@dereekb/firebase 13.4.1 → 13.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (73) hide show
  1. package/index.cjs.js +922 -385
  2. package/index.esm.js +920 -386
  3. package/package.json +5 -5
  4. package/src/lib/client/error/error.d.ts +1 -1
  5. package/src/lib/client/firestore/driver.accessor.batch.d.ts +2 -0
  6. package/src/lib/client/firestore/driver.accessor.create.d.ts +1 -0
  7. package/src/lib/client/firestore/driver.accessor.d.ts +2 -0
  8. package/src/lib/client/firestore/driver.accessor.default.d.ts +4 -0
  9. package/src/lib/client/firestore/driver.accessor.transaction.d.ts +2 -0
  10. package/src/lib/client/firestore/driver.d.ts +2 -0
  11. package/src/lib/client/firestore/driver.query.d.ts +5 -0
  12. package/src/lib/client/function/development.function.factory.d.ts +1 -0
  13. package/src/lib/client/function/error.d.ts +1 -0
  14. package/src/lib/client/function/function.callable.d.ts +9 -2
  15. package/src/lib/client/function/function.factory.d.ts +2 -0
  16. package/src/lib/client/function/model.function.factory.d.ts +11 -4
  17. package/src/lib/client/storage/driver.accessor.d.ts +7 -0
  18. package/src/lib/client/storage/driver.d.ts +2 -0
  19. package/src/lib/common/auth/auth.error.d.ts +34 -7
  20. package/src/lib/common/development/function.d.ts +1 -0
  21. package/src/lib/common/development/function.schedule.d.ts +3 -1
  22. package/src/lib/common/firestore/accessor/accessor.wrap.modify.d.ts +9 -0
  23. package/src/lib/common/firestore/accessor/context.d.ts +9 -3
  24. package/src/lib/common/firestore/accessor/document.d.ts +49 -7
  25. package/src/lib/common/firestore/accessor/document.utility.d.ts +18 -6
  26. package/src/lib/common/firestore/collection/collection.d.ts +76 -11
  27. package/src/lib/common/firestore/driver/query.handler.d.ts +9 -3
  28. package/src/lib/common/firestore/snapshot/snapshot.field.d.ts +32 -1
  29. package/src/lib/common/model/function.d.ts +8 -3
  30. package/src/lib/common/model/model/model.loader.d.ts +1 -0
  31. package/src/lib/common/model/model.service.d.ts +9 -2
  32. package/src/lib/common/model/permission/permission.d.ts +12 -4
  33. package/src/lib/common/model/permission/permission.service.d.ts +1 -0
  34. package/src/lib/common/model/permission/permission.service.grant.d.ts +10 -0
  35. package/src/lib/common/model/permission/permission.service.role.d.ts +9 -7
  36. package/src/lib/common/storage/accessor/path.model.d.ts +1 -0
  37. package/src/lib/common/storage/context.d.ts +1 -0
  38. package/src/lib/common/storage/driver/accessor.iterate.d.ts +7 -0
  39. package/src/lib/common/storage/driver/accessor.util.d.ts +1 -0
  40. package/src/lib/common/storage/driver/error.d.ts +3 -0
  41. package/src/lib/common/storage/driver/list.d.ts +18 -3
  42. package/src/lib/common/storage/storage.d.ts +4 -0
  43. package/src/lib/common/storage/types.d.ts +3 -0
  44. package/src/lib/model/notification/notification.api.error.d.ts +27 -9
  45. package/src/lib/model/notification/notification.api.util.d.ts +12 -0
  46. package/src/lib/model/notification/notification.config.d.ts +28 -0
  47. package/src/lib/model/notification/notification.create.d.ts +24 -0
  48. package/src/lib/model/notification/notification.create.task.d.ts +2 -0
  49. package/src/lib/model/notification/notification.d.ts +42 -0
  50. package/src/lib/model/notification/notification.details.d.ts +3 -0
  51. package/src/lib/model/notification/notification.id.d.ts +4 -3
  52. package/src/lib/model/notification/notification.item.d.ts +2 -1
  53. package/src/lib/model/notification/notification.message.d.ts +6 -3
  54. package/src/lib/model/notification/notification.query.d.ts +12 -0
  55. package/src/lib/model/notification/notification.send.d.ts +4 -0
  56. package/src/lib/model/notification/notification.task.d.ts +7 -0
  57. package/src/lib/model/notification/notification.task.subtask.d.ts +5 -0
  58. package/src/lib/model/notification/notification.util.d.ts +38 -0
  59. package/src/lib/model/oidcmodel/oidcmodel.api.d.ts +5 -1
  60. package/src/lib/model/oidcmodel/oidcmodel.d.ts +6 -0
  61. package/src/lib/model/oidcmodel/oidcmodel.query.d.ts +18 -0
  62. package/src/lib/model/storagefile/storagefile.create.d.ts +4 -0
  63. package/src/lib/model/storagefile/storagefile.d.ts +16 -0
  64. package/src/lib/model/storagefile/storagefile.file.d.ts +2 -0
  65. package/src/lib/model/storagefile/storagefile.group.d.ts +4 -0
  66. package/src/lib/model/storagefile/storagefile.permission.d.ts +1 -0
  67. package/src/lib/model/storagefile/storagefile.query.d.ts +19 -0
  68. package/src/lib/model/storagefile/storagefile.task.d.ts +1 -0
  69. package/src/lib/model/storagefile/storagefile.upload.d.ts +6 -0
  70. package/src/lib/model/storagefile/storagefile.upload.determiner.d.ts +9 -0
  71. package/src/lib/model/storagefile/storagefile.util.d.ts +4 -0
  72. package/src/lib/model/system/system.d.ts +4 -0
  73. package/test/package.json +6 -6
package/index.cjs.js CHANGED
@@ -441,13 +441,15 @@ function _is_native_reflect_construct$9() {
441
441
  */ function copyDocumentIdToFieldModifierFunction(fieldName) {
442
442
  return function(param) {
443
443
  var data = param.data, documentRef = param.documentRef;
444
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
445
444
  data[fieldName] = documentRef.id; // copy the id to the target field
446
445
  };
447
446
  }
448
447
  /**
449
448
  * Creates an {@link InterceptAccessorFactoryFunction} that wraps all created accessors with
450
449
  * {@link ModifyBeforeSetFirestoreDocumentDataAccessorWrapper} using the provided config.
450
+ *
451
+ * @param config - The ModifyBeforeSetConfig defining when and how to modify documents
452
+ * @returns An InterceptAccessorFactoryFunction that wraps accessors with the modify-before-set behavior
451
453
  */ function modifyBeforeSetInterceptAccessorFactoryFunction(config) {
452
454
  return interceptAccessorFactoryFunction(function(accessor) {
453
455
  return new ModifyBeforeSetFirestoreDocumentDataAccessorWrapper(accessor, config);
@@ -456,12 +458,16 @@ function _is_native_reflect_construct$9() {
456
458
  // MARK: Templates
457
459
  /**
458
460
  * Creates a modifier that copies the document ID to the `uid` field for {@link UserRelated} models.
461
+ *
462
+ * @returns A ModifyBeforeSetModifierFunction that sets the `uid` field to the document's ID
459
463
  */ function copyDocumentIdForUserRelatedModifierFunction() {
460
464
  return copyDocumentIdToFieldModifierFunction('uid');
461
465
  }
462
466
  /**
463
467
  * Returns a pre-configured {@link ModifyBeforeSetConfig} for {@link UserRelated} models
464
468
  * that copies the document ID to the `uid` field on set operations (new document creation).
469
+ *
470
+ * @returns A ModifyBeforeSetConfig configured to copy the document ID to the `uid` field on set
465
471
  */ function copyUserRelatedDataModifierConfig() {
466
472
  return {
467
473
  when: 'set',
@@ -476,6 +482,8 @@ function _is_native_reflect_construct$9() {
476
482
  /**
477
483
  * Returns a typed {@link InterceptAccessorFactoryFunction} that applies the UserRelated
478
484
  * document ID copy modifier to all accessors created by the factory.
485
+ *
486
+ * @returns A typed InterceptAccessorFactoryFunction with the UserRelated document ID copy modifier applied
479
487
  */ function copyUserRelatedDataAccessorFactoryFunction() {
480
488
  return COPY_USER_RELATED_DATA_ACCESSOR_FACTORY_FUNCTION();
481
489
  }
@@ -713,9 +721,15 @@ function _ts_generator$k(thisArg, body) {
713
721
  * - BATCH: Operations within a Firestore write batch (atomic writes only, no reads)
714
722
  */ exports.FirestoreDocumentContextType = void 0;
715
723
  (function(FirestoreDocumentContextType) {
716
- /** Standard context with no special transactional semantics */ FirestoreDocumentContextType["NONE"] = "none";
717
- /** Operations within a Firestore transaction (atomic reads and writes) */ FirestoreDocumentContextType["TRANSACTION"] = "transaction";
718
- /** Operations within a Firestore write batch (atomic writes only) */ FirestoreDocumentContextType["BATCH"] = "batch";
724
+ /**
725
+ * Standard context with no special transactional semantics
726
+ */ FirestoreDocumentContextType["NONE"] = "none";
727
+ /**
728
+ * Operations within a Firestore transaction (atomic reads and writes)
729
+ */ FirestoreDocumentContextType["TRANSACTION"] = "transaction";
730
+ /**
731
+ * Operations within a Firestore write batch (atomic writes only)
732
+ */ FirestoreDocumentContextType["BATCH"] = "batch";
719
733
  })(exports.FirestoreDocumentContextType || (exports.FirestoreDocumentContextType = {}));
720
734
 
721
735
  function asyncGeneratorStep$j(gen, resolve, reject, _next, _throw, key, arg) {
@@ -1212,7 +1226,8 @@ function _is_native_reflect_construct$8() {
1212
1226
  /**
1213
1227
  * Retrieves a DocumentSnapshot of the document as an Observable. Streams based on the input mode.
1214
1228
  *
1215
- * @returns
1229
+ * @param mode - The stream mode controlling how the Observable emits snapshot updates
1230
+ * @returns An Observable that emits DocumentSnapshot values based on the given mode
1216
1231
  */ key: "snapshotStream",
1217
1232
  value: function snapshotStream(mode) {
1218
1233
  return snapshotStreamForAccessor(this.accessor, mode);
@@ -1222,8 +1237,9 @@ function _is_native_reflect_construct$8() {
1222
1237
  /**
1223
1238
  * Retrieves the data of the DocumentSnapshot of the document as an Observable. Streams based on the input mode.
1224
1239
  *
1225
- * @param options
1226
- * @returns
1240
+ * @param mode - The stream mode controlling how the Observable emits snapshot data updates
1241
+ * @param options - Optional SnapshotOptions for reading the document data
1242
+ * @returns An Observable that emits the document data or undefined based on the given mode
1227
1243
  */ key: "snapshotDataStream",
1228
1244
  value: function snapshotDataStream(mode, options) {
1229
1245
  return snapshotStreamDataForAccessor(this.accessor, mode, options);
@@ -1232,6 +1248,7 @@ function _is_native_reflect_construct$8() {
1232
1248
  {
1233
1249
  /**
1234
1250
  * Retrieves a DocumentSnapshot of the document.
1251
+ *
1235
1252
  * @returns
1236
1253
  */ key: "snapshot",
1237
1254
  value: function snapshot() {
@@ -1241,6 +1258,7 @@ function _is_native_reflect_construct$8() {
1241
1258
  {
1242
1259
  /**
1243
1260
  * Retrieves the data of the DocumentSnapshot of the document.
1261
+ *
1244
1262
  * @param options
1245
1263
  * @returns
1246
1264
  */ key: "snapshotData",
@@ -1280,8 +1298,9 @@ function _is_native_reflect_construct$8() {
1280
1298
  *
1281
1299
  * Throws an exception when it does not exist.
1282
1300
  *
1283
- * @param data
1284
- * @returns
1301
+ * @param data - Partial document data to update
1302
+ * @param params - Optional update parameters
1303
+ * @returns A Promise that resolves when the update completes
1285
1304
  */ key: "update",
1286
1305
  value: function update(data, params) {
1287
1306
  return updateWithAccessorUpdateAndConverterFunction(this.accessor, this.converter)(data, params);
@@ -1291,7 +1310,8 @@ function _is_native_reflect_construct$8() {
1291
1310
  /**
1292
1311
  * Updates the document using the accessor's increment functionality.
1293
1312
  *
1294
- * @param data
1313
+ * @param data - The increment update to apply to numeric fields
1314
+ * @returns A Promise that resolves when the increment update completes
1295
1315
  */ key: "increment",
1296
1316
  value: function increment(data) {
1297
1317
  return incrementUpdateWithAccessorFunction(this.accessor)(data);
@@ -1301,7 +1321,8 @@ function _is_native_reflect_construct$8() {
1301
1321
  /**
1302
1322
  * Updates the document using the accessor's array field update functionality.
1303
1323
  *
1304
- * @param data
1324
+ * @param data - The array field update to apply (union or remove elements)
1325
+ * @returns A Promise that resolves when the array update completes
1305
1326
  */ key: "arrayUpdate",
1306
1327
  value: function arrayUpdate(data) {
1307
1328
  return arrayUpdateWithAccessorFunction(this.accessor)(data);
@@ -1310,7 +1331,12 @@ function _is_native_reflect_construct$8() {
1310
1331
  ]);
1311
1332
  return AbstractFirestoreDocument;
1312
1333
  }();
1313
- function limitedFirestoreDocumentAccessorFactory(config) {
1334
+ /**
1335
+ * Creates a {@link LimitedFirestoreDocumentAccessorFactoryFunction} from the provided configuration.
1336
+ *
1337
+ * @param config - Configuration including converter, accessor factory, and document factory
1338
+ * @returns A factory function for creating LimitedFirestoreDocumentAccessor instances
1339
+ */ function limitedFirestoreDocumentAccessorFactory(config) {
1314
1340
  var firestoreContext = config.firestoreContext, firestoreAccessorDriver = config.firestoreAccessorDriver, makeDocument = config.makeDocument, interceptAccessorFactory = config.accessorFactory, inputDefaultConverter = config.converter, inputConverterFactory = config.converterFactory, modelIdentity = config.modelIdentity;
1315
1341
  var expectedCollectionName = firestoreAccessorDriver.fuzzedPathForPath ? firestoreAccessorDriver.fuzzedPathForPath(modelIdentity.collectionName) : modelIdentity.collectionName;
1316
1342
  var converterFactory = inputConverterFactory ? function(ref) {
@@ -1321,9 +1347,6 @@ function limitedFirestoreDocumentAccessorFactory(config) {
1321
1347
  };
1322
1348
  var result = function result(context) {
1323
1349
  var loadDocument = function loadDocument(ref) {
1324
- if (!ref) {
1325
- throw new Error('ref must be defined.');
1326
- }
1327
1350
  var converter = converterFactory(ref);
1328
1351
  var accessor = dataAccessorFactory.accessorFor(ref.withConverter(converter));
1329
1352
  return makeDocument(accessor, documentAccessor);
@@ -1361,7 +1384,15 @@ function limitedFirestoreDocumentAccessorFactory(config) {
1361
1384
  result.converterFactory = converterFactory;
1362
1385
  return result;
1363
1386
  }
1364
- function firestoreDocumentAccessorFactory(config) {
1387
+ /**
1388
+ * Creates a {@link FirestoreDocumentAccessorFactoryFunction} from the provided configuration.
1389
+ *
1390
+ * Extends the limited accessor factory with collection-level operations such as creating new documents
1391
+ * and loading documents by ID.
1392
+ *
1393
+ * @param config - Configuration including the collection reference and document factory
1394
+ * @returns A factory function for creating FirestoreDocumentAccessor instances
1395
+ */ function firestoreDocumentAccessorFactory(config) {
1365
1396
  var firestoreAccessorDriver = config.firestoreAccessorDriver, collection = config.collection;
1366
1397
  var limitedFirestoreDocumentAccessor = limitedFirestoreDocumentAccessorFactory(config);
1367
1398
  function documentRefForId(path) {
@@ -1425,7 +1456,12 @@ var AbstractFirestoreDocumentWithParent = /*#__PURE__*/ function(AbstractFiresto
1425
1456
  ]);
1426
1457
  return AbstractFirestoreDocumentWithParent;
1427
1458
  }(AbstractFirestoreDocument);
1428
- function firestoreSingleDocumentAccessor(config) {
1459
+ /**
1460
+ * Creates a {@link FirestoreSingleDocumentAccessor} for a collection that contains a single known document.
1461
+ *
1462
+ * @param config - Configuration specifying the single item identifier and the document accessor context extension
1463
+ * @returns A FirestoreSingleDocumentAccessor providing convenient access to the single document
1464
+ */ function firestoreSingleDocumentAccessor(config) {
1429
1465
  var singleItemIdentifier = config.singleItemIdentifier, accessors = config.accessors;
1430
1466
  var defaultAccessor = accessors.documentAccessor();
1431
1467
  return {
@@ -1447,10 +1483,15 @@ function firestoreSingleDocumentAccessor(config) {
1447
1483
  /**
1448
1484
  * Default document ID used for single-document collections. The document is stored at path `<collection>/0`.
1449
1485
  */ var DEFAULT_SINGLE_ITEM_FIRESTORE_COLLECTION_DOCUMENT_IDENTIFIER = '0';
1450
- function extendFirestoreCollectionWithSingleDocumentAccessor(x, singleItemIdentifier) {
1486
+ /**
1487
+ * Extends a Firestore collection object in-place with single-document accessor methods.
1488
+ *
1489
+ * @param x - The collection object to extend with single-document accessor methods
1490
+ * @param singleItemIdentifier - Optional identifier for the single document; defaults to {@link DEFAULT_SINGLE_ITEM_FIRESTORE_COLLECTION_DOCUMENT_IDENTIFIER}
1491
+ */ function extendFirestoreCollectionWithSingleDocumentAccessor(x, singleItemIdentifier) {
1451
1492
  var singleAccessor = firestoreSingleDocumentAccessor({
1452
1493
  accessors: x,
1453
- singleItemIdentifier: singleItemIdentifier || DEFAULT_SINGLE_ITEM_FIRESTORE_COLLECTION_DOCUMENT_IDENTIFIER
1494
+ singleItemIdentifier: singleItemIdentifier !== null && singleItemIdentifier !== void 0 ? singleItemIdentifier : DEFAULT_SINGLE_ITEM_FIRESTORE_COLLECTION_DOCUMENT_IDENTIFIER
1454
1495
  });
1455
1496
  x.singleItemIdentifier = singleAccessor.singleItemIdentifier;
1456
1497
  x.documentRef = singleAccessor.documentRef;
@@ -1929,8 +1970,7 @@ function getDataFromDocumentSnapshots(snapshots) {
1929
1970
  */ var firestoreQueryDocumentSnapshotPairsLoader = firestoreDocumentSnapshotPairsLoader;
1930
1971
  function documentData(snapshot) {
1931
1972
  var withId = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false;
1932
- var result = withId ? documentDataWithIdAndKey(snapshot) : snapshot.data();
1933
- return result;
1973
+ return withId ? documentDataWithIdAndKey(snapshot) : snapshot.data();
1934
1974
  }
1935
1975
  function documentDataFunction(withId) {
1936
1976
  return withId ? documentDataWithIdAndKey : function(snapshot) {
@@ -2447,12 +2487,20 @@ function _object_spread_props$j(target, source) {
2447
2487
  /**
2448
2488
  * Implementation of FirestoreDataConverter.fromFirestore
2449
2489
  * Converts Firestore data to the application model type
2490
+ *
2491
+ * @param snapshot - The DocumentSnapshot containing raw Firestore data
2492
+ * @param options - Optional SnapshotOptions for reading data
2493
+ * @returns The converted application model instance
2450
2494
  */ fromFirestore: function fromFirestore(snapshot, options) {
2451
2495
  return from(snapshot, undefined);
2452
2496
  },
2453
2497
  /**
2454
2498
  * Implementation of FirestoreDataConverter.toFirestore
2455
2499
  * Converts the application model to Firestore data format
2500
+ *
2501
+ * @param modelObject - The model object to convert to Firestore data
2502
+ * @param options - Optional SetOptions controlling how data is written
2503
+ * @returns The converted Firestore data object
2456
2504
  */ toFirestore: function toFirestore(modelObject, options) {
2457
2505
  return to(modelObject, undefined, options);
2458
2506
  }
@@ -2578,7 +2626,7 @@ function _object_spread_props$i(target, source) {
2578
2626
  function optionalFirestoreField(config) {
2579
2627
  // NOTE: Typings for this function internally is weird due to the support for both the one and two type transforms.
2580
2628
  if (config) {
2581
- var inputConfig = config !== null && config !== void 0 ? config : {};
2629
+ var inputConfig = config;
2582
2630
  var dontStoreDefaultReadValue = inputConfig.dontStoreDefaultReadValue, inputDontStoreValueIf = inputConfig.dontStoreValueIf, inputTransformData = inputConfig.transformData; // might be defined.
2583
2631
  var inputDefaultReadValue = inputConfig.defaultReadValue, inputDontStoreIf = inputConfig.dontStoreIf, transformFromData = inputConfig.transformFromData, transformToData = inputConfig.transformToData;
2584
2632
  var transformData = inputTransformData !== null && inputTransformData !== void 0 ? inputTransformData : util.passThrough;
@@ -2626,8 +2674,7 @@ function optionalFirestoreField(config) {
2626
2674
  toData = function toData(x) {
2627
2675
  if (x != null) {
2628
2676
  var transformedValue = transformTo(x);
2629
- var finalValue = transformedValue != null && !dontStoreValue(transformedValue) ? transformedValue : null;
2630
- return finalValue;
2677
+ return transformedValue != null && !dontStoreValue(transformedValue) ? transformedValue : null;
2631
2678
  } else {
2632
2679
  return x;
2633
2680
  }
@@ -2959,8 +3006,7 @@ function optionalFirestoreField(config) {
2959
3006
  }
2960
3007
  var inputFilterUnique = (config === null || config === void 0 ? void 0 : config.filterUnique) === true ? util.unique : config === null || config === void 0 ? void 0 : config.filterUnique;
2961
3008
  var filterUniqueValuesFn = inputFilterUnique != null ? function(x) {
2962
- var result = inputFilterUnique(x);
2963
- return result;
3009
+ return inputFilterUnique(x);
2964
3010
  } : undefined;
2965
3011
  var inputTransformData = config === null || config === void 0 ? void 0 : config.transformData;
2966
3012
  var sortArrayFn = util.isMapIdentityFunction(sortFn) ? undefined : function(x) {
@@ -3050,7 +3096,8 @@ function optionalFirestoreField(config) {
3050
3096
  * @template S - Number type (defaults to number)
3051
3097
  * @param config - Configuration for the unique number array field
3052
3098
  * @returns A field mapping configuration for unique number array values
3053
- */ function firestoreUniqueNumberArray(config) {
3099
+ */ // eslint-disable-next-line sonarjs/no-identical-functions -- intentionally separate for distinct type constraints (number vs string|number)
3100
+ function firestoreUniqueNumberArray(config) {
3054
3101
  return firestoreUniqueArray(_object_spread_props$i(_object_spread$m({}, config), {
3055
3102
  filterUnique: util.unique
3056
3103
  }));
@@ -3168,6 +3215,8 @@ function optionalFirestoreField(config) {
3168
3215
  * FirestoreField configuration for a map of granted roles, keyed by model keys.
3169
3216
  *
3170
3217
  * Filters out models with no/null roles by default.
3218
+ *
3219
+ * @returns A field mapping configuration for a map of granted roles keyed by FirestoreModelKey
3171
3220
  */ function firestoreModelKeyGrantedRoleMap() {
3172
3221
  return firestoreMap({
3173
3222
  mapFilter: util.KeyValueTypleValueFilter.EMPTY
@@ -3202,13 +3251,11 @@ function optionalFirestoreField(config) {
3202
3251
  },
3203
3252
  fromData: function fromData(input) {
3204
3253
  var copy = util.copyObject(input);
3205
- var result = util.mapObjectMap(copy, decoder);
3206
- return result;
3254
+ return util.mapObjectMap(copy, decoder);
3207
3255
  },
3208
3256
  toData: function toData(input) {
3209
3257
  var encodedMap = util.mapObjectMap(input, encoder);
3210
- var result = filterFinalMapValuesFn(encodedMap);
3211
- return result;
3258
+ return filterFinalMapValuesFn(encodedMap);
3212
3259
  }
3213
3260
  });
3214
3261
  }
@@ -3234,6 +3281,9 @@ function optionalFirestoreField(config) {
3234
3281
  * FirestoreField configuration for a map of encoded granted roles, keyed by model keys.
3235
3282
  *
3236
3283
  * Filters out models with empty/no roles by default.
3284
+ *
3285
+ * @param dencoder - The dencoder function used to encode and decode the role values
3286
+ * @returns A field mapping configuration for an encoded granted role map keyed by FirestoreModelKey
3237
3287
  */ function firestoreModelKeyEncodedGrantedRoleMap(dencoder) {
3238
3288
  return firestoreDencoderMap({
3239
3289
  dencoder: dencoder
@@ -3259,6 +3309,8 @@ function optionalFirestoreField(config) {
3259
3309
  * FirestoreField configuration for a map of granted roles, keyed by models keys.
3260
3310
  *
3261
3311
  * Filters empty roles/arrays by default.
3312
+ *
3313
+ * @returns A field mapping configuration for a map of granted role arrays keyed by FirestoreModelKey
3262
3314
  */ function firestoreModelKeyGrantedRoleArrayMap() {
3263
3315
  return firestoreArrayMap({
3264
3316
  mapFieldValues: util.filterEmptyArrayValues
@@ -3274,6 +3326,9 @@ function optionalFirestoreField(config) {
3274
3326
  *
3275
3327
  * Used internally by {@link firestoreObjectArray} to adapt field configs into the map functions
3276
3328
  * format needed for array element conversion.
3329
+ *
3330
+ * @param config - The FirestoreModelFieldMapFunctionsConfig to convert
3331
+ * @returns A ModelMapFunctionsRef wrapping the derived map functions
3277
3332
  */ function firestoreFieldConfigToModelMapFunctionsRef(config) {
3278
3333
  var mapFunctions = util.modelFieldMapFunctions(config);
3279
3334
  return {
@@ -3324,8 +3379,7 @@ function optionalFirestoreField(config) {
3324
3379
  var to = function to(x) {
3325
3380
  // remove null/undefined values from each field when converting to in order to mirror firestore usage (undefined is treated like null)
3326
3381
  var base = baseTo(x);
3327
- var nullishfilteredOut = util.filterNullAndUndefinedValues(base);
3328
- return nullishfilteredOut;
3382
+ return util.filterNullAndUndefinedValues(base);
3329
3383
  };
3330
3384
  return firestoreField({
3331
3385
  default: (_config_default = config.default) !== null && _config_default !== void 0 ? _config_default : function() {
@@ -3378,7 +3432,7 @@ function optionalFirestoreField(config) {
3378
3432
  var defaultBeforeSave = (_config_defaultBeforeSave = config.defaultBeforeSave) !== null && _config_defaultBeforeSave !== void 0 ? _config_defaultBeforeSave : config.saveDefaultObject ? function() {
3379
3433
  return toData({});
3380
3434
  } : null;
3381
- var mapFunctionsConfig = util.build({
3435
+ return util.build({
3382
3436
  base: firestoreField({
3383
3437
  default: (_config_default = config.default) !== null && _config_default !== void 0 ? _config_default : defaultWithFields,
3384
3438
  defaultBeforeSave: defaultBeforeSave,
@@ -3389,7 +3443,6 @@ function optionalFirestoreField(config) {
3389
3443
  x.mapFunctions = mapFunctions;
3390
3444
  }
3391
3445
  });
3392
- return mapFunctionsConfig;
3393
3446
  }
3394
3447
  /**
3395
3448
  * Creates a field mapping configuration for Firestore latitude/longitude string fields.
@@ -3419,7 +3472,10 @@ function optionalFirestoreField(config) {
3419
3472
  /**
3420
3473
  * Default configuration for a TimezoneString.
3421
3474
  *
3422
- * The value defaults to UTC
3475
+ * The value defaults to UTC.
3476
+ *
3477
+ * @param config - Optional configuration for the timezone string field, including default value and pre-save default.
3478
+ * @returns A configured Firestore field that stores a TimezoneString value.
3423
3479
  */ function firestoreTimezoneString(config) {
3424
3480
  var _ref = config !== null && config !== void 0 ? config : {}, defaultValue = _ref.default, defaultBeforeSave = _ref.defaultBeforeSave;
3425
3481
  return firestoreString({
@@ -3440,8 +3496,7 @@ var assignWebsiteLinkFunction = util.assignValuesToPOJOFunction({
3440
3496
  valueFilter: util.KeyValueTypleValueFilter.EMPTY
3441
3497
  });
3442
3498
  var firestoreWebsiteLinkAssignFn = function firestoreWebsiteLinkAssignFn(input) {
3443
- var behavior = assignWebsiteLinkFunction(DEFAULT_WEBSITE_LINK, input);
3444
- return behavior;
3499
+ return assignWebsiteLinkFunction(DEFAULT_WEBSITE_LINK, input);
3445
3500
  };
3446
3501
  /**
3447
3502
  * Creates a field mapping configuration for Firestore website link fields.
@@ -3457,7 +3512,11 @@ var firestoreWebsiteLinkAssignFn = function firestoreWebsiteLinkAssignFn(input)
3457
3512
  });
3458
3513
  }
3459
3514
  // MARK: WebsiteLink Array
3460
- function firestoreWebsiteLinkArray() {
3515
+ /**
3516
+ * Creates a field mapping configuration for Firestore arrays of WebsiteLink values.
3517
+ *
3518
+ * @returns A field mapping configuration for WebsiteLink array values
3519
+ */ function firestoreWebsiteLinkArray() {
3461
3520
  return firestoreObjectArray({
3462
3521
  firestoreField: firestoreWebsiteLink()
3463
3522
  });
@@ -3475,8 +3534,7 @@ var assignWebsiteFileLinkFunction = util.assignValuesToPOJOFunction({
3475
3534
  valueFilter: util.KeyValueTypleValueFilter.EMPTY
3476
3535
  });
3477
3536
  var firestoreWebsiteFileLinkAssignFn = function firestoreWebsiteFileLinkAssignFn(input) {
3478
- var behavior = assignWebsiteFileLinkFunction(DEFAULT_FIRESTORE_WEBSITE_FILE_LINK_VALUE, input);
3479
- return behavior;
3537
+ return assignWebsiteFileLinkFunction(DEFAULT_FIRESTORE_WEBSITE_FILE_LINK_VALUE, input);
3480
3538
  };
3481
3539
  /**
3482
3540
  * Creates a field mapping configuration for Firestore website file link fields.
@@ -3494,6 +3552,8 @@ var firestoreWebsiteFileLinkAssignFn = function firestoreWebsiteFileLinkAssignFn
3494
3552
  // MARK: WebsiteFileLink Array
3495
3553
  /**
3496
3554
  * Stores the array of WebsiteFileLink values as an array of objects.
3555
+ *
3556
+ * @returns A field mapping configuration for WebsiteFileLink array values stored as objects
3497
3557
  */ function firestoreWebsiteFileLinkObjectArray() {
3498
3558
  return firestoreObjectArray({
3499
3559
  firestoreField: firestoreWebsiteFileLink()
@@ -3501,6 +3561,8 @@ var firestoreWebsiteFileLinkAssignFn = function firestoreWebsiteFileLinkAssignFn
3501
3561
  }
3502
3562
  /**
3503
3563
  * Stores the array of WebsiteFileLink values as an array of EncodedWebsiteFileLink values.
3564
+ *
3565
+ * @returns A field mapping configuration for WebsiteFileLink array values stored in encoded form
3504
3566
  */ function firestoreWebsiteFileLinkEncodedArray() {
3505
3567
  return firestoreEncodedArray({
3506
3568
  convert: {
@@ -3539,7 +3601,12 @@ var firestoreDateCellRangeAssignFn = function firestoreDateCellRangeAssignFn(inp
3539
3601
  });
3540
3602
  }
3541
3603
  // MARK: DateCellRange Array
3542
- function firestoreDateCellRangeArray() {
3604
+ /**
3605
+ * Creates a field mapping configuration for Firestore arrays of DateCellRange values.
3606
+ *
3607
+ * @param sort - Whether to sort the array by index number; defaults to true
3608
+ * @returns A field mapping configuration for DateCellRange array values
3609
+ */ function firestoreDateCellRangeArray() {
3543
3610
  var sort = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : true;
3544
3611
  return firestoreObjectArray({
3545
3612
  sortWith: sort ? util.sortAscendingIndexNumberRefFunction() : undefined,
@@ -3559,8 +3626,7 @@ var assignDateCellScheduleFunction = util.assignValuesToPOJOFunction({
3559
3626
  valueFilter: util.KeyValueTypleValueFilter.NULL
3560
3627
  });
3561
3628
  var firestoreDateCellScheduleAssignFn = function firestoreDateCellScheduleAssignFn(input) {
3562
- var block = assignDateCellScheduleFunction(DEFAULT_FIRESTORE_DATE_CELL_SCHEDULE_VALUE, input);
3563
- return block;
3629
+ return assignDateCellScheduleFunction(DEFAULT_FIRESTORE_DATE_CELL_SCHEDULE_VALUE, input);
3564
3630
  };
3565
3631
  /**
3566
3632
  * Creates a field mapping configuration for Firestore date cell schedule fields.
@@ -3594,6 +3660,9 @@ var DEFAULT_FIRESTORE_UNITED_STATES_ADDRESS_VALUE = {
3594
3660
  });
3595
3661
  /**
3596
3662
  * Function to assign values from an input UnitedStatesAddress to a default UnitedStatesAddress.
3663
+ *
3664
+ * @param input - The source UnitedStatesAddress to copy values from
3665
+ * @returns A new UnitedStatesAddress with values assigned from the input
3597
3666
  */ var firestoreUnitedStatesAddressAssignFn = function firestoreUnitedStatesAddressAssignFn(input) {
3598
3667
  return assignUnitedStatesAddressFunction(DEFAULT_FIRESTORE_UNITED_STATES_ADDRESS_VALUE, input);
3599
3668
  };
@@ -3731,37 +3800,37 @@ function firebaseQueryItemAccumulator(iteration, mapItem) {
3731
3800
  var mapFn = function mapFn(x) {
3732
3801
  var result = util.filterMaybeArrayValues(x.map(function(y) {
3733
3802
  var data = snapshotData(y);
3734
- return data ? mapItem(data) : undefined;
3803
+ return mapItem(data);
3735
3804
  }));
3736
3805
  return result;
3737
3806
  };
3738
3807
  return firebaseQuerySnapshotAccumulator(iteration, mapFn);
3739
3808
  }
3740
3809
 
3741
- function _array_like_to_array$f(arr, len) {
3810
+ function _array_like_to_array$g(arr, len) {
3742
3811
  if (len == null || len > arr.length) len = arr.length;
3743
3812
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
3744
3813
  return arr2;
3745
3814
  }
3746
- function _array_without_holes$b(arr) {
3747
- if (Array.isArray(arr)) return _array_like_to_array$f(arr);
3815
+ function _array_without_holes$d(arr) {
3816
+ if (Array.isArray(arr)) return _array_like_to_array$g(arr);
3748
3817
  }
3749
- function _iterable_to_array$b(iter) {
3818
+ function _iterable_to_array$d(iter) {
3750
3819
  if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
3751
3820
  }
3752
- function _non_iterable_spread$b() {
3821
+ function _non_iterable_spread$d() {
3753
3822
  throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
3754
3823
  }
3755
- function _to_consumable_array$b(arr) {
3756
- return _array_without_holes$b(arr) || _iterable_to_array$b(arr) || _unsupported_iterable_to_array$f(arr) || _non_iterable_spread$b();
3824
+ function _to_consumable_array$d(arr) {
3825
+ return _array_without_holes$d(arr) || _iterable_to_array$d(arr) || _unsupported_iterable_to_array$g(arr) || _non_iterable_spread$d();
3757
3826
  }
3758
- function _unsupported_iterable_to_array$f(o, minLen) {
3827
+ function _unsupported_iterable_to_array$g(o, minLen) {
3759
3828
  if (!o) return;
3760
- if (typeof o === "string") return _array_like_to_array$f(o, minLen);
3829
+ if (typeof o === "string") return _array_like_to_array$g(o, minLen);
3761
3830
  var n = Object.prototype.toString.call(o).slice(8, -1);
3762
3831
  if (n === "Object" && o.constructor) n = o.constructor.name;
3763
3832
  if (n === "Map" || n === "Set") return Array.from(n);
3764
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$f(o, minLen);
3833
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$g(o, minLen);
3765
3834
  }
3766
3835
  /**
3767
3836
  * Creates a {@link FirestoreQueryConstraint} with the given type identifier and data.
@@ -4060,7 +4129,7 @@ function orderBy(fieldPath, directionStr) {
4060
4129
  * const newConstraints = withLastLimit10(existingConstraints);
4061
4130
  */ function addOrReplaceLimitInConstraints(limit) {
4062
4131
  var addedLimitType = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : FIRESTORE_LIMIT_QUERY_CONSTRAINT_TYPE;
4063
- var replace = replaceConstraints(function(constraints) {
4132
+ return replaceConstraints(function(constraints) {
4064
4133
  var type;
4065
4134
  if (constraints.length) {
4066
4135
  type = constraints[0].type;
@@ -4077,7 +4146,6 @@ function orderBy(fieldPath, directionStr) {
4077
4146
  FIRESTORE_LIMIT_QUERY_CONSTRAINT_TYPE,
4078
4147
  FIRESTORE_LIMIT_TO_LAST_QUERY_CONSTRAINT_TYPE
4079
4148
  ]);
4080
- return replace;
4081
4149
  }
4082
4150
  /**
4083
4151
  * Creates a function that filters out constraints of specific types.
@@ -4122,11 +4190,11 @@ function orderBy(fieldPath, directionStr) {
4122
4190
  * );
4123
4191
  * const newConstraints = replaceLimit(existingConstraints);
4124
4192
  */ function replaceConstraints(replaceFn, types) {
4125
- var separateFn = separateConstraints.apply(void 0, _to_consumable_array$b(types));
4193
+ var separateFn = separateConstraints.apply(void 0, _to_consumable_array$d(types));
4126
4194
  return function(constraints) {
4127
4195
  var separated = separateFn(constraints);
4128
4196
  var replacements = util.asArray(replaceFn(separated.excluded));
4129
- return replacements ? util.pushItemOrArrayItemsIntoArray(separated.included, replacements) : separated.included;
4197
+ return util.pushItemOrArrayItemsIntoArray(separated.included, replacements);
4130
4198
  };
4131
4199
  }
4132
4200
  /**
@@ -4151,10 +4219,9 @@ function orderBy(fieldPath, directionStr) {
4151
4219
  }
4152
4220
  return function(constraints) {
4153
4221
  var typesToFilterOut = new Set(types);
4154
- var separated = util.separateValues(constraints, function(x) {
4222
+ return util.separateValues(constraints, function(x) {
4155
4223
  return !typesToFilterOut.has(x.type);
4156
4224
  });
4157
- return separated;
4158
4225
  };
4159
4226
  }
4160
4227
 
@@ -4309,13 +4376,13 @@ function whereDateIsBeforeWithSort(fieldPath) {
4309
4376
  ];
4310
4377
  }
4311
4378
 
4312
- function _array_like_to_array$e(arr, len) {
4379
+ function _array_like_to_array$f(arr, len) {
4313
4380
  if (len == null || len > arr.length) len = arr.length;
4314
4381
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
4315
4382
  return arr2;
4316
4383
  }
4317
- function _array_without_holes$a(arr) {
4318
- if (Array.isArray(arr)) return _array_like_to_array$e(arr);
4384
+ function _array_without_holes$c(arr) {
4385
+ if (Array.isArray(arr)) return _array_like_to_array$f(arr);
4319
4386
  }
4320
4387
  function _define_property$r(obj, key, value) {
4321
4388
  if (key in obj) {
@@ -4330,10 +4397,10 @@ function _define_property$r(obj, key, value) {
4330
4397
  }
4331
4398
  return obj;
4332
4399
  }
4333
- function _iterable_to_array$a(iter) {
4400
+ function _iterable_to_array$c(iter) {
4334
4401
  if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
4335
4402
  }
4336
- function _non_iterable_spread$a() {
4403
+ function _non_iterable_spread$c() {
4337
4404
  throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
4338
4405
  }
4339
4406
  function _object_spread$l(target) {
@@ -4370,16 +4437,16 @@ function _object_spread_props$h(target, source) {
4370
4437
  }
4371
4438
  return target;
4372
4439
  }
4373
- function _to_consumable_array$a(arr) {
4374
- return _array_without_holes$a(arr) || _iterable_to_array$a(arr) || _unsupported_iterable_to_array$e(arr) || _non_iterable_spread$a();
4440
+ function _to_consumable_array$c(arr) {
4441
+ return _array_without_holes$c(arr) || _iterable_to_array$c(arr) || _unsupported_iterable_to_array$f(arr) || _non_iterable_spread$c();
4375
4442
  }
4376
- function _unsupported_iterable_to_array$e(o, minLen) {
4443
+ function _unsupported_iterable_to_array$f(o, minLen) {
4377
4444
  if (!o) return;
4378
- if (typeof o === "string") return _array_like_to_array$e(o, minLen);
4445
+ if (typeof o === "string") return _array_like_to_array$f(o, minLen);
4379
4446
  var n = Object.prototype.toString.call(o).slice(8, -1);
4380
4447
  if (n === "Object" && o.constructor) n = o.constructor.name;
4381
4448
  if (n === "Map" || n === "Set") return Array.from(n);
4382
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$e(o, minLen);
4449
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$f(o, minLen);
4383
4450
  }
4384
4451
  /**
4385
4452
  * Filters out constraints that should not be directly specified in pagination queries.
@@ -4442,13 +4509,13 @@ function _unsupported_iterable_to_array$e(o, minLen) {
4442
4509
  // Add Limit
4443
4510
  var limitCount = filterLimit !== null && filterLimit !== void 0 ? filterLimit : itemsPerPage + (startAfterFilter ? 1 : 0); // todo: may not be needed.
4444
4511
  var limitConstraint = limit(limitCount);
4445
- var constraintsWithLimit = _to_consumable_array$a(constraints).concat([
4512
+ var constraintsWithLimit = _to_consumable_array$c(constraints).concat([
4446
4513
  limitConstraint
4447
4514
  ]);
4448
4515
  // make query
4449
4516
  var batchQuery = (_driver = driver).query.apply(_driver, [
4450
4517
  queryLike
4451
- ].concat(_to_consumable_array$a(constraintsWithLimit)));
4518
+ ].concat(_to_consumable_array$c(constraintsWithLimit)));
4452
4519
  var resultPromise = driver.getDocs(batchQuery).then(function(snapshot) {
4453
4520
  var time = new Date();
4454
4521
  var docs = snapshot.docs;
@@ -4677,7 +4744,7 @@ function _firestoreItemPageIterationWithSnapshotIteration(snapshotIteration) {
4677
4744
  return snapshot;
4678
4745
  });
4679
4746
  };
4680
- var resultPromise = _loadFakeQuerySnapshot().then(function(snapshot) {
4747
+ return _loadFakeQuerySnapshot().then(function(snapshot) {
4681
4748
  var result = {
4682
4749
  value: {
4683
4750
  time: time,
@@ -4686,7 +4753,7 @@ function _firestoreItemPageIterationWithSnapshotIteration(snapshotIteration) {
4686
4753
  reload: function reload() {
4687
4754
  return _loadFakeQuerySnapshot();
4688
4755
  },
4689
- stream: function stream(options) {
4756
+ stream: function stream(_options) {
4690
4757
  // TODO: Count potentially stream to fully implement, but might not be used anyways.
4691
4758
  return rxjs$1.of(snapshot);
4692
4759
  }
@@ -4695,7 +4762,6 @@ function _firestoreItemPageIterationWithSnapshotIteration(snapshotIteration) {
4695
4762
  };
4696
4763
  return result;
4697
4764
  });
4698
- return resultPromise;
4699
4765
  }
4700
4766
  }));
4701
4767
  }
@@ -4705,13 +4771,13 @@ function _firestoreItemPageIterationWithSnapshotIteration(snapshotIteration) {
4705
4771
  return _firestoreItemPageIterationWithSnapshotIteration(snapshotIteration);
4706
4772
  }
4707
4773
 
4708
- function _array_like_to_array$d(arr, len) {
4774
+ function _array_like_to_array$e(arr, len) {
4709
4775
  if (len == null || len > arr.length) len = arr.length;
4710
4776
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
4711
4777
  return arr2;
4712
4778
  }
4713
- function _array_without_holes$9(arr) {
4714
- if (Array.isArray(arr)) return _array_like_to_array$d(arr);
4779
+ function _array_without_holes$b(arr) {
4780
+ if (Array.isArray(arr)) return _array_like_to_array$e(arr);
4715
4781
  }
4716
4782
  function asyncGeneratorStep$g(gen, resolve, reject, _next, _throw, key, arg) {
4717
4783
  try {
@@ -4742,22 +4808,22 @@ function _async_to_generator$g(fn) {
4742
4808
  });
4743
4809
  };
4744
4810
  }
4745
- function _iterable_to_array$9(iter) {
4811
+ function _iterable_to_array$b(iter) {
4746
4812
  if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
4747
4813
  }
4748
- function _non_iterable_spread$9() {
4814
+ function _non_iterable_spread$b() {
4749
4815
  throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
4750
4816
  }
4751
- function _to_consumable_array$9(arr) {
4752
- return _array_without_holes$9(arr) || _iterable_to_array$9(arr) || _unsupported_iterable_to_array$d(arr) || _non_iterable_spread$9();
4817
+ function _to_consumable_array$b(arr) {
4818
+ return _array_without_holes$b(arr) || _iterable_to_array$b(arr) || _unsupported_iterable_to_array$e(arr) || _non_iterable_spread$b();
4753
4819
  }
4754
- function _unsupported_iterable_to_array$d(o, minLen) {
4820
+ function _unsupported_iterable_to_array$e(o, minLen) {
4755
4821
  if (!o) return;
4756
- if (typeof o === "string") return _array_like_to_array$d(o, minLen);
4822
+ if (typeof o === "string") return _array_like_to_array$e(o, minLen);
4757
4823
  var n = Object.prototype.toString.call(o).slice(8, -1);
4758
4824
  if (n === "Object" && o.constructor) n = o.constructor.name;
4759
4825
  if (n === "Map" || n === "Set") return Array.from(n);
4760
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$d(o, minLen);
4826
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$e(o, minLen);
4761
4827
  }
4762
4828
  function _ts_generator$g(thisArg, body) {
4763
4829
  var f, y, t, _ = {
@@ -4895,7 +4961,7 @@ function _ts_generator$g(thisArg, body) {
4895
4961
  var allConstraints = util.flattenArrayOrValueArray(queryConstraints);
4896
4962
  var query = makeQuery.apply(void 0, [
4897
4963
  inputQuery
4898
- ].concat(_to_consumable_array$9(allConstraints)));
4964
+ ].concat(_to_consumable_array$b(allConstraints)));
4899
4965
  var result = {
4900
4966
  query: query,
4901
4967
  countDocs: function countDocs1() {
@@ -4917,7 +4983,7 @@ function _ts_generator$g(thisArg, body) {
4917
4983
  constraintsForOneDoc = addOrReplaceLimitInConstraints(1)(allConstraints);
4918
4984
  query = makeQuery.apply(void 0, [
4919
4985
  inputQuery
4920
- ].concat(_to_consumable_array$9(constraintsForOneDoc)));
4986
+ ].concat(_to_consumable_array$b(constraintsForOneDoc)));
4921
4987
  return [
4922
4988
  4,
4923
4989
  getDocs(query, transaction)
@@ -5021,7 +5087,7 @@ function _ts_generator$g(thisArg, body) {
5021
5087
  return snapshot.ref.path;
5022
5088
  }
5023
5089
 
5024
- function _array_like_to_array$c(arr, len) {
5090
+ function _array_like_to_array$d(arr, len) {
5025
5091
  if (len == null || len > arr.length) len = arr.length;
5026
5092
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
5027
5093
  return arr2;
@@ -5133,15 +5199,15 @@ function _object_spread_props$g(target, source) {
5133
5199
  return target;
5134
5200
  }
5135
5201
  function _sliced_to_array$3(arr, i) {
5136
- return _array_with_holes$3(arr) || _iterable_to_array_limit$3(arr, i) || _unsupported_iterable_to_array$c(arr, i) || _non_iterable_rest$3();
5202
+ return _array_with_holes$3(arr) || _iterable_to_array_limit$3(arr, i) || _unsupported_iterable_to_array$d(arr, i) || _non_iterable_rest$3();
5137
5203
  }
5138
- function _unsupported_iterable_to_array$c(o, minLen) {
5204
+ function _unsupported_iterable_to_array$d(o, minLen) {
5139
5205
  if (!o) return;
5140
- if (typeof o === "string") return _array_like_to_array$c(o, minLen);
5206
+ if (typeof o === "string") return _array_like_to_array$d(o, minLen);
5141
5207
  var n = Object.prototype.toString.call(o).slice(8, -1);
5142
5208
  if (n === "Object" && o.constructor) n = o.constructor.name;
5143
5209
  if (n === "Map" || n === "Set") return Array.from(n);
5144
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$c(o, minLen);
5210
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$d(o, minLen);
5145
5211
  }
5146
5212
  function _ts_generator$f(thisArg, body) {
5147
5213
  var f, y, t, _ = {
@@ -5331,27 +5397,17 @@ function _ts_generator$f(thisArg, body) {
5331
5397
  maxParallelCheckpoints: 1,
5332
5398
  iterateSnapshotBatch: function iterateSnapshotBatch(docSnapshots) {
5333
5399
  return _async_to_generator$f(function() {
5334
- var performTasksResult;
5335
5400
  return _ts_generator$f(this, function(_state) {
5336
- switch(_state.label){
5337
- case 0:
5338
- return [
5339
- 4,
5340
- util.performAsyncTasks(docSnapshots, iterateSnapshot, _object_spread$k({
5341
- sequential: true
5342
- }, snapshotsPerformTasksConfig !== null && snapshotsPerformTasksConfig !== void 0 ? snapshotsPerformTasksConfig : _object_spread_props$g(_object_spread$k({}, performTasksConfig), {
5343
- nonConcurrentTaskKeyFactory: undefined,
5344
- beforeRetry: undefined
5345
- }) // don't pass the nonConcurrentTaskKeyFactory
5346
- ))
5347
- ];
5348
- case 1:
5349
- performTasksResult = _state.sent();
5350
- return [
5351
- 2,
5352
- performTasksResult
5353
- ];
5354
- }
5401
+ return [
5402
+ 2,
5403
+ util.performAsyncTasks(docSnapshots, iterateSnapshot, _object_spread$k({
5404
+ sequential: true
5405
+ }, snapshotsPerformTasksConfig !== null && snapshotsPerformTasksConfig !== void 0 ? snapshotsPerformTasksConfig : _object_spread_props$g(_object_spread$k({}, performTasksConfig), {
5406
+ nonConcurrentTaskKeyFactory: undefined,
5407
+ beforeRetry: undefined
5408
+ }) // don't pass the nonConcurrentTaskKeyFactory
5409
+ ))
5410
+ ];
5355
5411
  });
5356
5412
  })();
5357
5413
  }
@@ -5466,14 +5522,9 @@ function _ts_generator$f(thisArg, body) {
5466
5522
  case 0:
5467
5523
  if (!(docSnapshots.length > 0)) return [
5468
5524
  3,
5469
- 3
5470
- ];
5471
- return [
5472
- 4,
5473
- batchSizeForSnapshots(docSnapshots)
5525
+ 2
5474
5526
  ];
5475
- case 1:
5476
- batchSizeForSnapshotsResult = _state.sent();
5527
+ batchSizeForSnapshotsResult = batchSizeForSnapshots(docSnapshots);
5477
5528
  batches = batchSizeForSnapshotsResult === null ? [
5478
5529
  docSnapshots
5479
5530
  ] : util.batch(docSnapshots, batchSizeForSnapshotsResult);
@@ -5486,7 +5537,7 @@ function _ts_generator$f(thisArg, body) {
5486
5537
  sequential: true
5487
5538
  }, performTasksConfig))
5488
5539
  ];
5489
- case 2:
5540
+ case 1:
5490
5541
  performTasksResult = _state.sent();
5491
5542
  return [
5492
5543
  2,
@@ -5499,12 +5550,12 @@ function _ts_generator$f(thisArg, body) {
5499
5550
  };
5500
5551
  })
5501
5552
  ];
5502
- case 3:
5553
+ case 2:
5503
5554
  return [
5504
5555
  2,
5505
5556
  []
5506
5557
  ];
5507
- case 4:
5558
+ case 3:
5508
5559
  return [
5509
5560
  2
5510
5561
  ];
@@ -5601,6 +5652,7 @@ function _ts_generator$f(thisArg, body) {
5601
5652
  */ function iterateFirestoreDocumentSnapshotCheckpoints(config) {
5602
5653
  return _async_to_generator$f(function() {
5603
5654
  var iterateCheckpoint, inputFilterCheckpointSnapshot, inputHandleRepeatCursor, waitBetweenCheckpoints, useCheckpointResult, inputConstraintsFactory, inputDynamicConstraints, queryFactory, _config_maxParallelCheckpoints, maxParallelCheckpoints, inputLimitPerCheckpoint, inputTotalSnapshotsLimit, constraintsInputIsFactory, constraintsFactory, limitPerCheckpoint, totalSnapshotsLimit, currentIndex, hasReachedEnd, totalSnapshotsLimitReached, totalSnapshotsVisited, cursorDocument, visitedCursorPaths, handleRepeatCursor, filterCheckpointSnapshot, performTaskFn, result;
5655
+ // eslint-disable-next-line sonarjs/cognitive-complexity -- cursor-based pagination logic with repeat detection is inherently complex
5604
5656
  function taskInputFactory() {
5605
5657
  return _async_to_generator$f(function() {
5606
5658
  var result, constraints, startAfterFilter, shouldContinue, totalPossibleNumberOfItemsLeftToLoad, nextLimit, query, docQuerySnapshot, docSnapshots, nextCursorDocument, cursorPath, repeatResult, newSnapshotsVisited, i;
@@ -6166,7 +6218,7 @@ function _ts_generator$e(thisArg, body) {
6166
6218
  }), rxjs$1.shareReplay(1));
6167
6219
  var event$ = stream$.pipe(rxjs$1.map(function(event) {
6168
6220
  var changes = event.docChanges();
6169
- var results = util.build({
6221
+ return util.build({
6170
6222
  base: util.groupValues(changes, function(x) {
6171
6223
  return x.type;
6172
6224
  }),
@@ -6180,7 +6232,6 @@ function _ts_generator$e(thisArg, body) {
6180
6232
  x.type = iterationQueryDocChangeWatcherChangeTypeForGroup(x);
6181
6233
  }
6182
6234
  });
6183
- return results;
6184
6235
  }), rxjs$1.shareReplay(1));
6185
6236
  return {
6186
6237
  stream$: stream$,
@@ -6219,13 +6270,13 @@ function _ts_generator$e(thisArg, body) {
6219
6270
  return type;
6220
6271
  }
6221
6272
 
6222
- function _array_like_to_array$b(arr, len) {
6273
+ function _array_like_to_array$c(arr, len) {
6223
6274
  if (len == null || len > arr.length) len = arr.length;
6224
6275
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
6225
6276
  return arr2;
6226
6277
  }
6227
- function _array_without_holes$8(arr) {
6228
- if (Array.isArray(arr)) return _array_like_to_array$b(arr);
6278
+ function _array_without_holes$a(arr) {
6279
+ if (Array.isArray(arr)) return _array_like_to_array$c(arr);
6229
6280
  }
6230
6281
  function asyncGeneratorStep$d(gen, resolve, reject, _next, _throw, key, arg) {
6231
6282
  try {
@@ -6256,22 +6307,22 @@ function _async_to_generator$d(fn) {
6256
6307
  });
6257
6308
  };
6258
6309
  }
6259
- function _iterable_to_array$8(iter) {
6310
+ function _iterable_to_array$a(iter) {
6260
6311
  if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
6261
6312
  }
6262
- function _non_iterable_spread$8() {
6313
+ function _non_iterable_spread$a() {
6263
6314
  throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
6264
6315
  }
6265
- function _to_consumable_array$8(arr) {
6266
- return _array_without_holes$8(arr) || _iterable_to_array$8(arr) || _unsupported_iterable_to_array$b(arr) || _non_iterable_spread$8();
6316
+ function _to_consumable_array$a(arr) {
6317
+ return _array_without_holes$a(arr) || _iterable_to_array$a(arr) || _unsupported_iterable_to_array$c(arr) || _non_iterable_spread$a();
6267
6318
  }
6268
- function _unsupported_iterable_to_array$b(o, minLen) {
6319
+ function _unsupported_iterable_to_array$c(o, minLen) {
6269
6320
  if (!o) return;
6270
- if (typeof o === "string") return _array_like_to_array$b(o, minLen);
6321
+ if (typeof o === "string") return _array_like_to_array$c(o, minLen);
6271
6322
  var n = Object.prototype.toString.call(o).slice(8, -1);
6272
6323
  if (n === "Object" && o.constructor) n = o.constructor.name;
6273
6324
  if (n === "Map" || n === "Set") return Array.from(n);
6274
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$b(o, minLen);
6325
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$c(o, minLen);
6275
6326
  }
6276
6327
  function _ts_generator$d(thisArg, body) {
6277
6328
  var f, y, t, _ = {
@@ -6489,7 +6540,7 @@ function _ts_generator$d(thisArg, body) {
6489
6540
  for(var _len = arguments.length, queryConstraints = new Array(_len), _key = 0; _key < _len; _key++){
6490
6541
  queryConstraints[_key] = arguments[_key];
6491
6542
  }
6492
- return wrapQuery((_baseQuery = baseQuery).filter.apply(_baseQuery, _to_consumable_array$8(queryConstraints)));
6543
+ return wrapQuery((_baseQuery = baseQuery).filter.apply(_baseQuery, _to_consumable_array$a(queryConstraints)));
6493
6544
  }
6494
6545
  };
6495
6546
  };
@@ -6499,18 +6550,18 @@ function _ts_generator$d(thisArg, body) {
6499
6550
  for(var _len = arguments.length, queryConstraints = new Array(_len), _key = 0; _key < _len; _key++){
6500
6551
  queryConstraints[_key] = arguments[_key];
6501
6552
  }
6502
- return wrapQuery((_queryFactory = queryFactory).query.apply(_queryFactory, _to_consumable_array$8(queryConstraints)));
6553
+ return wrapQuery((_queryFactory = queryFactory).query.apply(_queryFactory, _to_consumable_array$a(queryConstraints)));
6503
6554
  }
6504
6555
  };
6505
6556
  }
6506
6557
 
6507
- function _array_like_to_array$a(arr, len) {
6558
+ function _array_like_to_array$b(arr, len) {
6508
6559
  if (len == null || len > arr.length) len = arr.length;
6509
6560
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
6510
6561
  return arr2;
6511
6562
  }
6512
- function _array_without_holes$7(arr) {
6513
- if (Array.isArray(arr)) return _array_like_to_array$a(arr);
6563
+ function _array_without_holes$9(arr) {
6564
+ if (Array.isArray(arr)) return _array_like_to_array$b(arr);
6514
6565
  }
6515
6566
  function _define_property$p(obj, key, value) {
6516
6567
  if (key in obj) {
@@ -6525,10 +6576,10 @@ function _define_property$p(obj, key, value) {
6525
6576
  }
6526
6577
  return obj;
6527
6578
  }
6528
- function _iterable_to_array$7(iter) {
6579
+ function _iterable_to_array$9(iter) {
6529
6580
  if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
6530
6581
  }
6531
- function _non_iterable_spread$7() {
6582
+ function _non_iterable_spread$9() {
6532
6583
  throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
6533
6584
  }
6534
6585
  function _object_spread$j(target) {
@@ -6565,20 +6616,20 @@ function _object_spread_props$f(target, source) {
6565
6616
  }
6566
6617
  return target;
6567
6618
  }
6568
- function _to_consumable_array$7(arr) {
6569
- return _array_without_holes$7(arr) || _iterable_to_array$7(arr) || _unsupported_iterable_to_array$a(arr) || _non_iterable_spread$7();
6619
+ function _to_consumable_array$9(arr) {
6620
+ return _array_without_holes$9(arr) || _iterable_to_array$9(arr) || _unsupported_iterable_to_array$b(arr) || _non_iterable_spread$9();
6570
6621
  }
6571
6622
  function _type_of$9(obj) {
6572
6623
  "@swc/helpers - typeof";
6573
6624
  return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
6574
6625
  }
6575
- function _unsupported_iterable_to_array$a(o, minLen) {
6626
+ function _unsupported_iterable_to_array$b(o, minLen) {
6576
6627
  if (!o) return;
6577
- if (typeof o === "string") return _array_like_to_array$a(o, minLen);
6628
+ if (typeof o === "string") return _array_like_to_array$b(o, minLen);
6578
6629
  var n = Object.prototype.toString.call(o).slice(8, -1);
6579
6630
  if (n === "Object" && o.constructor) n = o.constructor.name;
6580
6631
  if (n === "Map" || n === "Set") return Array.from(n);
6581
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$a(o, minLen);
6632
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$b(o, minLen);
6582
6633
  }
6583
6634
  /**
6584
6635
  * Separator used in Firestore paths to separate collection and document IDs.
@@ -6608,6 +6659,7 @@ function firestoreModelIdentity(parentOrModelName, collectionNameOrModelName, in
6608
6659
  }
6609
6660
  /**
6610
6661
  * Creates a FirestoreModelIdentityTypeMap from the input identities.
6662
+ *
6611
6663
  * @param identities
6612
6664
  * @returns
6613
6665
  */ function firestoreModelIdentityTypeMap(identities) {
@@ -6651,8 +6703,7 @@ function firestoreModelIdentity(parentOrModelName, collectionNameOrModelName, in
6651
6703
  } else {
6652
6704
  key = input;
6653
6705
  }
6654
- var result = id ? id : util.lastValue(key.split(FIRESTORE_COLLECTION_NAME_SEPARATOR));
6655
- return result;
6706
+ return id !== null && id !== void 0 ? id : util.lastValue(key.split(FIRESTORE_COLLECTION_NAME_SEPARATOR));
6656
6707
  }
6657
6708
  /**
6658
6709
  * Returns the array of ids within a FirestoreModelKey.
@@ -6688,7 +6739,7 @@ function firestoreModelIdentity(parentOrModelName, collectionNameOrModelName, in
6688
6739
  * @param key
6689
6740
  * @returns
6690
6741
  */ function inferKeyFromTwoWayFlatFirestoreModelKey(key) {
6691
- return key.replace(/\_/g, FIRESTORE_COLLECTION_NAME_SEPARATOR);
6742
+ return key.replace(/_/g, FIRESTORE_COLLECTION_NAME_SEPARATOR);
6692
6743
  }
6693
6744
  /**
6694
6745
  * Firestore Model Id Regex
@@ -6698,7 +6749,8 @@ function firestoreModelIdentity(parentOrModelName, collectionNameOrModelName, in
6698
6749
  /**
6699
6750
  * Returns true if the input string is a FirestoreModelId.
6700
6751
  *
6701
- * @param input
6752
+ * @param input - The string to test
6753
+ * @returns True if the input is a valid FirestoreModelId
6702
6754
  */ function isFirestoreModelId(input) {
6703
6755
  return FIRESTORE_MODEL_ID_REGEX.test(input);
6704
6756
  }
@@ -6722,14 +6774,16 @@ function firestoreModelIdentity(parentOrModelName, collectionNameOrModelName, in
6722
6774
  /**
6723
6775
  * Returns true if the input string is a FirestoreModelKey.
6724
6776
  *
6725
- * @param input
6777
+ * @param input - The string to test
6778
+ * @returns True if the input is a valid FirestoreModelKey
6726
6779
  */ function isFirestoreModelKey(input) {
6727
6780
  return FIRESTORE_MODEL_KEY_REGEX.test(input);
6728
6781
  }
6729
6782
  /**
6730
- * Returns true if the input string is a FirestoreModelId.
6783
+ * Returns true if the input string is a FirestoreModelId or a FirestoreModelKey.
6731
6784
  *
6732
- * @param input
6785
+ * @param input - The string to test
6786
+ * @returns True if the input is a valid FirestoreModelId or FirestoreModelKey
6733
6787
  */ function isFirestoreModelIdOrKey(input) {
6734
6788
  return util.stringContains(input, '/') ? FIRESTORE_MODEL_KEY_REGEX.test(input) : FIRESTORE_MODEL_ID_REGEX.test(input);
6735
6789
  }
@@ -6751,6 +6805,9 @@ function firestoreModelIdentity(parentOrModelName, collectionNameOrModelName, in
6751
6805
  */ var firestoreModelKey = firestoreModelKeyPart;
6752
6806
  /**
6753
6807
  * Creates a FirestoreModelKeyFactory for the input root identity.
6808
+ *
6809
+ * @param identity - The root FirestoreModelIdentity to bind the factory to
6810
+ * @returns A factory function that creates FirestoreModelKey values for the given identity and a provided id
6754
6811
  */ function firestoreModelKeyFactory(identity) {
6755
6812
  return function(id) {
6756
6813
  return firestoreModelKey(identity, id);
@@ -6814,7 +6871,12 @@ function firestoreModelIdentity(parentOrModelName, collectionNameOrModelName, in
6814
6871
  return "".concat(parent).concat(FIRESTORE_COLLECTION_NAME_SEPARATOR).concat(childPath);
6815
6872
  });
6816
6873
  }
6817
- function firestoreModelKeyPairObject(input) {
6874
+ /**
6875
+ * Converts a FirestoreModelKey or reference into a record mapping each collection name to its document id.
6876
+ *
6877
+ * @param input - The FirestoreModelKey, DocumentReferenceRef, or FirestoreModelKeyRef to convert
6878
+ * @returns An object mapping collection names to document ids, or undefined if the key is unavailable
6879
+ */ function firestoreModelKeyPairObject(input) {
6818
6880
  var pairs = firestoreModelKeyPartPairs(input);
6819
6881
  var object;
6820
6882
  if (pairs) {
@@ -6826,22 +6888,44 @@ function firestoreModelKeyPairObject(input) {
6826
6888
  }
6827
6889
  return object;
6828
6890
  }
6829
- function firestoreModelKeyCollectionType(input) {
6891
+ /**
6892
+ * Returns the FirestoreCollectionType derived from the input FirestoreModelKey.
6893
+ *
6894
+ * @param input - The key or reference to extract the collection type from
6895
+ * @returns The FirestoreCollectionType string, or undefined if the key is unavailable
6896
+ */ function firestoreModelKeyCollectionType(input) {
6830
6897
  return firestoreModelKeyCollectionTypeArrayName(input, FIRESTORE_COLLECTION_NAME_SEPARATOR);
6831
6898
  }
6832
- function firestoreModelKeyCollectionTypeArrayName(input) {
6899
+ /**
6900
+ * Returns the collection type array name string derived from the input key, joined by the given separator.
6901
+ *
6902
+ * @param input - The key or reference to extract collection names from
6903
+ * @param separator - The separator to join collection names with; defaults to the Firestore collection name separator
6904
+ * @returns The joined collection type array name string, or undefined if the key is unavailable
6905
+ */ function firestoreModelKeyCollectionTypeArrayName(input) {
6833
6906
  var separator = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : FIRESTORE_COLLECTION_NAME_SEPARATOR;
6834
6907
  var _firestoreModelKeyCollectionTypeArray;
6835
6908
  return (_firestoreModelKeyCollectionTypeArray = firestoreModelKeyCollectionTypeArray(input)) === null || _firestoreModelKeyCollectionTypeArray === void 0 ? void 0 : _firestoreModelKeyCollectionTypeArray.join(separator);
6836
6909
  }
6837
- function firestoreIdentityTypeArrayName(input) {
6910
+ /**
6911
+ * Returns the collection type array name string derived from a FirestoreModelIdentity, joined by the given separator.
6912
+ *
6913
+ * @param input - The FirestoreModelIdentity to derive collection names from
6914
+ * @param separator - The separator to join collection names with; defaults to the Firestore collection name separator
6915
+ * @returns The joined collection type array name string
6916
+ */ function firestoreIdentityTypeArrayName(input) {
6838
6917
  var separator = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : FIRESTORE_COLLECTION_NAME_SEPARATOR;
6839
6918
  return firestoreIdentityTypeArray(input).join(separator);
6840
6919
  }
6841
- function firestoreIdentityTypeArray(input) {
6920
+ /**
6921
+ * Returns an ordered array of collection names derived from a FirestoreModelIdentity, from root to leaf.
6922
+ *
6923
+ * @param input - The FirestoreModelIdentity to traverse
6924
+ * @returns An array of FirestoreCollectionName values ordered from root to leaf
6925
+ */ function firestoreIdentityTypeArray(input) {
6842
6926
  var array = [];
6843
6927
  var current = input;
6844
- while(true){
6928
+ for(;;){
6845
6929
  array.push(current.collectionName);
6846
6930
  if (current.type === 'nested') {
6847
6931
  current = current.parent;
@@ -6851,11 +6935,16 @@ function firestoreIdentityTypeArray(input) {
6851
6935
  }
6852
6936
  return array.reverse();
6853
6937
  }
6854
- function firestoreModelKeyCollectionTypeArray(input) {
6938
+ /**
6939
+ * Returns an ordered array of collection names derived from the input FirestoreModelKey.
6940
+ *
6941
+ * @param input - The key or reference to extract collection names from
6942
+ * @returns An array of FirestoreCollectionName values, or undefined if the key is unavailable
6943
+ */ function firestoreModelKeyCollectionTypeArray(input) {
6855
6944
  var key = readFirestoreModelKey(input);
6856
6945
  var array;
6857
6946
  if (key) {
6858
- var pieces = key === null || key === void 0 ? void 0 : key.split(FIRESTORE_COLLECTION_NAME_SEPARATOR);
6947
+ var pieces = key.split(FIRESTORE_COLLECTION_NAME_SEPARATOR);
6859
6948
  if (util.isOddNumber(pieces.length)) {
6860
6949
  throw new Error('input key source was a collection ref or unavailable.');
6861
6950
  }
@@ -6870,8 +6959,8 @@ function firestoreModelKeyCollectionTypeArray(input) {
6870
6959
  /**
6871
6960
  * Returns the collection name of the input key.
6872
6961
  *
6873
- * @param input
6874
- * @returns
6962
+ * @param input - The key or reference to extract the collection name from
6963
+ * @returns The FirestoreCollectionName from the deepest key pair, or undefined if unavailable
6875
6964
  */ function firestoreModelKeyCollectionName(input) {
6876
6965
  var _firestoreModelKeyTypePair;
6877
6966
  return (_firestoreModelKeyTypePair = firestoreModelKeyTypePair(input)) === null || _firestoreModelKeyTypePair === void 0 ? void 0 : _firestoreModelKeyTypePair.collectionName;
@@ -6879,8 +6968,9 @@ function firestoreModelKeyCollectionTypeArray(input) {
6879
6968
  /**
6880
6969
  * Returns the parent model key from up the specified amount of levels.
6881
6970
  *
6882
- * @param input
6883
- * @param maxLevelsUp
6971
+ * @param input - The key or reference to extract the parent key from
6972
+ * @param maxLevelsUp - The number of levels to traverse up the key hierarchy; defaults to 1
6973
+ * @returns The parent FirestoreModelKey, or undefined if no parent exists
6884
6974
  */ function firestoreModelKeyParentKey(input) {
6885
6975
  var maxLevelsUp = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 1;
6886
6976
  var keyParts = firestoreModelKeyParentKeyPartPairs(input, maxLevelsUp);
@@ -6890,7 +6980,13 @@ function firestoreModelKeyCollectionTypeArray(input) {
6890
6980
  }
6891
6981
  return result;
6892
6982
  }
6893
- function firestoreModelKeyParentKeyPartPairs(input) {
6983
+ /**
6984
+ * Returns the collection/id pair array truncated by the specified number of levels from the end.
6985
+ *
6986
+ * @param input - The key or reference to extract pairs from
6987
+ * @param maxLevelsUp - The number of levels to remove from the end; defaults to 1
6988
+ * @returns An array of FirestoreModelCollectionAndIdPair values up to the parent level, or undefined if unavailable
6989
+ */ function firestoreModelKeyParentKeyPartPairs(input) {
6894
6990
  var maxLevelsUp = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 1;
6895
6991
  var allParts = firestoreModelKeyPartPairs(input);
6896
6992
  var parentParts = undefined;
@@ -6908,11 +7004,16 @@ function firestoreModelKeyParentKeyPartPairs(input) {
6908
7004
  */ function firestoreModelKeyTypePair(input) {
6909
7005
  return util.lastValue(firestoreModelKeyPartPairs(input));
6910
7006
  }
6911
- function firestoreModelKeyPartPairs(input) {
7007
+ /**
7008
+ * Parses a FirestoreModelKey into an ordered array of collection/id pair objects.
7009
+ *
7010
+ * @param input - The key or reference to parse
7011
+ * @returns An array of FirestoreModelCollectionAndIdPair values, or undefined if the key is unavailable
7012
+ */ function firestoreModelKeyPartPairs(input) {
6912
7013
  var key = readFirestoreModelKey(input);
6913
7014
  var pairs;
6914
7015
  if (key) {
6915
- var pieces = key === null || key === void 0 ? void 0 : key.split(FIRESTORE_COLLECTION_NAME_SEPARATOR);
7016
+ var pieces = key.split(FIRESTORE_COLLECTION_NAME_SEPARATOR);
6916
7017
  if (util.isOddNumber(pieces.length)) {
6917
7018
  throw new Error('input key source was a collection ref or unavailable.');
6918
7019
  }
@@ -6934,7 +7035,7 @@ function firestoreModelKeyPartPairs(input) {
6934
7035
  * @param input
6935
7036
  * @returns
6936
7037
  */ function firestoreModelKeyPartPairsKeyPath(input) {
6937
- return firestoreModelKeyPath.apply(void 0, _to_consumable_array$7(firestoreModelKeyPartPairsPaths(input)));
7038
+ return firestoreModelKeyPath.apply(void 0, _to_consumable_array$9(firestoreModelKeyPartPairsPaths(input)));
6938
7039
  }
6939
7040
  /**
6940
7041
  * Maps the input FirestoreModelCollectionAndIdPair[] values to FirestoreModelKeyPart[] values.
@@ -6989,7 +7090,7 @@ var FIRESTORE_DUMMY_MODEL_KEY = 'dummymodel/dummykey';
6989
7090
  *
6990
7091
  * @template T - The data type of documents in the collection
6991
7092
  * @template D - The FirestoreDocument type that wraps the data
6992
- * @param config - Configuration for the collection
7093
+ * @param inputConfig - Configuration for the collection
6993
7094
  * @returns A fully configured FirestoreCollection instance
6994
7095
  */ function makeFirestoreCollection(inputConfig) {
6995
7096
  var config = inputConfig;
@@ -7032,13 +7133,12 @@ var FIRESTORE_DUMMY_MODEL_KEY = 'dummymodel/dummykey';
7032
7133
  * @param config - Configuration for the single document collection
7033
7134
  * @returns A RootSingleItemFirestoreCollection instance configured for the specified document
7034
7135
  */ function makeRootSingleItemFirestoreCollection(config) {
7035
- var collection = util.build({
7136
+ return util.build({
7036
7137
  base: makeFirestoreCollection(config),
7037
7138
  build: function build(x) {
7038
7139
  extendFirestoreCollectionWithSingleDocumentAccessor(x, config.singleItemIdentifier);
7039
7140
  }
7040
7141
  });
7041
- return collection;
7042
7142
  }
7043
7143
 
7044
7144
  function _define_property$o(obj, key, value) {
@@ -7189,23 +7289,22 @@ function _object_spread_props$e(target, source) {
7189
7289
  * @param config - Configuration for the single document subcollection
7190
7290
  * @returns A subcollection instance with specialized accessors for the single document
7191
7291
  */ function makeSingleItemFirestoreCollection(config) {
7192
- var collection = util.build({
7292
+ return util.build({
7193
7293
  base: makeFirestoreCollectionWithParent(config),
7194
7294
  build: function build(x) {
7195
7295
  // Extend the collection with single document accessor capabilities
7196
7296
  extendFirestoreCollectionWithSingleDocumentAccessor(x, config.singleItemIdentifier);
7197
7297
  }
7198
7298
  });
7199
- return collection;
7200
7299
  }
7201
7300
 
7202
- function _array_like_to_array$9(arr, len) {
7301
+ function _array_like_to_array$a(arr, len) {
7203
7302
  if (len == null || len > arr.length) len = arr.length;
7204
7303
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
7205
7304
  return arr2;
7206
7305
  }
7207
- function _array_without_holes$6(arr) {
7208
- if (Array.isArray(arr)) return _array_like_to_array$9(arr);
7306
+ function _array_without_holes$8(arr) {
7307
+ if (Array.isArray(arr)) return _array_like_to_array$a(arr);
7209
7308
  }
7210
7309
  function _define_property$n(obj, key, value) {
7211
7310
  if (key in obj) {
@@ -7220,10 +7319,10 @@ function _define_property$n(obj, key, value) {
7220
7319
  }
7221
7320
  return obj;
7222
7321
  }
7223
- function _iterable_to_array$6(iter) {
7322
+ function _iterable_to_array$8(iter) {
7224
7323
  if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
7225
7324
  }
7226
- function _non_iterable_spread$6() {
7325
+ function _non_iterable_spread$8() {
7227
7326
  throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
7228
7327
  }
7229
7328
  function _object_spread$h(target) {
@@ -7260,16 +7359,16 @@ function _object_spread_props$d(target, source) {
7260
7359
  }
7261
7360
  return target;
7262
7361
  }
7263
- function _to_consumable_array$6(arr) {
7264
- return _array_without_holes$6(arr) || _iterable_to_array$6(arr) || _unsupported_iterable_to_array$9(arr) || _non_iterable_spread$6();
7362
+ function _to_consumable_array$8(arr) {
7363
+ return _array_without_holes$8(arr) || _iterable_to_array$8(arr) || _unsupported_iterable_to_array$a(arr) || _non_iterable_spread$8();
7265
7364
  }
7266
- function _unsupported_iterable_to_array$9(o, minLen) {
7365
+ function _unsupported_iterable_to_array$a(o, minLen) {
7267
7366
  if (!o) return;
7268
- if (typeof o === "string") return _array_like_to_array$9(o, minLen);
7367
+ if (typeof o === "string") return _array_like_to_array$a(o, minLen);
7269
7368
  var n = Object.prototype.toString.call(o).slice(8, -1);
7270
7369
  if (n === "Object" && o.constructor) n = o.constructor.name;
7271
7370
  if (n === "Map" || n === "Set") return Array.from(n);
7272
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$9(o, minLen);
7371
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$a(o, minLen);
7273
7372
  }
7274
7373
  /**
7275
7374
  * Creates a factory function for generating FirestoreContext instances.
@@ -7285,11 +7384,10 @@ function _unsupported_iterable_to_array$9(o, minLen) {
7285
7384
  return function(firestore) {
7286
7385
  var _drivers_firestoreAccessorDriver;
7287
7386
  var makeFirestoreCollectionConfig = function makeFirestoreCollectionConfig(config) {
7288
- var _config_collection;
7289
- var _config_collection1;
7290
- var queryLike = (_config_collection = config.collection) !== null && _config_collection !== void 0 ? _config_collection : config.queryLike;
7387
+ var collection = config.collection;
7388
+ var queryLike = collection !== null && collection !== void 0 ? collection : config.queryLike;
7291
7389
  return _object_spread_props$d(_object_spread$h({}, config), {
7292
- collection: config.converter ? (_config_collection1 = config.collection) === null || _config_collection1 === void 0 ? void 0 : _config_collection1.withConverter(config.converter) : config.collection,
7390
+ collection: config.converter ? collection === null || collection === void 0 ? void 0 : collection.withConverter(config.converter) : collection,
7293
7391
  queryLike: config.converter ? queryLike.withConverter(config.converter) : queryLike,
7294
7392
  firestoreContext: context,
7295
7393
  firestoreDriverIdentifier: drivers.firestoreDriverIdentifier,
@@ -7317,7 +7415,7 @@ function _unsupported_iterable_to_array$9(o, minLen) {
7317
7415
  return (_drivers_firestoreAccessorDriver = drivers.firestoreAccessorDriver).collection.apply(_drivers_firestoreAccessorDriver, [
7318
7416
  firestore,
7319
7417
  path
7320
- ].concat(_to_consumable_array$6(pathSegments)));
7418
+ ].concat(_to_consumable_array$8(pathSegments)));
7321
7419
  },
7322
7420
  subcollection: drivers.firestoreAccessorDriver.subcollection,
7323
7421
  runTransaction: drivers.firestoreAccessorDriver.transactionFactoryForFirestore(firestore),
@@ -7529,9 +7627,10 @@ function _ts_generator$c(thisArg, body) {
7529
7627
  * // verifier can now check batches of IDs for uniqueness
7530
7628
  * ```
7531
7629
  */ function firestoreIdBatchVerifierFactory(config) {
7630
+ var _config_makeQueryConstraints;
7532
7631
  var readKeys = config.readKeys;
7533
7632
  var fieldToQuery = config.fieldToQuery;
7534
- var makeQueryConstraints = config.makeQueryConstraints ? config.makeQueryConstraints : fieldToQuery === '_id' ? function(ids) {
7633
+ var makeQueryConstraints = (_config_makeQueryConstraints = config.makeQueryConstraints) !== null && _config_makeQueryConstraints !== void 0 ? _config_makeQueryConstraints : fieldToQuery === '_id' ? function(ids) {
7535
7634
  return whereDocumentId('in', ids);
7536
7635
  } : function(ids) {
7537
7636
  return where(fieldToQuery, 'in', ids);
@@ -7539,7 +7638,7 @@ function _ts_generator$c(thisArg, body) {
7539
7638
  return function(collection) {
7540
7639
  var verify = function verify(keys) {
7541
7640
  return _async_to_generator$c(function() {
7542
- var constraints, results, keysInResults, unusedKeys;
7641
+ var constraints, results, keysInResults;
7543
7642
  return _ts_generator$c(this, function(_state) {
7544
7643
  switch(_state.label){
7545
7644
  case 0:
@@ -7550,13 +7649,12 @@ function _ts_generator$c(thisArg, body) {
7550
7649
  ];
7551
7650
  case 1:
7552
7651
  results = _state.sent();
7553
- keysInResults = results.docs.map(function(x) {
7652
+ keysInResults = results.docs.flatMap(function(x) {
7554
7653
  return readKeys(x);
7555
- }).flat();
7556
- unusedKeys = util.unique(keys, keysInResults);
7654
+ });
7557
7655
  return [
7558
7656
  2,
7559
- unusedKeys
7657
+ util.unique(keys, keysInResults)
7560
7658
  ];
7561
7659
  }
7562
7660
  });
@@ -7578,6 +7676,7 @@ function _ts_generator$c(thisArg, body) {
7578
7676
  * Checks for document existence first, then calls `set()` if the document is absent.
7579
7677
  *
7580
7678
  * @param accessor - the accessor to perform the existence check and set operation on
7679
+ * @returns a function that creates the document if it does not exist, or throws if it does
7581
7680
  * @throws {Error} When the document already exists at the reference path
7582
7681
  *
7583
7682
  * @example
@@ -7617,13 +7716,13 @@ function _ts_generator$c(thisArg, body) {
7617
7716
  });
7618
7717
  }
7619
7718
 
7620
- function _array_like_to_array$8(arr, len) {
7719
+ function _array_like_to_array$9(arr, len) {
7621
7720
  if (len == null || len > arr.length) len = arr.length;
7622
7721
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
7623
7722
  return arr2;
7624
7723
  }
7625
- function _array_without_holes$5(arr) {
7626
- if (Array.isArray(arr)) return _array_like_to_array$8(arr);
7724
+ function _array_without_holes$7(arr) {
7725
+ if (Array.isArray(arr)) return _array_like_to_array$9(arr);
7627
7726
  }
7628
7727
  function _define_property$m(obj, key, value) {
7629
7728
  if (key in obj) {
@@ -7638,10 +7737,10 @@ function _define_property$m(obj, key, value) {
7638
7737
  }
7639
7738
  return obj;
7640
7739
  }
7641
- function _iterable_to_array$5(iter) {
7740
+ function _iterable_to_array$7(iter) {
7642
7741
  if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
7643
7742
  }
7644
- function _non_iterable_spread$5() {
7743
+ function _non_iterable_spread$7() {
7645
7744
  throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
7646
7745
  }
7647
7746
  function _object_spread$g(target) {
@@ -7659,16 +7758,16 @@ function _object_spread$g(target) {
7659
7758
  }
7660
7759
  return target;
7661
7760
  }
7662
- function _to_consumable_array$5(arr) {
7663
- return _array_without_holes$5(arr) || _iterable_to_array$5(arr) || _unsupported_iterable_to_array$8(arr) || _non_iterable_spread$5();
7761
+ function _to_consumable_array$7(arr) {
7762
+ return _array_without_holes$7(arr) || _iterable_to_array$7(arr) || _unsupported_iterable_to_array$9(arr) || _non_iterable_spread$7();
7664
7763
  }
7665
- function _unsupported_iterable_to_array$8(o, minLen) {
7764
+ function _unsupported_iterable_to_array$9(o, minLen) {
7666
7765
  if (!o) return;
7667
- if (typeof o === "string") return _array_like_to_array$8(o, minLen);
7766
+ if (typeof o === "string") return _array_like_to_array$9(o, minLen);
7668
7767
  var n = Object.prototype.toString.call(o).slice(8, -1);
7669
7768
  if (n === "Object" && o.constructor) n = o.constructor.name;
7670
7769
  if (n === "Map" || n === "Set") return Array.from(n);
7671
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$8(o, minLen);
7770
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$9(o, minLen);
7672
7771
  }
7673
7772
  /**
7674
7773
  * Converts a {@link FirestoreAccessorArrayUpdate} into Firestore `UpdateData` using the
@@ -7689,15 +7788,15 @@ function _unsupported_iterable_to_array$8(o, minLen) {
7689
7788
  * await updateDoc(docRef, updateData);
7690
7789
  * ```
7691
7790
  */ function firestoreClientArrayUpdateToUpdateData(input) {
7692
- var union = input === null || input === void 0 ? void 0 : input.union;
7693
- var remove = input === null || input === void 0 ? void 0 : input.remove;
7791
+ var union = input.union;
7792
+ var remove = input.remove;
7694
7793
  function createUpdatesWithArrayFunction(fieldUpdate, arrayUpdateFunction) {
7695
7794
  var result;
7696
7795
  if (fieldUpdate) {
7697
7796
  result = util.mapObjectMap(fieldUpdate, function(arrayUpdate) {
7698
7797
  var result;
7699
7798
  if (arrayUpdate) {
7700
- result = arrayUpdateFunction.apply(void 0, _to_consumable_array$5(arrayUpdate)); // use spread operator to insert each value as an argument, as "nested arrays" are not allowed in the Firestore
7799
+ result = arrayUpdateFunction.apply(void 0, _to_consumable_array$7(arrayUpdate)); // use spread operator to insert each value as an argument, as "nested arrays" are not allowed in the Firestore
7701
7800
  }
7702
7801
  return result;
7703
7802
  });
@@ -7836,6 +7935,8 @@ function _define_property$l(obj, key, value) {
7836
7935
  * Creates a {@link FirestoreDocumentDataAccessorFactory} that produces {@link DefaultFirestoreDocumentDataAccessor} instances
7837
7936
  * for direct (non-batched, non-transactional) Firestore operations.
7838
7937
  *
7938
+ * @returns a factory that creates default (non-transactional) document data accessors
7939
+ *
7839
7940
  * @example
7840
7941
  * ```ts
7841
7942
  * const factory = defaultFirestoreAccessorFactory<MyModel>();
@@ -7856,6 +7957,8 @@ function _define_property$l(obj, key, value) {
7856
7957
  * The context type is {@link FirestoreDocumentContextType.NONE}, meaning operations execute immediately
7857
7958
  * against Firestore without transaction or batch grouping.
7858
7959
  *
7960
+ * @returns a default {@link FirestoreDocumentContext} with no transaction or batch semantics
7961
+ *
7859
7962
  * @example
7860
7963
  * ```ts
7861
7964
  * const context = defaultFirestoreDocumentContext<MyModel>();
@@ -8009,6 +8112,7 @@ function _is_native_reflect_construct$7() {
8009
8112
  * into the same batch.
8010
8113
  *
8011
8114
  * @param writeBatch - the Firestore `WriteBatch` to queue operations into
8115
+ * @returns a factory that creates write-batch-backed document data accessors for any document reference
8012
8116
  *
8013
8117
  * @example
8014
8118
  * ```ts
@@ -8054,6 +8158,7 @@ function _is_native_reflect_construct$7() {
8054
8158
  * Factory function that creates a {@link WriteBatchFirestoreDocumentContext} for the given batch.
8055
8159
  *
8056
8160
  * @param batch - the Firestore `WriteBatch` to use for all document operations
8161
+ * @returns a new {@link WriteBatchFirestoreDocumentContext} bound to the given batch
8057
8162
  *
8058
8163
  * @example
8059
8164
  * ```ts
@@ -8198,6 +8303,7 @@ function _define_property$j(obj, key, value) {
8198
8303
  * instances bound to the given transaction. All operations from these accessors participate in the same transaction.
8199
8304
  *
8200
8305
  * @param transaction - the Firestore `Transaction` to bind operations to
8306
+ * @returns a factory that creates transaction-backed document data accessors for any document reference
8201
8307
  *
8202
8308
  * @example
8203
8309
  * ```ts
@@ -8244,6 +8350,7 @@ function _define_property$j(obj, key, value) {
8244
8350
  * Factory function that creates a {@link TransactionFirestoreDocumentContext} for the given transaction.
8245
8351
  *
8246
8352
  * @param transaction - the Firestore `Transaction` to use for all document operations
8353
+ * @returns a new {@link TransactionFirestoreDocumentContext} bound to the given transaction
8247
8354
  *
8248
8355
  * @example
8249
8356
  * ```ts
@@ -8391,6 +8498,8 @@ function _ts_generator$b(thisArg, body) {
8391
8498
  * - Transaction and write batch context factories for atomic operations
8392
8499
  * - A default (non-transactional) document context
8393
8500
  *
8501
+ * @returns a {@link FirestoreAccessorDriver} backed by the `firebase/firestore` client SDK
8502
+ *
8394
8503
  * @example
8395
8504
  * ```ts
8396
8505
  * const driver = firestoreClientAccessorDriver();
@@ -8407,18 +8516,10 @@ function _ts_generator$b(thisArg, body) {
8407
8516
  return function(fn) {
8408
8517
  return _async_to_generator$b(function() {
8409
8518
  return _ts_generator$b(this, function(_state) {
8410
- switch(_state.label){
8411
- case 0:
8412
- return [
8413
- 4,
8414
- firestore.runTransaction(firestore$1, fn)
8415
- ];
8416
- case 1:
8417
- return [
8418
- 2,
8419
- _state.sent()
8420
- ];
8421
- }
8519
+ return [
8520
+ 2,
8521
+ firestore.runTransaction(firestore$1, fn)
8522
+ ];
8422
8523
  });
8423
8524
  })();
8424
8525
  };
@@ -8434,13 +8535,13 @@ function _ts_generator$b(thisArg, body) {
8434
8535
  };
8435
8536
  }
8436
8537
 
8437
- function _array_like_to_array$7(arr, len) {
8538
+ function _array_like_to_array$8(arr, len) {
8438
8539
  if (len == null || len > arr.length) len = arr.length;
8439
8540
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
8440
8541
  return arr2;
8441
8542
  }
8442
- function _array_without_holes$4(arr) {
8443
- if (Array.isArray(arr)) return _array_like_to_array$7(arr);
8543
+ function _array_without_holes$6(arr) {
8544
+ if (Array.isArray(arr)) return _array_like_to_array$8(arr);
8444
8545
  }
8445
8546
  function _define_property$i(obj, key, value) {
8446
8547
  if (key in obj) {
@@ -8455,10 +8556,10 @@ function _define_property$i(obj, key, value) {
8455
8556
  }
8456
8557
  return obj;
8457
8558
  }
8458
- function _iterable_to_array$4(iter) {
8559
+ function _iterable_to_array$6(iter) {
8459
8560
  if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
8460
8561
  }
8461
- function _non_iterable_spread$4() {
8562
+ function _non_iterable_spread$6() {
8462
8563
  throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
8463
8564
  }
8464
8565
  function _object_spread$f(target) {
@@ -8495,26 +8596,29 @@ function _object_spread_props$c(target, source) {
8495
8596
  }
8496
8597
  return target;
8497
8598
  }
8498
- function _to_consumable_array$4(arr) {
8499
- return _array_without_holes$4(arr) || _iterable_to_array$4(arr) || _unsupported_iterable_to_array$7(arr) || _non_iterable_spread$4();
8599
+ function _to_consumable_array$6(arr) {
8600
+ return _array_without_holes$6(arr) || _iterable_to_array$6(arr) || _unsupported_iterable_to_array$8(arr) || _non_iterable_spread$6();
8500
8601
  }
8501
- function _unsupported_iterable_to_array$7(o, minLen) {
8602
+ function _unsupported_iterable_to_array$8(o, minLen) {
8502
8603
  if (!o) return;
8503
- if (typeof o === "string") return _array_like_to_array$7(o, minLen);
8604
+ if (typeof o === "string") return _array_like_to_array$8(o, minLen);
8504
8605
  var n = Object.prototype.toString.call(o).slice(8, -1);
8505
8606
  if (n === "Object" && o.constructor) n = o.constructor.name;
8506
8607
  if (n === "Map" || n === "Set") return Array.from(n);
8507
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$7(o, minLen);
8608
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$8(o, minLen);
8508
8609
  }
8509
8610
  /**
8510
8611
  * Appends one or more `QueryConstraint` values to the builder, returning a new builder instance.
8511
8612
  *
8512
8613
  * @param builder - current query builder state
8513
8614
  * @param constraint - constraint(s) to append
8615
+ * @returns a new {@link FirebaseFirestoreQueryBuilder} with the added constraint(s)
8514
8616
  */ function addConstraintToBuilder(builder, constraint) {
8515
8617
  return {
8516
8618
  query: builder.query,
8517
- constraints: builder.constraints.concat(constraint)
8619
+ constraints: _to_consumable_array$6(builder.constraints).concat(_to_consumable_array$6(Array.isArray(constraint) ? constraint : [
8620
+ constraint
8621
+ ]))
8518
8622
  };
8519
8623
  }
8520
8624
  var _obj;
@@ -8537,13 +8641,13 @@ var _obj;
8537
8641
  }), _define_property$i(_obj, FIRESTORE_OFFSET_QUERY_CONSTRAINT_TYPE, undefined), _define_property$i(_obj, FIRESTORE_START_AT_QUERY_CONSTRAINT_TYPE, function(builder, data) {
8538
8642
  return addConstraintToBuilder(builder, firestore.startAt(data.snapshot));
8539
8643
  }), _define_property$i(_obj, FIRESTORE_START_AT_VALUE_QUERY_CONSTRAINT_TYPE, function(builder, data) {
8540
- return addConstraintToBuilder(builder, firestore.startAt.apply(void 0, _to_consumable_array$4(data.fieldValues)));
8644
+ return addConstraintToBuilder(builder, firestore.startAt.apply(void 0, _to_consumable_array$6(data.fieldValues)));
8541
8645
  }), _define_property$i(_obj, FIRESTORE_START_AFTER_QUERY_CONSTRAINT_TYPE, function(builder, data) {
8542
8646
  return addConstraintToBuilder(builder, firestore.startAfter(data.snapshot));
8543
8647
  }), _define_property$i(_obj, FIRESTORE_END_AT_QUERY_CONSTRAINT_TYPE, function(builder, data) {
8544
8648
  return addConstraintToBuilder(builder, firestore.endAt(data.snapshot));
8545
8649
  }), _define_property$i(_obj, FIRESTORE_END_AT_VALUE_QUERY_CONSTRAINT_TYPE, function(builder, data) {
8546
- return addConstraintToBuilder(builder, firestore.endAt.apply(void 0, _to_consumable_array$4(data.fieldValues)));
8650
+ return addConstraintToBuilder(builder, firestore.endAt.apply(void 0, _to_consumable_array$6(data.fieldValues)));
8547
8651
  }), _define_property$i(_obj, FIRESTORE_END_BEFORE_QUERY_CONSTRAINT_TYPE, function(builder, data) {
8548
8652
  return addConstraintToBuilder(builder, firestore.endBefore(data.snapshot));
8549
8653
  }), _obj);
@@ -8552,6 +8656,8 @@ var _obj;
8552
8656
  *
8553
8657
  * Converts abstract query constraints into `firebase/firestore` `QueryConstraint` objects
8554
8658
  * and composes them into an executable `Query`.
8659
+ *
8660
+ * @returns a {@link FirestoreQueryConstraintFunctionsDriver} backed by the `firebase/firestore` client SDK
8555
8661
  */ function firebaseFirestoreQueryConstraintFunctionsDriver() {
8556
8662
  return makeFirestoreQueryConstraintFunctionsDriver({
8557
8663
  mapping: FIRESTORE_CLIENT_QUERY_CONSTRAINT_HANDLER_MAPPING,
@@ -8565,7 +8671,7 @@ var _obj;
8565
8671
  var initialQuery = param.query, constraints = param.constraints;
8566
8672
  return firestore.query.apply(void 0, [
8567
8673
  initialQuery
8568
- ].concat(_to_consumable_array$4(constraints)));
8674
+ ].concat(_to_consumable_array$6(constraints)));
8569
8675
  },
8570
8676
  documentIdFieldPath: function documentIdFieldPath() {
8571
8677
  return firestore.documentId();
@@ -8579,6 +8685,8 @@ var _obj;
8579
8685
  * Note: Transactions are not supported for queries on the client; passing a `transaction` to `getDocs`
8580
8686
  * will throw an error.
8581
8687
  *
8688
+ * @returns a {@link FirestoreQueryDriver} backed by the `firebase/firestore` client SDK
8689
+ *
8582
8690
  * @example
8583
8691
  * ```ts
8584
8692
  * const queryDriver = firebaseFirestoreQueryDriver();
@@ -8613,6 +8721,8 @@ var _obj;
8613
8721
  * Provides accessor drivers (default, batch, transaction) and query drivers for use
8614
8722
  * with {@link clientFirebaseFirestoreContextFactory}.
8615
8723
  *
8724
+ * @returns the client-side {@link FirebaseFirestoreClientDrivers} for the `firebase/firestore` SDK
8725
+ *
8616
8726
  * @example
8617
8727
  * ```ts
8618
8728
  * const drivers = firebaseFirestoreClientDrivers();
@@ -8792,6 +8902,7 @@ function _is_native_reflect_construct$6() {
8792
8902
  * structured error details from the error's `details` property if available.
8793
8903
  *
8794
8904
  * @param error - the Firebase error from an `HttpsCallable` failure
8905
+ * @returns a new {@link FirebaseServerError} wrapping the given Firebase error with structured server error details
8795
8906
  */ function fromFirebaseError(error) {
8796
8907
  var details = error.details;
8797
8908
  details = _object_spread$e({
@@ -9057,6 +9168,7 @@ function mapHttpsCallable(callable, wrap) {
9057
9168
  * Errors are converted to readable errors via {@link convertHttpsCallableErrorToReadableError}.
9058
9169
  *
9059
9170
  * @param callable - the `HttpsCallable` to wrap
9171
+ * @returns a {@link DirectDataHttpsCallable} that resolves to the response data directly
9060
9172
  *
9061
9173
  * @example
9062
9174
  * ```ts
@@ -9079,6 +9191,7 @@ function mapHttpsCallable(callable, wrap) {
9079
9191
  * to preserve server-side error context. Otherwise, converts it to a generic readable error via `toReadableError`.
9080
9192
  *
9081
9193
  * @param error - the caught error from an `HttpsCallable` invocation
9194
+ * @returns a {@link FirebaseServerError} if the error has structured details, or a generic readable error otherwise
9082
9195
  */ function convertHttpsCallableErrorToReadableError(error) {
9083
9196
  var result;
9084
9197
  if ((typeof error === "undefined" ? "undefined" : _type_of$6(error)) === 'object') {
@@ -9093,7 +9206,7 @@ function mapHttpsCallable(callable, wrap) {
9093
9206
  return result;
9094
9207
  }
9095
9208
 
9096
- /* eslint-disable @typescript-eslint/no-explicit-any */ // The use of any here does not degrade the type-safety. The correct type is inferred in most cases.
9209
+ // The use of any here does not degrade the type-safety. The correct type is inferred in most cases.
9097
9210
  /**
9098
9211
  * Creates a {@link FirebaseFunctionMapFactory} from a configuration map.
9099
9212
  *
@@ -9101,6 +9214,7 @@ function mapHttpsCallable(callable, wrap) {
9101
9214
  * for direct data access. Per-key options (e.g., timeout) are applied if provided.
9102
9215
  *
9103
9216
  * @param configMap - maps function keys to their optional configuration
9217
+ * @returns a {@link FirebaseFunctionMapFactory} that creates a typed callable function map for a given `Functions` instance
9104
9218
  *
9105
9219
  * @example
9106
9220
  * ```ts
@@ -9121,8 +9235,7 @@ function mapHttpsCallable(callable, wrap) {
9121
9235
  var fn = directDataHttpsCallable(functions.httpsCallable(functionsInstance, key, httpCallableOptions));
9122
9236
  return fn;
9123
9237
  };
9124
- var result = util.mapObjectMap(configMap, mapFn);
9125
- return result;
9238
+ return util.mapObjectMap(configMap, mapFn);
9126
9239
  };
9127
9240
  }
9128
9241
  /**
@@ -9132,6 +9245,7 @@ function mapHttpsCallable(callable, wrap) {
9132
9245
  * so `httpsCallable` instances are only created when actually needed.
9133
9246
  *
9134
9247
  * @param configMap - maps each function group key to its `[ClassType, Factory]` tuple
9248
+ * @returns a {@link LazyFirebaseFunctionsFactory} that creates a lazy-loaded function map for a given `Functions` instance
9135
9249
  *
9136
9250
  * @example
9137
9251
  * ```ts
@@ -9166,6 +9280,7 @@ function mapHttpsCallable(callable, wrap) {
9166
9280
  * The returned function builds {@link OnCallTypedModelParams} for any model type.
9167
9281
  *
9168
9282
  * @param call - the CRUD call type to embed in generated params
9283
+ * @returns an {@link OnCallTypeModelParamsFunction} pre-configured with the given call type
9169
9284
  * @throws {Error} When `modelType` is not provided or empty.
9170
9285
  *
9171
9286
  * @example
@@ -9198,10 +9313,13 @@ function mapHttpsCallable(callable, wrap) {
9198
9313
  *
9199
9314
  * @deprecated Move towards using onCallTypedModelParamsFunction directly with the call type instead of using this function. Will not be removed in the future.
9200
9315
  *
9201
- * @param modelType
9202
- * @param data
9203
- * @returns
9204
- */ function onCallTypedModelParams(modelTypeInput, data, specifier, call) {
9316
+ * @param modelTypeInput - the model type string or ref
9317
+ * @param data - the call payload
9318
+ * @param specifier - optional sub-function specifier
9319
+ * @param call - the CRUD call type
9320
+ * @returns the constructed {@link OnCallTypedModelParams}
9321
+ */ // eslint-disable-next-line @typescript-eslint/max-params -- deprecated function, not worth refactoring
9322
+ function onCallTypedModelParams(modelTypeInput, data, specifier, call) {
9205
9323
  return onCallTypedModelParamsFunction(call)(modelTypeInput, data, specifier);
9206
9324
  }
9207
9325
  /**
@@ -9223,6 +9341,7 @@ function mapHttpsCallable(callable, wrap) {
9223
9341
  * Creates an {@link OnCallCreateModelResult} from document references by extracting their paths as model keys.
9224
9342
  *
9225
9343
  * @param result - document reference(s) from a create operation
9344
+ * @returns an {@link OnCallCreateModelResult} with model keys extracted from document paths
9226
9345
  *
9227
9346
  * @example
9228
9347
  * ```ts
@@ -9238,13 +9357,14 @@ function mapHttpsCallable(callable, wrap) {
9238
9357
  * Creates an {@link OnCallCreateModelResult} from model key(s), normalizing to an array.
9239
9358
  *
9240
9359
  * @param modelKeys - the model key(s) of the created document(s)
9360
+ * @returns an {@link OnCallCreateModelResult} containing the keys as an array
9241
9361
  */ function onCallCreateModelResult(modelKeys) {
9242
9362
  return {
9243
9363
  modelKeys: util.asArray(modelKeys)
9244
9364
  };
9245
9365
  }
9246
9366
 
9247
- function _array_like_to_array$6(arr, len) {
9367
+ function _array_like_to_array$7(arr, len) {
9248
9368
  if (len == null || len > arr.length) len = arr.length;
9249
9369
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
9250
9370
  return arr2;
@@ -9280,15 +9400,15 @@ function _non_iterable_rest$2() {
9280
9400
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
9281
9401
  }
9282
9402
  function _sliced_to_array$2(arr, i) {
9283
- return _array_with_holes$2(arr) || _iterable_to_array_limit$2(arr, i) || _unsupported_iterable_to_array$6(arr, i) || _non_iterable_rest$2();
9403
+ return _array_with_holes$2(arr) || _iterable_to_array_limit$2(arr, i) || _unsupported_iterable_to_array$7(arr, i) || _non_iterable_rest$2();
9284
9404
  }
9285
- function _unsupported_iterable_to_array$6(o, minLen) {
9405
+ function _unsupported_iterable_to_array$7(o, minLen) {
9286
9406
  if (!o) return;
9287
- if (typeof o === "string") return _array_like_to_array$6(o, minLen);
9407
+ if (typeof o === "string") return _array_like_to_array$7(o, minLen);
9288
9408
  var n = Object.prototype.toString.call(o).slice(8, -1);
9289
9409
  if (n === "Object" && o.constructor) n = o.constructor.name;
9290
9410
  if (n === "Map" || n === "Set") return Array.from(n);
9291
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$6(o, minLen);
9411
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$7(o, minLen);
9292
9412
  }
9293
9413
  /**
9294
9414
  * Default specifier string (`'_'`) used when a CRUD operation has specifiers but one
@@ -9311,6 +9431,7 @@ function _unsupported_iterable_to_array$6(o, minLen) {
9311
9431
  *
9312
9432
  * @param configMap - configuration for custom (non-CRUD) functions
9313
9433
  * @param crudConfigMap - configuration for model CRUD functions with optional specifiers
9434
+ * @returns a {@link ModelFirebaseFunctionMapFactory} that creates a combined custom and CRUD function map for a given `Functions` instance
9314
9435
  *
9315
9436
  * @example
9316
9437
  * ```ts
@@ -9325,22 +9446,22 @@ function _unsupported_iterable_to_array$6(o, minLen) {
9325
9446
  */ function callModelFirebaseFunctionMapFactory(configMap, crudConfigMap) {
9326
9447
  var functionFactory = firebaseFunctionMapFactory(configMap);
9327
9448
  return function(functionsInstance) {
9328
- var makeCallFunction = function makeCallFunction(call, fn, modelType, specifier) {
9329
- return mapHttpsCallable(fn(), {
9449
+ var makeCallFunction = function makeCallFunction(callFn, modelType, specifier) {
9450
+ return mapHttpsCallable(callFn.fn(), {
9330
9451
  mapInput: function mapInput(data) {
9331
- return onCallTypedModelParamsFunction(call)(modelType, data, specifier);
9452
+ return onCallTypedModelParamsFunction(callFn.call)(modelType, data, specifier);
9332
9453
  }
9333
9454
  }, true);
9334
9455
  };
9335
- var makeCallSpecifiers = function makeCallSpecifiers(call, fn, modelType, specifierKeys) {
9456
+ var makeCallSpecifiers = function makeCallSpecifiers(callFn, modelType, specifierKeys) {
9336
9457
  var modelTypeSuffix = util.capitalizeFirstLetter(modelType);
9337
9458
  var specifiers = {};
9338
9459
  specifierKeys.forEach(function(inputSpecifier) {
9339
9460
  var specifier = inputSpecifier === MODEL_FUNCTION_FIREBASE_CRUD_FUNCTION_SPECIFIER_DEFAULT ? '' : inputSpecifier;
9340
- var specifierFn = makeCallFunction(call, fn, modelType, inputSpecifier);
9341
- var fullSpecifierName = "".concat(call).concat(modelTypeSuffix).concat(util.capitalizeFirstLetter(specifier));
9461
+ var specifierFn = makeCallFunction(callFn, modelType, inputSpecifier);
9462
+ var fullSpecifierName = "".concat(callFn.call).concat(modelTypeSuffix).concat(util.capitalizeFirstLetter(specifier));
9342
9463
  specifiers[fullSpecifierName] = specifierFn;
9343
- var shortSpecifierName = util.lowercaseFirstLetter(specifier) || call;
9464
+ var shortSpecifierName = util.lowercaseFirstLetter(specifier) || callFn.call;
9344
9465
  specifiers[shortSpecifierName] = specifierFn;
9345
9466
  });
9346
9467
  return specifiers;
@@ -9349,7 +9470,7 @@ function _unsupported_iterable_to_array$6(o, minLen) {
9349
9470
  var _callFn = util.cachedGetter(function() {
9350
9471
  return functions.httpsCallable(functionsInstance, CALL_MODEL_APP_FUNCTION_KEY);
9351
9472
  });
9352
- var result = util.build({
9473
+ return util.build({
9353
9474
  base: functionMap,
9354
9475
  build: function build(x) {
9355
9476
  Object.entries(crudConfigMap).forEach(function(param) {
@@ -9363,10 +9484,14 @@ function _unsupported_iterable_to_array$6(o, minLen) {
9363
9484
  };
9364
9485
  var addCallFunctions = function addCallFunctions(crud, fn, modelType) {
9365
9486
  var crudFns;
9487
+ var callFn = {
9488
+ call: crud,
9489
+ fn: fn
9490
+ };
9366
9491
  if (crudFunctions.has(crud)) {
9367
- crudFns = makeCallFunction(crud, fn, modelType);
9492
+ crudFns = makeCallFunction(callFn, modelType);
9368
9493
  } else if (specifierFunctions.has(crud)) {
9369
- crudFns = makeCallSpecifiers(crud, fn, modelType, specifierFunctions.get(crud));
9494
+ crudFns = makeCallSpecifiers(callFn, modelType, specifierFunctions.get(crud));
9370
9495
  }
9371
9496
  if (crudFns) {
9372
9497
  modelTypeCalls["".concat(crud).concat(modelTypeSuffix)] = crudFns;
@@ -9374,7 +9499,7 @@ function _unsupported_iterable_to_array$6(o, minLen) {
9374
9499
  };
9375
9500
  var modelTypeSuffix = util.capitalizeFirstLetter(modelType);
9376
9501
  var _separateValues = util.separateValues(config, function(x) {
9377
- return x.indexOf(':') === -1;
9502
+ return !x.includes(':');
9378
9503
  }), crudFunctionKeys = _separateValues.included, specifiedCallFunctionKeys = _separateValues.excluded;
9379
9504
  var crudFunctions = new Set(crudFunctionKeys);
9380
9505
  var specifiedCallFunctionTuples = specifiedCallFunctionKeys.map(function(x) {
@@ -9405,7 +9530,6 @@ function _unsupported_iterable_to_array$6(o, minLen) {
9405
9530
  });
9406
9531
  }
9407
9532
  });
9408
- return result;
9409
9533
  };
9410
9534
  }
9411
9535
 
@@ -9414,6 +9538,7 @@ function _unsupported_iterable_to_array$6(o, minLen) {
9414
9538
  *
9415
9539
  * @param specifier - the development function to invoke
9416
9540
  * @param data - the call payload
9541
+ * @returns an {@link OnCallDevelopmentParams} envelope ready to send to the dev endpoint
9417
9542
  *
9418
9543
  * @example
9419
9544
  * ```ts
@@ -9439,6 +9564,7 @@ function _unsupported_iterable_to_array$6(o, minLen) {
9439
9564
  * through a single endpoint. The function specifier and data are wrapped via {@link onCallDevelopmentParams}.
9440
9565
  *
9441
9566
  * @param configMap - maps each development function key to optional configuration
9567
+ * @returns a factory that creates a {@link DevelopmentFirebaseFunctionMap} for a given `Functions` instance
9442
9568
  *
9443
9569
  * @example
9444
9570
  * ```ts
@@ -9491,6 +9617,7 @@ function _class_call_check$c(instance, Constructor) {
9491
9617
  * Useful when you need an independent reference that won't be affected by mutations to the original.
9492
9618
  *
9493
9619
  * @param path - the storage path to copy
9620
+ * @returns a new {@link StoragePath} with the same `bucketId` and `pathString`
9494
9621
  *
9495
9622
  * @example
9496
9623
  * ```ts
@@ -9507,6 +9634,7 @@ function _class_call_check$c(instance, Constructor) {
9507
9634
  * with a consistent bucket assignment.
9508
9635
  *
9509
9636
  * @param config - bucket and replacement behavior
9637
+ * @returns a {@link StoragePathFactory} that normalizes path inputs with the configured bucket
9510
9638
  *
9511
9639
  * @example
9512
9640
  * ```ts
@@ -9529,7 +9657,7 @@ function _class_call_check$c(instance, Constructor) {
9529
9657
  } else {
9530
9658
  return {
9531
9659
  pathString: pathString,
9532
- bucketId: inputBucketId || bucketId
9660
+ bucketId: inputBucketId !== null && inputBucketId !== void 0 ? inputBucketId : bucketId
9533
9661
  };
9534
9662
  }
9535
9663
  };
@@ -9541,6 +9669,7 @@ function _class_call_check$c(instance, Constructor) {
9541
9669
  * (implying the default bucket).
9542
9670
  *
9543
9671
  * @param path - the storage path to convert
9672
+ * @returns a {@link GoogleCloudStorageFilePath} string (`gs://bucket/path` or a relative path)
9544
9673
  *
9545
9674
  * @example
9546
9675
  * ```ts
@@ -9563,6 +9692,7 @@ function _class_call_check$c(instance, Constructor) {
9563
9692
  * Returns the `gs://` bucket prefix URI for the given bucket identifier or ref.
9564
9693
  *
9565
9694
  * @param storage - bucket ID string or a {@link StorageBucketIdRef}
9695
+ * @returns the `gs://bucket` prefix URI as a {@link GoogleCloudStorageBucketPrefix}
9566
9696
  *
9567
9697
  * @example
9568
9698
  * ```ts
@@ -9606,13 +9736,36 @@ var FIREBASE_SERVER_AUTH_CLAIMS_RESET_LAST_COM_DATE_KEY = 'resetCommunicationAt'
9606
9736
  return (_x_auth = x.auth) === null || _x_auth === void 0 ? void 0 : _x_auth.uid;
9607
9737
  });
9608
9738
 
9609
- /** Error code when the user account is not found. */ var FIREBASE_AUTH_USER_NOT_FOUND_ERROR = 'auth/user-not-found';
9610
- /** Error code when the password is incorrect. */ var FIREBASE_AUTH_WRONG_PASSWORD = 'auth/wrong-password';
9611
- /** Error code for a network request error (client SDK). */ var FIREBASE_AUTH_NETWORK_REQUEST_ERROR = 'auth/network-request-error';
9612
- /** Error code for a failed network request (client SDK). */ var FIREBASE_AUTH_NETWORK_REQUEST_FAILED = 'auth/network-request-failed';
9613
- /** Error code when a phone number is already associated with another account. */ var FIREBASE_AUTH_PHONE_NUMBER_ALREADY_EXISTS_ERROR = 'auth/phone-number-already-exists';
9614
- /** Error code when an email is already associated with another account. */ var FIREBASE_AUTH_EMAIL_ALREADY_EXISTS_ERROR = 'auth/email-already-exists';
9615
- /** Error code when the provided phone number is not a valid E.164 string. */ var FIREBASE_AUTH_INVALID_PHONE_NUMBER_ERROR = 'auth/invalid-phone-number';
9739
+ /**
9740
+ * Error code when the user account is not found.
9741
+ */ var FIREBASE_AUTH_USER_NOT_FOUND_ERROR = 'auth/user-not-found';
9742
+ /**
9743
+ * Error code when the password is incorrect.
9744
+ */ var FIREBASE_AUTH_WRONG_PASSWORD = 'auth/wrong-password';
9745
+ /**
9746
+ * Error code for a network request error (client SDK).
9747
+ */ var FIREBASE_AUTH_NETWORK_REQUEST_ERROR = 'auth/network-request-error';
9748
+ /**
9749
+ * Error code for a failed network request (client SDK).
9750
+ */ var FIREBASE_AUTH_NETWORK_REQUEST_FAILED = 'auth/network-request-failed';
9751
+ /**
9752
+ * Error code when a phone number is already associated with another account.
9753
+ */ var FIREBASE_AUTH_PHONE_NUMBER_ALREADY_EXISTS_ERROR = 'auth/phone-number-already-exists';
9754
+ /**
9755
+ * Error code when an email is already associated with another account.
9756
+ */ var FIREBASE_AUTH_EMAIL_ALREADY_EXISTS_ERROR = 'auth/email-already-exists';
9757
+ /**
9758
+ * Error code when the provided phone number is not a valid E.164 string.
9759
+ */ var FIREBASE_AUTH_INVALID_PHONE_NUMBER_ERROR = 'auth/invalid-phone-number';
9760
+ /**
9761
+ * Error code when a provider is already linked to the current user account.
9762
+ */ var FIREBASE_AUTH_PROVIDER_ALREADY_LINKED_ERROR = 'auth/provider-already-linked';
9763
+ /**
9764
+ * Error code when the credential is already associated with a different user account.
9765
+ */ var FIREBASE_AUTH_CREDENTIAL_ALREADY_IN_USE_ERROR = 'auth/credential-already-in-use';
9766
+ /**
9767
+ * Error code when an email address is already in use by another account during linking.
9768
+ */ var FIREBASE_AUTH_EMAIL_ALREADY_IN_USE_ERROR = 'auth/email-already-in-use';
9616
9769
  /**
9617
9770
  * Converts a {@link FirebaseAuthError} into a user-friendly {@link ReadableError} with a human-readable message.
9618
9771
  *
@@ -9620,6 +9773,7 @@ var FIREBASE_SERVER_AUTH_CLAIMS_RESET_LAST_COM_DATE_KEY = 'resetCommunicationAt'
9620
9773
  * suitable for display in the UI.
9621
9774
  *
9622
9775
  * @param inputError - the Firebase Auth error to convert
9776
+ * @returns a {@link ReadableError} with a human-readable message suitable for display
9623
9777
  *
9624
9778
  * @example
9625
9779
  * ```ts
@@ -9653,6 +9807,24 @@ var FIREBASE_SERVER_AUTH_CLAIMS_RESET_LAST_COM_DATE_KEY = 'resetCommunicationAt'
9653
9807
  message: 'Could not reach the server. Are you connected to the internet?'
9654
9808
  };
9655
9809
  break;
9810
+ case FIREBASE_AUTH_PROVIDER_ALREADY_LINKED_ERROR:
9811
+ error = {
9812
+ code: code,
9813
+ message: 'This provider is already linked to your account.'
9814
+ };
9815
+ break;
9816
+ case FIREBASE_AUTH_CREDENTIAL_ALREADY_IN_USE_ERROR:
9817
+ error = {
9818
+ code: code,
9819
+ message: 'These credentials are already associated with a different account.'
9820
+ };
9821
+ break;
9822
+ case FIREBASE_AUTH_EMAIL_ALREADY_IN_USE_ERROR:
9823
+ error = {
9824
+ code: code,
9825
+ message: 'This email address is already in use by another account.'
9826
+ };
9827
+ break;
9656
9828
  default:
9657
9829
  error = {
9658
9830
  code: code,
@@ -9723,6 +9895,7 @@ function _define_property$f(obj, key, value) {
9723
9895
  * Automatically uses a transaction accessor when the context has an active transaction.
9724
9896
  *
9725
9897
  * @param getFirestoreCollection - function to retrieve the Firestore collection from context
9898
+ * @returns a {@link FirebaseModelLoader} that loads document wrappers for given keys
9726
9899
  *
9727
9900
  * @example
9728
9901
  * ```ts
@@ -9739,8 +9912,7 @@ function _define_property$f(obj, key, value) {
9739
9912
  } else {
9740
9913
  documentAccessor = firestoreCollection.documentAccessor();
9741
9914
  }
9742
- var document = documentAccessor.loadDocumentForKey(key);
9743
- return document;
9915
+ return documentAccessor.loadDocumentForKey(key);
9744
9916
  }
9745
9917
  };
9746
9918
  }
@@ -9748,17 +9920,17 @@ function _define_property$f(obj, key, value) {
9748
9920
  /**
9749
9921
  * ArkType schema for a FirestoreModelKey (full path like "collection/12345").
9750
9922
  */ var firestoreModelKeyType = arktype.type('string > 0').narrow(function(val, ctx) {
9751
- return val != null && isFirestoreModelKey(val) || ctx.mustBe('a valid FirestoreModelKey');
9923
+ return isFirestoreModelKey(val) || ctx.mustBe('a valid FirestoreModelKey');
9752
9924
  });
9753
9925
  /**
9754
9926
  * ArkType schema for a FirestoreModelId (document ID like "12345").
9755
9927
  */ var firestoreModelIdType = arktype.type('string > 0').narrow(function(val, ctx) {
9756
- return val != null && isFirestoreModelId(val) || ctx.mustBe('a valid FirestoreModelId');
9928
+ return isFirestoreModelId(val) || ctx.mustBe('a valid FirestoreModelId');
9757
9929
  });
9758
9930
  /**
9759
9931
  * ArkType schema for a FirestoreModelId or FirestoreModelKey.
9760
9932
  */ var firestoreModelIdOrKeyType = arktype.type('string > 0').narrow(function(val, ctx) {
9761
- return val != null && isFirestoreModelIdOrKey(val) || ctx.mustBe('a valid FirestoreModelId or FirestoreModelKey');
9933
+ return isFirestoreModelIdOrKey(val) || ctx.mustBe('a valid FirestoreModelId or FirestoreModelKey');
9762
9934
  });
9763
9935
 
9764
9936
  /**
@@ -10067,6 +10239,7 @@ function _ts_generator$9(thisArg, body) {
10067
10239
  * Creates a {@link FirebaseModelPermissionServiceInstance} from a delegate.
10068
10240
  *
10069
10241
  * @param delegate - provides model loading and role computation
10242
+ * @returns a {@link FirebaseModelPermissionServiceInstance} configured with the given delegate
10070
10243
  */ function firebaseModelPermissionService(delegate) {
10071
10244
  return new FirebaseModelPermissionServiceInstance(delegate);
10072
10245
  }
@@ -10229,8 +10402,7 @@ function _define_property$d(obj, key, value) {
10229
10402
  value: function throwDoesNotExistError() {
10230
10403
  var _ref;
10231
10404
  var _this_contextGrantedModelRoles_context_makeDoesNotExistError, _this_contextGrantedModelRoles_context;
10232
- var error = (_ref = (_this_contextGrantedModelRoles_context_makeDoesNotExistError = (_this_contextGrantedModelRoles_context = this.contextGrantedModelRoles.context).makeDoesNotExistError) === null || _this_contextGrantedModelRoles_context_makeDoesNotExistError === void 0 ? void 0 : _this_contextGrantedModelRoles_context_makeDoesNotExistError.call(_this_contextGrantedModelRoles_context, this.contextGrantedModelRoles)) !== null && _ref !== void 0 ? _ref : new Error(contextGrantedModelRolesReaderDoesNotExistErrorMessage(this.contextGrantedModelRoles));
10233
- throw error;
10405
+ throw (_ref = (_this_contextGrantedModelRoles_context_makeDoesNotExistError = (_this_contextGrantedModelRoles_context = this.contextGrantedModelRoles.context).makeDoesNotExistError) === null || _this_contextGrantedModelRoles_context_makeDoesNotExistError === void 0 ? void 0 : _this_contextGrantedModelRoles_context_makeDoesNotExistError.call(_this_contextGrantedModelRoles_context, this.contextGrantedModelRoles)) !== null && _ref !== void 0 ? _ref : new Error(contextGrantedModelRolesReaderDoesNotExistErrorMessage(this.contextGrantedModelRoles));
10234
10406
  }
10235
10407
  },
10236
10408
  {
@@ -10238,8 +10410,7 @@ function _define_property$d(obj, key, value) {
10238
10410
  value: function throwPermissionError(role) {
10239
10411
  var _ref;
10240
10412
  var _this_contextGrantedModelRoles_context_makePermissionError, _this_contextGrantedModelRoles_context;
10241
- var error = (_ref = (_this_contextGrantedModelRoles_context_makePermissionError = (_this_contextGrantedModelRoles_context = this.contextGrantedModelRoles.context).makePermissionError) === null || _this_contextGrantedModelRoles_context_makePermissionError === void 0 ? void 0 : _this_contextGrantedModelRoles_context_makePermissionError.call(_this_contextGrantedModelRoles_context, this.contextGrantedModelRoles, role)) !== null && _ref !== void 0 ? _ref : new Error(contextGrantedModelRolesReaderPermissionErrorMessage(this.contextGrantedModelRoles, role));
10242
- throw error;
10413
+ throw (_ref = (_this_contextGrantedModelRoles_context_makePermissionError = (_this_contextGrantedModelRoles_context = this.contextGrantedModelRoles.context).makePermissionError) === null || _this_contextGrantedModelRoles_context_makePermissionError === void 0 ? void 0 : _this_contextGrantedModelRoles_context_makePermissionError.call(_this_contextGrantedModelRoles_context, this.contextGrantedModelRoles, role)) !== null && _ref !== void 0 ? _ref : new Error(contextGrantedModelRolesReaderPermissionErrorMessage(this.contextGrantedModelRoles, role));
10243
10414
  }
10244
10415
  }
10245
10416
  ]);
@@ -10247,6 +10418,9 @@ function _define_property$d(obj, key, value) {
10247
10418
  }();
10248
10419
  /**
10249
10420
  * Creates a new ContextGrantedModelRolesReader for the input model.
10421
+ *
10422
+ * @param service - the in-model-context permission service to read roles from
10423
+ * @returns a promise resolving to a {@link ContextGrantedModelRolesReader} for the model
10250
10424
  */ function contextGrantedModelRolesReader(service) {
10251
10425
  return service.roleMap().then(function(x) {
10252
10426
  return new ContextGrantedModelRolesReaderInstance(x);
@@ -10255,13 +10429,13 @@ function _define_property$d(obj, key, value) {
10255
10429
  /**
10256
10430
  * Creates the default permission error message.
10257
10431
  *
10258
- * @param contextGrantedModelRoles
10259
- * @param role
10260
- * @returns
10432
+ * @param contextGrantedModelRoles - the granted model roles context to generate the message from
10433
+ * @param roles - the required role(s) that were not satisfied
10434
+ * @returns a human-readable permission error message string
10261
10435
  */ function contextGrantedModelRolesReaderPermissionErrorMessage(contextGrantedModelRoles, roles) {
10262
10436
  var _contextGrantedModelRoles_data, _contextGrantedModelRoles_data1;
10263
10437
  var message = 'Permissions Error ("'.concat((_contextGrantedModelRoles_data = contextGrantedModelRoles.data) === null || _contextGrantedModelRoles_data === void 0 ? void 0 : _contextGrantedModelRoles_data.document.modelType, '":"').concat((_contextGrantedModelRoles_data1 = contextGrantedModelRoles.data) === null || _contextGrantedModelRoles_data1 === void 0 ? void 0 : _contextGrantedModelRoles_data1.document.id, '")');
10264
- if (roles && (roles === null || roles === void 0 ? void 0 : roles.length)) {
10438
+ if (roles === null || roles === void 0 ? void 0 : roles.length) {
10265
10439
  message = "".concat(message, ': required role(s) "').concat(roles, '"');
10266
10440
  }
10267
10441
  return message;
@@ -10269,13 +10443,11 @@ function _define_property$d(obj, key, value) {
10269
10443
  /**
10270
10444
  * Creates the default does not exist error message.
10271
10445
  *
10272
- * @param contextGrantedModelRoles
10273
- * @param role
10274
- * @returns
10446
+ * @param contextGrantedModelRoles - the granted model roles context to generate the message from
10447
+ * @returns a human-readable does-not-exist error message string
10275
10448
  */ function contextGrantedModelRolesReaderDoesNotExistErrorMessage(contextGrantedModelRoles) {
10276
10449
  var _contextGrantedModelRoles_data, _contextGrantedModelRoles_data1;
10277
- var message = 'Does Not Exist ("'.concat((_contextGrantedModelRoles_data = contextGrantedModelRoles.data) === null || _contextGrantedModelRoles_data === void 0 ? void 0 : _contextGrantedModelRoles_data.document.modelType, '":"').concat((_contextGrantedModelRoles_data1 = contextGrantedModelRoles.data) === null || _contextGrantedModelRoles_data1 === void 0 ? void 0 : _contextGrantedModelRoles_data1.document.id, '")');
10278
- return message;
10450
+ return 'Does Not Exist ("'.concat((_contextGrantedModelRoles_data = contextGrantedModelRoles.data) === null || _contextGrantedModelRoles_data === void 0 ? void 0 : _contextGrantedModelRoles_data.document.modelType, '":"').concat((_contextGrantedModelRoles_data1 = contextGrantedModelRoles.data) === null || _contextGrantedModelRoles_data1 === void 0 ? void 0 : _contextGrantedModelRoles_data1.document.id, '")');
10279
10451
  }
10280
10452
 
10281
10453
  function asyncGeneratorStep$8(gen, resolve, reject, _next, _throw, key, arg) {
@@ -10411,6 +10583,9 @@ function _ts_generator$8(thisArg, body) {
10411
10583
  * Decision function that checks if the current user is an admin in the given context.
10412
10584
  *
10413
10585
  * Returns `false` if no auth is present.
10586
+ *
10587
+ * @param context - the Firebase model context to evaluate
10588
+ * @returns a promise resolving to `true` if the user is an admin, `false` otherwise
10414
10589
  */ var isAdminInFirebaseModelContext = function isAdminInFirebaseModelContext(context) {
10415
10590
  var _ref;
10416
10591
  var _context_auth;
@@ -10420,6 +10595,7 @@ function _ts_generator$8(thisArg, body) {
10420
10595
  * Creates a {@link GrantRolesIfFunction} that grants the specified roles when the user is an admin.
10421
10596
  *
10422
10597
  * @param rolesToGrantToAdmin - roles to grant if the user is an admin
10598
+ * @returns a {@link GrantRolesIfFunction} that grants the given roles when the user is an admin
10423
10599
  *
10424
10600
  * @example
10425
10601
  * ```ts
@@ -10438,6 +10614,7 @@ function _ts_generator$8(thisArg, body) {
10438
10614
  * @param context - the model context to check
10439
10615
  * @param rolesToGrantToAdmin - roles to grant if admin
10440
10616
  * @param otherwise - fallback role computation when not admin
10617
+ * @returns a promise or value resolving to the granted role map
10441
10618
  */ function grantModelRolesIfAdmin(context, rolesToGrantToAdmin, otherwise) {
10442
10619
  return grantModelRolesIfAdminFunction(rolesToGrantToAdmin)(context, otherwise);
10443
10620
  }
@@ -10447,6 +10624,7 @@ function _ts_generator$8(thisArg, body) {
10447
10624
  *
10448
10625
  * @param authRoles - the auth roles the user must have
10449
10626
  * @param rolesToGrantToAdmin - the model roles to grant if the auth roles are present
10627
+ * @returns a {@link GrantRolesIfFunction} that grants the given roles when the user has the required auth roles
10450
10628
  */ function grantModelRolesIfHasAuthRolesFunction(authRoles, rolesToGrantToAdmin) {
10451
10629
  return grantModelRolesIfFunction(function(context) {
10452
10630
  var _context_auth;
@@ -10462,6 +10640,7 @@ function _ts_generator$8(thisArg, body) {
10462
10640
  * Creates a reusable factory pre-configured with specific auth roles to check for.
10463
10641
  *
10464
10642
  * @param authRoles - the auth roles the user must have
10643
+ * @returns a {@link GrantModelRolesIfHasAuthRolesFactory} pre-configured to check the given auth roles
10465
10644
  */ function grantModelRolesIfHasAuthRolesFactory(authRoles) {
10466
10645
  var authRolesToHave = util.iterableToArray(authRoles);
10467
10646
  return function(context, rolesToGrantToMatch, otherwise) {
@@ -10520,6 +10699,7 @@ function _ts_generator$8(thisArg, body) {
10520
10699
  * Creates a {@link GrantRolesIfFunction} that grants roles when the authenticated user's UID matches the model's `uid` field.
10521
10700
  *
10522
10701
  * @param rolesToGrant - the roles to grant if the user owns the model
10702
+ * @returns a {@link GrantRolesIfFunction} that grants roles when the authenticated user is the model owner
10523
10703
  *
10524
10704
  * @example
10525
10705
  * ```ts
@@ -10537,6 +10717,7 @@ function _ts_generator$8(thisArg, body) {
10537
10717
  *
10538
10718
  * @param grantIf - decision function to evaluate
10539
10719
  * @param grantedRoles - roles to grant if the decision is `true`
10720
+ * @returns a {@link GrantRolesOnlyIfFunction} that grants roles or returns no-access with no fallback
10540
10721
  */ function grantModelRolesOnlyIfFunction(grantIf, grantedRoles) {
10541
10722
  var fn = grantModelRolesIfFunction(grantIf, grantedRoles);
10542
10723
  return function(context) {
@@ -10551,6 +10732,7 @@ function _ts_generator$8(thisArg, body) {
10551
10732
  *
10552
10733
  * @param grantIf - async decision function to evaluate
10553
10734
  * @param grantedRoles - roles to grant if the decision is `true`
10735
+ * @returns a {@link GrantRolesIfFunction} that evaluates the condition and grants roles or falls back
10554
10736
  * @throws {Error} When `grantIf` is not provided.
10555
10737
  *
10556
10738
  * @example
@@ -10562,9 +10744,6 @@ function _ts_generator$8(thisArg, body) {
10562
10744
  * const roles = await grantIfOwner(context, () => noAccessRoleMap());
10563
10745
  * ```
10564
10746
  */ function grantModelRolesIfFunction(grantIf, grantedRoles) {
10565
- if (!grantIf) {
10566
- throw new Error('missing grant if');
10567
- }
10568
10747
  return function(context) {
10569
10748
  var otherwise = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : model.noAccessRoleMap;
10570
10749
  return _async_to_generator$8(function() {
@@ -10663,6 +10842,7 @@ function _object_spread_props$a(target, source) {
10663
10842
  * Creates a {@link FirebaseModelService} that wires together model loading and permission evaluation.
10664
10843
  *
10665
10844
  * @param config - collection loader and role mapping functions
10845
+ * @returns a {@link FirebaseModelService} combining model loading and permission evaluation
10666
10846
  *
10667
10847
  * @example
10668
10848
  * ```ts
@@ -10695,6 +10875,7 @@ function _object_spread_props$a(target, source) {
10695
10875
  * Creates a {@link FirebaseModelServiceFactory} that lazily instantiates and caches the service.
10696
10876
  *
10697
10877
  * @param config - the service configuration
10878
+ * @returns a {@link FirebaseModelServiceFactory} that lazily creates and caches the service
10698
10879
  */ function firebaseModelServiceFactory(config) {
10699
10880
  return util.cachedGetter(function() {
10700
10881
  return firebaseModelService(config);
@@ -10707,6 +10888,7 @@ function _object_spread_props$a(target, source) {
10707
10888
  * with a model or key to perform permission-checked operations.
10708
10889
  *
10709
10890
  * @param factory - lazy getter for the underlying model service
10891
+ * @returns an {@link InContextFirebaseModelServiceFactory} that binds contexts to the service
10710
10892
  */ function inContextFirebaseModelServiceFactory(factory) {
10711
10893
  return function(context) {
10712
10894
  var firebaseModelService = factory();
@@ -10776,8 +10958,8 @@ function _object_spread_props$a(target, source) {
10776
10958
  * export const demoFirebaseModelServices = firebaseModelsService<typeof DEMO_FIREBASE_MODEL_SERVICE_FACTORIES, DemoFirebaseBaseContext, DemoFirebaseModelTypes>(DEMO_FIREBASE_MODEL_SERVICE_FACTORIES);
10777
10959
  * export type DemoFirebaseContext = DemoFirebaseBaseContext & { service: typeof demoFirebaseModelServices };
10778
10960
  *
10779
- * @param services
10780
- * @returns
10961
+ * @param services - the map of model service getter factories
10962
+ * @returns a {@link FirebaseModelsService} that dispatches to the appropriate model service by type
10781
10963
  */ function firebaseModelsService(services) {
10782
10964
  var firebaseModelsServiceFunction = function firebaseModelsServiceFunction1(type, context) {
10783
10965
  var firebaseModelService = services[type];
@@ -10798,6 +10980,7 @@ function _object_spread_props$a(target, source) {
10798
10980
  * The returned factory binds a context, so callers can then select individual model services by type.
10799
10981
  *
10800
10982
  * @param service - the multi-model service to wrap
10983
+ * @returns an {@link InContextFirebaseModelsServiceFactory} that binds a context to the service
10801
10984
  */ function inContextFirebaseModelsServiceFactory(service) {
10802
10985
  var newInContextFirebaseModelsServiceFactory = function newInContextFirebaseModelsServiceFactory(context) {
10803
10986
  var result = function result(type) {
@@ -10815,6 +10998,7 @@ function _object_spread_props$a(target, source) {
10815
10998
  * @param service - the multi-model service
10816
10999
  * @param type - the model type to select
10817
11000
  * @param select - selection params including context and key
11001
+ * @returns the {@link FirebaseModelsServiceSelectionResult} bound to the specified model
10818
11002
  */ function selectFromFirebaseModelsService(service, type, select) {
10819
11003
  var key = readFirestoreModelKey(select.key, true);
10820
11004
  return service(type, select.context).forKey(key);
@@ -10827,10 +11011,12 @@ function _object_spread_props$a(target, source) {
10827
11011
  * @param service - the multi-model service
10828
11012
  * @param type - the model type to select
10829
11013
  * @param select - selection params including context, key, and optional role requirements
11014
+ * @returns a {@link UsePromiseFunction} for the resolved roles reader
10830
11015
  */ function useFirebaseModelsService(service, type, select) {
11016
+ var _select_roles;
10831
11017
  var inContextModelService = selectFromFirebaseModelsService(service, type, select);
10832
11018
  var result;
10833
- if (select.roles && select.roles.length) {
11019
+ if ((_select_roles = select.roles) === null || _select_roles === void 0 ? void 0 : _select_roles.length) {
10834
11020
  result = inContextModelService.requireUse(select.roles, select.rolesSetIncludes);
10835
11021
  } else {
10836
11022
  result = inContextModelService.use;
@@ -10844,6 +11030,7 @@ function _object_spread_props$a(target, source) {
10844
11030
  * Useful for routing incoming requests to the correct model service by collection path.
10845
11031
  *
10846
11032
  * @param inContextFirebaseModelsService - context-bound multi-model service
11033
+ * @returns a map of collection type strings to their {@link FirestoreModelIdentity} objects
10847
11034
  */ function buildFirebaseCollectionTypeModelTypeMap(inContextFirebaseModelsService) {
10848
11035
  var allTypes = inContextFirebaseModelsService.allTypes();
10849
11036
  var modelIdentities = allTypes.map(function(type) {
@@ -10870,6 +11057,7 @@ function _object_spread_props$a(target, source) {
10870
11057
  * The generated paths follow the convention `/model/[basePath/]<modelKey>/[path]`.
10871
11058
  *
10872
11059
  * @param config - optional base path to nest under
11060
+ * @returns a {@link ModelStorageSlashPathFactory} that maps Firestore model keys to storage paths
10873
11061
  *
10874
11062
  * @example
10875
11063
  * ```ts
@@ -11070,6 +11258,7 @@ function _ts_generator$7(thisArg, body) {
11070
11258
  * Wraps the folder's `list()` API with cursor-based pagination via {@link fetchPageFactory}.
11071
11259
  *
11072
11260
  * @param config - default listing options (e.g., maxResults)
11261
+ * @returns an {@link IterateStorageListFilesFactory} for paginated file listing
11073
11262
  *
11074
11263
  * @example
11075
11264
  * ```ts
@@ -11080,25 +11269,16 @@ function _ts_generator$7(thisArg, body) {
11080
11269
  return fetch.fetchPageFactory({
11081
11270
  fetch: function fetch(input) {
11082
11271
  return _async_to_generator$7(function() {
11083
- var _input_maxResults, _input_pageToken, list;
11272
+ var _input_maxResults, _input_pageToken;
11084
11273
  return _ts_generator$7(this, function(_state) {
11085
- switch(_state.label){
11086
- case 0:
11087
- return [
11088
- 4,
11089
- input.folder.list({
11090
- includeNestedResults: input.includeNestedResults,
11091
- maxResults: (_input_maxResults = input.maxResults) !== null && _input_maxResults !== void 0 ? _input_maxResults : factoryDefaultMaxResults,
11092
- pageToken: (_input_pageToken = input.pageToken) !== null && _input_pageToken !== void 0 ? _input_pageToken : undefined
11093
- })
11094
- ];
11095
- case 1:
11096
- list = _state.sent();
11097
- return [
11098
- 2,
11099
- list
11100
- ];
11101
- }
11274
+ return [
11275
+ 2,
11276
+ input.folder.list({
11277
+ includeNestedResults: input.includeNestedResults,
11278
+ maxResults: (_input_maxResults = input.maxResults) !== null && _input_maxResults !== void 0 ? _input_maxResults : factoryDefaultMaxResults,
11279
+ pageToken: (_input_pageToken = input.pageToken) !== null && _input_pageToken !== void 0 ? _input_pageToken : undefined
11280
+ })
11281
+ ];
11102
11282
  });
11103
11283
  })();
11104
11284
  },
@@ -11112,7 +11292,7 @@ function _ts_generator$7(thisArg, body) {
11112
11292
  };
11113
11293
  return info;
11114
11294
  },
11115
- buildInputForNextPage: function buildInputForNextPage(pageResult, input, options) {
11295
+ buildInputForNextPage: function buildInputForNextPage(pageResult, input, _options) {
11116
11296
  var _pageResult_nextPageCursor;
11117
11297
  return _object_spread_props$9(_object_spread$b({}, input), {
11118
11298
  pageToken: (_pageResult_nextPageCursor = pageResult.nextPageCursor) !== null && _pageResult_nextPageCursor !== void 0 ? _pageResult_nextPageCursor : undefined
@@ -11124,6 +11304,9 @@ function _ts_generator$7(thisArg, body) {
11124
11304
  * Iterates through every file in a storage folder, invoking a callback for each individual file result.
11125
11305
  *
11126
11306
  * Convenience wrapper around {@link iterateFetchPagesByEachItem} pre-configured for storage listing.
11307
+ *
11308
+ * @param input - iteration configuration including folder, listing options, and per-item callback
11309
+ * @returns the result of the paginated per-item iteration
11127
11310
  */ function iterateStorageListFilesByEachFile(input) {
11128
11311
  var folder = input.folder, includeNestedResults = input.includeNestedResults, pageToken = input.pageToken;
11129
11312
  return fetch.iterateFetchPagesByEachItem(_object_spread_props$9(_object_spread$b({}, input), {
@@ -11139,6 +11322,9 @@ function _ts_generator$7(thisArg, body) {
11139
11322
  * Iterates through pages of file results in a storage folder, invoking a callback for each page.
11140
11323
  *
11141
11324
  * Convenience wrapper around {@link iterateFetchPages} pre-configured for storage listing.
11325
+ *
11326
+ * @param input - iteration configuration including folder, listing options, and per-page callback
11327
+ * @returns the result of the paginated page-level iteration
11142
11328
  */ function iterateStorageListFiles(input) {
11143
11329
  var folder = input.folder, includeNestedResults = input.includeNestedResults, pageToken = input.pageToken;
11144
11330
  return fetch.iterateFetchPages(_object_spread_props$9(_object_spread$b({}, input), {
@@ -11217,6 +11403,7 @@ function _is_native_reflect_construct$4() {
11217
11403
  * Required when the upload input is a string, since the format (raw, base64, etc.) must be explicit.
11218
11404
  *
11219
11405
  * @param options - the upload options to extract from
11406
+ * @returns the {@link StorageDataStringType} extracted from the options
11220
11407
  * @throws {Error} When `stringFormat` is not set in the options.
11221
11408
  */ function assertStorageUploadOptionsStringFormat(options) {
11222
11409
  var stringFormat = options === null || options === void 0 ? void 0 : options.stringFormat;
@@ -11227,6 +11414,8 @@ function _is_native_reflect_construct$4() {
11227
11414
  }
11228
11415
  /**
11229
11416
  * Creates an error indicating that `stringFormat` was missing from upload options.
11417
+ *
11418
+ * @returns an {@link Error} describing the missing `stringFormat` in upload options
11230
11419
  */ function noStringFormatInStorageUploadOptionsError() {
11231
11420
  return new Error('stringFormat was missing a value in the StorageUploadOptions.');
11232
11421
  }
@@ -11383,6 +11572,7 @@ function _ts_generator$6(thisArg, body) {
11383
11572
  * @param file - the target file accessor to upload to
11384
11573
  * @param readableStream - the source stream to pipe
11385
11574
  * @param options - optional upload configuration (content type, metadata, etc.)
11575
+ * @returns a promise that resolves when the upload stream has finished
11386
11576
  * @throws {StorageFileUploadStreamUnsupportedError} When the file accessor does not support stream uploads.
11387
11577
  *
11388
11578
  * @example
@@ -11420,15 +11610,16 @@ function _ts_generator$6(thisArg, body) {
11420
11610
  * provides cursor-based pagination through the `next()` method.
11421
11611
  *
11422
11612
  * @param delegate - platform-specific implementation for extracting results
11613
+ * @returns a {@link StorageListFilesResultFactory} that normalizes raw SDK list results
11423
11614
  *
11424
11615
  * @example
11425
11616
  * ```ts
11426
11617
  * const factory = storageListFilesResultFactory(myDelegate);
11427
- * const result = factory(storage, folder, { maxResults: 50 }, rawSdkResult);
11618
+ * const result = factory({ storage, folder, options: { maxResults: 50 } }, rawSdkResult);
11428
11619
  * const files = result.files();
11429
11620
  * ```
11430
11621
  */ function storageListFilesResultFactory(delegate) {
11431
- return function(storage, folder, options, result) {
11622
+ return function(input, result) {
11432
11623
  var fileResult = function fileResult(item) {
11433
11624
  item.file = function() {
11434
11625
  return delegate.file(storage, item);
@@ -11441,12 +11632,13 @@ function _ts_generator$6(thisArg, body) {
11441
11632
  };
11442
11633
  return item;
11443
11634
  };
11635
+ var storage = input.storage, folder = input.folder, options = input.options;
11444
11636
  var hasNext = delegate.hasNext(result);
11445
11637
  var next = util.cachedGetter(function() {
11446
11638
  if (!hasNext) {
11447
11639
  throw storageListFilesResultHasNoNextError();
11448
11640
  }
11449
- return delegate.next(storage, options, folder, result);
11641
+ return delegate.next(input, result);
11450
11642
  });
11451
11643
  var files = util.cachedGetter(function() {
11452
11644
  return delegate.filesFromResult(result, folder).map(fileResult);
@@ -11474,6 +11666,8 @@ function _ts_generator$6(thisArg, body) {
11474
11666
  }
11475
11667
  /**
11476
11668
  * Creates an error thrown when `next()` is called on a list result that has no more pages.
11669
+ *
11670
+ * @returns an {@link Error} indicating there are no more pages to fetch
11477
11671
  */ function storageListFilesResultHasNoNextError() {
11478
11672
  return new Error('hasNext is false, there are no more results available.');
11479
11673
  }
@@ -11485,6 +11679,7 @@ function _ts_generator$6(thisArg, body) {
11485
11679
  * a {@link StoragePathFactory} to normalize all path inputs.
11486
11680
  *
11487
11681
  * @param drivers - the storage driver implementations to use
11682
+ * @returns a {@link FirebaseStorageContextFactory} that creates storage contexts for a given storage instance
11488
11683
  * @throws {Error} When a default bucket ID cannot be resolved from the driver or config.
11489
11684
  *
11490
11685
  * @example
@@ -11495,9 +11690,10 @@ function _ts_generator$6(thisArg, body) {
11495
11690
  * ```
11496
11691
  */ function firebaseStorageContextFactory(drivers) {
11497
11692
  return function(firebaseStorage, config) {
11693
+ var _ref;
11498
11694
  var _drivers_storageAccessorDriver_getDefaultBucket, _drivers_storageAccessorDriver;
11499
- var _ref = config !== null && config !== void 0 ? config : {}, inputDefaultBucketId = _ref.defaultBucketId, _ref_forceBucket = _ref.forceBucket, forceBucket = _ref_forceBucket === void 0 ? false : _ref_forceBucket;
11500
- var defaultBucketId = inputDefaultBucketId || ((_drivers_storageAccessorDriver_getDefaultBucket = (_drivers_storageAccessorDriver = drivers.storageAccessorDriver).getDefaultBucket) === null || _drivers_storageAccessorDriver_getDefaultBucket === void 0 ? void 0 : _drivers_storageAccessorDriver_getDefaultBucket.call(_drivers_storageAccessorDriver, firebaseStorage)) || '';
11695
+ var _ref1 = config !== null && config !== void 0 ? config : {}, inputDefaultBucketId = _ref1.defaultBucketId, _ref_forceBucket = _ref1.forceBucket, forceBucket = _ref_forceBucket === void 0 ? false : _ref_forceBucket;
11696
+ var defaultBucketId = (_ref = inputDefaultBucketId !== null && inputDefaultBucketId !== void 0 ? inputDefaultBucketId : (_drivers_storageAccessorDriver_getDefaultBucket = (_drivers_storageAccessorDriver = drivers.storageAccessorDriver).getDefaultBucket) === null || _drivers_storageAccessorDriver_getDefaultBucket === void 0 ? void 0 : _drivers_storageAccessorDriver_getDefaultBucket.call(_drivers_storageAccessorDriver, firebaseStorage)) !== null && _ref !== void 0 ? _ref : '';
11501
11697
  if (!defaultBucketId) {
11502
11698
  throw new Error('Could not resolve a default bucket id for the firebaseStorageContextFactory(). Supply a defaultBucketId.');
11503
11699
  }
@@ -11522,13 +11718,13 @@ function _ts_generator$6(thisArg, body) {
11522
11718
  };
11523
11719
  }
11524
11720
 
11525
- function _array_like_to_array$5(arr, len) {
11721
+ function _array_like_to_array$6(arr, len) {
11526
11722
  if (len == null || len > arr.length) len = arr.length;
11527
11723
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
11528
11724
  return arr2;
11529
11725
  }
11530
- function _array_without_holes$3(arr) {
11531
- if (Array.isArray(arr)) return _array_like_to_array$5(arr);
11726
+ function _array_without_holes$5(arr) {
11727
+ if (Array.isArray(arr)) return _array_like_to_array$6(arr);
11532
11728
  }
11533
11729
  function asyncGeneratorStep$5(gen, resolve, reject, _next, _throw, key, arg) {
11534
11730
  try {
@@ -11572,10 +11768,10 @@ function _define_property$a(obj, key, value) {
11572
11768
  }
11573
11769
  return obj;
11574
11770
  }
11575
- function _iterable_to_array$3(iter) {
11771
+ function _iterable_to_array$5(iter) {
11576
11772
  if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
11577
11773
  }
11578
- function _non_iterable_spread$3() {
11774
+ function _non_iterable_spread$5() {
11579
11775
  throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
11580
11776
  }
11581
11777
  function _object_spread$a(target) {
@@ -11612,16 +11808,16 @@ function _object_spread_props$8(target, source) {
11612
11808
  }
11613
11809
  return target;
11614
11810
  }
11615
- function _to_consumable_array$3(arr) {
11616
- return _array_without_holes$3(arr) || _iterable_to_array$3(arr) || _unsupported_iterable_to_array$5(arr) || _non_iterable_spread$3();
11811
+ function _to_consumable_array$5(arr) {
11812
+ return _array_without_holes$5(arr) || _iterable_to_array$5(arr) || _unsupported_iterable_to_array$6(arr) || _non_iterable_spread$5();
11617
11813
  }
11618
- function _unsupported_iterable_to_array$5(o, minLen) {
11814
+ function _unsupported_iterable_to_array$6(o, minLen) {
11619
11815
  if (!o) return;
11620
- if (typeof o === "string") return _array_like_to_array$5(o, minLen);
11816
+ if (typeof o === "string") return _array_like_to_array$6(o, minLen);
11621
11817
  var n = Object.prototype.toString.call(o).slice(8, -1);
11622
11818
  if (n === "Object" && o.constructor) n = o.constructor.name;
11623
11819
  if (n === "Map" || n === "Set") return Array.from(n);
11624
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$5(o, minLen);
11820
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$6(o, minLen);
11625
11821
  }
11626
11822
  function _ts_generator$5(thisArg, body) {
11627
11823
  var f, y, t, _ = {
@@ -11729,6 +11925,7 @@ function _ts_generator$5(thisArg, body) {
11729
11925
  * e.g., to silently handle deletion of already-deleted files.
11730
11926
  *
11731
11927
  * @param input - the error or error message to check
11928
+ * @returns `true` if the error message contains `'storage/object-not-found'`, `false` otherwise
11732
11929
  *
11733
11930
  * @example
11734
11931
  * ```ts
@@ -11748,6 +11945,7 @@ function _ts_generator$5(thisArg, body) {
11748
11945
  *
11749
11946
  * @param storage - the client Firebase Storage instance
11750
11947
  * @param path - abstract storage path to resolve
11948
+ * @returns a `StorageReference` pointing to the resolved storage path
11751
11949
  */ function firebaseStorageRefForStorageFilePath(storage$1, path) {
11752
11950
  return storage.ref(storage$1, firebaseStorageFilePathFromStorageFilePath(path));
11753
11951
  }
@@ -11757,6 +11955,7 @@ function _ts_generator$5(thisArg, body) {
11757
11955
  * Returns `true` if metadata is successfully retrieved, `false` for any error (including permission errors).
11758
11956
  *
11759
11957
  * @param ref - the storage reference to check
11958
+ * @returns a promise that resolves to `true` if the file exists, `false` otherwise
11760
11959
  */ function firebaseStorageFileExists(ref) {
11761
11960
  return storage.getMetadata(ref).then(function(_) {
11762
11961
  return true;
@@ -11772,6 +11971,7 @@ function _ts_generator$5(thisArg, body) {
11772
11971
  *
11773
11972
  * @param storage - the client Firebase Storage instance
11774
11973
  * @param storagePath - the abstract storage path for the file
11974
+ * @returns a {@link FirebaseStorageClientAccessorFile} providing CRUD and upload operations for the given path
11775
11975
  *
11776
11976
  * @example
11777
11977
  * ```ts
@@ -11788,7 +11988,7 @@ function _ts_generator$5(thisArg, body) {
11788
11988
  contentEncoding: (_options_metadata2 = options.metadata) === null || _options_metadata2 === void 0 ? void 0 : _options_metadata2.contentEncoding,
11789
11989
  contentLanguage: (_options_metadata3 = options.metadata) === null || _options_metadata3 === void 0 ? void 0 : _options_metadata3.contentLanguage,
11790
11990
  contentType: (_options_metadata4 = options.metadata) === null || _options_metadata4 === void 0 ? void 0 : _options_metadata4.contentType,
11791
- customMetadata: util.filterUndefinedValues(_object_spread$a({}, (_options_metadata5 = options.metadata) === null || _options_metadata5 === void 0 ? void 0 : _options_metadata5.customMetadata, options === null || options === void 0 ? void 0 : options.customMetadata))
11991
+ customMetadata: util.filterUndefinedValues(_object_spread$a({}, (_options_metadata5 = options.metadata) === null || _options_metadata5 === void 0 ? void 0 : _options_metadata5.customMetadata, options.customMetadata))
11792
11992
  });
11793
11993
  }
11794
11994
  function uploadMetadataFromStorageUploadOptions(options) {
@@ -11917,7 +12117,8 @@ function _ts_generator$5(thisArg, body) {
11917
12117
  nextPageTokenFromResult: function nextPageTokenFromResult(result) {
11918
12118
  return result.listResult.nextPageToken;
11919
12119
  },
11920
- next: function next(storage, options, folder, result) {
12120
+ next: function next(param, result) {
12121
+ var options = param.options, folder = param.folder;
11921
12122
  return folder.list(_object_spread_props$8(_object_spread$a({}, options, result.options), {
11922
12123
  pageToken: result.listResult.nextPageToken
11923
12124
  }));
@@ -11959,6 +12160,7 @@ function _ts_generator$5(thisArg, body) {
11959
12160
  *
11960
12161
  * @param storage - the client Firebase Storage instance
11961
12162
  * @param storagePath - the abstract storage path for the folder
12163
+ * @returns a {@link FirebaseStorageClientAccessorFolder} providing listing and existence operations for the given path
11962
12164
  *
11963
12165
  * @example
11964
12166
  * ```ts
@@ -11987,7 +12189,11 @@ function _ts_generator$5(thisArg, body) {
11987
12189
  return [
11988
12190
  4,
11989
12191
  storage.list(ref, options).then(function(listResult) {
11990
- return firebaseStorageClientListFilesResultFactory(storage$1, folder, options, {
12192
+ return firebaseStorageClientListFilesResultFactory({
12193
+ storage: storage$1,
12194
+ folder: folder,
12195
+ options: options
12196
+ }, {
11991
12197
  options: options,
11992
12198
  listResult: listResult
11993
12199
  });
@@ -12014,7 +12220,7 @@ function _ts_generator$5(thisArg, body) {
12014
12220
  case 2:
12015
12221
  allNestedFolderFileResults = _state.sent();
12016
12222
  allNestedFiles = allNestedFolderFileResults.flat();
12017
- allFiles = _to_consumable_array$3(allImmediateFiles).concat(_to_consumable_array$3(allNestedFiles));
12223
+ allFiles = _to_consumable_array$5(allImmediateFiles).concat(_to_consumable_array$5(allNestedFiles));
12018
12224
  result = _object_spread_props$8(_object_spread$a({}, rootResults), {
12019
12225
  files: function files() {
12020
12226
  return allFiles;
@@ -12050,6 +12256,8 @@ function _ts_generator$5(thisArg, body) {
12050
12256
  * Provides file and folder accessor factories and default bucket resolution.
12051
12257
  * Used internally by {@link firebaseStorageClientDrivers}.
12052
12258
  *
12259
+ * @returns a {@link FirebaseStorageAccessorDriver} backed by the `firebase/storage` client SDK
12260
+ *
12053
12261
  * @example
12054
12262
  * ```ts
12055
12263
  * const driver = firebaseStorageClientAccessorDriver();
@@ -12077,6 +12285,8 @@ function _ts_generator$5(thisArg, body) {
12077
12285
  *
12078
12286
  * Provides file and folder accessor operations for use with {@link clientFirebaseStorageContextFactory}.
12079
12287
  *
12288
+ * @returns the client-side {@link FirebaseStorageClientDrivers} for the `firebase/storage` SDK
12289
+ *
12080
12290
  * @example
12081
12291
  * ```ts
12082
12292
  * const drivers = firebaseStorageClientDrivers();
@@ -12135,6 +12345,7 @@ function _ts_generator$5(thisArg, body) {
12135
12345
  * by combining the given user model identity with the provided UID.
12136
12346
  *
12137
12347
  * @param userModelIdentity - the root identity for user models (e.g., `profileIdentity`)
12348
+ * @returns a function that generates a {@link NotificationSummaryId} for a given user UID
12138
12349
  *
12139
12350
  * @example
12140
12351
  * ```ts
@@ -12158,9 +12369,9 @@ function _ts_generator$5(thisArg, body) {
12158
12369
  /**
12159
12370
  * Creates a NotificationTaskUniqueId from the input model id and task type.
12160
12371
  *
12161
- * @param input model id input
12162
- * @param taskType task type
12163
- * @returns NotificationTaskUniqueId
12372
+ * @param input - model id input
12373
+ * @param taskType - task type
12374
+ * @returns the unique notification task id combining the model id and task type
12164
12375
  */ function notificationTaskUniqueId(input, taskType) {
12165
12376
  return "".concat(firestoreModelId(input), "_").concat(taskType); // combineation of model id and template type
12166
12377
  }
@@ -12215,6 +12426,10 @@ function _object_spread_props$7(target, source) {
12215
12426
  /**
12216
12427
  * Merges two {@link NotificationBoxRecipientTemplateConfig} objects, preferring values from `a` over `b`.
12217
12428
  *
12429
+ * @param a - primary config whose defined values take precedence
12430
+ * @param b - fallback config supplying values when `a` fields are undefined
12431
+ * @returns the merged template config with values from `a` preferred over `b`
12432
+ *
12218
12433
  * @example
12219
12434
  * ```ts
12220
12435
  * const merged = mergeNotificationBoxRecipientTemplateConfigs(
@@ -12239,6 +12454,9 @@ function _object_spread_props$7(target, source) {
12239
12454
  *
12240
12455
  * This produces the "effective" configuration used at send time, where each channel has a definite boolean.
12241
12456
  *
12457
+ * @param a - the template config to resolve
12458
+ * @returns the effective config with each channel flag filled in using the send-default fallback
12459
+ *
12242
12460
  * @example
12243
12461
  * ```ts
12244
12462
  * const effective = effectiveNotificationBoxRecipientTemplateConfig({ sd: true, se: false });
@@ -12258,6 +12476,10 @@ function _object_spread_props$7(target, source) {
12258
12476
  * Updates a {@link NotificationRecipient} with partial values, preserving existing fields where the update is undefined.
12259
12477
  *
12260
12478
  * Automatically clears the summary ID (`s`) when a `uid` is present.
12479
+ *
12480
+ * @param a - existing recipient to update
12481
+ * @param b - partial values to apply on top of the existing recipient
12482
+ * @returns the updated recipient with merged values
12261
12483
  */ function updateNotificationRecipient(a, b) {
12262
12484
  var inputUid = b.uid, inputN = b.n, inputE = b.e, inputT = b.t, inputS = b.s;
12263
12485
  var uid = util.updateMaybeValue(a.uid, inputUid);
@@ -12309,6 +12531,7 @@ function _object_spread_props$7(target, source) {
12309
12531
  *
12310
12532
  * @param uid - the user's Firebase auth UID
12311
12533
  * @param i - the recipient's index position in the box's recipient array
12534
+ * @returns a new recipient entry with the given uid and index and an empty template config record
12312
12535
  */ function newNotificationBoxRecipientForUid(uid, i) {
12313
12536
  return {
12314
12537
  c: {},
@@ -12318,6 +12541,10 @@ function _object_spread_props$7(target, source) {
12318
12541
  }
12319
12542
  /**
12320
12543
  * Merges two {@link NotificationUserDefaultNotificationBoxRecipientConfig} objects, preferring defined values from `a` over `b`.
12544
+ *
12545
+ * @param a - primary config whose defined values take precedence
12546
+ * @param b - fallback config supplying values when `a` fields are undefined
12547
+ * @returns the merged config
12321
12548
  */ function mergeNotificationUserDefaultNotificationBoxRecipientConfig(a, b) {
12322
12549
  var c = mergeNotificationBoxRecipientTemplateConfigRecords(a.c, b.c);
12323
12550
  var result = _object_spread_props$7(_object_spread$9({}, util.mergeObjects([
@@ -12348,6 +12575,10 @@ function _object_spread_props$7(target, source) {
12348
12575
  })(exports.NotificationBoxRecipientTemplateConfigBoolean || (exports.NotificationBoxRecipientTemplateConfigBoolean = {}));
12349
12576
  /**
12350
12577
  * Merges two {@link NotificationBoxRecipientTemplateConfigRecord} objects, preferring defined values from `a`.
12578
+ *
12579
+ * @param a - primary record whose defined values take precedence
12580
+ * @param b - fallback record supplying values when `a` entries are undefined
12581
+ * @returns the merged template config record
12351
12582
  */ function mergeNotificationBoxRecipientTemplateConfigRecords(a, b) {
12352
12583
  var mergeConfigs = util.mergeObjectsFunction(util.KeyValueTypleValueFilter.UNDEFINED);
12353
12584
  return mergeConfigs([
@@ -12409,6 +12640,8 @@ var notificationBoxRecipientTemplateConfigDencoder = util.bitwiseObjectDencoder(
12409
12640
  /**
12410
12641
  * Creates a Firestore field converter for {@link NotificationBoxRecipientTemplateConfigRecord},
12411
12642
  * using bitwise encoding for compact storage.
12643
+ *
12644
+ * @returns a Firestore field converter that encodes and decodes template config records using bitwise encoding
12412
12645
  */ function firestoreNotificationBoxRecipientTemplateConfigRecord() {
12413
12646
  return firestoreBitwiseObjectMap({
12414
12647
  dencoder: notificationBoxRecipientTemplateConfigDencoder
@@ -12498,6 +12731,9 @@ var notificationBoxRecipientTemplateConfigDencoder = util.bitwiseObjectDencoder(
12498
12731
  /**
12499
12732
  * Converts a {@link NotificationBoxRecipientTemplateConfigRecord} to an array of entries with their type keys.
12500
12733
  *
12734
+ * @param input - the template config record to convert
12735
+ * @returns an array of entries each containing a type key and the corresponding channel config
12736
+ *
12501
12737
  * @example
12502
12738
  * ```ts
12503
12739
  * const array = notificationBoxRecipientTemplateConfigRecordToArray({ 'comment': { se: true } });
@@ -12516,6 +12752,9 @@ var notificationBoxRecipientTemplateConfigDencoder = util.bitwiseObjectDencoder(
12516
12752
  }
12517
12753
  /**
12518
12754
  * Converts a {@link NotificationBoxRecipientTemplateConfigArray} back to a {@link NotificationBoxRecipientTemplateConfigRecord}.
12755
+ *
12756
+ * @param input - the array of typed config entries to convert
12757
+ * @returns a record keyed by template type
12519
12758
  */ function notificationBoxRecipientTemplateConfigArrayToRecord(input) {
12520
12759
  var map = {};
12521
12760
  input.forEach(function(x) {
@@ -12558,6 +12797,7 @@ var notificationBoxRecipientTemplateConfigDencoder = util.bitwiseObjectDencoder(
12558
12797
  *
12559
12798
  * @param items - notification items to classify
12560
12799
  * @param considerReadIfCreatedBefore - optional cutoff date; items created at or before this date are treated as read
12800
+ * @returns an object containing both the read and unread item arrays along with the input cutoff date
12561
12801
  *
12562
12802
  * @example
12563
12803
  * ```ts
@@ -12701,11 +12941,17 @@ var NotificationUserDocument = /*#__PURE__*/ function(AbstractFirestoreDocument)
12701
12941
  });
12702
12942
  /**
12703
12943
  * Creates a Firestore collection reference for {@link NotificationUser} documents.
12944
+ *
12945
+ * @param context - Firestore context to create the collection reference from
12946
+ * @returns a typed collection reference for NotificationUser documents
12704
12947
  */ function notificationUserCollectionReference(context) {
12705
12948
  return context.collection(notificationUserIdentity.collectionName);
12706
12949
  }
12707
12950
  /**
12708
12951
  * Creates a typed {@link NotificationUserFirestoreCollection} bound to the given Firestore context.
12952
+ *
12953
+ * @param firestoreContext - Firestore context to bind the collection to
12954
+ * @returns a typed Firestore collection for NotificationUser documents
12709
12955
  */ function notificationUserFirestoreCollection(firestoreContext) {
12710
12956
  return firestoreContext.firestoreCollection({
12711
12957
  modelIdentity: notificationUserIdentity,
@@ -12768,11 +13014,17 @@ var NotificationSummaryDocument = /*#__PURE__*/ function(AbstractFirestoreDocume
12768
13014
  });
12769
13015
  /**
12770
13016
  * Creates a Firestore collection reference for {@link NotificationSummary} documents.
13017
+ *
13018
+ * @param context - Firestore context to create the collection reference from
13019
+ * @returns a typed collection reference for NotificationSummary documents
12771
13020
  */ function notificationSummaryCollectionReference(context) {
12772
13021
  return context.collection(notificationSummaryIdentity.collectionName);
12773
13022
  }
12774
13023
  /**
12775
13024
  * Creates a typed {@link NotificationSummaryFirestoreCollection} bound to the given Firestore context.
13025
+ *
13026
+ * @param firestoreContext - Firestore context to bind the collection to
13027
+ * @returns a typed Firestore collection for NotificationSummary documents
12776
13028
  */ function notificationSummaryFirestoreCollection(firestoreContext) {
12777
13029
  return firestoreContext.firestoreCollection({
12778
13030
  modelIdentity: notificationSummaryIdentity,
@@ -12835,11 +13087,17 @@ var NotificationBoxDocument = /*#__PURE__*/ function(AbstractFirestoreDocument)
12835
13087
  });
12836
13088
  /**
12837
13089
  * Creates a Firestore collection reference for {@link NotificationBox} documents.
13090
+ *
13091
+ * @param context - Firestore context to create the collection reference from
13092
+ * @returns a typed collection reference for NotificationBox documents
12838
13093
  */ function notificationBoxCollectionReference(context) {
12839
13094
  return context.collection(notificationBoxIdentity.collectionName);
12840
13095
  }
12841
13096
  /**
12842
13097
  * Creates a typed {@link NotificationBoxFirestoreCollection} bound to the given Firestore context.
13098
+ *
13099
+ * @param firestoreContext - Firestore context to bind the collection to
13100
+ * @returns a typed Firestore collection for NotificationBox documents
12843
13101
  */ function notificationBoxFirestoreCollection(firestoreContext) {
12844
13102
  return firestoreContext.firestoreCollection({
12845
13103
  modelIdentity: notificationBoxIdentity,
@@ -13007,6 +13265,9 @@ var NotificationDocument = /*#__PURE__*/ function(AbstractFirestoreDocumentWithP
13007
13265
  });
13008
13266
  /**
13009
13267
  * Creates a factory that produces {@link Notification} subcollection references for a given {@link NotificationBoxDocument} parent.
13268
+ *
13269
+ * @param context - Firestore context to create subcollection references from
13270
+ * @returns a factory function that creates collection references for a given NotificationBox parent
13010
13271
  */ function notificationCollectionReferenceFactory(context) {
13011
13272
  return function(notificationBox) {
13012
13273
  return context.subcollection(notificationBox.documentRef, notificationIdentity.collectionName);
@@ -13014,6 +13275,9 @@ var NotificationDocument = /*#__PURE__*/ function(AbstractFirestoreDocumentWithP
13014
13275
  }
13015
13276
  /**
13016
13277
  * Creates a {@link NotificationFirestoreCollectionFactory} bound to the given Firestore context.
13278
+ *
13279
+ * @param firestoreContext - Firestore context to bind the collection factory to
13280
+ * @returns a factory that creates typed Firestore subcollections for Notification documents
13017
13281
  */ function notificationFirestoreCollectionFactory(firestoreContext) {
13018
13282
  var factory = notificationCollectionReferenceFactory(firestoreContext);
13019
13283
  return function(parent) {
@@ -13031,11 +13295,17 @@ var NotificationDocument = /*#__PURE__*/ function(AbstractFirestoreDocumentWithP
13031
13295
  }
13032
13296
  /**
13033
13297
  * Creates a collection group reference for querying all {@link Notification} documents across all {@link NotificationBox} parents.
13298
+ *
13299
+ * @param context - Firestore context to create the collection group reference from
13300
+ * @returns a typed collection group for querying Notification documents across all parents
13034
13301
  */ function notificationCollectionReference(context) {
13035
13302
  return context.collectionGroup(notificationIdentity.collectionName);
13036
13303
  }
13037
13304
  /**
13038
13305
  * Creates a typed {@link NotificationFirestoreCollectionGroup} bound to the given Firestore context.
13306
+ *
13307
+ * @param firestoreContext - Firestore context to bind the collection group to
13308
+ * @returns a typed Firestore collection group for querying Notification documents across all parents
13039
13309
  */ function notificationFirestoreCollectionGroup(firestoreContext) {
13040
13310
  return firestoreContext.firestoreCollectionGroup({
13041
13311
  modelIdentity: notificationIdentity,
@@ -13084,6 +13354,9 @@ var NotificationWeekDocument = /*#__PURE__*/ function(AbstractFirestoreDocumentW
13084
13354
  });
13085
13355
  /**
13086
13356
  * Creates a factory that produces {@link NotificationWeek} subcollection references for a given {@link NotificationBoxDocument} parent.
13357
+ *
13358
+ * @param context - Firestore context to create subcollection references from
13359
+ * @returns a factory function that creates collection references for a given NotificationBox parent
13087
13360
  */ function notificationWeekCollectionReferenceFactory(context) {
13088
13361
  return function(notificationBox) {
13089
13362
  return context.subcollection(notificationBox.documentRef, notificationWeekIdentity.collectionName);
@@ -13091,6 +13364,9 @@ var NotificationWeekDocument = /*#__PURE__*/ function(AbstractFirestoreDocumentW
13091
13364
  }
13092
13365
  /**
13093
13366
  * Creates a {@link NotificationWeekFirestoreCollectionFactory} bound to the given Firestore context.
13367
+ *
13368
+ * @param firestoreContext - Firestore context to bind the collection factory to
13369
+ * @returns a factory that creates typed Firestore subcollections for NotificationWeek documents
13094
13370
  */ function notificationWeekFirestoreCollectionFactory(firestoreContext) {
13095
13371
  var factory = notificationWeekCollectionReferenceFactory(firestoreContext);
13096
13372
  return function(parent) {
@@ -13108,11 +13384,17 @@ var NotificationWeekDocument = /*#__PURE__*/ function(AbstractFirestoreDocumentW
13108
13384
  }
13109
13385
  /**
13110
13386
  * Creates a collection group reference for querying all {@link NotificationWeek} documents across all {@link NotificationBox} parents.
13387
+ *
13388
+ * @param context - Firestore context to create the collection group reference from
13389
+ * @returns a typed collection group for querying NotificationWeek documents across all parents
13111
13390
  */ function notificationWeekCollectionReference(context) {
13112
13391
  return context.collectionGroup(notificationWeekIdentity.collectionName);
13113
13392
  }
13114
13393
  /**
13115
13394
  * Creates a typed {@link NotificationWeekFirestoreCollectionGroup} bound to the given Firestore context.
13395
+ *
13396
+ * @param firestoreContext - Firestore context to bind the collection group to
13397
+ * @returns a typed Firestore collection group for querying NotificationWeek documents across all parents
13116
13398
  */ function notificationWeekFirestoreCollectionGroup(firestoreContext) {
13117
13399
  return firestoreContext.firestoreCollectionGroup({
13118
13400
  modelIdentity: notificationWeekIdentity,
@@ -13257,16 +13539,42 @@ var notificationBoxModelCrudFunctionsConfig = {
13257
13539
  *
13258
13540
  * Error code constants thrown by the notification server action service.
13259
13541
  * These codes are returned in Firebase function error responses for client-side handling.
13260
- */ /** Thrown when a notification creation request is missing a required ID. */ var CREATE_NOTIFICATION_ID_REQUIRED_ERROR_CODE = 'CREATE_NOTIFICATION_ID_REQUIRED';
13261
- /** Thrown when attempting to initialize a NotificationBox or NotificationSummary that is already initialized. */ var NOTIFICATION_MODEL_ALREADY_INITIALIZED_ERROR_CODE = 'NOTIFICATION_MODEL_ALREADY_INITIALIZED';
13262
- /** Thrown when the target NotificationBox does not exist. */ var NOTIFICATION_BOX_DOES_NOT_EXIST_ERROR_CODE = 'NOTIFICATION_BOX_DOES_NOT_EXIST';
13263
- /** Thrown when attempting to create a NotificationBox for a model that already has one. */ var NOTIFICATION_BOX_EXISTS_FOR_MODEL_ERROR_CODE = 'NOTIFICATION_BOX_EXISTS_FOR_MODEL';
13264
- /** Thrown when the target recipient does not exist in the NotificationBox. */ var NOTIFICATION_BOX_RECIPIENT_DOES_NOT_EXIST_ERROR_CODE = 'NOTIFICATION_BOX_RECIPIENT_DOES_NOT_EXIST';
13265
- /** Thrown when an exclusion target is invalid (e.g., user not associated with the box). */ var NOTIFICATION_BOX_EXCLUSION_TARGET_INVALID_ERROR_CODE = 'NOTIFICATION_BOX_EXCLUSION_TARGET_INVALID';
13266
- /** Thrown when the UID provided for NotificationUser creation is invalid. */ var NOTIFICATION_USER_INVALID_UID_FOR_CREATE_ERROR_CODE = 'NOTIFICATION_USER_INVALID_UID_FOR_CREATE';
13267
- /** Thrown when attempting to add a user who has blocked themselves from being added as a recipient. */ var NOTIFICATION_USER_BLOCKED_FROM_BEING_ADD_TO_RECIPIENTS_ERROR_CODE = 'NOTIFICATION_USER_BLOCKED_FROM_BEING_ADD_TO_RECIPIENTS';
13268
- /** Thrown when attempting to update a recipient config that is locked by the user. */ var NOTIFICATION_USER_LOCKED_CONFIG_FROM_BEING_UPDATED_ERROR_CODE = 'NOTIFICATION_USER_LOCKED_CONFIG_FROM_BEING_UPDATED';
13542
+ */ /**
13543
+ * Thrown when a notification creation request is missing a required ID.
13544
+ */ var CREATE_NOTIFICATION_ID_REQUIRED_ERROR_CODE = 'CREATE_NOTIFICATION_ID_REQUIRED';
13545
+ /**
13546
+ * Thrown when attempting to initialize a NotificationBox or NotificationSummary that is already initialized.
13547
+ */ var NOTIFICATION_MODEL_ALREADY_INITIALIZED_ERROR_CODE = 'NOTIFICATION_MODEL_ALREADY_INITIALIZED';
13548
+ /**
13549
+ * Thrown when the target NotificationBox does not exist.
13550
+ */ var NOTIFICATION_BOX_DOES_NOT_EXIST_ERROR_CODE = 'NOTIFICATION_BOX_DOES_NOT_EXIST';
13551
+ /**
13552
+ * Thrown when attempting to create a NotificationBox for a model that already has one.
13553
+ */ var NOTIFICATION_BOX_EXISTS_FOR_MODEL_ERROR_CODE = 'NOTIFICATION_BOX_EXISTS_FOR_MODEL';
13554
+ /**
13555
+ * Thrown when the target recipient does not exist in the NotificationBox.
13556
+ */ var NOTIFICATION_BOX_RECIPIENT_DOES_NOT_EXIST_ERROR_CODE = 'NOTIFICATION_BOX_RECIPIENT_DOES_NOT_EXIST';
13557
+ /**
13558
+ * Thrown when an exclusion target is invalid (e.g., user not associated with the box).
13559
+ */ var NOTIFICATION_BOX_EXCLUSION_TARGET_INVALID_ERROR_CODE = 'NOTIFICATION_BOX_EXCLUSION_TARGET_INVALID';
13560
+ /**
13561
+ * Thrown when the UID provided for NotificationUser creation is invalid.
13562
+ */ var NOTIFICATION_USER_INVALID_UID_FOR_CREATE_ERROR_CODE = 'NOTIFICATION_USER_INVALID_UID_FOR_CREATE';
13563
+ /**
13564
+ * Thrown when attempting to add a user who has blocked themselves from being added as a recipient.
13565
+ */ var NOTIFICATION_USER_BLOCKED_FROM_BEING_ADD_TO_RECIPIENTS_ERROR_CODE = 'NOTIFICATION_USER_BLOCKED_FROM_BEING_ADD_TO_RECIPIENTS';
13566
+ /**
13567
+ * Thrown when attempting to update a recipient config that is locked by the user.
13568
+ */ var NOTIFICATION_USER_LOCKED_CONFIG_FROM_BEING_UPDATED_ERROR_CODE = 'NOTIFICATION_USER_LOCKED_CONFIG_FROM_BEING_UPDATED';
13269
13569
 
13570
+ function _array_like_to_array$5(arr, len) {
13571
+ if (len == null || len > arr.length) len = arr.length;
13572
+ for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
13573
+ return arr2;
13574
+ }
13575
+ function _array_without_holes$4(arr) {
13576
+ if (Array.isArray(arr)) return _array_like_to_array$5(arr);
13577
+ }
13270
13578
  function _define_property$8(obj, key, value) {
13271
13579
  if (key in obj) {
13272
13580
  Object.defineProperty(obj, key, {
@@ -13280,6 +13588,12 @@ function _define_property$8(obj, key, value) {
13280
13588
  }
13281
13589
  return obj;
13282
13590
  }
13591
+ function _iterable_to_array$4(iter) {
13592
+ if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
13593
+ }
13594
+ function _non_iterable_spread$4() {
13595
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
13596
+ }
13283
13597
  function _object_spread$8(target) {
13284
13598
  for(var i = 1; i < arguments.length; i++){
13285
13599
  var source = arguments[i] != null ? arguments[i] : {};
@@ -13314,6 +13628,17 @@ function _object_spread_props$6(target, source) {
13314
13628
  }
13315
13629
  return target;
13316
13630
  }
13631
+ function _to_consumable_array$4(arr) {
13632
+ return _array_without_holes$4(arr) || _iterable_to_array$4(arr) || _unsupported_iterable_to_array$5(arr) || _non_iterable_spread$4();
13633
+ }
13634
+ function _unsupported_iterable_to_array$5(o, minLen) {
13635
+ if (!o) return;
13636
+ if (typeof o === "string") return _array_like_to_array$5(o, minLen);
13637
+ var n = Object.prototype.toString.call(o).slice(8, -1);
13638
+ if (n === "Object" && o.constructor) n = o.constructor.name;
13639
+ if (n === "Map" || n === "Set") return Array.from(n);
13640
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$5(o, minLen);
13641
+ }
13317
13642
  /**
13318
13643
  * Applies an array of config entry params to a {@link NotificationBoxRecipientTemplateConfigRecord},
13319
13644
  * inserting new entries, merging updates, and removing entries marked with `remove: true`.
@@ -13321,31 +13646,29 @@ function _object_spread_props$6(target, source) {
13321
13646
  * @param a - existing config record
13322
13647
  * @param b - array of update params to apply
13323
13648
  * @param limitToAllowedConfigTypes - when provided, filters the result to only include these template types
13649
+ * @returns the updated config record, or undefined if no changes were made
13324
13650
  */ function updateNotificationBoxRecipientTemplateConfigRecord(a, b, limitToAllowedConfigTypes) {
13325
- var c;
13326
- if (b != null) {
13327
- var cArray = notificationBoxRecipientTemplateConfigRecordToArray(a);
13328
- var updatedC = util.ModelRelationUtility.insertCollection(cArray, b, {
13329
- readKey: function readKey(x) {
13330
- return x.type;
13331
- },
13332
- merge: function merge(x, y) {
13333
- return _object_spread$8({}, x, y);
13334
- }
13335
- });
13336
- // remove types marked as remove
13337
- updatedC = util.ModelRelationUtility.removeKeysFromCollection(updatedC, b.filter(function(x) {
13338
- return x.remove;
13339
- }).map(function(x) {
13340
- return x.type;
13341
- }), function(x) {
13651
+ var cArray = notificationBoxRecipientTemplateConfigRecordToArray(a);
13652
+ var updatedC = util.ModelRelationUtility.insertCollection(cArray, b, {
13653
+ readKey: function readKey(x) {
13342
13654
  return x.type;
13343
- });
13344
- c = notificationBoxRecipientTemplateConfigArrayToRecord(updatedC);
13345
- // if the config types are limited to specific types, then filter those only
13346
- if (limitToAllowedConfigTypes) {
13347
- c = util.filterKeysOnPOJOFunction(limitToAllowedConfigTypes)(c);
13655
+ },
13656
+ merge: function merge(x, y) {
13657
+ return _object_spread$8({}, x, y);
13348
13658
  }
13659
+ });
13660
+ // remove types marked as remove
13661
+ updatedC = util.ModelRelationUtility.removeKeysFromCollection(updatedC, b.filter(function(x) {
13662
+ return x.remove;
13663
+ }).map(function(x) {
13664
+ return x.type;
13665
+ }), function(x) {
13666
+ return x.type;
13667
+ });
13668
+ var c = notificationBoxRecipientTemplateConfigArrayToRecord(updatedC);
13669
+ // if the config types are limited to specific types, then filter those only
13670
+ if (limitToAllowedConfigTypes) {
13671
+ c = util.filterKeysOnPOJOFunction(limitToAllowedConfigTypes)(c);
13349
13672
  }
13350
13673
  return c;
13351
13674
  }
@@ -13356,6 +13679,7 @@ function _object_spread_props$6(target, source) {
13356
13679
  * @param a - existing config
13357
13680
  * @param b - update params to apply
13358
13681
  * @param limitToAllowedConfigTypes - when provided, filters config types to only allowed template types
13682
+ * @returns the updated default recipient config
13359
13683
  */ function updateNotificationUserDefaultNotificationBoxRecipientConfig(a, b, limitToAllowedConfigTypes) {
13360
13684
  var _ref;
13361
13685
  var inputC = b.configs, inputF = b.f, inputBk = b.bk, inputLk = b.lk;
@@ -13372,6 +13696,11 @@ function _object_spread_props$6(target, source) {
13372
13696
  * only if it actually changed. Returns `undefined` if no changes were detected.
13373
13697
  *
13374
13698
  * Automatically sets `ns = true` (needs sync) when changes are detected and the recipient has been indexed.
13699
+ *
13700
+ * @param a - existing per-box recipient config
13701
+ * @param b - update params to apply
13702
+ * @param limitToAllowedConfigTypes - when provided, filters template config types to only allowed types
13703
+ * @returns the updated config if changes were detected, or undefined if no changes occurred
13375
13704
  */ function updateNotificationUserNotificationBoxRecipientConfigIfChanged(a, b, limitToAllowedConfigTypes) {
13376
13705
  var _ref;
13377
13706
  var inputC = b.configs, inputRm = b.rm, inputLk = b.lk, inputBk = b.bk;
@@ -13402,6 +13731,11 @@ function _object_spread_props$6(target, source) {
13402
13731
  * through the optional {@link AppNotificationTemplateTypeInfoRecordService}.
13403
13732
  *
13404
13733
  * Returns `undefined` if no changes were made.
13734
+ *
13735
+ * @param a - existing per-box recipient config array
13736
+ * @param b - array of update params to apply to matching boxes
13737
+ * @param filterWithService - optional service used to filter template types to only those valid for each box's model
13738
+ * @returns the updated config array if any changes occurred, or undefined if nothing changed
13405
13739
  */ function updateNotificationUserNotificationBoxRecipientConfigs(a, b, filterWithService) {
13406
13740
  var boxesMap = util.makeModelMap(a, function(x) {
13407
13741
  return x.nb;
@@ -13431,7 +13765,7 @@ function _object_spread_props$6(target, source) {
13431
13765
  });
13432
13766
  var result;
13433
13767
  if (hasChanges) {
13434
- result = Array.from(boxesMap.values());
13768
+ result = _to_consumable_array$4(boxesMap.values());
13435
13769
  }
13436
13770
  return result;
13437
13771
  }
@@ -13570,6 +13904,9 @@ function _ts_generator$4(thisArg, body) {
13570
13904
  *
13571
13905
  * Maps friendly field names (`subject`, `message`, `createdBy`, etc.) to their Firestore abbreviations
13572
13906
  * and filters out null/undefined metadata values.
13907
+ *
13908
+ * @param input - friendly input with readable field names
13909
+ * @returns the low-level template using Firestore field abbreviations
13573
13910
  */ function createNotificationTemplate(input) {
13574
13911
  var _ref, _ref1;
13575
13912
  var inputNotificationModel = input.notificationModel, type = input.type, unique = input.unique, overrideExistingTask = input.overrideExistingTask, // notification
@@ -13616,6 +13953,9 @@ function _ts_generator$4(thisArg, body) {
13616
13953
  * Determines whether a notification should be created based on the explicit toggle and throttle settings.
13617
13954
  *
13618
13955
  * Returns false if `sendNotification` is explicitly false, or if the throttle window hasn't elapsed.
13956
+ *
13957
+ * @param input - the send control parameters including the toggle and throttle configuration
13958
+ * @returns true if the notification should be created and sent
13619
13959
  */ function shouldSendCreatedNotificationInput(input) {
13620
13960
  var sendNotification = input.sendNotification, sendNotificationThrottleDate = input.sendNotificationThrottleDate, inputSendNotificationThrottleTime = input.sendNotificationThrottleTime;
13621
13961
  var sendNotificationThrottleTime = inputSendNotificationThrottleTime !== null && inputSendNotificationThrottleTime !== void 0 ? inputSendNotificationThrottleTime : util.MS_IN_HOUR;
@@ -13629,6 +13969,8 @@ function _ts_generator$4(thisArg, body) {
13629
13969
  *
13630
13970
  * For unique task notifications, generates a deterministic document ID from the target model and task type.
13631
13971
  *
13972
+ * @param input - the creation parameters including template, context, and accessor
13973
+ * @returns the document reference and notification data pair, with `notificationCreated` set to false
13632
13974
  * @throws {Error} When neither an accessor nor sufficient context is provided
13633
13975
  * @throws {Error} When `unique=true` but no target model is specified
13634
13976
  */ function createNotificationDocumentPair(input) {
@@ -13637,15 +13979,13 @@ function _ts_generator$4(thisArg, body) {
13637
13979
  var notificationModel = template.notificationModel, inputCat = template.cat, st = template.st, sat = template.sat, r = template.r, rf = template.rf, n = template.n, ts = template.ts, es = template.es, ps = template.ps, ns = template.ns, ois = template.ois, ots = template.ots, tpr = template.tpr, inputUnique = template.unique, inputOverrideExistingTask = template.overrideExistingTask;
13638
13980
  /**
13639
13981
  * Use the input, or default to true if inputUnique is true.
13640
- */ var overrideExistingTask = inputOverrideExistingTask != null ? inputOverrideExistingTask : inputUnique ? true : undefined;
13982
+ */ var overrideExistingTask = inputOverrideExistingTask !== null && inputOverrideExistingTask !== void 0 ? inputOverrideExistingTask : inputUnique ? true : undefined;
13641
13983
  var accessor = inputAccessor;
13642
13984
  var notificationBoxId = notificationBoxIdForModel(notificationModel);
13643
- if (!accessor && notificationBoxId) {
13644
- if (context) {
13645
- var notificationCollectionFactory = context.notificationCollectionFactory, notificationBoxCollection = context.notificationBoxCollection;
13646
- var notificationBoxDocument = notificationBoxCollection.documentAccessorForTransaction(transaction).loadDocumentForId(notificationBoxId);
13647
- accessor = notificationCollectionFactory(notificationBoxDocument).documentAccessorForTransaction(transaction);
13648
- }
13985
+ if (!accessor && notificationBoxId && context) {
13986
+ var notificationCollectionFactory = context.notificationCollectionFactory, notificationBoxCollection = context.notificationBoxCollection;
13987
+ var notificationBoxDocument = notificationBoxCollection.documentAccessorForTransaction(transaction).loadDocumentForId(notificationBoxId);
13988
+ accessor = notificationCollectionFactory(notificationBoxDocument).documentAccessorForTransaction(transaction);
13649
13989
  }
13650
13990
  if (!accessor) {
13651
13991
  throw new Error('createNotificationDocument() failed as neither an accessor nor sufficient information was provided about the target.');
@@ -13726,6 +14066,10 @@ function _ts_generator$4(thisArg, body) {
13726
14066
  }
13727
14067
  /**
13728
14068
  * Internal function used by createNotificationDocument().
14069
+ *
14070
+ * @param input - send control parameters (throttle settings, shouldCreateNotification flag)
14071
+ * @param pair - the document pair created by {@link createNotificationDocumentPair}
14072
+ * @returns the pair with `notificationCreated` updated to reflect whether the document was saved
13729
14073
  */ function _createNotificationDocumentFromPair(input, pair) {
13730
14074
  return _async_to_generator$4(function() {
13731
14075
  var notification, notificationDocument, isNotificationTask, overrideExistingTask;
@@ -13776,6 +14120,9 @@ function _ts_generator$4(thisArg, body) {
13776
14120
  *
13777
14121
  * For unique tasks with `overrideExistingTask`, uses `set()` to replace existing documents.
13778
14122
  * Otherwise uses `create()` which fails if the document already exists.
14123
+ *
14124
+ * @param input - the creation parameters including template, context, send control settings
14125
+ * @returns the document pair with `notificationCreated` reflecting whether the document was saved
13779
14126
  */ function createNotificationDocument(input) {
13780
14127
  return _async_to_generator$4(function() {
13781
14128
  var pair;
@@ -13792,6 +14139,9 @@ function _ts_generator$4(thisArg, body) {
13792
14139
  * Creates and saves a notification only if sending conditions are met (not throttled, not explicitly disabled).
13793
14140
  *
13794
14141
  * Returns `undefined` if the notification was not created.
14142
+ *
14143
+ * @param input - the creation parameters including template, context, and send control settings
14144
+ * @returns the document pair if the notification was created, or undefined if it was skipped
13795
14145
  */ function createNotificationDocumentIfSending(input) {
13796
14146
  return _async_to_generator$4(function() {
13797
14147
  var pair;
@@ -13870,6 +14220,8 @@ function _object_spread_props$5(target, source) {
13870
14220
  /**
13871
14221
  * Creates a {@link CreateNotificationTaskTemplate} with `TASK_NOTIFICATION` send type and no recipients.
13872
14222
  *
14223
+ * @param input - task template input parameters
14224
+ * @returns the configured task notification template
13873
14225
  * @throws {Error} When `unique=true` but no `notificationModel` or target model is specified.
13874
14226
  *
13875
14227
  * @example
@@ -13907,11 +14259,17 @@ function _array_like_to_array$4(arr, len) {
13907
14259
  function _array_with_holes$1(arr) {
13908
14260
  if (Array.isArray(arr)) return arr;
13909
14261
  }
14262
+ function _array_without_holes$3(arr) {
14263
+ if (Array.isArray(arr)) return _array_like_to_array$4(arr);
14264
+ }
13910
14265
  function _class_call_check$5(instance, Constructor) {
13911
14266
  if (!(instance instanceof Constructor)) {
13912
14267
  throw new TypeError("Cannot call a class as a function");
13913
14268
  }
13914
14269
  }
14270
+ function _iterable_to_array$3(iter) {
14271
+ if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
14272
+ }
13915
14273
  function _iterable_to_array_limit$1(arr, i) {
13916
14274
  var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
13917
14275
  if (_i == null) return;
@@ -13939,9 +14297,15 @@ function _iterable_to_array_limit$1(arr, i) {
13939
14297
  function _non_iterable_rest$1() {
13940
14298
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
13941
14299
  }
14300
+ function _non_iterable_spread$3() {
14301
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
14302
+ }
13942
14303
  function _sliced_to_array$1(arr, i) {
13943
14304
  return _array_with_holes$1(arr) || _iterable_to_array_limit$1(arr, i) || _unsupported_iterable_to_array$4(arr, i) || _non_iterable_rest$1();
13944
14305
  }
14306
+ function _to_consumable_array$3(arr) {
14307
+ return _array_without_holes$3(arr) || _iterable_to_array$3(arr) || _unsupported_iterable_to_array$4(arr) || _non_iterable_spread$3();
14308
+ }
13945
14309
  function _unsupported_iterable_to_array$4(o, minLen) {
13946
14310
  if (!o) return;
13947
14311
  if (typeof o === "string") return _array_like_to_array$4(o, minLen);
@@ -13953,6 +14317,8 @@ function _unsupported_iterable_to_array$4(o, minLen) {
13953
14317
  /**
13954
14318
  * Creates a {@link NotificationTemplateTypeInfoRecord} from an array of template type info entries.
13955
14319
  *
14320
+ * @param infoArray - array of template type info entries to index
14321
+ * @returns a record keyed by template type
13956
14322
  * @throws {Error} When duplicate template types are found in the input array.
13957
14323
  *
13958
14324
  * @example
@@ -13989,6 +14355,7 @@ function _unsupported_iterable_to_array$4(o, minLen) {
13989
14355
  * Handles alternative model identities defined in {@link NotificationTemplateTypeInfoIdentityInfoAlternativeModelIdentityPair}.
13990
14356
  *
13991
14357
  * @param appNotificationTemplateTypeInfoRecord - the complete template type registry for the application
14358
+ * @returns a fully initialized service with indexed lookups for fast template type discovery
13992
14359
  *
13993
14360
  * @example
13994
14361
  * ```ts
@@ -14023,10 +14390,10 @@ function _unsupported_iterable_to_array$4(o, minLen) {
14023
14390
  allKnownTemplateTypeInfo.push(info);
14024
14391
  allKnownTemplateTypes.push(info.type);
14025
14392
  });
14026
- var allNotificationModelIdentityValues = Array.from(allNotificationModelIdentityValuesSet);
14393
+ var allNotificationModelIdentityValues = _to_consumable_array$3(allNotificationModelIdentityValuesSet);
14027
14394
  var notificationModelTemplateInfoMap = notificationModelTypeInfoMapBuilder.map();
14028
14395
  var targetModelTemplateInfoMap = targetModelTypeInfoMapBuilder.map();
14029
- var notificationModelTemplateTypesMap = new Map(Array.from(notificationModelTemplateInfoMap.entries()).map(function(param) {
14396
+ var notificationModelTemplateTypesMap = new Map(_to_consumable_array$3(notificationModelTemplateInfoMap.entries()).map(function(param) {
14030
14397
  var _param = _sliced_to_array$1(param, 2), k = _param[0], x = _param[1];
14031
14398
  return [
14032
14399
  k,
@@ -14035,7 +14402,7 @@ function _unsupported_iterable_to_array$4(o, minLen) {
14035
14402
  })
14036
14403
  ];
14037
14404
  }));
14038
- var targetModelTemplateTypesMap = new Map(Array.from(targetModelTemplateInfoMap.entries()).map(function(param) {
14405
+ var targetModelTemplateTypesMap = new Map(_to_consumable_array$3(targetModelTemplateInfoMap.entries()).map(function(param) {
14039
14406
  var _param = _sliced_to_array$1(param, 2), k = _param[0], x = _param[1];
14040
14407
  return [
14041
14408
  k,
@@ -14239,6 +14606,7 @@ function _ts_generator$3(thisArg, body) {
14239
14606
  *
14240
14607
  * @param fn - base function that generates message content per recipient
14241
14608
  * @param extras - optional delivery customization (global recipients, send callbacks)
14609
+ * @returns a {@link NotificationMessageFunction} with the extras attached
14242
14610
  *
14243
14611
  * @example
14244
14612
  * ```ts
@@ -14266,6 +14634,8 @@ function _ts_generator$3(thisArg, body) {
14266
14634
  *
14267
14635
  * Useful as a placeholder factory for template types that should not produce deliverable content.
14268
14636
  *
14637
+ * @returns a factory that produces no-content message functions
14638
+ *
14269
14639
  * @example
14270
14640
  * ```ts
14271
14641
  * const factory = noContentNotificationMessageFunctionFactory();
@@ -14274,7 +14644,7 @@ function _ts_generator$3(thisArg, body) {
14274
14644
  * // msg.flag === NotificationMessageFlag.NO_CONTENT
14275
14645
  * ```
14276
14646
  */ function noContentNotificationMessageFunctionFactory() {
14277
- return function(config) {
14647
+ return function(_config) {
14278
14648
  return _async_to_generator$3(function() {
14279
14649
  return _ts_generator$3(this, function(_state) {
14280
14650
  // const { item } = config;
@@ -14309,6 +14679,8 @@ function _ts_generator$3(thisArg, body) {
14309
14679
  * Query constraints for finding {@link NotificationUser} documents that have pending config syncs (`ns == true`).
14310
14680
  *
14311
14681
  * Used by the server to discover users whose configs need to be synced to their NotificationBox recipients.
14682
+ *
14683
+ * @returns array of Firestore query constraints filtering for users needing sync
14312
14684
  */ function notificationUsersFlaggedForNeedsSyncQuery() {
14313
14685
  return [
14314
14686
  where('ns', '==', true)
@@ -14318,6 +14690,7 @@ function _ts_generator$3(thisArg, body) {
14318
14690
  * Query constraints for finding {@link NotificationUser} documents that have any of the given exclusion IDs in their `x` array.
14319
14691
  *
14320
14692
  * @param exclusionId - one or more box IDs or collection name prefixes to match against
14693
+ * @returns array of Firestore query constraints filtering for users with matching exclusions
14321
14694
  */ function notificationUserHasExclusionQuery(exclusionId) {
14322
14695
  return [
14323
14696
  where('x', 'array-contains-any', exclusionId)
@@ -14326,6 +14699,8 @@ function _ts_generator$3(thisArg, body) {
14326
14699
  // MARK: NotificationSummary
14327
14700
  /**
14328
14701
  * Query constraints for finding {@link NotificationSummary} documents that need server-side initialization (`s == true`).
14702
+ *
14703
+ * @returns array of Firestore query constraints filtering for summaries needing initialization
14329
14704
  */ function notificationSummariesFlaggedForNeedsInitializationQuery() {
14330
14705
  return [
14331
14706
  where('s', '==', true)
@@ -14335,6 +14710,8 @@ function _ts_generator$3(thisArg, body) {
14335
14710
  // MARK: NotificationBox
14336
14711
  /**
14337
14712
  * Query constraints for finding {@link NotificationBox} documents that need server-side initialization (`s == true`).
14713
+ *
14714
+ * @returns array of Firestore query constraints filtering for boxes needing initialization
14338
14715
  */ function notificationBoxesFlaggedForNeedsInitializationQuery() {
14339
14716
  return [
14340
14717
  where('s', '==', true)
@@ -14344,6 +14721,8 @@ function _ts_generator$3(thisArg, body) {
14344
14721
  * Query constraints for finding {@link NotificationBox} documents flagged as invalid (`fi == true`).
14345
14722
  *
14346
14723
  * Used by the server to clean up boxes that could not be initialized.
14724
+ *
14725
+ * @returns array of Firestore query constraints filtering for boxes flagged as invalid
14347
14726
  */ function notificationBoxesFlaggedInvalidQuery() {
14348
14727
  return [
14349
14728
  where('fi', '==', true)
@@ -14357,6 +14736,7 @@ function _ts_generator$3(thisArg, body) {
14357
14736
  * This is the primary query used by the send queue processor.
14358
14737
  *
14359
14738
  * @param now - reference time for the `sat` comparison (defaults to current time)
14739
+ * @returns array of Firestore query constraints filtering for notifications past their scheduled send time
14360
14740
  */ function notificationsPastSendAtTimeQuery() {
14361
14741
  var now = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : new Date();
14362
14742
  return [
@@ -14367,6 +14747,8 @@ function _ts_generator$3(thisArg, body) {
14367
14747
  /**
14368
14748
  * Query constraints for finding {@link Notification} documents marked as done (`d == true`)
14369
14749
  * and ready to be archived to {@link NotificationWeek} and then deleted.
14750
+ *
14751
+ * @returns array of Firestore query constraints filtering for completed notifications ready to archive
14370
14752
  */ function notificationsReadyForCleanupQuery() {
14371
14753
  return [
14372
14754
  where('d', '==', true)
@@ -14403,6 +14785,10 @@ function _unsupported_iterable_to_array$3(o, minLen) {
14403
14785
  *
14404
14786
  * Used when combining results from multiple send batches within the same channel.
14405
14787
  *
14788
+ * @param a - first result to merge
14789
+ * @param b - second result to merge
14790
+ * @returns a new result with all recipient lists concatenated from both inputs
14791
+ *
14406
14792
  * @example
14407
14793
  * ```ts
14408
14794
  * const combined = mergeNotificationSendMessagesResult(firstBatchResult, secondBatchResult);
@@ -14469,6 +14855,8 @@ function _object_spread_props$4(target, source) {
14469
14855
  * Use this when the handler needs more time but doesn't want to increment the failure counter.
14470
14856
  * The task will be re-queued without counting as an error attempt.
14471
14857
  *
14858
+ * @returns an empty checkpoint array signaling in-progress without failure
14859
+ *
14472
14860
  * @example
14473
14861
  * ```ts
14474
14862
  * // Waiting for an external process — delay without failing
@@ -14484,6 +14872,7 @@ function _object_spread_props$4(target, source) {
14484
14872
  *
14485
14873
  * @param delayUntil - absolute date or relative milliseconds from the task's run start time
14486
14874
  * @param updateMetadata - optional metadata updates to merge into the notification item
14875
+ * @returns a task result that re-queues the task after the specified delay without marking it failed
14487
14876
  *
14488
14877
  * @example
14489
14878
  * ```ts
@@ -14505,6 +14894,7 @@ function _object_spread_props$4(target, source) {
14505
14894
  *
14506
14895
  * @param completedParts - checkpoint string(s) that were just completed
14507
14896
  * @param updateMetadata - optional metadata updates to merge into the notification item
14897
+ * @returns a task result marking the given checkpoints complete while keeping the task running
14508
14898
  *
14509
14899
  * @example
14510
14900
  * ```ts
@@ -14521,6 +14911,7 @@ function _object_spread_props$4(target, source) {
14521
14911
  * Returns a result indicating the task completed successfully. The notification document will be deleted.
14522
14912
  *
14523
14913
  * @param updateMetadata - optional final metadata update (applied before deletion if subtasks need it)
14914
+ * @returns a task result signaling successful completion; the notification document will be deleted
14524
14915
  *
14525
14916
  * @example
14526
14917
  * ```ts
@@ -14540,6 +14931,7 @@ function _object_spread_props$4(target, source) {
14540
14931
  *
14541
14932
  * @param updateMetadata - optional metadata updates
14542
14933
  * @param removeFromCompletedCheckpoints - checkpoint(s) to remove from the completed set (e.g., to retry a checkpoint)
14934
+ * @returns a task result signaling failure; the error attempt counter is incremented
14543
14935
  *
14544
14936
  * @example
14545
14937
  * ```ts
@@ -14561,6 +14953,7 @@ function _object_spread_props$4(target, source) {
14561
14953
  *
14562
14954
  * @param result - the task result to wrap
14563
14955
  * @param force - when true, overrides any existing `canRunNextCheckpoint` value
14956
+ * @returns a copy of the result with `canRunNextCheckpoint` set to true
14564
14957
  */ function notificationTaskCanRunNextCheckpoint(result, force) {
14565
14958
  if (force || result.canRunNextCheckpoint == null) {
14566
14959
  result = _object_spread_props$4(_object_spread$6({}, result), {
@@ -14634,6 +15027,8 @@ function _object_spread_props$3(target, source) {
14634
15027
  * Internal helper that marks the `'processing'` checkpoint complete and schedules the `'cleanup'` phase.
14635
15028
  *
14636
15029
  * Prefer using {@link notificationSubtaskComplete} in subtask handlers instead of calling this directly.
15030
+ *
15031
+ * @returns a partially-complete task result with the processing checkpoint marked done
14637
15032
  */ function completeSubtaskProcessingAndScheduleCleanupTaskResult() {
14638
15033
  return notificationTaskPartiallyComplete([
14639
15034
  'processing'
@@ -14645,6 +15040,9 @@ function _object_spread_props$3(target, source) {
14645
15040
  * Unlike {@link notificationTaskComplete}, this signals that the cleanup checkpoint should still run.
14646
15041
  * Use `canRunNextCheckpoint: true` in options to run cleanup immediately in the same execution.
14647
15042
  *
15043
+ * @param options - optional metadata updates and flag to run cleanup immediately in the same execution
15044
+ * @returns a task result marking the subtask as complete while allowing cleanup to proceed
15045
+ *
14648
15046
  * @example
14649
15047
  * ```ts
14650
15048
  * // Processing done, schedule cleanup for next run
@@ -14737,6 +15135,9 @@ function _unsupported_iterable_to_array$2(o, minLen) {
14737
15135
  *
14738
15136
  * Filters template configs to only include types applicable to the notification box's model.
14739
15137
  * Used during the server-side sync process to update box recipient entries from user configs.
15138
+ *
15139
+ * @param input - the merged config inputs including uid, global config, box config, and optional existing recipient
15140
+ * @returns the computed effective box recipient with merged config, contact info, and flags
14740
15141
  */ function effectiveNotificationBoxRecipientConfig(input) {
14741
15142
  var _ref, _ref1, _gc_f, _gc_lk, _gc_e, _gc_t;
14742
15143
  var uid = input.uid, inputM = input.m, appNotificationTemplateTypeInfoRecordService = input.appNotificationTemplateTypeInfoRecordService, gc = input.gc, notificationUserNotificationBoxConfig = input.boxConfig, recipient = input.recipient;
@@ -14768,6 +15169,9 @@ function _unsupported_iterable_to_array$2(o, minLen) {
14768
15169
  * and propagates exclusion flags to the per-box configs.
14769
15170
  *
14770
15171
  * Exclusions not matching any associated notification box are automatically filtered out.
15172
+ *
15173
+ * @param input - the user, exclusions to add, and exclusions to remove
15174
+ * @returns the updated exclusion list and the partial user update to apply
14771
15175
  */ function updateNotificationUserNotificationSendExclusions(input) {
14772
15176
  var notificationUser = input.notificationUser, inputAddExclusions = input.addExclusions, inputRemoveExclusions = input.removeExclusions;
14773
15177
  var associatedNotificationBoxes = notificationUser.b, currentExclusions = notificationUser.x, notificationBoxConfigs = notificationUser.bc;
@@ -14805,6 +15209,9 @@ function _unsupported_iterable_to_array$2(o, minLen) {
14805
15209
  /**
14806
15210
  * Applies the current exclusion list to per-box configs, setting/clearing the `x` flag and marking
14807
15211
  * changed configs as needing sync (`ns = true`).
15212
+ *
15213
+ * @param params - the exclusion list, per-box configs, and optional flag to recalculate the global ns flag
15214
+ * @returns the updated per-box configs and the recalculated needs-sync flag
14808
15215
  */ function applyExclusionsToNotificationUserNotificationBoxRecipientConfigs(params) {
14809
15216
  var _ref, _ref1;
14810
15217
  var inputX = params.x, inputBc = params.bc, notificationUser = params.notificationUser, recalculateNs = params.recalculateNs;
@@ -14832,6 +15239,9 @@ function _unsupported_iterable_to_array$2(o, minLen) {
14832
15239
  }
14833
15240
  /**
14834
15241
  * Returns true if any of the per-box configs need syncing (`ns == true`).
15242
+ *
15243
+ * @param configs - array of per-box recipient configs to check
15244
+ * @returns true if at least one config has its needs-sync flag set
14835
15245
  */ function calculateNsForNotificationUserNotificationBoxRecipientConfigs(configs) {
14836
15246
  return configs.some(function(x) {
14837
15247
  return x.ns;
@@ -14840,11 +15250,14 @@ function _unsupported_iterable_to_array$2(o, minLen) {
14840
15250
  /**
14841
15251
  * Creates a {@link NotificationSendExclusionCanSendFunction} from the given exclusion list.
14842
15252
  * Returns true for IDs that don't match any exclusion prefix.
15253
+ *
15254
+ * @param exclusions - the list of box IDs or prefixes that should be excluded from delivery
15255
+ * @returns a predicate function that returns true if the given notification/box ID is not excluded
14843
15256
  */ var notificationSendExclusionCanSendFunction = function notificationSendExclusionCanSendFunction(exclusions) {
14844
15257
  var fn = function fn(notification) {
14845
- return exclusions.findIndex(function(x) {
15258
+ return !exclusions.some(function(x) {
14846
15259
  return notification.startsWith(x);
14847
- }) === -1;
15260
+ });
14848
15261
  };
14849
15262
  fn._exclusions = exclusions;
14850
15263
  return fn;
@@ -14853,12 +15266,18 @@ function _unsupported_iterable_to_array$2(o, minLen) {
14853
15266
  /**
14854
15267
  * Returns true if all channels on the notification have reached a terminal state
14855
15268
  * (NONE, NO_TRY, SENT, or SKIPPED). Used to determine if the notification can be marked done.
15269
+ *
15270
+ * @param input - the per-channel send flags to evaluate
15271
+ * @returns true if all channels are in a terminal send state
14856
15272
  */ function notificationSendFlagsImplyIsComplete(input) {
14857
15273
  return isCompleteNotificationSendState(input.es) && isCompleteNotificationSendState(input.ps) && isCompleteNotificationSendState(input.ts) && isCompleteNotificationSendState(input.ns);
14858
15274
  }
14859
15275
  /**
14860
15276
  * Returns true if the given send state is terminal — no further send attempts will be made.
14861
15277
  * Terminal states: NONE, NO_TRY, SENT, SKIPPED.
15278
+ *
15279
+ * @param input - the send state to evaluate
15280
+ * @returns true if the state is terminal and no further delivery will be attempted
14862
15281
  */ function isCompleteNotificationSendState(input) {
14863
15282
  var isComplete = false;
14864
15283
  switch(input){
@@ -14868,7 +15287,11 @@ function _unsupported_iterable_to_array$2(o, minLen) {
14868
15287
  case exports.NotificationSendState.SKIPPED:
14869
15288
  isComplete = true;
14870
15289
  break;
14871
- default:
15290
+ case exports.NotificationSendState.QUEUED:
15291
+ case exports.NotificationSendState.SENT_PARTIAL:
15292
+ case exports.NotificationSendState.SEND_ERROR:
15293
+ case exports.NotificationSendState.BUILD_ERROR:
15294
+ case exports.NotificationSendState.CONFIG_ERROR:
14872
15295
  isComplete = false;
14873
15296
  break;
14874
15297
  }
@@ -14876,6 +15299,9 @@ function _unsupported_iterable_to_array$2(o, minLen) {
14876
15299
  }
14877
15300
  /**
14878
15301
  * Resolves which recipient groups (global, box, explicit) are allowed based on the {@link NotificationRecipientSendFlag}.
15302
+ *
15303
+ * @param flag - the recipient send flag controlling which groups are included
15304
+ * @returns an object indicating which recipient groups are permitted for this notification
14879
15305
  */ function allowedNotificationRecipients(flag) {
14880
15306
  var canSendToGlobalRecipients = true;
14881
15307
  var canSendToBoxRecipients = true;
@@ -14909,6 +15335,9 @@ function _unsupported_iterable_to_array$2(o, minLen) {
14909
15335
  *
14910
15336
  * Only notifications that can be sent to box recipients are archived (notifications restricted
14911
15337
  * to only explicit or only global recipients are not saved to the weekly archive).
15338
+ *
15339
+ * @param notification - the notification to check
15340
+ * @returns true if the notification should be saved to the weekly archive after delivery
14912
15341
  */ function shouldSaveNotificationToNotificationWeek(notification) {
14913
15342
  return allowedNotificationRecipients(notification.rf).canSendToBoxRecipients;
14914
15343
  }
@@ -14916,6 +15345,10 @@ function _unsupported_iterable_to_array$2(o, minLen) {
14916
15345
  /**
14917
15346
  * Merges a partial update into a {@link NotificationUserNotificationBoxRecipientConfig},
14918
15347
  * preserving user-controlled fields (`nb`, `rm`, `ns`, `lk`, `bk`) and respecting OPT_OUT state.
15348
+ *
15349
+ * @param a - base user box recipient config to merge into
15350
+ * @param b - partial update to apply on top of the base
15351
+ * @returns the merged config with protected fields retained from `a`
14919
15352
  */ function mergeNotificationUserNotificationBoxRecipientConfigs(a, b) {
14920
15353
  var _b_f;
14921
15354
  return _object_spread_props$2(_object_spread$4({}, mergeNotificationBoxRecipients(a, b)), {
@@ -14930,6 +15363,10 @@ function _unsupported_iterable_to_array$2(o, minLen) {
14930
15363
  }
14931
15364
  /**
14932
15365
  * Merges a partial update into a {@link NotificationBoxRecipient}, deeply merging the `c` (config record) field.
15366
+ *
15367
+ * @param a - base recipient to merge into
15368
+ * @param b - partial recipient update to apply on top of the base
15369
+ * @returns the merged recipient with deeply merged template config records
14933
15370
  */ function mergeNotificationBoxRecipients(a, b) {
14934
15371
  return _object_spread_props$2(_object_spread$4({}, a, b), {
14935
15372
  // configs should be merged/ovewritten
@@ -14939,6 +15376,9 @@ function _unsupported_iterable_to_array$2(o, minLen) {
14939
15376
  /**
14940
15377
  * Resolves a {@link NotificationBoxDocument} from a reference pair, loading by model key if no document is provided directly.
14941
15378
  *
15379
+ * @param input - reference pair containing either a direct document or a model key to load from
15380
+ * @param accessor - Firestore document accessor used to load the document by ID when needed
15381
+ * @returns the resolved NotificationBoxDocument
14942
15382
  * @throws {Error} When neither a document nor a model key is provided.
14943
15383
  */ function loadNotificationBoxDocumentForReferencePair(input, accessor) {
14944
15384
  var inputNotificationBoxDocument = input.notificationBoxDocument, inputNotificationBoxRelatedModelKey = input.notificationBoxRelatedModelKey;
@@ -15082,11 +15522,17 @@ function _is_native_reflect_construct$2() {
15082
15522
  });
15083
15523
  /**
15084
15524
  * Returns the Firestore {@link CollectionReference} for {@link OidcEntry} documents.
15525
+ *
15526
+ * @param context - the Firestore context to use
15527
+ * @returns the CollectionReference for OidcEntry documents
15085
15528
  */ function oidcEntryCollectionReference(context) {
15086
15529
  return context.collection(oidcEntryIdentity.collectionName);
15087
15530
  }
15088
15531
  /**
15089
15532
  * Creates an {@link OidcEntryFirestoreCollection} from the given configuration.
15533
+ *
15534
+ * @param config - the Firestore context and collection configuration
15535
+ * @returns a configured OidcEntryFirestoreCollection
15090
15536
  */ function oidcEntryFirestoreCollection(config) {
15091
15537
  var firestoreContext = config.firestoreContext;
15092
15538
  return firestoreContext.firestoreCollection({
@@ -15102,6 +15548,9 @@ function _is_native_reflect_construct$2() {
15102
15548
 
15103
15549
  /**
15104
15550
  * Query for OidcEntry documents with a specific type.
15551
+ *
15552
+ * @param type - the OIDC entry type to filter by
15553
+ * @returns Firestore query constraints for the given type
15105
15554
  */ function oidcEntriesWithTypeQuery(type) {
15106
15555
  return [
15107
15556
  where('type', '==', type)
@@ -15109,6 +15558,10 @@ function _is_native_reflect_construct$2() {
15109
15558
  }
15110
15559
  /**
15111
15560
  * Query for OidcEntry documents with a specific type and userCode.
15561
+ *
15562
+ * @param type - the OIDC entry type to filter by
15563
+ * @param userCode - the user code to match
15564
+ * @returns Firestore query constraints for the given type and userCode
15112
15565
  */ function oidcEntriesByUserCodeQuery(type, userCode) {
15113
15566
  return [
15114
15567
  where('type', '==', type),
@@ -15117,6 +15570,10 @@ function _is_native_reflect_construct$2() {
15117
15570
  }
15118
15571
  /**
15119
15572
  * Query for OidcEntry documents with a specific type and uid.
15573
+ *
15574
+ * @param type - the OIDC entry type to filter by
15575
+ * @param uid - the Firebase user ID to match
15576
+ * @returns Firestore query constraints for the given type and uid
15120
15577
  */ function oidcEntriesByUidQuery(type, uid) {
15121
15578
  return [
15122
15579
  where('type', '==', type),
@@ -15125,6 +15582,10 @@ function _is_native_reflect_construct$2() {
15125
15582
  }
15126
15583
  /**
15127
15584
  * Query for OidcEntry documents with a specific type and grantId.
15585
+ *
15586
+ * @param type - the OIDC entry type to filter by
15587
+ * @param grantId - the grant ID to match
15588
+ * @returns Firestore query constraints for the given type and grantId
15128
15589
  */ function oidcEntriesByGrantIdQuery(type, grantId) {
15129
15590
  return [
15130
15591
  where('type', '==', type),
@@ -15133,6 +15594,9 @@ function _is_native_reflect_construct$2() {
15133
15594
  }
15134
15595
  /**
15135
15596
  * Query for OidcEntry Client documents owned by a specific user.
15597
+ *
15598
+ * @param ownershipKey - the ownership key identifying the owner
15599
+ * @returns Firestore query constraints for Client entries matching the ownership key
15136
15600
  */ function oidcClientEntriesByOwnerQuery(ownershipKey) {
15137
15601
  return [
15138
15602
  where('type', '==', 'Client'),
@@ -15460,6 +15924,10 @@ function _is_native_reflect_construct$1() {
15460
15924
  var storageFileIdentity = firestoreModelIdentity('storageFile', 'sf');
15461
15925
  /**
15462
15926
  * Creates a StorageFileGroupCreatedStorageFileKey from the input StorageFileGroupId and purpose.
15927
+ *
15928
+ * @param purpose - the purpose identifying the type of file within the group
15929
+ * @param storageFileGroupId - the ID of the parent StorageFileGroup
15930
+ * @returns a deterministic FirestoreCollectionModelKey for the storage file
15463
15931
  */ function storageFileGroupCreatedStorageFileKey(purpose, storageFileGroupId) {
15464
15932
  return firestoreModelKey(storageFileIdentity, "".concat(purpose, "_").concat(storageFileGroupId));
15465
15933
  }
@@ -15654,6 +16122,9 @@ var storageFileIdentity = firestoreModelIdentity('storageFile', 'sf');
15654
16122
  * ```ts
15655
16123
  * const colRef = storageFileCollectionReference(firestoreContext);
15656
16124
  * ```
16125
+ *
16126
+ * @param context - the Firestore context to use
16127
+ * @returns the CollectionReference for StorageFile documents
15657
16128
  */ function storageFileCollectionReference(context) {
15658
16129
  return context.collection(storageFileIdentity.collectionName);
15659
16130
  }
@@ -15665,6 +16136,9 @@ var storageFileIdentity = firestoreModelIdentity('storageFile', 'sf');
15665
16136
  * const collection = storageFileFirestoreCollection(firestoreContext);
15666
16137
  * const doc = collection.documentAccessor().newDocument();
15667
16138
  * ```
16139
+ *
16140
+ * @param firestoreContext - the Firestore context to use
16141
+ * @returns a configured StorageFileFirestoreCollection
15668
16142
  */ function storageFileFirestoreCollection(firestoreContext) {
15669
16143
  return firestoreContext.firestoreCollection({
15670
16144
  modelIdentity: storageFileIdentity,
@@ -15757,6 +16231,9 @@ var storageFileIdentity = firestoreModelIdentity('storageFile', 'sf');
15757
16231
  * ```ts
15758
16232
  * const colRef = storageFileGroupCollectionReference(firestoreContext);
15759
16233
  * ```
16234
+ *
16235
+ * @param context - the Firestore context to use
16236
+ * @returns the CollectionReference for StorageFileGroup documents
15760
16237
  */ function storageFileGroupCollectionReference(context) {
15761
16238
  return context.collection(storageFileGroupIdentity.collectionName);
15762
16239
  }
@@ -15768,6 +16245,9 @@ var storageFileIdentity = firestoreModelIdentity('storageFile', 'sf');
15768
16245
  * const collection = storageFileGroupFirestoreCollection(firestoreContext);
15769
16246
  * const doc = collection.documentAccessor().loadDocumentForId(groupId);
15770
16247
  * ```
16248
+ *
16249
+ * @param firestoreContext - the Firestore context to use
16250
+ * @returns a configured StorageFileGroupFirestoreCollection
15771
16251
  */ function storageFileGroupFirestoreCollection(firestoreContext) {
15772
16252
  return firestoreContext.firestoreCollection({
15773
16253
  modelIdentity: storageFileGroupIdentity,
@@ -15963,6 +16443,7 @@ function _ts_generator$2(thisArg, body) {
15963
16443
  * initial state setup.
15964
16444
  *
15965
16445
  * @param config - optional defaults for creation type, subgroup, and processing state
16446
+ * @returns a factory function that creates StorageFile document pairs
15966
16447
  * @throws {Error} When neither accessor nor context is provided
15967
16448
  * @throws {Error} When no storage path can be resolved from the input
15968
16449
  * @throws {Error} When FOR_STORAGE_FILE_GROUP is used without parentStorageFileGroup or purpose
@@ -16060,6 +16541,9 @@ function _ts_generator$2(thisArg, body) {
16060
16541
  * Convenience function for creating a StorageFileDocumentPair.
16061
16542
  *
16062
16543
  * Calls createStorageFileDocumentPairFactory() with no arguments, then passes the input to the factory and returns the result.
16544
+ *
16545
+ * @param input - the creation input specifying the storage path, purpose, and context
16546
+ * @returns a promise resolving to the created StorageFileDocument and StorageFile data
16063
16547
  */ function createStorageFileDocumentPair(input) {
16064
16548
  return _async_to_generator$2(function() {
16065
16549
  return _ts_generator$2(this, function(_state) {
@@ -16106,6 +16590,7 @@ function _unsupported_iterable_to_array$1(o, minLen) {
16106
16590
  *
16107
16591
  * @param storageFileGroupId - the group's document ID
16108
16592
  * @param subPath - optional sub-paths to append
16593
+ * @returns the folder path as a SlashPathFolder string
16109
16594
  *
16110
16595
  * @example
16111
16596
  * ```ts
@@ -16131,6 +16616,9 @@ function _unsupported_iterable_to_array$1(o, minLen) {
16131
16616
  /**
16132
16617
  * Returns the full storage path for a StorageFileGroup's zip file.
16133
16618
  *
16619
+ * @param storageFileGroupId - the group's document ID
16620
+ * @returns the full SlashPath to the group's zip archive
16621
+ *
16134
16622
  * @example
16135
16623
  * ```ts
16136
16624
  * const zipPath = storageFileGroupZipFileStoragePath('abc123');
@@ -16168,6 +16656,8 @@ function _unsupported_iterable_to_array$1(o, minLen) {
16168
16656
  * const constraints = storageFilesQueuedForProcessingQuery();
16169
16657
  * const results = await collection.query(constraints);
16170
16658
  * ```
16659
+ *
16660
+ * @returns Firestore query constraints for StorageFiles queued for processing
16171
16661
  */ function storageFilesQueuedForProcessingQuery() {
16172
16662
  return [
16173
16663
  where('ps', '==', exports.StorageFileProcessingState.QUEUED_FOR_PROCESSING)
@@ -16179,6 +16669,7 @@ function _unsupported_iterable_to_array$1(o, minLen) {
16179
16669
  * Used by the cleanup service to find files ready for permanent deletion.
16180
16670
  *
16181
16671
  * @param now - reference time for comparison; defaults to current time
16672
+ * @returns Firestore query constraints for StorageFiles whose scheduled delete date has passed
16182
16673
  *
16183
16674
  * @example
16184
16675
  * ```ts
@@ -16194,6 +16685,10 @@ function _unsupported_iterable_to_array$1(o, minLen) {
16194
16685
  * with optional subgroup filtering.
16195
16686
  *
16196
16687
  * @example
16688
+ * @param input - the user, purpose, and optional subgroup to filter by
16689
+ * @returns Firestore query constraints for the given purpose and user
16690
+ *
16691
+ * @example
16197
16692
  * ```ts
16198
16693
  * const constraints = storageFilePurposeAndUserQuery({
16199
16694
  * user: 'user123',
@@ -16216,6 +16711,9 @@ function _unsupported_iterable_to_array$1(o, minLen) {
16216
16711
  * Used by the sync service to find files whose group memberships need to be propagated.
16217
16712
  *
16218
16713
  * @example
16714
+ * @returns Firestore query constraints for StorageFiles flagged for group synchronization
16715
+ *
16716
+ * @example
16219
16717
  * ```ts
16220
16718
  * const constraints = storageFileFlaggedForSyncWithGroupsQuery();
16221
16719
  * ```
@@ -16231,6 +16729,9 @@ function _unsupported_iterable_to_array$1(o, minLen) {
16231
16729
  * Used by the initialization service to find newly-created groups that haven't been synced yet.
16232
16730
  *
16233
16731
  * @example
16732
+ * @returns Firestore query constraints for StorageFileGroups needing initialization
16733
+ *
16734
+ * @example
16234
16735
  * ```ts
16235
16736
  * const constraints = storageFileGroupsFlaggedForNeedsInitializationQuery();
16236
16737
  * ```
@@ -16243,6 +16744,9 @@ function _unsupported_iterable_to_array$1(o, minLen) {
16243
16744
  * Returns query constraints for StorageFileGroups flagged for content regeneration (`re == true`).
16244
16745
  *
16245
16746
  * @example
16747
+ * @returns Firestore query constraints for StorageFileGroups flagged for content regeneration
16748
+ *
16749
+ * @example
16246
16750
  * ```ts
16247
16751
  * const constraints = storageFileGroupsFlaggedForContentRegenerationQuery();
16248
16752
  * ```
@@ -16257,6 +16761,9 @@ function _unsupported_iterable_to_array$1(o, minLen) {
16257
16761
  * Invalid groups are typically cleaned up (deleted along with their associated files).
16258
16762
  *
16259
16763
  * @example
16764
+ * @returns Firestore query constraints for StorageFileGroups flagged as invalid
16765
+ *
16766
+ * @example
16260
16767
  * ```ts
16261
16768
  * const constraints = storageFileGroupsFlaggedInvalidQuery();
16262
16769
  * ```
@@ -16279,6 +16786,7 @@ function _unsupported_iterable_to_array$1(o, minLen) {
16279
16786
  * The created task is unique per StorageFile (only one processing task at a time).
16280
16787
  *
16281
16788
  * @param input - the target StorageFileDocument and optional subtask data
16789
+ * @returns a CreateNotificationTaskTemplate for the StorageFile processing task
16282
16790
  *
16283
16791
  * @example
16284
16792
  * ```ts
@@ -16523,6 +17031,7 @@ function _ts_generator$1(thisArg, body) {
16523
17031
  * Use this within a permission service to define role-based access for StorageFile operations.
16524
17032
  *
16525
17033
  * @param config - the permission output, auth context, and target document
17034
+ * @returns a function that accepts role configuration and returns a GrantRolesOtherwiseFunction
16526
17035
  *
16527
17036
  * @example
16528
17037
  * ```ts
@@ -16533,7 +17042,7 @@ function _ts_generator$1(thisArg, body) {
16533
17042
  * });
16534
17043
  * ```
16535
17044
  */ function grantStorageFileRolesForUserAuthFunction(config) {
16536
- var output = config.output, context = config.context; config.model;
17045
+ var output = config.output, context = config.context;
16537
17046
  return function(input) {
16538
17047
  var rolesForStorageFileUser = input.rolesForStorageFileUser, rolesForStorageFileOwnershipKey = input.rolesForStorageFileOwnershipKey;
16539
17048
  var result = function result() {
@@ -16612,6 +17121,8 @@ function _object_spread$1(target) {
16612
17121
  *
16613
17122
  * Should only be used server-side, as `copy` may not be available on the client.
16614
17123
  *
17124
+ * @returns a factory function that wraps FirebaseStorageAccessorFile instances into StoredFileReader accessors
17125
+ *
16615
17126
  * @example
16616
17127
  * ```ts
16617
17128
  * const factory = storedFileReaderFactory();
@@ -16639,7 +17150,8 @@ function _object_spread$1(target) {
16639
17150
  loadFileStream: file.getStream,
16640
17151
  loadFileMetadata: loadFileMetadata,
16641
17152
  loadCustomMetadata: loadCustomMetadata,
16642
- copy: file.copy // copy is always available on the server-side
17153
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- copy is always available on the server-side
17154
+ copy: file.copy
16643
17155
  };
16644
17156
  return accessor;
16645
17157
  };
@@ -16665,6 +17177,7 @@ function _object_spread$1(target) {
16665
17177
  * Creates a {@link UserUploadsFolderSlashPathFactory} that generates per-user upload folder paths.
16666
17178
  *
16667
17179
  * @param inputBasePath - optional custom base path; defaults to {@link ALL_USER_UPLOADS_FOLDER_PATH}
17180
+ * @returns a factory function that generates per-user upload folder slash paths
16668
17181
  *
16669
17182
  * @example
16670
17183
  * ```ts
@@ -16681,6 +17194,11 @@ function _object_spread$1(target) {
16681
17194
  /**
16682
17195
  * Creates a {@link UserUploadsFolderStoragePathFactory} that includes the storage bucket ID.
16683
17196
  *
17197
+ * @param root0 - the configuration object
17198
+ * @param root0.bucketId - the storage bucket ID to include in each generated path
17199
+ * @param root0.basePath - optional custom base path; defaults to {@link ALL_USER_UPLOADS_FOLDER_PATH}
17200
+ * @returns a factory function that generates per-user StoragePath values including the bucket ID
17201
+ *
16684
17202
  * @example
16685
17203
  * ```ts
16686
17204
  * const factory = userUploadsFolderStoragePathFactory({ bucketId: 'my-bucket' });
@@ -16915,6 +17433,7 @@ function _ts_generator(thisArg, body) {
16915
17433
  * (e.g., `image` matches `image.png`, `image-test.jpg`) at {@link HIGH_UPLOADED_FILE_TYPE_DETERMINATION_LEVEL}.
16916
17434
  *
16917
17435
  * @param config - file type, match string, and optional determination levels
17436
+ * @returns an UploadedFileTypeDeterminer that classifies by file name
16918
17437
  *
16919
17438
  * @example
16920
17439
  * ```ts
@@ -16964,6 +17483,7 @@ function _ts_generator(thisArg, body) {
16964
17483
  * exactly equals the configured match string.
16965
17484
  *
16966
17485
  * @param config - file type and folder name to match
17486
+ * @returns an UploadedFileTypeDeterminer that classifies by folder name
16967
17487
  *
16968
17488
  * @example
16969
17489
  * ```ts
@@ -17003,6 +17523,7 @@ function _ts_generator(thisArg, body) {
17003
17523
  * built-in determiners.
17004
17524
  *
17005
17525
  * @param config - file type, path match config, optional bucket/file filters
17526
+ * @returns an UploadedFileTypeDeterminer that classifies by storage path
17006
17527
  *
17007
17528
  * @example
17008
17529
  * ```ts
@@ -17049,6 +17570,7 @@ function _ts_generator(thisArg, body) {
17049
17570
  * If `requireUser` is true, the determination fails when no user can be detected.
17050
17571
  *
17051
17572
  * @param config - root folder, user prefix, and matching options
17573
+ * @returns a wrapper function that adds user detection to any UploadedFileTypeDeterminer
17052
17574
  *
17053
17575
  * @example
17054
17576
  * ```ts
@@ -17060,8 +17582,7 @@ function _ts_generator(thisArg, body) {
17060
17582
  * ```
17061
17583
  */ function determineUserByFolderWrapperFunction(config) {
17062
17584
  var _config_matchSubPath;
17063
- var rootFolder = config.rootFolder, userFolderPrefix = config.userFolderPrefix, _config_requireUser = config.requireUser, requireUser = _config_requireUser === void 0 ? false : _config_requireUser, tmp = config.allowSubPaths, inputAllowSubPaths = tmp === void 0 ? true : tmp;
17064
- var allowSubPaths = inputAllowSubPaths !== null && inputAllowSubPaths !== void 0 ? inputAllowSubPaths : true;
17585
+ var rootFolder = config.rootFolder, userFolderPrefix = config.userFolderPrefix, _config_requireUser = config.requireUser, requireUser = _config_requireUser === void 0 ? false : _config_requireUser, _config_allowSubPaths = config.allowSubPaths, allowSubPaths = _config_allowSubPaths === void 0 ? true : _config_allowSubPaths;
17065
17586
  var subPathMatcherConfig = (_config_matchSubPath = config.matchSubPath) !== null && _config_matchSubPath !== void 0 ? _config_matchSubPath : {
17066
17587
  basePath: util.mergeSlashPaths([
17067
17588
  rootFolder,
@@ -17123,6 +17644,9 @@ function _ts_generator(thisArg, body) {
17123
17644
  /**
17124
17645
  * Convenience wrapper pre-configured for the standard uploads folder structure (`uploads/u/{userId}/...`).
17125
17646
  *
17647
+ * @param config - optional matching options (rootFolder and userFolderPrefix are pre-configured)
17648
+ * @returns a wrapper function that adds user detection for the standard uploads folder structure
17649
+ *
17126
17650
  * @example
17127
17651
  * ```ts
17128
17652
  * const addUser = determineUserByUserUploadsFolderWrapperFunction();
@@ -17149,6 +17673,7 @@ function _ts_generator(thisArg, body) {
17149
17673
  *
17150
17674
  * @param determiner - the determiner to filter
17151
17675
  * @param types - allowed file type identifier(s)
17676
+ * @returns an UploadedFileTypeDeterminer that only returns results for the specified file types
17152
17677
  *
17153
17678
  * @example
17154
17679
  * ```ts
@@ -17192,6 +17717,7 @@ function _ts_generator(thisArg, body) {
17192
17717
  * short-circuited via `completeSearchOnFirstMatch` or `completeSearchAtLevel`.
17193
17718
  *
17194
17719
  * @param config - determiners to combine and optional early-exit settings
17720
+ * @returns a combined UploadedFileTypeDeterminer that returns the highest-confidence match
17195
17721
  *
17196
17722
  * @example
17197
17723
  * ```ts
@@ -17206,9 +17732,9 @@ function _ts_generator(thisArg, body) {
17206
17732
  if (determiners.length === 1) {
17207
17733
  result = determiners[0];
17208
17734
  } else {
17209
- var possibleFileTypes = util.unique(determiners.map(function(d) {
17735
+ var possibleFileTypes = util.unique(determiners.flatMap(function(d) {
17210
17736
  return d.getPossibleFileTypes();
17211
- }).flat());
17737
+ }));
17212
17738
  var completeSearchOnFirstMatch = Boolean(inputCompleteSearchOnFirstMatch);
17213
17739
  var completeSearchAtLevel = completeSearchOnFirstMatch ? LOW_UPLOADED_FILE_TYPE_DETERMINATION_LEVEL : inputCompleteSearchAtLevel !== null && inputCompleteSearchAtLevel !== void 0 ? inputCompleteSearchAtLevel : EXACT_UPLOADED_FILE_TYPE_DETERMINATION_LEVEL;
17214
17740
  result = {
@@ -17308,6 +17834,9 @@ function _ts_generator(thisArg, body) {
17308
17834
  * If a document is provided directly, it is returned as-is. Otherwise, the related model key
17309
17835
  * is converted to a group ID via {@link storageFileGroupIdForModel} and loaded from the accessor.
17310
17836
  *
17837
+ * @param input - reference pair containing either a document or a related model key
17838
+ * @param accessor - document accessor used to load the group document by ID
17839
+ * @returns the resolved StorageFileGroupDocument
17311
17840
  * @throws {Error} When neither storageFileGroupDocument nor storageFileGroupRelatedModelKey is provided
17312
17841
  *
17313
17842
  * @example
@@ -17371,7 +17900,7 @@ function _ts_generator(thisArg, body) {
17371
17900
  ]);
17372
17901
  }
17373
17902
  });
17374
- var re = currentRe || oneOrMoreItemsWereRemoved; // flag removed if any items were removed
17903
+ var re = currentRe !== null && currentRe !== void 0 ? currentRe : oneOrMoreItemsWereRemoved; // flag removed if any items were removed
17375
17904
  // recalculate re if it is false or the retain flag is false
17376
17905
  if (!re || allowRecalculateRegenerateFlag) {
17377
17906
  var flagRegenerate = calculateStorageFileGroupRegeneration({
@@ -17397,6 +17926,7 @@ function _ts_generator(thisArg, body) {
17397
17926
  * - Any embedded file has never been included in the zip (`zat` is unset on the entry)
17398
17927
  *
17399
17928
  * @param input - group state and optional force flag
17929
+ * @returns the regeneration result indicating whether the zip or other derived files need to be regenerated
17400
17930
  *
17401
17931
  * @example
17402
17932
  * ```ts
@@ -17564,6 +18094,9 @@ function _is_native_reflect_construct() {
17564
18094
  * ```ts
17565
18095
  * const colRef = systemStateCollectionReference(firestoreContext);
17566
18096
  * ```
18097
+ *
18098
+ * @param context - the Firestore context to use
18099
+ * @returns the CollectionReference for SystemState documents
17567
18100
  */ function systemStateCollectionReference(context) {
17568
18101
  return context.collection(systemStateIdentity.collectionName);
17569
18102
  }
@@ -17576,6 +18109,7 @@ function _is_native_reflect_construct() {
17576
18109
  *
17577
18110
  * @param firestoreContext - the Firestore context
17578
18111
  * @param converters - map of type identifiers to their data field converters
18112
+ * @returns a configured SystemStateFirestoreCollection with per-type data converters
17579
18113
  *
17580
18114
  * @example
17581
18115
  * ```ts
@@ -17641,13 +18175,16 @@ exports.DEFAULT_UPLOADED_FILE_TYPE_DETERMINATION_LEVEL = DEFAULT_UPLOADED_FILE_T
17641
18175
  exports.DEFAULT_WEBSITE_LINK = DEFAULT_WEBSITE_LINK;
17642
18176
  exports.EMPTY_STORAGE_FILE_PURPOSE_SUBGROUP = EMPTY_STORAGE_FILE_PURPOSE_SUBGROUP;
17643
18177
  exports.EXACT_UPLOADED_FILE_TYPE_DETERMINATION_LEVEL = EXACT_UPLOADED_FILE_TYPE_DETERMINATION_LEVEL;
18178
+ exports.FIREBASE_AUTH_CREDENTIAL_ALREADY_IN_USE_ERROR = FIREBASE_AUTH_CREDENTIAL_ALREADY_IN_USE_ERROR;
17644
18179
  exports.FIREBASE_AUTH_EMAIL_ALREADY_EXISTS_ERROR = FIREBASE_AUTH_EMAIL_ALREADY_EXISTS_ERROR;
18180
+ exports.FIREBASE_AUTH_EMAIL_ALREADY_IN_USE_ERROR = FIREBASE_AUTH_EMAIL_ALREADY_IN_USE_ERROR;
17645
18181
  exports.FIREBASE_AUTH_INVALID_PHONE_NUMBER_ERROR = FIREBASE_AUTH_INVALID_PHONE_NUMBER_ERROR;
17646
18182
  exports.FIREBASE_AUTH_NETWORK_REQUEST_ERROR = FIREBASE_AUTH_NETWORK_REQUEST_ERROR;
17647
18183
  exports.FIREBASE_AUTH_NETWORK_REQUEST_FAILED = FIREBASE_AUTH_NETWORK_REQUEST_FAILED;
17648
18184
  exports.FIREBASE_AUTH_PASSWORD_MAX_LENGTH = FIREBASE_AUTH_PASSWORD_MAX_LENGTH;
17649
18185
  exports.FIREBASE_AUTH_PASSWORD_MIN_LENGTH = FIREBASE_AUTH_PASSWORD_MIN_LENGTH;
17650
18186
  exports.FIREBASE_AUTH_PHONE_NUMBER_ALREADY_EXISTS_ERROR = FIREBASE_AUTH_PHONE_NUMBER_ALREADY_EXISTS_ERROR;
18187
+ exports.FIREBASE_AUTH_PROVIDER_ALREADY_LINKED_ERROR = FIREBASE_AUTH_PROVIDER_ALREADY_LINKED_ERROR;
17651
18188
  exports.FIREBASE_AUTH_USER_NOT_FOUND_ERROR = FIREBASE_AUTH_USER_NOT_FOUND_ERROR;
17652
18189
  exports.FIREBASE_AUTH_WRONG_PASSWORD = FIREBASE_AUTH_WRONG_PASSWORD;
17653
18190
  exports.FIREBASE_DEVELOPMENT_FUNCTIONS_MAP_KEY = FIREBASE_DEVELOPMENT_FUNCTIONS_MAP_KEY;