@dereekb/firebase-server 13.11.14 → 13.11.16

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.
Files changed (102) hide show
  1. package/index.cjs.js +229 -199
  2. package/index.esm.js +230 -200
  3. package/mailgun/package.json +9 -9
  4. package/model/index.cjs.js +259 -270
  5. package/model/index.esm.js +259 -270
  6. package/model/package.json +9 -9
  7. package/model/src/lib/mailgun/notification.send.service.mailgun.d.ts +3 -3
  8. package/model/src/lib/notification/notification.action.server.d.ts +34 -34
  9. package/model/src/lib/notification/notification.action.server.init.d.ts +17 -17
  10. package/model/src/lib/notification/notification.config.service.d.ts +7 -7
  11. package/model/src/lib/notification/notification.create.run.d.ts +3 -3
  12. package/model/src/lib/notification/notification.error.d.ts +14 -14
  13. package/model/src/lib/notification/notification.expedite.service.d.ts +7 -7
  14. package/model/src/lib/notification/notification.module.d.ts +13 -13
  15. package/model/src/lib/notification/notification.send.service.notificationsummary.d.ts +2 -2
  16. package/model/src/lib/notification/notification.send.service.text.d.ts +1 -1
  17. package/model/src/lib/notification/notification.task.service.handler.d.ts +2 -2
  18. package/model/src/lib/notification/notification.task.service.util.d.ts +3 -3
  19. package/model/src/lib/notification/notification.task.subtask.handler.d.ts +3 -3
  20. package/model/src/lib/notification/notification.util.d.ts +8 -8
  21. package/model/src/lib/storagefile/storagefile.action.server.d.ts +43 -44
  22. package/model/src/lib/storagefile/storagefile.action.server.init.d.ts +11 -11
  23. package/model/src/lib/storagefile/storagefile.error.d.ts +15 -15
  24. package/model/src/lib/storagefile/storagefile.module.d.ts +10 -10
  25. package/model/src/lib/storagefile/storagefile.task.service.handler.d.ts +6 -6
  26. package/model/src/lib/storagefile/storagefile.upload.service.initializer.d.ts +5 -5
  27. package/model/src/lib/storagefile/storagefile.util.d.ts +2 -2
  28. package/oidc/index.cjs.js +225 -219
  29. package/oidc/index.esm.js +225 -219
  30. package/oidc/package.json +10 -10
  31. package/oidc/src/lib/controller/oidc.interaction.controller.d.ts +44 -25
  32. package/oidc/src/lib/controller/oidc.provider.controller.d.ts +1 -1
  33. package/oidc/src/lib/controller/oidc.wellknown.controller.d.ts +3 -3
  34. package/oidc/src/lib/middleware/oauth-cors.module.d.ts +1 -1
  35. package/oidc/src/lib/model/jwks/jwks.d.ts +6 -6
  36. package/oidc/src/lib/model/jwks/jwks.query.d.ts +11 -5
  37. package/oidc/src/lib/model/oidc/oidcmodel.action.server.d.ts +12 -12
  38. package/oidc/src/lib/model/oidc/oidcmodel.module.d.ts +5 -5
  39. package/oidc/src/lib/oidc.config.d.ts +1 -1
  40. package/oidc/src/lib/oidc.module.d.ts +8 -8
  41. package/oidc/src/lib/service/oidc.account.service.d.ts +4 -4
  42. package/oidc/src/lib/service/oidc.adapter.service.d.ts +4 -4
  43. package/oidc/src/lib/service/oidc.client.service.d.ts +3 -3
  44. package/oidc/src/lib/service/oidc.config.service.d.ts +1 -1
  45. package/oidc/src/lib/service/oidc.encryption.service.d.ts +4 -4
  46. package/oidc/src/lib/service/oidc.interaction.service.d.ts +14 -14
  47. package/oidc/src/lib/service/oidc.jwks.service.d.ts +6 -6
  48. package/oidc/src/lib/service/oidc.service.d.ts +5 -5
  49. package/package.json +10 -10
  50. package/src/lib/auth/auth.service.d.ts +8 -8
  51. package/src/lib/auth/auth.util.d.ts +1 -1
  52. package/src/lib/env/env.config.d.ts +5 -4
  53. package/src/lib/firestore/driver.accessor.batch.d.ts +2 -1
  54. package/src/lib/firestore/driver.accessor.d.ts +1 -1
  55. package/src/lib/firestore/driver.accessor.default.d.ts +2 -1
  56. package/src/lib/firestore/driver.accessor.transaction.d.ts +2 -1
  57. package/src/lib/firestore/snapshot/snapshot.field.encrypt.d.ts +10 -6
  58. package/src/lib/function/type.d.ts +4 -4
  59. package/src/lib/nest/analytics/analytics.module.d.ts +6 -5
  60. package/src/lib/nest/app.d.ts +4 -4
  61. package/src/lib/nest/app.module.d.ts +3 -2
  62. package/src/lib/nest/auth/auth.module.d.ts +4 -3
  63. package/src/lib/nest/controller/model/model.api.controller.d.ts +1 -0
  64. package/src/lib/nest/controller/model/model.api.get.service.d.ts +1 -1
  65. package/src/lib/nest/controller/model/model.api.module.d.ts +4 -3
  66. package/src/lib/nest/development/development.function.d.ts +1 -1
  67. package/src/lib/nest/development/development.schedule.function.error.d.ts +2 -2
  68. package/src/lib/nest/env/env.util.d.ts +2 -2
  69. package/src/lib/nest/firestore/firestore.module.d.ts +16 -15
  70. package/src/lib/nest/function/call.d.ts +6 -6
  71. package/src/lib/nest/function/context.d.ts +7 -6
  72. package/src/lib/nest/function/v2/blocking.d.ts +8 -6
  73. package/src/lib/nest/function/v2/call.d.ts +7 -5
  74. package/src/lib/nest/function/v2/event.d.ts +3 -2
  75. package/src/lib/nest/function/v2/schedule.d.ts +3 -2
  76. package/src/lib/nest/function/v2/taskqueue.d.ts +2 -1
  77. package/src/lib/nest/model/analytics.emit.d.ts +5 -5
  78. package/src/lib/nest/model/api.details.d.ts +4 -4
  79. package/src/lib/nest/model/query.model.function.d.ts +3 -3
  80. package/src/lib/nest/nest.provider.d.ts +7 -7
  81. package/src/lib/nest/storage/storage.module.d.ts +6 -5
  82. package/src/lib/storage/driver.accessor.d.ts +10 -10
  83. package/test/index.cjs.js +48 -57
  84. package/test/index.esm.js +48 -57
  85. package/test/package.json +11 -11
  86. package/test/src/lib/firebase/firebase.admin.auth.d.ts +18 -18
  87. package/test/src/lib/firebase/firebase.admin.collection.d.ts +7 -7
  88. package/test/src/lib/firebase/firebase.admin.d.ts +2 -2
  89. package/test/src/lib/firebase/firebase.admin.function.d.ts +2 -2
  90. package/test/src/lib/firebase/firebase.admin.nest.function.callable.context.d.ts +1 -1
  91. package/test/src/lib/firebase/firebase.admin.nest.function.cloud.context.d.ts +3 -3
  92. package/test/src/lib/firebase/firebase.d.ts +6 -5
  93. package/test/src/lib/firebase/firebase.function.d.ts +31 -31
  94. package/test/src/lib/firestore/firestore.d.ts +2 -2
  95. package/test/src/lib/oidc/oidc.test.fixture.d.ts +1 -1
  96. package/test/src/lib/oidc/oidc.test.flow.d.ts +1 -1
  97. package/test/src/lib/storage/storage.d.ts +2 -2
  98. package/zoho/index.cjs.js +2 -2
  99. package/zoho/index.esm.js +2 -2
  100. package/zoho/package.json +9 -9
  101. package/zoho/src/lib/zoho.accounts.firebase.d.ts +1 -1
  102. package/zoho/src/lib/zoho.accounts.firebase.system.d.ts +1 -1
package/test/index.esm.js CHANGED
@@ -425,7 +425,7 @@ function _ts_generator$a(thisArg, body) {
425
425
  * @param fn - Wrapped gen 2 callable request to invoke.
426
426
  * @param params - Request payload to pass to the callable, simulating the JSON body of an HTTP call.
427
427
  * @param skipJsonConversion - When `true`, skip the JSON serialize/parse round-trip applied to `params` (default `false`).
428
- * @returns A promise resolving to the callable's return value.
428
+ * @returns Promise resolving to the callable's return value.
429
429
  */ key: "callWrappedFunction",
430
430
  value: function callWrappedFunction(fn, params, skipJsonConversion) {
431
431
  // Parse to JSON then back to simulate sending JSON to the server, and the server parsing it as a POJO.
@@ -461,7 +461,7 @@ function _ts_generator$a(thisArg, body) {
461
461
  * @param input.eventType - Discriminator for the auth event being simulated (`google.firebase.auth.user.create` or `google.firebase.auth.user.delete`).
462
462
  * @param input.eventOverride - Partial event fields used to override the default placeholder values (e.g., `ipAddress`, `userAgent`, `resource`).
463
463
  * @param input.skipJsonConversion - When `true`, skip the JSON serialize/parse round-trip applied to the event payload (default `false`).
464
- * @returns A promise that resolves once the blocking function has completed.
464
+ * @returns Resolves once the blocking function has completed.
465
465
  */ key: "callAuthBlockingFunction",
466
466
  value: function callAuthBlockingFunction(input) {
467
467
  var fn = input.fn, userRecord = input.userRecord, eventType = input.eventType, eventOverride = input.eventOverride, _input_skipJsonConversion = input.skipJsonConversion, skipJsonConversion = _input_skipJsonConversion === void 0 ? false : _input_skipJsonConversion;
@@ -485,13 +485,13 @@ function _ts_generator$a(thisArg, body) {
485
485
  },
486
486
  {
487
487
  /**
488
- * @deprecated gen 1
489
- *
490
488
  * @param fn
491
489
  * @param params
492
490
  * @param contextOptions
493
491
  * @param skipJsonConversion
494
492
  * @returns
493
+ *
494
+ * @deprecated gen 1
495
495
  */ // eslint-disable-next-line @typescript-eslint/max-params -- deprecated gen 1 signature kept for downstream compatibility
496
496
  key: "callEventCloudFunction",
497
497
  value: function callEventCloudFunction(fn, params, contextOptions) {
@@ -535,7 +535,7 @@ function _ts_generator$a(thisArg, body) {
535
535
  * custom claims, and post-create initialization) and tear it down afterward.
536
536
  *
537
537
  * @param config - Factory configuration: optional uid generator, custom fixture/instance constructors, user-detail builder, and `initUser` hook.
538
- * @returns A function that, given runtime params and a `buildTests` callback, wires the authorized-user fixture into the active test context.
538
+ * @returns Function that, given runtime params and a `buildTests` callback, wires the authorized-user fixture into the active test context.
539
539
  */ function authorizedUserContextFactory(config) {
540
540
  var uidGetter = config.uid, _config_makeInstance = config.makeInstance, makeInstance = _config_makeInstance === void 0 ? function(uid, testInstance) {
541
541
  return new AuthorizedUserTestContextInstance(uid, testInstance);
@@ -1146,7 +1146,7 @@ function _ts_generator$9(thisArg, body) {
1146
1146
  * build the test context instance, optionally initialize the document, and clean up after each test.
1147
1147
  *
1148
1148
  * @param config - Factory configuration that resolves the collection, optionally produces document refs, builds fixtures/instances, and tears down state.
1149
- * @returns A function that, given runtime params and a `buildTests` callback, registers the model fixture hooks against the active test context.
1149
+ * @returns Function that, given runtime params and a `buildTests` callback, registers the model fixture hooks against the active test context.
1150
1150
  *
1151
1151
  * @see {@link ModelTestContextFactoryParams} for configuration options
1152
1152
  */ function modelTestContextFactory(config) {
@@ -1308,7 +1308,7 @@ var adminEnvironmentInitialized = false;
1308
1308
  * so that each component can also
1309
1309
  *
1310
1310
  * @returns The test project ID that was re-applied to `FIREBASE_CONFIG`/`GCLOUD_PROJECT`.
1311
- * @throws Error when no test project ID is present in the environment (i.e., {@link initFirebaseAdminTestEnvironment} has not been called).
1311
+ * @throws {Error} When no test project ID is present in the environment (i.e., {@link initFirebaseAdminTestEnvironment} has not been called).
1312
1312
  */ function applyFirebaseGCloudTestProjectIdToFirebaseConfigEnv() {
1313
1313
  var _process_env_FIREBASE_CONFIG;
1314
1314
  // firebase-functions-test overwrites this each time.
@@ -2680,24 +2680,16 @@ function _ts_generator$5(thisArg, body) {
2680
2680
  return _async_to_generator$5(function() {
2681
2681
  var _ref, request;
2682
2682
  return _ts_generator$5(this, function(_state) {
2683
- switch(_state.label){
2684
- case 0:
2685
- request = _object_spread_props$2(_object_spread$3({}, context), {
2686
- data: data,
2687
- // NOTE: These will typically not be used/available as they are express.js properties that are not available or useful to the handlers
2688
- rawRequest: (_ref = context === null || context === void 0 ? void 0 : context.rawRequest) !== null && _ref !== void 0 ? _ref : {},
2689
- acceptsStreaming: false
2690
- });
2691
- return [
2692
- 4,
2693
- wrappedCloudFunction(request)
2694
- ];
2695
- case 1:
2696
- return [
2697
- 2,
2698
- _state.sent()
2699
- ];
2700
- }
2683
+ request = _object_spread_props$2(_object_spread$3({}, context), {
2684
+ data: data,
2685
+ // NOTE: These will typically not be used/available as they are express.js properties that are not available or useful to the handlers
2686
+ rawRequest: (_ref = context === null || context === void 0 ? void 0 : context.rawRequest) !== null && _ref !== void 0 ? _ref : {},
2687
+ acceptsStreaming: false
2688
+ });
2689
+ return [
2690
+ 2,
2691
+ wrappedCloudFunction(request)
2692
+ ];
2701
2693
  });
2702
2694
  })();
2703
2695
  };
@@ -2721,28 +2713,6 @@ function _ts_generator$5(thisArg, body) {
2721
2713
  };
2722
2714
  return wrapper;
2723
2715
  }
2724
- /**
2725
- * Creates a lazy getter that wraps a gen 1 cloud function for testing each time it is called.
2726
- *
2727
- * The returned getter re-wraps on every invocation, so it always reflects the latest function
2728
- * reference from the provided getter — useful when the function under test is re-created between tests.
2729
- *
2730
- * @param wrapper - The cloud function wrapper providing gen 1 wrap support.
2731
- * @param getter - Lazy accessor for the gen 1 cloud function under test; re-evaluated on every getter call.
2732
- * @returns A getter that, when invoked, returns a freshly wrapped gen 1 cloud function ready for invocation in tests.
2733
- *
2734
- * @example
2735
- * ```ts
2736
- * const getWrapped = wrapCloudFunctionV1ForTests(wrapper, () => myV1Function);
2737
- * const result = await getWrapped()({ /* event data *\/ });
2738
- * ```
2739
- *
2740
- * @deprecated Prefer gen 2 functions and {@link wrapCloudFunctionV2ForTests} or {@link wrapCloudFunctionTests}.
2741
- */ function wrapCloudFunctionV1ForTests(wrapper, getter) {
2742
- return function() {
2743
- return wrapper.wrapV1CloudFunction(getter());
2744
- };
2745
- }
2746
2716
  /**
2747
2717
  * Creates a lazy getter that wraps a {@link CallableHttpFunction} for testing each time it is called.
2748
2718
  *
@@ -2763,6 +2733,28 @@ function _ts_generator$5(thisArg, body) {
2763
2733
  return wrapper.wrapCallableRequest(getter());
2764
2734
  };
2765
2735
  }
2736
+ /**
2737
+ * Creates a lazy getter that wraps a gen 1 cloud function for testing each time it is called.
2738
+ *
2739
+ * The returned getter re-wraps on every invocation, so it always reflects the latest function
2740
+ * reference from the provided getter — useful when the function under test is re-created between tests.
2741
+ *
2742
+ * @param wrapper - The cloud function wrapper providing gen 1 wrap support.
2743
+ * @param getter - Lazy accessor for the gen 1 cloud function under test; re-evaluated on every getter call.
2744
+ * @returns A getter that, when invoked, returns a freshly wrapped gen 1 cloud function ready for invocation in tests.
2745
+ *
2746
+ * @deprecated Prefer gen 2 functions and {@link wrapCloudFunctionV2ForTests} or {@link wrapCloudFunctionTests}.
2747
+ *
2748
+ * @example
2749
+ * ```ts
2750
+ * const getWrapped = wrapCloudFunctionV1ForTests(wrapper, () => myV1Function);
2751
+ * const result = await getWrapped()({ /* event data *\/ });
2752
+ * ```
2753
+ */ function wrapCloudFunctionV1ForTests(wrapper, getter) {
2754
+ return function() {
2755
+ return wrapper.wrapV1CloudFunction(getter());
2756
+ };
2757
+ }
2766
2758
 
2767
2759
  function _assert_this_initialized$4(self) {
2768
2760
  if (self === void 0) {
@@ -3033,7 +3025,7 @@ var functionsInitialized = false;
3033
3025
  * @param reroll - When `true`, generates a new project ID instead of reusing the current one.
3034
3026
  * @returns The initialized {@link FeaturesList} singleton.
3035
3027
  *
3036
- * @throws Error if `initFirebaseAdminTestEnvironment()` has not been called.
3028
+ * @throws {Error} If `initFirebaseAdminTestEnvironment()` has not been called.
3037
3029
  *
3038
3030
  * @example
3039
3031
  * ```ts
@@ -4907,18 +4899,17 @@ function _ts_generator$1(thisArg, body) {
4907
4899
  * @returns The space-separated scope string to pass to the `/oidc/auth` endpoint.
4908
4900
  */ function resolveScopes(nestApp, config) {
4909
4901
  return _async_to_generator$1(function() {
4910
- var accountService;
4902
+ var result, accountService;
4911
4903
  return _ts_generator$1(this, function(_state) {
4912
4904
  if (config === null || config === void 0 ? void 0 : config.scopes) {
4913
- return [
4914
- 2,
4915
- config.scopes
4916
- ];
4905
+ result = config.scopes;
4906
+ } else {
4907
+ accountService = nestApp.get(OidcAccountService);
4908
+ result = Object.keys(accountService.providerConfig.claims).join(' ');
4917
4909
  }
4918
- accountService = nestApp.get(OidcAccountService);
4919
4910
  return [
4920
4911
  2,
4921
- Object.keys(accountService.providerConfig.claims).join(' ')
4912
+ result
4922
4913
  ];
4923
4914
  });
4924
4915
  })();
@@ -4935,7 +4926,7 @@ function _ts_generator$1(thisArg, body) {
4935
4926
  * @param input.uid - Firebase user ID for whom the test ID token is minted and the OAuth flow is authorized.
4936
4927
  * @param input.config - Optional flow overrides (scopes, redirect URI, client name, token endpoint auth method).
4937
4928
  * @returns The exchanged access token and ID token from the OIDC `/token` endpoint.
4938
- * @throws Error when the token exchange step fails (the response body and status are included in the message).
4929
+ * @throws {Error} When the token exchange step fails (the response body and status are included in the message).
4939
4930
  */ function performFullOAuthFlow(input) {
4940
4931
  return _async_to_generator$1(function() {
4941
4932
  var _ref, _ref1, _ref2, server, oidcClientService, nestApp, uid, config, _createCookieJar, collectCookies, cookieHeader, redirectUri, clientName, tokenEndpointAuthMethod, scopes, _ref3, client_id, client_secret, codeVerifier, codeChallenge, authRes, loginUid, idToken, loginRes, resumeAfterLoginPath, consentRedirectRes, consentUid, consentRes, resumeAfterConsentPath, callbackRedirectRes, callbackUrl, authorizationCode, tokenRes;
@@ -5470,7 +5461,7 @@ function _ts_generator(thisArg, body) {
5470
5461
  * and provides an authenticated supertest agent and helper methods.
5471
5462
  *
5472
5463
  * @param config - Optional flow overrides (scopes, redirect URI, client name, timeout) and custom fixture/instance constructors.
5473
- * @returns A function that, given parent fixtures and a `buildTests` callback, registers a `describe('(oauth)', ...)` block which performs the full OAuth flow and exposes the authenticated supertest fixture.
5464
+ * @returns Function that, given parent fixtures and a `buildTests` callback, registers a `describe('(oauth)', ...)` block which performs the full OAuth flow and exposes the authenticated supertest fixture.
5474
5465
  *
5475
5466
  * @example
5476
5467
  * ```typescript
package/test/package.json CHANGED
@@ -1,16 +1,16 @@
1
1
  {
2
2
  "name": "@dereekb/firebase-server/test",
3
- "version": "13.11.14",
3
+ "version": "13.11.16",
4
4
  "peerDependencies": {
5
- "@dereekb/analytics": "13.11.14",
6
- "@dereekb/date": "13.11.14",
7
- "@dereekb/firebase": "13.11.14",
8
- "@dereekb/firebase-server": "13.11.14",
9
- "@dereekb/firebase-server/oidc": "13.11.14",
10
- "@dereekb/model": "13.11.14",
11
- "@dereekb/nestjs": "13.11.14",
12
- "@dereekb/rxjs": "13.11.14",
13
- "@dereekb/util": "13.11.14",
5
+ "@dereekb/analytics": "13.11.16",
6
+ "@dereekb/date": "13.11.16",
7
+ "@dereekb/firebase": "13.11.16",
8
+ "@dereekb/firebase-server": "13.11.16",
9
+ "@dereekb/firebase-server/oidc": "13.11.16",
10
+ "@dereekb/model": "13.11.16",
11
+ "@dereekb/nestjs": "13.11.16",
12
+ "@dereekb/rxjs": "13.11.16",
13
+ "@dereekb/util": "13.11.16",
14
14
  "@google-cloud/firestore": "^7.11.6",
15
15
  "@google-cloud/storage": "^7.19.0",
16
16
  "@nestjs/common": "^11.1.19",
@@ -23,7 +23,7 @@
23
23
  "supertest": "^7.2.2"
24
24
  },
25
25
  "devDependencies": {
26
- "@dereekb/nestjs": "13.11.14"
26
+ "@dereekb/nestjs": "13.11.16"
27
27
  },
28
28
  "exports": {
29
29
  "./package.json": "./package.json",
@@ -83,13 +83,6 @@ export declare class AuthorizedUserTestContextFixture<PI extends FirebaseAdminTe
83
83
  callCloudFunction<F extends WrappedCloudFunctionV1<any>, O = unknown>(fn: F, params: CallCloudFunctionParams<F>, skipJsonConversion?: boolean): Promise<O>;
84
84
  callCloudFunction<F extends WrappedFunction<any>, O = unknown>(fn: F, params: CallCloudFunctionParams<F>, skipJsonConversion?: boolean): Promise<O>;
85
85
  }
86
- /**
87
- * Partial event context for gen 1 event-triggered cloud functions, with the `auth` field omitted
88
- * since it is injected automatically by the test context.
89
- *
90
- * @deprecated Used only with gen 1 event cloud functions via {@link AuthorizedUserTestContextInstance.callEventCloudFunction}.
91
- */
92
- export type CallEventFunctionEventContext = Partial<Omit<EventContext, 'auth'>>;
93
86
  /**
94
87
  * Concrete implementation of {@link AuthorizedUserTestContext} that holds a Firebase user UID
95
88
  * and a reference to the parent {@link FirebaseAdminTestContext}.
@@ -119,7 +112,7 @@ export declare class AuthorizedUserTestContextInstance<PI extends FirebaseAdminT
119
112
  * @param fn - Wrapped gen 2 callable request to invoke.
120
113
  * @param params - Request payload to pass to the callable, simulating the JSON body of an HTTP call.
121
114
  * @param skipJsonConversion - When `true`, skip the JSON serialize/parse round-trip applied to `params` (default `false`).
122
- * @returns A promise resolving to the callable's return value.
115
+ * @returns Promise resolving to the callable's return value.
123
116
  */
124
117
  callWrappedFunction<F extends WrappedCallableRequest<any, any>>(fn: F, params: WrappedCallableRequestParams<F>, skipJsonConversion?: boolean): Promise<WrappedCallableRequestOutput<F>>;
125
118
  /**
@@ -146,7 +139,7 @@ export declare class AuthorizedUserTestContextInstance<PI extends FirebaseAdminT
146
139
  * @param input.eventType - Discriminator for the auth event being simulated (`google.firebase.auth.user.create` or `google.firebase.auth.user.delete`).
147
140
  * @param input.eventOverride - Partial event fields used to override the default placeholder values (e.g., `ipAddress`, `userAgent`, `resource`).
148
141
  * @param input.skipJsonConversion - When `true`, skip the JSON serialize/parse round-trip applied to the event payload (default `false`).
149
- * @returns A promise that resolves once the blocking function has completed.
142
+ * @returns Resolves once the blocking function has completed.
150
143
  */
151
144
  callAuthBlockingFunction(input: {
152
145
  fn: WrappedBlockingFunctionWithHandler<AuthBlockingEvent, void>;
@@ -156,13 +149,13 @@ export declare class AuthorizedUserTestContextInstance<PI extends FirebaseAdminT
156
149
  skipJsonConversion?: boolean;
157
150
  }): Promise<void>;
158
151
  /**
159
- * @deprecated gen 1
160
- *
161
152
  * @param fn
162
153
  * @param params
163
154
  * @param contextOptions
164
155
  * @param skipJsonConversion
165
156
  * @returns
157
+ *
158
+ * @deprecated gen 1
166
159
  */
167
160
  callEventCloudFunction<F extends WrappedFunction<any>, O = unknown>(fn: F, params: CallCloudFunctionParams<F>, contextOptions?: CallEventFunctionEventContext, skipJsonConversion?: boolean): Promise<O>;
168
161
  }
@@ -189,27 +182,27 @@ export interface AuthorizedUserTestContextDetailsTemplate {
189
182
  * authorizedUserContext/authorizedUserContextFactory parameters.
190
183
  */
191
184
  export interface AuthorizedUserTestContextParams<PI extends FirebaseAdminTestContext = FirebaseAdminTestContext, PF extends TestContextFixture<PI> = TestContextFixture<PI>, I extends AuthorizedUserTestContextInstance<PI> = AuthorizedUserTestContextInstance<PI>, F extends AuthorizedUserTestContextFixture<PI, PF, I> = AuthorizedUserTestContextFixture<PI, PF, I>, C extends AuthorizedUserTestContextFactoryParams<PI, PF> = AuthorizedUserTestContextFactoryParams<PI, PF>> {
192
- f: PF;
185
+ readonly f: PF;
193
186
  /**
194
187
  * uid value/getter to use. If not provided, a random one will be generated.
195
188
  */
196
- uid?: GetterOrValue<FirebaseAuthUserId>;
189
+ readonly uid?: GetterOrValue<FirebaseAuthUserId>;
197
190
  /**
198
191
  * Additional user details to attach to the create request.
199
192
  */
200
- makeUserDetails?: (uid: FirebaseAuthUserId, params: C) => AuthorizedUserTestContextDetailsTemplate;
193
+ readonly makeUserDetails?: (uid: FirebaseAuthUserId, params: C) => AuthorizedUserTestContextDetailsTemplate;
201
194
  /**
202
195
  * Creates the custom fixture. If not defined, a AuthorizedUserTestContextFixture is created.
203
196
  */
204
- makeFixture?: (parent: PF) => F;
197
+ readonly makeFixture?: (parent: PF) => F;
205
198
  /**
206
199
  * Custom make instance function. If not defined, a AuthorizedUserTestContextInstance will be generated.
207
200
  */
208
- makeInstance?: (uid: FirebaseAuthUserId, testInstance: PI, params: C, userRecord: UserRecord) => PromiseOrValue<I>;
201
+ readonly makeInstance?: (uid: FirebaseAuthUserId, testInstance: PI, params: C, userRecord: UserRecord) => PromiseOrValue<I>;
209
202
  /**
210
203
  * Optional function to initialize the user for this instance.
211
204
  */
212
- initUser?: (instance: I, params: C) => Promise<void>;
205
+ readonly initUser?: (instance: I, params: C) => Promise<void>;
213
206
  }
214
207
  /**
215
208
  * Convenience function for using authorizedUserContextFactory directly and passing buildTests.
@@ -262,7 +255,7 @@ export declare const AUTHORIZED_USER_RANDOM_PHONE_NUMBER_FACTORY: import("@deree
262
255
  * custom claims, and post-create initialization) and tear it down afterward.
263
256
  *
264
257
  * @param config - Factory configuration: optional uid generator, custom fixture/instance constructors, user-detail builder, and `initUser` hook.
265
- * @returns A function that, given runtime params and a `buildTests` callback, wires the authorized-user fixture into the active test context.
258
+ * @returns Function that, given runtime params and a `buildTests` callback, wires the authorized-user fixture into the active test context.
266
259
  */
267
260
  export declare function authorizedUserContextFactory<PI extends FirebaseAdminTestContext = FirebaseAdminTestContext, PF extends TestContextFixture<PI> = TestContextFixture<PI>, I extends AuthorizedUserTestContextInstance<PI> = AuthorizedUserTestContextInstance<PI>, F extends AuthorizedUserTestContextFixture<PI, PF, I> = AuthorizedUserTestContextFixture<PI, PF, I>, C extends AuthorizedUserTestContextFactoryParams<PI, PF> = AuthorizedUserTestContextFactoryParams<PI, PF>>(config: AuthorizedUserTestContextFactoryConfig<PI, PF, I, F>): (params: C, buildTests: (u: F) => void) => void;
268
261
  /**
@@ -346,3 +339,10 @@ export declare function decodeEncodedCreateCustomTokenResult(token: TestEncodedF
346
339
  * @see {@link createEncodedTestFirestoreTokenForUserRecord}
347
340
  */
348
341
  export declare function testFirestoreClaimsFromUserRecord(userRecord: UserRecord): object;
342
+ /**
343
+ * Partial event context for gen 1 event-triggered cloud functions, with the `auth` field omitted
344
+ * since it is injected automatically by the test context.
345
+ *
346
+ * @deprecated Used only with gen 1 event cloud functions via {@link AuthorizedUserTestContextInstance.callEventCloudFunction}.
347
+ */
348
+ export type CallEventFunctionEventContext = Partial<Omit<EventContext, 'auth'>>;
@@ -70,31 +70,31 @@ export interface ModelTestContextFactoryParams<T, D extends FirestoreDocument<T>
70
70
  /**
71
71
  * Creates a ModelTestContextInstanceDelegate from the parent instance.
72
72
  */
73
- getCollection: (parentInstance: PI, config: C) => CL;
73
+ readonly getCollection: (parentInstance: PI, config: C) => CL;
74
74
  /**
75
75
  * Creates the custom fixture. If not defined, a ModelTestContextFixture is created.
76
76
  */
77
- makeFixture?: (parent: PF) => F;
77
+ readonly makeFixture?: (parent: PF) => F;
78
78
  /**
79
79
  * Optional function to create a DocumentReference.
80
80
  *
81
81
  * If not provided, expects the input CL type to be a full FirestoreCollection, instead of a FirestoreCollectionLike.
82
82
  */
83
- makeRef?: (collection: CL, config: C, parentInstance: PI) => Promise<DocumentReference<T>>;
83
+ readonly makeRef?: (collection: CL, config: C, parentInstance: PI) => Promise<DocumentReference<T>>;
84
84
  /**
85
85
  * Custom make instance function. If not defined, a ModelTestContextInstance will be generated.
86
86
  */
87
- makeInstance?: (collection: CL, ref: DocumentReference<T>, testInstance: PI) => PromiseOrValue<I>;
87
+ readonly makeInstance?: (collection: CL, ref: DocumentReference<T>, testInstance: PI) => PromiseOrValue<I>;
88
88
  /**
89
89
  * Optional function to initialize the document for this instance.
90
90
  */
91
- initDocument?: (instance: I, config: C) => Promise<void>;
91
+ readonly initDocument?: (instance: I, config: C) => Promise<void>;
92
92
  /**
93
93
  * Optional function to retrieve a collection given the input document.
94
94
  *
95
95
  * Required if using ModelTestContextDocumentRefParam as input.
96
96
  */
97
- collectionForDocument?: (parentInstance: PI, document: D) => CL;
97
+ readonly collectionForDocument?: (parentInstance: PI, document: D) => CL;
98
98
  /**
99
99
  * Optional teardown function to cleanup after this object.
100
100
  */
@@ -133,7 +133,7 @@ export type ModelTestContextParams<C = any, PI extends FirebaseAdminTestContext
133
133
  * build the test context instance, optionally initialize the document, and clean up after each test.
134
134
  *
135
135
  * @param config - Factory configuration that resolves the collection, optionally produces document refs, builds fixtures/instances, and tears down state.
136
- * @returns A function that, given runtime params and a `buildTests` callback, registers the model fixture hooks against the active test context.
136
+ * @returns Function that, given runtime params and a `buildTests` callback, registers the model fixture hooks against the active test context.
137
137
  *
138
138
  * @see {@link ModelTestContextFactoryParams} for configuration options
139
139
  */
@@ -1,6 +1,6 @@
1
1
  import admin from 'firebase-admin';
2
2
  import { type Firestore } from '@google-cloud/firestore';
3
- import { type JestTestFirestoreContextFactory, type TestFirestoreContext, TestFirestoreContextFixture, type TestFirestoreInstance, type TestFirebaseStorageContext, type TestFirebaseStorageInstance } from '@dereekb/firebase/test';
3
+ import { type TestFirestoreContextFactory, type TestFirestoreContext, TestFirestoreContextFixture, type TestFirestoreInstance, type TestFirebaseStorageContext, type TestFirebaseStorageInstance } from '@dereekb/firebase/test';
4
4
  import { AbstractTestContextFixture, type BuildTestsWithContextFunction, type TestContextFactory, type TestContextFixture } from '@dereekb/util/test';
5
5
  import { GoogleCloudTestFirestoreInstance } from '../firestore/firestore';
6
6
  import { type FirebaseAdminCloudFunctionWrapper, type FirebaseAdminCloudFunctionWrapperSource } from './firebase.function';
@@ -126,7 +126,7 @@ export declare const firebaseAdminTestContextFactory: FirebaseAdminTestContextFa
126
126
  * @param factory
127
127
  * @returns
128
128
  */
129
- export declare function firebaseAdminFirestoreContextFixture(factory: TestContextFactory<TestContextFixture<FirebaseAdminTestContextInstance>>): JestTestFirestoreContextFactory;
129
+ export declare function firebaseAdminFirestoreContextFixture(factory: TestContextFactory<TestContextFixture<FirebaseAdminTestContextInstance>>): TestFirestoreContextFactory;
130
130
  /**
131
131
  * Sets up a {@link TestFirestoreContextFixture} as a child context within an existing
132
132
  * {@link FirebaseAdminTestContextInstance} fixture.
@@ -15,7 +15,7 @@ import { type Storage as GoogleCloudStorage } from '@google-cloud/storage';
15
15
  * @param reroll - When `true`, generates a new project ID instead of reusing the current one.
16
16
  * @returns The initialized {@link FeaturesList} singleton.
17
17
  *
18
- * @throws Error if `initFirebaseAdminTestEnvironment()` has not been called.
18
+ * @throws {Error} If `initFirebaseAdminTestEnvironment()` has not been called.
19
19
  *
20
20
  * @example
21
21
  * ```ts
@@ -38,7 +38,7 @@ export interface FirebaseAdminFunctionTestConfig {
38
38
  *
39
39
  * @deprecated Is false by default to allow a new app to be defined each time. Usage of the singleton does not make sense. Remove later, and require that tests be run in serial if testing framework isn't behaving.
40
40
  */
41
- useFunctionSingletonContext: boolean;
41
+ readonly useFunctionSingletonContext: boolean;
42
42
  }
43
43
  /**
44
44
  * Test context type for Firebase Admin function tests.
@@ -43,7 +43,7 @@ export interface CallableRequestTestMultipleConfig<I, T extends CallableRequestT
43
43
  /**
44
44
  * Map of named callable function factories to wrap for testing.
45
45
  */
46
- fns: T;
46
+ readonly fns: T;
47
47
  }
48
48
  /**
49
49
  * Suffix appended to each key in a {@link CallableRequestTestConfigMapObject} when building
@@ -14,7 +14,7 @@ export interface CloudFunctionTestBaseConfig {
14
14
  /**
15
15
  * The test context fixture providing NestJS module and function wrapping access.
16
16
  */
17
- f: FirebaseAdminFunctionNestTestContext;
17
+ readonly f: FirebaseAdminFunctionNestTestContext;
18
18
  }
19
19
  /**
20
20
  * Configuration for testing a single cloud function (v1 schedule, blocking, or cloud event).
@@ -24,7 +24,7 @@ export interface CloudFunctionTestSingleConfig<I extends object> extends CloudFu
24
24
  /**
25
25
  * The cloud function factory to wrap for testing.
26
26
  */
27
- fn: WrapCloudFunctionForNestTestsInput<I>;
27
+ readonly fn: WrapCloudFunctionForNestTestsInput<I>;
28
28
  }
29
29
  /**
30
30
  * Test callback for a single cloud function. Receives the wrapped function and should
@@ -46,7 +46,7 @@ export interface CloudFunctionTestMultipleConfig<I extends object, T extends Clo
46
46
  /**
47
47
  * Map of named cloud function factories to wrap for testing.
48
48
  */
49
- fns: T;
49
+ readonly fns: T;
50
50
  }
51
51
  /**
52
52
  * Mapped type that transforms a {@link CloudFunctionTestConfigMapObject} into an object
@@ -1,3 +1,4 @@
1
+ import type { Maybe } from '@dereekb/util';
1
2
  /**
2
3
  * A `host:port` string used to connect to a Firebase emulator.
3
4
  *
@@ -20,9 +21,9 @@ export type FirebaseAdminTestEnvironmentHost = string;
20
21
  * accidental connections to production services.
21
22
  */
22
23
  export interface FirebaseAdminTestEnvironmentEmulatorsConfig {
23
- auth: FirebaseAdminTestEnvironmentHost | null;
24
- storage: FirebaseAdminTestEnvironmentHost | null;
25
- firestore: FirebaseAdminTestEnvironmentHost | null;
24
+ readonly auth: Maybe<FirebaseAdminTestEnvironmentHost>;
25
+ readonly storage: Maybe<FirebaseAdminTestEnvironmentHost>;
26
+ readonly firestore: Maybe<FirebaseAdminTestEnvironmentHost>;
26
27
  }
27
28
  /**
28
29
  * Top-level configuration for initializing the Firebase Admin test environment.
@@ -30,7 +31,7 @@ export interface FirebaseAdminTestEnvironmentEmulatorsConfig {
30
31
  * Passed to {@link initFirebaseAdminTestEnvironment} to configure which emulators the test suite connects to.
31
32
  */
32
33
  export interface FirebaseAdminTestEnvironmentConfig {
33
- emulators: FirebaseAdminTestEnvironmentEmulatorsConfig;
34
+ readonly emulators: FirebaseAdminTestEnvironmentEmulatorsConfig;
34
35
  }
35
36
  /**
36
37
  * Returns whether {@link initFirebaseAdminTestEnvironment} has already been called.
@@ -91,7 +92,7 @@ export declare function getGCloudTestProjectId(): string | undefined;
91
92
  * so that each component can also
92
93
  *
93
94
  * @returns The test project ID that was re-applied to `FIREBASE_CONFIG`/`GCLOUD_PROJECT`.
94
- * @throws Error when no test project ID is present in the environment (i.e., {@link initFirebaseAdminTestEnvironment} has not been called).
95
+ * @throws {Error} When no test project ID is present in the environment (i.e., {@link initFirebaseAdminTestEnvironment} has not been called).
95
96
  */
96
97
  export declare function applyFirebaseGCloudTestProjectIdToFirebaseConfigEnv(): string;
97
98
  /**
@@ -20,18 +20,6 @@ export type CloudFunctionV1TypeFix<T> = Omit<CloudFunctionV1Input<T>, '__trigger
20
20
  * with the union-compatibility fix applied.
21
21
  */
22
22
  export type CloudFunctionV1<T> = CloudFunctionV1TypeFix<T>;
23
- /**
24
- * @deprecated deprecated gen 1 firebase function type
25
- */
26
- export type WrappedCloudFunctionV1<T> = WrappedScheduledFunction | WrappedFunction<T>;
27
- /**
28
- * @deprecated deprecated gen 1 firebase function type
29
- */
30
- export type WrapCloudFunctionV1 = <T>(cloudFunction: CloudFunctionV1<T>) => WrappedCloudFunctionV1<T>;
31
- /**
32
- * @deprecated deprecated gen 1 firebase function type
33
- */
34
- export type WrapCloudFunctionV1Input<T> = CloudFunctionV1<T>;
35
23
  /**
36
24
  * Wrapped callable function that only takes in data and options that are used to simulate a Firebase request, then returns the result.
37
25
  */
@@ -178,25 +166,6 @@ export interface FirebaseAdminCloudFunctionWrapper {
178
166
  * ```
179
167
  */
180
168
  export declare function firebaseAdminCloudFunctionWrapper(instance: FeaturesList): FirebaseAdminCloudFunctionWrapper;
181
- /**
182
- * Creates a lazy getter that wraps a gen 1 cloud function for testing each time it is called.
183
- *
184
- * The returned getter re-wraps on every invocation, so it always reflects the latest function
185
- * reference from the provided getter — useful when the function under test is re-created between tests.
186
- *
187
- * @param wrapper - The cloud function wrapper providing gen 1 wrap support.
188
- * @param getter - Lazy accessor for the gen 1 cloud function under test; re-evaluated on every getter call.
189
- * @returns A getter that, when invoked, returns a freshly wrapped gen 1 cloud function ready for invocation in tests.
190
- *
191
- * @example
192
- * ```ts
193
- * const getWrapped = wrapCloudFunctionV1ForTests(wrapper, () => myV1Function);
194
- * const result = await getWrapped()({ /* event data *\/ });
195
- * ```
196
- *
197
- * @deprecated Prefer gen 2 functions and {@link wrapCloudFunctionV2ForTests} or {@link wrapCloudFunctionTests}.
198
- */
199
- export declare function wrapCloudFunctionV1ForTests<I, T extends WrapCloudFunctionV1Input<I> = WrapCloudFunctionV1Input<I>>(wrapper: FirebaseAdminCloudFunctionWrapper, getter: Getter<T>): Getter<WrappedCloudFunctionV1<I>>;
200
169
  /**
201
170
  * Creates a lazy getter that wraps a gen 2 cloud function for testing each time it is called.
202
171
  *
@@ -249,6 +218,37 @@ export declare function wrapCloudFunctionTests<I extends object>(wrapper: Fireba
249
218
  * ```
250
219
  */
251
220
  export declare function wrapCallableRequestForTests<I, O = unknown, T extends WrapCallableRequestInput<I, O> = WrapCallableRequestInput<I, O>>(wrapper: FirebaseAdminCloudFunctionWrapper, getter: Getter<T>): Getter<WrappedCallableRequest<I, O>>;
221
+ /**
222
+ * @deprecated deprecated gen 1 firebase function type
223
+ */
224
+ export type WrappedCloudFunctionV1<T> = WrappedScheduledFunction | WrappedFunction<T>;
225
+ /**
226
+ * @deprecated deprecated gen 1 firebase function type
227
+ */
228
+ export type WrapCloudFunctionV1 = <T>(cloudFunction: CloudFunctionV1<T>) => WrappedCloudFunctionV1<T>;
229
+ /**
230
+ * @deprecated deprecated gen 1 firebase function type
231
+ */
232
+ export type WrapCloudFunctionV1Input<T> = CloudFunctionV1<T>;
233
+ /**
234
+ * Creates a lazy getter that wraps a gen 1 cloud function for testing each time it is called.
235
+ *
236
+ * The returned getter re-wraps on every invocation, so it always reflects the latest function
237
+ * reference from the provided getter — useful when the function under test is re-created between tests.
238
+ *
239
+ * @param wrapper - The cloud function wrapper providing gen 1 wrap support.
240
+ * @param getter - Lazy accessor for the gen 1 cloud function under test; re-evaluated on every getter call.
241
+ * @returns A getter that, when invoked, returns a freshly wrapped gen 1 cloud function ready for invocation in tests.
242
+ *
243
+ * @deprecated Prefer gen 2 functions and {@link wrapCloudFunctionV2ForTests} or {@link wrapCloudFunctionTests}.
244
+ *
245
+ * @example
246
+ * ```ts
247
+ * const getWrapped = wrapCloudFunctionV1ForTests(wrapper, () => myV1Function);
248
+ * const result = await getWrapped()({ /* event data *\/ });
249
+ * ```
250
+ */
251
+ export declare function wrapCloudFunctionV1ForTests<I, T extends WrapCloudFunctionV1Input<I> = WrapCloudFunctionV1Input<I>>(wrapper: FirebaseAdminCloudFunctionWrapper, getter: Getter<T>): Getter<WrappedCloudFunctionV1<I>>;
252
252
  /**
253
253
  * @deprecated use WrappedCallableRequest instead.
254
254
  */
@@ -4,8 +4,8 @@ import { type TestFirestoreContext, TestFirestoreInstance, TestFirestoreContextF
4
4
  * Configuration for connecting to a Google Cloud Firestore emulator in tests.
5
5
  */
6
6
  export interface GoogleCloudTestFirestoreConfig {
7
- host: string;
8
- port: number;
7
+ readonly host: string;
8
+ readonly port: number;
9
9
  }
10
10
  /**
11
11
  * A {@link TestFirestoreContext} backed by `@google-cloud/firestore`.
@@ -121,7 +121,7 @@ export declare class OAuthAuthorizedSuperTestFixture extends AbstractTestContext
121
121
  * and provides an authenticated supertest agent and helper methods.
122
122
  *
123
123
  * @param config - Optional flow overrides (scopes, redirect URI, client name, timeout) and custom fixture/instance constructors.
124
- * @returns A function that, given parent fixtures and a `buildTests` callback, registers a `describe('(oauth)', ...)` block which performs the full OAuth flow and exposes the authenticated supertest fixture.
124
+ * @returns Function that, given parent fixtures and a `buildTests` callback, registers a `describe('(oauth)', ...)` block which performs the full OAuth flow and exposes the authenticated supertest fixture.
125
125
  *
126
126
  * @example
127
127
  * ```typescript
@@ -50,7 +50,7 @@ export interface PerformFullOAuthFlowInput {
50
50
  * @param input.uid - Firebase user ID for whom the test ID token is minted and the OAuth flow is authorized.
51
51
  * @param input.config - Optional flow overrides (scopes, redirect URI, client name, token endpoint auth method).
52
52
  * @returns The exchanged access token and ID token from the OIDC `/token` endpoint.
53
- * @throws Error when the token exchange step fails (the response body and status are included in the message).
53
+ * @throws {Error} When the token exchange step fails (the response body and status are included in the message).
54
54
  */
55
55
  export declare function performFullOAuthFlow(input: PerformFullOAuthFlowInput): Promise<PerformFullOAuthFlowResult>;
56
56
  /**
@@ -4,8 +4,8 @@ import { type FirebaseStorage } from '@dereekb/firebase';
4
4
  * Configuration for connecting to a Google Cloud Storage emulator in tests.
5
5
  */
6
6
  export interface GoogleCloudTestFirebaseStorageConfig {
7
- host: string;
8
- port: number;
7
+ readonly host: string;
8
+ readonly port: number;
9
9
  }
10
10
  /**
11
11
  * A {@link TestFirebaseStorageContext} backed by `@google-cloud/storage`.