@hadoku/jobplatform-worker 2.32.40 → 2.32.42

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
@@ -2581,6 +2581,7 @@ function scheduleRankBuild(c, db, profileId, profile) {
2581
2581
  rebuildRank(db, profileId, profile).finally(() => building.delete(profileId))
2582
2582
  );
2583
2583
  }
2584
+ const MANUAL_SOURCE = "manual";
2584
2585
  function normalizeWorkplaceType(wt) {
2585
2586
  if (wt === "on_site") return "onsite";
2586
2587
  return wt;
@@ -4123,6 +4124,11 @@ function registerFeedRoute(app2) {
4123
4124
  whereBinds.push(userId);
4124
4125
  }
4125
4126
  }
4127
+ if (userId) {
4128
+ wheres.push(`(j.source_site IS NOT '${MANUAL_SOURCE}' OR js.state IS NOT NULL)`);
4129
+ } else {
4130
+ wheres.push(`j.source_site IS NOT '${MANUAL_SOURCE}'`);
4131
+ }
4126
4132
  const whereClause = wheres.length > 0 ? `WHERE ${wheres.join(" AND ")}` : "";
4127
4133
  const andWheres = wheres.length > 0 ? ` AND ${wheres.join(" AND ")}` : "";
4128
4134
  if (profile_id && profile) {
@@ -7157,7 +7163,14 @@ function registerLocationsRoute(app2) {
7157
7163
  const ImportJobSchema = z.object({
7158
7164
  url: z.string().trim().url().max(2e3),
7159
7165
  /** Where it lands in the pipeline when it is new to the caller. */
7160
- state: JobStateSchema.exclude(["dismissed"]).default("saved")
7166
+ state: JobStateSchema.exclude(["dismissed"]).default("saved"),
7167
+ /** Typed by the person: store this instead of reading the page. */
7168
+ manual: z.object({
7169
+ title: z.string().trim().min(1).max(300),
7170
+ company: z.string().trim().min(1).max(200),
7171
+ location: z.string().trim().max(200).default(""),
7172
+ description: z.string().trim().max(2e4).default("")
7173
+ }).optional()
7161
7174
  }).openapi("ImportJob");
7162
7175
  const ImportedSchema = z.object({
7163
7176
  success: z.literal(true),
@@ -7185,6 +7198,16 @@ function failure(status, message) {
7185
7198
  };
7186
7199
  }
7187
7200
  const JOB_COLS = "id, title, company, location, url";
7201
+ const escapeHtml = (text) => text.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
7202
+ function manualDescriptionHtml(text) {
7203
+ if (!text) return "";
7204
+ return text.split(/\n\s*\n/).map((para) => `<p>${escapeHtml(para.trim()).replace(/\n/g, "<br>")}</p>`).join("");
7205
+ }
7206
+ async function manualId(url) {
7207
+ const digest = await crypto.subtle.digest("SHA-256", new TextEncoder().encode(url));
7208
+ const hex = [...new Uint8Array(digest)].map((b) => b.toString(16).padStart(2, "0")).join("");
7209
+ return `manual_${hex.slice(0, 16)}`;
7210
+ }
7188
7211
  async function greenhouseSlugFor(db, url) {
7189
7212
  const parsed = new URL(url);
7190
7213
  if (!parsed.searchParams.has("gh_jid")) return void 0;
@@ -7241,13 +7264,44 @@ function registerImportRoute(app2) {
7241
7264
  }
7242
7265
  }),
7243
7266
  async (c) => {
7244
- const { url, state } = c.req.valid("json");
7267
+ const { url, state, manual } = c.req.valid("json");
7245
7268
  const { ownerName } = c.req.valid("query");
7246
7269
  const who = await effectiveUserId(c, ownerName);
7247
7270
  if (isEffectiveUserError(who)) return c.json(who.error.body, who.error.status);
7248
7271
  const db = c.env.JOB_PLATFORM_DB;
7249
7272
  let row = await db.prepare(`SELECT ${JOB_COLS} FROM jobs WHERE url = ?`).bind(url).first();
7250
7273
  let created = false;
7274
+ if (!row && manual) {
7275
+ const now2 = (/* @__PURE__ */ new Date()).toISOString();
7276
+ const id = await manualId(url);
7277
+ const [res] = await db.batch([
7278
+ insertJobStatement(
7279
+ db,
7280
+ {
7281
+ id,
7282
+ url,
7283
+ source_site: MANUAL_SOURCE,
7284
+ title: manual.title,
7285
+ company: manual.company,
7286
+ location: manual.location,
7287
+ job_type: "unknown",
7288
+ workplace_type: "unknown",
7289
+ salary: null,
7290
+ description: manualDescriptionHtml(manual.description),
7291
+ posted_date: null,
7292
+ application_url: url,
7293
+ department: null,
7294
+ scraper_used: null,
7295
+ raw: {}
7296
+ },
7297
+ { source: MANUAL_SOURCE, now: now2 }
7298
+ )
7299
+ ]);
7300
+ created = (res.meta?.changes ?? 0) > 0;
7301
+ row = await db.prepare(`SELECT ${JOB_COLS} FROM jobs WHERE id = ?`).bind(id).first();
7302
+ if (!row) throw new Error(`import: manual ${id} neither inserted nor found`);
7303
+ if (created) await rankNewJobs(db);
7304
+ }
7251
7305
  if (!row) {
7252
7306
  let extracted;
7253
7307
  try {
@@ -8,6 +8,11 @@ import type { z } from '@hono/zod-openapi';
8
8
  import type { AppEnv } from './types.js';
9
9
  import type { IngestJobSchema } from './schemas.js';
10
10
  type DB = AppEnv['JOB_PLATFORM_DB'];
11
+ /**
12
+ * The `source_site` of a posting a person typed in by hand (POST /jobs/import's
13
+ * `manual`). Nothing verified it, so the feed shows it only to people tracking it.
14
+ */
15
+ export declare const MANUAL_SOURCE = "manual";
11
16
  export type IngestJob = z.infer<typeof IngestJobSchema>;
12
17
  /**
13
18
  * The INSERT OR IGNORE for one posting. Ignored when its url (UNIQUE) or id
@@ -1 +1 @@
1
- {"version":3,"file":"ingestWrite.d.ts","sourceRoot":"","sources":["../src/ingestWrite.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AACzC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAQpD,KAAK,EAAE,GAAG,MAAM,CAAC,iBAAiB,CAAC,CAAC;AACpC,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAQxD;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CACjC,EAAE,EAAE,EAAE,EACN,GAAG,EAAE,SAAS,EACd,EAAE,MAAM,EAAE,UAAU,EAAE,GAAG,EAAE,EAAE;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,2DA6DjF;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,WAAW,CAAC,EAAE,EAAE,MAAM,CAAC,iBAAiB,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAyB9E"}
1
+ {"version":3,"file":"ingestWrite.d.ts","sourceRoot":"","sources":["../src/ingestWrite.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AACzC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAQpD,KAAK,EAAE,GAAG,MAAM,CAAC,iBAAiB,CAAC,CAAC;AAEpC;;;GAGG;AACH,eAAO,MAAM,aAAa,WAAW,CAAC;AACtC,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAQxD;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CACjC,EAAE,EAAE,EAAE,EACN,GAAG,EAAE,SAAS,EACd,EAAE,MAAM,EAAE,UAAU,EAAE,GAAG,EAAE,EAAE;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,2DA6DjF;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,WAAW,CAAC,EAAE,EAAE,MAAM,CAAC,iBAAiB,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAyB9E"}
@@ -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;AAkLrB,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,OAAO,GAAG,IAAI,CAuqBpD"}
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,3 +1,9 @@
1
1
  import { type JobsApp } from './shared.js';
2
+ /**
3
+ * Typed notes as the drawer's HTML: escaped, a paragraph per blank-line block,
4
+ * <br> for a single newline. Always wrapped in <p>, so the drawer reads it as
5
+ * HTML rather than collapsing an entity-escaped plain string.
6
+ */
7
+ export declare function manualDescriptionHtml(text: string): string;
2
8
  export declare function registerImportRoute(app: JobsApp): void;
3
9
  //# sourceMappingURL=importUrl.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"importUrl.d.ts","sourceRoot":"","sources":["../../../src/routes/jobs/importUrl.ts"],"names":[],"mappings":"AA2BA,OAAO,EAKN,KAAK,OAAO,EACZ,MAAM,aAAa,CAAC;AA2ErB,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,OAAO,GAAG,IAAI,CAuJtD"}
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"}
@@ -0,0 +1,39 @@
1
+ -- Point profiles at the boards companies actually post on now.
2
+ --
3
+ -- These (ats, slug) pairs all 404 at their ATS (checked 2026-11-09). A dead
4
+ -- pair in profile_companies is a dead entry in GET /directives: the scraper
5
+ -- auto-disables it and the profile silently gets nothing from that company.
6
+ --
7
+ -- Default-profile seeds (every profile created until f775d93):
8
+ -- lever:anyscale -> ashby:anyscale lever:plaid -> ashby:plaid
9
+ -- lever:mistral -> dropped (on none of greenhouse/lever/ashby)
10
+ -- Hostname guesses and moved boards (the operator's discovery profile),
11
+ -- matched through the scraper's /match on 2026-11-09:
12
+ -- greenhouse:withwaymo -> greenhouse:waymo
13
+ -- greenhouse:datadoghq -> greenhouse:datadog
14
+ -- greenhouse:pinterestcareers -> greenhouse:pinterest
15
+ -- greenhouse:toasttab -> greenhouse:toast
16
+ -- greenhouse:linkedin -> lever:linkedin
17
+ -- greenhouse:gigaenergy -> ashby:giga-energy
18
+ -- greenhouse:postman, greenhouse:realm, ashby:ocean -> dropped (no board found)
19
+ --
20
+ -- UPDATE OR IGNORE skips a row whose profile already lists the new pair
21
+ -- (UNIQUE(profile_id, ats, slug)); the DELETE then clears that leftover along
22
+ -- with the drops, so each profile ends with the live board once.
23
+
24
+ UPDATE OR IGNORE profile_companies SET ats = 'ashby', slug = 'anyscale' WHERE ats = 'lever' AND slug = 'anyscale';
25
+ UPDATE OR IGNORE profile_companies SET ats = 'ashby', slug = 'plaid' WHERE ats = 'lever' AND slug = 'plaid';
26
+ UPDATE OR IGNORE profile_companies SET slug = 'waymo' WHERE ats = 'greenhouse' AND slug = 'withwaymo';
27
+ UPDATE OR IGNORE profile_companies SET slug = 'datadog' WHERE ats = 'greenhouse' AND slug = 'datadoghq';
28
+ UPDATE OR IGNORE profile_companies SET slug = 'pinterest' WHERE ats = 'greenhouse' AND slug = 'pinterestcareers';
29
+ UPDATE OR IGNORE profile_companies SET slug = 'toast' WHERE ats = 'greenhouse' AND slug = 'toasttab';
30
+ UPDATE OR IGNORE profile_companies SET ats = 'lever' WHERE ats = 'greenhouse' AND slug = 'linkedin';
31
+ UPDATE OR IGNORE profile_companies SET ats = 'ashby', slug = 'giga-energy' WHERE ats = 'greenhouse' AND slug = 'gigaenergy';
32
+
33
+ DELETE FROM profile_companies WHERE (ats, slug) IN (
34
+ VALUES ('lever', 'anyscale'), ('lever', 'plaid'), ('lever', 'mistral'),
35
+ ('greenhouse', 'withwaymo'), ('greenhouse', 'datadoghq'),
36
+ ('greenhouse', 'pinterestcareers'), ('greenhouse', 'toasttab'),
37
+ ('greenhouse', 'linkedin'), ('greenhouse', 'gigaenergy'),
38
+ ('greenhouse', 'postman'), ('greenhouse', 'realm'), ('ashby', 'ocean')
39
+ );
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@hadoku/jobplatform-worker",
3
- "version": "2.32.40",
4
- "gitHead": "f775d93c3a0dd33f7763577b8d84e5f16b973328",
3
+ "version": "2.32.42",
4
+ "gitHead": "2bb65f3d1bd301200cad28ec44ae6d59d11f66d7",
5
5
  "description": "Job listings aggregation and tracking dashboard - Worker package",
6
6
  "license": "MIT",
7
7
  "type": "module",