openings 0.1.63 → 0.1.64
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/package.json +1 -1
- package/src/crawl-reporting.ts +7 -2
- package/src/version.ts +1 -1
package/package.json
CHANGED
package/src/crawl-reporting.ts
CHANGED
|
@@ -27,8 +27,12 @@ export function resolveAggregatorUrl(value: string | undefined): string | undefi
|
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
/** Posts each successfully crawled partition to the aggregator. Only job data is sent, never resume content. */
|
|
30
|
-
export function createCrawlReporter(options: { url: string; fetcher?: Fetch; timeoutMs?: number; attempts?: number; sleep?: (ms: number) => Promise<void> }) {
|
|
30
|
+
export function createCrawlReporter(options: { url: string; fetcher?: Fetch; timeoutMs?: number; attempts?: number; secret?: string; sleep?: (ms: number) => Promise<void> }) {
|
|
31
31
|
const fetcher = options.fetcher ?? globalThis.fetch;
|
|
32
|
+
// Without this the only thing standing between a stranger and an employer's listings is the slug, ats and
|
|
33
|
+
// token triple — all three of which are published in data/companies.json inside the npm tarball. An empty
|
|
34
|
+
// report for a real slug empties that employer from the site and answers 200.
|
|
35
|
+
const secret = options.secret ?? process.env.OPENINGS_INGEST_SECRET;
|
|
32
36
|
const target = endpoint(options.url, "v1/crawls");
|
|
33
37
|
const attempts = Math.max(1, options.attempts ?? 3);
|
|
34
38
|
const sleep = options.sleep ?? ((ms: number) => new Promise<void>((resolve) => setTimeout(resolve, ms)));
|
|
@@ -42,7 +46,8 @@ export function createCrawlReporter(options: { url: string; fetcher?: Fetch; tim
|
|
|
42
46
|
try {
|
|
43
47
|
const response = await fetcher(target, {
|
|
44
48
|
method: "POST",
|
|
45
|
-
headers: { "content-type": "application/json", "content-encoding": "gzip"
|
|
49
|
+
headers: { "content-type": "application/json", "content-encoding": "gzip",
|
|
50
|
+
...(secret ? { authorization: `Bearer ${secret}` } : {}) },
|
|
46
51
|
body,
|
|
47
52
|
// Big employers send tens of megabytes and the aggregator ingests one report at a time; give them room.
|
|
48
53
|
signal: AbortSignal.timeout(options.timeoutMs ?? 120_000),
|
package/src/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = "0.1.
|
|
1
|
+
export const VERSION = "0.1.64";
|