@dereekb/firebase 10.1.30 → 11.0.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/index.cjs.js +1040 -723
- package/index.esm.js +93 -163
- package/package.json +1 -1
- package/src/lib/client/firestore/driver.accessor.batch.d.ts +2 -2
- package/src/lib/client/firestore/driver.accessor.transaction.d.ts +1 -1
- package/src/lib/client/function/model.function.factory.d.ts +0 -10
- package/src/lib/common/firestore/collection/collection.d.ts +6 -0
- package/src/lib/common/firestore/query/query.iterate.d.ts +17 -2
- package/src/lib/common/firestore/snapshot/snapshot.field.d.ts +5 -9
- package/src/lib/common/model/function.d.ts +15 -37
- package/src/lib/common/model/model/model.param.d.ts +5 -5
- package/src/lib/common/model/model/model.validator.d.ts +4 -0
- package/test/CHANGELOG.md +23 -0
- package/test/package.json +1 -1
- package/test/src/lib/client/firebase.js +36 -21
- package/test/src/lib/client/firebase.js.map +1 -1
- package/test/src/lib/common/firebase.instance.js +2 -0
- package/test/src/lib/common/firebase.instance.js.map +1 -1
- package/test/src/lib/common/firestore/firestore.instance.js +1 -0
- package/test/src/lib/common/firestore/firestore.instance.js.map +1 -1
- package/test/src/lib/common/firestore/firestore.js +18 -10
- package/test/src/lib/common/firestore/firestore.js.map +1 -1
- package/test/src/lib/common/firestore/test.driver.accessor.js +273 -277
- package/test/src/lib/common/firestore/test.driver.accessor.js.map +1 -1
- package/test/src/lib/common/firestore/test.driver.query.js +411 -312
- package/test/src/lib/common/firestore/test.driver.query.js.map +1 -1
- package/test/src/lib/common/firestore/test.iterator.js +6 -7
- package/test/src/lib/common/firestore/test.iterator.js.map +1 -1
- package/test/src/lib/common/mock/mock.item.collection.fixture.d.ts +2 -1
- package/test/src/lib/common/mock/mock.item.collection.fixture.js +4 -2
- package/test/src/lib/common/mock/mock.item.collection.fixture.js.map +1 -1
- package/test/src/lib/common/mock/mock.item.service.js +6 -11
- package/test/src/lib/common/mock/mock.item.service.js.map +1 -1
- package/test/src/lib/common/mock/mock.item.storage.fixture.js +2 -1
- package/test/src/lib/common/mock/mock.item.storage.fixture.js.map +1 -1
- package/test/src/lib/common/storage/storage.instance.js +1 -0
- package/test/src/lib/common/storage/storage.instance.js.map +1 -1
- package/test/src/lib/common/storage/storage.js +10 -3
- package/test/src/lib/common/storage/storage.js.map +1 -1
- package/test/src/lib/common/storage/test.driver.accessor.js +132 -133
- package/test/src/lib/common/storage/test.driver.accessor.js.map +1 -1
package/index.cjs.js
CHANGED
|
@@ -13,47 +13,6 @@ var storage = require('firebase/storage');
|
|
|
13
13
|
var classTransformer = require('class-transformer');
|
|
14
14
|
var classValidator = require('class-validator');
|
|
15
15
|
|
|
16
|
-
/******************************************************************************
|
|
17
|
-
Copyright (c) Microsoft Corporation.
|
|
18
|
-
|
|
19
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
20
|
-
purpose with or without fee is hereby granted.
|
|
21
|
-
|
|
22
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
23
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
24
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
25
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
26
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
27
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
28
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
29
|
-
***************************************************************************** */
|
|
30
|
-
|
|
31
|
-
function __decorate(decorators, target, key, desc) {
|
|
32
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
33
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
34
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
35
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
function __metadata(metadataKey, metadataValue) {
|
|
39
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
function __awaiter(thisArg, _arguments, P, generator) {
|
|
43
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
44
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
45
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
46
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
47
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
48
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
53
|
-
var e = new Error(message);
|
|
54
|
-
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
55
|
-
};
|
|
56
|
-
|
|
57
16
|
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
58
17
|
|
|
59
18
|
var check = function (it) {
|
|
@@ -2276,6 +2235,7 @@ $$5({ target: 'Promise', stat: true, forced: FORCED_PROMISE_CONSTRUCTOR }, {
|
|
|
2276
2235
|
*/
|
|
2277
2236
|
class AbstractFirestoreDocumentDataAccessorWrapper {
|
|
2278
2237
|
constructor(accessor) {
|
|
2238
|
+
this.accessor = void 0;
|
|
2279
2239
|
this.accessor = accessor;
|
|
2280
2240
|
}
|
|
2281
2241
|
get documentRef() {
|
|
@@ -2398,6 +2358,9 @@ $$4({ target: 'Object', stat: true, arity: 2, forced: Object.assign !== assign }
|
|
|
2398
2358
|
class ModifyBeforeSetFirestoreDocumentDataAccessorWrapper extends AbstractFirestoreDocumentDataAccessorWrapper {
|
|
2399
2359
|
constructor(accessor, config) {
|
|
2400
2360
|
super(accessor);
|
|
2361
|
+
this.config = void 0;
|
|
2362
|
+
this.modifier = void 0;
|
|
2363
|
+
this.set = void 0;
|
|
2401
2364
|
this.config = config;
|
|
2402
2365
|
const when = config.when;
|
|
2403
2366
|
this.modifier = util.mergeModifiers(util.asArray(config.modifier));
|
|
@@ -2498,6 +2461,28 @@ function copyUserRelatedDataAccessorFactoryFunction() {
|
|
|
2498
2461
|
}
|
|
2499
2462
|
|
|
2500
2463
|
// MARK: Utility
|
|
2464
|
+
|
|
2465
|
+
function _await$a(value, then, direct) {
|
|
2466
|
+
if (direct) {
|
|
2467
|
+
return then ? then(value) : value;
|
|
2468
|
+
}
|
|
2469
|
+
if (!value || !value.then) {
|
|
2470
|
+
value = Promise.resolve(value);
|
|
2471
|
+
}
|
|
2472
|
+
return then ? value.then(then) : value;
|
|
2473
|
+
}
|
|
2474
|
+
function _async$a(f) {
|
|
2475
|
+
return function () {
|
|
2476
|
+
for (var args = [], i = 0; i < arguments.length; i++) {
|
|
2477
|
+
args[i] = arguments[i];
|
|
2478
|
+
}
|
|
2479
|
+
try {
|
|
2480
|
+
return Promise.resolve(f.apply(this, args));
|
|
2481
|
+
} catch (e) {
|
|
2482
|
+
return Promise.reject(e);
|
|
2483
|
+
}
|
|
2484
|
+
};
|
|
2485
|
+
}
|
|
2501
2486
|
exports.FirestoreAccessorStreamMode = void 0;
|
|
2502
2487
|
(function (FirestoreAccessorStreamMode) {
|
|
2503
2488
|
/**
|
|
@@ -2558,15 +2543,13 @@ function mapDataFromSnapshot(options) {
|
|
|
2558
2543
|
* @returns
|
|
2559
2544
|
*/
|
|
2560
2545
|
function updateWithAccessorUpdateAndConverterFunction(accessor, converter) {
|
|
2561
|
-
return (data, params)
|
|
2546
|
+
return _async$a(function (data, params) {
|
|
2562
2547
|
const updateInput = util.filterUndefinedValues(data);
|
|
2563
2548
|
const updateData = converter.toFirestore(updateInput, {
|
|
2564
2549
|
merge: true
|
|
2565
2550
|
}); // treat it as a merge
|
|
2566
2551
|
// Only update
|
|
2567
|
-
|
|
2568
|
-
return params != null ? accessor.update(updateData, params) : accessor.update(updateData);
|
|
2569
|
-
}
|
|
2552
|
+
return util.objectHasNoKeys(updateData) ? _await$a() : params != null ? accessor.update(updateData, params) : accessor.update(updateData);
|
|
2570
2553
|
});
|
|
2571
2554
|
}
|
|
2572
2555
|
|
|
@@ -2588,13 +2571,33 @@ exports.FirestoreDocumentContextType = void 0;
|
|
|
2588
2571
|
* @param accessor
|
|
2589
2572
|
* @returns
|
|
2590
2573
|
*/
|
|
2574
|
+
|
|
2575
|
+
function _await$9(value, then, direct) {
|
|
2576
|
+
if (direct) {
|
|
2577
|
+
return then ? then(value) : value;
|
|
2578
|
+
}
|
|
2579
|
+
if (!value || !value.then) {
|
|
2580
|
+
value = Promise.resolve(value);
|
|
2581
|
+
}
|
|
2582
|
+
return then ? value.then(then) : value;
|
|
2583
|
+
}
|
|
2584
|
+
function _async$9(f) {
|
|
2585
|
+
return function () {
|
|
2586
|
+
for (var args = [], i = 0; i < arguments.length; i++) {
|
|
2587
|
+
args[i] = arguments[i];
|
|
2588
|
+
}
|
|
2589
|
+
try {
|
|
2590
|
+
return Promise.resolve(f.apply(this, args));
|
|
2591
|
+
} catch (e) {
|
|
2592
|
+
return Promise.reject(e);
|
|
2593
|
+
}
|
|
2594
|
+
};
|
|
2595
|
+
}
|
|
2591
2596
|
function incrementUpdateWithAccessorFunction(accessor) {
|
|
2592
|
-
return
|
|
2597
|
+
return _async$9(function (data) {
|
|
2593
2598
|
const updateData = util.filterFalsyAndEmptyValues(data);
|
|
2594
2599
|
// Only update
|
|
2595
|
-
|
|
2596
|
-
return accessor.increment(updateData);
|
|
2597
|
-
}
|
|
2600
|
+
return util.objectHasNoKeys(updateData) ? _await$9() : accessor.increment(updateData);
|
|
2598
2601
|
});
|
|
2599
2602
|
}
|
|
2600
2603
|
|
|
@@ -2604,10 +2607,12 @@ function incrementUpdateWithAccessorFunction(accessor) {
|
|
|
2604
2607
|
*/
|
|
2605
2608
|
class AbstractFirestoreDocument {
|
|
2606
2609
|
constructor(accessor, documentAccessor) {
|
|
2607
|
-
this.accessor =
|
|
2608
|
-
this.documentAccessor =
|
|
2610
|
+
this.accessor = void 0;
|
|
2611
|
+
this.documentAccessor = void 0;
|
|
2609
2612
|
this.stream$ = rxjs$1.lazyFrom(() => this.accessor.stream());
|
|
2610
2613
|
this.data$ = rxjs$1.lazyFrom(() => dataFromSnapshotStream(this.stream$));
|
|
2614
|
+
this.accessor = accessor;
|
|
2615
|
+
this.documentAccessor = documentAccessor;
|
|
2611
2616
|
}
|
|
2612
2617
|
get modelType() {
|
|
2613
2618
|
return this.modelIdentity.modelType;
|
|
@@ -2714,11 +2719,11 @@ function limitedFirestoreDocumentAccessorFactory(config) {
|
|
|
2714
2719
|
} = config;
|
|
2715
2720
|
const expectedCollectionName = firestoreAccessorDriver.fuzzedPathForPath ? firestoreAccessorDriver.fuzzedPathForPath(modelIdentity.collectionName) : modelIdentity.collectionName;
|
|
2716
2721
|
const converterFactory = inputConverterFactory ? ref => {
|
|
2717
|
-
var
|
|
2718
|
-
return ref ? (
|
|
2722
|
+
var _inputConverterFactor;
|
|
2723
|
+
return ref ? (_inputConverterFactor = inputConverterFactory(ref)) != null ? _inputConverterFactor : inputDefaultConverter : inputDefaultConverter;
|
|
2719
2724
|
} : () => inputDefaultConverter;
|
|
2720
2725
|
const result = context => {
|
|
2721
|
-
const databaseContext = context
|
|
2726
|
+
const databaseContext = context != null ? context : config.firestoreAccessorDriver.defaultContextFactory();
|
|
2722
2727
|
const dataAccessorFactory = interceptAccessorFactory ? interceptAccessorFactory(databaseContext.accessorFactory) : databaseContext.accessorFactory;
|
|
2723
2728
|
function loadDocument(ref) {
|
|
2724
2729
|
if (!ref) {
|
|
@@ -2729,9 +2734,9 @@ function limitedFirestoreDocumentAccessorFactory(config) {
|
|
|
2729
2734
|
return makeDocument(accessor, documentAccessor);
|
|
2730
2735
|
}
|
|
2731
2736
|
function documentRefForKey(fullPath) {
|
|
2732
|
-
var
|
|
2737
|
+
var _ref$parent;
|
|
2733
2738
|
const ref = firestoreAccessorDriver.docAtPath(firestoreContext.firestore, fullPath);
|
|
2734
|
-
if (((
|
|
2739
|
+
if (((_ref$parent = ref.parent) == null ? void 0 : _ref$parent.id) !== expectedCollectionName) {
|
|
2735
2740
|
throw new Error(`unexpected key/path "${fullPath}" for expected type "${modelIdentity.collectionName}"/"${modelIdentity.modelType}".`);
|
|
2736
2741
|
}
|
|
2737
2742
|
const converter = converterFactory(ref);
|
|
@@ -2851,6 +2856,56 @@ function extendFirestoreCollectionWithSingleDocumentAccessor(x, singleItemIdenti
|
|
|
2851
2856
|
x.loadDocumentForWriteBatch = singleAccessor.loadDocumentForWriteBatch;
|
|
2852
2857
|
}
|
|
2853
2858
|
|
|
2859
|
+
/**
|
|
2860
|
+
* MappedUseAsyncFunction to load a snapshot from the input document and use it.
|
|
2861
|
+
*
|
|
2862
|
+
* @param document
|
|
2863
|
+
* @param use
|
|
2864
|
+
* @param defaultValue
|
|
2865
|
+
* @returns
|
|
2866
|
+
*/
|
|
2867
|
+
|
|
2868
|
+
function _empty$3() {} /**
|
|
2869
|
+
* MappedUseAsyncFunction to load snapshot data from the input document and use it.
|
|
2870
|
+
*/
|
|
2871
|
+
function _awaitIgnored$2(value, direct) {
|
|
2872
|
+
if (!direct) {
|
|
2873
|
+
return value && value.then ? value.then(_empty$3) : Promise.resolve();
|
|
2874
|
+
}
|
|
2875
|
+
}
|
|
2876
|
+
function _invoke$3(body, then) {
|
|
2877
|
+
var result = body();
|
|
2878
|
+
if (result && result.then) {
|
|
2879
|
+
return result.then(then);
|
|
2880
|
+
}
|
|
2881
|
+
return then(result);
|
|
2882
|
+
}
|
|
2883
|
+
function _await$8(value, then, direct) {
|
|
2884
|
+
if (direct) {
|
|
2885
|
+
return then ? then(value) : value;
|
|
2886
|
+
}
|
|
2887
|
+
if (!value || !value.then) {
|
|
2888
|
+
value = Promise.resolve(value);
|
|
2889
|
+
}
|
|
2890
|
+
return then ? value.then(then) : value;
|
|
2891
|
+
}
|
|
2892
|
+
function _async$8(f) {
|
|
2893
|
+
return function () {
|
|
2894
|
+
for (var args = [], i = 0; i < arguments.length; i++) {
|
|
2895
|
+
args[i] = arguments[i];
|
|
2896
|
+
}
|
|
2897
|
+
try {
|
|
2898
|
+
return Promise.resolve(f.apply(this, args));
|
|
2899
|
+
} catch (e) {
|
|
2900
|
+
return Promise.reject(e);
|
|
2901
|
+
}
|
|
2902
|
+
};
|
|
2903
|
+
}
|
|
2904
|
+
const useDocumentSnapshot = _async$8(function (document, use, defaultValue) {
|
|
2905
|
+
return _await$8(document == null ? void 0 : document.accessor.get(), function (snapshot) {
|
|
2906
|
+
return util.useAsync(snapshot, use, defaultValue);
|
|
2907
|
+
});
|
|
2908
|
+
});
|
|
2854
2909
|
function newDocuments(documentAccessor, count) {
|
|
2855
2910
|
return util.makeWithFactory(() => documentAccessor.newDocument(), count);
|
|
2856
2911
|
}
|
|
@@ -2862,17 +2917,21 @@ function newDocuments(documentAccessor, count) {
|
|
|
2862
2917
|
* @returns
|
|
2863
2918
|
*/
|
|
2864
2919
|
function makeDocuments(documentAccessor, make) {
|
|
2865
|
-
var
|
|
2866
|
-
const newDocumentFn = (
|
|
2920
|
+
var _make$newDocument;
|
|
2921
|
+
const newDocumentFn = (_make$newDocument = make.newDocument) != null ? _make$newDocument : () => documentAccessor.newDocument();
|
|
2867
2922
|
return util.performMakeLoop({
|
|
2868
2923
|
count: make.count,
|
|
2869
|
-
make:
|
|
2924
|
+
make: _async$8(function (i) {
|
|
2870
2925
|
const document = newDocumentFn(documentAccessor);
|
|
2871
|
-
|
|
2872
|
-
|
|
2873
|
-
|
|
2874
|
-
|
|
2875
|
-
|
|
2926
|
+
return _await$8(make.init(i, document), function (data) {
|
|
2927
|
+
return _invoke$3(function () {
|
|
2928
|
+
if (data != null) {
|
|
2929
|
+
return _awaitIgnored$2(document.accessor.create(data));
|
|
2930
|
+
}
|
|
2931
|
+
}, function () {
|
|
2932
|
+
return document;
|
|
2933
|
+
});
|
|
2934
|
+
});
|
|
2876
2935
|
})
|
|
2877
2936
|
});
|
|
2878
2937
|
}
|
|
@@ -3028,23 +3087,6 @@ function setIdAndKeyFromKeyIdRefOnDocumentData(data, modelRef) {
|
|
|
3028
3087
|
target.key = modelRef.key; // set the path/key on data
|
|
3029
3088
|
return target;
|
|
3030
3089
|
}
|
|
3031
|
-
/**
|
|
3032
|
-
* MappedUseAsyncFunction to load a snapshot from the input document and use it.
|
|
3033
|
-
*
|
|
3034
|
-
* @param document
|
|
3035
|
-
* @param use
|
|
3036
|
-
* @param defaultValue
|
|
3037
|
-
* @returns
|
|
3038
|
-
*/
|
|
3039
|
-
function useDocumentSnapshot(document, use, defaultValue) {
|
|
3040
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
3041
|
-
const snapshot = yield document === null || document === void 0 ? void 0 : document.accessor.get();
|
|
3042
|
-
return util.useAsync(snapshot, use, defaultValue);
|
|
3043
|
-
});
|
|
3044
|
-
}
|
|
3045
|
-
/**
|
|
3046
|
-
* MappedUseAsyncFunction to load snapshot data from the input document and use it.
|
|
3047
|
-
*/
|
|
3048
3090
|
const useDocumentSnapshotData = util.wrapUseAsyncFunction(useDocumentSnapshot, x => x.data());
|
|
3049
3091
|
// MARK: Key Accessors
|
|
3050
3092
|
function firestoreModelIdFromDocument(document) {
|
|
@@ -3184,7 +3226,7 @@ function snapshotConverterFunctions(config) {
|
|
|
3184
3226
|
};
|
|
3185
3227
|
}
|
|
3186
3228
|
if (mergeFields) {
|
|
3187
|
-
toOptions = Object.assign(
|
|
3229
|
+
toOptions = Object.assign({}, toOptions, {
|
|
3188
3230
|
fields: asTopLevelFieldPaths(mergeFields)
|
|
3189
3231
|
});
|
|
3190
3232
|
}
|
|
@@ -3675,7 +3717,7 @@ handlePrototype(DOMTokenListPrototype, 'DOMTokenList');
|
|
|
3675
3717
|
const FIRESTORE_EMPTY_VALUE = null;
|
|
3676
3718
|
|
|
3677
3719
|
function firestoreField(config) {
|
|
3678
|
-
var
|
|
3720
|
+
var _config$defaultBefore;
|
|
3679
3721
|
return {
|
|
3680
3722
|
from: config.default != null ? {
|
|
3681
3723
|
default: util.asObjectCopyFactory(config.default),
|
|
@@ -3685,7 +3727,7 @@ function firestoreField(config) {
|
|
|
3685
3727
|
convert: config.fromData
|
|
3686
3728
|
},
|
|
3687
3729
|
to: {
|
|
3688
|
-
default: (
|
|
3730
|
+
default: (_config$defaultBefore = config.defaultBeforeSave) != null ? _config$defaultBefore : FIRESTORE_EMPTY_VALUE,
|
|
3689
3731
|
convert: config.toData
|
|
3690
3732
|
}
|
|
3691
3733
|
};
|
|
@@ -3701,7 +3743,7 @@ function firestorePassThroughField() {
|
|
|
3701
3743
|
function optionalFirestoreField(config) {
|
|
3702
3744
|
// NOTE: Typings for this function internally is weird due to the support for both the one and two type transforms.
|
|
3703
3745
|
if (config) {
|
|
3704
|
-
const inputConfig = config
|
|
3746
|
+
const inputConfig = config != null ? config : {};
|
|
3705
3747
|
const {
|
|
3706
3748
|
dontStoreDefaultReadValue,
|
|
3707
3749
|
dontStoreValueIf: inputDontStoreValueIf,
|
|
@@ -3714,9 +3756,9 @@ function optionalFirestoreField(config) {
|
|
|
3714
3756
|
transformFromData,
|
|
3715
3757
|
transformToData
|
|
3716
3758
|
} = inputConfig;
|
|
3717
|
-
const transformData = inputTransformData
|
|
3718
|
-
const transformFrom = transformFromData
|
|
3719
|
-
const baseTransformTo = transformToData
|
|
3759
|
+
const transformData = inputTransformData != null ? inputTransformData : util.passThrough;
|
|
3760
|
+
const transformFrom = transformFromData != null ? transformFromData : transformData;
|
|
3761
|
+
const baseTransformTo = transformToData != null ? transformToData : transformData;
|
|
3720
3762
|
const dontStoreValueIf = inputDontStoreValueIf != null ? util.isEqualToValueDecisionFunction(inputDontStoreValueIf) : null;
|
|
3721
3763
|
const transformTo = dontStoreValueIf != null ? value => {
|
|
3722
3764
|
const dontStoreCheck = dontStoreValueIf(value);
|
|
@@ -3759,8 +3801,8 @@ function optionalFirestoreField(config) {
|
|
|
3759
3801
|
};
|
|
3760
3802
|
} else {
|
|
3761
3803
|
toData = x => {
|
|
3762
|
-
var
|
|
3763
|
-
return x != null ? (
|
|
3804
|
+
var _transformTo;
|
|
3805
|
+
return x != null ? (_transformTo = transformTo(x)) != null ? _transformTo : null : x;
|
|
3764
3806
|
};
|
|
3765
3807
|
}
|
|
3766
3808
|
return firestoreField({
|
|
@@ -3774,24 +3816,24 @@ function optionalFirestoreField(config) {
|
|
|
3774
3816
|
}
|
|
3775
3817
|
const DEFAULT_FIRESTORE_STRING_FIELD_VALUE = '';
|
|
3776
3818
|
function firestoreString(config) {
|
|
3777
|
-
const transform = util.transformStringFunctionConfig(config
|
|
3819
|
+
const transform = util.transformStringFunctionConfig(config == null ? void 0 : config.transform);
|
|
3778
3820
|
const transformData = transform ? util.transformStringFunction(transform) : util.passThrough;
|
|
3779
|
-
return firestoreField(Object.assign(
|
|
3821
|
+
return firestoreField(Object.assign({
|
|
3780
3822
|
default: DEFAULT_FIRESTORE_STRING_FIELD_VALUE
|
|
3781
|
-
}, config
|
|
3823
|
+
}, config, {
|
|
3782
3824
|
fromData: transformData,
|
|
3783
3825
|
toData: transformData
|
|
3784
3826
|
}));
|
|
3785
3827
|
}
|
|
3786
3828
|
function optionalFirestoreString(config) {
|
|
3787
|
-
const transform = util.transformStringFunctionConfig(config
|
|
3829
|
+
const transform = util.transformStringFunctionConfig(config == null ? void 0 : config.transform);
|
|
3788
3830
|
const transformData = transform ? util.transformStringFunction(transform) : util.passThrough;
|
|
3789
|
-
return optionalFirestoreField(Object.assign(
|
|
3831
|
+
return optionalFirestoreField(Object.assign({}, config, {
|
|
3790
3832
|
transformData
|
|
3791
3833
|
}));
|
|
3792
3834
|
}
|
|
3793
3835
|
function firestoreEnum(config) {
|
|
3794
|
-
return firestoreField(Object.assign(
|
|
3836
|
+
return firestoreField(Object.assign({}, config, {
|
|
3795
3837
|
fromData: util.passThrough,
|
|
3796
3838
|
toData: util.passThrough
|
|
3797
3839
|
}));
|
|
@@ -3810,22 +3852,22 @@ function optionalFirestoreUID() {
|
|
|
3810
3852
|
const firestoreModelKeyString = firestoreString();
|
|
3811
3853
|
const firestoreModelIdString = firestoreString();
|
|
3812
3854
|
function firestoreDate(config = {}) {
|
|
3813
|
-
var
|
|
3855
|
+
var _config$default, _config$defaultBefore2;
|
|
3814
3856
|
return firestoreField({
|
|
3815
|
-
default: (
|
|
3816
|
-
defaultBeforeSave: (
|
|
3857
|
+
default: (_config$default = config.default) != null ? _config$default : () => new Date(),
|
|
3858
|
+
defaultBeforeSave: (_config$defaultBefore2 = config.defaultBeforeSave) != null ? _config$defaultBefore2 : config.saveDefaultAsNow ? date.formatToISO8601DateString : null,
|
|
3817
3859
|
fromData: input => date.toJsDate(input),
|
|
3818
3860
|
toData: input => date.toISODateString(input)
|
|
3819
3861
|
});
|
|
3820
3862
|
}
|
|
3821
3863
|
function optionalFirestoreDate(config) {
|
|
3822
|
-
const inputDontStoreValueIf = config
|
|
3864
|
+
const inputDontStoreValueIf = config == null ? void 0 : config.dontStoreValueIf;
|
|
3823
3865
|
let dontStoreValueIf = inputDontStoreValueIf;
|
|
3824
3866
|
if (dontStoreValueIf != null && util.isDate(dontStoreValueIf)) {
|
|
3825
3867
|
const comparisonDate = dontStoreValueIf;
|
|
3826
3868
|
dontStoreValueIf = x => date.isSameDate(x, comparisonDate);
|
|
3827
3869
|
}
|
|
3828
|
-
return optionalFirestoreField(Object.assign(
|
|
3870
|
+
return optionalFirestoreField(Object.assign({}, config, {
|
|
3829
3871
|
dontStoreValueIf,
|
|
3830
3872
|
transformFromData: input => {
|
|
3831
3873
|
return date.toJsDate(input);
|
|
@@ -3846,41 +3888,41 @@ function optionalFirestoreBoolean(config) {
|
|
|
3846
3888
|
return optionalFirestoreField(config);
|
|
3847
3889
|
}
|
|
3848
3890
|
function firestoreNumber(config) {
|
|
3849
|
-
var
|
|
3850
|
-
const transform =
|
|
3851
|
-
transform: config
|
|
3852
|
-
} : config
|
|
3891
|
+
var _config$defaultBefore3;
|
|
3892
|
+
const transform = config != null && config.transform ? typeof config.transform === 'function' ? {
|
|
3893
|
+
transform: config == null ? void 0 : config.transform
|
|
3894
|
+
} : config == null ? void 0 : config.transform : undefined;
|
|
3853
3895
|
const transformData = transform ? util.transformNumberFunction(transform) : util.passThrough;
|
|
3854
|
-
return firestoreField(Object.assign(
|
|
3855
|
-
defaultBeforeSave: ((
|
|
3896
|
+
return firestoreField(Object.assign({}, config, {
|
|
3897
|
+
defaultBeforeSave: ((_config$defaultBefore3 = config.defaultBeforeSave) != null ? _config$defaultBefore3 : config.saveDefault) ? config.default : undefined,
|
|
3856
3898
|
fromData: transformData,
|
|
3857
3899
|
toData: transformData
|
|
3858
3900
|
}));
|
|
3859
3901
|
}
|
|
3860
3902
|
function optionalFirestoreNumber(config) {
|
|
3861
|
-
const transform =
|
|
3862
|
-
transform: config
|
|
3863
|
-
} : config
|
|
3903
|
+
const transform = config != null && config.transform ? typeof config.transform === 'function' ? {
|
|
3904
|
+
transform: config == null ? void 0 : config.transform
|
|
3905
|
+
} : config == null ? void 0 : config.transform : undefined;
|
|
3864
3906
|
const transformData = transform ? util.transformNumberFunction(transform) : util.passThrough;
|
|
3865
|
-
return optionalFirestoreField(Object.assign(
|
|
3907
|
+
return optionalFirestoreField(Object.assign({}, config, {
|
|
3866
3908
|
transformData
|
|
3867
3909
|
}));
|
|
3868
3910
|
}
|
|
3869
3911
|
function firestoreArray(config) {
|
|
3870
|
-
var
|
|
3912
|
+
var _config$default2;
|
|
3871
3913
|
const sortFn = util.sortValuesFunctionOrMapIdentityWithSortRef(config);
|
|
3872
3914
|
return firestoreField({
|
|
3873
|
-
default: (
|
|
3915
|
+
default: (_config$default2 = config.default) != null ? _config$default2 : () => [],
|
|
3874
3916
|
defaultBeforeSave: config.defaultBeforeSave,
|
|
3875
3917
|
fromData: x => sortFn(x, false),
|
|
3876
3918
|
toData: x => sortFn(x, true)
|
|
3877
3919
|
});
|
|
3878
3920
|
}
|
|
3879
3921
|
function optionalFirestoreArray(config) {
|
|
3880
|
-
var
|
|
3922
|
+
var _config$dontStoreIfEm;
|
|
3881
3923
|
const sortFn = util.sortValuesFunctionOrMapIdentityWithSortRef(config);
|
|
3882
|
-
const inputDontStoreIf = config
|
|
3883
|
-
const shouldNotStoreIfEmpty = (
|
|
3924
|
+
const inputDontStoreIf = config == null ? void 0 : config.dontStoreIf;
|
|
3925
|
+
const shouldNotStoreIfEmpty = (_config$dontStoreIfEm = config == null ? void 0 : config.dontStoreIfEmpty) != null ? _config$dontStoreIfEm : false;
|
|
3884
3926
|
let dontStoreIf;
|
|
3885
3927
|
if (inputDontStoreIf != null) {
|
|
3886
3928
|
dontStoreIf = shouldNotStoreIfEmpty ? x => x.length === 0 || inputDontStoreIf(x) : inputDontStoreIf;
|
|
@@ -3889,35 +3931,35 @@ function optionalFirestoreArray(config) {
|
|
|
3889
3931
|
return x.length === 0;
|
|
3890
3932
|
} : undefined;
|
|
3891
3933
|
}
|
|
3892
|
-
const inputFilterUnique = (config
|
|
3934
|
+
const inputFilterUnique = (config == null ? void 0 : config.filterUnique) === true ? util.unique : config == null ? void 0 : config.filterUnique;
|
|
3893
3935
|
const filterUniqueValuesFn = inputFilterUnique != null ? x => {
|
|
3894
3936
|
const result = inputFilterUnique(x);
|
|
3895
3937
|
return result;
|
|
3896
3938
|
} : undefined;
|
|
3897
|
-
const inputTransformData = config
|
|
3939
|
+
const inputTransformData = config == null ? void 0 : config.transformData;
|
|
3898
3940
|
const sortArrayFn = util.isMapIdentityFunction(sortFn) ? undefined : x => sortFn(x, true);
|
|
3899
3941
|
const transformData = util.chainMapSameFunctions([filterUniqueValuesFn, inputTransformData, sortArrayFn]);
|
|
3900
|
-
return optionalFirestoreField(Object.assign(
|
|
3942
|
+
return optionalFirestoreField(Object.assign({}, config, {
|
|
3901
3943
|
dontStoreIf,
|
|
3902
3944
|
transformData
|
|
3903
3945
|
}));
|
|
3904
3946
|
}
|
|
3905
3947
|
function firestoreUniqueArray(config) {
|
|
3906
|
-
var
|
|
3948
|
+
var _config$default3;
|
|
3907
3949
|
const {
|
|
3908
3950
|
filterUnique: inputFilterUnique
|
|
3909
3951
|
} = config;
|
|
3910
3952
|
const filterUnique = inputFilterUnique === true ? util.unique : inputFilterUnique;
|
|
3911
3953
|
const sortFn = util.sortValuesFunctionOrMapIdentityWithSortRef(config);
|
|
3912
3954
|
return firestoreField({
|
|
3913
|
-
default: (
|
|
3955
|
+
default: (_config$default3 = config.default) != null ? _config$default3 : () => [],
|
|
3914
3956
|
defaultBeforeSave: config.defaultBeforeSave,
|
|
3915
3957
|
fromData: x => sortFn(filterUnique(x), false),
|
|
3916
3958
|
toData: x => sortFn(filterUnique(x), true)
|
|
3917
3959
|
});
|
|
3918
3960
|
}
|
|
3919
3961
|
function firestoreUniqueKeyedArray(config) {
|
|
3920
|
-
return firestoreUniqueArray(Object.assign(
|
|
3962
|
+
return firestoreUniqueArray(Object.assign({}, config, {
|
|
3921
3963
|
filterUnique: util.filterUniqueFunction(config.readKey)
|
|
3922
3964
|
}));
|
|
3923
3965
|
}
|
|
@@ -3928,20 +3970,20 @@ function firestoreUniqueKeyedArray(config) {
|
|
|
3928
3970
|
* @returns
|
|
3929
3971
|
*/
|
|
3930
3972
|
function firestoreEnumArray(config = {}) {
|
|
3931
|
-
return firestoreUniqueArray(Object.assign(
|
|
3973
|
+
return firestoreUniqueArray(Object.assign({}, config, {
|
|
3932
3974
|
filterUnique: util.unique
|
|
3933
3975
|
}));
|
|
3934
3976
|
}
|
|
3935
3977
|
function firestoreUniqueStringArray(config) {
|
|
3936
3978
|
const filterUnique = config != null ? util.filterUniqueTransform(config) : util.unique;
|
|
3937
|
-
return firestoreUniqueArray(Object.assign(
|
|
3979
|
+
return firestoreUniqueArray(Object.assign({}, config, {
|
|
3938
3980
|
filterUnique: filterUnique
|
|
3939
3981
|
}));
|
|
3940
3982
|
}
|
|
3941
3983
|
const firestoreModelKeyArrayField = firestoreUniqueStringArray({});
|
|
3942
3984
|
const firestoreModelIdArrayField = firestoreModelKeyArrayField;
|
|
3943
3985
|
function firestoreUniqueNumberArray(config) {
|
|
3944
|
-
return firestoreUniqueArray(Object.assign(
|
|
3986
|
+
return firestoreUniqueArray(Object.assign({}, config, {
|
|
3945
3987
|
filterUnique: util.unique
|
|
3946
3988
|
}));
|
|
3947
3989
|
}
|
|
@@ -3952,14 +3994,14 @@ function firestoreUniqueNumberArray(config) {
|
|
|
3952
3994
|
* @returns
|
|
3953
3995
|
*/
|
|
3954
3996
|
function firestoreEncodedArray(config) {
|
|
3955
|
-
var
|
|
3997
|
+
var _config$default4;
|
|
3956
3998
|
const {
|
|
3957
3999
|
fromData,
|
|
3958
4000
|
toData
|
|
3959
4001
|
} = config.convert;
|
|
3960
4002
|
const sortFn = util.sortValuesFunctionOrMapIdentityWithSortRef(config);
|
|
3961
4003
|
return firestoreField({
|
|
3962
|
-
default: (
|
|
4004
|
+
default: (_config$default4 = config.default) != null ? _config$default4 : () => [],
|
|
3963
4005
|
defaultBeforeSave: config.defaultBeforeSave,
|
|
3964
4006
|
fromData: input => sortFn(input.map(fromData), false),
|
|
3965
4007
|
toData: input => util.filterMaybeValues(sortFn(input, true).map(toData))
|
|
@@ -3972,12 +4014,12 @@ function firestoreEncodedArray(config) {
|
|
|
3972
4014
|
* @returns
|
|
3973
4015
|
*/
|
|
3974
4016
|
function firestoreDencoderArray(config) {
|
|
3975
|
-
var
|
|
4017
|
+
var _config$default5;
|
|
3976
4018
|
const {
|
|
3977
4019
|
dencoder
|
|
3978
4020
|
} = config;
|
|
3979
4021
|
return firestoreField({
|
|
3980
|
-
default: (
|
|
4022
|
+
default: (_config$default5 = config.default) != null ? _config$default5 : () => [],
|
|
3981
4023
|
defaultBeforeSave: config.defaultBeforeSave,
|
|
3982
4024
|
fromData: input => dencoder(input),
|
|
3983
4025
|
toData: input => dencoder(input)
|
|
@@ -3990,12 +4032,12 @@ function firestoreDencoderArray(config) {
|
|
|
3990
4032
|
* @returns
|
|
3991
4033
|
*/
|
|
3992
4034
|
function firestoreDencoderStringArray(config) {
|
|
3993
|
-
var
|
|
4035
|
+
var _config$default6;
|
|
3994
4036
|
const {
|
|
3995
4037
|
dencoder
|
|
3996
4038
|
} = config;
|
|
3997
4039
|
return firestoreField({
|
|
3998
|
-
default: (
|
|
4040
|
+
default: (_config$default6 = config.default) != null ? _config$default6 : () => [],
|
|
3999
4041
|
defaultBeforeSave: config.defaultBeforeSave,
|
|
4000
4042
|
fromData: input => dencoder(input),
|
|
4001
4043
|
toData: input => dencoder(input)
|
|
@@ -4010,7 +4052,7 @@ function firestoreDencoderStringArray(config) {
|
|
|
4010
4052
|
* @returns
|
|
4011
4053
|
*/
|
|
4012
4054
|
function firestoreMap(config = {}) {
|
|
4013
|
-
var
|
|
4055
|
+
var _config$default7;
|
|
4014
4056
|
const {
|
|
4015
4057
|
mapFilter: filter = util.KeyValueTypleValueFilter.NULL,
|
|
4016
4058
|
mapFieldValues
|
|
@@ -4021,7 +4063,7 @@ function firestoreMap(config = {}) {
|
|
|
4021
4063
|
});
|
|
4022
4064
|
const makeCopy = mapFieldValues ? util.mapObjectMapFunction(mapFieldValues) : util.copyObject;
|
|
4023
4065
|
return firestoreField({
|
|
4024
|
-
default: (
|
|
4066
|
+
default: (_config$default7 = config.default) != null ? _config$default7 : () => ({}),
|
|
4025
4067
|
fromData: util.passThrough,
|
|
4026
4068
|
toData: model => {
|
|
4027
4069
|
const copy = makeCopy(model);
|
|
@@ -4054,7 +4096,7 @@ const firestoreModelIdGrantedRoleMap = firestoreModelKeyGrantedRoleMap;
|
|
|
4054
4096
|
* @returns
|
|
4055
4097
|
*/
|
|
4056
4098
|
function firestoreEncodedObjectMap(config) {
|
|
4057
|
-
var
|
|
4099
|
+
var _config$default8;
|
|
4058
4100
|
const {
|
|
4059
4101
|
mapFilter: filter = util.KeyValueTypleValueFilter.EMPTY,
|
|
4060
4102
|
encoder,
|
|
@@ -4065,7 +4107,7 @@ function firestoreEncodedObjectMap(config) {
|
|
|
4065
4107
|
filter
|
|
4066
4108
|
});
|
|
4067
4109
|
return firestoreField({
|
|
4068
|
-
default: (
|
|
4110
|
+
default: (_config$default8 = config.default) != null ? _config$default8 : () => ({}),
|
|
4069
4111
|
fromData: input => {
|
|
4070
4112
|
const copy = util.copyObject(input);
|
|
4071
4113
|
const result = util.mapObjectMap(copy, decoder);
|
|
@@ -4090,7 +4132,7 @@ function firestoreDencoderMap(config) {
|
|
|
4090
4132
|
const {
|
|
4091
4133
|
dencoder
|
|
4092
4134
|
} = config;
|
|
4093
|
-
return firestoreEncodedObjectMap(Object.assign(
|
|
4135
|
+
return firestoreEncodedObjectMap(Object.assign({}, config, {
|
|
4094
4136
|
encoder: dencoder,
|
|
4095
4137
|
decoder: dencoder
|
|
4096
4138
|
}));
|
|
@@ -4140,17 +4182,30 @@ function firestoreFieldConfigToModelMapFunctionsRef(config) {
|
|
|
4140
4182
|
* @returns
|
|
4141
4183
|
*/
|
|
4142
4184
|
function firestoreObjectArray(config) {
|
|
4143
|
-
var
|
|
4185
|
+
var _config$objectField, _config$default9;
|
|
4144
4186
|
const {
|
|
4145
|
-
filterUnique: inputFilterUnique
|
|
4187
|
+
filterUnique: inputFilterUnique,
|
|
4188
|
+
filter: filterFn
|
|
4146
4189
|
} = config;
|
|
4147
|
-
const
|
|
4148
|
-
const objectField = (_a = config.objectField) !== null && _a !== void 0 ? _a : firestoreFieldConfigToModelMapFunctionsRef(config.firestoreField);
|
|
4190
|
+
const objectField = (_config$objectField = config.objectField) != null ? _config$objectField : firestoreFieldConfigToModelMapFunctionsRef(config.firestoreField);
|
|
4149
4191
|
const sortFn = util.sortValuesFunctionOrMapIdentityWithSortRef(config);
|
|
4150
4192
|
const {
|
|
4151
4193
|
from,
|
|
4152
4194
|
to: baseTo
|
|
4153
4195
|
} = util.toModelMapFunctions(objectField);
|
|
4196
|
+
let performFiltering;
|
|
4197
|
+
if (inputFilterUnique != null ? inputFilterUnique : filterFn) {
|
|
4198
|
+
const filterUnique = inputFilterUnique != null ? inputFilterUnique : util.MAP_IDENTITY;
|
|
4199
|
+
performFiltering = x => {
|
|
4200
|
+
let result = filterUnique(x);
|
|
4201
|
+
if (filterFn) {
|
|
4202
|
+
result = result.filter(filterFn);
|
|
4203
|
+
}
|
|
4204
|
+
return result;
|
|
4205
|
+
};
|
|
4206
|
+
} else {
|
|
4207
|
+
performFiltering = util.MAP_IDENTITY;
|
|
4208
|
+
}
|
|
4154
4209
|
const to = x => {
|
|
4155
4210
|
// remove null/undefined values from each field when converting to in order to mirror firestore usage (undefined is treated like null)
|
|
4156
4211
|
const base = baseTo(x);
|
|
@@ -4158,27 +4213,27 @@ function firestoreObjectArray(config) {
|
|
|
4158
4213
|
return nullishfilteredOut;
|
|
4159
4214
|
};
|
|
4160
4215
|
return firestoreField({
|
|
4161
|
-
default: (
|
|
4216
|
+
default: (_config$default9 = config.default) != null ? _config$default9 : () => [],
|
|
4162
4217
|
defaultBeforeSave: config.defaultBeforeSave,
|
|
4163
|
-
fromData: input => sortFn(
|
|
4164
|
-
toData: input => util.filterMaybeValues(sortFn(
|
|
4218
|
+
fromData: input => sortFn(performFiltering(input.map(x => from(x))), false),
|
|
4219
|
+
toData: input => util.filterMaybeValues(sortFn(performFiltering(input), true)).map(x => to(x)) // filter then sort then map
|
|
4165
4220
|
});
|
|
4166
4221
|
}
|
|
4167
4222
|
/**
|
|
4168
4223
|
* A nested object field that uses other FirestoreFieldConfig configurations to map a field.
|
|
4169
4224
|
*/
|
|
4170
4225
|
function firestoreSubObject(config) {
|
|
4171
|
-
var
|
|
4226
|
+
var _config$defaultBefore4, _config$default10;
|
|
4172
4227
|
const mapFunctions = util.toModelMapFunctions(config.objectField);
|
|
4173
4228
|
const {
|
|
4174
4229
|
from: fromData,
|
|
4175
4230
|
to: toData
|
|
4176
4231
|
} = mapFunctions;
|
|
4177
4232
|
const defaultWithFields = () => fromData({});
|
|
4178
|
-
const defaultBeforeSave = (
|
|
4233
|
+
const defaultBeforeSave = (_config$defaultBefore4 = config.defaultBeforeSave) != null ? _config$defaultBefore4 : config.saveDefaultObject ? () => toData({}) : null;
|
|
4179
4234
|
const mapFunctionsConfig = util.build({
|
|
4180
4235
|
base: firestoreField({
|
|
4181
|
-
default: (
|
|
4236
|
+
default: (_config$default10 = config.default) != null ? _config$default10 : defaultWithFields,
|
|
4182
4237
|
defaultBeforeSave,
|
|
4183
4238
|
fromData,
|
|
4184
4239
|
toData
|
|
@@ -4203,7 +4258,7 @@ function firestoreLatLngString(config) {
|
|
|
4203
4258
|
default: defaultValue,
|
|
4204
4259
|
defaultBeforeSave,
|
|
4205
4260
|
precision
|
|
4206
|
-
} = config
|
|
4261
|
+
} = config != null ? config : {};
|
|
4207
4262
|
const transform = util.latLngStringFunction({
|
|
4208
4263
|
precision,
|
|
4209
4264
|
wrap: false,
|
|
@@ -4224,7 +4279,7 @@ function firestoreTimezoneString(config) {
|
|
|
4224
4279
|
const {
|
|
4225
4280
|
default: defaultValue,
|
|
4226
4281
|
defaultBeforeSave
|
|
4227
|
-
} = config
|
|
4282
|
+
} = config != null ? config : {};
|
|
4228
4283
|
return firestoreString({
|
|
4229
4284
|
default: defaultValue || util.DEFAULT_LAT_LNG_STRING_VALUE,
|
|
4230
4285
|
defaultBeforeSave
|
|
@@ -4388,18 +4443,18 @@ const firestoreMapZoomLevel = firestoreNumber({
|
|
|
4388
4443
|
});
|
|
4389
4444
|
function firestoreBitwiseSet(config) {
|
|
4390
4445
|
const dencoder = util.bitwiseSetDencoder(config.maxIndex);
|
|
4391
|
-
return firestoreField(Object.assign(
|
|
4446
|
+
return firestoreField(Object.assign({
|
|
4392
4447
|
default: () => new Set()
|
|
4393
|
-
}, config
|
|
4448
|
+
}, config, {
|
|
4394
4449
|
fromData: dencoder,
|
|
4395
4450
|
toData: dencoder
|
|
4396
4451
|
}));
|
|
4397
4452
|
}
|
|
4398
4453
|
function firestoreBitwiseSetMap(config) {
|
|
4399
4454
|
const dencoder = util.bitwiseSetDencoder(config.maxIndex);
|
|
4400
|
-
return firestoreEncodedObjectMap(Object.assign(
|
|
4455
|
+
return firestoreEncodedObjectMap(Object.assign({
|
|
4401
4456
|
mapFilter: util.KeyValueTypleValueFilter.FALSY
|
|
4402
|
-
}, config
|
|
4457
|
+
}, config, {
|
|
4403
4458
|
encoder: dencoder,
|
|
4404
4459
|
decoder: dencoder
|
|
4405
4460
|
}));
|
|
@@ -4408,16 +4463,16 @@ function firestoreBitwiseObjectMap(config) {
|
|
|
4408
4463
|
const {
|
|
4409
4464
|
dencoder
|
|
4410
4465
|
} = config;
|
|
4411
|
-
return firestoreEncodedObjectMap(Object.assign(
|
|
4466
|
+
return firestoreEncodedObjectMap(Object.assign({
|
|
4412
4467
|
mapFilter: util.KeyValueTypleValueFilter.FALSY
|
|
4413
|
-
}, config
|
|
4468
|
+
}, config, {
|
|
4414
4469
|
encoder: dencoder,
|
|
4415
4470
|
decoder: dencoder
|
|
4416
4471
|
}));
|
|
4417
4472
|
}
|
|
4418
4473
|
|
|
4419
4474
|
function unsupportedFirestoreDriverFunctionError(message) {
|
|
4420
|
-
throw new Error(message
|
|
4475
|
+
throw new Error(message != null ? message : 'This function is not supported by this Firestore driver.');
|
|
4421
4476
|
}
|
|
4422
4477
|
/**
|
|
4423
4478
|
* Asserts that the input data is not an empty object and has keys.
|
|
@@ -4442,7 +4497,8 @@ function firebaseQuerySnapshotAccumulator(iteration, mapSnapshots) {
|
|
|
4442
4497
|
return rxjs$1.itemAccumulator(iteration, mapSnapshots);
|
|
4443
4498
|
}
|
|
4444
4499
|
function firebaseQueryItemAccumulator(iteration, mapItem) {
|
|
4445
|
-
|
|
4500
|
+
var _mapItem;
|
|
4501
|
+
mapItem = (_mapItem = mapItem) != null ? _mapItem : x => x;
|
|
4446
4502
|
const snapshotData = documentDataFunction(true);
|
|
4447
4503
|
const mapFn = x => {
|
|
4448
4504
|
const result = util.filterMaybeValues(x.map(y => {
|
|
@@ -4700,31 +4756,31 @@ function whereDateIsBetween(fieldPath, range, sortDirection) {
|
|
|
4700
4756
|
start,
|
|
4701
4757
|
end
|
|
4702
4758
|
} = range;
|
|
4703
|
-
return [orderBy(fieldPath, sortDirection
|
|
4759
|
+
return [orderBy(fieldPath, sortDirection != null ? sortDirection : 'asc'), where(fieldPath, '>=', start.toISOString()), where(fieldPath, '<', end.toISOString())];
|
|
4704
4760
|
}
|
|
4705
4761
|
function whereDateIsOnOrAfter(fieldPath, date = new Date()) {
|
|
4706
4762
|
return where(fieldPath, '>=', date.toISOString());
|
|
4707
4763
|
}
|
|
4708
4764
|
function whereDateIsOnOrAfterWithSort(fieldPath, date = new Date(), sortDirection) {
|
|
4709
|
-
return [orderBy(fieldPath, sortDirection
|
|
4765
|
+
return [orderBy(fieldPath, sortDirection != null ? sortDirection : 'asc'), whereDateIsOnOrAfter(fieldPath, date)];
|
|
4710
4766
|
}
|
|
4711
4767
|
function whereDateIsOnOrBefore(fieldPath, date = new Date()) {
|
|
4712
4768
|
return where(fieldPath, '<=', date.toISOString());
|
|
4713
4769
|
}
|
|
4714
4770
|
function whereDateIsOnOrBeforeWithSort(fieldPath, date = new Date(), sortDirection) {
|
|
4715
|
-
return [orderBy(fieldPath, sortDirection
|
|
4771
|
+
return [orderBy(fieldPath, sortDirection != null ? sortDirection : 'desc'), whereDateIsOnOrBefore(fieldPath, date)];
|
|
4716
4772
|
}
|
|
4717
4773
|
function whereDateIsAfter(fieldPath, date = new Date()) {
|
|
4718
4774
|
return where(fieldPath, '>', date.toISOString());
|
|
4719
4775
|
}
|
|
4720
4776
|
function whereDateIsAfterWithSort(fieldPath, date = new Date(), sortDirection) {
|
|
4721
|
-
return [orderBy(fieldPath, sortDirection
|
|
4777
|
+
return [orderBy(fieldPath, sortDirection != null ? sortDirection : 'asc'), whereDateIsAfter(fieldPath, date)];
|
|
4722
4778
|
}
|
|
4723
4779
|
function whereDateIsBefore(fieldPath, date = new Date()) {
|
|
4724
4780
|
return where(fieldPath, '<', date.toISOString());
|
|
4725
4781
|
}
|
|
4726
4782
|
function whereDateIsBeforeWithSort(fieldPath, date = new Date(), sortDirection) {
|
|
4727
|
-
return [orderBy(fieldPath, sortDirection
|
|
4783
|
+
return [orderBy(fieldPath, sortDirection != null ? sortDirection : 'desc'), whereDateIsBefore(fieldPath, date)];
|
|
4728
4784
|
}
|
|
4729
4785
|
|
|
4730
4786
|
function filterDisallowedFirestoreItemPageIteratorInputContraints(constraints) {
|
|
@@ -4749,10 +4805,10 @@ function makeFirestoreItemPageIteratorDelegate() {
|
|
|
4749
4805
|
const {
|
|
4750
4806
|
limit: filterLimit,
|
|
4751
4807
|
constraints: filterConstraints
|
|
4752
|
-
} = filter
|
|
4808
|
+
} = filter != null ? filter : {};
|
|
4753
4809
|
return prevQueryResult$.pipe(rxjs.exhaustMap(prevResult => {
|
|
4754
|
-
if ((prevResult
|
|
4755
|
-
// TODO: Shouldn't happen. Remove this later.
|
|
4810
|
+
if ((prevResult == null ? void 0 : prevResult.snapshot.empty) === true) {
|
|
4811
|
+
// TODO(REMOVE): Shouldn't happen. Remove this later.
|
|
4756
4812
|
return rxjs.of({
|
|
4757
4813
|
end: true
|
|
4758
4814
|
});
|
|
@@ -4769,7 +4825,7 @@ function makeFirestoreItemPageIteratorDelegate() {
|
|
|
4769
4825
|
constraints.push(startAfterFilter);
|
|
4770
4826
|
}
|
|
4771
4827
|
// Add Limit
|
|
4772
|
-
const limitCount = filterLimit
|
|
4828
|
+
const limitCount = filterLimit != null ? filterLimit : itemsPerPage + (startAfterFilter ? 1 : 0); // todo: may not be needed.
|
|
4773
4829
|
const limitConstraint = limit(limitCount);
|
|
4774
4830
|
const constraintsWithLimit = [...constraints, limitConstraint];
|
|
4775
4831
|
// make query
|
|
@@ -4787,7 +4843,7 @@ function makeFirestoreItemPageIteratorDelegate() {
|
|
|
4787
4843
|
},
|
|
4788
4844
|
stream(options) {
|
|
4789
4845
|
// todo: consider allowing limit to be changed here to stream a subset. This will be useful for detecting collection changes.
|
|
4790
|
-
return driver.streamDocs(batchQuery, options
|
|
4846
|
+
return driver.streamDocs(batchQuery, options == null ? void 0 : options.options);
|
|
4791
4847
|
}
|
|
4792
4848
|
},
|
|
4793
4849
|
end: snapshot.empty
|
|
@@ -4819,12 +4875,12 @@ class FirestoreItemPageIterationInstance extends rxjs$1.MappedPageItemIterationI
|
|
|
4819
4875
|
*/
|
|
4820
4876
|
function firestoreItemPageIterationFactory(baseConfig) {
|
|
4821
4877
|
return filter => {
|
|
4822
|
-
var
|
|
4878
|
+
var _filter$maxPageLoadLi;
|
|
4823
4879
|
const result = firestoreItemPageIteration({
|
|
4824
4880
|
queryLike: baseConfig.queryLike,
|
|
4825
4881
|
itemsPerPage: baseConfig.itemsPerPage,
|
|
4826
4882
|
firestoreQueryDriver: baseConfig.firestoreQueryDriver,
|
|
4827
|
-
maxPageLoadLimit: (
|
|
4883
|
+
maxPageLoadLimit: (_filter$maxPageLoadLi = filter == null ? void 0 : filter.maxPageLoadLimit) != null ? _filter$maxPageLoadLi : baseConfig.maxPageLoadLimit,
|
|
4828
4884
|
filter
|
|
4829
4885
|
});
|
|
4830
4886
|
return result;
|
|
@@ -4843,6 +4899,28 @@ function firestoreItemPageIteration(config) {
|
|
|
4843
4899
|
* @param config
|
|
4844
4900
|
* @returns
|
|
4845
4901
|
*/
|
|
4902
|
+
|
|
4903
|
+
function _async$7(f) {
|
|
4904
|
+
return function () {
|
|
4905
|
+
for (var args = [], i = 0; i < arguments.length; i++) {
|
|
4906
|
+
args[i] = arguments[i];
|
|
4907
|
+
}
|
|
4908
|
+
try {
|
|
4909
|
+
return Promise.resolve(f.apply(this, args));
|
|
4910
|
+
} catch (e) {
|
|
4911
|
+
return Promise.reject(e);
|
|
4912
|
+
}
|
|
4913
|
+
};
|
|
4914
|
+
}
|
|
4915
|
+
function _await$7(value, then, direct) {
|
|
4916
|
+
if (direct) {
|
|
4917
|
+
return then ? then(value) : value;
|
|
4918
|
+
}
|
|
4919
|
+
if (!value || !value.then) {
|
|
4920
|
+
value = Promise.resolve(value);
|
|
4921
|
+
}
|
|
4922
|
+
return then ? value.then(then) : value;
|
|
4923
|
+
}
|
|
4846
4924
|
function firestoreQueryFactory(config) {
|
|
4847
4925
|
const {
|
|
4848
4926
|
queryLike,
|
|
@@ -4859,14 +4937,15 @@ function firestoreQueryFactory(config) {
|
|
|
4859
4937
|
const query = makeQuery(inputQuery, ...allConstraints);
|
|
4860
4938
|
const result = {
|
|
4861
4939
|
query,
|
|
4862
|
-
countDocs: (
|
|
4940
|
+
countDocs: _async$7(function () {
|
|
4863
4941
|
return countDocs(query);
|
|
4864
4942
|
}),
|
|
4865
|
-
getFirstDoc:
|
|
4943
|
+
getFirstDoc: _async$7(function (transaction) {
|
|
4866
4944
|
const contraintsForOneDoc = addOrReplaceLimitInConstraints(1)(allConstraints);
|
|
4867
4945
|
const query = makeQuery(inputQuery, ...contraintsForOneDoc);
|
|
4868
|
-
|
|
4869
|
-
|
|
4946
|
+
return _await$7(getDocs(query, transaction), function (result) {
|
|
4947
|
+
return result.docs[0];
|
|
4948
|
+
});
|
|
4870
4949
|
}),
|
|
4871
4950
|
getDocs: transaction => getDocs(query, transaction),
|
|
4872
4951
|
streamDocs: () => streamDocs(query),
|
|
@@ -4917,196 +4996,104 @@ function readFirestoreModelKeyFromDocumentSnapshot(snapshot) {
|
|
|
4917
4996
|
* @param config
|
|
4918
4997
|
* @returns
|
|
4919
4998
|
*/
|
|
4920
|
-
|
|
4921
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
4922
|
-
const {
|
|
4923
|
-
iterateSnapshotPair,
|
|
4924
|
-
documentAccessor
|
|
4925
|
-
} = config;
|
|
4926
|
-
const loadPairForSnapshot = firestoreDocumentSnapshotPairsLoaderInstance(documentAccessor);
|
|
4927
|
-
return iterateFirestoreDocumentSnapshots(Object.assign(Object.assign({}, config), {
|
|
4928
|
-
iterateSnapshot: snapshot => __awaiter(this, void 0, void 0, function* () {
|
|
4929
|
-
const pair = loadPairForSnapshot(snapshot);
|
|
4930
|
-
return iterateSnapshotPair(pair);
|
|
4931
|
-
})
|
|
4932
|
-
}));
|
|
4933
|
-
});
|
|
4934
|
-
}
|
|
4999
|
+
|
|
4935
5000
|
/**
|
|
4936
|
-
* Iterates through the results of a Firestore query
|
|
5001
|
+
* Iterates through the results of a Firestore query in several batches.
|
|
4937
5002
|
*
|
|
4938
5003
|
* @param config
|
|
4939
5004
|
* @returns
|
|
4940
5005
|
*/
|
|
4941
|
-
function
|
|
4942
|
-
return
|
|
4943
|
-
|
|
4944
|
-
|
|
4945
|
-
|
|
4946
|
-
|
|
4947
|
-
|
|
4948
|
-
|
|
4949
|
-
|
|
4950
|
-
|
|
4951
|
-
|
|
4952
|
-
sequential: true
|
|
4953
|
-
}, snapshotsPerformTasksConfig !== null && snapshotsPerformTasksConfig !== void 0 ? snapshotsPerformTasksConfig : Object.assign(Object.assign({}, performTasksConfig), {
|
|
4954
|
-
nonConcurrentTaskKeyFactory: undefined,
|
|
4955
|
-
beforeRetry: undefined
|
|
4956
|
-
}) // don't pass the nonConcurrentTaskKeyFactory
|
|
4957
|
-
));
|
|
4958
|
-
|
|
4959
|
-
return performTasksResult;
|
|
4960
|
-
})
|
|
4961
|
-
}));
|
|
4962
|
-
});
|
|
5006
|
+
function _async$6(f) {
|
|
5007
|
+
return function () {
|
|
5008
|
+
for (var args = [], i = 0; i < arguments.length; i++) {
|
|
5009
|
+
args[i] = arguments[i];
|
|
5010
|
+
}
|
|
5011
|
+
try {
|
|
5012
|
+
return Promise.resolve(f.apply(this, args));
|
|
5013
|
+
} catch (e) {
|
|
5014
|
+
return Promise.reject(e);
|
|
5015
|
+
}
|
|
5016
|
+
};
|
|
4963
5017
|
}
|
|
4964
|
-
|
|
4965
|
-
|
|
4966
|
-
|
|
4967
|
-
|
|
4968
|
-
|
|
4969
|
-
|
|
4970
|
-
|
|
4971
|
-
|
|
4972
|
-
|
|
4973
|
-
|
|
4974
|
-
documentAccessor
|
|
4975
|
-
} = config;
|
|
4976
|
-
const loadPairForSnapshot = firestoreDocumentSnapshotPairsLoaderInstance(documentAccessor);
|
|
4977
|
-
return iterateFirestoreDocumentSnapshotBatches(Object.assign(Object.assign({}, config), {
|
|
4978
|
-
maxParallelCheckpoints: 1,
|
|
4979
|
-
iterateSnapshotBatch: (snapshots, batchIndex) => __awaiter(this, void 0, void 0, function* () {
|
|
4980
|
-
const pairs = snapshots.map(loadPairForSnapshot);
|
|
4981
|
-
return iterateSnapshotPairsBatch(pairs, batchIndex);
|
|
4982
|
-
})
|
|
4983
|
-
}));
|
|
4984
|
-
});
|
|
5018
|
+
|
|
5019
|
+
// MARK: Utility
|
|
5020
|
+
function _await$6(value, then, direct) {
|
|
5021
|
+
if (direct) {
|
|
5022
|
+
return then ? then(value) : value;
|
|
5023
|
+
}
|
|
5024
|
+
if (!value || !value.then) {
|
|
5025
|
+
value = Promise.resolve(value);
|
|
5026
|
+
}
|
|
5027
|
+
return then ? value.then(then) : value;
|
|
4985
5028
|
}
|
|
4986
|
-
|
|
4987
|
-
|
|
4988
|
-
|
|
4989
|
-
|
|
4990
|
-
|
|
4991
|
-
const DEFAULT_ITERATE_FIRESTORE_DOCUMENT_SNAPSHOT_BATCHES_BATCH_SIZE = 25;
|
|
4992
|
-
/**
|
|
4993
|
-
* Iterates through the results of a Firestore query by each document snapshot.
|
|
4994
|
-
*
|
|
4995
|
-
* @param config
|
|
4996
|
-
* @returns
|
|
4997
|
-
*/
|
|
4998
|
-
function iterateFirestoreDocumentSnapshotBatches(config) {
|
|
4999
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
5000
|
-
const {
|
|
5001
|
-
iterateSnapshotBatch,
|
|
5002
|
-
batchSizeForSnapshots: inputBatchSizeForSnapshots,
|
|
5003
|
-
performTasksConfig,
|
|
5004
|
-
batchSize: inputBatchSize
|
|
5005
|
-
} = config;
|
|
5006
|
-
const batchSize = inputBatchSize === null ? null : inputBatchSize !== null && inputBatchSize !== void 0 ? inputBatchSize : DEFAULT_ITERATE_FIRESTORE_DOCUMENT_SNAPSHOT_BATCHES_BATCH_SIZE;
|
|
5007
|
-
const batchSizeForSnapshots = inputBatchSizeForSnapshots !== null && inputBatchSizeForSnapshots !== void 0 ? inputBatchSizeForSnapshots : () => batchSize;
|
|
5008
|
-
return iterateFirestoreDocumentSnapshotCheckpoints(Object.assign(Object.assign({}, config), {
|
|
5009
|
-
iterateCheckpoint: docSnapshots => __awaiter(this, void 0, void 0, function* () {
|
|
5010
|
-
if (docSnapshots.length > 0) {
|
|
5011
|
-
const batchSizeForSnapshotsResult = yield batchSizeForSnapshots(docSnapshots);
|
|
5012
|
-
const batches = batchSizeForSnapshotsResult === null ? [docSnapshots] : util.batch(docSnapshots, batchSizeForSnapshotsResult);
|
|
5013
|
-
let i = 0;
|
|
5014
|
-
const performTasksResult = yield util.performAsyncTasks(batches, x => iterateSnapshotBatch(x, i++), Object.assign({
|
|
5015
|
-
sequential: true
|
|
5016
|
-
}, performTasksConfig));
|
|
5017
|
-
return performTasksResult.results.map(([snapshots, result], i) => ({
|
|
5018
|
-
snapshots,
|
|
5019
|
-
result,
|
|
5020
|
-
i
|
|
5021
|
-
}));
|
|
5022
|
-
} else {
|
|
5023
|
-
return [];
|
|
5024
|
-
}
|
|
5025
|
-
})
|
|
5026
|
-
}));
|
|
5027
|
-
});
|
|
5029
|
+
function _empty$2() {}
|
|
5030
|
+
function _awaitIgnored$1(value, direct) {
|
|
5031
|
+
if (!direct) {
|
|
5032
|
+
return value && value.then ? value.then(_empty$2) : Promise.resolve();
|
|
5033
|
+
}
|
|
5028
5034
|
}
|
|
5029
|
-
|
|
5030
|
-
|
|
5031
|
-
|
|
5032
|
-
|
|
5033
|
-
|
|
5034
|
-
|
|
5035
|
-
|
|
5036
|
-
|
|
5037
|
-
|
|
5038
|
-
|
|
5039
|
-
|
|
5040
|
-
|
|
5041
|
-
|
|
5042
|
-
useCheckpointResult,
|
|
5043
|
-
constraintsFactory: inputConstraintsFactory,
|
|
5044
|
-
dynamicConstraints: inputDynamicConstraints,
|
|
5045
|
-
queryFactory,
|
|
5046
|
-
maxParallelCheckpoints = 1,
|
|
5047
|
-
limitPerCheckpoint: inputLimitPerCheckpoint,
|
|
5048
|
-
totalSnapshotsLimit: inputTotalSnapshotsLimit
|
|
5049
|
-
} = config;
|
|
5050
|
-
const constraintsInputIsFactory = typeof inputConstraintsFactory === 'function';
|
|
5051
|
-
const constraintsFactory = constraintsInputIsFactory && inputDynamicConstraints !== false ? inputConstraintsFactory : util.asGetter(util.getValueFromGetter(inputConstraintsFactory));
|
|
5052
|
-
/**
|
|
5053
|
-
* Default to the input total snapshots limit if no limit is provided, otherwise there will be no limit.
|
|
5054
|
-
*/
|
|
5055
|
-
const limitPerCheckpoint = inputLimitPerCheckpoint !== null && inputLimitPerCheckpoint !== void 0 ? inputLimitPerCheckpoint : inputTotalSnapshotsLimit;
|
|
5056
|
-
const totalSnapshotsLimit = inputTotalSnapshotsLimit !== null && inputTotalSnapshotsLimit !== void 0 ? inputTotalSnapshotsLimit : Number.MAX_SAFE_INTEGER;
|
|
5057
|
-
let currentIndex = 0;
|
|
5058
|
-
let hasReachedEnd = false;
|
|
5059
|
-
let totalSnapshotsLimitReached = false;
|
|
5060
|
-
let totalSnapshotsVisited = 0;
|
|
5061
|
-
let cursorDocument;
|
|
5062
|
-
const visitedCursorPaths = new Set();
|
|
5063
|
-
const handleRepeatCursor = typeof inputHandleRepeatCursor === 'function' ? inputHandleRepeatCursor : () => inputHandleRepeatCursor;
|
|
5064
|
-
const filterCheckpointSnapshot = inputFilterCheckpointSnapshot !== null && inputFilterCheckpointSnapshot !== void 0 ? inputFilterCheckpointSnapshot : util.mapIdentityFunction();
|
|
5065
|
-
function taskInputFactory() {
|
|
5066
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
5067
|
-
// Perform another query, then pass the results to the task factory.
|
|
5068
|
-
if (hasReachedEnd) {
|
|
5069
|
-
return null; // issue no more tasks
|
|
5070
|
-
}
|
|
5035
|
+
function _invoke$2(body, then) {
|
|
5036
|
+
var result = body();
|
|
5037
|
+
if (result && result.then) {
|
|
5038
|
+
return result.then(then);
|
|
5039
|
+
}
|
|
5040
|
+
return then(result);
|
|
5041
|
+
}
|
|
5042
|
+
const iterateFirestoreDocumentSnapshotCheckpoints = _async$6(function (config) {
|
|
5043
|
+
const taskInputFactory = _async$6(function () {
|
|
5044
|
+
// Perform another query, then pass the results to the task factory.
|
|
5045
|
+
if (hasReachedEnd) {
|
|
5046
|
+
return null; // issue no more tasks
|
|
5047
|
+
}
|
|
5071
5048
|
|
|
5072
|
-
|
|
5073
|
-
|
|
5074
|
-
|
|
5075
|
-
|
|
5076
|
-
|
|
5077
|
-
|
|
5078
|
-
|
|
5079
|
-
|
|
5080
|
-
|
|
5081
|
-
|
|
5082
|
-
|
|
5083
|
-
|
|
5084
|
-
|
|
5085
|
-
|
|
5086
|
-
|
|
5087
|
-
|
|
5088
|
-
|
|
5089
|
-
|
|
5090
|
-
|
|
5091
|
-
|
|
5092
|
-
|
|
5093
|
-
|
|
5094
|
-
|
|
5049
|
+
const constraints = constraintsFactory();
|
|
5050
|
+
const startAfterFilter = cursorDocument ? startAfter(cursorDocument) : undefined;
|
|
5051
|
+
if (startAfterFilter) {
|
|
5052
|
+
constraints.push(startAfterFilter);
|
|
5053
|
+
}
|
|
5054
|
+
if (limitPerCheckpoint != null) {
|
|
5055
|
+
const totalPossibleNumberOfItemsLeftToLoad = Math.max(0, totalSnapshotsLimit - totalSnapshotsVisited);
|
|
5056
|
+
const nextLimit = Math.min(limitPerCheckpoint, totalPossibleNumberOfItemsLeftToLoad);
|
|
5057
|
+
if (nextLimit === 0) {
|
|
5058
|
+
// we're at the end
|
|
5059
|
+
cursorDocument = null;
|
|
5060
|
+
hasReachedEnd = true;
|
|
5061
|
+
totalSnapshotsLimitReached = true; // should have already been reached, but flag again just incase
|
|
5062
|
+
return null; // exit immediately
|
|
5063
|
+
} else {
|
|
5064
|
+
constraints.push(limit(nextLimit));
|
|
5065
|
+
}
|
|
5066
|
+
}
|
|
5067
|
+
const query = queryFactory.query(constraints);
|
|
5068
|
+
return _await$6(query.getDocs(), function (docQuerySnapshot) {
|
|
5069
|
+
let _exit = false;
|
|
5070
|
+
const docSnapshots = docQuerySnapshot.docs;
|
|
5071
|
+
// check for repeat cursor
|
|
5072
|
+
const nextCursorDocument = util.lastValue(docSnapshots);
|
|
5073
|
+
return _invoke$2(function () {
|
|
5095
5074
|
if (nextCursorDocument != null) {
|
|
5096
5075
|
const cursorPath = readFirestoreModelKeyFromDocumentSnapshot(nextCursorDocument);
|
|
5097
|
-
|
|
5098
|
-
|
|
5099
|
-
|
|
5100
|
-
|
|
5101
|
-
|
|
5102
|
-
|
|
5076
|
+
return function () {
|
|
5077
|
+
if (visitedCursorPaths.has(cursorPath)) {
|
|
5078
|
+
return _await$6(handleRepeatCursor(nextCursorDocument), function (shouldContinue) {
|
|
5079
|
+
if (shouldContinue === false) {
|
|
5080
|
+
cursorDocument = null;
|
|
5081
|
+
hasReachedEnd = true;
|
|
5082
|
+
const _temp = null;
|
|
5083
|
+
_exit = true;
|
|
5084
|
+
return _temp; // exit immediately
|
|
5085
|
+
}
|
|
5086
|
+
});
|
|
5087
|
+
} else {
|
|
5088
|
+
visitedCursorPaths.add(cursorPath);
|
|
5103
5089
|
}
|
|
5104
|
-
}
|
|
5105
|
-
visitedCursorPaths.add(cursorPath);
|
|
5106
|
-
}
|
|
5090
|
+
}();
|
|
5107
5091
|
}
|
|
5092
|
+
}, function (_result2) {
|
|
5093
|
+
if (_exit) return _result2;
|
|
5108
5094
|
cursorDocument = nextCursorDocument; // set the next cursor document
|
|
5109
5095
|
// update state
|
|
5096
|
+
// increase our current index
|
|
5110
5097
|
const newSnapshotsVisited = docSnapshots.length;
|
|
5111
5098
|
totalSnapshotsVisited += newSnapshotsVisited;
|
|
5112
5099
|
if (!cursorDocument || totalSnapshotsVisited > totalSnapshotsLimit) {
|
|
@@ -5115,33 +5102,64 @@ function iterateFirestoreDocumentSnapshotCheckpoints(config) {
|
|
|
5115
5102
|
}
|
|
5116
5103
|
|
|
5117
5104
|
const i = currentIndex;
|
|
5118
|
-
currentIndex += 1;
|
|
5105
|
+
currentIndex += 1;
|
|
5119
5106
|
return {
|
|
5120
5107
|
i,
|
|
5121
5108
|
docQuerySnapshot
|
|
5122
5109
|
};
|
|
5123
5110
|
});
|
|
5124
|
-
}
|
|
5125
|
-
const performTaskFn = util.performTasksFromFactoryInParallelFunction({
|
|
5126
|
-
maxParallelTasks: maxParallelCheckpoints,
|
|
5127
|
-
waitBetweenTasks: waitBetweenCheckpoints,
|
|
5128
|
-
taskFactory: ({
|
|
5129
|
-
i,
|
|
5130
|
-
docQuerySnapshot
|
|
5131
|
-
}) => __awaiter(this, void 0, void 0, function* () {
|
|
5132
|
-
const docSnapshots = yield filterCheckpointSnapshot(docQuerySnapshot.docs);
|
|
5133
|
-
const results = yield iterateCheckpoint(docSnapshots, docQuerySnapshot);
|
|
5134
|
-
const checkpointResults = {
|
|
5135
|
-
i,
|
|
5136
|
-
cursorDocument,
|
|
5137
|
-
results,
|
|
5138
|
-
docSnapshots,
|
|
5139
|
-
docQuerySnapshot
|
|
5140
|
-
};
|
|
5141
|
-
yield useCheckpointResult === null || useCheckpointResult === void 0 ? void 0 : useCheckpointResult(checkpointResults);
|
|
5142
|
-
})
|
|
5143
5111
|
});
|
|
5144
|
-
|
|
5112
|
+
});
|
|
5113
|
+
const {
|
|
5114
|
+
iterateCheckpoint,
|
|
5115
|
+
filterCheckpointSnapshots: inputFilterCheckpointSnapshot,
|
|
5116
|
+
handleRepeatCursor: inputHandleRepeatCursor,
|
|
5117
|
+
waitBetweenCheckpoints,
|
|
5118
|
+
useCheckpointResult,
|
|
5119
|
+
constraintsFactory: inputConstraintsFactory,
|
|
5120
|
+
dynamicConstraints: inputDynamicConstraints,
|
|
5121
|
+
queryFactory,
|
|
5122
|
+
maxParallelCheckpoints = 1,
|
|
5123
|
+
limitPerCheckpoint: inputLimitPerCheckpoint,
|
|
5124
|
+
totalSnapshotsLimit: inputTotalSnapshotsLimit
|
|
5125
|
+
} = config;
|
|
5126
|
+
const constraintsInputIsFactory = typeof inputConstraintsFactory === 'function';
|
|
5127
|
+
const constraintsFactory = constraintsInputIsFactory && inputDynamicConstraints !== false ? inputConstraintsFactory : util.asGetter(util.getValueFromGetter(inputConstraintsFactory));
|
|
5128
|
+
/**
|
|
5129
|
+
* Default to the input total snapshots limit if no limit is provided, otherwise there will be no limit.
|
|
5130
|
+
*/
|
|
5131
|
+
const limitPerCheckpoint = inputLimitPerCheckpoint != null ? inputLimitPerCheckpoint : inputTotalSnapshotsLimit;
|
|
5132
|
+
const totalSnapshotsLimit = inputTotalSnapshotsLimit != null ? inputTotalSnapshotsLimit : Number.MAX_SAFE_INTEGER;
|
|
5133
|
+
let currentIndex = 0;
|
|
5134
|
+
let hasReachedEnd = false;
|
|
5135
|
+
let totalSnapshotsLimitReached = false;
|
|
5136
|
+
let totalSnapshotsVisited = 0;
|
|
5137
|
+
let cursorDocument;
|
|
5138
|
+
const visitedCursorPaths = new Set();
|
|
5139
|
+
const handleRepeatCursor = typeof inputHandleRepeatCursor === 'function' ? inputHandleRepeatCursor : () => inputHandleRepeatCursor;
|
|
5140
|
+
const filterCheckpointSnapshot = inputFilterCheckpointSnapshot != null ? inputFilterCheckpointSnapshot : util.mapIdentityFunction();
|
|
5141
|
+
const performTaskFn = util.performTasksFromFactoryInParallelFunction({
|
|
5142
|
+
maxParallelTasks: maxParallelCheckpoints,
|
|
5143
|
+
waitBetweenTasks: waitBetweenCheckpoints,
|
|
5144
|
+
taskFactory: _async$6(function ({
|
|
5145
|
+
i,
|
|
5146
|
+
docQuerySnapshot
|
|
5147
|
+
}) {
|
|
5148
|
+
return _await$6(filterCheckpointSnapshot(docQuerySnapshot.docs), function (docSnapshots) {
|
|
5149
|
+
return _await$6(iterateCheckpoint(docSnapshots, docQuerySnapshot), function (results) {
|
|
5150
|
+
const checkpointResults = {
|
|
5151
|
+
i,
|
|
5152
|
+
cursorDocument,
|
|
5153
|
+
results,
|
|
5154
|
+
docSnapshots,
|
|
5155
|
+
docQuerySnapshot
|
|
5156
|
+
};
|
|
5157
|
+
return _awaitIgnored$1(useCheckpointResult == null ? void 0 : useCheckpointResult(checkpointResults));
|
|
5158
|
+
});
|
|
5159
|
+
});
|
|
5160
|
+
})
|
|
5161
|
+
});
|
|
5162
|
+
return _await$6(performTaskFn(taskInputFactory), function () {
|
|
5145
5163
|
const result = {
|
|
5146
5164
|
totalCheckpoints: currentIndex,
|
|
5147
5165
|
totalSnapshotsVisited,
|
|
@@ -5149,108 +5167,265 @@ function iterateFirestoreDocumentSnapshotCheckpoints(config) {
|
|
|
5149
5167
|
};
|
|
5150
5168
|
return result;
|
|
5151
5169
|
});
|
|
5152
|
-
}
|
|
5153
|
-
// MARK: Utility
|
|
5154
|
-
function allowDocumentSnapshotWithPathOnceFilter() {
|
|
5155
|
-
return util.allowValueOnceFilter(readFirestoreModelKeyFromDocumentSnapshot);
|
|
5156
|
-
}
|
|
5157
|
-
|
|
5158
|
-
function loadAllFirestoreDocumentSnapshotPairs(config) {
|
|
5159
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
5160
|
-
const {
|
|
5161
|
-
documentAccessor,
|
|
5162
|
-
queryFactory,
|
|
5163
|
-
constraintsFactory,
|
|
5164
|
-
dynamicConstraints,
|
|
5165
|
-
totalSnapshotsLimit,
|
|
5166
|
-
limitPerCheckpoint,
|
|
5167
|
-
handleRepeatCursor,
|
|
5168
|
-
filterCheckpointSnapshots,
|
|
5169
|
-
iterateSnapshotPairsBatch: optionalIterateSnapshotPairsBatch
|
|
5170
|
-
} = config;
|
|
5171
|
-
const allDocumentGroups = [];
|
|
5172
|
-
const {
|
|
5173
|
-
totalCheckpoints,
|
|
5174
|
-
totalSnapshotsVisited,
|
|
5175
|
-
totalSnapshotsLimitReached
|
|
5176
|
-
} = yield iterateFirestoreDocumentSnapshotPairBatches({
|
|
5177
|
-
documentAccessor,
|
|
5178
|
-
queryFactory,
|
|
5179
|
-
constraintsFactory,
|
|
5180
|
-
dynamicConstraints,
|
|
5181
|
-
totalSnapshotsLimit,
|
|
5182
|
-
handleRepeatCursor,
|
|
5183
|
-
filterCheckpointSnapshots,
|
|
5184
|
-
limitPerCheckpoint,
|
|
5185
|
-
maxParallelCheckpoints: 1,
|
|
5186
|
-
iterateSnapshotPairsBatch: (snapshotDataPairs, batchIndex) => __awaiter(this, void 0, void 0, function* () {
|
|
5187
|
-
allDocumentGroups.push(snapshotDataPairs);
|
|
5188
|
-
if (optionalIterateSnapshotPairsBatch) {
|
|
5189
|
-
yield optionalIterateSnapshotPairsBatch(snapshotDataPairs, batchIndex);
|
|
5190
|
-
}
|
|
5191
|
-
})
|
|
5192
|
-
});
|
|
5193
|
-
const snapshotPairs = util.flattenArray(allDocumentGroups);
|
|
5194
|
-
return {
|
|
5195
|
-
snapshotPairs,
|
|
5196
|
-
totalCheckpoints,
|
|
5197
|
-
totalSnapshotsVisited,
|
|
5198
|
-
totalSnapshotsLimitReached
|
|
5199
|
-
};
|
|
5200
|
-
});
|
|
5201
|
-
}
|
|
5170
|
+
});
|
|
5202
5171
|
/**
|
|
5203
|
-
* Iterates
|
|
5172
|
+
* Iterates through the results of a Firestore query by each document snapshot.
|
|
5204
5173
|
*
|
|
5205
5174
|
* @param config
|
|
5206
5175
|
* @returns
|
|
5207
5176
|
*/
|
|
5208
|
-
function
|
|
5209
|
-
|
|
5210
|
-
|
|
5211
|
-
|
|
5212
|
-
|
|
5213
|
-
|
|
5214
|
-
|
|
5215
|
-
|
|
5216
|
-
|
|
5217
|
-
|
|
5218
|
-
|
|
5219
|
-
|
|
5220
|
-
|
|
5221
|
-
|
|
5222
|
-
|
|
5223
|
-
|
|
5224
|
-
|
|
5225
|
-
|
|
5226
|
-
|
|
5227
|
-
|
|
5228
|
-
|
|
5229
|
-
|
|
5230
|
-
|
|
5231
|
-
|
|
5232
|
-
|
|
5233
|
-
|
|
5234
|
-
|
|
5235
|
-
|
|
5236
|
-
|
|
5237
|
-
|
|
5238
|
-
|
|
5239
|
-
|
|
5240
|
-
|
|
5241
|
-
|
|
5242
|
-
|
|
5243
|
-
|
|
5244
|
-
|
|
5245
|
-
|
|
5246
|
-
|
|
5247
|
-
|
|
5248
|
-
|
|
5249
|
-
|
|
5250
|
-
|
|
5251
|
-
|
|
5177
|
+
const iterateFirestoreDocumentSnapshotBatches = _async$6(function (config) {
|
|
5178
|
+
const {
|
|
5179
|
+
iterateSnapshotBatch,
|
|
5180
|
+
batchSizeForSnapshots: inputBatchSizeForSnapshots,
|
|
5181
|
+
performTasksConfig,
|
|
5182
|
+
batchSize: inputBatchSize
|
|
5183
|
+
} = config;
|
|
5184
|
+
const batchSize = inputBatchSize === null ? null : inputBatchSize != null ? inputBatchSize : DEFAULT_ITERATE_FIRESTORE_DOCUMENT_SNAPSHOT_BATCHES_BATCH_SIZE;
|
|
5185
|
+
const batchSizeForSnapshots = inputBatchSizeForSnapshots != null ? inputBatchSizeForSnapshots : () => batchSize;
|
|
5186
|
+
return iterateFirestoreDocumentSnapshotCheckpoints(Object.assign({}, config, {
|
|
5187
|
+
iterateCheckpoint: _async$6(function (docSnapshots) {
|
|
5188
|
+
if (docSnapshots.length > 0) {
|
|
5189
|
+
return _await$6(batchSizeForSnapshots(docSnapshots), function (batchSizeForSnapshotsResult) {
|
|
5190
|
+
const batches = batchSizeForSnapshotsResult === null ? [docSnapshots] : util.batch(docSnapshots, batchSizeForSnapshotsResult);
|
|
5191
|
+
let i = 0;
|
|
5192
|
+
return _await$6(util.performAsyncTasks(batches, x => iterateSnapshotBatch(x, i++), Object.assign({
|
|
5193
|
+
sequential: true
|
|
5194
|
+
}, performTasksConfig)), function (performTasksResult) {
|
|
5195
|
+
return performTasksResult.results.map(([snapshots, result], i) => ({
|
|
5196
|
+
snapshots,
|
|
5197
|
+
result,
|
|
5198
|
+
i
|
|
5199
|
+
}));
|
|
5200
|
+
});
|
|
5201
|
+
});
|
|
5202
|
+
} else {
|
|
5203
|
+
return [];
|
|
5204
|
+
}
|
|
5205
|
+
})
|
|
5206
|
+
}));
|
|
5207
|
+
});
|
|
5208
|
+
/**
|
|
5209
|
+
* Creates a IterateFirestoreDocumentSnapshotCheckpointsFilterCheckpointSnapshotsFunction that filters out any repeat documents.
|
|
5210
|
+
*
|
|
5211
|
+
* Repeat documents can occur in cases where the document is updated and the query matches it again for a different reason.
|
|
5212
|
+
*
|
|
5213
|
+
* @param readKeyFunction
|
|
5214
|
+
*/
|
|
5215
|
+
/**
|
|
5216
|
+
* Iterates through the results of a Firestore query by each FirestoreDocumentSnapshotDataPair.
|
|
5217
|
+
*
|
|
5218
|
+
* @param config
|
|
5219
|
+
* @returns
|
|
5220
|
+
*/
|
|
5221
|
+
const iterateFirestoreDocumentSnapshotPairBatches = _async$6(function (config) {
|
|
5222
|
+
const {
|
|
5223
|
+
iterateSnapshotPairsBatch,
|
|
5224
|
+
documentAccessor
|
|
5225
|
+
} = config;
|
|
5226
|
+
const loadPairForSnapshot = firestoreDocumentSnapshotPairsLoaderInstance(documentAccessor);
|
|
5227
|
+
return iterateFirestoreDocumentSnapshotBatches(Object.assign({}, config, {
|
|
5228
|
+
maxParallelCheckpoints: 1,
|
|
5229
|
+
iterateSnapshotBatch: _async$6(function (snapshots, batchIndex) {
|
|
5230
|
+
const pairs = snapshots.map(loadPairForSnapshot);
|
|
5231
|
+
return iterateSnapshotPairsBatch(pairs, batchIndex);
|
|
5232
|
+
})
|
|
5233
|
+
}));
|
|
5234
|
+
});
|
|
5235
|
+
/**
|
|
5236
|
+
* Default batch size for iterateFirestoreDocumentSnapshotBatches().
|
|
5237
|
+
*
|
|
5238
|
+
* 25 documents per batch.
|
|
5239
|
+
*/
|
|
5240
|
+
/**
|
|
5241
|
+
* Iterates through the results of a Firestore query by each document snapshot by itself.
|
|
5242
|
+
*
|
|
5243
|
+
* @param config
|
|
5244
|
+
* @returns
|
|
5245
|
+
*/
|
|
5246
|
+
const iterateFirestoreDocumentSnapshots = _async$6(function (config) {
|
|
5247
|
+
const {
|
|
5248
|
+
iterateSnapshot,
|
|
5249
|
+
performTasksConfig,
|
|
5250
|
+
snapshotsPerformTasksConfig
|
|
5251
|
+
} = config;
|
|
5252
|
+
return iterateFirestoreDocumentSnapshotBatches(Object.assign({}, config, {
|
|
5253
|
+
maxParallelCheckpoints: 1,
|
|
5254
|
+
iterateSnapshotBatch: _async$6(function (docSnapshots) {
|
|
5255
|
+
return util.performAsyncTasks(docSnapshots, iterateSnapshot, Object.assign({
|
|
5256
|
+
sequential: true
|
|
5257
|
+
}, snapshotsPerformTasksConfig != null ? snapshotsPerformTasksConfig : Object.assign({}, performTasksConfig, {
|
|
5258
|
+
nonConcurrentTaskKeyFactory: undefined,
|
|
5259
|
+
beforeRetry: undefined
|
|
5260
|
+
})));
|
|
5261
|
+
})
|
|
5262
|
+
}));
|
|
5263
|
+
});
|
|
5264
|
+
const iterateFirestoreDocumentSnapshotPairs = _async$6(function (config) {
|
|
5265
|
+
const {
|
|
5266
|
+
iterateSnapshotPair,
|
|
5267
|
+
documentAccessor
|
|
5268
|
+
} = config;
|
|
5269
|
+
const loadPairForSnapshot = firestoreDocumentSnapshotPairsLoaderInstance(documentAccessor);
|
|
5270
|
+
return iterateFirestoreDocumentSnapshots(Object.assign({}, config, {
|
|
5271
|
+
iterateSnapshot: _async$6(function (snapshot) {
|
|
5272
|
+
const pair = loadPairForSnapshot(snapshot);
|
|
5273
|
+
return iterateSnapshotPair(pair);
|
|
5274
|
+
})
|
|
5275
|
+
}));
|
|
5276
|
+
});
|
|
5277
|
+
const DEFAULT_ITERATE_FIRESTORE_DOCUMENT_SNAPSHOT_BATCHES_BATCH_SIZE = 25;
|
|
5278
|
+
function filterRepeatCheckpointSnapshots(readKeyFunction = x => x.id) {
|
|
5279
|
+
const allowOnceFilter = util.allowValueOnceFilter(readKeyFunction);
|
|
5280
|
+
return _async$6(function (snapshots) {
|
|
5281
|
+
return snapshots.filter(allowOnceFilter);
|
|
5252
5282
|
});
|
|
5253
5283
|
}
|
|
5284
|
+
function allowDocumentSnapshotWithPathOnceFilter() {
|
|
5285
|
+
return util.allowValueOnceFilter(readFirestoreModelKeyFromDocumentSnapshot);
|
|
5286
|
+
}
|
|
5287
|
+
|
|
5288
|
+
/**
|
|
5289
|
+
* Iterates all documents that match the configuration and puts them into an array.
|
|
5290
|
+
*
|
|
5291
|
+
* @param config
|
|
5292
|
+
* @returns
|
|
5293
|
+
*/
|
|
5294
|
+
|
|
5295
|
+
function _await$5(value, then, direct) {
|
|
5296
|
+
if (direct) {
|
|
5297
|
+
return then ? then(value) : value;
|
|
5298
|
+
}
|
|
5299
|
+
if (!value || !value.then) {
|
|
5300
|
+
value = Promise.resolve(value);
|
|
5301
|
+
}
|
|
5302
|
+
return then ? value.then(then) : value;
|
|
5303
|
+
}
|
|
5304
|
+
function _async$5(f) {
|
|
5305
|
+
return function () {
|
|
5306
|
+
for (var args = [], i = 0; i < arguments.length; i++) {
|
|
5307
|
+
args[i] = arguments[i];
|
|
5308
|
+
}
|
|
5309
|
+
try {
|
|
5310
|
+
return Promise.resolve(f.apply(this, args));
|
|
5311
|
+
} catch (e) {
|
|
5312
|
+
return Promise.reject(e);
|
|
5313
|
+
}
|
|
5314
|
+
};
|
|
5315
|
+
}
|
|
5316
|
+
function _empty$1() {}
|
|
5317
|
+
function _awaitIgnored(value, direct) {
|
|
5318
|
+
if (!direct) {
|
|
5319
|
+
return value && value.then ? value.then(_empty$1) : Promise.resolve();
|
|
5320
|
+
}
|
|
5321
|
+
}
|
|
5322
|
+
function _invokeIgnored$1(body) {
|
|
5323
|
+
var result = body();
|
|
5324
|
+
if (result && result.then) {
|
|
5325
|
+
return result.then(_empty$1);
|
|
5326
|
+
}
|
|
5327
|
+
}
|
|
5328
|
+
function _invoke$1(body, then) {
|
|
5329
|
+
var result = body();
|
|
5330
|
+
if (result && result.then) {
|
|
5331
|
+
return result.then(then);
|
|
5332
|
+
}
|
|
5333
|
+
return then(result);
|
|
5334
|
+
}
|
|
5335
|
+
const loadAllFirestoreDocumentSnapshot = _async$5(function (config) {
|
|
5336
|
+
const {
|
|
5337
|
+
queryFactory,
|
|
5338
|
+
constraintsFactory,
|
|
5339
|
+
dynamicConstraints,
|
|
5340
|
+
totalSnapshotsLimit,
|
|
5341
|
+
limitPerCheckpoint,
|
|
5342
|
+
handleRepeatCursor,
|
|
5343
|
+
filterCheckpointSnapshots,
|
|
5344
|
+
iterateSnapshotsForCheckpoint
|
|
5345
|
+
} = config;
|
|
5346
|
+
const allDocumentGroups = [];
|
|
5347
|
+
return _await$5(iterateFirestoreDocumentSnapshotCheckpoints({
|
|
5348
|
+
queryFactory,
|
|
5349
|
+
constraintsFactory,
|
|
5350
|
+
dynamicConstraints,
|
|
5351
|
+
totalSnapshotsLimit,
|
|
5352
|
+
handleRepeatCursor,
|
|
5353
|
+
filterCheckpointSnapshots,
|
|
5354
|
+
limitPerCheckpoint,
|
|
5355
|
+
maxParallelCheckpoints: 1,
|
|
5356
|
+
iterateCheckpoint: _async$5(function (snapshots, query) {
|
|
5357
|
+
return _invoke$1(function () {
|
|
5358
|
+
if (snapshots.length) {
|
|
5359
|
+
allDocumentGroups.push(snapshots); // add to snapshots array
|
|
5360
|
+
return _invokeIgnored$1(function () {
|
|
5361
|
+
if (iterateSnapshotsForCheckpoint) {
|
|
5362
|
+
return _awaitIgnored(iterateSnapshotsForCheckpoint(snapshots, query));
|
|
5363
|
+
}
|
|
5364
|
+
});
|
|
5365
|
+
}
|
|
5366
|
+
}, function () {
|
|
5367
|
+
return []; // return nothing
|
|
5368
|
+
});
|
|
5369
|
+
})
|
|
5370
|
+
}), function ({
|
|
5371
|
+
totalCheckpoints,
|
|
5372
|
+
totalSnapshotsVisited,
|
|
5373
|
+
totalSnapshotsLimitReached
|
|
5374
|
+
}) {
|
|
5375
|
+
const snapshots = util.flattenArray(allDocumentGroups);
|
|
5376
|
+
return {
|
|
5377
|
+
snapshots,
|
|
5378
|
+
totalCheckpoints,
|
|
5379
|
+
totalSnapshotsVisited,
|
|
5380
|
+
totalSnapshotsLimitReached
|
|
5381
|
+
};
|
|
5382
|
+
});
|
|
5383
|
+
});
|
|
5384
|
+
const loadAllFirestoreDocumentSnapshotPairs = _async$5(function (config) {
|
|
5385
|
+
const {
|
|
5386
|
+
documentAccessor,
|
|
5387
|
+
queryFactory,
|
|
5388
|
+
constraintsFactory,
|
|
5389
|
+
dynamicConstraints,
|
|
5390
|
+
totalSnapshotsLimit,
|
|
5391
|
+
limitPerCheckpoint,
|
|
5392
|
+
handleRepeatCursor,
|
|
5393
|
+
filterCheckpointSnapshots,
|
|
5394
|
+
iterateSnapshotPairsBatch: optionalIterateSnapshotPairsBatch
|
|
5395
|
+
} = config;
|
|
5396
|
+
const allDocumentGroups = [];
|
|
5397
|
+
return _await$5(iterateFirestoreDocumentSnapshotPairBatches({
|
|
5398
|
+
documentAccessor,
|
|
5399
|
+
queryFactory,
|
|
5400
|
+
constraintsFactory,
|
|
5401
|
+
dynamicConstraints,
|
|
5402
|
+
totalSnapshotsLimit,
|
|
5403
|
+
handleRepeatCursor,
|
|
5404
|
+
filterCheckpointSnapshots,
|
|
5405
|
+
limitPerCheckpoint,
|
|
5406
|
+
maxParallelCheckpoints: 1,
|
|
5407
|
+
iterateSnapshotPairsBatch: _async$5(function (snapshotDataPairs, batchIndex) {
|
|
5408
|
+
allDocumentGroups.push(snapshotDataPairs);
|
|
5409
|
+
return _invokeIgnored$1(function () {
|
|
5410
|
+
if (optionalIterateSnapshotPairsBatch) {
|
|
5411
|
+
return _awaitIgnored(optionalIterateSnapshotPairsBatch(snapshotDataPairs, batchIndex));
|
|
5412
|
+
}
|
|
5413
|
+
});
|
|
5414
|
+
})
|
|
5415
|
+
}), function ({
|
|
5416
|
+
totalCheckpoints,
|
|
5417
|
+
totalSnapshotsVisited,
|
|
5418
|
+
totalSnapshotsLimitReached
|
|
5419
|
+
}) {
|
|
5420
|
+
const snapshotPairs = util.flattenArray(allDocumentGroups);
|
|
5421
|
+
return {
|
|
5422
|
+
snapshotPairs,
|
|
5423
|
+
totalCheckpoints,
|
|
5424
|
+
totalSnapshotsVisited,
|
|
5425
|
+
totalSnapshotsLimitReached
|
|
5426
|
+
};
|
|
5427
|
+
});
|
|
5428
|
+
});
|
|
5254
5429
|
|
|
5255
5430
|
const DEFAULT_QUERY_CHANGE_WATCHER_DELAY = 0;
|
|
5256
5431
|
function iterationQueryDocChangeWatcher(config) {
|
|
@@ -5259,14 +5434,14 @@ function iterationQueryDocChangeWatcher(config) {
|
|
|
5259
5434
|
delay: timeUntilActive = DEFAULT_QUERY_CHANGE_WATCHER_DELAY
|
|
5260
5435
|
} = config;
|
|
5261
5436
|
const stream$ = instance.snapshotIteration.firstSuccessfulPageResults$.pipe(rxjs.switchMap(first => {
|
|
5262
|
-
var
|
|
5437
|
+
var _beginCheckingAt$expi;
|
|
5263
5438
|
const {
|
|
5264
5439
|
time,
|
|
5265
5440
|
stream
|
|
5266
5441
|
} = first.value.value;
|
|
5267
5442
|
const beginCheckingAt = date.toExpires(time, timeUntilActive);
|
|
5268
5443
|
// don't start streaming until the given moment.
|
|
5269
|
-
return rxjs.timer((
|
|
5444
|
+
return rxjs.timer((_beginCheckingAt$expi = beginCheckingAt.expiresAt) != null ? _beginCheckingAt$expi : new Date()).pipe(rxjs.switchMap(() => stream().pipe(rxjs.skip(1) // skip the first value, as it should be equivalent to the query results given.
|
|
5270
5445
|
)));
|
|
5271
5446
|
}), rxjs.shareReplay(1));
|
|
5272
5447
|
const event$ = stream$.pipe(rxjs.map(event => {
|
|
@@ -5274,12 +5449,12 @@ function iterationQueryDocChangeWatcher(config) {
|
|
|
5274
5449
|
const results = util.build({
|
|
5275
5450
|
base: util.groupValues(changes, x => x.type),
|
|
5276
5451
|
build: x => {
|
|
5277
|
-
var
|
|
5452
|
+
var _x$added, _x$removed, _x$modified;
|
|
5278
5453
|
x.time = new Date();
|
|
5279
5454
|
x.changes = changes;
|
|
5280
|
-
x.added = (
|
|
5281
|
-
x.removed = (
|
|
5282
|
-
x.modified = (
|
|
5455
|
+
x.added = (_x$added = x.added) != null ? _x$added : [];
|
|
5456
|
+
x.removed = (_x$removed = x.removed) != null ? _x$removed : [];
|
|
5457
|
+
x.modified = (_x$modified = x.modified) != null ? _x$modified : [];
|
|
5283
5458
|
x.type = iterationQueryDocChangeWatcherChangeTypeForGroup(x);
|
|
5284
5459
|
}
|
|
5285
5460
|
});
|
|
@@ -5957,22 +6132,45 @@ $$1({ target: 'Array', proto: true, forced: String(test) === String(test.reverse
|
|
|
5957
6132
|
}
|
|
5958
6133
|
});
|
|
5959
6134
|
|
|
6135
|
+
function _async$4(f) {
|
|
6136
|
+
return function () {
|
|
6137
|
+
for (var args = [], i = 0; i < arguments.length; i++) {
|
|
6138
|
+
args[i] = arguments[i];
|
|
6139
|
+
}
|
|
6140
|
+
try {
|
|
6141
|
+
return Promise.resolve(f.apply(this, args));
|
|
6142
|
+
} catch (e) {
|
|
6143
|
+
return Promise.reject(e);
|
|
6144
|
+
}
|
|
6145
|
+
};
|
|
6146
|
+
}
|
|
6147
|
+
function _await$4(value, then, direct) {
|
|
6148
|
+
if (direct) {
|
|
6149
|
+
return then ? then(value) : value;
|
|
6150
|
+
}
|
|
6151
|
+
if (!value || !value.then) {
|
|
6152
|
+
value = Promise.resolve(value);
|
|
6153
|
+
}
|
|
6154
|
+
return then ? value.then(then) : value;
|
|
6155
|
+
}
|
|
5960
6156
|
function firestoreCollectionQueryFactory(queryFactory, accessorContext) {
|
|
5961
6157
|
const documentLoader = firestoreDocumentLoader(accessorContext);
|
|
5962
6158
|
const documentSnapshotPairsLoader = firestoreQueryDocumentSnapshotPairsLoader(accessorContext);
|
|
5963
6159
|
const wrapQuery = baseQuery => {
|
|
5964
6160
|
return {
|
|
5965
6161
|
baseQuery,
|
|
5966
|
-
countDocs: (
|
|
6162
|
+
countDocs: _async$4(function () {
|
|
5967
6163
|
return baseQuery.countDocs();
|
|
5968
6164
|
}),
|
|
5969
|
-
getFirstDoc:
|
|
5970
|
-
|
|
5971
|
-
|
|
6165
|
+
getFirstDoc: _async$4(function (transaction) {
|
|
6166
|
+
return _await$4(baseQuery.getFirstDoc(transaction), function (result) {
|
|
6167
|
+
return result ? documentLoader([result.ref])[0] : undefined;
|
|
6168
|
+
});
|
|
5972
6169
|
}),
|
|
5973
|
-
getFirstDocSnapshotDataPair:
|
|
5974
|
-
|
|
5975
|
-
|
|
6170
|
+
getFirstDocSnapshotDataPair: _async$4(function (transaction) {
|
|
6171
|
+
return _await$4(baseQuery.getFirstDoc(transaction), function (result) {
|
|
6172
|
+
return result ? documentSnapshotPairsLoader([result])[0] : undefined;
|
|
6173
|
+
});
|
|
5976
6174
|
}),
|
|
5977
6175
|
getDocs: transaction => baseQuery.getDocs(transaction).then(x => documentLoader(documentReferencesFromSnapshot(x), transaction)),
|
|
5978
6176
|
getDocSnapshotDataPairs: transaction => baseQuery.getDocs(transaction).then(x => documentSnapshotPairsLoader(x.docs, transaction)),
|
|
@@ -5988,9 +6186,8 @@ function firestoreCollectionQueryFactory(queryFactory, accessorContext) {
|
|
|
5988
6186
|
|
|
5989
6187
|
const FIRESTORE_COLLECTION_NAME_SEPARATOR = '/';
|
|
5990
6188
|
function firestoreModelIdentity(parentOrModelName, collectionNameOrModelName, inputCollectionName) {
|
|
5991
|
-
var _a, _b;
|
|
5992
6189
|
if (typeof parentOrModelName === 'object') {
|
|
5993
|
-
const collectionName =
|
|
6190
|
+
const collectionName = inputCollectionName != null ? inputCollectionName : collectionNameOrModelName.toLowerCase();
|
|
5994
6191
|
const collectionType = `${parentOrModelName.collectionType}/${collectionName}`;
|
|
5995
6192
|
return {
|
|
5996
6193
|
type: 'nested',
|
|
@@ -6000,7 +6197,7 @@ function firestoreModelIdentity(parentOrModelName, collectionNameOrModelName, in
|
|
|
6000
6197
|
collectionType
|
|
6001
6198
|
};
|
|
6002
6199
|
} else {
|
|
6003
|
-
const collectionName =
|
|
6200
|
+
const collectionName = collectionNameOrModelName != null ? collectionNameOrModelName : parentOrModelName.toLowerCase();
|
|
6004
6201
|
const collectionType = collectionName;
|
|
6005
6202
|
return {
|
|
6006
6203
|
type: 'root',
|
|
@@ -6075,9 +6272,9 @@ function firestoreModelId(input) {
|
|
|
6075
6272
|
* @returns
|
|
6076
6273
|
*/
|
|
6077
6274
|
function firestoreModelIdsFromKey(input) {
|
|
6078
|
-
var
|
|
6275
|
+
var _parts$map;
|
|
6079
6276
|
const parts = firestoreModelKeyPartPairs(input);
|
|
6080
|
-
return (
|
|
6277
|
+
return (_parts$map = parts == null ? void 0 : parts.map(x => x.id)) != null ? _parts$map : [];
|
|
6081
6278
|
}
|
|
6082
6279
|
/**
|
|
6083
6280
|
* Creates a OneWayFlatFirestoreModelKey from the input FirestoreModelKey.
|
|
@@ -6148,6 +6345,14 @@ const FIRESTORE_MODEL_KEY_REGEX_STRICT = /^(?:(?:(?!\.\.?$)(?!.*__.*__)([^\s/]+)
|
|
|
6148
6345
|
function isFirestoreModelKey(input) {
|
|
6149
6346
|
return FIRESTORE_MODEL_KEY_REGEX.test(input);
|
|
6150
6347
|
}
|
|
6348
|
+
/**
|
|
6349
|
+
* Returns true if the input string is a FirestoreModelId.
|
|
6350
|
+
*
|
|
6351
|
+
* @param input
|
|
6352
|
+
*/
|
|
6353
|
+
function isFirestoreModelIdOrKey(input) {
|
|
6354
|
+
return util.stringContains(input, '/') ? FIRESTORE_MODEL_KEY_REGEX.test(input) : FIRESTORE_MODEL_ID_REGEX.test(input);
|
|
6355
|
+
}
|
|
6151
6356
|
/**
|
|
6152
6357
|
* Creates a firestoreModelKeyPart
|
|
6153
6358
|
*
|
|
@@ -6234,8 +6439,8 @@ function firestoreModelKeyCollectionType(input) {
|
|
|
6234
6439
|
return firestoreModelKeyCollectionTypeArrayName(input, FIRESTORE_COLLECTION_NAME_SEPARATOR);
|
|
6235
6440
|
}
|
|
6236
6441
|
function firestoreModelKeyCollectionTypeArrayName(input, separator = FIRESTORE_COLLECTION_NAME_SEPARATOR) {
|
|
6237
|
-
var
|
|
6238
|
-
return (
|
|
6442
|
+
var _firestoreModelKeyCol;
|
|
6443
|
+
return (_firestoreModelKeyCol = firestoreModelKeyCollectionTypeArray(input)) == null ? void 0 : _firestoreModelKeyCol.join(separator);
|
|
6239
6444
|
}
|
|
6240
6445
|
function firestoreIdentityTypeArrayName(input, separator = FIRESTORE_COLLECTION_NAME_SEPARATOR) {
|
|
6241
6446
|
return firestoreIdentityTypeArray(input).join(separator);
|
|
@@ -6257,7 +6462,7 @@ function firestoreModelKeyCollectionTypeArray(input) {
|
|
|
6257
6462
|
const key = readFirestoreModelKey(input);
|
|
6258
6463
|
let array;
|
|
6259
6464
|
if (key) {
|
|
6260
|
-
const pieces = key
|
|
6465
|
+
const pieces = key == null ? void 0 : key.split(FIRESTORE_COLLECTION_NAME_SEPARATOR);
|
|
6261
6466
|
if (util.isOddNumber(pieces.length)) {
|
|
6262
6467
|
throw new Error('input key source was a collection ref or unavailable.');
|
|
6263
6468
|
}
|
|
@@ -6276,8 +6481,8 @@ function firestoreModelKeyCollectionTypeArray(input) {
|
|
|
6276
6481
|
* @returns
|
|
6277
6482
|
*/
|
|
6278
6483
|
function firestoreModelKeyCollectionName(input) {
|
|
6279
|
-
var
|
|
6280
|
-
return (
|
|
6484
|
+
var _firestoreModelKeyTyp;
|
|
6485
|
+
return (_firestoreModelKeyTyp = firestoreModelKeyTypePair(input)) == null ? void 0 : _firestoreModelKeyTyp.collectionName;
|
|
6281
6486
|
}
|
|
6282
6487
|
/**
|
|
6283
6488
|
* Returns the parent model key from up the specified amount of levels.
|
|
@@ -6315,7 +6520,7 @@ function firestoreModelKeyPartPairs(input) {
|
|
|
6315
6520
|
const key = readFirestoreModelKey(input);
|
|
6316
6521
|
let pairs;
|
|
6317
6522
|
if (key) {
|
|
6318
|
-
const pieces = key
|
|
6523
|
+
const pieces = key == null ? void 0 : key.split(FIRESTORE_COLLECTION_NAME_SEPARATOR);
|
|
6319
6524
|
if (util.isOddNumber(pieces.length)) {
|
|
6320
6525
|
throw new Error('input key source was a collection ref or unavailable.');
|
|
6321
6526
|
}
|
|
@@ -6397,13 +6602,13 @@ function makeFirestoreCollection(inputConfig) {
|
|
|
6397
6602
|
const {
|
|
6398
6603
|
query
|
|
6399
6604
|
} = queryFactory;
|
|
6400
|
-
return Object.assign(
|
|
6605
|
+
return Object.assign({
|
|
6401
6606
|
config,
|
|
6402
6607
|
modelIdentity,
|
|
6403
6608
|
collection,
|
|
6404
6609
|
queryLike: collection,
|
|
6405
6610
|
firestoreContext
|
|
6406
|
-
}, documentAccessorExtension
|
|
6611
|
+
}, documentAccessorExtension, {
|
|
6407
6612
|
firestoreIteration,
|
|
6408
6613
|
query,
|
|
6409
6614
|
queryDocument
|
|
@@ -6443,12 +6648,12 @@ function makeFirestoreCollectionGroup(config) {
|
|
|
6443
6648
|
const {
|
|
6444
6649
|
query
|
|
6445
6650
|
} = queryFactory;
|
|
6446
|
-
return Object.assign(
|
|
6651
|
+
return Object.assign({
|
|
6447
6652
|
config,
|
|
6448
6653
|
queryLike,
|
|
6449
6654
|
modelIdentity,
|
|
6450
6655
|
firestoreContext
|
|
6451
|
-
}, documentAccessorExtension
|
|
6656
|
+
}, documentAccessorExtension, {
|
|
6452
6657
|
firestoreIteration,
|
|
6453
6658
|
query,
|
|
6454
6659
|
queryDocument
|
|
@@ -6466,7 +6671,7 @@ function makeFirestoreCollectionGroup(config) {
|
|
|
6466
6671
|
function makeFirestoreCollectionWithParent(config) {
|
|
6467
6672
|
const result = makeFirestoreCollection(config);
|
|
6468
6673
|
result.parent = config.parent;
|
|
6469
|
-
//
|
|
6674
|
+
// TODO: consider throwing an exception if parent is not provided.
|
|
6470
6675
|
return result;
|
|
6471
6676
|
}
|
|
6472
6677
|
|
|
@@ -6489,10 +6694,10 @@ function makeSingleItemFirestoreCollection(config) {
|
|
|
6489
6694
|
function firestoreContextFactory(drivers) {
|
|
6490
6695
|
return firestore => {
|
|
6491
6696
|
const makeFirestoreCollectionConfig = config => {
|
|
6492
|
-
var
|
|
6493
|
-
const queryLike = (
|
|
6494
|
-
return Object.assign(
|
|
6495
|
-
collection: config.converter ? (
|
|
6697
|
+
var _config$collection, _config$collection2;
|
|
6698
|
+
const queryLike = (_config$collection = config.collection) != null ? _config$collection : config.queryLike;
|
|
6699
|
+
return Object.assign({}, config, {
|
|
6700
|
+
collection: config.converter ? (_config$collection2 = config.collection) == null ? void 0 : _config$collection2.withConverter(config.converter) : config.collection,
|
|
6496
6701
|
queryLike: config.converter ? queryLike.withConverter(config.converter) : queryLike,
|
|
6497
6702
|
firestoreContext: context,
|
|
6498
6703
|
firestoreDriverIdentifier: drivers.firestoreDriverIdentifier,
|
|
@@ -6657,6 +6862,27 @@ var addToUnscopables = addToUnscopables$2;
|
|
|
6657
6862
|
// https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
|
|
6658
6863
|
addToUnscopables('flat');
|
|
6659
6864
|
|
|
6865
|
+
function _await$3(value, then, direct) {
|
|
6866
|
+
if (direct) {
|
|
6867
|
+
return then ? then(value) : value;
|
|
6868
|
+
}
|
|
6869
|
+
if (!value || !value.then) {
|
|
6870
|
+
value = Promise.resolve(value);
|
|
6871
|
+
}
|
|
6872
|
+
return then ? value.then(then) : value;
|
|
6873
|
+
}
|
|
6874
|
+
function _async$3(f) {
|
|
6875
|
+
return function () {
|
|
6876
|
+
for (var args = [], i = 0; i < arguments.length; i++) {
|
|
6877
|
+
args[i] = arguments[i];
|
|
6878
|
+
}
|
|
6879
|
+
try {
|
|
6880
|
+
return Promise.resolve(f.apply(this, args));
|
|
6881
|
+
} catch (e) {
|
|
6882
|
+
return Promise.reject(e);
|
|
6883
|
+
}
|
|
6884
|
+
};
|
|
6885
|
+
}
|
|
6660
6886
|
function firestoreIdBatchVerifierFactory(config) {
|
|
6661
6887
|
const {
|
|
6662
6888
|
readKeys
|
|
@@ -6664,12 +6890,13 @@ function firestoreIdBatchVerifierFactory(config) {
|
|
|
6664
6890
|
const fieldToQuery = config.fieldToQuery;
|
|
6665
6891
|
const makeQueryConstraints = config.makeQueryConstraints ? config.makeQueryConstraints : fieldToQuery === '_id' ? ids => whereDocumentId('in', ids) : ids => where(fieldToQuery, 'in', ids);
|
|
6666
6892
|
return collection => {
|
|
6667
|
-
const verify =
|
|
6893
|
+
const verify = _async$3(function (keys) {
|
|
6668
6894
|
const constraints = makeQueryConstraints(keys);
|
|
6669
|
-
|
|
6670
|
-
|
|
6671
|
-
|
|
6672
|
-
|
|
6895
|
+
return _await$3(collection.query(constraints).getDocs(), function (results) {
|
|
6896
|
+
const keysInResults = results.docs.map(x => readKeys(x)).flat();
|
|
6897
|
+
const unusedKeys = util.unique(keys, keysInResults);
|
|
6898
|
+
return unusedKeys;
|
|
6899
|
+
});
|
|
6673
6900
|
});
|
|
6674
6901
|
const verifier = {
|
|
6675
6902
|
maxBatchSize: FIRESTORE_MAX_WHERE_IN_FILTER_ARGS_COUNT,
|
|
@@ -6700,13 +6927,14 @@ function createWithAccessor(accessor) {
|
|
|
6700
6927
|
*/
|
|
6701
6928
|
function firestoreClientIncrementUpdateToUpdateData(input) {
|
|
6702
6929
|
return util.mapObjectMap(input, incrementValue => {
|
|
6703
|
-
return firestore.increment(incrementValue
|
|
6930
|
+
return firestore.increment(incrementValue != null ? incrementValue : 0);
|
|
6704
6931
|
});
|
|
6705
6932
|
}
|
|
6706
6933
|
|
|
6707
6934
|
// MARK: Accessor
|
|
6708
6935
|
class DefaultFirestoreDocumentDataAccessor {
|
|
6709
6936
|
constructor(documentRef) {
|
|
6937
|
+
this.documentRef = void 0;
|
|
6710
6938
|
this.documentRef = documentRef;
|
|
6711
6939
|
}
|
|
6712
6940
|
stream() {
|
|
@@ -6762,6 +6990,7 @@ function defaultFirestoreDocumentContext() {
|
|
|
6762
6990
|
class WriteBatchFirestoreDocumentDataAccessor extends DefaultFirestoreDocumentDataAccessor {
|
|
6763
6991
|
constructor(batch, documentRef) {
|
|
6764
6992
|
super(documentRef);
|
|
6993
|
+
this.batch = void 0;
|
|
6765
6994
|
this.batch = batch;
|
|
6766
6995
|
}
|
|
6767
6996
|
delete() {
|
|
@@ -6792,8 +7021,10 @@ function writeBatchAccessorFactory(writeBatch) {
|
|
|
6792
7021
|
// MARK: Context
|
|
6793
7022
|
class WriteBatchFirestoreDocumentContext {
|
|
6794
7023
|
constructor(batch) {
|
|
6795
|
-
this.batch =
|
|
7024
|
+
this.batch = void 0;
|
|
6796
7025
|
this.contextType = exports.FirestoreDocumentContextType.BATCH;
|
|
7026
|
+
this.accessorFactory = void 0;
|
|
7027
|
+
this.batch = batch;
|
|
6797
7028
|
this.accessorFactory = writeBatchAccessorFactory(this.batch);
|
|
6798
7029
|
}
|
|
6799
7030
|
}
|
|
@@ -6807,6 +7038,8 @@ function writeBatchDocumentContext(batch) {
|
|
|
6807
7038
|
*/
|
|
6808
7039
|
class TransactionFirestoreDocumentDataAccessor {
|
|
6809
7040
|
constructor(transaction, documentRef) {
|
|
7041
|
+
this.transaction = void 0;
|
|
7042
|
+
this.documentRef = void 0;
|
|
6810
7043
|
this.transaction = transaction;
|
|
6811
7044
|
this.documentRef = documentRef;
|
|
6812
7045
|
}
|
|
@@ -6857,8 +7090,10 @@ function transactionAccessorFactory(transaction) {
|
|
|
6857
7090
|
// MARK: Context
|
|
6858
7091
|
class TransactionFirestoreDocumentContext {
|
|
6859
7092
|
constructor(transaction) {
|
|
6860
|
-
this.transaction =
|
|
7093
|
+
this.transaction = void 0;
|
|
6861
7094
|
this.contextType = exports.FirestoreDocumentContextType.TRANSACTION;
|
|
7095
|
+
this.accessorFactory = void 0;
|
|
7096
|
+
this.transaction = transaction;
|
|
6862
7097
|
this.accessorFactory = transactionAccessorFactory(this.transaction);
|
|
6863
7098
|
}
|
|
6864
7099
|
}
|
|
@@ -6866,6 +7101,18 @@ function transactionDocumentContext(transaction) {
|
|
|
6866
7101
|
return new TransactionFirestoreDocumentContext(transaction);
|
|
6867
7102
|
}
|
|
6868
7103
|
|
|
7104
|
+
function _async$2(f) {
|
|
7105
|
+
return function () {
|
|
7106
|
+
for (var args = [], i = 0; i < arguments.length; i++) {
|
|
7107
|
+
args[i] = arguments[i];
|
|
7108
|
+
}
|
|
7109
|
+
try {
|
|
7110
|
+
return Promise.resolve(f.apply(this, args));
|
|
7111
|
+
} catch (e) {
|
|
7112
|
+
return Promise.reject(e);
|
|
7113
|
+
}
|
|
7114
|
+
};
|
|
7115
|
+
}
|
|
6869
7116
|
function firestoreClientAccessorDriver() {
|
|
6870
7117
|
return {
|
|
6871
7118
|
doc: firestore.doc,
|
|
@@ -6873,8 +7120,8 @@ function firestoreClientAccessorDriver() {
|
|
|
6873
7120
|
collectionGroup: firestore.collectionGroup,
|
|
6874
7121
|
collection: firestore.collection,
|
|
6875
7122
|
subcollection: firestore.collection,
|
|
6876
|
-
transactionFactoryForFirestore: firestore$1 =>
|
|
6877
|
-
return
|
|
7123
|
+
transactionFactoryForFirestore: firestore$1 => _async$2(function (fn) {
|
|
7124
|
+
return firestore.runTransaction(firestore$1, fn);
|
|
6878
7125
|
}),
|
|
6879
7126
|
writeBatchFactoryForFirestore: firestore$1 => () => firestore.writeBatch(firestore$1),
|
|
6880
7127
|
defaultContextFactory: defaultFirestoreDocumentContext,
|
|
@@ -6919,7 +7166,7 @@ function firebaseFirestoreQueryConstraintFunctionsDriver() {
|
|
|
6919
7166
|
});
|
|
6920
7167
|
}
|
|
6921
7168
|
function firebaseFirestoreQueryDriver() {
|
|
6922
|
-
return Object.assign(
|
|
7169
|
+
return Object.assign({}, firebaseFirestoreQueryConstraintFunctionsDriver(), {
|
|
6923
7170
|
countDocs(query) {
|
|
6924
7171
|
return firestore.getCountFromServer(query).then(x => x.data().count);
|
|
6925
7172
|
},
|
|
@@ -6962,6 +7209,7 @@ class FirebaseServerError extends util.ServerErrorResponse {
|
|
|
6962
7209
|
}
|
|
6963
7210
|
constructor(firebaseError, serverError) {
|
|
6964
7211
|
super(serverError);
|
|
7212
|
+
this.firebaseError = void 0;
|
|
6965
7213
|
this.firebaseError = firebaseError;
|
|
6966
7214
|
}
|
|
6967
7215
|
get _error() {
|
|
@@ -6969,27 +7217,62 @@ class FirebaseServerError extends util.ServerErrorResponse {
|
|
|
6969
7217
|
}
|
|
6970
7218
|
}
|
|
6971
7219
|
|
|
7220
|
+
function _await$2(value, then, direct) {
|
|
7221
|
+
if (direct) {
|
|
7222
|
+
return then ? then(value) : value;
|
|
7223
|
+
}
|
|
7224
|
+
if (!value || !value.then) {
|
|
7225
|
+
value = Promise.resolve(value);
|
|
7226
|
+
}
|
|
7227
|
+
return then ? value.then(then) : value;
|
|
7228
|
+
}
|
|
7229
|
+
function _catch(body, recover) {
|
|
7230
|
+
try {
|
|
7231
|
+
var result = body();
|
|
7232
|
+
} catch (e) {
|
|
7233
|
+
return recover(e);
|
|
7234
|
+
}
|
|
7235
|
+
if (result && result.then) {
|
|
7236
|
+
return result.then(void 0, recover);
|
|
7237
|
+
}
|
|
7238
|
+
return result;
|
|
7239
|
+
}
|
|
7240
|
+
function _async$1(f) {
|
|
7241
|
+
return function () {
|
|
7242
|
+
for (var args = [], i = 0; i < arguments.length; i++) {
|
|
7243
|
+
args[i] = arguments[i];
|
|
7244
|
+
}
|
|
7245
|
+
try {
|
|
7246
|
+
return Promise.resolve(f.apply(this, args));
|
|
7247
|
+
} catch (e) {
|
|
7248
|
+
return Promise.reject(e);
|
|
7249
|
+
}
|
|
7250
|
+
};
|
|
7251
|
+
}
|
|
6972
7252
|
function mapHttpsCallable(callable, wrap, directData = false) {
|
|
6973
7253
|
const {
|
|
6974
7254
|
mapInput = x => x,
|
|
6975
7255
|
mapOutput = x => x
|
|
6976
7256
|
} = wrap;
|
|
6977
|
-
return
|
|
6978
|
-
|
|
6979
|
-
|
|
6980
|
-
|
|
6981
|
-
|
|
6982
|
-
|
|
6983
|
-
|
|
6984
|
-
|
|
6985
|
-
|
|
6986
|
-
|
|
6987
|
-
|
|
7257
|
+
return _async$1(function (inputData) {
|
|
7258
|
+
return _await$2(mapInput(inputData), function (data) {
|
|
7259
|
+
return _catch(function () {
|
|
7260
|
+
return _await$2(callable(data), function (result) {
|
|
7261
|
+
const resultData = result.data;
|
|
7262
|
+
return _await$2(mapOutput(resultData), function (mappedResultData) {
|
|
7263
|
+
if (directData) {
|
|
7264
|
+
return mappedResultData;
|
|
7265
|
+
} else {
|
|
7266
|
+
return Object.assign({}, result, {
|
|
7267
|
+
data: mappedResultData
|
|
7268
|
+
});
|
|
7269
|
+
}
|
|
7270
|
+
});
|
|
6988
7271
|
});
|
|
6989
|
-
}
|
|
6990
|
-
|
|
6991
|
-
|
|
6992
|
-
}
|
|
7272
|
+
}, function (e) {
|
|
7273
|
+
throw convertHttpsCallableErrorToReadableError(e);
|
|
7274
|
+
});
|
|
7275
|
+
});
|
|
6993
7276
|
});
|
|
6994
7277
|
}
|
|
6995
7278
|
function directDataHttpsCallable(callable) {
|
|
@@ -7062,6 +7345,20 @@ function onCallTypedModelParamsFunction(call) {
|
|
|
7062
7345
|
return result;
|
|
7063
7346
|
};
|
|
7064
7347
|
}
|
|
7348
|
+
/**
|
|
7349
|
+
* Creates OnCallTypedModelParams for the input.
|
|
7350
|
+
*
|
|
7351
|
+
* Convenience function for calling onCallTypedModelParamsFunction and executing it with the input.
|
|
7352
|
+
*
|
|
7353
|
+
* @deprecated Move towards using onCallTypedModelParamsFunction directly with the call type instead of using this function. Will not be removed in the future.
|
|
7354
|
+
*
|
|
7355
|
+
* @param modelType
|
|
7356
|
+
* @param data
|
|
7357
|
+
* @returns
|
|
7358
|
+
*/
|
|
7359
|
+
function onCallTypedModelParams(modelTypeInput, data, specifier, call) {
|
|
7360
|
+
return onCallTypedModelParamsFunction(call)(modelTypeInput, data, specifier);
|
|
7361
|
+
}
|
|
7065
7362
|
/**
|
|
7066
7363
|
* Pre-configured OnCallTypedModelParamsFunctions for 'create'
|
|
7067
7364
|
*/
|
|
@@ -7078,18 +7375,6 @@ const onCallUpdateModelParams = onCallTypedModelParamsFunction('update');
|
|
|
7078
7375
|
* Pre-configured OnCallTypedModelParamsFunctions for 'delete'
|
|
7079
7376
|
*/
|
|
7080
7377
|
const onCallDeleteModelParams = onCallTypedModelParamsFunction('delete');
|
|
7081
|
-
/**
|
|
7082
|
-
* Creates a OnCallTypedModelParams
|
|
7083
|
-
*
|
|
7084
|
-
* @deprecated use onCallTypedModelParamsFunction instead.
|
|
7085
|
-
*
|
|
7086
|
-
* @param modelType
|
|
7087
|
-
* @param data
|
|
7088
|
-
* @returns
|
|
7089
|
-
*/
|
|
7090
|
-
function onCallTypedModelParams(modelTypeInput, data, specifier, call) {
|
|
7091
|
-
return onCallTypedModelParamsFunction(call)(modelTypeInput, data, specifier);
|
|
7092
|
-
}
|
|
7093
7378
|
/**
|
|
7094
7379
|
* Key used on the front-end and backend that refers to the call function.
|
|
7095
7380
|
*/
|
|
@@ -7102,31 +7387,6 @@ function onCallCreateModelResult(modelKeys) {
|
|
|
7102
7387
|
modelKeys: util.asArray(modelKeys)
|
|
7103
7388
|
};
|
|
7104
7389
|
}
|
|
7105
|
-
// MARK: Compat
|
|
7106
|
-
/**
|
|
7107
|
-
* Key used on the front-end and backend that refers to a specific function for creating models.
|
|
7108
|
-
*
|
|
7109
|
-
* @deprecated Replaced by the callModel function.
|
|
7110
|
-
*/
|
|
7111
|
-
const CREATE_MODEL_APP_FUNCTION_KEY = 'createModel';
|
|
7112
|
-
/**
|
|
7113
|
-
* Key used on the front-end and backend that refers to a specific function for reading models.
|
|
7114
|
-
*
|
|
7115
|
-
* @deprecated Replaced by the callModel function.
|
|
7116
|
-
*/
|
|
7117
|
-
const READ_MODEL_APP_FUNCTION_KEY = 'readModel';
|
|
7118
|
-
/**
|
|
7119
|
-
* Key used on the front-end and backend that refers to a specific function for updating models.
|
|
7120
|
-
*
|
|
7121
|
-
* @deprecated Replaced by the callModel function.
|
|
7122
|
-
*/
|
|
7123
|
-
const UPDATE_MODEL_APP_FUNCTION_KEY = 'updateModel';
|
|
7124
|
-
/**
|
|
7125
|
-
* Key used on the front-end and backend that refers to a specific function for deleting models.
|
|
7126
|
-
*
|
|
7127
|
-
* @deprecated Replaced by the callModel function.
|
|
7128
|
-
*/
|
|
7129
|
-
const DELETE_MODEL_APP_FUNCTION_KEY = 'deleteModel';
|
|
7130
7390
|
|
|
7131
7391
|
const MODEL_FUNCTION_FIREBASE_CRUD_FUNCTION_SPECIFIER_DEFAULT = '_';
|
|
7132
7392
|
const MODEL_FUNCTION_FIREBASE_CRUD_FUNCTION_SPECIFIER_SPLITTER = ',';
|
|
@@ -7144,7 +7404,7 @@ function callModelFirebaseFunctionMapFactory(configMap, crudConfigMap) {
|
|
|
7144
7404
|
const _callFn = util.cachedGetter(() => functions.httpsCallable(functionsInstance, CALL_MODEL_APP_FUNCTION_KEY));
|
|
7145
7405
|
function makeCallFunction(call, fn, modelType, specifier) {
|
|
7146
7406
|
return mapHttpsCallable(fn(), {
|
|
7147
|
-
mapInput: data =>
|
|
7407
|
+
mapInput: data => onCallTypedModelParamsFunction(call)(modelType, data, specifier)
|
|
7148
7408
|
}, true);
|
|
7149
7409
|
}
|
|
7150
7410
|
function makeCallSpecifiers(call, fn, modelType, specifierKeys) {
|
|
@@ -7213,94 +7473,6 @@ function callModelFirebaseFunctionMapFactory(configMap, crudConfigMap) {
|
|
|
7213
7473
|
return result;
|
|
7214
7474
|
};
|
|
7215
7475
|
}
|
|
7216
|
-
// MARK: Compat
|
|
7217
|
-
/**
|
|
7218
|
-
* @deprecated move to using callModelFirebaseFunctionMapFactory instead and the call configuration in general.
|
|
7219
|
-
*
|
|
7220
|
-
* This will be removed in the next release.
|
|
7221
|
-
*
|
|
7222
|
-
* @param configMap
|
|
7223
|
-
* @param crudConfigMap
|
|
7224
|
-
* @returns
|
|
7225
|
-
*/
|
|
7226
|
-
function modelFirebaseFunctionMapFactory(configMap, crudConfigMap) {
|
|
7227
|
-
const functionFactory = firebaseFunctionMapFactory(configMap);
|
|
7228
|
-
return functionsInstance => {
|
|
7229
|
-
const functionMap = functionFactory(functionsInstance);
|
|
7230
|
-
const _readFn = util.cachedGetter(() => functions.httpsCallable(functionsInstance, READ_MODEL_APP_FUNCTION_KEY));
|
|
7231
|
-
const _createFn = util.cachedGetter(() => functions.httpsCallable(functionsInstance, CREATE_MODEL_APP_FUNCTION_KEY));
|
|
7232
|
-
const _updateFn = util.cachedGetter(() => functions.httpsCallable(functionsInstance, UPDATE_MODEL_APP_FUNCTION_KEY));
|
|
7233
|
-
const _deleteFn = util.cachedGetter(() => functions.httpsCallable(functionsInstance, DELETE_MODEL_APP_FUNCTION_KEY));
|
|
7234
|
-
function makeCrudFunction(fn, modelType, specifier) {
|
|
7235
|
-
return mapHttpsCallable(fn(), {
|
|
7236
|
-
mapInput: data => onCallTypedModelParams(modelType, data, specifier)
|
|
7237
|
-
}, true);
|
|
7238
|
-
}
|
|
7239
|
-
function makeCrudSpecifiers(crud, fn, modelType, specifierKeys) {
|
|
7240
|
-
const modelTypeSuffix = util.capitalizeFirstLetter(modelType);
|
|
7241
|
-
const specifiers = {};
|
|
7242
|
-
specifierKeys.forEach(inputSpecifier => {
|
|
7243
|
-
const specifier = inputSpecifier === MODEL_FUNCTION_FIREBASE_CRUD_FUNCTION_SPECIFIER_DEFAULT ? '' : inputSpecifier;
|
|
7244
|
-
const specifierFn = makeCrudFunction(fn, modelType, inputSpecifier);
|
|
7245
|
-
const fullSpecifierName = `${crud}${modelTypeSuffix}${util.capitalizeFirstLetter(specifier)}`;
|
|
7246
|
-
specifiers[fullSpecifierName] = specifierFn;
|
|
7247
|
-
const shortSpecifierName = util.lowercaseFirstLetter(specifier) || crud;
|
|
7248
|
-
specifiers[shortSpecifierName] = specifierFn;
|
|
7249
|
-
});
|
|
7250
|
-
return specifiers;
|
|
7251
|
-
}
|
|
7252
|
-
const result = util.build({
|
|
7253
|
-
base: functionMap,
|
|
7254
|
-
build: x => {
|
|
7255
|
-
Object.entries(crudConfigMap).forEach(([modelType, config]) => {
|
|
7256
|
-
const modelTypeSuffix = util.capitalizeFirstLetter(modelType);
|
|
7257
|
-
const {
|
|
7258
|
-
included: crudFunctionKeys,
|
|
7259
|
-
excluded: specifiedCrudFunctionKeys
|
|
7260
|
-
} = util.separateValues(config, x => x.indexOf(':') === -1);
|
|
7261
|
-
const crudFunctions = new Set(crudFunctionKeys);
|
|
7262
|
-
const specifiedCrudFunctionTuples = specifiedCrudFunctionKeys.map(x => {
|
|
7263
|
-
const [crud, functionsSplit] = x.split(':', 2);
|
|
7264
|
-
const functions = functionsSplit.split(MODEL_FUNCTION_FIREBASE_CRUD_FUNCTION_SPECIFIER_SPLITTER);
|
|
7265
|
-
return [crud, functions];
|
|
7266
|
-
});
|
|
7267
|
-
// check that there isn't a repeat crud key configured, which disallowed configuration and would cause some functions to be ignored
|
|
7268
|
-
const encounteredCruds = new Set();
|
|
7269
|
-
function assertCrudKeyNotEncountered(crud) {
|
|
7270
|
-
if (encounteredCruds.has(crud)) {
|
|
7271
|
-
throw new Error(`Cannot have multiple declarations of the same crud. Found repeat for crud: ${crud}`);
|
|
7272
|
-
} else {
|
|
7273
|
-
encounteredCruds.add(crud);
|
|
7274
|
-
}
|
|
7275
|
-
}
|
|
7276
|
-
crudFunctions.forEach(assertCrudKeyNotEncountered);
|
|
7277
|
-
specifiedCrudFunctionTuples.forEach(([crud]) => assertCrudKeyNotEncountered(crud));
|
|
7278
|
-
// build and add the functions
|
|
7279
|
-
const specifierFunctions = new Map(specifiedCrudFunctionTuples);
|
|
7280
|
-
function addFunctions(crud, fn, modelType) {
|
|
7281
|
-
let crudFns;
|
|
7282
|
-
if (crudFunctions.has(crud)) {
|
|
7283
|
-
crudFns = makeCrudFunction(fn, modelType);
|
|
7284
|
-
} else if (specifierFunctions.has(crud)) {
|
|
7285
|
-
crudFns = makeCrudSpecifiers(crud, fn, modelType, specifierFunctions.get(crud));
|
|
7286
|
-
}
|
|
7287
|
-
if (crudFns) {
|
|
7288
|
-
modelTypeCruds[`${crud}${modelTypeSuffix}`] = crudFns;
|
|
7289
|
-
}
|
|
7290
|
-
}
|
|
7291
|
-
const modelTypeCruds = {};
|
|
7292
|
-
addFunctions('create', _createFn, modelType);
|
|
7293
|
-
addFunctions('read', _readFn, modelType);
|
|
7294
|
-
addFunctions('update', _updateFn, modelType);
|
|
7295
|
-
addFunctions('delete', _deleteFn, modelType);
|
|
7296
|
-
// tslint:disable-next-line
|
|
7297
|
-
x[modelType] = modelTypeCruds;
|
|
7298
|
-
});
|
|
7299
|
-
}
|
|
7300
|
-
});
|
|
7301
|
-
return result;
|
|
7302
|
-
};
|
|
7303
|
-
}
|
|
7304
7476
|
|
|
7305
7477
|
/**
|
|
7306
7478
|
* Creates an OnCallDevelopmentParams
|
|
@@ -7422,8 +7594,8 @@ const FIREBASE_SERVER_AUTH_CLAIMS_RESET_LAST_COM_DATE_KEY = 'resetCommunicationA
|
|
|
7422
7594
|
|
|
7423
7595
|
const useContextAuth = util.mappedUseFunction(x => x.auth);
|
|
7424
7596
|
const useContextAuthUid = util.mappedUseFunction(x => {
|
|
7425
|
-
var
|
|
7426
|
-
return (
|
|
7597
|
+
var _x$auth;
|
|
7598
|
+
return (_x$auth = x.auth) == null ? void 0 : _x$auth.uid;
|
|
7427
7599
|
});
|
|
7428
7600
|
|
|
7429
7601
|
const FIREBASE_AUTH_USER_NOT_FOUND_ERROR = 'auth/user-not-found';
|
|
@@ -7463,15 +7635,58 @@ function firebaseAuthErrorToReadableError(inputError) {
|
|
|
7463
7635
|
return error;
|
|
7464
7636
|
}
|
|
7465
7637
|
|
|
7638
|
+
/******************************************************************************
|
|
7639
|
+
Copyright (c) Microsoft Corporation.
|
|
7640
|
+
|
|
7641
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
7642
|
+
purpose with or without fee is hereby granted.
|
|
7643
|
+
|
|
7644
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
7645
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
7646
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
7647
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
7648
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
7649
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
7650
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
7651
|
+
***************************************************************************** */
|
|
7652
|
+
|
|
7653
|
+
function __decorate(decorators, target, key, desc) {
|
|
7654
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
7655
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
7656
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
7657
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7658
|
+
}
|
|
7659
|
+
|
|
7660
|
+
function __metadata(metadataKey, metadataValue) {
|
|
7661
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
|
|
7662
|
+
}
|
|
7663
|
+
|
|
7664
|
+
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
7665
|
+
var e = new Error(message);
|
|
7666
|
+
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
7667
|
+
};
|
|
7668
|
+
|
|
7466
7669
|
exports.ScheduledFunctionDevelopmentFunctionTypeEnum = void 0;
|
|
7467
7670
|
(function (ScheduledFunctionDevelopmentFunctionTypeEnum) {
|
|
7468
7671
|
ScheduledFunctionDevelopmentFunctionTypeEnum["LIST"] = "list";
|
|
7469
7672
|
ScheduledFunctionDevelopmentFunctionTypeEnum["RUN"] = "run";
|
|
7470
7673
|
})(exports.ScheduledFunctionDevelopmentFunctionTypeEnum || (exports.ScheduledFunctionDevelopmentFunctionTypeEnum = {}));
|
|
7471
|
-
class ScheduledFunctionDevelopmentFirebaseFunctionParams {
|
|
7674
|
+
class ScheduledFunctionDevelopmentFirebaseFunctionParams {
|
|
7675
|
+
constructor() {
|
|
7676
|
+
this.type = void 0;
|
|
7677
|
+
/**
|
|
7678
|
+
* Name of function to run.
|
|
7679
|
+
*/
|
|
7680
|
+
this.run = void 0;
|
|
7681
|
+
}
|
|
7682
|
+
}
|
|
7472
7683
|
__decorate([classTransformer.Expose(), classValidator.IsEnum(exports.ScheduledFunctionDevelopmentFunctionTypeEnum), __metadata("design:type", String)], ScheduledFunctionDevelopmentFirebaseFunctionParams.prototype, "type", void 0);
|
|
7473
7684
|
__decorate([classTransformer.Expose(), classValidator.IsString(), classValidator.IsOptional(), __metadata("design:type", String)], ScheduledFunctionDevelopmentFirebaseFunctionParams.prototype, "run", void 0);
|
|
7474
|
-
class ScheduledFunctionDevelopmentFirebaseFunctionListEntry {
|
|
7685
|
+
class ScheduledFunctionDevelopmentFirebaseFunctionListEntry {
|
|
7686
|
+
constructor() {
|
|
7687
|
+
this.name = void 0;
|
|
7688
|
+
}
|
|
7689
|
+
}
|
|
7475
7690
|
/**
|
|
7476
7691
|
* Key used on the front-end and backend that refers to the specifier for the scheduled functions access.
|
|
7477
7692
|
*/
|
|
@@ -7505,7 +7720,7 @@ function IsFirestoreModelKey(validationOptions) {
|
|
|
7505
7720
|
options: validationOptions,
|
|
7506
7721
|
validator: {
|
|
7507
7722
|
validate: isFirestoreModelKey,
|
|
7508
|
-
defaultMessage: classValidator.buildMessage((eachPrefix, args) => eachPrefix + `$property value of "${args
|
|
7723
|
+
defaultMessage: classValidator.buildMessage((eachPrefix, args) => eachPrefix + `$property value of "${args == null ? void 0 : args.value}" is not a FirestoreModelKey.`, validationOptions)
|
|
7509
7724
|
}
|
|
7510
7725
|
});
|
|
7511
7726
|
};
|
|
@@ -7522,7 +7737,24 @@ function IsFirestoreModelId(validationOptions) {
|
|
|
7522
7737
|
options: validationOptions,
|
|
7523
7738
|
validator: {
|
|
7524
7739
|
validate: isFirestoreModelId,
|
|
7525
|
-
defaultMessage: classValidator.buildMessage((eachPrefix, args) => eachPrefix + `$property value of "${args
|
|
7740
|
+
defaultMessage: classValidator.buildMessage((eachPrefix, args) => eachPrefix + `$property value of "${args == null ? void 0 : args.value}" is not a FirestoreModelId.`, validationOptions)
|
|
7741
|
+
}
|
|
7742
|
+
});
|
|
7743
|
+
};
|
|
7744
|
+
}
|
|
7745
|
+
/**
|
|
7746
|
+
* isFirestoreModelIdOrKey validator
|
|
7747
|
+
*/
|
|
7748
|
+
function IsFirestoreModelIdOrKey(validationOptions) {
|
|
7749
|
+
return function (object, propertyName) {
|
|
7750
|
+
classValidator.registerDecorator({
|
|
7751
|
+
name: 'isFirestoreModelIdOrKey',
|
|
7752
|
+
target: object.constructor,
|
|
7753
|
+
propertyName: propertyName,
|
|
7754
|
+
options: validationOptions,
|
|
7755
|
+
validator: {
|
|
7756
|
+
validate: isFirestoreModelIdOrKey,
|
|
7757
|
+
defaultMessage: classValidator.buildMessage((eachPrefix, args) => eachPrefix + `$property value of "${args == null ? void 0 : args.value}" is not a FirestoreModelId or FirestoreModelKey.`, validationOptions)
|
|
7526
7758
|
}
|
|
7527
7759
|
});
|
|
7528
7760
|
};
|
|
@@ -7531,40 +7763,79 @@ function IsFirestoreModelId(validationOptions) {
|
|
|
7531
7763
|
/**
|
|
7532
7764
|
* Simple annotated params that implements FirestoreModelKeyRef.
|
|
7533
7765
|
*/
|
|
7534
|
-
class TargetModelParams {
|
|
7766
|
+
class TargetModelParams {
|
|
7767
|
+
constructor() {
|
|
7768
|
+
this.key = void 0;
|
|
7769
|
+
}
|
|
7770
|
+
}
|
|
7535
7771
|
__decorate([classTransformer.Expose(), classValidator.IsNotEmpty(), IsFirestoreModelKey(), __metadata("design:type", String)], TargetModelParams.prototype, "key", void 0);
|
|
7536
|
-
class InferredTargetModelParams {
|
|
7772
|
+
class InferredTargetModelParams {
|
|
7773
|
+
constructor() {
|
|
7774
|
+
this.key = void 0;
|
|
7775
|
+
}
|
|
7776
|
+
}
|
|
7537
7777
|
__decorate([classTransformer.Expose(), classValidator.IsOptional(), classValidator.IsNotEmpty(), IsFirestoreModelKey(), __metadata("design:type", String)], InferredTargetModelParams.prototype, "key", void 0);
|
|
7538
7778
|
/**
|
|
7539
7779
|
* Simple annotated params that implements FirestoreModelKeyRef but key is a FirestoreModelId.
|
|
7540
7780
|
*/
|
|
7541
|
-
class TargetModelIdParams {
|
|
7781
|
+
class TargetModelIdParams {
|
|
7782
|
+
constructor() {
|
|
7783
|
+
this.key = void 0;
|
|
7784
|
+
}
|
|
7785
|
+
}
|
|
7542
7786
|
__decorate([classTransformer.Expose(), classValidator.IsNotEmpty(), IsFirestoreModelId(), __metadata("design:type", String)], TargetModelIdParams.prototype, "key", void 0);
|
|
7543
|
-
class InferredTargetModelIdParams {
|
|
7787
|
+
class InferredTargetModelIdParams {
|
|
7788
|
+
constructor() {
|
|
7789
|
+
this.key = void 0;
|
|
7790
|
+
}
|
|
7791
|
+
}
|
|
7544
7792
|
__decorate([classTransformer.Expose(), classValidator.IsOptional(), classValidator.IsNotEmpty(), IsFirestoreModelId(), __metadata("design:type", String)], InferredTargetModelIdParams.prototype, "key", void 0);
|
|
7545
7793
|
|
|
7546
7794
|
/**
|
|
7547
7795
|
* Abstract AbstractModelPermissionService implementation for FirebaseModelsPermissionService.
|
|
7548
7796
|
*/
|
|
7797
|
+
|
|
7798
|
+
function _await$1(value, then, direct) {
|
|
7799
|
+
if (direct) {
|
|
7800
|
+
return then ? then(value) : value;
|
|
7801
|
+
}
|
|
7802
|
+
if (!value || !value.then) {
|
|
7803
|
+
value = Promise.resolve(value);
|
|
7804
|
+
}
|
|
7805
|
+
return then ? value.then(then) : value;
|
|
7806
|
+
}
|
|
7807
|
+
function _call(body, then, direct) {
|
|
7808
|
+
if (direct) {
|
|
7809
|
+
return then ? then(body()) : body();
|
|
7810
|
+
}
|
|
7811
|
+
try {
|
|
7812
|
+
var result = Promise.resolve(body());
|
|
7813
|
+
return then ? result.then(then) : result;
|
|
7814
|
+
} catch (e) {
|
|
7815
|
+
return Promise.reject(e);
|
|
7816
|
+
}
|
|
7817
|
+
}
|
|
7549
7818
|
class FirebaseModelPermissionServiceInstance extends model.AbstractModelPermissionService {
|
|
7550
7819
|
constructor(delegate) {
|
|
7551
7820
|
super(delegate);
|
|
7821
|
+
this.delegate = void 0;
|
|
7552
7822
|
this.delegate = delegate;
|
|
7553
7823
|
}
|
|
7554
7824
|
roleMapForModel(output, context, model) {
|
|
7555
7825
|
return this.delegate.roleMapForModel(output, context, model);
|
|
7556
7826
|
}
|
|
7557
7827
|
outputForModel(document) {
|
|
7558
|
-
return
|
|
7559
|
-
|
|
7560
|
-
|
|
7561
|
-
|
|
7562
|
-
|
|
7563
|
-
|
|
7564
|
-
|
|
7565
|
-
|
|
7566
|
-
|
|
7567
|
-
|
|
7828
|
+
return _call(function () {
|
|
7829
|
+
return _await$1(document.accessor.get(), function (snapshot) {
|
|
7830
|
+
const data = snapshot.data();
|
|
7831
|
+
const model = {
|
|
7832
|
+
document,
|
|
7833
|
+
snapshot,
|
|
7834
|
+
data,
|
|
7835
|
+
exists: data != null
|
|
7836
|
+
};
|
|
7837
|
+
return model;
|
|
7838
|
+
});
|
|
7568
7839
|
});
|
|
7569
7840
|
}
|
|
7570
7841
|
isUsableOutputForRoles(output) {
|
|
@@ -7577,6 +7848,8 @@ function firebaseModelPermissionService(delegate) {
|
|
|
7577
7848
|
|
|
7578
7849
|
class ContextGrantedModelRolesReaderInstance {
|
|
7579
7850
|
constructor(contextGrantedModelRoles) {
|
|
7851
|
+
this.contextGrantedModelRoles = void 0;
|
|
7852
|
+
this._roleReader = void 0;
|
|
7580
7853
|
this.contextGrantedModelRoles = contextGrantedModelRoles;
|
|
7581
7854
|
this._roleReader = model.grantedRoleMapReader(contextGrantedModelRoles.roleMap);
|
|
7582
7855
|
}
|
|
@@ -7638,13 +7911,13 @@ class ContextGrantedModelRolesReaderInstance {
|
|
|
7638
7911
|
return this;
|
|
7639
7912
|
}
|
|
7640
7913
|
throwDoesNotExistError() {
|
|
7641
|
-
var
|
|
7642
|
-
const error = (
|
|
7914
|
+
var _this$contextGrantedM, _this$contextGrantedM2, _this$contextGrantedM3;
|
|
7915
|
+
const error = (_this$contextGrantedM = (_this$contextGrantedM2 = (_this$contextGrantedM3 = this.contextGrantedModelRoles.context).makeDoesNotExistError) == null ? void 0 : _this$contextGrantedM2.call(_this$contextGrantedM3, this.contextGrantedModelRoles)) != null ? _this$contextGrantedM : new Error(contextGrantedModelRolesReaderDoesNotExistErrorMessage(this.contextGrantedModelRoles));
|
|
7643
7916
|
throw error;
|
|
7644
7917
|
}
|
|
7645
7918
|
throwPermissionError(role) {
|
|
7646
|
-
var
|
|
7647
|
-
const error = (
|
|
7919
|
+
var _this$contextGrantedM4, _this$contextGrantedM5, _this$contextGrantedM6;
|
|
7920
|
+
const error = (_this$contextGrantedM4 = (_this$contextGrantedM5 = (_this$contextGrantedM6 = this.contextGrantedModelRoles.context).makePermissionError) == null ? void 0 : _this$contextGrantedM5.call(_this$contextGrantedM6, this.contextGrantedModelRoles, role)) != null ? _this$contextGrantedM4 : new Error(contextGrantedModelRolesReaderPermissionErrorMessage(this.contextGrantedModelRoles, role));
|
|
7648
7921
|
throw error;
|
|
7649
7922
|
}
|
|
7650
7923
|
}
|
|
@@ -7662,9 +7935,9 @@ function contextGrantedModelRolesReader(service) {
|
|
|
7662
7935
|
* @returns
|
|
7663
7936
|
*/
|
|
7664
7937
|
function contextGrantedModelRolesReaderPermissionErrorMessage(contextGrantedModelRoles, roles) {
|
|
7665
|
-
var
|
|
7666
|
-
let message = `Permissions Error ("${(
|
|
7667
|
-
if (roles &&
|
|
7938
|
+
var _contextGrantedModelR, _contextGrantedModelR2;
|
|
7939
|
+
let message = `Permissions Error ("${(_contextGrantedModelR = contextGrantedModelRoles.data) == null ? void 0 : _contextGrantedModelR.document.modelType}":"${(_contextGrantedModelR2 = contextGrantedModelRoles.data) == null ? void 0 : _contextGrantedModelR2.document.id}")`;
|
|
7940
|
+
if (roles && roles != null && roles.length) {
|
|
7668
7941
|
message = `${message}: required role(s) "${roles}"`;
|
|
7669
7942
|
}
|
|
7670
7943
|
return message;
|
|
@@ -7677,8 +7950,8 @@ function contextGrantedModelRolesReaderPermissionErrorMessage(contextGrantedMode
|
|
|
7677
7950
|
* @returns
|
|
7678
7951
|
*/
|
|
7679
7952
|
function contextGrantedModelRolesReaderDoesNotExistErrorMessage(contextGrantedModelRoles) {
|
|
7680
|
-
var
|
|
7681
|
-
const message = `Does Not Exist ("${(
|
|
7953
|
+
var _contextGrantedModelR3, _contextGrantedModelR4;
|
|
7954
|
+
const message = `Does Not Exist ("${(_contextGrantedModelR3 = contextGrantedModelRoles.data) == null ? void 0 : _contextGrantedModelR3.document.modelType}":"${(_contextGrantedModelR4 = contextGrantedModelRoles.data) == null ? void 0 : _contextGrantedModelR4.document.id}")`;
|
|
7682
7955
|
return message;
|
|
7683
7956
|
}
|
|
7684
7957
|
|
|
@@ -7689,18 +7962,54 @@ function contextGrantedModelRolesReaderDoesNotExistErrorMessage(contextGrantedMo
|
|
|
7689
7962
|
* @param context
|
|
7690
7963
|
* @returns
|
|
7691
7964
|
*/
|
|
7965
|
+
|
|
7966
|
+
function _await(value, then, direct) {
|
|
7967
|
+
if (direct) {
|
|
7968
|
+
return then ? then(value) : value;
|
|
7969
|
+
}
|
|
7970
|
+
if (!value || !value.then) {
|
|
7971
|
+
value = Promise.resolve(value);
|
|
7972
|
+
}
|
|
7973
|
+
return then ? value.then(then) : value;
|
|
7974
|
+
} /**
|
|
7975
|
+
* Convenience function that checks the input context if the user is an admin or not and grants pre-set admin roles if they are.
|
|
7976
|
+
*
|
|
7977
|
+
* @param context
|
|
7978
|
+
* @param rolesToGrantToAdmin
|
|
7979
|
+
* @param otherwise
|
|
7980
|
+
* @returns
|
|
7981
|
+
*/
|
|
7982
|
+
|
|
7983
|
+
function _empty() {}
|
|
7984
|
+
function _invokeIgnored(body) {
|
|
7985
|
+
var result = body();
|
|
7986
|
+
if (result && result.then) {
|
|
7987
|
+
return result.then(_empty);
|
|
7988
|
+
}
|
|
7989
|
+
}
|
|
7990
|
+
function _invoke(body, then) {
|
|
7991
|
+
var result = body();
|
|
7992
|
+
if (result && result.then) {
|
|
7993
|
+
return result.then(then);
|
|
7994
|
+
}
|
|
7995
|
+
return then(result);
|
|
7996
|
+
}
|
|
7997
|
+
function _async(f) {
|
|
7998
|
+
return function () {
|
|
7999
|
+
for (var args = [], i = 0; i < arguments.length; i++) {
|
|
8000
|
+
args[i] = arguments[i];
|
|
8001
|
+
}
|
|
8002
|
+
try {
|
|
8003
|
+
return Promise.resolve(f.apply(this, args));
|
|
8004
|
+
} catch (e) {
|
|
8005
|
+
return Promise.reject(e);
|
|
8006
|
+
}
|
|
8007
|
+
};
|
|
8008
|
+
}
|
|
7692
8009
|
const isAdminInFirebaseModelContext = context => {
|
|
7693
|
-
var
|
|
7694
|
-
return (
|
|
8010
|
+
var _context$auth$isAdmin, _context$auth;
|
|
8011
|
+
return (_context$auth$isAdmin = (_context$auth = context.auth) == null ? void 0 : _context$auth.isAdmin()) != null ? _context$auth$isAdmin : false;
|
|
7695
8012
|
};
|
|
7696
|
-
/**
|
|
7697
|
-
* Convenience function that checks the input context if the user is an admin or not and grants pre-set admin roles if they are.
|
|
7698
|
-
*
|
|
7699
|
-
* @param context
|
|
7700
|
-
* @param rolesToGrantToAdmin
|
|
7701
|
-
* @param otherwise
|
|
7702
|
-
* @returns
|
|
7703
|
-
*/
|
|
7704
8013
|
function grantModelRolesIfAdminFunction(rolesToGrantToAdmin) {
|
|
7705
8014
|
return grantModelRolesIfFunction(isAdminInFirebaseModelContext, rolesToGrantToAdmin);
|
|
7706
8015
|
}
|
|
@@ -7722,8 +8031,8 @@ function grantModelRolesIfAdmin(context, rolesToGrantToAdmin, otherwise) {
|
|
|
7722
8031
|
*/
|
|
7723
8032
|
function grantModelRolesIfHasAuthRolesFunction(authRoles, rolesToGrantToAdmin) {
|
|
7724
8033
|
return grantModelRolesIfFunction(context => {
|
|
7725
|
-
var
|
|
7726
|
-
const currentAuthRoles = (
|
|
8034
|
+
var _context$auth2;
|
|
8035
|
+
const currentAuthRoles = (_context$auth2 = context.auth) == null ? void 0 : _context$auth2.getAuthRoles();
|
|
7727
8036
|
if (currentAuthRoles) {
|
|
7728
8037
|
return util.setContainsAllValues(currentAuthRoles, authRoles);
|
|
7729
8038
|
} else {
|
|
@@ -7743,22 +8052,32 @@ function grantModelRolesIfHasAuthRolesFactory(authRoles) {
|
|
|
7743
8052
|
* @param context
|
|
7744
8053
|
* @returns
|
|
7745
8054
|
*/
|
|
7746
|
-
const isOwnerOfUserRelatedModelInFirebaseModelContext =
|
|
8055
|
+
const isOwnerOfUserRelatedModelInFirebaseModelContext = _async(function (context) {
|
|
7747
8056
|
let decision = false;
|
|
7748
8057
|
const auth = context.context.auth;
|
|
7749
|
-
|
|
7750
|
-
|
|
7751
|
-
|
|
7752
|
-
|
|
7753
|
-
|
|
7754
|
-
|
|
7755
|
-
|
|
7756
|
-
|
|
7757
|
-
|
|
7758
|
-
|
|
8058
|
+
return _invoke(function () {
|
|
8059
|
+
if (auth != null) {
|
|
8060
|
+
let model = context.model;
|
|
8061
|
+
return _invoke(function () {
|
|
8062
|
+
if (!model) {
|
|
8063
|
+
const document = context.document;
|
|
8064
|
+
return _invokeIgnored(function () {
|
|
8065
|
+
if (document) {
|
|
8066
|
+
return _await(document.accessor.get(), function (_document$accessor$ge) {
|
|
8067
|
+
model = _document$accessor$ge.data();
|
|
8068
|
+
});
|
|
8069
|
+
}
|
|
8070
|
+
});
|
|
8071
|
+
}
|
|
8072
|
+
}, function () {
|
|
8073
|
+
if (model) {
|
|
8074
|
+
decision = auth.uid === model.uid;
|
|
8075
|
+
}
|
|
8076
|
+
});
|
|
7759
8077
|
}
|
|
7760
|
-
}
|
|
7761
|
-
|
|
8078
|
+
}, function () {
|
|
8079
|
+
return decision;
|
|
8080
|
+
});
|
|
7762
8081
|
});
|
|
7763
8082
|
/**
|
|
7764
8083
|
* Creates a GrantRolesIfFunction that grants roles if the user is related to the model by uid.
|
|
@@ -7797,11 +8116,12 @@ function grantModelRolesIfFunction(grantIf, grantedRoles) {
|
|
|
7797
8116
|
if (!grantIf) {
|
|
7798
8117
|
throw new Error('missing grant if');
|
|
7799
8118
|
}
|
|
7800
|
-
return (context, otherwise = model.noAccessRoleMap)
|
|
7801
|
-
|
|
7802
|
-
|
|
7803
|
-
|
|
7804
|
-
|
|
8119
|
+
return _async(function (context, otherwise = model.noAccessRoleMap) {
|
|
8120
|
+
return _await(grantIf(context), function (decision) {
|
|
8121
|
+
return _await(decision ? util.getValueFromGetter(grantedRoles) : 0, function (_getValueFromGetter) {
|
|
8122
|
+
return _await(decision ? _getValueFromGetter : otherwise(), void 0, decision);
|
|
8123
|
+
}, !decision);
|
|
8124
|
+
});
|
|
7805
8125
|
});
|
|
7806
8126
|
}
|
|
7807
8127
|
|
|
@@ -7878,7 +8198,7 @@ function inContextFirebaseModelServiceFactory(factory) {
|
|
|
7878
8198
|
function firebaseModelsService(services) {
|
|
7879
8199
|
const firebaseModelsServiceFunction = (type, context) => {
|
|
7880
8200
|
const firebaseModelService = services[type];
|
|
7881
|
-
const contextWithService = Object.assign(
|
|
8201
|
+
const contextWithService = Object.assign({}, context, {
|
|
7882
8202
|
service: firebaseModelsServiceFunction
|
|
7883
8203
|
});
|
|
7884
8204
|
const service = inContextFirebaseModelServiceFactory(firebaseModelService)(contextWithService);
|
|
@@ -7943,7 +8263,7 @@ const MODEL_STORAGE_FILE_SLASH_PATH_FACTORY = util.slashPathFactory({
|
|
|
7943
8263
|
function modelStorageSlashPathFactory(config) {
|
|
7944
8264
|
const {
|
|
7945
8265
|
basePath
|
|
7946
|
-
} = config
|
|
8266
|
+
} = config != null ? config : {};
|
|
7947
8267
|
return (input, path) => {
|
|
7948
8268
|
const key = readFirestoreModelKey(input, true);
|
|
7949
8269
|
return MODEL_STORAGE_FILE_SLASH_PATH_FACTORY([basePath, key, path]);
|
|
@@ -7951,7 +8271,7 @@ function modelStorageSlashPathFactory(config) {
|
|
|
7951
8271
|
}
|
|
7952
8272
|
|
|
7953
8273
|
function assertStorageUploadOptionsStringFormat(options) {
|
|
7954
|
-
const stringFormat = options
|
|
8274
|
+
const stringFormat = options == null ? void 0 : options.stringFormat;
|
|
7955
8275
|
if (!stringFormat) {
|
|
7956
8276
|
throw noStringFormatInStorageUploadOptionsError();
|
|
7957
8277
|
}
|
|
@@ -8004,12 +8324,11 @@ function storageListFilesResultHasNoNextError() {
|
|
|
8004
8324
|
*/
|
|
8005
8325
|
function firebaseStorageContextFactory(drivers) {
|
|
8006
8326
|
return (firebaseStorage, config) => {
|
|
8007
|
-
var _a, _b;
|
|
8008
8327
|
const {
|
|
8009
8328
|
defaultBucketId: inputDefaultBucketId,
|
|
8010
8329
|
forceBucket = false
|
|
8011
|
-
} = config
|
|
8012
|
-
const defaultBucketId = inputDefaultBucketId || (
|
|
8330
|
+
} = config != null ? config : {};
|
|
8331
|
+
const defaultBucketId = inputDefaultBucketId || (drivers.storageAccessorDriver.defaultBucket == null ? void 0 : drivers.storageAccessorDriver.defaultBucket(firebaseStorage)) || '';
|
|
8013
8332
|
if (!defaultBucketId) {
|
|
8014
8333
|
throw new Error('Could not resolve a default bucket id for the firebaseStorageContextFactory(). Supply a defaultBucketId.');
|
|
8015
8334
|
}
|
|
@@ -8047,9 +8366,9 @@ function firebaseStorageClientAccessorFile(storage$1, storagePath) {
|
|
|
8047
8366
|
metadata
|
|
8048
8367
|
} = options;
|
|
8049
8368
|
if (options.contentType || options.metadata) {
|
|
8050
|
-
result = Object.assign(
|
|
8369
|
+
result = Object.assign({}, contentType ? {
|
|
8051
8370
|
contentType
|
|
8052
|
-
} : undefined
|
|
8371
|
+
} : undefined, metadata);
|
|
8053
8372
|
}
|
|
8054
8373
|
}
|
|
8055
8374
|
return result;
|
|
@@ -8091,7 +8410,7 @@ const firebaseStorageClientListFilesResultFactory = storageListFilesResultFactor
|
|
|
8091
8410
|
return result.listResult.nextPageToken != null;
|
|
8092
8411
|
},
|
|
8093
8412
|
next(storage, folder, result) {
|
|
8094
|
-
return folder.list(Object.assign(
|
|
8413
|
+
return folder.list(Object.assign({}, result.options, {
|
|
8095
8414
|
pageToken: result.listResult.nextPageToken
|
|
8096
8415
|
}));
|
|
8097
8416
|
},
|
|
@@ -8138,8 +8457,8 @@ function firebaseStorageClientAccessorFolder(storage$1, storagePath) {
|
|
|
8138
8457
|
function firebaseStorageClientAccessorDriver() {
|
|
8139
8458
|
return {
|
|
8140
8459
|
defaultBucket: storage => {
|
|
8141
|
-
var
|
|
8142
|
-
return (
|
|
8460
|
+
var _storage$app$options$;
|
|
8461
|
+
return (_storage$app$options$ = storage.app.options.storageBucket) != null ? _storage$app$options$ : '';
|
|
8143
8462
|
},
|
|
8144
8463
|
file: (storage, path) => firebaseStorageClientAccessorFile(storage, path),
|
|
8145
8464
|
folder: (storage, path) => firebaseStorageClientAccessorFolder(storage, path)
|
|
@@ -8208,7 +8527,6 @@ exports.AbstractFirestoreDocumentWithParent = AbstractFirestoreDocumentWithParen
|
|
|
8208
8527
|
exports.BASE_MODEL_STORAGE_FILE_PATH = BASE_MODEL_STORAGE_FILE_PATH;
|
|
8209
8528
|
exports.CALL_MODEL_APP_FUNCTION_KEY = CALL_MODEL_APP_FUNCTION_KEY;
|
|
8210
8529
|
exports.COPY_USER_RELATED_DATA_ACCESSOR_FACTORY_FUNCTION = COPY_USER_RELATED_DATA_ACCESSOR_FACTORY_FUNCTION;
|
|
8211
|
-
exports.CREATE_MODEL_APP_FUNCTION_KEY = CREATE_MODEL_APP_FUNCTION_KEY;
|
|
8212
8530
|
exports.ContextGrantedModelRolesReaderInstance = ContextGrantedModelRolesReaderInstance;
|
|
8213
8531
|
exports.DEFAULT_DATE_CELL_RANGE_VALUE = DEFAULT_DATE_CELL_RANGE_VALUE;
|
|
8214
8532
|
exports.DEFAULT_FIRESTORE_DATE_CELL_SCHEDULE_VALUE = DEFAULT_FIRESTORE_DATE_CELL_SCHEDULE_VALUE;
|
|
@@ -8220,7 +8538,6 @@ exports.DEFAULT_ITERATE_FIRESTORE_DOCUMENT_SNAPSHOT_BATCHES_BATCH_SIZE = DEFAULT
|
|
|
8220
8538
|
exports.DEFAULT_QUERY_CHANGE_WATCHER_DELAY = DEFAULT_QUERY_CHANGE_WATCHER_DELAY;
|
|
8221
8539
|
exports.DEFAULT_SINGLE_ITEM_FIRESTORE_COLLECTION_DOCUMENT_IDENTIFIER = DEFAULT_SINGLE_ITEM_FIRESTORE_COLLECTION_DOCUMENT_IDENTIFIER;
|
|
8222
8540
|
exports.DEFAULT_WEBSITE_LINK = DEFAULT_WEBSITE_LINK;
|
|
8223
|
-
exports.DELETE_MODEL_APP_FUNCTION_KEY = DELETE_MODEL_APP_FUNCTION_KEY;
|
|
8224
8541
|
exports.FIREBASE_AUTH_NETWORK_REQUEST_ERROR = FIREBASE_AUTH_NETWORK_REQUEST_ERROR;
|
|
8225
8542
|
exports.FIREBASE_AUTH_NETWORK_REQUEST_FAILED = FIREBASE_AUTH_NETWORK_REQUEST_FAILED;
|
|
8226
8543
|
exports.FIREBASE_AUTH_PASSWORD_MAX_LENGTH = FIREBASE_AUTH_PASSWORD_MAX_LENGTH;
|
|
@@ -8263,6 +8580,7 @@ exports.FirestoreItemPageIterationInstance = FirestoreItemPageIterationInstance;
|
|
|
8263
8580
|
exports.InferredTargetModelIdParams = InferredTargetModelIdParams;
|
|
8264
8581
|
exports.InferredTargetModelParams = InferredTargetModelParams;
|
|
8265
8582
|
exports.IsFirestoreModelId = IsFirestoreModelId;
|
|
8583
|
+
exports.IsFirestoreModelIdOrKey = IsFirestoreModelIdOrKey;
|
|
8266
8584
|
exports.IsFirestoreModelKey = IsFirestoreModelKey;
|
|
8267
8585
|
exports.MAX_FIRESTORE_MAP_ZOOM_LEVEL_VALUE = MAX_FIRESTORE_MAP_ZOOM_LEVEL_VALUE;
|
|
8268
8586
|
exports.MIN_FIRESTORE_MAP_ZOOM_LEVEL_VALUE = MIN_FIRESTORE_MAP_ZOOM_LEVEL_VALUE;
|
|
@@ -8270,7 +8588,6 @@ exports.MODEL_FUNCTION_FIREBASE_CRUD_FUNCTION_SPECIFIER_DEFAULT = MODEL_FUNCTION
|
|
|
8270
8588
|
exports.MODEL_FUNCTION_FIREBASE_CRUD_FUNCTION_SPECIFIER_SPLITTER = MODEL_FUNCTION_FIREBASE_CRUD_FUNCTION_SPECIFIER_SPLITTER;
|
|
8271
8589
|
exports.MODEL_STORAGE_FILE_SLASH_PATH_FACTORY = MODEL_STORAGE_FILE_SLASH_PATH_FACTORY;
|
|
8272
8590
|
exports.ModifyBeforeSetFirestoreDocumentDataAccessorWrapper = ModifyBeforeSetFirestoreDocumentDataAccessorWrapper;
|
|
8273
|
-
exports.READ_MODEL_APP_FUNCTION_KEY = READ_MODEL_APP_FUNCTION_KEY;
|
|
8274
8591
|
exports.RUN_DEV_FUNCTION_APP_FUNCTION_KEY = RUN_DEV_FUNCTION_APP_FUNCTION_KEY;
|
|
8275
8592
|
exports.SCHEDULED_FUNCTION_DEV_FUNCTION_SPECIFIER = SCHEDULED_FUNCTION_DEV_FUNCTION_SPECIFIER;
|
|
8276
8593
|
exports.ScheduledFunctionDevelopmentFirebaseFunctionListEntry = ScheduledFunctionDevelopmentFirebaseFunctionListEntry;
|
|
@@ -8279,7 +8596,6 @@ exports.SystemStateDocument = SystemStateDocument;
|
|
|
8279
8596
|
exports.SystemStateFirestoreCollections = SystemStateFirestoreCollections;
|
|
8280
8597
|
exports.TargetModelIdParams = TargetModelIdParams;
|
|
8281
8598
|
exports.TargetModelParams = TargetModelParams;
|
|
8282
|
-
exports.UPDATE_MODEL_APP_FUNCTION_KEY = UPDATE_MODEL_APP_FUNCTION_KEY;
|
|
8283
8599
|
exports.addConstraintToBuilder = addConstraintToBuilder;
|
|
8284
8600
|
exports.addOrReplaceLimitInConstraints = addOrReplaceLimitInConstraints;
|
|
8285
8601
|
exports.allChildDocumentsUnderParent = allChildDocumentsUnderParent;
|
|
@@ -8326,6 +8642,7 @@ exports.endBefore = endBefore;
|
|
|
8326
8642
|
exports.extendFirestoreCollectionWithSingleDocumentAccessor = extendFirestoreCollectionWithSingleDocumentAccessor;
|
|
8327
8643
|
exports.filterConstraintsOfType = filterConstraintsOfType;
|
|
8328
8644
|
exports.filterDisallowedFirestoreItemPageIteratorInputContraints = filterDisallowedFirestoreItemPageIteratorInputContraints;
|
|
8645
|
+
exports.filterRepeatCheckpointSnapshots = filterRepeatCheckpointSnapshots;
|
|
8329
8646
|
exports.filterWithDateRange = filterWithDateRange;
|
|
8330
8647
|
exports.firebaseAuthErrorToReadableError = firebaseAuthErrorToReadableError;
|
|
8331
8648
|
exports.firebaseFirestoreClientDrivers = firebaseFirestoreClientDrivers;
|
|
@@ -8475,6 +8792,7 @@ exports.interceptAccessorFactoryFunction = interceptAccessorFactoryFunction;
|
|
|
8475
8792
|
exports.isAdminInFirebaseModelContext = isAdminInFirebaseModelContext;
|
|
8476
8793
|
exports.isFirebaseStorageObjectNotFoundError = isFirebaseStorageObjectNotFoundError;
|
|
8477
8794
|
exports.isFirestoreModelId = isFirestoreModelId;
|
|
8795
|
+
exports.isFirestoreModelIdOrKey = isFirestoreModelIdOrKey;
|
|
8478
8796
|
exports.isFirestoreModelKey = isFirestoreModelKey;
|
|
8479
8797
|
exports.isOwnerOfUserRelatedModelInFirebaseModelContext = isOwnerOfUserRelatedModelInFirebaseModelContext;
|
|
8480
8798
|
exports.iterateFirestoreDocumentSnapshotBatches = iterateFirestoreDocumentSnapshotBatches;
|
|
@@ -8510,7 +8828,6 @@ exports.makeRootSingleItemFirestoreCollection = makeRootSingleItemFirestoreColle
|
|
|
8510
8828
|
exports.makeSingleItemFirestoreCollection = makeSingleItemFirestoreCollection;
|
|
8511
8829
|
exports.mapDataFromSnapshot = mapDataFromSnapshot;
|
|
8512
8830
|
exports.mapHttpsCallable = mapHttpsCallable;
|
|
8513
|
-
exports.modelFirebaseFunctionMapFactory = modelFirebaseFunctionMapFactory;
|
|
8514
8831
|
exports.modelStorageSlashPathFactory = modelStorageSlashPathFactory;
|
|
8515
8832
|
exports.modifyBeforeSetInterceptAccessorFactoryFunction = modifyBeforeSetInterceptAccessorFactoryFunction;
|
|
8516
8833
|
exports.newDocuments = newDocuments;
|