@dereekb/firebase-server 11.0.21 → 11.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/mailgun/package.json +1 -1
  3. package/model/package.json +6 -0
  4. package/model/src/index.d.ts +1 -0
  5. package/model/src/index.js +5 -0
  6. package/model/src/index.js.map +1 -0
  7. package/model/src/lib/index.d.ts +2 -0
  8. package/model/src/lib/index.js +6 -0
  9. package/model/src/lib/index.js.map +1 -0
  10. package/model/src/lib/mailgun/index.d.ts +1 -0
  11. package/model/src/lib/mailgun/index.js +5 -0
  12. package/model/src/lib/mailgun/index.js.map +1 -0
  13. package/model/src/lib/mailgun/notification.send.service.mailgun.d.ts +51 -0
  14. package/model/src/lib/mailgun/notification.send.service.mailgun.js +67 -0
  15. package/model/src/lib/mailgun/notification.send.service.mailgun.js.map +1 -0
  16. package/model/src/lib/notification/index.d.ts +11 -0
  17. package/model/src/lib/notification/index.js +15 -0
  18. package/model/src/lib/notification/index.js.map +1 -0
  19. package/model/src/lib/notification/notification.action.init.server.d.ts +72 -0
  20. package/model/src/lib/notification/notification.action.init.server.js +228 -0
  21. package/model/src/lib/notification/notification.action.init.server.js.map +1 -0
  22. package/model/src/lib/notification/notification.action.server.d.ts +70 -0
  23. package/model/src/lib/notification/notification.action.server.js +1049 -0
  24. package/model/src/lib/notification/notification.action.server.js.map +1 -0
  25. package/model/src/lib/notification/notification.config.d.ts +31 -0
  26. package/model/src/lib/notification/notification.config.js +13 -0
  27. package/model/src/lib/notification/notification.config.js.map +1 -0
  28. package/model/src/lib/notification/notification.config.service.d.ts +49 -0
  29. package/model/src/lib/notification/notification.config.service.js +59 -0
  30. package/model/src/lib/notification/notification.config.service.js.map +1 -0
  31. package/model/src/lib/notification/notification.error.d.ts +9 -0
  32. package/model/src/lib/notification/notification.error.js +74 -0
  33. package/model/src/lib/notification/notification.error.js.map +1 -0
  34. package/model/src/lib/notification/notification.module.d.ts +49 -0
  35. package/model/src/lib/notification/notification.module.js +69 -0
  36. package/model/src/lib/notification/notification.module.js.map +1 -0
  37. package/model/src/lib/notification/notification.send.d.ts +4 -0
  38. package/model/src/lib/notification/notification.send.js +3 -0
  39. package/model/src/lib/notification/notification.send.js.map +1 -0
  40. package/model/src/lib/notification/notification.send.service.d.ts +65 -0
  41. package/model/src/lib/notification/notification.send.service.js +10 -0
  42. package/model/src/lib/notification/notification.send.service.js.map +1 -0
  43. package/model/src/lib/notification/notification.send.service.notificationsummary.d.ts +18 -0
  44. package/model/src/lib/notification/notification.send.service.notificationsummary.js +105 -0
  45. package/model/src/lib/notification/notification.send.service.notificationsummary.js.map +1 -0
  46. package/model/src/lib/notification/notification.send.service.text.d.ts +9 -0
  47. package/model/src/lib/notification/notification.send.service.text.js +30 -0
  48. package/model/src/lib/notification/notification.send.service.text.js.map +1 -0
  49. package/model/src/lib/notification/notification.util.d.ts +128 -0
  50. package/model/src/lib/notification/notification.util.js +465 -0
  51. package/model/src/lib/notification/notification.util.js.map +1 -0
  52. package/package.json +7 -1
  53. package/test/package.json +1 -1
  54. package/zoho/package.json +1 -1
@@ -0,0 +1,465 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.updateNotificationUserNotificationBoxRecipientConfig = exports.expandNotificationRecipients = exports.makeNewNotificationSummaryTemplate = void 0;
4
+ const firebase_1 = require("@dereekb/firebase");
5
+ const util_1 = require("@dereekb/util");
6
+ const notification_error_1 = require("./notification.error");
7
+ // MARK: Create NotificationSummary
8
+ function makeNewNotificationSummaryTemplate(model) {
9
+ return {
10
+ cat: new Date(),
11
+ m: model,
12
+ o: (0, firebase_1.firestoreDummyKey)(),
13
+ s: true,
14
+ n: []
15
+ };
16
+ }
17
+ exports.makeNewNotificationSummaryTemplate = makeNewNotificationSummaryTemplate;
18
+ /**
19
+ * "Expands" the input into recipients for emails, texts, etc.
20
+ *
21
+ * Recipients may come from the NotificationBox, Notification or from the global recipients.
22
+ *
23
+ * Recipients are each configurable and may be defined with as little info as a single contact info, or have multiple contact info pieces associated with them.
24
+ *
25
+ * @param input
26
+ * @returns
27
+ */
28
+ async function expandNotificationRecipients(input) {
29
+ const { notificationUserAccessor, authService, notification, notificationBox, globalRecipients: inputGlobalRecipients, recipientFlagOverride, notificationSummaryIdForUid: inputNotificationSummaryIdForUid, onlyTextExplicitlyEnabledRecipients: inputOnlyTextExplicitlyEnabledRecipients } = input;
30
+ const notificationSummaryIdForUid = inputNotificationSummaryIdForUid ?? (() => undefined);
31
+ const notificationTemplateType = notification.n.t || firebase_1.DEFAULT_NOTIFICATION_TEMPLATE_TYPE;
32
+ const recipientFlag = recipientFlagOverride ?? notification.rf ?? firebase_1.NotificationRecipientSendFlag.NORMAL;
33
+ const onlyTextExplicitlyEnabledRecipients = inputOnlyTextExplicitlyEnabledRecipients !== false;
34
+ const { canSendToGlobalRecipients, canSendToBoxRecipients, canSendToExplicitRecipients } = (0, firebase_1.allowedNotificationRecipients)(recipientFlag);
35
+ const initialExplicitRecipients = canSendToExplicitRecipients ? notification.r : [];
36
+ const initialGlobalRecipients = canSendToGlobalRecipients && inputGlobalRecipients ? inputGlobalRecipients : [];
37
+ const explicitRecipients = initialExplicitRecipients.map((x) => ({
38
+ ...x,
39
+ ...(0, firebase_1.effectiveNotificationBoxRecipientTemplateConfig)(x)
40
+ }));
41
+ const globalRecipients = initialGlobalRecipients.map((x) => ({
42
+ ...x,
43
+ ...(0, firebase_1.effectiveNotificationBoxRecipientTemplateConfig)(x)
44
+ }));
45
+ const explicitAndGlobalRecipients = [...explicitRecipients, ...globalRecipients];
46
+ const allBoxRecipientConfigs = canSendToBoxRecipients && notificationBox ? notificationBox.r : [];
47
+ const recipientUids = new Set();
48
+ const relevantBoxRecipientConfigs = [];
49
+ // find all recipients in the NotificationBox with the target template type flagged for them.
50
+ allBoxRecipientConfigs.forEach((x) => {
51
+ // ignore opt-out flagged recipients
52
+ if (!x.f) {
53
+ const relevantConfig = x.c[notificationTemplateType];
54
+ const effectiveTemplateConfig = relevantConfig ? (0, firebase_1.effectiveNotificationBoxRecipientTemplateConfig)(relevantConfig) : undefined;
55
+ if (!effectiveTemplateConfig || effectiveTemplateConfig.st || effectiveTemplateConfig.se || effectiveTemplateConfig.sp || effectiveTemplateConfig.st) {
56
+ relevantBoxRecipientConfigs.push({
57
+ recipient: x,
58
+ effectiveTemplateConfig
59
+ });
60
+ if (x.uid) {
61
+ recipientUids.add(x.uid);
62
+ }
63
+ }
64
+ }
65
+ });
66
+ // add other recipients to the map
67
+ const nonNotificationBoxUidRecipientConfigs = new Map();
68
+ explicitAndGlobalRecipients.forEach((x) => {
69
+ const { uid } = x;
70
+ if (uid && !recipientUids.has(uid)) {
71
+ // if already in recipientUids then they are a box recipient and we don't have to try and load them.
72
+ nonNotificationBoxUidRecipientConfigs.set(uid, x);
73
+ }
74
+ });
75
+ const otherNotificationUserUidOptOuts = new Set();
76
+ const notificationUserRecipientConfigs = new Map();
77
+ if (nonNotificationBoxUidRecipientConfigs.size > 0) {
78
+ const nonNotificationBoxRecipientUids = Array.from(nonNotificationBoxUidRecipientConfigs.keys());
79
+ const notificationUserDocuments = (0, firebase_1.loadDocumentsForIds)(notificationUserAccessor, nonNotificationBoxRecipientUids);
80
+ // Attempt to load the NotificationUser for each uid.
81
+ // Not guranteed to exist, but those that do we want to their configurations to decide opt-in/opt-out, as well as override the input recipient configuration for the Notification.
82
+ const notificationUsers = await (0, firebase_1.getDocumentSnapshotDataPairsWithData)(notificationUserDocuments);
83
+ notificationUsers.forEach((x) => {
84
+ const { data: notificationUser } = x;
85
+ const { dc, gc } = notificationUser;
86
+ const effectiveConfig = (0, firebase_1.mergeNotificationUserDefaultNotificationBoxRecipientConfig)(dc, gc);
87
+ const uid = x.document.id;
88
+ notificationUserRecipientConfigs.set(uid, effectiveConfig);
89
+ if (effectiveConfig.f) {
90
+ // if flagged for opt out, add to set
91
+ otherNotificationUserUidOptOuts.add(uid);
92
+ }
93
+ });
94
+ }
95
+ /**
96
+ * Other NotificationRecipientWithConfig
97
+ */
98
+ const otherRecipientConfigs = new Map();
99
+ const explicitOtherRecipientEmailAddresses = new Map();
100
+ const explicitOtherRecipientTextNumbers = new Map();
101
+ const explicitOtherRecipientNotificationSummaryIds = new Map();
102
+ explicitAndGlobalRecipients.forEach((x) => {
103
+ const uid = x.uid;
104
+ if (uid) {
105
+ if (otherNotificationUserUidOptOuts.has(uid)) {
106
+ return; // do not add to the recipients at all, user has opted out
107
+ }
108
+ const notificationUserRecipientConfig = notificationUserRecipientConfigs.get(uid);
109
+ if (notificationUserRecipientConfig != null) {
110
+ const userTemplateTypeConfig = notificationUserRecipientConfig.c[notificationTemplateType] ?? {};
111
+ const templateConfig = (0, firebase_1.mergeNotificationBoxRecipientTemplateConfigs)((0, firebase_1.effectiveNotificationBoxRecipientTemplateConfig)(userTemplateTypeConfig), x);
112
+ // replace the input NotificationRecipientWithConfig with the user's config
113
+ x = {
114
+ ...notificationUserRecipientConfig,
115
+ ...(0, firebase_1.effectiveNotificationBoxRecipientTemplateConfig)(templateConfig),
116
+ uid
117
+ };
118
+ }
119
+ recipientUids.add(uid);
120
+ otherRecipientConfigs.set(uid, x);
121
+ }
122
+ if (x.e) {
123
+ explicitOtherRecipientEmailAddresses.set(x.e.toLowerCase(), x);
124
+ }
125
+ if (x.t) {
126
+ explicitOtherRecipientTextNumbers.set(x.t, x);
127
+ }
128
+ if (x.s) {
129
+ explicitOtherRecipientNotificationSummaryIds.set(x.s, x);
130
+ }
131
+ });
132
+ // load user details from auth service
133
+ const allUserDetails = await Promise.all(Array.from(recipientUids).map((uid) => authService
134
+ .userContext(uid)
135
+ .loadDetails()
136
+ .then((details) => [uid, details])
137
+ .catch(() => [uid, undefined])));
138
+ const userDetailsMap = new Map(allUserDetails);
139
+ const _internal = {
140
+ userDetailsMap,
141
+ explicitRecipients,
142
+ globalRecipients,
143
+ allBoxRecipientConfigs,
144
+ relevantBoxRecipientConfigs,
145
+ recipientUids,
146
+ otherRecipientConfigs,
147
+ explicitOtherRecipientEmailAddresses,
148
+ explicitOtherRecipientTextNumbers,
149
+ explicitOtherRecipientNotificationSummaryIds,
150
+ otherNotificationUserUidOptOuts,
151
+ nonNotificationBoxUidRecipientConfigs,
152
+ notificationUserRecipientConfigs
153
+ };
154
+ // make all email recipients
155
+ const emails = [];
156
+ const emailUidsSet = new Set();
157
+ // start with all box recipients
158
+ relevantBoxRecipientConfigs.forEach((x) => {
159
+ const { recipient } = x;
160
+ const { uid, e: overrideRecipientEmail, n: overrideRecipientName } = recipient;
161
+ const userDetails = uid ? userDetailsMap.get(uid) : undefined;
162
+ const otherRecipientForUser = uid ? otherRecipientConfigs.get(uid) : undefined;
163
+ // don't send an email if marked false
164
+ if (x.effectiveTemplateConfig?.se !== false && !emailUidsSet.has(uid ?? '')) {
165
+ const e = overrideRecipientEmail ?? userDetails?.email; // use override email or the default email
166
+ if (e) {
167
+ const n = overrideRecipientName ?? userDetails?.displayName;
168
+ const emailAddress = e.toLowerCase();
169
+ explicitOtherRecipientEmailAddresses.delete(emailAddress); // don't double-send to the same email
170
+ const emailRecipient = {
171
+ emailAddress,
172
+ name: n,
173
+ boxRecipient: x,
174
+ otherRecipient: otherRecipientForUser
175
+ };
176
+ emails.push(emailRecipient);
177
+ if (uid) {
178
+ emailUidsSet.add(uid);
179
+ }
180
+ }
181
+ }
182
+ });
183
+ otherRecipientConfigs.forEach((x, uid) => {
184
+ // add users who existing in the system at this step, then other recipients in the next step
185
+ const userDetails = userDetailsMap.get(uid);
186
+ if (userDetails) {
187
+ const { email: userEmailAddress, displayName } = userDetails;
188
+ const sendEmail = x.se !== false;
189
+ if (userEmailAddress && sendEmail && !emailUidsSet.has(uid)) {
190
+ const emailAddress = userEmailAddress.toLowerCase();
191
+ const name = displayName || x.n;
192
+ const emailRecipient = {
193
+ emailAddress,
194
+ name,
195
+ otherRecipient: x
196
+ };
197
+ emails.push(emailRecipient);
198
+ emailUidsSet.add(uid);
199
+ explicitOtherRecipientEmailAddresses.delete(emailAddress);
200
+ }
201
+ }
202
+ });
203
+ explicitOtherRecipientEmailAddresses.forEach((x, emailAddress) => {
204
+ const sendEmail = x.se !== false;
205
+ if (sendEmail) {
206
+ const emailRecipient = {
207
+ emailAddress: emailAddress,
208
+ name: x.n,
209
+ otherRecipient: x
210
+ };
211
+ emails.push(emailRecipient);
212
+ }
213
+ });
214
+ // make all text recipients
215
+ // text recipients should be explicitly enabled, or marked true
216
+ const texts = [];
217
+ const textUidsSet = new Set();
218
+ relevantBoxRecipientConfigs.forEach((x) => {
219
+ const { recipient } = x;
220
+ const { uid } = recipient;
221
+ const sendTextEnabled = x.effectiveTemplateConfig?.st;
222
+ const userDetails = uid ? userDetailsMap.get(uid) : undefined;
223
+ const otherRecipientForUser = uid ? otherRecipientConfigs.get(uid) : undefined;
224
+ // only send a text if explicitly enabled
225
+ const shouldSendText = (onlyTextExplicitlyEnabledRecipients && sendTextEnabled === true) || (!onlyTextExplicitlyEnabledRecipients && sendTextEnabled !== false);
226
+ if (shouldSendText && !textUidsSet.has(uid ?? '')) {
227
+ const t = x.recipient.t ?? userDetails?.phoneNumber; // use override phoneNumber or the default phone
228
+ if (t) {
229
+ const name = userDetails?.displayName ?? x.recipient.n;
230
+ const phoneNumber = t;
231
+ explicitOtherRecipientTextNumbers.delete(phoneNumber); // don't double-send to the same text phone number
232
+ const textRecipient = {
233
+ phoneNumber,
234
+ name,
235
+ boxRecipient: x,
236
+ otherRecipient: otherRecipientForUser
237
+ };
238
+ texts.push(textRecipient);
239
+ if (uid) {
240
+ textUidsSet.add(uid);
241
+ }
242
+ }
243
+ }
244
+ });
245
+ otherRecipientConfigs.forEach((x, uid) => {
246
+ // add users who existing in the system at this step, then other recipients in the next step
247
+ const userDetails = userDetailsMap.get(uid);
248
+ if (userDetails) {
249
+ const { phoneNumber, displayName } = userDetails;
250
+ const sendTextEnabled = x.st;
251
+ const sendText = (onlyTextExplicitlyEnabledRecipients && sendTextEnabled === true) || (!onlyTextExplicitlyEnabledRecipients && sendTextEnabled !== false);
252
+ if (phoneNumber != null && sendText && !textUidsSet.has(uid)) {
253
+ const name = displayName || x.n;
254
+ const textRecipient = {
255
+ phoneNumber: phoneNumber,
256
+ name,
257
+ otherRecipient: x
258
+ };
259
+ texts.push(textRecipient);
260
+ textUidsSet.add(uid);
261
+ explicitOtherRecipientTextNumbers.delete(phoneNumber); // don't double-send to the same text phone number
262
+ }
263
+ }
264
+ });
265
+ explicitOtherRecipientTextNumbers.forEach((x, t) => {
266
+ const sendTextEnabled = x.st;
267
+ const shouldSendText = (onlyTextExplicitlyEnabledRecipients && sendTextEnabled === true) || (!onlyTextExplicitlyEnabledRecipients && sendTextEnabled !== false);
268
+ if (shouldSendText) {
269
+ const textRecipient = {
270
+ phoneNumber: t,
271
+ name: x.n,
272
+ otherRecipient: x
273
+ };
274
+ texts.push(textRecipient);
275
+ }
276
+ });
277
+ // TODO: Add push notification details...
278
+ // make all notification summary recipients
279
+ const notificationSummaries = [];
280
+ const notificationSummaryKeysSet = new Set();
281
+ const notificationSummaryUidsSet = new Set();
282
+ relevantBoxRecipientConfigs.forEach((x) => {
283
+ const { recipient } = x;
284
+ const { uid } = recipient;
285
+ const userDetails = uid ? userDetailsMap.get(uid) : undefined;
286
+ const otherRecipientForUser = uid ? otherRecipientConfigs.get(uid) : undefined;
287
+ const sendNotificationSummary = x.effectiveTemplateConfig?.sn !== false;
288
+ // don't send a notification summary if marked false
289
+ if (sendNotificationSummary && !notificationSummaryUidsSet.has(uid ?? '')) {
290
+ let notificationSummaryId;
291
+ if (uid) {
292
+ // only use the uid (and ignore recipient config) if uid is defined
293
+ notificationSummaryId = notificationSummaryIdForUid(uid);
294
+ notificationSummaryUidsSet.add(uid);
295
+ }
296
+ else if (x.recipient.s) {
297
+ notificationSummaryId = x.recipient.s;
298
+ }
299
+ if (notificationSummaryId) {
300
+ const name = userDetails?.displayName ?? x.recipient.n;
301
+ notificationSummaries.push({
302
+ notificationSummaryId,
303
+ boxRecipient: x,
304
+ otherRecipient: otherRecipientForUser,
305
+ name
306
+ });
307
+ explicitOtherRecipientNotificationSummaryIds.delete(notificationSummaryId); // don't double send
308
+ }
309
+ }
310
+ });
311
+ otherRecipientConfigs.forEach((x, uid) => {
312
+ // add users who existing in the system at this step, then other recipients in the next step
313
+ const userDetails = userDetailsMap.get(uid);
314
+ if (userDetails) {
315
+ const { phoneNumber, displayName } = userDetails;
316
+ const sendTextEnabled = x.st;
317
+ const sendText = (onlyTextExplicitlyEnabledRecipients && sendTextEnabled === true) || (!onlyTextExplicitlyEnabledRecipients && sendTextEnabled !== false);
318
+ if (phoneNumber != null && sendText && !textUidsSet.has(uid)) {
319
+ const name = displayName || x.n;
320
+ const textRecipient = {
321
+ phoneNumber: phoneNumber,
322
+ name,
323
+ otherRecipient: x
324
+ };
325
+ texts.push(textRecipient);
326
+ textUidsSet.add(uid);
327
+ explicitOtherRecipientTextNumbers.delete(phoneNumber); // don't double-send to the same text phone number
328
+ }
329
+ }
330
+ });
331
+ otherRecipientConfigs.forEach((x, uid) => {
332
+ const userDetails = userDetailsMap.get(uid);
333
+ if (userDetails) {
334
+ const { displayName } = userDetails;
335
+ const sendNotificationSummary = x.sn;
336
+ if (sendNotificationSummary !== false) {
337
+ let notificationSummaryId;
338
+ if (uid) {
339
+ notificationSummaryId = notificationSummaryIdForUid(uid);
340
+ notificationSummaryUidsSet.add(uid);
341
+ }
342
+ else if (x.s) {
343
+ notificationSummaryId = x.s;
344
+ }
345
+ if (notificationSummaryId) {
346
+ if (!notificationSummaryKeysSet.has(notificationSummaryId)) {
347
+ const name = displayName || x.n;
348
+ const notificationSummary = {
349
+ notificationSummaryId,
350
+ otherRecipient: x,
351
+ name
352
+ };
353
+ notificationSummaries.push(notificationSummary);
354
+ explicitOtherRecipientNotificationSummaryIds.delete(notificationSummaryId);
355
+ }
356
+ }
357
+ }
358
+ }
359
+ });
360
+ explicitOtherRecipientNotificationSummaryIds.forEach((x, notificationSummaryId) => {
361
+ const { sn: sendNotificationSummary } = x;
362
+ if (sendNotificationSummary !== false) {
363
+ const notificationSummary = {
364
+ notificationSummaryId,
365
+ otherRecipient: x,
366
+ name: x.n
367
+ };
368
+ notificationSummaries.push(notificationSummary);
369
+ }
370
+ });
371
+ // results
372
+ const result = {
373
+ _internal,
374
+ emails,
375
+ texts,
376
+ notificationSummaries
377
+ };
378
+ return result;
379
+ }
380
+ exports.expandNotificationRecipients = expandNotificationRecipients;
381
+ function updateNotificationUserNotificationBoxRecipientConfig(input) {
382
+ const { notificationBoxId, notificationUserId, notificationUser, insertingRecipientIntoNotificationBox, removeRecipientFromNotificationBox, notificationBoxRecipient } = input;
383
+ const currentNotificationUserBoxIndex = notificationUser.bc.findIndex((x) => x.nb === notificationBoxId);
384
+ const currentNotificationUserBoxIndexExists = currentNotificationUserBoxIndex !== -1;
385
+ const currentNotificationUserBoxGlobalConfig = notificationUser.gc;
386
+ const currentNotificationUserBoxConfig = notificationUser.bc[currentNotificationUserBoxIndex] ?? {};
387
+ /**
388
+ * If bc is updated then the user should be updated too
389
+ */
390
+ let updatedBc;
391
+ let updatedNotificationBoxRecipient;
392
+ if (removeRecipientFromNotificationBox) {
393
+ // flag as removed in the NotificationUser details if not already flagged as such
394
+ if (currentNotificationUserBoxIndexExists && currentNotificationUserBoxConfig.rm !== true) {
395
+ updatedBc = [...notificationUser.bc];
396
+ updatedBc[currentNotificationUserBoxIndex] = {
397
+ ...currentNotificationUserBoxConfig,
398
+ nb: notificationBoxId,
399
+ c: currentNotificationUserBoxConfig.c ?? {},
400
+ i: util_1.UNSET_INDEX_NUMBER,
401
+ ns: false,
402
+ rm: true
403
+ };
404
+ }
405
+ }
406
+ else if (notificationBoxRecipient != null) {
407
+ const { ns: currentConfigNeedsSync, lk: lockedFromChanges, bk: blockedFromAdd } = {
408
+ ns: currentNotificationUserBoxConfig.ns,
409
+ lk: currentNotificationUserBoxGlobalConfig.lk ?? currentNotificationUserBoxConfig.lk,
410
+ bk: currentNotificationUserBoxGlobalConfig.bk ?? currentNotificationUserBoxConfig.bk
411
+ };
412
+ // if we're re-inserting, then take the prevous config and restore as it was and remove the rm tag
413
+ let updateWithNotificationBoxRecipient;
414
+ if (insertingRecipientIntoNotificationBox) {
415
+ // does not exist in the NotificationBox currently
416
+ if (blockedFromAdd) {
417
+ throw (0, notification_error_1.notificationUserBlockedFromBeingAddedToRecipientsError)(notificationUserId);
418
+ }
419
+ else if (lockedFromChanges) {
420
+ // ignored the notificationBoxRecipient's updates
421
+ updateWithNotificationBoxRecipient = currentNotificationUserBoxConfig;
422
+ }
423
+ else {
424
+ updateWithNotificationBoxRecipient = (0, firebase_1.mergeNotificationBoxRecipients)(notificationBoxRecipient, currentNotificationUserBoxConfig);
425
+ }
426
+ }
427
+ else {
428
+ // if locked from changes, throw error
429
+ if (lockedFromChanges) {
430
+ throw (0, notification_error_1.notificationUserLockedConfigFromBeingUpdatedError)(notificationUserId);
431
+ }
432
+ else if (currentConfigNeedsSync) {
433
+ // if needs sync, then merge changes from the config into the notificationBoxRecipient
434
+ updateWithNotificationBoxRecipient = (0, firebase_1.mergeNotificationBoxRecipients)(notificationBoxRecipient, currentNotificationUserBoxConfig);
435
+ }
436
+ else {
437
+ // use as-is
438
+ updateWithNotificationBoxRecipient = notificationBoxRecipient;
439
+ }
440
+ }
441
+ const updatedNotificationUserBoxEntry = (0, firebase_1.mergeNotificationUserNotificationBoxRecipientConfigs)({
442
+ ...currentNotificationUserBoxConfig,
443
+ i: notificationBoxRecipient.i,
444
+ c: currentNotificationUserBoxConfig.c ?? {},
445
+ nb: notificationBoxId,
446
+ rm: false // remove/clear the removed flag
447
+ }, updateWithNotificationBoxRecipient);
448
+ updatedBc = [...notificationUser.bc];
449
+ if (currentNotificationUserBoxIndexExists) {
450
+ updatedBc[currentNotificationUserBoxIndex] = updatedNotificationUserBoxEntry;
451
+ }
452
+ else {
453
+ updatedBc.push(updatedNotificationUserBoxEntry);
454
+ }
455
+ // sync index with input NotificationBoxRecipient
456
+ updatedNotificationUserBoxEntry.i = notificationBoxRecipient.i;
457
+ updatedNotificationBoxRecipient = updatedNotificationUserBoxEntry;
458
+ }
459
+ return {
460
+ updatedBc,
461
+ updatedNotificationBoxRecipient
462
+ };
463
+ }
464
+ exports.updateNotificationUserNotificationBoxRecipientConfig = updateNotificationUserNotificationBoxRecipientConfig;
465
+ //# sourceMappingURL=notification.util.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"notification.util.js","sourceRoot":"","sources":["../../../../../../../packages/firebase-server/model/src/lib/notification/notification.util.ts"],"names":[],"mappings":";;;AAAA,gDA8B2B;AAE3B,wCAAyI;AACzI,6DAAiJ;AAEjJ,mCAAmC;AACnC,SAAgB,kCAAkC,CAAC,KAAe;IAChE,OAAO;QACL,GAAG,EAAE,IAAI,IAAI,EAAE;QACf,CAAC,EAAE,KAAK;QACR,CAAC,EAAE,IAAA,4BAAiB,GAAE;QACtB,CAAC,EAAE,IAAI;QACP,CAAC,EAAE,EAAE;KACN,CAAC;AACJ,CAAC;AARD,gFAQC;AA8FD;;;;;;;;;GASG;AACI,KAAK,UAAU,4BAA4B,CAAC,KAAwC;IACzF,MAAM,EAAE,wBAAwB,EAAE,WAAW,EAAE,YAAY,EAAE,eAAe,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,2BAA2B,EAAE,gCAAgC,EAAE,mCAAmC,EAAE,wCAAwC,EAAE,GAAG,KAAK,CAAC;IACrS,MAAM,2BAA2B,GAAG,gCAAgC,IAAI,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC;IAC1F,MAAM,wBAAwB,GAAG,YAAY,CAAC,CAAC,CAAC,CAAC,IAAI,6CAAkC,CAAC;IACxF,MAAM,aAAa,GAAG,qBAAqB,IAAI,YAAY,CAAC,EAAE,IAAI,wCAA6B,CAAC,MAAM,CAAC;IACvG,MAAM,mCAAmC,GAAG,wCAAwC,KAAK,KAAK,CAAC;IAE/F,MAAM,EAAE,yBAA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AAE,iBAAiB;YACrB,EAAE,EAAE,KAAK,CAAC,gCAAgC;SAC3C,EACD,kCAAkC,CACnC,CAAC;QAEF,SAAS,GAAG,CAAC,GAAG,gBAAgB,CAAC,EAAE,CAAC,CAAC;QAErC,IAAI,qCAAqC,EAAE;YACzC,SAAS,CAAC,+BAA+B,CAAC,GAAG,+BAA+B,CAAC;SAC9E;aAAM;YACL,SAAS,CAAC,IAAI,CAAC,+BAA+B,CAAC,CAAC;SACjD;QAED,iDAAiD;QACjD,+BAA+B,CAAC,CAAC,GAAG,wBAAwB,CAAC,CAAC,CAAC;QAC/D,+BAA+B,GAAG,+BAA+B,CAAC;KACnE;IAED,OAAO;QACL,SAAS;QACT,+BAA+B;KAChC,CAAC;AACJ,CAAC;AA7FD,oHA6FC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dereekb/firebase-server",
3
- "version": "11.0.21",
3
+ "version": "11.1.1",
4
4
  "exports": {
5
5
  ".": {
6
6
  "types": "./src/index.d.ts",
@@ -25,6 +25,12 @@
25
25
  "main": "./zoho/src/index.js",
26
26
  "require": "./zoho/src/index.js",
27
27
  "default": "./zoho/src/index.js"
28
+ },
29
+ "./model": {
30
+ "types": "./model/src/index.d.ts",
31
+ "main": "./model/src/index.js",
32
+ "require": "./model/src/index.js",
33
+ "default": "./model/src/index.js"
28
34
  }
29
35
  },
30
36
  "main": "./src/index.js",
package/test/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dereekb/firebase-server/test",
3
- "version": "11.0.21",
3
+ "version": "11.1.1",
4
4
  "type": "commonjs",
5
5
  "main": "./src/index.js"
6
6
  }
package/zoho/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dereekb/firebase-server/zoho",
3
- "version": "11.0.21",
3
+ "version": "11.1.1",
4
4
  "type": "commonjs",
5
5
  "main": "./src/index.js"
6
6
  }