@dereekb/firebase-server 13.4.1 → 13.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (101) hide show
  1. package/index.cjs.js +455 -113
  2. package/index.esm.js +456 -114
  3. package/mailgun/package.json +9 -9
  4. package/model/index.cjs.js +645 -350
  5. package/model/index.esm.js +646 -351
  6. package/model/package.json +9 -9
  7. package/model/src/lib/mailgun/notification.send.service.mailgun.d.ts +1 -0
  8. package/model/src/lib/notification/index.d.ts +2 -2
  9. package/model/src/lib/notification/{notification.action.service.d.ts → notification.action.server.d.ts} +53 -1
  10. package/model/src/lib/notification/{notification.action.init.service.d.ts → notification.action.server.init.d.ts} +20 -0
  11. package/model/src/lib/notification/notification.config.service.d.ts +2 -0
  12. package/model/src/lib/notification/notification.create.run.d.ts +1 -0
  13. package/model/src/lib/notification/notification.error.d.ts +16 -0
  14. package/model/src/lib/notification/notification.expedite.service.d.ts +11 -3
  15. package/model/src/lib/notification/notification.module.d.ts +19 -6
  16. package/model/src/lib/notification/notification.send.service.notificationsummary.d.ts +1 -0
  17. package/model/src/lib/notification/notification.send.service.text.d.ts +2 -0
  18. package/model/src/lib/notification/notification.task.service.handler.d.ts +1 -0
  19. package/model/src/lib/notification/notification.task.service.util.d.ts +1 -0
  20. package/model/src/lib/notification/notification.task.subtask.handler.d.ts +3 -0
  21. package/model/src/lib/notification/notification.util.d.ts +4 -2
  22. package/model/src/lib/storagefile/index.d.ts +1 -1
  23. package/model/src/lib/storagefile/storagefile.action.server.d.ts +98 -1
  24. package/model/src/lib/storagefile/{storagefile.action.init.service.d.ts → storagefile.action.server.init.d.ts} +13 -2
  25. package/model/src/lib/storagefile/storagefile.error.d.ts +27 -0
  26. package/model/src/lib/storagefile/storagefile.module.d.ts +14 -4
  27. package/model/src/lib/storagefile/storagefile.task.service.handler.d.ts +29 -7
  28. package/model/src/lib/storagefile/storagefile.upload.service.initializer.d.ts +2 -0
  29. package/oidc/index.cjs.js +150 -32
  30. package/oidc/index.esm.js +150 -32
  31. package/oidc/package.json +10 -10
  32. package/oidc/src/lib/controller/oidc.interaction.controller.d.ts +12 -0
  33. package/oidc/src/lib/controller/oidc.wellknown.controller.d.ts +6 -0
  34. package/oidc/src/lib/model/jwks/jwks.d.ts +9 -0
  35. package/oidc/src/lib/model/jwks/jwks.query.d.ts +9 -0
  36. package/oidc/src/lib/model/oidc/oidcmodel.action.server.d.ts +13 -0
  37. package/oidc/src/lib/model/oidc/oidcmodel.module.d.ts +5 -1
  38. package/oidc/src/lib/oidc.config.d.ts +2 -1
  39. package/oidc/src/lib/oidc.module.d.ts +9 -2
  40. package/oidc/src/lib/service/oidc.account.service.d.ts +7 -0
  41. package/oidc/src/lib/service/oidc.adapter.service.d.ts +1 -0
  42. package/oidc/src/lib/service/oidc.config.service.d.ts +1 -0
  43. package/oidc/src/lib/service/oidc.encryption.service.d.ts +6 -0
  44. package/oidc/src/lib/service/oidc.interaction.service.d.ts +15 -0
  45. package/oidc/src/lib/service/oidc.jwks.service.d.ts +18 -2
  46. package/oidc/src/lib/service/oidc.service.d.ts +7 -3
  47. package/package.json +10 -10
  48. package/src/lib/auth/auth.context.d.ts +1 -0
  49. package/src/lib/auth/auth.service.d.ts +13 -0
  50. package/src/lib/env/env.config.d.ts +2 -0
  51. package/src/lib/env/env.service.d.ts +21 -7
  52. package/src/lib/firestore/array.d.ts +1 -0
  53. package/src/lib/firestore/driver.accessor.batch.d.ts +4 -0
  54. package/src/lib/firestore/driver.accessor.d.ts +4 -0
  55. package/src/lib/firestore/driver.accessor.default.d.ts +5 -1
  56. package/src/lib/firestore/driver.accessor.transaction.d.ts +4 -0
  57. package/src/lib/firestore/driver.d.ts +2 -0
  58. package/src/lib/firestore/driver.query.d.ts +4 -0
  59. package/src/lib/firestore/increment.d.ts +1 -0
  60. package/src/lib/function/assert.d.ts +7 -0
  61. package/src/lib/function/context.d.ts +4 -0
  62. package/src/lib/function/error.auth.d.ts +2 -0
  63. package/src/lib/function/error.d.ts +86 -11
  64. package/src/lib/index.d.ts +0 -1
  65. package/src/lib/nest/analytics/analytics.service.listener.d.ts +2 -0
  66. package/src/lib/nest/app.d.ts +6 -3
  67. package/src/lib/nest/auth/auth.module.d.ts +6 -0
  68. package/src/lib/nest/auth/auth.util.d.ts +19 -1
  69. package/src/lib/nest/development/development.app.function.d.ts +12 -4
  70. package/src/lib/nest/development/development.assert.function.d.ts +6 -2
  71. package/src/lib/nest/development/development.function.d.ts +6 -1
  72. package/src/lib/nest/development/development.schedule.function.d.ts +3 -1
  73. package/src/lib/nest/development/development.schedule.function.error.d.ts +8 -0
  74. package/src/lib/nest/env/env.service.d.ts +2 -0
  75. package/src/lib/nest/env/env.util.d.ts +6 -0
  76. package/src/lib/nest/firebase/firebase.module.d.ts +1 -0
  77. package/src/lib/nest/firestore/firestore.module.d.ts +8 -0
  78. package/src/lib/nest/function/context.d.ts +2 -0
  79. package/src/lib/nest/model/analytics.details.d.ts +21 -7
  80. package/src/lib/nest/model/analytics.emit.d.ts +3 -0
  81. package/src/lib/nest/model/analytics.handler.d.ts +30 -10
  82. package/src/lib/nest/model/api.details.d.ts +34 -1
  83. package/src/lib/nest/model/call.model.function.d.ts +20 -4
  84. package/src/lib/nest/model/create.model.function.d.ts +6 -1
  85. package/src/lib/nest/model/crud.assert.function.d.ts +12 -4
  86. package/src/lib/nest/model/delete.model.function.d.ts +6 -1
  87. package/src/lib/nest/model/permission.error.d.ts +7 -0
  88. package/src/lib/nest/model/read.model.function.d.ts +6 -1
  89. package/src/lib/nest/model/specifier.function.d.ts +3 -0
  90. package/src/lib/nest/model/update.model.function.d.ts +6 -1
  91. package/src/lib/nest/nest.provider.d.ts +10 -0
  92. package/src/lib/nest/storage/storage.module.d.ts +9 -0
  93. package/src/lib/storage/driver.accessor.d.ts +22 -0
  94. package/src/lib/storage/driver.d.ts +2 -0
  95. package/src/lib/storage/storage.d.ts +1 -0
  96. package/test/package.json +10 -10
  97. package/zoho/index.cjs.js +8 -6
  98. package/zoho/index.esm.js +8 -6
  99. package/zoho/package.json +9 -9
  100. package/zoho/src/lib/zoho.accounts.firebase.d.ts +2 -1
  101. package/zoho/src/lib/zoho.accounts.firebase.system.d.ts +2 -1
@@ -66,6 +66,9 @@ export declare abstract class StorageFileServerActions {
66
66
  *
67
67
  * @param context - the fully assembled storage file server actions context
68
68
  *
69
+ * @param context - the fully assembled storage file server actions context
70
+ * @returns a concrete {@link StorageFileServerActions} with all action methods wired to their factories
71
+ *
69
72
  * @example
70
73
  * ```ts
71
74
  * const actions = storageFileServerActions(context);
@@ -78,14 +81,20 @@ export declare function storageFileServerActions(context: StorageFileServerActio
78
81
  * Factory for the `createStorageFile` action.
79
82
  *
80
83
  * Creates a new {@link StorageFile} document using the provided template data.
84
+ *
85
+ * @param context - the base server actions context providing Firestore and storage access
86
+ * @returns an async transform-and-validate function that creates a StorageFile document
81
87
  */
82
- export declare function createStorageFileFactory(context: BaseStorageFileServerActionsContext): import("@dereekb/model").TransformAndValidateFunctionResultFunction<CreateStorageFileParams, () => Promise<any>, object, unknown>;
88
+ export declare function createStorageFileFactory(context: BaseStorageFileServerActionsContext): import("@dereekb/model").TransformAndValidateFunctionResultFunction<CreateStorageFileParams, () => Promise<StorageFileDocument>, object, unknown>;
83
89
  /**
84
90
  * Factory for the `initializeAllStorageFilesFromUploads` action.
85
91
  *
86
92
  * Scans the uploads folder in Firebase Storage, identifies new uploaded files,
87
93
  * initializes each one via the upload service, and cleans up the source upload
88
94
  * on success. Failed initializations are logged but do not halt the batch.
95
+ *
96
+ * @param context - the storage file server actions context with storage service and upload initialization
97
+ * @returns an async transform-and-validate function that returns batch initialization results
89
98
  */
90
99
  export declare function initializeAllStorageFilesFromUploadsFactory(context: StorageFileServerActionsContext): import("@dereekb/model").TransformAndValidateFunctionResultFunction<InitializeAllStorageFilesFromUploadsParams, () => Promise<InitializeAllStorageFilesFromUploadsResult>, object, unknown>;
91
100
  export interface InitializeStorageFileFromUploadFileInput {
@@ -97,6 +106,15 @@ export interface InitializeStorageFileFromUploadFileInput {
97
106
  */
98
107
  readonly expediteProcessing?: Maybe<boolean>;
99
108
  }
109
+ /**
110
+ * Internal factory that creates a function to initialize a {@link StorageFile} from an uploaded file.
111
+ *
112
+ * Validates the file exists and is allowed, runs the upload initializer, deletes the upload source
113
+ * on success, and optionally expedites processing of the created storage file.
114
+ *
115
+ * @param context - the storage file server actions context
116
+ * @returns an async function that accepts an upload file input and returns the created StorageFileDocument
117
+ */
100
118
  export declare function _initializeStorageFileFromUploadFileFactory(context: StorageFileServerActionsContext): (input: InitializeStorageFileFromUploadFileInput) => Promise<StorageFileDocument>;
101
119
  /**
102
120
  * Factory for the `initializeStorageFileFromUpload` action.
@@ -104,9 +122,29 @@ export declare function _initializeStorageFileFromUploadFileFactory(context: Sto
104
122
  * Initializes a single {@link StorageFile} from an uploaded file at the given storage path.
105
123
  * Validates the file exists and is allowed, runs the type determiner and initializer,
106
124
  * then cleans up the upload source on success.
125
+ *
126
+ * @param context - the storage file server actions context with storage and upload services
127
+ * @returns an async transform-and-validate function that creates a StorageFile from an upload
107
128
  */
108
129
  export declare function initializeStorageFileFromUploadFactory(context: StorageFileServerActionsContext): import("@dereekb/model").TransformAndValidateFunctionResultFunction<InitializeStorageFileFromUploadParams, () => Promise<StorageFileDocument>, object, unknown>;
130
+ /**
131
+ * Factory for the `updateStorageFile` action.
132
+ *
133
+ * Updates an existing {@link StorageFile} document with the provided schedule-delete-at time.
134
+ *
135
+ * @param context - the base server actions context providing Firestore access
136
+ * @returns an async transform-and-validate function that updates a StorageFile document
137
+ */
109
138
  export declare function updateStorageFileFactory(context: BaseStorageFileServerActionsContext): import("@dereekb/model").TransformAndValidateFunctionResultFunction<UpdateStorageFileParams, (storageFileDocument: StorageFileDocument) => Promise<StorageFileDocument>, object, unknown>;
139
+ /**
140
+ * Factory for the `updateStorageFileGroup` action.
141
+ *
142
+ * Updates embedded file entries within a {@link StorageFileGroup} document inside a
143
+ * Firestore transaction, merging display name changes into the existing entries.
144
+ *
145
+ * @param context - the storage file server actions context
146
+ * @returns an async transform-and-validate function that updates a StorageFileGroup document
147
+ */
110
148
  export declare function updateStorageFileGroupFactory(context: StorageFileServerActionsContext): import("@dereekb/model").TransformAndValidateFunctionResultFunction<UpdateStorageFileGroupParams, (storageFileGroupDocument: StorageFileGroupDocument) => Promise<StorageFileGroupDocument>, object, unknown>;
111
149
  /**
112
150
  * Factory for the `processAllQueuedStorageFiles` action.
@@ -114,6 +152,9 @@ export declare function updateStorageFileGroupFactory(context: StorageFileServer
114
152
  * Batch-processes all {@link StorageFile} documents queued for processing. Creates a
115
153
  * processing notification task for each file and optionally expedites delivery.
116
154
  * Handles stuck-processing detection with a throttle check.
155
+ *
156
+ * @param context - the storage file server actions context
157
+ * @returns an async transform-and-validate function that returns batch processing results
117
158
  */
118
159
  export declare function processAllQueuedStorageFilesFactory(context: StorageFileServerActionsContext): import("@dereekb/model").TransformAndValidateFunctionResultFunction<ProcessAllQueuedStorageFilesParams, () => Promise<ProcessAllQueuedStorageFilesResult>, object, unknown>;
119
160
  export interface ProcessStorageFileInTransactionInput {
@@ -134,12 +175,24 @@ export interface ProcessStorageFileInTransactionInput {
134
175
  */
135
176
  readonly expediteInstance?: Maybe<NotificationExpediteServiceInstance>;
136
177
  }
178
+ /**
179
+ * Internal factory that creates a function for processing a {@link StorageFile} within a Firestore transaction.
180
+ *
181
+ * Creates or restarts a notification task for the file based on its current processing state,
182
+ * handling stuck-processing detection, forced restarts, and re-processing of already-successful files.
183
+ *
184
+ * @param context - the storage file server actions context
185
+ * @returns an async function that processes a storage file within a transaction
186
+ */
137
187
  export declare function _processStorageFileInTransactionFactory(context: StorageFileServerActionsContext): (input: ProcessStorageFileInTransactionInput, transaction: Transaction) => Promise<void>;
138
188
  /**
139
189
  * Factory for the `processStorageFile` action.
140
190
  *
141
191
  * Processes a single {@link StorageFile} by creating a notification task for it
142
192
  * and marking it as processing. Validates the file is in a valid state for processing.
193
+ *
194
+ * @param context - the storage file server actions context
195
+ * @returns an async transform-and-validate function that processes a single StorageFile
143
196
  */
144
197
  export declare function processStorageFileFactory(context: StorageFileServerActionsContext): import("@dereekb/model").TransformAndValidateFunctionResultFunction<ProcessStorageFileParams, (storageFileDocument: StorageFileDocument) => Promise<ProcessStorageFileResult>, object, unknown>;
145
198
  /**
@@ -148,6 +201,9 @@ export declare function processStorageFileFactory(context: StorageFileServerActi
148
201
  * Batch-deletes all {@link StorageFile} documents flagged for deletion whose
149
202
  * scheduled delete time has passed. Removes both the Firestore document and
150
203
  * the associated file in Cloud Storage.
204
+ *
205
+ * @param context - the storage file server actions context
206
+ * @returns an async transform-and-validate function that returns batch deletion results
151
207
  */
152
208
  export declare function deleteAllQueuedStorageFilesFactory(context: StorageFileServerActionsContext): import("@dereekb/model").TransformAndValidateFunctionResultFunction<DeleteAllQueuedStorageFilesParams, () => Promise<DeleteAllQueuedStorageFilesResult>, object, unknown>;
153
209
  /**
@@ -155,6 +211,9 @@ export declare function deleteAllQueuedStorageFilesFactory(context: StorageFileS
155
211
  *
156
212
  * Deletes a single {@link StorageFile} document and its associated Cloud Storage file.
157
213
  * Validates the file is flagged for deletion and the scheduled delete time has passed.
214
+ *
215
+ * @param context - the storage file server actions context
216
+ * @returns an async transform-and-validate function that deletes a StorageFile and its storage object
158
217
  */
159
218
  export declare function deleteStorageFileFactory(context: StorageFileServerActionsContext): import("@dereekb/model").TransformAndValidateFunctionResultFunction<DeleteStorageFileParams, (inputStorageFileDocument: StorageFileDocument) => Promise<void>, object, unknown>;
160
219
  /**
@@ -163,6 +222,9 @@ export declare function deleteStorageFileFactory(context: StorageFileServerActio
163
222
  * Generates a signed download URL for a {@link StorageFile}'s associated Cloud Storage file.
164
223
  * The URL expires after the configured duration. Supports loading the storage file document
165
224
  * by key if not provided directly.
225
+ *
226
+ * @param context - the storage file server actions context
227
+ * @returns an async transform-and-validate function that generates a signed download URL
166
228
  */
167
229
  export declare function downloadStorageFileFactory(context: StorageFileServerActionsContext): import("@dereekb/model").TransformAndValidateFunctionResultFunction<DownloadStorageFileParams, (storageFileDocument?: Maybe<StorageFileDocument>) => Promise<DownloadStorageFileResult>, object, unknown>;
168
230
  /**
@@ -184,6 +246,16 @@ export interface CreateStorageFileGroupInTransactionInput extends StorageFileGro
184
246
  */
185
247
  readonly template?: Maybe<Pick<StorageFileGroup, 'f' | 're'>>;
186
248
  }
249
+ /**
250
+ * Internal factory that creates a function for creating a {@link StorageFileGroup} document
251
+ * within a Firestore transaction.
252
+ *
253
+ * The created group is flagged for initialization (`s=true`) and uses a dummy owner key
254
+ * that will be set during the initialization step.
255
+ *
256
+ * @param context - the storage file server actions context
257
+ * @returns an async function that creates a StorageFileGroup within a transaction
258
+ */
187
259
  export declare function createStorageFileGroupInTransactionFactory(context: StorageFileServerActionsContext): (params: CreateStorageFileGroupInTransactionInput, transaction: Transaction) => Promise<{
188
260
  storageFileGroupTemplate: StorageFileGroup;
189
261
  storageFileGroupDocument: StorageFileGroupDocument;
@@ -193,6 +265,9 @@ export declare function createStorageFileGroupInTransactionFactory(context: Stor
193
265
  *
194
266
  * Creates a new {@link StorageFileGroup} document within a Firestore transaction,
195
267
  * associating it with a model key or storage file.
268
+ *
269
+ * @param context - the storage file server actions context
270
+ * @returns an async transform-and-validate function that creates a new StorageFileGroup
196
271
  */
197
272
  export declare function createStorageFileGroupFactory(context: StorageFileServerActionsContext): import("@dereekb/model").TransformAndValidateFunctionResultFunction<CreateStorageFileGroupParams, () => Promise<StorageFileGroupDocument>, object, unknown>;
198
273
  export interface SyncStorageFileWithGroupsInTransactionInput {
@@ -216,12 +291,25 @@ export interface SyncStorageFileWithGroupsInTransactionInput {
216
291
  */
217
292
  readonly skipStorageFileUpdate?: Maybe<boolean>;
218
293
  }
294
+ /**
295
+ * Internal factory that creates a function for syncing a {@link StorageFile} with its
296
+ * associated {@link StorageFileGroup} documents within a Firestore transaction.
297
+ *
298
+ * Adds the storage file to groups it is missing from, removes it from groups when requested,
299
+ * and optionally creates new groups for references that do not yet exist.
300
+ *
301
+ * @param context - the storage file server actions context
302
+ * @returns an async function that syncs a storage file with its groups within a transaction
303
+ */
219
304
  export declare function _syncStorageFileWithGroupsInTransactionFactory(context: StorageFileServerActionsContext): (input: SyncStorageFileWithGroupsInTransactionInput, transaction: Transaction) => Promise<SyncStorageFileWithGroupsResult>;
220
305
  /**
221
306
  * Factory for the `syncStorageFileWithGroups` action.
222
307
  *
223
308
  * Syncs a single {@link StorageFile}'s embedded data into its associated {@link StorageFileGroup}
224
309
  * documents and clears the sync flag on completion.
310
+ *
311
+ * @param context - the storage file server actions context
312
+ * @returns an async transform-and-validate function that syncs a StorageFile with its groups
225
313
  */
226
314
  export declare function syncStorageFileWithGroupsFactory(context: StorageFileServerActionsContext): import("@dereekb/model").TransformAndValidateFunctionResultFunction<SyncStorageFileWithGroupsParams, (storageFileDocument: StorageFileDocument) => Promise<SyncStorageFileWithGroupsResult>, object, unknown>;
227
315
  /**
@@ -230,6 +318,9 @@ export declare function syncStorageFileWithGroupsFactory(context: StorageFileSer
230
318
  * Batch-processes all {@link StorageFile} documents flagged for group sync,
231
319
  * updating their associated {@link StorageFileGroup} documents and flagging
232
320
  * groups for content regeneration when changes occur.
321
+ *
322
+ * @param context - the storage file server actions context
323
+ * @returns an async transform-and-validate function that returns batch sync results
233
324
  */
234
325
  export declare function syncAllFlaggedStorageFilesWithGroupsFactory(context: StorageFileServerActionsContext): import("@dereekb/model").TransformAndValidateFunctionResultFunction<SyncAllFlaggedStorageFilesWithGroupsParams, () => Promise<SyncAllFlaggedStorageFilesWithGroupsResult>, object, unknown>;
235
326
  /**
@@ -237,6 +328,9 @@ export declare function syncAllFlaggedStorageFilesWithGroupsFactory(context: Sto
237
328
  *
238
329
  * Regenerates the content of a single {@link StorageFileGroup}, including building a ZIP
239
330
  * archive from the group's embedded files and updating the group's content metadata.
331
+ *
332
+ * @param context - the storage file server actions context
333
+ * @returns an async transform-and-validate function that regenerates a StorageFileGroup's content
240
334
  */
241
335
  export declare function regenerateStorageFileGroupContentFactory(context: StorageFileServerActionsContext): import("@dereekb/model").TransformAndValidateFunctionResultFunction<RegenerateStorageFileGroupContentParams, (storageFileGroupDocument: StorageFileGroupDocument) => Promise<RegenerateStorageFileGroupContentResult>, object, unknown>;
242
336
  /**
@@ -244,5 +338,8 @@ export declare function regenerateStorageFileGroupContentFactory(context: Storag
244
338
  *
245
339
  * Batch-processes all {@link StorageFileGroup} documents flagged for content regeneration,
246
340
  * rebuilding their ZIP archives and updating content metadata.
341
+ *
342
+ * @param context - the storage file server actions context
343
+ * @returns an async transform-and-validate function that returns batch regeneration results
247
344
  */
248
345
  export declare function regenerateAllFlaggedStorageFileGroupsContentFactory(context: StorageFileServerActionsContext): import("@dereekb/model").TransformAndValidateFunctionResultFunction<RegenerateAllFlaggedStorageFileGroupsContentParams, () => Promise<RegenerateAllFlaggedStorageFileGroupsContentResult>, object, unknown>;
@@ -68,13 +68,14 @@ export declare abstract class StorageFileInitServerActions {
68
68
  * initialization action to its factory function.
69
69
  *
70
70
  * @param context - the initialization context with template function and Firestore access
71
+ * @returns a {@link StorageFileInitServerActions} wired to the provided context
71
72
  */
72
73
  export declare function storageFileInitServerActions(context: StorageFileInitServerActionsContext): StorageFileInitServerActions;
73
74
  /**
74
75
  * Input for {@link initializeStorageFileModelInTransaction}, providing the document,
75
76
  * its current data, the template function, and the transaction context.
76
77
  */
77
- export interface InitializeStorageFileModelInTransactionInput<D extends FirestoreDocument<InitializedStorageFileModel, any>> {
78
+ export interface InitializeStorageFileModelInTransactionInput<D extends FirestoreDocument<InitializedStorageFileModel>> {
78
79
  readonly makeTemplateFunction: MakeTemplateForStorageFileRelatedModelInitializationFunction<FirestoreDocumentData<D>>;
79
80
  readonly throwErrorIfAlreadyInitialized?: Maybe<boolean>;
80
81
  readonly transaction: Transaction;
@@ -90,9 +91,10 @@ export interface InitializeStorageFileModelInTransactionInput<D extends Firestor
90
91
  * - Returns `false` → deletes the document entirely
91
92
  *
92
93
  * @param input - the document, transaction, template function, and options
94
+ * @returns an object indicating whether the document was initialized or was already initialized
93
95
  * @throws storageFileModelAlreadyInitializedError when `throwErrorIfAlreadyInitialized` is true
94
96
  */
95
- export declare function initializeStorageFileModelInTransaction<D extends FirestoreDocument<InitializedStorageFileModel, any>>(input: InitializeStorageFileModelInTransactionInput<D>): Promise<{
97
+ export declare function initializeStorageFileModelInTransaction<D extends FirestoreDocument<InitializedStorageFileModel>>(input: InitializeStorageFileModelInTransactionInput<D>): Promise<{
96
98
  initialized: boolean;
97
99
  alreadyInitialized: boolean;
98
100
  }>;
@@ -101,6 +103,9 @@ export declare function initializeStorageFileModelInTransaction<D extends Firest
101
103
  *
102
104
  * Applies the app-specific template function, restricting the template to only the `o` (owner)
103
105
  * and content flag properties, and always flags the group for content regeneration.
106
+ *
107
+ * @param context - the initialization context providing collection access and the template function
108
+ * @returns an async function that initializes a storage file group document within a transaction
104
109
  */
105
110
  export declare function initializeStorageFileGroupInTransactionFactory(context: StorageFileInitServerActionsContext): (params: InitializeStorageFileModelParams, storageFileGroupDocument: StorageFileGroupDocument, transaction: Transaction) => Promise<{
106
111
  initialized: boolean;
@@ -111,6 +116,9 @@ export declare function initializeStorageFileGroupInTransactionFactory(context:
111
116
  *
112
117
  * Wraps the in-transaction group initialization in a Firestore transaction
113
118
  * and follows the transform-and-validate pattern.
119
+ *
120
+ * @param context - the initialization context with Firestore access and template function
121
+ * @returns a transform-and-validate function for single storage file group initialization
114
122
  */
115
123
  export declare function initializeStorageFileGroupFactory(context: StorageFileInitServerActionsContext): import("@dereekb/model").TransformAndValidateFunctionResultFunction<InitializeStorageFileModelParams, (storageFileGroupDocument: StorageFileGroupDocument) => Promise<StorageFileGroupDocument>, object, unknown>;
116
124
  /**
@@ -119,5 +127,8 @@ export declare function initializeStorageFileGroupFactory(context: StorageFileIn
119
127
  * Batch-processes all {@link StorageFileGroup} documents flagged for initialization,
120
128
  * initializing each in parallel (up to 5 concurrent tasks). Loops until no more
121
129
  * flagged groups are found.
130
+ *
131
+ * @param context - the initialization context with Firestore access, collection, and template function
132
+ * @returns a transform-and-validate function for batch storage file group initialization
122
133
  */
123
134
  export declare function initializeAllApplicableStorageFileGroupsFactory(context: StorageFileInitServerActionsContext): import("@dereekb/model").TransformAndValidateFunctionResultFunction<InitializeAllApplicableStorageFileGroupsParams, () => Promise<InitializeAllApplicableStorageFileGroupsResult>, object, unknown>;
@@ -1,59 +1,86 @@
1
1
  import { type UploadedFileInitializationFailedErrorData } from '@dereekb/firebase';
2
2
  /**
3
3
  * Creates an error indicating that a storage file model has already been initialized.
4
+ *
5
+ * @returns a precondition-conflict HttpsError with the STORAGE_FILE_MODEL_ALREADY_INITIALIZED error code
4
6
  */
5
7
  export declare function storageFileModelAlreadyInitializedError(): import("firebase-functions/https").HttpsError;
6
8
  /**
7
9
  * Creates an error indicating that the StorageFile is not flagged for group sync.
10
+ *
11
+ * @returns a precondition-conflict HttpsError with the STORAGE_FILE_NOT_FLAGGED_FOR_GROUPS_SYNC error code
8
12
  */
9
13
  export declare function storageFileNotFlaggedForGroupsSyncError(): import("firebase-functions/https").HttpsError;
10
14
  /**
11
15
  * Creates an error indicating that the target uploaded file does not exist in storage.
16
+ *
17
+ * @returns a precondition-conflict HttpsError with the UPLOADED_FILE_DOES_NOT_EXIST error code
12
18
  */
13
19
  export declare function uploadedFileDoesNotExistError(): import("firebase-functions/https").HttpsError;
14
20
  /**
15
21
  * Creates an error indicating that the file is not allowed to be initialized (rejected by the check function).
22
+ *
23
+ * @returns a precondition-conflict HttpsError with the UPLOADED_FILE_NOT_ALLOWED_TO_BE_INITIALIZED error code
16
24
  */
17
25
  export declare function uploadedFileIsNotAllowedToBeInitializedError(): import("firebase-functions/https").HttpsError;
18
26
  /**
19
27
  * Creates an error indicating that the file initialization failed with the given result type.
20
28
  *
21
29
  * @param data - error data containing the result type that caused the failure
30
+ * @returns an internal-server HttpsError with the UPLOADED_FILE_INITIALIZATION_FAILED error code and the result type
22
31
  */
23
32
  export declare function uploadedFileInitializationFailedError(data: UploadedFileInitializationFailedErrorData): import("firebase-functions/https").HttpsError;
24
33
  /**
25
34
  * Creates an error indicating that the initialization result was discarded (e.g., the created file no longer exists).
35
+ *
36
+ * @returns an internal-server HttpsError with the UPLOADED_FILE_INITIALIZATION_DISCARDED error code
26
37
  */
27
38
  export declare function uploadedFileInitializationDiscardedError(): import("firebase-functions/https").HttpsError;
28
39
  /**
29
40
  * Creates an error indicating that the StorageFile is not in a valid state for processing.
41
+ *
42
+ * @returns a precondition-conflict HttpsError with the STORAGE_FILE_PROCESSING_NOT_ALLOWED_FOR_INVALID_STATE error code
30
43
  */
31
44
  export declare function storageFileProcessingNotAllowedForInvalidStateError(): import("firebase-functions/https").HttpsError;
32
45
  /**
33
46
  * Creates an error indicating that the StorageFile is not queued for processing.
47
+ *
48
+ * @returns a precondition-conflict HttpsError with the STORAGE_FILE_PROCESSING_NOT_QUEUED_FOR_PROCESSING error code
34
49
  */
35
50
  export declare function storageFileProcessingNotQueuedForProcessingError(): import("firebase-functions/https").HttpsError;
36
51
  /**
37
52
  * Creates an error indicating that no processor is configured for the StorageFile's type.
53
+ *
54
+ * @returns a precondition-conflict HttpsError with the STORAGE_FILE_PROCESSING_NOT_AVAILABLE_FOR_TYPE error code
38
55
  */
39
56
  export declare function storageFileProcessingNotAvailableForTypeError(): import("firebase-functions/https").HttpsError;
40
57
  /**
41
58
  * Creates an error indicating that the StorageFile has already finished processing.
59
+ *
60
+ * @returns a precondition-conflict HttpsError with the STORAGE_FILE_ALREADY_PROCESSED error code
42
61
  */
43
62
  export declare function storageFileAlreadyProcessedError(): import("firebase-functions/https").HttpsError;
44
63
  /**
45
64
  * Creates an error indicating that the StorageFile is not flagged for deletion.
65
+ *
66
+ * @returns a precondition-conflict HttpsError with the STORAGE_FILE_NOT_FLAGGED_FOR_DELETION error code
46
67
  */
47
68
  export declare function storageFileNotFlaggedForDeletionError(): import("firebase-functions/https").HttpsError;
48
69
  /**
49
70
  * Creates an error indicating that the StorageFile's scheduled deletion time has not yet passed.
71
+ *
72
+ * @returns a precondition-conflict HttpsError with the STORAGE_FILE_CANNOT_BE_DELETED_YET error code
50
73
  */
51
74
  export declare function storageFileCannotBeDeletedYetError(): import("firebase-functions/https").HttpsError;
52
75
  /**
53
76
  * Creates an error indicating that the StorageFileGroup is still queued for initialization and cannot be operated on.
77
+ *
78
+ * @returns a precondition-conflict HttpsError with the STORAGE_FILE_GROUP_QUEUED_FOR_INITIALIZATION error code
54
79
  */
55
80
  export declare function storageFileGroupQueuedForInitializationError(): import("firebase-functions/https").HttpsError;
56
81
  /**
57
82
  * Creates an error indicating that the required model key or storageFileId is missing when creating a StorageFileGroup.
83
+ *
84
+ * @returns a precondition-conflict HttpsError with the STORAGE_FILE_GROUP_CREATE_INPUT error code
58
85
  */
59
86
  export declare function createStorageFileGroupInputError(): import("firebase-functions/https").HttpsError;
@@ -2,19 +2,30 @@ import { type ModuleMetadata } from '@nestjs/common';
2
2
  import { type Maybe } from '@dereekb/util';
3
3
  import { type BaseStorageFileServerActionsContext, StorageFileServerActions, type StorageFileServerActionsContext } from './storagefile.action.server';
4
4
  import { StorageFileInitializeFromUploadService } from './storagefile.upload.service';
5
- import { StorageFileInitServerActions, type StorageFileInitServerActionsContextConfig } from './storagefile.action.init.service';
5
+ import { StorageFileInitServerActions, type StorageFileInitServerActionsContextConfig } from './storagefile.action.server.init';
6
6
  /**
7
7
  * Factory that assembles the full {@link StorageFileServerActionsContext} by combining
8
8
  * the base context with the upload initialization service.
9
+ *
10
+ * @param context - the base server actions context providing Firebase infrastructure
11
+ * @param storageFileInitializeFromUploadService - the service for initializing storage files from uploads
12
+ * @returns the fully assembled StorageFileServerActionsContext
9
13
  */
10
14
  export declare function storageFileServerActionsContextFactory(context: BaseStorageFileServerActionsContext, storageFileInitializeFromUploadService: StorageFileInitializeFromUploadService): StorageFileServerActionsContext;
11
15
  /**
12
16
  * Factory that creates a {@link StorageFileServerActions} instance from the assembled context.
17
+ *
18
+ * @param context - the fully assembled storage file server actions context
19
+ * @returns a concrete StorageFileServerActions instance
13
20
  */
14
21
  export declare function storageFileServerActionsFactory(context: StorageFileServerActionsContext): StorageFileServerActions;
15
22
  /**
16
23
  * Factory that creates a {@link StorageFileInitServerActions} instance by merging the
17
24
  * server actions context with the init-specific configuration.
25
+ *
26
+ * @param context - the storage file server actions context
27
+ * @param storageFileInitServerActionsContextConfig - init-specific configuration with the template function
28
+ * @returns a concrete StorageFileInitServerActions instance
18
29
  */
19
30
  export declare function storageFileInitServerActionsFactory(context: StorageFileServerActionsContext, storageFileInitServerActionsContextConfig: StorageFileInitServerActionsContextConfig): StorageFileInitServerActions;
20
31
  export interface ProvideAppStorageFileMetadataConfig extends Pick<ModuleMetadata, 'imports' | 'exports' | 'providers'> {
@@ -38,8 +49,7 @@ export interface ProvideAppStorageFileMetadataConfig extends Pick<ModuleMetadata
38
49
  *
39
50
  * Be sure the class that delares the module using this function also extends AbstractAppStorageFileModule.
40
51
  *
41
- * @param provide
42
- * @param useFactory
43
- * @returns
52
+ * @param config - the module configuration including optional dependency module, imports, exports, and providers
53
+ * @returns the assembled {@link ModuleMetadata} for the storage file module
44
54
  */
45
55
  export declare function appStorageFileModuleMetadata(config: ProvideAppStorageFileMetadataConfig): ModuleMetadata;
@@ -10,7 +10,7 @@ import archiver from 'archiver';
10
10
  * Extends the generic subtask input with storage-file-specific context: the document reference,
11
11
  * a lazy loader for the current file data, and a file reader for accessing the stored file's content.
12
12
  */
13
- export interface StorageFileProcessingPurposeSubtaskInput<M extends StorageFileProcessingSubtaskMetadata = any, S extends StorageFileProcessingSubtask = StorageFileProcessingSubtask> extends NotificationTaskSubtaskInput<StorageFileProcessingNotificationTaskData<M, S>, M, S> {
13
+ export interface StorageFileProcessingPurposeSubtaskInput<M extends StorageFileProcessingSubtaskMetadata = StorageFileProcessingSubtaskMetadata, S extends StorageFileProcessingSubtask = StorageFileProcessingSubtask> extends NotificationTaskSubtaskInput<StorageFileProcessingNotificationTaskData<M, S>, M, S> {
14
14
  /**
15
15
  * The associated StorageFileDocument.
16
16
  */
@@ -29,15 +29,15 @@ export interface StorageFileProcessingPurposeSubtaskInput<M extends StorageFileP
29
29
  /**
30
30
  * Result of a StorageFileProcessingPurposeSubtask.
31
31
  */
32
- export type StorageFileProcessingPurposeSubtaskResult<M extends StorageFileProcessingSubtaskMetadata = any, S extends StorageFileProcessingSubtask = StorageFileProcessingSubtask> = NotificationTaskServiceHandleNotificationTaskResult<M, S>;
32
+ export type StorageFileProcessingPurposeSubtaskResult<M extends StorageFileProcessingSubtaskMetadata = StorageFileProcessingSubtaskMetadata, S extends StorageFileProcessingSubtask = StorageFileProcessingSubtask> = NotificationTaskServiceHandleNotificationTaskResult<M, S>;
33
33
  /**
34
34
  * A StorageFileProcessingPurposeSubtask is a function that handles a specific StorageFilePurpose subtask.
35
35
  */
36
- export type StorageFileProcessingPurposeSubtask<M extends StorageFileProcessingSubtaskMetadata = any, S extends StorageFileProcessingSubtask = StorageFileProcessingSubtask> = (input: StorageFileProcessingPurposeSubtaskInput<M>) => Promise<StorageFileProcessingPurposeSubtaskResult<M, S>>;
36
+ export type StorageFileProcessingPurposeSubtask<M extends StorageFileProcessingSubtaskMetadata = StorageFileProcessingSubtaskMetadata, S extends StorageFileProcessingSubtask = StorageFileProcessingSubtask> = (input: StorageFileProcessingPurposeSubtaskInput<M>) => Promise<StorageFileProcessingPurposeSubtaskResult<M, S>>;
37
37
  /**
38
38
  * Similar to NotificationTaskServiceTaskHandlerFlowEntry, but used in StorageFileProcessingPurposeTaskProcessorConfig as part of the flow.
39
39
  */
40
- export type StorageFileProcessingPurposeSubtaskFlowEntry<M extends StorageFileProcessingSubtaskMetadata = any, S extends StorageFileProcessingSubtask = StorageFileProcessingSubtask> = NotificationTaskSubtaskFlowEntry<StorageFileProcessingPurposeSubtaskInput<M, S>, StorageFileProcessingNotificationTaskData<M, S>, M, S>;
40
+ export type StorageFileProcessingPurposeSubtaskFlowEntry<M extends StorageFileProcessingSubtaskMetadata = StorageFileProcessingSubtaskMetadata, S extends StorageFileProcessingSubtask = StorageFileProcessingSubtask> = NotificationTaskSubtaskFlowEntry<StorageFileProcessingPurposeSubtaskInput<M, S>, StorageFileProcessingNotificationTaskData<M, S>, M, S>;
41
41
  /**
42
42
  * The output cleanup configuration.
43
43
  */
@@ -63,13 +63,13 @@ export interface StorageFileProcessingPurposeSubtaskCleanupOutput extends Notifi
63
63
  */
64
64
  readonly flagResyncWithStorageFileGroups?: boolean;
65
65
  }
66
- export type StorageFileProcessingPurposeSubtaskProcessorConfigWithTarget<M extends StorageFileProcessingSubtaskMetadata = any, S extends StorageFileProcessingSubtask = StorageFileProcessingSubtask> = NotificationTaskSubtaskProcessorConfig<StorageFileProcessingPurposeSubtaskInput<M, S>, StorageFileProcessingPurposeSubtaskCleanupOutput, StorageFileProcessingNotificationTaskData<M, S>>;
66
+ export type StorageFileProcessingPurposeSubtaskProcessorConfigWithTarget<M extends StorageFileProcessingSubtaskMetadata = StorageFileProcessingSubtaskMetadata, S extends StorageFileProcessingSubtask = StorageFileProcessingSubtask> = NotificationTaskSubtaskProcessorConfig<StorageFileProcessingPurposeSubtaskInput<M, S>, StorageFileProcessingPurposeSubtaskCleanupOutput, StorageFileProcessingNotificationTaskData<M, S>>;
67
67
  /**
68
68
  * Similar to NotificationTaskServiceTaskHandlerConfig, but instead targets a specific StorageFilePurpose.
69
69
  *
70
70
  * The flows behave the same way.
71
71
  */
72
- export type StorageFileProcessingPurposeSubtaskProcessorConfig<M extends StorageFileProcessingSubtaskMetadata = any, S extends StorageFileProcessingSubtask = StorageFileProcessingSubtask> = StorageFileProcessingPurposeSubtaskProcessorConfigWithTarget<M, S>;
72
+ export type StorageFileProcessingPurposeSubtaskProcessorConfig<M extends StorageFileProcessingSubtaskMetadata = StorageFileProcessingSubtaskMetadata, S extends StorageFileProcessingSubtask = StorageFileProcessingSubtask> = StorageFileProcessingPurposeSubtaskProcessorConfigWithTarget<M, S>;
73
73
  export interface StorageFileProcessingNotificationTaskHandlerConfig extends Omit<NotificationTaskSubtaskNotificationTaskHandlerConfig<StorageFileProcessingPurposeSubtaskInput, StorageFileProcessingPurposeSubtaskCleanupOutput, StorageFileProcessingNotificationTaskData>, 'processors'> {
74
74
  /**
75
75
  * The input processors.
@@ -93,6 +93,13 @@ export interface StorageFileProcessingNotificationTaskHandlerConfig extends Omit
93
93
  export declare const storageFileProcessingNotificationTaskHandlerDefaultCleanup: () => StorageFileProcessingPurposeSubtaskCleanupOutput;
94
94
  /**
95
95
  * Creates a NotificationTaskServiceTaskHandlerConfig that handles the StorageFileProcessingNotificationTask.
96
+ *
97
+ * Builds a subtask-based notification handler that loads the storage file document,
98
+ * determines its purpose, and dispatches to the appropriate purpose-specific processor.
99
+ * Includes optional StorageFileGroup processors (e.g., ZIP generation) by default.
100
+ *
101
+ * @param config - handler configuration including processors, storage accessor, and Firestore collections
102
+ * @returns a NotificationTaskServiceTaskHandlerConfig wired for storage file processing
96
103
  */
97
104
  export declare function storageFileProcessingNotificationTaskHandler(config: StorageFileProcessingNotificationTaskHandlerConfig): NotificationTaskServiceTaskHandlerConfig<StorageFileProcessingNotificationTaskData>;
98
105
  export interface AllStorageFileGroupStorageFileProcessingPurposeSubtaskProcessorsConfig extends StorageFileGroupStorageFileProcessingPurposeSubtaskProcessorsConfig {
@@ -103,6 +110,12 @@ export interface AllStorageFileGroupStorageFileProcessingPurposeSubtaskProcessor
103
110
  */
104
111
  readonly excludeZipProcessing?: boolean;
105
112
  }
113
+ /**
114
+ * Assembles all built-in StorageFileGroup subtask processors, such as ZIP generation.
115
+ *
116
+ * @param config - configuration controlling which group processors to include
117
+ * @returns an array of subtask processor configs for StorageFileGroup processing purposes
118
+ */
106
119
  export declare function allStorageFileGroupStorageFileProcessingPurposeSubtaskProcessors(config: AllStorageFileGroupStorageFileProcessingPurposeSubtaskProcessorsConfig): StorageFileProcessingPurposeSubtaskProcessorConfigWithTarget[];
107
120
  export interface StorageFileGroupStorageFileProcessingPurposeSubtaskProcessorsConfig {
108
121
  readonly storageFileFirestoreCollections: StorageFileFirestoreCollections;
@@ -161,10 +174,19 @@ export interface StorageFileGroupStorageFileProcessingPurposeSubtaskProcessorsCo
161
174
  *
162
175
  * The function should return an object that can be serialized to JSON.
163
176
  */
164
- readonly configureZipInfoJson?: false | ((baseInfoJson: StorageFileGroupStorageFileZipInfoJson) => PromiseOrValue<Maybe<any>>);
177
+ readonly configureZipInfoJson?: false | ((baseInfoJson: StorageFileGroupStorageFileZipInfoJson) => PromiseOrValue<Maybe<unknown>>);
165
178
  /**
166
179
  * Optional function to hook into the finalization of the target zip archive.
167
180
  */
168
181
  readonly finalizeZipArchive?: StorageFileGroupStorageFileZipFinalizeArchiveFunction;
169
182
  }
183
+ /**
184
+ * Creates the ZIP subtask processor for {@link StorageFileGroup} processing.
185
+ *
186
+ * This processor streams all files in the group into a ZIP archive, attaches an info JSON
187
+ * manifest, and uploads the result to the group's designated storage path.
188
+ *
189
+ * @param config - configuration providing Firestore collections, storage accessor, and ZIP options
190
+ * @returns a subtask processor config targeting the StorageFileGroup ZIP purpose
191
+ */
170
192
  export declare function storageFileGroupZipStorageFileProcessingPurposeSubtaskProcessor(config: StorageFileGroupStorageFileProcessingPurposeSubtaskProcessorsConfig): StorageFileProcessingPurposeSubtaskProcessorConfigWithTarget<StorageFileGroupZipStorageFileProcessingSubtaskMetadata, StorageFileGroupZipStorageFileProcessingSubtask>;
@@ -71,6 +71,7 @@ export interface StorageFileInitializeFromUploadServiceInitializerStorageFileDoc
71
71
  *
72
72
  * @param error - the error that caused the permanent failure
73
73
  * @param createdFile - optional path to a file that was created before the error and should be deleted
74
+ * @returns a permanent failure result with the error and optional created file reference
74
75
  */
75
76
  export declare function storageFileInitializeFromUploadServiceInitializerResultPermanentFailure(error: unknown, createdFile?: Maybe<StoragePathRef>): StorageFileInitializeFromUploadServiceInitializerResult;
76
77
  /**
@@ -145,6 +146,7 @@ export interface StorageFileInitializeFromUploadServiceConfig {
145
146
  * 4. Optionally, previous files for the same purpose/user are flagged for deletion
146
147
  *
147
148
  * @param config - service configuration including determiners, initializers, and storage references
149
+ * @returns a {@link StorageFileInitializeFromUploadService} with type detection and upload initialization
148
150
  *
149
151
  * @example
150
152
  * ```ts