When fetching a Bundle
, you are typically only interested in the
included resources which are located at {response}.entry[N].resource
.
If this option is set to true
, the returned result will be an array of
resources instead of the whole bundle. This is especially useful when
multiple pages are fetched, because an array of page bundles is not that
useful and will often have to be converted to array of resources that is
easier to iterate.
onPage
callback with flat: true
, it will receive that
array of resources instead of the page bundle.onPage
, which will be called with one array for each page).false
.Bundle.entry
is optional in FHIR and that leads to bugs in
apps that assume that it is always present. With flat: true
, you will
always get an array, even if it is empty, and even if no entry
is
found in the response bundle.Only applicable if you use resolveReferences
. If false
, the resolved
references will not be "mounted" in the result tree, but will be returned
as separate map object instead. Defaults to true
.
When you request a Bundle, the result will typically come back in pages
and you will only get the first page. You can use pageLimit
greater
than 1
to request multiple pages. For example pageLimit: 3
will fetch
the first 3 pages as array. To fetch all the available pages you can set
this to 0
.
1
.Bundle
.One or more references to resolve. Single item can be specified as a string or as an array of one string. Multiple items must be specified as array.
context.serviceProvider
will look for {Response}.context.serviceProvider.reference
.generalPractitioner.0
).
If the index is not specified, all the references in the array will be
resolved.["subject", "encounter.serviceProvider", "encounter"]
,
the library should figure out that encounter.serviceProvider
must be
fetched after encounter
. In fact, in this case it will first fetch
subject and encounter in parallel, and then proceed to encounter.serviceProvider.If the client is authorized, it will possess an access token and pass it
with the requests it makes. When that token expires, you should get back
a 401 Unauthorized
response. When that happens, if the client also has
a refresh token and if useRefreshToken
is true
(default), the client
will attempt to automatically re-authorize itself and then it will re-run
the failed request and eventually resolve it's promise with the final
result. This means that your requests should never fail with 401
,
unless the refresh token is also expired. If you don't want this, you can
set useRefreshToken
to false
. There is a refresh
method on the
client that can be called manually to renew the access token.
true
.When you fetch multiple pages the resulting array may be very large,
requiring a lot of time and memory. It is often better if you specify a
page callback instead. The onPage
callback will be called once for each
page with the page Bundle as it's argument. If you use resolveReferences
and graph: false
, the references will be passed to onPage
as second
argument.
onPage
returns a promise it will be awaited for, meaning that no
more pages will be fetched until the onPage
promise is resolved.onPage
returns a rejected promise or throws an error, the client
will not continue fetching more pages.onPage
callback, the promise returned by request()
will
be resolved with null
. This is to avoid building that huge array in
memory. By using the onPage
option you are stating that you will
handle the result one page at a time, instead of expecting to receive
the big combined result.Depending in the other options can be Bundle
, Bundle[]
,
Resource[]
Map of resolved references. Only available if the graph
option is set to false
Generated using TypeDoc
Additional options that can be passed to
client.request
to control its behavior