@orchesty/connector-onesignal 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.
- package/CHANGELOG.md +7 -0
- package/LICENSE +190 -0
- package/coverage/clover.xml +95 -0
- package/coverage/coverage-final.json +5 -0
- package/coverage/lcov-report/base.css +224 -0
- package/coverage/lcov-report/block-navigation.js +87 -0
- package/coverage/lcov-report/favicon.png +0 -0
- package/coverage/lcov-report/index.html +161 -0
- package/coverage/lcov-report/prettify.css +1 -0
- package/coverage/lcov-report/prettify.js +2 -0
- package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
- package/coverage/lcov-report/sorter.js +210 -0
- package/coverage/lcov-report/src/Batch/OnesignalViewAppsBatch.ts.html +265 -0
- package/coverage/lcov-report/src/Batch/index.html +116 -0
- package/coverage/lcov-report/src/Connector/OnesignalCreateAppConnector.ts.html +316 -0
- package/coverage/lcov-report/src/Connector/index.html +116 -0
- package/coverage/lcov-report/src/OnesignalApplication.ts.html +298 -0
- package/coverage/lcov-report/src/index.html +116 -0
- package/coverage/lcov-report/test/dataProvider.ts.html +181 -0
- package/coverage/lcov-report/test/index.html +116 -0
- package/coverage/lcov.info +129 -0
- package/dist/Batch/OnesignalViewAppsBatch.d.ts +33 -0
- package/dist/Batch/OnesignalViewAppsBatch.js +24 -0
- package/dist/Connector/OnesignalCreateAppConnector.d.ts +52 -0
- package/dist/Connector/OnesignalCreateAppConnector.js +21 -0
- package/dist/OnesignalApplication.d.ts +18 -0
- package/dist/OnesignalApplication.js +89 -0
- package/dist/package.json +22 -0
- package/jest.config.js +13 -0
- package/package.json +22 -0
- package/src/Batch/OnesignalViewAppsBatch.ts +60 -0
- package/src/Batch/__tests__/Data/OnesignalViewAppsBatch/input.json +6 -0
- package/src/Batch/__tests__/Data/OnesignalViewAppsBatch/mock.json +58 -0
- package/src/Batch/__tests__/Data/OnesignalViewAppsBatch/output.json +15 -0
- package/src/Batch/__tests__/OnesignalViewAppsBatch.ts +17 -0
- package/src/Connector/OnesignalCreateAppConnector.ts +77 -0
- package/src/Connector/__tests__/Data/OnesignalCreateAppConnector/input.json +8 -0
- package/src/Connector/__tests__/Data/OnesignalCreateAppConnector/mock.json +32 -0
- package/src/Connector/__tests__/Data/OnesignalCreateAppConnector/output.json +33 -0
- package/src/Connector/__tests__/OnesignalCreateAppConnector.ts +17 -0
- package/src/OnesignalApplication.ts +71 -0
- package/test/dataProvider.ts +32 -0
- package/tsconfig.json +8 -0
- package/tsconfig.prod.json +13 -0
- package/tsconfig.prod.tsbuildinfo +1 -0
|
@@ -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'>16/16</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'>16/16</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="16" class="abs high">16/16</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="16" class="abs high">16/16</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:49.394Z
|
|
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,129 @@
|
|
|
1
|
+
TN:
|
|
2
|
+
SF:src/OnesignalApplication.ts
|
|
3
|
+
FN:19,(anonymous_10)
|
|
4
|
+
FN:23,(anonymous_11)
|
|
5
|
+
FN:27,(anonymous_12)
|
|
6
|
+
FN:31,(anonymous_13)
|
|
7
|
+
FN:35,(anonymous_14)
|
|
8
|
+
FN:42,(anonymous_15)
|
|
9
|
+
FN:47,(anonymous_16)
|
|
10
|
+
FNF:7
|
|
11
|
+
FNH:2
|
|
12
|
+
FNDA:4,(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:2,(anonymous_16)
|
|
19
|
+
DA:1,2
|
|
20
|
+
DA:3,2
|
|
21
|
+
DA:4,2
|
|
22
|
+
DA:5,2
|
|
23
|
+
DA:6,2
|
|
24
|
+
DA:7,2
|
|
25
|
+
DA:8,2
|
|
26
|
+
DA:11,2
|
|
27
|
+
DA:13,2
|
|
28
|
+
DA:14,2
|
|
29
|
+
DA:15,2
|
|
30
|
+
DA:17,2
|
|
31
|
+
DA:20,4
|
|
32
|
+
DA:24,0
|
|
33
|
+
DA:28,0
|
|
34
|
+
DA:32,0
|
|
35
|
+
DA:36,0
|
|
36
|
+
DA:39,0
|
|
37
|
+
DA:43,0
|
|
38
|
+
DA:44,0
|
|
39
|
+
DA:54,2
|
|
40
|
+
DA:55,2
|
|
41
|
+
DA:56,2
|
|
42
|
+
DA:57,2
|
|
43
|
+
DA:58,2
|
|
44
|
+
DA:64,2
|
|
45
|
+
DA:65,1
|
|
46
|
+
DA:68,2
|
|
47
|
+
LF:28
|
|
48
|
+
LH:21
|
|
49
|
+
BRDA:64,0,0,1
|
|
50
|
+
BRDA:64,0,1,1
|
|
51
|
+
BRF:2
|
|
52
|
+
BRH:2
|
|
53
|
+
end_of_record
|
|
54
|
+
TN:
|
|
55
|
+
SF:src/Batch/OnesignalViewAppsBatch.ts
|
|
56
|
+
FN:9,(anonymous_1)
|
|
57
|
+
FN:13,(anonymous_2)
|
|
58
|
+
FNF:2
|
|
59
|
+
FNH:2
|
|
60
|
+
FNDA:2,(anonymous_1)
|
|
61
|
+
FNDA:1,(anonymous_2)
|
|
62
|
+
DA:1,2
|
|
63
|
+
DA:2,2
|
|
64
|
+
DA:5,2
|
|
65
|
+
DA:7,2
|
|
66
|
+
DA:10,2
|
|
67
|
+
DA:14,1
|
|
68
|
+
DA:15,1
|
|
69
|
+
DA:21,1
|
|
70
|
+
DA:22,1
|
|
71
|
+
DA:24,1
|
|
72
|
+
DA:25,1
|
|
73
|
+
DA:27,1
|
|
74
|
+
LF:12
|
|
75
|
+
LH:12
|
|
76
|
+
BRDA:24,0,0,1
|
|
77
|
+
BRDA:24,0,1,0
|
|
78
|
+
BRF:2
|
|
79
|
+
BRH:1
|
|
80
|
+
end_of_record
|
|
81
|
+
TN:
|
|
82
|
+
SF:src/Connector/OnesignalCreateAppConnector.ts
|
|
83
|
+
FN:9,(anonymous_1)
|
|
84
|
+
FN:13,(anonymous_2)
|
|
85
|
+
FNF:2
|
|
86
|
+
FNH:2
|
|
87
|
+
FNDA:2,(anonymous_1)
|
|
88
|
+
FNDA:1,(anonymous_2)
|
|
89
|
+
DA:1,2
|
|
90
|
+
DA:2,2
|
|
91
|
+
DA:5,2
|
|
92
|
+
DA:7,2
|
|
93
|
+
DA:10,2
|
|
94
|
+
DA:14,1
|
|
95
|
+
DA:15,1
|
|
96
|
+
DA:22,1
|
|
97
|
+
DA:24,1
|
|
98
|
+
LF:9
|
|
99
|
+
LH:9
|
|
100
|
+
BRF:0
|
|
101
|
+
BRH:0
|
|
102
|
+
end_of_record
|
|
103
|
+
TN:
|
|
104
|
+
SF:test/dataProvider.ts
|
|
105
|
+
FN:8,init
|
|
106
|
+
FNF:1
|
|
107
|
+
FNH:1
|
|
108
|
+
FNDA:2,init
|
|
109
|
+
DA:1,2
|
|
110
|
+
DA:2,2
|
|
111
|
+
DA:3,2
|
|
112
|
+
DA:4,2
|
|
113
|
+
DA:5,2
|
|
114
|
+
DA:6,2
|
|
115
|
+
DA:8,2
|
|
116
|
+
DA:9,2
|
|
117
|
+
DA:15,2
|
|
118
|
+
DA:16,2
|
|
119
|
+
DA:18,2
|
|
120
|
+
DA:19,2
|
|
121
|
+
DA:21,2
|
|
122
|
+
DA:25,2
|
|
123
|
+
DA:27,2
|
|
124
|
+
DA:31,2
|
|
125
|
+
LF:16
|
|
126
|
+
LH:16
|
|
127
|
+
BRF:0
|
|
128
|
+
BRH:0
|
|
129
|
+
end_of_record
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import ABatchNode from '@orchesty/nodejs-sdk/dist/lib/Batch/ABatchNode';
|
|
2
|
+
import BatchProcessDto from '@orchesty/nodejs-sdk/dist/lib/Utils/BatchProcessDto';
|
|
3
|
+
export declare const NAME = "onesignal-view-apps-batch";
|
|
4
|
+
export default class OnesignalViewAppsBatch extends ABatchNode {
|
|
5
|
+
getName(): string;
|
|
6
|
+
processAction(dto: BatchProcessDto): Promise<BatchProcessDto>;
|
|
7
|
+
}
|
|
8
|
+
export interface IOutput {
|
|
9
|
+
id: string;
|
|
10
|
+
name: string;
|
|
11
|
+
players: number;
|
|
12
|
+
messageable_players: number;
|
|
13
|
+
updated_at: string;
|
|
14
|
+
created_at: string;
|
|
15
|
+
gcm_key: string;
|
|
16
|
+
chrome_key: string;
|
|
17
|
+
chrome_web_origin: string;
|
|
18
|
+
chrome_web_gcm_sender_id: string;
|
|
19
|
+
chrome_web_default_notification_icon: string;
|
|
20
|
+
chrome_web_sub_domain: string;
|
|
21
|
+
apns_env: string;
|
|
22
|
+
apns_certificates: string;
|
|
23
|
+
safari_apns_certificate: string;
|
|
24
|
+
safari_site_origin: string;
|
|
25
|
+
safari_push_id: string;
|
|
26
|
+
safari_icon_16_16: string;
|
|
27
|
+
safari_icon_32_32: string;
|
|
28
|
+
safari_icon_64_64: string;
|
|
29
|
+
safari_icon_128_128: string;
|
|
30
|
+
safari_icon_256_256: string;
|
|
31
|
+
site_name: string;
|
|
32
|
+
basic_auth_key: string;
|
|
33
|
+
}
|
|
@@ -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 ABatchNode_1 = __importDefault(require("@orchesty/nodejs-sdk/dist/lib/Batch/ABatchNode"));
|
|
8
|
+
const HttpMethods_1 = require("@orchesty/nodejs-sdk/dist/lib/Transport/HttpMethods");
|
|
9
|
+
exports.NAME = 'onesignal-view-apps-batch';
|
|
10
|
+
class OnesignalViewAppsBatch extends ABatchNode_1.default {
|
|
11
|
+
getName() {
|
|
12
|
+
return exports.NAME;
|
|
13
|
+
}
|
|
14
|
+
async processAction(dto) {
|
|
15
|
+
const appInstall = await this.getApplicationInstallFromProcess(dto);
|
|
16
|
+
const req = await this.getApplication().getRequestDto(dto, appInstall, HttpMethods_1.HttpMethods.GET, 'apps');
|
|
17
|
+
const resp = await this.getSender().send(req, [200]);
|
|
18
|
+
const response = resp.getJsonBody();
|
|
19
|
+
dto.setItemList(response ?? []);
|
|
20
|
+
dto.removeBatchCursor();
|
|
21
|
+
return dto;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
exports.default = OnesignalViewAppsBatch;
|
|
@@ -0,0 +1,52 @@
|
|
|
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 = "onesignal-create-app-connector";
|
|
4
|
+
export default class OnesignalCreateAppConnector extends AConnector {
|
|
5
|
+
getName(): string;
|
|
6
|
+
processAction(dto: ProcessDto<IInput>): Promise<ProcessDto<IOutput>>;
|
|
7
|
+
}
|
|
8
|
+
export interface IInput {
|
|
9
|
+
name: string;
|
|
10
|
+
apns_env: string;
|
|
11
|
+
apns_p12: string;
|
|
12
|
+
apns_p12_password: string;
|
|
13
|
+
gcm_key: string;
|
|
14
|
+
android_gcm_sender_id: string;
|
|
15
|
+
chrome_web_origin: string;
|
|
16
|
+
chrome_web_default_notification_icon: string;
|
|
17
|
+
chrome_web_sub_domain: string;
|
|
18
|
+
chrome_key: string;
|
|
19
|
+
site_name: string;
|
|
20
|
+
safari_site_origin: string;
|
|
21
|
+
safari_apns_p12: string;
|
|
22
|
+
safari_apns_p12_password: string;
|
|
23
|
+
safari_icon_256_256: string;
|
|
24
|
+
additional_data_is_root_payload: boolean;
|
|
25
|
+
organization_id: string;
|
|
26
|
+
countent_type: string;
|
|
27
|
+
authorization: string;
|
|
28
|
+
}
|
|
29
|
+
export interface IOutput {
|
|
30
|
+
id: string;
|
|
31
|
+
name: string;
|
|
32
|
+
players: number;
|
|
33
|
+
messageable_players: number;
|
|
34
|
+
updated_at: string;
|
|
35
|
+
created_at: string;
|
|
36
|
+
gcm_key: string;
|
|
37
|
+
chrome_web_origin: string;
|
|
38
|
+
chrome_web_default_notification_icon: string;
|
|
39
|
+
chrome_web_sub_domain: string;
|
|
40
|
+
apns_env: string;
|
|
41
|
+
apns_certificates: string;
|
|
42
|
+
safari_apns_certificate: string;
|
|
43
|
+
safari_site_origin: string;
|
|
44
|
+
safari_push_id: string;
|
|
45
|
+
safari_icon_16_16: string;
|
|
46
|
+
safari_icon_32_32: string;
|
|
47
|
+
safari_icon_64_64: string;
|
|
48
|
+
safari_icon_128_128: string;
|
|
49
|
+
safari_icon_256_256: string;
|
|
50
|
+
site_name: string;
|
|
51
|
+
basic_auth_key: string;
|
|
52
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
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 AConnector_1 = __importDefault(require("@orchesty/nodejs-sdk/dist/lib/Connector/AConnector"));
|
|
8
|
+
const HttpMethods_1 = require("@orchesty/nodejs-sdk/dist/lib/Transport/HttpMethods");
|
|
9
|
+
exports.NAME = 'onesignal-create-app-connector';
|
|
10
|
+
class OnesignalCreateAppConnector extends AConnector_1.default {
|
|
11
|
+
getName() {
|
|
12
|
+
return exports.NAME;
|
|
13
|
+
}
|
|
14
|
+
async processAction(dto) {
|
|
15
|
+
const appInstall = await this.getApplicationInstallFromProcess(dto);
|
|
16
|
+
const req = await this.getApplication().getRequestDto(dto, appInstall, HttpMethods_1.HttpMethods.POST, 'apps', dto.getJsonData());
|
|
17
|
+
const resp = await this.getSender().send(req, [200]);
|
|
18
|
+
return dto.setNewJsonData(resp.getJsonBody());
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
exports.default = OnesignalCreateAppConnector;
|
|
@@ -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 = "onesignal";
|
|
8
|
+
export declare const API_KEY = "api_key";
|
|
9
|
+
export declare const REST_API_KEY = "rest_api_key";
|
|
10
|
+
export default class OnesignalApplication 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,89 @@
|
|
|
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.REST_API_KEY = exports.API_KEY = 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 Headers_1 = require("@orchesty/nodejs-sdk/dist/lib/Utils/Headers");
|
|
48
|
+
exports.NAME = 'onesignal';
|
|
49
|
+
exports.API_KEY = 'api_key';
|
|
50
|
+
exports.REST_API_KEY = 'rest_api_key';
|
|
51
|
+
class OnesignalApplication extends ABasicApplication_1.ABasicApplication {
|
|
52
|
+
getName() {
|
|
53
|
+
return exports.NAME;
|
|
54
|
+
}
|
|
55
|
+
getPublicName() {
|
|
56
|
+
return 'Onesignal';
|
|
57
|
+
}
|
|
58
|
+
getDescription() {
|
|
59
|
+
return 'Market-leading customer messaging and engagement solution, offering mobile and web push notifications, in-app messaging, SMS, and email';
|
|
60
|
+
}
|
|
61
|
+
getLogo() {
|
|
62
|
+
return 'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPCEtLSBHZW5lcmF0b3I6IEFkb2JlIElsbHVzdHJhdG9yIDI1LjAuMCwgU1ZHIEV4cG9ydCBQbHVnLUluIC4gU1ZHIFZlcnNpb246IDYuMDAgQnVpbGQgMCkgIC0tPgo8c3ZnIHZlcnNpb249IjEuMSIgaWQ9IlZyc3R2YV8xIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB4PSIwcHgiIHk9IjBweCIKCSB2aWV3Qm94PSIwIDAgMTAwIDEwMCIgc3R5bGU9ImVuYWJsZS1iYWNrZ3JvdW5kOm5ldyAwIDAgMTAwIDEwMDsiIHhtbDpzcGFjZT0icHJlc2VydmUiPgo8c3R5bGUgdHlwZT0idGV4dC9jc3MiPgoJLnN0MHtmaWxsOiNFNDRBNDk7fQo8L3N0eWxlPgo8Zz4KCTxwYXRoIGNsYXNzPSJzdDAiIGQ9Ik01MC4xLDRDMjIuNSw0LDAuMSwyNi41LDAuMSw1NC4xYzAsMTcuNiw5LjIsMzMsMjIuNyw0MS45YzAuOC0wLjUsMS42LTEuMSwyLjQtMS42YzAuNS0wLjMsMS40LTAuOCwxLjktMS4xCgkJYzAuOC0wLjMsMS42LTAuOCwyLjItMS4xYzAuOC0wLjMsMS42LTAuNSwyLjQtMS4xYzAuNS0wLjMsMS40LTAuNSwxLjktMC44YzAuOC0wLjMsMS45LTAuNSwyLjctMC44YzAuOC0wLjMsMS40LTAuMywyLjItMC41CgkJYzAuOC0wLjMsMS40LTAuMywyLjItMC41YzAuOC0wLjMsMS42LTAuMywyLjQtMC4zbDAsMGMwLjgsMCwxLjktMC4zLDIuNy0wLjNsMCwwdi0zLjJ2LTIuN1Y3MC44di0yLjd2LTEwaC0yLjd2LTUuNGgyLjdoOC4xaDIuNwoJCXYxNC42djN2MTEuNHYyLjd2NC4xYzcuNiwxLjEsMTQuMywzLjgsMjAuNiw3LjZsMCwwQzkxLDg3LjEsOTkuOSw3MS42LDk5LjksNTQuMUMxMDAuMiwyNi41LDc3LjcsNCw1MC4xLDRMNTAuMSw0eiBNNjUsNTQuMQoJCWMwLTguMS02LjgtMTQuOS0xNC45LTE0LjlzLTE0LjksNi44LTE0LjksMTQuOWMwLDUuNywzLjIsMTAuOCw4LjEsMTMuM3YzYy02LjItMi43LTEwLjgtOC45LTEwLjgtMTYuMmMwLTkuNyw3LjgtMTcuNiwxNy42LTE3LjYKCQlzMTcuNiw3LjgsMTcuNiwxNy42YzAsNi4yLTMuMiwxMS42LTguMSwxNC45di0zLjJDNjIuOSw2Mi43LDY1LDU4LjcsNjUsNTQuMUw2NSw1NC4xeiBNNTkuNiw4My42di0zYzExLjEtMy44LDE4LjktMTQuMywxOC45LTI2LjgKCQljMC0xNS40LTEyLjctMjguMS0yOC40LTI4LjFTMjEuNywzOC40LDIxLjcsNTQuMWMwLDEzLjMsOS4yLDI0LjYsMjEuNiwyNy42djIuN0MyOS42LDgxLjQsMTksNjguOSwxOSw1NC4xCgkJYzAtMTcuMywxMy44LTMxLjEsMzEuMS0zMS4xczMxLjEsMTMuOCwzMS4xLDMxLjFDODEuMyw2Ny45LDcyLjEsNzkuOCw1OS42LDgzLjZMNTkuNiw4My42eiIvPgo8L2c+Cjwvc3ZnPgo=';
|
|
63
|
+
}
|
|
64
|
+
getFormStack() {
|
|
65
|
+
const form = new Form_1.default(CoreFormsEnum_1.default.AUTHORIZATION_FORM, (0, CoreFormsEnum_1.getFormName)(CoreFormsEnum_1.default.AUTHORIZATION_FORM))
|
|
66
|
+
.addField(new Field_1.default(FieldType_1.default.TEXT, exports.API_KEY, 'api_key', undefined, true));
|
|
67
|
+
return new FormStack_1.default().addForm(form);
|
|
68
|
+
}
|
|
69
|
+
isAuthorized(applicationInstall) {
|
|
70
|
+
const authorizationForm = applicationInstall.getSettings()[CoreFormsEnum_1.default.AUTHORIZATION_FORM];
|
|
71
|
+
return authorizationForm?.[exports.API_KEY];
|
|
72
|
+
}
|
|
73
|
+
getRequestDto(dto, applicationInstall, method, _url, data) {
|
|
74
|
+
const settings = applicationInstall.getSettings();
|
|
75
|
+
const key = settings[CoreFormsEnum_1.default.AUTHORIZATION_FORM][exports.REST_API_KEY];
|
|
76
|
+
const url = `https://onesignal.com/api/v1/${_url}`;
|
|
77
|
+
const request = new RequestDto_1.default(url, method, dto);
|
|
78
|
+
request.setHeaders({
|
|
79
|
+
[Headers_1.CommonHeaders.CONTENT_TYPE]: Headers_1.JSON_TYPE,
|
|
80
|
+
[Headers_1.CommonHeaders.ACCEPT]: Headers_1.JSON_TYPE,
|
|
81
|
+
[Headers_1.CommonHeaders.AUTHORIZATION]: `Basic ${key}`,
|
|
82
|
+
});
|
|
83
|
+
if (data) {
|
|
84
|
+
request.setJsonBody(data);
|
|
85
|
+
}
|
|
86
|
+
return request;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
exports.default = OnesignalApplication;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@orchesty/connector-onesignal",
|
|
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-onesignal",
|
|
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,60 @@
|
|
|
1
|
+
import ABatchNode from '@orchesty/nodejs-sdk/dist/lib/Batch/ABatchNode';
|
|
2
|
+
import { HttpMethods } from '@orchesty/nodejs-sdk/dist/lib/Transport/HttpMethods';
|
|
3
|
+
import BatchProcessDto from '@orchesty/nodejs-sdk/dist/lib/Utils/BatchProcessDto';
|
|
4
|
+
|
|
5
|
+
export const NAME = 'onesignal-view-apps-batch';
|
|
6
|
+
|
|
7
|
+
export default class OnesignalViewAppsBatch extends ABatchNode {
|
|
8
|
+
|
|
9
|
+
public getName(): string {
|
|
10
|
+
return NAME;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
public async processAction(dto: BatchProcessDto): Promise<BatchProcessDto> {
|
|
14
|
+
const appInstall = await this.getApplicationInstallFromProcess(dto);
|
|
15
|
+
const req = await this.getApplication().getRequestDto(
|
|
16
|
+
dto,
|
|
17
|
+
appInstall,
|
|
18
|
+
HttpMethods.GET,
|
|
19
|
+
'apps',
|
|
20
|
+
);
|
|
21
|
+
const resp = await this.getSender().send<IOutput[]>(req, [200]);
|
|
22
|
+
const response = resp.getJsonBody();
|
|
23
|
+
|
|
24
|
+
dto.setItemList(response ?? []);
|
|
25
|
+
dto.removeBatchCursor();
|
|
26
|
+
|
|
27
|
+
return dto;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/* eslint-disable @typescript-eslint/naming-convention */
|
|
33
|
+
export interface IOutput {
|
|
34
|
+
id: string;
|
|
35
|
+
name: string;
|
|
36
|
+
players: number;
|
|
37
|
+
messageable_players: number;
|
|
38
|
+
updated_at: string;
|
|
39
|
+
created_at: string;
|
|
40
|
+
gcm_key: string;
|
|
41
|
+
chrome_key: string;
|
|
42
|
+
chrome_web_origin: string;
|
|
43
|
+
chrome_web_gcm_sender_id: string;
|
|
44
|
+
chrome_web_default_notification_icon: string;
|
|
45
|
+
chrome_web_sub_domain: string;
|
|
46
|
+
apns_env: string;
|
|
47
|
+
apns_certificates: string;
|
|
48
|
+
safari_apns_certificate: string;
|
|
49
|
+
safari_site_origin: string;
|
|
50
|
+
safari_push_id: string;
|
|
51
|
+
safari_icon_16_16: string;
|
|
52
|
+
safari_icon_32_32: string;
|
|
53
|
+
safari_icon_64_64: string;
|
|
54
|
+
safari_icon_128_128: string;
|
|
55
|
+
safari_icon_256_256: string;
|
|
56
|
+
site_name: string;
|
|
57
|
+
basic_auth_key: string;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/* eslint-enable @typescript-eslint/naming-convention */
|