@dereekb/firebase-server 13.30.0 → 13.32.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.
package/test/index.cjs.js CHANGED
@@ -74,7 +74,7 @@ function _create_class$6(Constructor, protoProps, staticProps) {
74
74
  if (protoProps) _defineProperties$6(Constructor.prototype, protoProps);
75
75
  return Constructor;
76
76
  }
77
- function _define_property$8(obj, key, value) {
77
+ function _define_property$9(obj, key, value) {
78
78
  if (key in obj) {
79
79
  Object.defineProperty(obj, key, {
80
80
  value: value,
@@ -106,7 +106,7 @@ function _inherits$9(subClass, superClass) {
106
106
  });
107
107
  if (superClass) _set_prototype_of$9(subClass, superClass);
108
108
  }
109
- function _object_spread$5(target) {
109
+ function _object_spread$6(target) {
110
110
  for(var i = 1; i < arguments.length; i++){
111
111
  var source = arguments[i] != null ? arguments[i] : {};
112
112
  var ownKeys = Object.keys(source);
@@ -116,7 +116,7 @@ function _object_spread$5(target) {
116
116
  }));
117
117
  }
118
118
  ownKeys.forEach(function(key) {
119
- _define_property$8(target, key, source[key]);
119
+ _define_property$9(target, key, source[key]);
120
120
  });
121
121
  }
122
122
  return target;
@@ -371,8 +371,8 @@ function _ts_generator$a(thisArg, body) {
371
371
  */ var AuthorizedUserTestContextInstance = /*#__PURE__*/ function() {
372
372
  function AuthorizedUserTestContextInstance(uid, testContext) {
373
373
  _class_call_check$9(this, AuthorizedUserTestContextInstance);
374
- _define_property$8(this, "uid", void 0);
375
- _define_property$8(this, "testContext", void 0);
374
+ _define_property$9(this, "uid", void 0);
375
+ _define_property$9(this, "testContext", void 0);
376
376
  this.uid = uid;
377
377
  this.testContext = testContext;
378
378
  }
@@ -496,7 +496,7 @@ function _ts_generator$a(thisArg, body) {
496
496
  value: function callAuthBlockingFunction(input) {
497
497
  var fn = input.fn, userRecord = input.userRecord, eventType = input.eventType, eventOverride = input.eventOverride, _input_skipJsonConversion = input.skipJsonConversion, skipJsonConversion = _input_skipJsonConversion === void 0 ? false : _input_skipJsonConversion;
498
498
  var timestamp = new Date().toISOString();
499
- var event = _object_spread_props$3(_object_spread$5({
499
+ var event = _object_spread_props$3(_object_spread$6({
500
500
  ipAddress: '127.0.0.1',
501
501
  userAgent: 'testing',
502
502
  eventId: '0',
@@ -528,7 +528,7 @@ function _ts_generator$a(thisArg, body) {
528
528
  var skipJsonConversion = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : false;
529
529
  var parsedParams = params == null || skipJsonConversion ? params : convertParamsToParsedJsonObjectAndBack(params);
530
530
  return this.makeContextOptions().then(function(options) {
531
- return fn(parsedParams, contextOptions ? _object_spread$5({}, contextOptions, options) : options);
531
+ return fn(parsedParams, contextOptions ? _object_spread$6({}, contextOptions, options) : options);
532
532
  });
533
533
  }
534
534
  }
@@ -603,7 +603,7 @@ function _ts_generator$a(thisArg, body) {
603
603
  inputUser = _state.sent();
604
604
  inputTemplate = templateGetter();
605
605
  uid = (inputUser === null || inputUser === void 0 ? void 0 : inputUser.uid) || makeUid();
606
- _$_object_spread = _object_spread$5({}, makeUserDetails(uid, params), inputTemplate), details = _$_object_spread.details, claims = _$_object_spread.claims, userDetailsAddContactInfo = _$_object_spread.addContactInfo;
606
+ _$_object_spread = _object_spread$6({}, makeUserDetails(uid, params), inputTemplate), details = _$_object_spread.details, claims = _$_object_spread.claims, userDetailsAddContactInfo = _$_object_spread.addContactInfo;
607
607
  _ref = details !== null && details !== void 0 ? details : {}, detailsPhoneNumber = _ref.phoneNumber, detailsEmail = _ref.email; // keep details if provided
608
608
  addContactInfo = inputAddContactInfo || userDetailsAddContactInfo;
609
609
  auth = f.instance.auth;
@@ -616,7 +616,7 @@ function _ts_generator$a(thisArg, body) {
616
616
  }
617
617
  return [
618
618
  4,
619
- auth.createUser(_object_spread$5(_object_spread_props$3(_object_spread$5({
619
+ auth.createUser(_object_spread$6(_object_spread_props$3(_object_spread$6({
620
620
  uid: uid,
621
621
  displayName: 'Test Person'
622
622
  }, details), {
@@ -808,7 +808,7 @@ function _ts_generator$a(thisArg, body) {
808
808
  var _ref;
809
809
  var _decoded_claims;
810
810
  var decoded = jsonwebtoken.decode(token);
811
- var decodedToken = _object_spread_props$3(_object_spread$5({}, decoded, decoded.claims), {
811
+ var decodedToken = _object_spread_props$3(_object_spread$6({}, decoded, decoded.claims), {
812
812
  auth_time: decoded.iat,
813
813
  firebase: (_ref = (_decoded_claims = decoded.claims) === null || _decoded_claims === void 0 ? void 0 : _decoded_claims.firebase) !== null && _ref !== void 0 ? _ref : {}
814
814
  });
@@ -839,7 +839,7 @@ function _ts_generator$a(thisArg, body) {
839
839
  }
840
840
  };
841
841
  var customClaims = userRecord.customClaims;
842
- return _object_spread$5({}, customClaims, baseClaims);
842
+ return _object_spread$6({}, customClaims, baseClaims);
843
843
  }
844
844
 
845
845
  function _assert_this_initialized$8(self) {
@@ -899,7 +899,7 @@ function _create_class$5(Constructor, protoProps, staticProps) {
899
899
  if (protoProps) _defineProperties$5(Constructor.prototype, protoProps);
900
900
  return Constructor;
901
901
  }
902
- function _define_property$7(obj, key, value) {
902
+ function _define_property$8(obj, key, value) {
903
903
  if (key in obj) {
904
904
  Object.defineProperty(obj, key, {
905
905
  value: value,
@@ -1120,9 +1120,9 @@ function _ts_generator$9(thisArg, body) {
1120
1120
  */ var ModelTestContextInstance = /*#__PURE__*/ function() {
1121
1121
  function ModelTestContextInstance(collection, ref, testContext) {
1122
1122
  _class_call_check$8(this, ModelTestContextInstance);
1123
- _define_property$7(this, "collection", void 0);
1124
- _define_property$7(this, "ref", void 0);
1125
- _define_property$7(this, "testContext", void 0);
1123
+ _define_property$8(this, "collection", void 0);
1124
+ _define_property$8(this, "ref", void 0);
1125
+ _define_property$8(this, "testContext", void 0);
1126
1126
  this.collection = collection;
1127
1127
  this.ref = ref;
1128
1128
  this.testContext = testContext;
@@ -2009,7 +2009,7 @@ function _create_class$4(Constructor, protoProps, staticProps) {
2009
2009
  if (protoProps) _defineProperties$4(Constructor.prototype, protoProps);
2010
2010
  return Constructor;
2011
2011
  }
2012
- function _define_property$6(obj, key, value) {
2012
+ function _define_property$7(obj, key, value) {
2013
2013
  if (key in obj) {
2014
2014
  Object.defineProperty(obj, key, {
2015
2015
  value: value,
@@ -2041,7 +2041,7 @@ function _inherits$5(subClass, superClass) {
2041
2041
  });
2042
2042
  if (superClass) _set_prototype_of$5(subClass, superClass);
2043
2043
  }
2044
- function _object_spread$4(target) {
2044
+ function _object_spread$5(target) {
2045
2045
  for(var i = 1; i < arguments.length; i++){
2046
2046
  var source = arguments[i] != null ? arguments[i] : {};
2047
2047
  var ownKeys = Object.keys(source);
@@ -2051,7 +2051,7 @@ function _object_spread$4(target) {
2051
2051
  }));
2052
2052
  }
2053
2053
  ownKeys.forEach(function(key) {
2054
- _define_property$6(target, key, source[key]);
2054
+ _define_property$7(target, key, source[key]);
2055
2055
  });
2056
2056
  }
2057
2057
  return target;
@@ -2266,12 +2266,12 @@ function _ts_generator$6(thisArg, body) {
2266
2266
  function FirebaseAdminTestContextInstance(app) {
2267
2267
  var _this = this;
2268
2268
  _class_call_check$5(this, FirebaseAdminTestContextInstance);
2269
- _define_property$6(this, "app", void 0);
2270
- _define_property$6(this, "getTestFirestoreInstance", util.cachedGetter(function() {
2269
+ _define_property$7(this, "app", void 0);
2270
+ _define_property$7(this, "getTestFirestoreInstance", util.cachedGetter(function() {
2271
2271
  var drivers = test$1.makeTestingFirestoreDrivers(firebaseServer.googleCloudFirestoreDrivers());
2272
2272
  return new GoogleCloudTestFirestoreInstance(drivers, _this.firestore);
2273
2273
  }));
2274
- _define_property$6(this, "getTestFirebaseStorageInstance", util.cachedGetter(function() {
2274
+ _define_property$7(this, "getTestFirebaseStorageInstance", util.cachedGetter(function() {
2275
2275
  var drivers = test$1.makeTestingFirebaseStorageDrivers(firebaseServer.googleCloudFirebaseStorageDrivers());
2276
2276
  var defaultBucketId = _this.app.options.storageBucket;
2277
2277
  return new GoogleCloudTestFirebaseStorageInstance(drivers, _this.storage, defaultBucketId);
@@ -2341,7 +2341,7 @@ function _ts_generator$6(thisArg, body) {
2341
2341
  */ var AbstractFirebaseAdminTestContextInstanceChild = /*#__PURE__*/ function() {
2342
2342
  function AbstractFirebaseAdminTestContextInstanceChild(parent) {
2343
2343
  _class_call_check$5(this, AbstractFirebaseAdminTestContextInstanceChild);
2344
- _define_property$6(this, "parent", void 0);
2344
+ _define_property$7(this, "parent", void 0);
2345
2345
  this.parent = parent;
2346
2346
  }
2347
2347
  _create_class$4(AbstractFirebaseAdminTestContextInstanceChild, [
@@ -2409,7 +2409,7 @@ function _ts_generator$6(thisArg, body) {
2409
2409
  * This can be used to easily build a testing context that sets up RulesTestEnvironment for tests that sets itself up and tears itself down.
2410
2410
  */ var firebaseAdminTestBuilder = test.testContextBuilder({
2411
2411
  buildConfig: function buildConfig(input) {
2412
- var config = _object_spread$4({}, input);
2412
+ var config = _object_spread$5({}, input);
2413
2413
  return config;
2414
2414
  },
2415
2415
  buildFixture: function buildFixture() {
@@ -2536,7 +2536,7 @@ function _async_to_generator$5(fn) {
2536
2536
  });
2537
2537
  };
2538
2538
  }
2539
- function _define_property$5(obj, key, value) {
2539
+ function _define_property$6(obj, key, value) {
2540
2540
  if (key in obj) {
2541
2541
  Object.defineProperty(obj, key, {
2542
2542
  value: value,
@@ -2549,7 +2549,7 @@ function _define_property$5(obj, key, value) {
2549
2549
  }
2550
2550
  return obj;
2551
2551
  }
2552
- function _object_spread$3(target) {
2552
+ function _object_spread$4(target) {
2553
2553
  for(var i = 1; i < arguments.length; i++){
2554
2554
  var source = arguments[i] != null ? arguments[i] : {};
2555
2555
  var ownKeys = Object.keys(source);
@@ -2559,7 +2559,7 @@ function _object_spread$3(target) {
2559
2559
  }));
2560
2560
  }
2561
2561
  ownKeys.forEach(function(key) {
2562
- _define_property$5(target, key, source[key]);
2562
+ _define_property$6(target, key, source[key]);
2563
2563
  });
2564
2564
  }
2565
2565
  return target;
@@ -2710,7 +2710,7 @@ function _ts_generator$5(thisArg, body) {
2710
2710
  return _async_to_generator$5(function() {
2711
2711
  var _ref, request;
2712
2712
  return _ts_generator$5(this, function(_state) {
2713
- request = _object_spread_props$2(_object_spread$3({}, context), {
2713
+ request = _object_spread_props$2(_object_spread$4({}, context), {
2714
2714
  data: data,
2715
2715
  // NOTE: These will typically not be used/available as they are express.js properties that are not available or useful to the handlers
2716
2716
  rawRequest: (_ref = context === null || context === void 0 ? void 0 : context.rawRequest) !== null && _ref !== void 0 ? _ref : {},
@@ -2843,7 +2843,7 @@ function _create_class$3(Constructor, protoProps, staticProps) {
2843
2843
  if (protoProps) _defineProperties$3(Constructor.prototype, protoProps);
2844
2844
  return Constructor;
2845
2845
  }
2846
- function _define_property$4(obj, key, value) {
2846
+ function _define_property$5(obj, key, value) {
2847
2847
  if (key in obj) {
2848
2848
  Object.defineProperty(obj, key, {
2849
2849
  value: value,
@@ -2883,7 +2883,7 @@ function _instanceof$1(left, right) {
2883
2883
  return left instanceof right;
2884
2884
  }
2885
2885
  }
2886
- function _object_spread$2(target) {
2886
+ function _object_spread$3(target) {
2887
2887
  for(var i = 1; i < arguments.length; i++){
2888
2888
  var source = arguments[i] != null ? arguments[i] : {};
2889
2889
  var ownKeys = Object.keys(source);
@@ -2893,7 +2893,7 @@ function _object_spread$2(target) {
2893
2893
  }));
2894
2894
  }
2895
2895
  ownKeys.forEach(function(key) {
2896
- _define_property$4(target, key, source[key]);
2896
+ _define_property$5(target, key, source[key]);
2897
2897
  });
2898
2898
  }
2899
2899
  return target;
@@ -3172,7 +3172,7 @@ var functionsInitialized = false;
3172
3172
  var _this;
3173
3173
  _this = _call_super$4(this, FirebaseAdminFunctionTestContextInstance, [
3174
3174
  app
3175
- ]), _define_property$4(_this, "instance", void 0), _define_property$4(_this, "_fnWrapper", util.cachedGetter(function() {
3175
+ ]), _define_property$5(_this, "instance", void 0), _define_property$5(_this, "_fnWrapper", util.cachedGetter(function() {
3176
3176
  return firebaseAdminCloudFunctionWrapper(_this.instance);
3177
3177
  }));
3178
3178
  _this.instance = instance;
@@ -3215,7 +3215,7 @@ var functionsInitialized = false;
3215
3215
  */ var firebaseAdminFunctionTestBuilder = test.testContextBuilder({
3216
3216
  buildConfig: function buildConfig(input) {
3217
3217
  var _ref;
3218
- var config = _object_spread_props$1(_object_spread$2({}, input), {
3218
+ var config = _object_spread_props$1(_object_spread$3({}, input), {
3219
3219
  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
3220
3220
  });
3221
3221
  return config;
@@ -3422,7 +3422,7 @@ function _create_class$2(Constructor, protoProps, staticProps) {
3422
3422
  if (protoProps) _defineProperties$2(Constructor.prototype, protoProps);
3423
3423
  return Constructor;
3424
3424
  }
3425
- function _define_property$3(obj, key, value) {
3425
+ function _define_property$4(obj, key, value) {
3426
3426
  if (key in obj) {
3427
3427
  Object.defineProperty(obj, key, {
3428
3428
  value: value,
@@ -3460,7 +3460,7 @@ function _iterable_to_array$1(iter) {
3460
3460
  function _non_iterable_spread$1() {
3461
3461
  throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
3462
3462
  }
3463
- function _object_spread$1(target) {
3463
+ function _object_spread$2(target) {
3464
3464
  for(var i = 1; i < arguments.length; i++){
3465
3465
  var source = arguments[i] != null ? arguments[i] : {};
3466
3466
  var ownKeys = Object.keys(source);
@@ -3470,7 +3470,7 @@ function _object_spread$1(target) {
3470
3470
  }));
3471
3471
  }
3472
3472
  ownKeys.forEach(function(key) {
3473
- _define_property$3(target, key, source[key]);
3473
+ _define_property$4(target, key, source[key]);
3474
3474
  });
3475
3475
  }
3476
3476
  return target;
@@ -3697,9 +3697,9 @@ function _ts_generator$3(thisArg, body) {
3697
3697
  var _this1;
3698
3698
  _this = _call_super$3(this, FirebaseAdminNestTestContextInstance, [
3699
3699
  parent
3700
- ]), _this1 = _this, _define_property$3(_this, "nest", void 0), _define_property$3(_this, "nestAppPromiseGetter", function() {
3700
+ ]), _this1 = _this, _define_property$4(_this, "nest", void 0), _define_property$4(_this, "nestAppPromiseGetter", function() {
3701
3701
  return Promise.resolve(_this.nest);
3702
- }), _define_property$3(_this, "_loadInitializedNestApplication", util.cachedGetter(function() {
3702
+ }), _define_property$4(_this, "_loadInitializedNestApplication", util.cachedGetter(function() {
3703
3703
  return _async_to_generator$3(function() {
3704
3704
  var app;
3705
3705
  return _ts_generator$3(this, function(_state) {
@@ -3812,7 +3812,7 @@ function _ts_generator$3(thisArg, body) {
3812
3812
  switch(_state.label){
3813
3813
  case 0:
3814
3814
  additionalProviders = (_makeProviders = makeProviders(f.instance)) !== null && _makeProviders !== void 0 ? _makeProviders : [];
3815
- rootModule = firebaseServer.buildNestServerRootModule(_object_spread_props(_object_spread$1({}, serverInstanceConfig), {
3815
+ rootModule = firebaseServer.buildNestServerRootModule(_object_spread_props(_object_spread$2({}, serverInstanceConfig), {
3816
3816
  modules: _to_consumable_array$1(util.asArray(nestModules)).concat(_to_consumable_array$1(util.asArray(serverInstanceConfig === null || serverInstanceConfig === void 0 ? void 0 : serverInstanceConfig.modules))),
3817
3817
  firebaseAppGetter: config.injectFirebaseServerAppTokenProvider ? util.asGetter(f.instance.app) : undefined,
3818
3818
  providers: additionalProviders,
@@ -3960,7 +3960,7 @@ function _create_class$1(Constructor, protoProps, staticProps) {
3960
3960
  if (protoProps) _defineProperties$1(Constructor.prototype, protoProps);
3961
3961
  return Constructor;
3962
3962
  }
3963
- function _define_property$2(obj, key, value) {
3963
+ function _define_property$3(obj, key, value) {
3964
3964
  if (key in obj) {
3965
3965
  Object.defineProperty(obj, key, {
3966
3966
  value: value,
@@ -3992,7 +3992,7 @@ function _inherits$2(subClass, superClass) {
3992
3992
  });
3993
3993
  if (superClass) _set_prototype_of$2(subClass, superClass);
3994
3994
  }
3995
- function _object_spread(target) {
3995
+ function _object_spread$1(target) {
3996
3996
  for(var i = 1; i < arguments.length; i++){
3997
3997
  var source = arguments[i] != null ? arguments[i] : {};
3998
3998
  var ownKeys = Object.keys(source);
@@ -4002,7 +4002,7 @@ function _object_spread(target) {
4002
4002
  }));
4003
4003
  }
4004
4004
  ownKeys.forEach(function(key) {
4005
- _define_property$2(target, key, source[key]);
4005
+ _define_property$3(target, key, source[key]);
4006
4006
  });
4007
4007
  }
4008
4008
  return target;
@@ -4161,7 +4161,7 @@ function _is_native_reflect_construct$2() {
4161
4161
  * @param buildTests - Callback that receives the child fixture and registers test cases.
4162
4162
  * @returns Whatever {@link firebaseAdminNestContextWithFixture} returns after registering the merged child fixture (typically `void`).
4163
4163
  */ function firebaseAdminFunctionNestContextWithFixture(config, f, buildTests) {
4164
- var mergedConfig = _object_spread({
4164
+ var mergedConfig = _object_spread$1({
4165
4165
  makeFixture: function makeFixture(parent) {
4166
4166
  return new FirebaseAdminFunctionNestTestContextFixture(parent);
4167
4167
  },
@@ -4503,7 +4503,7 @@ function _class_call_check$1(instance, Constructor) {
4503
4503
  throw new TypeError("Cannot call a class as a function");
4504
4504
  }
4505
4505
  }
4506
- function _define_property$1(obj, key, value) {
4506
+ function _define_property$2(obj, key, value) {
4507
4507
  if (key in obj) {
4508
4508
  Object.defineProperty(obj, key, {
4509
4509
  value: value,
@@ -4578,7 +4578,7 @@ function _is_native_reflect_construct$1() {
4578
4578
  var code = httpError.details.code;
4579
4579
  _this = _call_super$1(this, ExpectedHttpErrorWithSpecificServerErrorCode, [
4580
4580
  'Expected HttpError with an error code of "'.concat(expectedErrorCode, '", but recieved "').concat(code, '" instead.')
4581
- ]), _define_property$1(_this, "httpError", void 0), _define_property$1(_this, "expectedErrorCode", void 0);
4581
+ ]), _define_property$2(_this, "httpError", void 0), _define_property$2(_this, "expectedErrorCode", void 0);
4582
4582
  _this.httpError = httpError;
4583
4583
  _this.expectedErrorCode = expectedErrorCode;
4584
4584
  return _this;
@@ -4675,6 +4675,19 @@ function _async_to_generator$1(fn) {
4675
4675
  });
4676
4676
  };
4677
4677
  }
4678
+ function _define_property$1(obj, key, value) {
4679
+ if (key in obj) {
4680
+ Object.defineProperty(obj, key, {
4681
+ value: value,
4682
+ enumerable: true,
4683
+ configurable: true,
4684
+ writable: true
4685
+ });
4686
+ } else {
4687
+ obj[key] = value;
4688
+ }
4689
+ return obj;
4690
+ }
4678
4691
  function _iterable_to_array(iter) {
4679
4692
  if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
4680
4693
  }
@@ -4708,6 +4721,21 @@ function _non_iterable_rest() {
4708
4721
  function _non_iterable_spread() {
4709
4722
  throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
4710
4723
  }
4724
+ function _object_spread(target) {
4725
+ for(var i = 1; i < arguments.length; i++){
4726
+ var source = arguments[i] != null ? arguments[i] : {};
4727
+ var ownKeys = Object.keys(source);
4728
+ if (typeof Object.getOwnPropertySymbols === "function") {
4729
+ ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
4730
+ return Object.getOwnPropertyDescriptor(source, sym).enumerable;
4731
+ }));
4732
+ }
4733
+ ownKeys.forEach(function(key) {
4734
+ _define_property$1(target, key, source[key]);
4735
+ });
4736
+ }
4737
+ return target;
4738
+ }
4711
4739
  function _sliced_to_array(arr, i) {
4712
4740
  return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
4713
4741
  }
@@ -4927,27 +4955,32 @@ function _ts_generator$1(thisArg, body) {
4927
4955
  * Admin-only scopes (e.g. `token.service`) are dropped from the default "all scopes" request because
4928
4956
  * the provider hard-rejects them for non-admin users, and this default flow logs in an arbitrary
4929
4957
  * (often non-admin) user. Tests that need an admin-only scope pass it explicitly via `config.scopes`.
4958
+ * Both sources of the gate are excluded: the provider config's `adminOnlyScopes` and the scopes of any
4959
+ * profile marked `adminOnly`.
4930
4960
  *
4931
- * Provider-profile-gated scopes (e.g. `lms`, `reports`) are dropped for the same reason: they are
4932
- * unlocked only for a client an admin has assigned the corresponding profile to, and this flow creates
4933
- * a fresh client with no profiles — so the consent unlock gate hard-rejects them (finishing the
4961
+ * Assignment-only profile-gated scopes (e.g. `lms`, `reports`) are dropped for the same reason: they
4962
+ * are unlocked only for a client an admin has assigned the corresponding profile to, and this flow
4963
+ * creates a fresh client with no profiles — so the consent unlock gate hard-rejects them (finishing the
4934
4964
  * interaction with `access_denied` and no `code`). Tests that need a gated scope create a client with
4935
- * the profile and pass the scope explicitly via `config.scopes`.
4965
+ * the profile and pass the scope explicitly via `config.scopes`. A scope unlocked by a DEFAULT profile
4966
+ * is deliberately kept: a client with no profiles assigned resolves to the default profiles, so it can
4967
+ * obtain that scope.
4936
4968
  *
4937
4969
  * @param nestApp - Initialized NestJS application used to resolve {@link OidcAccountService} when no scopes override is given.
4938
4970
  * @param config - Optional flow config; when `config.scopes` is set, it is returned verbatim.
4939
4971
  * @returns The space-separated scope string to pass to the `/oidc/auth` endpoint.
4940
4972
  */ function resolveScopes(nestApp, config) {
4941
4973
  return _async_to_generator$1(function() {
4942
- var result, _providerConfig_adminOnlyScopes, _providerConfig_providerProfiles, accountService, providerConfig, adminOnlyScopes, profileGatedScopes;
4974
+ var result, _providerConfig_providerProfiles, _providerConfig_adminOnlyScopes, accountService, providerConfig, providerProfiles, adminOnlyScopes, profileGatedScopes;
4943
4975
  return _ts_generator$1(this, function(_state) {
4944
4976
  if (config === null || config === void 0 ? void 0 : config.scopes) {
4945
4977
  result = config.scopes;
4946
4978
  } else {
4947
4979
  accountService = nestApp.get(oidc.OidcAccountService);
4948
4980
  providerConfig = accountService.providerConfig;
4949
- adminOnlyScopes = new Set((_providerConfig_adminOnlyScopes = providerConfig.adminOnlyScopes) !== null && _providerConfig_adminOnlyScopes !== void 0 ? _providerConfig_adminOnlyScopes : []);
4950
- profileGatedScopes = firebase.scopesForOidcProviderProfiles((_providerConfig_providerProfiles = providerConfig.providerProfiles) !== null && _providerConfig_providerProfiles !== void 0 ? _providerConfig_providerProfiles : []);
4981
+ providerProfiles = (_providerConfig_providerProfiles = providerConfig.providerProfiles) !== null && _providerConfig_providerProfiles !== void 0 ? _providerConfig_providerProfiles : [];
4982
+ adminOnlyScopes = new Set(_to_consumable_array((_providerConfig_adminOnlyScopes = providerConfig.adminOnlyScopes) !== null && _providerConfig_adminOnlyScopes !== void 0 ? _providerConfig_adminOnlyScopes : []).concat(_to_consumable_array(firebase.adminOnlyScopesForOidcProviderProfiles(providerProfiles))));
4983
+ profileGatedScopes = firebase.assignmentOnlyScopesForOidcProviderProfiles(providerProfiles);
4951
4984
  result = Object.keys(providerConfig.claims).filter(function(scope) {
4952
4985
  return !adminOnlyScopes.has(scope) && !profileGatedScopes.has(scope);
4953
4986
  }).join(' ');
@@ -4969,12 +5002,12 @@ function _ts_generator$1(thisArg, body) {
4969
5002
  * @param input.oidcClientService - Service used to create the OAuth client whose credentials drive the flow.
4970
5003
  * @param input.nestApp - Initialized NestJS application; used to resolve {@link OidcAccountService} for project-id-derived ID tokens and default scopes.
4971
5004
  * @param input.uid - Firebase user ID for whom the test ID token is minted and the OAuth flow is authorized.
4972
- * @param input.config - Optional flow overrides (scopes, redirect URI, client name, token endpoint auth method).
5005
+ * @param input.config - Optional flow overrides (scopes, redirect URI, client name, token endpoint auth method, provider profiles).
4973
5006
  * @returns The exchanged access token and ID token from the OIDC `/token` endpoint.
4974
5007
  * @throws {Error} When the token exchange step fails (the response body and status are included in the message).
4975
5008
  */ function performFullOAuthFlow(input) {
4976
5009
  return _async_to_generator$1(function() {
4977
- var _ref, _ref1, _ref2, server, oidcClientService, nestApp, uid, config, _createCookieJar, collectCookies, cookieHeader, redirectUri, clientName, tokenEndpointAuthMethod, scopes, _ref3, client_id, client_secret, codeVerifier, codeChallenge, authRes, loginUid, idToken, loginRes, resumeAfterLoginPath, consentRedirectRes, consentUid, consentRes, resumeAfterConsentPath, callbackRedirectRes, callbackUrl, authorizationCode, tokenRes;
5010
+ var _ref, _ref1, _ref2, server, oidcClientService, nestApp, uid, config, _createCookieJar, collectCookies, cookieHeader, redirectUri, clientName, tokenEndpointAuthMethod, providerProfiles, scopes, _ref3, client_id, client_secret, codeVerifier, codeChallenge, authRes, loginUid, idToken, loginRes, resumeAfterLoginPath, consentRedirectRes, consentUid, consentRes, resumeAfterConsentPath, callbackRedirectRes, callbackUrl, authorizationCode, tokenRes;
4978
5011
  return _ts_generator$1(this, function(_state) {
4979
5012
  switch(_state.label){
4980
5013
  case 0:
@@ -4983,6 +5016,7 @@ function _ts_generator$1(thisArg, body) {
4983
5016
  redirectUri = (_ref = config === null || config === void 0 ? void 0 : config.redirectUri) !== null && _ref !== void 0 ? _ref : 'https://example.com/callback';
4984
5017
  clientName = (_ref1 = config === null || config === void 0 ? void 0 : config.clientName) !== null && _ref1 !== void 0 ? _ref1 : 'test-oauth-context';
4985
5018
  tokenEndpointAuthMethod = (_ref2 = config === null || config === void 0 ? void 0 : config.tokenEndpointAuthMethod) !== null && _ref2 !== void 0 ? _ref2 : 'client_secret_post';
5019
+ providerProfiles = config === null || config === void 0 ? void 0 : config.providerProfiles;
4986
5020
  return [
4987
5021
  4,
4988
5022
  resolveScopes(nestApp, config)
@@ -4991,13 +5025,15 @@ function _ts_generator$1(thisArg, body) {
4991
5025
  scopes = _state.sent();
4992
5026
  return [
4993
5027
  4,
4994
- oidcClientService.createClient({
5028
+ oidcClientService.createClient(_object_spread({
4995
5029
  client_name: clientName,
4996
5030
  redirect_uris: [
4997
5031
  redirectUri
4998
5032
  ],
4999
5033
  token_endpoint_auth_method: tokenEndpointAuthMethod
5000
- })
5034
+ }, providerProfiles == null ? {} : {
5035
+ dbx_provider_profiles: _to_consumable_array(providerProfiles)
5036
+ }))
5001
5037
  ];
5002
5038
  case 2:
5003
5039
  _ref3 = _state.sent(), client_id = _ref3.client_id, client_secret = _ref3.client_secret;
@@ -5100,7 +5136,7 @@ function _ts_generator$1(thisArg, body) {
5100
5136
  *
5101
5137
  * @param nestApp - Initialized NestJS application from which {@link JwksService} and {@link OidcClientService} are resolved.
5102
5138
  * @param uid - Firebase user ID for whom the OAuth flow is authorized.
5103
- * @param config - Optional flow overrides (scopes, redirect URI, client name, token endpoint auth method).
5139
+ * @param config - Optional flow overrides (scopes, redirect URI, client name, token endpoint auth method, provider profiles).
5104
5140
  * @returns The exchanged access token and ID token from {@link performFullOAuthFlow}.
5105
5141
  */ function setupAndPerformFullOAuthFlow(nestApp, uid, config) {
5106
5142
  return _async_to_generator$1(function() {
@@ -5505,7 +5541,7 @@ function _ts_generator(thisArg, body) {
5505
5541
  * The returned factory function performs a full OAuth authorization code flow
5506
5542
  * and provides an authenticated supertest agent and helper methods.
5507
5543
  *
5508
- * @param config - Optional flow overrides (scopes, redirect URI, client name, timeout) and custom fixture/instance constructors.
5544
+ * @param config - Optional flow overrides (scopes, redirect URI, client name, provider profiles, timeout) and custom fixture/instance constructors.
5509
5545
  * @returns Function that, given parent fixtures and a `buildTests` callback, registers a `describe('(oauth)', ...)` block which performs the full OAuth flow and exposes the authenticated supertest fixture.
5510
5546
  *
5511
5547
  * @example
@@ -5534,7 +5570,7 @@ function _ts_generator(thisArg, body) {
5534
5570
  "makeFixture",
5535
5571
  "makeInstance"
5536
5572
  ]);
5537
- var flowConfig = flowConfigOverrides.scopes || flowConfigOverrides.redirectUri || flowConfigOverrides.clientName ? flowConfigOverrides : undefined;
5573
+ var flowConfig = flowConfigOverrides.scopes || flowConfigOverrides.redirectUri || flowConfigOverrides.clientName || flowConfigOverrides.providerProfiles ? flowConfigOverrides : undefined;
5538
5574
  return function(params, buildTests) {
5539
5575
  var f = params.f, u = params.u;
5540
5576
  describe('(oauth)', function() {