@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,308 @@
|
|
|
1
|
+
{
|
|
2
|
+
"http": "GET https://api.personio.de/v1/company/employees?limit=200&offset=0",
|
|
3
|
+
"code": 200,
|
|
4
|
+
"body": {
|
|
5
|
+
"success": true,
|
|
6
|
+
"metadata": {
|
|
7
|
+
"total_elements": 1,
|
|
8
|
+
"current_page": 1,
|
|
9
|
+
"total_pages": 1
|
|
10
|
+
},
|
|
11
|
+
"offset": 0,
|
|
12
|
+
"limit": 20,
|
|
13
|
+
"data": [
|
|
14
|
+
{
|
|
15
|
+
"type": "Employee",
|
|
16
|
+
"attributes": {
|
|
17
|
+
"id": {
|
|
18
|
+
"label": "ID",
|
|
19
|
+
"value": 1,
|
|
20
|
+
"type": "integer",
|
|
21
|
+
"universal_id": "id"
|
|
22
|
+
},
|
|
23
|
+
"first_name": {
|
|
24
|
+
"label": "First name",
|
|
25
|
+
"value": "Alexander",
|
|
26
|
+
"type": "standard",
|
|
27
|
+
"universal_id": "first_name"
|
|
28
|
+
},
|
|
29
|
+
"last_name": {
|
|
30
|
+
"label": "Last name",
|
|
31
|
+
"value": "Bergmann",
|
|
32
|
+
"type": "standard",
|
|
33
|
+
"universal_id": "last_name"
|
|
34
|
+
},
|
|
35
|
+
"email": {
|
|
36
|
+
"label": "Email",
|
|
37
|
+
"value": "alexander.bergmann@demo.email",
|
|
38
|
+
"type": "standard",
|
|
39
|
+
"universal_id": "email"
|
|
40
|
+
},
|
|
41
|
+
"gender": {
|
|
42
|
+
"label": "Gender",
|
|
43
|
+
"value": "male",
|
|
44
|
+
"type": "standard",
|
|
45
|
+
"universal_id": "gender"
|
|
46
|
+
},
|
|
47
|
+
"status": {
|
|
48
|
+
"label": "Status",
|
|
49
|
+
"value": "active",
|
|
50
|
+
"type": "standard",
|
|
51
|
+
"universal_id": "status"
|
|
52
|
+
},
|
|
53
|
+
"position": {
|
|
54
|
+
"label": "Position",
|
|
55
|
+
"value": "CTO",
|
|
56
|
+
"type": "standard",
|
|
57
|
+
"universal_id": "position"
|
|
58
|
+
},
|
|
59
|
+
"supervisor": {
|
|
60
|
+
"label": "Supervisor",
|
|
61
|
+
"value": {
|
|
62
|
+
"type": "Employee",
|
|
63
|
+
"attributes": {
|
|
64
|
+
"id": {
|
|
65
|
+
"label": "ID",
|
|
66
|
+
"value": 2,
|
|
67
|
+
"type": "integer",
|
|
68
|
+
"universal_id": "id"
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
"type": "standard",
|
|
73
|
+
"universal_id": "supervisor"
|
|
74
|
+
},
|
|
75
|
+
"employment_type": {
|
|
76
|
+
"label": "Employment type",
|
|
77
|
+
"value": "external",
|
|
78
|
+
"type": "standard",
|
|
79
|
+
"universal_id": "employment_type"
|
|
80
|
+
},
|
|
81
|
+
"weekly_working_hours": {
|
|
82
|
+
"label": "Weekly hours",
|
|
83
|
+
"value": "40",
|
|
84
|
+
"type": "standard",
|
|
85
|
+
"universal_id": "weekly_working_hours"
|
|
86
|
+
},
|
|
87
|
+
"hire_date": {
|
|
88
|
+
"label": "Hire date",
|
|
89
|
+
"value": "2014-11-08T23:00:00.000Z",
|
|
90
|
+
"type": "date",
|
|
91
|
+
"universal_id": "hire_date"
|
|
92
|
+
},
|
|
93
|
+
"contract_end_date": {
|
|
94
|
+
"label": "Contract ends",
|
|
95
|
+
"value": null,
|
|
96
|
+
"type": "date",
|
|
97
|
+
"universal_id": "contract_end_date"
|
|
98
|
+
},
|
|
99
|
+
"termination_date": {
|
|
100
|
+
"label": "Termination date",
|
|
101
|
+
"value": null,
|
|
102
|
+
"type": "date",
|
|
103
|
+
"universal_id": "termination_date"
|
|
104
|
+
},
|
|
105
|
+
"termination_type": {
|
|
106
|
+
"label": "Termination type",
|
|
107
|
+
"value": null,
|
|
108
|
+
"type": "standard",
|
|
109
|
+
"universal_id": "termination_type"
|
|
110
|
+
},
|
|
111
|
+
"termination_reason": {
|
|
112
|
+
"label": "Termination reason",
|
|
113
|
+
"value": null,
|
|
114
|
+
"type": "standard",
|
|
115
|
+
"universal_id": "termination_reason"
|
|
116
|
+
},
|
|
117
|
+
"probation_period_end": {
|
|
118
|
+
"label": "Probation period end",
|
|
119
|
+
"value": null,
|
|
120
|
+
"type": "date",
|
|
121
|
+
"universal_id": "probation_period_end"
|
|
122
|
+
},
|
|
123
|
+
"created_at": {
|
|
124
|
+
"label": "created_at",
|
|
125
|
+
"value": "2017-05-23T09:49:03+02:00",
|
|
126
|
+
"type": "date",
|
|
127
|
+
"universal_id": "created_at"
|
|
128
|
+
},
|
|
129
|
+
"last_modified_at": {
|
|
130
|
+
"label": "Last modified",
|
|
131
|
+
"value": "2020-11-18T17:33:55+01:00",
|
|
132
|
+
"type": "date",
|
|
133
|
+
"universal_id": "last_modified_at"
|
|
134
|
+
},
|
|
135
|
+
"subcompany": {
|
|
136
|
+
"label": "Subcompany",
|
|
137
|
+
"value": {
|
|
138
|
+
"type": "Subcompany",
|
|
139
|
+
"attributes": {
|
|
140
|
+
"id": 7033,
|
|
141
|
+
"name": "CS Demo GmbH"
|
|
142
|
+
}
|
|
143
|
+
},
|
|
144
|
+
"type": "standard",
|
|
145
|
+
"universal_id": "subcompany"
|
|
146
|
+
},
|
|
147
|
+
"office": {
|
|
148
|
+
"label": "Office",
|
|
149
|
+
"value": {
|
|
150
|
+
"type": "Office",
|
|
151
|
+
"attributes": {
|
|
152
|
+
"id": 131014,
|
|
153
|
+
"name": "Munich"
|
|
154
|
+
}
|
|
155
|
+
},
|
|
156
|
+
"type": "standard",
|
|
157
|
+
"universal_id": "office"
|
|
158
|
+
},
|
|
159
|
+
"department": {
|
|
160
|
+
"label": "Department",
|
|
161
|
+
"value": {
|
|
162
|
+
"type": "Department",
|
|
163
|
+
"attributes": {
|
|
164
|
+
"id": 281521,
|
|
165
|
+
"name": "Customer Support"
|
|
166
|
+
}
|
|
167
|
+
},
|
|
168
|
+
"type": "standard",
|
|
169
|
+
"universal_id": "department"
|
|
170
|
+
},
|
|
171
|
+
"cost_centers": {
|
|
172
|
+
"label": "Cost center",
|
|
173
|
+
"value": [
|
|
174
|
+
{
|
|
175
|
+
"type": "CostCenter",
|
|
176
|
+
"attributes": {
|
|
177
|
+
"id": 82957,
|
|
178
|
+
"name": "Cost center 1",
|
|
179
|
+
"percentage": 100
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
],
|
|
183
|
+
"type": "standard",
|
|
184
|
+
"universal_id": "cost_centers"
|
|
185
|
+
},
|
|
186
|
+
"holiday_calendar": {
|
|
187
|
+
"label": "Public holidays",
|
|
188
|
+
"value": {
|
|
189
|
+
"type": "HolidayCalendar",
|
|
190
|
+
"attributes": {
|
|
191
|
+
"id": 2,
|
|
192
|
+
"name": "Deutschland (Bayern) Feiertage",
|
|
193
|
+
"country": "DE",
|
|
194
|
+
"state": "Bayern"
|
|
195
|
+
}
|
|
196
|
+
},
|
|
197
|
+
"type": "standard",
|
|
198
|
+
"universal_id": "holiday_calendar"
|
|
199
|
+
},
|
|
200
|
+
"absence_entitlement": {
|
|
201
|
+
"label": "Absence entitlement",
|
|
202
|
+
"value": [
|
|
203
|
+
{
|
|
204
|
+
"type": "TimeOffType",
|
|
205
|
+
"attributes": {
|
|
206
|
+
"id": 113437,
|
|
207
|
+
"name": "Paid vacation",
|
|
208
|
+
"category": "paid_vacation",
|
|
209
|
+
"entitlement": 24
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
],
|
|
213
|
+
"type": "standard",
|
|
214
|
+
"universal_id": "absence_entitlement"
|
|
215
|
+
},
|
|
216
|
+
"work_schedule": {
|
|
217
|
+
"label": "Work schedule",
|
|
218
|
+
"value": {
|
|
219
|
+
"type": "WorkSchedule",
|
|
220
|
+
"attributes": {
|
|
221
|
+
"id": 97188,
|
|
222
|
+
"name": "Full-time, 40 hours without time tracking, (mon,tue,wed,thu,fri)",
|
|
223
|
+
"valid_from": null,
|
|
224
|
+
"monday": "08:00",
|
|
225
|
+
"tuesday": "08:00",
|
|
226
|
+
"wednesday": "08:00",
|
|
227
|
+
"thursday": "08:00",
|
|
228
|
+
"friday": "08:00",
|
|
229
|
+
"saturday": "00:00",
|
|
230
|
+
"sunday": "00:00"
|
|
231
|
+
}
|
|
232
|
+
},
|
|
233
|
+
"type": "standard",
|
|
234
|
+
"universal_id": "work_schedule"
|
|
235
|
+
},
|
|
236
|
+
"fix_salary": {
|
|
237
|
+
"label": "Fix salary",
|
|
238
|
+
"value": 3000,
|
|
239
|
+
"type": "decimal",
|
|
240
|
+
"universal_id": "fix_salary",
|
|
241
|
+
"currency": "EUR"
|
|
242
|
+
},
|
|
243
|
+
"fix_salary_interval": {
|
|
244
|
+
"label": "Salary interval",
|
|
245
|
+
"value": "monthly",
|
|
246
|
+
"type": "standard",
|
|
247
|
+
"universal_id": "fix_salary_interval"
|
|
248
|
+
},
|
|
249
|
+
"hourly_salary": {
|
|
250
|
+
"label": "Hourly salary",
|
|
251
|
+
"value": 0,
|
|
252
|
+
"type": "decimal",
|
|
253
|
+
"universal_id": "hourly_salary",
|
|
254
|
+
"currency": "EUR"
|
|
255
|
+
},
|
|
256
|
+
"vacation_day_balance": {
|
|
257
|
+
"label": "Vacation day balance",
|
|
258
|
+
"value": 2,
|
|
259
|
+
"type": "decimal",
|
|
260
|
+
"universal_id": "vacation_day_balance"
|
|
261
|
+
},
|
|
262
|
+
"last_working_day": {
|
|
263
|
+
"label": "Last day of work",
|
|
264
|
+
"value": null,
|
|
265
|
+
"type": "date",
|
|
266
|
+
"universal_id": "last_working_day"
|
|
267
|
+
},
|
|
268
|
+
"profile_picture": {
|
|
269
|
+
"label": "Profile Picture",
|
|
270
|
+
"value": "https://api.personio.de/v1/company/employees/1132888/profile-picture",
|
|
271
|
+
"type": "standard",
|
|
272
|
+
"universal_id": "profile_picture"
|
|
273
|
+
},
|
|
274
|
+
"team": {
|
|
275
|
+
"label": "Team",
|
|
276
|
+
"value": {
|
|
277
|
+
"type": "Team",
|
|
278
|
+
"attributes": {
|
|
279
|
+
"id": 59026,
|
|
280
|
+
"name": "T_X"
|
|
281
|
+
}
|
|
282
|
+
},
|
|
283
|
+
"type": "standard",
|
|
284
|
+
"universal_id": "team"
|
|
285
|
+
},
|
|
286
|
+
"dynamic_24407": {
|
|
287
|
+
"label": "Titel",
|
|
288
|
+
"value": "Dr",
|
|
289
|
+
"universal_id": null,
|
|
290
|
+
"type": "standard"
|
|
291
|
+
},
|
|
292
|
+
"dynamic_21827": {
|
|
293
|
+
"label": "IBAN",
|
|
294
|
+
"value": "DE98 8989 9898 0000 8989 00",
|
|
295
|
+
"universal_id": "iban",
|
|
296
|
+
"type": "standard"
|
|
297
|
+
},
|
|
298
|
+
"dynamic_33400": {
|
|
299
|
+
"label": "Anniversary Date",
|
|
300
|
+
"value": "2021-01-01T00:00:00.000Z",
|
|
301
|
+
"universal_id": null,
|
|
302
|
+
"type": "date"
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
]
|
|
307
|
+
}
|
|
308
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
{
|
|
2
|
+
"headers": {
|
|
3
|
+
"user": "TestUser"
|
|
4
|
+
},
|
|
5
|
+
"data": [
|
|
6
|
+
{
|
|
7
|
+
"body": "{\"type\":\"Employee\",\"attributes\":{\"id\":{\"label\":\"ID\",\"value\":1,\"type\":\"integer\",\"universal_id\":\"id\"},\"first_name\":{\"label\":\"First name\",\"value\":\"Alexander\",\"type\":\"standard\",\"universal_id\":\"first_name\"},\"last_name\":{\"label\":\"Last name\",\"value\":\"Bergmann\",\"type\":\"standard\",\"universal_id\":\"last_name\"},\"email\":{\"label\":\"Email\",\"value\":\"alexander.bergmann@demo.email\",\"type\":\"standard\",\"universal_id\":\"email\"},\"gender\":{\"label\":\"Gender\",\"value\":\"male\",\"type\":\"standard\",\"universal_id\":\"gender\"},\"status\":{\"label\":\"Status\",\"value\":\"active\",\"type\":\"standard\",\"universal_id\":\"status\"},\"position\":{\"label\":\"Position\",\"value\":\"CTO\",\"type\":\"standard\",\"universal_id\":\"position\"},\"supervisor\":{\"label\":\"Supervisor\",\"value\":{\"type\":\"Employee\",\"attributes\":{\"id\":{\"label\":\"ID\",\"value\":2,\"type\":\"integer\",\"universal_id\":\"id\"}}},\"type\":\"standard\",\"universal_id\":\"supervisor\"},\"employment_type\":{\"label\":\"Employment type\",\"value\":\"external\",\"type\":\"standard\",\"universal_id\":\"employment_type\"},\"weekly_working_hours\":{\"label\":\"Weekly hours\",\"value\":\"40\",\"type\":\"standard\",\"universal_id\":\"weekly_working_hours\"},\"hire_date\":{\"label\":\"Hire date\",\"value\":\"2014-11-08T23:00:00.000Z\",\"type\":\"date\",\"universal_id\":\"hire_date\"},\"contract_end_date\":{\"label\":\"Contract ends\",\"value\":null,\"type\":\"date\",\"universal_id\":\"contract_end_date\"},\"termination_date\":{\"label\":\"Termination date\",\"value\":null,\"type\":\"date\",\"universal_id\":\"termination_date\"},\"termination_type\":{\"label\":\"Termination type\",\"value\":null,\"type\":\"standard\",\"universal_id\":\"termination_type\"},\"termination_reason\":{\"label\":\"Termination reason\",\"value\":null,\"type\":\"standard\",\"universal_id\":\"termination_reason\"},\"probation_period_end\":{\"label\":\"Probation period end\",\"value\":null,\"type\":\"date\",\"universal_id\":\"probation_period_end\"},\"created_at\":{\"label\":\"created_at\",\"value\":\"2017-05-23T09:49:03+02:00\",\"type\":\"date\",\"universal_id\":\"created_at\"},\"last_modified_at\":{\"label\":\"Last modified\",\"value\":\"2020-11-18T17:33:55+01:00\",\"type\":\"date\",\"universal_id\":\"last_modified_at\"},\"subcompany\":{\"label\":\"Subcompany\",\"value\":{\"type\":\"Subcompany\",\"attributes\":{\"id\":7033,\"name\":\"CS Demo GmbH\"}},\"type\":\"standard\",\"universal_id\":\"subcompany\"},\"office\":{\"label\":\"Office\",\"value\":{\"type\":\"Office\",\"attributes\":{\"id\":131014,\"name\":\"Munich\"}},\"type\":\"standard\",\"universal_id\":\"office\"},\"department\":{\"label\":\"Department\",\"value\":{\"type\":\"Department\",\"attributes\":{\"id\":281521,\"name\":\"Customer Support\"}},\"type\":\"standard\",\"universal_id\":\"department\"},\"cost_centers\":{\"label\":\"Cost center\",\"value\":[{\"type\":\"CostCenter\",\"attributes\":{\"id\":82957,\"name\":\"Cost center 1\",\"percentage\":100}}],\"type\":\"standard\",\"universal_id\":\"cost_centers\"},\"holiday_calendar\":{\"label\":\"Public holidays\",\"value\":{\"type\":\"HolidayCalendar\",\"attributes\":{\"id\":2,\"name\":\"Deutschland (Bayern) Feiertage\",\"country\":\"DE\",\"state\":\"Bayern\"}},\"type\":\"standard\",\"universal_id\":\"holiday_calendar\"},\"absence_entitlement\":{\"label\":\"Absence entitlement\",\"value\":[{\"type\":\"TimeOffType\",\"attributes\":{\"id\":113437,\"name\":\"Paid vacation\",\"category\":\"paid_vacation\",\"entitlement\":24}}],\"type\":\"standard\",\"universal_id\":\"absence_entitlement\"},\"work_schedule\":{\"label\":\"Work schedule\",\"value\":{\"type\":\"WorkSchedule\",\"attributes\":{\"id\":97188,\"name\":\"Full-time, 40 hours without time tracking, (mon,tue,wed,thu,fri)\",\"valid_from\":null,\"monday\":\"08:00\",\"tuesday\":\"08:00\",\"wednesday\":\"08:00\",\"thursday\":\"08:00\",\"friday\":\"08:00\",\"saturday\":\"00:00\",\"sunday\":\"00:00\"}},\"type\":\"standard\",\"universal_id\":\"work_schedule\"},\"fix_salary\":{\"label\":\"Fix salary\",\"value\":3000,\"type\":\"decimal\",\"universal_id\":\"fix_salary\",\"currency\":\"EUR\"},\"fix_salary_interval\":{\"label\":\"Salary interval\",\"value\":\"monthly\",\"type\":\"standard\",\"universal_id\":\"fix_salary_interval\"},\"hourly_salary\":{\"label\":\"Hourly salary\",\"value\":0,\"type\":\"decimal\",\"universal_id\":\"hourly_salary\",\"currency\":\"EUR\"},\"vacation_day_balance\":{\"label\":\"Vacation day balance\",\"value\":2,\"type\":\"decimal\",\"universal_id\":\"vacation_day_balance\"},\"last_working_day\":{\"label\":\"Last day of work\",\"value\":null,\"type\":\"date\",\"universal_id\":\"last_working_day\"},\"profile_picture\":{\"label\":\"Profile Picture\",\"value\":\"https://api.personio.de/v1/company/employees/1132888/profile-picture\",\"type\":\"standard\",\"universal_id\":\"profile_picture\"},\"team\":{\"label\":\"Team\",\"value\":{\"type\":\"Team\",\"attributes\":{\"id\":59026,\"name\":\"T_X\"}},\"type\":\"standard\",\"universal_id\":\"team\"},\"dynamic_24407\":{\"label\":\"Titel\",\"value\":\"Dr\",\"universal_id\":null,\"type\":\"standard\"},\"dynamic_21827\":{\"label\":\"IBAN\",\"value\":\"DE98 8989 9898 0000 8989 00\",\"universal_id\":\"iban\",\"type\":\"standard\"},\"dynamic_33400\":{\"label\":\"Anniversary Date\",\"value\":\"2021-01-01T00:00:00.000Z\",\"universal_id\":null,\"type\":\"date\"}}}",
|
|
8
|
+
"headers": {}
|
|
9
|
+
}
|
|
10
|
+
]
|
|
11
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
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 PERSONIO_GET_PROJECTS_BATCH } from '../PersonioGetProjectsBatch';
|
|
5
|
+
|
|
6
|
+
let tester: NodeTester;
|
|
7
|
+
|
|
8
|
+
describe('Tests for PersonioGetProjectsBatch', () => {
|
|
9
|
+
beforeEach(() => {
|
|
10
|
+
tester = new NodeTester(container, __filename);
|
|
11
|
+
init();
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
it('process - ok', async () => {
|
|
15
|
+
await tester.testBatch(PERSONIO_GET_PROJECTS_BATCH);
|
|
16
|
+
});
|
|
17
|
+
});
|
|
@@ -0,0 +1,17 @@
|
|
|
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 PERSONIO_LIST_EMPLOYEES_BATCH } from '../PersonioListEmployeesBatch';
|
|
5
|
+
|
|
6
|
+
let tester: NodeTester;
|
|
7
|
+
|
|
8
|
+
describe('Tests for PersonioListEmployeesBatch', () => {
|
|
9
|
+
beforeEach(() => {
|
|
10
|
+
tester = new NodeTester(container, __filename);
|
|
11
|
+
init();
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
it('process - ok', async () => {
|
|
15
|
+
await tester.testBatch(PERSONIO_LIST_EMPLOYEES_BATCH);
|
|
16
|
+
});
|
|
17
|
+
});
|
|
@@ -0,0 +1,94 @@
|
|
|
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 { CLIENT_ID, CLIENT_SECRET } from '@orchesty/nodejs-sdk/dist/lib/Authorization/Type/OAuth2/IOAuth2Application';
|
|
9
|
+
import CurlSender from '@orchesty/nodejs-sdk/dist/lib/Transport/Curl/CurlSender';
|
|
10
|
+
import RequestDto from '@orchesty/nodejs-sdk/dist/lib/Transport/Curl/RequestDto';
|
|
11
|
+
import { HttpMethods } from '@orchesty/nodejs-sdk/dist/lib/Transport/HttpMethods';
|
|
12
|
+
import AProcessDto from '@orchesty/nodejs-sdk/dist/lib/Utils/AProcessDto';
|
|
13
|
+
import { CommonHeaders, JSON_TYPE } from '@orchesty/nodejs-sdk/dist/lib/Utils/Headers';
|
|
14
|
+
|
|
15
|
+
export const NAME = 'personio';
|
|
16
|
+
|
|
17
|
+
export default class PersonioApplication extends ABasicApplication {
|
|
18
|
+
|
|
19
|
+
public constructor(private readonly sender: CurlSender) {
|
|
20
|
+
super();
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
public getName(): string {
|
|
24
|
+
return NAME;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
public getPublicName(): string {
|
|
28
|
+
return 'Personio';
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
public getDescription(): string {
|
|
32
|
+
return 'Software that automates and simplifies your HR tasks within a single software so that you have enough time for important HR topics';
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
public getLogo(): string {
|
|
36
|
+
return 'data:image/svg+xml;base64,PHN2ZyBpZD0iVnJzdHZhXzEiIGRhdGEtbmFtZT0iVnJzdHZhIDEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgdmlld0JveD0iMCAwIDkzLjU1IDk5LjI1Ij48cGF0aCBkPSJNNDEuMjYsNTcuODRjLTIsLjgzLTMuOCwxLjU2LTUuNTgsMi4yNmEx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i4zMSwwLDMuNDZTODguNCw5OSw4Ny4zMSw5OC45MmMtLjMyLDAtLjY0LDAtMSwwaC03M2MtMi4zNywwLTIuMzgsMC0yLjM4LTIuMzQsMC0uODcsMC0xLjc1LDAtMi42M2EyLjcsMi43LDAsMCwxLDEuNDktLjE0cTM3LjQxLDAsNzQuODEsMEM4Ny43NSw5My44MSw4OC4yOCw5My42NSw4OC43NCw5NFoiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0zLjA4IC0wLjU3KSIvPjxwYXRoIGQ9Ik04OC43NCw5NGMtNC42NiwwLTkuMzIsMC0xNCwwSDExYy4xOC0uNTQuNjQtLjI2Ljk0LS4yNnEzNy43OSwwLDc1LjU2LDBDODcuOSw5My42OCw4OC40MSw5My40OCw4OC43NCw5NFoiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0zLjA4IC0wLjU3KSIvPjwvc3ZnPg==';
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
public getFormStack(): FormStack {
|
|
40
|
+
const form = new Form(CoreFormsEnum.AUTHORIZATION_FORM, getFormName(CoreFormsEnum.AUTHORIZATION_FORM))
|
|
41
|
+
.addField(new Field(FieldType.TEXT, CLIENT_ID, ' client id', undefined, true))
|
|
42
|
+
.addField(new Field(FieldType.TEXT, CLIENT_SECRET, 'client secret', undefined, true));
|
|
43
|
+
|
|
44
|
+
return new FormStack().addForm(form);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
public isAuthorized(applicationInstall: ApplicationInstall): boolean {
|
|
48
|
+
const authorizationForm = applicationInstall.getSettings()[CoreFormsEnum.AUTHORIZATION_FORM];
|
|
49
|
+
return authorizationForm?.[CLIENT_ID] && authorizationForm?.[CLIENT_SECRET];
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
public async getRequestDto(
|
|
53
|
+
dto: AProcessDto,
|
|
54
|
+
applicationInstall: ApplicationInstall,
|
|
55
|
+
method: HttpMethods,
|
|
56
|
+
_url?: string,
|
|
57
|
+
data?: unknown,
|
|
58
|
+
): Promise<RequestDto> {
|
|
59
|
+
const request = new RequestDto(`https://api.personio.de/v1/company/${_url}`, method, dto);
|
|
60
|
+
request.setHeaders({
|
|
61
|
+
[CommonHeaders.CONTENT_TYPE]: JSON_TYPE,
|
|
62
|
+
[CommonHeaders.ACCEPT]: JSON_TYPE,
|
|
63
|
+
[CommonHeaders.AUTHORIZATION]: await this.getAuthorizationCode(applicationInstall, dto),
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
if (data) {
|
|
67
|
+
request.setJsonBody(data);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
return request;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
private async getAuthorizationCode(appInstall: ApplicationInstall, dto: AProcessDto): Promise<string> {
|
|
74
|
+
const clientId = appInstall.getSettings()[CoreFormsEnum.AUTHORIZATION_FORM][CLIENT_ID];
|
|
75
|
+
const clientSecret = appInstall.getSettings()[CoreFormsEnum.AUTHORIZATION_FORM][CLIENT_SECRET];
|
|
76
|
+
const req = new RequestDto(
|
|
77
|
+
`https://api.personio.de/v1/auth?client_id=${clientId}&client_secret=${clientSecret}`,
|
|
78
|
+
HttpMethods.GET,
|
|
79
|
+
dto,
|
|
80
|
+
);
|
|
81
|
+
|
|
82
|
+
const resp = await this.sender.send<ITokenResponse>(req);
|
|
83
|
+
|
|
84
|
+
return resp.getJsonBody().data.token;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
interface ITokenResponse {
|
|
90
|
+
success: boolean;
|
|
91
|
+
data: {
|
|
92
|
+
token: string;
|
|
93
|
+
};
|
|
94
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
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 { CLIENT_ID, CLIENT_SECRET } from '@orchesty/nodejs-sdk/dist/lib/Authorization/Type/OAuth2/IOAuth2Application';
|
|
5
|
+
import PersonioGetProjectsBatch from '../src/Batch/PersonioGetProjectsBatch';
|
|
6
|
+
import PersonioListEmployeesBatch from '../src/Batch/PersonioListEmployeesBatch';
|
|
7
|
+
import PersonioApplication, { NAME } from '../src/PersonioApplication';
|
|
8
|
+
|
|
9
|
+
export default function init(): void {
|
|
10
|
+
appInstall(NAME, DEFAULT_USER, {
|
|
11
|
+
[CoreFormsEnum.AUTHORIZATION_FORM]: {
|
|
12
|
+
[CLIENT_ID]: 'client_id',
|
|
13
|
+
[CLIENT_SECRET]: 'client_secret',
|
|
14
|
+
},
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
const app = new PersonioApplication(sender);
|
|
18
|
+
container.setApplication(app);
|
|
19
|
+
|
|
20
|
+
const listEmployees = new PersonioListEmployeesBatch();
|
|
21
|
+
const getProjects = new PersonioGetProjectsBatch();
|
|
22
|
+
|
|
23
|
+
listEmployees
|
|
24
|
+
.setSender(sender)
|
|
25
|
+
.setDb(db)
|
|
26
|
+
.setApplication(app);
|
|
27
|
+
container.setBatch(listEmployees);
|
|
28
|
+
|
|
29
|
+
getProjects
|
|
30
|
+
.setSender(sender)
|
|
31
|
+
.setDb(db)
|
|
32
|
+
.setApplication(app);
|
|
33
|
+
container.setBatch(getProjects);
|
|
34
|
+
}
|
package/tsconfig.json
ADDED