@medplum/core 5.1.3 → 5.1.5

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.
@@ -719,11 +719,31 @@ export declare interface Code {
719
719
  code?: CodeableConcept;
720
720
  }
721
721
 
722
+ /**
723
+ * Checks if a CodeableConcept matches a token search string
724
+ * https://build.fhir.org/search.html#token
725
+ *
726
+ * @param codeableConcept - The CodeableConcept to test
727
+ * @param token - The token string to test
728
+ * @returns True if the CodeableConcept matches the token
729
+ */
730
+ export declare function codeableConceptMatchesToken(codeableConcept: CodeableConcept, token: string): boolean;
731
+
722
732
  /**
723
733
  * Allowed values for `code_challenge_method` in a PKCE exchange.
724
734
  */
725
735
  export declare type CodeChallengeMethod = 'plain' | 'S256';
726
736
 
737
+ /**
738
+ * Checks if a Coding matches a token search string
739
+ * https://build.fhir.org/search.html#token
740
+ *
741
+ * @param coding - The Coding to test
742
+ * @param token - The token string to test
743
+ * @returns True if the Coding matches the token
744
+ */
745
+ export declare function codingMatchesToken(coding: Coding, token: string): boolean;
746
+
727
747
  export declare function compressElement(element: InternalSchemaElement): Partial<InternalSchemaElement>;
728
748
 
729
749
  export declare class ConcatAtom extends InfixOperatorAtom {
@@ -989,6 +1009,8 @@ export declare function createReference<T extends Resource>(resource: T): Refere
989
1009
 
990
1010
  export declare function createStructureIssue(expression: string, details: string): OperationOutcomeIssue;
991
1011
 
1012
+ export declare type CriteriaState = 'idle' | 'connecting' | 'active' | 'refreshing' | 'removed';
1013
+
992
1014
  export declare type CurrentContext<T extends FhircastAnchorResourceType | '' = FhircastAnchorResourceType | ''> = T extends '' ? {
993
1015
  'context.type': '';
994
1016
  context: never[];
@@ -3509,6 +3531,7 @@ export declare class MedplumClient extends TypedEventTarget<MedplumClientEventMa
3509
3531
  private readonly onUnauthenticated?;
3510
3532
  private readonly autoBatchTime;
3511
3533
  private readonly autoBatchQueue;
3534
+ private readonly maxRetries;
3512
3535
  private readonly maxRetryTime;
3513
3536
  private readonly refreshGracePeriod;
3514
3537
  private subscriptionManager?;
@@ -5301,6 +5324,17 @@ export declare interface MedplumClientOptions {
5301
5324
  * Default value is `2000` (2 seconds).
5302
5325
  */
5303
5326
  maxRetryTime?: number;
5327
+ /**
5328
+ * The maximum number of retries for failed requests.
5329
+ *
5330
+ * When the client encounters a retryable response (HTTP 429 or 5xx), it will automatically retry the request.
5331
+ * This setting defines the maximum number of retry attempts.
5332
+ *
5333
+ * This can be overridden per-request using the `maxRetries` option in `MedplumRequestOptions`.
5334
+ *
5335
+ * Default value is `2`.
5336
+ */
5337
+ maxRetries?: number;
5304
5338
  /**
5305
5339
  * The refresh grace period in milliseconds.
5306
5340
  *
@@ -7113,20 +7147,30 @@ export declare class ParserBuilder {
7113
7147
  private currentProfile;
7114
7148
  constructor(medplum: MedplumClient, wsUrl: URL | string, options?: SubManagerOptions);
7115
7149
  private setupListeners;
7150
+ private sendBind;
7151
+ private sendUnbind;
7116
7152
  private emitError;
7117
7153
  private maybeEmitDisconnect;
7118
- private getTokenForCriteria;
7154
+ private isStale;
7119
7155
  private maybeGetCriteriaEntry;
7120
7156
  private getAllCriteriaEmitters;
7121
7157
  private addCriteriaEntry;
7122
7158
  private removeCriteriaEntry;
7123
7159
  private subscribeToCriteria;
7124
7160
  private refreshAllSubscriptions;
7125
- private isReconnecting;
7126
7161
  private rebindCriteriaEntry;
7127
7162
  private checkTokenExpirations;
7128
7163
  addCriteria(criteria: string, subscriptionProps?: Partial<Subscription>): SubscriptionEmitter;
7129
7164
  removeCriteria(criteria: string, subscriptionProps?: Partial<Subscription>): void;
7165
+ /**
7166
+ * Garbage-collects criteria entries whose refCount has been 0 for longer than the grace period.
7167
+ * For each such entry, emits a disconnect event and performs the full removal
7168
+ * (unbind-from-token, map cleanup).
7169
+ *
7170
+ * Called automatically on the ping and token-refresh timers.
7171
+ */
7172
+ private gcUnrefEntries;
7173
+ private isEntryGettingRemoved;
7130
7174
  getWebSocket(): IReconnectingWebSocket;
7131
7175
  closeWebSocket(): void;
7132
7176
  reconnectWebSocket(): void;
@@ -719,11 +719,31 @@ export declare interface Code {
719
719
  code?: CodeableConcept;
720
720
  }
721
721
 
722
+ /**
723
+ * Checks if a CodeableConcept matches a token search string
724
+ * https://build.fhir.org/search.html#token
725
+ *
726
+ * @param codeableConcept - The CodeableConcept to test
727
+ * @param token - The token string to test
728
+ * @returns True if the CodeableConcept matches the token
729
+ */
730
+ export declare function codeableConceptMatchesToken(codeableConcept: CodeableConcept, token: string): boolean;
731
+
722
732
  /**
723
733
  * Allowed values for `code_challenge_method` in a PKCE exchange.
724
734
  */
725
735
  export declare type CodeChallengeMethod = 'plain' | 'S256';
726
736
 
737
+ /**
738
+ * Checks if a Coding matches a token search string
739
+ * https://build.fhir.org/search.html#token
740
+ *
741
+ * @param coding - The Coding to test
742
+ * @param token - The token string to test
743
+ * @returns True if the Coding matches the token
744
+ */
745
+ export declare function codingMatchesToken(coding: Coding, token: string): boolean;
746
+
727
747
  export declare function compressElement(element: InternalSchemaElement): Partial<InternalSchemaElement>;
728
748
 
729
749
  export declare class ConcatAtom extends InfixOperatorAtom {
@@ -989,6 +1009,8 @@ export declare function createReference<T extends Resource>(resource: T): Refere
989
1009
 
990
1010
  export declare function createStructureIssue(expression: string, details: string): OperationOutcomeIssue;
991
1011
 
1012
+ export declare type CriteriaState = 'idle' | 'connecting' | 'active' | 'refreshing' | 'removed';
1013
+
992
1014
  export declare type CurrentContext<T extends FhircastAnchorResourceType | '' = FhircastAnchorResourceType | ''> = T extends '' ? {
993
1015
  'context.type': '';
994
1016
  context: never[];
@@ -3509,6 +3531,7 @@ export declare class MedplumClient extends TypedEventTarget<MedplumClientEventMa
3509
3531
  private readonly onUnauthenticated?;
3510
3532
  private readonly autoBatchTime;
3511
3533
  private readonly autoBatchQueue;
3534
+ private readonly maxRetries;
3512
3535
  private readonly maxRetryTime;
3513
3536
  private readonly refreshGracePeriod;
3514
3537
  private subscriptionManager?;
@@ -5301,6 +5324,17 @@ export declare interface MedplumClientOptions {
5301
5324
  * Default value is `2000` (2 seconds).
5302
5325
  */
5303
5326
  maxRetryTime?: number;
5327
+ /**
5328
+ * The maximum number of retries for failed requests.
5329
+ *
5330
+ * When the client encounters a retryable response (HTTP 429 or 5xx), it will automatically retry the request.
5331
+ * This setting defines the maximum number of retry attempts.
5332
+ *
5333
+ * This can be overridden per-request using the `maxRetries` option in `MedplumRequestOptions`.
5334
+ *
5335
+ * Default value is `2`.
5336
+ */
5337
+ maxRetries?: number;
5304
5338
  /**
5305
5339
  * The refresh grace period in milliseconds.
5306
5340
  *
@@ -7113,20 +7147,30 @@ export declare class ParserBuilder {
7113
7147
  private currentProfile;
7114
7148
  constructor(medplum: MedplumClient, wsUrl: URL | string, options?: SubManagerOptions);
7115
7149
  private setupListeners;
7150
+ private sendBind;
7151
+ private sendUnbind;
7116
7152
  private emitError;
7117
7153
  private maybeEmitDisconnect;
7118
- private getTokenForCriteria;
7154
+ private isStale;
7119
7155
  private maybeGetCriteriaEntry;
7120
7156
  private getAllCriteriaEmitters;
7121
7157
  private addCriteriaEntry;
7122
7158
  private removeCriteriaEntry;
7123
7159
  private subscribeToCriteria;
7124
7160
  private refreshAllSubscriptions;
7125
- private isReconnecting;
7126
7161
  private rebindCriteriaEntry;
7127
7162
  private checkTokenExpirations;
7128
7163
  addCriteria(criteria: string, subscriptionProps?: Partial<Subscription>): SubscriptionEmitter;
7129
7164
  removeCriteria(criteria: string, subscriptionProps?: Partial<Subscription>): void;
7165
+ /**
7166
+ * Garbage-collects criteria entries whose refCount has been 0 for longer than the grace period.
7167
+ * For each such entry, emits a disconnect event and performs the full removal
7168
+ * (unbind-from-token, map cleanup).
7169
+ *
7170
+ * Called automatically on the ping and token-refresh timers.
7171
+ */
7172
+ private gcUnrefEntries;
7173
+ private isEntryGettingRemoved;
7130
7174
  getWebSocket(): IReconnectingWebSocket;
7131
7175
  closeWebSocket(): void;
7132
7176
  reconnectWebSocket(): void;