@pipedream/recruitee 0.0.1 → 0.1.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.
@@ -0,0 +1,542 @@
1
+ export default [
2
+ {
3
+ "label": "Adelaide",
4
+ "value": "Australia/Adelaide",
5
+ },
6
+ {
7
+ "label": "Aden",
8
+ "value": "Asia/Aden",
9
+ },
10
+ {
11
+ "label": "Alaska",
12
+ "value": "America/Anchorage",
13
+ },
14
+ {
15
+ "label": "Algiers",
16
+ "value": "Africa/Algiers",
17
+ },
18
+ {
19
+ "label": "Almaty",
20
+ "value": "Asia/Almaty",
21
+ },
22
+ {
23
+ "label": "Amman",
24
+ "value": "Asia/Amman",
25
+ },
26
+ {
27
+ "label": "Amsterdam",
28
+ "value": "Europe/Amsterdam",
29
+ },
30
+ {
31
+ "label": "Amsterdam, Berlin, Rome, Stockholm, Vienna",
32
+ "value": "Europe/Berlin",
33
+ },
34
+ {
35
+ "label": "Arizona",
36
+ "value": "America/Phoenix",
37
+ },
38
+ {
39
+ "label": "Astana, Dhaka",
40
+ "value": "Asia/Dhaka",
41
+ },
42
+ {
43
+ "label": "Athens",
44
+ "value": "Europe/Athens",
45
+ },
46
+ {
47
+ "label": "Atlantic Time (Canada)",
48
+ "value": "Canada/Atlantic",
49
+ },
50
+ {
51
+ "label": "Auckland, Wellington",
52
+ "value": "Pacific/Auckland",
53
+ },
54
+ {
55
+ "label": "Azores",
56
+ "value": "Atlantic/Azores",
57
+ },
58
+ {
59
+ "label": "Baghdad",
60
+ "value": "Asia/Baghdad",
61
+ },
62
+ {
63
+ "label": "Bahrain",
64
+ "value": "Asia/Bahrain",
65
+ },
66
+ {
67
+ "label": "Baku, Tbilisi, Yerevan",
68
+ "value": "Asia/Baku",
69
+ },
70
+ {
71
+ "label": "Bangkok",
72
+ "value": "Asia/Bangkok",
73
+ },
74
+ {
75
+ "label": "Beijing, Shanghai",
76
+ "value": "Asia/Shanghai",
77
+ },
78
+ {
79
+ "label": "Beirut",
80
+ "value": "Asia/Beirut",
81
+ },
82
+ {
83
+ "label": "Belgrade, Bratislava, Ljubljana",
84
+ "value": "Europe/Belgrade",
85
+ },
86
+ {
87
+ "label": "Bogota",
88
+ "value": "America/Bogota",
89
+ },
90
+ {
91
+ "label": "Brasilia",
92
+ "value": "America/Araguaina",
93
+ },
94
+ {
95
+ "label": "Brisbane",
96
+ "value": "Australia/Brisbane",
97
+ },
98
+ {
99
+ "label": "Brussels",
100
+ "value": "Europe/Brussels",
101
+ },
102
+ {
103
+ "label": "Bucharest",
104
+ "value": "Europe/Bucharest",
105
+ },
106
+ {
107
+ "label": "Budapest",
108
+ "value": "Europe/Budapest",
109
+ },
110
+ {
111
+ "label": "Buenos Aires, Georgetown",
112
+ "value": "America/Argentina/Buenos_Aires",
113
+ },
114
+ {
115
+ "label": "Cairo",
116
+ "value": "Africa/Cairo",
117
+ },
118
+ {
119
+ "label": "Canberra, Melbourne, Sydney",
120
+ "value": "Australia/Sydney",
121
+ },
122
+ {
123
+ "label": "Cape Verde Islands",
124
+ "value": "Atlantic/Cape_Verde",
125
+ },
126
+ {
127
+ "label": "Caracas",
128
+ "value": "America/Caracas",
129
+ },
130
+ {
131
+ "label": "Casablanca",
132
+ "value": "Africa/Casablanca",
133
+ },
134
+ {
135
+ "label": "Central Time (US and Canada)",
136
+ "value": "America/Chicago",
137
+ },
138
+ {
139
+ "label": "Copenhagen",
140
+ "value": "Europe/Copenhagen",
141
+ },
142
+ {
143
+ "label": "Costa Rica",
144
+ "value": "America/Costa_Rica",
145
+ },
146
+ {
147
+ "label": "Dacca",
148
+ "value": "Asia/Dacca",
149
+ },
150
+ {
151
+ "label": "Damascus",
152
+ "value": "Asia/Damascus",
153
+ },
154
+ {
155
+ "label": "Darwin",
156
+ "value": "Australia/Darwin",
157
+ },
158
+ {
159
+ "label": "Djibouti",
160
+ "value": "Africa/Djibouti",
161
+ },
162
+ {
163
+ "label": "Dubai",
164
+ "value": "Asia/Dubai",
165
+ },
166
+ {
167
+ "label": "Dublin",
168
+ "value": "Europe/Dublin",
169
+ },
170
+ {
171
+ "label": "Eastern Time (US and Canada)",
172
+ "value": "America/New_York",
173
+ },
174
+ {
175
+ "label": "Edmonton",
176
+ "value": "America/Edmonton",
177
+ },
178
+ {
179
+ "label": "El Salvador",
180
+ "value": "America/El_Salvador",
181
+ },
182
+ {
183
+ "label": "Fiji Islands, Marshall Islands",
184
+ "value": "Pacific/Fiji",
185
+ },
186
+ {
187
+ "label": "Greenland",
188
+ "value": "America/Godthab",
189
+ },
190
+ {
191
+ "label": "Greenwich Mean Time",
192
+ "value": "Etc/Greenwich",
193
+ },
194
+ {
195
+ "label": "Guam, Port Moresby",
196
+ "value": "Pacific/Port_Moresby",
197
+ },
198
+ {
199
+ "label": "Guatemala",
200
+ "value": "America/Guatemala",
201
+ },
202
+ {
203
+ "label": "Halifax",
204
+ "value": "America/Halifax",
205
+ },
206
+ {
207
+ "label": "Harare, Pretoria",
208
+ "value": "Africa/Harare",
209
+ },
210
+ {
211
+ "label": "Hawaii",
212
+ "value": "Pacific/Honolulu",
213
+ },
214
+ {
215
+ "label": "Helsinki",
216
+ "value": "Europe/Helsinki",
217
+ },
218
+ {
219
+ "label": "Hobart",
220
+ "value": "Australia/Hobart",
221
+ },
222
+ {
223
+ "label": "Hong Kong",
224
+ "value": "Asia/Hong_Kong",
225
+ },
226
+ {
227
+ "label": "Independent State of Samoa",
228
+ "value": "Pacific/Apia",
229
+ },
230
+ {
231
+ "label": "India",
232
+ "value": "Asia/Calcutta",
233
+ },
234
+ {
235
+ "label": "Indiana (East)",
236
+ "value": "America/Indianapolis",
237
+ },
238
+ {
239
+ "label": "Irkutsk, Ulaanbaatar",
240
+ "value": "Asia/Irkutsk",
241
+ },
242
+ {
243
+ "label": "Islamabad, Karachi, Tashkent",
244
+ "value": "Asia/Tashkent",
245
+ },
246
+ {
247
+ "label": "Istanbul",
248
+ "value": "Europe/Istanbul",
249
+ },
250
+ {
251
+ "label": "Jakarta",
252
+ "value": "Asia/Jakarta",
253
+ },
254
+ {
255
+ "label": "Jerusalem",
256
+ "value": "Asia/Jerusalem",
257
+ },
258
+ {
259
+ "label": "Johannesburg",
260
+ "value": "Africa/Johannesburg",
261
+ },
262
+ {
263
+ "label": "Kabul",
264
+ "value": "Asia/Kabul",
265
+ },
266
+ {
267
+ "label": "Kamchatka",
268
+ "value": "Asia/Kamchatka",
269
+ },
270
+ {
271
+ "label": "Kathmandu",
272
+ "value": "Asia/Kathmandu",
273
+ },
274
+ {
275
+ "label": "Khartoum",
276
+ "value": "Africa/Khartoum",
277
+ },
278
+ {
279
+ "label": "Kiev",
280
+ "value": "Europe/Kiev",
281
+ },
282
+ {
283
+ "label": "Krasnoyarsk",
284
+ "value": "Asia/Krasnoyarsk",
285
+ },
286
+ {
287
+ "label": "Kuala Lumpur",
288
+ "value": "Asia/Kuala_Lumpur",
289
+ },
290
+ {
291
+ "label": "Kuwait",
292
+ "value": "Asia/Kuwait",
293
+ },
294
+ {
295
+ "label": "Lima",
296
+ "value": "America/Lima",
297
+ },
298
+ {
299
+ "label": "Lisbon",
300
+ "value": "Europe/Lisbon",
301
+ },
302
+ {
303
+ "label": "London",
304
+ "value": "Europe/London",
305
+ },
306
+ {
307
+ "label": "Luxembourg",
308
+ "value": "Europe/Luxembourg",
309
+ },
310
+ {
311
+ "label": "Madrid",
312
+ "value": "Europe/Madrid",
313
+ },
314
+ {
315
+ "label": "Magadan",
316
+ "value": "Asia/Magadan",
317
+ },
318
+ {
319
+ "label": "Managua",
320
+ "value": "America/Managua",
321
+ },
322
+ {
323
+ "label": "Mazatlan",
324
+ "value": "America/Mazatlan",
325
+ },
326
+ {
327
+ "label": "Mexico City",
328
+ "value": "America/Mexico_City",
329
+ },
330
+ {
331
+ "label": "Midway Island, Samoa",
332
+ "value": "Pacific/Midway",
333
+ },
334
+ {
335
+ "label": "Mogadishu",
336
+ "value": "Africa/Mogadishu",
337
+ },
338
+ {
339
+ "label": "Montevideo",
340
+ "value": "America/Montevideo",
341
+ },
342
+ {
343
+ "label": "Montreal",
344
+ "value": "America/Montreal",
345
+ },
346
+ {
347
+ "label": "Moscow",
348
+ "value": "Europe/Moscow",
349
+ },
350
+ {
351
+ "label": "Mountain Time (US and Canada)",
352
+ "value": "America/Denver",
353
+ },
354
+ {
355
+ "label": "Mumbai, Kolkata, New Delhi",
356
+ "value": "Asia/Kolkata",
357
+ },
358
+ {
359
+ "label": "Muscat",
360
+ "value": "Asia/Muscat",
361
+ },
362
+ {
363
+ "label": "Nairobi",
364
+ "value": "Africa/Nairobi",
365
+ },
366
+ {
367
+ "label": "New Caledonia",
368
+ "value": "Pacific/Noumea",
369
+ },
370
+ {
371
+ "label": "Newfoundland and Labrador",
372
+ "value": "America/St_Johns",
373
+ },
374
+ {
375
+ "label": "Nicosia",
376
+ "value": "Asia/Nicosia",
377
+ },
378
+ {
379
+ "label": "Nouakchott",
380
+ "value": "Africa/Nouakchott",
381
+ },
382
+ {
383
+ "label": "Novosibirsk",
384
+ "value": "Asia/Novosibirsk",
385
+ },
386
+ {
387
+ "label": "Osaka, Sapporo, Tokyo",
388
+ "value": "Asia/Tokyo",
389
+ },
390
+ {
391
+ "label": "Oslo",
392
+ "value": "Europe/Oslo",
393
+ },
394
+ {
395
+ "label": "Pacific Time (US and Canada)",
396
+ "value": "America/Los_Angeles",
397
+ },
398
+ {
399
+ "label": "Pago Pago",
400
+ "value": "Pacific/Pago_Pago",
401
+ },
402
+ {
403
+ "label": "Panama",
404
+ "value": "America/Panama",
405
+ },
406
+ {
407
+ "label": "Paris",
408
+ "value": "Europe/Paris",
409
+ },
410
+ {
411
+ "label": "Perth",
412
+ "value": "Australia/Perth",
413
+ },
414
+ {
415
+ "label": "Prague Bratislava",
416
+ "value": "Europe/Prague",
417
+ },
418
+ {
419
+ "label": "Puerto Rico",
420
+ "value": "America/Puerto_Rico",
421
+ },
422
+ {
423
+ "label": "Qatar",
424
+ "value": "Asia/Qatar",
425
+ },
426
+ {
427
+ "label": "Reykjavik",
428
+ "value": "Atlantic/Reykjavik",
429
+ },
430
+ {
431
+ "label": "Riyadh",
432
+ "value": "Asia/Riyadh",
433
+ },
434
+ {
435
+ "label": "Rome",
436
+ "value": "Europe/Rome",
437
+ },
438
+ {
439
+ "label": "Santiago",
440
+ "value": "America/Santiago",
441
+ },
442
+ {
443
+ "label": "Sao Paulo",
444
+ "value": "America/Sao_Paulo",
445
+ },
446
+ {
447
+ "label": "Sarajevo, Skopje, Zagreb",
448
+ "value": "CET",
449
+ },
450
+ {
451
+ "label": "Saskatchewan",
452
+ "value": "America/Regina",
453
+ },
454
+ {
455
+ "label": "Seoul",
456
+ "value": "Asia/Seoul",
457
+ },
458
+ {
459
+ "label": "Singapore",
460
+ "value": "Asia/Singapore",
461
+ },
462
+ {
463
+ "label": "Sofia",
464
+ "value": "Europe/Sofia",
465
+ },
466
+ {
467
+ "label": "Solomon Islands",
468
+ "value": "SST",
469
+ },
470
+ {
471
+ "label": "Stockholm",
472
+ "value": "Europe/Stockholm",
473
+ },
474
+ {
475
+ "label": "Taipei",
476
+ "value": "Asia/Taipei",
477
+ },
478
+ {
479
+ "label": "Tegucigalpa",
480
+ "value": "America/Tegucigalpa",
481
+ },
482
+ {
483
+ "label": "Tehran",
484
+ "value": "Asia/Tehran",
485
+ },
486
+ {
487
+ "label": "Tijuana",
488
+ "value": "America/Tijuana",
489
+ },
490
+ {
491
+ "label": "Tripoli",
492
+ "value": "Africa/Tripoli",
493
+ },
494
+ {
495
+ "label": "Tunis",
496
+ "value": "Africa/Tunis",
497
+ },
498
+ {
499
+ "label": "Universal Time UTC",
500
+ "value": "UTC",
501
+ },
502
+ {
503
+ "label": "Vancouver",
504
+ "value": "America/Vancouver",
505
+ },
506
+ {
507
+ "label": "Vienna",
508
+ "value": "Europe/Vienna",
509
+ },
510
+ {
511
+ "label": "Vietnam",
512
+ "value": "Asia/Saigon",
513
+ },
514
+ {
515
+ "label": "Vladivostok",
516
+ "value": "Asia/Vladivostok",
517
+ },
518
+ {
519
+ "label": "Warsaw",
520
+ "value": "Europe/Warsaw",
521
+ },
522
+ {
523
+ "label": "West Central Africa",
524
+ "value": "Africa/Bangui",
525
+ },
526
+ {
527
+ "label": "Winnipeg",
528
+ "value": "America/Winnipeg",
529
+ },
530
+ {
531
+ "label": "Yakutsk",
532
+ "value": "Asia/Yakutsk",
533
+ },
534
+ {
535
+ "label": "Yekaterinburg",
536
+ "value": "Asia/Yekaterinburg",
537
+ },
538
+ {
539
+ "label": "Zurich",
540
+ "value": "Europe/Zurich",
541
+ },
542
+ ];
@@ -0,0 +1,58 @@
1
+ import app from "../../recruitee.app.mjs";
2
+
3
+ export default {
4
+ name: "Create Candidate",
5
+ description: "Create a new candidate. [See the documentation](https://api.recruitee.com/docs/index.html#candidate.web.candidate-candidate.web.candidate)",
6
+ key: "recruitee-create-candidate",
7
+ version: "0.0.1",
8
+ type: "action",
9
+ props: {
10
+ app,
11
+ name: {
12
+ type: "string",
13
+ label: "Full Name",
14
+ description: "The full name of the candidate",
15
+ },
16
+ phones: {
17
+ label: "Phones",
18
+ description: "The candidate's phone number. e.g. `+12223334444`",
19
+ type: "string[]",
20
+ optional: true,
21
+ },
22
+ emails: {
23
+ label: "Emails",
24
+ description: "The candidate's email",
25
+ type: "string[]",
26
+ optional: true,
27
+ },
28
+ socialLinks: {
29
+ label: "Social Media Profiles",
30
+ description: "The candidate's social media profiles",
31
+ type: "string[]",
32
+ optional: true,
33
+ },
34
+ links: {
35
+ label: "Links",
36
+ description: "The candidate's external links",
37
+ type: "string[]",
38
+ optional: true,
39
+ },
40
+ },
41
+ async run({ $ }) {
42
+ const payload = {
43
+ name: this.name,
44
+ phones: this.phones,
45
+ emails: this.emails,
46
+ social_links: this.socialLinks,
47
+ links: this.links,
48
+ };
49
+ const response = await this.app.createCandidate({
50
+ $,
51
+ data: {
52
+ candidate: payload,
53
+ },
54
+ });
55
+ $.export("$summary", `Successfully created candidate with ID \`${response.candidate.id}\``);
56
+ return response;
57
+ },
58
+ };
@@ -0,0 +1,51 @@
1
+ import app from "../../recruitee.app.mjs";
2
+
3
+ export default {
4
+ name: "Create Note",
5
+ description: "Create a new note for a candidate. [See the documentation](https://api.recruitee.com/docs/index.html#note.web.note-note.web.note)",
6
+ key: "recruitee-create-note",
7
+ version: "0.0.1",
8
+ type: "action",
9
+ props: {
10
+ app,
11
+ candidateId: {
12
+ propDefinition: [
13
+ app,
14
+ "candidateId",
15
+ ],
16
+ optional: false,
17
+ },
18
+ body: {
19
+ type: "string",
20
+ label: "body",
21
+ description: "The body of the note",
22
+ },
23
+ visibility: {
24
+ type: "string",
25
+ label: "Visibility",
26
+ description: "The visibility of the note",
27
+ options: [
28
+ "public",
29
+ "private",
30
+ ],
31
+ default: "public",
32
+ },
33
+ },
34
+ async run({ $ }) {
35
+ const payload = {
36
+ body: this.body,
37
+ visibility: {
38
+ level: this.visibility,
39
+ },
40
+ };
41
+ const response = await this.app.createNote({
42
+ $,
43
+ candidateId: this.candidateId,
44
+ data: {
45
+ note: payload,
46
+ },
47
+ });
48
+ $.export("$summary", `Successfully created note with ID \`${response.note.id}\``);
49
+ return response;
50
+ },
51
+ };
@@ -0,0 +1,60 @@
1
+ import app from "../../recruitee.app.mjs";
2
+ import timezones from "../common/timezones.mjs";
3
+
4
+ export default {
5
+ name: "Create Task",
6
+ description: "Create a new task for a candidate. [See the documentation](https://api.recruitee.com/docs/index.html#task.web.task-task.web.task-post)",
7
+ key: "recruitee-create-task",
8
+ version: "0.0.1",
9
+ type: "action",
10
+ props: {
11
+ app,
12
+ title: {
13
+ type: "string",
14
+ label: "Title",
15
+ description: "The task title",
16
+ },
17
+ candidateId: {
18
+ propDefinition: [
19
+ app,
20
+ "candidateId",
21
+ ],
22
+ },
23
+ description: {
24
+ type: "string",
25
+ label: "Description",
26
+ description: "The task description",
27
+ optional: true,
28
+ },
29
+ dueDate: {
30
+ type: "string",
31
+ label: "Due Date",
32
+ description: "The task due date. format as [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) e.g. `2023-11-15T08:30:00Z`",
33
+ optional: true,
34
+ },
35
+ timezone: {
36
+ type: "string",
37
+ label: "Timezone",
38
+ description: "The task timezone",
39
+ optional: true,
40
+ options: timezones,
41
+ },
42
+ },
43
+ async run({ $ }) {
44
+ const payload = {
45
+ candidate_id: this.candidateId,
46
+ description: this.description,
47
+ due_date: this.dueDate,
48
+ timezone: this.timezone,
49
+ title: this.title,
50
+ };
51
+ const response = await this.app.createTask({
52
+ $,
53
+ data: {
54
+ task: payload,
55
+ },
56
+ });
57
+ $.export("$summary", `Successfully created task with ID \`${response.task.id}\``);
58
+ return response;
59
+ },
60
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pipedream/recruitee",
3
- "version": "0.0.1",
3
+ "version": "0.1.0",
4
4
  "description": "Pipedream Recruitee Components",
5
5
  "main": "recruitee.app.mjs",
6
6
  "keywords": [
@@ -11,5 +11,8 @@
11
11
  "author": "Pipedream <support@pipedream.com> (https://pipedream.com/)",
12
12
  "publishConfig": {
13
13
  "access": "public"
14
+ },
15
+ "dependencies": {
16
+ "@pipedream/platform": "^1.5.1"
14
17
  }
15
18
  }
package/recruitee.app.mjs CHANGED
@@ -1,11 +1,72 @@
1
+ import { axios } from "@pipedream/platform";
2
+
1
3
  export default {
2
4
  type: "app",
3
5
  app: "recruitee",
4
- propDefinitions: {},
6
+ propDefinitions: {
7
+ candidateId: {
8
+ type: "integer",
9
+ label: "Candidate ID",
10
+ description: "The candidate unique identifier",
11
+ optional: true,
12
+ async options() {
13
+ const { candidates } = await this.listCandidates();
14
+ return candidates.map((candidate) => ({
15
+ label: candidate.name,
16
+ value: candidate.id,
17
+ }));
18
+ },
19
+ },
20
+ },
5
21
  methods: {
6
- // this.$auth contains connected account data
7
- authKeys() {
8
- console.log(Object.keys(this.$auth));
22
+ _apiEndpoint() {
23
+ return "https://api.recruitee.com";
24
+ },
25
+ _authorization() {
26
+ return `Bearer ${this.$auth.api_token}`;
27
+ },
28
+ _companyId() {
29
+ return this.$auth.company_id;
30
+ },
31
+ _makeRequest({
32
+ $ = this, path, ...args
33
+ }) {
34
+ return axios($, {
35
+ url: `${this._apiEndpoint()}${path}`,
36
+ ...args,
37
+ headers: {
38
+ ...args.headers,
39
+ Authorization: this._authorization(),
40
+ },
41
+ });
42
+ },
43
+ listCandidates(args = {}) {
44
+ return this._makeRequest({
45
+ method: "GET",
46
+ path: `/c/${this.$auth.company_id}/candidates`,
47
+ ...args,
48
+ });
49
+ },
50
+ createTask(args = {}) {
51
+ return this._makeRequest({
52
+ method: "POST",
53
+ path: `/c/${this._companyId()}/tasks`,
54
+ ...args,
55
+ });
56
+ },
57
+ createNote(args = {}) {
58
+ return this._makeRequest({
59
+ method: "POST",
60
+ path: `/c/${this._companyId()}/candidates/${args.candidateId}/notes`,
61
+ ...args,
62
+ });
63
+ },
64
+ createCandidate(args = {}) {
65
+ return this._makeRequest({
66
+ method: "POST",
67
+ path: `/c/${this._companyId()}/candidates`,
68
+ ...args,
69
+ });
9
70
  },
10
71
  },
11
- };
72
+ };
@@ -0,0 +1,51 @@
1
+ import app from "../../recruitee.app.mjs";
2
+ import { DEFAULT_POLLING_SOURCE_TIMER_INTERVAL } from "@pipedream/platform";
3
+
4
+ export default {
5
+ key: "recruitee-new-candidate",
6
+ name: "New Candidate Created",
7
+ description: "Emit new event when a new candidate is created. [See the Documentation](https://api.recruitee.com/docs/index.html#candidate.web.candidate-candidate.web.candidate-get)",
8
+ type: "source",
9
+ version: "0.0.1",
10
+ dedupe: "unique",
11
+ props: {
12
+ app,
13
+ db: "$.service.db",
14
+ timer: {
15
+ type: "$.interface.timer",
16
+ static: {
17
+ intervalSeconds: DEFAULT_POLLING_SOURCE_TIMER_INTERVAL,
18
+ },
19
+ },
20
+ },
21
+ methods: {
22
+ emitEvent(data) {
23
+ this.$emit(data, {
24
+ id: data.id,
25
+ summary: `New candidate: "${data.name}"`,
26
+ ts: Date.parse(data.created_at),
27
+ });
28
+ },
29
+ _setLastCreatedAfter(timestamp) {
30
+ this.db.set("lastCreatedAfter", timestamp);
31
+ },
32
+ _getLastCreatedAfter() {
33
+ return this.db.get("lastCreatedAfter");
34
+ },
35
+ },
36
+ async run() {
37
+ const lastCreatedAfter = this._getLastCreatedAfter();
38
+ const {
39
+ candidates,
40
+ generated_at: generatedAt,
41
+ } = await this.app.listCandidates({
42
+ params: {
43
+ created_after: lastCreatedAfter,
44
+ },
45
+ });
46
+ this._setLastCreatedAfter(generatedAt);
47
+ for (const candidate of candidates) {
48
+ this.emitEvent(candidate);
49
+ }
50
+ },
51
+ };