@memberjunction/core-actions 1.7.1 → 1.8.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.
- package/dist/custom/send-single-message.action.d.ts +17 -0
- package/dist/custom/send-single-message.action.d.ts.map +1 -0
- package/dist/custom/send-single-message.action.js +62 -0
- package/dist/custom/send-single-message.action.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/package.json +6 -5
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ActionResultSimple, BaseAction, RunActionParams } from "@memberjunction/actions";
|
|
2
|
+
/**
|
|
3
|
+
* This class provides a simple wrapper of the most basic feature in the MJ Communication Framework, sending a single message.
|
|
4
|
+
* This class takes in a set of parameters and uses the MJ Communication Framework to send a single message to a single recipient.
|
|
5
|
+
*
|
|
6
|
+
* Params:
|
|
7
|
+
* * Subject: The subject of the message.
|
|
8
|
+
* * Body: The body of the message.
|
|
9
|
+
* * To: The recipient of the message.
|
|
10
|
+
* * From: The sender of the message.
|
|
11
|
+
* * Provider: The name of the Communication Provider to use to send the message.
|
|
12
|
+
* * MessageType: The name of the Message Type (within the provider) to use to send the message.
|
|
13
|
+
*/
|
|
14
|
+
export declare class SendSingleMessageAction extends BaseAction {
|
|
15
|
+
protected InternalRunAction(params: RunActionParams): Promise<ActionResultSimple>;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=send-single-message.action.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"send-single-message.action.d.ts","sourceRoot":"","sources":["../../src/custom/send-single-message.action.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAK1F;;;;;;;;;;;GAWG;AACH,qBACa,uBAAwB,SAAQ,UAAU;cACnC,iBAAiB,CAAC,MAAM,EAAE,eAAe,GAAG,OAAO,CAAC,kBAAkB,CAAC;CAiC1F"}
|
|
@@ -0,0 +1,62 @@
|
|
|
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.SendSingleMessageAction = void 0;
|
|
10
|
+
const actions_1 = require("@memberjunction/actions");
|
|
11
|
+
const global_1 = require("@memberjunction/global");
|
|
12
|
+
const communication_engine_1 = require("@memberjunction/communication-engine");
|
|
13
|
+
/**
|
|
14
|
+
* This class provides a simple wrapper of the most basic feature in the MJ Communication Framework, sending a single message.
|
|
15
|
+
* This class takes in a set of parameters and uses the MJ Communication Framework to send a single message to a single recipient.
|
|
16
|
+
*
|
|
17
|
+
* Params:
|
|
18
|
+
* * Subject: The subject of the message.
|
|
19
|
+
* * Body: The body of the message.
|
|
20
|
+
* * To: The recipient of the message.
|
|
21
|
+
* * From: The sender of the message.
|
|
22
|
+
* * Provider: The name of the Communication Provider to use to send the message.
|
|
23
|
+
* * MessageType: The name of the Message Type (within the provider) to use to send the message.
|
|
24
|
+
*/
|
|
25
|
+
let SendSingleMessageAction = class SendSingleMessageAction extends actions_1.BaseAction {
|
|
26
|
+
async InternalRunAction(params) {
|
|
27
|
+
const subject = params.Params.find(p => p.Name === 'Subject');
|
|
28
|
+
const body = params.Params.find(p => p.Name === 'Body');
|
|
29
|
+
const to = params.Params.find(p => p.Name === 'To');
|
|
30
|
+
const from = params.Params.find(p => p.Name === 'From');
|
|
31
|
+
const provider = params.Params.find(p => p.Name === 'Provider');
|
|
32
|
+
const p = communication_engine_1.CommunicationEngine.Instance.Providers.find(p => p.Name === provider.Value);
|
|
33
|
+
const messageType = params.Params.find(p => p.Name === 'MessageType');
|
|
34
|
+
const mt = p.MessageTypes.find(mt => mt.Name === messageType.Value);
|
|
35
|
+
if (!p)
|
|
36
|
+
throw new Error(`Provider ${provider.Value} not found.`);
|
|
37
|
+
if (!mt)
|
|
38
|
+
throw new Error(`Provider Message Type ${messageType.Value} not found.`);
|
|
39
|
+
if (!from)
|
|
40
|
+
throw new Error(`From is required.`);
|
|
41
|
+
if (!to)
|
|
42
|
+
throw new Error(`To is required.`);
|
|
43
|
+
const m = {
|
|
44
|
+
MessageType: mt,
|
|
45
|
+
From: from.Value,
|
|
46
|
+
To: to.Value,
|
|
47
|
+
Subject: subject.Value,
|
|
48
|
+
Body: body.Value,
|
|
49
|
+
};
|
|
50
|
+
const result = await communication_engine_1.CommunicationEngine.Instance.SendSingleMessage(provider.Value, messageType.Value, m);
|
|
51
|
+
return {
|
|
52
|
+
Success: result.Success,
|
|
53
|
+
Message: result.Error,
|
|
54
|
+
ResultCode: result.Success ? "SUCCESS" : "FAILED"
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
exports.SendSingleMessageAction = SendSingleMessageAction;
|
|
59
|
+
exports.SendSingleMessageAction = SendSingleMessageAction = __decorate([
|
|
60
|
+
(0, global_1.RegisterClass)(actions_1.BaseAction, "SendSingleMessage")
|
|
61
|
+
], SendSingleMessageAction);
|
|
62
|
+
//# sourceMappingURL=send-single-message.action.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"send-single-message.action.js","sourceRoot":"","sources":["../../src/custom/send-single-message.action.ts"],"names":[],"mappings":";;;;;;;;;AAAA,qDAA0F;AAC1F,mDAAuD;AACvD,+EAA2E;AAG3E;;;;;;;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C,KAAK,aAAa,CAAC,CAAC;QAC7D,IAAI,CAAC,EAAE;YACH,MAAM,IAAI,KAAK,CAAC,yBAAyB,WAAW,CAAC,KAAK,aAAa,CAAC,CAAC;QAC7E,IAAI,CAAC,IAAI;YACL,MAAM,IAAI,KAAK,CAAC,mBAAmB,CAAC,CAAC;QACzC,IAAI,CAAC,EAAE;YACH,MAAM,IAAI,KAAK,CAAC,iBAAiB,CAAC,CAAC;QAEvC,MAAM,CAAC,GAAY;YACf,WAAW,EAAE,EAAE;YACf,IAAI,EAAE,IAAI,CAAC,KAAK;YAChB,EAAE,EAAE,EAAE,CAAC,KAAK;YACZ,OAAO,EAAE,OAAO,CAAC,KAAK;YACtB,IAAI,EAAE,IAAI,CAAC,KAAK;SACnB,CAAA;QACD,MAAM,MAAM,GAAG,MAAM,0CAAmB,CAAC,QAAQ,CAAC,iBAAiB,CAAC,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;QAC1G,OAAO;YACH,OAAO,EAAE,MAAM,CAAC,OAAO;YACvB,OAAO,EAAE,MAAM,CAAC,KAAK;YACrB,UAAU,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,QAAQ;SACpD,CAAC;IACN,CAAC;CACJ,CAAA;AAlCY,0DAAuB;kCAAvB,uBAAuB;IADnC,IAAA,sBAAa,EAAC,oBAAU,EAAE,mBAAmB,CAAC;GAClC,uBAAuB,CAkCnC"}
|
package/dist/index.d.ts
CHANGED
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,+BAA+B,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,+BAA+B,CAAC;AAE9C,cAAc,qCAAqC,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -15,4 +15,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./generated/action_subclasses"), exports);
|
|
18
|
+
__exportStar(require("./custom/send-single-message.action"), exports);
|
|
18
19
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,gEAA8C"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,gEAA8C;AAE9C,sEAAoD"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@memberjunction/core-actions",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.8.1",
|
|
4
4
|
"description": "Library of generated and custom actions for the core MemberJunction framework. This library is maintained by MemberJunction and includes actions for use within the framework itself.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -19,9 +19,10 @@
|
|
|
19
19
|
"typescript": "^5.4.5"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@memberjunction/global": "1.
|
|
23
|
-
"@memberjunction/core": "1.
|
|
24
|
-
"@memberjunction/core-entities": "1.
|
|
25
|
-
"@memberjunction/actions": "1.
|
|
22
|
+
"@memberjunction/global": "1.8.1",
|
|
23
|
+
"@memberjunction/core": "1.8.1",
|
|
24
|
+
"@memberjunction/core-entities": "1.8.1",
|
|
25
|
+
"@memberjunction/actions": "1.8.1",
|
|
26
|
+
"@memberjunction/communication-engine": "1.8.1"
|
|
26
27
|
}
|
|
27
28
|
}
|