@dereekb/firebase-server 13.15.0 → 13.17.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.
@@ -1,6 +1,6 @@
1
1
  import { mapObjectKeysToLowercase, multiValueMapBuilder, batch, runAsyncTasksForValues, asArray, pushArrayItemsIntoArray, UNSET_INDEX_NUMBER, areEqualPOJOValues, performAsyncTasks, removeValuesAtIndexesFromArrayCopy, takeFront, makeModelMap, computeNextFreeIndexOnSortedValuesFunction, readIndexNumber, asPromise, dateOrMillisecondsToDate, filterOnlyUndefinedValues, iterablesAreSetEquivalent, mapIdentityFunction, makeValuesGroupMap, filterMaybeArrayValues, cutStringFunction, takeLast, separateValues, unique, addMilliseconds, mergeSlashPaths, ModelRelationUtility, isThrottled, isPast, unixDateTimeSecondsNumberFromDate, slashPathDetails, MS_IN_MINUTE, expirationDetails, dateFromDateOrTimeMillisecondsNumber, cachedGetter, MS_IN_HOUR, documentFileExtensionForMimeType, useCallback, ZIP_FILE_MIME_TYPE, MAP_IDENTITY, pushItemOrArrayItemsIntoArray, asDecisionFunction } from '@dereekb/util';
2
2
  import { yearWeekCode, isSameDate, findMaxDate, findMinDate } from '@dereekb/date';
3
- import { CREATE_NOTIFICATION_ID_REQUIRED_ERROR_CODE, NOTIFICATION_BOX_DOES_NOT_EXIST_ERROR_CODE, NOTIFICATION_BOX_EXCLUSION_TARGET_INVALID_ERROR_CODE, NOTIFICATION_BOX_EXISTS_FOR_MODEL_ERROR_CODE, NOTIFICATION_BOX_RECIPIENT_DOES_NOT_EXIST_ERROR_CODE, NOTIFICATION_MODEL_ALREADY_INITIALIZED_ERROR_CODE, NOTIFICATION_USER_BLOCKED_FROM_BEING_ADD_TO_RECIPIENTS_ERROR_CODE, NOTIFICATION_USER_INVALID_UID_FOR_CREATE_ERROR_CODE, NOTIFICATION_USER_LOCKED_CONFIG_FROM_BEING_UPDATED_ERROR_CODE, firestoreDummyKey, mergeNotificationBoxRecipients, mergeNotificationUserNotificationBoxRecipientConfigs, applyExclusionsToNotificationUserNotificationBoxRecipientConfigs, mergeNotificationBoxRecipientTemplateConfigs, effectiveNotificationBoxRecipientTemplateConfig, notificationSendExclusionCanSendFunction, mergeNotificationUserDefaultNotificationBoxRecipientConfig, DEFAULT_NOTIFICATION_TEMPLATE_TYPE, NotificationRecipientSendFlag, allowedNotificationRecipients, loadDocumentsForIds, getDocumentSnapshotDataPairsWithData, cleanupOldNotificationLoggedEventDaysParamsType, cleanupSentNotificationsParamsType, createNotificationBoxParamsType, createNotificationSummaryParamsType, createNotificationUserParamsType, resyncNotificationUserParamsType, sendNotificationParamsType, sendQueuedNotificationsParamsType, updateNotificationBoxParamsType, updateNotificationBoxRecipientParamsType, updateNotificationSummaryParamsType, updateNotificationUserParamsType, updateNotificationUserDefaultNotificationBoxRecipientConfig, effectiveNotificationBoxRecipientConfig, updateNotificationUserNotificationBoxRecipientConfigs, calculateNsForNotificationUserNotificationBoxRecipientConfigs, getDocumentSnapshotDataPairs, iterateFirestoreDocumentSnapshotPairs, notificationUsersFlaggedForNeedsSyncQuery, notificationSummaryIdForModel, loadNotificationBoxDocumentForReferencePair, updateNotificationUserNotificationSendExclusions, notificationBoxRecipientTemplateConfigArrayToRecord, updateNotificationRecipient, setIdAndKeyFromKeyIdRefOnDocumentData, inferKeyFromTwoWayFlatFirestoreModelKey, NotificationSendType, getDocumentSnapshotData, notificationSendFlagsImplyIsComplete, NotificationSendState, mergeNotificationSendMessagesResult, notificationsPastSendAtTimeQuery, loadDocumentsForDocumentReferencesFromValues, notificationLoggedEventDayId, shouldSaveNotificationToNotificationWeek, notificationsReadyForCleanupQuery, notificationLoggedEventDaysOlderThanQuery, initializeAllApplicableNotificationBoxesParamsType, initializeAllApplicableNotificationSummariesParamsType, initializeNotificationModelParamsType, firestoreModelKeyCollectionName, notificationBoxesFlaggedForNeedsInitializationQuery, notificationSummariesFlaggedForNeedsInitializationQuery, noContentNotificationMessageFunctionFactory, _createNotificationDocumentFromPair, createNotificationDocumentPair, NOTIFICATION_SUMMARY_EMBEDDED_NOTIFICATION_ITEM_SUBJECT_MAX_LENGTH, NOTIFICATION_SUMMARY_EMBEDDED_NOTIFICATION_ITEM_MESSAGE_MAX_LENGTH, sortNotificationItemsFunction, NOTIFICATION_SUMMARY_ITEM_LIMIT, NOTIFICATION_TASK_SUBTASK_CHECKPOINT_PROCESSING, NOTIFICATION_TASK_SUBTASK_CHECKPOINT_CLEANUP, completeSubtaskProcessingAndScheduleCleanupTaskResult, delayCompletion, notificationTaskComplete, notificationTaskDelayRetry, DEFAULT_NOTIFICATION_TASK_SUBTASK_CLEANUP_RETRY_DELAY, DEFAULT_NOTIFICATION_TASK_SUBTASK_CLEANUP_RETRY_ATTEMPTS, STORAGE_FILE_GROUP_CREATE_INPUT_ERROR_CODE, STORAGE_FILE_ALREADY_PROCESSED_ERROR_CODE, STORAGE_FILE_CANNOT_BE_DELETED_YET_ERROR_CODE, STORAGE_FILE_GROUP_QUEUED_FOR_INITIALIZATION_ERROR_CODE, STORAGE_FILE_MODEL_ALREADY_INITIALIZED_ERROR_CODE, STORAGE_FILE_NOT_FLAGGED_FOR_DELETION_ERROR_CODE, STORAGE_FILE_NOT_FLAGGED_FOR_GROUPS_SYNC_ERROR_CODE, STORAGE_FILE_PROCESSING_NOT_ALLOWED_FOR_INVALID_STATE_ERROR_CODE, STORAGE_FILE_PROCESSING_NOT_AVAILABLE_FOR_TYPE_ERROR_CODE, STORAGE_FILE_PROCESSING_NOT_QUEUED_FOR_PROCESSING_ERROR_CODE, UPLOADED_FILE_DOES_NOT_EXIST_ERROR_CODE, UPLOADED_FILE_INITIALIZATION_DISCARDED_ERROR_CODE, UPLOADED_FILE_INITIALIZATION_FAILED_ERROR_CODE, UPLOADED_FILE_NOT_ALLOWED_TO_BE_INITIALIZED_ERROR_CODE, createStorageFileParamsType, createStorageFileGroupParamsType, createStorageFileSignedUploadUrlParamsType, deleteAllQueuedStorageFilesParamsType, deleteStorageFileParamsType, downloadMultipleStorageFilesParamsType, downloadStorageFileParamsType, initializeAllStorageFilesFromUploadsParamsType, initializeStorageFileFromUploadParamsType, processAllQueuedStorageFilesParamsType, processStorageFileParamsType, readMultipleStorageFilesMetadataParamsType, readStorageFileMetadataParamsType, regenerateAllFlaggedStorageFileGroupsContentParamsType, regenerateStorageFileGroupContentParamsType, syncAllFlaggedStorageFilesWithGroupsParamsType, syncStorageFileWithGroupsParamsType, updateStorageFileParamsType, updateStorageFileGroupParamsType, UPLOADS_FOLDER_PATH, iterateStorageListFilesByEachFile, StorageFileProcessingState, storageFilesQueuedForProcessingQuery, STORAGE_FILE_PROCESSING_STUCK_THROTTLE_CHECK_MS, StorageFileState, createNotificationDocument, storageFileProcessingNotificationTaskTemplate, storageFilesQueuedForDeleteQuery, loadStorageFileGroupDocumentForReferencePair, calculateStorageFileGroupEmbeddedFileUpdate, iterateFirestoreDocumentSnapshotPairBatches, storageFileFlaggedForSyncWithGroupsQuery, createStorageFileDocumentPairFactory, StorageFileCreationType, calculateStorageFileGroupRegeneration, storageFileGroupZipFileStoragePath, STORAGE_FILE_GROUP_ZIP_STORAGE_FILE_PURPOSE, getDocumentSnapshotDataPair, storageFileGroupsFlaggedForContentRegenerationQuery, DEFAULT_CREATE_STORAGE_FILE_SIGNED_UPLOAD_URL_EXPIRES_IN_MS, CREATE_STORAGE_FILE_SIGNED_UPLOAD_URL_MIN_EXPIRES_IN_MS, CREATE_STORAGE_FILE_SIGNED_UPLOAD_URL_MAX_EXPIRES_IN_MS, CREATE_STORAGE_FILE_SIGNED_UPLOAD_URL_MAX_FILENAME_LENGTH, initializeAllApplicableStorageFileGroupsParamsType, initializeStorageFileModelParamsType, storageFileGroupsFlaggedForNeedsInitializationQuery, STORAGE_FILE_GROUP_ZIP_STORAGE_FILE_PURPOSE_CREATE_ZIP_SUBTASK, storedFileReaderFactory, STORAGE_FILE_PROCESSING_NOTIFICATION_TASK_TYPE, copyStoragePath, notificationSubtaskComplete, STORAGE_FILE_GROUP_ZIP_INFO_JSON_FILE_NAME, limitUploadFileTypeDeterminer, combineUploadFileTypeDeterminers, STORAGEFILE_RELATED_FILE_METADATA_KEY, storageFilePurposeAndUserQuery } from '@dereekb/firebase';
3
+ import { CREATE_NOTIFICATION_ID_REQUIRED_ERROR_CODE, NOTIFICATION_BOX_DOES_NOT_EXIST_ERROR_CODE, NOTIFICATION_BOX_EXCLUSION_TARGET_INVALID_ERROR_CODE, NOTIFICATION_BOX_EXISTS_FOR_MODEL_ERROR_CODE, NOTIFICATION_BOX_RECIPIENT_DOES_NOT_EXIST_ERROR_CODE, NOTIFICATION_MODEL_ALREADY_INITIALIZED_ERROR_CODE, NOTIFICATION_USER_BLOCKED_FROM_BEING_ADD_TO_RECIPIENTS_ERROR_CODE, NOTIFICATION_USER_INVALID_UID_FOR_CREATE_ERROR_CODE, NOTIFICATION_USER_LOCKED_CONFIG_FROM_BEING_UPDATED_ERROR_CODE, firestoreDummyKey, mergeNotificationBoxRecipients, mergeNotificationUserNotificationBoxRecipientConfigs, applyExclusionsToNotificationUserNotificationBoxRecipientConfigs, mergeNotificationBoxRecipientTemplateConfigs, effectiveNotificationBoxRecipientTemplateConfig, notificationSendExclusionCanSendFunction, mergeNotificationUserDefaultNotificationBoxRecipientConfig, DEFAULT_NOTIFICATION_TEMPLATE_TYPE, NotificationRecipientSendFlag, allowedNotificationRecipients, loadDocumentsForIds, getDocumentSnapshotDataPairsWithData, cleanupOldNotificationLoggedEventDaysParamsType, cleanupSentNotificationsParamsType, createNotificationBoxParamsType, createNotificationSummaryParamsType, createNotificationUserParamsType, resyncNotificationUserParamsType, sendNotificationParamsType, sendQueuedNotificationsParamsType, updateNotificationBoxParamsType, updateNotificationBoxRecipientParamsType, updateNotificationSummaryParamsType, updateNotificationUserParamsType, updateNotificationUserDefaultNotificationBoxRecipientConfig, effectiveNotificationBoxRecipientConfig, updateNotificationUserNotificationBoxRecipientConfigs, calculateNsForNotificationUserNotificationBoxRecipientConfigs, getDocumentSnapshotDataPairs, iterateFirestoreDocumentSnapshotPairs, notificationUsersFlaggedForNeedsSyncQuery, notificationSummaryIdForModel, loadNotificationBoxDocumentForReferencePair, updateNotificationUserNotificationSendExclusions, notificationBoxRecipientTemplateConfigArrayToRecord, updateNotificationRecipient, setIdAndKeyFromKeyIdRefOnDocumentData, inferKeyFromTwoWayFlatFirestoreModelKey, NotificationSendType, getDocumentSnapshotData, notificationSendFlagsImplyIsComplete, NotificationSendState, mergeNotificationSendMessagesResult, notificationsPastSendAtTimeQuery, loadDocumentsForDocumentReferencesFromValues, notificationLoggedEventDayId, shouldSaveNotificationToNotificationWeek, notificationsReadyForCleanupQuery, notificationLoggedEventDaysOlderThanQuery, initializeAllApplicableNotificationBoxesParamsType, initializeAllApplicableNotificationSummariesParamsType, initializeNotificationModelParamsType, firestoreModelKeyCollectionName, notificationBoxesFlaggedForNeedsInitializationQuery, notificationSummariesFlaggedForNeedsInitializationQuery, noContentNotificationMessageFunctionFactory, _createNotificationDocumentFromPair, createNotificationDocumentPair, NOTIFICATION_SUMMARY_EMBEDDED_NOTIFICATION_ITEM_SUBJECT_MAX_LENGTH, NOTIFICATION_SUMMARY_EMBEDDED_NOTIFICATION_ITEM_MESSAGE_MAX_LENGTH, sortNotificationItemsFunction, NOTIFICATION_SUMMARY_ITEM_LIMIT, NOTIFICATION_TASK_SUBTASK_CHECKPOINT_PROCESSING, NOTIFICATION_TASK_SUBTASK_CHECKPOINT_CLEANUP, completeSubtaskProcessingAndScheduleCleanupTaskResult, delayCompletion, notificationTaskComplete, notificationTaskDelayRetry, DEFAULT_NOTIFICATION_TASK_SUBTASK_CLEANUP_RETRY_DELAY, DEFAULT_NOTIFICATION_TASK_SUBTASK_CLEANUP_RETRY_ATTEMPTS, STORAGE_FILE_GROUP_CREATE_INPUT_ERROR_CODE, STORAGE_FILE_ALREADY_PROCESSED_ERROR_CODE, STORAGE_FILE_CANNOT_BE_DELETED_YET_ERROR_CODE, STORAGE_FILE_GROUP_QUEUED_FOR_INITIALIZATION_ERROR_CODE, STORAGE_FILE_MODEL_ALREADY_INITIALIZED_ERROR_CODE, STORAGE_FILE_NOT_FLAGGED_FOR_DELETION_ERROR_CODE, STORAGE_FILE_NOT_FLAGGED_FOR_GROUPS_SYNC_ERROR_CODE, STORAGE_FILE_PROCESSING_NOT_ALLOWED_FOR_INVALID_STATE_ERROR_CODE, STORAGE_FILE_PROCESSING_NOT_AVAILABLE_FOR_TYPE_ERROR_CODE, STORAGE_FILE_PROCESSING_NOT_QUEUED_FOR_PROCESSING_ERROR_CODE, UPLOADED_FILE_DOES_NOT_EXIST_ERROR_CODE, UPLOADED_FILE_INITIALIZATION_DISCARDED_ERROR_CODE, UPLOADED_FILE_INITIALIZATION_FAILED_ERROR_CODE, UPLOADED_FILE_NOT_ALLOWED_TO_BE_INITIALIZED_ERROR_CODE, createStorageFileParamsType, createStorageFileGroupParamsType, createStorageFileSignedUploadUrlParamsType, deleteAllQueuedStorageFilesParamsType, deleteStorageFileParamsType, downloadMultipleStorageFilesParamsType, downloadStorageFileParamsType, initializeAllStorageFilesFromUploadsParamsType, initializeStorageFileFromUploadParamsType, processAllQueuedStorageFilesParamsType, processStorageFileParamsType, readMultipleStorageFilesMetadataParamsType, readStorageFileMetadataParamsType, regenerateAllFlaggedStorageFileGroupsContentParamsType, regenerateStorageFileGroupContentParamsType, syncAllFlaggedStorageFilesWithGroupsParamsType, syncStorageFileWithGroupsParamsType, updateStorageFileParamsType, updateStorageFileGroupParamsType, UPLOADS_FOLDER_PATH, iterateStorageListFilesByEachFile, StorageFileProcessingState, storageFilesQueuedForProcessingQuery, STORAGE_FILE_PROCESSING_STUCK_THROTTLE_CHECK_MS, StorageFileState, createNotificationDocument, storageFileProcessingNotificationTaskTemplate, storageFilesQueuedForDeleteQuery, loadStorageFileGroupDocumentForReferencePair, calculateStorageFileGroupEmbeddedFileUpdate, iterateFirestoreDocumentSnapshotPairBatches, storageFileFlaggedForSyncWithGroupsQuery, createStorageFileDocumentPairFactory, StorageFileCreationType, storageFileGroupZipFileStoragePath, STORAGE_FILE_GROUP_ZIP_STORAGE_FILE_PURPOSE, calculateStorageFileGroupRegeneration, getDocumentSnapshotDataPair, storageFileGroupsFlaggedForContentRegenerationQuery, DEFAULT_CREATE_STORAGE_FILE_SIGNED_UPLOAD_URL_EXPIRES_IN_MS, CREATE_STORAGE_FILE_SIGNED_UPLOAD_URL_MIN_EXPIRES_IN_MS, CREATE_STORAGE_FILE_SIGNED_UPLOAD_URL_MAX_EXPIRES_IN_MS, CREATE_STORAGE_FILE_SIGNED_UPLOAD_URL_MAX_FILENAME_LENGTH, initializeAllApplicableStorageFileGroupsParamsType, initializeStorageFileModelParamsType, storageFileGroupsFlaggedForNeedsInitializationQuery, STORAGE_FILE_GROUP_ZIP_STORAGE_FILE_PURPOSE_CREATE_ZIP_SUBTASK, storedFileReaderFactory, STORAGE_FILE_PROCESSING_NOTIFICATION_TASK_TYPE, copyStoragePath, notificationSubtaskComplete, STORAGE_FILE_GROUP_ZIP_INFO_JSON_FILE_NAME, limitUploadFileTypeDeterminer, combineUploadFileTypeDeterminers, STORAGEFILE_RELATED_FILE_METADATA_KEY, storageFilePurposeAndUserQuery } from '@dereekb/firebase';
4
4
  import { preconditionConflictError, assertSnapshotData, internalServerError, badRequestError } from '@dereekb/firebase-server';
5
5
  import { hoursToMilliseconds, addHours, isFuture, addMinutes, addSeconds, addDays } from 'date-fns';
6
6
  import { Optional, Inject, Injectable, Module, Global } from '@nestjs/common';
@@ -249,9 +249,7 @@ var DEFAULT_MAILGUN_NOTIFICATION_EMAIL_SEND_SERVICE_MAX_BATCH_SIZE_PER_REQUEST =
249
249
  return _ts_generator$h(this, function(_state) {
250
250
  sendTemplateNameToLowercase = sendTemplateName.toLowerCase();
251
251
  builderForKey = lowercaseKeysMessageBuilders[sendTemplateNameToLowercase];
252
- if (!builderForKey) {
253
- throw new Error('mailgunNotificationEmailSendService(): A template builder was not available for template type "'.concat(sendTemplateName, '".'));
254
- } else {
252
+ if (builderForKey) {
255
253
  input = {
256
254
  mailgunService: mailgunService,
257
255
  sendTemplateName: sendTemplateName,
@@ -262,6 +260,7 @@ var DEFAULT_MAILGUN_NOTIFICATION_EMAIL_SEND_SERVICE_MAX_BATCH_SIZE_PER_REQUEST =
262
260
  builderForKey(input)
263
261
  ];
264
262
  }
263
+ throw new Error('mailgunNotificationEmailSendService(): A template builder was not available for template type "'.concat(sendTemplateName, '".'));
265
264
  });
266
265
  })();
267
266
  }))
@@ -1212,13 +1211,13 @@ function _ts_generator$g(thisArg, body) {
1212
1211
  var result;
1213
1212
  if (removeAllCompletedCheckpoints) {
1214
1213
  result = [];
1215
- } else if (removeFromCompletedCheckpoints != null) {
1214
+ } else if (removeFromCompletedCheckpoints == null) {
1215
+ result = inputCompletions;
1216
+ } else {
1216
1217
  var removeFromCompletionsSet = new Set(asArray(removeFromCompletedCheckpoints));
1217
1218
  result = inputCompletions.filter(function(x) {
1218
1219
  return !removeFromCompletionsSet.has(x);
1219
1220
  });
1220
- } else {
1221
- result = inputCompletions;
1222
1221
  }
1223
1222
  return result;
1224
1223
  }
@@ -1795,17 +1794,10 @@ var MAX_NOTIFICATION_BOXES_TO_UPDATE_PER_BATCH = 50;
1795
1794
  notificationBox = notificationBoxDocumentSnapshotDataPair.data, document = notificationBoxDocumentSnapshotDataPair.document;
1796
1795
  nb = document.id;
1797
1796
  notificationUserNotificationBoxConfig = notificationBoxConfigsToSyncInThisBatchMap.get(nb); // always exists
1798
- if (!!notificationBox) return [
1799
- 3,
1800
- 1
1801
- ];
1802
- // if the entire NotificationBox no longer exists, flag to remove it from the user as a cleanup measure
1803
- notificationBoxConfigsToRemoveFromNotificationUser.add(nb);
1804
- return [
1797
+ if (!notificationBox) return [
1805
1798
  3,
1806
1799
  3
1807
1800
  ];
1808
- case 1:
1809
1801
  // update in the NotificationBox
1810
1802
  recipientIndex = notificationBox.r.findIndex(function(x) {
1811
1803
  return x.uid === notificationUser.uid;
@@ -1839,7 +1831,7 @@ var MAX_NOTIFICATION_BOXES_TO_UPDATE_PER_BATCH = 50;
1839
1831
  }
1840
1832
  if (!(r != null)) return [
1841
1833
  3,
1842
- 3
1834
+ 2
1843
1835
  ];
1844
1836
  return [
1845
1837
  4,
@@ -1847,11 +1839,20 @@ var MAX_NOTIFICATION_BOXES_TO_UPDATE_PER_BATCH = 50;
1847
1839
  r: r
1848
1840
  })
1849
1841
  ];
1850
- case 2:
1842
+ case 1:
1851
1843
  _state.sent();
1852
1844
  notificationBoxesUpdatedInBatch += 1;
1853
- _state.label = 3;
1845
+ _state.label = 2;
1846
+ case 2:
1847
+ return [
1848
+ 3,
1849
+ 4
1850
+ ];
1854
1851
  case 3:
1852
+ // if the entire NotificationBox no longer exists, flag to remove it from the user as a cleanup measure
1853
+ notificationBoxConfigsToRemoveFromNotificationUser.add(nb);
1854
+ _state.label = 4;
1855
+ case 4:
1855
1856
  return [
1856
1857
  2
1857
1858
  ];
@@ -2457,7 +2458,7 @@ var MAX_NOTIFICATION_BOXES_TO_UPDATE_PER_BATCH = 50;
2457
2458
  if (!targetRecipient && !insert) {
2458
2459
  throw notificationBoxRecipientDoesNotExistsError();
2459
2460
  }
2460
- c = (_ref = inputC != null ? notificationBoxRecipientTemplateConfigArrayToRecord(inputC) : targetRecipient === null || targetRecipient === void 0 ? void 0 : targetRecipient.c) !== null && _ref !== void 0 ? _ref : {};
2461
+ c = (_ref = inputC == null ? targetRecipient === null || targetRecipient === void 0 ? void 0 : targetRecipient.c : notificationBoxRecipientTemplateConfigArrayToRecord(inputC)) !== null && _ref !== void 0 ? _ref : {};
2461
2462
  nextRecipient = _object_spread$c({
2462
2463
  uid: uid,
2463
2464
  i: (_ref1 = targetRecipient === null || targetRecipient === void 0 ? void 0 : targetRecipient.i) !== null && _ref1 !== void 0 ? _ref1 : UNSET_INDEX_NUMBER,
@@ -2655,14 +2656,15 @@ var MAX_NOTIFICATION_BOXES_TO_UPDATE_PER_BATCH = 50;
2655
2656
  return _ts_generator$f(this, function(_state) {
2656
2657
  switch(_state.label){
2657
2658
  case 0:
2658
- if (!(params.setExclusion != null)) return [
2659
+ if (!(params.setExclusion == null)) return [
2659
2660
  3,
2660
2661
  2
2661
2662
  ];
2662
2663
  return [
2663
2664
  4,
2664
- updateNotificationBoxRecipientExclusionInTransaction({
2665
+ updateNotificationBoxRecipientInTransaction({
2665
2666
  params: params,
2667
+ throwErrorIfNotificationBoxDoesNotExist: true,
2666
2668
  notificationBoxDocument: notificationBoxDocument
2667
2669
  }, transaction)
2668
2670
  ];
@@ -2675,9 +2677,8 @@ var MAX_NOTIFICATION_BOXES_TO_UPDATE_PER_BATCH = 50;
2675
2677
  case 2:
2676
2678
  return [
2677
2679
  4,
2678
- updateNotificationBoxRecipientInTransaction({
2680
+ updateNotificationBoxRecipientExclusionInTransaction({
2679
2681
  params: params,
2680
- throwErrorIfNotificationBoxDoesNotExist: true,
2681
2682
  notificationBoxDocument: notificationBoxDocument
2682
2683
  }, transaction)
2683
2684
  ];
@@ -3015,11 +3016,11 @@ var NOTIFICATION_TASK_TYPE_FAILURE_DELAY_MS = hoursToMilliseconds(NOTIFICATION_T
3015
3016
  case 0:
3016
3017
  if (!(notification != null)) return [
3017
3018
  3,
3018
- 48
3019
+ 42
3019
3020
  ];
3020
3021
  if (!(tryRun && templateInstance != null)) return [
3021
3022
  3,
3022
- 47
3023
+ 41
3023
3024
  ];
3024
3025
  return [
3025
3026
  4,
@@ -3040,7 +3041,7 @@ var NOTIFICATION_TASK_TYPE_FAILURE_DELAY_MS = hoursToMilliseconds(NOTIFICATION_T
3040
3041
  messageFunction = _state.sent();
3041
3042
  if (!messageFunction) return [
3042
3043
  3,
3043
- 46
3044
+ 40
3044
3045
  ];
3045
3046
  filterOutNoContentNotificationMessages = function filterOutNoContentNotificationMessages(messages) {
3046
3047
  return messages.filter(function(x) {
@@ -3067,7 +3068,7 @@ var NOTIFICATION_TASK_TYPE_FAILURE_DELAY_MS = hoursToMilliseconds(NOTIFICATION_T
3067
3068
  currentEsr = notification.esr, currentTsr = notification.tsr;
3068
3069
  if (!(es === NotificationSendState.QUEUED || es === NotificationSendState.SENT_PARTIAL)) return [
3069
3070
  3,
3070
- 15
3071
+ 13
3071
3072
  ];
3072
3073
  emailRecipientsAlreadySentTo = new Set(currentEsr.map(function(x) {
3073
3074
  return x.toLowerCase();
@@ -3096,13 +3097,18 @@ var NOTIFICATION_TASK_TYPE_FAILURE_DELAY_MS = hoursToMilliseconds(NOTIFICATION_T
3096
3097
  emailMessages = _state.sent();
3097
3098
  if (!(emailMessages === null || emailMessages === void 0 ? void 0 : emailMessages.length)) return [
3098
3099
  3,
3099
- 14
3100
+ 12
3100
3101
  ];
3101
- if (!(notificationSendService.emailSendService != null)) return [
3102
+ if (!(notificationSendService.emailSendService == null)) return [
3102
3103
  3,
3103
- 12
3104
+ 4
3105
+ ];
3106
+ console.error('Failed sending email notification "'.concat(notification.id, '" with type "').concat(notificationTemplateType, '" due to no email service being configured.'));
3107
+ es = NotificationSendState.CONFIG_ERROR;
3108
+ return [
3109
+ 3,
3110
+ 11
3104
3111
  ];
3105
- _state.label = 4;
3106
3112
  case 4:
3107
3113
  _state.trys.push([
3108
3114
  4,
@@ -3160,15 +3166,6 @@ var NOTIFICATION_TASK_TYPE_FAILURE_DELAY_MS = hoursToMilliseconds(NOTIFICATION_T
3160
3166
  11
3161
3167
  ];
3162
3168
  case 11:
3163
- return [
3164
- 3,
3165
- 13
3166
- ];
3167
- case 12:
3168
- console.error('Failed sending email notification "'.concat(notification.id, '" with type "').concat(notificationTemplateType, '" due to no email service being configured.'));
3169
- es = NotificationSendState.CONFIG_ERROR;
3170
- _state.label = 13;
3171
- case 13:
3172
3169
  if (sendEmailsResult != null) {
3173
3170
  success1 = sendEmailsResult.success, failed = sendEmailsResult.failed;
3174
3171
  esr = success1.length ? _to_consumable_array$6(currentEsr).concat(_to_consumable_array$6(success1.map(function(x) {
@@ -3182,15 +3179,15 @@ var NOTIFICATION_TASK_TYPE_FAILURE_DELAY_MS = hoursToMilliseconds(NOTIFICATION_T
3182
3179
  }
3183
3180
  return [
3184
3181
  3,
3185
- 15
3182
+ 13
3186
3183
  ];
3187
- case 14:
3184
+ case 12:
3188
3185
  es = NotificationSendState.SENT;
3189
- _state.label = 15;
3190
- case 15:
3186
+ _state.label = 13;
3187
+ case 13:
3191
3188
  if (!(ts === NotificationSendState.QUEUED || ts === NotificationSendState.SENT_PARTIAL)) return [
3192
3189
  3,
3193
- 28
3190
+ 24
3194
3191
  ];
3195
3192
  textRecipientsAlreadySentTo = new Set(currentTsr);
3196
3193
  textInputContexts = textRecipients.filter(function(x) {
@@ -3213,83 +3210,79 @@ var NOTIFICATION_TASK_TYPE_FAILURE_DELAY_MS = hoursToMilliseconds(NOTIFICATION_T
3213
3210
  return undefined;
3214
3211
  })
3215
3212
  ];
3216
- case 16:
3213
+ case 14:
3217
3214
  textMessages = _state.sent();
3218
3215
  if (!(textMessages === null || textMessages === void 0 ? void 0 : textMessages.length)) return [
3219
3216
  3,
3220
- 27
3217
+ 23
3221
3218
  ];
3222
- if (!(notificationSendService.textSendService != null)) return [
3219
+ if (!(notificationSendService.textSendService == null)) return [
3223
3220
  3,
3224
- 25
3221
+ 15
3225
3222
  ];
3226
- _state.label = 17;
3227
- case 17:
3223
+ console.error('Failed sending text notification "'.concat(notification.id, '" with type "').concat(notificationTemplateType, '" due to no text service being configured.'));
3224
+ ts = NotificationSendState.CONFIG_ERROR;
3225
+ return [
3226
+ 3,
3227
+ 22
3228
+ ];
3229
+ case 15:
3228
3230
  _state.trys.push([
3231
+ 15,
3229
3232
  17,
3230
- 19,
3231
3233
  ,
3232
- 20
3234
+ 18
3233
3235
  ]);
3234
3236
  return [
3235
3237
  4,
3236
3238
  notificationSendService.textSendService.buildSendInstanceForTextNotificationMessages(textMessages)
3237
3239
  ];
3238
- case 18:
3240
+ case 16:
3239
3241
  sendInstance1 = _state.sent();
3240
3242
  return [
3241
3243
  3,
3242
- 20
3244
+ 18
3243
3245
  ];
3244
- case 19:
3246
+ case 17:
3245
3247
  e2 = _state.sent();
3246
3248
  console.error('Failed building text send instance for notification "'.concat(notification.id, '" with type "').concat(notificationTemplateType, '": '), e2);
3247
3249
  ts = NotificationSendState.CONFIG_ERROR;
3248
3250
  return [
3249
3251
  3,
3250
- 20
3252
+ 18
3251
3253
  ];
3252
- case 20:
3254
+ case 18:
3253
3255
  if (!sendInstance1) return [
3254
3256
  3,
3255
- 24
3257
+ 22
3256
3258
  ];
3257
- _state.label = 21;
3258
- case 21:
3259
+ _state.label = 19;
3260
+ case 19:
3259
3261
  _state.trys.push([
3262
+ 19,
3260
3263
  21,
3261
- 23,
3262
3264
  ,
3263
- 24
3265
+ 22
3264
3266
  ]);
3265
3267
  return [
3266
3268
  4,
3267
3269
  sendInstance1()
3268
3270
  ];
3269
- case 22:
3271
+ case 20:
3270
3272
  sendTextsResult = _state.sent();
3271
3273
  return [
3272
3274
  3,
3273
- 24
3275
+ 22
3274
3276
  ];
3275
- case 23:
3277
+ case 21:
3276
3278
  e3 = _state.sent();
3277
3279
  console.error('Failed sending text notification "'.concat(notification.id, '" with type "').concat(notificationTemplateType, '": '), e3);
3278
3280
  ts = NotificationSendState.SEND_ERROR;
3279
3281
  return [
3280
3282
  3,
3281
- 24
3282
- ];
3283
- case 24:
3284
- return [
3285
- 3,
3286
- 26
3283
+ 22
3287
3284
  ];
3288
- case 25:
3289
- console.error('Failed sending text notification "'.concat(notification.id, '" with type "').concat(notificationTemplateType, '" due to no text service being configured.'));
3290
- ts = NotificationSendState.CONFIG_ERROR;
3291
- _state.label = 26;
3292
- case 26:
3285
+ case 22:
3293
3286
  if (sendTextsResult != null) {
3294
3287
  success2 = sendTextsResult.success, failed1 = sendTextsResult.failed;
3295
3288
  tsr = success2.length ? _to_consumable_array$6(currentTsr).concat(_to_consumable_array$6(success2)) : undefined;
@@ -3301,16 +3294,16 @@ var NOTIFICATION_TASK_TYPE_FAILURE_DELAY_MS = hoursToMilliseconds(NOTIFICATION_T
3301
3294
  }
3302
3295
  return [
3303
3296
  3,
3304
- 28
3297
+ 24
3305
3298
  ];
3306
- case 27:
3299
+ case 23:
3307
3300
  ts = NotificationSendState.SENT;
3308
- _state.label = 28;
3309
- case 28:
3301
+ _state.label = 24;
3302
+ case 24:
3310
3303
  ps = NotificationSendState.NO_TRY;
3311
3304
  if (!(ns === NotificationSendState.QUEUED || ns === NotificationSendState.SENT_PARTIAL)) return [
3312
3305
  3,
3313
- 41
3306
+ 35
3314
3307
  ];
3315
3308
  notificationSummaryInputContexts = notificationSummaryRecipients.map(function(x) {
3316
3309
  var _$context = {
@@ -3329,92 +3322,88 @@ var NOTIFICATION_TASK_TYPE_FAILURE_DELAY_MS = hoursToMilliseconds(NOTIFICATION_T
3329
3322
  return undefined;
3330
3323
  })
3331
3324
  ];
3332
- case 29:
3325
+ case 25:
3333
3326
  notificationSummaryMessages = _state.sent();
3334
3327
  if (!(notificationSummaryMessages === null || notificationSummaryMessages === void 0 ? void 0 : notificationSummaryMessages.length)) return [
3335
3328
  3,
3336
- 40
3329
+ 34
3337
3330
  ];
3338
- if (!(notificationSendService.notificationSummarySendService != null)) return [
3331
+ if (!(notificationSendService.notificationSummarySendService == null)) return [
3339
3332
  3,
3340
- 38
3333
+ 26
3341
3334
  ];
3342
- _state.label = 30;
3343
- case 30:
3335
+ console.error('Failed sending notification summary notification "'.concat(notification.id, '" with type "').concat(notificationTemplateType, '" due to no notification summary service being configured.'));
3336
+ ns = NotificationSendState.CONFIG_ERROR;
3337
+ return [
3338
+ 3,
3339
+ 33
3340
+ ];
3341
+ case 26:
3344
3342
  _state.trys.push([
3345
- 30,
3346
- 32,
3343
+ 26,
3344
+ 28,
3347
3345
  ,
3348
- 33
3346
+ 29
3349
3347
  ]);
3350
3348
  return [
3351
3349
  4,
3352
3350
  notificationSendService.notificationSummarySendService.buildSendInstanceForNotificationSummaryMessages(notificationSummaryMessages)
3353
3351
  ];
3354
- case 31:
3352
+ case 27:
3355
3353
  sendInstance2 = _state.sent();
3356
3354
  return [
3357
3355
  3,
3358
- 33
3356
+ 29
3359
3357
  ];
3360
- case 32:
3358
+ case 28:
3361
3359
  e4 = _state.sent();
3362
3360
  console.error('Failed building notification summary send instance for notification "'.concat(notification.id, '" with type "').concat(notificationTemplateType, '": '), e4);
3363
3361
  ns = NotificationSendState.CONFIG_ERROR;
3364
3362
  return [
3365
3363
  3,
3366
- 33
3364
+ 29
3367
3365
  ];
3368
- case 33:
3366
+ case 29:
3369
3367
  if (!sendInstance2) return [
3370
3368
  3,
3371
- 37
3369
+ 33
3372
3370
  ];
3373
- _state.label = 34;
3374
- case 34:
3371
+ _state.label = 30;
3372
+ case 30:
3375
3373
  _state.trys.push([
3376
- 34,
3377
- 36,
3374
+ 30,
3375
+ 32,
3378
3376
  ,
3379
- 37
3377
+ 33
3380
3378
  ]);
3381
3379
  return [
3382
3380
  4,
3383
3381
  sendInstance2()
3384
3382
  ];
3385
- case 35:
3383
+ case 31:
3386
3384
  sendNotificationSummaryResult = _state.sent();
3387
3385
  ns = NotificationSendState.SENT;
3388
3386
  return [
3389
3387
  3,
3390
- 37
3388
+ 33
3391
3389
  ];
3392
- case 36:
3390
+ case 32:
3393
3391
  e5 = _state.sent();
3394
3392
  console.error('Failed sending notification summary notification "'.concat(notification.id, '" with type "').concat(notificationTemplateType, '": '), e5);
3395
3393
  ns = NotificationSendState.SEND_ERROR;
3396
3394
  return [
3397
3395
  3,
3398
- 37
3399
- ];
3400
- case 37:
3401
- return [
3402
- 3,
3403
- 39
3396
+ 33
3404
3397
  ];
3405
- case 38:
3406
- console.error('Failed sending notification summary notification "'.concat(notification.id, '" with type "').concat(notificationTemplateType, '" due to no notification summary service being configured.'));
3407
- ns = NotificationSendState.CONFIG_ERROR;
3408
- _state.label = 39;
3409
- case 39:
3398
+ case 33:
3410
3399
  return [
3411
3400
  3,
3412
- 41
3401
+ 35
3413
3402
  ];
3414
- case 40:
3403
+ case 34:
3415
3404
  ns = NotificationSendState.SENT;
3416
- _state.label = 41;
3417
- case 41:
3405
+ _state.label = 35;
3406
+ case 35:
3418
3407
  // calculate results
3419
3408
  notificationTemplate = {
3420
3409
  es: es,
@@ -3437,7 +3426,7 @@ var NOTIFICATION_TASK_TYPE_FAILURE_DELAY_MS = hoursToMilliseconds(NOTIFICATION_T
3437
3426
  4,
3438
3427
  notificationDocument.update(notificationTemplate)
3439
3428
  ];
3440
- case 42:
3429
+ case 36:
3441
3430
  _state.sent();
3442
3431
  notificationMarkedDone = notificationTemplate.d === true;
3443
3432
  callbackDetails = {
@@ -3450,7 +3439,7 @@ var NOTIFICATION_TASK_TYPE_FAILURE_DELAY_MS = hoursToMilliseconds(NOTIFICATION_T
3450
3439
  onSendAttempted = messageFunction.onSendAttempted, onSendSuccess = messageFunction.onSendSuccess;
3451
3440
  if (!onSendAttempted) return [
3452
3441
  3,
3453
- 44
3442
+ 38
3454
3443
  ];
3455
3444
  return [
3456
3445
  4,
@@ -3465,13 +3454,13 @@ var NOTIFICATION_TASK_TYPE_FAILURE_DELAY_MS = hoursToMilliseconds(NOTIFICATION_T
3465
3454
  };
3466
3455
  })
3467
3456
  ];
3468
- case 43:
3457
+ case 37:
3469
3458
  onSendAttemptedResult = _state.sent();
3470
- _state.label = 44;
3471
- case 44:
3459
+ _state.label = 38;
3460
+ case 38:
3472
3461
  if (!(notificationMarkedDone && onSendSuccess)) return [
3473
3462
  3,
3474
- 46
3463
+ 40
3475
3464
  ];
3476
3465
  return [
3477
3466
  4,
@@ -3486,15 +3475,15 @@ var NOTIFICATION_TASK_TYPE_FAILURE_DELAY_MS = hoursToMilliseconds(NOTIFICATION_T
3486
3475
  };
3487
3476
  })
3488
3477
  ];
3489
- case 45:
3478
+ case 39:
3490
3479
  onSendSuccessResult = _state.sent();
3491
- _state.label = 46;
3492
- case 46:
3480
+ _state.label = 40;
3481
+ case 40:
3493
3482
  return [
3494
3483
  3,
3495
- 48
3484
+ 42
3496
3485
  ];
3497
- case 47:
3486
+ case 41:
3498
3487
  switch(notification.st){
3499
3488
  case NotificationSendType.SEND_IF_BOX_EXISTS:
3500
3489
  // deleted successfully
@@ -3506,8 +3495,8 @@ var NOTIFICATION_TASK_TYPE_FAILURE_DELAY_MS = hoursToMilliseconds(NOTIFICATION_T
3506
3495
  case NotificationSendType.LOGGED_EVENT:
3507
3496
  break;
3508
3497
  }
3509
- _state.label = 48;
3510
- case 48:
3498
+ _state.label = 42;
3499
+ case 42:
3511
3500
  return [
3512
3501
  2
3513
3502
  ];
@@ -4258,15 +4247,14 @@ var NOTIFICATION_TASK_TYPE_FAILURE_DELAY_MS = hoursToMilliseconds(NOTIFICATION_T
4258
4247
  return shouldSaveToNotificationWeek ? data.n : undefined;
4259
4248
  }));
4260
4249
  n = _to_consumable_array$6((_ref = notificationWeek === null || notificationWeek === void 0 ? void 0 : notificationWeek.n) !== null && _ref !== void 0 ? _ref : []).concat(_to_consumable_array$6(newItems));
4261
- if (!!notificationWeek) return [
4250
+ if (!notificationWeek) return [
4262
4251
  3,
4263
4252
  3
4264
4253
  ];
4265
- // create
4254
+ // update
4266
4255
  return [
4267
4256
  4,
4268
- notificationWeekDocument.create({
4269
- w: yearWeekCode,
4257
+ notificationWeekDocument.update({
4270
4258
  n: n
4271
4259
  })
4272
4260
  ];
@@ -4277,10 +4265,11 @@ var NOTIFICATION_TASK_TYPE_FAILURE_DELAY_MS = hoursToMilliseconds(NOTIFICATION_T
4277
4265
  5
4278
4266
  ];
4279
4267
  case 3:
4280
- // update
4268
+ // create
4281
4269
  return [
4282
4270
  4,
4283
- notificationWeekDocument.update({
4271
+ notificationWeekDocument.create({
4272
+ w: yearWeekCode,
4284
4273
  n: n
4285
4274
  })
4286
4275
  ];
@@ -10345,46 +10334,49 @@ function _resolveSignedUploadUrlFilenameOrThrow(policy, filename) {
10345
10334
  case StorageFileProcessingState.FAILED:
10346
10335
  return [
10347
10336
  3,
10348
- 20
10337
+ 21
10349
10338
  ];
10350
10339
  case StorageFileProcessingState.DO_NOT_PROCESS:
10351
10340
  return [
10352
10341
  3,
10353
- 22
10342
+ 23
10354
10343
  ];
10355
10344
  case StorageFileProcessingState.SUCCESS:
10356
10345
  return [
10357
10346
  3,
10358
- 23
10347
+ 24
10359
10348
  ];
10360
10349
  case StorageFileProcessingState.ARCHIVED:
10361
10350
  return [
10362
10351
  3,
10363
- 27
10352
+ 28
10364
10353
  ];
10365
10354
  }
10366
10355
  return [
10367
10356
  3,
10368
- 28
10357
+ 29
10369
10358
  ];
10370
10359
  case 4:
10371
- if (!!storageFile.p) return [
10360
+ if (!storageFile.p) return [
10372
10361
  3,
10373
- 5
10362
+ 6
10374
10363
  ];
10375
- throw storageFileProcessingNotAvailableForTypeError();
10376
- case 5:
10377
10364
  return [
10378
10365
  4,
10379
10366
  beginProcessing(false)
10380
10367
  ];
10381
- case 6:
10368
+ case 5:
10382
10369
  _state.sent();
10383
- _state.label = 7;
10370
+ return [
10371
+ 3,
10372
+ 7
10373
+ ];
10374
+ case 6:
10375
+ throw storageFileProcessingNotAvailableForTypeError();
10384
10376
  case 7:
10385
10377
  return [
10386
10378
  3,
10387
- 28
10379
+ 29
10388
10380
  ];
10389
10381
  case 8:
10390
10382
  // begin processing
@@ -10396,121 +10388,123 @@ function _resolveSignedUploadUrlFilenameOrThrow(policy, filename) {
10396
10388
  _state.sent();
10397
10389
  return [
10398
10390
  3,
10399
- 28
10391
+ 29
10400
10392
  ];
10401
10393
  case 10:
10402
10394
  // check if the processing task is still running
10403
10395
  shouldCheckProcessing = !isThrottled(STORAGE_FILE_PROCESSING_STUCK_THROTTLE_CHECK_MS, storageFile.pat);
10404
- if (!!storageFile.pn) return [
10405
- 3,
10406
- 12
10407
- ];
10408
- return [
10409
- 4,
10410
- beginProcessing(true)
10411
- ];
10412
- case 11:
10413
- _state.sent(); // if no processing task is set, restart processing to recover from the broken state
10414
- return [
10396
+ if (!storageFile.pn) return [
10415
10397
  3,
10416
- 19
10398
+ 18
10417
10399
  ];
10418
- case 12:
10419
10400
  pn = storageFile.pn;
10420
10401
  notificationDocument = notificationCollectionGroup.documentAccessorForTransaction(transaction).loadDocumentForKey(pn);
10421
10402
  if (!(checkRetryProcessing || shouldCheckProcessing)) return [
10422
10403
  3,
10423
- 18
10404
+ 16
10424
10405
  ];
10425
10406
  return [
10426
10407
  4,
10427
10408
  notificationDocument.snapshotData()
10428
10409
  ];
10429
- case 13:
10410
+ case 11:
10430
10411
  notification = _state.sent();
10431
10412
  if (!!notification) return [
10432
10413
  3,
10433
- 15
10414
+ 13
10434
10415
  ];
10435
10416
  // the notification document is missing. Re-begin processing
10436
10417
  return [
10437
10418
  4,
10438
10419
  beginProcessing(true)
10439
10420
  ];
10440
- case 14:
10421
+ case 12:
10441
10422
  _state.sent();
10442
10423
  return [
10443
10424
  3,
10444
- 17
10425
+ 15
10445
10426
  ];
10446
- case 15:
10427
+ case 13:
10447
10428
  if (!(notification.d || forceRestartProcessing)) return [
10448
10429
  3,
10449
- 17
10430
+ 15
10450
10431
  ];
10451
10432
  // if the notification is somehow in the done state but the StorageFile never got notified in the same transaction, requeue.
10452
10433
  return [
10453
10434
  4,
10454
10435
  beginProcessing(true)
10455
10436
  ];
10456
- case 16:
10437
+ case 14:
10457
10438
  _state.sent();
10458
- _state.label = 17;
10459
- case 17:
10439
+ _state.label = 15;
10440
+ case 15:
10460
10441
  return [
10461
10442
  3,
10462
- 19
10443
+ 17
10463
10444
  ];
10464
- case 18:
10445
+ case 16:
10465
10446
  if (expediteInstance) {
10466
10447
  // enqueue the existing notification to be run in the expedite instance
10467
10448
  expediteInstance.enqueue(notificationDocument);
10468
10449
  }
10469
- _state.label = 19;
10470
- case 19:
10450
+ _state.label = 17;
10451
+ case 17:
10471
10452
  return [
10472
10453
  3,
10473
- 28
10454
+ 20
10474
10455
  ];
10456
+ case 18:
10457
+ return [
10458
+ 4,
10459
+ beginProcessing(true)
10460
+ ];
10461
+ case 19:
10462
+ _state.sent(); // if no processing task is set, restart processing to recover from the broken state
10463
+ _state.label = 20;
10475
10464
  case 20:
10465
+ return [
10466
+ 3,
10467
+ 29
10468
+ ];
10469
+ case 21:
10476
10470
  // restart processing on failure
10477
10471
  return [
10478
10472
  4,
10479
10473
  beginProcessing(true)
10480
10474
  ];
10481
- case 21:
10475
+ case 22:
10482
10476
  _state.sent();
10483
10477
  return [
10484
10478
  3,
10485
- 28
10479
+ 29
10486
10480
  ];
10487
- case 22:
10488
- throw storageFileProcessingNotQueuedForProcessingError();
10489
10481
  case 23:
10482
+ throw storageFileProcessingNotQueuedForProcessingError();
10483
+ case 24:
10490
10484
  if (!(forceRestartProcessing || processAgainIfSuccessful)) return [
10491
10485
  3,
10492
- 25
10486
+ 26
10493
10487
  ];
10494
10488
  return [
10495
10489
  4,
10496
10490
  beginProcessing(true)
10497
10491
  ];
10498
- case 24:
10492
+ case 25:
10499
10493
  _state.sent();
10500
10494
  return [
10501
10495
  3,
10502
- 26
10496
+ 27
10503
10497
  ];
10504
- case 25:
10505
- throw storageFileAlreadyProcessedError();
10506
10498
  case 26:
10499
+ throw storageFileAlreadyProcessedError();
10500
+ case 27:
10507
10501
  return [
10508
10502
  3,
10509
- 28
10503
+ 29
10510
10504
  ];
10511
- case 27:
10512
- throw storageFileProcessingNotQueuedForProcessingError();
10513
10505
  case 28:
10506
+ throw storageFileProcessingNotQueuedForProcessingError();
10507
+ case 29:
10514
10508
  return [
10515
10509
  2
10516
10510
  ];
@@ -11404,7 +11398,7 @@ function _resolveSignedUploadUrlFilenameOrThrow(policy, filename) {
11404
11398
  existsInStorageFileGroup = storageFileGroup === null || storageFileGroup === void 0 ? void 0 : storageFileGroup.f.some(function(x) {
11405
11399
  return x.s === storageFileDocument.id;
11406
11400
  });
11407
- change = removeAllStorageFileGroups ? existsInStorageFileGroup ? 'remove' : undefined : !existsInStorageFileGroup ? 'add' : undefined;
11401
+ change = removeAllStorageFileGroups ? existsInStorageFileGroup ? 'remove' : undefined : existsInStorageFileGroup ? undefined : 'add';
11408
11402
  switch(change){
11409
11403
  case 'add':
11410
11404
  return [
@@ -11439,34 +11433,34 @@ function _resolveSignedUploadUrlFilenameOrThrow(policy, filename) {
11439
11433
  ],
11440
11434
  allowRecalculateRegenerateFlag: false
11441
11435
  });
11442
- if (!!storageFileGroup) return [
11436
+ if (!storageFileGroup) return [
11443
11437
  3,
11444
11438
  3
11445
11439
  ];
11446
- // if the group does not exist, then create it
11440
+ // if the group exists, then update it
11447
11441
  return [
11448
11442
  4,
11449
- createStorageFileGroupInTransaction({
11450
- storageFileGroupDocument: storageFileGroupDocument,
11451
- template: createTemplate
11452
- }, transaction)
11443
+ storageFileGroupDocument.update(createTemplate)
11453
11444
  ];
11454
11445
  case 2:
11455
11446
  _state.sent();
11456
- storageFilesGroupsCreated += 1;
11447
+ storageFilesGroupsUpdated += 1;
11457
11448
  return [
11458
11449
  3,
11459
11450
  5
11460
11451
  ];
11461
11452
  case 3:
11462
- // if the group exists, then update it
11453
+ // if the group does not exist, then create it
11463
11454
  return [
11464
11455
  4,
11465
- storageFileGroupDocument.update(createTemplate)
11456
+ createStorageFileGroupInTransaction({
11457
+ storageFileGroupDocument: storageFileGroupDocument,
11458
+ template: createTemplate
11459
+ }, transaction)
11466
11460
  ];
11467
11461
  case 4:
11468
11462
  _state.sent();
11469
- storageFilesGroupsUpdated += 1;
11463
+ storageFilesGroupsCreated += 1;
11470
11464
  _state.label = 5;
11471
11465
  case 5:
11472
11466
  return [
@@ -11772,10 +11766,28 @@ function _resolveSignedUploadUrlFilenameOrThrow(policy, filename) {
11772
11766
  3,
11773
11767
  7
11774
11768
  ];
11775
- if (!!(existingZipStorageFilePair === null || existingZipStorageFilePair === void 0 ? void 0 : existingZipStorageFilePair.data)) return [
11769
+ if (!(existingZipStorageFilePair === null || existingZipStorageFilePair === void 0 ? void 0 : existingZipStorageFilePair.data)) return [
11776
11770
  3,
11777
11771
  4
11778
11772
  ];
11773
+ // flag it for processing again
11774
+ return [
11775
+ 4,
11776
+ processStorageFileInTransaction({
11777
+ params: {
11778
+ processAgainIfSuccessful: true
11779
+ },
11780
+ storageFileDocument: existingZipStorageFilePair.document,
11781
+ storageFile: existingZipStorageFilePair.data
11782
+ }, transaction)
11783
+ ];
11784
+ case 3:
11785
+ _state.sent();
11786
+ return [
11787
+ 3,
11788
+ 6
11789
+ ];
11790
+ case 4:
11779
11791
  zipStorageFile = storageService.file(storageFileGroupZipFileStoragePath(storageFileGroupDocument.id));
11780
11792
  return [
11781
11793
  4,
@@ -11791,27 +11803,9 @@ function _resolveSignedUploadUrlFilenameOrThrow(policy, filename) {
11791
11803
  }
11792
11804
  })
11793
11805
  ];
11794
- case 3:
11806
+ case 5:
11795
11807
  storageFileDocument = _state.sent().storageFileDocument;
11796
11808
  updateTemplate.zsf = storageFileDocument.id;
11797
- return [
11798
- 3,
11799
- 6
11800
- ];
11801
- case 4:
11802
- // flag it for processing again
11803
- return [
11804
- 4,
11805
- processStorageFileInTransaction({
11806
- params: {
11807
- processAgainIfSuccessful: true
11808
- },
11809
- storageFileDocument: existingZipStorageFilePair.document,
11810
- storageFile: existingZipStorageFilePair.data
11811
- }, transaction)
11812
- ];
11813
- case 5:
11814
- _state.sent();
11815
11809
  _state.label = 6;
11816
11810
  case 6:
11817
11811
  contentStorageFilesFlaggedForProcessing += 1;