@dereekb/firebase 10.2.0 → 11.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.cjs.js +1005 -729
- package/index.esm.js +47 -162
- 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/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/test/CHANGELOG.md +18 -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 +315 -329
- 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,209 +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
|
-
function filterRepeatCheckpointSnapshots(readKeyFunction = x => x.id) {
|
|
5037
|
-
const allowOnceFilter = util.allowValueOnceFilter(readKeyFunction);
|
|
5038
|
-
return snapshots => __awaiter(this, void 0, void 0, function* () {
|
|
5039
|
-
return snapshots.filter(allowOnceFilter);
|
|
5040
|
-
});
|
|
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
5041
|
}
|
|
5042
|
-
|
|
5043
|
-
|
|
5044
|
-
|
|
5045
|
-
|
|
5046
|
-
|
|
5047
|
-
|
|
5048
|
-
function iterateFirestoreDocumentSnapshotCheckpoints(config) {
|
|
5049
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
5050
|
-
const {
|
|
5051
|
-
iterateCheckpoint,
|
|
5052
|
-
filterCheckpointSnapshots: inputFilterCheckpointSnapshot,
|
|
5053
|
-
handleRepeatCursor: inputHandleRepeatCursor,
|
|
5054
|
-
waitBetweenCheckpoints,
|
|
5055
|
-
useCheckpointResult,
|
|
5056
|
-
constraintsFactory: inputConstraintsFactory,
|
|
5057
|
-
dynamicConstraints: inputDynamicConstraints,
|
|
5058
|
-
queryFactory,
|
|
5059
|
-
maxParallelCheckpoints = 1,
|
|
5060
|
-
limitPerCheckpoint: inputLimitPerCheckpoint,
|
|
5061
|
-
totalSnapshotsLimit: inputTotalSnapshotsLimit
|
|
5062
|
-
} = config;
|
|
5063
|
-
const constraintsInputIsFactory = typeof inputConstraintsFactory === 'function';
|
|
5064
|
-
const constraintsFactory = constraintsInputIsFactory && inputDynamicConstraints !== false ? inputConstraintsFactory : util.asGetter(util.getValueFromGetter(inputConstraintsFactory));
|
|
5065
|
-
/**
|
|
5066
|
-
* Default to the input total snapshots limit if no limit is provided, otherwise there will be no limit.
|
|
5067
|
-
*/
|
|
5068
|
-
const limitPerCheckpoint = inputLimitPerCheckpoint !== null && inputLimitPerCheckpoint !== void 0 ? inputLimitPerCheckpoint : inputTotalSnapshotsLimit;
|
|
5069
|
-
const totalSnapshotsLimit = inputTotalSnapshotsLimit !== null && inputTotalSnapshotsLimit !== void 0 ? inputTotalSnapshotsLimit : Number.MAX_SAFE_INTEGER;
|
|
5070
|
-
let currentIndex = 0;
|
|
5071
|
-
let hasReachedEnd = false;
|
|
5072
|
-
let totalSnapshotsLimitReached = false;
|
|
5073
|
-
let totalSnapshotsVisited = 0;
|
|
5074
|
-
let cursorDocument;
|
|
5075
|
-
const visitedCursorPaths = new Set();
|
|
5076
|
-
const handleRepeatCursor = typeof inputHandleRepeatCursor === 'function' ? inputHandleRepeatCursor : () => inputHandleRepeatCursor;
|
|
5077
|
-
const filterCheckpointSnapshot = inputFilterCheckpointSnapshot !== null && inputFilterCheckpointSnapshot !== void 0 ? inputFilterCheckpointSnapshot : util.mapIdentityFunction();
|
|
5078
|
-
function taskInputFactory() {
|
|
5079
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
5080
|
-
// Perform another query, then pass the results to the task factory.
|
|
5081
|
-
if (hasReachedEnd) {
|
|
5082
|
-
return null; // issue no more tasks
|
|
5083
|
-
}
|
|
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
|
+
}
|
|
5084
5048
|
|
|
5085
|
-
|
|
5086
|
-
|
|
5087
|
-
|
|
5088
|
-
|
|
5089
|
-
|
|
5090
|
-
|
|
5091
|
-
|
|
5092
|
-
|
|
5093
|
-
|
|
5094
|
-
|
|
5095
|
-
|
|
5096
|
-
|
|
5097
|
-
|
|
5098
|
-
|
|
5099
|
-
|
|
5100
|
-
|
|
5101
|
-
|
|
5102
|
-
|
|
5103
|
-
|
|
5104
|
-
|
|
5105
|
-
|
|
5106
|
-
|
|
5107
|
-
|
|
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 () {
|
|
5108
5074
|
if (nextCursorDocument != null) {
|
|
5109
5075
|
const cursorPath = readFirestoreModelKeyFromDocumentSnapshot(nextCursorDocument);
|
|
5110
|
-
|
|
5111
|
-
|
|
5112
|
-
|
|
5113
|
-
|
|
5114
|
-
|
|
5115
|
-
|
|
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);
|
|
5116
5089
|
}
|
|
5117
|
-
}
|
|
5118
|
-
visitedCursorPaths.add(cursorPath);
|
|
5119
|
-
}
|
|
5090
|
+
}();
|
|
5120
5091
|
}
|
|
5092
|
+
}, function (_result2) {
|
|
5093
|
+
if (_exit) return _result2;
|
|
5121
5094
|
cursorDocument = nextCursorDocument; // set the next cursor document
|
|
5122
5095
|
// update state
|
|
5096
|
+
// increase our current index
|
|
5123
5097
|
const newSnapshotsVisited = docSnapshots.length;
|
|
5124
5098
|
totalSnapshotsVisited += newSnapshotsVisited;
|
|
5125
5099
|
if (!cursorDocument || totalSnapshotsVisited > totalSnapshotsLimit) {
|
|
@@ -5128,33 +5102,64 @@ function iterateFirestoreDocumentSnapshotCheckpoints(config) {
|
|
|
5128
5102
|
}
|
|
5129
5103
|
|
|
5130
5104
|
const i = currentIndex;
|
|
5131
|
-
currentIndex += 1;
|
|
5105
|
+
currentIndex += 1;
|
|
5132
5106
|
return {
|
|
5133
5107
|
i,
|
|
5134
5108
|
docQuerySnapshot
|
|
5135
5109
|
};
|
|
5136
5110
|
});
|
|
5137
|
-
}
|
|
5138
|
-
const performTaskFn = util.performTasksFromFactoryInParallelFunction({
|
|
5139
|
-
maxParallelTasks: maxParallelCheckpoints,
|
|
5140
|
-
waitBetweenTasks: waitBetweenCheckpoints,
|
|
5141
|
-
taskFactory: ({
|
|
5142
|
-
i,
|
|
5143
|
-
docQuerySnapshot
|
|
5144
|
-
}) => __awaiter(this, void 0, void 0, function* () {
|
|
5145
|
-
const docSnapshots = yield filterCheckpointSnapshot(docQuerySnapshot.docs);
|
|
5146
|
-
const results = yield iterateCheckpoint(docSnapshots, docQuerySnapshot);
|
|
5147
|
-
const checkpointResults = {
|
|
5148
|
-
i,
|
|
5149
|
-
cursorDocument,
|
|
5150
|
-
results,
|
|
5151
|
-
docSnapshots,
|
|
5152
|
-
docQuerySnapshot
|
|
5153
|
-
};
|
|
5154
|
-
yield useCheckpointResult === null || useCheckpointResult === void 0 ? void 0 : useCheckpointResult(checkpointResults);
|
|
5155
|
-
})
|
|
5156
5111
|
});
|
|
5157
|
-
|
|
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 () {
|
|
5158
5163
|
const result = {
|
|
5159
5164
|
totalCheckpoints: currentIndex,
|
|
5160
5165
|
totalSnapshotsVisited,
|
|
@@ -5162,99 +5167,211 @@ function iterateFirestoreDocumentSnapshotCheckpoints(config) {
|
|
|
5162
5167
|
};
|
|
5163
5168
|
return result;
|
|
5164
5169
|
});
|
|
5165
|
-
}
|
|
5166
|
-
// MARK: Utility
|
|
5167
|
-
function allowDocumentSnapshotWithPathOnceFilter() {
|
|
5168
|
-
return util.allowValueOnceFilter(readFirestoreModelKeyFromDocumentSnapshot);
|
|
5169
|
-
}
|
|
5170
|
-
|
|
5171
|
-
function loadAllFirestoreDocumentSnapshotPairs(config) {
|
|
5172
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
5173
|
-
const {
|
|
5174
|
-
documentAccessor,
|
|
5175
|
-
queryFactory,
|
|
5176
|
-
constraintsFactory,
|
|
5177
|
-
dynamicConstraints,
|
|
5178
|
-
totalSnapshotsLimit,
|
|
5179
|
-
limitPerCheckpoint,
|
|
5180
|
-
handleRepeatCursor,
|
|
5181
|
-
filterCheckpointSnapshots,
|
|
5182
|
-
iterateSnapshotPairsBatch: optionalIterateSnapshotPairsBatch
|
|
5183
|
-
} = config;
|
|
5184
|
-
const allDocumentGroups = [];
|
|
5185
|
-
const {
|
|
5186
|
-
totalCheckpoints,
|
|
5187
|
-
totalSnapshotsVisited,
|
|
5188
|
-
totalSnapshotsLimitReached
|
|
5189
|
-
} = yield iterateFirestoreDocumentSnapshotPairBatches({
|
|
5190
|
-
documentAccessor,
|
|
5191
|
-
queryFactory,
|
|
5192
|
-
constraintsFactory,
|
|
5193
|
-
dynamicConstraints,
|
|
5194
|
-
totalSnapshotsLimit,
|
|
5195
|
-
handleRepeatCursor,
|
|
5196
|
-
filterCheckpointSnapshots,
|
|
5197
|
-
limitPerCheckpoint,
|
|
5198
|
-
maxParallelCheckpoints: 1,
|
|
5199
|
-
iterateSnapshotPairsBatch: (snapshotDataPairs, batchIndex) => __awaiter(this, void 0, void 0, function* () {
|
|
5200
|
-
allDocumentGroups.push(snapshotDataPairs);
|
|
5201
|
-
if (optionalIterateSnapshotPairsBatch) {
|
|
5202
|
-
yield optionalIterateSnapshotPairsBatch(snapshotDataPairs, batchIndex);
|
|
5203
|
-
}
|
|
5204
|
-
})
|
|
5205
|
-
});
|
|
5206
|
-
const snapshotPairs = util.flattenArray(allDocumentGroups);
|
|
5207
|
-
return {
|
|
5208
|
-
snapshotPairs,
|
|
5209
|
-
totalCheckpoints,
|
|
5210
|
-
totalSnapshotsVisited,
|
|
5211
|
-
totalSnapshotsLimitReached
|
|
5212
|
-
};
|
|
5213
|
-
});
|
|
5214
|
-
}
|
|
5170
|
+
});
|
|
5215
5171
|
/**
|
|
5216
|
-
* Iterates
|
|
5172
|
+
* Iterates through the results of a Firestore query by each document snapshot.
|
|
5173
|
+
*
|
|
5174
|
+
* @param config
|
|
5175
|
+
* @returns
|
|
5176
|
+
*/
|
|
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);
|
|
5282
|
+
});
|
|
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.
|
|
5217
5290
|
*
|
|
5218
5291
|
* @param config
|
|
5219
5292
|
* @returns
|
|
5220
5293
|
*/
|
|
5221
|
-
function loadAllFirestoreDocumentSnapshot(config) {
|
|
5222
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
5223
|
-
const {
|
|
5224
|
-
queryFactory,
|
|
5225
|
-
constraintsFactory,
|
|
5226
|
-
dynamicConstraints,
|
|
5227
|
-
totalSnapshotsLimit,
|
|
5228
|
-
limitPerCheckpoint,
|
|
5229
|
-
handleRepeatCursor,
|
|
5230
|
-
filterCheckpointSnapshots,
|
|
5231
|
-
iterateSnapshotsForCheckpoint
|
|
5232
|
-
} = config;
|
|
5233
|
-
const allDocumentGroups = [];
|
|
5234
|
-
const {
|
|
5235
|
-
totalCheckpoints,
|
|
5236
|
-
totalSnapshotsVisited,
|
|
5237
|
-
totalSnapshotsLimitReached
|
|
5238
|
-
} = yield iterateFirestoreDocumentSnapshotCheckpoints({
|
|
5239
|
-
queryFactory,
|
|
5240
|
-
constraintsFactory,
|
|
5241
|
-
dynamicConstraints,
|
|
5242
|
-
totalSnapshotsLimit,
|
|
5243
|
-
handleRepeatCursor,
|
|
5244
|
-
filterCheckpointSnapshots,
|
|
5245
|
-
limitPerCheckpoint,
|
|
5246
|
-
maxParallelCheckpoints: 1,
|
|
5247
|
-
iterateCheckpoint: (snapshots, query) => __awaiter(this, void 0, void 0, function* () {
|
|
5248
|
-
if (snapshots.length) {
|
|
5249
|
-
allDocumentGroups.push(snapshots); // add to snapshots array
|
|
5250
|
-
if (iterateSnapshotsForCheckpoint) {
|
|
5251
|
-
yield iterateSnapshotsForCheckpoint(snapshots, query);
|
|
5252
|
-
}
|
|
5253
|
-
}
|
|
5254
|
-
return []; // return nothing
|
|
5255
|
-
})
|
|
5256
|
-
});
|
|
5257
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
|
+
}) {
|
|
5258
5375
|
const snapshots = util.flattenArray(allDocumentGroups);
|
|
5259
5376
|
return {
|
|
5260
5377
|
snapshots,
|
|
@@ -5263,7 +5380,52 @@ function loadAllFirestoreDocumentSnapshot(config) {
|
|
|
5263
5380
|
totalSnapshotsLimitReached
|
|
5264
5381
|
};
|
|
5265
5382
|
});
|
|
5266
|
-
}
|
|
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
|
+
});
|
|
5267
5429
|
|
|
5268
5430
|
const DEFAULT_QUERY_CHANGE_WATCHER_DELAY = 0;
|
|
5269
5431
|
function iterationQueryDocChangeWatcher(config) {
|
|
@@ -5272,14 +5434,14 @@ function iterationQueryDocChangeWatcher(config) {
|
|
|
5272
5434
|
delay: timeUntilActive = DEFAULT_QUERY_CHANGE_WATCHER_DELAY
|
|
5273
5435
|
} = config;
|
|
5274
5436
|
const stream$ = instance.snapshotIteration.firstSuccessfulPageResults$.pipe(rxjs.switchMap(first => {
|
|
5275
|
-
var
|
|
5437
|
+
var _beginCheckingAt$expi;
|
|
5276
5438
|
const {
|
|
5277
5439
|
time,
|
|
5278
5440
|
stream
|
|
5279
5441
|
} = first.value.value;
|
|
5280
5442
|
const beginCheckingAt = date.toExpires(time, timeUntilActive);
|
|
5281
5443
|
// don't start streaming until the given moment.
|
|
5282
|
-
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.
|
|
5283
5445
|
)));
|
|
5284
5446
|
}), rxjs.shareReplay(1));
|
|
5285
5447
|
const event$ = stream$.pipe(rxjs.map(event => {
|
|
@@ -5287,12 +5449,12 @@ function iterationQueryDocChangeWatcher(config) {
|
|
|
5287
5449
|
const results = util.build({
|
|
5288
5450
|
base: util.groupValues(changes, x => x.type),
|
|
5289
5451
|
build: x => {
|
|
5290
|
-
var
|
|
5452
|
+
var _x$added, _x$removed, _x$modified;
|
|
5291
5453
|
x.time = new Date();
|
|
5292
5454
|
x.changes = changes;
|
|
5293
|
-
x.added = (
|
|
5294
|
-
x.removed = (
|
|
5295
|
-
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 : [];
|
|
5296
5458
|
x.type = iterationQueryDocChangeWatcherChangeTypeForGroup(x);
|
|
5297
5459
|
}
|
|
5298
5460
|
});
|
|
@@ -5970,22 +6132,45 @@ $$1({ target: 'Array', proto: true, forced: String(test) === String(test.reverse
|
|
|
5970
6132
|
}
|
|
5971
6133
|
});
|
|
5972
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
|
+
}
|
|
5973
6156
|
function firestoreCollectionQueryFactory(queryFactory, accessorContext) {
|
|
5974
6157
|
const documentLoader = firestoreDocumentLoader(accessorContext);
|
|
5975
6158
|
const documentSnapshotPairsLoader = firestoreQueryDocumentSnapshotPairsLoader(accessorContext);
|
|
5976
6159
|
const wrapQuery = baseQuery => {
|
|
5977
6160
|
return {
|
|
5978
6161
|
baseQuery,
|
|
5979
|
-
countDocs: (
|
|
6162
|
+
countDocs: _async$4(function () {
|
|
5980
6163
|
return baseQuery.countDocs();
|
|
5981
6164
|
}),
|
|
5982
|
-
getFirstDoc:
|
|
5983
|
-
|
|
5984
|
-
|
|
6165
|
+
getFirstDoc: _async$4(function (transaction) {
|
|
6166
|
+
return _await$4(baseQuery.getFirstDoc(transaction), function (result) {
|
|
6167
|
+
return result ? documentLoader([result.ref])[0] : undefined;
|
|
6168
|
+
});
|
|
5985
6169
|
}),
|
|
5986
|
-
getFirstDocSnapshotDataPair:
|
|
5987
|
-
|
|
5988
|
-
|
|
6170
|
+
getFirstDocSnapshotDataPair: _async$4(function (transaction) {
|
|
6171
|
+
return _await$4(baseQuery.getFirstDoc(transaction), function (result) {
|
|
6172
|
+
return result ? documentSnapshotPairsLoader([result])[0] : undefined;
|
|
6173
|
+
});
|
|
5989
6174
|
}),
|
|
5990
6175
|
getDocs: transaction => baseQuery.getDocs(transaction).then(x => documentLoader(documentReferencesFromSnapshot(x), transaction)),
|
|
5991
6176
|
getDocSnapshotDataPairs: transaction => baseQuery.getDocs(transaction).then(x => documentSnapshotPairsLoader(x.docs, transaction)),
|
|
@@ -6001,9 +6186,8 @@ function firestoreCollectionQueryFactory(queryFactory, accessorContext) {
|
|
|
6001
6186
|
|
|
6002
6187
|
const FIRESTORE_COLLECTION_NAME_SEPARATOR = '/';
|
|
6003
6188
|
function firestoreModelIdentity(parentOrModelName, collectionNameOrModelName, inputCollectionName) {
|
|
6004
|
-
var _a, _b;
|
|
6005
6189
|
if (typeof parentOrModelName === 'object') {
|
|
6006
|
-
const collectionName =
|
|
6190
|
+
const collectionName = inputCollectionName != null ? inputCollectionName : collectionNameOrModelName.toLowerCase();
|
|
6007
6191
|
const collectionType = `${parentOrModelName.collectionType}/${collectionName}`;
|
|
6008
6192
|
return {
|
|
6009
6193
|
type: 'nested',
|
|
@@ -6013,7 +6197,7 @@ function firestoreModelIdentity(parentOrModelName, collectionNameOrModelName, in
|
|
|
6013
6197
|
collectionType
|
|
6014
6198
|
};
|
|
6015
6199
|
} else {
|
|
6016
|
-
const collectionName =
|
|
6200
|
+
const collectionName = collectionNameOrModelName != null ? collectionNameOrModelName : parentOrModelName.toLowerCase();
|
|
6017
6201
|
const collectionType = collectionName;
|
|
6018
6202
|
return {
|
|
6019
6203
|
type: 'root',
|
|
@@ -6088,9 +6272,9 @@ function firestoreModelId(input) {
|
|
|
6088
6272
|
* @returns
|
|
6089
6273
|
*/
|
|
6090
6274
|
function firestoreModelIdsFromKey(input) {
|
|
6091
|
-
var
|
|
6275
|
+
var _parts$map;
|
|
6092
6276
|
const parts = firestoreModelKeyPartPairs(input);
|
|
6093
|
-
return (
|
|
6277
|
+
return (_parts$map = parts == null ? void 0 : parts.map(x => x.id)) != null ? _parts$map : [];
|
|
6094
6278
|
}
|
|
6095
6279
|
/**
|
|
6096
6280
|
* Creates a OneWayFlatFirestoreModelKey from the input FirestoreModelKey.
|
|
@@ -6255,8 +6439,8 @@ function firestoreModelKeyCollectionType(input) {
|
|
|
6255
6439
|
return firestoreModelKeyCollectionTypeArrayName(input, FIRESTORE_COLLECTION_NAME_SEPARATOR);
|
|
6256
6440
|
}
|
|
6257
6441
|
function firestoreModelKeyCollectionTypeArrayName(input, separator = FIRESTORE_COLLECTION_NAME_SEPARATOR) {
|
|
6258
|
-
var
|
|
6259
|
-
return (
|
|
6442
|
+
var _firestoreModelKeyCol;
|
|
6443
|
+
return (_firestoreModelKeyCol = firestoreModelKeyCollectionTypeArray(input)) == null ? void 0 : _firestoreModelKeyCol.join(separator);
|
|
6260
6444
|
}
|
|
6261
6445
|
function firestoreIdentityTypeArrayName(input, separator = FIRESTORE_COLLECTION_NAME_SEPARATOR) {
|
|
6262
6446
|
return firestoreIdentityTypeArray(input).join(separator);
|
|
@@ -6278,7 +6462,7 @@ function firestoreModelKeyCollectionTypeArray(input) {
|
|
|
6278
6462
|
const key = readFirestoreModelKey(input);
|
|
6279
6463
|
let array;
|
|
6280
6464
|
if (key) {
|
|
6281
|
-
const pieces = key
|
|
6465
|
+
const pieces = key == null ? void 0 : key.split(FIRESTORE_COLLECTION_NAME_SEPARATOR);
|
|
6282
6466
|
if (util.isOddNumber(pieces.length)) {
|
|
6283
6467
|
throw new Error('input key source was a collection ref or unavailable.');
|
|
6284
6468
|
}
|
|
@@ -6297,8 +6481,8 @@ function firestoreModelKeyCollectionTypeArray(input) {
|
|
|
6297
6481
|
* @returns
|
|
6298
6482
|
*/
|
|
6299
6483
|
function firestoreModelKeyCollectionName(input) {
|
|
6300
|
-
var
|
|
6301
|
-
return (
|
|
6484
|
+
var _firestoreModelKeyTyp;
|
|
6485
|
+
return (_firestoreModelKeyTyp = firestoreModelKeyTypePair(input)) == null ? void 0 : _firestoreModelKeyTyp.collectionName;
|
|
6302
6486
|
}
|
|
6303
6487
|
/**
|
|
6304
6488
|
* Returns the parent model key from up the specified amount of levels.
|
|
@@ -6336,7 +6520,7 @@ function firestoreModelKeyPartPairs(input) {
|
|
|
6336
6520
|
const key = readFirestoreModelKey(input);
|
|
6337
6521
|
let pairs;
|
|
6338
6522
|
if (key) {
|
|
6339
|
-
const pieces = key
|
|
6523
|
+
const pieces = key == null ? void 0 : key.split(FIRESTORE_COLLECTION_NAME_SEPARATOR);
|
|
6340
6524
|
if (util.isOddNumber(pieces.length)) {
|
|
6341
6525
|
throw new Error('input key source was a collection ref or unavailable.');
|
|
6342
6526
|
}
|
|
@@ -6418,13 +6602,13 @@ function makeFirestoreCollection(inputConfig) {
|
|
|
6418
6602
|
const {
|
|
6419
6603
|
query
|
|
6420
6604
|
} = queryFactory;
|
|
6421
|
-
return Object.assign(
|
|
6605
|
+
return Object.assign({
|
|
6422
6606
|
config,
|
|
6423
6607
|
modelIdentity,
|
|
6424
6608
|
collection,
|
|
6425
6609
|
queryLike: collection,
|
|
6426
6610
|
firestoreContext
|
|
6427
|
-
}, documentAccessorExtension
|
|
6611
|
+
}, documentAccessorExtension, {
|
|
6428
6612
|
firestoreIteration,
|
|
6429
6613
|
query,
|
|
6430
6614
|
queryDocument
|
|
@@ -6464,12 +6648,12 @@ function makeFirestoreCollectionGroup(config) {
|
|
|
6464
6648
|
const {
|
|
6465
6649
|
query
|
|
6466
6650
|
} = queryFactory;
|
|
6467
|
-
return Object.assign(
|
|
6651
|
+
return Object.assign({
|
|
6468
6652
|
config,
|
|
6469
6653
|
queryLike,
|
|
6470
6654
|
modelIdentity,
|
|
6471
6655
|
firestoreContext
|
|
6472
|
-
}, documentAccessorExtension
|
|
6656
|
+
}, documentAccessorExtension, {
|
|
6473
6657
|
firestoreIteration,
|
|
6474
6658
|
query,
|
|
6475
6659
|
queryDocument
|
|
@@ -6487,7 +6671,7 @@ function makeFirestoreCollectionGroup(config) {
|
|
|
6487
6671
|
function makeFirestoreCollectionWithParent(config) {
|
|
6488
6672
|
const result = makeFirestoreCollection(config);
|
|
6489
6673
|
result.parent = config.parent;
|
|
6490
|
-
//
|
|
6674
|
+
// TODO: consider throwing an exception if parent is not provided.
|
|
6491
6675
|
return result;
|
|
6492
6676
|
}
|
|
6493
6677
|
|
|
@@ -6510,10 +6694,10 @@ function makeSingleItemFirestoreCollection(config) {
|
|
|
6510
6694
|
function firestoreContextFactory(drivers) {
|
|
6511
6695
|
return firestore => {
|
|
6512
6696
|
const makeFirestoreCollectionConfig = config => {
|
|
6513
|
-
var
|
|
6514
|
-
const queryLike = (
|
|
6515
|
-
return Object.assign(
|
|
6516
|
-
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,
|
|
6517
6701
|
queryLike: config.converter ? queryLike.withConverter(config.converter) : queryLike,
|
|
6518
6702
|
firestoreContext: context,
|
|
6519
6703
|
firestoreDriverIdentifier: drivers.firestoreDriverIdentifier,
|
|
@@ -6678,6 +6862,27 @@ var addToUnscopables = addToUnscopables$2;
|
|
|
6678
6862
|
// https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
|
|
6679
6863
|
addToUnscopables('flat');
|
|
6680
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
|
+
}
|
|
6681
6886
|
function firestoreIdBatchVerifierFactory(config) {
|
|
6682
6887
|
const {
|
|
6683
6888
|
readKeys
|
|
@@ -6685,12 +6890,13 @@ function firestoreIdBatchVerifierFactory(config) {
|
|
|
6685
6890
|
const fieldToQuery = config.fieldToQuery;
|
|
6686
6891
|
const makeQueryConstraints = config.makeQueryConstraints ? config.makeQueryConstraints : fieldToQuery === '_id' ? ids => whereDocumentId('in', ids) : ids => where(fieldToQuery, 'in', ids);
|
|
6687
6892
|
return collection => {
|
|
6688
|
-
const verify =
|
|
6893
|
+
const verify = _async$3(function (keys) {
|
|
6689
6894
|
const constraints = makeQueryConstraints(keys);
|
|
6690
|
-
|
|
6691
|
-
|
|
6692
|
-
|
|
6693
|
-
|
|
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
|
+
});
|
|
6694
6900
|
});
|
|
6695
6901
|
const verifier = {
|
|
6696
6902
|
maxBatchSize: FIRESTORE_MAX_WHERE_IN_FILTER_ARGS_COUNT,
|
|
@@ -6721,13 +6927,14 @@ function createWithAccessor(accessor) {
|
|
|
6721
6927
|
*/
|
|
6722
6928
|
function firestoreClientIncrementUpdateToUpdateData(input) {
|
|
6723
6929
|
return util.mapObjectMap(input, incrementValue => {
|
|
6724
|
-
return firestore.increment(incrementValue
|
|
6930
|
+
return firestore.increment(incrementValue != null ? incrementValue : 0);
|
|
6725
6931
|
});
|
|
6726
6932
|
}
|
|
6727
6933
|
|
|
6728
6934
|
// MARK: Accessor
|
|
6729
6935
|
class DefaultFirestoreDocumentDataAccessor {
|
|
6730
6936
|
constructor(documentRef) {
|
|
6937
|
+
this.documentRef = void 0;
|
|
6731
6938
|
this.documentRef = documentRef;
|
|
6732
6939
|
}
|
|
6733
6940
|
stream() {
|
|
@@ -6783,6 +6990,7 @@ function defaultFirestoreDocumentContext() {
|
|
|
6783
6990
|
class WriteBatchFirestoreDocumentDataAccessor extends DefaultFirestoreDocumentDataAccessor {
|
|
6784
6991
|
constructor(batch, documentRef) {
|
|
6785
6992
|
super(documentRef);
|
|
6993
|
+
this.batch = void 0;
|
|
6786
6994
|
this.batch = batch;
|
|
6787
6995
|
}
|
|
6788
6996
|
delete() {
|
|
@@ -6813,8 +7021,10 @@ function writeBatchAccessorFactory(writeBatch) {
|
|
|
6813
7021
|
// MARK: Context
|
|
6814
7022
|
class WriteBatchFirestoreDocumentContext {
|
|
6815
7023
|
constructor(batch) {
|
|
6816
|
-
this.batch =
|
|
7024
|
+
this.batch = void 0;
|
|
6817
7025
|
this.contextType = exports.FirestoreDocumentContextType.BATCH;
|
|
7026
|
+
this.accessorFactory = void 0;
|
|
7027
|
+
this.batch = batch;
|
|
6818
7028
|
this.accessorFactory = writeBatchAccessorFactory(this.batch);
|
|
6819
7029
|
}
|
|
6820
7030
|
}
|
|
@@ -6828,6 +7038,8 @@ function writeBatchDocumentContext(batch) {
|
|
|
6828
7038
|
*/
|
|
6829
7039
|
class TransactionFirestoreDocumentDataAccessor {
|
|
6830
7040
|
constructor(transaction, documentRef) {
|
|
7041
|
+
this.transaction = void 0;
|
|
7042
|
+
this.documentRef = void 0;
|
|
6831
7043
|
this.transaction = transaction;
|
|
6832
7044
|
this.documentRef = documentRef;
|
|
6833
7045
|
}
|
|
@@ -6878,8 +7090,10 @@ function transactionAccessorFactory(transaction) {
|
|
|
6878
7090
|
// MARK: Context
|
|
6879
7091
|
class TransactionFirestoreDocumentContext {
|
|
6880
7092
|
constructor(transaction) {
|
|
6881
|
-
this.transaction =
|
|
7093
|
+
this.transaction = void 0;
|
|
6882
7094
|
this.contextType = exports.FirestoreDocumentContextType.TRANSACTION;
|
|
7095
|
+
this.accessorFactory = void 0;
|
|
7096
|
+
this.transaction = transaction;
|
|
6883
7097
|
this.accessorFactory = transactionAccessorFactory(this.transaction);
|
|
6884
7098
|
}
|
|
6885
7099
|
}
|
|
@@ -6887,6 +7101,18 @@ function transactionDocumentContext(transaction) {
|
|
|
6887
7101
|
return new TransactionFirestoreDocumentContext(transaction);
|
|
6888
7102
|
}
|
|
6889
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
|
+
}
|
|
6890
7116
|
function firestoreClientAccessorDriver() {
|
|
6891
7117
|
return {
|
|
6892
7118
|
doc: firestore.doc,
|
|
@@ -6894,8 +7120,8 @@ function firestoreClientAccessorDriver() {
|
|
|
6894
7120
|
collectionGroup: firestore.collectionGroup,
|
|
6895
7121
|
collection: firestore.collection,
|
|
6896
7122
|
subcollection: firestore.collection,
|
|
6897
|
-
transactionFactoryForFirestore: firestore$1 =>
|
|
6898
|
-
return
|
|
7123
|
+
transactionFactoryForFirestore: firestore$1 => _async$2(function (fn) {
|
|
7124
|
+
return firestore.runTransaction(firestore$1, fn);
|
|
6899
7125
|
}),
|
|
6900
7126
|
writeBatchFactoryForFirestore: firestore$1 => () => firestore.writeBatch(firestore$1),
|
|
6901
7127
|
defaultContextFactory: defaultFirestoreDocumentContext,
|
|
@@ -6940,7 +7166,7 @@ function firebaseFirestoreQueryConstraintFunctionsDriver() {
|
|
|
6940
7166
|
});
|
|
6941
7167
|
}
|
|
6942
7168
|
function firebaseFirestoreQueryDriver() {
|
|
6943
|
-
return Object.assign(
|
|
7169
|
+
return Object.assign({}, firebaseFirestoreQueryConstraintFunctionsDriver(), {
|
|
6944
7170
|
countDocs(query) {
|
|
6945
7171
|
return firestore.getCountFromServer(query).then(x => x.data().count);
|
|
6946
7172
|
},
|
|
@@ -6983,6 +7209,7 @@ class FirebaseServerError extends util.ServerErrorResponse {
|
|
|
6983
7209
|
}
|
|
6984
7210
|
constructor(firebaseError, serverError) {
|
|
6985
7211
|
super(serverError);
|
|
7212
|
+
this.firebaseError = void 0;
|
|
6986
7213
|
this.firebaseError = firebaseError;
|
|
6987
7214
|
}
|
|
6988
7215
|
get _error() {
|
|
@@ -6990,27 +7217,62 @@ class FirebaseServerError extends util.ServerErrorResponse {
|
|
|
6990
7217
|
}
|
|
6991
7218
|
}
|
|
6992
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
|
+
}
|
|
6993
7252
|
function mapHttpsCallable(callable, wrap, directData = false) {
|
|
6994
7253
|
const {
|
|
6995
7254
|
mapInput = x => x,
|
|
6996
7255
|
mapOutput = x => x
|
|
6997
7256
|
} = wrap;
|
|
6998
|
-
return
|
|
6999
|
-
|
|
7000
|
-
|
|
7001
|
-
|
|
7002
|
-
|
|
7003
|
-
|
|
7004
|
-
|
|
7005
|
-
|
|
7006
|
-
|
|
7007
|
-
|
|
7008
|
-
|
|
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
|
+
});
|
|
7009
7271
|
});
|
|
7010
|
-
}
|
|
7011
|
-
|
|
7012
|
-
|
|
7013
|
-
}
|
|
7272
|
+
}, function (e) {
|
|
7273
|
+
throw convertHttpsCallableErrorToReadableError(e);
|
|
7274
|
+
});
|
|
7275
|
+
});
|
|
7014
7276
|
});
|
|
7015
7277
|
}
|
|
7016
7278
|
function directDataHttpsCallable(callable) {
|
|
@@ -7083,6 +7345,20 @@ function onCallTypedModelParamsFunction(call) {
|
|
|
7083
7345
|
return result;
|
|
7084
7346
|
};
|
|
7085
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
|
+
}
|
|
7086
7362
|
/**
|
|
7087
7363
|
* Pre-configured OnCallTypedModelParamsFunctions for 'create'
|
|
7088
7364
|
*/
|
|
@@ -7099,18 +7375,6 @@ const onCallUpdateModelParams = onCallTypedModelParamsFunction('update');
|
|
|
7099
7375
|
* Pre-configured OnCallTypedModelParamsFunctions for 'delete'
|
|
7100
7376
|
*/
|
|
7101
7377
|
const onCallDeleteModelParams = onCallTypedModelParamsFunction('delete');
|
|
7102
|
-
/**
|
|
7103
|
-
* Creates a OnCallTypedModelParams
|
|
7104
|
-
*
|
|
7105
|
-
* @deprecated use onCallTypedModelParamsFunction instead.
|
|
7106
|
-
*
|
|
7107
|
-
* @param modelType
|
|
7108
|
-
* @param data
|
|
7109
|
-
* @returns
|
|
7110
|
-
*/
|
|
7111
|
-
function onCallTypedModelParams(modelTypeInput, data, specifier, call) {
|
|
7112
|
-
return onCallTypedModelParamsFunction(call)(modelTypeInput, data, specifier);
|
|
7113
|
-
}
|
|
7114
7378
|
/**
|
|
7115
7379
|
* Key used on the front-end and backend that refers to the call function.
|
|
7116
7380
|
*/
|
|
@@ -7123,31 +7387,6 @@ function onCallCreateModelResult(modelKeys) {
|
|
|
7123
7387
|
modelKeys: util.asArray(modelKeys)
|
|
7124
7388
|
};
|
|
7125
7389
|
}
|
|
7126
|
-
// MARK: Compat
|
|
7127
|
-
/**
|
|
7128
|
-
* Key used on the front-end and backend that refers to a specific function for creating models.
|
|
7129
|
-
*
|
|
7130
|
-
* @deprecated Replaced by the callModel function.
|
|
7131
|
-
*/
|
|
7132
|
-
const CREATE_MODEL_APP_FUNCTION_KEY = 'createModel';
|
|
7133
|
-
/**
|
|
7134
|
-
* Key used on the front-end and backend that refers to a specific function for reading models.
|
|
7135
|
-
*
|
|
7136
|
-
* @deprecated Replaced by the callModel function.
|
|
7137
|
-
*/
|
|
7138
|
-
const READ_MODEL_APP_FUNCTION_KEY = 'readModel';
|
|
7139
|
-
/**
|
|
7140
|
-
* Key used on the front-end and backend that refers to a specific function for updating models.
|
|
7141
|
-
*
|
|
7142
|
-
* @deprecated Replaced by the callModel function.
|
|
7143
|
-
*/
|
|
7144
|
-
const UPDATE_MODEL_APP_FUNCTION_KEY = 'updateModel';
|
|
7145
|
-
/**
|
|
7146
|
-
* Key used on the front-end and backend that refers to a specific function for deleting models.
|
|
7147
|
-
*
|
|
7148
|
-
* @deprecated Replaced by the callModel function.
|
|
7149
|
-
*/
|
|
7150
|
-
const DELETE_MODEL_APP_FUNCTION_KEY = 'deleteModel';
|
|
7151
7390
|
|
|
7152
7391
|
const MODEL_FUNCTION_FIREBASE_CRUD_FUNCTION_SPECIFIER_DEFAULT = '_';
|
|
7153
7392
|
const MODEL_FUNCTION_FIREBASE_CRUD_FUNCTION_SPECIFIER_SPLITTER = ',';
|
|
@@ -7165,7 +7404,7 @@ function callModelFirebaseFunctionMapFactory(configMap, crudConfigMap) {
|
|
|
7165
7404
|
const _callFn = util.cachedGetter(() => functions.httpsCallable(functionsInstance, CALL_MODEL_APP_FUNCTION_KEY));
|
|
7166
7405
|
function makeCallFunction(call, fn, modelType, specifier) {
|
|
7167
7406
|
return mapHttpsCallable(fn(), {
|
|
7168
|
-
mapInput: data =>
|
|
7407
|
+
mapInput: data => onCallTypedModelParamsFunction(call)(modelType, data, specifier)
|
|
7169
7408
|
}, true);
|
|
7170
7409
|
}
|
|
7171
7410
|
function makeCallSpecifiers(call, fn, modelType, specifierKeys) {
|
|
@@ -7234,94 +7473,6 @@ function callModelFirebaseFunctionMapFactory(configMap, crudConfigMap) {
|
|
|
7234
7473
|
return result;
|
|
7235
7474
|
};
|
|
7236
7475
|
}
|
|
7237
|
-
// MARK: Compat
|
|
7238
|
-
/**
|
|
7239
|
-
* @deprecated move to using callModelFirebaseFunctionMapFactory instead and the call configuration in general.
|
|
7240
|
-
*
|
|
7241
|
-
* This will be removed in the next release.
|
|
7242
|
-
*
|
|
7243
|
-
* @param configMap
|
|
7244
|
-
* @param crudConfigMap
|
|
7245
|
-
* @returns
|
|
7246
|
-
*/
|
|
7247
|
-
function modelFirebaseFunctionMapFactory(configMap, crudConfigMap) {
|
|
7248
|
-
const functionFactory = firebaseFunctionMapFactory(configMap);
|
|
7249
|
-
return functionsInstance => {
|
|
7250
|
-
const functionMap = functionFactory(functionsInstance);
|
|
7251
|
-
const _readFn = util.cachedGetter(() => functions.httpsCallable(functionsInstance, READ_MODEL_APP_FUNCTION_KEY));
|
|
7252
|
-
const _createFn = util.cachedGetter(() => functions.httpsCallable(functionsInstance, CREATE_MODEL_APP_FUNCTION_KEY));
|
|
7253
|
-
const _updateFn = util.cachedGetter(() => functions.httpsCallable(functionsInstance, UPDATE_MODEL_APP_FUNCTION_KEY));
|
|
7254
|
-
const _deleteFn = util.cachedGetter(() => functions.httpsCallable(functionsInstance, DELETE_MODEL_APP_FUNCTION_KEY));
|
|
7255
|
-
function makeCrudFunction(fn, modelType, specifier) {
|
|
7256
|
-
return mapHttpsCallable(fn(), {
|
|
7257
|
-
mapInput: data => onCallTypedModelParams(modelType, data, specifier)
|
|
7258
|
-
}, true);
|
|
7259
|
-
}
|
|
7260
|
-
function makeCrudSpecifiers(crud, fn, modelType, specifierKeys) {
|
|
7261
|
-
const modelTypeSuffix = util.capitalizeFirstLetter(modelType);
|
|
7262
|
-
const specifiers = {};
|
|
7263
|
-
specifierKeys.forEach(inputSpecifier => {
|
|
7264
|
-
const specifier = inputSpecifier === MODEL_FUNCTION_FIREBASE_CRUD_FUNCTION_SPECIFIER_DEFAULT ? '' : inputSpecifier;
|
|
7265
|
-
const specifierFn = makeCrudFunction(fn, modelType, inputSpecifier);
|
|
7266
|
-
const fullSpecifierName = `${crud}${modelTypeSuffix}${util.capitalizeFirstLetter(specifier)}`;
|
|
7267
|
-
specifiers[fullSpecifierName] = specifierFn;
|
|
7268
|
-
const shortSpecifierName = util.lowercaseFirstLetter(specifier) || crud;
|
|
7269
|
-
specifiers[shortSpecifierName] = specifierFn;
|
|
7270
|
-
});
|
|
7271
|
-
return specifiers;
|
|
7272
|
-
}
|
|
7273
|
-
const result = util.build({
|
|
7274
|
-
base: functionMap,
|
|
7275
|
-
build: x => {
|
|
7276
|
-
Object.entries(crudConfigMap).forEach(([modelType, config]) => {
|
|
7277
|
-
const modelTypeSuffix = util.capitalizeFirstLetter(modelType);
|
|
7278
|
-
const {
|
|
7279
|
-
included: crudFunctionKeys,
|
|
7280
|
-
excluded: specifiedCrudFunctionKeys
|
|
7281
|
-
} = util.separateValues(config, x => x.indexOf(':') === -1);
|
|
7282
|
-
const crudFunctions = new Set(crudFunctionKeys);
|
|
7283
|
-
const specifiedCrudFunctionTuples = specifiedCrudFunctionKeys.map(x => {
|
|
7284
|
-
const [crud, functionsSplit] = x.split(':', 2);
|
|
7285
|
-
const functions = functionsSplit.split(MODEL_FUNCTION_FIREBASE_CRUD_FUNCTION_SPECIFIER_SPLITTER);
|
|
7286
|
-
return [crud, functions];
|
|
7287
|
-
});
|
|
7288
|
-
// check that there isn't a repeat crud key configured, which disallowed configuration and would cause some functions to be ignored
|
|
7289
|
-
const encounteredCruds = new Set();
|
|
7290
|
-
function assertCrudKeyNotEncountered(crud) {
|
|
7291
|
-
if (encounteredCruds.has(crud)) {
|
|
7292
|
-
throw new Error(`Cannot have multiple declarations of the same crud. Found repeat for crud: ${crud}`);
|
|
7293
|
-
} else {
|
|
7294
|
-
encounteredCruds.add(crud);
|
|
7295
|
-
}
|
|
7296
|
-
}
|
|
7297
|
-
crudFunctions.forEach(assertCrudKeyNotEncountered);
|
|
7298
|
-
specifiedCrudFunctionTuples.forEach(([crud]) => assertCrudKeyNotEncountered(crud));
|
|
7299
|
-
// build and add the functions
|
|
7300
|
-
const specifierFunctions = new Map(specifiedCrudFunctionTuples);
|
|
7301
|
-
function addFunctions(crud, fn, modelType) {
|
|
7302
|
-
let crudFns;
|
|
7303
|
-
if (crudFunctions.has(crud)) {
|
|
7304
|
-
crudFns = makeCrudFunction(fn, modelType);
|
|
7305
|
-
} else if (specifierFunctions.has(crud)) {
|
|
7306
|
-
crudFns = makeCrudSpecifiers(crud, fn, modelType, specifierFunctions.get(crud));
|
|
7307
|
-
}
|
|
7308
|
-
if (crudFns) {
|
|
7309
|
-
modelTypeCruds[`${crud}${modelTypeSuffix}`] = crudFns;
|
|
7310
|
-
}
|
|
7311
|
-
}
|
|
7312
|
-
const modelTypeCruds = {};
|
|
7313
|
-
addFunctions('create', _createFn, modelType);
|
|
7314
|
-
addFunctions('read', _readFn, modelType);
|
|
7315
|
-
addFunctions('update', _updateFn, modelType);
|
|
7316
|
-
addFunctions('delete', _deleteFn, modelType);
|
|
7317
|
-
// tslint:disable-next-line
|
|
7318
|
-
x[modelType] = modelTypeCruds;
|
|
7319
|
-
});
|
|
7320
|
-
}
|
|
7321
|
-
});
|
|
7322
|
-
return result;
|
|
7323
|
-
};
|
|
7324
|
-
}
|
|
7325
7476
|
|
|
7326
7477
|
/**
|
|
7327
7478
|
* Creates an OnCallDevelopmentParams
|
|
@@ -7443,8 +7594,8 @@ const FIREBASE_SERVER_AUTH_CLAIMS_RESET_LAST_COM_DATE_KEY = 'resetCommunicationA
|
|
|
7443
7594
|
|
|
7444
7595
|
const useContextAuth = util.mappedUseFunction(x => x.auth);
|
|
7445
7596
|
const useContextAuthUid = util.mappedUseFunction(x => {
|
|
7446
|
-
var
|
|
7447
|
-
return (
|
|
7597
|
+
var _x$auth;
|
|
7598
|
+
return (_x$auth = x.auth) == null ? void 0 : _x$auth.uid;
|
|
7448
7599
|
});
|
|
7449
7600
|
|
|
7450
7601
|
const FIREBASE_AUTH_USER_NOT_FOUND_ERROR = 'auth/user-not-found';
|
|
@@ -7484,15 +7635,58 @@ function firebaseAuthErrorToReadableError(inputError) {
|
|
|
7484
7635
|
return error;
|
|
7485
7636
|
}
|
|
7486
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
|
+
|
|
7487
7669
|
exports.ScheduledFunctionDevelopmentFunctionTypeEnum = void 0;
|
|
7488
7670
|
(function (ScheduledFunctionDevelopmentFunctionTypeEnum) {
|
|
7489
7671
|
ScheduledFunctionDevelopmentFunctionTypeEnum["LIST"] = "list";
|
|
7490
7672
|
ScheduledFunctionDevelopmentFunctionTypeEnum["RUN"] = "run";
|
|
7491
7673
|
})(exports.ScheduledFunctionDevelopmentFunctionTypeEnum || (exports.ScheduledFunctionDevelopmentFunctionTypeEnum = {}));
|
|
7492
|
-
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
|
+
}
|
|
7493
7683
|
__decorate([classTransformer.Expose(), classValidator.IsEnum(exports.ScheduledFunctionDevelopmentFunctionTypeEnum), __metadata("design:type", String)], ScheduledFunctionDevelopmentFirebaseFunctionParams.prototype, "type", void 0);
|
|
7494
7684
|
__decorate([classTransformer.Expose(), classValidator.IsString(), classValidator.IsOptional(), __metadata("design:type", String)], ScheduledFunctionDevelopmentFirebaseFunctionParams.prototype, "run", void 0);
|
|
7495
|
-
class ScheduledFunctionDevelopmentFirebaseFunctionListEntry {
|
|
7685
|
+
class ScheduledFunctionDevelopmentFirebaseFunctionListEntry {
|
|
7686
|
+
constructor() {
|
|
7687
|
+
this.name = void 0;
|
|
7688
|
+
}
|
|
7689
|
+
}
|
|
7496
7690
|
/**
|
|
7497
7691
|
* Key used on the front-end and backend that refers to the specifier for the scheduled functions access.
|
|
7498
7692
|
*/
|
|
@@ -7526,7 +7720,7 @@ function IsFirestoreModelKey(validationOptions) {
|
|
|
7526
7720
|
options: validationOptions,
|
|
7527
7721
|
validator: {
|
|
7528
7722
|
validate: isFirestoreModelKey,
|
|
7529
|
-
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)
|
|
7530
7724
|
}
|
|
7531
7725
|
});
|
|
7532
7726
|
};
|
|
@@ -7543,7 +7737,7 @@ function IsFirestoreModelId(validationOptions) {
|
|
|
7543
7737
|
options: validationOptions,
|
|
7544
7738
|
validator: {
|
|
7545
7739
|
validate: isFirestoreModelId,
|
|
7546
|
-
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)
|
|
7547
7741
|
}
|
|
7548
7742
|
});
|
|
7549
7743
|
};
|
|
@@ -7560,7 +7754,7 @@ function IsFirestoreModelIdOrKey(validationOptions) {
|
|
|
7560
7754
|
options: validationOptions,
|
|
7561
7755
|
validator: {
|
|
7562
7756
|
validate: isFirestoreModelIdOrKey,
|
|
7563
|
-
defaultMessage: classValidator.buildMessage((eachPrefix, args) => eachPrefix + `$property value of "${args
|
|
7757
|
+
defaultMessage: classValidator.buildMessage((eachPrefix, args) => eachPrefix + `$property value of "${args == null ? void 0 : args.value}" is not a FirestoreModelId or FirestoreModelKey.`, validationOptions)
|
|
7564
7758
|
}
|
|
7565
7759
|
});
|
|
7566
7760
|
};
|
|
@@ -7569,40 +7763,79 @@ function IsFirestoreModelIdOrKey(validationOptions) {
|
|
|
7569
7763
|
/**
|
|
7570
7764
|
* Simple annotated params that implements FirestoreModelKeyRef.
|
|
7571
7765
|
*/
|
|
7572
|
-
class TargetModelParams {
|
|
7766
|
+
class TargetModelParams {
|
|
7767
|
+
constructor() {
|
|
7768
|
+
this.key = void 0;
|
|
7769
|
+
}
|
|
7770
|
+
}
|
|
7573
7771
|
__decorate([classTransformer.Expose(), classValidator.IsNotEmpty(), IsFirestoreModelKey(), __metadata("design:type", String)], TargetModelParams.prototype, "key", void 0);
|
|
7574
|
-
class InferredTargetModelParams {
|
|
7772
|
+
class InferredTargetModelParams {
|
|
7773
|
+
constructor() {
|
|
7774
|
+
this.key = void 0;
|
|
7775
|
+
}
|
|
7776
|
+
}
|
|
7575
7777
|
__decorate([classTransformer.Expose(), classValidator.IsOptional(), classValidator.IsNotEmpty(), IsFirestoreModelKey(), __metadata("design:type", String)], InferredTargetModelParams.prototype, "key", void 0);
|
|
7576
7778
|
/**
|
|
7577
7779
|
* Simple annotated params that implements FirestoreModelKeyRef but key is a FirestoreModelId.
|
|
7578
7780
|
*/
|
|
7579
|
-
class TargetModelIdParams {
|
|
7781
|
+
class TargetModelIdParams {
|
|
7782
|
+
constructor() {
|
|
7783
|
+
this.key = void 0;
|
|
7784
|
+
}
|
|
7785
|
+
}
|
|
7580
7786
|
__decorate([classTransformer.Expose(), classValidator.IsNotEmpty(), IsFirestoreModelId(), __metadata("design:type", String)], TargetModelIdParams.prototype, "key", void 0);
|
|
7581
|
-
class InferredTargetModelIdParams {
|
|
7787
|
+
class InferredTargetModelIdParams {
|
|
7788
|
+
constructor() {
|
|
7789
|
+
this.key = void 0;
|
|
7790
|
+
}
|
|
7791
|
+
}
|
|
7582
7792
|
__decorate([classTransformer.Expose(), classValidator.IsOptional(), classValidator.IsNotEmpty(), IsFirestoreModelId(), __metadata("design:type", String)], InferredTargetModelIdParams.prototype, "key", void 0);
|
|
7583
7793
|
|
|
7584
7794
|
/**
|
|
7585
7795
|
* Abstract AbstractModelPermissionService implementation for FirebaseModelsPermissionService.
|
|
7586
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
|
+
}
|
|
7587
7818
|
class FirebaseModelPermissionServiceInstance extends model.AbstractModelPermissionService {
|
|
7588
7819
|
constructor(delegate) {
|
|
7589
7820
|
super(delegate);
|
|
7821
|
+
this.delegate = void 0;
|
|
7590
7822
|
this.delegate = delegate;
|
|
7591
7823
|
}
|
|
7592
7824
|
roleMapForModel(output, context, model) {
|
|
7593
7825
|
return this.delegate.roleMapForModel(output, context, model);
|
|
7594
7826
|
}
|
|
7595
7827
|
outputForModel(document) {
|
|
7596
|
-
return
|
|
7597
|
-
|
|
7598
|
-
|
|
7599
|
-
|
|
7600
|
-
|
|
7601
|
-
|
|
7602
|
-
|
|
7603
|
-
|
|
7604
|
-
|
|
7605
|
-
|
|
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
|
+
});
|
|
7606
7839
|
});
|
|
7607
7840
|
}
|
|
7608
7841
|
isUsableOutputForRoles(output) {
|
|
@@ -7615,6 +7848,8 @@ function firebaseModelPermissionService(delegate) {
|
|
|
7615
7848
|
|
|
7616
7849
|
class ContextGrantedModelRolesReaderInstance {
|
|
7617
7850
|
constructor(contextGrantedModelRoles) {
|
|
7851
|
+
this.contextGrantedModelRoles = void 0;
|
|
7852
|
+
this._roleReader = void 0;
|
|
7618
7853
|
this.contextGrantedModelRoles = contextGrantedModelRoles;
|
|
7619
7854
|
this._roleReader = model.grantedRoleMapReader(contextGrantedModelRoles.roleMap);
|
|
7620
7855
|
}
|
|
@@ -7676,13 +7911,13 @@ class ContextGrantedModelRolesReaderInstance {
|
|
|
7676
7911
|
return this;
|
|
7677
7912
|
}
|
|
7678
7913
|
throwDoesNotExistError() {
|
|
7679
|
-
var
|
|
7680
|
-
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));
|
|
7681
7916
|
throw error;
|
|
7682
7917
|
}
|
|
7683
7918
|
throwPermissionError(role) {
|
|
7684
|
-
var
|
|
7685
|
-
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));
|
|
7686
7921
|
throw error;
|
|
7687
7922
|
}
|
|
7688
7923
|
}
|
|
@@ -7700,9 +7935,9 @@ function contextGrantedModelRolesReader(service) {
|
|
|
7700
7935
|
* @returns
|
|
7701
7936
|
*/
|
|
7702
7937
|
function contextGrantedModelRolesReaderPermissionErrorMessage(contextGrantedModelRoles, roles) {
|
|
7703
|
-
var
|
|
7704
|
-
let message = `Permissions Error ("${(
|
|
7705
|
-
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) {
|
|
7706
7941
|
message = `${message}: required role(s) "${roles}"`;
|
|
7707
7942
|
}
|
|
7708
7943
|
return message;
|
|
@@ -7715,8 +7950,8 @@ function contextGrantedModelRolesReaderPermissionErrorMessage(contextGrantedMode
|
|
|
7715
7950
|
* @returns
|
|
7716
7951
|
*/
|
|
7717
7952
|
function contextGrantedModelRolesReaderDoesNotExistErrorMessage(contextGrantedModelRoles) {
|
|
7718
|
-
var
|
|
7719
|
-
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}")`;
|
|
7720
7955
|
return message;
|
|
7721
7956
|
}
|
|
7722
7957
|
|
|
@@ -7727,18 +7962,54 @@ function contextGrantedModelRolesReaderDoesNotExistErrorMessage(contextGrantedMo
|
|
|
7727
7962
|
* @param context
|
|
7728
7963
|
* @returns
|
|
7729
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
|
+
}
|
|
7730
8009
|
const isAdminInFirebaseModelContext = context => {
|
|
7731
|
-
var
|
|
7732
|
-
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;
|
|
7733
8012
|
};
|
|
7734
|
-
/**
|
|
7735
|
-
* Convenience function that checks the input context if the user is an admin or not and grants pre-set admin roles if they are.
|
|
7736
|
-
*
|
|
7737
|
-
* @param context
|
|
7738
|
-
* @param rolesToGrantToAdmin
|
|
7739
|
-
* @param otherwise
|
|
7740
|
-
* @returns
|
|
7741
|
-
*/
|
|
7742
8013
|
function grantModelRolesIfAdminFunction(rolesToGrantToAdmin) {
|
|
7743
8014
|
return grantModelRolesIfFunction(isAdminInFirebaseModelContext, rolesToGrantToAdmin);
|
|
7744
8015
|
}
|
|
@@ -7760,8 +8031,8 @@ function grantModelRolesIfAdmin(context, rolesToGrantToAdmin, otherwise) {
|
|
|
7760
8031
|
*/
|
|
7761
8032
|
function grantModelRolesIfHasAuthRolesFunction(authRoles, rolesToGrantToAdmin) {
|
|
7762
8033
|
return grantModelRolesIfFunction(context => {
|
|
7763
|
-
var
|
|
7764
|
-
const currentAuthRoles = (
|
|
8034
|
+
var _context$auth2;
|
|
8035
|
+
const currentAuthRoles = (_context$auth2 = context.auth) == null ? void 0 : _context$auth2.getAuthRoles();
|
|
7765
8036
|
if (currentAuthRoles) {
|
|
7766
8037
|
return util.setContainsAllValues(currentAuthRoles, authRoles);
|
|
7767
8038
|
} else {
|
|
@@ -7781,22 +8052,32 @@ function grantModelRolesIfHasAuthRolesFactory(authRoles) {
|
|
|
7781
8052
|
* @param context
|
|
7782
8053
|
* @returns
|
|
7783
8054
|
*/
|
|
7784
|
-
const isOwnerOfUserRelatedModelInFirebaseModelContext =
|
|
8055
|
+
const isOwnerOfUserRelatedModelInFirebaseModelContext = _async(function (context) {
|
|
7785
8056
|
let decision = false;
|
|
7786
8057
|
const auth = context.context.auth;
|
|
7787
|
-
|
|
7788
|
-
|
|
7789
|
-
|
|
7790
|
-
|
|
7791
|
-
|
|
7792
|
-
|
|
7793
|
-
|
|
7794
|
-
|
|
7795
|
-
|
|
7796
|
-
|
|
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
|
+
});
|
|
7797
8077
|
}
|
|
7798
|
-
}
|
|
7799
|
-
|
|
8078
|
+
}, function () {
|
|
8079
|
+
return decision;
|
|
8080
|
+
});
|
|
7800
8081
|
});
|
|
7801
8082
|
/**
|
|
7802
8083
|
* Creates a GrantRolesIfFunction that grants roles if the user is related to the model by uid.
|
|
@@ -7835,11 +8116,12 @@ function grantModelRolesIfFunction(grantIf, grantedRoles) {
|
|
|
7835
8116
|
if (!grantIf) {
|
|
7836
8117
|
throw new Error('missing grant if');
|
|
7837
8118
|
}
|
|
7838
|
-
return (context, otherwise = model.noAccessRoleMap)
|
|
7839
|
-
|
|
7840
|
-
|
|
7841
|
-
|
|
7842
|
-
|
|
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
|
+
});
|
|
7843
8125
|
});
|
|
7844
8126
|
}
|
|
7845
8127
|
|
|
@@ -7916,7 +8198,7 @@ function inContextFirebaseModelServiceFactory(factory) {
|
|
|
7916
8198
|
function firebaseModelsService(services) {
|
|
7917
8199
|
const firebaseModelsServiceFunction = (type, context) => {
|
|
7918
8200
|
const firebaseModelService = services[type];
|
|
7919
|
-
const contextWithService = Object.assign(
|
|
8201
|
+
const contextWithService = Object.assign({}, context, {
|
|
7920
8202
|
service: firebaseModelsServiceFunction
|
|
7921
8203
|
});
|
|
7922
8204
|
const service = inContextFirebaseModelServiceFactory(firebaseModelService)(contextWithService);
|
|
@@ -7981,7 +8263,7 @@ const MODEL_STORAGE_FILE_SLASH_PATH_FACTORY = util.slashPathFactory({
|
|
|
7981
8263
|
function modelStorageSlashPathFactory(config) {
|
|
7982
8264
|
const {
|
|
7983
8265
|
basePath
|
|
7984
|
-
} = config
|
|
8266
|
+
} = config != null ? config : {};
|
|
7985
8267
|
return (input, path) => {
|
|
7986
8268
|
const key = readFirestoreModelKey(input, true);
|
|
7987
8269
|
return MODEL_STORAGE_FILE_SLASH_PATH_FACTORY([basePath, key, path]);
|
|
@@ -7989,7 +8271,7 @@ function modelStorageSlashPathFactory(config) {
|
|
|
7989
8271
|
}
|
|
7990
8272
|
|
|
7991
8273
|
function assertStorageUploadOptionsStringFormat(options) {
|
|
7992
|
-
const stringFormat = options
|
|
8274
|
+
const stringFormat = options == null ? void 0 : options.stringFormat;
|
|
7993
8275
|
if (!stringFormat) {
|
|
7994
8276
|
throw noStringFormatInStorageUploadOptionsError();
|
|
7995
8277
|
}
|
|
@@ -8042,12 +8324,11 @@ function storageListFilesResultHasNoNextError() {
|
|
|
8042
8324
|
*/
|
|
8043
8325
|
function firebaseStorageContextFactory(drivers) {
|
|
8044
8326
|
return (firebaseStorage, config) => {
|
|
8045
|
-
var _a, _b;
|
|
8046
8327
|
const {
|
|
8047
8328
|
defaultBucketId: inputDefaultBucketId,
|
|
8048
8329
|
forceBucket = false
|
|
8049
|
-
} = config
|
|
8050
|
-
const defaultBucketId = inputDefaultBucketId || (
|
|
8330
|
+
} = config != null ? config : {};
|
|
8331
|
+
const defaultBucketId = inputDefaultBucketId || (drivers.storageAccessorDriver.defaultBucket == null ? void 0 : drivers.storageAccessorDriver.defaultBucket(firebaseStorage)) || '';
|
|
8051
8332
|
if (!defaultBucketId) {
|
|
8052
8333
|
throw new Error('Could not resolve a default bucket id for the firebaseStorageContextFactory(). Supply a defaultBucketId.');
|
|
8053
8334
|
}
|
|
@@ -8085,9 +8366,9 @@ function firebaseStorageClientAccessorFile(storage$1, storagePath) {
|
|
|
8085
8366
|
metadata
|
|
8086
8367
|
} = options;
|
|
8087
8368
|
if (options.contentType || options.metadata) {
|
|
8088
|
-
result = Object.assign(
|
|
8369
|
+
result = Object.assign({}, contentType ? {
|
|
8089
8370
|
contentType
|
|
8090
|
-
} : undefined
|
|
8371
|
+
} : undefined, metadata);
|
|
8091
8372
|
}
|
|
8092
8373
|
}
|
|
8093
8374
|
return result;
|
|
@@ -8129,7 +8410,7 @@ const firebaseStorageClientListFilesResultFactory = storageListFilesResultFactor
|
|
|
8129
8410
|
return result.listResult.nextPageToken != null;
|
|
8130
8411
|
},
|
|
8131
8412
|
next(storage, folder, result) {
|
|
8132
|
-
return folder.list(Object.assign(
|
|
8413
|
+
return folder.list(Object.assign({}, result.options, {
|
|
8133
8414
|
pageToken: result.listResult.nextPageToken
|
|
8134
8415
|
}));
|
|
8135
8416
|
},
|
|
@@ -8176,8 +8457,8 @@ function firebaseStorageClientAccessorFolder(storage$1, storagePath) {
|
|
|
8176
8457
|
function firebaseStorageClientAccessorDriver() {
|
|
8177
8458
|
return {
|
|
8178
8459
|
defaultBucket: storage => {
|
|
8179
|
-
var
|
|
8180
|
-
return (
|
|
8460
|
+
var _storage$app$options$;
|
|
8461
|
+
return (_storage$app$options$ = storage.app.options.storageBucket) != null ? _storage$app$options$ : '';
|
|
8181
8462
|
},
|
|
8182
8463
|
file: (storage, path) => firebaseStorageClientAccessorFile(storage, path),
|
|
8183
8464
|
folder: (storage, path) => firebaseStorageClientAccessorFolder(storage, path)
|
|
@@ -8246,7 +8527,6 @@ exports.AbstractFirestoreDocumentWithParent = AbstractFirestoreDocumentWithParen
|
|
|
8246
8527
|
exports.BASE_MODEL_STORAGE_FILE_PATH = BASE_MODEL_STORAGE_FILE_PATH;
|
|
8247
8528
|
exports.CALL_MODEL_APP_FUNCTION_KEY = CALL_MODEL_APP_FUNCTION_KEY;
|
|
8248
8529
|
exports.COPY_USER_RELATED_DATA_ACCESSOR_FACTORY_FUNCTION = COPY_USER_RELATED_DATA_ACCESSOR_FACTORY_FUNCTION;
|
|
8249
|
-
exports.CREATE_MODEL_APP_FUNCTION_KEY = CREATE_MODEL_APP_FUNCTION_KEY;
|
|
8250
8530
|
exports.ContextGrantedModelRolesReaderInstance = ContextGrantedModelRolesReaderInstance;
|
|
8251
8531
|
exports.DEFAULT_DATE_CELL_RANGE_VALUE = DEFAULT_DATE_CELL_RANGE_VALUE;
|
|
8252
8532
|
exports.DEFAULT_FIRESTORE_DATE_CELL_SCHEDULE_VALUE = DEFAULT_FIRESTORE_DATE_CELL_SCHEDULE_VALUE;
|
|
@@ -8258,7 +8538,6 @@ exports.DEFAULT_ITERATE_FIRESTORE_DOCUMENT_SNAPSHOT_BATCHES_BATCH_SIZE = DEFAULT
|
|
|
8258
8538
|
exports.DEFAULT_QUERY_CHANGE_WATCHER_DELAY = DEFAULT_QUERY_CHANGE_WATCHER_DELAY;
|
|
8259
8539
|
exports.DEFAULT_SINGLE_ITEM_FIRESTORE_COLLECTION_DOCUMENT_IDENTIFIER = DEFAULT_SINGLE_ITEM_FIRESTORE_COLLECTION_DOCUMENT_IDENTIFIER;
|
|
8260
8540
|
exports.DEFAULT_WEBSITE_LINK = DEFAULT_WEBSITE_LINK;
|
|
8261
|
-
exports.DELETE_MODEL_APP_FUNCTION_KEY = DELETE_MODEL_APP_FUNCTION_KEY;
|
|
8262
8541
|
exports.FIREBASE_AUTH_NETWORK_REQUEST_ERROR = FIREBASE_AUTH_NETWORK_REQUEST_ERROR;
|
|
8263
8542
|
exports.FIREBASE_AUTH_NETWORK_REQUEST_FAILED = FIREBASE_AUTH_NETWORK_REQUEST_FAILED;
|
|
8264
8543
|
exports.FIREBASE_AUTH_PASSWORD_MAX_LENGTH = FIREBASE_AUTH_PASSWORD_MAX_LENGTH;
|
|
@@ -8309,7 +8588,6 @@ exports.MODEL_FUNCTION_FIREBASE_CRUD_FUNCTION_SPECIFIER_DEFAULT = MODEL_FUNCTION
|
|
|
8309
8588
|
exports.MODEL_FUNCTION_FIREBASE_CRUD_FUNCTION_SPECIFIER_SPLITTER = MODEL_FUNCTION_FIREBASE_CRUD_FUNCTION_SPECIFIER_SPLITTER;
|
|
8310
8589
|
exports.MODEL_STORAGE_FILE_SLASH_PATH_FACTORY = MODEL_STORAGE_FILE_SLASH_PATH_FACTORY;
|
|
8311
8590
|
exports.ModifyBeforeSetFirestoreDocumentDataAccessorWrapper = ModifyBeforeSetFirestoreDocumentDataAccessorWrapper;
|
|
8312
|
-
exports.READ_MODEL_APP_FUNCTION_KEY = READ_MODEL_APP_FUNCTION_KEY;
|
|
8313
8591
|
exports.RUN_DEV_FUNCTION_APP_FUNCTION_KEY = RUN_DEV_FUNCTION_APP_FUNCTION_KEY;
|
|
8314
8592
|
exports.SCHEDULED_FUNCTION_DEV_FUNCTION_SPECIFIER = SCHEDULED_FUNCTION_DEV_FUNCTION_SPECIFIER;
|
|
8315
8593
|
exports.ScheduledFunctionDevelopmentFirebaseFunctionListEntry = ScheduledFunctionDevelopmentFirebaseFunctionListEntry;
|
|
@@ -8318,7 +8596,6 @@ exports.SystemStateDocument = SystemStateDocument;
|
|
|
8318
8596
|
exports.SystemStateFirestoreCollections = SystemStateFirestoreCollections;
|
|
8319
8597
|
exports.TargetModelIdParams = TargetModelIdParams;
|
|
8320
8598
|
exports.TargetModelParams = TargetModelParams;
|
|
8321
|
-
exports.UPDATE_MODEL_APP_FUNCTION_KEY = UPDATE_MODEL_APP_FUNCTION_KEY;
|
|
8322
8599
|
exports.addConstraintToBuilder = addConstraintToBuilder;
|
|
8323
8600
|
exports.addOrReplaceLimitInConstraints = addOrReplaceLimitInConstraints;
|
|
8324
8601
|
exports.allChildDocumentsUnderParent = allChildDocumentsUnderParent;
|
|
@@ -8551,7 +8828,6 @@ exports.makeRootSingleItemFirestoreCollection = makeRootSingleItemFirestoreColle
|
|
|
8551
8828
|
exports.makeSingleItemFirestoreCollection = makeSingleItemFirestoreCollection;
|
|
8552
8829
|
exports.mapDataFromSnapshot = mapDataFromSnapshot;
|
|
8553
8830
|
exports.mapHttpsCallable = mapHttpsCallable;
|
|
8554
|
-
exports.modelFirebaseFunctionMapFactory = modelFirebaseFunctionMapFactory;
|
|
8555
8831
|
exports.modelStorageSlashPathFactory = modelStorageSlashPathFactory;
|
|
8556
8832
|
exports.modifyBeforeSetInterceptAccessorFactoryFunction = modifyBeforeSetInterceptAccessorFactoryFunction;
|
|
8557
8833
|
exports.newDocuments = newDocuments;
|