@dereekb/firebase-server 9.10.1 → 9.10.3
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/CHANGELOG.md +13 -0
- package/mailgun/package.json +9 -9
- package/package.json +7 -7
- package/src/lib/nest/function/v1/schedule.js +3 -0
- package/src/lib/nest/function/v1/schedule.js.map +1 -1
- package/src/lib/nest/function/v2/schedule.js +3 -0
- package/src/lib/nest/function/v2/schedule.js.map +1 -1
- package/test/package.json +10 -10
- package/test/src/lib/firebase/firebase.admin.collection.d.ts +6 -1
- package/test/src/lib/firebase/firebase.admin.collection.js +11 -3
- package/test/src/lib/firebase/firebase.admin.collection.js.map +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,19 @@
|
|
|
2
2
|
|
|
3
3
|
This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
|
|
4
4
|
|
|
5
|
+
## [9.10.3](https://github.com/dereekb/dbx-components/compare/v9.10.2-dev...v9.10.3) (2022-10-07)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
## [9.10.2](https://github.com/dereekb/dbx-components/compare/v9.10.1-dev...v9.10.2) (2022-10-06)
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
### Bug Fixes
|
|
13
|
+
|
|
14
|
+
* fixed scheduler cron issue ([8a96047](https://github.com/dereekb/dbx-components/commit/8a960475ee43908f54d839e76c4d0320976a403d))
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
5
18
|
## [9.10.1](https://github.com/dereekb/dbx-components/compare/v9.10.0-dev...v9.10.1) (2022-10-06)
|
|
6
19
|
|
|
7
20
|
|
package/mailgun/package.json
CHANGED
|
@@ -1,33 +1,33 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dereekb/firebase-server/mailgun",
|
|
3
|
-
"version": "9.10.
|
|
3
|
+
"version": "9.10.3",
|
|
4
4
|
"type": "commonjs",
|
|
5
5
|
"main": "./src/index.js",
|
|
6
6
|
"typings": "./src/index.d.ts",
|
|
7
7
|
"dependencies": {},
|
|
8
8
|
"peerDependencies": {
|
|
9
|
-
"@dereekb/nestjs/mailgun": "9.10.
|
|
9
|
+
"@dereekb/nestjs/mailgun": "9.10.3",
|
|
10
10
|
"@nestjs/common": "^9.0.0",
|
|
11
11
|
"mailgun.js": "^8.0.0",
|
|
12
12
|
"form-data": "4.0.0",
|
|
13
|
-
"@dereekb/util": "9.10.
|
|
13
|
+
"@dereekb/util": "9.10.3",
|
|
14
14
|
"lodash.isequal": "^4.5.0",
|
|
15
15
|
"make-error": "^1.3.0",
|
|
16
16
|
"class-validator": "^0.13.2",
|
|
17
17
|
"ts-essentials": "^9.1.2",
|
|
18
18
|
"extra-set": "^2.2.11",
|
|
19
|
-
"@dereekb/nestjs": "9.10.
|
|
19
|
+
"@dereekb/nestjs": "9.10.3",
|
|
20
20
|
"@nestjs/config": "^2.0.1",
|
|
21
|
-
"@dereekb/firebase-server": "9.10.
|
|
21
|
+
"@dereekb/firebase-server": "9.10.3",
|
|
22
22
|
"jsonwebtoken": "^8.0.0",
|
|
23
|
-
"@dereekb/firebase": "9.10.
|
|
23
|
+
"@dereekb/firebase": "9.10.3",
|
|
24
24
|
"rxjs": "^7.5.0",
|
|
25
25
|
"firebase": "^9.9.2",
|
|
26
26
|
"class-transformer": "^0.5.1",
|
|
27
|
-
"@dereekb/rxjs": "9.10.
|
|
27
|
+
"@dereekb/rxjs": "9.10.3",
|
|
28
28
|
"ms": "^3.0.0-canary.1",
|
|
29
|
-
"@dereekb/model": "9.10.
|
|
30
|
-
"@dereekb/date": "9.10.
|
|
29
|
+
"@dereekb/model": "9.10.3",
|
|
30
|
+
"@dereekb/date": "9.10.3",
|
|
31
31
|
"date-fns": "^2.29.0",
|
|
32
32
|
"date-fns-tz": "^1.3.0",
|
|
33
33
|
"rrule": "git+https://git@github.com/dereekb/rrule#2b13b1ea881059ba2ecfec380e12ef244ef54570",
|
package/package.json
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dereekb/firebase-server",
|
|
3
|
-
"version": "9.10.
|
|
3
|
+
"version": "9.10.3",
|
|
4
4
|
"devDependencies": {
|
|
5
5
|
"firebase-functions-test": "2.0.2"
|
|
6
6
|
},
|
|
7
7
|
"peerDependencies": {
|
|
8
8
|
"jsonwebtoken": "^8.0.0",
|
|
9
|
-
"@dereekb/firebase": "9.10.
|
|
9
|
+
"@dereekb/firebase": "9.10.3",
|
|
10
10
|
"rxjs": "^7.5.0",
|
|
11
11
|
"firebase": "^9.9.2",
|
|
12
|
-
"@dereekb/util": "9.10.
|
|
12
|
+
"@dereekb/util": "9.10.3",
|
|
13
13
|
"lodash.isequal": "^4.5.0",
|
|
14
14
|
"make-error": "^1.3.0",
|
|
15
15
|
"class-validator": "^0.13.2",
|
|
16
16
|
"ts-essentials": "^9.1.2",
|
|
17
17
|
"extra-set": "^2.2.11",
|
|
18
18
|
"class-transformer": "^0.5.1",
|
|
19
|
-
"@dereekb/rxjs": "9.10.
|
|
19
|
+
"@dereekb/rxjs": "9.10.3",
|
|
20
20
|
"ms": "^3.0.0-canary.1",
|
|
21
|
-
"@dereekb/model": "9.10.
|
|
22
|
-
"@dereekb/date": "9.10.
|
|
21
|
+
"@dereekb/model": "9.10.3",
|
|
22
|
+
"@dereekb/date": "9.10.3",
|
|
23
23
|
"date-fns": "^2.29.0",
|
|
24
24
|
"date-fns-tz": "^1.3.0",
|
|
25
25
|
"rrule": "git+https://git@github.com/dereekb/rrule#2b13b1ea881059ba2ecfec380e12ef244ef54570",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"@nestjs/common": "^9.0.0",
|
|
31
31
|
"@nestjs/core": "^9.0.0",
|
|
32
32
|
"@nestjs/platform-express": "^9.0.0",
|
|
33
|
-
"@dereekb/nestjs": "9.10.
|
|
33
|
+
"@dereekb/nestjs": "9.10.3",
|
|
34
34
|
"@nestjs/config": "^2.0.1",
|
|
35
35
|
"node-schedule": "^2.1.0",
|
|
36
36
|
"tslib": "^2.0.0"
|
|
@@ -27,6 +27,9 @@ function onScheduleWithNestApplicationFactory(baseSchedule) {
|
|
|
27
27
|
else if (typeof schedule.cron === 'number') {
|
|
28
28
|
cron = (0, util_1.cronExpressionRepeatingEveryNMinutes)(schedule.cron);
|
|
29
29
|
}
|
|
30
|
+
else {
|
|
31
|
+
cron = schedule.cron;
|
|
32
|
+
}
|
|
30
33
|
return (nestAppPromiseGetter) => {
|
|
31
34
|
let builder = functions.pubsub.schedule(cron).retryConfig(schedule);
|
|
32
35
|
if (schedule.timezone) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schedule.js","sourceRoot":"","sources":["../../../../../../../../packages/firebase-server/src/lib/nest/function/v1/schedule.ts"],"names":[],"mappings":";;;AAAA,gDAAgD;AAGhD,0CAA6Q;AAC7Q,wCAAmG;AAGnG,SAAgB,wCAAwC,CAAC,eAAwC,EAAE,eAAwC;IACzI,OAAO;QACL,eAAe;QACf,eAAe;KAChB,CAAC;AACJ,CAAC;AALD,4FAKC;AAaD;;;;;GAKG;AACH,SAAgB,oCAAoC,CAAC,YAA+B;IAClF,OAAO,CAAO,aAA+B,EAAE,EAAyD,EAAE,EAAE;QAC1G,MAAM,QAAQ,GAAG,IAAA,mBAAY,EAAmB,CAAC,YAAY,EAAE,aAAa,CAAC,CAAqB,CAAC;QACnG,IAAI,IAAoB,CAAC;QAEzB,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE;YAClB,MAAM,IAAI,KAAK,CAAC,qDAAqD,CAAC,CAAC;SACxE;aAAM,IAAI,OAAO,QAAQ,CAAC,IAAI,KAAK,QAAQ,EAAE;YAC5C,IAAI,GAAG,IAAA,2CAAoC,EAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;SAC5D;QAED,OAAO,CAAC,oBAAkD,EAAE,EAAE;YAC5D,IAAI,OAAO,GAAG,SAAS,CAAC,MAAM,CAAC,QAAQ,CAAC,I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.schedule = (0, util_1.cronExpressionRepeatingEveryNMinutes)(schedule.cron);
|
|
27
27
|
}
|
|
28
|
+
else {
|
|
29
|
+
schedule.schedule = schedule.cron;
|
|
30
|
+
}
|
|
28
31
|
}
|
|
29
32
|
else {
|
|
30
33
|
throw new Error('Missing required "cron" or "schedule" variable for configuration.');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schedule.js","sourceRoot":"","sources":["../../../../../../../../packages/firebase-server/src/lib/nest/function/v2/schedule.ts"],"names":[],"mappings":";;;AACA,8CAAkD;AAGlD,0CAA6Q;AAC7Q,wCAAmF;AAMnF,SAAgB,+CAA+C,CAAC,eAAwC,EAAE,eAA0C;IAClJ,OAAO;QACL,eAAe;QACf,eAAe;KAChB,CAAC;AACJ,CAAC;AALD,0GAKC;AAUD;;;;;GAKG;AACH,SAAgB,2CAA2C,CAAC,YAA+B;IACzF,OAAO,CAAO,aAA+B,EAAE,EAA2D,EAAE,EAAE;QAC5G,MAAM,QAAQ,GAAG,IAAA,mBAAY,EAAmB,CAAC,YAAY,EAAE,aAAa,CAAC,CAAqB,CAAC;QAEnG,IAAI,CAAC,QAAQ,CAAC,QAAQ,EAAE;YACtB,IAAI,QAAQ,CAAC,IAAI,EAAE;gBACjB,IAAI,OAAO,QAAQ,CAAC,IAAI,KAAK,QAAQ,EAAE;oBACrC,QAAQ,CAAC,QAAQ,GAAG,IAAA,2CAAoC,EAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;iBACzE;aACF;iBAAM;gBACL,MAAM,IAAI,KAAK,CAAC,mEAAmE,CAAC,CAAC;aACtF;SACF;QAED,OAAO,CAAC,oBAAkD,EAAE,EAAE;YAC5D,MAAM,MAAM,GAAG,CAAC,eAA0C,EAAE,EAAE,CAAC,oBAAoB,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC,+CAA+C,CAAC,CAAC,EAAE,eAAe,CAAC,CAAC,CAAC,CAAC;YAC3K,MAAM,GAAG,GAA8F,cAAS,CAAC,UAAU,CAAC,QAA2B,EAAE,MAAM,CAAC,CAAC;YACjK,GAAG,CAAC,SAAS,GAAG,QAAQ,CAAC;YACzB,GAAG,CAAC,OAAO,GAAG,MAAM,CAAC;YACrB,OAAO,GAA4E,CAAC;QACtF,CAAC,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC;
|
|
1
|
+
{"version":3,"file":"schedule.js","sourceRoot":"","sources":["../../../../../../../../packages/firebase-server/src/lib/nest/function/v2/schedule.ts"],"names":[],"mappings":";;;AACA,8CAAkD;AAGlD,0CAA6Q;AAC7Q,wCAAmF;AAMnF,SAAgB,+CAA+C,CAAC,eAAwC,EAAE,eAA0C;IAClJ,OAAO;QACL,eAAe;QACf,eAAe;KAChB,CAAC;AACJ,CAAC;AALD,0GAKC;AAUD;;;;;GAKG;AACH,SAAgB,2CAA2C,CAAC,YAA+B;IACzF,OAAO,CAAO,aAA+B,EAAE,EAA2D,EAAE,EAAE;QAC5G,MAAM,QAAQ,GAAG,IAAA,mBAAY,EAAmB,CAAC,YAAY,EAAE,aAAa,CAAC,CAAqB,CAAC;QAEnG,IAAI,CAAC,QAAQ,CAAC,QAAQ,EAAE;YACtB,IAAI,QAAQ,CAAC,IAAI,EAAE;gBACjB,IAAI,OAAO,QAAQ,CAAC,IAAI,KAAK,QAAQ,EAAE;oBACrC,QAAQ,CAAC,QAAQ,GAAG,IAAA,2CAAoC,EAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;iBACzE;qBAAM;oBACL,QAAQ,CAAC,QAAQ,GAAG,QAAQ,CAAC,IAAI,CAAC;iBACnC;aACF;iBAAM;gBACL,MAAM,IAAI,KAAK,CAAC,mEAAmE,CAAC,CAAC;aACtF;SACF;QAED,OAAO,CAAC,oBAAkD,EAAE,EAAE;YAC5D,MAAM,MAAM,GAAG,CAAC,eAA0C,EAAE,EAAE,CAAC,oBAAoB,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC,+CAA+C,CAAC,CAAC,EAAE,eAAe,CAAC,CAAC,CAAC,CAAC;YAC3K,MAAM,GAAG,GAA8F,cAAS,CAAC,UAAU,CAAC,QAA2B,EAAE,MAAM,CAAC,CAAC;YACjK,GAAG,CAAC,SAAS,GAAG,QAAQ,CAAC;YACzB,GAAG,CAAC,OAAO,GAAG,MAAM,CAAC;YACrB,OAAO,GAA4E,CAAC;QACtF,CAAC,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC;AAxBD,kGAwBC;AAOD;;;;;;GAMG;AACH,SAAgB,uCAAuC,CAAI,UAAuD,EAAE,eAAmC;IACrJ,OAAO,CAAC,QAA0B,EAAE,EAA0D,EAAE,EAAE,CAAC,UAAU,CAAC,QAAQ,EAAE,CAAC,OAAuE,EAAE,EAAE,CAAC,EAAE,CAAC,IAAA,0CAA+B,EAAC,eAAe,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC;AACtQ,CAAC;AAFD,0FAEC"}
|
package/test/package.json
CHANGED
|
@@ -1,40 +1,40 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dereekb/firebase-server/test",
|
|
3
|
-
"version": "9.10.
|
|
3
|
+
"version": "9.10.3",
|
|
4
4
|
"type": "commonjs",
|
|
5
5
|
"main": "./src/index.js",
|
|
6
6
|
"typings": "./src/index.d.ts",
|
|
7
7
|
"dependencies": {},
|
|
8
8
|
"peerDependencies": {
|
|
9
|
-
"@dereekb/firebase": "9.10.
|
|
9
|
+
"@dereekb/firebase": "9.10.3",
|
|
10
10
|
"rxjs": "^7.5.0",
|
|
11
11
|
"firebase": "^9.9.2",
|
|
12
|
-
"@dereekb/util": "9.10.
|
|
12
|
+
"@dereekb/util": "9.10.3",
|
|
13
13
|
"lodash.isequal": "^4.5.0",
|
|
14
14
|
"make-error": "^1.3.0",
|
|
15
15
|
"class-validator": "^0.13.2",
|
|
16
16
|
"ts-essentials": "^9.1.2",
|
|
17
17
|
"extra-set": "^2.2.11",
|
|
18
18
|
"class-transformer": "^0.5.1",
|
|
19
|
-
"@dereekb/rxjs": "9.10.
|
|
19
|
+
"@dereekb/rxjs": "9.10.3",
|
|
20
20
|
"ms": "^3.0.0-canary.1",
|
|
21
|
-
"@dereekb/model": "9.10.
|
|
22
|
-
"@dereekb/date": "9.10.
|
|
21
|
+
"@dereekb/model": "9.10.3",
|
|
22
|
+
"@dereekb/date": "9.10.3",
|
|
23
23
|
"date-fns": "^2.29.0",
|
|
24
24
|
"date-fns-tz": "^1.3.0",
|
|
25
25
|
"rrule": "git+https://git@github.com/dereekb/rrule#2b13b1ea881059ba2ecfec380e12ef244ef54570",
|
|
26
26
|
"@vvo/tzdb": "^6.56.0",
|
|
27
|
-
"@dereekb/util/test": "9.10.
|
|
27
|
+
"@dereekb/util/test": "9.10.3",
|
|
28
28
|
"firebase-admin": "^11.0.0",
|
|
29
29
|
"jsonwebtoken": "^8.0.0",
|
|
30
30
|
"firebase-functions": "^3.24.0",
|
|
31
31
|
"@nestjs/common": "^9.0.0",
|
|
32
32
|
"@google-cloud/firestore": "^5.0.2",
|
|
33
|
-
"@dereekb/firebase/test": "9.10.
|
|
34
|
-
"@dereekb/firebase-server": "9.10.
|
|
33
|
+
"@dereekb/firebase/test": "9.10.3",
|
|
34
|
+
"@dereekb/firebase-server": "9.10.3",
|
|
35
35
|
"@nestjs/core": "^9.0.0",
|
|
36
36
|
"@nestjs/platform-express": "^9.0.0",
|
|
37
|
-
"@dereekb/nestjs": "9.10.
|
|
37
|
+
"@dereekb/nestjs": "9.10.3",
|
|
38
38
|
"@nestjs/config": "^2.0.1",
|
|
39
39
|
"node-schedule": "^2.1.0",
|
|
40
40
|
"tslib": "^2.0.0"
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { FirestoreCollection, FirestoreDocument, DocumentReference, FirestoreModelId, FirestoreModelKey } from '@dereekb/firebase';
|
|
2
|
-
import { PromiseOrValue } from '@dereekb/util';
|
|
2
|
+
import { Maybe, PromiseOrValue } from '@dereekb/util';
|
|
3
3
|
import { JestTestContextFixture, AbstractChildJestTestContextFixture } from '@dereekb/util/test';
|
|
4
4
|
import { FirebaseAdminTestContext } from './firebase.admin';
|
|
5
5
|
/**
|
|
@@ -39,6 +39,10 @@ export interface ModelTestContextFactoryParams<T, D extends FirestoreDocument<T>
|
|
|
39
39
|
* Creates the custom fixture. If not defined, a ModelTestContextFixture is created.
|
|
40
40
|
*/
|
|
41
41
|
makeFixture?: (parent: PF) => F;
|
|
42
|
+
/**
|
|
43
|
+
* Optional function to try and get an existing reference from the input config. This model will be considered to be fully initialized.
|
|
44
|
+
*/
|
|
45
|
+
useRef?: (config: C, parentInstance: PI) => Promise<Maybe<DocumentReference<T>>>;
|
|
42
46
|
/**
|
|
43
47
|
* Optional function to create a DocumentReference.
|
|
44
48
|
*/
|
|
@@ -54,6 +58,7 @@ export interface ModelTestContextFactoryParams<T, D extends FirestoreDocument<T>
|
|
|
54
58
|
}
|
|
55
59
|
export declare type ModelTestContextParams<C = any, PI extends FirebaseAdminTestContext = FirebaseAdminTestContext, PF extends JestTestContextFixture<PI> = JestTestContextFixture<PI>> = {
|
|
56
60
|
f: PF;
|
|
61
|
+
ref?: Maybe<DocumentReference<any>>;
|
|
57
62
|
} & C;
|
|
58
63
|
/**
|
|
59
64
|
* Creates a new Jest Context that has a random user for authorization for use in firebase server tests.
|
|
@@ -43,7 +43,7 @@ exports.ModelTestContextInstance = ModelTestContextInstance;
|
|
|
43
43
|
* Creates a new Jest Context that has a random user for authorization for use in firebase server tests.
|
|
44
44
|
*/
|
|
45
45
|
function modelTestContextFactory(config) {
|
|
46
|
-
const { getCollection, makeRef = (collection) => collection.documentAccessor().newDocument().documentRef, makeInstance = (collection, ref, testInstance) => new ModelTestContextInstance(collection, ref, testInstance), makeFixture = (f) => new ModelTestContextFixture(f), initDocument } = config;
|
|
46
|
+
const { getCollection, useRef: loadRef, makeRef = (collection) => collection.documentAccessor().newDocument().documentRef, makeInstance = (collection, ref, testInstance) => new ModelTestContextInstance(collection, ref, testInstance), makeFixture = (f) => new ModelTestContextFixture(f), initDocument } = config;
|
|
47
47
|
return (params, buildTests) => {
|
|
48
48
|
const { f } = params;
|
|
49
49
|
return (0, test_1.useJestContextFixture)({
|
|
@@ -52,9 +52,17 @@ function modelTestContextFactory(config) {
|
|
|
52
52
|
initInstance: () => tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
53
53
|
const parentInstance = f.instance;
|
|
54
54
|
const collection = getCollection(parentInstance, params);
|
|
55
|
-
|
|
55
|
+
let ref = params.ref;
|
|
56
|
+
let init = ref == null;
|
|
57
|
+
if (ref != null && loadRef != null) {
|
|
58
|
+
ref = yield loadRef(params, parentInstance);
|
|
59
|
+
init = false;
|
|
60
|
+
}
|
|
61
|
+
if (!ref) {
|
|
62
|
+
ref = yield makeRef(collection, params, parentInstance);
|
|
63
|
+
}
|
|
56
64
|
const instance = yield makeInstance(collection, ref, parentInstance);
|
|
57
|
-
if (initDocument) {
|
|
65
|
+
if (init && initDocument) {
|
|
58
66
|
yield initDocument(instance, params);
|
|
59
67
|
}
|
|
60
68
|
return instance;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"firebase.admin.collection.js","sourceRoot":"","sources":["../../../../../../../packages/firebase-server/test/src/lib/firebase/firebase.admin.collection.ts"],"names":[],"mappings":";;;;AAEA,6CAAwH;AAaxH,MAAa,uBAAyS,SAAQ,0CAA0C;IACtW,qCAAqC;IACrC,IAAI,UAAU;QACZ,OAAO,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC;IAClC,CAAC;IAED,IAAI,WAAW;QACb,OAAO,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC;IACnC,CAAC;IAED,IAAI,WAAW;QACb,OAAO,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC;IACnC,CAAC;IAED,IAAI,QAAQ;QACV,OAAO,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC;IAChC,CAAC;CACF;AAjBD,0DAiBC;AAED,MAAa,wBAAwB;IACnC,YAAqB,UAAqC,EAAW,GAAyB,EAAW,WAAe;QAAnG,eAAU,GAAV,UAAU,CAA2B;QAAW,QAAG,GAAH,GAAG,CAAsB;QAAW,gBAAW,GAAX,WAAW,CAAI;IAAG,CAAC;IAE5H,IAAI,UAAU;QACZ,OAAO,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;IACrB,CAAC;IAED,IAAI,WAAW;QACb,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC;IACvB,CAAC;IAED,IAAI,WAAW;QACb,OAAO,IAAI,CAAC,GAAG,CAAC;IAClB,CAAC;IAED,IAAI,QAAQ;QACV,OAAO,IAAI,CAAC,UAAU,CAAC,gBAAgB,EAAE,CAAC,YAAY,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACnE,CAAC;CACF;AAlBD,4DAkBC;
|
|
1
|
+
{"version":3,"file":"firebase.admin.collection.js","sourceRoot":"","sources":["../../../../../../../packages/firebase-server/test/src/lib/firebase/firebase.admin.collection.ts"],"names":[],"mappings":";;;;AAEA,6CAAwH;AAaxH,MAAa,uBAAyS,SAAQ,0CAA0C;IACtW,qCAAqC;IACrC,IAAI,UAAU;QACZ,OAAO,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC;IAClC,CAAC;IAED,IAAI,WAAW;QACb,OAAO,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC;IACnC,CAAC;IAED,IAAI,WAAW;QACb,OAAO,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC;IACnC,CAAC;IAED,IAAI,QAAQ;QACV,OAAO,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC;IAChC,CAAC;CACF;AAjBD,0DAiBC;AAED,MAAa,wBAAwB;IACnC,YAAqB,UAAqC,EAAW,GAAyB,EAAW,WAAe;QAAnG,eAAU,GAAV,UAAU,CAA2B;QAAW,QAAG,GAAH,GAAG,CAAsB;QAAW,gBAAW,GAAX,WAAW,CAAI;IAAG,CAAC;IAE5H,I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