@dereekb/firebase 8.2.0 → 8.3.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/CHANGELOG.md +10 -0
- package/package.json +5 -5
- package/src/lib/common/firestore/accessor/document.utility.d.ts +28 -0
- package/src/lib/common/firestore/accessor/document.utility.js +48 -1
- package/src/lib/common/firestore/accessor/document.utility.js.map +1 -1
- package/src/lib/common/firestore/query/accumulator.d.ts +2 -1
- package/src/lib/common/firestore/query/accumulator.js +7 -5
- package/src/lib/common/firestore/query/accumulator.js.map +1 -1
- package/test/CHANGELOG.md +4 -0
- package/test/package.json +7 -7
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,16 @@
|
|
|
2
2
|
|
|
3
3
|
This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
|
|
4
4
|
|
|
5
|
+
# [8.3.0](https://github.com/dereekb/dbx-components/compare/v8.2.0-dev...v8.3.0) (2022-06-20)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* added DbxFirebaseDocumentLoaderInstance ([523d1df](https://github.com/dereekb/dbx-components/commit/523d1dff22ac979b75bd310677770665ec76ff63))
|
|
11
|
+
* added getDocumentSnapshotsData() ([dc26340](https://github.com/dereekb/dbx-components/commit/dc26340972df9f1a7a8b8767e2929ca956e9e4a5))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
5
15
|
# [8.2.0](https://github.com/dereekb/dbx-components/compare/v8.1.2-dev...v8.2.0) (2022-06-20)
|
|
6
16
|
|
|
7
17
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dereekb/firebase",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.3.0",
|
|
4
4
|
"devDependencies": {
|
|
5
5
|
"@firebase/rules-unit-testing": "^2.0.0"
|
|
6
6
|
},
|
|
@@ -23,16 +23,16 @@
|
|
|
23
23
|
"rxfire": "^6.0.3",
|
|
24
24
|
"rxjs": "^7.0.0",
|
|
25
25
|
"firebase": "^9.8.0",
|
|
26
|
-
"@dereekb/util": "8.
|
|
26
|
+
"@dereekb/util": "8.3.0",
|
|
27
27
|
"make-error": "^1.3.0",
|
|
28
28
|
"ts-essentials": "^9.1.2",
|
|
29
29
|
"extra-set": "^2.2.11",
|
|
30
|
-
"@dereekb/rxjs": "8.
|
|
30
|
+
"@dereekb/rxjs": "8.3.0",
|
|
31
31
|
"ms": "^3.0.0-canary.1",
|
|
32
|
-
"@dereekb/model": "8.
|
|
32
|
+
"@dereekb/model": "8.3.0",
|
|
33
33
|
"class-transformer": "^0.5.1",
|
|
34
34
|
"class-validator": "^0.13.2",
|
|
35
|
-
"@dereekb/date": "8.
|
|
35
|
+
"@dereekb/date": "8.3.0",
|
|
36
36
|
"date-fns": "^2.28.0",
|
|
37
37
|
"date-fns-tz": "^1.3.0",
|
|
38
38
|
"rrule": "2.7.0",
|
|
@@ -25,6 +25,14 @@ export interface MakeDocumentsParams<T, D extends FirestoreDocument<T> = Firesto
|
|
|
25
25
|
*/
|
|
26
26
|
export declare function makeDocuments<T, D extends FirestoreDocument<T>>(documentAccessor: FirestoreDocumentAccessor<T, D>, make: MakeDocumentsParams<T, D>): Promise<D[]>;
|
|
27
27
|
export declare function getDocumentSnapshots<T, D extends FirestoreDocument<T>>(documents: D[]): Promise<DocumentSnapshot<T>[]>;
|
|
28
|
+
export declare function getDocumentSnapshotsData<T, D extends FirestoreDocument<T>>(documents: D[]): Promise<DocumentDataWithId<T>[]>;
|
|
29
|
+
export declare function getDocumentSnapshotsData<T, D extends FirestoreDocument<T>>(documents: D[], withId: true): Promise<DocumentDataWithId<T>[]>;
|
|
30
|
+
export declare function getDocumentSnapshotsData<T, D extends FirestoreDocument<T>>(documents: D[], withId: false): Promise<T[]>;
|
|
31
|
+
export declare function getDocumentSnapshotsData<T, D extends FirestoreDocument<T>>(documents: D[], withId?: boolean): Promise<DocumentDataWithId<T>[] | T[]>;
|
|
32
|
+
export declare function getDataFromDocumentSnapshots<T>(snapshots: DocumentSnapshot<T>[]): DocumentDataWithId<T>[];
|
|
33
|
+
export declare function getDataFromDocumentSnapshots<T>(snapshots: DocumentSnapshot<T>[], withId: true): DocumentDataWithId<T>[];
|
|
34
|
+
export declare function getDataFromDocumentSnapshots<T>(snapshots: DocumentSnapshot<T>[], withId: false): T[];
|
|
35
|
+
export declare function getDataFromDocumentSnapshots<T>(snapshots: DocumentSnapshot<T>[], withId?: boolean): DocumentDataWithId<T>[] | T[];
|
|
28
36
|
export declare function loadDocumentsForSnapshots<T, D extends FirestoreDocument<T>>(accessor: LimitedFirestoreDocumentAccessor<T, D>, snapshots: QuerySnapshot<T>): D[];
|
|
29
37
|
export declare function loadDocumentsForDocumentReferencesFromValues<I, T, D extends FirestoreDocument<T>>(accessor: LimitedFirestoreDocumentAccessor<T, D>, values: I[], getRef: (value: I) => DocumentReference<T>): D[];
|
|
30
38
|
export declare const loadDocumentsForValues: typeof loadDocumentsForDocumentReferencesFromValues;
|
|
@@ -44,6 +52,20 @@ export declare type FirestoreDocumentLoader<T, D extends FirestoreDocument<T>> =
|
|
|
44
52
|
* @returns
|
|
45
53
|
*/
|
|
46
54
|
export declare function firestoreDocumentLoader<T, D extends FirestoreDocument<T>>(accessorContext: LimitedFirestoreDocumentAccessorContextExtension<T, D>): FirestoreDocumentLoader<T, D>;
|
|
55
|
+
/**
|
|
56
|
+
* Creates the document data from the snapshot.
|
|
57
|
+
*
|
|
58
|
+
* @param snapshot
|
|
59
|
+
* @returns
|
|
60
|
+
*/
|
|
61
|
+
export declare function documentData<T>(snapshot: DocumentSnapshot<T>): Maybe<DocumentDataWithId<T>>;
|
|
62
|
+
export declare function documentData<T>(snapshot: DocumentSnapshot<T>, withId: true): Maybe<DocumentDataWithId<T>>;
|
|
63
|
+
export declare function documentData<T>(snapshot: DocumentSnapshot<T>, withId: false): Maybe<T>;
|
|
64
|
+
export declare type DocumentDataFunction<T> = (snapshot: DocumentSnapshot<T>) => Maybe<T>;
|
|
65
|
+
export declare type DocumentDataWithIdFunction<T> = (snapshot: DocumentSnapshot<T>) => Maybe<DocumentDataWithId<T>>;
|
|
66
|
+
export declare function documentDataFunction<T>(withId: true): DocumentDataWithIdFunction<T>;
|
|
67
|
+
export declare function documentDataFunction<T>(withId: false): DocumentDataFunction<T>;
|
|
68
|
+
export declare function documentDataFunction<T>(withId: boolean): DocumentDataWithIdFunction<T> | DocumentDataFunction<T>;
|
|
47
69
|
/**
|
|
48
70
|
* Creates a DocumentDataWithId from the input DocumentSnapshot. If the data does not exist, returns undefined.
|
|
49
71
|
*
|
|
@@ -64,3 +86,9 @@ export declare function useDocumentSnapshot<T, D extends FirestoreDocument<T>, O
|
|
|
64
86
|
* MappedUseAsyncFunction to load snapshot data from the input document and use it.
|
|
65
87
|
*/
|
|
66
88
|
export declare const useDocumentSnapshotData: import("@dereekb/util").MappedUseAsyncFunction<FirestoreDocument<unknown, import("../collection").FirestoreModelIdentity<string, string>>, unknown>;
|
|
89
|
+
export declare function firestoreModelIdFromDocument<T, D extends FirestoreDocument<T>>(document: D): FirestoreModelId;
|
|
90
|
+
export declare function firestoreModelIdsFromDocuments<T, D extends FirestoreDocument<T>>(documents: D[]): FirestoreModelId[];
|
|
91
|
+
export declare function firestoreModelKeyFromDocument<T, D extends FirestoreDocument<T>>(document: D): FirestoreModelKey;
|
|
92
|
+
export declare function firestoreModelKeysFromDocuments<T, D extends FirestoreDocument<T>>(documents: D[]): FirestoreModelKey[];
|
|
93
|
+
export declare function documentReferenceFromDocument<T, D extends FirestoreDocument<T>>(document: D): DocumentReference<T>;
|
|
94
|
+
export declare function documentReferencesFromDocuments<T, D extends FirestoreDocument<T>>(documents: D[]): DocumentReference<T>[];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.useDocumentSnapshotData = exports.useDocumentSnapshot = exports.documentDataWithId = exports.firestoreDocumentLoader = exports.loadDocumentsForIds = exports.loadDocumentsForIdsFromValues = exports.loadDocumentsForKeys = exports.loadDocumentsForKeysFromValues = exports.loadDocumentsForDocumentReferences = exports.loadDocumentsForValues = exports.loadDocumentsForDocumentReferencesFromValues = exports.loadDocumentsForSnapshots = exports.getDocumentSnapshots = exports.makeDocuments = exports.newDocuments = void 0;
|
|
3
|
+
exports.documentReferencesFromDocuments = exports.documentReferenceFromDocument = exports.firestoreModelKeysFromDocuments = exports.firestoreModelKeyFromDocument = exports.firestoreModelIdsFromDocuments = exports.firestoreModelIdFromDocument = exports.useDocumentSnapshotData = exports.useDocumentSnapshot = exports.documentDataWithId = exports.documentDataFunction = exports.documentData = exports.firestoreDocumentLoader = exports.loadDocumentsForIds = exports.loadDocumentsForIdsFromValues = exports.loadDocumentsForKeys = exports.loadDocumentsForKeysFromValues = exports.loadDocumentsForDocumentReferences = exports.loadDocumentsForValues = exports.loadDocumentsForDocumentReferencesFromValues = exports.loadDocumentsForSnapshots = exports.getDataFromDocumentSnapshots = exports.getDocumentSnapshotsData = exports.getDocumentSnapshots = exports.makeDocuments = exports.newDocuments = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const util_1 = require("@dereekb/util");
|
|
6
6
|
function newDocuments(documentAccessor, count) {
|
|
@@ -34,6 +34,15 @@ function getDocumentSnapshots(documents) {
|
|
|
34
34
|
return util_1.PromiseUtility.runTasksForValues(documents, (x) => x.accessor.get());
|
|
35
35
|
}
|
|
36
36
|
exports.getDocumentSnapshots = getDocumentSnapshots;
|
|
37
|
+
function getDocumentSnapshotsData(documents, withId = true) {
|
|
38
|
+
return getDocumentSnapshots(documents).then((x) => getDataFromDocumentSnapshots(x, withId));
|
|
39
|
+
}
|
|
40
|
+
exports.getDocumentSnapshotsData = getDocumentSnapshotsData;
|
|
41
|
+
function getDataFromDocumentSnapshots(snapshots, withId = true) {
|
|
42
|
+
const mapFn = documentDataFunction(withId);
|
|
43
|
+
return (0, util_1.filterMaybeValues)(snapshots.map(mapFn));
|
|
44
|
+
}
|
|
45
|
+
exports.getDataFromDocumentSnapshots = getDataFromDocumentSnapshots;
|
|
37
46
|
function loadDocumentsForSnapshots(accessor, snapshots) {
|
|
38
47
|
return snapshots.docs.map((x) => accessor.loadDocument(x.ref));
|
|
39
48
|
}
|
|
@@ -76,6 +85,19 @@ function firestoreDocumentLoader(accessorContext) {
|
|
|
76
85
|
};
|
|
77
86
|
}
|
|
78
87
|
exports.firestoreDocumentLoader = firestoreDocumentLoader;
|
|
88
|
+
function documentData(snapshot, withId = false) {
|
|
89
|
+
if (withId) {
|
|
90
|
+
return documentDataWithId(snapshot);
|
|
91
|
+
}
|
|
92
|
+
else {
|
|
93
|
+
return snapshot.data();
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
exports.documentData = documentData;
|
|
97
|
+
function documentDataFunction(withId) {
|
|
98
|
+
return withId ? documentDataWithId : (snapshot) => snapshot.data();
|
|
99
|
+
}
|
|
100
|
+
exports.documentDataFunction = documentDataFunction;
|
|
79
101
|
/**
|
|
80
102
|
* Creates a DocumentDataWithId from the input DocumentSnapshot. If the data does not exist, returns undefined.
|
|
81
103
|
*
|
|
@@ -109,4 +131,29 @@ exports.useDocumentSnapshot = useDocumentSnapshot;
|
|
|
109
131
|
* MappedUseAsyncFunction to load snapshot data from the input document and use it.
|
|
110
132
|
*/
|
|
111
133
|
exports.useDocumentSnapshotData = (0, util_1.wrapUseAsyncFunction)(useDocumentSnapshot, (x) => x.data());
|
|
134
|
+
// MARK: Key Accessors
|
|
135
|
+
function firestoreModelIdFromDocument(document) {
|
|
136
|
+
return document.id;
|
|
137
|
+
}
|
|
138
|
+
exports.firestoreModelIdFromDocument = firestoreModelIdFromDocument;
|
|
139
|
+
function firestoreModelIdsFromDocuments(documents) {
|
|
140
|
+
return documents.map(firestoreModelIdFromDocument);
|
|
141
|
+
}
|
|
142
|
+
exports.firestoreModelIdsFromDocuments = firestoreModelIdsFromDocuments;
|
|
143
|
+
function firestoreModelKeyFromDocument(document) {
|
|
144
|
+
return document.key;
|
|
145
|
+
}
|
|
146
|
+
exports.firestoreModelKeyFromDocument = firestoreModelKeyFromDocument;
|
|
147
|
+
function firestoreModelKeysFromDocuments(documents) {
|
|
148
|
+
return documents.map(firestoreModelKeyFromDocument);
|
|
149
|
+
}
|
|
150
|
+
exports.firestoreModelKeysFromDocuments = firestoreModelKeysFromDocuments;
|
|
151
|
+
function documentReferenceFromDocument(document) {
|
|
152
|
+
return document.documentRef;
|
|
153
|
+
}
|
|
154
|
+
exports.documentReferenceFromDocument = documentReferenceFromDocument;
|
|
155
|
+
function documentReferencesFromDocuments(documents) {
|
|
156
|
+
return documents.map(documentReferenceFromDocument);
|
|
157
|
+
}
|
|
158
|
+
exports.documentReferencesFromDocuments = documentReferencesFromDocuments;
|
|
112
159
|
//# sourceMappingURL=document.utility.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"document.utility.js","sourceRoot":"","sources":["../../../../../../../../packages/firebase/src/lib/common/firestore/accessor/document.utility.ts"],"names":[],"mappings":";;;;AAAA,
|
|
1
|
+
{"version":3,"file":"document.utility.js","sourceRoot":"","sources":["../../../../../../../../packages/firebase/src/lib/common/firestore/accessor/document.utility.ts"],"names":[],"mappings":";;;;AAAA,wCAAyK;AAKzK,SAAgB,YAAY,CAAoC,gBAAiD,EAAE,KAAa;IAC9H,OAAO,IAAA,sBAAe,EAAC,GAAG,EAAE,CAAC,gBAAgB,CAAC,WAAW,EAAE,EAAE,KAAK,CAAC,CAAC;AACtE,CAAC;AAFD,oCAEC;AAkBD;;;;;;GAMG;AACH,SAAgB,aAAa,CAAoC,gBAAiD,EAAE,IAA+B;;IACjJ,MAAM,aAAa,GAAG,MAAA,IAAI,CAAC,WAAW,mCAAI,CAAC,GAAG,EAAE,CAAC,gBAAgB,CAAC,WAAW,EAAE,CAAC,CAAC;IACjF,OAAO,IAAA,sBAAe,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DAGC;AAED;;GAEG;AACU,QAAA,uBAAuB,GAAG,IAAA,2BAAoB,EAAC,mBAAmB,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;AAElG,sBAAsB;AACtB,SAAgB,4BAA4B,CAAoC,QAAW;IACzF,OAAO,QAAQ,CAAC,EAAE,CAAC;AACrB,CAAC;AAFD,oEAEC;AAED,SAAgB,8BAA8B,CAAoC,SAAc;IAC9F,OAAO,SAAS,CAAC,GAAG,CAAC,4BAA4B,CAAC,CAAC;AACrD,CAAC;AAFD,wEAEC;AAED,SAAgB,6BAA6B,CAAoC,QAAW;IAC1F,OAAO,QAAQ,CAAC,GAAG,CAAC;AACtB,CAAC;AAFD,sEAEC;AAED,SAAgB,+BAA+B,CAAoC,SAAc;IAC/F,OAAO,SAAS,CAAC,GAAG,CAAC,6BAA6B,CAAC,CAAC;AACtD,CAAC;AAFD,0EAEC;AAED,SAAgB,6BAA6B,CAAoC,QAAW;IAC1F,OAAO,QAAQ,CAAC,WAAW,CAAC;AAC9B,CAAC;AAFD,sEAEC;AAED,SAAgB,+BAA+B,CAAoC,SAAc;IAC/F,OAAO,SAAS,CAAC,GAAG,CAAC,6BAA6B,CAAC,CAAC;AACtD,CAAC;AAFD,0EAEC"}
|
|
@@ -21,4 +21,5 @@ export declare function firebaseQuerySnapshotAccumulator<O, T>(iteration: Firest
|
|
|
21
21
|
* @param iteration
|
|
22
22
|
*/
|
|
23
23
|
export declare function firebaseQueryItemAccumulator<T>(iteration: FirestoreItemPageIterationInstance<T>): FirebaseQueryItemAccumulator<T>;
|
|
24
|
-
export declare function firebaseQueryItemAccumulator<U, T>(iteration: FirestoreItemPageIterationInstance<T>, mapItem
|
|
24
|
+
export declare function firebaseQueryItemAccumulator<U, T>(iteration: FirestoreItemPageIterationInstance<T>, mapItem: MapFunction<DocumentDataWithId<T>, U>): MappedFirebaseQuerySnapshotAccumulator<U[], T>;
|
|
25
|
+
export declare function firebaseQueryItemAccumulator<U, T>(iteration: FirestoreItemPageIterationInstance<T>, mapItem?: MapFunction<DocumentDataWithId<T>, U>): FirebaseQueryItemAccumulator<T> | MappedFirebaseQuerySnapshotAccumulator<U[], T>;
|
|
@@ -2,18 +2,20 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.firebaseQueryItemAccumulator = exports.firebaseQuerySnapshotAccumulator = void 0;
|
|
4
4
|
const rxjs_1 = require("@dereekb/rxjs");
|
|
5
|
+
const util_1 = require("@dereekb/util");
|
|
6
|
+
const accessor_1 = require("../accessor");
|
|
5
7
|
function firebaseQuerySnapshotAccumulator(iteration, mapSnapshots) {
|
|
6
8
|
return (0, rxjs_1.itemAccumulator)(iteration, mapSnapshots);
|
|
7
9
|
}
|
|
8
10
|
exports.firebaseQuerySnapshotAccumulator = firebaseQuerySnapshotAccumulator;
|
|
9
11
|
function firebaseQueryItemAccumulator(iteration, mapItem) {
|
|
10
12
|
mapItem = mapItem !== null && mapItem !== void 0 ? mapItem : ((x) => x);
|
|
13
|
+
const snapshotData = (0, accessor_1.documentDataFunction)(true);
|
|
11
14
|
const mapFn = (x) => {
|
|
12
|
-
const result = x.map((y) => {
|
|
13
|
-
const data = y
|
|
14
|
-
data
|
|
15
|
-
|
|
16
|
-
});
|
|
15
|
+
const result = (0, util_1.filterMaybeValues)(x.map((y) => {
|
|
16
|
+
const data = snapshotData(y);
|
|
17
|
+
return data ? mapItem(data) : undefined;
|
|
18
|
+
}));
|
|
17
19
|
return result;
|
|
18
20
|
};
|
|
19
21
|
return firebaseQuerySnapshotAccumulator(iteration, mapFn);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"accumulator.js","sourceRoot":"","sources":["../../../../../../../../packages/firebase/src/lib/common/firestore/query/accumulator.ts"],"names":[],"mappings":";;;AAAA,wCAAwH;
|
|
1
|
+
{"version":3,"file":"accumulator.js","sourceRoot":"","sources":["../../../../../../../../packages/firebase/src/lib/common/firestore/query/accumulator.ts"],"names":[],"mappings":";;;AAAA,wCAAwH;AACxH,wCAA+D;AAC/D,0CAAmD;AAmBnD,SAAgB,gCAAgC,CAAO,SAAgD,EAAE,YAA2E;IAClL,OAAO,IAAA,sBAAe,EAAqF,SAAS,EAAE,YAAY,CAAC,CAAC;AACtI,CAAC;AAFD,4EAEC;AAUD,SAAgB,4BAA4B,CAAO,SAAgD,EAAE,OAA+C;IAClJ,OAAO,GAAG,OAAO,aAAP,OAAO,cAAP,OAAO,GAAK,CAAC,CAAC,CAAwB,EAAE,EAAE,CAAC,CAAC,CAAsD,CAAC;IAE7G,MAAM,YAAY,GAAG,IAAA,+BAAoB,EAAI,IAAI,CAAC,CAAC;IACnD,MAAM,KAAK,GAAmE,CAAC,CAAgC,EAAE,EAAE;QACjH,MAAM,MAAM,GAAQ,IAAA,wBAAiB,EACnC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE;YACV,MAAM,IAAI,GAAG,YAAY,CAAC,CAAC,CAAC,CAAC;YAC7B,OAAO,IAAI,CAAC,CAAC,CAAE,OAAiD,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;QACrF,CAAC,CAAC,CACH,CAAC;QAEF,OAAO,MAAM,CAAC;IAChB,CAAC,CAAC;IAEF,OAAO,gCAAgC,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;AAC5D,CAAC;AAhBD,oEAgBC"}
|
package/test/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
|
+
# [8.3.0](https://github.com/dereekb/dbx-components/compare/v8.2.0-dev...v8.3.0) (2022-06-20)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
5
9
|
# [8.2.0](https://github.com/dereekb/dbx-components/compare/v8.1.2-dev...v8.2.0) (2022-06-20)
|
|
6
10
|
|
|
7
11
|
|
package/test/package.json
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dereekb/firebase/test",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.3.0",
|
|
4
4
|
"main": "./src/index.js",
|
|
5
5
|
"typings": "./src/index.d.ts",
|
|
6
6
|
"dependencies": {},
|
|
7
7
|
"peerDependencies": {
|
|
8
|
-
"@dereekb/util/test": "8.
|
|
9
|
-
"@dereekb/util": "8.
|
|
8
|
+
"@dereekb/util/test": "8.3.0",
|
|
9
|
+
"@dereekb/util": "8.3.0",
|
|
10
10
|
"make-error": "^1.3.0",
|
|
11
11
|
"ts-essentials": "^9.1.2",
|
|
12
12
|
"extra-set": "^2.2.11",
|
|
13
|
-
"@dereekb/firebase": "8.
|
|
13
|
+
"@dereekb/firebase": "8.3.0",
|
|
14
14
|
"rxfire": "^6.0.3",
|
|
15
15
|
"rxjs": "^7.0.0",
|
|
16
16
|
"firebase": "^9.8.0",
|
|
17
|
-
"@dereekb/rxjs": "8.
|
|
17
|
+
"@dereekb/rxjs": "8.3.0",
|
|
18
18
|
"ms": "^3.0.0-canary.1",
|
|
19
|
-
"@dereekb/model": "8.
|
|
19
|
+
"@dereekb/model": "8.3.0",
|
|
20
20
|
"class-transformer": "^0.5.1",
|
|
21
21
|
"class-validator": "^0.13.2",
|
|
22
|
-
"@dereekb/date": "8.
|
|
22
|
+
"@dereekb/date": "8.3.0",
|
|
23
23
|
"date-fns": "^2.28.0",
|
|
24
24
|
"date-fns-tz": "^1.3.0",
|
|
25
25
|
"rrule": "2.7.0",
|