@dereekb/firebase-server 13.0.7 → 13.2.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, makeValuesGroupMap, performAsyncTasks, separateValues, filterMaybeArrayValues, takeFront, makeModelMap, removeValuesAtIndexesFromArrayCopy, areEqualPOJOValues, asPromise, mapIdentityFunction, computeNextFreeIndexOnSortedValuesFunction, readIndexNumber, filterOnlyUndefinedValues, iterablesAreSetEquivalent, dateOrMillisecondsToDate, cutStringFunction, takeLast, unique, isThrottled, isPast, expirationDetails, unixDateTimeSecondsNumberFromDate, slashPathDetails, mergeSlashPaths, ModelRelationUtility, MS_IN_MINUTE, dateFromDateOrTimeMillisecondsNumber, cachedGetter, ZIP_FILE_MIME_TYPE, documentFileExtensionForMimeType, useCallback, MS_IN_HOUR, MAP_IDENTITY, pushItemOrArrayItemsIntoArray, asDecisionFunction } from '@dereekb/util';
2
2
  import { yearWeekCode, findMaxDate, isSameDate, 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, DEFAULT_NOTIFICATION_TEMPLATE_TYPE, NotificationRecipientSendFlag, allowedNotificationRecipients, effectiveNotificationBoxRecipientTemplateConfig, loadDocumentsForIds, getDocumentSnapshotDataPairsWithData, notificationSendExclusionCanSendFunction, mergeNotificationUserDefaultNotificationBoxRecipientConfig, mergeNotificationBoxRecipientTemplateConfigs, firestoreDummyKey, mergeNotificationBoxRecipients, mergeNotificationUserNotificationBoxRecipientConfigs, applyExclusionsToNotificationUserNotificationBoxRecipientConfigs, CleanupSentNotificationsParams, notificationsReadyForCleanupQuery, getDocumentSnapshotDataPairs, NotificationSendType, loadDocumentsForDocumentReferencesFromValues, shouldSaveNotificationToNotificationWeek, CreateNotificationBoxParams, loadNotificationBoxDocumentForReferencePair, CreateNotificationSummaryParams, notificationSummaryIdForModel, CreateNotificationUserParams, iterateFirestoreDocumentSnapshotPairs, notificationUsersFlaggedForNeedsSyncQuery, ResyncNotificationUserParams, effectiveNotificationBoxRecipientConfig, SendNotificationParams, getDocumentSnapshotData, inferKeyFromTwoWayFlatFirestoreModelKey, setIdAndKeyFromKeyIdRefOnDocumentData, NotificationSendState, notificationSendFlagsImplyIsComplete, SendQueuedNotificationsParams, mergeNotificationSendMessagesResult, UpdateNotificationBoxParams, updateNotificationUserNotificationSendExclusions, UpdateNotificationBoxRecipientParams, notificationBoxRecipientTemplateConfigArrayToRecord, updateNotificationRecipient, UpdateNotificationSummaryParams, UpdateNotificationUserParams, updateNotificationUserDefaultNotificationBoxRecipientConfig, updateNotificationUserNotificationBoxRecipientConfigs, calculateNsForNotificationUserNotificationBoxRecipientConfigs, notificationsPastSendAtTimeQuery, InitializeAllApplicableNotificationBoxesParams, InitializeAllApplicableNotificationSummariesParams, InitializeNotificationModelParams, firestoreModelKeyCollectionName, notificationBoxesFlaggedForNeedsInitializationQuery, notificationSummariesFlaggedForNeedsInitializationQuery, noContentNotificationMessageFunctionFactory, createNotificationDocumentPair, _createNotificationDocumentFromPair, NOTIFICATION_SUMMARY_EMBEDDED_NOTIFICATION_ITEM_SUBJECT_MAX_LENGTH, NOTIFICATION_SUMMARY_EMBEDDED_NOTIFICATION_ITEM_MESSAGE_MAX_LENGTH, sortNotificationItemsFunction, NOTIFICATION_SUMMARY_ITEM_LIMIT, delayCompletion, completeSubtaskProcessingAndScheduleCleanupTaskResult, NOTIFICATION_TASK_SUBTASK_CHECKPOINT_PROCESSING, NOTIFICATION_TASK_SUBTASK_CHECKPOINT_CLEANUP, notificationTaskComplete, DEFAULT_NOTIFICATION_TASK_SUBTASK_CLEANUP_RETRY_ATTEMPTS, notificationTaskDelayRetry, DEFAULT_NOTIFICATION_TASK_SUBTASK_CLEANUP_RETRY_DELAY, 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, StorageFileProcessingState, STORAGE_FILE_PROCESSING_STUCK_THROTTLE_CHECK_MS, calculateStorageFileGroupEmbeddedFileUpdate, CreateStorageFileParams, CreateStorageFileGroupParams, loadStorageFileGroupDocumentForReferencePair, DeleteAllQueuedStorageFilesParams, storageFilesQueuedForDeleteQuery, DeleteStorageFileParams, DownloadStorageFileParams, InitializeAllStorageFilesFromUploadsParams, UPLOADS_FOLDER_PATH, iterateStorageListFilesByEachFile, InitializeStorageFileFromUploadParams, ProcessAllQueuedStorageFilesParams, storageFilesQueuedForProcessingQuery, ProcessStorageFileParams, RegenerateAllFlaggedStorageFileGroupsContentParams, storageFileGroupsFlaggedForContentRegenerationQuery, RegenerateStorageFileGroupContentParams, createStorageFileDocumentPairFactory, StorageFileCreationType, getDocumentSnapshotDataPair, calculateStorageFileGroupRegeneration, storageFileGroupZipFileStoragePath, STORAGE_FILE_GROUP_ZIP_STORAGE_FILE_PURPOSE, SyncAllFlaggedStorageFilesWithGroupsParams, iterateFirestoreDocumentSnapshotPairBatches, storageFileFlaggedForSyncWithGroupsQuery, SyncStorageFileWithGroupsParams, UpdateStorageFileParams, UpdateStorageFileGroupParams, StorageFileState, createNotificationDocument, storageFileProcessingNotificationTaskTemplate, InitializeAllApplicableStorageFileGroupsParams, InitializeStorageFileModelParams, storageFileGroupsFlaggedForNeedsInitializationQuery, STORAGE_FILE_GROUP_ZIP_STORAGE_FILE_PURPOSE_CREATE_ZIP_SUBTASK, storedFileReaderFactory, STORAGE_FILE_PROCESSING_NOTIFICATION_TASK_TYPE, copyStoragePath, STORAGE_FILE_GROUP_ZIP_INFO_JSON_FILE_NAME, notificationSubtaskComplete, 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, DEFAULT_NOTIFICATION_TEMPLATE_TYPE, NotificationRecipientSendFlag, allowedNotificationRecipients, effectiveNotificationBoxRecipientTemplateConfig, loadDocumentsForIds, getDocumentSnapshotDataPairsWithData, notificationSendExclusionCanSendFunction, mergeNotificationUserDefaultNotificationBoxRecipientConfig, mergeNotificationBoxRecipientTemplateConfigs, firestoreDummyKey, mergeNotificationBoxRecipients, mergeNotificationUserNotificationBoxRecipientConfigs, applyExclusionsToNotificationUserNotificationBoxRecipientConfigs, cleanupSentNotificationsParamsType, notificationsReadyForCleanupQuery, getDocumentSnapshotDataPairs, NotificationSendType, loadDocumentsForDocumentReferencesFromValues, shouldSaveNotificationToNotificationWeek, createNotificationBoxParamsType, loadNotificationBoxDocumentForReferencePair, createNotificationSummaryParamsType, notificationSummaryIdForModel, createNotificationUserParamsType, iterateFirestoreDocumentSnapshotPairs, notificationUsersFlaggedForNeedsSyncQuery, resyncNotificationUserParamsType, effectiveNotificationBoxRecipientConfig, sendNotificationParamsType, getDocumentSnapshotData, inferKeyFromTwoWayFlatFirestoreModelKey, setIdAndKeyFromKeyIdRefOnDocumentData, NotificationSendState, notificationSendFlagsImplyIsComplete, sendQueuedNotificationsParamsType, mergeNotificationSendMessagesResult, updateNotificationBoxParamsType, updateNotificationUserNotificationSendExclusions, updateNotificationBoxRecipientParamsType, notificationBoxRecipientTemplateConfigArrayToRecord, updateNotificationRecipient, updateNotificationSummaryParamsType, updateNotificationUserParamsType, updateNotificationUserDefaultNotificationBoxRecipientConfig, updateNotificationUserNotificationBoxRecipientConfigs, calculateNsForNotificationUserNotificationBoxRecipientConfigs, notificationsPastSendAtTimeQuery, initializeAllApplicableNotificationBoxesParamsType, initializeAllApplicableNotificationSummariesParamsType, initializeNotificationModelParamsType, firestoreModelKeyCollectionName, notificationBoxesFlaggedForNeedsInitializationQuery, notificationSummariesFlaggedForNeedsInitializationQuery, noContentNotificationMessageFunctionFactory, createNotificationDocumentPair, _createNotificationDocumentFromPair, NOTIFICATION_SUMMARY_EMBEDDED_NOTIFICATION_ITEM_SUBJECT_MAX_LENGTH, NOTIFICATION_SUMMARY_EMBEDDED_NOTIFICATION_ITEM_MESSAGE_MAX_LENGTH, sortNotificationItemsFunction, NOTIFICATION_SUMMARY_ITEM_LIMIT, delayCompletion, completeSubtaskProcessingAndScheduleCleanupTaskResult, NOTIFICATION_TASK_SUBTASK_CHECKPOINT_PROCESSING, NOTIFICATION_TASK_SUBTASK_CHECKPOINT_CLEANUP, notificationTaskComplete, DEFAULT_NOTIFICATION_TASK_SUBTASK_CLEANUP_RETRY_ATTEMPTS, notificationTaskDelayRetry, DEFAULT_NOTIFICATION_TASK_SUBTASK_CLEANUP_RETRY_DELAY, 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, StorageFileProcessingState, STORAGE_FILE_PROCESSING_STUCK_THROTTLE_CHECK_MS, calculateStorageFileGroupEmbeddedFileUpdate, createStorageFileParamsType, createStorageFileGroupParamsType, loadStorageFileGroupDocumentForReferencePair, deleteAllQueuedStorageFilesParamsType, storageFilesQueuedForDeleteQuery, deleteStorageFileParamsType, downloadStorageFileParamsType, initializeAllStorageFilesFromUploadsParamsType, UPLOADS_FOLDER_PATH, iterateStorageListFilesByEachFile, initializeStorageFileFromUploadParamsType, processAllQueuedStorageFilesParamsType, storageFilesQueuedForProcessingQuery, processStorageFileParamsType, regenerateAllFlaggedStorageFileGroupsContentParamsType, storageFileGroupsFlaggedForContentRegenerationQuery, regenerateStorageFileGroupContentParamsType, createStorageFileDocumentPairFactory, StorageFileCreationType, getDocumentSnapshotDataPair, calculateStorageFileGroupRegeneration, storageFileGroupZipFileStoragePath, STORAGE_FILE_GROUP_ZIP_STORAGE_FILE_PURPOSE, syncAllFlaggedStorageFilesWithGroupsParamsType, iterateFirestoreDocumentSnapshotPairBatches, storageFileFlaggedForSyncWithGroupsQuery, syncStorageFileWithGroupsParamsType, updateStorageFileParamsType, updateStorageFileGroupParamsType, StorageFileState, createNotificationDocument, storageFileProcessingNotificationTaskTemplate, initializeAllApplicableStorageFileGroupsParamsType, initializeStorageFileModelParamsType, storageFileGroupsFlaggedForNeedsInitializationQuery, STORAGE_FILE_GROUP_ZIP_STORAGE_FILE_PURPOSE_CREATE_ZIP_SUBTASK, storedFileReaderFactory, STORAGE_FILE_PROCESSING_NOTIFICATION_TASK_TYPE, copyStoragePath, STORAGE_FILE_GROUP_ZIP_INFO_JSON_FILE_NAME, notificationSubtaskComplete, limitUploadFileTypeDeterminer, combineUploadFileTypeDeterminers, STORAGEFILE_RELATED_FILE_METADATA_KEY, storageFilePurposeAndUserQuery } from '@dereekb/firebase';
4
4
  import { preconditionConflictError, assertSnapshotData, internalServerError } from '@dereekb/firebase-server';
5
5
  import { hoursToMilliseconds, isFuture, addMinutes, addHours, addSeconds, addDays } from 'date-fns';
6
6
  import { Optional, Inject, Injectable, Module, Global } from '@nestjs/common';
@@ -665,7 +665,7 @@ function notificationServerActions(context) {
665
665
  // MARK: Actions
666
666
  function createNotificationUserFactory(context) {
667
667
  const { firebaseServerActionTransformFunctionFactory, notificationUserCollection, authService } = context;
668
- return firebaseServerActionTransformFunctionFactory(CreateNotificationUserParams, async (params) => {
668
+ return firebaseServerActionTransformFunctionFactory(createNotificationUserParamsType, async (params) => {
669
669
  const { uid } = params;
670
670
  return async () => {
671
671
  // assert they exist in the auth system
@@ -694,7 +694,7 @@ function createNotificationUserFactory(context) {
694
694
  }
695
695
  function updateNotificationUserFactory(context) {
696
696
  const { firestoreContext, firebaseServerActionTransformFunctionFactory, notificationUserCollection, appNotificationTemplateTypeInfoRecordService } = context;
697
- return firebaseServerActionTransformFunctionFactory(UpdateNotificationUserParams, async (params) => {
697
+ return firebaseServerActionTransformFunctionFactory(updateNotificationUserParamsType, async (params) => {
698
698
  const { gc: inputGc, dc: inputDc, bc: inputBc } = params;
699
699
  return async (notificationUserDocument) => {
700
700
  await firestoreContext.runTransaction(async (transaction) => {
@@ -758,7 +758,7 @@ function updateNotificationUserFactory(context) {
758
758
  const MAX_NOTIFICATION_BOXES_TO_UPDATE_PER_BATCH = 50;
759
759
  function resyncNotificationUserFactory(context) {
760
760
  const { firestoreContext, firebaseServerActionTransformFunctionFactory, notificationBoxCollection, notificationUserCollection, appNotificationTemplateTypeInfoRecordService } = context;
761
- return firebaseServerActionTransformFunctionFactory(ResyncNotificationUserParams, async () => {
761
+ return firebaseServerActionTransformFunctionFactory(resyncNotificationUserParamsType, async () => {
762
762
  return async (notificationUserDocument) => {
763
763
  // run updates in batches
764
764
  let notificationBoxesUpdated = 0;
@@ -927,7 +927,7 @@ function resyncAllNotificationUsersFactory(context) {
927
927
  }
928
928
  function createNotificationSummaryFactory(context) {
929
929
  const { firebaseServerActionTransformFunctionFactory, notificationSummaryCollection } = context;
930
- return firebaseServerActionTransformFunctionFactory(CreateNotificationSummaryParams, async (params) => {
930
+ return firebaseServerActionTransformFunctionFactory(createNotificationSummaryParamsType, async (params) => {
931
931
  const { model } = params;
932
932
  return async () => {
933
933
  const notificationSummaryId = notificationSummaryIdForModel(model);
@@ -940,7 +940,7 @@ function createNotificationSummaryFactory(context) {
940
940
  }
941
941
  function updateNotificationSummaryFactory(context) {
942
942
  const { firebaseServerActionTransformFunctionFactory } = context;
943
- return firebaseServerActionTransformFunctionFactory(UpdateNotificationSummaryParams, async (params) => {
943
+ return firebaseServerActionTransformFunctionFactory(updateNotificationSummaryParamsType, async (params) => {
944
944
  const { setReadAtTime, flagAllRead } = params;
945
945
  return async (notificationSummaryDocument) => {
946
946
  let updateTemplate;
@@ -983,7 +983,7 @@ function createNotificationBoxInTransactionFactory(context) {
983
983
  function createNotificationBoxFactory(context) {
984
984
  const { firestoreContext, notificationBoxCollection, firebaseServerActionTransformFunctionFactory } = context;
985
985
  const createNotificationBoxInTransaction = createNotificationBoxInTransactionFactory(context);
986
- return firebaseServerActionTransformFunctionFactory(CreateNotificationBoxParams, async (params) => {
986
+ return firebaseServerActionTransformFunctionFactory(createNotificationBoxParamsType, async (params) => {
987
987
  const { model } = params;
988
988
  return async () => {
989
989
  const result = await firestoreContext.runTransaction(async (transaction) => {
@@ -995,7 +995,7 @@ function createNotificationBoxFactory(context) {
995
995
  });
996
996
  }
997
997
  function updateNotificationBoxFactory({ firebaseServerActionTransformFunctionFactory }) {
998
- return firebaseServerActionTransformFunctionFactory(UpdateNotificationBoxParams, async () => {
998
+ return firebaseServerActionTransformFunctionFactory(updateNotificationBoxParamsType, async () => {
999
999
  return async (notificationBoxDocument) => {
1000
1000
  // does nothing currently.
1001
1001
  return notificationBoxDocument;
@@ -1195,7 +1195,7 @@ function updateNotificationBoxRecipientFactory(context) {
1195
1195
  const { firestoreContext, firebaseServerActionTransformFunctionFactory } = context;
1196
1196
  const updateNotificationBoxRecipientInTransaction = updateNotificationBoxRecipientInTransactionFactory(context);
1197
1197
  const updateNotificationBoxRecipientExclusionInTransaction = updateNotificationBoxRecipientExclusionInTransactionFactory(context);
1198
- return firebaseServerActionTransformFunctionFactory(UpdateNotificationBoxRecipientParams, async (params) => {
1198
+ return firebaseServerActionTransformFunctionFactory(updateNotificationBoxRecipientParamsType, async (params) => {
1199
1199
  return async (notificationBoxDocument) => {
1200
1200
  await firestoreContext.runTransaction(async (transaction) => {
1201
1201
  if (params.setExclusion != null) {
@@ -1235,7 +1235,7 @@ function sendNotificationFactory(context) {
1235
1235
  const { appNotificationTemplateTypeInfoRecordService, notificationSendService, notificationTaskService, notificationTemplateService, authService, notificationBoxCollection, notificationCollectionGroup, notificationUserCollection, firestoreContext, firebaseServerActionTransformFunctionFactory } = context;
1236
1236
  const createNotificationBoxInTransaction = createNotificationBoxInTransactionFactory(context);
1237
1237
  const notificationUserAccessor = notificationUserCollection.documentAccessor();
1238
- return firebaseServerActionTransformFunctionFactory(SendNotificationParams, async (params) => {
1238
+ return firebaseServerActionTransformFunctionFactory(sendNotificationParamsType, async (params) => {
1239
1239
  const { ignoreSendAtThrottle } = params;
1240
1240
  return async (inputNotificationDocument) => {
1241
1241
  const now = new Date();
@@ -1887,7 +1887,7 @@ const SEND_QUEUE_NOTIFICATIONS_TASK_EXCESS_THRESHOLD = 5000;
1887
1887
  function sendQueuedNotificationsFactory(context) {
1888
1888
  const { firebaseServerActionTransformFunctionFactory, notificationCollectionGroup } = context;
1889
1889
  const sendNotification = sendNotificationFactory(context);
1890
- return firebaseServerActionTransformFunctionFactory(SendQueuedNotificationsParams, async (params) => {
1890
+ return firebaseServerActionTransformFunctionFactory(sendQueuedNotificationsParamsType, async (params) => {
1891
1891
  const { maxSendNotificationLoops } = params;
1892
1892
  const maxLoops = maxSendNotificationLoops ?? Number.MAX_SAFE_INTEGER;
1893
1893
  const sendNotificationLoopsTaskExcessThreshold = params.sendNotificationLoopsTaskExcessThreshold ?? SEND_QUEUE_NOTIFICATIONS_TASK_EXCESS_THRESHOLD;
@@ -1979,7 +1979,7 @@ function sendQueuedNotificationsFactory(context) {
1979
1979
  }
1980
1980
  function cleanupSentNotificationsFactory(context) {
1981
1981
  const { firestoreContext, firebaseServerActionTransformFunctionFactory, notificationCollectionGroup, notificationBoxCollection, notificationWeekCollectionFactory } = context;
1982
- return firebaseServerActionTransformFunctionFactory(CleanupSentNotificationsParams, async () => {
1982
+ return firebaseServerActionTransformFunctionFactory(cleanupSentNotificationsParamsType, async () => {
1983
1983
  return async () => {
1984
1984
  let notificationBoxesUpdatesCount = 0;
1985
1985
  let notificationsDeleted = 0;
@@ -2167,7 +2167,7 @@ function initializeNotificationBoxInTransactionFactory(context) {
2167
2167
  function initializeNotificationBoxFactory(context) {
2168
2168
  const { firestoreContext, firebaseServerActionTransformFunctionFactory } = context;
2169
2169
  const initializeNotificationBoxInTransaction = initializeNotificationBoxInTransactionFactory(context);
2170
- return firebaseServerActionTransformFunctionFactory(InitializeNotificationModelParams, async (params) => {
2170
+ return firebaseServerActionTransformFunctionFactory(initializeNotificationModelParamsType, async (params) => {
2171
2171
  return async (notificationBoxDocument) => {
2172
2172
  await firestoreContext.runTransaction((transaction) => initializeNotificationBoxInTransaction(params, notificationBoxDocument, transaction));
2173
2173
  return notificationBoxDocument;
@@ -2177,7 +2177,7 @@ function initializeNotificationBoxFactory(context) {
2177
2177
  function initializeAllApplicableNotificationBoxesFactory(context) {
2178
2178
  const { firestoreContext, firebaseServerActionTransformFunctionFactory, notificationBoxCollection, notificationCollectionGroup } = context;
2179
2179
  const initializeNotificationBoxInTransaction = initializeNotificationBoxInTransactionFactory(context);
2180
- return firebaseServerActionTransformFunctionFactory(InitializeAllApplicableNotificationBoxesParams, async () => {
2180
+ return firebaseServerActionTransformFunctionFactory(initializeAllApplicableNotificationBoxesParamsType, async () => {
2181
2181
  return async () => {
2182
2182
  let notificationBoxesVisited = 0;
2183
2183
  let notificationBoxesSucceeded = 0;
@@ -2243,7 +2243,7 @@ function initializeNotificationSummaryInTransactionFactory(context) {
2243
2243
  function initializeNotificationSummaryFactory(context) {
2244
2244
  const { firestoreContext, firebaseServerActionTransformFunctionFactory } = context;
2245
2245
  const initializeNotificationSummaryInTransaction = initializeNotificationSummaryInTransactionFactory(context);
2246
- return firebaseServerActionTransformFunctionFactory(InitializeNotificationModelParams, async (params) => {
2246
+ return firebaseServerActionTransformFunctionFactory(initializeNotificationModelParamsType, async (params) => {
2247
2247
  return async (notificationSummaryDocument) => {
2248
2248
  await firestoreContext.runTransaction((transaction) => initializeNotificationSummaryInTransaction(params, notificationSummaryDocument, transaction));
2249
2249
  return notificationSummaryDocument;
@@ -2253,7 +2253,7 @@ function initializeNotificationSummaryFactory(context) {
2253
2253
  function initializeAllApplicableNotificationSummariesFactory(context) {
2254
2254
  const { firestoreContext, firebaseServerActionTransformFunctionFactory, notificationSummaryCollection, notificationCollectionGroup } = context;
2255
2255
  const initializeNotificationSummaryInTransaction = initializeNotificationSummaryInTransactionFactory(context);
2256
- return firebaseServerActionTransformFunctionFactory(InitializeAllApplicableNotificationSummariesParams, async () => {
2256
+ return firebaseServerActionTransformFunctionFactory(initializeAllApplicableNotificationSummariesParamsType, async () => {
2257
2257
  return async () => {
2258
2258
  let notificationSummariesVisited = 0;
2259
2259
  let notificationSummariesSucceeded = 0;
@@ -2330,10 +2330,6 @@ function __param(paramIndex, decorator) {
2330
2330
  return function (target, key) { decorator(target, key, paramIndex); }
2331
2331
  }
2332
2332
 
2333
- function __metadata(metadataKey, metadataValue) {
2334
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
2335
- }
2336
-
2337
2333
  typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
2338
2334
  var e = new Error(message);
2339
2335
  return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
@@ -2374,8 +2370,7 @@ let NotificationTemplateService = class NotificationTemplateService {
2374
2370
  NotificationTemplateService = __decorate([
2375
2371
  __param(0, Optional()),
2376
2372
  __param(0, Inject(NOTIFICATION_TEMPLATE_SERVICE_DEFAULTS_OVERRIDE_TOKEN)),
2377
- __param(1, Inject(NOTIFICATION_TEMPLATE_SERVICE_CONFIGS_ARRAY_TOKEN)),
2378
- __metadata("design:paramtypes", [Object, Object])
2373
+ __param(1, Inject(NOTIFICATION_TEMPLATE_SERVICE_CONFIGS_ARRAY_TOKEN))
2379
2374
  ], NotificationTemplateService);
2380
2375
  /**
2381
2376
  * Creates a NotificationTemplateServiceInstance.
@@ -2641,8 +2636,7 @@ let AbstractAppNotificationModule = class AbstractAppNotificationModule {
2641
2636
  AbstractAppNotificationModule = __decorate([
2642
2637
  Module({}),
2643
2638
  __param(0, Inject(MutableNotificationExpediteService)),
2644
- __param(1, Inject(NotificationServerActions)),
2645
- __metadata("design:paramtypes", [MutableNotificationExpediteService, NotificationServerActions])
2639
+ __param(1, Inject(NotificationServerActions))
2646
2640
  ], AbstractAppNotificationModule);
2647
2641
  /**
2648
2642
  * Pre-configured global provider for MutableNotificationExpediteService/NotificationExpediteService.
@@ -3208,7 +3202,7 @@ function storageFileServerActions(context) {
3208
3202
  // MARK: Actions
3209
3203
  function createStorageFileFactory(context) {
3210
3204
  const { storageFileCollection, firestoreContext, firebaseServerActionTransformFunctionFactory } = context;
3211
- return firebaseServerActionTransformFunctionFactory(CreateStorageFileParams, async (params) => {
3205
+ return firebaseServerActionTransformFunctionFactory(createStorageFileParamsType, async (params) => {
3212
3206
  return async () => {
3213
3207
  const storageFileDocument = null;
3214
3208
  // TODO: check the file exists, and pull the metadata, and create the document
@@ -3219,7 +3213,7 @@ function createStorageFileFactory(context) {
3219
3213
  function initializeAllStorageFilesFromUploadsFactory(context) {
3220
3214
  const { storageService, firebaseServerActionTransformFunctionFactory } = context;
3221
3215
  const _initializeStorageFileFromUploadFile = _initializeStorageFileFromUploadFileFactory(context);
3222
- return firebaseServerActionTransformFunctionFactory(InitializeAllStorageFilesFromUploadsParams, async (params) => {
3216
+ return firebaseServerActionTransformFunctionFactory(initializeAllStorageFilesFromUploadsParamsType, async (params) => {
3223
3217
  const { folderPath, maxFilesToInitialize, overrideUploadsFolderPath } = params;
3224
3218
  const fullPath = mergeSlashPaths([overrideUploadsFolderPath ?? UPLOADS_FOLDER_PATH, folderPath]); // only targets the uploads folder
3225
3219
  return async () => {
@@ -3365,7 +3359,7 @@ function _initializeStorageFileFromUploadFileFactory(context) {
3365
3359
  function initializeStorageFileFromUploadFactory(context) {
3366
3360
  const { storageService, firebaseServerActionTransformFunctionFactory } = context;
3367
3361
  const _initializeStorageFileFromUploadFile = _initializeStorageFileFromUploadFileFactory(context);
3368
- return firebaseServerActionTransformFunctionFactory(InitializeStorageFileFromUploadParams, async (params) => {
3362
+ return firebaseServerActionTransformFunctionFactory(initializeStorageFileFromUploadParamsType, async (params) => {
3369
3363
  const { bucketId, pathString, expediteProcessing } = params;
3370
3364
  return async () => {
3371
3365
  const file = storageService.file(bucketId == null ? pathString : { bucketId, pathString });
@@ -3375,7 +3369,7 @@ function initializeStorageFileFromUploadFactory(context) {
3375
3369
  }
3376
3370
  function updateStorageFileFactory(context) {
3377
3371
  const { storageFileCollection, firestoreContext, firebaseServerActionTransformFunctionFactory } = context;
3378
- return firebaseServerActionTransformFunctionFactory(UpdateStorageFileParams, async (params) => {
3372
+ return firebaseServerActionTransformFunctionFactory(updateStorageFileParamsType, async (params) => {
3379
3373
  const { sdat } = params;
3380
3374
  return async (storageFileDocument) => {
3381
3375
  const updateTemplate = {
@@ -3388,7 +3382,7 @@ function updateStorageFileFactory(context) {
3388
3382
  }
3389
3383
  function updateStorageFileGroupFactory(context) {
3390
3384
  const { firestoreContext, storageFileGroupCollection, firebaseServerActionTransformFunctionFactory } = context;
3391
- return firebaseServerActionTransformFunctionFactory(UpdateStorageFileGroupParams, async (params) => {
3385
+ return firebaseServerActionTransformFunctionFactory(updateStorageFileGroupParamsType, async (params) => {
3392
3386
  const { entries } = params;
3393
3387
  return async (storageFileGroupDocument) => {
3394
3388
  await firestoreContext.runTransaction(async (transaction) => {
@@ -3420,7 +3414,7 @@ function updateStorageFileGroupFactory(context) {
3420
3414
  function processAllQueuedStorageFilesFactory(context) {
3421
3415
  const { storageFileCollection, firebaseServerActionTransformFunctionFactory } = context;
3422
3416
  const processStorageFile = processStorageFileFactory(context);
3423
- return firebaseServerActionTransformFunctionFactory(ProcessAllQueuedStorageFilesParams, async (params) => {
3417
+ return firebaseServerActionTransformFunctionFactory(processAllQueuedStorageFilesParamsType, async (params) => {
3424
3418
  return async () => {
3425
3419
  let storageFilesVisited = 0;
3426
3420
  let storageFilesProcessStarted = 0;
@@ -3545,7 +3539,7 @@ function _processStorageFileInTransactionFactory(context) {
3545
3539
  function processStorageFileFactory(context) {
3546
3540
  const { firestoreContext, notificationExpediteService, firebaseServerActionTransformFunctionFactory } = context;
3547
3541
  const processStorageFileInTransaction = _processStorageFileInTransactionFactory(context);
3548
- return firebaseServerActionTransformFunctionFactory(ProcessStorageFileParams, async (params) => {
3542
+ return firebaseServerActionTransformFunctionFactory(processStorageFileParamsType, async (params) => {
3549
3543
  const { runImmediately } = params;
3550
3544
  return async (storageFileDocument) => {
3551
3545
  const expediteInstance = notificationExpediteService.expediteInstance();
@@ -3573,7 +3567,7 @@ function processStorageFileFactory(context) {
3573
3567
  function deleteAllQueuedStorageFilesFactory(context) {
3574
3568
  const { storageFileCollection, firebaseServerActionTransformFunctionFactory } = context;
3575
3569
  const deleteStorageFile = deleteStorageFileFactory(context);
3576
- return firebaseServerActionTransformFunctionFactory(DeleteAllQueuedStorageFilesParams, async (params) => {
3570
+ return firebaseServerActionTransformFunctionFactory(deleteAllQueuedStorageFilesParamsType, async (params) => {
3577
3571
  return async () => {
3578
3572
  let storageFilesVisited = 0;
3579
3573
  let storageFilesDeleted = 0;
@@ -3615,7 +3609,7 @@ function deleteAllQueuedStorageFilesFactory(context) {
3615
3609
  function deleteStorageFileFactory(context) {
3616
3610
  const { firestoreContext, storageService, storageFileCollection, firebaseServerActionTransformFunctionFactory } = context;
3617
3611
  const syncStorageFileWithGroupsInTransaction = _syncStorageFileWithGroupsInTransactionFactory(context);
3618
- return firebaseServerActionTransformFunctionFactory(DeleteStorageFileParams, async (params) => {
3612
+ return firebaseServerActionTransformFunctionFactory(deleteStorageFileParamsType, async (params) => {
3619
3613
  const { force } = params;
3620
3614
  return async (inputStorageFileDocument) => {
3621
3615
  await firestoreContext.runTransaction(async (transaction) => {
@@ -3642,7 +3636,7 @@ function deleteStorageFileFactory(context) {
3642
3636
  }
3643
3637
  function downloadStorageFileFactory(context) {
3644
3638
  const { storageService, firebaseServerActionTransformFunctionFactory, storageFileCollection } = context;
3645
- return firebaseServerActionTransformFunctionFactory(DownloadStorageFileParams, async (params) => {
3639
+ return firebaseServerActionTransformFunctionFactory(downloadStorageFileParamsType, async (params) => {
3646
3640
  const { key: targetStorageFileDocumentKey, asAdmin, expiresAt, expiresIn: inputExpiresIn, responseDisposition, responseContentType } = params;
3647
3641
  return async (storageFileDocument) => {
3648
3642
  // if the StorageFileDocument was not provided, set it from the target key
@@ -3709,7 +3703,7 @@ function createStorageFileGroupInTransactionFactory(context) {
3709
3703
  function createStorageFileGroupFactory(context) {
3710
3704
  const { firestoreContext, firebaseServerActionTransformFunctionFactory } = context;
3711
3705
  const createStorageFileGroupInTransaction = createStorageFileGroupInTransactionFactory(context);
3712
- return firebaseServerActionTransformFunctionFactory(CreateStorageFileGroupParams, async (params) => {
3706
+ return firebaseServerActionTransformFunctionFactory(createStorageFileGroupParamsType, async (params) => {
3713
3707
  const { model, storageFileId } = params;
3714
3708
  const storageFileGroupRelatedModelKey = model ? model : storageFileId ? inferKeyFromTwoWayFlatFirestoreModelKey(storageFileId) : undefined;
3715
3709
  if (!storageFileGroupRelatedModelKey) {
@@ -3794,7 +3788,7 @@ function _syncStorageFileWithGroupsInTransactionFactory(context) {
3794
3788
  function syncStorageFileWithGroupsFactory(context) {
3795
3789
  const { firestoreContext, storageFileCollection, storageFileGroupCollection, firebaseServerActionTransformFunctionFactory } = context;
3796
3790
  const syncStorageFileWithGroupsInTransaction = _syncStorageFileWithGroupsInTransactionFactory(context);
3797
- return firebaseServerActionTransformFunctionFactory(SyncStorageFileWithGroupsParams, async (params) => {
3791
+ return firebaseServerActionTransformFunctionFactory(syncStorageFileWithGroupsParamsType, async (params) => {
3798
3792
  const { force } = params;
3799
3793
  return async (storageFileDocument) => {
3800
3794
  return firestoreContext.runTransaction(async (transaction) => syncStorageFileWithGroupsInTransaction({ storageFileDocument, force }, transaction));
@@ -3804,7 +3798,7 @@ function syncStorageFileWithGroupsFactory(context) {
3804
3798
  function syncAllFlaggedStorageFilesWithGroupsFactory(context) {
3805
3799
  const { firebaseServerActionTransformFunctionFactory, storageFileCollection } = context;
3806
3800
  const syncStorageFileWithGroups = syncStorageFileWithGroupsFactory(context);
3807
- return firebaseServerActionTransformFunctionFactory(SyncAllFlaggedStorageFilesWithGroupsParams, async (params) => {
3801
+ return firebaseServerActionTransformFunctionFactory(syncAllFlaggedStorageFilesWithGroupsParamsType, async (params) => {
3808
3802
  return async () => {
3809
3803
  const syncStorageFileWithGroupsInstance = await syncStorageFileWithGroups({
3810
3804
  key: firestoreDummyKey(),
@@ -3848,7 +3842,7 @@ function syncAllFlaggedStorageFilesWithGroupsFactory(context) {
3848
3842
  function regenerateStorageFileGroupContentFactory(context) {
3849
3843
  const { firestoreContext, storageService, storageFileCollection, storageFileGroupCollection, firebaseServerActionTransformFunctionFactory } = context;
3850
3844
  const processStorageFileInTransaction = _processStorageFileInTransactionFactory(context);
3851
- return firebaseServerActionTransformFunctionFactory(RegenerateStorageFileGroupContentParams, async (params) => {
3845
+ return firebaseServerActionTransformFunctionFactory(regenerateStorageFileGroupContentParamsType, async (params) => {
3852
3846
  const { force } = params;
3853
3847
  const createStorageFileDocumentPair = createStorageFileDocumentPairFactory({
3854
3848
  defaultCreationType: StorageFileCreationType.FOR_STORAGE_FILE_GROUP
@@ -3908,7 +3902,7 @@ function regenerateStorageFileGroupContentFactory(context) {
3908
3902
  function regenerateAllFlaggedStorageFileGroupsContentFactory(context) {
3909
3903
  const { firebaseServerActionTransformFunctionFactory, storageFileGroupCollection } = context;
3910
3904
  const regenerateStorageFileGroupContent = regenerateStorageFileGroupContentFactory(context);
3911
- return firebaseServerActionTransformFunctionFactory(RegenerateAllFlaggedStorageFileGroupsContentParams, async (params) => {
3905
+ return firebaseServerActionTransformFunctionFactory(regenerateAllFlaggedStorageFileGroupsContentParamsType, async (params) => {
3912
3906
  return async () => {
3913
3907
  const regenerateStorageFileGroupContentInstance = await regenerateStorageFileGroupContent({
3914
3908
  key: firestoreDummyKey()
@@ -4025,7 +4019,7 @@ function initializeStorageFileGroupInTransactionFactory(context) {
4025
4019
  function initializeStorageFileGroupFactory(context) {
4026
4020
  const { firestoreContext, firebaseServerActionTransformFunctionFactory } = context;
4027
4021
  const initializeStorageFileGroupInTransaction = initializeStorageFileGroupInTransactionFactory(context);
4028
- return firebaseServerActionTransformFunctionFactory(InitializeStorageFileModelParams, async (params) => {
4022
+ return firebaseServerActionTransformFunctionFactory(initializeStorageFileModelParamsType, async (params) => {
4029
4023
  return async (storageFileGroupDocument) => {
4030
4024
  await firestoreContext.runTransaction((transaction) => initializeStorageFileGroupInTransaction(params, storageFileGroupDocument, transaction));
4031
4025
  return storageFileGroupDocument;
@@ -4035,7 +4029,7 @@ function initializeStorageFileGroupFactory(context) {
4035
4029
  function initializeAllApplicableStorageFileGroupsFactory(context) {
4036
4030
  const { firestoreContext, firebaseServerActionTransformFunctionFactory, storageFileGroupCollection } = context;
4037
4031
  const initializeStorageFileGroupInTransaction = initializeStorageFileGroupInTransactionFactory(context);
4038
- return firebaseServerActionTransformFunctionFactory(InitializeAllApplicableStorageFileGroupsParams, async () => {
4032
+ return firebaseServerActionTransformFunctionFactory(initializeAllApplicableStorageFileGroupsParamsType, async () => {
4039
4033
  return async () => {
4040
4034
  let storageFileGroupsVisited = 0;
4041
4035
  let storageFileGroupsSucceeded = 0;
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "@dereekb/firebase-server/model",
3
- "version": "13.0.7",
3
+ "version": "13.2.0",
4
4
  "peerDependencies": {
5
- "@dereekb/date": "13.0.7",
6
- "@dereekb/firebase": "13.0.7",
7
- "@dereekb/firebase-server": "13.0.7",
8
- "@dereekb/model": "13.0.7",
9
- "@dereekb/nestjs": "13.0.7",
10
- "@dereekb/rxjs": "13.0.7",
11
- "@dereekb/util": "13.0.7",
5
+ "@dereekb/date": "13.2.0",
6
+ "@dereekb/firebase": "13.2.0",
7
+ "@dereekb/firebase-server": "13.2.0",
8
+ "@dereekb/model": "13.2.0",
9
+ "@dereekb/nestjs": "13.2.0",
10
+ "@dereekb/rxjs": "13.2.0",
11
+ "@dereekb/util": "13.2.0",
12
12
  "@nestjs/common": "^11.0.0",
13
13
  "@nestjs/config": "^4.0.0",
14
14
  "archiver": "^7.0.0",
@@ -1,4 +1,4 @@
1
- import { type FirestoreContextReference, type Transaction, type TwoWayFlatFirestoreModelKey, type FirestoreModelKey, type FirestoreCollectionName, type NotificationFirestoreCollections, type AsyncNotificationBoxUpdateAction, type NotificationBoxDocument, InitializeNotificationModelParams, InitializeAllApplicableNotificationBoxesParams, type InitializeAllApplicableNotificationBoxesResult, type NotificationBox, type NotificationSummary, InitializeAllApplicableNotificationSummariesParams, type InitializeAllApplicableNotificationSummariesResult, type NotificationSummaryDocument, type AsyncNotificationSummaryUpdateAction, type FirestoreDocument, type FirestoreDocumentData, type InitializedNotificationModel } from '@dereekb/firebase';
1
+ import { type FirestoreContextReference, type Transaction, type TwoWayFlatFirestoreModelKey, type FirestoreModelKey, type FirestoreCollectionName, type NotificationFirestoreCollections, type AsyncNotificationBoxUpdateAction, type NotificationBoxDocument, type InitializeNotificationModelParams, type InitializeAllApplicableNotificationBoxesParams, type InitializeAllApplicableNotificationBoxesResult, type NotificationBox, type NotificationSummary, type InitializeAllApplicableNotificationSummariesParams, type InitializeAllApplicableNotificationSummariesResult, type NotificationSummaryDocument, type AsyncNotificationSummaryUpdateAction, type FirestoreDocument, type FirestoreDocumentData, type InitializedNotificationModel } from '@dereekb/firebase';
2
2
  import { type FirebaseServerActionsContext } from '@dereekb/firebase-server';
3
3
  import { type Maybe } from '@dereekb/util';
4
4
  import { type TransformAndValidateFunctionResult } from '@dereekb/model';
@@ -1,4 +1,4 @@
1
- import { type AsyncNotificationSummaryCreateAction, type AsyncNotificationUserCreateAction, type AsyncNotificationUserUpdateAction, CleanupSentNotificationsParams, CreateNotificationBoxParams, CreateNotificationSummaryParams, CreateNotificationUserParams, type NotificationSummaryDocument, type NotificationUser, type NotificationUserDocument, SendNotificationParams, SendQueuedNotificationsParams, UpdateNotificationBoxParams, UpdateNotificationBoxRecipientParams, UpdateNotificationUserParams, type AsyncNotificationBoxCreateAction, type AsyncNotificationBoxUpdateAction, type CleanupSentNotificationsResult, type FirestoreContextReference, type NotificationBox, type NotificationBoxDocument, type NotificationDocument, type NotificationFirestoreCollections, type SendNotificationResult, type SendQueuedNotificationsResult, type Transaction, type ResyncAllNotificationUserParams, type ResyncAllNotificationUsersResult, type ResyncNotificationUserResult, ResyncNotificationUserParams, type AppNotificationTemplateTypeInfoRecordServiceRef, type AsyncNotificationSummaryUpdateAction, UpdateNotificationSummaryParams, type NotificationBoxDocumentReferencePair } from '@dereekb/firebase';
1
+ import { type AsyncNotificationSummaryCreateAction, type AsyncNotificationUserCreateAction, type AsyncNotificationUserUpdateAction, type CleanupSentNotificationsParams, type CreateNotificationBoxParams, type CreateNotificationSummaryParams, type CreateNotificationUserParams, type NotificationSummaryDocument, type NotificationUser, type NotificationUserDocument, type SendNotificationParams, type SendQueuedNotificationsParams, type UpdateNotificationBoxParams, type UpdateNotificationBoxRecipientParams, type UpdateNotificationUserParams, type AsyncNotificationBoxCreateAction, type AsyncNotificationBoxUpdateAction, type CleanupSentNotificationsResult, type FirestoreContextReference, type NotificationBox, type NotificationBoxDocument, type NotificationDocument, type NotificationFirestoreCollections, type SendNotificationResult, type SendQueuedNotificationsResult, type Transaction, type ResyncAllNotificationUserParams, type ResyncAllNotificationUsersResult, type ResyncNotificationUserResult, type ResyncNotificationUserParams, type AppNotificationTemplateTypeInfoRecordServiceRef, type AsyncNotificationSummaryUpdateAction, type UpdateNotificationSummaryParams, type NotificationBoxDocumentReferencePair } from '@dereekb/firebase';
2
2
  import { type FirebaseServerActionsContext, type FirebaseServerAuthServiceRef } from '@dereekb/firebase-server';
3
3
  import { type TransformAndValidateFunctionResult } from '@dereekb/model';
4
4
  import { type Maybe } from '@dereekb/util';
@@ -35,7 +35,7 @@ export declare abstract class NotificationServerActions {
35
35
  export declare function notificationServerActions(context: NotificationServerActionsContext): NotificationServerActions;
36
36
  export declare function createNotificationUserFactory(context: NotificationServerActionsContext): import("@dereekb/model").TransformAndValidateFunctionResultFunction<CreateNotificationUserParams, () => Promise<NotificationUserDocument>, object, unknown>;
37
37
  export declare function updateNotificationUserFactory(context: NotificationServerActionsContext): import("@dereekb/model").TransformAndValidateFunctionResultFunction<UpdateNotificationUserParams, (notificationUserDocument: NotificationUserDocument) => Promise<NotificationUserDocument>, object, unknown>;
38
- export declare function resyncNotificationUserFactory(context: NotificationServerActionsContext): import("@dereekb/model").TransformAndValidateFunctionResultFunction<ResyncNotificationUserParams, (notificationUserDocument: NotificationUserDocument) => Promise<ResyncNotificationUserResult>, object, unknown>;
38
+ export declare function resyncNotificationUserFactory(context: NotificationServerActionsContext): import("@dereekb/model").TransformAndValidateFunctionResultFunction<import("@dereekb/firebase").TargetModelParams, (notificationUserDocument: NotificationUserDocument) => Promise<ResyncNotificationUserResult>, object, unknown>;
39
39
  export declare function resyncAllNotificationUsersFactory(context: NotificationServerActionsContext): () => Promise<ResyncAllNotificationUsersResult>;
40
40
  export declare function createNotificationSummaryFactory(context: NotificationServerActionsContext): import("@dereekb/model").TransformAndValidateFunctionResultFunction<CreateNotificationSummaryParams, () => Promise<NotificationSummaryDocument>, object, unknown>;
41
41
  export declare function updateNotificationSummaryFactory(context: NotificationServerActionsContext): import("@dereekb/model").TransformAndValidateFunctionResultFunction<UpdateNotificationSummaryParams, (notificationSummaryDocument: NotificationSummaryDocument) => Promise<NotificationSummaryDocument>, object, unknown>;
@@ -59,7 +59,7 @@ export declare function createNotificationBoxInTransactionFactory(context: BaseN
59
59
  notificationBoxDocument: NotificationBoxDocument;
60
60
  }>;
61
61
  export declare function createNotificationBoxFactory(context: NotificationServerActionsContext): import("@dereekb/model").TransformAndValidateFunctionResultFunction<CreateNotificationBoxParams, () => Promise<NotificationBoxDocument>, object, unknown>;
62
- export declare function updateNotificationBoxFactory({ firebaseServerActionTransformFunctionFactory }: NotificationServerActionsContext): import("@dereekb/model").TransformAndValidateFunctionResultFunction<UpdateNotificationBoxParams, (notificationBoxDocument: NotificationBoxDocument) => Promise<NotificationBoxDocument>, object, unknown>;
62
+ export declare function updateNotificationBoxFactory({ firebaseServerActionTransformFunctionFactory }: NotificationServerActionsContext): import("@dereekb/model").TransformAndValidateFunctionResultFunction<import("@dereekb/firebase").TargetModelParams, (notificationBoxDocument: NotificationBoxDocument) => Promise<NotificationBoxDocument>, object, unknown>;
63
63
  export interface UpdateNotificationBoxRecipientExclusionInTransactionInput extends NotificationBoxDocumentReferencePair {
64
64
  readonly params: UpdateNotificationBoxRecipientParams;
65
65
  }
@@ -1,7 +1,7 @@
1
- import { CreateNotificationDocumentPairResult, NotificationDocument, SendNotificationParams, SendNotificationResult } from '@dereekb/firebase';
2
- import { NotificationServerActions } from './notification.action.service';
3
- import { Abstract, Provider } from '@nestjs/common';
4
- import { Maybe } from '@dereekb/util';
1
+ import { type CreateNotificationDocumentPairResult, type NotificationDocument, type SendNotificationParams, type SendNotificationResult } from '@dereekb/firebase';
2
+ import { type NotificationServerActions } from './notification.action.service';
3
+ import { type Abstract, type Provider } from '@nestjs/common';
4
+ import { type Maybe } from '@dereekb/util';
5
5
  export type NotificationExpediteServiceSendNotificationOptions = Pick<SendNotificationParams, 'ignoreSendAtThrottle' | 'throwErrorIfSent'>;
6
6
  /**
7
7
  * Interface for a service that allows access to a NotificationServerActions instance and "expediting" the sending of notification(s) that should be emitted immediately for timeliness.
@@ -1,4 +1,4 @@
1
- import { type FirestoreContextReference, type Transaction, type TwoWayFlatFirestoreModelKey, type FirestoreModelKey, type FirestoreCollectionName, type StorageFileFirestoreCollections, type StorageFileGroupDocument, InitializeStorageFileModelParams, InitializeAllApplicableStorageFileGroupsParams, type InitializeAllApplicableStorageFileGroupsResult, type StorageFileGroup, type FirestoreDocument, type FirestoreDocumentData, type InitializedStorageFileModel, type AsyncStorageFileGroupUpdateAction, type StorageFileGroupContentFlagsData } from '@dereekb/firebase';
1
+ import { type FirestoreContextReference, type Transaction, type TwoWayFlatFirestoreModelKey, type FirestoreModelKey, type FirestoreCollectionName, type StorageFileFirestoreCollections, type StorageFileGroupDocument, type InitializeStorageFileModelParams, type InitializeAllApplicableStorageFileGroupsParams, type InitializeAllApplicableStorageFileGroupsResult, type StorageFileGroup, type FirestoreDocument, type FirestoreDocumentData, type InitializedStorageFileModel, type AsyncStorageFileGroupUpdateAction, type StorageFileGroupContentFlagsData } from '@dereekb/firebase';
2
2
  import { type FirebaseServerActionsContext } from '@dereekb/firebase-server';
3
3
  import { type Maybe } from '@dereekb/util';
4
4
  import { type TransformAndValidateFunctionResult } from '@dereekb/model';
@@ -1,4 +1,4 @@
1
- import { type FirestoreContextReference, InitializeStorageFileFromUploadParams, type AsyncStorageFileCreateAction, type StorageFileFirestoreCollections, ProcessStorageFileParams, type StorageFileDocument, type ProcessStorageFileResult, CreateStorageFileParams, type AsyncStorageFileUpdateAction, UpdateStorageFileParams, type NotificationFirestoreCollections, type FirebaseStorageAccessorFile, type InitializeAllStorageFilesFromUploadsResult, InitializeAllStorageFilesFromUploadsParams, ProcessAllQueuedStorageFilesParams, type ProcessAllQueuedStorageFilesResult, DeleteAllQueuedStorageFilesParams, type DeleteAllQueuedStorageFilesResult, DeleteStorageFileParams, type AsyncStorageFileDeleteAction, type StorageFile, DownloadStorageFileParams, type DownloadStorageFileResult, SyncStorageFileWithGroupsParams, SyncAllFlaggedStorageFilesWithGroupsParams, type SyncAllFlaggedStorageFilesWithGroupsResult, type SyncStorageFileWithGroupsResult, RegenerateAllFlaggedStorageFileGroupsContentParams, type RegenerateAllFlaggedStorageFileGroupsContentResult, RegenerateStorageFileGroupContentParams, type RegenerateStorageFileGroupContentResult, type StorageFileGroupDocument, type AsyncStorageFileGroupCreateAction, CreateStorageFileGroupParams, type Transaction, type StorageFileGroup, type StorageFileGroupDocumentReferencePair, type StorageFileGroupId, UpdateStorageFileGroupParams } from '@dereekb/firebase';
1
+ import { type FirestoreContextReference, type InitializeStorageFileFromUploadParams, type AsyncStorageFileCreateAction, type StorageFileFirestoreCollections, type ProcessStorageFileParams, type StorageFileDocument, type ProcessStorageFileResult, type CreateStorageFileParams, type AsyncStorageFileUpdateAction, type UpdateStorageFileParams, type NotificationFirestoreCollections, type FirebaseStorageAccessorFile, type InitializeAllStorageFilesFromUploadsResult, type InitializeAllStorageFilesFromUploadsParams, type ProcessAllQueuedStorageFilesParams, type ProcessAllQueuedStorageFilesResult, type DeleteAllQueuedStorageFilesParams, type DeleteAllQueuedStorageFilesResult, type DeleteStorageFileParams, type AsyncStorageFileDeleteAction, type StorageFile, type DownloadStorageFileParams, type DownloadStorageFileResult, type SyncStorageFileWithGroupsParams, type SyncAllFlaggedStorageFilesWithGroupsParams, type SyncAllFlaggedStorageFilesWithGroupsResult, type SyncStorageFileWithGroupsResult, type RegenerateAllFlaggedStorageFileGroupsContentParams, type RegenerateAllFlaggedStorageFileGroupsContentResult, type RegenerateStorageFileGroupContentParams, type RegenerateStorageFileGroupContentResult, type StorageFileGroupDocument, type AsyncStorageFileGroupCreateAction, type CreateStorageFileGroupParams, type Transaction, type StorageFileGroup, type StorageFileGroupDocumentReferencePair, type StorageFileGroupId, type UpdateStorageFileGroupParams } from '@dereekb/firebase';
2
2
  import { type FirebaseServerStorageServiceRef, type FirebaseServerActionsContext, type FirebaseServerAuthServiceRef } from '@dereekb/firebase-server';
3
3
  import { type TransformAndValidateFunctionResult } from '@dereekb/model';
4
4
  import { type InjectionToken } from '@nestjs/common';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dereekb/firebase-server",
3
- "version": "13.0.7",
3
+ "version": "13.2.0",
4
4
  "exports": {
5
5
  "./test": {
6
6
  "module": "./test/index.esm.js",
@@ -37,14 +37,14 @@
37
37
  "main": "./index.cjs.js",
38
38
  "types": "./src/index.d.ts",
39
39
  "peerDependencies": {
40
- "@dereekb/date": "13.0.7",
41
- "@dereekb/dbx-core": "13.0.7",
42
- "@dereekb/firebase": "13.0.7",
43
- "@dereekb/model": "13.0.7",
44
- "@dereekb/nestjs": "13.0.7",
45
- "@dereekb/rxjs": "13.0.7",
46
- "@dereekb/util": "13.0.7",
47
- "@dereekb/zoho": "13.0.7",
40
+ "@dereekb/date": "13.2.0",
41
+ "@dereekb/dbx-core": "13.2.0",
42
+ "@dereekb/firebase": "13.2.0",
43
+ "@dereekb/model": "13.2.0",
44
+ "@dereekb/nestjs": "13.2.0",
45
+ "@dereekb/rxjs": "13.2.0",
46
+ "@dereekb/util": "13.2.0",
47
+ "@dereekb/zoho": "13.2.0",
48
48
  "@google-cloud/firestore": "^7.11.6",
49
49
  "@google-cloud/storage": "^7.19.0",
50
50
  "@nestjs/common": "^11.0.0",
@@ -53,7 +53,7 @@
53
53
  "@nestjs/platform-express": "^11.0.0",
54
54
  "@nestjs/testing": "^11.0.0",
55
55
  "archiver": "^7.0.0",
56
- "class-validator": "^0.15.1",
56
+ "arktype": "^2.2.0",
57
57
  "date-fns": "^4.0.0",
58
58
  "express": "^5.0.0",
59
59
  "firebase-admin": "^13.0.0",
@@ -3,3 +3,4 @@ export * from './driver.accessor';
3
3
  export * from './driver.query';
4
4
  export * from './firestore';
5
5
  export * from './increment';
6
+ export * from './snapshot';
@@ -0,0 +1 @@
1
+ export * from './snapshot.field';
@@ -0,0 +1,80 @@
1
+ import { type Maybe, type Getter, type GetterOrValue } from '@dereekb/util';
2
+ import { type FirestoreModelFieldMapFunctionsConfig } from '@dereekb/firebase';
3
+ /**
4
+ * The source for the encryption secret.
5
+ *
6
+ * - If a string, it is used directly as the hex-encoded key (64 hex chars = 32 bytes).
7
+ * - If a Getter, it is called each time to retrieve the key (useful for rotation or lazy loading).
8
+ * - If an object with `env`, the key is read from the specified environment variable.
9
+ */
10
+ export type FirestoreEncryptedFieldSecretSource = string | Getter<string> | {
11
+ env: string;
12
+ };
13
+ /**
14
+ * Configuration for encrypted Firestore fields.
15
+ *
16
+ * @template T - The JSON-serializable value type stored in the model.
17
+ */
18
+ export interface FirestoreEncryptedFieldConfig<T> {
19
+ /**
20
+ * The encryption secret source.
21
+ *
22
+ * Expects a 64-character hex string representing a 32-byte AES-256 key.
23
+ */
24
+ readonly secret: FirestoreEncryptedFieldSecretSource;
25
+ /**
26
+ * Default model value when the Firestore data is null/undefined.
27
+ */
28
+ readonly default?: GetterOrValue<T>;
29
+ }
30
+ /**
31
+ * Configuration for optional encrypted Firestore fields.
32
+ *
33
+ * @template T - The JSON-serializable value type stored in the model.
34
+ */
35
+ export interface OptionalFirestoreEncryptedFieldConfig<T> {
36
+ /**
37
+ * The encryption secret source.
38
+ *
39
+ * Expects a 64-character hex string representing a 32-byte AES-256 key.
40
+ */
41
+ readonly secret: FirestoreEncryptedFieldSecretSource;
42
+ }
43
+ /**
44
+ * Creates a Firestore field mapping that encrypts/decrypts a JSON-serializable value
45
+ * using AES-256-GCM. The value is stored in Firestore as a base64-encoded string.
46
+ *
47
+ * The encryption key is resolved from the configured secret source on each read/write,
48
+ * allowing for key rotation via environment variable changes.
49
+ *
50
+ * @example
51
+ * ```typescript
52
+ * const jwksField = firestoreEncryptedField<JWKSet>({
53
+ * secret: { env: 'FIRESTORE_ENCRYPTION_KEY' },
54
+ * default: () => ({ keys: [] })
55
+ * });
56
+ * ```
57
+ *
58
+ * @template T - The JSON-serializable value type.
59
+ * @param config - Encryption field configuration.
60
+ * @returns A field mapping configuration for encrypted values.
61
+ */
62
+ export declare function firestoreEncryptedField<T>(config: FirestoreEncryptedFieldConfig<T>): FirestoreModelFieldMapFunctionsConfig<T, string>;
63
+ /**
64
+ * Creates a Firestore field mapping for an optional encrypted field.
65
+ *
66
+ * When the value is null/undefined, it is stored/read as null. When present, it is
67
+ * encrypted/decrypted using AES-256-GCM.
68
+ *
69
+ * @example
70
+ * ```typescript
71
+ * const optionalSecretField = optionalFirestoreEncryptedField<OAuthClientSecret>({
72
+ * secret: { env: 'FIRESTORE_ENCRYPTION_KEY' }
73
+ * });
74
+ * ```
75
+ *
76
+ * @template T - The JSON-serializable value type.
77
+ * @param config - Encryption field configuration.
78
+ * @returns A field mapping configuration for optional encrypted values.
79
+ */
80
+ export declare function optionalFirestoreEncryptedField<T>(config: OptionalFirestoreEncryptedFieldConfig<T>): FirestoreModelFieldMapFunctionsConfig<Maybe<T>, Maybe<string>>;
@@ -1,5 +1,5 @@
1
- import { type ValidationError } from 'class-validator';
2
- import { type TransformAndValidateFunctionResultFactory, type TransformAndValidateObjectFactory, type TransformAndValidateObjectFactoryDefaults } from '@dereekb/model';
1
+ import { type ArkErrors } from 'arktype';
2
+ import { type TransformAndValidateFunctionResultFactory, type TransformAndValidateObjectFactory } from '@dereekb/model';
3
3
  /**
4
4
  * Context used for building FirebaseServerActions. It contains references to reusable factories.
5
5
  */
@@ -24,23 +24,20 @@ export type FirebaseServerActionsTransformContextOptions = FirebaseServerActions
24
24
  export declare function firebaseServerActionsTransformContext(options?: FirebaseServerActionsTransformContextOptions): FirebaseServerActionsTransformContext;
25
25
  export declare const FIREBASE_SERVER_VALIDATION_ERROR_CODE = "VALIDATION_ERROR";
26
26
  /**
27
- *
28
- * @param validationError
29
- * @returns
27
+ * Creates a server error object from ArkType validation errors.
30
28
  */
31
- export declare function firebaseServerValidationServerError(validationError: ValidationError[]): {
29
+ export declare function firebaseServerValidationServerError(validationErrors: ArkErrors): {
32
30
  message: string;
33
31
  code: string;
34
- data: string | object;
32
+ data: {
33
+ message: string;
34
+ };
35
35
  };
36
36
  /**
37
37
  * Creates a new badRequestError with the validation error details as the response data.
38
- *
39
- * @param validationError
40
- * @returns
41
38
  */
42
- export declare function firebaseServerValidationError(validationError: ValidationError[]): import("firebase-functions/https").HttpsError;
43
- export interface FirebaseServerActionsTransformFactoryOptions extends Pick<TransformAndValidateObjectFactoryDefaults<any>, 'defaultValidationOptions'> {
39
+ export declare function firebaseServerValidationError(validationErrors: ArkErrors): import("firebase-functions/https").HttpsError;
40
+ export interface FirebaseServerActionsTransformFactoryOptions {
44
41
  readonly logError?: FirebaseServerActionsTransformFactoryLogErrorFunctionInput;
45
42
  }
46
43
  export declare function firebaseServerActionsTransformFactory(options?: FirebaseServerActionsTransformFactoryOptions): TransformAndValidateObjectFactory;