@orchesty/connector-personio 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 +102 -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 +146 -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/PersonioGetProjectsBatch.ts.html +232 -0
- package/coverage/lcov-report/src/Batch/PersonioListEmployeesBatch.ts.html +1108 -0
- package/coverage/lcov-report/src/Batch/index.html +131 -0
- package/coverage/lcov-report/src/PersonioApplication.ts.html +367 -0
- package/coverage/lcov-report/src/index.html +116 -0
- package/coverage/lcov-report/test/dataProvider.ts.html +187 -0
- package/coverage/lcov-report/test/index.html +116 -0
- package/coverage/lcov.info +149 -0
- package/dist/Batch/PersonioGetProjectsBatch.d.ts +17 -0
- package/dist/Batch/PersonioGetProjectsBatch.js +24 -0
- package/dist/Batch/PersonioListEmployeesBatch.d.ts +310 -0
- package/dist/Batch/PersonioListEmployeesBatch.js +27 -0
- package/dist/PersonioApplication.d.ts +20 -0
- package/dist/PersonioApplication.js +99 -0
- package/dist/package.json +22 -0
- package/jest.config.js +13 -0
- package/package.json +22 -0
- package/src/Batch/PersonioGetProjectsBatch.ts +49 -0
- package/src/Batch/PersonioListEmployeesBatch.ts +341 -0
- package/src/Batch/__tests__/Data/PersonioGetProjectsBatch/input.json +6 -0
- package/src/Batch/__tests__/Data/PersonioGetProjectsBatch/mock.json +10 -0
- package/src/Batch/__tests__/Data/PersonioGetProjectsBatch/mock1.json +19 -0
- package/src/Batch/__tests__/Data/PersonioGetProjectsBatch/output.json +11 -0
- package/src/Batch/__tests__/Data/PersonioListEmployeesBatch/input.json +6 -0
- package/src/Batch/__tests__/Data/PersonioListEmployeesBatch/mock.json +10 -0
- package/src/Batch/__tests__/Data/PersonioListEmployeesBatch/mock1.json +308 -0
- package/src/Batch/__tests__/Data/PersonioListEmployeesBatch/output.json +11 -0
- package/src/Batch/__tests__/PersonioGetProjectsBatch.ts +17 -0
- package/src/Batch/__tests__/PersonioListEmployeesBatch.ts +17 -0
- package/src/PersonioApplication.ts +94 -0
- package/test/dataProvider.ts +34 -0
- package/tsconfig.json +8 -0
- package/tsconfig.prod.json +13 -0
- package/tsconfig.prod.tsbuildinfo +1 -0
|
@@ -0,0 +1,310 @@
|
|
|
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 = "personio-list-employees-batch";
|
|
4
|
+
export default class PersonioListEmployeesBatch extends ABatchNode {
|
|
5
|
+
getName(): string;
|
|
6
|
+
processAction(dto: BatchProcessDto): Promise<BatchProcessDto>;
|
|
7
|
+
}
|
|
8
|
+
export interface IResponse {
|
|
9
|
+
success: boolean;
|
|
10
|
+
metadata: {
|
|
11
|
+
total_elements: number;
|
|
12
|
+
current_page: number;
|
|
13
|
+
total_pages: number;
|
|
14
|
+
};
|
|
15
|
+
offset: number;
|
|
16
|
+
limit: number;
|
|
17
|
+
data: IOutput[];
|
|
18
|
+
}
|
|
19
|
+
export interface IOutput {
|
|
20
|
+
type: string;
|
|
21
|
+
attributes: {
|
|
22
|
+
id: {
|
|
23
|
+
label: string;
|
|
24
|
+
value: number;
|
|
25
|
+
type: string;
|
|
26
|
+
universal_id: string;
|
|
27
|
+
};
|
|
28
|
+
first_name: {
|
|
29
|
+
label: string;
|
|
30
|
+
value: string;
|
|
31
|
+
type: string;
|
|
32
|
+
universal_id: string;
|
|
33
|
+
};
|
|
34
|
+
last_name: {
|
|
35
|
+
label: string;
|
|
36
|
+
value: string;
|
|
37
|
+
type: string;
|
|
38
|
+
universal_id: string;
|
|
39
|
+
};
|
|
40
|
+
email: {
|
|
41
|
+
label: string;
|
|
42
|
+
value: string;
|
|
43
|
+
type: string;
|
|
44
|
+
universal_id: string;
|
|
45
|
+
};
|
|
46
|
+
gender: {
|
|
47
|
+
label: string;
|
|
48
|
+
value: string;
|
|
49
|
+
type: string;
|
|
50
|
+
universal_id: string;
|
|
51
|
+
};
|
|
52
|
+
status: {
|
|
53
|
+
label: string;
|
|
54
|
+
value: string;
|
|
55
|
+
type: string;
|
|
56
|
+
universal_id: string;
|
|
57
|
+
};
|
|
58
|
+
position: {
|
|
59
|
+
label: string;
|
|
60
|
+
value: string;
|
|
61
|
+
type: string;
|
|
62
|
+
universal_id: string;
|
|
63
|
+
};
|
|
64
|
+
supervisor: {
|
|
65
|
+
label: string;
|
|
66
|
+
value: {
|
|
67
|
+
type: string;
|
|
68
|
+
attributes: {
|
|
69
|
+
id: {
|
|
70
|
+
label: string;
|
|
71
|
+
value: number;
|
|
72
|
+
type: string;
|
|
73
|
+
universal_id: string;
|
|
74
|
+
};
|
|
75
|
+
};
|
|
76
|
+
};
|
|
77
|
+
type: string;
|
|
78
|
+
universal_id: string;
|
|
79
|
+
};
|
|
80
|
+
employment_type: {
|
|
81
|
+
label: string;
|
|
82
|
+
value: string;
|
|
83
|
+
type: string;
|
|
84
|
+
universal_id: string;
|
|
85
|
+
};
|
|
86
|
+
weekly_working_hours: {
|
|
87
|
+
label: string;
|
|
88
|
+
value: string;
|
|
89
|
+
type: string;
|
|
90
|
+
universal_id: string;
|
|
91
|
+
};
|
|
92
|
+
hire_date: {
|
|
93
|
+
label: string;
|
|
94
|
+
value: string;
|
|
95
|
+
type: string;
|
|
96
|
+
universal_id: string;
|
|
97
|
+
};
|
|
98
|
+
contract_end_date: {
|
|
99
|
+
label: string;
|
|
100
|
+
value: null;
|
|
101
|
+
type: string;
|
|
102
|
+
universal_id: string;
|
|
103
|
+
};
|
|
104
|
+
termination_date: {
|
|
105
|
+
label: string;
|
|
106
|
+
value: null;
|
|
107
|
+
type: string;
|
|
108
|
+
universal_id: string;
|
|
109
|
+
};
|
|
110
|
+
termination_type: {
|
|
111
|
+
label: string;
|
|
112
|
+
value: null;
|
|
113
|
+
type: string;
|
|
114
|
+
universal_id: string;
|
|
115
|
+
};
|
|
116
|
+
termination_reason: {
|
|
117
|
+
label: string;
|
|
118
|
+
value: null;
|
|
119
|
+
type: string;
|
|
120
|
+
universal_id: string;
|
|
121
|
+
};
|
|
122
|
+
probation_period_end: {
|
|
123
|
+
label: string;
|
|
124
|
+
value: null;
|
|
125
|
+
type: string;
|
|
126
|
+
universal_id: string;
|
|
127
|
+
};
|
|
128
|
+
created_at: {
|
|
129
|
+
label: string;
|
|
130
|
+
value: string;
|
|
131
|
+
type: string;
|
|
132
|
+
universal_id: string;
|
|
133
|
+
};
|
|
134
|
+
last_modified_at: {
|
|
135
|
+
label: string;
|
|
136
|
+
value: string;
|
|
137
|
+
type: string;
|
|
138
|
+
universal_id: string;
|
|
139
|
+
};
|
|
140
|
+
subcompany: {
|
|
141
|
+
label: string;
|
|
142
|
+
value: {
|
|
143
|
+
type: string;
|
|
144
|
+
attributes: {
|
|
145
|
+
id: number;
|
|
146
|
+
name: string;
|
|
147
|
+
};
|
|
148
|
+
};
|
|
149
|
+
type: string;
|
|
150
|
+
universal_id: string;
|
|
151
|
+
};
|
|
152
|
+
office: {
|
|
153
|
+
label: string;
|
|
154
|
+
value: {
|
|
155
|
+
type: string;
|
|
156
|
+
attributes: {
|
|
157
|
+
id: number;
|
|
158
|
+
name: string;
|
|
159
|
+
};
|
|
160
|
+
};
|
|
161
|
+
type: string;
|
|
162
|
+
universal_id: string;
|
|
163
|
+
};
|
|
164
|
+
department: {
|
|
165
|
+
label: string;
|
|
166
|
+
value: {
|
|
167
|
+
type: string;
|
|
168
|
+
attributes: {
|
|
169
|
+
id: number;
|
|
170
|
+
name: string;
|
|
171
|
+
};
|
|
172
|
+
};
|
|
173
|
+
type: string;
|
|
174
|
+
universal_id: string;
|
|
175
|
+
};
|
|
176
|
+
cost_centers: {
|
|
177
|
+
label: string;
|
|
178
|
+
value: [
|
|
179
|
+
{
|
|
180
|
+
type: string;
|
|
181
|
+
attributes: {
|
|
182
|
+
id: number;
|
|
183
|
+
name: string;
|
|
184
|
+
percentage: number;
|
|
185
|
+
};
|
|
186
|
+
}
|
|
187
|
+
];
|
|
188
|
+
type: string;
|
|
189
|
+
universal_id: string;
|
|
190
|
+
};
|
|
191
|
+
holiday_calendar: {
|
|
192
|
+
label: string;
|
|
193
|
+
value: {
|
|
194
|
+
type: string;
|
|
195
|
+
attributes: {
|
|
196
|
+
id: number;
|
|
197
|
+
name: string;
|
|
198
|
+
country: string;
|
|
199
|
+
state: string;
|
|
200
|
+
};
|
|
201
|
+
};
|
|
202
|
+
type: string;
|
|
203
|
+
universal_id: string;
|
|
204
|
+
};
|
|
205
|
+
absence_entitlement: {
|
|
206
|
+
label: string;
|
|
207
|
+
value: [
|
|
208
|
+
{
|
|
209
|
+
type: string;
|
|
210
|
+
attributes: {
|
|
211
|
+
id: number;
|
|
212
|
+
name: string;
|
|
213
|
+
category: string;
|
|
214
|
+
entitlement: number;
|
|
215
|
+
};
|
|
216
|
+
}
|
|
217
|
+
];
|
|
218
|
+
type: string;
|
|
219
|
+
universal_id: string;
|
|
220
|
+
};
|
|
221
|
+
work_schedule: {
|
|
222
|
+
label: string;
|
|
223
|
+
value: {
|
|
224
|
+
type: string;
|
|
225
|
+
attributes: {
|
|
226
|
+
id: number;
|
|
227
|
+
name: string;
|
|
228
|
+
valid_from: null;
|
|
229
|
+
monday: string;
|
|
230
|
+
tuesday: string;
|
|
231
|
+
wednesday: string;
|
|
232
|
+
thursday: string;
|
|
233
|
+
friday: string;
|
|
234
|
+
saturday: string;
|
|
235
|
+
sunday: string;
|
|
236
|
+
};
|
|
237
|
+
};
|
|
238
|
+
type: string;
|
|
239
|
+
universal_id: string;
|
|
240
|
+
};
|
|
241
|
+
fix_salary: {
|
|
242
|
+
label: string;
|
|
243
|
+
value: number;
|
|
244
|
+
type: string;
|
|
245
|
+
universal_id: string;
|
|
246
|
+
currency: string;
|
|
247
|
+
};
|
|
248
|
+
fix_salary_interval: {
|
|
249
|
+
label: string;
|
|
250
|
+
value: string;
|
|
251
|
+
type: string;
|
|
252
|
+
universal_id: string;
|
|
253
|
+
};
|
|
254
|
+
hourly_salary: {
|
|
255
|
+
label: string;
|
|
256
|
+
value: number;
|
|
257
|
+
type: string;
|
|
258
|
+
universal_id: string;
|
|
259
|
+
currency: string;
|
|
260
|
+
};
|
|
261
|
+
vacation_day_balance: {
|
|
262
|
+
label: string;
|
|
263
|
+
value: number;
|
|
264
|
+
type: string;
|
|
265
|
+
universal_id: string;
|
|
266
|
+
};
|
|
267
|
+
last_working_day: {
|
|
268
|
+
label: string;
|
|
269
|
+
value: null;
|
|
270
|
+
type: string;
|
|
271
|
+
universal_id: string;
|
|
272
|
+
};
|
|
273
|
+
profile_picture: {
|
|
274
|
+
label: string;
|
|
275
|
+
value: string;
|
|
276
|
+
type: string;
|
|
277
|
+
universal_id: string;
|
|
278
|
+
};
|
|
279
|
+
team: {
|
|
280
|
+
label: string;
|
|
281
|
+
value: {
|
|
282
|
+
type: string;
|
|
283
|
+
attributes: {
|
|
284
|
+
id: number;
|
|
285
|
+
name: string;
|
|
286
|
+
};
|
|
287
|
+
};
|
|
288
|
+
type: string;
|
|
289
|
+
universal_id: string;
|
|
290
|
+
};
|
|
291
|
+
dynamic_24407: {
|
|
292
|
+
label: string;
|
|
293
|
+
value: string;
|
|
294
|
+
universal_id: null;
|
|
295
|
+
type: string;
|
|
296
|
+
};
|
|
297
|
+
dynamic_21827: {
|
|
298
|
+
label: string;
|
|
299
|
+
value: string;
|
|
300
|
+
universal_id: string;
|
|
301
|
+
type: string;
|
|
302
|
+
};
|
|
303
|
+
dynamic_33400: {
|
|
304
|
+
label: string;
|
|
305
|
+
value: string;
|
|
306
|
+
universal_id: null;
|
|
307
|
+
type: string;
|
|
308
|
+
};
|
|
309
|
+
};
|
|
310
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
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 = 'personio-list-employees-batch';
|
|
10
|
+
class PersonioListEmployeesBatch extends ABatchNode_1.default {
|
|
11
|
+
getName() {
|
|
12
|
+
return exports.NAME;
|
|
13
|
+
}
|
|
14
|
+
async processAction(dto) {
|
|
15
|
+
const offset = dto.getBatchCursor('0');
|
|
16
|
+
const appInstall = await this.getApplicationInstallFromProcess(dto);
|
|
17
|
+
const req = await this.getApplication().getRequestDto(dto, appInstall, HttpMethods_1.HttpMethods.GET, `employees?limit=200&offset=${offset}`);
|
|
18
|
+
const resp = await this.getSender().send(req, [200]);
|
|
19
|
+
const response = resp.getJsonBody();
|
|
20
|
+
dto.setItemList(response.data ?? []);
|
|
21
|
+
if (response.metadata.current_page < response.metadata.total_pages) {
|
|
22
|
+
dto.setBatchCursor((Number(offset) + 1).toString());
|
|
23
|
+
}
|
|
24
|
+
return dto;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
exports.default = PersonioListEmployeesBatch;
|
|
@@ -0,0 +1,20 @@
|
|
|
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 CurlSender from '@orchesty/nodejs-sdk/dist/lib/Transport/Curl/CurlSender';
|
|
5
|
+
import RequestDto from '@orchesty/nodejs-sdk/dist/lib/Transport/Curl/RequestDto';
|
|
6
|
+
import { HttpMethods } from '@orchesty/nodejs-sdk/dist/lib/Transport/HttpMethods';
|
|
7
|
+
import AProcessDto from '@orchesty/nodejs-sdk/dist/lib/Utils/AProcessDto';
|
|
8
|
+
export declare const NAME = "personio";
|
|
9
|
+
export default class PersonioApplication extends ABasicApplication {
|
|
10
|
+
private readonly sender;
|
|
11
|
+
constructor(sender: CurlSender);
|
|
12
|
+
getName(): string;
|
|
13
|
+
getPublicName(): string;
|
|
14
|
+
getDescription(): string;
|
|
15
|
+
getLogo(): string;
|
|
16
|
+
getFormStack(): FormStack;
|
|
17
|
+
isAuthorized(applicationInstall: ApplicationInstall): boolean;
|
|
18
|
+
getRequestDto(dto: AProcessDto, applicationInstall: ApplicationInstall, method: HttpMethods, _url?: string, data?: unknown): Promise<RequestDto>;
|
|
19
|
+
private getAuthorizationCode;
|
|
20
|
+
}
|
|
@@ -0,0 +1,99 @@
|
|
|
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.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 IOAuth2Application_1 = require("@orchesty/nodejs-sdk/dist/lib/Authorization/Type/OAuth2/IOAuth2Application");
|
|
47
|
+
const RequestDto_1 = __importDefault(require("@orchesty/nodejs-sdk/dist/lib/Transport/Curl/RequestDto"));
|
|
48
|
+
const HttpMethods_1 = require("@orchesty/nodejs-sdk/dist/lib/Transport/HttpMethods");
|
|
49
|
+
const Headers_1 = require("@orchesty/nodejs-sdk/dist/lib/Utils/Headers");
|
|
50
|
+
exports.NAME = 'personio';
|
|
51
|
+
class PersonioApplication extends ABasicApplication_1.ABasicApplication {
|
|
52
|
+
sender;
|
|
53
|
+
constructor(sender) {
|
|
54
|
+
super();
|
|
55
|
+
this.sender = sender;
|
|
56
|
+
}
|
|
57
|
+
getName() {
|
|
58
|
+
return exports.NAME;
|
|
59
|
+
}
|
|
60
|
+
getPublicName() {
|
|
61
|
+
return 'Personio';
|
|
62
|
+
}
|
|
63
|
+
getDescription() {
|
|
64
|
+
return 'Software that automates and simplifies your HR tasks within a single software so that you have enough time for important HR topics';
|
|
65
|
+
}
|
|
66
|
+
getLogo() {
|
|
67
|
+
return 'data:image/svg+xml;base64,PHN2ZyBpZD0iVnJzdHZhXzEiIGRhdGEtbmFtZT0iVnJzdHZhIDEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgdmlld0JveD0iMCAwIDkzLjU1IDk5LjI1Ij48cGF0aCBkPSJNNDEuMjYsNTcuODRjLTIsLjgzLTMuOCwxLjU2LTUuNTgsMi4yNmExOS42NywxOS42NywwLDAsMS00LjkzLDEuMzMsNC43NSw0Ljc1LDAsMCwxLTQtMUEzLjMsMy4zLDAsMCwxLDI2LDU2LjQ3YTMuMDgsMy4wOCwwLDAsMSwzLjYtMS42NCw0LDQsMCwwLDAsMi4yOC0uMThBODkuNzQsODkuNzQsMCwwLDAsNDMsNDkuNzRhMS45LDEuOSwwLDAsMCwxLT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4OC43NCw5NFoiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0zLjA4IC0wLjU3KSIvPjxwYXRoIGQ9Ik04OC43NCw5NGMtNC42NiwwLTkuMzIsMC0xNCwwSDExYy4xOC0uNTQuNjQtLjI2Ljk0LS4yNnEzNy43OSwwLDc1LjU2LDBDODcuOSw5My42OCw4OC40MSw5My40OCw4OC43NCw5NFoiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0zLjA4IC0wLjU3KSIvPjwvc3ZnPg==';
|
|
68
|
+
}
|
|
69
|
+
getFormStack() {
|
|
70
|
+
const form = new Form_1.default(CoreFormsEnum_1.default.AUTHORIZATION_FORM, (0, CoreFormsEnum_1.getFormName)(CoreFormsEnum_1.default.AUTHORIZATION_FORM))
|
|
71
|
+
.addField(new Field_1.default(FieldType_1.default.TEXT, IOAuth2Application_1.CLIENT_ID, ' client id', undefined, true))
|
|
72
|
+
.addField(new Field_1.default(FieldType_1.default.TEXT, IOAuth2Application_1.CLIENT_SECRET, 'client secret', undefined, true));
|
|
73
|
+
return new FormStack_1.default().addForm(form);
|
|
74
|
+
}
|
|
75
|
+
isAuthorized(applicationInstall) {
|
|
76
|
+
const authorizationForm = applicationInstall.getSettings()[CoreFormsEnum_1.default.AUTHORIZATION_FORM];
|
|
77
|
+
return authorizationForm?.[IOAuth2Application_1.CLIENT_ID] && authorizationForm?.[IOAuth2Application_1.CLIENT_SECRET];
|
|
78
|
+
}
|
|
79
|
+
async getRequestDto(dto, applicationInstall, method, _url, data) {
|
|
80
|
+
const request = new RequestDto_1.default(`https://api.personio.de/v1/company/${_url}`, method, dto);
|
|
81
|
+
request.setHeaders({
|
|
82
|
+
[Headers_1.CommonHeaders.CONTENT_TYPE]: Headers_1.JSON_TYPE,
|
|
83
|
+
[Headers_1.CommonHeaders.ACCEPT]: Headers_1.JSON_TYPE,
|
|
84
|
+
[Headers_1.CommonHeaders.AUTHORIZATION]: await this.getAuthorizationCode(applicationInstall, dto),
|
|
85
|
+
});
|
|
86
|
+
if (data) {
|
|
87
|
+
request.setJsonBody(data);
|
|
88
|
+
}
|
|
89
|
+
return request;
|
|
90
|
+
}
|
|
91
|
+
async getAuthorizationCode(appInstall, dto) {
|
|
92
|
+
const clientId = appInstall.getSettings()[CoreFormsEnum_1.default.AUTHORIZATION_FORM][IOAuth2Application_1.CLIENT_ID];
|
|
93
|
+
const clientSecret = appInstall.getSettings()[CoreFormsEnum_1.default.AUTHORIZATION_FORM][IOAuth2Application_1.CLIENT_SECRET];
|
|
94
|
+
const req = new RequestDto_1.default(`https://api.personio.de/v1/auth?client_id=${clientId}&client_secret=${clientSecret}`, HttpMethods_1.HttpMethods.GET, dto);
|
|
95
|
+
const resp = await this.sender.send(req);
|
|
96
|
+
return resp.getJsonBody().data.token;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
exports.default = PersonioApplication;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@orchesty/connector-personio",
|
|
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-personio",
|
|
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,49 @@
|
|
|
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 = 'personio-get-projects-batch';
|
|
6
|
+
|
|
7
|
+
export default class PersonioGetProjectsBatch 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
|
+
'attendances/projects',
|
|
20
|
+
);
|
|
21
|
+
const resp = await this.getSender().send<IResponse>(req, [200]);
|
|
22
|
+
const response = resp.getJsonBody();
|
|
23
|
+
|
|
24
|
+
dto.setItemList(response.data ?? []);
|
|
25
|
+
dto.removeBatchCursor();
|
|
26
|
+
|
|
27
|
+
return dto;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/* eslint-disable @typescript-eslint/naming-convention */
|
|
33
|
+
interface IResponse {
|
|
34
|
+
success: boolean;
|
|
35
|
+
data: IOutput[];
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export interface IOutput {
|
|
39
|
+
id: number;
|
|
40
|
+
type: string;
|
|
41
|
+
attributes: {
|
|
42
|
+
name: string;
|
|
43
|
+
active: boolean;
|
|
44
|
+
created_at: string;
|
|
45
|
+
updated_at: string;
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/* eslint-enable @typescript-eslint/naming-convention */
|