@medplum/mock 5.1.24 → 5.1.27

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.
@@ -337,11 +337,25 @@ export declare class MockClient extends MedplumClient {
337
337
  private profile;
338
338
  subManager: MockSubscriptionManager | undefined;
339
339
  constructor(clientOptions?: MockClientOptions);
340
+ get mock(): MockClientTestMethods;
340
341
  clear(): void;
342
+ /**
343
+ * Run a function in "seeding" mode, allowing it to set metadata like
344
+ * `versionId` that normally would be dropped.
345
+ *
346
+ * @deprecated - Use `.mock.withSeeding()` instead
347
+ * @param fn - The callback to run in "seeding" mode
348
+ * @returns The return value from `fn`
349
+ */
341
350
  withSeeding<T>(fn: () => T | Promise<T>): Promise<T>;
342
351
  getProfile(): ProfileResource | undefined;
343
352
  getUserConfiguration(): WithId<UserConfiguration> | undefined;
344
353
  setActiveLoginOverride(activeLoginOverride: LoginState): void;
354
+ /**
355
+ * Overrides the active profile.
356
+ * @deprecated - Use `.mock.setProfile()` instead
357
+ * @param profile - The profile to set as active for this client
358
+ */
345
359
  setProfile(profile: ProfileResource | undefined): void;
346
360
  getActiveLogin(): LoginState | undefined;
347
361
  getLogins(): LoginState[];
@@ -382,8 +396,20 @@ export declare class MockClient extends MedplumClient {
382
396
  */
383
397
  createBinary(data: BinarySource, filename: string | undefined, contentType: string, onProgress?: (e: ProgressEvent) => void, options?: MedplumRequestOptions): Promise<WithId<Binary>>;
384
398
  pushToAgent(agent: Agent | Reference<Agent>, destination: Device | Reference<Device> | string, body: any, contentType?: string, _waitForResponse?: boolean, _options?: MedplumRequestOptions): Promise<any>;
399
+ /**
400
+ * Updates internal test state used by `pushToAgent` mocking.
401
+ *
402
+ * @deprecated - Use `.mock.setAgentAvailable()` instead
403
+ * @param value - boolean
404
+ */
385
405
  setAgentAvailable(value: boolean): void;
386
406
  getSubscriptionManager(): MockSubscriptionManager;
407
+ /**
408
+ * Sets a MockSubscriptionManager that this MockClient should use.
409
+ *
410
+ * @deprecated - Use `.mock.setSubscriptionManager()` instead
411
+ * @param subManager - A MockSubscriptionManager to attach to this MockClient
412
+ */
387
413
  setSubscriptionManager(subManager: MockSubscriptionManager): void;
388
414
  subscribeToCriteria(criteria: string, subscriptionProps?: Partial<Subscription>): SubscriptionEmitter;
389
415
  unsubscribeFromCriteria(criteria: string, subscriptionProps?: Partial<Subscription>): void;
@@ -403,6 +429,13 @@ export declare interface MockClientOptions extends Pick<MedplumClientOptions, 'b
403
429
  readonly mockFetchOverride?: MockFetchOverrideOptions;
404
430
  }
405
431
 
432
+ declare interface MockClientTestMethods {
433
+ withSeeding: <T>(fn: () => T | Promise<T>) => Promise<T>;
434
+ setProfile: (profile: ProfileResource | undefined) => void;
435
+ setAgentAvailable: (value: boolean) => void;
436
+ setSubscriptionManager: (subManager: MockSubscriptionManager) => void;
437
+ }
438
+
406
439
  export declare type MockCriteriaEntry = {
407
440
  criteria: string;
408
441
  subscriptionProps?: Partial<Subscription>;
@@ -337,11 +337,25 @@ export declare class MockClient extends MedplumClient {
337
337
  private profile;
338
338
  subManager: MockSubscriptionManager | undefined;
339
339
  constructor(clientOptions?: MockClientOptions);
340
+ get mock(): MockClientTestMethods;
340
341
  clear(): void;
342
+ /**
343
+ * Run a function in "seeding" mode, allowing it to set metadata like
344
+ * `versionId` that normally would be dropped.
345
+ *
346
+ * @deprecated - Use `.mock.withSeeding()` instead
347
+ * @param fn - The callback to run in "seeding" mode
348
+ * @returns The return value from `fn`
349
+ */
341
350
  withSeeding<T>(fn: () => T | Promise<T>): Promise<T>;
342
351
  getProfile(): ProfileResource | undefined;
343
352
  getUserConfiguration(): WithId<UserConfiguration> | undefined;
344
353
  setActiveLoginOverride(activeLoginOverride: LoginState): void;
354
+ /**
355
+ * Overrides the active profile.
356
+ * @deprecated - Use `.mock.setProfile()` instead
357
+ * @param profile - The profile to set as active for this client
358
+ */
345
359
  setProfile(profile: ProfileResource | undefined): void;
346
360
  getActiveLogin(): LoginState | undefined;
347
361
  getLogins(): LoginState[];
@@ -382,8 +396,20 @@ export declare class MockClient extends MedplumClient {
382
396
  */
383
397
  createBinary(data: BinarySource, filename: string | undefined, contentType: string, onProgress?: (e: ProgressEvent) => void, options?: MedplumRequestOptions): Promise<WithId<Binary>>;
384
398
  pushToAgent(agent: Agent | Reference<Agent>, destination: Device | Reference<Device> | string, body: any, contentType?: string, _waitForResponse?: boolean, _options?: MedplumRequestOptions): Promise<any>;
399
+ /**
400
+ * Updates internal test state used by `pushToAgent` mocking.
401
+ *
402
+ * @deprecated - Use `.mock.setAgentAvailable()` instead
403
+ * @param value - boolean
404
+ */
385
405
  setAgentAvailable(value: boolean): void;
386
406
  getSubscriptionManager(): MockSubscriptionManager;
407
+ /**
408
+ * Sets a MockSubscriptionManager that this MockClient should use.
409
+ *
410
+ * @deprecated - Use `.mock.setSubscriptionManager()` instead
411
+ * @param subManager - A MockSubscriptionManager to attach to this MockClient
412
+ */
387
413
  setSubscriptionManager(subManager: MockSubscriptionManager): void;
388
414
  subscribeToCriteria(criteria: string, subscriptionProps?: Partial<Subscription>): SubscriptionEmitter;
389
415
  unsubscribeFromCriteria(criteria: string, subscriptionProps?: Partial<Subscription>): void;
@@ -403,6 +429,13 @@ export declare interface MockClientOptions extends Pick<MedplumClientOptions, 'b
403
429
  readonly mockFetchOverride?: MockFetchOverrideOptions;
404
430
  }
405
431
 
432
+ declare interface MockClientTestMethods {
433
+ withSeeding: <T>(fn: () => T | Promise<T>) => Promise<T>;
434
+ setProfile: (profile: ProfileResource | undefined) => void;
435
+ setAgentAvailable: (value: boolean) => void;
436
+ setSubscriptionManager: (subManager: MockSubscriptionManager) => void;
437
+ }
438
+
406
439
  export declare type MockCriteriaEntry = {
407
440
  criteria: string;
408
441
  subscriptionProps?: Partial<Subscription>;