@dereekb/firebase 8.2.0 → 8.5.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 +23 -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/collection/collection.d.ts +26 -0
- package/src/lib/common/firestore/collection/collection.js +33 -1
- package/src/lib/common/firestore/collection/collection.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/src/lib/common/model/model/index.d.ts +1 -0
- package/src/lib/common/model/model/index.js +1 -0
- package/src/lib/common/model/model/index.js.map +1 -1
- package/src/lib/common/model/model/model.validator.d.ts +9 -0
- package/src/lib/common/model/model/model.validator.js +46 -0
- package/src/lib/common/model/model/model.validator.js.map +1 -0
- package/test/CHANGELOG.md +12 -0
- package/test/package.json +7 -7
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,29 @@
|
|
|
2
2
|
|
|
3
3
|
This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
|
|
4
4
|
|
|
5
|
+
# [8.5.0](https://github.com/dereekb/dbx-components/compare/v8.4.0-dev...v8.5.0) (2022-06-22)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* added firestore key validators ([9d090db](https://github.com/dereekb/dbx-components/commit/9d090db1e84b97f11cc2b751dcbe7d2724960b2b))
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
# [8.4.0](https://github.com/dereekb/dbx-components/compare/v8.3.0-dev...v8.4.0) (2022-06-21)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
# [8.3.0](https://github.com/dereekb/dbx-components/compare/v8.2.0-dev...v8.3.0) (2022-06-20)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
### Features
|
|
22
|
+
|
|
23
|
+
* added DbxFirebaseDocumentLoaderInstance ([523d1df](https://github.com/dereekb/dbx-components/commit/523d1dff22ac979b75bd310677770665ec76ff63))
|
|
24
|
+
* added getDocumentSnapshotsData() ([dc26340](https://github.com/dereekb/dbx-components/commit/dc26340972df9f1a7a8b8767e2929ca956e9e4a5))
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
5
28
|
# [8.2.0](https://github.com/dereekb/dbx-components/compare/v8.1.2-dev...v8.2.0) (2022-06-20)
|
|
6
29
|
|
|
7
30
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dereekb/firebase",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.5.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.5.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.5.0",
|
|
31
31
|
"ms": "^3.0.0-canary.1",
|
|
32
|
-
"@dereekb/model": "8.
|
|
32
|
+
"@dereekb/model": "8.5.0",
|
|
33
33
|
"class-transformer": "^0.5.1",
|
|
34
34
|
"class-validator": "^0.13.2",
|
|
35
|
-
"@dereekb/date": "8.
|
|
35
|
+
"@dereekb/date": "8.5.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,EAAC;QACrB,KAAK,EAAE,IAAI,CAAC,KAAK;QACjB,IAAI,EAAE,CAAO,CAAS,EAAE,EAAE;YACxB,MAAM,QAAQ,GAAM,aAAa,CAAC,gBAAgB,CAAC,CAAC;YACpD,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC;YAE1C,IAAI,IAAI,IAAI,IAAI,EAAE;gBAChB,MAAM,QAAQ,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;aACnC;YAED,OAAO,QAAQ,CAAC;QAClB,CAAC,CAAA;KACF,CAAC,CAAC;AACL,CAAC;AAfD,sCAeC;AAED,SAAgB,oBAAoB,CAAoC,SAAc;IACpF,OAAO,qBAAc,CAAC,iBAAiB,CAAC,SAAS,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,GAAG,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AC;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"}
|
|
@@ -119,6 +119,18 @@ export interface FirestoreModelIdentityRef<I extends FirestoreModelIdentity> {
|
|
|
119
119
|
* 12345
|
|
120
120
|
*/
|
|
121
121
|
export declare type FirestoreModelId = string;
|
|
122
|
+
/**
|
|
123
|
+
* Firestore Model Id Regex
|
|
124
|
+
*
|
|
125
|
+
* https://stackoverflow.com/questions/52850099/what-is-the-reg-expression-for-firestore-constraints-on-document-ids
|
|
126
|
+
*/
|
|
127
|
+
export declare const FIRESTORE_MODEL_ID_REGEX: RegExp;
|
|
128
|
+
/**
|
|
129
|
+
* Returns true if the input string is a FirestoreModelId.
|
|
130
|
+
*
|
|
131
|
+
* @param input
|
|
132
|
+
*/
|
|
133
|
+
export declare function isFirestoreModelId(input: string | FirestoreModelId): input is FirestoreModelId;
|
|
122
134
|
/**
|
|
123
135
|
* Reference to a FirestoreModelId
|
|
124
136
|
*/
|
|
@@ -136,6 +148,20 @@ export interface FirestoreModelIdRef {
|
|
|
136
148
|
* collection/12345/subcollection/67890
|
|
137
149
|
*/
|
|
138
150
|
export declare type FirestoreModelKey = ModelKey;
|
|
151
|
+
/**
|
|
152
|
+
* Firestore Model Key Regex that checks for pairs.
|
|
153
|
+
*/
|
|
154
|
+
export declare const FIRESTORE_MODEL_KEY_REGEX: RegExp;
|
|
155
|
+
/**
|
|
156
|
+
* Firestore Model Key Regex that is more strict
|
|
157
|
+
*/
|
|
158
|
+
export declare const FIRESTORE_MODEL_KEY_REGEX_STRICT: RegExp;
|
|
159
|
+
/**
|
|
160
|
+
* Returns true if the input string is a FirestoreModelKey.
|
|
161
|
+
*
|
|
162
|
+
* @param input
|
|
163
|
+
*/
|
|
164
|
+
export declare function isFirestoreModelKey(input: string | FirestoreModelKey): input is FirestoreModelKey;
|
|
139
165
|
/**
|
|
140
166
|
* A part of a FirestoreModelKey.
|
|
141
167
|
*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.makeFirestoreCollection = exports.childFirestoreModelKeyPath = exports.firestoreModelKeyPath = exports.firestoreModelKeys = exports.firestoreModelKey = exports.firestoreModelKeyPart = exports.firestoreModelType = exports.firestoreModelIdentity = void 0;
|
|
3
|
+
exports.makeFirestoreCollection = exports.childFirestoreModelKeyPath = exports.firestoreModelKeyPath = exports.firestoreModelKeys = exports.firestoreModelKey = exports.firestoreModelKeyPart = exports.isFirestoreModelKey = exports.FIRESTORE_MODEL_KEY_REGEX_STRICT = exports.FIRESTORE_MODEL_KEY_REGEX = exports.isFirestoreModelId = exports.FIRESTORE_MODEL_ID_REGEX = exports.firestoreModelType = exports.firestoreModelIdentity = void 0;
|
|
4
4
|
const document_1 = require("../accessor/document");
|
|
5
5
|
const iterator_1 = require("../query/iterator");
|
|
6
6
|
const query_1 = require("../query/query");
|
|
@@ -44,6 +44,38 @@ function firestoreModelType(modelTypeInput) {
|
|
|
44
44
|
return modelType;
|
|
45
45
|
}
|
|
46
46
|
exports.firestoreModelType = firestoreModelType;
|
|
47
|
+
/**
|
|
48
|
+
* Firestore Model Id Regex
|
|
49
|
+
*
|
|
50
|
+
* https://stackoverflow.com/questions/52850099/what-is-the-reg-expression-for-firestore-constraints-on-document-ids
|
|
51
|
+
*/
|
|
52
|
+
exports.FIRESTORE_MODEL_ID_REGEX = /^(?!\.\.?$)(?!.*__.*__)([^\s\/]{1,1500})$/;
|
|
53
|
+
/**
|
|
54
|
+
* Returns true if the input string is a FirestoreModelId.
|
|
55
|
+
*
|
|
56
|
+
* @param input
|
|
57
|
+
*/
|
|
58
|
+
function isFirestoreModelId(input) {
|
|
59
|
+
return exports.FIRESTORE_MODEL_ID_REGEX.test(input);
|
|
60
|
+
}
|
|
61
|
+
exports.isFirestoreModelId = isFirestoreModelId;
|
|
62
|
+
/**
|
|
63
|
+
* Firestore Model Key Regex that checks for pairs.
|
|
64
|
+
*/
|
|
65
|
+
exports.FIRESTORE_MODEL_KEY_REGEX = /^(?:([^\s\/]+)\/([^\s\/]+))(?:\/(?:([^\s\/]+))\/(?:([^\s\/]+)))*$/;
|
|
66
|
+
/**
|
|
67
|
+
* Firestore Model Key Regex that is more strict
|
|
68
|
+
*/
|
|
69
|
+
exports.FIRESTORE_MODEL_KEY_REGEX_STRICT = /^(?:(?:(?!\.\.?$)(?!.*__.*__)([^\s\/]+))\/(?:(?!\.\.?$)(?!.*__.*__)([^\s\/]+))\/?)(?:\/(?:(?!\.\.?$)(?!.*__.*__)([^\s\/]+))\/(?:(?!\.\.?$)(?!.*__.*__)([^\s\/]+)))*$/;
|
|
70
|
+
/**
|
|
71
|
+
* Returns true if the input string is a FirestoreModelKey.
|
|
72
|
+
*
|
|
73
|
+
* @param input
|
|
74
|
+
*/
|
|
75
|
+
function isFirestoreModelKey(input) {
|
|
76
|
+
return exports.FIRESTORE_MODEL_KEY_REGEX.test(input);
|
|
77
|
+
}
|
|
78
|
+
exports.isFirestoreModelKey = isFirestoreModelKey;
|
|
47
79
|
/**
|
|
48
80
|
* Creates a firestoreModelKeyPart
|
|
49
81
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"collection.js","sourceRoot":"","sources":["../../../../../../../../packages/firebase/src/lib/common/firestore/collection/collection.ts"],"names":[],"mappings":";;;AACA,mDAc8B;AAC9B,gDAA0L;AAC1L,0CAA8E;AAE9E,yDAAsG;AA0EtG,SAAgB,sBAAsB,CAA8I,iBAAwB,EAAE,yBAAiC,EAAE,mBAAuB;;IACtQ,IAAI,OAAO,iBAAiB,KAAK,QAAQ,EAAE;QACzC,MAAM,cAAc,GAAG,MAAC,mBAAyB,mCAAM,yBAA+B,CAAC,WAAW,EAAQ,CAAC;QAC3G,OAAO;YACL,IAAI,EAAE,QAAQ;YACd,MAAM,EAAE,iBAAsB;YAC9B,cAAc;YACd,UAAU,EAAE,cAAc;YAC1B,KAAK,EAAE,yBAA8B;YACrC,SAAS,EAAE,yBAA8B;SAC1C,CAAC;KACH;SAAM;QACL,MAAM,cAAc,GAAG,MAAC,yBAA+B,mCAAK,iBAAiB,CAAC,WAAW,EAAQ,CAAC;QAClG,OAAO;YACL,IAAI,EAAE,MAAM;YACZ,cAAc;YACd,UAAU,EAAE,cAAc;YAC1B,KAAK,EAAE,iBAAiB;YACxB,SAAS,EAAE,iBAAiB;SAC7B,CAAC;KACH;AACH,CAAC;AArBD,wDAqBC;AAYD;;;;;GAKG;AACH,SAAgB,kBAAkB,CAAC,cAA0D;IAC3F,MAAM,SAAS,GAAG,OAAO,cAAc,KAAK,QAAQ,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,cAAc,CAAC,SAAS,CAAC;IAEjG,IAAI,CAAC,SAAS,EAAE;QACd,MAAM,IAAI,KAAK,CAAC,wBAAwB,CAAC,CAAC;KAC3C;IAED,OAAO,SAAS,CAAC;AACnB,CAAC;AARD,gDAQC;
|
|
1
|
+
{"version":3,"file":"collection.js","sourceRoot":"","sources":["../../../../../../../../packages/firebase/src/lib/common/firestore/collection/collection.ts"],"names":[],"mappings":";;;AACA,mDAc8B;AAC9B,gDAA0L;AAC1L,0CAA8E;AAE9E,yDAAsG;AA0EtG,SAAgB,sBAAsB,CAA8I,iBAAwB,EAAE,yBAAiC,EAAE,mBAAuB;;IACtQ,IAAI,OAAO,iBAAiB,KAAK,QAAQ,EAAE;QACzC,MAAM,cAAc,GAAG,MAAC,mBAAyB,mCAAM,yBAA+B,CAAC,WAAW,EAAQ,CAAC;QAC3G,OAAO;YACL,IAAI,EAAE,QAAQ;YACd,MAAM,EAAE,iBAAsB;YAC9B,cAAc;YACd,UAAU,EAAE,cAAc;YA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AE,aAAa,EAAE,GAAG,IAAA,kDAA+B,EAAC,YAAY,EAAE,yBAAyB,CAAC,CAAC;IACnG,MAAM,EAAE,KAAK,EAAE,GAAG,YAAY,CAAC;IAE/B,qCACE,MAAM;QACN,UAAU,EACV,SAAS,EAAE,UAAU,EACrB,gBAAgB,IACb,yBAAyB,KAC5B,kBAAkB;QAClB,KAAK;QACL,aAAa,IACb;AACJ,CAAC;AAxBD,0DAwBC"}
|
|
@@ -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"}
|
|
@@ -3,4 +3,5 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
4
|
tslib_1.__exportStar(require("./model.loader"), exports);
|
|
5
5
|
tslib_1.__exportStar(require("./model.param"), exports);
|
|
6
|
+
tslib_1.__exportStar(require("./model.validator"), exports);
|
|
6
7
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../../packages/firebase/src/lib/common/model/model/index.ts"],"names":[],"mappings":";;;AAAA,yDAA+B;AAC/B,wDAA8B"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../../packages/firebase/src/lib/common/model/model/index.ts"],"names":[],"mappings":";;;AAAA,yDAA+B;AAC/B,wDAA8B;AAC9B,4DAAkC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ValidationOptions } from 'class-validator';
|
|
2
|
+
/**
|
|
3
|
+
* isFirestoreModelKey validator
|
|
4
|
+
*/
|
|
5
|
+
export declare function IsFirestoreModelKey(validationOptions?: ValidationOptions): (object: Object, propertyName: string) => void;
|
|
6
|
+
/**
|
|
7
|
+
* isFirestoreModelId validator
|
|
8
|
+
*/
|
|
9
|
+
export declare function IsFirestoreModelId(validationOptions?: ValidationOptions): (object: Object, propertyName: string) => void;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.IsFirestoreModelId = exports.IsFirestoreModelKey = void 0;
|
|
4
|
+
const class_validator_1 = require("class-validator");
|
|
5
|
+
const collection_1 = require("../../firestore/collection/collection");
|
|
6
|
+
/**
|
|
7
|
+
* isFirestoreModelKey validator
|
|
8
|
+
*/
|
|
9
|
+
function IsFirestoreModelKey(validationOptions) {
|
|
10
|
+
return function (object, propertyName) {
|
|
11
|
+
(0, class_validator_1.registerDecorator)({
|
|
12
|
+
name: 'isFirestoreModelKey',
|
|
13
|
+
target: object.constructor,
|
|
14
|
+
propertyName: propertyName,
|
|
15
|
+
options: validationOptions,
|
|
16
|
+
validator: {
|
|
17
|
+
validate: collection_1.isFirestoreModelKey,
|
|
18
|
+
defaultMessage(args) {
|
|
19
|
+
return `"${args.value}" is not a FirestoreModelKey.`;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
exports.IsFirestoreModelKey = IsFirestoreModelKey;
|
|
26
|
+
/**
|
|
27
|
+
* isFirestoreModelId validator
|
|
28
|
+
*/
|
|
29
|
+
function IsFirestoreModelId(validationOptions) {
|
|
30
|
+
return function (object, propertyName) {
|
|
31
|
+
(0, class_validator_1.registerDecorator)({
|
|
32
|
+
name: 'isFirestoreModelId',
|
|
33
|
+
target: object.constructor,
|
|
34
|
+
propertyName: propertyName,
|
|
35
|
+
options: validationOptions,
|
|
36
|
+
validator: {
|
|
37
|
+
validate: collection_1.isFirestoreModelId,
|
|
38
|
+
defaultMessage(args) {
|
|
39
|
+
return `"${args.value}" is not a FirestoreModelId.`;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
exports.IsFirestoreModelId = IsFirestoreModelId;
|
|
46
|
+
//# sourceMappingURL=model.validator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"model.validator.js","sourceRoot":"","sources":["../../../../../../../../packages/firebase/src/lib/common/model/model/model.validator.ts"],"names":[],"mappings":";;;AAAA,qDAA+I;AAC/I,sEAAgG;AAEhG;;GAEG;AACH,SAAgB,mBAAmB,CAAC,iBAAqC;IACvE,OAAO,UAAU,MAAc,EAAE,YAAoB;QACnD,IAAA,mCAAiB,EAAC;YAChB,IAAI,EAAE,qBAAqB;YAC3B,MAAM,EAAE,MAAM,CAAC,WAAW;YAC1B,YAAY,EAAE,YAAY;YAC1B,OAAO,EAAE,iBAAiB;YAC1B,SAAS,EAAE;gBACT,QAAQ,EAAE,gCAAmB;gBAC7B,cAAc,CAAC,IAAyB;oBACtC,OAAO,IAAI,IAAI,CAAC,KAAK,+BAA+B,CAAC;gBACvD,CAAC;aACF;SACF,CAAC,CAAC;IACL,CAAC,CAAC;AACJ,CAAC;AAfD,kDAeC;AAED;;GAEG;AACH,SAAgB,kBAAkB,CAAC,iBAAqC;IACtE,OAAO,UAAU,MAAc,EAAE,YAAoB;QACnD,IAAA,mCAAiB,EAAC;YAChB,IAAI,EAAE,oBAAoB;YAC1B,MAAM,EAAE,MAAM,CAAC,WAAW;YAC1B,YAAY,EAAE,YAAY;YAC1B,OAAO,EAAE,iBAAiB;YAC1B,SAAS,EAAE;gBACT,QAAQ,EAAE,+BAAkB;gBAC5B,cAAc,CAAC,IAAyB;oBACtC,OAAO,IAAI,IAAI,CAAC,KAAK,8BAA8B,CAAC;gBACtD,CAAC;aACF;SACF,CAAC,CAAC;IACL,CAAC,CAAC;AACJ,CAAC;AAfD,gDAeC"}
|
package/test/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,18 @@
|
|
|
2
2
|
|
|
3
3
|
This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
|
|
4
4
|
|
|
5
|
+
# [8.5.0](https://github.com/dereekb/dbx-components/compare/v8.4.0-dev...v8.5.0) (2022-06-22)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
# [8.4.0](https://github.com/dereekb/dbx-components/compare/v8.3.0-dev...v8.4.0) (2022-06-21)
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
# [8.3.0](https://github.com/dereekb/dbx-components/compare/v8.2.0-dev...v8.3.0) (2022-06-20)
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
5
17
|
# [8.2.0](https://github.com/dereekb/dbx-components/compare/v8.1.2-dev...v8.2.0) (2022-06-20)
|
|
6
18
|
|
|
7
19
|
|
package/test/package.json
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dereekb/firebase/test",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.5.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.5.0",
|
|
9
|
+
"@dereekb/util": "8.5.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.5.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.5.0",
|
|
18
18
|
"ms": "^3.0.0-canary.1",
|
|
19
|
-
"@dereekb/model": "8.
|
|
19
|
+
"@dereekb/model": "8.5.0",
|
|
20
20
|
"class-transformer": "^0.5.1",
|
|
21
21
|
"class-validator": "^0.13.2",
|
|
22
|
-
"@dereekb/date": "8.
|
|
22
|
+
"@dereekb/date": "8.5.0",
|
|
23
23
|
"date-fns": "^2.28.0",
|
|
24
24
|
"date-fns-tz": "^1.3.0",
|
|
25
25
|
"rrule": "2.7.0",
|