@memberjunction/communication-engine 1.8.0 → 2.0.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/dist/Engine.d.ts +2 -2
- package/dist/Engine.d.ts.map +1 -1
- package/dist/Engine.js +19 -14
- package/dist/Engine.js.map +1 -1
- package/package.json +6 -6
package/dist/Engine.d.ts
CHANGED
|
@@ -19,10 +19,10 @@ export declare class CommunicationEngine extends CommunicationEngineBase {
|
|
|
19
19
|
* @param providerMessageTypeName
|
|
20
20
|
* @param message this will be used as a starting point but the To will be replaced with the recipient in the recipients array
|
|
21
21
|
*/
|
|
22
|
-
SendMessages(providerName: string, providerMessageTypeName: string, message: Message, recipients: MessageRecipient[]): Promise<MessageResult[]>;
|
|
22
|
+
SendMessages(providerName: string, providerMessageTypeName: string, message: Message, recipients: MessageRecipient[], previewOnly?: boolean): Promise<MessageResult[]>;
|
|
23
23
|
/**
|
|
24
24
|
* Sends a single message using the specified provider. The provider must be one of the providers that are configured in the system.
|
|
25
25
|
*/
|
|
26
|
-
SendSingleMessage(providerName: string, providerMessageTypeName: string, message: Message, run?: CommunicationRunEntity): Promise<MessageResult>;
|
|
26
|
+
SendSingleMessage(providerName: string, providerMessageTypeName: string, message: Message, run?: CommunicationRunEntity, previewOnly?: boolean): Promise<MessageResult>;
|
|
27
27
|
}
|
|
28
28
|
//# sourceMappingURL=Engine.d.ts.map
|
package/dist/Engine.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Engine.d.ts","sourceRoot":"","sources":["../src/Engine.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,uBAAuB,EAAE,OAAO,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,qCAAqC,CAAC;AACnJ,OAAO,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AAKvE;;;GAGG;AACH,qBAAa,mBAAoB,SAAQ,uBAAuB;IAC5D,WAAkB,QAAQ,IAAI,mBAAmB,CAEhD;IAEA;;;;OAIG;IACI,WAAW,CAAC,YAAY,EAAE,MAAM,GAAG,yBAAyB;IAkBnE;;;;;;OAMG;IACU,YAAY,CAAC,YAAY,EAAE,MAAM,EAAE,uBAAuB,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"Engine.d.ts","sourceRoot":"","sources":["../src/Engine.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,uBAAuB,EAAE,OAAO,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,qCAAqC,CAAC;AACnJ,OAAO,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AAKvE;;;GAGG;AACH,qBAAa,mBAAoB,SAAQ,uBAAuB;IAC5D,WAAkB,QAAQ,IAAI,mBAAmB,CAEhD;IAEA;;;;OAIG;IACI,WAAW,CAAC,YAAY,EAAE,MAAM,GAAG,yBAAyB;IAkBnE;;;;;;OAMG;IACU,YAAY,CAAC,YAAY,EAAE,MAAM,EAAE,uBAAuB,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,EAAE,WAAW,GAAE,OAAe,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC;IAoB1L;;OAEG;IACU,iBAAiB,CAAC,YAAY,EAAE,MAAM,EAAE,uBAAuB,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,CAAC,EAAE,sBAAsB,EAAE,WAAW,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,aAAa,CAAC;CA6CxL"}
|
package/dist/Engine.js
CHANGED
|
@@ -39,7 +39,7 @@ class CommunicationEngine extends communication_types_1.CommunicationEngineBase
|
|
|
39
39
|
* @param providerMessageTypeName
|
|
40
40
|
* @param message this will be used as a starting point but the To will be replaced with the recipient in the recipients array
|
|
41
41
|
*/
|
|
42
|
-
async SendMessages(providerName, providerMessageTypeName, message, recipients) {
|
|
42
|
+
async SendMessages(providerName, providerMessageTypeName, message, recipients, previewOnly = false) {
|
|
43
43
|
const run = await this.StartRun();
|
|
44
44
|
if (!run)
|
|
45
45
|
throw new Error(`Failed to start communication run.`);
|
|
@@ -48,7 +48,7 @@ class CommunicationEngine extends communication_types_1.CommunicationEngineBase
|
|
|
48
48
|
const messageCopy = new communication_types_1.Message(message);
|
|
49
49
|
messageCopy.To = r.To;
|
|
50
50
|
messageCopy.ContextData = r.ContextData;
|
|
51
|
-
const result = await this.SendSingleMessage(providerName, providerMessageTypeName, messageCopy, run);
|
|
51
|
+
const result = await this.SendSingleMessage(providerName, providerMessageTypeName, messageCopy, run, previewOnly);
|
|
52
52
|
results.push(result);
|
|
53
53
|
}
|
|
54
54
|
if (!await this.EndRun(run))
|
|
@@ -58,7 +58,7 @@ class CommunicationEngine extends communication_types_1.CommunicationEngineBase
|
|
|
58
58
|
/**
|
|
59
59
|
* Sends a single message using the specified provider. The provider must be one of the providers that are configured in the system.
|
|
60
60
|
*/
|
|
61
|
-
async SendSingleMessage(providerName, providerMessageTypeName, message, run) {
|
|
61
|
+
async SendSingleMessage(providerName, providerMessageTypeName, message, run, previewOnly) {
|
|
62
62
|
if (!this.Loaded)
|
|
63
63
|
throw new Error(`Metadata not loaded. Call Config() before accessing metadata.`);
|
|
64
64
|
const provider = this.GetProvider(providerName);
|
|
@@ -78,21 +78,26 @@ class CommunicationEngine extends communication_types_1.CommunicationEngineBase
|
|
|
78
78
|
const processedMessage = new BaseProvider_1.ProcessedMessageServer(message);
|
|
79
79
|
const processResult = await processedMessage.Process(false, this.ContextUser);
|
|
80
80
|
if (processResult.Success) {
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
log
|
|
86
|
-
if (
|
|
87
|
-
|
|
81
|
+
if (previewOnly) {
|
|
82
|
+
return { Success: true, Error: '', Message: processedMessage };
|
|
83
|
+
}
|
|
84
|
+
else {
|
|
85
|
+
const log = await this.StartLog(processedMessage, run);
|
|
86
|
+
if (log) {
|
|
87
|
+
const sendResult = await provider.SendSingleMessage(processedMessage);
|
|
88
|
+
log.Status = sendResult.Success ? 'Complete' : 'Failed';
|
|
89
|
+
log.ErrorMessage = sendResult.Error;
|
|
90
|
+
if (!await log.Save())
|
|
91
|
+
throw new Error(`Failed to complete log for message.`);
|
|
92
|
+
else
|
|
93
|
+
return sendResult;
|
|
94
|
+
}
|
|
88
95
|
else
|
|
89
|
-
|
|
96
|
+
throw new Error(`Failed to start log for message.`);
|
|
90
97
|
}
|
|
91
|
-
else
|
|
92
|
-
throw new Error(`Failed to start log for message.`);
|
|
93
98
|
}
|
|
94
99
|
else
|
|
95
|
-
throw new Error(`Failed to process message
|
|
100
|
+
throw new Error(`Failed to process message: ${processResult.Message}`);
|
|
96
101
|
}
|
|
97
102
|
}
|
|
98
103
|
exports.CommunicationEngine = CommunicationEngine;
|
package/dist/Engine.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Engine.js","sourceRoot":"","sources":["../src/Engine.ts"],"names":[],"mappings":";;;AAAA,6EAAmJ;AAEnJ,mDAAkD;AAClD,iDAAwD;AAGxD;;;GAGG;AACH,MAAa,mBAAoB,SAAQ,6CAAuB;IACrD,MAAM,KAAK,QAAQ;QACtB,OAAO,KAAK,CAAC,WAAW,EAAuB,CAAC;IACpD,CAAC;IAEA;;;;OAIG;IACI,WAAW,CAAC,YAAoB;QACpC,IAAI,CAAC,IAAI,CAAC,MAAM;YACZ,MAAM,IAAI,KAAK,CAAC,+DAA+D,CAAC,CAAC;QAErF,MAAM,QAAQ,GAAG,iBAAQ,CAAC,QAAQ,CAAC,YAAY,CAAC,cAAc,CAA4B,+CAAyB,EAAE,YAAY,CAAC,CAAC;QACnI,IAAI,QAAQ,EAAE,CAAC;YACX,8HAA8H;YAC9H,4DAA4D;YAC5D,IAAI,QA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,IAAI,CAAC,MAAM,GAAG,CAAC,IAAI,EAAE;wBACjB,MAAM,IAAI,KAAK,CAAC,qCAAqC,CAAC,CAAC;;wBAEvD,OAAO,UAAU,CAAC;gBAC1B,CAAC;;oBAEG,MAAM,IAAI,KAAK,CAAC,kCAAkC,CAAC,CAAC;YAC5D,CAAC;QACL,CAAC;;YAEG,MAAM,IAAI,KAAK,CAAC,8BAA8B,aAAa,CAAC,OAAO,EAAE,CAAC,CAAC;IAC9E,CAAC;CACL;AAvGD,kDAuGC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@memberjunction/communication-engine",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "MemberJunction: Core Communication Framework Library",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -19,11 +19,11 @@
|
|
|
19
19
|
"typescript": "^5.4.5"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@memberjunction/global": "
|
|
23
|
-
"@memberjunction/core": "
|
|
24
|
-
"@memberjunction/templates": "
|
|
25
|
-
"@memberjunction/core-entities": "
|
|
26
|
-
"@memberjunction/communication-types": "
|
|
22
|
+
"@memberjunction/global": "2.0.0",
|
|
23
|
+
"@memberjunction/core": "2.0.0",
|
|
24
|
+
"@memberjunction/templates": "2.0.0",
|
|
25
|
+
"@memberjunction/core-entities": "2.0.0",
|
|
26
|
+
"@memberjunction/communication-types": "2.0.0",
|
|
27
27
|
"rxjs": "^7.8.1"
|
|
28
28
|
}
|
|
29
29
|
}
|