@medplum/core 2.1.12 → 2.1.14

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.
package/dist/types.d.ts CHANGED
@@ -375,6 +375,12 @@ export declare function createReference<T extends Resource>(resource: T): Refere
375
375
 
376
376
  export declare function createStructureIssue(expression: string, details: string): OperationOutcomeIssue;
377
377
 
378
+ export declare type CurrentContext<EventName extends FhircastResourceEventName = FhircastResourceEventName> = {
379
+ 'context.type': ResourceType | '';
380
+ 'context.versionId'?: string;
381
+ context: FhircastEventContext<EventName>[];
382
+ };
383
+
378
384
  /**
379
385
  * Decodes a base64 string.
380
386
  * Handles both browser and Node environments.
@@ -748,6 +754,8 @@ export declare type FhircastMultiResourceContext<EventName extends FhircastEvent
748
754
  resources: FhircastEventResource<EventName, K>[];
749
755
  };
750
756
 
757
+ export declare type FhircastResourceEventName = Exclude<FhircastEventName, 'syncerror'>;
758
+
751
759
  export declare type FhircastResourceType = (typeof FHIRCAST_RESOURCE_TYPES)[number];
752
760
 
753
761
  export declare type FhircastSingleResourceContext<EventName extends FhircastEventName = FhircastEventName, K extends FhircastEventContextKey<EventName> = FhircastEventContextKey<EventName>> = {
@@ -1254,14 +1262,9 @@ export declare interface GoogleLoginRequest extends BaseLoginRequest {
1254
1262
  /**
1255
1263
  * The Hl7Context class represents the parsing context for an HL7 message.
1256
1264
  *
1257
- * MSH-1:
1258
- * https://hl7-definition.caristix.com/v2/HL7v2.6/Fields/MSH.1
1259
- *
1260
- * MSH-2:
1261
- * https://hl7-definition.caristix.com/v2/HL7v2.6/Fields/MSH.2
1262
- *
1263
- * See this tutorial on MSH, and why it's a bad idea to use anything other than the default values:
1264
- * https://www.hl7soup.com/HL7TutorialMSH.html
1265
+ * @see MSH-1: https://hl7-definition.caristix.com/v2/HL7v2.6/Fields/MSH.1
1266
+ * @see MSH-2: https://hl7-definition.caristix.com/v2/HL7v2.6/Fields/MSH.2
1267
+ * @see See this tutorial on MSH, and why it's a bad idea to use anything other than the default values: https://www.hl7soup.com/HL7TutorialMSH.html
1265
1268
  */
1266
1269
  export declare class Hl7Context {
1267
1270
  readonly segmentSeparator: string;
@@ -1536,9 +1539,7 @@ export declare interface IncludeTarget {
1536
1539
  * PropertySchema - one per property/field
1537
1540
  */
1538
1541
  export declare interface IndexedStructureDefinition {
1539
- types: {
1540
- [resourceType: string]: TypeInfo;
1541
- };
1542
+ types: Record<string, TypeInfo>;
1542
1543
  }
1543
1544
 
1544
1545
  export declare class IndexerAtom implements Atom {
@@ -1768,7 +1769,7 @@ export declare function isStringArray(arr: any[]): arr is string[];
1768
1769
  * @param input - The input string.
1769
1770
  * @returns True if the input string matches the UUID format.
1770
1771
  */
1771
- export declare function isUUID(input: string): input is `${string}-${string}-${string}-${string}-${string}`;
1772
+ export declare function isUUID(input: string): input is string;
1772
1773
 
1773
1774
  /**
1774
1775
  * Returns true if the given date object is a valid date.
@@ -1939,7 +1940,7 @@ export declare function matchesRange(value: number, range: Range_2, precision?:
1939
1940
  */
1940
1941
  export declare function matchesSearchRequest(resource: Resource, searchRequest: SearchRequest): boolean;
1941
1942
 
1942
- export declare const MEDPLUM_VERSION: string;
1943
+ export declare const MEDPLUM_VERSION: any;
1943
1944
 
1944
1945
  /**
1945
1946
  * The MedplumClient class provides a client for the Medplum FHIR server.
@@ -3173,7 +3174,7 @@ export declare class MedplumClient extends EventTarget_2 {
3173
3174
  *
3174
3175
  * @example
3175
3176
  * ```typescript
3176
- * await medplum.startClientLogin(process.env.MEDPLUM_CLIENT_ID, process.env.MEDPLUM_CLIENT_SECRET)
3177
+ * await medplum.startClientLogin(import.meta.env.MEDPLUM_CLIENT_ID, import.meta.env.MEDPLUM_CLIENT_SECRET)
3177
3178
  * // Example Search
3178
3179
  * await medplum.searchResources('Patient')
3179
3180
  * ```
@@ -3191,7 +3192,7 @@ export declare class MedplumClient extends EventTarget_2 {
3191
3192
  *
3192
3193
  * @example
3193
3194
  * ```typescript
3194
- * await medplum.startJwtBearerLogin(process.env.MEDPLUM_CLIENT_ID, process.env.MEDPLUM_JWT_BEARER_ASSERTION, 'openid profile');
3195
+ * await medplum.startJwtBearerLogin(import.meta.env.MEDPLUM_CLIENT_ID, import.meta.env.MEDPLUM_JWT_BEARER_ASSERTION, 'openid profile');
3195
3196
  * // Example Search
3196
3197
  * await medplum.searchResources('Patient')
3197
3198
  * ```
@@ -3220,7 +3221,7 @@ export declare class MedplumClient extends EventTarget_2 {
3220
3221
  *
3221
3222
  * @example
3222
3223
  * ```typescript
3223
- * medplum.setBasicAuth(process.env.MEDPLUM_CLIENT_ID, process.env.MEDPLUM_CLIENT_SECRET);
3224
+ * medplum.setBasicAuth(import.meta.env.MEDPLUM_CLIENT_ID, import.meta.env.MEDPLUM_CLIENT_SECRET);
3224
3225
  * // Example Search
3225
3226
  * await medplum.searchResources('Patient');
3226
3227
  * ```
@@ -3269,6 +3270,14 @@ export declare class MedplumClient extends EventTarget_2 {
3269
3270
  */
3270
3271
  fhircastPublish<EventName extends FhircastEventVersionOptional>(topic: string, event: EventName, context: FhircastEventContext<EventName> | FhircastEventContext<EventName>[], versionId?: never): Promise<void>;
3271
3272
  fhircastPublish<RequiredVersionEvent extends FhircastEventVersionRequired>(topic: string, event: RequiredVersionEvent, context: FhircastEventContext<RequiredVersionEvent> | FhircastEventContext<RequiredVersionEvent>[], versionId: string): Promise<void>;
3273
+ /**
3274
+ * Gets the current context of the given FHIRcast `topic`.
3275
+ *
3276
+ * @category FHIRcast
3277
+ * @param topic - The topic to get the current context for. Usually a UUID.
3278
+ * @returns A Promise which resolves to the `CurrentContext` for the given topic.
3279
+ */
3280
+ fhircastGetContext(topic: string): Promise<CurrentContext>;
3272
3281
  /**
3273
3282
  * Invite a user to a project.
3274
3283
  * @param projectId - The project ID.
@@ -3953,8 +3962,16 @@ export declare function parseSearchUrl<T extends Resource = Resource>(url: URL):
3953
3962
  export declare function parseStructureDefinition(sd: StructureDefinition): InternalTypeSchema;
3954
3963
 
3955
3964
  /**
3956
- * Parses an extended FHIR search criteria string (i.e. application/x-fhir-query), evaluating
3957
- * any embedded FHIRPath subexpressions (e.g. `{{ %patient.id }}`) with the provided variables.
3965
+ * Parses an extended FHIR search criteria string (i.e. application/x-fhir-query).
3966
+ *
3967
+ * @example Evaluating a FHIRPath subexpression
3968
+ *
3969
+ * ```typescript
3970
+ * const query = 'Patient?name={{ %patient.name }}';
3971
+ * const variables = { patient: { name: 'John Doe' } };
3972
+ * const request = parseXFhirQuery(query, variables);
3973
+ * console.log(request.filters[0].value); // "John Doe"
3974
+ * ```
3958
3975
  *
3959
3976
  * @see https://hl7.org/fhir/fhir-xquery.html
3960
3977
  * @param query - The X-Fhir-Query string to parse
@@ -4501,12 +4518,8 @@ export declare interface TypedValue {
4501
4518
  * 4) Patient_Link
4502
4519
  */
4503
4520
  export declare interface TypeInfo {
4504
- searchParams?: {
4505
- [code: string]: SearchParameter;
4506
- };
4507
- searchParamsDetails?: {
4508
- [code: string]: SearchParameterDetails;
4509
- };
4521
+ searchParams?: Record<string, SearchParameter>;
4522
+ searchParamsDetails?: Record<string, SearchParameterDetails>;
4510
4523
  }
4511
4524
 
4512
4525
  export declare type TypeName<T> = T extends string ? 'string' : T extends number ? 'number' : T extends boolean ? 'boolean' : T extends undefined ? 'undefined' : 'object';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@medplum/core",
3
- "version": "2.1.12",
3
+ "version": "2.1.14",
4
4
  "description": "Medplum TS/JS Library",
5
5
  "keywords": [
6
6
  "medplum",
@@ -25,6 +25,7 @@
25
25
  },
26
26
  "license": "Apache-2.0",
27
27
  "author": "Medplum <hello@medplum.com>",
28
+ "type": "module",
28
29
  "sideEffects": false,
29
30
  "exports": {
30
31
  "types": "./dist/types.d.ts",
@@ -44,6 +45,8 @@
44
45
  "devDependencies": {
45
46
  "@medplum/definitions": "*",
46
47
  "@medplum/fhirtypes": "*",
48
+ "@types/jest": "^29.5.5",
49
+ "jest": "^29.7.0",
47
50
  "jest-websocket-mock": "2.5.0"
48
51
  },
49
52
  "peerDependencies": {