@orchesty/connector-plivo 1.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.
Files changed (36) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/LICENSE +190 -0
  3. package/coverage/clover.xml +76 -0
  4. package/coverage/coverage-final.json +4 -0
  5. package/coverage/lcov-report/base.css +224 -0
  6. package/coverage/lcov-report/block-navigation.js +87 -0
  7. package/coverage/lcov-report/favicon.png +0 -0
  8. package/coverage/lcov-report/index.html +146 -0
  9. package/coverage/lcov-report/prettify.css +1 -0
  10. package/coverage/lcov-report/prettify.js +2 -0
  11. package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
  12. package/coverage/lcov-report/sorter.js +210 -0
  13. package/coverage/lcov-report/src/Connector/PlivoSendSMSConector.ts.html +226 -0
  14. package/coverage/lcov-report/src/Connector/index.html +116 -0
  15. package/coverage/lcov-report/src/PlivoApplication.ts.html +301 -0
  16. package/coverage/lcov-report/src/index.html +116 -0
  17. package/coverage/lcov-report/test/dataProvider.ts.html +160 -0
  18. package/coverage/lcov-report/test/index.html +116 -0
  19. package/coverage/lcov.info +103 -0
  20. package/dist/Connector/PlivoSendSMSConector.d.ts +18 -0
  21. package/dist/Connector/PlivoSendSMSConector.js +24 -0
  22. package/dist/PlivoApplication.d.ts +18 -0
  23. package/dist/PlivoApplication.js +90 -0
  24. package/dist/package.json +22 -0
  25. package/jest.config.js +13 -0
  26. package/package.json +22 -0
  27. package/src/Connector/PlivoSendSMSConector.ts +47 -0
  28. package/src/Connector/__tests__/Data/PlivoSendSMSConector/input.json +11 -0
  29. package/src/Connector/__tests__/Data/PlivoSendSMSConector/mock.json +11 -0
  30. package/src/Connector/__tests__/Data/PlivoSendSMSConector/output.json +12 -0
  31. package/src/Connector/__tests__/PlivoSendSMSConector.ts +17 -0
  32. package/src/PlivoApplication.ts +72 -0
  33. package/test/dataProvider.ts +25 -0
  34. package/tsconfig.json +8 -0
  35. package/tsconfig.prod.json +13 -0
  36. package/tsconfig.prod.tsbuildinfo +1 -0
@@ -0,0 +1,160 @@
1
+
2
+ <!doctype html>
3
+ <html lang="en">
4
+
5
+ <head>
6
+ <title>Code coverage report for test/dataProvider.ts</title>
7
+ <meta charset="utf-8" />
8
+ <link rel="stylesheet" href="../prettify.css" />
9
+ <link rel="stylesheet" href="../base.css" />
10
+ <link rel="shortcut icon" type="image/x-icon" href="../favicon.png" />
11
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
12
+ <style type='text/css'>
13
+ .coverage-summary .sorter {
14
+ background-image: url(../sort-arrow-sprite.png);
15
+ }
16
+ </style>
17
+ </head>
18
+
19
+ <body>
20
+ <div class='wrapper'>
21
+ <div class='pad1'>
22
+ <h1><a href="../index.html">All files</a> / <a href="index.html">test</a> dataProvider.ts</h1>
23
+ <div class='clearfix'>
24
+
25
+ <div class='fl pad1y space-right2'>
26
+ <span class="strong">100% </span>
27
+ <span class="quiet">Statements</span>
28
+ <span class='fraction'>12/12</span>
29
+ </div>
30
+
31
+
32
+ <div class='fl pad1y space-right2'>
33
+ <span class="strong">100% </span>
34
+ <span class="quiet">Branches</span>
35
+ <span class='fraction'>0/0</span>
36
+ </div>
37
+
38
+
39
+ <div class='fl pad1y space-right2'>
40
+ <span class="strong">100% </span>
41
+ <span class="quiet">Functions</span>
42
+ <span class='fraction'>1/1</span>
43
+ </div>
44
+
45
+
46
+ <div class='fl pad1y space-right2'>
47
+ <span class="strong">100% </span>
48
+ <span class="quiet">Lines</span>
49
+ <span class='fraction'>12/12</span>
50
+ </div>
51
+
52
+
53
+ </div>
54
+ <p class="quiet">
55
+ Press <em>n</em> or <em>j</em> to go to the next uncovered block, <em>b</em>, <em>p</em> or <em>k</em> for the previous block.
56
+ </p>
57
+ <template id="filterTemplate">
58
+ <div class="quiet">
59
+ Filter:
60
+ <input type="search" id="fileSearch">
61
+ </div>
62
+ </template>
63
+ </div>
64
+ <div class='status-line high'></div>
65
+ <pre><table class="coverage">
66
+ <tr><td class="line-count quiet"><a name='L1'></a><a href='#L1'>1</a>
67
+ <a name='L2'></a><a href='#L2'>2</a>
68
+ <a name='L3'></a><a href='#L3'>3</a>
69
+ <a name='L4'></a><a href='#L4'>4</a>
70
+ <a name='L5'></a><a href='#L5'>5</a>
71
+ <a name='L6'></a><a href='#L6'>6</a>
72
+ <a name='L7'></a><a href='#L7'>7</a>
73
+ <a name='L8'></a><a href='#L8'>8</a>
74
+ <a name='L9'></a><a href='#L9'>9</a>
75
+ <a name='L10'></a><a href='#L10'>10</a>
76
+ <a name='L11'></a><a href='#L11'>11</a>
77
+ <a name='L12'></a><a href='#L12'>12</a>
78
+ <a name='L13'></a><a href='#L13'>13</a>
79
+ <a name='L14'></a><a href='#L14'>14</a>
80
+ <a name='L15'></a><a href='#L15'>15</a>
81
+ <a name='L16'></a><a href='#L16'>16</a>
82
+ <a name='L17'></a><a href='#L17'>17</a>
83
+ <a name='L18'></a><a href='#L18'>18</a>
84
+ <a name='L19'></a><a href='#L19'>19</a>
85
+ <a name='L20'></a><a href='#L20'>20</a>
86
+ <a name='L21'></a><a href='#L21'>21</a>
87
+ <a name='L22'></a><a href='#L22'>22</a>
88
+ <a name='L23'></a><a href='#L23'>23</a>
89
+ <a name='L24'></a><a href='#L24'>24</a>
90
+ <a name='L25'></a><a href='#L25'>25</a>
91
+ <a name='L26'></a><a href='#L26'>26</a></td><td class="line-coverage quiet"><span class="cline-any cline-yes">1x</span>
92
+ <span class="cline-any cline-yes">1x</span>
93
+ <span class="cline-any cline-yes">1x</span>
94
+ <span class="cline-any cline-yes">1x</span>
95
+ <span class="cline-any cline-yes">1x</span>
96
+ <span class="cline-any cline-neutral">&nbsp;</span>
97
+ <span class="cline-any cline-yes">1x</span>
98
+ <span class="cline-any cline-yes">1x</span>
99
+ <span class="cline-any cline-neutral">&nbsp;</span>
100
+ <span class="cline-any cline-neutral">&nbsp;</span>
101
+ <span class="cline-any cline-neutral">&nbsp;</span>
102
+ <span class="cline-any cline-neutral">&nbsp;</span>
103
+ <span class="cline-any cline-neutral">&nbsp;</span>
104
+ <span class="cline-any cline-neutral">&nbsp;</span>
105
+ <span class="cline-any cline-yes">1x</span>
106
+ <span class="cline-any cline-yes">1x</span>
107
+ <span class="cline-any cline-neutral">&nbsp;</span>
108
+ <span class="cline-any cline-yes">1x</span>
109
+ <span class="cline-any cline-neutral">&nbsp;</span>
110
+ <span class="cline-any cline-yes">1x</span>
111
+ <span class="cline-any cline-neutral">&nbsp;</span>
112
+ <span class="cline-any cline-neutral">&nbsp;</span>
113
+ <span class="cline-any cline-neutral">&nbsp;</span>
114
+ <span class="cline-any cline-yes">1x</span>
115
+ <span class="cline-any cline-neutral">&nbsp;</span>
116
+ <span class="cline-any cline-neutral">&nbsp;</span></td><td class="text"><pre class="prettyprint lang-js">import { appInstall, DEFAULT_USER } from '@orchesty/nodejs-connectors/test/DataProvider';
117
+ import { container, db, sender } from '@orchesty/nodejs-connectors/test/TestAbstract';
118
+ import CoreFormsEnum from '@orchesty/nodejs-sdk/dist/lib/Application/Base/CoreFormsEnum';
119
+ import PlivoSendSMSConector from '../src/Connector/PlivoSendSMSConector';
120
+ import PlivoApplication, { AUTH_ID, AUTH_TOKEN, NAME } from '../src/PlivoApplication';
121
+ &nbsp;
122
+ export default function init(): void {
123
+ appInstall(NAME, DEFAULT_USER, {
124
+ [CoreFormsEnum.AUTHORIZATION_FORM]: {
125
+ [AUTH_ID]: 'AUTH_ID',
126
+ [AUTH_TOKEN]: 'AUTH_TOKEN',
127
+ },
128
+ });
129
+ &nbsp;
130
+ const app = new PlivoApplication();
131
+ container.setApplication(app);
132
+ &nbsp;
133
+ const sendSMS = new PlivoSendSMSConector();
134
+ &nbsp;
135
+ sendSMS
136
+ .setSender(sender)
137
+ .setDb(db)
138
+ .setApplication(app);
139
+ container.setConnector(sendSMS);
140
+ }
141
+ &nbsp;</pre></td></tr></table></pre>
142
+
143
+ <div class='push'></div><!-- for sticky footer -->
144
+ </div><!-- /wrapper -->
145
+ <div class='footer quiet pad2 space-top1 center small'>
146
+ Code coverage generated by
147
+ <a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
148
+ at 2026-01-15T09:49:51.902Z
149
+ </div>
150
+ <script src="../prettify.js"></script>
151
+ <script>
152
+ window.onload = function () {
153
+ prettyPrint();
154
+ };
155
+ </script>
156
+ <script src="../sorter.js"></script>
157
+ <script src="../block-navigation.js"></script>
158
+ </body>
159
+ </html>
160
+
@@ -0,0 +1,116 @@
1
+
2
+ <!doctype html>
3
+ <html lang="en">
4
+
5
+ <head>
6
+ <title>Code coverage report for test</title>
7
+ <meta charset="utf-8" />
8
+ <link rel="stylesheet" href="../prettify.css" />
9
+ <link rel="stylesheet" href="../base.css" />
10
+ <link rel="shortcut icon" type="image/x-icon" href="../favicon.png" />
11
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
12
+ <style type='text/css'>
13
+ .coverage-summary .sorter {
14
+ background-image: url(../sort-arrow-sprite.png);
15
+ }
16
+ </style>
17
+ </head>
18
+
19
+ <body>
20
+ <div class='wrapper'>
21
+ <div class='pad1'>
22
+ <h1><a href="../index.html">All files</a> test</h1>
23
+ <div class='clearfix'>
24
+
25
+ <div class='fl pad1y space-right2'>
26
+ <span class="strong">100% </span>
27
+ <span class="quiet">Statements</span>
28
+ <span class='fraction'>12/12</span>
29
+ </div>
30
+
31
+
32
+ <div class='fl pad1y space-right2'>
33
+ <span class="strong">100% </span>
34
+ <span class="quiet">Branches</span>
35
+ <span class='fraction'>0/0</span>
36
+ </div>
37
+
38
+
39
+ <div class='fl pad1y space-right2'>
40
+ <span class="strong">100% </span>
41
+ <span class="quiet">Functions</span>
42
+ <span class='fraction'>1/1</span>
43
+ </div>
44
+
45
+
46
+ <div class='fl pad1y space-right2'>
47
+ <span class="strong">100% </span>
48
+ <span class="quiet">Lines</span>
49
+ <span class='fraction'>12/12</span>
50
+ </div>
51
+
52
+
53
+ </div>
54
+ <p class="quiet">
55
+ Press <em>n</em> or <em>j</em> to go to the next uncovered block, <em>b</em>, <em>p</em> or <em>k</em> for the previous block.
56
+ </p>
57
+ <template id="filterTemplate">
58
+ <div class="quiet">
59
+ Filter:
60
+ <input type="search" id="fileSearch">
61
+ </div>
62
+ </template>
63
+ </div>
64
+ <div class='status-line high'></div>
65
+ <div class="pad1">
66
+ <table class="coverage-summary">
67
+ <thead>
68
+ <tr>
69
+ <th data-col="file" data-fmt="html" data-html="true" class="file">File</th>
70
+ <th data-col="pic" data-type="number" data-fmt="html" data-html="true" class="pic"></th>
71
+ <th data-col="statements" data-type="number" data-fmt="pct" class="pct">Statements</th>
72
+ <th data-col="statements_raw" data-type="number" data-fmt="html" class="abs"></th>
73
+ <th data-col="branches" data-type="number" data-fmt="pct" class="pct">Branches</th>
74
+ <th data-col="branches_raw" data-type="number" data-fmt="html" class="abs"></th>
75
+ <th data-col="functions" data-type="number" data-fmt="pct" class="pct">Functions</th>
76
+ <th data-col="functions_raw" data-type="number" data-fmt="html" class="abs"></th>
77
+ <th data-col="lines" data-type="number" data-fmt="pct" class="pct">Lines</th>
78
+ <th data-col="lines_raw" data-type="number" data-fmt="html" class="abs"></th>
79
+ </tr>
80
+ </thead>
81
+ <tbody><tr>
82
+ <td class="file high" data-value="dataProvider.ts"><a href="dataProvider.ts.html">dataProvider.ts</a></td>
83
+ <td data-value="100" class="pic high">
84
+ <div class="chart"><div class="cover-fill cover-full" style="width: 100%"></div><div class="cover-empty" style="width: 0%"></div></div>
85
+ </td>
86
+ <td data-value="100" class="pct high">100%</td>
87
+ <td data-value="12" class="abs high">12/12</td>
88
+ <td data-value="100" class="pct high">100%</td>
89
+ <td data-value="0" class="abs high">0/0</td>
90
+ <td data-value="100" class="pct high">100%</td>
91
+ <td data-value="1" class="abs high">1/1</td>
92
+ <td data-value="100" class="pct high">100%</td>
93
+ <td data-value="12" class="abs high">12/12</td>
94
+ </tr>
95
+
96
+ </tbody>
97
+ </table>
98
+ </div>
99
+ <div class='push'></div><!-- for sticky footer -->
100
+ </div><!-- /wrapper -->
101
+ <div class='footer quiet pad2 space-top1 center small'>
102
+ Code coverage generated by
103
+ <a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
104
+ at 2026-01-15T09:49:51.902Z
105
+ </div>
106
+ <script src="../prettify.js"></script>
107
+ <script>
108
+ window.onload = function () {
109
+ prettyPrint();
110
+ };
111
+ </script>
112
+ <script src="../sorter.js"></script>
113
+ <script src="../block-navigation.js"></script>
114
+ </body>
115
+ </html>
116
+
@@ -0,0 +1,103 @@
1
+ TN:
2
+ SF:src/PlivoApplication.ts
3
+ FN:20,(anonymous_10)
4
+ FN:24,(anonymous_11)
5
+ FN:28,(anonymous_12)
6
+ FN:32,(anonymous_13)
7
+ FN:36,(anonymous_14)
8
+ FN:44,(anonymous_15)
9
+ FN:49,(anonymous_16)
10
+ FNF:7
11
+ FNH:2
12
+ FNDA:2,(anonymous_10)
13
+ FNDA:0,(anonymous_11)
14
+ FNDA:0,(anonymous_12)
15
+ FNDA:0,(anonymous_13)
16
+ FNDA:0,(anonymous_14)
17
+ FNDA:0,(anonymous_15)
18
+ FNDA:1,(anonymous_16)
19
+ DA:1,1
20
+ DA:3,1
21
+ DA:4,1
22
+ DA:5,1
23
+ DA:6,1
24
+ DA:7,1
25
+ DA:8,1
26
+ DA:11,1
27
+ DA:12,1
28
+ DA:14,1
29
+ DA:15,1
30
+ DA:16,1
31
+ DA:18,1
32
+ DA:21,2
33
+ DA:25,0
34
+ DA:29,0
35
+ DA:33,0
36
+ DA:37,0
37
+ DA:41,0
38
+ DA:45,0
39
+ DA:46,0
40
+ DA:56,1
41
+ DA:57,1
42
+ DA:58,1
43
+ DA:59,1
44
+ DA:65,1
45
+ DA:66,1
46
+ DA:69,1
47
+ LF:28
48
+ LH:21
49
+ BRDA:46,0,0,0
50
+ BRDA:46,0,1,0
51
+ BRDA:65,1,0,1
52
+ BRDA:65,1,1,0
53
+ BRF:4
54
+ BRH:1
55
+ end_of_record
56
+ TN:
57
+ SF:src/Connector/PlivoSendSMSConector.ts
58
+ FN:11,(anonymous_1)
59
+ FN:15,(anonymous_2)
60
+ FNF:2
61
+ FNH:2
62
+ FNDA:1,(anonymous_1)
63
+ FNDA:1,(anonymous_2)
64
+ DA:1,1
65
+ DA:2,1
66
+ DA:3,1
67
+ DA:5,1
68
+ DA:7,1
69
+ DA:9,1
70
+ DA:12,1
71
+ DA:16,1
72
+ DA:17,1
73
+ DA:18,1
74
+ DA:25,1
75
+ DA:27,1
76
+ LF:12
77
+ LH:12
78
+ BRF:0
79
+ BRH:0
80
+ end_of_record
81
+ TN:
82
+ SF:test/dataProvider.ts
83
+ FN:7,init
84
+ FNF:1
85
+ FNH:1
86
+ FNDA:1,init
87
+ DA:1,1
88
+ DA:2,1
89
+ DA:3,1
90
+ DA:4,1
91
+ DA:5,1
92
+ DA:7,1
93
+ DA:8,1
94
+ DA:15,1
95
+ DA:16,1
96
+ DA:18,1
97
+ DA:20,1
98
+ DA:24,1
99
+ LF:12
100
+ LH:12
101
+ BRF:0
102
+ BRH:0
103
+ end_of_record
@@ -0,0 +1,18 @@
1
+ import AConnector from '@orchesty/nodejs-sdk/dist/lib/Connector/AConnector';
2
+ import ProcessDto from '@orchesty/nodejs-sdk/dist/lib/Utils/ProcessDto';
3
+ export declare const NAME = "plivo-send-sms-conector";
4
+ export default class PlivoSendSMSConector extends AConnector {
5
+ getName(): string;
6
+ processAction(dto: ProcessDto<IInput>): Promise<ProcessDto<IOutput>>;
7
+ }
8
+ export interface IInput {
9
+ src: string;
10
+ dst: string;
11
+ text: string;
12
+ url: string;
13
+ }
14
+ export interface IOutput {
15
+ message: string;
16
+ 'message_uuid': string[];
17
+ 'api_id': string;
18
+ }
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.NAME = void 0;
7
+ const CoreFormsEnum_1 = __importDefault(require("@orchesty/nodejs-sdk/dist/lib/Application/Base/CoreFormsEnum"));
8
+ const AConnector_1 = __importDefault(require("@orchesty/nodejs-sdk/dist/lib/Connector/AConnector"));
9
+ const HttpMethods_1 = require("@orchesty/nodejs-sdk/dist/lib/Transport/HttpMethods");
10
+ const PlivoApplication_1 = require("../PlivoApplication");
11
+ exports.NAME = 'plivo-send-sms-conector';
12
+ class PlivoSendSMSConector extends AConnector_1.default {
13
+ getName() {
14
+ return exports.NAME;
15
+ }
16
+ async processAction(dto) {
17
+ const appInstall = await this.getApplicationInstallFromProcess(dto);
18
+ const id = appInstall.getSettings()[CoreFormsEnum_1.default.AUTHORIZATION_FORM][PlivoApplication_1.AUTH_ID];
19
+ const req = await this.getApplication().getRequestDto(dto, appInstall, HttpMethods_1.HttpMethods.POST, `Account/${id}/Message/`, dto.getJsonData());
20
+ const resp = await this.getSender().send(req, [202]);
21
+ return dto.setNewJsonData(resp.getJsonBody());
22
+ }
23
+ }
24
+ exports.default = PlivoSendSMSConector;
@@ -0,0 +1,18 @@
1
+ import { ApplicationInstall } from '@orchesty/nodejs-sdk/dist/lib/Application/Database/ApplicationInstall';
2
+ import FormStack from '@orchesty/nodejs-sdk/dist/lib/Application/Model/Form/FormStack';
3
+ import { ABasicApplication } from '@orchesty/nodejs-sdk/dist/lib/Authorization/Type/Basic/ABasicApplication';
4
+ import RequestDto from '@orchesty/nodejs-sdk/dist/lib/Transport/Curl/RequestDto';
5
+ import { HttpMethods } from '@orchesty/nodejs-sdk/dist/lib/Transport/HttpMethods';
6
+ import AProcessDto from '@orchesty/nodejs-sdk/dist/lib/Utils/AProcessDto';
7
+ export declare const NAME = "plivo";
8
+ export declare const AUTH_ID = "Authorization_id";
9
+ export declare const AUTH_TOKEN = "Authorization_token";
10
+ export default class PlivoApplication extends ABasicApplication {
11
+ getName(): string;
12
+ getPublicName(): string;
13
+ getDescription(): string;
14
+ getLogo(): string;
15
+ getFormStack(): FormStack;
16
+ isAuthorized(applicationInstall: ApplicationInstall): boolean;
17
+ getRequestDto(dto: AProcessDto, applicationInstall: ApplicationInstall, method: HttpMethods, url?: string, data?: unknown): RequestDto;
18
+ }
@@ -0,0 +1,90 @@
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 __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ var __importDefault = (this && this.__importDefault) || function (mod) {
36
+ return (mod && mod.__esModule) ? mod : { "default": mod };
37
+ };
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ exports.AUTH_TOKEN = exports.AUTH_ID = exports.NAME = void 0;
40
+ const CoreFormsEnum_1 = __importStar(require("@orchesty/nodejs-sdk/dist/lib/Application/Base/CoreFormsEnum"));
41
+ const Field_1 = __importDefault(require("@orchesty/nodejs-sdk/dist/lib/Application/Model/Form/Field"));
42
+ const FieldType_1 = __importDefault(require("@orchesty/nodejs-sdk/dist/lib/Application/Model/Form/FieldType"));
43
+ const Form_1 = __importDefault(require("@orchesty/nodejs-sdk/dist/lib/Application/Model/Form/Form"));
44
+ const FormStack_1 = __importDefault(require("@orchesty/nodejs-sdk/dist/lib/Application/Model/Form/FormStack"));
45
+ const ABasicApplication_1 = require("@orchesty/nodejs-sdk/dist/lib/Authorization/Type/Basic/ABasicApplication");
46
+ const RequestDto_1 = __importDefault(require("@orchesty/nodejs-sdk/dist/lib/Transport/Curl/RequestDto"));
47
+ const Base64_1 = require("@orchesty/nodejs-sdk/dist/lib/Utils/Base64");
48
+ const Headers_1 = require("@orchesty/nodejs-sdk/dist/lib/Utils/Headers");
49
+ exports.NAME = 'plivo';
50
+ exports.AUTH_ID = 'Authorization_id';
51
+ exports.AUTH_TOKEN = 'Authorization_token';
52
+ class PlivoApplication extends ABasicApplication_1.ABasicApplication {
53
+ getName() {
54
+ return 'plivo';
55
+ }
56
+ getPublicName() {
57
+ return 'Plivo';
58
+ }
59
+ getDescription() {
60
+ return 'Cloud-based communication platform to digitize and modernize business communications. It allows users to automatically interact using text messages in over 190 countries';
61
+ }
62
+ getLogo() {
63
+ return 'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPCEtLSBHZW5lcmF0b3I6IEFkb2JlIElsbHVzdHJhdG9yIDI1LjAuMCwgU1ZHIEV4cG9ydCBQbHVnLUluIC4gU1ZHIFZlcnNpb246IDYuMDAgQnVpbGQgMCkgIC0tPgo8c3ZnIHZlcnNpb249IjEuMSIgaWQ9ImxheWVyIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB4PSIwcHgiIHk9IjBweCIKCSB2aWV3Qm94PSIwIDAg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vPgo8L2c+Cjwvc3ZnPgo=';
64
+ }
65
+ getFormStack() {
66
+ const form = new Form_1.default(CoreFormsEnum_1.default.AUTHORIZATION_FORM, (0, CoreFormsEnum_1.getFormName)(CoreFormsEnum_1.default.AUTHORIZATION_FORM))
67
+ .addField(new Field_1.default(FieldType_1.default.TEXT, exports.AUTH_ID, ' Authorization id', undefined, true))
68
+ .addField(new Field_1.default(FieldType_1.default.PASSWORD, exports.AUTH_TOKEN, ' Authorization token', undefined, true));
69
+ return new FormStack_1.default().addForm(form);
70
+ }
71
+ isAuthorized(applicationInstall) {
72
+ const authorizationForm = applicationInstall.getSettings()[CoreFormsEnum_1.default.AUTHORIZATION_FORM];
73
+ return authorizationForm?.[exports.AUTH_ID] && authorizationForm?.[exports.AUTH_TOKEN];
74
+ }
75
+ getRequestDto(dto, applicationInstall, method, url, data) {
76
+ const request = new RequestDto_1.default(`https://api.plivo.com/v1/${url}`, method, dto);
77
+ const id = applicationInstall.getSettings()[CoreFormsEnum_1.default.AUTHORIZATION_FORM][exports.AUTH_ID];
78
+ const token = applicationInstall.getSettings()[CoreFormsEnum_1.default.AUTHORIZATION_FORM][exports.AUTH_TOKEN];
79
+ request.setHeaders({
80
+ [Headers_1.CommonHeaders.CONTENT_TYPE]: Headers_1.JSON_TYPE,
81
+ [Headers_1.CommonHeaders.ACCEPT]: Headers_1.JSON_TYPE,
82
+ [Headers_1.CommonHeaders.AUTHORIZATION]: `Basic ${(0, Base64_1.encode)(`${id}:${token}`)}`,
83
+ });
84
+ if (data) {
85
+ request.setJsonBody(data);
86
+ }
87
+ return request;
88
+ }
89
+ }
90
+ exports.default = PlivoApplication;
@@ -0,0 +1,22 @@
1
+ {
2
+ "name": "@orchesty/connector-plivo",
3
+ "description": "",
4
+ "version": "0.0.0",
5
+ "license": "Apache-2.0",
6
+ "url": "https://github.com/Orchesty/orchesty-nodejs-connectors",
7
+ "repository": "https://github.com/Orchesty/orchesty-nodejs-connectors",
8
+ "scripts": {
9
+ "build": "rm -rf dist && rm -rf tsconfig.prod.tsbuildinfo && tsc -d -p tsconfig.prod.json && cp package.json ./dist/package.json",
10
+ "test": "jest --coverage --forceExit --passWithNoTests",
11
+ "lint": "eslint src test --fix",
12
+ "lint-ci": "eslint src test"
13
+ },
14
+ "keywords": [],
15
+ "author": "info@hanaboso.com",
16
+ "dependencies": {
17
+ "@orchesty/nodejs-sdk": "^4.3.6"
18
+ },
19
+ "engines": {
20
+ "node": ">=24"
21
+ }
22
+ }
package/jest.config.js ADDED
@@ -0,0 +1,13 @@
1
+ const baseConfig = require('../../jest.config.js');
2
+
3
+ module.exports = {
4
+ ...baseConfig,
5
+ roots: ["<rootDir>/src"],
6
+ setupFiles: ["<rootDir>/../../.jest/testEnvs.ts"],
7
+ setupFilesAfterEnv: ["<rootDir>/../../.jest/testLifecycle.ts"],
8
+ globalSetup: "<rootDir>/../../.jest/globalSetup.ts",
9
+ moduleNameMapper: {
10
+ "^@orchesty/nodejs-connectors/test/(.*)$": "<rootDir>/../../test/$1",
11
+ "^@orchesty/nodejs-connectors/lib/(.*)$": "<rootDir>/../../lib/$1",
12
+ },
13
+ }
package/package.json ADDED
@@ -0,0 +1,22 @@
1
+ {
2
+ "name": "@orchesty/connector-plivo",
3
+ "description": "",
4
+ "version": "1.0.0",
5
+ "license": "Apache-2.0",
6
+ "url": "https://github.com/Orchesty/orchesty-nodejs-connectors",
7
+ "repository": "https://github.com/Orchesty/orchesty-nodejs-connectors",
8
+ "keywords": [],
9
+ "author": "info@hanaboso.com",
10
+ "dependencies": {
11
+ "@orchesty/nodejs-sdk": "^4.3.6"
12
+ },
13
+ "engines": {
14
+ "node": ">=24"
15
+ },
16
+ "scripts": {
17
+ "build": "rm -rf dist && rm -rf tsconfig.prod.tsbuildinfo && tsc -d -p tsconfig.prod.json && cp package.json ./dist/package.json",
18
+ "test": "jest --coverage --forceExit --passWithNoTests",
19
+ "lint": "eslint src test --fix",
20
+ "lint-ci": "eslint src test"
21
+ }
22
+ }
@@ -0,0 +1,47 @@
1
+ import CoreFormsEnum from '@orchesty/nodejs-sdk/dist/lib/Application/Base/CoreFormsEnum';
2
+ import AConnector from '@orchesty/nodejs-sdk/dist/lib/Connector/AConnector';
3
+ import { HttpMethods } from '@orchesty/nodejs-sdk/dist/lib/Transport/HttpMethods';
4
+ import ProcessDto from '@orchesty/nodejs-sdk/dist/lib/Utils/ProcessDto';
5
+ import { AUTH_ID } from '../PlivoApplication';
6
+
7
+ export const NAME = 'plivo-send-sms-conector';
8
+
9
+ export default class PlivoSendSMSConector extends AConnector {
10
+
11
+ public getName(): string {
12
+ return NAME;
13
+ }
14
+
15
+ public async processAction(dto: ProcessDto<IInput>): Promise<ProcessDto<IOutput>> {
16
+ const appInstall = await this.getApplicationInstallFromProcess(dto);
17
+ const id = appInstall.getSettings()[CoreFormsEnum.AUTHORIZATION_FORM][AUTH_ID];
18
+ const req = await this.getApplication().getRequestDto(
19
+ dto,
20
+ appInstall,
21
+ HttpMethods.POST,
22
+ `Account/${id}/Message/`,
23
+ dto.getJsonData(),
24
+ );
25
+ const resp = await this.getSender().send<IOutput>(req, [202]);
26
+
27
+ return dto.setNewJsonData(resp.getJsonBody());
28
+ }
29
+
30
+ }
31
+
32
+ /* eslint-disable @typescript-eslint/naming-convention */
33
+
34
+ export interface IInput {
35
+ src: string;
36
+ dst: string;
37
+ text: string;
38
+ url: string;
39
+ }
40
+
41
+ export interface IOutput {
42
+ message: string;
43
+ 'message_uuid': string[];
44
+ 'api_id': string;
45
+ }
46
+
47
+ /* eslint-enable @typescript-eslint/naming-convention */
@@ -0,0 +1,11 @@
1
+ {
2
+ "headers": {
3
+ "user": "TestUser"
4
+ },
5
+ "data": {
6
+ "src": "<from_number>",
7
+ "dst": "+12025551111",
8
+ "text": "Hello, this is sample text",
9
+ "url": "https://<yourdomain>.com/sms_status/"
10
+ }
11
+ }