@dereekb/firebase-server 13.36.0 → 13.38.0

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 (45) hide show
  1. package/calcom/package.json +10 -10
  2. package/discord/package.json +10 -10
  3. package/index.cjs.js +1732 -510
  4. package/index.esm.js +1717 -513
  5. package/mailgun/package.json +9 -9
  6. package/mcp/index.cjs.js +913 -167
  7. package/mcp/index.esm.js +906 -166
  8. package/mcp/package.json +13 -12
  9. package/mcp/src/lib/controller/mcp.controller.d.ts +28 -3
  10. package/mcp/src/lib/controller/mcp.wellknown.controller.d.ts +21 -1
  11. package/mcp/src/lib/mcp.config.d.ts +31 -8
  12. package/mcp/src/lib/mcp.module.d.ts +2 -1
  13. package/mcp/src/lib/service/index.d.ts +1 -0
  14. package/mcp/src/lib/service/mcp.server.factory.d.ts +8 -6
  15. package/mcp/src/lib/service/mcp.tool-generator.d.ts +1 -1
  16. package/mcp/src/lib/service/mcp.visibility.d.ts +1 -1
  17. package/mcp/src/lib/service/tools/mcp.tool.model-roles.d.ts +95 -0
  18. package/mcp/src/lib/transport/streamable-http.transport.d.ts +16 -11
  19. package/model/index.cjs.js +1 -1
  20. package/model/index.esm.js +1 -1
  21. package/model/package.json +9 -9
  22. package/oidc/index.cjs.js +257 -67
  23. package/oidc/index.esm.js +256 -69
  24. package/oidc/package.json +10 -10
  25. package/oidc/src/lib/profile.d.ts +21 -0
  26. package/oidc/src/lib/service/index.d.ts +1 -0
  27. package/oidc/src/lib/service/oidc.config.service.d.ts +14 -0
  28. package/oidc/src/lib/service/oidc.interaction-policy.d.ts +35 -0
  29. package/oidc/src/lib/service/oidc.service.d.ts +29 -0
  30. package/package.json +14 -13
  31. package/src/lib/env/env.service.d.ts +27 -3
  32. package/src/lib/nest/controller/api.scope.d.ts +63 -0
  33. package/src/lib/nest/controller/index.d.ts +2 -0
  34. package/src/lib/nest/controller/model/model.api.get.service.d.ts +146 -1
  35. package/src/lib/nest/controller/model/model.api.scope.d.ts +3 -2
  36. package/src/lib/nest/controller/session/index.d.ts +4 -0
  37. package/src/lib/nest/controller/session/session.api.config.d.ts +104 -0
  38. package/src/lib/nest/controller/session/session.api.controller.d.ts +26 -0
  39. package/src/lib/nest/controller/session/session.api.module.d.ts +49 -0
  40. package/src/lib/nest/controller/session/session.api.service.d.ts +71 -0
  41. package/test/index.cjs.js +8 -8
  42. package/test/index.esm.js +8 -8
  43. package/test/package.json +11 -11
  44. package/twilio/package.json +8 -8
  45. package/zoho/package.json +10 -10
package/index.cjs.js CHANGED
@@ -13,8 +13,8 @@ var common = require('@nestjs/common');
13
13
  var core = require('@nestjs/core');
14
14
  var analytics = require('@dereekb/analytics');
15
15
  var nestjs$1 = require('@dereekb/analytics/nestjs');
16
- var v2 = require('firebase-functions/v2');
17
16
  var model = require('@dereekb/model');
17
+ var v2 = require('firebase-functions/v2');
18
18
  var admin = require('firebase-admin');
19
19
  var storage = require('@google-cloud/storage');
20
20
  var dateFns = require('date-fns');
@@ -23,7 +23,7 @@ var rxjs$1 = require('@dereekb/rxjs');
23
23
  var platformExpress = require('@nestjs/platform-express');
24
24
  var express = require('express');
25
25
 
26
- function _define_property$z(obj, key, value) {
26
+ function _define_property$C(obj, key, value) {
27
27
  if (key in obj) {
28
28
  Object.defineProperty(obj, key, {
29
29
  value: value,
@@ -36,7 +36,7 @@ function _define_property$z(obj, key, value) {
36
36
  }
37
37
  return obj;
38
38
  }
39
- function _object_spread$l(target) {
39
+ function _object_spread$m(target) {
40
40
  for(var i = 1; i < arguments.length; i++){
41
41
  var source = arguments[i] != null ? arguments[i] : {};
42
42
  var ownKeys = Object.keys(source);
@@ -46,12 +46,12 @@ function _object_spread$l(target) {
46
46
  }));
47
47
  }
48
48
  ownKeys.forEach(function(key) {
49
- _define_property$z(target, key, source[key]);
49
+ _define_property$C(target, key, source[key]);
50
50
  });
51
51
  }
52
52
  return target;
53
53
  }
54
- function ownKeys$e(object, enumerableOnly) {
54
+ function ownKeys$g(object, enumerableOnly) {
55
55
  var keys = Object.keys(object);
56
56
  if (Object.getOwnPropertySymbols) {
57
57
  var symbols = Object.getOwnPropertySymbols(object);
@@ -59,12 +59,12 @@ function ownKeys$e(object, enumerableOnly) {
59
59
  }
60
60
  return keys;
61
61
  }
62
- function _object_spread_props$e(target, source) {
62
+ function _object_spread_props$g(target, source) {
63
63
  source = source != null ? source : {};
64
64
  if (Object.getOwnPropertyDescriptors) {
65
65
  Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
66
66
  } else {
67
- ownKeys$e(Object(source)).forEach(function(key) {
67
+ ownKeys$g(Object(source)).forEach(function(key) {
68
68
  Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
69
69
  });
70
70
  }
@@ -103,7 +103,7 @@ function _type_of$7(obj) {
103
103
  */ function unauthenticatedError(messageOrError) {
104
104
  var _serverError_message;
105
105
  var serverError = util.partialServerError(messageOrError);
106
- return new https.HttpsError('unauthenticated', (_serverError_message = serverError.message) !== null && _serverError_message !== void 0 ? _serverError_message : 'unauthenticated', _object_spread_props$e(_object_spread$l({
106
+ return new https.HttpsError('unauthenticated', (_serverError_message = serverError.message) !== null && _serverError_message !== void 0 ? _serverError_message : 'unauthenticated', _object_spread_props$g(_object_spread$m({
107
107
  status: 401,
108
108
  code: firebase.UNAUTHENTICATED_ERROR_CODE
109
109
  }, serverError), {
@@ -118,7 +118,7 @@ function _type_of$7(obj) {
118
118
  */ function forbiddenError(messageOrError) {
119
119
  var _serverError_message;
120
120
  var serverError = util.partialServerError(messageOrError);
121
- return new https.HttpsError('permission-denied', (_serverError_message = serverError.message) !== null && _serverError_message !== void 0 ? _serverError_message : 'forbidden', _object_spread_props$e(_object_spread$l({
121
+ return new https.HttpsError('permission-denied', (_serverError_message = serverError.message) !== null && _serverError_message !== void 0 ? _serverError_message : 'forbidden', _object_spread_props$g(_object_spread$m({
122
122
  status: 403,
123
123
  code: firebase.FORBIDDEN_ERROR_CODE
124
124
  }, serverError), {
@@ -133,7 +133,7 @@ function _type_of$7(obj) {
133
133
  */ function permissionDeniedError(messageOrError) {
134
134
  var _serverError_message;
135
135
  var serverError = util.partialServerError(messageOrError);
136
- return new https.HttpsError('permission-denied', (_serverError_message = serverError.message) !== null && _serverError_message !== void 0 ? _serverError_message : 'permission denied', _object_spread_props$e(_object_spread$l({
136
+ return new https.HttpsError('permission-denied', (_serverError_message = serverError.message) !== null && _serverError_message !== void 0 ? _serverError_message : 'permission denied', _object_spread_props$g(_object_spread$m({
137
137
  status: 403,
138
138
  code: firebase.PERMISSION_DENIED_ERROR_CODE
139
139
  }, serverError), {
@@ -148,7 +148,7 @@ function _type_of$7(obj) {
148
148
  */ function notFoundError(messageOrError) {
149
149
  var _serverError_message;
150
150
  var serverError = util.partialServerError(messageOrError);
151
- return new https.HttpsError('not-found', (_serverError_message = serverError.message) !== null && _serverError_message !== void 0 ? _serverError_message : 'not found', _object_spread_props$e(_object_spread$l({
151
+ return new https.HttpsError('not-found', (_serverError_message = serverError.message) !== null && _serverError_message !== void 0 ? _serverError_message : 'not found', _object_spread_props$g(_object_spread$m({
152
152
  status: 404,
153
153
  code: firebase.NOT_FOUND_ERROR_CODE
154
154
  }, serverError), {
@@ -163,7 +163,7 @@ function _type_of$7(obj) {
163
163
  */ function modelNotAvailableError(messageOrError) {
164
164
  var _serverError_message;
165
165
  var serverError = util.partialServerError(messageOrError);
166
- return new https.HttpsError('not-found', (_serverError_message = serverError.message) !== null && _serverError_message !== void 0 ? _serverError_message : 'model was not available', _object_spread_props$e(_object_spread$l({
166
+ return new https.HttpsError('not-found', (_serverError_message = serverError.message) !== null && _serverError_message !== void 0 ? _serverError_message : 'model was not available', _object_spread_props$g(_object_spread$m({
167
167
  status: 404,
168
168
  code: firebase.MODEL_NOT_AVAILABLE_ERROR_CODE
169
169
  }, serverError), {
@@ -178,7 +178,7 @@ function _type_of$7(obj) {
178
178
  */ function badRequestError(messageOrError) {
179
179
  var _serverError_message;
180
180
  var serverError = util.partialServerError(messageOrError);
181
- return new https.HttpsError('invalid-argument', (_serverError_message = serverError.message) !== null && _serverError_message !== void 0 ? _serverError_message : 'bad request', _object_spread_props$e(_object_spread$l({
181
+ return new https.HttpsError('invalid-argument', (_serverError_message = serverError.message) !== null && _serverError_message !== void 0 ? _serverError_message : 'bad request', _object_spread_props$g(_object_spread$m({
182
182
  status: 400,
183
183
  code: firebase.BAD_REQUEST_ERROR_CODE
184
184
  }, serverError), {
@@ -193,7 +193,7 @@ function _type_of$7(obj) {
193
193
  */ function preconditionConflictError(messageOrError) {
194
194
  var _serverError_message;
195
195
  var serverError = util.partialServerError(messageOrError);
196
- return new https.HttpsError('failed-precondition', (_serverError_message = serverError.message) !== null && _serverError_message !== void 0 ? _serverError_message : 'conflict', _object_spread_props$e(_object_spread$l({
196
+ return new https.HttpsError('failed-precondition', (_serverError_message = serverError.message) !== null && _serverError_message !== void 0 ? _serverError_message : 'conflict', _object_spread_props$g(_object_spread$m({
197
197
  status: 409,
198
198
  code: firebase.CONFLICT_ERROR_CODE
199
199
  }, serverError), {
@@ -208,7 +208,7 @@ function _type_of$7(obj) {
208
208
  */ function alreadyExistsError(messageOrError) {
209
209
  var _serverError_message;
210
210
  var serverError = util.partialServerError(messageOrError);
211
- return new https.HttpsError('already-exists', (_serverError_message = serverError.message) !== null && _serverError_message !== void 0 ? _serverError_message : 'already exists', _object_spread_props$e(_object_spread$l({
211
+ return new https.HttpsError('already-exists', (_serverError_message = serverError.message) !== null && _serverError_message !== void 0 ? _serverError_message : 'already exists', _object_spread_props$g(_object_spread$m({
212
212
  status: 409,
213
213
  code: firebase.ALREADY_EXISTS_ERROR_CODE
214
214
  }, serverError), {
@@ -223,7 +223,7 @@ function _type_of$7(obj) {
223
223
  */ function unavailableError(messageOrError) {
224
224
  var _serverError_message;
225
225
  var serverError = util.partialServerError(messageOrError);
226
- return new https.HttpsError('unavailable', (_serverError_message = serverError.message) !== null && _serverError_message !== void 0 ? _serverError_message : 'service unavailable', _object_spread_props$e(_object_spread$l({
226
+ return new https.HttpsError('unavailable', (_serverError_message = serverError.message) !== null && _serverError_message !== void 0 ? _serverError_message : 'service unavailable', _object_spread_props$g(_object_spread$m({
227
227
  status: 503,
228
228
  code: firebase.UNAVAILABLE_ERROR_CODE
229
229
  }, serverError), {
@@ -238,7 +238,7 @@ function _type_of$7(obj) {
238
238
  */ function unavailableOrDeactivatedFunctionError(messageOrError) {
239
239
  var _serverError_message;
240
240
  var serverError = util.partialServerError(messageOrError);
241
- return new https.HttpsError('unimplemented', (_serverError_message = serverError.message) !== null && _serverError_message !== void 0 ? _serverError_message : 'the requested function is not available or has been deactivated for use', _object_spread_props$e(_object_spread$l({
241
+ return new https.HttpsError('unimplemented', (_serverError_message = serverError.message) !== null && _serverError_message !== void 0 ? _serverError_message : 'the requested function is not available or has been deactivated for use', _object_spread_props$g(_object_spread$m({
242
242
  status: 501,
243
243
  code: firebase.UNAVAILABLE_OR_DEACTIVATED_FUNCTION_ERROR_CODE
244
244
  }, serverError), {
@@ -253,7 +253,7 @@ function _type_of$7(obj) {
253
253
  */ function internalServerError(messageOrError) {
254
254
  var _serverError_message;
255
255
  var serverError = util.partialServerError(messageOrError);
256
- return new https.HttpsError('internal', (_serverError_message = serverError.message) !== null && _serverError_message !== void 0 ? _serverError_message : 'internal error', _object_spread_props$e(_object_spread$l({
256
+ return new https.HttpsError('internal', (_serverError_message = serverError.message) !== null && _serverError_message !== void 0 ? _serverError_message : 'internal error', _object_spread_props$g(_object_spread$m({
257
257
  status: 500,
258
258
  code: firebase.INTERNAL_SERVER_ERROR_CODE
259
259
  }, serverError), {
@@ -489,7 +489,7 @@ function toIsoStringFromUnixSeconds(value) {
489
489
  return result;
490
490
  }
491
491
 
492
- function asyncGeneratorStep$h(gen, resolve, reject, _next, _throw, key, arg) {
492
+ function asyncGeneratorStep$j(gen, resolve, reject, _next, _throw, key, arg) {
493
493
  try {
494
494
  var info = gen[key](arg);
495
495
  var value = info.value;
@@ -503,22 +503,22 @@ function asyncGeneratorStep$h(gen, resolve, reject, _next, _throw, key, arg) {
503
503
  Promise.resolve(value).then(_next, _throw);
504
504
  }
505
505
  }
506
- function _async_to_generator$h(fn) {
506
+ function _async_to_generator$j(fn) {
507
507
  return function() {
508
508
  var self = this, args = arguments;
509
509
  return new Promise(function(resolve, reject) {
510
510
  var gen = fn.apply(self, args);
511
511
  function _next(value) {
512
- asyncGeneratorStep$h(gen, resolve, reject, _next, _throw, "next", value);
512
+ asyncGeneratorStep$j(gen, resolve, reject, _next, _throw, "next", value);
513
513
  }
514
514
  function _throw(err) {
515
- asyncGeneratorStep$h(gen, resolve, reject, _next, _throw, "throw", err);
515
+ asyncGeneratorStep$j(gen, resolve, reject, _next, _throw, "throw", err);
516
516
  }
517
517
  _next(undefined);
518
518
  });
519
519
  };
520
520
  }
521
- function _ts_generator$h(thisArg, body) {
521
+ function _ts_generator$j(thisArg, body) {
522
522
  var f, y, t, _ = {
523
523
  label: 0,
524
524
  sent: function() {
@@ -634,9 +634,9 @@ function _ts_generator$h(thisArg, body) {
634
634
  * }
635
635
  * ```
636
636
  */ function getAuthUserOrUndefined(promise) {
637
- return _async_to_generator$h(function() {
637
+ return _async_to_generator$j(function() {
638
638
  var result, error;
639
- return _ts_generator$h(this, function(_state) {
639
+ return _ts_generator$j(this, function(_state) {
640
640
  switch(_state.label){
641
641
  case 0:
642
642
  _state.trys.push([
@@ -684,12 +684,12 @@ function _call_super$5(_this, derived, args) {
684
684
  derived = _get_prototype_of$5(derived);
685
685
  return _possible_constructor_return$5(_this, _is_native_reflect_construct$5() ? Reflect.construct(derived, args || [], _get_prototype_of$5(_this).constructor) : derived.apply(_this, args));
686
686
  }
687
- function _class_call_check$r(instance, Constructor) {
687
+ function _class_call_check$u(instance, Constructor) {
688
688
  if (!(instance instanceof Constructor)) {
689
689
  throw new TypeError("Cannot call a class as a function");
690
690
  }
691
691
  }
692
- function _define_property$y(obj, key, value) {
692
+ function _define_property$B(obj, key, value) {
693
693
  if (key in obj) {
694
694
  Object.defineProperty(obj, key, {
695
695
  value: value,
@@ -763,11 +763,11 @@ function _is_native_reflect_construct$5() {
763
763
  */ var FirebaseServerAuthUserExistsError = /*#__PURE__*/ function(BaseError) {
764
764
  _inherits$5(FirebaseServerAuthUserExistsError, BaseError);
765
765
  function FirebaseServerAuthUserExistsError(code, identifierType, identifierValue) {
766
- _class_call_check$r(this, FirebaseServerAuthUserExistsError);
766
+ _class_call_check$u(this, FirebaseServerAuthUserExistsError);
767
767
  var _this;
768
768
  _this = _call_super$5(this, FirebaseServerAuthUserExistsError, [
769
769
  "A user with the provided ".concat(identifierType, " already exists.")
770
- ]), _define_property$y(_this, "code", void 0), _define_property$y(_this, "identifierType", void 0), _define_property$y(_this, "identifierValue", void 0);
770
+ ]), _define_property$B(_this, "code", void 0), _define_property$B(_this, "identifierType", void 0), _define_property$B(_this, "identifierValue", void 0);
771
771
  _this.code = code;
772
772
  _this.identifierType = identifierType;
773
773
  _this.identifierValue = identifierValue;
@@ -792,11 +792,11 @@ function _is_native_reflect_construct$5() {
792
792
  */ var FirebaseServerAuthUserBadInputError = /*#__PURE__*/ function(BaseError) {
793
793
  _inherits$5(FirebaseServerAuthUserBadInputError, BaseError);
794
794
  function FirebaseServerAuthUserBadInputError(code, inputValue, message) {
795
- _class_call_check$r(this, FirebaseServerAuthUserBadInputError);
795
+ _class_call_check$u(this, FirebaseServerAuthUserBadInputError);
796
796
  var _this;
797
797
  _this = _call_super$5(this, FirebaseServerAuthUserBadInputError, [
798
798
  message !== null && message !== void 0 ? message : "Invalid input for user creation: ".concat(inputValue)
799
- ]), _define_property$y(_this, "code", void 0), _define_property$y(_this, "inputValue", void 0);
799
+ ]), _define_property$B(_this, "code", void 0), _define_property$B(_this, "inputValue", void 0);
800
800
  _this.code = code;
801
801
  _this.inputValue = inputValue;
802
802
  return _this;
@@ -808,7 +808,7 @@ function _is_native_reflect_construct$5() {
808
808
  */ var FirebaseServerAuthNewUserSendSetupDetailsNoSetupConfigError = /*#__PURE__*/ function(BaseError) {
809
809
  _inherits$5(FirebaseServerAuthNewUserSendSetupDetailsNoSetupConfigError, BaseError);
810
810
  function FirebaseServerAuthNewUserSendSetupDetailsNoSetupConfigError() {
811
- _class_call_check$r(this, FirebaseServerAuthNewUserSendSetupDetailsNoSetupConfigError);
811
+ _class_call_check$u(this, FirebaseServerAuthNewUserSendSetupDetailsNoSetupConfigError);
812
812
  return _call_super$5(this, FirebaseServerAuthNewUserSendSetupDetailsNoSetupConfigError, [
813
813
  "This user has no setup configuration available."
814
814
  ]);
@@ -820,11 +820,11 @@ function _is_native_reflect_construct$5() {
820
820
  */ var FirebaseServerAuthNewUserSendSetupDetailsThrottleError = /*#__PURE__*/ function(BaseError) {
821
821
  _inherits$5(FirebaseServerAuthNewUserSendSetupDetailsThrottleError, BaseError);
822
822
  function FirebaseServerAuthNewUserSendSetupDetailsThrottleError(lastSentAt) {
823
- _class_call_check$r(this, FirebaseServerAuthNewUserSendSetupDetailsThrottleError);
823
+ _class_call_check$u(this, FirebaseServerAuthNewUserSendSetupDetailsThrottleError);
824
824
  var _this;
825
825
  _this = _call_super$5(this, FirebaseServerAuthNewUserSendSetupDetailsThrottleError, [
826
826
  "This user was recently sent details. Try again later."
827
- ]), _define_property$y(_this, "lastSentAt", void 0);
827
+ ]), _define_property$B(_this, "lastSentAt", void 0);
828
828
  _this.lastSentAt = lastSentAt;
829
829
  return _this;
830
830
  }
@@ -836,7 +836,7 @@ function _is_native_reflect_construct$5() {
836
836
  */ var FirebaseServerAuthNewUserSendSetupDetailsSendOnceError = /*#__PURE__*/ function(BaseError) {
837
837
  _inherits$5(FirebaseServerAuthNewUserSendSetupDetailsSendOnceError, BaseError);
838
838
  function FirebaseServerAuthNewUserSendSetupDetailsSendOnceError() {
839
- _class_call_check$r(this, FirebaseServerAuthNewUserSendSetupDetailsSendOnceError);
839
+ _class_call_check$u(this, FirebaseServerAuthNewUserSendSetupDetailsSendOnceError);
840
840
  return _call_super$5(this, FirebaseServerAuthNewUserSendSetupDetailsSendOnceError, [
841
841
  "The user has been sent details before and the sendSetupDetailsOnce configuration was true."
842
842
  ]);
@@ -850,7 +850,7 @@ function _is_native_reflect_construct$5() {
850
850
  */ var FirebaseServerAuthPasswordResetNoResetConfigError = /*#__PURE__*/ function(BaseError) {
851
851
  _inherits$5(FirebaseServerAuthPasswordResetNoResetConfigError, BaseError);
852
852
  function FirebaseServerAuthPasswordResetNoResetConfigError() {
853
- _class_call_check$r(this, FirebaseServerAuthPasswordResetNoResetConfigError);
853
+ _class_call_check$u(this, FirebaseServerAuthPasswordResetNoResetConfigError);
854
854
  return _call_super$5(this, FirebaseServerAuthPasswordResetNoResetConfigError, [
855
855
  "This user has no active password reset configuration."
856
856
  ]);
@@ -863,11 +863,11 @@ function _is_native_reflect_construct$5() {
863
863
  */ var FirebaseServerAuthPasswordResetThrottleError = /*#__PURE__*/ function(BaseError) {
864
864
  _inherits$5(FirebaseServerAuthPasswordResetThrottleError, BaseError);
865
865
  function FirebaseServerAuthPasswordResetThrottleError(lastSentAt) {
866
- _class_call_check$r(this, FirebaseServerAuthPasswordResetThrottleError);
866
+ _class_call_check$u(this, FirebaseServerAuthPasswordResetThrottleError);
867
867
  var _this;
868
868
  _this = _call_super$5(this, FirebaseServerAuthPasswordResetThrottleError, [
869
869
  "This user was recently sent password reset details. Try again later."
870
- ]), _define_property$y(_this, "lastSentAt", void 0);
870
+ ]), _define_property$B(_this, "lastSentAt", void 0);
871
871
  _this.lastSentAt = lastSentAt;
872
872
  return _this;
873
873
  }
@@ -879,7 +879,7 @@ function _is_native_reflect_construct$5() {
879
879
  */ var FirebaseServerAuthPasswordResetSendOnceError = /*#__PURE__*/ function(BaseError) {
880
880
  _inherits$5(FirebaseServerAuthPasswordResetSendOnceError, BaseError);
881
881
  function FirebaseServerAuthPasswordResetSendOnceError() {
882
- _class_call_check$r(this, FirebaseServerAuthPasswordResetSendOnceError);
882
+ _class_call_check$u(this, FirebaseServerAuthPasswordResetSendOnceError);
883
883
  return _call_super$5(this, FirebaseServerAuthPasswordResetSendOnceError, [
884
884
  "The user has been sent password reset details before and the sendResetDetailsOnce configuration was true."
885
885
  ]);
@@ -892,7 +892,7 @@ function _is_native_reflect_construct$5() {
892
892
  */ var FirebaseServerAuthPasswordResetInvalidCodeError = /*#__PURE__*/ function(BaseError) {
893
893
  _inherits$5(FirebaseServerAuthPasswordResetInvalidCodeError, BaseError);
894
894
  function FirebaseServerAuthPasswordResetInvalidCodeError() {
895
- _class_call_check$r(this, FirebaseServerAuthPasswordResetInvalidCodeError);
895
+ _class_call_check$u(this, FirebaseServerAuthPasswordResetInvalidCodeError);
896
896
  return _call_super$5(this, FirebaseServerAuthPasswordResetInvalidCodeError, [
897
897
  "The provided reset password code is invalid or expired."
898
898
  ]);
@@ -901,16 +901,16 @@ function _is_native_reflect_construct$5() {
901
901
  }
902
902
  (makeError.BaseError);
903
903
 
904
- function _array_like_to_array$e(arr, len) {
904
+ function _array_like_to_array$h(arr, len) {
905
905
  if (len == null || len > arr.length) len = arr.length;
906
906
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
907
907
  return arr2;
908
908
  }
909
- function _array_with_holes$4(arr) {
909
+ function _array_with_holes$5(arr) {
910
910
  if (Array.isArray(arr)) return arr;
911
911
  }
912
- function _array_without_holes$a(arr) {
913
- if (Array.isArray(arr)) return _array_like_to_array$e(arr);
912
+ function _array_without_holes$c(arr) {
913
+ if (Array.isArray(arr)) return _array_like_to_array$h(arr);
914
914
  }
915
915
  function _assert_this_initialized$4(self) {
916
916
  if (self === void 0) {
@@ -918,7 +918,7 @@ function _assert_this_initialized$4(self) {
918
918
  }
919
919
  return self;
920
920
  }
921
- function asyncGeneratorStep$g(gen, resolve, reject, _next, _throw, key, arg) {
921
+ function asyncGeneratorStep$i(gen, resolve, reject, _next, _throw, key, arg) {
922
922
  try {
923
923
  var info = gen[key](arg);
924
924
  var value = info.value;
@@ -932,16 +932,16 @@ function asyncGeneratorStep$g(gen, resolve, reject, _next, _throw, key, arg) {
932
932
  Promise.resolve(value).then(_next, _throw);
933
933
  }
934
934
  }
935
- function _async_to_generator$g(fn) {
935
+ function _async_to_generator$i(fn) {
936
936
  return function() {
937
937
  var self = this, args = arguments;
938
938
  return new Promise(function(resolve, reject) {
939
939
  var gen = fn.apply(self, args);
940
940
  function _next(value) {
941
- asyncGeneratorStep$g(gen, resolve, reject, _next, _throw, "next", value);
941
+ asyncGeneratorStep$i(gen, resolve, reject, _next, _throw, "next", value);
942
942
  }
943
943
  function _throw(err) {
944
- asyncGeneratorStep$g(gen, resolve, reject, _next, _throw, "throw", err);
944
+ asyncGeneratorStep$i(gen, resolve, reject, _next, _throw, "throw", err);
945
945
  }
946
946
  _next(undefined);
947
947
  });
@@ -951,12 +951,12 @@ function _call_super$4(_this, derived, args) {
951
951
  derived = _get_prototype_of$4(derived);
952
952
  return _possible_constructor_return$4(_this, _is_native_reflect_construct$4() ? Reflect.construct(derived, args || [], _get_prototype_of$4(_this).constructor) : derived.apply(_this, args));
953
953
  }
954
- function _class_call_check$q(instance, Constructor) {
954
+ function _class_call_check$t(instance, Constructor) {
955
955
  if (!(instance instanceof Constructor)) {
956
956
  throw new TypeError("Cannot call a class as a function");
957
957
  }
958
958
  }
959
- function _defineProperties$g(target, props) {
959
+ function _defineProperties$i(target, props) {
960
960
  for(var i = 0; i < props.length; i++){
961
961
  var descriptor = props[i];
962
962
  descriptor.enumerable = descriptor.enumerable || false;
@@ -965,11 +965,11 @@ function _defineProperties$g(target, props) {
965
965
  Object.defineProperty(target, descriptor.key, descriptor);
966
966
  }
967
967
  }
968
- function _create_class$g(Constructor, protoProps, staticProps) {
969
- if (protoProps) _defineProperties$g(Constructor.prototype, protoProps);
968
+ function _create_class$i(Constructor, protoProps, staticProps) {
969
+ if (protoProps) _defineProperties$i(Constructor.prototype, protoProps);
970
970
  return Constructor;
971
971
  }
972
- function _define_property$x(obj, key, value) {
972
+ function _define_property$A(obj, key, value) {
973
973
  if (key in obj) {
974
974
  Object.defineProperty(obj, key, {
975
975
  value: value,
@@ -1001,10 +1001,10 @@ function _inherits$4(subClass, superClass) {
1001
1001
  });
1002
1002
  if (superClass) _set_prototype_of$4(subClass, superClass);
1003
1003
  }
1004
- function _iterable_to_array$a(iter) {
1004
+ function _iterable_to_array$c(iter) {
1005
1005
  if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
1006
1006
  }
1007
- function _iterable_to_array_limit$4(arr, i) {
1007
+ function _iterable_to_array_limit$5(arr, i) {
1008
1008
  var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
1009
1009
  if (_i == null) return;
1010
1010
  var _arr = [];
@@ -1028,13 +1028,13 @@ function _iterable_to_array_limit$4(arr, i) {
1028
1028
  }
1029
1029
  return _arr;
1030
1030
  }
1031
- function _non_iterable_rest$4() {
1031
+ function _non_iterable_rest$5() {
1032
1032
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
1033
1033
  }
1034
- function _non_iterable_spread$a() {
1034
+ function _non_iterable_spread$c() {
1035
1035
  throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
1036
1036
  }
1037
- function _object_spread$k(target) {
1037
+ function _object_spread$l(target) {
1038
1038
  for(var i = 1; i < arguments.length; i++){
1039
1039
  var source = arguments[i] != null ? arguments[i] : {};
1040
1040
  var ownKeys = Object.keys(source);
@@ -1044,7 +1044,7 @@ function _object_spread$k(target) {
1044
1044
  }));
1045
1045
  }
1046
1046
  ownKeys.forEach(function(key) {
1047
- _define_property$x(target, key, source[key]);
1047
+ _define_property$A(target, key, source[key]);
1048
1048
  });
1049
1049
  }
1050
1050
  return target;
@@ -1062,23 +1062,23 @@ function _set_prototype_of$4(o, p) {
1062
1062
  };
1063
1063
  return _set_prototype_of$4(o, p);
1064
1064
  }
1065
- function _sliced_to_array$4(arr, i) {
1066
- return _array_with_holes$4(arr) || _iterable_to_array_limit$4(arr, i) || _unsupported_iterable_to_array$e(arr, i) || _non_iterable_rest$4();
1065
+ function _sliced_to_array$5(arr, i) {
1066
+ return _array_with_holes$5(arr) || _iterable_to_array_limit$5(arr, i) || _unsupported_iterable_to_array$h(arr, i) || _non_iterable_rest$5();
1067
1067
  }
1068
- function _to_consumable_array$a(arr) {
1069
- return _array_without_holes$a(arr) || _iterable_to_array$a(arr) || _unsupported_iterable_to_array$e(arr) || _non_iterable_spread$a();
1068
+ function _to_consumable_array$c(arr) {
1069
+ return _array_without_holes$c(arr) || _iterable_to_array$c(arr) || _unsupported_iterable_to_array$h(arr) || _non_iterable_spread$c();
1070
1070
  }
1071
1071
  function _type_of$5(obj) {
1072
1072
  "@swc/helpers - typeof";
1073
1073
  return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
1074
1074
  }
1075
- function _unsupported_iterable_to_array$e(o, minLen) {
1075
+ function _unsupported_iterable_to_array$h(o, minLen) {
1076
1076
  if (!o) return;
1077
- if (typeof o === "string") return _array_like_to_array$e(o, minLen);
1077
+ if (typeof o === "string") return _array_like_to_array$h(o, minLen);
1078
1078
  var n = Object.prototype.toString.call(o).slice(8, -1);
1079
1079
  if (n === "Object" && o.constructor) n = o.constructor.name;
1080
1080
  if (n === "Map" || n === "Set") return Array.from(n);
1081
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$e(o, minLen);
1081
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$h(o, minLen);
1082
1082
  }
1083
1083
  function _is_native_reflect_construct$4() {
1084
1084
  try {
@@ -1088,7 +1088,7 @@ function _is_native_reflect_construct$4() {
1088
1088
  return !!result;
1089
1089
  })();
1090
1090
  }
1091
- function _ts_generator$g(thisArg, body) {
1091
+ function _ts_generator$i(thisArg, body) {
1092
1092
  var f, y, t, _ = {
1093
1093
  label: 0,
1094
1094
  sent: function() {
@@ -1220,16 +1220,16 @@ function _ts_generator$g(thisArg, body) {
1220
1220
  */ var AbstractFirebaseServerAuthUserContext = /*#__PURE__*/ function() {
1221
1221
  function AbstractFirebaseServerAuthUserContext(service, uid) {
1222
1222
  var _this = this;
1223
- _class_call_check$q(this, AbstractFirebaseServerAuthUserContext);
1224
- _define_property$x(this, "_service", void 0);
1225
- _define_property$x(this, "_uid", void 0);
1226
- _define_property$x(this, "_loadRecord", util.cachedGetter(function() {
1223
+ _class_call_check$t(this, AbstractFirebaseServerAuthUserContext);
1224
+ _define_property$A(this, "_service", void 0);
1225
+ _define_property$A(this, "_uid", void 0);
1226
+ _define_property$A(this, "_loadRecord", util.cachedGetter(function() {
1227
1227
  return _this._service.auth.getUser(_this._uid);
1228
1228
  }));
1229
1229
  this._service = service;
1230
1230
  this._uid = uid;
1231
1231
  }
1232
- _create_class$g(AbstractFirebaseServerAuthUserContext, [
1232
+ _create_class$i(AbstractFirebaseServerAuthUserContext, [
1233
1233
  {
1234
1234
  key: "service",
1235
1235
  get: function get() {
@@ -1245,8 +1245,8 @@ function _ts_generator$g(thisArg, body) {
1245
1245
  {
1246
1246
  key: "exists",
1247
1247
  value: function exists() {
1248
- return _async_to_generator$g(function() {
1249
- return _ts_generator$g(this, function(_state) {
1248
+ return _async_to_generator$i(function() {
1249
+ return _ts_generator$i(this, function(_state) {
1250
1250
  return [
1251
1251
  2,
1252
1252
  getAuthUserOrUndefined(this._loadRecord()).then(Boolean)
@@ -1283,9 +1283,9 @@ function _ts_generator$g(thisArg, body) {
1283
1283
  {
1284
1284
  key: "beginResetPassword",
1285
1285
  value: function beginResetPassword(options) {
1286
- return _async_to_generator$g(function() {
1286
+ return _async_to_generator$i(function() {
1287
1287
  var _ref, password, now, expiresInMs, expiresAt, _obj, passwordClaimsData;
1288
- return _ts_generator$g(this, function(_state) {
1288
+ return _ts_generator$i(this, function(_state) {
1289
1289
  switch(_state.label){
1290
1290
  case 0:
1291
1291
  password = this._generateResetPasswordKey();
@@ -1293,7 +1293,7 @@ function _ts_generator$g(thisArg, body) {
1293
1293
  // An explicit per-call lifetime wins over the context default; otherwise fall back to _resetCodeExpiresInMs().
1294
1294
  expiresInMs = (_ref = options === null || options === void 0 ? void 0 : options.resetCodeExpiresIn) !== null && _ref !== void 0 ? _ref : this._resetCodeExpiresInMs();
1295
1295
  expiresAt = new Date(now.getTime() + expiresInMs);
1296
- passwordClaimsData = (_obj = {}, _define_property$x(_obj, firebase.FIREBASE_SERVER_AUTH_CLAIMS_RESET_PASSWORD_KEY, password), _define_property$x(_obj, firebase.FIREBASE_SERVER_AUTH_CLAIMS_RESET_LAST_COM_DATE_KEY, date.toISODateString(now)), _define_property$x(_obj, firebase.FIREBASE_SERVER_AUTH_CLAIMS_RESET_EXPIRES_AT_KEY, date.toISODateString(expiresAt)), _obj);
1296
+ passwordClaimsData = (_obj = {}, _define_property$A(_obj, firebase.FIREBASE_SERVER_AUTH_CLAIMS_RESET_PASSWORD_KEY, password), _define_property$A(_obj, firebase.FIREBASE_SERVER_AUTH_CLAIMS_RESET_LAST_COM_DATE_KEY, date.toISODateString(now)), _define_property$A(_obj, firebase.FIREBASE_SERVER_AUTH_CLAIMS_RESET_EXPIRES_AT_KEY, date.toISODateString(expiresAt)), _obj);
1297
1297
  // set the claims
1298
1298
  return [
1299
1299
  4,
@@ -1324,9 +1324,9 @@ function _ts_generator$g(thisArg, body) {
1324
1324
  {
1325
1325
  key: "loadResetPasswordClaims",
1326
1326
  value: function loadResetPasswordClaims() {
1327
- return _async_to_generator$g(function() {
1327
+ return _async_to_generator$i(function() {
1328
1328
  var claims, result;
1329
- return _ts_generator$g(this, function(_state) {
1329
+ return _ts_generator$i(this, function(_state) {
1330
1330
  switch(_state.label){
1331
1331
  case 0:
1332
1332
  return [
@@ -1348,9 +1348,9 @@ function _ts_generator$g(thisArg, body) {
1348
1348
  {
1349
1349
  key: "setPassword",
1350
1350
  value: function setPassword(password) {
1351
- return _async_to_generator$g(function() {
1351
+ return _async_to_generator$i(function() {
1352
1352
  var record, _obj;
1353
- return _ts_generator$g(this, function(_state) {
1353
+ return _ts_generator$i(this, function(_state) {
1354
1354
  switch(_state.label){
1355
1355
  case 0:
1356
1356
  return [
@@ -1364,7 +1364,7 @@ function _ts_generator$g(thisArg, body) {
1364
1364
  // clear password reset claims
1365
1365
  return [
1366
1366
  4,
1367
- this.updateClaims((_obj = {}, _define_property$x(_obj, firebase.FIREBASE_SERVER_AUTH_CLAIMS_RESET_PASSWORD_KEY, null), _define_property$x(_obj, firebase.FIREBASE_SERVER_AUTH_CLAIMS_RESET_LAST_COM_DATE_KEY, null), _define_property$x(_obj, firebase.FIREBASE_SERVER_AUTH_CLAIMS_RESET_EXPIRES_AT_KEY, null), _obj))
1367
+ this.updateClaims((_obj = {}, _define_property$A(_obj, firebase.FIREBASE_SERVER_AUTH_CLAIMS_RESET_PASSWORD_KEY, null), _define_property$A(_obj, firebase.FIREBASE_SERVER_AUTH_CLAIMS_RESET_LAST_COM_DATE_KEY, null), _define_property$A(_obj, firebase.FIREBASE_SERVER_AUTH_CLAIMS_RESET_EXPIRES_AT_KEY, null), _obj))
1368
1368
  ];
1369
1369
  case 2:
1370
1370
  _state.sent();
@@ -1380,9 +1380,9 @@ function _ts_generator$g(thisArg, body) {
1380
1380
  {
1381
1381
  key: "updateUser",
1382
1382
  value: function updateUser(template) {
1383
- return _async_to_generator$g(function() {
1383
+ return _async_to_generator$i(function() {
1384
1384
  var e, firebaseError, errorCode, email, phoneNumber;
1385
- return _ts_generator$g(this, function(_state) {
1385
+ return _ts_generator$i(this, function(_state) {
1386
1386
  switch(_state.label){
1387
1387
  case 0:
1388
1388
  _state.trys.push([
@@ -1425,9 +1425,9 @@ function _ts_generator$g(thisArg, body) {
1425
1425
  {
1426
1426
  key: "loadRoles",
1427
1427
  value: function loadRoles() {
1428
- return _async_to_generator$g(function() {
1428
+ return _async_to_generator$i(function() {
1429
1429
  var claims;
1430
- return _ts_generator$g(this, function(_state) {
1430
+ return _ts_generator$i(this, function(_state) {
1431
1431
  switch(_state.label){
1432
1432
  case 0:
1433
1433
  return [
@@ -1448,9 +1448,9 @@ function _ts_generator$g(thisArg, body) {
1448
1448
  {
1449
1449
  key: "addRoles",
1450
1450
  value: function addRoles(roles) {
1451
- return _async_to_generator$g(function() {
1451
+ return _async_to_generator$i(function() {
1452
1452
  var claims;
1453
- return _ts_generator$g(this, function(_state) {
1453
+ return _ts_generator$i(this, function(_state) {
1454
1454
  claims = this._claimsForRolesChange(roles);
1455
1455
  return [
1456
1456
  2,
@@ -1463,14 +1463,14 @@ function _ts_generator$g(thisArg, body) {
1463
1463
  {
1464
1464
  key: "removeRoles",
1465
1465
  value: function removeRoles(roles) {
1466
- return _async_to_generator$g(function() {
1466
+ return _async_to_generator$i(function() {
1467
1467
  var baseClaims, claims;
1468
- return _ts_generator$g(this, function(_state) {
1468
+ return _ts_generator$i(this, function(_state) {
1469
1469
  baseClaims = this._claimsForRolesChange(roles);
1470
1470
  claims = {};
1471
1471
  util.forEachKeyValue(baseClaims, {
1472
1472
  forEach: function forEach(param) {
1473
- var _param = _sliced_to_array$4(param, 1), key = _param[0];
1473
+ var _param = _sliced_to_array$5(param, 1), key = _param[0];
1474
1474
  claims[key] = null; // set null on every key
1475
1475
  },
1476
1476
  filter: util.KeyValueTypleValueFilter.NONE // don't skip any key/value
@@ -1501,10 +1501,10 @@ function _ts_generator$g(thisArg, body) {
1501
1501
  * await userCtx.setRoles([AUTH_ADMIN_ROLE], { customFlag: 1 });
1502
1502
  * ```
1503
1503
  */ function setRoles(roles, claimsToRetain) {
1504
- return _async_to_generator$g(function() {
1504
+ return _async_to_generator$i(function() {
1505
1505
  var claims;
1506
- return _ts_generator$g(this, function(_state) {
1507
- claims = _object_spread$k({}, claimsToRetain, this._claimsForRolesChange(_to_consumable_array$a(roles)));
1506
+ return _ts_generator$i(this, function(_state) {
1507
+ claims = _object_spread$l({}, claimsToRetain, this._claimsForRolesChange(_to_consumable_array$c(roles)));
1508
1508
  return [
1509
1509
  2,
1510
1510
  this.setClaims(claims)
@@ -1537,9 +1537,9 @@ function _ts_generator$g(thisArg, body) {
1537
1537
  {
1538
1538
  key: "updateClaims",
1539
1539
  value: function updateClaims(claims) {
1540
- return _async_to_generator$g(function() {
1540
+ return _async_to_generator$i(function() {
1541
1541
  var currentClaims, newClaims;
1542
- return _ts_generator$g(this, function(_state) {
1542
+ return _ts_generator$i(this, function(_state) {
1543
1543
  switch(_state.label){
1544
1544
  case 0:
1545
1545
  return [
@@ -1548,7 +1548,7 @@ function _ts_generator$g(thisArg, body) {
1548
1548
  ];
1549
1549
  case 1:
1550
1550
  currentClaims = _state.sent();
1551
- newClaims = _object_spread$k({}, currentClaims, util.filterUndefinedValues(claims, false));
1551
+ newClaims = _object_spread$l({}, currentClaims, util.filterUndefinedValues(claims, false));
1552
1552
  newClaims = util.filterNullAndUndefinedValues(newClaims);
1553
1553
  return [
1554
1554
  2,
@@ -1588,25 +1588,25 @@ function _ts_generator$g(thisArg, body) {
1588
1588
  */ var AbstractFirebaseServerAuthContext = /*#__PURE__*/ function() {
1589
1589
  function AbstractFirebaseServerAuthContext(service, context) {
1590
1590
  var _this = this;
1591
- _class_call_check$q(this, AbstractFirebaseServerAuthContext);
1592
- _define_property$x(this, "_service", void 0);
1593
- _define_property$x(this, "_context", void 0);
1594
- _define_property$x(this, "_authRoles", util.cachedGetter(function() {
1591
+ _class_call_check$t(this, AbstractFirebaseServerAuthContext);
1592
+ _define_property$A(this, "_service", void 0);
1593
+ _define_property$A(this, "_context", void 0);
1594
+ _define_property$A(this, "_authRoles", util.cachedGetter(function() {
1595
1595
  return _this.service.readRoles(_this.claims);
1596
1596
  }));
1597
- _define_property$x(this, "_isAdmin", util.cachedGetter(function() {
1597
+ _define_property$A(this, "_isAdmin", util.cachedGetter(function() {
1598
1598
  return _this.service.isAdminInRoles(_this._authRoles());
1599
1599
  }));
1600
- _define_property$x(this, "_hasSignedTos", util.cachedGetter(function() {
1600
+ _define_property$A(this, "_hasSignedTos", util.cachedGetter(function() {
1601
1601
  return _this.service.hasSignedTosInRoles(_this._authRoles());
1602
1602
  }));
1603
- _define_property$x(this, "_userContext", util.cachedGetter(function() {
1603
+ _define_property$A(this, "_userContext", util.cachedGetter(function() {
1604
1604
  return _this.service.userContext(_this.context.auth.uid);
1605
1605
  }));
1606
1606
  this._service = service;
1607
1607
  this._context = context;
1608
1608
  }
1609
- _create_class$g(AbstractFirebaseServerAuthContext, [
1609
+ _create_class$i(AbstractFirebaseServerAuthContext, [
1610
1610
  {
1611
1611
  key: "service",
1612
1612
  get: function get() {
@@ -1706,15 +1706,15 @@ function _ts_generator$g(thisArg, body) {
1706
1706
  * ```
1707
1707
  */ var AbstractFirebaseServerNewUserService = /*#__PURE__*/ function() {
1708
1708
  function AbstractFirebaseServerNewUserService(authService) {
1709
- _class_call_check$q(this, AbstractFirebaseServerNewUserService);
1710
- _define_property$x(this, "_authService", void 0);
1709
+ _class_call_check$t(this, AbstractFirebaseServerNewUserService);
1710
+ _define_property$A(this, "_authService", void 0);
1711
1711
  /**
1712
1712
  * Minimum time between setup content sends. Defaults to {@link DEFAULT_SETUP_COM_THROTTLE_TIME} (1 hour).
1713
1713
  * Override in subclasses to customize the throttle window.
1714
- */ _define_property$x(this, "setupThrottleTime", DEFAULT_SETUP_COM_THROTTLE_TIME);
1714
+ */ _define_property$A(this, "setupThrottleTime", DEFAULT_SETUP_COM_THROTTLE_TIME);
1715
1715
  this._authService = authService;
1716
1716
  }
1717
- _create_class$g(AbstractFirebaseServerNewUserService, [
1717
+ _create_class$i(AbstractFirebaseServerNewUserService, [
1718
1718
  {
1719
1719
  key: "authService",
1720
1720
  get: function get() {
@@ -1724,9 +1724,9 @@ function _ts_generator$g(thisArg, body) {
1724
1724
  {
1725
1725
  key: "initializeNewUser",
1726
1726
  value: function initializeNewUser(input) {
1727
- return _async_to_generator$g(function() {
1727
+ return _async_to_generator$i(function() {
1728
1728
  var uid, email, phone, sendSetupContent, sendSetupContentIfUserExists, sendSetupDetailsOnce, sendSetupIgnoreThrottle, sendSetupThrowErrors, data, sendDetailsInTestEnvironment, userRecordPromise, userRecord, userRecordId, createdUser, createResult, userContext, sentEmail, userContext1;
1729
- return _ts_generator$g(this, function(_state) {
1729
+ return _ts_generator$i(this, function(_state) {
1730
1730
  switch(_state.label){
1731
1731
  case 0:
1732
1732
  uid = input.uid, email = input.email, phone = input.phone, sendSetupContent = input.sendSetupContent, sendSetupContentIfUserExists = input.sendSetupContentIfUserExists, sendSetupDetailsOnce = input.sendSetupDetailsOnce, sendSetupIgnoreThrottle = input.sendSetupIgnoreThrottle, sendSetupThrowErrors = input.sendSetupThrowErrors, data = input.data, sendDetailsInTestEnvironment = input.sendDetailsInTestEnvironment;
@@ -1821,16 +1821,16 @@ function _ts_generator$g(thisArg, body) {
1821
1821
  {
1822
1822
  key: "addNewUserSetupClaims",
1823
1823
  value: function addNewUserSetupClaims(userContextOrUid, setupPassword) {
1824
- return _async_to_generator$g(function() {
1824
+ return _async_to_generator$i(function() {
1825
1825
  var password, userContext;
1826
- return _ts_generator$g(this, function(_state) {
1826
+ return _ts_generator$i(this, function(_state) {
1827
1827
  switch(_state.label){
1828
1828
  case 0:
1829
1829
  password = setupPassword !== null && setupPassword !== void 0 ? setupPassword : this.generateRandomSetupPassword();
1830
1830
  userContext = userContextFromUid(this.authService, userContextOrUid);
1831
1831
  return [
1832
1832
  4,
1833
- userContext.updateClaims(_define_property$x({}, firebase.FIREBASE_SERVER_AUTH_CLAIMS_SETUP_PASSWORD_KEY, password))
1833
+ userContext.updateClaims(_define_property$A({}, firebase.FIREBASE_SERVER_AUTH_CLAIMS_SETUP_PASSWORD_KEY, password))
1834
1834
  ];
1835
1835
  case 1:
1836
1836
  _state.sent();
@@ -1846,9 +1846,9 @@ function _ts_generator$g(thisArg, body) {
1846
1846
  {
1847
1847
  key: "sendSetupContent",
1848
1848
  value: function sendSetupContent(userContextOrUid, config) {
1849
- return _async_to_generator$g(function() {
1849
+ return _async_to_generator$i(function() {
1850
1850
  var setupDetails, sentContent, setupCommunicationAt, hasSentCommunication, lastSentAt, sendIsThrottled;
1851
- return _ts_generator$g(this, function(_state) {
1851
+ return _ts_generator$i(this, function(_state) {
1852
1852
  switch(_state.label){
1853
1853
  case 0:
1854
1854
  return [
@@ -1929,9 +1929,9 @@ function _ts_generator$g(thisArg, body) {
1929
1929
  {
1930
1930
  key: "loadSetupDetails",
1931
1931
  value: function loadSetupDetails(userContextOrUid, config) {
1932
- return _async_to_generator$g(function() {
1932
+ return _async_to_generator$i(function() {
1933
1933
  var userContext, userExists, details;
1934
- return _ts_generator$g(this, function(_state) {
1934
+ return _ts_generator$i(this, function(_state) {
1935
1935
  switch(_state.label){
1936
1936
  case 0:
1937
1937
  userContext = userContextFromUid(this.authService, userContextOrUid);
@@ -1965,9 +1965,9 @@ function _ts_generator$g(thisArg, body) {
1965
1965
  {
1966
1966
  key: "loadSetupDetailsForUserContext",
1967
1967
  value: function loadSetupDetailsForUserContext(userContext, config) {
1968
- return _async_to_generator$g(function() {
1968
+ return _async_to_generator$i(function() {
1969
1969
  var details, _ref, setupPassword, setupCommunicationAt;
1970
- return _ts_generator$g(this, function(_state) {
1970
+ return _ts_generator$i(this, function(_state) {
1971
1971
  switch(_state.label){
1972
1972
  case 0:
1973
1973
  return [
@@ -2003,9 +2003,9 @@ function _ts_generator$g(thisArg, body) {
2003
2003
  *
2004
2004
  * @param details - The user's setup details containing the user context.
2005
2005
  */ function updateSetupContentSentTime(details) {
2006
- return _async_to_generator$g(function() {
2006
+ return _async_to_generator$i(function() {
2007
2007
  var setupCommunicationAt;
2008
- return _ts_generator$g(this, function(_state) {
2008
+ return _ts_generator$i(this, function(_state) {
2009
2009
  switch(_state.label){
2010
2010
  case 0:
2011
2011
  setupCommunicationAt = date.toISODateString(new Date());
@@ -2028,9 +2028,9 @@ function _ts_generator$g(thisArg, body) {
2028
2028
  {
2029
2029
  key: "markUserSetupAsComplete",
2030
2030
  value: function markUserSetupAsComplete(uid) {
2031
- return _async_to_generator$g(function() {
2031
+ return _async_to_generator$i(function() {
2032
2032
  var userContext, userExists;
2033
- return _ts_generator$g(this, function(_state) {
2033
+ return _ts_generator$i(this, function(_state) {
2034
2034
  switch(_state.label){
2035
2035
  case 0:
2036
2036
  userContext = this.authService.userContext(uid);
@@ -2072,9 +2072,9 @@ function _ts_generator$g(thisArg, body) {
2072
2072
  * @returns The created user record and the setup password used.
2073
2073
  * @throws {Error} Throws if the Firebase Admin SDK rejects the user creation.
2074
2074
  */ function createNewUser(input) {
2075
- return _async_to_generator$g(function() {
2075
+ return _async_to_generator$i(function() {
2076
2076
  var uid, displayName, email, phoneNumber, inputPassword, password, user, e, firebaseError, errorCode;
2077
- return _ts_generator$g(this, function(_state) {
2077
+ return _ts_generator$i(this, function(_state) {
2078
2078
  switch(_state.label){
2079
2079
  case 0:
2080
2080
  uid = input.uid, displayName = input.displayName, email = input.email, phoneNumber = input.phone, inputPassword = input.setupPassword;
@@ -2141,14 +2141,14 @@ function _ts_generator$g(thisArg, body) {
2141
2141
  *
2142
2142
  * @param userContext - The user context to clear setup claims from.
2143
2143
  */ function updateClaimsToClearUser(userContext) {
2144
- return _async_to_generator$g(function() {
2144
+ return _async_to_generator$i(function() {
2145
2145
  var _obj;
2146
- return _ts_generator$g(this, function(_state) {
2146
+ return _ts_generator$i(this, function(_state) {
2147
2147
  switch(_state.label){
2148
2148
  case 0:
2149
2149
  return [
2150
2150
  4,
2151
- userContext.updateClaims((_obj = {}, _define_property$x(_obj, firebase.FIREBASE_SERVER_AUTH_CLAIMS_SETUP_PASSWORD_KEY, null), _define_property$x(_obj, firebase.FIREBASE_SERVER_AUTH_CLAIMS_SETUP_LAST_COM_DATE_KEY, null), _obj))
2151
+ userContext.updateClaims((_obj = {}, _define_property$A(_obj, firebase.FIREBASE_SERVER_AUTH_CLAIMS_SETUP_PASSWORD_KEY, null), _define_property$A(_obj, firebase.FIREBASE_SERVER_AUTH_CLAIMS_SETUP_LAST_COM_DATE_KEY, null), _obj))
2152
2152
  ];
2153
2153
  case 1:
2154
2154
  _state.sent();
@@ -2170,15 +2170,15 @@ function _ts_generator$g(thisArg, body) {
2170
2170
  */ var NoSetupContentFirebaseServerNewUserService = /*#__PURE__*/ function(AbstractFirebaseServerNewUserService) {
2171
2171
  _inherits$4(NoSetupContentFirebaseServerNewUserService, AbstractFirebaseServerNewUserService);
2172
2172
  function NoSetupContentFirebaseServerNewUserService() {
2173
- _class_call_check$q(this, NoSetupContentFirebaseServerNewUserService);
2173
+ _class_call_check$t(this, NoSetupContentFirebaseServerNewUserService);
2174
2174
  return _call_super$4(this, NoSetupContentFirebaseServerNewUserService, arguments);
2175
2175
  }
2176
- _create_class$g(NoSetupContentFirebaseServerNewUserService, [
2176
+ _create_class$i(NoSetupContentFirebaseServerNewUserService, [
2177
2177
  {
2178
2178
  key: "sendSetupContentToUser",
2179
2179
  value: function sendSetupContentToUser(_details) {
2180
- return _async_to_generator$g(function() {
2181
- return _ts_generator$g(this, function(_state) {
2180
+ return _async_to_generator$i(function() {
2181
+ return _ts_generator$i(this, function(_state) {
2182
2182
  return [
2183
2183
  2
2184
2184
  ];
@@ -2263,15 +2263,15 @@ function _ts_generator$g(thisArg, body) {
2263
2263
  * ```
2264
2264
  */ var AbstractFirebaseServerUserPasswordResetService = /*#__PURE__*/ function() {
2265
2265
  function AbstractFirebaseServerUserPasswordResetService(authService) {
2266
- _class_call_check$q(this, AbstractFirebaseServerUserPasswordResetService);
2267
- _define_property$x(this, "_authService", void 0);
2266
+ _class_call_check$t(this, AbstractFirebaseServerUserPasswordResetService);
2267
+ _define_property$A(this, "_authService", void 0);
2268
2268
  /**
2269
2269
  * Minimum time between reset content sends. Defaults to {@link DEFAULT_RESET_COM_THROTTLE_TIME} (1 hour).
2270
2270
  * Override in subclasses to customize the throttle window.
2271
- */ _define_property$x(this, "resetThrottleTime", DEFAULT_RESET_COM_THROTTLE_TIME);
2271
+ */ _define_property$A(this, "resetThrottleTime", DEFAULT_RESET_COM_THROTTLE_TIME);
2272
2272
  this._authService = authService;
2273
2273
  }
2274
- _create_class$g(AbstractFirebaseServerUserPasswordResetService, [
2274
+ _create_class$i(AbstractFirebaseServerUserPasswordResetService, [
2275
2275
  {
2276
2276
  key: "authService",
2277
2277
  get: function get() {
@@ -2281,9 +2281,9 @@ function _ts_generator$g(thisArg, body) {
2281
2281
  {
2282
2282
  key: "beginPasswordReset",
2283
2283
  value: function beginPasswordReset(input) {
2284
- return _async_to_generator$g(function() {
2284
+ return _async_to_generator$i(function() {
2285
2285
  var uid, email, sendResetContent, sendResetDetailsOnce, sendResetIgnoreThrottle, sendResetThrowErrors, data, sendDetailsInTestEnvironment, resetCodeExpiresIn, resolvedUid, userRecord, userContext, claims, oobCode;
2286
- return _ts_generator$g(this, function(_state) {
2286
+ return _ts_generator$i(this, function(_state) {
2287
2287
  switch(_state.label){
2288
2288
  case 0:
2289
2289
  uid = input.uid, email = input.email, sendResetContent = input.sendResetContent, sendResetDetailsOnce = input.sendResetDetailsOnce, sendResetIgnoreThrottle = input.sendResetIgnoreThrottle, sendResetThrowErrors = input.sendResetThrowErrors, data = input.data, sendDetailsInTestEnvironment = input.sendDetailsInTestEnvironment, resetCodeExpiresIn = input.resetCodeExpiresIn;
@@ -2361,9 +2361,9 @@ function _ts_generator$g(thisArg, body) {
2361
2361
  {
2362
2362
  key: "sendResetContent",
2363
2363
  value: function sendResetContent(uid, config) {
2364
- return _async_to_generator$g(function() {
2364
+ return _async_to_generator$i(function() {
2365
2365
  var resetDetails, sentContent, resetCommunicationAt, hasSentCommunication, lastSentAt, sendIsThrottled;
2366
- return _ts_generator$g(this, function(_state) {
2366
+ return _ts_generator$i(this, function(_state) {
2367
2367
  switch(_state.label){
2368
2368
  case 0:
2369
2369
  return [
@@ -2442,9 +2442,9 @@ function _ts_generator$g(thisArg, body) {
2442
2442
  {
2443
2443
  key: "loadResetDetails",
2444
2444
  value: function loadResetDetails(uid, config) {
2445
- return _async_to_generator$g(function() {
2445
+ return _async_to_generator$i(function() {
2446
2446
  var userContext, userExists, details;
2447
- return _ts_generator$g(this, function(_state) {
2447
+ return _ts_generator$i(this, function(_state) {
2448
2448
  switch(_state.label){
2449
2449
  case 0:
2450
2450
  userContext = this.authService.userContext(uid);
@@ -2478,9 +2478,9 @@ function _ts_generator$g(thisArg, body) {
2478
2478
  {
2479
2479
  key: "loadResetDetailsForUserContext",
2480
2480
  value: function loadResetDetailsForUserContext(userContext, config) {
2481
- return _async_to_generator$g(function() {
2481
+ return _async_to_generator$i(function() {
2482
2482
  var details, claims;
2483
- return _ts_generator$g(this, function(_state) {
2483
+ return _ts_generator$i(this, function(_state) {
2484
2484
  switch(_state.label){
2485
2485
  case 0:
2486
2486
  return [
@@ -2518,15 +2518,15 @@ function _ts_generator$g(thisArg, body) {
2518
2518
  *
2519
2519
  * @param details - The user's reset details containing the user context.
2520
2520
  */ function updateResetContentSentTime(details) {
2521
- return _async_to_generator$g(function() {
2521
+ return _async_to_generator$i(function() {
2522
2522
  var resetCommunicationAt;
2523
- return _ts_generator$g(this, function(_state) {
2523
+ return _ts_generator$i(this, function(_state) {
2524
2524
  switch(_state.label){
2525
2525
  case 0:
2526
2526
  resetCommunicationAt = date.toISODateString(new Date());
2527
2527
  return [
2528
2528
  4,
2529
- details.userContext.updateClaims(_define_property$x({}, firebase.FIREBASE_SERVER_AUTH_CLAIMS_RESET_LAST_COM_DATE_KEY, resetCommunicationAt))
2529
+ details.userContext.updateClaims(_define_property$A({}, firebase.FIREBASE_SERVER_AUTH_CLAIMS_RESET_LAST_COM_DATE_KEY, resetCommunicationAt))
2530
2530
  ];
2531
2531
  case 1:
2532
2532
  _state.sent();
@@ -2541,9 +2541,9 @@ function _ts_generator$g(thisArg, body) {
2541
2541
  {
2542
2542
  key: "completePasswordReset",
2543
2543
  value: function completePasswordReset(input) {
2544
- return _async_to_generator$g(function() {
2544
+ return _async_to_generator$i(function() {
2545
2545
  var decoded, userContext, claims, storedCode, expiresAt, storedBuf, inputBuf;
2546
- return _ts_generator$g(this, function(_state) {
2546
+ return _ts_generator$i(this, function(_state) {
2547
2547
  switch(_state.label){
2548
2548
  case 0:
2549
2549
  // Decode the composite token. A malformed token is treated identically to every other
@@ -2612,15 +2612,15 @@ function _ts_generator$g(thisArg, body) {
2612
2612
  */ var NoContentFirebaseServerUserPasswordResetService = /*#__PURE__*/ function(AbstractFirebaseServerUserPasswordResetService) {
2613
2613
  _inherits$4(NoContentFirebaseServerUserPasswordResetService, AbstractFirebaseServerUserPasswordResetService);
2614
2614
  function NoContentFirebaseServerUserPasswordResetService() {
2615
- _class_call_check$q(this, NoContentFirebaseServerUserPasswordResetService);
2615
+ _class_call_check$t(this, NoContentFirebaseServerUserPasswordResetService);
2616
2616
  return _call_super$4(this, NoContentFirebaseServerUserPasswordResetService, arguments);
2617
2617
  }
2618
- _create_class$g(NoContentFirebaseServerUserPasswordResetService, [
2618
+ _create_class$i(NoContentFirebaseServerUserPasswordResetService, [
2619
2619
  {
2620
2620
  key: "sendPasswordResetContentToUser",
2621
2621
  value: function sendPasswordResetContentToUser(_details) {
2622
- return _async_to_generator$g(function() {
2623
- return _ts_generator$g(this, function(_state) {
2622
+ return _async_to_generator$i(function() {
2623
+ return _ts_generator$i(this, function(_state) {
2624
2624
  return [
2625
2625
  2
2626
2626
  ];
@@ -2652,7 +2652,7 @@ function _ts_generator$g(thisArg, body) {
2652
2652
  * }
2653
2653
  * ```
2654
2654
  */ var FirebaseServerAuthService = function FirebaseServerAuthService() {
2655
- _class_call_check$q(this, FirebaseServerAuthService);
2655
+ _class_call_check$t(this, FirebaseServerAuthService);
2656
2656
  };
2657
2657
  /**
2658
2658
  * Base implementation of {@link FirebaseServerAuthService} providing standard admin/ToS checks,
@@ -2683,11 +2683,11 @@ function _ts_generator$g(thisArg, body) {
2683
2683
  * ```
2684
2684
  */ var AbstractFirebaseServerAuthService = /*#__PURE__*/ function() {
2685
2685
  function AbstractFirebaseServerAuthService(auth) {
2686
- _class_call_check$q(this, AbstractFirebaseServerAuthService);
2687
- _define_property$x(this, "_auth", void 0);
2686
+ _class_call_check$t(this, AbstractFirebaseServerAuthService);
2687
+ _define_property$A(this, "_auth", void 0);
2688
2688
  this._auth = auth;
2689
2689
  }
2690
- _create_class$g(AbstractFirebaseServerAuthService, [
2690
+ _create_class$i(AbstractFirebaseServerAuthService, [
2691
2691
  {
2692
2692
  key: "auth",
2693
2693
  get: function get() {
@@ -2785,7 +2785,7 @@ function _ts_generator$g(thisArg, body) {
2785
2785
  }
2786
2786
  ();
2787
2787
 
2788
- function asyncGeneratorStep$f(gen, resolve, reject, _next, _throw, key, arg) {
2788
+ function asyncGeneratorStep$h(gen, resolve, reject, _next, _throw, key, arg) {
2789
2789
  try {
2790
2790
  var info = gen[key](arg);
2791
2791
  var value = info.value;
@@ -2799,22 +2799,22 @@ function asyncGeneratorStep$f(gen, resolve, reject, _next, _throw, key, arg) {
2799
2799
  Promise.resolve(value).then(_next, _throw);
2800
2800
  }
2801
2801
  }
2802
- function _async_to_generator$f(fn) {
2802
+ function _async_to_generator$h(fn) {
2803
2803
  return function() {
2804
2804
  var self = this, args = arguments;
2805
2805
  return new Promise(function(resolve, reject) {
2806
2806
  var gen = fn.apply(self, args);
2807
2807
  function _next(value) {
2808
- asyncGeneratorStep$f(gen, resolve, reject, _next, _throw, "next", value);
2808
+ asyncGeneratorStep$h(gen, resolve, reject, _next, _throw, "next", value);
2809
2809
  }
2810
2810
  function _throw(err) {
2811
- asyncGeneratorStep$f(gen, resolve, reject, _next, _throw, "throw", err);
2811
+ asyncGeneratorStep$h(gen, resolve, reject, _next, _throw, "throw", err);
2812
2812
  }
2813
2813
  _next(undefined);
2814
2814
  });
2815
2815
  };
2816
2816
  }
2817
- function _ts_generator$f(thisArg, body) {
2817
+ function _ts_generator$h(thisArg, body) {
2818
2818
  var f, y, t, _ = {
2819
2819
  label: 0,
2820
2820
  sent: function() {
@@ -2942,9 +2942,9 @@ function _ts_generator$f(thisArg, body) {
2942
2942
  * const userData = await assertSnapshotData(userDocument);
2943
2943
  * ```
2944
2944
  */ function assertSnapshotData(document, message) {
2945
- return _async_to_generator$f(function() {
2945
+ return _async_to_generator$h(function() {
2946
2946
  var data;
2947
- return _ts_generator$f(this, function(_state) {
2947
+ return _ts_generator$h(this, function(_state) {
2948
2948
  switch(_state.label){
2949
2949
  case 0:
2950
2950
  return [
@@ -2976,9 +2976,9 @@ function _ts_generator$f(thisArg, body) {
2976
2976
  * @returns The document's snapshot data with `id` and `key` attached.
2977
2977
  * @throws {HttpsError} Throws a {@link modelNotAvailableError} (404) if the document has no data.
2978
2978
  */ function assertSnapshotDataWithKey(document, message) {
2979
- return _async_to_generator$f(function() {
2979
+ return _async_to_generator$h(function() {
2980
2980
  var data;
2981
- return _ts_generator$f(this, function(_state) {
2981
+ return _ts_generator$h(this, function(_state) {
2982
2982
  switch(_state.label){
2983
2983
  case 0:
2984
2984
  return [
@@ -3002,9 +3002,9 @@ function _ts_generator$f(thisArg, body) {
3002
3002
  * @param message - Optional custom error message.
3003
3003
  * @throws {HttpsError} Throws a {@link modelNotAvailableError} (404) if the document does not exist.
3004
3004
  */ function assertDocumentExists(document, message) {
3005
- return _async_to_generator$f(function() {
3005
+ return _async_to_generator$h(function() {
3006
3006
  var exists;
3007
- return _ts_generator$f(this, function(_state) {
3007
+ return _ts_generator$h(this, function(_state) {
3008
3008
  switch(_state.label){
3009
3009
  case 0:
3010
3010
  return [
@@ -3070,7 +3070,7 @@ function _ts_generator$f(thisArg, body) {
3070
3070
  });
3071
3071
  }
3072
3072
 
3073
- function asyncGeneratorStep$e(gen, resolve, reject, _next, _throw, key, arg) {
3073
+ function asyncGeneratorStep$g(gen, resolve, reject, _next, _throw, key, arg) {
3074
3074
  try {
3075
3075
  var info = gen[key](arg);
3076
3076
  var value = info.value;
@@ -3084,22 +3084,22 @@ function asyncGeneratorStep$e(gen, resolve, reject, _next, _throw, key, arg) {
3084
3084
  Promise.resolve(value).then(_next, _throw);
3085
3085
  }
3086
3086
  }
3087
- function _async_to_generator$e(fn) {
3087
+ function _async_to_generator$g(fn) {
3088
3088
  return function() {
3089
3089
  var self = this, args = arguments;
3090
3090
  return new Promise(function(resolve, reject) {
3091
3091
  var gen = fn.apply(self, args);
3092
3092
  function _next(value) {
3093
- asyncGeneratorStep$e(gen, resolve, reject, _next, _throw, "next", value);
3093
+ asyncGeneratorStep$g(gen, resolve, reject, _next, _throw, "next", value);
3094
3094
  }
3095
3095
  function _throw(err) {
3096
- asyncGeneratorStep$e(gen, resolve, reject, _next, _throw, "throw", err);
3096
+ asyncGeneratorStep$g(gen, resolve, reject, _next, _throw, "throw", err);
3097
3097
  }
3098
3098
  _next(undefined);
3099
3099
  });
3100
3100
  };
3101
3101
  }
3102
- function _instanceof$3(left, right) {
3102
+ function _instanceof$4(left, right) {
3103
3103
  "@swc/helpers - instanceof";
3104
3104
  if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
3105
3105
  return !!right[Symbol.hasInstance](left);
@@ -3107,7 +3107,7 @@ function _instanceof$3(left, right) {
3107
3107
  return left instanceof right;
3108
3108
  }
3109
3109
  }
3110
- function _ts_generator$e(thisArg, body) {
3110
+ function _ts_generator$g(thisArg, body) {
3111
3111
  var f, y, t, _ = {
3112
3112
  label: 0,
3113
3113
  sent: function() {
@@ -3233,9 +3233,9 @@ function _ts_generator$e(thisArg, body) {
3233
3233
  * enumeration-safe opaque response. Pass the caller's admin status here.
3234
3234
  * @returns The result of the function.
3235
3235
  */ function catchAndThrowPasswordResetServerErrors(fn, isAdmin) {
3236
- return _async_to_generator$e(function() {
3236
+ return _async_to_generator$g(function() {
3237
3237
  var result, error;
3238
- return _ts_generator$e(this, function(_state) {
3238
+ return _ts_generator$g(this, function(_state) {
3239
3239
  switch(_state.label){
3240
3240
  case 0:
3241
3241
  _state.trys.push([
@@ -3256,13 +3256,13 @@ function _ts_generator$e(thisArg, body) {
3256
3256
  ];
3257
3257
  case 2:
3258
3258
  error = _state.sent();
3259
- if (_instanceof$3(error, FirebaseServerAuthPasswordResetInvalidCodeError)) {
3259
+ if (_instanceof$4(error, FirebaseServerAuthPasswordResetInvalidCodeError)) {
3260
3260
  throw authServicePasswordResetInvalidCodeError();
3261
- } else if (_instanceof$3(error, FirebaseServerAuthPasswordResetNoResetConfigError)) {
3261
+ } else if (_instanceof$4(error, FirebaseServerAuthPasswordResetNoResetConfigError)) {
3262
3262
  throw isAdmin ? authServicePasswordResetNoConfigError() : authServicePasswordResetInvalidCodeError();
3263
- } else if (_instanceof$3(error, FirebaseServerAuthPasswordResetSendOnceError)) {
3263
+ } else if (_instanceof$4(error, FirebaseServerAuthPasswordResetSendOnceError)) {
3264
3264
  throw isAdmin ? authServicePasswordResetSendOnceError() : authServicePasswordResetInvalidCodeError();
3265
- } else if (_instanceof$3(error, FirebaseServerAuthPasswordResetThrottleError)) {
3265
+ } else if (_instanceof$4(error, FirebaseServerAuthPasswordResetThrottleError)) {
3266
3266
  throw authServicePasswordResetThrottleError();
3267
3267
  }
3268
3268
  throw error;
@@ -3369,7 +3369,7 @@ function _ts_generator$e(thisArg, body) {
3369
3369
  ];
3370
3370
  }
3371
3371
 
3372
- function _class_call_check$p(instance, Constructor) {
3372
+ function _class_call_check$s(instance, Constructor) {
3373
3373
  if (!(instance instanceof Constructor)) {
3374
3374
  throw new TypeError("Cannot call a class as a function");
3375
3375
  }
@@ -3381,7 +3381,7 @@ function _class_call_check$p(instance, Constructor) {
3381
3381
  * Implementations are typically injected via {@link FIREBASE_SERVER_ENV_TOKEN} and
3382
3382
  * backed by a {@link FirebaseServerEnvironmentConfig}.
3383
3383
  */ var FirebaseServerEnvService = function FirebaseServerEnvService() {
3384
- _class_call_check$p(this, FirebaseServerEnvService);
3384
+ _class_call_check$s(this, FirebaseServerEnvService);
3385
3385
  }
3386
3386
  ;
3387
3387
 
@@ -3408,15 +3408,15 @@ function _class_call_check$p(instance, Constructor) {
3408
3408
  });
3409
3409
  }
3410
3410
 
3411
- function _array_like_to_array$d(arr, len) {
3411
+ function _array_like_to_array$g(arr, len) {
3412
3412
  if (len == null || len > arr.length) len = arr.length;
3413
3413
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
3414
3414
  return arr2;
3415
3415
  }
3416
- function _array_without_holes$9(arr) {
3417
- if (Array.isArray(arr)) return _array_like_to_array$d(arr);
3416
+ function _array_without_holes$b(arr) {
3417
+ if (Array.isArray(arr)) return _array_like_to_array$g(arr);
3418
3418
  }
3419
- function _define_property$w(obj, key, value) {
3419
+ function _define_property$z(obj, key, value) {
3420
3420
  if (key in obj) {
3421
3421
  Object.defineProperty(obj, key, {
3422
3422
  value: value,
@@ -3429,13 +3429,13 @@ function _define_property$w(obj, key, value) {
3429
3429
  }
3430
3430
  return obj;
3431
3431
  }
3432
- function _iterable_to_array$9(iter) {
3432
+ function _iterable_to_array$b(iter) {
3433
3433
  if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
3434
3434
  }
3435
- function _non_iterable_spread$9() {
3435
+ function _non_iterable_spread$b() {
3436
3436
  throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
3437
3437
  }
3438
- function _object_spread$j(target) {
3438
+ function _object_spread$k(target) {
3439
3439
  for(var i = 1; i < arguments.length; i++){
3440
3440
  var source = arguments[i] != null ? arguments[i] : {};
3441
3441
  var ownKeys = Object.keys(source);
@@ -3445,21 +3445,21 @@ function _object_spread$j(target) {
3445
3445
  }));
3446
3446
  }
3447
3447
  ownKeys.forEach(function(key) {
3448
- _define_property$w(target, key, source[key]);
3448
+ _define_property$z(target, key, source[key]);
3449
3449
  });
3450
3450
  }
3451
3451
  return target;
3452
3452
  }
3453
- function _to_consumable_array$9(arr) {
3454
- return _array_without_holes$9(arr) || _iterable_to_array$9(arr) || _unsupported_iterable_to_array$d(arr) || _non_iterable_spread$9();
3453
+ function _to_consumable_array$b(arr) {
3454
+ return _array_without_holes$b(arr) || _iterable_to_array$b(arr) || _unsupported_iterable_to_array$g(arr) || _non_iterable_spread$b();
3455
3455
  }
3456
- function _unsupported_iterable_to_array$d(o, minLen) {
3456
+ function _unsupported_iterable_to_array$g(o, minLen) {
3457
3457
  if (!o) return;
3458
- if (typeof o === "string") return _array_like_to_array$d(o, minLen);
3458
+ if (typeof o === "string") return _array_like_to_array$g(o, minLen);
3459
3459
  var n = Object.prototype.toString.call(o).slice(8, -1);
3460
3460
  if (n === "Object" && o.constructor) n = o.constructor.name;
3461
3461
  if (n === "Map" || n === "Set") return Array.from(n);
3462
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$d(o, minLen);
3462
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$g(o, minLen);
3463
3463
  }
3464
3464
  /**
3465
3465
  * Converts a {@link FirestoreAccessorArrayUpdate} into Firestore {@link UpdateData} using
@@ -3485,23 +3485,23 @@ function _unsupported_iterable_to_array$d(o, minLen) {
3485
3485
  result = util.mapObjectMap(fieldUpdate, function(arrayUpdate) {
3486
3486
  var result;
3487
3487
  if (arrayUpdate) {
3488
- result = arrayUpdateFunction.apply(void 0, _to_consumable_array$9(arrayUpdate)); // use spread operator to insert each value as an argument, as "nested arrays" are not allowed in the Firestore
3488
+ result = arrayUpdateFunction.apply(void 0, _to_consumable_array$b(arrayUpdate)); // use spread operator to insert each value as an argument, as "nested arrays" are not allowed in the Firestore
3489
3489
  }
3490
3490
  return result;
3491
3491
  });
3492
3492
  }
3493
3493
  return result;
3494
3494
  }
3495
- var updateData = _object_spread$j({}, createUpdatesWithArrayFunction(union, firestore.FieldValue.arrayUnion), createUpdatesWithArrayFunction(remove, firestore.FieldValue.arrayRemove));
3495
+ var updateData = _object_spread$k({}, createUpdatesWithArrayFunction(union, firestore.FieldValue.arrayUnion), createUpdatesWithArrayFunction(remove, firestore.FieldValue.arrayRemove));
3496
3496
  return updateData;
3497
3497
  }
3498
3498
 
3499
- function _class_call_check$o(instance, Constructor) {
3499
+ function _class_call_check$r(instance, Constructor) {
3500
3500
  if (!(instance instanceof Constructor)) {
3501
3501
  throw new TypeError("Cannot call a class as a function");
3502
3502
  }
3503
3503
  }
3504
- function _defineProperties$f(target, props) {
3504
+ function _defineProperties$h(target, props) {
3505
3505
  for(var i = 0; i < props.length; i++){
3506
3506
  var descriptor = props[i];
3507
3507
  descriptor.enumerable = descriptor.enumerable || false;
@@ -3510,11 +3510,11 @@ function _defineProperties$f(target, props) {
3510
3510
  Object.defineProperty(target, descriptor.key, descriptor);
3511
3511
  }
3512
3512
  }
3513
- function _create_class$f(Constructor, protoProps, staticProps) {
3514
- if (protoProps) _defineProperties$f(Constructor.prototype, protoProps);
3513
+ function _create_class$h(Constructor, protoProps, staticProps) {
3514
+ if (protoProps) _defineProperties$h(Constructor.prototype, protoProps);
3515
3515
  return Constructor;
3516
3516
  }
3517
- function _define_property$v(obj, key, value) {
3517
+ function _define_property$y(obj, key, value) {
3518
3518
  if (key in obj) {
3519
3519
  Object.defineProperty(obj, key, {
3520
3520
  value: value,
@@ -3536,13 +3536,13 @@ function _define_property$v(obj, key, value) {
3536
3536
  * (get, exists) bypass the batch and read directly from Firestore.
3537
3537
  */ var WriteBatchFirestoreDocumentDataAccessor = /*#__PURE__*/ function() {
3538
3538
  function WriteBatchFirestoreDocumentDataAccessor(batch, documentRef) {
3539
- _class_call_check$o(this, WriteBatchFirestoreDocumentDataAccessor);
3540
- _define_property$v(this, "documentRef", void 0);
3541
- _define_property$v(this, "_batch", void 0);
3539
+ _class_call_check$r(this, WriteBatchFirestoreDocumentDataAccessor);
3540
+ _define_property$y(this, "documentRef", void 0);
3541
+ _define_property$y(this, "_batch", void 0);
3542
3542
  this.documentRef = documentRef;
3543
3543
  this._batch = batch;
3544
3544
  }
3545
- _create_class$f(WriteBatchFirestoreDocumentDataAccessor, [
3545
+ _create_class$h(WriteBatchFirestoreDocumentDataAccessor, [
3546
3546
  {
3547
3547
  key: "batch",
3548
3548
  get: function get() {
@@ -3654,14 +3654,14 @@ function _define_property$v(obj, key, value) {
3654
3654
  * All document accessors created from this context queue writes into the same batch.
3655
3655
  */ var WriteBatchFirestoreDocumentContext = /*#__PURE__*/ function() {
3656
3656
  function WriteBatchFirestoreDocumentContext(batch) {
3657
- _class_call_check$o(this, WriteBatchFirestoreDocumentContext);
3658
- _define_property$v(this, "_batch", void 0);
3659
- _define_property$v(this, "contextType", firebase.FirestoreDocumentContextType.BATCH);
3660
- _define_property$v(this, "accessorFactory", void 0);
3657
+ _class_call_check$r(this, WriteBatchFirestoreDocumentContext);
3658
+ _define_property$y(this, "_batch", void 0);
3659
+ _define_property$y(this, "contextType", firebase.FirestoreDocumentContextType.BATCH);
3660
+ _define_property$y(this, "accessorFactory", void 0);
3661
3661
  this._batch = batch;
3662
3662
  this.accessorFactory = writeBatchAccessorFactory(batch);
3663
3663
  }
3664
- _create_class$f(WriteBatchFirestoreDocumentContext, [
3664
+ _create_class$h(WriteBatchFirestoreDocumentContext, [
3665
3665
  {
3666
3666
  key: "batch",
3667
3667
  get: function get() {
@@ -3680,12 +3680,12 @@ function _define_property$v(obj, key, value) {
3680
3680
  return new WriteBatchFirestoreDocumentContext(batch);
3681
3681
  }
3682
3682
 
3683
- function _class_call_check$n(instance, Constructor) {
3683
+ function _class_call_check$q(instance, Constructor) {
3684
3684
  if (!(instance instanceof Constructor)) {
3685
3685
  throw new TypeError("Cannot call a class as a function");
3686
3686
  }
3687
3687
  }
3688
- function _defineProperties$e(target, props) {
3688
+ function _defineProperties$g(target, props) {
3689
3689
  for(var i = 0; i < props.length; i++){
3690
3690
  var descriptor = props[i];
3691
3691
  descriptor.enumerable = descriptor.enumerable || false;
@@ -3694,11 +3694,11 @@ function _defineProperties$e(target, props) {
3694
3694
  Object.defineProperty(target, descriptor.key, descriptor);
3695
3695
  }
3696
3696
  }
3697
- function _create_class$e(Constructor, protoProps, staticProps) {
3698
- if (protoProps) _defineProperties$e(Constructor.prototype, protoProps);
3697
+ function _create_class$g(Constructor, protoProps, staticProps) {
3698
+ if (protoProps) _defineProperties$g(Constructor.prototype, protoProps);
3699
3699
  return Constructor;
3700
3700
  }
3701
- function _define_property$u(obj, key, value) {
3701
+ function _define_property$x(obj, key, value) {
3702
3702
  if (key in obj) {
3703
3703
  Object.defineProperty(obj, key, {
3704
3704
  value: value,
@@ -3719,11 +3719,11 @@ function _define_property$u(obj, key, value) {
3719
3719
  * batching or transactional context. Supports real-time streaming via `onSnapshot`.
3720
3720
  */ var DefaultFirestoreDocumentDataAccessor = /*#__PURE__*/ function() {
3721
3721
  function DefaultFirestoreDocumentDataAccessor(documentRef) {
3722
- _class_call_check$n(this, DefaultFirestoreDocumentDataAccessor);
3723
- _define_property$u(this, "_documentRef", void 0);
3722
+ _class_call_check$q(this, DefaultFirestoreDocumentDataAccessor);
3723
+ _define_property$x(this, "_documentRef", void 0);
3724
3724
  this._documentRef = documentRef;
3725
3725
  }
3726
- _create_class$e(DefaultFirestoreDocumentDataAccessor, [
3726
+ _create_class$g(DefaultFirestoreDocumentDataAccessor, [
3727
3727
  {
3728
3728
  key: "documentRef",
3729
3729
  get: function get() {
@@ -3831,12 +3831,12 @@ function _define_property$u(obj, key, value) {
3831
3831
  };
3832
3832
  }
3833
3833
 
3834
- function _class_call_check$m(instance, Constructor) {
3834
+ function _class_call_check$p(instance, Constructor) {
3835
3835
  if (!(instance instanceof Constructor)) {
3836
3836
  throw new TypeError("Cannot call a class as a function");
3837
3837
  }
3838
3838
  }
3839
- function _defineProperties$d(target, props) {
3839
+ function _defineProperties$f(target, props) {
3840
3840
  for(var i = 0; i < props.length; i++){
3841
3841
  var descriptor = props[i];
3842
3842
  descriptor.enumerable = descriptor.enumerable || false;
@@ -3845,11 +3845,11 @@ function _defineProperties$d(target, props) {
3845
3845
  Object.defineProperty(target, descriptor.key, descriptor);
3846
3846
  }
3847
3847
  }
3848
- function _create_class$d(Constructor, protoProps, staticProps) {
3849
- if (protoProps) _defineProperties$d(Constructor.prototype, protoProps);
3848
+ function _create_class$f(Constructor, protoProps, staticProps) {
3849
+ if (protoProps) _defineProperties$f(Constructor.prototype, protoProps);
3850
3850
  return Constructor;
3851
3851
  }
3852
- function _define_property$t(obj, key, value) {
3852
+ function _define_property$w(obj, key, value) {
3853
3853
  if (key in obj) {
3854
3854
  Object.defineProperty(obj, key, {
3855
3855
  value: value,
@@ -3871,13 +3871,13 @@ function _define_property$t(obj, key, value) {
3871
3871
  * consistency. Writes are committed atomically when the transaction completes.
3872
3872
  */ var TransactionFirestoreDocumentDataAccessor = /*#__PURE__*/ function() {
3873
3873
  function TransactionFirestoreDocumentDataAccessor(transaction, documentRef) {
3874
- _class_call_check$m(this, TransactionFirestoreDocumentDataAccessor);
3875
- _define_property$t(this, "_transaction", void 0);
3876
- _define_property$t(this, "_documentRef", void 0);
3874
+ _class_call_check$p(this, TransactionFirestoreDocumentDataAccessor);
3875
+ _define_property$w(this, "_transaction", void 0);
3876
+ _define_property$w(this, "_documentRef", void 0);
3877
3877
  this._transaction = transaction;
3878
3878
  this._documentRef = documentRef;
3879
3879
  }
3880
- _create_class$d(TransactionFirestoreDocumentDataAccessor, [
3880
+ _create_class$f(TransactionFirestoreDocumentDataAccessor, [
3881
3881
  {
3882
3882
  key: "transaction",
3883
3883
  get: function get() {
@@ -3996,14 +3996,14 @@ function _define_property$t(obj, key, value) {
3996
3996
  * All document accessors created from this context operate within the same transaction.
3997
3997
  */ var TransactionFirestoreDocumentContext = /*#__PURE__*/ function() {
3998
3998
  function TransactionFirestoreDocumentContext(transaction) {
3999
- _class_call_check$m(this, TransactionFirestoreDocumentContext);
4000
- _define_property$t(this, "_transaction", void 0);
4001
- _define_property$t(this, "contextType", firebase.FirestoreDocumentContextType.TRANSACTION);
4002
- _define_property$t(this, "accessorFactory", void 0);
3999
+ _class_call_check$p(this, TransactionFirestoreDocumentContext);
4000
+ _define_property$w(this, "_transaction", void 0);
4001
+ _define_property$w(this, "contextType", firebase.FirestoreDocumentContextType.TRANSACTION);
4002
+ _define_property$w(this, "accessorFactory", void 0);
4003
4003
  this._transaction = transaction;
4004
4004
  this.accessorFactory = transactionAccessorFactory(transaction);
4005
4005
  }
4006
- _create_class$d(TransactionFirestoreDocumentContext, [
4006
+ _create_class$f(TransactionFirestoreDocumentContext, [
4007
4007
  {
4008
4008
  key: "transaction",
4009
4009
  get: function get() {
@@ -4022,15 +4022,15 @@ function _define_property$t(obj, key, value) {
4022
4022
  return new TransactionFirestoreDocumentContext(transaction);
4023
4023
  }
4024
4024
 
4025
- function _array_like_to_array$c(arr, len) {
4025
+ function _array_like_to_array$f(arr, len) {
4026
4026
  if (len == null || len > arr.length) len = arr.length;
4027
4027
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
4028
4028
  return arr2;
4029
4029
  }
4030
- function _array_with_holes$3(arr) {
4030
+ function _array_with_holes$4(arr) {
4031
4031
  if (Array.isArray(arr)) return arr;
4032
4032
  }
4033
- function asyncGeneratorStep$d(gen, resolve, reject, _next, _throw, key, arg) {
4033
+ function asyncGeneratorStep$f(gen, resolve, reject, _next, _throw, key, arg) {
4034
4034
  try {
4035
4035
  var info = gen[key](arg);
4036
4036
  var value = info.value;
@@ -4044,22 +4044,22 @@ function asyncGeneratorStep$d(gen, resolve, reject, _next, _throw, key, arg) {
4044
4044
  Promise.resolve(value).then(_next, _throw);
4045
4045
  }
4046
4046
  }
4047
- function _async_to_generator$d(fn) {
4047
+ function _async_to_generator$f(fn) {
4048
4048
  return function() {
4049
4049
  var self = this, args = arguments;
4050
4050
  return new Promise(function(resolve, reject) {
4051
4051
  var gen = fn.apply(self, args);
4052
4052
  function _next(value) {
4053
- asyncGeneratorStep$d(gen, resolve, reject, _next, _throw, "next", value);
4053
+ asyncGeneratorStep$f(gen, resolve, reject, _next, _throw, "next", value);
4054
4054
  }
4055
4055
  function _throw(err) {
4056
- asyncGeneratorStep$d(gen, resolve, reject, _next, _throw, "throw", err);
4056
+ asyncGeneratorStep$f(gen, resolve, reject, _next, _throw, "throw", err);
4057
4057
  }
4058
4058
  _next(undefined);
4059
4059
  });
4060
4060
  };
4061
4061
  }
4062
- function _iterable_to_array_limit$3(arr, i) {
4062
+ function _iterable_to_array_limit$4(arr, i) {
4063
4063
  var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
4064
4064
  if (_i == null) return;
4065
4065
  var _arr = [];
@@ -4083,21 +4083,21 @@ function _iterable_to_array_limit$3(arr, i) {
4083
4083
  }
4084
4084
  return _arr;
4085
4085
  }
4086
- function _non_iterable_rest$3() {
4086
+ function _non_iterable_rest$4() {
4087
4087
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
4088
4088
  }
4089
- function _sliced_to_array$3(arr, i) {
4090
- return _array_with_holes$3(arr) || _iterable_to_array_limit$3(arr, i) || _unsupported_iterable_to_array$c(arr, i) || _non_iterable_rest$3();
4089
+ function _sliced_to_array$4(arr, i) {
4090
+ return _array_with_holes$4(arr) || _iterable_to_array_limit$4(arr, i) || _unsupported_iterable_to_array$f(arr, i) || _non_iterable_rest$4();
4091
4091
  }
4092
- function _unsupported_iterable_to_array$c(o, minLen) {
4092
+ function _unsupported_iterable_to_array$f(o, minLen) {
4093
4093
  if (!o) return;
4094
- if (typeof o === "string") return _array_like_to_array$c(o, minLen);
4094
+ if (typeof o === "string") return _array_like_to_array$f(o, minLen);
4095
4095
  var n = Object.prototype.toString.call(o).slice(8, -1);
4096
4096
  if (n === "Object" && o.constructor) n = o.constructor.name;
4097
4097
  if (n === "Map" || n === "Set") return Array.from(n);
4098
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$c(o, minLen);
4098
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$f(o, minLen);
4099
4099
  }
4100
- function _ts_generator$d(thisArg, body) {
4100
+ function _ts_generator$f(thisArg, body) {
4101
4101
  var f, y, t, _ = {
4102
4102
  label: 0,
4103
4103
  sent: function() {
@@ -4220,7 +4220,7 @@ function _ts_generator$d(thisArg, body) {
4220
4220
  }
4221
4221
  var batches = util.batch(pathSegments, 2); // batch to tuple [string, string]
4222
4222
  batches.forEach(function(x) {
4223
- var _x = _sliced_to_array$3(x, 2), first = _x[0], second = _x[1];
4223
+ var _x = _sliced_to_array$4(x, 2), first = _x[0], second = _x[1];
4224
4224
  ref = ref.doc(first).collection(second);
4225
4225
  });
4226
4226
  }
@@ -4247,7 +4247,7 @@ function _ts_generator$d(thisArg, body) {
4247
4247
  if (pathSegments === null || pathSegments === void 0 ? void 0 : pathSegments.length) {
4248
4248
  var batches = util.batch(pathSegments, 2); // batch to tuple [string, string]
4249
4249
  batches.forEach(function(x) {
4250
- var _x = _sliced_to_array$3(x, 2), first = _x[0], second = _x[1];
4250
+ var _x = _sliced_to_array$4(x, 2), first = _x[0], second = _x[1];
4251
4251
  var collection = doc.collection(first);
4252
4252
  doc = second ? collection.doc(second) : collection.doc();
4253
4253
  });
@@ -4294,8 +4294,8 @@ function _ts_generator$d(thisArg, body) {
4294
4294
  },
4295
4295
  transactionFactoryForFirestore: function transactionFactoryForFirestore(firestore) {
4296
4296
  return function(fn) {
4297
- return _async_to_generator$d(function() {
4298
- return _ts_generator$d(this, function(_state) {
4297
+ return _async_to_generator$f(function() {
4298
+ return _ts_generator$f(this, function(_state) {
4299
4299
  return [
4300
4300
  2,
4301
4301
  firestore.runTransaction(fn)
@@ -4315,15 +4315,15 @@ function _ts_generator$d(thisArg, body) {
4315
4315
  };
4316
4316
  }
4317
4317
 
4318
- function _array_like_to_array$b(arr, len) {
4318
+ function _array_like_to_array$e(arr, len) {
4319
4319
  if (len == null || len > arr.length) len = arr.length;
4320
4320
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
4321
4321
  return arr2;
4322
4322
  }
4323
- function _array_without_holes$8(arr) {
4324
- if (Array.isArray(arr)) return _array_like_to_array$b(arr);
4323
+ function _array_without_holes$a(arr) {
4324
+ if (Array.isArray(arr)) return _array_like_to_array$e(arr);
4325
4325
  }
4326
- function _define_property$s(obj, key, value) {
4326
+ function _define_property$v(obj, key, value) {
4327
4327
  if (key in obj) {
4328
4328
  Object.defineProperty(obj, key, {
4329
4329
  value: value,
@@ -4336,13 +4336,13 @@ function _define_property$s(obj, key, value) {
4336
4336
  }
4337
4337
  return obj;
4338
4338
  }
4339
- function _iterable_to_array$8(iter) {
4339
+ function _iterable_to_array$a(iter) {
4340
4340
  if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
4341
4341
  }
4342
- function _non_iterable_spread$8() {
4342
+ function _non_iterable_spread$a() {
4343
4343
  throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
4344
4344
  }
4345
- function _object_spread$i(target) {
4345
+ function _object_spread$j(target) {
4346
4346
  for(var i = 1; i < arguments.length; i++){
4347
4347
  var source = arguments[i] != null ? arguments[i] : {};
4348
4348
  var ownKeys = Object.keys(source);
@@ -4352,12 +4352,12 @@ function _object_spread$i(target) {
4352
4352
  }));
4353
4353
  }
4354
4354
  ownKeys.forEach(function(key) {
4355
- _define_property$s(target, key, source[key]);
4355
+ _define_property$v(target, key, source[key]);
4356
4356
  });
4357
4357
  }
4358
4358
  return target;
4359
4359
  }
4360
- function ownKeys$d(object, enumerableOnly) {
4360
+ function ownKeys$f(object, enumerableOnly) {
4361
4361
  var keys = Object.keys(object);
4362
4362
  if (Object.getOwnPropertySymbols) {
4363
4363
  var symbols = Object.getOwnPropertySymbols(object);
@@ -4365,27 +4365,27 @@ function ownKeys$d(object, enumerableOnly) {
4365
4365
  }
4366
4366
  return keys;
4367
4367
  }
4368
- function _object_spread_props$d(target, source) {
4368
+ function _object_spread_props$f(target, source) {
4369
4369
  source = source != null ? source : {};
4370
4370
  if (Object.getOwnPropertyDescriptors) {
4371
4371
  Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
4372
4372
  } else {
4373
- ownKeys$d(Object(source)).forEach(function(key) {
4373
+ ownKeys$f(Object(source)).forEach(function(key) {
4374
4374
  Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
4375
4375
  });
4376
4376
  }
4377
4377
  return target;
4378
4378
  }
4379
- function _to_consumable_array$8(arr) {
4380
- return _array_without_holes$8(arr) || _iterable_to_array$8(arr) || _unsupported_iterable_to_array$b(arr) || _non_iterable_spread$8();
4379
+ function _to_consumable_array$a(arr) {
4380
+ return _array_without_holes$a(arr) || _iterable_to_array$a(arr) || _unsupported_iterable_to_array$e(arr) || _non_iterable_spread$a();
4381
4381
  }
4382
- function _unsupported_iterable_to_array$b(o, minLen) {
4382
+ function _unsupported_iterable_to_array$e(o, minLen) {
4383
4383
  if (!o) return;
4384
- if (typeof o === "string") return _array_like_to_array$b(o, minLen);
4384
+ if (typeof o === "string") return _array_like_to_array$e(o, minLen);
4385
4385
  var n = Object.prototype.toString.call(o).slice(8, -1);
4386
4386
  if (n === "Object" && o.constructor) n = o.constructor.name;
4387
4387
  if (n === "Map" || n === "Set") return Array.from(n);
4388
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$b(o, minLen);
4388
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$e(o, minLen);
4389
4389
  }
4390
4390
  var _builder, _builder1;
4391
4391
  var _obj;
@@ -4393,31 +4393,31 @@ var _obj;
4393
4393
  * Maps each abstract query constraint type to its Google Cloud Firestore implementation.
4394
4394
  *
4395
4395
  * Used by {@link firestoreClientQueryConstraintFunctionsDriver} to build the server-side query driver.
4396
- */ var FIRESTORE_CLIENT_QUERY_CONSTRAINT_HANDLER_MAPPING = (_obj = {}, _define_property$s(_obj, firebase.FIRESTORE_LIMIT_QUERY_CONSTRAINT_TYPE, function(builder, data) {
4396
+ */ var FIRESTORE_CLIENT_QUERY_CONSTRAINT_HANDLER_MAPPING = (_obj = {}, _define_property$v(_obj, firebase.FIRESTORE_LIMIT_QUERY_CONSTRAINT_TYPE, function(builder, data) {
4397
4397
  return builder.limit(data.limit);
4398
- }), _define_property$s(_obj, firebase.FIRESTORE_LIMIT_TO_LAST_QUERY_CONSTRAINT_TYPE, function(builder, data) {
4398
+ }), _define_property$v(_obj, firebase.FIRESTORE_LIMIT_TO_LAST_QUERY_CONSTRAINT_TYPE, function(builder, data) {
4399
4399
  return builder.limitToLast(data.limit);
4400
- }), _define_property$s(_obj, firebase.FIRESTORE_ORDER_BY_QUERY_CONSTRAINT_TYPE, function(builder, data) {
4400
+ }), _define_property$v(_obj, firebase.FIRESTORE_ORDER_BY_QUERY_CONSTRAINT_TYPE, function(builder, data) {
4401
4401
  return builder.orderBy(data.fieldPath, data.directionStr);
4402
- }), _define_property$s(_obj, firebase.FIRESTORE_ORDER_BY_DOCUMENT_ID_QUERY_CONSTRAINT_TYPE, function(builder, data) {
4402
+ }), _define_property$v(_obj, firebase.FIRESTORE_ORDER_BY_DOCUMENT_ID_QUERY_CONSTRAINT_TYPE, function(builder, data) {
4403
4403
  return builder.orderBy(firestore.FieldPath.documentId(), data.directionStr);
4404
- }), _define_property$s(_obj, firebase.FIRESTORE_WHERE_QUERY_CONSTRAINT_TYPE, function(builder, data) {
4404
+ }), _define_property$v(_obj, firebase.FIRESTORE_WHERE_QUERY_CONSTRAINT_TYPE, function(builder, data) {
4405
4405
  return builder.where(data.fieldPath, data.opStr, data.value);
4406
- }), _define_property$s(_obj, firebase.FIRESTORE_WHERE_DOCUMENT_ID_QUERY_CONSTRAINT_TYPE, function(builder, data) {
4406
+ }), _define_property$v(_obj, firebase.FIRESTORE_WHERE_DOCUMENT_ID_QUERY_CONSTRAINT_TYPE, function(builder, data) {
4407
4407
  return builder.where(firestore.FieldPath.documentId(), data.opStr, data.value);
4408
- }), _define_property$s(_obj, firebase.FIRESTORE_OFFSET_QUERY_CONSTRAINT_TYPE, function(builder, data) {
4408
+ }), _define_property$v(_obj, firebase.FIRESTORE_OFFSET_QUERY_CONSTRAINT_TYPE, function(builder, data) {
4409
4409
  return builder.offset(data.offset);
4410
- }), _define_property$s(_obj, firebase.FIRESTORE_START_AT_QUERY_CONSTRAINT_TYPE, function(builder, data) {
4410
+ }), _define_property$v(_obj, firebase.FIRESTORE_START_AT_QUERY_CONSTRAINT_TYPE, function(builder, data) {
4411
4411
  return builder.startAt(data.snapshot);
4412
- }), _define_property$s(_obj, firebase.FIRESTORE_START_AT_VALUE_QUERY_CONSTRAINT_TYPE, function(builder, data) {
4413
- return (_builder = builder).startAt.apply(_builder, _to_consumable_array$8(data.fieldValues));
4414
- }), _define_property$s(_obj, firebase.FIRESTORE_START_AFTER_QUERY_CONSTRAINT_TYPE, function(builder, data) {
4412
+ }), _define_property$v(_obj, firebase.FIRESTORE_START_AT_VALUE_QUERY_CONSTRAINT_TYPE, function(builder, data) {
4413
+ return (_builder = builder).startAt.apply(_builder, _to_consumable_array$a(data.fieldValues));
4414
+ }), _define_property$v(_obj, firebase.FIRESTORE_START_AFTER_QUERY_CONSTRAINT_TYPE, function(builder, data) {
4415
4415
  return builder.startAfter(data.snapshot);
4416
- }), _define_property$s(_obj, firebase.FIRESTORE_END_AT_QUERY_CONSTRAINT_TYPE, function(builder, data) {
4416
+ }), _define_property$v(_obj, firebase.FIRESTORE_END_AT_QUERY_CONSTRAINT_TYPE, function(builder, data) {
4417
4417
  return builder.endAt(data.snapshot);
4418
- }), _define_property$s(_obj, firebase.FIRESTORE_END_AT_VALUE_QUERY_CONSTRAINT_TYPE, function(builder, data) {
4419
- return (_builder1 = builder).endAt.apply(_builder1, _to_consumable_array$8(data.fieldValues));
4420
- }), _define_property$s(_obj, firebase.FIRESTORE_END_BEFORE_QUERY_CONSTRAINT_TYPE, function(builder, data) {
4418
+ }), _define_property$v(_obj, firebase.FIRESTORE_END_AT_VALUE_QUERY_CONSTRAINT_TYPE, function(builder, data) {
4419
+ return (_builder1 = builder).endAt.apply(_builder1, _to_consumable_array$a(data.fieldValues));
4420
+ }), _define_property$v(_obj, firebase.FIRESTORE_END_BEFORE_QUERY_CONSTRAINT_TYPE, function(builder, data) {
4421
4421
  return builder.endBefore(data.snapshot);
4422
4422
  }), _obj);
4423
4423
  /**
@@ -4455,7 +4455,7 @@ var _obj;
4455
4455
  * const queryDriver = googleCloudFirestoreQueryDriver();
4456
4456
  * ```
4457
4457
  */ function googleCloudFirestoreQueryDriver() {
4458
- return _object_spread_props$d(_object_spread$i({}, firestoreClientQueryConstraintFunctionsDriver()), {
4458
+ return _object_spread_props$f(_object_spread$j({}, firestoreClientQueryConstraintFunctionsDriver()), {
4459
4459
  countDocs: function countDocs(query) {
4460
4460
  return query.count().get().then(function(x) {
4461
4461
  return x.data().count;
@@ -4621,7 +4621,7 @@ typeof SuppressedError === "function" ? SuppressedError : function(error, suppre
4621
4621
  return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
4622
4622
  };
4623
4623
 
4624
- function _class_call_check$l(instance, Constructor) {
4624
+ function _class_call_check$o(instance, Constructor) {
4625
4625
  if (!(instance instanceof Constructor)) {
4626
4626
  throw new TypeError("Cannot call a class as a function");
4627
4627
  }
@@ -4632,7 +4632,7 @@ function _class_call_check$l(instance, Constructor) {
4632
4632
  * Analogous to {@link DbxAnalyticsService} on the frontend.
4633
4633
  * Apps extend this class and provide it via {@link ON_CALL_MODEL_ANALYTICS_SERVICE}.
4634
4634
  */ var OnCallModelAnalyticsService = function OnCallModelAnalyticsService() {
4635
- _class_call_check$l(this, OnCallModelAnalyticsService);
4635
+ _class_call_check$o(this, OnCallModelAnalyticsService);
4636
4636
  };
4637
4637
  /**
4638
4638
  * Default injection token for the analytics service.
@@ -4657,7 +4657,7 @@ function _class_call_check$l(instance, Constructor) {
4657
4657
  * @deprecated Use {@link ON_CALL_MODEL_ANALYTICS_SERVICE} instead.
4658
4658
  */ var ON_CALL_MODEL_ANALYTICS_HANDLER = ON_CALL_MODEL_ANALYTICS_SERVICE;
4659
4659
 
4660
- function _class_call_check$k(instance, Constructor) {
4660
+ function _class_call_check$n(instance, Constructor) {
4661
4661
  if (!(instance instanceof Constructor)) {
4662
4662
  throw new TypeError("Cannot call a class as a function");
4663
4663
  }
@@ -4667,7 +4667,7 @@ function _class_call_check$k(instance, Constructor) {
4667
4667
  * Events are forwarded from FirebaseServerAnalyticsService to this listener
4668
4668
  * for processing by an analytics provider (e.g., Segment).
4669
4669
  */ var FirebaseServerAnalyticsServiceListener = function FirebaseServerAnalyticsServiceListener() {
4670
- _class_call_check$k(this, FirebaseServerAnalyticsServiceListener);
4670
+ _class_call_check$n(this, FirebaseServerAnalyticsServiceListener);
4671
4671
  };
4672
4672
  /**
4673
4673
  * Creates a default no-op {@link FirebaseServerAnalyticsServiceListener}.
@@ -4697,12 +4697,12 @@ function _call_super$3(_this, derived, args) {
4697
4697
  derived = _get_prototype_of$3(derived);
4698
4698
  return _possible_constructor_return$3(_this, _is_native_reflect_construct$3() ? Reflect.construct(derived, [], _get_prototype_of$3(_this).constructor) : derived.apply(_this, args));
4699
4699
  }
4700
- function _class_call_check$j(instance, Constructor) {
4700
+ function _class_call_check$m(instance, Constructor) {
4701
4701
  if (!(instance instanceof Constructor)) {
4702
4702
  throw new TypeError("Cannot call a class as a function");
4703
4703
  }
4704
4704
  }
4705
- function _defineProperties$c(target, props) {
4705
+ function _defineProperties$e(target, props) {
4706
4706
  for(var i = 0; i < props.length; i++){
4707
4707
  var descriptor = props[i];
4708
4708
  descriptor.enumerable = descriptor.enumerable || false;
@@ -4711,11 +4711,11 @@ function _defineProperties$c(target, props) {
4711
4711
  Object.defineProperty(target, descriptor.key, descriptor);
4712
4712
  }
4713
4713
  }
4714
- function _create_class$c(Constructor, protoProps, staticProps) {
4715
- if (protoProps) _defineProperties$c(Constructor.prototype, protoProps);
4714
+ function _create_class$e(Constructor, protoProps, staticProps) {
4715
+ if (protoProps) _defineProperties$e(Constructor.prototype, protoProps);
4716
4716
  return Constructor;
4717
4717
  }
4718
- function _define_property$r(obj, key, value) {
4718
+ function _define_property$u(obj, key, value) {
4719
4719
  if (key in obj) {
4720
4720
  Object.defineProperty(obj, key, {
4721
4721
  value: value,
@@ -4795,9 +4795,9 @@ function _is_native_reflect_construct$3() {
4795
4795
  */ exports.FirebaseServerAnalyticsService = /*#__PURE__*/ function(OnCallModelAnalyticsService) {
4796
4796
  _inherits$3(FirebaseServerAnalyticsService, OnCallModelAnalyticsService);
4797
4797
  function FirebaseServerAnalyticsService(listener) {
4798
- _class_call_check$j(this, FirebaseServerAnalyticsService);
4798
+ _class_call_check$m(this, FirebaseServerAnalyticsService);
4799
4799
  var _this;
4800
- _this = _call_super$3(this, FirebaseServerAnalyticsService), _define_property$r(_this, "_listener", void 0);
4800
+ _this = _call_super$3(this, FirebaseServerAnalyticsService), _define_property$u(_this, "_listener", void 0);
4801
4801
  if (listener) {
4802
4802
  _this._listener = listener;
4803
4803
  } else {
@@ -4806,7 +4806,7 @@ function _is_native_reflect_construct$3() {
4806
4806
  }
4807
4807
  return _this;
4808
4808
  }
4809
- _create_class$c(FirebaseServerAnalyticsService, [
4809
+ _create_class$e(FirebaseServerAnalyticsService, [
4810
4810
  {
4811
4811
  key: "handleOnCallAnalyticsEvent",
4812
4812
  value: function handleOnCallAnalyticsEvent(event) {
@@ -4846,7 +4846,7 @@ exports.FirebaseServerAnalyticsService = __decorate([
4846
4846
  __param(0, common.Inject(FirebaseServerAnalyticsServiceListener))
4847
4847
  ], exports.FirebaseServerAnalyticsService);
4848
4848
 
4849
- function asyncGeneratorStep$c(gen, resolve, reject, _next, _throw, key, arg) {
4849
+ function asyncGeneratorStep$e(gen, resolve, reject, _next, _throw, key, arg) {
4850
4850
  try {
4851
4851
  var info = gen[key](arg);
4852
4852
  var value = info.value;
@@ -4860,22 +4860,22 @@ function asyncGeneratorStep$c(gen, resolve, reject, _next, _throw, key, arg) {
4860
4860
  Promise.resolve(value).then(_next, _throw);
4861
4861
  }
4862
4862
  }
4863
- function _async_to_generator$c(fn) {
4863
+ function _async_to_generator$e(fn) {
4864
4864
  return function() {
4865
4865
  var self = this, args = arguments;
4866
4866
  return new Promise(function(resolve, reject) {
4867
4867
  var gen = fn.apply(self, args);
4868
4868
  function _next(value) {
4869
- asyncGeneratorStep$c(gen, resolve, reject, _next, _throw, "next", value);
4869
+ asyncGeneratorStep$e(gen, resolve, reject, _next, _throw, "next", value);
4870
4870
  }
4871
4871
  function _throw(err) {
4872
- asyncGeneratorStep$c(gen, resolve, reject, _next, _throw, "throw", err);
4872
+ asyncGeneratorStep$e(gen, resolve, reject, _next, _throw, "throw", err);
4873
4873
  }
4874
4874
  _next(undefined);
4875
4875
  });
4876
4876
  };
4877
4877
  }
4878
- function _ts_generator$c(thisArg, body) {
4878
+ function _ts_generator$e(thisArg, body) {
4879
4879
  var f, y, t, _ = {
4880
4880
  label: 0,
4881
4881
  sent: function() {
@@ -5039,7 +5039,7 @@ function _ts_generator$c(thisArg, body) {
5039
5039
  * });
5040
5040
  * ```
5041
5041
  */ function callWithAnalytics(config) {
5042
- return _async_to_generator$c(function() {
5042
+ return _async_to_generator$e(function() {
5043
5043
  var service, details, context, execute, result, emitter, error;
5044
5044
  function _safeCall(fn) {
5045
5045
  try {
@@ -5049,7 +5049,7 @@ function _ts_generator$c(thisArg, body) {
5049
5049
  console.error("callWithAnalytics: Failed to emit analytics event:", error);
5050
5050
  }
5051
5051
  }
5052
- return _ts_generator$c(this, function(_state) {
5052
+ return _ts_generator$e(this, function(_state) {
5053
5053
  switch(_state.label){
5054
5054
  case 0:
5055
5055
  service = config.service, details = config.details, context = config.context, execute = config.execute;
@@ -5108,15 +5108,15 @@ function _ts_generator$c(thisArg, body) {
5108
5108
  })();
5109
5109
  }
5110
5110
 
5111
- function _array_like_to_array$a(arr, len) {
5111
+ function _array_like_to_array$d(arr, len) {
5112
5112
  if (len == null || len > arr.length) len = arr.length;
5113
5113
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
5114
5114
  return arr2;
5115
5115
  }
5116
- function _array_with_holes$2(arr) {
5116
+ function _array_with_holes$3(arr) {
5117
5117
  if (Array.isArray(arr)) return arr;
5118
5118
  }
5119
- function _iterable_to_array_limit$2(arr, i) {
5119
+ function _iterable_to_array_limit$3(arr, i) {
5120
5120
  var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
5121
5121
  if (_i == null) return;
5122
5122
  var _arr = [];
@@ -5140,7 +5140,7 @@ function _iterable_to_array_limit$2(arr, i) {
5140
5140
  }
5141
5141
  return _arr;
5142
5142
  }
5143
- function _non_iterable_rest$2() {
5143
+ function _non_iterable_rest$3() {
5144
5144
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
5145
5145
  }
5146
5146
  function _object_without_properties(source, excluded) {
@@ -5179,16 +5179,16 @@ function _object_without_properties_loose(source, excluded) {
5179
5179
  }
5180
5180
  return target;
5181
5181
  }
5182
- function _sliced_to_array$2(arr, i) {
5183
- return _array_with_holes$2(arr) || _iterable_to_array_limit$2(arr, i) || _unsupported_iterable_to_array$a(arr, i) || _non_iterable_rest$2();
5182
+ function _sliced_to_array$3(arr, i) {
5183
+ return _array_with_holes$3(arr) || _iterable_to_array_limit$3(arr, i) || _unsupported_iterable_to_array$d(arr, i) || _non_iterable_rest$3();
5184
5184
  }
5185
- function _unsupported_iterable_to_array$a(o, minLen) {
5185
+ function _unsupported_iterable_to_array$d(o, minLen) {
5186
5186
  if (!o) return;
5187
- if (typeof o === "string") return _array_like_to_array$a(o, minLen);
5187
+ if (typeof o === "string") return _array_like_to_array$d(o, minLen);
5188
5188
  var n = Object.prototype.toString.call(o).slice(8, -1);
5189
5189
  if (n === "Object" && o.constructor) n = o.constructor.name;
5190
5190
  if (n === "Map" || n === "Set") return Array.from(n);
5191
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$a(o, minLen);
5191
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$d(o, minLen);
5192
5192
  }
5193
5193
  // MARK: Type Guards
5194
5194
  /**
@@ -5290,7 +5290,7 @@ function _unsupported_iterable_to_array$a(o, minLen) {
5290
5290
  var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
5291
5291
  try {
5292
5292
  for(var _iterator = Object.entries(config)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
5293
- var _step_value = _sliced_to_array$2(_step.value, 2), key = _step_value[0], handler = _step_value[1];
5293
+ var _step_value = _sliced_to_array$3(_step.value, 2), key = _step_value[0], handler = _step_value[1];
5294
5294
  var details = readApiDetails(handler);
5295
5295
  if (details != null) {
5296
5296
  // At the specifier level, details should be handler-level (OnCallModelFunctionApiDetails)
@@ -5330,7 +5330,7 @@ function _unsupported_iterable_to_array$a(o, minLen) {
5330
5330
  var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
5331
5331
  try {
5332
5332
  for(var _iterator = Object.entries(map)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
5333
- var _step_value = _sliced_to_array$2(_step.value, 2), key = _step_value[0], handler = _step_value[1];
5333
+ var _step_value = _sliced_to_array$3(_step.value, 2), key = _step_value[0], handler = _step_value[1];
5334
5334
  var details = readApiDetails(handler);
5335
5335
  if (details != null) {
5336
5336
  if (isOnCallModelTypeApiDetails(details)) {
@@ -5379,7 +5379,7 @@ function _unsupported_iterable_to_array$a(o, minLen) {
5379
5379
  var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
5380
5380
  try {
5381
5381
  for(var _iterator = Object.entries(map)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
5382
- var _step_value = _sliced_to_array$2(_step.value, 2), call = _step_value[0], handler = _step_value[1];
5382
+ var _step_value = _sliced_to_array$3(_step.value, 2), call = _step_value[0], handler = _step_value[1];
5383
5383
  var details = readApiDetails(handler);
5384
5384
  if (details != null) {
5385
5385
  result[call] = details;
@@ -5427,14 +5427,14 @@ function _unsupported_iterable_to_array$a(o, minLen) {
5427
5427
  try {
5428
5428
  // Pivot: iterate CRUD types, then model types within each
5429
5429
  for(var _iterator = Object.entries(topDetails)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
5430
- var _step_value = _sliced_to_array$2(_step.value, 2), callType = _step_value[0], crudDetails = _step_value[1];
5430
+ var _step_value = _sliced_to_array$3(_step.value, 2), callType = _step_value[0], crudDetails = _step_value[1];
5431
5431
  if (crudDetails == null) {
5432
5432
  continue;
5433
5433
  }
5434
5434
  var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = undefined;
5435
5435
  try {
5436
5436
  for(var _iterator1 = Object.entries(crudDetails.modelTypes)[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true){
5437
- var _step_value1 = _sliced_to_array$2(_step1.value, 2), modelType = _step_value1[0], modelDetails = _step_value1[1];
5437
+ var _step_value1 = _sliced_to_array$3(_step1.value, 2), modelType = _step_value1[0], modelDetails = _step_value1[1];
5438
5438
  if (modelDetails == null) {
5439
5439
  continue;
5440
5440
  }
@@ -5704,7 +5704,7 @@ function resolveRequiredScopeFromApiDetails(apiDetails, call, modelType, specifi
5704
5704
  }));
5705
5705
  }
5706
5706
 
5707
- function _define_property$q(obj, key, value) {
5707
+ function _define_property$t(obj, key, value) {
5708
5708
  if (key in obj) {
5709
5709
  Object.defineProperty(obj, key, {
5710
5710
  value: value,
@@ -5717,7 +5717,7 @@ function _define_property$q(obj, key, value) {
5717
5717
  }
5718
5718
  return obj;
5719
5719
  }
5720
- function _object_spread$h(target) {
5720
+ function _object_spread$i(target) {
5721
5721
  for(var i = 1; i < arguments.length; i++){
5722
5722
  var source = arguments[i] != null ? arguments[i] : {};
5723
5723
  var ownKeys = Object.keys(source);
@@ -5727,12 +5727,12 @@ function _object_spread$h(target) {
5727
5727
  }));
5728
5728
  }
5729
5729
  ownKeys.forEach(function(key) {
5730
- _define_property$q(target, key, source[key]);
5730
+ _define_property$t(target, key, source[key]);
5731
5731
  });
5732
5732
  }
5733
5733
  return target;
5734
5734
  }
5735
- function ownKeys$c(object, enumerableOnly) {
5735
+ function ownKeys$e(object, enumerableOnly) {
5736
5736
  var keys = Object.keys(object);
5737
5737
  if (Object.getOwnPropertySymbols) {
5738
5738
  var symbols = Object.getOwnPropertySymbols(object);
@@ -5740,12 +5740,12 @@ function ownKeys$c(object, enumerableOnly) {
5740
5740
  }
5741
5741
  return keys;
5742
5742
  }
5743
- function _object_spread_props$c(target, source) {
5743
+ function _object_spread_props$e(target, source) {
5744
5744
  source = source != null ? source : {};
5745
5745
  if (Object.getOwnPropertyDescriptors) {
5746
5746
  Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
5747
5747
  } else {
5748
- ownKeys$c(Object(source)).forEach(function(key) {
5748
+ ownKeys$e(Object(source)).forEach(function(key) {
5749
5749
  Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
5750
5750
  });
5751
5751
  }
@@ -5824,7 +5824,7 @@ function _object_spread_props$c(target, source) {
5824
5824
  // Resolve the leaf handler's per-function requiredScope (if any) so the preAssert can enforce
5825
5825
  // it additively with the per-verb OIDC scope. Same call -> modelType -> specifier walk as analytics.
5826
5826
  var requiredScope = resolveRequiredScopeFromApiDetails(modelApiDetails, call, modelType, specifier);
5827
- preAssert(_object_spread_props$c(_object_spread$h({}, context), {
5827
+ preAssert(_object_spread_props$e(_object_spread$i({}, context), {
5828
5828
  requiredScope: requiredScope
5829
5829
  }));
5830
5830
  var result;
@@ -5902,7 +5902,7 @@ function _object_spread_props$c(target, source) {
5902
5902
  modelType: modelType,
5903
5903
  specifier: specifier
5904
5904
  });
5905
- return crudFn(_object_spread_props$c(_object_spread$h({}, request), {
5905
+ return crudFn(_object_spread_props$e(_object_spread$i({}, request), {
5906
5906
  specifier: specifier,
5907
5907
  data: request.data.data
5908
5908
  }));
@@ -6089,15 +6089,15 @@ function _object_spread_props$c(target, source) {
6089
6089
  }));
6090
6090
  }
6091
6091
 
6092
- function _array_like_to_array$9(arr, len) {
6092
+ function _array_like_to_array$c(arr, len) {
6093
6093
  if (len == null || len > arr.length) len = arr.length;
6094
6094
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
6095
6095
  return arr2;
6096
6096
  }
6097
- function _array_without_holes$7(arr) {
6098
- if (Array.isArray(arr)) return _array_like_to_array$9(arr);
6097
+ function _array_without_holes$9(arr) {
6098
+ if (Array.isArray(arr)) return _array_like_to_array$c(arr);
6099
6099
  }
6100
- function asyncGeneratorStep$b(gen, resolve, reject, _next, _throw, key, arg) {
6100
+ function asyncGeneratorStep$d(gen, resolve, reject, _next, _throw, key, arg) {
6101
6101
  try {
6102
6102
  var info = gen[key](arg);
6103
6103
  var value = info.value;
@@ -6111,39 +6111,39 @@ function asyncGeneratorStep$b(gen, resolve, reject, _next, _throw, key, arg) {
6111
6111
  Promise.resolve(value).then(_next, _throw);
6112
6112
  }
6113
6113
  }
6114
- function _async_to_generator$b(fn) {
6114
+ function _async_to_generator$d(fn) {
6115
6115
  return function() {
6116
6116
  var self = this, args = arguments;
6117
6117
  return new Promise(function(resolve, reject) {
6118
6118
  var gen = fn.apply(self, args);
6119
6119
  function _next(value) {
6120
- asyncGeneratorStep$b(gen, resolve, reject, _next, _throw, "next", value);
6120
+ asyncGeneratorStep$d(gen, resolve, reject, _next, _throw, "next", value);
6121
6121
  }
6122
6122
  function _throw(err) {
6123
- asyncGeneratorStep$b(gen, resolve, reject, _next, _throw, "throw", err);
6123
+ asyncGeneratorStep$d(gen, resolve, reject, _next, _throw, "throw", err);
6124
6124
  }
6125
6125
  _next(undefined);
6126
6126
  });
6127
6127
  };
6128
6128
  }
6129
- function _iterable_to_array$7(iter) {
6129
+ function _iterable_to_array$9(iter) {
6130
6130
  if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
6131
6131
  }
6132
- function _non_iterable_spread$7() {
6132
+ function _non_iterable_spread$9() {
6133
6133
  throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
6134
6134
  }
6135
- function _to_consumable_array$7(arr) {
6136
- return _array_without_holes$7(arr) || _iterable_to_array$7(arr) || _unsupported_iterable_to_array$9(arr) || _non_iterable_spread$7();
6135
+ function _to_consumable_array$9(arr) {
6136
+ return _array_without_holes$9(arr) || _iterable_to_array$9(arr) || _unsupported_iterable_to_array$c(arr) || _non_iterable_spread$9();
6137
6137
  }
6138
- function _unsupported_iterable_to_array$9(o, minLen) {
6138
+ function _unsupported_iterable_to_array$c(o, minLen) {
6139
6139
  if (!o) return;
6140
- if (typeof o === "string") return _array_like_to_array$9(o, minLen);
6140
+ if (typeof o === "string") return _array_like_to_array$c(o, minLen);
6141
6141
  var n = Object.prototype.toString.call(o).slice(8, -1);
6142
6142
  if (n === "Object" && o.constructor) n = o.constructor.name;
6143
6143
  if (n === "Map" || n === "Set") return Array.from(n);
6144
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$9(o, minLen);
6144
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$c(o, minLen);
6145
6145
  }
6146
- function _ts_generator$b(thisArg, body) {
6146
+ function _ts_generator$d(thisArg, body) {
6147
6147
  var f, y, t, _ = {
6148
6148
  label: 0,
6149
6149
  sent: function() {
@@ -6346,9 +6346,9 @@ function _ts_generator$b(thisArg, body) {
6346
6346
  * };
6347
6347
  * ```
6348
6348
  */ function executeOnCallQuery(config) {
6349
- return _async_to_generator$b(function() {
6349
+ return _async_to_generator$d(function() {
6350
6350
  var _collection, _params_limit, _resultDocs_at, params, collection, loadCursorDocument, buildConstraints, _config_maxLimit, maxLimit, mapResult, requestedLimit, effectiveLimit, constraints, cursorSnapshot, e, errorInfo, executableQuery, querySnapshot, docs, hasMore, resultDocs, results, keys, cursorDocumentKey;
6351
- return _ts_generator$b(this, function(_state) {
6351
+ return _ts_generator$d(this, function(_state) {
6352
6352
  switch(_state.label){
6353
6353
  case 0:
6354
6354
  params = config.params, collection = config.collection, loadCursorDocument = config.loadCursorDocument, buildConstraints = config.buildConstraints, _config_maxLimit = config.maxLimit, maxLimit = _config_maxLimit === void 0 ? firebase.MAX_ON_CALL_QUERY_MODEL_LIMIT : _config_maxLimit, mapResult = config.mapResult;
@@ -6400,7 +6400,7 @@ function _ts_generator$b(thisArg, body) {
6400
6400
  // Fetch one extra to detect hasMore
6401
6401
  constraints.push(firebase.limit(effectiveLimit + 1));
6402
6402
  // Execute via the collection's query factory
6403
- executableQuery = (_collection = collection).query.apply(_collection, _to_consumable_array$7(constraints));
6403
+ executableQuery = (_collection = collection).query.apply(_collection, _to_consumable_array$9(constraints));
6404
6404
  return [
6405
6405
  4,
6406
6406
  executableQuery.getDocs()
@@ -6477,30 +6477,30 @@ function _ts_generator$b(thisArg, body) {
6477
6477
  }));
6478
6478
  }
6479
6479
 
6480
- function _array_like_to_array$8(arr, len) {
6480
+ function _array_like_to_array$b(arr, len) {
6481
6481
  if (len == null || len > arr.length) len = arr.length;
6482
6482
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
6483
6483
  return arr2;
6484
6484
  }
6485
- function _array_without_holes$6(arr) {
6486
- if (Array.isArray(arr)) return _array_like_to_array$8(arr);
6485
+ function _array_without_holes$8(arr) {
6486
+ if (Array.isArray(arr)) return _array_like_to_array$b(arr);
6487
6487
  }
6488
- function _iterable_to_array$6(iter) {
6488
+ function _iterable_to_array$8(iter) {
6489
6489
  if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
6490
6490
  }
6491
- function _non_iterable_spread$6() {
6491
+ function _non_iterable_spread$8() {
6492
6492
  throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
6493
6493
  }
6494
- function _to_consumable_array$6(arr) {
6495
- return _array_without_holes$6(arr) || _iterable_to_array$6(arr) || _unsupported_iterable_to_array$8(arr) || _non_iterable_spread$6();
6494
+ function _to_consumable_array$8(arr) {
6495
+ return _array_without_holes$8(arr) || _iterable_to_array$8(arr) || _unsupported_iterable_to_array$b(arr) || _non_iterable_spread$8();
6496
6496
  }
6497
- function _unsupported_iterable_to_array$8(o, minLen) {
6497
+ function _unsupported_iterable_to_array$b(o, minLen) {
6498
6498
  if (!o) return;
6499
- if (typeof o === "string") return _array_like_to_array$8(o, minLen);
6499
+ if (typeof o === "string") return _array_like_to_array$b(o, minLen);
6500
6500
  var n = Object.prototype.toString.call(o).slice(8, -1);
6501
6501
  if (n === "Object" && o.constructor) n = o.constructor.name;
6502
6502
  if (n === "Map" || n === "Set") return Array.from(n);
6503
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$8(o, minLen);
6503
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$b(o, minLen);
6504
6504
  }
6505
6505
  /**
6506
6506
  * Generates NestJS {@link ModuleMetadata} for an app's analytics module.
@@ -6525,18 +6525,18 @@ function _unsupported_iterable_to_array$8(o, minLen) {
6525
6525
  dependencyModule
6526
6526
  ] : [];
6527
6527
  return {
6528
- imports: _to_consumable_array$6(dependencyModuleImport).concat(_to_consumable_array$6(imports !== null && imports !== void 0 ? imports : [])),
6528
+ imports: _to_consumable_array$8(dependencyModuleImport).concat(_to_consumable_array$8(imports !== null && imports !== void 0 ? imports : [])),
6529
6529
  exports: [
6530
6530
  exports.FirebaseServerAnalyticsService,
6531
6531
  ON_CALL_MODEL_ANALYTICS_SERVICE
6532
- ].concat(_to_consumable_array$6(exports$1 !== null && exports$1 !== void 0 ? exports$1 : [])),
6532
+ ].concat(_to_consumable_array$8(exports$1 !== null && exports$1 !== void 0 ? exports$1 : [])),
6533
6533
  providers: [
6534
6534
  exports.FirebaseServerAnalyticsService,
6535
6535
  {
6536
6536
  provide: ON_CALL_MODEL_ANALYTICS_SERVICE,
6537
6537
  useExisting: exports.FirebaseServerAnalyticsService
6538
6538
  }
6539
- ].concat(_to_consumable_array$6(providers !== null && providers !== void 0 ? providers : []))
6539
+ ].concat(_to_consumable_array$8(providers !== null && providers !== void 0 ? providers : []))
6540
6540
  };
6541
6541
  }
6542
6542
 
@@ -6550,12 +6550,12 @@ function _call_super$2(_this, derived, args) {
6550
6550
  derived = _get_prototype_of$2(derived);
6551
6551
  return _possible_constructor_return$2(_this, _is_native_reflect_construct$2() ? Reflect.construct(derived, [], _get_prototype_of$2(_this).constructor) : derived.apply(_this, args));
6552
6552
  }
6553
- function _class_call_check$i(instance, Constructor) {
6553
+ function _class_call_check$l(instance, Constructor) {
6554
6554
  if (!(instance instanceof Constructor)) {
6555
6555
  throw new TypeError("Cannot call a class as a function");
6556
6556
  }
6557
6557
  }
6558
- function _defineProperties$b(target, props) {
6558
+ function _defineProperties$d(target, props) {
6559
6559
  for(var i = 0; i < props.length; i++){
6560
6560
  var descriptor = props[i];
6561
6561
  descriptor.enumerable = descriptor.enumerable || false;
@@ -6564,11 +6564,11 @@ function _defineProperties$b(target, props) {
6564
6564
  Object.defineProperty(target, descriptor.key, descriptor);
6565
6565
  }
6566
6566
  }
6567
- function _create_class$b(Constructor, protoProps, staticProps) {
6568
- if (protoProps) _defineProperties$b(Constructor.prototype, protoProps);
6567
+ function _create_class$d(Constructor, protoProps, staticProps) {
6568
+ if (protoProps) _defineProperties$d(Constructor.prototype, protoProps);
6569
6569
  return Constructor;
6570
6570
  }
6571
- function _define_property$p(obj, key, value) {
6571
+ function _define_property$s(obj, key, value) {
6572
6572
  if (key in obj) {
6573
6573
  Object.defineProperty(obj, key, {
6574
6574
  value: value,
@@ -6600,7 +6600,7 @@ function _inherits$2(subClass, superClass) {
6600
6600
  });
6601
6601
  if (superClass) _set_prototype_of$2(subClass, superClass);
6602
6602
  }
6603
- function _object_spread$g(target) {
6603
+ function _object_spread$h(target) {
6604
6604
  for(var i = 1; i < arguments.length; i++){
6605
6605
  var source = arguments[i] != null ? arguments[i] : {};
6606
6606
  var ownKeys = Object.keys(source);
@@ -6610,12 +6610,12 @@ function _object_spread$g(target) {
6610
6610
  }));
6611
6611
  }
6612
6612
  ownKeys.forEach(function(key) {
6613
- _define_property$p(target, key, source[key]);
6613
+ _define_property$s(target, key, source[key]);
6614
6614
  });
6615
6615
  }
6616
6616
  return target;
6617
6617
  }
6618
- function ownKeys$b(object, enumerableOnly) {
6618
+ function ownKeys$d(object, enumerableOnly) {
6619
6619
  var keys = Object.keys(object);
6620
6620
  if (Object.getOwnPropertySymbols) {
6621
6621
  var symbols = Object.getOwnPropertySymbols(object);
@@ -6623,12 +6623,12 @@ function ownKeys$b(object, enumerableOnly) {
6623
6623
  }
6624
6624
  return keys;
6625
6625
  }
6626
- function _object_spread_props$b(target, source) {
6626
+ function _object_spread_props$d(target, source) {
6627
6627
  source = source != null ? source : {};
6628
6628
  if (Object.getOwnPropertyDescriptors) {
6629
6629
  Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
6630
6630
  } else {
6631
- ownKeys$b(Object(source)).forEach(function(key) {
6631
+ ownKeys$d(Object(source)).forEach(function(key) {
6632
6632
  Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
6633
6633
  });
6634
6634
  }
@@ -6671,17 +6671,17 @@ function _is_native_reflect_construct$2() {
6671
6671
  */ exports.FirebaseServerAnalyticsSegmentListenerService = /*#__PURE__*/ function(FirebaseServerAnalyticsServiceListener) {
6672
6672
  _inherits$2(FirebaseServerAnalyticsSegmentListenerService, FirebaseServerAnalyticsServiceListener);
6673
6673
  function FirebaseServerAnalyticsSegmentListenerService(_segmentService) {
6674
- _class_call_check$i(this, FirebaseServerAnalyticsSegmentListenerService);
6674
+ _class_call_check$l(this, FirebaseServerAnalyticsSegmentListenerService);
6675
6675
  var _this;
6676
- _this = _call_super$2(this, FirebaseServerAnalyticsSegmentListenerService), _define_property$p(_this, "_segmentService", void 0);
6676
+ _this = _call_super$2(this, FirebaseServerAnalyticsSegmentListenerService), _define_property$s(_this, "_segmentService", void 0);
6677
6677
  _this._segmentService = _segmentService;
6678
6678
  return _this;
6679
6679
  }
6680
- _create_class$b(FirebaseServerAnalyticsSegmentListenerService, [
6680
+ _create_class$d(FirebaseServerAnalyticsSegmentListenerService, [
6681
6681
  {
6682
6682
  key: "handleOnCallAnalyticsEvent",
6683
6683
  value: function handleOnCallAnalyticsEvent(event) {
6684
- var properties = _object_spread$g(_object_spread_props$b(_object_spread$g({}, analytics.asAnalyticsEventData(event.properties)), {
6684
+ var properties = _object_spread$h(_object_spread_props$d(_object_spread$h({}, analytics.asAnalyticsEventData(event.properties)), {
6685
6685
  call: event.call,
6686
6686
  modelType: event.modelType,
6687
6687
  lifecycle: event.lifecycle
@@ -6738,7 +6738,7 @@ exports.FirebaseServerAnalyticsSegmentListenerService = __decorate([
6738
6738
  __param(0, common.Inject(nestjs$1.SegmentService))
6739
6739
  ], exports.FirebaseServerAnalyticsSegmentListenerService);
6740
6740
 
6741
- function _class_call_check$h(instance, Constructor) {
6741
+ function _class_call_check$k(instance, Constructor) {
6742
6742
  if (!(instance instanceof Constructor)) {
6743
6743
  throw new TypeError("Cannot call a class as a function");
6744
6744
  }
@@ -6748,7 +6748,7 @@ function _class_call_check$h(instance, Constructor) {
6748
6748
  *
6749
6749
  * This module provides the {@link FirebaseServerAnalyticsSegmentListenerService} as the {@link FirebaseServerAnalyticsServiceListener} implementation and exports {@link SegmentServiceModule} for use in the app.
6750
6750
  */ exports.FirebaseServerAnalyticsSegmentModule = function FirebaseServerAnalyticsSegmentModule() {
6751
- _class_call_check$h(this, FirebaseServerAnalyticsSegmentModule);
6751
+ _class_call_check$k(this, FirebaseServerAnalyticsSegmentModule);
6752
6752
  };
6753
6753
  exports.FirebaseServerAnalyticsSegmentModule = __decorate([
6754
6754
  common.Module({
@@ -6793,12 +6793,12 @@ exports.FirebaseServerAnalyticsSegmentModule = __decorate([
6793
6793
  };
6794
6794
  }
6795
6795
 
6796
- function _class_call_check$g(instance, Constructor) {
6796
+ function _class_call_check$j(instance, Constructor) {
6797
6797
  if (!(instance instanceof Constructor)) {
6798
6798
  throw new TypeError("Cannot call a class as a function");
6799
6799
  }
6800
6800
  }
6801
- function _define_property$o(obj, key, value) {
6801
+ function _define_property$r(obj, key, value) {
6802
6802
  if (key in obj) {
6803
6803
  Object.defineProperty(obj, key, {
6804
6804
  value: value,
@@ -6811,7 +6811,7 @@ function _define_property$o(obj, key, value) {
6811
6811
  }
6812
6812
  return obj;
6813
6813
  }
6814
- function _object_spread$f(target) {
6814
+ function _object_spread$g(target) {
6815
6815
  for(var i = 1; i < arguments.length; i++){
6816
6816
  var source = arguments[i] != null ? arguments[i] : {};
6817
6817
  var ownKeys = Object.keys(source);
@@ -6821,12 +6821,12 @@ function _object_spread$f(target) {
6821
6821
  }));
6822
6822
  }
6823
6823
  ownKeys.forEach(function(key) {
6824
- _define_property$o(target, key, source[key]);
6824
+ _define_property$r(target, key, source[key]);
6825
6825
  });
6826
6826
  }
6827
6827
  return target;
6828
6828
  }
6829
- function ownKeys$a(object, enumerableOnly) {
6829
+ function ownKeys$c(object, enumerableOnly) {
6830
6830
  var keys = Object.keys(object);
6831
6831
  if (Object.getOwnPropertySymbols) {
6832
6832
  var symbols = Object.getOwnPropertySymbols(object);
@@ -6834,12 +6834,12 @@ function ownKeys$a(object, enumerableOnly) {
6834
6834
  }
6835
6835
  return keys;
6836
6836
  }
6837
- function _object_spread_props$a(target, source) {
6837
+ function _object_spread_props$c(target, source) {
6838
6838
  source = source != null ? source : {};
6839
6839
  if (Object.getOwnPropertyDescriptors) {
6840
6840
  Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
6841
6841
  } else {
6842
- ownKeys$a(Object(source)).forEach(function(key) {
6842
+ ownKeys$c(Object(source)).forEach(function(key) {
6843
6843
  Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
6844
6844
  });
6845
6845
  }
@@ -6852,7 +6852,7 @@ function _object_spread_props$a(target, source) {
6852
6852
  /**
6853
6853
  * Nest provider module for Firebase that provides a firestore, etc. from the firestore token.
6854
6854
  */ exports.FirebaseServerAuthModule = function FirebaseServerAuthModule() {
6855
- _class_call_check$g(this, FirebaseServerAuthModule);
6855
+ _class_call_check$j(this, FirebaseServerAuthModule);
6856
6856
  };
6857
6857
  exports.FirebaseServerAuthModule = __decorate([
6858
6858
  common.Module({
@@ -6892,7 +6892,7 @@ exports.FirebaseServerAuthModule = __decorate([
6892
6892
  */ function provideFirebaseServerAuthService(provider) {
6893
6893
  var _provider_inject;
6894
6894
  return [
6895
- _object_spread_props$a(_object_spread$f({}, provider), {
6895
+ _object_spread_props$c(_object_spread$g({}, provider), {
6896
6896
  inject: (_provider_inject = provider.inject) !== null && _provider_inject !== void 0 ? _provider_inject : [
6897
6897
  FIREBASE_AUTH_TOKEN
6898
6898
  ]
@@ -7081,27 +7081,86 @@ exports.FirebaseServerAuthModule = __decorate([
7081
7081
  return claims[firebase.FIREBASE_SERVER_AUTH_CLAIMS_SETUP_PASSWORD_KEY] != null;
7082
7082
  }
7083
7083
 
7084
- // MARK: Scope Reading
7085
7084
  /**
7086
- * Reads the set of OIDC scopes carried by a model-api request's auth, or `undefined` for a non-OIDC
7085
+ * Error code thrown by {@link assertEndpointOidcScope} when an OIDC caller is missing the scope a
7086
+ * non-model endpoint requires.
7087
+ *
7088
+ * Distinct from the callModel-layer code so a client can tell "you cannot call this endpoint" apart
7089
+ * from "you cannot make this model call".
7090
+ */ var MISSING_ENDPOINT_OIDC_SCOPE_ERROR_CODE = 'MISSING_ENDPOINT_OIDC_SCOPE_ERROR';
7091
+ /**
7092
+ * Reads the set of OIDC scopes carried by an authenticated request, or `undefined` for a non-OIDC
7087
7093
  * (regular Firebase ID-token) caller.
7088
7094
  *
7089
7095
  * The OIDC bearer-token middleware attaches the validated access-token claims at
7090
7096
  * `auth.oidcValidatedToken` (with the space-delimited `scope` string); a non-OIDC caller has neither
7091
- * that field nor a `scope` on `auth.token`. Reading is defensive (the auth shape is only typed as
7092
- * {@link FirebaseServerAuthData} here — the OIDC-specific `oidcValidatedToken` lives in the
7093
- * `@dereekb/firebase-server/oidc` sub-package this core layer cannot import), delegating the actual
7094
- * parse to the shared {@link oidcScopesFromScopeClaim} so there is no drift with `getOidcScopesFromRequest`.
7097
+ * that field nor a `scope` on `auth.token`. Reading is defensive — the auth shape is only typed as
7098
+ * {@link FirebaseServerAuthData} here, since the OIDC-specific `oidcValidatedToken` lives in the
7099
+ * `@dereekb/firebase-server/oidc` sub-package this core layer cannot import — and the actual parse is
7100
+ * delegated to the shared {@link oidcScopesFromScopeClaim} so there is no drift with
7101
+ * `getOidcScopesFromRequest`.
7095
7102
  *
7096
7103
  * @param auth - The request auth data, or undefined for unauthenticated requests.
7097
7104
  * @returns The granted scope set, or `undefined` when the request carries no OIDC `scope` claim.
7098
- */ function oidcScopesFromModelApiAuth(auth) {
7105
+ */ function oidcScopesFromRequestAuth(auth) {
7099
7106
  var _auth_oidcValidatedToken, _auth_token;
7100
7107
  var oidcScope = auth === null || auth === void 0 ? void 0 : (_auth_oidcValidatedToken = auth.oidcValidatedToken) === null || _auth_oidcValidatedToken === void 0 ? void 0 : _auth_oidcValidatedToken.scope;
7101
7108
  var tokenScope = auth === null || auth === void 0 ? void 0 : (_auth_token = auth.token) === null || _auth_token === void 0 ? void 0 : _auth_token.scope;
7102
7109
  var scope = oidcScope !== null && oidcScope !== void 0 ? oidcScope : tokenScope;
7103
7110
  return firebase.oidcScopesFromScopeClaim(scope);
7104
7111
  }
7112
+ /**
7113
+ * Enforces a single OIDC scope requirement for a plain (non-callModel) endpoint, throwing a `403`
7114
+ * when an OIDC caller does not hold it.
7115
+ *
7116
+ * The non-model counterpart to `assertModelApiOidcScope`, which is unusable outside the model API
7117
+ * because it requires a `{ call, modelType }` pair. Evaluation reuses the same shipped
7118
+ * {@link oidcScopeTermSatisfied} primitive so a term means the same thing on both surfaces.
7119
+ *
7120
+ * Bypasses (no-op) when `grantedScopes` is `undefined` — i.e. a non-OIDC caller carrying a plain
7121
+ * Firebase ID token, which has no `scope` claim to enforce against. **This is why scope-gating alone
7122
+ * is never a sufficient gate**: an endpoint that must reject non-admins needs its own admin check,
7123
+ * with the scope acting as defence in depth.
7124
+ *
7125
+ * @param input - The required term, the caller's granted scopes, and the endpoint name for the message.
7126
+ * @throws A `403` forbidden error (code {@link MISSING_ENDPOINT_OIDC_SCOPE_ERROR_CODE}) when an OIDC
7127
+ * caller does not satisfy the requirement.
7128
+ */ function assertEndpointOidcScope(input) {
7129
+ var requiredScope = input.requiredScope, grantedScopes = input.grantedScopes, endpoint = input.endpoint;
7130
+ if (requiredScope != null && grantedScopes != null && !firebase.oidcScopeTermSatisfied(requiredScope, grantedScopes)) {
7131
+ var required = Array.isArray(requiredScope) ? requiredScope : [
7132
+ requiredScope
7133
+ ];
7134
+ throw forbiddenError({
7135
+ status: 403,
7136
+ code: MISSING_ENDPOINT_OIDC_SCOPE_ERROR_CODE,
7137
+ message: "Missing required OIDC scope for ".concat(endpoint, ": ").concat(required.join(' | ')),
7138
+ data: {
7139
+ requiredScopes: required,
7140
+ endpoint: endpoint
7141
+ }
7142
+ });
7143
+ }
7144
+ }
7145
+
7146
+ // MARK: Scope Reading
7147
+ /**
7148
+ * Reads the set of OIDC scopes carried by a model-api request's auth, or `undefined` for a non-OIDC
7149
+ * (regular Firebase ID-token) caller.
7150
+ *
7151
+ * The OIDC bearer-token middleware attaches the validated access-token claims at
7152
+ * `auth.oidcValidatedToken` (with the space-delimited `scope` string); a non-OIDC caller has neither
7153
+ * that field nor a `scope` on `auth.token`. Reading is defensive (the auth shape is only typed as
7154
+ * {@link FirebaseServerAuthData} here — the OIDC-specific `oidcValidatedToken` lives in the
7155
+ * `@dereekb/firebase-server/oidc` sub-package this core layer cannot import), delegating entirely to the
7156
+ * shared {@link oidcScopesFromRequestAuth} so there is no drift with `getOidcScopesFromRequest` or with
7157
+ * the non-model endpoints that read scopes the same way.
7158
+ *
7159
+ * @param auth - The request auth data, or undefined for unauthenticated requests.
7160
+ * @returns The granted scope set, or `undefined` when the request carries no OIDC `scope` claim.
7161
+ */ function oidcScopesFromModelApiAuth(auth) {
7162
+ return oidcScopesFromRequestAuth(auth);
7163
+ }
7105
7164
  /**
7106
7165
  * Enforces the OIDC scope requirement for a single model-api op, throwing a `403`
7107
7166
  * {@link CALL_MODEL_MISSING_OIDC_SCOPE_ERROR_CODE} error when the caller does not satisfy it.
@@ -7153,7 +7212,7 @@ exports.FirebaseServerAuthModule = __decorate([
7153
7212
  return typeof term === 'string' ? term : term.join('|');
7154
7213
  }
7155
7214
 
7156
- function _define_property$n(obj, key, value) {
7215
+ function _define_property$q(obj, key, value) {
7157
7216
  if (key in obj) {
7158
7217
  Object.defineProperty(obj, key, {
7159
7218
  value: value,
@@ -7166,7 +7225,7 @@ function _define_property$n(obj, key, value) {
7166
7225
  }
7167
7226
  return obj;
7168
7227
  }
7169
- function _object_spread$e(target) {
7228
+ function _object_spread$f(target) {
7170
7229
  for(var i = 1; i < arguments.length; i++){
7171
7230
  var source = arguments[i] != null ? arguments[i] : {};
7172
7231
  var ownKeys = Object.keys(source);
@@ -7176,12 +7235,12 @@ function _object_spread$e(target) {
7176
7235
  }));
7177
7236
  }
7178
7237
  ownKeys.forEach(function(key) {
7179
- _define_property$n(target, key, source[key]);
7238
+ _define_property$q(target, key, source[key]);
7180
7239
  });
7181
7240
  }
7182
7241
  return target;
7183
7242
  }
7184
- function ownKeys$9(object, enumerableOnly) {
7243
+ function ownKeys$b(object, enumerableOnly) {
7185
7244
  var keys = Object.keys(object);
7186
7245
  if (Object.getOwnPropertySymbols) {
7187
7246
  var symbols = Object.getOwnPropertySymbols(object);
@@ -7189,12 +7248,12 @@ function ownKeys$9(object, enumerableOnly) {
7189
7248
  }
7190
7249
  return keys;
7191
7250
  }
7192
- function _object_spread_props$9(target, source) {
7251
+ function _object_spread_props$b(target, source) {
7193
7252
  source = source != null ? source : {};
7194
7253
  if (Object.getOwnPropertyDescriptors) {
7195
7254
  Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
7196
7255
  } else {
7197
- ownKeys$9(Object(source)).forEach(function(key) {
7256
+ ownKeys$b(Object(source)).forEach(function(key) {
7198
7257
  Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
7199
7258
  });
7200
7259
  }
@@ -7211,7 +7270,7 @@ function _object_spread_props$9(target, source) {
7211
7270
  * @param request - The base request to augment (must include the nestApplication reference).
7212
7271
  * @returns A new object combining the request properties with the nest context.
7213
7272
  */ function injectNestIntoRequest(nest, request) {
7214
- return _object_spread_props$9(_object_spread$e({}, request), {
7273
+ return _object_spread_props$b(_object_spread$f({}, request), {
7215
7274
  nest: nest
7216
7275
  });
7217
7276
  }
@@ -7225,12 +7284,12 @@ function _object_spread_props$9(target, source) {
7225
7284
  * @param request - The base request to augment.
7226
7285
  * @returns A new object combining the request properties with the application context.
7227
7286
  */ function injectNestApplicationContextIntoRequest(nestContext, request) {
7228
- return _object_spread_props$9(_object_spread$e({}, request), {
7287
+ return _object_spread_props$b(_object_spread$f({}, request), {
7229
7288
  nestApplication: nestContext
7230
7289
  });
7231
7290
  }
7232
7291
 
7233
- function asyncGeneratorStep$a(gen, resolve, reject, _next, _throw, key, arg) {
7292
+ function asyncGeneratorStep$c(gen, resolve, reject, _next, _throw, key, arg) {
7234
7293
  try {
7235
7294
  var info = gen[key](arg);
7236
7295
  var value = info.value;
@@ -7244,27 +7303,27 @@ function asyncGeneratorStep$a(gen, resolve, reject, _next, _throw, key, arg) {
7244
7303
  Promise.resolve(value).then(_next, _throw);
7245
7304
  }
7246
7305
  }
7247
- function _async_to_generator$a(fn) {
7306
+ function _async_to_generator$c(fn) {
7248
7307
  return function() {
7249
7308
  var self = this, args = arguments;
7250
7309
  return new Promise(function(resolve, reject) {
7251
7310
  var gen = fn.apply(self, args);
7252
7311
  function _next(value) {
7253
- asyncGeneratorStep$a(gen, resolve, reject, _next, _throw, "next", value);
7312
+ asyncGeneratorStep$c(gen, resolve, reject, _next, _throw, "next", value);
7254
7313
  }
7255
7314
  function _throw(err) {
7256
- asyncGeneratorStep$a(gen, resolve, reject, _next, _throw, "throw", err);
7315
+ asyncGeneratorStep$c(gen, resolve, reject, _next, _throw, "throw", err);
7257
7316
  }
7258
7317
  _next(undefined);
7259
7318
  });
7260
7319
  };
7261
7320
  }
7262
- function _class_call_check$f(instance, Constructor) {
7321
+ function _class_call_check$i(instance, Constructor) {
7263
7322
  if (!(instance instanceof Constructor)) {
7264
7323
  throw new TypeError("Cannot call a class as a function");
7265
7324
  }
7266
7325
  }
7267
- function _defineProperties$a(target, props) {
7326
+ function _defineProperties$c(target, props) {
7268
7327
  for(var i = 0; i < props.length; i++){
7269
7328
  var descriptor = props[i];
7270
7329
  descriptor.enumerable = descriptor.enumerable || false;
@@ -7273,11 +7332,11 @@ function _defineProperties$a(target, props) {
7273
7332
  Object.defineProperty(target, descriptor.key, descriptor);
7274
7333
  }
7275
7334
  }
7276
- function _create_class$a(Constructor, protoProps, staticProps) {
7277
- if (protoProps) _defineProperties$a(Constructor.prototype, protoProps);
7335
+ function _create_class$c(Constructor, protoProps, staticProps) {
7336
+ if (protoProps) _defineProperties$c(Constructor.prototype, protoProps);
7278
7337
  return Constructor;
7279
7338
  }
7280
- function _define_property$m(obj, key, value) {
7339
+ function _define_property$p(obj, key, value) {
7281
7340
  if (key in obj) {
7282
7341
  Object.defineProperty(obj, key, {
7283
7342
  value: value,
@@ -7290,7 +7349,7 @@ function _define_property$m(obj, key, value) {
7290
7349
  }
7291
7350
  return obj;
7292
7351
  }
7293
- function _object_spread$d(target) {
7352
+ function _object_spread$e(target) {
7294
7353
  for(var i = 1; i < arguments.length; i++){
7295
7354
  var source = arguments[i] != null ? arguments[i] : {};
7296
7355
  var ownKeys = Object.keys(source);
@@ -7300,12 +7359,12 @@ function _object_spread$d(target) {
7300
7359
  }));
7301
7360
  }
7302
7361
  ownKeys.forEach(function(key) {
7303
- _define_property$m(target, key, source[key]);
7362
+ _define_property$p(target, key, source[key]);
7304
7363
  });
7305
7364
  }
7306
7365
  return target;
7307
7366
  }
7308
- function _ts_generator$a(thisArg, body) {
7367
+ function _ts_generator$c(thisArg, body) {
7309
7368
  var f, y, t, _ = {
7310
7369
  label: 0,
7311
7370
  sent: function() {
@@ -7422,22 +7481,22 @@ function _ts_generator$a(thisArg, body) {
7422
7481
  * }
7423
7482
  * ```
7424
7483
  */ var ModelApiDispatchConfig = function ModelApiDispatchConfig() {
7425
- _class_call_check$f(this, ModelApiDispatchConfig);
7484
+ _class_call_check$i(this, ModelApiDispatchConfig);
7426
7485
  /**
7427
7486
  * The onCallModel() return value with _apiDetails attached.
7428
- */ _define_property$m(this, "callModelFn", void 0);
7487
+ */ _define_property$p(this, "callModelFn", void 0);
7429
7488
  /**
7430
7489
  * Factory to create typed nest context from INestApplicationContext.
7431
- */ _define_property$m(this, "makeNestContext", void 0);
7490
+ */ _define_property$p(this, "makeNestContext", void 0);
7432
7491
  /**
7433
7492
  * Optional model-api-layer OIDC group-scope default. See {@link ModelApiOidcScopeConfig.defaultRequiredScope}.
7434
7493
  * This is the home for the callModel group-scope default; providing it here enforces it across
7435
7494
  * dispatch AND the `/get` reads.
7436
- */ _define_property$m(this, "defaultRequiredScope", void 0);
7495
+ */ _define_property$p(this, "defaultRequiredScope", void 0);
7437
7496
  /**
7438
7497
  * Optional per-model OIDC group-scope overrides. See {@link ModelApiOidcScopeConfig.modelRequiredScopes}.
7439
7498
  * The only place a plain `/get` read (no per-function handler) can be scope-gated beyond `model.read`.
7440
- */ _define_property$m(this, "modelRequiredScopes", void 0);
7499
+ */ _define_property$p(this, "modelRequiredScopes", void 0);
7441
7500
  };
7442
7501
  /**
7443
7502
  * Injection token for providing the NestJS application context to the dispatch service.
@@ -7454,13 +7513,13 @@ function _ts_generator$a(thisArg, body) {
7454
7513
  * the callModel function.
7455
7514
  */ exports.ModelApiCallModelDispatchService = /*#__PURE__*/ function() {
7456
7515
  function ModelApiCallModelDispatchService(config, nestApplication) {
7457
- _class_call_check$f(this, ModelApiCallModelDispatchService);
7458
- _define_property$m(this, "config", void 0);
7459
- _define_property$m(this, "nestApplication", void 0);
7516
+ _class_call_check$i(this, ModelApiCallModelDispatchService);
7517
+ _define_property$p(this, "config", void 0);
7518
+ _define_property$p(this, "nestApplication", void 0);
7460
7519
  this.config = config;
7461
7520
  this.nestApplication = nestApplication;
7462
7521
  }
7463
- _create_class$a(ModelApiCallModelDispatchService, [
7522
+ _create_class$c(ModelApiCallModelDispatchService, [
7464
7523
  {
7465
7524
  key: "dispatch",
7466
7525
  value: /**
@@ -7471,9 +7530,9 @@ function _ts_generator$a(thisArg, body) {
7471
7530
  * @param rawRequest - The raw Express request.
7472
7531
  * @returns The handler's return value.
7473
7532
  */ function dispatch(params, auth, rawRequest) {
7474
- return _async_to_generator$a(function() {
7533
+ return _async_to_generator$c(function() {
7475
7534
  var call, modelType, specifier, apiDetails, requiredScope, callableRequest, appRequest, contextRequest;
7476
- return _ts_generator$a(this, function(_state) {
7535
+ return _ts_generator$c(this, function(_state) {
7477
7536
  // Enforce OIDC scope BEFORE dispatching — the relocated home of the callModel scope check.
7478
7537
  // AND-of-ORs across the per-verb `model.<call>` scope and the effective group term (per-function
7479
7538
  // `requiredScope` > per-model requirement > module default), bypassing non-OIDC callers. A nullish
@@ -7499,7 +7558,7 @@ function _ts_generator$a(thisArg, body) {
7499
7558
  data: params,
7500
7559
  auth: auth ? {
7501
7560
  uid: auth.uid,
7502
- token: _object_spread$d({}, auth.token, auth.oidcValidatedToken)
7561
+ token: _object_spread$e({}, auth.token, auth.oidcValidatedToken)
7503
7562
  } : undefined,
7504
7563
  rawRequest: rawRequest,
7505
7564
  acceptsStreaming: false
@@ -7535,7 +7594,15 @@ exports.ModelApiCallModelDispatchService = __decorate([
7535
7594
  __param(1, common.Inject(MODEL_API_NEST_APPLICATION_CONTEXT))
7536
7595
  ], exports.ModelApiCallModelDispatchService);
7537
7596
 
7538
- function asyncGeneratorStep$9(gen, resolve, reject, _next, _throw, key, arg) {
7597
+ function _array_like_to_array$a(arr, len) {
7598
+ if (len == null || len > arr.length) len = arr.length;
7599
+ for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
7600
+ return arr2;
7601
+ }
7602
+ function _array_with_holes$2(arr) {
7603
+ if (Array.isArray(arr)) return arr;
7604
+ }
7605
+ function asyncGeneratorStep$b(gen, resolve, reject, _next, _throw, key, arg) {
7539
7606
  try {
7540
7607
  var info = gen[key](arg);
7541
7608
  var value = info.value;
@@ -7549,27 +7616,27 @@ function asyncGeneratorStep$9(gen, resolve, reject, _next, _throw, key, arg) {
7549
7616
  Promise.resolve(value).then(_next, _throw);
7550
7617
  }
7551
7618
  }
7552
- function _async_to_generator$9(fn) {
7619
+ function _async_to_generator$b(fn) {
7553
7620
  return function() {
7554
7621
  var self = this, args = arguments;
7555
7622
  return new Promise(function(resolve, reject) {
7556
7623
  var gen = fn.apply(self, args);
7557
7624
  function _next(value) {
7558
- asyncGeneratorStep$9(gen, resolve, reject, _next, _throw, "next", value);
7625
+ asyncGeneratorStep$b(gen, resolve, reject, _next, _throw, "next", value);
7559
7626
  }
7560
7627
  function _throw(err) {
7561
- asyncGeneratorStep$9(gen, resolve, reject, _next, _throw, "throw", err);
7628
+ asyncGeneratorStep$b(gen, resolve, reject, _next, _throw, "throw", err);
7562
7629
  }
7563
7630
  _next(undefined);
7564
7631
  });
7565
7632
  };
7566
7633
  }
7567
- function _class_call_check$e(instance, Constructor) {
7634
+ function _class_call_check$h(instance, Constructor) {
7568
7635
  if (!(instance instanceof Constructor)) {
7569
7636
  throw new TypeError("Cannot call a class as a function");
7570
7637
  }
7571
7638
  }
7572
- function _defineProperties$9(target, props) {
7639
+ function _defineProperties$b(target, props) {
7573
7640
  for(var i = 0; i < props.length; i++){
7574
7641
  var descriptor = props[i];
7575
7642
  descriptor.enumerable = descriptor.enumerable || false;
@@ -7578,11 +7645,11 @@ function _defineProperties$9(target, props) {
7578
7645
  Object.defineProperty(target, descriptor.key, descriptor);
7579
7646
  }
7580
7647
  }
7581
- function _create_class$9(Constructor, protoProps, staticProps) {
7582
- if (protoProps) _defineProperties$9(Constructor.prototype, protoProps);
7648
+ function _create_class$b(Constructor, protoProps, staticProps) {
7649
+ if (protoProps) _defineProperties$b(Constructor.prototype, protoProps);
7583
7650
  return Constructor;
7584
7651
  }
7585
- function _define_property$l(obj, key, value) {
7652
+ function _define_property$o(obj, key, value) {
7586
7653
  if (key in obj) {
7587
7654
  Object.defineProperty(obj, key, {
7588
7655
  value: value,
@@ -7595,7 +7662,7 @@ function _define_property$l(obj, key, value) {
7595
7662
  }
7596
7663
  return obj;
7597
7664
  }
7598
- function _instanceof$2(left, right) {
7665
+ function _instanceof$3(left, right) {
7599
7666
  "@swc/helpers - instanceof";
7600
7667
  if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
7601
7668
  return !!right[Symbol.hasInstance](left);
@@ -7603,7 +7670,34 @@ function _instanceof$2(left, right) {
7603
7670
  return left instanceof right;
7604
7671
  }
7605
7672
  }
7606
- function _object_spread$c(target) {
7673
+ function _iterable_to_array_limit$2(arr, i) {
7674
+ var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
7675
+ if (_i == null) return;
7676
+ var _arr = [];
7677
+ var _n = true;
7678
+ var _d = false;
7679
+ var _s, _e;
7680
+ try {
7681
+ for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
7682
+ _arr.push(_s.value);
7683
+ if (i && _arr.length === i) break;
7684
+ }
7685
+ } catch (err) {
7686
+ _d = true;
7687
+ _e = err;
7688
+ } finally{
7689
+ try {
7690
+ if (!_n && _i["return"] != null) _i["return"]();
7691
+ } finally{
7692
+ if (_d) throw _e;
7693
+ }
7694
+ }
7695
+ return _arr;
7696
+ }
7697
+ function _non_iterable_rest$2() {
7698
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
7699
+ }
7700
+ function _object_spread$d(target) {
7607
7701
  for(var i = 1; i < arguments.length; i++){
7608
7702
  var source = arguments[i] != null ? arguments[i] : {};
7609
7703
  var ownKeys = Object.keys(source);
@@ -7613,12 +7707,42 @@ function _object_spread$c(target) {
7613
7707
  }));
7614
7708
  }
7615
7709
  ownKeys.forEach(function(key) {
7616
- _define_property$l(target, key, source[key]);
7710
+ _define_property$o(target, key, source[key]);
7617
7711
  });
7618
7712
  }
7619
7713
  return target;
7620
7714
  }
7621
- function _ts_generator$9(thisArg, body) {
7715
+ function ownKeys$a(object, enumerableOnly) {
7716
+ var keys = Object.keys(object);
7717
+ if (Object.getOwnPropertySymbols) {
7718
+ var symbols = Object.getOwnPropertySymbols(object);
7719
+ keys.push.apply(keys, symbols);
7720
+ }
7721
+ return keys;
7722
+ }
7723
+ function _object_spread_props$a(target, source) {
7724
+ source = source != null ? source : {};
7725
+ if (Object.getOwnPropertyDescriptors) {
7726
+ Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
7727
+ } else {
7728
+ ownKeys$a(Object(source)).forEach(function(key) {
7729
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
7730
+ });
7731
+ }
7732
+ return target;
7733
+ }
7734
+ function _sliced_to_array$2(arr, i) {
7735
+ return _array_with_holes$2(arr) || _iterable_to_array_limit$2(arr, i) || _unsupported_iterable_to_array$a(arr, i) || _non_iterable_rest$2();
7736
+ }
7737
+ function _unsupported_iterable_to_array$a(o, minLen) {
7738
+ if (!o) return;
7739
+ if (typeof o === "string") return _array_like_to_array$a(o, minLen);
7740
+ var n = Object.prototype.toString.call(o).slice(8, -1);
7741
+ if (n === "Object" && o.constructor) n = o.constructor.name;
7742
+ if (n === "Map" || n === "Set") return Array.from(n);
7743
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$a(o, minLen);
7744
+ }
7745
+ function _ts_generator$b(thisArg, body) {
7622
7746
  var f, y, t, _ = {
7623
7747
  label: 0,
7624
7748
  sent: function() {
@@ -7721,6 +7845,49 @@ function _ts_generator$9(thisArg, body) {
7721
7845
  /**
7722
7846
  * Maximum number of keys allowed in a multi-read request.
7723
7847
  */ var MAX_MODEL_ACCESS_MULTI_READ_KEYS = 50;
7848
+ /**
7849
+ * Error code returned when a read targets a model the app declared SERVER-ONLY.
7850
+ *
7851
+ * Deliberately distinct from a permission error: nothing the caller can be granted will make this
7852
+ * read succeed, so the message needs to say WHY rather than implying a missing role.
7853
+ */ var MODEL_IS_SERVER_ONLY_ERROR_CODE = 'MODEL_IS_SERVER_ONLY';
7854
+ /**
7855
+ * Role-map keys that are structural markers rather than granted role names, so they are never
7856
+ * reported as roles.
7857
+ *
7858
+ * {@link FULL_ACCESS_ROLE_KEY} is surfaced through `fullAccess` instead. {@link NO_ACCESS_ROLE_KEY}
7859
+ * is what `noAccessRoleMap()` sets and means "no roles at all" — both a missing document and an
7860
+ * explicit no-access grant carry it, so leaking it would report `__EMPTY__` as a granted role and
7861
+ * make the no-access case indistinguishable from a real one-role grant.
7862
+ */ var MODEL_ACCESS_ROLE_MAP_MARKER_KEYS = new Set([
7863
+ model.FULL_ACCESS_ROLE_KEY,
7864
+ model.NO_ACCESS_ROLE_KEY
7865
+ ]);
7866
+ /**
7867
+ * Maps a resolved `ContextGrantedModelRoles` into the flat {@link ModelAccessRoleMapResult} wire
7868
+ * shape — collapsing the full-access marker into a boolean, dropping the structural marker keys, and
7869
+ * sorting the enumerated role keys so output is stable across calls.
7870
+ *
7871
+ * @param input - The key and its resolved granted-roles result.
7872
+ * @returns The flattened per-key permission state.
7873
+ */ function modelAccessRoleMapResultFromGrantedRoles(input) {
7874
+ var _granted_data;
7875
+ var key = input.key, granted = input.granted;
7876
+ var fullAccess = model.isFullAccessRoleMap(granted.roleMap);
7877
+ var roles = fullAccess ? [] : Object.entries(granted.roleMap).filter(function(param) {
7878
+ var _param = _sliced_to_array$2(param, 2), roleKey = _param[0], value = _param[1];
7879
+ return value === true && !MODEL_ACCESS_ROLE_MAP_MARKER_KEYS.has(roleKey);
7880
+ }).map(function(param) {
7881
+ var _param = _sliced_to_array$2(param, 1), roleKey = _param[0];
7882
+ return roleKey;
7883
+ }).sort();
7884
+ return {
7885
+ key: key,
7886
+ exists: ((_granted_data = granted.data) === null || _granted_data === void 0 ? void 0 : _granted_data.exists) === true,
7887
+ fullAccess: fullAccess,
7888
+ roles: roles
7889
+ };
7890
+ }
7724
7891
  /**
7725
7892
  * Maps a single `useMultipleModels` failure entry into the public {@link ModelAccessReadError}
7726
7893
  * shape. Unwraps the typical Firebase error shapes via {@link firebaseServerErrorInfo} so
@@ -7740,7 +7907,7 @@ function _ts_generator$9(thisArg, body) {
7740
7907
  var info = firebaseServerErrorInfo(entry.error);
7741
7908
  var serverMessage = (_info_httpsErrorDetailsServerError = info.httpsErrorDetailsServerError) === null || _info_httpsErrorDetailsServerError === void 0 ? void 0 : _info_httpsErrorDetailsServerError.message;
7742
7909
  var httpsMessage = (_info_httpsError = info.httpsError) === null || _info_httpsError === void 0 ? void 0 : _info_httpsError.message;
7743
- var plainMessage = _instanceof$2(entry.error, Error) ? entry.error.message : undefined;
7910
+ var plainMessage = _instanceof$3(entry.error, Error) ? entry.error.message : undefined;
7744
7911
  var code = (_info_serverErrorCode = info.serverErrorCode) !== null && _info_serverErrorCode !== void 0 ? _info_serverErrorCode : info.firebaseErrorCode;
7745
7912
  return {
7746
7913
  key: entry.key,
@@ -7780,16 +7947,16 @@ function _ts_generator$9(thisArg, body) {
7780
7947
  * enforcing `'read'` role permissions per document.
7781
7948
  */ exports.ModelApiGetService = /*#__PURE__*/ function() {
7782
7949
  function ModelApiGetService(config, nestApplication) {
7783
- _class_call_check$e(this, ModelApiGetService);
7784
- _define_property$l(this, "_nestContext", void 0);
7785
- _define_property$l(this, "_defaultRequiredScope", void 0);
7786
- _define_property$l(this, "_modelRequiredScopes", void 0);
7787
- _define_property$l(this, "_identityByModelType", void 0);
7950
+ _class_call_check$h(this, ModelApiGetService);
7951
+ _define_property$o(this, "_nestContext", void 0);
7952
+ _define_property$o(this, "_defaultRequiredScope", void 0);
7953
+ _define_property$o(this, "_modelRequiredScopes", void 0);
7954
+ _define_property$o(this, "_identityByModelType", void 0);
7788
7955
  this._nestContext = config.makeNestContext(nestApplication);
7789
7956
  this._defaultRequiredScope = config.defaultRequiredScope;
7790
7957
  this._modelRequiredScopes = config.modelRequiredScopes;
7791
7958
  }
7792
- _create_class$9(ModelApiGetService, [
7959
+ _create_class$b(ModelApiGetService, [
7793
7960
  {
7794
7961
  /**
7795
7962
  * Enforces the OIDC read-scope requirement for a direct document read before it hits Firestore.
@@ -7814,6 +7981,57 @@ function _ts_generator$9(thisArg, body) {
7814
7981
  },
7815
7982
  {
7816
7983
  /**
7984
+ * Refuses a read of a model the app declared SERVER-ONLY, BEFORE `useModel` runs.
7985
+ *
7986
+ * The model API authorizes through `roleMapForModel` under the Admin SDK, which bypasses
7987
+ * `firestore.rules` entirely. For a model the rules file deliberately leaves unmatched (or denies
7988
+ * outright), those two systems disagree and the model API is the one handing out the document.
7989
+ * Gating here — ahead of the role map, and on the ONE service both `/model/<type>/get` and the
7990
+ * `model-get` MCP tool share — is what makes the two read paths agree.
7991
+ *
7992
+ * @param modelType - The Firestore model type being read.
7993
+ * @param auth - The request's auth data; used to build the context the service lookup needs.
7994
+ * @throws {HttpsError} `MODEL_IS_SERVER_ONLY` when the model opted in via `serverOnly`.
7995
+ */ key: "_assertNotServerOnly",
7996
+ value: function _assertNotServerOnly(modelType, auth) {
7997
+ if (this._isServerOnlyModel(modelType, auth)) {
7998
+ throw forbiddenError({
7999
+ status: 403,
8000
+ code: MODEL_IS_SERVER_ONLY_ERROR_CODE,
8001
+ message: 'Model "'.concat(modelType, '" is server-only and cannot be read through the model API. It has no client read grant in firestore.rules either — reach it through a callable that owns its access policy.'),
8002
+ data: {
8003
+ modelType: modelType
8004
+ }
8005
+ });
8006
+ }
8007
+ }
8008
+ },
8009
+ {
8010
+ /**
8011
+ * Reads the `serverOnly` flag off the registered model service, tolerating a type whose service
8012
+ * cannot be constructed (which `readDocument` then reports as an unknown model).
8013
+ *
8014
+ * @param modelType - The Firestore model type to inspect.
8015
+ * @param auth - The request's auth data.
8016
+ * @returns `true` when the model declared itself server-only.
8017
+ */ key: "_isServerOnlyModel",
8018
+ value: function _isServerOnlyModel(modelType, auth) {
8019
+ var authRef = this._makeAuthRef(auth);
8020
+ var result = false;
8021
+ try {
8022
+ var inContextService = this._nestContext.model(authRef);
8023
+ var modelService = inContextService(modelType);
8024
+ result = (modelService === null || modelService === void 0 ? void 0 : modelService.serverOnly) === true;
8025
+ } catch (unused) {
8026
+ // an unregistered / unconstructable type is not our error to raise here — the subsequent
8027
+ // useModel call reports it as an unknown model
8028
+ result = false;
8029
+ }
8030
+ return result;
8031
+ }
8032
+ },
8033
+ {
8034
+ /**
7817
8035
  * Returns the registered {@link FirestoreModelIdentity} for the given `modelType` string, or
7818
8036
  * `undefined` when no model of that type is registered.
7819
8037
  *
@@ -7880,12 +8098,13 @@ function _ts_generator$9(thisArg, body) {
7880
8098
  * @returns The document key and data.
7881
8099
  * @throws {Error} Permission or not-found errors from useModel.
7882
8100
  */ function readDocument(modelType, key, auth) {
7883
- return _async_to_generator$9(function() {
8101
+ return _async_to_generator$b(function() {
7884
8102
  var authRef, doc, snapshot;
7885
- return _ts_generator$9(this, function(_state) {
8103
+ return _ts_generator$b(this, function(_state) {
7886
8104
  switch(_state.label){
7887
8105
  case 0:
7888
8106
  this._assertReadScope(modelType, auth);
8107
+ this._assertNotServerOnly(modelType, auth);
7889
8108
  authRef = this._makeAuthRef(auth);
7890
8109
  return [
7891
8110
  4,
@@ -7931,10 +8150,11 @@ function _ts_generator$9(thisArg, body) {
7931
8150
  * @param auth - The authenticated user's auth data from the request.
7932
8151
  * @returns Results and errors for each requested key.
7933
8152
  */ function readDocuments(modelType, keys, auth) {
7934
- return _async_to_generator$9(function() {
8153
+ return _async_to_generator$b(function() {
7935
8154
  var authRef;
7936
- return _ts_generator$9(this, function(_state) {
8155
+ return _ts_generator$b(this, function(_state) {
7937
8156
  this._assertReadScope(modelType, auth);
8157
+ this._assertNotServerOnly(modelType, auth);
7938
8158
  authRef = this._makeAuthRef(auth);
7939
8159
  return [
7940
8160
  2,
@@ -7944,17 +8164,17 @@ function _ts_generator$9(thisArg, body) {
7944
8164
  roles: 'read',
7945
8165
  throwOnFirstError: false,
7946
8166
  use: function use(successful, failure) {
7947
- return _async_to_generator$9(function() {
8167
+ return _async_to_generator$b(function() {
7948
8168
  var results, errors;
7949
- return _ts_generator$9(this, function(_state) {
8169
+ return _ts_generator$b(this, function(_state) {
7950
8170
  switch(_state.label){
7951
8171
  case 0:
7952
8172
  return [
7953
8173
  4,
7954
8174
  Promise.all(successful.map(function(reader) {
7955
- return _async_to_generator$9(function() {
8175
+ return _async_to_generator$b(function() {
7956
8176
  var snapshot;
7957
- return _ts_generator$9(this, function(_state) {
8177
+ return _ts_generator$b(this, function(_state) {
7958
8178
  switch(_state.label){
7959
8179
  case 0:
7960
8180
  return [
@@ -7996,27 +8216,207 @@ function _ts_generator$9(thisArg, body) {
7996
8216
  }
7997
8217
  },
7998
8218
  {
7999
- /**
8000
- * Builds an {@link AuthDataRef} compatible with `useModel()` from the HTTP request auth.
8219
+ key: "readRoleMaps",
8220
+ value: /**
8221
+ * Resolves the granted role map for one or more keys of the same model type — i.e. "what is this
8222
+ * user actually allowed to do with this document?".
8001
8223
  *
8002
- * Uses the same synthetic auth pattern as {@link ModelApiDispatchService.dispatch}.
8003
- * The OIDC-validated claim subset is layered over the base token so the synthetic
8004
- * `auth.token` keeps standard JWT claims (`iat`, `auth_time`, `email`, …) that
8005
- * downstream consumers like `authContextInfo` rely on.
8224
+ * This is the same computation the permission-checked read path runs (`roleMapForModel()` on the
8225
+ * model's registered service factory), but the resolved roles are returned instead of being
8226
+ * consumed to allow/deny an operation. Because it runs the model's real delegate, derived and
8227
+ * cascading roles are included exactly as the API would grant them.
8006
8228
  *
8007
- * @param auth - The Firebase server auth data from the HTTP request, or undefined for unauthenticated requests.
8008
- * @returns An object containing a synthetic {@link AuthData} for use with `useModel()`, or undefined auth.
8009
- */ key: "_makeAuthRef",
8010
- value: function _makeAuthRef(auth) {
8011
- var synthetic;
8012
- if (auth) {
8013
- var _auth_token, _auth_oidcValidatedToken;
8014
- var baseToken = (_auth_token = auth.token) !== null && _auth_token !== void 0 ? _auth_token : {};
8015
- var oidcToken = (_auth_oidcValidatedToken = auth.oidcValidatedToken) !== null && _auth_oidcValidatedToken !== void 0 ? _auth_oidcValidatedToken : {};
8016
- synthetic = {
8017
- uid: auth.uid,
8018
- token: _object_spread$c({}, baseToken, oidcToken)
8019
- };
8229
+ * Per-key failures are captured in `errors` rather than thrown, matching {@link readDocuments}.
8230
+ * A key that resolves to a missing document is NOT an error — it comes back with
8231
+ * `exists: false, roles: []`, which is what distinguishes "not there" from "no access".
8232
+ *
8233
+ * @param params - Model type, keys, calling auth, and an optional target uid.
8234
+ * @returns The per-key permission state plus the uid the roles were resolved for.
8235
+ */ function readRoleMaps(params) {
8236
+ return _async_to_generator$b(function() {
8237
+ var _authRef_auth, modelType, keys, auth, targetUid, targeted, authRef, _tmp, context, service, settled, results, errors, uid;
8238
+ return _ts_generator$b(this, function(_state) {
8239
+ switch(_state.label){
8240
+ case 0:
8241
+ modelType = params.modelType, keys = params.keys, auth = params.auth, targetUid = params.targetUid;
8242
+ this._assertReadScope(modelType, auth);
8243
+ targeted = targetUid != null && targetUid !== (auth === null || auth === void 0 ? void 0 : auth.uid);
8244
+ if (!targeted) return [
8245
+ 3,
8246
+ 2
8247
+ ];
8248
+ return [
8249
+ 4,
8250
+ this._makeAuthRefForUid(targetUid)
8251
+ ];
8252
+ case 1:
8253
+ _tmp = _state.sent();
8254
+ return [
8255
+ 3,
8256
+ 3
8257
+ ];
8258
+ case 2:
8259
+ _tmp = this._makeAuthRef(auth);
8260
+ _state.label = 3;
8261
+ case 3:
8262
+ authRef = _tmp;
8263
+ context = this._nestContext.makeModelContext(authRef);
8264
+ service = this._nestContext.firebaseModelsService(modelType, context);
8265
+ return [
8266
+ 4,
8267
+ Promise.all(keys.map(function(key) {
8268
+ return _async_to_generator$b(function() {
8269
+ var entry, granted, error;
8270
+ return _ts_generator$b(this, function(_state) {
8271
+ switch(_state.label){
8272
+ case 0:
8273
+ _state.trys.push([
8274
+ 0,
8275
+ 2,
8276
+ ,
8277
+ 3
8278
+ ]);
8279
+ return [
8280
+ 4,
8281
+ service.roleMapForKey(key)
8282
+ ];
8283
+ case 1:
8284
+ granted = _state.sent();
8285
+ entry = {
8286
+ result: modelAccessRoleMapResultFromGrantedRoles({
8287
+ key: key,
8288
+ granted: granted
8289
+ })
8290
+ };
8291
+ return [
8292
+ 3,
8293
+ 3
8294
+ ];
8295
+ case 2:
8296
+ error = _state.sent();
8297
+ entry = {
8298
+ error: modelAccessReadErrorFromUseMultipleModelsFailure({
8299
+ key: key,
8300
+ error: error
8301
+ })
8302
+ };
8303
+ return [
8304
+ 3,
8305
+ 3
8306
+ ];
8307
+ case 3:
8308
+ return [
8309
+ 2,
8310
+ entry
8311
+ ];
8312
+ }
8313
+ });
8314
+ })();
8315
+ }))
8316
+ ];
8317
+ case 4:
8318
+ settled = _state.sent();
8319
+ results = [];
8320
+ errors = [];
8321
+ settled.forEach(function(entry) {
8322
+ if (entry.result != null) {
8323
+ results.push(entry.result);
8324
+ } else if (entry.error != null) {
8325
+ errors.push(entry.error);
8326
+ }
8327
+ });
8328
+ uid = (_authRef_auth = authRef.auth) === null || _authRef_auth === void 0 ? void 0 : _authRef_auth.uid;
8329
+ return [
8330
+ 2,
8331
+ _object_spread_props$a(_object_spread$d({}, uid == null ? {} : {
8332
+ uid: uid
8333
+ }), {
8334
+ targeted: targeted,
8335
+ results: results,
8336
+ errors: errors
8337
+ })
8338
+ ];
8339
+ }
8340
+ });
8341
+ }).call(this);
8342
+ }
8343
+ },
8344
+ {
8345
+ key: "_makeAuthRefForUid",
8346
+ value: /**
8347
+ * Builds a synthetic {@link AuthData} for an arbitrary uid so role resolution can run *as* that
8348
+ * user rather than as the caller.
8349
+ *
8350
+ * The target's custom claims are read from their Firebase Auth record and spread into the
8351
+ * synthetic token, mirroring how Firebase merges custom claims into a real decoded ID token —
8352
+ * so claim-reading permission delegates behave identically to a live request from that user.
8353
+ *
8354
+ * @param uid - The uid to resolve as.
8355
+ * @returns An auth ref carrying the target user's claims.
8356
+ * @throws {Error} If no Firebase Auth user exists for the uid.
8357
+ */ function _makeAuthRefForUid(uid) {
8358
+ return _async_to_generator$b(function() {
8359
+ var userContext, exists, record;
8360
+ return _ts_generator$b(this, function(_state) {
8361
+ switch(_state.label){
8362
+ case 0:
8363
+ userContext = this._nestContext.authService.userContext(uid);
8364
+ return [
8365
+ 4,
8366
+ userContext.exists()
8367
+ ];
8368
+ case 1:
8369
+ exists = _state.sent();
8370
+ if (!exists) {
8371
+ throw new Error('No user exists with uid "'.concat(uid, '".'));
8372
+ }
8373
+ return [
8374
+ 4,
8375
+ userContext.loadRecord()
8376
+ ];
8377
+ case 2:
8378
+ record = _state.sent();
8379
+ return [
8380
+ 2,
8381
+ {
8382
+ auth: {
8383
+ uid: uid,
8384
+ token: _object_spread_props$a(_object_spread$d({}, record.customClaims), {
8385
+ uid: uid,
8386
+ sub: uid,
8387
+ email: record.email,
8388
+ email_verified: record.emailVerified
8389
+ })
8390
+ }
8391
+ }
8392
+ ];
8393
+ }
8394
+ });
8395
+ }).call(this);
8396
+ }
8397
+ },
8398
+ {
8399
+ /**
8400
+ * Builds an {@link AuthDataRef} compatible with `useModel()` from the HTTP request auth.
8401
+ *
8402
+ * Uses the same synthetic auth pattern as {@link ModelApiDispatchService.dispatch}.
8403
+ * The OIDC-validated claim subset is layered over the base token so the synthetic
8404
+ * `auth.token` keeps standard JWT claims (`iat`, `auth_time`, `email`, …) that
8405
+ * downstream consumers like `authContextInfo` rely on.
8406
+ *
8407
+ * @param auth - The Firebase server auth data from the HTTP request, or undefined for unauthenticated requests.
8408
+ * @returns An object containing a synthetic {@link AuthData} for use with `useModel()`, or undefined auth.
8409
+ */ key: "_makeAuthRef",
8410
+ value: function _makeAuthRef(auth) {
8411
+ var synthetic;
8412
+ if (auth) {
8413
+ var _auth_token, _auth_oidcValidatedToken;
8414
+ var baseToken = (_auth_token = auth.token) !== null && _auth_token !== void 0 ? _auth_token : {};
8415
+ var oidcToken = (_auth_oidcValidatedToken = auth.oidcValidatedToken) !== null && _auth_oidcValidatedToken !== void 0 ? _auth_oidcValidatedToken : {};
8416
+ synthetic = {
8417
+ uid: auth.uid,
8418
+ token: _object_spread$d({}, baseToken, oidcToken)
8419
+ };
8020
8420
  }
8021
8421
  return {
8022
8422
  auth: synthetic
@@ -8032,7 +8432,7 @@ exports.ModelApiGetService = __decorate([
8032
8432
  __param(1, common.Inject(MODEL_API_NEST_APPLICATION_CONTEXT))
8033
8433
  ], exports.ModelApiGetService);
8034
8434
 
8035
- function asyncGeneratorStep$8(gen, resolve, reject, _next, _throw, key, arg) {
8435
+ function asyncGeneratorStep$a(gen, resolve, reject, _next, _throw, key, arg) {
8036
8436
  try {
8037
8437
  var info = gen[key](arg);
8038
8438
  var value = info.value;
@@ -8046,27 +8446,27 @@ function asyncGeneratorStep$8(gen, resolve, reject, _next, _throw, key, arg) {
8046
8446
  Promise.resolve(value).then(_next, _throw);
8047
8447
  }
8048
8448
  }
8049
- function _async_to_generator$8(fn) {
8449
+ function _async_to_generator$a(fn) {
8050
8450
  return function() {
8051
8451
  var self = this, args = arguments;
8052
8452
  return new Promise(function(resolve, reject) {
8053
8453
  var gen = fn.apply(self, args);
8054
8454
  function _next(value) {
8055
- asyncGeneratorStep$8(gen, resolve, reject, _next, _throw, "next", value);
8455
+ asyncGeneratorStep$a(gen, resolve, reject, _next, _throw, "next", value);
8056
8456
  }
8057
8457
  function _throw(err) {
8058
- asyncGeneratorStep$8(gen, resolve, reject, _next, _throw, "throw", err);
8458
+ asyncGeneratorStep$a(gen, resolve, reject, _next, _throw, "throw", err);
8059
8459
  }
8060
8460
  _next(undefined);
8061
8461
  });
8062
8462
  };
8063
8463
  }
8064
- function _class_call_check$d(instance, Constructor) {
8464
+ function _class_call_check$g(instance, Constructor) {
8065
8465
  if (!(instance instanceof Constructor)) {
8066
8466
  throw new TypeError("Cannot call a class as a function");
8067
8467
  }
8068
8468
  }
8069
- function _defineProperties$8(target, props) {
8469
+ function _defineProperties$a(target, props) {
8070
8470
  for(var i = 0; i < props.length; i++){
8071
8471
  var descriptor = props[i];
8072
8472
  descriptor.enumerable = descriptor.enumerable || false;
@@ -8075,11 +8475,11 @@ function _defineProperties$8(target, props) {
8075
8475
  Object.defineProperty(target, descriptor.key, descriptor);
8076
8476
  }
8077
8477
  }
8078
- function _create_class$8(Constructor, protoProps, staticProps) {
8079
- if (protoProps) _defineProperties$8(Constructor.prototype, protoProps);
8478
+ function _create_class$a(Constructor, protoProps, staticProps) {
8479
+ if (protoProps) _defineProperties$a(Constructor.prototype, protoProps);
8080
8480
  return Constructor;
8081
8481
  }
8082
- function _define_property$k(obj, key, value) {
8482
+ function _define_property$n(obj, key, value) {
8083
8483
  if (key in obj) {
8084
8484
  Object.defineProperty(obj, key, {
8085
8485
  value: value,
@@ -8092,7 +8492,7 @@ function _define_property$k(obj, key, value) {
8092
8492
  }
8093
8493
  return obj;
8094
8494
  }
8095
- function _instanceof$1(left, right) {
8495
+ function _instanceof$2(left, right) {
8096
8496
  "@swc/helpers - instanceof";
8097
8497
  if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
8098
8498
  return !!right[Symbol.hasInstance](left);
@@ -8100,7 +8500,7 @@ function _instanceof$1(left, right) {
8100
8500
  return left instanceof right;
8101
8501
  }
8102
8502
  }
8103
- function _ts_generator$8(thisArg, body) {
8503
+ function _ts_generator$a(thisArg, body) {
8104
8504
  var f, y, t, _ = {
8105
8505
  label: 0,
8106
8506
  sent: function() {
@@ -8225,13 +8625,13 @@ function _ts_generator$8(thisArg, body) {
8225
8625
  * Auth is provided by the OIDC bearer token middleware on the `req.auth` field.
8226
8626
  */ exports.ModelApiController = /*#__PURE__*/ function() {
8227
8627
  function ModelApiController(dispatchService, accessService) {
8228
- _class_call_check$d(this, ModelApiController);
8229
- _define_property$k(this, "dispatchService", void 0);
8230
- _define_property$k(this, "accessService", void 0);
8628
+ _class_call_check$g(this, ModelApiController);
8629
+ _define_property$n(this, "dispatchService", void 0);
8630
+ _define_property$n(this, "accessService", void 0);
8231
8631
  this.dispatchService = dispatchService;
8232
8632
  this.accessService = accessService;
8233
8633
  }
8234
- _create_class$8(ModelApiController, [
8634
+ _create_class$a(ModelApiController, [
8235
8635
  {
8236
8636
  key: "directDispatch",
8237
8637
  value: // MARK: Direct Dispatch
@@ -8245,8 +8645,8 @@ function _ts_generator$8(thisArg, body) {
8245
8645
  * @param req - The Express request containing auth credentials on `req.auth`.
8246
8646
  * @returns The result of the dispatched model call.
8247
8647
  */ function directDispatch(body, req) {
8248
- return _async_to_generator$8(function() {
8249
- return _ts_generator$8(this, function(_state) {
8648
+ return _async_to_generator$a(function() {
8649
+ return _ts_generator$a(this, function(_state) {
8250
8650
  return [
8251
8651
  2,
8252
8652
  this._dispatch(body, req)
@@ -8270,9 +8670,9 @@ function _ts_generator$8(thisArg, body) {
8270
8670
  * @param req - The Express request containing auth credentials on `req.auth`.
8271
8671
  * @returns The document data for the requested model key.
8272
8672
  */ function getOne(modelType, key, req) {
8273
- return _async_to_generator$8(function() {
8673
+ return _async_to_generator$a(function() {
8274
8674
  var auth, error;
8275
- return _ts_generator$8(this, function(_state) {
8675
+ return _ts_generator$a(this, function(_state) {
8276
8676
  switch(_state.label){
8277
8677
  case 0:
8278
8678
  if (!key) {
@@ -8326,9 +8726,9 @@ function _ts_generator$8(thisArg, body) {
8326
8726
  * @param req - The Express request containing auth credentials on `req.auth`.
8327
8727
  * @returns An object with `results` (document data array) and `errors` (per-key failures).
8328
8728
  */ function getMany(modelType, body, req) {
8329
- return _async_to_generator$8(function() {
8729
+ return _async_to_generator$a(function() {
8330
8730
  var keys, auth, error;
8331
- return _ts_generator$8(this, function(_state) {
8731
+ return _ts_generator$a(this, function(_state) {
8332
8732
  switch(_state.label){
8333
8733
  case 0:
8334
8734
  keys = body.keys;
@@ -8391,9 +8791,9 @@ function _ts_generator$8(thisArg, body) {
8391
8791
  * @param req - The Express request whose path segments encode modelType, call, and optional specifier.
8392
8792
  * @returns The result of the dispatched model call.
8393
8793
  */ function handleDispatchRequest(req) {
8394
- return _async_to_generator$8(function() {
8794
+ return _async_to_generator$a(function() {
8395
8795
  var _this__parsePath, modelType, call, specifier, params;
8396
- return _ts_generator$8(this, function(_state) {
8796
+ return _ts_generator$a(this, function(_state) {
8397
8797
  if (!ALLOWED_DISPATCH_METHODS.has(req.method)) {
8398
8798
  throw new common.HttpException({
8399
8799
  statusCode: 405,
@@ -8466,9 +8866,9 @@ function _ts_generator$8(thisArg, body) {
8466
8866
  {
8467
8867
  key: "_dispatch",
8468
8868
  value: function _dispatch(params, req) {
8469
- return _async_to_generator$8(function() {
8869
+ return _async_to_generator$a(function() {
8470
8870
  var auth, error;
8471
- return _ts_generator$8(this, function(_state) {
8871
+ return _ts_generator$a(this, function(_state) {
8472
8872
  switch(_state.label){
8473
8873
  case 0:
8474
8874
  auth = req.auth;
@@ -8505,7 +8905,7 @@ function _ts_generator$8(thisArg, body) {
8505
8905
  key: "_toHttpException",
8506
8906
  value: function _toHttpException(error) {
8507
8907
  var result;
8508
- if (_instanceof$1(error, common.HttpException)) {
8908
+ if (_instanceof$2(error, common.HttpException)) {
8509
8909
  result = error;
8510
8910
  } else {
8511
8911
  var _ref, _ref1, _ref2;
@@ -8551,15 +8951,15 @@ exports.ModelApiController = __decorate([
8551
8951
  __param(1, common.Inject(exports.ModelApiGetService))
8552
8952
  ], exports.ModelApiController);
8553
8953
 
8554
- function _array_like_to_array$7(arr, len) {
8954
+ function _array_like_to_array$9(arr, len) {
8555
8955
  if (len == null || len > arr.length) len = arr.length;
8556
8956
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
8557
8957
  return arr2;
8558
8958
  }
8559
- function _array_without_holes$5(arr) {
8560
- if (Array.isArray(arr)) return _array_like_to_array$7(arr);
8959
+ function _array_without_holes$7(arr) {
8960
+ if (Array.isArray(arr)) return _array_like_to_array$9(arr);
8561
8961
  }
8562
- function _define_property$j(obj, key, value) {
8962
+ function _define_property$m(obj, key, value) {
8563
8963
  if (key in obj) {
8564
8964
  Object.defineProperty(obj, key, {
8565
8965
  value: value,
@@ -8572,13 +8972,13 @@ function _define_property$j(obj, key, value) {
8572
8972
  }
8573
8973
  return obj;
8574
8974
  }
8575
- function _iterable_to_array$5(iter) {
8975
+ function _iterable_to_array$7(iter) {
8576
8976
  if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
8577
8977
  }
8578
- function _non_iterable_spread$5() {
8978
+ function _non_iterable_spread$7() {
8579
8979
  throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
8580
8980
  }
8581
- function _object_spread$b(target) {
8981
+ function _object_spread$c(target) {
8582
8982
  for(var i = 1; i < arguments.length; i++){
8583
8983
  var source = arguments[i] != null ? arguments[i] : {};
8584
8984
  var ownKeys = Object.keys(source);
@@ -8588,21 +8988,21 @@ function _object_spread$b(target) {
8588
8988
  }));
8589
8989
  }
8590
8990
  ownKeys.forEach(function(key) {
8591
- _define_property$j(target, key, source[key]);
8991
+ _define_property$m(target, key, source[key]);
8592
8992
  });
8593
8993
  }
8594
8994
  return target;
8595
8995
  }
8596
- function _to_consumable_array$5(arr) {
8597
- return _array_without_holes$5(arr) || _iterable_to_array$5(arr) || _unsupported_iterable_to_array$7(arr) || _non_iterable_spread$5();
8996
+ function _to_consumable_array$7(arr) {
8997
+ return _array_without_holes$7(arr) || _iterable_to_array$7(arr) || _unsupported_iterable_to_array$9(arr) || _non_iterable_spread$7();
8598
8998
  }
8599
- function _unsupported_iterable_to_array$7(o, minLen) {
8999
+ function _unsupported_iterable_to_array$9(o, minLen) {
8600
9000
  if (!o) return;
8601
- if (typeof o === "string") return _array_like_to_array$7(o, minLen);
9001
+ if (typeof o === "string") return _array_like_to_array$9(o, minLen);
8602
9002
  var n = Object.prototype.toString.call(o).slice(8, -1);
8603
9003
  if (n === "Object" && o.constructor) n = o.constructor.name;
8604
9004
  if (n === "Map" || n === "Set") return Array.from(n);
8605
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$7(o, minLen);
9005
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$9(o, minLen);
8606
9006
  }
8607
9007
  // MARK: Module Metadata
8608
9008
  /**
@@ -8627,14 +9027,14 @@ function _unsupported_iterable_to_array$7(o, minLen) {
8627
9027
  return {
8628
9028
  imports: [
8629
9029
  dependencyModule
8630
- ].concat(_to_consumable_array$5(imports !== null && imports !== void 0 ? imports : [])),
9030
+ ].concat(_to_consumable_array$7(imports !== null && imports !== void 0 ? imports : [])),
8631
9031
  controllers: [
8632
9032
  exports.ModelApiController
8633
9033
  ],
8634
9034
  exports: [
8635
9035
  exports.ModelApiGetService,
8636
9036
  exports.ModelApiCallModelDispatchService
8637
- ].concat(_to_consumable_array$5(exports$1 !== null && exports$1 !== void 0 ? exports$1 : [])),
9037
+ ].concat(_to_consumable_array$7(exports$1 !== null && exports$1 !== void 0 ? exports$1 : [])),
8638
9038
  providers: [
8639
9039
  exports.ModelApiGetService,
8640
9040
  exports.ModelApiCallModelDispatchService,
@@ -8646,7 +9046,7 @@ function _unsupported_iterable_to_array$7(o, minLen) {
8646
9046
  // a full app-level context where all providers (e.g., server actions) are resolvable.
8647
9047
  return {
8648
9048
  get: function get(typeOrToken, options) {
8649
- return moduleRef.get(typeOrToken, _object_spread$b({
9049
+ return moduleRef.get(typeOrToken, _object_spread$c({
8650
9050
  strict: false
8651
9051
  }, options));
8652
9052
  }
@@ -8656,6 +9056,810 @@ function _unsupported_iterable_to_array$7(o, minLen) {
8656
9056
  core.ModuleRef
8657
9057
  ]
8658
9058
  }
9059
+ ].concat(_to_consumable_array$7(providers !== null && providers !== void 0 ? providers : []))
9060
+ };
9061
+ }
9062
+
9063
+ function _class_call_check$f(instance, Constructor) {
9064
+ if (!(instance instanceof Constructor)) {
9065
+ throw new TypeError("Cannot call a class as a function");
9066
+ }
9067
+ }
9068
+ function _define_property$l(obj, key, value) {
9069
+ if (key in obj) {
9070
+ Object.defineProperty(obj, key, {
9071
+ value: value,
9072
+ enumerable: true,
9073
+ configurable: true,
9074
+ writable: true
9075
+ });
9076
+ } else {
9077
+ obj[key] = value;
9078
+ }
9079
+ return obj;
9080
+ }
9081
+ // MARK: Paths
9082
+ /**
9083
+ * Route prefix the session API controller is mounted at. Under the `/api` global route prefix the
9084
+ * routes become `/api/session/*`.
9085
+ */ var SESSION_API_ROUTE_PREFIX = 'session';
9086
+ /**
9087
+ * Path (relative to the API base URL) of the direct-Firestore session endpoint.
9088
+ *
9089
+ * The `@dereekb/dbx-cli` client posts to `<apiBaseUrl>${FIRESTORE_SESSION_API_PATH}`.
9090
+ */ var FIRESTORE_SESSION_API_PATH = '/session/firestore';
9091
+ /**
9092
+ * Path prefix apps must add to their OIDC `protectedPaths` so the bearer-token middleware
9093
+ * authenticates the session endpoint (today typically `['/api/model', '/mcp']`).
9094
+ *
9095
+ * Without this the endpoint is reachable unauthenticated — `req.auth` would be `undefined` and the
9096
+ * request rejected as unauthenticated, but the gate belongs at the middleware, not the handler.
9097
+ */ var FIREBASE_SERVER_SESSION_API_PROTECTED_PATH = '/api/session';
9098
+ // MARK: TTL
9099
+ /**
9100
+ * Default lifetime requested for the minted App Check token. Matches the Admin SDK's own default.
9101
+ */ var DEFAULT_FIRESTORE_SESSION_APP_CHECK_TTL_MILLIS = 60 * 60 * 1000;
9102
+ /**
9103
+ * Minimum lifetime the Admin SDK accepts for an App Check token (30 minutes).
9104
+ */ var MIN_FIRESTORE_SESSION_APP_CHECK_TTL_MILLIS = 30 * 60 * 1000;
9105
+ /**
9106
+ * Maximum lifetime the Admin SDK accepts for an App Check token (7 days).
9107
+ *
9108
+ * Deliberately NOT the default: this endpoint mints a valid web-app App Check attestation for
9109
+ * whoever calls it, so the shortest workable lifetime is the right one.
9110
+ */ var MAX_FIRESTORE_SESSION_APP_CHECK_TTL_MILLIS = 7 * 24 * 60 * 60 * 1000;
9111
+ /**
9112
+ * Window a Firebase Auth custom token may be exchanged for an ID token within (1 hour, fixed by
9113
+ * Firebase). The exchanged ID token then lives its own hour from sign-in.
9114
+ */ var FIREBASE_CUSTOM_TOKEN_EXCHANGE_WINDOW_MILLIS = 60 * 60 * 1000;
9115
+ /**
9116
+ * NestJS injection token for the {@link FirestoreSessionAdminPredicate} provider.
9117
+ */ var FIRESTORE_SESSION_ADMIN_PREDICATE = 'FIRESTORE_SESSION_ADMIN_PREDICATE';
9118
+ // MARK: Config
9119
+ /**
9120
+ * Optional configuration for the session API module, supplied by the app via its dependency module.
9121
+ *
9122
+ * Everything here is optional — with no config provided the endpoint still mints custom tokens, just
9123
+ * without an App Check attestation (correct for a project that does not enforce App Check, and for
9124
+ * emulator-backed local development).
9125
+ */ var SessionApiModuleConfig = function SessionApiModuleConfig() {
9126
+ _class_call_check$f(this, SessionApiModuleConfig);
9127
+ /**
9128
+ * The Firebase `appId` of the registered **web** app to mint App Check tokens for. This is the same
9129
+ * `appId` the browser client initializes with — the attestation must match an app the project's
9130
+ * App Check enforcement recognizes.
9131
+ *
9132
+ * When unset, no App Check token is minted and the response's `appCheckToken` is omitted.
9133
+ */ _define_property$l(this, "appCheckAppId", void 0);
9134
+ /**
9135
+ * Lifetime to request for the minted App Check token. Clamped to
9136
+ * [{@link MIN_FIRESTORE_SESSION_APP_CHECK_TTL_MILLIS}, {@link MAX_FIRESTORE_SESSION_APP_CHECK_TTL_MILLIS}].
9137
+ *
9138
+ * Defaults to {@link DEFAULT_FIRESTORE_SESSION_APP_CHECK_TTL_MILLIS}.
9139
+ */ _define_property$l(this, "appCheckTokenTtlMillis", void 0);
9140
+ /**
9141
+ * OIDC scope term an OIDC caller must hold to open a session. Defaults to
9142
+ * {@link FIRESTORE_SESSION_OIDC_SCOPE}. Pass `null` to disable scope enforcement entirely (the admin
9143
+ * predicate remains the real gate either way).
9144
+ */ _define_property$l(this, "requiredScope", void 0);
9145
+ };
9146
+ /**
9147
+ * Resolves the effective App Check TTL from the module config, clamped to the Admin SDK's accepted range.
9148
+ *
9149
+ * @param ttlMillis - The configured TTL, or `undefined` to use the default.
9150
+ * @returns The TTL to request, in milliseconds.
9151
+ * @__NO_SIDE_EFFECTS__
9152
+ */ function firestoreSessionAppCheckTtlMillis(ttlMillis) {
9153
+ var requested = ttlMillis !== null && ttlMillis !== void 0 ? ttlMillis : DEFAULT_FIRESTORE_SESSION_APP_CHECK_TTL_MILLIS;
9154
+ return Math.min(Math.max(requested, MIN_FIRESTORE_SESSION_APP_CHECK_TTL_MILLIS), MAX_FIRESTORE_SESSION_APP_CHECK_TTL_MILLIS);
9155
+ }
9156
+ /**
9157
+ * The default {@link SessionApiModuleConfig.requiredScope}, re-exported for apps that want to widen it
9158
+ * into an OR-group rather than replace it.
9159
+ */ var DEFAULT_FIRESTORE_SESSION_REQUIRED_OIDC_SCOPE = firebase.FIRESTORE_SESSION_OIDC_SCOPE;
9160
+
9161
+ function _array_like_to_array$8(arr, len) {
9162
+ if (len == null || len > arr.length) len = arr.length;
9163
+ for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
9164
+ return arr2;
9165
+ }
9166
+ function _array_without_holes$6(arr) {
9167
+ if (Array.isArray(arr)) return _array_like_to_array$8(arr);
9168
+ }
9169
+ function asyncGeneratorStep$9(gen, resolve, reject, _next, _throw, key, arg) {
9170
+ try {
9171
+ var info = gen[key](arg);
9172
+ var value = info.value;
9173
+ } catch (error) {
9174
+ reject(error);
9175
+ return;
9176
+ }
9177
+ if (info.done) {
9178
+ resolve(value);
9179
+ } else {
9180
+ Promise.resolve(value).then(_next, _throw);
9181
+ }
9182
+ }
9183
+ function _async_to_generator$9(fn) {
9184
+ return function() {
9185
+ var self = this, args = arguments;
9186
+ return new Promise(function(resolve, reject) {
9187
+ var gen = fn.apply(self, args);
9188
+ function _next(value) {
9189
+ asyncGeneratorStep$9(gen, resolve, reject, _next, _throw, "next", value);
9190
+ }
9191
+ function _throw(err) {
9192
+ asyncGeneratorStep$9(gen, resolve, reject, _next, _throw, "throw", err);
9193
+ }
9194
+ _next(undefined);
9195
+ });
9196
+ };
9197
+ }
9198
+ function _class_call_check$e(instance, Constructor) {
9199
+ if (!(instance instanceof Constructor)) {
9200
+ throw new TypeError("Cannot call a class as a function");
9201
+ }
9202
+ }
9203
+ function _defineProperties$9(target, props) {
9204
+ for(var i = 0; i < props.length; i++){
9205
+ var descriptor = props[i];
9206
+ descriptor.enumerable = descriptor.enumerable || false;
9207
+ descriptor.configurable = true;
9208
+ if ("value" in descriptor) descriptor.writable = true;
9209
+ Object.defineProperty(target, descriptor.key, descriptor);
9210
+ }
9211
+ }
9212
+ function _create_class$9(Constructor, protoProps, staticProps) {
9213
+ if (protoProps) _defineProperties$9(Constructor.prototype, protoProps);
9214
+ return Constructor;
9215
+ }
9216
+ function _define_property$k(obj, key, value) {
9217
+ if (key in obj) {
9218
+ Object.defineProperty(obj, key, {
9219
+ value: value,
9220
+ enumerable: true,
9221
+ configurable: true,
9222
+ writable: true
9223
+ });
9224
+ } else {
9225
+ obj[key] = value;
9226
+ }
9227
+ return obj;
9228
+ }
9229
+ function _iterable_to_array$6(iter) {
9230
+ if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
9231
+ }
9232
+ function _non_iterable_spread$6() {
9233
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
9234
+ }
9235
+ function _object_spread$b(target) {
9236
+ for(var i = 1; i < arguments.length; i++){
9237
+ var source = arguments[i] != null ? arguments[i] : {};
9238
+ var ownKeys = Object.keys(source);
9239
+ if (typeof Object.getOwnPropertySymbols === "function") {
9240
+ ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
9241
+ return Object.getOwnPropertyDescriptor(source, sym).enumerable;
9242
+ }));
9243
+ }
9244
+ ownKeys.forEach(function(key) {
9245
+ _define_property$k(target, key, source[key]);
9246
+ });
9247
+ }
9248
+ return target;
9249
+ }
9250
+ function ownKeys$9(object, enumerableOnly) {
9251
+ var keys = Object.keys(object);
9252
+ if (Object.getOwnPropertySymbols) {
9253
+ var symbols = Object.getOwnPropertySymbols(object);
9254
+ keys.push.apply(keys, symbols);
9255
+ }
9256
+ return keys;
9257
+ }
9258
+ function _object_spread_props$9(target, source) {
9259
+ source = source != null ? source : {};
9260
+ if (Object.getOwnPropertyDescriptors) {
9261
+ Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
9262
+ } else {
9263
+ ownKeys$9(Object(source)).forEach(function(key) {
9264
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
9265
+ });
9266
+ }
9267
+ return target;
9268
+ }
9269
+ function _to_consumable_array$6(arr) {
9270
+ return _array_without_holes$6(arr) || _iterable_to_array$6(arr) || _unsupported_iterable_to_array$8(arr) || _non_iterable_spread$6();
9271
+ }
9272
+ function _unsupported_iterable_to_array$8(o, minLen) {
9273
+ if (!o) return;
9274
+ if (typeof o === "string") return _array_like_to_array$8(o, minLen);
9275
+ var n = Object.prototype.toString.call(o).slice(8, -1);
9276
+ if (n === "Object" && o.constructor) n = o.constructor.name;
9277
+ if (n === "Map" || n === "Set") return Array.from(n);
9278
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$8(o, minLen);
9279
+ }
9280
+ function _ts_generator$9(thisArg, body) {
9281
+ var f, y, t, _ = {
9282
+ label: 0,
9283
+ sent: function() {
9284
+ if (t[0] & 1) throw t[1];
9285
+ return t[1];
9286
+ },
9287
+ trys: [],
9288
+ ops: []
9289
+ }, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype), d = Object.defineProperty;
9290
+ return d(g, "next", {
9291
+ value: verb(0)
9292
+ }), d(g, "throw", {
9293
+ value: verb(1)
9294
+ }), d(g, "return", {
9295
+ value: verb(2)
9296
+ }), typeof Symbol === "function" && d(g, Symbol.iterator, {
9297
+ value: function() {
9298
+ return this;
9299
+ }
9300
+ }), g;
9301
+ function verb(n) {
9302
+ return function(v) {
9303
+ return step([
9304
+ n,
9305
+ v
9306
+ ]);
9307
+ };
9308
+ }
9309
+ function step(op) {
9310
+ if (f) throw new TypeError("Generator is already executing.");
9311
+ while(g && (g = 0, op[0] && (_ = 0)), _)try {
9312
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
9313
+ if (y = 0, t) op = [
9314
+ op[0] & 2,
9315
+ t.value
9316
+ ];
9317
+ switch(op[0]){
9318
+ case 0:
9319
+ case 1:
9320
+ t = op;
9321
+ break;
9322
+ case 4:
9323
+ _.label++;
9324
+ return {
9325
+ value: op[1],
9326
+ done: false
9327
+ };
9328
+ case 5:
9329
+ _.label++;
9330
+ y = op[1];
9331
+ op = [
9332
+ 0
9333
+ ];
9334
+ continue;
9335
+ case 7:
9336
+ op = _.ops.pop();
9337
+ _.trys.pop();
9338
+ continue;
9339
+ default:
9340
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
9341
+ _ = 0;
9342
+ continue;
9343
+ }
9344
+ if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
9345
+ _.label = op[1];
9346
+ break;
9347
+ }
9348
+ if (op[0] === 6 && _.label < t[1]) {
9349
+ _.label = t[1];
9350
+ t = op;
9351
+ break;
9352
+ }
9353
+ if (t && _.label < t[2]) {
9354
+ _.label = t[2];
9355
+ _.ops.push(op);
9356
+ break;
9357
+ }
9358
+ if (t[2]) _.ops.pop();
9359
+ _.trys.pop();
9360
+ continue;
9361
+ }
9362
+ op = body.call(thisArg, _);
9363
+ } catch (e) {
9364
+ op = [
9365
+ 6,
9366
+ e
9367
+ ];
9368
+ y = 0;
9369
+ } finally{
9370
+ f = t = 0;
9371
+ }
9372
+ if (op[0] & 5) throw op[1];
9373
+ return {
9374
+ value: op[0] ? op[1] : void 0,
9375
+ done: true
9376
+ };
9377
+ }
9378
+ }
9379
+ var FirestoreSessionApiService_1;
9380
+ /**
9381
+ * Error code thrown when the caller is not authorized to open a direct-Firestore session.
9382
+ */ var FIRESTORE_SESSION_FORBIDDEN_ERROR_CODE = 'FIRESTORE_SESSION_FORBIDDEN_ERROR';
9383
+ /**
9384
+ * Mints the direct-Firestore session credential bundle returned by `SessionApiController`.
9385
+ *
9386
+ * ## Security
9387
+ *
9388
+ * This service hands out a valid web-app App Check token and a custom token for the caller's own uid.
9389
+ * Two gates apply, in order:
9390
+ *
9391
+ * 1. The app-supplied {@link FirestoreSessionAdminPredicate} — the load-bearing check. **Fails closed**
9392
+ * when the app provides no predicate.
9393
+ * 2. The OIDC scope requirement (default {@link FIRESTORE_SESSION_OIDC_SCOPE}) — defence in depth only.
9394
+ * It cannot stand alone: a non-OIDC caller carries no `scope` claim and every enforcement site in
9395
+ * this codebase treats that as "skip".
9396
+ *
9397
+ * The custom token is ALWAYS minted for `auth.uid`; there is no way to ask for someone else's session,
9398
+ * so a granted session is exactly as privileged as the caller already is under Firestore rules.
9399
+ */ exports.FirestoreSessionApiService = FirestoreSessionApiService_1 = /*#__PURE__*/ function() {
9400
+ function FirestoreSessionApiService(app, config, adminPredicate) {
9401
+ _class_call_check$e(this, FirestoreSessionApiService);
9402
+ _define_property$k(this, "_logger", new common.Logger(FirestoreSessionApiService_1.name));
9403
+ _define_property$k(this, "_app", void 0);
9404
+ _define_property$k(this, "_config", void 0);
9405
+ _define_property$k(this, "_adminPredicate", void 0);
9406
+ this._app = app;
9407
+ this._config = config;
9408
+ this._adminPredicate = adminPredicate;
9409
+ if (!adminPredicate) {
9410
+ this._logger.warn("No ".concat(FIRESTORE_SESSION_ADMIN_PREDICATE, " provided — ").concat(FIRESTORE_SESSION_API_PATH, " will reject every caller. Provide one from the session module's dependency module."));
9411
+ }
9412
+ if (!(config === null || config === void 0 ? void 0 : config.appCheckAppId)) {
9413
+ this._logger.warn("No SessionApiModuleConfig.appCheckAppId configured — ".concat(FIRESTORE_SESSION_API_PATH, " will issue sessions without an App Check attestation. Direct Firestore access will be rejected wherever App Check is enforced."));
9414
+ }
9415
+ }
9416
+ _create_class$9(FirestoreSessionApiService, [
9417
+ {
9418
+ key: "createFirestoreSession",
9419
+ value: /**
9420
+ * Mints a direct-Firestore session for the calling user after enforcing the admin predicate and the
9421
+ * OIDC scope requirement.
9422
+ *
9423
+ * @param auth - The authenticated request's auth data (`req.auth`).
9424
+ * @returns The credential bundle the client needs to connect to Firestore as this user.
9425
+ * @throws {HttpsError} A `401` when the request carries no uid, or a `403` when either gate rejects the caller.
9426
+ */ function createFirestoreSession(auth) {
9427
+ return _async_to_generator$9(function() {
9428
+ var _Math, _this__config, _this__config1, uid, isAllowed, _tmp, configuredScope, now, customToken, appCheckToken, appCheckTtlMillis, appCheckAppId, _created_ttlMillis, _this__config2, ttlMillis, created, expiresAtMillis;
9429
+ return _ts_generator$9(this, function(_state) {
9430
+ switch(_state.label){
9431
+ case 0:
9432
+ uid = auth === null || auth === void 0 ? void 0 : auth.uid;
9433
+ if (!uid) {
9434
+ throw unauthenticatedError({
9435
+ message: 'A direct-Firestore session requires an authenticated caller.'
9436
+ });
9437
+ }
9438
+ if (!this._adminPredicate) return [
9439
+ 3,
9440
+ 2
9441
+ ];
9442
+ return [
9443
+ 4,
9444
+ this._adminPredicate(auth)
9445
+ ];
9446
+ case 1:
9447
+ _tmp = _state.sent();
9448
+ return [
9449
+ 3,
9450
+ 3
9451
+ ];
9452
+ case 2:
9453
+ _tmp = false;
9454
+ _state.label = 3;
9455
+ case 3:
9456
+ isAllowed = _tmp;
9457
+ if (!isAllowed) {
9458
+ throw forbiddenError({
9459
+ status: 403,
9460
+ code: FIRESTORE_SESSION_FORBIDDEN_ERROR_CODE,
9461
+ message: 'Not authorized to open a direct-Firestore session.'
9462
+ });
9463
+ }
9464
+ // an explicit `null` disables scope enforcement; only an ABSENT value falls back to the default
9465
+ configuredScope = (_this__config = this._config) === null || _this__config === void 0 ? void 0 : _this__config.requiredScope;
9466
+ assertEndpointOidcScope({
9467
+ requiredScope: configuredScope === undefined ? DEFAULT_FIRESTORE_SESSION_REQUIRED_OIDC_SCOPE : configuredScope,
9468
+ grantedScopes: oidcScopesFromRequestAuth(auth),
9469
+ endpoint: FIRESTORE_SESSION_API_PATH
9470
+ });
9471
+ now = Date.now();
9472
+ return [
9473
+ 4,
9474
+ this._app.auth().createCustomToken(uid)
9475
+ ];
9476
+ case 4:
9477
+ customToken = _state.sent();
9478
+ appCheckAppId = (_this__config1 = this._config) === null || _this__config1 === void 0 ? void 0 : _this__config1.appCheckAppId;
9479
+ if (!appCheckAppId) return [
9480
+ 3,
9481
+ 6
9482
+ ];
9483
+ ttlMillis = firestoreSessionAppCheckTtlMillis((_this__config2 = this._config) === null || _this__config2 === void 0 ? void 0 : _this__config2.appCheckTokenTtlMillis);
9484
+ return [
9485
+ 4,
9486
+ this._app.appCheck().createToken(appCheckAppId, {
9487
+ ttlMillis: ttlMillis
9488
+ })
9489
+ ];
9490
+ case 5:
9491
+ created = _state.sent();
9492
+ appCheckToken = created.token;
9493
+ appCheckTtlMillis = (_created_ttlMillis = created.ttlMillis) !== null && _created_ttlMillis !== void 0 ? _created_ttlMillis : ttlMillis;
9494
+ _state.label = 6;
9495
+ case 6:
9496
+ // the session lives only as long as its shortest-lived credential
9497
+ expiresAtMillis = (_Math = Math).min.apply(_Math, [
9498
+ now + FIREBASE_CUSTOM_TOKEN_EXCHANGE_WINDOW_MILLIS
9499
+ ].concat(_to_consumable_array$6(appCheckTtlMillis == null ? [] : [
9500
+ now + appCheckTtlMillis
9501
+ ])));
9502
+ return [
9503
+ 2,
9504
+ _object_spread_props$9(_object_spread$b({
9505
+ uid: uid,
9506
+ customToken: customToken
9507
+ }, appCheckToken ? {
9508
+ appCheckToken: appCheckToken
9509
+ } : undefined), {
9510
+ expiresAt: new Date(expiresAtMillis).toISOString()
9511
+ })
9512
+ ];
9513
+ }
9514
+ });
9515
+ }).call(this);
9516
+ }
9517
+ }
9518
+ ]);
9519
+ return FirestoreSessionApiService;
9520
+ }();
9521
+ exports.FirestoreSessionApiService = FirestoreSessionApiService_1 = __decorate([
9522
+ common.Injectable(),
9523
+ __param(0, common.Inject(FIREBASE_APP_TOKEN)),
9524
+ __param(1, common.Optional()),
9525
+ __param(1, common.Inject(SessionApiModuleConfig)),
9526
+ __param(2, common.Optional()),
9527
+ __param(2, common.Inject(FIRESTORE_SESSION_ADMIN_PREDICATE))
9528
+ ], exports.FirestoreSessionApiService);
9529
+
9530
+ function asyncGeneratorStep$8(gen, resolve, reject, _next, _throw, key, arg) {
9531
+ try {
9532
+ var info = gen[key](arg);
9533
+ var value = info.value;
9534
+ } catch (error) {
9535
+ reject(error);
9536
+ return;
9537
+ }
9538
+ if (info.done) {
9539
+ resolve(value);
9540
+ } else {
9541
+ Promise.resolve(value).then(_next, _throw);
9542
+ }
9543
+ }
9544
+ function _async_to_generator$8(fn) {
9545
+ return function() {
9546
+ var self = this, args = arguments;
9547
+ return new Promise(function(resolve, reject) {
9548
+ var gen = fn.apply(self, args);
9549
+ function _next(value) {
9550
+ asyncGeneratorStep$8(gen, resolve, reject, _next, _throw, "next", value);
9551
+ }
9552
+ function _throw(err) {
9553
+ asyncGeneratorStep$8(gen, resolve, reject, _next, _throw, "throw", err);
9554
+ }
9555
+ _next(undefined);
9556
+ });
9557
+ };
9558
+ }
9559
+ function _class_call_check$d(instance, Constructor) {
9560
+ if (!(instance instanceof Constructor)) {
9561
+ throw new TypeError("Cannot call a class as a function");
9562
+ }
9563
+ }
9564
+ function _defineProperties$8(target, props) {
9565
+ for(var i = 0; i < props.length; i++){
9566
+ var descriptor = props[i];
9567
+ descriptor.enumerable = descriptor.enumerable || false;
9568
+ descriptor.configurable = true;
9569
+ if ("value" in descriptor) descriptor.writable = true;
9570
+ Object.defineProperty(target, descriptor.key, descriptor);
9571
+ }
9572
+ }
9573
+ function _create_class$8(Constructor, protoProps, staticProps) {
9574
+ if (protoProps) _defineProperties$8(Constructor.prototype, protoProps);
9575
+ return Constructor;
9576
+ }
9577
+ function _define_property$j(obj, key, value) {
9578
+ if (key in obj) {
9579
+ Object.defineProperty(obj, key, {
9580
+ value: value,
9581
+ enumerable: true,
9582
+ configurable: true,
9583
+ writable: true
9584
+ });
9585
+ } else {
9586
+ obj[key] = value;
9587
+ }
9588
+ return obj;
9589
+ }
9590
+ function _instanceof$1(left, right) {
9591
+ "@swc/helpers - instanceof";
9592
+ if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
9593
+ return !!right[Symbol.hasInstance](left);
9594
+ } else {
9595
+ return left instanceof right;
9596
+ }
9597
+ }
9598
+ function _ts_generator$8(thisArg, body) {
9599
+ var f, y, t, _ = {
9600
+ label: 0,
9601
+ sent: function() {
9602
+ if (t[0] & 1) throw t[1];
9603
+ return t[1];
9604
+ },
9605
+ trys: [],
9606
+ ops: []
9607
+ }, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype), d = Object.defineProperty;
9608
+ return d(g, "next", {
9609
+ value: verb(0)
9610
+ }), d(g, "throw", {
9611
+ value: verb(1)
9612
+ }), d(g, "return", {
9613
+ value: verb(2)
9614
+ }), typeof Symbol === "function" && d(g, Symbol.iterator, {
9615
+ value: function() {
9616
+ return this;
9617
+ }
9618
+ }), g;
9619
+ function verb(n) {
9620
+ return function(v) {
9621
+ return step([
9622
+ n,
9623
+ v
9624
+ ]);
9625
+ };
9626
+ }
9627
+ function step(op) {
9628
+ if (f) throw new TypeError("Generator is already executing.");
9629
+ while(g && (g = 0, op[0] && (_ = 0)), _)try {
9630
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
9631
+ if (y = 0, t) op = [
9632
+ op[0] & 2,
9633
+ t.value
9634
+ ];
9635
+ switch(op[0]){
9636
+ case 0:
9637
+ case 1:
9638
+ t = op;
9639
+ break;
9640
+ case 4:
9641
+ _.label++;
9642
+ return {
9643
+ value: op[1],
9644
+ done: false
9645
+ };
9646
+ case 5:
9647
+ _.label++;
9648
+ y = op[1];
9649
+ op = [
9650
+ 0
9651
+ ];
9652
+ continue;
9653
+ case 7:
9654
+ op = _.ops.pop();
9655
+ _.trys.pop();
9656
+ continue;
9657
+ default:
9658
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
9659
+ _ = 0;
9660
+ continue;
9661
+ }
9662
+ if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
9663
+ _.label = op[1];
9664
+ break;
9665
+ }
9666
+ if (op[0] === 6 && _.label < t[1]) {
9667
+ _.label = t[1];
9668
+ t = op;
9669
+ break;
9670
+ }
9671
+ if (t && _.label < t[2]) {
9672
+ _.label = t[2];
9673
+ _.ops.push(op);
9674
+ break;
9675
+ }
9676
+ if (t[2]) _.ops.pop();
9677
+ _.trys.pop();
9678
+ continue;
9679
+ }
9680
+ op = body.call(thisArg, _);
9681
+ } catch (e) {
9682
+ op = [
9683
+ 6,
9684
+ e
9685
+ ];
9686
+ y = 0;
9687
+ } finally{
9688
+ f = t = 0;
9689
+ }
9690
+ if (op[0] & 5) throw op[1];
9691
+ return {
9692
+ value: op[0] ? op[1] : void 0,
9693
+ done: true
9694
+ };
9695
+ }
9696
+ }
9697
+ /**
9698
+ * REST controller that hands an authenticated admin caller the credentials needed to talk to
9699
+ * Firestore directly, rather than only through the model HTTP API.
9700
+ *
9701
+ * Mounted at `session` — under the `/api` global prefix the route becomes `GET /api/session/firestore`.
9702
+ *
9703
+ * Auth comes from the global OIDC bearer middleware, so `'/api/session'` MUST be listed in the OIDC
9704
+ * module's `protectedPaths` (see `FIREBASE_SERVER_SESSION_API_PROTECTED_PATH`). Follows `McpController`:
9705
+ * there are no NestJS guards in this codebase — protection is path-prefix middleware plus the
9706
+ * per-endpoint checks in {@link FirestoreSessionApiService}.
9707
+ */ exports.SessionApiController = /*#__PURE__*/ function() {
9708
+ function SessionApiController(sessionService) {
9709
+ _class_call_check$d(this, SessionApiController);
9710
+ _define_property$j(this, "sessionService", void 0);
9711
+ this.sessionService = sessionService;
9712
+ }
9713
+ _create_class$8(SessionApiController, [
9714
+ {
9715
+ key: "getFirestoreSession",
9716
+ value: /**
9717
+ * Mints a short-lived Firebase Auth custom token (+ App Check attestation, when configured) for the
9718
+ * calling user.
9719
+ *
9720
+ * @param req - The Express request carrying auth credentials on `req.auth`.
9721
+ * @returns The {@link FirestoreSessionResult} credential bundle.
9722
+ */ function getFirestoreSession(req) {
9723
+ return _async_to_generator$8(function() {
9724
+ var auth, error;
9725
+ return _ts_generator$8(this, function(_state) {
9726
+ switch(_state.label){
9727
+ case 0:
9728
+ auth = req.auth;
9729
+ _state.label = 1;
9730
+ case 1:
9731
+ _state.trys.push([
9732
+ 1,
9733
+ 3,
9734
+ ,
9735
+ 4
9736
+ ]);
9737
+ return [
9738
+ 4,
9739
+ this.sessionService.createFirestoreSession(auth)
9740
+ ];
9741
+ case 2:
9742
+ return [
9743
+ 2,
9744
+ _state.sent()
9745
+ ];
9746
+ case 3:
9747
+ error = _state.sent();
9748
+ throw this._toHttpException(error);
9749
+ case 4:
9750
+ return [
9751
+ 2
9752
+ ];
9753
+ }
9754
+ });
9755
+ }).call(this);
9756
+ }
9757
+ },
9758
+ {
9759
+ key: "_toHttpException",
9760
+ value: function _toHttpException(error) {
9761
+ var result;
9762
+ if (_instanceof$1(error, common.HttpException)) {
9763
+ result = error;
9764
+ } else {
9765
+ var _ref, _ref1, _ref2, _ref3;
9766
+ var _error_httpErrorCode, _error_details;
9767
+ var status = (_ref = (_ref1 = error === null || error === void 0 ? void 0 : error.status) !== null && _ref1 !== void 0 ? _ref1 : error === null || error === void 0 ? void 0 : (_error_httpErrorCode = error.httpErrorCode) === null || _error_httpErrorCode === void 0 ? void 0 : _error_httpErrorCode.status) !== null && _ref !== void 0 ? _ref : common.HttpStatus.INTERNAL_SERVER_ERROR;
9768
+ var message = (_ref2 = error === null || error === void 0 ? void 0 : error.message) !== null && _ref2 !== void 0 ? _ref2 : 'Internal server error';
9769
+ // `forbiddenError`/`unauthenticatedError` build an HttpsError whose top-level `code` is the
9770
+ // coarse functions code ('permission-denied'), with the specific one under `details`. Prefer
9771
+ // the specific code so a client can tell FIRESTORE_SESSION_FORBIDDEN_ERROR (not an admin) apart
9772
+ // from MISSING_ENDPOINT_OIDC_SCOPE_ERROR (admin, but the token lacks `session.firestore`).
9773
+ var code = (_ref3 = error === null || error === void 0 ? void 0 : (_error_details = error.details) === null || _error_details === void 0 ? void 0 : _error_details.code) !== null && _ref3 !== void 0 ? _ref3 : error === null || error === void 0 ? void 0 : error.code;
9774
+ result = new common.HttpException({
9775
+ statusCode: status,
9776
+ message: message,
9777
+ code: code
9778
+ }, status);
9779
+ }
9780
+ return result;
9781
+ }
9782
+ }
9783
+ ]);
9784
+ return SessionApiController;
9785
+ }();
9786
+ __decorate([
9787
+ common.Get('firestore'),
9788
+ __param(0, common.Req())
9789
+ ], exports.SessionApiController.prototype, "getFirestoreSession", null);
9790
+ exports.SessionApiController = __decorate([
9791
+ common.Controller(SESSION_API_ROUTE_PREFIX),
9792
+ __param(0, common.Inject(exports.FirestoreSessionApiService))
9793
+ ], exports.SessionApiController);
9794
+
9795
+ function _array_like_to_array$7(arr, len) {
9796
+ if (len == null || len > arr.length) len = arr.length;
9797
+ for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
9798
+ return arr2;
9799
+ }
9800
+ function _array_without_holes$5(arr) {
9801
+ if (Array.isArray(arr)) return _array_like_to_array$7(arr);
9802
+ }
9803
+ function _iterable_to_array$5(iter) {
9804
+ if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
9805
+ }
9806
+ function _non_iterable_spread$5() {
9807
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
9808
+ }
9809
+ function _to_consumable_array$5(arr) {
9810
+ return _array_without_holes$5(arr) || _iterable_to_array$5(arr) || _unsupported_iterable_to_array$7(arr) || _non_iterable_spread$5();
9811
+ }
9812
+ function _unsupported_iterable_to_array$7(o, minLen) {
9813
+ if (!o) return;
9814
+ if (typeof o === "string") return _array_like_to_array$7(o, minLen);
9815
+ var n = Object.prototype.toString.call(o).slice(8, -1);
9816
+ if (n === "Object" && o.constructor) n = o.constructor.name;
9817
+ if (n === "Map" || n === "Set") return Array.from(n);
9818
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$7(o, minLen);
9819
+ }
9820
+ // MARK: Module Metadata
9821
+ /**
9822
+ * Generates NestJS module metadata for the direct-Firestore session API.
9823
+ *
9824
+ * Mirrors the convention used by `modelApiModuleMetadata` and `mcpModuleMetadata`: the consumer
9825
+ * provides a dependency module exposing the required tokens, and this factory wires the controller +
9826
+ * service.
9827
+ *
9828
+ * Remember to add `FIREBASE_SERVER_SESSION_API_PROTECTED_PATH` (`'/api/session'`) to the OIDC module's
9829
+ * `protectedPaths` — the controller relies on the bearer middleware having populated `req.auth`.
9830
+ *
9831
+ * @param metadataConfig - Configuration including the dependency module.
9832
+ * @returns NestJS module metadata exposing the session controller + service.
9833
+ *
9834
+ * @example
9835
+ * ```typescript
9836
+ * @Module({
9837
+ * imports: [DemoApiAuthModule],
9838
+ * providers: [
9839
+ * { provide: SessionApiModuleConfig, useValue: { appCheckAppId: environment.firebase.appId } },
9840
+ * { provide: FIRESTORE_SESSION_ADMIN_PREDICATE, useValue: (auth) => DEMO_AUTH_CLAIMS_SERVICE.toRoles(auth?.token ?? {}).has('admin') }
9841
+ * ],
9842
+ * exports: [SessionApiModuleConfig, FIRESTORE_SESSION_ADMIN_PREDICATE]
9843
+ * })
9844
+ * export class DemoSessionApiDependencyModule {}
9845
+ *
9846
+ * @Module(sessionApiModuleMetadata({ dependencyModule: DemoSessionApiDependencyModule }))
9847
+ * export class DemoSessionApiModule {}
9848
+ * ```
9849
+ */ function sessionApiModuleMetadata(metadataConfig) {
9850
+ var dependencyModule = metadataConfig.dependencyModule, imports = metadataConfig.imports, exports$1 = metadataConfig.exports, providers = metadataConfig.providers;
9851
+ return {
9852
+ imports: [
9853
+ dependencyModule
9854
+ ].concat(_to_consumable_array$5(imports !== null && imports !== void 0 ? imports : [])),
9855
+ controllers: [
9856
+ exports.SessionApiController
9857
+ ],
9858
+ exports: [
9859
+ exports.FirestoreSessionApiService
9860
+ ].concat(_to_consumable_array$5(exports$1 !== null && exports$1 !== void 0 ? exports$1 : [])),
9861
+ providers: [
9862
+ exports.FirestoreSessionApiService
8659
9863
  ].concat(_to_consumable_array$5(providers !== null && providers !== void 0 ? providers : []))
8660
9864
  };
8661
9865
  }
@@ -11565,7 +12769,7 @@ function _ts_generator$2(thisArg, body) {
11565
12769
  return x[0];
11566
12770
  }).catch(function(e) {
11567
12771
  var publicUrlBackup;
11568
- if (_instanceof(e, Error) && e.name === 'SigningError' && (nestjs.isTestNodeEnv() || process.env.FIREBASE_STORAGE_EMULATOR_HOST)) {
12772
+ if (_instanceof(e, Error) && e.name === 'SigningError' && (nestjs.isTestNodeEnv() || process.env['FIREBASE_STORAGE_EMULATOR_HOST'])) {
11569
12773
  // NOTE: Signing does not behave properly in the emulator as it is not supported.
11570
12774
  // https://github.com/firebase/firebase-tools/issues/3400
11571
12775
  // we can return the public url instead.
@@ -13287,20 +14491,27 @@ exports.AbstractFirebaseServerUserPasswordResetService = AbstractFirebaseServerU
13287
14491
  exports.AbstractNestContext = AbstractNestContext;
13288
14492
  exports.AbstractServerFirebaseNestContext = AbstractServerFirebaseNestContext;
13289
14493
  exports.DEFAULT_FIREBASE_PASSWORD_NUMBER_GENERATOR = DEFAULT_FIREBASE_PASSWORD_NUMBER_GENERATOR;
14494
+ exports.DEFAULT_FIRESTORE_SESSION_APP_CHECK_TTL_MILLIS = DEFAULT_FIRESTORE_SESSION_APP_CHECK_TTL_MILLIS;
14495
+ exports.DEFAULT_FIRESTORE_SESSION_REQUIRED_OIDC_SCOPE = DEFAULT_FIRESTORE_SESSION_REQUIRED_OIDC_SCOPE;
13290
14496
  exports.DEFAULT_RESET_CODE_EXPIRES_IN = DEFAULT_RESET_CODE_EXPIRES_IN;
13291
14497
  exports.DEFAULT_RESET_COM_THROTTLE_TIME = DEFAULT_RESET_COM_THROTTLE_TIME;
13292
14498
  exports.DEFAULT_SERVER_ASSETS_BASE_PATH = DEFAULT_SERVER_ASSETS_BASE_PATH;
13293
14499
  exports.DEFAULT_SETUP_COM_THROTTLE_TIME = DEFAULT_SETUP_COM_THROTTLE_TIME;
13294
14500
  exports.FIREBASE_APP_TOKEN = FIREBASE_APP_TOKEN;
13295
14501
  exports.FIREBASE_AUTH_TOKEN = FIREBASE_AUTH_TOKEN;
14502
+ exports.FIREBASE_CUSTOM_TOKEN_EXCHANGE_WINDOW_MILLIS = FIREBASE_CUSTOM_TOKEN_EXCHANGE_WINDOW_MILLIS;
13296
14503
  exports.FIREBASE_FIRESTORE_CONTEXT_TOKEN = FIREBASE_FIRESTORE_CONTEXT_TOKEN;
13297
14504
  exports.FIREBASE_FIRESTORE_TOKEN = FIREBASE_FIRESTORE_TOKEN;
13298
14505
  exports.FIREBASE_SERVER_ENV_TOKEN = FIREBASE_SERVER_ENV_TOKEN;
14506
+ exports.FIREBASE_SERVER_SESSION_API_PROTECTED_PATH = FIREBASE_SERVER_SESSION_API_PROTECTED_PATH;
13299
14507
  exports.FIREBASE_SERVER_VALIDATION_ERROR_CODE = FIREBASE_SERVER_VALIDATION_ERROR_CODE;
13300
14508
  exports.FIREBASE_STORAGE_CONTEXT_FACTORY_CONFIG_TOKEN = FIREBASE_STORAGE_CONTEXT_FACTORY_CONFIG_TOKEN;
13301
14509
  exports.FIREBASE_STORAGE_CONTEXT_TOKEN = FIREBASE_STORAGE_CONTEXT_TOKEN;
13302
14510
  exports.FIREBASE_STORAGE_TOKEN = FIREBASE_STORAGE_TOKEN;
13303
14511
  exports.FIRESTORE_CLIENT_QUERY_CONSTRAINT_HANDLER_MAPPING = FIRESTORE_CLIENT_QUERY_CONSTRAINT_HANDLER_MAPPING;
14512
+ exports.FIRESTORE_SESSION_ADMIN_PREDICATE = FIRESTORE_SESSION_ADMIN_PREDICATE;
14513
+ exports.FIRESTORE_SESSION_API_PATH = FIRESTORE_SESSION_API_PATH;
14514
+ exports.FIRESTORE_SESSION_FORBIDDEN_ERROR_CODE = FIRESTORE_SESSION_FORBIDDEN_ERROR_CODE;
13304
14515
  exports.FirebaseAppCheckMiddlewareConfig = FirebaseAppCheckMiddlewareConfig;
13305
14516
  exports.FirebaseNestServerRootModule = FirebaseNestServerRootModule;
13306
14517
  exports.FirebaseServerAnalyticsServiceListener = FirebaseServerAnalyticsServiceListener;
@@ -13317,8 +14528,12 @@ exports.FirebaseServerAuthUserExistsError = FirebaseServerAuthUserExistsError;
13317
14528
  exports.FirebaseServerEnvService = FirebaseServerEnvService;
13318
14529
  exports.FirebaseServerStorageService = FirebaseServerStorageService;
13319
14530
  exports.GlobalRoutePrefixConfig = GlobalRoutePrefixConfig;
14531
+ exports.MAX_FIRESTORE_SESSION_APP_CHECK_TTL_MILLIS = MAX_FIRESTORE_SESSION_APP_CHECK_TTL_MILLIS;
13320
14532
  exports.MAX_MODEL_ACCESS_MULTI_READ_KEYS = MAX_MODEL_ACCESS_MULTI_READ_KEYS;
14533
+ exports.MIN_FIRESTORE_SESSION_APP_CHECK_TTL_MILLIS = MIN_FIRESTORE_SESSION_APP_CHECK_TTL_MILLIS;
14534
+ exports.MISSING_ENDPOINT_OIDC_SCOPE_ERROR_CODE = MISSING_ENDPOINT_OIDC_SCOPE_ERROR_CODE;
13321
14535
  exports.MODEL_API_NEST_APPLICATION_CONTEXT = MODEL_API_NEST_APPLICATION_CONTEXT;
14536
+ exports.MODEL_IS_SERVER_ONLY_ERROR_CODE = MODEL_IS_SERVER_ONLY_ERROR_CODE;
13322
14537
  exports.ModelApiDispatchConfig = ModelApiDispatchConfig;
13323
14538
  exports.NO_RUN_NAME_SPECIFIED_FOR_SCHEDULED_FUNCTION_DEVELOPMENT_FUNCTION_CODE = NO_RUN_NAME_SPECIFIED_FOR_SCHEDULED_FUNCTION_DEVELOPMENT_FUNCTION_CODE;
13324
14539
  exports.NoContentFirebaseServerUserPasswordResetService = NoContentFirebaseServerUserPasswordResetService;
@@ -13327,6 +14542,8 @@ exports.ON_CALL_MODEL_ANALYTICS_HANDLER = ON_CALL_MODEL_ANALYTICS_HANDLER;
13327
14542
  exports.ON_CALL_MODEL_ANALYTICS_SERVICE = ON_CALL_MODEL_ANALYTICS_SERVICE;
13328
14543
  exports.OnCallModelAnalyticsService = OnCallModelAnalyticsService;
13329
14544
  exports.PHONE_NUMBER_ALREADY_EXISTS_ERROR_CODE = PHONE_NUMBER_ALREADY_EXISTS_ERROR_CODE;
14545
+ exports.SESSION_API_ROUTE_PREFIX = SESSION_API_ROUTE_PREFIX;
14546
+ exports.SessionApiModuleConfig = SessionApiModuleConfig;
13330
14547
  exports.SkipAppCheck = SkipAppCheck;
13331
14548
  exports.UNKNOWN_SCHEDULED_FUNCTION_DEVELOPMENT_FUNCTION_NAME_CODE = UNKNOWN_SCHEDULED_FUNCTION_DEVELOPMENT_FUNCTION_NAME_CODE;
13332
14549
  exports.UNKNOWN_SCHEDULED_FUNCTION_DEVELOPMENT_FUNCTION_TYPE_CODE = UNKNOWN_SCHEDULED_FUNCTION_DEVELOPMENT_FUNCTION_TYPE_CODE;
@@ -13339,6 +14556,7 @@ exports.appAnalyticsModuleMetadata = appAnalyticsModuleMetadata;
13339
14556
  exports.appFirestoreModuleMetadata = appFirestoreModuleMetadata;
13340
14557
  exports.assertContextHasAuth = assertContextHasAuth;
13341
14558
  exports.assertDocumentExists = assertDocumentExists;
14559
+ exports.assertEndpointOidcScope = assertEndpointOidcScope;
13342
14560
  exports.assertHasRolesInRequest = assertHasRolesInRequest;
13343
14561
  exports.assertHasSignedTosInRequest = assertHasSignedTosInRequest;
13344
14562
  exports.assertIsAdminInRequest = assertIsAdminInRequest;
@@ -13390,6 +14608,7 @@ exports.firebaseServerValidationServerError = firebaseServerValidationServerErro
13390
14608
  exports.firestoreClientQueryConstraintFunctionsDriver = firestoreClientQueryConstraintFunctionsDriver;
13391
14609
  exports.firestoreEncryptedField = firestoreEncryptedField;
13392
14610
  exports.firestoreServerIncrementUpdateToUpdateData = firestoreServerIncrementUpdateToUpdateData;
14611
+ exports.firestoreSessionAppCheckTtlMillis = firestoreSessionAppCheckTtlMillis;
13393
14612
  exports.forbiddenError = forbiddenError;
13394
14613
  exports.getAuthUserOrUndefined = getAuthUserOrUndefined;
13395
14614
  exports.getModelApiDetails = getModelApiDetails;
@@ -13431,6 +14650,7 @@ exports.makeBlockingFunctionWithHandler = makeBlockingFunctionWithHandler;
13431
14650
  exports.makeOnScheduleHandlerWithNestApplicationRequest = makeOnScheduleHandlerWithNestApplicationRequest;
13432
14651
  exports.makeScheduledFunctionDevelopmentFunction = makeScheduledFunctionDevelopmentFunction;
13433
14652
  exports.modelAccessReadErrorFromUseMultipleModelsFailure = modelAccessReadErrorFromUseMultipleModelsFailure;
14653
+ exports.modelAccessRoleMapResultFromGrantedRoles = modelAccessRoleMapResultFromGrantedRoles;
13434
14654
  exports.modelApiModuleMetadata = modelApiModuleMetadata;
13435
14655
  exports.modelNotAvailableError = modelNotAvailableError;
13436
14656
  exports.nestAppHasDevelopmentSchedulerEnabled = nestAppHasDevelopmentSchedulerEnabled;
@@ -13443,6 +14663,7 @@ exports.noopFirebaseServerAnalyticsServiceListener = noopFirebaseServerAnalytics
13443
14663
  exports.noopOnCallModelAnalyticsService = noopOnCallModelAnalyticsService;
13444
14664
  exports.notFoundError = notFoundError;
13445
14665
  exports.oidcScopesFromModelApiAuth = oidcScopesFromModelApiAuth;
14666
+ exports.oidcScopesFromRequestAuth = oidcScopesFromRequestAuth;
13446
14667
  exports.onCallAnalyticsEmitterInstance = onCallAnalyticsEmitterInstance;
13447
14668
  exports.onCallCreateModel = onCallCreateModel;
13448
14669
  exports.onCallDeleteModel = onCallDeleteModel;
@@ -13474,6 +14695,7 @@ exports.readModelUnknownModelTypeError = readModelUnknownModelTypeError;
13474
14695
  exports.resolveAdminOnlyValue = resolveAdminOnlyValue;
13475
14696
  exports.resolveAnalyticsFromApiDetails = resolveAnalyticsFromApiDetails;
13476
14697
  exports.resolveRequiredScopeFromApiDetails = resolveRequiredScopeFromApiDetails;
14698
+ exports.sessionApiModuleMetadata = sessionApiModuleMetadata;
13477
14699
  exports.setNestContextOnRequest = setNestContextOnRequest;
13478
14700
  exports.setNestContextOnScheduleRequest = setNestContextOnScheduleRequest;
13479
14701
  exports.taskQueueFunctionHandlerWithNestContextFactory = taskQueueFunctionHandlerWithNestContextFactory;