@dereekb/firebase-server 12.6.21 → 13.0.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.
- package/LICENSE +1 -1
- package/index.cjs.js +2937 -0
- package/index.esm.js +2775 -0
- package/mailgun/index.cjs.js +48 -0
- package/mailgun/index.esm.js +46 -0
- package/mailgun/package.json +26 -6
- package/model/index.cjs.js +5298 -0
- package/model/index.d.ts +1 -0
- package/model/index.esm.js +5161 -0
- package/model/package.json +31 -3
- package/model/src/lib/notification/notification.module.d.ts +10 -10
- package/model/src/lib/storagefile/storagefile.task.service.handler.d.ts +3 -14
- package/package.json +48 -27
- package/src/lib/auth/auth.context.d.ts +1 -1
- package/src/lib/auth/auth.service.d.ts +1 -1
- package/src/lib/function/assert.d.ts +2 -2
- package/src/lib/function/context.d.ts +1 -1
- package/src/lib/index.d.ts +1 -0
- package/src/lib/nest/app.d.ts +1 -1
- package/src/lib/nest/development/development.app.function.d.ts +1 -2
- package/src/lib/nest/function/call.d.ts +1 -1
- package/src/lib/nest/function/context.d.ts +0 -4
- package/src/lib/nest/function/index.d.ts +0 -1
- package/src/lib/nest/function/nest.d.ts +1 -1
- package/src/lib/nest/function/v2/blocking.d.ts +3 -2
- package/src/lib/nest/model/crud.assert.function.d.ts +0 -4
- package/src/lib/storage/storage.d.ts +1 -1
- package/src/lib/type.d.ts +9 -0
- package/test/index.cjs.js +1324 -0
- package/test/index.d.ts +1 -0
- package/test/index.esm.js +1247 -0
- package/test/package.json +34 -3
- package/test/src/lib/firebase/firebase.admin.auth.d.ts +22 -13
- package/test/src/lib/firebase/firebase.admin.collection.d.ts +6 -6
- package/test/src/lib/firebase/firebase.admin.d.ts +10 -10
- package/test/src/lib/firebase/firebase.admin.function.d.ts +9 -9
- package/test/src/lib/firebase/firebase.admin.nest.d.ts +8 -8
- package/test/src/lib/firebase/firebase.admin.nest.function.d.ts +9 -9
- package/test/src/lib/firebase/firebase.test.d.ts +30 -0
- package/test/src/lib/firebase/index.d.ts +1 -1
- package/test/src/lib/firestore/firestore.admin.d.ts +3 -3
- package/test/src/lib/firestore/firestore.d.ts +2 -2
- package/test/src/lib/storage/storage.admin.d.ts +3 -3
- package/test/src/lib/storage/storage.d.ts +2 -2
- package/zoho/LICENSE +1 -1
- package/zoho/index.d.ts +1 -0
- package/zoho/index.esm.js +2 -2
- package/zoho/package.json +12 -8
- package/CHANGELOG.md +0 -2233
- package/mailgun/src/index.js +0 -5
- package/mailgun/src/index.js.map +0 -1
- package/mailgun/src/lib/auth.mailgun.js +0 -41
- package/mailgun/src/lib/auth.mailgun.js.map +0 -1
- package/mailgun/src/lib/index.js +0 -5
- package/mailgun/src/lib/index.js.map +0 -1
- package/model/src/index.js +0 -5
- package/model/src/index.js.map +0 -1
- package/model/src/lib/index.js +0 -7
- package/model/src/lib/index.js.map +0 -1
- package/model/src/lib/mailgun/index.js +0 -5
- package/model/src/lib/mailgun/index.js.map +0 -1
- package/model/src/lib/mailgun/notification.send.service.mailgun.js +0 -68
- package/model/src/lib/mailgun/notification.send.service.mailgun.js.map +0 -1
- package/model/src/lib/notification/index.js +0 -20
- package/model/src/lib/notification/index.js.map +0 -1
- package/model/src/lib/notification/notification.action.init.service.js +0 -230
- package/model/src/lib/notification/notification.action.init.service.js.map +0 -1
- package/model/src/lib/notification/notification.action.service.js +0 -1487
- package/model/src/lib/notification/notification.action.service.js.map +0 -1
- package/model/src/lib/notification/notification.config.js +0 -13
- package/model/src/lib/notification/notification.config.js.map +0 -1
- package/model/src/lib/notification/notification.config.service.js +0 -60
- package/model/src/lib/notification/notification.config.service.js.map +0 -1
- package/model/src/lib/notification/notification.create.run.js +0 -59
- package/model/src/lib/notification/notification.create.run.js.map +0 -1
- package/model/src/lib/notification/notification.error.js +0 -87
- package/model/src/lib/notification/notification.error.js.map +0 -1
- package/model/src/lib/notification/notification.expedite.service.js +0 -112
- package/model/src/lib/notification/notification.expedite.service.js.map +0 -1
- package/model/src/lib/notification/notification.module.js +0 -106
- package/model/src/lib/notification/notification.module.js.map +0 -1
- package/model/src/lib/notification/notification.send.js +0 -3
- package/model/src/lib/notification/notification.send.js.map +0 -1
- package/model/src/lib/notification/notification.send.service.js +0 -10
- package/model/src/lib/notification/notification.send.service.js.map +0 -1
- package/model/src/lib/notification/notification.send.service.notificationsummary.js +0 -104
- package/model/src/lib/notification/notification.send.service.notificationsummary.js.map +0 -1
- package/model/src/lib/notification/notification.send.service.text.js +0 -29
- package/model/src/lib/notification/notification.send.service.text.js.map +0 -1
- package/model/src/lib/notification/notification.task.service.handler.js +0 -65
- package/model/src/lib/notification/notification.task.service.handler.js.map +0 -1
- package/model/src/lib/notification/notification.task.service.js +0 -10
- package/model/src/lib/notification/notification.task.service.js.map +0 -1
- package/model/src/lib/notification/notification.task.service.util.js +0 -27
- package/model/src/lib/notification/notification.task.service.util.js.map +0 -1
- package/model/src/lib/notification/notification.task.subtask.handler.js +0 -256
- package/model/src/lib/notification/notification.task.subtask.handler.js.map +0 -1
- package/model/src/lib/notification/notification.util.js +0 -478
- package/model/src/lib/notification/notification.util.js.map +0 -1
- package/model/src/lib/storagefile/index.js +0 -12
- package/model/src/lib/storagefile/index.js.map +0 -1
- package/model/src/lib/storagefile/storagefile.action.init.service.js +0 -155
- package/model/src/lib/storagefile/storagefile.action.init.service.js.map +0 -1
- package/model/src/lib/storagefile/storagefile.action.server.js +0 -797
- package/model/src/lib/storagefile/storagefile.action.server.js.map +0 -1
- package/model/src/lib/storagefile/storagefile.error.js +0 -106
- package/model/src/lib/storagefile/storagefile.error.js.map +0 -1
- package/model/src/lib/storagefile/storagefile.module.js +0 -64
- package/model/src/lib/storagefile/storagefile.module.js.map +0 -1
- package/model/src/lib/storagefile/storagefile.task.service.handler.js +0 -287
- package/model/src/lib/storagefile/storagefile.task.service.handler.js.map +0 -1
- package/model/src/lib/storagefile/storagefile.upload.service.initializer.js +0 -180
- package/model/src/lib/storagefile/storagefile.upload.service.initializer.js.map +0 -1
- package/model/src/lib/storagefile/storagefile.upload.service.js +0 -10
- package/model/src/lib/storagefile/storagefile.upload.service.js.map +0 -1
- package/model/src/lib/storagefile/storagefile.util.js +0 -54
- package/model/src/lib/storagefile/storagefile.util.js.map +0 -1
- package/src/index.js +0 -5
- package/src/index.js.map +0 -1
- package/src/lib/auth/auth.context.js +0 -13
- package/src/lib/auth/auth.context.js.map +0 -1
- package/src/lib/auth/auth.service.error.js +0 -34
- package/src/lib/auth/auth.service.error.js.map +0 -1
- package/src/lib/auth/auth.service.js +0 -427
- package/src/lib/auth/auth.service.js.map +0 -1
- package/src/lib/auth/auth.util.js +0 -23
- package/src/lib/auth/auth.util.js.map +0 -1
- package/src/lib/auth/index.js +0 -8
- package/src/lib/auth/index.js.map +0 -1
- package/src/lib/env/env.service.js +0 -7
- package/src/lib/env/env.service.js.map +0 -1
- package/src/lib/env/index.js +0 -5
- package/src/lib/env/index.js.map +0 -1
- package/src/lib/firestore/array.js +0 -34
- package/src/lib/firestore/array.js.map +0 -1
- package/src/lib/firestore/driver.accessor.batch.js +0 -93
- package/src/lib/firestore/driver.accessor.batch.js.map +0 -1
- package/src/lib/firestore/driver.accessor.default.js +0 -62
- package/src/lib/firestore/driver.accessor.default.js.map +0 -1
- package/src/lib/firestore/driver.accessor.js +0 -50
- package/src/lib/firestore/driver.accessor.js.map +0 -1
- package/src/lib/firestore/driver.accessor.transaction.js +0 -96
- package/src/lib/firestore/driver.accessor.transaction.js.map +0 -1
- package/src/lib/firestore/driver.js +0 -14
- package/src/lib/firestore/driver.js.map +0 -1
- package/src/lib/firestore/driver.query.js +0 -55
- package/src/lib/firestore/driver.query.js.map +0 -1
- package/src/lib/firestore/firestore.js +0 -10
- package/src/lib/firestore/firestore.js.map +0 -1
- package/src/lib/firestore/increment.js +0 -17
- package/src/lib/firestore/increment.js.map +0 -1
- package/src/lib/firestore/index.js +0 -9
- package/src/lib/firestore/index.js.map +0 -1
- package/src/lib/function/assert.js +0 -68
- package/src/lib/function/assert.js.map +0 -1
- package/src/lib/function/context.js +0 -14
- package/src/lib/function/context.js.map +0 -1
- package/src/lib/function/error.auth.js +0 -25
- package/src/lib/function/error.auth.js.map +0 -1
- package/src/lib/function/error.js +0 -221
- package/src/lib/function/error.js.map +0 -1
- package/src/lib/function/index.js +0 -9
- package/src/lib/function/index.js.map +0 -1
- package/src/lib/function/type.js +0 -3
- package/src/lib/function/type.js.map +0 -1
- package/src/lib/index.js +0 -11
- package/src/lib/index.js.map +0 -1
- package/src/lib/nest/app.js +0 -114
- package/src/lib/nest/app.js.map +0 -1
- package/src/lib/nest/auth/auth.module.js +0 -60
- package/src/lib/nest/auth/auth.module.js.map +0 -1
- package/src/lib/nest/auth/auth.util.js +0 -72
- package/src/lib/nest/auth/auth.util.js.map +0 -1
- package/src/lib/nest/auth/index.js +0 -6
- package/src/lib/nest/auth/index.js.map +0 -1
- package/src/lib/nest/development/development.app.function.js +0 -38
- package/src/lib/nest/development/development.app.function.js.map +0 -1
- package/src/lib/nest/development/development.assert.function.js +0 -3
- package/src/lib/nest/development/development.assert.function.js.map +0 -1
- package/src/lib/nest/development/development.function.js +0 -41
- package/src/lib/nest/development/development.function.js.map +0 -1
- package/src/lib/nest/development/development.schedule.function.error.js +0 -35
- package/src/lib/nest/development/development.schedule.function.error.js.map +0 -1
- package/src/lib/nest/development/development.schedule.function.js +0 -54
- package/src/lib/nest/development/development.schedule.function.js.map +0 -1
- package/src/lib/nest/development/index.js +0 -9
- package/src/lib/nest/development/index.js.map +0 -1
- package/src/lib/nest/env/env.service.js +0 -19
- package/src/lib/nest/env/env.service.js.map +0 -1
- package/src/lib/nest/env/env.util.js +0 -12
- package/src/lib/nest/env/env.util.js.map +0 -1
- package/src/lib/nest/env/index.js +0 -6
- package/src/lib/nest/env/index.js.map +0 -1
- package/src/lib/nest/firebase/firebase.module.js +0 -17
- package/src/lib/nest/firebase/firebase.module.js.map +0 -1
- package/src/lib/nest/firebase/index.js +0 -5
- package/src/lib/nest/firebase/index.js.map +0 -1
- package/src/lib/nest/firestore/firestore.module.js +0 -86
- package/src/lib/nest/firestore/firestore.module.js.map +0 -1
- package/src/lib/nest/firestore/index.js +0 -5
- package/src/lib/nest/firestore/index.js.map +0 -1
- package/src/lib/nest/function/call.js +0 -46
- package/src/lib/nest/function/call.js.map +0 -1
- package/src/lib/nest/function/context.js +0 -79
- package/src/lib/nest/function/context.js.map +0 -1
- package/src/lib/nest/function/index.js +0 -10
- package/src/lib/nest/function/index.js.map +0 -1
- package/src/lib/nest/function/nest.js +0 -17
- package/src/lib/nest/function/nest.js.map +0 -1
- package/src/lib/nest/function/schedule.js +0 -8
- package/src/lib/nest/function/schedule.js.map +0 -1
- package/src/lib/nest/function/v1/call.d.ts +0 -59
- package/src/lib/nest/function/v1/call.js +0 -55
- package/src/lib/nest/function/v1/call.js.map +0 -1
- package/src/lib/nest/function/v1/event.d.ts +0 -80
- package/src/lib/nest/function/v1/event.js +0 -52
- package/src/lib/nest/function/v1/event.js.map +0 -1
- package/src/lib/nest/function/v1/index.d.ts +0 -3
- package/src/lib/nest/function/v1/index.js +0 -7
- package/src/lib/nest/function/v1/index.js.map +0 -1
- package/src/lib/nest/function/v1/schedule.d.ts +0 -47
- package/src/lib/nest/function/v1/schedule.js +0 -68
- package/src/lib/nest/function/v1/schedule.js.map +0 -1
- package/src/lib/nest/function/v2/blocking.js +0 -38
- package/src/lib/nest/function/v2/blocking.js.map +0 -1
- package/src/lib/nest/function/v2/call.js +0 -31
- package/src/lib/nest/function/v2/call.js.map +0 -1
- package/src/lib/nest/function/v2/event.js +0 -25
- package/src/lib/nest/function/v2/event.js.map +0 -1
- package/src/lib/nest/function/v2/index.js +0 -9
- package/src/lib/nest/function/v2/index.js.map +0 -1
- package/src/lib/nest/function/v2/schedule.js +0 -56
- package/src/lib/nest/function/v2/schedule.js.map +0 -1
- package/src/lib/nest/function/v2/taskqueue.js +0 -26
- package/src/lib/nest/function/v2/taskqueue.js.map +0 -1
- package/src/lib/nest/index.js +0 -15
- package/src/lib/nest/index.js.map +0 -1
- package/src/lib/nest/middleware/appcheck.decorator.js +0 -12
- package/src/lib/nest/middleware/appcheck.decorator.js.map +0 -1
- package/src/lib/nest/middleware/appcheck.js +0 -3
- package/src/lib/nest/middleware/appcheck.js.map +0 -1
- package/src/lib/nest/middleware/appcheck.middleware.js +0 -74
- package/src/lib/nest/middleware/appcheck.middleware.js.map +0 -1
- package/src/lib/nest/middleware/appcheck.module.js +0 -21
- package/src/lib/nest/middleware/appcheck.module.js.map +0 -1
- package/src/lib/nest/middleware/globalprefix.js +0 -11
- package/src/lib/nest/middleware/globalprefix.js.map +0 -1
- package/src/lib/nest/middleware/index.js +0 -10
- package/src/lib/nest/middleware/index.js.map +0 -1
- package/src/lib/nest/middleware/rawbody.middleware.js +0 -16
- package/src/lib/nest/middleware/rawbody.middleware.js.map +0 -1
- package/src/lib/nest/middleware/webhook.js +0 -24
- package/src/lib/nest/middleware/webhook.js.map +0 -1
- package/src/lib/nest/model/call.model.function.js +0 -73
- package/src/lib/nest/model/call.model.function.js.map +0 -1
- package/src/lib/nest/model/create.model.function.js +0 -27
- package/src/lib/nest/model/create.model.function.js.map +0 -1
- package/src/lib/nest/model/crud.assert.function.js +0 -3
- package/src/lib/nest/model/crud.assert.function.js.map +0 -1
- package/src/lib/nest/model/delete.model.function.js +0 -27
- package/src/lib/nest/model/delete.model.function.js.map +0 -1
- package/src/lib/nest/model/index.js +0 -11
- package/src/lib/nest/model/index.js.map +0 -1
- package/src/lib/nest/model/permission.error.js +0 -24
- package/src/lib/nest/model/permission.error.js.map +0 -1
- package/src/lib/nest/model/read.model.function.js +0 -27
- package/src/lib/nest/model/read.model.function.js.map +0 -1
- package/src/lib/nest/model/specifier.function.js +0 -35
- package/src/lib/nest/model/specifier.function.js.map +0 -1
- package/src/lib/nest/model/update.model.function.js +0 -27
- package/src/lib/nest/model/update.model.function.js.map +0 -1
- package/src/lib/nest/nest.provider.js +0 -89
- package/src/lib/nest/nest.provider.js.map +0 -1
- package/src/lib/nest/storage/index.js +0 -5
- package/src/lib/nest/storage/index.js.map +0 -1
- package/src/lib/nest/storage/storage.module.js +0 -112
- package/src/lib/nest/storage/storage.module.js.map +0 -1
- package/src/lib/storage/driver.accessor.js +0 -299
- package/src/lib/storage/driver.accessor.js.map +0 -1
- package/src/lib/storage/driver.js +0 -12
- package/src/lib/storage/driver.js.map +0 -1
- package/src/lib/storage/index.js +0 -8
- package/src/lib/storage/index.js.map +0 -1
- package/src/lib/storage/storage.js +0 -20
- package/src/lib/storage/storage.js.map +0 -1
- package/src/lib/storage/storage.service.js +0 -26
- package/src/lib/storage/storage.service.js.map +0 -1
- package/test/src/index.js +0 -5
- package/test/src/index.js.map +0 -1
- package/test/src/lib/firebase/firebase.admin.auth.js +0 -260
- package/test/src/lib/firebase/firebase.admin.auth.js.map +0 -1
- package/test/src/lib/firebase/firebase.admin.collection.js +0 -108
- package/test/src/lib/firebase/firebase.admin.collection.js.map +0 -1
- package/test/src/lib/firebase/firebase.admin.function.js +0 -132
- package/test/src/lib/firebase/firebase.admin.function.js.map +0 -1
- package/test/src/lib/firebase/firebase.admin.js +0 -174
- package/test/src/lib/firebase/firebase.admin.js.map +0 -1
- package/test/src/lib/firebase/firebase.admin.nest.function.callable.context.js +0 -42
- package/test/src/lib/firebase/firebase.admin.nest.function.callable.context.js.map +0 -1
- package/test/src/lib/firebase/firebase.admin.nest.function.cloud.context.js +0 -40
- package/test/src/lib/firebase/firebase.admin.nest.function.cloud.context.js.map +0 -1
- package/test/src/lib/firebase/firebase.admin.nest.function.js +0 -64
- package/test/src/lib/firebase/firebase.admin.nest.function.js.map +0 -1
- package/test/src/lib/firebase/firebase.admin.nest.js +0 -107
- package/test/src/lib/firebase/firebase.admin.nest.js.map +0 -1
- package/test/src/lib/firebase/firebase.admin.test.server.js +0 -37
- package/test/src/lib/firebase/firebase.admin.test.server.js.map +0 -1
- package/test/src/lib/firebase/firebase.function.js +0 -58
- package/test/src/lib/firebase/firebase.function.js.map +0 -1
- package/test/src/lib/firebase/firebase.jest.d.ts +0 -21
- package/test/src/lib/firebase/firebase.jest.js +0 -45
- package/test/src/lib/firebase/firebase.jest.js.map +0 -1
- package/test/src/lib/firebase/firebase.js +0 -74
- package/test/src/lib/firebase/firebase.js.map +0 -1
- package/test/src/lib/firebase/index.js +0 -15
- package/test/src/lib/firebase/index.js.map +0 -1
- package/test/src/lib/firestore/firestore.admin.js +0 -21
- package/test/src/lib/firestore/firestore.admin.js.map +0 -1
- package/test/src/lib/firestore/firestore.js +0 -57
- package/test/src/lib/firestore/firestore.js.map +0 -1
- package/test/src/lib/firestore/index.js +0 -6
- package/test/src/lib/firestore/index.js.map +0 -1
- package/test/src/lib/index.js +0 -7
- package/test/src/lib/index.js.map +0 -1
- package/test/src/lib/storage/index.js +0 -6
- package/test/src/lib/storage/index.js.map +0 -1
- package/test/src/lib/storage/storage.admin.js +0 -21
- package/test/src/lib/storage/storage.admin.js.map +0 -1
- package/test/src/lib/storage/storage.js +0 -59
- package/test/src/lib/storage/storage.js.map +0 -1
- /package/{zoho/index.cjs.d.ts → index.d.ts} +0 -0
- /package/{zoho/index.esm.d.ts → mailgun/index.d.ts} +0 -0
|
@@ -1,797 +0,0 @@
|
|
|
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.updateStorageFileGroupFactory = updateStorageFileGroupFactory;
|
|
11
|
-
exports.processAllQueuedStorageFilesFactory = processAllQueuedStorageFilesFactory;
|
|
12
|
-
exports._processStorageFileInTransactionFactory = _processStorageFileInTransactionFactory;
|
|
13
|
-
exports.processStorageFileFactory = processStorageFileFactory;
|
|
14
|
-
exports.deleteAllQueuedStorageFilesFactory = deleteAllQueuedStorageFilesFactory;
|
|
15
|
-
exports.deleteStorageFileFactory = deleteStorageFileFactory;
|
|
16
|
-
exports.downloadStorageFileFactory = downloadStorageFileFactory;
|
|
17
|
-
exports.createStorageFileGroupInTransactionFactory = createStorageFileGroupInTransactionFactory;
|
|
18
|
-
exports.createStorageFileGroupFactory = createStorageFileGroupFactory;
|
|
19
|
-
exports._syncStorageFileWithGroupsInTransactionFactory = _syncStorageFileWithGroupsInTransactionFactory;
|
|
20
|
-
exports.syncStorageFileWithGroupsFactory = syncStorageFileWithGroupsFactory;
|
|
21
|
-
exports.syncAllFlaggedStorageFilesWithGroupsFactory = syncAllFlaggedStorageFilesWithGroupsFactory;
|
|
22
|
-
exports.regenerateStorageFileGroupContentFactory = regenerateStorageFileGroupContentFactory;
|
|
23
|
-
exports.regenerateAllFlaggedStorageFileGroupsContentFactory = regenerateAllFlaggedStorageFileGroupsContentFactory;
|
|
24
|
-
const firebase_1 = require("@dereekb/firebase");
|
|
25
|
-
const firebase_server_1 = require("@dereekb/firebase-server");
|
|
26
|
-
const storagefile_error_1 = require("./storagefile.error");
|
|
27
|
-
const util_1 = require("@dereekb/util");
|
|
28
|
-
const date_1 = require("@dereekb/date");
|
|
29
|
-
const date_fns_1 = require("date-fns");
|
|
30
|
-
/**
|
|
31
|
-
* Injection token for the BaseStorageFileServerActionsContext
|
|
32
|
-
*/
|
|
33
|
-
exports.BASE_STORAGE_FILE_SERVER_ACTION_CONTEXT_TOKEN = 'BASE_STORAGE_FILE_SERVER_ACTION_CONTEXT';
|
|
34
|
-
/**
|
|
35
|
-
* Injection token for the StorageFileServerActionsContext
|
|
36
|
-
*/
|
|
37
|
-
exports.STORAGE_FILE_SERVER_ACTION_CONTEXT_TOKEN = 'STORAGE_FILE_SERVER_ACTION_CONTEXT';
|
|
38
|
-
class StorageFileServerActions {
|
|
39
|
-
}
|
|
40
|
-
exports.StorageFileServerActions = StorageFileServerActions;
|
|
41
|
-
function storageFileServerActions(context) {
|
|
42
|
-
return {
|
|
43
|
-
createStorageFile: createStorageFileFactory(context),
|
|
44
|
-
initializeAllStorageFilesFromUploads: initializeAllStorageFilesFromUploadsFactory(context),
|
|
45
|
-
initializeStorageFileFromUpload: initializeStorageFileFromUploadFactory(context),
|
|
46
|
-
updateStorageFile: updateStorageFileFactory(context),
|
|
47
|
-
processAllQueuedStorageFiles: processAllQueuedStorageFilesFactory(context),
|
|
48
|
-
processStorageFile: processStorageFileFactory(context),
|
|
49
|
-
deleteAllQueuedStorageFiles: deleteAllQueuedStorageFilesFactory(context),
|
|
50
|
-
deleteStorageFile: deleteStorageFileFactory(context),
|
|
51
|
-
downloadStorageFile: downloadStorageFileFactory(context),
|
|
52
|
-
createStorageFileGroup: createStorageFileGroupFactory(context),
|
|
53
|
-
updateStorageFileGroup: updateStorageFileGroupFactory(context),
|
|
54
|
-
syncStorageFileWithGroups: syncStorageFileWithGroupsFactory(context),
|
|
55
|
-
syncAllFlaggedStorageFilesWithGroups: syncAllFlaggedStorageFilesWithGroupsFactory(context),
|
|
56
|
-
regenerateStorageFileGroupContent: regenerateStorageFileGroupContentFactory(context),
|
|
57
|
-
regenerateAllFlaggedStorageFileGroupsContent: regenerateAllFlaggedStorageFileGroupsContentFactory(context)
|
|
58
|
-
};
|
|
59
|
-
}
|
|
60
|
-
// MARK: Actions
|
|
61
|
-
function createStorageFileFactory(context) {
|
|
62
|
-
const { storageFileCollection, firestoreContext, firebaseServerActionTransformFunctionFactory } = context;
|
|
63
|
-
return firebaseServerActionTransformFunctionFactory(firebase_1.CreateStorageFileParams, async (params) => {
|
|
64
|
-
const {} = params;
|
|
65
|
-
return async () => {
|
|
66
|
-
const storageFileDocument = null;
|
|
67
|
-
// TODO: check the file exists, and pull the metadata, and create the document
|
|
68
|
-
return storageFileDocument;
|
|
69
|
-
};
|
|
70
|
-
});
|
|
71
|
-
}
|
|
72
|
-
function initializeAllStorageFilesFromUploadsFactory(context) {
|
|
73
|
-
const { storageService, firebaseServerActionTransformFunctionFactory } = context;
|
|
74
|
-
const _initializeStorageFileFromUploadFile = _initializeStorageFileFromUploadFileFactory(context);
|
|
75
|
-
return firebaseServerActionTransformFunctionFactory(firebase_1.InitializeAllStorageFilesFromUploadsParams, async (params) => {
|
|
76
|
-
const { folderPath, maxFilesToInitialize, overrideUploadsFolderPath } = params;
|
|
77
|
-
const fullPath = (0, util_1.mergeSlashPaths)([overrideUploadsFolderPath ?? firebase_1.UPLOADS_FOLDER_PATH, folderPath]); // only targets the uploads folder
|
|
78
|
-
return async () => {
|
|
79
|
-
const folder = storageService.folder(fullPath);
|
|
80
|
-
const modelKeys = [];
|
|
81
|
-
let filesVisited = 0;
|
|
82
|
-
let initializationsSuccessCount = 0;
|
|
83
|
-
let initializationsFailureCount = 0;
|
|
84
|
-
await (0, firebase_1.iterateStorageListFilesByEachFile)({
|
|
85
|
-
folder,
|
|
86
|
-
includeNestedResults: true,
|
|
87
|
-
readItemsFromPageResult: (results) => results.result.files(),
|
|
88
|
-
iterateEachPageItem: async (file) => {
|
|
89
|
-
const fileInstance = file.file();
|
|
90
|
-
const initializeResult = await _initializeStorageFileFromUploadFile({ file: fileInstance }).catch(() => null);
|
|
91
|
-
filesVisited++;
|
|
92
|
-
if (initializeResult) {
|
|
93
|
-
initializationsSuccessCount++;
|
|
94
|
-
modelKeys.push(initializeResult.key);
|
|
95
|
-
}
|
|
96
|
-
else {
|
|
97
|
-
initializationsFailureCount++;
|
|
98
|
-
}
|
|
99
|
-
},
|
|
100
|
-
/**
|
|
101
|
-
* The maximum number of files to initialize at once.
|
|
102
|
-
*/
|
|
103
|
-
iterateItemsLimit: maxFilesToInitialize ?? 1000,
|
|
104
|
-
/**
|
|
105
|
-
* Iterate four separate pages at a time
|
|
106
|
-
*/
|
|
107
|
-
maxParallelPages: 4
|
|
108
|
-
});
|
|
109
|
-
const result = {
|
|
110
|
-
modelKeys,
|
|
111
|
-
filesVisited,
|
|
112
|
-
initializationsSuccessCount,
|
|
113
|
-
initializationsFailureCount
|
|
114
|
-
};
|
|
115
|
-
return result;
|
|
116
|
-
};
|
|
117
|
-
});
|
|
118
|
-
}
|
|
119
|
-
function _initializeStorageFileFromUploadFileFactory(context) {
|
|
120
|
-
const { firestoreContext, storageFileInitializeFromUploadService, notificationExpediteService } = context;
|
|
121
|
-
const processStorageFileInTransaction = _processStorageFileInTransactionFactory(context);
|
|
122
|
-
return async (input) => {
|
|
123
|
-
const { file, expediteProcessing } = input;
|
|
124
|
-
const { bucketId, pathString } = file.storagePath;
|
|
125
|
-
// file must exist
|
|
126
|
-
const exists = await file.exists();
|
|
127
|
-
if (!exists) {
|
|
128
|
-
throw (0, storagefile_error_1.uploadedFileDoesNotExistError)();
|
|
129
|
-
}
|
|
130
|
-
// file must be allowed to be initialized
|
|
131
|
-
const isAllowedToBeInitialized = await storageFileInitializeFromUploadService.checkFileIsAllowedToBeInitialized(file);
|
|
132
|
-
if (!isAllowedToBeInitialized) {
|
|
133
|
-
throw (0, storagefile_error_1.uploadedFileIsNotAllowedToBeInitializedError)();
|
|
134
|
-
}
|
|
135
|
-
let storageFileDocument;
|
|
136
|
-
let initializationResult;
|
|
137
|
-
let httpsError;
|
|
138
|
-
try {
|
|
139
|
-
initializationResult = await storageFileInitializeFromUploadService.initializeFromUpload({
|
|
140
|
-
file
|
|
141
|
-
});
|
|
142
|
-
async function deleteFile() {
|
|
143
|
-
try {
|
|
144
|
-
// can now delete the uploaded file
|
|
145
|
-
await file.delete();
|
|
146
|
-
}
|
|
147
|
-
catch (e) {
|
|
148
|
-
// log errors here, but do nothing.
|
|
149
|
-
console.error(`initializeStorageFileFromUpload(): Error deleting uploaded file (${bucketId}/${pathString})`, e);
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
switch (initializationResult.resultType) {
|
|
153
|
-
case 'success':
|
|
154
|
-
await deleteFile();
|
|
155
|
-
if (initializationResult.storageFileDocument) {
|
|
156
|
-
storageFileDocument = initializationResult.storageFileDocument;
|
|
157
|
-
// expedite processing if requested
|
|
158
|
-
if (storageFileDocument != null && expediteProcessing) {
|
|
159
|
-
const storageFile = await (0, firebase_server_1.assertSnapshotData)(storageFileDocument);
|
|
160
|
-
if (storageFile.ps === firebase_1.StorageFileProcessingState.QUEUED_FOR_PROCESSING) {
|
|
161
|
-
const expediteInstance = notificationExpediteService.expediteInstance();
|
|
162
|
-
await firestoreContext.runTransaction(async (transaction) => {
|
|
163
|
-
expediteInstance.initialize();
|
|
164
|
-
await processStorageFileInTransaction({
|
|
165
|
-
storageFileDocument: storageFileDocument,
|
|
166
|
-
expediteInstance
|
|
167
|
-
}, transaction);
|
|
168
|
-
});
|
|
169
|
-
await expediteInstance.send().catch(() => null);
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
else {
|
|
174
|
-
httpsError = (0, storagefile_error_1.uploadedFileInitializationDiscardedError)();
|
|
175
|
-
}
|
|
176
|
-
break;
|
|
177
|
-
case 'initializer_error':
|
|
178
|
-
if (initializationResult.initializationError) {
|
|
179
|
-
throw initializationResult.initializationError; // re-throw the encountered error
|
|
180
|
-
}
|
|
181
|
-
break;
|
|
182
|
-
case 'permanent_initializer_failure':
|
|
183
|
-
// log the error
|
|
184
|
-
if (initializationResult.initializationError) {
|
|
185
|
-
console.warn(`initializeStorageFileFromUpload(): Permanent initializer failure for file (${bucketId}/${pathString})`, initializationResult.initializationError);
|
|
186
|
-
}
|
|
187
|
-
// delete the file
|
|
188
|
-
await deleteFile();
|
|
189
|
-
// return the error
|
|
190
|
-
httpsError = (0, storagefile_error_1.uploadedFileInitializationFailedError)({
|
|
191
|
-
resultType: initializationResult.resultType,
|
|
192
|
-
fileDeleted: true
|
|
193
|
-
});
|
|
194
|
-
break;
|
|
195
|
-
case 'no_determiner_match':
|
|
196
|
-
case 'no_initializer_configured':
|
|
197
|
-
default:
|
|
198
|
-
httpsError = (0, storagefile_error_1.uploadedFileInitializationFailedError)({
|
|
199
|
-
resultType: initializationResult.resultType
|
|
200
|
-
});
|
|
201
|
-
console.error(`initializeStorageFileFromUpload(): Unknown file type (${initializationResult.resultType}) encountered for storage file "${bucketId}/${pathString}".`);
|
|
202
|
-
break;
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
catch (e) {
|
|
206
|
-
console.error(`initializeStorageFileFromUpload(): Error while initializing storage file (${bucketId}/${pathString}) from upload`, e);
|
|
207
|
-
httpsError = (0, storagefile_error_1.uploadedFileInitializationFailedError)({ resultType: 'initializer_error' });
|
|
208
|
-
}
|
|
209
|
-
if (httpsError) {
|
|
210
|
-
throw httpsError;
|
|
211
|
-
}
|
|
212
|
-
else if (!storageFileDocument) {
|
|
213
|
-
throw (0, storagefile_error_1.uploadedFileInitializationDiscardedError)(); // throw again for redundancy
|
|
214
|
-
}
|
|
215
|
-
return storageFileDocument;
|
|
216
|
-
};
|
|
217
|
-
}
|
|
218
|
-
function initializeStorageFileFromUploadFactory(context) {
|
|
219
|
-
const { storageService, firebaseServerActionTransformFunctionFactory } = context;
|
|
220
|
-
const _initializeStorageFileFromUploadFile = _initializeStorageFileFromUploadFileFactory(context);
|
|
221
|
-
return firebaseServerActionTransformFunctionFactory(firebase_1.InitializeStorageFileFromUploadParams, async (params) => {
|
|
222
|
-
const { bucketId, pathString, expediteProcessing } = params;
|
|
223
|
-
return async () => {
|
|
224
|
-
const file = storageService.file(bucketId == null ? pathString : { bucketId, pathString });
|
|
225
|
-
return _initializeStorageFileFromUploadFile({ file, expediteProcessing });
|
|
226
|
-
};
|
|
227
|
-
});
|
|
228
|
-
}
|
|
229
|
-
function updateStorageFileFactory(context) {
|
|
230
|
-
const { storageFileCollection, firestoreContext, firebaseServerActionTransformFunctionFactory } = context;
|
|
231
|
-
return firebaseServerActionTransformFunctionFactory(firebase_1.UpdateStorageFileParams, async (params) => {
|
|
232
|
-
const { sdat } = params;
|
|
233
|
-
return async (storageFileDocument) => {
|
|
234
|
-
const updateTemplate = {
|
|
235
|
-
sdat
|
|
236
|
-
};
|
|
237
|
-
await storageFileDocument.update(updateTemplate);
|
|
238
|
-
return storageFileDocument;
|
|
239
|
-
};
|
|
240
|
-
});
|
|
241
|
-
}
|
|
242
|
-
function updateStorageFileGroupFactory(context) {
|
|
243
|
-
const { firestoreContext, storageFileGroupCollection, firebaseServerActionTransformFunctionFactory } = context;
|
|
244
|
-
return firebaseServerActionTransformFunctionFactory(firebase_1.UpdateStorageFileGroupParams, async (params) => {
|
|
245
|
-
const { entries } = params;
|
|
246
|
-
return async (storageFileGroupDocument) => {
|
|
247
|
-
await firestoreContext.runTransaction(async (transaction) => {
|
|
248
|
-
const storageFileGroupDocumentInTransaction = storageFileGroupCollection.documentAccessorForTransaction(transaction).loadDocumentFrom(storageFileGroupDocument);
|
|
249
|
-
const storageFileGroup = await (0, firebase_server_1.assertSnapshotData)(storageFileGroupDocumentInTransaction);
|
|
250
|
-
let f = undefined;
|
|
251
|
-
// update entries
|
|
252
|
-
if (entries?.length) {
|
|
253
|
-
f = util_1.ModelRelationUtility.updateCollection(storageFileGroup.f, entries, {
|
|
254
|
-
readKey: (x) => x.s,
|
|
255
|
-
merge: (existing, update) => {
|
|
256
|
-
const n = update.n === undefined ? existing.n : update.n;
|
|
257
|
-
return {
|
|
258
|
-
...existing,
|
|
259
|
-
n
|
|
260
|
-
};
|
|
261
|
-
}
|
|
262
|
-
});
|
|
263
|
-
}
|
|
264
|
-
const updateTemplate = {
|
|
265
|
-
f
|
|
266
|
-
};
|
|
267
|
-
await storageFileGroupDocumentInTransaction.update(updateTemplate);
|
|
268
|
-
});
|
|
269
|
-
return storageFileGroupDocument;
|
|
270
|
-
};
|
|
271
|
-
});
|
|
272
|
-
}
|
|
273
|
-
function processAllQueuedStorageFilesFactory(context) {
|
|
274
|
-
const { storageFileCollection, firebaseServerActionTransformFunctionFactory } = context;
|
|
275
|
-
const processStorageFile = processStorageFileFactory(context);
|
|
276
|
-
return firebaseServerActionTransformFunctionFactory(firebase_1.ProcessAllQueuedStorageFilesParams, async (params) => {
|
|
277
|
-
return async () => {
|
|
278
|
-
let storageFilesVisited = 0;
|
|
279
|
-
let storageFilesProcessStarted = 0;
|
|
280
|
-
let storageFilesFailedStarting = 0;
|
|
281
|
-
const proceessStorageFileParams = {
|
|
282
|
-
key: (0, firebase_1.firestoreDummyKey)()
|
|
283
|
-
};
|
|
284
|
-
const processStorageFileInstance = await processStorageFile(proceessStorageFileParams);
|
|
285
|
-
await (0, firebase_1.iterateFirestoreDocumentSnapshotPairs)({
|
|
286
|
-
documentAccessor: storageFileCollection.documentAccessor(),
|
|
287
|
-
iterateSnapshotPair: async (snapshotPair) => {
|
|
288
|
-
storageFilesVisited++;
|
|
289
|
-
const processStorageFileResult = await processStorageFileInstance(snapshotPair.document).catch(() => null);
|
|
290
|
-
if (processStorageFileResult) {
|
|
291
|
-
storageFilesProcessStarted++;
|
|
292
|
-
}
|
|
293
|
-
else {
|
|
294
|
-
storageFilesFailedStarting++;
|
|
295
|
-
}
|
|
296
|
-
},
|
|
297
|
-
constraintsFactory: () => (0, firebase_1.storageFilesQueuedForProcessingQuery)(),
|
|
298
|
-
queryFactory: storageFileCollection,
|
|
299
|
-
batchSize: undefined,
|
|
300
|
-
performTasksConfig: {
|
|
301
|
-
maxParallelTasks: 10
|
|
302
|
-
}
|
|
303
|
-
});
|
|
304
|
-
const result = {
|
|
305
|
-
storageFilesVisited,
|
|
306
|
-
storageFilesProcessStarted,
|
|
307
|
-
storageFilesFailedStarting
|
|
308
|
-
};
|
|
309
|
-
return result;
|
|
310
|
-
};
|
|
311
|
-
});
|
|
312
|
-
}
|
|
313
|
-
function _processStorageFileInTransactionFactory(context) {
|
|
314
|
-
const { storageFileCollection, notificationCollectionGroup } = context;
|
|
315
|
-
return async (input, transaction) => {
|
|
316
|
-
const { storageFileDocument, storageFile: inputStorageFile, params, expediteInstance } = input;
|
|
317
|
-
const { checkRetryProcessing, forceRestartProcessing, processAgainIfSuccessful } = params ?? {};
|
|
318
|
-
const storageFileDocumentInTransaction = storageFileCollection.documentAccessorForTransaction(transaction).loadDocumentFrom(storageFileDocument);
|
|
319
|
-
const storageFile = inputStorageFile ?? (await (0, firebase_server_1.assertSnapshotData)(storageFileDocumentInTransaction));
|
|
320
|
-
async function beginProcessing(overrideExistingTask) {
|
|
321
|
-
const state = storageFile.fs;
|
|
322
|
-
// check the storageFile is in the OK state
|
|
323
|
-
if (state !== firebase_1.StorageFileState.OK) {
|
|
324
|
-
throw (0, storagefile_error_1.storageFileProcessingNotAllowedForInvalidStateError)();
|
|
325
|
-
}
|
|
326
|
-
const createNotificationTaskResult = await (0, firebase_1.createNotificationDocument)({
|
|
327
|
-
context,
|
|
328
|
-
transaction,
|
|
329
|
-
template: (0, firebase_1.storageFileProcessingNotificationTaskTemplate)({
|
|
330
|
-
storageFileDocument,
|
|
331
|
-
overrideExistingTask
|
|
332
|
-
})
|
|
333
|
-
});
|
|
334
|
-
await storageFileDocumentInTransaction.update({
|
|
335
|
-
ps: firebase_1.StorageFileProcessingState.PROCESSING,
|
|
336
|
-
pat: new Date(), // set new processing start date
|
|
337
|
-
pcat: null, // clear processing completion date
|
|
338
|
-
pn: createNotificationTaskResult.notificationDocument.key
|
|
339
|
-
});
|
|
340
|
-
expediteInstance?.enqueueCreateResult(createNotificationTaskResult);
|
|
341
|
-
}
|
|
342
|
-
switch (storageFile.ps) {
|
|
343
|
-
case firebase_1.StorageFileProcessingState.INIT_OR_NONE:
|
|
344
|
-
// queue up for processing, unless it has no purpose
|
|
345
|
-
if (!storageFile.p) {
|
|
346
|
-
throw (0, storagefile_error_1.storageFileProcessingNotAvailableForTypeError)();
|
|
347
|
-
}
|
|
348
|
-
else {
|
|
349
|
-
await beginProcessing(false);
|
|
350
|
-
}
|
|
351
|
-
break;
|
|
352
|
-
case firebase_1.StorageFileProcessingState.QUEUED_FOR_PROCESSING:
|
|
353
|
-
// begin processing
|
|
354
|
-
await beginProcessing(false);
|
|
355
|
-
break;
|
|
356
|
-
case firebase_1.StorageFileProcessingState.PROCESSING:
|
|
357
|
-
// check if the processing task is still running
|
|
358
|
-
const shouldCheckProcessing = !(0, util_1.isThrottled)(firebase_1.STORAGE_FILE_PROCESSING_STUCK_THROTTLE_CHECK_MS, storageFile.pat);
|
|
359
|
-
if (!storageFile.pn) {
|
|
360
|
-
await beginProcessing(true); // if no processing task is set, restart processing to recover from the broken state
|
|
361
|
-
}
|
|
362
|
-
else {
|
|
363
|
-
const { pn } = storageFile;
|
|
364
|
-
const notificationDocument = notificationCollectionGroup.documentAccessorForTransaction(transaction).loadDocumentForKey(pn);
|
|
365
|
-
if (checkRetryProcessing || shouldCheckProcessing) {
|
|
366
|
-
const notification = await notificationDocument.snapshotData();
|
|
367
|
-
if (!notification) {
|
|
368
|
-
// the notification document is missing. Re-begin processing
|
|
369
|
-
await beginProcessing(true);
|
|
370
|
-
}
|
|
371
|
-
else if (notification.d || forceRestartProcessing) {
|
|
372
|
-
// if the notification is somehow in the done state but the StorageFile never got notified in the same transaction, requeue.
|
|
373
|
-
await beginProcessing(true);
|
|
374
|
-
}
|
|
375
|
-
// 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,
|
|
376
|
-
// 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
|
|
377
|
-
// task running system should complete eventually by design.
|
|
378
|
-
}
|
|
379
|
-
else if (expediteInstance) {
|
|
380
|
-
// enqueue the existing notification to be run in the expedite instance
|
|
381
|
-
expediteInstance.enqueue(notificationDocument);
|
|
382
|
-
}
|
|
383
|
-
}
|
|
384
|
-
break;
|
|
385
|
-
case firebase_1.StorageFileProcessingState.DO_NOT_PROCESS:
|
|
386
|
-
throw (0, storagefile_error_1.storageFileProcessingNotQueuedForProcessingError)();
|
|
387
|
-
case firebase_1.StorageFileProcessingState.SUCCESS:
|
|
388
|
-
if (forceRestartProcessing || processAgainIfSuccessful) {
|
|
389
|
-
await beginProcessing(true);
|
|
390
|
-
}
|
|
391
|
-
else {
|
|
392
|
-
throw (0, storagefile_error_1.storageFileAlreadyProcessedError)();
|
|
393
|
-
}
|
|
394
|
-
break;
|
|
395
|
-
}
|
|
396
|
-
};
|
|
397
|
-
}
|
|
398
|
-
function processStorageFileFactory(context) {
|
|
399
|
-
const { firestoreContext, notificationExpediteService, firebaseServerActionTransformFunctionFactory } = context;
|
|
400
|
-
const processStorageFileInTransaction = _processStorageFileInTransactionFactory(context);
|
|
401
|
-
return firebaseServerActionTransformFunctionFactory(firebase_1.ProcessStorageFileParams, async (params) => {
|
|
402
|
-
const { runImmediately } = params;
|
|
403
|
-
return async (storageFileDocument) => {
|
|
404
|
-
const expediteInstance = notificationExpediteService.expediteInstance();
|
|
405
|
-
await firestoreContext.runTransaction(async (transaction) => {
|
|
406
|
-
expediteInstance.initialize();
|
|
407
|
-
await processStorageFileInTransaction({
|
|
408
|
-
storageFileDocument,
|
|
409
|
-
params,
|
|
410
|
-
expediteInstance
|
|
411
|
-
}, transaction);
|
|
412
|
-
});
|
|
413
|
-
let expediteResult = null;
|
|
414
|
-
// expedite the task if requested
|
|
415
|
-
if (runImmediately) {
|
|
416
|
-
expediteResult = await expediteInstance.send().then((x) => x[0]);
|
|
417
|
-
}
|
|
418
|
-
const result = {
|
|
419
|
-
runImmediately: runImmediately ?? false,
|
|
420
|
-
expediteResult
|
|
421
|
-
};
|
|
422
|
-
return result;
|
|
423
|
-
};
|
|
424
|
-
});
|
|
425
|
-
}
|
|
426
|
-
function deleteAllQueuedStorageFilesFactory(context) {
|
|
427
|
-
const { storageFileCollection, firebaseServerActionTransformFunctionFactory } = context;
|
|
428
|
-
const deleteStorageFile = deleteStorageFileFactory(context);
|
|
429
|
-
return firebaseServerActionTransformFunctionFactory(firebase_1.DeleteAllQueuedStorageFilesParams, async (params) => {
|
|
430
|
-
return async () => {
|
|
431
|
-
let storageFilesVisited = 0;
|
|
432
|
-
let storageFilesDeleted = 0;
|
|
433
|
-
let storageFilesFailedDeleting = 0;
|
|
434
|
-
const deleteStorageFileInstance = await deleteStorageFile({
|
|
435
|
-
key: (0, firebase_1.firestoreDummyKey)()
|
|
436
|
-
});
|
|
437
|
-
await (0, firebase_1.iterateFirestoreDocumentSnapshotPairs)({
|
|
438
|
-
documentAccessor: storageFileCollection.documentAccessor(),
|
|
439
|
-
iterateSnapshotPair: async (snapshotPair) => {
|
|
440
|
-
const { document: storageFileDocument } = snapshotPair;
|
|
441
|
-
storageFilesVisited++;
|
|
442
|
-
const deleteStorageFileResult = await deleteStorageFileInstance(storageFileDocument)
|
|
443
|
-
.then(() => true)
|
|
444
|
-
.catch(() => false);
|
|
445
|
-
if (deleteStorageFileResult) {
|
|
446
|
-
storageFilesDeleted++;
|
|
447
|
-
}
|
|
448
|
-
else {
|
|
449
|
-
storageFilesFailedDeleting++;
|
|
450
|
-
}
|
|
451
|
-
},
|
|
452
|
-
constraintsFactory: () => (0, firebase_1.storageFilesQueuedForDeleteQuery)(),
|
|
453
|
-
queryFactory: storageFileCollection,
|
|
454
|
-
batchSize: undefined,
|
|
455
|
-
performTasksConfig: {
|
|
456
|
-
maxParallelTasks: 10
|
|
457
|
-
}
|
|
458
|
-
});
|
|
459
|
-
const result = {
|
|
460
|
-
storageFilesDeleted,
|
|
461
|
-
storageFilesFailedDeleting,
|
|
462
|
-
storageFilesVisited
|
|
463
|
-
};
|
|
464
|
-
return result;
|
|
465
|
-
};
|
|
466
|
-
});
|
|
467
|
-
}
|
|
468
|
-
function deleteStorageFileFactory(context) {
|
|
469
|
-
const { firestoreContext, storageService, storageFileCollection, firebaseServerActionTransformFunctionFactory } = context;
|
|
470
|
-
const syncStorageFileWithGroupsInTransaction = _syncStorageFileWithGroupsInTransactionFactory(context);
|
|
471
|
-
return firebaseServerActionTransformFunctionFactory(firebase_1.DeleteStorageFileParams, async (params) => {
|
|
472
|
-
const { force } = params;
|
|
473
|
-
return async (inputStorageFileDocument) => {
|
|
474
|
-
await firestoreContext.runTransaction(async (transaction) => {
|
|
475
|
-
const storageFileDocument = await storageFileCollection.documentAccessorForTransaction(transaction).loadDocumentFrom(inputStorageFileDocument);
|
|
476
|
-
const storageFile = await (0, firebase_server_1.assertSnapshotData)(storageFileDocument);
|
|
477
|
-
const fileAccessor = storageService.file(storageFile);
|
|
478
|
-
if (!force) {
|
|
479
|
-
if (!storageFile.sdat) {
|
|
480
|
-
throw (0, storagefile_error_1.storageFileNotFlaggedForDeletionError)();
|
|
481
|
-
}
|
|
482
|
-
else if (!(0, util_1.isPast)(storageFile.sdat)) {
|
|
483
|
-
throw (0, storagefile_error_1.storageFileCannotBeDeletedYetError)();
|
|
484
|
-
}
|
|
485
|
-
}
|
|
486
|
-
// remove the storage file from any groups
|
|
487
|
-
await syncStorageFileWithGroupsInTransaction({ storageFileDocument, storageFile, force: true, removeAllStorageFileGroups: true }, transaction);
|
|
488
|
-
// delete the file
|
|
489
|
-
await fileAccessor.delete().catch(() => null);
|
|
490
|
-
// delete the document
|
|
491
|
-
await storageFileDocument.accessor.delete();
|
|
492
|
-
});
|
|
493
|
-
};
|
|
494
|
-
});
|
|
495
|
-
}
|
|
496
|
-
function downloadStorageFileFactory(context) {
|
|
497
|
-
const { storageService, firebaseServerActionTransformFunctionFactory, storageFileCollection } = context;
|
|
498
|
-
return firebaseServerActionTransformFunctionFactory(firebase_1.DownloadStorageFileParams, async (params) => {
|
|
499
|
-
const { key: targetStorageFileDocumentKey, asAdmin, expiresAt, expiresIn: inputExpiresIn, responseDisposition, responseContentType } = params;
|
|
500
|
-
return async (storageFileDocument) => {
|
|
501
|
-
// if the StorageFileDocument was not provided, set it from the target key
|
|
502
|
-
if (!storageFileDocument) {
|
|
503
|
-
storageFileDocument = storageFileCollection.documentAccessor().loadDocumentForKey(targetStorageFileDocumentKey);
|
|
504
|
-
}
|
|
505
|
-
const storageFile = await (0, firebase_server_1.assertSnapshotData)(storageFileDocument);
|
|
506
|
-
const fileAccessor = storageService.file(storageFile);
|
|
507
|
-
let result;
|
|
508
|
-
if (fileAccessor.getSignedUrl) {
|
|
509
|
-
const expiresIn = inputExpiresIn ?? util_1.MS_IN_MINUTE * 30;
|
|
510
|
-
const expires = (0, util_1.expirationDetails)({ defaultExpiresFromDateToNow: true, expiresAt, expiresIn });
|
|
511
|
-
let downloadUrlExpiresAt = expires.getExpirationDate();
|
|
512
|
-
// if they're not an admin, limit the expiration to a max of 30 days.
|
|
513
|
-
if (downloadUrlExpiresAt && !asAdmin) {
|
|
514
|
-
const maxExpirationDate = (0, date_fns_1.addDays)(new Date(), 30);
|
|
515
|
-
downloadUrlExpiresAt = (0, date_1.findMinDate)([downloadUrlExpiresAt, maxExpirationDate]);
|
|
516
|
-
}
|
|
517
|
-
const [downloadUrl, metadata] = await Promise.all([
|
|
518
|
-
fileAccessor.getSignedUrl({
|
|
519
|
-
action: 'read',
|
|
520
|
-
expiresAt: downloadUrlExpiresAt ?? undefined,
|
|
521
|
-
responseDisposition: responseDisposition ?? undefined, // can be set by anyone
|
|
522
|
-
responseType: asAdmin ? (responseContentType ?? undefined) : undefined // can only be set by admins
|
|
523
|
-
}),
|
|
524
|
-
fileAccessor.getMetadata()
|
|
525
|
-
]);
|
|
526
|
-
result = {
|
|
527
|
-
url: downloadUrl,
|
|
528
|
-
fileName: metadata.name ? (0, util_1.slashPathDetails)(metadata.name).end : undefined,
|
|
529
|
-
mimeType: responseContentType ?? metadata.contentType,
|
|
530
|
-
expiresAt: (0, util_1.unixDateTimeSecondsNumberFromDate)(downloadUrlExpiresAt)
|
|
531
|
-
};
|
|
532
|
-
}
|
|
533
|
-
else {
|
|
534
|
-
throw (0, firebase_server_1.internalServerError)('Signed url function appears to not be avalable.');
|
|
535
|
-
}
|
|
536
|
-
return result;
|
|
537
|
-
};
|
|
538
|
-
});
|
|
539
|
-
}
|
|
540
|
-
function createStorageFileGroupInTransactionFactory(context) {
|
|
541
|
-
const { storageFileGroupCollection } = context;
|
|
542
|
-
return async (params, transaction) => {
|
|
543
|
-
const { now: inputNow, skipCreate, template } = params;
|
|
544
|
-
const now = inputNow ?? new Date();
|
|
545
|
-
const storageFileGroupDocument = (0, firebase_1.loadStorageFileGroupDocumentForReferencePair)(params, storageFileGroupCollection.documentAccessorForTransaction(transaction));
|
|
546
|
-
const storageFileGroupTemplate = {
|
|
547
|
-
o: (0, firebase_1.firestoreDummyKey)(), // set during initialization
|
|
548
|
-
cat: now,
|
|
549
|
-
s: true, // requires initialization
|
|
550
|
-
f: [],
|
|
551
|
-
...template
|
|
552
|
-
};
|
|
553
|
-
if (!skipCreate) {
|
|
554
|
-
await storageFileGroupDocument.create(storageFileGroupTemplate);
|
|
555
|
-
}
|
|
556
|
-
return {
|
|
557
|
-
storageFileGroupTemplate,
|
|
558
|
-
storageFileGroupDocument
|
|
559
|
-
};
|
|
560
|
-
};
|
|
561
|
-
}
|
|
562
|
-
function createStorageFileGroupFactory(context) {
|
|
563
|
-
const { firestoreContext, firebaseServerActionTransformFunctionFactory } = context;
|
|
564
|
-
const createStorageFileGroupInTransaction = createStorageFileGroupInTransactionFactory(context);
|
|
565
|
-
return firebaseServerActionTransformFunctionFactory(firebase_1.CreateStorageFileGroupParams, async (params) => {
|
|
566
|
-
const { model, storageFileId } = params;
|
|
567
|
-
const storageFileGroupRelatedModelKey = model ? model : storageFileId ? (0, firebase_1.inferKeyFromTwoWayFlatFirestoreModelKey)(storageFileId) : undefined;
|
|
568
|
-
if (!storageFileGroupRelatedModelKey) {
|
|
569
|
-
throw (0, storagefile_error_1.createStorageFileGroupInputError)();
|
|
570
|
-
}
|
|
571
|
-
return async () => {
|
|
572
|
-
const result = await firestoreContext.runTransaction(async (transaction) => {
|
|
573
|
-
const { storageFileGroupDocument } = await createStorageFileGroupInTransaction({ storageFileGroupRelatedModelKey }, transaction);
|
|
574
|
-
return storageFileGroupDocument;
|
|
575
|
-
});
|
|
576
|
-
return result;
|
|
577
|
-
};
|
|
578
|
-
});
|
|
579
|
-
}
|
|
580
|
-
function _syncStorageFileWithGroupsInTransactionFactory(context) {
|
|
581
|
-
const { storageFileCollection, storageFileGroupCollection } = context;
|
|
582
|
-
const createStorageFileGroupInTransaction = createStorageFileGroupInTransactionFactory(context);
|
|
583
|
-
return async (input, transaction) => {
|
|
584
|
-
const { storageFileDocument, storageFile: inputStorageFile, force, removeAllStorageFileGroups, skipStorageFileUpdate } = input;
|
|
585
|
-
const storageFileDocumentInTransaction = storageFileCollection.documentAccessorForTransaction(transaction).loadDocumentFrom(storageFileDocument);
|
|
586
|
-
const storageFileGroupDocumentAccessor = storageFileGroupCollection.documentAccessorForTransaction(transaction);
|
|
587
|
-
const storageFile = inputStorageFile ?? (await (0, firebase_server_1.assertSnapshotData)(storageFileDocumentInTransaction));
|
|
588
|
-
if (!storageFile.gs && !force) {
|
|
589
|
-
throw (0, storagefile_error_1.storageFileNotFlaggedForGroupsSyncError)();
|
|
590
|
-
}
|
|
591
|
-
const g = storageFile.g ?? [];
|
|
592
|
-
const storageFileGroupDocuments = (0, firebase_1.loadDocumentsForIds)(storageFileGroupDocumentAccessor, g);
|
|
593
|
-
const storageFileGroupPairs = await (0, firebase_1.getDocumentSnapshotDataPairs)(storageFileGroupDocuments);
|
|
594
|
-
let storageFilesGroupsCreated = 0;
|
|
595
|
-
let storageFilesGroupsUpdated = 0;
|
|
596
|
-
await (0, util_1.performAsyncTasks)(storageFileGroupPairs, async (storageFileGroupPair) => {
|
|
597
|
-
const { data: storageFileGroup, document: storageFileGroupDocument } = storageFileGroupPair;
|
|
598
|
-
const existsInStorageFileGroup = storageFileGroup?.f.some((x) => x.s === storageFileDocument.id);
|
|
599
|
-
const change = removeAllStorageFileGroups ? (existsInStorageFileGroup ? 'remove' : undefined) : !existsInStorageFileGroup ? 'add' : undefined;
|
|
600
|
-
switch (change) {
|
|
601
|
-
case 'add':
|
|
602
|
-
// add it if it doesn't exist
|
|
603
|
-
const createTemplate = (0, firebase_1.calculateStorageFileGroupEmbeddedFileUpdate)({
|
|
604
|
-
storageFileGroup: storageFileGroup ?? { f: [] },
|
|
605
|
-
insert: [
|
|
606
|
-
{
|
|
607
|
-
s: storageFileDocument.id
|
|
608
|
-
}
|
|
609
|
-
],
|
|
610
|
-
allowRecalculateRegenerateFlag: false
|
|
611
|
-
});
|
|
612
|
-
if (!storageFileGroup) {
|
|
613
|
-
// if the group does not exist, then create it
|
|
614
|
-
await createStorageFileGroupInTransaction({ storageFileGroupDocument, template: createTemplate }, transaction);
|
|
615
|
-
storageFilesGroupsCreated += 1;
|
|
616
|
-
}
|
|
617
|
-
else {
|
|
618
|
-
// if the group exists, then update it
|
|
619
|
-
await storageFileGroupDocument.update(createTemplate);
|
|
620
|
-
storageFilesGroupsUpdated += 1;
|
|
621
|
-
}
|
|
622
|
-
break;
|
|
623
|
-
case 'remove':
|
|
624
|
-
// remove it
|
|
625
|
-
const removeTemplate = (0, firebase_1.calculateStorageFileGroupEmbeddedFileUpdate)({
|
|
626
|
-
storageFileGroup: storageFileGroup ?? { f: [] },
|
|
627
|
-
remove: [storageFileDocument.id]
|
|
628
|
-
});
|
|
629
|
-
await storageFileGroupDocument.update(removeTemplate);
|
|
630
|
-
storageFilesGroupsUpdated += 1;
|
|
631
|
-
break;
|
|
632
|
-
}
|
|
633
|
-
});
|
|
634
|
-
const result = {
|
|
635
|
-
storageFilesGroupsCreated,
|
|
636
|
-
storageFilesGroupsUpdated
|
|
637
|
-
};
|
|
638
|
-
// update the storage file to no longer be flagged for sync
|
|
639
|
-
if (!skipStorageFileUpdate) {
|
|
640
|
-
await storageFileDocumentInTransaction.update({
|
|
641
|
-
gs: false
|
|
642
|
-
});
|
|
643
|
-
}
|
|
644
|
-
return result;
|
|
645
|
-
};
|
|
646
|
-
}
|
|
647
|
-
function syncStorageFileWithGroupsFactory(context) {
|
|
648
|
-
const { firestoreContext, storageFileCollection, storageFileGroupCollection, firebaseServerActionTransformFunctionFactory } = context;
|
|
649
|
-
const syncStorageFileWithGroupsInTransaction = _syncStorageFileWithGroupsInTransactionFactory(context);
|
|
650
|
-
return firebaseServerActionTransformFunctionFactory(firebase_1.SyncStorageFileWithGroupsParams, async (params) => {
|
|
651
|
-
const { force } = params;
|
|
652
|
-
return async (storageFileDocument) => {
|
|
653
|
-
return firestoreContext.runTransaction(async (transaction) => syncStorageFileWithGroupsInTransaction({ storageFileDocument, force }, transaction));
|
|
654
|
-
};
|
|
655
|
-
});
|
|
656
|
-
}
|
|
657
|
-
function syncAllFlaggedStorageFilesWithGroupsFactory(context) {
|
|
658
|
-
const { firebaseServerActionTransformFunctionFactory, storageFileCollection } = context;
|
|
659
|
-
const syncStorageFileWithGroups = syncStorageFileWithGroupsFactory(context);
|
|
660
|
-
return firebaseServerActionTransformFunctionFactory(firebase_1.SyncAllFlaggedStorageFilesWithGroupsParams, async (params) => {
|
|
661
|
-
return async () => {
|
|
662
|
-
const syncStorageFileWithGroupsInstance = await syncStorageFileWithGroups({
|
|
663
|
-
key: (0, firebase_1.firestoreDummyKey)(),
|
|
664
|
-
force: true // force anyways; they should all be flagged for sync when the query hits
|
|
665
|
-
});
|
|
666
|
-
let storageFilesSynced = 0;
|
|
667
|
-
let storageFilesGroupsCreated = 0;
|
|
668
|
-
let storageFilesGroupsUpdated = 0;
|
|
669
|
-
await (0, firebase_1.iterateFirestoreDocumentSnapshotPairBatches)({
|
|
670
|
-
documentAccessor: storageFileCollection.documentAccessor(),
|
|
671
|
-
iterateSnapshotPairsBatch: async (snapshotPairBatch) => {
|
|
672
|
-
// only sync StorageFiles that are flagged for sync
|
|
673
|
-
await (0, util_1.runAsyncTasksForValues)(snapshotPairBatch.filter((x) => x.data.gs), async (snapshotPair) => {
|
|
674
|
-
const { document: storageFileDocument } = snapshotPair;
|
|
675
|
-
const result = await syncStorageFileWithGroupsInstance(storageFileDocument);
|
|
676
|
-
storageFilesSynced += 1;
|
|
677
|
-
storageFilesGroupsCreated += result.storageFilesGroupsCreated;
|
|
678
|
-
storageFilesGroupsUpdated += result.storageFilesGroupsUpdated;
|
|
679
|
-
}, {
|
|
680
|
-
maxParallelTasks: 10, // can update 10 storageFiles/Groups at the same time
|
|
681
|
-
nonConcurrentTaskKeyFactory: (x) => x.data.g // do not update the same group at the same time
|
|
682
|
-
});
|
|
683
|
-
},
|
|
684
|
-
queryFactory: storageFileCollection,
|
|
685
|
-
constraintsFactory: () => (0, firebase_1.storageFileFlaggedForSyncWithGroupsQuery)(),
|
|
686
|
-
performTasksConfig: {
|
|
687
|
-
sequential: true // run batches sequentially to avoid contention in updating a StorageFileGroup
|
|
688
|
-
},
|
|
689
|
-
totalSnapshotsLimit: 1000,
|
|
690
|
-
limitPerCheckpoint: 100
|
|
691
|
-
});
|
|
692
|
-
const result = {
|
|
693
|
-
storageFilesSynced,
|
|
694
|
-
storageFilesGroupsCreated,
|
|
695
|
-
storageFilesGroupsUpdated
|
|
696
|
-
};
|
|
697
|
-
return result;
|
|
698
|
-
};
|
|
699
|
-
});
|
|
700
|
-
}
|
|
701
|
-
function regenerateStorageFileGroupContentFactory(context) {
|
|
702
|
-
const { firestoreContext, storageService, storageFileCollection, storageFileGroupCollection, firebaseServerActionTransformFunctionFactory } = context;
|
|
703
|
-
const processStorageFileInTransaction = _processStorageFileInTransactionFactory(context);
|
|
704
|
-
return firebaseServerActionTransformFunctionFactory(firebase_1.RegenerateStorageFileGroupContentParams, async (params) => {
|
|
705
|
-
const { force } = params;
|
|
706
|
-
const createStorageFileDocumentPair = (0, firebase_1.createStorageFileDocumentPairFactory)({
|
|
707
|
-
defaultCreationType: firebase_1.StorageFileCreationType.FOR_STORAGE_FILE_GROUP
|
|
708
|
-
});
|
|
709
|
-
return async (storageFileGroupDocument) => {
|
|
710
|
-
return firestoreContext.runTransaction(async (transaction) => {
|
|
711
|
-
const storageFileGroupDocumentInTransaction = storageFileGroupCollection.documentAccessorForTransaction(transaction).loadDocumentFrom(storageFileGroupDocument);
|
|
712
|
-
const storageFileGroup = await (0, firebase_server_1.assertSnapshotData)(storageFileGroupDocumentInTransaction);
|
|
713
|
-
const storageFileDocumentAccessor = storageFileCollection.documentAccessorForTransaction(transaction);
|
|
714
|
-
const { o, zsf, s } = storageFileGroup;
|
|
715
|
-
// must not be queued for initialization
|
|
716
|
-
if (s) {
|
|
717
|
-
throw (0, storagefile_error_1.storageFileGroupQueuedForInitializationError)();
|
|
718
|
-
}
|
|
719
|
-
const existingZipStorageFileDocument = zsf ? storageFileDocumentAccessor.loadDocumentForId(zsf) : undefined;
|
|
720
|
-
const [existingZipStorageFilePair] = await Promise.all([existingZipStorageFileDocument ? (0, firebase_1.getDocumentSnapshotDataPair)(existingZipStorageFileDocument) : undefined]);
|
|
721
|
-
let contentStorageFilesFlaggedForProcessing = 0;
|
|
722
|
-
const updateTemplate = {
|
|
723
|
-
re: false // clear the regeneration flag
|
|
724
|
-
};
|
|
725
|
-
// For each content type, create/update/flag the StorageFile for processing that type
|
|
726
|
-
const { regenerateZip } = (0, firebase_1.calculateStorageFileGroupRegeneration)({ storageFileGroup, force });
|
|
727
|
-
if (regenerateZip) {
|
|
728
|
-
// check that the storageFile exists, and if it doesn't, create a new one
|
|
729
|
-
if (!existingZipStorageFilePair?.data) {
|
|
730
|
-
const zipStorageFile = storageService.file((0, firebase_1.storageFileGroupZipFileStoragePath)(storageFileGroupDocument.id));
|
|
731
|
-
// create a new StorageFile
|
|
732
|
-
const { storageFileDocument } = await createStorageFileDocumentPair({
|
|
733
|
-
storagePathRef: zipStorageFile,
|
|
734
|
-
accessor: storageFileDocumentAccessor,
|
|
735
|
-
parentStorageFileGroup: storageFileGroupDocument,
|
|
736
|
-
purpose: firebase_1.STORAGE_FILE_GROUP_ZIP_STORAGE_FILE_PURPOSE,
|
|
737
|
-
shouldBeProcessed: true,
|
|
738
|
-
ownershipKey: o,
|
|
739
|
-
metadata: {
|
|
740
|
-
sfg: storageFileGroupDocument.id
|
|
741
|
-
}
|
|
742
|
-
});
|
|
743
|
-
updateTemplate.zsf = storageFileDocument.id;
|
|
744
|
-
}
|
|
745
|
-
else {
|
|
746
|
-
// flag it for processing again
|
|
747
|
-
await processStorageFileInTransaction({ params: { processAgainIfSuccessful: true }, storageFileDocument: existingZipStorageFilePair.document, storageFile: existingZipStorageFilePair.data }, transaction);
|
|
748
|
-
}
|
|
749
|
-
contentStorageFilesFlaggedForProcessing += 1;
|
|
750
|
-
}
|
|
751
|
-
// update the StorageFileGroup
|
|
752
|
-
await storageFileGroupDocumentInTransaction.update(updateTemplate);
|
|
753
|
-
const result = {
|
|
754
|
-
contentStorageFilesFlaggedForProcessing
|
|
755
|
-
};
|
|
756
|
-
return result;
|
|
757
|
-
});
|
|
758
|
-
};
|
|
759
|
-
});
|
|
760
|
-
}
|
|
761
|
-
function regenerateAllFlaggedStorageFileGroupsContentFactory(context) {
|
|
762
|
-
const { firebaseServerActionTransformFunctionFactory, storageFileGroupCollection } = context;
|
|
763
|
-
const regenerateStorageFileGroupContent = regenerateStorageFileGroupContentFactory(context);
|
|
764
|
-
return firebaseServerActionTransformFunctionFactory(firebase_1.RegenerateAllFlaggedStorageFileGroupsContentParams, async (params) => {
|
|
765
|
-
return async () => {
|
|
766
|
-
const regenerateStorageFileGroupContentInstance = await regenerateStorageFileGroupContent({
|
|
767
|
-
key: (0, firebase_1.firestoreDummyKey)()
|
|
768
|
-
});
|
|
769
|
-
let storageFileGroupsUpdated = 0;
|
|
770
|
-
let contentStorageFilesFlaggedForProcessing = 0;
|
|
771
|
-
await (0, firebase_1.iterateFirestoreDocumentSnapshotPairs)({
|
|
772
|
-
documentAccessor: storageFileGroupCollection.documentAccessor(),
|
|
773
|
-
iterateSnapshotPair: async (snapshotPair) => {
|
|
774
|
-
const { data: storageFileGroup } = snapshotPair;
|
|
775
|
-
if (!storageFileGroup.s) {
|
|
776
|
-
const result = await regenerateStorageFileGroupContentInstance(snapshotPair.document);
|
|
777
|
-
storageFileGroupsUpdated += 1;
|
|
778
|
-
contentStorageFilesFlaggedForProcessing += result.contentStorageFilesFlaggedForProcessing;
|
|
779
|
-
}
|
|
780
|
-
},
|
|
781
|
-
queryFactory: storageFileGroupCollection,
|
|
782
|
-
constraintsFactory: () => (0, firebase_1.storageFileGroupsFlaggedForContentRegenerationQuery)(),
|
|
783
|
-
performTasksConfig: {
|
|
784
|
-
maxParallelTasks: 10
|
|
785
|
-
},
|
|
786
|
-
totalSnapshotsLimit: 1000,
|
|
787
|
-
limitPerCheckpoint: 100
|
|
788
|
-
});
|
|
789
|
-
const result = {
|
|
790
|
-
storageFileGroupsUpdated,
|
|
791
|
-
contentStorageFilesFlaggedForProcessing
|
|
792
|
-
};
|
|
793
|
-
return result;
|
|
794
|
-
};
|
|
795
|
-
});
|
|
796
|
-
}
|
|
797
|
-
//# sourceMappingURL=storagefile.action.server.js.map
|