@dereekb/firebase-server 13.4.1 → 13.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (101) hide show
  1. package/index.cjs.js +405 -93
  2. package/index.esm.js +406 -94
  3. package/mailgun/package.json +9 -9
  4. package/model/index.cjs.js +639 -348
  5. package/model/index.esm.js +640 -349
  6. package/model/package.json +10 -10
  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 +141 -31
  30. package/oidc/index.esm.js +141 -31
  31. package/oidc/package.json +11 -11
  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 +13 -13
  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 +11 -11
  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
@@ -325,6 +326,8 @@ var MAILGUN_NOTIFICATION_EMAIL_SEND_SERVICE_DEFAULT_MAX_BATCH_SIZE_PER_REQUEST =
325
326
  * Creates an error indicating that a required notification ID was missing during creation.
326
327
  *
327
328
  * Thrown when attempting to create a {@link Notification} document without providing the mandatory ID field.
329
+ *
330
+ * @returns a precondition conflict error with the notification ID required error code
328
331
  */ function createNotificationIdRequiredError() {
329
332
  return firebaseServer.preconditionConflictError({
330
333
  message: "The required id was not present when attempting to create a Notification.",
@@ -336,6 +339,8 @@ var MAILGUN_NOTIFICATION_EMAIL_SEND_SERVICE_DEFAULT_MAX_BATCH_SIZE_PER_REQUEST =
336
339
  *
337
340
  * Thrown during initialization when `throwErrorIfAlreadyInitialized` is true and the model's
338
341
  * setup flag (`s`) indicates it was previously initialized.
342
+ *
343
+ * @returns a precondition conflict error with the already-initialized error code
339
344
  */ function notificationModelAlreadyInitializedError() {
340
345
  return firebaseServer.preconditionConflictError({
341
346
  message: "This model has already been initialized.",
@@ -348,6 +353,7 @@ var MAILGUN_NOTIFICATION_EMAIL_SEND_SERVICE_DEFAULT_MAX_BATCH_SIZE_PER_REQUEST =
348
353
  * Thrown when the model key's collection name does not match any registered notification model type.
349
354
  *
350
355
  * @param key - the Firestore model key that has no registered notification model type
356
+ * @returns a precondition conflict error with the unregistered model type error code
351
357
  */ function notificationBoxUnregistredModelTypeInitializationError(key) {
352
358
  return firebaseServer.preconditionConflictError({
353
359
  message: "This NotificationBox is associated with an unregistered model type.",
@@ -361,6 +367,8 @@ var MAILGUN_NOTIFICATION_EMAIL_SEND_SERVICE_DEFAULT_MAX_BATCH_SIZE_PER_REQUEST =
361
367
  * Creates an error indicating that no {@link NotificationBox} exists for the target model.
362
368
  *
363
369
  * Thrown when an operation requires a NotificationBox but none has been created for the given model key.
370
+ *
371
+ * @returns a precondition conflict error with the box-not-found error code
364
372
  */ function notificationBoxDoesNotExist() {
365
373
  return firebaseServer.preconditionConflictError({
366
374
  message: "A NotificationBox does not exist for this model.",
@@ -372,6 +380,8 @@ var MAILGUN_NOTIFICATION_EMAIL_SEND_SERVICE_DEFAULT_MAX_BATCH_SIZE_PER_REQUEST =
372
380
  *
373
381
  * Thrown when the target recipient on the {@link NotificationBox} does not exist on the box
374
382
  * or does not have a UID, making it ineligible for exclusion.
383
+ *
384
+ * @returns a precondition conflict error with the invalid exclusion target error code
375
385
  */ function notificationBoxExclusionTargetInvalidError() {
376
386
  return firebaseServer.preconditionConflictError({
377
387
  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 +392,8 @@ var MAILGUN_NOTIFICATION_EMAIL_SEND_SERVICE_DEFAULT_MAX_BATCH_SIZE_PER_REQUEST =
382
392
  * Creates an error indicating that a {@link NotificationBox} already exists for this model.
383
393
  *
384
394
  * Thrown when attempting to create a duplicate NotificationBox for a model that already has one.
395
+ *
396
+ * @returns a precondition conflict error with the box-exists error code
385
397
  */ function notificationBoxExistsForModelError() {
386
398
  return firebaseServer.preconditionConflictError({
387
399
  message: "A NotificationBox already exists for this model.",
@@ -393,6 +405,8 @@ var MAILGUN_NOTIFICATION_EMAIL_SEND_SERVICE_DEFAULT_MAX_BATCH_SIZE_PER_REQUEST =
393
405
  *
394
406
  * Thrown when attempting to update a recipient that is not registered on the box
395
407
  * and `insert=true` was not passed to allow creating a new recipient entry.
408
+ *
409
+ * @returns a precondition conflict error with the recipient-not-found error code
396
410
  */ function notificationBoxRecipientDoesNotExistsError() {
397
411
  return firebaseServer.preconditionConflictError({
398
412
  message: "An existing NotificationBox recipient for the target does not exist. You must pass insert=true to create a new recipient.",
@@ -405,6 +419,7 @@ var MAILGUN_NOTIFICATION_EMAIL_SEND_SERVICE_DEFAULT_MAX_BATCH_SIZE_PER_REQUEST =
405
419
  * Thrown during {@link NotificationUser} creation when the provided UID cannot be found in Firebase Auth.
406
420
  *
407
421
  * @param uid - the Firebase Auth user ID that was not found
422
+ * @returns a precondition conflict error with the invalid-uid error code
408
423
  */ function notificationUserInvalidUidForCreateError(uid) {
409
424
  return firebaseServer.preconditionConflictError({
410
425
  message: "The user with the uid '".concat(uid, "' does not exist. Cannot create a NotificationUser for them."),
@@ -421,6 +436,7 @@ var MAILGUN_NOTIFICATION_EMAIL_SEND_SERVICE_DEFAULT_MAX_BATCH_SIZE_PER_REQUEST =
421
436
  * and an operation attempts to insert them into a {@link NotificationBox}'s recipient list.
422
437
  *
423
438
  * @param uid - the Firebase Auth user ID of the blocked user
439
+ * @returns a precondition conflict error with the blocked-from-add error code
424
440
  */ function notificationUserBlockedFromBeingAddedToRecipientsError(uid) {
425
441
  return firebaseServer.preconditionConflictError({
426
442
  message: "The user with the uid '".concat(uid, "' has blocked themselves from from being added recipients."),
@@ -437,6 +453,7 @@ var MAILGUN_NOTIFICATION_EMAIL_SEND_SERVICE_DEFAULT_MAX_BATCH_SIZE_PER_REQUEST =
437
453
  * and an operation attempts to modify their recipient settings on a {@link NotificationBox}.
438
454
  *
439
455
  * @param uid - the Firebase Auth user ID of the locked user
456
+ * @returns a precondition conflict error with the locked-config error code
440
457
  */ function notificationUserLockedConfigFromBeingUpdatedError(uid) {
441
458
  return firebaseServer.preconditionConflictError({
442
459
  message: "The user with the uid '".concat(uid, "' has locked their config from being updated."),
@@ -452,7 +469,7 @@ function _array_like_to_array$7(arr, len) {
452
469
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
453
470
  return arr2;
454
471
  }
455
- function _array_without_holes$5(arr) {
472
+ function _array_without_holes$6(arr) {
456
473
  if (Array.isArray(arr)) return _array_like_to_array$7(arr);
457
474
  }
458
475
  function asyncGeneratorStep$e(gen, resolve, reject, _next, _throw, key, arg) {
@@ -497,10 +514,10 @@ function _define_property$d(obj, key, value) {
497
514
  }
498
515
  return obj;
499
516
  }
500
- function _iterable_to_array$5(iter) {
517
+ function _iterable_to_array$6(iter) {
501
518
  if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
502
519
  }
503
- function _non_iterable_spread$5() {
520
+ function _non_iterable_spread$6() {
504
521
  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
522
  }
506
523
  function _object_spread$c(target) {
@@ -537,8 +554,8 @@ function _object_spread_props$b(target, source) {
537
554
  }
538
555
  return target;
539
556
  }
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();
557
+ function _to_consumable_array$6(arr) {
558
+ return _array_without_holes$6(arr) || _iterable_to_array$6(arr) || _unsupported_iterable_to_array$7(arr) || _non_iterable_spread$6();
542
559
  }
543
560
  function _unsupported_iterable_to_array$7(o, minLen) {
544
561
  if (!o) return;
@@ -655,6 +672,7 @@ function _ts_generator$e(thisArg, body) {
655
672
  * and initializes with an empty notifications array.
656
673
  *
657
674
  * @param model - the model key to associate the summary with
675
+ * @returns a blank {@link NotificationSummary} with creation timestamp and empty notifications
658
676
  *
659
677
  * @example
660
678
  * ```ts
@@ -677,8 +695,8 @@ function _ts_generator$e(thisArg, body) {
677
695
  *
678
696
  * 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
697
  *
680
- * @param input
681
- * @returns
698
+ * @param input - the notification, box, auth service, and recipient configuration
699
+ * @returns channel-specific recipient lists (email, text, notification summary) ready for delivery
682
700
  */ function expandNotificationRecipients(input) {
683
701
  return _async_to_generator$e(function() {
684
702
  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 +722,7 @@ function _ts_generator$e(thisArg, body) {
704
722
  onlyTextExplicitlyEnabledRecipients = inputOnlyTextExplicitlyEnabledRecipients !== false; // defaults to true
705
723
  onlySendToExplicitlyEnabledRecipients = inputOnlySendToExplicitlyEnabledRecipients === true; // defaults to false
706
724
  onlyEmailExplicitlyEnabledRecipients = onlySendToExplicitlyEnabledRecipients;
725
+ // const onlySendPushNotificationExplicitlyEnabledRecipients = onlySendToExplicitlyEnabledRecipients;
707
726
  onlySendNotificationSummaryExplicitlyEnabledRecipients = onlySendToExplicitlyEnabledRecipients;
708
727
  _allowedNotificationRecipients = firebase.allowedNotificationRecipients(recipientFlag), canSendToGlobalRecipients = _allowedNotificationRecipients.canSendToGlobalRecipients, canSendToBoxRecipients = _allowedNotificationRecipients.canSendToBoxRecipients, canSendToExplicitRecipients = _allowedNotificationRecipients.canSendToExplicitRecipients;
709
728
  initialExplicitRecipients = canSendToExplicitRecipients ? notification.r : [];
@@ -714,7 +733,7 @@ function _ts_generator$e(thisArg, body) {
714
733
  globalRecipients = initialGlobalRecipients.map(function(x) {
715
734
  return _object_spread$c({}, x, firebase.effectiveNotificationBoxRecipientTemplateConfig(x));
716
735
  });
717
- explicitAndGlobalRecipients = _to_consumable_array$5(explicitRecipients).concat(_to_consumable_array$5(globalRecipients));
736
+ explicitAndGlobalRecipients = _to_consumable_array$6(explicitRecipients).concat(_to_consumable_array$6(globalRecipients));
718
737
  allBoxRecipientConfigs = canSendToBoxRecipients && notificationBox ? notificationBox.r : [];
719
738
  recipientUids = new Set();
720
739
  relevantBoxRecipientConfigs = [];
@@ -751,7 +770,7 @@ function _ts_generator$e(thisArg, body) {
751
770
  3,
752
771
  2
753
772
  ];
754
- nonNotificationBoxRecipientUids = Array.from(nonNotificationBoxUidRecipientConfigs.keys());
773
+ nonNotificationBoxRecipientUids = _to_consumable_array$6(nonNotificationBoxUidRecipientConfigs.keys());
755
774
  notificationUserDocuments = firebase.loadDocumentsForIds(notificationUserAccessor, nonNotificationBoxRecipientUids);
756
775
  return [
757
776
  4,
@@ -815,7 +834,7 @@ function _ts_generator$e(thisArg, body) {
815
834
  });
816
835
  return [
817
836
  4,
818
- Promise.all(Array.from(recipientUids).map(function(uid) {
837
+ Promise.all(_to_consumable_array$6(recipientUids).map(function(uid) {
819
838
  return authService.userContext(uid).loadDetails().then(function(details) {
820
839
  return [
821
840
  uid,
@@ -1027,17 +1046,15 @@ function _ts_generator$e(thisArg, body) {
1027
1046
  } else if (x.s) {
1028
1047
  notificationSummaryId = x.s;
1029
1048
  }
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
- }
1049
+ if (notificationSummaryId && !notificationSummaryKeysSet.has(notificationSummaryId)) {
1050
+ var name = displayName || x.n;
1051
+ var notificationSummary = {
1052
+ notificationSummaryId: notificationSummaryId,
1053
+ otherRecipient: x,
1054
+ name: name
1055
+ };
1056
+ notificationSummaries.push(notificationSummary);
1057
+ explicitOtherRecipientNotificationSummaryIds.delete(notificationSummaryId);
1041
1058
  }
1042
1059
  }
1043
1060
  }
@@ -1082,6 +1099,7 @@ function _ts_generator$e(thisArg, body) {
1082
1099
  * Also re-applies send exclusions to the updated config array.
1083
1100
  *
1084
1101
  * @param input - the current state and intended change
1102
+ * @returns the updated box config array and notification box recipient, if changes occurred
1085
1103
  * @throws notificationUserBlockedFromBeingAddedToRecipientsError when inserting a blocked user
1086
1104
  * @throws notificationUserLockedConfigFromBeingUpdatedError when updating a locked user's config
1087
1105
  */ function updateNotificationUserNotificationBoxRecipientConfig(input) {
@@ -1101,7 +1119,7 @@ function _ts_generator$e(thisArg, body) {
1101
1119
  // flag as removed in the NotificationUser details if not already flagged as such
1102
1120
  if (currentNotificationUserBoxIndexExists && currentNotificationUserBoxConfig.rm !== true) {
1103
1121
  var _currentNotificationUserBoxConfig_c;
1104
- updatedBc = _to_consumable_array$5(notificationUser.bc);
1122
+ updatedBc = _to_consumable_array$6(notificationUser.bc);
1105
1123
  updatedBc[currentNotificationUserBoxIndex] = _object_spread_props$b(_object_spread$c({}, currentNotificationUserBoxConfig), {
1106
1124
  nb: notificationBoxId,
1107
1125
  c: (_currentNotificationUserBoxConfig_c = currentNotificationUserBoxConfig.c) !== null && _currentNotificationUserBoxConfig_c !== void 0 ? _currentNotificationUserBoxConfig_c : {},
@@ -1147,7 +1165,7 @@ function _ts_generator$e(thisArg, body) {
1147
1165
  nb: notificationBoxId,
1148
1166
  rm: false // remove/clear the removed flag
1149
1167
  }), updateWithNotificationBoxRecipient);
1150
- updatedBc = _to_consumable_array$5(notificationUser.bc);
1168
+ updatedBc = _to_consumable_array$6(notificationUser.bc);
1151
1169
  if (currentNotificationUserBoxIndexExists) {
1152
1170
  updatedBc[currentNotificationUserBoxIndex] = updatedNotificationUserBoxEntry;
1153
1171
  } else {
@@ -1179,6 +1197,7 @@ function _ts_generator$e(thisArg, body) {
1179
1197
  *
1180
1198
  * @param inputCompletions - the current list of completed checkpoint strings
1181
1199
  * @param handleTaskResult - the handler result containing removal instructions
1200
+ * @returns the filtered completions array with specified checkpoints removed
1182
1201
  *
1183
1202
  * @example
1184
1203
  * ```ts
@@ -1212,7 +1231,7 @@ function _array_like_to_array$6(arr, len) {
1212
1231
  function _array_with_holes$2(arr) {
1213
1232
  if (Array.isArray(arr)) return arr;
1214
1233
  }
1215
- function _array_without_holes$4(arr) {
1234
+ function _array_without_holes$5(arr) {
1216
1235
  if (Array.isArray(arr)) return _array_like_to_array$6(arr);
1217
1236
  }
1218
1237
  function asyncGeneratorStep$d(gen, resolve, reject, _next, _throw, key, arg) {
@@ -1262,7 +1281,7 @@ function _define_property$c(obj, key, value) {
1262
1281
  }
1263
1282
  return obj;
1264
1283
  }
1265
- function _iterable_to_array$4(iter) {
1284
+ function _iterable_to_array$5(iter) {
1266
1285
  if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
1267
1286
  }
1268
1287
  function _iterable_to_array_limit$2(arr, i) {
@@ -1292,7 +1311,7 @@ function _iterable_to_array_limit$2(arr, i) {
1292
1311
  function _non_iterable_rest$2() {
1293
1312
  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
1313
  }
1295
- function _non_iterable_spread$4() {
1314
+ function _non_iterable_spread$5() {
1296
1315
  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
1316
  }
1298
1317
  function _object_spread$b(target) {
@@ -1332,8 +1351,8 @@ function _object_spread_props$a(target, source) {
1332
1351
  function _sliced_to_array$2(arr, i) {
1333
1352
  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
1353
  }
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();
1354
+ function _to_consumable_array$5(arr) {
1355
+ return _array_without_holes$5(arr) || _iterable_to_array$5(arr) || _unsupported_iterable_to_array$6(arr) || _non_iterable_spread$5();
1337
1356
  }
1338
1357
  function _unsupported_iterable_to_array$6(o, minLen) {
1339
1358
  if (!o) return;
@@ -1474,6 +1493,7 @@ function _ts_generator$d(thisArg, body) {
1474
1493
  * to its factory function using the provided context.
1475
1494
  *
1476
1495
  * @param context - the fully assembled notification server actions context
1496
+ * @returns a fully wired {@link NotificationServerActions} instance
1477
1497
  *
1478
1498
  * @example
1479
1499
  * ```ts
@@ -1503,6 +1523,9 @@ function _ts_generator$d(thisArg, body) {
1503
1523
  *
1504
1524
  * Validates the UID exists in Firebase Auth, then creates a new {@link NotificationUser} document
1505
1525
  * with empty default and global configs. Throws if the UID is not found in Auth.
1526
+ *
1527
+ * @param context - the notification server actions context with auth and collection access
1528
+ * @returns a transform-and-validate function that creates a new notification user document
1506
1529
  */ function createNotificationUserFactory(context) {
1507
1530
  var firebaseServerActionTransformFunctionFactory = context.firebaseServerActionTransformFunctionFactory, notificationUserCollection = context.notificationUserCollection, authService = context.authService;
1508
1531
  return firebaseServerActionTransformFunctionFactory(firebase.createNotificationUserParamsType, function(params) {
@@ -1567,6 +1590,9 @@ function _ts_generator$d(thisArg, body) {
1567
1590
  * Updates a {@link NotificationUser}'s default config (`dc`), global config (`gc`), and/or
1568
1591
  * box configs (`bc`). When the global config changes, iterates all box configs to propagate
1569
1592
  * effective recipient changes and marks affected entries for sync.
1593
+ *
1594
+ * @param context - the notification server actions context with Firestore and collection access
1595
+ * @returns a transform-and-validate function that updates an existing notification user document
1570
1596
  */ function updateNotificationUserFactory(context) {
1571
1597
  var firestoreContext = context.firestoreContext, firebaseServerActionTransformFunctionFactory = context.firebaseServerActionTransformFunctionFactory, notificationUserCollection = context.notificationUserCollection, appNotificationTemplateTypeInfoRecordService = context.appNotificationTemplateTypeInfoRecordService;
1572
1598
  return firebaseServerActionTransformFunctionFactory(firebase.updateNotificationUserParamsType, function(params) {
@@ -1686,6 +1712,9 @@ var MAX_NOTIFICATION_BOXES_TO_UPDATE_PER_BATCH = 50;
1686
1712
  * entries flagged with `ns=true` (needs-sync), loading the corresponding {@link NotificationBox},
1687
1713
  * and merging the user's preferences back into the box's recipient list. Handles removed entries
1688
1714
  * and cleans up stale box references.
1715
+ *
1716
+ * @param context - the notification server actions context with Firestore and collection access
1717
+ * @returns a transform-and-validate function that resyncs a notification user's box configurations
1689
1718
  */ function resyncNotificationUserFactory(context) {
1690
1719
  var firestoreContext = context.firestoreContext, firebaseServerActionTransformFunctionFactory = context.firebaseServerActionTransformFunctionFactory, notificationBoxCollection = context.notificationBoxCollection, notificationUserCollection = context.notificationUserCollection, appNotificationTemplateTypeInfoRecordService = context.appNotificationTemplateTypeInfoRecordService;
1691
1720
  return firebaseServerActionTransformFunctionFactory(firebase.resyncNotificationUserParamsType, function() {
@@ -1739,7 +1768,7 @@ var MAX_NOTIFICATION_BOXES_TO_UPDATE_PER_BATCH = 50;
1739
1768
  notificationBoxConfigsToSyncInThisBatchMap = util.makeModelMap(notificationBoxConfigsToSyncInThisBatch, function(x) {
1740
1769
  return x.nb;
1741
1770
  });
1742
- notificationBoxIdsToSyncInThisBatch = Array.from(notificationBoxConfigsToSyncInThisBatchMap.keys());
1771
+ notificationBoxIdsToSyncInThisBatch = _to_consumable_array$5(notificationBoxConfigsToSyncInThisBatchMap.keys());
1743
1772
  notificationBoxDocuments = firebase.loadDocumentsForIds(notificationBoxCollection.documentAccessorForTransaction(transaction), notificationBoxIdsToSyncInThisBatch);
1744
1773
  return [
1745
1774
  4,
@@ -1797,7 +1826,7 @@ var MAX_NOTIFICATION_BOXES_TO_UPDATE_PER_BATCH = 50;
1797
1826
  recipientHasChange = !util.areEqualPOJOValues(nextRecipient, recipient);
1798
1827
  // only update recipients if the next/new recipient is not equal to the existing one
1799
1828
  if (recipientHasChange) {
1800
- r = _to_consumable_array$4(notificationBox.r);
1829
+ r = _to_consumable_array$5(notificationBox.r);
1801
1830
  r[recipientIndex] = nextRecipient;
1802
1831
  nextRecipientsMap.set(nb, nextRecipient);
1803
1832
  } else {
@@ -1847,13 +1876,12 @@ var MAX_NOTIFICATION_BOXES_TO_UPDATE_PER_BATCH = 50;
1847
1876
  i: util.UNSET_INDEX_NUMBER
1848
1877
  });
1849
1878
  } else {
1850
- var _updatedRecipient_i;
1851
1879
  // else, use the updated recipient and keep/copy the
1852
1880
  var updatedRecipient = nextRecipientsMap.get(nb);
1853
1881
  nextConfig = _object_spread_props$a(_object_spread$b({}, existingConfig), {
1854
1882
  nb: nb,
1855
1883
  rm: false,
1856
- i: (_updatedRecipient_i = updatedRecipient.i) !== null && _updatedRecipient_i !== void 0 ? _updatedRecipient_i : util.UNSET_INDEX_NUMBER
1884
+ i: updatedRecipient.i
1857
1885
  });
1858
1886
  }
1859
1887
  }
@@ -1921,6 +1949,9 @@ var MAX_NOTIFICATION_BOXES_TO_UPDATE_PER_BATCH = 50;
1921
1949
  * Batch-processes all {@link NotificationUser} documents flagged for sync by querying
1922
1950
  * for entries with `ns=true`, then calling the resync logic for each in parallel
1923
1951
  * (up to 5 concurrent tasks). Loops until no more flagged users are found.
1952
+ *
1953
+ * @param context - the notification server actions context with collection access
1954
+ * @returns an async function that resyncs all flagged notification users and returns aggregate results
1924
1955
  */ function resyncAllNotificationUsersFactory(context) {
1925
1956
  var notificationUserCollection = context.notificationUserCollection;
1926
1957
  var resyncNotificationUser = resyncNotificationUserFactory(context);
@@ -2006,6 +2037,9 @@ var MAX_NOTIFICATION_BOXES_TO_UPDATE_PER_BATCH = 50;
2006
2037
  *
2007
2038
  * Creates a new {@link NotificationSummary} document for a model, generating the summary ID
2008
2039
  * from the model key and initializing it with a blank template.
2040
+ *
2041
+ * @param context - the notification server actions context with collection access
2042
+ * @returns a transform-and-validate function that creates a new notification summary document
2009
2043
  */ function createNotificationSummaryFactory(context) {
2010
2044
  var firebaseServerActionTransformFunctionFactory = context.firebaseServerActionTransformFunctionFactory, notificationSummaryCollection = context.notificationSummaryCollection;
2011
2045
  return firebaseServerActionTransformFunctionFactory(firebase.createNotificationSummaryParamsType, function(params) {
@@ -2048,6 +2082,9 @@ var MAX_NOTIFICATION_BOXES_TO_UPDATE_PER_BATCH = 50;
2048
2082
  *
2049
2083
  * Updates an existing {@link NotificationSummary} document's owner or setup flag.
2050
2084
  * Runs within a Firestore transaction to ensure consistency.
2085
+ *
2086
+ * @param context - the notification server actions context
2087
+ * @returns a transform-and-validate function that updates an existing notification summary document
2051
2088
  */ function updateNotificationSummaryFactory(context) {
2052
2089
  var firebaseServerActionTransformFunctionFactory = context.firebaseServerActionTransformFunctionFactory;
2053
2090
  return firebaseServerActionTransformFunctionFactory(firebase.updateNotificationSummaryParamsType, function(params) {
@@ -2102,6 +2139,9 @@ var MAX_NOTIFICATION_BOXES_TO_UPDATE_PER_BATCH = 50;
2102
2139
  *
2103
2140
  * Checks for existing boxes and throws if one already exists for the model.
2104
2141
  * Also syncs initial recipients with their corresponding {@link NotificationUser} documents.
2142
+ *
2143
+ * @param context - the base notification server actions context with collection access
2144
+ * @returns an async function that creates a notification box within a transaction and returns the document and template
2105
2145
  */ function createNotificationBoxInTransactionFactory(context) {
2106
2146
  var notificationBoxCollection = context.notificationBoxCollection;
2107
2147
  return function(params, transaction) {
@@ -2150,6 +2190,9 @@ var MAX_NOTIFICATION_BOXES_TO_UPDATE_PER_BATCH = 50;
2150
2190
  *
2151
2191
  * Wraps {@link createNotificationBoxInTransactionFactory} in a Firestore transaction
2152
2192
  * and follows the transform-and-validate pattern.
2193
+ *
2194
+ * @param context - the notification server actions context with Firestore and collection access
2195
+ * @returns a transform-and-validate function that creates a new notification box document
2153
2196
  */ function createNotificationBoxFactory(context) {
2154
2197
  var firestoreContext = context.firestoreContext, notificationBoxCollection = context.notificationBoxCollection, firebaseServerActionTransformFunctionFactory = context.firebaseServerActionTransformFunctionFactory;
2155
2198
  var createNotificationBoxInTransaction = createNotificationBoxInTransactionFactory(context);
@@ -2206,8 +2249,16 @@ var MAX_NOTIFICATION_BOXES_TO_UPDATE_PER_BATCH = 50;
2206
2249
  })();
2207
2250
  });
2208
2251
  }
2209
- function updateNotificationBoxFactory(param) {
2210
- var firebaseServerActionTransformFunctionFactory = param.firebaseServerActionTransformFunctionFactory;
2252
+ /**
2253
+ * Factory for the `updateNotificationBox` action.
2254
+ *
2255
+ * Currently a no-op placeholder that returns the document unchanged.
2256
+ * Reserved for future box-level update logic.
2257
+ *
2258
+ * @param context - the notification server actions context (destructured for the transform factory)
2259
+ * @returns a transform-and-validate function that returns the notification box document unchanged
2260
+ */ function updateNotificationBoxFactory(context) {
2261
+ var firebaseServerActionTransformFunctionFactory = context.firebaseServerActionTransformFunctionFactory;
2211
2262
  return firebaseServerActionTransformFunctionFactory(firebase.updateNotificationBoxParamsType, function() {
2212
2263
  return _async_to_generator$d(function() {
2213
2264
  return _ts_generator$d(this, function(_state) {
@@ -2234,6 +2285,9 @@ function updateNotificationBoxFactory(param) {
2234
2285
  *
2235
2286
  * Manages the exclusion list (`x`) on both the box recipient and the corresponding
2236
2287
  * {@link NotificationUser}'s send exclusion array, keeping them in sync.
2288
+ *
2289
+ * @param context - the base notification server actions context with collection access
2290
+ * @returns an async function that updates recipient exclusions within a transaction
2237
2291
  */ function updateNotificationBoxRecipientExclusionInTransactionFactory(context) {
2238
2292
  var notificationBoxCollection = context.notificationBoxCollection, notificationUserCollection = context.notificationUserCollection;
2239
2293
  return function(input, transaction) {
@@ -2269,7 +2323,7 @@ function updateNotificationBoxFactory(param) {
2269
2323
  targetRecipient = notificationBox.r.find(function(x) {
2270
2324
  return x.i === i;
2271
2325
  });
2272
- if (!targetRecipient || !targetRecipient.uid) {
2326
+ if (!(targetRecipient === null || targetRecipient === void 0 ? void 0 : targetRecipient.uid)) {
2273
2327
  throw notificationBoxExclusionTargetInvalidError();
2274
2328
  } else {
2275
2329
  targetUid = targetRecipient.uid;
@@ -2279,21 +2333,16 @@ function updateNotificationBoxFactory(param) {
2279
2333
  if (!targetUid) {
2280
2334
  throw notificationBoxExclusionTargetInvalidError();
2281
2335
  }
2282
- return [
2283
- 4,
2284
- notificationUserCollection.documentAccessorForTransaction(transaction).loadDocumentForId(targetUid)
2285
- ];
2286
- case 4:
2287
- notificationUserDocument = _state.sent();
2336
+ notificationUserDocument = notificationUserCollection.documentAccessorForTransaction(transaction).loadDocumentForId(targetUid);
2288
2337
  return [
2289
2338
  4,
2290
2339
  notificationUserDocument.snapshotData()
2291
2340
  ];
2292
- case 5:
2341
+ case 4:
2293
2342
  notificationUser = _state.sent();
2294
2343
  if (!notificationUser) return [
2295
2344
  3,
2296
- 7
2345
+ 6
2297
2346
  ];
2298
2347
  // only update if the user exists
2299
2348
  targetExclusions = [
@@ -2308,13 +2357,13 @@ function updateNotificationBoxFactory(param) {
2308
2357
  4,
2309
2358
  notificationUserDocument.update(notificationUserUpdate)
2310
2359
  ];
2311
- case 6:
2360
+ case 5:
2312
2361
  _state.sent();
2313
2362
  result = {
2314
2363
  notificationUserUpdate: notificationUserUpdate
2315
2364
  };
2316
- _state.label = 7;
2317
- case 7:
2365
+ _state.label = 6;
2366
+ case 6:
2318
2367
  return [
2319
2368
  2,
2320
2369
  result
@@ -2330,6 +2379,9 @@ function updateNotificationBoxFactory(param) {
2330
2379
  * Handles inserting new recipients, updating existing ones, and removing recipients.
2331
2380
  * Syncs changes with the recipient's {@link NotificationUser} document and manages
2332
2381
  * recipient index assignment via a sorted-values free-index calculator.
2382
+ *
2383
+ * @param context - the base notification server actions context with auth and collection access
2384
+ * @returns an async function that updates a recipient on a notification box within a transaction
2333
2385
  */ function updateNotificationBoxRecipientInTransactionFactory(context) {
2334
2386
  var authService = context.authService, notificationBoxCollection = context.notificationBoxCollection, notificationUserCollection = context.notificationUserCollection;
2335
2387
  var createNotificationBoxInTransaction = createNotificationBoxInTransactionFactory(context);
@@ -2387,14 +2439,14 @@ function updateNotificationBoxFactory(param) {
2387
2439
  case 4:
2388
2440
  if (!notificationBox) return [
2389
2441
  3,
2390
- 18
2442
+ 17
2391
2443
  ];
2392
2444
  notificationBox.m;
2393
2445
  targetRecipientIndex = notificationBox.r.findIndex(findRecipientFn);
2394
2446
  targetRecipient = notificationBox.r[targetRecipientIndex];
2395
2447
  if (remove) {
2396
- if (targetRecipientIndex != null) {
2397
- r = _to_consumable_array$4(notificationBox.r); // remove if they exist.
2448
+ if (targetRecipientIndex !== -1) {
2449
+ r = _to_consumable_array$5(notificationBox.r); // remove if they exist.
2398
2450
  delete r[targetRecipientIndex];
2399
2451
  }
2400
2452
  } else {
@@ -2407,7 +2459,7 @@ function updateNotificationBoxFactory(param) {
2407
2459
  i: (_ref1 = targetRecipient === null || targetRecipient === void 0 ? void 0 : targetRecipient.i) !== null && _ref1 !== void 0 ? _ref1 : util.UNSET_INDEX_NUMBER,
2408
2460
  c: c
2409
2461
  }, firebase.updateNotificationRecipient(targetRecipient !== null && targetRecipient !== void 0 ? targetRecipient : {}, params));
2410
- r = _to_consumable_array$4(notificationBox.r);
2462
+ r = _to_consumable_array$5(notificationBox.r);
2411
2463
  if (targetRecipient) {
2412
2464
  nextRecipient.i = targetRecipient.i;
2413
2465
  nextRecipient = firebase.mergeNotificationBoxRecipients(targetRecipient, nextRecipient);
@@ -2422,30 +2474,25 @@ function updateNotificationBoxFactory(param) {
2422
2474
  }
2423
2475
  if (!(r != null)) return [
2424
2476
  3,
2425
- 18
2477
+ 17
2426
2478
  ];
2427
2479
  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
2480
  if (!(notificationUserId != null)) return [
2429
2481
  3,
2430
- 13
2482
+ 12
2431
2483
  ];
2432
2484
  notificationBoxId = notificationBoxDocument.id;
2433
- return [
2434
- 4,
2435
- notificationUserCollection.documentAccessorForTransaction(transaction).loadDocumentForId(notificationUserId)
2436
- ];
2437
- case 5:
2438
- notificationUserDocument = _state.sent();
2485
+ notificationUserDocument = notificationUserCollection.documentAccessorForTransaction(transaction).loadDocumentForId(notificationUserId);
2439
2486
  return [
2440
2487
  4,
2441
2488
  notificationUserDocument.snapshotData()
2442
2489
  ];
2443
- case 6:
2490
+ case 5:
2444
2491
  notificationUser = _state.sent();
2445
2492
  createNotificationUser = !notificationUser && !remove && insert;
2446
2493
  if (!createNotificationUser) return [
2447
2494
  3,
2448
- 8
2495
+ 7
2449
2496
  ];
2450
2497
  // assert they exist in the auth system
2451
2498
  userContext = authService.userContext(notificationUserId);
@@ -2453,7 +2500,7 @@ function updateNotificationBoxFactory(param) {
2453
2500
  4,
2454
2501
  userContext.exists()
2455
2502
  ];
2456
- case 7:
2503
+ case 6:
2457
2504
  userExistsInAuth = _state.sent();
2458
2505
  if (!userExistsInAuth) {
2459
2506
  throw notificationUserInvalidUidForCreateError(notificationUserId);
@@ -2472,11 +2519,11 @@ function updateNotificationBoxFactory(param) {
2472
2519
  }
2473
2520
  };
2474
2521
  notificationUser = notificationUserTemplate;
2475
- _state.label = 8;
2476
- case 8:
2522
+ _state.label = 7;
2523
+ case 7:
2477
2524
  if (!(notificationUser != null)) return [
2478
2525
  3,
2479
- 13
2526
+ 12
2480
2527
  ];
2481
2528
  _updateNotificationUserNotificationBoxRecipientConfig = updateNotificationUserNotificationBoxRecipientConfig({
2482
2529
  notificationBoxId: notificationBoxId,
@@ -2491,7 +2538,7 @@ function updateNotificationBoxFactory(param) {
2491
2538
  }) : undefined;
2492
2539
  if (!createNotificationUser) return [
2493
2540
  3,
2494
- 10
2541
+ 9
2495
2542
  ];
2496
2543
  newUserTemplate = _object_spread_props$a(_object_spread$b({}, notificationUser), {
2497
2544
  bc: updatedBc !== null && updatedBc !== void 0 ? updatedBc : [],
@@ -2501,16 +2548,16 @@ function updateNotificationBoxFactory(param) {
2501
2548
  4,
2502
2549
  notificationUserDocument.create(newUserTemplate)
2503
2550
  ];
2504
- case 9:
2551
+ case 8:
2505
2552
  _state.sent();
2506
2553
  return [
2507
2554
  3,
2508
- 12
2555
+ 11
2509
2556
  ];
2510
- case 10:
2557
+ case 9:
2511
2558
  if (!(updatedBc != null)) return [
2512
2559
  3,
2513
- 12
2560
+ 11
2514
2561
  ];
2515
2562
  return [
2516
2563
  4,
@@ -2519,53 +2566,53 @@ function updateNotificationBoxFactory(param) {
2519
2566
  b: updatedB
2520
2567
  })
2521
2568
  ];
2522
- case 11:
2569
+ case 10:
2523
2570
  _state.sent();
2524
- _state.label = 12;
2525
- case 12:
2571
+ _state.label = 11;
2572
+ case 11:
2526
2573
  // Set if nextRecipient is updated/influence from existing configuration
2527
- if (targetRecipientIndex != null && updatedNotificationBoxRecipient && !remove) {
2574
+ if (targetRecipientIndex !== -1 && updatedNotificationBoxRecipient && !remove) {
2528
2575
  r[targetRecipientIndex] = updatedNotificationBoxRecipient; // set the updated value in r
2529
2576
  }
2530
- _state.label = 13;
2531
- case 13:
2577
+ _state.label = 12;
2578
+ case 12:
2532
2579
  updatedNotificationBox = _object_spread_props$a(_object_spread$b({}, notificationBox), {
2533
2580
  r: r
2534
2581
  });
2535
2582
  notificationBoxWasCreated = false;
2536
2583
  if (!createNotificationBox) return [
2537
2584
  3,
2538
- 15
2585
+ 14
2539
2586
  ];
2540
2587
  return [
2541
2588
  4,
2542
2589
  notificationBoxDocument.create(updatedNotificationBox)
2543
2590
  ];
2544
- case 14:
2591
+ case 13:
2545
2592
  _state.sent();
2546
2593
  notificationBoxWasCreated = true;
2547
2594
  return [
2548
2595
  3,
2549
- 17
2596
+ 16
2550
2597
  ];
2551
- case 15:
2598
+ case 14:
2552
2599
  return [
2553
2600
  4,
2554
2601
  notificationBoxDocument.update({
2555
2602
  r: r
2556
2603
  })
2557
2604
  ];
2558
- case 16:
2605
+ case 15:
2559
2606
  _state.sent();
2560
- _state.label = 17;
2561
- case 17:
2607
+ _state.label = 16;
2608
+ case 16:
2562
2609
  result = {
2563
2610
  updatedNotificationBox: updatedNotificationBox,
2564
2611
  notificationBoxWasCreated: notificationBoxWasCreated,
2565
2612
  notificationBoxDocument: notificationBoxDocument
2566
2613
  };
2567
- _state.label = 18;
2568
- case 18:
2614
+ _state.label = 17;
2615
+ case 17:
2569
2616
  return [
2570
2617
  2,
2571
2618
  result
@@ -2580,6 +2627,9 @@ function updateNotificationBoxFactory(param) {
2580
2627
  *
2581
2628
  * Wraps the in-transaction recipient update logic, handling both recipient changes
2582
2629
  * and send exclusion updates in a single Firestore transaction.
2630
+ *
2631
+ * @param context - the notification server actions context with Firestore and collection access
2632
+ * @returns a transform-and-validate function that updates a recipient on a notification box
2583
2633
  */ function updateNotificationBoxRecipientFactory(context) {
2584
2634
  var firestoreContext = context.firestoreContext, firebaseServerActionTransformFunctionFactory = context.firebaseServerActionTransformFunctionFactory;
2585
2635
  var updateNotificationBoxRecipientInTransaction = updateNotificationBoxRecipientInTransactionFactory(context);
@@ -2681,6 +2731,9 @@ var NOTIFICATION_TASK_TYPE_FAILURE_DELAY_MS = dateFns.hoursToMilliseconds(NOTIFI
2681
2731
  *
2682
2732
  * Supports throttling via `sendAt` time, configurable send flags, and task-based
2683
2733
  * async workflows for notifications that require multi-step processing.
2734
+ *
2735
+ * @param context - the notification server actions context with template, send, and task services
2736
+ * @returns a transform-and-validate function that processes and sends a notification document
2684
2737
  */ function sendNotificationFactory(context) {
2685
2738
  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
2739
  var createNotificationBoxInTransaction = createNotificationBoxInTransactionFactory(context);
@@ -2761,7 +2814,7 @@ var NOTIFICATION_TASK_TYPE_FAILURE_DELAY_MS = dateFns.hoursToMilliseconds(NOTIFI
2761
2814
  notificationTemplate.at = 0; // reset checkpoint attempt/delay count
2762
2815
  }
2763
2816
  // 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)));
2817
+ notificationTemplate.tpr = _to_consumable_array$5(removeFromCompletionsArrayWithTaskResult(notification.tpr, handleTaskResult)).concat(_to_consumable_array$5(util.asArray(completion)));
2765
2818
  // calculate the updated notification item
2766
2819
  notificationTemplate.n = _object_spread_props$a(_object_spread$b({}, notification.n), {
2767
2820
  d: _object_spread$b({}, notification.n.d, updateMetadata ? util.filterOnlyUndefinedValues(updateMetadata) : undefined // ignore any undefined values
@@ -2771,7 +2824,7 @@ var NOTIFICATION_TASK_TYPE_FAILURE_DELAY_MS = dateFns.hoursToMilliseconds(NOTIFI
2771
2824
  // if the tpr has not changed, then it is also considered a reversal
2772
2825
  if (tryRunNextPart) {
2773
2826
  tprChanged = !util.iterablesAreSetEquivalent(notification.tpr, notificationTemplate.tpr);
2774
- partTprReversal = !tprChanged || tprChanged && notificationTemplate.tpr.length <= notification.tpr.length;
2827
+ partTprReversal = !tprChanged || notificationTemplate.tpr.length <= notification.tpr.length;
2775
2828
  if (allCompletedSubTasks != null) {
2776
2829
  switch(allCompletedSubTasks){
2777
2830
  case true:
@@ -2780,11 +2833,13 @@ var NOTIFICATION_TASK_TYPE_FAILURE_DELAY_MS = dateFns.hoursToMilliseconds(NOTIFI
2780
2833
  tryRunNextPart = !partTprReversal;
2781
2834
  break;
2782
2835
  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;
2836
+ {
2837
+ // check subtask tpr changes
2838
+ nextCompleteSubTasks = util.asArray(allCompletedSubTasks);
2839
+ subtaskTprChanged = !util.iterablesAreSetEquivalent(previouslyCompleteSubTasks, nextCompleteSubTasks);
2840
+ partTprReversal = !subtaskTprChanged || nextCompleteSubTasks.length <= previouslyCompleteSubTasks.length;
2841
+ break;
2842
+ }
2788
2843
  }
2789
2844
  }
2790
2845
  }
@@ -3003,7 +3058,8 @@ var NOTIFICATION_TASK_TYPE_FAILURE_DELAY_MS = dateFns.hoursToMilliseconds(NOTIFI
3003
3058
  ];
3004
3059
  case 2:
3005
3060
  _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;
3061
+ es = notification.es, ts = notification.ts, ps = notification.ps, ns = notification.ns;
3062
+ currentEsr = notification.esr, currentTsr = notification.tsr;
3007
3063
  if (!(es === firebase.NotificationSendState.QUEUED || es === firebase.NotificationSendState.SENT_PARTIAL)) return [
3008
3064
  3,
3009
3065
  15
@@ -3110,9 +3166,9 @@ var NOTIFICATION_TASK_TYPE_FAILURE_DELAY_MS = dateFns.hoursToMilliseconds(NOTIFI
3110
3166
  case 13:
3111
3167
  if (sendEmailsResult != null) {
3112
3168
  success1 = sendEmailsResult.success, failed = sendEmailsResult.failed;
3113
- esr = success1.length ? currentEsr.concat(success1.map(function(x) {
3169
+ esr = success1.length ? _to_consumable_array$5(currentEsr).concat(_to_consumable_array$5(success1.map(function(x) {
3114
3170
  return x.toLowerCase();
3115
- })) : undefined;
3171
+ }))) : undefined;
3116
3172
  if (failed.length > 0) {
3117
3173
  es = firebase.NotificationSendState.SENT_PARTIAL;
3118
3174
  } else {
@@ -3231,7 +3287,7 @@ var NOTIFICATION_TASK_TYPE_FAILURE_DELAY_MS = dateFns.hoursToMilliseconds(NOTIFI
3231
3287
  case 26:
3232
3288
  if (sendTextsResult != null) {
3233
3289
  success2 = sendTextsResult.success, failed1 = sendTextsResult.failed;
3234
- tsr = success2.length ? currentTsr.concat(success2) : undefined;
3290
+ tsr = success2.length ? _to_consumable_array$5(currentTsr).concat(_to_consumable_array$5(success2)) : undefined;
3235
3291
  if (failed1.length > 0) {
3236
3292
  ts = firebase.NotificationSendState.SENT_PARTIAL;
3237
3293
  } else {
@@ -3439,6 +3495,10 @@ var NOTIFICATION_TASK_TYPE_FAILURE_DELAY_MS = dateFns.hoursToMilliseconds(NOTIFI
3439
3495
  // deleted successfully
3440
3496
  success = deletedNotification;
3441
3497
  break;
3498
+ case firebase.NotificationSendType.INIT_BOX_AND_SEND:
3499
+ case firebase.NotificationSendType.SEND_WITHOUT_CREATING_BOX:
3500
+ case firebase.NotificationSendType.TASK_NOTIFICATION:
3501
+ break;
3442
3502
  }
3443
3503
  _state.label = 48;
3444
3504
  case 48:
@@ -3459,7 +3519,7 @@ var NOTIFICATION_TASK_TYPE_FAILURE_DELAY_MS = dateFns.hoursToMilliseconds(NOTIFI
3459
3519
  4,
3460
3520
  firestoreContext.runTransaction(function(transaction) {
3461
3521
  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
3522
+ 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
3523
  , delay, _notification_ois, _notification_ots, templateTypeInfo, retryAttempts, delay1, _, notificationBoxTemplate, isAtMaxAttempts, a;
3464
3524
  function deleteNotification() {
3465
3525
  return _async_to_generator$d(function() {
@@ -3497,7 +3557,8 @@ var NOTIFICATION_TASK_TYPE_FAILURE_DELAY_MS = dateFns.hoursToMilliseconds(NOTIFI
3497
3557
  _ref = _sliced_to_array$2.apply(void 0, [
3498
3558
  _state.sent(),
3499
3559
  2
3500
- ]), notificationBox = _ref[0], notification = _ref[1];
3560
+ ]), initialNotificationBox = _ref[0], notification = _ref[1];
3561
+ notificationBox = initialNotificationBox;
3501
3562
  model = firebase.inferKeyFromTwoWayFlatFirestoreModelKey(notificationBoxDocument.id);
3502
3563
  isNotificationTask = (notification === null || notification === void 0 ? void 0 : notification.st) === firebase.NotificationSendType.TASK_NOTIFICATION;
3503
3564
  tryRun = true;
@@ -3525,7 +3586,7 @@ var NOTIFICATION_TASK_TYPE_FAILURE_DELAY_MS = dateFns.hoursToMilliseconds(NOTIFI
3525
3586
  notificationBoxNeedsInitialization = false;
3526
3587
  if (!(notification && tryRun)) return [
3527
3588
  3,
3528
- 18
3589
+ 19
3529
3590
  ];
3530
3591
  // if we're still trying to run, check the template is ok. If not, cancel the run.
3531
3592
  t = notification.n.t;
@@ -3582,7 +3643,7 @@ var NOTIFICATION_TASK_TYPE_FAILURE_DELAY_MS = dateFns.hoursToMilliseconds(NOTIFI
3582
3643
  case 7:
3583
3644
  return [
3584
3645
  3,
3585
- 18
3646
+ 19
3586
3647
  ];
3587
3648
  case 8:
3588
3649
  templateInstance = notificationTemplateService.templateInstanceForType(t);
@@ -3603,7 +3664,7 @@ var NOTIFICATION_TASK_TYPE_FAILURE_DELAY_MS = dateFns.hoursToMilliseconds(NOTIFI
3603
3664
  9
3604
3665
  ];
3605
3666
  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."));
3667
+ 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
3668
  } else {
3608
3669
  console.warn('Unknown template type of "'.concat(t, '" was found in a Notification. Send is being delayed by ').concat(delay1, " hours."));
3609
3670
  }
@@ -3627,7 +3688,7 @@ var NOTIFICATION_TASK_TYPE_FAILURE_DELAY_MS = dateFns.hoursToMilliseconds(NOTIFI
3627
3688
  case 11:
3628
3689
  if (!(!notificationBox && tryRun)) return [
3629
3690
  3,
3630
- 17
3691
+ 18
3631
3692
  ];
3632
3693
  _ = notification.st;
3633
3694
  switch(_){
@@ -3646,10 +3707,15 @@ var NOTIFICATION_TASK_TYPE_FAILURE_DELAY_MS = dateFns.hoursToMilliseconds(NOTIFI
3646
3707
  3,
3647
3708
  16
3648
3709
  ];
3710
+ case firebase.NotificationSendType.TASK_NOTIFICATION:
3711
+ return [
3712
+ 3,
3713
+ 17
3714
+ ];
3649
3715
  }
3650
3716
  return [
3651
3717
  3,
3652
- 17
3718
+ 18
3653
3719
  ];
3654
3720
  case 12:
3655
3721
  return [
@@ -3664,7 +3730,7 @@ var NOTIFICATION_TASK_TYPE_FAILURE_DELAY_MS = dateFns.hoursToMilliseconds(NOTIFI
3664
3730
  createdBox = true;
3665
3731
  return [
3666
3732
  3,
3667
- 17
3733
+ 18
3668
3734
  ];
3669
3735
  case 14:
3670
3736
  // delete the notification since it won't get sent.
@@ -3676,43 +3742,49 @@ var NOTIFICATION_TASK_TYPE_FAILURE_DELAY_MS = dateFns.hoursToMilliseconds(NOTIFI
3676
3742
  _state.sent();
3677
3743
  return [
3678
3744
  3,
3679
- 17
3745
+ 18
3680
3746
  ];
3681
3747
  case 16:
3682
3748
  // continue with current tryRun
3683
3749
  return [
3684
3750
  3,
3685
- 17
3751
+ 18
3686
3752
  ];
3687
3753
  case 17:
3754
+ // task notifications do not require a notification box; continue with current tryRun
3755
+ return [
3756
+ 3,
3757
+ 18
3758
+ ];
3759
+ case 18:
3688
3760
  // if the notification box is not initialized/synchronized yet, do not run.
3689
3761
  if (tryRun && notificationBox && notificationBox.s) {
3690
3762
  notificationBoxNeedsInitialization = true;
3691
3763
  tryRun = false;
3692
3764
  nextSat = dateFns.addMinutes(now, NOTIFICATION_BOX_NOT_INITIALIZED_DELAY_MINUTES);
3693
3765
  }
3694
- _state.label = 18;
3695
- case 18:
3766
+ _state.label = 19;
3767
+ case 19:
3696
3768
  if (!(notification != null && nextSat != null && !deletedNotification)) return [
3697
3769
  3,
3698
- 22
3770
+ 23
3699
3771
  ];
3700
3772
  isAtMaxAttempts = notification.a >= NOTIFICATION_MAX_SEND_ATTEMPTS;
3701
3773
  if (!(isAtMaxAttempts && notificationBoxNeedsInitialization)) return [
3702
3774
  3,
3703
- 20
3775
+ 21
3704
3776
  ];
3705
3777
  return [
3706
3778
  4,
3707
3779
  deleteNotification()
3708
3780
  ];
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
3781
  case 20:
3782
+ _state.sent(); // just delete the notification if the box still hasn't been initialized successfully at this point.
3783
+ _state.label = 21;
3784
+ case 21:
3713
3785
  if (!!deletedNotification) return [
3714
3786
  3,
3715
- 22
3787
+ 23
3716
3788
  ];
3717
3789
  a = isNotificationTask && tryRun ? notification.a : notification.a + 1; // do not update a notification task's attempt count here, unless tryRun fails
3718
3790
  // 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 +3795,10 @@ var NOTIFICATION_TASK_TYPE_FAILURE_DELAY_MS = dateFns.hoursToMilliseconds(NOTIFI
3723
3795
  a: a
3724
3796
  })
3725
3797
  ];
3726
- case 21:
3727
- _state.sent();
3728
- _state.label = 22;
3729
3798
  case 22:
3799
+ _state.sent();
3800
+ _state.label = 23;
3801
+ case 23:
3730
3802
  return [
3731
3803
  2,
3732
3804
  {
@@ -3838,6 +3910,9 @@ var NOTIFICATION_TASK_TYPE_FAILURE_DELAY_MS = dateFns.hoursToMilliseconds(NOTIFI
3838
3910
  * and an optional {@link NotificationExpediteService} for immediate delivery.
3839
3911
  * Continues processing batches until no more queued notifications are found
3840
3912
  * or the time budget is exhausted.
3913
+ *
3914
+ * @param context - the notification server actions context with collection group and send factory access
3915
+ * @returns a transform-and-validate function that processes all queued notifications and returns aggregate results
3841
3916
  */ function sendQueuedNotificationsFactory(context) {
3842
3917
  var firebaseServerActionTransformFunctionFactory = context.firebaseServerActionTransformFunctionFactory, notificationCollectionGroup = context.notificationCollectionGroup;
3843
3918
  var sendNotification = sendNotificationFactory(context);
@@ -3879,7 +3954,7 @@ var NOTIFICATION_TASK_TYPE_FAILURE_DELAY_MS = dateFns.hoursToMilliseconds(NOTIFI
3879
3954
  excessLoopsDetected = false;
3880
3955
  sendQueuedNotifications = function sendQueuedNotifications() {
3881
3956
  return _async_to_generator$d(function() {
3882
- var query, notificationDocuments, result;
3957
+ var query, notificationDocuments;
3883
3958
  return _ts_generator$d(this, function(_state) {
3884
3959
  switch(_state.label){
3885
3960
  case 0:
@@ -3891,7 +3966,7 @@ var NOTIFICATION_TASK_TYPE_FAILURE_DELAY_MS = dateFns.hoursToMilliseconds(NOTIFI
3891
3966
  case 1:
3892
3967
  notificationDocuments = _state.sent();
3893
3968
  return [
3894
- 4,
3969
+ 2,
3895
3970
  util.performAsyncTasks(notificationDocuments, function(notificationDocument) {
3896
3971
  return _async_to_generator$d(function() {
3897
3972
  var result;
@@ -3916,12 +3991,6 @@ var NOTIFICATION_TASK_TYPE_FAILURE_DELAY_MS = dateFns.hoursToMilliseconds(NOTIFI
3916
3991
  maxParallelTasks: maxParallelTasks
3917
3992
  })
3918
3993
  ];
3919
- case 2:
3920
- result = _state.sent();
3921
- return [
3922
- 2,
3923
- result
3924
- ];
3925
3994
  }
3926
3995
  });
3927
3996
  })();
@@ -4011,6 +4080,9 @@ var NOTIFICATION_TASK_TYPE_FAILURE_DELAY_MS = dateFns.hoursToMilliseconds(NOTIFI
4011
4080
  * Queries for {@link Notification} documents that are ready for cleanup (fully sent,
4012
4081
  * past the retention window) and deletes them in batches. Continues until no more
4013
4082
  * cleanup-eligible notifications are found.
4083
+ *
4084
+ * @param context - the notification server actions context with Firestore and collection access
4085
+ * @returns a transform-and-validate function that cleans up sent notification documents and returns aggregate results
4014
4086
  */ function cleanupSentNotificationsFactory(context) {
4015
4087
  var firestoreContext = context.firestoreContext, firebaseServerActionTransformFunctionFactory = context.firebaseServerActionTransformFunctionFactory, notificationCollectionGroup = context.notificationCollectionGroup, notificationBoxCollection = context.notificationBoxCollection, notificationWeekCollectionFactory = context.notificationWeekCollectionFactory;
4016
4088
  return firebaseServerActionTransformFunctionFactory(firebase.cleanupSentNotificationsParamsType, function() {
@@ -4023,7 +4095,7 @@ var NOTIFICATION_TASK_TYPE_FAILURE_DELAY_MS = dateFns.hoursToMilliseconds(NOTIFI
4023
4095
  var notificationBoxesUpdatesCount, notificationsDeleted, notificationTasksDeletedCount, notificationWeeksCreated, notificationWeeksUpdated, cleanupSentNotificationsResults, notificationBoxesUpdated, result;
4024
4096
  function cleanupSentNotifications() {
4025
4097
  return _async_to_generator$d(function() {
4026
- var query, notificationDocuments, notificationDocumentsGroupedByNotificationBox, result;
4098
+ var query, notificationDocuments, notificationDocumentsGroupedByNotificationBox;
4027
4099
  return _ts_generator$d(this, function(_state) {
4028
4100
  switch(_state.label){
4029
4101
  case 0:
@@ -4034,14 +4106,14 @@ var NOTIFICATION_TASK_TYPE_FAILURE_DELAY_MS = dateFns.hoursToMilliseconds(NOTIFI
4034
4106
  ];
4035
4107
  case 1:
4036
4108
  notificationDocuments = _state.sent();
4037
- notificationDocumentsGroupedByNotificationBox = Array.from(util.makeValuesGroupMap(notificationDocuments, function(x) {
4109
+ notificationDocumentsGroupedByNotificationBox = _to_consumable_array$5(util.makeValuesGroupMap(notificationDocuments, function(x) {
4038
4110
  return x.parent.id;
4039
4111
  }).values());
4040
4112
  return [
4041
- 4,
4113
+ 2,
4042
4114
  util.performAsyncTasks(notificationDocumentsGroupedByNotificationBox, function(notificationDocumentsInSameBox) {
4043
4115
  return _async_to_generator$d(function() {
4044
- var allPairs, allPairsWithDataAndMarkedDeleted, _separateValues, taskPairsWithDataAndMarkedDeleted, normalPairsWithDataAndMarkedDeleted, pairsGroupedByWeek, pairsGroupedByWeekInBatches, notificationBoxDocument, notificationWeekResults, writeBatch, writeBatchAccessor, weeksCreated, weeksUpdated, tasksDeleted, result;
4116
+ var allPairs, allPairsWithDataAndMarkedDeleted, _separateValues, taskPairsWithDataAndMarkedDeleted, normalPairsWithDataAndMarkedDeleted, pairsGroupedByWeek, pairsGroupedByWeekInBatches, notificationBoxDocument, notificationWeekResults, writeBatch, writeBatchAccessor, weeksCreated, weeksUpdated, tasksDeleted;
4045
4117
  return _ts_generator$d(this, function(_state) {
4046
4118
  switch(_state.label){
4047
4119
  case 0:
@@ -4059,11 +4131,11 @@ var NOTIFICATION_TASK_TYPE_FAILURE_DELAY_MS = dateFns.hoursToMilliseconds(NOTIFI
4059
4131
  var _x_data;
4060
4132
  return ((_x_data = x.data) === null || _x_data === void 0 ? void 0 : _x_data.st) === firebase.NotificationSendType.TASK_NOTIFICATION;
4061
4133
  }), taskPairsWithDataAndMarkedDeleted = _separateValues.included, normalPairsWithDataAndMarkedDeleted = _separateValues.excluded;
4062
- pairsGroupedByWeek = Array.from(util.makeValuesGroupMap(normalPairsWithDataAndMarkedDeleted, function(x) {
4134
+ pairsGroupedByWeek = _to_consumable_array$5(util.makeValuesGroupMap(normalPairsWithDataAndMarkedDeleted, function(x) {
4063
4135
  return date.yearWeekCode(x.data.sat);
4064
4136
  }).entries());
4065
4137
  // batch incase there are a lot of new notifications to move to week
4066
- pairsGroupedByWeekInBatches = pairsGroupedByWeek.map(function(x) {
4138
+ pairsGroupedByWeekInBatches = pairsGroupedByWeek.flatMap(function(x) {
4067
4139
  var batches = util.batch(x[1], 40);
4068
4140
  return batches.map(function(batch) {
4069
4141
  return [
@@ -4071,13 +4143,8 @@ var NOTIFICATION_TASK_TYPE_FAILURE_DELAY_MS = dateFns.hoursToMilliseconds(NOTIFI
4071
4143
  batch
4072
4144
  ];
4073
4145
  });
4074
- }).flat();
4075
- return [
4076
- 4,
4077
- notificationBoxCollection.documentAccessor().loadDocument(notificationDocumentsInSameBox[0].parent)
4078
- ];
4079
- case 2:
4080
- notificationBoxDocument = _state.sent();
4146
+ });
4147
+ notificationBoxDocument = notificationBoxCollection.documentAccessor().loadDocument(notificationDocumentsInSameBox[0].parent);
4081
4148
  return [
4082
4149
  4,
4083
4150
  util.performAsyncTasks(pairsGroupedByWeekInBatches, function(param) {
@@ -4107,7 +4174,7 @@ var NOTIFICATION_TASK_TYPE_FAILURE_DELAY_MS = dateFns.hoursToMilliseconds(NOTIFI
4107
4174
  var shouldSaveToNotificationWeek = firebase.shouldSaveNotificationToNotificationWeek(data);
4108
4175
  return shouldSaveToNotificationWeek ? data.n : undefined;
4109
4176
  }));
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));
4177
+ 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
4178
  if (!!notificationWeek) return [
4112
4179
  3,
4113
4180
  3
@@ -4162,7 +4229,7 @@ var NOTIFICATION_TASK_TYPE_FAILURE_DELAY_MS = dateFns.hoursToMilliseconds(NOTIFI
4162
4229
  })();
4163
4230
  })
4164
4231
  ];
4165
- case 3:
4232
+ case 2:
4166
4233
  notificationWeekResults = _state.sent();
4167
4234
  // delete all the task notifications
4168
4235
  writeBatch = firestoreContext.batch();
@@ -4173,13 +4240,13 @@ var NOTIFICATION_TASK_TYPE_FAILURE_DELAY_MS = dateFns.hoursToMilliseconds(NOTIFI
4173
4240
  return writeBatchAccessor.loadDocumentFrom(x.document).accessor.delete();
4174
4241
  }))
4175
4242
  ];
4176
- case 4:
4243
+ case 3:
4177
4244
  _state.sent();
4178
4245
  return [
4179
4246
  4,
4180
4247
  writeBatch.commit()
4181
4248
  ];
4182
- case 5:
4249
+ case 4:
4183
4250
  _state.sent();
4184
4251
  weeksCreated = 0;
4185
4252
  weeksUpdated = 0;
@@ -4191,15 +4258,14 @@ var NOTIFICATION_TASK_TYPE_FAILURE_DELAY_MS = dateFns.hoursToMilliseconds(NOTIFI
4191
4258
  weeksUpdated += 1;
4192
4259
  }
4193
4260
  });
4194
- result = {
4195
- weeksCreated: weeksCreated,
4196
- weeksUpdated: weeksUpdated,
4197
- itemsDeleted: allPairsWithDataAndMarkedDeleted.length,
4198
- tasksDeleted: tasksDeleted
4199
- };
4200
4261
  return [
4201
4262
  2,
4202
- result
4263
+ {
4264
+ weeksCreated: weeksCreated,
4265
+ weeksUpdated: weeksUpdated,
4266
+ itemsDeleted: allPairsWithDataAndMarkedDeleted.length,
4267
+ tasksDeleted: tasksDeleted
4268
+ }
4203
4269
  ];
4204
4270
  }
4205
4271
  });
@@ -4208,12 +4274,6 @@ var NOTIFICATION_TASK_TYPE_FAILURE_DELAY_MS = dateFns.hoursToMilliseconds(NOTIFI
4208
4274
  maxParallelTasks: 10
4209
4275
  })
4210
4276
  ];
4211
- case 2:
4212
- result = _state.sent();
4213
- return [
4214
- 2,
4215
- result
4216
- ];
4217
4277
  }
4218
4278
  });
4219
4279
  })();
@@ -4478,6 +4538,7 @@ var MAKE_TEMPLATE_FOR_NOTIFICATION_RELATED_MODEL_INITIALIZATION_FUNCTION_DELETE_
4478
4538
  * initialization action to its factory function.
4479
4539
  *
4480
4540
  * @param context - the initialization context with template functions and Firestore access
4541
+ * @returns a fully wired {@link NotificationInitServerActions} instance
4481
4542
  *
4482
4543
  * @example
4483
4544
  * ```ts
@@ -4504,6 +4565,7 @@ var MAKE_TEMPLATE_FOR_NOTIFICATION_RELATED_MODEL_INITIALIZATION_FUNCTION_DELETE_
4504
4565
  * Skips initialization if the model is already initialized, optionally throwing an error.
4505
4566
  *
4506
4567
  * @param input - the document, transaction, template function, and options
4568
+ * @returns an object with `initialized` and `alreadyInitialized` boolean flags
4507
4569
  * @throws notificationModelAlreadyInitializedError when `throwErrorIfAlreadyInitialized` is true
4508
4570
  */ function initializeNotificationModelInTransaction(input) {
4509
4571
  return _async_to_generator$c(function() {
@@ -4605,6 +4667,9 @@ var MAKE_TEMPLATE_FOR_NOTIFICATION_RELATED_MODEL_INITIALIZATION_FUNCTION_DELETE_
4605
4667
  *
4606
4668
  * Loads the box document in the transaction, reads its current data, and delegates
4607
4669
  * to {@link initializeNotificationModelInTransaction} with the box-specific template function.
4670
+ *
4671
+ * @param context - the initialization context with collection references and template functions
4672
+ * @returns an async function that initializes a notification box given params, document, and transaction
4608
4673
  */ function initializeNotificationBoxInTransactionFactory(context) {
4609
4674
  var notificationBoxCollection = context.notificationBoxCollection, makeTemplateForNotificationBoxInitialization = context.makeTemplateForNotificationBoxInitialization;
4610
4675
  return function(params, notificationBoxDocument, transaction) {
@@ -4641,6 +4706,9 @@ var MAKE_TEMPLATE_FOR_NOTIFICATION_RELATED_MODEL_INITIALIZATION_FUNCTION_DELETE_
4641
4706
  *
4642
4707
  * Wraps the in-transaction initialization in a Firestore transaction
4643
4708
  * and follows the transform-and-validate pattern.
4709
+ *
4710
+ * @param context - the initialization context with Firestore access and template functions
4711
+ * @returns a transform-and-validate function that initializes a single notification box
4644
4712
  */ function initializeNotificationBoxFactory(context) {
4645
4713
  var firestoreContext = context.firestoreContext, firebaseServerActionTransformFunctionFactory = context.firebaseServerActionTransformFunctionFactory;
4646
4714
  var initializeNotificationBoxInTransaction = initializeNotificationBoxInTransactionFactory(context);
@@ -4681,8 +4749,11 @@ var MAKE_TEMPLATE_FOR_NOTIFICATION_RELATED_MODEL_INITIALIZATION_FUNCTION_DELETE_
4681
4749
  * Batch-processes all {@link NotificationBox} documents flagged for initialization
4682
4750
  * by querying for entries with `s=true` (setup needed), then initializing each in
4683
4751
  * parallel (up to 5 concurrent tasks). Loops until no more flagged boxes are found.
4752
+ *
4753
+ * @param context - the initialization context with Firestore access and collection references
4754
+ * @returns a transform-and-validate function that batch-initializes all applicable notification boxes
4684
4755
  */ function initializeAllApplicableNotificationBoxesFactory(context) {
4685
- var firestoreContext = context.firestoreContext, firebaseServerActionTransformFunctionFactory = context.firebaseServerActionTransformFunctionFactory, notificationBoxCollection = context.notificationBoxCollection; context.notificationCollectionGroup;
4756
+ var firestoreContext = context.firestoreContext, firebaseServerActionTransformFunctionFactory = context.firebaseServerActionTransformFunctionFactory, notificationBoxCollection = context.notificationBoxCollection;
4686
4757
  var initializeNotificationBoxInTransaction = initializeNotificationBoxInTransactionFactory(context);
4687
4758
  return firebaseServerActionTransformFunctionFactory(firebase.initializeAllApplicableNotificationBoxesParamsType, function() {
4688
4759
  return _async_to_generator$c(function() {
@@ -4798,6 +4869,9 @@ var MAKE_TEMPLATE_FOR_NOTIFICATION_RELATED_MODEL_INITIALIZATION_FUNCTION_DELETE_
4798
4869
  *
4799
4870
  * Loads the summary document in the transaction, reads its current data, and delegates
4800
4871
  * to {@link initializeNotificationModelInTransaction} with the summary-specific template function.
4872
+ *
4873
+ * @param context - the initialization context with collection references and template functions
4874
+ * @returns an async function that initializes a notification summary given params, document, and transaction
4801
4875
  */ function initializeNotificationSummaryInTransactionFactory(context) {
4802
4876
  var notificationSummaryCollection = context.notificationSummaryCollection, makeTemplateForNotificationSummaryInitialization = context.makeTemplateForNotificationSummaryInitialization;
4803
4877
  return function(params, notificationSummaryDocument, transaction) {
@@ -4834,6 +4908,9 @@ var MAKE_TEMPLATE_FOR_NOTIFICATION_RELATED_MODEL_INITIALIZATION_FUNCTION_DELETE_
4834
4908
  *
4835
4909
  * Wraps the in-transaction summary initialization in a Firestore transaction
4836
4910
  * and follows the transform-and-validate pattern.
4911
+ *
4912
+ * @param context - the initialization context with Firestore access and template functions
4913
+ * @returns a transform-and-validate function that initializes a single notification summary
4837
4914
  */ function initializeNotificationSummaryFactory(context) {
4838
4915
  var firestoreContext = context.firestoreContext, firebaseServerActionTransformFunctionFactory = context.firebaseServerActionTransformFunctionFactory;
4839
4916
  var initializeNotificationSummaryInTransaction = initializeNotificationSummaryInTransactionFactory(context);
@@ -4874,8 +4951,11 @@ var MAKE_TEMPLATE_FOR_NOTIFICATION_RELATED_MODEL_INITIALIZATION_FUNCTION_DELETE_
4874
4951
  * Batch-processes all {@link NotificationSummary} documents flagged for initialization
4875
4952
  * by querying for entries with `s=true` (setup needed), then initializing each in
4876
4953
  * parallel (up to 5 concurrent tasks). Loops until no more flagged summaries are found.
4954
+ *
4955
+ * @param context - the initialization context with Firestore access and collection references
4956
+ * @returns a transform-and-validate function that batch-initializes all applicable notification summaries
4877
4957
  */ function initializeAllApplicableNotificationSummariesFactory(context) {
4878
- var firestoreContext = context.firestoreContext, firebaseServerActionTransformFunctionFactory = context.firebaseServerActionTransformFunctionFactory, notificationSummaryCollection = context.notificationSummaryCollection; context.notificationCollectionGroup;
4958
+ var firestoreContext = context.firestoreContext, firebaseServerActionTransformFunctionFactory = context.firebaseServerActionTransformFunctionFactory, notificationSummaryCollection = context.notificationSummaryCollection;
4879
4959
  var initializeNotificationSummaryInTransaction = initializeNotificationSummaryInTransactionFactory(context);
4880
4960
  return firebaseServerActionTransformFunctionFactory(firebase.initializeAllApplicableNotificationSummariesParamsType, function() {
4881
4961
  return _async_to_generator$c(function() {
@@ -5229,6 +5309,7 @@ function _ts_generator$b(thisArg, body) {
5229
5309
  * pre-wired with the resolved factory for that type.
5230
5310
  *
5231
5311
  * @param type - the notification template type
5312
+ * @returns a new {@link NotificationTemplateServiceInstance} bound to the given type
5232
5313
  */ key: "templateInstanceForType",
5233
5314
  value: function templateInstanceForType(type) {
5234
5315
  return notificationTemplateServiceInstance(this, type);
@@ -5250,6 +5331,7 @@ exports.NotificationTemplateService = __decorate([
5250
5331
  *
5251
5332
  * @param service - the parent template service
5252
5333
  * @param type - the template type to bind
5334
+ * @returns a {@link NotificationTemplateServiceInstance} with the resolved factory for the type
5253
5335
  *
5254
5336
  * @example
5255
5337
  * ```ts
@@ -5471,6 +5553,7 @@ function _ts_generator$a(thisArg, body) {
5471
5553
  * Does not support Firestore transactions, as running should occur outside of a transaction.
5472
5554
  *
5473
5555
  * @param input - creation and run configuration
5556
+ * @returns the creation pair result with optional send/enqueue outcomes
5474
5557
  * @throws Error if the notification template is not flagged as unique
5475
5558
  *
5476
5559
  * @example
@@ -5829,8 +5912,8 @@ function _ts_generator$9(thisArg, body) {
5829
5912
  /**
5830
5913
  * Creates a new NotificationExpediteServiceInstance with the input NotificationExpediteService.
5831
5914
 
5832
- * @param notificationExpediteService
5833
- * @returns
5915
+ * @param notificationExpediteService - the expedite service to use for sending
5916
+ * @returns a new {@link NotificationExpediteServiceInstance} with an internal queue
5834
5917
  */ function notificationExpediteServiceInstance(notificationExpediteService) {
5835
5918
  var _documentsToSend = [];
5836
5919
  var initialize = function initialize() {
@@ -5849,28 +5932,18 @@ function _ts_generator$9(thisArg, body) {
5849
5932
  };
5850
5933
  var send = function send(options) {
5851
5934
  return _async_to_generator$9(function() {
5852
- var results;
5853
5935
  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
- }
5936
+ return [
5937
+ 2,
5938
+ util.runAsyncTasksForValues(_documentsToSend, function(x) {
5939
+ return notificationExpediteService.sendNotification(x, options);
5940
+ }, {
5941
+ nonConcurrentTaskKeyFactory: function nonConcurrentTaskKeyFactory(x) {
5942
+ return x.parent.id // only send one notification at a time for a notification box
5943
+ ;
5944
+ }
5945
+ })
5946
+ ];
5874
5947
  });
5875
5948
  })();
5876
5949
  };
@@ -5898,6 +5971,8 @@ function _ts_generator$9(thisArg, body) {
5898
5971
  {
5899
5972
  /**
5900
5973
  * Returns the configured NotificationServerActions instance.
5974
+ *
5975
+ * @returns the current {@link NotificationServerActions} instance
5901
5976
  */ key: "getNotificationServerActions",
5902
5977
  value: function getNotificationServerActions() {
5903
5978
  return this._notificationServerActions;
@@ -5906,6 +5981,8 @@ function _ts_generator$9(thisArg, body) {
5906
5981
  {
5907
5982
  /**
5908
5983
  * Sets the NotificationServerActions instance to use.
5984
+ *
5985
+ * @param notificationServerActions - the actions instance to configure
5909
5986
  */ key: "setNotificationServerActions",
5910
5987
  value: function setNotificationServerActions(notificationServerActions) {
5911
5988
  this._notificationServerActions = notificationServerActions;
@@ -5953,6 +6030,8 @@ exports.MutableNotificationExpediteService = __decorate([
5953
6030
  * Provides an instance of MutableNotificationExpediteService and NotificationExpediteService.
5954
6031
  *
5955
6032
  * This should generally be used in the global module of an app.
6033
+ *
6034
+ * @returns an array of NestJS providers for both MutableNotificationExpediteService and NotificationExpediteService
5956
6035
  */ function provideMutableNotificationExpediteService() {
5957
6036
  return [
5958
6037
  exports.MutableNotificationExpediteService,
@@ -5966,6 +6045,8 @@ exports.MutableNotificationExpediteService = __decorate([
5966
6045
  * Convenience function that exports NotificationExpediteService and MutableNotificationExpediteService.
5967
6046
  *
5968
6047
  * This should generally be used in the global module of an app.
6048
+ *
6049
+ * @returns an array of abstract classes to export from the NestJS module
5969
6050
  */ function exportMutableNotificationExpediteService() {
5970
6051
  return [
5971
6052
  NotificationExpediteService,
@@ -5978,7 +6059,7 @@ function _array_like_to_array$5(arr, len) {
5978
6059
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
5979
6060
  return arr2;
5980
6061
  }
5981
- function _array_without_holes$3(arr) {
6062
+ function _array_without_holes$4(arr) {
5982
6063
  if (Array.isArray(arr)) return _array_like_to_array$5(arr);
5983
6064
  }
5984
6065
  function _class_call_check$4(instance, Constructor) {
@@ -5999,10 +6080,10 @@ function _define_property$7(obj, key, value) {
5999
6080
  }
6000
6081
  return obj;
6001
6082
  }
6002
- function _iterable_to_array$3(iter) {
6083
+ function _iterable_to_array$4(iter) {
6003
6084
  if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
6004
6085
  }
6005
- function _non_iterable_spread$3() {
6086
+ function _non_iterable_spread$4() {
6006
6087
  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
6088
  }
6008
6089
  function _object_spread$7(target) {
@@ -6039,8 +6120,8 @@ function _object_spread_props$7(target, source) {
6039
6120
  }
6040
6121
  return target;
6041
6122
  }
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();
6123
+ function _to_consumable_array$4(arr) {
6124
+ return _array_without_holes$4(arr) || _iterable_to_array$4(arr) || _unsupported_iterable_to_array$5(arr) || _non_iterable_spread$4();
6044
6125
  }
6045
6126
  function _unsupported_iterable_to_array$5(o, minLen) {
6046
6127
  if (!o) return;
@@ -6054,7 +6135,15 @@ function _unsupported_iterable_to_array$5(o, minLen) {
6054
6135
  /**
6055
6136
  * Factory that assembles the full {@link NotificationServerActionsContext} by combining
6056
6137
  * the base context with the template, send, task, and expedite services.
6057
- */ function notificationServerActionsContextFactory(context, notificationTemplateService, notificationSendService, notificationTaskService, notificationsExpediteService) {
6138
+ *
6139
+ * @param context - the base server actions context
6140
+ * @param notificationTemplateService - resolves message factories for notification template types
6141
+ * @param notificationSendService - handles sending notification messages
6142
+ * @param notificationTaskService - handles notification task dispatch
6143
+ * @param notificationsExpediteService - expedites immediate notification delivery
6144
+ * @returns the assembled {@link NotificationServerActionsContext}
6145
+ */ // eslint-disable-next-line @typescript-eslint/max-params
6146
+ function notificationServerActionsContextFactory(context, notificationTemplateService, notificationSendService, notificationTaskService, notificationsExpediteService) {
6058
6147
  return _object_spread_props$7(_object_spread$7({}, context), {
6059
6148
  notificationTemplateService: notificationTemplateService,
6060
6149
  notificationSendService: notificationSendService,
@@ -6064,12 +6153,19 @@ function _unsupported_iterable_to_array$5(o, minLen) {
6064
6153
  }
6065
6154
  /**
6066
6155
  * Factory that creates a {@link NotificationServerActions} instance from the assembled context.
6067
- */ function notificationServerActionsFactory(context, mutableNotificationExpediteService) {
6156
+ *
6157
+ * @param context - the assembled notification server actions context
6158
+ * @returns a new {@link NotificationServerActions} instance
6159
+ */ function notificationServerActionsFactory(context) {
6068
6160
  return notificationServerActions(context);
6069
6161
  }
6070
6162
  /**
6071
6163
  * Factory that creates a {@link NotificationInitServerActions} instance by merging the
6072
6164
  * server actions context with the init-specific configuration.
6165
+ *
6166
+ * @param context - the assembled notification server actions context
6167
+ * @param notificationInitServerActionsContextConfig - init-specific configuration
6168
+ * @returns a new {@link NotificationInitServerActions} instance
6073
6169
  */ function notificationInitServerActionsFactory(context, notificationInitServerActionsContextConfig) {
6074
6170
  return notificationInitServerActions(_object_spread$7({}, context, notificationInitServerActionsContextConfig));
6075
6171
  }
@@ -6085,9 +6181,8 @@ function _unsupported_iterable_to_array$5(o, minLen) {
6085
6181
  *
6086
6182
  * Be sure the class that delares the module using this function also extends AbstractAppNotificationModule.
6087
6183
  *
6088
- * @param provide
6089
- * @param useFactory
6090
- * @returns
6184
+ * @param config - module metadata configuration including dependency module and additional providers
6185
+ * @returns the assembled {@link ModuleMetadata} for the notification module
6091
6186
  */ function appNotificationModuleMetadata(config$1) {
6092
6187
  var dependencyModule = config$1.dependencyModule, imports = config$1.imports, exports$1 = config$1.exports, providers = config$1.providers;
6093
6188
  var dependencyModuleImport = dependencyModule ? [
@@ -6096,14 +6191,14 @@ function _unsupported_iterable_to_array$5(o, minLen) {
6096
6191
  return {
6097
6192
  imports: [
6098
6193
  config.ConfigModule
6099
- ].concat(_to_consumable_array$3(dependencyModuleImport), _to_consumable_array$3(imports !== null && imports !== void 0 ? imports : [])),
6194
+ ].concat(_to_consumable_array$4(dependencyModuleImport), _to_consumable_array$4(imports !== null && imports !== void 0 ? imports : [])),
6100
6195
  exports: [
6101
6196
  NOTIFICATION_SERVER_ACTION_CONTEXT_TOKEN,
6102
6197
  NotificationExpediteService,
6103
6198
  exports.NotificationTemplateService,
6104
6199
  NotificationServerActions,
6105
6200
  NotificationInitServerActions
6106
- ].concat(_to_consumable_array$3(exports$1 !== null && exports$1 !== void 0 ? exports$1 : [])),
6201
+ ].concat(_to_consumable_array$4(exports$1 !== null && exports$1 !== void 0 ? exports$1 : [])),
6107
6202
  providers: [
6108
6203
  {
6109
6204
  provide: NotificationExpediteService,
@@ -6128,8 +6223,7 @@ function _unsupported_iterable_to_array$5(o, minLen) {
6128
6223
  provide: NotificationServerActions,
6129
6224
  useFactory: notificationServerActionsFactory,
6130
6225
  inject: [
6131
- NOTIFICATION_SERVER_ACTION_CONTEXT_TOKEN,
6132
- NotificationExpediteService
6226
+ NOTIFICATION_SERVER_ACTION_CONTEXT_TOKEN
6133
6227
  ]
6134
6228
  },
6135
6229
  {
@@ -6140,7 +6234,7 @@ function _unsupported_iterable_to_array$5(o, minLen) {
6140
6234
  NOTIFICATION_INIT_SERVER_ACTIONS_CONTEXT_CONFIG_TOKEN
6141
6235
  ]
6142
6236
  }
6143
- ].concat(_to_consumable_array$3(providers !== null && providers !== void 0 ? providers : []))
6237
+ ].concat(_to_consumable_array$4(providers !== null && providers !== void 0 ? providers : []))
6144
6238
  };
6145
6239
  }
6146
6240
  /**
@@ -6175,6 +6269,9 @@ function _array_like_to_array$4(arr, len) {
6175
6269
  function _array_with_holes$1(arr) {
6176
6270
  if (Array.isArray(arr)) return arr;
6177
6271
  }
6272
+ function _array_without_holes$3(arr) {
6273
+ if (Array.isArray(arr)) return _array_like_to_array$4(arr);
6274
+ }
6178
6275
  function asyncGeneratorStep$8(gen, resolve, reject, _next, _throw, key, arg) {
6179
6276
  try {
6180
6277
  var info = gen[key](arg);
@@ -6217,6 +6314,9 @@ function _define_property$6(obj, key, value) {
6217
6314
  }
6218
6315
  return obj;
6219
6316
  }
6317
+ function _iterable_to_array$3(iter) {
6318
+ if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
6319
+ }
6220
6320
  function _iterable_to_array_limit$1(arr, i) {
6221
6321
  var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
6222
6322
  if (_i == null) return;
@@ -6244,6 +6344,9 @@ function _iterable_to_array_limit$1(arr, i) {
6244
6344
  function _non_iterable_rest$1() {
6245
6345
  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
6346
  }
6347
+ function _non_iterable_spread$3() {
6348
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
6349
+ }
6247
6350
  function _object_spread$6(target) {
6248
6351
  for(var i = 1; i < arguments.length; i++){
6249
6352
  var source = arguments[i] != null ? arguments[i] : {};
@@ -6281,6 +6384,9 @@ function _object_spread_props$6(target, source) {
6281
6384
  function _sliced_to_array$1(arr, i) {
6282
6385
  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
6386
  }
6387
+ function _to_consumable_array$3(arr) {
6388
+ return _array_without_holes$3(arr) || _iterable_to_array$3(arr) || _unsupported_iterable_to_array$4(arr) || _non_iterable_spread$3();
6389
+ }
6284
6390
  function _unsupported_iterable_to_array$4(o, minLen) {
6285
6391
  if (!o) return;
6286
6392
  if (typeof o === "string") return _array_like_to_array$4(o, minLen);
@@ -6399,6 +6505,7 @@ function _ts_generator$8(thisArg, body) {
6399
6505
  * Each summary update runs in a Firestore transaction to prevent concurrent write conflicts.
6400
6506
  *
6401
6507
  * @param config - service configuration including Firestore context and collection references
6508
+ * @returns a {@link NotificationSummarySendService} backed by Firestore
6402
6509
  *
6403
6510
  * @example
6404
6511
  * ```ts
@@ -6432,6 +6539,7 @@ function _ts_generator$8(thisArg, body) {
6432
6539
  cutMessage = util.cutStringFunction({
6433
6540
  maxLength: firebase.NOTIFICATION_SUMMARY_EMBEDDED_NOTIFICATION_ITEM_MESSAGE_MAX_LENGTH
6434
6541
  });
6542
+ // eslint-disable-next-line @typescript-eslint/no-empty-object-type
6435
6543
  messagesGroups = messagesGroupedByNotificationSummaryMapBuilder.entries();
6436
6544
  return [
6437
6545
  2,
@@ -6478,7 +6586,7 @@ function _ts_generator$8(thisArg, body) {
6478
6586
  });
6479
6587
  if (messagesToSend.length > 0) {
6480
6588
  // add the new items to existing n, then keep the last 1000
6481
- sortedN = existingMessages.concat(messagesToSend.map(function(x) {
6589
+ sortedN = _to_consumable_array$3(existingMessages).concat(_to_consumable_array$3(messagesToSend.map(function(x) {
6482
6590
  var message = '';
6483
6591
  if (x.content.openingMessage) {
6484
6592
  message = x.content.openingMessage;
@@ -6491,7 +6599,7 @@ function _ts_generator$8(thisArg, body) {
6491
6599
  g: cutMessage(message)
6492
6600
  });
6493
6601
  return item;
6494
- })).sort(firebase.sortNotificationItemsFunction);
6602
+ }))).sort(firebase.sortNotificationItemsFunction);
6495
6603
  n = util.takeLast(sortedN, firebase.NOTIFICATION_SUMMARY_ITEM_LIMIT);
6496
6604
  updateTemplate = {
6497
6605
  n: n,
@@ -6719,6 +6827,8 @@ function _ts_generator$7(thisArg, body) {
6719
6827
  * Useful as a placeholder when your app's notification pipeline is fully wired for SMS
6720
6828
  * but actual delivery is not yet enabled, avoiding the need for conditional logic elsewhere.
6721
6829
  *
6830
+ * @returns a no-op {@link NotificationTextSendService} that ignores all messages
6831
+ *
6722
6832
  * @example
6723
6833
  * ```ts
6724
6834
  * const textService = ignoreSendNotificationTextSendService();
@@ -6898,6 +7008,7 @@ function _ts_generator$6(thisArg, body) {
6898
7008
  * If all checkpoints are complete, the task is marked as done.
6899
7009
  *
6900
7010
  * @param config - handler configurations and optional validation list
7011
+ * @returns a {@link NotificationTaskService} that dispatches tasks to the registered handlers
6901
7012
  *
6902
7013
  * @example
6903
7014
  * ```ts
@@ -6943,14 +7054,16 @@ function _ts_generator$6(thisArg, body) {
6943
7054
  fn = (_this = (_nonCheckpointFlows_ = nonCheckpointFlows[0]) !== null && _nonCheckpointFlows_ !== void 0 ? _nonCheckpointFlows_ : checkpointFlows[0]) === null || _this === void 0 ? void 0 : _this.fn;
6944
7055
  break;
6945
7056
  default:
6946
- completedCheckpointsSet = new Set(completedCheckpoints);
6947
- /**
7057
+ {
7058
+ completedCheckpointsSet = new Set(completedCheckpoints);
7059
+ /**
6948
7060
  * Find the next flow function that hasn't had its checkpoint completed yet.
6949
7061
  */ 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;
7062
+ return !completedCheckpointsSet.has(x.checkpoint);
7063
+ });
7064
+ fn = nextCheckpoint === null || nextCheckpoint === void 0 ? void 0 : nextCheckpoint.fn;
7065
+ break;
7066
+ }
6954
7067
  }
6955
7068
  if (!fn) return [
6956
7069
  3,
@@ -7277,6 +7390,7 @@ function _ts_generator$5(thisArg, body) {
7277
7390
  * such as storage file processing or other async workflows.
7278
7391
  *
7279
7392
  * @param factoryConfig - shared configuration including the input function, cleanup logic, and task type
7393
+ * @returns a factory function that produces {@link NotificationTaskServiceTaskHandlerConfig} entries
7280
7394
  *
7281
7395
  * @example
7282
7396
  * ```ts
@@ -7299,6 +7413,9 @@ function _ts_generator$5(thisArg, body) {
7299
7413
  return function(subtaskHandlerConfig) {
7300
7414
  var processorFunctionForConfig = /**
7301
7415
  * Structure is similar to notificationTaskService(), but contained to handle the subtasks.
7416
+ *
7417
+ * @param processorConfig - the processor configuration with target, flow, and cleanup
7418
+ * @returns a processor with process and optional cleanup functions
7302
7419
  */ function processorFunctionForConfig(processorConfig) {
7303
7420
  var inputFlows = processorConfig.flow, cleanup = processorConfig.cleanup, processorAllowRunMultipleParts = processorConfig.allowRunMultipleParts;
7304
7421
  var _separateValues = util.separateValues(inputFlows, function(x) {
@@ -7326,14 +7443,16 @@ function _ts_generator$5(thisArg, body) {
7326
7443
  fn = (_this = (_nonSubtaskFlows_ = nonSubtaskFlows[0]) !== null && _nonSubtaskFlows_ !== void 0 ? _nonSubtaskFlows_ : subtaskFlows[0]) === null || _this === void 0 ? void 0 : _this.fn;
7327
7444
  break;
7328
7445
  default:
7329
- completedSubtasksSet = new Set(completedSubtasks);
7330
- /**
7446
+ {
7447
+ completedSubtasksSet = new Set(completedSubtasks);
7448
+ /**
7331
7449
  * Find the next flow function that hasn't had its checkpoint completed yet.
7332
7450
  */ 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;
7451
+ return !completedSubtasksSet.has(x.subtask);
7452
+ });
7453
+ fn = nextSubtask === null || nextSubtask === void 0 ? void 0 : nextSubtask.fn;
7454
+ break;
7455
+ }
7337
7456
  }
7338
7457
  if (!fn) return [
7339
7458
  3,
@@ -7358,13 +7477,15 @@ function _ts_generator$5(thisArg, body) {
7358
7477
  sfps = removeFromCompletionsArrayWithTaskResult(sfps, subtaskResult);
7359
7478
  break;
7360
7479
  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;
7480
+ {
7481
+ sfps = util.unique(_to_consumable_array$2(removeFromCompletionsArrayWithTaskResult(sfps, subtaskResult)).concat(_to_consumable_array$2(util.asArray(subtaskCompletion))));
7482
+ completedSubtasksSet1 = new Set(sfps);
7483
+ incompleteSubtasks = allKnownSubtasks.filter(function(x) {
7484
+ return !completedSubtasksSet1.has(x);
7485
+ });
7486
+ allSubtasksDone = incompleteSubtasks.length === 0;
7487
+ break;
7488
+ }
7368
7489
  }
7369
7490
  // configure the update metadata result
7370
7491
  sd = _object_spread$5({}, subtaskData, subtaskUpdateMetadata);
@@ -7578,7 +7699,7 @@ function _ts_generator$5(thisArg, body) {
7578
7699
  8
7579
7700
  ];
7580
7701
  processor = processors[target];
7581
- if (!(processor && processor.cleanup)) return [
7702
+ if (!(processor === null || processor === void 0 ? void 0 : processor.cleanup)) return [
7582
7703
  3,
7583
7704
  5
7584
7705
  ];
@@ -7691,12 +7812,16 @@ function _ts_generator$5(thisArg, body) {
7691
7812
  }(makeError.BaseError);
7692
7813
  /**
7693
7814
  * Creates a NotificationTaskSubTaskMissingRequiredDataTermination.
7815
+ *
7816
+ * @returns a new {@link NotificationTaskSubTaskMissingRequiredDataTermination} error instance
7694
7817
  */ function notificationTaskSubTaskMissingRequiredDataTermination() {
7695
7818
  return new NotificationTaskSubTaskMissingRequiredDataTermination();
7696
7819
  }
7697
7820
 
7698
7821
  /**
7699
7822
  * Creates an error indicating that a storage file model has already been initialized.
7823
+ *
7824
+ * @returns a precondition-conflict HttpsError with the STORAGE_FILE_MODEL_ALREADY_INITIALIZED error code
7700
7825
  */ function storageFileModelAlreadyInitializedError() {
7701
7826
  return firebaseServer.preconditionConflictError({
7702
7827
  message: "This model has already been initialized.",
@@ -7705,6 +7830,8 @@ function _ts_generator$5(thisArg, body) {
7705
7830
  }
7706
7831
  /**
7707
7832
  * Creates an error indicating that the StorageFile is not flagged for group sync.
7833
+ *
7834
+ * @returns a precondition-conflict HttpsError with the STORAGE_FILE_NOT_FLAGGED_FOR_GROUPS_SYNC error code
7708
7835
  */ function storageFileNotFlaggedForGroupsSyncError() {
7709
7836
  return firebaseServer.preconditionConflictError({
7710
7837
  message: "This StorageFile has not been flagged for sync with its groups.",
@@ -7713,6 +7840,8 @@ function _ts_generator$5(thisArg, body) {
7713
7840
  }
7714
7841
  /**
7715
7842
  * Creates an error indicating that the target uploaded file does not exist in storage.
7843
+ *
7844
+ * @returns a precondition-conflict HttpsError with the UPLOADED_FILE_DOES_NOT_EXIST error code
7716
7845
  */ function uploadedFileDoesNotExistError() {
7717
7846
  return firebaseServer.preconditionConflictError({
7718
7847
  message: "The target uploaded file does not exist.",
@@ -7721,6 +7850,8 @@ function _ts_generator$5(thisArg, body) {
7721
7850
  }
7722
7851
  /**
7723
7852
  * Creates an error indicating that the file is not allowed to be initialized (rejected by the check function).
7853
+ *
7854
+ * @returns a precondition-conflict HttpsError with the UPLOADED_FILE_NOT_ALLOWED_TO_BE_INITIALIZED error code
7724
7855
  */ function uploadedFileIsNotAllowedToBeInitializedError() {
7725
7856
  return firebaseServer.preconditionConflictError({
7726
7857
  message: "The target uploaded file is not allowed to be initialized.",
@@ -7731,6 +7862,7 @@ function _ts_generator$5(thisArg, body) {
7731
7862
  * Creates an error indicating that the file initialization failed with the given result type.
7732
7863
  *
7733
7864
  * @param data - error data containing the result type that caused the failure
7865
+ * @returns an internal-server HttpsError with the UPLOADED_FILE_INITIALIZATION_FAILED error code and the result type
7734
7866
  */ function uploadedFileInitializationFailedError(data) {
7735
7867
  return firebaseServer.internalServerError({
7736
7868
  message: 'The target uploaded file initialization failed with result type "'.concat(data.resultType, '".'),
@@ -7742,6 +7874,8 @@ function _ts_generator$5(thisArg, body) {
7742
7874
  }
7743
7875
  /**
7744
7876
  * Creates an error indicating that the initialization result was discarded (e.g., the created file no longer exists).
7877
+ *
7878
+ * @returns an internal-server HttpsError with the UPLOADED_FILE_INITIALIZATION_DISCARDED error code
7745
7879
  */ function uploadedFileInitializationDiscardedError() {
7746
7880
  return firebaseServer.internalServerError({
7747
7881
  message: "The target uploaded file initialization was discarded.",
@@ -7750,6 +7884,8 @@ function _ts_generator$5(thisArg, body) {
7750
7884
  }
7751
7885
  /**
7752
7886
  * Creates an error indicating that the StorageFile is not in a valid state for processing.
7887
+ *
7888
+ * @returns a precondition-conflict HttpsError with the STORAGE_FILE_PROCESSING_NOT_ALLOWED_FOR_INVALID_STATE error code
7753
7889
  */ function storageFileProcessingNotAllowedForInvalidStateError() {
7754
7890
  return firebaseServer.preconditionConflictError({
7755
7891
  message: "The target StorageFileDocument must be in an OK state to be processed and processing not flagged as SHOULD_NOT_PROCESS.",
@@ -7758,6 +7894,8 @@ function _ts_generator$5(thisArg, body) {
7758
7894
  }
7759
7895
  /**
7760
7896
  * Creates an error indicating that the StorageFile is not queued for processing.
7897
+ *
7898
+ * @returns a precondition-conflict HttpsError with the STORAGE_FILE_PROCESSING_NOT_QUEUED_FOR_PROCESSING error code
7761
7899
  */ function storageFileProcessingNotQueuedForProcessingError() {
7762
7900
  return firebaseServer.preconditionConflictError({
7763
7901
  message: "The target StorageFileDocument is not queued for processing.",
@@ -7766,6 +7904,8 @@ function _ts_generator$5(thisArg, body) {
7766
7904
  }
7767
7905
  /**
7768
7906
  * Creates an error indicating that no processor is configured for the StorageFile's type.
7907
+ *
7908
+ * @returns a precondition-conflict HttpsError with the STORAGE_FILE_PROCESSING_NOT_AVAILABLE_FOR_TYPE error code
7769
7909
  */ function storageFileProcessingNotAvailableForTypeError() {
7770
7910
  return firebaseServer.preconditionConflictError({
7771
7911
  message: "The target StorageFileDocument is not available for processing.",
@@ -7774,6 +7914,8 @@ function _ts_generator$5(thisArg, body) {
7774
7914
  }
7775
7915
  /**
7776
7916
  * Creates an error indicating that the StorageFile has already finished processing.
7917
+ *
7918
+ * @returns a precondition-conflict HttpsError with the STORAGE_FILE_ALREADY_PROCESSED error code
7777
7919
  */ function storageFileAlreadyProcessedError() {
7778
7920
  return firebaseServer.preconditionConflictError({
7779
7921
  message: "The target StorageFileDocument has already finished processing.",
@@ -7782,6 +7924,8 @@ function _ts_generator$5(thisArg, body) {
7782
7924
  }
7783
7925
  /**
7784
7926
  * Creates an error indicating that the StorageFile is not flagged for deletion.
7927
+ *
7928
+ * @returns a precondition-conflict HttpsError with the STORAGE_FILE_NOT_FLAGGED_FOR_DELETION error code
7785
7929
  */ function storageFileNotFlaggedForDeletionError() {
7786
7930
  return firebaseServer.preconditionConflictError({
7787
7931
  message: "The target StorageFileDocument is not flagged for deletion.",
@@ -7790,6 +7934,8 @@ function _ts_generator$5(thisArg, body) {
7790
7934
  }
7791
7935
  /**
7792
7936
  * Creates an error indicating that the StorageFile's scheduled deletion time has not yet passed.
7937
+ *
7938
+ * @returns a precondition-conflict HttpsError with the STORAGE_FILE_CANNOT_BE_DELETED_YET error code
7793
7939
  */ function storageFileCannotBeDeletedYetError() {
7794
7940
  return firebaseServer.preconditionConflictError({
7795
7941
  message: "The target StorageFileDocument cannot be deleted yet.",
@@ -7798,6 +7944,8 @@ function _ts_generator$5(thisArg, body) {
7798
7944
  }
7799
7945
  /**
7800
7946
  * Creates an error indicating that the StorageFileGroup is still queued for initialization and cannot be operated on.
7947
+ *
7948
+ * @returns a precondition-conflict HttpsError with the STORAGE_FILE_GROUP_QUEUED_FOR_INITIALIZATION error code
7801
7949
  */ function storageFileGroupQueuedForInitializationError() {
7802
7950
  return firebaseServer.preconditionConflictError({
7803
7951
  message: "The target StorageFileGroupDocument is queued for initialization.",
@@ -7806,6 +7954,8 @@ function _ts_generator$5(thisArg, body) {
7806
7954
  }
7807
7955
  /**
7808
7956
  * Creates an error indicating that the required model key or storageFileId is missing when creating a StorageFileGroup.
7957
+ *
7958
+ * @returns a precondition-conflict HttpsError with the STORAGE_FILE_GROUP_CREATE_INPUT error code
7809
7959
  */ function createStorageFileGroupInputError() {
7810
7960
  return firebaseServer.preconditionConflictError({
7811
7961
  message: "The model or storageFileId is required for creating a StorageFileGroup.",
@@ -7895,10 +8045,6 @@ function _iterable_to_array_limit(arr, i) {
7895
8045
  function _non_iterable_rest() {
7896
8046
  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
8047
  }
7898
- function _object_destructuring_empty(o) {
7899
- if (o === null || o === void 0) throw new TypeError("Cannot destructure " + o);
7900
- return o;
7901
- }
7902
8048
  function _object_spread$4(target) {
7903
8049
  for(var i = 1; i < arguments.length; i++){
7904
8050
  var source = arguments[i] != null ? arguments[i] : {};
@@ -8075,6 +8221,9 @@ function _ts_generator$4(thisArg, body) {
8075
8221
  *
8076
8222
  * @param context - the fully assembled storage file server actions context
8077
8223
  *
8224
+ * @param context - the fully assembled storage file server actions context
8225
+ * @returns a concrete {@link StorageFileServerActions} with all action methods wired to their factories
8226
+ *
8078
8227
  * @example
8079
8228
  * ```ts
8080
8229
  * const actions = storageFileServerActions(context);
@@ -8105,23 +8254,23 @@ function _ts_generator$4(thisArg, body) {
8105
8254
  * Factory for the `createStorageFile` action.
8106
8255
  *
8107
8256
  * Creates a new {@link StorageFile} document using the provided template data.
8257
+ *
8258
+ * @param context - the base server actions context providing Firestore and storage access
8259
+ * @returns an async transform-and-validate function that creates a StorageFile document
8108
8260
  */ function createStorageFileFactory(context) {
8109
- context.storageFileCollection; context.firestoreContext; var firebaseServerActionTransformFunctionFactory = context.firebaseServerActionTransformFunctionFactory;
8261
+ var firebaseServerActionTransformFunctionFactory = context.firebaseServerActionTransformFunctionFactory;
8110
8262
  return firebaseServerActionTransformFunctionFactory(firebase.createStorageFileParamsType, function(params) {
8111
8263
  return _async_to_generator$4(function() {
8112
8264
  return _ts_generator$4(this, function(_state) {
8113
- _object_destructuring_empty(params);
8114
8265
  return [
8115
8266
  2,
8116
8267
  function() {
8117
8268
  return _async_to_generator$4(function() {
8118
- var storageFileDocument;
8119
8269
  return _ts_generator$4(this, function(_state) {
8120
- storageFileDocument = null;
8121
8270
  // TODO: check the file exists, and pull the metadata, and create the document
8122
8271
  return [
8123
8272
  2,
8124
- storageFileDocument
8273
+ null
8125
8274
  ];
8126
8275
  });
8127
8276
  })();
@@ -8137,6 +8286,9 @@ function _ts_generator$4(thisArg, body) {
8137
8286
  * Scans the uploads folder in Firebase Storage, identifies new uploaded files,
8138
8287
  * initializes each one via the upload service, and cleans up the source upload
8139
8288
  * on success. Failed initializations are logged but do not halt the batch.
8289
+ *
8290
+ * @param context - the storage file server actions context with storage service and upload initialization
8291
+ * @returns an async transform-and-validate function that returns batch initialization results
8140
8292
  */ function initializeAllStorageFilesFromUploadsFactory(context) {
8141
8293
  var storageService = context.storageService, firebaseServerActionTransformFunctionFactory = context.firebaseServerActionTransformFunctionFactory;
8142
8294
  var _initializeStorageFileFromUploadFile = _initializeStorageFileFromUploadFileFactory(context);
@@ -8230,7 +8382,15 @@ function _ts_generator$4(thisArg, body) {
8230
8382
  })();
8231
8383
  });
8232
8384
  }
8233
- function _initializeStorageFileFromUploadFileFactory(context) {
8385
+ /**
8386
+ * Internal factory that creates a function to initialize a {@link StorageFile} from an uploaded file.
8387
+ *
8388
+ * Validates the file exists and is allowed, runs the upload initializer, deletes the upload source
8389
+ * on success, and optionally expedites processing of the created storage file.
8390
+ *
8391
+ * @param context - the storage file server actions context
8392
+ * @returns an async function that accepts an upload file input and returns the created StorageFileDocument
8393
+ */ function _initializeStorageFileFromUploadFileFactory(context) {
8234
8394
  var firestoreContext = context.firestoreContext, storageFileInitializeFromUploadService = context.storageFileInitializeFromUploadService, notificationExpediteService = context.notificationExpediteService;
8235
8395
  var processStorageFileInTransaction = _processStorageFileInTransactionFactory(context);
8236
8396
  return function(input) {
@@ -8358,7 +8518,7 @@ function _initializeStorageFileFromUploadFileFactory(context) {
8358
8518
  11
8359
8519
  ];
8360
8520
  storageFileDocument = initializationResult.storageFileDocument;
8361
- if (!(storageFileDocument != null && expediteProcessing)) return [
8521
+ if (!expediteProcessing) return [
8362
8522
  3,
8363
8523
  10
8364
8524
  ];
@@ -8494,6 +8654,9 @@ function _initializeStorageFileFromUploadFileFactory(context) {
8494
8654
  * Initializes a single {@link StorageFile} from an uploaded file at the given storage path.
8495
8655
  * Validates the file exists and is allowed, runs the type determiner and initializer,
8496
8656
  * then cleans up the upload source on success.
8657
+ *
8658
+ * @param context - the storage file server actions context with storage and upload services
8659
+ * @returns an async transform-and-validate function that creates a StorageFile from an upload
8497
8660
  */ function initializeStorageFileFromUploadFactory(context) {
8498
8661
  var storageService = context.storageService, firebaseServerActionTransformFunctionFactory = context.firebaseServerActionTransformFunctionFactory;
8499
8662
  var _initializeStorageFileFromUploadFile = _initializeStorageFileFromUploadFileFactory(context);
@@ -8527,8 +8690,15 @@ function _initializeStorageFileFromUploadFileFactory(context) {
8527
8690
  })();
8528
8691
  });
8529
8692
  }
8530
- function updateStorageFileFactory(context) {
8531
- context.storageFileCollection; context.firestoreContext; var firebaseServerActionTransformFunctionFactory = context.firebaseServerActionTransformFunctionFactory;
8693
+ /**
8694
+ * Factory for the `updateStorageFile` action.
8695
+ *
8696
+ * Updates an existing {@link StorageFile} document with the provided schedule-delete-at time.
8697
+ *
8698
+ * @param context - the base server actions context providing Firestore access
8699
+ * @returns an async transform-and-validate function that updates a StorageFile document
8700
+ */ function updateStorageFileFactory(context) {
8701
+ var firebaseServerActionTransformFunctionFactory = context.firebaseServerActionTransformFunctionFactory;
8532
8702
  return firebaseServerActionTransformFunctionFactory(firebase.updateStorageFileParamsType, function(params) {
8533
8703
  return _async_to_generator$4(function() {
8534
8704
  var sdat;
@@ -8564,7 +8734,15 @@ function updateStorageFileFactory(context) {
8564
8734
  })();
8565
8735
  });
8566
8736
  }
8567
- function updateStorageFileGroupFactory(context) {
8737
+ /**
8738
+ * Factory for the `updateStorageFileGroup` action.
8739
+ *
8740
+ * Updates embedded file entries within a {@link StorageFileGroup} document inside a
8741
+ * Firestore transaction, merging display name changes into the existing entries.
8742
+ *
8743
+ * @param context - the storage file server actions context
8744
+ * @returns an async transform-and-validate function that updates a StorageFileGroup document
8745
+ */ function updateStorageFileGroupFactory(context) {
8568
8746
  var firestoreContext = context.firestoreContext, storageFileGroupCollection = context.storageFileGroupCollection, firebaseServerActionTransformFunctionFactory = context.firebaseServerActionTransformFunctionFactory;
8569
8747
  return firebaseServerActionTransformFunctionFactory(firebase.updateStorageFileGroupParamsType, function(params) {
8570
8748
  return _async_to_generator$4(function() {
@@ -8646,10 +8824,13 @@ function updateStorageFileGroupFactory(context) {
8646
8824
  * Batch-processes all {@link StorageFile} documents queued for processing. Creates a
8647
8825
  * processing notification task for each file and optionally expedites delivery.
8648
8826
  * Handles stuck-processing detection with a throttle check.
8827
+ *
8828
+ * @param context - the storage file server actions context
8829
+ * @returns an async transform-and-validate function that returns batch processing results
8649
8830
  */ function processAllQueuedStorageFilesFactory(context) {
8650
8831
  var storageFileCollection = context.storageFileCollection, firebaseServerActionTransformFunctionFactory = context.firebaseServerActionTransformFunctionFactory;
8651
8832
  var processStorageFile = processStorageFileFactory(context);
8652
- return firebaseServerActionTransformFunctionFactory(firebase.processAllQueuedStorageFilesParamsType, function(params) {
8833
+ return firebaseServerActionTransformFunctionFactory(firebase.processAllQueuedStorageFilesParamsType, function(_params) {
8653
8834
  return _async_to_generator$4(function() {
8654
8835
  return _ts_generator$4(this, function(_state) {
8655
8836
  return [
@@ -8733,7 +8914,15 @@ function updateStorageFileGroupFactory(context) {
8733
8914
  })();
8734
8915
  });
8735
8916
  }
8736
- function _processStorageFileInTransactionFactory(context) {
8917
+ /**
8918
+ * Internal factory that creates a function for processing a {@link StorageFile} within a Firestore transaction.
8919
+ *
8920
+ * Creates or restarts a notification task for the file based on its current processing state,
8921
+ * handling stuck-processing detection, forced restarts, and re-processing of already-successful files.
8922
+ *
8923
+ * @param context - the storage file server actions context
8924
+ * @returns an async function that processes a storage file within a transaction
8925
+ */ function _processStorageFileInTransactionFactory(context) {
8737
8926
  var storageFileCollection = context.storageFileCollection, notificationCollectionGroup = context.notificationCollectionGroup;
8738
8927
  return function(input, transaction) {
8739
8928
  return _async_to_generator$4(function() {
@@ -8823,20 +9012,30 @@ function _processStorageFileInTransactionFactory(context) {
8823
9012
  3,
8824
9013
  10
8825
9014
  ];
8826
- case firebase.StorageFileProcessingState.DO_NOT_PROCESS:
9015
+ case firebase.StorageFileProcessingState.FAILED:
8827
9016
  return [
8828
9017
  3,
8829
9018
  20
8830
9019
  ];
9020
+ case firebase.StorageFileProcessingState.DO_NOT_PROCESS:
9021
+ return [
9022
+ 3,
9023
+ 22
9024
+ ];
8831
9025
  case firebase.StorageFileProcessingState.SUCCESS:
8832
9026
  return [
8833
9027
  3,
8834
- 21
9028
+ 23
9029
+ ];
9030
+ case firebase.StorageFileProcessingState.ARCHIVED:
9031
+ return [
9032
+ 3,
9033
+ 27
8835
9034
  ];
8836
9035
  }
8837
9036
  return [
8838
9037
  3,
8839
- 25
9038
+ 28
8840
9039
  ];
8841
9040
  case 4:
8842
9041
  if (!!storageFile.p) return [
@@ -8855,7 +9054,7 @@ function _processStorageFileInTransactionFactory(context) {
8855
9054
  case 7:
8856
9055
  return [
8857
9056
  3,
8858
- 25
9057
+ 28
8859
9058
  ];
8860
9059
  case 8:
8861
9060
  // begin processing
@@ -8867,7 +9066,7 @@ function _processStorageFileInTransactionFactory(context) {
8867
9066
  _state.sent();
8868
9067
  return [
8869
9068
  3,
8870
- 25
9069
+ 28
8871
9070
  ];
8872
9071
  case 10:
8873
9072
  // check if the processing task is still running
@@ -8941,33 +9140,47 @@ function _processStorageFileInTransactionFactory(context) {
8941
9140
  case 19:
8942
9141
  return [
8943
9142
  3,
8944
- 25
9143
+ 28
8945
9144
  ];
8946
9145
  case 20:
8947
- throw storageFileProcessingNotQueuedForProcessingError();
9146
+ // restart processing on failure
9147
+ return [
9148
+ 4,
9149
+ beginProcessing(true)
9150
+ ];
8948
9151
  case 21:
9152
+ _state.sent();
9153
+ return [
9154
+ 3,
9155
+ 28
9156
+ ];
9157
+ case 22:
9158
+ throw storageFileProcessingNotQueuedForProcessingError();
9159
+ case 23:
8949
9160
  if (!(forceRestartProcessing || processAgainIfSuccessful)) return [
8950
9161
  3,
8951
- 23
9162
+ 25
8952
9163
  ];
8953
9164
  return [
8954
9165
  4,
8955
9166
  beginProcessing(true)
8956
9167
  ];
8957
- case 22:
9168
+ case 24:
8958
9169
  _state.sent();
8959
9170
  return [
8960
9171
  3,
8961
- 24
9172
+ 26
8962
9173
  ];
8963
- case 23:
9174
+ case 25:
8964
9175
  throw storageFileAlreadyProcessedError();
8965
- case 24:
9176
+ case 26:
8966
9177
  return [
8967
9178
  3,
8968
- 25
9179
+ 28
8969
9180
  ];
8970
- case 25:
9181
+ case 27:
9182
+ throw storageFileProcessingNotQueuedForProcessingError();
9183
+ case 28:
8971
9184
  return [
8972
9185
  2
8973
9186
  ];
@@ -8981,6 +9194,9 @@ function _processStorageFileInTransactionFactory(context) {
8981
9194
  *
8982
9195
  * Processes a single {@link StorageFile} by creating a notification task for it
8983
9196
  * and marking it as processing. Validates the file is in a valid state for processing.
9197
+ *
9198
+ * @param context - the storage file server actions context
9199
+ * @returns an async transform-and-validate function that processes a single StorageFile
8984
9200
  */ function processStorageFileFactory(context) {
8985
9201
  var firestoreContext = context.firestoreContext, notificationExpediteService = context.notificationExpediteService, firebaseServerActionTransformFunctionFactory = context.firebaseServerActionTransformFunctionFactory;
8986
9202
  var processStorageFileInTransaction = _processStorageFileInTransactionFactory(context);
@@ -9064,10 +9280,13 @@ function _processStorageFileInTransactionFactory(context) {
9064
9280
  * Batch-deletes all {@link StorageFile} documents flagged for deletion whose
9065
9281
  * scheduled delete time has passed. Removes both the Firestore document and
9066
9282
  * the associated file in Cloud Storage.
9283
+ *
9284
+ * @param context - the storage file server actions context
9285
+ * @returns an async transform-and-validate function that returns batch deletion results
9067
9286
  */ function deleteAllQueuedStorageFilesFactory(context) {
9068
9287
  var storageFileCollection = context.storageFileCollection, firebaseServerActionTransformFunctionFactory = context.firebaseServerActionTransformFunctionFactory;
9069
9288
  var deleteStorageFile = deleteStorageFileFactory(context);
9070
- return firebaseServerActionTransformFunctionFactory(firebase.deleteAllQueuedStorageFilesParamsType, function(params) {
9289
+ return firebaseServerActionTransformFunctionFactory(firebase.deleteAllQueuedStorageFilesParamsType, function(_params) {
9071
9290
  return _async_to_generator$4(function() {
9072
9291
  return _ts_generator$4(this, function(_state) {
9073
9292
  return [
@@ -9158,6 +9377,9 @@ function _processStorageFileInTransactionFactory(context) {
9158
9377
  *
9159
9378
  * Deletes a single {@link StorageFile} document and its associated Cloud Storage file.
9160
9379
  * Validates the file is flagged for deletion and the scheduled delete time has passed.
9380
+ *
9381
+ * @param context - the storage file server actions context
9382
+ * @returns an async transform-and-validate function that deletes a StorageFile and its storage object
9161
9383
  */ function deleteStorageFileFactory(context) {
9162
9384
  var firestoreContext = context.firestoreContext, storageService = context.storageService, storageFileCollection = context.storageFileCollection, firebaseServerActionTransformFunctionFactory = context.firebaseServerActionTransformFunctionFactory;
9163
9385
  var syncStorageFileWithGroupsInTransaction = _syncStorageFileWithGroupsInTransactionFactory(context);
@@ -9181,17 +9403,12 @@ function _processStorageFileInTransactionFactory(context) {
9181
9403
  return _ts_generator$4(this, function(_state) {
9182
9404
  switch(_state.label){
9183
9405
  case 0:
9184
- return [
9185
- 4,
9186
- storageFileCollection.documentAccessorForTransaction(transaction).loadDocumentFrom(inputStorageFileDocument)
9187
- ];
9188
- case 1:
9189
- storageFileDocument = _state.sent();
9406
+ storageFileDocument = storageFileCollection.documentAccessorForTransaction(transaction).loadDocumentFrom(inputStorageFileDocument);
9190
9407
  return [
9191
9408
  4,
9192
9409
  firebaseServer.assertSnapshotData(storageFileDocument)
9193
9410
  ];
9194
- case 2:
9411
+ case 1:
9195
9412
  storageFile = _state.sent();
9196
9413
  fileAccessor = storageService.file(storageFile);
9197
9414
  if (!force) {
@@ -9211,7 +9428,7 @@ function _processStorageFileInTransactionFactory(context) {
9211
9428
  removeAllStorageFileGroups: true
9212
9429
  }, transaction)
9213
9430
  ];
9214
- case 3:
9431
+ case 2:
9215
9432
  _state.sent();
9216
9433
  // delete the file
9217
9434
  return [
@@ -9220,14 +9437,14 @@ function _processStorageFileInTransactionFactory(context) {
9220
9437
  return null;
9221
9438
  })
9222
9439
  ];
9223
- case 4:
9440
+ case 3:
9224
9441
  _state.sent();
9225
9442
  // delete the document
9226
9443
  return [
9227
9444
  4,
9228
9445
  storageFileDocument.accessor.delete()
9229
9446
  ];
9230
- case 5:
9447
+ case 4:
9231
9448
  _state.sent();
9232
9449
  return [
9233
9450
  2
@@ -9257,6 +9474,9 @@ function _processStorageFileInTransactionFactory(context) {
9257
9474
  * Generates a signed download URL for a {@link StorageFile}'s associated Cloud Storage file.
9258
9475
  * The URL expires after the configured duration. Supports loading the storage file document
9259
9476
  * by key if not provided directly.
9477
+ *
9478
+ * @param context - the storage file server actions context
9479
+ * @returns an async transform-and-validate function that generates a signed download URL
9260
9480
  */ function downloadStorageFileFactory(context) {
9261
9481
  var storageService = context.storageService, firebaseServerActionTransformFunctionFactory = context.firebaseServerActionTransformFunctionFactory, storageFileCollection = context.storageFileCollection;
9262
9482
  return firebaseServerActionTransformFunctionFactory(firebase.downloadStorageFileParamsType, function(params) {
@@ -9273,9 +9493,7 @@ function _processStorageFileInTransactionFactory(context) {
9273
9493
  switch(_state.label){
9274
9494
  case 0:
9275
9495
  // if the StorageFileDocument was not provided, set it from the target key
9276
- if (!storageFileDocument) {
9277
- storageFileDocument = storageFileCollection.documentAccessor().loadDocumentForKey(targetStorageFileDocumentKey);
9278
- }
9496
+ storageFileDocument !== null && storageFileDocument !== void 0 ? storageFileDocument : storageFileDocument = storageFileCollection.documentAccessor().loadDocumentForKey(targetStorageFileDocumentKey);
9279
9497
  return [
9280
9498
  4,
9281
9499
  firebaseServer.assertSnapshotData(storageFileDocument)
@@ -9293,9 +9511,9 @@ function _processStorageFileInTransactionFactory(context) {
9293
9511
  expiresAt: expiresAt,
9294
9512
  expiresIn: expiresIn
9295
9513
  });
9296
- downloadUrlExpiresAt = expires.getExpirationDate();
9514
+ downloadUrlExpiresAt = expires.getExpirationDate(); // always returns a Date when defaultExpiresFromDateToNow and expiresIn are set
9297
9515
  // if they're not an admin, limit the expiration to a max of 30 days.
9298
- if (downloadUrlExpiresAt && !asAdmin) {
9516
+ if (!asAdmin) {
9299
9517
  maxExpirationDate = dateFns.addDays(new Date(), 30);
9300
9518
  downloadUrlExpiresAt = date.findMinDate([
9301
9519
  downloadUrlExpiresAt,
@@ -9307,7 +9525,7 @@ function _processStorageFileInTransactionFactory(context) {
9307
9525
  Promise.all([
9308
9526
  fileAccessor.getSignedUrl({
9309
9527
  action: 'read',
9310
- expiresAt: downloadUrlExpiresAt !== null && downloadUrlExpiresAt !== void 0 ? downloadUrlExpiresAt : undefined,
9528
+ expiresAt: downloadUrlExpiresAt,
9311
9529
  responseDisposition: responseDisposition !== null && responseDisposition !== void 0 ? responseDisposition : undefined,
9312
9530
  responseType: asAdmin ? responseContentType !== null && responseContentType !== void 0 ? responseContentType : undefined : undefined // can only be set by admins
9313
9531
  }),
@@ -9345,7 +9563,16 @@ function _processStorageFileInTransactionFactory(context) {
9345
9563
  })();
9346
9564
  });
9347
9565
  }
9348
- function createStorageFileGroupInTransactionFactory(context) {
9566
+ /**
9567
+ * Internal factory that creates a function for creating a {@link StorageFileGroup} document
9568
+ * within a Firestore transaction.
9569
+ *
9570
+ * The created group is flagged for initialization (`s=true`) and uses a dummy owner key
9571
+ * that will be set during the initialization step.
9572
+ *
9573
+ * @param context - the storage file server actions context
9574
+ * @returns an async function that creates a StorageFileGroup within a transaction
9575
+ */ function createStorageFileGroupInTransactionFactory(context) {
9349
9576
  var storageFileGroupCollection = context.storageFileGroupCollection;
9350
9577
  return function(params, transaction) {
9351
9578
  return _async_to_generator$4(function() {
@@ -9391,6 +9618,9 @@ function createStorageFileGroupInTransactionFactory(context) {
9391
9618
  *
9392
9619
  * Creates a new {@link StorageFileGroup} document within a Firestore transaction,
9393
9620
  * associating it with a model key or storage file.
9621
+ *
9622
+ * @param context - the storage file server actions context
9623
+ * @returns an async transform-and-validate function that creates a new StorageFileGroup
9394
9624
  */ function createStorageFileGroupFactory(context) {
9395
9625
  var firestoreContext = context.firestoreContext, firebaseServerActionTransformFunctionFactory = context.firebaseServerActionTransformFunctionFactory;
9396
9626
  var createStorageFileGroupInTransaction = createStorageFileGroupInTransactionFactory(context);
@@ -9399,7 +9629,7 @@ function createStorageFileGroupInTransactionFactory(context) {
9399
9629
  var model, storageFileId, storageFileGroupRelatedModelKey;
9400
9630
  return _ts_generator$4(this, function(_state) {
9401
9631
  model = params.model, storageFileId = params.storageFileId;
9402
- storageFileGroupRelatedModelKey = model ? model : storageFileId ? firebase.inferKeyFromTwoWayFlatFirestoreModelKey(storageFileId) : undefined;
9632
+ storageFileGroupRelatedModelKey = model !== null && model !== void 0 ? model : storageFileId ? firebase.inferKeyFromTwoWayFlatFirestoreModelKey(storageFileId) : undefined;
9403
9633
  if (!storageFileGroupRelatedModelKey) {
9404
9634
  throw createStorageFileGroupInputError();
9405
9635
  }
@@ -9407,42 +9637,32 @@ function createStorageFileGroupInTransactionFactory(context) {
9407
9637
  2,
9408
9638
  function() {
9409
9639
  return _async_to_generator$4(function() {
9410
- var result;
9411
9640
  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
- }
9641
+ return [
9642
+ 2,
9643
+ firestoreContext.runTransaction(function(transaction) {
9644
+ return _async_to_generator$4(function() {
9645
+ var storageFileGroupDocument;
9646
+ return _ts_generator$4(this, function(_state) {
9647
+ switch(_state.label){
9648
+ case 0:
9649
+ return [
9650
+ 4,
9651
+ createStorageFileGroupInTransaction({
9652
+ storageFileGroupRelatedModelKey: storageFileGroupRelatedModelKey
9653
+ }, transaction)
9654
+ ];
9655
+ case 1:
9656
+ storageFileGroupDocument = _state.sent().storageFileGroupDocument;
9657
+ return [
9658
+ 2,
9659
+ storageFileGroupDocument
9660
+ ];
9661
+ }
9662
+ });
9663
+ })();
9664
+ })
9665
+ ];
9446
9666
  });
9447
9667
  })();
9448
9668
  }
@@ -9451,12 +9671,21 @@ function createStorageFileGroupInTransactionFactory(context) {
9451
9671
  })();
9452
9672
  });
9453
9673
  }
9454
- function _syncStorageFileWithGroupsInTransactionFactory(context) {
9674
+ /**
9675
+ * Internal factory that creates a function for syncing a {@link StorageFile} with its
9676
+ * associated {@link StorageFileGroup} documents within a Firestore transaction.
9677
+ *
9678
+ * Adds the storage file to groups it is missing from, removes it from groups when requested,
9679
+ * and optionally creates new groups for references that do not yet exist.
9680
+ *
9681
+ * @param context - the storage file server actions context
9682
+ * @returns an async function that syncs a storage file with its groups within a transaction
9683
+ */ function _syncStorageFileWithGroupsInTransactionFactory(context) {
9455
9684
  var storageFileCollection = context.storageFileCollection, storageFileGroupCollection = context.storageFileGroupCollection;
9456
9685
  var createStorageFileGroupInTransaction = createStorageFileGroupInTransactionFactory(context);
9457
9686
  return function(input, transaction) {
9458
9687
  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;
9688
+ var storageFileDocument, inputStorageFile, force, removeAllStorageFileGroups, skipStorageFileUpdate, storageFileDocumentInTransaction, storageFileGroupDocumentAccessor, storageFile, _tmp, g, storageFileGroupDocuments, storageFileGroupPairs, storageFilesGroupsCreated, storageFilesGroupsUpdated, result;
9460
9689
  return _ts_generator$4(this, function(_state) {
9461
9690
  switch(_state.label){
9462
9691
  case 0:
@@ -9485,7 +9714,7 @@ function _syncStorageFileWithGroupsInTransactionFactory(context) {
9485
9714
  if (!storageFile.gs && !force) {
9486
9715
  throw storageFileNotFlaggedForGroupsSyncError();
9487
9716
  }
9488
- g = (_storageFile_g = storageFile.g) !== null && _storageFile_g !== void 0 ? _storageFile_g : [];
9717
+ g = storageFile.g;
9489
9718
  storageFileGroupDocuments = firebase.loadDocumentsForIds(storageFileGroupDocumentAccessor, g);
9490
9719
  return [
9491
9720
  4,
@@ -9519,10 +9748,15 @@ function _syncStorageFileWithGroupsInTransactionFactory(context) {
9519
9748
  3,
9520
9749
  6
9521
9750
  ];
9751
+ case undefined:
9752
+ return [
9753
+ 3,
9754
+ 8
9755
+ ];
9522
9756
  }
9523
9757
  return [
9524
9758
  3,
9525
- 8
9759
+ 9
9526
9760
  ];
9527
9761
  case 1:
9528
9762
  // add it if it doesn't exist
@@ -9569,7 +9803,7 @@ function _syncStorageFileWithGroupsInTransactionFactory(context) {
9569
9803
  case 5:
9570
9804
  return [
9571
9805
  3,
9572
- 8
9806
+ 9
9573
9807
  ];
9574
9808
  case 6:
9575
9809
  // remove it
@@ -9590,9 +9824,15 @@ function _syncStorageFileWithGroupsInTransactionFactory(context) {
9590
9824
  storageFilesGroupsUpdated += 1;
9591
9825
  return [
9592
9826
  3,
9593
- 8
9827
+ 9
9594
9828
  ];
9595
9829
  case 8:
9830
+ // no change needed
9831
+ return [
9832
+ 3,
9833
+ 9
9834
+ ];
9835
+ case 9:
9596
9836
  return [
9597
9837
  2
9598
9838
  ];
@@ -9635,8 +9875,11 @@ function _syncStorageFileWithGroupsInTransactionFactory(context) {
9635
9875
  *
9636
9876
  * Syncs a single {@link StorageFile}'s embedded data into its associated {@link StorageFileGroup}
9637
9877
  * documents and clears the sync flag on completion.
9878
+ *
9879
+ * @param context - the storage file server actions context
9880
+ * @returns an async transform-and-validate function that syncs a StorageFile with its groups
9638
9881
  */ function syncStorageFileWithGroupsFactory(context) {
9639
- var firestoreContext = context.firestoreContext; context.storageFileCollection; context.storageFileGroupCollection; var firebaseServerActionTransformFunctionFactory = context.firebaseServerActionTransformFunctionFactory;
9882
+ var firestoreContext = context.firestoreContext, firebaseServerActionTransformFunctionFactory = context.firebaseServerActionTransformFunctionFactory;
9640
9883
  var syncStorageFileWithGroupsInTransaction = _syncStorageFileWithGroupsInTransactionFactory(context);
9641
9884
  return firebaseServerActionTransformFunctionFactory(firebase.syncStorageFileWithGroupsParamsType, function(params) {
9642
9885
  return _async_to_generator$4(function() {
@@ -9678,10 +9921,13 @@ function _syncStorageFileWithGroupsInTransactionFactory(context) {
9678
9921
  * Batch-processes all {@link StorageFile} documents flagged for group sync,
9679
9922
  * updating their associated {@link StorageFileGroup} documents and flagging
9680
9923
  * groups for content regeneration when changes occur.
9924
+ *
9925
+ * @param context - the storage file server actions context
9926
+ * @returns an async transform-and-validate function that returns batch sync results
9681
9927
  */ function syncAllFlaggedStorageFilesWithGroupsFactory(context) {
9682
9928
  var firebaseServerActionTransformFunctionFactory = context.firebaseServerActionTransformFunctionFactory, storageFileCollection = context.storageFileCollection;
9683
9929
  var syncStorageFileWithGroups = syncStorageFileWithGroupsFactory(context);
9684
- return firebaseServerActionTransformFunctionFactory(firebase.syncAllFlaggedStorageFilesWithGroupsParamsType, function(params) {
9930
+ return firebaseServerActionTransformFunctionFactory(firebase.syncAllFlaggedStorageFilesWithGroupsParamsType, function(_params) {
9685
9931
  return _async_to_generator$4(function() {
9686
9932
  return _ts_generator$4(this, function(_state) {
9687
9933
  return [
@@ -9793,6 +10039,9 @@ function _syncStorageFileWithGroupsInTransactionFactory(context) {
9793
10039
  *
9794
10040
  * Regenerates the content of a single {@link StorageFileGroup}, including building a ZIP
9795
10041
  * archive from the group's embedded files and updating the group's content metadata.
10042
+ *
10043
+ * @param context - the storage file server actions context
10044
+ * @returns an async transform-and-validate function that regenerates a StorageFileGroup's content
9796
10045
  */ function regenerateStorageFileGroupContentFactory(context) {
9797
10046
  var firestoreContext = context.firestoreContext, storageService = context.storageService, storageFileCollection = context.storageFileCollection, storageFileGroupCollection = context.storageFileGroupCollection, firebaseServerActionTransformFunctionFactory = context.firebaseServerActionTransformFunctionFactory;
9798
10047
  var processStorageFileInTransaction = _processStorageFileInTransactionFactory(context);
@@ -9932,10 +10181,13 @@ function _syncStorageFileWithGroupsInTransactionFactory(context) {
9932
10181
  *
9933
10182
  * Batch-processes all {@link StorageFileGroup} documents flagged for content regeneration,
9934
10183
  * rebuilding their ZIP archives and updating content metadata.
10184
+ *
10185
+ * @param context - the storage file server actions context
10186
+ * @returns an async transform-and-validate function that returns batch regeneration results
9935
10187
  */ function regenerateAllFlaggedStorageFileGroupsContentFactory(context) {
9936
10188
  var firebaseServerActionTransformFunctionFactory = context.firebaseServerActionTransformFunctionFactory, storageFileGroupCollection = context.storageFileGroupCollection;
9937
10189
  var regenerateStorageFileGroupContent = regenerateStorageFileGroupContentFactory(context);
9938
- return firebaseServerActionTransformFunctionFactory(firebase.regenerateAllFlaggedStorageFileGroupsContentParamsType, function(params) {
10190
+ return firebaseServerActionTransformFunctionFactory(firebase.regenerateAllFlaggedStorageFileGroupsContentParamsType, function(_params) {
9939
10191
  return _async_to_generator$4(function() {
9940
10192
  return _ts_generator$4(this, function(_state) {
9941
10193
  return [
@@ -10220,6 +10472,7 @@ var MAKE_TEMPLATE_FOR_STORAGEFILE_RELATED_MODEL_INITIALIZATION_FUNCTION_DELETE_R
10220
10472
  * initialization action to its factory function.
10221
10473
  *
10222
10474
  * @param context - the initialization context with template function and Firestore access
10475
+ * @returns a {@link StorageFileInitServerActions} wired to the provided context
10223
10476
  */ function storageFileInitServerActions(context) {
10224
10477
  return {
10225
10478
  initializeStorageFileGroup: initializeStorageFileGroupFactory(context),
@@ -10235,6 +10488,7 @@ var MAKE_TEMPLATE_FOR_STORAGEFILE_RELATED_MODEL_INITIALIZATION_FUNCTION_DELETE_R
10235
10488
  * - Returns `false` → deletes the document entirely
10236
10489
  *
10237
10490
  * @param input - the document, transaction, template function, and options
10491
+ * @returns an object indicating whether the document was initialized or was already initialized
10238
10492
  * @throws storageFileModelAlreadyInitializedError when `throwErrorIfAlreadyInitialized` is true
10239
10493
  */ function initializeStorageFileModelInTransaction(input) {
10240
10494
  return _async_to_generator$3(function() {
@@ -10336,6 +10590,9 @@ var MAKE_TEMPLATE_FOR_STORAGEFILE_RELATED_MODEL_INITIALIZATION_FUNCTION_DELETE_R
10336
10590
  *
10337
10591
  * Applies the app-specific template function, restricting the template to only the `o` (owner)
10338
10592
  * and content flag properties, and always flags the group for content regeneration.
10593
+ *
10594
+ * @param context - the initialization context providing collection access and the template function
10595
+ * @returns an async function that initializes a storage file group document within a transaction
10339
10596
  */ function initializeStorageFileGroupInTransactionFactory(context) {
10340
10597
  var storageFileGroupCollection = context.storageFileGroupCollection, makeTemplateForStorageFileGroupInitialization = context.makeTemplateForStorageFileGroupInitialization;
10341
10598
  return function(params, storageFileGroupDocument, transaction) {
@@ -10396,6 +10653,9 @@ var MAKE_TEMPLATE_FOR_STORAGEFILE_RELATED_MODEL_INITIALIZATION_FUNCTION_DELETE_R
10396
10653
  *
10397
10654
  * Wraps the in-transaction group initialization in a Firestore transaction
10398
10655
  * and follows the transform-and-validate pattern.
10656
+ *
10657
+ * @param context - the initialization context with Firestore access and template function
10658
+ * @returns a transform-and-validate function for single storage file group initialization
10399
10659
  */ function initializeStorageFileGroupFactory(context) {
10400
10660
  var firestoreContext = context.firestoreContext, firebaseServerActionTransformFunctionFactory = context.firebaseServerActionTransformFunctionFactory;
10401
10661
  var initializeStorageFileGroupInTransaction = initializeStorageFileGroupInTransactionFactory(context);
@@ -10436,6 +10696,9 @@ var MAKE_TEMPLATE_FOR_STORAGEFILE_RELATED_MODEL_INITIALIZATION_FUNCTION_DELETE_R
10436
10696
  * Batch-processes all {@link StorageFileGroup} documents flagged for initialization,
10437
10697
  * initializing each in parallel (up to 5 concurrent tasks). Loops until no more
10438
10698
  * flagged groups are found.
10699
+ *
10700
+ * @param context - the initialization context with Firestore access, collection, and template function
10701
+ * @returns a transform-and-validate function for batch storage file group initialization
10439
10702
  */ function initializeAllApplicableStorageFileGroupsFactory(context) {
10440
10703
  var firestoreContext = context.firestoreContext, firebaseServerActionTransformFunctionFactory = context.firebaseServerActionTransformFunctionFactory, storageFileGroupCollection = context.storageFileGroupCollection;
10441
10704
  var initializeStorageFileGroupInTransaction = initializeStorageFileGroupInTransactionFactory(context);
@@ -10449,7 +10712,7 @@ var MAKE_TEMPLATE_FOR_STORAGEFILE_RELATED_MODEL_INITIALIZATION_FUNCTION_DELETE_R
10449
10712
  var storageFileGroupsVisited, storageFileGroupsSucceeded, storageFileGroupsFailed, storageFileGroupsAlreadyInitialized, initializeStorageFileGroupParams, initializeStorageFileGroupsResults, found, result;
10450
10713
  function initializeStorageFileGroups() {
10451
10714
  return _async_to_generator$3(function() {
10452
- var query, storageFileGroupDocuments, result;
10715
+ var query, storageFileGroupDocuments;
10453
10716
  return _ts_generator$3(this, function(_state) {
10454
10717
  switch(_state.label){
10455
10718
  case 0:
@@ -10461,7 +10724,7 @@ var MAKE_TEMPLATE_FOR_STORAGEFILE_RELATED_MODEL_INITIALIZATION_FUNCTION_DELETE_R
10461
10724
  case 1:
10462
10725
  storageFileGroupDocuments = _state.sent();
10463
10726
  return [
10464
- 4,
10727
+ 2,
10465
10728
  util.performAsyncTasks(storageFileGroupDocuments, function(storageFileGroupDocument) {
10466
10729
  return _async_to_generator$3(function() {
10467
10730
  return _ts_generator$3(this, function(_state) {
@@ -10477,12 +10740,6 @@ var MAKE_TEMPLATE_FOR_STORAGEFILE_RELATED_MODEL_INITIALIZATION_FUNCTION_DELETE_R
10477
10740
  maxParallelTasks: 5
10478
10741
  })
10479
10742
  ];
10480
- case 2:
10481
- result = _state.sent();
10482
- return [
10483
- 2,
10484
- result
10485
- ];
10486
10743
  }
10487
10744
  });
10488
10745
  })();
@@ -10642,6 +10899,10 @@ function _unsupported_iterable_to_array$1(o, minLen) {
10642
10899
  /**
10643
10900
  * Factory that assembles the full {@link StorageFileServerActionsContext} by combining
10644
10901
  * the base context with the upload initialization service.
10902
+ *
10903
+ * @param context - the base server actions context providing Firebase infrastructure
10904
+ * @param storageFileInitializeFromUploadService - the service for initializing storage files from uploads
10905
+ * @returns the fully assembled StorageFileServerActionsContext
10645
10906
  */ function storageFileServerActionsContextFactory(context, storageFileInitializeFromUploadService) {
10646
10907
  return _object_spread_props$2(_object_spread$2({}, context), {
10647
10908
  storageFileInitializeFromUploadService: storageFileInitializeFromUploadService
@@ -10649,12 +10910,19 @@ function _unsupported_iterable_to_array$1(o, minLen) {
10649
10910
  }
10650
10911
  /**
10651
10912
  * Factory that creates a {@link StorageFileServerActions} instance from the assembled context.
10913
+ *
10914
+ * @param context - the fully assembled storage file server actions context
10915
+ * @returns a concrete StorageFileServerActions instance
10652
10916
  */ function storageFileServerActionsFactory(context) {
10653
10917
  return storageFileServerActions(context);
10654
10918
  }
10655
10919
  /**
10656
10920
  * Factory that creates a {@link StorageFileInitServerActions} instance by merging the
10657
10921
  * server actions context with the init-specific configuration.
10922
+ *
10923
+ * @param context - the storage file server actions context
10924
+ * @param storageFileInitServerActionsContextConfig - init-specific configuration with the template function
10925
+ * @returns a concrete StorageFileInitServerActions instance
10658
10926
  */ function storageFileInitServerActionsFactory(context, storageFileInitServerActionsContextConfig) {
10659
10927
  return storageFileInitServerActions(_object_spread$2({}, context, storageFileInitServerActionsContextConfig));
10660
10928
  }
@@ -10668,9 +10936,8 @@ function _unsupported_iterable_to_array$1(o, minLen) {
10668
10936
  *
10669
10937
  * Be sure the class that delares the module using this function also extends AbstractAppStorageFileModule.
10670
10938
  *
10671
- * @param provide
10672
- * @param useFactory
10673
- * @returns
10939
+ * @param config - the module configuration including optional dependency module, imports, exports, and providers
10940
+ * @returns the assembled {@link ModuleMetadata} for the storage file module
10674
10941
  */ function appStorageFileModuleMetadata(config$1) {
10675
10942
  var dependencyModule = config$1.dependencyModule, imports = config$1.imports, exports$1 = config$1.exports, providers = config$1.providers;
10676
10943
  var dependencyModuleImport = dependencyModule ? [
@@ -11134,6 +11401,13 @@ var storageFileProcessingNotificationTaskHandlerDefaultCleanup = function storag
11134
11401
  };
11135
11402
  /**
11136
11403
  * Creates a NotificationTaskServiceTaskHandlerConfig that handles the StorageFileProcessingNotificationTask.
11404
+ *
11405
+ * Builds a subtask-based notification handler that loads the storage file document,
11406
+ * determines its purpose, and dispatches to the appropriate purpose-specific processor.
11407
+ * Includes optional StorageFileGroup processors (e.g., ZIP generation) by default.
11408
+ *
11409
+ * @param config - handler configuration including processors, storage accessor, and Firestore collections
11410
+ * @returns a NotificationTaskServiceTaskHandlerConfig wired for storage file processing
11137
11411
  */ function storageFileProcessingNotificationTaskHandler(config) {
11138
11412
  var inputProcessors = config.processors, storageAccessor = config.storageAccessor, storageFileFirestoreCollections = config.storageFileFirestoreCollections, allStorageFileGroupProcessorConfig = config.allStorageFileGroupProcessorConfig;
11139
11413
  var storageFileDocumentAccessor = storageFileFirestoreCollections.storageFileCollection.documentAccessor();
@@ -11152,16 +11426,11 @@ var storageFileProcessingNotificationTaskHandlerDefaultCleanup = function storag
11152
11426
  subtaskHandlerFunctionName: 'storageFileProcessingNotificationTaskHandler',
11153
11427
  inputFunction: function inputFunction(data) {
11154
11428
  return _async_to_generator$1(function() {
11155
- var storageFileDocument, loadStorageFile, purpose, storagePath, file, fileDetailsAccessor, input;
11429
+ var storageFileDocument, loadStorageFile, purpose, storagePath, file, fileDetailsAccessor;
11156
11430
  return _ts_generator$1(this, function(_state) {
11157
11431
  switch(_state.label){
11158
11432
  case 0:
11159
- return [
11160
- 4,
11161
- storageFileDocumentAccessor.loadDocumentForId(data.storageFile)
11162
- ];
11163
- case 1:
11164
- storageFileDocument = _state.sent();
11433
+ storageFileDocument = storageFileDocumentAccessor.loadDocumentForId(data.storageFile);
11165
11434
  loadStorageFile = util.cachedGetter(function() {
11166
11435
  return _async_to_generator$1(function() {
11167
11436
  var storageFile;
@@ -11185,11 +11454,17 @@ var storageFileProcessingNotificationTaskHandlerDefaultCleanup = function storag
11185
11454
  });
11186
11455
  })();
11187
11456
  });
11188
- purpose = data === null || data === void 0 ? void 0 : data.p;
11189
- if (!!purpose) return [
11457
+ purpose = data.p;
11458
+ if (!(// attempt to load the purpose from the storage file, if it exists.
11459
+ purpose !== null && purpose !== void 0)) return [
11460
+ 3,
11461
+ 1
11462
+ ];
11463
+ return [
11190
11464
  3,
11191
11465
  3
11192
11466
  ];
11467
+ case 1:
11193
11468
  return [
11194
11469
  4,
11195
11470
  loadStorageFile().then(function(x) {
@@ -11197,7 +11472,6 @@ var storageFileProcessingNotificationTaskHandlerDefaultCleanup = function storag
11197
11472
  })
11198
11473
  ];
11199
11474
  case 2:
11200
- // attempt to load the purpose from the storage file, if it exists.
11201
11475
  purpose = _state.sent();
11202
11476
  _state.label = 3;
11203
11477
  case 3:
@@ -11226,15 +11500,14 @@ var storageFileProcessingNotificationTaskHandlerDefaultCleanup = function storag
11226
11500
  case 6:
11227
11501
  file = storageAccessor.file(storagePath);
11228
11502
  fileDetailsAccessor = makeFileDetailsAccessor(file);
11229
- input = {
11230
- target: purpose,
11231
- loadStorageFile: loadStorageFile,
11232
- fileDetailsAccessor: fileDetailsAccessor,
11233
- storageFileDocument: storageFileDocument
11234
- };
11235
11503
  return [
11236
11504
  2,
11237
- input
11505
+ {
11506
+ target: purpose,
11507
+ loadStorageFile: loadStorageFile,
11508
+ fileDetailsAccessor: fileDetailsAccessor,
11509
+ storageFileDocument: storageFileDocument
11510
+ }
11238
11511
  ];
11239
11512
  }
11240
11513
  });
@@ -11287,7 +11560,12 @@ var storageFileProcessingNotificationTaskHandlerDefaultCleanup = function storag
11287
11560
  processors: processors
11288
11561
  }));
11289
11562
  }
11290
- function allStorageFileGroupStorageFileProcessingPurposeSubtaskProcessors(config) {
11563
+ /**
11564
+ * Assembles all built-in StorageFileGroup subtask processors, such as ZIP generation.
11565
+ *
11566
+ * @param config - configuration controlling which group processors to include
11567
+ * @returns an array of subtask processor configs for StorageFileGroup processing purposes
11568
+ */ function allStorageFileGroupStorageFileProcessingPurposeSubtaskProcessors(config) {
11291
11569
  var excludeZipProcessing = config.excludeZipProcessing;
11292
11570
  var processors = [];
11293
11571
  if (!excludeZipProcessing) {
@@ -11295,7 +11573,15 @@ function allStorageFileGroupStorageFileProcessingPurposeSubtaskProcessors(config
11295
11573
  }
11296
11574
  return processors;
11297
11575
  }
11298
- function storageFileGroupZipStorageFileProcessingPurposeSubtaskProcessor(config) {
11576
+ /**
11577
+ * Creates the ZIP subtask processor for {@link StorageFileGroup} processing.
11578
+ *
11579
+ * This processor streams all files in the group into a ZIP archive, attaches an info JSON
11580
+ * manifest, and uploads the result to the group's designated storage path.
11581
+ *
11582
+ * @param config - configuration providing Firestore collections, storage accessor, and ZIP options
11583
+ * @returns a subtask processor config targeting the StorageFileGroup ZIP purpose
11584
+ */ function storageFileGroupZipStorageFileProcessingPurposeSubtaskProcessor(config) {
11299
11585
  var _ref;
11300
11586
  var storageFileFirestoreCollections = config.storageFileFirestoreCollections, storageAccessor = config.storageAccessor, zip = config.zip;
11301
11587
  var storageFileCollection = storageFileFirestoreCollections.storageFileCollection, storageFileGroupCollection = storageFileFirestoreCollections.storageFileGroupCollection;
@@ -11425,7 +11711,7 @@ function storageFileGroupZipStorageFileProcessingPurposeSubtaskProcessor(config)
11425
11711
  4,
11426
11712
  util.performAsyncTasks(storageFileDataPairsToZip, function(storageFileDataPair) {
11427
11713
  return _async_to_generator$1(function() {
11428
- var storageFile, storageFileDisplayName, referencesStorageFileGroup, fileAccessor, metadata, fileSlashPathDetails, storageFileGroupEmbeddedFile, embeddedFileNameOverride, nameFromFactory, untypedName, extension, name, fileStream;
11714
+ var storageFile, storageFileDisplayName, referencesStorageFileGroup, fileAccessor, metadata, _ref, _ref1, fileSlashPathDetails, storageFileGroupEmbeddedFile, embeddedFileNameOverride, nameFromFactory, untypedName, extension, name, fileStream;
11429
11715
  return _ts_generator$1(this, function(_state) {
11430
11716
  switch(_state.label){
11431
11717
  case 0:
@@ -11436,9 +11722,7 @@ function storageFileGroupZipStorageFileProcessingPurposeSubtaskProcessor(config)
11436
11722
  ];
11437
11723
  storageFileDisplayName = storageFile.n;
11438
11724
  // make sure it references the storage file group
11439
- referencesStorageFileGroup = storageFile.g.some(function(x) {
11440
- return x === storageFileGroupId;
11441
- });
11725
+ referencesStorageFileGroup = storageFile.g.includes(storageFileGroupId);
11442
11726
  if (!referencesStorageFileGroup) return [
11443
11727
  3,
11444
11728
  6
@@ -11471,15 +11755,20 @@ function storageFileGroupZipStorageFileProcessingPurposeSubtaskProcessor(config)
11471
11755
  ];
11472
11756
  case 2:
11473
11757
  nameFromFactory = _state.sent();
11474
- untypedName = nameFromFactory || storageFileDisplayName || embeddedFileNameOverride || fileSlashPathDetails.fileName;
11758
+ untypedName = (_ref = (_ref1 = nameFromFactory !== null && nameFromFactory !== void 0 ? nameFromFactory : storageFileDisplayName) !== null && _ref1 !== void 0 ? _ref1 : embeddedFileNameOverride) !== null && _ref !== void 0 ? _ref : fileSlashPathDetails.fileName;
11475
11759
  if (fileSlashPathDetails.typedFileExtension) {
11476
11760
  extension = fileSlashPathDetails.typedFileExtension;
11477
11761
  } else if (metadata.contentType) {
11478
11762
  extension = util.documentFileExtensionForMimeType(metadata.contentType);
11479
11763
  }
11480
11764
  // set the default name if still unset
11481
- untypedName = untypedName || "sf_".concat(storageFile.id);
11765
+ untypedName = untypedName !== null && untypedName !== void 0 ? untypedName : "sf_".concat(storageFile.id);
11482
11766
  name = extension ? "".concat(untypedName, ".").concat(extension) : untypedName;
11767
+ if (!fileAccessor.getStream) {
11768
+ return [
11769
+ 2
11770
+ ]; // skip files where getStream is not available
11771
+ }
11483
11772
  fileStream = fileAccessor.getStream();
11484
11773
  return [
11485
11774
  4,
@@ -11830,6 +12119,7 @@ function _ts_generator(thisArg, body) {
11830
12119
  *
11831
12120
  * @param error - the error that caused the permanent failure
11832
12121
  * @param createdFile - optional path to a file that was created before the error and should be deleted
12122
+ * @returns a permanent failure result with the error and optional created file reference
11833
12123
  */ function storageFileInitializeFromUploadServiceInitializerResultPermanentFailure(error, createdFile) {
11834
12124
  return {
11835
12125
  error: error,
@@ -11849,6 +12139,7 @@ function _ts_generator(thisArg, body) {
11849
12139
  * 4. Optionally, previous files for the same purpose/user are flagged for deletion
11850
12140
  *
11851
12141
  * @param config - service configuration including determiners, initializers, and storage references
12142
+ * @returns a {@link StorageFileInitializeFromUploadService} with type detection and upload initialization
11852
12143
  *
11853
12144
  * @example
11854
12145
  * ```ts
@@ -11885,10 +12176,9 @@ function _ts_generator(thisArg, body) {
11885
12176
  }
11886
12177
  });
11887
12178
  var determiner = firebase.combineUploadFileTypeDeterminers(_object_spread({
11888
- determiners: allDeterminers
11889
- }, _object_spread({
12179
+ determiners: allDeterminers,
11890
12180
  completeSearchOnFirstMatch: true
11891
- }, config.combineDeterminersConfig)));
12181
+ }, config.combineDeterminersConfig));
11892
12182
  // validate initializers
11893
12183
  if (validate) {
11894
12184
  var allInitializerTypes = Object.keys(initializers);
@@ -11916,6 +12206,7 @@ function _ts_generator(thisArg, body) {
11916
12206
  return {
11917
12207
  checkFileIsAllowedToBeInitialized: inputCheckFileIsAllowedToBeInitialized !== null && inputCheckFileIsAllowedToBeInitialized !== void 0 ? inputCheckFileIsAllowedToBeInitialized : util.asDecisionFunction(true),
11918
12208
  determineUploadFileType: determineUploadFileType,
12209
+ // eslint-disable-next-line sonarjs/cognitive-complexity
11919
12210
  initializeFromUpload: function initializeFromUpload(input) {
11920
12211
  return _async_to_generator(function() {
11921
12212
  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;