@dereekb/firebase 11.0.21 → 11.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (28) hide show
  1. package/index.cjs.js +1881 -93
  2. package/index.esm.js +2042 -37
  3. package/package.json +3 -2
  4. package/src/lib/client/error/error.d.ts +8 -0
  5. package/src/lib/client/error/index.d.ts +1 -0
  6. package/src/lib/client/firestore/error.d.ts +1 -0
  7. package/src/lib/client/firestore/index.d.ts +1 -0
  8. package/src/lib/client/index.d.ts +1 -0
  9. package/src/lib/common/firestore/accessor/document.utility.d.ts +4 -0
  10. package/src/lib/common/firestore/collection/collection.d.ts +6 -1
  11. package/src/lib/model/index.d.ts +1 -0
  12. package/src/lib/model/notification/index.d.ts +14 -0
  13. package/src/lib/model/notification/notification.action.d.ts +24 -0
  14. package/src/lib/model/notification/notification.api.d.ts +389 -0
  15. package/src/lib/model/notification/notification.api.error.d.ts +7 -0
  16. package/src/lib/model/notification/notification.api.util.d.ts +31 -0
  17. package/src/lib/model/notification/notification.config.d.ts +207 -0
  18. package/src/lib/model/notification/notification.create.d.ts +139 -0
  19. package/src/lib/model/notification/notification.d.ts +403 -0
  20. package/src/lib/model/notification/notification.details.d.ts +98 -0
  21. package/src/lib/model/notification/notification.id.d.ts +49 -0
  22. package/src/lib/model/notification/notification.item.d.ts +70 -0
  23. package/src/lib/model/notification/notification.message.d.ts +152 -0
  24. package/src/lib/model/notification/notification.query.d.ts +43 -0
  25. package/src/lib/model/notification/notification.send.d.ts +22 -0
  26. package/src/lib/model/notification/notification.util.d.ts +51 -0
  27. package/test/CHANGELOG.md +4 -0
  28. package/test/package.json +1 -1
package/index.esm.js CHANGED
@@ -1,13 +1,24 @@
1
1
  import { increment, onSnapshot, getDoc, deleteDoc, setDoc, updateDoc, doc, collectionGroup, collection, runTransaction, writeBatch, limit as limit$1, limitToLast as limitToLast$1, orderBy as orderBy$1, documentId, where as where$1, startAt as startAt$1, startAfter as startAfter$1, endAt as endAt$1, endBefore as endBefore$1, getCountFromServer, getDocs, query } from 'firebase/firestore';
2
- import { cachedGetter, mergeModifiers, asArray, filterUndefinedValues, objectHasNoKeys, filterFalsyAndEmptyValues, build, wrapUseAsyncFunction, makeWithFactory, performMakeLoop, runAsyncTasksForValues, filterMaybeValues, useAsync, toModelFieldConversions, makeModelMapFunctions, modifyModelMapFunctions, assignValuesToPOJOFunction, KeyValueTypleValueFilter, asObjectCopyFactory, passThrough, isEqualToValueDecisionFunction, transformStringFunctionConfig, transformStringFunction, isDate, transformNumberFunction, sortValuesFunctionOrMapIdentityWithSortRef, unique, isMapIdentityFunction, chainMapSameFunctions, filterUniqueFunction, filterUniqueTransform, filterFromPOJOFunction, mapObjectMapFunction, copyObject, mapObjectMap, filterEmptyValues, modelFieldMapFunctions, toModelMapFunctions, latLngStringFunction, DEFAULT_LAT_LNG_STRING_VALUE, sortAscendingIndexNumberRefFunction, bitwiseSetDencoder, MAP_IDENTITY, filterNullAndUndefinedValues, convertToArray, pushItemOrArrayItemsIntoArray, separateValues, UTF_8_START_CHARACTER, UTF_PRIVATE_USAGE_AREA_START, mergeArraysIntoArray, lastValue, flattenArrayOrValueArray, performAsyncTasks, batch, allowValueOnceFilter, asGetter, getValueFromGetter, mapIdentityFunction, performTasksFromFactoryInParallelFunction, flattenArray, groupValues, forEachInIterable, stringContains, arrayToObject, takeFront, isOddNumber, objectToMap, ServerErrorResponse, toReadableError, capitalizeFirstLetter, lowercaseFirstLetter, toRelativeSlashPathStartType, mappedUseFunction, iterableToArray, setContainsAllValues, usePromise, slashPathFactory, errorMessageContainsString } from '@dereekb/util';
2
+ import { cachedGetter, mergeModifiers, asArray, filterUndefinedValues, objectHasNoKeys, filterFalsyAndEmptyValues, build, wrapUseAsyncFunction, makeWithFactory, performMakeLoop, runAsyncTasksForValues, filterMaybeArrayValues, useAsync, toModelFieldConversions, makeModelMapFunctions, modifyModelMapFunctions, assignValuesToPOJOFunction, KeyValueTypleValueFilter, asObjectCopyFactory, passThrough, isEqualToValueDecisionFunction, transformStringFunctionConfig, transformStringFunction, isDate, transformNumberFunction, sortValuesFunctionOrMapIdentityWithSortRef, unique, isMapIdentityFunction, chainMapSameFunctions, filterUniqueFunction, filterUniqueTransform, filterFromPOJOFunction, mapObjectMapFunction, copyObject, mapObjectMap, filterEmptyArrayValues, modelFieldMapFunctions, toModelMapFunctions, latLngStringFunction, DEFAULT_LAT_LNG_STRING_VALUE, sortAscendingIndexNumberRefFunction, bitwiseSetDencoder, MAP_IDENTITY, filterNullAndUndefinedValues, convertToArray, pushItemOrArrayItemsIntoArray, separateValues, UTF_8_START_CHARACTER, UTF_PRIVATE_USAGE_AREA_START, mergeArraysIntoArray, lastValue, flattenArrayOrValueArray, performAsyncTasks, batch, allowValueOnceFilter, asGetter, getValueFromGetter, mapIdentityFunction, performTasksFromFactoryInParallelFunction, flattenArray, groupValues, forEachInIterable, stringContains, arrayToObject, takeFront, isOddNumber, objectToMap, ServerErrorResponse, toReadableError, capitalizeFirstLetter, lowercaseFirstLetter, toRelativeSlashPathStartType, mappedUseFunction, iterableToArray, setContainsAllValues, usePromise, slashPathFactory, errorMessageContainsString, bitwiseObjectDencoder, updateMaybeValue, mergeObjects, mergeObjectsFunction, UNSET_INDEX_NUMBER, forEachKeyValue, ModelRelationUtility, filterKeysOnPOJOFunction, areEqualPOJOValuesUsingPojoFilter, filterOnlyUndefinedValues, makeModelMap, MS_IN_HOUR, multiValueMapBuilder } from '@dereekb/util';
3
3
  import { filterMaybe, lazyFrom, itemAccumulator, ItemPageIterator, mappedPageItemIteration } from '@dereekb/rxjs';
4
4
  import { from, map, combineLatest, shareReplay, of, exhaustMap, Observable, switchMap, timer, skip } from 'rxjs';
5
- import { UNKNOWN_WEBSITE_LINK_TYPE, decodeWebsiteLinkEncodedDataToWebsiteFileLink, encodeWebsiteFileLinkToWebsiteLinkEncodedData, AbstractModelPermissionService, grantedRoleMapReader, noAccessRoleMap, fullAccessRoleMap } from '@dereekb/model';
6
- import { formatToISO8601DateString, toJsDate, toISODateString, isSameDate, dateRange, toExpires } from '@dereekb/date';
5
+ import { UNKNOWN_WEBSITE_LINK_TYPE, decodeWebsiteLinkEncodedDataToWebsiteFileLink, encodeWebsiteFileLinkToWebsiteLinkEncodedData, AbstractModelPermissionService, grantedRoleMapReader, noAccessRoleMap, fullAccessRoleMap, IsE164PhoneNumber } from '@dereekb/model';
6
+ import { formatToISO8601DateString, toJsDate, toISODateString, isSameDate, dateRange, toExpires, sortByDateFunction, yearWeekCode, UNKNOWN_YEAR_WEEK_CODE, timeHasExpired } from '@dereekb/date';
7
7
  import { httpsCallable } from 'firebase/functions';
8
8
  import { ref, getMetadata, getDownloadURL, uploadString, uploadBytes, getBytes, getBlob, uploadBytesResumable, deleteObject, list } from 'firebase/storage';
9
- import { Expose } from 'class-transformer';
10
- import { IsEnum, IsString, IsOptional, registerDecorator, buildMessage, IsNotEmpty } from 'class-validator';
9
+ import { Expose, Type } from 'class-transformer';
10
+ import { IsEnum, IsString, IsOptional, registerDecorator, buildMessage, IsNotEmpty, IsBoolean, IsNumber, IsEmail, IsArray, ValidateNested, IsPhoneNumber, IsDate, MinLength, MaxLength } from 'class-validator';
11
+ import { isAfter } from 'date-fns';
12
+
13
+ /**
14
+ * Returns true if the input is seen as a client-side FirebaseError.
15
+ *
16
+ * @param error
17
+ * @returns
18
+ */
19
+ function isClientFirebaseError(error) {
20
+ return typeof error === 'object' && error.name === 'FirebaseError' && typeof error.code === 'string';
21
+ }
11
22
 
12
23
  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
13
24
 
@@ -2969,6 +2980,13 @@ function getDocumentSnapshotDataPair(document) {
2969
2980
  function getDocumentSnapshotDataPairs(documents) {
2970
2981
  return runAsyncTasksForValues(documents, getDocumentSnapshotDataPair);
2971
2982
  }
2983
+
2984
+ /**
2985
+ * Convenience function for calling getDocumentSnapshotDataPairs() then returning only the pairs that have data.
2986
+ */
2987
+ function getDocumentSnapshotDataPairsWithData(documents) {
2988
+ return getDocumentSnapshotDataPairs(documents).then(pairs => pairs.filter(pair => pair.data != null));
2989
+ }
2972
2990
  function getDocumentSnapshotDataTuples(documents) {
2973
2991
  return runAsyncTasksForValues(documents, document => document.accessor.get().then(snapshot => [document, snapshot.data()]));
2974
2992
  }
@@ -2987,7 +3005,7 @@ function getDocumentSnapshotsData(documents, withId = true) {
2987
3005
 
2988
3006
  function getDataFromDocumentSnapshots(snapshots, withId = true) {
2989
3007
  const mapFn = documentDataFunction(withId);
2990
- return filterMaybeValues(snapshots.map(mapFn));
3008
+ return filterMaybeArrayValues(snapshots.map(mapFn));
2991
3009
  }
2992
3010
  function loadDocumentsForSnapshots(accessor, snapshots) {
2993
3011
  return snapshots.docs.map(x => accessor.loadDocument(x.ref));
@@ -4193,7 +4211,7 @@ function firestoreEncodedArray(config) {
4193
4211
  default: (_config$default4 = config.default) != null ? _config$default4 : () => [],
4194
4212
  defaultBeforeSave: config.defaultBeforeSave,
4195
4213
  fromData: input => sortFn(input.map(fromData), false),
4196
- toData: input => filterMaybeValues(sortFn(input, true).map(toData))
4214
+ toData: input => filterMaybeArrayValues(sortFn(input, true).map(toData))
4197
4215
  });
4198
4216
  }
4199
4217
  /**
@@ -4363,7 +4381,7 @@ function firestoreArrayMap(config = {}) {
4363
4381
  return firestoreMap(Object.assign({
4364
4382
  mapFilter: KeyValueTypleValueFilter.EMPTY,
4365
4383
  // default to empty instead of null
4366
- mapFieldValues: filterMaybeValues
4384
+ mapFieldValues: filterMaybeArrayValues
4367
4385
  }, config));
4368
4386
  }
4369
4387
 
@@ -4374,7 +4392,7 @@ function firestoreArrayMap(config = {}) {
4374
4392
  */
4375
4393
  function firestoreModelKeyGrantedRoleArrayMap() {
4376
4394
  return firestoreArrayMap({
4377
- mapFieldValues: filterEmptyValues
4395
+ mapFieldValues: filterEmptyArrayValues
4378
4396
  });
4379
4397
  }
4380
4398
 
@@ -4438,7 +4456,7 @@ function firestoreObjectArray(config) {
4438
4456
  defaultBeforeSave: config.defaultBeforeSave,
4439
4457
  fromData: input => sortFn(performFiltering(input.map(x => from(x))), false),
4440
4458
  // map then filter then sort
4441
- toData: input => filterMaybeValues(sortFn(performFiltering(input), true)).map(x => to(x)) // filter then sort then map
4459
+ toData: input => filterMaybeArrayValues(sortFn(performFiltering(input), true)).map(x => to(x)) // filter then sort then map
4442
4460
  });
4443
4461
  }
4444
4462
 
@@ -4761,7 +4779,7 @@ function firebaseQueryItemAccumulator(iteration, mapItem) {
4761
4779
  mapItem = (_mapItem = mapItem) != null ? _mapItem : x => x;
4762
4780
  const snapshotData = documentDataFunction(true);
4763
4781
  const mapFn = x => {
4764
- const result = filterMaybeValues(x.map(y => {
4782
+ const result = filterMaybeArrayValues(x.map(y => {
4765
4783
  const data = snapshotData(y);
4766
4784
  return data ? mapItem(data) : undefined;
4767
4785
  }));
@@ -6970,6 +6988,13 @@ function firestoreModelKeyPairObject(input) {
6970
6988
  }
6971
6989
  return object;
6972
6990
  }
6991
+
6992
+ /**
6993
+ * String that is composed of the FirestoreCollectionNames derived from an input FirestoreModelKey and joined together via a separator.
6994
+ *
6995
+ * Is equivalent to a FirestoreCollectionType if the FIRESTORE_COLLECTION_NAME_SEPARATOR is used as the separator.
6996
+ */
6997
+
6973
6998
  function firestoreModelKeyCollectionType(input) {
6974
6999
  return firestoreModelKeyCollectionTypeArrayName(input, FIRESTORE_COLLECTION_NAME_SEPARATOR);
6975
7000
  }
@@ -7786,6 +7811,8 @@ function firebaseFirestoreClientDrivers() {
7786
7811
  };
7787
7812
  }
7788
7813
 
7814
+ const FIRESTORE_PERMISSION_DENIED_ERROR_CODE = 'permission-denied';
7815
+
7789
7816
  /**
7790
7817
  * Creates a FirestoreContextFactory that uses the @firebase/firebase package.
7791
7818
  */
@@ -7853,7 +7880,7 @@ function directDataHttpsCallable(callable) {
7853
7880
  function convertHttpsCallableErrorToReadableError(error) {
7854
7881
  let result;
7855
7882
  if (typeof error === 'object') {
7856
- if (error.name === 'FirebaseError' || error.code && error.details) {
7883
+ if (isClientFirebaseError(error) && error.details != null) {
7857
7884
  result = FirebaseServerError.fromFirebaseError(error);
7858
7885
  } else {
7859
7886
  result = toReadableError(error);
@@ -8419,31 +8446,31 @@ function _applyDecoratedDescriptor(target, property, decorators, descriptor, con
8419
8446
  return desc;
8420
8447
  }
8421
8448
 
8422
- var _dec$1, _dec2$1, _dec3$1, _dec4$1, _dec5$1, _dec6$1, _dec7$1, _class$1, _descriptor$1, _descriptor2$1;
8449
+ var _dec$2, _dec2$2, _dec3$2, _dec4$2, _dec5$2, _dec6$2, _dec7$2, _class$2, _descriptor$2, _descriptor2$2;
8423
8450
  let ScheduledFunctionDevelopmentFunctionTypeEnum = /*#__PURE__*/function (ScheduledFunctionDevelopmentFunctionTypeEnum) {
8424
8451
  ScheduledFunctionDevelopmentFunctionTypeEnum["LIST"] = "list";
8425
8452
  ScheduledFunctionDevelopmentFunctionTypeEnum["RUN"] = "run";
8426
8453
  return ScheduledFunctionDevelopmentFunctionTypeEnum;
8427
8454
  }({});
8428
- let ScheduledFunctionDevelopmentFirebaseFunctionParams = (_dec$1 = Expose(), _dec2$1 = IsEnum(ScheduledFunctionDevelopmentFunctionTypeEnum), _dec3$1 = Reflect.metadata("design:type", typeof ScheduledFunctionDevelopmentFunctionTypeEnum === "undefined" ? Object : ScheduledFunctionDevelopmentFunctionTypeEnum), _dec4$1 = Expose(), _dec5$1 = IsString(), _dec6$1 = IsOptional(), _dec7$1 = Reflect.metadata("design:type", String), (_class$1 = class ScheduledFunctionDevelopmentFirebaseFunctionParams {
8455
+ let ScheduledFunctionDevelopmentFirebaseFunctionParams = (_dec$2 = Expose(), _dec2$2 = IsEnum(ScheduledFunctionDevelopmentFunctionTypeEnum), _dec3$2 = Reflect.metadata("design:type", typeof ScheduledFunctionDevelopmentFunctionTypeEnum === "undefined" ? Object : ScheduledFunctionDevelopmentFunctionTypeEnum), _dec4$2 = Expose(), _dec5$2 = IsString(), _dec6$2 = IsOptional(), _dec7$2 = Reflect.metadata("design:type", String), (_class$2 = class ScheduledFunctionDevelopmentFirebaseFunctionParams {
8429
8456
  constructor() {
8430
- _initializerDefineProperty(this, "type", _descriptor$1, this);
8457
+ _initializerDefineProperty(this, "type", _descriptor$2, this);
8431
8458
  /**
8432
8459
  * Name of function to run.
8433
8460
  */
8434
- _initializerDefineProperty(this, "run", _descriptor2$1, this);
8461
+ _initializerDefineProperty(this, "run", _descriptor2$2, this);
8435
8462
  }
8436
- }, (_descriptor$1 = _applyDecoratedDescriptor(_class$1.prototype, "type", [_dec$1, _dec2$1, _dec3$1], {
8463
+ }, (_descriptor$2 = _applyDecoratedDescriptor(_class$2.prototype, "type", [_dec$2, _dec2$2, _dec3$2], {
8437
8464
  configurable: true,
8438
8465
  enumerable: true,
8439
8466
  writable: true,
8440
8467
  initializer: null
8441
- }), _descriptor2$1 = _applyDecoratedDescriptor(_class$1.prototype, "run", [_dec4$1, _dec5$1, _dec6$1, _dec7$1], {
8468
+ }), _descriptor2$2 = _applyDecoratedDescriptor(_class$2.prototype, "run", [_dec4$2, _dec5$2, _dec6$2, _dec7$2], {
8442
8469
  configurable: true,
8443
8470
  enumerable: true,
8444
8471
  writable: true,
8445
8472
  initializer: null
8446
- })), _class$1));
8473
+ })), _class$2));
8447
8474
  class ScheduledFunctionDevelopmentFirebaseFunctionListEntry {
8448
8475
  constructor() {
8449
8476
  this.name = void 0;
@@ -8532,55 +8559,55 @@ function IsFirestoreModelIdOrKey(validationOptions) {
8532
8559
  };
8533
8560
  }
8534
8561
 
8535
- var _dec, _dec2, _dec3, _dec4, _class, _descriptor, _dec5, _dec6, _dec7, _dec8, _dec9, _class2, _descriptor2, _dec10, _dec11, _dec12, _dec13, _class3, _descriptor3, _dec14, _dec15, _dec16, _dec17, _dec18, _class4, _descriptor4;
8562
+ var _dec$1, _dec2$1, _dec3$1, _dec4$1, _class$1, _descriptor$1, _dec5$1, _dec6$1, _dec7$1, _dec8$1, _dec9$1, _class2$1, _descriptor2$1, _dec10$1, _dec11$1, _dec12$1, _dec13$1, _class3$1, _descriptor3$1, _dec14$1, _dec15$1, _dec16$1, _dec17$1, _dec18$1, _class4$1, _descriptor4$1;
8536
8563
 
8537
8564
  /**
8538
8565
  * Simple annotated params that implements FirestoreModelKeyRef.
8539
8566
  */
8540
- let TargetModelParams = (_dec = Expose(), _dec2 = IsNotEmpty(), _dec3 = IsFirestoreModelKey(), _dec4 = Reflect.metadata("design:type", typeof FirestoreModelKey === "undefined" ? Object : FirestoreModelKey), (_class = class TargetModelParams {
8567
+ let TargetModelParams = (_dec$1 = Expose(), _dec2$1 = IsNotEmpty(), _dec3$1 = IsFirestoreModelKey(), _dec4$1 = Reflect.metadata("design:type", typeof FirestoreModelKey === "undefined" ? Object : FirestoreModelKey), (_class$1 = class TargetModelParams {
8541
8568
  constructor() {
8542
- _initializerDefineProperty(this, "key", _descriptor, this);
8569
+ _initializerDefineProperty(this, "key", _descriptor$1, this);
8543
8570
  }
8544
- }, (_descriptor = _applyDecoratedDescriptor(_class.prototype, "key", [_dec, _dec2, _dec3, _dec4], {
8571
+ }, (_descriptor$1 = _applyDecoratedDescriptor(_class$1.prototype, "key", [_dec$1, _dec2$1, _dec3$1, _dec4$1], {
8545
8572
  configurable: true,
8546
8573
  enumerable: true,
8547
8574
  writable: true,
8548
8575
  initializer: null
8549
- })), _class));
8550
- let InferredTargetModelParams = (_dec5 = Expose(), _dec6 = IsOptional(), _dec7 = IsNotEmpty(), _dec8 = IsFirestoreModelKey(), _dec9 = Reflect.metadata("design:type", typeof FirestoreModelKey === "undefined" ? Object : FirestoreModelKey), (_class2 = class InferredTargetModelParams {
8576
+ })), _class$1));
8577
+ let InferredTargetModelParams = (_dec5$1 = Expose(), _dec6$1 = IsOptional(), _dec7$1 = IsNotEmpty(), _dec8$1 = IsFirestoreModelKey(), _dec9$1 = Reflect.metadata("design:type", typeof FirestoreModelKey === "undefined" ? Object : FirestoreModelKey), (_class2$1 = class InferredTargetModelParams {
8551
8578
  constructor() {
8552
- _initializerDefineProperty(this, "key", _descriptor2, this);
8579
+ _initializerDefineProperty(this, "key", _descriptor2$1, this);
8553
8580
  }
8554
- }, (_descriptor2 = _applyDecoratedDescriptor(_class2.prototype, "key", [_dec5, _dec6, _dec7, _dec8, _dec9], {
8581
+ }, (_descriptor2$1 = _applyDecoratedDescriptor(_class2$1.prototype, "key", [_dec5$1, _dec6$1, _dec7$1, _dec8$1, _dec9$1], {
8555
8582
  configurable: true,
8556
8583
  enumerable: true,
8557
8584
  writable: true,
8558
8585
  initializer: null
8559
- })), _class2));
8586
+ })), _class2$1));
8560
8587
 
8561
8588
  /**
8562
8589
  * Simple annotated params that implements FirestoreModelKeyRef but key is a FirestoreModelId.
8563
8590
  */
8564
- let TargetModelIdParams = (_dec10 = Expose(), _dec11 = IsNotEmpty(), _dec12 = IsFirestoreModelId(), _dec13 = Reflect.metadata("design:type", typeof FirestoreModelKey === "undefined" ? Object : FirestoreModelKey), (_class3 = class TargetModelIdParams {
8591
+ let TargetModelIdParams = (_dec10$1 = Expose(), _dec11$1 = IsNotEmpty(), _dec12$1 = IsFirestoreModelId(), _dec13$1 = Reflect.metadata("design:type", typeof FirestoreModelKey === "undefined" ? Object : FirestoreModelKey), (_class3$1 = class TargetModelIdParams {
8565
8592
  constructor() {
8566
- _initializerDefineProperty(this, "key", _descriptor3, this);
8593
+ _initializerDefineProperty(this, "key", _descriptor3$1, this);
8567
8594
  }
8568
- }, (_descriptor3 = _applyDecoratedDescriptor(_class3.prototype, "key", [_dec10, _dec11, _dec12, _dec13], {
8595
+ }, (_descriptor3$1 = _applyDecoratedDescriptor(_class3$1.prototype, "key", [_dec10$1, _dec11$1, _dec12$1, _dec13$1], {
8569
8596
  configurable: true,
8570
8597
  enumerable: true,
8571
8598
  writable: true,
8572
8599
  initializer: null
8573
- })), _class3));
8574
- let InferredTargetModelIdParams = (_dec14 = Expose(), _dec15 = IsOptional(), _dec16 = IsNotEmpty(), _dec17 = IsFirestoreModelId(), _dec18 = Reflect.metadata("design:type", typeof FirestoreModelKey === "undefined" ? Object : FirestoreModelKey), (_class4 = class InferredTargetModelIdParams {
8600
+ })), _class3$1));
8601
+ let InferredTargetModelIdParams = (_dec14$1 = Expose(), _dec15$1 = IsOptional(), _dec16$1 = IsNotEmpty(), _dec17$1 = IsFirestoreModelId(), _dec18$1 = Reflect.metadata("design:type", typeof FirestoreModelKey === "undefined" ? Object : FirestoreModelKey), (_class4$1 = class InferredTargetModelIdParams {
8575
8602
  constructor() {
8576
- _initializerDefineProperty(this, "key", _descriptor4, this);
8603
+ _initializerDefineProperty(this, "key", _descriptor4$1, this);
8577
8604
  }
8578
- }, (_descriptor4 = _applyDecoratedDescriptor(_class4.prototype, "key", [_dec14, _dec15, _dec16, _dec17, _dec18], {
8605
+ }, (_descriptor4$1 = _applyDecoratedDescriptor(_class4$1.prototype, "key", [_dec14$1, _dec15$1, _dec16$1, _dec17$1, _dec18$1], {
8579
8606
  configurable: true,
8580
8607
  enumerable: true,
8581
8608
  writable: true,
8582
8609
  initializer: null
8583
- })), _class4));
8610
+ })), _class4$1));
8584
8611
 
8585
8612
  /**
8586
8613
  * Abstract AbstractModelPermissionService implementation for FirebaseModelsPermissionService.
@@ -9270,6 +9297,1984 @@ function firebaseStorageClientDrivers() {
9270
9297
  */
9271
9298
  const clientFirebaseStorageContextFactory = firebaseStorageContextFactory(firebaseStorageClientDrivers());
9272
9299
 
9300
+ /**
9301
+ * Notification configuration state for a template.
9302
+ *
9303
+ * Denotes which modes of message are enabled for the user to recieve.
9304
+ */
9305
+
9306
+ function mergeNotificationBoxRecipientTemplateConfigs(a, b) {
9307
+ const {
9308
+ sd,
9309
+ se,
9310
+ st,
9311
+ sp,
9312
+ sn
9313
+ } = a != null ? a : {};
9314
+ const {
9315
+ sd: sdb,
9316
+ se: seb,
9317
+ st: stb,
9318
+ sp: spb,
9319
+ sn: snb
9320
+ } = b != null ? b : {};
9321
+ return {
9322
+ sd: sd != null ? sd : sdb,
9323
+ se: se != null ? se : seb,
9324
+ st: st != null ? st : stb,
9325
+ sp: sp != null ? sp : spb,
9326
+ sn: sn != null ? sn : snb
9327
+ };
9328
+ }
9329
+ function effectiveNotificationBoxRecipientTemplateConfig(x) {
9330
+ const {
9331
+ sd,
9332
+ se,
9333
+ st,
9334
+ sp,
9335
+ sn
9336
+ } = x;
9337
+ return {
9338
+ sd,
9339
+ se: se != null ? se : sd,
9340
+ st: st != null ? st : sd,
9341
+ sp: sp != null ? sp : sd,
9342
+ sn: sn != null ? sn : sd
9343
+ };
9344
+ }
9345
+
9346
+ // MARK: Recipient
9347
+ /**
9348
+ * Recipient configuration for a notification
9349
+ */
9350
+
9351
+ function updateNotificationRecipient(a, b) {
9352
+ const {
9353
+ uid: inputUid,
9354
+ n: inputN,
9355
+ e: inputE,
9356
+ t: inputT,
9357
+ s: inputS
9358
+ } = b;
9359
+ const uid = updateMaybeValue(a.uid, inputUid);
9360
+ return {
9361
+ uid,
9362
+ n: updateMaybeValue(a.n, inputN),
9363
+ e: updateMaybeValue(a.e, inputE),
9364
+ t: updateMaybeValue(a.t, inputT),
9365
+ s: uid != null ? null : updateMaybeValue(a.s, inputS) // null if uid is defined
9366
+ };
9367
+ }
9368
+
9369
+ const firestoreNotificationRecipientWithConfig = firestoreSubObject({
9370
+ objectField: {
9371
+ fields: {
9372
+ uid: optionalFirestoreString(),
9373
+ n: optionalFirestoreString(),
9374
+ e: optionalFirestoreString(),
9375
+ t: optionalFirestoreString(),
9376
+ s: optionalFirestoreString(),
9377
+ sd: optionalFirestoreBoolean(),
9378
+ se: optionalFirestoreBoolean(),
9379
+ st: optionalFirestoreBoolean(),
9380
+ sp: optionalFirestoreBoolean(),
9381
+ sn: optionalFirestoreBoolean()
9382
+ }
9383
+ }
9384
+ });
9385
+
9386
+ // MARK: Config
9387
+ let NotificationBoxRecipientFlag = /*#__PURE__*/function (NotificationBoxRecipientFlag) {
9388
+ NotificationBoxRecipientFlag[NotificationBoxRecipientFlag["ENABLED"] = 0] = "ENABLED";
9389
+ NotificationBoxRecipientFlag[NotificationBoxRecipientFlag["DISABLED"] = 1] = "DISABLED";
9390
+ NotificationBoxRecipientFlag[NotificationBoxRecipientFlag["OPT_OUT"] = 2] = "OPT_OUT";
9391
+ return NotificationBoxRecipientFlag;
9392
+ }({});
9393
+
9394
+ /**
9395
+ * Settings related to recipients that recieve notifications.
9396
+ *
9397
+ * If uid is set, then most other NotificationRecipient fields are ignored as those are pulled from auth.
9398
+ */
9399
+
9400
+ function newNotificationBoxRecipientForUid(uid, i) {
9401
+ return {
9402
+ c: {},
9403
+ i,
9404
+ uid
9405
+ };
9406
+ }
9407
+
9408
+ /**
9409
+ * Default NotificationUserNotificationBoxRecipientConfig.
9410
+ */
9411
+
9412
+ function mergeNotificationUserDefaultNotificationBoxRecipientConfig(a, b) {
9413
+ const c = mergeNotificationBoxRecipientTemplateConfigRecords(a.c, b.c);
9414
+ const result = Object.assign({}, mergeObjects([a, b], KeyValueTypleValueFilter.UNDEFINED), {
9415
+ c
9416
+ });
9417
+ return result;
9418
+ }
9419
+
9420
+ /**
9421
+ * Used to reflect the NotificationBoxRecipient config back to a NotificationUser.
9422
+ *
9423
+ * The index reflects the index the user is in the NotificationBox.
9424
+ */
9425
+
9426
+ let NotificationBoxRecipientTemplateConfigBoolean = /*#__PURE__*/function (NotificationBoxRecipientTemplateConfigBoolean) {
9427
+ NotificationBoxRecipientTemplateConfigBoolean[NotificationBoxRecipientTemplateConfigBoolean["SEND_ALL_ON"] = 0] = "SEND_ALL_ON";
9428
+ NotificationBoxRecipientTemplateConfigBoolean[NotificationBoxRecipientTemplateConfigBoolean["SEND_ALL_OFF"] = 1] = "SEND_ALL_OFF";
9429
+ NotificationBoxRecipientTemplateConfigBoolean[NotificationBoxRecipientTemplateConfigBoolean["EMAIL"] = 2] = "EMAIL";
9430
+ NotificationBoxRecipientTemplateConfigBoolean[NotificationBoxRecipientTemplateConfigBoolean["EMAIL_OFF"] = 3] = "EMAIL_OFF";
9431
+ NotificationBoxRecipientTemplateConfigBoolean[NotificationBoxRecipientTemplateConfigBoolean["TEXT"] = 4] = "TEXT";
9432
+ NotificationBoxRecipientTemplateConfigBoolean[NotificationBoxRecipientTemplateConfigBoolean["TEXT_OFF"] = 5] = "TEXT_OFF";
9433
+ NotificationBoxRecipientTemplateConfigBoolean[NotificationBoxRecipientTemplateConfigBoolean["PUSH_NOTIFICATION"] = 6] = "PUSH_NOTIFICATION";
9434
+ NotificationBoxRecipientTemplateConfigBoolean[NotificationBoxRecipientTemplateConfigBoolean["PUSH_NOTIFICATION_OFF"] = 7] = "PUSH_NOTIFICATION_OFF";
9435
+ NotificationBoxRecipientTemplateConfigBoolean[NotificationBoxRecipientTemplateConfigBoolean["NOTIFICATION_SUMMARY"] = 8] = "NOTIFICATION_SUMMARY";
9436
+ NotificationBoxRecipientTemplateConfigBoolean[NotificationBoxRecipientTemplateConfigBoolean["NOTIFICATION_SUMMARY_OFF"] = 9] = "NOTIFICATION_SUMMARY_OFF";
9437
+ return NotificationBoxRecipientTemplateConfigBoolean;
9438
+ }({});
9439
+
9440
+ /**
9441
+ * Encoded NotificationBoxRecipientTemplateConfig
9442
+ */
9443
+
9444
+ /**
9445
+ * Map of template types to their configurations.
9446
+ *
9447
+ * Should not be saved with any template type entirely disabled.
9448
+ */
9449
+
9450
+ function mergeNotificationBoxRecipientTemplateConfigRecords(a, b) {
9451
+ const mergeConfigs = mergeObjectsFunction(KeyValueTypleValueFilter.UNDEFINED);
9452
+ return mergeConfigs([a, b]);
9453
+ }
9454
+
9455
+ /**
9456
+ * Encoded NotificationBoxRecipientTemplateConfigRecord
9457
+ */
9458
+
9459
+ const notificationBoxRecipientTemplateConfigDencoder = bitwiseObjectDencoder({
9460
+ maxIndex: NotificationBoxRecipientTemplateConfigBoolean.NOTIFICATION_SUMMARY_OFF + 1,
9461
+ toSetFunction: x => {
9462
+ const set = new Set();
9463
+ if (x.sd != null) {
9464
+ set.add(x.sd ? NotificationBoxRecipientTemplateConfigBoolean.SEND_ALL_ON : NotificationBoxRecipientTemplateConfigBoolean.SEND_ALL_OFF);
9465
+ }
9466
+ if (x.st != null) {
9467
+ set.add(x.st ? NotificationBoxRecipientTemplateConfigBoolean.TEXT : NotificationBoxRecipientTemplateConfigBoolean.TEXT_OFF);
9468
+ }
9469
+ if (x.se != null) {
9470
+ set.add(x.se ? NotificationBoxRecipientTemplateConfigBoolean.EMAIL : NotificationBoxRecipientTemplateConfigBoolean.EMAIL_OFF);
9471
+ }
9472
+ if (x.sp != null) {
9473
+ set.add(x.sp ? NotificationBoxRecipientTemplateConfigBoolean.PUSH_NOTIFICATION : NotificationBoxRecipientTemplateConfigBoolean.PUSH_NOTIFICATION_OFF);
9474
+ }
9475
+ if (x.sn != null) {
9476
+ set.add(x.sn ? NotificationBoxRecipientTemplateConfigBoolean.NOTIFICATION_SUMMARY : NotificationBoxRecipientTemplateConfigBoolean.NOTIFICATION_SUMMARY_OFF);
9477
+ }
9478
+ return set;
9479
+ },
9480
+ fromSetFunction: x => {
9481
+ const object = {};
9482
+ if (x.has(NotificationBoxRecipientTemplateConfigBoolean.SEND_ALL_ON)) {
9483
+ object.sd = true;
9484
+ } else if (x.has(NotificationBoxRecipientTemplateConfigBoolean.SEND_ALL_OFF)) {
9485
+ object.sd = false;
9486
+ }
9487
+ if (x.has(NotificationBoxRecipientTemplateConfigBoolean.TEXT)) {
9488
+ object.st = true;
9489
+ } else if (x.has(NotificationBoxRecipientTemplateConfigBoolean.TEXT_OFF)) {
9490
+ object.st = false;
9491
+ }
9492
+ if (x.has(NotificationBoxRecipientTemplateConfigBoolean.EMAIL)) {
9493
+ object.se = true;
9494
+ } else if (x.has(NotificationBoxRecipientTemplateConfigBoolean.EMAIL_OFF)) {
9495
+ object.se = false;
9496
+ }
9497
+ if (x.has(NotificationBoxRecipientTemplateConfigBoolean.PUSH_NOTIFICATION)) {
9498
+ object.sp = true;
9499
+ } else if (x.has(NotificationBoxRecipientTemplateConfigBoolean.PUSH_NOTIFICATION_OFF)) {
9500
+ object.sp = false;
9501
+ }
9502
+ if (x.has(NotificationBoxRecipientTemplateConfigBoolean.NOTIFICATION_SUMMARY)) {
9503
+ object.sn = true;
9504
+ } else if (x.has(NotificationBoxRecipientTemplateConfigBoolean.NOTIFICATION_SUMMARY_OFF)) {
9505
+ object.sn = false;
9506
+ }
9507
+ return object;
9508
+ }
9509
+ });
9510
+ function firestoreNotificationBoxRecipientTemplateConfigRecord() {
9511
+ return firestoreBitwiseObjectMap({
9512
+ dencoder: notificationBoxRecipientTemplateConfigDencoder
9513
+ });
9514
+ }
9515
+ const firestoreNotificationBoxRecipient = firestoreSubObject({
9516
+ objectField: {
9517
+ fields: {
9518
+ i: firestoreNumber({
9519
+ default: UNSET_INDEX_NUMBER
9520
+ }),
9521
+ uid: optionalFirestoreString(),
9522
+ n: optionalFirestoreString(),
9523
+ t: optionalFirestoreString(),
9524
+ e: optionalFirestoreString(),
9525
+ s: optionalFirestoreString(),
9526
+ f: optionalFirestoreEnum({
9527
+ dontStoreIf: NotificationBoxRecipientFlag.ENABLED
9528
+ }),
9529
+ c: firestoreNotificationBoxRecipientTemplateConfigRecord(),
9530
+ lk: optionalFirestoreBoolean({
9531
+ dontStoreValueIf: false
9532
+ })
9533
+ }
9534
+ }
9535
+ });
9536
+ const firestoreNotificationUserDefaultNotificationBoxRecipientConfig = firestoreSubObject({
9537
+ objectField: {
9538
+ fields: {
9539
+ lk: optionalFirestoreBoolean({
9540
+ dontStoreValueIf: false
9541
+ }),
9542
+ bk: optionalFirestoreBoolean({
9543
+ dontStoreValueIf: false
9544
+ }),
9545
+ t: optionalFirestoreString(),
9546
+ e: optionalFirestoreString(),
9547
+ f: optionalFirestoreEnum({
9548
+ dontStoreIf: NotificationBoxRecipientFlag.ENABLED
9549
+ }),
9550
+ c: firestoreNotificationBoxRecipientTemplateConfigRecord()
9551
+ }
9552
+ }
9553
+ });
9554
+ const firestoreNotificationUserNotificationBoxRecipientConfig = firestoreSubObject({
9555
+ objectField: {
9556
+ fields: {
9557
+ nb: firestoreModelIdString,
9558
+ rm: optionalFirestoreBoolean({
9559
+ dontStoreValueIf: false
9560
+ }),
9561
+ ns: optionalFirestoreBoolean({
9562
+ dontStoreValueIf: false
9563
+ }),
9564
+ lk: optionalFirestoreBoolean({
9565
+ dontStoreValueIf: false
9566
+ }),
9567
+ bk: optionalFirestoreBoolean({
9568
+ dontStoreValueIf: false
9569
+ }),
9570
+ i: firestoreNumber({
9571
+ default: UNSET_INDEX_NUMBER
9572
+ }),
9573
+ n: optionalFirestoreString(),
9574
+ t: optionalFirestoreString(),
9575
+ e: optionalFirestoreString(),
9576
+ s: optionalFirestoreString(),
9577
+ f: optionalFirestoreEnum({
9578
+ dontStoreIf: NotificationBoxRecipientFlag.ENABLED
9579
+ }),
9580
+ c: firestoreNotificationBoxRecipientTemplateConfigRecord()
9581
+ }
9582
+ }
9583
+ });
9584
+ function notificationBoxRecipientTemplateConfigRecordToArray(input) {
9585
+ const array = [];
9586
+ forEachKeyValue(input, {
9587
+ forEach: x => {
9588
+ array.push(Object.assign({
9589
+ type: x[0]
9590
+ }, x[1]));
9591
+ }
9592
+ });
9593
+ return array;
9594
+ }
9595
+ function notificationBoxRecipientTemplateConfigArrayToRecord(input) {
9596
+ const map = {};
9597
+ input.forEach(x => {
9598
+ map[x.type] = {
9599
+ sd: x.sd,
9600
+ st: x.st,
9601
+ se: x.se,
9602
+ sp: x.sp,
9603
+ sn: x.sn
9604
+ };
9605
+ });
9606
+ return map;
9607
+ }
9608
+
9609
+ // MARK: Utility
9610
+ /**
9611
+ * Config object that may contain a boolean called sendNotification.
9612
+ */
9613
+
9614
+ /**
9615
+ * Arbitrary metadata for a job. Derived/managed by the concrete job type.
9616
+ */
9617
+
9618
+ /**
9619
+ * A notification item.
9620
+ *
9621
+ * Is embedded within a Notification, NotificationWeek, and NotificationSummary.
9622
+ */
9623
+
9624
+ const firestoreNotificationItem = firestoreSubObject({
9625
+ objectField: {
9626
+ fields: {
9627
+ id: firestoreModelIdString,
9628
+ cat: firestoreDate(),
9629
+ cb: optionalFirestoreUID(),
9630
+ t: firestoreString(),
9631
+ m: optionalFirestoreString(),
9632
+ s: optionalFirestoreString(),
9633
+ g: optionalFirestoreString(),
9634
+ d: firestorePassThroughField(),
9635
+ v: optionalFirestoreBoolean({
9636
+ dontStoreIf: false
9637
+ })
9638
+ }
9639
+ }
9640
+ });
9641
+ /**
9642
+ * Returns an object containing input notification items split up by their determined read/unread state.
9643
+ *
9644
+ * @param items
9645
+ */
9646
+ function unreadNotificationItems(items, considerReadIfCreatedBefore) {
9647
+ const checkIsRead = considerReadIfCreatedBefore != null ? x => Boolean(x.v || !isAfter(x.cat, considerReadIfCreatedBefore)) : x => Boolean(x.v);
9648
+ const {
9649
+ included: read,
9650
+ excluded: unread
9651
+ } = separateValues(items, checkIsRead);
9652
+ return {
9653
+ items,
9654
+ considerReadIfCreatedBefore,
9655
+ read,
9656
+ unread
9657
+ };
9658
+ }
9659
+ const sortNotificationItemsFunction = sortByDateFunction(x => x.cat);
9660
+
9661
+ class NotificationFirestoreCollections {
9662
+ constructor() {
9663
+ this.notificationUserCollection = void 0;
9664
+ this.notificationSummaryCollection = void 0;
9665
+ this.notificationBoxCollection = void 0;
9666
+ this.notificationCollectionFactory = void 0;
9667
+ this.notificationCollectionGroup = void 0;
9668
+ this.notificationWeekCollectionFactory = void 0;
9669
+ this.notificationWeekCollectionGroup = void 0;
9670
+ }
9671
+ }
9672
+
9673
+ /**
9674
+ * Notification-related model that is initialized asynchronously at a later time.
9675
+ */
9676
+
9677
+ // MARK: NotificationUser
9678
+ const notificationUserIdentity = firestoreModelIdentity('notificationUser', 'nu');
9679
+
9680
+ /**
9681
+ * A global notification User in the system.
9682
+ *
9683
+ * Keeps track of the NotificationBoxes the user is subscribed to, as well as other global subscriptions.
9684
+ *
9685
+ * The NotificationUser is created automatically by the NotificationBox as a user is created.
9686
+ */
9687
+
9688
+ class NotificationUserDocument extends AbstractFirestoreDocument {
9689
+ get modelIdentity() {
9690
+ return notificationUserIdentity;
9691
+ }
9692
+ }
9693
+ const notificationUserConverter = snapshotConverterFunctions({
9694
+ fields: {
9695
+ uid: firestoreUID(),
9696
+ b: firestoreModelIdArrayField,
9697
+ dc: firestoreNotificationUserDefaultNotificationBoxRecipientConfig,
9698
+ gc: firestoreNotificationUserDefaultNotificationBoxRecipientConfig,
9699
+ bc: firestoreObjectArray({
9700
+ objectField: firestoreNotificationUserNotificationBoxRecipientConfig
9701
+ }),
9702
+ ns: optionalFirestoreBoolean()
9703
+ }
9704
+ });
9705
+ function notificationUserCollectionReference(context) {
9706
+ return context.collection(notificationUserIdentity.collectionName);
9707
+ }
9708
+ function notificationUserFirestoreCollection(firestoreContext) {
9709
+ return firestoreContext.firestoreCollection({
9710
+ modelIdentity: notificationUserIdentity,
9711
+ converter: notificationUserConverter,
9712
+ collection: notificationUserCollectionReference(firestoreContext),
9713
+ makeDocument: (accessor, documentAccessor) => new NotificationUserDocument(accessor, documentAccessor),
9714
+ firestoreContext
9715
+ });
9716
+ }
9717
+
9718
+ // MARK: NotificationSummary
9719
+ /**
9720
+ * An arbitrary summary object
9721
+ */
9722
+ const notificationSummaryIdentity = firestoreModelIdentity('notificationSummary', 'ns');
9723
+
9724
+ /**
9725
+ * The maximum number of notifications that can be stored in a NotificationSummary.
9726
+ */
9727
+ const NOTIFICATION_SUMMARY_ITEM_LIMIT = 1000;
9728
+
9729
+ /**
9730
+ * The expected max length of a subject on a NotificationSummary's embedded NotificationItem.
9731
+ */
9732
+ const NOTIFICATION_SUMMARY_EMBEDDED_NOTIFICATION_ITEM_SUBJECT_MAX_LENGTH = 80;
9733
+
9734
+ /**
9735
+ * The expected max length of a message on a NotificationSummary's embedded NotificationItem.
9736
+ */
9737
+ const NOTIFICATION_SUMMARY_EMBEDDED_NOTIFICATION_ITEM_MESSAGE_MAX_LENGTH = 500;
9738
+
9739
+ /**
9740
+ * Used to hold arbitrary NotificationItems in the system for an object. The id for this is the two-way flat key of the object it represents.
9741
+ *
9742
+ * Notification Items can be delivered here.
9743
+ */
9744
+
9745
+ /**
9746
+ * NotificationSummary roles
9747
+ */
9748
+
9749
+ class NotificationSummaryDocument extends AbstractFirestoreDocument {
9750
+ get modelIdentity() {
9751
+ return notificationSummaryIdentity;
9752
+ }
9753
+ }
9754
+ const notificationSummaryConverter = snapshotConverterFunctions({
9755
+ fields: {
9756
+ cat: firestoreDate(),
9757
+ m: firestoreModelKeyString,
9758
+ o: firestoreModelKeyString,
9759
+ n: firestoreObjectArray({
9760
+ objectField: firestoreNotificationItem
9761
+ }),
9762
+ lat: optionalFirestoreDate(),
9763
+ rat: optionalFirestoreDate(),
9764
+ s: optionalFirestoreBoolean({
9765
+ dontStoreIf: false
9766
+ })
9767
+ }
9768
+ });
9769
+ function notificationSummaryCollectionReference(context) {
9770
+ return context.collection(notificationSummaryIdentity.collectionName);
9771
+ }
9772
+ function notificationSummaryFirestoreCollection(firestoreContext) {
9773
+ return firestoreContext.firestoreCollection({
9774
+ modelIdentity: notificationSummaryIdentity,
9775
+ converter: notificationSummaryConverter,
9776
+ collection: notificationSummaryCollectionReference(firestoreContext),
9777
+ makeDocument: (accessor, documentAccessor) => new NotificationSummaryDocument(accessor, documentAccessor),
9778
+ firestoreContext
9779
+ });
9780
+ }
9781
+
9782
+ // MARK: NotificationBox
9783
+ const notificationBoxIdentity = firestoreModelIdentity('notificationBox', 'nb');
9784
+
9785
+ /**
9786
+ * A Notification Box in the system for an object. The id for this is the two-way flat key of the object it represents.
9787
+ *
9788
+ * This object is the root collection for notifications for the corresponding object.
9789
+ *
9790
+ * Additional information about what notification templates are available to this type are available on a per-application basis, typically through the
9791
+ * NotificationTemplateTypeInfoRecord configured for the app.
9792
+ *
9793
+ * Update to each recipient is propogated from NotificationUser values.
9794
+ */
9795
+
9796
+ /**
9797
+ * NotificationBox roles
9798
+ *
9799
+ * subscribe: user can subscribe or unsubscribe to/from this notification box and manage themselves.
9800
+ * manageRecipients: user can manage all recipients
9801
+ */
9802
+
9803
+ class NotificationBoxDocument extends AbstractFirestoreDocument {
9804
+ get modelIdentity() {
9805
+ return notificationBoxIdentity;
9806
+ }
9807
+ }
9808
+ const notificationBoxConverter = snapshotConverterFunctions({
9809
+ fields: {
9810
+ cat: firestoreDate(),
9811
+ m: firestoreModelKeyString,
9812
+ o: firestoreModelKeyString,
9813
+ r: firestoreObjectArray({
9814
+ objectField: firestoreNotificationBoxRecipient
9815
+ }),
9816
+ w: firestoreNumber({
9817
+ default: () => yearWeekCode(new Date())
9818
+ }),
9819
+ s: optionalFirestoreBoolean({
9820
+ dontStoreIf: false
9821
+ }),
9822
+ fi: optionalFirestoreBoolean({
9823
+ dontStoreIf: false
9824
+ })
9825
+ }
9826
+ });
9827
+ function notificationBoxCollectionReference(context) {
9828
+ return context.collection(notificationBoxIdentity.collectionName);
9829
+ }
9830
+ function notificationBoxFirestoreCollection(firestoreContext) {
9831
+ return firestoreContext.firestoreCollection({
9832
+ modelIdentity: notificationBoxIdentity,
9833
+ converter: notificationBoxConverter,
9834
+ collection: notificationBoxCollectionReference(firestoreContext),
9835
+ makeDocument: (accessor, documentAccessor) => new NotificationBoxDocument(accessor, documentAccessor),
9836
+ firestoreContext
9837
+ });
9838
+ }
9839
+
9840
+ // MARK: Notification Data
9841
+ const notificationIdentity = firestoreModelIdentity(notificationBoxIdentity, 'notification', 'nbn');
9842
+ let NotificationSendType = /*#__PURE__*/function (NotificationSendType) {
9843
+ NotificationSendType[NotificationSendType["SEND_IF_BOX_EXISTS"] = 0] = "SEND_IF_BOX_EXISTS";
9844
+ NotificationSendType[NotificationSendType["INIT_BOX_AND_SEND"] = 1] = "INIT_BOX_AND_SEND";
9845
+ NotificationSendType[NotificationSendType["SEND_WITHOUT_CREATING_BOX"] = 2] = "SEND_WITHOUT_CREATING_BOX";
9846
+ return NotificationSendType;
9847
+ }({});
9848
+ let NotificationSendState = /*#__PURE__*/function (NotificationSendState) {
9849
+ NotificationSendState[NotificationSendState["NONE"] = -1] = "NONE";
9850
+ NotificationSendState[NotificationSendState["QUEUED"] = 0] = "QUEUED";
9851
+ NotificationSendState[NotificationSendState["SENT"] = 1] = "SENT";
9852
+ NotificationSendState[NotificationSendState["SENT_PARTIAL"] = 2] = "SENT_PARTIAL";
9853
+ NotificationSendState[NotificationSendState["SKIPPED"] = 3] = "SKIPPED";
9854
+ NotificationSendState[NotificationSendState["NO_TRY"] = 4] = "NO_TRY";
9855
+ NotificationSendState[NotificationSendState["SEND_ERROR"] = 5] = "SEND_ERROR";
9856
+ NotificationSendState[NotificationSendState["BUILD_ERROR"] = 6] = "BUILD_ERROR";
9857
+ NotificationSendState[NotificationSendState["CONFIG_ERROR"] = 7] = "CONFIG_ERROR";
9858
+ return NotificationSendState;
9859
+ }({});
9860
+ let NotificationType = /*#__PURE__*/function (NotificationType) {
9861
+ NotificationType[NotificationType["NORMAL"] = 0] = "NORMAL";
9862
+ NotificationType[NotificationType["AD_HOC"] = 1] = "AD_HOC";
9863
+ return NotificationType;
9864
+ }({});
9865
+ let NotificationRecipientSendFlag = /*#__PURE__*/function (NotificationRecipientSendFlag) {
9866
+ NotificationRecipientSendFlag[NotificationRecipientSendFlag["NORMAL"] = 0] = "NORMAL";
9867
+ NotificationRecipientSendFlag[NotificationRecipientSendFlag["SKIP_NOTIFICATION_BOX_RECIPIENTS"] = 1] = "SKIP_NOTIFICATION_BOX_RECIPIENTS";
9868
+ NotificationRecipientSendFlag[NotificationRecipientSendFlag["SKIP_GLOBAL_RECIPIENTS"] = 2] = "SKIP_GLOBAL_RECIPIENTS";
9869
+ NotificationRecipientSendFlag[NotificationRecipientSendFlag["ONLY_EXPLICIT_RECIPIENTS"] = 3] = "ONLY_EXPLICIT_RECIPIENTS";
9870
+ NotificationRecipientSendFlag[NotificationRecipientSendFlag["ONLY_GLOBAL_RECIPIENTS"] = 4] = "ONLY_GLOBAL_RECIPIENTS";
9871
+ return NotificationRecipientSendFlag;
9872
+ }({});
9873
+
9874
+ /**
9875
+ * Contains information about which recipients were already sent their messages, etc.
9876
+ */
9877
+
9878
+ class NotificationDocument extends AbstractFirestoreDocumentWithParent {
9879
+ get modelIdentity() {
9880
+ return notificationIdentity;
9881
+ }
9882
+ }
9883
+ const notificationConverter = snapshotConverterFunctions({
9884
+ fields: {
9885
+ st: firestoreEnum({
9886
+ default: NotificationSendType.SEND_IF_BOX_EXISTS
9887
+ }),
9888
+ rf: optionalFirestoreEnum(),
9889
+ ts: firestoreEnum({
9890
+ default: NotificationSendState.NONE
9891
+ }),
9892
+ es: firestoreEnum({
9893
+ default: NotificationSendState.NONE
9894
+ }),
9895
+ ps: firestoreEnum({
9896
+ default: NotificationSendState.NONE
9897
+ }),
9898
+ ns: firestoreEnum({
9899
+ default: NotificationSendState.NONE
9900
+ }),
9901
+ n: firestoreNotificationItem,
9902
+ r: firestoreObjectArray({
9903
+ objectField: firestoreNotificationRecipientWithConfig
9904
+ }),
9905
+ sat: firestoreDate(),
9906
+ a: firestoreNumber({
9907
+ default: 0
9908
+ }),
9909
+ d: firestoreBoolean({
9910
+ default: false
9911
+ }),
9912
+ tsr: firestoreUniqueStringArray(),
9913
+ esr: firestoreUniqueStringArray()
9914
+ }
9915
+ });
9916
+ function notificationCollectionReferenceFactory(context) {
9917
+ return notificationBox => {
9918
+ return context.subcollection(notificationBox.documentRef, notificationIdentity.collectionName);
9919
+ };
9920
+ }
9921
+ function notificationFirestoreCollectionFactory(firestoreContext) {
9922
+ const factory = notificationCollectionReferenceFactory(firestoreContext);
9923
+ return parent => {
9924
+ return firestoreContext.firestoreCollectionWithParent({
9925
+ modelIdentity: notificationIdentity,
9926
+ converter: notificationConverter,
9927
+ collection: factory(parent),
9928
+ makeDocument: (accessor, documentAccessor) => new NotificationDocument(accessor, documentAccessor),
9929
+ firestoreContext,
9930
+ parent
9931
+ });
9932
+ };
9933
+ }
9934
+ function notificationCollectionReference(context) {
9935
+ return context.collectionGroup(notificationIdentity.collectionName);
9936
+ }
9937
+ function notificationFirestoreCollectionGroup(firestoreContext) {
9938
+ return firestoreContext.firestoreCollectionGroup({
9939
+ modelIdentity: notificationIdentity,
9940
+ converter: notificationConverter,
9941
+ queryLike: notificationCollectionReference(firestoreContext),
9942
+ makeDocument: (accessor, documentAccessor) => new NotificationDocument(accessor, documentAccessor),
9943
+ firestoreContext
9944
+ });
9945
+ }
9946
+
9947
+ // MARK: Notification Week Data
9948
+ const notificationWeekIdentity = firestoreModelIdentity(notificationBoxIdentity, 'notificationWeek', 'nbnw');
9949
+
9950
+ /**
9951
+ * The maximum number of notifications that can be stored in a NotificationWeek.
9952
+ */
9953
+ const NOTIFICATION_WEEK_NOTIFICATION_ITEM_LIMIT = 5000;
9954
+
9955
+ /**
9956
+ * Notification week. Contains all notifications in the box for the given week.
9957
+ */
9958
+
9959
+ class NotificationWeekDocument extends AbstractFirestoreDocumentWithParent {
9960
+ get modelIdentity() {
9961
+ return notificationWeekIdentity;
9962
+ }
9963
+ }
9964
+ const notificationWeekConverter = snapshotConverterFunctions({
9965
+ fields: {
9966
+ w: firestoreNumber({
9967
+ default: UNKNOWN_YEAR_WEEK_CODE
9968
+ }),
9969
+ n: firestoreObjectArray({
9970
+ objectField: firestoreNotificationItem
9971
+ })
9972
+ }
9973
+ });
9974
+ function notificationWeekCollectionReferenceFactory(context) {
9975
+ return notificationBox => {
9976
+ return context.subcollection(notificationBox.documentRef, notificationWeekIdentity.collectionName);
9977
+ };
9978
+ }
9979
+ function notificationWeekFirestoreCollectionFactory(firestoreContext) {
9980
+ const factory = notificationWeekCollectionReferenceFactory(firestoreContext);
9981
+ return parent => {
9982
+ return firestoreContext.firestoreCollectionWithParent({
9983
+ modelIdentity: notificationWeekIdentity,
9984
+ converter: notificationWeekConverter,
9985
+ collection: factory(parent),
9986
+ makeDocument: (accessor, documentAccessor) => new NotificationWeekDocument(accessor, documentAccessor),
9987
+ firestoreContext,
9988
+ parent
9989
+ });
9990
+ };
9991
+ }
9992
+ function notificationWeekCollectionReference(context) {
9993
+ return context.collectionGroup(notificationWeekIdentity.collectionName);
9994
+ }
9995
+ function notificationWeekFirestoreCollectionGroup(firestoreContext) {
9996
+ return firestoreContext.firestoreCollectionGroup({
9997
+ modelIdentity: notificationWeekIdentity,
9998
+ converter: notificationWeekConverter,
9999
+ queryLike: notificationWeekCollectionReference(firestoreContext),
10000
+ makeDocument: (accessor, documentAccessor) => new NotificationWeekDocument(accessor, documentAccessor),
10001
+ firestoreContext
10002
+ });
10003
+ }
10004
+
10005
+ var _dec, _dec2, _dec3, _dec4, _dec5, _dec6, _dec7, _dec8, _dec9, _dec10, _dec11, _dec12, _dec13, _dec14, _dec15, _dec16, _dec17, _dec18, _dec19, _dec20, _dec21, _dec22, _dec23, _dec24, _dec25, _dec26, _dec27, _class, _descriptor, _descriptor2, _descriptor3, _descriptor4, _descriptor5, _descriptor6, _descriptor7, _dec28, _dec29, _dec30, _dec31, _class2, _descriptor8, _dec32, _dec33, _dec34, _dec35, _dec36, _dec37, _dec38, _dec39, _dec40, _dec41, _dec42, _dec43, _dec44, _dec45, _dec46, _dec47, _dec48, _dec49, _dec50, _dec51, _dec52, _dec53, _dec54, _dec55, _dec56, _dec57, _dec58, _dec59, _dec60, _dec61, _class3, _descriptor9, _descriptor10, _descriptor11, _descriptor12, _descriptor13, _descriptor14, _descriptor15, _dec62, _dec63, _dec64, _dec65, _dec66, _dec67, _dec68, _dec69, _dec70, _dec71, _dec72, _dec73, _dec74, _dec75, _dec76, _dec77, _dec78, _dec79, _class4, _descriptor16, _descriptor17, _descriptor18, _descriptor19, _dec80, _dec81, _dec82, _dec83, _dec84, _dec85, _dec86, _dec87, _dec88, _dec89, _dec90, _dec91, _dec92, _dec93, _dec94, _dec95, _dec96, _dec97, _dec98, _dec99, _dec100, _dec101, _dec102, _class5, _descriptor20, _descriptor21, _descriptor22, _descriptor23, _descriptor24, _descriptor25, _dec103, _dec104, _dec105, _dec106, _dec107, _dec108, _dec109, _dec110, _dec111, _dec112, _dec113, _dec114, _dec115, _dec116, _dec117, _dec118, _class6, _descriptor26, _descriptor27, _descriptor28, _dec119, _dec120, _dec121, _dec122, _class7, _descriptor29, _dec123, _dec124, _dec125, _dec126, _dec127, _dec128, _dec129, _dec130, _dec131, _class8, _descriptor30, _descriptor31, _dec132, _dec133, _dec134, _dec135, _class9, _descriptor32, _dec136, _dec137, _dec138, _dec139, _class10, _descriptor33, _dec140, _dec141, _dec142, _dec143, _dec144, _dec145, _dec146, _dec147, _dec148, _dec149, _dec150, _dec151, _dec152, _dec153, _dec154, _dec155, _dec156, _dec157, _dec158, _dec159, _dec160, _dec161, _dec162, _dec163, _class11, _descriptor34, _descriptor35, _descriptor36, _descriptor37, _descriptor38, _descriptor39, _dec164, _dec165, _dec166, _dec167, _dec168, _dec169, _dec170, _dec171, _dec172, _dec173, _dec174, _dec175, _dec176, _dec177, _dec178, _dec179, _dec180, _dec181, _class12, _descriptor40, _descriptor41, _descriptor42, _descriptor43, _dec182, _dec183, _dec184, _dec185, _dec186, _dec187, _dec188, _dec189, _class13, _descriptor44, _descriptor45;
10006
+ const NOTIFICATION_RECIPIENT_NAME_MIN_LENGTH = 0;
10007
+ const NOTIFICATION_RECIPIENT_NAME_MAX_LENGTH = 42;
10008
+ const NOTIFICATION_SUBJECT_MIN_LENGTH = 2;
10009
+ const NOTIFICATION_SUBJECT_MAX_LENGTH = 100;
10010
+ const NOTIFICATION_MESSAGE_MIN_LENGTH = 2;
10011
+ const NOTIFICATION_MESSAGE_MAX_LENGTH = 1000;
10012
+
10013
+ /**
10014
+ * Config entries are inserted, unless marked as remove.
10015
+ */
10016
+ let NotificationBoxRecipientTemplateConfigArrayEntryParam = (_dec = Expose(), _dec2 = IsString(), _dec3 = Reflect.metadata("design:type", String), _dec4 = Expose(), _dec5 = IsOptional(), _dec6 = IsBoolean(), _dec7 = Reflect.metadata("design:type", typeof Maybe === "undefined" ? Object : Maybe), _dec8 = Expose(), _dec9 = IsOptional(), _dec10 = IsBoolean(), _dec11 = Reflect.metadata("design:type", typeof Maybe === "undefined" ? Object : Maybe), _dec12 = Expose(), _dec13 = IsOptional(), _dec14 = IsBoolean(), _dec15 = Reflect.metadata("design:type", typeof Maybe === "undefined" ? Object : Maybe), _dec16 = Expose(), _dec17 = IsOptional(), _dec18 = IsBoolean(), _dec19 = Reflect.metadata("design:type", typeof Maybe === "undefined" ? Object : Maybe), _dec20 = Expose(), _dec21 = IsOptional(), _dec22 = IsBoolean(), _dec23 = Reflect.metadata("design:type", typeof Maybe === "undefined" ? Object : Maybe), _dec24 = Expose(), _dec25 = IsOptional(), _dec26 = IsBoolean(), _dec27 = Reflect.metadata("design:type", typeof Maybe === "undefined" ? Object : Maybe), (_class = class NotificationBoxRecipientTemplateConfigArrayEntryParam {
10017
+ constructor() {
10018
+ _initializerDefineProperty(this, "type", _descriptor, this);
10019
+ _initializerDefineProperty(this, "sd", _descriptor2, this);
10020
+ _initializerDefineProperty(this, "se", _descriptor3, this);
10021
+ _initializerDefineProperty(this, "st", _descriptor4, this);
10022
+ _initializerDefineProperty(this, "sp", _descriptor5, this);
10023
+ _initializerDefineProperty(this, "sn", _descriptor6, this);
10024
+ /**
10025
+ * If true, removes this configuration
10026
+ */
10027
+ _initializerDefineProperty(this, "remove", _descriptor7, this);
10028
+ }
10029
+ }, (_descriptor = _applyDecoratedDescriptor(_class.prototype, "type", [_dec, _dec2, _dec3], {
10030
+ configurable: true,
10031
+ enumerable: true,
10032
+ writable: true,
10033
+ initializer: null
10034
+ }), _descriptor2 = _applyDecoratedDescriptor(_class.prototype, "sd", [_dec4, _dec5, _dec6, _dec7], {
10035
+ configurable: true,
10036
+ enumerable: true,
10037
+ writable: true,
10038
+ initializer: null
10039
+ }), _descriptor3 = _applyDecoratedDescriptor(_class.prototype, "se", [_dec8, _dec9, _dec10, _dec11], {
10040
+ configurable: true,
10041
+ enumerable: true,
10042
+ writable: true,
10043
+ initializer: null
10044
+ }), _descriptor4 = _applyDecoratedDescriptor(_class.prototype, "st", [_dec12, _dec13, _dec14, _dec15], {
10045
+ configurable: true,
10046
+ enumerable: true,
10047
+ writable: true,
10048
+ initializer: null
10049
+ }), _descriptor5 = _applyDecoratedDescriptor(_class.prototype, "sp", [_dec16, _dec17, _dec18, _dec19], {
10050
+ configurable: true,
10051
+ enumerable: true,
10052
+ writable: true,
10053
+ initializer: null
10054
+ }), _descriptor6 = _applyDecoratedDescriptor(_class.prototype, "sn", [_dec20, _dec21, _dec22, _dec23], {
10055
+ configurable: true,
10056
+ enumerable: true,
10057
+ writable: true,
10058
+ initializer: null
10059
+ }), _descriptor7 = _applyDecoratedDescriptor(_class.prototype, "remove", [_dec24, _dec25, _dec26, _dec27], {
10060
+ configurable: true,
10061
+ enumerable: true,
10062
+ writable: true,
10063
+ initializer: null
10064
+ })), _class));
10065
+
10066
+ /**
10067
+ * Used for creating a new NotificationUser for a user.
10068
+ */
10069
+ let CreateNotificationUserParams = (_dec28 = Expose(), _dec29 = IsOptional(), _dec30 = IsFirestoreModelId(), _dec31 = Reflect.metadata("design:type", typeof FirebaseAuthUserId === "undefined" ? Object : FirebaseAuthUserId), (_class2 = class CreateNotificationUserParams {
10070
+ constructor() {
10071
+ /**
10072
+ * UID of the user to create the NotificationUser for.
10073
+ */
10074
+ _initializerDefineProperty(this, "uid", _descriptor8, this);
10075
+ }
10076
+ }, (_descriptor8 = _applyDecoratedDescriptor(_class2.prototype, "uid", [_dec28, _dec29, _dec30, _dec31], {
10077
+ configurable: true,
10078
+ enumerable: true,
10079
+ writable: true,
10080
+ initializer: null
10081
+ })), _class2));
10082
+
10083
+ /**
10084
+ * Used for updating the global or default config on a NotificationUser.
10085
+ */
10086
+ let UpdateNotificationUserDefaultNotificationBoxRecipientConfigParams = (_dec32 = Expose(), _dec33 = IsOptional(), _dec34 = IsNumber(), _dec35 = Reflect.metadata("design:type", typeof Maybe === "undefined" ? Object : Maybe), _dec36 = Expose(), _dec37 = IsOptional(), _dec38 = IsEmail(), _dec39 = Reflect.metadata("design:type", typeof Maybe === "undefined" ? Object : Maybe), _dec40 = Expose(), _dec41 = IsOptional(), _dec42 = IsE164PhoneNumber(), _dec43 = Reflect.metadata("design:type", typeof Maybe === "undefined" ? Object : Maybe), _dec44 = Expose(), _dec45 = IsOptional(), _dec46 = IsArray(), _dec47 = ValidateNested({
10087
+ each: true
10088
+ }), _dec48 = Type(() => NotificationBoxRecipientTemplateConfigArrayEntryParam), _dec49 = Reflect.metadata("design:type", typeof Maybe === "undefined" ? Object : Maybe), _dec50 = Expose(), _dec51 = IsBoolean(), _dec52 = IsOptional(), _dec53 = Reflect.metadata("design:type", typeof Maybe === "undefined" ? Object : Maybe), _dec54 = Expose(), _dec55 = IsBoolean(), _dec56 = IsOptional(), _dec57 = Reflect.metadata("design:type", typeof Maybe === "undefined" ? Object : Maybe), _dec58 = Expose(), _dec59 = IsOptional(), _dec60 = IsEnum(NotificationBoxRecipientFlag), _dec61 = Reflect.metadata("design:type", typeof Maybe === "undefined" ? Object : Maybe), (_class3 = class UpdateNotificationUserDefaultNotificationBoxRecipientConfigParams {
10089
+ constructor() {
10090
+ /**
10091
+ * NotificationBox recipient to update. Is ignored if UID is provided and matches a user. Used for external recipients/users.
10092
+ */
10093
+ _initializerDefineProperty(this, "i", _descriptor9, this);
10094
+ /**
10095
+ * Override email address
10096
+ */
10097
+ _initializerDefineProperty(this, "e", _descriptor10, this);
10098
+ /**
10099
+ * Override phone number
10100
+ */
10101
+ _initializerDefineProperty(this, "t", _descriptor11, this);
10102
+ /**
10103
+ * Array of configs that correspond with "c"
10104
+ */
10105
+ _initializerDefineProperty(this, "configs", _descriptor12, this);
10106
+ _initializerDefineProperty(this, "lk", _descriptor13, this);
10107
+ _initializerDefineProperty(this, "bk", _descriptor14, this);
10108
+ _initializerDefineProperty(this, "f", _descriptor15, this);
10109
+ }
10110
+ }, (_descriptor9 = _applyDecoratedDescriptor(_class3.prototype, "i", [_dec32, _dec33, _dec34, _dec35], {
10111
+ configurable: true,
10112
+ enumerable: true,
10113
+ writable: true,
10114
+ initializer: null
10115
+ }), _descriptor10 = _applyDecoratedDescriptor(_class3.prototype, "e", [_dec36, _dec37, _dec38, _dec39], {
10116
+ configurable: true,
10117
+ enumerable: true,
10118
+ writable: true,
10119
+ initializer: null
10120
+ }), _descriptor11 = _applyDecoratedDescriptor(_class3.prototype, "t", [_dec40, _dec41, _dec42, _dec43], {
10121
+ configurable: true,
10122
+ enumerable: true,
10123
+ writable: true,
10124
+ initializer: null
10125
+ }), _descriptor12 = _applyDecoratedDescriptor(_class3.prototype, "configs", [_dec44, _dec45, _dec46, _dec47, _dec48, _dec49], {
10126
+ configurable: true,
10127
+ enumerable: true,
10128
+ writable: true,
10129
+ initializer: null
10130
+ }), _descriptor13 = _applyDecoratedDescriptor(_class3.prototype, "lk", [_dec50, _dec51, _dec52, _dec53], {
10131
+ configurable: true,
10132
+ enumerable: true,
10133
+ writable: true,
10134
+ initializer: null
10135
+ }), _descriptor14 = _applyDecoratedDescriptor(_class3.prototype, "bk", [_dec54, _dec55, _dec56, _dec57], {
10136
+ configurable: true,
10137
+ enumerable: true,
10138
+ writable: true,
10139
+ initializer: null
10140
+ }), _descriptor15 = _applyDecoratedDescriptor(_class3.prototype, "f", [_dec58, _dec59, _dec60, _dec61], {
10141
+ configurable: true,
10142
+ enumerable: true,
10143
+ writable: true,
10144
+ initializer: null
10145
+ })), _class3));
10146
+ let UpdateNotificationBoxRecipientLikeParams = (_dec62 = Expose(), _dec63 = IsOptional(), _dec64 = IsEmail(), _dec65 = Reflect.metadata("design:type", typeof Maybe === "undefined" ? Object : Maybe), _dec66 = Expose(), _dec67 = IsOptional(), _dec68 = IsE164PhoneNumber(), _dec69 = Reflect.metadata("design:type", typeof Maybe === "undefined" ? Object : Maybe), _dec70 = Expose(), _dec71 = IsOptional(), _dec72 = IsPhoneNumber(), _dec73 = Reflect.metadata("design:type", typeof Maybe === "undefined" ? Object : Maybe), _dec74 = Expose(), _dec75 = IsOptional(), _dec76 = IsArray(), _dec77 = ValidateNested({
10147
+ each: true
10148
+ }), _dec78 = Type(() => NotificationBoxRecipientTemplateConfigArrayEntryParam), _dec79 = Reflect.metadata("design:type", typeof Maybe === "undefined" ? Object : Maybe), (_class4 = class UpdateNotificationBoxRecipientLikeParams {
10149
+ constructor() {
10150
+ /**
10151
+ * Override email address
10152
+ */
10153
+ _initializerDefineProperty(this, "e", _descriptor16, this);
10154
+ /**
10155
+ * Override phone number
10156
+ */
10157
+ _initializerDefineProperty(this, "t", _descriptor17, this);
10158
+ /**
10159
+ * Notification summary id
10160
+ */
10161
+ _initializerDefineProperty(this, "s", _descriptor18, this);
10162
+ /**
10163
+ * Array of configs
10164
+ */
10165
+ _initializerDefineProperty(this, "configs", _descriptor19, this);
10166
+ }
10167
+ }, (_descriptor16 = _applyDecoratedDescriptor(_class4.prototype, "e", [_dec62, _dec63, _dec64, _dec65], {
10168
+ configurable: true,
10169
+ enumerable: true,
10170
+ writable: true,
10171
+ initializer: null
10172
+ }), _descriptor17 = _applyDecoratedDescriptor(_class4.prototype, "t", [_dec66, _dec67, _dec68, _dec69], {
10173
+ configurable: true,
10174
+ enumerable: true,
10175
+ writable: true,
10176
+ initializer: null
10177
+ }), _descriptor18 = _applyDecoratedDescriptor(_class4.prototype, "s", [_dec70, _dec71, _dec72, _dec73], {
10178
+ configurable: true,
10179
+ enumerable: true,
10180
+ writable: true,
10181
+ initializer: null
10182
+ }), _descriptor19 = _applyDecoratedDescriptor(_class4.prototype, "configs", [_dec74, _dec75, _dec76, _dec77, _dec78, _dec79], {
10183
+ configurable: true,
10184
+ enumerable: true,
10185
+ writable: true,
10186
+ initializer: null
10187
+ })), _class4));
10188
+
10189
+ /**
10190
+ * Used for updating the target NotificationUserNotificationBoxRecipientConfig.
10191
+ */
10192
+ let UpdateNotificationUserNotificationBoxRecipientParams = (_dec80 = Expose(), _dec81 = IsFirestoreModelId(), _dec82 = Reflect.metadata("design:type", typeof NotificationBoxId === "undefined" ? Object : NotificationBoxId), _dec83 = Expose(), _dec84 = IsOptional(), _dec85 = IsBoolean(), _dec86 = Reflect.metadata("design:type", typeof Maybe === "undefined" ? Object : Maybe), _dec87 = Expose(), _dec88 = IsOptional(), _dec89 = IsBoolean(), _dec90 = Reflect.metadata("design:type", typeof Maybe === "undefined" ? Object : Maybe), _dec91 = Expose(), _dec92 = IsOptional(), _dec93 = IsBoolean(), _dec94 = Reflect.metadata("design:type", typeof Maybe === "undefined" ? Object : Maybe), _dec95 = Expose(), _dec96 = IsOptional(), _dec97 = IsEnum(() => NotificationBoxRecipientFlag), _dec98 = Reflect.metadata("design:type", typeof Maybe === "undefined" ? Object : Maybe), _dec99 = Expose(), _dec100 = IsOptional(), _dec101 = IsBoolean(), _dec102 = Reflect.metadata("design:type", typeof Maybe === "undefined" ? Object : Maybe), (_class5 = class UpdateNotificationUserNotificationBoxRecipientParams extends UpdateNotificationBoxRecipientLikeParams {
10193
+ constructor(...args) {
10194
+ super(...args);
10195
+ /**
10196
+ * NotificationBox config to update
10197
+ */
10198
+ _initializerDefineProperty(this, "nb", _descriptor20, this);
10199
+ _initializerDefineProperty(this, "rm", _descriptor21, this);
10200
+ _initializerDefineProperty(this, "lk", _descriptor22, this);
10201
+ _initializerDefineProperty(this, "bk", _descriptor23, this);
10202
+ _initializerDefineProperty(this, "f", _descriptor24, this);
10203
+ /**
10204
+ * Whether or not to delete this configuration entirely.
10205
+ *
10206
+ * Will only delete if rm is true and ns is false. Is ignored otherwise.
10207
+ */
10208
+ _initializerDefineProperty(this, "deleteRemovedConfig", _descriptor25, this);
10209
+ }
10210
+ }, (_descriptor20 = _applyDecoratedDescriptor(_class5.prototype, "nb", [_dec80, _dec81, _dec82], {
10211
+ configurable: true,
10212
+ enumerable: true,
10213
+ writable: true,
10214
+ initializer: null
10215
+ }), _descriptor21 = _applyDecoratedDescriptor(_class5.prototype, "rm", [_dec83, _dec84, _dec85, _dec86], {
10216
+ configurable: true,
10217
+ enumerable: true,
10218
+ writable: true,
10219
+ initializer: null
10220
+ }), _descriptor22 = _applyDecoratedDescriptor(_class5.prototype, "lk", [_dec87, _dec88, _dec89, _dec90], {
10221
+ configurable: true,
10222
+ enumerable: true,
10223
+ writable: true,
10224
+ initializer: null
10225
+ }), _descriptor23 = _applyDecoratedDescriptor(_class5.prototype, "bk", [_dec91, _dec92, _dec93, _dec94], {
10226
+ configurable: true,
10227
+ enumerable: true,
10228
+ writable: true,
10229
+ initializer: null
10230
+ }), _descriptor24 = _applyDecoratedDescriptor(_class5.prototype, "f", [_dec95, _dec96, _dec97, _dec98], {
10231
+ configurable: true,
10232
+ enumerable: true,
10233
+ writable: true,
10234
+ initializer: null
10235
+ }), _descriptor25 = _applyDecoratedDescriptor(_class5.prototype, "deleteRemovedConfig", [_dec99, _dec100, _dec101, _dec102], {
10236
+ configurable: true,
10237
+ enumerable: true,
10238
+ writable: true,
10239
+ initializer: null
10240
+ })), _class5));
10241
+
10242
+ /**
10243
+ * Used for updating the NotificationUser.
10244
+ */
10245
+ let UpdateNotificationUserParams = (_dec103 = Expose(), _dec104 = IsOptional(), _dec105 = ValidateNested(), _dec106 = Type(() => UpdateNotificationUserDefaultNotificationBoxRecipientConfigParams), _dec107 = Reflect.metadata("design:type", typeof Maybe === "undefined" ? Object : Maybe), _dec108 = Expose(), _dec109 = IsOptional(), _dec110 = ValidateNested(), _dec111 = Type(() => UpdateNotificationUserDefaultNotificationBoxRecipientConfigParams), _dec112 = Reflect.metadata("design:type", typeof Maybe === "undefined" ? Object : Maybe), _dec113 = Expose(), _dec114 = IsOptional(), _dec115 = IsArray(), _dec116 = ValidateNested({
10246
+ each: true
10247
+ }), _dec117 = Type(() => UpdateNotificationUserNotificationBoxRecipientParams), _dec118 = Reflect.metadata("design:type", typeof Maybe === "undefined" ? Object : Maybe), (_class6 = class UpdateNotificationUserParams extends TargetModelParams {
10248
+ constructor(...args) {
10249
+ super(...args);
10250
+ // TODO: update configs...
10251
+ _initializerDefineProperty(this, "gc", _descriptor26, this);
10252
+ _initializerDefineProperty(this, "dc", _descriptor27, this);
10253
+ _initializerDefineProperty(this, "bc", _descriptor28, this);
10254
+ }
10255
+ }, (_descriptor26 = _applyDecoratedDescriptor(_class6.prototype, "gc", [_dec103, _dec104, _dec105, _dec106, _dec107], {
10256
+ configurable: true,
10257
+ enumerable: true,
10258
+ writable: true,
10259
+ initializer: null
10260
+ }), _descriptor27 = _applyDecoratedDescriptor(_class6.prototype, "dc", [_dec108, _dec109, _dec110, _dec111, _dec112], {
10261
+ configurable: true,
10262
+ enumerable: true,
10263
+ writable: true,
10264
+ initializer: null
10265
+ }), _descriptor28 = _applyDecoratedDescriptor(_class6.prototype, "bc", [_dec113, _dec114, _dec115, _dec116, _dec117, _dec118], {
10266
+ configurable: true,
10267
+ enumerable: true,
10268
+ writable: true,
10269
+ initializer: null
10270
+ })), _class6));
10271
+ class ResyncNotificationUserParams extends TargetModelParams {}
10272
+ class ResyncAllNotificationUserParams {}
10273
+ /**
10274
+ * Used for creating a new NotificationSummary for a model.
10275
+ */
10276
+ let CreateNotificationSummaryParams = (_dec119 = Expose(), _dec120 = IsNotEmpty(), _dec121 = IsFirestoreModelKey(), _dec122 = Reflect.metadata("design:type", typeof FirestoreModelKey === "undefined" ? Object : FirestoreModelKey), (_class7 = class CreateNotificationSummaryParams {
10277
+ constructor() {
10278
+ /**
10279
+ * Model to create the NotificationSummary for.
10280
+ */
10281
+ _initializerDefineProperty(this, "model", _descriptor29, this);
10282
+ }
10283
+ }, (_descriptor29 = _applyDecoratedDescriptor(_class7.prototype, "model", [_dec119, _dec120, _dec121, _dec122], {
10284
+ configurable: true,
10285
+ enumerable: true,
10286
+ writable: true,
10287
+ initializer: null
10288
+ })), _class7));
10289
+
10290
+ /**
10291
+ * Used for updating the NotificationSummary.
10292
+ */
10293
+ let UpdateNotificationSummaryParams = (_dec123 = Expose(), _dec124 = IsOptional(), _dec125 = IsBoolean(), _dec126 = Reflect.metadata("design:type", typeof Maybe === "undefined" ? Object : Maybe), _dec127 = Expose(), _dec128 = IsOptional(), _dec129 = IsDate(), _dec130 = Type(() => Date), _dec131 = Reflect.metadata("design:type", typeof Maybe === "undefined" ? Object : Maybe), (_class8 = class UpdateNotificationSummaryParams extends TargetModelParams {
10294
+ constructor(...args) {
10295
+ super(...args);
10296
+ /**
10297
+ * Updates the "rat" time to now.
10298
+ */
10299
+ _initializerDefineProperty(this, "flagAllRead", _descriptor30, this);
10300
+ /**
10301
+ * Sets the "rat" time to the given date, or clears it.
10302
+ */
10303
+ _initializerDefineProperty(this, "setReadAtTime", _descriptor31, this);
10304
+ }
10305
+ }, (_descriptor30 = _applyDecoratedDescriptor(_class8.prototype, "flagAllRead", [_dec123, _dec124, _dec125, _dec126], {
10306
+ configurable: true,
10307
+ enumerable: true,
10308
+ writable: true,
10309
+ initializer: null
10310
+ }), _descriptor31 = _applyDecoratedDescriptor(_class8.prototype, "setReadAtTime", [_dec127, _dec128, _dec129, _dec130, _dec131], {
10311
+ configurable: true,
10312
+ enumerable: true,
10313
+ writable: true,
10314
+ initializer: null
10315
+ })), _class8));
10316
+
10317
+ /**
10318
+ * Used for creating or initializing a new NotificationBox for a model.
10319
+ *
10320
+ * Mainly used for testing. Not exposed to the API.
10321
+ *
10322
+ * The preferred way is to create a NotificationBox through a Notification.
10323
+ */
10324
+ let CreateNotificationBoxParams = (_dec132 = Expose(), _dec133 = IsNotEmpty(), _dec134 = IsFirestoreModelKey(), _dec135 = Reflect.metadata("design:type", typeof FirestoreModelKey === "undefined" ? Object : FirestoreModelKey), (_class9 = class CreateNotificationBoxParams {
10325
+ constructor() {
10326
+ _initializerDefineProperty(this, "model", _descriptor32, this);
10327
+ }
10328
+ }, (_descriptor32 = _applyDecoratedDescriptor(_class9.prototype, "model", [_dec132, _dec133, _dec134, _dec135], {
10329
+ configurable: true,
10330
+ enumerable: true,
10331
+ writable: true,
10332
+ initializer: null
10333
+ })), _class9));
10334
+
10335
+ /**
10336
+ * Used for initializing an uninitialized model like NotificationBox or NotificationSummary.
10337
+ */
10338
+ let InitializeNotificationModelParams = (_dec136 = Expose(), _dec137 = IsBoolean(), _dec138 = IsOptional(), _dec139 = Reflect.metadata("design:type", Boolean), (_class10 = class InitializeNotificationModelParams extends TargetModelParams {
10339
+ constructor(...args) {
10340
+ super(...args);
10341
+ /**
10342
+ * Whether or not to throw an error if the notification has already been sent or is being sent.
10343
+ */
10344
+ _initializerDefineProperty(this, "throwErrorIfAlreadyInitialized", _descriptor33, this);
10345
+ }
10346
+ }, (_descriptor33 = _applyDecoratedDescriptor(_class10.prototype, "throwErrorIfAlreadyInitialized", [_dec136, _dec137, _dec138, _dec139], {
10347
+ configurable: true,
10348
+ enumerable: true,
10349
+ writable: true,
10350
+ initializer: null
10351
+ })), _class10));
10352
+ class InitializeAllApplicableNotificationBoxesParams {}
10353
+ class InitializeAllApplicableNotificationSummariesParams {}
10354
+ /**
10355
+ * Used for updating the NotificationBox.
10356
+ */
10357
+ class UpdateNotificationBoxParams extends TargetModelParams {}
10358
+
10359
+ /**
10360
+ * Used to create/update a notification box recipient.
10361
+ */
10362
+ let UpdateNotificationBoxRecipientParams = (_dec140 = Expose(), _dec141 = IsNotEmpty(), _dec142 = IsFirestoreModelKey(), _dec143 = Reflect.metadata("design:type", typeof FirestoreModelKey === "undefined" ? Object : FirestoreModelKey), _dec144 = Expose(), _dec145 = IsOptional(), _dec146 = IsNumber(), _dec147 = Reflect.metadata("design:type", typeof Maybe === "undefined" ? Object : Maybe), _dec148 = Expose(), _dec149 = IsOptional(), _dec150 = IsFirestoreModelId(), _dec151 = Reflect.metadata("design:type", typeof Maybe === "undefined" ? Object : Maybe), _dec152 = Expose(), _dec153 = IsOptional(), _dec154 = IsBoolean(), _dec155 = Reflect.metadata("design:type", typeof Maybe === "undefined" ? Object : Maybe), _dec156 = Expose(), _dec157 = IsOptional(), _dec158 = IsBoolean(), _dec159 = Reflect.metadata("design:type", typeof Maybe === "undefined" ? Object : Maybe), _dec160 = Expose(), _dec161 = IsOptional(), _dec162 = IsBoolean(), _dec163 = Reflect.metadata("design:type", typeof Maybe === "undefined" ? Object : Maybe), (_class11 = class UpdateNotificationBoxRecipientParams extends UpdateNotificationBoxRecipientLikeParams {
10363
+ constructor(...args) {
10364
+ super(...args);
10365
+ /**
10366
+ * NotificationBox key to update.
10367
+ */
10368
+ _initializerDefineProperty(this, "key", _descriptor34, this);
10369
+ /**
10370
+ * NotificationBox recipient to update. Is ignored if UID is provided and matches a user. Used for external recipients/users.
10371
+ */
10372
+ _initializerDefineProperty(this, "i", _descriptor35, this);
10373
+ /**
10374
+ * Notification recipient to update by UID, if applicable.
10375
+ */
10376
+ _initializerDefineProperty(this, "uid", _descriptor36, this);
10377
+ /**
10378
+ * Whether or not to insert the user if they currently do not exist. Defaults to false.
10379
+ */
10380
+ _initializerDefineProperty(this, "insert", _descriptor37, this);
10381
+ /**
10382
+ * Whether or not to enable/disable the recipient from recieving items from this box.
10383
+ */
10384
+ _initializerDefineProperty(this, "enabled", _descriptor38, this);
10385
+ /**
10386
+ * Whether or not to remove the user if they exist. Defaults to false.
10387
+ */
10388
+ _initializerDefineProperty(this, "remove", _descriptor39, this);
10389
+ }
10390
+ }, (_descriptor34 = _applyDecoratedDescriptor(_class11.prototype, "key", [_dec140, _dec141, _dec142, _dec143], {
10391
+ configurable: true,
10392
+ enumerable: true,
10393
+ writable: true,
10394
+ initializer: null
10395
+ }), _descriptor35 = _applyDecoratedDescriptor(_class11.prototype, "i", [_dec144, _dec145, _dec146, _dec147], {
10396
+ configurable: true,
10397
+ enumerable: true,
10398
+ writable: true,
10399
+ initializer: null
10400
+ }), _descriptor36 = _applyDecoratedDescriptor(_class11.prototype, "uid", [_dec148, _dec149, _dec150, _dec151], {
10401
+ configurable: true,
10402
+ enumerable: true,
10403
+ writable: true,
10404
+ initializer: null
10405
+ }), _descriptor37 = _applyDecoratedDescriptor(_class11.prototype, "insert", [_dec152, _dec153, _dec154, _dec155], {
10406
+ configurable: true,
10407
+ enumerable: true,
10408
+ writable: true,
10409
+ initializer: null
10410
+ }), _descriptor38 = _applyDecoratedDescriptor(_class11.prototype, "enabled", [_dec156, _dec157, _dec158, _dec159], {
10411
+ configurable: true,
10412
+ enumerable: true,
10413
+ writable: true,
10414
+ initializer: null
10415
+ }), _descriptor39 = _applyDecoratedDescriptor(_class11.prototype, "remove", [_dec160, _dec161, _dec162, _dec163], {
10416
+ configurable: true,
10417
+ enumerable: true,
10418
+ writable: true,
10419
+ initializer: null
10420
+ })), _class11));
10421
+ let NotificationRecipientParams = (_dec164 = Expose(), _dec165 = IsOptional(), _dec166 = IsFirestoreModelId(), _dec167 = Reflect.metadata("design:type", typeof Maybe === "undefined" ? Object : Maybe), _dec168 = Expose(), _dec169 = IsOptional(), _dec170 = IsString(), _dec171 = MinLength(NOTIFICATION_RECIPIENT_NAME_MIN_LENGTH), _dec172 = MaxLength(NOTIFICATION_RECIPIENT_NAME_MAX_LENGTH), _dec173 = Reflect.metadata("design:type", typeof Maybe === "undefined" ? Object : Maybe), _dec174 = Expose(), _dec175 = IsOptional(), _dec176 = IsEmail(), _dec177 = Reflect.metadata("design:type", typeof Maybe === "undefined" ? Object : Maybe), _dec178 = Expose(), _dec179 = IsOptional(), _dec180 = IsPhoneNumber(), _dec181 = Reflect.metadata("design:type", typeof Maybe === "undefined" ? Object : Maybe), (_class12 = class NotificationRecipientParams {
10422
+ constructor() {
10423
+ /**
10424
+ * User to send the notification to.
10425
+ */
10426
+ _initializerDefineProperty(this, "uid", _descriptor40, this);
10427
+ /**
10428
+ * Recipient Name
10429
+ */
10430
+ _initializerDefineProperty(this, "un", _descriptor41, this);
10431
+ /**
10432
+ * Email address
10433
+ */
10434
+ _initializerDefineProperty(this, "e", _descriptor42, this);
10435
+ /**
10436
+ * Phone number
10437
+ */
10438
+ _initializerDefineProperty(this, "p", _descriptor43, this);
10439
+ }
10440
+ }, (_descriptor40 = _applyDecoratedDescriptor(_class12.prototype, "uid", [_dec164, _dec165, _dec166, _dec167], {
10441
+ configurable: true,
10442
+ enumerable: true,
10443
+ writable: true,
10444
+ initializer: null
10445
+ }), _descriptor41 = _applyDecoratedDescriptor(_class12.prototype, "un", [_dec168, _dec169, _dec170, _dec171, _dec172, _dec173], {
10446
+ configurable: true,
10447
+ enumerable: true,
10448
+ writable: true,
10449
+ initializer: null
10450
+ }), _descriptor42 = _applyDecoratedDescriptor(_class12.prototype, "e", [_dec174, _dec175, _dec176, _dec177], {
10451
+ configurable: true,
10452
+ enumerable: true,
10453
+ writable: true,
10454
+ initializer: null
10455
+ }), _descriptor43 = _applyDecoratedDescriptor(_class12.prototype, "p", [_dec178, _dec179, _dec180, _dec181], {
10456
+ configurable: true,
10457
+ enumerable: true,
10458
+ writable: true,
10459
+ initializer: null
10460
+ })), _class12));
10461
+
10462
+ /**
10463
+ * Used for sending the notification immediately, if it has not already been sent.
10464
+ */
10465
+ let SendNotificationParams = (_dec182 = Expose(), _dec183 = IsOptional(), _dec184 = IsBoolean(), _dec185 = Reflect.metadata("design:type", typeof Maybe === "undefined" ? Object : Maybe), _dec186 = Expose(), _dec187 = IsOptional(), _dec188 = IsBoolean(), _dec189 = Reflect.metadata("design:type", typeof Maybe === "undefined" ? Object : Maybe), (_class13 = class SendNotificationParams extends TargetModelParams {
10466
+ constructor(...args) {
10467
+ super(...args);
10468
+ /**
10469
+ * Whether or not to ignore the send at time. Defaults to false.
10470
+ */
10471
+ _initializerDefineProperty(this, "ignoreSendAtThrottle", _descriptor44, this);
10472
+ /**
10473
+ * Whether or not to throw an error if the notification has already been sent or is being sent.
10474
+ */
10475
+ _initializerDefineProperty(this, "throwErrorIfSent", _descriptor45, this);
10476
+ }
10477
+ }, (_descriptor44 = _applyDecoratedDescriptor(_class13.prototype, "ignoreSendAtThrottle", [_dec182, _dec183, _dec184, _dec185], {
10478
+ configurable: true,
10479
+ enumerable: true,
10480
+ writable: true,
10481
+ initializer: null
10482
+ }), _descriptor45 = _applyDecoratedDescriptor(_class13.prototype, "throwErrorIfSent", [_dec186, _dec187, _dec188, _dec189], {
10483
+ configurable: true,
10484
+ enumerable: true,
10485
+ writable: true,
10486
+ initializer: null
10487
+ })), _class13));
10488
+ /**
10489
+ * Used for sending queued notifications in the system.
10490
+ */
10491
+ class SendQueuedNotificationsParams {}
10492
+ /**
10493
+ * Used for sending queued notifications in the system.
10494
+ */
10495
+ class CleanupSentNotificationsParams {}
10496
+
10497
+ // MARK: Functions
10498
+
10499
+ const notificationFunctionTypeConfigMap = {};
10500
+ const notificationBoxModelCrudFunctionsConfig = {
10501
+ notificationUser: ['update:_,resync'],
10502
+ notificationSummary: ['update:_'],
10503
+ notificationBox: ['update:_,recipient']
10504
+ };
10505
+ class NotificationFunctions {
10506
+ constructor() {
10507
+ this.notificationUser = void 0;
10508
+ this.notificationSummary = void 0;
10509
+ this.notificationBox = void 0;
10510
+ }
10511
+ }
10512
+ const notificationFunctionMap = callModelFirebaseFunctionMapFactory(notificationFunctionTypeConfigMap, notificationBoxModelCrudFunctionsConfig);
10513
+
10514
+ const CREATE_NOTIFICATION_ID_REQUIRED_ERROR_CODE = 'CREATE_NOTIFICATION_ID_REQUIRED';
10515
+ const NOTIFICATION_MODEL_ALREADY_INITIALIZED_ERROR_CODE = 'NOTIFICATION_MODEL_ALREADY_INITIALIZED';
10516
+ const NOTIFICATION_BOX_EXISTS_FOR_MODEL_ERROR_CODE = 'NOTIFICATION_BOX_EXISTS_FOR_MODEL';
10517
+ const NOTIFICATION_BOX_RECIPIENT_DOES_NOT_EXIST_ERROR_CODE = 'NOTIFICATION_BOX_RECIPIENT_DOES_NOT_EXIST';
10518
+ const NOTIFICATION_USER_INVALID_UID_FOR_CREATE_ERROR_CODE = 'NOTIFICATION_USER_INVALID_UID_FOR_CREATE';
10519
+ const NOTIFICATION_USER_BLOCKED_FROM_BEING_ADD_TO_RECIPIENTS_ERROR_CODE = 'NOTIFICATION_USER_BLOCKED_FROM_BEING_ADD_TO_RECIPIENTS';
10520
+ const NOTIFICATION_USER_LOCKED_CONFIG_FROM_BEING_UPDATED_ERROR_CODE = 'NOTIFICATION_USER_LOCKED_CONFIG_FROM_BEING_UPDATED';
10521
+
10522
+ /**
10523
+ * The NotificationBox's id is the two way flat firestore model key of the object that it represents.
10524
+ */
10525
+
10526
+ /**
10527
+ * Creates a NotificationBoxId from the input FirestoreModelKey.
10528
+ *
10529
+ * @param modelKey
10530
+ * @returns
10531
+ */
10532
+ const notificationBoxIdForModel = twoWayFlatFirestoreModelKey;
10533
+ const inferNotificationBoxRelatedModelKey = inferKeyFromTwoWayFlatFirestoreModelKey;
10534
+ /**
10535
+ * Creates a NotificationSummaryId from the input FirestoreModelKey.
10536
+ *
10537
+ * @param modelKey
10538
+ * @returns
10539
+ */
10540
+ const notificationSummaryIdForModel = twoWayFlatFirestoreModelKey;
10541
+
10542
+ /**
10543
+ * Function used to retrieve a NotificationSummaryId given the input FirestoreAuthUserId.
10544
+ */
10545
+
10546
+ function notificationSummaryIdForUidFunctionForRootFirestoreModelIdentity(userModelIdentity) {
10547
+ return uid => twoWayFlatFirestoreModelKey(firestoreModelKey(userModelIdentity, uid));
10548
+ }
10549
+ /**
10550
+ * The default notification template type that can be provided to subscribe to notifications not specified in the configurations.
10551
+ */
10552
+ const DEFAULT_NOTIFICATION_TEMPLATE_TYPE = 'D';
10553
+
10554
+ /**
10555
+ * Template type identifier of the notification.
10556
+ *
10557
+ * Provides default information for the notification.
10558
+ *
10559
+ * Types are generally intended to be handled case-insensitively by notification services.
10560
+ *
10561
+ * Ideally type type values are shorter to reduce database size impact.
10562
+ */
10563
+
10564
+ /**
10565
+ * Updates a NotificationUserDefaultNotificationBoxRecipientConfig with the input UpdateNotificationUserDefaultNotificationBoxRecipientConfigParams.
10566
+ *
10567
+ * @param a
10568
+ * @param b
10569
+ * @returns
10570
+ */
10571
+ function updateNotificationBoxRecipientTemplateConfigRecord(a, b, limitToAllowedConfigTypes) {
10572
+ let c;
10573
+ if (b != null) {
10574
+ const cArray = notificationBoxRecipientTemplateConfigRecordToArray(a);
10575
+ let updatedC = ModelRelationUtility.insertCollection(cArray, b, {
10576
+ readKey: x => x.type,
10577
+ readType: () => 'x',
10578
+ merge: (x, y) => Object.assign({}, x, y)
10579
+ });
10580
+
10581
+ // remove types marked as remove
10582
+ updatedC = ModelRelationUtility.removeKeysFromCollection(updatedC, b.filter(x => x.remove).map(x => x.type), x => x.type);
10583
+ c = notificationBoxRecipientTemplateConfigArrayToRecord(updatedC);
10584
+
10585
+ // if the config types are limited to specific types, then filter those only
10586
+ if (limitToAllowedConfigTypes) {
10587
+ c = filterKeysOnPOJOFunction(limitToAllowedConfigTypes)(c);
10588
+ }
10589
+ }
10590
+ return c;
10591
+ }
10592
+
10593
+ /**
10594
+ * Updates a NotificationUserDefaultNotificationBoxRecipientConfig with the input UpdateNotificationUserDefaultNotificationBoxRecipientConfigParams.
10595
+ *
10596
+ * @param a
10597
+ * @param b
10598
+ * @returns
10599
+ */
10600
+ function updateNotificationUserDefaultNotificationBoxRecipientConfig(a, b, limitToAllowedConfigTypes) {
10601
+ var _ref;
10602
+ const {
10603
+ configs: inputC,
10604
+ f: inputF,
10605
+ bk: inputBk,
10606
+ lk: inputLk
10607
+ } = b;
10608
+ const c = (_ref = inputC != null ? updateNotificationBoxRecipientTemplateConfigRecord(a.c, inputC, limitToAllowedConfigTypes) : undefined) != null ? _ref : a.c;
10609
+ return Object.assign({}, updateNotificationRecipient(a, b), {
10610
+ c,
10611
+ f: updateMaybeValue(a.f, inputF),
10612
+ bk: updateMaybeValue(a.bk, inputBk),
10613
+ lk: updateMaybeValue(a.lk, inputLk)
10614
+ });
10615
+ }
10616
+ function updateNotificationUserNotificationBoxRecipientConfigIfChanged(a, b, limitToAllowedConfigTypes) {
10617
+ var _ref2;
10618
+ const {
10619
+ configs: inputC,
10620
+ rm: inputRm,
10621
+ lk: inputLk,
10622
+ bk: inputBk
10623
+ } = b;
10624
+ const c = (_ref2 = inputC != null ? updateNotificationBoxRecipientTemplateConfigRecord(a.c, inputC, limitToAllowedConfigTypes) : undefined) != null ? _ref2 : a.c;
10625
+ const nextConfig = Object.assign({}, updateNotificationRecipient(a, b), {
10626
+ c,
10627
+ rm: updateMaybeValue(a.rm, inputRm),
10628
+ lk: updateMaybeValue(a.lk, inputLk),
10629
+ bk: updateMaybeValue(a.bk, inputBk),
10630
+ // values remain the same
10631
+ ns: a.ns,
10632
+ nb: a.nb,
10633
+ i: a.i
10634
+ });
10635
+ const configChanged = !areEqualPOJOValuesUsingPojoFilter(nextConfig, a, filterOnlyUndefinedValues);
10636
+ let result;
10637
+ if (configChanged) {
10638
+ nextConfig.ns = a.i !== UNSET_INDEX_NUMBER; // needs sync unless i is unset
10639
+ result = nextConfig;
10640
+ }
10641
+ return result;
10642
+ }
10643
+
10644
+ /**
10645
+ * Updates the target NotificationUserNotificationBoxRecipientConfig array with the input UpdateNotificationUserNotificationBoxRecipientParams.
10646
+ *
10647
+ * If the target NotificationBox does not exist in the config, it is ignored.
10648
+ *
10649
+ * @param a
10650
+ * @param b
10651
+ */
10652
+ function updateNotificationUserNotificationBoxRecipientConfigs(a, b, filterWithService) {
10653
+ const boxesMap = makeModelMap(a, x => x.nb);
10654
+ let hasChanges = false;
10655
+ b.forEach(x => {
10656
+ const existingBox = boxesMap.get(x.nb);
10657
+ if (existingBox) {
10658
+ if (x.deleteRemovedConfig && existingBox.rm && existingBox.i === UNSET_INDEX_NUMBER) {
10659
+ // delete if marked as removed and already sync'd
10660
+ boxesMap.delete(x.nb);
10661
+ hasChanges = true;
10662
+ } else {
10663
+ let allowedConfigTypes;
10664
+ if (filterWithService && x.configs != null) {
10665
+ const modelKey = inferNotificationBoxRelatedModelKey(existingBox.nb);
10666
+ allowedConfigTypes = filterWithService.getTemplateTypesForNotificationModel(modelKey);
10667
+ }
10668
+
10669
+ // perform update
10670
+ const updatedConfig = updateNotificationUserNotificationBoxRecipientConfigIfChanged(existingBox, x, allowedConfigTypes);
10671
+ if (updatedConfig) {
10672
+ boxesMap.set(x.nb, updatedConfig);
10673
+ hasChanges = true;
10674
+ }
10675
+ }
10676
+ }
10677
+ });
10678
+ let result;
10679
+ if (hasChanges) {
10680
+ result = Array.from(boxesMap.values());
10681
+ }
10682
+ return result;
10683
+ }
10684
+
10685
+ /**
10686
+ * Template item for a new Notification
10687
+ */
10688
+
10689
+ /**
10690
+ * Template use for creating a new Notification
10691
+ */
10692
+
10693
+ function createNotificationTemplate(input) {
10694
+ const {
10695
+ notificationModel: inputNotification,
10696
+ type,
10697
+ // notification
10698
+ sendType,
10699
+ recipients,
10700
+ st,
10701
+ r,
10702
+ rf,
10703
+ sat,
10704
+ // item
10705
+ createdBy,
10706
+ targetModel: inputTargetModel,
10707
+ subject,
10708
+ message,
10709
+ data,
10710
+ cat,
10711
+ cb,
10712
+ s,
10713
+ m,
10714
+ g,
10715
+ d: inputD
10716
+ } = input;
10717
+ const notificationModel = readFirestoreModelKey(inputNotification);
10718
+ const targetModel = inputTargetModel ? readFirestoreModelKey(inputTargetModel) : undefined;
10719
+ let d = data != null ? data : inputD;
10720
+ if (d && objectHasNoKeys(d)) {
10721
+ d = undefined;
10722
+ }
10723
+ const template = {
10724
+ notificationModel,
10725
+ st: sendType != null ? sendType : st,
10726
+ sat,
10727
+ rf,
10728
+ r: recipients != null ? recipients : r,
10729
+ n: {
10730
+ cat,
10731
+ t: type,
10732
+ cb: createdBy != null ? createdBy : cb,
10733
+ m: targetModel != null ? targetModel : m,
10734
+ s: subject != null ? subject : s,
10735
+ g: message != null ? message : g,
10736
+ d
10737
+ }
10738
+ };
10739
+ return template;
10740
+ }
10741
+
10742
+ // MARK: Create
10743
+
10744
+ /**
10745
+ * Returns true if the notification should be created/sent, given the input.
10746
+ *
10747
+ * @param input
10748
+ * @returns
10749
+ */
10750
+ function shouldSendCreatedNotificationInput(input) {
10751
+ const {
10752
+ sendNotification,
10753
+ sendNotificationThrottleDate,
10754
+ sendNotificationThrottleTime: inputSendNotificationThrottleTime
10755
+ } = input;
10756
+ const sendNotificationThrottleTime = inputSendNotificationThrottleTime != null ? inputSendNotificationThrottleTime : MS_IN_HOUR;
10757
+ const isNotThrottled = sendNotificationThrottleDate ? timeHasExpired(sendNotificationThrottleDate, sendNotificationThrottleTime) : true;
10758
+ return sendNotification !== false && isNotThrottled;
10759
+ }
10760
+ /**
10761
+ * Creates a CreateNotificationDocumentPairResult from the input.
10762
+ *
10763
+ * Only creates a pair. Used createNotificationDocument() to also save the document's data.
10764
+ *
10765
+ * @param template
10766
+ */
10767
+ function createNotificationDocumentPair(input) {
10768
+ var _n$cat;
10769
+ const {
10770
+ template,
10771
+ accessor: inputAccessor,
10772
+ transaction,
10773
+ context
10774
+ } = input;
10775
+ const {
10776
+ notificationModel,
10777
+ st,
10778
+ sat,
10779
+ r,
10780
+ rf,
10781
+ n,
10782
+ ts,
10783
+ es,
10784
+ ps,
10785
+ ns
10786
+ } = template;
10787
+ let accessor = inputAccessor;
10788
+ const notificationBoxId = notificationBoxIdForModel(notificationModel);
10789
+ if (!accessor && notificationBoxId) {
10790
+ if (context) {
10791
+ const {
10792
+ notificationCollectionFactory,
10793
+ notificationBoxCollection
10794
+ } = context;
10795
+ const notificationBoxDocument = notificationBoxCollection.documentAccessorForTransaction(transaction).loadDocumentForId(notificationBoxId);
10796
+ accessor = notificationCollectionFactory(notificationBoxDocument).documentAccessorForTransaction(transaction);
10797
+ }
10798
+ }
10799
+ if (!accessor) {
10800
+ throw new Error('createNotificationDocument() failed as neither an accessor nor sufficient information was provided about the target.');
10801
+ }
10802
+ const notificationDocument = accessor.newDocument();
10803
+ const id = notificationDocument.id;
10804
+ const notification = {
10805
+ st: st != null ? st : NotificationSendType.INIT_BOX_AND_SEND,
10806
+ sat: sat != null ? sat : new Date(),
10807
+ rf,
10808
+ r: r != null ? r : [],
10809
+ n: {
10810
+ id,
10811
+ cat: (_n$cat = n.cat) != null ? _n$cat : new Date(),
10812
+ t: n.t,
10813
+ cb: n.cb,
10814
+ m: n.m,
10815
+ s: n.s,
10816
+ g: n.g,
10817
+ d: n.d
10818
+ },
10819
+ a: 0,
10820
+ d: false,
10821
+ tsr: [],
10822
+ esr: [],
10823
+ ts: ts != null ? ts : NotificationSendState.QUEUED,
10824
+ es: es != null ? es : NotificationSendState.QUEUED,
10825
+ ps: ps != null ? ps : NotificationSendState.QUEUED,
10826
+ ns: ns != null ? ns : NotificationSendState.QUEUED
10827
+ };
10828
+ return {
10829
+ notificationDocument,
10830
+ notification,
10831
+ notificationCreated: false
10832
+ };
10833
+ }
10834
+
10835
+ /**
10836
+ * Creates a new Notification and saves it to Firestore. Returns the pair.
10837
+ *
10838
+ * @param input
10839
+ */
10840
+ async function createNotificationDocument(input) {
10841
+ const pair = createNotificationDocumentPair(input);
10842
+ const {
10843
+ notification,
10844
+ notificationDocument
10845
+ } = pair;
10846
+ if (input.shouldCreateNotification !== false && shouldSendCreatedNotificationInput(input)) {
10847
+ await notificationDocument.create(notification);
10848
+ pair.notificationCreated = true;
10849
+ }
10850
+ return pair;
10851
+ }
10852
+
10853
+ /**
10854
+ * Creates a new Notification and saves it to Firestore and returns the pair if sendNotification in the input is not false.
10855
+ *
10856
+ * @param input
10857
+ * @returns
10858
+ */
10859
+ async function createNotificationDocumentIfSending(input) {
10860
+ const pair = await createNotificationDocument(input);
10861
+ if (pair.notificationCreated) {
10862
+ return pair;
10863
+ } else {
10864
+ return undefined;
10865
+ }
10866
+ }
10867
+
10868
+ /**
10869
+ * Template type identifier of the notification.
10870
+ *
10871
+ * Provides default information for the notification.
10872
+ *
10873
+ * Types are generally intended to be handled case-insensitively by notification services.
10874
+ */
10875
+
10876
+ /**
10877
+ * Record of NotificationTemplateTypeInfo keyed by type.
10878
+ */
10879
+
10880
+ /**
10881
+ * Creates a NotificationTemplateTypeInfoRecord from the input details array.
10882
+ *
10883
+ * @param infoArray
10884
+ * @returns
10885
+ */
10886
+ function notificationTemplateTypeDetailsRecord(infoArray) {
10887
+ const record = {};
10888
+ infoArray.forEach(x => {
10889
+ const {
10890
+ type
10891
+ } = x;
10892
+ if (record[type]) {
10893
+ throw new Error(`notificationTemplateTypeDetailsRecord(): duplicate NotificationTemplateType in record: ${type}`);
10894
+ }
10895
+ record[type] = x;
10896
+ });
10897
+ return record;
10898
+ }
10899
+
10900
+ /**
10901
+ * Reference to a NotificationTemplateTypeInfoRecord that contains a AppNotificationTemplateTypeInfoRecordService
10902
+ */
10903
+
10904
+ class AppNotificationTemplateTypeInfoRecordService {
10905
+ constructor() {
10906
+ /**
10907
+ * All records for this app.
10908
+ */
10909
+ this.appNotificationTemplateTypeInfoRecord = void 0;
10910
+ }
10911
+ /**
10912
+ * Returns the array of all known NotificationTemplateTypes
10913
+ */
10914
+ /**
10915
+ * Returns the array of all known NotificationTemplateTypeInfo
10916
+ */
10917
+ /**
10918
+ * Returns all individual FirestoreModelIdentity values that are associate with atleast one NotificationTemplateType.
10919
+ */
10920
+ /**
10921
+ * Returns all NotificationTemplateTypes that are associate with the given model input.
10922
+ *
10923
+ * @param model
10924
+ */
10925
+ /**
10926
+ * Returns all NotificationTemplateTypeInfo that are associate with the given model input.
10927
+ *
10928
+ * @param model
10929
+ */
10930
+ /**
10931
+ * Returns all NotificationTemplateTypes that are associate with the given model input.
10932
+ *
10933
+ * @param model
10934
+ */
10935
+ /**
10936
+ * Returns all NotificationTemplateTypeInfo that are associate with the given model input.
10937
+ *
10938
+ * @param model
10939
+ */
10940
+ }
10941
+ function appNotificationTemplateTypeInfoRecordService(appNotificationTemplateTypeInfoRecord) {
10942
+ const allNotificationModelIdentityValuesSet = new Set();
10943
+ const notificationModelTypeDetailsMapBuilder = multiValueMapBuilder();
10944
+ const targetModelTypeDetailsMapBuilder = multiValueMapBuilder();
10945
+ const allKnownTemplateTypes = [];
10946
+ const allKnownTemplateTypeDetails = [];
10947
+ Object.entries(appNotificationTemplateTypeInfoRecord).forEach(([_, details]) => {
10948
+ var _details$targetModelI, _details$targetModelI2;
10949
+ const {
10950
+ collectionType
10951
+ } = details.notificationModelIdentity;
10952
+ notificationModelTypeDetailsMapBuilder.add(collectionType, details);
10953
+ targetModelTypeDetailsMapBuilder.add((_details$targetModelI = (_details$targetModelI2 = details.targetModelIdentity) == null ? void 0 : _details$targetModelI2.collectionType) != null ? _details$targetModelI : collectionType, details);
10954
+ allNotificationModelIdentityValuesSet.add(details.notificationModelIdentity);
10955
+ allKnownTemplateTypeDetails.push(details);
10956
+ allKnownTemplateTypes.push(details.type);
10957
+ });
10958
+ const allNotificationModelIdentityValues = Array.from(allNotificationModelIdentityValuesSet);
10959
+ const notificationModelTemplateDetailsMap = notificationModelTypeDetailsMapBuilder.map();
10960
+ const targetModelTemplateDetailsMap = targetModelTypeDetailsMapBuilder.map();
10961
+ const notificationModelTemplateTypesMap = new Map(Array.from(notificationModelTemplateDetailsMap.entries()).map(([k, x]) => [k, x.map(y => y.type)]));
10962
+ const targetModelTemplateTypesMap = new Map(Array.from(targetModelTemplateDetailsMap.entries()).map(([k, x]) => [k, x.map(y => y.type)]));
10963
+ const service = {
10964
+ appNotificationTemplateTypeInfoRecord,
10965
+ getAllKnownTemplateTypes() {
10966
+ return allKnownTemplateTypes;
10967
+ },
10968
+ getAllKnownTemplateTypeDetails() {
10969
+ return allKnownTemplateTypeDetails;
10970
+ },
10971
+ getAllNotificationModelIdentityValues() {
10972
+ return allNotificationModelIdentityValues;
10973
+ },
10974
+ getTemplateTypesForNotificationModel(model) {
10975
+ var _notificationModelTem;
10976
+ const modelKey = readFirestoreModelKey(model, true);
10977
+ const firestoreCollectionType = firestoreModelKeyCollectionType(modelKey);
10978
+ return (_notificationModelTem = notificationModelTemplateTypesMap.get(firestoreCollectionType)) != null ? _notificationModelTem : [];
10979
+ },
10980
+ getTemplateTypesDetailsForNotificationModel(model) {
10981
+ var _notificationModelTem2;
10982
+ const modelKey = readFirestoreModelKey(model, true);
10983
+ const firestoreCollectionType = firestoreModelKeyCollectionType(modelKey);
10984
+ return (_notificationModelTem2 = notificationModelTemplateDetailsMap.get(firestoreCollectionType)) != null ? _notificationModelTem2 : [];
10985
+ },
10986
+ getTemplateTypesForTargetModel(target) {
10987
+ var _targetModelTemplateT;
10988
+ const targetModelKey = readFirestoreModelKey(target, true);
10989
+ const targetFirestoreCollectionType = firestoreModelKeyCollectionType(targetModelKey);
10990
+ return (_targetModelTemplateT = targetModelTemplateTypesMap.get(targetFirestoreCollectionType)) != null ? _targetModelTemplateT : [];
10991
+ },
10992
+ getTemplateTypesDetailsForTargetModel(target) {
10993
+ var _targetModelTemplateD;
10994
+ const targetModelKey = readFirestoreModelKey(target, true);
10995
+ const targetFirestoreCollectionType = firestoreModelKeyCollectionType(targetModelKey);
10996
+ return (_targetModelTemplateD = targetModelTemplateDetailsMap.get(targetFirestoreCollectionType)) != null ? _targetModelTemplateD : [];
10997
+ }
10998
+ };
10999
+ return service;
11000
+ }
11001
+
11002
+ /**
11003
+ * Contextual information when
11004
+ */
11005
+
11006
+ /**
11007
+ * Arbitrary template name/key that is used to configure which template to use by the sending service.
11008
+ */
11009
+
11010
+ /**
11011
+ * Generic notification message content.
11012
+ */
11013
+
11014
+ let NotificationMessageFlag = /*#__PURE__*/function (NotificationMessageFlag) {
11015
+ NotificationMessageFlag[NotificationMessageFlag["NONE"] = 0] = "NONE";
11016
+ NotificationMessageFlag[NotificationMessageFlag["NO_CONTENT"] = 1] = "NO_CONTENT";
11017
+ NotificationMessageFlag[NotificationMessageFlag["DO_NOT_SEND"] = 2] = "DO_NOT_SEND";
11018
+ return NotificationMessageFlag;
11019
+ }({});
11020
+
11021
+ /**
11022
+ * A NotificationMessage is the final result of the expanded notification.
11023
+ */
11024
+
11025
+ /**
11026
+ * Creates a NotificationMessageFunction from the input config.
11027
+ */
11028
+
11029
+ /**
11030
+ * Converts a NotificationMessageContext to a NotificationMessage.
11031
+ */
11032
+
11033
+ /**
11034
+ * Creates a NotificationMessageFunction from the input.
11035
+ *
11036
+ * @param fn
11037
+ * @param extras
11038
+ * @returns
11039
+ */
11040
+ function notificationMessageFunction(fn, extras) {
11041
+ if (extras) {
11042
+ const fnWithExtras = fn;
11043
+ fnWithExtras.globalRecipients = extras.globalRecipients;
11044
+ return fnWithExtras;
11045
+ } else {
11046
+ return fn;
11047
+ }
11048
+ }
11049
+ function noContentNotificationMessageFunctionFactory() {
11050
+ return async config => {
11051
+ // const { item } = config;
11052
+ return async inputContext => {
11053
+ const result = {
11054
+ flag: NotificationMessageFlag.NO_CONTENT,
11055
+ inputContext,
11056
+ content: {
11057
+ title: 'n/a'
11058
+ }
11059
+ };
11060
+ return result;
11061
+ };
11062
+ };
11063
+ }
11064
+
11065
+ // MARK: NotificationUser
11066
+ /**
11067
+ * Query for notificationUsers that are flagged for initialization.
11068
+ *
11069
+ * @param now
11070
+ * @returns
11071
+ */
11072
+ function notificationUsersFlaggedForNeedsSyncQuery() {
11073
+ return [where('ns', '==', true)];
11074
+ }
11075
+
11076
+ // MARK: NotificationSummary
11077
+ /**
11078
+ * Query for notificationSummaries that are flagged for initialization.
11079
+ *
11080
+ * @param now
11081
+ * @returns
11082
+ */
11083
+ function notificationSummariesFlaggedForNeedsInitializationQuery() {
11084
+ return [where('s', '==', true)];
11085
+ }
11086
+
11087
+ // MARK: NotificationBox
11088
+ /**
11089
+ * Query for notificationBoxes that are flagged for initialization.
11090
+ *
11091
+ * @param now
11092
+ * @returns
11093
+ */
11094
+ function notificationBoxesFlaggedForNeedsInitializationQuery() {
11095
+ return [where('s', '==', true)];
11096
+ }
11097
+
11098
+ /**
11099
+ * Query for notificationBoxes that are flagged as invalid.
11100
+ *
11101
+ * @param now
11102
+ * @returns
11103
+ */
11104
+ function notificationBoxesFlaggedInvalidQuery() {
11105
+ return [where('fi', '==', true)];
11106
+ }
11107
+
11108
+ // MARK: Notifcation
11109
+ /**
11110
+ * Query for notifications that are not done and the send at time is in the past.
11111
+ *
11112
+ * @param now
11113
+ * @returns
11114
+ */
11115
+ function notificationsPastSendAtTimeQuery(now = new Date()) {
11116
+ return [where('d', '==', false), where('sat', '<=', toISODateString(now))];
11117
+ }
11118
+
11119
+ /**
11120
+ * Query for notifications that are marked ready for cleanup/deletion.
11121
+ *
11122
+ * @param now
11123
+ * @returns
11124
+ */
11125
+ function notificationsReadyForCleanupQuery() {
11126
+ return [where('d', '==', true)
11127
+ // orderByDocumentId('asc') // todo: consider using orderby to get notificationboxes sorted
11128
+ ];
11129
+ }
11130
+
11131
+ function mergeNotificationSendMessagesResult(a, b) {
11132
+ var _a$success, _b$success, _a$failed, _b$failed, _a$ignored, _b$ignored;
11133
+ return {
11134
+ success: [...((_a$success = a == null ? void 0 : a.success) != null ? _a$success : []), ...((_b$success = b == null ? void 0 : b.success) != null ? _b$success : [])],
11135
+ failed: [...((_a$failed = a == null ? void 0 : a.failed) != null ? _a$failed : []), ...((_b$failed = b == null ? void 0 : b.failed) != null ? _b$failed : [])],
11136
+ ignored: [...((_a$ignored = a == null ? void 0 : a.ignored) != null ? _a$ignored : []), ...((_b$ignored = b == null ? void 0 : b.ignored) != null ? _b$ignored : [])]
11137
+ };
11138
+ }
11139
+
11140
+ // MARK: NotificationUser
11141
+
11142
+ function effectiveNotificationBoxRecipientConfig(input) {
11143
+ var _recipient$i, _ref, _gc$f, _gc$lk, _gc$e, _gc$t;
11144
+ const {
11145
+ uid,
11146
+ m: inputM,
11147
+ appNotificationTemplateTypeInfoRecordService,
11148
+ gc,
11149
+ boxConfig: notificationUserNotificationBoxConfig,
11150
+ recipient
11151
+ } = input;
11152
+ const m = inputM != null ? inputM : inferKeyFromTwoWayFlatFirestoreModelKey(notificationUserNotificationBoxConfig.nb);
11153
+ const applicableTemplateTypesForModel = appNotificationTemplateTypeInfoRecordService.getTemplateTypesForNotificationModel(m);
11154
+ const filterOnlyApplicableTemplateTypes = filterKeysOnPOJOFunction(applicableTemplateTypesForModel);
11155
+
11156
+ // retain only the relevant/applicable template types for the model associate with the notification box
11157
+ const c = filterOnlyApplicableTemplateTypes(Object.assign({}, recipient == null ? void 0 : recipient.c, notificationUserNotificationBoxConfig.c, gc.c));
11158
+ const nextRecipient = Object.assign({}, recipient, {
11159
+ c,
11160
+ uid,
11161
+ // index and uid are retained
11162
+ i: (_recipient$i = recipient == null ? void 0 : recipient.i) != null ? _recipient$i : notificationUserNotificationBoxConfig.i,
11163
+ // copy from NotificationUser
11164
+ f: (_ref = (_gc$f = gc.f) != null ? _gc$f : notificationUserNotificationBoxConfig.f) != null ? _ref : recipient == null ? void 0 : recipient.f,
11165
+ lk: (_gc$lk = gc.lk) != null ? _gc$lk : notificationUserNotificationBoxConfig.lk,
11166
+ // lock state only comes from NotificationUser
11167
+ // email and text overrides first come from global, then the NotificationBox specific config
11168
+ e: (_gc$e = gc.e) != null ? _gc$e : notificationUserNotificationBoxConfig.e,
11169
+ t: (_gc$t = gc.t) != null ? _gc$t : notificationUserNotificationBoxConfig.t,
11170
+ // no custom name or notification summary allowed
11171
+ n: undefined,
11172
+ s: undefined // should never be defined since uid is defined
11173
+ });
11174
+
11175
+ return nextRecipient;
11176
+ }
11177
+
11178
+ // MARK: Notification
11179
+ /**
11180
+ * Returns true if the notification's send types are all marked as sent.
11181
+ *
11182
+ * @param input
11183
+ * @returns
11184
+ */
11185
+ function notificationSendFlagsImplyIsComplete(input) {
11186
+ return isCompleteNotificationSendState(input.es) && isCompleteNotificationSendState(input.ps) && isCompleteNotificationSendState(input.ts) && isCompleteNotificationSendState(input.ns);
11187
+ }
11188
+
11189
+ /**
11190
+ * Returns true if the state implies completion of sending (not necessarily success, but that attempts to send are done)
11191
+ *
11192
+ * @param input
11193
+ * @returns
11194
+ */
11195
+ function isCompleteNotificationSendState(input) {
11196
+ let isComplete = false;
11197
+ switch (input) {
11198
+ case NotificationSendState.NONE:
11199
+ case NotificationSendState.NO_TRY:
11200
+ case NotificationSendState.SENT:
11201
+ case NotificationSendState.SKIPPED:
11202
+ isComplete = true;
11203
+ break;
11204
+ default:
11205
+ isComplete = false;
11206
+ break;
11207
+ }
11208
+ return isComplete;
11209
+ }
11210
+ /**
11211
+ * Returns a AllowedNotificationRecipients from the input NotificationRecipientSendFlag.
11212
+ *
11213
+ * @param flag
11214
+ * @returns
11215
+ */
11216
+ function allowedNotificationRecipients(flag) {
11217
+ let canSendToGlobalRecipients = true;
11218
+ let canSendToBoxRecipients = true;
11219
+ let canSendToExplicitRecipients = true;
11220
+ switch (flag) {
11221
+ case NotificationRecipientSendFlag.SKIP_NOTIFICATION_BOX_RECIPIENTS:
11222
+ canSendToBoxRecipients = false;
11223
+ break;
11224
+ case NotificationRecipientSendFlag.SKIP_GLOBAL_RECIPIENTS:
11225
+ canSendToGlobalRecipients = false;
11226
+ break;
11227
+ case NotificationRecipientSendFlag.ONLY_EXPLICIT_RECIPIENTS:
11228
+ canSendToBoxRecipients = false;
11229
+ canSendToGlobalRecipients = false;
11230
+ break;
11231
+ case NotificationRecipientSendFlag.ONLY_GLOBAL_RECIPIENTS:
11232
+ canSendToBoxRecipients = false;
11233
+ canSendToExplicitRecipients = false;
11234
+ break;
11235
+ case NotificationRecipientSendFlag.NORMAL:
11236
+ }
11237
+ return {
11238
+ canSendToGlobalRecipients,
11239
+ canSendToBoxRecipients,
11240
+ canSendToExplicitRecipients
11241
+ };
11242
+ }
11243
+
11244
+ // MARK: NotificationWeek
11245
+ /**
11246
+ * Whether or not the Notification should be saved to the NotificationWeek.
11247
+ *
11248
+ * A Notification should only be saved when the notification can be sent to box recipients.
11249
+ *
11250
+ * @param notification
11251
+ * @returns
11252
+ */
11253
+ function shouldSaveNotificationToNotificationWeek(notification) {
11254
+ return allowedNotificationRecipients(notification.rf).canSendToBoxRecipients;
11255
+ }
11256
+
11257
+ // MARK: NotificationBox
11258
+ function mergeNotificationUserNotificationBoxRecipientConfigs(a, b) {
11259
+ var _b$f;
11260
+ return Object.assign({}, mergeNotificationBoxRecipients(a, b), {
11261
+ // retain the following states always
11262
+ f: a.f === NotificationBoxRecipientFlag.OPT_OUT ? a.f : (_b$f = b.f) != null ? _b$f : a.f,
11263
+ // do not override if marked OPT OUT
11264
+ nb: a.nb,
11265
+ rm: a.rm,
11266
+ ns: a.ns,
11267
+ lk: a.lk,
11268
+ bk: a.bk
11269
+ });
11270
+ }
11271
+ function mergeNotificationBoxRecipients(a, b) {
11272
+ return Object.assign({}, a, b, {
11273
+ // configs should be merged/ovewritten
11274
+ c: Object.assign({}, a.c, b.c)
11275
+ });
11276
+ }
11277
+
9273
11278
  // MARK: Collection
9274
11279
  class SystemStateFirestoreCollections {
9275
11280
  constructor() {
@@ -9341,4 +11346,4 @@ function systemStateFirestoreCollection(firestoreContext, converters) {
9341
11346
  });
9342
11347
  }
9343
11348
 
9344
- export { AbstractFirestoreDocument, AbstractFirestoreDocumentDataAccessorWrapper, AbstractFirestoreDocumentWithParent, BASE_MODEL_STORAGE_FILE_PATH, CALL_MODEL_APP_FUNCTION_KEY, COPY_USER_RELATED_DATA_ACCESSOR_FACTORY_FUNCTION, ContextGrantedModelRolesReaderInstance, DEFAULT_DATE_CELL_RANGE_VALUE, DEFAULT_FIRESTORE_DATE_CELL_SCHEDULE_VALUE, DEFAULT_FIRESTORE_ITEM_PAGE_ITERATOR_ITEMS_PER_PAGE, DEFAULT_FIRESTORE_STRING_FIELD_VALUE, DEFAULT_FIRESTORE_UNITED_STATES_ADDRESS_VALUE, DEFAULT_FIRESTORE_WEBSITE_FILE_LINK_VALUE, DEFAULT_ITERATE_FIRESTORE_DOCUMENT_SNAPSHOT_BATCHES_BATCH_SIZE, DEFAULT_QUERY_CHANGE_WATCHER_DELAY, DEFAULT_SINGLE_ITEM_FIRESTORE_COLLECTION_DOCUMENT_IDENTIFIER, DEFAULT_WEBSITE_LINK, FIREBASE_AUTH_NETWORK_REQUEST_ERROR, FIREBASE_AUTH_NETWORK_REQUEST_FAILED, FIREBASE_AUTH_PASSWORD_MAX_LENGTH, FIREBASE_AUTH_PASSWORD_MIN_LENGTH, FIREBASE_AUTH_USER_NOT_FOUND_ERROR, FIREBASE_AUTH_WRONG_PASSWORD, FIREBASE_DEVELOPMENT_FUNCTIONS_MAP_KEY, FIREBASE_SERVER_AUTH_CLAIMS_RESET_LAST_COM_DATE_KEY, FIREBASE_SERVER_AUTH_CLAIMS_RESET_PASSWORD_KEY, FIREBASE_SERVER_AUTH_CLAIMS_SETUP_LAST_COM_DATE_KEY, FIREBASE_SERVER_AUTH_CLAIMS_SETUP_PASSWORD_KEY, FIRESTORE_CLIENT_QUERY_CONSTRAINT_HANDLER_MAPPING, FIRESTORE_COLLECTION_NAME_SEPARATOR, FIRESTORE_DUMMY_MODEL_KEY, FIRESTORE_EMPTY_VALUE, FIRESTORE_END_AT_QUERY_CONSTRAINT_TYPE, FIRESTORE_END_AT_VALUE_QUERY_CONSTRAINT_TYPE, FIRESTORE_END_BEFORE_QUERY_CONSTRAINT_TYPE, FIRESTORE_ITEM_PAGE_ITERATOR, FIRESTORE_ITEM_PAGE_ITERATOR_DELEGATE, FIRESTORE_LIMIT_QUERY_CONSTRAINT_TYPE, FIRESTORE_LIMIT_TO_LAST_QUERY_CONSTRAINT_TYPE, FIRESTORE_MAX_WHERE_IN_FILTER_ARGS_COUNT, FIRESTORE_MODEL_ID_REGEX, FIRESTORE_MODEL_KEY_REGEX, FIRESTORE_MODEL_KEY_REGEX_STRICT, FIRESTORE_OFFSET_QUERY_CONSTRAINT_TYPE, FIRESTORE_ORDER_BY_DOCUMENT_ID_QUERY_CONSTRAINT_TYPE, FIRESTORE_ORDER_BY_QUERY_CONSTRAINT_TYPE, FIRESTORE_PASSTHROUGH_FIELD, FIRESTORE_START_AFTER_QUERY_CONSTRAINT_TYPE, FIRESTORE_START_AT_QUERY_CONSTRAINT_TYPE, FIRESTORE_START_AT_VALUE_QUERY_CONSTRAINT_TYPE, FIRESTORE_WHERE_DOCUMENT_ID_QUERY_CONSTRAINT_TYPE, FIRESTORE_WHERE_QUERY_CONSTRAINT_TYPE, FirebaseDevelopmentFunctions, FirebaseModelPermissionServiceInstance, FirebaseServerError, FirestoreAccessorStreamMode, FirestoreDocumentContextType, InferredTargetModelIdParams, InferredTargetModelParams, IsFirestoreModelId, IsFirestoreModelIdOrKey, IsFirestoreModelKey, MAX_FIRESTORE_MAP_ZOOM_LEVEL_VALUE, MIN_FIRESTORE_MAP_ZOOM_LEVEL_VALUE, MODEL_FUNCTION_FIREBASE_CRUD_FUNCTION_SPECIFIER_DEFAULT, MODEL_FUNCTION_FIREBASE_CRUD_FUNCTION_SPECIFIER_SPLITTER, MODEL_STORAGE_FILE_SLASH_PATH_FACTORY, ModifyBeforeSetFirestoreDocumentDataAccessorWrapper, RUN_DEV_FUNCTION_APP_FUNCTION_KEY, SCHEDULED_FUNCTION_DEV_FUNCTION_SPECIFIER, ScheduledFunctionDevelopmentFirebaseFunctionListEntry, ScheduledFunctionDevelopmentFirebaseFunctionParams, ScheduledFunctionDevelopmentFunctionTypeEnum, SystemStateDocument, SystemStateFirestoreCollections, TargetModelIdParams, TargetModelParams, addConstraintToBuilder, addOrReplaceLimitInConstraints, allChildDocumentsUnderParent, allChildDocumentsUnderParentPath, allChildDocumentsUnderRelativePath, allowDocumentSnapshotWithPathOnceFilter, asTopLevelFieldPath, asTopLevelFieldPaths, assertFirestoreUpdateHasData, assertStorageUploadOptionsStringFormat, assignDateCellRangeFunction, assignDateCellScheduleFunction, assignUnitedStatesAddressFunction, assignWebsiteFileLinkFunction, assignWebsiteLinkFunction, buildFirebaseCollectionTypeModelTypeMap, callModelFirebaseFunctionMapFactory, childFirestoreModelKey, childFirestoreModelKeyPath, childFirestoreModelKeys, clientFirebaseFirestoreContextFactory, clientFirebaseStorageContextFactory, contextGrantedModelRolesReader, contextGrantedModelRolesReaderDoesNotExistErrorMessage, contextGrantedModelRolesReaderPermissionErrorMessage, convertHttpsCallableErrorToReadableError, copyDocumentIdForUserRelatedModifierFunction, copyDocumentIdToFieldModifierFunction, copyUserRelatedDataAccessorFactoryFunction, copyUserRelatedDataModifierConfig, dataFromDocumentSnapshots, dataFromSnapshotStream, developmentFirebaseFunctionMapFactory, directDataHttpsCallable, documentData, documentDataFunction, documentDataWithIdAndKey, documentReferenceFromDocument, documentReferencesFromDocuments, documentReferencesFromSnapshot, endAt, endAtValue, endBefore, extendFirestoreCollectionWithSingleDocumentAccessor, filterConstraintsOfType, filterDisallowedFirestoreItemPageIteratorInputContraints, filterRepeatCheckpointSnapshots, filterWithDateRange, firebaseAuthErrorToReadableError, firebaseFirestoreClientDrivers, firebaseFirestoreQueryConstraintFunctionsDriver, firebaseFirestoreQueryDriver, firebaseFunctionMapFactory, firebaseModelLoader, firebaseModelPermissionService, firebaseModelService, firebaseModelServiceFactory, firebaseModelsService, firebaseQueryItemAccumulator, firebaseQuerySnapshotAccumulator, firebaseStorageBucketFolderPath, firebaseStorageClientAccessorDriver, firebaseStorageClientAccessorFile, firebaseStorageClientAccessorFolder, firebaseStorageClientDrivers, firebaseStorageClientListFilesResultFactory, firebaseStorageContextFactory, firebaseStorageFileExists, firebaseStorageFilePathFromStorageFilePath, firebaseStorageRefForStorageFilePath, firestoreArray, firestoreArrayMap, firestoreBitwiseObjectMap, firestoreBitwiseSet, firestoreBitwiseSetMap, firestoreBoolean, firestoreClientAccessorDriver, firestoreClientIncrementUpdateToUpdateData, firestoreCollectionQueryFactory, firestoreContextFactory, firestoreDate, firestoreDateCellRange, firestoreDateCellRangeArray, firestoreDateCellRangeAssignFn, firestoreDateCellSchedule, firestoreDateCellScheduleAssignFn, firestoreDencoderArray, firestoreDencoderMap, firestoreDencoderStringArray, firestoreDocumentAccessorContextExtension, firestoreDocumentAccessorFactory, firestoreDocumentLoader, firestoreDocumentSnapshotPairsLoader, firestoreDocumentSnapshotPairsLoaderInstance, firestoreDummyKey, firestoreEncodedArray, firestoreEncodedObjectMap, firestoreEnum, firestoreEnumArray, firestoreField, firestoreFieldConfigToModelMapFunctionsRef, firestoreIdBatchVerifierFactory, firestoreIdentityTypeArray, firestoreIdentityTypeArrayName, firestoreItemPageIteration, firestoreItemPageIterationFactory, firestoreLatLngString, firestoreMap, firestoreMapZoomLevel, firestoreModelId, firestoreModelIdArrayField, firestoreModelIdFromDocument, firestoreModelIdGrantedRoleArrayMap, firestoreModelIdGrantedRoleMap, firestoreModelIdString, firestoreModelIdentity, firestoreModelIdentityTypeMap, firestoreModelIdsFromDocuments, firestoreModelIdsFromKey, firestoreModelKey, firestoreModelKeyArrayField, firestoreModelKeyCollectionName, firestoreModelKeyCollectionType, firestoreModelKeyCollectionTypeArray, firestoreModelKeyCollectionTypeArrayName, firestoreModelKeyCollectionTypePair, firestoreModelKeyEncodedGrantedRoleMap, firestoreModelKeyFromDocument, firestoreModelKeyGrantedRoleArrayMap, firestoreModelKeyGrantedRoleMap, firestoreModelKeyPairObject, firestoreModelKeyParentKey, firestoreModelKeyParentKeyPartPairs, firestoreModelKeyPart, firestoreModelKeyPartPairs, firestoreModelKeyPartPairsKeyPath, firestoreModelKeyPartPairsPaths, firestoreModelKeyPath, firestoreModelKeyString, firestoreModelKeyTypePair, firestoreModelKeys, firestoreModelKeysFromDocuments, firestoreModelType, firestoreNumber, firestoreObjectArray, firestorePassThroughField, firestoreQueryConstraint, firestoreQueryConstraintFactory, firestoreQueryDocumentSnapshotPairsLoader, firestoreQueryFactory, firestoreSingleDocumentAccessor, firestoreString, firestoreSubObject, firestoreTimezoneString, firestoreUID, firestoreUniqueArray, firestoreUniqueKeyedArray, firestoreUniqueNumberArray, firestoreUniqueStringArray, firestoreUnitedStatesAddress, firestoreUnitedStatesAddressAssignFn, firestoreUpdateWithNoDataError, firestoreWebsiteFileLink, firestoreWebsiteFileLinkAssignFn, firestoreWebsiteFileLinkEncodedArray, firestoreWebsiteFileLinkObjectArray, firestoreWebsiteLink, firestoreWebsiteLinkArray, firestoreWebsiteLinkAssignFn, flatFirestoreModelKey, getDataFromDocumentSnapshots, getDocumentSnapshotData, getDocumentSnapshotDataPair, getDocumentSnapshotDataPairs, getDocumentSnapshotDataTuples, getDocumentSnapshotPair, getDocumentSnapshotPairs, getDocumentSnapshots, getDocumentSnapshotsData, grantFullAccessIfAdmin, grantFullAccessIfAuthUserRelated, grantModelRolesIfAdmin, grantModelRolesIfAdminFunction, grantModelRolesIfAuthUserRelatedModelFunction, grantModelRolesIfFunction, grantModelRolesIfHasAuthRolesFactory, grantModelRolesIfHasAuthRolesFunction, grantModelRolesOnlyIfFunction, inContextFirebaseModelServiceFactory, inContextFirebaseModelsServiceFactory, incrementUpdateWithAccessorFunction, inferKeyFromTwoWayFlatFirestoreModelKey, interceptAccessorFactoryFunction, isAdminInFirebaseModelContext, isFirebaseStorageObjectNotFoundError, isFirestoreModelId, isFirestoreModelIdOrKey, isFirestoreModelKey, isOwnerOfUserRelatedModelInFirebaseModelContext, iterateFirestoreDocumentSnapshotBatches, iterateFirestoreDocumentSnapshotCheckpoints, iterateFirestoreDocumentSnapshotPairBatches, iterateFirestoreDocumentSnapshotPairs, iterateFirestoreDocumentSnapshots, iterationQueryDocChangeWatcher, iterationQueryDocChangeWatcherChangeTypeForGroup, latestDataFromDocuments, latestSnapshotsFromDocuments, lazyFirebaseFunctionsFactory, limit, limitToLast, limitedFirestoreDocumentAccessorFactory, loadAllFirestoreDocumentSnapshot, loadAllFirestoreDocumentSnapshotPairs, loadDocumentsForDocumentReferences, loadDocumentsForDocumentReferencesFromValues, loadDocumentsForIds, loadDocumentsForIdsFromValues, loadDocumentsForKeys, loadDocumentsForKeysFromValues, loadDocumentsForSnapshots, loadDocumentsForValues, makeDocuments, makeFirestoreCollection, makeFirestoreCollectionGroup, makeFirestoreCollectionWithParent, makeFirestoreItemPageIteratorDelegate, makeFirestoreQueryConstraintFunctionsDriver, makeRootSingleItemFirestoreCollection, makeSingleItemFirestoreCollection, mapDataFromSnapshot, mapHttpsCallable, modelStorageSlashPathFactory, modifyBeforeSetInterceptAccessorFactoryFunction, newDocuments, noStringFormatInStorageUploadOptionsError, offset, onCallCreateModelParams, onCallCreateModelResult, onCallCreateModelResultWithDocs, onCallDeleteModelParams, onCallDevelopmentParams, onCallReadModelParams, onCallTypedModelParams, onCallTypedModelParamsFunction, onCallUpdateModelParams, optionalFirestoreArray, optionalFirestoreBoolean, optionalFirestoreDate, optionalFirestoreEnum, optionalFirestoreField, optionalFirestoreNumber, optionalFirestoreString, optionalFirestoreUID, optionalFirestoreUnitedStatesAddress, orderBy, orderByDocumentId, readFirestoreModelKey, readFirestoreModelKeyFromDocumentSnapshot, replaceConstraints, selectFromFirebaseModelsService, separateConstraints, setIdAndKeyFromKeyIdRefOnDocumentData, setIdAndKeyFromSnapshotOnDocumentData, snapshotConverterFunctions, snapshotStreamDataForAccessor, snapshotStreamForAccessor, startAfter, startAt, startAtValue, storageListFilesResultFactory, storageListFilesResultHasNoNextError, storagePathFactory, streamFromOnSnapshot, systemStateCollectionReference, systemStateConverter, systemStateFirestoreCollection, systemStateIdentity, twoWayFlatFirestoreModelKey, unsupportedFirestoreDriverFunctionError, updateWithAccessorUpdateAndConverterFunction, useContextAuth, useContextAuthUid, useDocumentSnapshot, useDocumentSnapshotData, useFirebaseModelsService, where, whereDateIsAfter, whereDateIsAfterWithSort, whereDateIsBefore, whereDateIsBeforeWithSort, whereDateIsBetween, whereDateIsInRange, whereDateIsOnOrAfter, whereDateIsOnOrAfterWithSort, whereDateIsOnOrBefore, whereDateIsOnOrBeforeWithSort, whereDocumentId, whereStringHasRootIdentityModelKey, whereStringValueHasPrefix };
11349
+ export { AbstractFirestoreDocument, AbstractFirestoreDocumentDataAccessorWrapper, AbstractFirestoreDocumentWithParent, AppNotificationTemplateTypeInfoRecordService, BASE_MODEL_STORAGE_FILE_PATH, CALL_MODEL_APP_FUNCTION_KEY, COPY_USER_RELATED_DATA_ACCESSOR_FACTORY_FUNCTION, CREATE_NOTIFICATION_ID_REQUIRED_ERROR_CODE, CleanupSentNotificationsParams, ContextGrantedModelRolesReaderInstance, CreateNotificationBoxParams, CreateNotificationSummaryParams, CreateNotificationUserParams, DEFAULT_DATE_CELL_RANGE_VALUE, DEFAULT_FIRESTORE_DATE_CELL_SCHEDULE_VALUE, DEFAULT_FIRESTORE_ITEM_PAGE_ITERATOR_ITEMS_PER_PAGE, DEFAULT_FIRESTORE_STRING_FIELD_VALUE, DEFAULT_FIRESTORE_UNITED_STATES_ADDRESS_VALUE, DEFAULT_FIRESTORE_WEBSITE_FILE_LINK_VALUE, DEFAULT_ITERATE_FIRESTORE_DOCUMENT_SNAPSHOT_BATCHES_BATCH_SIZE, DEFAULT_NOTIFICATION_TEMPLATE_TYPE, DEFAULT_QUERY_CHANGE_WATCHER_DELAY, DEFAULT_SINGLE_ITEM_FIRESTORE_COLLECTION_DOCUMENT_IDENTIFIER, DEFAULT_WEBSITE_LINK, FIREBASE_AUTH_NETWORK_REQUEST_ERROR, FIREBASE_AUTH_NETWORK_REQUEST_FAILED, FIREBASE_AUTH_PASSWORD_MAX_LENGTH, FIREBASE_AUTH_PASSWORD_MIN_LENGTH, FIREBASE_AUTH_USER_NOT_FOUND_ERROR, FIREBASE_AUTH_WRONG_PASSWORD, FIREBASE_DEVELOPMENT_FUNCTIONS_MAP_KEY, FIREBASE_SERVER_AUTH_CLAIMS_RESET_LAST_COM_DATE_KEY, FIREBASE_SERVER_AUTH_CLAIMS_RESET_PASSWORD_KEY, FIREBASE_SERVER_AUTH_CLAIMS_SETUP_LAST_COM_DATE_KEY, FIREBASE_SERVER_AUTH_CLAIMS_SETUP_PASSWORD_KEY, FIRESTORE_CLIENT_QUERY_CONSTRAINT_HANDLER_MAPPING, FIRESTORE_COLLECTION_NAME_SEPARATOR, FIRESTORE_DUMMY_MODEL_KEY, FIRESTORE_EMPTY_VALUE, FIRESTORE_END_AT_QUERY_CONSTRAINT_TYPE, FIRESTORE_END_AT_VALUE_QUERY_CONSTRAINT_TYPE, FIRESTORE_END_BEFORE_QUERY_CONSTRAINT_TYPE, FIRESTORE_ITEM_PAGE_ITERATOR, FIRESTORE_ITEM_PAGE_ITERATOR_DELEGATE, FIRESTORE_LIMIT_QUERY_CONSTRAINT_TYPE, FIRESTORE_LIMIT_TO_LAST_QUERY_CONSTRAINT_TYPE, FIRESTORE_MAX_WHERE_IN_FILTER_ARGS_COUNT, FIRESTORE_MODEL_ID_REGEX, FIRESTORE_MODEL_KEY_REGEX, FIRESTORE_MODEL_KEY_REGEX_STRICT, FIRESTORE_OFFSET_QUERY_CONSTRAINT_TYPE, FIRESTORE_ORDER_BY_DOCUMENT_ID_QUERY_CONSTRAINT_TYPE, FIRESTORE_ORDER_BY_QUERY_CONSTRAINT_TYPE, FIRESTORE_PASSTHROUGH_FIELD, FIRESTORE_PERMISSION_DENIED_ERROR_CODE, FIRESTORE_START_AFTER_QUERY_CONSTRAINT_TYPE, FIRESTORE_START_AT_QUERY_CONSTRAINT_TYPE, FIRESTORE_START_AT_VALUE_QUERY_CONSTRAINT_TYPE, FIRESTORE_WHERE_DOCUMENT_ID_QUERY_CONSTRAINT_TYPE, FIRESTORE_WHERE_QUERY_CONSTRAINT_TYPE, FirebaseDevelopmentFunctions, FirebaseModelPermissionServiceInstance, FirebaseServerError, FirestoreAccessorStreamMode, FirestoreDocumentContextType, InferredTargetModelIdParams, InferredTargetModelParams, InitializeAllApplicableNotificationBoxesParams, InitializeAllApplicableNotificationSummariesParams, InitializeNotificationModelParams, IsFirestoreModelId, IsFirestoreModelIdOrKey, IsFirestoreModelKey, MAX_FIRESTORE_MAP_ZOOM_LEVEL_VALUE, MIN_FIRESTORE_MAP_ZOOM_LEVEL_VALUE, MODEL_FUNCTION_FIREBASE_CRUD_FUNCTION_SPECIFIER_DEFAULT, MODEL_FUNCTION_FIREBASE_CRUD_FUNCTION_SPECIFIER_SPLITTER, MODEL_STORAGE_FILE_SLASH_PATH_FACTORY, ModifyBeforeSetFirestoreDocumentDataAccessorWrapper, NOTIFICATION_BOX_EXISTS_FOR_MODEL_ERROR_CODE, NOTIFICATION_BOX_RECIPIENT_DOES_NOT_EXIST_ERROR_CODE, NOTIFICATION_MESSAGE_MAX_LENGTH, NOTIFICATION_MESSAGE_MIN_LENGTH, NOTIFICATION_MODEL_ALREADY_INITIALIZED_ERROR_CODE, NOTIFICATION_RECIPIENT_NAME_MAX_LENGTH, NOTIFICATION_RECIPIENT_NAME_MIN_LENGTH, NOTIFICATION_SUBJECT_MAX_LENGTH, NOTIFICATION_SUBJECT_MIN_LENGTH, NOTIFICATION_SUMMARY_EMBEDDED_NOTIFICATION_ITEM_MESSAGE_MAX_LENGTH, NOTIFICATION_SUMMARY_EMBEDDED_NOTIFICATION_ITEM_SUBJECT_MAX_LENGTH, NOTIFICATION_SUMMARY_ITEM_LIMIT, NOTIFICATION_USER_BLOCKED_FROM_BEING_ADD_TO_RECIPIENTS_ERROR_CODE, NOTIFICATION_USER_INVALID_UID_FOR_CREATE_ERROR_CODE, NOTIFICATION_USER_LOCKED_CONFIG_FROM_BEING_UPDATED_ERROR_CODE, NOTIFICATION_WEEK_NOTIFICATION_ITEM_LIMIT, NotificationBoxDocument, NotificationBoxRecipientFlag, NotificationBoxRecipientTemplateConfigArrayEntryParam, NotificationBoxRecipientTemplateConfigBoolean, NotificationDocument, NotificationFirestoreCollections, NotificationFunctions, NotificationMessageFlag, NotificationRecipientParams, NotificationRecipientSendFlag, NotificationSendState, NotificationSendType, NotificationSummaryDocument, NotificationType, NotificationUserDocument, NotificationWeekDocument, RUN_DEV_FUNCTION_APP_FUNCTION_KEY, ResyncAllNotificationUserParams, ResyncNotificationUserParams, SCHEDULED_FUNCTION_DEV_FUNCTION_SPECIFIER, ScheduledFunctionDevelopmentFirebaseFunctionListEntry, ScheduledFunctionDevelopmentFirebaseFunctionParams, ScheduledFunctionDevelopmentFunctionTypeEnum, SendNotificationParams, SendQueuedNotificationsParams, SystemStateDocument, SystemStateFirestoreCollections, TargetModelIdParams, TargetModelParams, UpdateNotificationBoxParams, UpdateNotificationBoxRecipientLikeParams, UpdateNotificationBoxRecipientParams, UpdateNotificationSummaryParams, UpdateNotificationUserDefaultNotificationBoxRecipientConfigParams, UpdateNotificationUserNotificationBoxRecipientParams, UpdateNotificationUserParams, addConstraintToBuilder, addOrReplaceLimitInConstraints, allChildDocumentsUnderParent, allChildDocumentsUnderParentPath, allChildDocumentsUnderRelativePath, allowDocumentSnapshotWithPathOnceFilter, allowedNotificationRecipients, appNotificationTemplateTypeInfoRecordService, asTopLevelFieldPath, asTopLevelFieldPaths, assertFirestoreUpdateHasData, assertStorageUploadOptionsStringFormat, assignDateCellRangeFunction, assignDateCellScheduleFunction, assignUnitedStatesAddressFunction, assignWebsiteFileLinkFunction, assignWebsiteLinkFunction, buildFirebaseCollectionTypeModelTypeMap, callModelFirebaseFunctionMapFactory, childFirestoreModelKey, childFirestoreModelKeyPath, childFirestoreModelKeys, clientFirebaseFirestoreContextFactory, clientFirebaseStorageContextFactory, contextGrantedModelRolesReader, contextGrantedModelRolesReaderDoesNotExistErrorMessage, contextGrantedModelRolesReaderPermissionErrorMessage, convertHttpsCallableErrorToReadableError, copyDocumentIdForUserRelatedModifierFunction, copyDocumentIdToFieldModifierFunction, copyUserRelatedDataAccessorFactoryFunction, copyUserRelatedDataModifierConfig, createNotificationDocument, createNotificationDocumentIfSending, createNotificationDocumentPair, createNotificationTemplate, dataFromDocumentSnapshots, dataFromSnapshotStream, developmentFirebaseFunctionMapFactory, directDataHttpsCallable, documentData, documentDataFunction, documentDataWithIdAndKey, documentReferenceFromDocument, documentReferencesFromDocuments, documentReferencesFromSnapshot, effectiveNotificationBoxRecipientConfig, effectiveNotificationBoxRecipientTemplateConfig, endAt, endAtValue, endBefore, extendFirestoreCollectionWithSingleDocumentAccessor, filterConstraintsOfType, filterDisallowedFirestoreItemPageIteratorInputContraints, filterRepeatCheckpointSnapshots, filterWithDateRange, firebaseAuthErrorToReadableError, firebaseFirestoreClientDrivers, firebaseFirestoreQueryConstraintFunctionsDriver, firebaseFirestoreQueryDriver, firebaseFunctionMapFactory, firebaseModelLoader, firebaseModelPermissionService, firebaseModelService, firebaseModelServiceFactory, firebaseModelsService, firebaseQueryItemAccumulator, firebaseQuerySnapshotAccumulator, firebaseStorageBucketFolderPath, firebaseStorageClientAccessorDriver, firebaseStorageClientAccessorFile, firebaseStorageClientAccessorFolder, firebaseStorageClientDrivers, firebaseStorageClientListFilesResultFactory, firebaseStorageContextFactory, firebaseStorageFileExists, firebaseStorageFilePathFromStorageFilePath, firebaseStorageRefForStorageFilePath, firestoreArray, firestoreArrayMap, firestoreBitwiseObjectMap, firestoreBitwiseSet, firestoreBitwiseSetMap, firestoreBoolean, firestoreClientAccessorDriver, firestoreClientIncrementUpdateToUpdateData, firestoreCollectionQueryFactory, firestoreContextFactory, firestoreDate, firestoreDateCellRange, firestoreDateCellRangeArray, firestoreDateCellRangeAssignFn, firestoreDateCellSchedule, firestoreDateCellScheduleAssignFn, firestoreDencoderArray, firestoreDencoderMap, firestoreDencoderStringArray, firestoreDocumentAccessorContextExtension, firestoreDocumentAccessorFactory, firestoreDocumentLoader, firestoreDocumentSnapshotPairsLoader, firestoreDocumentSnapshotPairsLoaderInstance, firestoreDummyKey, firestoreEncodedArray, firestoreEncodedObjectMap, firestoreEnum, firestoreEnumArray, firestoreField, firestoreFieldConfigToModelMapFunctionsRef, firestoreIdBatchVerifierFactory, firestoreIdentityTypeArray, firestoreIdentityTypeArrayName, firestoreItemPageIteration, firestoreItemPageIterationFactory, firestoreLatLngString, firestoreMap, firestoreMapZoomLevel, firestoreModelId, firestoreModelIdArrayField, firestoreModelIdFromDocument, firestoreModelIdGrantedRoleArrayMap, firestoreModelIdGrantedRoleMap, firestoreModelIdString, firestoreModelIdentity, firestoreModelIdentityTypeMap, firestoreModelIdsFromDocuments, firestoreModelIdsFromKey, firestoreModelKey, firestoreModelKeyArrayField, firestoreModelKeyCollectionName, firestoreModelKeyCollectionType, firestoreModelKeyCollectionTypeArray, firestoreModelKeyCollectionTypeArrayName, firestoreModelKeyCollectionTypePair, firestoreModelKeyEncodedGrantedRoleMap, firestoreModelKeyFromDocument, firestoreModelKeyGrantedRoleArrayMap, firestoreModelKeyGrantedRoleMap, firestoreModelKeyPairObject, firestoreModelKeyParentKey, firestoreModelKeyParentKeyPartPairs, firestoreModelKeyPart, firestoreModelKeyPartPairs, firestoreModelKeyPartPairsKeyPath, firestoreModelKeyPartPairsPaths, firestoreModelKeyPath, firestoreModelKeyString, firestoreModelKeyTypePair, firestoreModelKeys, firestoreModelKeysFromDocuments, firestoreModelType, firestoreNotificationBoxRecipient, firestoreNotificationBoxRecipientTemplateConfigRecord, firestoreNotificationItem, firestoreNotificationRecipientWithConfig, firestoreNotificationUserDefaultNotificationBoxRecipientConfig, firestoreNotificationUserNotificationBoxRecipientConfig, firestoreNumber, firestoreObjectArray, firestorePassThroughField, firestoreQueryConstraint, firestoreQueryConstraintFactory, firestoreQueryDocumentSnapshotPairsLoader, firestoreQueryFactory, firestoreSingleDocumentAccessor, firestoreString, firestoreSubObject, firestoreTimezoneString, firestoreUID, firestoreUniqueArray, firestoreUniqueKeyedArray, firestoreUniqueNumberArray, firestoreUniqueStringArray, firestoreUnitedStatesAddress, firestoreUnitedStatesAddressAssignFn, firestoreUpdateWithNoDataError, firestoreWebsiteFileLink, firestoreWebsiteFileLinkAssignFn, firestoreWebsiteFileLinkEncodedArray, firestoreWebsiteFileLinkObjectArray, firestoreWebsiteLink, firestoreWebsiteLinkArray, firestoreWebsiteLinkAssignFn, flatFirestoreModelKey, getDataFromDocumentSnapshots, getDocumentSnapshotData, getDocumentSnapshotDataPair, getDocumentSnapshotDataPairs, getDocumentSnapshotDataPairsWithData, getDocumentSnapshotDataTuples, getDocumentSnapshotPair, getDocumentSnapshotPairs, getDocumentSnapshots, getDocumentSnapshotsData, grantFullAccessIfAdmin, grantFullAccessIfAuthUserRelated, grantModelRolesIfAdmin, grantModelRolesIfAdminFunction, grantModelRolesIfAuthUserRelatedModelFunction, grantModelRolesIfFunction, grantModelRolesIfHasAuthRolesFactory, grantModelRolesIfHasAuthRolesFunction, grantModelRolesOnlyIfFunction, inContextFirebaseModelServiceFactory, inContextFirebaseModelsServiceFactory, incrementUpdateWithAccessorFunction, inferKeyFromTwoWayFlatFirestoreModelKey, inferNotificationBoxRelatedModelKey, interceptAccessorFactoryFunction, isAdminInFirebaseModelContext, isClientFirebaseError, isCompleteNotificationSendState, isFirebaseStorageObjectNotFoundError, isFirestoreModelId, isFirestoreModelIdOrKey, isFirestoreModelKey, isOwnerOfUserRelatedModelInFirebaseModelContext, iterateFirestoreDocumentSnapshotBatches, iterateFirestoreDocumentSnapshotCheckpoints, iterateFirestoreDocumentSnapshotPairBatches, iterateFirestoreDocumentSnapshotPairs, iterateFirestoreDocumentSnapshots, iterationQueryDocChangeWatcher, iterationQueryDocChangeWatcherChangeTypeForGroup, latestDataFromDocuments, latestSnapshotsFromDocuments, lazyFirebaseFunctionsFactory, limit, limitToLast, limitedFirestoreDocumentAccessorFactory, loadAllFirestoreDocumentSnapshot, loadAllFirestoreDocumentSnapshotPairs, loadDocumentsForDocumentReferences, loadDocumentsForDocumentReferencesFromValues, loadDocumentsForIds, loadDocumentsForIdsFromValues, loadDocumentsForKeys, loadDocumentsForKeysFromValues, loadDocumentsForSnapshots, loadDocumentsForValues, makeDocuments, makeFirestoreCollection, makeFirestoreCollectionGroup, makeFirestoreCollectionWithParent, makeFirestoreItemPageIteratorDelegate, makeFirestoreQueryConstraintFunctionsDriver, makeRootSingleItemFirestoreCollection, makeSingleItemFirestoreCollection, mapDataFromSnapshot, mapHttpsCallable, mergeNotificationBoxRecipientTemplateConfigRecords, mergeNotificationBoxRecipientTemplateConfigs, mergeNotificationBoxRecipients, mergeNotificationSendMessagesResult, mergeNotificationUserDefaultNotificationBoxRecipientConfig, mergeNotificationUserNotificationBoxRecipientConfigs, modelStorageSlashPathFactory, modifyBeforeSetInterceptAccessorFactoryFunction, newDocuments, newNotificationBoxRecipientForUid, noContentNotificationMessageFunctionFactory, noStringFormatInStorageUploadOptionsError, notificationBoxCollectionReference, notificationBoxConverter, notificationBoxFirestoreCollection, notificationBoxIdForModel, notificationBoxIdentity, notificationBoxModelCrudFunctionsConfig, notificationBoxRecipientTemplateConfigArrayToRecord, notificationBoxRecipientTemplateConfigRecordToArray, notificationBoxesFlaggedForNeedsInitializationQuery, notificationBoxesFlaggedInvalidQuery, notificationCollectionReference, notificationCollectionReferenceFactory, notificationConverter, notificationFirestoreCollectionFactory, notificationFirestoreCollectionGroup, notificationFunctionMap, notificationFunctionTypeConfigMap, notificationIdentity, notificationMessageFunction, notificationSendFlagsImplyIsComplete, notificationSummariesFlaggedForNeedsInitializationQuery, notificationSummaryCollectionReference, notificationSummaryConverter, notificationSummaryFirestoreCollection, notificationSummaryIdForModel, notificationSummaryIdForUidFunctionForRootFirestoreModelIdentity, notificationSummaryIdentity, notificationTemplateTypeDetailsRecord, notificationUserCollectionReference, notificationUserConverter, notificationUserFirestoreCollection, notificationUserIdentity, notificationUsersFlaggedForNeedsSyncQuery, notificationWeekCollectionReference, notificationWeekCollectionReferenceFactory, notificationWeekConverter, notificationWeekFirestoreCollectionFactory, notificationWeekFirestoreCollectionGroup, notificationWeekIdentity, notificationsPastSendAtTimeQuery, notificationsReadyForCleanupQuery, offset, onCallCreateModelParams, onCallCreateModelResult, onCallCreateModelResultWithDocs, onCallDeleteModelParams, onCallDevelopmentParams, onCallReadModelParams, onCallTypedModelParams, onCallTypedModelParamsFunction, onCallUpdateModelParams, optionalFirestoreArray, optionalFirestoreBoolean, optionalFirestoreDate, optionalFirestoreEnum, optionalFirestoreField, optionalFirestoreNumber, optionalFirestoreString, optionalFirestoreUID, optionalFirestoreUnitedStatesAddress, orderBy, orderByDocumentId, readFirestoreModelKey, readFirestoreModelKeyFromDocumentSnapshot, replaceConstraints, selectFromFirebaseModelsService, separateConstraints, setIdAndKeyFromKeyIdRefOnDocumentData, setIdAndKeyFromSnapshotOnDocumentData, shouldSaveNotificationToNotificationWeek, shouldSendCreatedNotificationInput, snapshotConverterFunctions, snapshotStreamDataForAccessor, snapshotStreamForAccessor, sortNotificationItemsFunction, startAfter, startAt, startAtValue, storageListFilesResultFactory, storageListFilesResultHasNoNextError, storagePathFactory, streamFromOnSnapshot, systemStateCollectionReference, systemStateConverter, systemStateFirestoreCollection, systemStateIdentity, twoWayFlatFirestoreModelKey, unreadNotificationItems, unsupportedFirestoreDriverFunctionError, updateNotificationBoxRecipientTemplateConfigRecord, updateNotificationRecipient, updateNotificationUserDefaultNotificationBoxRecipientConfig, updateNotificationUserNotificationBoxRecipientConfigIfChanged, updateNotificationUserNotificationBoxRecipientConfigs, updateWithAccessorUpdateAndConverterFunction, useContextAuth, useContextAuthUid, useDocumentSnapshot, useDocumentSnapshotData, useFirebaseModelsService, where, whereDateIsAfter, whereDateIsAfterWithSort, whereDateIsBefore, whereDateIsBeforeWithSort, whereDateIsBetween, whereDateIsInRange, whereDateIsOnOrAfter, whereDateIsOnOrAfterWithSort, whereDateIsOnOrBefore, whereDateIsOnOrBeforeWithSort, whereDocumentId, whereStringHasRootIdentityModelKey, whereStringValueHasPrefix };