@medplum/core 2.0.11 → 2.0.13

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.
@@ -6312,7 +6312,7 @@
6312
6312
  .replace('_', ' ')
6313
6313
  .replace(/\s+/g, ' ');
6314
6314
  }
6315
- const capitalizedWords = new Set(['ID', 'PKCE', 'JWKS', 'URI', 'URL']);
6315
+ const capitalizedWords = new Set(['ID', 'IP', 'PKCE', 'JWKS', 'URI', 'URL']);
6316
6316
  function capitalizeDisplayWord(word) {
6317
6317
  const upper = word.toUpperCase();
6318
6318
  if (capitalizedWords.has(upper)) {
@@ -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.11-16951901";
6373
+ const MEDPLUM_VERSION = "2.0.13-ee64d72c";
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
  *
@@ -7815,6 +7835,15 @@
7815
7835
  formBody.set('client_secret', clientSecret);
7816
7836
  return __classPrivateFieldGet(this, _MedplumClient_instances, "m", _MedplumClient_fetchTokens).call(this, formBody);
7817
7837
  }
7838
+ /**
7839
+ * Invite a user to a project.
7840
+ * @param projectId The project ID.
7841
+ * @param body The InviteBody.
7842
+ * @returns Promise that returns an invite result or an operation outcome.
7843
+ */
7844
+ async invite(projectId, body) {
7845
+ return this.post('admin/projects/' + projectId + '/invite', body);
7846
+ }
7818
7847
  }
7819
7848
  _MedplumClient_fetch = new WeakMap(), _MedplumClient_createPdf = new WeakMap(), _MedplumClient_storage = new WeakMap(), _MedplumClient_requestCache = new WeakMap(), _MedplumClient_cacheTime = new WeakMap(), _MedplumClient_baseUrl = new WeakMap(), _MedplumClient_fhirBaseUrl = new WeakMap(), _MedplumClient_authorizeUrl = new WeakMap(), _MedplumClient_tokenUrl = new WeakMap(), _MedplumClient_logoutUrl = new WeakMap(), _MedplumClient_onUnauthenticated = new WeakMap(), _MedplumClient_autoBatchTime = new WeakMap(), _MedplumClient_autoBatchQueue = new WeakMap(), _MedplumClient_clientId = new WeakMap(), _MedplumClient_clientSecret = new WeakMap(), _MedplumClient_autoBatchTimerId = new WeakMap(), _MedplumClient_accessToken = new WeakMap(), _MedplumClient_refreshToken = new WeakMap(), _MedplumClient_refreshPromise = new WeakMap(), _MedplumClient_profilePromise = new WeakMap(), _MedplumClient_profile = new WeakMap(), _MedplumClient_config = new WeakMap(), _MedplumClient_instances = new WeakSet(), _MedplumClient_addLogin = function _MedplumClient_addLogin(newLogin) {
7820
7849
  const logins = this.getLogins().filter((login) => login.profile?.reference !== newLogin.profile?.reference);
@@ -10231,13 +10260,22 @@
10231
10260
  if (ref.resource) {
10232
10261
  return toTypedValue(ref.resource);
10233
10262
  }
10234
- refStr = ref.reference;
10263
+ if (ref.reference) {
10264
+ refStr = ref.reference;
10265
+ }
10266
+ else if (ref.type && ref.identifier) {
10267
+ refStr = `${ref.type}?identifier=${ref.identifier.system}|${ref.identifier.value}`;
10268
+ }
10269
+ }
10270
+ if (refStr?.includes('?')) {
10271
+ const [resourceType] = refStr.split('?');
10272
+ return { type: resourceType, value: { resourceType } };
10235
10273
  }
10236
- if (!refStr) {
10237
- return { type: exports.PropertyType.BackboneElement, value: null };
10274
+ if (refStr?.includes('/')) {
10275
+ const [resourceType, id] = refStr.split('/');
10276
+ return { type: resourceType, value: { resourceType, id } };
10238
10277
  }
10239
- const [resourceType, id] = refStr.split('/');
10240
- return { type: exports.PropertyType.BackboneElement, value: { resourceType, id } };
10278
+ return { type: exports.PropertyType.BackboneElement, value: undefined };
10241
10279
  })
10242
10280
  .filter((e) => !!e.value);
10243
10281
  },
@@ -10382,8 +10420,8 @@
10382
10420
  }
10383
10421
  class SymbolAtom {
10384
10422
  constructor(name) {
10385
- this.name = name;
10386
10423
  _SymbolAtom_instances.add(this);
10424
+ this.name = name;
10387
10425
  }
10388
10426
  eval(context) {
10389
10427
  if (this.name === '$this') {
@@ -10827,8 +10865,8 @@
10827
10865
  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
10866
  class StructureMapParser {
10829
10867
  constructor(parser) {
10830
- this.parser = parser;
10831
10868
  _StructureMapParser_instances.add(this);
10869
+ this.parser = parser;
10832
10870
  this.structureMap = { resourceType: 'StructureMap' };
10833
10871
  }
10834
10872
  parse() {
@@ -11645,6 +11683,10 @@
11645
11683
  }
11646
11684
  }
11647
11685
  else {
11686
+ if (Array.isArray(value)) {
11687
+ __classPrivateFieldGet(this, _FhirSchemaValidator_issues, "f").push(createStructureIssue(path, 'Expected single value for property'));
11688
+ return;
11689
+ }
11648
11690
  __classPrivateFieldGet(this, _FhirSchemaValidator_instances, "m", _FhirSchemaValidator_checkPropertyValue).call(this, path, elementDefinition, value);
11649
11691
  }
11650
11692
  }, _FhirSchemaValidator_checkPropertyValue = function _FhirSchemaValidator_checkPropertyValue(path, elementDefinition, typedValue) {
@@ -11821,6 +11863,7 @@
11821
11863
  SearchParameterType["DATE"] = "DATE";
11822
11864
  SearchParameterType["DATETIME"] = "DATETIME";
11823
11865
  SearchParameterType["PERIOD"] = "PERIOD";
11866
+ SearchParameterType["UUID"] = "UUID";
11824
11867
  })(exports.SearchParameterType || (exports.SearchParameterType = {}));
11825
11868
  /**
11826
11869
  * Returns the type details of a SearchParameter.
@@ -12104,6 +12147,9 @@
12104
12147
  searchRequest.total = 'estimate';
12105
12148
  searchRequest.count = 0;
12106
12149
  break;
12150
+ case '_include':
12151
+ searchRequest.include = value;
12152
+ break;
12107
12153
  case '_revinclude':
12108
12154
  searchRequest.revInclude = value;
12109
12155
  break;
@@ -12300,6 +12346,7 @@
12300
12346
  case 'reference':
12301
12347
  return matchesReferenceFilter(resource, filter, searchParam);
12302
12348
  case 'string':
12349
+ case 'uri':
12303
12350
  return matchesStringFilter(resource, filter, searchParam);
12304
12351
  case 'token':
12305
12352
  return matchesTokenFilter(resource, filter, searchParam);