@dereekb/firebase-server 13.6.16 → 13.7.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 (40) hide show
  1. package/index.cjs.js +2615 -951
  2. package/index.esm.js +2598 -932
  3. package/mailgun/package.json +9 -9
  4. package/model/package.json +9 -9
  5. package/model/src/lib/storagefile/storagefile.action.server.d.ts +4 -13
  6. package/oidc/index.cjs.js +245 -180
  7. package/oidc/index.esm.js +242 -178
  8. package/oidc/package.json +10 -10
  9. package/oidc/src/lib/middleware/oauth-auth.module.d.ts +18 -25
  10. package/package.json +11 -10
  11. package/src/lib/function/error.d.ts +11 -28
  12. package/src/lib/nest/app.d.ts +4 -45
  13. package/src/lib/nest/app.module.d.ts +4 -2
  14. package/src/lib/nest/auth/auth.util.d.ts +71 -5
  15. package/src/lib/nest/controller/index.d.ts +1 -0
  16. package/src/lib/nest/controller/model/index.d.ts +4 -0
  17. package/src/lib/nest/controller/model/model.api.controller.d.ts +93 -0
  18. package/src/lib/nest/controller/model/model.api.dispatch.d.ts +73 -0
  19. package/src/lib/nest/controller/model/model.api.get.service.d.ts +73 -0
  20. package/src/lib/nest/controller/model/model.api.module.d.ts +32 -0
  21. package/src/lib/nest/model/analytics.handler.d.ts +2 -0
  22. package/src/lib/nest/model/api.details.d.ts +53 -1
  23. package/src/lib/nest/model/call.model.function.d.ts +8 -5
  24. package/src/lib/nest/model/create.model.function.d.ts +1 -1
  25. package/src/lib/nest/model/crud.assert.function.d.ts +1 -1
  26. package/src/lib/nest/model/delete.model.function.d.ts +1 -1
  27. package/src/lib/nest/model/index.d.ts +1 -0
  28. package/src/lib/nest/model/query.model.function.d.ts +207 -0
  29. package/src/lib/nest/model/read.model.function.d.ts +1 -1
  30. package/src/lib/nest/model/update.model.function.d.ts +1 -1
  31. package/src/lib/nest/nest.provider.d.ts +19 -0
  32. package/test/index.cjs.js +1358 -398
  33. package/test/index.esm.js +1355 -400
  34. package/test/package.json +13 -11
  35. package/test/src/lib/firebase/firebase.test.d.ts +1 -1
  36. package/test/src/lib/index.d.ts +1 -0
  37. package/test/src/lib/oidc/index.d.ts +2 -0
  38. package/test/src/lib/oidc/oidc.test.fixture.d.ts +126 -0
  39. package/test/src/lib/oidc/oidc.test.flow.d.ts +43 -0
  40. package/zoho/package.json +9 -9
package/test/index.cjs.js CHANGED
@@ -11,16 +11,19 @@ var firebaseServer = require('@dereekb/firebase-server');
11
11
  var firestore = require('@google-cloud/firestore');
12
12
  var storage = require('@google-cloud/storage');
13
13
  var testing = require('@nestjs/testing');
14
- var https = require('firebase-functions/v1/https');
14
+ var https = require('firebase-functions/https');
15
15
  var makeError = require('make-error');
16
+ var request = require('supertest');
17
+ var node_crypto = require('node:crypto');
18
+ var oidc = require('@dereekb/firebase-server/oidc');
16
19
 
17
- function _assert_this_initialized$8(self) {
20
+ function _assert_this_initialized$9(self) {
18
21
  if (self === void 0) {
19
22
  throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
20
23
  }
21
24
  return self;
22
25
  }
23
- function asyncGeneratorStep$8(gen, resolve, reject, _next, _throw, key, arg) {
26
+ function asyncGeneratorStep$a(gen, resolve, reject, _next, _throw, key, arg) {
24
27
  try {
25
28
  var info = gen[key](arg);
26
29
  var value = info.value;
@@ -34,31 +37,31 @@ function asyncGeneratorStep$8(gen, resolve, reject, _next, _throw, key, arg) {
34
37
  Promise.resolve(value).then(_next, _throw);
35
38
  }
36
39
  }
37
- function _async_to_generator$8(fn) {
40
+ function _async_to_generator$a(fn) {
38
41
  return function() {
39
42
  var self = this, args = arguments;
40
43
  return new Promise(function(resolve, reject) {
41
44
  var gen = fn.apply(self, args);
42
45
  function _next(value) {
43
- asyncGeneratorStep$8(gen, resolve, reject, _next, _throw, "next", value);
46
+ asyncGeneratorStep$a(gen, resolve, reject, _next, _throw, "next", value);
44
47
  }
45
48
  function _throw(err) {
46
- asyncGeneratorStep$8(gen, resolve, reject, _next, _throw, "throw", err);
49
+ asyncGeneratorStep$a(gen, resolve, reject, _next, _throw, "throw", err);
47
50
  }
48
51
  _next(undefined);
49
52
  });
50
53
  };
51
54
  }
52
- function _call_super$8(_this, derived, args) {
53
- derived = _get_prototype_of$8(derived);
54
- return _possible_constructor_return$8(_this, _is_native_reflect_construct$8() ? Reflect.construct(derived, args || [], _get_prototype_of$8(_this).constructor) : derived.apply(_this, args));
55
+ function _call_super$9(_this, derived, args) {
56
+ derived = _get_prototype_of$9(derived);
57
+ return _possible_constructor_return$9(_this, _is_native_reflect_construct$9() ? Reflect.construct(derived, args || [], _get_prototype_of$9(_this).constructor) : derived.apply(_this, args));
55
58
  }
56
- function _class_call_check$8(instance, Constructor) {
59
+ function _class_call_check$9(instance, Constructor) {
57
60
  if (!(instance instanceof Constructor)) {
58
61
  throw new TypeError("Cannot call a class as a function");
59
62
  }
60
63
  }
61
- function _defineProperties$5(target, props) {
64
+ function _defineProperties$6(target, props) {
62
65
  for(var i = 0; i < props.length; i++){
63
66
  var descriptor = props[i];
64
67
  descriptor.enumerable = descriptor.enumerable || false;
@@ -67,11 +70,11 @@ function _defineProperties$5(target, props) {
67
70
  Object.defineProperty(target, descriptor.key, descriptor);
68
71
  }
69
72
  }
70
- function _create_class$5(Constructor, protoProps, staticProps) {
71
- if (protoProps) _defineProperties$5(Constructor.prototype, protoProps);
73
+ function _create_class$6(Constructor, protoProps, staticProps) {
74
+ if (protoProps) _defineProperties$6(Constructor.prototype, protoProps);
72
75
  return Constructor;
73
76
  }
74
- function _define_property$7(obj, key, value) {
77
+ function _define_property$8(obj, key, value) {
75
78
  if (key in obj) {
76
79
  Object.defineProperty(obj, key, {
77
80
  value: value,
@@ -84,13 +87,13 @@ function _define_property$7(obj, key, value) {
84
87
  }
85
88
  return obj;
86
89
  }
87
- function _get_prototype_of$8(o) {
88
- _get_prototype_of$8 = Object.setPrototypeOf ? Object.getPrototypeOf : function getPrototypeOf(o) {
90
+ function _get_prototype_of$9(o) {
91
+ _get_prototype_of$9 = Object.setPrototypeOf ? Object.getPrototypeOf : function getPrototypeOf(o) {
89
92
  return o.__proto__ || Object.getPrototypeOf(o);
90
93
  };
91
- return _get_prototype_of$8(o);
94
+ return _get_prototype_of$9(o);
92
95
  }
93
- function _inherits$8(subClass, superClass) {
96
+ function _inherits$9(subClass, superClass) {
94
97
  if (typeof superClass !== "function" && superClass !== null) {
95
98
  throw new TypeError("Super expression must either be null or a function");
96
99
  }
@@ -101,9 +104,9 @@ function _inherits$8(subClass, superClass) {
101
104
  configurable: true
102
105
  }
103
106
  });
104
- if (superClass) _set_prototype_of$8(subClass, superClass);
107
+ if (superClass) _set_prototype_of$9(subClass, superClass);
105
108
  }
106
- function _object_spread$4(target) {
109
+ function _object_spread$5(target) {
107
110
  for(var i = 1; i < arguments.length; i++){
108
111
  var source = arguments[i] != null ? arguments[i] : {};
109
112
  var ownKeys = Object.keys(source);
@@ -113,12 +116,12 @@ function _object_spread$4(target) {
113
116
  }));
114
117
  }
115
118
  ownKeys.forEach(function(key) {
116
- _define_property$7(target, key, source[key]);
119
+ _define_property$8(target, key, source[key]);
117
120
  });
118
121
  }
119
122
  return target;
120
123
  }
121
- function ownKeys$2(object, enumerableOnly) {
124
+ function ownKeys$3(object, enumerableOnly) {
122
125
  var keys = Object.keys(object);
123
126
  if (Object.getOwnPropertySymbols) {
124
127
  var symbols = Object.getOwnPropertySymbols(object);
@@ -126,43 +129,43 @@ function ownKeys$2(object, enumerableOnly) {
126
129
  }
127
130
  return keys;
128
131
  }
129
- function _object_spread_props$2(target, source) {
132
+ function _object_spread_props$3(target, source) {
130
133
  source = source != null ? source : {};
131
134
  if (Object.getOwnPropertyDescriptors) {
132
135
  Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
133
136
  } else {
134
- ownKeys$2(Object(source)).forEach(function(key) {
137
+ ownKeys$3(Object(source)).forEach(function(key) {
135
138
  Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
136
139
  });
137
140
  }
138
141
  return target;
139
142
  }
140
- function _possible_constructor_return$8(self, call) {
141
- if (call && (_type_of$8(call) === "object" || typeof call === "function")) {
143
+ function _possible_constructor_return$9(self, call) {
144
+ if (call && (_type_of$9(call) === "object" || typeof call === "function")) {
142
145
  return call;
143
146
  }
144
- return _assert_this_initialized$8(self);
147
+ return _assert_this_initialized$9(self);
145
148
  }
146
- function _set_prototype_of$8(o, p) {
147
- _set_prototype_of$8 = Object.setPrototypeOf || function setPrototypeOf(o, p) {
149
+ function _set_prototype_of$9(o, p) {
150
+ _set_prototype_of$9 = Object.setPrototypeOf || function setPrototypeOf(o, p) {
148
151
  o.__proto__ = p;
149
152
  return o;
150
153
  };
151
- return _set_prototype_of$8(o, p);
154
+ return _set_prototype_of$9(o, p);
152
155
  }
153
- function _type_of$8(obj) {
156
+ function _type_of$9(obj) {
154
157
  "@swc/helpers - typeof";
155
158
  return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
156
159
  }
157
- function _is_native_reflect_construct$8() {
160
+ function _is_native_reflect_construct$9() {
158
161
  try {
159
162
  var result = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
160
163
  } catch (_) {}
161
- return (_is_native_reflect_construct$8 = function() {
164
+ return (_is_native_reflect_construct$9 = function() {
162
165
  return !!result;
163
166
  })();
164
167
  }
165
- function _ts_generator$8(thisArg, body) {
168
+ function _ts_generator$a(thisArg, body) {
166
169
  var f, y, t, _ = {
167
170
  label: 0,
168
171
  sent: function() {
@@ -268,12 +271,12 @@ function _ts_generator$8(thisArg, body) {
268
271
  * Manages the lifecycle of the authorized user test context within the Jest test fixture hierarchy.
269
272
  * Use this as the primary handle in test suites; it is created automatically by {@link authorizedUserContextFactory}.
270
273
  */ var AuthorizedUserTestContextFixture = /*#__PURE__*/ function(AbstractChildTestContextFixture) {
271
- _inherits$8(AuthorizedUserTestContextFixture, AbstractChildTestContextFixture);
274
+ _inherits$9(AuthorizedUserTestContextFixture, AbstractChildTestContextFixture);
272
275
  function AuthorizedUserTestContextFixture() {
273
- _class_call_check$8(this, AuthorizedUserTestContextFixture);
274
- return _call_super$8(this, AuthorizedUserTestContextFixture, arguments);
276
+ _class_call_check$9(this, AuthorizedUserTestContextFixture);
277
+ return _call_super$9(this, AuthorizedUserTestContextFixture, arguments);
275
278
  }
276
- _create_class$5(AuthorizedUserTestContextFixture, [
279
+ _create_class$6(AuthorizedUserTestContextFixture, [
277
280
  {
278
281
  key: "uid",
279
282
  get: // MARK: AuthorizedUserTestContext (Forwarded)
@@ -350,13 +353,13 @@ function _ts_generator$8(thisArg, body) {
350
353
  * through the {@link AuthorizedUserTestContextFixture} wrapper.
351
354
  */ var AuthorizedUserTestContextInstance = /*#__PURE__*/ function() {
352
355
  function AuthorizedUserTestContextInstance(uid, testContext) {
353
- _class_call_check$8(this, AuthorizedUserTestContextInstance);
354
- _define_property$7(this, "uid", void 0);
355
- _define_property$7(this, "testContext", void 0);
356
+ _class_call_check$9(this, AuthorizedUserTestContextInstance);
357
+ _define_property$8(this, "uid", void 0);
358
+ _define_property$8(this, "testContext", void 0);
356
359
  this.uid = uid;
357
360
  this.testContext = testContext;
358
361
  }
359
- _create_class$5(AuthorizedUserTestContextInstance, [
362
+ _create_class$6(AuthorizedUserTestContextInstance, [
360
363
  {
361
364
  key: "loadUserRecord",
362
365
  value: function loadUserRecord() {
@@ -366,9 +369,9 @@ function _ts_generator$8(thisArg, body) {
366
369
  {
367
370
  key: "loadUserEmailAndPhone",
368
371
  value: function loadUserEmailAndPhone() {
369
- return _async_to_generator$8(function() {
372
+ return _async_to_generator$a(function() {
370
373
  var record;
371
- return _ts_generator$8(this, function(_state) {
374
+ return _ts_generator$a(this, function(_state) {
372
375
  switch(_state.label){
373
376
  case 0:
374
377
  return [
@@ -456,7 +459,7 @@ function _ts_generator$8(thisArg, body) {
456
459
  value: function callAuthBlockingFunction(fn, userRecord, eventType, eventOverride) {
457
460
  var skipJsonConversion = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : false;
458
461
  var timestamp = new Date().toISOString();
459
- var event = _object_spread_props$2(_object_spread$4({
462
+ var event = _object_spread_props$3(_object_spread$5({
460
463
  ipAddress: '127.0.0.1',
461
464
  userAgent: 'testing',
462
465
  eventId: '0',
@@ -487,7 +490,7 @@ function _ts_generator$8(thisArg, body) {
487
490
  var skipJsonConversion = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : false;
488
491
  var parsedParams = params == null || skipJsonConversion ? params : convertParamsToParsedJsonObjectAndBack(params);
489
492
  return this.makeContextOptions().then(function(options) {
490
- return fn(parsedParams, contextOptions ? _object_spread$4({}, contextOptions, options) : options);
493
+ return fn(parsedParams, contextOptions ? _object_spread$5({}, contextOptions, options) : options);
491
494
  });
492
495
  }
493
496
  }
@@ -533,9 +536,9 @@ function _ts_generator$8(thisArg, body) {
533
536
  fixture: makeFixture(f),
534
537
  buildTests: buildTests,
535
538
  initInstance: function initInstance() {
536
- return _async_to_generator$8(function() {
539
+ return _async_to_generator$a(function() {
537
540
  var inputAddContactInfo, inputUser, inputTemplate, uid, _$_object_spread, details, claims, userDetailsAddContactInfo, _ref, detailsPhoneNumber, detailsEmail, addContactInfo, auth, email, phoneNumber, userRecord, instance;
538
- return _ts_generator$8(this, function(_state) {
541
+ return _ts_generator$a(this, function(_state) {
539
542
  switch(_state.label){
540
543
  case 0:
541
544
  return [
@@ -557,7 +560,7 @@ function _ts_generator$8(thisArg, body) {
557
560
  case 3:
558
561
  inputTemplate = _state.sent();
559
562
  uid = (inputUser === null || inputUser === void 0 ? void 0 : inputUser.uid) || makeUid();
560
- _$_object_spread = _object_spread$4({}, makeUserDetails(uid, params), inputTemplate), details = _$_object_spread.details, claims = _$_object_spread.claims, userDetailsAddContactInfo = _$_object_spread.addContactInfo;
563
+ _$_object_spread = _object_spread$5({}, makeUserDetails(uid, params), inputTemplate), details = _$_object_spread.details, claims = _$_object_spread.claims, userDetailsAddContactInfo = _$_object_spread.addContactInfo;
561
564
  _ref = details !== null && details !== void 0 ? details : {}, detailsPhoneNumber = _ref.phoneNumber, detailsEmail = _ref.email; // keep details if provided
562
565
  addContactInfo = inputAddContactInfo || userDetailsAddContactInfo;
563
566
  auth = f.instance.auth;
@@ -570,7 +573,7 @@ function _ts_generator$8(thisArg, body) {
570
573
  }
571
574
  return [
572
575
  4,
573
- auth.createUser(_object_spread$4(_object_spread_props$2(_object_spread$4({
576
+ auth.createUser(_object_spread$5(_object_spread_props$3(_object_spread$5({
574
577
  uid: uid,
575
578
  displayName: 'Test Person'
576
579
  }, details), {
@@ -619,11 +622,17 @@ function _ts_generator$8(thisArg, body) {
619
622
  })();
620
623
  },
621
624
  destroyInstance: function destroyInstance(instance) {
622
- return _async_to_generator$8(function() {
623
- var app, uid;
624
- return _ts_generator$8(this, function(_state) {
625
+ return _async_to_generator$a(function() {
626
+ var app, uid, e;
627
+ return _ts_generator$a(this, function(_state) {
625
628
  switch(_state.label){
626
629
  case 0:
630
+ _state.trys.push([
631
+ 0,
632
+ 2,
633
+ ,
634
+ 3
635
+ ]);
627
636
  app = instance.testContext.app;
628
637
  uid = instance.uid;
629
638
  return [
@@ -632,6 +641,19 @@ function _ts_generator$8(thisArg, body) {
632
641
  ];
633
642
  case 1:
634
643
  _state.sent();
644
+ return [
645
+ 3,
646
+ 3
647
+ ];
648
+ case 2:
649
+ e = _state.sent();
650
+ // Ignore teardown errors (e.g., app already deleted during stale Vitest reload)
651
+ console.warn("authorizedUserContextFactory(): Failed to destroy user ".concat(instance.uid), e);
652
+ return [
653
+ 3,
654
+ 3
655
+ ];
656
+ case 3:
635
657
  return [
636
658
  2
637
659
  ];
@@ -656,9 +678,9 @@ function _ts_generator$8(thisArg, body) {
656
678
  * @param userRecord
657
679
  * @returns
658
680
  */ function createTestFunctionContextOptions(auth, userRecord) {
659
- return _async_to_generator$8(function() {
681
+ return _async_to_generator$a(function() {
660
682
  var authData, contextOptions;
661
- return _ts_generator$8(this, function(_state) {
683
+ return _ts_generator$a(this, function(_state) {
662
684
  switch(_state.label){
663
685
  case 0:
664
686
  return [
@@ -685,9 +707,9 @@ function _ts_generator$8(thisArg, body) {
685
707
  * @param userRecord
686
708
  * @returns
687
709
  */ function createTestFunctionContextAuthData(auth, userRecord) {
688
- return _async_to_generator$8(function() {
710
+ return _async_to_generator$a(function() {
689
711
  var token, authData;
690
- return _ts_generator$8(this, function(_state) {
712
+ return _ts_generator$a(this, function(_state) {
691
713
  switch(_state.label){
692
714
  case 0:
693
715
  return [
@@ -740,7 +762,7 @@ function _ts_generator$8(thisArg, body) {
740
762
  var _ref;
741
763
  var _decoded_claims;
742
764
  var decoded = jsonwebtoken.decode(token);
743
- var decodedToken = _object_spread_props$2(_object_spread$4({}, decoded, decoded.claims), {
765
+ var decodedToken = _object_spread_props$3(_object_spread$5({}, decoded, decoded.claims), {
744
766
  auth_time: decoded.iat,
745
767
  firebase: (_ref = (_decoded_claims = decoded.claims) === null || _decoded_claims === void 0 ? void 0 : _decoded_claims.firebase) !== null && _ref !== void 0 ? _ref : {}
746
768
  });
@@ -768,17 +790,17 @@ function _ts_generator$8(thisArg, body) {
768
790
  }
769
791
  };
770
792
  var customClaims = userRecord.customClaims;
771
- var claims = _object_spread$4({}, customClaims, baseClaims);
793
+ var claims = _object_spread$5({}, customClaims, baseClaims);
772
794
  return claims;
773
795
  }
774
796
 
775
- function _assert_this_initialized$7(self) {
797
+ function _assert_this_initialized$8(self) {
776
798
  if (self === void 0) {
777
799
  throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
778
800
  }
779
801
  return self;
780
802
  }
781
- function asyncGeneratorStep$7(gen, resolve, reject, _next, _throw, key, arg) {
803
+ function asyncGeneratorStep$9(gen, resolve, reject, _next, _throw, key, arg) {
782
804
  try {
783
805
  var info = gen[key](arg);
784
806
  var value = info.value;
@@ -792,31 +814,31 @@ function asyncGeneratorStep$7(gen, resolve, reject, _next, _throw, key, arg) {
792
814
  Promise.resolve(value).then(_next, _throw);
793
815
  }
794
816
  }
795
- function _async_to_generator$7(fn) {
817
+ function _async_to_generator$9(fn) {
796
818
  return function() {
797
819
  var self = this, args = arguments;
798
820
  return new Promise(function(resolve, reject) {
799
821
  var gen = fn.apply(self, args);
800
822
  function _next(value) {
801
- asyncGeneratorStep$7(gen, resolve, reject, _next, _throw, "next", value);
823
+ asyncGeneratorStep$9(gen, resolve, reject, _next, _throw, "next", value);
802
824
  }
803
825
  function _throw(err) {
804
- asyncGeneratorStep$7(gen, resolve, reject, _next, _throw, "throw", err);
826
+ asyncGeneratorStep$9(gen, resolve, reject, _next, _throw, "throw", err);
805
827
  }
806
828
  _next(undefined);
807
829
  });
808
830
  };
809
831
  }
810
- function _call_super$7(_this, derived, args) {
811
- derived = _get_prototype_of$7(derived);
812
- return _possible_constructor_return$7(_this, _is_native_reflect_construct$7() ? Reflect.construct(derived, args || [], _get_prototype_of$7(_this).constructor) : derived.apply(_this, args));
832
+ function _call_super$8(_this, derived, args) {
833
+ derived = _get_prototype_of$8(derived);
834
+ return _possible_constructor_return$8(_this, _is_native_reflect_construct$8() ? Reflect.construct(derived, args || [], _get_prototype_of$8(_this).constructor) : derived.apply(_this, args));
813
835
  }
814
- function _class_call_check$7(instance, Constructor) {
836
+ function _class_call_check$8(instance, Constructor) {
815
837
  if (!(instance instanceof Constructor)) {
816
838
  throw new TypeError("Cannot call a class as a function");
817
839
  }
818
840
  }
819
- function _defineProperties$4(target, props) {
841
+ function _defineProperties$5(target, props) {
820
842
  for(var i = 0; i < props.length; i++){
821
843
  var descriptor = props[i];
822
844
  descriptor.enumerable = descriptor.enumerable || false;
@@ -825,11 +847,11 @@ function _defineProperties$4(target, props) {
825
847
  Object.defineProperty(target, descriptor.key, descriptor);
826
848
  }
827
849
  }
828
- function _create_class$4(Constructor, protoProps, staticProps) {
829
- if (protoProps) _defineProperties$4(Constructor.prototype, protoProps);
850
+ function _create_class$5(Constructor, protoProps, staticProps) {
851
+ if (protoProps) _defineProperties$5(Constructor.prototype, protoProps);
830
852
  return Constructor;
831
853
  }
832
- function _define_property$6(obj, key, value) {
854
+ function _define_property$7(obj, key, value) {
833
855
  if (key in obj) {
834
856
  Object.defineProperty(obj, key, {
835
857
  value: value,
@@ -842,13 +864,13 @@ function _define_property$6(obj, key, value) {
842
864
  }
843
865
  return obj;
844
866
  }
845
- function _get_prototype_of$7(o) {
846
- _get_prototype_of$7 = Object.setPrototypeOf ? Object.getPrototypeOf : function getPrototypeOf(o) {
867
+ function _get_prototype_of$8(o) {
868
+ _get_prototype_of$8 = Object.setPrototypeOf ? Object.getPrototypeOf : function getPrototypeOf(o) {
847
869
  return o.__proto__ || Object.getPrototypeOf(o);
848
870
  };
849
- return _get_prototype_of$7(o);
871
+ return _get_prototype_of$8(o);
850
872
  }
851
- function _inherits$7(subClass, superClass) {
873
+ function _inherits$8(subClass, superClass) {
852
874
  if (typeof superClass !== "function" && superClass !== null) {
853
875
  throw new TypeError("Super expression must either be null or a function");
854
876
  }
@@ -859,34 +881,34 @@ function _inherits$7(subClass, superClass) {
859
881
  configurable: true
860
882
  }
861
883
  });
862
- if (superClass) _set_prototype_of$7(subClass, superClass);
884
+ if (superClass) _set_prototype_of$8(subClass, superClass);
863
885
  }
864
- function _possible_constructor_return$7(self, call) {
865
- if (call && (_type_of$7(call) === "object" || typeof call === "function")) {
886
+ function _possible_constructor_return$8(self, call) {
887
+ if (call && (_type_of$8(call) === "object" || typeof call === "function")) {
866
888
  return call;
867
889
  }
868
- return _assert_this_initialized$7(self);
890
+ return _assert_this_initialized$8(self);
869
891
  }
870
- function _set_prototype_of$7(o, p) {
871
- _set_prototype_of$7 = Object.setPrototypeOf || function setPrototypeOf(o, p) {
892
+ function _set_prototype_of$8(o, p) {
893
+ _set_prototype_of$8 = Object.setPrototypeOf || function setPrototypeOf(o, p) {
872
894
  o.__proto__ = p;
873
895
  return o;
874
896
  };
875
- return _set_prototype_of$7(o, p);
897
+ return _set_prototype_of$8(o, p);
876
898
  }
877
- function _type_of$7(obj) {
899
+ function _type_of$8(obj) {
878
900
  "@swc/helpers - typeof";
879
901
  return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
880
902
  }
881
- function _is_native_reflect_construct$7() {
903
+ function _is_native_reflect_construct$8() {
882
904
  try {
883
905
  var result = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
884
906
  } catch (_) {}
885
- return (_is_native_reflect_construct$7 = function() {
907
+ return (_is_native_reflect_construct$8 = function() {
886
908
  return !!result;
887
909
  })();
888
910
  }
889
- function _ts_generator$7(thisArg, body) {
911
+ function _ts_generator$9(thisArg, body) {
890
912
  var f, y, t, _ = {
891
913
  label: 0,
892
914
  sent: function() {
@@ -992,12 +1014,12 @@ function _ts_generator$7(thisArg, body) {
992
1014
  * Manages the lifecycle of the model test context within the Jest test fixture hierarchy.
993
1015
  * Use this as the primary handle in test suites; it is created automatically by {@link modelTestContextFactory}.
994
1016
  */ var ModelTestContextFixture = /*#__PURE__*/ function(AbstractChildTestContextFixture) {
995
- _inherits$7(ModelTestContextFixture, AbstractChildTestContextFixture);
1017
+ _inherits$8(ModelTestContextFixture, AbstractChildTestContextFixture);
996
1018
  function ModelTestContextFixture() {
997
- _class_call_check$7(this, ModelTestContextFixture);
998
- return _call_super$7(this, ModelTestContextFixture, arguments);
1019
+ _class_call_check$8(this, ModelTestContextFixture);
1020
+ return _call_super$8(this, ModelTestContextFixture, arguments);
999
1021
  }
1000
- _create_class$4(ModelTestContextFixture, [
1022
+ _create_class$5(ModelTestContextFixture, [
1001
1023
  {
1002
1024
  key: "documentId",
1003
1025
  get: // MARK: ModelTestContext (Forwarded)
@@ -1049,15 +1071,15 @@ function _ts_generator$7(thisArg, body) {
1049
1071
  * through the {@link ModelTestContextFixture} wrapper.
1050
1072
  */ var ModelTestContextInstance = /*#__PURE__*/ function() {
1051
1073
  function ModelTestContextInstance(collection, ref, testContext) {
1052
- _class_call_check$7(this, ModelTestContextInstance);
1053
- _define_property$6(this, "collection", void 0);
1054
- _define_property$6(this, "ref", void 0);
1055
- _define_property$6(this, "testContext", void 0);
1074
+ _class_call_check$8(this, ModelTestContextInstance);
1075
+ _define_property$7(this, "collection", void 0);
1076
+ _define_property$7(this, "ref", void 0);
1077
+ _define_property$7(this, "testContext", void 0);
1056
1078
  this.collection = collection;
1057
1079
  this.ref = ref;
1058
1080
  this.testContext = testContext;
1059
1081
  }
1060
- _create_class$4(ModelTestContextInstance, [
1082
+ _create_class$5(ModelTestContextInstance, [
1061
1083
  {
1062
1084
  key: "documentId",
1063
1085
  get: function get() {
@@ -1124,9 +1146,9 @@ function _ts_generator$7(thisArg, body) {
1124
1146
  fixture: makeFixture(f),
1125
1147
  buildTests: buildTests,
1126
1148
  initInstance: function initInstance() {
1127
- return _async_to_generator$7(function() {
1149
+ return _async_to_generator$9(function() {
1128
1150
  var parentInstance, ref, collection, init, doc, expectedCollectionName, instance;
1129
- return _ts_generator$7(this, function(_state) {
1151
+ return _ts_generator$9(this, function(_state) {
1130
1152
  switch(_state.label){
1131
1153
  case 0:
1132
1154
  parentInstance = f.instance;
@@ -1293,13 +1315,13 @@ var adminEnvironmentInitialized = false;
1293
1315
  adminEnvironmentInitialized = true;
1294
1316
  }
1295
1317
 
1296
- function _assert_this_initialized$6(self) {
1318
+ function _assert_this_initialized$7(self) {
1297
1319
  if (self === void 0) {
1298
1320
  throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
1299
1321
  }
1300
1322
  return self;
1301
1323
  }
1302
- function asyncGeneratorStep$6(gen, resolve, reject, _next, _throw, key, arg) {
1324
+ function asyncGeneratorStep$8(gen, resolve, reject, _next, _throw, key, arg) {
1303
1325
  try {
1304
1326
  var info = gen[key](arg);
1305
1327
  var value = info.value;
@@ -1313,37 +1335,37 @@ function asyncGeneratorStep$6(gen, resolve, reject, _next, _throw, key, arg) {
1313
1335
  Promise.resolve(value).then(_next, _throw);
1314
1336
  }
1315
1337
  }
1316
- function _async_to_generator$6(fn) {
1338
+ function _async_to_generator$8(fn) {
1317
1339
  return function() {
1318
1340
  var self = this, args = arguments;
1319
1341
  return new Promise(function(resolve, reject) {
1320
1342
  var gen = fn.apply(self, args);
1321
1343
  function _next(value) {
1322
- asyncGeneratorStep$6(gen, resolve, reject, _next, _throw, "next", value);
1344
+ asyncGeneratorStep$8(gen, resolve, reject, _next, _throw, "next", value);
1323
1345
  }
1324
1346
  function _throw(err) {
1325
- asyncGeneratorStep$6(gen, resolve, reject, _next, _throw, "throw", err);
1347
+ asyncGeneratorStep$8(gen, resolve, reject, _next, _throw, "throw", err);
1326
1348
  }
1327
1349
  _next(undefined);
1328
1350
  });
1329
1351
  };
1330
1352
  }
1331
- function _call_super$6(_this, derived, args) {
1332
- derived = _get_prototype_of$6(derived);
1333
- return _possible_constructor_return$6(_this, _is_native_reflect_construct$6() ? Reflect.construct(derived, args || [], _get_prototype_of$6(_this).constructor) : derived.apply(_this, args));
1353
+ function _call_super$7(_this, derived, args) {
1354
+ derived = _get_prototype_of$7(derived);
1355
+ return _possible_constructor_return$7(_this, _is_native_reflect_construct$7() ? Reflect.construct(derived, args || [], _get_prototype_of$7(_this).constructor) : derived.apply(_this, args));
1334
1356
  }
1335
- function _class_call_check$6(instance, Constructor) {
1357
+ function _class_call_check$7(instance, Constructor) {
1336
1358
  if (!(instance instanceof Constructor)) {
1337
1359
  throw new TypeError("Cannot call a class as a function");
1338
1360
  }
1339
1361
  }
1340
- function _get_prototype_of$6(o) {
1341
- _get_prototype_of$6 = Object.setPrototypeOf ? Object.getPrototypeOf : function getPrototypeOf(o) {
1362
+ function _get_prototype_of$7(o) {
1363
+ _get_prototype_of$7 = Object.setPrototypeOf ? Object.getPrototypeOf : function getPrototypeOf(o) {
1342
1364
  return o.__proto__ || Object.getPrototypeOf(o);
1343
1365
  };
1344
- return _get_prototype_of$6(o);
1366
+ return _get_prototype_of$7(o);
1345
1367
  }
1346
- function _inherits$6(subClass, superClass) {
1368
+ function _inherits$7(subClass, superClass) {
1347
1369
  if (typeof superClass !== "function" && superClass !== null) {
1348
1370
  throw new TypeError("Super expression must either be null or a function");
1349
1371
  }
@@ -1354,34 +1376,34 @@ function _inherits$6(subClass, superClass) {
1354
1376
  configurable: true
1355
1377
  }
1356
1378
  });
1357
- if (superClass) _set_prototype_of$6(subClass, superClass);
1379
+ if (superClass) _set_prototype_of$7(subClass, superClass);
1358
1380
  }
1359
- function _possible_constructor_return$6(self, call) {
1360
- if (call && (_type_of$6(call) === "object" || typeof call === "function")) {
1381
+ function _possible_constructor_return$7(self, call) {
1382
+ if (call && (_type_of$7(call) === "object" || typeof call === "function")) {
1361
1383
  return call;
1362
1384
  }
1363
- return _assert_this_initialized$6(self);
1385
+ return _assert_this_initialized$7(self);
1364
1386
  }
1365
- function _set_prototype_of$6(o, p) {
1366
- _set_prototype_of$6 = Object.setPrototypeOf || function setPrototypeOf(o, p) {
1387
+ function _set_prototype_of$7(o, p) {
1388
+ _set_prototype_of$7 = Object.setPrototypeOf || function setPrototypeOf(o, p) {
1367
1389
  o.__proto__ = p;
1368
1390
  return o;
1369
1391
  };
1370
- return _set_prototype_of$6(o, p);
1392
+ return _set_prototype_of$7(o, p);
1371
1393
  }
1372
- function _type_of$6(obj) {
1394
+ function _type_of$7(obj) {
1373
1395
  "@swc/helpers - typeof";
1374
1396
  return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
1375
1397
  }
1376
- function _is_native_reflect_construct$6() {
1398
+ function _is_native_reflect_construct$7() {
1377
1399
  try {
1378
1400
  var result = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
1379
1401
  } catch (_) {}
1380
- return (_is_native_reflect_construct$6 = function() {
1402
+ return (_is_native_reflect_construct$7 = function() {
1381
1403
  return !!result;
1382
1404
  })();
1383
1405
  }
1384
- function _ts_generator$6(thisArg, body) {
1406
+ function _ts_generator$8(thisArg, body) {
1385
1407
  var f, y, t, _ = {
1386
1408
  label: 0,
1387
1409
  sent: function() {
@@ -1500,10 +1522,10 @@ function _ts_generator$6(thisArg, body) {
1500
1522
  * Each instance is constructed with its own {@link Firestore} instance and testing drivers,
1501
1523
  * providing an isolated Firestore context for a single test run.
1502
1524
  */ var GoogleCloudTestFirestoreInstance = /*#__PURE__*/ function(TestFirestoreInstance) {
1503
- _inherits$6(GoogleCloudTestFirestoreInstance, TestFirestoreInstance);
1525
+ _inherits$7(GoogleCloudTestFirestoreInstance, TestFirestoreInstance);
1504
1526
  function GoogleCloudTestFirestoreInstance(drivers, firestore) {
1505
- _class_call_check$6(this, GoogleCloudTestFirestoreInstance);
1506
- return _call_super$6(this, GoogleCloudTestFirestoreInstance, [
1527
+ _class_call_check$7(this, GoogleCloudTestFirestoreInstance);
1528
+ return _call_super$7(this, GoogleCloudTestFirestoreInstance, [
1507
1529
  makeGoogleFirestoreContext(drivers, firestore)
1508
1530
  ]);
1509
1531
  }
@@ -1515,10 +1537,10 @@ function _ts_generator$6(thisArg, body) {
1515
1537
  * Manages the lifecycle of a {@link GoogleCloudTestFirestoreInstance}, setting it up
1516
1538
  * before each test and tearing it down afterward via the {@link testContextBuilder} infrastructure.
1517
1539
  */ var GoogleCloudTestFirestoreContextFixture = /*#__PURE__*/ function(TestFirestoreContextFixture) {
1518
- _inherits$6(GoogleCloudTestFirestoreContextFixture, TestFirestoreContextFixture);
1540
+ _inherits$7(GoogleCloudTestFirestoreContextFixture, TestFirestoreContextFixture);
1519
1541
  function GoogleCloudTestFirestoreContextFixture() {
1520
- _class_call_check$6(this, GoogleCloudTestFirestoreContextFixture);
1521
- return _call_super$6(this, GoogleCloudTestFirestoreContextFixture, arguments);
1542
+ _class_call_check$7(this, GoogleCloudTestFirestoreContextFixture);
1543
+ return _call_super$7(this, GoogleCloudTestFirestoreContextFixture, arguments);
1522
1544
  }
1523
1545
  return GoogleCloudTestFirestoreContextFixture;
1524
1546
  }(test$1.TestFirestoreContextFixture);
@@ -1542,9 +1564,9 @@ var COUNTER$1 = 0;
1542
1564
  return new GoogleCloudTestFirestoreContextFixture();
1543
1565
  },
1544
1566
  setupInstance: function setupInstance(config) {
1545
- return _async_to_generator$6(function() {
1567
+ return _async_to_generator$8(function() {
1546
1568
  var random, drivers, projectId, firestore$1;
1547
- return _ts_generator$6(this, function(_state) {
1569
+ return _ts_generator$8(this, function(_state) {
1548
1570
  random = Math.floor(Math.random() * 10000);
1549
1571
  drivers = test$1.makeTestingFirestoreDrivers(firebaseServer.googleCloudFirestoreDrivers());
1550
1572
  projectId = "test-".concat(COUNTER$1++, "-").concat(Date.now(), "-").concat(random).substring(0, 30);
@@ -1562,8 +1584,8 @@ var COUNTER$1 = 0;
1562
1584
  })();
1563
1585
  },
1564
1586
  teardownInstance: function teardownInstance(instance, config) {
1565
- return _async_to_generator$6(function() {
1566
- return _ts_generator$6(this, function(_state) {
1587
+ return _async_to_generator$8(function() {
1588
+ return _ts_generator$8(this, function(_state) {
1567
1589
  switch(_state.label){
1568
1590
  case 0:
1569
1591
  return [
@@ -1581,13 +1603,13 @@ var COUNTER$1 = 0;
1581
1603
  }
1582
1604
  });
1583
1605
 
1584
- function _assert_this_initialized$5(self) {
1606
+ function _assert_this_initialized$6(self) {
1585
1607
  if (self === void 0) {
1586
1608
  throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
1587
1609
  }
1588
1610
  return self;
1589
1611
  }
1590
- function asyncGeneratorStep$5(gen, resolve, reject, _next, _throw, key, arg) {
1612
+ function asyncGeneratorStep$7(gen, resolve, reject, _next, _throw, key, arg) {
1591
1613
  try {
1592
1614
  var info = gen[key](arg);
1593
1615
  var value = info.value;
@@ -1601,37 +1623,37 @@ function asyncGeneratorStep$5(gen, resolve, reject, _next, _throw, key, arg) {
1601
1623
  Promise.resolve(value).then(_next, _throw);
1602
1624
  }
1603
1625
  }
1604
- function _async_to_generator$5(fn) {
1626
+ function _async_to_generator$7(fn) {
1605
1627
  return function() {
1606
1628
  var self = this, args = arguments;
1607
1629
  return new Promise(function(resolve, reject) {
1608
1630
  var gen = fn.apply(self, args);
1609
1631
  function _next(value) {
1610
- asyncGeneratorStep$5(gen, resolve, reject, _next, _throw, "next", value);
1632
+ asyncGeneratorStep$7(gen, resolve, reject, _next, _throw, "next", value);
1611
1633
  }
1612
1634
  function _throw(err) {
1613
- asyncGeneratorStep$5(gen, resolve, reject, _next, _throw, "throw", err);
1635
+ asyncGeneratorStep$7(gen, resolve, reject, _next, _throw, "throw", err);
1614
1636
  }
1615
1637
  _next(undefined);
1616
1638
  });
1617
1639
  };
1618
1640
  }
1619
- function _call_super$5(_this, derived, args) {
1620
- derived = _get_prototype_of$5(derived);
1621
- 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));
1641
+ function _call_super$6(_this, derived, args) {
1642
+ derived = _get_prototype_of$6(derived);
1643
+ return _possible_constructor_return$6(_this, _is_native_reflect_construct$6() ? Reflect.construct(derived, args || [], _get_prototype_of$6(_this).constructor) : derived.apply(_this, args));
1622
1644
  }
1623
- function _class_call_check$5(instance, Constructor) {
1645
+ function _class_call_check$6(instance, Constructor) {
1624
1646
  if (!(instance instanceof Constructor)) {
1625
1647
  throw new TypeError("Cannot call a class as a function");
1626
1648
  }
1627
1649
  }
1628
- function _get_prototype_of$5(o) {
1629
- _get_prototype_of$5 = Object.setPrototypeOf ? Object.getPrototypeOf : function getPrototypeOf(o) {
1650
+ function _get_prototype_of$6(o) {
1651
+ _get_prototype_of$6 = Object.setPrototypeOf ? Object.getPrototypeOf : function getPrototypeOf(o) {
1630
1652
  return o.__proto__ || Object.getPrototypeOf(o);
1631
1653
  };
1632
- return _get_prototype_of$5(o);
1654
+ return _get_prototype_of$6(o);
1633
1655
  }
1634
- function _inherits$5(subClass, superClass) {
1656
+ function _inherits$6(subClass, superClass) {
1635
1657
  if (typeof superClass !== "function" && superClass !== null) {
1636
1658
  throw new TypeError("Super expression must either be null or a function");
1637
1659
  }
@@ -1642,34 +1664,34 @@ function _inherits$5(subClass, superClass) {
1642
1664
  configurable: true
1643
1665
  }
1644
1666
  });
1645
- if (superClass) _set_prototype_of$5(subClass, superClass);
1667
+ if (superClass) _set_prototype_of$6(subClass, superClass);
1646
1668
  }
1647
- function _possible_constructor_return$5(self, call) {
1648
- if (call && (_type_of$5(call) === "object" || typeof call === "function")) {
1669
+ function _possible_constructor_return$6(self, call) {
1670
+ if (call && (_type_of$6(call) === "object" || typeof call === "function")) {
1649
1671
  return call;
1650
1672
  }
1651
- return _assert_this_initialized$5(self);
1673
+ return _assert_this_initialized$6(self);
1652
1674
  }
1653
- function _set_prototype_of$5(o, p) {
1654
- _set_prototype_of$5 = Object.setPrototypeOf || function setPrototypeOf(o, p) {
1675
+ function _set_prototype_of$6(o, p) {
1676
+ _set_prototype_of$6 = Object.setPrototypeOf || function setPrototypeOf(o, p) {
1655
1677
  o.__proto__ = p;
1656
1678
  return o;
1657
1679
  };
1658
- return _set_prototype_of$5(o, p);
1680
+ return _set_prototype_of$6(o, p);
1659
1681
  }
1660
- function _type_of$5(obj) {
1682
+ function _type_of$6(obj) {
1661
1683
  "@swc/helpers - typeof";
1662
1684
  return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
1663
1685
  }
1664
- function _is_native_reflect_construct$5() {
1686
+ function _is_native_reflect_construct$6() {
1665
1687
  try {
1666
1688
  var result = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
1667
1689
  } catch (_) {}
1668
- return (_is_native_reflect_construct$5 = function() {
1690
+ return (_is_native_reflect_construct$6 = function() {
1669
1691
  return !!result;
1670
1692
  })();
1671
1693
  }
1672
- function _ts_generator$5(thisArg, body) {
1694
+ function _ts_generator$7(thisArg, body) {
1673
1695
  var f, y, t, _ = {
1674
1696
  label: 0,
1675
1697
  sent: function() {
@@ -1790,10 +1812,10 @@ function _ts_generator$5(thisArg, body) {
1790
1812
  * Each instance is constructed with its own Storage instance, testing drivers, and optional
1791
1813
  * default bucket ID, providing an isolated storage context for a single test run.
1792
1814
  */ var GoogleCloudTestFirebaseStorageInstance = /*#__PURE__*/ function(TestFirebaseStorageInstance) {
1793
- _inherits$5(GoogleCloudTestFirebaseStorageInstance, TestFirebaseStorageInstance);
1815
+ _inherits$6(GoogleCloudTestFirebaseStorageInstance, TestFirebaseStorageInstance);
1794
1816
  function GoogleCloudTestFirebaseStorageInstance(drivers, firebaseStorage, defaultBucketId) {
1795
- _class_call_check$5(this, GoogleCloudTestFirebaseStorageInstance);
1796
- return _call_super$5(this, GoogleCloudTestFirebaseStorageInstance, [
1817
+ _class_call_check$6(this, GoogleCloudTestFirebaseStorageInstance);
1818
+ return _call_super$6(this, GoogleCloudTestFirebaseStorageInstance, [
1797
1819
  makeGoogleFirebaseStorageContext(drivers, firebaseStorage, defaultBucketId)
1798
1820
  ]);
1799
1821
  }
@@ -1805,10 +1827,10 @@ function _ts_generator$5(thisArg, body) {
1805
1827
  * Manages the lifecycle of a {@link GoogleCloudTestFirebaseStorageInstance}, setting it up
1806
1828
  * before each test and tearing it down afterward via the {@link testContextBuilder} infrastructure.
1807
1829
  */ var GoogleCloudTestFirebaseStorageContextFixture = /*#__PURE__*/ function(TestFirebaseStorageContextFixture) {
1808
- _inherits$5(GoogleCloudTestFirebaseStorageContextFixture, TestFirebaseStorageContextFixture);
1830
+ _inherits$6(GoogleCloudTestFirebaseStorageContextFixture, TestFirebaseStorageContextFixture);
1809
1831
  function GoogleCloudTestFirebaseStorageContextFixture() {
1810
- _class_call_check$5(this, GoogleCloudTestFirebaseStorageContextFixture);
1811
- return _call_super$5(this, GoogleCloudTestFirebaseStorageContextFixture, arguments);
1832
+ _class_call_check$6(this, GoogleCloudTestFirebaseStorageContextFixture);
1833
+ return _call_super$6(this, GoogleCloudTestFirebaseStorageContextFixture, arguments);
1812
1834
  }
1813
1835
  return GoogleCloudTestFirebaseStorageContextFixture;
1814
1836
  }(test$1.TestFirebaseStorageContextFixture);
@@ -1835,9 +1857,9 @@ var COUNTER = 0;
1835
1857
  return new GoogleCloudTestFirebaseStorageContextFixture();
1836
1858
  },
1837
1859
  setupInstance: function setupInstance(config) {
1838
- return _async_to_generator$5(function() {
1860
+ return _async_to_generator$7(function() {
1839
1861
  var drivers, projectId, firebaseStorage, defaultBucketId;
1840
- return _ts_generator$5(this, function(_state) {
1862
+ return _ts_generator$7(this, function(_state) {
1841
1863
  drivers = test$1.makeTestingFirebaseStorageDrivers(firebaseServer.googleCloudFirebaseStorageDrivers());
1842
1864
  projectId = "firebase-storage-server-test-".concat(new Date().getTime(), "-").concat(COUNTER++);
1843
1865
  firebaseStorage = new storage.Storage({
@@ -1854,8 +1876,8 @@ var COUNTER = 0;
1854
1876
  })();
1855
1877
  },
1856
1878
  teardownInstance: function teardownInstance(instance, config) {
1857
- return _async_to_generator$5(function() {
1858
- return _ts_generator$5(this, function(_state) {
1879
+ return _async_to_generator$7(function() {
1880
+ return _ts_generator$7(this, function(_state) {
1859
1881
  return [
1860
1882
  2
1861
1883
  ];
@@ -1865,13 +1887,13 @@ var COUNTER = 0;
1865
1887
  }
1866
1888
  });
1867
1889
 
1868
- function _assert_this_initialized$4(self) {
1890
+ function _assert_this_initialized$5(self) {
1869
1891
  if (self === void 0) {
1870
1892
  throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
1871
1893
  }
1872
1894
  return self;
1873
1895
  }
1874
- function asyncGeneratorStep$4(gen, resolve, reject, _next, _throw, key, arg) {
1896
+ function asyncGeneratorStep$6(gen, resolve, reject, _next, _throw, key, arg) {
1875
1897
  try {
1876
1898
  var info = gen[key](arg);
1877
1899
  var value = info.value;
@@ -1885,31 +1907,31 @@ function asyncGeneratorStep$4(gen, resolve, reject, _next, _throw, key, arg) {
1885
1907
  Promise.resolve(value).then(_next, _throw);
1886
1908
  }
1887
1909
  }
1888
- function _async_to_generator$4(fn) {
1910
+ function _async_to_generator$6(fn) {
1889
1911
  return function() {
1890
1912
  var self = this, args = arguments;
1891
1913
  return new Promise(function(resolve, reject) {
1892
1914
  var gen = fn.apply(self, args);
1893
1915
  function _next(value) {
1894
- asyncGeneratorStep$4(gen, resolve, reject, _next, _throw, "next", value);
1916
+ asyncGeneratorStep$6(gen, resolve, reject, _next, _throw, "next", value);
1895
1917
  }
1896
1918
  function _throw(err) {
1897
- asyncGeneratorStep$4(gen, resolve, reject, _next, _throw, "throw", err);
1919
+ asyncGeneratorStep$6(gen, resolve, reject, _next, _throw, "throw", err);
1898
1920
  }
1899
1921
  _next(undefined);
1900
1922
  });
1901
1923
  };
1902
1924
  }
1903
- function _call_super$4(_this, derived, args) {
1904
- derived = _get_prototype_of$4(derived);
1905
- 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));
1925
+ function _call_super$5(_this, derived, args) {
1926
+ derived = _get_prototype_of$5(derived);
1927
+ 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));
1906
1928
  }
1907
- function _class_call_check$4(instance, Constructor) {
1929
+ function _class_call_check$5(instance, Constructor) {
1908
1930
  if (!(instance instanceof Constructor)) {
1909
1931
  throw new TypeError("Cannot call a class as a function");
1910
1932
  }
1911
1933
  }
1912
- function _defineProperties$3(target, props) {
1934
+ function _defineProperties$4(target, props) {
1913
1935
  for(var i = 0; i < props.length; i++){
1914
1936
  var descriptor = props[i];
1915
1937
  descriptor.enumerable = descriptor.enumerable || false;
@@ -1918,11 +1940,11 @@ function _defineProperties$3(target, props) {
1918
1940
  Object.defineProperty(target, descriptor.key, descriptor);
1919
1941
  }
1920
1942
  }
1921
- function _create_class$3(Constructor, protoProps, staticProps) {
1922
- if (protoProps) _defineProperties$3(Constructor.prototype, protoProps);
1943
+ function _create_class$4(Constructor, protoProps, staticProps) {
1944
+ if (protoProps) _defineProperties$4(Constructor.prototype, protoProps);
1923
1945
  return Constructor;
1924
1946
  }
1925
- function _define_property$5(obj, key, value) {
1947
+ function _define_property$6(obj, key, value) {
1926
1948
  if (key in obj) {
1927
1949
  Object.defineProperty(obj, key, {
1928
1950
  value: value,
@@ -1935,13 +1957,13 @@ function _define_property$5(obj, key, value) {
1935
1957
  }
1936
1958
  return obj;
1937
1959
  }
1938
- function _get_prototype_of$4(o) {
1939
- _get_prototype_of$4 = Object.setPrototypeOf ? Object.getPrototypeOf : function getPrototypeOf(o) {
1960
+ function _get_prototype_of$5(o) {
1961
+ _get_prototype_of$5 = Object.setPrototypeOf ? Object.getPrototypeOf : function getPrototypeOf(o) {
1940
1962
  return o.__proto__ || Object.getPrototypeOf(o);
1941
1963
  };
1942
- return _get_prototype_of$4(o);
1964
+ return _get_prototype_of$5(o);
1943
1965
  }
1944
- function _inherits$4(subClass, superClass) {
1966
+ function _inherits$5(subClass, superClass) {
1945
1967
  if (typeof superClass !== "function" && superClass !== null) {
1946
1968
  throw new TypeError("Super expression must either be null or a function");
1947
1969
  }
@@ -1952,9 +1974,9 @@ function _inherits$4(subClass, superClass) {
1952
1974
  configurable: true
1953
1975
  }
1954
1976
  });
1955
- if (superClass) _set_prototype_of$4(subClass, superClass);
1977
+ if (superClass) _set_prototype_of$5(subClass, superClass);
1956
1978
  }
1957
- function _object_spread$3(target) {
1979
+ function _object_spread$4(target) {
1958
1980
  for(var i = 1; i < arguments.length; i++){
1959
1981
  var source = arguments[i] != null ? arguments[i] : {};
1960
1982
  var ownKeys = Object.keys(source);
@@ -1964,37 +1986,37 @@ function _object_spread$3(target) {
1964
1986
  }));
1965
1987
  }
1966
1988
  ownKeys.forEach(function(key) {
1967
- _define_property$5(target, key, source[key]);
1989
+ _define_property$6(target, key, source[key]);
1968
1990
  });
1969
1991
  }
1970
1992
  return target;
1971
1993
  }
1972
- function _possible_constructor_return$4(self, call) {
1973
- if (call && (_type_of$4(call) === "object" || typeof call === "function")) {
1994
+ function _possible_constructor_return$5(self, call) {
1995
+ if (call && (_type_of$5(call) === "object" || typeof call === "function")) {
1974
1996
  return call;
1975
1997
  }
1976
- return _assert_this_initialized$4(self);
1998
+ return _assert_this_initialized$5(self);
1977
1999
  }
1978
- function _set_prototype_of$4(o, p) {
1979
- _set_prototype_of$4 = Object.setPrototypeOf || function setPrototypeOf(o, p) {
2000
+ function _set_prototype_of$5(o, p) {
2001
+ _set_prototype_of$5 = Object.setPrototypeOf || function setPrototypeOf(o, p) {
1980
2002
  o.__proto__ = p;
1981
2003
  return o;
1982
2004
  };
1983
- return _set_prototype_of$4(o, p);
2005
+ return _set_prototype_of$5(o, p);
1984
2006
  }
1985
- function _type_of$4(obj) {
2007
+ function _type_of$5(obj) {
1986
2008
  "@swc/helpers - typeof";
1987
2009
  return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
1988
2010
  }
1989
- function _is_native_reflect_construct$4() {
2011
+ function _is_native_reflect_construct$5() {
1990
2012
  try {
1991
2013
  var result = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
1992
2014
  } catch (_) {}
1993
- return (_is_native_reflect_construct$4 = function() {
2015
+ return (_is_native_reflect_construct$5 = function() {
1994
2016
  return !!result;
1995
2017
  })();
1996
2018
  }
1997
- function _ts_generator$4(thisArg, body) {
2019
+ function _ts_generator$6(thisArg, body) {
1998
2020
  var f, y, t, _ = {
1999
2021
  label: 0,
2000
2022
  sent: function() {
@@ -2100,12 +2122,12 @@ function _ts_generator$4(thisArg, body) {
2100
2122
  * Used with {@link firebaseAdminTestBuilder} to provide a stable reference that persists across
2101
2123
  * the setup/teardown lifecycle while the inner instance is created and destroyed per test suite.
2102
2124
  */ var FirebaseAdminTestContextFixture = /*#__PURE__*/ function(AbstractTestContextFixture) {
2103
- _inherits$4(FirebaseAdminTestContextFixture, AbstractTestContextFixture);
2125
+ _inherits$5(FirebaseAdminTestContextFixture, AbstractTestContextFixture);
2104
2126
  function FirebaseAdminTestContextFixture() {
2105
- _class_call_check$4(this, FirebaseAdminTestContextFixture);
2106
- return _call_super$4(this, FirebaseAdminTestContextFixture, arguments);
2127
+ _class_call_check$5(this, FirebaseAdminTestContextFixture);
2128
+ return _call_super$5(this, FirebaseAdminTestContextFixture, arguments);
2107
2129
  }
2108
- _create_class$3(FirebaseAdminTestContextFixture, [
2130
+ _create_class$4(FirebaseAdminTestContextFixture, [
2109
2131
  {
2110
2132
  key: "app",
2111
2133
  get: // MARK: FirebaseAdminTestContext (Forwarded)
@@ -2178,20 +2200,20 @@ function _ts_generator$4(thisArg, body) {
2178
2200
  */ var FirebaseAdminTestContextInstance = /*#__PURE__*/ function() {
2179
2201
  function FirebaseAdminTestContextInstance(app) {
2180
2202
  var _this = this;
2181
- _class_call_check$4(this, FirebaseAdminTestContextInstance);
2182
- _define_property$5(this, "app", void 0);
2183
- _define_property$5(this, "getTestFirestoreInstance", util.cachedGetter(function() {
2203
+ _class_call_check$5(this, FirebaseAdminTestContextInstance);
2204
+ _define_property$6(this, "app", void 0);
2205
+ _define_property$6(this, "getTestFirestoreInstance", util.cachedGetter(function() {
2184
2206
  var drivers = test$1.makeTestingFirestoreDrivers(firebaseServer.googleCloudFirestoreDrivers());
2185
2207
  return new GoogleCloudTestFirestoreInstance(drivers, _this.firestore);
2186
2208
  }));
2187
- _define_property$5(this, "getTestFirebaseStorageInstance", util.cachedGetter(function() {
2209
+ _define_property$6(this, "getTestFirebaseStorageInstance", util.cachedGetter(function() {
2188
2210
  var drivers = test$1.makeTestingFirebaseStorageDrivers(firebaseServer.googleCloudFirebaseStorageDrivers());
2189
2211
  var defaultBucketId = _this.app.options.storageBucket;
2190
2212
  return new GoogleCloudTestFirebaseStorageInstance(drivers, _this.storage, defaultBucketId);
2191
2213
  }));
2192
2214
  this.app = app;
2193
2215
  }
2194
- _create_class$3(FirebaseAdminTestContextInstance, [
2216
+ _create_class$4(FirebaseAdminTestContextInstance, [
2195
2217
  {
2196
2218
  key: "auth",
2197
2219
  get: function get() {
@@ -2253,11 +2275,11 @@ function _ts_generator$4(thisArg, body) {
2253
2275
  * @typeParam F - The parent instance type, defaults to {@link FirebaseAdminTestContextInstance}.
2254
2276
  */ var AbstractFirebaseAdminTestContextInstanceChild = /*#__PURE__*/ function() {
2255
2277
  function AbstractFirebaseAdminTestContextInstanceChild(parent) {
2256
- _class_call_check$4(this, AbstractFirebaseAdminTestContextInstanceChild);
2257
- _define_property$5(this, "parent", void 0);
2278
+ _class_call_check$5(this, AbstractFirebaseAdminTestContextInstanceChild);
2279
+ _define_property$6(this, "parent", void 0);
2258
2280
  this.parent = parent;
2259
2281
  }
2260
- _create_class$3(AbstractFirebaseAdminTestContextInstanceChild, [
2282
+ _create_class$4(AbstractFirebaseAdminTestContextInstanceChild, [
2261
2283
  {
2262
2284
  key: "app",
2263
2285
  get: // MARK: FirebaseAdminTestContext (Forwarded)
@@ -2322,16 +2344,16 @@ function _ts_generator$4(thisArg, body) {
2322
2344
  * This can be used to easily build a testing context that sets up RulesTestEnvironment for tests that sets itself up and tears itself down.
2323
2345
  */ var firebaseAdminTestBuilder = test.testContextBuilder({
2324
2346
  buildConfig: function buildConfig(input) {
2325
- var config = _object_spread$3({}, input);
2347
+ var config = _object_spread$4({}, input);
2326
2348
  return config;
2327
2349
  },
2328
2350
  buildFixture: function buildFixture() {
2329
2351
  return new FirebaseAdminTestContextFixture();
2330
2352
  },
2331
2353
  setupInstance: function setupInstance(config) {
2332
- return _async_to_generator$4(function() {
2354
+ return _async_to_generator$6(function() {
2333
2355
  var projectId, storageBucket, app;
2334
- return _ts_generator$4(this, function(_state) {
2356
+ return _ts_generator$6(this, function(_state) {
2335
2357
  if (!isAdminEnvironmentInitialized()) {
2336
2358
  throw new Error('Call initFirebaseAdminTestEnvironment() from @dereekb/firebase-server was not called before using adminFirebaseTestBuilder().');
2337
2359
  }
@@ -2349,8 +2371,8 @@ function _ts_generator$4(thisArg, body) {
2349
2371
  })();
2350
2372
  },
2351
2373
  teardownInstance: function teardownInstance(instance, config) {
2352
- return _async_to_generator$4(function() {
2353
- return _ts_generator$4(this, function(_state) {
2374
+ return _async_to_generator$6(function() {
2375
+ return _ts_generator$6(this, function(_state) {
2354
2376
  switch(_state.label){
2355
2377
  case 0:
2356
2378
  return [
@@ -2420,7 +2442,7 @@ function _ts_generator$4(thisArg, body) {
2420
2442
  });
2421
2443
  }
2422
2444
 
2423
- function asyncGeneratorStep$3(gen, resolve, reject, _next, _throw, key, arg) {
2445
+ function asyncGeneratorStep$5(gen, resolve, reject, _next, _throw, key, arg) {
2424
2446
  try {
2425
2447
  var info = gen[key](arg);
2426
2448
  var value = info.value;
@@ -2434,22 +2456,22 @@ function asyncGeneratorStep$3(gen, resolve, reject, _next, _throw, key, arg) {
2434
2456
  Promise.resolve(value).then(_next, _throw);
2435
2457
  }
2436
2458
  }
2437
- function _async_to_generator$3(fn) {
2459
+ function _async_to_generator$5(fn) {
2438
2460
  return function() {
2439
2461
  var self = this, args = arguments;
2440
2462
  return new Promise(function(resolve, reject) {
2441
2463
  var gen = fn.apply(self, args);
2442
2464
  function _next(value) {
2443
- asyncGeneratorStep$3(gen, resolve, reject, _next, _throw, "next", value);
2465
+ asyncGeneratorStep$5(gen, resolve, reject, _next, _throw, "next", value);
2444
2466
  }
2445
2467
  function _throw(err) {
2446
- asyncGeneratorStep$3(gen, resolve, reject, _next, _throw, "throw", err);
2468
+ asyncGeneratorStep$5(gen, resolve, reject, _next, _throw, "throw", err);
2447
2469
  }
2448
2470
  _next(undefined);
2449
2471
  });
2450
2472
  };
2451
2473
  }
2452
- function _define_property$4(obj, key, value) {
2474
+ function _define_property$5(obj, key, value) {
2453
2475
  if (key in obj) {
2454
2476
  Object.defineProperty(obj, key, {
2455
2477
  value: value,
@@ -2462,7 +2484,7 @@ function _define_property$4(obj, key, value) {
2462
2484
  }
2463
2485
  return obj;
2464
2486
  }
2465
- function _object_spread$2(target) {
2487
+ function _object_spread$3(target) {
2466
2488
  for(var i = 1; i < arguments.length; i++){
2467
2489
  var source = arguments[i] != null ? arguments[i] : {};
2468
2490
  var ownKeys = Object.keys(source);
@@ -2472,12 +2494,12 @@ function _object_spread$2(target) {
2472
2494
  }));
2473
2495
  }
2474
2496
  ownKeys.forEach(function(key) {
2475
- _define_property$4(target, key, source[key]);
2497
+ _define_property$5(target, key, source[key]);
2476
2498
  });
2477
2499
  }
2478
2500
  return target;
2479
2501
  }
2480
- function ownKeys$1(object, enumerableOnly) {
2502
+ function ownKeys$2(object, enumerableOnly) {
2481
2503
  var keys = Object.keys(object);
2482
2504
  if (Object.getOwnPropertySymbols) {
2483
2505
  var symbols = Object.getOwnPropertySymbols(object);
@@ -2485,18 +2507,18 @@ function ownKeys$1(object, enumerableOnly) {
2485
2507
  }
2486
2508
  return keys;
2487
2509
  }
2488
- function _object_spread_props$1(target, source) {
2510
+ function _object_spread_props$2(target, source) {
2489
2511
  source = source != null ? source : {};
2490
2512
  if (Object.getOwnPropertyDescriptors) {
2491
2513
  Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
2492
2514
  } else {
2493
- ownKeys$1(Object(source)).forEach(function(key) {
2515
+ ownKeys$2(Object(source)).forEach(function(key) {
2494
2516
  Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
2495
2517
  });
2496
2518
  }
2497
2519
  return target;
2498
2520
  }
2499
- function _ts_generator$3(thisArg, body) {
2521
+ function _ts_generator$5(thisArg, body) {
2500
2522
  var f, y, t, _ = {
2501
2523
  label: 0,
2502
2524
  sent: function() {
@@ -2617,12 +2639,12 @@ function _ts_generator$3(thisArg, body) {
2617
2639
  var wrappedCloudFunction = instance.wrap(x);
2618
2640
  // context is marked optional here to better match the gen 1 callable function signature
2619
2641
  return function(data, context) {
2620
- return _async_to_generator$3(function() {
2642
+ return _async_to_generator$5(function() {
2621
2643
  var _ref, request, result;
2622
- return _ts_generator$3(this, function(_state) {
2644
+ return _ts_generator$5(this, function(_state) {
2623
2645
  switch(_state.label){
2624
2646
  case 0:
2625
- request = _object_spread_props$1(_object_spread$2({}, context), {
2647
+ request = _object_spread_props$2(_object_spread$3({}, context), {
2626
2648
  data: data,
2627
2649
  // NOTE: These will typically not be used/available as they are express.js properties that are not available or useful to the handlers
2628
2650
  rawRequest: (_ref = context === null || context === void 0 ? void 0 : context.rawRequest) !== null && _ref !== void 0 ? _ref : {},
@@ -2697,13 +2719,13 @@ function _ts_generator$3(thisArg, body) {
2697
2719
  };
2698
2720
  }
2699
2721
 
2700
- function _assert_this_initialized$3(self) {
2722
+ function _assert_this_initialized$4(self) {
2701
2723
  if (self === void 0) {
2702
2724
  throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
2703
2725
  }
2704
2726
  return self;
2705
2727
  }
2706
- function asyncGeneratorStep$2(gen, resolve, reject, _next, _throw, key, arg) {
2728
+ function asyncGeneratorStep$4(gen, resolve, reject, _next, _throw, key, arg) {
2707
2729
  try {
2708
2730
  var info = gen[key](arg);
2709
2731
  var value = info.value;
@@ -2717,31 +2739,31 @@ function asyncGeneratorStep$2(gen, resolve, reject, _next, _throw, key, arg) {
2717
2739
  Promise.resolve(value).then(_next, _throw);
2718
2740
  }
2719
2741
  }
2720
- function _async_to_generator$2(fn) {
2742
+ function _async_to_generator$4(fn) {
2721
2743
  return function() {
2722
2744
  var self = this, args = arguments;
2723
2745
  return new Promise(function(resolve, reject) {
2724
2746
  var gen = fn.apply(self, args);
2725
2747
  function _next(value) {
2726
- asyncGeneratorStep$2(gen, resolve, reject, _next, _throw, "next", value);
2748
+ asyncGeneratorStep$4(gen, resolve, reject, _next, _throw, "next", value);
2727
2749
  }
2728
2750
  function _throw(err) {
2729
- asyncGeneratorStep$2(gen, resolve, reject, _next, _throw, "throw", err);
2751
+ asyncGeneratorStep$4(gen, resolve, reject, _next, _throw, "throw", err);
2730
2752
  }
2731
2753
  _next(undefined);
2732
2754
  });
2733
2755
  };
2734
2756
  }
2735
- function _call_super$3(_this, derived, args) {
2736
- derived = _get_prototype_of$3(derived);
2737
- return _possible_constructor_return$3(_this, _is_native_reflect_construct$3() ? Reflect.construct(derived, args || [], _get_prototype_of$3(_this).constructor) : derived.apply(_this, args));
2757
+ function _call_super$4(_this, derived, args) {
2758
+ derived = _get_prototype_of$4(derived);
2759
+ 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));
2738
2760
  }
2739
- function _class_call_check$3(instance, Constructor) {
2761
+ function _class_call_check$4(instance, Constructor) {
2740
2762
  if (!(instance instanceof Constructor)) {
2741
2763
  throw new TypeError("Cannot call a class as a function");
2742
2764
  }
2743
2765
  }
2744
- function _defineProperties$2(target, props) {
2766
+ function _defineProperties$3(target, props) {
2745
2767
  for(var i = 0; i < props.length; i++){
2746
2768
  var descriptor = props[i];
2747
2769
  descriptor.enumerable = descriptor.enumerable || false;
@@ -2750,11 +2772,11 @@ function _defineProperties$2(target, props) {
2750
2772
  Object.defineProperty(target, descriptor.key, descriptor);
2751
2773
  }
2752
2774
  }
2753
- function _create_class$2(Constructor, protoProps, staticProps) {
2754
- if (protoProps) _defineProperties$2(Constructor.prototype, protoProps);
2775
+ function _create_class$3(Constructor, protoProps, staticProps) {
2776
+ if (protoProps) _defineProperties$3(Constructor.prototype, protoProps);
2755
2777
  return Constructor;
2756
2778
  }
2757
- function _define_property$3(obj, key, value) {
2779
+ function _define_property$4(obj, key, value) {
2758
2780
  if (key in obj) {
2759
2781
  Object.defineProperty(obj, key, {
2760
2782
  value: value,
@@ -2767,13 +2789,13 @@ function _define_property$3(obj, key, value) {
2767
2789
  }
2768
2790
  return obj;
2769
2791
  }
2770
- function _get_prototype_of$3(o) {
2771
- _get_prototype_of$3 = Object.setPrototypeOf ? Object.getPrototypeOf : function getPrototypeOf(o) {
2792
+ function _get_prototype_of$4(o) {
2793
+ _get_prototype_of$4 = Object.setPrototypeOf ? Object.getPrototypeOf : function getPrototypeOf(o) {
2772
2794
  return o.__proto__ || Object.getPrototypeOf(o);
2773
2795
  };
2774
- return _get_prototype_of$3(o);
2796
+ return _get_prototype_of$4(o);
2775
2797
  }
2776
- function _inherits$3(subClass, superClass) {
2798
+ function _inherits$4(subClass, superClass) {
2777
2799
  if (typeof superClass !== "function" && superClass !== null) {
2778
2800
  throw new TypeError("Super expression must either be null or a function");
2779
2801
  }
@@ -2784,7 +2806,7 @@ function _inherits$3(subClass, superClass) {
2784
2806
  configurable: true
2785
2807
  }
2786
2808
  });
2787
- if (superClass) _set_prototype_of$3(subClass, superClass);
2809
+ if (superClass) _set_prototype_of$4(subClass, superClass);
2788
2810
  }
2789
2811
  function _instanceof$1(left, right) {
2790
2812
  if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
@@ -2793,7 +2815,7 @@ function _instanceof$1(left, right) {
2793
2815
  return left instanceof right;
2794
2816
  }
2795
2817
  }
2796
- function _object_spread$1(target) {
2818
+ function _object_spread$2(target) {
2797
2819
  for(var i = 1; i < arguments.length; i++){
2798
2820
  var source = arguments[i] != null ? arguments[i] : {};
2799
2821
  var ownKeys = Object.keys(source);
@@ -2803,12 +2825,12 @@ function _object_spread$1(target) {
2803
2825
  }));
2804
2826
  }
2805
2827
  ownKeys.forEach(function(key) {
2806
- _define_property$3(target, key, source[key]);
2828
+ _define_property$4(target, key, source[key]);
2807
2829
  });
2808
2830
  }
2809
2831
  return target;
2810
2832
  }
2811
- function ownKeys(object, enumerableOnly) {
2833
+ function ownKeys$1(object, enumerableOnly) {
2812
2834
  var keys = Object.keys(object);
2813
2835
  if (Object.getOwnPropertySymbols) {
2814
2836
  var symbols = Object.getOwnPropertySymbols(object);
@@ -2816,43 +2838,43 @@ function ownKeys(object, enumerableOnly) {
2816
2838
  }
2817
2839
  return keys;
2818
2840
  }
2819
- function _object_spread_props(target, source) {
2841
+ function _object_spread_props$1(target, source) {
2820
2842
  source = source != null ? source : {};
2821
2843
  if (Object.getOwnPropertyDescriptors) {
2822
2844
  Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
2823
2845
  } else {
2824
- ownKeys(Object(source)).forEach(function(key) {
2846
+ ownKeys$1(Object(source)).forEach(function(key) {
2825
2847
  Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
2826
2848
  });
2827
2849
  }
2828
2850
  return target;
2829
2851
  }
2830
- function _possible_constructor_return$3(self, call) {
2831
- if (call && (_type_of$3(call) === "object" || typeof call === "function")) {
2852
+ function _possible_constructor_return$4(self, call) {
2853
+ if (call && (_type_of$4(call) === "object" || typeof call === "function")) {
2832
2854
  return call;
2833
2855
  }
2834
- return _assert_this_initialized$3(self);
2856
+ return _assert_this_initialized$4(self);
2835
2857
  }
2836
- function _set_prototype_of$3(o, p) {
2837
- _set_prototype_of$3 = Object.setPrototypeOf || function setPrototypeOf(o, p) {
2858
+ function _set_prototype_of$4(o, p) {
2859
+ _set_prototype_of$4 = Object.setPrototypeOf || function setPrototypeOf(o, p) {
2838
2860
  o.__proto__ = p;
2839
2861
  return o;
2840
2862
  };
2841
- return _set_prototype_of$3(o, p);
2863
+ return _set_prototype_of$4(o, p);
2842
2864
  }
2843
- function _type_of$3(obj) {
2865
+ function _type_of$4(obj) {
2844
2866
  "@swc/helpers - typeof";
2845
2867
  return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
2846
2868
  }
2847
- function _is_native_reflect_construct$3() {
2869
+ function _is_native_reflect_construct$4() {
2848
2870
  try {
2849
2871
  var result = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
2850
2872
  } catch (_) {}
2851
- return (_is_native_reflect_construct$3 = function() {
2873
+ return (_is_native_reflect_construct$4 = function() {
2852
2874
  return !!result;
2853
2875
  })();
2854
2876
  }
2855
- function _ts_generator$2(thisArg, body) {
2877
+ function _ts_generator$4(thisArg, body) {
2856
2878
  var f, y, t, _ = {
2857
2879
  label: 0,
2858
2880
  sent: function() {
@@ -3004,12 +3026,12 @@ var functionsInitialized = false;
3004
3026
  * fixture and use it to access the Firebase Admin app, Firestore, Auth, Storage, and the
3005
3027
  * firebase-functions-test wrapper during each test lifecycle.
3006
3028
  */ var FirebaseAdminFunctionTestContextFixture = /*#__PURE__*/ function(AbstractTestContextFixture) {
3007
- _inherits$3(FirebaseAdminFunctionTestContextFixture, AbstractTestContextFixture);
3029
+ _inherits$4(FirebaseAdminFunctionTestContextFixture, AbstractTestContextFixture);
3008
3030
  function FirebaseAdminFunctionTestContextFixture() {
3009
- _class_call_check$3(this, FirebaseAdminFunctionTestContextFixture);
3010
- return _call_super$3(this, FirebaseAdminFunctionTestContextFixture, arguments);
3031
+ _class_call_check$4(this, FirebaseAdminFunctionTestContextFixture);
3032
+ return _call_super$4(this, FirebaseAdminFunctionTestContextFixture, arguments);
3011
3033
  }
3012
- _create_class$2(FirebaseAdminFunctionTestContextFixture, [
3034
+ _create_class$3(FirebaseAdminFunctionTestContextFixture, [
3013
3035
  {
3014
3036
  key: "app",
3015
3037
  get: // MARK: FirebaseAdminTestContext (Forwarded)
@@ -3076,19 +3098,19 @@ var functionsInitialized = false;
3076
3098
  * Each instance holds a lazily-created {@link FirebaseAdminCloudFunctionWrapper} via `fnWrapper`
3077
3099
  * so Cloud Functions can be wrapped and invoked against the test project.
3078
3100
  */ var FirebaseAdminFunctionTestContextInstance = /*#__PURE__*/ function(FirebaseAdminTestContextInstance) {
3079
- _inherits$3(FirebaseAdminFunctionTestContextInstance, FirebaseAdminTestContextInstance);
3101
+ _inherits$4(FirebaseAdminFunctionTestContextInstance, FirebaseAdminTestContextInstance);
3080
3102
  function FirebaseAdminFunctionTestContextInstance(instance, app) {
3081
- _class_call_check$3(this, FirebaseAdminFunctionTestContextInstance);
3103
+ _class_call_check$4(this, FirebaseAdminFunctionTestContextInstance);
3082
3104
  var _this;
3083
- _this = _call_super$3(this, FirebaseAdminFunctionTestContextInstance, [
3105
+ _this = _call_super$4(this, FirebaseAdminFunctionTestContextInstance, [
3084
3106
  app
3085
- ]), _define_property$3(_this, "instance", void 0), _define_property$3(_this, "_fnWrapper", util.cachedGetter(function() {
3107
+ ]), _define_property$4(_this, "instance", void 0), _define_property$4(_this, "_fnWrapper", util.cachedGetter(function() {
3086
3108
  return firebaseAdminCloudFunctionWrapper(_this.instance);
3087
3109
  }));
3088
3110
  _this.instance = instance;
3089
3111
  return _this;
3090
3112
  }
3091
- _create_class$2(FirebaseAdminFunctionTestContextInstance, [
3113
+ _create_class$3(FirebaseAdminFunctionTestContextInstance, [
3092
3114
  {
3093
3115
  key: "fnWrapper",
3094
3116
  get: function get() {
@@ -3123,7 +3145,7 @@ var functionsInitialized = false;
3123
3145
  */ var firebaseAdminFunctionTestBuilder = test.testContextBuilder({
3124
3146
  buildConfig: function buildConfig(input) {
3125
3147
  var _ref;
3126
- var config = _object_spread_props(_object_spread$1({}, input), {
3148
+ var config = _object_spread_props$1(_object_spread$2({}, input), {
3127
3149
  useFunctionSingletonContext: (_ref = input === null || input === void 0 ? void 0 : input.useFunctionSingletonContext) !== null && _ref !== void 0 ? _ref : exports.DEFAULT_FIREBASE_ADMIN_FUNCTION_TEST_USE_FUNCTION_SINGLETON_CONTEXT
3128
3150
  });
3129
3151
  return config;
@@ -3132,9 +3154,9 @@ var functionsInitialized = false;
3132
3154
  return new FirebaseAdminFunctionTestContextFixture();
3133
3155
  },
3134
3156
  setupInstance: function setupInstance(config) {
3135
- return _async_to_generator$2(function() {
3157
+ return _async_to_generator$4(function() {
3136
3158
  var projectId, storageBucket, app, e;
3137
- return _ts_generator$2(this, function(_state) {
3159
+ return _ts_generator$4(this, function(_state) {
3138
3160
  switch(_state.label){
3139
3161
  case 0:
3140
3162
  if (!isAdminEnvironmentInitialized()) {
@@ -3205,8 +3227,8 @@ var functionsInitialized = false;
3205
3227
  })();
3206
3228
  },
3207
3229
  teardownInstance: function teardownInstance(instance, config) {
3208
- return _async_to_generator$2(function() {
3209
- return _ts_generator$2(this, function(_state) {
3230
+ return _async_to_generator$4(function() {
3231
+ return _ts_generator$4(this, function(_state) {
3210
3232
  switch(_state.label){
3211
3233
  case 0:
3212
3234
  if (!!config.useFunctionSingletonContext) return [
@@ -3265,13 +3287,21 @@ var functionsInitialized = false;
3265
3287
  * ```
3266
3288
  */ var firebaseAdminFunctionTestContextFactory = firebaseAdminFunctionTestBuilder({});
3267
3289
 
3268
- function _assert_this_initialized$2(self) {
3290
+ function _array_like_to_array$1(arr, len) {
3291
+ if (len == null || len > arr.length) len = arr.length;
3292
+ for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
3293
+ return arr2;
3294
+ }
3295
+ function _array_without_holes$1(arr) {
3296
+ if (Array.isArray(arr)) return _array_like_to_array$1(arr);
3297
+ }
3298
+ function _assert_this_initialized$3(self) {
3269
3299
  if (self === void 0) {
3270
3300
  throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
3271
3301
  }
3272
3302
  return self;
3273
3303
  }
3274
- function asyncGeneratorStep$1(gen, resolve, reject, _next, _throw, key, arg) {
3304
+ function asyncGeneratorStep$3(gen, resolve, reject, _next, _throw, key, arg) {
3275
3305
  try {
3276
3306
  var info = gen[key](arg);
3277
3307
  var value = info.value;
@@ -3285,31 +3315,31 @@ function asyncGeneratorStep$1(gen, resolve, reject, _next, _throw, key, arg) {
3285
3315
  Promise.resolve(value).then(_next, _throw);
3286
3316
  }
3287
3317
  }
3288
- function _async_to_generator$1(fn) {
3318
+ function _async_to_generator$3(fn) {
3289
3319
  return function() {
3290
3320
  var self = this, args = arguments;
3291
3321
  return new Promise(function(resolve, reject) {
3292
3322
  var gen = fn.apply(self, args);
3293
3323
  function _next(value) {
3294
- asyncGeneratorStep$1(gen, resolve, reject, _next, _throw, "next", value);
3324
+ asyncGeneratorStep$3(gen, resolve, reject, _next, _throw, "next", value);
3295
3325
  }
3296
3326
  function _throw(err) {
3297
- asyncGeneratorStep$1(gen, resolve, reject, _next, _throw, "throw", err);
3327
+ asyncGeneratorStep$3(gen, resolve, reject, _next, _throw, "throw", err);
3298
3328
  }
3299
3329
  _next(undefined);
3300
3330
  });
3301
3331
  };
3302
3332
  }
3303
- function _call_super$2(_this, derived, args) {
3304
- derived = _get_prototype_of$2(derived);
3305
- return _possible_constructor_return$2(_this, _is_native_reflect_construct$2() ? Reflect.construct(derived, args || [], _get_prototype_of$2(_this).constructor) : derived.apply(_this, args));
3333
+ function _call_super$3(_this, derived, args) {
3334
+ derived = _get_prototype_of$3(derived);
3335
+ return _possible_constructor_return$3(_this, _is_native_reflect_construct$3() ? Reflect.construct(derived, args || [], _get_prototype_of$3(_this).constructor) : derived.apply(_this, args));
3306
3336
  }
3307
- function _class_call_check$2(instance, Constructor) {
3337
+ function _class_call_check$3(instance, Constructor) {
3308
3338
  if (!(instance instanceof Constructor)) {
3309
3339
  throw new TypeError("Cannot call a class as a function");
3310
3340
  }
3311
3341
  }
3312
- function _defineProperties$1(target, props) {
3342
+ function _defineProperties$2(target, props) {
3313
3343
  for(var i = 0; i < props.length; i++){
3314
3344
  var descriptor = props[i];
3315
3345
  descriptor.enumerable = descriptor.enumerable || false;
@@ -3318,11 +3348,11 @@ function _defineProperties$1(target, props) {
3318
3348
  Object.defineProperty(target, descriptor.key, descriptor);
3319
3349
  }
3320
3350
  }
3321
- function _create_class$1(Constructor, protoProps, staticProps) {
3322
- if (protoProps) _defineProperties$1(Constructor.prototype, protoProps);
3351
+ function _create_class$2(Constructor, protoProps, staticProps) {
3352
+ if (protoProps) _defineProperties$2(Constructor.prototype, protoProps);
3323
3353
  return Constructor;
3324
3354
  }
3325
- function _define_property$2(obj, key, value) {
3355
+ function _define_property$3(obj, key, value) {
3326
3356
  if (key in obj) {
3327
3357
  Object.defineProperty(obj, key, {
3328
3358
  value: value,
@@ -3335,13 +3365,13 @@ function _define_property$2(obj, key, value) {
3335
3365
  }
3336
3366
  return obj;
3337
3367
  }
3338
- function _get_prototype_of$2(o) {
3339
- _get_prototype_of$2 = Object.setPrototypeOf ? Object.getPrototypeOf : function getPrototypeOf(o) {
3368
+ function _get_prototype_of$3(o) {
3369
+ _get_prototype_of$3 = Object.setPrototypeOf ? Object.getPrototypeOf : function getPrototypeOf(o) {
3340
3370
  return o.__proto__ || Object.getPrototypeOf(o);
3341
3371
  };
3342
- return _get_prototype_of$2(o);
3372
+ return _get_prototype_of$3(o);
3343
3373
  }
3344
- function _inherits$2(subClass, superClass) {
3374
+ function _inherits$3(subClass, superClass) {
3345
3375
  if (typeof superClass !== "function" && superClass !== null) {
3346
3376
  throw new TypeError("Super expression must either be null or a function");
3347
3377
  }
@@ -3352,34 +3382,85 @@ function _inherits$2(subClass, superClass) {
3352
3382
  configurable: true
3353
3383
  }
3354
3384
  });
3355
- if (superClass) _set_prototype_of$2(subClass, superClass);
3385
+ if (superClass) _set_prototype_of$3(subClass, superClass);
3356
3386
  }
3357
- function _possible_constructor_return$2(self, call) {
3358
- if (call && (_type_of$2(call) === "object" || typeof call === "function")) {
3387
+ function _iterable_to_array$1(iter) {
3388
+ if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
3389
+ }
3390
+ function _non_iterable_spread$1() {
3391
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
3392
+ }
3393
+ function _object_spread$1(target) {
3394
+ for(var i = 1; i < arguments.length; i++){
3395
+ var source = arguments[i] != null ? arguments[i] : {};
3396
+ var ownKeys = Object.keys(source);
3397
+ if (typeof Object.getOwnPropertySymbols === "function") {
3398
+ ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
3399
+ return Object.getOwnPropertyDescriptor(source, sym).enumerable;
3400
+ }));
3401
+ }
3402
+ ownKeys.forEach(function(key) {
3403
+ _define_property$3(target, key, source[key]);
3404
+ });
3405
+ }
3406
+ return target;
3407
+ }
3408
+ function ownKeys(object, enumerableOnly) {
3409
+ var keys = Object.keys(object);
3410
+ if (Object.getOwnPropertySymbols) {
3411
+ var symbols = Object.getOwnPropertySymbols(object);
3412
+ keys.push.apply(keys, symbols);
3413
+ }
3414
+ return keys;
3415
+ }
3416
+ function _object_spread_props(target, source) {
3417
+ source = source != null ? source : {};
3418
+ if (Object.getOwnPropertyDescriptors) {
3419
+ Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
3420
+ } else {
3421
+ ownKeys(Object(source)).forEach(function(key) {
3422
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
3423
+ });
3424
+ }
3425
+ return target;
3426
+ }
3427
+ function _possible_constructor_return$3(self, call) {
3428
+ if (call && (_type_of$3(call) === "object" || typeof call === "function")) {
3359
3429
  return call;
3360
3430
  }
3361
- return _assert_this_initialized$2(self);
3431
+ return _assert_this_initialized$3(self);
3362
3432
  }
3363
- function _set_prototype_of$2(o, p) {
3364
- _set_prototype_of$2 = Object.setPrototypeOf || function setPrototypeOf(o, p) {
3433
+ function _set_prototype_of$3(o, p) {
3434
+ _set_prototype_of$3 = Object.setPrototypeOf || function setPrototypeOf(o, p) {
3365
3435
  o.__proto__ = p;
3366
3436
  return o;
3367
3437
  };
3368
- return _set_prototype_of$2(o, p);
3438
+ return _set_prototype_of$3(o, p);
3369
3439
  }
3370
- function _type_of$2(obj) {
3440
+ function _to_consumable_array$1(arr) {
3441
+ return _array_without_holes$1(arr) || _iterable_to_array$1(arr) || _unsupported_iterable_to_array$1(arr) || _non_iterable_spread$1();
3442
+ }
3443
+ function _type_of$3(obj) {
3371
3444
  "@swc/helpers - typeof";
3372
3445
  return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
3373
3446
  }
3374
- function _is_native_reflect_construct$2() {
3447
+ function _unsupported_iterable_to_array$1(o, minLen) {
3448
+ if (!o) return;
3449
+ if (typeof o === "string") return _array_like_to_array$1(o, minLen);
3450
+ var n = Object.prototype.toString.call(o).slice(8, -1);
3451
+ if (n === "Object" && o.constructor) n = o.constructor.name;
3452
+ if (n === "Map" || n === "Set") return Array.from(n);
3453
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$1(o, minLen);
3454
+ }
3455
+ function _is_native_reflect_construct$3() {
3375
3456
  try {
3376
3457
  var result = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
3377
3458
  } catch (_) {}
3378
- return (_is_native_reflect_construct$2 = function() {
3459
+ return (_is_native_reflect_construct$3 = function() {
3379
3460
  return !!result;
3380
3461
  })();
3381
3462
  }
3382
- function _ts_generator$1(thisArg, body) {
3463
+ function _ts_generator$3(thisArg, body) {
3383
3464
  var f, y, t, _ = {
3384
3465
  label: 0,
3385
3466
  sent: function() {
@@ -3491,12 +3572,12 @@ function _ts_generator$1(thisArg, body) {
3491
3572
  * this fixture and use it to access the NestJS {@link TestingModule}, resolve providers,
3492
3573
  * and create application instances.
3493
3574
  */ var FirebaseAdminNestTestContextFixture = /*#__PURE__*/ function(AbstractChildTestContextFixture) {
3494
- _inherits$2(FirebaseAdminNestTestContextFixture, AbstractChildTestContextFixture);
3575
+ _inherits$3(FirebaseAdminNestTestContextFixture, AbstractChildTestContextFixture);
3495
3576
  function FirebaseAdminNestTestContextFixture() {
3496
- _class_call_check$2(this, FirebaseAdminNestTestContextFixture);
3497
- return _call_super$2(this, FirebaseAdminNestTestContextFixture, arguments);
3577
+ _class_call_check$3(this, FirebaseAdminNestTestContextFixture);
3578
+ return _call_super$3(this, FirebaseAdminNestTestContextFixture, arguments);
3498
3579
  }
3499
- _create_class$1(FirebaseAdminNestTestContextFixture, [
3580
+ _create_class$2(FirebaseAdminNestTestContextFixture, [
3500
3581
  {
3501
3582
  key: "nest",
3502
3583
  get: // MARK: Forwarded
@@ -3539,19 +3620,19 @@ function _ts_generator$1(thisArg, body) {
3539
3620
  * from {@link FIREBASE_ADMIN_NEST_TEST_SERVER_INSTANCE_CONFIG_TOKEN} when creating applications,
3540
3621
  * ensuring test applications mirror production setup.
3541
3622
  */ var FirebaseAdminNestTestContextInstance = /*#__PURE__*/ function(AbstractFirebaseAdminTestContextInstanceChild) {
3542
- _inherits$2(FirebaseAdminNestTestContextInstance, AbstractFirebaseAdminTestContextInstanceChild);
3623
+ _inherits$3(FirebaseAdminNestTestContextInstance, AbstractFirebaseAdminTestContextInstanceChild);
3543
3624
  function FirebaseAdminNestTestContextInstance(parent, nest) {
3544
- _class_call_check$2(this, FirebaseAdminNestTestContextInstance);
3625
+ _class_call_check$3(this, FirebaseAdminNestTestContextInstance);
3545
3626
  var _this;
3546
3627
  var _this1;
3547
- _this = _call_super$2(this, FirebaseAdminNestTestContextInstance, [
3628
+ _this = _call_super$3(this, FirebaseAdminNestTestContextInstance, [
3548
3629
  parent
3549
- ]), _this1 = _this, _define_property$2(_this, "nest", void 0), _define_property$2(_this, "nestAppPromiseGetter", function() {
3630
+ ]), _this1 = _this, _define_property$3(_this, "nest", void 0), _define_property$3(_this, "nestAppPromiseGetter", function() {
3550
3631
  return Promise.resolve(_this.nest);
3551
- }), _define_property$2(_this, "_loadInitializedNestApplication", util.cachedGetter(function() {
3552
- return _async_to_generator$1(function() {
3632
+ }), _define_property$3(_this, "_loadInitializedNestApplication", util.cachedGetter(function() {
3633
+ return _async_to_generator$3(function() {
3553
3634
  var app;
3554
- return _ts_generator$1(this, function(_state) {
3635
+ return _ts_generator$3(this, function(_state) {
3555
3636
  switch(_state.label){
3556
3637
  case 0:
3557
3638
  app = _this1.createNewNestApplication();
@@ -3572,7 +3653,7 @@ function _ts_generator$1(thisArg, body) {
3572
3653
  _this.nest = nest;
3573
3654
  return _this;
3574
3655
  }
3575
- _create_class$1(FirebaseAdminNestTestContextInstance, [
3656
+ _create_class$2(FirebaseAdminNestTestContextInstance, [
3576
3657
  {
3577
3658
  key: "createNewNestApplication",
3578
3659
  value: function createNewNestApplication() {
@@ -3655,26 +3736,20 @@ function _ts_generator$1(thisArg, body) {
3655
3736
  * This will inject all tests and sub Jest lifecycle items.
3656
3737
  */ buildTests: buildTests,
3657
3738
  initInstance: function initInstance1() {
3658
- return _async_to_generator$1(function() {
3659
- var _makeProviders, _config_defaultStorageBucket, additionalProviders, defaultStorageBucket, rootModule, options, nest, instance, e;
3660
- return _ts_generator$1(this, function(_state) {
3739
+ return _async_to_generator$3(function() {
3740
+ var _makeProviders, _config_defaultStorageBucket, additionalProviders, rootModule, options, nest, instance, e;
3741
+ return _ts_generator$3(this, function(_state) {
3661
3742
  switch(_state.label){
3662
3743
  case 0:
3663
3744
  additionalProviders = (_makeProviders = makeProviders(f.instance)) !== null && _makeProviders !== void 0 ? _makeProviders : [];
3664
- defaultStorageBucket = (_config_defaultStorageBucket = config.defaultStorageBucket) !== null && _config_defaultStorageBucket !== void 0 ? _config_defaultStorageBucket : f.instance.app.options.storageBucket;
3665
- rootModule = firebaseServer.buildNestServerRootModule({
3666
- modules: nestModules,
3745
+ rootModule = firebaseServer.buildNestServerRootModule(_object_spread_props(_object_spread$1({}, serverInstanceConfig), {
3746
+ modules: _to_consumable_array$1(util.asArray(nestModules)).concat(_to_consumable_array$1(util.asArray(serverInstanceConfig === null || serverInstanceConfig === void 0 ? void 0 : serverInstanceConfig.modules))),
3667
3747
  firebaseAppGetter: config.injectFirebaseServerAppTokenProvider ? util.asGetter(f.instance.app) : undefined,
3668
- additionalProviders: additionalProviders,
3748
+ providers: additionalProviders,
3669
3749
  envConfig: envConfig,
3670
- configureEnvService: config.injectServerEnvServiceProvider,
3671
- defaultStorageBucket: defaultStorageBucket,
3672
- forceStorageBucket: config.forceStorageBucket,
3673
- // Shared config from production — tests pick up the same global prefix, webhooks, etc.
3674
- globalApiRoutePrefix: serverInstanceConfig === null || serverInstanceConfig === void 0 ? void 0 : serverInstanceConfig.globalApiRoutePrefix,
3675
- configureWebhooks: serverInstanceConfig === null || serverInstanceConfig === void 0 ? void 0 : serverInstanceConfig.configureWebhooks,
3676
- appCheckEnabled: false // disabled in tests
3677
- }).rootModule;
3750
+ defaultStorageBucket: (_config_defaultStorageBucket = config.defaultStorageBucket) !== null && _config_defaultStorageBucket !== void 0 ? _config_defaultStorageBucket : f.instance.app.options.storageBucket,
3751
+ appCheckEnabled: false // always disabled in tests
3752
+ })).rootModule;
3678
3753
  // NOTE: https://cloud.google.com/functions/docs/writing/http#parsing_http_requests
3679
3754
  // we emulate firebase already having applied body-parser, since our testing environment
3680
3755
  // might not. In production, bodyParser is actually set false.
@@ -3741,8 +3816,8 @@ function _ts_generator$1(thisArg, body) {
3741
3816
  })();
3742
3817
  },
3743
3818
  destroyInstance: function destroyInstance(instance) {
3744
- return _async_to_generator$1(function() {
3745
- return _ts_generator$1(this, function(_state) {
3819
+ return _async_to_generator$3(function() {
3820
+ return _ts_generator$3(this, function(_state) {
3746
3821
  switch(_state.label){
3747
3822
  case 0:
3748
3823
  return [
@@ -3782,22 +3857,22 @@ function _ts_generator$1(thisArg, body) {
3782
3857
  return firebaseAdminNestContextFixture(config, firebaseAdminTestContextFactory);
3783
3858
  }
3784
3859
 
3785
- function _assert_this_initialized$1(self) {
3860
+ function _assert_this_initialized$2(self) {
3786
3861
  if (self === void 0) {
3787
3862
  throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
3788
3863
  }
3789
3864
  return self;
3790
3865
  }
3791
- function _call_super$1(_this, derived, args) {
3792
- derived = _get_prototype_of$1(derived);
3793
- return _possible_constructor_return$1(_this, _is_native_reflect_construct$1() ? Reflect.construct(derived, args || [], _get_prototype_of$1(_this).constructor) : derived.apply(_this, args));
3866
+ function _call_super$2(_this, derived, args) {
3867
+ derived = _get_prototype_of$2(derived);
3868
+ return _possible_constructor_return$2(_this, _is_native_reflect_construct$2() ? Reflect.construct(derived, args || [], _get_prototype_of$2(_this).constructor) : derived.apply(_this, args));
3794
3869
  }
3795
- function _class_call_check$1(instance, Constructor) {
3870
+ function _class_call_check$2(instance, Constructor) {
3796
3871
  if (!(instance instanceof Constructor)) {
3797
3872
  throw new TypeError("Cannot call a class as a function");
3798
3873
  }
3799
3874
  }
3800
- function _defineProperties(target, props) {
3875
+ function _defineProperties$1(target, props) {
3801
3876
  for(var i = 0; i < props.length; i++){
3802
3877
  var descriptor = props[i];
3803
3878
  descriptor.enumerable = descriptor.enumerable || false;
@@ -3806,11 +3881,11 @@ function _defineProperties(target, props) {
3806
3881
  Object.defineProperty(target, descriptor.key, descriptor);
3807
3882
  }
3808
3883
  }
3809
- function _create_class(Constructor, protoProps, staticProps) {
3810
- if (protoProps) _defineProperties(Constructor.prototype, protoProps);
3884
+ function _create_class$1(Constructor, protoProps, staticProps) {
3885
+ if (protoProps) _defineProperties$1(Constructor.prototype, protoProps);
3811
3886
  return Constructor;
3812
3887
  }
3813
- function _define_property$1(obj, key, value) {
3888
+ function _define_property$2(obj, key, value) {
3814
3889
  if (key in obj) {
3815
3890
  Object.defineProperty(obj, key, {
3816
3891
  value: value,
@@ -3823,13 +3898,13 @@ function _define_property$1(obj, key, value) {
3823
3898
  }
3824
3899
  return obj;
3825
3900
  }
3826
- function _get_prototype_of$1(o) {
3827
- _get_prototype_of$1 = Object.setPrototypeOf ? Object.getPrototypeOf : function getPrototypeOf(o) {
3901
+ function _get_prototype_of$2(o) {
3902
+ _get_prototype_of$2 = Object.setPrototypeOf ? Object.getPrototypeOf : function getPrototypeOf(o) {
3828
3903
  return o.__proto__ || Object.getPrototypeOf(o);
3829
3904
  };
3830
- return _get_prototype_of$1(o);
3905
+ return _get_prototype_of$2(o);
3831
3906
  }
3832
- function _inherits$1(subClass, superClass) {
3907
+ function _inherits$2(subClass, superClass) {
3833
3908
  if (typeof superClass !== "function" && superClass !== null) {
3834
3909
  throw new TypeError("Super expression must either be null or a function");
3835
3910
  }
@@ -3840,7 +3915,7 @@ function _inherits$1(subClass, superClass) {
3840
3915
  configurable: true
3841
3916
  }
3842
3917
  });
3843
- if (superClass) _set_prototype_of$1(subClass, superClass);
3918
+ if (superClass) _set_prototype_of$2(subClass, superClass);
3844
3919
  }
3845
3920
  function _object_spread(target) {
3846
3921
  for(var i = 1; i < arguments.length; i++){
@@ -3852,33 +3927,33 @@ function _object_spread(target) {
3852
3927
  }));
3853
3928
  }
3854
3929
  ownKeys.forEach(function(key) {
3855
- _define_property$1(target, key, source[key]);
3930
+ _define_property$2(target, key, source[key]);
3856
3931
  });
3857
3932
  }
3858
3933
  return target;
3859
3934
  }
3860
- function _possible_constructor_return$1(self, call) {
3861
- if (call && (_type_of$1(call) === "object" || typeof call === "function")) {
3935
+ function _possible_constructor_return$2(self, call) {
3936
+ if (call && (_type_of$2(call) === "object" || typeof call === "function")) {
3862
3937
  return call;
3863
3938
  }
3864
- return _assert_this_initialized$1(self);
3939
+ return _assert_this_initialized$2(self);
3865
3940
  }
3866
- function _set_prototype_of$1(o, p) {
3867
- _set_prototype_of$1 = Object.setPrototypeOf || function setPrototypeOf(o, p) {
3941
+ function _set_prototype_of$2(o, p) {
3942
+ _set_prototype_of$2 = Object.setPrototypeOf || function setPrototypeOf(o, p) {
3868
3943
  o.__proto__ = p;
3869
3944
  return o;
3870
3945
  };
3871
- return _set_prototype_of$1(o, p);
3946
+ return _set_prototype_of$2(o, p);
3872
3947
  }
3873
- function _type_of$1(obj) {
3948
+ function _type_of$2(obj) {
3874
3949
  "@swc/helpers - typeof";
3875
3950
  return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
3876
3951
  }
3877
- function _is_native_reflect_construct$1() {
3952
+ function _is_native_reflect_construct$2() {
3878
3953
  try {
3879
3954
  var result = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
3880
3955
  } catch (_) {}
3881
- return (_is_native_reflect_construct$1 = function() {
3956
+ return (_is_native_reflect_construct$2 = function() {
3882
3957
  return !!result;
3883
3958
  })();
3884
3959
  }
@@ -3917,12 +3992,12 @@ function _is_native_reflect_construct$1() {
3917
3992
  * both v1 cloud functions and gen-2 callable requests directly from the fixture, delegating
3918
3993
  * to the standalone {@link wrapCloudFunctionForNestTestsGetter} and {@link wrapCallableRequestForNestTestsGetter} helpers.
3919
3994
  */ var FirebaseAdminFunctionNestTestContextFixture = /*#__PURE__*/ function(FirebaseAdminNestTestContextFixture) {
3920
- _inherits$1(FirebaseAdminFunctionNestTestContextFixture, FirebaseAdminNestTestContextFixture);
3995
+ _inherits$2(FirebaseAdminFunctionNestTestContextFixture, FirebaseAdminNestTestContextFixture);
3921
3996
  function FirebaseAdminFunctionNestTestContextFixture() {
3922
- _class_call_check$1(this, FirebaseAdminFunctionNestTestContextFixture);
3923
- return _call_super$1(this, FirebaseAdminFunctionNestTestContextFixture, arguments);
3997
+ _class_call_check$2(this, FirebaseAdminFunctionNestTestContextFixture);
3998
+ return _call_super$2(this, FirebaseAdminFunctionNestTestContextFixture, arguments);
3924
3999
  }
3925
- _create_class(FirebaseAdminFunctionNestTestContextFixture, [
4000
+ _create_class$1(FirebaseAdminFunctionNestTestContextFixture, [
3926
4001
  {
3927
4002
  // MARK: FirebaseAdminTestContext (Forwarded)
3928
4003
  key: "wrapCloudFunctionForNestTests",
@@ -3963,12 +4038,12 @@ function _is_native_reflect_construct$1() {
3963
4038
  * {@link FirebaseAdminCloudFunctionWrapperSource} interface, delegating `fnWrapper` to
3964
4039
  * the parent {@link FirebaseAdminFunctionTestContextInstance}.
3965
4040
  */ var FirebaseAdminFunctionNestTestContextInstance = /*#__PURE__*/ function(FirebaseAdminNestTestContextInstance) {
3966
- _inherits$1(FirebaseAdminFunctionNestTestContextInstance, FirebaseAdminNestTestContextInstance);
4041
+ _inherits$2(FirebaseAdminFunctionNestTestContextInstance, FirebaseAdminNestTestContextInstance);
3967
4042
  function FirebaseAdminFunctionNestTestContextInstance() {
3968
- _class_call_check$1(this, FirebaseAdminFunctionNestTestContextInstance);
3969
- return _call_super$1(this, FirebaseAdminFunctionNestTestContextInstance, arguments);
4043
+ _class_call_check$2(this, FirebaseAdminFunctionNestTestContextInstance);
4044
+ return _call_super$2(this, FirebaseAdminFunctionNestTestContextInstance, arguments);
3970
4045
  }
3971
- _create_class(FirebaseAdminFunctionNestTestContextInstance, [
4046
+ _create_class$1(FirebaseAdminFunctionNestTestContextInstance, [
3972
4047
  {
3973
4048
  key: "fnWrapper",
3974
4049
  get: // MARK: FirebaseAdminTestContext (Forwarded)
@@ -3998,7 +4073,7 @@ function _is_native_reflect_construct$1() {
3998
4073
  /**
3999
4074
  * Empty NestJS module class used as a placeholder root module for function nest test contexts.
4000
4075
  */ var FirebaseAdminFunctionNestRootModule = function FirebaseAdminFunctionNestRootModule() {
4001
- _class_call_check$1(this, FirebaseAdminFunctionNestRootModule);
4076
+ _class_call_check$2(this, FirebaseAdminFunctionNestRootModule);
4002
4077
  };
4003
4078
  /**
4004
4079
  * Wires up a NestJS {@link TestingModule} with Cloud Function wrapping inside an existing parent fixture.
@@ -4122,7 +4197,7 @@ function describeCloudFunctionTest(label, config, buildTests) {
4122
4197
  });
4123
4198
  }
4124
4199
 
4125
- function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
4200
+ function asyncGeneratorStep$2(gen, resolve, reject, _next, _throw, key, arg) {
4126
4201
  try {
4127
4202
  var info = gen[key](arg);
4128
4203
  var value = info.value;
@@ -4136,22 +4211,22 @@ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
4136
4211
  Promise.resolve(value).then(_next, _throw);
4137
4212
  }
4138
4213
  }
4139
- function _async_to_generator(fn) {
4214
+ function _async_to_generator$2(fn) {
4140
4215
  return function() {
4141
4216
  var self = this, args = arguments;
4142
4217
  return new Promise(function(resolve, reject) {
4143
4218
  var gen = fn.apply(self, args);
4144
4219
  function _next(value) {
4145
- asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
4220
+ asyncGeneratorStep$2(gen, resolve, reject, _next, _throw, "next", value);
4146
4221
  }
4147
4222
  function _throw(err) {
4148
- asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
4223
+ asyncGeneratorStep$2(gen, resolve, reject, _next, _throw, "throw", err);
4149
4224
  }
4150
4225
  _next(undefined);
4151
4226
  });
4152
4227
  };
4153
4228
  }
4154
- function _ts_generator(thisArg, body) {
4229
+ function _ts_generator$2(thisArg, body) {
4155
4230
  var f, y, t, _ = {
4156
4231
  label: 0,
4157
4232
  sent: function() {
@@ -4290,9 +4365,9 @@ function _ts_generator(thisArg, body) {
4290
4365
  });
4291
4366
  describe('firestore', function() {
4292
4367
  it('should interact with the firestore.', function() {
4293
- return _async_to_generator(function() {
4368
+ return _async_to_generator$2(function() {
4294
4369
  var document, setData, exists, snapshot, data;
4295
- return _ts_generator(this, function(_state) {
4370
+ return _ts_generator$2(this, function(_state) {
4296
4371
  switch(_state.label){
4297
4372
  case 0:
4298
4373
  document = collection.documentAccessor().newDocument();
@@ -4331,22 +4406,22 @@ function _ts_generator(thisArg, body) {
4331
4406
  });
4332
4407
  }
4333
4408
 
4334
- function _assert_this_initialized(self) {
4409
+ function _assert_this_initialized$1(self) {
4335
4410
  if (self === void 0) {
4336
4411
  throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
4337
4412
  }
4338
4413
  return self;
4339
4414
  }
4340
- function _call_super(_this, derived, args) {
4341
- derived = _get_prototype_of(derived);
4342
- return _possible_constructor_return(_this, _is_native_reflect_construct() ? Reflect.construct(derived, args || [], _get_prototype_of(_this).constructor) : derived.apply(_this, args));
4415
+ function _call_super$1(_this, derived, args) {
4416
+ derived = _get_prototype_of$1(derived);
4417
+ return _possible_constructor_return$1(_this, _is_native_reflect_construct$1() ? Reflect.construct(derived, args || [], _get_prototype_of$1(_this).constructor) : derived.apply(_this, args));
4343
4418
  }
4344
- function _class_call_check(instance, Constructor) {
4419
+ function _class_call_check$1(instance, Constructor) {
4345
4420
  if (!(instance instanceof Constructor)) {
4346
4421
  throw new TypeError("Cannot call a class as a function");
4347
4422
  }
4348
4423
  }
4349
- function _define_property(obj, key, value) {
4424
+ function _define_property$1(obj, key, value) {
4350
4425
  if (key in obj) {
4351
4426
  Object.defineProperty(obj, key, {
4352
4427
  value: value,
@@ -4359,13 +4434,13 @@ function _define_property(obj, key, value) {
4359
4434
  }
4360
4435
  return obj;
4361
4436
  }
4362
- function _get_prototype_of(o) {
4363
- _get_prototype_of = Object.setPrototypeOf ? Object.getPrototypeOf : function getPrototypeOf(o) {
4437
+ function _get_prototype_of$1(o) {
4438
+ _get_prototype_of$1 = Object.setPrototypeOf ? Object.getPrototypeOf : function getPrototypeOf(o) {
4364
4439
  return o.__proto__ || Object.getPrototypeOf(o);
4365
4440
  };
4366
- return _get_prototype_of(o);
4441
+ return _get_prototype_of$1(o);
4367
4442
  }
4368
- function _inherits(subClass, superClass) {
4443
+ function _inherits$1(subClass, superClass) {
4369
4444
  if (typeof superClass !== "function" && superClass !== null) {
4370
4445
  throw new TypeError("Super expression must either be null or a function");
4371
4446
  }
@@ -4376,7 +4451,7 @@ function _inherits(subClass, superClass) {
4376
4451
  configurable: true
4377
4452
  }
4378
4453
  });
4379
- if (superClass) _set_prototype_of(subClass, superClass);
4454
+ if (superClass) _set_prototype_of$1(subClass, superClass);
4380
4455
  }
4381
4456
  function _instanceof(left, right) {
4382
4457
  if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
@@ -4385,42 +4460,42 @@ function _instanceof(left, right) {
4385
4460
  return left instanceof right;
4386
4461
  }
4387
4462
  }
4388
- function _possible_constructor_return(self, call) {
4389
- if (call && (_type_of(call) === "object" || typeof call === "function")) {
4463
+ function _possible_constructor_return$1(self, call) {
4464
+ if (call && (_type_of$1(call) === "object" || typeof call === "function")) {
4390
4465
  return call;
4391
4466
  }
4392
- return _assert_this_initialized(self);
4467
+ return _assert_this_initialized$1(self);
4393
4468
  }
4394
- function _set_prototype_of(o, p) {
4395
- _set_prototype_of = Object.setPrototypeOf || function setPrototypeOf(o, p) {
4469
+ function _set_prototype_of$1(o, p) {
4470
+ _set_prototype_of$1 = Object.setPrototypeOf || function setPrototypeOf(o, p) {
4396
4471
  o.__proto__ = p;
4397
4472
  return o;
4398
4473
  };
4399
- return _set_prototype_of(o, p);
4474
+ return _set_prototype_of$1(o, p);
4400
4475
  }
4401
- function _type_of(obj) {
4476
+ function _type_of$1(obj) {
4402
4477
  "@swc/helpers - typeof";
4403
4478
  return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
4404
4479
  }
4405
- function _is_native_reflect_construct() {
4480
+ function _is_native_reflect_construct$1() {
4406
4481
  try {
4407
4482
  var result = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
4408
4483
  } catch (_) {}
4409
- return (_is_native_reflect_construct = function() {
4484
+ return (_is_native_reflect_construct$1 = function() {
4410
4485
  return !!result;
4411
4486
  })();
4412
4487
  }
4413
4488
  /**
4414
4489
  * Error thrown when the error type was different than the expected type.
4415
4490
  */ var ExpectedHttpErrorWithSpecificServerErrorCode = /*#__PURE__*/ function(BaseError) {
4416
- _inherits(ExpectedHttpErrorWithSpecificServerErrorCode, BaseError);
4491
+ _inherits$1(ExpectedHttpErrorWithSpecificServerErrorCode, BaseError);
4417
4492
  function ExpectedHttpErrorWithSpecificServerErrorCode(httpError, expectedErrorCode) {
4418
- _class_call_check(this, ExpectedHttpErrorWithSpecificServerErrorCode);
4493
+ _class_call_check$1(this, ExpectedHttpErrorWithSpecificServerErrorCode);
4419
4494
  var _this;
4420
4495
  var code = httpError.details.code;
4421
- _this = _call_super(this, ExpectedHttpErrorWithSpecificServerErrorCode, [
4496
+ _this = _call_super$1(this, ExpectedHttpErrorWithSpecificServerErrorCode, [
4422
4497
  'Expected HttpError with an error code of "'.concat(expectedErrorCode, '", but recieved "').concat(code, '" instead.')
4423
- ]), _define_property(_this, "httpError", void 0), _define_property(_this, "expectedErrorCode", void 0);
4498
+ ]), _define_property$1(_this, "httpError", void 0), _define_property$1(_this, "expectedErrorCode", void 0);
4424
4499
  _this.httpError = httpError;
4425
4500
  _this.expectedErrorCode = expectedErrorCode;
4426
4501
  return _this;
@@ -4452,10 +4527,10 @@ function _is_native_reflect_construct() {
4452
4527
  /**
4453
4528
  * @deprecated Use ExpectedHttpErrorWithSpecificServerErrorCode from shared instead. This is kept for backwards compatibility.
4454
4529
  */ var JestExpectedHttpErrorWithSpecificServerErrorCode = /*#__PURE__*/ function(ExpectedHttpErrorWithSpecificServerErrorCode) {
4455
- _inherits(JestExpectedHttpErrorWithSpecificServerErrorCode, ExpectedHttpErrorWithSpecificServerErrorCode);
4530
+ _inherits$1(JestExpectedHttpErrorWithSpecificServerErrorCode, ExpectedHttpErrorWithSpecificServerErrorCode);
4456
4531
  function JestExpectedHttpErrorWithSpecificServerErrorCode() {
4457
- _class_call_check(this, JestExpectedHttpErrorWithSpecificServerErrorCode);
4458
- return _call_super(this, JestExpectedHttpErrorWithSpecificServerErrorCode, arguments);
4532
+ _class_call_check$1(this, JestExpectedHttpErrorWithSpecificServerErrorCode);
4533
+ return _call_super$1(this, JestExpectedHttpErrorWithSpecificServerErrorCode, arguments);
4459
4534
  }
4460
4535
  return JestExpectedHttpErrorWithSpecificServerErrorCode;
4461
4536
  }(ExpectedHttpErrorWithSpecificServerErrorCode);
@@ -4477,6 +4552,886 @@ function _is_native_reflect_construct() {
4477
4552
  * Uses @google-cloud/firestore
4478
4553
  */ var dbxComponentsAdminTestWithMockItemCollection = test$1.testWithMockItemCollectionFixture()(adminFirestoreFactory);
4479
4554
 
4555
+ function _array_like_to_array(arr, len) {
4556
+ if (len == null || len > arr.length) len = arr.length;
4557
+ for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
4558
+ return arr2;
4559
+ }
4560
+ function _array_with_holes(arr) {
4561
+ if (Array.isArray(arr)) return arr;
4562
+ }
4563
+ function _array_without_holes(arr) {
4564
+ if (Array.isArray(arr)) return _array_like_to_array(arr);
4565
+ }
4566
+ function asyncGeneratorStep$1(gen, resolve, reject, _next, _throw, key, arg) {
4567
+ try {
4568
+ var info = gen[key](arg);
4569
+ var value = info.value;
4570
+ } catch (error) {
4571
+ reject(error);
4572
+ return;
4573
+ }
4574
+ if (info.done) {
4575
+ resolve(value);
4576
+ } else {
4577
+ Promise.resolve(value).then(_next, _throw);
4578
+ }
4579
+ }
4580
+ function _async_to_generator$1(fn) {
4581
+ return function() {
4582
+ var self = this, args = arguments;
4583
+ return new Promise(function(resolve, reject) {
4584
+ var gen = fn.apply(self, args);
4585
+ function _next(value) {
4586
+ asyncGeneratorStep$1(gen, resolve, reject, _next, _throw, "next", value);
4587
+ }
4588
+ function _throw(err) {
4589
+ asyncGeneratorStep$1(gen, resolve, reject, _next, _throw, "throw", err);
4590
+ }
4591
+ _next(undefined);
4592
+ });
4593
+ };
4594
+ }
4595
+ function _iterable_to_array(iter) {
4596
+ if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
4597
+ }
4598
+ function _iterable_to_array_limit(arr, i) {
4599
+ var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
4600
+ if (_i == null) return;
4601
+ var _arr = [];
4602
+ var _n = true;
4603
+ var _d = false;
4604
+ var _s, _e;
4605
+ try {
4606
+ for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
4607
+ _arr.push(_s.value);
4608
+ if (i && _arr.length === i) break;
4609
+ }
4610
+ } catch (err) {
4611
+ _d = true;
4612
+ _e = err;
4613
+ } finally{
4614
+ try {
4615
+ if (!_n && _i["return"] != null) _i["return"]();
4616
+ } finally{
4617
+ if (_d) throw _e;
4618
+ }
4619
+ }
4620
+ return _arr;
4621
+ }
4622
+ function _non_iterable_rest() {
4623
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
4624
+ }
4625
+ function _non_iterable_spread() {
4626
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
4627
+ }
4628
+ function _sliced_to_array(arr, i) {
4629
+ return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
4630
+ }
4631
+ function _to_consumable_array(arr) {
4632
+ return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
4633
+ }
4634
+ function _unsupported_iterable_to_array(o, minLen) {
4635
+ if (!o) return;
4636
+ if (typeof o === "string") return _array_like_to_array(o, minLen);
4637
+ var n = Object.prototype.toString.call(o).slice(8, -1);
4638
+ if (n === "Object" && o.constructor) n = o.constructor.name;
4639
+ if (n === "Map" || n === "Set") return Array.from(n);
4640
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
4641
+ }
4642
+ function _ts_generator$1(thisArg, body) {
4643
+ var f, y, t, _ = {
4644
+ label: 0,
4645
+ sent: function() {
4646
+ if (t[0] & 1) throw t[1];
4647
+ return t[1];
4648
+ },
4649
+ trys: [],
4650
+ ops: []
4651
+ }, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype), d = Object.defineProperty;
4652
+ return d(g, "next", {
4653
+ value: verb(0)
4654
+ }), d(g, "throw", {
4655
+ value: verb(1)
4656
+ }), d(g, "return", {
4657
+ value: verb(2)
4658
+ }), typeof Symbol === "function" && d(g, Symbol.iterator, {
4659
+ value: function() {
4660
+ return this;
4661
+ }
4662
+ }), g;
4663
+ function verb(n) {
4664
+ return function(v) {
4665
+ return step([
4666
+ n,
4667
+ v
4668
+ ]);
4669
+ };
4670
+ }
4671
+ function step(op) {
4672
+ if (f) throw new TypeError("Generator is already executing.");
4673
+ while(g && (g = 0, op[0] && (_ = 0)), _)try {
4674
+ 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;
4675
+ if (y = 0, t) op = [
4676
+ op[0] & 2,
4677
+ t.value
4678
+ ];
4679
+ switch(op[0]){
4680
+ case 0:
4681
+ case 1:
4682
+ t = op;
4683
+ break;
4684
+ case 4:
4685
+ _.label++;
4686
+ return {
4687
+ value: op[1],
4688
+ done: false
4689
+ };
4690
+ case 5:
4691
+ _.label++;
4692
+ y = op[1];
4693
+ op = [
4694
+ 0
4695
+ ];
4696
+ continue;
4697
+ case 7:
4698
+ op = _.ops.pop();
4699
+ _.trys.pop();
4700
+ continue;
4701
+ default:
4702
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
4703
+ _ = 0;
4704
+ continue;
4705
+ }
4706
+ if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
4707
+ _.label = op[1];
4708
+ break;
4709
+ }
4710
+ if (op[0] === 6 && _.label < t[1]) {
4711
+ _.label = t[1];
4712
+ t = op;
4713
+ break;
4714
+ }
4715
+ if (t && _.label < t[2]) {
4716
+ _.label = t[2];
4717
+ _.ops.push(op);
4718
+ break;
4719
+ }
4720
+ if (t[2]) _.ops.pop();
4721
+ _.trys.pop();
4722
+ continue;
4723
+ }
4724
+ op = body.call(thisArg, _);
4725
+ } catch (e) {
4726
+ op = [
4727
+ 6,
4728
+ e
4729
+ ];
4730
+ y = 0;
4731
+ } finally{
4732
+ f = t = 0;
4733
+ }
4734
+ if (op[0] & 5) throw op[1];
4735
+ return {
4736
+ value: op[0] ? op[1] : void 0,
4737
+ done: true
4738
+ };
4739
+ }
4740
+ }
4741
+ // MARK: Helpers
4742
+ /**
4743
+ * Creates a Firebase ID token for the given UID that the Auth emulator will accept.
4744
+ *
4745
+ * The Auth emulator accepts unsigned JWTs (alg: "none") as long as the audience
4746
+ * matches the project ID the Admin SDK was initialized with.
4747
+ */ function createTestIdToken(nestApp, uid) {
4748
+ return _async_to_generator$1(function() {
4749
+ var accountService, projectId, now, payload, header, body;
4750
+ return _ts_generator$1(this, function(_state) {
4751
+ accountService = nestApp.get(oidc.OidcAccountService);
4752
+ projectId = accountService.authService.auth.app.options.projectId;
4753
+ now = util.unixDateTimeSecondsNumberForNow();
4754
+ payload = {
4755
+ iss: "https://securetoken.google.com/".concat(projectId),
4756
+ aud: projectId,
4757
+ auth_time: now,
4758
+ user_id: uid,
4759
+ sub: uid,
4760
+ iat: now,
4761
+ exp: now + 3600,
4762
+ firebase: {
4763
+ identities: {},
4764
+ sign_in_provider: 'custom'
4765
+ }
4766
+ };
4767
+ header = Buffer.from(JSON.stringify({
4768
+ alg: 'none',
4769
+ typ: 'JWT'
4770
+ })).toString('base64url');
4771
+ body = Buffer.from(JSON.stringify(payload)).toString('base64url');
4772
+ return [
4773
+ 2,
4774
+ "".concat(header, ".").concat(body, ".")
4775
+ ];
4776
+ });
4777
+ })();
4778
+ }
4779
+ /**
4780
+ * Extracts the interaction UID from a redirect to the login/consent frontend URL.
4781
+ */ function extractInteractionUid(res) {
4782
+ var location = res.headers['location'];
4783
+ var url = location.startsWith('/') ? new URL(location, 'http://localhost') : new URL(location);
4784
+ return url.searchParams.get('uid');
4785
+ }
4786
+ /**
4787
+ * Cookie jar helpers for the OAuth flow.
4788
+ *
4789
+ * oidc-provider scopes cookies to specific paths, so supertest.agent()
4790
+ * won't forward them between /oidc/* and /interaction/* controllers.
4791
+ */ function createCookieJar() {
4792
+ var cookieJar = new Map();
4793
+ function collectCookies(res) {
4794
+ var setCookies = res.headers['set-cookie'];
4795
+ if (setCookies) {
4796
+ var items = Array.isArray(setCookies) ? setCookies : [
4797
+ setCookies
4798
+ ];
4799
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
4800
+ try {
4801
+ for(var _iterator = items[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
4802
+ var cookie = _step.value;
4803
+ var _cookie_split = _sliced_to_array(cookie.split(';'), 1), nameValue = _cookie_split[0];
4804
+ var _nameValue_split = _sliced_to_array(nameValue.split('='), 1), name = _nameValue_split[0];
4805
+ cookieJar.set(name, nameValue);
4806
+ }
4807
+ } catch (err) {
4808
+ _didIteratorError = true;
4809
+ _iteratorError = err;
4810
+ } finally{
4811
+ try {
4812
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
4813
+ _iterator.return();
4814
+ }
4815
+ } finally{
4816
+ if (_didIteratorError) {
4817
+ throw _iteratorError;
4818
+ }
4819
+ }
4820
+ }
4821
+ }
4822
+ }
4823
+ function cookieHeader() {
4824
+ return _to_consumable_array(cookieJar.values()).join('; ');
4825
+ }
4826
+ return {
4827
+ collectCookies: collectCookies,
4828
+ cookieHeader: cookieHeader
4829
+ };
4830
+ }
4831
+ /**
4832
+ * Resolves the scopes string from config, or falls back to all registered scopes
4833
+ * from `OidcAccountService.allRegisteredScopes`.
4834
+ */ function resolveScopes(nestApp, config) {
4835
+ return _async_to_generator$1(function() {
4836
+ var accountService;
4837
+ return _ts_generator$1(this, function(_state) {
4838
+ if (config === null || config === void 0 ? void 0 : config.scopes) {
4839
+ return [
4840
+ 2,
4841
+ config.scopes
4842
+ ];
4843
+ }
4844
+ accountService = nestApp.get(oidc.OidcAccountService);
4845
+ return [
4846
+ 2,
4847
+ Object.keys(accountService.providerConfig.claims).join(' ')
4848
+ ];
4849
+ });
4850
+ })();
4851
+ }
4852
+ // MARK: Flow
4853
+ /**
4854
+ * Performs the full OAuth authorization code flow with PKCE and returns tokens.
4855
+ *
4856
+ * Steps: create client → PKCE → auth redirect → login → consent → code exchange → token
4857
+ */ function performFullOAuthFlow(server, oidcClientService, nestApp, uid, config) {
4858
+ return _async_to_generator$1(function() {
4859
+ var _ref, _ref1, _ref2, _createCookieJar, collectCookies, cookieHeader, redirectUri, clientName, tokenEndpointAuthMethod, scopes, _ref3, client_id, client_secret, codeVerifier, codeChallenge, authRes, loginUid, idToken, loginRes, resumeAfterLoginPath, consentRedirectRes, consentUid, consentRes, resumeAfterConsentPath, callbackRedirectRes, callbackUrl, authorizationCode, tokenRes;
4860
+ return _ts_generator$1(this, function(_state) {
4861
+ switch(_state.label){
4862
+ case 0:
4863
+ _createCookieJar = createCookieJar(), collectCookies = _createCookieJar.collectCookies, cookieHeader = _createCookieJar.cookieHeader;
4864
+ redirectUri = (_ref = config === null || config === void 0 ? void 0 : config.redirectUri) !== null && _ref !== void 0 ? _ref : 'https://example.com/callback';
4865
+ clientName = (_ref1 = config === null || config === void 0 ? void 0 : config.clientName) !== null && _ref1 !== void 0 ? _ref1 : 'test-oauth-context';
4866
+ tokenEndpointAuthMethod = (_ref2 = config === null || config === void 0 ? void 0 : config.tokenEndpointAuthMethod) !== null && _ref2 !== void 0 ? _ref2 : 'client_secret_post';
4867
+ return [
4868
+ 4,
4869
+ resolveScopes(nestApp, config)
4870
+ ];
4871
+ case 1:
4872
+ scopes = _state.sent();
4873
+ return [
4874
+ 4,
4875
+ oidcClientService.createClient({
4876
+ client_name: clientName,
4877
+ redirect_uris: [
4878
+ redirectUri
4879
+ ],
4880
+ token_endpoint_auth_method: tokenEndpointAuthMethod
4881
+ })
4882
+ ];
4883
+ case 2:
4884
+ _ref3 = _state.sent(), client_id = _ref3.client_id, client_secret = _ref3.client_secret;
4885
+ // 2. Generate PKCE code_verifier and code_challenge
4886
+ codeVerifier = node_crypto.randomBytes(32).toString('base64url');
4887
+ codeChallenge = node_crypto.createHash('sha256').update(codeVerifier).digest('base64url');
4888
+ return [
4889
+ 4,
4890
+ request(server).get('/oidc/auth').query({
4891
+ client_id: client_id,
4892
+ redirect_uri: redirectUri,
4893
+ response_type: 'code',
4894
+ scope: scopes,
4895
+ code_challenge: codeChallenge,
4896
+ code_challenge_method: 'S256',
4897
+ state: 'test-state',
4898
+ nonce: 'test-nonce'
4899
+ }).redirects(0)
4900
+ ];
4901
+ case 3:
4902
+ authRes = _state.sent();
4903
+ collectCookies(authRes);
4904
+ loginUid = extractInteractionUid(authRes);
4905
+ return [
4906
+ 4,
4907
+ createTestIdToken(nestApp, uid)
4908
+ ];
4909
+ case 4:
4910
+ idToken = _state.sent();
4911
+ return [
4912
+ 4,
4913
+ request(server).post("/interaction/".concat(loginUid, "/login")).set('Cookie', cookieHeader()).send({
4914
+ idToken: idToken
4915
+ })
4916
+ ];
4917
+ case 5:
4918
+ loginRes = _state.sent();
4919
+ // 5. Resume after login → consent redirect
4920
+ resumeAfterLoginPath = new URL(loginRes.body.redirectTo).pathname + new URL(loginRes.body.redirectTo).search;
4921
+ return [
4922
+ 4,
4923
+ request(server).get(resumeAfterLoginPath).set('Cookie', cookieHeader()).redirects(0)
4924
+ ];
4925
+ case 6:
4926
+ consentRedirectRes = _state.sent();
4927
+ collectCookies(consentRedirectRes);
4928
+ consentUid = extractInteractionUid(consentRedirectRes);
4929
+ return [
4930
+ 4,
4931
+ request(server).post("/interaction/".concat(consentUid, "/consent")).set('Cookie', cookieHeader()).send({
4932
+ idToken: idToken,
4933
+ approved: true
4934
+ })
4935
+ ];
4936
+ case 7:
4937
+ consentRes = _state.sent();
4938
+ // 7. Follow resume redirect → callback with authorization code
4939
+ resumeAfterConsentPath = new URL(consentRes.body.redirectTo).pathname + new URL(consentRes.body.redirectTo).search;
4940
+ return [
4941
+ 4,
4942
+ request(server).get(resumeAfterConsentPath).set('Cookie', cookieHeader()).redirects(0)
4943
+ ];
4944
+ case 8:
4945
+ callbackRedirectRes = _state.sent();
4946
+ collectCookies(callbackRedirectRes);
4947
+ callbackUrl = new URL(callbackRedirectRes.headers['location']);
4948
+ authorizationCode = callbackUrl.searchParams.get('code');
4949
+ return [
4950
+ 4,
4951
+ request(server).post('/oidc/token').set('Cookie', cookieHeader()).type('form').send({
4952
+ grant_type: 'authorization_code',
4953
+ code: authorizationCode,
4954
+ redirect_uri: redirectUri,
4955
+ client_id: client_id,
4956
+ client_secret: client_secret,
4957
+ code_verifier: codeVerifier
4958
+ })
4959
+ ];
4960
+ case 9:
4961
+ tokenRes = _state.sent();
4962
+ if (!tokenRes.body.access_token) {
4963
+ throw new Error("OAuth token exchange failed (status ".concat(tokenRes.status, "): ").concat(JSON.stringify(tokenRes.body)));
4964
+ }
4965
+ return [
4966
+ 2,
4967
+ {
4968
+ accessToken: tokenRes.body.access_token,
4969
+ idToken: tokenRes.body.id_token
4970
+ }
4971
+ ];
4972
+ }
4973
+ });
4974
+ })();
4975
+ }
4976
+ /**
4977
+ * Higher-level helper that resolves OIDC services from the NestJS DI container,
4978
+ * rotates JWKS keys, and then performs the full OAuth flow.
4979
+ *
4980
+ * This avoids callers needing to import from `@dereekb/firebase-server/oidc` directly.
4981
+ */ function setupAndPerformFullOAuthFlow(nestApp, uid, config) {
4982
+ return _async_to_generator$1(function() {
4983
+ var jwksService, oidcClientService, server;
4984
+ return _ts_generator$1(this, function(_state) {
4985
+ switch(_state.label){
4986
+ case 0:
4987
+ // Rotate JWKS keys so JWKS endpoints work
4988
+ jwksService = nestApp.get(oidc.JwksService);
4989
+ return [
4990
+ 4,
4991
+ jwksService.rotateKeys()
4992
+ ];
4993
+ case 1:
4994
+ _state.sent();
4995
+ // Resolve OidcClientService from DI
4996
+ oidcClientService = nestApp.get(oidc.OidcClientService);
4997
+ server = nestApp.getHttpServer();
4998
+ return [
4999
+ 2,
5000
+ performFullOAuthFlow(server, oidcClientService, nestApp, uid, config)
5001
+ ];
5002
+ }
5003
+ });
5004
+ })();
5005
+ }
5006
+
5007
+ function _assert_this_initialized(self) {
5008
+ if (self === void 0) {
5009
+ throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
5010
+ }
5011
+ return self;
5012
+ }
5013
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
5014
+ try {
5015
+ var info = gen[key](arg);
5016
+ var value = info.value;
5017
+ } catch (error) {
5018
+ reject(error);
5019
+ return;
5020
+ }
5021
+ if (info.done) {
5022
+ resolve(value);
5023
+ } else {
5024
+ Promise.resolve(value).then(_next, _throw);
5025
+ }
5026
+ }
5027
+ function _async_to_generator(fn) {
5028
+ return function() {
5029
+ var self = this, args = arguments;
5030
+ return new Promise(function(resolve, reject) {
5031
+ var gen = fn.apply(self, args);
5032
+ function _next(value) {
5033
+ asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
5034
+ }
5035
+ function _throw(err) {
5036
+ asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
5037
+ }
5038
+ _next(undefined);
5039
+ });
5040
+ };
5041
+ }
5042
+ function _call_super(_this, derived, args) {
5043
+ derived = _get_prototype_of(derived);
5044
+ return _possible_constructor_return(_this, _is_native_reflect_construct() ? Reflect.construct(derived, args || [], _get_prototype_of(_this).constructor) : derived.apply(_this, args));
5045
+ }
5046
+ function _class_call_check(instance, Constructor) {
5047
+ if (!(instance instanceof Constructor)) {
5048
+ throw new TypeError("Cannot call a class as a function");
5049
+ }
5050
+ }
5051
+ function _defineProperties(target, props) {
5052
+ for(var i = 0; i < props.length; i++){
5053
+ var descriptor = props[i];
5054
+ descriptor.enumerable = descriptor.enumerable || false;
5055
+ descriptor.configurable = true;
5056
+ if ("value" in descriptor) descriptor.writable = true;
5057
+ Object.defineProperty(target, descriptor.key, descriptor);
5058
+ }
5059
+ }
5060
+ function _create_class(Constructor, protoProps, staticProps) {
5061
+ if (protoProps) _defineProperties(Constructor.prototype, protoProps);
5062
+ return Constructor;
5063
+ }
5064
+ function _define_property(obj, key, value) {
5065
+ if (key in obj) {
5066
+ Object.defineProperty(obj, key, {
5067
+ value: value,
5068
+ enumerable: true,
5069
+ configurable: true,
5070
+ writable: true
5071
+ });
5072
+ } else {
5073
+ obj[key] = value;
5074
+ }
5075
+ return obj;
5076
+ }
5077
+ function _get_prototype_of(o) {
5078
+ _get_prototype_of = Object.setPrototypeOf ? Object.getPrototypeOf : function getPrototypeOf(o) {
5079
+ return o.__proto__ || Object.getPrototypeOf(o);
5080
+ };
5081
+ return _get_prototype_of(o);
5082
+ }
5083
+ function _inherits(subClass, superClass) {
5084
+ if (typeof superClass !== "function" && superClass !== null) {
5085
+ throw new TypeError("Super expression must either be null or a function");
5086
+ }
5087
+ subClass.prototype = Object.create(superClass && superClass.prototype, {
5088
+ constructor: {
5089
+ value: subClass,
5090
+ writable: true,
5091
+ configurable: true
5092
+ }
5093
+ });
5094
+ if (superClass) _set_prototype_of(subClass, superClass);
5095
+ }
5096
+ function _object_without_properties(source, excluded) {
5097
+ if (source == null) return {};
5098
+ var target = {}, sourceKeys, key, i;
5099
+ if (typeof Reflect !== "undefined" && Reflect.ownKeys) {
5100
+ sourceKeys = Reflect.ownKeys(Object(source));
5101
+ for(i = 0; i < sourceKeys.length; i++){
5102
+ key = sourceKeys[i];
5103
+ if (excluded.indexOf(key) >= 0) continue;
5104
+ if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
5105
+ target[key] = source[key];
5106
+ }
5107
+ return target;
5108
+ }
5109
+ target = _object_without_properties_loose(source, excluded);
5110
+ if (Object.getOwnPropertySymbols) {
5111
+ sourceKeys = Object.getOwnPropertySymbols(source);
5112
+ for(i = 0; i < sourceKeys.length; i++){
5113
+ key = sourceKeys[i];
5114
+ if (excluded.indexOf(key) >= 0) continue;
5115
+ if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
5116
+ target[key] = source[key];
5117
+ }
5118
+ }
5119
+ return target;
5120
+ }
5121
+ function _object_without_properties_loose(source, excluded) {
5122
+ if (source == null) return {};
5123
+ var target = {}, sourceKeys = Object.getOwnPropertyNames(source), key, i;
5124
+ for(i = 0; i < sourceKeys.length; i++){
5125
+ key = sourceKeys[i];
5126
+ if (excluded.indexOf(key) >= 0) continue;
5127
+ if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
5128
+ target[key] = source[key];
5129
+ }
5130
+ return target;
5131
+ }
5132
+ function _possible_constructor_return(self, call) {
5133
+ if (call && (_type_of(call) === "object" || typeof call === "function")) {
5134
+ return call;
5135
+ }
5136
+ return _assert_this_initialized(self);
5137
+ }
5138
+ function _set_prototype_of(o, p) {
5139
+ _set_prototype_of = Object.setPrototypeOf || function setPrototypeOf(o, p) {
5140
+ o.__proto__ = p;
5141
+ return o;
5142
+ };
5143
+ return _set_prototype_of(o, p);
5144
+ }
5145
+ function _type_of(obj) {
5146
+ "@swc/helpers - typeof";
5147
+ return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
5148
+ }
5149
+ function _is_native_reflect_construct() {
5150
+ try {
5151
+ var result = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
5152
+ } catch (_) {}
5153
+ return (_is_native_reflect_construct = function() {
5154
+ return !!result;
5155
+ })();
5156
+ }
5157
+ function _ts_generator(thisArg, body) {
5158
+ var f, y, t, _ = {
5159
+ label: 0,
5160
+ sent: function() {
5161
+ if (t[0] & 1) throw t[1];
5162
+ return t[1];
5163
+ },
5164
+ trys: [],
5165
+ ops: []
5166
+ }, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype), d = Object.defineProperty;
5167
+ return d(g, "next", {
5168
+ value: verb(0)
5169
+ }), d(g, "throw", {
5170
+ value: verb(1)
5171
+ }), d(g, "return", {
5172
+ value: verb(2)
5173
+ }), typeof Symbol === "function" && d(g, Symbol.iterator, {
5174
+ value: function() {
5175
+ return this;
5176
+ }
5177
+ }), g;
5178
+ function verb(n) {
5179
+ return function(v) {
5180
+ return step([
5181
+ n,
5182
+ v
5183
+ ]);
5184
+ };
5185
+ }
5186
+ function step(op) {
5187
+ if (f) throw new TypeError("Generator is already executing.");
5188
+ while(g && (g = 0, op[0] && (_ = 0)), _)try {
5189
+ 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;
5190
+ if (y = 0, t) op = [
5191
+ op[0] & 2,
5192
+ t.value
5193
+ ];
5194
+ switch(op[0]){
5195
+ case 0:
5196
+ case 1:
5197
+ t = op;
5198
+ break;
5199
+ case 4:
5200
+ _.label++;
5201
+ return {
5202
+ value: op[1],
5203
+ done: false
5204
+ };
5205
+ case 5:
5206
+ _.label++;
5207
+ y = op[1];
5208
+ op = [
5209
+ 0
5210
+ ];
5211
+ continue;
5212
+ case 7:
5213
+ op = _.ops.pop();
5214
+ _.trys.pop();
5215
+ continue;
5216
+ default:
5217
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
5218
+ _ = 0;
5219
+ continue;
5220
+ }
5221
+ if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
5222
+ _.label = op[1];
5223
+ break;
5224
+ }
5225
+ if (op[0] === 6 && _.label < t[1]) {
5226
+ _.label = t[1];
5227
+ t = op;
5228
+ break;
5229
+ }
5230
+ if (t && _.label < t[2]) {
5231
+ _.label = t[2];
5232
+ _.ops.push(op);
5233
+ break;
5234
+ }
5235
+ if (t[2]) _.ops.pop();
5236
+ _.trys.pop();
5237
+ continue;
5238
+ }
5239
+ op = body.call(thisArg, _);
5240
+ } catch (e) {
5241
+ op = [
5242
+ 6,
5243
+ e
5244
+ ];
5245
+ y = 0;
5246
+ } finally{
5247
+ f = t = 0;
5248
+ }
5249
+ if (op[0] & 5) throw op[1];
5250
+ return {
5251
+ value: op[0] ? op[1] : void 0,
5252
+ done: true
5253
+ };
5254
+ }
5255
+ }
5256
+ // MARK: Instance
5257
+ /**
5258
+ * Instance holding authenticated OAuth state for a single test.
5259
+ */ var OAuthAuthorizedSuperTestInstance = /*#__PURE__*/ function() {
5260
+ function OAuthAuthorizedSuperTestInstance(server, accessToken) {
5261
+ _class_call_check(this, OAuthAuthorizedSuperTestInstance);
5262
+ _define_property(this, "server", void 0);
5263
+ _define_property(this, "accessToken", void 0);
5264
+ this.server = server;
5265
+ this.accessToken = accessToken;
5266
+ }
5267
+ _create_class(OAuthAuthorizedSuperTestInstance, [
5268
+ {
5269
+ /**
5270
+ * Apply Bearer auth to a supertest request.
5271
+ *
5272
+ * @example
5273
+ * ```typescript
5274
+ * await oauth.withAuth(request(oauth.server).get('/oidc/me')).expect(200);
5275
+ * await oauth.withAuth(request(oauth.server).post('/api/model/call')).send(body).expect(200);
5276
+ * ```
5277
+ */ key: "withAuth",
5278
+ value: function withAuth(test) {
5279
+ return test.set('Authorization', "Bearer ".concat(this.accessToken));
5280
+ }
5281
+ },
5282
+ {
5283
+ /**
5284
+ * Shorthand: create a supertest request with auth already applied.
5285
+ *
5286
+ * @example
5287
+ * ```typescript
5288
+ * await oauth.authRequest('get', '/oidc/me').expect(200);
5289
+ * await oauth.authRequest('post', '/api/model/call').send(body).expect(200);
5290
+ * ```
5291
+ */ key: "authRequest",
5292
+ value: function authRequest(method, path) {
5293
+ return request(this.server)[method](path).set('Authorization', "Bearer ".concat(this.accessToken));
5294
+ }
5295
+ }
5296
+ ]);
5297
+ return OAuthAuthorizedSuperTestInstance;
5298
+ }();
5299
+ // MARK: Fixture
5300
+ /**
5301
+ * Fixture that wraps {@link OAuthAuthorizedSuperTestInstance} and delegates to it.
5302
+ */ var OAuthAuthorizedSuperTestFixture = /*#__PURE__*/ function(AbstractTestContextFixture) {
5303
+ _inherits(OAuthAuthorizedSuperTestFixture, AbstractTestContextFixture);
5304
+ function OAuthAuthorizedSuperTestFixture() {
5305
+ _class_call_check(this, OAuthAuthorizedSuperTestFixture);
5306
+ return _call_super(this, OAuthAuthorizedSuperTestFixture, arguments);
5307
+ }
5308
+ _create_class(OAuthAuthorizedSuperTestFixture, [
5309
+ {
5310
+ key: "server",
5311
+ get: function get() {
5312
+ return this.instance.server;
5313
+ }
5314
+ },
5315
+ {
5316
+ key: "accessToken",
5317
+ get: function get() {
5318
+ return this.instance.accessToken;
5319
+ }
5320
+ },
5321
+ {
5322
+ /**
5323
+ * Apply Bearer auth to a supertest request.
5324
+ *
5325
+ * @example
5326
+ * ```typescript
5327
+ * await oauth.withAuth(request(oauth.server).get('/oidc/me')).expect(200);
5328
+ * ```
5329
+ */ key: "withAuth",
5330
+ value: function withAuth(test) {
5331
+ return this.instance.withAuth(test);
5332
+ }
5333
+ },
5334
+ {
5335
+ /**
5336
+ * Shorthand: create a supertest request with auth already applied.
5337
+ *
5338
+ * @example
5339
+ * ```typescript
5340
+ * await oauth.authRequest('get', '/oidc/me').expect(200);
5341
+ * await oauth.authRequest('post', '/api/model/call').send(body).expect(200);
5342
+ * ```
5343
+ */ key: "authRequest",
5344
+ value: function authRequest(method, path) {
5345
+ return this.instance.authRequest(method, path);
5346
+ }
5347
+ }
5348
+ ]);
5349
+ return OAuthAuthorizedSuperTestFixture;
5350
+ }(test.AbstractTestContextFixture);
5351
+ // MARK: Factory
5352
+ /**
5353
+ * Default hook/test timeout for OAuth-authenticated test contexts.
5354
+ *
5355
+ * The full OAuth authorization code flow involves multiple HTTP round trips
5356
+ * (auth → login → consent → code exchange), so the default 10s timeout is too short.
5357
+ */ var DEFAULT_OAUTH_TEST_TIMEOUT = 30000;
5358
+ /**
5359
+ * Creates a factory that sets up an OAuth-authenticated supertest context.
5360
+ *
5361
+ * The returned factory function performs a full OAuth authorization code flow
5362
+ * and provides an authenticated supertest agent and helper methods.
5363
+ *
5364
+ * @example
5365
+ * ```typescript
5366
+ * // In shared test setup (e.g. fixture.oidc.ts)
5367
+ * export const myOAuthContext = oAuthAuthorizedSuperTestContextFactory();
5368
+ *
5369
+ * // In test file
5370
+ * myAppFunctionContextFactory((f) => {
5371
+ * authorizedUserContext({ f }, (u) => {
5372
+ * myOAuthContext({ f, u }, (oauth) => {
5373
+ * it('should fetch userinfo', async () => {
5374
+ * await oauth.authRequest('get', '/oidc/me').expect(200);
5375
+ * });
5376
+ * });
5377
+ * });
5378
+ * });
5379
+ * ```
5380
+ */ function oAuthAuthorizedSuperTestContextFactory(config) {
5381
+ var _ref = config !== null && config !== void 0 ? config : {}, _ref_timeout = _ref.timeout, timeout = _ref_timeout === void 0 ? DEFAULT_OAUTH_TEST_TIMEOUT : _ref_timeout, _ref_makeFixture = _ref.makeFixture, makeFixture = _ref_makeFixture === void 0 ? function() {
5382
+ return new OAuthAuthorizedSuperTestFixture();
5383
+ } : _ref_makeFixture, _ref_makeInstance = _ref.makeInstance, makeInstance = _ref_makeInstance === void 0 ? function(server, accessToken) {
5384
+ return new OAuthAuthorizedSuperTestInstance(server, accessToken);
5385
+ } : _ref_makeInstance, flowConfigOverrides = _object_without_properties(_ref, [
5386
+ "timeout",
5387
+ "makeFixture",
5388
+ "makeInstance"
5389
+ ]);
5390
+ var flowConfig = flowConfigOverrides.scopes || flowConfigOverrides.redirectUri || flowConfigOverrides.clientName ? flowConfigOverrides : undefined;
5391
+ return function(params, buildTests) {
5392
+ var f = params.f, u = params.u;
5393
+ describe('(oauth)', function() {
5394
+ // Increase timeouts for the OAuth flow
5395
+ beforeAll(function() {
5396
+ vi.setConfig({
5397
+ hookTimeout: timeout,
5398
+ testTimeout: timeout
5399
+ });
5400
+ });
5401
+ test.useTestContextFixture({
5402
+ fixture: makeFixture(),
5403
+ buildTests: buildTests,
5404
+ initInstance: function initInstance() {
5405
+ return _async_to_generator(function() {
5406
+ var app, accessToken;
5407
+ return _ts_generator(this, function(_state) {
5408
+ switch(_state.label){
5409
+ case 0:
5410
+ return [
5411
+ 4,
5412
+ f.loadInitializedNestApplication()
5413
+ ];
5414
+ case 1:
5415
+ app = _state.sent();
5416
+ return [
5417
+ 4,
5418
+ setupAndPerformFullOAuthFlow(app, u.uid, flowConfig)
5419
+ ];
5420
+ case 2:
5421
+ accessToken = _state.sent().accessToken;
5422
+ return [
5423
+ 2,
5424
+ makeInstance(app.getHttpServer(), accessToken)
5425
+ ];
5426
+ }
5427
+ });
5428
+ })();
5429
+ }
5430
+ });
5431
+ });
5432
+ };
5433
+ }
5434
+
4480
5435
  /**
4481
5436
  * Default Firebase Storage admin factory.
4482
5437
  *
@@ -4519,6 +5474,8 @@ exports.GoogleCloudTestFirestoreInstance = GoogleCloudTestFirestoreInstance;
4519
5474
  exports.JestExpectedHttpErrorWithSpecificServerErrorCode = JestExpectedHttpErrorWithSpecificServerErrorCode;
4520
5475
  exports.ModelTestContextFixture = ModelTestContextFixture;
4521
5476
  exports.ModelTestContextInstance = ModelTestContextInstance;
5477
+ exports.OAuthAuthorizedSuperTestFixture = OAuthAuthorizedSuperTestFixture;
5478
+ exports.OAuthAuthorizedSuperTestInstance = OAuthAuthorizedSuperTestInstance;
4522
5479
  exports.adminFirebaseStorageFactory = adminFirebaseStorageFactory;
4523
5480
  exports.adminFirestoreFactory = adminFirestoreFactory;
4524
5481
  exports.applyFirebaseGCloudTestProjectIdToFirebaseConfigEnv = applyFirebaseGCloudTestProjectIdToFirebaseConfigEnv;
@@ -4563,9 +5520,12 @@ exports.jestExpectFailAssertHttpErrorServerErrorCode = jestExpectFailAssertHttpE
4563
5520
  exports.makeGoogleFirebaseStorageContext = makeGoogleFirebaseStorageContext;
4564
5521
  exports.makeGoogleFirestoreContext = makeGoogleFirestoreContext;
4565
5522
  exports.modelTestContextFactory = modelTestContextFactory;
5523
+ exports.oAuthAuthorizedSuperTestContextFactory = oAuthAuthorizedSuperTestContextFactory;
5524
+ exports.performFullOAuthFlow = performFullOAuthFlow;
4566
5525
  exports.rerollFirebaseAdminFunctionTestSingleton = rerollFirebaseAdminFunctionTestSingleton;
4567
5526
  exports.rollNewGCloudProjectEnvironmentVariable = rollNewGCloudProjectEnvironmentVariable;
4568
5527
  exports.setDefaultFirebaseAdminFunctionTestUseFunctionSingleton = setDefaultFirebaseAdminFunctionTestUseFunctionSingleton;
5528
+ exports.setupAndPerformFullOAuthFlow = setupAndPerformFullOAuthFlow;
4569
5529
  exports.setupFirebaseAdminFunctionTestSingleton = setupFirebaseAdminFunctionTestSingleton;
4570
5530
  exports.testFirestoreClaimsFromUserRecord = testFirestoreClaimsFromUserRecord;
4571
5531
  exports.testUidFactory = testUidFactory;