@memberjunction/communication-types 1.5.3

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.
@@ -0,0 +1,43 @@
1
+ import { BaseEngine, UserInfo } from "@memberjunction/core";
2
+ import { CommunicationBaseMessageTypeEntity, CommunicationLogEntity, CommunicationRunEntity } from "@memberjunction/core-entities";
3
+ import { CommunicationProviderEntityExtended, ProcessedMessage } from "./BaseProvider";
4
+ /**
5
+ * Base class for communications. This class can be sub-classed if desired if you would like to modify the logic across ALL actions. To do so, sub-class this class and use the
6
+ * @RegisterClass decorator from the @memberjunction/global package to register your sub-class with the ClassFactory. This will cause your sub-class to be used instead of this base class when the Metadata object insantiates the ActionEngine.
7
+ */
8
+ export declare class CommunicationEngineBase extends BaseEngine<CommunicationEngineBase> {
9
+ /**
10
+ * Returns the global instance of the class. This is a singleton class, so there is only one instance of it in the application. Do not directly create new instances of it, always use this method to get the instance.
11
+ */
12
+ static get Instance(): CommunicationEngineBase;
13
+ private _BaseMessageTypes;
14
+ private _Providers;
15
+ private _ProviderMessageTypes;
16
+ /**
17
+ * This method is called to configure the engine. It loads the metadata and caches it in the GlobalObjectStore. You must call this method before doing anything else with the engine.
18
+ * If this method was previously run on the instance of the engine, it will return immediately without re-loading the metadata. If you want to force a reload of the metadata, you can pass true for the forceReload parameter.
19
+ * @param forceRefresh If true, the metadata will be loaded from the database even if it was previously loaded.
20
+ * @param contextUser If you are running on the server side you must pass this in, but it is not required in an environment where a user is authenticated directly, e.g. a browser or other client.
21
+ */
22
+ Config(forceRefresh?: boolean, contextUser?: UserInfo): Promise<void>;
23
+ protected AdditionalLoading(contextUser?: UserInfo): Promise<void>;
24
+ get BaseMessageTypes(): CommunicationBaseMessageTypeEntity[];
25
+ get Providers(): CommunicationProviderEntityExtended[];
26
+ /**
27
+ * Starts a communication run
28
+ */
29
+ protected StartRun(): Promise<CommunicationRunEntity>;
30
+ /**
31
+ * Ends a communication run
32
+ * @param run
33
+ * @returns
34
+ */
35
+ protected EndRun(run: CommunicationRunEntity): Promise<boolean>;
36
+ /**
37
+ * This method creates a new Communication Log record and saves it to the database with a status of pending. It returns the new Communication Log record.
38
+ * @param processedMessage
39
+ * @param run
40
+ */
41
+ protected StartLog(processedMessage: ProcessedMessage, run?: CommunicationRunEntity): Promise<CommunicationLogEntity>;
42
+ }
43
+ //# sourceMappingURL=BaseEngine.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BaseEngine.d.ts","sourceRoot":"","sources":["../src/BaseEngine.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAY,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AACtE,OAAO,EAAE,kCAAkC,EAAE,sBAAsB,EAA0C,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AAC3K,OAAO,EAAE,mCAAmC,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAGvF;;;GAGG;AACH,qBAAa,uBAAwB,SAAQ,UAAU,CAAC,uBAAuB,CAAC;IAC5E;;OAEG;IACH,WAAkB,QAAQ,IAAI,uBAAuB,CAEpD;IAEA,OAAO,CAAC,iBAAiB,CAAuC;IAChE,OAAO,CAAC,UAAU,CAAwC;IAC1D,OAAO,CAAC,qBAAqB,CAA2C;IAExE;;;;;OAKG;IACU,MAAM,CAAC,YAAY,GAAE,OAAe,EAAE,WAAW,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;cAmBhE,iBAAiB,CAAC,WAAW,CAAC,EAAE,QAAQ;IAOjE,IAAW,gBAAgB,IAAI,kCAAkC,EAAE,CAIlE;IACD,IAAW,SAAS,IAAI,mCAAmC,EAAE,CAI5D;IAGD;;OAEG;cACa,QAAQ,IAAI,OAAO,CAAC,sBAAsB,CAAC;IAc3D;;;;OAIG;cACa,MAAM,CAAC,GAAG,EAAE,sBAAsB,GAAG,OAAO,CAAC,OAAO,CAAC;IAMrE;;;;OAIG;cACa,QAAQ,CAAC,gBAAgB,EAAE,gBAAgB,EAAE,GAAG,CAAC,EAAE,sBAAsB,GAAG,OAAO,CAAC,sBAAsB,CAAC;CAsB/H"}
@@ -0,0 +1,110 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CommunicationEngineBase = void 0;
4
+ const core_1 = require("@memberjunction/core");
5
+ /**
6
+ * Base class for communications. This class can be sub-classed if desired if you would like to modify the logic across ALL actions. To do so, sub-class this class and use the
7
+ * @RegisterClass decorator from the @memberjunction/global package to register your sub-class with the ClassFactory. This will cause your sub-class to be used instead of this base class when the Metadata object insantiates the ActionEngine.
8
+ */
9
+ class CommunicationEngineBase extends core_1.BaseEngine {
10
+ /**
11
+ * Returns the global instance of the class. This is a singleton class, so there is only one instance of it in the application. Do not directly create new instances of it, always use this method to get the instance.
12
+ */
13
+ static get Instance() {
14
+ return super.getInstance();
15
+ }
16
+ /**
17
+ * This method is called to configure the engine. It loads the metadata and caches it in the GlobalObjectStore. You must call this method before doing anything else with the engine.
18
+ * If this method was previously run on the instance of the engine, it will return immediately without re-loading the metadata. If you want to force a reload of the metadata, you can pass true for the forceReload parameter.
19
+ * @param forceRefresh If true, the metadata will be loaded from the database even if it was previously loaded.
20
+ * @param contextUser If you are running on the server side you must pass this in, but it is not required in an environment where a user is authenticated directly, e.g. a browser or other client.
21
+ */
22
+ async Config(forceRefresh = false, contextUser) {
23
+ const config = [
24
+ {
25
+ EntityName: 'Communication Base Message Types',
26
+ PropertyName: '_BaseMessageTypes'
27
+ },
28
+ {
29
+ EntityName: 'Communication Providers',
30
+ PropertyName: '_Providers'
31
+ },
32
+ {
33
+ EntityName: 'Communication Provider Message Types',
34
+ PropertyName: '_ProviderMessageTypes'
35
+ }
36
+ ];
37
+ await this.Load(config, forceRefresh, contextUser);
38
+ }
39
+ async AdditionalLoading(contextUser) {
40
+ // a little post-processing done within the context of the base classes loading architecture...
41
+ this._Providers.forEach((provider) => {
42
+ provider.MessageTypes = this._ProviderMessageTypes.filter((pmt) => pmt.CommunicationProviderID === provider.ID);
43
+ });
44
+ }
45
+ get BaseMessageTypes() {
46
+ if (!this.Loaded)
47
+ throw new Error(`Metadata not loaded. Call Config() before accessing metadata.`);
48
+ return this._BaseMessageTypes;
49
+ }
50
+ get Providers() {
51
+ if (!this.Loaded)
52
+ throw new Error(`Metadata not loaded. Call Config() before accessing metadata.`);
53
+ return this._Providers;
54
+ }
55
+ /**
56
+ * Starts a communication run
57
+ */
58
+ async StartRun() {
59
+ const md = new core_1.Metadata();
60
+ const run = await md.GetEntityObject('Communication Runs', this.ContextUser);
61
+ run.Status = 'Pending';
62
+ run.Direction = 'Sending';
63
+ run.StartedAt = new Date();
64
+ run.UserID = this.ContextUser.ID;
65
+ if (await run.Save()) {
66
+ return run;
67
+ }
68
+ else
69
+ return null;
70
+ }
71
+ /**
72
+ * Ends a communication run
73
+ * @param run
74
+ * @returns
75
+ */
76
+ async EndRun(run) {
77
+ run.Status = 'Complete';
78
+ run.EndedAt = new Date();
79
+ return await run.Save();
80
+ }
81
+ /**
82
+ * This method creates a new Communication Log record and saves it to the database with a status of pending. It returns the new Communication Log record.
83
+ * @param processedMessage
84
+ * @param run
85
+ */
86
+ async StartLog(processedMessage, run) {
87
+ const md = new core_1.Metadata();
88
+ const log = await md.GetEntityObject('Communication Logs', this.ContextUser);
89
+ log.CommunicationRunID = run?.ID;
90
+ log.Status = 'Pending';
91
+ log.CommunicationProviderID = processedMessage.MessageType.CommunicationProviderID;
92
+ log.CommunicationProviderMessageTypeID = processedMessage.MessageType.ID;
93
+ log.MessageDate = new Date();
94
+ log.Direction = 'Sending';
95
+ log.MessageContent = JSON.stringify({
96
+ To: processedMessage.To,
97
+ From: processedMessage.From,
98
+ Subject: processedMessage.ProcessedSubject,
99
+ HTMLBody: processedMessage.ProcessedHTMLBody,
100
+ TextBody: processedMessage.ProcessedBody,
101
+ });
102
+ if (await log.Save()) {
103
+ return log;
104
+ }
105
+ else
106
+ return null;
107
+ }
108
+ }
109
+ exports.CommunicationEngineBase = CommunicationEngineBase;
110
+ //# sourceMappingURL=BaseEngine.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BaseEngine.js","sourceRoot":"","sources":["../src/BaseEngine.ts"],"names":[],"mappings":";;;AAAA,+CAAsE;AAKtE;;;GAGG;AACH,MAAa,uBAAwB,SAAQ,iBAAmC;IAC5E;;OAEG;IACI,MAAM,KAAK,QAAQ;QACvB,OAAO,KAAK,CAAC,WAAW,EAA2B,CAAC;IACvD,CAAC;IAMA;;;;;OAKG;IACI,KAAK,CAAC,MAAM,CAAC,eAAwB,KAAK,EAAE,WAAsB;QACtE,MAAM,MAAM,GAAG;YACX;gBACI,UAAU,EAAE,kCAAkC;gBAC9C,YAAY,EAAE,mBAAmB;aACpC;YACD;gBACI,UAAU,EAAE,yBAAyB;gBACrC,YAAY,EAAE,YAAY;aAC7B;YACD;gBACI,UAAU,EAAE,sCAAsC;gBAClD,YAAY,EAAE,uBAAuB;aACxC;SAAC,CAAA;QAEN,MAAM,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,YAAY,EAAE,WAAW,CAAC,CAAC;IAEtD,CAAC;IAEkB,KAAK,CAAC,iBAAiB,CAAC,WAAsB;QAC9D,+FAA+F;QAC/F,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,QAAQ,EAAE,EAAE;YACjC,QAAQ,CAAC,YAAY,GAAG,IAAI,CAAC,qBAAqB,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,uBAAuB,KAAK,QAAQ,CAAC,EAAE,CAAC,CAAC;QACpH,CAAC,CAAC,CAAC;IACN,CAAC;IAED,IAAW,gBAAgB;QACxB,IAAI,CAAC,IAAI,CAAC,MAAM;YACZ,MAAM,IAAI,KAAK,CAAC,+DAA+D,CAAC,CAAC;QACrF,OAAO,IAAI,CAAC,iBAAiB,CAAC;IACjC,CAAC;IACD,IAAW,SAAS;QACjB,IAAI,CAAC,IAAI,CAAC,MAAM;YACZ,MAAM,IAAI,KAAK,CAAC,+DAA+D,CAAC,CAAC;QACrF,OAAO,IAAI,CAAC,UAAU,CAAC;IAC1B,CAAC;IAGD;;OAEG;IACO,KAAK,CAAC,QAAQ;QACrB,MAAM,EAAE,GAAG,IAAI,eAAQ,EAAE,CAAC;QAC1B,MAAM,GAAG,GAAG,MAAM,EAAE,CAAC,eAAe,CAAyB,oBAAoB,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;QACrG,GAAG,CAAC,MAAM,GAAG,SAAS,CAAC;QACvB,GAAG,CAAC,SAAS,GAAG,SAAS,CAAC;QAC1B,GAAG,CAAC,SAAS,GAAG,IAAI,IAAI,EAAE,CAAC;QAC3B,GAAG,CAAC,MAAM,GAAG,IAAI,CAAC,WAAW,CAAC,EAAE,CAAC;QACjC,IAAI,MAAM,GAAG,CAAC,IAAI,EAAE,EAAE,CAAC;YACnB,OAAO,GAAG,CAAC;QACf,CAAC;;YAEG,OAAO,IAAI,CAAC;IACnB,CAAC;IAED;;;;OAIG;IACO,KAAK,CAAC,MAAM,CAAC,GAA2B;QAC/C,GAAG,CAAC,MAAM,GAAG,UAAU,CAAC;QACxB,GAAG,CAAC,OAAO,GAAG,IAAI,IAAI,EAAE,CAAC;QACzB,OAAO,MAAM,GAAG,CAAC,IAAI,EAAE,CAAC;IAC3B,CAAC;IAED;;;;OAIG;IACO,KAAK,CAAC,QAAQ,CAAC,gBAAkC,EAAE,GAA4B;QACtF,MAAM,EAAE,GAAG,IAAI,eAAQ,EAAE,CAAC;QAC1B,MAAM,GAAG,GAAG,MAAM,EAAE,CAAC,eAAe,CAAyB,oBAAoB,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;QACrG,GAAG,CAAC,kBAAkB,GAAG,GAAG,EAAE,EAAE,CAAC;QACjC,GAAG,CAAC,MAAM,GAAG,SAAS,CAAC;QACvB,GAAG,CAAC,uBAAuB,GAAG,gBAAgB,CAAC,WAAW,CAAC,uBAAuB,CAAC;QACnF,GAAG,CAAC,kCAAkC,GAAG,gBAAgB,CAAC,WAAW,CAAC,EAAE,CAAC;QACzE,GAAG,CAAC,WAAW,GAAG,IAAI,IAAI,EAAE,CAAC;QAC7B,GAAG,CAAC,SAAS,GAAG,SAAS,CAAC;QAC1B,GAAG,CAAC,cAAc,GAAG,IAAI,CAAC,SAAS,CAAC;YAChC,EAAE,EAAE,gBAAgB,CAAC,EAAE;YACvB,IAAI,EAAE,gBAAgB,CAAC,IAAI;YAC3B,OAAO,EAAE,gBAAgB,CAAC,gBAAgB;YAC1C,QAAQ,EAAE,gBAAgB,CAAC,iBAAiB;YAC5C,QAAQ,EAAE,gBAAgB,CAAC,aAAa;SAC3C,CAAC,CAAC;QACH,IAAI,MAAM,GAAG,CAAC,IAAI,EAAE,EAAE,CAAC;YACnB,OAAO,GAAG,CAAC;QACf,CAAC;;YAEG,OAAO,IAAI,CAAC;IACnB,CAAC;CACL;AA/GD,0DA+GC"}
@@ -0,0 +1,119 @@
1
+ import { UserInfo } from "@memberjunction/core";
2
+ import { CommunicationProviderEntity, CommunicationProviderMessageTypeEntity, CommunicationRunEntity } from "@memberjunction/core-entities";
3
+ import { TemplateEntityExtended } from "@memberjunction/templates-base-types";
4
+ /**
5
+ * Information about a single recipient
6
+ */
7
+ export declare class MessageRecipient {
8
+ /**
9
+ * The address is the "TO" field for the message and would be either an email, phone #, social handle, etc
10
+ * it is provider-specific and can be anything that the provider supports as a recipient
11
+ */
12
+ To: string;
13
+ /**
14
+ * The full name of the recipient, if available
15
+ */
16
+ FullName?: string;
17
+ /**
18
+ * When using templates, this is the context data that is used to render the template for this recipient
19
+ */
20
+ ContextData: any;
21
+ }
22
+ /**
23
+ * Message class, holds information and functionality specific to a single message
24
+ */
25
+ export declare class Message {
26
+ /**
27
+ * The type of message to send
28
+ */
29
+ MessageType: CommunicationProviderMessageTypeEntity;
30
+ /**
31
+ * The sender of the message, typically an email address but can be anything that is provider-specific for example for a provider that is a social
32
+ * media provider, it might be a user's social media handle
33
+ */
34
+ From: string;
35
+ /**
36
+ * The recipient of the message, typically an email address but can be anything that is provider-specific for example for a provider that is a social
37
+ * media provider, it might be a user's social media handle
38
+ */
39
+ To: string;
40
+ /**
41
+ * The body of the message, used if BodyTemplate is not provided.
42
+ */
43
+ Body?: string;
44
+ /**
45
+ * Optional, when provided, Body is ignored and the template is used to render the message. In addition,
46
+ * if BodyTemplate is provided it will be used to render the Body and if the template has HTML content it will
47
+ * also be used to render the HTMLBody
48
+ */
49
+ BodyTemplate?: TemplateEntityExtended;
50
+ /**
51
+ * The HTML body of the message
52
+ */
53
+ HTMLBody?: string;
54
+ /**
55
+ * Optional, when provided, HTMLBody is ignored and the template is used to render the message. This OVERRIDES
56
+ * the BodyTemplate's HTML content even if BodyTemplate is provided. This allows for flexibility in that you can
57
+ * specify a completely different HTMLBodyTemplate and not just relay on the TemplateContent of the BodyTemplate having
58
+ * an HTML option.
59
+ */
60
+ HTMLBodyTemplate?: TemplateEntityExtended;
61
+ /**
62
+ * The subject line for the message, used if SubjectTemplate is not provided and only supported by some providers
63
+ */
64
+ Subject?: string;
65
+ /**
66
+ * Optional, when provided, Subject is ignored and the template is used to render the message
67
+ */
68
+ SubjectTemplate?: TemplateEntityExtended;
69
+ /**
70
+ * Optional, any context data that is needed to render the message template
71
+ */
72
+ ContextData?: any;
73
+ constructor(copyFrom?: Message);
74
+ }
75
+ /**
76
+ * This class is used to hold the results of a pre-processed message. This is used to hold the results of processing a message, for example, rendering a template.
77
+ */
78
+ export declare abstract class ProcessedMessage extends Message {
79
+ /**
80
+ * The body of the message after processing
81
+ */
82
+ ProcessedBody: string;
83
+ /**
84
+ * The HTML body of the message after processing
85
+ */
86
+ ProcessedHTMLBody: string;
87
+ /**
88
+ * The subject of the message after processing
89
+ */
90
+ ProcessedSubject: string;
91
+ abstract Process(forceTemplateRefresh?: boolean, contextUser?: UserInfo): Promise<{
92
+ Success: boolean;
93
+ Message?: string;
94
+ }>;
95
+ }
96
+ /**
97
+ * MessageResult class, holds information and functionality specific to a single message result
98
+ */
99
+ export declare class MessageResult {
100
+ Run?: CommunicationRunEntity;
101
+ Message: ProcessedMessage;
102
+ Success: boolean;
103
+ Error: string;
104
+ }
105
+ /**
106
+ * Base class for all communication providers. Each provider sub-classes this base class and implements functionality specific to the provider.
107
+ */
108
+ export declare abstract class BaseCommunicationProvider {
109
+ /**
110
+ *
111
+ */
112
+ abstract SendSingleMessage(message: ProcessedMessage): Promise<MessageResult>;
113
+ }
114
+ export declare class CommunicationProviderEntityExtended extends CommunicationProviderEntity {
115
+ private _ProviderMessageTypes;
116
+ get MessageTypes(): CommunicationProviderMessageTypeEntity[];
117
+ set MessageTypes(value: CommunicationProviderMessageTypeEntity[]);
118
+ }
119
+ //# sourceMappingURL=BaseProvider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BaseProvider.d.ts","sourceRoot":"","sources":["../src/BaseProvider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAE5D,OAAO,EAAE,2BAA2B,EAAE,sCAAsC,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AAC5I,OAAO,EAAE,sBAAsB,EAAE,MAAM,sCAAsC,CAAC;AAE9E;;GAEG;AACH,qBAAa,gBAAgB;IACzB;;;OAGG;IACI,EAAE,EAAE,MAAM,CAAC;IAClB;;OAEG;IACI,QAAQ,CAAC,EAAE,MAAM,CAAC;IAEzB;;OAEG;IACI,WAAW,EAAE,GAAG,CAAC;CAC3B;AAGD;;GAEG;AACH,qBAAa,OAAO;IAChB;;OAEG;IACI,WAAW,EAAE,sCAAsC,CAAC;IAE3D;;;OAGG;IACI,IAAI,EAAE,MAAM,CAAC;IAEpB;;;OAGG;IACI,EAAE,EAAE,MAAM,CAAC;IAElB;;OAEG;IACI,IAAI,CAAC,EAAE,MAAM,CAAC;IACrB;;;;OAIG;IACI,YAAY,CAAC,EAAE,sBAAsB,CAAC;IAE7C;;OAEG;IACI,QAAQ,CAAC,EAAE,MAAM,CAAC;IACzB;;;;;OAKG;IACI,gBAAgB,CAAC,EAAE,sBAAsB,CAAC;IAEjD;;OAEG;IACI,OAAO,CAAC,EAAE,MAAM,CAAC;IACxB;;OAEG;IACI,eAAe,CAAC,EAAE,sBAAsB,CAAC;IAEhD;;OAEG;IACI,WAAW,CAAC,EAAE,GAAG,CAAC;gBAEb,QAAQ,CAAC,EAAE,OAAO;CAKjC;AAED;;GAEG;AACH,8BAAsB,gBAAiB,SAAQ,OAAO;IAClD;;OAEG;IACI,aAAa,EAAE,MAAM,CAAC;IAE7B;;OAEG;IACI,iBAAiB,EAAE,MAAM,CAAA;IAEhC;;OAEG;IACI,gBAAgB,EAAE,MAAM,CAAC;aAGhB,OAAO,CAAC,oBAAoB,CAAC,EAAE,OAAO,EAAE,WAAW,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC;QAAC,OAAO,EAAE,OAAO,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAC,CAAC;CACjI;AAED;;GAEG;AACH,qBAAa,aAAa;IACf,GAAG,CAAC,EAAE,sBAAsB,CAAC;IAC7B,OAAO,EAAE,gBAAgB,CAAC;IAC1B,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;CACxB;AAED;;GAEG;AACH,8BAAsB,yBAAyB;IAC3C;;OAEG;aACa,iBAAiB,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,aAAa,CAAC;CACvF;AAED,qBACa,mCAAoC,SAAQ,2BAA2B;IAChF,OAAO,CAAC,qBAAqB,CAA2C;IACxE,IAAW,YAAY,IAAI,sCAAsC,EAAE,CAElE;IACD,IAAW,YAAY,CAAC,KAAK,EAAE,sCAAsC,EAAE,EAEtE;CACJ"}
@@ -0,0 +1,60 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.CommunicationProviderEntityExtended = exports.BaseCommunicationProvider = exports.MessageResult = exports.ProcessedMessage = exports.Message = exports.MessageRecipient = void 0;
10
+ const core_1 = require("@memberjunction/core");
11
+ const global_1 = require("@memberjunction/global");
12
+ const core_entities_1 = require("@memberjunction/core-entities");
13
+ /**
14
+ * Information about a single recipient
15
+ */
16
+ class MessageRecipient {
17
+ }
18
+ exports.MessageRecipient = MessageRecipient;
19
+ /**
20
+ * Message class, holds information and functionality specific to a single message
21
+ */
22
+ class Message {
23
+ constructor(copyFrom) {
24
+ // copy all properties from the message to us, used for copying a message
25
+ if (copyFrom)
26
+ Object.assign(this, copyFrom);
27
+ }
28
+ }
29
+ exports.Message = Message;
30
+ /**
31
+ * This class is used to hold the results of a pre-processed message. This is used to hold the results of processing a message, for example, rendering a template.
32
+ */
33
+ class ProcessedMessage extends Message {
34
+ }
35
+ exports.ProcessedMessage = ProcessedMessage;
36
+ /**
37
+ * MessageResult class, holds information and functionality specific to a single message result
38
+ */
39
+ class MessageResult {
40
+ }
41
+ exports.MessageResult = MessageResult;
42
+ /**
43
+ * Base class for all communication providers. Each provider sub-classes this base class and implements functionality specific to the provider.
44
+ */
45
+ class BaseCommunicationProvider {
46
+ }
47
+ exports.BaseCommunicationProvider = BaseCommunicationProvider;
48
+ let CommunicationProviderEntityExtended = class CommunicationProviderEntityExtended extends core_entities_1.CommunicationProviderEntity {
49
+ get MessageTypes() {
50
+ return this._ProviderMessageTypes;
51
+ }
52
+ set MessageTypes(value) {
53
+ this._ProviderMessageTypes = value;
54
+ }
55
+ };
56
+ exports.CommunicationProviderEntityExtended = CommunicationProviderEntityExtended;
57
+ exports.CommunicationProviderEntityExtended = CommunicationProviderEntityExtended = __decorate([
58
+ (0, global_1.RegisterClass)(core_1.BaseEntity, 'Communication Providers') // sub-class to extend the properties of the base entity
59
+ ], CommunicationProviderEntityExtended);
60
+ //# sourceMappingURL=BaseProvider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BaseProvider.js","sourceRoot":"","sources":["../src/BaseProvider.ts"],"names":[],"mappings":";;;;;;;;;AAAA,+CAA4D;AAC5D,mDAAuD;AACvD,iEAA4I;AAG5I;;GAEG;AACH,MAAa,gBAAgB;CAe5B;AAfD,4CAeC;AAGD;;GAEG;AACH,MAAa,OAAO;IAuDhB,YAAY,QAAkB;QAC1B,yEAAyE;QACzE,IAAI,QAAQ;YACR,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;IACtC,CAAC;CACJ;AA5DD,0BA4DC;AAED;;GAEG;AACH,MAAsB,gBAAiB,SAAQ,OAAO;CAkBrD;AAlBD,4CAkBC;AAED;;GAEG;AACH,MAAa,aAAa;CAKzB;AALD,sCAKC;AAED;;GAEG;AACH,MAAsB,yBAAyB;CAK9C;AALD,8DAKC;AAGM,IAAM,mCAAmC,GAAzC,MAAM,mCAAoC,SAAQ,2CAA2B;IAEhF,IAAW,YAAY;QACnB,OAAO,IAAI,CAAC,qBAAqB,CAAC;IACtC,CAAC;IACD,IAAW,YAAY,CAAC,KAA+C;QACnE,IAAI,CAAC,qBAAqB,GAAG,KAAK,CAAC;IACvC,CAAC;CACJ,CAAA;AARY,kFAAmC;8CAAnC,mCAAmC;IAD/C,IAAA,sBAAa,EAAC,iBAAU,EAAE,yBAAyB,CAAC,CAAC,wDAAwD;GACjG,mCAAmC,CAQ/C"}
@@ -0,0 +1,3 @@
1
+ export * from './BaseEngine';
2
+ export * from './BaseProvider';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,cAAc,cAAc,CAAC;AAC7B,cAAc,gBAAgB,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ // PUBLIC API SURFACE AREA
18
+ __exportStar(require("./BaseEngine"), exports);
19
+ __exportStar(require("./BaseProvider"), exports);
20
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0BAA0B;AAC1B,+CAA6B;AAC7B,iDAA+B"}
package/package.json ADDED
@@ -0,0 +1,28 @@
1
+ {
2
+ "name": "@memberjunction/communication-types",
3
+ "version": "1.5.3",
4
+ "description": "MemberJunction: Communication Framework Library Generic Types",
5
+ "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
7
+ "files": [
8
+ "/dist"
9
+ ],
10
+ "scripts": {
11
+ "start": "ts-node-dev src/index.ts",
12
+ "build": "tsc",
13
+ "test": "echo \"Error: no test specified\" && exit 1"
14
+ },
15
+ "author": "MemberJunction.com",
16
+ "license": "ISC",
17
+ "devDependencies": {
18
+ "ts-node-dev": "^2.0.0",
19
+ "typescript": "^5.4.5"
20
+ },
21
+ "dependencies": {
22
+ "@memberjunction/global": "1.5.3",
23
+ "@memberjunction/core": "1.5.3",
24
+ "@memberjunction/templates-base-types": "1.5.3",
25
+ "@memberjunction/core-entities": "1.5.3",
26
+ "rxjs": "^7.8.1"
27
+ }
28
+ }