@rawdash/connector-greenhouse 0.22.0 → 0.24.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/dist/index.d.ts +48 -0
- package/dist/index.js +84 -0
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/dist/index.d.ts
CHANGED
|
@@ -31,6 +31,11 @@ type GreenhouseResource = GreenhousePhase;
|
|
|
31
31
|
declare const greenhouseResources: {
|
|
32
32
|
readonly greenhouse_job: {
|
|
33
33
|
readonly shape: "entity";
|
|
34
|
+
readonly filterable: [{
|
|
35
|
+
readonly field: "status";
|
|
36
|
+
readonly ops: ["eq"];
|
|
37
|
+
readonly values: ["open", "closed", "draft"];
|
|
38
|
+
}];
|
|
34
39
|
readonly description: "Open, draft, and closed requisitions with department, office, and timestamps for opened / closed transitions.";
|
|
35
40
|
readonly endpoint: "GET /v1/jobs";
|
|
36
41
|
readonly fields: [{
|
|
@@ -85,6 +90,7 @@ declare const greenhouseResources: {
|
|
|
85
90
|
};
|
|
86
91
|
readonly greenhouse_candidate: {
|
|
87
92
|
readonly shape: "entity";
|
|
93
|
+
readonly filterable: [];
|
|
88
94
|
readonly description: "Candidate records with name, title, company, and the count of attached applications.";
|
|
89
95
|
readonly endpoint: "GET /v1/candidates";
|
|
90
96
|
readonly fields: [{
|
|
@@ -129,6 +135,14 @@ declare const greenhouseResources: {
|
|
|
129
135
|
};
|
|
130
136
|
readonly greenhouse_application: {
|
|
131
137
|
readonly shape: "entity";
|
|
138
|
+
readonly filterable: [{
|
|
139
|
+
readonly field: "status";
|
|
140
|
+
readonly ops: ["eq"];
|
|
141
|
+
readonly values: ["active", "converted", "hired", "rejected"];
|
|
142
|
+
}, {
|
|
143
|
+
readonly field: "jobId";
|
|
144
|
+
readonly ops: ["eq"];
|
|
145
|
+
}];
|
|
132
146
|
readonly description: "Applications with status (active / hired / rejected), current stage, source, and the linked candidate / job.";
|
|
133
147
|
readonly endpoint: "GET /v1/applications";
|
|
134
148
|
readonly fields: [{
|
|
@@ -187,6 +201,10 @@ declare const greenhouseResources: {
|
|
|
187
201
|
};
|
|
188
202
|
readonly greenhouse_application_event: {
|
|
189
203
|
readonly shape: "event";
|
|
204
|
+
readonly filterable: [{
|
|
205
|
+
readonly field: "jobId";
|
|
206
|
+
readonly ops: ["eq"];
|
|
207
|
+
}];
|
|
190
208
|
readonly description: "Application lifecycle events (applied / hired / rejected) derived from each application timestamps. The scope is cleared and rewritten on every sync (including incremental runs).";
|
|
191
209
|
readonly endpoint: "GET /v1/applications";
|
|
192
210
|
readonly notes: "Derived from each application's applied_at / rejected_at / last_activity_at fields, not from a separate API call.";
|
|
@@ -231,6 +249,11 @@ declare const greenhouseResources: {
|
|
|
231
249
|
};
|
|
232
250
|
readonly greenhouse_offer: {
|
|
233
251
|
readonly shape: "entity";
|
|
252
|
+
readonly filterable: [{
|
|
253
|
+
readonly field: "status";
|
|
254
|
+
readonly ops: ["eq"];
|
|
255
|
+
readonly values: ["unresolved", "accepted", "rejected", "deprecated"];
|
|
256
|
+
}];
|
|
234
257
|
readonly description: "Offers with status (pending / accepted / rejected), linked to their application, candidate, and job.";
|
|
235
258
|
readonly endpoint: "GET /v1/offers";
|
|
236
259
|
readonly fields: [{
|
|
@@ -276,6 +299,11 @@ declare class GreenhouseConnector extends BaseConnector<GreenhouseSettings, Gree
|
|
|
276
299
|
static readonly resources: {
|
|
277
300
|
readonly greenhouse_job: {
|
|
278
301
|
readonly shape: "entity";
|
|
302
|
+
readonly filterable: [{
|
|
303
|
+
readonly field: "status";
|
|
304
|
+
readonly ops: ["eq"];
|
|
305
|
+
readonly values: ["open", "closed", "draft"];
|
|
306
|
+
}];
|
|
279
307
|
readonly description: "Open, draft, and closed requisitions with department, office, and timestamps for opened / closed transitions.";
|
|
280
308
|
readonly endpoint: "GET /v1/jobs";
|
|
281
309
|
readonly fields: [{
|
|
@@ -330,6 +358,7 @@ declare class GreenhouseConnector extends BaseConnector<GreenhouseSettings, Gree
|
|
|
330
358
|
};
|
|
331
359
|
readonly greenhouse_candidate: {
|
|
332
360
|
readonly shape: "entity";
|
|
361
|
+
readonly filterable: [];
|
|
333
362
|
readonly description: "Candidate records with name, title, company, and the count of attached applications.";
|
|
334
363
|
readonly endpoint: "GET /v1/candidates";
|
|
335
364
|
readonly fields: [{
|
|
@@ -374,6 +403,14 @@ declare class GreenhouseConnector extends BaseConnector<GreenhouseSettings, Gree
|
|
|
374
403
|
};
|
|
375
404
|
readonly greenhouse_application: {
|
|
376
405
|
readonly shape: "entity";
|
|
406
|
+
readonly filterable: [{
|
|
407
|
+
readonly field: "status";
|
|
408
|
+
readonly ops: ["eq"];
|
|
409
|
+
readonly values: ["active", "converted", "hired", "rejected"];
|
|
410
|
+
}, {
|
|
411
|
+
readonly field: "jobId";
|
|
412
|
+
readonly ops: ["eq"];
|
|
413
|
+
}];
|
|
377
414
|
readonly description: "Applications with status (active / hired / rejected), current stage, source, and the linked candidate / job.";
|
|
378
415
|
readonly endpoint: "GET /v1/applications";
|
|
379
416
|
readonly fields: [{
|
|
@@ -432,6 +469,10 @@ declare class GreenhouseConnector extends BaseConnector<GreenhouseSettings, Gree
|
|
|
432
469
|
};
|
|
433
470
|
readonly greenhouse_application_event: {
|
|
434
471
|
readonly shape: "event";
|
|
472
|
+
readonly filterable: [{
|
|
473
|
+
readonly field: "jobId";
|
|
474
|
+
readonly ops: ["eq"];
|
|
475
|
+
}];
|
|
435
476
|
readonly description: "Application lifecycle events (applied / hired / rejected) derived from each application timestamps. The scope is cleared and rewritten on every sync (including incremental runs).";
|
|
436
477
|
readonly endpoint: "GET /v1/applications";
|
|
437
478
|
readonly notes: "Derived from each application's applied_at / rejected_at / last_activity_at fields, not from a separate API call.";
|
|
@@ -476,6 +517,11 @@ declare class GreenhouseConnector extends BaseConnector<GreenhouseSettings, Gree
|
|
|
476
517
|
};
|
|
477
518
|
readonly greenhouse_offer: {
|
|
478
519
|
readonly shape: "entity";
|
|
520
|
+
readonly filterable: [{
|
|
521
|
+
readonly field: "status";
|
|
522
|
+
readonly ops: ["eq"];
|
|
523
|
+
readonly values: ["unresolved", "accepted", "rejected", "deprecated"];
|
|
524
|
+
}];
|
|
479
525
|
readonly description: "Offers with status (pending / accepted / rejected), linked to their application, candidate, and job.";
|
|
480
526
|
readonly endpoint: "GET /v1/offers";
|
|
481
527
|
readonly fields: [{
|
|
@@ -620,6 +666,8 @@ declare class GreenhouseConnector extends BaseConnector<GreenhouseSettings, Gree
|
|
|
620
666
|
private allowedPagePath;
|
|
621
667
|
private sanitizePageUrl;
|
|
622
668
|
private resolveCursor;
|
|
669
|
+
private singleSpec;
|
|
670
|
+
private applyPushdown;
|
|
623
671
|
private buildInitialUrl;
|
|
624
672
|
private fetchPhasePage;
|
|
625
673
|
private writeJobs;
|
package/dist/index.js
CHANGED
|
@@ -219,6 +219,9 @@ var offerSchema = z.object({
|
|
|
219
219
|
var greenhouseResources = defineResources({
|
|
220
220
|
[JOB_ENTITY]: {
|
|
221
221
|
shape: "entity",
|
|
222
|
+
filterable: [
|
|
223
|
+
{ field: "status", ops: ["eq"], values: ["open", "closed", "draft"] }
|
|
224
|
+
],
|
|
222
225
|
description: "Open, draft, and closed requisitions with department, office, and timestamps for opened / closed transitions.",
|
|
223
226
|
endpoint: "GET /v1/jobs",
|
|
224
227
|
fields: [
|
|
@@ -244,6 +247,7 @@ var greenhouseResources = defineResources({
|
|
|
244
247
|
},
|
|
245
248
|
[CANDIDATE_ENTITY]: {
|
|
246
249
|
shape: "entity",
|
|
250
|
+
filterable: [],
|
|
247
251
|
description: "Candidate records with name, title, company, and the count of attached applications.",
|
|
248
252
|
endpoint: "GET /v1/candidates",
|
|
249
253
|
fields: [
|
|
@@ -272,6 +276,14 @@ var greenhouseResources = defineResources({
|
|
|
272
276
|
},
|
|
273
277
|
[APPLICATION_ENTITY]: {
|
|
274
278
|
shape: "entity",
|
|
279
|
+
filterable: [
|
|
280
|
+
{
|
|
281
|
+
field: "status",
|
|
282
|
+
ops: ["eq"],
|
|
283
|
+
values: ["active", "converted", "hired", "rejected"]
|
|
284
|
+
},
|
|
285
|
+
{ field: "jobId", ops: ["eq"] }
|
|
286
|
+
],
|
|
275
287
|
description: "Applications with status (active / hired / rejected), current stage, source, and the linked candidate / job.",
|
|
276
288
|
endpoint: "GET /v1/applications",
|
|
277
289
|
fields: [
|
|
@@ -314,6 +326,7 @@ var greenhouseResources = defineResources({
|
|
|
314
326
|
},
|
|
315
327
|
[APPLICATION_EVENT]: {
|
|
316
328
|
shape: "event",
|
|
329
|
+
filterable: [{ field: "jobId", ops: ["eq"] }],
|
|
317
330
|
description: "Application lifecycle events (applied / hired / rejected) derived from each application timestamps. The scope is cleared and rewritten on every sync (including incremental runs).",
|
|
318
331
|
endpoint: "GET /v1/applications",
|
|
319
332
|
notes: "Derived from each application's applied_at / rejected_at / last_activity_at fields, not from a separate API call.",
|
|
@@ -337,6 +350,13 @@ var greenhouseResources = defineResources({
|
|
|
337
350
|
},
|
|
338
351
|
[OFFER_ENTITY]: {
|
|
339
352
|
shape: "entity",
|
|
353
|
+
filterable: [
|
|
354
|
+
{
|
|
355
|
+
field: "status",
|
|
356
|
+
ops: ["eq"],
|
|
357
|
+
values: ["unresolved", "accepted", "rejected", "deprecated"]
|
|
358
|
+
}
|
|
359
|
+
],
|
|
340
360
|
description: "Offers with status (pending / accepted / rejected), linked to their application, candidate, and job.",
|
|
341
361
|
endpoint: "GET /v1/offers",
|
|
342
362
|
fields: [
|
|
@@ -398,6 +418,17 @@ function hiredAtMs(app) {
|
|
|
398
418
|
}
|
|
399
419
|
return isoToMs(app.last_activity_at);
|
|
400
420
|
}
|
|
421
|
+
function pushableEq(filter, field) {
|
|
422
|
+
if (!filter) {
|
|
423
|
+
return null;
|
|
424
|
+
}
|
|
425
|
+
for (const clause of filter) {
|
|
426
|
+
if ("field" in clause && clause.field === field && clause.op === "eq" && typeof clause.value === "string") {
|
|
427
|
+
return clause.value;
|
|
428
|
+
}
|
|
429
|
+
}
|
|
430
|
+
return null;
|
|
431
|
+
}
|
|
401
432
|
var id = "greenhouse";
|
|
402
433
|
var GreenhouseConnector = class _GreenhouseConnector extends BaseConnector {
|
|
403
434
|
static id = id;
|
|
@@ -462,12 +493,65 @@ var GreenhouseConnector = class _GreenhouseConnector extends BaseConnector {
|
|
|
462
493
|
page: this.sanitizePageUrl(cursor.phase, cursor.page)
|
|
463
494
|
};
|
|
464
495
|
}
|
|
496
|
+
singleSpec(options, resource) {
|
|
497
|
+
const specs = options.fetchSpecs?.[resource];
|
|
498
|
+
return specs && specs.length === 1 ? specs[0] : void 0;
|
|
499
|
+
}
|
|
500
|
+
applyPushdown(url, phase, options) {
|
|
501
|
+
switch (phase) {
|
|
502
|
+
case "jobs": {
|
|
503
|
+
const status = pushableEq(
|
|
504
|
+
this.singleSpec(options, JOB_ENTITY)?.filter,
|
|
505
|
+
"status"
|
|
506
|
+
);
|
|
507
|
+
if (status !== null) {
|
|
508
|
+
url.searchParams.set("status", status);
|
|
509
|
+
}
|
|
510
|
+
return;
|
|
511
|
+
}
|
|
512
|
+
case "applications": {
|
|
513
|
+
const spec = this.singleSpec(options, APPLICATION_ENTITY);
|
|
514
|
+
const status = pushableEq(spec?.filter, "status");
|
|
515
|
+
if (status !== null) {
|
|
516
|
+
url.searchParams.set("status", status);
|
|
517
|
+
}
|
|
518
|
+
const jobId = pushableEq(spec?.filter, "jobId");
|
|
519
|
+
if (jobId !== null) {
|
|
520
|
+
url.searchParams.set("job_id", jobId);
|
|
521
|
+
}
|
|
522
|
+
return;
|
|
523
|
+
}
|
|
524
|
+
case "application_events": {
|
|
525
|
+
const jobId = pushableEq(
|
|
526
|
+
this.singleSpec(options, APPLICATION_EVENT)?.filter,
|
|
527
|
+
"jobId"
|
|
528
|
+
);
|
|
529
|
+
if (jobId !== null) {
|
|
530
|
+
url.searchParams.set("job_id", jobId);
|
|
531
|
+
}
|
|
532
|
+
return;
|
|
533
|
+
}
|
|
534
|
+
case "offers": {
|
|
535
|
+
const status = pushableEq(
|
|
536
|
+
this.singleSpec(options, OFFER_ENTITY)?.filter,
|
|
537
|
+
"status"
|
|
538
|
+
);
|
|
539
|
+
if (status !== null) {
|
|
540
|
+
url.searchParams.set("status", status);
|
|
541
|
+
}
|
|
542
|
+
return;
|
|
543
|
+
}
|
|
544
|
+
case "candidates":
|
|
545
|
+
return;
|
|
546
|
+
}
|
|
547
|
+
}
|
|
465
548
|
buildInitialUrl(phase, options) {
|
|
466
549
|
const url = new URL(`${API_BASE}${this.allowedPagePath(phase)}`);
|
|
467
550
|
url.searchParams.set("per_page", String(PER_PAGE));
|
|
468
551
|
if (phase !== "application_events" && options.since) {
|
|
469
552
|
url.searchParams.set("updated_after", options.since);
|
|
470
553
|
}
|
|
554
|
+
this.applyPushdown(url, phase, options);
|
|
471
555
|
return url.toString();
|
|
472
556
|
}
|
|
473
557
|
async fetchPhasePage(phase, page, options, signal) {
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../connector-shared/src/errors.ts","../../../connector-shared/src/retry.ts","../../../connector-shared/src/version.ts","../../../connector-shared/src/request.ts","../../../connector-shared/src/rate-limit.ts","../../../connector-shared/src/map-concurrent.ts","../../../connector-shared/src/sanitize.ts","../../../connector-shared/src/epoch.ts","../../../connector-shared/src/pagination.ts","../../../connector-shared/src/logger.ts","../src/greenhouse.ts","../src/index.ts"],"sourcesContent":["import type { HttpResponse } from './types';\n\nexport type HttpErrorKind =\n | 'transient'\n | 'rate_limit'\n | 'auth'\n | 'upstream_bug'\n | 'client_bug';\n\nexport abstract class HttpClientError extends Error {\n abstract readonly kind: HttpErrorKind;\n readonly response?: HttpResponse;\n\n constructor(message: string, response?: HttpResponse) {\n super(message);\n this.name = new.target.name;\n this.response = response;\n }\n}\n\nexport class TransientError extends HttpClientError {\n readonly kind = 'transient' as const;\n}\n\nexport class RateLimitError extends HttpClientError {\n readonly kind = 'rate_limit' as const;\n readonly retryAfter?: Date;\n\n constructor(message: string, response?: HttpResponse, retryAfter?: Date) {\n super(message, response);\n this.retryAfter = retryAfter;\n }\n}\n\nexport class AuthError extends HttpClientError {\n readonly kind = 'auth' as const;\n}\n\nexport class UpstreamBugError extends HttpClientError {\n readonly kind = 'upstream_bug' as const;\n}\n\nexport class ClientBugError extends HttpClientError {\n readonly kind = 'client_bug' as const;\n}\n\nexport function classifyStatus(status: number): HttpErrorKind {\n if (status === 429) {\n return 'rate_limit';\n }\n if (status === 401 || status === 403) {\n return 'auth';\n }\n if (status === 408) {\n return 'transient';\n }\n if (status >= 500) {\n return 'upstream_bug';\n }\n if (status >= 400) {\n return 'client_bug';\n }\n return 'client_bug';\n}\n\nexport function errorForStatus(\n message: string,\n response: HttpResponse,\n retryAfter?: Date,\n): HttpClientError {\n const kind = classifyStatus(response.status);\n switch (kind) {\n case 'rate_limit':\n return new RateLimitError(message, response, retryAfter);\n case 'auth':\n return new AuthError(message, response);\n case 'transient':\n return new TransientError(message, response);\n case 'upstream_bug':\n return new UpstreamBugError(message, response);\n case 'client_bug':\n return new ClientBugError(message, response);\n }\n}\n","import { HttpClientError, RateLimitError, TransientError } from './errors';\n\nexport interface RetryPolicy {\n maxAttempts?: number;\n initialDelayMs?: number;\n maxDelayMs?: number;\n retryOn?: (status: number | null, err?: Error) => boolean;\n}\n\nexport const defaultRetryOn = (status: number | null, err?: Error): boolean => {\n if (err instanceof RateLimitError) {\n return true;\n }\n if (err instanceof TransientError) {\n return true;\n }\n if (status === null) {\n return err instanceof Error && !(err instanceof HttpClientError);\n }\n if (status === 408 || status === 429) {\n return true;\n }\n if (status >= 500) {\n return true;\n }\n return false;\n};\n\nexport function backoffDelayMs(\n attempt: number,\n policy: Required<Pick<RetryPolicy, 'initialDelayMs' | 'maxDelayMs'>>,\n): number {\n const base = policy.initialDelayMs * 2 ** attempt;\n const jitter = base * 0.25 * Math.random();\n return Math.min(base + jitter, policy.maxDelayMs);\n}\n\nexport function parseRetryAfter(\n headerValue: string | null,\n now: Date = new Date(),\n): Date | undefined {\n if (!headerValue) {\n return undefined;\n }\n const trimmed = headerValue.trim();\n if (/^\\d+$/.test(trimmed)) {\n return new Date(now.getTime() + Number(trimmed) * 1000);\n }\n const parsed = Date.parse(trimmed);\n if (Number.isNaN(parsed)) {\n return undefined;\n }\n return new Date(parsed);\n}\n\nexport function sleep(ms: number, signal?: AbortSignal): Promise<void> {\n if (signal?.aborted) {\n return Promise.reject(signal.reason ?? new Error('Aborted'));\n }\n return new Promise<void>((resolve, reject) => {\n const onAbort = () => {\n clearTimeout(timer);\n reject(signal!.reason ?? new Error('Aborted'));\n };\n const timer = setTimeout(() => {\n signal?.removeEventListener('abort', onAbort);\n resolve();\n }, ms);\n signal?.addEventListener('abort', onAbort, { once: true });\n });\n}\n","export const HTTP_CLIENT_VERSION = '0.0.0';\n\nexport const DEFAULT_USER_AGENT = `rawdash-connector/${HTTP_CLIENT_VERSION} (+https://rawdash.dev)`;\n\nexport function connectorUserAgent(connectorId: string): string {\n return `rawdash-connector-${connectorId}/${HTTP_CLIENT_VERSION} (+https://rawdash.dev)`;\n}\n","import {\n AuthError,\n ClientBugError,\n HttpClientError,\n RateLimitError,\n TransientError,\n UpstreamBugError,\n errorForStatus,\n} from './errors';\nimport { defaultRetryOn, parseRetryAfter, sleep } from './retry';\nimport type { FetchLike, HttpMethod, HttpRequest, HttpResponse } from './types';\nimport { DEFAULT_USER_AGENT } from './version';\n\nconst DEFAULT_TIMEOUT_MS = 10_000;\nconst DEFAULT_MAX_ATTEMPTS = 3;\nconst DEFAULT_INITIAL_DELAY_MS = 1000;\nconst DEFAULT_MAX_DELAY_MS = 60_000;\nconst OBSERVER_TIMEOUT_MS = 250;\n\nexport interface RequestObservation {\n url: string;\n method: HttpMethod;\n status: number;\n resource: string;\n requestId: string;\n body: unknown;\n}\n\nexport type RequestObserver = (\n event: RequestObservation,\n) => void | Promise<void>;\n\nexport interface RequestOptions {\n fetch?: FetchLike;\n observer?: RequestObserver;\n resource: string;\n requestId?: string;\n}\n\nasync function notifyObserver(\n observer: RequestObserver,\n event: RequestObservation,\n): Promise<void> {\n let result: void | Promise<void>;\n try {\n result = observer(event);\n } catch (err) {\n console.warn('[connector-shared] request observer threw:', err);\n return;\n }\n if (!(result instanceof Promise)) {\n return;\n }\n const guarded = result.catch((err) => {\n console.warn('[connector-shared] request observer rejected:', err);\n });\n let timer: ReturnType<typeof setTimeout> | undefined;\n const timeout = new Promise<void>((resolve) => {\n timer = setTimeout(resolve, OBSERVER_TIMEOUT_MS);\n });\n try {\n await Promise.race([guarded, timeout]);\n } finally {\n if (timer) {\n clearTimeout(timer);\n }\n }\n}\n\nfunction newRequestId(): string {\n const c = (globalThis as { crypto?: { randomUUID?: () => string } }).crypto;\n if (c?.randomUUID) {\n return c.randomUUID();\n }\n return `${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 10)}`;\n}\n\nfunction mergeHeaders(\n defaults: Record<string, string>,\n overrides: Record<string, string> | undefined,\n): Record<string, string> {\n const merged: Record<string, string> = {};\n for (const [k, v] of Object.entries(defaults)) {\n merged[k.toLowerCase()] = v;\n }\n if (overrides) {\n for (const [k, v] of Object.entries(overrides)) {\n merged[k.toLowerCase()] = v;\n }\n }\n return merged;\n}\n\nfunction linkTimeoutSignal(\n parent: AbortSignal | undefined,\n timeoutMs: number,\n): { signal: AbortSignal; cancel: () => void } {\n const controller = new AbortController();\n const onParentAbort = () => {\n controller.abort(parent?.reason);\n };\n if (parent) {\n if (parent.aborted) {\n controller.abort(parent.reason);\n } else {\n parent.addEventListener('abort', onParentAbort, { once: true });\n }\n }\n const timer = setTimeout(() => {\n controller.abort(new Error(`Request timed out after ${timeoutMs}ms`));\n }, timeoutMs);\n return {\n signal: controller.signal,\n cancel: () => {\n clearTimeout(timer);\n if (parent) {\n parent.removeEventListener('abort', onParentAbort);\n }\n },\n };\n}\n\nasync function readBody(res: Response, parseJson: boolean): Promise<unknown> {\n if (res.status === 204 || res.status === 205) {\n return null;\n }\n const contentType = res.headers.get('content-type') ?? '';\n if (parseJson && contentType.includes('application/json')) {\n const text = await res.text();\n if (text.length === 0) {\n return null;\n }\n return JSON.parse(text);\n }\n return res.text();\n}\n\nexport async function request<T = unknown>(\n req: HttpRequest,\n options: RequestOptions,\n): Promise<HttpResponse<T>> {\n const fetchImpl: FetchLike = options.fetch ?? (globalThis.fetch as FetchLike);\n const retry = req.retry ?? {};\n const maxAttempts = retry.maxAttempts ?? DEFAULT_MAX_ATTEMPTS;\n const initialDelayMs = retry.initialDelayMs ?? DEFAULT_INITIAL_DELAY_MS;\n const maxDelayMs = retry.maxDelayMs ?? DEFAULT_MAX_DELAY_MS;\n const retryOn = retry.retryOn ?? defaultRetryOn;\n const timeoutMs = req.timeoutMs ?? DEFAULT_TIMEOUT_MS;\n const parseJson = req.parseJson ?? true;\n\n const headers = mergeHeaders(\n {\n 'User-Agent': DEFAULT_USER_AGENT,\n Accept: 'application/json',\n },\n req.headers,\n );\n\n let lastErr: Error | undefined;\n\n for (let attempt = 0; attempt < maxAttempts; attempt++) {\n req.signal?.throwIfAborted();\n\n const { signal, cancel } = linkTimeoutSignal(req.signal, timeoutMs);\n let res: Response;\n try {\n res = await fetchImpl(req.url, {\n method: req.method ?? 'GET',\n headers,\n body: req.body as RequestInit['body'],\n signal,\n });\n } catch (err) {\n cancel();\n if (req.signal?.aborted) {\n throw req.signal.reason ?? err;\n }\n const error = err instanceof Error ? err : new Error(String(err));\n lastErr = error;\n if (attempt < maxAttempts - 1 && retryOn(null, error)) {\n const delay = computeDelay(attempt, initialDelayMs, maxDelayMs);\n await sleep(delay, req.signal);\n continue;\n }\n throw new TransientError(error.message);\n }\n cancel();\n\n const body = await readBody(res, parseJson);\n const httpResponse: HttpResponse<T> = {\n status: res.status,\n headers: res.headers,\n body: body as T,\n };\n if (req.rateLimit) {\n const state = req.rateLimit.parse(res.headers);\n if (state) {\n httpResponse.rateLimitState = state;\n }\n }\n\n if (options.observer) {\n await notifyObserver(options.observer, {\n url: req.url,\n method: req.method ?? 'GET',\n status: res.status,\n resource: options.resource,\n requestId: options.requestId ?? newRequestId(),\n body,\n });\n }\n\n if (res.ok) {\n return httpResponse;\n }\n\n const retryAfter = parseRetryAfter(res.headers.get('retry-after'));\n const message = `HTTP ${res.status} ${res.statusText} for ${req.method ?? 'GET'} ${req.url}`;\n const err = errorForStatus(message, httpResponse, retryAfter);\n\n if (\n attempt < maxAttempts - 1 &&\n retryOn(res.status, err) &&\n !(err instanceof AuthError) &&\n !(err instanceof ClientBugError)\n ) {\n lastErr = err;\n let delay = computeDelay(attempt, initialDelayMs, maxDelayMs);\n if (err instanceof RateLimitError && retryAfter) {\n const wait = retryAfter.getTime() - Date.now();\n if (wait > 0) {\n delay = Math.min(wait, maxDelayMs);\n }\n }\n await sleep(delay, req.signal);\n continue;\n }\n\n throw err;\n }\n\n throw lastErr ?? new UpstreamBugError('Exhausted retry attempts');\n}\n\nfunction computeDelay(\n attempt: number,\n initialDelayMs: number,\n maxDelayMs: number,\n): number {\n const base = initialDelayMs * 2 ** attempt;\n const jitter = base * 0.25 * Math.random();\n return Math.min(base + jitter, maxDelayMs);\n}\n\nexport { HttpClientError };\n","export interface RateLimitState {\n remaining: number;\n resetAt: Date;\n}\n\nexport interface RateLimitPolicy {\n parse(headers: Headers): RateLimitState | null;\n}\n\nexport interface StandardRateLimitPolicyConfig {\n remainingHeader: string;\n resetHeader: string;\n resetUnit: 's' | 'ms';\n resetFallbackMs?: number;\n}\n\nexport function standardRateLimitPolicy(\n config: StandardRateLimitPolicyConfig,\n): RateLimitPolicy {\n const { remainingHeader, resetHeader, resetUnit, resetFallbackMs } = config;\n const multiplier = resetUnit === 's' ? 1000 : 1;\n return {\n parse(h) {\n const remainingRaw = h.get(remainingHeader);\n if (remainingRaw === null || remainingRaw.trim() === '') {\n return null;\n }\n const remaining = Number(remainingRaw);\n if (!Number.isFinite(remaining)) {\n return null;\n }\n const resetRaw = h.get(resetHeader);\n if (resetRaw === null) {\n if (resetFallbackMs === undefined) {\n return null;\n }\n return {\n remaining,\n resetAt: new Date(Date.now() + resetFallbackMs),\n };\n }\n if (resetRaw.trim() === '') {\n return null;\n }\n const reset = Number(resetRaw);\n if (!Number.isFinite(reset) || reset < 0) {\n return null;\n }\n const resetMs = reset * multiplier;\n if (!Number.isFinite(resetMs)) {\n return null;\n }\n return { remaining, resetAt: new Date(resetMs) };\n },\n };\n}\n","export async function mapWithConcurrency<T, R>(\n items: readonly T[],\n concurrency: number,\n fn: (item: T, index: number) => Promise<R>,\n): Promise<R[]> {\n const results = new Array<R>(items.length);\n if (items.length === 0) {\n return results;\n }\n const normalized = Number.isFinite(concurrency) ? Math.floor(concurrency) : 1;\n const limit = Math.max(1, Math.min(normalized, items.length));\n let next = 0;\n let failed = false;\n\n async function worker(): Promise<void> {\n while (!failed) {\n const i = next++;\n if (i >= items.length) {\n return;\n }\n try {\n results[i] = await fn(items[i]!, i);\n } catch (err) {\n failed = true;\n throw err;\n }\n }\n }\n\n const workers: Promise<void>[] = [];\n for (let w = 0; w < limit; w++) {\n workers.push(worker());\n }\n await Promise.all(workers);\n return results;\n}\n","export interface SanitizeAllowedUrlOptions {\n url: string | null;\n host: string;\n pathname: string;\n protocol?: 'https:' | 'http:';\n}\n\nexport function sanitizeAllowedUrl(\n options: SanitizeAllowedUrlOptions,\n): string | null {\n const { url, host, pathname, protocol = 'https:' } = options;\n if (url === null) {\n return null;\n }\n try {\n const u = new URL(url);\n if (u.protocol !== protocol || u.host !== host || u.pathname !== pathname) {\n return null;\n }\n return u.toString();\n } catch {\n return null;\n }\n}\n","export type EpochUnit = 'ms' | 's' | 'iso';\n\nexport function parseEpoch(\n value: number | string | null | undefined,\n unit: EpochUnit,\n): number | null {\n if (value === null || value === undefined) {\n return null;\n }\n if (unit === 'iso') {\n if (typeof value !== 'string') {\n return null;\n }\n const ms = new Date(value).getTime();\n return Number.isFinite(ms) ? ms : null;\n }\n if (typeof value === 'string' && value.trim() === '') {\n return null;\n }\n const n = typeof value === 'number' ? value : Number(value);\n if (!Number.isFinite(n)) {\n return null;\n }\n const result = unit === 's' ? n * 1000 : n;\n return Number.isFinite(result) ? result : null;\n}\n","import { request } from './request';\nimport type { HttpRequest } from './types';\n\nexport function parseLinkHeader(header: string | null): Record<string, string> {\n if (!header) {\n return {};\n }\n const result: Record<string, string> = {};\n for (const part of header.split(',')) {\n const match = part.match(/<([^>]+)>\\s*;\\s*rel=\"([^\"]+)\"/);\n if (match) {\n result[match[2]!] = match[1]!;\n }\n }\n return result;\n}\n\nexport async function* paginateLink<T>(\n initial: HttpRequest,\n parse: (body: unknown) => T[],\n options: { resource: string },\n): AsyncIterable<T> {\n let next: string | null = initial.url;\n while (next) {\n const res: Awaited<ReturnType<typeof request>> = await request(\n {\n ...initial,\n url: next,\n },\n { resource: options.resource },\n );\n for (const item of parse(res.body)) {\n yield item;\n }\n const links = parseLinkHeader(res.headers.get('link'));\n next = links['next'] ?? null;\n }\n}\n\nexport async function* paginateCursor<T>(\n initial: HttpRequest,\n parse: (body: unknown) => { items: T[]; nextCursor: string | null },\n buildNext: (req: HttpRequest, cursor: string) => HttpRequest,\n options: { resource: string },\n): AsyncIterable<T> {\n let req: HttpRequest = initial;\n while (true) {\n const res = await request(req, { resource: options.resource });\n const { items, nextCursor } = parse(res.body);\n for (const item of items) {\n yield item;\n }\n if (!nextCursor) {\n return;\n }\n req = buildNext(req, nextCursor);\n }\n}\n\nexport async function* paginatePage<T>(\n initial: HttpRequest,\n parse: (body: unknown) => { items: T[]; hasMore: boolean },\n buildPage: (req: HttpRequest, page: number) => HttpRequest,\n options: { resource: string },\n): AsyncIterable<T> {\n let page = 1;\n while (true) {\n const req = page === 1 ? initial : buildPage(initial, page);\n const res = await request(req, { resource: options.resource });\n const { items, hasMore } = parse(res.body);\n for (const item of items) {\n yield item;\n }\n if (!hasMore || items.length === 0) {\n return;\n }\n page++;\n }\n}\n","export type LogFields = Record<string, unknown>;\n\nexport interface ConnectorLogger {\n info(event: string, fields?: LogFields): void;\n warn(event: string, fields?: LogFields): void;\n}\n\nexport interface ConnectorLoggerOptions {\n scope: string;\n}\n\nconst MAX_VALUE_LEN = 120;\n\nfunction truncate(s: string, max = MAX_VALUE_LEN): string {\n if (s.length <= max) {\n return s;\n }\n return `${s.slice(0, max - 1)}…`;\n}\n\nfunction formatValue(value: unknown): string {\n if (value === null) {\n return 'null';\n }\n if (value === undefined) {\n return '';\n }\n if (typeof value === 'number' || typeof value === 'boolean') {\n return String(value);\n }\n if (typeof value === 'string') {\n const t = truncate(value);\n if (/[\\s\"=]/.test(t)) {\n return JSON.stringify(t);\n }\n return t;\n }\n if (typeof value === 'bigint') {\n return value.toString();\n }\n let json: string | undefined;\n try {\n json = JSON.stringify(value);\n } catch {\n json = undefined;\n }\n return truncate(json ?? String(value));\n}\n\nexport function formatLogFields(fields?: LogFields): string {\n if (!fields) {\n return '';\n }\n const parts: string[] = [];\n for (const [k, v] of Object.entries(fields)) {\n if (v === undefined) {\n continue;\n }\n parts.push(`${k}=${formatValue(v)}`);\n }\n return parts.length > 0 ? ` ${parts.join(' ')}` : '';\n}\n\nexport function formatLogLine(\n scope: string,\n event: string,\n fields?: LogFields,\n): string {\n return `[${scope}] ${event}${formatLogFields(fields)}`;\n}\n\nexport function createDefaultConnectorLogger(\n opts: ConnectorLoggerOptions,\n): ConnectorLogger {\n return {\n info(event, fields) {\n console.info(formatLogLine(opts.scope, event, fields));\n },\n warn(event, fields) {\n console.warn(formatLogLine(opts.scope, event, fields));\n },\n };\n}\n\nconst NOOP_LOGGER: ConnectorLogger = {\n info() {},\n warn() {},\n};\n\nexport function noopConnectorLogger(): ConnectorLogger {\n return NOOP_LOGGER;\n}\n","import {\n type HttpResponse,\n connectorUserAgent,\n parseLinkHeader,\n sanitizeAllowedUrl,\n standardRateLimitPolicy,\n} from '@rawdash/connector-shared';\nimport {\n BaseConnector,\n type ChunkedSyncCursor,\n type ConnectorContext,\n type ConnectorCost,\n type ConnectorDoc,\n type CredentialsSchema,\n type FetchPageResult,\n type JSONValue,\n type StorageHandle,\n type SyncOptions,\n type SyncResult,\n defineConfigFields,\n defineConnectorDoc,\n defineResources,\n makeChunkedCursorGuard,\n paginateChunked,\n schemasFromResources,\n selectActivePhases,\n} from '@rawdash/core';\nimport { z } from 'zod';\n\nexport const configFields = defineConfigFields(\n z.object({\n apiKey: z.object({ $secret: z.string() }).meta({\n label: 'Harvest API key',\n description:\n 'Greenhouse Harvest API key with read-only access. Create one at Configure -> Dev Center -> API Credential Management.',\n placeholder: 'ghr_...',\n secret: true,\n }),\n resources: z\n .array(\n z.enum([\n 'jobs',\n 'candidates',\n 'applications',\n 'application_events',\n 'offers',\n ]),\n )\n .nonempty()\n .optional()\n .meta({\n label: 'Resources',\n description:\n 'Which Greenhouse resources to sync. Omit to sync all resources. The Harvest key only needs Get / List permissions for the resources listed here.',\n }),\n }),\n);\n\nexport const doc: ConnectorDoc = defineConnectorDoc({\n displayName: 'Greenhouse',\n category: 'hr',\n brandColor: '#24A47F',\n tagline:\n 'Sync jobs, candidates, applications, and offers from the Greenhouse Harvest API for hiring-funnel, time-to-hire, and offer-rate analytics.',\n vendor: {\n name: 'Greenhouse',\n domain: 'greenhouse.io',\n apiDocs: 'https://developers.greenhouse.io/harvest.html',\n website: 'https://www.greenhouse.com',\n },\n auth: {\n summary:\n 'A Harvest API key with read-only access to candidates, applications, jobs, and offers. Greenhouse authenticates via HTTP Basic with the key as the username and an empty password.',\n setup: [\n 'Open Greenhouse -> Configure -> Dev Center -> API Credential Management.',\n 'Create a new Harvest API key with Get / List permissions for the resources you intend to sync (Candidates, Applications, Jobs, Offers).',\n 'Copy the key once on creation - Greenhouse never shows it again.',\n 'Store the key as a secret and reference it from config as `apiKey: secret(\"GREENHOUSE_API_KEY\")`.',\n ],\n },\n rateLimit:\n 'Greenhouse Harvest enforces 50 requests per 10 seconds per key and surfaces remaining quota via the X-RateLimit-* headers; the shared HTTP client backs off on 429, preferring the Retry-After header.',\n limitations: [\n \"Application stage-transition history is derived from each application's built-in timestamps (applied_at, hired_at, rejected_at, last_activity_at) rather than the per-application /activity_feed endpoint, which avoids an N+1 sync.\",\n 'Greenhouse Onboard data and Recruiting custom fields are out of scope.',\n ],\n});\n\nexport const cost: ConnectorCost = {\n recommendedInterval: '1 hour',\n minInterval: '15 minutes',\n warning:\n 'Greenhouse Harvest is rate-limited to 50 requests / 10 seconds per key; on large hiring funnels the full backfill spans many pages, so syncing more often than the recommended interval can starve other integrations on the same key.',\n};\n\nexport interface GreenhouseSettings {\n resources?: readonly GreenhouseResource[];\n}\n\nconst greenhouseCredentials = {\n apiKey: {\n description: 'Greenhouse Harvest API key',\n auth: 'required' as const,\n },\n} satisfies CredentialsSchema;\n\ntype GreenhouseCredentials = typeof greenhouseCredentials;\n\nconst PHASE_ORDER = [\n 'jobs',\n 'candidates',\n 'applications',\n 'application_events',\n 'offers',\n] as const;\n\ntype GreenhousePhase = (typeof PHASE_ORDER)[number];\n\nexport type GreenhouseResource = GreenhousePhase;\n\nconst isGreenhouseSyncCursor = makeChunkedCursorGuard(PHASE_ORDER);\n\ntype GreenhouseSyncCursor = ChunkedSyncCursor<GreenhousePhase, string>;\n\nconst PER_PAGE = 100;\nconst API_HOST = 'harvest.greenhouse.io';\nconst API_BASE = `https://${API_HOST}`;\n\nconst JOB_ENTITY = 'greenhouse_job';\nconst CANDIDATE_ENTITY = 'greenhouse_candidate';\nconst APPLICATION_ENTITY = 'greenhouse_application';\nconst OFFER_ENTITY = 'greenhouse_offer';\nconst APPLICATION_EVENT = 'greenhouse_application_event';\n\nconst greenhouseRateLimit = standardRateLimitPolicy({\n remainingHeader: 'x-ratelimit-remaining',\n resetHeader: 'x-ratelimit-reset',\n resetUnit: 's',\n});\n\nfunction resourceToPhase(resource: GreenhouseResource): GreenhousePhase {\n return resource;\n}\n\ninterface JobRecord {\n id: number;\n name: string;\n status?: string | null;\n requisition_id?: string | null;\n notes?: string | null;\n confidential?: boolean | null;\n is_template?: boolean | null;\n copied_from_id?: number | null;\n departments?: Array<{ id?: number | null; name?: string | null }> | null;\n offices?: Array<{ id?: number | null; name?: string | null }> | null;\n opened_at?: string | null;\n closed_at?: string | null;\n created_at?: string | null;\n updated_at?: string | null;\n}\n\ninterface CandidateRecord {\n id: number;\n first_name?: string | null;\n last_name?: string | null;\n company?: string | null;\n title?: string | null;\n is_private?: boolean | null;\n application_ids?: number[] | null;\n created_at?: string | null;\n updated_at?: string | null;\n last_activity?: string | null;\n}\n\ninterface ApplicationStage {\n id?: number | null;\n name?: string | null;\n}\n\ninterface ApplicationSourceRef {\n id?: number | null;\n public_name?: string | null;\n}\n\ninterface ApplicationRecord {\n id: number;\n candidate_id: number;\n status?: string | null;\n current_stage?: ApplicationStage | null;\n applied_at?: string | null;\n rejected_at?: string | null;\n last_activity_at?: string | null;\n source?: ApplicationSourceRef | null;\n jobs?: Array<{ id?: number | null; name?: string | null }> | null;\n}\n\ninterface OfferRecord {\n id: number;\n application_id?: number | null;\n candidate_id?: number | null;\n job_id?: number | null;\n status?: string | null;\n created_at?: string | null;\n sent_at?: string | null;\n resolved_at?: string | null;\n starts_at?: string | null;\n}\n\nconst jobSchema = z.object({\n id: z.number().int(),\n name: z.string(),\n status: z.string().nullish(),\n requisition_id: z.string().nullish(),\n notes: z.string().nullish(),\n confidential: z.boolean().nullish(),\n is_template: z.boolean().nullish(),\n copied_from_id: z.number().nullish(),\n departments: z\n .array(z.object({ id: z.number().nullish(), name: z.string().nullish() }))\n .nullish(),\n offices: z\n .array(z.object({ id: z.number().nullish(), name: z.string().nullish() }))\n .nullish(),\n opened_at: z.string().nullish(),\n closed_at: z.string().nullish(),\n created_at: z.string().nullish(),\n updated_at: z.string().nullish(),\n});\n\nconst candidateSchema = z.object({\n id: z.number().int(),\n first_name: z.string().nullish(),\n last_name: z.string().nullish(),\n company: z.string().nullish(),\n title: z.string().nullish(),\n is_private: z.boolean().nullish(),\n application_ids: z.array(z.number()).nullish(),\n created_at: z.string().nullish(),\n updated_at: z.string().nullish(),\n last_activity: z.string().nullish(),\n});\n\nconst applicationSchema = z.object({\n id: z.number().int(),\n candidate_id: z.number().int(),\n status: z.string().nullish(),\n current_stage: z\n .object({ id: z.number().nullish(), name: z.string().nullish() })\n .nullish(),\n applied_at: z.string().nullish(),\n rejected_at: z.string().nullish(),\n last_activity_at: z.string().nullish(),\n source: z\n .object({ id: z.number().nullish(), public_name: z.string().nullish() })\n .nullish(),\n jobs: z\n .array(z.object({ id: z.number().nullish(), name: z.string().nullish() }))\n .nullish(),\n});\n\nconst offerSchema = z.object({\n id: z.number().int(),\n application_id: z.number().nullish(),\n candidate_id: z.number().nullish(),\n job_id: z.number().nullish(),\n status: z.string().nullish(),\n created_at: z.string().nullish(),\n sent_at: z.string().nullish(),\n resolved_at: z.string().nullish(),\n starts_at: z.string().nullish(),\n});\n\nexport const greenhouseResources = defineResources({\n [JOB_ENTITY]: {\n shape: 'entity',\n description:\n 'Open, draft, and closed requisitions with department, office, and timestamps for opened / closed transitions.',\n endpoint: 'GET /v1/jobs',\n fields: [\n { name: 'name', description: 'Job title.' },\n {\n name: 'status',\n description: 'Greenhouse job status (open / closed / draft).',\n },\n { name: 'requisitionId', description: 'External requisition id.' },\n {\n name: 'departments',\n description: 'Flat list of department names attached to the job.',\n },\n {\n name: 'offices',\n description: 'Flat list of office names attached to the job.',\n },\n { name: 'openedAt', description: 'When the job was opened (Unix ms).' },\n { name: 'closedAt', description: 'When the job was closed (Unix ms).' },\n { name: 'confidential', description: 'Whether the job is confidential.' },\n ],\n responses: { jobs: z.array(jobSchema) },\n },\n [CANDIDATE_ENTITY]: {\n shape: 'entity',\n description:\n 'Candidate records with name, title, company, and the count of attached applications.',\n endpoint: 'GET /v1/candidates',\n fields: [\n { name: 'firstName', description: 'Candidate first name.' },\n { name: 'lastName', description: 'Candidate last name.' },\n { name: 'title', description: 'Candidate current job title.' },\n { name: 'company', description: 'Candidate current company.' },\n {\n name: 'applicationCount',\n description:\n 'Number of applications attached to the candidate. Useful for spotting repeat applicants.',\n },\n {\n name: 'isPrivate',\n description: 'Whether the candidate is marked private.',\n },\n {\n name: 'createdAt',\n description: 'When the candidate was created (Unix ms).',\n },\n {\n name: 'lastActivityAt',\n description: 'Last activity timestamp on the candidate (Unix ms).',\n },\n ],\n responses: { candidates: z.array(candidateSchema) },\n },\n [APPLICATION_ENTITY]: {\n shape: 'entity',\n description:\n 'Applications with status (active / hired / rejected), current stage, source, and the linked candidate / job.',\n endpoint: 'GET /v1/applications',\n fields: [\n {\n name: 'candidateId',\n description: 'Candidate the application belongs to.',\n },\n {\n name: 'jobId',\n description: 'Primary job the application is attached to.',\n },\n { name: 'jobName', description: 'Primary job name at sync time.' },\n {\n name: 'status',\n description: 'Application status (active / hired / rejected).',\n },\n {\n name: 'currentStage',\n description: 'Name of the current stage (e.g. \"Phone Screen\").',\n },\n {\n name: 'source',\n description:\n 'Public source name where the application originated (e.g. \"LinkedIn\").',\n },\n { name: 'appliedAt', description: 'When the application was submitted.' },\n {\n name: 'rejectedAt',\n description: 'When the application was rejected (null if not).',\n },\n {\n name: 'hiredAt',\n description:\n 'When the application was hired (derived from last_activity_at when status=hired).',\n },\n {\n name: 'lastActivityAt',\n description: 'Last activity timestamp on the application (Unix ms).',\n },\n ],\n responses: { applications: z.array(applicationSchema) },\n },\n [APPLICATION_EVENT]: {\n shape: 'event',\n description:\n 'Application lifecycle events (applied / hired / rejected) derived from each application timestamps. The scope is cleared and rewritten on every sync (including incremental runs).',\n endpoint: 'GET /v1/applications',\n notes:\n \"Derived from each application's applied_at / rejected_at / last_activity_at fields, not from a separate API call.\",\n fields: [\n {\n name: 'applicationId',\n description: 'Application the event belongs to.',\n },\n { name: 'candidateId', description: 'Candidate id, denormalised.' },\n { name: 'jobId', description: 'Job id, denormalised.' },\n {\n name: 'transition',\n description: '\"applied\", \"hired\", or \"rejected\".',\n },\n {\n name: 'source',\n description: 'Application source name at the time of the event.',\n },\n ],\n responses: { application_events: z.array(applicationSchema) },\n },\n [OFFER_ENTITY]: {\n shape: 'entity',\n description:\n 'Offers with status (pending / accepted / rejected), linked to their application, candidate, and job.',\n endpoint: 'GET /v1/offers',\n fields: [\n { name: 'applicationId', description: 'Linked application.' },\n { name: 'candidateId', description: 'Linked candidate.' },\n { name: 'jobId', description: 'Linked job.' },\n {\n name: 'status',\n description: 'Offer status (pending / accepted / rejected).',\n },\n { name: 'sentAt', description: 'When the offer was sent (Unix ms).' },\n {\n name: 'resolvedAt',\n description:\n 'When the offer was accepted or rejected (Unix ms; null while pending).',\n },\n {\n name: 'startsAt',\n description: 'Proposed start date on the offer (Unix ms).',\n },\n ],\n responses: { offers: z.array(offerSchema) },\n },\n});\n\nfunction isoToMs(value: string | null | undefined): number | null {\n if (!value) {\n return null;\n }\n const ms = Date.parse(value);\n return Number.isFinite(ms) ? ms : null;\n}\n\nfunction isoToMsOrZero(value: string | null | undefined): number {\n return isoToMs(value) ?? 0;\n}\n\nfunction listNames(\n items: Array<{ name?: string | null }> | null | undefined,\n): string[] {\n if (!items) {\n return [];\n }\n const names: string[] = [];\n for (const item of items) {\n if (item && typeof item.name === 'string' && item.name !== '') {\n names.push(item.name);\n }\n }\n return names;\n}\n\nfunction primaryJobId(app: ApplicationRecord): number | null {\n const first = app.jobs?.[0];\n if (!first || first.id === null || first.id === undefined) {\n return null;\n }\n return first.id;\n}\n\nfunction primaryJobName(app: ApplicationRecord): string | null {\n return app.jobs?.[0]?.name ?? null;\n}\n\nfunction hiredAtMs(app: ApplicationRecord): number | null {\n if (app.status !== 'hired') {\n return null;\n }\n return isoToMs(app.last_activity_at);\n}\n\nexport const id = 'greenhouse';\n\nexport class GreenhouseConnector extends BaseConnector<\n GreenhouseSettings,\n GreenhouseCredentials\n> {\n static readonly id = id;\n\n static readonly resources = greenhouseResources;\n\n static readonly schemas = schemasFromResources(greenhouseResources);\n\n static readonly cost = cost;\n\n static create(input: unknown, ctx?: ConnectorContext): GreenhouseConnector {\n const parsed = configFields.parse(input);\n return new GreenhouseConnector(\n { resources: parsed.resources },\n { apiKey: parsed.apiKey },\n ctx,\n );\n }\n\n readonly id = id;\n override readonly credentials = greenhouseCredentials;\n\n private buildHeaders(): Record<string, string> {\n const basic = btoa(`${this.creds.apiKey}:`);\n return {\n Authorization: `Basic ${basic}`,\n Accept: 'application/json',\n 'User-Agent': connectorUserAgent('greenhouse'),\n };\n }\n\n private apiGet<T>(\n url: string,\n resource: string,\n signal?: AbortSignal,\n ): Promise<HttpResponse<T>> {\n return this.get<T>(url, {\n resource,\n headers: this.buildHeaders(),\n signal,\n rateLimit: greenhouseRateLimit,\n });\n }\n\n private allowedPagePath(phase: GreenhousePhase): string {\n switch (phase) {\n case 'jobs':\n return '/v1/jobs';\n case 'candidates':\n return '/v1/candidates';\n case 'applications':\n case 'application_events':\n return '/v1/applications';\n case 'offers':\n return '/v1/offers';\n }\n }\n\n private sanitizePageUrl(\n phase: GreenhousePhase,\n pageUrl: string | null,\n ): string | null {\n return sanitizeAllowedUrl({\n url: pageUrl,\n host: API_HOST,\n pathname: this.allowedPagePath(phase),\n });\n }\n\n private resolveCursor(cursor: unknown): GreenhouseSyncCursor | undefined {\n if (!isGreenhouseSyncCursor(cursor)) {\n return undefined;\n }\n if (cursor.phase === 'application_events') {\n return { phase: cursor.phase, page: null };\n }\n return {\n phase: cursor.phase,\n page: this.sanitizePageUrl(cursor.phase, cursor.page),\n };\n }\n\n private buildInitialUrl(\n phase: GreenhousePhase,\n options: SyncOptions,\n ): string {\n const url = new URL(`${API_BASE}${this.allowedPagePath(phase)}`);\n url.searchParams.set('per_page', String(PER_PAGE));\n if (phase !== 'application_events' && options.since) {\n url.searchParams.set('updated_after', options.since);\n }\n return url.toString();\n }\n\n private async fetchPhasePage(\n phase: GreenhousePhase,\n page: string | null,\n options: SyncOptions,\n signal?: AbortSignal,\n ): Promise<FetchPageResult<string>> {\n const resource =\n phase === 'application_events' ? 'application_events' : phase;\n const url = page ?? this.buildInitialUrl(phase, options);\n const res = await this.apiGet<unknown[]>(url, resource, signal);\n const rawNext = parseLinkHeader(res.headers.get('link'))['next'] ?? null;\n const next = this.sanitizePageUrl(phase, rawNext);\n return { items: res.body ?? [], next };\n }\n\n private async writeJobs(\n storage: StorageHandle,\n items: JobRecord[],\n ): Promise<void> {\n for (const job of items) {\n await storage.entity({\n type: JOB_ENTITY,\n id: String(job.id),\n attributes: {\n name: job.name,\n status: job.status ?? null,\n requisitionId: job.requisition_id ?? null,\n confidential: job.confidential ?? null,\n departments: listNames(job.departments),\n offices: listNames(job.offices),\n openedAt: isoToMs(job.opened_at),\n closedAt: isoToMs(job.closed_at),\n createdAt: isoToMs(job.created_at),\n },\n updated_at: isoToMsOrZero(job.updated_at ?? job.created_at),\n });\n }\n }\n\n private async writeCandidates(\n storage: StorageHandle,\n items: CandidateRecord[],\n ): Promise<void> {\n for (const cand of items) {\n await storage.entity({\n type: CANDIDATE_ENTITY,\n id: String(cand.id),\n attributes: {\n firstName: cand.first_name ?? null,\n lastName: cand.last_name ?? null,\n title: cand.title ?? null,\n company: cand.company ?? null,\n applicationCount: cand.application_ids?.length ?? 0,\n isPrivate: cand.is_private ?? null,\n createdAt: isoToMs(cand.created_at),\n lastActivityAt: isoToMs(cand.last_activity),\n },\n updated_at: isoToMsOrZero(\n cand.updated_at ?? cand.last_activity ?? cand.created_at,\n ),\n });\n }\n }\n\n private async writeApplications(\n storage: StorageHandle,\n items: ApplicationRecord[],\n ): Promise<void> {\n for (const app of items) {\n const attributes: Record<string, JSONValue> = {\n candidateId: String(app.candidate_id),\n jobId: primaryJobId(app) === null ? null : String(primaryJobId(app)),\n jobName: primaryJobName(app),\n status: app.status ?? null,\n currentStage: app.current_stage?.name ?? null,\n source: app.source?.public_name ?? null,\n appliedAt: isoToMs(app.applied_at),\n rejectedAt: isoToMs(app.rejected_at),\n hiredAt: hiredAtMs(app),\n lastActivityAt: isoToMs(app.last_activity_at),\n };\n await storage.entity({\n type: APPLICATION_ENTITY,\n id: String(app.id),\n attributes,\n updated_at: isoToMsOrZero(\n app.last_activity_at ?? app.applied_at ?? app.rejected_at,\n ),\n });\n }\n }\n\n private async writeApplicationEvents(\n storage: StorageHandle,\n items: ApplicationRecord[],\n ): Promise<void> {\n for (const app of items) {\n const base: Record<string, JSONValue> = {\n applicationId: String(app.id),\n candidateId: String(app.candidate_id),\n jobId: primaryJobId(app) === null ? null : String(primaryJobId(app)),\n source: app.source?.public_name ?? null,\n };\n\n const appliedMs = isoToMs(app.applied_at);\n if (appliedMs !== null) {\n await storage.event({\n name: APPLICATION_EVENT,\n start_ts: appliedMs,\n end_ts: null,\n attributes: { ...base, transition: 'applied' },\n });\n }\n\n const rejectedMs = isoToMs(app.rejected_at);\n if (rejectedMs !== null) {\n await storage.event({\n name: APPLICATION_EVENT,\n start_ts: rejectedMs,\n end_ts: null,\n attributes: { ...base, transition: 'rejected' },\n });\n }\n\n const hiredMs = hiredAtMs(app);\n if (hiredMs !== null) {\n await storage.event({\n name: APPLICATION_EVENT,\n start_ts: hiredMs,\n end_ts: null,\n attributes: { ...base, transition: 'hired' },\n });\n }\n }\n }\n\n private async writeOffers(\n storage: StorageHandle,\n items: OfferRecord[],\n ): Promise<void> {\n for (const offer of items) {\n await storage.entity({\n type: OFFER_ENTITY,\n id: String(offer.id),\n attributes: {\n applicationId:\n offer.application_id === null || offer.application_id === undefined\n ? null\n : String(offer.application_id),\n candidateId:\n offer.candidate_id === null || offer.candidate_id === undefined\n ? null\n : String(offer.candidate_id),\n jobId:\n offer.job_id === null || offer.job_id === undefined\n ? null\n : String(offer.job_id),\n status: offer.status ?? null,\n sentAt: isoToMs(offer.sent_at),\n resolvedAt: isoToMs(offer.resolved_at),\n startsAt: isoToMs(offer.starts_at),\n },\n updated_at: isoToMsOrZero(\n offer.resolved_at ?? offer.sent_at ?? offer.created_at,\n ),\n });\n }\n }\n\n private async clearScopeOnFirstPage(\n storage: StorageHandle,\n phase: GreenhousePhase,\n isFull: boolean,\n ): Promise<void> {\n if (phase === 'application_events') {\n await storage.events([], { names: [APPLICATION_EVENT] });\n return;\n }\n if (!isFull) {\n return;\n }\n const entityType = ENTITY_TYPE_BY_PHASE[phase];\n if (entityType) {\n await storage.entities([], { types: [entityType] });\n }\n }\n\n private async writePhase(\n storage: StorageHandle,\n phase: GreenhousePhase,\n items: unknown[],\n ): Promise<void> {\n switch (phase) {\n case 'jobs':\n return this.writeJobs(storage, items as JobRecord[]);\n case 'candidates':\n return this.writeCandidates(storage, items as CandidateRecord[]);\n case 'applications':\n return this.writeApplications(storage, items as ApplicationRecord[]);\n case 'application_events':\n return this.writeApplicationEvents(\n storage,\n items as ApplicationRecord[],\n );\n case 'offers':\n return this.writeOffers(storage, items as OfferRecord[]);\n }\n }\n\n async sync(\n options: SyncOptions,\n storage: StorageHandle,\n signal?: AbortSignal,\n ): Promise<SyncResult> {\n const cursor = this.resolveCursor(options.cursor);\n const isFull = options.mode === 'full';\n\n const phases = selectActivePhases<GreenhouseResource, GreenhousePhase>(\n resourceToPhase,\n PHASE_ORDER,\n this.settings.resources,\n );\n\n return paginateChunked<GreenhousePhase, string>({\n phases,\n cursor,\n signal,\n logger: this.logger,\n fetchPage: async (phase, page, sig) =>\n this.fetchPhasePage(phase, page, options, sig),\n writeBatch: async (phase, items, page) => {\n if (page === null) {\n await this.clearScopeOnFirstPage(storage, phase, isFull);\n }\n await this.writePhase(storage, phase, items);\n },\n });\n }\n}\n\nconst ENTITY_TYPE_BY_PHASE: Partial<Record<GreenhousePhase, string>> = {\n jobs: JOB_ENTITY,\n candidates: CANDIDATE_ENTITY,\n applications: APPLICATION_ENTITY,\n offers: OFFER_ENTITY,\n};\n","import { GreenhouseConnector } from './greenhouse';\n\nexport {\n configFields,\n cost,\n doc,\n GreenhouseConnector,\n greenhouseResources as resources,\n id,\n} from './greenhouse';\nexport type { GreenhouseResource, GreenhouseSettings } from './greenhouse';\nexport default GreenhouseConnector;\n"],"mappings":";AEAO,IAAM,sBAAsB;AAE5B,IAAM,qBAAqB,qBAAqB,mBAAmB;AAEnE,SAAS,mBAAmB,aAA6B;AAC9D,SAAO,qBAAqB,WAAW,IAAI,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;AACV;;;ACryBA,IAAO,gBAAQ;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../../connector-shared/src/errors.ts","../../../connector-shared/src/retry.ts","../../../connector-shared/src/version.ts","../../../connector-shared/src/request.ts","../../../connector-shared/src/rate-limit.ts","../../../connector-shared/src/map-concurrent.ts","../../../connector-shared/src/sanitize.ts","../../../connector-shared/src/epoch.ts","../../../connector-shared/src/pagination.ts","../../../connector-shared/src/logger.ts","../src/greenhouse.ts","../src/index.ts"],"sourcesContent":["import type { HttpResponse } from './types';\n\nexport type HttpErrorKind =\n | 'transient'\n | 'rate_limit'\n | 'auth'\n | 'upstream_bug'\n | 'client_bug';\n\nexport abstract class HttpClientError extends Error {\n abstract readonly kind: HttpErrorKind;\n readonly response?: HttpResponse;\n\n constructor(message: string, response?: HttpResponse) {\n super(message);\n this.name = new.target.name;\n this.response = response;\n }\n}\n\nexport class TransientError extends HttpClientError {\n readonly kind = 'transient' as const;\n}\n\nexport class RateLimitError extends HttpClientError {\n readonly kind = 'rate_limit' as const;\n readonly retryAfter?: Date;\n\n constructor(message: string, response?: HttpResponse, retryAfter?: Date) {\n super(message, response);\n this.retryAfter = retryAfter;\n }\n}\n\nexport class AuthError extends HttpClientError {\n readonly kind = 'auth' as const;\n}\n\nexport class UpstreamBugError extends HttpClientError {\n readonly kind = 'upstream_bug' as const;\n}\n\nexport class ClientBugError extends HttpClientError {\n readonly kind = 'client_bug' as const;\n}\n\nexport function classifyStatus(status: number): HttpErrorKind {\n if (status === 429) {\n return 'rate_limit';\n }\n if (status === 401 || status === 403) {\n return 'auth';\n }\n if (status === 408) {\n return 'transient';\n }\n if (status >= 500) {\n return 'upstream_bug';\n }\n if (status >= 400) {\n return 'client_bug';\n }\n return 'client_bug';\n}\n\nexport function errorForStatus(\n message: string,\n response: HttpResponse,\n retryAfter?: Date,\n): HttpClientError {\n const kind = classifyStatus(response.status);\n switch (kind) {\n case 'rate_limit':\n return new RateLimitError(message, response, retryAfter);\n case 'auth':\n return new AuthError(message, response);\n case 'transient':\n return new TransientError(message, response);\n case 'upstream_bug':\n return new UpstreamBugError(message, response);\n case 'client_bug':\n return new ClientBugError(message, response);\n }\n}\n","import { HttpClientError, RateLimitError, TransientError } from './errors';\n\nexport interface RetryPolicy {\n maxAttempts?: number;\n initialDelayMs?: number;\n maxDelayMs?: number;\n retryOn?: (status: number | null, err?: Error) => boolean;\n}\n\nexport const defaultRetryOn = (status: number | null, err?: Error): boolean => {\n if (err instanceof RateLimitError) {\n return true;\n }\n if (err instanceof TransientError) {\n return true;\n }\n if (status === null) {\n return err instanceof Error && !(err instanceof HttpClientError);\n }\n if (status === 408 || status === 429) {\n return true;\n }\n if (status >= 500) {\n return true;\n }\n return false;\n};\n\nexport function backoffDelayMs(\n attempt: number,\n policy: Required<Pick<RetryPolicy, 'initialDelayMs' | 'maxDelayMs'>>,\n): number {\n const base = policy.initialDelayMs * 2 ** attempt;\n const jitter = base * 0.25 * Math.random();\n return Math.min(base + jitter, policy.maxDelayMs);\n}\n\nexport function parseRetryAfter(\n headerValue: string | null,\n now: Date = new Date(),\n): Date | undefined {\n if (!headerValue) {\n return undefined;\n }\n const trimmed = headerValue.trim();\n if (/^\\d+$/.test(trimmed)) {\n return new Date(now.getTime() + Number(trimmed) * 1000);\n }\n const parsed = Date.parse(trimmed);\n if (Number.isNaN(parsed)) {\n return undefined;\n }\n return new Date(parsed);\n}\n\nexport function sleep(ms: number, signal?: AbortSignal): Promise<void> {\n if (signal?.aborted) {\n return Promise.reject(signal.reason ?? new Error('Aborted'));\n }\n return new Promise<void>((resolve, reject) => {\n const onAbort = () => {\n clearTimeout(timer);\n reject(signal!.reason ?? new Error('Aborted'));\n };\n const timer = setTimeout(() => {\n signal?.removeEventListener('abort', onAbort);\n resolve();\n }, ms);\n signal?.addEventListener('abort', onAbort, { once: true });\n });\n}\n","export const HTTP_CLIENT_VERSION = '0.0.0';\n\nexport const DEFAULT_USER_AGENT = `rawdash-connector/${HTTP_CLIENT_VERSION} (+https://rawdash.dev)`;\n\nexport function connectorUserAgent(connectorId: string): string {\n return `rawdash-connector-${connectorId}/${HTTP_CLIENT_VERSION} (+https://rawdash.dev)`;\n}\n","import {\n AuthError,\n ClientBugError,\n HttpClientError,\n RateLimitError,\n TransientError,\n UpstreamBugError,\n errorForStatus,\n} from './errors';\nimport { defaultRetryOn, parseRetryAfter, sleep } from './retry';\nimport type { FetchLike, HttpMethod, HttpRequest, HttpResponse } from './types';\nimport { DEFAULT_USER_AGENT } from './version';\n\nconst DEFAULT_TIMEOUT_MS = 10_000;\nconst DEFAULT_MAX_ATTEMPTS = 3;\nconst DEFAULT_INITIAL_DELAY_MS = 1000;\nconst DEFAULT_MAX_DELAY_MS = 60_000;\nconst OBSERVER_TIMEOUT_MS = 250;\n\nexport interface RequestObservation {\n url: string;\n method: HttpMethod;\n status: number;\n resource: string;\n requestId: string;\n body: unknown;\n}\n\nexport type RequestObserver = (\n event: RequestObservation,\n) => void | Promise<void>;\n\nexport interface RequestOptions {\n fetch?: FetchLike;\n observer?: RequestObserver;\n resource: string;\n requestId?: string;\n}\n\nasync function notifyObserver(\n observer: RequestObserver,\n event: RequestObservation,\n): Promise<void> {\n let result: void | Promise<void>;\n try {\n result = observer(event);\n } catch (err) {\n console.warn('[connector-shared] request observer threw:', err);\n return;\n }\n if (!(result instanceof Promise)) {\n return;\n }\n const guarded = result.catch((err) => {\n console.warn('[connector-shared] request observer rejected:', err);\n });\n let timer: ReturnType<typeof setTimeout> | undefined;\n const timeout = new Promise<void>((resolve) => {\n timer = setTimeout(resolve, OBSERVER_TIMEOUT_MS);\n });\n try {\n await Promise.race([guarded, timeout]);\n } finally {\n if (timer) {\n clearTimeout(timer);\n }\n }\n}\n\nfunction newRequestId(): string {\n const c = (globalThis as { crypto?: { randomUUID?: () => string } }).crypto;\n if (c?.randomUUID) {\n return c.randomUUID();\n }\n return `${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 10)}`;\n}\n\nfunction mergeHeaders(\n defaults: Record<string, string>,\n overrides: Record<string, string> | undefined,\n): Record<string, string> {\n const merged: Record<string, string> = {};\n for (const [k, v] of Object.entries(defaults)) {\n merged[k.toLowerCase()] = v;\n }\n if (overrides) {\n for (const [k, v] of Object.entries(overrides)) {\n merged[k.toLowerCase()] = v;\n }\n }\n return merged;\n}\n\nfunction linkTimeoutSignal(\n parent: AbortSignal | undefined,\n timeoutMs: number,\n): { signal: AbortSignal; cancel: () => void } {\n const controller = new AbortController();\n const onParentAbort = () => {\n controller.abort(parent?.reason);\n };\n if (parent) {\n if (parent.aborted) {\n controller.abort(parent.reason);\n } else {\n parent.addEventListener('abort', onParentAbort, { once: true });\n }\n }\n const timer = setTimeout(() => {\n controller.abort(new Error(`Request timed out after ${timeoutMs}ms`));\n }, timeoutMs);\n return {\n signal: controller.signal,\n cancel: () => {\n clearTimeout(timer);\n if (parent) {\n parent.removeEventListener('abort', onParentAbort);\n }\n },\n };\n}\n\nasync function readBody(res: Response, parseJson: boolean): Promise<unknown> {\n if (res.status === 204 || res.status === 205) {\n return null;\n }\n const contentType = res.headers.get('content-type') ?? '';\n if (parseJson && contentType.includes('application/json')) {\n const text = await res.text();\n if (text.length === 0) {\n return null;\n }\n return JSON.parse(text);\n }\n return res.text();\n}\n\nexport async function request<T = unknown>(\n req: HttpRequest,\n options: RequestOptions,\n): Promise<HttpResponse<T>> {\n const fetchImpl: FetchLike = options.fetch ?? (globalThis.fetch as FetchLike);\n const retry = req.retry ?? {};\n const maxAttempts = retry.maxAttempts ?? DEFAULT_MAX_ATTEMPTS;\n const initialDelayMs = retry.initialDelayMs ?? DEFAULT_INITIAL_DELAY_MS;\n const maxDelayMs = retry.maxDelayMs ?? DEFAULT_MAX_DELAY_MS;\n const retryOn = retry.retryOn ?? defaultRetryOn;\n const timeoutMs = req.timeoutMs ?? DEFAULT_TIMEOUT_MS;\n const parseJson = req.parseJson ?? true;\n\n const headers = mergeHeaders(\n {\n 'User-Agent': DEFAULT_USER_AGENT,\n Accept: 'application/json',\n },\n req.headers,\n );\n\n let lastErr: Error | undefined;\n\n for (let attempt = 0; attempt < maxAttempts; attempt++) {\n req.signal?.throwIfAborted();\n\n const { signal, cancel } = linkTimeoutSignal(req.signal, timeoutMs);\n let res: Response;\n try {\n res = await fetchImpl(req.url, {\n method: req.method ?? 'GET',\n headers,\n body: req.body as RequestInit['body'],\n signal,\n });\n } catch (err) {\n cancel();\n if (req.signal?.aborted) {\n throw req.signal.reason ?? err;\n }\n const error = err instanceof Error ? err : new Error(String(err));\n lastErr = error;\n if (attempt < maxAttempts - 1 && retryOn(null, error)) {\n const delay = computeDelay(attempt, initialDelayMs, maxDelayMs);\n await sleep(delay, req.signal);\n continue;\n }\n throw new TransientError(error.message);\n }\n cancel();\n\n const body = await readBody(res, parseJson);\n const httpResponse: HttpResponse<T> = {\n status: res.status,\n headers: res.headers,\n body: body as T,\n };\n if (req.rateLimit) {\n const state = req.rateLimit.parse(res.headers);\n if (state) {\n httpResponse.rateLimitState = state;\n }\n }\n\n if (options.observer) {\n await notifyObserver(options.observer, {\n url: req.url,\n method: req.method ?? 'GET',\n status: res.status,\n resource: options.resource,\n requestId: options.requestId ?? newRequestId(),\n body,\n });\n }\n\n if (res.ok) {\n return httpResponse;\n }\n\n const retryAfter = parseRetryAfter(res.headers.get('retry-after'));\n const message = `HTTP ${res.status} ${res.statusText} for ${req.method ?? 'GET'} ${req.url}`;\n const err = errorForStatus(message, httpResponse, retryAfter);\n\n if (\n attempt < maxAttempts - 1 &&\n retryOn(res.status, err) &&\n !(err instanceof AuthError) &&\n !(err instanceof ClientBugError)\n ) {\n lastErr = err;\n let delay = computeDelay(attempt, initialDelayMs, maxDelayMs);\n if (err instanceof RateLimitError && retryAfter) {\n const wait = retryAfter.getTime() - Date.now();\n if (wait > 0) {\n delay = Math.min(wait, maxDelayMs);\n }\n }\n await sleep(delay, req.signal);\n continue;\n }\n\n throw err;\n }\n\n throw lastErr ?? new UpstreamBugError('Exhausted retry attempts');\n}\n\nfunction computeDelay(\n attempt: number,\n initialDelayMs: number,\n maxDelayMs: number,\n): number {\n const base = initialDelayMs * 2 ** attempt;\n const jitter = base * 0.25 * Math.random();\n return Math.min(base + jitter, maxDelayMs);\n}\n\nexport { HttpClientError };\n","export interface RateLimitState {\n remaining: number;\n resetAt: Date;\n}\n\nexport interface RateLimitPolicy {\n parse(headers: Headers): RateLimitState | null;\n}\n\nexport interface StandardRateLimitPolicyConfig {\n remainingHeader: string;\n resetHeader: string;\n resetUnit: 's' | 'ms';\n resetFallbackMs?: number;\n}\n\nexport function standardRateLimitPolicy(\n config: StandardRateLimitPolicyConfig,\n): RateLimitPolicy {\n const { remainingHeader, resetHeader, resetUnit, resetFallbackMs } = config;\n const multiplier = resetUnit === 's' ? 1000 : 1;\n return {\n parse(h) {\n const remainingRaw = h.get(remainingHeader);\n if (remainingRaw === null || remainingRaw.trim() === '') {\n return null;\n }\n const remaining = Number(remainingRaw);\n if (!Number.isFinite(remaining)) {\n return null;\n }\n const resetRaw = h.get(resetHeader);\n if (resetRaw === null) {\n if (resetFallbackMs === undefined) {\n return null;\n }\n return {\n remaining,\n resetAt: new Date(Date.now() + resetFallbackMs),\n };\n }\n if (resetRaw.trim() === '') {\n return null;\n }\n const reset = Number(resetRaw);\n if (!Number.isFinite(reset) || reset < 0) {\n return null;\n }\n const resetMs = reset * multiplier;\n if (!Number.isFinite(resetMs)) {\n return null;\n }\n return { remaining, resetAt: new Date(resetMs) };\n },\n };\n}\n","export async function mapWithConcurrency<T, R>(\n items: readonly T[],\n concurrency: number,\n fn: (item: T, index: number) => Promise<R>,\n): Promise<R[]> {\n const results = new Array<R>(items.length);\n if (items.length === 0) {\n return results;\n }\n const normalized = Number.isFinite(concurrency) ? Math.floor(concurrency) : 1;\n const limit = Math.max(1, Math.min(normalized, items.length));\n let next = 0;\n let failed = false;\n\n async function worker(): Promise<void> {\n while (!failed) {\n const i = next++;\n if (i >= items.length) {\n return;\n }\n try {\n results[i] = await fn(items[i]!, i);\n } catch (err) {\n failed = true;\n throw err;\n }\n }\n }\n\n const workers: Promise<void>[] = [];\n for (let w = 0; w < limit; w++) {\n workers.push(worker());\n }\n await Promise.all(workers);\n return results;\n}\n","export interface SanitizeAllowedUrlOptions {\n url: string | null;\n host: string;\n pathname: string;\n protocol?: 'https:' | 'http:';\n}\n\nexport function sanitizeAllowedUrl(\n options: SanitizeAllowedUrlOptions,\n): string | null {\n const { url, host, pathname, protocol = 'https:' } = options;\n if (url === null) {\n return null;\n }\n try {\n const u = new URL(url);\n if (u.protocol !== protocol || u.host !== host || u.pathname !== pathname) {\n return null;\n }\n return u.toString();\n } catch {\n return null;\n }\n}\n","export type EpochUnit = 'ms' | 's' | 'iso';\n\nexport function parseEpoch(\n value: number | string | null | undefined,\n unit: EpochUnit,\n): number | null {\n if (value === null || value === undefined) {\n return null;\n }\n if (unit === 'iso') {\n if (typeof value !== 'string') {\n return null;\n }\n const ms = new Date(value).getTime();\n return Number.isFinite(ms) ? ms : null;\n }\n if (typeof value === 'string' && value.trim() === '') {\n return null;\n }\n const n = typeof value === 'number' ? value : Number(value);\n if (!Number.isFinite(n)) {\n return null;\n }\n const result = unit === 's' ? n * 1000 : n;\n return Number.isFinite(result) ? result : null;\n}\n","import { request } from './request';\nimport type { HttpRequest } from './types';\n\nexport function parseLinkHeader(header: string | null): Record<string, string> {\n if (!header) {\n return {};\n }\n const result: Record<string, string> = {};\n for (const part of header.split(',')) {\n const match = part.match(/<([^>]+)>\\s*;\\s*rel=\"([^\"]+)\"/);\n if (match) {\n result[match[2]!] = match[1]!;\n }\n }\n return result;\n}\n\nexport async function* paginateLink<T>(\n initial: HttpRequest,\n parse: (body: unknown) => T[],\n options: { resource: string },\n): AsyncIterable<T> {\n let next: string | null = initial.url;\n while (next) {\n const res: Awaited<ReturnType<typeof request>> = await request(\n {\n ...initial,\n url: next,\n },\n { resource: options.resource },\n );\n for (const item of parse(res.body)) {\n yield item;\n }\n const links = parseLinkHeader(res.headers.get('link'));\n next = links['next'] ?? null;\n }\n}\n\nexport async function* paginateCursor<T>(\n initial: HttpRequest,\n parse: (body: unknown) => { items: T[]; nextCursor: string | null },\n buildNext: (req: HttpRequest, cursor: string) => HttpRequest,\n options: { resource: string },\n): AsyncIterable<T> {\n let req: HttpRequest = initial;\n while (true) {\n const res = await request(req, { resource: options.resource });\n const { items, nextCursor } = parse(res.body);\n for (const item of items) {\n yield item;\n }\n if (!nextCursor) {\n return;\n }\n req = buildNext(req, nextCursor);\n }\n}\n\nexport async function* paginatePage<T>(\n initial: HttpRequest,\n parse: (body: unknown) => { items: T[]; hasMore: boolean },\n buildPage: (req: HttpRequest, page: number) => HttpRequest,\n options: { resource: string },\n): AsyncIterable<T> {\n let page = 1;\n while (true) {\n const req = page === 1 ? initial : buildPage(initial, page);\n const res = await request(req, { resource: options.resource });\n const { items, hasMore } = parse(res.body);\n for (const item of items) {\n yield item;\n }\n if (!hasMore || items.length === 0) {\n return;\n }\n page++;\n }\n}\n","export type LogFields = Record<string, unknown>;\n\nexport interface ConnectorLogger {\n info(event: string, fields?: LogFields): void;\n warn(event: string, fields?: LogFields): void;\n}\n\nexport interface ConnectorLoggerOptions {\n scope: string;\n}\n\nconst MAX_VALUE_LEN = 120;\n\nfunction truncate(s: string, max = MAX_VALUE_LEN): string {\n if (s.length <= max) {\n return s;\n }\n return `${s.slice(0, max - 1)}…`;\n}\n\nfunction formatValue(value: unknown): string {\n if (value === null) {\n return 'null';\n }\n if (value === undefined) {\n return '';\n }\n if (typeof value === 'number' || typeof value === 'boolean') {\n return String(value);\n }\n if (typeof value === 'string') {\n const t = truncate(value);\n if (/[\\s\"=]/.test(t)) {\n return JSON.stringify(t);\n }\n return t;\n }\n if (typeof value === 'bigint') {\n return value.toString();\n }\n let json: string | undefined;\n try {\n json = JSON.stringify(value);\n } catch {\n json = undefined;\n }\n return truncate(json ?? String(value));\n}\n\nexport function formatLogFields(fields?: LogFields): string {\n if (!fields) {\n return '';\n }\n const parts: string[] = [];\n for (const [k, v] of Object.entries(fields)) {\n if (v === undefined) {\n continue;\n }\n parts.push(`${k}=${formatValue(v)}`);\n }\n return parts.length > 0 ? ` ${parts.join(' ')}` : '';\n}\n\nexport function formatLogLine(\n scope: string,\n event: string,\n fields?: LogFields,\n): string {\n return `[${scope}] ${event}${formatLogFields(fields)}`;\n}\n\nexport function createDefaultConnectorLogger(\n opts: ConnectorLoggerOptions,\n): ConnectorLogger {\n return {\n info(event, fields) {\n console.info(formatLogLine(opts.scope, event, fields));\n },\n warn(event, fields) {\n console.warn(formatLogLine(opts.scope, event, fields));\n },\n };\n}\n\nconst NOOP_LOGGER: ConnectorLogger = {\n info() {},\n warn() {},\n};\n\nexport function noopConnectorLogger(): ConnectorLogger {\n return NOOP_LOGGER;\n}\n","import {\n type HttpResponse,\n connectorUserAgent,\n parseLinkHeader,\n sanitizeAllowedUrl,\n standardRateLimitPolicy,\n} from '@rawdash/connector-shared';\nimport {\n BaseConnector,\n type ChunkedSyncCursor,\n type ConnectorContext,\n type ConnectorCost,\n type ConnectorDoc,\n type CredentialsSchema,\n type FetchPageResult,\n type FetchSpec,\n type FilterClause,\n type JSONValue,\n type StorageHandle,\n type SyncOptions,\n type SyncResult,\n defineConfigFields,\n defineConnectorDoc,\n defineResources,\n makeChunkedCursorGuard,\n paginateChunked,\n schemasFromResources,\n selectActivePhases,\n} from '@rawdash/core';\nimport { z } from 'zod';\n\nexport const configFields = defineConfigFields(\n z.object({\n apiKey: z.object({ $secret: z.string() }).meta({\n label: 'Harvest API key',\n description:\n 'Greenhouse Harvest API key with read-only access. Create one at Configure -> Dev Center -> API Credential Management.',\n placeholder: 'ghr_...',\n secret: true,\n }),\n resources: z\n .array(\n z.enum([\n 'jobs',\n 'candidates',\n 'applications',\n 'application_events',\n 'offers',\n ]),\n )\n .nonempty()\n .optional()\n .meta({\n label: 'Resources',\n description:\n 'Which Greenhouse resources to sync. Omit to sync all resources. The Harvest key only needs Get / List permissions for the resources listed here.',\n }),\n }),\n);\n\nexport const doc: ConnectorDoc = defineConnectorDoc({\n displayName: 'Greenhouse',\n category: 'hr',\n brandColor: '#24A47F',\n tagline:\n 'Sync jobs, candidates, applications, and offers from the Greenhouse Harvest API for hiring-funnel, time-to-hire, and offer-rate analytics.',\n vendor: {\n name: 'Greenhouse',\n domain: 'greenhouse.io',\n apiDocs: 'https://developers.greenhouse.io/harvest.html',\n website: 'https://www.greenhouse.com',\n },\n auth: {\n summary:\n 'A Harvest API key with read-only access to candidates, applications, jobs, and offers. Greenhouse authenticates via HTTP Basic with the key as the username and an empty password.',\n setup: [\n 'Open Greenhouse -> Configure -> Dev Center -> API Credential Management.',\n 'Create a new Harvest API key with Get / List permissions for the resources you intend to sync (Candidates, Applications, Jobs, Offers).',\n 'Copy the key once on creation - Greenhouse never shows it again.',\n 'Store the key as a secret and reference it from config as `apiKey: secret(\"GREENHOUSE_API_KEY\")`.',\n ],\n },\n rateLimit:\n 'Greenhouse Harvest enforces 50 requests per 10 seconds per key and surfaces remaining quota via the X-RateLimit-* headers; the shared HTTP client backs off on 429, preferring the Retry-After header.',\n limitations: [\n \"Application stage-transition history is derived from each application's built-in timestamps (applied_at, hired_at, rejected_at, last_activity_at) rather than the per-application /activity_feed endpoint, which avoids an N+1 sync.\",\n 'Greenhouse Onboard data and Recruiting custom fields are out of scope.',\n ],\n});\n\nexport const cost: ConnectorCost = {\n recommendedInterval: '1 hour',\n minInterval: '15 minutes',\n warning:\n 'Greenhouse Harvest is rate-limited to 50 requests / 10 seconds per key; on large hiring funnels the full backfill spans many pages, so syncing more often than the recommended interval can starve other integrations on the same key.',\n};\n\nexport interface GreenhouseSettings {\n resources?: readonly GreenhouseResource[];\n}\n\nconst greenhouseCredentials = {\n apiKey: {\n description: 'Greenhouse Harvest API key',\n auth: 'required' as const,\n },\n} satisfies CredentialsSchema;\n\ntype GreenhouseCredentials = typeof greenhouseCredentials;\n\nconst PHASE_ORDER = [\n 'jobs',\n 'candidates',\n 'applications',\n 'application_events',\n 'offers',\n] as const;\n\ntype GreenhousePhase = (typeof PHASE_ORDER)[number];\n\nexport type GreenhouseResource = GreenhousePhase;\n\nconst isGreenhouseSyncCursor = makeChunkedCursorGuard(PHASE_ORDER);\n\ntype GreenhouseSyncCursor = ChunkedSyncCursor<GreenhousePhase, string>;\n\nconst PER_PAGE = 100;\nconst API_HOST = 'harvest.greenhouse.io';\nconst API_BASE = `https://${API_HOST}`;\n\nconst JOB_ENTITY = 'greenhouse_job';\nconst CANDIDATE_ENTITY = 'greenhouse_candidate';\nconst APPLICATION_ENTITY = 'greenhouse_application';\nconst OFFER_ENTITY = 'greenhouse_offer';\nconst APPLICATION_EVENT = 'greenhouse_application_event';\n\nconst greenhouseRateLimit = standardRateLimitPolicy({\n remainingHeader: 'x-ratelimit-remaining',\n resetHeader: 'x-ratelimit-reset',\n resetUnit: 's',\n});\n\nfunction resourceToPhase(resource: GreenhouseResource): GreenhousePhase {\n return resource;\n}\n\ninterface JobRecord {\n id: number;\n name: string;\n status?: string | null;\n requisition_id?: string | null;\n notes?: string | null;\n confidential?: boolean | null;\n is_template?: boolean | null;\n copied_from_id?: number | null;\n departments?: Array<{ id?: number | null; name?: string | null }> | null;\n offices?: Array<{ id?: number | null; name?: string | null }> | null;\n opened_at?: string | null;\n closed_at?: string | null;\n created_at?: string | null;\n updated_at?: string | null;\n}\n\ninterface CandidateRecord {\n id: number;\n first_name?: string | null;\n last_name?: string | null;\n company?: string | null;\n title?: string | null;\n is_private?: boolean | null;\n application_ids?: number[] | null;\n created_at?: string | null;\n updated_at?: string | null;\n last_activity?: string | null;\n}\n\ninterface ApplicationStage {\n id?: number | null;\n name?: string | null;\n}\n\ninterface ApplicationSourceRef {\n id?: number | null;\n public_name?: string | null;\n}\n\ninterface ApplicationRecord {\n id: number;\n candidate_id: number;\n status?: string | null;\n current_stage?: ApplicationStage | null;\n applied_at?: string | null;\n rejected_at?: string | null;\n last_activity_at?: string | null;\n source?: ApplicationSourceRef | null;\n jobs?: Array<{ id?: number | null; name?: string | null }> | null;\n}\n\ninterface OfferRecord {\n id: number;\n application_id?: number | null;\n candidate_id?: number | null;\n job_id?: number | null;\n status?: string | null;\n created_at?: string | null;\n sent_at?: string | null;\n resolved_at?: string | null;\n starts_at?: string | null;\n}\n\nconst jobSchema = z.object({\n id: z.number().int(),\n name: z.string(),\n status: z.string().nullish(),\n requisition_id: z.string().nullish(),\n notes: z.string().nullish(),\n confidential: z.boolean().nullish(),\n is_template: z.boolean().nullish(),\n copied_from_id: z.number().nullish(),\n departments: z\n .array(z.object({ id: z.number().nullish(), name: z.string().nullish() }))\n .nullish(),\n offices: z\n .array(z.object({ id: z.number().nullish(), name: z.string().nullish() }))\n .nullish(),\n opened_at: z.string().nullish(),\n closed_at: z.string().nullish(),\n created_at: z.string().nullish(),\n updated_at: z.string().nullish(),\n});\n\nconst candidateSchema = z.object({\n id: z.number().int(),\n first_name: z.string().nullish(),\n last_name: z.string().nullish(),\n company: z.string().nullish(),\n title: z.string().nullish(),\n is_private: z.boolean().nullish(),\n application_ids: z.array(z.number()).nullish(),\n created_at: z.string().nullish(),\n updated_at: z.string().nullish(),\n last_activity: z.string().nullish(),\n});\n\nconst applicationSchema = z.object({\n id: z.number().int(),\n candidate_id: z.number().int(),\n status: z.string().nullish(),\n current_stage: z\n .object({ id: z.number().nullish(), name: z.string().nullish() })\n .nullish(),\n applied_at: z.string().nullish(),\n rejected_at: z.string().nullish(),\n last_activity_at: z.string().nullish(),\n source: z\n .object({ id: z.number().nullish(), public_name: z.string().nullish() })\n .nullish(),\n jobs: z\n .array(z.object({ id: z.number().nullish(), name: z.string().nullish() }))\n .nullish(),\n});\n\nconst offerSchema = z.object({\n id: z.number().int(),\n application_id: z.number().nullish(),\n candidate_id: z.number().nullish(),\n job_id: z.number().nullish(),\n status: z.string().nullish(),\n created_at: z.string().nullish(),\n sent_at: z.string().nullish(),\n resolved_at: z.string().nullish(),\n starts_at: z.string().nullish(),\n});\n\nexport const greenhouseResources = defineResources({\n [JOB_ENTITY]: {\n shape: 'entity',\n filterable: [\n { field: 'status', ops: ['eq'], values: ['open', 'closed', 'draft'] },\n ],\n description:\n 'Open, draft, and closed requisitions with department, office, and timestamps for opened / closed transitions.',\n endpoint: 'GET /v1/jobs',\n fields: [\n { name: 'name', description: 'Job title.' },\n {\n name: 'status',\n description: 'Greenhouse job status (open / closed / draft).',\n },\n { name: 'requisitionId', description: 'External requisition id.' },\n {\n name: 'departments',\n description: 'Flat list of department names attached to the job.',\n },\n {\n name: 'offices',\n description: 'Flat list of office names attached to the job.',\n },\n { name: 'openedAt', description: 'When the job was opened (Unix ms).' },\n { name: 'closedAt', description: 'When the job was closed (Unix ms).' },\n { name: 'confidential', description: 'Whether the job is confidential.' },\n ],\n responses: { jobs: z.array(jobSchema) },\n },\n [CANDIDATE_ENTITY]: {\n shape: 'entity',\n filterable: [],\n description:\n 'Candidate records with name, title, company, and the count of attached applications.',\n endpoint: 'GET /v1/candidates',\n fields: [\n { name: 'firstName', description: 'Candidate first name.' },\n { name: 'lastName', description: 'Candidate last name.' },\n { name: 'title', description: 'Candidate current job title.' },\n { name: 'company', description: 'Candidate current company.' },\n {\n name: 'applicationCount',\n description:\n 'Number of applications attached to the candidate. Useful for spotting repeat applicants.',\n },\n {\n name: 'isPrivate',\n description: 'Whether the candidate is marked private.',\n },\n {\n name: 'createdAt',\n description: 'When the candidate was created (Unix ms).',\n },\n {\n name: 'lastActivityAt',\n description: 'Last activity timestamp on the candidate (Unix ms).',\n },\n ],\n responses: { candidates: z.array(candidateSchema) },\n },\n [APPLICATION_ENTITY]: {\n shape: 'entity',\n filterable: [\n {\n field: 'status',\n ops: ['eq'],\n values: ['active', 'converted', 'hired', 'rejected'],\n },\n { field: 'jobId', ops: ['eq'] },\n ],\n description:\n 'Applications with status (active / hired / rejected), current stage, source, and the linked candidate / job.',\n endpoint: 'GET /v1/applications',\n fields: [\n {\n name: 'candidateId',\n description: 'Candidate the application belongs to.',\n },\n {\n name: 'jobId',\n description: 'Primary job the application is attached to.',\n },\n { name: 'jobName', description: 'Primary job name at sync time.' },\n {\n name: 'status',\n description: 'Application status (active / hired / rejected).',\n },\n {\n name: 'currentStage',\n description: 'Name of the current stage (e.g. \"Phone Screen\").',\n },\n {\n name: 'source',\n description:\n 'Public source name where the application originated (e.g. \"LinkedIn\").',\n },\n { name: 'appliedAt', description: 'When the application was submitted.' },\n {\n name: 'rejectedAt',\n description: 'When the application was rejected (null if not).',\n },\n {\n name: 'hiredAt',\n description:\n 'When the application was hired (derived from last_activity_at when status=hired).',\n },\n {\n name: 'lastActivityAt',\n description: 'Last activity timestamp on the application (Unix ms).',\n },\n ],\n responses: { applications: z.array(applicationSchema) },\n },\n [APPLICATION_EVENT]: {\n shape: 'event',\n filterable: [{ field: 'jobId', ops: ['eq'] }],\n description:\n 'Application lifecycle events (applied / hired / rejected) derived from each application timestamps. The scope is cleared and rewritten on every sync (including incremental runs).',\n endpoint: 'GET /v1/applications',\n notes:\n \"Derived from each application's applied_at / rejected_at / last_activity_at fields, not from a separate API call.\",\n fields: [\n {\n name: 'applicationId',\n description: 'Application the event belongs to.',\n },\n { name: 'candidateId', description: 'Candidate id, denormalised.' },\n { name: 'jobId', description: 'Job id, denormalised.' },\n {\n name: 'transition',\n description: '\"applied\", \"hired\", or \"rejected\".',\n },\n {\n name: 'source',\n description: 'Application source name at the time of the event.',\n },\n ],\n responses: { application_events: z.array(applicationSchema) },\n },\n [OFFER_ENTITY]: {\n shape: 'entity',\n filterable: [\n {\n field: 'status',\n ops: ['eq'],\n values: ['unresolved', 'accepted', 'rejected', 'deprecated'],\n },\n ],\n description:\n 'Offers with status (pending / accepted / rejected), linked to their application, candidate, and job.',\n endpoint: 'GET /v1/offers',\n fields: [\n { name: 'applicationId', description: 'Linked application.' },\n { name: 'candidateId', description: 'Linked candidate.' },\n { name: 'jobId', description: 'Linked job.' },\n {\n name: 'status',\n description: 'Offer status (pending / accepted / rejected).',\n },\n { name: 'sentAt', description: 'When the offer was sent (Unix ms).' },\n {\n name: 'resolvedAt',\n description:\n 'When the offer was accepted or rejected (Unix ms; null while pending).',\n },\n {\n name: 'startsAt',\n description: 'Proposed start date on the offer (Unix ms).',\n },\n ],\n responses: { offers: z.array(offerSchema) },\n },\n});\n\nfunction isoToMs(value: string | null | undefined): number | null {\n if (!value) {\n return null;\n }\n const ms = Date.parse(value);\n return Number.isFinite(ms) ? ms : null;\n}\n\nfunction isoToMsOrZero(value: string | null | undefined): number {\n return isoToMs(value) ?? 0;\n}\n\nfunction listNames(\n items: Array<{ name?: string | null }> | null | undefined,\n): string[] {\n if (!items) {\n return [];\n }\n const names: string[] = [];\n for (const item of items) {\n if (item && typeof item.name === 'string' && item.name !== '') {\n names.push(item.name);\n }\n }\n return names;\n}\n\nfunction primaryJobId(app: ApplicationRecord): number | null {\n const first = app.jobs?.[0];\n if (!first || first.id === null || first.id === undefined) {\n return null;\n }\n return first.id;\n}\n\nfunction primaryJobName(app: ApplicationRecord): string | null {\n return app.jobs?.[0]?.name ?? null;\n}\n\nfunction hiredAtMs(app: ApplicationRecord): number | null {\n if (app.status !== 'hired') {\n return null;\n }\n return isoToMs(app.last_activity_at);\n}\n\nfunction pushableEq(\n filter: FilterClause[] | undefined,\n field: string,\n): string | null {\n if (!filter) {\n return null;\n }\n for (const clause of filter) {\n if (\n 'field' in clause &&\n clause.field === field &&\n clause.op === 'eq' &&\n typeof clause.value === 'string'\n ) {\n return clause.value;\n }\n }\n return null;\n}\n\nexport const id = 'greenhouse';\n\nexport class GreenhouseConnector extends BaseConnector<\n GreenhouseSettings,\n GreenhouseCredentials\n> {\n static readonly id = id;\n\n static readonly resources = greenhouseResources;\n\n static readonly schemas = schemasFromResources(greenhouseResources);\n\n static readonly cost = cost;\n\n static create(input: unknown, ctx?: ConnectorContext): GreenhouseConnector {\n const parsed = configFields.parse(input);\n return new GreenhouseConnector(\n { resources: parsed.resources },\n { apiKey: parsed.apiKey },\n ctx,\n );\n }\n\n readonly id = id;\n override readonly credentials = greenhouseCredentials;\n\n private buildHeaders(): Record<string, string> {\n const basic = btoa(`${this.creds.apiKey}:`);\n return {\n Authorization: `Basic ${basic}`,\n Accept: 'application/json',\n 'User-Agent': connectorUserAgent('greenhouse'),\n };\n }\n\n private apiGet<T>(\n url: string,\n resource: string,\n signal?: AbortSignal,\n ): Promise<HttpResponse<T>> {\n return this.get<T>(url, {\n resource,\n headers: this.buildHeaders(),\n signal,\n rateLimit: greenhouseRateLimit,\n });\n }\n\n private allowedPagePath(phase: GreenhousePhase): string {\n switch (phase) {\n case 'jobs':\n return '/v1/jobs';\n case 'candidates':\n return '/v1/candidates';\n case 'applications':\n case 'application_events':\n return '/v1/applications';\n case 'offers':\n return '/v1/offers';\n }\n }\n\n private sanitizePageUrl(\n phase: GreenhousePhase,\n pageUrl: string | null,\n ): string | null {\n return sanitizeAllowedUrl({\n url: pageUrl,\n host: API_HOST,\n pathname: this.allowedPagePath(phase),\n });\n }\n\n private resolveCursor(cursor: unknown): GreenhouseSyncCursor | undefined {\n if (!isGreenhouseSyncCursor(cursor)) {\n return undefined;\n }\n if (cursor.phase === 'application_events') {\n return { phase: cursor.phase, page: null };\n }\n return {\n phase: cursor.phase,\n page: this.sanitizePageUrl(cursor.phase, cursor.page),\n };\n }\n\n private singleSpec(\n options: SyncOptions,\n resource: string,\n ): FetchSpec | undefined {\n const specs = options.fetchSpecs?.[resource];\n return specs && specs.length === 1 ? specs[0] : undefined;\n }\n\n private applyPushdown(\n url: URL,\n phase: GreenhousePhase,\n options: SyncOptions,\n ): void {\n switch (phase) {\n case 'jobs': {\n const status = pushableEq(\n this.singleSpec(options, JOB_ENTITY)?.filter,\n 'status',\n );\n if (status !== null) {\n url.searchParams.set('status', status);\n }\n return;\n }\n case 'applications': {\n const spec = this.singleSpec(options, APPLICATION_ENTITY);\n const status = pushableEq(spec?.filter, 'status');\n if (status !== null) {\n url.searchParams.set('status', status);\n }\n const jobId = pushableEq(spec?.filter, 'jobId');\n if (jobId !== null) {\n url.searchParams.set('job_id', jobId);\n }\n return;\n }\n case 'application_events': {\n const jobId = pushableEq(\n this.singleSpec(options, APPLICATION_EVENT)?.filter,\n 'jobId',\n );\n if (jobId !== null) {\n url.searchParams.set('job_id', jobId);\n }\n return;\n }\n case 'offers': {\n const status = pushableEq(\n this.singleSpec(options, OFFER_ENTITY)?.filter,\n 'status',\n );\n if (status !== null) {\n url.searchParams.set('status', status);\n }\n return;\n }\n case 'candidates':\n return;\n }\n }\n\n private buildInitialUrl(\n phase: GreenhousePhase,\n options: SyncOptions,\n ): string {\n const url = new URL(`${API_BASE}${this.allowedPagePath(phase)}`);\n url.searchParams.set('per_page', String(PER_PAGE));\n if (phase !== 'application_events' && options.since) {\n url.searchParams.set('updated_after', options.since);\n }\n this.applyPushdown(url, phase, options);\n return url.toString();\n }\n\n private async fetchPhasePage(\n phase: GreenhousePhase,\n page: string | null,\n options: SyncOptions,\n signal?: AbortSignal,\n ): Promise<FetchPageResult<string>> {\n const resource =\n phase === 'application_events' ? 'application_events' : phase;\n const url = page ?? this.buildInitialUrl(phase, options);\n const res = await this.apiGet<unknown[]>(url, resource, signal);\n const rawNext = parseLinkHeader(res.headers.get('link'))['next'] ?? null;\n const next = this.sanitizePageUrl(phase, rawNext);\n return { items: res.body ?? [], next };\n }\n\n private async writeJobs(\n storage: StorageHandle,\n items: JobRecord[],\n ): Promise<void> {\n for (const job of items) {\n await storage.entity({\n type: JOB_ENTITY,\n id: String(job.id),\n attributes: {\n name: job.name,\n status: job.status ?? null,\n requisitionId: job.requisition_id ?? null,\n confidential: job.confidential ?? null,\n departments: listNames(job.departments),\n offices: listNames(job.offices),\n openedAt: isoToMs(job.opened_at),\n closedAt: isoToMs(job.closed_at),\n createdAt: isoToMs(job.created_at),\n },\n updated_at: isoToMsOrZero(job.updated_at ?? job.created_at),\n });\n }\n }\n\n private async writeCandidates(\n storage: StorageHandle,\n items: CandidateRecord[],\n ): Promise<void> {\n for (const cand of items) {\n await storage.entity({\n type: CANDIDATE_ENTITY,\n id: String(cand.id),\n attributes: {\n firstName: cand.first_name ?? null,\n lastName: cand.last_name ?? null,\n title: cand.title ?? null,\n company: cand.company ?? null,\n applicationCount: cand.application_ids?.length ?? 0,\n isPrivate: cand.is_private ?? null,\n createdAt: isoToMs(cand.created_at),\n lastActivityAt: isoToMs(cand.last_activity),\n },\n updated_at: isoToMsOrZero(\n cand.updated_at ?? cand.last_activity ?? cand.created_at,\n ),\n });\n }\n }\n\n private async writeApplications(\n storage: StorageHandle,\n items: ApplicationRecord[],\n ): Promise<void> {\n for (const app of items) {\n const attributes: Record<string, JSONValue> = {\n candidateId: String(app.candidate_id),\n jobId: primaryJobId(app) === null ? null : String(primaryJobId(app)),\n jobName: primaryJobName(app),\n status: app.status ?? null,\n currentStage: app.current_stage?.name ?? null,\n source: app.source?.public_name ?? null,\n appliedAt: isoToMs(app.applied_at),\n rejectedAt: isoToMs(app.rejected_at),\n hiredAt: hiredAtMs(app),\n lastActivityAt: isoToMs(app.last_activity_at),\n };\n await storage.entity({\n type: APPLICATION_ENTITY,\n id: String(app.id),\n attributes,\n updated_at: isoToMsOrZero(\n app.last_activity_at ?? app.applied_at ?? app.rejected_at,\n ),\n });\n }\n }\n\n private async writeApplicationEvents(\n storage: StorageHandle,\n items: ApplicationRecord[],\n ): Promise<void> {\n for (const app of items) {\n const base: Record<string, JSONValue> = {\n applicationId: String(app.id),\n candidateId: String(app.candidate_id),\n jobId: primaryJobId(app) === null ? null : String(primaryJobId(app)),\n source: app.source?.public_name ?? null,\n };\n\n const appliedMs = isoToMs(app.applied_at);\n if (appliedMs !== null) {\n await storage.event({\n name: APPLICATION_EVENT,\n start_ts: appliedMs,\n end_ts: null,\n attributes: { ...base, transition: 'applied' },\n });\n }\n\n const rejectedMs = isoToMs(app.rejected_at);\n if (rejectedMs !== null) {\n await storage.event({\n name: APPLICATION_EVENT,\n start_ts: rejectedMs,\n end_ts: null,\n attributes: { ...base, transition: 'rejected' },\n });\n }\n\n const hiredMs = hiredAtMs(app);\n if (hiredMs !== null) {\n await storage.event({\n name: APPLICATION_EVENT,\n start_ts: hiredMs,\n end_ts: null,\n attributes: { ...base, transition: 'hired' },\n });\n }\n }\n }\n\n private async writeOffers(\n storage: StorageHandle,\n items: OfferRecord[],\n ): Promise<void> {\n for (const offer of items) {\n await storage.entity({\n type: OFFER_ENTITY,\n id: String(offer.id),\n attributes: {\n applicationId:\n offer.application_id === null || offer.application_id === undefined\n ? null\n : String(offer.application_id),\n candidateId:\n offer.candidate_id === null || offer.candidate_id === undefined\n ? null\n : String(offer.candidate_id),\n jobId:\n offer.job_id === null || offer.job_id === undefined\n ? null\n : String(offer.job_id),\n status: offer.status ?? null,\n sentAt: isoToMs(offer.sent_at),\n resolvedAt: isoToMs(offer.resolved_at),\n startsAt: isoToMs(offer.starts_at),\n },\n updated_at: isoToMsOrZero(\n offer.resolved_at ?? offer.sent_at ?? offer.created_at,\n ),\n });\n }\n }\n\n private async clearScopeOnFirstPage(\n storage: StorageHandle,\n phase: GreenhousePhase,\n isFull: boolean,\n ): Promise<void> {\n if (phase === 'application_events') {\n await storage.events([], { names: [APPLICATION_EVENT] });\n return;\n }\n if (!isFull) {\n return;\n }\n const entityType = ENTITY_TYPE_BY_PHASE[phase];\n if (entityType) {\n await storage.entities([], { types: [entityType] });\n }\n }\n\n private async writePhase(\n storage: StorageHandle,\n phase: GreenhousePhase,\n items: unknown[],\n ): Promise<void> {\n switch (phase) {\n case 'jobs':\n return this.writeJobs(storage, items as JobRecord[]);\n case 'candidates':\n return this.writeCandidates(storage, items as CandidateRecord[]);\n case 'applications':\n return this.writeApplications(storage, items as ApplicationRecord[]);\n case 'application_events':\n return this.writeApplicationEvents(\n storage,\n items as ApplicationRecord[],\n );\n case 'offers':\n return this.writeOffers(storage, items as OfferRecord[]);\n }\n }\n\n async sync(\n options: SyncOptions,\n storage: StorageHandle,\n signal?: AbortSignal,\n ): Promise<SyncResult> {\n const cursor = this.resolveCursor(options.cursor);\n const isFull = options.mode === 'full';\n\n const phases = selectActivePhases<GreenhouseResource, GreenhousePhase>(\n resourceToPhase,\n PHASE_ORDER,\n this.settings.resources,\n );\n\n return paginateChunked<GreenhousePhase, string>({\n phases,\n cursor,\n signal,\n logger: this.logger,\n fetchPage: async (phase, page, sig) =>\n this.fetchPhasePage(phase, page, options, sig),\n writeBatch: async (phase, items, page) => {\n if (page === null) {\n await this.clearScopeOnFirstPage(storage, phase, isFull);\n }\n await this.writePhase(storage, phase, items);\n },\n });\n }\n}\n\nconst ENTITY_TYPE_BY_PHASE: Partial<Record<GreenhousePhase, string>> = {\n jobs: JOB_ENTITY,\n candidates: CANDIDATE_ENTITY,\n applications: APPLICATION_ENTITY,\n offers: OFFER_ENTITY,\n};\n","import { GreenhouseConnector } from './greenhouse';\n\nexport {\n configFields,\n cost,\n doc,\n GreenhouseConnector,\n greenhouseResources as resources,\n id,\n} from './greenhouse';\nexport type { GreenhouseResource, GreenhouseSettings } from './greenhouse';\nexport default GreenhouseConnector;\n"],"mappings":";AEAO,IAAM,sBAAsB;AAE5B,IAAM,qBAAqB,qBAAqB,mBAAmB;AAEnE,SAAS,mBAAmB,aAA6B;AAC9D,SAAO,qBAAqB,WAAW,IAAI,mBAAmB;AAChE;AEUO,SAAS,wBACd,QACiB;AACjB,QAAM,EAAE,iBAAiB,aAAa,WAAW,gBAAgB,IAAI;AACrE,QAAM,aAAa,cAAc,MAAM,MAAO;AAC9C,SAAO;IACL,MAAM,GAAG;AACP,YAAM,eAAe,EAAE,IAAI,eAAe;AAC1C,UAAI,iBAAiB,QAAQ,aAAa,KAAK,MAAM,IAAI;AACvD,eAAO;MACT;AACA,YAAM,YAAY,OAAO,YAAY;AACrC,UAAI,CAAC,OAAO,SAAS,SAAS,GAAG;AAC/B,eAAO;MACT;AACA,YAAM,WAAW,EAAE,IAAI,WAAW;AAClC,UAAI,aAAa,MAAM;AACrB,YAAI,oBAAoB,QAAW;AACjC,iBAAO;QACT;AACA,eAAO;UACL;UACA,SAAS,IAAI,KAAK,KAAK,IAAI,IAAI,eAAe;QAChD;MACF;AACA,UAAI,SAAS,KA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QACzD;AACA,cAAM,KAAK,WAAW,SAAS,OAAO,KAAK;AAAA,MAC7C;AAAA,IACF,CAAC;AAAA,EACH;AACF;AAEA,IAAM,uBAAiE;AAAA,EACrE,MAAM;AAAA,EACN,YAAY;AAAA,EACZ,cAAc;AAAA,EACd,QAAQ;AACV;;;AC74BA,IAAO,gBAAQ;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rawdash/connector-greenhouse",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.24.0",
|
|
4
4
|
"description": "Rawdash connector for Greenhouse — syncs candidates, applications, jobs, and offers from the Greenhouse Harvest API into the six-shape storage model",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
@@ -24,15 +24,15 @@
|
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"zod": "^4.4.3",
|
|
27
|
-
"@rawdash/core": "0.
|
|
27
|
+
"@rawdash/core": "0.24.0"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
30
|
"fast-check": "^4.8.0",
|
|
31
31
|
"tsup": "^8.0.0",
|
|
32
32
|
"typescript": "^5.7.2",
|
|
33
33
|
"vitest": "^4.1.4",
|
|
34
|
-
"@rawdash/connector-
|
|
35
|
-
"@rawdash/connector-
|
|
34
|
+
"@rawdash/connector-test-utils": "0.0.10",
|
|
35
|
+
"@rawdash/connector-shared": "0.3.1"
|
|
36
36
|
},
|
|
37
37
|
"scripts": {
|
|
38
38
|
"build": "tsup",
|