@dereekb/firebase 13.2.2 → 13.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (135) hide show
  1. package/index.cjs.js +12893 -4062
  2. package/index.esm.js +12872 -4065
  3. package/package.json +5 -5
  4. package/src/lib/client/error/error.d.ts +18 -3
  5. package/src/lib/client/firestore/array.d.ts +16 -3
  6. package/src/lib/client/firestore/driver.accessor.batch.d.ts +35 -4
  7. package/src/lib/client/firestore/driver.accessor.create.d.ts +15 -0
  8. package/src/lib/client/firestore/driver.accessor.d.ts +15 -0
  9. package/src/lib/client/firestore/driver.accessor.default.d.ts +32 -0
  10. package/src/lib/client/firestore/driver.accessor.transaction.d.ts +35 -4
  11. package/src/lib/client/firestore/driver.d.ts +16 -0
  12. package/src/lib/client/firestore/driver.query.d.ts +36 -0
  13. package/src/lib/client/firestore/firestore.d.ts +11 -1
  14. package/src/lib/client/firestore/increment.d.ts +12 -3
  15. package/src/lib/client/function/development.function.factory.d.ts +27 -2
  16. package/src/lib/client/function/error.d.ts +27 -0
  17. package/src/lib/client/function/function.callable.d.ts +50 -5
  18. package/src/lib/client/function/function.factory.d.ts +70 -4
  19. package/src/lib/client/function/model.function.factory.d.ts +64 -9
  20. package/src/lib/client/storage/driver.accessor.d.ts +93 -0
  21. package/src/lib/client/storage/driver.d.ts +15 -0
  22. package/src/lib/client/storage/storage.d.ts +10 -1
  23. package/src/lib/common/auth/auth.context.d.ts +17 -2
  24. package/src/lib/common/auth/auth.d.ts +38 -9
  25. package/src/lib/common/auth/auth.error.d.ts +25 -0
  26. package/src/lib/common/auth/auth.server.error.d.ts +6 -2
  27. package/src/lib/common/development/function.d.ts +17 -6
  28. package/src/lib/common/development/function.schedule.d.ts +30 -1
  29. package/src/lib/common/firestore/accessor/accessor.wrap.modify.d.ts +36 -12
  30. package/src/lib/common/firestore/accessor/array.d.ts +14 -4
  31. package/src/lib/common/firestore/accessor/document.d.ts +77 -2
  32. package/src/lib/common/firestore/accessor/increment.d.ts +15 -3
  33. package/src/lib/common/firestore/collection/collection.d.ts +22 -4
  34. package/src/lib/common/firestore/collection/collection.util.d.ts +12 -2
  35. package/src/lib/common/firestore/driver/accessor.d.ts +28 -1
  36. package/src/lib/common/firestore/driver/batch.d.ts +6 -4
  37. package/src/lib/common/firestore/driver/driver.d.ts +18 -1
  38. package/src/lib/common/firestore/driver/query.d.ts +20 -1
  39. package/src/lib/common/firestore/driver/query.handler.d.ts +23 -0
  40. package/src/lib/common/firestore/driver/transaction.d.ts +18 -6
  41. package/src/lib/common/firestore/error.d.ts +16 -4
  42. package/src/lib/common/firestore/query/iterator.d.ts +11 -0
  43. package/src/lib/common/firestore/reference.d.ts +11 -6
  44. package/src/lib/common/firestore/snapshot/snapshot.d.ts +4 -0
  45. package/src/lib/common/firestore/snapshot/snapshot.field.d.ts +263 -63
  46. package/src/lib/common/firestore/types.d.ts +39 -1
  47. package/src/lib/common/firestore/util/id.batch.d.ts +55 -3
  48. package/src/lib/common/function/action.d.ts +35 -0
  49. package/src/lib/common/model/context.d.ts +11 -1
  50. package/src/lib/common/model/function.d.ts +45 -9
  51. package/src/lib/common/model/model/model.loader.d.ts +37 -0
  52. package/src/lib/common/model/model/model.param.d.ts +24 -2
  53. package/src/lib/common/model/model.service.d.ts +126 -4
  54. package/src/lib/common/model/permission/permission.context.d.ts +15 -0
  55. package/src/lib/common/model/permission/permission.d.ts +16 -0
  56. package/src/lib/common/model/permission/permission.service.d.ts +24 -1
  57. package/src/lib/common/model/permission/permission.service.grant.d.ts +72 -28
  58. package/src/lib/common/model/permission/permission.service.role.d.ts +15 -0
  59. package/src/lib/common/storage/accessor/path.model.d.ts +25 -8
  60. package/src/lib/common/storage/context.d.ts +23 -6
  61. package/src/lib/common/storage/driver/accessor.d.ts +15 -4
  62. package/src/lib/common/storage/driver/accessor.iterate.d.ts +31 -8
  63. package/src/lib/common/storage/driver/accessor.util.d.ts +13 -6
  64. package/src/lib/common/storage/driver/driver.d.ts +10 -1
  65. package/src/lib/common/storage/driver/error.d.ts +16 -0
  66. package/src/lib/common/storage/driver/list.d.ts +30 -0
  67. package/src/lib/common/storage/storage.d.ts +76 -19
  68. package/src/lib/common/storage/types.d.ts +23 -5
  69. package/src/lib/model/index.d.ts +1 -0
  70. package/src/lib/model/notification/notification.action.d.ts +8 -0
  71. package/src/lib/model/notification/notification.api.d.ts +26 -0
  72. package/src/lib/model/notification/notification.api.error.d.ts +15 -0
  73. package/src/lib/model/notification/notification.api.util.d.ts +27 -12
  74. package/src/lib/model/notification/notification.config.d.ts +193 -64
  75. package/src/lib/model/notification/notification.create.d.ts +62 -13
  76. package/src/lib/model/notification/notification.create.task.d.ts +25 -4
  77. package/src/lib/model/notification/notification.d.ts +258 -99
  78. package/src/lib/model/notification/notification.details.d.ts +66 -18
  79. package/src/lib/model/notification/notification.id.d.ts +90 -12
  80. package/src/lib/model/notification/notification.item.d.ts +57 -16
  81. package/src/lib/model/notification/notification.message.d.ts +84 -18
  82. package/src/lib/model/notification/notification.query.d.ts +21 -24
  83. package/src/lib/model/notification/notification.send.d.ts +38 -5
  84. package/src/lib/model/notification/notification.task.d.ts +87 -16
  85. package/src/lib/model/notification/notification.task.subtask.d.ts +42 -13
  86. package/src/lib/model/notification/notification.util.d.ts +68 -18
  87. package/src/lib/model/oidcmodel/index.d.ts +8 -0
  88. package/src/lib/model/oidcmodel/oidcmodel.action.d.ts +37 -0
  89. package/src/lib/model/oidcmodel/oidcmodel.api.d.ts +131 -0
  90. package/src/lib/model/oidcmodel/oidcmodel.d.ts +114 -0
  91. package/src/lib/model/oidcmodel/oidcmodel.data.d.ts +17 -0
  92. package/src/lib/model/oidcmodel/oidcmodel.id.d.ts +18 -0
  93. package/src/lib/model/oidcmodel/oidcmodel.interaction.d.ts +40 -0
  94. package/src/lib/model/oidcmodel/oidcmodel.interaction.oauth.d.ts +73 -0
  95. package/src/lib/model/oidcmodel/oidcmodel.query.d.ts +21 -0
  96. package/src/lib/model/storagefile/storagefile.action.d.ts +47 -0
  97. package/src/lib/model/storagefile/storagefile.api.d.ts +54 -4
  98. package/src/lib/model/storagefile/storagefile.create.d.ts +40 -3
  99. package/src/lib/model/storagefile/storagefile.d.ts +153 -16
  100. package/src/lib/model/storagefile/storagefile.file.d.ts +22 -7
  101. package/src/lib/model/storagefile/storagefile.group.d.ts +30 -1
  102. package/src/lib/model/storagefile/storagefile.group.processing.d.ts +20 -2
  103. package/src/lib/model/storagefile/storagefile.id.d.ts +44 -5
  104. package/src/lib/model/storagefile/storagefile.permission.d.ts +23 -4
  105. package/src/lib/model/storagefile/storagefile.query.d.ts +63 -11
  106. package/src/lib/model/storagefile/storagefile.task.d.ts +47 -4
  107. package/src/lib/model/storagefile/storagefile.upload.claims.d.ts +21 -4
  108. package/src/lib/model/storagefile/storagefile.upload.d.ts +41 -9
  109. package/src/lib/model/storagefile/storagefile.upload.determiner.d.ts +112 -20
  110. package/src/lib/model/storagefile/storagefile.util.d.ts +66 -3
  111. package/src/lib/model/system/system.action.d.ts +25 -0
  112. package/src/lib/model/system/system.d.ts +80 -4
  113. package/src/lib/model/user.d.ts +8 -2
  114. package/test/index.cjs.js +11168 -3295
  115. package/test/index.esm.js +11176 -3303
  116. package/test/package.json +6 -6
  117. package/test/src/lib/client/firebase.authorized.d.ts +18 -0
  118. package/test/src/lib/client/firebase.d.ts +60 -0
  119. package/test/src/lib/common/firebase.instance.d.ts +21 -0
  120. package/test/src/lib/common/firestore/firestore.d.ts +40 -0
  121. package/test/src/lib/common/firestore/firestore.instance.d.ts +16 -0
  122. package/test/src/lib/common/firestore/test.driver.accessor.d.ts +39 -2
  123. package/test/src/lib/common/firestore/test.driver.utility.d.ts +8 -2
  124. package/test/src/lib/common/firestore/test.iterator.d.ts +7 -2
  125. package/test/src/lib/common/mock/mock.item.collection.fixture.d.ts +29 -1
  126. package/test/src/lib/common/mock/mock.item.d.ts +219 -5
  127. package/test/src/lib/common/mock/mock.item.id.d.ts +6 -0
  128. package/test/src/lib/common/mock/mock.item.query.d.ts +12 -0
  129. package/test/src/lib/common/mock/mock.item.service.d.ts +60 -0
  130. package/test/src/lib/common/mock/mock.item.storage.fixture.d.ts +28 -1
  131. package/test/src/lib/common/storage/storage.d.ts +30 -0
  132. package/test/src/lib/common/storage/storage.instance.d.ts +22 -0
  133. package/test/src/lib/common/storage/test.driver.accessor.d.ts +7 -2
  134. package/index.cjs.js.map +0 -1
  135. package/index.esm.js.map +0 -1
@@ -1,77 +1,134 @@
1
1
  import { type SlashPath, type FactoryWithRequiredInput } from '@dereekb/util';
2
2
  /**
3
- * Storage bucket identifier.
3
+ * Storage bucket identifier for Firebase Cloud Storage.
4
4
  *
5
- * Should contain no slashes, just the bucket's identifier.
5
+ * Should contain no slashes just the bucket name (e.g., `"my-app.appspot.com"`).
6
6
  */
7
7
  export type StorageBucketId = string;
8
8
  /**
9
- * A reference to a StorageBucketId
9
+ * Contains a reference to a {@link StorageBucketId}.
10
10
  */
11
11
  export interface StorageBucketIdRef {
12
12
  readonly bucketId: StorageBucketId;
13
13
  }
14
14
  /**
15
- * A filepath to a file or folder.
15
+ * Slash-delimited file or folder path within a storage bucket.
16
+ *
17
+ * Does not include the bucket identifier — only the path relative to the bucket root.
16
18
  */
17
19
  export type StorageSlashPath = SlashPath;
18
20
  /**
19
- * A reference to a StorageSlashPath
21
+ * Contains a reference to a {@link StorageSlashPath}.
20
22
  */
21
23
  export interface StorageSlashPathRef {
22
24
  /**
23
- * The full path/name of a file.
25
+ * The full path/name of a file relative to the bucket root.
24
26
  *
25
- * For example, if a file is at the path '<bucket>/full/path/image.png', the pathString is 'full/path/image.png'.
27
+ * For example, if a file is at the path `<bucket>/full/path/image.png`, the pathString is `full/path/image.png`.
26
28
  */
27
29
  readonly pathString: StorageSlashPath;
28
30
  }
29
31
  /**
30
- * A bucket and path pair.
32
+ * A bucket and path pair that uniquely identifies a file or folder in Firebase Cloud Storage.
31
33
  *
32
34
  * If the bucket is not defined, it implies the default app bucket.
33
35
  */
34
36
  export interface StoragePath extends StorageBucketIdRef, StorageSlashPathRef {
35
37
  }
36
38
  /**
37
- * Creates a new StoragePath object with the same bucketId and pathString as the input.
39
+ * Creates a shallow copy of a {@link StoragePath}, preserving bucketId and pathString.
40
+ *
41
+ * Useful when you need an independent reference that won't be affected by mutations to the original.
42
+ *
43
+ * @param path - the storage path to copy
38
44
  *
39
- * @param path The StoragePath to copy.
40
- * @returns A new StoragePath object.
45
+ * @example
46
+ * ```ts
47
+ * const copy = copyStoragePath({ bucketId: 'my-bucket', pathString: 'images/photo.png' });
48
+ * ```
41
49
  */
42
50
  export declare function copyStoragePath(path: StoragePath): StoragePath;
43
51
  /**
44
- * Storage-Path related input.
52
+ * Flexible input that can be used to resolve a {@link StoragePath}.
53
+ *
54
+ * Accepts a raw slash path string, a {@link StoragePath}, or a {@link StorageSlashPathRef}.
45
55
  */
46
56
  export type StoragePathInput = StorageSlashPath | StoragePath | StorageSlashPathRef;
47
57
  /**
48
- * Converts the input to a StoragePath
58
+ * Factory that normalizes a {@link StoragePathInput} into a fully-resolved {@link StoragePath} with a bucket.
49
59
  */
50
60
  export type StoragePathFactory = FactoryWithRequiredInput<StoragePath, StoragePathInput>;
61
+ /**
62
+ * Configuration for {@link storagePathFactory}.
63
+ */
51
64
  export interface StoragePathFactoryConfig extends StorageBucketIdRef {
52
65
  /**
53
- * Whether or not to replace the bucketId on input that has it.
66
+ * Whether to always override the bucketId on inputs that already have one.
54
67
  *
55
- * False by default.
68
+ * When `false` (default), input bucketIds are preserved and the configured bucket is used only as a fallback.
56
69
  */
57
70
  readonly replaceBucket?: boolean;
58
71
  }
59
72
  /**
60
- * Creates a StoragePathFactory.
73
+ * Creates a {@link StoragePathFactory} that normalizes various path inputs into {@link StoragePath} objects
74
+ * with a consistent bucket assignment.
61
75
  *
62
- * @param config
63
- * @returns
76
+ * @param config - bucket and replacement behavior
77
+ *
78
+ * @example
79
+ * ```ts
80
+ * const pathFactory = storagePathFactory({ bucketId: 'my-bucket' });
81
+ * const path = pathFactory('images/photo.png');
82
+ * // path === { bucketId: 'my-bucket', pathString: 'images/photo.png' }
83
+ * ```
64
84
  */
65
85
  export declare function storagePathFactory(config: StoragePathFactoryConfig): StoragePathFactory;
66
86
  /**
67
- * A reference to a StoragePath
87
+ * Contains a reference to a {@link StoragePath}.
68
88
  */
69
89
  export interface StoragePathRef {
70
90
  readonly storagePath: StoragePath;
71
91
  }
92
+ /**
93
+ * Google Cloud Storage bucket prefix in `gs://` URI format.
94
+ */
72
95
  export type GoogleCloudStorageBucketPrefix<S extends StorageBucketId = StorageBucketId> = `gs://${S}`;
96
+ /**
97
+ * A file path in the default bucket — equivalent to the raw path string.
98
+ */
73
99
  export type GoogleCloudStorageDefaultBucketFilePath<P extends StorageSlashPath = StorageSlashPath> = P;
100
+ /**
101
+ * A fully-qualified `gs://bucket/path` URI for a file in a specific bucket.
102
+ */
74
103
  export type GoogleCloudStorageBucketAndFilePath<P extends StorageSlashPath = StorageSlashPath, S extends StorageBucketId = StorageBucketId> = `${GoogleCloudStorageBucketPrefix<S>}/${P}`;
104
+ /**
105
+ * A Google Cloud Storage file path — either a raw path (default bucket) or a full `gs://` URI.
106
+ */
75
107
  export type GoogleCloudStorageFilePath<P extends StorageSlashPath = StorageSlashPath> = GoogleCloudStorageDefaultBucketFilePath<P> | GoogleCloudStorageBucketAndFilePath<P>;
108
+ /**
109
+ * Converts a {@link StoragePath} to a {@link GoogleCloudStorageFilePath} string.
110
+ *
111
+ * If the path has a bucketId, produces a `gs://bucket/path` URI. Otherwise, returns just the relative path
112
+ * (implying the default bucket).
113
+ *
114
+ * @param path - the storage path to convert
115
+ *
116
+ * @example
117
+ * ```ts
118
+ * const uri = firebaseStorageFilePathFromStorageFilePath({ bucketId: 'my-bucket', pathString: 'images/photo.png' });
119
+ * // uri === 'gs://my-bucket/images/photo.png'
120
+ * ```
121
+ */
76
122
  export declare function firebaseStorageFilePathFromStorageFilePath(path: StoragePath): GoogleCloudStorageFilePath;
123
+ /**
124
+ * Returns the `gs://` bucket prefix URI for the given bucket identifier or ref.
125
+ *
126
+ * @param storage - bucket ID string or a {@link StorageBucketIdRef}
127
+ *
128
+ * @example
129
+ * ```ts
130
+ * firebaseStorageBucketFolderPath('my-bucket');
131
+ * // returns 'gs://my-bucket'
132
+ * ```
133
+ */
77
134
  export declare function firebaseStorageBucketFolderPath(storage: StorageBucketId | StorageBucketIdRef): GoogleCloudStorageBucketPrefix;
@@ -1,5 +1,10 @@
1
1
  import { type ArrayOrValue, type DateOrUnixDateTimeMillisecondsNumber, type FileSize, type Milliseconds, type MimeTypeWithoutParameters, type ISO8601DateString, type Maybe, type ContentDispositionString, type ContentTypeMimeType } from '@dereekb/util';
2
2
  import { type Observable } from 'rxjs';
3
+ /**
4
+ * Minimal shape of the Firebase client-side Storage object.
5
+ *
6
+ * Used to avoid depending on the concrete Firebase SDK type — keeps the library SDK-agnostic.
7
+ */
3
8
  export type FirebaseStorageLikeStorage = {
4
9
  /**
5
10
  * The maximum time to retry uploads in milliseconds.
@@ -11,12 +16,17 @@ export type FirebaseStorageLikeStorage = {
11
16
  */
12
17
  readonly maxOperationRetryTime: number;
13
18
  };
19
+ /**
20
+ * Minimal shape of the Google Cloud Storage (server-side) object.
21
+ */
14
22
  export type GoogleCloudLikeStorage = {
15
23
  readonly baseUrl: string;
16
24
  readonly projectId: string;
17
25
  };
18
26
  /**
19
- * Cast to the local type's Storage if direct access is needed. In most cases, direct access to this type is unncessary.
27
+ * Union of client-side and server-side Firebase Storage types.
28
+ *
29
+ * Cast to the concrete type if direct SDK access is needed. In most cases, use {@link FirebaseStorageContext} instead.
20
30
  */
21
31
  export type FirebaseStorage = FirebaseStorageLikeStorage | GoogleCloudLikeStorage;
22
32
  /**
@@ -124,22 +134,30 @@ export type StorageDataUrlStringType = 'data_url';
124
134
  export type StorageDataString = StorageRawDataString | StorageBase64DataString | StorageBase64UrlDataString | StorageDataUrlString;
125
135
  export type StorageDataStringType = StorageRawDataStringType | StorageBase64DataStringType | StorageBase64UrlDataStringType | StorageDataUrlStringType;
126
136
  /**
127
- * Blob and Byte array types that can be uploaded by the client implementation.
137
+ * Binary types that can be uploaded via the client-side Firebase Storage SDK.
128
138
  */
129
139
  export type StorageClientUploadBytesInput = File | Blob | Uint8Array;
130
140
  /**
131
- * Known types that can be uploaded by the client implementation.
141
+ * All types that can be uploaded via the client-side Firebase Storage SDK (binary or string-encoded).
132
142
  */
133
143
  export type StorageClientUploadInput = StorageClientUploadBytesInput | StorageDataString;
134
144
  /**
135
- * Known types that can be uploaded by the client implementation.
145
+ * Binary types that can be uploaded via the server-side Google Cloud Storage SDK.
136
146
  */
137
147
  export type StorageServerUploadBytesInput = Buffer | Uint8Array;
138
148
  /**
139
- * Known types that can be uploaded by the server implementation.
149
+ * All types that can be uploaded via the server-side Google Cloud Storage SDK (binary or string-encoded).
140
150
  */
141
151
  export type StorageServerUploadInput = StorageServerUploadBytesInput | StorageDataString;
152
+ /**
153
+ * Union of all uploadable input types across client and server.
154
+ */
142
155
  export type StorageUploadInput = StorageClientUploadInput | StorageServerUploadInput;
156
+ /**
157
+ * Represents a resumable upload task with controls for pausing, cancelling, and monitoring progress.
158
+ *
159
+ * Primarily used on the client side via `uploadResumable()` on {@link FirebaseStorageAccessorFile}.
160
+ */
143
161
  export interface StorageUploadTask<R = unknown> {
144
162
  /**
145
163
  * Exposes the internal reference type.
@@ -1,4 +1,5 @@
1
1
  export * from './user';
2
2
  export * from './notification';
3
+ export * from './oidcmodel';
3
4
  export * from './storagefile';
4
5
  export * from './system';
@@ -1,3 +1,11 @@
1
+ /**
2
+ * @module notification.action
3
+ *
4
+ * Generic CRUD action type aliases for each notification document type.
5
+ * These types parameterize the server-side action factories in `@dereekb/firebase-server/model`.
6
+ *
7
+ * Sync variants return the result directly; Async variants return a Promise.
8
+ */
1
9
  import { type AsyncFirebaseFunctionCreateAction, type AsyncFirebaseFunctionDeleteAction, type AsyncFirebaseFunctionUpdateAction, type FirebaseFunctionCreateAction, type FirebaseFunctionDeleteAction, type FirebaseFunctionUpdateAction } from '../../common';
2
10
  import { type NotificationSummaryDocument, type NotificationBoxDocument, type NotificationDocument, type NotificationWeekDocument, type NotificationUserDocument } from './notification';
3
11
  export type NotificationUserCreateAction<P extends object> = FirebaseFunctionCreateAction<P, NotificationUserDocument>;
@@ -1,3 +1,11 @@
1
+ /**
2
+ * @module notification.api
3
+ *
4
+ * API parameter types, Arktype validation schemas, and Firebase function definitions for the notification CRUD operations.
5
+ *
6
+ * Each param interface has a corresponding Arktype validator (e.g., {@link updateNotificationUserParamsType}).
7
+ * The {@link NotificationFunctions} abstract class defines the client-callable function map.
8
+ */
1
9
  import { type Type } from 'arktype';
2
10
  import { type TargetModelParams, type FirestoreModelKey, type FirebaseAuthUserId } from '../../common';
3
11
  import { type ModelFirebaseCrudFunction, type FirebaseFunctionTypeConfigMap, type ModelFirebaseCrudFunctionConfigMap, type ModelFirebaseFunctionMap } from '../../client';
@@ -192,6 +200,9 @@ export interface SendNotificationResultOnSendCompleteResult<T = unknown> {
192
200
  readonly value?: T;
193
201
  readonly error?: Maybe<unknown>;
194
202
  }
203
+ /**
204
+ * Detailed result returned by the `sendNotification` function, describing the outcome of sending a single notification.
205
+ */
195
206
  export interface SendNotificationResult {
196
207
  readonly notificationTemplateType: Maybe<NotificationTemplateType>;
197
208
  readonly isKnownTemplateType: Maybe<boolean>;
@@ -228,6 +239,9 @@ export interface SendQueuedNotificationsParams {
228
239
  readonly sendNotificationLoopsTaskExcessThreshold?: Maybe<number>;
229
240
  }
230
241
  export declare const sendQueuedNotificationsParamsType: Type<SendQueuedNotificationsParams>;
242
+ /**
243
+ * Aggregate result of processing the notification send queue, with counts of visited, succeeded, failed, and deleted notifications.
244
+ */
231
245
  export interface SendQueuedNotificationsResult extends Omit<SendNotificationResult, 'throttled' | 'isNotificationTask' | 'isUniqueNotificationTask' | 'notificationTaskCompletionType' | 'uniqueNotificationTaskConflict' | 'isConfiguredTemplateType' | 'isKnownTemplateType' | 'notificationTemplateType' | 'notificationMarkedDone' | 'deletedNotification' | 'createdBox' | 'success' | 'exists' | 'boxExists' | 'notificationBoxNeedsInitialization' | 'tryRun' | 'loadMessageFunctionFailure' | 'buildMessageFailure'> {
232
246
  readonly excessLoopsDetected: boolean;
233
247
  readonly notificationLoopCount: number;
@@ -252,6 +266,9 @@ export interface CleanupSentNotificationsResult {
252
266
  readonly notificationWeeksCreated: number;
253
267
  readonly notificationWeeksUpdated: number;
254
268
  }
269
+ /**
270
+ * Custom (non-CRUD) function type map for notifications. Currently empty — all operations use the CRUD pattern.
271
+ */
255
272
  export type NotificationFunctionTypeMap = {};
256
273
  export declare const notificationFunctionTypeConfigMap: FirebaseFunctionTypeConfigMap<NotificationFunctionTypeMap>;
257
274
  export type NotificationBoxModelCrudFunctionsConfig = {
@@ -280,6 +297,12 @@ export type NotificationBoxModelCrudFunctionsConfig = {
280
297
  readonly notificationWeek: null;
281
298
  };
282
299
  export declare const notificationBoxModelCrudFunctionsConfig: ModelFirebaseCrudFunctionConfigMap<NotificationBoxModelCrudFunctionsConfig, NotificationTypes>;
300
+ /**
301
+ * Abstract client-callable function map for notification CRUD operations.
302
+ *
303
+ * Implementations are generated by {@link notificationFunctionMap} for client-side use,
304
+ * and by the server-side function registration in the demo-api or application module.
305
+ */
283
306
  export declare abstract class NotificationFunctions implements ModelFirebaseFunctionMap<NotificationFunctionTypeMap, NotificationBoxModelCrudFunctionsConfig> {
284
307
  abstract notificationUser: {
285
308
  updateNotificationUser: {
@@ -304,4 +327,7 @@ export declare abstract class NotificationFunctions implements ModelFirebaseFunc
304
327
  };
305
328
  };
306
329
  }
330
+ /**
331
+ * Factory for creating client-side callable function instances from the notification CRUD configuration.
332
+ */
307
333
  export declare const notificationFunctionMap: import("../..").ModelFirebaseFunctionMapFactory<NotificationFunctionTypeMap, NotificationBoxModelCrudFunctionsConfig>;
@@ -1,9 +1,24 @@
1
+ /**
2
+ * @module notification.api.error
3
+ *
4
+ * Error code constants thrown by the notification server action service.
5
+ * These codes are returned in Firebase function error responses for client-side handling.
6
+ */
7
+ /** Thrown when a notification creation request is missing a required ID. */
1
8
  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. */
2
10
  export declare const NOTIFICATION_MODEL_ALREADY_INITIALIZED_ERROR_CODE = "NOTIFICATION_MODEL_ALREADY_INITIALIZED";
11
+ /** Thrown when the target NotificationBox does not exist. */
3
12
  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. */
4
14
  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. */
5
16
  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). */
6
18
  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. */
7
20
  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. */
8
22
  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. */
9
24
  export declare const NOTIFICATION_USER_LOCKED_CONFIG_FROM_BEING_UPDATED_ERROR_CODE = "NOTIFICATION_USER_LOCKED_CONFIG_FROM_BEING_UPDATED";
@@ -1,31 +1,46 @@
1
+ /**
2
+ * @module notification.api.util
3
+ *
4
+ * Utility functions for applying {@link UpdateNotificationUserParams} changes to notification config objects.
5
+ * Used by the server action service when processing user config update requests.
6
+ */
1
7
  import { type Maybe } from '@dereekb/util';
2
8
  import { type NotificationBoxRecipientTemplateConfigRecord, type NotificationUserDefaultNotificationBoxRecipientConfig, type NotificationUserNotificationBoxRecipientConfig } from './notification.config';
3
9
  import { type NotificationBoxRecipientTemplateConfigArrayEntryParam, type UpdateNotificationUserDefaultNotificationBoxRecipientConfigParams, type UpdateNotificationUserNotificationBoxRecipientParams } from './notification.api';
4
10
  import { type AppNotificationTemplateTypeInfoRecordService } from './notification.details';
5
11
  import { type NotificationTemplateType } from './notification.id';
6
12
  /**
7
- * Updates a NotificationUserDefaultNotificationBoxRecipientConfig with the input UpdateNotificationUserDefaultNotificationBoxRecipientConfigParams.
13
+ * Applies an array of config entry params to a {@link NotificationBoxRecipientTemplateConfigRecord},
14
+ * inserting new entries, merging updates, and removing entries marked with `remove: true`.
8
15
  *
9
- * @param a
10
- * @param b
11
- * @returns
16
+ * @param a - existing config record
17
+ * @param b - array of update params to apply
18
+ * @param limitToAllowedConfigTypes - when provided, filters the result to only include these template types
12
19
  */
13
20
  export declare function updateNotificationBoxRecipientTemplateConfigRecord(a: NotificationBoxRecipientTemplateConfigRecord, b: NotificationBoxRecipientTemplateConfigArrayEntryParam[], limitToAllowedConfigTypes?: Maybe<Iterable<NotificationTemplateType>>): NotificationBoxRecipientTemplateConfigRecord | undefined;
14
21
  /**
15
- * Updates a NotificationUserDefaultNotificationBoxRecipientConfig with the input UpdateNotificationUserDefaultNotificationBoxRecipientConfigParams.
22
+ * Applies {@link UpdateNotificationUserDefaultNotificationBoxRecipientConfigParams} to an existing
23
+ * {@link NotificationUserDefaultNotificationBoxRecipientConfig}, producing an updated config.
16
24
  *
17
- * @param a
18
- * @param b
19
- * @returns
25
+ * @param a - existing config
26
+ * @param b - update params to apply
27
+ * @param limitToAllowedConfigTypes - when provided, filters config types to only allowed template types
20
28
  */
21
29
  export declare function updateNotificationUserDefaultNotificationBoxRecipientConfig(a: NotificationUserDefaultNotificationBoxRecipientConfig, b: UpdateNotificationUserDefaultNotificationBoxRecipientConfigParams, limitToAllowedConfigTypes?: Maybe<Iterable<NotificationTemplateType>>): NotificationUserDefaultNotificationBoxRecipientConfig;
30
+ /**
31
+ * Applies update params to a {@link NotificationUserNotificationBoxRecipientConfig} and returns the updated config
32
+ * only if it actually changed. Returns `undefined` if no changes were detected.
33
+ *
34
+ * Automatically sets `ns = true` (needs sync) when changes are detected and the recipient has been indexed.
35
+ */
22
36
  export declare function updateNotificationUserNotificationBoxRecipientConfigIfChanged(a: NotificationUserNotificationBoxRecipientConfig, b: UpdateNotificationUserNotificationBoxRecipientParams, limitToAllowedConfigTypes?: Maybe<Iterable<NotificationTemplateType>>): NotificationUserNotificationBoxRecipientConfig | undefined;
23
37
  /**
24
- * Updates the target NotificationUserNotificationBoxRecipientConfig array with the input UpdateNotificationUserNotificationBoxRecipientParams.
38
+ * Batch-applies an array of {@link UpdateNotificationUserNotificationBoxRecipientParams} to the user's
39
+ * per-box config array. Only updates configs for boxes that already exist in the user's config.
25
40
  *
26
- * If the target NotificationBox does not exist in the config, it is ignored.
41
+ * Handles deletion of removed configs (when `deleteRemovedConfig` is set) and filters template types
42
+ * through the optional {@link AppNotificationTemplateTypeInfoRecordService}.
27
43
  *
28
- * @param a
29
- * @param b
44
+ * Returns `undefined` if no changes were made.
30
45
  */
31
46
  export declare function updateNotificationUserNotificationBoxRecipientConfigs(a: NotificationUserNotificationBoxRecipientConfig[], b: UpdateNotificationUserNotificationBoxRecipientParams[], filterWithService?: AppNotificationTemplateTypeInfoRecordService): NotificationUserNotificationBoxRecipientConfig[] | undefined;