@medplum/mock 3.0.3 → 3.0.4

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.
@@ -33,6 +33,9 @@ import { Slot } from '@medplum/fhirtypes';
33
33
  import { Specimen } from '@medplum/fhirtypes';
34
34
  import { StructureDefinition } from '@medplum/fhirtypes';
35
35
  import { Subscription } from '@medplum/fhirtypes';
36
+ import { SubscriptionEmitter } from '@medplum/core';
37
+ import { SubscriptionEventMap } from '@medplum/core';
38
+ import { SubscriptionManager } from '@medplum/core';
36
39
  import { Task } from '@medplum/fhirtypes';
37
40
  import type { TDocumentDefinitions } from 'pdfmake/interfaces';
38
41
  import type { TFontDictionary } from 'pdfmake/interfaces';
@@ -152,6 +155,7 @@ export declare class MockClient extends MedplumClient {
152
155
  activeLoginOverride?: LoginState;
153
156
  private agentAvailable;
154
157
  private readonly profile;
158
+ subManager: MockSubscriptionManager | undefined;
155
159
  constructor(clientOptions?: MockClientOptions);
156
160
  clear(): void;
157
161
  getProfile(): ProfileResource | undefined;
@@ -162,6 +166,10 @@ export declare class MockClient extends MedplumClient {
162
166
  createBinary(data: string | File | Blob | Uint8Array, filename: string | undefined, contentType: string, onProgress?: (e: ProgressEvent) => void): Promise<Binary>;
163
167
  pushToAgent(agent: Agent | Reference<Agent>, destination: Device | Reference<Device> | string, body: any, contentType?: string | undefined, _waitForResponse?: boolean | undefined, _options?: RequestInit | undefined): Promise<any>;
164
168
  setAgentAvailable(value: boolean): void;
169
+ getSubscriptionManager(): MockSubscriptionManager;
170
+ subscribeToCriteria(criteria: string): SubscriptionEmitter;
171
+ unsubscribeFromCriteria(criteria: string): void;
172
+ getMasterSubscriptionEmitter(): SubscriptionEmitter;
165
173
  }
166
174
 
167
175
  export declare interface MockClientOptions extends MedplumClientOptions {
@@ -197,6 +205,20 @@ export declare class MockFetchClient {
197
205
  private mockFhirHandler;
198
206
  }
199
207
 
208
+ export declare class MockSubscriptionManager extends SubscriptionManager {
209
+ emitters: Map<string, SubscriptionEmitter>;
210
+ counts: Map<string, number>;
211
+ masterEmitter: SubscriptionEmitter;
212
+ constructor(medplum: MedplumClient, _wsOrUrl: WebSocket | string);
213
+ addCriteria(criteria: string): SubscriptionEmitter;
214
+ removeCriteria(criteria: string): void;
215
+ closeWebSocket(): void;
216
+ getCriteriaCount(): number;
217
+ getMasterEmitter(): SubscriptionEmitter;
218
+ emitEventForCriteria<K extends keyof SubscriptionEventMap = keyof SubscriptionEventMap>(criteria: string, event: SubscriptionEventMap[K]): void;
219
+ getEmitter(criteria: string): SubscriptionEmitter | undefined;
220
+ }
221
+
200
222
  export declare type ProfileStructureDefinition = StructureDefinition & {
201
223
  url: string;
202
224
  name: string;
@@ -33,6 +33,9 @@ import { Slot } from '@medplum/fhirtypes';
33
33
  import { Specimen } from '@medplum/fhirtypes';
34
34
  import { StructureDefinition } from '@medplum/fhirtypes';
35
35
  import { Subscription } from '@medplum/fhirtypes';
36
+ import { SubscriptionEmitter } from '@medplum/core';
37
+ import { SubscriptionEventMap } from '@medplum/core';
38
+ import { SubscriptionManager } from '@medplum/core';
36
39
  import { Task } from '@medplum/fhirtypes';
37
40
  import type { TDocumentDefinitions } from 'pdfmake/interfaces';
38
41
  import type { TFontDictionary } from 'pdfmake/interfaces';
@@ -152,6 +155,7 @@ export declare class MockClient extends MedplumClient {
152
155
  activeLoginOverride?: LoginState;
153
156
  private agentAvailable;
154
157
  private readonly profile;
158
+ subManager: MockSubscriptionManager | undefined;
155
159
  constructor(clientOptions?: MockClientOptions);
156
160
  clear(): void;
157
161
  getProfile(): ProfileResource | undefined;
@@ -162,6 +166,10 @@ export declare class MockClient extends MedplumClient {
162
166
  createBinary(data: string | File | Blob | Uint8Array, filename: string | undefined, contentType: string, onProgress?: (e: ProgressEvent) => void): Promise<Binary>;
163
167
  pushToAgent(agent: Agent | Reference<Agent>, destination: Device | Reference<Device> | string, body: any, contentType?: string | undefined, _waitForResponse?: boolean | undefined, _options?: RequestInit | undefined): Promise<any>;
164
168
  setAgentAvailable(value: boolean): void;
169
+ getSubscriptionManager(): MockSubscriptionManager;
170
+ subscribeToCriteria(criteria: string): SubscriptionEmitter;
171
+ unsubscribeFromCriteria(criteria: string): void;
172
+ getMasterSubscriptionEmitter(): SubscriptionEmitter;
165
173
  }
166
174
 
167
175
  export declare interface MockClientOptions extends MedplumClientOptions {
@@ -197,6 +205,20 @@ export declare class MockFetchClient {
197
205
  private mockFhirHandler;
198
206
  }
199
207
 
208
+ export declare class MockSubscriptionManager extends SubscriptionManager {
209
+ emitters: Map<string, SubscriptionEmitter>;
210
+ counts: Map<string, number>;
211
+ masterEmitter: SubscriptionEmitter;
212
+ constructor(medplum: MedplumClient, _wsOrUrl: WebSocket | string);
213
+ addCriteria(criteria: string): SubscriptionEmitter;
214
+ removeCriteria(criteria: string): void;
215
+ closeWebSocket(): void;
216
+ getCriteriaCount(): number;
217
+ getMasterEmitter(): SubscriptionEmitter;
218
+ emitEventForCriteria<K extends keyof SubscriptionEventMap = keyof SubscriptionEventMap>(criteria: string, event: SubscriptionEventMap[K]): void;
219
+ getEmitter(criteria: string): SubscriptionEmitter | undefined;
220
+ }
221
+
200
222
  export declare type ProfileStructureDefinition = StructureDefinition & {
201
223
  url: string;
202
224
  name: string;