@dereekb/firebase 11.0.21 → 11.1.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.
- package/index.cjs.js +1881 -93
- package/index.esm.js +2042 -37
- package/package.json +3 -2
- package/src/lib/client/error/error.d.ts +8 -0
- package/src/lib/client/error/index.d.ts +1 -0
- package/src/lib/client/firestore/error.d.ts +1 -0
- package/src/lib/client/firestore/index.d.ts +1 -0
- package/src/lib/client/index.d.ts +1 -0
- package/src/lib/common/firestore/accessor/document.utility.d.ts +4 -0
- package/src/lib/common/firestore/collection/collection.d.ts +6 -1
- package/src/lib/model/index.d.ts +1 -0
- package/src/lib/model/notification/index.d.ts +14 -0
- package/src/lib/model/notification/notification.action.d.ts +24 -0
- package/src/lib/model/notification/notification.api.d.ts +389 -0
- package/src/lib/model/notification/notification.api.error.d.ts +7 -0
- package/src/lib/model/notification/notification.api.util.d.ts +31 -0
- package/src/lib/model/notification/notification.config.d.ts +207 -0
- package/src/lib/model/notification/notification.create.d.ts +139 -0
- package/src/lib/model/notification/notification.d.ts +403 -0
- package/src/lib/model/notification/notification.details.d.ts +98 -0
- package/src/lib/model/notification/notification.id.d.ts +49 -0
- package/src/lib/model/notification/notification.item.d.ts +70 -0
- package/src/lib/model/notification/notification.message.d.ts +152 -0
- package/src/lib/model/notification/notification.query.d.ts +43 -0
- package/src/lib/model/notification/notification.send.d.ts +22 -0
- package/src/lib/model/notification/notification.util.d.ts +51 -0
- package/test/CHANGELOG.md +4 -0
- package/test/package.json +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dereekb/firebase",
|
|
3
|
-
"version": "11.0
|
|
3
|
+
"version": "11.1.0",
|
|
4
4
|
"exports": {
|
|
5
5
|
".": {
|
|
6
6
|
"types": "./src/index.d.ts",
|
|
@@ -30,7 +30,8 @@
|
|
|
30
30
|
"firebase": "^10.5.0",
|
|
31
31
|
"ts-essentials": "^9.1.2",
|
|
32
32
|
"class-transformer": "^0.5.1",
|
|
33
|
-
"class-validator": "^0.14.0"
|
|
33
|
+
"class-validator": "^0.14.0",
|
|
34
|
+
"date-fns": "^2.30.0"
|
|
34
35
|
},
|
|
35
36
|
"dependencies": {},
|
|
36
37
|
"module": "./index.esm.js",
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './error';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const FIRESTORE_PERMISSION_DENIED_ERROR_CODE: string;
|
|
@@ -41,6 +41,10 @@ export interface FirestoreDocumentSnapshotDataPairWithData<D extends FirestoreDo
|
|
|
41
41
|
}
|
|
42
42
|
export declare function getDocumentSnapshotDataPair<D extends FirestoreDocument<any>>(document: D): Promise<FirestoreDocumentSnapshotDataPair<D>>;
|
|
43
43
|
export declare function getDocumentSnapshotDataPairs<D extends FirestoreDocument<any>>(documents: D[]): Promise<FirestoreDocumentSnapshotDataPair<D>[]>;
|
|
44
|
+
/**
|
|
45
|
+
* Convenience function for calling getDocumentSnapshotDataPairs() then returning only the pairs that have data.
|
|
46
|
+
*/
|
|
47
|
+
export declare function getDocumentSnapshotDataPairsWithData<D extends FirestoreDocument<any>>(documents: D[]): Promise<FirestoreDocumentSnapshotDataPairWithData<D>[]>;
|
|
44
48
|
export type FirestoreDocumentSnapshotDataTuple<D extends FirestoreDocument<any>> = [D, Maybe<FirestoreDocumentData<D>>];
|
|
45
49
|
export declare function getDocumentSnapshotDataTuples<D extends FirestoreDocument<any>>(documents: D[]): Promise<FirestoreDocumentSnapshotDataTuple<D>[]>;
|
|
46
50
|
export declare function getDocumentSnapshotData<D extends FirestoreDocument<any>>(document: D): Promise<Maybe<DocumentDataWithIdAndKey<FirestoreDocumentData<D>>>>;
|
|
@@ -317,8 +317,13 @@ export declare function firestoreModelKeyPath(...parts: FirestoreModelKeyPart[])
|
|
|
317
317
|
export declare function childFirestoreModelKeyPath(parent: FirestoreModelKeyPart, children: ArrayOrValue<FirestoreModelKeyPart>): FirestoreModelKey[];
|
|
318
318
|
export type FirestoreModelCollectionAndIdPairObject = Record<FirestoreCollectionName, FirestoreModelId>;
|
|
319
319
|
export declare function firestoreModelKeyPairObject(input: FirestoreModelKey | DocumentReferenceRef<unknown> | FirestoreModelKeyRef): Maybe<FirestoreModelCollectionAndIdPairObject>;
|
|
320
|
+
/**
|
|
321
|
+
* String that is composed of the FirestoreCollectionNames derived from an input FirestoreModelKey and joined together via a separator.
|
|
322
|
+
*
|
|
323
|
+
* Is equivalent to a FirestoreCollectionType if the FIRESTORE_COLLECTION_NAME_SEPARATOR is used as the separator.
|
|
324
|
+
*/
|
|
320
325
|
export type FirestoreModelCollectionTypeArrayName = string;
|
|
321
|
-
export declare function firestoreModelKeyCollectionType<T = unknown>(input: ReadFirestoreModelKeyInput<T>): Maybe<
|
|
326
|
+
export declare function firestoreModelKeyCollectionType<T = unknown>(input: ReadFirestoreModelKeyInput<T>): Maybe<FirestoreCollectionType>;
|
|
322
327
|
export declare function firestoreModelKeyCollectionTypeArrayName<T = unknown>(input: ReadFirestoreModelKeyInput<T>, separator?: string): Maybe<FirestoreModelCollectionTypeArrayName>;
|
|
323
328
|
export declare function firestoreIdentityTypeArrayName(input: FirestoreModelIdentity, separator?: string): FirestoreModelCollectionTypeArrayName;
|
|
324
329
|
export type FirestoreModelCollectionTypeArray = FirestoreCollectionName[];
|
package/src/lib/model/index.d.ts
CHANGED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export * from './notification';
|
|
2
|
+
export * from './notification.api';
|
|
3
|
+
export * from './notification.api.error';
|
|
4
|
+
export * from './notification.api.util';
|
|
5
|
+
export * from './notification.action';
|
|
6
|
+
export * from './notification.config';
|
|
7
|
+
export * from './notification.create';
|
|
8
|
+
export * from './notification.details';
|
|
9
|
+
export * from './notification.item';
|
|
10
|
+
export * from './notification.id';
|
|
11
|
+
export * from './notification.message';
|
|
12
|
+
export * from './notification.query';
|
|
13
|
+
export * from './notification.send';
|
|
14
|
+
export * from './notification.util';
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { type AsyncFirebaseFunctionCreateAction, type AsyncFirebaseFunctionDeleteAction, type AsyncFirebaseFunctionUpdateAction, type FirebaseFunctionCreateAction, type FirebaseFunctionDeleteAction, type FirebaseFunctionUpdateAction } from '../../common';
|
|
2
|
+
import { type NotificationSummaryDocument, type NotificationBoxDocument, type NotificationDocument, type NotificationWeekDocument, type NotificationUserDocument } from './notification';
|
|
3
|
+
export type NotificationUserCreateAction<P extends object> = FirebaseFunctionCreateAction<P, NotificationUserDocument>;
|
|
4
|
+
export type AsyncNotificationUserCreateAction<P extends object> = AsyncFirebaseFunctionCreateAction<P, NotificationUserDocument>;
|
|
5
|
+
export type NotificationUserUpdateAction<P extends object> = FirebaseFunctionUpdateAction<P, NotificationUserDocument>;
|
|
6
|
+
export type AsyncNotificationUserUpdateAction<P extends object> = AsyncFirebaseFunctionUpdateAction<P, NotificationUserDocument>;
|
|
7
|
+
export type NotificationSummaryCreateAction<P extends object> = FirebaseFunctionCreateAction<P, NotificationSummaryDocument>;
|
|
8
|
+
export type AsyncNotificationSummaryCreateAction<P extends object> = AsyncFirebaseFunctionCreateAction<P, NotificationSummaryDocument>;
|
|
9
|
+
export type NotificationSummaryUpdateAction<P extends object> = FirebaseFunctionUpdateAction<P, NotificationSummaryDocument>;
|
|
10
|
+
export type AsyncNotificationSummaryUpdateAction<P extends object> = AsyncFirebaseFunctionUpdateAction<P, NotificationSummaryDocument>;
|
|
11
|
+
export type NotificationBoxCreateAction<P extends object> = FirebaseFunctionCreateAction<P, NotificationBoxDocument>;
|
|
12
|
+
export type AsyncNotificationBoxCreateAction<P extends object> = AsyncFirebaseFunctionCreateAction<P, NotificationBoxDocument>;
|
|
13
|
+
export type NotificationBoxUpdateAction<P extends object> = FirebaseFunctionUpdateAction<P, NotificationBoxDocument>;
|
|
14
|
+
export type AsyncNotificationBoxUpdateAction<P extends object> = AsyncFirebaseFunctionUpdateAction<P, NotificationBoxDocument>;
|
|
15
|
+
export type NotificationCreateAction<P extends object> = FirebaseFunctionCreateAction<P, NotificationDocument, NotificationBoxDocument>;
|
|
16
|
+
export type AsyncNotificationCreateAction<P extends object> = AsyncFirebaseFunctionCreateAction<P, NotificationDocument, NotificationBoxDocument>;
|
|
17
|
+
export type NotificationUpdateAction<P extends object> = FirebaseFunctionUpdateAction<P, NotificationDocument>;
|
|
18
|
+
export type AsyncNotificationUpdateAction<P extends object> = AsyncFirebaseFunctionUpdateAction<P, NotificationDocument>;
|
|
19
|
+
export type NotificationDeleteAction<P extends object> = FirebaseFunctionDeleteAction<P, NotificationDocument>;
|
|
20
|
+
export type AsyncNotificationDeleteAction<P extends object> = AsyncFirebaseFunctionDeleteAction<P, NotificationDocument>;
|
|
21
|
+
export type NotificationWeekCreateAction<P extends object> = FirebaseFunctionCreateAction<P, NotificationWeekDocument>;
|
|
22
|
+
export type AsyncNotificationWeekCreateAction<P extends object> = AsyncFirebaseFunctionCreateAction<P, NotificationWeekDocument>;
|
|
23
|
+
export type NotificationWeekUpdateAction<P extends object> = FirebaseFunctionUpdateAction<P, NotificationWeekDocument>;
|
|
24
|
+
export type AsyncNotificationWeekUpdateAction<P extends object> = AsyncFirebaseFunctionUpdateAction<P, NotificationWeekDocument>;
|
|
@@ -0,0 +1,389 @@
|
|
|
1
|
+
import { TargetModelParams, type FirestoreModelKey, type FirebaseAuthUserId } from '../../common';
|
|
2
|
+
import { type ModelFirebaseCrudFunction, type FirebaseFunctionTypeConfigMap, type ModelFirebaseCrudFunctionConfigMap, type ModelFirebaseFunctionMap } from '../../client';
|
|
3
|
+
import { type E164PhoneNumber, type EmailAddress, type IndexNumber, type Maybe } from '@dereekb/util';
|
|
4
|
+
import { type NotificationTypes } from './notification';
|
|
5
|
+
import { type NotificationUserDefaultNotificationBoxRecipientConfig, type NotificationBoxRecipientTemplateConfigArrayEntry, NotificationBoxRecipientFlag } from './notification.config';
|
|
6
|
+
import { type NotificationBoxId, type NotificationSummaryId, type NotificationTemplateType } from './notification.id';
|
|
7
|
+
import { type NotificationSendEmailMessagesResult, type NotificationSendTextMessagesResult, type NotificationSendNotificationSummaryMessagesResult } from './notification.send';
|
|
8
|
+
export declare const NOTIFICATION_RECIPIENT_NAME_MIN_LENGTH = 0;
|
|
9
|
+
export declare const NOTIFICATION_RECIPIENT_NAME_MAX_LENGTH = 42;
|
|
10
|
+
export declare const NOTIFICATION_SUBJECT_MIN_LENGTH = 2;
|
|
11
|
+
export declare const NOTIFICATION_SUBJECT_MAX_LENGTH = 100;
|
|
12
|
+
export declare const NOTIFICATION_MESSAGE_MIN_LENGTH = 2;
|
|
13
|
+
export declare const NOTIFICATION_MESSAGE_MAX_LENGTH = 1000;
|
|
14
|
+
/**
|
|
15
|
+
* Config entries are inserted, unless marked as remove.
|
|
16
|
+
*/
|
|
17
|
+
export declare class NotificationBoxRecipientTemplateConfigArrayEntryParam implements NotificationBoxRecipientTemplateConfigArrayEntry {
|
|
18
|
+
type: string;
|
|
19
|
+
sd?: Maybe<boolean>;
|
|
20
|
+
se?: Maybe<boolean>;
|
|
21
|
+
st?: Maybe<boolean>;
|
|
22
|
+
sp?: Maybe<boolean>;
|
|
23
|
+
sn?: Maybe<boolean>;
|
|
24
|
+
/**
|
|
25
|
+
* If true, removes this configuration
|
|
26
|
+
*/
|
|
27
|
+
remove?: Maybe<boolean>;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Used for creating a new NotificationUser for a user.
|
|
31
|
+
*/
|
|
32
|
+
export declare class CreateNotificationUserParams {
|
|
33
|
+
/**
|
|
34
|
+
* UID of the user to create the NotificationUser for.
|
|
35
|
+
*/
|
|
36
|
+
uid: FirebaseAuthUserId;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Used for updating the global or default config on a NotificationUser.
|
|
40
|
+
*/
|
|
41
|
+
export declare class UpdateNotificationUserDefaultNotificationBoxRecipientConfigParams implements Omit<NotificationUserDefaultNotificationBoxRecipientConfig, 'c'> {
|
|
42
|
+
/**
|
|
43
|
+
* NotificationBox recipient to update. Is ignored if UID is provided and matches a user. Used for external recipients/users.
|
|
44
|
+
*/
|
|
45
|
+
i?: Maybe<IndexNumber>;
|
|
46
|
+
/**
|
|
47
|
+
* Override email address
|
|
48
|
+
*/
|
|
49
|
+
e?: Maybe<EmailAddress>;
|
|
50
|
+
/**
|
|
51
|
+
* Override phone number
|
|
52
|
+
*/
|
|
53
|
+
t?: Maybe<E164PhoneNumber>;
|
|
54
|
+
/**
|
|
55
|
+
* Array of configs that correspond with "c"
|
|
56
|
+
*/
|
|
57
|
+
configs?: Maybe<NotificationBoxRecipientTemplateConfigArrayEntryParam[]>;
|
|
58
|
+
lk?: Maybe<boolean>;
|
|
59
|
+
bk?: Maybe<boolean>;
|
|
60
|
+
f?: Maybe<NotificationBoxRecipientFlag>;
|
|
61
|
+
}
|
|
62
|
+
export declare class UpdateNotificationBoxRecipientLikeParams {
|
|
63
|
+
/**
|
|
64
|
+
* Override email address
|
|
65
|
+
*/
|
|
66
|
+
e?: Maybe<EmailAddress>;
|
|
67
|
+
/**
|
|
68
|
+
* Override phone number
|
|
69
|
+
*/
|
|
70
|
+
t?: Maybe<E164PhoneNumber>;
|
|
71
|
+
/**
|
|
72
|
+
* Notification summary id
|
|
73
|
+
*/
|
|
74
|
+
s?: Maybe<NotificationSummaryId>;
|
|
75
|
+
/**
|
|
76
|
+
* Array of configs
|
|
77
|
+
*/
|
|
78
|
+
configs?: Maybe<NotificationBoxRecipientTemplateConfigArrayEntryParam[]>;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Used for updating the target NotificationUserNotificationBoxRecipientConfig.
|
|
82
|
+
*/
|
|
83
|
+
export declare class UpdateNotificationUserNotificationBoxRecipientParams extends UpdateNotificationBoxRecipientLikeParams {
|
|
84
|
+
/**
|
|
85
|
+
* NotificationBox config to update
|
|
86
|
+
*/
|
|
87
|
+
nb: NotificationBoxId;
|
|
88
|
+
rm?: Maybe<boolean>;
|
|
89
|
+
lk?: Maybe<boolean>;
|
|
90
|
+
bk?: Maybe<boolean>;
|
|
91
|
+
f?: Maybe<NotificationBoxRecipientFlag>;
|
|
92
|
+
/**
|
|
93
|
+
* Whether or not to delete this configuration entirely.
|
|
94
|
+
*
|
|
95
|
+
* Will only delete if rm is true and ns is false. Is ignored otherwise.
|
|
96
|
+
*/
|
|
97
|
+
deleteRemovedConfig?: Maybe<boolean>;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Used for updating the NotificationUser.
|
|
101
|
+
*/
|
|
102
|
+
export declare class UpdateNotificationUserParams extends TargetModelParams {
|
|
103
|
+
gc?: Maybe<UpdateNotificationUserDefaultNotificationBoxRecipientConfigParams>;
|
|
104
|
+
dc?: Maybe<UpdateNotificationUserDefaultNotificationBoxRecipientConfigParams>;
|
|
105
|
+
bc?: Maybe<UpdateNotificationUserNotificationBoxRecipientParams[]>;
|
|
106
|
+
}
|
|
107
|
+
export declare class ResyncNotificationUserParams extends TargetModelParams {
|
|
108
|
+
}
|
|
109
|
+
export interface ResyncNotificationUserResult {
|
|
110
|
+
/**
|
|
111
|
+
* Total number of notification boxes updated.
|
|
112
|
+
*/
|
|
113
|
+
readonly notificationBoxesUpdated: number;
|
|
114
|
+
}
|
|
115
|
+
export declare class ResyncAllNotificationUserParams {
|
|
116
|
+
}
|
|
117
|
+
export interface ResyncAllNotificationUsersResult extends ResyncNotificationUserResult {
|
|
118
|
+
/**
|
|
119
|
+
* Total number of users updated.
|
|
120
|
+
*/
|
|
121
|
+
readonly notificationUsersResynced: number;
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Used for creating a new NotificationSummary for a model.
|
|
125
|
+
*/
|
|
126
|
+
export declare class CreateNotificationSummaryParams {
|
|
127
|
+
/**
|
|
128
|
+
* Model to create the NotificationSummary for.
|
|
129
|
+
*/
|
|
130
|
+
model: FirestoreModelKey;
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Used for updating the NotificationSummary.
|
|
134
|
+
*/
|
|
135
|
+
export declare class UpdateNotificationSummaryParams extends TargetModelParams {
|
|
136
|
+
/**
|
|
137
|
+
* Updates the "rat" time to now.
|
|
138
|
+
*/
|
|
139
|
+
readonly flagAllRead?: Maybe<boolean>;
|
|
140
|
+
/**
|
|
141
|
+
* Sets the "rat" time to the given date, or clears it.
|
|
142
|
+
*/
|
|
143
|
+
readonly setReadAtTime?: Maybe<Date>;
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Used for creating or initializing a new NotificationBox for a model.
|
|
147
|
+
*
|
|
148
|
+
* Mainly used for testing. Not exposed to the API.
|
|
149
|
+
*
|
|
150
|
+
* The preferred way is to create a NotificationBox through a Notification.
|
|
151
|
+
*/
|
|
152
|
+
export declare class CreateNotificationBoxParams {
|
|
153
|
+
model: FirestoreModelKey;
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Used for initializing an uninitialized model like NotificationBox or NotificationSummary.
|
|
157
|
+
*/
|
|
158
|
+
export declare class InitializeNotificationModelParams extends TargetModelParams {
|
|
159
|
+
/**
|
|
160
|
+
* Whether or not to throw an error if the notification has already been sent or is being sent.
|
|
161
|
+
*/
|
|
162
|
+
throwErrorIfAlreadyInitialized?: boolean;
|
|
163
|
+
}
|
|
164
|
+
export declare class InitializeAllApplicableNotificationBoxesParams {
|
|
165
|
+
}
|
|
166
|
+
export interface InitializeAllApplicableNotificationBoxesResult {
|
|
167
|
+
readonly notificationBoxesVisited: number;
|
|
168
|
+
readonly notificationBoxesSucceeded: number;
|
|
169
|
+
readonly notificationBoxesFailed: number;
|
|
170
|
+
readonly notificationBoxesAlreadyInitialized: number;
|
|
171
|
+
}
|
|
172
|
+
export declare class InitializeAllApplicableNotificationSummariesParams {
|
|
173
|
+
}
|
|
174
|
+
export interface InitializeAllApplicableNotificationSummariesResult {
|
|
175
|
+
readonly notificationSummariesVisited: number;
|
|
176
|
+
readonly notificationSummariesSucceeded: number;
|
|
177
|
+
readonly notificationSummariesFailed: number;
|
|
178
|
+
readonly notificationSummariesAlreadyInitialized: number;
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* Used for updating the NotificationBox.
|
|
182
|
+
*/
|
|
183
|
+
export declare class UpdateNotificationBoxParams extends TargetModelParams {
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* Used to create/update a notification box recipient.
|
|
187
|
+
*/
|
|
188
|
+
export declare class UpdateNotificationBoxRecipientParams extends UpdateNotificationBoxRecipientLikeParams implements TargetModelParams {
|
|
189
|
+
/**
|
|
190
|
+
* NotificationBox key to update.
|
|
191
|
+
*/
|
|
192
|
+
key: FirestoreModelKey;
|
|
193
|
+
/**
|
|
194
|
+
* NotificationBox recipient to update. Is ignored if UID is provided and matches a user. Used for external recipients/users.
|
|
195
|
+
*/
|
|
196
|
+
i?: Maybe<IndexNumber>;
|
|
197
|
+
/**
|
|
198
|
+
* Notification recipient to update by UID, if applicable.
|
|
199
|
+
*/
|
|
200
|
+
uid?: Maybe<FirebaseAuthUserId>;
|
|
201
|
+
/**
|
|
202
|
+
* Whether or not to insert the user if they currently do not exist. Defaults to false.
|
|
203
|
+
*/
|
|
204
|
+
insert?: Maybe<boolean>;
|
|
205
|
+
/**
|
|
206
|
+
* Whether or not to enable/disable the recipient from recieving items from this box.
|
|
207
|
+
*/
|
|
208
|
+
enabled?: Maybe<boolean>;
|
|
209
|
+
/**
|
|
210
|
+
* Whether or not to remove the user if they exist. Defaults to false.
|
|
211
|
+
*/
|
|
212
|
+
remove?: Maybe<boolean>;
|
|
213
|
+
}
|
|
214
|
+
export declare class NotificationRecipientParams {
|
|
215
|
+
/**
|
|
216
|
+
* User to send the notification to.
|
|
217
|
+
*/
|
|
218
|
+
uid?: Maybe<FirebaseAuthUserId>;
|
|
219
|
+
/**
|
|
220
|
+
* Recipient Name
|
|
221
|
+
*/
|
|
222
|
+
un?: Maybe<string>;
|
|
223
|
+
/**
|
|
224
|
+
* Email address
|
|
225
|
+
*/
|
|
226
|
+
e?: Maybe<EmailAddress>;
|
|
227
|
+
/**
|
|
228
|
+
* Phone number
|
|
229
|
+
*/
|
|
230
|
+
p?: Maybe<E164PhoneNumber>;
|
|
231
|
+
}
|
|
232
|
+
/**
|
|
233
|
+
* Used for sending the notification immediately, if it has not already been sent.
|
|
234
|
+
*/
|
|
235
|
+
export declare class SendNotificationParams extends TargetModelParams {
|
|
236
|
+
/**
|
|
237
|
+
* Whether or not to ignore the send at time. Defaults to false.
|
|
238
|
+
*/
|
|
239
|
+
ignoreSendAtThrottle?: Maybe<boolean>;
|
|
240
|
+
/**
|
|
241
|
+
* Whether or not to throw an error if the notification has already been sent or is being sent.
|
|
242
|
+
*/
|
|
243
|
+
throwErrorIfSent?: Maybe<boolean>;
|
|
244
|
+
}
|
|
245
|
+
export interface SendNotificationResult {
|
|
246
|
+
/**
|
|
247
|
+
* Attempted notification type
|
|
248
|
+
*/
|
|
249
|
+
readonly notificationTemplateType: Maybe<NotificationTemplateType>;
|
|
250
|
+
/**
|
|
251
|
+
* Whether or not the notification was of a known type.
|
|
252
|
+
*/
|
|
253
|
+
readonly isKnownTemplateType: Maybe<boolean>;
|
|
254
|
+
/**
|
|
255
|
+
* Whether or not the notification was of a configured type.
|
|
256
|
+
*/
|
|
257
|
+
readonly isConfiguredTemplateType: Maybe<boolean>;
|
|
258
|
+
/**
|
|
259
|
+
* Whether or not the try was aborted due to being throttled.
|
|
260
|
+
*/
|
|
261
|
+
readonly throttled: boolean;
|
|
262
|
+
/**
|
|
263
|
+
* Whether or not the run was successful.
|
|
264
|
+
*
|
|
265
|
+
* In cases where the Notification is set to SEND_IF_BOX_EXISTS and the box does not exist, this will return true.
|
|
266
|
+
*/
|
|
267
|
+
readonly success: boolean;
|
|
268
|
+
/**
|
|
269
|
+
* Whether or not the notification was marked as done.
|
|
270
|
+
*
|
|
271
|
+
* May occur in cases where success is false, but the notification reached the max number of send attempts.
|
|
272
|
+
*/
|
|
273
|
+
readonly notificationMarkedDone: boolean;
|
|
274
|
+
/**
|
|
275
|
+
* Whether or not the NotificationBox was created.
|
|
276
|
+
*/
|
|
277
|
+
readonly createdBox: boolean;
|
|
278
|
+
/**
|
|
279
|
+
* Whether or not the NotificationBox exists but still needs initialization.
|
|
280
|
+
*/
|
|
281
|
+
readonly notificationBoxNeedsInitialization: boolean;
|
|
282
|
+
/**
|
|
283
|
+
* Whether or not the notification was deleted.
|
|
284
|
+
*
|
|
285
|
+
* This typically only occurs when SEND_IF_BOX_EXISTS is set and the box does not exist.
|
|
286
|
+
*/
|
|
287
|
+
readonly deletedNotification: boolean;
|
|
288
|
+
readonly exists: boolean;
|
|
289
|
+
readonly boxExists: boolean;
|
|
290
|
+
readonly tryRun: boolean;
|
|
291
|
+
/**
|
|
292
|
+
* Send emails result.
|
|
293
|
+
*
|
|
294
|
+
* Undefined if not attempted.
|
|
295
|
+
*/
|
|
296
|
+
readonly sendEmailsResult: Maybe<NotificationSendEmailMessagesResult>;
|
|
297
|
+
/**
|
|
298
|
+
*
|
|
299
|
+
* Send texts result.
|
|
300
|
+
*
|
|
301
|
+
* Undefined if not attempted.
|
|
302
|
+
*/
|
|
303
|
+
readonly sendTextsResult: Maybe<NotificationSendTextMessagesResult>;
|
|
304
|
+
/**
|
|
305
|
+
* Send notification summaries result.
|
|
306
|
+
*
|
|
307
|
+
* Undefined if not attempted.
|
|
308
|
+
*/
|
|
309
|
+
readonly sendNotificationSummaryResult: Maybe<NotificationSendNotificationSummaryMessagesResult>;
|
|
310
|
+
/**
|
|
311
|
+
* Failed while attempting to loada the proper message function
|
|
312
|
+
*/
|
|
313
|
+
readonly loadMessageFunctionFailure: boolean;
|
|
314
|
+
/**
|
|
315
|
+
* Failed while attempting to build a message
|
|
316
|
+
*/
|
|
317
|
+
readonly buildMessageFailure: boolean;
|
|
318
|
+
}
|
|
319
|
+
/**
|
|
320
|
+
* Used for sending queued notifications in the system.
|
|
321
|
+
*/
|
|
322
|
+
export declare class SendQueuedNotificationsParams {
|
|
323
|
+
}
|
|
324
|
+
export interface SendQueuedNotificationsResult extends Omit<SendNotificationResult, 'throttled' | 'isConfiguredTemplateType' | 'isKnownTemplateType' | 'notificationTemplateType' | 'notificationMarkedDone' | 'deletedNotification' | 'createdBox' | 'success' | 'exists' | 'boxExists' | 'notificationBoxNeedsInitialization' | 'tryRun' | 'loadMessageFunctionFailure' | 'buildMessageFailure'> {
|
|
325
|
+
readonly notificationBoxesCreated: number;
|
|
326
|
+
readonly notificationsVisited: number;
|
|
327
|
+
readonly notificationsSucceeded: number;
|
|
328
|
+
readonly notificationsDelayed: number;
|
|
329
|
+
readonly notificationsFailed: number;
|
|
330
|
+
readonly notificationsDeleted: number;
|
|
331
|
+
}
|
|
332
|
+
/**
|
|
333
|
+
* Used for sending queued notifications in the system.
|
|
334
|
+
*/
|
|
335
|
+
export declare class CleanupSentNotificationsParams {
|
|
336
|
+
}
|
|
337
|
+
export interface CleanupSentNotificationsResult {
|
|
338
|
+
/**
|
|
339
|
+
* Number of total updates. May include the same notification box more than once.
|
|
340
|
+
*/
|
|
341
|
+
readonly notificationBoxesUpdatesCount: number;
|
|
342
|
+
readonly notificationsDeleted: number;
|
|
343
|
+
readonly notificationWeeksCreated: number;
|
|
344
|
+
readonly notificationWeeksUpdated: number;
|
|
345
|
+
}
|
|
346
|
+
export type NotificationFunctionTypeMap = {};
|
|
347
|
+
export declare const notificationFunctionTypeConfigMap: FirebaseFunctionTypeConfigMap<NotificationFunctionTypeMap>;
|
|
348
|
+
export type NotificationBoxModelCrudFunctionsConfig = {
|
|
349
|
+
readonly notificationUser: {
|
|
350
|
+
update: {
|
|
351
|
+
_: UpdateNotificationUserParams;
|
|
352
|
+
resync: [ResyncNotificationUserParams, ResyncNotificationUserResult];
|
|
353
|
+
};
|
|
354
|
+
};
|
|
355
|
+
readonly notificationSummary: {
|
|
356
|
+
update: {
|
|
357
|
+
_: UpdateNotificationSummaryParams;
|
|
358
|
+
};
|
|
359
|
+
};
|
|
360
|
+
readonly notificationBox: {
|
|
361
|
+
update: {
|
|
362
|
+
_: UpdateNotificationBoxParams;
|
|
363
|
+
recipient: UpdateNotificationBoxRecipientParams;
|
|
364
|
+
};
|
|
365
|
+
};
|
|
366
|
+
readonly notification: null;
|
|
367
|
+
readonly notificationWeek: null;
|
|
368
|
+
};
|
|
369
|
+
export declare const notificationBoxModelCrudFunctionsConfig: ModelFirebaseCrudFunctionConfigMap<NotificationBoxModelCrudFunctionsConfig, NotificationTypes>;
|
|
370
|
+
export declare abstract class NotificationFunctions implements ModelFirebaseFunctionMap<NotificationFunctionTypeMap, NotificationBoxModelCrudFunctionsConfig> {
|
|
371
|
+
abstract notificationUser: {
|
|
372
|
+
updateNotificationUser: {
|
|
373
|
+
update: ModelFirebaseCrudFunction<UpdateNotificationUserParams>;
|
|
374
|
+
resync: ModelFirebaseCrudFunction<ResyncNotificationUserParams, ResyncNotificationUserResult>;
|
|
375
|
+
};
|
|
376
|
+
};
|
|
377
|
+
abstract notificationSummary: {
|
|
378
|
+
updateNotificationSummary: {
|
|
379
|
+
update: ModelFirebaseCrudFunction<UpdateNotificationSummaryParams>;
|
|
380
|
+
};
|
|
381
|
+
};
|
|
382
|
+
abstract notificationBox: {
|
|
383
|
+
updateNotificationBox: {
|
|
384
|
+
update: ModelFirebaseCrudFunction<UpdateNotificationBoxParams>;
|
|
385
|
+
recipient: ModelFirebaseCrudFunction<UpdateNotificationBoxRecipientParams>;
|
|
386
|
+
};
|
|
387
|
+
};
|
|
388
|
+
}
|
|
389
|
+
export declare const notificationFunctionMap: import("../../client").ModelFirebaseFunctionMapFactory<NotificationFunctionTypeMap, NotificationBoxModelCrudFunctionsConfig>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare const CREATE_NOTIFICATION_ID_REQUIRED_ERROR_CODE = "CREATE_NOTIFICATION_ID_REQUIRED";
|
|
2
|
+
export declare const NOTIFICATION_MODEL_ALREADY_INITIALIZED_ERROR_CODE = "NOTIFICATION_MODEL_ALREADY_INITIALIZED";
|
|
3
|
+
export declare const NOTIFICATION_BOX_EXISTS_FOR_MODEL_ERROR_CODE = "NOTIFICATION_BOX_EXISTS_FOR_MODEL";
|
|
4
|
+
export declare const NOTIFICATION_BOX_RECIPIENT_DOES_NOT_EXIST_ERROR_CODE = "NOTIFICATION_BOX_RECIPIENT_DOES_NOT_EXIST";
|
|
5
|
+
export declare const NOTIFICATION_USER_INVALID_UID_FOR_CREATE_ERROR_CODE = "NOTIFICATION_USER_INVALID_UID_FOR_CREATE";
|
|
6
|
+
export declare const NOTIFICATION_USER_BLOCKED_FROM_BEING_ADD_TO_RECIPIENTS_ERROR_CODE = "NOTIFICATION_USER_BLOCKED_FROM_BEING_ADD_TO_RECIPIENTS";
|
|
7
|
+
export declare const NOTIFICATION_USER_LOCKED_CONFIG_FROM_BEING_UPDATED_ERROR_CODE = "NOTIFICATION_USER_LOCKED_CONFIG_FROM_BEING_UPDATED";
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { type Maybe } from '@dereekb/util';
|
|
2
|
+
import { type NotificationBoxRecipientTemplateConfigRecord, type NotificationUserDefaultNotificationBoxRecipientConfig, type NotificationUserNotificationBoxRecipientConfig } from './notification.config';
|
|
3
|
+
import { type NotificationBoxRecipientTemplateConfigArrayEntryParam, type UpdateNotificationUserDefaultNotificationBoxRecipientConfigParams, type UpdateNotificationUserNotificationBoxRecipientParams } from './notification.api';
|
|
4
|
+
import { type AppNotificationTemplateTypeInfoRecordService } from './notification.details';
|
|
5
|
+
import { type NotificationTemplateType } from './notification.id';
|
|
6
|
+
/**
|
|
7
|
+
* Updates a NotificationUserDefaultNotificationBoxRecipientConfig with the input UpdateNotificationUserDefaultNotificationBoxRecipientConfigParams.
|
|
8
|
+
*
|
|
9
|
+
* @param a
|
|
10
|
+
* @param b
|
|
11
|
+
* @returns
|
|
12
|
+
*/
|
|
13
|
+
export declare function updateNotificationBoxRecipientTemplateConfigRecord(a: NotificationBoxRecipientTemplateConfigRecord, b: NotificationBoxRecipientTemplateConfigArrayEntryParam[], limitToAllowedConfigTypes?: Maybe<Iterable<NotificationTemplateType>>): NotificationBoxRecipientTemplateConfigRecord | undefined;
|
|
14
|
+
/**
|
|
15
|
+
* Updates a NotificationUserDefaultNotificationBoxRecipientConfig with the input UpdateNotificationUserDefaultNotificationBoxRecipientConfigParams.
|
|
16
|
+
*
|
|
17
|
+
* @param a
|
|
18
|
+
* @param b
|
|
19
|
+
* @returns
|
|
20
|
+
*/
|
|
21
|
+
export declare function updateNotificationUserDefaultNotificationBoxRecipientConfig(a: NotificationUserDefaultNotificationBoxRecipientConfig, b: UpdateNotificationUserDefaultNotificationBoxRecipientConfigParams, limitToAllowedConfigTypes?: Maybe<Iterable<NotificationTemplateType>>): NotificationUserDefaultNotificationBoxRecipientConfig;
|
|
22
|
+
export declare function updateNotificationUserNotificationBoxRecipientConfigIfChanged(a: NotificationUserNotificationBoxRecipientConfig, b: UpdateNotificationUserNotificationBoxRecipientParams, limitToAllowedConfigTypes?: Maybe<Iterable<NotificationTemplateType>>): NotificationUserNotificationBoxRecipientConfig | undefined;
|
|
23
|
+
/**
|
|
24
|
+
* Updates the target NotificationUserNotificationBoxRecipientConfig array with the input UpdateNotificationUserNotificationBoxRecipientParams.
|
|
25
|
+
*
|
|
26
|
+
* If the target NotificationBox does not exist in the config, it is ignored.
|
|
27
|
+
*
|
|
28
|
+
* @param a
|
|
29
|
+
* @param b
|
|
30
|
+
*/
|
|
31
|
+
export declare function updateNotificationUserNotificationBoxRecipientConfigs(a: NotificationUserNotificationBoxRecipientConfig[], b: UpdateNotificationUserNotificationBoxRecipientParams[], filterWithService?: AppNotificationTemplateTypeInfoRecordService): NotificationUserNotificationBoxRecipientConfig[] | undefined;
|