@dereekb/firebase-server 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.
Files changed (54) hide show
  1. package/CHANGELOG.md +9 -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
package/CHANGELOG.md CHANGED
@@ -2,6 +2,15 @@
2
2
 
3
3
  This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
4
4
 
5
+ # [11.1.0](https://github.com/dereekb/dbx-components/compare/v11.0.21-dev...v11.1.0) (2025-02-28)
6
+
7
+
8
+ ### Features
9
+
10
+ * notifications ([#27](https://github.com/dereekb/dbx-components/issues/27)) ([d83bdc3](https://github.com/dereekb/dbx-components/commit/d83bdc3c2f308a25cc4cb12e6eedd126e91c46a4))
11
+
12
+
13
+
5
14
  ## [11.0.21](https://github.com/dereekb/dbx-components/compare/v11.0.20-dev...v11.0.21) (2025-01-28)
6
15
 
7
16
 
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dereekb/firebase-server/mailgun",
3
- "version": "11.0.21",
3
+ "version": "11.1.0",
4
4
  "type": "commonjs",
5
5
  "main": "./src/index.js"
6
6
  }
@@ -0,0 +1,6 @@
1
+ {
2
+ "name": "@dereekb/firebase-server/model",
3
+ "version": "11.1.0",
4
+ "type": "commonjs",
5
+ "main": "./src/index.js"
6
+ }
@@ -0,0 +1 @@
1
+ export * from './lib';
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ tslib_1.__exportStar(require("./lib"), exports);
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../packages/firebase-server/model/src/index.ts"],"names":[],"mappings":";;;AAAA,gDAAsB"}
@@ -0,0 +1,2 @@
1
+ export * from './mailgun';
2
+ export * from './notification';
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ tslib_1.__exportStar(require("./mailgun"), exports);
5
+ tslib_1.__exportStar(require("./notification"), exports);
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/firebase-server/model/src/lib/index.ts"],"names":[],"mappings":";;;AAAA,oDAA0B;AAC1B,yDAA+B"}
@@ -0,0 +1 @@
1
+ export * from './notification.send.service.mailgun';
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ tslib_1.__exportStar(require("./notification.send.service.mailgun"), exports);
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../packages/firebase-server/model/src/lib/mailgun/index.ts"],"names":[],"mappings":";;;AAAA,8EAAoD"}
@@ -0,0 +1,51 @@
1
+ import { type Maybe, type PromiseOrValue } from '@dereekb/util';
2
+ import { type MailgunTemplateEmailRequest, type MailgunService } from '@dereekb/nestjs/mailgun';
3
+ import { type NotificationMessage, type NotificationSendMessageTemplateName } from '@dereekb/firebase';
4
+ import { type NotificationEmailSendService } from '../notification/notification.send.service';
5
+ /**
6
+ * Input for a MailgunNotificationEmailSendServiceTemplateBuilder.
7
+ */
8
+ export interface MailgunNotificationEmailSendServiceTemplateBuilderInput {
9
+ /**
10
+ * The mailgun service.
11
+ */
12
+ readonly mailgunService: MailgunService;
13
+ /**
14
+ * The determined template type for all email messages provided.
15
+ */
16
+ readonly sendTemplateName: NotificationSendMessageTemplateName;
17
+ /**
18
+ * The set of email messages to be built into the email request.
19
+ */
20
+ readonly messages: NotificationMessage[];
21
+ }
22
+ /**
23
+ * Config for a mailgunNotificationEmailSendService()
24
+ */
25
+ export interface MailgunNotificationEmailSendServiceConfig {
26
+ /**
27
+ * The mailgun service.
28
+ */
29
+ readonly mailgunService: MailgunService;
30
+ /**
31
+ * The default template type to use for messages, if applicable.
32
+ */
33
+ readonly defaultSendTemplateName?: Maybe<NotificationSendMessageTemplateName>;
34
+ /**
35
+ * The maximum number of messages to batch together.
36
+ *
37
+ * Defaults to 50.
38
+ */
39
+ readonly maxBatchSizePerRequest?: Maybe<number>;
40
+ /**
41
+ * A Record of MailgunNotificationEmailSendServiceTemplateBuilder functions keyed by the template type used to convert messages.
42
+ */
43
+ readonly messageBuilders: Record<NotificationSendMessageTemplateName, MailgunNotificationEmailSendServiceTemplateBuilder>;
44
+ }
45
+ export declare const MAILGUN_NOTIFICATION_EMAIL_SEND_SERVICE_DEFAULT_MAX_BATCH_SIZE_PER_REQUEST = 50;
46
+ /**
47
+ * Function that converts the input into a MailgunTemplateEmailRequest.
48
+ */
49
+ export type MailgunNotificationEmailSendServiceTemplateBuilder = (input: MailgunNotificationEmailSendServiceTemplateBuilderInput) => PromiseOrValue<MailgunTemplateEmailRequest>;
50
+ export type MailgunNotificationEmailSendService = NotificationEmailSendService;
51
+ export declare function mailgunNotificationEmailSendService(config: MailgunNotificationEmailSendServiceConfig): MailgunNotificationEmailSendService;
@@ -0,0 +1,67 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.mailgunNotificationEmailSendService = exports.MAILGUN_NOTIFICATION_EMAIL_SEND_SERVICE_DEFAULT_MAX_BATCH_SIZE_PER_REQUEST = void 0;
4
+ const util_1 = require("@dereekb/util");
5
+ exports.MAILGUN_NOTIFICATION_EMAIL_SEND_SERVICE_DEFAULT_MAX_BATCH_SIZE_PER_REQUEST = 50;
6
+ function mailgunNotificationEmailSendService(config) {
7
+ const { mailgunService, defaultSendTemplateName, maxBatchSizePerRequest: inputMaxBatchSizePerRequest, messageBuilders: inputMessageBuilders } = config;
8
+ const lowercaseKeysMessageBuilders = (0, util_1.mapObjectKeysToLowercase)(inputMessageBuilders);
9
+ const maxBatchSizePerRequest = inputMaxBatchSizePerRequest ?? exports.MAILGUN_NOTIFICATION_EMAIL_SEND_SERVICE_DEFAULT_MAX_BATCH_SIZE_PER_REQUEST;
10
+ const sendService = {
11
+ async buildSendInstanceForEmailNotificationMessages(notificationMessages) {
12
+ const templateMap = (0, util_1.multiValueMapBuilder)();
13
+ // group by templates
14
+ notificationMessages.forEach((x) => {
15
+ const sendTemplateName = x.emailContent?.sendTemplateName ?? x.content.sendTemplateName ?? defaultSendTemplateName;
16
+ if (sendTemplateName == null) {
17
+ throw new Error(`mailgunNotificationEmailSendService(): A sendTemplateName for a message was not available and no default was provided. Consider configuring a default send template.`);
18
+ }
19
+ templateMap.add(sendTemplateName, x);
20
+ });
21
+ // build send batches
22
+ const messageSendBatches = templateMap.entries().flatMap(([templateType, messages]) => {
23
+ return (0, util_1.batch)(messages, maxBatchSizePerRequest).map((x) => [templateType, x]);
24
+ });
25
+ // create the template requests
26
+ const templateRequests = await Promise.all(messageSendBatches.map(([sendTemplateName, messages]) => {
27
+ const sendTemplateNameToLowercase = sendTemplateName.toLowerCase();
28
+ const builderForKey = lowercaseKeysMessageBuilders[sendTemplateNameToLowercase];
29
+ if (!builderForKey) {
30
+ throw new Error(`mailgunNotificationEmailSendService(): A template builder was not available for template type "${sendTemplateName}".`);
31
+ }
32
+ else {
33
+ const input = { mailgunService, sendTemplateName, messages };
34
+ return builderForKey(input);
35
+ }
36
+ }));
37
+ const sendFn = async () => {
38
+ const success = [];
39
+ const failed = [];
40
+ // send the template emails
41
+ await (0, util_1.runAsyncTasksForValues)(templateRequests, (x) => {
42
+ const recipients = (0, util_1.asArray)(x.to).map((z) => z.email);
43
+ return mailgunService
44
+ .sendTemplateEmail(x)
45
+ .then(() => {
46
+ (0, util_1.pushArrayItemsIntoArray)(success, recipients);
47
+ })
48
+ .catch((e) => {
49
+ (0, util_1.pushArrayItemsIntoArray)(failed, recipients);
50
+ console.error('mailgunNotificationEmailSendService(): failed sending template emails', e);
51
+ // suppress error
52
+ });
53
+ }, { maxParallelTasks: 3 });
54
+ const result = {
55
+ success,
56
+ failed,
57
+ ignored: []
58
+ };
59
+ return result;
60
+ };
61
+ return sendFn;
62
+ }
63
+ };
64
+ return sendService;
65
+ }
66
+ exports.mailgunNotificationEmailSendService = mailgunNotificationEmailSendService;
67
+ //# sourceMappingURL=notification.send.service.mailgun.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"notification.send.service.mailgun.js","sourceRoot":"","sources":["../../../../../../../packages/firebase-server/model/src/lib/mailgun/notification.send.service.mailgun.ts"],"names":[],"mappings":";;;AAAA,wCAAoM;AAgDvL,QAAA,0EAA0E,GAAG,EAAE,CAAC;AAS7F,SAAgB,mCAAmC,CAAC,MAAiD;IACnG,MAAM,EAAE,cAAc,EAAE,uBAAuB,EAAE,sBAAsB,EAAE,2BAA2B,EAAE,eAAe,EAAE,oBAAoB,EAAE,GAAG,MAAM,CAAC;IACvJ,MAAM,4BAA4B,GAAG,IAAA,+BAAwB,EAAC,oBAAoB,CAAC,CAAC;IACpF,MAAM,sBAAsB,GAAG,2BAA2B,IAAI,kFAA0E,CAAC;IAEzI,MAAM,WAAW,GAAwC;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,CAAC;oBAC7D,OAAO,aAAa,CAAC,KAAK,CAAC,CAAC;iBAC7B;YACH,CAAC,CAAC,CACH,CAAC;YAEF,MAAM,MAAM,GAAG,KAAK,IAAI,EAAE;gBACxB,MAAM,OAAO,GAAmB,EAAE,CAAC;gBACnC,MAAM,MAAM,GAAmB,EAAE,CAAC;gBAElC,2BAA2B;gBAC3B,MAAM,IAAA,6BAAsB,EAC1B,gBAAgB,EAChB,CAAC,CAAC,EAAE,EAAE;oBACJ,MAAM,UAAU,GAAG,IAAA,cAAO,EAAC,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;oBAErD,OAAO,cAAc;yBAClB,iBAAiB,CAAC,CAAC,CAAC;yBACpB,IAAI,CAAC,GAAG,EAAE;wBACT,IAAA,8BAAuB,EAAC,OAAO,EAAE,UAAU,CAAC,CAAC;oBAC/C,CAAC,CAAC;yBACD,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE;wBACX,IAAA,8BAAuB,EAAC,MAAM,EAAE,UAAU,CAAC,CAAC;wBAC5C,OAAO,CAAC,KAAK,CAAC,uEAAuE,EAAE,CAAC,CAAC,CAAC;wBAC1F,iBAAiB;oBACnB,CAAC,CAAC,CAAC;gBACP,CAAC,EACD,EAAE,gBAAgB,EAAE,CAAC,EAAE,CACxB,CAAC;gBAEF,MAAM,MAAM,GAAwC;oBAClD,OAAO;oBACP,MAAM;oBACN,OAAO,EAAE,EAAE;iBACZ,CAAC;gBAEF,OAAO,MAAM,CAAC;YAChB,CAAC,CAAC;YAEF,OAAO,MAAM,CAAC;QAChB,CAAC;KACF,CAAC;IAEF,OAAO,WAAW,CAAC;AACrB,CAAC;AA9ED,kFA8EC"}
@@ -0,0 +1,11 @@
1
+ export * from './notification.action.server';
2
+ export * from './notification.action.init.server';
3
+ export * from './notification.config.service';
4
+ export * from './notification.config';
5
+ export * from './notification.module';
6
+ export * from './notification.send.service.notificationsummary';
7
+ export * from './notification.send.service.text';
8
+ export * from './notification.send.service';
9
+ export * from './notification.send';
10
+ export * from './notification.error';
11
+ export * from './notification.util';
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ tslib_1.__exportStar(require("./notification.action.server"), exports);
5
+ tslib_1.__exportStar(require("./notification.action.init.server"), exports);
6
+ tslib_1.__exportStar(require("./notification.config.service"), exports);
7
+ tslib_1.__exportStar(require("./notification.config"), exports);
8
+ tslib_1.__exportStar(require("./notification.module"), exports);
9
+ tslib_1.__exportStar(require("./notification.send.service.notificationsummary"), exports);
10
+ tslib_1.__exportStar(require("./notification.send.service.text"), exports);
11
+ tslib_1.__exportStar(require("./notification.send.service"), exports);
12
+ tslib_1.__exportStar(require("./notification.send"), exports);
13
+ tslib_1.__exportStar(require("./notification.error"), exports);
14
+ tslib_1.__exportStar(require("./notification.util"), exports);
15
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../packages/firebase-server/model/src/lib/notification/index.ts"],"names":[],"mappings":";;;AAAA,uEAA6C;AAC7C,4EAAkD;AAClD,wEAA8C;AAC9C,gEAAsC;AACtC,gEAAsC;AACtC,0FAAgE;AAChE,2EAAiD;AACjD,sEAA4C;AAC5C,8DAAoC;AACpC,+DAAqC;AACrC,8DAAoC"}
@@ -0,0 +1,72 @@
1
+ import { type FirestoreContextReference, type Transaction, type TwoWayFlatFirestoreModelKey, type FirestoreModelKey, type FirestoreCollectionName, type NotificationFirestoreCollections, type AsyncNotificationBoxUpdateAction, type NotificationBoxDocument, InitializeNotificationModelParams, InitializeAllApplicableNotificationBoxesParams, type InitializeAllApplicableNotificationBoxesResult, type NotificationBox, type NotificationSummary, InitializeAllApplicableNotificationSummariesParams, type InitializeAllApplicableNotificationSummariesResult, type NotificationSummaryDocument, type AsyncNotificationSummaryUpdateAction, type FirestoreDocument, type FirestoreDocumentData, type InitializedNotificationModel } from '@dereekb/firebase';
2
+ import { type FirebaseServerActionsContext } from '@dereekb/firebase-server';
3
+ import { type Maybe } from '@dereekb/util';
4
+ import { type TransformAndValidateFunctionResult } from '@dereekb/model';
5
+ import { type InjectionToken } from '@nestjs/common';
6
+ /**
7
+ * Token to access/override the NotificationTemplateService's defaults records.
8
+ */
9
+ export declare const NOTIFICATION_INIT_SERVER_ACTIONS_CONTEXT_CONFIG_TOKEN: InjectionToken;
10
+ export interface NotificationInitServerActionsContextConfig {
11
+ /**
12
+ * MakeTemplateForNotificationBoxInitializationFunction used by the system for initializing the NotificationBoxes for models.
13
+ */
14
+ readonly makeTemplateForNotificationBoxInitialization: MakeTemplateForNotificationBoxInitializationFunction;
15
+ /**
16
+ * MakeTemplateForNotificationBoxInitializationFunction used by the system for initializing the NotificationSummaries for models.
17
+ */
18
+ readonly makeTemplateForNotificationSummaryInitialization: MakeTemplateForNotificationSummaryInitializationFunction;
19
+ }
20
+ export interface MakeTemplateForNotificationRelatedModelInitializationFunctionInput {
21
+ readonly transaction: Transaction;
22
+ readonly flatModelKey: TwoWayFlatFirestoreModelKey;
23
+ readonly modelKey: FirestoreModelKey;
24
+ readonly collectionName: FirestoreCollectionName;
25
+ }
26
+ export type MakeTemplateForNotificationRelatedModelInitializationFunctionInvalidResponse = null;
27
+ export declare const MAKE_TEMPLATE_FOR_NOTIFICATION_RELATED_MODEL_INITIALIZATION_FUNCTION_DELETE_RESPONSE = false;
28
+ export type MakeTemplateForNotificationRelatedModelInitializationFunctionDeleteResponse = typeof MAKE_TEMPLATE_FOR_NOTIFICATION_RELATED_MODEL_INITIALIZATION_FUNCTION_DELETE_RESPONSE;
29
+ export type MakeTemplateForNotificationRelatedModelInitializationFunctionResult<T> = Partial<T> | MakeTemplateForNotificationRelatedModelInitializationFunctionInvalidResponse | MakeTemplateForNotificationRelatedModelInitializationFunctionDeleteResponse;
30
+ /**
31
+ * Idempotent function used by the system to determine how to handle a model initialization.
32
+ *
33
+ * Behavior:
34
+ * - Returns a template for the input that is used for initializing the notification model. Typically this is the owner, or name, etc.
35
+ * - If null/undefined is returned, then the model will be flagged as invalid instead.
36
+ * - If false, then the notification model will be deleted. Used for cases where a model should not have t
37
+ */
38
+ export type MakeTemplateForNotificationRelatedModelInitializationFunction<T> = (input: MakeTemplateForNotificationRelatedModelInitializationFunctionInput) => Promise<MakeTemplateForNotificationRelatedModelInitializationFunctionResult<T>>;
39
+ export type MakeTemplateForNotificationBoxInitializationFunction = MakeTemplateForNotificationRelatedModelInitializationFunction<NotificationBox>;
40
+ export type MakeTemplateForNotificationSummaryInitializationFunction = MakeTemplateForNotificationRelatedModelInitializationFunction<NotificationSummary>;
41
+ export interface NotificationInitServerActionsContext extends FirebaseServerActionsContext, NotificationFirestoreCollections, FirestoreContextReference, NotificationInitServerActionsContextConfig {
42
+ }
43
+ export declare abstract class NotificationInitServerActions {
44
+ abstract initializeNotificationBox(params: InitializeNotificationModelParams): AsyncNotificationBoxUpdateAction<InitializeNotificationModelParams>;
45
+ abstract initializeAllApplicableNotificationBoxes(params: InitializeAllApplicableNotificationBoxesParams): Promise<TransformAndValidateFunctionResult<InitializeAllApplicableNotificationBoxesParams, () => Promise<InitializeAllApplicableNotificationBoxesResult>>>;
46
+ abstract initializeNotificationSummary(params: InitializeNotificationModelParams): AsyncNotificationSummaryUpdateAction<InitializeNotificationModelParams>;
47
+ abstract initializeAllApplicableNotificationSummaries(params: InitializeAllApplicableNotificationSummariesParams): Promise<TransformAndValidateFunctionResult<InitializeAllApplicableNotificationSummariesParams, () => Promise<InitializeAllApplicableNotificationSummariesResult>>>;
48
+ }
49
+ export declare function notificationInitServerActions(context: NotificationInitServerActionsContext): NotificationInitServerActions;
50
+ export interface InitializeNotificationModelInTransactionInput<D extends FirestoreDocument<InitializedNotificationModel, any>> {
51
+ readonly makeTemplateFunction: MakeTemplateForNotificationRelatedModelInitializationFunction<FirestoreDocumentData<D>>;
52
+ readonly throwErrorIfAlreadyInitialized?: Maybe<boolean>;
53
+ readonly transaction: Transaction;
54
+ readonly document: D;
55
+ readonly data: FirestoreDocumentData<D>;
56
+ }
57
+ export declare function initializeNotificationModelInTransaction<D extends FirestoreDocument<InitializedNotificationModel, any>>(input: InitializeNotificationModelInTransactionInput<D>): Promise<{
58
+ initialized: boolean;
59
+ alreadyInitialized: boolean;
60
+ }>;
61
+ export declare function initializeNotificationBoxInTransactionFactory(context: NotificationInitServerActionsContext): (params: InitializeNotificationModelParams, notificationBoxDocument: NotificationBoxDocument, transaction: Transaction) => Promise<{
62
+ initialized: boolean;
63
+ alreadyInitialized: boolean;
64
+ }>;
65
+ export declare function initializeNotificationBoxFactory(context: NotificationInitServerActionsContext): import("@dereekb/model").TransformAndValidateFunctionResultFunction<InitializeNotificationModelParams, (notificationBoxDocument: NotificationBoxDocument) => Promise<NotificationBoxDocument>, object, unknown>;
66
+ export declare function initializeAllApplicableNotificationBoxesFactory(context: NotificationInitServerActionsContext): import("@dereekb/model").TransformAndValidateFunctionResultFunction<InitializeAllApplicableNotificationBoxesParams, () => Promise<InitializeAllApplicableNotificationBoxesResult>, object, unknown>;
67
+ export declare function initializeNotificationSummaryInTransactionFactory(context: NotificationInitServerActionsContext): (params: InitializeNotificationModelParams, notificationSummaryDocument: NotificationSummaryDocument, transaction: Transaction) => Promise<{
68
+ initialized: boolean;
69
+ alreadyInitialized: boolean;
70
+ }>;
71
+ export declare function initializeNotificationSummaryFactory(context: NotificationInitServerActionsContext): import("@dereekb/model").TransformAndValidateFunctionResultFunction<InitializeNotificationModelParams, (notificationSummaryDocument: NotificationSummaryDocument) => Promise<NotificationSummaryDocument>, object, unknown>;
72
+ export declare function initializeAllApplicableNotificationSummariesFactory(context: NotificationInitServerActionsContext): import("@dereekb/model").TransformAndValidateFunctionResultFunction<InitializeAllApplicableNotificationSummariesParams, () => Promise<InitializeAllApplicableNotificationSummariesResult>, object, unknown>;
@@ -0,0 +1,228 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.initializeAllApplicableNotificationSummariesFactory = exports.initializeNotificationSummaryFactory = exports.initializeNotificationSummaryInTransactionFactory = exports.initializeAllApplicableNotificationBoxesFactory = exports.initializeNotificationBoxFactory = exports.initializeNotificationBoxInTransactionFactory = exports.initializeNotificationModelInTransaction = exports.notificationInitServerActions = exports.NotificationInitServerActions = exports.MAKE_TEMPLATE_FOR_NOTIFICATION_RELATED_MODEL_INITIALIZATION_FUNCTION_DELETE_RESPONSE = exports.NOTIFICATION_INIT_SERVER_ACTIONS_CONTEXT_CONFIG_TOKEN = void 0;
4
+ const firebase_1 = require("@dereekb/firebase");
5
+ const firebase_server_1 = require("@dereekb/firebase-server");
6
+ const util_1 = require("@dereekb/util");
7
+ const notification_error_1 = require("./notification.error");
8
+ // MARK: NotificationInitServerActionsContextConfig
9
+ /**
10
+ * Token to access/override the NotificationTemplateService's defaults records.
11
+ */
12
+ exports.NOTIFICATION_INIT_SERVER_ACTIONS_CONTEXT_CONFIG_TOKEN = 'NOTIFICATION_INIT_SERVER_ACTIONS_CONTEXT_CONFIG';
13
+ exports.MAKE_TEMPLATE_FOR_NOTIFICATION_RELATED_MODEL_INITIALIZATION_FUNCTION_DELETE_RESPONSE = false;
14
+ class NotificationInitServerActions {
15
+ }
16
+ exports.NotificationInitServerActions = NotificationInitServerActions;
17
+ function notificationInitServerActions(context) {
18
+ return {
19
+ initializeNotificationBox: initializeNotificationBoxFactory(context),
20
+ initializeAllApplicableNotificationBoxes: initializeAllApplicableNotificationBoxesFactory(context),
21
+ initializeNotificationSummary: initializeNotificationSummaryFactory(context),
22
+ initializeAllApplicableNotificationSummaries: initializeAllApplicableNotificationSummariesFactory(context)
23
+ };
24
+ }
25
+ exports.notificationInitServerActions = notificationInitServerActions;
26
+ async function initializeNotificationModelInTransaction(input) {
27
+ const { makeTemplateFunction, throwErrorIfAlreadyInitialized, transaction, document: documentInTransaction, data: notificationBox } = input;
28
+ let initialized = false;
29
+ const alreadyInitialized = !notificationBox.s;
30
+ if (!alreadyInitialized) {
31
+ const flatModelKey = documentInTransaction.id;
32
+ const modelKey = (0, firebase_1.inferKeyFromTwoWayFlatFirestoreModelKey)(flatModelKey);
33
+ const modelCollectionName = (0, firebase_1.firestoreModelKeyCollectionName)(modelKey);
34
+ const input = {
35
+ transaction,
36
+ flatModelKey,
37
+ modelKey,
38
+ collectionName: modelCollectionName
39
+ };
40
+ const template = await makeTemplateFunction(input);
41
+ if (template === false) {
42
+ await documentInTransaction.accessor.delete();
43
+ }
44
+ else if (template == null) {
45
+ await documentInTransaction.update({
46
+ s: false,
47
+ fi: true
48
+ });
49
+ }
50
+ else {
51
+ initialized = true;
52
+ await documentInTransaction.update({
53
+ //
54
+ ...template,
55
+ m: undefined,
56
+ s: null,
57
+ fi: false // set false
58
+ });
59
+ }
60
+ }
61
+ else if (throwErrorIfAlreadyInitialized) {
62
+ throw (0, notification_error_1.notificationModelAlreadyInitializedError)();
63
+ }
64
+ return {
65
+ initialized,
66
+ alreadyInitialized
67
+ };
68
+ }
69
+ exports.initializeNotificationModelInTransaction = initializeNotificationModelInTransaction;
70
+ function initializeNotificationBoxInTransactionFactory(context) {
71
+ const { notificationBoxCollection, makeTemplateForNotificationBoxInitialization } = context;
72
+ return async (params, notificationBoxDocument, transaction) => {
73
+ const { throwErrorIfAlreadyInitialized } = params;
74
+ const notificationBoxDocumentInTransaction = notificationBoxCollection.documentAccessorForTransaction(transaction).loadDocumentFrom(notificationBoxDocument);
75
+ const notificationBox = await (0, firebase_server_1.assertSnapshotData)(notificationBoxDocumentInTransaction);
76
+ return initializeNotificationModelInTransaction({
77
+ makeTemplateFunction: makeTemplateForNotificationBoxInitialization,
78
+ throwErrorIfAlreadyInitialized,
79
+ transaction,
80
+ document: notificationBoxDocumentInTransaction,
81
+ data: notificationBox
82
+ });
83
+ };
84
+ }
85
+ exports.initializeNotificationBoxInTransactionFactory = initializeNotificationBoxInTransactionFactory;
86
+ function initializeNotificationBoxFactory(context) {
87
+ const { firestoreContext, firebaseServerActionTransformFunctionFactory } = context;
88
+ const initializeNotificationBoxInTransaction = initializeNotificationBoxInTransactionFactory(context);
89
+ return firebaseServerActionTransformFunctionFactory(firebase_1.InitializeNotificationModelParams, async (params) => {
90
+ return async (notificationBoxDocument) => {
91
+ await firestoreContext.runTransaction((transaction) => initializeNotificationBoxInTransaction(params, notificationBoxDocument, transaction));
92
+ return notificationBoxDocument;
93
+ };
94
+ });
95
+ }
96
+ exports.initializeNotificationBoxFactory = initializeNotificationBoxFactory;
97
+ function initializeAllApplicableNotificationBoxesFactory(context) {
98
+ const { firestoreContext, firebaseServerActionTransformFunctionFactory, notificationBoxCollection, notificationCollectionGroup } = context;
99
+ const initializeNotificationBoxInTransaction = initializeNotificationBoxInTransactionFactory(context);
100
+ return firebaseServerActionTransformFunctionFactory(firebase_1.InitializeAllApplicableNotificationBoxesParams, async () => {
101
+ return async () => {
102
+ let notificationBoxesVisited = 0;
103
+ let notificationBoxesSucceeded = 0;
104
+ let notificationBoxesFailed = 0;
105
+ let notificationBoxesAlreadyInitialized = 0;
106
+ const initializeNotificationBoxParams = { key: (0, firebase_1.firestoreDummyKey)(), throwErrorIfAlreadyInitialized: false };
107
+ async function initializeNotificationBoxes() {
108
+ const query = notificationBoxCollection.queryDocument((0, firebase_1.notificationBoxesFlaggedForNeedsInitializationQuery)());
109
+ const notificationBoxDocuments = await query.getDocs();
110
+ const result = await (0, util_1.performAsyncTasks)(notificationBoxDocuments, async (notificationBoxDocument) => {
111
+ return firestoreContext.runTransaction((transaction) => initializeNotificationBoxInTransaction(initializeNotificationBoxParams, notificationBoxDocument, transaction));
112
+ }, {
113
+ maxParallelTasks: 5
114
+ });
115
+ return result;
116
+ }
117
+ // iterate through all JobApplication items that need to be synced
118
+ while (true) {
119
+ const initializeNotificationBoxesResults = await initializeNotificationBoxes();
120
+ initializeNotificationBoxesResults.results.forEach((x) => {
121
+ const result = x[1];
122
+ if (result.alreadyInitialized) {
123
+ notificationBoxesAlreadyInitialized += 1;
124
+ }
125
+ else if (result.initialized) {
126
+ notificationBoxesSucceeded += 1;
127
+ }
128
+ else {
129
+ notificationBoxesFailed += 1;
130
+ }
131
+ });
132
+ const found = initializeNotificationBoxesResults.results.length;
133
+ notificationBoxesVisited += found;
134
+ if (!found) {
135
+ break;
136
+ }
137
+ }
138
+ const result = {
139
+ notificationBoxesVisited,
140
+ notificationBoxesSucceeded,
141
+ notificationBoxesFailed,
142
+ notificationBoxesAlreadyInitialized
143
+ };
144
+ return result;
145
+ };
146
+ });
147
+ }
148
+ exports.initializeAllApplicableNotificationBoxesFactory = initializeAllApplicableNotificationBoxesFactory;
149
+ function initializeNotificationSummaryInTransactionFactory(context) {
150
+ const { notificationSummaryCollection, makeTemplateForNotificationSummaryInitialization } = context;
151
+ return async (params, notificationSummaryDocument, transaction) => {
152
+ const { throwErrorIfAlreadyInitialized } = params;
153
+ const notificationSummaryDocumentInTransaction = notificationSummaryCollection.documentAccessorForTransaction(transaction).loadDocumentFrom(notificationSummaryDocument);
154
+ const notificationSummary = await (0, firebase_server_1.assertSnapshotData)(notificationSummaryDocumentInTransaction);
155
+ return initializeNotificationModelInTransaction({
156
+ makeTemplateFunction: makeTemplateForNotificationSummaryInitialization,
157
+ throwErrorIfAlreadyInitialized,
158
+ transaction,
159
+ document: notificationSummaryDocumentInTransaction,
160
+ data: notificationSummary
161
+ });
162
+ };
163
+ }
164
+ exports.initializeNotificationSummaryInTransactionFactory = initializeNotificationSummaryInTransactionFactory;
165
+ function initializeNotificationSummaryFactory(context) {
166
+ const { firestoreContext, firebaseServerActionTransformFunctionFactory } = context;
167
+ const initializeNotificationSummaryInTransaction = initializeNotificationSummaryInTransactionFactory(context);
168
+ return firebaseServerActionTransformFunctionFactory(firebase_1.InitializeNotificationModelParams, async (params) => {
169
+ return async (notificationSummaryDocument) => {
170
+ await firestoreContext.runTransaction((transaction) => initializeNotificationSummaryInTransaction(params, notificationSummaryDocument, transaction));
171
+ return notificationSummaryDocument;
172
+ };
173
+ });
174
+ }
175
+ exports.initializeNotificationSummaryFactory = initializeNotificationSummaryFactory;
176
+ function initializeAllApplicableNotificationSummariesFactory(context) {
177
+ const { firestoreContext, firebaseServerActionTransformFunctionFactory, notificationSummaryCollection, notificationCollectionGroup } = context;
178
+ const initializeNotificationSummaryInTransaction = initializeNotificationSummaryInTransactionFactory(context);
179
+ return firebaseServerActionTransformFunctionFactory(firebase_1.InitializeAllApplicableNotificationSummariesParams, async () => {
180
+ return async () => {
181
+ let notificationSummariesVisited = 0;
182
+ let notificationSummariesSucceeded = 0;
183
+ let notificationSummariesFailed = 0;
184
+ let notificationSummariesAlreadyInitialized = 0;
185
+ const initializeNotificationSummaryParams = { key: (0, firebase_1.firestoreDummyKey)(), throwErrorIfAlreadyInitialized: false };
186
+ async function initializeNotificationSummaries() {
187
+ const query = notificationSummaryCollection.queryDocument((0, firebase_1.notificationSummariesFlaggedForNeedsInitializationQuery)());
188
+ const notificationSummaryDocuments = await query.getDocs();
189
+ const result = await (0, util_1.performAsyncTasks)(notificationSummaryDocuments, async (notificationSummaryDocument) => {
190
+ return firestoreContext.runTransaction((transaction) => initializeNotificationSummaryInTransaction(initializeNotificationSummaryParams, notificationSummaryDocument, transaction));
191
+ }, {
192
+ maxParallelTasks: 5
193
+ });
194
+ return result;
195
+ }
196
+ // iterate through all JobApplication items that need to be synced
197
+ while (true) {
198
+ const initializeNotificationSummariesResults = await initializeNotificationSummaries();
199
+ initializeNotificationSummariesResults.results.forEach((x) => {
200
+ const result = x[1];
201
+ if (result.alreadyInitialized) {
202
+ notificationSummariesAlreadyInitialized += 1;
203
+ }
204
+ else if (result.initialized) {
205
+ notificationSummariesSucceeded += 1;
206
+ }
207
+ else {
208
+ notificationSummariesFailed += 1;
209
+ }
210
+ });
211
+ const found = initializeNotificationSummariesResults.results.length;
212
+ notificationSummariesVisited += found;
213
+ if (!found) {
214
+ break;
215
+ }
216
+ }
217
+ const result = {
218
+ notificationSummariesVisited,
219
+ notificationSummariesSucceeded,
220
+ notificationSummariesFailed,
221
+ notificationSummariesAlreadyInitialized
222
+ };
223
+ return result;
224
+ };
225
+ });
226
+ }
227
+ exports.initializeAllApplicableNotificationSummariesFactory = initializeAllApplicableNotificationSummariesFactory;
228
+ //# sourceMappingURL=notification.action.init.server.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"notification.action.init.server.js","sourceRoot":"","sources":["../../../../../../../packages/firebase-server/model/src/lib/notification/notification.action.init.server.ts"],"names":[],"mappings":";;;AAAA,gDA0B2B;AAC3B,8DAAiG;AACjG,wCAA8D;AAE9D,6DAAgF;AAGhF,mDAAmD;AACnD;;GAEG;AACU,QAAA,qDAAqD,GAAmB,iDAAiD,CAAC;AAsB1H,QAAA,oFAAoF,GAAG,KAAK,CAAC;AAqB1G,MAAsB,6BAA6B;CAKlD;AALD,sEAKC;AAED,SAAgB,6BAA6B,CAAC,OAA6C;IACzF,OAAO;QACL,yBAAyB,EAAE,gCAAgC,CAAC,OAAO,CAAC;QACpE,wCAAwC,EAAE,+CAA+C,CAAC,OAAO,CAAC;QAClG,6BAA6B,EAAE,oCAAoC,CAAC,OAAO,CAAC;QAC5E,4CAA4C,EAAE,mDAAmD,CAAC,OAAO,CAAC;KAC3G,CAAC;AACJ,CAAC;AAPD,sEAOC;AAUM,KAAK,UAAU,wCAAwC,CAAiE,KAAuD;IACpL,MAAM,EAAE,oBAAoB,EAAE,8BAA8B,EAAE,WAAW,EAAE,QAAQ,EAAE,qBAAqB,EAAE,IAAI,EAAE,eAAe,EAAE,GAAG,KAAK,CAAC;IAE5I,IAAI,WAAW,GAAY,KAAK,CAAC;IACjC,MAAM,kBAAkB,GAAY,CAAC,eAAe,CAAC,CAAC,CAAC;IAEvD,IAAI,CAAC,kBAAkB,EAAE;QACvB,MAAM,YAAY,GAAG,qBAAqB,CAAC,EAAE,CAAC;QAC9C,MAAM,QAAQ,GAAG,IAAA,kDAAuC,EAAC,YAAY,CAAC,CAAC;QACvE,MAAM,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