@medplum/core 2.0.10 → 2.0.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -6370,7 +6370,7 @@
6370
6370
  // PKCE auth based on:
6371
6371
  // https://aws.amazon.com/blogs/security/how-to-add-authentication-single-page-web-application-with-amazon-cognito-oauth2-implementation/
6372
6372
  var _MedplumClient_instances, _MedplumClient_fetch, _MedplumClient_createPdf, _MedplumClient_storage, _MedplumClient_requestCache, _MedplumClient_cacheTime, _MedplumClient_baseUrl, _MedplumClient_fhirBaseUrl, _MedplumClient_authorizeUrl, _MedplumClient_tokenUrl, _MedplumClient_logoutUrl, _MedplumClient_onUnauthenticated, _MedplumClient_autoBatchTime, _MedplumClient_autoBatchQueue, _MedplumClient_clientId, _MedplumClient_clientSecret, _MedplumClient_autoBatchTimerId, _MedplumClient_accessToken, _MedplumClient_refreshToken, _MedplumClient_refreshPromise, _MedplumClient_profilePromise, _MedplumClient_profile, _MedplumClient_config, _MedplumClient_addLogin, _MedplumClient_refreshProfile, _MedplumClient_getCacheEntry, _MedplumClient_setCacheEntry, _MedplumClient_cacheResource, _MedplumClient_deleteCacheEntry, _MedplumClient_request, _MedplumClient_fetchWithRetry, _MedplumClient_executeAutoBatch, _MedplumClient_addFetchOptionsDefaults, _MedplumClient_setRequestContentType, _MedplumClient_setRequestBody, _MedplumClient_handleUnauthenticated, _MedplumClient_requestAuthorization, _MedplumClient_refresh, _MedplumClient_fetchTokens, _MedplumClient_verifyTokens, _MedplumClient_setupStorageListener;
6373
- const MEDPLUM_VERSION = "2.0.10-20b3fb40";
6373
+ const MEDPLUM_VERSION = "2.0.12-b25d6c05";
6374
6374
  const DEFAULT_BASE_URL = 'https://api.medplum.com/';
6375
6375
  const DEFAULT_RESOURCE_CACHE_SIZE = 1000;
6376
6376
  const DEFAULT_CACHE_TIME = 60000; // 60 seconds
@@ -6925,7 +6925,7 @@
6925
6925
  * @param resourceType The FHIR resource type.
6926
6926
  * @param query Optional FHIR search query or structured query object. Can be any valid input to the URLSearchParams() constructor.
6927
6927
  * @param options Optional fetch options.
6928
- * @returns Promise to the search result bundle.
6928
+ * @returns Promise to the first search result.
6929
6929
  */
6930
6930
  searchOne(resourceType, query, options = {}) {
6931
6931
  const url = this.fhirSearchUrl(resourceType, query);
@@ -6960,7 +6960,7 @@
6960
6960
  * @param resourceType The FHIR resource type.
6961
6961
  * @param query Optional FHIR search query or structured query object. Can be any valid input to the URLSearchParams() constructor.
6962
6962
  * @param options Optional fetch options.
6963
- * @returns Promise to the search result bundle.
6963
+ * @returns Promise to the array of search results.
6964
6964
  */
6965
6965
  searchResources(resourceType, query, options = {}) {
6966
6966
  const url = this.fhirSearchUrl(resourceType, query);
@@ -7523,6 +7523,26 @@
7523
7523
  validateResource(resource) {
7524
7524
  return this.post(this.fhirUrl(resource.resourceType, '$validate'), resource);
7525
7525
  }
7526
+ /**
7527
+ * Executes a bot by ID or Identifier.
7528
+ * @param idOrIdentifier The Bot ID or Identifier.
7529
+ * @param body The content body. Strings and `File` objects are passed directly. Other objects are converted to JSON.
7530
+ * @param contentType The content type to be included in the "Content-Type" header.
7531
+ * @param options Optional fetch options.
7532
+ * @returns The Bot return value.
7533
+ */
7534
+ executeBot(idOrIdentifier, body, contentType, options = {}) {
7535
+ let url;
7536
+ if (typeof idOrIdentifier === 'string') {
7537
+ const id = idOrIdentifier;
7538
+ url = this.fhirUrl('Bot', id, '$execute');
7539
+ }
7540
+ else {
7541
+ const identifier = idOrIdentifier;
7542
+ url = this.fhirUrl('Bot', '$execute') + `?identifier=${identifier.system}|${identifier.value}`;
7543
+ }
7544
+ return this.post(url, body, contentType, options);
7545
+ }
7526
7546
  /**
7527
7547
  * Executes a batch or transaction of FHIR operations.
7528
7548
  *
@@ -10231,13 +10251,22 @@
10231
10251
  if (ref.resource) {
10232
10252
  return toTypedValue(ref.resource);
10233
10253
  }
10234
- refStr = ref.reference;
10254
+ if (ref.reference) {
10255
+ refStr = ref.reference;
10256
+ }
10257
+ else if (ref.type && ref.identifier) {
10258
+ refStr = `${ref.type}?identifier=${ref.identifier.system}|${ref.identifier.value}`;
10259
+ }
10260
+ }
10261
+ if (refStr?.includes('?')) {
10262
+ const [resourceType] = refStr.split('?');
10263
+ return { type: resourceType, value: { resourceType } };
10235
10264
  }
10236
- if (!refStr) {
10237
- return { type: exports.PropertyType.BackboneElement, value: null };
10265
+ if (refStr?.includes('/')) {
10266
+ const [resourceType, id] = refStr.split('/');
10267
+ return { type: resourceType, value: { resourceType, id } };
10238
10268
  }
10239
- const [resourceType, id] = refStr.split('/');
10240
- return { type: exports.PropertyType.BackboneElement, value: { resourceType, id } };
10269
+ return { type: exports.PropertyType.BackboneElement, value: undefined };
10241
10270
  })
10242
10271
  .filter((e) => !!e.value);
10243
10272
  },
@@ -10382,8 +10411,8 @@
10382
10411
  }
10383
10412
  class SymbolAtom {
10384
10413
  constructor(name) {
10385
- this.name = name;
10386
10414
  _SymbolAtom_instances.add(this);
10415
+ this.name = name;
10387
10416
  }
10388
10417
  eval(context) {
10389
10418
  if (this.name === '$this') {
@@ -10827,8 +10856,8 @@
10827
10856
  var _StructureMapParser_instances, _StructureMapParser_parseUses, _StructureMapParser_parseImport, _StructureMapParser_parseGroup, _StructureMapParser_parseParameters, _StructureMapParser_parseParameter, _StructureMapParser_parseRules, _StructureMapParser_parseRule, _StructureMapParser_parseRuleSources, _StructureMapParser_parseRuleSource, _StructureMapParser_parseRuleTargets, _StructureMapParser_parseRuleTarget, _StructureMapParser_parseRuleTargetTransform, _StructureMapParser_parseRuleTargetSymbol, _StructureMapParser_parseRuleTargetFunction, _StructureMapParser_parseRuleTargetLiteral, _StructureMapParser_parseRuleContext, _StructureMapParser_parseRuleDependents, _StructureMapParser_parseConceptMap;
10828
10857
  class StructureMapParser {
10829
10858
  constructor(parser) {
10830
- this.parser = parser;
10831
10859
  _StructureMapParser_instances.add(this);
10860
+ this.parser = parser;
10832
10861
  this.structureMap = { resourceType: 'StructureMap' };
10833
10862
  }
10834
10863
  parse() {
@@ -11821,6 +11850,7 @@
11821
11850
  SearchParameterType["DATE"] = "DATE";
11822
11851
  SearchParameterType["DATETIME"] = "DATETIME";
11823
11852
  SearchParameterType["PERIOD"] = "PERIOD";
11853
+ SearchParameterType["UUID"] = "UUID";
11824
11854
  })(exports.SearchParameterType || (exports.SearchParameterType = {}));
11825
11855
  /**
11826
11856
  * Returns the type details of a SearchParameter.
@@ -12262,7 +12292,7 @@
12262
12292
  }
12263
12293
  function formatFilter(filter) {
12264
12294
  const modifier = filter.operator in MODIFIER_OPERATORS ? ':' + filter.operator : '';
12265
- const prefix = filter.operator != exports.Operator.EQUALS && filter.operator in PREFIX_OPERATORS ? filter.operator : '';
12295
+ const prefix = filter.operator !== exports.Operator.EQUALS && filter.operator in PREFIX_OPERATORS ? filter.operator : '';
12266
12296
  return `${filter.code}${modifier}=${prefix}${encodeURIComponent(filter.value)}`;
12267
12297
  }
12268
12298
  function formatSortRules(sortRules) {