@dereekb/firebase-server 9.10.2 → 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 CHANGED
@@ -2,6 +2,10 @@
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
+
5
9
  ## [9.10.2](https://github.com/dereekb/dbx-components/compare/v9.10.1-dev...v9.10.2) (2022-10-06)
6
10
 
7
11
 
@@ -1,33 +1,33 @@
1
1
  {
2
2
  "name": "@dereekb/firebase-server/mailgun",
3
- "version": "9.10.2",
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.2",
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.2",
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.2",
19
+ "@dereekb/nestjs": "9.10.3",
20
20
  "@nestjs/config": "^2.0.1",
21
- "@dereekb/firebase-server": "9.10.2",
21
+ "@dereekb/firebase-server": "9.10.3",
22
22
  "jsonwebtoken": "^8.0.0",
23
- "@dereekb/firebase": "9.10.2",
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.2",
27
+ "@dereekb/rxjs": "9.10.3",
28
28
  "ms": "^3.0.0-canary.1",
29
- "@dereekb/model": "9.10.2",
30
- "@dereekb/date": "9.10.2",
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.2",
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.2",
9
+ "@dereekb/firebase": "9.10.3",
10
10
  "rxjs": "^7.5.0",
11
11
  "firebase": "^9.9.2",
12
- "@dereekb/util": "9.10.2",
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.2",
19
+ "@dereekb/rxjs": "9.10.3",
20
20
  "ms": "^3.0.0-canary.1",
21
- "@dereekb/model": "9.10.2",
22
- "@dereekb/date": "9.10.2",
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.2",
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"
package/test/package.json CHANGED
@@ -1,40 +1,40 @@
1
1
  {
2
2
  "name": "@dereekb/firebase-server/test",
3
- "version": "9.10.2",
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.2",
9
+ "@dereekb/firebase": "9.10.3",
10
10
  "rxjs": "^7.5.0",
11
11
  "firebase": "^9.9.2",
12
- "@dereekb/util": "9.10.2",
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.2",
19
+ "@dereekb/rxjs": "9.10.3",
20
20
  "ms": "^3.0.0-canary.1",
21
- "@dereekb/model": "9.10.2",
22
- "@dereekb/date": "9.10.2",
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.2",
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.2",
34
- "@dereekb/firebase-server": "9.10.2",
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.2",
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
- const ref = yield makeRef(collection, params, parentInstance);
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;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C,QAAQ,CAAC;gBAClC,MAAM,UAAU,GAAG,aAAa,CAAC,cAAc,EAAE,MAAM,CAAC,CAAC;gBACzD,MAAM,GAAG,GAAG,MAAM,OAAO,CAAC,UAAU,EAAE,MAAM,EAAE,cAAc,CAAC,CAAC;gBAC9D,MAAM,QAAQ,GAAM,MAAM,YAAY,CAAC,UAAU,EAAE,GAAG,EAAE,cAAc,CAAC,CAAC;gBAExE,IAAI,YAAY,EAAE;oBAChB,MAAM,YAAY,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;iBACtC;gBAED,OAAO,QAAQ,CAAC;YAClB,CAAC,CAAA;SACF,CAAC,CAAC;IACL,CAAC,CAAC;AACJ,CAAC;AAxBD,0DAwBC"}
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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