@orchesty/connector-plivo 1.0.0 → 1.0.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/package.json +4 -1
- package/package.json +4 -1
- package/CHANGELOG.md +0 -7
- package/coverage/clover.xml +0 -76
- package/coverage/coverage-final.json +0 -4
- package/coverage/lcov-report/base.css +0 -224
- package/coverage/lcov-report/block-navigation.js +0 -87
- package/coverage/lcov-report/favicon.png +0 -0
- package/coverage/lcov-report/index.html +0 -146
- package/coverage/lcov-report/prettify.css +0 -1
- package/coverage/lcov-report/prettify.js +0 -2
- package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
- package/coverage/lcov-report/sorter.js +0 -210
- package/coverage/lcov-report/src/Connector/PlivoSendSMSConector.ts.html +0 -226
- package/coverage/lcov-report/src/Connector/index.html +0 -116
- package/coverage/lcov-report/src/PlivoApplication.ts.html +0 -301
- package/coverage/lcov-report/src/index.html +0 -116
- package/coverage/lcov-report/test/dataProvider.ts.html +0 -160
- package/coverage/lcov-report/test/index.html +0 -116
- package/coverage/lcov.info +0 -103
- package/jest.config.js +0 -13
- package/src/Connector/PlivoSendSMSConector.ts +0 -47
- package/src/Connector/__tests__/Data/PlivoSendSMSConector/input.json +0 -11
- package/src/Connector/__tests__/Data/PlivoSendSMSConector/mock.json +0 -11
- package/src/Connector/__tests__/Data/PlivoSendSMSConector/output.json +0 -12
- package/src/Connector/__tests__/PlivoSendSMSConector.ts +0 -17
- package/src/PlivoApplication.ts +0 -72
- package/test/dataProvider.ts +0 -25
- package/tsconfig.json +0 -8
- package/tsconfig.prod.json +0 -13
- package/tsconfig.prod.tsbuildinfo +0 -1
|
@@ -1,116 +0,0 @@
|
|
|
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
|
-
|
package/coverage/lcov.info
DELETED
|
@@ -1,103 +0,0 @@
|
|
|
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
|
package/jest.config.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,47 +0,0 @@
|
|
|
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 */
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { container } from '@orchesty/nodejs-connectors/test/TestAbstract';
|
|
2
|
-
import NodeTester from '@orchesty/nodejs-sdk/dist/test/Testers/NodeTester';
|
|
3
|
-
import init from '../../../test/dataProvider';
|
|
4
|
-
import { NAME as PLIVO_SEND_SMS_CONECTOR } from '../PlivoSendSMSConector';
|
|
5
|
-
|
|
6
|
-
let tester: NodeTester;
|
|
7
|
-
|
|
8
|
-
describe('Tests for PlivoSendSMSConector', () => {
|
|
9
|
-
beforeAll(() => {
|
|
10
|
-
tester = new NodeTester(container, __filename, true);
|
|
11
|
-
init();
|
|
12
|
-
});
|
|
13
|
-
|
|
14
|
-
it('process - ok', async () => {
|
|
15
|
-
await tester.testConnector(PLIVO_SEND_SMS_CONECTOR);
|
|
16
|
-
});
|
|
17
|
-
});
|
package/src/PlivoApplication.ts
DELETED
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import CoreFormsEnum, { getFormName } from '@orchesty/nodejs-sdk/dist/lib/Application/Base/CoreFormsEnum';
|
|
2
|
-
import { ApplicationInstall } from '@orchesty/nodejs-sdk/dist/lib/Application/Database/ApplicationInstall';
|
|
3
|
-
import Field from '@orchesty/nodejs-sdk/dist/lib/Application/Model/Form/Field';
|
|
4
|
-
import FieldType from '@orchesty/nodejs-sdk/dist/lib/Application/Model/Form/FieldType';
|
|
5
|
-
import Form from '@orchesty/nodejs-sdk/dist/lib/Application/Model/Form/Form';
|
|
6
|
-
import FormStack from '@orchesty/nodejs-sdk/dist/lib/Application/Model/Form/FormStack';
|
|
7
|
-
import { ABasicApplication } from '@orchesty/nodejs-sdk/dist/lib/Authorization/Type/Basic/ABasicApplication';
|
|
8
|
-
import RequestDto from '@orchesty/nodejs-sdk/dist/lib/Transport/Curl/RequestDto';
|
|
9
|
-
import { HttpMethods } from '@orchesty/nodejs-sdk/dist/lib/Transport/HttpMethods';
|
|
10
|
-
import AProcessDto from '@orchesty/nodejs-sdk/dist/lib/Utils/AProcessDto';
|
|
11
|
-
import { encode } from '@orchesty/nodejs-sdk/dist/lib/Utils/Base64';
|
|
12
|
-
import { CommonHeaders, JSON_TYPE } from '@orchesty/nodejs-sdk/dist/lib/Utils/Headers';
|
|
13
|
-
|
|
14
|
-
export const NAME = 'plivo';
|
|
15
|
-
export const AUTH_ID = 'Authorization_id';
|
|
16
|
-
export const AUTH_TOKEN = 'Authorization_token';
|
|
17
|
-
|
|
18
|
-
export default class PlivoApplication extends ABasicApplication {
|
|
19
|
-
|
|
20
|
-
public getName(): string {
|
|
21
|
-
return 'plivo';
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
public getPublicName(): string {
|
|
25
|
-
return 'Plivo';
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
public getDescription(): string {
|
|
29
|
-
return 'Cloud-based communication platform to digitize and modernize business communications. It allows users to automatically interact using text messages in over 190 countries';
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
public getLogo(): string {
|
|
33
|
-
return 'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPCEtLSBHZW5lcmF0b3I6IEFkb2JlIElsbHVzdHJhdG9yIDI1LjAuMCwgU1ZHIEV4cG9ydCBQbHVnLUluIC4gU1ZHIFZlcnNpb246IDYuMDAgQnVpbGQgMCkgIC0tPgo8c3ZnIHZlcnNpb249IjEuMSIgaWQ9ImxheWVyIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB4PSIwcHgiIHk9IjBweCIKCSB2aWV3Qm94PSIwIDAgMTAwIDEwMCIgc3R5bGU9ImVuYWJsZS1iYWNrZ3JvdW5kOm5ldyAwIDAgMTAwIDEwMDsiIHhtbDpzcGFjZT0icHJlc2VydmUiPgo8c3R5bGUgdHlwZT0idGV4dC9jc3MiPgoJLnN0MHtmaWxsOiMwM0E5NEE7fQo8L3N0eWxlPgo8Zz4KCTxwYXRoIGNsYXNzPSJzdDAiIGQ9Ik00O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sMC0xLjEtMC4yLTEuNS0wLjZjLTAuNC0wLjQtMC42LTAuOS0wLjYtMS41di0yLjF2LTIuMWMwLTAuNiwwLjItMS4xLDAuNi0xLjVjMC40LTAuNCwwLjktMC42LDEuNS0wLjZoMi4xaDIuMQoJCWMwLjYsMCwxLjEsMC4yLDEuNSwwLjZjMC40LDAuNCwwLjYsMC45LDAuNiwxLjVWNjZWNjguMXogTTU0LjIsNjguMWMwLDAuNi0wLjIsMS4xLTAuNiwxLjVjLTAuNCwwLjQtMC45LDAuNi0xLjUsMC42SDUwaC0yLjEKCQljLTAuNiwwLTEuMS0wLjItMS41LTAuNmMtMC40LTAuNC0wLjYtMC45LTAuNi0xLjV2LTIuMXYtMi4xYzAtMC42LDAuMi0xLjEsMC42LTEuNWMwLjQtMC40LDAuOS0wLjYsMS41LTAuNkg1MGgyLjEKCQljMC42LDAsMS4xLDAuMiwxLjUsMC42YzAuNCwwLjQsMC42LDAuOSwwLjYsMS41VjY2VjY4LjF6IE02NS45LDY4LjFjMCwwLjYtMC4yLDEuMS0wLjYsMS41Yy0wLjQsMC40LTAuOSwwLjYtMS41LDAuNmgtMi4xaC0yLjEKCQljLTAuNiwwLTEuMS0wLjItMS41LTAuNmMtMC40LTAuNC0wLjYtMC45LTAuNi0xLjV2LTIuMXYtMi4xYzAtMC42LDAuMi0xLjEsMC42LTEuNWMwLjQtMC40LDAuOS0wLjYsMS41LTAuNmgyLjFoMi4xCgkJYzAuNiwwLDEuMSwwLjIsMS41LDAuNmMwLjQsMC40LDAuNiwwLjksMC42LDEuNVY2NlY2OC4xeiIvPgo8L2c+Cjwvc3ZnPgo=';
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
public getFormStack(): FormStack {
|
|
37
|
-
const form = new Form(CoreFormsEnum.AUTHORIZATION_FORM, getFormName(CoreFormsEnum.AUTHORIZATION_FORM))
|
|
38
|
-
.addField(new Field(FieldType.TEXT, AUTH_ID, ' Authorization id', undefined, true))
|
|
39
|
-
.addField(new Field(FieldType.PASSWORD, AUTH_TOKEN, ' Authorization token', undefined, true));
|
|
40
|
-
|
|
41
|
-
return new FormStack().addForm(form);
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
public isAuthorized(applicationInstall: ApplicationInstall): boolean {
|
|
45
|
-
const authorizationForm = applicationInstall.getSettings()[CoreFormsEnum.AUTHORIZATION_FORM];
|
|
46
|
-
return authorizationForm?.[AUTH_ID] && authorizationForm?.[AUTH_TOKEN];
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
public getRequestDto(
|
|
50
|
-
dto: AProcessDto,
|
|
51
|
-
applicationInstall: ApplicationInstall,
|
|
52
|
-
method: HttpMethods,
|
|
53
|
-
url?: string,
|
|
54
|
-
data?: unknown,
|
|
55
|
-
): RequestDto {
|
|
56
|
-
const request = new RequestDto(`https://api.plivo.com/v1/${url}`, method, dto);
|
|
57
|
-
const id = applicationInstall.getSettings()[CoreFormsEnum.AUTHORIZATION_FORM][AUTH_ID];
|
|
58
|
-
const token = applicationInstall.getSettings()[CoreFormsEnum.AUTHORIZATION_FORM][AUTH_TOKEN];
|
|
59
|
-
request.setHeaders({
|
|
60
|
-
[CommonHeaders.CONTENT_TYPE]: JSON_TYPE,
|
|
61
|
-
[CommonHeaders.ACCEPT]: JSON_TYPE,
|
|
62
|
-
[CommonHeaders.AUTHORIZATION]: `Basic ${encode(`${id}:${token}`)}`,
|
|
63
|
-
});
|
|
64
|
-
|
|
65
|
-
if (data) {
|
|
66
|
-
request.setJsonBody(data);
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
return request;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
}
|
package/test/dataProvider.ts
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { appInstall, DEFAULT_USER } from '@orchesty/nodejs-connectors/test/DataProvider';
|
|
2
|
-
import { container, db, sender } from '@orchesty/nodejs-connectors/test/TestAbstract';
|
|
3
|
-
import CoreFormsEnum from '@orchesty/nodejs-sdk/dist/lib/Application/Base/CoreFormsEnum';
|
|
4
|
-
import PlivoSendSMSConector from '../src/Connector/PlivoSendSMSConector';
|
|
5
|
-
import PlivoApplication, { AUTH_ID, AUTH_TOKEN, NAME } from '../src/PlivoApplication';
|
|
6
|
-
|
|
7
|
-
export default function init(): void {
|
|
8
|
-
appInstall(NAME, DEFAULT_USER, {
|
|
9
|
-
[CoreFormsEnum.AUTHORIZATION_FORM]: {
|
|
10
|
-
[AUTH_ID]: 'AUTH_ID',
|
|
11
|
-
[AUTH_TOKEN]: 'AUTH_TOKEN',
|
|
12
|
-
},
|
|
13
|
-
});
|
|
14
|
-
|
|
15
|
-
const app = new PlivoApplication();
|
|
16
|
-
container.setApplication(app);
|
|
17
|
-
|
|
18
|
-
const sendSMS = new PlivoSendSMSConector();
|
|
19
|
-
|
|
20
|
-
sendSMS
|
|
21
|
-
.setSender(sender)
|
|
22
|
-
.setDb(db)
|
|
23
|
-
.setApplication(app);
|
|
24
|
-
container.setConnector(sendSMS);
|
|
25
|
-
}
|
package/tsconfig.json
DELETED