@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.
Files changed (46) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/LICENSE +190 -0
  3. package/coverage/clover.xml +102 -0
  4. package/coverage/coverage-final.json +5 -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/Batch/PersonioGetProjectsBatch.ts.html +232 -0
  14. package/coverage/lcov-report/src/Batch/PersonioListEmployeesBatch.ts.html +1108 -0
  15. package/coverage/lcov-report/src/Batch/index.html +131 -0
  16. package/coverage/lcov-report/src/PersonioApplication.ts.html +367 -0
  17. package/coverage/lcov-report/src/index.html +116 -0
  18. package/coverage/lcov-report/test/dataProvider.ts.html +187 -0
  19. package/coverage/lcov-report/test/index.html +116 -0
  20. package/coverage/lcov.info +149 -0
  21. package/dist/Batch/PersonioGetProjectsBatch.d.ts +17 -0
  22. package/dist/Batch/PersonioGetProjectsBatch.js +24 -0
  23. package/dist/Batch/PersonioListEmployeesBatch.d.ts +310 -0
  24. package/dist/Batch/PersonioListEmployeesBatch.js +27 -0
  25. package/dist/PersonioApplication.d.ts +20 -0
  26. package/dist/PersonioApplication.js +99 -0
  27. package/dist/package.json +22 -0
  28. package/jest.config.js +13 -0
  29. package/package.json +22 -0
  30. package/src/Batch/PersonioGetProjectsBatch.ts +49 -0
  31. package/src/Batch/PersonioListEmployeesBatch.ts +341 -0
  32. package/src/Batch/__tests__/Data/PersonioGetProjectsBatch/input.json +6 -0
  33. package/src/Batch/__tests__/Data/PersonioGetProjectsBatch/mock.json +10 -0
  34. package/src/Batch/__tests__/Data/PersonioGetProjectsBatch/mock1.json +19 -0
  35. package/src/Batch/__tests__/Data/PersonioGetProjectsBatch/output.json +11 -0
  36. package/src/Batch/__tests__/Data/PersonioListEmployeesBatch/input.json +6 -0
  37. package/src/Batch/__tests__/Data/PersonioListEmployeesBatch/mock.json +10 -0
  38. package/src/Batch/__tests__/Data/PersonioListEmployeesBatch/mock1.json +308 -0
  39. package/src/Batch/__tests__/Data/PersonioListEmployeesBatch/output.json +11 -0
  40. package/src/Batch/__tests__/PersonioGetProjectsBatch.ts +17 -0
  41. package/src/Batch/__tests__/PersonioListEmployeesBatch.ts +17 -0
  42. package/src/PersonioApplication.ts +94 -0
  43. package/test/dataProvider.ts +34 -0
  44. package/tsconfig.json +8 -0
  45. package/tsconfig.prod.json +13 -0
  46. package/tsconfig.prod.tsbuildinfo +1 -0
@@ -0,0 +1,341 @@
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-list-employees-batch';
6
+
7
+ export default class PersonioListEmployeesBatch extends ABatchNode {
8
+
9
+ public getName(): string {
10
+ return NAME;
11
+ }
12
+
13
+ public async processAction(dto: BatchProcessDto): Promise<BatchProcessDto> {
14
+ const offset = dto.getBatchCursor('0');
15
+ const appInstall = await this.getApplicationInstallFromProcess(dto);
16
+ const req = await this.getApplication().getRequestDto(
17
+ dto,
18
+ appInstall,
19
+ HttpMethods.GET,
20
+ `employees?limit=200&offset=${offset}`,
21
+ );
22
+ const resp = await this.getSender().send<IResponse>(req, [200]);
23
+ const response = resp.getJsonBody();
24
+
25
+ dto.setItemList(response.data ?? []);
26
+ if (response.metadata.current_page < response.metadata.total_pages) {
27
+ dto.setBatchCursor((Number(offset) + 1).toString());
28
+ }
29
+
30
+ return dto;
31
+ }
32
+
33
+ }
34
+
35
+ /* eslint-disable @typescript-eslint/naming-convention */
36
+ export interface IResponse {
37
+ success: boolean;
38
+ metadata: {
39
+ total_elements: number;
40
+ current_page: number;
41
+ total_pages: number;
42
+ };
43
+ offset: number;
44
+ limit: number;
45
+ data: IOutput[];
46
+ }
47
+
48
+ export interface IOutput {
49
+ type: string;
50
+ attributes: {
51
+ id: {
52
+ label: string;
53
+ value: number;
54
+ type: string;
55
+ universal_id: string;
56
+ };
57
+ first_name: {
58
+ label: string;
59
+ value: string;
60
+ type: string;
61
+ universal_id: string;
62
+ };
63
+ last_name: {
64
+ label: string;
65
+ value: string;
66
+ type: string;
67
+ universal_id: string;
68
+ };
69
+ email: {
70
+ label: string;
71
+ value: string;
72
+ type: string;
73
+ universal_id: string;
74
+ };
75
+ gender: {
76
+ label: string;
77
+ value: string;
78
+ type: string;
79
+ universal_id: string;
80
+ };
81
+ status: {
82
+ label: string;
83
+ value: string;
84
+ type: string;
85
+ universal_id: string;
86
+ };
87
+ position: {
88
+ label: string;
89
+ value: string;
90
+ type: string;
91
+ universal_id: string;
92
+ };
93
+ supervisor: {
94
+ label: string;
95
+ value: {
96
+ type: string;
97
+ attributes: {
98
+ id: {
99
+ label: string;
100
+ value: number;
101
+ type: string;
102
+ universal_id: string;
103
+ };
104
+ };
105
+ };
106
+ type: string;
107
+ universal_id: string;
108
+ };
109
+ employment_type: {
110
+ label: string;
111
+ value: string;
112
+ type: string;
113
+ universal_id: string;
114
+ };
115
+ weekly_working_hours: {
116
+ label: string;
117
+ value: string;
118
+ type: string;
119
+ universal_id: string;
120
+ };
121
+ hire_date: {
122
+ label: string;
123
+ value: string;
124
+ type: string;
125
+ universal_id: string;
126
+ };
127
+ contract_end_date: {
128
+ label: string;
129
+ value: null;
130
+ type: string;
131
+ universal_id: string;
132
+ };
133
+ termination_date: {
134
+ label: string;
135
+ value: null;
136
+ type: string;
137
+ universal_id: string;
138
+ };
139
+ termination_type: {
140
+ label: string;
141
+ value: null;
142
+ type: string;
143
+ universal_id: string;
144
+ };
145
+ termination_reason: {
146
+ label: string;
147
+ value: null;
148
+ type: string;
149
+ universal_id: string;
150
+ };
151
+ probation_period_end: {
152
+ label: string;
153
+ value: null;
154
+ type: string;
155
+ universal_id: string;
156
+ };
157
+ created_at: {
158
+ label: string;
159
+ value: string;
160
+ type: string;
161
+ universal_id: string;
162
+ };
163
+ last_modified_at: {
164
+ label: string;
165
+ value: string;
166
+ type: string;
167
+ universal_id: string;
168
+ };
169
+ subcompany: {
170
+ label: string;
171
+ value: {
172
+ type: string;
173
+ attributes: {
174
+ id: number;
175
+ name: string;
176
+ };
177
+ };
178
+ type: string;
179
+ universal_id: string;
180
+ };
181
+ office: {
182
+ label: string;
183
+ value: {
184
+ type: string;
185
+ attributes: {
186
+ id: number;
187
+ name: string;
188
+ };
189
+ };
190
+ type: string;
191
+ universal_id: string;
192
+ };
193
+ department: {
194
+ label: string;
195
+ value: {
196
+ type: string;
197
+ attributes: {
198
+ id: number;
199
+ name: string;
200
+ };
201
+ };
202
+ type: string;
203
+ universal_id: string;
204
+ };
205
+ cost_centers: {
206
+ label: string;
207
+ value: [
208
+ {
209
+ type: string;
210
+ attributes: {
211
+ id: number;
212
+ name: string;
213
+ percentage: number;
214
+ };
215
+ },
216
+ ];
217
+ type: string;
218
+ universal_id: string;
219
+ };
220
+ holiday_calendar: {
221
+ label: string;
222
+ value: {
223
+ type: string;
224
+ attributes: {
225
+ id: number;
226
+ name: string;
227
+ country: string;
228
+ state: string;
229
+ };
230
+ };
231
+ type: string;
232
+ universal_id: string;
233
+ };
234
+ absence_entitlement: {
235
+ label: string;
236
+ value: [
237
+ {
238
+ type: string;
239
+ attributes: {
240
+ id: number;
241
+ name: string;
242
+ category: string;
243
+ entitlement: number;
244
+ };
245
+ },
246
+ ];
247
+ type: string;
248
+ universal_id: string;
249
+ };
250
+ work_schedule: {
251
+ label: string;
252
+ value: {
253
+ type: string;
254
+ attributes: {
255
+ id: number;
256
+ name: string;
257
+ valid_from: null;
258
+ monday: string;
259
+ tuesday: string;
260
+ wednesday: string;
261
+ thursday: string;
262
+ friday: string;
263
+ saturday: string;
264
+ sunday: string;
265
+ };
266
+ };
267
+ type: string;
268
+ universal_id: string;
269
+ };
270
+ fix_salary: {
271
+ label: string;
272
+ value: number;
273
+ type: string;
274
+ universal_id: string;
275
+ currency: string;
276
+ };
277
+ fix_salary_interval: {
278
+ label: string;
279
+ value: string;
280
+ type: string;
281
+ universal_id: string;
282
+ };
283
+ hourly_salary: {
284
+ label: string;
285
+ value: number;
286
+ type: string;
287
+ universal_id: string;
288
+ currency: string;
289
+ };
290
+ vacation_day_balance: {
291
+ label: string;
292
+ value: number;
293
+ type: string;
294
+ universal_id: string;
295
+ };
296
+ last_working_day: {
297
+ label: string;
298
+ value: null;
299
+ type: string;
300
+ universal_id: string;
301
+ };
302
+ profile_picture: {
303
+ label: string;
304
+ value: string;
305
+ type: string;
306
+ universal_id: string;
307
+ };
308
+ team: {
309
+ label: string;
310
+ value: {
311
+ type: string;
312
+ attributes: {
313
+ id: number;
314
+ name: string;
315
+ };
316
+ };
317
+ type: string;
318
+ universal_id: string;
319
+ };
320
+ dynamic_24407: {
321
+ label: string;
322
+ value: string;
323
+ universal_id: null;
324
+ type: string;
325
+ };
326
+ dynamic_21827: {
327
+ label: string;
328
+ value: string;
329
+ universal_id: string;
330
+ type: string;
331
+ };
332
+ dynamic_33400: {
333
+ label: string;
334
+ value: string;
335
+ universal_id: null;
336
+ type: string;
337
+ };
338
+ };
339
+ }
340
+
341
+ /* eslint-enable @typescript-eslint/naming-convention */
@@ -0,0 +1,6 @@
1
+ {
2
+ "headers": {
3
+ "user": "TestUser"
4
+ },
5
+ "data": {}
6
+ }
@@ -0,0 +1,10 @@
1
+ {
2
+ "http": "GET https://api.personio.de/v1/auth?client_id=client_id&client_secret=client_secret",
3
+ "code": 200,
4
+ "body": {
5
+ "success": true,
6
+ "data": {
7
+ "token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwOi8vYXBpLmRldi5wZXJzb25pby5kZTozMDAwMS92MS9hdXRoIiwiaWF0IjoxNDg5MDkxMzA2LCJleHAiOjE0ODkxNzc3MDYsIm5iZiI6MTQ4OTA5MTMwNiwianRpIjoiZmU1ZjkxOGY2MDZjOWI4OGMwMzM0ZmJkZjkyYzkwMzgiLCJzdWIiOiJPR014TVdRd1kySmxZbVF6Tm1RNVpqQmxOell6WmpsaSJ9.QZZCdlDjmL-LYdoDx2XLUfhwTdcjDgm9h4t-6JoACiM"
8
+ }
9
+ }
10
+ }
@@ -0,0 +1,19 @@
1
+ {
2
+ "http": "GET https://api.personio.de/v1/company/attendances/projects",
3
+ "code": 200,
4
+ "body": {
5
+ "success": true,
6
+ "data": [
7
+ {
8
+ "id": 1,
9
+ "type": "Project",
10
+ "attributes": {
11
+ "name": "Project name",
12
+ "active": true,
13
+ "created_at": "2022-02-01T12:00:00+0100",
14
+ "updated_at": "2022-02-01T12:00:00+0100"
15
+ }
16
+ }
17
+ ]
18
+ }
19
+ }
@@ -0,0 +1,11 @@
1
+ {
2
+ "headers": {
3
+ "user": "TestUser"
4
+ },
5
+ "data": [
6
+ {
7
+ "body": "{\"id\":1,\"type\":\"Project\",\"attributes\":{\"name\":\"Project name\",\"active\":true,\"created_at\":\"2022-02-01T12:00:00+0100\",\"updated_at\":\"2022-02-01T12:00:00+0100\"}}",
8
+ "headers": {}
9
+ }
10
+ ]
11
+ }
@@ -0,0 +1,6 @@
1
+ {
2
+ "headers": {
3
+ "user": "TestUser"
4
+ },
5
+ "data": {}
6
+ }
@@ -0,0 +1,10 @@
1
+ {
2
+ "http": "GET https://api.personio.de/v1/auth?client_id=client_id&client_secret=client_secret",
3
+ "code": 200,
4
+ "body": {
5
+ "success": true,
6
+ "data": {
7
+ "token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwOi8vYXBpLmRldi5wZXJzb25pby5kZTozMDAwMS92MS9hdXRoIiwiaWF0IjoxNDg5MDkxMzA2LCJleHAiOjE0ODkxNzc3MDYsIm5iZiI6MTQ4OTA5MTMwNiwianRpIjoiZmU1ZjkxOGY2MDZjOWI4OGMwMzM0ZmJkZjkyYzkwMzgiLCJzdWIiOiJPR014TVdRd1kySmxZbVF6Tm1RNVpqQmxOell6WmpsaSJ9.QZZCdlDjmL-LYdoDx2XLUfhwTdcjDgm9h4t-6JoACiM"
8
+ }
9
+ }
10
+ }