@hadoku/jobplatform-worker 2.32.42 → 2.32.43

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.js CHANGED
@@ -1663,6 +1663,16 @@ function parseAtsSlug(url) {
1663
1663
  }
1664
1664
  return { ats: null, slug: null };
1665
1665
  }
1666
+ const TEST_BOARDS = /* @__PURE__ */ new Set(["greenhouse:linkedin", "lever:linkedin"]);
1667
+ function isTestBoardPosting(url, scraped) {
1668
+ const onTestBoard = (ats, slug2) => !!ats && !!slug2 && TEST_BOARDS.has(`${ats.toLowerCase()}:${slug2.toLowerCase()}`);
1669
+ const parsed = parseAtsSlug(url);
1670
+ return onTestBoard(parsed.ats, parsed.slug) || onTestBoard(scraped?.ats, scraped?.slug);
1671
+ }
1672
+ [...TEST_BOARDS].map((k) => {
1673
+ const [ats, slug2] = k.split(":");
1674
+ return { ats, slug: slug2 };
1675
+ });
1666
1676
  const US = [
1667
1677
  ["arlington", "va", 38.8799, -77.1068],
1668
1678
  ["austin", "tx", 30.2672, -97.7431],
@@ -2712,7 +2722,10 @@ const ingestRoute = createRoute({
2712
2722
  });
2713
2723
  const INGEST_BATCH_CHUNK = 100;
2714
2724
  app$4.openapi(ingestRoute, async (c) => {
2715
- const { jobs, batch_number, is_final, source, board_slug } = c.req.valid("json");
2725
+ const { jobs: received, batch_number, is_final, source, board_slug } = c.req.valid("json");
2726
+ const jobs = received.filter(
2727
+ (job) => !isTestBoardPosting(job.url, board_slug ? { ats: source, slug: board_slug } : void 0)
2728
+ );
2716
2729
  const db = c.env.JOB_PLATFORM_DB;
2717
2730
  const now = (/* @__PURE__ */ new Date()).toISOString();
2718
2731
  const stmts = jobs.map((job) => insertJobStatement(db, job, { source, board_slug, now }));
@@ -2724,7 +2737,7 @@ app$4.openapi(ingestRoute, async (c) => {
2724
2737
  }
2725
2738
  endTime(c, "insert");
2726
2739
  const accepted = inserted.filter(Boolean).length;
2727
- const skipped = jobs.length - accepted;
2740
+ const skipped = received.length - accepted;
2728
2741
  const seen = jobs.filter((_, i) => !inserted[i]);
2729
2742
  const SEEN_CHUNK = 45;
2730
2743
  const storedReads = [];
@@ -3891,6 +3904,7 @@ function deserializeProfile(r) {
3891
3904
  };
3892
3905
  }
3893
3906
  const profileRoutes = app$3;
3907
+ const MAX_SEARCH_WORDS = 6;
3894
3908
  const MAX_NEARBY = 80;
3895
3909
  const LIGHT_CANDIDATE_CAP = 5e4;
3896
3910
  const FULL_SCORE_CAP = 800;
@@ -3989,6 +4003,15 @@ function registerFeedRoute(app2) {
3989
4003
  }),
3990
4004
  min_salary: z.coerce.number().min(0).optional().openapi({
3991
4005
  description: "View filter: drop jobs whose salary_max is below this. Jobs with no listed salary are kept — most postings omit it, and hiding them would hide the corpus."
4006
+ }),
4007
+ q: z.string().trim().max(100).optional().openapi({
4008
+ description: "Keyword search over title, company and location, case-insensitive. Words are AND-ed (each must appear in one of the three); at most 6 are used."
4009
+ }),
4010
+ source: z.string().trim().toLowerCase().regex(/^[a-z0-9.-]{1,40}$/).optional().openapi({
4011
+ description: "Only postings from one source: an ATS ('greenhouse', 'ashby', 'lever') or a site ('remoteok'), matched against the posting's ats and source_site."
4012
+ }),
4013
+ track: z.enum(["ic", "manager"]).optional().openapi({
4014
+ description: "Hard filter on the classified role track, for a caller without a profile (a profile's own track applies too)."
3992
4015
  })
3993
4016
  })
3994
4017
  },
@@ -4038,7 +4061,10 @@ function registerFeedRoute(app2) {
4038
4061
  min_salary,
4039
4062
  near,
4040
4063
  radius_miles,
4041
- include_remote
4064
+ include_remote,
4065
+ q,
4066
+ source,
4067
+ track
4042
4068
  } = c.req.valid("query");
4043
4069
  const hideDismissed = hideDismissedRaw === "true";
4044
4070
  const hideQueued = hideQueuedRaw === "true";
@@ -4106,6 +4132,24 @@ function registerFeedRoute(app2) {
4106
4132
  wheres.push(`(${terms.join(" OR ")})`);
4107
4133
  whereBinds.push(...nearby.map((p) => `%|${p.key}|%`));
4108
4134
  }
4135
+ if (q) {
4136
+ const words = q.split(/\s+/).filter(Boolean).slice(0, MAX_SEARCH_WORDS);
4137
+ for (const word of words) {
4138
+ const pattern = `%${word.replace(/[\\%_]/g, (ch) => `\\${ch}`)}%`;
4139
+ wheres.push(
4140
+ "(j.title LIKE ? ESCAPE '\\' OR j.company LIKE ? ESCAPE '\\' OR j.location LIKE ? ESCAPE '\\')"
4141
+ );
4142
+ whereBinds.push(pattern, pattern, pattern);
4143
+ }
4144
+ }
4145
+ if (source) {
4146
+ wheres.push("(j.ats = ? OR j.source_site LIKE ?)");
4147
+ whereBinds.push(source, `${source}%`);
4148
+ }
4149
+ if (track) {
4150
+ wheres.push("j.role_track = ?");
4151
+ whereBinds.push(track);
4152
+ }
4109
4153
  if (userId) {
4110
4154
  if (stateFilter === "new") {
4111
4155
  wheres.push("js.state IS NULL");
@@ -7329,6 +7373,12 @@ function registerImportRoute(app2) {
7329
7373
  502
7330
7374
  );
7331
7375
  }
7376
+ if (isTestBoardPosting(job.data.url, { ats: extracted.ats, slug: extracted.board_slug })) {
7377
+ return c.json(
7378
+ failure(422, "That board holds LinkedIn's ATS test postings, not real jobs."),
7379
+ 422
7380
+ );
7381
+ }
7332
7382
  const now2 = (/* @__PURE__ */ new Date()).toISOString();
7333
7383
  const [res] = await db.batch([
7334
7384
  insertJobStatement(db, job.data, {
@@ -1 +1 @@
1
- {"version":3,"file":"ingest.d.ts","sourceRoot":"","sources":["../../src/routes/ingest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAkB,MAAM,mBAAmB,CAAC;AAEhE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAkB,KAAK,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAiB9E,UAAU,YAAY;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE;QAAE,WAAW,EAAE,iBAAiB,CAAA;KAAE,CAAC;CAC9C;AAq9BD,eAAO,MAAM,YAAY,oCAAM,CAAC"}
1
+ {"version":3,"file":"ingest.d.ts","sourceRoot":"","sources":["../../src/routes/ingest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAkB,MAAM,mBAAmB,CAAC;AAEhE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAkB,KAAK,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAkB9E,UAAU,YAAY;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE;QAAE,WAAW,EAAE,iBAAiB,CAAA;KAAE,CAAC;CAC9C;AA09BD,eAAO,MAAM,YAAY,oCAAM,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"feed.d.ts","sourceRoot":"","sources":["../../../src/routes/jobs/feed.ts"],"names":[],"mappings":"AAYA,OAAO,EASN,KAAK,OAAO,EACZ,MAAM,aAAa,CAAC;AAmLrB,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,OAAO,GAAG,IAAI,CAirBpD"}
1
+ {"version":3,"file":"feed.d.ts","sourceRoot":"","sources":["../../../src/routes/jobs/feed.ts"],"names":[],"mappings":"AAYA,OAAO,EASN,KAAK,OAAO,EACZ,MAAM,aAAa,CAAC;AAsLrB,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,OAAO,GAAG,IAAI,CAyuBpD"}
@@ -1 +1 @@
1
- {"version":3,"file":"importUrl.d.ts","sourceRoot":"","sources":["../../../src/routes/jobs/importUrl.ts"],"names":[],"mappings":"AAmCA,OAAO,EAKN,KAAK,OAAO,EACZ,MAAM,aAAa,CAAC;AAgErB;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAM1D;AAgCD,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,OAAO,GAAG,IAAI,CA4LtD"}
1
+ {"version":3,"file":"importUrl.d.ts","sourceRoot":"","sources":["../../../src/routes/jobs/importUrl.ts"],"names":[],"mappings":"AAoCA,OAAO,EAKN,KAAK,OAAO,EACZ,MAAM,aAAa,CAAC;AAgErB;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAM1D;AAgCD,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,OAAO,GAAG,IAAI,CAkMtD"}
@@ -0,0 +1,11 @@
1
+ /** The posting is on a known test board (by its URL, or the board the scraper says it fetched). */
2
+ export declare function isTestBoardPosting(url: string, scraped?: {
3
+ ats?: string | null;
4
+ slug?: string | null;
5
+ }): boolean;
6
+ /** For the migration and tests: the boards as (ats, slug) pairs. */
7
+ export declare const TEST_BOARD_PAIRS: {
8
+ ats: string;
9
+ slug: string;
10
+ }[];
11
+ //# sourceMappingURL=testBoards.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"testBoards.d.ts","sourceRoot":"","sources":["../src/testBoards.ts"],"names":[],"mappings":"AAkBA,mGAAmG;AACnG,wBAAgB,kBAAkB,CACjC,GAAG,EAAE,MAAM,EACX,OAAO,CAAC,EAAE;IAAE,GAAG,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,GACrD,OAAO,CAKT;AAED,oEAAoE;AACpE,eAAO,MAAM,gBAAgB;;;GAG3B,CAAC"}
@@ -0,0 +1,23 @@
1
+ -- Drop the postings of known ATS test boards (worker/src/testBoards.ts):
2
+ -- LinkedIn's own Greenhouse and Lever tenants, which hold only LinkedIn's
3
+ -- integration tests ("Bug Bash Job …", "EA Test - Most Questions",
4
+ -- "SJ_TEST_LEVER_ATTACHMENT", 76 rows on 2026-11-09). Ingest and
5
+ -- POST /jobs/import refuse them from now on; this removes what is already
6
+ -- stored.
7
+ --
8
+ -- Only rows nobody has touched: a posting someone tracks, voted on, queued or
9
+ -- logged a timeline row for stays, as the daily cull spares it. job_profile_rank,
10
+ -- job_profile_matches, job_states and job_events cascade on delete; applications
11
+ -- and job_feedback have no foreign key, so they are checked explicitly.
12
+ DELETE FROM jobs
13
+ WHERE (
14
+ (ats = 'greenhouse' AND LOWER(slug) = 'linkedin')
15
+ OR (ats = 'lever' AND LOWER(slug) = 'linkedin')
16
+ OR url LIKE 'https://job-boards.greenhouse.io/linkedin/%'
17
+ OR url LIKE 'https://boards.greenhouse.io/linkedin/%'
18
+ OR url LIKE 'https://jobs.lever.co/linkedin/%'
19
+ )
20
+ AND NOT EXISTS (SELECT 1 FROM job_states s WHERE s.job_id = jobs.id)
21
+ AND NOT EXISTS (SELECT 1 FROM job_feedback f WHERE f.job_id = jobs.id)
22
+ AND NOT EXISTS (SELECT 1 FROM applications a WHERE a.job_id = jobs.id)
23
+ AND NOT EXISTS (SELECT 1 FROM job_events e WHERE e.job_id = jobs.id);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@hadoku/jobplatform-worker",
3
- "version": "2.32.42",
4
- "gitHead": "2bb65f3d1bd301200cad28ec44ae6d59d11f66d7",
3
+ "version": "2.32.43",
4
+ "gitHead": "1894003df9c23d34d2488f9104836c8e9384e267",
5
5
  "description": "Job listings aggregation and tracking dashboard - Worker package",
6
6
  "license": "MIT",
7
7
  "type": "module",