@chrisdothtml/job-scraper 0.0.1
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/LICENSE +21 -0
- package/README.md +71 -0
- package/dist/cache.d.ts +64 -0
- package/dist/cache.d.ts.map +1 -0
- package/dist/cache.js +146 -0
- package/dist/cache.js.map +1 -0
- package/dist/companies.d.ts +89 -0
- package/dist/companies.d.ts.map +1 -0
- package/dist/companies.js +244 -0
- package/dist/companies.js.map +1 -0
- package/dist/companies.seed.d.ts +9 -0
- package/dist/companies.seed.d.ts.map +1 -0
- package/dist/companies.seed.js +455 -0
- package/dist/companies.seed.js.map +1 -0
- package/dist/constants.d.ts +8 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +14 -0
- package/dist/constants.js.map +1 -0
- package/dist/index.d.ts +46 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +69 -0
- package/dist/index.js.map +1 -0
- package/dist/paths.d.ts +16 -0
- package/dist/paths.d.ts.map +1 -0
- package/dist/paths.js +17 -0
- package/dist/paths.js.map +1 -0
- package/dist/platform/browser.d.ts +3 -0
- package/dist/platform/browser.d.ts.map +1 -0
- package/dist/platform/browser.js +103 -0
- package/dist/platform/browser.js.map +1 -0
- package/dist/platform/node.d.ts +3 -0
- package/dist/platform/node.d.ts.map +1 -0
- package/dist/platform/node.js +106 -0
- package/dist/platform/node.js.map +1 -0
- package/dist/platform/types.d.ts +46 -0
- package/dist/platform/types.d.ts.map +1 -0
- package/dist/platform/types.js +2 -0
- package/dist/platform/types.js.map +1 -0
- package/dist/resolve.d.ts +89 -0
- package/dist/resolve.d.ts.map +1 -0
- package/dist/resolve.js +379 -0
- package/dist/resolve.js.map +1 -0
- package/dist/scrapers/AshbyScraper.d.ts +16 -0
- package/dist/scrapers/AshbyScraper.d.ts.map +1 -0
- package/dist/scrapers/AshbyScraper.js +207 -0
- package/dist/scrapers/AshbyScraper.js.map +1 -0
- package/dist/scrapers/GitHubScraper.d.ts +8 -0
- package/dist/scrapers/GitHubScraper.d.ts.map +1 -0
- package/dist/scrapers/GitHubScraper.js +61 -0
- package/dist/scrapers/GitHubScraper.js.map +1 -0
- package/dist/scrapers/GoogleScraper.d.ts +8 -0
- package/dist/scrapers/GoogleScraper.d.ts.map +1 -0
- package/dist/scrapers/GoogleScraper.js +83 -0
- package/dist/scrapers/GoogleScraper.js.map +1 -0
- package/dist/scrapers/GreenhouseScraper.d.ts +28 -0
- package/dist/scrapers/GreenhouseScraper.d.ts.map +1 -0
- package/dist/scrapers/GreenhouseScraper.js +68 -0
- package/dist/scrapers/GreenhouseScraper.js.map +1 -0
- package/dist/scrapers/LeverScraper.d.ts +13 -0
- package/dist/scrapers/LeverScraper.d.ts.map +1 -0
- package/dist/scrapers/LeverScraper.js +58 -0
- package/dist/scrapers/LeverScraper.js.map +1 -0
- package/dist/scrapers/NetflixScraper.d.ts +8 -0
- package/dist/scrapers/NetflixScraper.d.ts.map +1 -0
- package/dist/scrapers/NetflixScraper.js +60 -0
- package/dist/scrapers/NetflixScraper.js.map +1 -0
- package/dist/scrapers/NvidiaScraper.d.ts +8 -0
- package/dist/scrapers/NvidiaScraper.d.ts.map +1 -0
- package/dist/scrapers/NvidiaScraper.js +61 -0
- package/dist/scrapers/NvidiaScraper.js.map +1 -0
- package/dist/scrapers/RipplingScraper.d.ts +10 -0
- package/dist/scrapers/RipplingScraper.d.ts.map +1 -0
- package/dist/scrapers/RipplingScraper.js +64 -0
- package/dist/scrapers/RipplingScraper.js.map +1 -0
- package/dist/scrapers/Scraper.d.ts +134 -0
- package/dist/scrapers/Scraper.d.ts.map +1 -0
- package/dist/scrapers/Scraper.js +224 -0
- package/dist/scrapers/Scraper.js.map +1 -0
- package/dist/scrapers/ShopifyScraper.d.ts +16 -0
- package/dist/scrapers/ShopifyScraper.d.ts.map +1 -0
- package/dist/scrapers/ShopifyScraper.js +104 -0
- package/dist/scrapers/ShopifyScraper.js.map +1 -0
- package/dist/scrapers/SmartRecruitersScraper.d.ts +13 -0
- package/dist/scrapers/SmartRecruitersScraper.d.ts.map +1 -0
- package/dist/scrapers/SmartRecruitersScraper.js +66 -0
- package/dist/scrapers/SmartRecruitersScraper.js.map +1 -0
- package/dist/scrapers/UberScraper.d.ts +14 -0
- package/dist/scrapers/UberScraper.d.ts.map +1 -0
- package/dist/scrapers/UberScraper.js +94 -0
- package/dist/scrapers/UberScraper.js.map +1 -0
- package/dist/scrapers/WorkableScraper.d.ts +12 -0
- package/dist/scrapers/WorkableScraper.d.ts.map +1 -0
- package/dist/scrapers/WorkableScraper.js +67 -0
- package/dist/scrapers/WorkableScraper.js.map +1 -0
- package/dist/scrapers/WorkdayScraper.d.ts +14 -0
- package/dist/scrapers/WorkdayScraper.d.ts.map +1 -0
- package/dist/scrapers/WorkdayScraper.js +85 -0
- package/dist/scrapers/WorkdayScraper.js.map +1 -0
- package/dist/scrapers/index.d.ts +41 -0
- package/dist/scrapers/index.d.ts.map +1 -0
- package/dist/scrapers/index.js +46 -0
- package/dist/scrapers/index.js.map +1 -0
- package/dist/search.d.ts +75 -0
- package/dist/search.d.ts.map +1 -0
- package/dist/search.js +225 -0
- package/dist/search.js.map +1 -0
- package/dist/sniff.d.ts +43 -0
- package/dist/sniff.d.ts.map +1 -0
- package/dist/sniff.js +124 -0
- package/dist/sniff.js.map +1 -0
- package/dist/utils/misc.d.ts +15 -0
- package/dist/utils/misc.d.ts.map +1 -0
- package/dist/utils/misc.js +31 -0
- package/dist/utils/misc.js.map +1 -0
- package/package.json +70 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Chris Deacy
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
# job-scraper
|
|
2
|
+
|
|
3
|
+
> List jobs for 15k+ companies for free. Runs locally; no headless browsers or API tokens.
|
|
4
|
+
|
|
5
|
+
This package provides lightweight, reliable, http-only scrapers for the most popular job board providers. It ships with a small list of pre-mapped companies, but it learns new ones as you look them up.
|
|
6
|
+
|
|
7
|
+
**[Try it live in your browser](https://chrisdothtml.github.io/job-scraper/)**
|
|
8
|
+
|
|
9
|
+
One benefit this package provides (in addition to reliable job board scrapers) is its ability to infer the correct job board for a company from a variety of different input formats (e.g. company name, careers homepage URL, individual job post URL).
|
|
10
|
+
|
|
11
|
+
<details>
|
|
12
|
+
<summary>Where does the 15k+ number come from?</summary>
|
|
13
|
+
|
|
14
|
+
[Bloomberry](https://bloomberry.com/) tracks software adoption by discovering and validating companies using known URL patterns and other public signals.
|
|
15
|
+
|
|
16
|
+
These are its current counts for the job boards this package supports:
|
|
17
|
+
|
|
18
|
+
| Provider | Companies |
|
|
19
|
+
| ----------------------------------------------------------------------- | ---------: |
|
|
20
|
+
| [Greenhouse](https://bloomberry.com/data/greenhouse/) | 4,250 |
|
|
21
|
+
| [Ashby](https://bloomberry.com/data/ashby/) | 3,655 |
|
|
22
|
+
| [Workday Recruiting](https://bloomberry.com/data/workday-recruiting/) | 2,334 |
|
|
23
|
+
| [Lever](https://bloomberry.com/data/lever/) | 1,849 |
|
|
24
|
+
| [SmartRecruiters](https://bloomberry.com/data/smartrecruiters/) | 1,250 |
|
|
25
|
+
| [Rippling Recruiting](https://bloomberry.com/data/rippling-recruiting/) | 851 |
|
|
26
|
+
| [Workable](https://bloomberry.com/data/workable/) | 844 |
|
|
27
|
+
| **Total** | **15,033** |
|
|
28
|
+
|
|
29
|
+
</details>
|
|
30
|
+
|
|
31
|
+
## Install
|
|
32
|
+
|
|
33
|
+
```sh
|
|
34
|
+
yarn add @chrisdothtml/job-scraper
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
No runtime dependencies. Requires Node 22+, or a bundler for browsers (where only some boards are reachable).
|
|
38
|
+
|
|
39
|
+
## Usage
|
|
40
|
+
|
|
41
|
+
**List company jobs**
|
|
42
|
+
|
|
43
|
+
```ts
|
|
44
|
+
import { listCompanyJobs } from '@chrisdothtml/job-scraper';
|
|
45
|
+
|
|
46
|
+
// works by name alone, across whichever board the company happens to use
|
|
47
|
+
await listCompanyJobs('Airbnb'); // Greenhouse
|
|
48
|
+
await listCompanyJobs('Klaviyo'); // also Greenhouse, but you didn't need to know that
|
|
49
|
+
await listCompanyJobs('Whatnot'); // Workday, found via search
|
|
50
|
+
|
|
51
|
+
// or by any URL a person would actually paste: a board link, or the
|
|
52
|
+
// company's own careers page with a board embedded in it
|
|
53
|
+
await listCompanyJobs('https://jobs.ashbyhq.com/zapier');
|
|
54
|
+
await listCompanyJobs(
|
|
55
|
+
'https://careers.airbnb.com/positions/8184174?gh_jid=8184174'
|
|
56
|
+
);
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
**Fetch a single job**
|
|
60
|
+
|
|
61
|
+
```ts
|
|
62
|
+
import { fetchJob } from '@chrisdothtml/job-scraper';
|
|
63
|
+
|
|
64
|
+
await fetchJob('https://job-boards.greenhouse.io/airbnb/jobs/7712345');
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
See the [docs](https://chrisdothtml.github.io/job-scraper/) for the full API, recipes, how resolution works, caching, and configuration.
|
|
68
|
+
|
|
69
|
+
## License
|
|
70
|
+
|
|
71
|
+
[MIT](./LICENSE)
|
package/dist/cache.d.ts
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/** Thrown when a board answers with a non-2xx status */
|
|
2
|
+
export declare class HttpError extends Error {
|
|
3
|
+
status: number;
|
|
4
|
+
statusText: string;
|
|
5
|
+
url: string;
|
|
6
|
+
constructor(status: number, statusText: string, url: string);
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Thrown in browsers when a request fails before any response arrives, which
|
|
10
|
+
* is what a board refusing cross-origin requests looks like to page script
|
|
11
|
+
* (a plain network failure looks identical). Never thrown under Node, which
|
|
12
|
+
* doesn't enforce CORS.
|
|
13
|
+
*/
|
|
14
|
+
export declare class CorsError extends Error {
|
|
15
|
+
url: string;
|
|
16
|
+
constructor(url: string, options?: ErrorOptions);
|
|
17
|
+
}
|
|
18
|
+
export interface CacheConfig {
|
|
19
|
+
/**
|
|
20
|
+
* Turns response caching off entirely. Scrapers that opt out per-call (during
|
|
21
|
+
* tests, say) stay opted out regardless: this can disable caching, never
|
|
22
|
+
* force it on.
|
|
23
|
+
*/
|
|
24
|
+
enabled: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* How long a cached response stays fresh, in milliseconds. Overrides the
|
|
27
|
+
* TTL each scraper picks for itself; leave it unset to keep those.
|
|
28
|
+
*/
|
|
29
|
+
ttl: number | null;
|
|
30
|
+
/**
|
|
31
|
+
* Where response bodies are written. Defaults to `~/.job-scraper/cache`.
|
|
32
|
+
* In browsers, this names the Cache API cache instead
|
|
33
|
+
*/
|
|
34
|
+
dir: string;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Overrides caching for this process. Anything left out falls back to the
|
|
38
|
+
* environment (`JOB_SCRAPER_CACHE`, `JOB_SCRAPER_CACHE_TTL`; Node only), then
|
|
39
|
+
* defaults.
|
|
40
|
+
* Passing `undefined` for a key drops the override, restoring that fallback.
|
|
41
|
+
*
|
|
42
|
+
* @example
|
|
43
|
+
* configureCache({ enabled: false }); // always hit the network
|
|
44
|
+
* configureCache({ ttl: time.hour }); // fresher than the default day
|
|
45
|
+
* configureCache({ ttl: undefined }); // back to whatever each scraper asks
|
|
46
|
+
*/
|
|
47
|
+
export declare function configureCache(config: Partial<CacheConfig>): void;
|
|
48
|
+
export declare function getCacheConfig(): CacheConfig;
|
|
49
|
+
/** Deletes every cached response. Returns how many were removed */
|
|
50
|
+
export declare function clearCache(): Promise<number>;
|
|
51
|
+
interface CacheContext {
|
|
52
|
+
cache?: boolean;
|
|
53
|
+
cacheTTL?: number;
|
|
54
|
+
}
|
|
55
|
+
type Fetch = typeof fetch;
|
|
56
|
+
export declare function cachedFetch(this: CacheContext | void, ...args: Parameters<Fetch>): ReturnType<Fetch>;
|
|
57
|
+
/**
|
|
58
|
+
* `fetch`, except that in browsers a request that never got a response
|
|
59
|
+
* becomes a `CorsError`. Everything that goes over the network should come
|
|
60
|
+
* through here, so a blocked board is always told apart from a missing one.
|
|
61
|
+
*/
|
|
62
|
+
export declare function corsAwareFetch(...args: Parameters<Fetch>): ReturnType<Fetch>;
|
|
63
|
+
export {};
|
|
64
|
+
//# sourceMappingURL=cache.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cache.d.ts","sourceRoot":"","sources":["../src/cache.ts"],"names":[],"mappings":"AAiBA,wDAAwD;AACxD,qBAAa,SAAU,SAAQ,KAAK;IAEzB,MAAM,EAAE,MAAM;IACd,UAAU,EAAE,MAAM;IAClB,GAAG,EAAE,MAAM;gBAFX,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,MAAM,EAClB,GAAG,EAAE,MAAM;CAKrB;AAED;;;;;GAKG;AACH,qBAAa,SAAU,SAAQ,KAAK;IAEzB,GAAG,EAAE,MAAM;gBAAX,GAAG,EAAE,MAAM,EAClB,OAAO,CAAC,EAAE,YAAY;CASzB;AAED,MAAM,WAAW,WAAW;IAC1B;;;;OAIG;IACH,OAAO,EAAE,OAAO,CAAC;IACjB;;;OAGG;IACH,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IACnB;;;OAGG;IACH,GAAG,EAAE,MAAM,CAAC;CACb;AAUD;;;;;;;;;;GAUG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,OAAO,CAAC,WAAW,CAAC,GAAG,IAAI,CAEjE;AAED,wBAAgB,cAAc,IAAI,WAAW,CAY5C;AAED,mEAAmE;AACnE,wBAAsB,UAAU,IAAI,OAAO,CAAC,MAAM,CAAC,CAElD;AAED,UAAU,YAAY;IACpB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,KAAK,KAAK,GAAG,OAAO,KAAK,CAAC;AAE1B,wBAAsB,WAAW,CAC/B,IAAI,EAAE,YAAY,GAAG,IAAI,EACzB,GAAG,IAAI,EAAE,UAAU,CAAC,KAAK,CAAC,GACzB,UAAU,CAAC,KAAK,CAAC,CAmCnB;AAED;;;;GAIG;AACH,wBAAsB,cAAc,CAClC,GAAG,IAAI,EAAE,UAAU,CAAC,KAAK,CAAC,GACzB,UAAU,CAAC,KAAK,CAAC,CAenB"}
|
package/dist/cache.js
ADDED
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import { platform } from '#platform';
|
|
2
|
+
import { cacheDir as defaultCacheDir } from "./paths.js";
|
|
3
|
+
import { applyOverrides, time } from "./utils/misc.js";
|
|
4
|
+
function serializeArgs(args) {
|
|
5
|
+
const [url, init] = args;
|
|
6
|
+
return JSON.stringify({
|
|
7
|
+
url,
|
|
8
|
+
init: init && {
|
|
9
|
+
...init,
|
|
10
|
+
headers: init.headers
|
|
11
|
+
? Array.from(new Headers(init.headers).entries())
|
|
12
|
+
: undefined,
|
|
13
|
+
},
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
/** Thrown when a board answers with a non-2xx status */
|
|
17
|
+
export class HttpError extends Error {
|
|
18
|
+
status;
|
|
19
|
+
statusText;
|
|
20
|
+
url;
|
|
21
|
+
constructor(status, statusText, url) {
|
|
22
|
+
super(`${status} ${statusText} — ${url}`);
|
|
23
|
+
this.status = status;
|
|
24
|
+
this.statusText = statusText;
|
|
25
|
+
this.url = url;
|
|
26
|
+
this.name = 'HttpError';
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Thrown in browsers when a request fails before any response arrives, which
|
|
31
|
+
* is what a board refusing cross-origin requests looks like to page script
|
|
32
|
+
* (a plain network failure looks identical). Never thrown under Node, which
|
|
33
|
+
* doesn't enforce CORS.
|
|
34
|
+
*/
|
|
35
|
+
export class CorsError extends Error {
|
|
36
|
+
url;
|
|
37
|
+
constructor(url, options) {
|
|
38
|
+
super(`Request to ${url} was blocked, most likely by its CORS policy. ` +
|
|
39
|
+
`It should work from Node, which doesn't enforce CORS`, options);
|
|
40
|
+
this.url = url;
|
|
41
|
+
this.name = 'CorsError';
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
const CACHE_DEFAULTS = {
|
|
45
|
+
enabled: true,
|
|
46
|
+
ttl: null,
|
|
47
|
+
dir: defaultCacheDir,
|
|
48
|
+
};
|
|
49
|
+
let overrides = {};
|
|
50
|
+
/**
|
|
51
|
+
* Overrides caching for this process. Anything left out falls back to the
|
|
52
|
+
* environment (`JOB_SCRAPER_CACHE`, `JOB_SCRAPER_CACHE_TTL`; Node only), then
|
|
53
|
+
* defaults.
|
|
54
|
+
* Passing `undefined` for a key drops the override, restoring that fallback.
|
|
55
|
+
*
|
|
56
|
+
* @example
|
|
57
|
+
* configureCache({ enabled: false }); // always hit the network
|
|
58
|
+
* configureCache({ ttl: time.hour }); // fresher than the default day
|
|
59
|
+
* configureCache({ ttl: undefined }); // back to whatever each scraper asks
|
|
60
|
+
*/
|
|
61
|
+
export function configureCache(config) {
|
|
62
|
+
overrides = applyOverrides(overrides, config);
|
|
63
|
+
}
|
|
64
|
+
export function getCacheConfig() {
|
|
65
|
+
const ttl = Number(platform.env('JOB_SCRAPER_CACHE_TTL'));
|
|
66
|
+
const disabled = /^(0|false|off|no)$/i.test(platform.env('JOB_SCRAPER_CACHE') ?? '');
|
|
67
|
+
return {
|
|
68
|
+
...CACHE_DEFAULTS,
|
|
69
|
+
...(disabled ? { enabled: false } : {}),
|
|
70
|
+
...(Number.isFinite(ttl) && ttl >= 0 ? { ttl } : {}),
|
|
71
|
+
...overrides,
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
/** Deletes every cached response. Returns how many were removed */
|
|
75
|
+
export async function clearCache() {
|
|
76
|
+
return platform.responseCache.clear(getCacheConfig().dir);
|
|
77
|
+
}
|
|
78
|
+
// FIXME: implement rate limit header/status-code detection
|
|
79
|
+
export async function cachedFetch(...args) {
|
|
80
|
+
const { cache: callerWantsCache = true, cacheTTL } = this ?? {};
|
|
81
|
+
const config = getCacheConfig();
|
|
82
|
+
// a caller that opted out stays opted out; config can only disable
|
|
83
|
+
const cache = callerWantsCache && config.enabled;
|
|
84
|
+
// an explicit config TTL wins over whatever the scraper asked for
|
|
85
|
+
const ttl = config.ttl ?? cacheTTL ?? time.day;
|
|
86
|
+
if (!cache)
|
|
87
|
+
return assertOk(await corsAwareFetch(...args), args);
|
|
88
|
+
const key = serializeArgs(args);
|
|
89
|
+
const hit = await platform.responseCache.get(config.dir, key, ttl);
|
|
90
|
+
if (hit)
|
|
91
|
+
return hit;
|
|
92
|
+
const res = await corsAwareFetch(...args);
|
|
93
|
+
const body = await res.arrayBuffer();
|
|
94
|
+
if (res.ok) {
|
|
95
|
+
await platform.responseCache.put(config.dir, key, {
|
|
96
|
+
status: res.status,
|
|
97
|
+
statusText: res.statusText,
|
|
98
|
+
headers: Array.from(res.headers.entries()),
|
|
99
|
+
body,
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
return assertOk(new Response(body, {
|
|
103
|
+
status: res.status,
|
|
104
|
+
statusText: res.statusText,
|
|
105
|
+
headers: res.headers,
|
|
106
|
+
}), args);
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* `fetch`, except that in browsers a request that never got a response
|
|
110
|
+
* becomes a `CorsError`. Everything that goes over the network should come
|
|
111
|
+
* through here, so a blocked board is always told apart from a missing one.
|
|
112
|
+
*/
|
|
113
|
+
export async function corsAwareFetch(...args) {
|
|
114
|
+
try {
|
|
115
|
+
return await fetch(...args);
|
|
116
|
+
}
|
|
117
|
+
catch (err) {
|
|
118
|
+
const url = requestUrl(args[0]);
|
|
119
|
+
// an unparseable URL is a TypeError too, but a caller's bug, not a block
|
|
120
|
+
if (platform.enforcesCors &&
|
|
121
|
+
err instanceof TypeError &&
|
|
122
|
+
URL.canParse(url)) {
|
|
123
|
+
throw new CorsError(url, { cause: err });
|
|
124
|
+
}
|
|
125
|
+
throw err;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
function requestUrl(input) {
|
|
129
|
+
return typeof input === 'string'
|
|
130
|
+
? input
|
|
131
|
+
: input instanceof URL
|
|
132
|
+
? input.href
|
|
133
|
+
: input.url;
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Boards signal a missing board or posting with a status code and an error
|
|
137
|
+
* body that would otherwise be handed back as if it were job content, so a
|
|
138
|
+
* failed response has to become an exception here rather than downstream.
|
|
139
|
+
*/
|
|
140
|
+
function assertOk(res, args) {
|
|
141
|
+
if (!res.ok) {
|
|
142
|
+
throw new HttpError(res.status, res.statusText, requestUrl(args[0]));
|
|
143
|
+
}
|
|
144
|
+
return res;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AK,UAAU,cAAc,CAClC,GAAG,IAAuB;IAE1B,IAAI,CAAC;QACH,OAAO,MAAM,KAAK,CAAC,GAAG,IAAI,CAAC,CAAC;IAC9B,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,MAAM,GAAG,GAAG,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;QAChC,yEAAyE;QACzE,IACE,QAAQ,CAAC,YAAY;YACrB,GAAG,YAAY,SAAS;YACxB,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,EACjB,CAAC;YACD,MAAM,IAAI,SAAS,CAAC,GAAG,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,CAAC;QAC3C,CAAC;QACD,MAAM,GAAG,CAAC;IACZ,CAAC;AACH,CAAC;AAED,SAAS,UAAU,CAAC,KAA2B;IAC7C,OAAO,OAAO,KAAK,KAAK,QAAQ;QAC9B,CAAC,CAAC,KAAK;QACP,CAAC,CAAC,KAAK,YAAY,GAAG;YACpB,CAAC,CAAC,KAAK,CAAC,IAAI;YACZ,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC;AAClB,CAAC;AAED;;;;GAIG;AACH,SAAS,QAAQ,CAAC,GAAa,EAAE,IAAuB;IACtD,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC;QACZ,MAAM,IAAI,SAAS,CAAC,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,UAAU,EAAE,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACvE,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC"}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { type ScraperName } from './scrapers/index.ts';
|
|
2
|
+
export interface Company {
|
|
3
|
+
/** Display name, as a human would write it */
|
|
4
|
+
name: string;
|
|
5
|
+
/** Which scraper serves this company's board */
|
|
6
|
+
scraper: ScraperName;
|
|
7
|
+
/** The board slug, as the scraper's constructor takes it */
|
|
8
|
+
slug: string;
|
|
9
|
+
/**
|
|
10
|
+
* Hostnames this company posts jobs on that aren't the board's own, e.g.
|
|
11
|
+
* `pinterestcareers.com`. A URL on one of these resolves to this company
|
|
12
|
+
* directly, skipping discovery entirely.
|
|
13
|
+
*/
|
|
14
|
+
domains?: string[];
|
|
15
|
+
}
|
|
16
|
+
export interface StoredCompany extends Company {
|
|
17
|
+
/**
|
|
18
|
+
* `seed` came with the package; `discovered` was resolved on this machine.
|
|
19
|
+
* The distinction is what lets an upgrade refresh the shipped list without
|
|
20
|
+
* discarding what the user found themselves.
|
|
21
|
+
*/
|
|
22
|
+
source: 'seed' | 'discovered';
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Reduces a company name to a stable lookup key, so that "Apollo.io",
|
|
26
|
+
* "apollo io" and "Apollo.io, Inc." all land on the same record.
|
|
27
|
+
*/
|
|
28
|
+
export declare function normalizeCompanyName(input: string): string;
|
|
29
|
+
/**
|
|
30
|
+
* Whether a board slug plausibly belongs to a company. Slugs aren't exactly
|
|
31
|
+
* the company name (`Anduril` posts under `andurilindustries`, and Workday
|
|
32
|
+
* buries it in `whatnot.wd1.Whatnot`), so this asks whether one contains the
|
|
33
|
+
* other rather than for an exact match.
|
|
34
|
+
*/
|
|
35
|
+
export declare function slugMatchesCompany(slug: string, companyName: string): boolean;
|
|
36
|
+
/**
|
|
37
|
+
* Reduces a hostname to the form the domain index is keyed on: lowercased,
|
|
38
|
+
* without a port, and without a leading `www.`.
|
|
39
|
+
*/
|
|
40
|
+
export declare function normalizeDomain(input: string): string;
|
|
41
|
+
/**
|
|
42
|
+
* Whether a hostname belongs to a job board rather than to one company.
|
|
43
|
+
* Board hosts are matched by suffix, since boards use per-tenant subdomains
|
|
44
|
+
* (`acme.wd1.myworkdayjobs.com`).
|
|
45
|
+
*/
|
|
46
|
+
export declare function isBoardDomain(hostname: string): boolean;
|
|
47
|
+
/**
|
|
48
|
+
* Loads the company registry, seeding it from the bundled list on first run.
|
|
49
|
+
*
|
|
50
|
+
* The stored file records which package version it was last reconciled
|
|
51
|
+
* against. While that matches, loading is just a parse, with no comparison
|
|
52
|
+
* work on the common path. When it doesn't, the shipped list and the user's own
|
|
53
|
+
* discoveries are merged (see `mergeRegistry`) and the result written back.
|
|
54
|
+
*/
|
|
55
|
+
export declare function loadCompanies(): Promise<Map<string, StoredCompany>>;
|
|
56
|
+
/**
|
|
57
|
+
* Reconciles a stored registry against the list this version ships with.
|
|
58
|
+
*
|
|
59
|
+
* The shipped list wins for anything it covers: it's curated, and a newer
|
|
60
|
+
* release may have corrected a slug. Everything the user discovered on their
|
|
61
|
+
* own is carried over untouched, unless the shipped list has since picked
|
|
62
|
+
* that company up. Stale `seed` entries are dropped, since their absence
|
|
63
|
+
* from the new list is deliberate.
|
|
64
|
+
*/
|
|
65
|
+
export declare function mergeRegistry(stored: StoredCompany[]): StoredCompany[];
|
|
66
|
+
/** Every known company, sorted by display name */
|
|
67
|
+
export declare function listCompanies(): Promise<StoredCompany[]>;
|
|
68
|
+
/** Looks a company up by name (or by the key `normalizeCompanyName` returns) */
|
|
69
|
+
export declare function findCompany(name: string): Promise<StoredCompany | null>;
|
|
70
|
+
/**
|
|
71
|
+
* Adds a company to the registry and persists it, so the next lookup skips
|
|
72
|
+
* discovery entirely. Re-registering an existing company replaces it.
|
|
73
|
+
*/
|
|
74
|
+
export declare function registerCompany(company: Company, source?: StoredCompany['source']): Promise<StoredCompany>;
|
|
75
|
+
/** Drops the in-memory registry, so the next load re-reads it from storage */
|
|
76
|
+
export declare function clearCompaniesCache(): void;
|
|
77
|
+
/**
|
|
78
|
+
* Looks a company up by a hostname it posts jobs on. Subdomains resolve to a
|
|
79
|
+
* registered parent (`jobs.acme.com` finds `acme.com`), so a company only has
|
|
80
|
+
* to be seen on a domain once however it was linked.
|
|
81
|
+
*/
|
|
82
|
+
export declare function findCompanyByDomain(hostname: string): Promise<StoredCompany | null>;
|
|
83
|
+
/**
|
|
84
|
+
* Records a hostname as one a company posts on, so the next URL on it
|
|
85
|
+
* resolves without probing. Shared board hosts are refused: claiming
|
|
86
|
+
* `boards.greenhouse.io` would point every Greenhouse job at one company.
|
|
87
|
+
*/
|
|
88
|
+
export declare function addCompanyDomain(name: string, hostname: string): Promise<StoredCompany | null>;
|
|
89
|
+
//# sourceMappingURL=companies.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"companies.d.ts","sourceRoot":"","sources":["../src/companies.ts"],"names":[],"mappings":"AAIA,OAAO,EAIL,KAAK,WAAW,EACjB,MAAM,qBAAqB,CAAC;AAE7B,MAAM,WAAW,OAAO;IACtB,8CAA8C;IAC9C,IAAI,EAAE,MAAM,CAAC;IACb,gDAAgD;IAChD,OAAO,EAAE,WAAW,CAAC;IACrB,4DAA4D;IAC5D,IAAI,EAAE,MAAM,CAAC;IACb;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;CACpB;AAED,MAAM,WAAW,aAAc,SAAQ,OAAO;IAC5C;;;;OAIG;IACH,MAAM,EAAE,MAAM,GAAG,YAAY,CAAC;CAC/B;AAYD;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAW1D;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,CAK7E;AAWD;;;GAGG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAOrD;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAMvD;AAED;;;;;;;GAOG;AACH,wBAAsB,aAAa,IAAI,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC,CAsBzE;AAED;;;;;;;;GAQG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,aAAa,EAAE,GAAG,aAAa,EAAE,CA0BtE;AAED,kDAAkD;AAClD,wBAAsB,aAAa,IAAI,OAAO,CAAC,aAAa,EAAE,CAAC,CAG9D;AAED,gFAAgF;AAChF,wBAAsB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC,CAG7E;AAED;;;GAGG;AACH,wBAAsB,eAAe,CACnC,OAAO,EAAE,OAAO,EAChB,MAAM,GAAE,aAAa,CAAC,QAAQ,CAAgB,GAC7C,OAAO,CAAC,aAAa,CAAC,CAWxB;AAED,8EAA8E;AAC9E,wBAAgB,mBAAmB,IAAI,IAAI,CAG1C;AAED;;;;GAIG;AACH,wBAAsB,mBAAmB,CACvC,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC,CAc/B;AAED;;;;GAIG;AACH,wBAAsB,gBAAgB,CACpC,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC,CAc/B"}
|
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
import { platform } from '#platform';
|
|
2
|
+
import { seedCompanies } from "./companies.seed.js";
|
|
3
|
+
import { pkgVersion } from "./constants.js";
|
|
4
|
+
import { companiesFile } from "./paths.js";
|
|
5
|
+
import { isScraperName, scraperNames, scrapers, } from "./scrapers/index.js";
|
|
6
|
+
// trailing legal suffixes carry no identity and are written inconsistently
|
|
7
|
+
const LEGAL_SUFFIXES = /\b(inc|incorporated|llc|ltd|limited|corp|corporation|co|company|gmbh|plc|sa|ag|nv|bv|pty|holdings|group|labs?|technologies|the)\b/g;
|
|
8
|
+
/**
|
|
9
|
+
* Reduces a company name to a stable lookup key, so that "Apollo.io",
|
|
10
|
+
* "apollo io" and "Apollo.io, Inc." all land on the same record.
|
|
11
|
+
*/
|
|
12
|
+
export function normalizeCompanyName(input) {
|
|
13
|
+
const key = input
|
|
14
|
+
.normalize('NFKD')
|
|
15
|
+
.replace(/[̀-ͯ]/g, '')
|
|
16
|
+
.toLowerCase()
|
|
17
|
+
.replace(/[^a-z0-9]+/g, ' ')
|
|
18
|
+
.replace(LEGAL_SUFFIXES, ' ')
|
|
19
|
+
.replace(/[^a-z0-9]+/g, '');
|
|
20
|
+
// a name made up entirely of suffix words (e.g. "The Co") still needs a key
|
|
21
|
+
return key || input.toLowerCase().replace(/[^a-z0-9]+/g, '');
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Whether a board slug plausibly belongs to a company. Slugs aren't exactly
|
|
25
|
+
* the company name (`Anduril` posts under `andurilindustries`, and Workday
|
|
26
|
+
* buries it in `whatnot.wd1.Whatnot`), so this asks whether one contains the
|
|
27
|
+
* other rather than for an exact match.
|
|
28
|
+
*/
|
|
29
|
+
export function slugMatchesCompany(slug, companyName) {
|
|
30
|
+
const a = normalizeCompanyName(slug);
|
|
31
|
+
const b = normalizeCompanyName(companyName);
|
|
32
|
+
if (!a || !b)
|
|
33
|
+
return false;
|
|
34
|
+
return a.includes(b) || b.includes(a);
|
|
35
|
+
}
|
|
36
|
+
let cache = null;
|
|
37
|
+
let domainIndex = null;
|
|
38
|
+
// hostnames every board answers on; a company must never claim one of these
|
|
39
|
+
// or a single entry would swallow every other company on that board
|
|
40
|
+
const boardHostnames = new Set(scraperNames.flatMap((name) => [...scrapers[name].boardDomains]));
|
|
41
|
+
/**
|
|
42
|
+
* Reduces a hostname to the form the domain index is keyed on: lowercased,
|
|
43
|
+
* without a port, and without a leading `www.`.
|
|
44
|
+
*/
|
|
45
|
+
export function normalizeDomain(input) {
|
|
46
|
+
const host = (URL.parse(input)?.hostname ?? input)
|
|
47
|
+
.toLowerCase()
|
|
48
|
+
.replace(/^\.+|\.+$/g, '')
|
|
49
|
+
.replace(/:\d+$/, '');
|
|
50
|
+
return host.startsWith('www.') ? host.slice(4) : host;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Whether a hostname belongs to a job board rather than to one company.
|
|
54
|
+
* Board hosts are matched by suffix, since boards use per-tenant subdomains
|
|
55
|
+
* (`acme.wd1.myworkdayjobs.com`).
|
|
56
|
+
*/
|
|
57
|
+
export function isBoardDomain(hostname) {
|
|
58
|
+
const host = normalizeDomain(hostname);
|
|
59
|
+
for (const domain of boardHostnames) {
|
|
60
|
+
if (host === domain || host.endsWith(`.${domain}`))
|
|
61
|
+
return true;
|
|
62
|
+
}
|
|
63
|
+
return false;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Loads the company registry, seeding it from the bundled list on first run.
|
|
67
|
+
*
|
|
68
|
+
* The stored file records which package version it was last reconciled
|
|
69
|
+
* against. While that matches, loading is just a parse, with no comparison
|
|
70
|
+
* work on the common path. When it doesn't, the shipped list and the user's own
|
|
71
|
+
* discoveries are merged (see `mergeRegistry`) and the result written back.
|
|
72
|
+
*/
|
|
73
|
+
export async function loadCompanies() {
|
|
74
|
+
if (cache)
|
|
75
|
+
return cache;
|
|
76
|
+
const stored = await readRegistry();
|
|
77
|
+
const companies = stored && stored.version === pkgVersion
|
|
78
|
+
? stored.companies
|
|
79
|
+
: mergeRegistry(stored?.companies ?? []);
|
|
80
|
+
cache = new Map();
|
|
81
|
+
domainIndex = new Map();
|
|
82
|
+
for (const entry of companies) {
|
|
83
|
+
if (!isStoredCompany(entry))
|
|
84
|
+
continue;
|
|
85
|
+
cache.set(normalizeCompanyName(entry.name), entry);
|
|
86
|
+
indexDomains(entry);
|
|
87
|
+
}
|
|
88
|
+
if (!stored || stored.version !== pkgVersion) {
|
|
89
|
+
await writeRegistry([...cache.values()]);
|
|
90
|
+
}
|
|
91
|
+
return cache;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Reconciles a stored registry against the list this version ships with.
|
|
95
|
+
*
|
|
96
|
+
* The shipped list wins for anything it covers: it's curated, and a newer
|
|
97
|
+
* release may have corrected a slug. Everything the user discovered on their
|
|
98
|
+
* own is carried over untouched, unless the shipped list has since picked
|
|
99
|
+
* that company up. Stale `seed` entries are dropped, since their absence
|
|
100
|
+
* from the new list is deliberate.
|
|
101
|
+
*/
|
|
102
|
+
export function mergeRegistry(stored) {
|
|
103
|
+
const merged = new Map();
|
|
104
|
+
for (const company of seedCompanies) {
|
|
105
|
+
merged.set(normalizeCompanyName(company.name), {
|
|
106
|
+
...company,
|
|
107
|
+
source: 'seed',
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
for (const company of stored) {
|
|
111
|
+
const key = normalizeCompanyName(company.name);
|
|
112
|
+
const shipped = merged.get(key);
|
|
113
|
+
if (!shipped) {
|
|
114
|
+
if (company.source === 'discovered')
|
|
115
|
+
merged.set(key, company);
|
|
116
|
+
continue;
|
|
117
|
+
}
|
|
118
|
+
// the shipped record wins on scraper and slug, but domains are additive:
|
|
119
|
+
// one the user saw this company on is still true after an upgrade
|
|
120
|
+
const domains = union(shipped.domains, company.domains);
|
|
121
|
+
if (domains.length)
|
|
122
|
+
shipped.domains = domains;
|
|
123
|
+
}
|
|
124
|
+
return [...merged.values()];
|
|
125
|
+
}
|
|
126
|
+
/** Every known company, sorted by display name */
|
|
127
|
+
export async function listCompanies() {
|
|
128
|
+
const companies = await loadCompanies();
|
|
129
|
+
return [...companies.values()].sort((a, b) => a.name.localeCompare(b.name));
|
|
130
|
+
}
|
|
131
|
+
/** Looks a company up by name (or by the key `normalizeCompanyName` returns) */
|
|
132
|
+
export async function findCompany(name) {
|
|
133
|
+
const companies = await loadCompanies();
|
|
134
|
+
return companies.get(normalizeCompanyName(name)) ?? null;
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Adds a company to the registry and persists it, so the next lookup skips
|
|
138
|
+
* discovery entirely. Re-registering an existing company replaces it.
|
|
139
|
+
*/
|
|
140
|
+
export async function registerCompany(company, source = 'discovered') {
|
|
141
|
+
const entry = { ...company, source };
|
|
142
|
+
if (!isStoredCompany(entry)) {
|
|
143
|
+
throw new Error(`Invalid company entry: ${JSON.stringify(company)}`);
|
|
144
|
+
}
|
|
145
|
+
const companies = await loadCompanies();
|
|
146
|
+
companies.set(normalizeCompanyName(entry.name), entry);
|
|
147
|
+
indexDomains(entry);
|
|
148
|
+
await writeRegistry([...companies.values()]);
|
|
149
|
+
return entry;
|
|
150
|
+
}
|
|
151
|
+
/** Drops the in-memory registry, so the next load re-reads it from storage */
|
|
152
|
+
export function clearCompaniesCache() {
|
|
153
|
+
cache = null;
|
|
154
|
+
domainIndex = null;
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Looks a company up by a hostname it posts jobs on. Subdomains resolve to a
|
|
158
|
+
* registered parent (`jobs.acme.com` finds `acme.com`), so a company only has
|
|
159
|
+
* to be seen on a domain once however it was linked.
|
|
160
|
+
*/
|
|
161
|
+
export async function findCompanyByDomain(hostname) {
|
|
162
|
+
await loadCompanies();
|
|
163
|
+
const host = normalizeDomain(hostname);
|
|
164
|
+
if (!host || isBoardDomain(host))
|
|
165
|
+
return null;
|
|
166
|
+
const labels = host.split('.');
|
|
167
|
+
// walk up the subdomains, most specific first
|
|
168
|
+
for (let i = 0; i < labels.length - 1; i++) {
|
|
169
|
+
const found = domainIndex.get(labels.slice(i).join('.'));
|
|
170
|
+
if (found)
|
|
171
|
+
return found;
|
|
172
|
+
}
|
|
173
|
+
return null;
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* Records a hostname as one a company posts on, so the next URL on it
|
|
177
|
+
* resolves without probing. Shared board hosts are refused: claiming
|
|
178
|
+
* `boards.greenhouse.io` would point every Greenhouse job at one company.
|
|
179
|
+
*/
|
|
180
|
+
export async function addCompanyDomain(name, hostname) {
|
|
181
|
+
const host = normalizeDomain(hostname);
|
|
182
|
+
if (!host || !host.includes('.') || isBoardDomain(host))
|
|
183
|
+
return null;
|
|
184
|
+
const company = await findCompany(name);
|
|
185
|
+
if (!company || company.domains?.includes(host))
|
|
186
|
+
return company;
|
|
187
|
+
// a domain already spoken for stays with whoever claimed it first
|
|
188
|
+
if (domainIndex.has(host))
|
|
189
|
+
return company;
|
|
190
|
+
company.domains = [...(company.domains ?? []), host].sort();
|
|
191
|
+
indexDomains(company);
|
|
192
|
+
await writeRegistry([...cache.values()]);
|
|
193
|
+
return company;
|
|
194
|
+
}
|
|
195
|
+
function indexDomains(company) {
|
|
196
|
+
for (const domain of company.domains ?? []) {
|
|
197
|
+
const host = normalizeDomain(domain);
|
|
198
|
+
if (host && !isBoardDomain(host))
|
|
199
|
+
domainIndex.set(host, company);
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
function union(a = [], b = []) {
|
|
203
|
+
return [...new Set([...a, ...b])].sort();
|
|
204
|
+
}
|
|
205
|
+
function isStoredCompany(entry) {
|
|
206
|
+
if (!entry || typeof entry !== 'object')
|
|
207
|
+
return false;
|
|
208
|
+
const { name, scraper, slug, source, domains } = entry;
|
|
209
|
+
return (typeof name === 'string' &&
|
|
210
|
+
name.length > 0 &&
|
|
211
|
+
typeof slug === 'string' &&
|
|
212
|
+
slug.length > 0 &&
|
|
213
|
+
typeof scraper === 'string' &&
|
|
214
|
+
isScraperName(scraper) &&
|
|
215
|
+
(source === 'seed' || source === 'discovered') &&
|
|
216
|
+
(domains === undefined ||
|
|
217
|
+
(Array.isArray(domains) && domains.every((d) => typeof d === 'string'))));
|
|
218
|
+
}
|
|
219
|
+
// lets a developer work on the registry's shape without the stored file
|
|
220
|
+
// (or its writes) getting in the way; each load starts fresh from the seed
|
|
221
|
+
const registryDisabled = Boolean(platform.env('DISABLE_COMPANY_REGISTRY'));
|
|
222
|
+
async function readRegistry() {
|
|
223
|
+
if (registryDisabled)
|
|
224
|
+
return null;
|
|
225
|
+
try {
|
|
226
|
+
const parsed = JSON.parse((await platform.readText(companiesFile)) ?? '');
|
|
227
|
+
if (!parsed || !Array.isArray(parsed.companies))
|
|
228
|
+
return null;
|
|
229
|
+
return parsed;
|
|
230
|
+
}
|
|
231
|
+
catch {
|
|
232
|
+
return null;
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
async function writeRegistry(entries) {
|
|
236
|
+
if (registryDisabled)
|
|
237
|
+
return;
|
|
238
|
+
const registry = {
|
|
239
|
+
version: pkgVersion,
|
|
240
|
+
companies: [...entries].sort((a, b) => a.name.localeCompare(b.name)),
|
|
241
|
+
};
|
|
242
|
+
await platform.writeText(companiesFile, JSON.stringify(registry, null, 2) + '\n');
|
|
243
|
+
}
|
|
244
|
+
//# sourceMappingURL=companies.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"companies.js","sourceRoot":"","sources":["../src/companies.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACrC,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,EACL,aAAa,EACb,YAAY,EACZ,QAAQ,GAET,MAAM,qBAAqB,CAAC;AAgC7B,2EAA2E;AAC3E,MAAM,cAAc,GAClB,oIAAoI,CAAC;AAEvI;;;GAGG;AACH,MAAM,UAAU,oBAAoB,CAAC,KAAa;IAChD,MAAM,GAAG,GAAG,KAAK;SACd,SAAS,CAAC,MAAM,CAAC;SACjB,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC;SACrB,WAAW,EAAE;SACb,OAAO,CAAC,aAAa,EAAE,GAAG,CAAC;SAC3B,OAAO,CAAC,cAAc,EAAE,GAAG,CAAC;SAC5B,OAAO,CAAC,aAAa,EAAE,EAAE,CAAC,CAAC;IAE9B,4EAA4E;IAC5E,OAAO,GAAG,IAAI,KAAK,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,aAAa,EAAE,EAAE,CAAC,CAAC;AAC/D,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,kBAAkB,CAAC,IAAY,EAAE,WAAmB;IAClE,MAAM,CAAC,GAAG,oBAAoB,CAAC,IAAI,CAAC,CAAC;IACrC,MAAM,CAAC,GAA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