@dereekb/firebase 12.4.4 → 12.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.cjs.js +1523 -231
- package/index.esm.js +1458 -234
- package/package.json +1 -1
- package/src/lib/common/firestore/query/iterator.d.ts +39 -9
- package/src/lib/common/firestore/query/watcher.d.ts +2 -2
- package/src/lib/common/storage/driver/accessor.d.ts +62 -6
- package/src/lib/common/storage/driver/accessor.iterate.d.ts +38 -0
- package/src/lib/common/storage/driver/accessor.util.d.ts +14 -0
- package/src/lib/common/storage/driver/error.d.ts +4 -0
- package/src/lib/common/storage/driver/index.d.ts +2 -0
- package/src/lib/common/storage/driver/list.d.ts +4 -2
- package/src/lib/common/storage/storage.d.ts +7 -0
- package/src/lib/common/storage/types.d.ts +141 -32
- package/src/lib/model/index.d.ts +1 -0
- package/src/lib/model/notification/notification.api.d.ts +10 -0
- package/src/lib/model/notification/notification.create.d.ts +2 -2
- package/src/lib/model/notification/notification.item.d.ts +2 -0
- package/src/lib/model/notification/notification.task.d.ts +22 -8
- package/src/lib/model/storagefile/index.d.ts +12 -0
- package/src/lib/model/storagefile/storagefile.action.d.ts +8 -0
- package/src/lib/model/storagefile/storagefile.api.d.ts +148 -0
- package/src/lib/model/storagefile/storagefile.api.error.d.ts +51 -0
- package/src/lib/model/storagefile/storagefile.create.d.ts +121 -0
- package/src/lib/model/storagefile/storagefile.d.ts +164 -0
- package/src/lib/model/storagefile/storagefile.file.d.ts +55 -0
- package/src/lib/model/storagefile/storagefile.id.d.ts +20 -0
- package/src/lib/model/storagefile/storagefile.query.d.ts +17 -0
- package/src/lib/model/storagefile/storagefile.task.d.ts +67 -0
- package/src/lib/model/storagefile/storagefile.upload.claims.d.ts +26 -0
- package/src/lib/model/storagefile/storagefile.upload.d.ts +52 -0
- package/src/lib/model/storagefile/storagefile.upload.determiner.d.ts +271 -0
- package/test/CHANGELOG.md +13 -0
- package/test/package.json +1 -1
- package/test/src/lib/common/storage/storage.js +3 -3
- package/test/src/lib/common/storage/storage.js.map +1 -1
- package/test/src/lib/common/storage/test.driver.accessor.js +331 -29
- package/test/src/lib/common/storage/test.driver.accessor.js.map +1 -1
package/index.cjs.js
CHANGED
|
@@ -10,6 +10,7 @@ var functions = require('firebase/functions');
|
|
|
10
10
|
var storage = require('firebase/storage');
|
|
11
11
|
var classTransformer = require('class-transformer');
|
|
12
12
|
var classValidator = require('class-validator');
|
|
13
|
+
var fetch = require('@dereekb/util/fetch');
|
|
13
14
|
var dateFns = require('date-fns');
|
|
14
15
|
|
|
15
16
|
/**
|
|
@@ -651,10 +652,11 @@ function firestoreSingleDocumentAccessor(config) {
|
|
|
651
652
|
singleItemIdentifier,
|
|
652
653
|
accessors
|
|
653
654
|
} = config;
|
|
655
|
+
const defaultAccessor = accessors.documentAccessor();
|
|
654
656
|
return {
|
|
655
657
|
singleItemIdentifier,
|
|
656
658
|
loadDocument() {
|
|
657
|
-
return
|
|
659
|
+
return defaultAccessor.loadDocumentForId(singleItemIdentifier);
|
|
658
660
|
},
|
|
659
661
|
loadDocumentForTransaction(transaction) {
|
|
660
662
|
return accessors.documentAccessorForTransaction(transaction).loadDocumentForId(singleItemIdentifier);
|
|
@@ -663,7 +665,7 @@ function firestoreSingleDocumentAccessor(config) {
|
|
|
663
665
|
return accessors.documentAccessorForWriteBatch(writeBatch).loadDocumentForId(singleItemIdentifier);
|
|
664
666
|
},
|
|
665
667
|
documentRef() {
|
|
666
|
-
return
|
|
668
|
+
return defaultAccessor.documentRefForId(singleItemIdentifier);
|
|
667
669
|
}
|
|
668
670
|
};
|
|
669
671
|
}
|
|
@@ -4681,6 +4683,199 @@ $$2({ target: 'Array', proto: true, arity: 1, forced: FORCED }, {
|
|
|
4681
4683
|
}
|
|
4682
4684
|
});
|
|
4683
4685
|
|
|
4686
|
+
var classofRaw$1 = classofRaw$2;
|
|
4687
|
+
var uncurryThis$1 = functionUncurryThis;
|
|
4688
|
+
|
|
4689
|
+
var functionUncurryThisClause = function (fn) {
|
|
4690
|
+
// Nashorn bug:
|
|
4691
|
+
// https://github.com/zloirock/core-js/issues/1128
|
|
4692
|
+
// https://github.com/zloirock/core-js/issues/1130
|
|
4693
|
+
if (classofRaw$1(fn) === 'Function') return uncurryThis$1(fn);
|
|
4694
|
+
};
|
|
4695
|
+
|
|
4696
|
+
var uncurryThis = functionUncurryThisClause;
|
|
4697
|
+
var aCallable$3 = aCallable$9;
|
|
4698
|
+
var NATIVE_BIND = functionBindNative;
|
|
4699
|
+
|
|
4700
|
+
var bind$1 = uncurryThis(uncurryThis.bind);
|
|
4701
|
+
|
|
4702
|
+
// optional / simple context binding
|
|
4703
|
+
var functionBindContext = function (fn, that) {
|
|
4704
|
+
aCallable$3(fn);
|
|
4705
|
+
return that === undefined ? fn : NATIVE_BIND ? bind$1(fn, that) : function (/* ...args */) {
|
|
4706
|
+
return fn.apply(that, arguments);
|
|
4707
|
+
};
|
|
4708
|
+
};
|
|
4709
|
+
|
|
4710
|
+
var iterators = {};
|
|
4711
|
+
|
|
4712
|
+
var wellKnownSymbol$3 = wellKnownSymbol$8;
|
|
4713
|
+
var Iterators$1 = iterators;
|
|
4714
|
+
|
|
4715
|
+
var ITERATOR$1 = wellKnownSymbol$3('iterator');
|
|
4716
|
+
var ArrayPrototype = Array.prototype;
|
|
4717
|
+
|
|
4718
|
+
// check on default Array iterator
|
|
4719
|
+
var isArrayIteratorMethod$1 = function (it) {
|
|
4720
|
+
return it !== undefined && (Iterators$1.Array === it || ArrayPrototype[ITERATOR$1] === it);
|
|
4721
|
+
};
|
|
4722
|
+
|
|
4723
|
+
var wellKnownSymbol$2 = wellKnownSymbol$8;
|
|
4724
|
+
|
|
4725
|
+
var TO_STRING_TAG$1 = wellKnownSymbol$2('toStringTag');
|
|
4726
|
+
var test = {};
|
|
4727
|
+
|
|
4728
|
+
test[TO_STRING_TAG$1] = 'z';
|
|
4729
|
+
|
|
4730
|
+
var toStringTagSupport = String(test) === '[object z]';
|
|
4731
|
+
|
|
4732
|
+
var TO_STRING_TAG_SUPPORT = toStringTagSupport;
|
|
4733
|
+
var isCallable = isCallable$e;
|
|
4734
|
+
var classofRaw = classofRaw$2;
|
|
4735
|
+
var wellKnownSymbol$1 = wellKnownSymbol$8;
|
|
4736
|
+
|
|
4737
|
+
var TO_STRING_TAG = wellKnownSymbol$1('toStringTag');
|
|
4738
|
+
var $Object = Object;
|
|
4739
|
+
|
|
4740
|
+
// ES3 wrong here
|
|
4741
|
+
var CORRECT_ARGUMENTS = classofRaw(function () { return arguments; }()) === 'Arguments';
|
|
4742
|
+
|
|
4743
|
+
// fallback for IE11 Script Access Denied error
|
|
4744
|
+
var tryGet = function (it, key) {
|
|
4745
|
+
try {
|
|
4746
|
+
return it[key];
|
|
4747
|
+
} catch (error) { /* empty */ }
|
|
4748
|
+
};
|
|
4749
|
+
|
|
4750
|
+
// getting tag from ES6+ `Object.prototype.toString`
|
|
4751
|
+
var classof$1 = TO_STRING_TAG_SUPPORT ? classofRaw : function (it) {
|
|
4752
|
+
var O, tag, result;
|
|
4753
|
+
return it === undefined ? 'Undefined' : it === null ? 'Null'
|
|
4754
|
+
// @@toStringTag case
|
|
4755
|
+
: typeof (tag = tryGet(O = $Object(it), TO_STRING_TAG)) == 'string' ? tag
|
|
4756
|
+
// builtinTag case
|
|
4757
|
+
: CORRECT_ARGUMENTS ? classofRaw(O)
|
|
4758
|
+
// ES3 arguments fallback
|
|
4759
|
+
: (result = classofRaw(O)) === 'Object' && isCallable(O.callee) ? 'Arguments' : result;
|
|
4760
|
+
};
|
|
4761
|
+
|
|
4762
|
+
var classof = classof$1;
|
|
4763
|
+
var getMethod = getMethod$4;
|
|
4764
|
+
var isNullOrUndefined = isNullOrUndefined$3;
|
|
4765
|
+
var Iterators = iterators;
|
|
4766
|
+
var wellKnownSymbol = wellKnownSymbol$8;
|
|
4767
|
+
|
|
4768
|
+
var ITERATOR = wellKnownSymbol('iterator');
|
|
4769
|
+
|
|
4770
|
+
var getIteratorMethod$2 = function (it) {
|
|
4771
|
+
if (!isNullOrUndefined(it)) return getMethod(it, ITERATOR)
|
|
4772
|
+
|| getMethod(it, '@@iterator')
|
|
4773
|
+
|| Iterators[classof(it)];
|
|
4774
|
+
};
|
|
4775
|
+
|
|
4776
|
+
var call$1 = functionCall;
|
|
4777
|
+
var aCallable$2 = aCallable$9;
|
|
4778
|
+
var anObject$3 = anObject$e;
|
|
4779
|
+
var tryToString$1 = tryToString$3;
|
|
4780
|
+
var getIteratorMethod$1 = getIteratorMethod$2;
|
|
4781
|
+
|
|
4782
|
+
var $TypeError$1 = TypeError;
|
|
4783
|
+
|
|
4784
|
+
var getIterator$1 = function (argument, usingIterator) {
|
|
4785
|
+
var iteratorMethod = arguments.length < 2 ? getIteratorMethod$1(argument) : usingIterator;
|
|
4786
|
+
if (aCallable$2(iteratorMethod)) return anObject$3(call$1(iteratorMethod, argument));
|
|
4787
|
+
throw new $TypeError$1(tryToString$1(argument) + ' is not iterable');
|
|
4788
|
+
};
|
|
4789
|
+
|
|
4790
|
+
var bind = functionBindContext;
|
|
4791
|
+
var call = functionCall;
|
|
4792
|
+
var anObject$2 = anObject$e;
|
|
4793
|
+
var tryToString = tryToString$3;
|
|
4794
|
+
var isArrayIteratorMethod = isArrayIteratorMethod$1;
|
|
4795
|
+
var lengthOfArrayLike = lengthOfArrayLike$3;
|
|
4796
|
+
var isPrototypeOf = objectIsPrototypeOf;
|
|
4797
|
+
var getIterator = getIterator$1;
|
|
4798
|
+
var getIteratorMethod = getIteratorMethod$2;
|
|
4799
|
+
var iteratorClose = iteratorClose$5;
|
|
4800
|
+
|
|
4801
|
+
var $TypeError = TypeError;
|
|
4802
|
+
|
|
4803
|
+
var Result = function (stopped, result) {
|
|
4804
|
+
this.stopped = stopped;
|
|
4805
|
+
this.result = result;
|
|
4806
|
+
};
|
|
4807
|
+
|
|
4808
|
+
var ResultPrototype = Result.prototype;
|
|
4809
|
+
|
|
4810
|
+
var iterate$2 = function (iterable, unboundFunction, options) {
|
|
4811
|
+
var that = options && options.that;
|
|
4812
|
+
var AS_ENTRIES = !!(options && options.AS_ENTRIES);
|
|
4813
|
+
var IS_RECORD = !!(options && options.IS_RECORD);
|
|
4814
|
+
var IS_ITERATOR = !!(options && options.IS_ITERATOR);
|
|
4815
|
+
var INTERRUPTED = !!(options && options.INTERRUPTED);
|
|
4816
|
+
var fn = bind(unboundFunction, that);
|
|
4817
|
+
var iterator, iterFn, index, length, result, next, step;
|
|
4818
|
+
|
|
4819
|
+
var stop = function (condition) {
|
|
4820
|
+
if (iterator) iteratorClose(iterator, 'normal', condition);
|
|
4821
|
+
return new Result(true, condition);
|
|
4822
|
+
};
|
|
4823
|
+
|
|
4824
|
+
var callFn = function (value) {
|
|
4825
|
+
if (AS_ENTRIES) {
|
|
4826
|
+
anObject$2(value);
|
|
4827
|
+
return INTERRUPTED ? fn(value[0], value[1], stop) : fn(value[0], value[1]);
|
|
4828
|
+
} return INTERRUPTED ? fn(value, stop) : fn(value);
|
|
4829
|
+
};
|
|
4830
|
+
|
|
4831
|
+
if (IS_RECORD) {
|
|
4832
|
+
iterator = iterable.iterator;
|
|
4833
|
+
} else if (IS_ITERATOR) {
|
|
4834
|
+
iterator = iterable;
|
|
4835
|
+
} else {
|
|
4836
|
+
iterFn = getIteratorMethod(iterable);
|
|
4837
|
+
if (!iterFn) throw new $TypeError(tryToString(iterable) + ' is not iterable');
|
|
4838
|
+
// optimisation for array iterators
|
|
4839
|
+
if (isArrayIteratorMethod(iterFn)) {
|
|
4840
|
+
for (index = 0, length = lengthOfArrayLike(iterable); length > index; index++) {
|
|
4841
|
+
result = callFn(iterable[index]);
|
|
4842
|
+
if (result && isPrototypeOf(ResultPrototype, result)) return result;
|
|
4843
|
+
} return new Result(false);
|
|
4844
|
+
}
|
|
4845
|
+
iterator = getIterator(iterable, iterFn);
|
|
4846
|
+
}
|
|
4847
|
+
|
|
4848
|
+
next = IS_RECORD ? iterable.next : iterator.next;
|
|
4849
|
+
while (!(step = call(next, iterator)).done) {
|
|
4850
|
+
try {
|
|
4851
|
+
result = callFn(step.value);
|
|
4852
|
+
} catch (error) {
|
|
4853
|
+
iteratorClose(iterator, 'throw', error);
|
|
4854
|
+
}
|
|
4855
|
+
if (typeof result == 'object' && result && isPrototypeOf(ResultPrototype, result)) return result;
|
|
4856
|
+
} return new Result(false);
|
|
4857
|
+
};
|
|
4858
|
+
|
|
4859
|
+
var $$1 = _export;
|
|
4860
|
+
var iterate$1 = iterate$2;
|
|
4861
|
+
var aCallable$1 = aCallable$9;
|
|
4862
|
+
var anObject$1 = anObject$e;
|
|
4863
|
+
var getIteratorDirect$1 = getIteratorDirect$5;
|
|
4864
|
+
|
|
4865
|
+
// `Iterator.prototype.forEach` method
|
|
4866
|
+
// https://github.com/tc39/proposal-iterator-helpers
|
|
4867
|
+
$$1({ target: 'Iterator', proto: true, real: true }, {
|
|
4868
|
+
forEach: function forEach(fn) {
|
|
4869
|
+
anObject$1(this);
|
|
4870
|
+
aCallable$1(fn);
|
|
4871
|
+
var record = getIteratorDirect$1(this);
|
|
4872
|
+
var counter = 0;
|
|
4873
|
+
iterate$1(record, function (value) {
|
|
4874
|
+
fn(value, counter++);
|
|
4875
|
+
}, { IS_RECORD: true });
|
|
4876
|
+
}
|
|
4877
|
+
});
|
|
4878
|
+
|
|
4684
4879
|
/**
|
|
4685
4880
|
* Filters out constraints that should not be directly specified in pagination queries.
|
|
4686
4881
|
*
|
|
@@ -4855,6 +5050,9 @@ const FIRESTORE_ITEM_PAGE_ITERATOR = new rxjs$1.ItemPageIterator(FIRESTORE_ITEM_
|
|
|
4855
5050
|
*/
|
|
4856
5051
|
function firestoreItemPageIteration(config) {
|
|
4857
5052
|
const snapshotIteration = FIRESTORE_ITEM_PAGE_ITERATOR.instance(config);
|
|
5053
|
+
return _firestoreItemPageIterationWithSnapshotIteration(snapshotIteration);
|
|
5054
|
+
}
|
|
5055
|
+
function _firestoreItemPageIterationWithSnapshotIteration(snapshotIteration) {
|
|
4858
5056
|
const mappedIteration = rxjs$1.mappedPageItemIteration(snapshotIteration, {
|
|
4859
5057
|
forwardDestroy: true,
|
|
4860
5058
|
mapValue: x => x.docs
|
|
@@ -4865,6 +5063,128 @@ function firestoreItemPageIteration(config) {
|
|
|
4865
5063
|
};
|
|
4866
5064
|
return result;
|
|
4867
5065
|
}
|
|
5066
|
+
/**
|
|
5067
|
+
* Creates a FirestoreFixedItemPageIterationFactoryFunction.
|
|
5068
|
+
*/
|
|
5069
|
+
function firestoreFixedItemPageIterationFactory(baseConfig, documentAccessor) {
|
|
5070
|
+
return (items, filter) => {
|
|
5071
|
+
const result = firestoreFixedItemPageIteration({
|
|
5072
|
+
items,
|
|
5073
|
+
documentAccessor,
|
|
5074
|
+
queryLike: baseConfig.queryLike,
|
|
5075
|
+
itemsPerPage: baseConfig.itemsPerPage,
|
|
5076
|
+
firestoreQueryDriver: baseConfig.firestoreQueryDriver,
|
|
5077
|
+
maxPageLoadLimit: filter?.maxPageLoadLimit ?? baseConfig.maxPageLoadLimit,
|
|
5078
|
+
filter
|
|
5079
|
+
});
|
|
5080
|
+
return result;
|
|
5081
|
+
};
|
|
5082
|
+
}
|
|
5083
|
+
/**
|
|
5084
|
+
* Creates a FirestoreItemPageIterationInstance that iterates over the fixed
|
|
5085
|
+
*/
|
|
5086
|
+
function firestoreFixedItemPageIteration(config) {
|
|
5087
|
+
const {
|
|
5088
|
+
items,
|
|
5089
|
+
documentAccessor
|
|
5090
|
+
} = config;
|
|
5091
|
+
const idLookupMap = new Map();
|
|
5092
|
+
// used to cache the index for ids that are looked up
|
|
5093
|
+
const indexForId = id => {
|
|
5094
|
+
let index = idLookupMap.get(id);
|
|
5095
|
+
if (index === undefined) {
|
|
5096
|
+
index = items.findIndex(x => x.id === id);
|
|
5097
|
+
idLookupMap.set(id, index);
|
|
5098
|
+
}
|
|
5099
|
+
return index;
|
|
5100
|
+
};
|
|
5101
|
+
const delegate = {
|
|
5102
|
+
loadItemsForPage: request => {
|
|
5103
|
+
const {
|
|
5104
|
+
page,
|
|
5105
|
+
iteratorConfig
|
|
5106
|
+
} = request;
|
|
5107
|
+
const prevQueryResult$ = page > 0 ? request.lastItem$ : rxjs.of(undefined);
|
|
5108
|
+
const {
|
|
5109
|
+
itemsPerPage = DEFAULT_FIRESTORE_ITEM_PAGE_ITERATOR_ITEMS_PER_PAGE,
|
|
5110
|
+
filter
|
|
5111
|
+
} = iteratorConfig;
|
|
5112
|
+
const {
|
|
5113
|
+
limit: filterLimit
|
|
5114
|
+
} = filter ?? {};
|
|
5115
|
+
return prevQueryResult$.pipe(rxjs.exhaustMap(prevResult => {
|
|
5116
|
+
if (prevResult?.snapshot.empty === true) {
|
|
5117
|
+
// TODO(REMOVE): Shouldn't happen. Remove this later.
|
|
5118
|
+
return rxjs.of({
|
|
5119
|
+
end: true
|
|
5120
|
+
});
|
|
5121
|
+
} else {
|
|
5122
|
+
const cursorDocument = prevResult ? util.lastValue(prevResult.docs) : undefined;
|
|
5123
|
+
const startAtIndex = cursorDocument ? indexForId(cursorDocument.id) + 1 : 0;
|
|
5124
|
+
const limitCount = filterLimit ?? itemsPerPage;
|
|
5125
|
+
const time = new Date();
|
|
5126
|
+
const itemsForThisPage = items.slice(startAtIndex, startAtIndex + limitCount);
|
|
5127
|
+
const lastItemForThisPage = util.lastValue(itemsForThisPage);
|
|
5128
|
+
let end = false;
|
|
5129
|
+
if (lastItemForThisPage) {
|
|
5130
|
+
const lastItemForThisPageItemIndex = startAtIndex + (itemsForThisPage.length - 1);
|
|
5131
|
+
idLookupMap.set(lastItemForThisPage.id, lastItemForThisPageItemIndex);
|
|
5132
|
+
end = lastItemForThisPageItemIndex === items.length - 1;
|
|
5133
|
+
} else {
|
|
5134
|
+
end = true;
|
|
5135
|
+
}
|
|
5136
|
+
const documents = loadDocumentsForDocumentReferences(documentAccessor, itemsForThisPage);
|
|
5137
|
+
const _loadFakeQuerySnapshot = () => {
|
|
5138
|
+
return getDocumentSnapshots(documents).then(documentSnapshots => {
|
|
5139
|
+
const documentSnapshotsWithData = documentSnapshots.filter(x => x.data() != null);
|
|
5140
|
+
const docs = documentSnapshotsWithData;
|
|
5141
|
+
const query = {
|
|
5142
|
+
withConverter: () => {
|
|
5143
|
+
throw new Error('firestoreFixedItemPageIteration(): Not a real query');
|
|
5144
|
+
}
|
|
5145
|
+
}; // TODO: No great way to implement this. Not a great way to
|
|
5146
|
+
const snapshot = {
|
|
5147
|
+
query,
|
|
5148
|
+
docs,
|
|
5149
|
+
size: docs.length,
|
|
5150
|
+
empty: docs.length === 0,
|
|
5151
|
+
docChanges: () => {
|
|
5152
|
+
return []; // no changes to return in this fake snapshot
|
|
5153
|
+
},
|
|
5154
|
+
forEach: result => {
|
|
5155
|
+
docs.forEach(result);
|
|
5156
|
+
}
|
|
5157
|
+
};
|
|
5158
|
+
return snapshot;
|
|
5159
|
+
});
|
|
5160
|
+
};
|
|
5161
|
+
const resultPromise = _loadFakeQuerySnapshot().then(snapshot => {
|
|
5162
|
+
const result = {
|
|
5163
|
+
value: {
|
|
5164
|
+
time,
|
|
5165
|
+
docs: snapshot.docs,
|
|
5166
|
+
snapshot,
|
|
5167
|
+
reload() {
|
|
5168
|
+
return _loadFakeQuerySnapshot();
|
|
5169
|
+
},
|
|
5170
|
+
stream(options) {
|
|
5171
|
+
// TODO: Count potentially stream to fully implement, but might not be used anyways.
|
|
5172
|
+
return rxjs.of(snapshot);
|
|
5173
|
+
}
|
|
5174
|
+
},
|
|
5175
|
+
end
|
|
5176
|
+
};
|
|
5177
|
+
return result;
|
|
5178
|
+
});
|
|
5179
|
+
return resultPromise;
|
|
5180
|
+
}
|
|
5181
|
+
}));
|
|
5182
|
+
}
|
|
5183
|
+
};
|
|
5184
|
+
const factory = new rxjs$1.ItemPageIterator(delegate);
|
|
5185
|
+
const snapshotIteration = factory.instance(config);
|
|
5186
|
+
return _firestoreItemPageIterationWithSnapshotIteration(snapshotIteration);
|
|
5187
|
+
}
|
|
4868
5188
|
// MARK: Compat
|
|
4869
5189
|
/**
|
|
4870
5190
|
* @deprecated Use filterDisallowedFirestoreItemPageIteratorInputConstraints instead. Mispelling.
|
|
@@ -6028,13 +6348,14 @@ function makeFirestoreCollection(inputConfig) {
|
|
|
6028
6348
|
firestoreAccessorDriver
|
|
6029
6349
|
} = config;
|
|
6030
6350
|
config.queryLike = collection;
|
|
6031
|
-
const firestoreIteration = firestoreItemPageIterationFactory(config);
|
|
6032
6351
|
const documentAccessor = firestoreDocumentAccessorFactory(config);
|
|
6033
|
-
const queryFactory = firestoreQueryFactory(config);
|
|
6034
6352
|
const documentAccessorExtension = firestoreDocumentAccessorContextExtension({
|
|
6035
6353
|
documentAccessor,
|
|
6036
6354
|
firestoreAccessorDriver
|
|
6037
6355
|
});
|
|
6356
|
+
const firestoreIteration = firestoreItemPageIterationFactory(config);
|
|
6357
|
+
const firestoreFixedIteration = firestoreFixedItemPageIterationFactory(config, documentAccessorExtension.documentAccessor());
|
|
6358
|
+
const queryFactory = firestoreQueryFactory(config);
|
|
6038
6359
|
const {
|
|
6039
6360
|
queryDocument
|
|
6040
6361
|
} = firestoreCollectionQueryFactory(queryFactory, documentAccessorExtension);
|
|
@@ -6049,6 +6370,7 @@ function makeFirestoreCollection(inputConfig) {
|
|
|
6049
6370
|
firestoreContext,
|
|
6050
6371
|
...documentAccessorExtension,
|
|
6051
6372
|
firestoreIteration,
|
|
6373
|
+
firestoreFixedIteration,
|
|
6052
6374
|
query,
|
|
6053
6375
|
queryDocument
|
|
6054
6376
|
};
|
|
@@ -6100,17 +6422,18 @@ function makeFirestoreCollectionGroup(config) {
|
|
|
6100
6422
|
firestoreContext,
|
|
6101
6423
|
firestoreAccessorDriver
|
|
6102
6424
|
} = config;
|
|
6103
|
-
// Create the iteration factory for pagination support
|
|
6104
|
-
const firestoreIteration = firestoreItemPageIterationFactory(config);
|
|
6105
6425
|
// Create the document accessor for loading documents
|
|
6106
6426
|
const documentAccessor = limitedFirestoreDocumentAccessorFactory(config);
|
|
6107
|
-
// Create the query factory for building Firestore queries
|
|
6108
|
-
const queryFactory = firestoreQueryFactory(config);
|
|
6109
6427
|
// Create the document accessor extension with context
|
|
6110
6428
|
const documentAccessorExtension = firestoreDocumentAccessorContextExtension({
|
|
6111
6429
|
documentAccessor,
|
|
6112
6430
|
firestoreAccessorDriver
|
|
6113
6431
|
});
|
|
6432
|
+
// Create the iteration factory for pagination support
|
|
6433
|
+
const firestoreIteration = firestoreItemPageIterationFactory(config);
|
|
6434
|
+
const firestoreFixedIteration = firestoreFixedItemPageIterationFactory(config, documentAccessorExtension.documentAccessor());
|
|
6435
|
+
// Create the query factory for building Firestore queries
|
|
6436
|
+
const queryFactory = firestoreQueryFactory(config);
|
|
6114
6437
|
// Create the document-aware query factory
|
|
6115
6438
|
const {
|
|
6116
6439
|
queryDocument
|
|
@@ -6126,6 +6449,7 @@ function makeFirestoreCollectionGroup(config) {
|
|
|
6126
6449
|
firestoreContext,
|
|
6127
6450
|
...documentAccessorExtension,
|
|
6128
6451
|
firestoreIteration,
|
|
6452
|
+
firestoreFixedIteration,
|
|
6129
6453
|
query,
|
|
6130
6454
|
queryDocument
|
|
6131
6455
|
};
|
|
@@ -6252,199 +6576,6 @@ function firestoreContextFactory(drivers) {
|
|
|
6252
6576
|
};
|
|
6253
6577
|
}
|
|
6254
6578
|
|
|
6255
|
-
var classofRaw$1 = classofRaw$2;
|
|
6256
|
-
var uncurryThis$1 = functionUncurryThis;
|
|
6257
|
-
|
|
6258
|
-
var functionUncurryThisClause = function (fn) {
|
|
6259
|
-
// Nashorn bug:
|
|
6260
|
-
// https://github.com/zloirock/core-js/issues/1128
|
|
6261
|
-
// https://github.com/zloirock/core-js/issues/1130
|
|
6262
|
-
if (classofRaw$1(fn) === 'Function') return uncurryThis$1(fn);
|
|
6263
|
-
};
|
|
6264
|
-
|
|
6265
|
-
var uncurryThis = functionUncurryThisClause;
|
|
6266
|
-
var aCallable$3 = aCallable$9;
|
|
6267
|
-
var NATIVE_BIND = functionBindNative;
|
|
6268
|
-
|
|
6269
|
-
var bind$1 = uncurryThis(uncurryThis.bind);
|
|
6270
|
-
|
|
6271
|
-
// optional / simple context binding
|
|
6272
|
-
var functionBindContext = function (fn, that) {
|
|
6273
|
-
aCallable$3(fn);
|
|
6274
|
-
return that === undefined ? fn : NATIVE_BIND ? bind$1(fn, that) : function (/* ...args */) {
|
|
6275
|
-
return fn.apply(that, arguments);
|
|
6276
|
-
};
|
|
6277
|
-
};
|
|
6278
|
-
|
|
6279
|
-
var iterators = {};
|
|
6280
|
-
|
|
6281
|
-
var wellKnownSymbol$3 = wellKnownSymbol$8;
|
|
6282
|
-
var Iterators$1 = iterators;
|
|
6283
|
-
|
|
6284
|
-
var ITERATOR$1 = wellKnownSymbol$3('iterator');
|
|
6285
|
-
var ArrayPrototype = Array.prototype;
|
|
6286
|
-
|
|
6287
|
-
// check on default Array iterator
|
|
6288
|
-
var isArrayIteratorMethod$1 = function (it) {
|
|
6289
|
-
return it !== undefined && (Iterators$1.Array === it || ArrayPrototype[ITERATOR$1] === it);
|
|
6290
|
-
};
|
|
6291
|
-
|
|
6292
|
-
var wellKnownSymbol$2 = wellKnownSymbol$8;
|
|
6293
|
-
|
|
6294
|
-
var TO_STRING_TAG$1 = wellKnownSymbol$2('toStringTag');
|
|
6295
|
-
var test = {};
|
|
6296
|
-
|
|
6297
|
-
test[TO_STRING_TAG$1] = 'z';
|
|
6298
|
-
|
|
6299
|
-
var toStringTagSupport = String(test) === '[object z]';
|
|
6300
|
-
|
|
6301
|
-
var TO_STRING_TAG_SUPPORT = toStringTagSupport;
|
|
6302
|
-
var isCallable = isCallable$e;
|
|
6303
|
-
var classofRaw = classofRaw$2;
|
|
6304
|
-
var wellKnownSymbol$1 = wellKnownSymbol$8;
|
|
6305
|
-
|
|
6306
|
-
var TO_STRING_TAG = wellKnownSymbol$1('toStringTag');
|
|
6307
|
-
var $Object = Object;
|
|
6308
|
-
|
|
6309
|
-
// ES3 wrong here
|
|
6310
|
-
var CORRECT_ARGUMENTS = classofRaw(function () { return arguments; }()) === 'Arguments';
|
|
6311
|
-
|
|
6312
|
-
// fallback for IE11 Script Access Denied error
|
|
6313
|
-
var tryGet = function (it, key) {
|
|
6314
|
-
try {
|
|
6315
|
-
return it[key];
|
|
6316
|
-
} catch (error) { /* empty */ }
|
|
6317
|
-
};
|
|
6318
|
-
|
|
6319
|
-
// getting tag from ES6+ `Object.prototype.toString`
|
|
6320
|
-
var classof$1 = TO_STRING_TAG_SUPPORT ? classofRaw : function (it) {
|
|
6321
|
-
var O, tag, result;
|
|
6322
|
-
return it === undefined ? 'Undefined' : it === null ? 'Null'
|
|
6323
|
-
// @@toStringTag case
|
|
6324
|
-
: typeof (tag = tryGet(O = $Object(it), TO_STRING_TAG)) == 'string' ? tag
|
|
6325
|
-
// builtinTag case
|
|
6326
|
-
: CORRECT_ARGUMENTS ? classofRaw(O)
|
|
6327
|
-
// ES3 arguments fallback
|
|
6328
|
-
: (result = classofRaw(O)) === 'Object' && isCallable(O.callee) ? 'Arguments' : result;
|
|
6329
|
-
};
|
|
6330
|
-
|
|
6331
|
-
var classof = classof$1;
|
|
6332
|
-
var getMethod = getMethod$4;
|
|
6333
|
-
var isNullOrUndefined = isNullOrUndefined$3;
|
|
6334
|
-
var Iterators = iterators;
|
|
6335
|
-
var wellKnownSymbol = wellKnownSymbol$8;
|
|
6336
|
-
|
|
6337
|
-
var ITERATOR = wellKnownSymbol('iterator');
|
|
6338
|
-
|
|
6339
|
-
var getIteratorMethod$2 = function (it) {
|
|
6340
|
-
if (!isNullOrUndefined(it)) return getMethod(it, ITERATOR)
|
|
6341
|
-
|| getMethod(it, '@@iterator')
|
|
6342
|
-
|| Iterators[classof(it)];
|
|
6343
|
-
};
|
|
6344
|
-
|
|
6345
|
-
var call$1 = functionCall;
|
|
6346
|
-
var aCallable$2 = aCallable$9;
|
|
6347
|
-
var anObject$3 = anObject$e;
|
|
6348
|
-
var tryToString$1 = tryToString$3;
|
|
6349
|
-
var getIteratorMethod$1 = getIteratorMethod$2;
|
|
6350
|
-
|
|
6351
|
-
var $TypeError$1 = TypeError;
|
|
6352
|
-
|
|
6353
|
-
var getIterator$1 = function (argument, usingIterator) {
|
|
6354
|
-
var iteratorMethod = arguments.length < 2 ? getIteratorMethod$1(argument) : usingIterator;
|
|
6355
|
-
if (aCallable$2(iteratorMethod)) return anObject$3(call$1(iteratorMethod, argument));
|
|
6356
|
-
throw new $TypeError$1(tryToString$1(argument) + ' is not iterable');
|
|
6357
|
-
};
|
|
6358
|
-
|
|
6359
|
-
var bind = functionBindContext;
|
|
6360
|
-
var call = functionCall;
|
|
6361
|
-
var anObject$2 = anObject$e;
|
|
6362
|
-
var tryToString = tryToString$3;
|
|
6363
|
-
var isArrayIteratorMethod = isArrayIteratorMethod$1;
|
|
6364
|
-
var lengthOfArrayLike = lengthOfArrayLike$3;
|
|
6365
|
-
var isPrototypeOf = objectIsPrototypeOf;
|
|
6366
|
-
var getIterator = getIterator$1;
|
|
6367
|
-
var getIteratorMethod = getIteratorMethod$2;
|
|
6368
|
-
var iteratorClose = iteratorClose$5;
|
|
6369
|
-
|
|
6370
|
-
var $TypeError = TypeError;
|
|
6371
|
-
|
|
6372
|
-
var Result = function (stopped, result) {
|
|
6373
|
-
this.stopped = stopped;
|
|
6374
|
-
this.result = result;
|
|
6375
|
-
};
|
|
6376
|
-
|
|
6377
|
-
var ResultPrototype = Result.prototype;
|
|
6378
|
-
|
|
6379
|
-
var iterate$2 = function (iterable, unboundFunction, options) {
|
|
6380
|
-
var that = options && options.that;
|
|
6381
|
-
var AS_ENTRIES = !!(options && options.AS_ENTRIES);
|
|
6382
|
-
var IS_RECORD = !!(options && options.IS_RECORD);
|
|
6383
|
-
var IS_ITERATOR = !!(options && options.IS_ITERATOR);
|
|
6384
|
-
var INTERRUPTED = !!(options && options.INTERRUPTED);
|
|
6385
|
-
var fn = bind(unboundFunction, that);
|
|
6386
|
-
var iterator, iterFn, index, length, result, next, step;
|
|
6387
|
-
|
|
6388
|
-
var stop = function (condition) {
|
|
6389
|
-
if (iterator) iteratorClose(iterator, 'normal', condition);
|
|
6390
|
-
return new Result(true, condition);
|
|
6391
|
-
};
|
|
6392
|
-
|
|
6393
|
-
var callFn = function (value) {
|
|
6394
|
-
if (AS_ENTRIES) {
|
|
6395
|
-
anObject$2(value);
|
|
6396
|
-
return INTERRUPTED ? fn(value[0], value[1], stop) : fn(value[0], value[1]);
|
|
6397
|
-
} return INTERRUPTED ? fn(value, stop) : fn(value);
|
|
6398
|
-
};
|
|
6399
|
-
|
|
6400
|
-
if (IS_RECORD) {
|
|
6401
|
-
iterator = iterable.iterator;
|
|
6402
|
-
} else if (IS_ITERATOR) {
|
|
6403
|
-
iterator = iterable;
|
|
6404
|
-
} else {
|
|
6405
|
-
iterFn = getIteratorMethod(iterable);
|
|
6406
|
-
if (!iterFn) throw new $TypeError(tryToString(iterable) + ' is not iterable');
|
|
6407
|
-
// optimisation for array iterators
|
|
6408
|
-
if (isArrayIteratorMethod(iterFn)) {
|
|
6409
|
-
for (index = 0, length = lengthOfArrayLike(iterable); length > index; index++) {
|
|
6410
|
-
result = callFn(iterable[index]);
|
|
6411
|
-
if (result && isPrototypeOf(ResultPrototype, result)) return result;
|
|
6412
|
-
} return new Result(false);
|
|
6413
|
-
}
|
|
6414
|
-
iterator = getIterator(iterable, iterFn);
|
|
6415
|
-
}
|
|
6416
|
-
|
|
6417
|
-
next = IS_RECORD ? iterable.next : iterator.next;
|
|
6418
|
-
while (!(step = call(next, iterator)).done) {
|
|
6419
|
-
try {
|
|
6420
|
-
result = callFn(step.value);
|
|
6421
|
-
} catch (error) {
|
|
6422
|
-
iteratorClose(iterator, 'throw', error);
|
|
6423
|
-
}
|
|
6424
|
-
if (typeof result == 'object' && result && isPrototypeOf(ResultPrototype, result)) return result;
|
|
6425
|
-
} return new Result(false);
|
|
6426
|
-
};
|
|
6427
|
-
|
|
6428
|
-
var $$1 = _export;
|
|
6429
|
-
var iterate$1 = iterate$2;
|
|
6430
|
-
var aCallable$1 = aCallable$9;
|
|
6431
|
-
var anObject$1 = anObject$e;
|
|
6432
|
-
var getIteratorDirect$1 = getIteratorDirect$5;
|
|
6433
|
-
|
|
6434
|
-
// `Iterator.prototype.forEach` method
|
|
6435
|
-
// https://github.com/tc39/proposal-iterator-helpers
|
|
6436
|
-
$$1({ target: 'Iterator', proto: true, real: true }, {
|
|
6437
|
-
forEach: function forEach(fn) {
|
|
6438
|
-
anObject$1(this);
|
|
6439
|
-
aCallable$1(fn);
|
|
6440
|
-
var record = getIteratorDirect$1(this);
|
|
6441
|
-
var counter = 0;
|
|
6442
|
-
iterate$1(record, function (value) {
|
|
6443
|
-
fn(value, counter++);
|
|
6444
|
-
}, { IS_RECORD: true });
|
|
6445
|
-
}
|
|
6446
|
-
});
|
|
6447
|
-
|
|
6448
6579
|
function makeFirestoreQueryConstraintFunctionsDriver(config) {
|
|
6449
6580
|
const {
|
|
6450
6581
|
mapping,
|
|
@@ -7124,6 +7255,18 @@ const FIREBASE_DEVELOPMENT_FUNCTIONS_MAP_KEY = 'developmentFunctions';
|
|
|
7124
7255
|
*/
|
|
7125
7256
|
class FirebaseDevelopmentFunctions {}
|
|
7126
7257
|
|
|
7258
|
+
/**
|
|
7259
|
+
* Creates a new StoragePath object with the same bucketId and pathString as the input.
|
|
7260
|
+
*
|
|
7261
|
+
* @param path The StoragePath to copy.
|
|
7262
|
+
* @returns A new StoragePath object.
|
|
7263
|
+
*/
|
|
7264
|
+
function copyStoragePath(path) {
|
|
7265
|
+
return {
|
|
7266
|
+
bucketId: path.bucketId,
|
|
7267
|
+
pathString: path.pathString
|
|
7268
|
+
};
|
|
7269
|
+
}
|
|
7127
7270
|
/**
|
|
7128
7271
|
* Creates a StoragePathFactory.
|
|
7129
7272
|
*
|
|
@@ -7809,6 +7952,237 @@ function modelStorageSlashPathFactory(config) {
|
|
|
7809
7952
|
};
|
|
7810
7953
|
}
|
|
7811
7954
|
|
|
7955
|
+
/**
|
|
7956
|
+
* Creates a new IterateStorageListFilesFactory.
|
|
7957
|
+
*
|
|
7958
|
+
* @param config
|
|
7959
|
+
* @returns
|
|
7960
|
+
*/
|
|
7961
|
+
function iterateStorageListFilesFactory(config) {
|
|
7962
|
+
const {
|
|
7963
|
+
maxResults: factoryDefaultMaxResults
|
|
7964
|
+
} = config;
|
|
7965
|
+
return fetch.fetchPageFactory({
|
|
7966
|
+
fetch: async input => {
|
|
7967
|
+
const list = await input.folder.list({
|
|
7968
|
+
includeNestedResults: input.includeNestedResults,
|
|
7969
|
+
maxResults: input.maxResults ?? factoryDefaultMaxResults,
|
|
7970
|
+
pageToken: input.pageToken ?? undefined
|
|
7971
|
+
});
|
|
7972
|
+
return list;
|
|
7973
|
+
},
|
|
7974
|
+
readFetchPageResultInfo: result => {
|
|
7975
|
+
const cursor = result.nextPageToken();
|
|
7976
|
+
const info = {
|
|
7977
|
+
hasNext: result.hasNext,
|
|
7978
|
+
cursor: result.options?.pageToken,
|
|
7979
|
+
nextPageCursor: cursor
|
|
7980
|
+
};
|
|
7981
|
+
return info;
|
|
7982
|
+
},
|
|
7983
|
+
buildInputForNextPage: function (pageResult, input, options) {
|
|
7984
|
+
return {
|
|
7985
|
+
...input,
|
|
7986
|
+
pageToken: pageResult.nextPageCursor ?? undefined
|
|
7987
|
+
};
|
|
7988
|
+
}
|
|
7989
|
+
});
|
|
7990
|
+
}
|
|
7991
|
+
/**
|
|
7992
|
+
* Convenience function for calling iterateFetchPagesByEachItem() for a storage folder.
|
|
7993
|
+
*/
|
|
7994
|
+
function iterateStorageListFilesByEachFile(input) {
|
|
7995
|
+
const {
|
|
7996
|
+
folder,
|
|
7997
|
+
includeNestedResults,
|
|
7998
|
+
pageToken
|
|
7999
|
+
} = input;
|
|
8000
|
+
return fetch.iterateFetchPagesByEachItem({
|
|
8001
|
+
...input,
|
|
8002
|
+
input: {
|
|
8003
|
+
folder,
|
|
8004
|
+
includeNestedResults,
|
|
8005
|
+
pageToken
|
|
8006
|
+
},
|
|
8007
|
+
fetchPageFactory: iterateStorageListFilesFactory({})
|
|
8008
|
+
});
|
|
8009
|
+
}
|
|
8010
|
+
/**
|
|
8011
|
+
* Convenience function for calling iterateFetchPages() for a storage folder.
|
|
8012
|
+
*/
|
|
8013
|
+
function iterateStorageListFiles(input) {
|
|
8014
|
+
const {
|
|
8015
|
+
folder,
|
|
8016
|
+
includeNestedResults,
|
|
8017
|
+
pageToken
|
|
8018
|
+
} = input;
|
|
8019
|
+
return fetch.iterateFetchPages({
|
|
8020
|
+
...input,
|
|
8021
|
+
input: {
|
|
8022
|
+
folder,
|
|
8023
|
+
includeNestedResults,
|
|
8024
|
+
pageToken
|
|
8025
|
+
},
|
|
8026
|
+
fetchPageFactory: iterateStorageListFilesFactory({})
|
|
8027
|
+
});
|
|
8028
|
+
}
|
|
8029
|
+
|
|
8030
|
+
var makeError = {exports: {}};
|
|
8031
|
+
|
|
8032
|
+
(function (module, exports) {
|
|
8033
|
+
|
|
8034
|
+
// ===================================================================
|
|
8035
|
+
|
|
8036
|
+
var construct = typeof Reflect !== "undefined" ? Reflect.construct : undefined;
|
|
8037
|
+
var defineProperty = Object.defineProperty;
|
|
8038
|
+
|
|
8039
|
+
// -------------------------------------------------------------------
|
|
8040
|
+
|
|
8041
|
+
var captureStackTrace = Error.captureStackTrace;
|
|
8042
|
+
if (captureStackTrace === undefined) {
|
|
8043
|
+
captureStackTrace = function captureStackTrace(error) {
|
|
8044
|
+
var container = new Error();
|
|
8045
|
+
|
|
8046
|
+
defineProperty(error, "stack", {
|
|
8047
|
+
configurable: true,
|
|
8048
|
+
get: function getStack() {
|
|
8049
|
+
var stack = container.stack;
|
|
8050
|
+
|
|
8051
|
+
// Replace property with value for faster future accesses.
|
|
8052
|
+
defineProperty(this, "stack", {
|
|
8053
|
+
configurable: true,
|
|
8054
|
+
value: stack,
|
|
8055
|
+
writable: true,
|
|
8056
|
+
});
|
|
8057
|
+
|
|
8058
|
+
return stack;
|
|
8059
|
+
},
|
|
8060
|
+
set: function setStack(stack) {
|
|
8061
|
+
defineProperty(error, "stack", {
|
|
8062
|
+
configurable: true,
|
|
8063
|
+
value: stack,
|
|
8064
|
+
writable: true,
|
|
8065
|
+
});
|
|
8066
|
+
},
|
|
8067
|
+
});
|
|
8068
|
+
};
|
|
8069
|
+
}
|
|
8070
|
+
|
|
8071
|
+
// -------------------------------------------------------------------
|
|
8072
|
+
|
|
8073
|
+
function BaseError(message) {
|
|
8074
|
+
if (message !== undefined) {
|
|
8075
|
+
defineProperty(this, "message", {
|
|
8076
|
+
configurable: true,
|
|
8077
|
+
value: message,
|
|
8078
|
+
writable: true,
|
|
8079
|
+
});
|
|
8080
|
+
}
|
|
8081
|
+
|
|
8082
|
+
var cname = this.constructor.name;
|
|
8083
|
+
if (cname !== undefined && cname !== this.name) {
|
|
8084
|
+
defineProperty(this, "name", {
|
|
8085
|
+
configurable: true,
|
|
8086
|
+
value: cname,
|
|
8087
|
+
writable: true,
|
|
8088
|
+
});
|
|
8089
|
+
}
|
|
8090
|
+
|
|
8091
|
+
captureStackTrace(this, this.constructor);
|
|
8092
|
+
}
|
|
8093
|
+
|
|
8094
|
+
BaseError.prototype = Object.create(Error.prototype, {
|
|
8095
|
+
// See: https://github.com/JsCommunity/make-error/issues/4
|
|
8096
|
+
constructor: {
|
|
8097
|
+
configurable: true,
|
|
8098
|
+
value: BaseError,
|
|
8099
|
+
writable: true,
|
|
8100
|
+
},
|
|
8101
|
+
});
|
|
8102
|
+
|
|
8103
|
+
// -------------------------------------------------------------------
|
|
8104
|
+
|
|
8105
|
+
// Sets the name of a function if possible (depends of the JS engine).
|
|
8106
|
+
var setFunctionName = (function() {
|
|
8107
|
+
function setFunctionName(fn, name) {
|
|
8108
|
+
return defineProperty(fn, "name", {
|
|
8109
|
+
configurable: true,
|
|
8110
|
+
value: name,
|
|
8111
|
+
});
|
|
8112
|
+
}
|
|
8113
|
+
try {
|
|
8114
|
+
var f = function() {};
|
|
8115
|
+
setFunctionName(f, "foo");
|
|
8116
|
+
if (f.name === "foo") {
|
|
8117
|
+
return setFunctionName;
|
|
8118
|
+
}
|
|
8119
|
+
} catch (_) {}
|
|
8120
|
+
})();
|
|
8121
|
+
|
|
8122
|
+
// -------------------------------------------------------------------
|
|
8123
|
+
|
|
8124
|
+
function makeError(constructor, super_) {
|
|
8125
|
+
if (super_ == null || super_ === Error) {
|
|
8126
|
+
super_ = BaseError;
|
|
8127
|
+
} else if (typeof super_ !== "function") {
|
|
8128
|
+
throw new TypeError("super_ should be a function");
|
|
8129
|
+
}
|
|
8130
|
+
|
|
8131
|
+
var name;
|
|
8132
|
+
if (typeof constructor === "string") {
|
|
8133
|
+
name = constructor;
|
|
8134
|
+
constructor =
|
|
8135
|
+
construct !== undefined
|
|
8136
|
+
? function() {
|
|
8137
|
+
return construct(super_, arguments, this.constructor);
|
|
8138
|
+
}
|
|
8139
|
+
: function() {
|
|
8140
|
+
super_.apply(this, arguments);
|
|
8141
|
+
};
|
|
8142
|
+
|
|
8143
|
+
// If the name can be set, do it once and for all.
|
|
8144
|
+
if (setFunctionName !== undefined) {
|
|
8145
|
+
setFunctionName(constructor, name);
|
|
8146
|
+
name = undefined;
|
|
8147
|
+
}
|
|
8148
|
+
} else if (typeof constructor !== "function") {
|
|
8149
|
+
throw new TypeError("constructor should be either a string or a function");
|
|
8150
|
+
}
|
|
8151
|
+
|
|
8152
|
+
// Also register the super constructor also as `constructor.super_` just
|
|
8153
|
+
// like Node's `util.inherits()`.
|
|
8154
|
+
//
|
|
8155
|
+
// eslint-disable-next-line dot-notation
|
|
8156
|
+
constructor.super_ = constructor["super"] = super_;
|
|
8157
|
+
|
|
8158
|
+
var properties = {
|
|
8159
|
+
constructor: {
|
|
8160
|
+
configurable: true,
|
|
8161
|
+
value: constructor,
|
|
8162
|
+
writable: true,
|
|
8163
|
+
},
|
|
8164
|
+
};
|
|
8165
|
+
|
|
8166
|
+
// If the name could not be set on the constructor, set it on the
|
|
8167
|
+
// prototype.
|
|
8168
|
+
if (name !== undefined) {
|
|
8169
|
+
properties.name = {
|
|
8170
|
+
configurable: true,
|
|
8171
|
+
value: name,
|
|
8172
|
+
writable: true,
|
|
8173
|
+
};
|
|
8174
|
+
}
|
|
8175
|
+
constructor.prototype = Object.create(super_.prototype, properties);
|
|
8176
|
+
|
|
8177
|
+
return constructor;
|
|
8178
|
+
}
|
|
8179
|
+
exports = module.exports = makeError;
|
|
8180
|
+
exports.BaseError = BaseError;
|
|
8181
|
+
} (makeError, makeError.exports));
|
|
8182
|
+
|
|
8183
|
+
var makeErrorExports = makeError.exports;
|
|
8184
|
+
|
|
8185
|
+
// MARK: Upload Options
|
|
7812
8186
|
function assertStorageUploadOptionsStringFormat(options) {
|
|
7813
8187
|
const stringFormat = options?.stringFormat;
|
|
7814
8188
|
if (!stringFormat) {
|
|
@@ -7819,6 +8193,36 @@ function assertStorageUploadOptionsStringFormat(options) {
|
|
|
7819
8193
|
function noStringFormatInStorageUploadOptionsError() {
|
|
7820
8194
|
return new Error('stringFormat was missing a value in the StorageUploadOptions.');
|
|
7821
8195
|
}
|
|
8196
|
+
// MARK: Stream Error
|
|
8197
|
+
class StorageFileUploadStreamUnsupportedError extends makeErrorExports.BaseError {
|
|
8198
|
+
constructor() {
|
|
8199
|
+
super('Failed to upload file using a stream. The file does not support upload streams.');
|
|
8200
|
+
}
|
|
8201
|
+
}
|
|
8202
|
+
|
|
8203
|
+
/**
|
|
8204
|
+
* Uploads a file using a Readable, using the uploadStream() method on the FirebaseStorageAccessorFile.
|
|
8205
|
+
*
|
|
8206
|
+
* If uploadStream is not supported, a StorageFileUploadStreamUnsupportedError will be thrown.
|
|
8207
|
+
*
|
|
8208
|
+
* @param file The file to upload to.
|
|
8209
|
+
* @param readableStream The stream to upload.
|
|
8210
|
+
* @param options The upload options.
|
|
8211
|
+
* @returns A promise that resolves when the upload is complete.
|
|
8212
|
+
*/
|
|
8213
|
+
async function uploadFileWithStream(file, readableStream, options) {
|
|
8214
|
+
if (!file.uploadStream) {
|
|
8215
|
+
throw new StorageFileUploadStreamUnsupportedError();
|
|
8216
|
+
}
|
|
8217
|
+
const uploadStream = file.uploadStream(options);
|
|
8218
|
+
readableStream.pipe(uploadStream, {
|
|
8219
|
+
end: true
|
|
8220
|
+
});
|
|
8221
|
+
return new Promise((resolve, reject) => {
|
|
8222
|
+
uploadStream.on('finish', resolve);
|
|
8223
|
+
uploadStream.on('error', reject);
|
|
8224
|
+
});
|
|
8225
|
+
}
|
|
7822
8226
|
|
|
7823
8227
|
function storageListFilesResultFactory(delegate) {
|
|
7824
8228
|
return (storage, folder, options, result) => {
|
|
@@ -7835,10 +8239,11 @@ function storageListFilesResultFactory(delegate) {
|
|
|
7835
8239
|
if (!hasNext) {
|
|
7836
8240
|
throw storageListFilesResultHasNoNextError();
|
|
7837
8241
|
}
|
|
7838
|
-
return delegate.next(storage, folder, result);
|
|
8242
|
+
return delegate.next(storage, options, folder, result);
|
|
7839
8243
|
});
|
|
7840
8244
|
const files = util.cachedGetter(() => delegate.filesFromResult(result, folder).map(fileResult));
|
|
7841
8245
|
const folders = util.cachedGetter(() => delegate.foldersFromResult(result, folder).map(folderResult));
|
|
8246
|
+
const nextPageToken = util.cachedGetter(() => delegate.nextPageTokenFromResult(result));
|
|
7842
8247
|
const filesResult = {
|
|
7843
8248
|
raw: result,
|
|
7844
8249
|
options,
|
|
@@ -7846,7 +8251,8 @@ function storageListFilesResultFactory(delegate) {
|
|
|
7846
8251
|
hasItems: () => delegate.hasItems(result),
|
|
7847
8252
|
next,
|
|
7848
8253
|
files,
|
|
7849
|
-
folders
|
|
8254
|
+
folders,
|
|
8255
|
+
nextPageToken
|
|
7850
8256
|
};
|
|
7851
8257
|
return filesResult;
|
|
7852
8258
|
};
|
|
@@ -7867,7 +8273,7 @@ function firebaseStorageContextFactory(drivers) {
|
|
|
7867
8273
|
defaultBucketId: inputDefaultBucketId,
|
|
7868
8274
|
forceBucket = false
|
|
7869
8275
|
} = config ?? {};
|
|
7870
|
-
const defaultBucketId = inputDefaultBucketId || drivers.storageAccessorDriver.
|
|
8276
|
+
const defaultBucketId = inputDefaultBucketId || drivers.storageAccessorDriver.getDefaultBucket?.(firebaseStorage) || '';
|
|
7871
8277
|
if (!defaultBucketId) {
|
|
7872
8278
|
throw new Error('Could not resolve a default bucket id for the firebaseStorageContextFactory(). Supply a defaultBucketId.');
|
|
7873
8279
|
}
|
|
@@ -7897,33 +8303,47 @@ function firebaseStorageFileExists(ref) {
|
|
|
7897
8303
|
}
|
|
7898
8304
|
function firebaseStorageClientAccessorFile(storage$1, storagePath) {
|
|
7899
8305
|
const ref = firebaseStorageRefForStorageFilePath(storage$1, storagePath);
|
|
7900
|
-
function
|
|
7901
|
-
|
|
8306
|
+
function _configureMetadata(options) {
|
|
8307
|
+
return util.filterUndefinedValues({
|
|
8308
|
+
cacheControl: options.metadata?.cacheControl,
|
|
8309
|
+
contentDisposition: options.metadata?.contentDisposition,
|
|
8310
|
+
contentEncoding: options.metadata?.contentEncoding,
|
|
8311
|
+
contentLanguage: options.metadata?.contentLanguage,
|
|
8312
|
+
contentType: options.metadata?.contentType,
|
|
8313
|
+
customMetadata: util.filterUndefinedValues({
|
|
8314
|
+
...options.metadata?.customMetadata,
|
|
8315
|
+
...options?.customMetadata
|
|
8316
|
+
})
|
|
8317
|
+
});
|
|
8318
|
+
}
|
|
8319
|
+
function uploadMetadataFromStorageUploadOptions(options) {
|
|
8320
|
+
let result;
|
|
7902
8321
|
if (options != null) {
|
|
7903
|
-
|
|
7904
|
-
|
|
7905
|
-
|
|
7906
|
-
|
|
7907
|
-
|
|
7908
|
-
|
|
7909
|
-
|
|
7910
|
-
contentType
|
|
7911
|
-
} : undefined),
|
|
7912
|
-
...metadata
|
|
7913
|
-
};
|
|
7914
|
-
}
|
|
8322
|
+
result = _configureMetadata({
|
|
8323
|
+
metadata: {
|
|
8324
|
+
...options.metadata,
|
|
8325
|
+
contentType: options.contentType ?? options.metadata?.contentType
|
|
8326
|
+
},
|
|
8327
|
+
customMetadata: options.customMetadata
|
|
8328
|
+
});
|
|
7915
8329
|
}
|
|
7916
8330
|
return result;
|
|
7917
8331
|
}
|
|
7918
|
-
|
|
8332
|
+
function asSettableMetadata(metadata) {
|
|
8333
|
+
return _configureMetadata({
|
|
8334
|
+
metadata
|
|
8335
|
+
});
|
|
8336
|
+
}
|
|
8337
|
+
const clientFile = {
|
|
7919
8338
|
reference: ref,
|
|
7920
8339
|
storagePath,
|
|
7921
8340
|
exists: () => firebaseStorageFileExists(ref),
|
|
7922
8341
|
getDownloadUrl: () => storage.getDownloadURL(ref),
|
|
7923
8342
|
getMetadata: () => storage.getMetadata(ref),
|
|
8343
|
+
setMetadata: metadata => storage.updateMetadata(ref, asSettableMetadata(metadata)),
|
|
7924
8344
|
upload: (input, options) => {
|
|
7925
8345
|
const inputType = typeof input === 'string';
|
|
7926
|
-
const metadataOption =
|
|
8346
|
+
const metadataOption = uploadMetadataFromStorageUploadOptions(options);
|
|
7927
8347
|
if (inputType) {
|
|
7928
8348
|
const stringFormat = assertStorageUploadOptionsStringFormat(options);
|
|
7929
8349
|
return storage.uploadString(ref, input, stringFormat, metadataOption);
|
|
@@ -7934,8 +8354,35 @@ function firebaseStorageClientAccessorFile(storage$1, storagePath) {
|
|
|
7934
8354
|
getBytes: maxDownloadSizeBytes => storage.getBytes(ref, maxDownloadSizeBytes),
|
|
7935
8355
|
getBlob: maxDownloadSizeBytes => storage.getBlob(ref, maxDownloadSizeBytes),
|
|
7936
8356
|
uploadResumable: (input, options) => {
|
|
7937
|
-
const metadataOption =
|
|
7938
|
-
|
|
8357
|
+
const metadataOption = uploadMetadataFromStorageUploadOptions(options);
|
|
8358
|
+
const uploadBytesTask = storage.uploadBytesResumable(ref, input, metadataOption);
|
|
8359
|
+
function wrapSnapshot(currentSnapshot) {
|
|
8360
|
+
const snapshot = {
|
|
8361
|
+
bytesTransferred: currentSnapshot.bytesTransferred,
|
|
8362
|
+
totalBytes: currentSnapshot.totalBytes,
|
|
8363
|
+
metadata: currentSnapshot.metadata,
|
|
8364
|
+
state: currentSnapshot.state,
|
|
8365
|
+
uploadTask
|
|
8366
|
+
};
|
|
8367
|
+
return snapshot;
|
|
8368
|
+
}
|
|
8369
|
+
const uploadTask = {
|
|
8370
|
+
taskRef: uploadBytesTask,
|
|
8371
|
+
cancel: () => uploadBytesTask.cancel(),
|
|
8372
|
+
pause: () => uploadBytesTask.pause(),
|
|
8373
|
+
resume: () => uploadBytesTask.resume(),
|
|
8374
|
+
getSnapshot: () => wrapSnapshot(uploadBytesTask.snapshot),
|
|
8375
|
+
streamSnapshotEvents: util.cachedGetter(() => {
|
|
8376
|
+
const internalSnapshotObs = new rxjs.Observable(x => uploadBytesTask.on('state_changed', {
|
|
8377
|
+
next: y => x.next(y),
|
|
8378
|
+
error: e => x.error(e),
|
|
8379
|
+
complete: () => x.complete()
|
|
8380
|
+
}));
|
|
8381
|
+
const snapshotEvents = internalSnapshotObs.pipe(rxjs.map(x => wrapSnapshot(x)), rxjs.shareReplay(1));
|
|
8382
|
+
return snapshotEvents;
|
|
8383
|
+
})
|
|
8384
|
+
};
|
|
8385
|
+
return uploadTask;
|
|
7939
8386
|
},
|
|
7940
8387
|
delete: options => storage.deleteObject(ref).catch(x => {
|
|
7941
8388
|
if (!options.ignoreNotFound || !isFirebaseStorageObjectNotFoundError(x)) {
|
|
@@ -7943,6 +8390,7 @@ function firebaseStorageClientAccessorFile(storage$1, storagePath) {
|
|
|
7943
8390
|
}
|
|
7944
8391
|
})
|
|
7945
8392
|
};
|
|
8393
|
+
return clientFile;
|
|
7946
8394
|
}
|
|
7947
8395
|
const firebaseStorageClientListFilesResultFactory = storageListFilesResultFactory({
|
|
7948
8396
|
hasItems: result => {
|
|
@@ -7951,8 +8399,12 @@ const firebaseStorageClientListFilesResultFactory = storageListFilesResultFactor
|
|
|
7951
8399
|
hasNext: result => {
|
|
7952
8400
|
return result.listResult.nextPageToken != null;
|
|
7953
8401
|
},
|
|
7954
|
-
|
|
8402
|
+
nextPageTokenFromResult(result) {
|
|
8403
|
+
return result.listResult.nextPageToken;
|
|
8404
|
+
},
|
|
8405
|
+
next(storage, options, folder, result) {
|
|
7955
8406
|
return folder.list({
|
|
8407
|
+
...options,
|
|
7956
8408
|
...result.options,
|
|
7957
8409
|
pageToken: result.listResult.nextPageToken
|
|
7958
8410
|
});
|
|
@@ -7990,16 +8442,37 @@ function firebaseStorageClientAccessorFolder(storage$1, storagePath) {
|
|
|
7990
8442
|
exists: () => folder.list({
|
|
7991
8443
|
maxResults: 1
|
|
7992
8444
|
}).then(x => x.hasItems()),
|
|
7993
|
-
list:
|
|
7994
|
-
options,
|
|
7995
|
-
|
|
7996
|
-
|
|
8445
|
+
list: async options => {
|
|
8446
|
+
const rootResults = await storage.list(ref, options).then(listResult => firebaseStorageClientListFilesResultFactory(storage$1, folder, options, {
|
|
8447
|
+
options,
|
|
8448
|
+
listResult
|
|
8449
|
+
}));
|
|
8450
|
+
let result;
|
|
8451
|
+
if (options?.includeNestedResults) {
|
|
8452
|
+
const allImmediateFiles = rootResults.files();
|
|
8453
|
+
const allImmediateFolders = rootResults.folders();
|
|
8454
|
+
const allNestedFolderFileResults = await Promise.all(allImmediateFolders.map(x => x.folder().list({
|
|
8455
|
+
includeNestedResults: true
|
|
8456
|
+
}).then(x => x.files())));
|
|
8457
|
+
const allNestedFiles = allNestedFolderFileResults.flat();
|
|
8458
|
+
const allFiles = [...allImmediateFiles, ...allNestedFiles];
|
|
8459
|
+
result = {
|
|
8460
|
+
...rootResults,
|
|
8461
|
+
files: () => allFiles,
|
|
8462
|
+
folders: () => [] // no folders
|
|
8463
|
+
};
|
|
8464
|
+
} else {
|
|
8465
|
+
result = rootResults;
|
|
8466
|
+
}
|
|
8467
|
+
return result;
|
|
8468
|
+
}
|
|
7997
8469
|
};
|
|
7998
8470
|
return folder;
|
|
7999
8471
|
}
|
|
8000
8472
|
function firebaseStorageClientAccessorDriver() {
|
|
8001
8473
|
return {
|
|
8002
|
-
|
|
8474
|
+
type: 'client',
|
|
8475
|
+
getDefaultBucket: storage => storage.app.options.storageBucket ?? '',
|
|
8003
8476
|
file: (storage, path) => firebaseStorageClientAccessorFile(storage, path),
|
|
8004
8477
|
folder: (storage, path) => firebaseStorageClientAccessorFolder(storage, path)
|
|
8005
8478
|
};
|
|
@@ -9338,13 +9811,22 @@ function createNotificationDocumentPair(input) {
|
|
|
9338
9811
|
const isNotificationTask = st === exports.NotificationSendType.TASK_NOTIFICATION;
|
|
9339
9812
|
if (isNotificationTask && inputUnique) {
|
|
9340
9813
|
let uniqueId;
|
|
9814
|
+
/**
|
|
9815
|
+
* Defaults to the notification box id if no target model is provided.
|
|
9816
|
+
*/
|
|
9817
|
+
const targetModelId = n.m;
|
|
9341
9818
|
if (typeof inputUnique === 'string') {
|
|
9342
9819
|
uniqueId = inputUnique;
|
|
9343
9820
|
if (!isFirestoreModelId(uniqueId)) {
|
|
9344
9821
|
throw new Error('Input "unique" notification task id is not a valid firestore model id.');
|
|
9345
9822
|
}
|
|
9823
|
+
} else if (targetModelId) {
|
|
9824
|
+
uniqueId = notificationTaskUniqueId(targetModelId, n.t);
|
|
9346
9825
|
} else {
|
|
9347
|
-
|
|
9826
|
+
// Without a target model, the generated id ends up being a type-global unique notification task id, or if
|
|
9827
|
+
// the notification task global default model type is used, being unique across the whole system, which is
|
|
9828
|
+
// generally unintended behavor. When it is desired, the inputUnique can be a string.
|
|
9829
|
+
throw new Error('Must provide a target model when using unique=true for a notification task. The default result otherwise would be an unintended type-global unique notification task id.');
|
|
9348
9830
|
}
|
|
9349
9831
|
notificationDocument = accessor.loadDocumentForId(uniqueId);
|
|
9350
9832
|
} else {
|
|
@@ -9445,9 +9927,10 @@ async function createNotificationDocumentIfSending(input) {
|
|
|
9445
9927
|
* @returns
|
|
9446
9928
|
*/
|
|
9447
9929
|
function createNotificationTaskTemplate(input) {
|
|
9448
|
-
|
|
9930
|
+
const notificationModel = input.notificationModel ?? DEFAULT_NOTIFICATION_TASK_NOTIFICATION_MODEL_KEY;
|
|
9931
|
+
const result = createNotificationTemplate({
|
|
9449
9932
|
...input,
|
|
9450
|
-
notificationModel
|
|
9933
|
+
notificationModel,
|
|
9451
9934
|
tpr: input.completedCheckpoints ?? input.tpr,
|
|
9452
9935
|
sendType: exports.NotificationSendType.TASK_NOTIFICATION,
|
|
9453
9936
|
st: undefined,
|
|
@@ -9455,6 +9938,10 @@ function createNotificationTaskTemplate(input) {
|
|
|
9455
9938
|
recipients: undefined,
|
|
9456
9939
|
r: undefined
|
|
9457
9940
|
});
|
|
9941
|
+
if (!input.notificationModel && !result.n.m && input.unique === true) {
|
|
9942
|
+
throw new Error('Must provide a target model when using unique=true for a notification task template. The default result otherwise would be an unintended type-global unique notification task id.');
|
|
9943
|
+
}
|
|
9944
|
+
return result;
|
|
9458
9945
|
}
|
|
9459
9946
|
|
|
9460
9947
|
/**
|
|
@@ -9730,6 +10217,22 @@ function notificationTaskFailed(updateMetadata, removeFromCompletedCheckpoints)
|
|
|
9730
10217
|
removeFromCompletedCheckpoints
|
|
9731
10218
|
};
|
|
9732
10219
|
}
|
|
10220
|
+
/**
|
|
10221
|
+
* Wraps an existing NotificationTaskServiceHandleNotificationTaskResult<D> and sets canRunNextCheckpoint to true if it is undefined.
|
|
10222
|
+
*
|
|
10223
|
+
* @param result The result to use as a template.
|
|
10224
|
+
* @param force If true, then canRunNextCheckpoint will be set to true even if it is already defined.
|
|
10225
|
+
* @returns A new result.
|
|
10226
|
+
*/
|
|
10227
|
+
function notificationTaskCanRunNextCheckpoint(result, force) {
|
|
10228
|
+
if (force || result.canRunNextCheckpoint == null) {
|
|
10229
|
+
result = {
|
|
10230
|
+
...result,
|
|
10231
|
+
canRunNextCheckpoint: true
|
|
10232
|
+
};
|
|
10233
|
+
}
|
|
10234
|
+
return result;
|
|
10235
|
+
}
|
|
9733
10236
|
|
|
9734
10237
|
var $ = _export;
|
|
9735
10238
|
var iterate = iterate$2;
|
|
@@ -9987,6 +10490,727 @@ function loadNotificationBoxDocumentForReferencePair(input, accessor) {
|
|
|
9987
10490
|
return notificationBoxDocument;
|
|
9988
10491
|
}
|
|
9989
10492
|
|
|
10493
|
+
/**
|
|
10494
|
+
* Thrown if the target uploaded file does not exist.
|
|
10495
|
+
*/
|
|
10496
|
+
const UPLOADED_FILE_DOES_NOT_EXIST_ERROR_CODE = 'UPLOADED_FILE_DOES_NOT_EXIST';
|
|
10497
|
+
/**
|
|
10498
|
+
* Thrown if the target uploaded file is not allowed to be initialized.
|
|
10499
|
+
*/
|
|
10500
|
+
const UPLOADED_FILE_NOT_ALLOWED_TO_BE_INITIALIZED_ERROR_CODE = 'UPLOADED_FILE_NOT_ALLOWED_TO_BE_INITIALIZED';
|
|
10501
|
+
/**
|
|
10502
|
+
* Thrown if the target uploaded file initialization failed.
|
|
10503
|
+
*/
|
|
10504
|
+
const UPLOADED_FILE_INITIALIZATION_FAILED_ERROR_CODE = 'UPLOADED_FILE_INITIALIZATION_FAILED';
|
|
10505
|
+
/**
|
|
10506
|
+
* Thrown if the target uploaded file initialization was successful, but produced no new StorageFileDocument.
|
|
10507
|
+
*/
|
|
10508
|
+
const UPLOADED_FILE_INITIALIZATION_DISCARDED_ERROR_CODE = 'UPLOADED_FILE_INITIALIZATION_DISCARDED';
|
|
10509
|
+
/**
|
|
10510
|
+
* Thrown if the target StorageFileDocument is not queued for processing and is called to be processed.
|
|
10511
|
+
*/
|
|
10512
|
+
const STORAGE_FILE_PROCESSING_NOT_QUEUED_FOR_PROCESSING_ERROR_CODE = 'STORAGE_FILE_PROCESSING_NOT_QUEUED_FOR_PROCESSING';
|
|
10513
|
+
/**
|
|
10514
|
+
* Thrown if:
|
|
10515
|
+
* - the target StorageFileDocument was marked as queued for processing but isn't actually a processable-type.
|
|
10516
|
+
* - the target StorageFileDocument is marked as init but has no purpose set, meaning it can't be processed.
|
|
10517
|
+
*/
|
|
10518
|
+
const STORAGE_FILE_PROCESSING_NOT_AVAILABLE_FOR_TYPE_ERROR_CODE = 'STORAGE_FILE_PROCESSING_NOT_AVAILABLE_FOR_TYPE';
|
|
10519
|
+
/**
|
|
10520
|
+
* Thrown if the StorageFile is not in an OK state.
|
|
10521
|
+
*/
|
|
10522
|
+
const STORAGE_FILE_PROCESSING_NOT_ALLOWED_FOR_INVALID_STATE_ERROR_CODE = 'STORAGE_FILE_PROCESSING_NOT_ALLOWED_FOR_INVALID_STATE';
|
|
10523
|
+
/**
|
|
10524
|
+
* Thrown if the target StorageFileDocument already finished processing.
|
|
10525
|
+
*/
|
|
10526
|
+
const STORAGE_FILE_ALREADY_PROCESSED_ERROR_CODE = 'STORAGE_FILE_ALREADY_PROCESSED';
|
|
10527
|
+
/**
|
|
10528
|
+
* Thrown if the target StorageFileDocument is not flagged for deletion but attempts to be deleted.
|
|
10529
|
+
*/
|
|
10530
|
+
const STORAGE_FILE_NOT_FLAGGED_FOR_DELETION_ERROR_CODE = 'STORAGE_FILE_NOT_FLAGGED_FOR_DELETION';
|
|
10531
|
+
/**
|
|
10532
|
+
* Thrown if the target StorageFileDocument is flagged for deletion, but has not reached the time to be deleted yet.
|
|
10533
|
+
*/
|
|
10534
|
+
const STORAGE_FILE_CANNOT_BE_DELETED_YET_ERROR_CODE = 'STORAGE_FILE_CANNOT_BE_DELETED_YET';
|
|
10535
|
+
|
|
10536
|
+
/**
|
|
10537
|
+
* Used for directly create a new StorageFile.
|
|
10538
|
+
*/
|
|
10539
|
+
class CreateStorageFileParams {}
|
|
10540
|
+
/**
|
|
10541
|
+
* Initializes all StorageFiles in the uploads folder.
|
|
10542
|
+
*/
|
|
10543
|
+
class InitializeAllStorageFilesFromUploadsParams {
|
|
10544
|
+
constructor() {
|
|
10545
|
+
/**
|
|
10546
|
+
* The maximum number of files to initialize at once.
|
|
10547
|
+
*/
|
|
10548
|
+
this.maxFilesToInitialize = void 0;
|
|
10549
|
+
/**
|
|
10550
|
+
* The specific folder under the uploads folder to search for files and initialize
|
|
10551
|
+
*/
|
|
10552
|
+
this.folderPath = void 0;
|
|
10553
|
+
/**
|
|
10554
|
+
* Overrides the default uploads folder path.
|
|
10555
|
+
*/
|
|
10556
|
+
this.overrideUploadsFolderPath = void 0;
|
|
10557
|
+
}
|
|
10558
|
+
}
|
|
10559
|
+
__decorate([classTransformer.Expose(), classValidator.IsNumber(), classValidator.IsOptional(), __metadata("design:type", Object)], InitializeAllStorageFilesFromUploadsParams.prototype, "maxFilesToInitialize", void 0);
|
|
10560
|
+
__decorate([classTransformer.Expose(), classValidator.IsString(), classValidator.IsOptional(), __metadata("design:type", Object)], InitializeAllStorageFilesFromUploadsParams.prototype, "folderPath", void 0);
|
|
10561
|
+
__decorate([classTransformer.Expose(), classValidator.IsString(), classValidator.IsOptional(), __metadata("design:type", Object)], InitializeAllStorageFilesFromUploadsParams.prototype, "overrideUploadsFolderPath", void 0);
|
|
10562
|
+
/**
|
|
10563
|
+
* Initializes a StorageFile from the document at the given path.
|
|
10564
|
+
*/
|
|
10565
|
+
class InitializeStorageFileFromUploadParams {
|
|
10566
|
+
constructor() {
|
|
10567
|
+
/**
|
|
10568
|
+
* Specific bucketId to use.
|
|
10569
|
+
*
|
|
10570
|
+
* If not defined, the default bucket will be used.
|
|
10571
|
+
*/
|
|
10572
|
+
this.bucketId = void 0;
|
|
10573
|
+
this.pathString = void 0;
|
|
10574
|
+
}
|
|
10575
|
+
}
|
|
10576
|
+
__decorate([classTransformer.Expose(), classValidator.IsOptional(), classValidator.IsString(), __metadata("design:type", Object)], InitializeStorageFileFromUploadParams.prototype, "bucketId", void 0);
|
|
10577
|
+
__decorate([classTransformer.Expose(), classValidator.IsString(), __metadata("design:type", String)], InitializeStorageFileFromUploadParams.prototype, "pathString", void 0);
|
|
10578
|
+
class ProcessStorageFileParams extends TargetModelParams {
|
|
10579
|
+
constructor(...args) {
|
|
10580
|
+
super(...args);
|
|
10581
|
+
/**
|
|
10582
|
+
* If set, will start/run the processing immediately instead of waiting for the next scheduled run.
|
|
10583
|
+
*/
|
|
10584
|
+
this.runImmediately = void 0;
|
|
10585
|
+
/**
|
|
10586
|
+
* If set, will check and retry processing if the StorageFile is in a failed processing state.
|
|
10587
|
+
*/
|
|
10588
|
+
this.checkRetryProcessing = void 0;
|
|
10589
|
+
/**
|
|
10590
|
+
* Used with retryProcessing.
|
|
10591
|
+
*
|
|
10592
|
+
* If set, will forcibly create a new processing task even if the existing processing task appears to be ok.
|
|
10593
|
+
*/
|
|
10594
|
+
this.forceRestartProcessing = void 0;
|
|
10595
|
+
}
|
|
10596
|
+
}
|
|
10597
|
+
__decorate([classTransformer.Expose(), classValidator.IsBoolean(), classValidator.IsOptional(), __metadata("design:type", Object)], ProcessStorageFileParams.prototype, "runImmediately", void 0);
|
|
10598
|
+
__decorate([classTransformer.Expose(), classValidator.IsBoolean(), classValidator.IsOptional(), __metadata("design:type", Object)], ProcessStorageFileParams.prototype, "checkRetryProcessing", void 0);
|
|
10599
|
+
__decorate([classTransformer.Expose(), classValidator.IsBoolean(), classValidator.IsOptional(), __metadata("design:type", Object)], ProcessStorageFileParams.prototype, "forceRestartProcessing", void 0);
|
|
10600
|
+
/**
|
|
10601
|
+
* Processes all StorageFiles that are queued for processing.
|
|
10602
|
+
*/
|
|
10603
|
+
class ProcessAllQueuedStorageFilesParams {}
|
|
10604
|
+
class UpdateStorageFileParams extends TargetModelParams {
|
|
10605
|
+
constructor(...args) {
|
|
10606
|
+
super(...args);
|
|
10607
|
+
/**
|
|
10608
|
+
* Sets the delete at time for the given StorageFileDocument, and queues the file for deletion.
|
|
10609
|
+
*/
|
|
10610
|
+
this.sdat = void 0;
|
|
10611
|
+
}
|
|
10612
|
+
}
|
|
10613
|
+
__decorate([classTransformer.Expose(), classValidator.IsDate(), classValidator.IsOptional(), classTransformer.Type(() => Date), __metadata("design:type", Object)], UpdateStorageFileParams.prototype, "sdat", void 0);
|
|
10614
|
+
class DeleteStorageFileParams extends TargetModelParams {
|
|
10615
|
+
constructor(...args) {
|
|
10616
|
+
super(...args);
|
|
10617
|
+
/**
|
|
10618
|
+
* If true, will force the deletion of the StorageFile even if it is not queued for deletion.
|
|
10619
|
+
*/
|
|
10620
|
+
this.force = void 0;
|
|
10621
|
+
}
|
|
10622
|
+
}
|
|
10623
|
+
__decorate([classTransformer.Expose(), classValidator.IsBoolean(), classValidator.IsOptional(), __metadata("design:type", Object)], DeleteStorageFileParams.prototype, "force", void 0);
|
|
10624
|
+
/**
|
|
10625
|
+
* Processes all StorageFiles that are queued for processing.
|
|
10626
|
+
*/
|
|
10627
|
+
class DeleteAllQueuedStorageFilesParams {}
|
|
10628
|
+
const storageFileFunctionTypeConfigMap = {};
|
|
10629
|
+
const storageFileModelCrudFunctionsConfig = {
|
|
10630
|
+
storageFile: ['create:_,fromUpload,allFromUpload', 'update:_,process', 'delete:_']
|
|
10631
|
+
};
|
|
10632
|
+
class StorageFileFunctions {}
|
|
10633
|
+
const storageFileFunctionMap = callModelFirebaseFunctionMapFactory(storageFileFunctionTypeConfigMap, storageFileModelCrudFunctionsConfig);
|
|
10634
|
+
|
|
10635
|
+
class StorageFileFirestoreCollections {}
|
|
10636
|
+
// MARK: StorageFile
|
|
10637
|
+
const storageFileIdentity = firestoreModelIdentity('storageFile', 'sf');
|
|
10638
|
+
/**
|
|
10639
|
+
* The current file state.
|
|
10640
|
+
*/
|
|
10641
|
+
exports.StorageFileCreationType = void 0;
|
|
10642
|
+
(function (StorageFileCreationType) {
|
|
10643
|
+
/**
|
|
10644
|
+
* No info about how this file was created.
|
|
10645
|
+
*/
|
|
10646
|
+
StorageFileCreationType[StorageFileCreationType["NONE"] = 0] = "NONE";
|
|
10647
|
+
/**
|
|
10648
|
+
* The StorageFile was directly created.
|
|
10649
|
+
*/
|
|
10650
|
+
StorageFileCreationType[StorageFileCreationType["DIRECTLY_CREATED"] = 1] = "DIRECTLY_CREATED";
|
|
10651
|
+
/**
|
|
10652
|
+
* The StorageFile was initialized from an uploaded file.
|
|
10653
|
+
*/
|
|
10654
|
+
StorageFileCreationType[StorageFileCreationType["INIT_FROM_UPLOAD"] = 2] = "INIT_FROM_UPLOAD";
|
|
10655
|
+
})(exports.StorageFileCreationType || (exports.StorageFileCreationType = {}));
|
|
10656
|
+
/**
|
|
10657
|
+
* The current file state.
|
|
10658
|
+
*/
|
|
10659
|
+
exports.StorageFileState = void 0;
|
|
10660
|
+
(function (StorageFileState) {
|
|
10661
|
+
/**
|
|
10662
|
+
* The StorageFile has no state, or is just being initialized.
|
|
10663
|
+
*/
|
|
10664
|
+
StorageFileState[StorageFileState["INIT"] = 0] = "INIT";
|
|
10665
|
+
/**
|
|
10666
|
+
* The StorageFile failed to initialize properly and is considered invalid.
|
|
10667
|
+
*
|
|
10668
|
+
* StorageFiles that are marked invalid are deleted after a period of time.
|
|
10669
|
+
*
|
|
10670
|
+
* Files that are invalid cannot be processed.
|
|
10671
|
+
*/
|
|
10672
|
+
StorageFileState[StorageFileState["INVALID"] = 1] = "INVALID";
|
|
10673
|
+
/**
|
|
10674
|
+
* The StorageFile has been initialized and is ok.
|
|
10675
|
+
*/
|
|
10676
|
+
StorageFileState[StorageFileState["OK"] = 2] = "OK";
|
|
10677
|
+
/**
|
|
10678
|
+
* A previously OK file that is now queued for deletion.
|
|
10679
|
+
*/
|
|
10680
|
+
StorageFileState[StorageFileState["QUEUED_FOR_DELETE"] = 3] = "QUEUED_FOR_DELETE";
|
|
10681
|
+
})(exports.StorageFileState || (exports.StorageFileState = {}));
|
|
10682
|
+
/**
|
|
10683
|
+
* The current processing state of the file.
|
|
10684
|
+
*/
|
|
10685
|
+
exports.StorageFileProcessingState = void 0;
|
|
10686
|
+
(function (StorageFileProcessingState) {
|
|
10687
|
+
/**
|
|
10688
|
+
* The StorageFile has no processing state or is just being initialized.
|
|
10689
|
+
*/
|
|
10690
|
+
StorageFileProcessingState[StorageFileProcessingState["INIT_OR_NONE"] = 0] = "INIT_OR_NONE";
|
|
10691
|
+
/**
|
|
10692
|
+
* The StorageFile is flagged for processing, which will create a NotificationTask for it.
|
|
10693
|
+
*/
|
|
10694
|
+
StorageFileProcessingState[StorageFileProcessingState["QUEUED_FOR_PROCESSING"] = 1] = "QUEUED_FOR_PROCESSING";
|
|
10695
|
+
/**
|
|
10696
|
+
* The StorageFile has an associated NotificationTask for it.
|
|
10697
|
+
*/
|
|
10698
|
+
StorageFileProcessingState[StorageFileProcessingState["PROCESSING"] = 2] = "PROCESSING";
|
|
10699
|
+
/**
|
|
10700
|
+
* The StorageFile has encountered an error during processing.
|
|
10701
|
+
*/
|
|
10702
|
+
StorageFileProcessingState[StorageFileProcessingState["FAILED"] = 3] = "FAILED";
|
|
10703
|
+
/**
|
|
10704
|
+
* The StorageFile has been processed or required no processing and is done.
|
|
10705
|
+
*/
|
|
10706
|
+
StorageFileProcessingState[StorageFileProcessingState["SUCCESS"] = 4] = "SUCCESS";
|
|
10707
|
+
/**
|
|
10708
|
+
* The StorageFile has been archived. It should not be processed.
|
|
10709
|
+
*/
|
|
10710
|
+
StorageFileProcessingState[StorageFileProcessingState["ARCHIVED"] = 5] = "ARCHIVED";
|
|
10711
|
+
/**
|
|
10712
|
+
* The StorageFile shouldn't be processed.
|
|
10713
|
+
*/
|
|
10714
|
+
StorageFileProcessingState[StorageFileProcessingState["DO_NOT_PROCESS"] = 6] = "DO_NOT_PROCESS";
|
|
10715
|
+
})(exports.StorageFileProcessingState || (exports.StorageFileProcessingState = {}));
|
|
10716
|
+
/**
|
|
10717
|
+
* After 3 hours of being in the PROCESSING state, we can check for retring processing.
|
|
10718
|
+
*/
|
|
10719
|
+
const STORAGE_FILE_PROCESSING_STUCK_THROTTLE_CHECK_MS = util.MS_IN_HOUR * 3;
|
|
10720
|
+
class StorageFileDocument extends AbstractFirestoreDocument {
|
|
10721
|
+
get modelIdentity() {
|
|
10722
|
+
return storageFileIdentity;
|
|
10723
|
+
}
|
|
10724
|
+
}
|
|
10725
|
+
const storageFileConverter = snapshotConverterFunctions({
|
|
10726
|
+
fields: {
|
|
10727
|
+
bucketId: firestoreString(),
|
|
10728
|
+
pathString: firestoreString(),
|
|
10729
|
+
cat: firestoreDate(),
|
|
10730
|
+
ct: optionalFirestoreEnum({
|
|
10731
|
+
defaultReadValue: exports.StorageFileCreationType.NONE,
|
|
10732
|
+
dontStoreDefaultReadValue: true
|
|
10733
|
+
}),
|
|
10734
|
+
fs: firestoreEnum({
|
|
10735
|
+
default: exports.StorageFileState.INIT
|
|
10736
|
+
}),
|
|
10737
|
+
ps: firestoreEnum({
|
|
10738
|
+
default: exports.StorageFileProcessingState.INIT_OR_NONE
|
|
10739
|
+
}),
|
|
10740
|
+
pn: optionalFirestoreString(),
|
|
10741
|
+
pat: optionalFirestoreDate(),
|
|
10742
|
+
pcat: optionalFirestoreDate(),
|
|
10743
|
+
u: optionalFirestoreString(),
|
|
10744
|
+
uby: optionalFirestoreString(),
|
|
10745
|
+
o: optionalFirestoreString(),
|
|
10746
|
+
p: optionalFirestoreString(),
|
|
10747
|
+
d: firestorePassThroughField(),
|
|
10748
|
+
sdat: optionalFirestoreDate()
|
|
10749
|
+
}
|
|
10750
|
+
});
|
|
10751
|
+
function storageFileCollectionReference(context) {
|
|
10752
|
+
return context.collection(storageFileIdentity.collectionName);
|
|
10753
|
+
}
|
|
10754
|
+
function storageFileFirestoreCollection(firestoreContext) {
|
|
10755
|
+
return firestoreContext.firestoreCollection({
|
|
10756
|
+
modelIdentity: storageFileIdentity,
|
|
10757
|
+
converter: storageFileConverter,
|
|
10758
|
+
collection: storageFileCollectionReference(firestoreContext),
|
|
10759
|
+
makeDocument: (accessor, documentAccessor) => new StorageFileDocument(accessor, documentAccessor),
|
|
10760
|
+
firestoreContext
|
|
10761
|
+
});
|
|
10762
|
+
}
|
|
10763
|
+
|
|
10764
|
+
/**
|
|
10765
|
+
* Creates a CreateStorageFileDocumentPairFactory.
|
|
10766
|
+
*
|
|
10767
|
+
* @param config
|
|
10768
|
+
* @returns
|
|
10769
|
+
*/
|
|
10770
|
+
function createStorageFileDocumentPairFactory(config = {}) {
|
|
10771
|
+
const {
|
|
10772
|
+
defaultCreationType: inputDefaultCreationType,
|
|
10773
|
+
defaultShouldBeProcessed: inputDefaultShouldBeProcessed
|
|
10774
|
+
} = config;
|
|
10775
|
+
const defaultCreationType = inputDefaultCreationType ?? exports.StorageFileCreationType.DIRECTLY_CREATED;
|
|
10776
|
+
const defaultShouldBeProcessed = inputDefaultShouldBeProcessed ?? false;
|
|
10777
|
+
return async input => {
|
|
10778
|
+
const {
|
|
10779
|
+
template: inputTemplate,
|
|
10780
|
+
accessor: inputAccessor,
|
|
10781
|
+
transaction,
|
|
10782
|
+
context,
|
|
10783
|
+
now: inputNow,
|
|
10784
|
+
uploadedBy,
|
|
10785
|
+
user,
|
|
10786
|
+
purpose,
|
|
10787
|
+
metadata,
|
|
10788
|
+
shouldBeProcessed
|
|
10789
|
+
} = input;
|
|
10790
|
+
const now = inputNow ?? new Date();
|
|
10791
|
+
let accessor = inputAccessor;
|
|
10792
|
+
if (!accessor && context) {
|
|
10793
|
+
const {
|
|
10794
|
+
storageFileCollection
|
|
10795
|
+
} = context;
|
|
10796
|
+
accessor = storageFileCollection.documentAccessorForTransaction(transaction);
|
|
10797
|
+
}
|
|
10798
|
+
if (!accessor) {
|
|
10799
|
+
throw new Error('createStorageFileDocumentPair() failed as neither an accessor nor a context was provided.');
|
|
10800
|
+
}
|
|
10801
|
+
const storagePath = input.file?.storagePath ?? input.storagePathRef?.storagePath ?? input.storagePath;
|
|
10802
|
+
if (!storagePath) {
|
|
10803
|
+
throw new Error('createStorageFileDocumentPair() failed as neither a file, storagePathRef, or storagePath was provided.');
|
|
10804
|
+
}
|
|
10805
|
+
const storageFileDocument = accessor.newDocument();
|
|
10806
|
+
const template = {
|
|
10807
|
+
...inputTemplate,
|
|
10808
|
+
cat: now,
|
|
10809
|
+
u: user ?? inputTemplate?.u,
|
|
10810
|
+
uby: uploadedBy ?? inputTemplate?.uby,
|
|
10811
|
+
p: purpose ?? inputTemplate?.p,
|
|
10812
|
+
d: metadata ?? inputTemplate?.d,
|
|
10813
|
+
fs: inputTemplate?.fs ?? exports.StorageFileState.OK,
|
|
10814
|
+
ps: shouldBeProcessed ?? defaultShouldBeProcessed ? exports.StorageFileProcessingState.QUEUED_FOR_PROCESSING : exports.StorageFileProcessingState.DO_NOT_PROCESS,
|
|
10815
|
+
ct: inputTemplate?.ct ?? defaultCreationType,
|
|
10816
|
+
bucketId: storagePath.bucketId,
|
|
10817
|
+
pathString: storagePath.pathString
|
|
10818
|
+
};
|
|
10819
|
+
// create the StorageFileDocument
|
|
10820
|
+
await storageFileDocument.create(template);
|
|
10821
|
+
return {
|
|
10822
|
+
storageFileDocument,
|
|
10823
|
+
storageFile: template
|
|
10824
|
+
};
|
|
10825
|
+
};
|
|
10826
|
+
}
|
|
10827
|
+
/**
|
|
10828
|
+
* Convenience function for creating a StorageFileDocumentPair.
|
|
10829
|
+
*
|
|
10830
|
+
* Calls createStorageFileDocumentPairFactory() with no arguments, then passes the input to the factory and returns the result.
|
|
10831
|
+
*/
|
|
10832
|
+
async function createStorageFileDocumentPair(input) {
|
|
10833
|
+
return createStorageFileDocumentPairFactory()(input);
|
|
10834
|
+
}
|
|
10835
|
+
|
|
10836
|
+
// MARK: StorageFile
|
|
10837
|
+
/**
|
|
10838
|
+
* Returns a query constraint for StorageFiles that are queued for processing.
|
|
10839
|
+
*/
|
|
10840
|
+
function storageFilesQueuedForProcessingQuery() {
|
|
10841
|
+
return [where('ps', '==', exports.StorageFileProcessingState.QUEUED_FOR_PROCESSING)];
|
|
10842
|
+
}
|
|
10843
|
+
/**
|
|
10844
|
+
* Returns a query constraint for StorageFiles that are queued for deletion and are past their scheduled delete date.
|
|
10845
|
+
*/
|
|
10846
|
+
function storageFilesQueuedForDeleteQuery(now) {
|
|
10847
|
+
return [whereDateIsBefore('sdat', now ?? new Date())];
|
|
10848
|
+
}
|
|
10849
|
+
function storageFilePurposeAndUserQuery(input) {
|
|
10850
|
+
return [where('p', '==', input.purpose), where('u', '==', input.user)];
|
|
10851
|
+
}
|
|
10852
|
+
|
|
10853
|
+
// MARK: Storage File Processing Notification
|
|
10854
|
+
const STORAGE_FILE_PROCESSING_NOTIFICATION_TASK_TYPE = 'SFP';
|
|
10855
|
+
/**
|
|
10856
|
+
* The maximum number of times to delay the cleanup step of a StorageFileProcessingNotificationTask.
|
|
10857
|
+
*/
|
|
10858
|
+
const DEFAULT_MAX_STORAGE_FILE_PROCESSING_CLEANUP_RETRY_ATTEMPTS = 4;
|
|
10859
|
+
/**
|
|
10860
|
+
* The default amount of time to delay the cleanup step of a StorageFileProcessingNotificationTask that failed to cleanup successfully.
|
|
10861
|
+
*/
|
|
10862
|
+
const DEFAULT_STORAGE_FILE_PROCESSING_CLEANUP_RETRY_DELAY = util.MS_IN_HOUR;
|
|
10863
|
+
function storageFileProcessingNotificationTaskTemplate(input) {
|
|
10864
|
+
const {
|
|
10865
|
+
storageFileDocument,
|
|
10866
|
+
overrideExistingTask
|
|
10867
|
+
} = input;
|
|
10868
|
+
return createNotificationTaskTemplate({
|
|
10869
|
+
type: STORAGE_FILE_PROCESSING_NOTIFICATION_TASK_TYPE,
|
|
10870
|
+
targetModel: storageFileDocument,
|
|
10871
|
+
data: {
|
|
10872
|
+
storageFile: storageFileDocument.id,
|
|
10873
|
+
d: input.sd
|
|
10874
|
+
},
|
|
10875
|
+
/**
|
|
10876
|
+
* The task is unique to the StorageFile.
|
|
10877
|
+
*/
|
|
10878
|
+
unique: true,
|
|
10879
|
+
overrideExistingTask
|
|
10880
|
+
});
|
|
10881
|
+
}
|
|
10882
|
+
// MARK: All Tasks
|
|
10883
|
+
const ALL_STORAGE_FILE_NOTIFICATION_TASK_TYPES = [STORAGE_FILE_PROCESSING_NOTIFICATION_TASK_TYPE];
|
|
10884
|
+
|
|
10885
|
+
/**
|
|
10886
|
+
* Creates a StoredFileReaderFactory.
|
|
10887
|
+
*
|
|
10888
|
+
* Should generally only be used on the server-side, as copy may not be available on the client-side.
|
|
10889
|
+
*/
|
|
10890
|
+
function storedFileReaderFactory() {
|
|
10891
|
+
return file => {
|
|
10892
|
+
const getPathDetails = util.cachedGetter(() => util.slashPathDetails(file.storagePath.pathString));
|
|
10893
|
+
const details = {
|
|
10894
|
+
...file.storagePath
|
|
10895
|
+
};
|
|
10896
|
+
const loadFileMetadata = util.cachedGetter(() => file.getMetadata());
|
|
10897
|
+
const loadCustomMetadata = () => {
|
|
10898
|
+
return loadFileMetadata().then(x => x.customMetadata);
|
|
10899
|
+
};
|
|
10900
|
+
const accessor = {
|
|
10901
|
+
input: details,
|
|
10902
|
+
getPathDetails,
|
|
10903
|
+
loadFileBytes: file.getBytes,
|
|
10904
|
+
// do not cache the file data accessors
|
|
10905
|
+
loadFileStream: file.getStream,
|
|
10906
|
+
loadFileMetadata,
|
|
10907
|
+
loadCustomMetadata,
|
|
10908
|
+
copy: file.copy // copy is always available on the server-side
|
|
10909
|
+
};
|
|
10910
|
+
return accessor;
|
|
10911
|
+
};
|
|
10912
|
+
}
|
|
10913
|
+
|
|
10914
|
+
/**
|
|
10915
|
+
* The base path for all uploaded files.
|
|
10916
|
+
*
|
|
10917
|
+
* The uploads folder is a transient folder that is cleared/processed often of files that are uploaded to it.
|
|
10918
|
+
*/
|
|
10919
|
+
const UPLOADS_FOLDER_PATH = 'uploads';
|
|
10920
|
+
/**
|
|
10921
|
+
* The folder name that contains the uploads for each user "u".
|
|
10922
|
+
*/
|
|
10923
|
+
const ALL_USER_UPLOADS_FOLDER_NAME = `u`;
|
|
10924
|
+
/**
|
|
10925
|
+
* All users uploads folder path.
|
|
10926
|
+
*
|
|
10927
|
+
* For example, user 12345 will upload their files to folder "uploads/u/12345/".
|
|
10928
|
+
*/
|
|
10929
|
+
const ALL_USER_UPLOADS_FOLDER_PATH = `${UPLOADS_FOLDER_PATH}/${ALL_USER_UPLOADS_FOLDER_NAME}`;
|
|
10930
|
+
function userUploadsFolderSlashPathFactory(inputBasePath) {
|
|
10931
|
+
const basePath = util.toAbsoluteSlashPathStartType(inputBasePath ?? ALL_USER_UPLOADS_FOLDER_PATH);
|
|
10932
|
+
return userId => `${basePath}/${userId}`;
|
|
10933
|
+
}
|
|
10934
|
+
function userUploadsFolderStoragePathFactory({
|
|
10935
|
+
bucketId,
|
|
10936
|
+
basePath: inputBasePath
|
|
10937
|
+
}) {
|
|
10938
|
+
const userUploadsFolderSlashPath = userUploadsFolderSlashPathFactory(inputBasePath);
|
|
10939
|
+
return userId => ({
|
|
10940
|
+
pathString: userUploadsFolderSlashPath(userId),
|
|
10941
|
+
bucketId
|
|
10942
|
+
});
|
|
10943
|
+
}
|
|
10944
|
+
|
|
10945
|
+
/**
|
|
10946
|
+
* The role used for uploading files.
|
|
10947
|
+
*/
|
|
10948
|
+
const STORAGE_FILE_UPLOAD_USER_ROLE = 'uploads';
|
|
10949
|
+
/**
|
|
10950
|
+
* AuthRoleClaimsFactoryConfigEntrySimpleOptions configuration for adding the "uploads" role to the user when the disable uploads claim is not present.
|
|
10951
|
+
*/
|
|
10952
|
+
const storageFileUploadUserSimpleClaimsConfiguration = {
|
|
10953
|
+
roles: STORAGE_FILE_UPLOAD_USER_ROLE,
|
|
10954
|
+
inverse: true
|
|
10955
|
+
};
|
|
10956
|
+
|
|
10957
|
+
/**
|
|
10958
|
+
* Lower determination level.
|
|
10959
|
+
*/
|
|
10960
|
+
const LOW_UPLOADED_FILE_TYPE_DETERMINATION_LEVEL = 1;
|
|
10961
|
+
/**
|
|
10962
|
+
* Default determination level.
|
|
10963
|
+
*/
|
|
10964
|
+
const DEFAULT_UPLOADED_FILE_TYPE_DETERMINATION_LEVEL = 2;
|
|
10965
|
+
/**
|
|
10966
|
+
* High determination level.
|
|
10967
|
+
*/
|
|
10968
|
+
const HIGH_UPLOADED_FILE_TYPE_DETERMINATION_LEVEL = 3;
|
|
10969
|
+
/**
|
|
10970
|
+
* Exact match determination level.
|
|
10971
|
+
*
|
|
10972
|
+
* The default highest determination level.
|
|
10973
|
+
*/
|
|
10974
|
+
const EXACT_UPLOADED_FILE_TYPE_DETERMINATION_LEVEL = 10;
|
|
10975
|
+
/**
|
|
10976
|
+
* Creates an UploadedFileTypeDeterminer that determines the upload type based on the file name.
|
|
10977
|
+
*
|
|
10978
|
+
* @param config The configuration for the determiner.
|
|
10979
|
+
* @returns The determiner.
|
|
10980
|
+
*/
|
|
10981
|
+
function determineByFileName(config) {
|
|
10982
|
+
const {
|
|
10983
|
+
fileType,
|
|
10984
|
+
match,
|
|
10985
|
+
exactMatchDeterminationLevel: inputExactMatchDeterminationLevel,
|
|
10986
|
+
nameMatchDeterminationLevel: inputNameMatchDeterminationLevel
|
|
10987
|
+
} = config;
|
|
10988
|
+
const mustMatchExactly = match.includes(util.SLASH_PATH_FILE_TYPE_SEPARATOR);
|
|
10989
|
+
const exactMatchDeterminationLevel = inputExactMatchDeterminationLevel ?? EXACT_UPLOADED_FILE_TYPE_DETERMINATION_LEVEL;
|
|
10990
|
+
const nameMatchDeterminationLevel = inputNameMatchDeterminationLevel ?? HIGH_UPLOADED_FILE_TYPE_DETERMINATION_LEVEL;
|
|
10991
|
+
const testFileName = mustMatchExactly ? fileName => fileName === match ? exactMatchDeterminationLevel : undefined // exact match
|
|
10992
|
+
: fileName => fileName.startsWith(match) ? nameMatchDeterminationLevel : undefined; // name match
|
|
10993
|
+
return {
|
|
10994
|
+
determine: input => {
|
|
10995
|
+
let result;
|
|
10996
|
+
const pathDetails = input.getPathDetails();
|
|
10997
|
+
if (pathDetails.file) {
|
|
10998
|
+
const matchLevel = testFileName(pathDetails.file);
|
|
10999
|
+
if (matchLevel != null) {
|
|
11000
|
+
result = {
|
|
11001
|
+
input,
|
|
11002
|
+
type: fileType,
|
|
11003
|
+
level: matchLevel
|
|
11004
|
+
};
|
|
11005
|
+
}
|
|
11006
|
+
}
|
|
11007
|
+
return result;
|
|
11008
|
+
},
|
|
11009
|
+
getPossibleFileTypes: () => [fileType]
|
|
11010
|
+
};
|
|
11011
|
+
}
|
|
11012
|
+
/**
|
|
11013
|
+
* Creates an UploadedFileTypeDeterminer that determines the upload type based on the folder name.
|
|
11014
|
+
*
|
|
11015
|
+
* @param config The configuration for the determiner.
|
|
11016
|
+
* @returns The determiner.
|
|
11017
|
+
*/
|
|
11018
|
+
function determineByFolderName(config) {
|
|
11019
|
+
const {
|
|
11020
|
+
fileType,
|
|
11021
|
+
match
|
|
11022
|
+
} = config;
|
|
11023
|
+
return {
|
|
11024
|
+
determine: input => {
|
|
11025
|
+
const pathDetails = input.getPathDetails();
|
|
11026
|
+
const folderPath = pathDetails.folderPath;
|
|
11027
|
+
let result;
|
|
11028
|
+
if (folderPath === match) {
|
|
11029
|
+
result = {
|
|
11030
|
+
input,
|
|
11031
|
+
type: fileType,
|
|
11032
|
+
level: EXACT_UPLOADED_FILE_TYPE_DETERMINATION_LEVEL
|
|
11033
|
+
};
|
|
11034
|
+
}
|
|
11035
|
+
return result;
|
|
11036
|
+
},
|
|
11037
|
+
getPossibleFileTypes: () => [fileType]
|
|
11038
|
+
};
|
|
11039
|
+
}
|
|
11040
|
+
/**
|
|
11041
|
+
* Creates an UploadedFileTypeDeterminer that determines the upload type based on the file name.
|
|
11042
|
+
*
|
|
11043
|
+
* @param config The configuration for the determiner.
|
|
11044
|
+
* @returns The determiner.
|
|
11045
|
+
*/
|
|
11046
|
+
function determineByFilePath(config) {
|
|
11047
|
+
const {
|
|
11048
|
+
fileType,
|
|
11049
|
+
match,
|
|
11050
|
+
matchDeterminationLevel: inputMatchDeterminationLevel,
|
|
11051
|
+
matchBucket: inputMatchBucket,
|
|
11052
|
+
matchFileDetails: inputMatchFile
|
|
11053
|
+
} = config;
|
|
11054
|
+
const pathMatcher = util.slashPathPathMatcher(match);
|
|
11055
|
+
const matchBucket = typeof inputMatchBucket === 'function' ? inputMatchBucket : util.decisionFunction(true);
|
|
11056
|
+
const matchFileDetails = typeof inputMatchFile === 'function' ? inputMatchFile : util.decisionFunction(true);
|
|
11057
|
+
const matchDeterminationLevel = inputMatchDeterminationLevel ?? HIGH_UPLOADED_FILE_TYPE_DETERMINATION_LEVEL;
|
|
11058
|
+
return {
|
|
11059
|
+
determine: input => {
|
|
11060
|
+
let result;
|
|
11061
|
+
const {
|
|
11062
|
+
bucketId,
|
|
11063
|
+
pathString
|
|
11064
|
+
} = input.input;
|
|
11065
|
+
if (matchBucket(bucketId)) {
|
|
11066
|
+
const {
|
|
11067
|
+
matchesTargetPath
|
|
11068
|
+
} = pathMatcher(pathString);
|
|
11069
|
+
if (matchesTargetPath && matchFileDetails(input)) {
|
|
11070
|
+
result = {
|
|
11071
|
+
input,
|
|
11072
|
+
type: fileType,
|
|
11073
|
+
level: matchDeterminationLevel
|
|
11074
|
+
};
|
|
11075
|
+
}
|
|
11076
|
+
}
|
|
11077
|
+
return result;
|
|
11078
|
+
},
|
|
11079
|
+
getPossibleFileTypes: () => [fileType]
|
|
11080
|
+
};
|
|
11081
|
+
}
|
|
11082
|
+
/**
|
|
11083
|
+
* Wraps a separate UploadedFileTypeDeterminer and adds user determination based on folder path structure.
|
|
11084
|
+
*
|
|
11085
|
+
* @param config Configuration.
|
|
11086
|
+
*/
|
|
11087
|
+
function determineUserByFolderWrapperFunction(config) {
|
|
11088
|
+
const {
|
|
11089
|
+
rootFolder,
|
|
11090
|
+
userFolderPrefix,
|
|
11091
|
+
requireUser = false,
|
|
11092
|
+
allowSubPaths: inputAllowSubPaths = true
|
|
11093
|
+
} = config;
|
|
11094
|
+
const allowSubPaths = inputAllowSubPaths ?? true;
|
|
11095
|
+
const subPathMatcherConfig = config.matchSubPath ?? {
|
|
11096
|
+
basePath: util.mergeSlashPaths([rootFolder, userFolderPrefix])
|
|
11097
|
+
};
|
|
11098
|
+
const pathMatcher = util.slashPathSubPathMatcher(subPathMatcherConfig);
|
|
11099
|
+
return determiner => {
|
|
11100
|
+
return {
|
|
11101
|
+
determine: async input => {
|
|
11102
|
+
const determinerResult = await determiner.determine(input);
|
|
11103
|
+
let result;
|
|
11104
|
+
if (determinerResult) {
|
|
11105
|
+
if (determinerResult.user) {
|
|
11106
|
+
result = determinerResult;
|
|
11107
|
+
} else {
|
|
11108
|
+
const pathDetails = input.getPathDetails();
|
|
11109
|
+
const pathRootFolder = pathDetails.parts[0];
|
|
11110
|
+
if (pathRootFolder === rootFolder) {
|
|
11111
|
+
// root folder matches, continue
|
|
11112
|
+
const {
|
|
11113
|
+
matchesBasePath,
|
|
11114
|
+
subPathParts
|
|
11115
|
+
} = pathMatcher(pathDetails.path);
|
|
11116
|
+
if (matchesBasePath && (allowSubPaths ? subPathParts.length >= 2 : subPathParts.length === 2)) {
|
|
11117
|
+
// must have two parts: the user folder and the file
|
|
11118
|
+
const user = subPathParts[0];
|
|
11119
|
+
result = {
|
|
11120
|
+
...determinerResult,
|
|
11121
|
+
user
|
|
11122
|
+
};
|
|
11123
|
+
}
|
|
11124
|
+
}
|
|
11125
|
+
}
|
|
11126
|
+
// If requireUser is true and no user was detected, return null.
|
|
11127
|
+
if (requireUser && !result?.user) {
|
|
11128
|
+
result = null;
|
|
11129
|
+
}
|
|
11130
|
+
}
|
|
11131
|
+
return result;
|
|
11132
|
+
},
|
|
11133
|
+
getPossibleFileTypes: () => determiner.getPossibleFileTypes()
|
|
11134
|
+
};
|
|
11135
|
+
};
|
|
11136
|
+
}
|
|
11137
|
+
function determineUserByUserUploadsFolderWrapperFunction(config) {
|
|
11138
|
+
return determineUserByFolderWrapperFunction({
|
|
11139
|
+
...config,
|
|
11140
|
+
rootFolder: UPLOADS_FOLDER_PATH,
|
|
11141
|
+
userFolderPrefix: ALL_USER_UPLOADS_FOLDER_NAME
|
|
11142
|
+
});
|
|
11143
|
+
}
|
|
11144
|
+
/**
|
|
11145
|
+
* Convenience function for using determineUserByFolderWrapperFunction directly on a pre-set determiner.
|
|
11146
|
+
*
|
|
11147
|
+
* @param config Configuration.
|
|
11148
|
+
* @returns The wrapped UploadedFileTypeDeterminer.
|
|
11149
|
+
*/
|
|
11150
|
+
function determineUserByFolder(config) {
|
|
11151
|
+
return determineUserByFolderWrapperFunction(config)(config.determiner);
|
|
11152
|
+
}
|
|
11153
|
+
/**
|
|
11154
|
+
* Wraps an UploadedFileTypeDeterminer to only allow respond to certain file types.
|
|
11155
|
+
*
|
|
11156
|
+
* @param determiner The determiner to wrap.
|
|
11157
|
+
* @param types The file types to allow.
|
|
11158
|
+
*/
|
|
11159
|
+
function limitUploadFileTypeDeterminer(determiner, types) {
|
|
11160
|
+
const allowedTypes = util.asArray(types);
|
|
11161
|
+
const allowedTypeSet = new Set(allowedTypes);
|
|
11162
|
+
return {
|
|
11163
|
+
determine: async input => {
|
|
11164
|
+
const result = await determiner.determine(input);
|
|
11165
|
+
// if the result's type is not in the allowed types, return null.
|
|
11166
|
+
return result && allowedTypeSet.has(result.type) ? result : null;
|
|
11167
|
+
},
|
|
11168
|
+
getPossibleFileTypes: () => allowedTypes
|
|
11169
|
+
};
|
|
11170
|
+
}
|
|
11171
|
+
/**
|
|
11172
|
+
* Combines multiple UploadedFileTypeDeterminer instances into a single determiner.
|
|
11173
|
+
*
|
|
11174
|
+
* If a single determiner is provided, it will be returned and not wrapped.
|
|
11175
|
+
*
|
|
11176
|
+
* @param determiners The determiners to combine.
|
|
11177
|
+
* @returns The combined determiner.
|
|
11178
|
+
*/
|
|
11179
|
+
function combineUploadFileTypeDeterminers(config) {
|
|
11180
|
+
const {
|
|
11181
|
+
determiners,
|
|
11182
|
+
completeSearchAtLevel: inputCompleteSearchAtLevel,
|
|
11183
|
+
completeSearchOnFirstMatch: inputCompleteSearchOnFirstMatch
|
|
11184
|
+
} = config;
|
|
11185
|
+
let result;
|
|
11186
|
+
if (determiners.length === 1) {
|
|
11187
|
+
result = determiners[0];
|
|
11188
|
+
} else {
|
|
11189
|
+
const possibleFileTypes = util.unique(determiners.map(d => d.getPossibleFileTypes()).flat());
|
|
11190
|
+
const completeSearchOnFirstMatch = Boolean(inputCompleteSearchOnFirstMatch);
|
|
11191
|
+
const completeSearchAtLevel = completeSearchOnFirstMatch ? LOW_UPLOADED_FILE_TYPE_DETERMINATION_LEVEL : inputCompleteSearchAtLevel ?? EXACT_UPLOADED_FILE_TYPE_DETERMINATION_LEVEL;
|
|
11192
|
+
result = {
|
|
11193
|
+
determine: async input => {
|
|
11194
|
+
let result;
|
|
11195
|
+
for (const determiner of determiners) {
|
|
11196
|
+
const stepResult = await determiner.determine(input);
|
|
11197
|
+
if (stepResult) {
|
|
11198
|
+
if (stepResult.level >= completeSearchAtLevel) {
|
|
11199
|
+
result = stepResult;
|
|
11200
|
+
break;
|
|
11201
|
+
} else if (!result || stepResult.level > result.level) {
|
|
11202
|
+
result = stepResult; // update result to the higher level match
|
|
11203
|
+
}
|
|
11204
|
+
}
|
|
11205
|
+
}
|
|
11206
|
+
return result;
|
|
11207
|
+
},
|
|
11208
|
+
getPossibleFileTypes: () => possibleFileTypes
|
|
11209
|
+
};
|
|
11210
|
+
}
|
|
11211
|
+
return result;
|
|
11212
|
+
}
|
|
11213
|
+
|
|
9990
11214
|
// MARK: Collection
|
|
9991
11215
|
class SystemStateFirestoreCollections {}
|
|
9992
11216
|
// MARK: Mock Item
|
|
@@ -10030,6 +11254,9 @@ function systemStateFirestoreCollection(firestoreContext, converters) {
|
|
|
10030
11254
|
});
|
|
10031
11255
|
}
|
|
10032
11256
|
|
|
11257
|
+
exports.ALL_STORAGE_FILE_NOTIFICATION_TASK_TYPES = ALL_STORAGE_FILE_NOTIFICATION_TASK_TYPES;
|
|
11258
|
+
exports.ALL_USER_UPLOADS_FOLDER_NAME = ALL_USER_UPLOADS_FOLDER_NAME;
|
|
11259
|
+
exports.ALL_USER_UPLOADS_FOLDER_PATH = ALL_USER_UPLOADS_FOLDER_PATH;
|
|
10033
11260
|
exports.AbstractFirestoreDocument = AbstractFirestoreDocument;
|
|
10034
11261
|
exports.AbstractFirestoreDocumentDataAccessorWrapper = AbstractFirestoreDocumentDataAccessorWrapper;
|
|
10035
11262
|
exports.AbstractFirestoreDocumentWithParent = AbstractFirestoreDocumentWithParent;
|
|
@@ -10045,6 +11272,7 @@ exports.ContextGrantedModelRolesReaderInstance = ContextGrantedModelRolesReaderI
|
|
|
10045
11272
|
exports.CreateNotificationBoxParams = CreateNotificationBoxParams;
|
|
10046
11273
|
exports.CreateNotificationSummaryParams = CreateNotificationSummaryParams;
|
|
10047
11274
|
exports.CreateNotificationUserParams = CreateNotificationUserParams;
|
|
11275
|
+
exports.CreateStorageFileParams = CreateStorageFileParams;
|
|
10048
11276
|
exports.DBX_FIREBASE_SERVER_NO_AUTH_ERROR_CODE = DBX_FIREBASE_SERVER_NO_AUTH_ERROR_CODE;
|
|
10049
11277
|
exports.DBX_FIREBASE_SERVER_NO_UID_ERROR_CODE = DBX_FIREBASE_SERVER_NO_UID_ERROR_CODE;
|
|
10050
11278
|
exports.DEFAULT_DATE_CELL_RANGE_VALUE = DEFAULT_DATE_CELL_RANGE_VALUE;
|
|
@@ -10054,11 +11282,17 @@ exports.DEFAULT_FIRESTORE_STRING_FIELD_VALUE = DEFAULT_FIRESTORE_STRING_FIELD_VA
|
|
|
10054
11282
|
exports.DEFAULT_FIRESTORE_UNITED_STATES_ADDRESS_VALUE = DEFAULT_FIRESTORE_UNITED_STATES_ADDRESS_VALUE;
|
|
10055
11283
|
exports.DEFAULT_FIRESTORE_WEBSITE_FILE_LINK_VALUE = DEFAULT_FIRESTORE_WEBSITE_FILE_LINK_VALUE;
|
|
10056
11284
|
exports.DEFAULT_ITERATE_FIRESTORE_DOCUMENT_SNAPSHOT_BATCHES_BATCH_SIZE = DEFAULT_ITERATE_FIRESTORE_DOCUMENT_SNAPSHOT_BATCHES_BATCH_SIZE;
|
|
11285
|
+
exports.DEFAULT_MAX_STORAGE_FILE_PROCESSING_CLEANUP_RETRY_ATTEMPTS = DEFAULT_MAX_STORAGE_FILE_PROCESSING_CLEANUP_RETRY_ATTEMPTS;
|
|
10057
11286
|
exports.DEFAULT_NOTIFICATION_TASK_NOTIFICATION_MODEL_KEY = DEFAULT_NOTIFICATION_TASK_NOTIFICATION_MODEL_KEY;
|
|
10058
11287
|
exports.DEFAULT_NOTIFICATION_TEMPLATE_TYPE = DEFAULT_NOTIFICATION_TEMPLATE_TYPE;
|
|
10059
11288
|
exports.DEFAULT_QUERY_CHANGE_WATCHER_DELAY = DEFAULT_QUERY_CHANGE_WATCHER_DELAY;
|
|
10060
11289
|
exports.DEFAULT_SINGLE_ITEM_FIRESTORE_COLLECTION_DOCUMENT_IDENTIFIER = DEFAULT_SINGLE_ITEM_FIRESTORE_COLLECTION_DOCUMENT_IDENTIFIER;
|
|
11290
|
+
exports.DEFAULT_STORAGE_FILE_PROCESSING_CLEANUP_RETRY_DELAY = DEFAULT_STORAGE_FILE_PROCESSING_CLEANUP_RETRY_DELAY;
|
|
11291
|
+
exports.DEFAULT_UPLOADED_FILE_TYPE_DETERMINATION_LEVEL = DEFAULT_UPLOADED_FILE_TYPE_DETERMINATION_LEVEL;
|
|
10061
11292
|
exports.DEFAULT_WEBSITE_LINK = DEFAULT_WEBSITE_LINK;
|
|
11293
|
+
exports.DeleteAllQueuedStorageFilesParams = DeleteAllQueuedStorageFilesParams;
|
|
11294
|
+
exports.DeleteStorageFileParams = DeleteStorageFileParams;
|
|
11295
|
+
exports.EXACT_UPLOADED_FILE_TYPE_DETERMINATION_LEVEL = EXACT_UPLOADED_FILE_TYPE_DETERMINATION_LEVEL;
|
|
10062
11296
|
exports.FIREBASE_AUTH_NETWORK_REQUEST_ERROR = FIREBASE_AUTH_NETWORK_REQUEST_ERROR;
|
|
10063
11297
|
exports.FIREBASE_AUTH_NETWORK_REQUEST_FAILED = FIREBASE_AUTH_NETWORK_REQUEST_FAILED;
|
|
10064
11298
|
exports.FIREBASE_AUTH_PASSWORD_MAX_LENGTH = FIREBASE_AUTH_PASSWORD_MAX_LENGTH;
|
|
@@ -10098,14 +11332,18 @@ exports.FIRESTORE_WHERE_QUERY_CONSTRAINT_TYPE = FIRESTORE_WHERE_QUERY_CONSTRAINT
|
|
|
10098
11332
|
exports.FirebaseDevelopmentFunctions = FirebaseDevelopmentFunctions;
|
|
10099
11333
|
exports.FirebaseModelPermissionServiceInstance = FirebaseModelPermissionServiceInstance;
|
|
10100
11334
|
exports.FirebaseServerError = FirebaseServerError;
|
|
11335
|
+
exports.HIGH_UPLOADED_FILE_TYPE_DETERMINATION_LEVEL = HIGH_UPLOADED_FILE_TYPE_DETERMINATION_LEVEL;
|
|
10101
11336
|
exports.InferredTargetModelIdParams = InferredTargetModelIdParams;
|
|
10102
11337
|
exports.InferredTargetModelParams = InferredTargetModelParams;
|
|
10103
11338
|
exports.InitializeAllApplicableNotificationBoxesParams = InitializeAllApplicableNotificationBoxesParams;
|
|
10104
11339
|
exports.InitializeAllApplicableNotificationSummariesParams = InitializeAllApplicableNotificationSummariesParams;
|
|
11340
|
+
exports.InitializeAllStorageFilesFromUploadsParams = InitializeAllStorageFilesFromUploadsParams;
|
|
10105
11341
|
exports.InitializeNotificationModelParams = InitializeNotificationModelParams;
|
|
11342
|
+
exports.InitializeStorageFileFromUploadParams = InitializeStorageFileFromUploadParams;
|
|
10106
11343
|
exports.IsFirestoreModelId = IsFirestoreModelId;
|
|
10107
11344
|
exports.IsFirestoreModelIdOrKey = IsFirestoreModelIdOrKey;
|
|
10108
11345
|
exports.IsFirestoreModelKey = IsFirestoreModelKey;
|
|
11346
|
+
exports.LOW_UPLOADED_FILE_TYPE_DETERMINATION_LEVEL = LOW_UPLOADED_FILE_TYPE_DETERMINATION_LEVEL;
|
|
10109
11347
|
exports.MAX_FIRESTORE_MAP_ZOOM_LEVEL_VALUE = MAX_FIRESTORE_MAP_ZOOM_LEVEL_VALUE;
|
|
10110
11348
|
exports.MIN_FIRESTORE_MAP_ZOOM_LEVEL_VALUE = MIN_FIRESTORE_MAP_ZOOM_LEVEL_VALUE;
|
|
10111
11349
|
exports.MODEL_FUNCTION_FIREBASE_CRUD_FUNCTION_SPECIFIER_DEFAULT = MODEL_FUNCTION_FIREBASE_CRUD_FUNCTION_SPECIFIER_DEFAULT;
|
|
@@ -10139,18 +11377,38 @@ exports.NotificationRecipientParams = NotificationRecipientParams;
|
|
|
10139
11377
|
exports.NotificationSummaryDocument = NotificationSummaryDocument;
|
|
10140
11378
|
exports.NotificationUserDocument = NotificationUserDocument;
|
|
10141
11379
|
exports.NotificationWeekDocument = NotificationWeekDocument;
|
|
11380
|
+
exports.ProcessAllQueuedStorageFilesParams = ProcessAllQueuedStorageFilesParams;
|
|
11381
|
+
exports.ProcessStorageFileParams = ProcessStorageFileParams;
|
|
10142
11382
|
exports.RUN_DEV_FUNCTION_APP_FUNCTION_KEY = RUN_DEV_FUNCTION_APP_FUNCTION_KEY;
|
|
10143
11383
|
exports.ResyncAllNotificationUserParams = ResyncAllNotificationUserParams;
|
|
10144
11384
|
exports.ResyncNotificationUserParams = ResyncNotificationUserParams;
|
|
10145
11385
|
exports.SCHEDULED_FUNCTION_DEV_FUNCTION_SPECIFIER = SCHEDULED_FUNCTION_DEV_FUNCTION_SPECIFIER;
|
|
11386
|
+
exports.STORAGE_FILE_ALREADY_PROCESSED_ERROR_CODE = STORAGE_FILE_ALREADY_PROCESSED_ERROR_CODE;
|
|
11387
|
+
exports.STORAGE_FILE_CANNOT_BE_DELETED_YET_ERROR_CODE = STORAGE_FILE_CANNOT_BE_DELETED_YET_ERROR_CODE;
|
|
11388
|
+
exports.STORAGE_FILE_NOT_FLAGGED_FOR_DELETION_ERROR_CODE = STORAGE_FILE_NOT_FLAGGED_FOR_DELETION_ERROR_CODE;
|
|
11389
|
+
exports.STORAGE_FILE_PROCESSING_NOTIFICATION_TASK_TYPE = STORAGE_FILE_PROCESSING_NOTIFICATION_TASK_TYPE;
|
|
11390
|
+
exports.STORAGE_FILE_PROCESSING_NOT_ALLOWED_FOR_INVALID_STATE_ERROR_CODE = STORAGE_FILE_PROCESSING_NOT_ALLOWED_FOR_INVALID_STATE_ERROR_CODE;
|
|
11391
|
+
exports.STORAGE_FILE_PROCESSING_NOT_AVAILABLE_FOR_TYPE_ERROR_CODE = STORAGE_FILE_PROCESSING_NOT_AVAILABLE_FOR_TYPE_ERROR_CODE;
|
|
11392
|
+
exports.STORAGE_FILE_PROCESSING_NOT_QUEUED_FOR_PROCESSING_ERROR_CODE = STORAGE_FILE_PROCESSING_NOT_QUEUED_FOR_PROCESSING_ERROR_CODE;
|
|
11393
|
+
exports.STORAGE_FILE_PROCESSING_STUCK_THROTTLE_CHECK_MS = STORAGE_FILE_PROCESSING_STUCK_THROTTLE_CHECK_MS;
|
|
11394
|
+
exports.STORAGE_FILE_UPLOAD_USER_ROLE = STORAGE_FILE_UPLOAD_USER_ROLE;
|
|
10146
11395
|
exports.ScheduledFunctionDevelopmentFirebaseFunctionListEntry = ScheduledFunctionDevelopmentFirebaseFunctionListEntry;
|
|
10147
11396
|
exports.ScheduledFunctionDevelopmentFirebaseFunctionParams = ScheduledFunctionDevelopmentFirebaseFunctionParams;
|
|
10148
11397
|
exports.SendNotificationParams = SendNotificationParams;
|
|
10149
11398
|
exports.SendQueuedNotificationsParams = SendQueuedNotificationsParams;
|
|
11399
|
+
exports.StorageFileDocument = StorageFileDocument;
|
|
11400
|
+
exports.StorageFileFirestoreCollections = StorageFileFirestoreCollections;
|
|
11401
|
+
exports.StorageFileFunctions = StorageFileFunctions;
|
|
11402
|
+
exports.StorageFileUploadStreamUnsupportedError = StorageFileUploadStreamUnsupportedError;
|
|
10150
11403
|
exports.SystemStateDocument = SystemStateDocument;
|
|
10151
11404
|
exports.SystemStateFirestoreCollections = SystemStateFirestoreCollections;
|
|
10152
11405
|
exports.TargetModelIdParams = TargetModelIdParams;
|
|
10153
11406
|
exports.TargetModelParams = TargetModelParams;
|
|
11407
|
+
exports.UPLOADED_FILE_DOES_NOT_EXIST_ERROR_CODE = UPLOADED_FILE_DOES_NOT_EXIST_ERROR_CODE;
|
|
11408
|
+
exports.UPLOADED_FILE_INITIALIZATION_DISCARDED_ERROR_CODE = UPLOADED_FILE_INITIALIZATION_DISCARDED_ERROR_CODE;
|
|
11409
|
+
exports.UPLOADED_FILE_INITIALIZATION_FAILED_ERROR_CODE = UPLOADED_FILE_INITIALIZATION_FAILED_ERROR_CODE;
|
|
11410
|
+
exports.UPLOADED_FILE_NOT_ALLOWED_TO_BE_INITIALIZED_ERROR_CODE = UPLOADED_FILE_NOT_ALLOWED_TO_BE_INITIALIZED_ERROR_CODE;
|
|
11411
|
+
exports.UPLOADS_FOLDER_PATH = UPLOADS_FOLDER_PATH;
|
|
10154
11412
|
exports.UpdateNotificationBoxParams = UpdateNotificationBoxParams;
|
|
10155
11413
|
exports.UpdateNotificationBoxRecipientLikeParams = UpdateNotificationBoxRecipientLikeParams;
|
|
10156
11414
|
exports.UpdateNotificationBoxRecipientParams = UpdateNotificationBoxRecipientParams;
|
|
@@ -10158,6 +11416,7 @@ exports.UpdateNotificationSummaryParams = UpdateNotificationSummaryParams;
|
|
|
10158
11416
|
exports.UpdateNotificationUserDefaultNotificationBoxRecipientConfigParams = UpdateNotificationUserDefaultNotificationBoxRecipientConfigParams;
|
|
10159
11417
|
exports.UpdateNotificationUserNotificationBoxRecipientParams = UpdateNotificationUserNotificationBoxRecipientParams;
|
|
10160
11418
|
exports.UpdateNotificationUserParams = UpdateNotificationUserParams;
|
|
11419
|
+
exports.UpdateStorageFileParams = UpdateStorageFileParams;
|
|
10161
11420
|
exports.addConstraintToBuilder = addConstraintToBuilder;
|
|
10162
11421
|
exports.addOrReplaceLimitInConstraints = addOrReplaceLimitInConstraints;
|
|
10163
11422
|
exports.allChildDocumentsUnderParent = allChildDocumentsUnderParent;
|
|
@@ -10185,12 +11444,14 @@ exports.childFirestoreModelKeyPath = childFirestoreModelKeyPath;
|
|
|
10185
11444
|
exports.childFirestoreModelKeys = childFirestoreModelKeys;
|
|
10186
11445
|
exports.clientFirebaseFirestoreContextFactory = clientFirebaseFirestoreContextFactory;
|
|
10187
11446
|
exports.clientFirebaseStorageContextFactory = clientFirebaseStorageContextFactory;
|
|
11447
|
+
exports.combineUploadFileTypeDeterminers = combineUploadFileTypeDeterminers;
|
|
10188
11448
|
exports.contextGrantedModelRolesReader = contextGrantedModelRolesReader;
|
|
10189
11449
|
exports.contextGrantedModelRolesReaderDoesNotExistErrorMessage = contextGrantedModelRolesReaderDoesNotExistErrorMessage;
|
|
10190
11450
|
exports.contextGrantedModelRolesReaderPermissionErrorMessage = contextGrantedModelRolesReaderPermissionErrorMessage;
|
|
10191
11451
|
exports.convertHttpsCallableErrorToReadableError = convertHttpsCallableErrorToReadableError;
|
|
10192
11452
|
exports.copyDocumentIdForUserRelatedModifierFunction = copyDocumentIdForUserRelatedModifierFunction;
|
|
10193
11453
|
exports.copyDocumentIdToFieldModifierFunction = copyDocumentIdToFieldModifierFunction;
|
|
11454
|
+
exports.copyStoragePath = copyStoragePath;
|
|
10194
11455
|
exports.copyUserRelatedDataAccessorFactoryFunction = copyUserRelatedDataAccessorFactoryFunction;
|
|
10195
11456
|
exports.copyUserRelatedDataModifierConfig = copyUserRelatedDataModifierConfig;
|
|
10196
11457
|
exports.createNotificationDocument = createNotificationDocument;
|
|
@@ -10198,9 +11459,17 @@ exports.createNotificationDocumentIfSending = createNotificationDocumentIfSendin
|
|
|
10198
11459
|
exports.createNotificationDocumentPair = createNotificationDocumentPair;
|
|
10199
11460
|
exports.createNotificationTaskTemplate = createNotificationTaskTemplate;
|
|
10200
11461
|
exports.createNotificationTemplate = createNotificationTemplate;
|
|
11462
|
+
exports.createStorageFileDocumentPair = createStorageFileDocumentPair;
|
|
11463
|
+
exports.createStorageFileDocumentPairFactory = createStorageFileDocumentPairFactory;
|
|
10201
11464
|
exports.dataFromDocumentSnapshots = dataFromDocumentSnapshots;
|
|
10202
11465
|
exports.dataFromSnapshotStream = dataFromSnapshotStream;
|
|
10203
11466
|
exports.delayCompletion = delayCompletion;
|
|
11467
|
+
exports.determineByFileName = determineByFileName;
|
|
11468
|
+
exports.determineByFilePath = determineByFilePath;
|
|
11469
|
+
exports.determineByFolderName = determineByFolderName;
|
|
11470
|
+
exports.determineUserByFolder = determineUserByFolder;
|
|
11471
|
+
exports.determineUserByFolderWrapperFunction = determineUserByFolderWrapperFunction;
|
|
11472
|
+
exports.determineUserByUserUploadsFolderWrapperFunction = determineUserByUserUploadsFolderWrapperFunction;
|
|
10204
11473
|
exports.developmentFirebaseFunctionMapFactory = developmentFirebaseFunctionMapFactory;
|
|
10205
11474
|
exports.directDataHttpsCallable = directDataHttpsCallable;
|
|
10206
11475
|
exports.documentData = documentData;
|
|
@@ -10274,6 +11543,8 @@ exports.firestoreEnum = firestoreEnum;
|
|
|
10274
11543
|
exports.firestoreEnumArray = firestoreEnumArray;
|
|
10275
11544
|
exports.firestoreField = firestoreField;
|
|
10276
11545
|
exports.firestoreFieldConfigToModelMapFunctionsRef = firestoreFieldConfigToModelMapFunctionsRef;
|
|
11546
|
+
exports.firestoreFixedItemPageIteration = firestoreFixedItemPageIteration;
|
|
11547
|
+
exports.firestoreFixedItemPageIterationFactory = firestoreFixedItemPageIterationFactory;
|
|
10277
11548
|
exports.firestoreIdBatchVerifierFactory = firestoreIdBatchVerifierFactory;
|
|
10278
11549
|
exports.firestoreIdentityTypeArray = firestoreIdentityTypeArray;
|
|
10279
11550
|
exports.firestoreIdentityTypeArrayName = firestoreIdentityTypeArrayName;
|
|
@@ -10387,6 +11658,9 @@ exports.iterateFirestoreDocumentSnapshotCheckpoints = iterateFirestoreDocumentSn
|
|
|
10387
11658
|
exports.iterateFirestoreDocumentSnapshotPairBatches = iterateFirestoreDocumentSnapshotPairBatches;
|
|
10388
11659
|
exports.iterateFirestoreDocumentSnapshotPairs = iterateFirestoreDocumentSnapshotPairs;
|
|
10389
11660
|
exports.iterateFirestoreDocumentSnapshots = iterateFirestoreDocumentSnapshots;
|
|
11661
|
+
exports.iterateStorageListFiles = iterateStorageListFiles;
|
|
11662
|
+
exports.iterateStorageListFilesByEachFile = iterateStorageListFilesByEachFile;
|
|
11663
|
+
exports.iterateStorageListFilesFactory = iterateStorageListFilesFactory;
|
|
10390
11664
|
exports.iterationQueryDocChangeWatcher = iterationQueryDocChangeWatcher;
|
|
10391
11665
|
exports.iterationQueryDocChangeWatcherChangeTypeForGroup = iterationQueryDocChangeWatcherChangeTypeForGroup;
|
|
10392
11666
|
exports.latestDataFromDocuments = latestDataFromDocuments;
|
|
@@ -10394,6 +11668,7 @@ exports.latestSnapshotsFromDocuments = latestSnapshotsFromDocuments;
|
|
|
10394
11668
|
exports.lazyFirebaseFunctionsFactory = lazyFirebaseFunctionsFactory;
|
|
10395
11669
|
exports.limit = limit;
|
|
10396
11670
|
exports.limitToLast = limitToLast;
|
|
11671
|
+
exports.limitUploadFileTypeDeterminer = limitUploadFileTypeDeterminer;
|
|
10397
11672
|
exports.limitedFirestoreDocumentAccessorFactory = limitedFirestoreDocumentAccessorFactory;
|
|
10398
11673
|
exports.loadAllFirestoreDocumentSnapshot = loadAllFirestoreDocumentSnapshot;
|
|
10399
11674
|
exports.loadAllFirestoreDocumentSnapshotPairs = loadAllFirestoreDocumentSnapshotPairs;
|
|
@@ -10456,6 +11731,7 @@ exports.notificationSummaryFirestoreCollection = notificationSummaryFirestoreCol
|
|
|
10456
11731
|
exports.notificationSummaryIdForModel = notificationSummaryIdForModel;
|
|
10457
11732
|
exports.notificationSummaryIdForUidFunctionForRootFirestoreModelIdentity = notificationSummaryIdForUidFunctionForRootFirestoreModelIdentity;
|
|
10458
11733
|
exports.notificationSummaryIdentity = notificationSummaryIdentity;
|
|
11734
|
+
exports.notificationTaskCanRunNextCheckpoint = notificationTaskCanRunNextCheckpoint;
|
|
10459
11735
|
exports.notificationTaskComplete = notificationTaskComplete;
|
|
10460
11736
|
exports.notificationTaskDelayRetry = notificationTaskDelayRetry;
|
|
10461
11737
|
exports.notificationTaskFailed = notificationTaskFailed;
|
|
@@ -10514,9 +11790,22 @@ exports.sortNotificationItemsFunction = sortNotificationItemsFunction;
|
|
|
10514
11790
|
exports.startAfter = startAfter;
|
|
10515
11791
|
exports.startAt = startAt;
|
|
10516
11792
|
exports.startAtValue = startAtValue;
|
|
11793
|
+
exports.storageFileCollectionReference = storageFileCollectionReference;
|
|
11794
|
+
exports.storageFileConverter = storageFileConverter;
|
|
11795
|
+
exports.storageFileFirestoreCollection = storageFileFirestoreCollection;
|
|
11796
|
+
exports.storageFileFunctionMap = storageFileFunctionMap;
|
|
11797
|
+
exports.storageFileFunctionTypeConfigMap = storageFileFunctionTypeConfigMap;
|
|
11798
|
+
exports.storageFileIdentity = storageFileIdentity;
|
|
11799
|
+
exports.storageFileModelCrudFunctionsConfig = storageFileModelCrudFunctionsConfig;
|
|
11800
|
+
exports.storageFileProcessingNotificationTaskTemplate = storageFileProcessingNotificationTaskTemplate;
|
|
11801
|
+
exports.storageFilePurposeAndUserQuery = storageFilePurposeAndUserQuery;
|
|
11802
|
+
exports.storageFileUploadUserSimpleClaimsConfiguration = storageFileUploadUserSimpleClaimsConfiguration;
|
|
11803
|
+
exports.storageFilesQueuedForDeleteQuery = storageFilesQueuedForDeleteQuery;
|
|
11804
|
+
exports.storageFilesQueuedForProcessingQuery = storageFilesQueuedForProcessingQuery;
|
|
10517
11805
|
exports.storageListFilesResultFactory = storageListFilesResultFactory;
|
|
10518
11806
|
exports.storageListFilesResultHasNoNextError = storageListFilesResultHasNoNextError;
|
|
10519
11807
|
exports.storagePathFactory = storagePathFactory;
|
|
11808
|
+
exports.storedFileReaderFactory = storedFileReaderFactory;
|
|
10520
11809
|
exports.streamFromOnSnapshot = streamFromOnSnapshot;
|
|
10521
11810
|
exports.systemStateCollectionReference = systemStateCollectionReference;
|
|
10522
11811
|
exports.systemStateConverter = systemStateConverter;
|
|
@@ -10532,11 +11821,14 @@ exports.updateNotificationUserNotificationBoxRecipientConfigIfChanged = updateNo
|
|
|
10532
11821
|
exports.updateNotificationUserNotificationBoxRecipientConfigs = updateNotificationUserNotificationBoxRecipientConfigs;
|
|
10533
11822
|
exports.updateNotificationUserNotificationSendExclusions = updateNotificationUserNotificationSendExclusions;
|
|
10534
11823
|
exports.updateWithAccessorUpdateAndConverterFunction = updateWithAccessorUpdateAndConverterFunction;
|
|
11824
|
+
exports.uploadFileWithStream = uploadFileWithStream;
|
|
10535
11825
|
exports.useContextAuth = useContextAuth;
|
|
10536
11826
|
exports.useContextAuthUid = useContextAuthUid;
|
|
10537
11827
|
exports.useDocumentSnapshot = useDocumentSnapshot;
|
|
10538
11828
|
exports.useDocumentSnapshotData = useDocumentSnapshotData;
|
|
10539
11829
|
exports.useFirebaseModelsService = useFirebaseModelsService;
|
|
11830
|
+
exports.userUploadsFolderSlashPathFactory = userUploadsFolderSlashPathFactory;
|
|
11831
|
+
exports.userUploadsFolderStoragePathFactory = userUploadsFolderStoragePathFactory;
|
|
10540
11832
|
exports.where = where;
|
|
10541
11833
|
exports.whereDateIsAfter = whereDateIsAfter;
|
|
10542
11834
|
exports.whereDateIsAfterWithSort = whereDateIsAfterWithSort;
|