@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
@@ -1,5 +1,17 @@
1
1
  import { type Maybe } from '@dereekb/util';
2
2
  import { type StorageListFilesPageToken, type FirebaseStorageAccessorFile, type FirebaseStorageAccessorFolder, type StorageListFilesOptions, type StorageListFilesResult, type StorageListItemResult } from './accessor';
3
+ /**
4
+ * Input context for {@link StorageListFilesResultFactory} and related delegate methods.
5
+ *
6
+ * Bundles the storage instance, target folder, and listing options into a single parameter.
7
+ *
8
+ * @template S - the storage instance type (client or server SDK)
9
+ */
10
+ export interface StorageListFilesResultFactoryInput<S> {
11
+ readonly storage: S;
12
+ readonly folder: FirebaseStorageAccessorFolder;
13
+ readonly options: Maybe<StorageListFilesOptions>;
14
+ }
3
15
  /**
4
16
  * Delegate that adapts platform-specific list results into the generic {@link StorageListFilesResult} interface.
5
17
  *
@@ -13,7 +25,7 @@ export interface StorageListFilesResultFactoryDelegate<S, R> {
13
25
  hasItems(result: R): boolean;
14
26
  hasNext(result: R): boolean;
15
27
  nextPageTokenFromResult(result: R): Maybe<StorageListFilesPageToken>;
16
- next(storage: S, options: Maybe<StorageListFilesOptions>, folder: FirebaseStorageAccessorFolder, result: R): Promise<StorageListFilesResult>;
28
+ next(input: StorageListFilesResultFactoryInput<S>, result: R): Promise<StorageListFilesResult>;
17
29
  file(storage: S, fileResult: StorageListItemResult): FirebaseStorageAccessorFile;
18
30
  folder(storage: S, folderResult: StorageListItemResult): FirebaseStorageAccessorFolder;
19
31
  filesFromResult(result: R, folder: FirebaseStorageAccessorFolder): StorageListItemResult[];
@@ -22,7 +34,7 @@ export interface StorageListFilesResultFactoryDelegate<S, R> {
22
34
  /**
23
35
  * Factory function that transforms a raw SDK list result into a normalized {@link StorageListFilesResult}.
24
36
  */
25
- export type StorageListFilesResultFactory<S, R> = (storage: S, folder: FirebaseStorageAccessorFolder, options: Maybe<StorageListFilesOptions>, result: R) => StorageListFilesResult;
37
+ export type StorageListFilesResultFactory<S, R> = (input: StorageListFilesResultFactoryInput<S>, result: R) => StorageListFilesResult;
26
38
  /**
27
39
  * Creates a {@link StorageListFilesResultFactory} from a platform-specific delegate.
28
40
  *
@@ -30,16 +42,19 @@ export type StorageListFilesResultFactory<S, R> = (storage: S, folder: FirebaseS
30
42
  * provides cursor-based pagination through the `next()` method.
31
43
  *
32
44
  * @param delegate - platform-specific implementation for extracting results
45
+ * @returns a {@link StorageListFilesResultFactory} that normalizes raw SDK list results
33
46
  *
34
47
  * @example
35
48
  * ```ts
36
49
  * const factory = storageListFilesResultFactory(myDelegate);
37
- * const result = factory(storage, folder, { maxResults: 50 }, rawSdkResult);
50
+ * const result = factory({ storage, folder, options: { maxResults: 50 } }, rawSdkResult);
38
51
  * const files = result.files();
39
52
  * ```
40
53
  */
41
54
  export declare function storageListFilesResultFactory<S, R>(delegate: StorageListFilesResultFactoryDelegate<S, R>): StorageListFilesResultFactory<S, R>;
42
55
  /**
43
56
  * Creates an error thrown when `next()` is called on a list result that has no more pages.
57
+ *
58
+ * @returns an {@link Error} indicating there are no more pages to fetch
44
59
  */
45
60
  export declare function storageListFilesResultHasNoNextError(): Error;
@@ -41,6 +41,7 @@ export interface StoragePath extends StorageBucketIdRef, StorageSlashPathRef {
41
41
  * Useful when you need an independent reference that won't be affected by mutations to the original.
42
42
  *
43
43
  * @param path - the storage path to copy
44
+ * @returns a new {@link StoragePath} with the same `bucketId` and `pathString`
44
45
  *
45
46
  * @example
46
47
  * ```ts
@@ -74,6 +75,7 @@ export interface StoragePathFactoryConfig extends StorageBucketIdRef {
74
75
  * with a consistent bucket assignment.
75
76
  *
76
77
  * @param config - bucket and replacement behavior
78
+ * @returns a {@link StoragePathFactory} that normalizes path inputs with the configured bucket
77
79
  *
78
80
  * @example
79
81
  * ```ts
@@ -112,6 +114,7 @@ export type GoogleCloudStorageFilePath<P extends StorageSlashPath = StorageSlash
112
114
  * (implying the default bucket).
113
115
  *
114
116
  * @param path - the storage path to convert
117
+ * @returns a {@link GoogleCloudStorageFilePath} string (`gs://bucket/path` or a relative path)
115
118
  *
116
119
  * @example
117
120
  * ```ts
@@ -124,6 +127,7 @@ export declare function firebaseStorageFilePathFromStorageFilePath(path: Storage
124
127
  * Returns the `gs://` bucket prefix URI for the given bucket identifier or ref.
125
128
  *
126
129
  * @param storage - bucket ID string or a {@link StorageBucketIdRef}
130
+ * @returns the `gs://bucket` prefix URI as a {@link GoogleCloudStorageBucketPrefix}
127
131
  *
128
132
  * @example
129
133
  * ```ts
@@ -165,16 +165,19 @@ export interface StorageUploadTask<R = unknown> {
165
165
  readonly taskRef: R;
166
166
  /**
167
167
  * Cancels a running task. Has no effect on a complete or failed task.
168
+ *
168
169
  * @returns True if the cancel had an effect.
169
170
  */
170
171
  cancel(): boolean;
171
172
  /**
172
173
  * Pauses a currently running task. Has no effect on a paused or failed task.
174
+ *
173
175
  * @returns True if the operation took effect, false if ignored.
174
176
  */
175
177
  pause(): boolean;
176
178
  /**
177
179
  * Resumes a paused task. Has no effect on a currently running or failed task.
180
+ *
178
181
  * @returns True if the operation took effect, false if ignored.
179
182
  */
180
183
  resume(): boolean;
@@ -4,21 +4,39 @@
4
4
  * Error code constants thrown by the notification server action service.
5
5
  * These codes are returned in Firebase function error responses for client-side handling.
6
6
  */
7
- /** Thrown when a notification creation request is missing a required ID. */
7
+ /**
8
+ * Thrown when a notification creation request is missing a required ID.
9
+ */
8
10
  export declare const CREATE_NOTIFICATION_ID_REQUIRED_ERROR_CODE = "CREATE_NOTIFICATION_ID_REQUIRED";
9
- /** Thrown when attempting to initialize a NotificationBox or NotificationSummary that is already initialized. */
11
+ /**
12
+ * Thrown when attempting to initialize a NotificationBox or NotificationSummary that is already initialized.
13
+ */
10
14
  export declare const NOTIFICATION_MODEL_ALREADY_INITIALIZED_ERROR_CODE = "NOTIFICATION_MODEL_ALREADY_INITIALIZED";
11
- /** Thrown when the target NotificationBox does not exist. */
15
+ /**
16
+ * Thrown when the target NotificationBox does not exist.
17
+ */
12
18
  export declare const NOTIFICATION_BOX_DOES_NOT_EXIST_ERROR_CODE = "NOTIFICATION_BOX_DOES_NOT_EXIST";
13
- /** Thrown when attempting to create a NotificationBox for a model that already has one. */
19
+ /**
20
+ * Thrown when attempting to create a NotificationBox for a model that already has one.
21
+ */
14
22
  export declare const NOTIFICATION_BOX_EXISTS_FOR_MODEL_ERROR_CODE = "NOTIFICATION_BOX_EXISTS_FOR_MODEL";
15
- /** Thrown when the target recipient does not exist in the NotificationBox. */
23
+ /**
24
+ * Thrown when the target recipient does not exist in the NotificationBox.
25
+ */
16
26
  export declare const NOTIFICATION_BOX_RECIPIENT_DOES_NOT_EXIST_ERROR_CODE = "NOTIFICATION_BOX_RECIPIENT_DOES_NOT_EXIST";
17
- /** Thrown when an exclusion target is invalid (e.g., user not associated with the box). */
27
+ /**
28
+ * Thrown when an exclusion target is invalid (e.g., user not associated with the box).
29
+ */
18
30
  export declare const NOTIFICATION_BOX_EXCLUSION_TARGET_INVALID_ERROR_CODE = "NOTIFICATION_BOX_EXCLUSION_TARGET_INVALID";
19
- /** Thrown when the UID provided for NotificationUser creation is invalid. */
31
+ /**
32
+ * Thrown when the UID provided for NotificationUser creation is invalid.
33
+ */
20
34
  export declare const NOTIFICATION_USER_INVALID_UID_FOR_CREATE_ERROR_CODE = "NOTIFICATION_USER_INVALID_UID_FOR_CREATE";
21
- /** Thrown when attempting to add a user who has blocked themselves from being added as a recipient. */
35
+ /**
36
+ * Thrown when attempting to add a user who has blocked themselves from being added as a recipient.
37
+ */
22
38
  export declare const NOTIFICATION_USER_BLOCKED_FROM_BEING_ADD_TO_RECIPIENTS_ERROR_CODE = "NOTIFICATION_USER_BLOCKED_FROM_BEING_ADD_TO_RECIPIENTS";
23
- /** Thrown when attempting to update a recipient config that is locked by the user. */
39
+ /**
40
+ * Thrown when attempting to update a recipient config that is locked by the user.
41
+ */
24
42
  export declare const NOTIFICATION_USER_LOCKED_CONFIG_FROM_BEING_UPDATED_ERROR_CODE = "NOTIFICATION_USER_LOCKED_CONFIG_FROM_BEING_UPDATED";
@@ -16,6 +16,7 @@ import { type NotificationTemplateType } from './notification.id';
16
16
  * @param a - existing config record
17
17
  * @param b - array of update params to apply
18
18
  * @param limitToAllowedConfigTypes - when provided, filters the result to only include these template types
19
+ * @returns the updated config record, or undefined if no changes were made
19
20
  */
20
21
  export declare function updateNotificationBoxRecipientTemplateConfigRecord(a: NotificationBoxRecipientTemplateConfigRecord, b: NotificationBoxRecipientTemplateConfigArrayEntryParam[], limitToAllowedConfigTypes?: Maybe<Iterable<NotificationTemplateType>>): Maybe<NotificationBoxRecipientTemplateConfigRecord>;
21
22
  /**
@@ -25,6 +26,7 @@ export declare function updateNotificationBoxRecipientTemplateConfigRecord(a: No
25
26
  * @param a - existing config
26
27
  * @param b - update params to apply
27
28
  * @param limitToAllowedConfigTypes - when provided, filters config types to only allowed template types
29
+ * @returns the updated default recipient config
28
30
  */
29
31
  export declare function updateNotificationUserDefaultNotificationBoxRecipientConfig(a: NotificationUserDefaultNotificationBoxRecipientConfig, b: UpdateNotificationUserDefaultNotificationBoxRecipientConfigParams, limitToAllowedConfigTypes?: Maybe<Iterable<NotificationTemplateType>>): NotificationUserDefaultNotificationBoxRecipientConfig;
30
32
  /**
@@ -32,6 +34,11 @@ export declare function updateNotificationUserDefaultNotificationBoxRecipientCon
32
34
  * only if it actually changed. Returns `undefined` if no changes were detected.
33
35
  *
34
36
  * Automatically sets `ns = true` (needs sync) when changes are detected and the recipient has been indexed.
37
+ *
38
+ * @param a - existing per-box recipient config
39
+ * @param b - update params to apply
40
+ * @param limitToAllowedConfigTypes - when provided, filters template config types to only allowed types
41
+ * @returns the updated config if changes were detected, or undefined if no changes occurred
35
42
  */
36
43
  export declare function updateNotificationUserNotificationBoxRecipientConfigIfChanged(a: NotificationUserNotificationBoxRecipientConfig, b: UpdateNotificationUserNotificationBoxRecipientParams, limitToAllowedConfigTypes?: Maybe<Iterable<NotificationTemplateType>>): Maybe<NotificationUserNotificationBoxRecipientConfig>;
37
44
  /**
@@ -42,5 +49,10 @@ export declare function updateNotificationUserNotificationBoxRecipientConfigIfCh
42
49
  * through the optional {@link AppNotificationTemplateTypeInfoRecordService}.
43
50
  *
44
51
  * Returns `undefined` if no changes were made.
52
+ *
53
+ * @param a - existing per-box recipient config array
54
+ * @param b - array of update params to apply to matching boxes
55
+ * @param filterWithService - optional service used to filter template types to only those valid for each box's model
56
+ * @returns the updated config array if any changes occurred, or undefined if nothing changed
45
57
  */
46
58
  export declare function updateNotificationUserNotificationBoxRecipientConfigs(a: NotificationUserNotificationBoxRecipientConfig[], b: UpdateNotificationUserNotificationBoxRecipientParams[], filterWithService?: AppNotificationTemplateTypeInfoRecordService): Maybe<NotificationUserNotificationBoxRecipientConfig[]>;
@@ -52,6 +52,10 @@ export interface NotificationBoxRecipientTemplateConfig {
52
52
  /**
53
53
  * Merges two {@link NotificationBoxRecipientTemplateConfig} objects, preferring values from `a` over `b`.
54
54
  *
55
+ * @param a - primary config whose defined values take precedence
56
+ * @param b - fallback config supplying values when `a` fields are undefined
57
+ * @returns the merged template config with values from `a` preferred over `b`
58
+ *
55
59
  * @example
56
60
  * ```ts
57
61
  * const merged = mergeNotificationBoxRecipientTemplateConfigs(
@@ -67,6 +71,9 @@ export declare function mergeNotificationBoxRecipientTemplateConfigs(a?: Maybe<N
67
71
  *
68
72
  * This produces the "effective" configuration used at send time, where each channel has a definite boolean.
69
73
  *
74
+ * @param a - the template config to resolve
75
+ * @returns the effective config with each channel flag filled in using the send-default fallback
76
+ *
70
77
  * @example
71
78
  * ```ts
72
79
  * const effective = effectiveNotificationBoxRecipientTemplateConfig({ sd: true, se: false });
@@ -113,6 +120,10 @@ export interface NotificationRecipient {
113
120
  * Updates a {@link NotificationRecipient} with partial values, preserving existing fields where the update is undefined.
114
121
  *
115
122
  * Automatically clears the summary ID (`s`) when a `uid` is present.
123
+ *
124
+ * @param a - existing recipient to update
125
+ * @param b - partial values to apply on top of the existing recipient
126
+ * @returns the updated recipient with merged values
116
127
  */
117
128
  export declare function updateNotificationRecipient(a: NotificationRecipient, b: Partial<NotificationRecipient>): NotificationRecipient;
118
129
  /**
@@ -183,6 +194,7 @@ export interface NotificationBoxRecipient extends NotificationRecipient, IndexRe
183
194
  *
184
195
  * @param uid - the user's Firebase auth UID
185
196
  * @param i - the recipient's index position in the box's recipient array
197
+ * @returns a new recipient entry with the given uid and index and an empty template config record
186
198
  */
187
199
  export declare function newNotificationBoxRecipientForUid(uid: FirebaseAuthUserId, i: number): NotificationBoxRecipient;
188
200
  /**
@@ -207,6 +219,10 @@ export interface NotificationUserDefaultNotificationBoxRecipientConfig extends O
207
219
  }
208
220
  /**
209
221
  * Merges two {@link NotificationUserDefaultNotificationBoxRecipientConfig} objects, preferring defined values from `a` over `b`.
222
+ *
223
+ * @param a - primary config whose defined values take precedence
224
+ * @param b - fallback config supplying values when `a` fields are undefined
225
+ * @returns the merged config
210
226
  */
211
227
  export declare function mergeNotificationUserDefaultNotificationBoxRecipientConfig(a: NotificationUserDefaultNotificationBoxRecipientConfig, b: NotificationUserDefaultNotificationBoxRecipientConfig): NotificationUserDefaultNotificationBoxRecipientConfig;
212
228
  /**
@@ -279,6 +295,10 @@ export type EncodedNotificationBoxRecipientTemplateConfig = BitwiseEncodedSet;
279
295
  export type NotificationBoxRecipientTemplateConfigRecord = Record<NotificationTemplateType, NotificationBoxRecipientTemplateConfig>;
280
296
  /**
281
297
  * Merges two {@link NotificationBoxRecipientTemplateConfigRecord} objects, preferring defined values from `a`.
298
+ *
299
+ * @param a - primary record whose defined values take precedence
300
+ * @param b - fallback record supplying values when `a` entries are undefined
301
+ * @returns the merged template config record
282
302
  */
283
303
  export declare function mergeNotificationBoxRecipientTemplateConfigRecords(a: NotificationBoxRecipientTemplateConfigRecord, b: NotificationBoxRecipientTemplateConfigRecord): NotificationBoxRecipientTemplateConfigRecord;
284
304
  /**
@@ -289,6 +309,8 @@ export type EncodedNotificationBoxRecipientTemplateConfigRecord = Record<Notific
289
309
  /**
290
310
  * Creates a Firestore field converter for {@link NotificationBoxRecipientTemplateConfigRecord},
291
311
  * using bitwise encoding for compact storage.
312
+ *
313
+ * @returns a Firestore field converter that encodes and decodes template config records using bitwise encoding
292
314
  */
293
315
  export declare function firestoreNotificationBoxRecipientTemplateConfigRecord(): import("../..").FirestoreModelFieldMapFunctionsConfig<import("../..").FirestoreEncodedObjectMapFieldValueType<NotificationBoxRecipientTemplateConfig, string>, import("../..").FirestoreMapFieldType<number, string>>;
294
316
  /**
@@ -321,6 +343,9 @@ export type NotificationBoxRecipientTemplateConfigArray = NotificationBoxRecipie
321
343
  /**
322
344
  * Converts a {@link NotificationBoxRecipientTemplateConfigRecord} to an array of entries with their type keys.
323
345
  *
346
+ * @param input - the template config record to convert
347
+ * @returns an array of entries each containing a type key and the corresponding channel config
348
+ *
324
349
  * @example
325
350
  * ```ts
326
351
  * const array = notificationBoxRecipientTemplateConfigRecordToArray({ 'comment': { se: true } });
@@ -330,6 +355,9 @@ export type NotificationBoxRecipientTemplateConfigArray = NotificationBoxRecipie
330
355
  export declare function notificationBoxRecipientTemplateConfigRecordToArray(input: NotificationBoxRecipientTemplateConfigRecord): NotificationBoxRecipientTemplateConfigArray;
331
356
  /**
332
357
  * Converts a {@link NotificationBoxRecipientTemplateConfigArray} back to a {@link NotificationBoxRecipientTemplateConfigRecord}.
358
+ *
359
+ * @param input - the array of typed config entries to convert
360
+ * @returns a record keyed by template type
333
361
  */
334
362
  export declare function notificationBoxRecipientTemplateConfigArrayToRecord(input: NotificationBoxRecipientTemplateConfigArray): NotificationBoxRecipientTemplateConfigRecord;
335
363
  /**
@@ -123,6 +123,9 @@ export interface CreateNotificationTemplateInput extends Partial<Omit<CreateNoti
123
123
  *
124
124
  * Maps friendly field names (`subject`, `message`, `createdBy`, etc.) to their Firestore abbreviations
125
125
  * and filters out null/undefined metadata values.
126
+ *
127
+ * @param input - friendly input with readable field names
128
+ * @returns the low-level template using Firestore field abbreviations
126
129
  */
127
130
  export declare function createNotificationTemplate(input: CreateNotificationTemplateInput): CreateNotificationTemplate;
128
131
  /**
@@ -149,6 +152,9 @@ export interface ShouldSendCreatedNotificationInput {
149
152
  * Determines whether a notification should be created based on the explicit toggle and throttle settings.
150
153
  *
151
154
  * Returns false if `sendNotification` is explicitly false, or if the throttle window hasn't elapsed.
155
+ *
156
+ * @param input - the send control parameters including the toggle and throttle configuration
157
+ * @returns true if the notification should be created and sent
152
158
  */
153
159
  export declare function shouldSendCreatedNotificationInput(input: ShouldSendCreatedNotificationInput): boolean;
154
160
  /**
@@ -187,7 +193,13 @@ export interface CreateNotificationDocumentPairInput extends ShouldSendCreatedNo
187
193
  * Result of creating a notification document pair (document reference + data), before or after saving.
188
194
  */
189
195
  export interface CreateNotificationDocumentPairResult extends Pick<CreateNotificationTemplate, 'overrideExistingTask'> {
196
+ /**
197
+ * The notification document.
198
+ */
190
199
  readonly notificationDocument: NotificationDocument;
200
+ /**
201
+ * The notification data.
202
+ */
191
203
  readonly notification: Notification;
192
204
  /**
193
205
  * Whether or not the notification was created.
@@ -205,12 +217,18 @@ export interface CreateNotificationDocumentPairResult extends Pick<CreateNotific
205
217
  *
206
218
  * For unique task notifications, generates a deterministic document ID from the target model and task type.
207
219
  *
220
+ * @param input - the creation parameters including template, context, and accessor
221
+ * @returns the document reference and notification data pair, with `notificationCreated` set to false
208
222
  * @throws {Error} When neither an accessor nor sufficient context is provided
209
223
  * @throws {Error} When `unique=true` but no target model is specified
210
224
  */
211
225
  export declare function createNotificationDocumentPair(input: CreateNotificationDocumentPairInput): CreateNotificationDocumentPairResult;
212
226
  /**
213
227
  * Internal function used by createNotificationDocument().
228
+ *
229
+ * @param input - send control parameters (throttle settings, shouldCreateNotification flag)
230
+ * @param pair - the document pair created by {@link createNotificationDocumentPair}
231
+ * @returns the pair with `notificationCreated` updated to reflect whether the document was saved
214
232
  */
215
233
  export declare function _createNotificationDocumentFromPair(input: Pick<CreateNotificationDocumentPairInput, 'shouldCreateNotification' | keyof ShouldSendCreatedNotificationInput>, pair: CreateNotificationDocumentPairResult): Promise<CreateNotificationDocumentPairResult>;
216
234
  /**
@@ -218,11 +236,17 @@ export declare function _createNotificationDocumentFromPair(input: Pick<CreateNo
218
236
  *
219
237
  * For unique tasks with `overrideExistingTask`, uses `set()` to replace existing documents.
220
238
  * Otherwise uses `create()` which fails if the document already exists.
239
+ *
240
+ * @param input - the creation parameters including template, context, send control settings
241
+ * @returns the document pair with `notificationCreated` reflecting whether the document was saved
221
242
  */
222
243
  export declare function createNotificationDocument(input: CreateNotificationDocumentPairInput): Promise<CreateNotificationDocumentPairResult>;
223
244
  /**
224
245
  * Creates and saves a notification only if sending conditions are met (not throttled, not explicitly disabled).
225
246
  *
226
247
  * Returns `undefined` if the notification was not created.
248
+ *
249
+ * @param input - the creation parameters including template, context, and send control settings
250
+ * @returns the document pair if the notification was created, or undefined if it was skipped
227
251
  */
228
252
  export declare function createNotificationDocumentIfSending(input: CreateNotificationDocumentPairInput): Promise<Maybe<CreateNotificationDocumentPairResult>>;
@@ -28,6 +28,8 @@ export interface CreateNotificationTaskTemplateInput extends Omit<CreateNotifica
28
28
  /**
29
29
  * Creates a {@link CreateNotificationTaskTemplate} with `TASK_NOTIFICATION` send type and no recipients.
30
30
  *
31
+ * @param input - task template input parameters
32
+ * @returns the configured task notification template
31
33
  * @throws {Error} When `unique=true` but no `notificationModel` or target model is specified.
32
34
  *
33
35
  * @example
@@ -128,6 +128,9 @@ export declare class NotificationUserDocument extends AbstractFirestoreDocument<
128
128
  export declare const notificationUserConverter: import("../..").SnapshotConverterFunctions<NotificationUser, Partial<import("@dereekb/util").ReplaceType<NotificationUser, import("@dereekb/util").MaybeMap<object>, any>>>;
129
129
  /**
130
130
  * Creates a Firestore collection reference for {@link NotificationUser} documents.
131
+ *
132
+ * @param context - Firestore context to create the collection reference from
133
+ * @returns a typed collection reference for NotificationUser documents
131
134
  */
132
135
  export declare function notificationUserCollectionReference(context: FirestoreContext): CollectionReference<NotificationUser>;
133
136
  /**
@@ -136,6 +139,9 @@ export declare function notificationUserCollectionReference(context: FirestoreCo
136
139
  export type NotificationUserFirestoreCollection = FirestoreCollection<NotificationUser, NotificationUserDocument>;
137
140
  /**
138
141
  * Creates a typed {@link NotificationUserFirestoreCollection} bound to the given Firestore context.
142
+ *
143
+ * @param firestoreContext - Firestore context to bind the collection to
144
+ * @returns a typed Firestore collection for NotificationUser documents
139
145
  */
140
146
  export declare function notificationUserFirestoreCollection(firestoreContext: FirestoreContext): NotificationUserFirestoreCollection;
141
147
  /**
@@ -206,6 +212,9 @@ export declare class NotificationSummaryDocument extends AbstractFirestoreDocume
206
212
  export declare const notificationSummaryConverter: import("../..").SnapshotConverterFunctions<NotificationSummary, Partial<import("@dereekb/util").ReplaceType<NotificationSummary, import("@dereekb/util").MaybeMap<object>, any>>>;
207
213
  /**
208
214
  * Creates a Firestore collection reference for {@link NotificationSummary} documents.
215
+ *
216
+ * @param context - Firestore context to create the collection reference from
217
+ * @returns a typed collection reference for NotificationSummary documents
209
218
  */
210
219
  export declare function notificationSummaryCollectionReference(context: FirestoreContext): CollectionReference<NotificationSummary>;
211
220
  /**
@@ -214,6 +223,9 @@ export declare function notificationSummaryCollectionReference(context: Firestor
214
223
  export type NotificationSummaryFirestoreCollection = FirestoreCollection<NotificationSummary, NotificationSummaryDocument>;
215
224
  /**
216
225
  * Creates a typed {@link NotificationSummaryFirestoreCollection} bound to the given Firestore context.
226
+ *
227
+ * @param firestoreContext - Firestore context to bind the collection to
228
+ * @returns a typed Firestore collection for NotificationSummary documents
217
229
  */
218
230
  export declare function notificationSummaryFirestoreCollection(firestoreContext: FirestoreContext): NotificationSummaryFirestoreCollection;
219
231
  /**
@@ -287,6 +299,9 @@ export declare class NotificationBoxDocument extends AbstractFirestoreDocument<N
287
299
  export declare const notificationBoxConverter: import("../..").SnapshotConverterFunctions<NotificationBox, Partial<import("@dereekb/util").ReplaceType<NotificationBox, import("@dereekb/util").MaybeMap<object>, any>>>;
288
300
  /**
289
301
  * Creates a Firestore collection reference for {@link NotificationBox} documents.
302
+ *
303
+ * @param context - Firestore context to create the collection reference from
304
+ * @returns a typed collection reference for NotificationBox documents
290
305
  */
291
306
  export declare function notificationBoxCollectionReference(context: FirestoreContext): CollectionReference<NotificationBox>;
292
307
  /**
@@ -295,6 +310,9 @@ export declare function notificationBoxCollectionReference(context: FirestoreCon
295
310
  export type NotificationBoxFirestoreCollection = FirestoreCollection<NotificationBox, NotificationBoxDocument>;
296
311
  /**
297
312
  * Creates a typed {@link NotificationBoxFirestoreCollection} bound to the given Firestore context.
313
+ *
314
+ * @param firestoreContext - Firestore context to bind the collection to
315
+ * @returns a typed Firestore collection for NotificationBox documents
298
316
  */
299
317
  export declare function notificationBoxFirestoreCollection(firestoreContext: FirestoreContext): NotificationBoxFirestoreCollection;
300
318
  /**
@@ -544,6 +562,9 @@ export declare class NotificationDocument extends AbstractFirestoreDocumentWithP
544
562
  export declare const notificationConverter: import("../..").SnapshotConverterFunctions<Notification, Partial<import("@dereekb/util").ReplaceType<Notification, import("@dereekb/util").MaybeMap<object>, any>>>;
545
563
  /**
546
564
  * Creates a factory that produces {@link Notification} subcollection references for a given {@link NotificationBoxDocument} parent.
565
+ *
566
+ * @param context - Firestore context to create subcollection references from
567
+ * @returns a factory function that creates collection references for a given NotificationBox parent
547
568
  */
548
569
  export declare function notificationCollectionReferenceFactory(context: FirestoreContext): (notificationBox: NotificationBoxDocument) => CollectionReference<Notification>;
549
570
  /**
@@ -556,10 +577,16 @@ export type NotificationFirestoreCollection = FirestoreCollectionWithParent<Noti
556
577
  export type NotificationFirestoreCollectionFactory = (parent: NotificationBoxDocument) => NotificationFirestoreCollection;
557
578
  /**
558
579
  * Creates a {@link NotificationFirestoreCollectionFactory} bound to the given Firestore context.
580
+ *
581
+ * @param firestoreContext - Firestore context to bind the collection factory to
582
+ * @returns a factory that creates typed Firestore subcollections for Notification documents
559
583
  */
560
584
  export declare function notificationFirestoreCollectionFactory(firestoreContext: FirestoreContext): NotificationFirestoreCollectionFactory;
561
585
  /**
562
586
  * Creates a collection group reference for querying all {@link Notification} documents across all {@link NotificationBox} parents.
587
+ *
588
+ * @param context - Firestore context to create the collection group reference from
589
+ * @returns a typed collection group for querying Notification documents across all parents
563
590
  */
564
591
  export declare function notificationCollectionReference(context: FirestoreContext): CollectionGroup<Notification>;
565
592
  /**
@@ -568,6 +595,9 @@ export declare function notificationCollectionReference(context: FirestoreContex
568
595
  export type NotificationFirestoreCollectionGroup = FirestoreCollectionGroup<Notification, NotificationDocument>;
569
596
  /**
570
597
  * Creates a typed {@link NotificationFirestoreCollectionGroup} bound to the given Firestore context.
598
+ *
599
+ * @param firestoreContext - Firestore context to bind the collection group to
600
+ * @returns a typed Firestore collection group for querying Notification documents across all parents
571
601
  */
572
602
  export declare function notificationFirestoreCollectionGroup(firestoreContext: FirestoreContext): NotificationFirestoreCollectionGroup;
573
603
  /**
@@ -606,6 +636,9 @@ export declare class NotificationWeekDocument extends AbstractFirestoreDocumentW
606
636
  export declare const notificationWeekConverter: import("../..").SnapshotConverterFunctions<NotificationWeek, Partial<import("@dereekb/util").ReplaceType<NotificationWeek, import("@dereekb/util").MaybeMap<object>, any>>>;
607
637
  /**
608
638
  * Creates a factory that produces {@link NotificationWeek} subcollection references for a given {@link NotificationBoxDocument} parent.
639
+ *
640
+ * @param context - Firestore context to create subcollection references from
641
+ * @returns a factory function that creates collection references for a given NotificationBox parent
609
642
  */
610
643
  export declare function notificationWeekCollectionReferenceFactory(context: FirestoreContext): (notificationBox: NotificationBoxDocument) => CollectionReference<NotificationWeek>;
611
644
  /**
@@ -618,10 +651,16 @@ export type NotificationWeekFirestoreCollection = FirestoreCollectionWithParent<
618
651
  export type NotificationWeekFirestoreCollectionFactory = (parent: NotificationBoxDocument) => NotificationWeekFirestoreCollection;
619
652
  /**
620
653
  * Creates a {@link NotificationWeekFirestoreCollectionFactory} bound to the given Firestore context.
654
+ *
655
+ * @param firestoreContext - Firestore context to bind the collection factory to
656
+ * @returns a factory that creates typed Firestore subcollections for NotificationWeek documents
621
657
  */
622
658
  export declare function notificationWeekFirestoreCollectionFactory(firestoreContext: FirestoreContext): NotificationWeekFirestoreCollectionFactory;
623
659
  /**
624
660
  * Creates a collection group reference for querying all {@link NotificationWeek} documents across all {@link NotificationBox} parents.
661
+ *
662
+ * @param context - Firestore context to create the collection group reference from
663
+ * @returns a typed collection group for querying NotificationWeek documents across all parents
625
664
  */
626
665
  export declare function notificationWeekCollectionReference(context: FirestoreContext): CollectionGroup<NotificationWeek>;
627
666
  /**
@@ -630,5 +669,8 @@ export declare function notificationWeekCollectionReference(context: FirestoreCo
630
669
  export type NotificationWeekFirestoreCollectionGroup = FirestoreCollectionGroup<NotificationWeek, NotificationWeekDocument>;
631
670
  /**
632
671
  * Creates a typed {@link NotificationWeekFirestoreCollectionGroup} bound to the given Firestore context.
672
+ *
673
+ * @param firestoreContext - Firestore context to bind the collection group to
674
+ * @returns a typed Firestore collection group for querying NotificationWeek documents across all parents
633
675
  */
634
676
  export declare function notificationWeekFirestoreCollectionGroup(firestoreContext: FirestoreContext): NotificationWeekFirestoreCollectionGroup;
@@ -99,6 +99,8 @@ export type NotificationTemplateTypeInfoRecord = Record<NotificationTemplateType
99
99
  /**
100
100
  * Creates a {@link NotificationTemplateTypeInfoRecord} from an array of template type info entries.
101
101
  *
102
+ * @param infoArray - array of template type info entries to index
103
+ * @returns a record keyed by template type
102
104
  * @throws {Error} When duplicate template types are found in the input array.
103
105
  *
104
106
  * @example
@@ -186,6 +188,7 @@ export declare abstract class AppNotificationTemplateTypeInfoRecordService {
186
188
  * Handles alternative model identities defined in {@link NotificationTemplateTypeInfoIdentityInfoAlternativeModelIdentityPair}.
187
189
  *
188
190
  * @param appNotificationTemplateTypeInfoRecord - the complete template type registry for the application
191
+ * @returns a fully initialized service with indexed lookups for fast template type discovery
189
192
  *
190
193
  * @example
191
194
  * ```ts
@@ -98,6 +98,7 @@ export type NotificationSummaryIdForUidFunction = FactoryWithRequiredInput<Notif
98
98
  * by combining the given user model identity with the provided UID.
99
99
  *
100
100
  * @param userModelIdentity - the root identity for user models (e.g., `profileIdentity`)
101
+ * @returns a function that generates a {@link NotificationSummaryId} for a given user UID
101
102
  *
102
103
  * @example
103
104
  * ```ts
@@ -176,8 +177,8 @@ export interface NotificationTaskKeyRef {
176
177
  /**
177
178
  * Creates a NotificationTaskUniqueId from the input model id and task type.
178
179
  *
179
- * @param input model id input
180
- * @param taskType task type
181
- * @returns NotificationTaskUniqueId
180
+ * @param input - model id input
181
+ * @param taskType - task type
182
+ * @returns the unique notification task id combining the model id and task type
182
183
  */
183
184
  export declare function notificationTaskUniqueId(input: FirestoreModelIdInput, taskType: NotificationTaskType): NotificationTaskUniqueId;
@@ -99,6 +99,7 @@ export interface UnreadNotificationItemsResult<D extends NotificationItemMetadat
99
99
  *
100
100
  * @param items - notification items to classify
101
101
  * @param considerReadIfCreatedBefore - optional cutoff date; items created at or before this date are treated as read
102
+ * @returns an object containing both the read and unread item arrays along with the input cutoff date
102
103
  *
103
104
  * @example
104
105
  * ```ts
@@ -110,4 +111,4 @@ export declare function unreadNotificationItems<D extends NotificationItemMetada
110
111
  /**
111
112
  * Sort comparator for {@link NotificationItem} arrays. Sorts ascending by creation date (`cat`).
112
113
  */
113
- export declare const sortNotificationItemsFunction: import("@dereekb/date").SortByDateFunction<NotificationItem<any>>;
114
+ export declare const sortNotificationItemsFunction: import("@dereekb/date").SortByDateFunction<NotificationItem<{}>>;
@@ -38,13 +38,13 @@ export type NotificationSendMessageTemplateName = string;
38
38
  *
39
39
  * This info is used by the sending service to configure the template, but is not passed directly to the template itself.
40
40
  */
41
- export type NotificationMessageTemplateConfiguration = Record<string, any>;
41
+ export type NotificationMessageTemplateConfiguration = Record<string, unknown>;
42
42
  /**
43
43
  * Template variables for a notification message.
44
44
  *
45
45
  * These variables may be directly passed to the template.
46
46
  */
47
- export type NotificationMessageTemplateVariables = Record<string, any>;
47
+ export type NotificationMessageTemplateVariables = Record<string, unknown>;
48
48
  /**
49
49
  * Generic notification message content.
50
50
  */
@@ -258,6 +258,7 @@ export type NotificationMessageFunction = NotificationMessageFunctionWithoutExtr
258
258
  *
259
259
  * @param fn - base function that generates message content per recipient
260
260
  * @param extras - optional delivery customization (global recipients, send callbacks)
261
+ * @returns a {@link NotificationMessageFunction} with the extras attached
261
262
  *
262
263
  * @example
263
264
  * ```ts
@@ -276,6 +277,8 @@ export declare function notificationMessageFunction(fn: NotificationMessageFunct
276
277
  *
277
278
  * Useful as a placeholder factory for template types that should not produce deliverable content.
278
279
  *
280
+ * @returns a factory that produces no-content message functions
281
+ *
279
282
  * @example
280
283
  * ```ts
281
284
  * const factory = noContentNotificationMessageFunctionFactory();
@@ -284,4 +287,4 @@ export declare function notificationMessageFunction(fn: NotificationMessageFunct
284
287
  * // msg.flag === NotificationMessageFlag.NO_CONTENT
285
288
  * ```
286
289
  */
287
- export declare function noContentNotificationMessageFunctionFactory<D extends NotificationItemMetadata = any>(): NotificationMessageFunctionFactory<D>;
290
+ export declare function noContentNotificationMessageFunctionFactory<D extends NotificationItemMetadata = {}>(): NotificationMessageFunctionFactory<D>;
@@ -11,26 +11,35 @@ import { type ArrayOrValue } from '@dereekb/util';
11
11
  * Query constraints for finding {@link NotificationUser} documents that have pending config syncs (`ns == true`).
12
12
  *
13
13
  * Used by the server to discover users whose configs need to be synced to their NotificationBox recipients.
14
+ *
15
+ * @returns array of Firestore query constraints filtering for users needing sync
14
16
  */
15
17
  export declare function notificationUsersFlaggedForNeedsSyncQuery(): FirestoreQueryConstraint[];
16
18
  /**
17
19
  * Query constraints for finding {@link NotificationUser} documents that have any of the given exclusion IDs in their `x` array.
18
20
  *
19
21
  * @param exclusionId - one or more box IDs or collection name prefixes to match against
22
+ * @returns array of Firestore query constraints filtering for users with matching exclusions
20
23
  */
21
24
  export declare function notificationUserHasExclusionQuery(exclusionId: ArrayOrValue<NotificationBoxSendExclusion>): FirestoreQueryConstraint[];
22
25
  /**
23
26
  * Query constraints for finding {@link NotificationSummary} documents that need server-side initialization (`s == true`).
27
+ *
28
+ * @returns array of Firestore query constraints filtering for summaries needing initialization
24
29
  */
25
30
  export declare function notificationSummariesFlaggedForNeedsInitializationQuery(): FirestoreQueryConstraint[];
26
31
  /**
27
32
  * Query constraints for finding {@link NotificationBox} documents that need server-side initialization (`s == true`).
33
+ *
34
+ * @returns array of Firestore query constraints filtering for boxes needing initialization
28
35
  */
29
36
  export declare function notificationBoxesFlaggedForNeedsInitializationQuery(): FirestoreQueryConstraint[];
30
37
  /**
31
38
  * Query constraints for finding {@link NotificationBox} documents flagged as invalid (`fi == true`).
32
39
  *
33
40
  * Used by the server to clean up boxes that could not be initialized.
41
+ *
42
+ * @returns array of Firestore query constraints filtering for boxes flagged as invalid
34
43
  */
35
44
  export declare function notificationBoxesFlaggedInvalidQuery(): FirestoreQueryConstraint[];
36
45
  /**
@@ -40,10 +49,13 @@ export declare function notificationBoxesFlaggedInvalidQuery(): FirestoreQueryCo
40
49
  * This is the primary query used by the send queue processor.
41
50
  *
42
51
  * @param now - reference time for the `sat` comparison (defaults to current time)
52
+ * @returns array of Firestore query constraints filtering for notifications past their scheduled send time
43
53
  */
44
54
  export declare function notificationsPastSendAtTimeQuery(now?: Date): FirestoreQueryConstraint[];
45
55
  /**
46
56
  * Query constraints for finding {@link Notification} documents marked as done (`d == true`)
47
57
  * and ready to be archived to {@link NotificationWeek} and then deleted.
58
+ *
59
+ * @returns array of Firestore query constraints filtering for completed notifications ready to archive
48
60
  */
49
61
  export declare function notificationsReadyForCleanupQuery(): FirestoreQueryConstraint[];