@dereekb/firebase-server 13.4.1 → 13.4.2

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 (101) hide show
  1. package/index.cjs.js +455 -113
  2. package/index.esm.js +456 -114
  3. package/mailgun/package.json +9 -9
  4. package/model/index.cjs.js +645 -350
  5. package/model/index.esm.js +646 -351
  6. package/model/package.json +9 -9
  7. package/model/src/lib/mailgun/notification.send.service.mailgun.d.ts +1 -0
  8. package/model/src/lib/notification/index.d.ts +2 -2
  9. package/model/src/lib/notification/{notification.action.service.d.ts → notification.action.server.d.ts} +53 -1
  10. package/model/src/lib/notification/{notification.action.init.service.d.ts → notification.action.server.init.d.ts} +20 -0
  11. package/model/src/lib/notification/notification.config.service.d.ts +2 -0
  12. package/model/src/lib/notification/notification.create.run.d.ts +1 -0
  13. package/model/src/lib/notification/notification.error.d.ts +16 -0
  14. package/model/src/lib/notification/notification.expedite.service.d.ts +11 -3
  15. package/model/src/lib/notification/notification.module.d.ts +19 -6
  16. package/model/src/lib/notification/notification.send.service.notificationsummary.d.ts +1 -0
  17. package/model/src/lib/notification/notification.send.service.text.d.ts +2 -0
  18. package/model/src/lib/notification/notification.task.service.handler.d.ts +1 -0
  19. package/model/src/lib/notification/notification.task.service.util.d.ts +1 -0
  20. package/model/src/lib/notification/notification.task.subtask.handler.d.ts +3 -0
  21. package/model/src/lib/notification/notification.util.d.ts +4 -2
  22. package/model/src/lib/storagefile/index.d.ts +1 -1
  23. package/model/src/lib/storagefile/storagefile.action.server.d.ts +98 -1
  24. package/model/src/lib/storagefile/{storagefile.action.init.service.d.ts → storagefile.action.server.init.d.ts} +13 -2
  25. package/model/src/lib/storagefile/storagefile.error.d.ts +27 -0
  26. package/model/src/lib/storagefile/storagefile.module.d.ts +14 -4
  27. package/model/src/lib/storagefile/storagefile.task.service.handler.d.ts +29 -7
  28. package/model/src/lib/storagefile/storagefile.upload.service.initializer.d.ts +2 -0
  29. package/oidc/index.cjs.js +150 -32
  30. package/oidc/index.esm.js +150 -32
  31. package/oidc/package.json +10 -10
  32. package/oidc/src/lib/controller/oidc.interaction.controller.d.ts +12 -0
  33. package/oidc/src/lib/controller/oidc.wellknown.controller.d.ts +6 -0
  34. package/oidc/src/lib/model/jwks/jwks.d.ts +9 -0
  35. package/oidc/src/lib/model/jwks/jwks.query.d.ts +9 -0
  36. package/oidc/src/lib/model/oidc/oidcmodel.action.server.d.ts +13 -0
  37. package/oidc/src/lib/model/oidc/oidcmodel.module.d.ts +5 -1
  38. package/oidc/src/lib/oidc.config.d.ts +2 -1
  39. package/oidc/src/lib/oidc.module.d.ts +9 -2
  40. package/oidc/src/lib/service/oidc.account.service.d.ts +7 -0
  41. package/oidc/src/lib/service/oidc.adapter.service.d.ts +1 -0
  42. package/oidc/src/lib/service/oidc.config.service.d.ts +1 -0
  43. package/oidc/src/lib/service/oidc.encryption.service.d.ts +6 -0
  44. package/oidc/src/lib/service/oidc.interaction.service.d.ts +15 -0
  45. package/oidc/src/lib/service/oidc.jwks.service.d.ts +18 -2
  46. package/oidc/src/lib/service/oidc.service.d.ts +7 -3
  47. package/package.json +10 -10
  48. package/src/lib/auth/auth.context.d.ts +1 -0
  49. package/src/lib/auth/auth.service.d.ts +13 -0
  50. package/src/lib/env/env.config.d.ts +2 -0
  51. package/src/lib/env/env.service.d.ts +21 -7
  52. package/src/lib/firestore/array.d.ts +1 -0
  53. package/src/lib/firestore/driver.accessor.batch.d.ts +4 -0
  54. package/src/lib/firestore/driver.accessor.d.ts +4 -0
  55. package/src/lib/firestore/driver.accessor.default.d.ts +5 -1
  56. package/src/lib/firestore/driver.accessor.transaction.d.ts +4 -0
  57. package/src/lib/firestore/driver.d.ts +2 -0
  58. package/src/lib/firestore/driver.query.d.ts +4 -0
  59. package/src/lib/firestore/increment.d.ts +1 -0
  60. package/src/lib/function/assert.d.ts +7 -0
  61. package/src/lib/function/context.d.ts +4 -0
  62. package/src/lib/function/error.auth.d.ts +2 -0
  63. package/src/lib/function/error.d.ts +86 -11
  64. package/src/lib/index.d.ts +0 -1
  65. package/src/lib/nest/analytics/analytics.service.listener.d.ts +2 -0
  66. package/src/lib/nest/app.d.ts +6 -3
  67. package/src/lib/nest/auth/auth.module.d.ts +6 -0
  68. package/src/lib/nest/auth/auth.util.d.ts +19 -1
  69. package/src/lib/nest/development/development.app.function.d.ts +12 -4
  70. package/src/lib/nest/development/development.assert.function.d.ts +6 -2
  71. package/src/lib/nest/development/development.function.d.ts +6 -1
  72. package/src/lib/nest/development/development.schedule.function.d.ts +3 -1
  73. package/src/lib/nest/development/development.schedule.function.error.d.ts +8 -0
  74. package/src/lib/nest/env/env.service.d.ts +2 -0
  75. package/src/lib/nest/env/env.util.d.ts +6 -0
  76. package/src/lib/nest/firebase/firebase.module.d.ts +1 -0
  77. package/src/lib/nest/firestore/firestore.module.d.ts +8 -0
  78. package/src/lib/nest/function/context.d.ts +2 -0
  79. package/src/lib/nest/model/analytics.details.d.ts +21 -7
  80. package/src/lib/nest/model/analytics.emit.d.ts +3 -0
  81. package/src/lib/nest/model/analytics.handler.d.ts +30 -10
  82. package/src/lib/nest/model/api.details.d.ts +34 -1
  83. package/src/lib/nest/model/call.model.function.d.ts +20 -4
  84. package/src/lib/nest/model/create.model.function.d.ts +6 -1
  85. package/src/lib/nest/model/crud.assert.function.d.ts +12 -4
  86. package/src/lib/nest/model/delete.model.function.d.ts +6 -1
  87. package/src/lib/nest/model/permission.error.d.ts +7 -0
  88. package/src/lib/nest/model/read.model.function.d.ts +6 -1
  89. package/src/lib/nest/model/specifier.function.d.ts +3 -0
  90. package/src/lib/nest/model/update.model.function.d.ts +6 -1
  91. package/src/lib/nest/nest.provider.d.ts +10 -0
  92. package/src/lib/nest/storage/storage.module.d.ts +9 -0
  93. package/src/lib/storage/driver.accessor.d.ts +22 -0
  94. package/src/lib/storage/driver.d.ts +2 -0
  95. package/src/lib/storage/storage.d.ts +1 -0
  96. package/test/package.json +10 -10
  97. package/zoho/index.cjs.js +8 -6
  98. package/zoho/index.esm.js +8 -6
  99. package/zoho/package.json +9 -9
  100. package/zoho/src/lib/zoho.accounts.firebase.d.ts +2 -1
  101. package/zoho/src/lib/zoho.accounts.firebase.system.d.ts +2 -1
@@ -193,6 +193,7 @@ var MAILGUN_NOTIFICATION_EMAIL_SEND_SERVICE_DEFAULT_MAX_BATCH_SIZE_PER_REQUEST =
193
193
  * and dispatches them through the Mailgun API.
194
194
  *
195
195
  * @param config - service configuration including the Mailgun service, template builders, and batch size
196
+ * @returns a {@link NotificationEmailSendService} that batches and sends emails through Mailgun
196
197
  *
197
198
  * @example
198
199
  * ```ts
@@ -247,6 +248,7 @@ var MAILGUN_NOTIFICATION_EMAIL_SEND_SERVICE_DEFAULT_MAX_BATCH_SIZE_PER_REQUEST =
247
248
  var sendTemplateNameToLowercase, builderForKey, input;
248
249
  return _ts_generator$f(this, function(_state) {
249
250
  sendTemplateNameToLowercase = sendTemplateName.toLowerCase();
251
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
250
252
  builderForKey = lowercaseKeysMessageBuilders[sendTemplateNameToLowercase];
251
253
  if (!builderForKey) {
252
254
  throw new Error('mailgunNotificationEmailSendService(): A template builder was not available for template type "'.concat(sendTemplateName, '".'));
@@ -325,6 +327,8 @@ var MAILGUN_NOTIFICATION_EMAIL_SEND_SERVICE_DEFAULT_MAX_BATCH_SIZE_PER_REQUEST =
325
327
  * Creates an error indicating that a required notification ID was missing during creation.
326
328
  *
327
329
  * Thrown when attempting to create a {@link Notification} document without providing the mandatory ID field.
330
+ *
331
+ * @returns a precondition conflict error with the notification ID required error code
328
332
  */ function createNotificationIdRequiredError() {
329
333
  return firebaseServer.preconditionConflictError({
330
334
  message: "The required id was not present when attempting to create a Notification.",
@@ -336,6 +340,8 @@ var MAILGUN_NOTIFICATION_EMAIL_SEND_SERVICE_DEFAULT_MAX_BATCH_SIZE_PER_REQUEST =
336
340
  *
337
341
  * Thrown during initialization when `throwErrorIfAlreadyInitialized` is true and the model's
338
342
  * setup flag (`s`) indicates it was previously initialized.
343
+ *
344
+ * @returns a precondition conflict error with the already-initialized error code
339
345
  */ function notificationModelAlreadyInitializedError() {
340
346
  return firebaseServer.preconditionConflictError({
341
347
  message: "This model has already been initialized.",
@@ -348,6 +354,7 @@ var MAILGUN_NOTIFICATION_EMAIL_SEND_SERVICE_DEFAULT_MAX_BATCH_SIZE_PER_REQUEST =
348
354
  * Thrown when the model key's collection name does not match any registered notification model type.
349
355
  *
350
356
  * @param key - the Firestore model key that has no registered notification model type
357
+ * @returns a precondition conflict error with the unregistered model type error code
351
358
  */ function notificationBoxUnregistredModelTypeInitializationError(key) {
352
359
  return firebaseServer.preconditionConflictError({
353
360
  message: "This NotificationBox is associated with an unregistered model type.",
@@ -361,6 +368,8 @@ var MAILGUN_NOTIFICATION_EMAIL_SEND_SERVICE_DEFAULT_MAX_BATCH_SIZE_PER_REQUEST =
361
368
  * Creates an error indicating that no {@link NotificationBox} exists for the target model.
362
369
  *
363
370
  * Thrown when an operation requires a NotificationBox but none has been created for the given model key.
371
+ *
372
+ * @returns a precondition conflict error with the box-not-found error code
364
373
  */ function notificationBoxDoesNotExist() {
365
374
  return firebaseServer.preconditionConflictError({
366
375
  message: "A NotificationBox does not exist for this model.",
@@ -372,6 +381,8 @@ var MAILGUN_NOTIFICATION_EMAIL_SEND_SERVICE_DEFAULT_MAX_BATCH_SIZE_PER_REQUEST =
372
381
  *
373
382
  * Thrown when the target recipient on the {@link NotificationBox} does not exist on the box
374
383
  * or does not have a UID, making it ineligible for exclusion.
384
+ *
385
+ * @returns a precondition conflict error with the invalid exclusion target error code
375
386
  */ function notificationBoxExclusionTargetInvalidError() {
376
387
  return firebaseServer.preconditionConflictError({
377
388
  message: "The target for exclusion is invalid. The target recipient on the NotificationBox must be exist on the NotificationBox and have a uid to be excluded.",
@@ -382,6 +393,8 @@ var MAILGUN_NOTIFICATION_EMAIL_SEND_SERVICE_DEFAULT_MAX_BATCH_SIZE_PER_REQUEST =
382
393
  * Creates an error indicating that a {@link NotificationBox} already exists for this model.
383
394
  *
384
395
  * Thrown when attempting to create a duplicate NotificationBox for a model that already has one.
396
+ *
397
+ * @returns a precondition conflict error with the box-exists error code
385
398
  */ function notificationBoxExistsForModelError() {
386
399
  return firebaseServer.preconditionConflictError({
387
400
  message: "A NotificationBox already exists for this model.",
@@ -393,6 +406,8 @@ var MAILGUN_NOTIFICATION_EMAIL_SEND_SERVICE_DEFAULT_MAX_BATCH_SIZE_PER_REQUEST =
393
406
  *
394
407
  * Thrown when attempting to update a recipient that is not registered on the box
395
408
  * and `insert=true` was not passed to allow creating a new recipient entry.
409
+ *
410
+ * @returns a precondition conflict error with the recipient-not-found error code
396
411
  */ function notificationBoxRecipientDoesNotExistsError() {
397
412
  return firebaseServer.preconditionConflictError({
398
413
  message: "An existing NotificationBox recipient for the target does not exist. You must pass insert=true to create a new recipient.",
@@ -405,6 +420,7 @@ var MAILGUN_NOTIFICATION_EMAIL_SEND_SERVICE_DEFAULT_MAX_BATCH_SIZE_PER_REQUEST =
405
420
  * Thrown during {@link NotificationUser} creation when the provided UID cannot be found in Firebase Auth.
406
421
  *
407
422
  * @param uid - the Firebase Auth user ID that was not found
423
+ * @returns a precondition conflict error with the invalid-uid error code
408
424
  */ function notificationUserInvalidUidForCreateError(uid) {
409
425
  return firebaseServer.preconditionConflictError({
410
426
  message: "The user with the uid '".concat(uid, "' does not exist. Cannot create a NotificationUser for them."),
@@ -421,6 +437,7 @@ var MAILGUN_NOTIFICATION_EMAIL_SEND_SERVICE_DEFAULT_MAX_BATCH_SIZE_PER_REQUEST =
421
437
  * and an operation attempts to insert them into a {@link NotificationBox}'s recipient list.
422
438
  *
423
439
  * @param uid - the Firebase Auth user ID of the blocked user
440
+ * @returns a precondition conflict error with the blocked-from-add error code
424
441
  */ function notificationUserBlockedFromBeingAddedToRecipientsError(uid) {
425
442
  return firebaseServer.preconditionConflictError({
426
443
  message: "The user with the uid '".concat(uid, "' has blocked themselves from from being added recipients."),
@@ -437,6 +454,7 @@ var MAILGUN_NOTIFICATION_EMAIL_SEND_SERVICE_DEFAULT_MAX_BATCH_SIZE_PER_REQUEST =
437
454
  * and an operation attempts to modify their recipient settings on a {@link NotificationBox}.
438
455
  *
439
456
  * @param uid - the Firebase Auth user ID of the locked user
457
+ * @returns a precondition conflict error with the locked-config error code
440
458
  */ function notificationUserLockedConfigFromBeingUpdatedError(uid) {
441
459
  return firebaseServer.preconditionConflictError({
442
460
  message: "The user with the uid '".concat(uid, "' has locked their config from being updated."),
@@ -452,7 +470,7 @@ function _array_like_to_array$7(arr, len) {
452
470
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
453
471
  return arr2;
454
472
  }
455
- function _array_without_holes$5(arr) {
473
+ function _array_without_holes$6(arr) {
456
474
  if (Array.isArray(arr)) return _array_like_to_array$7(arr);
457
475
  }
458
476
  function asyncGeneratorStep$e(gen, resolve, reject, _next, _throw, key, arg) {
@@ -497,10 +515,10 @@ function _define_property$d(obj, key, value) {
497
515
  }
498
516
  return obj;
499
517
  }
500
- function _iterable_to_array$5(iter) {
518
+ function _iterable_to_array$6(iter) {
501
519
  if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
502
520
  }
503
- function _non_iterable_spread$5() {
521
+ function _non_iterable_spread$6() {
504
522
  throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
505
523
  }
506
524
  function _object_spread$c(target) {
@@ -537,8 +555,8 @@ function _object_spread_props$b(target, source) {
537
555
  }
538
556
  return target;
539
557
  }
540
- function _to_consumable_array$5(arr) {
541
- return _array_without_holes$5(arr) || _iterable_to_array$5(arr) || _unsupported_iterable_to_array$7(arr) || _non_iterable_spread$5();
558
+ function _to_consumable_array$6(arr) {
559
+ return _array_without_holes$6(arr) || _iterable_to_array$6(arr) || _unsupported_iterable_to_array$7(arr) || _non_iterable_spread$6();
542
560
  }
543
561
  function _unsupported_iterable_to_array$7(o, minLen) {
544
562
  if (!o) return;
@@ -655,6 +673,7 @@ function _ts_generator$e(thisArg, body) {
655
673
  * and initializes with an empty notifications array.
656
674
  *
657
675
  * @param model - the model key to associate the summary with
676
+ * @returns a blank {@link NotificationSummary} with creation timestamp and empty notifications
658
677
  *
659
678
  * @example
660
679
  * ```ts
@@ -677,8 +696,8 @@ function _ts_generator$e(thisArg, body) {
677
696
  *
678
697
  * Recipients are each configurable and may be defined with as little info as a single contact info, or have multiple contact info pieces associated with them.
679
698
  *
680
- * @param input
681
- * @returns
699
+ * @param input - the notification, box, auth service, and recipient configuration
700
+ * @returns channel-specific recipient lists (email, text, notification summary) ready for delivery
682
701
  */ function expandNotificationRecipients(input) {
683
702
  return _async_to_generator$e(function() {
684
703
  var _ref, notificationUserAccessor, authService, notification, notificationBox, inputGlobalRecipients, recipientFlagOverride, inputNotificationSummaryIdForUid, inputOnlySendToExplicitlyEnabledRecipients, inputOnlyTextExplicitlyEnabledRecipients, notificationBoxId, notificationSummaryIdForUid, notificationTemplateType, recipientFlag, onlyTextExplicitlyEnabledRecipients, onlySendToExplicitlyEnabledRecipients, onlyEmailExplicitlyEnabledRecipients, onlySendNotificationSummaryExplicitlyEnabledRecipients, _allowedNotificationRecipients, canSendToGlobalRecipients, canSendToBoxRecipients, canSendToExplicitRecipients, initialExplicitRecipients, initialGlobalRecipients, explicitRecipients, globalRecipients, explicitAndGlobalRecipients, allBoxRecipientConfigs, recipientUids, relevantBoxRecipientConfigs, nonNotificationBoxUidRecipientConfigs, otherNotificationUserUidOptOuts, otherNotificationUserUidSendExclusions, notificationUserRecipientConfigs, nonNotificationBoxRecipientUids, notificationUserDocuments, notificationUsers, otherRecipientConfigs, explicitOtherRecipientEmailAddresses, explicitOtherRecipientTextNumbers, explicitOtherRecipientNotificationSummaryIds, allUserDetails, userDetailsMap, _internal, emails, emailUidsSet, texts, textUidsSet, notificationSummaries, notificationSummaryKeysSet, notificationSummaryUidsSet, result;
@@ -704,6 +723,7 @@ function _ts_generator$e(thisArg, body) {
704
723
  onlyTextExplicitlyEnabledRecipients = inputOnlyTextExplicitlyEnabledRecipients !== false; // defaults to true
705
724
  onlySendToExplicitlyEnabledRecipients = inputOnlySendToExplicitlyEnabledRecipients === true; // defaults to false
706
725
  onlyEmailExplicitlyEnabledRecipients = onlySendToExplicitlyEnabledRecipients;
726
+ // const onlySendPushNotificationExplicitlyEnabledRecipients = onlySendToExplicitlyEnabledRecipients;
707
727
  onlySendNotificationSummaryExplicitlyEnabledRecipients = onlySendToExplicitlyEnabledRecipients;
708
728
  _allowedNotificationRecipients = firebase.allowedNotificationRecipients(recipientFlag), canSendToGlobalRecipients = _allowedNotificationRecipients.canSendToGlobalRecipients, canSendToBoxRecipients = _allowedNotificationRecipients.canSendToBoxRecipients, canSendToExplicitRecipients = _allowedNotificationRecipients.canSendToExplicitRecipients;
709
729
  initialExplicitRecipients = canSendToExplicitRecipients ? notification.r : [];
@@ -714,7 +734,7 @@ function _ts_generator$e(thisArg, body) {
714
734
  globalRecipients = initialGlobalRecipients.map(function(x) {
715
735
  return _object_spread$c({}, x, firebase.effectiveNotificationBoxRecipientTemplateConfig(x));
716
736
  });
717
- explicitAndGlobalRecipients = _to_consumable_array$5(explicitRecipients).concat(_to_consumable_array$5(globalRecipients));
737
+ explicitAndGlobalRecipients = _to_consumable_array$6(explicitRecipients).concat(_to_consumable_array$6(globalRecipients));
718
738
  allBoxRecipientConfigs = canSendToBoxRecipients && notificationBox ? notificationBox.r : [];
719
739
  recipientUids = new Set();
720
740
  relevantBoxRecipientConfigs = [];
@@ -751,7 +771,7 @@ function _ts_generator$e(thisArg, body) {
751
771
  3,
752
772
  2
753
773
  ];
754
- nonNotificationBoxRecipientUids = Array.from(nonNotificationBoxUidRecipientConfigs.keys());
774
+ nonNotificationBoxRecipientUids = _to_consumable_array$6(nonNotificationBoxUidRecipientConfigs.keys());
755
775
  notificationUserDocuments = firebase.loadDocumentsForIds(notificationUserAccessor, nonNotificationBoxRecipientUids);
756
776
  return [
757
777
  4,
@@ -815,7 +835,7 @@ function _ts_generator$e(thisArg, body) {
815
835
  });
816
836
  return [
817
837
  4,
818
- Promise.all(Array.from(recipientUids).map(function(uid) {
838
+ Promise.all(_to_consumable_array$6(recipientUids).map(function(uid) {
819
839
  return authService.userContext(uid).loadDetails().then(function(details) {
820
840
  return [
821
841
  uid,
@@ -1027,17 +1047,15 @@ function _ts_generator$e(thisArg, body) {
1027
1047
  } else if (x.s) {
1028
1048
  notificationSummaryId = x.s;
1029
1049
  }
1030
- if (notificationSummaryId) {
1031
- if (!notificationSummaryKeysSet.has(notificationSummaryId)) {
1032
- var name = displayName || x.n;
1033
- var notificationSummary = {
1034
- notificationSummaryId: notificationSummaryId,
1035
- otherRecipient: x,
1036
- name: name
1037
- };
1038
- notificationSummaries.push(notificationSummary);
1039
- explicitOtherRecipientNotificationSummaryIds.delete(notificationSummaryId);
1040
- }
1050
+ if (notificationSummaryId && !notificationSummaryKeysSet.has(notificationSummaryId)) {
1051
+ var name = displayName || x.n;
1052
+ var notificationSummary = {
1053
+ notificationSummaryId: notificationSummaryId,
1054
+ otherRecipient: x,
1055
+ name: name
1056
+ };
1057
+ notificationSummaries.push(notificationSummary);
1058
+ explicitOtherRecipientNotificationSummaryIds.delete(notificationSummaryId);
1041
1059
  }
1042
1060
  }
1043
1061
  }
@@ -1082,6 +1100,7 @@ function _ts_generator$e(thisArg, body) {
1082
1100
  * Also re-applies send exclusions to the updated config array.
1083
1101
  *
1084
1102
  * @param input - the current state and intended change
1103
+ * @returns the updated box config array and notification box recipient, if changes occurred
1085
1104
  * @throws notificationUserBlockedFromBeingAddedToRecipientsError when inserting a blocked user
1086
1105
  * @throws notificationUserLockedConfigFromBeingUpdatedError when updating a locked user's config
1087
1106
  */ function updateNotificationUserNotificationBoxRecipientConfig(input) {
@@ -1101,7 +1120,7 @@ function _ts_generator$e(thisArg, body) {
1101
1120
  // flag as removed in the NotificationUser details if not already flagged as such
1102
1121
  if (currentNotificationUserBoxIndexExists && currentNotificationUserBoxConfig.rm !== true) {
1103
1122
  var _currentNotificationUserBoxConfig_c;
1104
- updatedBc = _to_consumable_array$5(notificationUser.bc);
1123
+ updatedBc = _to_consumable_array$6(notificationUser.bc);
1105
1124
  updatedBc[currentNotificationUserBoxIndex] = _object_spread_props$b(_object_spread$c({}, currentNotificationUserBoxConfig), {
1106
1125
  nb: notificationBoxId,
1107
1126
  c: (_currentNotificationUserBoxConfig_c = currentNotificationUserBoxConfig.c) !== null && _currentNotificationUserBoxConfig_c !== void 0 ? _currentNotificationUserBoxConfig_c : {},
@@ -1147,7 +1166,7 @@ function _ts_generator$e(thisArg, body) {
1147
1166
  nb: notificationBoxId,
1148
1167
  rm: false // remove/clear the removed flag
1149
1168
  }), updateWithNotificationBoxRecipient);
1150
- updatedBc = _to_consumable_array$5(notificationUser.bc);
1169
+ updatedBc = _to_consumable_array$6(notificationUser.bc);
1151
1170
  if (currentNotificationUserBoxIndexExists) {
1152
1171
  updatedBc[currentNotificationUserBoxIndex] = updatedNotificationUserBoxEntry;
1153
1172
  } else {
@@ -1179,6 +1198,7 @@ function _ts_generator$e(thisArg, body) {
1179
1198
  *
1180
1199
  * @param inputCompletions - the current list of completed checkpoint strings
1181
1200
  * @param handleTaskResult - the handler result containing removal instructions
1201
+ * @returns the filtered completions array with specified checkpoints removed
1182
1202
  *
1183
1203
  * @example
1184
1204
  * ```ts
@@ -1188,7 +1208,8 @@ function _ts_generator$e(thisArg, body) {
1188
1208
  * );
1189
1209
  * // remaining === ['validate', 'cleanup']
1190
1210
  * ```
1191
- */ function removeFromCompletionsArrayWithTaskResult(inputCompletions, handleTaskResult) {
1211
+ */ // eslint-disable-next-line @typescript-eslint/no-explicit-any
1212
+ function removeFromCompletionsArrayWithTaskResult(inputCompletions, handleTaskResult) {
1192
1213
  var removeAllCompletedCheckpoints = handleTaskResult.removeAllCompletedCheckpoints, removeFromCompletedCheckpoints = handleTaskResult.removeFromCompletedCheckpoints;
1193
1214
  var result;
1194
1215
  if (removeAllCompletedCheckpoints) {
@@ -1212,7 +1233,7 @@ function _array_like_to_array$6(arr, len) {
1212
1233
  function _array_with_holes$2(arr) {
1213
1234
  if (Array.isArray(arr)) return arr;
1214
1235
  }
1215
- function _array_without_holes$4(arr) {
1236
+ function _array_without_holes$5(arr) {
1216
1237
  if (Array.isArray(arr)) return _array_like_to_array$6(arr);
1217
1238
  }
1218
1239
  function asyncGeneratorStep$d(gen, resolve, reject, _next, _throw, key, arg) {
@@ -1262,7 +1283,7 @@ function _define_property$c(obj, key, value) {
1262
1283
  }
1263
1284
  return obj;
1264
1285
  }
1265
- function _iterable_to_array$4(iter) {
1286
+ function _iterable_to_array$5(iter) {
1266
1287
  if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
1267
1288
  }
1268
1289
  function _iterable_to_array_limit$2(arr, i) {
@@ -1292,7 +1313,7 @@ function _iterable_to_array_limit$2(arr, i) {
1292
1313
  function _non_iterable_rest$2() {
1293
1314
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
1294
1315
  }
1295
- function _non_iterable_spread$4() {
1316
+ function _non_iterable_spread$5() {
1296
1317
  throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
1297
1318
  }
1298
1319
  function _object_spread$b(target) {
@@ -1332,8 +1353,8 @@ function _object_spread_props$a(target, source) {
1332
1353
  function _sliced_to_array$2(arr, i) {
1333
1354
  return _array_with_holes$2(arr) || _iterable_to_array_limit$2(arr, i) || _unsupported_iterable_to_array$6(arr, i) || _non_iterable_rest$2();
1334
1355
  }
1335
- function _to_consumable_array$4(arr) {
1336
- return _array_without_holes$4(arr) || _iterable_to_array$4(arr) || _unsupported_iterable_to_array$6(arr) || _non_iterable_spread$4();
1356
+ function _to_consumable_array$5(arr) {
1357
+ return _array_without_holes$5(arr) || _iterable_to_array$5(arr) || _unsupported_iterable_to_array$6(arr) || _non_iterable_spread$5();
1337
1358
  }
1338
1359
  function _unsupported_iterable_to_array$6(o, minLen) {
1339
1360
  if (!o) return;
@@ -1474,6 +1495,7 @@ function _ts_generator$d(thisArg, body) {
1474
1495
  * to its factory function using the provided context.
1475
1496
  *
1476
1497
  * @param context - the fully assembled notification server actions context
1498
+ * @returns a fully wired {@link NotificationServerActions} instance
1477
1499
  *
1478
1500
  * @example
1479
1501
  * ```ts
@@ -1503,6 +1525,9 @@ function _ts_generator$d(thisArg, body) {
1503
1525
  *
1504
1526
  * Validates the UID exists in Firebase Auth, then creates a new {@link NotificationUser} document
1505
1527
  * with empty default and global configs. Throws if the UID is not found in Auth.
1528
+ *
1529
+ * @param context - the notification server actions context with auth and collection access
1530
+ * @returns a transform-and-validate function that creates a new notification user document
1506
1531
  */ function createNotificationUserFactory(context) {
1507
1532
  var firebaseServerActionTransformFunctionFactory = context.firebaseServerActionTransformFunctionFactory, notificationUserCollection = context.notificationUserCollection, authService = context.authService;
1508
1533
  return firebaseServerActionTransformFunctionFactory(firebase.createNotificationUserParamsType, function(params) {
@@ -1567,6 +1592,9 @@ function _ts_generator$d(thisArg, body) {
1567
1592
  * Updates a {@link NotificationUser}'s default config (`dc`), global config (`gc`), and/or
1568
1593
  * box configs (`bc`). When the global config changes, iterates all box configs to propagate
1569
1594
  * effective recipient changes and marks affected entries for sync.
1595
+ *
1596
+ * @param context - the notification server actions context with Firestore and collection access
1597
+ * @returns a transform-and-validate function that updates an existing notification user document
1570
1598
  */ function updateNotificationUserFactory(context) {
1571
1599
  var firestoreContext = context.firestoreContext, firebaseServerActionTransformFunctionFactory = context.firebaseServerActionTransformFunctionFactory, notificationUserCollection = context.notificationUserCollection, appNotificationTemplateTypeInfoRecordService = context.appNotificationTemplateTypeInfoRecordService;
1572
1600
  return firebaseServerActionTransformFunctionFactory(firebase.updateNotificationUserParamsType, function(params) {
@@ -1686,6 +1714,9 @@ var MAX_NOTIFICATION_BOXES_TO_UPDATE_PER_BATCH = 50;
1686
1714
  * entries flagged with `ns=true` (needs-sync), loading the corresponding {@link NotificationBox},
1687
1715
  * and merging the user's preferences back into the box's recipient list. Handles removed entries
1688
1716
  * and cleans up stale box references.
1717
+ *
1718
+ * @param context - the notification server actions context with Firestore and collection access
1719
+ * @returns a transform-and-validate function that resyncs a notification user's box configurations
1689
1720
  */ function resyncNotificationUserFactory(context) {
1690
1721
  var firestoreContext = context.firestoreContext, firebaseServerActionTransformFunctionFactory = context.firebaseServerActionTransformFunctionFactory, notificationBoxCollection = context.notificationBoxCollection, notificationUserCollection = context.notificationUserCollection, appNotificationTemplateTypeInfoRecordService = context.appNotificationTemplateTypeInfoRecordService;
1691
1722
  return firebaseServerActionTransformFunctionFactory(firebase.resyncNotificationUserParamsType, function() {
@@ -1739,7 +1770,7 @@ var MAX_NOTIFICATION_BOXES_TO_UPDATE_PER_BATCH = 50;
1739
1770
  notificationBoxConfigsToSyncInThisBatchMap = util.makeModelMap(notificationBoxConfigsToSyncInThisBatch, function(x) {
1740
1771
  return x.nb;
1741
1772
  });
1742
- notificationBoxIdsToSyncInThisBatch = Array.from(notificationBoxConfigsToSyncInThisBatchMap.keys());
1773
+ notificationBoxIdsToSyncInThisBatch = _to_consumable_array$5(notificationBoxConfigsToSyncInThisBatchMap.keys());
1743
1774
  notificationBoxDocuments = firebase.loadDocumentsForIds(notificationBoxCollection.documentAccessorForTransaction(transaction), notificationBoxIdsToSyncInThisBatch);
1744
1775
  return [
1745
1776
  4,
@@ -1797,7 +1828,7 @@ var MAX_NOTIFICATION_BOXES_TO_UPDATE_PER_BATCH = 50;
1797
1828
  recipientHasChange = !util.areEqualPOJOValues(nextRecipient, recipient);
1798
1829
  // only update recipients if the next/new recipient is not equal to the existing one
1799
1830
  if (recipientHasChange) {
1800
- r = _to_consumable_array$4(notificationBox.r);
1831
+ r = _to_consumable_array$5(notificationBox.r);
1801
1832
  r[recipientIndex] = nextRecipient;
1802
1833
  nextRecipientsMap.set(nb, nextRecipient);
1803
1834
  } else {
@@ -1847,13 +1878,12 @@ var MAX_NOTIFICATION_BOXES_TO_UPDATE_PER_BATCH = 50;
1847
1878
  i: util.UNSET_INDEX_NUMBER
1848
1879
  });
1849
1880
  } else {
1850
- var _updatedRecipient_i;
1851
1881
  // else, use the updated recipient and keep/copy the
1852
1882
  var updatedRecipient = nextRecipientsMap.get(nb);
1853
1883
  nextConfig = _object_spread_props$a(_object_spread$b({}, existingConfig), {
1854
1884
  nb: nb,
1855
1885
  rm: false,
1856
- i: (_updatedRecipient_i = updatedRecipient.i) !== null && _updatedRecipient_i !== void 0 ? _updatedRecipient_i : util.UNSET_INDEX_NUMBER
1886
+ i: updatedRecipient.i
1857
1887
  });
1858
1888
  }
1859
1889
  }
@@ -1921,6 +1951,9 @@ var MAX_NOTIFICATION_BOXES_TO_UPDATE_PER_BATCH = 50;
1921
1951
  * Batch-processes all {@link NotificationUser} documents flagged for sync by querying
1922
1952
  * for entries with `ns=true`, then calling the resync logic for each in parallel
1923
1953
  * (up to 5 concurrent tasks). Loops until no more flagged users are found.
1954
+ *
1955
+ * @param context - the notification server actions context with collection access
1956
+ * @returns an async function that resyncs all flagged notification users and returns aggregate results
1924
1957
  */ function resyncAllNotificationUsersFactory(context) {
1925
1958
  var notificationUserCollection = context.notificationUserCollection;
1926
1959
  var resyncNotificationUser = resyncNotificationUserFactory(context);
@@ -2006,6 +2039,9 @@ var MAX_NOTIFICATION_BOXES_TO_UPDATE_PER_BATCH = 50;
2006
2039
  *
2007
2040
  * Creates a new {@link NotificationSummary} document for a model, generating the summary ID
2008
2041
  * from the model key and initializing it with a blank template.
2042
+ *
2043
+ * @param context - the notification server actions context with collection access
2044
+ * @returns a transform-and-validate function that creates a new notification summary document
2009
2045
  */ function createNotificationSummaryFactory(context) {
2010
2046
  var firebaseServerActionTransformFunctionFactory = context.firebaseServerActionTransformFunctionFactory, notificationSummaryCollection = context.notificationSummaryCollection;
2011
2047
  return firebaseServerActionTransformFunctionFactory(firebase.createNotificationSummaryParamsType, function(params) {
@@ -2048,6 +2084,9 @@ var MAX_NOTIFICATION_BOXES_TO_UPDATE_PER_BATCH = 50;
2048
2084
  *
2049
2085
  * Updates an existing {@link NotificationSummary} document's owner or setup flag.
2050
2086
  * Runs within a Firestore transaction to ensure consistency.
2087
+ *
2088
+ * @param context - the notification server actions context
2089
+ * @returns a transform-and-validate function that updates an existing notification summary document
2051
2090
  */ function updateNotificationSummaryFactory(context) {
2052
2091
  var firebaseServerActionTransformFunctionFactory = context.firebaseServerActionTransformFunctionFactory;
2053
2092
  return firebaseServerActionTransformFunctionFactory(firebase.updateNotificationSummaryParamsType, function(params) {
@@ -2102,6 +2141,9 @@ var MAX_NOTIFICATION_BOXES_TO_UPDATE_PER_BATCH = 50;
2102
2141
  *
2103
2142
  * Checks for existing boxes and throws if one already exists for the model.
2104
2143
  * Also syncs initial recipients with their corresponding {@link NotificationUser} documents.
2144
+ *
2145
+ * @param context - the base notification server actions context with collection access
2146
+ * @returns an async function that creates a notification box within a transaction and returns the document and template
2105
2147
  */ function createNotificationBoxInTransactionFactory(context) {
2106
2148
  var notificationBoxCollection = context.notificationBoxCollection;
2107
2149
  return function(params, transaction) {
@@ -2150,6 +2192,9 @@ var MAX_NOTIFICATION_BOXES_TO_UPDATE_PER_BATCH = 50;
2150
2192
  *
2151
2193
  * Wraps {@link createNotificationBoxInTransactionFactory} in a Firestore transaction
2152
2194
  * and follows the transform-and-validate pattern.
2195
+ *
2196
+ * @param context - the notification server actions context with Firestore and collection access
2197
+ * @returns a transform-and-validate function that creates a new notification box document
2153
2198
  */ function createNotificationBoxFactory(context) {
2154
2199
  var firestoreContext = context.firestoreContext, notificationBoxCollection = context.notificationBoxCollection, firebaseServerActionTransformFunctionFactory = context.firebaseServerActionTransformFunctionFactory;
2155
2200
  var createNotificationBoxInTransaction = createNotificationBoxInTransactionFactory(context);
@@ -2206,8 +2251,16 @@ var MAX_NOTIFICATION_BOXES_TO_UPDATE_PER_BATCH = 50;
2206
2251
  })();
2207
2252
  });
2208
2253
  }
2209
- function updateNotificationBoxFactory(param) {
2210
- var firebaseServerActionTransformFunctionFactory = param.firebaseServerActionTransformFunctionFactory;
2254
+ /**
2255
+ * Factory for the `updateNotificationBox` action.
2256
+ *
2257
+ * Currently a no-op placeholder that returns the document unchanged.
2258
+ * Reserved for future box-level update logic.
2259
+ *
2260
+ * @param context - the notification server actions context (destructured for the transform factory)
2261
+ * @returns a transform-and-validate function that returns the notification box document unchanged
2262
+ */ function updateNotificationBoxFactory(context) {
2263
+ var firebaseServerActionTransformFunctionFactory = context.firebaseServerActionTransformFunctionFactory;
2211
2264
  return firebaseServerActionTransformFunctionFactory(firebase.updateNotificationBoxParamsType, function() {
2212
2265
  return _async_to_generator$d(function() {
2213
2266
  return _ts_generator$d(this, function(_state) {
@@ -2234,6 +2287,9 @@ function updateNotificationBoxFactory(param) {
2234
2287
  *
2235
2288
  * Manages the exclusion list (`x`) on both the box recipient and the corresponding
2236
2289
  * {@link NotificationUser}'s send exclusion array, keeping them in sync.
2290
+ *
2291
+ * @param context - the base notification server actions context with collection access
2292
+ * @returns an async function that updates recipient exclusions within a transaction
2237
2293
  */ function updateNotificationBoxRecipientExclusionInTransactionFactory(context) {
2238
2294
  var notificationBoxCollection = context.notificationBoxCollection, notificationUserCollection = context.notificationUserCollection;
2239
2295
  return function(input, transaction) {
@@ -2269,7 +2325,7 @@ function updateNotificationBoxFactory(param) {
2269
2325
  targetRecipient = notificationBox.r.find(function(x) {
2270
2326
  return x.i === i;
2271
2327
  });
2272
- if (!targetRecipient || !targetRecipient.uid) {
2328
+ if (!(targetRecipient === null || targetRecipient === void 0 ? void 0 : targetRecipient.uid)) {
2273
2329
  throw notificationBoxExclusionTargetInvalidError();
2274
2330
  } else {
2275
2331
  targetUid = targetRecipient.uid;
@@ -2279,21 +2335,16 @@ function updateNotificationBoxFactory(param) {
2279
2335
  if (!targetUid) {
2280
2336
  throw notificationBoxExclusionTargetInvalidError();
2281
2337
  }
2282
- return [
2283
- 4,
2284
- notificationUserCollection.documentAccessorForTransaction(transaction).loadDocumentForId(targetUid)
2285
- ];
2286
- case 4:
2287
- notificationUserDocument = _state.sent();
2338
+ notificationUserDocument = notificationUserCollection.documentAccessorForTransaction(transaction).loadDocumentForId(targetUid);
2288
2339
  return [
2289
2340
  4,
2290
2341
  notificationUserDocument.snapshotData()
2291
2342
  ];
2292
- case 5:
2343
+ case 4:
2293
2344
  notificationUser = _state.sent();
2294
2345
  if (!notificationUser) return [
2295
2346
  3,
2296
- 7
2347
+ 6
2297
2348
  ];
2298
2349
  // only update if the user exists
2299
2350
  targetExclusions = [
@@ -2308,13 +2359,13 @@ function updateNotificationBoxFactory(param) {
2308
2359
  4,
2309
2360
  notificationUserDocument.update(notificationUserUpdate)
2310
2361
  ];
2311
- case 6:
2362
+ case 5:
2312
2363
  _state.sent();
2313
2364
  result = {
2314
2365
  notificationUserUpdate: notificationUserUpdate
2315
2366
  };
2316
- _state.label = 7;
2317
- case 7:
2367
+ _state.label = 6;
2368
+ case 6:
2318
2369
  return [
2319
2370
  2,
2320
2371
  result
@@ -2330,6 +2381,9 @@ function updateNotificationBoxFactory(param) {
2330
2381
  * Handles inserting new recipients, updating existing ones, and removing recipients.
2331
2382
  * Syncs changes with the recipient's {@link NotificationUser} document and manages
2332
2383
  * recipient index assignment via a sorted-values free-index calculator.
2384
+ *
2385
+ * @param context - the base notification server actions context with auth and collection access
2386
+ * @returns an async function that updates a recipient on a notification box within a transaction
2333
2387
  */ function updateNotificationBoxRecipientInTransactionFactory(context) {
2334
2388
  var authService = context.authService, notificationBoxCollection = context.notificationBoxCollection, notificationUserCollection = context.notificationUserCollection;
2335
2389
  var createNotificationBoxInTransaction = createNotificationBoxInTransactionFactory(context);
@@ -2387,14 +2441,14 @@ function updateNotificationBoxFactory(param) {
2387
2441
  case 4:
2388
2442
  if (!notificationBox) return [
2389
2443
  3,
2390
- 18
2444
+ 17
2391
2445
  ];
2392
2446
  notificationBox.m;
2393
2447
  targetRecipientIndex = notificationBox.r.findIndex(findRecipientFn);
2394
2448
  targetRecipient = notificationBox.r[targetRecipientIndex];
2395
2449
  if (remove) {
2396
- if (targetRecipientIndex != null) {
2397
- r = _to_consumable_array$4(notificationBox.r); // remove if they exist.
2450
+ if (targetRecipientIndex !== -1) {
2451
+ r = _to_consumable_array$5(notificationBox.r); // remove if they exist.
2398
2452
  delete r[targetRecipientIndex];
2399
2453
  }
2400
2454
  } else {
@@ -2407,7 +2461,7 @@ function updateNotificationBoxFactory(param) {
2407
2461
  i: (_ref1 = targetRecipient === null || targetRecipient === void 0 ? void 0 : targetRecipient.i) !== null && _ref1 !== void 0 ? _ref1 : util.UNSET_INDEX_NUMBER,
2408
2462
  c: c
2409
2463
  }, firebase.updateNotificationRecipient(targetRecipient !== null && targetRecipient !== void 0 ? targetRecipient : {}, params));
2410
- r = _to_consumable_array$4(notificationBox.r);
2464
+ r = _to_consumable_array$5(notificationBox.r);
2411
2465
  if (targetRecipient) {
2412
2466
  nextRecipient.i = targetRecipient.i;
2413
2467
  nextRecipient = firebase.mergeNotificationBoxRecipients(targetRecipient, nextRecipient);
@@ -2422,30 +2476,25 @@ function updateNotificationBoxFactory(param) {
2422
2476
  }
2423
2477
  if (!(r != null)) return [
2424
2478
  3,
2425
- 18
2479
+ 17
2426
2480
  ];
2427
2481
  notificationUserId = (_ref2 = targetRecipient === null || targetRecipient === void 0 ? void 0 : targetRecipient.uid) !== null && _ref2 !== void 0 ? _ref2 : nextRecipient === null || nextRecipient === void 0 ? void 0 : nextRecipient.uid;
2428
2482
  if (!(notificationUserId != null)) return [
2429
2483
  3,
2430
- 13
2484
+ 12
2431
2485
  ];
2432
2486
  notificationBoxId = notificationBoxDocument.id;
2433
- return [
2434
- 4,
2435
- notificationUserCollection.documentAccessorForTransaction(transaction).loadDocumentForId(notificationUserId)
2436
- ];
2437
- case 5:
2438
- notificationUserDocument = _state.sent();
2487
+ notificationUserDocument = notificationUserCollection.documentAccessorForTransaction(transaction).loadDocumentForId(notificationUserId);
2439
2488
  return [
2440
2489
  4,
2441
2490
  notificationUserDocument.snapshotData()
2442
2491
  ];
2443
- case 6:
2492
+ case 5:
2444
2493
  notificationUser = _state.sent();
2445
2494
  createNotificationUser = !notificationUser && !remove && insert;
2446
2495
  if (!createNotificationUser) return [
2447
2496
  3,
2448
- 8
2497
+ 7
2449
2498
  ];
2450
2499
  // assert they exist in the auth system
2451
2500
  userContext = authService.userContext(notificationUserId);
@@ -2453,7 +2502,7 @@ function updateNotificationBoxFactory(param) {
2453
2502
  4,
2454
2503
  userContext.exists()
2455
2504
  ];
2456
- case 7:
2505
+ case 6:
2457
2506
  userExistsInAuth = _state.sent();
2458
2507
  if (!userExistsInAuth) {
2459
2508
  throw notificationUserInvalidUidForCreateError(notificationUserId);
@@ -2472,11 +2521,11 @@ function updateNotificationBoxFactory(param) {
2472
2521
  }
2473
2522
  };
2474
2523
  notificationUser = notificationUserTemplate;
2475
- _state.label = 8;
2476
- case 8:
2524
+ _state.label = 7;
2525
+ case 7:
2477
2526
  if (!(notificationUser != null)) return [
2478
2527
  3,
2479
- 13
2528
+ 12
2480
2529
  ];
2481
2530
  _updateNotificationUserNotificationBoxRecipientConfig = updateNotificationUserNotificationBoxRecipientConfig({
2482
2531
  notificationBoxId: notificationBoxId,
@@ -2491,7 +2540,7 @@ function updateNotificationBoxFactory(param) {
2491
2540
  }) : undefined;
2492
2541
  if (!createNotificationUser) return [
2493
2542
  3,
2494
- 10
2543
+ 9
2495
2544
  ];
2496
2545
  newUserTemplate = _object_spread_props$a(_object_spread$b({}, notificationUser), {
2497
2546
  bc: updatedBc !== null && updatedBc !== void 0 ? updatedBc : [],
@@ -2501,16 +2550,16 @@ function updateNotificationBoxFactory(param) {
2501
2550
  4,
2502
2551
  notificationUserDocument.create(newUserTemplate)
2503
2552
  ];
2504
- case 9:
2553
+ case 8:
2505
2554
  _state.sent();
2506
2555
  return [
2507
2556
  3,
2508
- 12
2557
+ 11
2509
2558
  ];
2510
- case 10:
2559
+ case 9:
2511
2560
  if (!(updatedBc != null)) return [
2512
2561
  3,
2513
- 12
2562
+ 11
2514
2563
  ];
2515
2564
  return [
2516
2565
  4,
@@ -2519,53 +2568,53 @@ function updateNotificationBoxFactory(param) {
2519
2568
  b: updatedB
2520
2569
  })
2521
2570
  ];
2522
- case 11:
2571
+ case 10:
2523
2572
  _state.sent();
2524
- _state.label = 12;
2525
- case 12:
2573
+ _state.label = 11;
2574
+ case 11:
2526
2575
  // Set if nextRecipient is updated/influence from existing configuration
2527
- if (targetRecipientIndex != null && updatedNotificationBoxRecipient && !remove) {
2576
+ if (targetRecipientIndex !== -1 && updatedNotificationBoxRecipient && !remove) {
2528
2577
  r[targetRecipientIndex] = updatedNotificationBoxRecipient; // set the updated value in r
2529
2578
  }
2530
- _state.label = 13;
2531
- case 13:
2579
+ _state.label = 12;
2580
+ case 12:
2532
2581
  updatedNotificationBox = _object_spread_props$a(_object_spread$b({}, notificationBox), {
2533
2582
  r: r
2534
2583
  });
2535
2584
  notificationBoxWasCreated = false;
2536
2585
  if (!createNotificationBox) return [
2537
2586
  3,
2538
- 15
2587
+ 14
2539
2588
  ];
2540
2589
  return [
2541
2590
  4,
2542
2591
  notificationBoxDocument.create(updatedNotificationBox)
2543
2592
  ];
2544
- case 14:
2593
+ case 13:
2545
2594
  _state.sent();
2546
2595
  notificationBoxWasCreated = true;
2547
2596
  return [
2548
2597
  3,
2549
- 17
2598
+ 16
2550
2599
  ];
2551
- case 15:
2600
+ case 14:
2552
2601
  return [
2553
2602
  4,
2554
2603
  notificationBoxDocument.update({
2555
2604
  r: r
2556
2605
  })
2557
2606
  ];
2558
- case 16:
2607
+ case 15:
2559
2608
  _state.sent();
2560
- _state.label = 17;
2561
- case 17:
2609
+ _state.label = 16;
2610
+ case 16:
2562
2611
  result = {
2563
2612
  updatedNotificationBox: updatedNotificationBox,
2564
2613
  notificationBoxWasCreated: notificationBoxWasCreated,
2565
2614
  notificationBoxDocument: notificationBoxDocument
2566
2615
  };
2567
- _state.label = 18;
2568
- case 18:
2616
+ _state.label = 17;
2617
+ case 17:
2569
2618
  return [
2570
2619
  2,
2571
2620
  result
@@ -2580,6 +2629,9 @@ function updateNotificationBoxFactory(param) {
2580
2629
  *
2581
2630
  * Wraps the in-transaction recipient update logic, handling both recipient changes
2582
2631
  * and send exclusion updates in a single Firestore transaction.
2632
+ *
2633
+ * @param context - the notification server actions context with Firestore and collection access
2634
+ * @returns a transform-and-validate function that updates a recipient on a notification box
2583
2635
  */ function updateNotificationBoxRecipientFactory(context) {
2584
2636
  var firestoreContext = context.firestoreContext, firebaseServerActionTransformFunctionFactory = context.firebaseServerActionTransformFunctionFactory;
2585
2637
  var updateNotificationBoxRecipientInTransaction = updateNotificationBoxRecipientInTransactionFactory(context);
@@ -2681,6 +2733,9 @@ var NOTIFICATION_TASK_TYPE_FAILURE_DELAY_MS = dateFns.hoursToMilliseconds(NOTIFI
2681
2733
  *
2682
2734
  * Supports throttling via `sendAt` time, configurable send flags, and task-based
2683
2735
  * async workflows for notifications that require multi-step processing.
2736
+ *
2737
+ * @param context - the notification server actions context with template, send, and task services
2738
+ * @returns a transform-and-validate function that processes and sends a notification document
2684
2739
  */ function sendNotificationFactory(context) {
2685
2740
  var appNotificationTemplateTypeInfoRecordService = context.appNotificationTemplateTypeInfoRecordService, notificationSendService = context.notificationSendService, notificationTaskService = context.notificationTaskService, notificationTemplateService = context.notificationTemplateService, authService = context.authService, notificationBoxCollection = context.notificationBoxCollection, notificationCollectionGroup = context.notificationCollectionGroup, notificationUserCollection = context.notificationUserCollection, firestoreContext = context.firestoreContext, firebaseServerActionTransformFunctionFactory = context.firebaseServerActionTransformFunctionFactory;
2686
2741
  var createNotificationBoxInTransaction = createNotificationBoxInTransactionFactory(context);
@@ -2761,7 +2816,7 @@ var NOTIFICATION_TASK_TYPE_FAILURE_DELAY_MS = dateFns.hoursToMilliseconds(NOTIFI
2761
2816
  notificationTemplate.at = 0; // reset checkpoint attempt/delay count
2762
2817
  }
2763
2818
  // add the checkpoint to the notification
2764
- notificationTemplate.tpr = _to_consumable_array$4(removeFromCompletionsArrayWithTaskResult(notification.tpr, handleTaskResult)).concat(_to_consumable_array$4(util.asArray(completion)));
2819
+ notificationTemplate.tpr = _to_consumable_array$5(removeFromCompletionsArrayWithTaskResult(notification.tpr, handleTaskResult)).concat(_to_consumable_array$5(util.asArray(completion)));
2765
2820
  // calculate the updated notification item
2766
2821
  notificationTemplate.n = _object_spread_props$a(_object_spread$b({}, notification.n), {
2767
2822
  d: _object_spread$b({}, notification.n.d, updateMetadata ? util.filterOnlyUndefinedValues(updateMetadata) : undefined // ignore any undefined values
@@ -2771,7 +2826,7 @@ var NOTIFICATION_TASK_TYPE_FAILURE_DELAY_MS = dateFns.hoursToMilliseconds(NOTIFI
2771
2826
  // if the tpr has not changed, then it is also considered a reversal
2772
2827
  if (tryRunNextPart) {
2773
2828
  tprChanged = !util.iterablesAreSetEquivalent(notification.tpr, notificationTemplate.tpr);
2774
- partTprReversal = !tprChanged || tprChanged && notificationTemplate.tpr.length <= notification.tpr.length;
2829
+ partTprReversal = !tprChanged || notificationTemplate.tpr.length <= notification.tpr.length;
2775
2830
  if (allCompletedSubTasks != null) {
2776
2831
  switch(allCompletedSubTasks){
2777
2832
  case true:
@@ -2780,11 +2835,13 @@ var NOTIFICATION_TASK_TYPE_FAILURE_DELAY_MS = dateFns.hoursToMilliseconds(NOTIFI
2780
2835
  tryRunNextPart = !partTprReversal;
2781
2836
  break;
2782
2837
  default:
2783
- // check subtask tpr changes
2784
- nextCompleteSubTasks = util.asArray(allCompletedSubTasks);
2785
- subtaskTprChanged = !util.iterablesAreSetEquivalent(previouslyCompleteSubTasks, nextCompleteSubTasks);
2786
- partTprReversal = !subtaskTprChanged || subtaskTprChanged && nextCompleteSubTasks.length <= previouslyCompleteSubTasks.length;
2787
- break;
2838
+ {
2839
+ // check subtask tpr changes
2840
+ nextCompleteSubTasks = util.asArray(allCompletedSubTasks);
2841
+ subtaskTprChanged = !util.iterablesAreSetEquivalent(previouslyCompleteSubTasks, nextCompleteSubTasks);
2842
+ partTprReversal = !subtaskTprChanged || nextCompleteSubTasks.length <= previouslyCompleteSubTasks.length;
2843
+ break;
2844
+ }
2788
2845
  }
2789
2846
  }
2790
2847
  }
@@ -3003,7 +3060,8 @@ var NOTIFICATION_TASK_TYPE_FAILURE_DELAY_MS = dateFns.hoursToMilliseconds(NOTIFI
3003
3060
  ];
3004
3061
  case 2:
3005
3062
  _ref = _state.sent(), emailRecipients = _ref.emails, textRecipients = _ref.texts, notificationSummaryRecipients = _ref.notificationSummaries;
3006
- es = notification.es, ts = notification.ts, ps = notification.ps, ns = notification.ns, currentEsr = notification.esr, currentTsr = notification.tsr;
3063
+ es = notification.es, ts = notification.ts, ps = notification.ps, ns = notification.ns;
3064
+ currentEsr = notification.esr, currentTsr = notification.tsr;
3007
3065
  if (!(es === firebase.NotificationSendState.QUEUED || es === firebase.NotificationSendState.SENT_PARTIAL)) return [
3008
3066
  3,
3009
3067
  15
@@ -3110,9 +3168,9 @@ var NOTIFICATION_TASK_TYPE_FAILURE_DELAY_MS = dateFns.hoursToMilliseconds(NOTIFI
3110
3168
  case 13:
3111
3169
  if (sendEmailsResult != null) {
3112
3170
  success1 = sendEmailsResult.success, failed = sendEmailsResult.failed;
3113
- esr = success1.length ? currentEsr.concat(success1.map(function(x) {
3171
+ esr = success1.length ? _to_consumable_array$5(currentEsr).concat(_to_consumable_array$5(success1.map(function(x) {
3114
3172
  return x.toLowerCase();
3115
- })) : undefined;
3173
+ }))) : undefined;
3116
3174
  if (failed.length > 0) {
3117
3175
  es = firebase.NotificationSendState.SENT_PARTIAL;
3118
3176
  } else {
@@ -3231,7 +3289,7 @@ var NOTIFICATION_TASK_TYPE_FAILURE_DELAY_MS = dateFns.hoursToMilliseconds(NOTIFI
3231
3289
  case 26:
3232
3290
  if (sendTextsResult != null) {
3233
3291
  success2 = sendTextsResult.success, failed1 = sendTextsResult.failed;
3234
- tsr = success2.length ? currentTsr.concat(success2) : undefined;
3292
+ tsr = success2.length ? _to_consumable_array$5(currentTsr).concat(_to_consumable_array$5(success2)) : undefined;
3235
3293
  if (failed1.length > 0) {
3236
3294
  ts = firebase.NotificationSendState.SENT_PARTIAL;
3237
3295
  } else {
@@ -3439,6 +3497,10 @@ var NOTIFICATION_TASK_TYPE_FAILURE_DELAY_MS = dateFns.hoursToMilliseconds(NOTIFI
3439
3497
  // deleted successfully
3440
3498
  success = deletedNotification;
3441
3499
  break;
3500
+ case firebase.NotificationSendType.INIT_BOX_AND_SEND:
3501
+ case firebase.NotificationSendType.SEND_WITHOUT_CREATING_BOX:
3502
+ case firebase.NotificationSendType.TASK_NOTIFICATION:
3503
+ break;
3442
3504
  }
3443
3505
  _state.label = 48;
3444
3506
  case 48:
@@ -3459,7 +3521,7 @@ var NOTIFICATION_TASK_TYPE_FAILURE_DELAY_MS = dateFns.hoursToMilliseconds(NOTIFI
3459
3521
  4,
3460
3522
  firestoreContext.runTransaction(function(transaction) {
3461
3523
  return _async_to_generator$d(function() {
3462
- var notificationBoxDocument, notificationDocumentInTransaction, _ref, notificationBox, notification, model, isNotificationTask, tryRun, throttled, nextSat, createdBox, deletedNotification, notificationBoxNeedsInitialization, isKnownTemplateType, isConfiguredTemplateType, onlySendToExplicitlyEnabledRecipients, onlyTextExplicitlyEnabledRecipients, templateInstance, notificationTaskHandler, t // notification task/template type
3524
+ var notificationBoxDocument, notificationDocumentInTransaction, _ref, initialNotificationBox, notification, notificationBox, model, isNotificationTask, tryRun, throttled, nextSat, createdBox, deletedNotification, notificationBoxNeedsInitialization, isKnownTemplateType, isConfiguredTemplateType, onlySendToExplicitlyEnabledRecipients, onlyTextExplicitlyEnabledRecipients, templateInstance, notificationTaskHandler, t // notification task/template type
3463
3525
  , delay, _notification_ois, _notification_ots, templateTypeInfo, retryAttempts, delay1, _, notificationBoxTemplate, isAtMaxAttempts, a;
3464
3526
  function deleteNotification() {
3465
3527
  return _async_to_generator$d(function() {
@@ -3497,7 +3559,8 @@ var NOTIFICATION_TASK_TYPE_FAILURE_DELAY_MS = dateFns.hoursToMilliseconds(NOTIFI
3497
3559
  _ref = _sliced_to_array$2.apply(void 0, [
3498
3560
  _state.sent(),
3499
3561
  2
3500
- ]), notificationBox = _ref[0], notification = _ref[1];
3562
+ ]), initialNotificationBox = _ref[0], notification = _ref[1];
3563
+ notificationBox = initialNotificationBox;
3501
3564
  model = firebase.inferKeyFromTwoWayFlatFirestoreModelKey(notificationBoxDocument.id);
3502
3565
  isNotificationTask = (notification === null || notification === void 0 ? void 0 : notification.st) === firebase.NotificationSendType.TASK_NOTIFICATION;
3503
3566
  tryRun = true;
@@ -3525,7 +3588,7 @@ var NOTIFICATION_TASK_TYPE_FAILURE_DELAY_MS = dateFns.hoursToMilliseconds(NOTIFI
3525
3588
  notificationBoxNeedsInitialization = false;
3526
3589
  if (!(notification && tryRun)) return [
3527
3590
  3,
3528
- 18
3591
+ 19
3529
3592
  ];
3530
3593
  // if we're still trying to run, check the template is ok. If not, cancel the run.
3531
3594
  t = notification.n.t;
@@ -3582,7 +3645,7 @@ var NOTIFICATION_TASK_TYPE_FAILURE_DELAY_MS = dateFns.hoursToMilliseconds(NOTIFI
3582
3645
  case 7:
3583
3646
  return [
3584
3647
  3,
3585
- 18
3648
+ 19
3586
3649
  ];
3587
3650
  case 8:
3588
3651
  templateInstance = notificationTemplateService.templateInstanceForType(t);
@@ -3603,7 +3666,7 @@ var NOTIFICATION_TASK_TYPE_FAILURE_DELAY_MS = dateFns.hoursToMilliseconds(NOTIFI
3603
3666
  9
3604
3667
  ];
3605
3668
  if (isKnownTemplateType) {
3606
- console.warn('Unconfigured but known template type of "'.concat(t, '" (').concat(templateTypeInfo.name, ") was found in a Notification. Send is being delayed by ").concat(delay1, " hours."));
3669
+ console.warn('Unconfigured but known template type of "'.concat(t, '" (').concat(templateTypeInfo === null || templateTypeInfo === void 0 ? void 0 : templateTypeInfo.name, ") was found in a Notification. Send is being delayed by ").concat(delay1, " hours."));
3607
3670
  } else {
3608
3671
  console.warn('Unknown template type of "'.concat(t, '" was found in a Notification. Send is being delayed by ').concat(delay1, " hours."));
3609
3672
  }
@@ -3627,7 +3690,7 @@ var NOTIFICATION_TASK_TYPE_FAILURE_DELAY_MS = dateFns.hoursToMilliseconds(NOTIFI
3627
3690
  case 11:
3628
3691
  if (!(!notificationBox && tryRun)) return [
3629
3692
  3,
3630
- 17
3693
+ 18
3631
3694
  ];
3632
3695
  _ = notification.st;
3633
3696
  switch(_){
@@ -3646,10 +3709,15 @@ var NOTIFICATION_TASK_TYPE_FAILURE_DELAY_MS = dateFns.hoursToMilliseconds(NOTIFI
3646
3709
  3,
3647
3710
  16
3648
3711
  ];
3712
+ case firebase.NotificationSendType.TASK_NOTIFICATION:
3713
+ return [
3714
+ 3,
3715
+ 17
3716
+ ];
3649
3717
  }
3650
3718
  return [
3651
3719
  3,
3652
- 17
3720
+ 18
3653
3721
  ];
3654
3722
  case 12:
3655
3723
  return [
@@ -3664,7 +3732,7 @@ var NOTIFICATION_TASK_TYPE_FAILURE_DELAY_MS = dateFns.hoursToMilliseconds(NOTIFI
3664
3732
  createdBox = true;
3665
3733
  return [
3666
3734
  3,
3667
- 17
3735
+ 18
3668
3736
  ];
3669
3737
  case 14:
3670
3738
  // delete the notification since it won't get sent.
@@ -3676,43 +3744,49 @@ var NOTIFICATION_TASK_TYPE_FAILURE_DELAY_MS = dateFns.hoursToMilliseconds(NOTIFI
3676
3744
  _state.sent();
3677
3745
  return [
3678
3746
  3,
3679
- 17
3747
+ 18
3680
3748
  ];
3681
3749
  case 16:
3682
3750
  // continue with current tryRun
3683
3751
  return [
3684
3752
  3,
3685
- 17
3753
+ 18
3686
3754
  ];
3687
3755
  case 17:
3756
+ // task notifications do not require a notification box; continue with current tryRun
3757
+ return [
3758
+ 3,
3759
+ 18
3760
+ ];
3761
+ case 18:
3688
3762
  // if the notification box is not initialized/synchronized yet, do not run.
3689
3763
  if (tryRun && notificationBox && notificationBox.s) {
3690
3764
  notificationBoxNeedsInitialization = true;
3691
3765
  tryRun = false;
3692
3766
  nextSat = dateFns.addMinutes(now, NOTIFICATION_BOX_NOT_INITIALIZED_DELAY_MINUTES);
3693
3767
  }
3694
- _state.label = 18;
3695
- case 18:
3768
+ _state.label = 19;
3769
+ case 19:
3696
3770
  if (!(notification != null && nextSat != null && !deletedNotification)) return [
3697
3771
  3,
3698
- 22
3772
+ 23
3699
3773
  ];
3700
3774
  isAtMaxAttempts = notification.a >= NOTIFICATION_MAX_SEND_ATTEMPTS;
3701
3775
  if (!(isAtMaxAttempts && notificationBoxNeedsInitialization)) return [
3702
3776
  3,
3703
- 20
3777
+ 21
3704
3778
  ];
3705
3779
  return [
3706
3780
  4,
3707
3781
  deleteNotification()
3708
3782
  ];
3709
- case 19:
3710
- _state.sent(); // just delete the notification if the box still hasn't been initialized successfully at this point.
3711
- _state.label = 20;
3712
3783
  case 20:
3784
+ _state.sent(); // just delete the notification if the box still hasn't been initialized successfully at this point.
3785
+ _state.label = 21;
3786
+ case 21:
3713
3787
  if (!!deletedNotification) return [
3714
3788
  3,
3715
- 22
3789
+ 23
3716
3790
  ];
3717
3791
  a = isNotificationTask && tryRun ? notification.a : notification.a + 1; // do not update a notification task's attempt count here, unless tryRun fails
3718
3792
  // NOTE: It is important to update sat so the notification task queue running doesn't get stuck in a query loop by notifications/tasks that have a sat value that is in the past, but was just run.
@@ -3723,10 +3797,10 @@ var NOTIFICATION_TASK_TYPE_FAILURE_DELAY_MS = dateFns.hoursToMilliseconds(NOTIFI
3723
3797
  a: a
3724
3798
  })
3725
3799
  ];
3726
- case 21:
3727
- _state.sent();
3728
- _state.label = 22;
3729
3800
  case 22:
3801
+ _state.sent();
3802
+ _state.label = 23;
3803
+ case 23:
3730
3804
  return [
3731
3805
  2,
3732
3806
  {
@@ -3838,6 +3912,9 @@ var NOTIFICATION_TASK_TYPE_FAILURE_DELAY_MS = dateFns.hoursToMilliseconds(NOTIFI
3838
3912
  * and an optional {@link NotificationExpediteService} for immediate delivery.
3839
3913
  * Continues processing batches until no more queued notifications are found
3840
3914
  * or the time budget is exhausted.
3915
+ *
3916
+ * @param context - the notification server actions context with collection group and send factory access
3917
+ * @returns a transform-and-validate function that processes all queued notifications and returns aggregate results
3841
3918
  */ function sendQueuedNotificationsFactory(context) {
3842
3919
  var firebaseServerActionTransformFunctionFactory = context.firebaseServerActionTransformFunctionFactory, notificationCollectionGroup = context.notificationCollectionGroup;
3843
3920
  var sendNotification = sendNotificationFactory(context);
@@ -3879,7 +3956,7 @@ var NOTIFICATION_TASK_TYPE_FAILURE_DELAY_MS = dateFns.hoursToMilliseconds(NOTIFI
3879
3956
  excessLoopsDetected = false;
3880
3957
  sendQueuedNotifications = function sendQueuedNotifications() {
3881
3958
  return _async_to_generator$d(function() {
3882
- var query, notificationDocuments, result;
3959
+ var query, notificationDocuments;
3883
3960
  return _ts_generator$d(this, function(_state) {
3884
3961
  switch(_state.label){
3885
3962
  case 0:
@@ -3891,7 +3968,7 @@ var NOTIFICATION_TASK_TYPE_FAILURE_DELAY_MS = dateFns.hoursToMilliseconds(NOTIFI
3891
3968
  case 1:
3892
3969
  notificationDocuments = _state.sent();
3893
3970
  return [
3894
- 4,
3971
+ 2,
3895
3972
  util.performAsyncTasks(notificationDocuments, function(notificationDocument) {
3896
3973
  return _async_to_generator$d(function() {
3897
3974
  var result;
@@ -3916,12 +3993,6 @@ var NOTIFICATION_TASK_TYPE_FAILURE_DELAY_MS = dateFns.hoursToMilliseconds(NOTIFI
3916
3993
  maxParallelTasks: maxParallelTasks
3917
3994
  })
3918
3995
  ];
3919
- case 2:
3920
- result = _state.sent();
3921
- return [
3922
- 2,
3923
- result
3924
- ];
3925
3996
  }
3926
3997
  });
3927
3998
  })();
@@ -4011,6 +4082,9 @@ var NOTIFICATION_TASK_TYPE_FAILURE_DELAY_MS = dateFns.hoursToMilliseconds(NOTIFI
4011
4082
  * Queries for {@link Notification} documents that are ready for cleanup (fully sent,
4012
4083
  * past the retention window) and deletes them in batches. Continues until no more
4013
4084
  * cleanup-eligible notifications are found.
4085
+ *
4086
+ * @param context - the notification server actions context with Firestore and collection access
4087
+ * @returns a transform-and-validate function that cleans up sent notification documents and returns aggregate results
4014
4088
  */ function cleanupSentNotificationsFactory(context) {
4015
4089
  var firestoreContext = context.firestoreContext, firebaseServerActionTransformFunctionFactory = context.firebaseServerActionTransformFunctionFactory, notificationCollectionGroup = context.notificationCollectionGroup, notificationBoxCollection = context.notificationBoxCollection, notificationWeekCollectionFactory = context.notificationWeekCollectionFactory;
4016
4090
  return firebaseServerActionTransformFunctionFactory(firebase.cleanupSentNotificationsParamsType, function() {
@@ -4023,7 +4097,7 @@ var NOTIFICATION_TASK_TYPE_FAILURE_DELAY_MS = dateFns.hoursToMilliseconds(NOTIFI
4023
4097
  var notificationBoxesUpdatesCount, notificationsDeleted, notificationTasksDeletedCount, notificationWeeksCreated, notificationWeeksUpdated, cleanupSentNotificationsResults, notificationBoxesUpdated, result;
4024
4098
  function cleanupSentNotifications() {
4025
4099
  return _async_to_generator$d(function() {
4026
- var query, notificationDocuments, notificationDocumentsGroupedByNotificationBox, result;
4100
+ var query, notificationDocuments, notificationDocumentsGroupedByNotificationBox;
4027
4101
  return _ts_generator$d(this, function(_state) {
4028
4102
  switch(_state.label){
4029
4103
  case 0:
@@ -4034,14 +4108,14 @@ var NOTIFICATION_TASK_TYPE_FAILURE_DELAY_MS = dateFns.hoursToMilliseconds(NOTIFI
4034
4108
  ];
4035
4109
  case 1:
4036
4110
  notificationDocuments = _state.sent();
4037
- notificationDocumentsGroupedByNotificationBox = Array.from(util.makeValuesGroupMap(notificationDocuments, function(x) {
4111
+ notificationDocumentsGroupedByNotificationBox = _to_consumable_array$5(util.makeValuesGroupMap(notificationDocuments, function(x) {
4038
4112
  return x.parent.id;
4039
4113
  }).values());
4040
4114
  return [
4041
- 4,
4115
+ 2,
4042
4116
  util.performAsyncTasks(notificationDocumentsGroupedByNotificationBox, function(notificationDocumentsInSameBox) {
4043
4117
  return _async_to_generator$d(function() {
4044
- var allPairs, allPairsWithDataAndMarkedDeleted, _separateValues, taskPairsWithDataAndMarkedDeleted, normalPairsWithDataAndMarkedDeleted, pairsGroupedByWeek, pairsGroupedByWeekInBatches, notificationBoxDocument, notificationWeekResults, writeBatch, writeBatchAccessor, weeksCreated, weeksUpdated, tasksDeleted, result;
4118
+ var allPairs, allPairsWithDataAndMarkedDeleted, _separateValues, taskPairsWithDataAndMarkedDeleted, normalPairsWithDataAndMarkedDeleted, pairsGroupedByWeek, pairsGroupedByWeekInBatches, notificationBoxDocument, notificationWeekResults, writeBatch, writeBatchAccessor, weeksCreated, weeksUpdated, tasksDeleted;
4045
4119
  return _ts_generator$d(this, function(_state) {
4046
4120
  switch(_state.label){
4047
4121
  case 0:
@@ -4059,11 +4133,11 @@ var NOTIFICATION_TASK_TYPE_FAILURE_DELAY_MS = dateFns.hoursToMilliseconds(NOTIFI
4059
4133
  var _x_data;
4060
4134
  return ((_x_data = x.data) === null || _x_data === void 0 ? void 0 : _x_data.st) === firebase.NotificationSendType.TASK_NOTIFICATION;
4061
4135
  }), taskPairsWithDataAndMarkedDeleted = _separateValues.included, normalPairsWithDataAndMarkedDeleted = _separateValues.excluded;
4062
- pairsGroupedByWeek = Array.from(util.makeValuesGroupMap(normalPairsWithDataAndMarkedDeleted, function(x) {
4136
+ pairsGroupedByWeek = _to_consumable_array$5(util.makeValuesGroupMap(normalPairsWithDataAndMarkedDeleted, function(x) {
4063
4137
  return date.yearWeekCode(x.data.sat);
4064
4138
  }).entries());
4065
4139
  // batch incase there are a lot of new notifications to move to week
4066
- pairsGroupedByWeekInBatches = pairsGroupedByWeek.map(function(x) {
4140
+ pairsGroupedByWeekInBatches = pairsGroupedByWeek.flatMap(function(x) {
4067
4141
  var batches = util.batch(x[1], 40);
4068
4142
  return batches.map(function(batch) {
4069
4143
  return [
@@ -4071,13 +4145,8 @@ var NOTIFICATION_TASK_TYPE_FAILURE_DELAY_MS = dateFns.hoursToMilliseconds(NOTIFI
4071
4145
  batch
4072
4146
  ];
4073
4147
  });
4074
- }).flat();
4075
- return [
4076
- 4,
4077
- notificationBoxCollection.documentAccessor().loadDocument(notificationDocumentsInSameBox[0].parent)
4078
- ];
4079
- case 2:
4080
- notificationBoxDocument = _state.sent();
4148
+ });
4149
+ notificationBoxDocument = notificationBoxCollection.documentAccessor().loadDocument(notificationDocumentsInSameBox[0].parent);
4081
4150
  return [
4082
4151
  4,
4083
4152
  util.performAsyncTasks(pairsGroupedByWeekInBatches, function(param) {
@@ -4107,7 +4176,7 @@ var NOTIFICATION_TASK_TYPE_FAILURE_DELAY_MS = dateFns.hoursToMilliseconds(NOTIFI
4107
4176
  var shouldSaveToNotificationWeek = firebase.shouldSaveNotificationToNotificationWeek(data);
4108
4177
  return shouldSaveToNotificationWeek ? data.n : undefined;
4109
4178
  }));
4110
- n = _to_consumable_array$4((_ref = notificationWeek === null || notificationWeek === void 0 ? void 0 : notificationWeek.n) !== null && _ref !== void 0 ? _ref : []).concat(_to_consumable_array$4(newItems));
4179
+ n = _to_consumable_array$5((_ref = notificationWeek === null || notificationWeek === void 0 ? void 0 : notificationWeek.n) !== null && _ref !== void 0 ? _ref : []).concat(_to_consumable_array$5(newItems));
4111
4180
  if (!!notificationWeek) return [
4112
4181
  3,
4113
4182
  3
@@ -4162,7 +4231,7 @@ var NOTIFICATION_TASK_TYPE_FAILURE_DELAY_MS = dateFns.hoursToMilliseconds(NOTIFI
4162
4231
  })();
4163
4232
  })
4164
4233
  ];
4165
- case 3:
4234
+ case 2:
4166
4235
  notificationWeekResults = _state.sent();
4167
4236
  // delete all the task notifications
4168
4237
  writeBatch = firestoreContext.batch();
@@ -4173,13 +4242,13 @@ var NOTIFICATION_TASK_TYPE_FAILURE_DELAY_MS = dateFns.hoursToMilliseconds(NOTIFI
4173
4242
  return writeBatchAccessor.loadDocumentFrom(x.document).accessor.delete();
4174
4243
  }))
4175
4244
  ];
4176
- case 4:
4245
+ case 3:
4177
4246
  _state.sent();
4178
4247
  return [
4179
4248
  4,
4180
4249
  writeBatch.commit()
4181
4250
  ];
4182
- case 5:
4251
+ case 4:
4183
4252
  _state.sent();
4184
4253
  weeksCreated = 0;
4185
4254
  weeksUpdated = 0;
@@ -4191,15 +4260,14 @@ var NOTIFICATION_TASK_TYPE_FAILURE_DELAY_MS = dateFns.hoursToMilliseconds(NOTIFI
4191
4260
  weeksUpdated += 1;
4192
4261
  }
4193
4262
  });
4194
- result = {
4195
- weeksCreated: weeksCreated,
4196
- weeksUpdated: weeksUpdated,
4197
- itemsDeleted: allPairsWithDataAndMarkedDeleted.length,
4198
- tasksDeleted: tasksDeleted
4199
- };
4200
4263
  return [
4201
4264
  2,
4202
- result
4265
+ {
4266
+ weeksCreated: weeksCreated,
4267
+ weeksUpdated: weeksUpdated,
4268
+ itemsDeleted: allPairsWithDataAndMarkedDeleted.length,
4269
+ tasksDeleted: tasksDeleted
4270
+ }
4203
4271
  ];
4204
4272
  }
4205
4273
  });
@@ -4208,12 +4276,6 @@ var NOTIFICATION_TASK_TYPE_FAILURE_DELAY_MS = dateFns.hoursToMilliseconds(NOTIFI
4208
4276
  maxParallelTasks: 10
4209
4277
  })
4210
4278
  ];
4211
- case 2:
4212
- result = _state.sent();
4213
- return [
4214
- 2,
4215
- result
4216
- ];
4217
4279
  }
4218
4280
  });
4219
4281
  })();
@@ -4478,6 +4540,7 @@ var MAKE_TEMPLATE_FOR_NOTIFICATION_RELATED_MODEL_INITIALIZATION_FUNCTION_DELETE_
4478
4540
  * initialization action to its factory function.
4479
4541
  *
4480
4542
  * @param context - the initialization context with template functions and Firestore access
4543
+ * @returns a fully wired {@link NotificationInitServerActions} instance
4481
4544
  *
4482
4545
  * @example
4483
4546
  * ```ts
@@ -4504,6 +4567,7 @@ var MAKE_TEMPLATE_FOR_NOTIFICATION_RELATED_MODEL_INITIALIZATION_FUNCTION_DELETE_
4504
4567
  * Skips initialization if the model is already initialized, optionally throwing an error.
4505
4568
  *
4506
4569
  * @param input - the document, transaction, template function, and options
4570
+ * @returns an object with `initialized` and `alreadyInitialized` boolean flags
4507
4571
  * @throws notificationModelAlreadyInitializedError when `throwErrorIfAlreadyInitialized` is true
4508
4572
  */ function initializeNotificationModelInTransaction(input) {
4509
4573
  return _async_to_generator$c(function() {
@@ -4605,6 +4669,9 @@ var MAKE_TEMPLATE_FOR_NOTIFICATION_RELATED_MODEL_INITIALIZATION_FUNCTION_DELETE_
4605
4669
  *
4606
4670
  * Loads the box document in the transaction, reads its current data, and delegates
4607
4671
  * to {@link initializeNotificationModelInTransaction} with the box-specific template function.
4672
+ *
4673
+ * @param context - the initialization context with collection references and template functions
4674
+ * @returns an async function that initializes a notification box given params, document, and transaction
4608
4675
  */ function initializeNotificationBoxInTransactionFactory(context) {
4609
4676
  var notificationBoxCollection = context.notificationBoxCollection, makeTemplateForNotificationBoxInitialization = context.makeTemplateForNotificationBoxInitialization;
4610
4677
  return function(params, notificationBoxDocument, transaction) {
@@ -4641,6 +4708,9 @@ var MAKE_TEMPLATE_FOR_NOTIFICATION_RELATED_MODEL_INITIALIZATION_FUNCTION_DELETE_
4641
4708
  *
4642
4709
  * Wraps the in-transaction initialization in a Firestore transaction
4643
4710
  * and follows the transform-and-validate pattern.
4711
+ *
4712
+ * @param context - the initialization context with Firestore access and template functions
4713
+ * @returns a transform-and-validate function that initializes a single notification box
4644
4714
  */ function initializeNotificationBoxFactory(context) {
4645
4715
  var firestoreContext = context.firestoreContext, firebaseServerActionTransformFunctionFactory = context.firebaseServerActionTransformFunctionFactory;
4646
4716
  var initializeNotificationBoxInTransaction = initializeNotificationBoxInTransactionFactory(context);
@@ -4681,8 +4751,11 @@ var MAKE_TEMPLATE_FOR_NOTIFICATION_RELATED_MODEL_INITIALIZATION_FUNCTION_DELETE_
4681
4751
  * Batch-processes all {@link NotificationBox} documents flagged for initialization
4682
4752
  * by querying for entries with `s=true` (setup needed), then initializing each in
4683
4753
  * parallel (up to 5 concurrent tasks). Loops until no more flagged boxes are found.
4754
+ *
4755
+ * @param context - the initialization context with Firestore access and collection references
4756
+ * @returns a transform-and-validate function that batch-initializes all applicable notification boxes
4684
4757
  */ function initializeAllApplicableNotificationBoxesFactory(context) {
4685
- var firestoreContext = context.firestoreContext, firebaseServerActionTransformFunctionFactory = context.firebaseServerActionTransformFunctionFactory, notificationBoxCollection = context.notificationBoxCollection; context.notificationCollectionGroup;
4758
+ var firestoreContext = context.firestoreContext, firebaseServerActionTransformFunctionFactory = context.firebaseServerActionTransformFunctionFactory, notificationBoxCollection = context.notificationBoxCollection;
4686
4759
  var initializeNotificationBoxInTransaction = initializeNotificationBoxInTransactionFactory(context);
4687
4760
  return firebaseServerActionTransformFunctionFactory(firebase.initializeAllApplicableNotificationBoxesParamsType, function() {
4688
4761
  return _async_to_generator$c(function() {
@@ -4798,6 +4871,9 @@ var MAKE_TEMPLATE_FOR_NOTIFICATION_RELATED_MODEL_INITIALIZATION_FUNCTION_DELETE_
4798
4871
  *
4799
4872
  * Loads the summary document in the transaction, reads its current data, and delegates
4800
4873
  * to {@link initializeNotificationModelInTransaction} with the summary-specific template function.
4874
+ *
4875
+ * @param context - the initialization context with collection references and template functions
4876
+ * @returns an async function that initializes a notification summary given params, document, and transaction
4801
4877
  */ function initializeNotificationSummaryInTransactionFactory(context) {
4802
4878
  var notificationSummaryCollection = context.notificationSummaryCollection, makeTemplateForNotificationSummaryInitialization = context.makeTemplateForNotificationSummaryInitialization;
4803
4879
  return function(params, notificationSummaryDocument, transaction) {
@@ -4834,6 +4910,9 @@ var MAKE_TEMPLATE_FOR_NOTIFICATION_RELATED_MODEL_INITIALIZATION_FUNCTION_DELETE_
4834
4910
  *
4835
4911
  * Wraps the in-transaction summary initialization in a Firestore transaction
4836
4912
  * and follows the transform-and-validate pattern.
4913
+ *
4914
+ * @param context - the initialization context with Firestore access and template functions
4915
+ * @returns a transform-and-validate function that initializes a single notification summary
4837
4916
  */ function initializeNotificationSummaryFactory(context) {
4838
4917
  var firestoreContext = context.firestoreContext, firebaseServerActionTransformFunctionFactory = context.firebaseServerActionTransformFunctionFactory;
4839
4918
  var initializeNotificationSummaryInTransaction = initializeNotificationSummaryInTransactionFactory(context);
@@ -4874,8 +4953,11 @@ var MAKE_TEMPLATE_FOR_NOTIFICATION_RELATED_MODEL_INITIALIZATION_FUNCTION_DELETE_
4874
4953
  * Batch-processes all {@link NotificationSummary} documents flagged for initialization
4875
4954
  * by querying for entries with `s=true` (setup needed), then initializing each in
4876
4955
  * parallel (up to 5 concurrent tasks). Loops until no more flagged summaries are found.
4956
+ *
4957
+ * @param context - the initialization context with Firestore access and collection references
4958
+ * @returns a transform-and-validate function that batch-initializes all applicable notification summaries
4877
4959
  */ function initializeAllApplicableNotificationSummariesFactory(context) {
4878
- var firestoreContext = context.firestoreContext, firebaseServerActionTransformFunctionFactory = context.firebaseServerActionTransformFunctionFactory, notificationSummaryCollection = context.notificationSummaryCollection; context.notificationCollectionGroup;
4960
+ var firestoreContext = context.firestoreContext, firebaseServerActionTransformFunctionFactory = context.firebaseServerActionTransformFunctionFactory, notificationSummaryCollection = context.notificationSummaryCollection;
4879
4961
  var initializeNotificationSummaryInTransaction = initializeNotificationSummaryInTransactionFactory(context);
4880
4962
  return firebaseServerActionTransformFunctionFactory(firebase.initializeAllApplicableNotificationSummariesParamsType, function() {
4881
4963
  return _async_to_generator$c(function() {
@@ -5229,6 +5311,7 @@ function _ts_generator$b(thisArg, body) {
5229
5311
  * pre-wired with the resolved factory for that type.
5230
5312
  *
5231
5313
  * @param type - the notification template type
5314
+ * @returns a new {@link NotificationTemplateServiceInstance} bound to the given type
5232
5315
  */ key: "templateInstanceForType",
5233
5316
  value: function templateInstanceForType(type) {
5234
5317
  return notificationTemplateServiceInstance(this, type);
@@ -5250,6 +5333,7 @@ exports.NotificationTemplateService = __decorate([
5250
5333
  *
5251
5334
  * @param service - the parent template service
5252
5335
  * @param type - the template type to bind
5336
+ * @returns a {@link NotificationTemplateServiceInstance} with the resolved factory for the type
5253
5337
  *
5254
5338
  * @example
5255
5339
  * ```ts
@@ -5471,6 +5555,7 @@ function _ts_generator$a(thisArg, body) {
5471
5555
  * Does not support Firestore transactions, as running should occur outside of a transaction.
5472
5556
  *
5473
5557
  * @param input - creation and run configuration
5558
+ * @returns the creation pair result with optional send/enqueue outcomes
5474
5559
  * @throws Error if the notification template is not flagged as unique
5475
5560
  *
5476
5561
  * @example
@@ -5829,8 +5914,8 @@ function _ts_generator$9(thisArg, body) {
5829
5914
  /**
5830
5915
  * Creates a new NotificationExpediteServiceInstance with the input NotificationExpediteService.
5831
5916
 
5832
- * @param notificationExpediteService
5833
- * @returns
5917
+ * @param notificationExpediteService - the expedite service to use for sending
5918
+ * @returns a new {@link NotificationExpediteServiceInstance} with an internal queue
5834
5919
  */ function notificationExpediteServiceInstance(notificationExpediteService) {
5835
5920
  var _documentsToSend = [];
5836
5921
  var initialize = function initialize() {
@@ -5849,28 +5934,18 @@ function _ts_generator$9(thisArg, body) {
5849
5934
  };
5850
5935
  var send = function send(options) {
5851
5936
  return _async_to_generator$9(function() {
5852
- var results;
5853
5937
  return _ts_generator$9(this, function(_state) {
5854
- switch(_state.label){
5855
- case 0:
5856
- return [
5857
- 4,
5858
- util.runAsyncTasksForValues(_documentsToSend, function(x) {
5859
- return notificationExpediteService.sendNotification(x, options);
5860
- }, {
5861
- nonConcurrentTaskKeyFactory: function nonConcurrentTaskKeyFactory(x) {
5862
- return x.parent.id // only send one notification at a time for a notification box
5863
- ;
5864
- }
5865
- })
5866
- ];
5867
- case 1:
5868
- results = _state.sent();
5869
- return [
5870
- 2,
5871
- results
5872
- ];
5873
- }
5938
+ return [
5939
+ 2,
5940
+ util.runAsyncTasksForValues(_documentsToSend, function(x) {
5941
+ return notificationExpediteService.sendNotification(x, options);
5942
+ }, {
5943
+ nonConcurrentTaskKeyFactory: function nonConcurrentTaskKeyFactory(x) {
5944
+ return x.parent.id // only send one notification at a time for a notification box
5945
+ ;
5946
+ }
5947
+ })
5948
+ ];
5874
5949
  });
5875
5950
  })();
5876
5951
  };
@@ -5898,6 +5973,8 @@ function _ts_generator$9(thisArg, body) {
5898
5973
  {
5899
5974
  /**
5900
5975
  * Returns the configured NotificationServerActions instance.
5976
+ *
5977
+ * @returns the current {@link NotificationServerActions} instance
5901
5978
  */ key: "getNotificationServerActions",
5902
5979
  value: function getNotificationServerActions() {
5903
5980
  return this._notificationServerActions;
@@ -5906,6 +5983,8 @@ function _ts_generator$9(thisArg, body) {
5906
5983
  {
5907
5984
  /**
5908
5985
  * Sets the NotificationServerActions instance to use.
5986
+ *
5987
+ * @param notificationServerActions - the actions instance to configure
5909
5988
  */ key: "setNotificationServerActions",
5910
5989
  value: function setNotificationServerActions(notificationServerActions) {
5911
5990
  this._notificationServerActions = notificationServerActions;
@@ -5953,6 +6032,8 @@ exports.MutableNotificationExpediteService = __decorate([
5953
6032
  * Provides an instance of MutableNotificationExpediteService and NotificationExpediteService.
5954
6033
  *
5955
6034
  * This should generally be used in the global module of an app.
6035
+ *
6036
+ * @returns an array of NestJS providers for both MutableNotificationExpediteService and NotificationExpediteService
5956
6037
  */ function provideMutableNotificationExpediteService() {
5957
6038
  return [
5958
6039
  exports.MutableNotificationExpediteService,
@@ -5966,7 +6047,10 @@ exports.MutableNotificationExpediteService = __decorate([
5966
6047
  * Convenience function that exports NotificationExpediteService and MutableNotificationExpediteService.
5967
6048
  *
5968
6049
  * This should generally be used in the global module of an app.
5969
- */ function exportMutableNotificationExpediteService() {
6050
+ *
6051
+ * @returns an array of abstract classes to export from the NestJS module
6052
+ */ // eslint-disable-next-line @typescript-eslint/no-explicit-any
6053
+ function exportMutableNotificationExpediteService() {
5970
6054
  return [
5971
6055
  NotificationExpediteService,
5972
6056
  exports.MutableNotificationExpediteService
@@ -5978,7 +6062,7 @@ function _array_like_to_array$5(arr, len) {
5978
6062
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
5979
6063
  return arr2;
5980
6064
  }
5981
- function _array_without_holes$3(arr) {
6065
+ function _array_without_holes$4(arr) {
5982
6066
  if (Array.isArray(arr)) return _array_like_to_array$5(arr);
5983
6067
  }
5984
6068
  function _class_call_check$4(instance, Constructor) {
@@ -5999,10 +6083,10 @@ function _define_property$7(obj, key, value) {
5999
6083
  }
6000
6084
  return obj;
6001
6085
  }
6002
- function _iterable_to_array$3(iter) {
6086
+ function _iterable_to_array$4(iter) {
6003
6087
  if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
6004
6088
  }
6005
- function _non_iterable_spread$3() {
6089
+ function _non_iterable_spread$4() {
6006
6090
  throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
6007
6091
  }
6008
6092
  function _object_spread$7(target) {
@@ -6039,8 +6123,8 @@ function _object_spread_props$7(target, source) {
6039
6123
  }
6040
6124
  return target;
6041
6125
  }
6042
- function _to_consumable_array$3(arr) {
6043
- return _array_without_holes$3(arr) || _iterable_to_array$3(arr) || _unsupported_iterable_to_array$5(arr) || _non_iterable_spread$3();
6126
+ function _to_consumable_array$4(arr) {
6127
+ return _array_without_holes$4(arr) || _iterable_to_array$4(arr) || _unsupported_iterable_to_array$5(arr) || _non_iterable_spread$4();
6044
6128
  }
6045
6129
  function _unsupported_iterable_to_array$5(o, minLen) {
6046
6130
  if (!o) return;
@@ -6054,7 +6138,15 @@ function _unsupported_iterable_to_array$5(o, minLen) {
6054
6138
  /**
6055
6139
  * Factory that assembles the full {@link NotificationServerActionsContext} by combining
6056
6140
  * the base context with the template, send, task, and expedite services.
6057
- */ function notificationServerActionsContextFactory(context, notificationTemplateService, notificationSendService, notificationTaskService, notificationsExpediteService) {
6141
+ *
6142
+ * @param context - the base server actions context
6143
+ * @param notificationTemplateService - resolves message factories for notification template types
6144
+ * @param notificationSendService - handles sending notification messages
6145
+ * @param notificationTaskService - handles notification task dispatch
6146
+ * @param notificationsExpediteService - expedites immediate notification delivery
6147
+ * @returns the assembled {@link NotificationServerActionsContext}
6148
+ */ // eslint-disable-next-line @typescript-eslint/max-params
6149
+ function notificationServerActionsContextFactory(context, notificationTemplateService, notificationSendService, notificationTaskService, notificationsExpediteService) {
6058
6150
  return _object_spread_props$7(_object_spread$7({}, context), {
6059
6151
  notificationTemplateService: notificationTemplateService,
6060
6152
  notificationSendService: notificationSendService,
@@ -6064,12 +6156,19 @@ function _unsupported_iterable_to_array$5(o, minLen) {
6064
6156
  }
6065
6157
  /**
6066
6158
  * Factory that creates a {@link NotificationServerActions} instance from the assembled context.
6067
- */ function notificationServerActionsFactory(context, mutableNotificationExpediteService) {
6159
+ *
6160
+ * @param context - the assembled notification server actions context
6161
+ * @returns a new {@link NotificationServerActions} instance
6162
+ */ function notificationServerActionsFactory(context) {
6068
6163
  return notificationServerActions(context);
6069
6164
  }
6070
6165
  /**
6071
6166
  * Factory that creates a {@link NotificationInitServerActions} instance by merging the
6072
6167
  * server actions context with the init-specific configuration.
6168
+ *
6169
+ * @param context - the assembled notification server actions context
6170
+ * @param notificationInitServerActionsContextConfig - init-specific configuration
6171
+ * @returns a new {@link NotificationInitServerActions} instance
6073
6172
  */ function notificationInitServerActionsFactory(context, notificationInitServerActionsContextConfig) {
6074
6173
  return notificationInitServerActions(_object_spread$7({}, context, notificationInitServerActionsContextConfig));
6075
6174
  }
@@ -6085,9 +6184,8 @@ function _unsupported_iterable_to_array$5(o, minLen) {
6085
6184
  *
6086
6185
  * Be sure the class that delares the module using this function also extends AbstractAppNotificationModule.
6087
6186
  *
6088
- * @param provide
6089
- * @param useFactory
6090
- * @returns
6187
+ * @param config - module metadata configuration including dependency module and additional providers
6188
+ * @returns the assembled {@link ModuleMetadata} for the notification module
6091
6189
  */ function appNotificationModuleMetadata(config$1) {
6092
6190
  var dependencyModule = config$1.dependencyModule, imports = config$1.imports, exports$1 = config$1.exports, providers = config$1.providers;
6093
6191
  var dependencyModuleImport = dependencyModule ? [
@@ -6096,14 +6194,14 @@ function _unsupported_iterable_to_array$5(o, minLen) {
6096
6194
  return {
6097
6195
  imports: [
6098
6196
  config.ConfigModule
6099
- ].concat(_to_consumable_array$3(dependencyModuleImport), _to_consumable_array$3(imports !== null && imports !== void 0 ? imports : [])),
6197
+ ].concat(_to_consumable_array$4(dependencyModuleImport), _to_consumable_array$4(imports !== null && imports !== void 0 ? imports : [])),
6100
6198
  exports: [
6101
6199
  NOTIFICATION_SERVER_ACTION_CONTEXT_TOKEN,
6102
6200
  NotificationExpediteService,
6103
6201
  exports.NotificationTemplateService,
6104
6202
  NotificationServerActions,
6105
6203
  NotificationInitServerActions
6106
- ].concat(_to_consumable_array$3(exports$1 !== null && exports$1 !== void 0 ? exports$1 : [])),
6204
+ ].concat(_to_consumable_array$4(exports$1 !== null && exports$1 !== void 0 ? exports$1 : [])),
6107
6205
  providers: [
6108
6206
  {
6109
6207
  provide: NotificationExpediteService,
@@ -6128,8 +6226,7 @@ function _unsupported_iterable_to_array$5(o, minLen) {
6128
6226
  provide: NotificationServerActions,
6129
6227
  useFactory: notificationServerActionsFactory,
6130
6228
  inject: [
6131
- NOTIFICATION_SERVER_ACTION_CONTEXT_TOKEN,
6132
- NotificationExpediteService
6229
+ NOTIFICATION_SERVER_ACTION_CONTEXT_TOKEN
6133
6230
  ]
6134
6231
  },
6135
6232
  {
@@ -6140,7 +6237,7 @@ function _unsupported_iterable_to_array$5(o, minLen) {
6140
6237
  NOTIFICATION_INIT_SERVER_ACTIONS_CONTEXT_CONFIG_TOKEN
6141
6238
  ]
6142
6239
  }
6143
- ].concat(_to_consumable_array$3(providers !== null && providers !== void 0 ? providers : []))
6240
+ ].concat(_to_consumable_array$4(providers !== null && providers !== void 0 ? providers : []))
6144
6241
  };
6145
6242
  }
6146
6243
  /**
@@ -6175,6 +6272,9 @@ function _array_like_to_array$4(arr, len) {
6175
6272
  function _array_with_holes$1(arr) {
6176
6273
  if (Array.isArray(arr)) return arr;
6177
6274
  }
6275
+ function _array_without_holes$3(arr) {
6276
+ if (Array.isArray(arr)) return _array_like_to_array$4(arr);
6277
+ }
6178
6278
  function asyncGeneratorStep$8(gen, resolve, reject, _next, _throw, key, arg) {
6179
6279
  try {
6180
6280
  var info = gen[key](arg);
@@ -6217,6 +6317,9 @@ function _define_property$6(obj, key, value) {
6217
6317
  }
6218
6318
  return obj;
6219
6319
  }
6320
+ function _iterable_to_array$3(iter) {
6321
+ if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
6322
+ }
6220
6323
  function _iterable_to_array_limit$1(arr, i) {
6221
6324
  var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
6222
6325
  if (_i == null) return;
@@ -6244,6 +6347,9 @@ function _iterable_to_array_limit$1(arr, i) {
6244
6347
  function _non_iterable_rest$1() {
6245
6348
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
6246
6349
  }
6350
+ function _non_iterable_spread$3() {
6351
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
6352
+ }
6247
6353
  function _object_spread$6(target) {
6248
6354
  for(var i = 1; i < arguments.length; i++){
6249
6355
  var source = arguments[i] != null ? arguments[i] : {};
@@ -6281,6 +6387,9 @@ function _object_spread_props$6(target, source) {
6281
6387
  function _sliced_to_array$1(arr, i) {
6282
6388
  return _array_with_holes$1(arr) || _iterable_to_array_limit$1(arr, i) || _unsupported_iterable_to_array$4(arr, i) || _non_iterable_rest$1();
6283
6389
  }
6390
+ function _to_consumable_array$3(arr) {
6391
+ return _array_without_holes$3(arr) || _iterable_to_array$3(arr) || _unsupported_iterable_to_array$4(arr) || _non_iterable_spread$3();
6392
+ }
6284
6393
  function _unsupported_iterable_to_array$4(o, minLen) {
6285
6394
  if (!o) return;
6286
6395
  if (typeof o === "string") return _array_like_to_array$4(o, minLen);
@@ -6399,6 +6508,7 @@ function _ts_generator$8(thisArg, body) {
6399
6508
  * Each summary update runs in a Firestore transaction to prevent concurrent write conflicts.
6400
6509
  *
6401
6510
  * @param config - service configuration including Firestore context and collection references
6511
+ * @returns a {@link NotificationSummarySendService} backed by Firestore
6402
6512
  *
6403
6513
  * @example
6404
6514
  * ```ts
@@ -6432,6 +6542,7 @@ function _ts_generator$8(thisArg, body) {
6432
6542
  cutMessage = util.cutStringFunction({
6433
6543
  maxLength: firebase.NOTIFICATION_SUMMARY_EMBEDDED_NOTIFICATION_ITEM_MESSAGE_MAX_LENGTH
6434
6544
  });
6545
+ // eslint-disable-next-line @typescript-eslint/no-empty-object-type
6435
6546
  messagesGroups = messagesGroupedByNotificationSummaryMapBuilder.entries();
6436
6547
  return [
6437
6548
  2,
@@ -6478,7 +6589,7 @@ function _ts_generator$8(thisArg, body) {
6478
6589
  });
6479
6590
  if (messagesToSend.length > 0) {
6480
6591
  // add the new items to existing n, then keep the last 1000
6481
- sortedN = existingMessages.concat(messagesToSend.map(function(x) {
6592
+ sortedN = _to_consumable_array$3(existingMessages).concat(_to_consumable_array$3(messagesToSend.map(function(x) {
6482
6593
  var message = '';
6483
6594
  if (x.content.openingMessage) {
6484
6595
  message = x.content.openingMessage;
@@ -6491,7 +6602,7 @@ function _ts_generator$8(thisArg, body) {
6491
6602
  g: cutMessage(message)
6492
6603
  });
6493
6604
  return item;
6494
- })).sort(firebase.sortNotificationItemsFunction);
6605
+ }))).sort(firebase.sortNotificationItemsFunction);
6495
6606
  n = util.takeLast(sortedN, firebase.NOTIFICATION_SUMMARY_ITEM_LIMIT);
6496
6607
  updateTemplate = {
6497
6608
  n: n,
@@ -6719,6 +6830,8 @@ function _ts_generator$7(thisArg, body) {
6719
6830
  * Useful as a placeholder when your app's notification pipeline is fully wired for SMS
6720
6831
  * but actual delivery is not yet enabled, avoiding the need for conditional logic elsewhere.
6721
6832
  *
6833
+ * @returns a no-op {@link NotificationTextSendService} that ignores all messages
6834
+ *
6722
6835
  * @example
6723
6836
  * ```ts
6724
6837
  * const textService = ignoreSendNotificationTextSendService();
@@ -6898,6 +7011,7 @@ function _ts_generator$6(thisArg, body) {
6898
7011
  * If all checkpoints are complete, the task is marked as done.
6899
7012
  *
6900
7013
  * @param config - handler configurations and optional validation list
7014
+ * @returns a {@link NotificationTaskService} that dispatches tasks to the registered handlers
6901
7015
  *
6902
7016
  * @example
6903
7017
  * ```ts
@@ -6920,6 +7034,7 @@ function _ts_generator$6(thisArg, body) {
6920
7034
  var type = handlerConfig.type;
6921
7035
  handlers[type] = handlerForConfig(handlerConfig);
6922
7036
  });
7037
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
6923
7038
  function handlerForConfig(handlerConfig) {
6924
7039
  var inputFlows = handlerConfig.flow, allowRunMultipleParts = handlerConfig.allowRunMultipleParts;
6925
7040
  var _separateValues = util.separateValues(inputFlows, function(x) {
@@ -6943,14 +7058,16 @@ function _ts_generator$6(thisArg, body) {
6943
7058
  fn = (_this = (_nonCheckpointFlows_ = nonCheckpointFlows[0]) !== null && _nonCheckpointFlows_ !== void 0 ? _nonCheckpointFlows_ : checkpointFlows[0]) === null || _this === void 0 ? void 0 : _this.fn;
6944
7059
  break;
6945
7060
  default:
6946
- completedCheckpointsSet = new Set(completedCheckpoints);
6947
- /**
7061
+ {
7062
+ completedCheckpointsSet = new Set(completedCheckpoints);
7063
+ /**
6948
7064
  * Find the next flow function that hasn't had its checkpoint completed yet.
6949
7065
  */ nextCheckpoint = checkpointFlows.find(function(x) {
6950
- return !completedCheckpointsSet.has(x.checkpoint);
6951
- });
6952
- fn = nextCheckpoint === null || nextCheckpoint === void 0 ? void 0 : nextCheckpoint.fn;
6953
- break;
7066
+ return !completedCheckpointsSet.has(x.checkpoint);
7067
+ });
7068
+ fn = nextCheckpoint === null || nextCheckpoint === void 0 ? void 0 : nextCheckpoint.fn;
7069
+ break;
7070
+ }
6954
7071
  }
6955
7072
  if (!fn) return [
6956
7073
  3,
@@ -7277,6 +7394,7 @@ function _ts_generator$5(thisArg, body) {
7277
7394
  * such as storage file processing or other async workflows.
7278
7395
  *
7279
7396
  * @param factoryConfig - shared configuration including the input function, cleanup logic, and task type
7397
+ * @returns a factory function that produces {@link NotificationTaskServiceTaskHandlerConfig} entries
7280
7398
  *
7281
7399
  * @example
7282
7400
  * ```ts
@@ -7299,6 +7417,9 @@ function _ts_generator$5(thisArg, body) {
7299
7417
  return function(subtaskHandlerConfig) {
7300
7418
  var processorFunctionForConfig = /**
7301
7419
  * Structure is similar to notificationTaskService(), but contained to handle the subtasks.
7420
+ *
7421
+ * @param processorConfig - the processor configuration with target, flow, and cleanup
7422
+ * @returns a processor with process and optional cleanup functions
7302
7423
  */ function processorFunctionForConfig(processorConfig) {
7303
7424
  var inputFlows = processorConfig.flow, cleanup = processorConfig.cleanup, processorAllowRunMultipleParts = processorConfig.allowRunMultipleParts;
7304
7425
  var _separateValues = util.separateValues(inputFlows, function(x) {
@@ -7326,14 +7447,16 @@ function _ts_generator$5(thisArg, body) {
7326
7447
  fn = (_this = (_nonSubtaskFlows_ = nonSubtaskFlows[0]) !== null && _nonSubtaskFlows_ !== void 0 ? _nonSubtaskFlows_ : subtaskFlows[0]) === null || _this === void 0 ? void 0 : _this.fn;
7327
7448
  break;
7328
7449
  default:
7329
- completedSubtasksSet = new Set(completedSubtasks);
7330
- /**
7450
+ {
7451
+ completedSubtasksSet = new Set(completedSubtasks);
7452
+ /**
7331
7453
  * Find the next flow function that hasn't had its checkpoint completed yet.
7332
7454
  */ nextSubtask = subtaskFlows.find(function(x) {
7333
- return !completedSubtasksSet.has(x.subtask);
7334
- });
7335
- fn = nextSubtask === null || nextSubtask === void 0 ? void 0 : nextSubtask.fn;
7336
- break;
7455
+ return !completedSubtasksSet.has(x.subtask);
7456
+ });
7457
+ fn = nextSubtask === null || nextSubtask === void 0 ? void 0 : nextSubtask.fn;
7458
+ break;
7459
+ }
7337
7460
  }
7338
7461
  if (!fn) return [
7339
7462
  3,
@@ -7358,13 +7481,15 @@ function _ts_generator$5(thisArg, body) {
7358
7481
  sfps = removeFromCompletionsArrayWithTaskResult(sfps, subtaskResult);
7359
7482
  break;
7360
7483
  default:
7361
- sfps = util.unique(_to_consumable_array$2(removeFromCompletionsArrayWithTaskResult(sfps, subtaskResult)).concat(_to_consumable_array$2(util.asArray(subtaskCompletion))));
7362
- completedSubtasksSet1 = new Set(sfps);
7363
- incompleteSubtasks = allKnownSubtasks.filter(function(x) {
7364
- return !completedSubtasksSet1.has(x);
7365
- });
7366
- allSubtasksDone = incompleteSubtasks.length === 0;
7367
- break;
7484
+ {
7485
+ sfps = util.unique(_to_consumable_array$2(removeFromCompletionsArrayWithTaskResult(sfps, subtaskResult)).concat(_to_consumable_array$2(util.asArray(subtaskCompletion))));
7486
+ completedSubtasksSet1 = new Set(sfps);
7487
+ incompleteSubtasks = allKnownSubtasks.filter(function(x) {
7488
+ return !completedSubtasksSet1.has(x);
7489
+ });
7490
+ allSubtasksDone = incompleteSubtasks.length === 0;
7491
+ break;
7492
+ }
7368
7493
  }
7369
7494
  // configure the update metadata result
7370
7495
  sd = _object_spread$5({}, subtaskData, subtaskUpdateMetadata);
@@ -7578,7 +7703,7 @@ function _ts_generator$5(thisArg, body) {
7578
7703
  8
7579
7704
  ];
7580
7705
  processor = processors[target];
7581
- if (!(processor && processor.cleanup)) return [
7706
+ if (!(processor === null || processor === void 0 ? void 0 : processor.cleanup)) return [
7582
7707
  3,
7583
7708
  5
7584
7709
  ];
@@ -7691,12 +7816,16 @@ function _ts_generator$5(thisArg, body) {
7691
7816
  }(makeError.BaseError);
7692
7817
  /**
7693
7818
  * Creates a NotificationTaskSubTaskMissingRequiredDataTermination.
7819
+ *
7820
+ * @returns a new {@link NotificationTaskSubTaskMissingRequiredDataTermination} error instance
7694
7821
  */ function notificationTaskSubTaskMissingRequiredDataTermination() {
7695
7822
  return new NotificationTaskSubTaskMissingRequiredDataTermination();
7696
7823
  }
7697
7824
 
7698
7825
  /**
7699
7826
  * Creates an error indicating that a storage file model has already been initialized.
7827
+ *
7828
+ * @returns a precondition-conflict HttpsError with the STORAGE_FILE_MODEL_ALREADY_INITIALIZED error code
7700
7829
  */ function storageFileModelAlreadyInitializedError() {
7701
7830
  return firebaseServer.preconditionConflictError({
7702
7831
  message: "This model has already been initialized.",
@@ -7705,6 +7834,8 @@ function _ts_generator$5(thisArg, body) {
7705
7834
  }
7706
7835
  /**
7707
7836
  * Creates an error indicating that the StorageFile is not flagged for group sync.
7837
+ *
7838
+ * @returns a precondition-conflict HttpsError with the STORAGE_FILE_NOT_FLAGGED_FOR_GROUPS_SYNC error code
7708
7839
  */ function storageFileNotFlaggedForGroupsSyncError() {
7709
7840
  return firebaseServer.preconditionConflictError({
7710
7841
  message: "This StorageFile has not been flagged for sync with its groups.",
@@ -7713,6 +7844,8 @@ function _ts_generator$5(thisArg, body) {
7713
7844
  }
7714
7845
  /**
7715
7846
  * Creates an error indicating that the target uploaded file does not exist in storage.
7847
+ *
7848
+ * @returns a precondition-conflict HttpsError with the UPLOADED_FILE_DOES_NOT_EXIST error code
7716
7849
  */ function uploadedFileDoesNotExistError() {
7717
7850
  return firebaseServer.preconditionConflictError({
7718
7851
  message: "The target uploaded file does not exist.",
@@ -7721,6 +7854,8 @@ function _ts_generator$5(thisArg, body) {
7721
7854
  }
7722
7855
  /**
7723
7856
  * Creates an error indicating that the file is not allowed to be initialized (rejected by the check function).
7857
+ *
7858
+ * @returns a precondition-conflict HttpsError with the UPLOADED_FILE_NOT_ALLOWED_TO_BE_INITIALIZED error code
7724
7859
  */ function uploadedFileIsNotAllowedToBeInitializedError() {
7725
7860
  return firebaseServer.preconditionConflictError({
7726
7861
  message: "The target uploaded file is not allowed to be initialized.",
@@ -7731,6 +7866,7 @@ function _ts_generator$5(thisArg, body) {
7731
7866
  * Creates an error indicating that the file initialization failed with the given result type.
7732
7867
  *
7733
7868
  * @param data - error data containing the result type that caused the failure
7869
+ * @returns an internal-server HttpsError with the UPLOADED_FILE_INITIALIZATION_FAILED error code and the result type
7734
7870
  */ function uploadedFileInitializationFailedError(data) {
7735
7871
  return firebaseServer.internalServerError({
7736
7872
  message: 'The target uploaded file initialization failed with result type "'.concat(data.resultType, '".'),
@@ -7742,6 +7878,8 @@ function _ts_generator$5(thisArg, body) {
7742
7878
  }
7743
7879
  /**
7744
7880
  * Creates an error indicating that the initialization result was discarded (e.g., the created file no longer exists).
7881
+ *
7882
+ * @returns an internal-server HttpsError with the UPLOADED_FILE_INITIALIZATION_DISCARDED error code
7745
7883
  */ function uploadedFileInitializationDiscardedError() {
7746
7884
  return firebaseServer.internalServerError({
7747
7885
  message: "The target uploaded file initialization was discarded.",
@@ -7750,6 +7888,8 @@ function _ts_generator$5(thisArg, body) {
7750
7888
  }
7751
7889
  /**
7752
7890
  * Creates an error indicating that the StorageFile is not in a valid state for processing.
7891
+ *
7892
+ * @returns a precondition-conflict HttpsError with the STORAGE_FILE_PROCESSING_NOT_ALLOWED_FOR_INVALID_STATE error code
7753
7893
  */ function storageFileProcessingNotAllowedForInvalidStateError() {
7754
7894
  return firebaseServer.preconditionConflictError({
7755
7895
  message: "The target StorageFileDocument must be in an OK state to be processed and processing not flagged as SHOULD_NOT_PROCESS.",
@@ -7758,6 +7898,8 @@ function _ts_generator$5(thisArg, body) {
7758
7898
  }
7759
7899
  /**
7760
7900
  * Creates an error indicating that the StorageFile is not queued for processing.
7901
+ *
7902
+ * @returns a precondition-conflict HttpsError with the STORAGE_FILE_PROCESSING_NOT_QUEUED_FOR_PROCESSING error code
7761
7903
  */ function storageFileProcessingNotQueuedForProcessingError() {
7762
7904
  return firebaseServer.preconditionConflictError({
7763
7905
  message: "The target StorageFileDocument is not queued for processing.",
@@ -7766,6 +7908,8 @@ function _ts_generator$5(thisArg, body) {
7766
7908
  }
7767
7909
  /**
7768
7910
  * Creates an error indicating that no processor is configured for the StorageFile's type.
7911
+ *
7912
+ * @returns a precondition-conflict HttpsError with the STORAGE_FILE_PROCESSING_NOT_AVAILABLE_FOR_TYPE error code
7769
7913
  */ function storageFileProcessingNotAvailableForTypeError() {
7770
7914
  return firebaseServer.preconditionConflictError({
7771
7915
  message: "The target StorageFileDocument is not available for processing.",
@@ -7774,6 +7918,8 @@ function _ts_generator$5(thisArg, body) {
7774
7918
  }
7775
7919
  /**
7776
7920
  * Creates an error indicating that the StorageFile has already finished processing.
7921
+ *
7922
+ * @returns a precondition-conflict HttpsError with the STORAGE_FILE_ALREADY_PROCESSED error code
7777
7923
  */ function storageFileAlreadyProcessedError() {
7778
7924
  return firebaseServer.preconditionConflictError({
7779
7925
  message: "The target StorageFileDocument has already finished processing.",
@@ -7782,6 +7928,8 @@ function _ts_generator$5(thisArg, body) {
7782
7928
  }
7783
7929
  /**
7784
7930
  * Creates an error indicating that the StorageFile is not flagged for deletion.
7931
+ *
7932
+ * @returns a precondition-conflict HttpsError with the STORAGE_FILE_NOT_FLAGGED_FOR_DELETION error code
7785
7933
  */ function storageFileNotFlaggedForDeletionError() {
7786
7934
  return firebaseServer.preconditionConflictError({
7787
7935
  message: "The target StorageFileDocument is not flagged for deletion.",
@@ -7790,6 +7938,8 @@ function _ts_generator$5(thisArg, body) {
7790
7938
  }
7791
7939
  /**
7792
7940
  * Creates an error indicating that the StorageFile's scheduled deletion time has not yet passed.
7941
+ *
7942
+ * @returns a precondition-conflict HttpsError with the STORAGE_FILE_CANNOT_BE_DELETED_YET error code
7793
7943
  */ function storageFileCannotBeDeletedYetError() {
7794
7944
  return firebaseServer.preconditionConflictError({
7795
7945
  message: "The target StorageFileDocument cannot be deleted yet.",
@@ -7798,6 +7948,8 @@ function _ts_generator$5(thisArg, body) {
7798
7948
  }
7799
7949
  /**
7800
7950
  * Creates an error indicating that the StorageFileGroup is still queued for initialization and cannot be operated on.
7951
+ *
7952
+ * @returns a precondition-conflict HttpsError with the STORAGE_FILE_GROUP_QUEUED_FOR_INITIALIZATION error code
7801
7953
  */ function storageFileGroupQueuedForInitializationError() {
7802
7954
  return firebaseServer.preconditionConflictError({
7803
7955
  message: "The target StorageFileGroupDocument is queued for initialization.",
@@ -7806,6 +7958,8 @@ function _ts_generator$5(thisArg, body) {
7806
7958
  }
7807
7959
  /**
7808
7960
  * Creates an error indicating that the required model key or storageFileId is missing when creating a StorageFileGroup.
7961
+ *
7962
+ * @returns a precondition-conflict HttpsError with the STORAGE_FILE_GROUP_CREATE_INPUT error code
7809
7963
  */ function createStorageFileGroupInputError() {
7810
7964
  return firebaseServer.preconditionConflictError({
7811
7965
  message: "The model or storageFileId is required for creating a StorageFileGroup.",
@@ -7895,10 +8049,6 @@ function _iterable_to_array_limit(arr, i) {
7895
8049
  function _non_iterable_rest() {
7896
8050
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
7897
8051
  }
7898
- function _object_destructuring_empty(o) {
7899
- if (o === null || o === void 0) throw new TypeError("Cannot destructure " + o);
7900
- return o;
7901
- }
7902
8052
  function _object_spread$4(target) {
7903
8053
  for(var i = 1; i < arguments.length; i++){
7904
8054
  var source = arguments[i] != null ? arguments[i] : {};
@@ -8075,6 +8225,9 @@ function _ts_generator$4(thisArg, body) {
8075
8225
  *
8076
8226
  * @param context - the fully assembled storage file server actions context
8077
8227
  *
8228
+ * @param context - the fully assembled storage file server actions context
8229
+ * @returns a concrete {@link StorageFileServerActions} with all action methods wired to their factories
8230
+ *
8078
8231
  * @example
8079
8232
  * ```ts
8080
8233
  * const actions = storageFileServerActions(context);
@@ -8105,23 +8258,23 @@ function _ts_generator$4(thisArg, body) {
8105
8258
  * Factory for the `createStorageFile` action.
8106
8259
  *
8107
8260
  * Creates a new {@link StorageFile} document using the provided template data.
8261
+ *
8262
+ * @param context - the base server actions context providing Firestore and storage access
8263
+ * @returns an async transform-and-validate function that creates a StorageFile document
8108
8264
  */ function createStorageFileFactory(context) {
8109
- context.storageFileCollection; context.firestoreContext; var firebaseServerActionTransformFunctionFactory = context.firebaseServerActionTransformFunctionFactory;
8265
+ var firebaseServerActionTransformFunctionFactory = context.firebaseServerActionTransformFunctionFactory;
8110
8266
  return firebaseServerActionTransformFunctionFactory(firebase.createStorageFileParamsType, function(params) {
8111
8267
  return _async_to_generator$4(function() {
8112
8268
  return _ts_generator$4(this, function(_state) {
8113
- _object_destructuring_empty(params);
8114
8269
  return [
8115
8270
  2,
8116
8271
  function() {
8117
8272
  return _async_to_generator$4(function() {
8118
- var storageFileDocument;
8119
8273
  return _ts_generator$4(this, function(_state) {
8120
- storageFileDocument = null;
8121
8274
  // TODO: check the file exists, and pull the metadata, and create the document
8122
8275
  return [
8123
8276
  2,
8124
- storageFileDocument
8277
+ null
8125
8278
  ];
8126
8279
  });
8127
8280
  })();
@@ -8137,6 +8290,9 @@ function _ts_generator$4(thisArg, body) {
8137
8290
  * Scans the uploads folder in Firebase Storage, identifies new uploaded files,
8138
8291
  * initializes each one via the upload service, and cleans up the source upload
8139
8292
  * on success. Failed initializations are logged but do not halt the batch.
8293
+ *
8294
+ * @param context - the storage file server actions context with storage service and upload initialization
8295
+ * @returns an async transform-and-validate function that returns batch initialization results
8140
8296
  */ function initializeAllStorageFilesFromUploadsFactory(context) {
8141
8297
  var storageService = context.storageService, firebaseServerActionTransformFunctionFactory = context.firebaseServerActionTransformFunctionFactory;
8142
8298
  var _initializeStorageFileFromUploadFile = _initializeStorageFileFromUploadFileFactory(context);
@@ -8230,7 +8386,15 @@ function _ts_generator$4(thisArg, body) {
8230
8386
  })();
8231
8387
  });
8232
8388
  }
8233
- function _initializeStorageFileFromUploadFileFactory(context) {
8389
+ /**
8390
+ * Internal factory that creates a function to initialize a {@link StorageFile} from an uploaded file.
8391
+ *
8392
+ * Validates the file exists and is allowed, runs the upload initializer, deletes the upload source
8393
+ * on success, and optionally expedites processing of the created storage file.
8394
+ *
8395
+ * @param context - the storage file server actions context
8396
+ * @returns an async function that accepts an upload file input and returns the created StorageFileDocument
8397
+ */ function _initializeStorageFileFromUploadFileFactory(context) {
8234
8398
  var firestoreContext = context.firestoreContext, storageFileInitializeFromUploadService = context.storageFileInitializeFromUploadService, notificationExpediteService = context.notificationExpediteService;
8235
8399
  var processStorageFileInTransaction = _processStorageFileInTransactionFactory(context);
8236
8400
  return function(input) {
@@ -8358,7 +8522,7 @@ function _initializeStorageFileFromUploadFileFactory(context) {
8358
8522
  11
8359
8523
  ];
8360
8524
  storageFileDocument = initializationResult.storageFileDocument;
8361
- if (!(storageFileDocument != null && expediteProcessing)) return [
8525
+ if (!expediteProcessing) return [
8362
8526
  3,
8363
8527
  10
8364
8528
  ];
@@ -8494,6 +8658,9 @@ function _initializeStorageFileFromUploadFileFactory(context) {
8494
8658
  * Initializes a single {@link StorageFile} from an uploaded file at the given storage path.
8495
8659
  * Validates the file exists and is allowed, runs the type determiner and initializer,
8496
8660
  * then cleans up the upload source on success.
8661
+ *
8662
+ * @param context - the storage file server actions context with storage and upload services
8663
+ * @returns an async transform-and-validate function that creates a StorageFile from an upload
8497
8664
  */ function initializeStorageFileFromUploadFactory(context) {
8498
8665
  var storageService = context.storageService, firebaseServerActionTransformFunctionFactory = context.firebaseServerActionTransformFunctionFactory;
8499
8666
  var _initializeStorageFileFromUploadFile = _initializeStorageFileFromUploadFileFactory(context);
@@ -8527,8 +8694,15 @@ function _initializeStorageFileFromUploadFileFactory(context) {
8527
8694
  })();
8528
8695
  });
8529
8696
  }
8530
- function updateStorageFileFactory(context) {
8531
- context.storageFileCollection; context.firestoreContext; var firebaseServerActionTransformFunctionFactory = context.firebaseServerActionTransformFunctionFactory;
8697
+ /**
8698
+ * Factory for the `updateStorageFile` action.
8699
+ *
8700
+ * Updates an existing {@link StorageFile} document with the provided schedule-delete-at time.
8701
+ *
8702
+ * @param context - the base server actions context providing Firestore access
8703
+ * @returns an async transform-and-validate function that updates a StorageFile document
8704
+ */ function updateStorageFileFactory(context) {
8705
+ var firebaseServerActionTransformFunctionFactory = context.firebaseServerActionTransformFunctionFactory;
8532
8706
  return firebaseServerActionTransformFunctionFactory(firebase.updateStorageFileParamsType, function(params) {
8533
8707
  return _async_to_generator$4(function() {
8534
8708
  var sdat;
@@ -8564,7 +8738,15 @@ function updateStorageFileFactory(context) {
8564
8738
  })();
8565
8739
  });
8566
8740
  }
8567
- function updateStorageFileGroupFactory(context) {
8741
+ /**
8742
+ * Factory for the `updateStorageFileGroup` action.
8743
+ *
8744
+ * Updates embedded file entries within a {@link StorageFileGroup} document inside a
8745
+ * Firestore transaction, merging display name changes into the existing entries.
8746
+ *
8747
+ * @param context - the storage file server actions context
8748
+ * @returns an async transform-and-validate function that updates a StorageFileGroup document
8749
+ */ function updateStorageFileGroupFactory(context) {
8568
8750
  var firestoreContext = context.firestoreContext, storageFileGroupCollection = context.storageFileGroupCollection, firebaseServerActionTransformFunctionFactory = context.firebaseServerActionTransformFunctionFactory;
8569
8751
  return firebaseServerActionTransformFunctionFactory(firebase.updateStorageFileGroupParamsType, function(params) {
8570
8752
  return _async_to_generator$4(function() {
@@ -8646,10 +8828,13 @@ function updateStorageFileGroupFactory(context) {
8646
8828
  * Batch-processes all {@link StorageFile} documents queued for processing. Creates a
8647
8829
  * processing notification task for each file and optionally expedites delivery.
8648
8830
  * Handles stuck-processing detection with a throttle check.
8831
+ *
8832
+ * @param context - the storage file server actions context
8833
+ * @returns an async transform-and-validate function that returns batch processing results
8649
8834
  */ function processAllQueuedStorageFilesFactory(context) {
8650
8835
  var storageFileCollection = context.storageFileCollection, firebaseServerActionTransformFunctionFactory = context.firebaseServerActionTransformFunctionFactory;
8651
8836
  var processStorageFile = processStorageFileFactory(context);
8652
- return firebaseServerActionTransformFunctionFactory(firebase.processAllQueuedStorageFilesParamsType, function(params) {
8837
+ return firebaseServerActionTransformFunctionFactory(firebase.processAllQueuedStorageFilesParamsType, function(_params) {
8653
8838
  return _async_to_generator$4(function() {
8654
8839
  return _ts_generator$4(this, function(_state) {
8655
8840
  return [
@@ -8733,7 +8918,15 @@ function updateStorageFileGroupFactory(context) {
8733
8918
  })();
8734
8919
  });
8735
8920
  }
8736
- function _processStorageFileInTransactionFactory(context) {
8921
+ /**
8922
+ * Internal factory that creates a function for processing a {@link StorageFile} within a Firestore transaction.
8923
+ *
8924
+ * Creates or restarts a notification task for the file based on its current processing state,
8925
+ * handling stuck-processing detection, forced restarts, and re-processing of already-successful files.
8926
+ *
8927
+ * @param context - the storage file server actions context
8928
+ * @returns an async function that processes a storage file within a transaction
8929
+ */ function _processStorageFileInTransactionFactory(context) {
8737
8930
  var storageFileCollection = context.storageFileCollection, notificationCollectionGroup = context.notificationCollectionGroup;
8738
8931
  return function(input, transaction) {
8739
8932
  return _async_to_generator$4(function() {
@@ -8823,20 +9016,30 @@ function _processStorageFileInTransactionFactory(context) {
8823
9016
  3,
8824
9017
  10
8825
9018
  ];
8826
- case firebase.StorageFileProcessingState.DO_NOT_PROCESS:
9019
+ case firebase.StorageFileProcessingState.FAILED:
8827
9020
  return [
8828
9021
  3,
8829
9022
  20
8830
9023
  ];
9024
+ case firebase.StorageFileProcessingState.DO_NOT_PROCESS:
9025
+ return [
9026
+ 3,
9027
+ 22
9028
+ ];
8831
9029
  case firebase.StorageFileProcessingState.SUCCESS:
8832
9030
  return [
8833
9031
  3,
8834
- 21
9032
+ 23
9033
+ ];
9034
+ case firebase.StorageFileProcessingState.ARCHIVED:
9035
+ return [
9036
+ 3,
9037
+ 27
8835
9038
  ];
8836
9039
  }
8837
9040
  return [
8838
9041
  3,
8839
- 25
9042
+ 28
8840
9043
  ];
8841
9044
  case 4:
8842
9045
  if (!!storageFile.p) return [
@@ -8855,7 +9058,7 @@ function _processStorageFileInTransactionFactory(context) {
8855
9058
  case 7:
8856
9059
  return [
8857
9060
  3,
8858
- 25
9061
+ 28
8859
9062
  ];
8860
9063
  case 8:
8861
9064
  // begin processing
@@ -8867,7 +9070,7 @@ function _processStorageFileInTransactionFactory(context) {
8867
9070
  _state.sent();
8868
9071
  return [
8869
9072
  3,
8870
- 25
9073
+ 28
8871
9074
  ];
8872
9075
  case 10:
8873
9076
  // check if the processing task is still running
@@ -8941,33 +9144,47 @@ function _processStorageFileInTransactionFactory(context) {
8941
9144
  case 19:
8942
9145
  return [
8943
9146
  3,
8944
- 25
9147
+ 28
8945
9148
  ];
8946
9149
  case 20:
8947
- throw storageFileProcessingNotQueuedForProcessingError();
9150
+ // restart processing on failure
9151
+ return [
9152
+ 4,
9153
+ beginProcessing(true)
9154
+ ];
8948
9155
  case 21:
9156
+ _state.sent();
9157
+ return [
9158
+ 3,
9159
+ 28
9160
+ ];
9161
+ case 22:
9162
+ throw storageFileProcessingNotQueuedForProcessingError();
9163
+ case 23:
8949
9164
  if (!(forceRestartProcessing || processAgainIfSuccessful)) return [
8950
9165
  3,
8951
- 23
9166
+ 25
8952
9167
  ];
8953
9168
  return [
8954
9169
  4,
8955
9170
  beginProcessing(true)
8956
9171
  ];
8957
- case 22:
9172
+ case 24:
8958
9173
  _state.sent();
8959
9174
  return [
8960
9175
  3,
8961
- 24
9176
+ 26
8962
9177
  ];
8963
- case 23:
9178
+ case 25:
8964
9179
  throw storageFileAlreadyProcessedError();
8965
- case 24:
9180
+ case 26:
8966
9181
  return [
8967
9182
  3,
8968
- 25
9183
+ 28
8969
9184
  ];
8970
- case 25:
9185
+ case 27:
9186
+ throw storageFileProcessingNotQueuedForProcessingError();
9187
+ case 28:
8971
9188
  return [
8972
9189
  2
8973
9190
  ];
@@ -8981,6 +9198,9 @@ function _processStorageFileInTransactionFactory(context) {
8981
9198
  *
8982
9199
  * Processes a single {@link StorageFile} by creating a notification task for it
8983
9200
  * and marking it as processing. Validates the file is in a valid state for processing.
9201
+ *
9202
+ * @param context - the storage file server actions context
9203
+ * @returns an async transform-and-validate function that processes a single StorageFile
8984
9204
  */ function processStorageFileFactory(context) {
8985
9205
  var firestoreContext = context.firestoreContext, notificationExpediteService = context.notificationExpediteService, firebaseServerActionTransformFunctionFactory = context.firebaseServerActionTransformFunctionFactory;
8986
9206
  var processStorageFileInTransaction = _processStorageFileInTransactionFactory(context);
@@ -9064,10 +9284,13 @@ function _processStorageFileInTransactionFactory(context) {
9064
9284
  * Batch-deletes all {@link StorageFile} documents flagged for deletion whose
9065
9285
  * scheduled delete time has passed. Removes both the Firestore document and
9066
9286
  * the associated file in Cloud Storage.
9287
+ *
9288
+ * @param context - the storage file server actions context
9289
+ * @returns an async transform-and-validate function that returns batch deletion results
9067
9290
  */ function deleteAllQueuedStorageFilesFactory(context) {
9068
9291
  var storageFileCollection = context.storageFileCollection, firebaseServerActionTransformFunctionFactory = context.firebaseServerActionTransformFunctionFactory;
9069
9292
  var deleteStorageFile = deleteStorageFileFactory(context);
9070
- return firebaseServerActionTransformFunctionFactory(firebase.deleteAllQueuedStorageFilesParamsType, function(params) {
9293
+ return firebaseServerActionTransformFunctionFactory(firebase.deleteAllQueuedStorageFilesParamsType, function(_params) {
9071
9294
  return _async_to_generator$4(function() {
9072
9295
  return _ts_generator$4(this, function(_state) {
9073
9296
  return [
@@ -9158,6 +9381,9 @@ function _processStorageFileInTransactionFactory(context) {
9158
9381
  *
9159
9382
  * Deletes a single {@link StorageFile} document and its associated Cloud Storage file.
9160
9383
  * Validates the file is flagged for deletion and the scheduled delete time has passed.
9384
+ *
9385
+ * @param context - the storage file server actions context
9386
+ * @returns an async transform-and-validate function that deletes a StorageFile and its storage object
9161
9387
  */ function deleteStorageFileFactory(context) {
9162
9388
  var firestoreContext = context.firestoreContext, storageService = context.storageService, storageFileCollection = context.storageFileCollection, firebaseServerActionTransformFunctionFactory = context.firebaseServerActionTransformFunctionFactory;
9163
9389
  var syncStorageFileWithGroupsInTransaction = _syncStorageFileWithGroupsInTransactionFactory(context);
@@ -9181,17 +9407,12 @@ function _processStorageFileInTransactionFactory(context) {
9181
9407
  return _ts_generator$4(this, function(_state) {
9182
9408
  switch(_state.label){
9183
9409
  case 0:
9184
- return [
9185
- 4,
9186
- storageFileCollection.documentAccessorForTransaction(transaction).loadDocumentFrom(inputStorageFileDocument)
9187
- ];
9188
- case 1:
9189
- storageFileDocument = _state.sent();
9410
+ storageFileDocument = storageFileCollection.documentAccessorForTransaction(transaction).loadDocumentFrom(inputStorageFileDocument);
9190
9411
  return [
9191
9412
  4,
9192
9413
  firebaseServer.assertSnapshotData(storageFileDocument)
9193
9414
  ];
9194
- case 2:
9415
+ case 1:
9195
9416
  storageFile = _state.sent();
9196
9417
  fileAccessor = storageService.file(storageFile);
9197
9418
  if (!force) {
@@ -9211,7 +9432,7 @@ function _processStorageFileInTransactionFactory(context) {
9211
9432
  removeAllStorageFileGroups: true
9212
9433
  }, transaction)
9213
9434
  ];
9214
- case 3:
9435
+ case 2:
9215
9436
  _state.sent();
9216
9437
  // delete the file
9217
9438
  return [
@@ -9220,14 +9441,14 @@ function _processStorageFileInTransactionFactory(context) {
9220
9441
  return null;
9221
9442
  })
9222
9443
  ];
9223
- case 4:
9444
+ case 3:
9224
9445
  _state.sent();
9225
9446
  // delete the document
9226
9447
  return [
9227
9448
  4,
9228
9449
  storageFileDocument.accessor.delete()
9229
9450
  ];
9230
- case 5:
9451
+ case 4:
9231
9452
  _state.sent();
9232
9453
  return [
9233
9454
  2
@@ -9257,6 +9478,9 @@ function _processStorageFileInTransactionFactory(context) {
9257
9478
  * Generates a signed download URL for a {@link StorageFile}'s associated Cloud Storage file.
9258
9479
  * The URL expires after the configured duration. Supports loading the storage file document
9259
9480
  * by key if not provided directly.
9481
+ *
9482
+ * @param context - the storage file server actions context
9483
+ * @returns an async transform-and-validate function that generates a signed download URL
9260
9484
  */ function downloadStorageFileFactory(context) {
9261
9485
  var storageService = context.storageService, firebaseServerActionTransformFunctionFactory = context.firebaseServerActionTransformFunctionFactory, storageFileCollection = context.storageFileCollection;
9262
9486
  return firebaseServerActionTransformFunctionFactory(firebase.downloadStorageFileParamsType, function(params) {
@@ -9273,9 +9497,7 @@ function _processStorageFileInTransactionFactory(context) {
9273
9497
  switch(_state.label){
9274
9498
  case 0:
9275
9499
  // if the StorageFileDocument was not provided, set it from the target key
9276
- if (!storageFileDocument) {
9277
- storageFileDocument = storageFileCollection.documentAccessor().loadDocumentForKey(targetStorageFileDocumentKey);
9278
- }
9500
+ storageFileDocument !== null && storageFileDocument !== void 0 ? storageFileDocument : storageFileDocument = storageFileCollection.documentAccessor().loadDocumentForKey(targetStorageFileDocumentKey);
9279
9501
  return [
9280
9502
  4,
9281
9503
  firebaseServer.assertSnapshotData(storageFileDocument)
@@ -9293,9 +9515,9 @@ function _processStorageFileInTransactionFactory(context) {
9293
9515
  expiresAt: expiresAt,
9294
9516
  expiresIn: expiresIn
9295
9517
  });
9296
- downloadUrlExpiresAt = expires.getExpirationDate();
9518
+ downloadUrlExpiresAt = expires.getExpirationDate(); // always returns a Date when defaultExpiresFromDateToNow and expiresIn are set
9297
9519
  // if they're not an admin, limit the expiration to a max of 30 days.
9298
- if (downloadUrlExpiresAt && !asAdmin) {
9520
+ if (!asAdmin) {
9299
9521
  maxExpirationDate = dateFns.addDays(new Date(), 30);
9300
9522
  downloadUrlExpiresAt = date.findMinDate([
9301
9523
  downloadUrlExpiresAt,
@@ -9307,7 +9529,7 @@ function _processStorageFileInTransactionFactory(context) {
9307
9529
  Promise.all([
9308
9530
  fileAccessor.getSignedUrl({
9309
9531
  action: 'read',
9310
- expiresAt: downloadUrlExpiresAt !== null && downloadUrlExpiresAt !== void 0 ? downloadUrlExpiresAt : undefined,
9532
+ expiresAt: downloadUrlExpiresAt,
9311
9533
  responseDisposition: responseDisposition !== null && responseDisposition !== void 0 ? responseDisposition : undefined,
9312
9534
  responseType: asAdmin ? responseContentType !== null && responseContentType !== void 0 ? responseContentType : undefined : undefined // can only be set by admins
9313
9535
  }),
@@ -9345,7 +9567,16 @@ function _processStorageFileInTransactionFactory(context) {
9345
9567
  })();
9346
9568
  });
9347
9569
  }
9348
- function createStorageFileGroupInTransactionFactory(context) {
9570
+ /**
9571
+ * Internal factory that creates a function for creating a {@link StorageFileGroup} document
9572
+ * within a Firestore transaction.
9573
+ *
9574
+ * The created group is flagged for initialization (`s=true`) and uses a dummy owner key
9575
+ * that will be set during the initialization step.
9576
+ *
9577
+ * @param context - the storage file server actions context
9578
+ * @returns an async function that creates a StorageFileGroup within a transaction
9579
+ */ function createStorageFileGroupInTransactionFactory(context) {
9349
9580
  var storageFileGroupCollection = context.storageFileGroupCollection;
9350
9581
  return function(params, transaction) {
9351
9582
  return _async_to_generator$4(function() {
@@ -9391,6 +9622,9 @@ function createStorageFileGroupInTransactionFactory(context) {
9391
9622
  *
9392
9623
  * Creates a new {@link StorageFileGroup} document within a Firestore transaction,
9393
9624
  * associating it with a model key or storage file.
9625
+ *
9626
+ * @param context - the storage file server actions context
9627
+ * @returns an async transform-and-validate function that creates a new StorageFileGroup
9394
9628
  */ function createStorageFileGroupFactory(context) {
9395
9629
  var firestoreContext = context.firestoreContext, firebaseServerActionTransformFunctionFactory = context.firebaseServerActionTransformFunctionFactory;
9396
9630
  var createStorageFileGroupInTransaction = createStorageFileGroupInTransactionFactory(context);
@@ -9399,7 +9633,7 @@ function createStorageFileGroupInTransactionFactory(context) {
9399
9633
  var model, storageFileId, storageFileGroupRelatedModelKey;
9400
9634
  return _ts_generator$4(this, function(_state) {
9401
9635
  model = params.model, storageFileId = params.storageFileId;
9402
- storageFileGroupRelatedModelKey = model ? model : storageFileId ? firebase.inferKeyFromTwoWayFlatFirestoreModelKey(storageFileId) : undefined;
9636
+ storageFileGroupRelatedModelKey = model !== null && model !== void 0 ? model : storageFileId ? firebase.inferKeyFromTwoWayFlatFirestoreModelKey(storageFileId) : undefined;
9403
9637
  if (!storageFileGroupRelatedModelKey) {
9404
9638
  throw createStorageFileGroupInputError();
9405
9639
  }
@@ -9407,42 +9641,32 @@ function createStorageFileGroupInTransactionFactory(context) {
9407
9641
  2,
9408
9642
  function() {
9409
9643
  return _async_to_generator$4(function() {
9410
- var result;
9411
9644
  return _ts_generator$4(this, function(_state) {
9412
- switch(_state.label){
9413
- case 0:
9414
- return [
9415
- 4,
9416
- firestoreContext.runTransaction(function(transaction) {
9417
- return _async_to_generator$4(function() {
9418
- var storageFileGroupDocument;
9419
- return _ts_generator$4(this, function(_state) {
9420
- switch(_state.label){
9421
- case 0:
9422
- return [
9423
- 4,
9424
- createStorageFileGroupInTransaction({
9425
- storageFileGroupRelatedModelKey: storageFileGroupRelatedModelKey
9426
- }, transaction)
9427
- ];
9428
- case 1:
9429
- storageFileGroupDocument = _state.sent().storageFileGroupDocument;
9430
- return [
9431
- 2,
9432
- storageFileGroupDocument
9433
- ];
9434
- }
9435
- });
9436
- })();
9437
- })
9438
- ];
9439
- case 1:
9440
- result = _state.sent();
9441
- return [
9442
- 2,
9443
- result
9444
- ];
9445
- }
9645
+ return [
9646
+ 2,
9647
+ firestoreContext.runTransaction(function(transaction) {
9648
+ return _async_to_generator$4(function() {
9649
+ var storageFileGroupDocument;
9650
+ return _ts_generator$4(this, function(_state) {
9651
+ switch(_state.label){
9652
+ case 0:
9653
+ return [
9654
+ 4,
9655
+ createStorageFileGroupInTransaction({
9656
+ storageFileGroupRelatedModelKey: storageFileGroupRelatedModelKey
9657
+ }, transaction)
9658
+ ];
9659
+ case 1:
9660
+ storageFileGroupDocument = _state.sent().storageFileGroupDocument;
9661
+ return [
9662
+ 2,
9663
+ storageFileGroupDocument
9664
+ ];
9665
+ }
9666
+ });
9667
+ })();
9668
+ })
9669
+ ];
9446
9670
  });
9447
9671
  })();
9448
9672
  }
@@ -9451,12 +9675,21 @@ function createStorageFileGroupInTransactionFactory(context) {
9451
9675
  })();
9452
9676
  });
9453
9677
  }
9454
- function _syncStorageFileWithGroupsInTransactionFactory(context) {
9678
+ /**
9679
+ * Internal factory that creates a function for syncing a {@link StorageFile} with its
9680
+ * associated {@link StorageFileGroup} documents within a Firestore transaction.
9681
+ *
9682
+ * Adds the storage file to groups it is missing from, removes it from groups when requested,
9683
+ * and optionally creates new groups for references that do not yet exist.
9684
+ *
9685
+ * @param context - the storage file server actions context
9686
+ * @returns an async function that syncs a storage file with its groups within a transaction
9687
+ */ function _syncStorageFileWithGroupsInTransactionFactory(context) {
9455
9688
  var storageFileCollection = context.storageFileCollection, storageFileGroupCollection = context.storageFileGroupCollection;
9456
9689
  var createStorageFileGroupInTransaction = createStorageFileGroupInTransactionFactory(context);
9457
9690
  return function(input, transaction) {
9458
9691
  return _async_to_generator$4(function() {
9459
- var _storageFile_g, storageFileDocument, inputStorageFile, force, removeAllStorageFileGroups, skipStorageFileUpdate, storageFileDocumentInTransaction, storageFileGroupDocumentAccessor, storageFile, _tmp, g, storageFileGroupDocuments, storageFileGroupPairs, storageFilesGroupsCreated, storageFilesGroupsUpdated, result;
9692
+ var storageFileDocument, inputStorageFile, force, removeAllStorageFileGroups, skipStorageFileUpdate, storageFileDocumentInTransaction, storageFileGroupDocumentAccessor, storageFile, _tmp, g, storageFileGroupDocuments, storageFileGroupPairs, storageFilesGroupsCreated, storageFilesGroupsUpdated, result;
9460
9693
  return _ts_generator$4(this, function(_state) {
9461
9694
  switch(_state.label){
9462
9695
  case 0:
@@ -9485,7 +9718,7 @@ function _syncStorageFileWithGroupsInTransactionFactory(context) {
9485
9718
  if (!storageFile.gs && !force) {
9486
9719
  throw storageFileNotFlaggedForGroupsSyncError();
9487
9720
  }
9488
- g = (_storageFile_g = storageFile.g) !== null && _storageFile_g !== void 0 ? _storageFile_g : [];
9721
+ g = storageFile.g;
9489
9722
  storageFileGroupDocuments = firebase.loadDocumentsForIds(storageFileGroupDocumentAccessor, g);
9490
9723
  return [
9491
9724
  4,
@@ -9519,10 +9752,15 @@ function _syncStorageFileWithGroupsInTransactionFactory(context) {
9519
9752
  3,
9520
9753
  6
9521
9754
  ];
9755
+ case undefined:
9756
+ return [
9757
+ 3,
9758
+ 8
9759
+ ];
9522
9760
  }
9523
9761
  return [
9524
9762
  3,
9525
- 8
9763
+ 9
9526
9764
  ];
9527
9765
  case 1:
9528
9766
  // add it if it doesn't exist
@@ -9569,7 +9807,7 @@ function _syncStorageFileWithGroupsInTransactionFactory(context) {
9569
9807
  case 5:
9570
9808
  return [
9571
9809
  3,
9572
- 8
9810
+ 9
9573
9811
  ];
9574
9812
  case 6:
9575
9813
  // remove it
@@ -9590,9 +9828,15 @@ function _syncStorageFileWithGroupsInTransactionFactory(context) {
9590
9828
  storageFilesGroupsUpdated += 1;
9591
9829
  return [
9592
9830
  3,
9593
- 8
9831
+ 9
9594
9832
  ];
9595
9833
  case 8:
9834
+ // no change needed
9835
+ return [
9836
+ 3,
9837
+ 9
9838
+ ];
9839
+ case 9:
9596
9840
  return [
9597
9841
  2
9598
9842
  ];
@@ -9635,8 +9879,11 @@ function _syncStorageFileWithGroupsInTransactionFactory(context) {
9635
9879
  *
9636
9880
  * Syncs a single {@link StorageFile}'s embedded data into its associated {@link StorageFileGroup}
9637
9881
  * documents and clears the sync flag on completion.
9882
+ *
9883
+ * @param context - the storage file server actions context
9884
+ * @returns an async transform-and-validate function that syncs a StorageFile with its groups
9638
9885
  */ function syncStorageFileWithGroupsFactory(context) {
9639
- var firestoreContext = context.firestoreContext; context.storageFileCollection; context.storageFileGroupCollection; var firebaseServerActionTransformFunctionFactory = context.firebaseServerActionTransformFunctionFactory;
9886
+ var firestoreContext = context.firestoreContext, firebaseServerActionTransformFunctionFactory = context.firebaseServerActionTransformFunctionFactory;
9640
9887
  var syncStorageFileWithGroupsInTransaction = _syncStorageFileWithGroupsInTransactionFactory(context);
9641
9888
  return firebaseServerActionTransformFunctionFactory(firebase.syncStorageFileWithGroupsParamsType, function(params) {
9642
9889
  return _async_to_generator$4(function() {
@@ -9678,10 +9925,13 @@ function _syncStorageFileWithGroupsInTransactionFactory(context) {
9678
9925
  * Batch-processes all {@link StorageFile} documents flagged for group sync,
9679
9926
  * updating their associated {@link StorageFileGroup} documents and flagging
9680
9927
  * groups for content regeneration when changes occur.
9928
+ *
9929
+ * @param context - the storage file server actions context
9930
+ * @returns an async transform-and-validate function that returns batch sync results
9681
9931
  */ function syncAllFlaggedStorageFilesWithGroupsFactory(context) {
9682
9932
  var firebaseServerActionTransformFunctionFactory = context.firebaseServerActionTransformFunctionFactory, storageFileCollection = context.storageFileCollection;
9683
9933
  var syncStorageFileWithGroups = syncStorageFileWithGroupsFactory(context);
9684
- return firebaseServerActionTransformFunctionFactory(firebase.syncAllFlaggedStorageFilesWithGroupsParamsType, function(params) {
9934
+ return firebaseServerActionTransformFunctionFactory(firebase.syncAllFlaggedStorageFilesWithGroupsParamsType, function(_params) {
9685
9935
  return _async_to_generator$4(function() {
9686
9936
  return _ts_generator$4(this, function(_state) {
9687
9937
  return [
@@ -9793,6 +10043,9 @@ function _syncStorageFileWithGroupsInTransactionFactory(context) {
9793
10043
  *
9794
10044
  * Regenerates the content of a single {@link StorageFileGroup}, including building a ZIP
9795
10045
  * archive from the group's embedded files and updating the group's content metadata.
10046
+ *
10047
+ * @param context - the storage file server actions context
10048
+ * @returns an async transform-and-validate function that regenerates a StorageFileGroup's content
9796
10049
  */ function regenerateStorageFileGroupContentFactory(context) {
9797
10050
  var firestoreContext = context.firestoreContext, storageService = context.storageService, storageFileCollection = context.storageFileCollection, storageFileGroupCollection = context.storageFileGroupCollection, firebaseServerActionTransformFunctionFactory = context.firebaseServerActionTransformFunctionFactory;
9798
10051
  var processStorageFileInTransaction = _processStorageFileInTransactionFactory(context);
@@ -9932,10 +10185,13 @@ function _syncStorageFileWithGroupsInTransactionFactory(context) {
9932
10185
  *
9933
10186
  * Batch-processes all {@link StorageFileGroup} documents flagged for content regeneration,
9934
10187
  * rebuilding their ZIP archives and updating content metadata.
10188
+ *
10189
+ * @param context - the storage file server actions context
10190
+ * @returns an async transform-and-validate function that returns batch regeneration results
9935
10191
  */ function regenerateAllFlaggedStorageFileGroupsContentFactory(context) {
9936
10192
  var firebaseServerActionTransformFunctionFactory = context.firebaseServerActionTransformFunctionFactory, storageFileGroupCollection = context.storageFileGroupCollection;
9937
10193
  var regenerateStorageFileGroupContent = regenerateStorageFileGroupContentFactory(context);
9938
- return firebaseServerActionTransformFunctionFactory(firebase.regenerateAllFlaggedStorageFileGroupsContentParamsType, function(params) {
10194
+ return firebaseServerActionTransformFunctionFactory(firebase.regenerateAllFlaggedStorageFileGroupsContentParamsType, function(_params) {
9939
10195
  return _async_to_generator$4(function() {
9940
10196
  return _ts_generator$4(this, function(_state) {
9941
10197
  return [
@@ -10220,6 +10476,7 @@ var MAKE_TEMPLATE_FOR_STORAGEFILE_RELATED_MODEL_INITIALIZATION_FUNCTION_DELETE_R
10220
10476
  * initialization action to its factory function.
10221
10477
  *
10222
10478
  * @param context - the initialization context with template function and Firestore access
10479
+ * @returns a {@link StorageFileInitServerActions} wired to the provided context
10223
10480
  */ function storageFileInitServerActions(context) {
10224
10481
  return {
10225
10482
  initializeStorageFileGroup: initializeStorageFileGroupFactory(context),
@@ -10235,6 +10492,7 @@ var MAKE_TEMPLATE_FOR_STORAGEFILE_RELATED_MODEL_INITIALIZATION_FUNCTION_DELETE_R
10235
10492
  * - Returns `false` → deletes the document entirely
10236
10493
  *
10237
10494
  * @param input - the document, transaction, template function, and options
10495
+ * @returns an object indicating whether the document was initialized or was already initialized
10238
10496
  * @throws storageFileModelAlreadyInitializedError when `throwErrorIfAlreadyInitialized` is true
10239
10497
  */ function initializeStorageFileModelInTransaction(input) {
10240
10498
  return _async_to_generator$3(function() {
@@ -10336,6 +10594,9 @@ var MAKE_TEMPLATE_FOR_STORAGEFILE_RELATED_MODEL_INITIALIZATION_FUNCTION_DELETE_R
10336
10594
  *
10337
10595
  * Applies the app-specific template function, restricting the template to only the `o` (owner)
10338
10596
  * and content flag properties, and always flags the group for content regeneration.
10597
+ *
10598
+ * @param context - the initialization context providing collection access and the template function
10599
+ * @returns an async function that initializes a storage file group document within a transaction
10339
10600
  */ function initializeStorageFileGroupInTransactionFactory(context) {
10340
10601
  var storageFileGroupCollection = context.storageFileGroupCollection, makeTemplateForStorageFileGroupInitialization = context.makeTemplateForStorageFileGroupInitialization;
10341
10602
  return function(params, storageFileGroupDocument, transaction) {
@@ -10396,6 +10657,9 @@ var MAKE_TEMPLATE_FOR_STORAGEFILE_RELATED_MODEL_INITIALIZATION_FUNCTION_DELETE_R
10396
10657
  *
10397
10658
  * Wraps the in-transaction group initialization in a Firestore transaction
10398
10659
  * and follows the transform-and-validate pattern.
10660
+ *
10661
+ * @param context - the initialization context with Firestore access and template function
10662
+ * @returns a transform-and-validate function for single storage file group initialization
10399
10663
  */ function initializeStorageFileGroupFactory(context) {
10400
10664
  var firestoreContext = context.firestoreContext, firebaseServerActionTransformFunctionFactory = context.firebaseServerActionTransformFunctionFactory;
10401
10665
  var initializeStorageFileGroupInTransaction = initializeStorageFileGroupInTransactionFactory(context);
@@ -10436,6 +10700,9 @@ var MAKE_TEMPLATE_FOR_STORAGEFILE_RELATED_MODEL_INITIALIZATION_FUNCTION_DELETE_R
10436
10700
  * Batch-processes all {@link StorageFileGroup} documents flagged for initialization,
10437
10701
  * initializing each in parallel (up to 5 concurrent tasks). Loops until no more
10438
10702
  * flagged groups are found.
10703
+ *
10704
+ * @param context - the initialization context with Firestore access, collection, and template function
10705
+ * @returns a transform-and-validate function for batch storage file group initialization
10439
10706
  */ function initializeAllApplicableStorageFileGroupsFactory(context) {
10440
10707
  var firestoreContext = context.firestoreContext, firebaseServerActionTransformFunctionFactory = context.firebaseServerActionTransformFunctionFactory, storageFileGroupCollection = context.storageFileGroupCollection;
10441
10708
  var initializeStorageFileGroupInTransaction = initializeStorageFileGroupInTransactionFactory(context);
@@ -10449,7 +10716,7 @@ var MAKE_TEMPLATE_FOR_STORAGEFILE_RELATED_MODEL_INITIALIZATION_FUNCTION_DELETE_R
10449
10716
  var storageFileGroupsVisited, storageFileGroupsSucceeded, storageFileGroupsFailed, storageFileGroupsAlreadyInitialized, initializeStorageFileGroupParams, initializeStorageFileGroupsResults, found, result;
10450
10717
  function initializeStorageFileGroups() {
10451
10718
  return _async_to_generator$3(function() {
10452
- var query, storageFileGroupDocuments, result;
10719
+ var query, storageFileGroupDocuments;
10453
10720
  return _ts_generator$3(this, function(_state) {
10454
10721
  switch(_state.label){
10455
10722
  case 0:
@@ -10461,7 +10728,7 @@ var MAKE_TEMPLATE_FOR_STORAGEFILE_RELATED_MODEL_INITIALIZATION_FUNCTION_DELETE_R
10461
10728
  case 1:
10462
10729
  storageFileGroupDocuments = _state.sent();
10463
10730
  return [
10464
- 4,
10731
+ 2,
10465
10732
  util.performAsyncTasks(storageFileGroupDocuments, function(storageFileGroupDocument) {
10466
10733
  return _async_to_generator$3(function() {
10467
10734
  return _ts_generator$3(this, function(_state) {
@@ -10477,12 +10744,6 @@ var MAKE_TEMPLATE_FOR_STORAGEFILE_RELATED_MODEL_INITIALIZATION_FUNCTION_DELETE_R
10477
10744
  maxParallelTasks: 5
10478
10745
  })
10479
10746
  ];
10480
- case 2:
10481
- result = _state.sent();
10482
- return [
10483
- 2,
10484
- result
10485
- ];
10486
10747
  }
10487
10748
  });
10488
10749
  })();
@@ -10642,6 +10903,10 @@ function _unsupported_iterable_to_array$1(o, minLen) {
10642
10903
  /**
10643
10904
  * Factory that assembles the full {@link StorageFileServerActionsContext} by combining
10644
10905
  * the base context with the upload initialization service.
10906
+ *
10907
+ * @param context - the base server actions context providing Firebase infrastructure
10908
+ * @param storageFileInitializeFromUploadService - the service for initializing storage files from uploads
10909
+ * @returns the fully assembled StorageFileServerActionsContext
10645
10910
  */ function storageFileServerActionsContextFactory(context, storageFileInitializeFromUploadService) {
10646
10911
  return _object_spread_props$2(_object_spread$2({}, context), {
10647
10912
  storageFileInitializeFromUploadService: storageFileInitializeFromUploadService
@@ -10649,12 +10914,19 @@ function _unsupported_iterable_to_array$1(o, minLen) {
10649
10914
  }
10650
10915
  /**
10651
10916
  * Factory that creates a {@link StorageFileServerActions} instance from the assembled context.
10917
+ *
10918
+ * @param context - the fully assembled storage file server actions context
10919
+ * @returns a concrete StorageFileServerActions instance
10652
10920
  */ function storageFileServerActionsFactory(context) {
10653
10921
  return storageFileServerActions(context);
10654
10922
  }
10655
10923
  /**
10656
10924
  * Factory that creates a {@link StorageFileInitServerActions} instance by merging the
10657
10925
  * server actions context with the init-specific configuration.
10926
+ *
10927
+ * @param context - the storage file server actions context
10928
+ * @param storageFileInitServerActionsContextConfig - init-specific configuration with the template function
10929
+ * @returns a concrete StorageFileInitServerActions instance
10658
10930
  */ function storageFileInitServerActionsFactory(context, storageFileInitServerActionsContextConfig) {
10659
10931
  return storageFileInitServerActions(_object_spread$2({}, context, storageFileInitServerActionsContextConfig));
10660
10932
  }
@@ -10668,9 +10940,8 @@ function _unsupported_iterable_to_array$1(o, minLen) {
10668
10940
  *
10669
10941
  * Be sure the class that delares the module using this function also extends AbstractAppStorageFileModule.
10670
10942
  *
10671
- * @param provide
10672
- * @param useFactory
10673
- * @returns
10943
+ * @param config - the module configuration including optional dependency module, imports, exports, and providers
10944
+ * @returns the assembled {@link ModuleMetadata} for the storage file module
10674
10945
  */ function appStorageFileModuleMetadata(config$1) {
10675
10946
  var dependencyModule = config$1.dependencyModule, imports = config$1.imports, exports$1 = config$1.exports, providers = config$1.providers;
10676
10947
  var dependencyModuleImport = dependencyModule ? [
@@ -11134,6 +11405,13 @@ var storageFileProcessingNotificationTaskHandlerDefaultCleanup = function storag
11134
11405
  };
11135
11406
  /**
11136
11407
  * Creates a NotificationTaskServiceTaskHandlerConfig that handles the StorageFileProcessingNotificationTask.
11408
+ *
11409
+ * Builds a subtask-based notification handler that loads the storage file document,
11410
+ * determines its purpose, and dispatches to the appropriate purpose-specific processor.
11411
+ * Includes optional StorageFileGroup processors (e.g., ZIP generation) by default.
11412
+ *
11413
+ * @param config - handler configuration including processors, storage accessor, and Firestore collections
11414
+ * @returns a NotificationTaskServiceTaskHandlerConfig wired for storage file processing
11137
11415
  */ function storageFileProcessingNotificationTaskHandler(config) {
11138
11416
  var inputProcessors = config.processors, storageAccessor = config.storageAccessor, storageFileFirestoreCollections = config.storageFileFirestoreCollections, allStorageFileGroupProcessorConfig = config.allStorageFileGroupProcessorConfig;
11139
11417
  var storageFileDocumentAccessor = storageFileFirestoreCollections.storageFileCollection.documentAccessor();
@@ -11152,16 +11430,11 @@ var storageFileProcessingNotificationTaskHandlerDefaultCleanup = function storag
11152
11430
  subtaskHandlerFunctionName: 'storageFileProcessingNotificationTaskHandler',
11153
11431
  inputFunction: function inputFunction(data) {
11154
11432
  return _async_to_generator$1(function() {
11155
- var storageFileDocument, loadStorageFile, purpose, storagePath, file, fileDetailsAccessor, input;
11433
+ var storageFileDocument, loadStorageFile, purpose, storagePath, file, fileDetailsAccessor;
11156
11434
  return _ts_generator$1(this, function(_state) {
11157
11435
  switch(_state.label){
11158
11436
  case 0:
11159
- return [
11160
- 4,
11161
- storageFileDocumentAccessor.loadDocumentForId(data.storageFile)
11162
- ];
11163
- case 1:
11164
- storageFileDocument = _state.sent();
11437
+ storageFileDocument = storageFileDocumentAccessor.loadDocumentForId(data.storageFile);
11165
11438
  loadStorageFile = util.cachedGetter(function() {
11166
11439
  return _async_to_generator$1(function() {
11167
11440
  var storageFile;
@@ -11185,11 +11458,17 @@ var storageFileProcessingNotificationTaskHandlerDefaultCleanup = function storag
11185
11458
  });
11186
11459
  })();
11187
11460
  });
11188
- purpose = data === null || data === void 0 ? void 0 : data.p;
11189
- if (!!purpose) return [
11461
+ purpose = data.p;
11462
+ if (!(// attempt to load the purpose from the storage file, if it exists.
11463
+ purpose !== null && purpose !== void 0)) return [
11464
+ 3,
11465
+ 1
11466
+ ];
11467
+ return [
11190
11468
  3,
11191
11469
  3
11192
11470
  ];
11471
+ case 1:
11193
11472
  return [
11194
11473
  4,
11195
11474
  loadStorageFile().then(function(x) {
@@ -11197,7 +11476,6 @@ var storageFileProcessingNotificationTaskHandlerDefaultCleanup = function storag
11197
11476
  })
11198
11477
  ];
11199
11478
  case 2:
11200
- // attempt to load the purpose from the storage file, if it exists.
11201
11479
  purpose = _state.sent();
11202
11480
  _state.label = 3;
11203
11481
  case 3:
@@ -11226,15 +11504,14 @@ var storageFileProcessingNotificationTaskHandlerDefaultCleanup = function storag
11226
11504
  case 6:
11227
11505
  file = storageAccessor.file(storagePath);
11228
11506
  fileDetailsAccessor = makeFileDetailsAccessor(file);
11229
- input = {
11230
- target: purpose,
11231
- loadStorageFile: loadStorageFile,
11232
- fileDetailsAccessor: fileDetailsAccessor,
11233
- storageFileDocument: storageFileDocument
11234
- };
11235
11507
  return [
11236
11508
  2,
11237
- input
11509
+ {
11510
+ target: purpose,
11511
+ loadStorageFile: loadStorageFile,
11512
+ fileDetailsAccessor: fileDetailsAccessor,
11513
+ storageFileDocument: storageFileDocument
11514
+ }
11238
11515
  ];
11239
11516
  }
11240
11517
  });
@@ -11287,7 +11564,12 @@ var storageFileProcessingNotificationTaskHandlerDefaultCleanup = function storag
11287
11564
  processors: processors
11288
11565
  }));
11289
11566
  }
11290
- function allStorageFileGroupStorageFileProcessingPurposeSubtaskProcessors(config) {
11567
+ /**
11568
+ * Assembles all built-in StorageFileGroup subtask processors, such as ZIP generation.
11569
+ *
11570
+ * @param config - configuration controlling which group processors to include
11571
+ * @returns an array of subtask processor configs for StorageFileGroup processing purposes
11572
+ */ function allStorageFileGroupStorageFileProcessingPurposeSubtaskProcessors(config) {
11291
11573
  var excludeZipProcessing = config.excludeZipProcessing;
11292
11574
  var processors = [];
11293
11575
  if (!excludeZipProcessing) {
@@ -11295,7 +11577,15 @@ function allStorageFileGroupStorageFileProcessingPurposeSubtaskProcessors(config
11295
11577
  }
11296
11578
  return processors;
11297
11579
  }
11298
- function storageFileGroupZipStorageFileProcessingPurposeSubtaskProcessor(config) {
11580
+ /**
11581
+ * Creates the ZIP subtask processor for {@link StorageFileGroup} processing.
11582
+ *
11583
+ * This processor streams all files in the group into a ZIP archive, attaches an info JSON
11584
+ * manifest, and uploads the result to the group's designated storage path.
11585
+ *
11586
+ * @param config - configuration providing Firestore collections, storage accessor, and ZIP options
11587
+ * @returns a subtask processor config targeting the StorageFileGroup ZIP purpose
11588
+ */ function storageFileGroupZipStorageFileProcessingPurposeSubtaskProcessor(config) {
11299
11589
  var _ref;
11300
11590
  var storageFileFirestoreCollections = config.storageFileFirestoreCollections, storageAccessor = config.storageAccessor, zip = config.zip;
11301
11591
  var storageFileCollection = storageFileFirestoreCollections.storageFileCollection, storageFileGroupCollection = storageFileFirestoreCollections.storageFileGroupCollection;
@@ -11425,7 +11715,7 @@ function storageFileGroupZipStorageFileProcessingPurposeSubtaskProcessor(config)
11425
11715
  4,
11426
11716
  util.performAsyncTasks(storageFileDataPairsToZip, function(storageFileDataPair) {
11427
11717
  return _async_to_generator$1(function() {
11428
- var storageFile, storageFileDisplayName, referencesStorageFileGroup, fileAccessor, metadata, fileSlashPathDetails, storageFileGroupEmbeddedFile, embeddedFileNameOverride, nameFromFactory, untypedName, extension, name, fileStream;
11718
+ var storageFile, storageFileDisplayName, referencesStorageFileGroup, fileAccessor, metadata, _ref, _ref1, fileSlashPathDetails, storageFileGroupEmbeddedFile, embeddedFileNameOverride, nameFromFactory, untypedName, extension, name, fileStream;
11429
11719
  return _ts_generator$1(this, function(_state) {
11430
11720
  switch(_state.label){
11431
11721
  case 0:
@@ -11436,9 +11726,7 @@ function storageFileGroupZipStorageFileProcessingPurposeSubtaskProcessor(config)
11436
11726
  ];
11437
11727
  storageFileDisplayName = storageFile.n;
11438
11728
  // make sure it references the storage file group
11439
- referencesStorageFileGroup = storageFile.g.some(function(x) {
11440
- return x === storageFileGroupId;
11441
- });
11729
+ referencesStorageFileGroup = storageFile.g.includes(storageFileGroupId);
11442
11730
  if (!referencesStorageFileGroup) return [
11443
11731
  3,
11444
11732
  6
@@ -11471,15 +11759,20 @@ function storageFileGroupZipStorageFileProcessingPurposeSubtaskProcessor(config)
11471
11759
  ];
11472
11760
  case 2:
11473
11761
  nameFromFactory = _state.sent();
11474
- untypedName = nameFromFactory || storageFileDisplayName || embeddedFileNameOverride || fileSlashPathDetails.fileName;
11762
+ untypedName = (_ref = (_ref1 = nameFromFactory !== null && nameFromFactory !== void 0 ? nameFromFactory : storageFileDisplayName) !== null && _ref1 !== void 0 ? _ref1 : embeddedFileNameOverride) !== null && _ref !== void 0 ? _ref : fileSlashPathDetails.fileName;
11475
11763
  if (fileSlashPathDetails.typedFileExtension) {
11476
11764
  extension = fileSlashPathDetails.typedFileExtension;
11477
11765
  } else if (metadata.contentType) {
11478
11766
  extension = util.documentFileExtensionForMimeType(metadata.contentType);
11479
11767
  }
11480
11768
  // set the default name if still unset
11481
- untypedName = untypedName || "sf_".concat(storageFile.id);
11769
+ untypedName = untypedName !== null && untypedName !== void 0 ? untypedName : "sf_".concat(storageFile.id);
11482
11770
  name = extension ? "".concat(untypedName, ".").concat(extension) : untypedName;
11771
+ if (!fileAccessor.getStream) {
11772
+ return [
11773
+ 2
11774
+ ]; // skip files where getStream is not available
11775
+ }
11483
11776
  fileStream = fileAccessor.getStream();
11484
11777
  return [
11485
11778
  4,
@@ -11830,6 +12123,7 @@ function _ts_generator(thisArg, body) {
11830
12123
  *
11831
12124
  * @param error - the error that caused the permanent failure
11832
12125
  * @param createdFile - optional path to a file that was created before the error and should be deleted
12126
+ * @returns a permanent failure result with the error and optional created file reference
11833
12127
  */ function storageFileInitializeFromUploadServiceInitializerResultPermanentFailure(error, createdFile) {
11834
12128
  return {
11835
12129
  error: error,
@@ -11849,6 +12143,7 @@ function _ts_generator(thisArg, body) {
11849
12143
  * 4. Optionally, previous files for the same purpose/user are flagged for deletion
11850
12144
  *
11851
12145
  * @param config - service configuration including determiners, initializers, and storage references
12146
+ * @returns a {@link StorageFileInitializeFromUploadService} with type detection and upload initialization
11852
12147
  *
11853
12148
  * @example
11854
12149
  * ```ts
@@ -11885,10 +12180,9 @@ function _ts_generator(thisArg, body) {
11885
12180
  }
11886
12181
  });
11887
12182
  var determiner = firebase.combineUploadFileTypeDeterminers(_object_spread({
11888
- determiners: allDeterminers
11889
- }, _object_spread({
12183
+ determiners: allDeterminers,
11890
12184
  completeSearchOnFirstMatch: true
11891
- }, config.combineDeterminersConfig)));
12185
+ }, config.combineDeterminersConfig));
11892
12186
  // validate initializers
11893
12187
  if (validate) {
11894
12188
  var allInitializerTypes = Object.keys(initializers);
@@ -11916,6 +12210,7 @@ function _ts_generator(thisArg, body) {
11916
12210
  return {
11917
12211
  checkFileIsAllowedToBeInitialized: inputCheckFileIsAllowedToBeInitialized !== null && inputCheckFileIsAllowedToBeInitialized !== void 0 ? inputCheckFileIsAllowedToBeInitialized : util.asDecisionFunction(true),
11918
12212
  determineUploadFileType: determineUploadFileType,
12213
+ // eslint-disable-next-line sonarjs/cognitive-complexity
11919
12214
  initializeFromUpload: function initializeFromUpload(input) {
11920
12215
  return _async_to_generator(function() {
11921
12216
  var determinerResult, resultType, createdFilePath, storageFileDocument, processorError, previousStorageFilesFlaggedForDeletion, fileDetailsAccessor, initializer, initializerResult, error, permanentFailure, createdFile, flagPreviousForDelete, createStorageFileResult, flagPreviousForDeleteResult, _createStorageFileResult_storageFile, p, pg, u, createdFile1, fileMetadata, e, flagForDeleteResult, e1, result;