@dereekb/firebase-server 12.4.4 → 12.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/mailgun/package.json +1 -1
  3. package/model/package.json +1 -1
  4. package/model/src/lib/index.d.ts +1 -0
  5. package/model/src/lib/index.js +1 -0
  6. package/model/src/lib/index.js.map +1 -1
  7. package/model/src/lib/notification/notification.action.server.d.ts +2 -2
  8. package/model/src/lib/notification/notification.action.server.js +142 -93
  9. package/model/src/lib/notification/notification.action.server.js.map +1 -1
  10. package/model/src/lib/notification/notification.task.service.d.ts +1 -1
  11. package/model/src/lib/notification/notification.task.service.handler.d.ts +5 -1
  12. package/model/src/lib/notification/notification.task.service.handler.js +5 -1
  13. package/model/src/lib/notification/notification.task.service.handler.js.map +1 -1
  14. package/model/src/lib/notification/notification.task.service.util.d.ts +9 -0
  15. package/model/src/lib/notification/notification.task.service.util.js +27 -0
  16. package/model/src/lib/notification/notification.task.service.util.js.map +1 -0
  17. package/model/src/lib/storagefile/index.d.ts +7 -0
  18. package/model/src/lib/storagefile/index.js +11 -0
  19. package/model/src/lib/storagefile/index.js.map +1 -0
  20. package/model/src/lib/storagefile/storagefile.action.server.d.ts +41 -0
  21. package/model/src/lib/storagefile/storagefile.action.server.js +392 -0
  22. package/model/src/lib/storagefile/storagefile.action.server.js.map +1 -0
  23. package/model/src/lib/storagefile/storagefile.error.d.ts +11 -0
  24. package/model/src/lib/storagefile/storagefile.error.js +78 -0
  25. package/model/src/lib/storagefile/storagefile.error.js.map +1 -0
  26. package/model/src/lib/storagefile/storagefile.module.d.ts +30 -0
  27. package/model/src/lib/storagefile/storagefile.module.js +50 -0
  28. package/model/src/lib/storagefile/storagefile.module.js.map +1 -0
  29. package/model/src/lib/storagefile/storagefile.task.service.handler.d.ts +163 -0
  30. package/model/src/lib/storagefile/storagefile.task.service.handler.js +286 -0
  31. package/model/src/lib/storagefile/storagefile.task.service.handler.js.map +1 -0
  32. package/model/src/lib/storagefile/storagefile.upload.service.d.ts +57 -0
  33. package/model/src/lib/storagefile/storagefile.upload.service.initializer.d.ts +105 -0
  34. package/model/src/lib/storagefile/storagefile.upload.service.initializer.js +143 -0
  35. package/model/src/lib/storagefile/storagefile.upload.service.initializer.js.map +1 -0
  36. package/model/src/lib/storagefile/storagefile.upload.service.js +10 -0
  37. package/model/src/lib/storagefile/storagefile.upload.service.js.map +1 -0
  38. package/model/src/lib/storagefile/storagefile.util.d.ts +37 -0
  39. package/model/src/lib/storagefile/storagefile.util.js +54 -0
  40. package/model/src/lib/storagefile/storagefile.util.js.map +1 -0
  41. package/package.json +1 -1
  42. package/src/lib/storage/driver.accessor.d.ts +3 -3
  43. package/src/lib/storage/driver.accessor.js +111 -18
  44. package/src/lib/storage/driver.accessor.js.map +1 -1
  45. package/test/package.json +1 -1
  46. package/zoho/package.json +1 -1
@@ -13,7 +13,7 @@ function notificationTaskService(config) {
13
13
  handlers[type] = handlerForConfig(handlerConfig);
14
14
  });
15
15
  function handlerForConfig(handlerConfig) {
16
- const { flow: inputFlows } = handlerConfig;
16
+ const { flow: inputFlows, allowRunMultipleParts } = handlerConfig;
17
17
  const { included: checkpointFlows, excluded: nonCheckpointFlows } = (0, util_1.separateValues)(inputFlows, (x) => x.checkpoint != null);
18
18
  if (inputFlows.length === 0) {
19
19
  throw new Error('notificationTaskService(): NotificationTaskServiceTaskHandlerConfig must have at least one flow entry.');
@@ -41,6 +41,10 @@ function notificationTaskService(config) {
41
41
  let result;
42
42
  if (fn) {
43
43
  result = await fn(notificationTask);
44
+ // if allowRunMultipleParts is true, and the result doesn't have a canRunNextCheckpoint value, then set it to true.
45
+ if (allowRunMultipleParts && result.canRunNextCheckpoint == null) {
46
+ result.canRunNextCheckpoint = true;
47
+ }
44
48
  }
45
49
  else {
46
50
  result = {
@@ -1 +1 @@
1
- {"version":3,"file":"notification.task.service.handler.js","sourceRoot":"","sources":["../../../../../../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,eAAe,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC;wBACvD,MAAM;oBACR;wBACE,MAAM,uBAAuB,GAAG,IAAI,GAAG,CAAC,oBAAoB,CAAC,CAAC;wBAC9D;;2BAEG;wBACH,MAAM,cAAc,GAAG,eAAe,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,uBAAuB,CAAC,GAAG,CAAC,CAAC,CAAC,UAAoB,CAAC,CAAC,CAAC;wBACzG,EAAE,GAAG,cAAc,EAAE,EAAE,CAAC;wBACxB,MAAM;gBACV,CAAC;gBAED,IAAI,MAA2D,CAAC;gBAEhE,IAAI,EAAE,EAAE,CAAC;oBACP,MAAM,GAAG,MAAM,EAAE,CAAC,gBAAgB,CAAC,CAAC;gBACtC,CAAC;qBAAM,CAAC;oBACN,MAAM,GAAG;wBACP,UAAU,EAAE,IAAI,CAAC,iEAAiE;qBACnF,CAAC;gBACJ,CAAC;gBAED,OAAO,MAAM,CAAC;YAChB,CAAC;SACF,CAAC;IACJ,CAAC;IAED,OAAO;QACL,2BAA2B,EAAE,CAAC,oBAA0C,EAAE,EAAE;YAC1E,OAAO,QAAQ,CAAC,oBAAoB,CAAC,KAAK,SAAS,CAAC;QACtD,CAAC;QACD,kCAAkC,EAAE,CAAC,oBAA0C,EAAE,EAAE,CAAC,QAAQ,CAAC,oBAAoB,CAAC;KACnH,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"notification.task.service.handler.js","sourceRoot":"","sources":["../../../../../../../packages/firebase-server/model/src/lib/notification/notification.task.service.handler.ts"],"names":[],"mappings":";;AA8CA,0DAiEC;AA7GD,wCAA6D;AAyC7D;;GAEG;AACH,SAAgB,uBAAuB,CAAC,MAAqC;IAC3E,MAAM,EAAE,QAAQ,EAAE,aAAa,EAAE,GAAG,MAAM,CAAC;IAE3C,MAAM,QAAQ,GAAqE,EAAE,CAAC;IAEtF,aAAa,CAAC,OAAO,CAAC,CAAC,aAAa,EAAE,EAAE;Q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CAAC,CAAC,CAAC;wBACzG,EAAE,GAAG,cAAc,EAAE,EAAE,CAAC;wBACxB,MAAM;gBACV,CAAC;gBAED,IAAI,MAA2D,CAAC;gBAEhE,IAAI,EAAE,EAAE,CAAC;oBACP,MAAM,GAAG,MAAM,EAAE,CAAC,gBAAgB,CAAC,CAAC;oBAEpC,mHAAmH;oBACnH,IAAI,qBAAqB,IAAI,MAAM,CAAC,oBAAoB,IAAI,IAAI,EAAE,CAAC;wBAChE,MAAsC,CAAC,oBAAoB,GAAG,IAAI,CAAC;oBACtE,CAAC;gBACH,CAAC;qBAAM,CAAC;oBACN,MAAM,GAAG;wBACP,UAAU,EAAE,IAAI,CAAC,iEAAiE;qBACnF,CAAC;gBACJ,CAAC;gBAED,OAAO,MAAM,CAAC;YAChB,CAAC;SACF,CAAC;IACJ,CAAC;IAED,OAAO;QACL,2BAA2B,EAAE,CAAC,oBAA0C,EAAE,EAAE;YAC1E,OAAO,QAAQ,CAAC,oBAAoB,CAAC,KAAK,SAAS,CAAC;QACtD,CAAC;QACD,kCAAkC,EAAE,CAAC,oBAA0C,EAAE,EAAE,CAAC,QAAQ,CAAC,oBAAoB,CAAC;KACnH,CAAC;AACJ,CAAC"}
@@ -0,0 +1,9 @@
1
+ import { NotificationTaskCheckpointString, NotificationTaskServiceHandleNotificationTaskResult } from '@dereekb/firebase';
2
+ /**
3
+ * Removes the completed checkpoints from the inputCompletions array based on the handleTaskResult.
4
+ *
5
+ * @param inputCompletions
6
+ * @param handleTaskResult
7
+ * @returns
8
+ */
9
+ export declare function removeFromCompletionsArrayWithTaskResult<S extends NotificationTaskCheckpointString = NotificationTaskCheckpointString>(inputCompletions: S[], handleTaskResult: Pick<NotificationTaskServiceHandleNotificationTaskResult<any, S>, 'removeAllCompletedCheckpoints' | 'removeFromCompletedCheckpoints'>): S[];
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.removeFromCompletionsArrayWithTaskResult = removeFromCompletionsArrayWithTaskResult;
4
+ const util_1 = require("@dereekb/util");
5
+ /**
6
+ * Removes the completed checkpoints from the inputCompletions array based on the handleTaskResult.
7
+ *
8
+ * @param inputCompletions
9
+ * @param handleTaskResult
10
+ * @returns
11
+ */
12
+ function removeFromCompletionsArrayWithTaskResult(inputCompletions, handleTaskResult) {
13
+ const { removeAllCompletedCheckpoints, removeFromCompletedCheckpoints } = handleTaskResult;
14
+ let result;
15
+ if (removeAllCompletedCheckpoints) {
16
+ result = [];
17
+ }
18
+ else if (removeFromCompletedCheckpoints != null) {
19
+ const removeFromCompletionsSet = new Set((0, util_1.asArray)(removeFromCompletedCheckpoints));
20
+ result = inputCompletions.filter((x) => !removeFromCompletionsSet.has(x));
21
+ }
22
+ else {
23
+ result = inputCompletions;
24
+ }
25
+ return result;
26
+ }
27
+ //# sourceMappingURL=notification.task.service.util.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"notification.task.service.util.js","sourceRoot":"","sources":["../../../../../../../packages/firebase-server/model/src/lib/notification/notification.task.service.util.ts"],"names":[],"mappings":";;AAUA,4FAeC;AAxBD,wCAAwC;AAExC;;;;;;GAMG;AACH,SAAgB,wCAAwC,CAAgF,gBAAqB,EAAE,gBAAuJ;IACpT,MAAM,EAAE,6BAA6B,EAAE,8BAA8B,EAAE,GAAG,gBAAgB,CAAC;IAE3F,IAAI,MAAW,CAAC;IAEhB,IAAI,6BAA6B,EAAE,CAAC;QAClC,MAAM,GAAG,EAAE,CAAC;IACd,CAAC;SAAM,IAAI,8BAA8B,IAAI,IAAI,EAAE,CAAC;QAClD,MAAM,wBAAwB,GAAG,IAAI,GAAG,CAAC,IAAA,cAAO,EAAC,8BAA8B,CAAC,CAAC,CAAC;QAClF,MAAM,GAAG,gBAAgB,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,wBAAwB,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;IAC5E,CAAC;SAAM,CAAC;QACN,MAAM,GAAG,gBAAgB,CAAC;IAC5B,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC"}
@@ -0,0 +1,7 @@
1
+ export * from './storagefile.action.server';
2
+ export * from './storagefile.error';
3
+ export * from './storagefile.module';
4
+ export * from './storagefile.task.service.handler';
5
+ export * from './storagefile.upload.service';
6
+ export * from './storagefile.upload.service.initializer';
7
+ export * from './storagefile.util';
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ tslib_1.__exportStar(require("./storagefile.action.server"), exports);
5
+ tslib_1.__exportStar(require("./storagefile.error"), exports);
6
+ tslib_1.__exportStar(require("./storagefile.module"), exports);
7
+ tslib_1.__exportStar(require("./storagefile.task.service.handler"), exports);
8
+ tslib_1.__exportStar(require("./storagefile.upload.service"), exports);
9
+ tslib_1.__exportStar(require("./storagefile.upload.service.initializer"), exports);
10
+ tslib_1.__exportStar(require("./storagefile.util"), exports);
11
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../packages/firebase-server/model/src/lib/storagefile/index.ts"],"names":[],"mappings":";;;AAAA,sEAA4C;AAC5C,8DAAoC;AACpC,+DAAqC;AACrC,6EAAmD;AACnD,uEAA6C;AAC7C,mFAAyD;AACzD,6DAAmC"}
@@ -0,0 +1,41 @@
1
+ import { type FirestoreContextReference, InitializeStorageFileFromUploadParams, AsyncStorageFileCreateAction, StorageFileFirestoreCollections, ProcessStorageFileParams, StorageFileDocument, ProcessStorageFileResult, CreateStorageFileParams, AsyncStorageFileUpdateAction, UpdateStorageFileParams, NotificationFirestoreCollections, FirebaseStorageAccessorFile, InitializeAllStorageFilesFromUploadsResult, InitializeAllStorageFilesFromUploadsParams, ProcessAllQueuedStorageFilesParams, ProcessAllQueuedStorageFilesResult, DeleteAllQueuedStorageFilesParams, DeleteAllQueuedStorageFilesResult, DeleteStorageFileParams, AsyncStorageFileDeleteAction } from '@dereekb/firebase';
2
+ import { FirebaseServerStorageServiceRef, type FirebaseServerActionsContext, type FirebaseServerAuthServiceRef } from '@dereekb/firebase-server';
3
+ import { type TransformAndValidateFunctionResult } from '@dereekb/model';
4
+ import { type InjectionToken } from '@nestjs/common';
5
+ import { NotificationExpediteServiceRef } from '../notification';
6
+ import { StorageFileInitializeFromUploadServiceRef } from './storagefile.upload.service';
7
+ /**
8
+ * Injection token for the BaseStorageFileServerActionsContext
9
+ */
10
+ export declare const BASE_STORAGE_FILE_SERVER_ACTION_CONTEXT_TOKEN: InjectionToken;
11
+ /**
12
+ * Injection token for the StorageFileServerActionsContext
13
+ */
14
+ export declare const STORAGE_FILE_SERVER_ACTION_CONTEXT_TOKEN: InjectionToken;
15
+ export interface BaseStorageFileServerActionsContext extends FirebaseServerActionsContext, NotificationFirestoreCollections, NotificationExpediteServiceRef, StorageFileFirestoreCollections, FirebaseServerAuthServiceRef, FirebaseServerStorageServiceRef, FirestoreContextReference {
16
+ }
17
+ export interface StorageFileServerActionsContext extends BaseStorageFileServerActionsContext, StorageFileInitializeFromUploadServiceRef {
18
+ }
19
+ export declare abstract class StorageFileServerActions {
20
+ abstract createStorageFile(params: CreateStorageFileParams): AsyncStorageFileCreateAction<CreateStorageFileParams>;
21
+ abstract initializeAllStorageFilesFromUploads(params: InitializeAllStorageFilesFromUploadsParams): Promise<TransformAndValidateFunctionResult<InitializeAllStorageFilesFromUploadsParams, () => Promise<InitializeAllStorageFilesFromUploadsResult>>>;
22
+ abstract initializeStorageFileFromUpload(params: InitializeStorageFileFromUploadParams): AsyncStorageFileCreateAction<InitializeStorageFileFromUploadParams>;
23
+ abstract updateStorageFile(params: UpdateStorageFileParams): AsyncStorageFileUpdateAction<UpdateStorageFileParams>;
24
+ abstract processAllQueuedStorageFiles(params: ProcessAllQueuedStorageFilesParams): Promise<TransformAndValidateFunctionResult<ProcessAllQueuedStorageFilesParams, () => Promise<ProcessAllQueuedStorageFilesResult>>>;
25
+ abstract processStorageFile(params: ProcessStorageFileParams): Promise<TransformAndValidateFunctionResult<ProcessStorageFileParams, (storageFileDocument: StorageFileDocument) => Promise<ProcessStorageFileResult>>>;
26
+ abstract deleteAllQueuedStorageFiles(params: DeleteAllQueuedStorageFilesParams): Promise<TransformAndValidateFunctionResult<DeleteAllQueuedStorageFilesParams, () => Promise<DeleteAllQueuedStorageFilesResult>>>;
27
+ abstract deleteStorageFile(params: DeleteStorageFileParams): AsyncStorageFileDeleteAction<DeleteStorageFileParams>;
28
+ }
29
+ export declare function storageFileServerActions(context: StorageFileServerActionsContext): StorageFileServerActions;
30
+ export declare function createStorageFileFactory(context: BaseStorageFileServerActionsContext): import("@dereekb/model").TransformAndValidateFunctionResultFunction<CreateStorageFileParams, () => Promise<any>, object, unknown>;
31
+ export declare function initializeAllStorageFilesFromUploadsFactory(context: StorageFileServerActionsContext): import("@dereekb/model").TransformAndValidateFunctionResultFunction<InitializeAllStorageFilesFromUploadsParams, () => Promise<InitializeAllStorageFilesFromUploadsResult>, object, unknown>;
32
+ export interface InitializeStorageFileFromUploadFileInput {
33
+ readonly file: FirebaseStorageAccessorFile;
34
+ }
35
+ export declare function _initializeStorageFileFromUploadFileFactory(context: StorageFileServerActionsContext): (input: InitializeStorageFileFromUploadFileInput) => Promise<StorageFileDocument>;
36
+ export declare function initializeStorageFileFromUploadFactory(context: StorageFileServerActionsContext): import("@dereekb/model").TransformAndValidateFunctionResultFunction<InitializeStorageFileFromUploadParams, () => Promise<StorageFileDocument>, object, unknown>;
37
+ export declare function updateStorageFileFactory(context: BaseStorageFileServerActionsContext): import("@dereekb/model").TransformAndValidateFunctionResultFunction<UpdateStorageFileParams, (storageFileDocument: StorageFileDocument) => Promise<StorageFileDocument>, object, unknown>;
38
+ export declare function processAllQueuedStorageFilesFactory(context: StorageFileServerActionsContext): import("@dereekb/model").TransformAndValidateFunctionResultFunction<ProcessAllQueuedStorageFilesParams, () => Promise<ProcessAllQueuedStorageFilesResult>, object, unknown>;
39
+ export declare function processStorageFileFactory(context: StorageFileServerActionsContext): import("@dereekb/model").TransformAndValidateFunctionResultFunction<ProcessStorageFileParams, (storageFileDocument: StorageFileDocument) => Promise<ProcessStorageFileResult>, object, unknown>;
40
+ export declare function deleteAllQueuedStorageFilesFactory(context: StorageFileServerActionsContext): import("@dereekb/model").TransformAndValidateFunctionResultFunction<DeleteAllQueuedStorageFilesParams, () => Promise<DeleteAllQueuedStorageFilesResult>, object, unknown>;
41
+ export declare function deleteStorageFileFactory(context: StorageFileServerActionsContext): import("@dereekb/model").TransformAndValidateFunctionResultFunction<DeleteStorageFileParams, (inputStorageFileDocument: StorageFileDocument) => Promise<void>, object, unknown>;
@@ -0,0 +1,392 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.StorageFileServerActions = exports.STORAGE_FILE_SERVER_ACTION_CONTEXT_TOKEN = exports.BASE_STORAGE_FILE_SERVER_ACTION_CONTEXT_TOKEN = void 0;
4
+ exports.storageFileServerActions = storageFileServerActions;
5
+ exports.createStorageFileFactory = createStorageFileFactory;
6
+ exports.initializeAllStorageFilesFromUploadsFactory = initializeAllStorageFilesFromUploadsFactory;
7
+ exports._initializeStorageFileFromUploadFileFactory = _initializeStorageFileFromUploadFileFactory;
8
+ exports.initializeStorageFileFromUploadFactory = initializeStorageFileFromUploadFactory;
9
+ exports.updateStorageFileFactory = updateStorageFileFactory;
10
+ exports.processAllQueuedStorageFilesFactory = processAllQueuedStorageFilesFactory;
11
+ exports.processStorageFileFactory = processStorageFileFactory;
12
+ exports.deleteAllQueuedStorageFilesFactory = deleteAllQueuedStorageFilesFactory;
13
+ exports.deleteStorageFileFactory = deleteStorageFileFactory;
14
+ const firebase_1 = require("@dereekb/firebase");
15
+ const firebase_server_1 = require("@dereekb/firebase-server");
16
+ const storagefile_error_1 = require("./storagefile.error");
17
+ const util_1 = require("@dereekb/util");
18
+ /**
19
+ * Injection token for the BaseStorageFileServerActionsContext
20
+ */
21
+ exports.BASE_STORAGE_FILE_SERVER_ACTION_CONTEXT_TOKEN = 'BASE_STORAGE_FILE_SERVER_ACTION_CONTEXT';
22
+ /**
23
+ * Injection token for the StorageFileServerActionsContext
24
+ */
25
+ exports.STORAGE_FILE_SERVER_ACTION_CONTEXT_TOKEN = 'STORAGE_FILE_SERVER_ACTION_CONTEXT';
26
+ class StorageFileServerActions {
27
+ }
28
+ exports.StorageFileServerActions = StorageFileServerActions;
29
+ function storageFileServerActions(context) {
30
+ return {
31
+ createStorageFile: createStorageFileFactory(context),
32
+ initializeAllStorageFilesFromUploads: initializeAllStorageFilesFromUploadsFactory(context),
33
+ initializeStorageFileFromUpload: initializeStorageFileFromUploadFactory(context),
34
+ updateStorageFile: updateStorageFileFactory(context),
35
+ processAllQueuedStorageFiles: processAllQueuedStorageFilesFactory(context),
36
+ processStorageFile: processStorageFileFactory(context),
37
+ deleteAllQueuedStorageFiles: deleteAllQueuedStorageFilesFactory(context),
38
+ deleteStorageFile: deleteStorageFileFactory(context)
39
+ };
40
+ }
41
+ // MARK: Actions
42
+ function createStorageFileFactory(context) {
43
+ const { storageFileCollection, firestoreContext, firebaseServerActionTransformFunctionFactory } = context;
44
+ return firebaseServerActionTransformFunctionFactory(firebase_1.CreateStorageFileParams, async (params) => {
45
+ const {} = params;
46
+ return async () => {
47
+ const storageFileDocument = null;
48
+ // TODO: check the file exists, and pull the metadata, and create the document
49
+ return storageFileDocument;
50
+ };
51
+ });
52
+ }
53
+ function initializeAllStorageFilesFromUploadsFactory(context) {
54
+ const { storageService, firebaseServerActionTransformFunctionFactory } = context;
55
+ const _initializeStorageFileFromUploadFile = _initializeStorageFileFromUploadFileFactory(context);
56
+ return firebaseServerActionTransformFunctionFactory(firebase_1.InitializeAllStorageFilesFromUploadsParams, async (params) => {
57
+ const { folderPath, maxFilesToInitialize, overrideUploadsFolderPath } = params;
58
+ const fullPath = (0, util_1.mergeSlashPaths)([overrideUploadsFolderPath ?? firebase_1.UPLOADS_FOLDER_PATH, folderPath]); // only targets the uploads folder
59
+ return async () => {
60
+ const folder = storageService.folder(fullPath);
61
+ const modelKeys = [];
62
+ let filesVisited = 0;
63
+ let initializationsSuccessCount = 0;
64
+ let initializationsFailureCount = 0;
65
+ await (0, firebase_1.iterateStorageListFilesByEachFile)({
66
+ folder,
67
+ includeNestedResults: true,
68
+ readItemsFromPageResult: (results) => results.result.files(),
69
+ iterateEachPageItem: async (file) => {
70
+ const fileInstance = file.file();
71
+ const initializeResult = await _initializeStorageFileFromUploadFile({ file: fileInstance }).catch(() => null);
72
+ filesVisited++;
73
+ if (initializeResult) {
74
+ initializationsSuccessCount++;
75
+ modelKeys.push(initializeResult.key);
76
+ }
77
+ else {
78
+ initializationsFailureCount++;
79
+ }
80
+ },
81
+ /**
82
+ * The maximum number of files to initialize at once.
83
+ */
84
+ iterateItemsLimit: maxFilesToInitialize ?? 1000,
85
+ /**
86
+ * Iterate four separate pages at a time
87
+ */
88
+ maxParallelPages: 4
89
+ });
90
+ const result = {
91
+ modelKeys,
92
+ filesVisited,
93
+ initializationsSuccessCount,
94
+ initializationsFailureCount
95
+ };
96
+ return result;
97
+ };
98
+ });
99
+ }
100
+ function _initializeStorageFileFromUploadFileFactory(context) {
101
+ const { storageFileInitializeFromUploadService } = context;
102
+ return async (input) => {
103
+ const { file } = input;
104
+ const { bucketId, pathString } = file.storagePath;
105
+ // file must exist
106
+ const exists = await file.exists();
107
+ if (!exists) {
108
+ throw (0, storagefile_error_1.uploadedFileDoesNotExistError)();
109
+ }
110
+ // file must be allowed to be initialized
111
+ const isAllowedToBeInitialized = await storageFileInitializeFromUploadService.checkFileIsAllowedToBeInitialized(file);
112
+ if (!isAllowedToBeInitialized) {
113
+ throw (0, storagefile_error_1.uploadedFileIsNotAllowedToBeInitializedError)();
114
+ }
115
+ let storageFileDocument;
116
+ let initializationResult;
117
+ let httpsError;
118
+ try {
119
+ initializationResult = await storageFileInitializeFromUploadService.initializeFromUpload({
120
+ file
121
+ });
122
+ async function deleteFile() {
123
+ try {
124
+ // can now delete the uploaded file
125
+ await file.delete();
126
+ }
127
+ catch (e) {
128
+ // log errors here, but do nothing.
129
+ console.error(`initializeStorageFileFromUpload(): Error deleting uploaded file (${bucketId}/${pathString})`, e);
130
+ }
131
+ }
132
+ switch (initializationResult.resultType) {
133
+ case 'success':
134
+ await deleteFile();
135
+ if (initializationResult.storageFileDocument) {
136
+ storageFileDocument = initializationResult.storageFileDocument;
137
+ }
138
+ else {
139
+ httpsError = (0, storagefile_error_1.uploadedFileInitializationDiscardedError)();
140
+ }
141
+ break;
142
+ case 'initializer_error':
143
+ if (initializationResult.initializationError) {
144
+ throw initializationResult.initializationError; // re-throw the encountered error
145
+ }
146
+ break;
147
+ case 'permanent_initializer_failure':
148
+ // log the error
149
+ if (initializationResult.initializationError) {
150
+ console.warn(`initializeStorageFileFromUpload(): Permanent initializer failure for file (${bucketId}/${pathString})`, initializationResult.initializationError);
151
+ }
152
+ // delete the file
153
+ await deleteFile();
154
+ // return the error
155
+ httpsError = (0, storagefile_error_1.uploadedFileInitializationFailedError)({
156
+ resultType: initializationResult.resultType,
157
+ fileDeleted: true
158
+ });
159
+ break;
160
+ case 'no_determiner_match':
161
+ case 'no_initializer_configured':
162
+ default:
163
+ httpsError = (0, storagefile_error_1.uploadedFileInitializationFailedError)({
164
+ resultType: initializationResult.resultType
165
+ });
166
+ console.error(`initializeStorageFileFromUpload(): Unknown file type (${initializationResult.resultType}) encountered for storage file "${bucketId}/${pathString}".`);
167
+ break;
168
+ }
169
+ }
170
+ catch (e) {
171
+ console.error(`initializeStorageFileFromUpload(): Error while initializing storage file (${bucketId}/${pathString}) from upload`, e);
172
+ httpsError = (0, storagefile_error_1.uploadedFileInitializationFailedError)({ resultType: 'initializer_error' });
173
+ }
174
+ if (httpsError) {
175
+ throw httpsError;
176
+ }
177
+ else if (!storageFileDocument) {
178
+ throw (0, storagefile_error_1.uploadedFileInitializationDiscardedError)(); // throw again for redundancy
179
+ }
180
+ return storageFileDocument;
181
+ };
182
+ }
183
+ function initializeStorageFileFromUploadFactory(context) {
184
+ const { storageService, firebaseServerActionTransformFunctionFactory } = context;
185
+ const _initializeStorageFileFromUploadFile = _initializeStorageFileFromUploadFileFactory(context);
186
+ return firebaseServerActionTransformFunctionFactory(firebase_1.InitializeStorageFileFromUploadParams, async (params) => {
187
+ const { bucketId, pathString } = params;
188
+ return async () => {
189
+ const file = storageService.file(bucketId == null ? pathString : { bucketId, pathString });
190
+ return _initializeStorageFileFromUploadFile({ file });
191
+ };
192
+ });
193
+ }
194
+ function updateStorageFileFactory(context) {
195
+ const { storageFileCollection, firestoreContext, firebaseServerActionTransformFunctionFactory } = context;
196
+ return firebaseServerActionTransformFunctionFactory(firebase_1.UpdateStorageFileParams, async (params) => {
197
+ const { sdat } = params;
198
+ return async (storageFileDocument) => {
199
+ const updateTemplate = {
200
+ sdat
201
+ };
202
+ await storageFileDocument.update(updateTemplate);
203
+ return storageFileDocument;
204
+ };
205
+ });
206
+ }
207
+ function processAllQueuedStorageFilesFactory(context) {
208
+ const { storageFileCollection, firebaseServerActionTransformFunctionFactory } = context;
209
+ const processStorageFile = processStorageFileFactory(context);
210
+ return firebaseServerActionTransformFunctionFactory(firebase_1.ProcessAllQueuedStorageFilesParams, async (params) => {
211
+ return async () => {
212
+ let storageFilesVisited = 0;
213
+ let storageFilesProcessStarted = 0;
214
+ let storageFilesFailedStarting = 0;
215
+ await (0, firebase_1.iterateFirestoreDocumentSnapshotPairs)({
216
+ documentAccessor: storageFileCollection.documentAccessor(),
217
+ iterateSnapshotPair: async (snapshotPair) => {
218
+ storageFilesVisited++;
219
+ const processStorageFileResult = await processStorageFile(snapshotPair.document).catch(() => null);
220
+ if (processStorageFileResult) {
221
+ storageFilesProcessStarted++;
222
+ }
223
+ else {
224
+ storageFilesFailedStarting++;
225
+ }
226
+ },
227
+ constraintsFactory: () => (0, firebase_1.storageFilesQueuedForProcessingQuery)(),
228
+ queryFactory: storageFileCollection,
229
+ batchSize: undefined,
230
+ performTasksConfig: {
231
+ maxParallelTasks: 10
232
+ }
233
+ });
234
+ const result = {
235
+ storageFilesVisited,
236
+ storageFilesProcessStarted,
237
+ storageFilesFailedStarting
238
+ };
239
+ return result;
240
+ };
241
+ });
242
+ }
243
+ function processStorageFileFactory(context) {
244
+ const { storageFileCollection, notificationCollectionGroup, firestoreContext, notificationExpediteService, firebaseServerActionTransformFunctionFactory } = context;
245
+ return firebaseServerActionTransformFunctionFactory(firebase_1.ProcessStorageFileParams, async (params) => {
246
+ const { runImmediately, checkRetryProcessing, forceRestartProcessing } = params;
247
+ return async (storageFileDocument) => {
248
+ const result = {};
249
+ const expediteInstance = notificationExpediteService.expediteInstance();
250
+ await firestoreContext.runTransaction(async (transaction) => {
251
+ expediteInstance.initialize();
252
+ const storageFileDocumentInTransaction = await storageFileCollection.documentAccessorForTransaction(transaction).loadDocumentFrom(storageFileDocument);
253
+ const storageFile = await (0, firebase_server_1.assertSnapshotData)(storageFileDocumentInTransaction);
254
+ async function beginProcessing(overrideExistingTask) {
255
+ const state = storageFile.fs;
256
+ // check the storageFile is in the OK state
257
+ if (state !== firebase_1.StorageFileState.OK) {
258
+ throw (0, storagefile_error_1.storageFileProcessingNotAllowedForInvalidStateError)();
259
+ }
260
+ const createNotificationTaskResult = await (0, firebase_1.createNotificationDocument)({
261
+ context,
262
+ transaction,
263
+ template: (0, firebase_1.storageFileProcessingNotificationTaskTemplate)({
264
+ storageFileDocument,
265
+ overrideExistingTask
266
+ })
267
+ });
268
+ await storageFileDocumentInTransaction.update({
269
+ ps: firebase_1.StorageFileProcessingState.PROCESSING,
270
+ pat: new Date(), // set new processing start date
271
+ pcat: null, // clear processing completion date
272
+ pn: createNotificationTaskResult.notificationDocument.key
273
+ });
274
+ expediteInstance.enqueueCreateResult(createNotificationTaskResult);
275
+ }
276
+ switch (storageFile.ps) {
277
+ case firebase_1.StorageFileProcessingState.INIT_OR_NONE:
278
+ // queue up for processing, unless it has no purpose
279
+ if (!storageFile.p) {
280
+ throw (0, storagefile_error_1.storageFileProcessingNotAvailableForTypeError)();
281
+ }
282
+ else {
283
+ await beginProcessing(false);
284
+ }
285
+ break;
286
+ case firebase_1.StorageFileProcessingState.QUEUED_FOR_PROCESSING:
287
+ // begin processing
288
+ await beginProcessing(false);
289
+ break;
290
+ case firebase_1.StorageFileProcessingState.PROCESSING:
291
+ // check if the processing task is still running
292
+ const shouldCheckProcessing = !(0, util_1.isThrottled)(firebase_1.STORAGE_FILE_PROCESSING_STUCK_THROTTLE_CHECK_MS, storageFile.pat);
293
+ if (!storageFile.pn) {
294
+ await beginProcessing(true); // if no processing task is set, restart processing to recover from the broken state
295
+ }
296
+ else if (checkRetryProcessing || shouldCheckProcessing) {
297
+ const { pn } = storageFile;
298
+ const notificationDocument = notificationCollectionGroup.documentAccessorForTransaction(transaction).loadDocumentForKey(pn);
299
+ const notification = await notificationDocument.snapshotData();
300
+ if (!notification) {
301
+ // the notification document is missing. Re-begin processing
302
+ await beginProcessing(true);
303
+ }
304
+ else if (notification.d || forceRestartProcessing) {
305
+ // if the notification is somehow in the done state but the StorageFile never got notified in the same transaction, requeue.
306
+ await beginProcessing(true);
307
+ }
308
+ // NOTE: We could look at the state of the notification task more, but at this point the task is probably still valid and still running,
309
+ // so we can only wait on it. In general if the task still exists and is not yet done, then we should wait on it as the
310
+ // task running system should complete eventually by design.
311
+ }
312
+ break;
313
+ case firebase_1.StorageFileProcessingState.DO_NOT_PROCESS:
314
+ throw (0, storagefile_error_1.storageFileProcessingNotQueuedForProcessingError)();
315
+ case firebase_1.StorageFileProcessingState.SUCCESS:
316
+ throw (0, storagefile_error_1.storageFileAlreadySuccessfullyProcessedError)();
317
+ }
318
+ });
319
+ // expedite the task if requested
320
+ if (runImmediately) {
321
+ await expediteInstance.send();
322
+ }
323
+ return result;
324
+ };
325
+ });
326
+ }
327
+ function deleteAllQueuedStorageFilesFactory(context) {
328
+ const { storageFileCollection, firebaseServerActionTransformFunctionFactory } = context;
329
+ const deleteStorageFile = deleteStorageFileFactory(context);
330
+ return firebaseServerActionTransformFunctionFactory(firebase_1.DeleteAllQueuedStorageFilesParams, async (params) => {
331
+ return async () => {
332
+ let storageFilesVisited = 0;
333
+ let storageFilesDeleted = 0;
334
+ let storageFilesFailedDeleting = 0;
335
+ const deleteStorageFileInstance = await deleteStorageFile({
336
+ key: (0, firebase_1.firestoreDummyKey)()
337
+ });
338
+ await (0, firebase_1.iterateFirestoreDocumentSnapshotPairs)({
339
+ documentAccessor: storageFileCollection.documentAccessor(),
340
+ iterateSnapshotPair: async (snapshotPair) => {
341
+ const { document: storageFileDocument } = snapshotPair;
342
+ storageFilesVisited++;
343
+ const deleteStorageFileResult = await deleteStorageFileInstance(storageFileDocument)
344
+ .then(() => true)
345
+ .catch(() => false);
346
+ if (deleteStorageFileResult) {
347
+ storageFilesDeleted++;
348
+ }
349
+ else {
350
+ storageFilesFailedDeleting++;
351
+ }
352
+ },
353
+ constraintsFactory: () => (0, firebase_1.storageFilesQueuedForDeleteQuery)(),
354
+ queryFactory: storageFileCollection,
355
+ batchSize: undefined,
356
+ performTasksConfig: {
357
+ maxParallelTasks: 10
358
+ }
359
+ });
360
+ const result = {
361
+ storageFilesDeleted,
362
+ storageFilesFailedDeleting,
363
+ storageFilesVisited
364
+ };
365
+ return result;
366
+ };
367
+ });
368
+ }
369
+ function deleteStorageFileFactory(context) {
370
+ const { storageService, storageFileCollection, firebaseServerActionTransformFunctionFactory } = context;
371
+ return firebaseServerActionTransformFunctionFactory(firebase_1.DeleteStorageFileParams, async (params) => {
372
+ const { force } = params;
373
+ return async (inputStorageFileDocument) => {
374
+ const storageFileDocument = await storageFileCollection.documentAccessor().loadDocumentFrom(inputStorageFileDocument);
375
+ const storageFile = await (0, firebase_server_1.assertSnapshotData)(storageFileDocument);
376
+ const fileAccessor = storageService.file(storageFile);
377
+ if (!force) {
378
+ if (!storageFile.sdat) {
379
+ throw (0, storagefile_error_1.storageFileNotFlaggedForDeletionError)();
380
+ }
381
+ else if (!(0, util_1.isPast)(storageFile.sdat)) {
382
+ throw (0, storagefile_error_1.storageFileCannotBeDeletedYetError)();
383
+ }
384
+ }
385
+ // delete the file
386
+ await fileAccessor.delete().catch(() => null);
387
+ // delete the document
388
+ await storageFileDocument.accessor.delete();
389
+ };
390
+ });
391
+ }
392
+ //# sourceMappingURL=storagefile.action.server.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"storagefile.action.server.js","sourceRoot":"","sources":["../../../../../../../packages/firebase-server/model/src/lib/storagefile/storagefile.action.server.ts"],"names":[],"mappings":";;;AAoEA,4DAWC;AAGD,4DAcC;AAED,kGAsDC;AAMD,kGA8FC;AAED,wFAYC;AAED,4DAgBC;AAED,kFAwCC;AAED,8DAgGC;AAED,gFA+CC;AAED,4DA0BC;AArfD,gDAkC2B;AAC3B,8DAAqK;AAKrK,2DAAkd;AACld,wCAA4E;AAG5E;;GAEG;AACU,QAAA,6CAA6C,GAAmB,yCAAyC,CAAC;AAEvH;;GAEG;AACU,QAAA,wCAAwC,GAAmB,oCAAoC,CAAC;AAK7G,MAAsB,wBAAwB;CAS7C;AATD,4DASC;AAED,SAAgB,wBAAwB,CAAC,OAAwC;IAC/E,OAAO;QACL,iBAAiB,EAAE,wBAAwB,CAAC,OAAO,CAAC;QACpD,oCAAoC,EAAE,2CAA2C,CAAC,OAAO,CAAC;QAC1F,+BAA+B,EAAE,sCAAsC,CAAC,OAAO,CAAC;QAChF,iBAAiB,EAAE,wBAAwB,CAAC,OAAO,CAAC;QACpD,4BAA4B,EAAE,mCAAmC,CAAC,OAAO,CAAC;QAC1E,kBAAkB,EAAE,yBAAyB,CAAC,OAAO,CAAC;QACtD,2BAA2B,EAAE,kCAAkC,CAAC,OAAO,CAAC;QACxE,iBAAiB,EAAE,wBAAwB,CAAC,OAAO,CAAC;KACrD,CAAC;AACJ,CAAC;AAED,gBAAgB;AAChB,SAAgB,wBAAwB,CAAC,OAA4C;IACnF,MAAM,EAAE,qBAAqB,EAAE,gBAAgB,EAAE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esNotExistError(): import("firebase-functions/https").HttpsError;
3
+ export declare function uploadedFileIsNotAllowedToBeInitializedError(): import("firebase-functions/https").HttpsError;
4
+ export declare function uploadedFileInitializationFailedError(data: UploadedFileInitializationFailedErrorData): import("firebase-functions/https").HttpsError;
5
+ export declare function uploadedFileInitializationDiscardedError(): import("firebase-functions/https").HttpsError;
6
+ export declare function storageFileProcessingNotAllowedForInvalidStateError(): import("firebase-functions/https").HttpsError;
7
+ export declare function storageFileProcessingNotQueuedForProcessingError(): import("firebase-functions/https").HttpsError;
8
+ export declare function storageFileProcessingNotAvailableForTypeError(): import("firebase-functions/https").HttpsError;
9
+ export declare function storageFileAlreadySuccessfullyProcessedError(): import("firebase-functions/https").HttpsError;
10
+ export declare function storageFileNotFlaggedForDeletionError(): import("firebase-functions/https").HttpsError;
11
+ export declare function storageFileCannotBeDeletedYetError(): import("firebase-functions/https").HttpsError;