@dereekb/firebase 11.0.21 → 11.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.cjs.js +1909 -93
- package/index.esm.js +2092 -37
- package/package.json +3 -2
- package/src/lib/client/error/error.d.ts +8 -0
- package/src/lib/client/error/index.d.ts +1 -0
- package/src/lib/client/firestore/error.d.ts +1 -0
- package/src/lib/client/firestore/index.d.ts +1 -0
- package/src/lib/client/index.d.ts +1 -0
- package/src/lib/common/firestore/accessor/document.utility.d.ts +4 -0
- package/src/lib/common/firestore/collection/collection.d.ts +6 -1
- package/src/lib/model/index.d.ts +1 -0
- package/src/lib/model/notification/index.d.ts +14 -0
- package/src/lib/model/notification/notification.action.d.ts +24 -0
- package/src/lib/model/notification/notification.api.d.ts +389 -0
- package/src/lib/model/notification/notification.api.error.d.ts +7 -0
- package/src/lib/model/notification/notification.api.util.d.ts +31 -0
- package/src/lib/model/notification/notification.config.d.ts +207 -0
- package/src/lib/model/notification/notification.create.d.ts +139 -0
- package/src/lib/model/notification/notification.d.ts +403 -0
- package/src/lib/model/notification/notification.details.d.ts +146 -0
- package/src/lib/model/notification/notification.id.d.ts +49 -0
- package/src/lib/model/notification/notification.item.d.ts +70 -0
- package/src/lib/model/notification/notification.message.d.ts +152 -0
- package/src/lib/model/notification/notification.query.d.ts +43 -0
- package/src/lib/model/notification/notification.send.d.ts +22 -0
- package/src/lib/model/notification/notification.util.d.ts +51 -0
- package/test/CHANGELOG.md +8 -0
- package/test/package.json +1 -1
package/index.cjs.js
CHANGED
|
@@ -12,6 +12,17 @@ var functions = require('firebase/functions');
|
|
|
12
12
|
var storage = require('firebase/storage');
|
|
13
13
|
var classTransformer = require('class-transformer');
|
|
14
14
|
var classValidator = require('class-validator');
|
|
15
|
+
var dateFns = require('date-fns');
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Returns true if the input is seen as a client-side FirebaseError.
|
|
19
|
+
*
|
|
20
|
+
* @param error
|
|
21
|
+
* @returns
|
|
22
|
+
*/
|
|
23
|
+
function isClientFirebaseError(error) {
|
|
24
|
+
return typeof error === 'object' && error.name === 'FirebaseError' && typeof error.code === 'string';
|
|
25
|
+
}
|
|
15
26
|
|
|
16
27
|
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
17
28
|
|
|
@@ -2465,7 +2476,7 @@ function copyUserRelatedDataAccessorFactoryFunction() {
|
|
|
2465
2476
|
|
|
2466
2477
|
// MARK: Utility
|
|
2467
2478
|
|
|
2468
|
-
function _await$
|
|
2479
|
+
function _await$c(value, then, direct) {
|
|
2469
2480
|
if (direct) {
|
|
2470
2481
|
return then ? then(value) : value;
|
|
2471
2482
|
}
|
|
@@ -2474,7 +2485,7 @@ function _await$a(value, then, direct) {
|
|
|
2474
2485
|
}
|
|
2475
2486
|
return then ? value.then(then) : value;
|
|
2476
2487
|
}
|
|
2477
|
-
function _async$
|
|
2488
|
+
function _async$c(f) {
|
|
2478
2489
|
return function () {
|
|
2479
2490
|
for (var args = [], i = 0; i < arguments.length; i++) {
|
|
2480
2491
|
args[i] = arguments[i];
|
|
@@ -2546,13 +2557,13 @@ function mapDataFromSnapshot(options) {
|
|
|
2546
2557
|
* @returns
|
|
2547
2558
|
*/
|
|
2548
2559
|
function updateWithAccessorUpdateAndConverterFunction(accessor, converter) {
|
|
2549
|
-
return _async$
|
|
2560
|
+
return _async$c(function (data, params) {
|
|
2550
2561
|
const updateInput = util.filterUndefinedValues(data);
|
|
2551
2562
|
const updateData = converter.toFirestore(updateInput, {
|
|
2552
2563
|
merge: true
|
|
2553
2564
|
}); // treat it as a merge
|
|
2554
2565
|
// Only update
|
|
2555
|
-
return util.objectHasNoKeys(updateData) ? _await$
|
|
2566
|
+
return util.objectHasNoKeys(updateData) ? _await$c() : params != null ? accessor.update(updateData, params) : accessor.update(updateData);
|
|
2556
2567
|
});
|
|
2557
2568
|
}
|
|
2558
2569
|
|
|
@@ -2575,7 +2586,7 @@ exports.FirestoreDocumentContextType = void 0;
|
|
|
2575
2586
|
* @returns
|
|
2576
2587
|
*/
|
|
2577
2588
|
|
|
2578
|
-
function _await$
|
|
2589
|
+
function _await$b(value, then, direct) {
|
|
2579
2590
|
if (direct) {
|
|
2580
2591
|
return then ? then(value) : value;
|
|
2581
2592
|
}
|
|
@@ -2584,7 +2595,7 @@ function _await$9(value, then, direct) {
|
|
|
2584
2595
|
}
|
|
2585
2596
|
return then ? value.then(then) : value;
|
|
2586
2597
|
}
|
|
2587
|
-
function _async$
|
|
2598
|
+
function _async$b(f) {
|
|
2588
2599
|
return function () {
|
|
2589
2600
|
for (var args = [], i = 0; i < arguments.length; i++) {
|
|
2590
2601
|
args[i] = arguments[i];
|
|
@@ -2597,10 +2608,10 @@ function _async$9(f) {
|
|
|
2597
2608
|
};
|
|
2598
2609
|
}
|
|
2599
2610
|
function incrementUpdateWithAccessorFunction(accessor) {
|
|
2600
|
-
return _async$
|
|
2611
|
+
return _async$b(function (data) {
|
|
2601
2612
|
const updateData = util.filterFalsyAndEmptyValues(data);
|
|
2602
2613
|
// Only update
|
|
2603
|
-
return util.objectHasNoKeys(updateData) ? _await$
|
|
2614
|
+
return util.objectHasNoKeys(updateData) ? _await$b() : accessor.increment(updateData);
|
|
2604
2615
|
});
|
|
2605
2616
|
}
|
|
2606
2617
|
|
|
@@ -2882,14 +2893,14 @@ function _awaitIgnored$2(value, direct) {
|
|
|
2882
2893
|
return value && value.then ? value.then(_empty$3) : Promise.resolve();
|
|
2883
2894
|
}
|
|
2884
2895
|
}
|
|
2885
|
-
function _invoke$
|
|
2896
|
+
function _invoke$4(body, then) {
|
|
2886
2897
|
var result = body();
|
|
2887
2898
|
if (result && result.then) {
|
|
2888
2899
|
return result.then(then);
|
|
2889
2900
|
}
|
|
2890
2901
|
return then(result);
|
|
2891
2902
|
}
|
|
2892
|
-
function _await$
|
|
2903
|
+
function _await$a(value, then, direct) {
|
|
2893
2904
|
if (direct) {
|
|
2894
2905
|
return then ? then(value) : value;
|
|
2895
2906
|
}
|
|
@@ -2898,7 +2909,7 @@ function _await$8(value, then, direct) {
|
|
|
2898
2909
|
}
|
|
2899
2910
|
return then ? value.then(then) : value;
|
|
2900
2911
|
}
|
|
2901
|
-
function _async$
|
|
2912
|
+
function _async$a(f) {
|
|
2902
2913
|
return function () {
|
|
2903
2914
|
for (var args = [], i = 0; i < arguments.length; i++) {
|
|
2904
2915
|
args[i] = arguments[i];
|
|
@@ -2910,8 +2921,8 @@ function _async$8(f) {
|
|
|
2910
2921
|
}
|
|
2911
2922
|
};
|
|
2912
2923
|
}
|
|
2913
|
-
const useDocumentSnapshot = _async$
|
|
2914
|
-
return _await$
|
|
2924
|
+
const useDocumentSnapshot = _async$a(function (document, use, defaultValue) {
|
|
2925
|
+
return _await$a(document == null ? void 0 : document.accessor.get(), function (snapshot) {
|
|
2915
2926
|
return util.useAsync(snapshot, use, defaultValue);
|
|
2916
2927
|
});
|
|
2917
2928
|
});
|
|
@@ -2930,10 +2941,10 @@ function makeDocuments(documentAccessor, make) {
|
|
|
2930
2941
|
const newDocumentFn = (_make$newDocument = make.newDocument) != null ? _make$newDocument : () => documentAccessor.newDocument();
|
|
2931
2942
|
return util.performMakeLoop({
|
|
2932
2943
|
count: make.count,
|
|
2933
|
-
make: _async$
|
|
2944
|
+
make: _async$a(function (i) {
|
|
2934
2945
|
const document = newDocumentFn(documentAccessor);
|
|
2935
|
-
return _await$
|
|
2936
|
-
return _invoke$
|
|
2946
|
+
return _await$a(make.init(i, document), function (data) {
|
|
2947
|
+
return _invoke$4(function () {
|
|
2937
2948
|
if (data != null) {
|
|
2938
2949
|
return _awaitIgnored$2(document.accessor.create(data));
|
|
2939
2950
|
}
|
|
@@ -2966,6 +2977,12 @@ function getDocumentSnapshotDataPair(document) {
|
|
|
2966
2977
|
function getDocumentSnapshotDataPairs(documents) {
|
|
2967
2978
|
return util.runAsyncTasksForValues(documents, getDocumentSnapshotDataPair);
|
|
2968
2979
|
}
|
|
2980
|
+
/**
|
|
2981
|
+
* Convenience function for calling getDocumentSnapshotDataPairs() then returning only the pairs that have data.
|
|
2982
|
+
*/
|
|
2983
|
+
function getDocumentSnapshotDataPairsWithData(documents) {
|
|
2984
|
+
return getDocumentSnapshotDataPairs(documents).then(pairs => pairs.filter(pair => pair.data != null));
|
|
2985
|
+
}
|
|
2969
2986
|
function getDocumentSnapshotDataTuples(documents) {
|
|
2970
2987
|
return util.runAsyncTasksForValues(documents, document => document.accessor.get().then(snapshot => [document, snapshot.data()]));
|
|
2971
2988
|
}
|
|
@@ -2977,7 +2994,7 @@ function getDocumentSnapshotsData(documents, withId = true) {
|
|
|
2977
2994
|
}
|
|
2978
2995
|
function getDataFromDocumentSnapshots(snapshots, withId = true) {
|
|
2979
2996
|
const mapFn = documentDataFunction(withId);
|
|
2980
|
-
return util.
|
|
2997
|
+
return util.filterMaybeArrayValues(snapshots.map(mapFn));
|
|
2981
2998
|
}
|
|
2982
2999
|
function loadDocumentsForSnapshots(accessor, snapshots) {
|
|
2983
3000
|
return snapshots.docs.map(x => accessor.loadDocument(x.ref));
|
|
@@ -4013,7 +4030,7 @@ function firestoreEncodedArray(config) {
|
|
|
4013
4030
|
default: (_config$default4 = config.default) != null ? _config$default4 : () => [],
|
|
4014
4031
|
defaultBeforeSave: config.defaultBeforeSave,
|
|
4015
4032
|
fromData: input => sortFn(input.map(fromData), false),
|
|
4016
|
-
toData: input => util.
|
|
4033
|
+
toData: input => util.filterMaybeArrayValues(sortFn(input, true).map(toData))
|
|
4017
4034
|
});
|
|
4018
4035
|
}
|
|
4019
4036
|
/**
|
|
@@ -4159,7 +4176,7 @@ function firestoreModelKeyEncodedGrantedRoleMap(dencoder) {
|
|
|
4159
4176
|
function firestoreArrayMap(config = {}) {
|
|
4160
4177
|
return firestoreMap(Object.assign({
|
|
4161
4178
|
mapFilter: util.KeyValueTypleValueFilter.EMPTY,
|
|
4162
|
-
mapFieldValues: util.
|
|
4179
|
+
mapFieldValues: util.filterMaybeArrayValues
|
|
4163
4180
|
}, config));
|
|
4164
4181
|
}
|
|
4165
4182
|
/**
|
|
@@ -4169,7 +4186,7 @@ function firestoreArrayMap(config = {}) {
|
|
|
4169
4186
|
*/
|
|
4170
4187
|
function firestoreModelKeyGrantedRoleArrayMap() {
|
|
4171
4188
|
return firestoreArrayMap({
|
|
4172
|
-
mapFieldValues: util.
|
|
4189
|
+
mapFieldValues: util.filterEmptyArrayValues
|
|
4173
4190
|
});
|
|
4174
4191
|
}
|
|
4175
4192
|
/**
|
|
@@ -4225,7 +4242,7 @@ function firestoreObjectArray(config) {
|
|
|
4225
4242
|
default: (_config$default9 = config.default) != null ? _config$default9 : () => [],
|
|
4226
4243
|
defaultBeforeSave: config.defaultBeforeSave,
|
|
4227
4244
|
fromData: input => sortFn(performFiltering(input.map(x => from(x))), false),
|
|
4228
|
-
toData: input => util.
|
|
4245
|
+
toData: input => util.filterMaybeArrayValues(sortFn(performFiltering(input), true)).map(x => to(x)) // filter then sort then map
|
|
4229
4246
|
});
|
|
4230
4247
|
}
|
|
4231
4248
|
/**
|
|
@@ -4510,7 +4527,7 @@ function firebaseQueryItemAccumulator(iteration, mapItem) {
|
|
|
4510
4527
|
mapItem = (_mapItem = mapItem) != null ? _mapItem : x => x;
|
|
4511
4528
|
const snapshotData = documentDataFunction(true);
|
|
4512
4529
|
const mapFn = x => {
|
|
4513
|
-
const result = util.
|
|
4530
|
+
const result = util.filterMaybeArrayValues(x.map(y => {
|
|
4514
4531
|
const data = snapshotData(y);
|
|
4515
4532
|
return data ? mapItem(data) : undefined;
|
|
4516
4533
|
}));
|
|
@@ -4905,7 +4922,7 @@ function firestoreItemPageIteration(config) {
|
|
|
4905
4922
|
* @returns
|
|
4906
4923
|
*/
|
|
4907
4924
|
|
|
4908
|
-
function _async$
|
|
4925
|
+
function _async$9(f) {
|
|
4909
4926
|
return function () {
|
|
4910
4927
|
for (var args = [], i = 0; i < arguments.length; i++) {
|
|
4911
4928
|
args[i] = arguments[i];
|
|
@@ -4917,7 +4934,7 @@ function _async$7(f) {
|
|
|
4917
4934
|
}
|
|
4918
4935
|
};
|
|
4919
4936
|
}
|
|
4920
|
-
function _await$
|
|
4937
|
+
function _await$9(value, then, direct) {
|
|
4921
4938
|
if (direct) {
|
|
4922
4939
|
return then ? then(value) : value;
|
|
4923
4940
|
}
|
|
@@ -4942,13 +4959,13 @@ function firestoreQueryFactory(config) {
|
|
|
4942
4959
|
const query = makeQuery(inputQuery, ...allConstraints);
|
|
4943
4960
|
const result = {
|
|
4944
4961
|
query,
|
|
4945
|
-
countDocs: _async$
|
|
4962
|
+
countDocs: _async$9(function () {
|
|
4946
4963
|
return countDocs(query);
|
|
4947
4964
|
}),
|
|
4948
|
-
getFirstDoc: _async$
|
|
4965
|
+
getFirstDoc: _async$9(function (transaction) {
|
|
4949
4966
|
const contraintsForOneDoc = addOrReplaceLimitInConstraints(1)(allConstraints);
|
|
4950
4967
|
const query = makeQuery(inputQuery, ...contraintsForOneDoc);
|
|
4951
|
-
return _await$
|
|
4968
|
+
return _await$9(getDocs(query, transaction), function (result) {
|
|
4952
4969
|
return result.docs[0];
|
|
4953
4970
|
});
|
|
4954
4971
|
}),
|
|
@@ -5008,7 +5025,7 @@ function readFirestoreModelKeyFromDocumentSnapshot(snapshot) {
|
|
|
5008
5025
|
* @param config
|
|
5009
5026
|
* @returns
|
|
5010
5027
|
*/
|
|
5011
|
-
function _async$
|
|
5028
|
+
function _async$8(f) {
|
|
5012
5029
|
return function () {
|
|
5013
5030
|
for (var args = [], i = 0; i < arguments.length; i++) {
|
|
5014
5031
|
args[i] = arguments[i];
|
|
@@ -5022,7 +5039,7 @@ function _async$6(f) {
|
|
|
5022
5039
|
}
|
|
5023
5040
|
|
|
5024
5041
|
// MARK: Utility
|
|
5025
|
-
function _await$
|
|
5042
|
+
function _await$8(value, then, direct) {
|
|
5026
5043
|
if (direct) {
|
|
5027
5044
|
return then ? then(value) : value;
|
|
5028
5045
|
}
|
|
@@ -5037,15 +5054,15 @@ function _awaitIgnored$1(value, direct) {
|
|
|
5037
5054
|
return value && value.then ? value.then(_empty$2) : Promise.resolve();
|
|
5038
5055
|
}
|
|
5039
5056
|
}
|
|
5040
|
-
function _invoke$
|
|
5057
|
+
function _invoke$3(body, then) {
|
|
5041
5058
|
var result = body();
|
|
5042
5059
|
if (result && result.then) {
|
|
5043
5060
|
return result.then(then);
|
|
5044
5061
|
}
|
|
5045
5062
|
return then(result);
|
|
5046
5063
|
}
|
|
5047
|
-
const iterateFirestoreDocumentSnapshotCheckpoints = _async$
|
|
5048
|
-
const taskInputFactory = _async$
|
|
5064
|
+
const iterateFirestoreDocumentSnapshotCheckpoints = _async$8(function (config) {
|
|
5065
|
+
const taskInputFactory = _async$8(function () {
|
|
5049
5066
|
// Perform another query, then pass the results to the task factory.
|
|
5050
5067
|
if (hasReachedEnd) {
|
|
5051
5068
|
return null; // issue no more tasks
|
|
@@ -5070,17 +5087,17 @@ const iterateFirestoreDocumentSnapshotCheckpoints = _async$6(function (config) {
|
|
|
5070
5087
|
}
|
|
5071
5088
|
}
|
|
5072
5089
|
const query = queryFactory.query(constraints);
|
|
5073
|
-
return _await$
|
|
5090
|
+
return _await$8(query.getDocs(), function (docQuerySnapshot) {
|
|
5074
5091
|
let _exit = false;
|
|
5075
5092
|
const docSnapshots = docQuerySnapshot.docs;
|
|
5076
5093
|
// check for repeat cursor
|
|
5077
5094
|
const nextCursorDocument = util.lastValue(docSnapshots);
|
|
5078
|
-
return _invoke$
|
|
5095
|
+
return _invoke$3(function () {
|
|
5079
5096
|
if (nextCursorDocument != null) {
|
|
5080
5097
|
const cursorPath = readFirestoreModelKeyFromDocumentSnapshot(nextCursorDocument);
|
|
5081
5098
|
return function () {
|
|
5082
5099
|
if (visitedCursorPaths.has(cursorPath)) {
|
|
5083
|
-
return _await$
|
|
5100
|
+
return _await$8(handleRepeatCursor(nextCursorDocument), function (shouldContinue) {
|
|
5084
5101
|
if (shouldContinue === false) {
|
|
5085
5102
|
cursorDocument = null;
|
|
5086
5103
|
hasReachedEnd = true;
|
|
@@ -5146,12 +5163,12 @@ const iterateFirestoreDocumentSnapshotCheckpoints = _async$6(function (config) {
|
|
|
5146
5163
|
const performTaskFn = util.performTasksFromFactoryInParallelFunction({
|
|
5147
5164
|
maxParallelTasks: maxParallelCheckpoints,
|
|
5148
5165
|
waitBetweenTasks: waitBetweenCheckpoints,
|
|
5149
|
-
taskFactory: _async$
|
|
5166
|
+
taskFactory: _async$8(function ({
|
|
5150
5167
|
i,
|
|
5151
5168
|
docQuerySnapshot
|
|
5152
5169
|
}) {
|
|
5153
|
-
return _await$
|
|
5154
|
-
return _await$
|
|
5170
|
+
return _await$8(filterCheckpointSnapshot(docQuerySnapshot.docs), function (docSnapshots) {
|
|
5171
|
+
return _await$8(iterateCheckpoint(docSnapshots, docQuerySnapshot), function (results) {
|
|
5155
5172
|
const checkpointResults = {
|
|
5156
5173
|
i,
|
|
5157
5174
|
cursorDocument,
|
|
@@ -5164,7 +5181,7 @@ const iterateFirestoreDocumentSnapshotCheckpoints = _async$6(function (config) {
|
|
|
5164
5181
|
});
|
|
5165
5182
|
})
|
|
5166
5183
|
});
|
|
5167
|
-
return _await$
|
|
5184
|
+
return _await$8(performTaskFn(taskInputFactory), function () {
|
|
5168
5185
|
const result = {
|
|
5169
5186
|
totalCheckpoints: currentIndex,
|
|
5170
5187
|
totalSnapshotsVisited,
|
|
@@ -5179,7 +5196,7 @@ const iterateFirestoreDocumentSnapshotCheckpoints = _async$6(function (config) {
|
|
|
5179
5196
|
* @param config
|
|
5180
5197
|
* @returns
|
|
5181
5198
|
*/
|
|
5182
|
-
const iterateFirestoreDocumentSnapshotBatches = _async$
|
|
5199
|
+
const iterateFirestoreDocumentSnapshotBatches = _async$8(function (config) {
|
|
5183
5200
|
const {
|
|
5184
5201
|
iterateSnapshotBatch,
|
|
5185
5202
|
batchSizeForSnapshots: inputBatchSizeForSnapshots,
|
|
@@ -5189,12 +5206,12 @@ const iterateFirestoreDocumentSnapshotBatches = _async$6(function (config) {
|
|
|
5189
5206
|
const batchSize = inputBatchSize === null ? null : inputBatchSize != null ? inputBatchSize : DEFAULT_ITERATE_FIRESTORE_DOCUMENT_SNAPSHOT_BATCHES_BATCH_SIZE;
|
|
5190
5207
|
const batchSizeForSnapshots = inputBatchSizeForSnapshots != null ? inputBatchSizeForSnapshots : () => batchSize;
|
|
5191
5208
|
return iterateFirestoreDocumentSnapshotCheckpoints(Object.assign({}, config, {
|
|
5192
|
-
iterateCheckpoint: _async$
|
|
5209
|
+
iterateCheckpoint: _async$8(function (docSnapshots) {
|
|
5193
5210
|
if (docSnapshots.length > 0) {
|
|
5194
|
-
return _await$
|
|
5211
|
+
return _await$8(batchSizeForSnapshots(docSnapshots), function (batchSizeForSnapshotsResult) {
|
|
5195
5212
|
const batches = batchSizeForSnapshotsResult === null ? [docSnapshots] : util.batch(docSnapshots, batchSizeForSnapshotsResult);
|
|
5196
5213
|
let i = 0;
|
|
5197
|
-
return _await$
|
|
5214
|
+
return _await$8(util.performAsyncTasks(batches, x => iterateSnapshotBatch(x, i++), Object.assign({
|
|
5198
5215
|
sequential: true
|
|
5199
5216
|
}, performTasksConfig)), function (performTasksResult) {
|
|
5200
5217
|
return performTasksResult.results.map(([snapshots, result], i) => ({
|
|
@@ -5223,7 +5240,7 @@ const iterateFirestoreDocumentSnapshotBatches = _async$6(function (config) {
|
|
|
5223
5240
|
* @param config
|
|
5224
5241
|
* @returns
|
|
5225
5242
|
*/
|
|
5226
|
-
const iterateFirestoreDocumentSnapshotPairBatches = _async$
|
|
5243
|
+
const iterateFirestoreDocumentSnapshotPairBatches = _async$8(function (config) {
|
|
5227
5244
|
const {
|
|
5228
5245
|
iterateSnapshotPairsBatch,
|
|
5229
5246
|
documentAccessor
|
|
@@ -5231,7 +5248,7 @@ const iterateFirestoreDocumentSnapshotPairBatches = _async$6(function (config) {
|
|
|
5231
5248
|
const loadPairForSnapshot = firestoreDocumentSnapshotPairsLoaderInstance(documentAccessor);
|
|
5232
5249
|
return iterateFirestoreDocumentSnapshotBatches(Object.assign({}, config, {
|
|
5233
5250
|
maxParallelCheckpoints: 1,
|
|
5234
|
-
iterateSnapshotBatch: _async$
|
|
5251
|
+
iterateSnapshotBatch: _async$8(function (snapshots, batchIndex) {
|
|
5235
5252
|
const pairs = snapshots.map(loadPairForSnapshot);
|
|
5236
5253
|
return iterateSnapshotPairsBatch(pairs, batchIndex);
|
|
5237
5254
|
})
|
|
@@ -5248,7 +5265,7 @@ const iterateFirestoreDocumentSnapshotPairBatches = _async$6(function (config) {
|
|
|
5248
5265
|
* @param config
|
|
5249
5266
|
* @returns
|
|
5250
5267
|
*/
|
|
5251
|
-
const iterateFirestoreDocumentSnapshots = _async$
|
|
5268
|
+
const iterateFirestoreDocumentSnapshots = _async$8(function (config) {
|
|
5252
5269
|
const {
|
|
5253
5270
|
iterateSnapshot,
|
|
5254
5271
|
performTasksConfig,
|
|
@@ -5256,7 +5273,7 @@ const iterateFirestoreDocumentSnapshots = _async$6(function (config) {
|
|
|
5256
5273
|
} = config;
|
|
5257
5274
|
return iterateFirestoreDocumentSnapshotBatches(Object.assign({}, config, {
|
|
5258
5275
|
maxParallelCheckpoints: 1,
|
|
5259
|
-
iterateSnapshotBatch: _async$
|
|
5276
|
+
iterateSnapshotBatch: _async$8(function (docSnapshots) {
|
|
5260
5277
|
return util.performAsyncTasks(docSnapshots, iterateSnapshot, Object.assign({
|
|
5261
5278
|
sequential: true
|
|
5262
5279
|
}, snapshotsPerformTasksConfig != null ? snapshotsPerformTasksConfig : Object.assign({}, performTasksConfig, {
|
|
@@ -5266,14 +5283,14 @@ const iterateFirestoreDocumentSnapshots = _async$6(function (config) {
|
|
|
5266
5283
|
})
|
|
5267
5284
|
}));
|
|
5268
5285
|
});
|
|
5269
|
-
const iterateFirestoreDocumentSnapshotPairs = _async$
|
|
5286
|
+
const iterateFirestoreDocumentSnapshotPairs = _async$8(function (config) {
|
|
5270
5287
|
const {
|
|
5271
5288
|
iterateSnapshotPair,
|
|
5272
5289
|
documentAccessor
|
|
5273
5290
|
} = config;
|
|
5274
5291
|
const loadPairForSnapshot = firestoreDocumentSnapshotPairsLoaderInstance(documentAccessor);
|
|
5275
5292
|
return iterateFirestoreDocumentSnapshots(Object.assign({}, config, {
|
|
5276
|
-
iterateSnapshot: _async$
|
|
5293
|
+
iterateSnapshot: _async$8(function (snapshot) {
|
|
5277
5294
|
const pair = loadPairForSnapshot(snapshot);
|
|
5278
5295
|
return iterateSnapshotPair(pair);
|
|
5279
5296
|
})
|
|
@@ -5282,7 +5299,7 @@ const iterateFirestoreDocumentSnapshotPairs = _async$6(function (config) {
|
|
|
5282
5299
|
const DEFAULT_ITERATE_FIRESTORE_DOCUMENT_SNAPSHOT_BATCHES_BATCH_SIZE = 25;
|
|
5283
5300
|
function filterRepeatCheckpointSnapshots(readKeyFunction = x => x.id) {
|
|
5284
5301
|
const allowOnceFilter = util.allowValueOnceFilter(readKeyFunction);
|
|
5285
|
-
return _async$
|
|
5302
|
+
return _async$8(function (snapshots) {
|
|
5286
5303
|
return snapshots.filter(allowOnceFilter);
|
|
5287
5304
|
});
|
|
5288
5305
|
}
|
|
@@ -5297,7 +5314,7 @@ function allowDocumentSnapshotWithPathOnceFilter() {
|
|
|
5297
5314
|
* @returns
|
|
5298
5315
|
*/
|
|
5299
5316
|
|
|
5300
|
-
function _await$
|
|
5317
|
+
function _await$7(value, then, direct) {
|
|
5301
5318
|
if (direct) {
|
|
5302
5319
|
return then ? then(value) : value;
|
|
5303
5320
|
}
|
|
@@ -5306,7 +5323,7 @@ function _await$5(value, then, direct) {
|
|
|
5306
5323
|
}
|
|
5307
5324
|
return then ? value.then(then) : value;
|
|
5308
5325
|
}
|
|
5309
|
-
function _async$
|
|
5326
|
+
function _async$7(f) {
|
|
5310
5327
|
return function () {
|
|
5311
5328
|
for (var args = [], i = 0; i < arguments.length; i++) {
|
|
5312
5329
|
args[i] = arguments[i];
|
|
@@ -5330,14 +5347,14 @@ function _invokeIgnored$1(body) {
|
|
|
5330
5347
|
return result.then(_empty$1);
|
|
5331
5348
|
}
|
|
5332
5349
|
}
|
|
5333
|
-
function _invoke$
|
|
5350
|
+
function _invoke$2(body, then) {
|
|
5334
5351
|
var result = body();
|
|
5335
5352
|
if (result && result.then) {
|
|
5336
5353
|
return result.then(then);
|
|
5337
5354
|
}
|
|
5338
5355
|
return then(result);
|
|
5339
5356
|
}
|
|
5340
|
-
const loadAllFirestoreDocumentSnapshot = _async$
|
|
5357
|
+
const loadAllFirestoreDocumentSnapshot = _async$7(function (config) {
|
|
5341
5358
|
const {
|
|
5342
5359
|
queryFactory,
|
|
5343
5360
|
constraintsFactory,
|
|
@@ -5349,7 +5366,7 @@ const loadAllFirestoreDocumentSnapshot = _async$5(function (config) {
|
|
|
5349
5366
|
iterateSnapshotsForCheckpoint
|
|
5350
5367
|
} = config;
|
|
5351
5368
|
const allDocumentGroups = [];
|
|
5352
|
-
return _await$
|
|
5369
|
+
return _await$7(iterateFirestoreDocumentSnapshotCheckpoints({
|
|
5353
5370
|
queryFactory,
|
|
5354
5371
|
constraintsFactory,
|
|
5355
5372
|
dynamicConstraints,
|
|
@@ -5358,8 +5375,8 @@ const loadAllFirestoreDocumentSnapshot = _async$5(function (config) {
|
|
|
5358
5375
|
filterCheckpointSnapshots,
|
|
5359
5376
|
limitPerCheckpoint,
|
|
5360
5377
|
maxParallelCheckpoints: 1,
|
|
5361
|
-
iterateCheckpoint: _async$
|
|
5362
|
-
return _invoke$
|
|
5378
|
+
iterateCheckpoint: _async$7(function (snapshots, query) {
|
|
5379
|
+
return _invoke$2(function () {
|
|
5363
5380
|
if (snapshots.length) {
|
|
5364
5381
|
allDocumentGroups.push(snapshots); // add to snapshots array
|
|
5365
5382
|
return _invokeIgnored$1(function () {
|
|
@@ -5386,7 +5403,7 @@ const loadAllFirestoreDocumentSnapshot = _async$5(function (config) {
|
|
|
5386
5403
|
};
|
|
5387
5404
|
});
|
|
5388
5405
|
});
|
|
5389
|
-
const loadAllFirestoreDocumentSnapshotPairs = _async$
|
|
5406
|
+
const loadAllFirestoreDocumentSnapshotPairs = _async$7(function (config) {
|
|
5390
5407
|
const {
|
|
5391
5408
|
documentAccessor,
|
|
5392
5409
|
queryFactory,
|
|
@@ -5399,7 +5416,7 @@ const loadAllFirestoreDocumentSnapshotPairs = _async$5(function (config) {
|
|
|
5399
5416
|
iterateSnapshotPairsBatch: optionalIterateSnapshotPairsBatch
|
|
5400
5417
|
} = config;
|
|
5401
5418
|
const allDocumentGroups = [];
|
|
5402
|
-
return _await$
|
|
5419
|
+
return _await$7(iterateFirestoreDocumentSnapshotPairBatches({
|
|
5403
5420
|
documentAccessor,
|
|
5404
5421
|
queryFactory,
|
|
5405
5422
|
constraintsFactory,
|
|
@@ -5409,7 +5426,7 @@ const loadAllFirestoreDocumentSnapshotPairs = _async$5(function (config) {
|
|
|
5409
5426
|
filterCheckpointSnapshots,
|
|
5410
5427
|
limitPerCheckpoint,
|
|
5411
5428
|
maxParallelCheckpoints: 1,
|
|
5412
|
-
iterateSnapshotPairsBatch: _async$
|
|
5429
|
+
iterateSnapshotPairsBatch: _async$7(function (snapshotDataPairs, batchIndex) {
|
|
5413
5430
|
allDocumentGroups.push(snapshotDataPairs);
|
|
5414
5431
|
return _invokeIgnored$1(function () {
|
|
5415
5432
|
if (optionalIterateSnapshotPairsBatch) {
|
|
@@ -6137,7 +6154,7 @@ $$1({ target: 'Array', proto: true, forced: String(test) === String(test.reverse
|
|
|
6137
6154
|
}
|
|
6138
6155
|
});
|
|
6139
6156
|
|
|
6140
|
-
function _async$
|
|
6157
|
+
function _async$6(f) {
|
|
6141
6158
|
return function () {
|
|
6142
6159
|
for (var args = [], i = 0; i < arguments.length; i++) {
|
|
6143
6160
|
args[i] = arguments[i];
|
|
@@ -6149,7 +6166,7 @@ function _async$4(f) {
|
|
|
6149
6166
|
}
|
|
6150
6167
|
};
|
|
6151
6168
|
}
|
|
6152
|
-
function _await$
|
|
6169
|
+
function _await$6(value, then, direct) {
|
|
6153
6170
|
if (direct) {
|
|
6154
6171
|
return then ? then(value) : value;
|
|
6155
6172
|
}
|
|
@@ -6164,16 +6181,16 @@ function firestoreCollectionQueryFactory(queryFactory, accessorContext) {
|
|
|
6164
6181
|
const wrapQuery = baseQuery => {
|
|
6165
6182
|
return {
|
|
6166
6183
|
baseQuery,
|
|
6167
|
-
countDocs: _async$
|
|
6184
|
+
countDocs: _async$6(function () {
|
|
6168
6185
|
return baseQuery.countDocs();
|
|
6169
6186
|
}),
|
|
6170
|
-
getFirstDoc: _async$
|
|
6171
|
-
return _await$
|
|
6187
|
+
getFirstDoc: _async$6(function (transaction) {
|
|
6188
|
+
return _await$6(baseQuery.getFirstDoc(transaction), function (result) {
|
|
6172
6189
|
return result ? documentLoader([result.ref])[0] : undefined;
|
|
6173
6190
|
});
|
|
6174
6191
|
}),
|
|
6175
|
-
getFirstDocSnapshotDataPair: _async$
|
|
6176
|
-
return _await$
|
|
6192
|
+
getFirstDocSnapshotDataPair: _async$6(function (transaction) {
|
|
6193
|
+
return _await$6(baseQuery.getFirstDoc(transaction), function (result) {
|
|
6177
6194
|
return result ? documentSnapshotPairsLoader([result])[0] : undefined;
|
|
6178
6195
|
});
|
|
6179
6196
|
}),
|
|
@@ -6867,7 +6884,7 @@ var addToUnscopables = addToUnscopables$2;
|
|
|
6867
6884
|
// https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
|
|
6868
6885
|
addToUnscopables('flat');
|
|
6869
6886
|
|
|
6870
|
-
function _await$
|
|
6887
|
+
function _await$5(value, then, direct) {
|
|
6871
6888
|
if (direct) {
|
|
6872
6889
|
return then ? then(value) : value;
|
|
6873
6890
|
}
|
|
@@ -6876,7 +6893,7 @@ function _await$3(value, then, direct) {
|
|
|
6876
6893
|
}
|
|
6877
6894
|
return then ? value.then(then) : value;
|
|
6878
6895
|
}
|
|
6879
|
-
function _async$
|
|
6896
|
+
function _async$5(f) {
|
|
6880
6897
|
return function () {
|
|
6881
6898
|
for (var args = [], i = 0; i < arguments.length; i++) {
|
|
6882
6899
|
args[i] = arguments[i];
|
|
@@ -6895,9 +6912,9 @@ function firestoreIdBatchVerifierFactory(config) {
|
|
|
6895
6912
|
const fieldToQuery = config.fieldToQuery;
|
|
6896
6913
|
const makeQueryConstraints = config.makeQueryConstraints ? config.makeQueryConstraints : fieldToQuery === '_id' ? ids => whereDocumentId('in', ids) : ids => where(fieldToQuery, 'in', ids);
|
|
6897
6914
|
return collection => {
|
|
6898
|
-
const verify = _async$
|
|
6915
|
+
const verify = _async$5(function (keys) {
|
|
6899
6916
|
const constraints = makeQueryConstraints(keys);
|
|
6900
|
-
return _await$
|
|
6917
|
+
return _await$5(collection.query(constraints).getDocs(), function (results) {
|
|
6901
6918
|
const keysInResults = results.docs.map(x => readKeys(x)).flat();
|
|
6902
6919
|
const unusedKeys = util.unique(keys, keysInResults);
|
|
6903
6920
|
return unusedKeys;
|
|
@@ -7124,7 +7141,7 @@ function transactionDocumentContext(transaction) {
|
|
|
7124
7141
|
return new TransactionFirestoreDocumentContext(transaction);
|
|
7125
7142
|
}
|
|
7126
7143
|
|
|
7127
|
-
function _async$
|
|
7144
|
+
function _async$4(f) {
|
|
7128
7145
|
return function () {
|
|
7129
7146
|
for (var args = [], i = 0; i < arguments.length; i++) {
|
|
7130
7147
|
args[i] = arguments[i];
|
|
@@ -7143,7 +7160,7 @@ function firestoreClientAccessorDriver() {
|
|
|
7143
7160
|
collectionGroup: firestore.collectionGroup,
|
|
7144
7161
|
collection: firestore.collection,
|
|
7145
7162
|
subcollection: firestore.collection,
|
|
7146
|
-
transactionFactoryForFirestore: firestore$1 => _async$
|
|
7163
|
+
transactionFactoryForFirestore: firestore$1 => _async$4(function (fn) {
|
|
7147
7164
|
return firestore.runTransaction(firestore$1, fn);
|
|
7148
7165
|
}),
|
|
7149
7166
|
writeBatchFactoryForFirestore: firestore$1 => () => firestore.writeBatch(firestore$1),
|
|
@@ -7215,6 +7232,8 @@ function firebaseFirestoreClientDrivers() {
|
|
|
7215
7232
|
};
|
|
7216
7233
|
}
|
|
7217
7234
|
|
|
7235
|
+
const FIRESTORE_PERMISSION_DENIED_ERROR_CODE = 'permission-denied';
|
|
7236
|
+
|
|
7218
7237
|
/**
|
|
7219
7238
|
* Creates a FirestoreContextFactory that uses the @firebase/firebase package.
|
|
7220
7239
|
*/
|
|
@@ -7240,7 +7259,7 @@ class FirebaseServerError extends util.ServerErrorResponse {
|
|
|
7240
7259
|
}
|
|
7241
7260
|
}
|
|
7242
7261
|
|
|
7243
|
-
function _await$
|
|
7262
|
+
function _await$4(value, then, direct) {
|
|
7244
7263
|
if (direct) {
|
|
7245
7264
|
return then ? then(value) : value;
|
|
7246
7265
|
}
|
|
@@ -7260,7 +7279,7 @@ function _catch(body, recover) {
|
|
|
7260
7279
|
}
|
|
7261
7280
|
return result;
|
|
7262
7281
|
}
|
|
7263
|
-
function _async$
|
|
7282
|
+
function _async$3(f) {
|
|
7264
7283
|
return function () {
|
|
7265
7284
|
for (var args = [], i = 0; i < arguments.length; i++) {
|
|
7266
7285
|
args[i] = arguments[i];
|
|
@@ -7277,12 +7296,12 @@ function mapHttpsCallable(callable, wrap, directData = false) {
|
|
|
7277
7296
|
mapInput = x => x,
|
|
7278
7297
|
mapOutput = x => x
|
|
7279
7298
|
} = wrap;
|
|
7280
|
-
return _async$
|
|
7281
|
-
return _await$
|
|
7299
|
+
return _async$3(function (inputData) {
|
|
7300
|
+
return _await$4(mapInput(inputData), function (data) {
|
|
7282
7301
|
return _catch(function () {
|
|
7283
|
-
return _await$
|
|
7302
|
+
return _await$4(callable(data), function (result) {
|
|
7284
7303
|
const resultData = result.data;
|
|
7285
|
-
return _await$
|
|
7304
|
+
return _await$4(mapOutput(resultData), function (mappedResultData) {
|
|
7286
7305
|
if (directData) {
|
|
7287
7306
|
return mappedResultData;
|
|
7288
7307
|
} else {
|
|
@@ -7304,7 +7323,7 @@ function directDataHttpsCallable(callable) {
|
|
|
7304
7323
|
function convertHttpsCallableErrorToReadableError(error) {
|
|
7305
7324
|
let result;
|
|
7306
7325
|
if (typeof error === 'object') {
|
|
7307
|
-
if (error
|
|
7326
|
+
if (isClientFirebaseError(error) && error.details != null) {
|
|
7308
7327
|
result = FirebaseServerError.fromFirebaseError(error);
|
|
7309
7328
|
} else {
|
|
7310
7329
|
result = util.toReadableError(error);
|
|
@@ -7818,7 +7837,7 @@ __decorate([classTransformer.Expose(), classValidator.IsOptional(), classValidat
|
|
|
7818
7837
|
* Abstract AbstractModelPermissionService implementation for FirebaseModelsPermissionService.
|
|
7819
7838
|
*/
|
|
7820
7839
|
|
|
7821
|
-
function _await$
|
|
7840
|
+
function _await$3(value, then, direct) {
|
|
7822
7841
|
if (direct) {
|
|
7823
7842
|
return then ? then(value) : value;
|
|
7824
7843
|
}
|
|
@@ -7852,7 +7871,7 @@ class FirebaseModelPermissionServiceInstance extends model.AbstractModelPermissi
|
|
|
7852
7871
|
}
|
|
7853
7872
|
outputForModel(document) {
|
|
7854
7873
|
return _call(function () {
|
|
7855
|
-
return _await$
|
|
7874
|
+
return _await$3(document.accessor.get(), function (snapshot) {
|
|
7856
7875
|
const data = snapshot.data();
|
|
7857
7876
|
const model = {
|
|
7858
7877
|
document,
|
|
@@ -7992,7 +8011,7 @@ function contextGrantedModelRolesReaderDoesNotExistErrorMessage(contextGrantedMo
|
|
|
7992
8011
|
* @returns
|
|
7993
8012
|
*/
|
|
7994
8013
|
|
|
7995
|
-
function _await(value, then, direct) {
|
|
8014
|
+
function _await$2(value, then, direct) {
|
|
7996
8015
|
if (direct) {
|
|
7997
8016
|
return then ? then(value) : value;
|
|
7998
8017
|
}
|
|
@@ -8016,14 +8035,14 @@ function _invokeIgnored(body) {
|
|
|
8016
8035
|
return result.then(_empty);
|
|
8017
8036
|
}
|
|
8018
8037
|
}
|
|
8019
|
-
function _invoke(body, then) {
|
|
8038
|
+
function _invoke$1(body, then) {
|
|
8020
8039
|
var result = body();
|
|
8021
8040
|
if (result && result.then) {
|
|
8022
8041
|
return result.then(then);
|
|
8023
8042
|
}
|
|
8024
8043
|
return then(result);
|
|
8025
8044
|
}
|
|
8026
|
-
function _async(f) {
|
|
8045
|
+
function _async$2(f) {
|
|
8027
8046
|
return function () {
|
|
8028
8047
|
for (var args = [], i = 0; i < arguments.length; i++) {
|
|
8029
8048
|
args[i] = arguments[i];
|
|
@@ -8081,18 +8100,18 @@ function grantModelRolesIfHasAuthRolesFactory(authRoles) {
|
|
|
8081
8100
|
* @param context
|
|
8082
8101
|
* @returns
|
|
8083
8102
|
*/
|
|
8084
|
-
const isOwnerOfUserRelatedModelInFirebaseModelContext = _async(function (context) {
|
|
8103
|
+
const isOwnerOfUserRelatedModelInFirebaseModelContext = _async$2(function (context) {
|
|
8085
8104
|
let decision = false;
|
|
8086
8105
|
const auth = context.context.auth;
|
|
8087
|
-
return _invoke(function () {
|
|
8106
|
+
return _invoke$1(function () {
|
|
8088
8107
|
if (auth != null) {
|
|
8089
8108
|
let model = context.model;
|
|
8090
|
-
return _invoke(function () {
|
|
8109
|
+
return _invoke$1(function () {
|
|
8091
8110
|
if (!model) {
|
|
8092
8111
|
const document = context.document;
|
|
8093
8112
|
return _invokeIgnored(function () {
|
|
8094
8113
|
if (document) {
|
|
8095
|
-
return _await(document.accessor.get(), function (_document$accessor$ge) {
|
|
8114
|
+
return _await$2(document.accessor.get(), function (_document$accessor$ge) {
|
|
8096
8115
|
model = _document$accessor$ge.data();
|
|
8097
8116
|
});
|
|
8098
8117
|
}
|
|
@@ -8145,10 +8164,10 @@ function grantModelRolesIfFunction(grantIf, grantedRoles) {
|
|
|
8145
8164
|
if (!grantIf) {
|
|
8146
8165
|
throw new Error('missing grant if');
|
|
8147
8166
|
}
|
|
8148
|
-
return _async(function (context, otherwise = model.noAccessRoleMap) {
|
|
8149
|
-
return _await(grantIf(context), function (decision) {
|
|
8150
|
-
return _await(decision ? util.getValueFromGetter(grantedRoles) : 0, function (_getValueFromGetter) {
|
|
8151
|
-
return _await(decision ? _getValueFromGetter : otherwise(), void 0, decision);
|
|
8167
|
+
return _async$2(function (context, otherwise = model.noAccessRoleMap) {
|
|
8168
|
+
return _await$2(grantIf(context), function (decision) {
|
|
8169
|
+
return _await$2(decision ? util.getValueFromGetter(grantedRoles) : 0, function (_getValueFromGetter) {
|
|
8170
|
+
return _await$2(decision ? _getValueFromGetter : otherwise(), void 0, decision);
|
|
8152
8171
|
}, !decision);
|
|
8153
8172
|
});
|
|
8154
8173
|
});
|
|
@@ -8507,6 +8526,1679 @@ function firebaseStorageClientDrivers() {
|
|
|
8507
8526
|
*/
|
|
8508
8527
|
const clientFirebaseStorageContextFactory = firebaseStorageContextFactory(firebaseStorageClientDrivers());
|
|
8509
8528
|
|
|
8529
|
+
function mergeNotificationBoxRecipientTemplateConfigs(a, b) {
|
|
8530
|
+
const {
|
|
8531
|
+
sd,
|
|
8532
|
+
se,
|
|
8533
|
+
st,
|
|
8534
|
+
sp,
|
|
8535
|
+
sn
|
|
8536
|
+
} = a != null ? a : {};
|
|
8537
|
+
const {
|
|
8538
|
+
sd: sdb,
|
|
8539
|
+
se: seb,
|
|
8540
|
+
st: stb,
|
|
8541
|
+
sp: spb,
|
|
8542
|
+
sn: snb
|
|
8543
|
+
} = b != null ? b : {};
|
|
8544
|
+
return {
|
|
8545
|
+
sd: sd != null ? sd : sdb,
|
|
8546
|
+
se: se != null ? se : seb,
|
|
8547
|
+
st: st != null ? st : stb,
|
|
8548
|
+
sp: sp != null ? sp : spb,
|
|
8549
|
+
sn: sn != null ? sn : snb
|
|
8550
|
+
};
|
|
8551
|
+
}
|
|
8552
|
+
function effectiveNotificationBoxRecipientTemplateConfig(x) {
|
|
8553
|
+
const {
|
|
8554
|
+
sd,
|
|
8555
|
+
se,
|
|
8556
|
+
st,
|
|
8557
|
+
sp,
|
|
8558
|
+
sn
|
|
8559
|
+
} = x;
|
|
8560
|
+
return {
|
|
8561
|
+
sd,
|
|
8562
|
+
se: se != null ? se : sd,
|
|
8563
|
+
st: st != null ? st : sd,
|
|
8564
|
+
sp: sp != null ? sp : sd,
|
|
8565
|
+
sn: sn != null ? sn : sd
|
|
8566
|
+
};
|
|
8567
|
+
}
|
|
8568
|
+
function updateNotificationRecipient(a, b) {
|
|
8569
|
+
const {
|
|
8570
|
+
uid: inputUid,
|
|
8571
|
+
n: inputN,
|
|
8572
|
+
e: inputE,
|
|
8573
|
+
t: inputT,
|
|
8574
|
+
s: inputS
|
|
8575
|
+
} = b;
|
|
8576
|
+
const uid = util.updateMaybeValue(a.uid, inputUid);
|
|
8577
|
+
return {
|
|
8578
|
+
uid,
|
|
8579
|
+
n: util.updateMaybeValue(a.n, inputN),
|
|
8580
|
+
e: util.updateMaybeValue(a.e, inputE),
|
|
8581
|
+
t: util.updateMaybeValue(a.t, inputT),
|
|
8582
|
+
s: uid != null ? null : util.updateMaybeValue(a.s, inputS) // null if uid is defined
|
|
8583
|
+
};
|
|
8584
|
+
}
|
|
8585
|
+
|
|
8586
|
+
const firestoreNotificationRecipientWithConfig = firestoreSubObject({
|
|
8587
|
+
objectField: {
|
|
8588
|
+
fields: {
|
|
8589
|
+
uid: optionalFirestoreString(),
|
|
8590
|
+
n: optionalFirestoreString(),
|
|
8591
|
+
e: optionalFirestoreString(),
|
|
8592
|
+
t: optionalFirestoreString(),
|
|
8593
|
+
s: optionalFirestoreString(),
|
|
8594
|
+
sd: optionalFirestoreBoolean(),
|
|
8595
|
+
se: optionalFirestoreBoolean(),
|
|
8596
|
+
st: optionalFirestoreBoolean(),
|
|
8597
|
+
sp: optionalFirestoreBoolean(),
|
|
8598
|
+
sn: optionalFirestoreBoolean()
|
|
8599
|
+
}
|
|
8600
|
+
}
|
|
8601
|
+
});
|
|
8602
|
+
// MARK: Config
|
|
8603
|
+
exports.NotificationBoxRecipientFlag = void 0;
|
|
8604
|
+
(function (NotificationBoxRecipientFlag) {
|
|
8605
|
+
/**
|
|
8606
|
+
* The recipient is enabled.
|
|
8607
|
+
*
|
|
8608
|
+
* This is a transient state that should not be stored.
|
|
8609
|
+
*/
|
|
8610
|
+
NotificationBoxRecipientFlag[NotificationBoxRecipientFlag["ENABLED"] = 0] = "ENABLED";
|
|
8611
|
+
/**
|
|
8612
|
+
* The recipient is not enabled to recieve notifications currently.
|
|
8613
|
+
*/
|
|
8614
|
+
NotificationBoxRecipientFlag[NotificationBoxRecipientFlag["DISABLED"] = 1] = "DISABLED";
|
|
8615
|
+
/**
|
|
8616
|
+
* Recipient opted themselves out from recieving notifications.
|
|
8617
|
+
*/
|
|
8618
|
+
NotificationBoxRecipientFlag[NotificationBoxRecipientFlag["OPT_OUT"] = 2] = "OPT_OUT";
|
|
8619
|
+
})(exports.NotificationBoxRecipientFlag || (exports.NotificationBoxRecipientFlag = {}));
|
|
8620
|
+
function newNotificationBoxRecipientForUid(uid, i) {
|
|
8621
|
+
return {
|
|
8622
|
+
c: {},
|
|
8623
|
+
i,
|
|
8624
|
+
uid
|
|
8625
|
+
};
|
|
8626
|
+
}
|
|
8627
|
+
function mergeNotificationUserDefaultNotificationBoxRecipientConfig(a, b) {
|
|
8628
|
+
const c = mergeNotificationBoxRecipientTemplateConfigRecords(a.c, b.c);
|
|
8629
|
+
const result = Object.assign({}, util.mergeObjects([a, b], util.KeyValueTypleValueFilter.UNDEFINED), {
|
|
8630
|
+
c
|
|
8631
|
+
});
|
|
8632
|
+
return result;
|
|
8633
|
+
}
|
|
8634
|
+
exports.NotificationBoxRecipientTemplateConfigBoolean = void 0;
|
|
8635
|
+
(function (NotificationBoxRecipientTemplateConfigBoolean) {
|
|
8636
|
+
NotificationBoxRecipientTemplateConfigBoolean[NotificationBoxRecipientTemplateConfigBoolean["SEND_ALL_ON"] = 0] = "SEND_ALL_ON";
|
|
8637
|
+
NotificationBoxRecipientTemplateConfigBoolean[NotificationBoxRecipientTemplateConfigBoolean["SEND_ALL_OFF"] = 1] = "SEND_ALL_OFF";
|
|
8638
|
+
NotificationBoxRecipientTemplateConfigBoolean[NotificationBoxRecipientTemplateConfigBoolean["EMAIL"] = 2] = "EMAIL";
|
|
8639
|
+
NotificationBoxRecipientTemplateConfigBoolean[NotificationBoxRecipientTemplateConfigBoolean["EMAIL_OFF"] = 3] = "EMAIL_OFF";
|
|
8640
|
+
NotificationBoxRecipientTemplateConfigBoolean[NotificationBoxRecipientTemplateConfigBoolean["TEXT"] = 4] = "TEXT";
|
|
8641
|
+
NotificationBoxRecipientTemplateConfigBoolean[NotificationBoxRecipientTemplateConfigBoolean["TEXT_OFF"] = 5] = "TEXT_OFF";
|
|
8642
|
+
NotificationBoxRecipientTemplateConfigBoolean[NotificationBoxRecipientTemplateConfigBoolean["PUSH_NOTIFICATION"] = 6] = "PUSH_NOTIFICATION";
|
|
8643
|
+
NotificationBoxRecipientTemplateConfigBoolean[NotificationBoxRecipientTemplateConfigBoolean["PUSH_NOTIFICATION_OFF"] = 7] = "PUSH_NOTIFICATION_OFF";
|
|
8644
|
+
NotificationBoxRecipientTemplateConfigBoolean[NotificationBoxRecipientTemplateConfigBoolean["NOTIFICATION_SUMMARY"] = 8] = "NOTIFICATION_SUMMARY";
|
|
8645
|
+
NotificationBoxRecipientTemplateConfigBoolean[NotificationBoxRecipientTemplateConfigBoolean["NOTIFICATION_SUMMARY_OFF"] = 9] = "NOTIFICATION_SUMMARY_OFF";
|
|
8646
|
+
})(exports.NotificationBoxRecipientTemplateConfigBoolean || (exports.NotificationBoxRecipientTemplateConfigBoolean = {}));
|
|
8647
|
+
function mergeNotificationBoxRecipientTemplateConfigRecords(a, b) {
|
|
8648
|
+
const mergeConfigs = util.mergeObjectsFunction(util.KeyValueTypleValueFilter.UNDEFINED);
|
|
8649
|
+
return mergeConfigs([a, b]);
|
|
8650
|
+
}
|
|
8651
|
+
const notificationBoxRecipientTemplateConfigDencoder = util.bitwiseObjectDencoder({
|
|
8652
|
+
maxIndex: exports.NotificationBoxRecipientTemplateConfigBoolean.NOTIFICATION_SUMMARY_OFF + 1,
|
|
8653
|
+
toSetFunction: x => {
|
|
8654
|
+
const set = new Set();
|
|
8655
|
+
if (x.sd != null) {
|
|
8656
|
+
set.add(x.sd ? exports.NotificationBoxRecipientTemplateConfigBoolean.SEND_ALL_ON : exports.NotificationBoxRecipientTemplateConfigBoolean.SEND_ALL_OFF);
|
|
8657
|
+
}
|
|
8658
|
+
if (x.st != null) {
|
|
8659
|
+
set.add(x.st ? exports.NotificationBoxRecipientTemplateConfigBoolean.TEXT : exports.NotificationBoxRecipientTemplateConfigBoolean.TEXT_OFF);
|
|
8660
|
+
}
|
|
8661
|
+
if (x.se != null) {
|
|
8662
|
+
set.add(x.se ? exports.NotificationBoxRecipientTemplateConfigBoolean.EMAIL : exports.NotificationBoxRecipientTemplateConfigBoolean.EMAIL_OFF);
|
|
8663
|
+
}
|
|
8664
|
+
if (x.sp != null) {
|
|
8665
|
+
set.add(x.sp ? exports.NotificationBoxRecipientTemplateConfigBoolean.PUSH_NOTIFICATION : exports.NotificationBoxRecipientTemplateConfigBoolean.PUSH_NOTIFICATION_OFF);
|
|
8666
|
+
}
|
|
8667
|
+
if (x.sn != null) {
|
|
8668
|
+
set.add(x.sn ? exports.NotificationBoxRecipientTemplateConfigBoolean.NOTIFICATION_SUMMARY : exports.NotificationBoxRecipientTemplateConfigBoolean.NOTIFICATION_SUMMARY_OFF);
|
|
8669
|
+
}
|
|
8670
|
+
return set;
|
|
8671
|
+
},
|
|
8672
|
+
fromSetFunction: x => {
|
|
8673
|
+
const object = {};
|
|
8674
|
+
if (x.has(exports.NotificationBoxRecipientTemplateConfigBoolean.SEND_ALL_ON)) {
|
|
8675
|
+
object.sd = true;
|
|
8676
|
+
} else if (x.has(exports.NotificationBoxRecipientTemplateConfigBoolean.SEND_ALL_OFF)) {
|
|
8677
|
+
object.sd = false;
|
|
8678
|
+
}
|
|
8679
|
+
if (x.has(exports.NotificationBoxRecipientTemplateConfigBoolean.TEXT)) {
|
|
8680
|
+
object.st = true;
|
|
8681
|
+
} else if (x.has(exports.NotificationBoxRecipientTemplateConfigBoolean.TEXT_OFF)) {
|
|
8682
|
+
object.st = false;
|
|
8683
|
+
}
|
|
8684
|
+
if (x.has(exports.NotificationBoxRecipientTemplateConfigBoolean.EMAIL)) {
|
|
8685
|
+
object.se = true;
|
|
8686
|
+
} else if (x.has(exports.NotificationBoxRecipientTemplateConfigBoolean.EMAIL_OFF)) {
|
|
8687
|
+
object.se = false;
|
|
8688
|
+
}
|
|
8689
|
+
if (x.has(exports.NotificationBoxRecipientTemplateConfigBoolean.PUSH_NOTIFICATION)) {
|
|
8690
|
+
object.sp = true;
|
|
8691
|
+
} else if (x.has(exports.NotificationBoxRecipientTemplateConfigBoolean.PUSH_NOTIFICATION_OFF)) {
|
|
8692
|
+
object.sp = false;
|
|
8693
|
+
}
|
|
8694
|
+
if (x.has(exports.NotificationBoxRecipientTemplateConfigBoolean.NOTIFICATION_SUMMARY)) {
|
|
8695
|
+
object.sn = true;
|
|
8696
|
+
} else if (x.has(exports.NotificationBoxRecipientTemplateConfigBoolean.NOTIFICATION_SUMMARY_OFF)) {
|
|
8697
|
+
object.sn = false;
|
|
8698
|
+
}
|
|
8699
|
+
return object;
|
|
8700
|
+
}
|
|
8701
|
+
});
|
|
8702
|
+
function firestoreNotificationBoxRecipientTemplateConfigRecord() {
|
|
8703
|
+
return firestoreBitwiseObjectMap({
|
|
8704
|
+
dencoder: notificationBoxRecipientTemplateConfigDencoder
|
|
8705
|
+
});
|
|
8706
|
+
}
|
|
8707
|
+
const firestoreNotificationBoxRecipient = firestoreSubObject({
|
|
8708
|
+
objectField: {
|
|
8709
|
+
fields: {
|
|
8710
|
+
i: firestoreNumber({
|
|
8711
|
+
default: util.UNSET_INDEX_NUMBER
|
|
8712
|
+
}),
|
|
8713
|
+
uid: optionalFirestoreString(),
|
|
8714
|
+
n: optionalFirestoreString(),
|
|
8715
|
+
t: optionalFirestoreString(),
|
|
8716
|
+
e: optionalFirestoreString(),
|
|
8717
|
+
s: optionalFirestoreString(),
|
|
8718
|
+
f: optionalFirestoreEnum({
|
|
8719
|
+
dontStoreIf: exports.NotificationBoxRecipientFlag.ENABLED
|
|
8720
|
+
}),
|
|
8721
|
+
c: firestoreNotificationBoxRecipientTemplateConfigRecord(),
|
|
8722
|
+
lk: optionalFirestoreBoolean({
|
|
8723
|
+
dontStoreValueIf: false
|
|
8724
|
+
})
|
|
8725
|
+
}
|
|
8726
|
+
}
|
|
8727
|
+
});
|
|
8728
|
+
const firestoreNotificationUserDefaultNotificationBoxRecipientConfig = firestoreSubObject({
|
|
8729
|
+
objectField: {
|
|
8730
|
+
fields: {
|
|
8731
|
+
lk: optionalFirestoreBoolean({
|
|
8732
|
+
dontStoreValueIf: false
|
|
8733
|
+
}),
|
|
8734
|
+
bk: optionalFirestoreBoolean({
|
|
8735
|
+
dontStoreValueIf: false
|
|
8736
|
+
}),
|
|
8737
|
+
t: optionalFirestoreString(),
|
|
8738
|
+
e: optionalFirestoreString(),
|
|
8739
|
+
f: optionalFirestoreEnum({
|
|
8740
|
+
dontStoreIf: exports.NotificationBoxRecipientFlag.ENABLED
|
|
8741
|
+
}),
|
|
8742
|
+
c: firestoreNotificationBoxRecipientTemplateConfigRecord()
|
|
8743
|
+
}
|
|
8744
|
+
}
|
|
8745
|
+
});
|
|
8746
|
+
const firestoreNotificationUserNotificationBoxRecipientConfig = firestoreSubObject({
|
|
8747
|
+
objectField: {
|
|
8748
|
+
fields: {
|
|
8749
|
+
nb: firestoreModelIdString,
|
|
8750
|
+
rm: optionalFirestoreBoolean({
|
|
8751
|
+
dontStoreValueIf: false
|
|
8752
|
+
}),
|
|
8753
|
+
ns: optionalFirestoreBoolean({
|
|
8754
|
+
dontStoreValueIf: false
|
|
8755
|
+
}),
|
|
8756
|
+
lk: optionalFirestoreBoolean({
|
|
8757
|
+
dontStoreValueIf: false
|
|
8758
|
+
}),
|
|
8759
|
+
bk: optionalFirestoreBoolean({
|
|
8760
|
+
dontStoreValueIf: false
|
|
8761
|
+
}),
|
|
8762
|
+
i: firestoreNumber({
|
|
8763
|
+
default: util.UNSET_INDEX_NUMBER
|
|
8764
|
+
}),
|
|
8765
|
+
n: optionalFirestoreString(),
|
|
8766
|
+
t: optionalFirestoreString(),
|
|
8767
|
+
e: optionalFirestoreString(),
|
|
8768
|
+
s: optionalFirestoreString(),
|
|
8769
|
+
f: optionalFirestoreEnum({
|
|
8770
|
+
dontStoreIf: exports.NotificationBoxRecipientFlag.ENABLED
|
|
8771
|
+
}),
|
|
8772
|
+
c: firestoreNotificationBoxRecipientTemplateConfigRecord()
|
|
8773
|
+
}
|
|
8774
|
+
}
|
|
8775
|
+
});
|
|
8776
|
+
function notificationBoxRecipientTemplateConfigRecordToArray(input) {
|
|
8777
|
+
const array = [];
|
|
8778
|
+
util.forEachKeyValue(input, {
|
|
8779
|
+
forEach: x => {
|
|
8780
|
+
array.push(Object.assign({
|
|
8781
|
+
type: x[0]
|
|
8782
|
+
}, x[1]));
|
|
8783
|
+
}
|
|
8784
|
+
});
|
|
8785
|
+
return array;
|
|
8786
|
+
}
|
|
8787
|
+
function notificationBoxRecipientTemplateConfigArrayToRecord(input) {
|
|
8788
|
+
const map = {};
|
|
8789
|
+
input.forEach(x => {
|
|
8790
|
+
map[x.type] = {
|
|
8791
|
+
sd: x.sd,
|
|
8792
|
+
st: x.st,
|
|
8793
|
+
se: x.se,
|
|
8794
|
+
sp: x.sp,
|
|
8795
|
+
sn: x.sn
|
|
8796
|
+
};
|
|
8797
|
+
});
|
|
8798
|
+
return map;
|
|
8799
|
+
}
|
|
8800
|
+
|
|
8801
|
+
const firestoreNotificationItem = firestoreSubObject({
|
|
8802
|
+
objectField: {
|
|
8803
|
+
fields: {
|
|
8804
|
+
id: firestoreModelIdString,
|
|
8805
|
+
cat: firestoreDate(),
|
|
8806
|
+
cb: optionalFirestoreUID(),
|
|
8807
|
+
t: firestoreString(),
|
|
8808
|
+
m: optionalFirestoreString(),
|
|
8809
|
+
s: optionalFirestoreString(),
|
|
8810
|
+
g: optionalFirestoreString(),
|
|
8811
|
+
d: firestorePassThroughField(),
|
|
8812
|
+
v: optionalFirestoreBoolean({
|
|
8813
|
+
dontStoreIf: false
|
|
8814
|
+
})
|
|
8815
|
+
}
|
|
8816
|
+
}
|
|
8817
|
+
});
|
|
8818
|
+
/**
|
|
8819
|
+
* Returns an object containing input notification items split up by their determined read/unread state.
|
|
8820
|
+
*
|
|
8821
|
+
* @param items
|
|
8822
|
+
*/
|
|
8823
|
+
function unreadNotificationItems(items, considerReadIfCreatedBefore) {
|
|
8824
|
+
const checkIsRead = considerReadIfCreatedBefore != null ? x => Boolean(x.v || !dateFns.isAfter(x.cat, considerReadIfCreatedBefore)) : x => Boolean(x.v);
|
|
8825
|
+
const {
|
|
8826
|
+
included: read,
|
|
8827
|
+
excluded: unread
|
|
8828
|
+
} = util.separateValues(items, checkIsRead);
|
|
8829
|
+
return {
|
|
8830
|
+
items,
|
|
8831
|
+
considerReadIfCreatedBefore,
|
|
8832
|
+
read,
|
|
8833
|
+
unread
|
|
8834
|
+
};
|
|
8835
|
+
}
|
|
8836
|
+
const sortNotificationItemsFunction = date.sortByDateFunction(x => x.cat);
|
|
8837
|
+
|
|
8838
|
+
class NotificationFirestoreCollections {}
|
|
8839
|
+
// MARK: NotificationUser
|
|
8840
|
+
const notificationUserIdentity = firestoreModelIdentity('notificationUser', 'nu');
|
|
8841
|
+
class NotificationUserDocument extends AbstractFirestoreDocument {
|
|
8842
|
+
get modelIdentity() {
|
|
8843
|
+
return notificationUserIdentity;
|
|
8844
|
+
}
|
|
8845
|
+
}
|
|
8846
|
+
const notificationUserConverter = snapshotConverterFunctions({
|
|
8847
|
+
fields: {
|
|
8848
|
+
uid: firestoreUID(),
|
|
8849
|
+
b: firestoreModelIdArrayField,
|
|
8850
|
+
dc: firestoreNotificationUserDefaultNotificationBoxRecipientConfig,
|
|
8851
|
+
gc: firestoreNotificationUserDefaultNotificationBoxRecipientConfig,
|
|
8852
|
+
bc: firestoreObjectArray({
|
|
8853
|
+
objectField: firestoreNotificationUserNotificationBoxRecipientConfig
|
|
8854
|
+
}),
|
|
8855
|
+
ns: optionalFirestoreBoolean()
|
|
8856
|
+
}
|
|
8857
|
+
});
|
|
8858
|
+
function notificationUserCollectionReference(context) {
|
|
8859
|
+
return context.collection(notificationUserIdentity.collectionName);
|
|
8860
|
+
}
|
|
8861
|
+
function notificationUserFirestoreCollection(firestoreContext) {
|
|
8862
|
+
return firestoreContext.firestoreCollection({
|
|
8863
|
+
modelIdentity: notificationUserIdentity,
|
|
8864
|
+
converter: notificationUserConverter,
|
|
8865
|
+
collection: notificationUserCollectionReference(firestoreContext),
|
|
8866
|
+
makeDocument: (accessor, documentAccessor) => new NotificationUserDocument(accessor, documentAccessor),
|
|
8867
|
+
firestoreContext
|
|
8868
|
+
});
|
|
8869
|
+
}
|
|
8870
|
+
// MARK: NotificationSummary
|
|
8871
|
+
/**
|
|
8872
|
+
* An arbitrary summary object
|
|
8873
|
+
*/
|
|
8874
|
+
const notificationSummaryIdentity = firestoreModelIdentity('notificationSummary', 'ns');
|
|
8875
|
+
/**
|
|
8876
|
+
* The maximum number of notifications that can be stored in a NotificationSummary.
|
|
8877
|
+
*/
|
|
8878
|
+
const NOTIFICATION_SUMMARY_ITEM_LIMIT = 1000;
|
|
8879
|
+
/**
|
|
8880
|
+
* The expected max length of a subject on a NotificationSummary's embedded NotificationItem.
|
|
8881
|
+
*/
|
|
8882
|
+
const NOTIFICATION_SUMMARY_EMBEDDED_NOTIFICATION_ITEM_SUBJECT_MAX_LENGTH = 80;
|
|
8883
|
+
/**
|
|
8884
|
+
* The expected max length of a message on a NotificationSummary's embedded NotificationItem.
|
|
8885
|
+
*/
|
|
8886
|
+
const NOTIFICATION_SUMMARY_EMBEDDED_NOTIFICATION_ITEM_MESSAGE_MAX_LENGTH = 500;
|
|
8887
|
+
class NotificationSummaryDocument extends AbstractFirestoreDocument {
|
|
8888
|
+
get modelIdentity() {
|
|
8889
|
+
return notificationSummaryIdentity;
|
|
8890
|
+
}
|
|
8891
|
+
}
|
|
8892
|
+
const notificationSummaryConverter = snapshotConverterFunctions({
|
|
8893
|
+
fields: {
|
|
8894
|
+
cat: firestoreDate(),
|
|
8895
|
+
m: firestoreModelKeyString,
|
|
8896
|
+
o: firestoreModelKeyString,
|
|
8897
|
+
n: firestoreObjectArray({
|
|
8898
|
+
objectField: firestoreNotificationItem
|
|
8899
|
+
}),
|
|
8900
|
+
lat: optionalFirestoreDate(),
|
|
8901
|
+
rat: optionalFirestoreDate(),
|
|
8902
|
+
s: optionalFirestoreBoolean({
|
|
8903
|
+
dontStoreIf: false
|
|
8904
|
+
})
|
|
8905
|
+
}
|
|
8906
|
+
});
|
|
8907
|
+
function notificationSummaryCollectionReference(context) {
|
|
8908
|
+
return context.collection(notificationSummaryIdentity.collectionName);
|
|
8909
|
+
}
|
|
8910
|
+
function notificationSummaryFirestoreCollection(firestoreContext) {
|
|
8911
|
+
return firestoreContext.firestoreCollection({
|
|
8912
|
+
modelIdentity: notificationSummaryIdentity,
|
|
8913
|
+
converter: notificationSummaryConverter,
|
|
8914
|
+
collection: notificationSummaryCollectionReference(firestoreContext),
|
|
8915
|
+
makeDocument: (accessor, documentAccessor) => new NotificationSummaryDocument(accessor, documentAccessor),
|
|
8916
|
+
firestoreContext
|
|
8917
|
+
});
|
|
8918
|
+
}
|
|
8919
|
+
// MARK: NotificationBox
|
|
8920
|
+
const notificationBoxIdentity = firestoreModelIdentity('notificationBox', 'nb');
|
|
8921
|
+
class NotificationBoxDocument extends AbstractFirestoreDocument {
|
|
8922
|
+
get modelIdentity() {
|
|
8923
|
+
return notificationBoxIdentity;
|
|
8924
|
+
}
|
|
8925
|
+
}
|
|
8926
|
+
const notificationBoxConverter = snapshotConverterFunctions({
|
|
8927
|
+
fields: {
|
|
8928
|
+
cat: firestoreDate(),
|
|
8929
|
+
m: firestoreModelKeyString,
|
|
8930
|
+
o: firestoreModelKeyString,
|
|
8931
|
+
r: firestoreObjectArray({
|
|
8932
|
+
objectField: firestoreNotificationBoxRecipient
|
|
8933
|
+
}),
|
|
8934
|
+
w: firestoreNumber({
|
|
8935
|
+
default: () => date.yearWeekCode(new Date())
|
|
8936
|
+
}),
|
|
8937
|
+
s: optionalFirestoreBoolean({
|
|
8938
|
+
dontStoreIf: false
|
|
8939
|
+
}),
|
|
8940
|
+
fi: optionalFirestoreBoolean({
|
|
8941
|
+
dontStoreIf: false
|
|
8942
|
+
})
|
|
8943
|
+
}
|
|
8944
|
+
});
|
|
8945
|
+
function notificationBoxCollectionReference(context) {
|
|
8946
|
+
return context.collection(notificationBoxIdentity.collectionName);
|
|
8947
|
+
}
|
|
8948
|
+
function notificationBoxFirestoreCollection(firestoreContext) {
|
|
8949
|
+
return firestoreContext.firestoreCollection({
|
|
8950
|
+
modelIdentity: notificationBoxIdentity,
|
|
8951
|
+
converter: notificationBoxConverter,
|
|
8952
|
+
collection: notificationBoxCollectionReference(firestoreContext),
|
|
8953
|
+
makeDocument: (accessor, documentAccessor) => new NotificationBoxDocument(accessor, documentAccessor),
|
|
8954
|
+
firestoreContext
|
|
8955
|
+
});
|
|
8956
|
+
}
|
|
8957
|
+
// MARK: Notification Data
|
|
8958
|
+
const notificationIdentity = firestoreModelIdentity(notificationBoxIdentity, 'notification', 'nbn');
|
|
8959
|
+
exports.NotificationSendType = void 0;
|
|
8960
|
+
(function (NotificationSendType) {
|
|
8961
|
+
/**
|
|
8962
|
+
* Sends only if the NotificationBox exists.
|
|
8963
|
+
*
|
|
8964
|
+
* Does not create a NotificationBox for the model.
|
|
8965
|
+
*/
|
|
8966
|
+
NotificationSendType[NotificationSendType["SEND_IF_BOX_EXISTS"] = 0] = "SEND_IF_BOX_EXISTS";
|
|
8967
|
+
/**
|
|
8968
|
+
* Creates a NotificationBox if it doesn't exist, and then sends the Notification.
|
|
8969
|
+
*/
|
|
8970
|
+
NotificationSendType[NotificationSendType["INIT_BOX_AND_SEND"] = 1] = "INIT_BOX_AND_SEND";
|
|
8971
|
+
/**
|
|
8972
|
+
* Sends the notification even if the NotificationBox does not exist.
|
|
8973
|
+
*/
|
|
8974
|
+
NotificationSendType[NotificationSendType["SEND_WITHOUT_CREATING_BOX"] = 2] = "SEND_WITHOUT_CREATING_BOX";
|
|
8975
|
+
})(exports.NotificationSendType || (exports.NotificationSendType = {}));
|
|
8976
|
+
exports.NotificationSendState = void 0;
|
|
8977
|
+
(function (NotificationSendState) {
|
|
8978
|
+
/**
|
|
8979
|
+
* Notification will not be sent.
|
|
8980
|
+
*/
|
|
8981
|
+
NotificationSendState[NotificationSendState["NONE"] = -1] = "NONE";
|
|
8982
|
+
/**
|
|
8983
|
+
* Notification is queued up.
|
|
8984
|
+
*/
|
|
8985
|
+
NotificationSendState[NotificationSendState["QUEUED"] = 0] = "QUEUED";
|
|
8986
|
+
/**
|
|
8987
|
+
* Notification has been sent. Will still show as sent even if there were no messages/recipients to send for this medium.
|
|
8988
|
+
*/
|
|
8989
|
+
NotificationSendState[NotificationSendState["SENT"] = 1] = "SENT";
|
|
8990
|
+
/**
|
|
8991
|
+
* Some of the notifications have been sent, but some failed.
|
|
8992
|
+
*/
|
|
8993
|
+
NotificationSendState[NotificationSendState["SENT_PARTIAL"] = 2] = "SENT_PARTIAL";
|
|
8994
|
+
/**
|
|
8995
|
+
* Notification has been skipped due to the box's settings.
|
|
8996
|
+
*/
|
|
8997
|
+
NotificationSendState[NotificationSendState["SKIPPED"] = 3] = "SKIPPED";
|
|
8998
|
+
/**
|
|
8999
|
+
* Notification is flagged as being skipped and should not be reattempetd
|
|
9000
|
+
*/
|
|
9001
|
+
NotificationSendState[NotificationSendState["NO_TRY"] = 4] = "NO_TRY";
|
|
9002
|
+
/**
|
|
9003
|
+
* Notification encountered an error while sending and could not be sent.
|
|
9004
|
+
*/
|
|
9005
|
+
NotificationSendState[NotificationSendState["SEND_ERROR"] = 5] = "SEND_ERROR";
|
|
9006
|
+
/**
|
|
9007
|
+
* Notification encountered an error while building and could not be sent.
|
|
9008
|
+
*/
|
|
9009
|
+
NotificationSendState[NotificationSendState["BUILD_ERROR"] = 6] = "BUILD_ERROR";
|
|
9010
|
+
/**
|
|
9011
|
+
* Notification encountered an error due to the system not being configured properly.
|
|
9012
|
+
*/
|
|
9013
|
+
NotificationSendState[NotificationSendState["CONFIG_ERROR"] = 7] = "CONFIG_ERROR";
|
|
9014
|
+
})(exports.NotificationSendState || (exports.NotificationSendState = {}));
|
|
9015
|
+
exports.NotificationType = void 0;
|
|
9016
|
+
(function (NotificationType) {
|
|
9017
|
+
/**
|
|
9018
|
+
* Normal notification that is sent to everyone that is configured for the notification box.
|
|
9019
|
+
*/
|
|
9020
|
+
NotificationType[NotificationType["NORMAL"] = 0] = "NORMAL";
|
|
9021
|
+
/**
|
|
9022
|
+
* Notification that goes to only the configured users.
|
|
9023
|
+
*/
|
|
9024
|
+
NotificationType[NotificationType["AD_HOC"] = 1] = "AD_HOC";
|
|
9025
|
+
})(exports.NotificationType || (exports.NotificationType = {}));
|
|
9026
|
+
exports.NotificationRecipientSendFlag = void 0;
|
|
9027
|
+
(function (NotificationRecipientSendFlag) {
|
|
9028
|
+
/**
|
|
9029
|
+
* Will send to all recipients.
|
|
9030
|
+
*/
|
|
9031
|
+
NotificationRecipientSendFlag[NotificationRecipientSendFlag["NORMAL"] = 0] = "NORMAL";
|
|
9032
|
+
/**
|
|
9033
|
+
* Will not send to any of the configured notification box recipients. Will only to the globally configured message recpients or the notification specified recipients.
|
|
9034
|
+
*/
|
|
9035
|
+
NotificationRecipientSendFlag[NotificationRecipientSendFlag["SKIP_NOTIFICATION_BOX_RECIPIENTS"] = 1] = "SKIP_NOTIFICATION_BOX_RECIPIENTS";
|
|
9036
|
+
/**
|
|
9037
|
+
* Will not send to any of the globally configured message recpients. Will only send to the notification specified recipients or the notification box recipients.
|
|
9038
|
+
*/
|
|
9039
|
+
NotificationRecipientSendFlag[NotificationRecipientSendFlag["SKIP_GLOBAL_RECIPIENTS"] = 2] = "SKIP_GLOBAL_RECIPIENTS";
|
|
9040
|
+
/**
|
|
9041
|
+
* Will only sent to recipients that are configured in this notification. Will not send to globally configured message recipients or notification box recipients.
|
|
9042
|
+
*/
|
|
9043
|
+
NotificationRecipientSendFlag[NotificationRecipientSendFlag["ONLY_EXPLICIT_RECIPIENTS"] = 3] = "ONLY_EXPLICIT_RECIPIENTS";
|
|
9044
|
+
/**
|
|
9045
|
+
* Will only sent to globally configured message recipients.
|
|
9046
|
+
*/
|
|
9047
|
+
NotificationRecipientSendFlag[NotificationRecipientSendFlag["ONLY_GLOBAL_RECIPIENTS"] = 4] = "ONLY_GLOBAL_RECIPIENTS";
|
|
9048
|
+
})(exports.NotificationRecipientSendFlag || (exports.NotificationRecipientSendFlag = {}));
|
|
9049
|
+
class NotificationDocument extends AbstractFirestoreDocumentWithParent {
|
|
9050
|
+
get modelIdentity() {
|
|
9051
|
+
return notificationIdentity;
|
|
9052
|
+
}
|
|
9053
|
+
}
|
|
9054
|
+
const notificationConverter = snapshotConverterFunctions({
|
|
9055
|
+
fields: {
|
|
9056
|
+
st: firestoreEnum({
|
|
9057
|
+
default: exports.NotificationSendType.SEND_IF_BOX_EXISTS
|
|
9058
|
+
}),
|
|
9059
|
+
rf: optionalFirestoreEnum(),
|
|
9060
|
+
ts: firestoreEnum({
|
|
9061
|
+
default: exports.NotificationSendState.NONE
|
|
9062
|
+
}),
|
|
9063
|
+
es: firestoreEnum({
|
|
9064
|
+
default: exports.NotificationSendState.NONE
|
|
9065
|
+
}),
|
|
9066
|
+
ps: firestoreEnum({
|
|
9067
|
+
default: exports.NotificationSendState.NONE
|
|
9068
|
+
}),
|
|
9069
|
+
ns: firestoreEnum({
|
|
9070
|
+
default: exports.NotificationSendState.NONE
|
|
9071
|
+
}),
|
|
9072
|
+
n: firestoreNotificationItem,
|
|
9073
|
+
r: firestoreObjectArray({
|
|
9074
|
+
objectField: firestoreNotificationRecipientWithConfig
|
|
9075
|
+
}),
|
|
9076
|
+
sat: firestoreDate(),
|
|
9077
|
+
a: firestoreNumber({
|
|
9078
|
+
default: 0
|
|
9079
|
+
}),
|
|
9080
|
+
d: firestoreBoolean({
|
|
9081
|
+
default: false
|
|
9082
|
+
}),
|
|
9083
|
+
tsr: firestoreUniqueStringArray(),
|
|
9084
|
+
esr: firestoreUniqueStringArray()
|
|
9085
|
+
}
|
|
9086
|
+
});
|
|
9087
|
+
function notificationCollectionReferenceFactory(context) {
|
|
9088
|
+
return notificationBox => {
|
|
9089
|
+
return context.subcollection(notificationBox.documentRef, notificationIdentity.collectionName);
|
|
9090
|
+
};
|
|
9091
|
+
}
|
|
9092
|
+
function notificationFirestoreCollectionFactory(firestoreContext) {
|
|
9093
|
+
const factory = notificationCollectionReferenceFactory(firestoreContext);
|
|
9094
|
+
return parent => {
|
|
9095
|
+
return firestoreContext.firestoreCollectionWithParent({
|
|
9096
|
+
modelIdentity: notificationIdentity,
|
|
9097
|
+
converter: notificationConverter,
|
|
9098
|
+
collection: factory(parent),
|
|
9099
|
+
makeDocument: (accessor, documentAccessor) => new NotificationDocument(accessor, documentAccessor),
|
|
9100
|
+
firestoreContext,
|
|
9101
|
+
parent
|
|
9102
|
+
});
|
|
9103
|
+
};
|
|
9104
|
+
}
|
|
9105
|
+
function notificationCollectionReference(context) {
|
|
9106
|
+
return context.collectionGroup(notificationIdentity.collectionName);
|
|
9107
|
+
}
|
|
9108
|
+
function notificationFirestoreCollectionGroup(firestoreContext) {
|
|
9109
|
+
return firestoreContext.firestoreCollectionGroup({
|
|
9110
|
+
modelIdentity: notificationIdentity,
|
|
9111
|
+
converter: notificationConverter,
|
|
9112
|
+
queryLike: notificationCollectionReference(firestoreContext),
|
|
9113
|
+
makeDocument: (accessor, documentAccessor) => new NotificationDocument(accessor, documentAccessor),
|
|
9114
|
+
firestoreContext
|
|
9115
|
+
});
|
|
9116
|
+
}
|
|
9117
|
+
// MARK: Notification Week Data
|
|
9118
|
+
const notificationWeekIdentity = firestoreModelIdentity(notificationBoxIdentity, 'notificationWeek', 'nbnw');
|
|
9119
|
+
/**
|
|
9120
|
+
* The maximum number of notifications that can be stored in a NotificationWeek.
|
|
9121
|
+
*/
|
|
9122
|
+
const NOTIFICATION_WEEK_NOTIFICATION_ITEM_LIMIT = 5000;
|
|
9123
|
+
class NotificationWeekDocument extends AbstractFirestoreDocumentWithParent {
|
|
9124
|
+
get modelIdentity() {
|
|
9125
|
+
return notificationWeekIdentity;
|
|
9126
|
+
}
|
|
9127
|
+
}
|
|
9128
|
+
const notificationWeekConverter = snapshotConverterFunctions({
|
|
9129
|
+
fields: {
|
|
9130
|
+
w: firestoreNumber({
|
|
9131
|
+
default: date.UNKNOWN_YEAR_WEEK_CODE
|
|
9132
|
+
}),
|
|
9133
|
+
n: firestoreObjectArray({
|
|
9134
|
+
objectField: firestoreNotificationItem
|
|
9135
|
+
})
|
|
9136
|
+
}
|
|
9137
|
+
});
|
|
9138
|
+
function notificationWeekCollectionReferenceFactory(context) {
|
|
9139
|
+
return notificationBox => {
|
|
9140
|
+
return context.subcollection(notificationBox.documentRef, notificationWeekIdentity.collectionName);
|
|
9141
|
+
};
|
|
9142
|
+
}
|
|
9143
|
+
function notificationWeekFirestoreCollectionFactory(firestoreContext) {
|
|
9144
|
+
const factory = notificationWeekCollectionReferenceFactory(firestoreContext);
|
|
9145
|
+
return parent => {
|
|
9146
|
+
return firestoreContext.firestoreCollectionWithParent({
|
|
9147
|
+
modelIdentity: notificationWeekIdentity,
|
|
9148
|
+
converter: notificationWeekConverter,
|
|
9149
|
+
collection: factory(parent),
|
|
9150
|
+
makeDocument: (accessor, documentAccessor) => new NotificationWeekDocument(accessor, documentAccessor),
|
|
9151
|
+
firestoreContext,
|
|
9152
|
+
parent
|
|
9153
|
+
});
|
|
9154
|
+
};
|
|
9155
|
+
}
|
|
9156
|
+
function notificationWeekCollectionReference(context) {
|
|
9157
|
+
return context.collectionGroup(notificationWeekIdentity.collectionName);
|
|
9158
|
+
}
|
|
9159
|
+
function notificationWeekFirestoreCollectionGroup(firestoreContext) {
|
|
9160
|
+
return firestoreContext.firestoreCollectionGroup({
|
|
9161
|
+
modelIdentity: notificationWeekIdentity,
|
|
9162
|
+
converter: notificationWeekConverter,
|
|
9163
|
+
queryLike: notificationWeekCollectionReference(firestoreContext),
|
|
9164
|
+
makeDocument: (accessor, documentAccessor) => new NotificationWeekDocument(accessor, documentAccessor),
|
|
9165
|
+
firestoreContext
|
|
9166
|
+
});
|
|
9167
|
+
}
|
|
9168
|
+
|
|
9169
|
+
const NOTIFICATION_RECIPIENT_NAME_MIN_LENGTH = 0;
|
|
9170
|
+
const NOTIFICATION_RECIPIENT_NAME_MAX_LENGTH = 42;
|
|
9171
|
+
const NOTIFICATION_SUBJECT_MIN_LENGTH = 2;
|
|
9172
|
+
const NOTIFICATION_SUBJECT_MAX_LENGTH = 100;
|
|
9173
|
+
const NOTIFICATION_MESSAGE_MIN_LENGTH = 2;
|
|
9174
|
+
const NOTIFICATION_MESSAGE_MAX_LENGTH = 1000;
|
|
9175
|
+
/**
|
|
9176
|
+
* Config entries are inserted, unless marked as remove.
|
|
9177
|
+
*/
|
|
9178
|
+
class NotificationBoxRecipientTemplateConfigArrayEntryParam {
|
|
9179
|
+
constructor() {
|
|
9180
|
+
this.type = void 0;
|
|
9181
|
+
this.sd = void 0;
|
|
9182
|
+
this.se = void 0;
|
|
9183
|
+
this.st = void 0;
|
|
9184
|
+
this.sp = void 0;
|
|
9185
|
+
this.sn = void 0;
|
|
9186
|
+
/**
|
|
9187
|
+
* If true, removes this configuration
|
|
9188
|
+
*/
|
|
9189
|
+
this.remove = void 0;
|
|
9190
|
+
}
|
|
9191
|
+
}
|
|
9192
|
+
__decorate([classTransformer.Expose(), classValidator.IsString(), __metadata("design:type", String)], NotificationBoxRecipientTemplateConfigArrayEntryParam.prototype, "type", void 0);
|
|
9193
|
+
__decorate([classTransformer.Expose(), classValidator.IsOptional(), classValidator.IsBoolean(), __metadata("design:type", Object)], NotificationBoxRecipientTemplateConfigArrayEntryParam.prototype, "sd", void 0);
|
|
9194
|
+
__decorate([classTransformer.Expose(), classValidator.IsOptional(), classValidator.IsBoolean(), __metadata("design:type", Object)], NotificationBoxRecipientTemplateConfigArrayEntryParam.prototype, "se", void 0);
|
|
9195
|
+
__decorate([classTransformer.Expose(), classValidator.IsOptional(), classValidator.IsBoolean(), __metadata("design:type", Object)], NotificationBoxRecipientTemplateConfigArrayEntryParam.prototype, "st", void 0);
|
|
9196
|
+
__decorate([classTransformer.Expose(), classValidator.IsOptional(), classValidator.IsBoolean(), __metadata("design:type", Object)], NotificationBoxRecipientTemplateConfigArrayEntryParam.prototype, "sp", void 0);
|
|
9197
|
+
__decorate([classTransformer.Expose(), classValidator.IsOptional(), classValidator.IsBoolean(), __metadata("design:type", Object)], NotificationBoxRecipientTemplateConfigArrayEntryParam.prototype, "sn", void 0);
|
|
9198
|
+
__decorate([classTransformer.Expose(), classValidator.IsOptional(), classValidator.IsBoolean(), __metadata("design:type", Object)], NotificationBoxRecipientTemplateConfigArrayEntryParam.prototype, "remove", void 0);
|
|
9199
|
+
/**
|
|
9200
|
+
* Used for creating a new NotificationUser for a user.
|
|
9201
|
+
*/
|
|
9202
|
+
class CreateNotificationUserParams {
|
|
9203
|
+
constructor() {
|
|
9204
|
+
/**
|
|
9205
|
+
* UID of the user to create the NotificationUser for.
|
|
9206
|
+
*/
|
|
9207
|
+
this.uid = void 0;
|
|
9208
|
+
}
|
|
9209
|
+
}
|
|
9210
|
+
__decorate([classTransformer.Expose(), classValidator.IsOptional(), IsFirestoreModelId(), __metadata("design:type", String)], CreateNotificationUserParams.prototype, "uid", void 0);
|
|
9211
|
+
/**
|
|
9212
|
+
* Used for updating the global or default config on a NotificationUser.
|
|
9213
|
+
*/
|
|
9214
|
+
class UpdateNotificationUserDefaultNotificationBoxRecipientConfigParams {
|
|
9215
|
+
constructor() {
|
|
9216
|
+
/**
|
|
9217
|
+
* NotificationBox recipient to update. Is ignored if UID is provided and matches a user. Used for external recipients/users.
|
|
9218
|
+
*/
|
|
9219
|
+
this.i = void 0;
|
|
9220
|
+
/**
|
|
9221
|
+
* Override email address
|
|
9222
|
+
*/
|
|
9223
|
+
this.e = void 0;
|
|
9224
|
+
/**
|
|
9225
|
+
* Override phone number
|
|
9226
|
+
*/
|
|
9227
|
+
this.t = void 0;
|
|
9228
|
+
/**
|
|
9229
|
+
* Array of configs that correspond with "c"
|
|
9230
|
+
*/
|
|
9231
|
+
this.configs = void 0;
|
|
9232
|
+
this.lk = void 0;
|
|
9233
|
+
this.bk = void 0;
|
|
9234
|
+
this.f = void 0;
|
|
9235
|
+
}
|
|
9236
|
+
}
|
|
9237
|
+
__decorate([classTransformer.Expose(), classValidator.IsOptional(), classValidator.IsNumber(), __metadata("design:type", Object)], UpdateNotificationUserDefaultNotificationBoxRecipientConfigParams.prototype, "i", void 0);
|
|
9238
|
+
__decorate([classTransformer.Expose(), classValidator.IsOptional(), classValidator.IsEmail(), __metadata("design:type", Object)], UpdateNotificationUserDefaultNotificationBoxRecipientConfigParams.prototype, "e", void 0);
|
|
9239
|
+
__decorate([classTransformer.Expose(), classValidator.IsOptional(), model.IsE164PhoneNumber(), __metadata("design:type", Object)], UpdateNotificationUserDefaultNotificationBoxRecipientConfigParams.prototype, "t", void 0);
|
|
9240
|
+
__decorate([classTransformer.Expose(), classValidator.IsOptional(), classValidator.IsArray(), classValidator.ValidateNested({
|
|
9241
|
+
each: true
|
|
9242
|
+
}), classTransformer.Type(() => NotificationBoxRecipientTemplateConfigArrayEntryParam), __metadata("design:type", Object)], UpdateNotificationUserDefaultNotificationBoxRecipientConfigParams.prototype, "configs", void 0);
|
|
9243
|
+
__decorate([classTransformer.Expose(), classValidator.IsBoolean(), classValidator.IsOptional(), __metadata("design:type", Object)], UpdateNotificationUserDefaultNotificationBoxRecipientConfigParams.prototype, "lk", void 0);
|
|
9244
|
+
__decorate([classTransformer.Expose(), classValidator.IsBoolean(), classValidator.IsOptional(), __metadata("design:type", Object)], UpdateNotificationUserDefaultNotificationBoxRecipientConfigParams.prototype, "bk", void 0);
|
|
9245
|
+
__decorate([classTransformer.Expose(), classValidator.IsOptional(), classValidator.IsEnum(exports.NotificationBoxRecipientFlag), __metadata("design:type", Object)], UpdateNotificationUserDefaultNotificationBoxRecipientConfigParams.prototype, "f", void 0);
|
|
9246
|
+
class UpdateNotificationBoxRecipientLikeParams {
|
|
9247
|
+
constructor() {
|
|
9248
|
+
/**
|
|
9249
|
+
* Override email address
|
|
9250
|
+
*/
|
|
9251
|
+
this.e = void 0;
|
|
9252
|
+
/**
|
|
9253
|
+
* Override phone number
|
|
9254
|
+
*/
|
|
9255
|
+
this.t = void 0;
|
|
9256
|
+
/**
|
|
9257
|
+
* Notification summary id
|
|
9258
|
+
*/
|
|
9259
|
+
this.s = void 0;
|
|
9260
|
+
/**
|
|
9261
|
+
* Array of configs
|
|
9262
|
+
*/
|
|
9263
|
+
this.configs = void 0;
|
|
9264
|
+
}
|
|
9265
|
+
}
|
|
9266
|
+
__decorate([classTransformer.Expose(), classValidator.IsOptional(), classValidator.IsEmail(), __metadata("design:type", Object)], UpdateNotificationBoxRecipientLikeParams.prototype, "e", void 0);
|
|
9267
|
+
__decorate([classTransformer.Expose(), classValidator.IsOptional(), model.IsE164PhoneNumber(), __metadata("design:type", Object)], UpdateNotificationBoxRecipientLikeParams.prototype, "t", void 0);
|
|
9268
|
+
__decorate([classTransformer.Expose(), classValidator.IsOptional(), classValidator.IsPhoneNumber(), __metadata("design:type", Object)], UpdateNotificationBoxRecipientLikeParams.prototype, "s", void 0);
|
|
9269
|
+
__decorate([classTransformer.Expose(), classValidator.IsOptional(), classValidator.IsArray(), classValidator.ValidateNested({
|
|
9270
|
+
each: true
|
|
9271
|
+
}), classTransformer.Type(() => NotificationBoxRecipientTemplateConfigArrayEntryParam), __metadata("design:type", Object)], UpdateNotificationBoxRecipientLikeParams.prototype, "configs", void 0);
|
|
9272
|
+
/**
|
|
9273
|
+
* Used for updating the target NotificationUserNotificationBoxRecipientConfig.
|
|
9274
|
+
*/
|
|
9275
|
+
class UpdateNotificationUserNotificationBoxRecipientParams extends UpdateNotificationBoxRecipientLikeParams {
|
|
9276
|
+
constructor(...args) {
|
|
9277
|
+
super(...args);
|
|
9278
|
+
/**
|
|
9279
|
+
* NotificationBox config to update
|
|
9280
|
+
*/
|
|
9281
|
+
this.nb = void 0;
|
|
9282
|
+
this.rm = void 0;
|
|
9283
|
+
this.lk = void 0;
|
|
9284
|
+
this.bk = void 0;
|
|
9285
|
+
this.f = void 0;
|
|
9286
|
+
/**
|
|
9287
|
+
* Whether or not to delete this configuration entirely.
|
|
9288
|
+
*
|
|
9289
|
+
* Will only delete if rm is true and ns is false. Is ignored otherwise.
|
|
9290
|
+
*/
|
|
9291
|
+
this.deleteRemovedConfig = void 0;
|
|
9292
|
+
}
|
|
9293
|
+
}
|
|
9294
|
+
__decorate([classTransformer.Expose(), IsFirestoreModelId(), __metadata("design:type", String)], UpdateNotificationUserNotificationBoxRecipientParams.prototype, "nb", void 0);
|
|
9295
|
+
__decorate([classTransformer.Expose(), classValidator.IsOptional(), classValidator.IsBoolean(), __metadata("design:type", Object)], UpdateNotificationUserNotificationBoxRecipientParams.prototype, "rm", void 0);
|
|
9296
|
+
__decorate([classTransformer.Expose(), classValidator.IsOptional(), classValidator.IsBoolean(), __metadata("design:type", Object)], UpdateNotificationUserNotificationBoxRecipientParams.prototype, "lk", void 0);
|
|
9297
|
+
__decorate([classTransformer.Expose(), classValidator.IsOptional(), classValidator.IsBoolean(), __metadata("design:type", Object)], UpdateNotificationUserNotificationBoxRecipientParams.prototype, "bk", void 0);
|
|
9298
|
+
__decorate([classTransformer.Expose(), classValidator.IsOptional(), classValidator.IsEnum(() => exports.NotificationBoxRecipientFlag), __metadata("design:type", Object)], UpdateNotificationUserNotificationBoxRecipientParams.prototype, "f", void 0);
|
|
9299
|
+
__decorate([classTransformer.Expose(), classValidator.IsOptional(), classValidator.IsBoolean(), __metadata("design:type", Object)], UpdateNotificationUserNotificationBoxRecipientParams.prototype, "deleteRemovedConfig", void 0);
|
|
9300
|
+
/**
|
|
9301
|
+
* Used for updating the NotificationUser.
|
|
9302
|
+
*/
|
|
9303
|
+
class UpdateNotificationUserParams extends TargetModelParams {
|
|
9304
|
+
constructor(...args) {
|
|
9305
|
+
super(...args);
|
|
9306
|
+
// TODO: update configs...
|
|
9307
|
+
this.gc = void 0;
|
|
9308
|
+
this.dc = void 0;
|
|
9309
|
+
this.bc = void 0;
|
|
9310
|
+
}
|
|
9311
|
+
}
|
|
9312
|
+
__decorate([classTransformer.Expose(), classValidator.IsOptional(), classValidator.ValidateNested(), classTransformer.Type(() => UpdateNotificationUserDefaultNotificationBoxRecipientConfigParams), __metadata("design:type", Object)], UpdateNotificationUserParams.prototype, "gc", void 0);
|
|
9313
|
+
__decorate([classTransformer.Expose(), classValidator.IsOptional(), classValidator.ValidateNested(), classTransformer.Type(() => UpdateNotificationUserDefaultNotificationBoxRecipientConfigParams), __metadata("design:type", Object)], UpdateNotificationUserParams.prototype, "dc", void 0);
|
|
9314
|
+
__decorate([classTransformer.Expose(), classValidator.IsOptional(), classValidator.IsArray(), classValidator.ValidateNested({
|
|
9315
|
+
each: true
|
|
9316
|
+
}), classTransformer.Type(() => UpdateNotificationUserNotificationBoxRecipientParams), __metadata("design:type", Object)], UpdateNotificationUserParams.prototype, "bc", void 0);
|
|
9317
|
+
class ResyncNotificationUserParams extends TargetModelParams {}
|
|
9318
|
+
class ResyncAllNotificationUserParams {}
|
|
9319
|
+
/**
|
|
9320
|
+
* Used for creating a new NotificationSummary for a model.
|
|
9321
|
+
*/
|
|
9322
|
+
class CreateNotificationSummaryParams {
|
|
9323
|
+
constructor() {
|
|
9324
|
+
/**
|
|
9325
|
+
* Model to create the NotificationSummary for.
|
|
9326
|
+
*/
|
|
9327
|
+
this.model = void 0;
|
|
9328
|
+
}
|
|
9329
|
+
}
|
|
9330
|
+
__decorate([classTransformer.Expose(), classValidator.IsNotEmpty(), IsFirestoreModelKey(), __metadata("design:type", String)], CreateNotificationSummaryParams.prototype, "model", void 0);
|
|
9331
|
+
/**
|
|
9332
|
+
* Used for updating the NotificationSummary.
|
|
9333
|
+
*/
|
|
9334
|
+
class UpdateNotificationSummaryParams extends TargetModelParams {
|
|
9335
|
+
constructor(...args) {
|
|
9336
|
+
super(...args);
|
|
9337
|
+
/**
|
|
9338
|
+
* Updates the "rat" time to now.
|
|
9339
|
+
*/
|
|
9340
|
+
this.flagAllRead = void 0;
|
|
9341
|
+
/**
|
|
9342
|
+
* Sets the "rat" time to the given date, or clears it.
|
|
9343
|
+
*/
|
|
9344
|
+
this.setReadAtTime = void 0;
|
|
9345
|
+
}
|
|
9346
|
+
}
|
|
9347
|
+
__decorate([classTransformer.Expose(), classValidator.IsOptional(), classValidator.IsBoolean(), __metadata("design:type", Object)], UpdateNotificationSummaryParams.prototype, "flagAllRead", void 0);
|
|
9348
|
+
__decorate([classTransformer.Expose(), classValidator.IsOptional(), classValidator.IsDate(), classTransformer.Type(() => Date), __metadata("design:type", Object)], UpdateNotificationSummaryParams.prototype, "setReadAtTime", void 0);
|
|
9349
|
+
/**
|
|
9350
|
+
* Used for creating or initializing a new NotificationBox for a model.
|
|
9351
|
+
*
|
|
9352
|
+
* Mainly used for testing. Not exposed to the API.
|
|
9353
|
+
*
|
|
9354
|
+
* The preferred way is to create a NotificationBox through a Notification.
|
|
9355
|
+
*/
|
|
9356
|
+
class CreateNotificationBoxParams {
|
|
9357
|
+
constructor() {
|
|
9358
|
+
this.model = void 0;
|
|
9359
|
+
}
|
|
9360
|
+
}
|
|
9361
|
+
__decorate([classTransformer.Expose(), classValidator.IsNotEmpty(), IsFirestoreModelKey(), __metadata("design:type", String)], CreateNotificationBoxParams.prototype, "model", void 0);
|
|
9362
|
+
/**
|
|
9363
|
+
* Used for initializing an uninitialized model like NotificationBox or NotificationSummary.
|
|
9364
|
+
*/
|
|
9365
|
+
class InitializeNotificationModelParams extends TargetModelParams {
|
|
9366
|
+
constructor(...args) {
|
|
9367
|
+
super(...args);
|
|
9368
|
+
/**
|
|
9369
|
+
* Whether or not to throw an error if the notification has already been sent or is being sent.
|
|
9370
|
+
*/
|
|
9371
|
+
this.throwErrorIfAlreadyInitialized = void 0;
|
|
9372
|
+
}
|
|
9373
|
+
}
|
|
9374
|
+
__decorate([classTransformer.Expose(), classValidator.IsBoolean(), classValidator.IsOptional(), __metadata("design:type", Boolean)], InitializeNotificationModelParams.prototype, "throwErrorIfAlreadyInitialized", void 0);
|
|
9375
|
+
class InitializeAllApplicableNotificationBoxesParams {}
|
|
9376
|
+
class InitializeAllApplicableNotificationSummariesParams {}
|
|
9377
|
+
/**
|
|
9378
|
+
* Used for updating the NotificationBox.
|
|
9379
|
+
*/
|
|
9380
|
+
class UpdateNotificationBoxParams extends TargetModelParams {}
|
|
9381
|
+
/**
|
|
9382
|
+
* Used to create/update a notification box recipient.
|
|
9383
|
+
*/
|
|
9384
|
+
class UpdateNotificationBoxRecipientParams extends UpdateNotificationBoxRecipientLikeParams {
|
|
9385
|
+
constructor(...args) {
|
|
9386
|
+
super(...args);
|
|
9387
|
+
/**
|
|
9388
|
+
* NotificationBox key to update.
|
|
9389
|
+
*/
|
|
9390
|
+
this.key = void 0;
|
|
9391
|
+
/**
|
|
9392
|
+
* NotificationBox recipient to update. Is ignored if UID is provided and matches a user. Used for external recipients/users.
|
|
9393
|
+
*/
|
|
9394
|
+
this.i = void 0;
|
|
9395
|
+
/**
|
|
9396
|
+
* Notification recipient to update by UID, if applicable.
|
|
9397
|
+
*/
|
|
9398
|
+
this.uid = void 0;
|
|
9399
|
+
/**
|
|
9400
|
+
* Whether or not to insert the user if they currently do not exist. Defaults to false.
|
|
9401
|
+
*/
|
|
9402
|
+
this.insert = void 0;
|
|
9403
|
+
/**
|
|
9404
|
+
* Whether or not to enable/disable the recipient from recieving items from this box.
|
|
9405
|
+
*/
|
|
9406
|
+
this.enabled = void 0;
|
|
9407
|
+
/**
|
|
9408
|
+
* Whether or not to remove the user if they exist. Defaults to false.
|
|
9409
|
+
*/
|
|
9410
|
+
this.remove = void 0;
|
|
9411
|
+
}
|
|
9412
|
+
}
|
|
9413
|
+
__decorate([classTransformer.Expose(), classValidator.IsNotEmpty(), IsFirestoreModelKey(), __metadata("design:type", String)], UpdateNotificationBoxRecipientParams.prototype, "key", void 0);
|
|
9414
|
+
__decorate([classTransformer.Expose(), classValidator.IsOptional(), classValidator.IsNumber(), __metadata("design:type", Object)], UpdateNotificationBoxRecipientParams.prototype, "i", void 0);
|
|
9415
|
+
__decorate([classTransformer.Expose(), classValidator.IsOptional(), IsFirestoreModelId(), __metadata("design:type", Object)], UpdateNotificationBoxRecipientParams.prototype, "uid", void 0);
|
|
9416
|
+
__decorate([classTransformer.Expose(), classValidator.IsOptional(), classValidator.IsBoolean(), __metadata("design:type", Object)], UpdateNotificationBoxRecipientParams.prototype, "insert", void 0);
|
|
9417
|
+
__decorate([classTransformer.Expose(), classValidator.IsOptional(), classValidator.IsBoolean(), __metadata("design:type", Object)], UpdateNotificationBoxRecipientParams.prototype, "enabled", void 0);
|
|
9418
|
+
__decorate([classTransformer.Expose(), classValidator.IsOptional(), classValidator.IsBoolean(), __metadata("design:type", Object)], UpdateNotificationBoxRecipientParams.prototype, "remove", void 0);
|
|
9419
|
+
class NotificationRecipientParams {
|
|
9420
|
+
constructor() {
|
|
9421
|
+
/**
|
|
9422
|
+
* User to send the notification to.
|
|
9423
|
+
*/
|
|
9424
|
+
this.uid = void 0;
|
|
9425
|
+
/**
|
|
9426
|
+
* Recipient Name
|
|
9427
|
+
*/
|
|
9428
|
+
this.un = void 0;
|
|
9429
|
+
/**
|
|
9430
|
+
* Email address
|
|
9431
|
+
*/
|
|
9432
|
+
this.e = void 0;
|
|
9433
|
+
/**
|
|
9434
|
+
* Phone number
|
|
9435
|
+
*/
|
|
9436
|
+
this.p = void 0;
|
|
9437
|
+
}
|
|
9438
|
+
}
|
|
9439
|
+
__decorate([classTransformer.Expose(), classValidator.IsOptional(), IsFirestoreModelId(), __metadata("design:type", Object)], NotificationRecipientParams.prototype, "uid", void 0);
|
|
9440
|
+
__decorate([classTransformer.Expose(), classValidator.IsOptional(), classValidator.IsString(), classValidator.MinLength(NOTIFICATION_RECIPIENT_NAME_MIN_LENGTH), classValidator.MaxLength(NOTIFICATION_RECIPIENT_NAME_MAX_LENGTH), __metadata("design:type", Object)], NotificationRecipientParams.prototype, "un", void 0);
|
|
9441
|
+
__decorate([classTransformer.Expose(), classValidator.IsOptional(), classValidator.IsEmail(), __metadata("design:type", Object)], NotificationRecipientParams.prototype, "e", void 0);
|
|
9442
|
+
__decorate([classTransformer.Expose(), classValidator.IsOptional(), classValidator.IsPhoneNumber(), __metadata("design:type", Object)], NotificationRecipientParams.prototype, "p", void 0);
|
|
9443
|
+
/**
|
|
9444
|
+
* Used for sending the notification immediately, if it has not already been sent.
|
|
9445
|
+
*/
|
|
9446
|
+
class SendNotificationParams extends TargetModelParams {
|
|
9447
|
+
constructor(...args) {
|
|
9448
|
+
super(...args);
|
|
9449
|
+
/**
|
|
9450
|
+
* Whether or not to ignore the send at time. Defaults to false.
|
|
9451
|
+
*/
|
|
9452
|
+
this.ignoreSendAtThrottle = void 0;
|
|
9453
|
+
/**
|
|
9454
|
+
* Whether or not to throw an error if the notification has already been sent or is being sent.
|
|
9455
|
+
*/
|
|
9456
|
+
this.throwErrorIfSent = void 0;
|
|
9457
|
+
}
|
|
9458
|
+
}
|
|
9459
|
+
__decorate([classTransformer.Expose(), classValidator.IsOptional(), classValidator.IsBoolean(), __metadata("design:type", Object)], SendNotificationParams.prototype, "ignoreSendAtThrottle", void 0);
|
|
9460
|
+
__decorate([classTransformer.Expose(), classValidator.IsOptional(), classValidator.IsBoolean(), __metadata("design:type", Object)], SendNotificationParams.prototype, "throwErrorIfSent", void 0);
|
|
9461
|
+
/**
|
|
9462
|
+
* Used for sending queued notifications in the system.
|
|
9463
|
+
*/
|
|
9464
|
+
class SendQueuedNotificationsParams {}
|
|
9465
|
+
/**
|
|
9466
|
+
* Used for sending queued notifications in the system.
|
|
9467
|
+
*/
|
|
9468
|
+
class CleanupSentNotificationsParams {}
|
|
9469
|
+
const notificationFunctionTypeConfigMap = {};
|
|
9470
|
+
const notificationBoxModelCrudFunctionsConfig = {
|
|
9471
|
+
notificationUser: ['update:_,resync'],
|
|
9472
|
+
notificationSummary: ['update:_'],
|
|
9473
|
+
notificationBox: ['update:_,recipient']
|
|
9474
|
+
};
|
|
9475
|
+
class NotificationFunctions {}
|
|
9476
|
+
const notificationFunctionMap = callModelFirebaseFunctionMapFactory(notificationFunctionTypeConfigMap, notificationBoxModelCrudFunctionsConfig);
|
|
9477
|
+
|
|
9478
|
+
const CREATE_NOTIFICATION_ID_REQUIRED_ERROR_CODE = 'CREATE_NOTIFICATION_ID_REQUIRED';
|
|
9479
|
+
const NOTIFICATION_MODEL_ALREADY_INITIALIZED_ERROR_CODE = 'NOTIFICATION_MODEL_ALREADY_INITIALIZED';
|
|
9480
|
+
const NOTIFICATION_BOX_EXISTS_FOR_MODEL_ERROR_CODE = 'NOTIFICATION_BOX_EXISTS_FOR_MODEL';
|
|
9481
|
+
const NOTIFICATION_BOX_RECIPIENT_DOES_NOT_EXIST_ERROR_CODE = 'NOTIFICATION_BOX_RECIPIENT_DOES_NOT_EXIST';
|
|
9482
|
+
const NOTIFICATION_USER_INVALID_UID_FOR_CREATE_ERROR_CODE = 'NOTIFICATION_USER_INVALID_UID_FOR_CREATE';
|
|
9483
|
+
const NOTIFICATION_USER_BLOCKED_FROM_BEING_ADD_TO_RECIPIENTS_ERROR_CODE = 'NOTIFICATION_USER_BLOCKED_FROM_BEING_ADD_TO_RECIPIENTS';
|
|
9484
|
+
const NOTIFICATION_USER_LOCKED_CONFIG_FROM_BEING_UPDATED_ERROR_CODE = 'NOTIFICATION_USER_LOCKED_CONFIG_FROM_BEING_UPDATED';
|
|
9485
|
+
|
|
9486
|
+
/**
|
|
9487
|
+
* Creates a NotificationBoxId from the input FirestoreModelKey.
|
|
9488
|
+
*
|
|
9489
|
+
* @param modelKey
|
|
9490
|
+
* @returns
|
|
9491
|
+
*/
|
|
9492
|
+
const notificationBoxIdForModel = twoWayFlatFirestoreModelKey;
|
|
9493
|
+
const inferNotificationBoxRelatedModelKey = inferKeyFromTwoWayFlatFirestoreModelKey;
|
|
9494
|
+
/**
|
|
9495
|
+
* Creates a NotificationSummaryId from the input FirestoreModelKey.
|
|
9496
|
+
*
|
|
9497
|
+
* @param modelKey
|
|
9498
|
+
* @returns
|
|
9499
|
+
*/
|
|
9500
|
+
const notificationSummaryIdForModel = twoWayFlatFirestoreModelKey;
|
|
9501
|
+
function notificationSummaryIdForUidFunctionForRootFirestoreModelIdentity(userModelIdentity) {
|
|
9502
|
+
return uid => twoWayFlatFirestoreModelKey(firestoreModelKey(userModelIdentity, uid));
|
|
9503
|
+
}
|
|
9504
|
+
/**
|
|
9505
|
+
* The default notification template type that can be provided to subscribe to notifications not specified in the configurations.
|
|
9506
|
+
*/
|
|
9507
|
+
const DEFAULT_NOTIFICATION_TEMPLATE_TYPE = 'D';
|
|
9508
|
+
|
|
9509
|
+
/**
|
|
9510
|
+
* Updates a NotificationUserDefaultNotificationBoxRecipientConfig with the input UpdateNotificationUserDefaultNotificationBoxRecipientConfigParams.
|
|
9511
|
+
*
|
|
9512
|
+
* @param a
|
|
9513
|
+
* @param b
|
|
9514
|
+
* @returns
|
|
9515
|
+
*/
|
|
9516
|
+
function updateNotificationBoxRecipientTemplateConfigRecord(a, b, limitToAllowedConfigTypes) {
|
|
9517
|
+
let c;
|
|
9518
|
+
if (b != null) {
|
|
9519
|
+
const cArray = notificationBoxRecipientTemplateConfigRecordToArray(a);
|
|
9520
|
+
let updatedC = util.ModelRelationUtility.insertCollection(cArray, b, {
|
|
9521
|
+
readKey: x => x.type,
|
|
9522
|
+
readType: () => 'x',
|
|
9523
|
+
merge: (x, y) => Object.assign({}, x, y)
|
|
9524
|
+
});
|
|
9525
|
+
// remove types marked as remove
|
|
9526
|
+
updatedC = util.ModelRelationUtility.removeKeysFromCollection(updatedC, b.filter(x => x.remove).map(x => x.type), x => x.type);
|
|
9527
|
+
c = notificationBoxRecipientTemplateConfigArrayToRecord(updatedC);
|
|
9528
|
+
// if the config types are limited to specific types, then filter those only
|
|
9529
|
+
if (limitToAllowedConfigTypes) {
|
|
9530
|
+
c = util.filterKeysOnPOJOFunction(limitToAllowedConfigTypes)(c);
|
|
9531
|
+
}
|
|
9532
|
+
}
|
|
9533
|
+
return c;
|
|
9534
|
+
}
|
|
9535
|
+
/**
|
|
9536
|
+
* Updates a NotificationUserDefaultNotificationBoxRecipientConfig with the input UpdateNotificationUserDefaultNotificationBoxRecipientConfigParams.
|
|
9537
|
+
*
|
|
9538
|
+
* @param a
|
|
9539
|
+
* @param b
|
|
9540
|
+
* @returns
|
|
9541
|
+
*/
|
|
9542
|
+
function updateNotificationUserDefaultNotificationBoxRecipientConfig(a, b, limitToAllowedConfigTypes) {
|
|
9543
|
+
var _ref;
|
|
9544
|
+
const {
|
|
9545
|
+
configs: inputC,
|
|
9546
|
+
f: inputF,
|
|
9547
|
+
bk: inputBk,
|
|
9548
|
+
lk: inputLk
|
|
9549
|
+
} = b;
|
|
9550
|
+
const c = (_ref = inputC != null ? updateNotificationBoxRecipientTemplateConfigRecord(a.c, inputC, limitToAllowedConfigTypes) : undefined) != null ? _ref : a.c;
|
|
9551
|
+
return Object.assign({}, updateNotificationRecipient(a, b), {
|
|
9552
|
+
c,
|
|
9553
|
+
f: util.updateMaybeValue(a.f, inputF),
|
|
9554
|
+
bk: util.updateMaybeValue(a.bk, inputBk),
|
|
9555
|
+
lk: util.updateMaybeValue(a.lk, inputLk)
|
|
9556
|
+
});
|
|
9557
|
+
}
|
|
9558
|
+
function updateNotificationUserNotificationBoxRecipientConfigIfChanged(a, b, limitToAllowedConfigTypes) {
|
|
9559
|
+
var _ref2;
|
|
9560
|
+
const {
|
|
9561
|
+
configs: inputC,
|
|
9562
|
+
rm: inputRm,
|
|
9563
|
+
lk: inputLk,
|
|
9564
|
+
bk: inputBk
|
|
9565
|
+
} = b;
|
|
9566
|
+
const c = (_ref2 = inputC != null ? updateNotificationBoxRecipientTemplateConfigRecord(a.c, inputC, limitToAllowedConfigTypes) : undefined) != null ? _ref2 : a.c;
|
|
9567
|
+
const nextConfig = Object.assign({}, updateNotificationRecipient(a, b), {
|
|
9568
|
+
c,
|
|
9569
|
+
rm: util.updateMaybeValue(a.rm, inputRm),
|
|
9570
|
+
lk: util.updateMaybeValue(a.lk, inputLk),
|
|
9571
|
+
bk: util.updateMaybeValue(a.bk, inputBk),
|
|
9572
|
+
// values remain the same
|
|
9573
|
+
ns: a.ns,
|
|
9574
|
+
nb: a.nb,
|
|
9575
|
+
i: a.i
|
|
9576
|
+
});
|
|
9577
|
+
const configChanged = !util.areEqualPOJOValuesUsingPojoFilter(nextConfig, a, util.filterOnlyUndefinedValues);
|
|
9578
|
+
let result;
|
|
9579
|
+
if (configChanged) {
|
|
9580
|
+
nextConfig.ns = a.i !== util.UNSET_INDEX_NUMBER; // needs sync unless i is unset
|
|
9581
|
+
result = nextConfig;
|
|
9582
|
+
}
|
|
9583
|
+
return result;
|
|
9584
|
+
}
|
|
9585
|
+
/**
|
|
9586
|
+
* Updates the target NotificationUserNotificationBoxRecipientConfig array with the input UpdateNotificationUserNotificationBoxRecipientParams.
|
|
9587
|
+
*
|
|
9588
|
+
* If the target NotificationBox does not exist in the config, it is ignored.
|
|
9589
|
+
*
|
|
9590
|
+
* @param a
|
|
9591
|
+
* @param b
|
|
9592
|
+
*/
|
|
9593
|
+
function updateNotificationUserNotificationBoxRecipientConfigs(a, b, filterWithService) {
|
|
9594
|
+
const boxesMap = util.makeModelMap(a, x => x.nb);
|
|
9595
|
+
let hasChanges = false;
|
|
9596
|
+
b.forEach(x => {
|
|
9597
|
+
const existingBox = boxesMap.get(x.nb);
|
|
9598
|
+
if (existingBox) {
|
|
9599
|
+
if (x.deleteRemovedConfig && existingBox.rm && existingBox.i === util.UNSET_INDEX_NUMBER) {
|
|
9600
|
+
// delete if marked as removed and already sync'd
|
|
9601
|
+
boxesMap.delete(x.nb);
|
|
9602
|
+
hasChanges = true;
|
|
9603
|
+
} else {
|
|
9604
|
+
let allowedConfigTypes;
|
|
9605
|
+
if (filterWithService && x.configs != null) {
|
|
9606
|
+
const modelKey = inferNotificationBoxRelatedModelKey(existingBox.nb);
|
|
9607
|
+
allowedConfigTypes = filterWithService.getTemplateTypesForNotificationModel(modelKey);
|
|
9608
|
+
}
|
|
9609
|
+
// perform update
|
|
9610
|
+
const updatedConfig = updateNotificationUserNotificationBoxRecipientConfigIfChanged(existingBox, x, allowedConfigTypes);
|
|
9611
|
+
if (updatedConfig) {
|
|
9612
|
+
boxesMap.set(x.nb, updatedConfig);
|
|
9613
|
+
hasChanges = true;
|
|
9614
|
+
}
|
|
9615
|
+
}
|
|
9616
|
+
}
|
|
9617
|
+
});
|
|
9618
|
+
let result;
|
|
9619
|
+
if (hasChanges) {
|
|
9620
|
+
result = Array.from(boxesMap.values());
|
|
9621
|
+
}
|
|
9622
|
+
return result;
|
|
9623
|
+
}
|
|
9624
|
+
|
|
9625
|
+
/**
|
|
9626
|
+
* Creates a new Notification and saves it to Firestore and returns the pair if sendNotification in the input is not false.
|
|
9627
|
+
*
|
|
9628
|
+
* @param input
|
|
9629
|
+
* @returns
|
|
9630
|
+
*/
|
|
9631
|
+
function _await$1(value, then, direct) {
|
|
9632
|
+
if (direct) {
|
|
9633
|
+
return then ? then(value) : value;
|
|
9634
|
+
}
|
|
9635
|
+
if (!value || !value.then) {
|
|
9636
|
+
value = Promise.resolve(value);
|
|
9637
|
+
}
|
|
9638
|
+
return then ? value.then(then) : value;
|
|
9639
|
+
}
|
|
9640
|
+
function _invoke(body, then) {
|
|
9641
|
+
var result = body();
|
|
9642
|
+
if (result && result.then) {
|
|
9643
|
+
return result.then(then);
|
|
9644
|
+
}
|
|
9645
|
+
return then(result);
|
|
9646
|
+
}
|
|
9647
|
+
function _async$1(f) {
|
|
9648
|
+
return function () {
|
|
9649
|
+
for (var args = [], i = 0; i < arguments.length; i++) {
|
|
9650
|
+
args[i] = arguments[i];
|
|
9651
|
+
}
|
|
9652
|
+
try {
|
|
9653
|
+
return Promise.resolve(f.apply(this, args));
|
|
9654
|
+
} catch (e) {
|
|
9655
|
+
return Promise.reject(e);
|
|
9656
|
+
}
|
|
9657
|
+
};
|
|
9658
|
+
}
|
|
9659
|
+
const createNotificationDocumentIfSending = function createNotificationDocumentIfSending(input) {
|
|
9660
|
+
return _await$1(createNotificationDocument(input), function (pair) {
|
|
9661
|
+
if (pair.notificationCreated) {
|
|
9662
|
+
return pair;
|
|
9663
|
+
} else {
|
|
9664
|
+
return undefined;
|
|
9665
|
+
}
|
|
9666
|
+
});
|
|
9667
|
+
};
|
|
9668
|
+
/**
|
|
9669
|
+
* Creates a new Notification and saves it to Firestore. Returns the pair.
|
|
9670
|
+
*
|
|
9671
|
+
* @param input
|
|
9672
|
+
*/
|
|
9673
|
+
const createNotificationDocument = _async$1(function (input) {
|
|
9674
|
+
const pair = createNotificationDocumentPair(input);
|
|
9675
|
+
const {
|
|
9676
|
+
notification,
|
|
9677
|
+
notificationDocument
|
|
9678
|
+
} = pair;
|
|
9679
|
+
return _invoke(function () {
|
|
9680
|
+
if (input.shouldCreateNotification !== false && shouldSendCreatedNotificationInput(input)) {
|
|
9681
|
+
return _await$1(notificationDocument.create(notification), function () {
|
|
9682
|
+
pair.notificationCreated = true;
|
|
9683
|
+
});
|
|
9684
|
+
}
|
|
9685
|
+
}, function () {
|
|
9686
|
+
return pair;
|
|
9687
|
+
});
|
|
9688
|
+
});
|
|
9689
|
+
function createNotificationTemplate(input) {
|
|
9690
|
+
const {
|
|
9691
|
+
notificationModel: inputNotification,
|
|
9692
|
+
type,
|
|
9693
|
+
// notification
|
|
9694
|
+
sendType,
|
|
9695
|
+
recipients,
|
|
9696
|
+
st,
|
|
9697
|
+
r,
|
|
9698
|
+
rf,
|
|
9699
|
+
sat,
|
|
9700
|
+
// item
|
|
9701
|
+
createdBy,
|
|
9702
|
+
targetModel: inputTargetModel,
|
|
9703
|
+
subject,
|
|
9704
|
+
message,
|
|
9705
|
+
data,
|
|
9706
|
+
cat,
|
|
9707
|
+
cb,
|
|
9708
|
+
s,
|
|
9709
|
+
m,
|
|
9710
|
+
g,
|
|
9711
|
+
d: inputD
|
|
9712
|
+
} = input;
|
|
9713
|
+
const notificationModel = readFirestoreModelKey(inputNotification);
|
|
9714
|
+
const targetModel = inputTargetModel ? readFirestoreModelKey(inputTargetModel) : undefined;
|
|
9715
|
+
let d = data != null ? data : inputD;
|
|
9716
|
+
if (d && util.objectHasNoKeys(d)) {
|
|
9717
|
+
d = undefined;
|
|
9718
|
+
}
|
|
9719
|
+
const template = {
|
|
9720
|
+
notificationModel,
|
|
9721
|
+
st: sendType != null ? sendType : st,
|
|
9722
|
+
sat,
|
|
9723
|
+
rf,
|
|
9724
|
+
r: recipients != null ? recipients : r,
|
|
9725
|
+
n: {
|
|
9726
|
+
cat,
|
|
9727
|
+
t: type,
|
|
9728
|
+
cb: createdBy != null ? createdBy : cb,
|
|
9729
|
+
m: targetModel != null ? targetModel : m,
|
|
9730
|
+
s: subject != null ? subject : s,
|
|
9731
|
+
g: message != null ? message : g,
|
|
9732
|
+
d
|
|
9733
|
+
}
|
|
9734
|
+
};
|
|
9735
|
+
return template;
|
|
9736
|
+
}
|
|
9737
|
+
/**
|
|
9738
|
+
* Returns true if the notification should be created/sent, given the input.
|
|
9739
|
+
*
|
|
9740
|
+
* @param input
|
|
9741
|
+
* @returns
|
|
9742
|
+
*/
|
|
9743
|
+
function shouldSendCreatedNotificationInput(input) {
|
|
9744
|
+
const {
|
|
9745
|
+
sendNotification,
|
|
9746
|
+
sendNotificationThrottleDate,
|
|
9747
|
+
sendNotificationThrottleTime: inputSendNotificationThrottleTime
|
|
9748
|
+
} = input;
|
|
9749
|
+
const sendNotificationThrottleTime = inputSendNotificationThrottleTime != null ? inputSendNotificationThrottleTime : util.MS_IN_HOUR;
|
|
9750
|
+
const isNotThrottled = sendNotificationThrottleDate ? date.timeHasExpired(sendNotificationThrottleDate, sendNotificationThrottleTime) : true;
|
|
9751
|
+
return sendNotification !== false && isNotThrottled;
|
|
9752
|
+
}
|
|
9753
|
+
/**
|
|
9754
|
+
* Creates a CreateNotificationDocumentPairResult from the input.
|
|
9755
|
+
*
|
|
9756
|
+
* Only creates a pair. Used createNotificationDocument() to also save the document's data.
|
|
9757
|
+
*
|
|
9758
|
+
* @param template
|
|
9759
|
+
*/
|
|
9760
|
+
function createNotificationDocumentPair(input) {
|
|
9761
|
+
var _n$cat;
|
|
9762
|
+
const {
|
|
9763
|
+
template,
|
|
9764
|
+
accessor: inputAccessor,
|
|
9765
|
+
transaction,
|
|
9766
|
+
context
|
|
9767
|
+
} = input;
|
|
9768
|
+
const {
|
|
9769
|
+
notificationModel,
|
|
9770
|
+
st,
|
|
9771
|
+
sat,
|
|
9772
|
+
r,
|
|
9773
|
+
rf,
|
|
9774
|
+
n,
|
|
9775
|
+
ts,
|
|
9776
|
+
es,
|
|
9777
|
+
ps,
|
|
9778
|
+
ns
|
|
9779
|
+
} = template;
|
|
9780
|
+
let accessor = inputAccessor;
|
|
9781
|
+
const notificationBoxId = notificationBoxIdForModel(notificationModel);
|
|
9782
|
+
if (!accessor && notificationBoxId) {
|
|
9783
|
+
if (context) {
|
|
9784
|
+
const {
|
|
9785
|
+
notificationCollectionFactory,
|
|
9786
|
+
notificationBoxCollection
|
|
9787
|
+
} = context;
|
|
9788
|
+
const notificationBoxDocument = notificationBoxCollection.documentAccessorForTransaction(transaction).loadDocumentForId(notificationBoxId);
|
|
9789
|
+
accessor = notificationCollectionFactory(notificationBoxDocument).documentAccessorForTransaction(transaction);
|
|
9790
|
+
}
|
|
9791
|
+
}
|
|
9792
|
+
if (!accessor) {
|
|
9793
|
+
throw new Error('createNotificationDocument() failed as neither an accessor nor sufficient information was provided about the target.');
|
|
9794
|
+
}
|
|
9795
|
+
const notificationDocument = accessor.newDocument();
|
|
9796
|
+
const id = notificationDocument.id;
|
|
9797
|
+
const notification = {
|
|
9798
|
+
st: st != null ? st : exports.NotificationSendType.INIT_BOX_AND_SEND,
|
|
9799
|
+
sat: sat != null ? sat : new Date(),
|
|
9800
|
+
rf,
|
|
9801
|
+
r: r != null ? r : [],
|
|
9802
|
+
n: {
|
|
9803
|
+
id,
|
|
9804
|
+
cat: (_n$cat = n.cat) != null ? _n$cat : new Date(),
|
|
9805
|
+
t: n.t,
|
|
9806
|
+
cb: n.cb,
|
|
9807
|
+
m: n.m,
|
|
9808
|
+
s: n.s,
|
|
9809
|
+
g: n.g,
|
|
9810
|
+
d: n.d
|
|
9811
|
+
},
|
|
9812
|
+
a: 0,
|
|
9813
|
+
d: false,
|
|
9814
|
+
tsr: [],
|
|
9815
|
+
esr: [],
|
|
9816
|
+
ts: ts != null ? ts : exports.NotificationSendState.QUEUED,
|
|
9817
|
+
es: es != null ? es : exports.NotificationSendState.QUEUED,
|
|
9818
|
+
ps: ps != null ? ps : exports.NotificationSendState.QUEUED,
|
|
9819
|
+
ns: ns != null ? ns : exports.NotificationSendState.QUEUED
|
|
9820
|
+
};
|
|
9821
|
+
return {
|
|
9822
|
+
notificationDocument,
|
|
9823
|
+
notification,
|
|
9824
|
+
notificationCreated: false
|
|
9825
|
+
};
|
|
9826
|
+
}
|
|
9827
|
+
|
|
9828
|
+
/**
|
|
9829
|
+
* Creates a NotificationTemplateTypeInfoRecord from the input details array.
|
|
9830
|
+
*
|
|
9831
|
+
* @param infoArray
|
|
9832
|
+
* @returns
|
|
9833
|
+
*/
|
|
9834
|
+
function notificationTemplateTypeInfoRecord(infoArray) {
|
|
9835
|
+
const record = {};
|
|
9836
|
+
infoArray.forEach(x => {
|
|
9837
|
+
const {
|
|
9838
|
+
type
|
|
9839
|
+
} = x;
|
|
9840
|
+
if (record[type]) {
|
|
9841
|
+
throw new Error(`notificationTemplateTypeInfoRecord(): duplicate NotificationTemplateType in record: ${type}`);
|
|
9842
|
+
}
|
|
9843
|
+
record[type] = x;
|
|
9844
|
+
});
|
|
9845
|
+
return record;
|
|
9846
|
+
}
|
|
9847
|
+
class AppNotificationTemplateTypeInfoRecordService {}
|
|
9848
|
+
function appNotificationTemplateTypeInfoRecordService(appNotificationTemplateTypeInfoRecord) {
|
|
9849
|
+
const allNotificationModelIdentityValuesSet = new Set();
|
|
9850
|
+
const notificationModelTypeInfoMapBuilder = util.multiValueMapBuilder();
|
|
9851
|
+
const targetModelTypeInfoMapBuilder = util.multiValueMapBuilder();
|
|
9852
|
+
const allKnownTemplateTypes = [];
|
|
9853
|
+
const allKnownTemplateTypeInfo = [];
|
|
9854
|
+
Object.entries(appNotificationTemplateTypeInfoRecord).forEach(([_, details]) => {
|
|
9855
|
+
const {
|
|
9856
|
+
notificationModelIdentity,
|
|
9857
|
+
targetModelIdentity,
|
|
9858
|
+
alternativeModelIdentities
|
|
9859
|
+
} = details;
|
|
9860
|
+
function addInfoForIdentity(modelIdentity, targetIdentity) {
|
|
9861
|
+
var _targetIdentity$colle;
|
|
9862
|
+
const {
|
|
9863
|
+
collectionType
|
|
9864
|
+
} = modelIdentity;
|
|
9865
|
+
notificationModelTypeInfoMapBuilder.add(collectionType, details);
|
|
9866
|
+
targetModelTypeInfoMapBuilder.add((_targetIdentity$colle = targetIdentity == null ? void 0 : targetIdentity.collectionType) != null ? _targetIdentity$colle : collectionType, details);
|
|
9867
|
+
allNotificationModelIdentityValuesSet.add(modelIdentity);
|
|
9868
|
+
}
|
|
9869
|
+
addInfoForIdentity(notificationModelIdentity, targetModelIdentity);
|
|
9870
|
+
if (alternativeModelIdentities != null) {
|
|
9871
|
+
util.asArray(alternativeModelIdentities).forEach(x => {
|
|
9872
|
+
var _x$altTargetModelIden;
|
|
9873
|
+
addInfoForIdentity(x.altNotificationModelIdentity, (_x$altTargetModelIden = x.altTargetModelIdentity) != null ? _x$altTargetModelIden : targetModelIdentity);
|
|
9874
|
+
});
|
|
9875
|
+
}
|
|
9876
|
+
allKnownTemplateTypeInfo.push(details);
|
|
9877
|
+
allKnownTemplateTypes.push(details.type);
|
|
9878
|
+
});
|
|
9879
|
+
const allNotificationModelIdentityValues = Array.from(allNotificationModelIdentityValuesSet);
|
|
9880
|
+
const notificationModelTemplateInfoMap = notificationModelTypeInfoMapBuilder.map();
|
|
9881
|
+
const targetModelTemplateInfoMap = targetModelTypeInfoMapBuilder.map();
|
|
9882
|
+
const notificationModelTemplateTypesMap = new Map(Array.from(notificationModelTemplateInfoMap.entries()).map(([k, x]) => [k, x.map(y => y.type)]));
|
|
9883
|
+
const targetModelTemplateTypesMap = new Map(Array.from(targetModelTemplateInfoMap.entries()).map(([k, x]) => [k, x.map(y => y.type)]));
|
|
9884
|
+
const service = {
|
|
9885
|
+
appNotificationTemplateTypeInfoRecord,
|
|
9886
|
+
getAllKnownTemplateTypes() {
|
|
9887
|
+
return allKnownTemplateTypes;
|
|
9888
|
+
},
|
|
9889
|
+
getAllKnownTemplateTypeInfo() {
|
|
9890
|
+
return allKnownTemplateTypeInfo;
|
|
9891
|
+
},
|
|
9892
|
+
getAllNotificationModelIdentityValues() {
|
|
9893
|
+
return allNotificationModelIdentityValues;
|
|
9894
|
+
},
|
|
9895
|
+
getTemplateTypesForNotificationModel(model) {
|
|
9896
|
+
var _notificationModelTem;
|
|
9897
|
+
const modelKey = readFirestoreModelKey(model, true);
|
|
9898
|
+
const firestoreCollectionType = firestoreModelKeyCollectionType(modelKey);
|
|
9899
|
+
return (_notificationModelTem = notificationModelTemplateTypesMap.get(firestoreCollectionType)) != null ? _notificationModelTem : [];
|
|
9900
|
+
},
|
|
9901
|
+
getTemplateTypesInfoForNotificationModel(model) {
|
|
9902
|
+
var _notificationModelTem2;
|
|
9903
|
+
const modelKey = readFirestoreModelKey(model, true);
|
|
9904
|
+
const firestoreCollectionType = firestoreModelKeyCollectionType(modelKey);
|
|
9905
|
+
return (_notificationModelTem2 = notificationModelTemplateInfoMap.get(firestoreCollectionType)) != null ? _notificationModelTem2 : [];
|
|
9906
|
+
},
|
|
9907
|
+
getTemplateTypesForTargetModel(target) {
|
|
9908
|
+
var _targetModelTemplateT;
|
|
9909
|
+
const targetModelKey = readFirestoreModelKey(target, true);
|
|
9910
|
+
const targetFirestoreCollectionType = firestoreModelKeyCollectionType(targetModelKey);
|
|
9911
|
+
return (_targetModelTemplateT = targetModelTemplateTypesMap.get(targetFirestoreCollectionType)) != null ? _targetModelTemplateT : [];
|
|
9912
|
+
},
|
|
9913
|
+
getTemplateTypesForTargetModelIdentity(identity) {
|
|
9914
|
+
var _targetModelTemplateT2;
|
|
9915
|
+
return (_targetModelTemplateT2 = targetModelTemplateTypesMap.get(identity.collectionName)) != null ? _targetModelTemplateT2 : [];
|
|
9916
|
+
},
|
|
9917
|
+
getTemplateTypeInfosForTargetModel(target) {
|
|
9918
|
+
var _targetModelTemplateI;
|
|
9919
|
+
const targetModelKey = readFirestoreModelKey(target, true);
|
|
9920
|
+
const targetFirestoreCollectionType = firestoreModelKeyCollectionType(targetModelKey);
|
|
9921
|
+
return (_targetModelTemplateI = targetModelTemplateInfoMap.get(targetFirestoreCollectionType)) != null ? _targetModelTemplateI : [];
|
|
9922
|
+
},
|
|
9923
|
+
getTemplateTypeInfosForTargetModelIdentity(identity) {
|
|
9924
|
+
var _targetModelTemplateI2;
|
|
9925
|
+
return (_targetModelTemplateI2 = targetModelTemplateInfoMap.get(identity.collectionName)) != null ? _targetModelTemplateI2 : [];
|
|
9926
|
+
}
|
|
9927
|
+
};
|
|
9928
|
+
return service;
|
|
9929
|
+
}
|
|
9930
|
+
// MARK: Compat
|
|
9931
|
+
/**
|
|
9932
|
+
* @deprecated use notificationTemplateTypeInfoRecord instead.
|
|
9933
|
+
*/
|
|
9934
|
+
const notificationTemplateTypeDetailsRecord = notificationTemplateTypeInfoRecord;
|
|
9935
|
+
|
|
9936
|
+
function _await(value, then, direct) {
|
|
9937
|
+
if (direct) {
|
|
9938
|
+
return then ? then(value) : value;
|
|
9939
|
+
}
|
|
9940
|
+
if (!value || !value.then) {
|
|
9941
|
+
value = Promise.resolve(value);
|
|
9942
|
+
}
|
|
9943
|
+
return then ? value.then(then) : value;
|
|
9944
|
+
}
|
|
9945
|
+
function _async(f) {
|
|
9946
|
+
return function () {
|
|
9947
|
+
for (var args = [], i = 0; i < arguments.length; i++) {
|
|
9948
|
+
args[i] = arguments[i];
|
|
9949
|
+
}
|
|
9950
|
+
try {
|
|
9951
|
+
return Promise.resolve(f.apply(this, args));
|
|
9952
|
+
} catch (e) {
|
|
9953
|
+
return Promise.reject(e);
|
|
9954
|
+
}
|
|
9955
|
+
};
|
|
9956
|
+
}
|
|
9957
|
+
exports.NotificationMessageFlag = void 0;
|
|
9958
|
+
(function (NotificationMessageFlag) {
|
|
9959
|
+
/**
|
|
9960
|
+
* No flag
|
|
9961
|
+
*/
|
|
9962
|
+
NotificationMessageFlag[NotificationMessageFlag["NONE"] = 0] = "NONE";
|
|
9963
|
+
/**
|
|
9964
|
+
* Special flag to indicate there is no content. Should not be sent.
|
|
9965
|
+
*/
|
|
9966
|
+
NotificationMessageFlag[NotificationMessageFlag["NO_CONTENT"] = 1] = "NO_CONTENT";
|
|
9967
|
+
/**
|
|
9968
|
+
* Special flag to not send the notification.
|
|
9969
|
+
*/
|
|
9970
|
+
NotificationMessageFlag[NotificationMessageFlag["DO_NOT_SEND"] = 2] = "DO_NOT_SEND";
|
|
9971
|
+
})(exports.NotificationMessageFlag || (exports.NotificationMessageFlag = {}));
|
|
9972
|
+
/**
|
|
9973
|
+
* Creates a NotificationMessageFunction from the input.
|
|
9974
|
+
*
|
|
9975
|
+
* @param fn
|
|
9976
|
+
* @param extras
|
|
9977
|
+
* @returns
|
|
9978
|
+
*/
|
|
9979
|
+
function notificationMessageFunction(fn, extras) {
|
|
9980
|
+
if (extras) {
|
|
9981
|
+
const fnWithExtras = fn;
|
|
9982
|
+
fnWithExtras.globalRecipients = extras.globalRecipients;
|
|
9983
|
+
return fnWithExtras;
|
|
9984
|
+
} else {
|
|
9985
|
+
return fn;
|
|
9986
|
+
}
|
|
9987
|
+
}
|
|
9988
|
+
function noContentNotificationMessageFunctionFactory() {
|
|
9989
|
+
return function (config) {
|
|
9990
|
+
// const { item } = config;
|
|
9991
|
+
return _await(_async(function (inputContext) {
|
|
9992
|
+
const result = {
|
|
9993
|
+
flag: exports.NotificationMessageFlag.NO_CONTENT,
|
|
9994
|
+
inputContext,
|
|
9995
|
+
content: {
|
|
9996
|
+
title: 'n/a'
|
|
9997
|
+
}
|
|
9998
|
+
};
|
|
9999
|
+
return result;
|
|
10000
|
+
}));
|
|
10001
|
+
};
|
|
10002
|
+
}
|
|
10003
|
+
|
|
10004
|
+
// MARK: NotificationUser
|
|
10005
|
+
/**
|
|
10006
|
+
* Query for notificationUsers that are flagged for initialization.
|
|
10007
|
+
*
|
|
10008
|
+
* @param now
|
|
10009
|
+
* @returns
|
|
10010
|
+
*/
|
|
10011
|
+
function notificationUsersFlaggedForNeedsSyncQuery() {
|
|
10012
|
+
return [where('ns', '==', true)];
|
|
10013
|
+
}
|
|
10014
|
+
// MARK: NotificationSummary
|
|
10015
|
+
/**
|
|
10016
|
+
* Query for notificationSummaries that are flagged for initialization.
|
|
10017
|
+
*
|
|
10018
|
+
* @param now
|
|
10019
|
+
* @returns
|
|
10020
|
+
*/
|
|
10021
|
+
function notificationSummariesFlaggedForNeedsInitializationQuery() {
|
|
10022
|
+
return [where('s', '==', true)];
|
|
10023
|
+
}
|
|
10024
|
+
// MARK: NotificationBox
|
|
10025
|
+
/**
|
|
10026
|
+
* Query for notificationBoxes that are flagged for initialization.
|
|
10027
|
+
*
|
|
10028
|
+
* @param now
|
|
10029
|
+
* @returns
|
|
10030
|
+
*/
|
|
10031
|
+
function notificationBoxesFlaggedForNeedsInitializationQuery() {
|
|
10032
|
+
return [where('s', '==', true)];
|
|
10033
|
+
}
|
|
10034
|
+
/**
|
|
10035
|
+
* Query for notificationBoxes that are flagged as invalid.
|
|
10036
|
+
*
|
|
10037
|
+
* @param now
|
|
10038
|
+
* @returns
|
|
10039
|
+
*/
|
|
10040
|
+
function notificationBoxesFlaggedInvalidQuery() {
|
|
10041
|
+
return [where('fi', '==', true)];
|
|
10042
|
+
}
|
|
10043
|
+
// MARK: Notifcation
|
|
10044
|
+
/**
|
|
10045
|
+
* Query for notifications that are not done and the send at time is in the past.
|
|
10046
|
+
*
|
|
10047
|
+
* @param now
|
|
10048
|
+
* @returns
|
|
10049
|
+
*/
|
|
10050
|
+
function notificationsPastSendAtTimeQuery(now = new Date()) {
|
|
10051
|
+
return [where('d', '==', false), where('sat', '<=', date.toISODateString(now))];
|
|
10052
|
+
}
|
|
10053
|
+
/**
|
|
10054
|
+
* Query for notifications that are marked ready for cleanup/deletion.
|
|
10055
|
+
*
|
|
10056
|
+
* @param now
|
|
10057
|
+
* @returns
|
|
10058
|
+
*/
|
|
10059
|
+
function notificationsReadyForCleanupQuery() {
|
|
10060
|
+
return [where('d', '==', true)
|
|
10061
|
+
// orderByDocumentId('asc') // todo: consider using orderby to get notificationboxes sorted
|
|
10062
|
+
];
|
|
10063
|
+
}
|
|
10064
|
+
|
|
10065
|
+
function mergeNotificationSendMessagesResult(a, b) {
|
|
10066
|
+
var _a$success, _b$success, _a$failed, _b$failed, _a$ignored, _b$ignored;
|
|
10067
|
+
return {
|
|
10068
|
+
success: [...((_a$success = a == null ? void 0 : a.success) != null ? _a$success : []), ...((_b$success = b == null ? void 0 : b.success) != null ? _b$success : [])],
|
|
10069
|
+
failed: [...((_a$failed = a == null ? void 0 : a.failed) != null ? _a$failed : []), ...((_b$failed = b == null ? void 0 : b.failed) != null ? _b$failed : [])],
|
|
10070
|
+
ignored: [...((_a$ignored = a == null ? void 0 : a.ignored) != null ? _a$ignored : []), ...((_b$ignored = b == null ? void 0 : b.ignored) != null ? _b$ignored : [])]
|
|
10071
|
+
};
|
|
10072
|
+
}
|
|
10073
|
+
|
|
10074
|
+
function effectiveNotificationBoxRecipientConfig(input) {
|
|
10075
|
+
var _recipient$i, _ref, _gc$f, _gc$lk, _gc$e, _gc$t;
|
|
10076
|
+
const {
|
|
10077
|
+
uid,
|
|
10078
|
+
m: inputM,
|
|
10079
|
+
appNotificationTemplateTypeInfoRecordService,
|
|
10080
|
+
gc,
|
|
10081
|
+
boxConfig: notificationUserNotificationBoxConfig,
|
|
10082
|
+
recipient
|
|
10083
|
+
} = input;
|
|
10084
|
+
const m = inputM != null ? inputM : inferKeyFromTwoWayFlatFirestoreModelKey(notificationUserNotificationBoxConfig.nb);
|
|
10085
|
+
const applicableTemplateTypesForModel = appNotificationTemplateTypeInfoRecordService.getTemplateTypesForNotificationModel(m);
|
|
10086
|
+
const filterOnlyApplicableTemplateTypes = util.filterKeysOnPOJOFunction(applicableTemplateTypesForModel);
|
|
10087
|
+
// retain only the relevant/applicable template types for the model associate with the notification box
|
|
10088
|
+
const c = filterOnlyApplicableTemplateTypes(Object.assign({}, recipient == null ? void 0 : recipient.c, notificationUserNotificationBoxConfig.c, gc.c));
|
|
10089
|
+
const nextRecipient = Object.assign({}, recipient, {
|
|
10090
|
+
c,
|
|
10091
|
+
uid,
|
|
10092
|
+
i: (_recipient$i = recipient == null ? void 0 : recipient.i) != null ? _recipient$i : notificationUserNotificationBoxConfig.i,
|
|
10093
|
+
// copy from NotificationUser
|
|
10094
|
+
f: (_ref = (_gc$f = gc.f) != null ? _gc$f : notificationUserNotificationBoxConfig.f) != null ? _ref : recipient == null ? void 0 : recipient.f,
|
|
10095
|
+
lk: (_gc$lk = gc.lk) != null ? _gc$lk : notificationUserNotificationBoxConfig.lk,
|
|
10096
|
+
// email and text overrides first come from global, then the NotificationBox specific config
|
|
10097
|
+
e: (_gc$e = gc.e) != null ? _gc$e : notificationUserNotificationBoxConfig.e,
|
|
10098
|
+
t: (_gc$t = gc.t) != null ? _gc$t : notificationUserNotificationBoxConfig.t,
|
|
10099
|
+
// no custom name or notification summary allowed
|
|
10100
|
+
n: undefined,
|
|
10101
|
+
s: undefined // should never be defined since uid is defined
|
|
10102
|
+
});
|
|
10103
|
+
|
|
10104
|
+
return nextRecipient;
|
|
10105
|
+
}
|
|
10106
|
+
// MARK: Notification
|
|
10107
|
+
/**
|
|
10108
|
+
* Returns true if the notification's send types are all marked as sent.
|
|
10109
|
+
*
|
|
10110
|
+
* @param input
|
|
10111
|
+
* @returns
|
|
10112
|
+
*/
|
|
10113
|
+
function notificationSendFlagsImplyIsComplete(input) {
|
|
10114
|
+
return isCompleteNotificationSendState(input.es) && isCompleteNotificationSendState(input.ps) && isCompleteNotificationSendState(input.ts) && isCompleteNotificationSendState(input.ns);
|
|
10115
|
+
}
|
|
10116
|
+
/**
|
|
10117
|
+
* Returns true if the state implies completion of sending (not necessarily success, but that attempts to send are done)
|
|
10118
|
+
*
|
|
10119
|
+
* @param input
|
|
10120
|
+
* @returns
|
|
10121
|
+
*/
|
|
10122
|
+
function isCompleteNotificationSendState(input) {
|
|
10123
|
+
let isComplete = false;
|
|
10124
|
+
switch (input) {
|
|
10125
|
+
case exports.NotificationSendState.NONE:
|
|
10126
|
+
case exports.NotificationSendState.NO_TRY:
|
|
10127
|
+
case exports.NotificationSendState.SENT:
|
|
10128
|
+
case exports.NotificationSendState.SKIPPED:
|
|
10129
|
+
isComplete = true;
|
|
10130
|
+
break;
|
|
10131
|
+
default:
|
|
10132
|
+
isComplete = false;
|
|
10133
|
+
break;
|
|
10134
|
+
}
|
|
10135
|
+
return isComplete;
|
|
10136
|
+
}
|
|
10137
|
+
/**
|
|
10138
|
+
* Returns a AllowedNotificationRecipients from the input NotificationRecipientSendFlag.
|
|
10139
|
+
*
|
|
10140
|
+
* @param flag
|
|
10141
|
+
* @returns
|
|
10142
|
+
*/
|
|
10143
|
+
function allowedNotificationRecipients(flag) {
|
|
10144
|
+
let canSendToGlobalRecipients = true;
|
|
10145
|
+
let canSendToBoxRecipients = true;
|
|
10146
|
+
let canSendToExplicitRecipients = true;
|
|
10147
|
+
switch (flag) {
|
|
10148
|
+
case exports.NotificationRecipientSendFlag.SKIP_NOTIFICATION_BOX_RECIPIENTS:
|
|
10149
|
+
canSendToBoxRecipients = false;
|
|
10150
|
+
break;
|
|
10151
|
+
case exports.NotificationRecipientSendFlag.SKIP_GLOBAL_RECIPIENTS:
|
|
10152
|
+
canSendToGlobalRecipients = false;
|
|
10153
|
+
break;
|
|
10154
|
+
case exports.NotificationRecipientSendFlag.ONLY_EXPLICIT_RECIPIENTS:
|
|
10155
|
+
canSendToBoxRecipients = false;
|
|
10156
|
+
canSendToGlobalRecipients = false;
|
|
10157
|
+
break;
|
|
10158
|
+
case exports.NotificationRecipientSendFlag.ONLY_GLOBAL_RECIPIENTS:
|
|
10159
|
+
canSendToBoxRecipients = false;
|
|
10160
|
+
canSendToExplicitRecipients = false;
|
|
10161
|
+
break;
|
|
10162
|
+
case exports.NotificationRecipientSendFlag.NORMAL:
|
|
10163
|
+
}
|
|
10164
|
+
return {
|
|
10165
|
+
canSendToGlobalRecipients,
|
|
10166
|
+
canSendToBoxRecipients,
|
|
10167
|
+
canSendToExplicitRecipients
|
|
10168
|
+
};
|
|
10169
|
+
}
|
|
10170
|
+
// MARK: NotificationWeek
|
|
10171
|
+
/**
|
|
10172
|
+
* Whether or not the Notification should be saved to the NotificationWeek.
|
|
10173
|
+
*
|
|
10174
|
+
* A Notification should only be saved when the notification can be sent to box recipients.
|
|
10175
|
+
*
|
|
10176
|
+
* @param notification
|
|
10177
|
+
* @returns
|
|
10178
|
+
*/
|
|
10179
|
+
function shouldSaveNotificationToNotificationWeek(notification) {
|
|
10180
|
+
return allowedNotificationRecipients(notification.rf).canSendToBoxRecipients;
|
|
10181
|
+
}
|
|
10182
|
+
// MARK: NotificationBox
|
|
10183
|
+
function mergeNotificationUserNotificationBoxRecipientConfigs(a, b) {
|
|
10184
|
+
var _b$f;
|
|
10185
|
+
return Object.assign({}, mergeNotificationBoxRecipients(a, b), {
|
|
10186
|
+
// retain the following states always
|
|
10187
|
+
f: a.f === exports.NotificationBoxRecipientFlag.OPT_OUT ? a.f : (_b$f = b.f) != null ? _b$f : a.f,
|
|
10188
|
+
nb: a.nb,
|
|
10189
|
+
rm: a.rm,
|
|
10190
|
+
ns: a.ns,
|
|
10191
|
+
lk: a.lk,
|
|
10192
|
+
bk: a.bk
|
|
10193
|
+
});
|
|
10194
|
+
}
|
|
10195
|
+
function mergeNotificationBoxRecipients(a, b) {
|
|
10196
|
+
return Object.assign({}, a, b, {
|
|
10197
|
+
// configs should be merged/ovewritten
|
|
10198
|
+
c: Object.assign({}, a.c, b.c)
|
|
10199
|
+
});
|
|
10200
|
+
}
|
|
10201
|
+
|
|
8510
10202
|
// MARK: Collection
|
|
8511
10203
|
class SystemStateFirestoreCollections {}
|
|
8512
10204
|
// MARK: Mock Item
|
|
@@ -8553,10 +10245,16 @@ function systemStateFirestoreCollection(firestoreContext, converters) {
|
|
|
8553
10245
|
exports.AbstractFirestoreDocument = AbstractFirestoreDocument;
|
|
8554
10246
|
exports.AbstractFirestoreDocumentDataAccessorWrapper = AbstractFirestoreDocumentDataAccessorWrapper;
|
|
8555
10247
|
exports.AbstractFirestoreDocumentWithParent = AbstractFirestoreDocumentWithParent;
|
|
10248
|
+
exports.AppNotificationTemplateTypeInfoRecordService = AppNotificationTemplateTypeInfoRecordService;
|
|
8556
10249
|
exports.BASE_MODEL_STORAGE_FILE_PATH = BASE_MODEL_STORAGE_FILE_PATH;
|
|
8557
10250
|
exports.CALL_MODEL_APP_FUNCTION_KEY = CALL_MODEL_APP_FUNCTION_KEY;
|
|
8558
10251
|
exports.COPY_USER_RELATED_DATA_ACCESSOR_FACTORY_FUNCTION = COPY_USER_RELATED_DATA_ACCESSOR_FACTORY_FUNCTION;
|
|
10252
|
+
exports.CREATE_NOTIFICATION_ID_REQUIRED_ERROR_CODE = CREATE_NOTIFICATION_ID_REQUIRED_ERROR_CODE;
|
|
10253
|
+
exports.CleanupSentNotificationsParams = CleanupSentNotificationsParams;
|
|
8559
10254
|
exports.ContextGrantedModelRolesReaderInstance = ContextGrantedModelRolesReaderInstance;
|
|
10255
|
+
exports.CreateNotificationBoxParams = CreateNotificationBoxParams;
|
|
10256
|
+
exports.CreateNotificationSummaryParams = CreateNotificationSummaryParams;
|
|
10257
|
+
exports.CreateNotificationUserParams = CreateNotificationUserParams;
|
|
8560
10258
|
exports.DEFAULT_DATE_CELL_RANGE_VALUE = DEFAULT_DATE_CELL_RANGE_VALUE;
|
|
8561
10259
|
exports.DEFAULT_FIRESTORE_DATE_CELL_SCHEDULE_VALUE = DEFAULT_FIRESTORE_DATE_CELL_SCHEDULE_VALUE;
|
|
8562
10260
|
exports.DEFAULT_FIRESTORE_ITEM_PAGE_ITERATOR_ITEMS_PER_PAGE = DEFAULT_FIRESTORE_ITEM_PAGE_ITERATOR_ITEMS_PER_PAGE;
|
|
@@ -8564,6 +10262,7 @@ exports.DEFAULT_FIRESTORE_STRING_FIELD_VALUE = DEFAULT_FIRESTORE_STRING_FIELD_VA
|
|
|
8564
10262
|
exports.DEFAULT_FIRESTORE_UNITED_STATES_ADDRESS_VALUE = DEFAULT_FIRESTORE_UNITED_STATES_ADDRESS_VALUE;
|
|
8565
10263
|
exports.DEFAULT_FIRESTORE_WEBSITE_FILE_LINK_VALUE = DEFAULT_FIRESTORE_WEBSITE_FILE_LINK_VALUE;
|
|
8566
10264
|
exports.DEFAULT_ITERATE_FIRESTORE_DOCUMENT_SNAPSHOT_BATCHES_BATCH_SIZE = DEFAULT_ITERATE_FIRESTORE_DOCUMENT_SNAPSHOT_BATCHES_BATCH_SIZE;
|
|
10265
|
+
exports.DEFAULT_NOTIFICATION_TEMPLATE_TYPE = DEFAULT_NOTIFICATION_TEMPLATE_TYPE;
|
|
8567
10266
|
exports.DEFAULT_QUERY_CHANGE_WATCHER_DELAY = DEFAULT_QUERY_CHANGE_WATCHER_DELAY;
|
|
8568
10267
|
exports.DEFAULT_SINGLE_ITEM_FIRESTORE_COLLECTION_DOCUMENT_IDENTIFIER = DEFAULT_SINGLE_ITEM_FIRESTORE_COLLECTION_DOCUMENT_IDENTIFIER;
|
|
8569
10268
|
exports.DEFAULT_WEBSITE_LINK = DEFAULT_WEBSITE_LINK;
|
|
@@ -8597,6 +10296,7 @@ exports.FIRESTORE_OFFSET_QUERY_CONSTRAINT_TYPE = FIRESTORE_OFFSET_QUERY_CONSTRAI
|
|
|
8597
10296
|
exports.FIRESTORE_ORDER_BY_DOCUMENT_ID_QUERY_CONSTRAINT_TYPE = FIRESTORE_ORDER_BY_DOCUMENT_ID_QUERY_CONSTRAINT_TYPE;
|
|
8598
10297
|
exports.FIRESTORE_ORDER_BY_QUERY_CONSTRAINT_TYPE = FIRESTORE_ORDER_BY_QUERY_CONSTRAINT_TYPE;
|
|
8599
10298
|
exports.FIRESTORE_PASSTHROUGH_FIELD = FIRESTORE_PASSTHROUGH_FIELD;
|
|
10299
|
+
exports.FIRESTORE_PERMISSION_DENIED_ERROR_CODE = FIRESTORE_PERMISSION_DENIED_ERROR_CODE;
|
|
8600
10300
|
exports.FIRESTORE_START_AFTER_QUERY_CONSTRAINT_TYPE = FIRESTORE_START_AFTER_QUERY_CONSTRAINT_TYPE;
|
|
8601
10301
|
exports.FIRESTORE_START_AT_QUERY_CONSTRAINT_TYPE = FIRESTORE_START_AT_QUERY_CONSTRAINT_TYPE;
|
|
8602
10302
|
exports.FIRESTORE_START_AT_VALUE_QUERY_CONSTRAINT_TYPE = FIRESTORE_START_AT_VALUE_QUERY_CONSTRAINT_TYPE;
|
|
@@ -8607,6 +10307,9 @@ exports.FirebaseModelPermissionServiceInstance = FirebaseModelPermissionServiceI
|
|
|
8607
10307
|
exports.FirebaseServerError = FirebaseServerError;
|
|
8608
10308
|
exports.InferredTargetModelIdParams = InferredTargetModelIdParams;
|
|
8609
10309
|
exports.InferredTargetModelParams = InferredTargetModelParams;
|
|
10310
|
+
exports.InitializeAllApplicableNotificationBoxesParams = InitializeAllApplicableNotificationBoxesParams;
|
|
10311
|
+
exports.InitializeAllApplicableNotificationSummariesParams = InitializeAllApplicableNotificationSummariesParams;
|
|
10312
|
+
exports.InitializeNotificationModelParams = InitializeNotificationModelParams;
|
|
8610
10313
|
exports.IsFirestoreModelId = IsFirestoreModelId;
|
|
8611
10314
|
exports.IsFirestoreModelIdOrKey = IsFirestoreModelIdOrKey;
|
|
8612
10315
|
exports.IsFirestoreModelKey = IsFirestoreModelKey;
|
|
@@ -8616,20 +10319,58 @@ exports.MODEL_FUNCTION_FIREBASE_CRUD_FUNCTION_SPECIFIER_DEFAULT = MODEL_FUNCTION
|
|
|
8616
10319
|
exports.MODEL_FUNCTION_FIREBASE_CRUD_FUNCTION_SPECIFIER_SPLITTER = MODEL_FUNCTION_FIREBASE_CRUD_FUNCTION_SPECIFIER_SPLITTER;
|
|
8617
10320
|
exports.MODEL_STORAGE_FILE_SLASH_PATH_FACTORY = MODEL_STORAGE_FILE_SLASH_PATH_FACTORY;
|
|
8618
10321
|
exports.ModifyBeforeSetFirestoreDocumentDataAccessorWrapper = ModifyBeforeSetFirestoreDocumentDataAccessorWrapper;
|
|
10322
|
+
exports.NOTIFICATION_BOX_EXISTS_FOR_MODEL_ERROR_CODE = NOTIFICATION_BOX_EXISTS_FOR_MODEL_ERROR_CODE;
|
|
10323
|
+
exports.NOTIFICATION_BOX_RECIPIENT_DOES_NOT_EXIST_ERROR_CODE = NOTIFICATION_BOX_RECIPIENT_DOES_NOT_EXIST_ERROR_CODE;
|
|
10324
|
+
exports.NOTIFICATION_MESSAGE_MAX_LENGTH = NOTIFICATION_MESSAGE_MAX_LENGTH;
|
|
10325
|
+
exports.NOTIFICATION_MESSAGE_MIN_LENGTH = NOTIFICATION_MESSAGE_MIN_LENGTH;
|
|
10326
|
+
exports.NOTIFICATION_MODEL_ALREADY_INITIALIZED_ERROR_CODE = NOTIFICATION_MODEL_ALREADY_INITIALIZED_ERROR_CODE;
|
|
10327
|
+
exports.NOTIFICATION_RECIPIENT_NAME_MAX_LENGTH = NOTIFICATION_RECIPIENT_NAME_MAX_LENGTH;
|
|
10328
|
+
exports.NOTIFICATION_RECIPIENT_NAME_MIN_LENGTH = NOTIFICATION_RECIPIENT_NAME_MIN_LENGTH;
|
|
10329
|
+
exports.NOTIFICATION_SUBJECT_MAX_LENGTH = NOTIFICATION_SUBJECT_MAX_LENGTH;
|
|
10330
|
+
exports.NOTIFICATION_SUBJECT_MIN_LENGTH = NOTIFICATION_SUBJECT_MIN_LENGTH;
|
|
10331
|
+
exports.NOTIFICATION_SUMMARY_EMBEDDED_NOTIFICATION_ITEM_MESSAGE_MAX_LENGTH = NOTIFICATION_SUMMARY_EMBEDDED_NOTIFICATION_ITEM_MESSAGE_MAX_LENGTH;
|
|
10332
|
+
exports.NOTIFICATION_SUMMARY_EMBEDDED_NOTIFICATION_ITEM_SUBJECT_MAX_LENGTH = NOTIFICATION_SUMMARY_EMBEDDED_NOTIFICATION_ITEM_SUBJECT_MAX_LENGTH;
|
|
10333
|
+
exports.NOTIFICATION_SUMMARY_ITEM_LIMIT = NOTIFICATION_SUMMARY_ITEM_LIMIT;
|
|
10334
|
+
exports.NOTIFICATION_USER_BLOCKED_FROM_BEING_ADD_TO_RECIPIENTS_ERROR_CODE = NOTIFICATION_USER_BLOCKED_FROM_BEING_ADD_TO_RECIPIENTS_ERROR_CODE;
|
|
10335
|
+
exports.NOTIFICATION_USER_INVALID_UID_FOR_CREATE_ERROR_CODE = NOTIFICATION_USER_INVALID_UID_FOR_CREATE_ERROR_CODE;
|
|
10336
|
+
exports.NOTIFICATION_USER_LOCKED_CONFIG_FROM_BEING_UPDATED_ERROR_CODE = NOTIFICATION_USER_LOCKED_CONFIG_FROM_BEING_UPDATED_ERROR_CODE;
|
|
10337
|
+
exports.NOTIFICATION_WEEK_NOTIFICATION_ITEM_LIMIT = NOTIFICATION_WEEK_NOTIFICATION_ITEM_LIMIT;
|
|
10338
|
+
exports.NotificationBoxDocument = NotificationBoxDocument;
|
|
10339
|
+
exports.NotificationBoxRecipientTemplateConfigArrayEntryParam = NotificationBoxRecipientTemplateConfigArrayEntryParam;
|
|
10340
|
+
exports.NotificationDocument = NotificationDocument;
|
|
10341
|
+
exports.NotificationFirestoreCollections = NotificationFirestoreCollections;
|
|
10342
|
+
exports.NotificationFunctions = NotificationFunctions;
|
|
10343
|
+
exports.NotificationRecipientParams = NotificationRecipientParams;
|
|
10344
|
+
exports.NotificationSummaryDocument = NotificationSummaryDocument;
|
|
10345
|
+
exports.NotificationUserDocument = NotificationUserDocument;
|
|
10346
|
+
exports.NotificationWeekDocument = NotificationWeekDocument;
|
|
8619
10347
|
exports.RUN_DEV_FUNCTION_APP_FUNCTION_KEY = RUN_DEV_FUNCTION_APP_FUNCTION_KEY;
|
|
10348
|
+
exports.ResyncAllNotificationUserParams = ResyncAllNotificationUserParams;
|
|
10349
|
+
exports.ResyncNotificationUserParams = ResyncNotificationUserParams;
|
|
8620
10350
|
exports.SCHEDULED_FUNCTION_DEV_FUNCTION_SPECIFIER = SCHEDULED_FUNCTION_DEV_FUNCTION_SPECIFIER;
|
|
8621
10351
|
exports.ScheduledFunctionDevelopmentFirebaseFunctionListEntry = ScheduledFunctionDevelopmentFirebaseFunctionListEntry;
|
|
8622
10352
|
exports.ScheduledFunctionDevelopmentFirebaseFunctionParams = ScheduledFunctionDevelopmentFirebaseFunctionParams;
|
|
10353
|
+
exports.SendNotificationParams = SendNotificationParams;
|
|
10354
|
+
exports.SendQueuedNotificationsParams = SendQueuedNotificationsParams;
|
|
8623
10355
|
exports.SystemStateDocument = SystemStateDocument;
|
|
8624
10356
|
exports.SystemStateFirestoreCollections = SystemStateFirestoreCollections;
|
|
8625
10357
|
exports.TargetModelIdParams = TargetModelIdParams;
|
|
8626
10358
|
exports.TargetModelParams = TargetModelParams;
|
|
10359
|
+
exports.UpdateNotificationBoxParams = UpdateNotificationBoxParams;
|
|
10360
|
+
exports.UpdateNotificationBoxRecipientLikeParams = UpdateNotificationBoxRecipientLikeParams;
|
|
10361
|
+
exports.UpdateNotificationBoxRecipientParams = UpdateNotificationBoxRecipientParams;
|
|
10362
|
+
exports.UpdateNotificationSummaryParams = UpdateNotificationSummaryParams;
|
|
10363
|
+
exports.UpdateNotificationUserDefaultNotificationBoxRecipientConfigParams = UpdateNotificationUserDefaultNotificationBoxRecipientConfigParams;
|
|
10364
|
+
exports.UpdateNotificationUserNotificationBoxRecipientParams = UpdateNotificationUserNotificationBoxRecipientParams;
|
|
10365
|
+
exports.UpdateNotificationUserParams = UpdateNotificationUserParams;
|
|
8627
10366
|
exports.addConstraintToBuilder = addConstraintToBuilder;
|
|
8628
10367
|
exports.addOrReplaceLimitInConstraints = addOrReplaceLimitInConstraints;
|
|
8629
10368
|
exports.allChildDocumentsUnderParent = allChildDocumentsUnderParent;
|
|
8630
10369
|
exports.allChildDocumentsUnderParentPath = allChildDocumentsUnderParentPath;
|
|
8631
10370
|
exports.allChildDocumentsUnderRelativePath = allChildDocumentsUnderRelativePath;
|
|
8632
10371
|
exports.allowDocumentSnapshotWithPathOnceFilter = allowDocumentSnapshotWithPathOnceFilter;
|
|
10372
|
+
exports.allowedNotificationRecipients = allowedNotificationRecipients;
|
|
10373
|
+
exports.appNotificationTemplateTypeInfoRecordService = appNotificationTemplateTypeInfoRecordService;
|
|
8633
10374
|
exports.asTopLevelFieldPath = asTopLevelFieldPath;
|
|
8634
10375
|
exports.asTopLevelFieldPaths = asTopLevelFieldPaths;
|
|
8635
10376
|
exports.assertFirestoreUpdateHasData = assertFirestoreUpdateHasData;
|
|
@@ -8654,6 +10395,10 @@ exports.copyDocumentIdForUserRelatedModifierFunction = copyDocumentIdForUserRela
|
|
|
8654
10395
|
exports.copyDocumentIdToFieldModifierFunction = copyDocumentIdToFieldModifierFunction;
|
|
8655
10396
|
exports.copyUserRelatedDataAccessorFactoryFunction = copyUserRelatedDataAccessorFactoryFunction;
|
|
8656
10397
|
exports.copyUserRelatedDataModifierConfig = copyUserRelatedDataModifierConfig;
|
|
10398
|
+
exports.createNotificationDocument = createNotificationDocument;
|
|
10399
|
+
exports.createNotificationDocumentIfSending = createNotificationDocumentIfSending;
|
|
10400
|
+
exports.createNotificationDocumentPair = createNotificationDocumentPair;
|
|
10401
|
+
exports.createNotificationTemplate = createNotificationTemplate;
|
|
8657
10402
|
exports.dataFromDocumentSnapshots = dataFromDocumentSnapshots;
|
|
8658
10403
|
exports.dataFromSnapshotStream = dataFromSnapshotStream;
|
|
8659
10404
|
exports.developmentFirebaseFunctionMapFactory = developmentFirebaseFunctionMapFactory;
|
|
@@ -8664,6 +10409,8 @@ exports.documentDataWithIdAndKey = documentDataWithIdAndKey;
|
|
|
8664
10409
|
exports.documentReferenceFromDocument = documentReferenceFromDocument;
|
|
8665
10410
|
exports.documentReferencesFromDocuments = documentReferencesFromDocuments;
|
|
8666
10411
|
exports.documentReferencesFromSnapshot = documentReferencesFromSnapshot;
|
|
10412
|
+
exports.effectiveNotificationBoxRecipientConfig = effectiveNotificationBoxRecipientConfig;
|
|
10413
|
+
exports.effectiveNotificationBoxRecipientTemplateConfig = effectiveNotificationBoxRecipientTemplateConfig;
|
|
8667
10414
|
exports.endAt = endAt;
|
|
8668
10415
|
exports.endAtValue = endAtValue;
|
|
8669
10416
|
exports.endBefore = endBefore;
|
|
@@ -8767,6 +10514,12 @@ exports.firestoreModelKeyTypePair = firestoreModelKeyTypePair;
|
|
|
8767
10514
|
exports.firestoreModelKeys = firestoreModelKeys;
|
|
8768
10515
|
exports.firestoreModelKeysFromDocuments = firestoreModelKeysFromDocuments;
|
|
8769
10516
|
exports.firestoreModelType = firestoreModelType;
|
|
10517
|
+
exports.firestoreNotificationBoxRecipient = firestoreNotificationBoxRecipient;
|
|
10518
|
+
exports.firestoreNotificationBoxRecipientTemplateConfigRecord = firestoreNotificationBoxRecipientTemplateConfigRecord;
|
|
10519
|
+
exports.firestoreNotificationItem = firestoreNotificationItem;
|
|
10520
|
+
exports.firestoreNotificationRecipientWithConfig = firestoreNotificationRecipientWithConfig;
|
|
10521
|
+
exports.firestoreNotificationUserDefaultNotificationBoxRecipientConfig = firestoreNotificationUserDefaultNotificationBoxRecipientConfig;
|
|
10522
|
+
exports.firestoreNotificationUserNotificationBoxRecipientConfig = firestoreNotificationUserNotificationBoxRecipientConfig;
|
|
8770
10523
|
exports.firestoreNumber = firestoreNumber;
|
|
8771
10524
|
exports.firestoreObjectArray = firestoreObjectArray;
|
|
8772
10525
|
exports.firestorePassThroughField = firestorePassThroughField;
|
|
@@ -8798,6 +10551,7 @@ exports.getDataFromDocumentSnapshots = getDataFromDocumentSnapshots;
|
|
|
8798
10551
|
exports.getDocumentSnapshotData = getDocumentSnapshotData;
|
|
8799
10552
|
exports.getDocumentSnapshotDataPair = getDocumentSnapshotDataPair;
|
|
8800
10553
|
exports.getDocumentSnapshotDataPairs = getDocumentSnapshotDataPairs;
|
|
10554
|
+
exports.getDocumentSnapshotDataPairsWithData = getDocumentSnapshotDataPairsWithData;
|
|
8801
10555
|
exports.getDocumentSnapshotDataTuples = getDocumentSnapshotDataTuples;
|
|
8802
10556
|
exports.getDocumentSnapshotPair = getDocumentSnapshotPair;
|
|
8803
10557
|
exports.getDocumentSnapshotPairs = getDocumentSnapshotPairs;
|
|
@@ -8816,8 +10570,11 @@ exports.inContextFirebaseModelServiceFactory = inContextFirebaseModelServiceFact
|
|
|
8816
10570
|
exports.inContextFirebaseModelsServiceFactory = inContextFirebaseModelsServiceFactory;
|
|
8817
10571
|
exports.incrementUpdateWithAccessorFunction = incrementUpdateWithAccessorFunction;
|
|
8818
10572
|
exports.inferKeyFromTwoWayFlatFirestoreModelKey = inferKeyFromTwoWayFlatFirestoreModelKey;
|
|
10573
|
+
exports.inferNotificationBoxRelatedModelKey = inferNotificationBoxRelatedModelKey;
|
|
8819
10574
|
exports.interceptAccessorFactoryFunction = interceptAccessorFactoryFunction;
|
|
8820
10575
|
exports.isAdminInFirebaseModelContext = isAdminInFirebaseModelContext;
|
|
10576
|
+
exports.isClientFirebaseError = isClientFirebaseError;
|
|
10577
|
+
exports.isCompleteNotificationSendState = isCompleteNotificationSendState;
|
|
8821
10578
|
exports.isFirebaseStorageObjectNotFoundError = isFirebaseStorageObjectNotFoundError;
|
|
8822
10579
|
exports.isFirestoreModelId = isFirestoreModelId;
|
|
8823
10580
|
exports.isFirestoreModelIdOrKey = isFirestoreModelIdOrKey;
|
|
@@ -8856,10 +10613,60 @@ exports.makeRootSingleItemFirestoreCollection = makeRootSingleItemFirestoreColle
|
|
|
8856
10613
|
exports.makeSingleItemFirestoreCollection = makeSingleItemFirestoreCollection;
|
|
8857
10614
|
exports.mapDataFromSnapshot = mapDataFromSnapshot;
|
|
8858
10615
|
exports.mapHttpsCallable = mapHttpsCallable;
|
|
10616
|
+
exports.mergeNotificationBoxRecipientTemplateConfigRecords = mergeNotificationBoxRecipientTemplateConfigRecords;
|
|
10617
|
+
exports.mergeNotificationBoxRecipientTemplateConfigs = mergeNotificationBoxRecipientTemplateConfigs;
|
|
10618
|
+
exports.mergeNotificationBoxRecipients = mergeNotificationBoxRecipients;
|
|
10619
|
+
exports.mergeNotificationSendMessagesResult = mergeNotificationSendMessagesResult;
|
|
10620
|
+
exports.mergeNotificationUserDefaultNotificationBoxRecipientConfig = mergeNotificationUserDefaultNotificationBoxRecipientConfig;
|
|
10621
|
+
exports.mergeNotificationUserNotificationBoxRecipientConfigs = mergeNotificationUserNotificationBoxRecipientConfigs;
|
|
8859
10622
|
exports.modelStorageSlashPathFactory = modelStorageSlashPathFactory;
|
|
8860
10623
|
exports.modifyBeforeSetInterceptAccessorFactoryFunction = modifyBeforeSetInterceptAccessorFactoryFunction;
|
|
8861
10624
|
exports.newDocuments = newDocuments;
|
|
10625
|
+
exports.newNotificationBoxRecipientForUid = newNotificationBoxRecipientForUid;
|
|
10626
|
+
exports.noContentNotificationMessageFunctionFactory = noContentNotificationMessageFunctionFactory;
|
|
8862
10627
|
exports.noStringFormatInStorageUploadOptionsError = noStringFormatInStorageUploadOptionsError;
|
|
10628
|
+
exports.notificationBoxCollectionReference = notificationBoxCollectionReference;
|
|
10629
|
+
exports.notificationBoxConverter = notificationBoxConverter;
|
|
10630
|
+
exports.notificationBoxFirestoreCollection = notificationBoxFirestoreCollection;
|
|
10631
|
+
exports.notificationBoxIdForModel = notificationBoxIdForModel;
|
|
10632
|
+
exports.notificationBoxIdentity = notificationBoxIdentity;
|
|
10633
|
+
exports.notificationBoxModelCrudFunctionsConfig = notificationBoxModelCrudFunctionsConfig;
|
|
10634
|
+
exports.notificationBoxRecipientTemplateConfigArrayToRecord = notificationBoxRecipientTemplateConfigArrayToRecord;
|
|
10635
|
+
exports.notificationBoxRecipientTemplateConfigRecordToArray = notificationBoxRecipientTemplateConfigRecordToArray;
|
|
10636
|
+
exports.notificationBoxesFlaggedForNeedsInitializationQuery = notificationBoxesFlaggedForNeedsInitializationQuery;
|
|
10637
|
+
exports.notificationBoxesFlaggedInvalidQuery = notificationBoxesFlaggedInvalidQuery;
|
|
10638
|
+
exports.notificationCollectionReference = notificationCollectionReference;
|
|
10639
|
+
exports.notificationCollectionReferenceFactory = notificationCollectionReferenceFactory;
|
|
10640
|
+
exports.notificationConverter = notificationConverter;
|
|
10641
|
+
exports.notificationFirestoreCollectionFactory = notificationFirestoreCollectionFactory;
|
|
10642
|
+
exports.notificationFirestoreCollectionGroup = notificationFirestoreCollectionGroup;
|
|
10643
|
+
exports.notificationFunctionMap = notificationFunctionMap;
|
|
10644
|
+
exports.notificationFunctionTypeConfigMap = notificationFunctionTypeConfigMap;
|
|
10645
|
+
exports.notificationIdentity = notificationIdentity;
|
|
10646
|
+
exports.notificationMessageFunction = notificationMessageFunction;
|
|
10647
|
+
exports.notificationSendFlagsImplyIsComplete = notificationSendFlagsImplyIsComplete;
|
|
10648
|
+
exports.notificationSummariesFlaggedForNeedsInitializationQuery = notificationSummariesFlaggedForNeedsInitializationQuery;
|
|
10649
|
+
exports.notificationSummaryCollectionReference = notificationSummaryCollectionReference;
|
|
10650
|
+
exports.notificationSummaryConverter = notificationSummaryConverter;
|
|
10651
|
+
exports.notificationSummaryFirestoreCollection = notificationSummaryFirestoreCollection;
|
|
10652
|
+
exports.notificationSummaryIdForModel = notificationSummaryIdForModel;
|
|
10653
|
+
exports.notificationSummaryIdForUidFunctionForRootFirestoreModelIdentity = notificationSummaryIdForUidFunctionForRootFirestoreModelIdentity;
|
|
10654
|
+
exports.notificationSummaryIdentity = notificationSummaryIdentity;
|
|
10655
|
+
exports.notificationTemplateTypeDetailsRecord = notificationTemplateTypeDetailsRecord;
|
|
10656
|
+
exports.notificationTemplateTypeInfoRecord = notificationTemplateTypeInfoRecord;
|
|
10657
|
+
exports.notificationUserCollectionReference = notificationUserCollectionReference;
|
|
10658
|
+
exports.notificationUserConverter = notificationUserConverter;
|
|
10659
|
+
exports.notificationUserFirestoreCollection = notificationUserFirestoreCollection;
|
|
10660
|
+
exports.notificationUserIdentity = notificationUserIdentity;
|
|
10661
|
+
exports.notificationUsersFlaggedForNeedsSyncQuery = notificationUsersFlaggedForNeedsSyncQuery;
|
|
10662
|
+
exports.notificationWeekCollectionReference = notificationWeekCollectionReference;
|
|
10663
|
+
exports.notificationWeekCollectionReferenceFactory = notificationWeekCollectionReferenceFactory;
|
|
10664
|
+
exports.notificationWeekConverter = notificationWeekConverter;
|
|
10665
|
+
exports.notificationWeekFirestoreCollectionFactory = notificationWeekFirestoreCollectionFactory;
|
|
10666
|
+
exports.notificationWeekFirestoreCollectionGroup = notificationWeekFirestoreCollectionGroup;
|
|
10667
|
+
exports.notificationWeekIdentity = notificationWeekIdentity;
|
|
10668
|
+
exports.notificationsPastSendAtTimeQuery = notificationsPastSendAtTimeQuery;
|
|
10669
|
+
exports.notificationsReadyForCleanupQuery = notificationsReadyForCleanupQuery;
|
|
8863
10670
|
exports.offset = offset;
|
|
8864
10671
|
exports.onCallCreateModelParams = onCallCreateModelParams;
|
|
8865
10672
|
exports.onCallCreateModelResult = onCallCreateModelResult;
|
|
@@ -8888,9 +10695,12 @@ exports.selectFromFirebaseModelsService = selectFromFirebaseModelsService;
|
|
|
8888
10695
|
exports.separateConstraints = separateConstraints;
|
|
8889
10696
|
exports.setIdAndKeyFromKeyIdRefOnDocumentData = setIdAndKeyFromKeyIdRefOnDocumentData;
|
|
8890
10697
|
exports.setIdAndKeyFromSnapshotOnDocumentData = setIdAndKeyFromSnapshotOnDocumentData;
|
|
10698
|
+
exports.shouldSaveNotificationToNotificationWeek = shouldSaveNotificationToNotificationWeek;
|
|
10699
|
+
exports.shouldSendCreatedNotificationInput = shouldSendCreatedNotificationInput;
|
|
8891
10700
|
exports.snapshotConverterFunctions = snapshotConverterFunctions;
|
|
8892
10701
|
exports.snapshotStreamDataForAccessor = snapshotStreamDataForAccessor;
|
|
8893
10702
|
exports.snapshotStreamForAccessor = snapshotStreamForAccessor;
|
|
10703
|
+
exports.sortNotificationItemsFunction = sortNotificationItemsFunction;
|
|
8894
10704
|
exports.startAfter = startAfter;
|
|
8895
10705
|
exports.startAt = startAt;
|
|
8896
10706
|
exports.startAtValue = startAtValue;
|
|
@@ -8903,7 +10713,13 @@ exports.systemStateConverter = systemStateConverter;
|
|
|
8903
10713
|
exports.systemStateFirestoreCollection = systemStateFirestoreCollection;
|
|
8904
10714
|
exports.systemStateIdentity = systemStateIdentity;
|
|
8905
10715
|
exports.twoWayFlatFirestoreModelKey = twoWayFlatFirestoreModelKey;
|
|
10716
|
+
exports.unreadNotificationItems = unreadNotificationItems;
|
|
8906
10717
|
exports.unsupportedFirestoreDriverFunctionError = unsupportedFirestoreDriverFunctionError;
|
|
10718
|
+
exports.updateNotificationBoxRecipientTemplateConfigRecord = updateNotificationBoxRecipientTemplateConfigRecord;
|
|
10719
|
+
exports.updateNotificationRecipient = updateNotificationRecipient;
|
|
10720
|
+
exports.updateNotificationUserDefaultNotificationBoxRecipientConfig = updateNotificationUserDefaultNotificationBoxRecipientConfig;
|
|
10721
|
+
exports.updateNotificationUserNotificationBoxRecipientConfigIfChanged = updateNotificationUserNotificationBoxRecipientConfigIfChanged;
|
|
10722
|
+
exports.updateNotificationUserNotificationBoxRecipientConfigs = updateNotificationUserNotificationBoxRecipientConfigs;
|
|
8907
10723
|
exports.updateWithAccessorUpdateAndConverterFunction = updateWithAccessorUpdateAndConverterFunction;
|
|
8908
10724
|
exports.useContextAuth = useContextAuth;
|
|
8909
10725
|
exports.useContextAuthUid = useContextAuthUid;
|