@dereekb/firebase 8.7.5 → 8.8.1
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 +18 -0
- package/package.json +5 -5
- package/src/lib/common/firestore/collection/collection.d.ts +3 -1
- package/src/lib/common/firestore/collection/collection.js +4 -1
- package/src/lib/common/firestore/collection/collection.js.map +1 -1
- package/src/lib/common/firestore/snapshot/index.d.ts +1 -0
- package/src/lib/common/firestore/snapshot/index.js +1 -0
- package/src/lib/common/firestore/snapshot/index.js.map +1 -1
- package/src/lib/common/firestore/snapshot/snapshot.d.ts +1 -64
- package/src/lib/common/firestore/snapshot/snapshot.field.d.ts +43 -2
- package/src/lib/common/firestore/snapshot/snapshot.field.js +45 -4
- package/src/lib/common/firestore/snapshot/snapshot.field.js.map +1 -1
- package/src/lib/common/firestore/snapshot/snapshot.js +7 -10
- package/src/lib/common/firestore/snapshot/snapshot.js.map +1 -1
- package/src/lib/common/firestore/snapshot/snapshot.type.d.ts +61 -0
- package/src/lib/common/firestore/snapshot/snapshot.type.js +8 -0
- package/src/lib/common/firestore/snapshot/snapshot.type.js.map +1 -0
- package/src/lib/common/model/model.service.d.ts +2 -2
- package/src/lib/common/model/model.service.js +3 -1
- package/src/lib/common/model/model.service.js.map +1 -1
- package/test/CHANGELOG.md +12 -0
- package/test/package.json +7 -7
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,24 @@
|
|
|
2
2
|
|
|
3
3
|
This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
|
|
4
4
|
|
|
5
|
+
## [8.8.1](https://github.com/dereekb/dbx-components/compare/v8.8.0-dev...v8.8.1) (2022-06-29)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
# [8.8.0](https://github.com/dereekb/dbx-components/compare/v8.7.6-dev...v8.8.0) (2022-06-29)
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
### Features
|
|
13
|
+
|
|
14
|
+
* added FirestoreObjectArray ([e1050eb](https://github.com/dereekb/dbx-components/commit/e1050eb53c816025e016a07e2d7e41ee8c24362a))
|
|
15
|
+
* added firestoreSubObjectField() ([3d6fbe1](https://github.com/dereekb/dbx-components/commit/3d6fbe17a10dfddf3e9bc1cecd522ed61efd6c49))
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
## [8.7.6](https://github.com/dereekb/dbx-components/compare/v8.7.5-dev...v8.7.6) (2022-06-29)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
5
23
|
## [8.7.5](https://github.com/dereekb/dbx-components/compare/v8.7.4-dev...v8.7.5) (2022-06-28)
|
|
6
24
|
|
|
7
25
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dereekb/firebase",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.8.1",
|
|
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.8.1",
|
|
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.8.1",
|
|
31
31
|
"ms": "^3.0.0-canary.1",
|
|
32
|
-
"@dereekb/model": "8.
|
|
32
|
+
"@dereekb/model": "8.8.1",
|
|
33
33
|
"class-transformer": "^0.5.1",
|
|
34
34
|
"class-validator": "^0.13.2",
|
|
35
|
-
"@dereekb/date": "8.
|
|
35
|
+
"@dereekb/date": "8.8.1",
|
|
36
36
|
"date-fns": "^2.28.0",
|
|
37
37
|
"date-fns-tz": "^1.3.0",
|
|
38
38
|
"rrule": "2.7.0",
|
|
@@ -230,7 +230,9 @@ export interface FirestoreModelCollectionAndIdPair extends FirestoreModelIdRef,
|
|
|
230
230
|
}
|
|
231
231
|
export declare function firestoreModelKeyPartPairs<T = unknown>(input: ReadFirestoreModelKeyInput<T>): Maybe<FirestoreModelCollectionAndIdPair[]>;
|
|
232
232
|
export declare type ReadFirestoreModelKeyInput<T = unknown> = FirestoreModelKey | FirestoreModelKeyRef | DocumentReferenceRef<T>;
|
|
233
|
-
export declare function readFirestoreModelKey<T = unknown>(input: ReadFirestoreModelKeyInput<T
|
|
233
|
+
export declare function readFirestoreModelKey<T = unknown>(input: ReadFirestoreModelKeyInput<T>, required: true): FirestoreModelKey;
|
|
234
|
+
export declare function readFirestoreModelKey<T = unknown>(input: ReadFirestoreModelKeyInput<T>, required: false): Maybe<FirestoreModelKey>;
|
|
235
|
+
export declare function readFirestoreModelKey<T = unknown>(input: ReadFirestoreModelKeyInput<T>, required?: boolean): Maybe<FirestoreModelKey>;
|
|
234
236
|
/**
|
|
235
237
|
* Reference to a FirestoreModelKey
|
|
236
238
|
*/
|
|
@@ -203,7 +203,7 @@ function firestoreModelKeyPartPairs(input) {
|
|
|
203
203
|
return pairs;
|
|
204
204
|
}
|
|
205
205
|
exports.firestoreModelKeyPartPairs = firestoreModelKeyPartPairs;
|
|
206
|
-
function readFirestoreModelKey(input) {
|
|
206
|
+
function readFirestoreModelKey(input, required = false) {
|
|
207
207
|
let key;
|
|
208
208
|
if (typeof input === 'object') {
|
|
209
209
|
if (input.key) {
|
|
@@ -216,6 +216,9 @@ function readFirestoreModelKey(input) {
|
|
|
216
216
|
else {
|
|
217
217
|
key = input;
|
|
218
218
|
}
|
|
219
|
+
if (!key && required) {
|
|
220
|
+
throw new Error('Key is required.');
|
|
221
|
+
}
|
|
219
222
|
return key;
|
|
220
223
|
}
|
|
221
224
|
exports.readFirestoreModelKey = readFirestoreModelKey;
|
|
@@ -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;AACtG,wCAAmH;AAyEnH,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;AA4CD;;;;;GAKG;AACH,SAAgB,gBAAgB,CAAC,KAAwH;IACvJ,IAAI,GAAG,GAAG,EAAE,CAAC;IACb,IAAI,EAAE,CAAC;IAEP,IA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,CAAC;AAbD,kEAaC;AAID,SAAgB,0BAA0B,CAAc,KAAoC;IAC1F,MAAM,GAAG,GAAG,qBAAqB,CAAI,KAAK,CAAC,CAAC;IAC5C,IAAI,KAAiD,CAAC;IAEtD,IAAI,GAAG,EAAE;QACP,MAAM,MAAM,GAAG,GAAG,aAAH,GAAG,uBAAH,GAAG,CAAE,KAAK,CAAC,GAAG,CAAC,CAAC;QAC/B,KAAK,GAAG,EAAE,CAAC;QAEX,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,KAAK,CAAC,EAAE;YAC3B,MAAM,IAAI,KAAK,CAAC,uDAAuD,CAAC,CAAC;SAC1E;QAED,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,EAAE;YACzC,MAAM,cAAc,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;YACjC,MAAM,EAAE,GAAG,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;YACzB,KAAK,CAAC,IAAI,CAAC,EAAE,EAAE,EAAE,cAAc,EAAE,CAAC,CAAC;SACpC;KACF;IAED,OAAO,KAAK,CAAC;AACf,CAAC;AApBD,gEAoBC;
|
|
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;AACtG,wCAAmH;AAyEnH,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;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oDAAyC,EAAC,EAAE,gBAAgB,EAAE,uBAAuB,EAAE,CAAC,CAAC;IAC3H,MAAM,EAAE,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"}
|
|
@@ -3,4 +3,5 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
4
|
tslib_1.__exportStar(require("./snapshot"), exports);
|
|
5
5
|
tslib_1.__exportStar(require("./snapshot.field"), exports);
|
|
6
|
+
tslib_1.__exportStar(require("./snapshot.type"), exports);
|
|
6
7
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../../packages/firebase/src/lib/common/firestore/snapshot/index.ts"],"names":[],"mappings":";;;AAAA,qDAA2B;AAC3B,2DAAiC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../../packages/firebase/src/lib/common/firestore/snapshot/index.ts"],"names":[],"mappings":";;;AAAA,qDAA2B;AAC3B,2DAAiC;AACjC,0DAAgC"}
|
|
@@ -1,65 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { SnapshotOptions, SetOptions, DocumentSnapshot, FirestoreDataConverter } from '../types';
|
|
3
|
-
/**
|
|
4
|
-
* The default "empty" value in the Firestore.
|
|
5
|
-
*/
|
|
6
|
-
export declare const FIRESTORE_EMPTY_VALUE: null;
|
|
7
|
-
/**
|
|
8
|
-
* The expected firestore document data for a specific type.
|
|
9
|
-
*
|
|
10
|
-
* This declaration allows a second type to defined overrides for how the data is stored within Firestore. For example, since by default
|
|
11
|
-
* this library choses to store dates as an ISO8601String, you can strictly specify that, and gain the type checking benefits.
|
|
12
|
-
*/
|
|
13
|
-
export declare type ExpectedFirestoreModelData<T extends object, R extends object = object> = TypedMappedModelData<T, R>;
|
|
14
|
-
/**
|
|
15
|
-
* What is considered the typings for the true "stored" data.
|
|
16
|
-
*
|
|
17
|
-
* All items are marked as partial and Maybe. This is because by design the firestore has no schema and has no obligation to require fields.
|
|
18
|
-
* It is better to be cognizant of this fact in our typings, and let the Snapshot conversions handle this.
|
|
19
|
-
*
|
|
20
|
-
* Fields that existing on the database type can only replace typings on the specific type, and not declare new typings.
|
|
21
|
-
* This is to prevent accidents related to adding/removing fields but not adding the correct conversions.
|
|
22
|
-
*
|
|
23
|
-
* This declaration allows a second type to defined overrides for how the data is stored within Firestore. For example, since by default
|
|
24
|
-
* this library choses to store dates as an ISO8601String, you can strictly specify that, and gain the type checking benefits. For other data types
|
|
25
|
-
* that are the same in the datastore as they are here, they are considered "any".
|
|
26
|
-
*
|
|
27
|
-
* The reason for this is that FirestoreModelData types are typically never used directly, execept for our snapshotConverterFunctions(),
|
|
28
|
-
* and using the built-in snapshot firestore field converters. Unless we have specified a strict new type that we expect in the data,
|
|
29
|
-
* most of the time we are unconcerned with the final type of our ExpectedFirestoreModelData.
|
|
30
|
-
*
|
|
31
|
-
* This is a more lose type that takes the above into account. You will only see typing information for fields of R that override the converted type T.
|
|
32
|
-
* If you find yourself needing full typings, extend ExpectedFirestoreModelData instead.
|
|
33
|
-
*
|
|
34
|
-
* Example:
|
|
35
|
-
*
|
|
36
|
-
* export interface MockItem {
|
|
37
|
-
* string: string;
|
|
38
|
-
* date: Date;
|
|
39
|
-
* }
|
|
40
|
-
*
|
|
41
|
-
* export type MockItemData = ExpectedFirestoreModelData<MockItem, {
|
|
42
|
-
* // string field is not defined directly, will be treated as any.
|
|
43
|
-
* date: string; // we want typescript typing help for this in our converters.
|
|
44
|
-
* }>;
|
|
45
|
-
*
|
|
46
|
-
*/
|
|
47
|
-
export declare type FirestoreModelData<T extends object, R extends object = object> = Partial<ExpectedFirestoreModelData<T, MaybeMap<R>>>;
|
|
48
|
-
export declare type SnapshotConverterConfigWithFields<T extends object, O extends object = FirestoreModelData<T>> = {
|
|
49
|
-
readonly fields: ModelFieldConversionsConfig<T, O>;
|
|
50
|
-
};
|
|
51
|
-
export declare type SnapshotConverterConfigWithConversions<T extends object, O extends object = FirestoreModelData<T>> = {
|
|
52
|
-
readonly fieldConversions: ModelFieldConversions<T, O>;
|
|
53
|
-
};
|
|
54
|
-
export declare type SnapshotConverterModifier<T extends object, O extends object = FirestoreModelData<T>> = PartialModelModifier<T, O>;
|
|
55
|
-
export declare type SnapshotConverterConfig<T extends object, O extends object = FirestoreModelData<T>> = (SnapshotConverterConfigWithFields<T, O> | SnapshotConverterConfigWithConversions<T, O>) & {
|
|
56
|
-
readonly modifiers?: ArrayOrValue<SnapshotConverterModifier<T, O>>;
|
|
57
|
-
};
|
|
58
|
-
export interface SnapshotConverterFunctions<T extends object, O extends object = FirestoreModelData<T>> extends FirestoreDataConverter<T, O> {
|
|
59
|
-
from: SnapshotConverterFromFunction<T, O>;
|
|
60
|
-
to: SnapshotConverterToFunction<T, O>;
|
|
61
|
-
}
|
|
62
|
-
export declare type SnapshotConverterFromFirestoreFunction<T extends object, O extends object = FirestoreModelData<T>> = (snapshot: DocumentSnapshot<O>, options?: SnapshotOptions) => T;
|
|
63
|
-
export declare type SnapshotConverterFromFunction<T extends object, O extends object = FirestoreModelData<T>> = ApplyMapFunctionWithOptions<DocumentSnapshot<O>, T, SnapshotOptions>;
|
|
64
|
-
export declare type SnapshotConverterToFunction<T extends object, O extends object = FirestoreModelData<T>> = ApplyMapFunctionWithOptions<T, O, SetOptions>;
|
|
1
|
+
import { FirestoreModelData, SnapshotConverterConfig, SnapshotConverterFunctions } from './snapshot.type';
|
|
65
2
|
export declare function snapshotConverterFunctions<T extends object, O extends object = FirestoreModelData<T>>(config: SnapshotConverterConfig<T, O>): SnapshotConverterFunctions<T, O>;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { GrantedRole } from '@dereekb/model';
|
|
2
|
-
import { ModelFieldMapFunctionsConfig, GetterOrValue, Maybe, ModelFieldMapConvertFunction, PrimativeKey, ReadKeyFunction, ModelFieldMapFunctionsWithDefaultsConfig, FindUniqueFunction, FindUniqueStringsTransformConfig, MapFunction, FilterKeyValueTuplesInput, ModelKey } from '@dereekb/util';
|
|
2
|
+
import { ModelFieldMapFunctionsConfig, GetterOrValue, Maybe, ModelFieldMapConvertFunction, PrimativeKey, ReadKeyFunction, ModelFieldMapFunctionsWithDefaultsConfig, FindUniqueFunction, FindUniqueStringsTransformConfig, MapFunction, FilterKeyValueTuplesInput, ModelKey, ToModelMapFunctionsInput, ModelMapFunctinosRef } from '@dereekb/util';
|
|
3
|
+
import { FirestoreModelData } from './snapshot.type';
|
|
3
4
|
export interface BaseFirestoreFieldConfig<V, D = unknown> {
|
|
4
5
|
fromData: ModelFieldMapConvertFunction<D, V>;
|
|
5
6
|
toData: ModelFieldMapConvertFunction<V, D>;
|
|
@@ -29,7 +30,11 @@ export declare type MapConfiguredFirestoreFieldConfigWithDefaultData<V, D = unkn
|
|
|
29
30
|
export declare type MapConfiguredFirestoreFieldConfig<V, D = unknown> = MapConfiguredFirestoreFieldConfigWithDefault<V, D> | MapConfiguredFirestoreFieldConfigWithDefaultData<V, D>;
|
|
30
31
|
export declare type DefaultMapConfiguredFirestoreFieldConfig<V, D = unknown> = Omit<FirestoreFieldConfigWithDefault<V, D>, 'fromData' | 'toData' | 'default'> & Partial<Pick<FirestoreFieldConfigWithDefault<V, D>, 'default'>>;
|
|
31
32
|
export declare type OptionalMapConfiguredFirestoreFieldConfig<V, D = unknown> = Omit<BaseFirestoreFieldConfig<V, D>, 'fromData' | 'toData' | 'defaultBeforeSave'>;
|
|
32
|
-
export
|
|
33
|
+
export interface FirestoreStringTransformOptions {
|
|
34
|
+
trim?: boolean;
|
|
35
|
+
}
|
|
36
|
+
export interface FirestoreStringConfig<S extends string = string> extends DefaultMapConfiguredFirestoreFieldConfig<S, S>, FirestoreStringTransformOptions {
|
|
37
|
+
}
|
|
33
38
|
export declare function firestoreString<S extends string = string>(config?: FirestoreStringConfig<S>): FirestoreModelFieldMapFunctionsConfig<S, S>;
|
|
34
39
|
export declare function optionalFirestoreString(): ModelFieldMapFunctionsConfig<Maybe<string>, Maybe<string>>;
|
|
35
40
|
export declare type FirestoreEnumConfig<S extends string | number> = MapConfiguredFirestoreFieldConfigWithDefault<S, S>;
|
|
@@ -146,6 +151,42 @@ export declare function firestoreModelKeyGrantedRoleArrayMap<R extends GrantedRo
|
|
|
146
151
|
* Filters empty roles/arrays by default.
|
|
147
152
|
*/
|
|
148
153
|
export declare const firestoreModelIdGrantedRoleArrayMap: () => FirestoreModelFieldMapFunctionsConfig<FirestoreMapFieldType<ModelKey[], string>, FirestoreMapFieldType<ModelKey[], string>>;
|
|
154
|
+
/**
|
|
155
|
+
* firestoreObjectArray configuration
|
|
156
|
+
*/
|
|
157
|
+
export declare type FirestoreObjectArrayFieldConfig<T extends object, O extends object = FirestoreModelData<T>> = DefaultMapConfiguredFirestoreFieldConfig<T[], O[]> & {
|
|
158
|
+
/**
|
|
159
|
+
* The field to use for conversion.
|
|
160
|
+
*/
|
|
161
|
+
readonly objectField: ToModelMapFunctionsInput<T, O>;
|
|
162
|
+
};
|
|
163
|
+
/**
|
|
164
|
+
* A Firestore array that maps each array value using another FirestoreFieldConfig config.
|
|
165
|
+
*
|
|
166
|
+
* @param config
|
|
167
|
+
* @returns
|
|
168
|
+
*/
|
|
169
|
+
export declare function firestoreObjectArray<T extends object, O extends object = FirestoreModelData<T>>(config: FirestoreObjectArrayFieldConfig<T, O>): FirestoreModelFieldMapFunctionsConfig<T[], O[]>;
|
|
170
|
+
/**
|
|
171
|
+
* firestoreSubObjectField configuration
|
|
172
|
+
*/
|
|
173
|
+
export declare type FirestoreSubObjectFieldConfig<T extends object, O extends object = FirestoreModelData<T>> = DefaultMapConfiguredFirestoreFieldConfig<T, O> & {
|
|
174
|
+
/**
|
|
175
|
+
* Whether or not to save the default object. Is ignored if defaultBeforeSave is set.
|
|
176
|
+
*
|
|
177
|
+
* Is false by default.
|
|
178
|
+
*/
|
|
179
|
+
saveDefaultObject?: boolean;
|
|
180
|
+
/**
|
|
181
|
+
* The fields to use for conversion.
|
|
182
|
+
*/
|
|
183
|
+
objectField: ToModelMapFunctionsInput<T, O>;
|
|
184
|
+
};
|
|
185
|
+
export declare type FirestoreSubObjectFieldMapFunctionsConfig<T extends object, O extends object = FirestoreModelData<T>> = FirestoreModelFieldMapFunctionsConfig<T, O> & ModelMapFunctinosRef<T, O>;
|
|
186
|
+
/**
|
|
187
|
+
* A nested object field that uses other FirestoreFieldConfig configurations to map a field.
|
|
188
|
+
*/
|
|
189
|
+
export declare function firestoreSubObject<T extends object, O extends object = FirestoreModelData<T>>(config: FirestoreSubObjectFieldConfig<T, O>): FirestoreSubObjectFieldMapFunctionsConfig<T, O>;
|
|
149
190
|
export declare type FirestoreSetFieldConfig<T extends string | number> = DefaultMapConfiguredFirestoreFieldConfig<Set<T>, T[]>;
|
|
150
191
|
/**
|
|
151
192
|
* Do not use.
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.firestoreSet = exports.firestoreModelIdGrantedRoleArrayMap = exports.firestoreModelKeyGrantedRoleArrayMap = exports.firestoreArrayMap = exports.firestoreModelIdGrantedRoleMap = exports.firestoreModelKeyGrantedRoleMap = exports.firestoreMap = exports.firestoreEncodedArray = exports.firestoreModelIdArrayField = exports.firestoreModelKeyArrayField = exports.firestoreUniqueStringArray = exports.firestoreEnumArray = exports.firestoreUniqueKeyedArray = exports.firestoreUniqueArray = exports.optionalFirestoreArray = exports.firestoreArray = exports.optionalFirestoreNumber = exports.firestoreNumber = exports.optionalFirestoreBoolean = exports.firestoreBoolean = exports.optionalFirestoreDate = exports.firestoreDate = exports.firestoreModelIdString = exports.firestoreModelKeyString = exports.optionalFirestoreUID = exports.firestoreUID = exports.optionalFirestoreEnum = exports.firestoreEnum = exports.optionalFirestoreString = exports.firestoreString = exports.firestorePassThroughField = exports.FIRESTORE_PASSTHROUGH_FIELD = exports.firestoreField = void 0;
|
|
3
|
+
exports.firestoreSet = exports.firestoreSubObject = exports.firestoreObjectArray = exports.firestoreModelIdGrantedRoleArrayMap = exports.firestoreModelKeyGrantedRoleArrayMap = exports.firestoreArrayMap = exports.firestoreModelIdGrantedRoleMap = exports.firestoreModelKeyGrantedRoleMap = exports.firestoreMap = exports.firestoreEncodedArray = exports.firestoreModelIdArrayField = exports.firestoreModelKeyArrayField = exports.firestoreUniqueStringArray = exports.firestoreEnumArray = exports.firestoreUniqueKeyedArray = exports.firestoreUniqueArray = exports.optionalFirestoreArray = exports.firestoreArray = exports.optionalFirestoreNumber = exports.firestoreNumber = exports.optionalFirestoreBoolean = exports.firestoreBoolean = exports.optionalFirestoreDate = exports.firestoreDate = exports.firestoreModelIdString = exports.firestoreModelKeyString = exports.optionalFirestoreUID = exports.firestoreUID = exports.optionalFirestoreEnum = exports.firestoreEnum = exports.optionalFirestoreString = exports.firestoreString = exports.firestorePassThroughField = exports.FIRESTORE_PASSTHROUGH_FIELD = exports.firestoreField = void 0;
|
|
4
4
|
const date_1 = require("@dereekb/date");
|
|
5
5
|
const util_1 = require("@dereekb/util");
|
|
6
|
-
const
|
|
6
|
+
const snapshot_type_1 = require("./snapshot.type");
|
|
7
7
|
function firestoreField(config) {
|
|
8
8
|
var _a;
|
|
9
9
|
return {
|
|
@@ -17,7 +17,7 @@ function firestoreField(config) {
|
|
|
17
17
|
convert: config.fromData
|
|
18
18
|
},
|
|
19
19
|
to: {
|
|
20
|
-
default: ((_a = config.defaultBeforeSave) !== null && _a !== void 0 ? _a :
|
|
20
|
+
default: ((_a = config.defaultBeforeSave) !== null && _a !== void 0 ? _a : snapshot_type_1.FIRESTORE_EMPTY_VALUE),
|
|
21
21
|
convert: config.toData
|
|
22
22
|
}
|
|
23
23
|
};
|
|
@@ -33,7 +33,8 @@ function firestorePassThroughField() {
|
|
|
33
33
|
}
|
|
34
34
|
exports.firestorePassThroughField = firestorePassThroughField;
|
|
35
35
|
function firestoreString(config) {
|
|
36
|
-
|
|
36
|
+
const transformData = (config === null || config === void 0 ? void 0 : config.trim) ? (x) => x.trim() : util_1.passThrough;
|
|
37
|
+
return firestoreField(Object.assign(Object.assign({ default: '' }, config), { fromData: transformData, toData: transformData }));
|
|
37
38
|
}
|
|
38
39
|
exports.firestoreString = firestoreString;
|
|
39
40
|
function optionalFirestoreString() {
|
|
@@ -231,6 +232,46 @@ exports.firestoreModelKeyGrantedRoleArrayMap = firestoreModelKeyGrantedRoleArray
|
|
|
231
232
|
* Filters empty roles/arrays by default.
|
|
232
233
|
*/
|
|
233
234
|
exports.firestoreModelIdGrantedRoleArrayMap = firestoreModelKeyGrantedRoleArrayMap;
|
|
235
|
+
/**
|
|
236
|
+
* A Firestore array that maps each array value using another FirestoreFieldConfig config.
|
|
237
|
+
*
|
|
238
|
+
* @param config
|
|
239
|
+
* @returns
|
|
240
|
+
*/
|
|
241
|
+
function firestoreObjectArray(config) {
|
|
242
|
+
var _a;
|
|
243
|
+
const { from, to } = (0, util_1.toModelMapFunctions)(config.objectField);
|
|
244
|
+
return firestoreField({
|
|
245
|
+
default: (_a = config.default) !== null && _a !== void 0 ? _a : (() => []),
|
|
246
|
+
defaultBeforeSave: config.defaultBeforeSave,
|
|
247
|
+
fromData: (input) => input.map((x) => from(x)),
|
|
248
|
+
toData: (input) => (0, util_1.filterMaybeValues)(input).map((x) => to(x))
|
|
249
|
+
});
|
|
250
|
+
}
|
|
251
|
+
exports.firestoreObjectArray = firestoreObjectArray;
|
|
252
|
+
/**
|
|
253
|
+
* A nested object field that uses other FirestoreFieldConfig configurations to map a field.
|
|
254
|
+
*/
|
|
255
|
+
function firestoreSubObject(config) {
|
|
256
|
+
var _a, _b;
|
|
257
|
+
const mapFunctions = (0, util_1.toModelMapFunctions)(config.objectField);
|
|
258
|
+
const { from: fromData, to: toData } = mapFunctions;
|
|
259
|
+
const defaultWithFields = () => fromData({});
|
|
260
|
+
const defaultBeforeSave = (_a = config.defaultBeforeSave) !== null && _a !== void 0 ? _a : (config.saveDefaultObject ? () => toData({}) : null);
|
|
261
|
+
const mapFunctionsConfig = (0, util_1.build)({
|
|
262
|
+
base: firestoreField({
|
|
263
|
+
default: (_b = config.default) !== null && _b !== void 0 ? _b : defaultWithFields,
|
|
264
|
+
defaultBeforeSave,
|
|
265
|
+
fromData,
|
|
266
|
+
toData
|
|
267
|
+
}),
|
|
268
|
+
build: (x) => {
|
|
269
|
+
x.mapFunctions = mapFunctions;
|
|
270
|
+
}
|
|
271
|
+
});
|
|
272
|
+
return mapFunctionsConfig;
|
|
273
|
+
}
|
|
274
|
+
exports.firestoreSubObject = firestoreSubObject;
|
|
234
275
|
/**
|
|
235
276
|
* Do not use.
|
|
236
277
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"snapshot.field.js","sourceRoot":"","sources":["../../../../../../../../packages/firebase/src/lib/common/firestore/snapshot/snapshot.field.ts"],"names":[],"mappings":";;;AAEA,wCAA4E;AAC5E,
|
|
1
|
+
{"version":3,"file":"snapshot.field.js","sourceRoot":"","sources":["../../../../../../../../packages/firebase/src/lib/common/firestore/snapshot/snapshot.field.ts"],"names":[],"mappings":";;;AAEA,wCAA4E;AAC5E,wCA8BuB;AACvB,mDAA4E;AA6B5E,SAAgB,cAAc,CAAiB,MAAkC;;IAC/E,OAAO;QACL,IAAI,EACD,MAAgD,CAAC,OAAO,IAAI,IAAI;YAC/D,CAAC,CAAC;gBACE,OAAO,EAAG,MAAgD,CAAC,OAAO;gBAClE,OAAO,EAAE,MAAM,CAAC,QAAQ;aACzB;YACH,CAAC,CAAC;gBACE,YAAY,EAAG,MAAoD,CAAC,WAAW;gBAC/E,OA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AO,kBAAkB,CAAC;AAC5B,CAAC;AApBD,gDAoBC;AAKD;;;;;;;GAOG;AACH,SAAgB,YAAY,CAA4B,MAAkC;;IACxF,OAAO,cAAc,CAAc;QACjC,OAAO,EAAE,MAAA,MAAM,CAAC,OAAO,mCAAI,CAAC,GAAG,EAAE,CAAC,IAAI,GAAG,EAAE,CAAC;QAC5C,QAAQ,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,GAAG,CAAC,IAAI,CAAC;QACjC,MAAM,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC;KACjC,CAAC,CAAC;AACL,CAAC;AAND,oCAMC"}
|
|
@@ -1,18 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.snapshotConverterFunctions =
|
|
3
|
+
exports.snapshotConverterFunctions = void 0;
|
|
4
4
|
const util_1 = require("@dereekb/util");
|
|
5
5
|
const types_1 = require("../types");
|
|
6
|
-
// MARK:
|
|
7
|
-
/**
|
|
8
|
-
* The default "empty" value in the Firestore.
|
|
9
|
-
*/
|
|
10
|
-
exports.FIRESTORE_EMPTY_VALUE = null;
|
|
6
|
+
// MARK: Snapshots
|
|
11
7
|
function snapshotConverterFunctions(config) {
|
|
12
|
-
|
|
13
|
-
const
|
|
14
|
-
const mapFunctions = (0, util_1.
|
|
15
|
-
const { from: fromData, to: toData } =
|
|
8
|
+
const conversions = (0, util_1.toModelFieldConversions)(config);
|
|
9
|
+
const baseMapFunctions = (0, util_1.makeModelMapFunctions)(conversions);
|
|
10
|
+
const mapFunctions = config.modifiers ? (0, util_1.modifyModelMapFunctions)({ mapFunctions: baseMapFunctions, modifiers: config.modifiers }) : baseMapFunctions;
|
|
11
|
+
const { from: fromData, to: toData } = mapFunctions;
|
|
16
12
|
const from = (input, target) => {
|
|
17
13
|
const data = input.data();
|
|
18
14
|
return fromData(data, target);
|
|
@@ -35,6 +31,7 @@ function snapshotConverterFunctions(config) {
|
|
|
35
31
|
return {
|
|
36
32
|
from,
|
|
37
33
|
to,
|
|
34
|
+
mapFunctions,
|
|
38
35
|
fromFirestore: (snapshot, options) => from(snapshot, undefined, options),
|
|
39
36
|
toFirestore: (modelObject, options) => to(modelObject, undefined, options)
|
|
40
37
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"snapshot.js","sourceRoot":"","sources":["../../../../../../../../packages/firebase/src/lib/common/firestore/snapshot/snapshot.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"snapshot.js","sourceRoot":"","sources":["../../../../../../../../packages/firebase/src/lib/common/firestore/snapshot/snapshot.ts"],"names":[],"mappings":";;;AAAA,wCAA8J;AAC9J,oCAA8K;AAG9K,kBAAkB;AAClB,SAAgB,0BAA0B,CAA6D,MAAqC;IAC1I,MAAM,WAAW,GAAgC,IAAA,8BAAuB,EAAO,MAAM,CAAC,CAAC;IACvF,MAAM,gBAAgB,GAAG,IAAA,4BAAqB,EAAO,WAAW,CAAC,CAAC;IAClE,MAAM,YAAY,GAAG,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,IAAA,8BAAuB,EAAC,EAAE,YAAY,EAAE,gBAAgB,EAAE,SAAS,EAAE,MAAM,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,CAAC,gBAAgB,CAAC;IACpJ,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,GAAG,YAAY,CAAC;IAEpD,MAAM,IAAI,GAAwC,CAAC,KAAuB,EAAE,MAA0B,EAAE,EAAE;QACxG,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC;QAC1B,OAAO,QAAQ,CAAC,IAAS,EAAE,MAAM,CAAC,CAAC;IACrC,CAAC,CAAC;IAEF,MAAM,EAAE,GAAsC,CAAC,KAAQ,EAAE,MAA0B,EAAE,OAA2B,EAAE,EAAE;QAClH,IAAI,SAA2C,CAAC;QAEhD,IAAI,OAAO,EAAE;YACX,MAAM,WAAW,GAAI,OAAiC,CAAC,WAAW,CAAC;YAEnE,IAAK,OAA2B,CAAC,KAAK,EAAE;gBACtC,SAAS,GAAG;oBACV,WAAW,EAAE,IAAI;iBAClB,CAAC;aACH;YAED,IAAI,WAAW,EAAE;gBACf,SAAS,mCACJ,SAAS,KACZ,MAAM,EAAE,IAAA,4BAAoB,EAAC,WAAW,CAAgB,GACzD,CAAC;aACH;SACF;QAED,OAAO,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,SAAS,CAAC,CAAC;IAC1C,CAAC,CAAC;IAEF,OAAO;QACL,IAAI;QACJ,EAAE;QACF,YAAY;QACZ,aAAa,EAAE,CAAC,QAA6B,EAAE,OAAyB,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,EAAE,SAAS,EAAE,OAAO,CAAC;QAC/G,WAAW,EAAE,CAAC,WAAyD,EAAE,OAAoB,EAAE,EAAE,CAAC,EAAE,CAAC,WAAgB,EAAE,SAAS,EAAE,OAAO,CAAC;KAC3I,CAAC;AACJ,CAAC;AAzCD,gEAyCC"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { ApplyMapFunctionWithOptions, ArrayOrValue, MaybeMap, ModelFieldConversionsConfigRef, ModelFieldConversionsRef, ModelMapFunctions, PartialModelModifier, TypedMappedModelData } from '@dereekb/util';
|
|
2
|
+
import { FirestoreDataConverter, DocumentSnapshot, SetOptions, SnapshotOptions } from '../types';
|
|
3
|
+
/**
|
|
4
|
+
* The default "empty" value in the Firestore.
|
|
5
|
+
*/
|
|
6
|
+
export declare const FIRESTORE_EMPTY_VALUE: null;
|
|
7
|
+
/**
|
|
8
|
+
* The expected firestore document data for a specific type.
|
|
9
|
+
*
|
|
10
|
+
* This declaration allows a second type to defined overrides for how the data is stored within Firestore. For example, since by default
|
|
11
|
+
* this library choses to store dates as an ISO8601String, you can strictly specify that, and gain the type checking benefits.
|
|
12
|
+
*/
|
|
13
|
+
export declare type ExpectedFirestoreModelData<T extends object, R extends object = object> = TypedMappedModelData<T, R>;
|
|
14
|
+
/**
|
|
15
|
+
* What is considered the typings for the true "stored" data.
|
|
16
|
+
*
|
|
17
|
+
* All items are marked as partial and Maybe. This is because by design the firestore has no schema and has no obligation to require fields.
|
|
18
|
+
* It is better to be cognizant of this fact in our typings, and let the Snapshot conversions handle this.
|
|
19
|
+
*
|
|
20
|
+
* Fields that existing on the database type can only replace typings on the specific type, and not declare new typings.
|
|
21
|
+
* This is to prevent accidents related to adding/removing fields but not adding the correct conversions.
|
|
22
|
+
*
|
|
23
|
+
* This declaration allows a second type to defined overrides for how the data is stored within Firestore. For example, since by default
|
|
24
|
+
* this library choses to store dates as an ISO8601String, you can strictly specify that, and gain the type checking benefits. For other data types
|
|
25
|
+
* that are the same in the datastore as they are here, they are considered "any".
|
|
26
|
+
*
|
|
27
|
+
* The reason for this is that FirestoreModelData types are typically never used directly, execept for our snapshotConverterFunctions(),
|
|
28
|
+
* and using the built-in snapshot firestore field converters. Unless we have specified a strict new type that we expect in the data,
|
|
29
|
+
* most of the time we are unconcerned with the final type of our ExpectedFirestoreModelData.
|
|
30
|
+
*
|
|
31
|
+
* This is a more lose type that takes the above into account. You will only see typing information for fields of R that override the converted type T.
|
|
32
|
+
* If you find yourself needing full typings, extend ExpectedFirestoreModelData instead.
|
|
33
|
+
*
|
|
34
|
+
* Example:
|
|
35
|
+
*
|
|
36
|
+
* export interface MockItem {
|
|
37
|
+
* string: string;
|
|
38
|
+
* date: Date;
|
|
39
|
+
* }
|
|
40
|
+
*
|
|
41
|
+
* export type MockItemData = ExpectedFirestoreModelData<MockItem, {
|
|
42
|
+
* // string field is not defined directly, will be treated as any.
|
|
43
|
+
* date: string; // we want typescript typing help for this in our converters.
|
|
44
|
+
* }>;
|
|
45
|
+
*
|
|
46
|
+
*/
|
|
47
|
+
export declare type FirestoreModelData<T extends object, R extends object = object> = Partial<ExpectedFirestoreModelData<T, MaybeMap<R>>>;
|
|
48
|
+
export declare type SnapshotConverterConfigWithFields<T extends object, O extends object = FirestoreModelData<T>> = ModelFieldConversionsConfigRef<T, O>;
|
|
49
|
+
export declare type SnapshotConverterConfigWithConversions<T extends object, O extends object = FirestoreModelData<T>> = ModelFieldConversionsRef<T, O>;
|
|
50
|
+
export declare type SnapshotConverterModifier<T extends object, O extends object = FirestoreModelData<T>> = PartialModelModifier<T, O>;
|
|
51
|
+
export declare type SnapshotConverterConfig<T extends object, O extends object = FirestoreModelData<T>> = (SnapshotConverterConfigWithFields<T, O> | SnapshotConverterConfigWithConversions<T, O>) & {
|
|
52
|
+
readonly modifiers?: ArrayOrValue<SnapshotConverterModifier<T, O>>;
|
|
53
|
+
};
|
|
54
|
+
export interface SnapshotConverterFunctions<T extends object, O extends object = FirestoreModelData<T>> extends FirestoreDataConverter<T, O> {
|
|
55
|
+
readonly from: SnapshotConverterFromFunction<T, O>;
|
|
56
|
+
readonly to: SnapshotConverterToFunction<T, O>;
|
|
57
|
+
readonly mapFunctions: ModelMapFunctions<T, O>;
|
|
58
|
+
}
|
|
59
|
+
export declare type SnapshotConverterFromFirestoreFunction<T extends object, O extends object = FirestoreModelData<T>> = (snapshot: DocumentSnapshot<O>, options?: SnapshotOptions) => T;
|
|
60
|
+
export declare type SnapshotConverterFromFunction<T extends object, O extends object = FirestoreModelData<T>> = ApplyMapFunctionWithOptions<DocumentSnapshot<O>, T, SnapshotOptions>;
|
|
61
|
+
export declare type SnapshotConverterToFunction<T extends object, O extends object = FirestoreModelData<T>> = ApplyMapFunctionWithOptions<T, O, SetOptions>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"snapshot.type.js","sourceRoot":"","sources":["../../../../../../../../packages/firebase/src/lib/common/firestore/snapshot/snapshot.type.ts"],"names":[],"mappings":";;;AAGA;;GAEG;AACU,QAAA,qBAAqB,GAAG,IAAI,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { GrantedRole } from '@dereekb/model';
|
|
2
2
|
import { Getter, SetIncludesMode, ArrayOrValue, UseAsync, UsePromiseFunction } from '@dereekb/util';
|
|
3
3
|
import { FirestoreDocument } from '../firestore/accessor/document';
|
|
4
|
-
import { FirestoreModelIdentity, FirestoreModelKey, FirestoreModelTypes } from '../firestore/collection/collection';
|
|
4
|
+
import { FirestoreModelIdentity, FirestoreModelKey, FirestoreModelTypes, ReadFirestoreModelKeyInput } from '../firestore/collection/collection';
|
|
5
5
|
import { FirebaseModelCollectionLoader, FirebaseModelLoader, InContextFirebaseModelLoader } from './model/model.loader';
|
|
6
6
|
import { InContextFirebaseModelPermissionService, FirebasePermissionContext, FirebaseModelPermissionService, FirebasePermissionServiceInstanceDelegate, InModelContextFirebaseModelPermissionService, FirebasePermissionErrorContext } from './permission';
|
|
7
7
|
import { ContextGrantedModelRolesReader } from './permission/permission.service.role';
|
|
@@ -67,7 +67,7 @@ export declare type FirebaseModelsServiceSelectionResultRolesReader<Y extends Fi
|
|
|
67
67
|
export declare type FirebaseModelsServiceSelectionResultDocumentType<Y extends FirebaseModelsService<any, any>, T extends FirebaseModelsServiceTypes<Y>> = Y extends FirebaseModelsService<infer X, infer C> ? (T extends keyof X ? (X[T] extends FirebaseModelServiceGetter<C, infer T, infer D> ? D : never) : never) : never;
|
|
68
68
|
export declare type UseFirebaseModelsServiceSelection<Y extends FirebaseModelsService<any, any>, T extends FirebaseModelsServiceTypes<Y>> = Y extends FirebaseModelsService<infer X, infer C> ? X extends FirebaseModelsServiceFactory<C, FirestoreModelIdentity<T>> ? {
|
|
69
69
|
context: C;
|
|
70
|
-
key:
|
|
70
|
+
key: X[T] extends FirebaseModelServiceGetter<C, infer M> ? ReadFirestoreModelKeyInput<M> : ReadFirestoreModelKeyInput;
|
|
71
71
|
roles?: X[T] extends FirebaseModelServiceGetter<C, any, any, infer R> ? ArrayOrValue<R> : never;
|
|
72
72
|
rolesSetIncludes?: SetIncludesMode;
|
|
73
73
|
} : never : never;
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
5
|
exports.useFirebaseModelsService = exports.selectFromFirebaseModelsService = exports.inContextFirebaseModelsServiceFactory = exports.firebaseModelsService = exports.inContextFirebaseModelServiceFactory = exports.firebaseModelServiceFactory = exports.firebaseModelService = void 0;
|
|
6
6
|
const util_1 = require("@dereekb/util");
|
|
7
|
+
const collection_1 = require("../firestore/collection/collection");
|
|
7
8
|
const model_loader_1 = require("./model/model.loader");
|
|
8
9
|
const permission_1 = require("./permission");
|
|
9
10
|
const permission_service_role_1 = require("./permission/permission.service.role");
|
|
@@ -100,7 +101,8 @@ function inContextFirebaseModelsServiceFactory(service) {
|
|
|
100
101
|
}
|
|
101
102
|
exports.inContextFirebaseModelsServiceFactory = inContextFirebaseModelsServiceFactory;
|
|
102
103
|
function selectFromFirebaseModelsService(service, type, select) {
|
|
103
|
-
|
|
104
|
+
const key = (0, collection_1.readFirestoreModelKey)(select.key, true);
|
|
105
|
+
return service(type, select.context).forKey(key);
|
|
104
106
|
}
|
|
105
107
|
exports.selectFromFirebaseModelsService = selectFromFirebaseModelsService;
|
|
106
108
|
function useFirebaseModelsService(service, type, select) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model.service.js","sourceRoot":"","sources":["../../../../../../../packages/firebase/src/lib/common/model/model.service.ts"],"names":[],"mappings":";AAAA,uDAAuD;AACvD,oGAAoG;;;AAGpG,wCAAqI;
|
|
1
|
+
{"version":3,"file":"model.service.js","sourceRoot":"","sources":["../../../../../../../packages/firebase/src/lib/common/model/model.service.ts"],"names":[],"mappings":";AAAA,uDAAuD;AACvD,oGAAoG;;;AAGpG,wCAAqI;AAErI,mEAAuK;AACvK,uDAA6I;AAC7I,6CAA2R;AAC3R,kFAAsH;AAStH,SAAgB,oBAAoB,CAAuI,MAA8C;IACvN,MAAM,yBAAyB,GAAG,IAAA,YAAK,EAAwD;QAC7F,IAAI,EAAE,IAAA,kCAAmB,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CAAqF,OAAU,EAAE,IAAO,EAAE,MAA+C;IAC/L,MAAM,qBAAqB,GAAG,+BAA+B,CAAC,OAAO,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;IACrF,IAAI,MAAqD,CAAC;IAE1D,IAAI,MAAM,CAAC,KAAK,IAAI,MAAM,CAAC,KAAK,CAAC,MAAM,EAAE;QACvC,MAAM,GAAG,qBAAqB,CAAC,UAAU,CAAC,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,gBAAgB,CAAkD,CAAC;KACnI;SAAM;QACL,MAAM,GAAG,qBAAqB,CAAC,GAAoD,CAAC;KACrF;IAED,OAAO,MAAM,CAAC;AAChB,CAAC;AAXD,4DAWC"}
|
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.8.1](https://github.com/dereekb/dbx-components/compare/v8.8.0-dev...v8.8.1) (2022-06-29)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
# [8.8.0](https://github.com/dereekb/dbx-components/compare/v8.7.6-dev...v8.8.0) (2022-06-29)
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
## [8.7.6](https://github.com/dereekb/dbx-components/compare/v8.7.5-dev...v8.7.6) (2022-06-29)
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
5
17
|
## [8.7.5](https://github.com/dereekb/dbx-components/compare/v8.7.4-dev...v8.7.5) (2022-06-28)
|
|
6
18
|
|
|
7
19
|
|
package/test/package.json
CHANGED
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dereekb/firebase/test",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.8.1",
|
|
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/util/test": "8.
|
|
10
|
-
"@dereekb/util": "8.
|
|
9
|
+
"@dereekb/util/test": "8.8.1",
|
|
10
|
+
"@dereekb/util": "8.8.1",
|
|
11
11
|
"make-error": "^1.3.0",
|
|
12
12
|
"ts-essentials": "^9.1.2",
|
|
13
13
|
"extra-set": "^2.2.11",
|
|
14
|
-
"@dereekb/firebase": "8.
|
|
14
|
+
"@dereekb/firebase": "8.8.1",
|
|
15
15
|
"rxfire": "^6.0.3",
|
|
16
16
|
"rxjs": "^7.0.0",
|
|
17
17
|
"firebase": "^9.8.0",
|
|
18
|
-
"@dereekb/rxjs": "8.
|
|
18
|
+
"@dereekb/rxjs": "8.8.1",
|
|
19
19
|
"ms": "^3.0.0-canary.1",
|
|
20
|
-
"@dereekb/model": "8.
|
|
20
|
+
"@dereekb/model": "8.8.1",
|
|
21
21
|
"class-transformer": "^0.5.1",
|
|
22
22
|
"class-validator": "^0.13.2",
|
|
23
|
-
"@dereekb/date": "8.
|
|
23
|
+
"@dereekb/date": "8.8.1",
|
|
24
24
|
"date-fns": "^2.28.0",
|
|
25
25
|
"date-fns-tz": "^1.3.0",
|
|
26
26
|
"rrule": "2.7.0",
|