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