@medplum/core 5.2.15 → 5.2.17

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.
@@ -1281,6 +1281,27 @@ export declare function createReference<T extends Resource>(resource: T): Refere
1281
1281
  reference: string;
1282
1282
  };
1283
1283
 
1284
+ /**
1285
+ * Creates a MedplumClient that serves reads from the given resources and never touches the network.
1286
+ *
1287
+ * Use it to render Medplum React components from data gathered up front:
1288
+ *
1289
+ * ```tsx
1290
+ * const medplum = createStaticClient([report, patient, ...observations]);
1291
+ * <MedplumProvider medplum={medplum}>
1292
+ * <DiagnosticReportDisplay value={report} />
1293
+ * </MedplumProvider>
1294
+ * ```
1295
+ *
1296
+ * Only reads by type and id (`GET [base]/Type/id`) are supported. A read of a resource not in the
1297
+ * list fails with "Not found", the same as a real server. Any other request, such as a search or a
1298
+ * write, fails with "Bad request".
1299
+ * @param resources - The resources to serve.
1300
+ * @param options - Optional client options. `fetch`, `storage`, and `autoBatchTime` are always replaced.
1301
+ * @returns The client.
1302
+ */
1303
+ export declare function createStaticClient(resources: Resource[], options?: MedplumClientOptions): MedplumClient;
1304
+
1284
1305
  export declare function createStructureIssue(expression: string, details: string): OperationOutcomeIssue;
1285
1306
 
1286
1307
  /**
@@ -4013,6 +4034,25 @@ export declare function isUUID(input: string): input is string;
4013
4034
  */
4014
4035
  export declare function isValidCalendarDate(str: string): boolean;
4015
4036
 
4037
+ /**
4038
+ * Returns true if the input is a cron expression the Medplum job scheduler can run.
4039
+ *
4040
+ * Accepts what cron-parser accepts in its default, non-strict mode -- the `@daily`-style shorthands, month and weekday
4041
+ * names, and the `L`, `#`, and `?` extensions -- with these restrictions:
4042
+ *
4043
+ * - The empty string, which cron-parser reads as every minute but BullMQ refuses as a missing pattern, is rejected.
4044
+ * - An expression BullMQ cannot compute a next run for is rejected, since it would silently schedule nothing: one
4045
+ * that can never fire, such as `0 0 31 4,6 *`, or the 5th weekday of February, such as `0 0 * 2 1#5`.
4046
+ * - Schedules are limited to minute granularity, so the optional sixth (seconds) field and `@secondly` are rejected.
4047
+ * - `H` (hashed) terms are rejected. They exist to stagger jobs that share a schedule; leaving them out keeps
4048
+ * staggering an implementation detail of the scheduler and keeps the syntax authors of `Cron` and `Bot` resources
4049
+ * must learn small. cron-parser also draws them at random, so one expression could pass on one parse and fail on
4050
+ * the next.
4051
+ * @param cronString - The cron expression to check.
4052
+ * @returns True if the cron expression is valid.
4053
+ */
4054
+ export declare function isValidCronString(cronString: string): boolean;
4055
+
4016
4056
  /**
4017
4057
  * Returns true if the given date object is a valid date.
4018
4058
  * Dates can be invalid if created by parsing an invalid string.
@@ -1281,6 +1281,27 @@ export declare function createReference<T extends Resource>(resource: T): Refere
1281
1281
  reference: string;
1282
1282
  };
1283
1283
 
1284
+ /**
1285
+ * Creates a MedplumClient that serves reads from the given resources and never touches the network.
1286
+ *
1287
+ * Use it to render Medplum React components from data gathered up front:
1288
+ *
1289
+ * ```tsx
1290
+ * const medplum = createStaticClient([report, patient, ...observations]);
1291
+ * <MedplumProvider medplum={medplum}>
1292
+ * <DiagnosticReportDisplay value={report} />
1293
+ * </MedplumProvider>
1294
+ * ```
1295
+ *
1296
+ * Only reads by type and id (`GET [base]/Type/id`) are supported. A read of a resource not in the
1297
+ * list fails with "Not found", the same as a real server. Any other request, such as a search or a
1298
+ * write, fails with "Bad request".
1299
+ * @param resources - The resources to serve.
1300
+ * @param options - Optional client options. `fetch`, `storage`, and `autoBatchTime` are always replaced.
1301
+ * @returns The client.
1302
+ */
1303
+ export declare function createStaticClient(resources: Resource[], options?: MedplumClientOptions): MedplumClient;
1304
+
1284
1305
  export declare function createStructureIssue(expression: string, details: string): OperationOutcomeIssue;
1285
1306
 
1286
1307
  /**
@@ -4013,6 +4034,25 @@ export declare function isUUID(input: string): input is string;
4013
4034
  */
4014
4035
  export declare function isValidCalendarDate(str: string): boolean;
4015
4036
 
4037
+ /**
4038
+ * Returns true if the input is a cron expression the Medplum job scheduler can run.
4039
+ *
4040
+ * Accepts what cron-parser accepts in its default, non-strict mode -- the `@daily`-style shorthands, month and weekday
4041
+ * names, and the `L`, `#`, and `?` extensions -- with these restrictions:
4042
+ *
4043
+ * - The empty string, which cron-parser reads as every minute but BullMQ refuses as a missing pattern, is rejected.
4044
+ * - An expression BullMQ cannot compute a next run for is rejected, since it would silently schedule nothing: one
4045
+ * that can never fire, such as `0 0 31 4,6 *`, or the 5th weekday of February, such as `0 0 * 2 1#5`.
4046
+ * - Schedules are limited to minute granularity, so the optional sixth (seconds) field and `@secondly` are rejected.
4047
+ * - `H` (hashed) terms are rejected. They exist to stagger jobs that share a schedule; leaving them out keeps
4048
+ * staggering an implementation detail of the scheduler and keeps the syntax authors of `Cron` and `Bot` resources
4049
+ * must learn small. cron-parser also draws them at random, so one expression could pass on one parse and fail on
4050
+ * the next.
4051
+ * @param cronString - The cron expression to check.
4052
+ * @returns True if the cron expression is valid.
4053
+ */
4054
+ export declare function isValidCronString(cronString: string): boolean;
4055
+
4016
4056
  /**
4017
4057
  * Returns true if the given date object is a valid date.
4018
4058
  * Dates can be invalid if created by parsing an invalid string.