@dereekb/firebase 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 (72) hide show
  1. package/index.cjs.js +892 -385
  2. package/index.esm.js +892 -385
  3. package/package.json +5 -5
  4. package/src/lib/client/error/error.d.ts +1 -1
  5. package/src/lib/client/firestore/driver.accessor.batch.d.ts +2 -0
  6. package/src/lib/client/firestore/driver.accessor.create.d.ts +1 -0
  7. package/src/lib/client/firestore/driver.accessor.d.ts +2 -0
  8. package/src/lib/client/firestore/driver.accessor.default.d.ts +4 -0
  9. package/src/lib/client/firestore/driver.accessor.transaction.d.ts +2 -0
  10. package/src/lib/client/firestore/driver.d.ts +2 -0
  11. package/src/lib/client/firestore/driver.query.d.ts +5 -0
  12. package/src/lib/client/function/development.function.factory.d.ts +1 -0
  13. package/src/lib/client/function/error.d.ts +1 -0
  14. package/src/lib/client/function/function.callable.d.ts +9 -2
  15. package/src/lib/client/function/function.factory.d.ts +2 -0
  16. package/src/lib/client/function/model.function.factory.d.ts +11 -4
  17. package/src/lib/client/storage/driver.accessor.d.ts +7 -0
  18. package/src/lib/client/storage/driver.d.ts +2 -0
  19. package/src/lib/common/auth/auth.error.d.ts +22 -7
  20. package/src/lib/common/development/function.d.ts +1 -0
  21. package/src/lib/common/development/function.schedule.d.ts +3 -1
  22. package/src/lib/common/firestore/accessor/accessor.wrap.modify.d.ts +9 -0
  23. package/src/lib/common/firestore/accessor/context.d.ts +9 -3
  24. package/src/lib/common/firestore/accessor/document.d.ts +49 -7
  25. package/src/lib/common/firestore/accessor/document.utility.d.ts +18 -6
  26. package/src/lib/common/firestore/collection/collection.d.ts +76 -11
  27. package/src/lib/common/firestore/driver/query.handler.d.ts +9 -3
  28. package/src/lib/common/firestore/snapshot/snapshot.field.d.ts +32 -1
  29. package/src/lib/common/model/function.d.ts +8 -3
  30. package/src/lib/common/model/model/model.loader.d.ts +1 -0
  31. package/src/lib/common/model/model.service.d.ts +9 -2
  32. package/src/lib/common/model/permission/permission.d.ts +12 -4
  33. package/src/lib/common/model/permission/permission.service.d.ts +1 -0
  34. package/src/lib/common/model/permission/permission.service.grant.d.ts +10 -0
  35. package/src/lib/common/model/permission/permission.service.role.d.ts +9 -7
  36. package/src/lib/common/storage/accessor/path.model.d.ts +1 -0
  37. package/src/lib/common/storage/context.d.ts +1 -0
  38. package/src/lib/common/storage/driver/accessor.iterate.d.ts +7 -0
  39. package/src/lib/common/storage/driver/accessor.util.d.ts +1 -0
  40. package/src/lib/common/storage/driver/error.d.ts +3 -0
  41. package/src/lib/common/storage/driver/list.d.ts +18 -3
  42. package/src/lib/common/storage/storage.d.ts +4 -0
  43. package/src/lib/common/storage/types.d.ts +3 -0
  44. package/src/lib/model/notification/notification.api.error.d.ts +27 -9
  45. package/src/lib/model/notification/notification.api.util.d.ts +12 -0
  46. package/src/lib/model/notification/notification.config.d.ts +28 -0
  47. package/src/lib/model/notification/notification.create.d.ts +24 -0
  48. package/src/lib/model/notification/notification.create.task.d.ts +2 -0
  49. package/src/lib/model/notification/notification.d.ts +42 -0
  50. package/src/lib/model/notification/notification.details.d.ts +3 -0
  51. package/src/lib/model/notification/notification.id.d.ts +4 -3
  52. package/src/lib/model/notification/notification.item.d.ts +2 -1
  53. package/src/lib/model/notification/notification.message.d.ts +6 -3
  54. package/src/lib/model/notification/notification.query.d.ts +12 -0
  55. package/src/lib/model/notification/notification.send.d.ts +4 -0
  56. package/src/lib/model/notification/notification.task.d.ts +7 -0
  57. package/src/lib/model/notification/notification.task.subtask.d.ts +5 -0
  58. package/src/lib/model/notification/notification.util.d.ts +38 -0
  59. package/src/lib/model/oidcmodel/oidcmodel.d.ts +6 -0
  60. package/src/lib/model/oidcmodel/oidcmodel.query.d.ts +18 -0
  61. package/src/lib/model/storagefile/storagefile.create.d.ts +4 -0
  62. package/src/lib/model/storagefile/storagefile.d.ts +16 -0
  63. package/src/lib/model/storagefile/storagefile.file.d.ts +2 -0
  64. package/src/lib/model/storagefile/storagefile.group.d.ts +4 -0
  65. package/src/lib/model/storagefile/storagefile.permission.d.ts +1 -0
  66. package/src/lib/model/storagefile/storagefile.query.d.ts +19 -0
  67. package/src/lib/model/storagefile/storagefile.task.d.ts +1 -0
  68. package/src/lib/model/storagefile/storagefile.upload.d.ts +6 -0
  69. package/src/lib/model/storagefile/storagefile.upload.determiner.d.ts +9 -0
  70. package/src/lib/model/storagefile/storagefile.util.d.ts +4 -0
  71. package/src/lib/model/system/system.d.ts +4 -0
  72. package/test/package.json +6 -6
@@ -35,6 +35,10 @@ export interface NotificationSendMessagesResult<K> {
35
35
  *
36
36
  * Used when combining results from multiple send batches within the same channel.
37
37
  *
38
+ * @param a - first result to merge
39
+ * @param b - second result to merge
40
+ * @returns a new result with all recipient lists concatenated from both inputs
41
+ *
38
42
  * @example
39
43
  * ```ts
40
44
  * const combined = mergeNotificationSendMessagesResult(firstBatchResult, secondBatchResult);
@@ -78,6 +78,8 @@ export interface NotificationTask<D extends NotificationItemMetadata = {}> {
78
78
  * Use this when the handler needs more time but doesn't want to increment the failure counter.
79
79
  * The task will be re-queued without counting as an error attempt.
80
80
  *
81
+ * @returns an empty checkpoint array signaling in-progress without failure
82
+ *
81
83
  * @example
82
84
  * ```ts
83
85
  * // Waiting for an external process — delay without failing
@@ -92,6 +94,7 @@ export declare function delayCompletion<S extends NotificationTaskCheckpointStri
92
94
  *
93
95
  * @param delayUntil - absolute date or relative milliseconds from the task's run start time
94
96
  * @param updateMetadata - optional metadata updates to merge into the notification item
97
+ * @returns a task result that re-queues the task after the specified delay without marking it failed
95
98
  *
96
99
  * @example
97
100
  * ```ts
@@ -108,6 +111,7 @@ export declare function notificationTaskDelayRetry<D extends NotificationItemMet
108
111
  *
109
112
  * @param completedParts - checkpoint string(s) that were just completed
110
113
  * @param updateMetadata - optional metadata updates to merge into the notification item
114
+ * @returns a task result marking the given checkpoints complete while keeping the task running
111
115
  *
112
116
  * @example
113
117
  * ```ts
@@ -120,6 +124,7 @@ export declare function notificationTaskPartiallyComplete<D extends Notification
120
124
  * Returns a result indicating the task completed successfully. The notification document will be deleted.
121
125
  *
122
126
  * @param updateMetadata - optional final metadata update (applied before deletion if subtasks need it)
127
+ * @returns a task result signaling successful completion; the notification document will be deleted
123
128
  *
124
129
  * @example
125
130
  * ```ts
@@ -135,6 +140,7 @@ export declare function notificationTaskComplete<D extends NotificationItemMetad
135
140
  *
136
141
  * @param updateMetadata - optional metadata updates
137
142
  * @param removeFromCompletedCheckpoints - checkpoint(s) to remove from the completed set (e.g., to retry a checkpoint)
143
+ * @returns a task result signaling failure; the error attempt counter is incremented
138
144
  *
139
145
  * @example
140
146
  * ```ts
@@ -151,6 +157,7 @@ export declare function notificationTaskFailed<D extends NotificationItemMetadat
151
157
  *
152
158
  * @param result - the task result to wrap
153
159
  * @param force - when true, overrides any existing `canRunNextCheckpoint` value
160
+ * @returns a copy of the result with `canRunNextCheckpoint` set to true
154
161
  */
155
162
  export declare function notificationTaskCanRunNextCheckpoint<D extends NotificationItemMetadata = {}, S extends NotificationTaskCheckpointString = NotificationTaskCheckpointString>(result: NotificationTaskServiceHandleNotificationTaskResult<D, S>, force?: Maybe<boolean>): NotificationTaskServiceHandleNotificationTaskResult<D, S>;
156
163
  /**
@@ -71,6 +71,8 @@ export type NotificationTaskSubtaskCheckpoint = typeof NOTIFICATION_TASK_SUBTASK
71
71
  * Internal helper that marks the `'processing'` checkpoint complete and schedules the `'cleanup'` phase.
72
72
  *
73
73
  * Prefer using {@link notificationSubtaskComplete} in subtask handlers instead of calling this directly.
74
+ *
75
+ * @returns a partially-complete task result with the processing checkpoint marked done
74
76
  */
75
77
  export declare function completeSubtaskProcessingAndScheduleCleanupTaskResult<D extends NotificationTaskSubtaskData>(): NotificationTaskServiceHandleNotificationTaskResult<D, NotificationTaskSubtaskCheckpoint>;
76
78
  /**
@@ -79,6 +81,9 @@ export declare function completeSubtaskProcessingAndScheduleCleanupTaskResult<D
79
81
  * Unlike {@link notificationTaskComplete}, this signals that the cleanup checkpoint should still run.
80
82
  * Use `canRunNextCheckpoint: true` in options to run cleanup immediately in the same execution.
81
83
  *
84
+ * @param options - optional metadata updates and flag to run cleanup immediately in the same execution
85
+ * @returns a task result marking the subtask as complete while allowing cleanup to proceed
86
+ *
82
87
  * @example
83
88
  * ```ts
84
89
  * // Processing done, schedule cleanup for next run
@@ -28,6 +28,9 @@ export interface EffectiveNotificationBoxRecipientConfigInput {
28
28
  *
29
29
  * Filters template configs to only include types applicable to the notification box's model.
30
30
  * Used during the server-side sync process to update box recipient entries from user configs.
31
+ *
32
+ * @param input - the merged config inputs including uid, global config, box config, and optional existing recipient
33
+ * @returns the computed effective box recipient with merged config, contact info, and flags
31
34
  */
32
35
  export declare function effectiveNotificationBoxRecipientConfig(input: EffectiveNotificationBoxRecipientConfigInput): NotificationBoxRecipient;
33
36
  /**
@@ -47,6 +50,9 @@ export interface UpdateNotificationUserNotificationSendExclusionsResult {
47
50
  * and propagates exclusion flags to the per-box configs.
48
51
  *
49
52
  * Exclusions not matching any associated notification box are automatically filtered out.
53
+ *
54
+ * @param input - the user, exclusions to add, and exclusions to remove
55
+ * @returns the updated exclusion list and the partial user update to apply
50
56
  */
51
57
  export declare function updateNotificationUserNotificationSendExclusions(input: UpdateNotificationUserNotificationSendExclusionsInput): UpdateNotificationUserNotificationSendExclusionsResult;
52
58
  /**
@@ -62,10 +68,16 @@ export type ApplyExclusionsToNotificationUserNotificationBoxRecipientConfigsResu
62
68
  /**
63
69
  * Applies the current exclusion list to per-box configs, setting/clearing the `x` flag and marking
64
70
  * changed configs as needing sync (`ns = true`).
71
+ *
72
+ * @param params - the exclusion list, per-box configs, and optional flag to recalculate the global ns flag
73
+ * @returns the updated per-box configs and the recalculated needs-sync flag
65
74
  */
66
75
  export declare function applyExclusionsToNotificationUserNotificationBoxRecipientConfigs(params: ApplyExclusionsToNotificationUserNotificationBoxRecipientConfigsParams): ApplyExclusionsToNotificationUserNotificationBoxRecipientConfigsResult;
67
76
  /**
68
77
  * Returns true if any of the per-box configs need syncing (`ns == true`).
78
+ *
79
+ * @param configs - array of per-box recipient configs to check
80
+ * @returns true if at least one config has its needs-sync flag set
69
81
  */
70
82
  export declare function calculateNsForNotificationUserNotificationBoxRecipientConfigs(configs: NotificationUserNotificationBoxRecipientConfig[]): boolean;
71
83
  /**
@@ -78,16 +90,25 @@ export type NotificationSendExclusionCanSendFunction = ((notification: Notificat
78
90
  /**
79
91
  * Creates a {@link NotificationSendExclusionCanSendFunction} from the given exclusion list.
80
92
  * Returns true for IDs that don't match any exclusion prefix.
93
+ *
94
+ * @param exclusions - the list of box IDs or prefixes that should be excluded from delivery
95
+ * @returns a predicate function that returns true if the given notification/box ID is not excluded
81
96
  */
82
97
  export declare const notificationSendExclusionCanSendFunction: (exclusions: NotificationBoxSendExclusionList) => NotificationSendExclusionCanSendFunction;
83
98
  /**
84
99
  * Returns true if all channels on the notification have reached a terminal state
85
100
  * (NONE, NO_TRY, SENT, or SKIPPED). Used to determine if the notification can be marked done.
101
+ *
102
+ * @param input - the per-channel send flags to evaluate
103
+ * @returns true if all channels are in a terminal send state
86
104
  */
87
105
  export declare function notificationSendFlagsImplyIsComplete(input: NotificationSendFlags): boolean;
88
106
  /**
89
107
  * Returns true if the given send state is terminal — no further send attempts will be made.
90
108
  * Terminal states: NONE, NO_TRY, SENT, SKIPPED.
109
+ *
110
+ * @param input - the send state to evaluate
111
+ * @returns true if the state is terminal and no further delivery will be attempted
91
112
  */
92
113
  export declare function isCompleteNotificationSendState(input: NotificationSendState): boolean;
93
114
  /**
@@ -100,6 +121,9 @@ export interface AllowedNotificationRecipients {
100
121
  }
101
122
  /**
102
123
  * Resolves which recipient groups (global, box, explicit) are allowed based on the {@link NotificationRecipientSendFlag}.
124
+ *
125
+ * @param flag - the recipient send flag controlling which groups are included
126
+ * @returns an object indicating which recipient groups are permitted for this notification
103
127
  */
104
128
  export declare function allowedNotificationRecipients(flag?: Maybe<NotificationRecipientSendFlag>): AllowedNotificationRecipients;
105
129
  /**
@@ -107,15 +131,26 @@ export declare function allowedNotificationRecipients(flag?: Maybe<NotificationR
107
131
  *
108
132
  * Only notifications that can be sent to box recipients are archived (notifications restricted
109
133
  * to only explicit or only global recipients are not saved to the weekly archive).
134
+ *
135
+ * @param notification - the notification to check
136
+ * @returns true if the notification should be saved to the weekly archive after delivery
110
137
  */
111
138
  export declare function shouldSaveNotificationToNotificationWeek(notification: Notification): boolean;
112
139
  /**
113
140
  * Merges a partial update into a {@link NotificationUserNotificationBoxRecipientConfig},
114
141
  * preserving user-controlled fields (`nb`, `rm`, `ns`, `lk`, `bk`) and respecting OPT_OUT state.
142
+ *
143
+ * @param a - base user box recipient config to merge into
144
+ * @param b - partial update to apply on top of the base
145
+ * @returns the merged config with protected fields retained from `a`
115
146
  */
116
147
  export declare function mergeNotificationUserNotificationBoxRecipientConfigs(a: NotificationUserNotificationBoxRecipientConfig, b: Partial<NotificationUserNotificationBoxRecipientConfig>): NotificationUserNotificationBoxRecipientConfig;
117
148
  /**
118
149
  * Merges a partial update into a {@link NotificationBoxRecipient}, deeply merging the `c` (config record) field.
150
+ *
151
+ * @param a - base recipient to merge into
152
+ * @param b - partial recipient update to apply on top of the base
153
+ * @returns the merged recipient with deeply merged template config records
119
154
  */
120
155
  export declare function mergeNotificationBoxRecipients<T extends NotificationBoxRecipient>(a: T, b: Partial<T>): T;
121
156
  /**
@@ -136,6 +171,9 @@ export interface NotificationBoxDocumentReferencePair {
136
171
  /**
137
172
  * Resolves a {@link NotificationBoxDocument} from a reference pair, loading by model key if no document is provided directly.
138
173
  *
174
+ * @param input - reference pair containing either a direct document or a model key to load from
175
+ * @param accessor - Firestore document accessor used to load the document by ID when needed
176
+ * @returns the resolved NotificationBoxDocument
139
177
  * @throws {Error} When neither a document nor a model key is provided.
140
178
  */
141
179
  export declare function loadNotificationBoxDocumentForReferencePair(input: NotificationBoxDocumentReferencePair, accessor: FirestoreDocumentAccessor<NotificationBox, NotificationBoxDocument>): NotificationBoxDocument;
@@ -106,9 +106,15 @@ export interface OidcEntryFirestoreCollectionConfig {
106
106
  }
107
107
  /**
108
108
  * Returns the Firestore {@link CollectionReference} for {@link OidcEntry} documents.
109
+ *
110
+ * @param context - the Firestore context to use
111
+ * @returns the CollectionReference for OidcEntry documents
109
112
  */
110
113
  export declare function oidcEntryCollectionReference(context: FirestoreContext): CollectionReference<OidcEntry>;
111
114
  /**
112
115
  * Creates an {@link OidcEntryFirestoreCollection} from the given configuration.
116
+ *
117
+ * @param config - the Firestore context and collection configuration
118
+ * @returns a configured OidcEntryFirestoreCollection
113
119
  */
114
120
  export declare function oidcEntryFirestoreCollection(config: OidcEntryFirestoreCollectionConfig): OidcEntryFirestoreCollection;
@@ -2,21 +2,39 @@ import { type FirebaseAuthOwnershipKey, type FirebaseAuthUserId, type FirestoreQ
2
2
  import { type OidcEntryType } from './oidcmodel';
3
3
  /**
4
4
  * Query for OidcEntry documents with a specific type.
5
+ *
6
+ * @param type - the OIDC entry type to filter by
7
+ * @returns Firestore query constraints for the given type
5
8
  */
6
9
  export declare function oidcEntriesWithTypeQuery(type: OidcEntryType): FirestoreQueryConstraint[];
7
10
  /**
8
11
  * Query for OidcEntry documents with a specific type and userCode.
12
+ *
13
+ * @param type - the OIDC entry type to filter by
14
+ * @param userCode - the user code to match
15
+ * @returns Firestore query constraints for the given type and userCode
9
16
  */
10
17
  export declare function oidcEntriesByUserCodeQuery(type: OidcEntryType, userCode: string): FirestoreQueryConstraint[];
11
18
  /**
12
19
  * Query for OidcEntry documents with a specific type and uid.
20
+ *
21
+ * @param type - the OIDC entry type to filter by
22
+ * @param uid - the Firebase user ID to match
23
+ * @returns Firestore query constraints for the given type and uid
13
24
  */
14
25
  export declare function oidcEntriesByUidQuery(type: OidcEntryType, uid: FirebaseAuthUserId): FirestoreQueryConstraint[];
15
26
  /**
16
27
  * Query for OidcEntry documents with a specific type and grantId.
28
+ *
29
+ * @param type - the OIDC entry type to filter by
30
+ * @param grantId - the grant ID to match
31
+ * @returns Firestore query constraints for the given type and grantId
17
32
  */
18
33
  export declare function oidcEntriesByGrantIdQuery(type: OidcEntryType, grantId: string): FirestoreQueryConstraint[];
19
34
  /**
20
35
  * Query for OidcEntry Client documents owned by a specific user.
36
+ *
37
+ * @param ownershipKey - the ownership key identifying the owner
38
+ * @returns Firestore query constraints for Client entries matching the ownership key
21
39
  */
22
40
  export declare function oidcClientEntriesByOwnerQuery(ownershipKey: FirebaseAuthOwnershipKey): FirestoreQueryConstraint[];
@@ -171,6 +171,7 @@ export type CreateStorageFileDocumentPairFactory = <M extends StorageFileMetadat
171
171
  * initial state setup.
172
172
  *
173
173
  * @param config - optional defaults for creation type, subgroup, and processing state
174
+ * @returns a factory function that creates StorageFile document pairs
174
175
  * @throws {Error} When neither accessor nor context is provided
175
176
  * @throws {Error} When no storage path can be resolved from the input
176
177
  * @throws {Error} When FOR_STORAGE_FILE_GROUP is used without parentStorageFileGroup or purpose
@@ -193,5 +194,8 @@ export declare function createStorageFileDocumentPairFactory(config?: CreateStor
193
194
  * Convenience function for creating a StorageFileDocumentPair.
194
195
  *
195
196
  * Calls createStorageFileDocumentPairFactory() with no arguments, then passes the input to the factory and returns the result.
197
+ *
198
+ * @param input - the creation input specifying the storage path, purpose, and context
199
+ * @returns a promise resolving to the created StorageFileDocument and StorageFile data
196
200
  */
197
201
  export declare function createStorageFileDocumentPair<M extends StorageFileMetadata = StorageFileMetadata>(input: CreateStorageFileDocumentPairInput<M>): Promise<CreateStorageFileDocumentPairResult<M>>;
@@ -61,6 +61,10 @@ export declare const storageFileIdentity: import("../..").RootFirestoreModelIden
61
61
  export type StorageFileGroupCreatedStorageFileKey<P extends StorageFileGroupRelatedStorageFilePurpose> = FirestoreCollectionModelKey<typeof storageFileIdentity, `${P}_${OneWayFlatFirestoreModelKey}`>;
62
62
  /**
63
63
  * Creates a StorageFileGroupCreatedStorageFileKey from the input StorageFileGroupId and purpose.
64
+ *
65
+ * @param purpose - the purpose identifying the type of file within the group
66
+ * @param storageFileGroupId - the ID of the parent StorageFileGroup
67
+ * @returns a deterministic FirestoreCollectionModelKey for the storage file
64
68
  */
65
69
  export declare function storageFileGroupCreatedStorageFileKey<P extends StorageFileGroupRelatedStorageFilePurpose>(purpose: P, storageFileGroupId: StorageFileGroupId): StorageFileGroupCreatedStorageFileKey<P>;
66
70
  /**
@@ -379,6 +383,9 @@ export declare const storageFileConverter: import("../..").SnapshotConverterFunc
379
383
  * ```ts
380
384
  * const colRef = storageFileCollectionReference(firestoreContext);
381
385
  * ```
386
+ *
387
+ * @param context - the Firestore context to use
388
+ * @returns the CollectionReference for StorageFile documents
382
389
  */
383
390
  export declare function storageFileCollectionReference(context: FirestoreContext): CollectionReference<StorageFile>;
384
391
  /**
@@ -393,6 +400,9 @@ export type StorageFileFirestoreCollection = FirestoreCollection<StorageFile, St
393
400
  * const collection = storageFileFirestoreCollection(firestoreContext);
394
401
  * const doc = collection.documentAccessor().newDocument();
395
402
  * ```
403
+ *
404
+ * @param firestoreContext - the Firestore context to use
405
+ * @returns a configured StorageFileFirestoreCollection
396
406
  */
397
407
  export declare function storageFileFirestoreCollection(firestoreContext: FirestoreContext): StorageFileFirestoreCollection;
398
408
  /**
@@ -505,6 +515,9 @@ export declare const storageFileGroupConverter: import("../..").SnapshotConverte
505
515
  * ```ts
506
516
  * const colRef = storageFileGroupCollectionReference(firestoreContext);
507
517
  * ```
518
+ *
519
+ * @param context - the Firestore context to use
520
+ * @returns the CollectionReference for StorageFileGroup documents
508
521
  */
509
522
  export declare function storageFileGroupCollectionReference(context: FirestoreContext): CollectionReference<StorageFileGroup>;
510
523
  /**
@@ -519,5 +532,8 @@ export type StorageFileGroupFirestoreCollection = FirestoreCollection<StorageFil
519
532
  * const collection = storageFileGroupFirestoreCollection(firestoreContext);
520
533
  * const doc = collection.documentAccessor().loadDocumentForId(groupId);
521
534
  * ```
535
+ *
536
+ * @param firestoreContext - the Firestore context to use
537
+ * @returns a configured StorageFileGroupFirestoreCollection
522
538
  */
523
539
  export declare function storageFileGroupFirestoreCollection(firestoreContext: FirestoreContext): StorageFileGroupFirestoreCollection;
@@ -60,6 +60,8 @@ export interface StoredFileReader {
60
60
  *
61
61
  * Should only be used server-side, as `copy` may not be available on the client.
62
62
  *
63
+ * @returns a factory function that wraps FirebaseStorageAccessorFile instances into StoredFileReader accessors
64
+ *
63
65
  * @example
64
66
  * ```ts
65
67
  * const factory = storedFileReaderFactory();
@@ -11,6 +11,7 @@ export declare const STORAGE_FILE_GROUP_ROOT_FOLDER_PATH: SlashPathFolder;
11
11
  *
12
12
  * @param storageFileGroupId - the group's document ID
13
13
  * @param subPath - optional sub-paths to append
14
+ * @returns the folder path as a SlashPathFolder string
14
15
  *
15
16
  * @example
16
17
  * ```ts
@@ -29,6 +30,9 @@ export declare const STORAGE_FILE_GROUP_ZIP_FILE_PATH: SlashPathFile;
29
30
  /**
30
31
  * Returns the full storage path for a StorageFileGroup's zip file.
31
32
  *
33
+ * @param storageFileGroupId - the group's document ID
34
+ * @returns the full SlashPath to the group's zip archive
35
+ *
32
36
  * @example
33
37
  * ```ts
34
38
  * const zipPath = storageFileGroupZipFileStoragePath('abc123');
@@ -34,6 +34,7 @@ export type GrantStorageFileRolesForUserAuthFunction = (input: GrantStorageFileR
34
34
  * Use this within a permission service to define role-based access for StorageFile operations.
35
35
  *
36
36
  * @param config - the permission output, auth context, and target document
37
+ * @returns a function that accepts role configuration and returns a GrantRolesOtherwiseFunction
37
38
  *
38
39
  * @example
39
40
  * ```ts
@@ -12,6 +12,8 @@ import { type FirebaseAuthUserId } from '../../common/auth/auth';
12
12
  * const constraints = storageFilesQueuedForProcessingQuery();
13
13
  * const results = await collection.query(constraints);
14
14
  * ```
15
+ *
16
+ * @returns Firestore query constraints for StorageFiles queued for processing
15
17
  */
16
18
  export declare function storageFilesQueuedForProcessingQuery(): FirestoreQueryConstraint[];
17
19
  /**
@@ -20,6 +22,7 @@ export declare function storageFilesQueuedForProcessingQuery(): FirestoreQueryCo
20
22
  * Used by the cleanup service to find files ready for permanent deletion.
21
23
  *
22
24
  * @param now - reference time for comparison; defaults to current time
25
+ * @returns Firestore query constraints for StorageFiles whose scheduled delete date has passed
23
26
  *
24
27
  * @example
25
28
  * ```ts
@@ -43,6 +46,10 @@ export interface StorageFilePurposeAndUserQueryInput {
43
46
  * with optional subgroup filtering.
44
47
  *
45
48
  * @example
49
+ * @param input - the user, purpose, and optional subgroup to filter by
50
+ * @returns Firestore query constraints for the given purpose and user
51
+ *
52
+ * @example
46
53
  * ```ts
47
54
  * const constraints = storageFilePurposeAndUserQuery({
48
55
  * user: 'user123',
@@ -57,6 +64,9 @@ export declare function storageFilePurposeAndUserQuery(input: StorageFilePurpose
57
64
  * Used by the sync service to find files whose group memberships need to be propagated.
58
65
  *
59
66
  * @example
67
+ * @returns Firestore query constraints for StorageFiles flagged for group synchronization
68
+ *
69
+ * @example
60
70
  * ```ts
61
71
  * const constraints = storageFileFlaggedForSyncWithGroupsQuery();
62
72
  * ```
@@ -68,6 +78,9 @@ export declare function storageFileFlaggedForSyncWithGroupsQuery(): FirestoreQue
68
78
  * Used by the initialization service to find newly-created groups that haven't been synced yet.
69
79
  *
70
80
  * @example
81
+ * @returns Firestore query constraints for StorageFileGroups needing initialization
82
+ *
83
+ * @example
71
84
  * ```ts
72
85
  * const constraints = storageFileGroupsFlaggedForNeedsInitializationQuery();
73
86
  * ```
@@ -77,6 +90,9 @@ export declare function storageFileGroupsFlaggedForNeedsInitializationQuery(): F
77
90
  * Returns query constraints for StorageFileGroups flagged for content regeneration (`re == true`).
78
91
  *
79
92
  * @example
93
+ * @returns Firestore query constraints for StorageFileGroups flagged for content regeneration
94
+ *
95
+ * @example
80
96
  * ```ts
81
97
  * const constraints = storageFileGroupsFlaggedForContentRegenerationQuery();
82
98
  * ```
@@ -88,6 +104,9 @@ export declare function storageFileGroupsFlaggedForContentRegenerationQuery(): F
88
104
  * Invalid groups are typically cleaned up (deleted along with their associated files).
89
105
  *
90
106
  * @example
107
+ * @returns Firestore query constraints for StorageFileGroups flagged as invalid
108
+ *
109
+ * @example
91
110
  * ```ts
92
111
  * const constraints = storageFileGroupsFlaggedInvalidQuery();
93
112
  * ```
@@ -69,6 +69,7 @@ export interface StorageFileProcessingNotificationTaskInput<M extends StorageFil
69
69
  * The created task is unique per StorageFile (only one processing task at a time).
70
70
  *
71
71
  * @param input - the target StorageFileDocument and optional subtask data
72
+ * @returns a CreateNotificationTaskTemplate for the StorageFile processing task
72
73
  *
73
74
  * @example
74
75
  * ```ts
@@ -28,6 +28,7 @@ export type UserUploadsFolderSlashPathFactory = FactoryWithRequiredInput<SlashPa
28
28
  * Creates a {@link UserUploadsFolderSlashPathFactory} that generates per-user upload folder paths.
29
29
  *
30
30
  * @param inputBasePath - optional custom base path; defaults to {@link ALL_USER_UPLOADS_FOLDER_PATH}
31
+ * @returns a factory function that generates per-user upload folder slash paths
31
32
  *
32
33
  * @example
33
34
  * ```ts
@@ -51,6 +52,11 @@ export interface UserUploadsFolderStoragePathFactoryConfig {
51
52
  /**
52
53
  * Creates a {@link UserUploadsFolderStoragePathFactory} that includes the storage bucket ID.
53
54
  *
55
+ * @param root0 - the configuration object
56
+ * @param root0.bucketId - the storage bucket ID to include in each generated path
57
+ * @param root0.basePath - optional custom base path; defaults to {@link ALL_USER_UPLOADS_FOLDER_PATH}
58
+ * @returns a factory function that generates per-user StoragePath values including the bucket ID
59
+ *
54
60
  * @example
55
61
  * ```ts
56
62
  * const factory = userUploadsFolderStoragePathFactory({ bucketId: 'my-bucket' });
@@ -133,6 +133,7 @@ export interface DetermineByFileNameConfig {
133
133
  * (e.g., `image` matches `image.png`, `image-test.jpg`) at {@link HIGH_UPLOADED_FILE_TYPE_DETERMINATION_LEVEL}.
134
134
  *
135
135
  * @param config - file type, match string, and optional determination levels
136
+ * @returns an UploadedFileTypeDeterminer that classifies by file name
136
137
  *
137
138
  * @example
138
139
  * ```ts
@@ -160,6 +161,7 @@ export interface DetermineByFolderNameConfig {
160
161
  * exactly equals the configured match string.
161
162
  *
162
163
  * @param config - file type and folder name to match
164
+ * @returns an UploadedFileTypeDeterminer that classifies by folder name
163
165
  *
164
166
  * @example
165
167
  * ```ts
@@ -202,6 +204,7 @@ export interface DetermineByFilePathConfig {
202
204
  * built-in determiners.
203
205
  *
204
206
  * @param config - file type, path match config, optional bucket/file filters
207
+ * @returns an UploadedFileTypeDeterminer that classifies by storage path
205
208
  *
206
209
  * @example
207
210
  * ```ts
@@ -259,6 +262,7 @@ export type DetermineUserByFolderDeterminerWrapperFunction = (determiner: Upload
259
262
  * If `requireUser` is true, the determination fails when no user can be detected.
260
263
  *
261
264
  * @param config - root folder, user prefix, and matching options
265
+ * @returns a wrapper function that adds user detection to any UploadedFileTypeDeterminer
262
266
  *
263
267
  * @example
264
268
  * ```ts
@@ -273,6 +277,9 @@ export declare function determineUserByFolderWrapperFunction(config: DetermineUs
273
277
  /**
274
278
  * Convenience wrapper pre-configured for the standard uploads folder structure (`uploads/u/{userId}/...`).
275
279
  *
280
+ * @param config - optional matching options (rootFolder and userFolderPrefix are pre-configured)
281
+ * @returns a wrapper function that adds user detection for the standard uploads folder structure
282
+ *
276
283
  * @example
277
284
  * ```ts
278
285
  * const addUser = determineUserByUserUploadsFolderWrapperFunction();
@@ -316,6 +323,7 @@ export interface LimitUploadFileTypeDeterminerConfig {
316
323
  *
317
324
  * @param determiner - the determiner to filter
318
325
  * @param types - allowed file type identifier(s)
326
+ * @returns an UploadedFileTypeDeterminer that only returns results for the specified file types
319
327
  *
320
328
  * @example
321
329
  * ```ts
@@ -351,6 +359,7 @@ export interface CombineUploadFileTypeDeterminerConfig {
351
359
  * short-circuited via `completeSearchOnFirstMatch` or `completeSearchAtLevel`.
352
360
  *
353
361
  * @param config - determiners to combine and optional early-exit settings
362
+ * @returns a combined UploadedFileTypeDeterminer that returns the highest-confidence match
354
363
  *
355
364
  * @example
356
365
  * ```ts
@@ -26,6 +26,9 @@ export interface StorageFileGroupDocumentReferencePair {
26
26
  * If a document is provided directly, it is returned as-is. Otherwise, the related model key
27
27
  * is converted to a group ID via {@link storageFileGroupIdForModel} and loaded from the accessor.
28
28
  *
29
+ * @param input - reference pair containing either a document or a related model key
30
+ * @param accessor - document accessor used to load the group document by ID
31
+ * @returns the resolved StorageFileGroupDocument
29
32
  * @throws {Error} When neither storageFileGroupDocument nor storageFileGroupRelatedModelKey is provided
30
33
  *
31
34
  * @example
@@ -106,6 +109,7 @@ export interface CalculateStorageFileGroupRegenerationResult {
106
109
  * - Any embedded file has never been included in the zip (`zat` is unset on the entry)
107
110
  *
108
111
  * @param input - group state and optional force flag
112
+ * @returns the regeneration result indicating whether the zip or other derived files need to be regenerated
109
113
  *
110
114
  * @example
111
115
  * ```ts
@@ -85,6 +85,9 @@ export declare const systemStateConverter: import("../..").SnapshotConverterFunc
85
85
  * ```ts
86
86
  * const colRef = systemStateCollectionReference(firestoreContext);
87
87
  * ```
88
+ *
89
+ * @param context - the Firestore context to use
90
+ * @returns the CollectionReference for SystemState documents
88
91
  */
89
92
  export declare function systemStateCollectionReference(context: FirestoreContext): CollectionReference<SystemState>;
90
93
  export type SystemStateFirestoreCollection<T extends SystemStateStoredData = SystemStateStoredData> = FirestoreCollection<SystemState<T>, SystemStateDocument<T>>;
@@ -113,6 +116,7 @@ export type SystemStateStoredDataConverterMap = {
113
116
  *
114
117
  * @param firestoreContext - the Firestore context
115
118
  * @param converters - map of type identifiers to their data field converters
119
+ * @returns a configured SystemStateFirestoreCollection with per-type data converters
116
120
  *
117
121
  * @example
118
122
  * ```ts
package/test/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@dereekb/firebase/test",
3
- "version": "13.4.1",
3
+ "version": "13.4.2",
4
4
  "peerDependencies": {
5
- "@dereekb/date": "13.4.1",
6
- "@dereekb/firebase": "13.4.1",
7
- "@dereekb/model": "13.4.1",
8
- "@dereekb/rxjs": "13.4.1",
9
- "@dereekb/util": "13.4.1",
5
+ "@dereekb/date": "13.4.2",
6
+ "@dereekb/firebase": "13.4.2",
7
+ "@dereekb/model": "13.4.2",
8
+ "@dereekb/rxjs": "13.4.2",
9
+ "@dereekb/util": "13.4.2",
10
10
  "@firebase/rules-unit-testing": "5.0.0",
11
11
  "date-fns": "^4.0.0",
12
12
  "firebase": "^12.0.0",