@dereekb/firebase 12.5.10 → 12.6.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dereekb/firebase",
3
- "version": "12.5.10",
3
+ "version": "12.6.1",
4
4
  "exports": {
5
5
  ".": {
6
6
  "types": "./src/index.d.ts",
@@ -362,6 +362,14 @@ export declare function firestoreModelKeyPart<N extends FirestoreCollectionNameR
362
362
  * @returns
363
363
  */
364
364
  export declare const firestoreModelKey: <I extends RootFirestoreModelIdentity, K extends FirestoreModelId = FirestoreModelId>(identity: I, id: K) => FirestoreCollectionModelKey<I, K>;
365
+ /**
366
+ * Creates a FirestoreModelKey for root FirestoreModelIdentity values.
367
+ */
368
+ export type FirestoreModelKeyFactory<I extends RootFirestoreModelIdentity, K extends FirestoreModelId = FirestoreModelId> = (id: K) => FirestoreCollectionModelKey<I, K>;
369
+ /**
370
+ * Creates a FirestoreModelKeyFactory for the input root identity.
371
+ */
372
+ export declare function firestoreModelKeyFactory<I extends RootFirestoreModelIdentity, K extends FirestoreModelId = FirestoreModelId>(identity: I): (id: K) => FirestoreCollectionModelKeyPart<I, K>;
365
373
  /**
366
374
  * Creates an array of FirestoreCollectionModelKey values from the input ids.
367
375
  *
@@ -348,6 +348,62 @@ export type OptionalFirestoreDateFieldConfig = OptionalFirestoreFieldConfig<Date
348
348
  * @returns A field mapping configuration for optional Date values
349
349
  */
350
350
  export declare function optionalFirestoreDate(config?: OptionalFirestoreDateFieldConfig): ModelFieldMapFunctionsConfig<Maybe<Date>, Maybe<string>>;
351
+ /**
352
+ * Configuration for a Firestore date field that is stored as a number.
353
+ */
354
+ export type FirestoreDateNumberFieldConfig = DefaultMapConfiguredFirestoreFieldConfig<Date, number> & {
355
+ /**
356
+ * Whether to save the default date as the current timestamp
357
+ */
358
+ readonly saveDefaultAsNow?: boolean;
359
+ /**
360
+ * Converts a Date object to a number.
361
+ */
362
+ readonly fromDate: (input: Date) => number;
363
+ /**
364
+ * Converts a number to a Date object.
365
+ */
366
+ readonly toDate: (input: number) => Date;
367
+ };
368
+ /**
369
+ * Creates a field mapping configuration for Firestore date fields.
370
+ *
371
+ * Handles conversion between JavaScript Date objects and ISO8601 strings stored in Firestore.
372
+ *
373
+ * @param config - Configuration for the date field
374
+ * @returns A field mapping configuration for Date values
375
+ */
376
+ export declare function firestoreDateNumber(config: FirestoreDateNumberFieldConfig): FirestoreModelFieldMapFunctionsConfig<Date, number>;
377
+ /**
378
+ * Configuration for an optional Firestore date field.
379
+ *
380
+ * @template Date - JavaScript Date object type
381
+ * @template ISO8601DateString - ISO8601 date string format in Firestore
382
+ */
383
+ export type OptionalFirestoreDateNumberFieldConfig = OptionalFirestoreFieldConfig<Date, number> & Pick<FirestoreDateNumberFieldConfig, 'fromDate' | 'toDate'>;
384
+ /**
385
+ * Creates a field mapping configuration for optional Firestore date field that is stored as a number.
386
+ *
387
+ * @param config - Configuration for the optional date field
388
+ * @returns A field mapping configuration for optional Date values
389
+ */
390
+ export declare function optionalFirestoreDateNumber(config: OptionalFirestoreDateNumberFieldConfig): ModelFieldMapFunctionsConfig<Maybe<Date>, Maybe<number>>;
391
+ export type FirestoreUnixDateTimeSecondsNumberFieldConfig = Omit<FirestoreDateNumberFieldConfig, 'fromDate' | 'toDate'>;
392
+ /**
393
+ * Creates a field mapping configuration for Firestore Date fields that are stored as a UnixDateTimeSecondsNumber.
394
+ *
395
+ * @param config - Configuration for the date field
396
+ * @returns A field mapping configuration for Date values
397
+ */
398
+ export declare function firestoreUnixDateTimeSecondsNumber(config: FirestoreUnixDateTimeSecondsNumberFieldConfig): FirestoreModelFieldMapFunctionsConfig<Date, number>;
399
+ export type OptionalFirestoreUnixDateTimeSecondsNumberFieldConfig = Omit<OptionalFirestoreDateNumberFieldConfig, 'fromDate' | 'toDate'>;
400
+ /**
401
+ * Creates a field mapping configuration for optional Firestore Date fields that are stored as a UnixDateTimeSecondsNumber.
402
+ *
403
+ * @param config - Configuration for the optional date field
404
+ * @returns A field mapping configuration for optional Date values
405
+ */
406
+ export declare function optionalFirestoreUnixDateTimeSecondsNumber(config?: OptionalFirestoreUnixDateTimeSecondsNumberFieldConfig): ModelFieldMapFunctionsConfig<Maybe<Date>, Maybe<number>>;
351
407
  /**
352
408
  * Configuration for a Firestore boolean field.
353
409
  */
@@ -1,6 +1,7 @@
1
1
  import { type StorageBucketId, type StoragePathInput, type StoragePath, type StoragePathRef, type StorageSlashPath } from '../storage';
2
2
  import { type ConfigurableStorageMetadata, type StorageAccessControlObject, type StorageAclMetadata, type StorageMakePrivateOptions, type StorageMoveOptions, type StorageSignedDownloadUrl, type StorageSignedDownloadUrlConfig, type FirebaseStorage, type StorageClientUploadBytesInput, type StorageDeleteFileOptions, type StorageDownloadUrl, type StorageMetadata, type StorageUploadInput, type StorageUploadOptions, type StorageUploadResult, type StorageUploadTask } from '../types';
3
3
  import { type ArrayOrValue, type Maybe } from '@dereekb/util';
4
+ import { type Readable } from 'stream';
4
5
  /**
5
6
  * Used for accessing files and folders in the storage.
6
7
  */
@@ -64,7 +65,7 @@ export interface FirebaseStorageAccessorFile<R = unknown> extends StoragePathRef
64
65
  *
65
66
  * Available only in NodeJS.
66
67
  */
67
- getStream?(maxDownloadSizeBytes?: number): NodeJS.ReadableStream;
68
+ getStream?(maxDownloadSizeBytes?: number): Readable;
68
69
  /**
69
70
  * Uploads data to the file's path.
70
71
  */
@@ -419,7 +419,7 @@ export declare class SendQueuedNotificationsParams {
419
419
  */
420
420
  readonly sendNotificationLoopsTaskExcessThreshold?: Maybe<number>;
421
421
  }
422
- export interface SendQueuedNotificationsResult extends Omit<SendNotificationResult, 'throttled' | 'isNotificationTask' | 'isUniqueNotificationTask' | 'uniqueNotificationTaskConflict' | 'isConfiguredTemplateType' | 'isKnownTemplateType' | 'notificationTemplateType' | 'notificationMarkedDone' | 'deletedNotification' | 'createdBox' | 'success' | 'exists' | 'boxExists' | 'notificationBoxNeedsInitialization' | 'tryRun' | 'loadMessageFunctionFailure' | 'buildMessageFailure'> {
422
+ export interface SendQueuedNotificationsResult extends Omit<SendNotificationResult, 'throttled' | 'isNotificationTask' | 'isUniqueNotificationTask' | 'notificationTaskCompletionType' | 'uniqueNotificationTaskConflict' | 'isConfiguredTemplateType' | 'isKnownTemplateType' | 'notificationTemplateType' | 'notificationMarkedDone' | 'deletedNotification' | 'createdBox' | 'success' | 'exists' | 'boxExists' | 'notificationBoxNeedsInitialization' | 'tryRun' | 'loadMessageFunctionFailure' | 'buildMessageFailure'> {
423
423
  readonly excessLoopsDetected: boolean;
424
424
  readonly notificationLoopCount: number;
425
425
  readonly notificationBoxesCreated: number;
@@ -18,6 +18,8 @@ export declare abstract class NotificationFirestoreCollections {
18
18
  export type NotificationTypes = typeof notificationUserIdentity | typeof notificationSummaryIdentity | typeof notificationBoxIdentity | typeof notificationIdentity | typeof notificationWeekIdentity;
19
19
  /**
20
20
  * Notification-related model that is initialized asynchronously at a later time.
21
+ *
22
+ * Examples: NotificationSummary, NotificationBox
21
23
  */
22
24
  export interface InitializedNotificationModel {
23
25
  /**
@@ -111,7 +113,7 @@ export declare const NOTIFICATION_SUMMARY_EMBEDDED_NOTIFICATION_ITEM_MESSAGE_MAX
111
113
  *
112
114
  * Notification Items can be delivered here.
113
115
  */
114
- export interface NotificationSummary {
116
+ export interface NotificationSummary extends InitializedNotificationModel {
115
117
  /**
116
118
  * Notification Summary creation date
117
119
  */
@@ -167,7 +169,7 @@ export declare const notificationBoxIdentity: import("../../common").RootFiresto
167
169
  *
168
170
  * Update to each recipient is propogated from NotificationUser values.
169
171
  */
170
- export interface NotificationBox {
172
+ export interface NotificationBox extends InitializedNotificationModel {
171
173
  /**
172
174
  * Notification Box creation date
173
175
  */
@@ -52,5 +52,11 @@ export declare const DEFAULT_NOTIFICATION_TASK_SUBTASK_CLEANUP_RETRY_DELAY: numb
52
52
  export type NotificationTaskSubtaskCheckpoint = typeof NOTIFICATION_TASK_SUBTASK_CHECKPOINT_PROCESSING | typeof NOTIFICATION_TASK_SUBTASK_CHECKPOINT_CLEANUP;
53
53
  /**
54
54
  * Returned by a subtask to complete the processing step and schedule the cleanup step.
55
+ *
56
+ * This is used internally in subtask running. Do not use this directly. Use of notificationSubtaskComplete() is preferred.
55
57
  */
56
58
  export declare function completeSubtaskProcessingAndScheduleCleanupTaskResult<D extends NotificationTaskSubtaskData>(): NotificationTaskServiceHandleNotificationTaskResult<D, NotificationTaskSubtaskCheckpoint>;
59
+ /**
60
+ * Similar to notificationTaskComplete, but is customized for a subtask with the intent of running the cleanup checkpoint.
61
+ */
62
+ export declare function notificationSubtaskComplete<D extends NotificationTaskSubtaskData>(options?: Maybe<Pick<NotificationTaskServiceHandleNotificationTaskResult<D, NotificationTaskSubtaskCheckpoint>, 'updateMetadata' | 'canRunNextCheckpoint'>>): NotificationTaskServiceHandleNotificationTaskResult<D, NotificationTaskSubtaskCheckpoint>;
@@ -2,6 +2,8 @@ export * from './storagefile.action';
2
2
  export * from './storagefile.api.error';
3
3
  export * from './storagefile.api';
4
4
  export * from './storagefile.create';
5
+ export * from './storagefile.group';
6
+ export * from './storagefile.group.processing';
5
7
  export * from './storagefile.id';
6
8
  export * from './storagefile.query';
7
9
  export * from './storagefile.task';
@@ -11,3 +13,4 @@ export * from './storagefile.file';
11
13
  export * from './storagefile.upload';
12
14
  export * from './storagefile.upload.claims';
13
15
  export * from './storagefile.upload.determiner';
16
+ export * from './storagefile.util';
@@ -1,8 +1,14 @@
1
1
  import { type AsyncFirebaseFunctionDeleteAction, type FirebaseFunctionDeleteAction, type AsyncFirebaseFunctionCreateAction, type AsyncFirebaseFunctionUpdateAction, type FirebaseFunctionCreateAction, type FirebaseFunctionUpdateAction } from '../../common';
2
- import { type StorageFileDocument } from './storagefile';
2
+ import { type StorageFileGroupDocument, type StorageFileDocument } from './storagefile';
3
3
  export type StorageFileCreateAction<P extends object> = FirebaseFunctionCreateAction<P, StorageFileDocument>;
4
4
  export type AsyncStorageFileCreateAction<P extends object> = AsyncFirebaseFunctionCreateAction<P, StorageFileDocument>;
5
5
  export type StorageFileUpdateAction<P extends object> = FirebaseFunctionUpdateAction<P, StorageFileDocument>;
6
6
  export type AsyncStorageFileUpdateAction<P extends object> = AsyncFirebaseFunctionUpdateAction<P, StorageFileDocument>;
7
7
  export type StorageFileDeleteAction<P extends object> = FirebaseFunctionDeleteAction<P, StorageFileDocument>;
8
8
  export type AsyncStorageFileDeleteAction<P extends object> = AsyncFirebaseFunctionDeleteAction<P, StorageFileDocument>;
9
+ export type StorageFileGroupCreateAction<P extends object> = FirebaseFunctionCreateAction<P, StorageFileGroupDocument>;
10
+ export type AsyncStorageFileGroupCreateAction<P extends object> = AsyncFirebaseFunctionCreateAction<P, StorageFileGroupDocument>;
11
+ export type StorageFileGroupUpdateAction<P extends object> = FirebaseFunctionUpdateAction<P, StorageFileGroupDocument>;
12
+ export type AsyncStorageFileGroupUpdateAction<P extends object> = AsyncFirebaseFunctionUpdateAction<P, StorageFileGroupDocument>;
13
+ export type StorageFileGroupDeleteAction<P extends object> = FirebaseFunctionDeleteAction<P, StorageFileGroupDocument>;
14
+ export type AsyncStorageFileGroupDeleteAction<P extends object> = AsyncFirebaseFunctionDeleteAction<P, StorageFileGroupDocument>;
@@ -1,8 +1,10 @@
1
- import { TargetModelParams, OnCallCreateModelResult } from '../../common';
1
+ import { TargetModelParams, OnCallCreateModelResult, FirestoreModelKey } from '../../common';
2
2
  import { type ModelFirebaseCrudFunction, type FirebaseFunctionTypeConfigMap, type ModelFirebaseCrudFunctionConfigMap, type ModelFirebaseFunctionMap, ModelFirebaseCreateFunction } from '../../client';
3
3
  import { StorageFileSignedDownloadUrl, StorageFileTypes } from './storagefile';
4
4
  import { type StorageBucketId, type StoragePath, type StorageSlashPath } from '../../common/storage';
5
- import { ContentDispositionString, ContentTypeMimeType, Maybe, Milliseconds } from '@dereekb/util';
5
+ import { ContentDispositionString, ContentTypeMimeType, Maybe, Milliseconds, UnixDateTimeSecondsNumber } from '@dereekb/util';
6
+ import { StorageFileId } from './storagefile.id';
7
+ import { SendNotificationResult } from '../notification/notification.api';
6
8
  /**
7
9
  * Used for directly create a new StorageFile.
8
10
  */
@@ -52,13 +54,25 @@ export declare class ProcessStorageFileParams extends TargetModelParams {
52
54
  */
53
55
  checkRetryProcessing?: Maybe<boolean>;
54
56
  /**
55
- * Used with retryProcessing.
57
+ * Used with checkRetryProcessing.
56
58
  *
57
- * If set, will forcibly create a new processing task even if the existing processing task appears to be ok.
59
+ * If set, will forcibly create a new processing task even if the existing processing task appears to be ok, or if processing was already marked complete.
58
60
  */
59
61
  forceRestartProcessing?: Maybe<boolean>;
62
+ /**
63
+ * If set, will start the processing again if the StorageFile is in a successful processing state.
64
+ */
65
+ processAgainIfSuccessful?: Maybe<boolean>;
60
66
  }
61
67
  export interface ProcessStorageFileResult {
68
+ /**
69
+ * Whether or not the StorageFile was run immediately.
70
+ */
71
+ readonly runImmediately: boolean;
72
+ /**
73
+ * The expedite result, if runImmediately returned true.
74
+ */
75
+ readonly expediteResult: Maybe<SendNotificationResult>;
62
76
  }
63
77
  /**
64
78
  * Processes all StorageFiles that are queued for processing.
@@ -136,11 +150,116 @@ export declare class DownloadStorageFileParams extends TargetModelParams {
136
150
  */
137
151
  asAdmin?: Maybe<boolean>;
138
152
  }
153
+ /**
154
+ * Result of downloading a StorageFile.
155
+ */
139
156
  export interface DownloadStorageFileResult {
140
157
  /**
141
158
  * The download URL.
142
159
  */
143
160
  readonly url: StorageFileSignedDownloadUrl;
161
+ /**
162
+ * The name of the StorageFile, if available.
163
+ */
164
+ readonly fileName?: Maybe<string>;
165
+ /**
166
+ * The mime type of the StorageFile, if available.
167
+ */
168
+ readonly mimeType?: Maybe<ContentTypeMimeType>;
169
+ /**
170
+ * Expiration time as a UnixDateTimeSecondsNumber value.
171
+ */
172
+ readonly expiresAt?: Maybe<UnixDateTimeSecondsNumber>;
173
+ }
174
+ /**
175
+ * Used for creating or initializing a new StorageFileGroup for a StorageFile.
176
+ *
177
+ * Mainly used for testing. Not exposed to the API.
178
+ *
179
+ * The preferred way is to create a StorageFileGroup through a StorageFile.
180
+ */
181
+ export declare class CreateStorageFileGroupParams {
182
+ /**
183
+ * ModelKey to use for creating the StorageFileGroup.
184
+ */
185
+ model?: Maybe<FirestoreModelKey>;
186
+ /**
187
+ * StorageFileId to use for creating the StorageFileGroup.
188
+ */
189
+ storageFileId?: Maybe<StorageFileId>;
190
+ }
191
+ export declare class SyncStorageFileWithGroupsParams extends TargetModelParams {
192
+ /**
193
+ * If true, will force syncing even if the StorageFile is not flagged for a resync.
194
+ */
195
+ force?: boolean;
196
+ }
197
+ export interface SyncStorageFileWithGroupsResult {
198
+ /**
199
+ * The number of StorageFileGroups that were created.
200
+ */
201
+ readonly storageFilesGroupsCreated: number;
202
+ /**
203
+ * The number of StorageFileGroups that were updated.
204
+ */
205
+ readonly storageFilesGroupsUpdated: number;
206
+ }
207
+ export declare class SyncAllFlaggedStorageFilesWithGroupsParams {
208
+ }
209
+ export interface SyncAllFlaggedStorageFilesWithGroupsResult {
210
+ /**
211
+ * The total number of StorageFiles that were synced.
212
+ */
213
+ readonly storageFilesSynced: number;
214
+ /**
215
+ * The total number of StorageFileGroups that were created.
216
+ */
217
+ readonly storageFilesGroupsCreated: number;
218
+ /**
219
+ * The total number of StorageFileGroups that were updated.
220
+ */
221
+ readonly storageFilesGroupsUpdated: number;
222
+ }
223
+ export declare class RegenerateStorageFileGroupContentParams extends TargetModelParams {
224
+ /**
225
+ * If true, will force syncing even if the StorageFile is not flagged for a resync.
226
+ */
227
+ force?: boolean;
228
+ }
229
+ export interface RegenerateStorageFileGroupContentResult {
230
+ /**
231
+ * The total number of "content" StorageFiles that were flagged for processing again.
232
+ */
233
+ readonly contentStorageFilesFlaggedForProcessing: number;
234
+ }
235
+ export declare class RegenerateAllFlaggedStorageFileGroupsContentParams {
236
+ }
237
+ export interface RegenerateAllFlaggedStorageFileGroupsContentResult {
238
+ /**
239
+ * The number of StorageFileGroups that were updated.
240
+ */
241
+ readonly storageFileGroupsUpdated: number;
242
+ /**
243
+ * The number of "content" StorageFiles that were flagged for processing again.
244
+ */
245
+ readonly contentStorageFilesFlaggedForProcessing: number;
246
+ }
247
+ /**
248
+ * Used for initializing an uninitialized model like NotificationBox or NotificationSummary.
249
+ */
250
+ export declare class InitializeStorageFileModelParams extends TargetModelParams {
251
+ /**
252
+ * Whether or not to throw an error if the notification has already been sent or is being sent.
253
+ */
254
+ throwErrorIfAlreadyInitialized?: boolean;
255
+ }
256
+ export declare class InitializeAllApplicableStorageFileGroupsParams {
257
+ }
258
+ export interface InitializeAllApplicableStorageFileGroupsResult {
259
+ readonly storageFileGroupsVisited: number;
260
+ readonly storageFileGroupsSucceeded: number;
261
+ readonly storageFileGroupsFailed: number;
262
+ readonly storageFileGroupsAlreadyInitialized: number;
144
263
  }
145
264
  export type StorageFileFunctionTypeMap = {};
146
265
  export declare const storageFileFunctionTypeConfigMap: FirebaseFunctionTypeConfigMap<StorageFileFunctionTypeMap>;
@@ -154,6 +273,7 @@ export type StorageFileModelCrudFunctionsConfig = {
154
273
  update: {
155
274
  _: UpdateStorageFileParams;
156
275
  process: [ProcessStorageFileParams, ProcessStorageFileResult];
276
+ syncWithGroups: [SyncStorageFileWithGroupsParams, SyncStorageFileWithGroupsResult];
157
277
  };
158
278
  read: {
159
279
  download: [DownloadStorageFileParams, DownloadStorageFileResult];
@@ -162,6 +282,11 @@ export type StorageFileModelCrudFunctionsConfig = {
162
282
  _: DeleteStorageFileParams;
163
283
  };
164
284
  };
285
+ storageFileGroup: {
286
+ update: {
287
+ regenerateContent: [RegenerateStorageFileGroupContentParams, RegenerateStorageFileGroupContentResult];
288
+ };
289
+ };
165
290
  };
166
291
  export declare const storageFileModelCrudFunctionsConfig: ModelFirebaseCrudFunctionConfigMap<StorageFileModelCrudFunctionsConfig, StorageFileTypes>;
167
292
  export declare abstract class StorageFileFunctions implements ModelFirebaseFunctionMap<StorageFileFunctionTypeMap, StorageFileModelCrudFunctionsConfig> {
@@ -174,6 +299,7 @@ export declare abstract class StorageFileFunctions implements ModelFirebaseFunct
174
299
  updateStorageFile: {
175
300
  update: ModelFirebaseCrudFunction<UpdateStorageFileParams>;
176
301
  process: ModelFirebaseCrudFunction<ProcessStorageFileParams, ProcessStorageFileResult>;
302
+ syncWithGroups: ModelFirebaseCrudFunction<SyncStorageFileWithGroupsParams, SyncStorageFileWithGroupsResult>;
177
303
  };
178
304
  readStorageFile: {
179
305
  download: ModelFirebaseCrudFunction<DownloadStorageFileParams, DownloadStorageFileResult>;
@@ -182,5 +308,10 @@ export declare abstract class StorageFileFunctions implements ModelFirebaseFunct
182
308
  delete: ModelFirebaseCrudFunction<DeleteStorageFileParams>;
183
309
  };
184
310
  };
311
+ abstract storageFileGroup: {
312
+ updateStorageFileGroup: {
313
+ regenerateContent: ModelFirebaseCrudFunction<RegenerateStorageFileGroupContentParams, RegenerateStorageFileGroupContentResult>;
314
+ };
315
+ };
185
316
  }
186
317
  export declare const storageFileFunctionMap: import("../../client").ModelFirebaseFunctionMapFactory<StorageFileFunctionTypeMap, StorageFileModelCrudFunctionsConfig>;
@@ -49,3 +49,19 @@ export declare const STORAGE_FILE_NOT_FLAGGED_FOR_DELETION_ERROR_CODE = "STORAGE
49
49
  * Thrown if the target StorageFileDocument is flagged for deletion, but has not reached the time to be deleted yet.
50
50
  */
51
51
  export declare const STORAGE_FILE_CANNOT_BE_DELETED_YET_ERROR_CODE = "STORAGE_FILE_CANNOT_BE_DELETED_YET";
52
+ /**
53
+ * Thrown if the target InitializedStorageFileModel has already been initialized.
54
+ */
55
+ export declare const STORAGE_FILE_MODEL_ALREADY_INITIALIZED_ERROR_CODE = "STORAGE_FILE_MODEL_ALREADY_INITIALIZED";
56
+ /**
57
+ * Thrown if the target StorageFileDocument is attempted to be synced with groups, but is not flagged for groups sync.
58
+ */
59
+ export declare const STORAGE_FILE_NOT_FLAGGED_FOR_GROUPS_SYNC_ERROR_CODE = "STORAGE_FILE_NOT_FLAGGED_FOR_GROUPS_SYNC";
60
+ /**
61
+ * Thrown if the target StorageFileGroupDocument is queued for initialization and the current function is not yet allowed.
62
+ */
63
+ export declare const STORAGE_FILE_GROUP_QUEUED_FOR_INITIALIZATION_ERROR_CODE = "STORAGE_FILE_GROUP_QUEUED_FOR_INITIALIZATION";
64
+ /**
65
+ * Thrown if both the target model and storageFileId is not provided in CreateStorageFileGroupParams.
66
+ */
67
+ export declare const STORAGE_FILE_GROUP_CREATE_INPUT_ERROR_CODE = "STORAGE_FILE_GROUP_CREATE_INPUT_ERROR";
@@ -1,11 +1,12 @@
1
1
  import { type Maybe } from '@dereekb/util';
2
- import { StorageFileCreationType, type StorageFile, type StorageFileDocument, type StorageFileFirestoreCollections } from './storagefile';
2
+ import { StorageFileCreationType, type StorageFileGroup, type StorageFile, type StorageFileDocument, type StorageFileFirestoreCollections } from './storagefile';
3
3
  import { type Transaction } from '../../common/firestore/types';
4
4
  import { type FirestoreDocumentAccessor } from '../../common/firestore/accessor/document';
5
5
  import { type FirebaseStorageAccessorFile } from '../../common/storage/driver/accessor';
6
6
  import { type StoragePathRef, type StoragePath } from '../../common/storage/storage';
7
7
  import { type FirebaseAuthOwnershipKey, type FirebaseAuthUserId } from '../../common/auth/auth';
8
- import { type StorageFileMetadata, type StorageFilePurpose } from './storagefile.id';
8
+ import { type StorageFileGroupId, type StorageFileGroupRelatedStorageFilePurpose, type StorageFileMetadata, type StorageFilePurpose } from './storagefile.id';
9
+ import { type ReadFirestoreModelKeyInput } from '../../common';
9
10
  export interface CreateStorageFileDocumentPairInput<M extends StorageFileMetadata = StorageFileMetadata> {
10
11
  /**
11
12
  * Optional "now" value that is assigned to the "cat" value, created at time.
@@ -43,6 +44,20 @@ export interface CreateStorageFileDocumentPairInput<M extends StorageFileMetadat
43
44
  * Corresponds with the "uby" value in the StorageFile template.
44
45
  */
45
46
  readonly uploadedBy?: Maybe<FirebaseAuthUserId>;
47
+ /**
48
+ * The group ids of the file.
49
+ *
50
+ * Corresponds with the "g" value in the StorageFile template.
51
+ */
52
+ readonly storageFileGroupIds?: Maybe<StorageFileGroupId[]>;
53
+ /**
54
+ * If true, will flag the file for group sync.
55
+ *
56
+ * Defaults to true if one or more values in "storageFileGroupIds" are provided.
57
+ *
58
+ * Ignored if the "storageFileGroupIds" value is empty.
59
+ */
60
+ readonly flagForStorageFileGroupsSync?: boolean;
46
61
  /**
47
62
  * The ownership key of the file.
48
63
  *
@@ -54,7 +69,13 @@ export interface CreateStorageFileDocumentPairInput<M extends StorageFileMetadat
54
69
  *
55
70
  * Corresponds with the "p" value in the StorageFile template.
56
71
  */
57
- readonly purpose?: Maybe<StorageFilePurpose>;
72
+ readonly purpose?: Maybe<StorageFilePurpose | StorageFileGroupRelatedStorageFilePurpose>;
73
+ /**
74
+ * The StorageFileGroup that the file is associated with.
75
+ *
76
+ * This is ONLY used if the creation type is StorageFileCreationType.FOR_STORAGE_FILE_GROUP.
77
+ */
78
+ readonly parentStorageFileGroup?: Maybe<ReadFirestoreModelKeyInput<StorageFileGroup>>;
58
79
  /**
59
80
  * The metadata of the file.
60
81
  *