@hadoku/jobplatform-worker 2.32.43 → 2.32.45

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.
@@ -0,0 +1,40 @@
1
+ /**
2
+ * Is a posting still listed? The one definition, shared by the apply queue
3
+ * (applications.ts, which marks a queued application job_closed), GET /pipeline
4
+ * and GET /jobs/:id.
5
+ *
6
+ * Ingest bumps `last_seen_at` on every job a scrape re-encounters, so a posting
7
+ * still on its board keeps pace with its siblings and one that has been pulled
8
+ * falls behind. The comparison is against THE SAME BOARD's newest stamp rather
9
+ * than wall-clock age, which is what makes it safe: if the scraper breaks, a
10
+ * target is disabled, or auth lapses, every job on that board stops advancing
11
+ * together and none of them looks dead. "Our scraper is broken" must never read
12
+ * as "every job closed".
13
+ *
14
+ * The window exists because one scrape run is not instantaneous — it arrives as
15
+ * batches of 25, each stamped when it lands, so jobs from a single run differ by
16
+ * minutes. Runs are daily. Twelve hours is comfortably wider than any one run
17
+ * and comfortably narrower than a missed one.
18
+ *
19
+ * Only board-sourced jobs can be judged: keyword-feed sources (RemoteOK, a
20
+ * pasted page, a posting typed in by hand) have no board to be absent from, so
21
+ * `ats`/`slug` are empty and the answer is "not closed".
22
+ */
23
+ import type { D1Database } from '@cloudflare/workers-types';
24
+ export declare const DELISTED_LAG_MS: number;
25
+ export interface BoardPosting {
26
+ ats: string | null;
27
+ slug: string | null;
28
+ last_seen_at: string | null;
29
+ }
30
+ /** Has a posting seen at `lastSeen` fallen behind its board's newest `boardNewest`? */
31
+ export declare function isDelisted(lastSeen: string | null, boardNewest: string | null): boolean;
32
+ /**
33
+ * Each board's newest `last_seen_at`, one grouped query for all of them (a
34
+ * pipeline names tens of boards). Rides idx_jobs_ats_slug; no index on
35
+ * last_seen_at, which every nightly liveness bump would have to rewrite.
36
+ */
37
+ export declare function boardNewest(db: D1Database, postings: BoardPosting[]): Promise<Map<string, string>>;
38
+ /** Whether each posting has been taken down, in order. */
39
+ export declare function closedFlags(db: D1Database, postings: BoardPosting[]): Promise<boolean[]>;
40
+ //# sourceMappingURL=freshness.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"freshness.d.ts","sourceRoot":"","sources":["../src/freshness.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAE5D,eAAO,MAAM,eAAe,QAAsB,CAAC;AAEnD,MAAM,WAAW,YAAY;IAC5B,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IACnB,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;CAC5B;AAID,uFAAuF;AACvF,wBAAgB,UAAU,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,EAAE,WAAW,EAAE,MAAM,GAAG,IAAI,GAAG,OAAO,CAMvF;AAED;;;;GAIG;AACH,wBAAsB,WAAW,CAChC,EAAE,EAAE,UAAU,EACd,QAAQ,EAAE,YAAY,EAAE,GACtB,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAqB9B;AAED,0DAA0D;AAC1D,wBAAsB,WAAW,CAAC,EAAE,EAAE,UAAU,EAAE,QAAQ,EAAE,YAAY,EAAE,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC,CAO9F"}
package/dist/index.js CHANGED
@@ -572,7 +572,11 @@ const JobDetailSchema = JobSummarySchema.extend({
572
572
  run_id: z.string().nullable(),
573
573
  state_updated_at: z.string().nullable(),
574
574
  /** V5 tracking; null when the caller has no state for this posting (or is anonymous). */
575
- tracking: TrackingSchema.nullable()
575
+ tracking: TrackingSchema.nullable(),
576
+ /** When a scrape last saw it on its board (null: never, or not a board posting). */
577
+ last_seen_at: z.string().nullable(),
578
+ /** Taken down: it has fallen behind its own board's scrapes (freshness.ts). */
579
+ closed: z.boolean()
576
580
  }).openapi("JobDetail");
577
581
  const FEEDBACK_REASONS = [
578
582
  // downvote-flavored
@@ -1039,7 +1043,11 @@ const PipelineItemSchema = z.object({
1039
1043
  /** First time it moved to 'applied', from the timeline. */
1040
1044
  applied_at: z.string().nullable(),
1041
1045
  /** Newest timeline row, of any kind. */
1042
- last_event_at: z.string().nullable()
1046
+ last_event_at: z.string().nullable(),
1047
+ /** When a scrape last saw it on its board (null: never, or not a board posting). */
1048
+ last_seen_at: z.string().nullable(),
1049
+ /** Taken down: it has fallen behind its own board's scrapes (freshness.ts). */
1050
+ closed: z.boolean()
1043
1051
  }).openapi("PipelineItem");
1044
1052
  const PipelineResponseSchema = S(z.object({ items: z.array(PipelineItemSchema) })).openapi(
1045
1053
  "PipelineResponse"
@@ -1088,6 +1096,38 @@ const InsightsSchema = z.object({
1088
1096
  skill_postings: z.number().int()
1089
1097
  }).openapi("Insights");
1090
1098
  const InsightsResponseSchema = S(InsightsSchema).openapi("InsightsResponse");
1099
+ const SkillProficiencySchema = z.enum(["beginner", "intermediate", "expert"]);
1100
+ const SkillSchema = z.object({
1101
+ id: z.number().int(),
1102
+ name: z.string(),
1103
+ category: z.string().nullable(),
1104
+ proficiency: SkillProficiencySchema,
1105
+ created_at: z.string()
1106
+ }).openapi("Skill");
1107
+ const AddSkillSchema = z.object({
1108
+ name: z.string().trim().min(1).max(80),
1109
+ category: z.string().trim().max(80).optional(),
1110
+ proficiency: SkillProficiencySchema.default("intermediate")
1111
+ }).openapi("AddSkill");
1112
+ const SkillsResponseSchema = S(z.object({ skills: z.array(SkillSchema) })).openapi(
1113
+ "SkillsResponse"
1114
+ );
1115
+ const SkillResponseSchema = S(z.object({ skill: SkillSchema })).openapi("SkillResponse");
1116
+ const JobMatchResponseSchema = S(
1117
+ z.object({
1118
+ /** Skills the posting names that the caller has (canonical names). */
1119
+ matched: z.array(z.string()),
1120
+ /** Skills the posting names that the caller lacks. */
1121
+ missing: z.array(z.string()),
1122
+ /** Every skill the posting names, in vocabulary order. */
1123
+ detected: z.array(z.string()),
1124
+ /** matched / detected, 0–100 (0 when the posting names none). */
1125
+ score: z.number().int(),
1126
+ summary: z.string(),
1127
+ /** What the caller's side came from: their skills list, their profiles' stack, or nothing. */
1128
+ against: z.enum(["skills", "profile_stack", "none"])
1129
+ })
1130
+ ).openapi("JobMatchResponse");
1091
1131
  const app$5 = new OpenAPIHono();
1092
1132
  const healthRoute = createRoute({
1093
1133
  method: "get",
@@ -4486,6 +4526,39 @@ function registerPacketsRoute(app2) {
4486
4526
  }
4487
4527
  );
4488
4528
  }
4529
+ const DELISTED_LAG_MS = 12 * 60 * 60 * 1e3;
4530
+ const boardKey = (ats, slug2) => `${ats}\0${slug2}`;
4531
+ function isDelisted(lastSeen, boardNewest2) {
4532
+ if (!lastSeen || !boardNewest2) return false;
4533
+ const seen = Date.parse(lastSeen);
4534
+ const newest = Date.parse(boardNewest2);
4535
+ if (Number.isNaN(seen) || Number.isNaN(newest)) return false;
4536
+ return newest - seen > DELISTED_LAG_MS;
4537
+ }
4538
+ async function boardNewest(db, postings) {
4539
+ const boards = /* @__PURE__ */ new Map();
4540
+ for (const p of postings) {
4541
+ if (p.ats && p.slug) boards.set(boardKey(p.ats, p.slug), { ats: p.ats, slug: p.slug });
4542
+ }
4543
+ const out = /* @__PURE__ */ new Map();
4544
+ const list = [...boards.values()];
4545
+ for (let i = 0; i < list.length; i += 45) {
4546
+ const chunk = list.slice(i, i + 45);
4547
+ const res = await db.prepare(
4548
+ `SELECT ats, slug, MAX(last_seen_at) AS newest FROM jobs
4549
+ WHERE ${chunk.map(() => "(ats = ? AND slug = ?)").join(" OR ")}
4550
+ GROUP BY ats, slug`
4551
+ ).bind(...chunk.flatMap((b) => [b.ats, b.slug])).all();
4552
+ for (const r of res.results) if (r.newest) out.set(boardKey(r.ats, r.slug), r.newest);
4553
+ }
4554
+ return out;
4555
+ }
4556
+ async function closedFlags(db, postings) {
4557
+ const newest = await boardNewest(db, postings);
4558
+ return postings.map(
4559
+ (p) => p.ats && p.slug ? isDelisted(p.last_seen_at, newest.get(boardKey(p.ats, p.slug)) ?? null) : false
4560
+ );
4561
+ }
4489
4562
  const SUPPORTED_HOSTS = [
4490
4563
  "jobs.ashbyhq.com",
4491
4564
  "job-boards.greenhouse.io",
@@ -4624,6 +4697,7 @@ function registerPipelineRoutes(app2) {
4624
4697
  const rows = await c.env.JOB_PLATFORM_DB.prepare(
4625
4698
  `SELECT js.job_id, j.title, j.company, j.location, j.workplace_type,
4626
4699
  j.salary_min, j.salary_max, j.url, j.posted_date,
4700
+ j.ats, j.slug, j.last_seen_at,
4627
4701
  js.state, js.updated_at, js.variant_slug,
4628
4702
  js.notes, js.priority, js.follow_up_at, js.contact_name, js.contact_email,
4629
4703
  ap.status AS application_status,
@@ -4638,7 +4712,8 @@ function registerPipelineRoutes(app2) {
4638
4712
  WHERE js.user_id = ? ${dismissed}
4639
4713
  ORDER BY js.updated_at DESC`
4640
4714
  ).bind(who.userId).all();
4641
- const items = rows.results.flatMap((r) => {
4715
+ const closed = await closedFlags(c.env.JOB_PLATFORM_DB, rows.results);
4716
+ const items = rows.results.flatMap((r, i) => {
4642
4717
  const state = stateOrNull(r.state);
4643
4718
  if (!state) return [];
4644
4719
  return [
@@ -4658,6 +4733,8 @@ function registerPipelineRoutes(app2) {
4658
4733
  variant_slug: r.variant_slug,
4659
4734
  application_status: asApplicationStatus(r.application_status),
4660
4735
  applied_at: r.applied_at,
4736
+ last_seen_at: r.last_seen_at,
4737
+ closed: closed[i],
4661
4738
  last_event_at: r.last_event_at
4662
4739
  }
4663
4740
  ];
@@ -4961,7 +5038,15 @@ function registerDetailRoute(app2) {
4961
5038
  state,
4962
5039
  application_status: asApplicationStatus(applicationStatus),
4963
5040
  state_updated_at: stateUpdatedAt,
4964
- tracking
5041
+ tracking,
5042
+ last_seen_at: row.last_seen_at ?? null,
5043
+ closed: (await closedFlags(db, [
5044
+ {
5045
+ ats: row.ats ?? null,
5046
+ slug: row.slug ?? null,
5047
+ last_seen_at: row.last_seen_at ?? null
5048
+ }
5049
+ ]))[0]
4965
5050
  };
4966
5051
  return c.json({ success: true, data: { job } }, 200);
4967
5052
  }
@@ -6202,17 +6287,12 @@ function reconcile(evidence, stored) {
6202
6287
  }
6203
6288
  return out;
6204
6289
  }
6205
- const DELISTED_LAG_MS = 12 * 60 * 60 * 1e3;
6206
6290
  async function delistedReason(db, jobId) {
6207
6291
  const job = await db.prepare("SELECT ats, slug, last_seen_at FROM jobs WHERE id = ?").bind(jobId).first();
6208
6292
  if (!job?.ats || !job.slug || !job.last_seen_at) return null;
6209
- const board = await db.prepare("SELECT MAX(last_seen_at) AS newest FROM jobs WHERE ats = ? AND slug = ?").bind(job.ats, job.slug).first();
6210
- if (!board?.newest) return null;
6211
- const seen = Date.parse(job.last_seen_at);
6212
- const newest = Date.parse(board.newest);
6213
- if (Number.isNaN(seen) || Number.isNaN(newest)) return null;
6214
- if (newest - seen <= DELISTED_LAG_MS) return null;
6215
- return `this posting has not appeared in a scrape of the ${job.ats} board '${job.slug}' since ${job.last_seen_at}, while other jobs on that board were seen as recently as ${board.newest} — it looks taken down`;
6293
+ const newest = (await boardNewest(db, [job])).values().next().value ?? null;
6294
+ if (!isDelisted(job.last_seen_at, newest)) return null;
6295
+ return `this posting has not appeared in a scrape of the ${job.ats} board '${job.slug}' since ${job.last_seen_at}, while other jobs on that board were seen as recently as ${newest} — it looks taken down`;
6216
6296
  }
6217
6297
  const FORBIDDEN = {
6218
6298
  success: false,
@@ -6665,6 +6745,21 @@ function validProfile(p) {
6665
6745
  const o = p;
6666
6746
  return typeof o.name === "string" && !!o.name.trim() && typeof o.email === "string";
6667
6747
  }
6748
+ const PROFILE_TEXT_LIMITS = {
6749
+ work_authorization: 200,
6750
+ desired_salary: 100,
6751
+ notice_period: 100,
6752
+ master_resume_text: 5e4
6753
+ };
6754
+ function profileProblem(p) {
6755
+ for (const [key, max] of Object.entries(PROFILE_TEXT_LIMITS)) {
6756
+ const v = p[key];
6757
+ if (v === void 0 || v === null) continue;
6758
+ if (typeof v !== "string") return `${key} must be a string`;
6759
+ if (v.length > max) return `${key} is longer than ${max} characters`;
6760
+ }
6761
+ return null;
6762
+ }
6668
6763
  async function loadProfile(db, userId) {
6669
6764
  const row = await db.prepare("SELECT profile, updated_at FROM applicant_profiles WHERE user_id = ?").bind(userId).first();
6670
6765
  if (!row) return null;
@@ -6701,6 +6796,8 @@ function registerFillRoutes(app2) {
6701
6796
  if (!validProfile(b.profile)) {
6702
6797
  return c.json(badRequest("profile must be an object with a name and an email"), 400);
6703
6798
  }
6799
+ const problem = profileProblem(b.profile);
6800
+ if (problem) return c.json(badRequest(problem), 400);
6704
6801
  const who = await effectiveUserId(c, typeof b.ownerName === "string" ? b.ownerName : void 0);
6705
6802
  if (isEffectiveUserError(who)) return c.json(who.error.body, who.error.status);
6706
6803
  const now = (/* @__PURE__ */ new Date()).toISOString();
@@ -6757,7 +6854,7 @@ function registerFillRoutes(app2) {
6757
6854
  );
6758
6855
  });
6759
6856
  }
6760
- const ERRORS$1 = {
6857
+ const ERRORS$2 = {
6761
6858
  403: {
6762
6859
  description: "Forbidden",
6763
6860
  content: { "application/json": { schema: IdentityErrorResponseSchema } }
@@ -6791,7 +6888,7 @@ function registerBlockedRoutes(app2) {
6791
6888
  description: "Blocked companies, newest first",
6792
6889
  content: { "application/json": { schema: BlockedCompaniesResponseSchema } }
6793
6890
  },
6794
- ...ERRORS$1
6891
+ ...ERRORS$2
6795
6892
  }
6796
6893
  }),
6797
6894
  async (c) => {
@@ -6819,7 +6916,7 @@ function registerBlockedRoutes(app2) {
6819
6916
  description: "Blocked (or already was — the first spelling is kept)",
6820
6917
  content: { "application/json": { schema: BlockedCompanyResponseSchema } }
6821
6918
  },
6822
- ...ERRORS$1
6919
+ ...ERRORS$2
6823
6920
  }
6824
6921
  }),
6825
6922
  async (c) => {
@@ -6859,7 +6956,7 @@ function registerBlockedRoutes(app2) {
6859
6956
  description: "Unblocked (or was not blocked)",
6860
6957
  content: { "application/json": { schema: UnblockCompanyResponseSchema } }
6861
6958
  },
6862
- ...ERRORS$1
6959
+ ...ERRORS$2
6863
6960
  }
6864
6961
  }),
6865
6962
  async (c) => {
@@ -6991,6 +7088,15 @@ function canonicalSkill(term) {
6991
7088
  for (const { name, aliases } of SKILLS) if (aliases.includes(t)) return name;
6992
7089
  return t;
6993
7090
  }
7091
+ function parseStringList(raw) {
7092
+ if (!raw) return [];
7093
+ try {
7094
+ const v = JSON.parse(raw);
7095
+ return Array.isArray(v) ? v.filter((x) => typeof x === "string") : [];
7096
+ } catch {
7097
+ return [];
7098
+ }
7099
+ }
6994
7100
  const WEEKS = 12;
6995
7101
  const TOP_SKILLS = 15;
6996
7102
  const APPLIED_OR_LATER = /* @__PURE__ */ new Set(["applied", "interviewing", "offered", "rejected"]);
@@ -7001,15 +7107,7 @@ function weekOf(iso) {
7001
7107
  d.setUTCDate(d.getUTCDate() - sinceMonday);
7002
7108
  return d.toISOString().slice(0, 10);
7003
7109
  }
7004
- function parseList(raw) {
7005
- try {
7006
- const v = JSON.parse(raw);
7007
- return Array.isArray(v) ? v.filter((x) => typeof x === "string") : [];
7008
- } catch {
7009
- return [];
7010
- }
7011
- }
7012
- const ERRORS = {
7110
+ const ERRORS$1 = {
7013
7111
  403: {
7014
7112
  description: "Forbidden",
7015
7113
  content: { "application/json": { schema: IdentityErrorResponseSchema } }
@@ -7041,7 +7139,7 @@ function registerInsightsRoute(app2) {
7041
7139
  description: "Insights",
7042
7140
  content: { "application/json": { schema: InsightsResponseSchema } }
7043
7141
  },
7044
- ...ERRORS
7142
+ ...ERRORS$1
7045
7143
  }
7046
7144
  }),
7047
7145
  async (c) => {
@@ -7127,7 +7225,7 @@ function registerInsightsRoute(app2) {
7127
7225
  }
7128
7226
  const stack = new Set(
7129
7227
  profiles.results.flatMap(
7130
- (p) => parseList(p.stack).map(canonicalSkill)
7228
+ (p) => parseStringList(p.stack).map(canonicalSkill)
7131
7229
  )
7132
7230
  );
7133
7231
  const demand = /* @__PURE__ */ new Map();
@@ -7427,6 +7525,197 @@ function registerImportRoute(app2) {
7427
7525
  }
7428
7526
  );
7429
7527
  }
7528
+ const ERRORS = {
7529
+ 403: {
7530
+ description: "Forbidden",
7531
+ content: { "application/json": { schema: IdentityErrorResponseSchema } }
7532
+ },
7533
+ 404: {
7534
+ description: "Not found, or no such owner name",
7535
+ content: { "application/json": { schema: IdentityErrorResponseSchema } }
7536
+ },
7537
+ 409: {
7538
+ description: "Already in the list, or that owner name has never signed in",
7539
+ content: { "application/json": { schema: IdentityErrorResponseSchema } }
7540
+ },
7541
+ 503: {
7542
+ description: "Identity could not be resolved right now — retry",
7543
+ content: { "application/json": { schema: IdentityErrorResponseSchema } }
7544
+ }
7545
+ };
7546
+ const SKILL_COLS = "id, name, category, proficiency, created_at";
7547
+ function registerUserSkillRoutes(app2) {
7548
+ app2.get("/skills", gateAuthed);
7549
+ app2.post("/skills", gateAuthed);
7550
+ app2.delete("/skills/:id", gateAuthed);
7551
+ app2.get("/jobs/:id/match", gateAuthed);
7552
+ app2.openapi(
7553
+ createRoute({
7554
+ method: "get",
7555
+ path: "/skills",
7556
+ tags: ["Profile"],
7557
+ summary: "The caller's skills list",
7558
+ request: { query: ownerNameQuery },
7559
+ responses: {
7560
+ 200: {
7561
+ description: "Skills, by name",
7562
+ content: { "application/json": { schema: SkillsResponseSchema } }
7563
+ },
7564
+ ...ERRORS
7565
+ }
7566
+ }),
7567
+ async (c) => {
7568
+ const who = await effectiveUserId(c, c.req.valid("query").ownerName);
7569
+ if (isEffectiveUserError(who)) return c.json(who.error.body, who.error.status);
7570
+ const rows = await c.env.JOB_PLATFORM_DB.prepare(
7571
+ `SELECT ${SKILL_COLS} FROM user_skills WHERE user_id = ? ORDER BY name COLLATE NOCASE`
7572
+ ).bind(who.userId).all();
7573
+ return c.json({ success: true, data: { skills: rows.results } }, 200);
7574
+ }
7575
+ );
7576
+ app2.openapi(
7577
+ createRoute({
7578
+ method: "post",
7579
+ path: "/skills",
7580
+ tags: ["Profile"],
7581
+ summary: "Add a skill to the caller's list",
7582
+ request: {
7583
+ query: ownerNameQuery,
7584
+ body: { content: { "application/json": { schema: AddSkillSchema } } }
7585
+ },
7586
+ responses: {
7587
+ 201: {
7588
+ description: "Added",
7589
+ content: { "application/json": { schema: SkillResponseSchema } }
7590
+ },
7591
+ ...ERRORS
7592
+ }
7593
+ }),
7594
+ async (c) => {
7595
+ const who = await effectiveUserId(c, c.req.valid("query").ownerName);
7596
+ if (isEffectiveUserError(who)) return c.json(who.error.body, who.error.status);
7597
+ const { name, category, proficiency } = c.req.valid("json");
7598
+ const db = c.env.JOB_PLATFORM_DB;
7599
+ const res = await db.prepare(
7600
+ `INSERT INTO user_skills (user_id, name, name_key, category, proficiency, created_at)
7601
+ VALUES (?, ?, ?, ?, ?, ?)
7602
+ ON CONFLICT (user_id, name_key) DO NOTHING`
7603
+ ).bind(
7604
+ who.userId,
7605
+ name,
7606
+ canonicalSkill(name),
7607
+ category ?? null,
7608
+ proficiency,
7609
+ (/* @__PURE__ */ new Date()).toISOString()
7610
+ ).run();
7611
+ if ((res.meta?.changes ?? 0) === 0) {
7612
+ return c.json(
7613
+ {
7614
+ success: false,
7615
+ error: "Conflict",
7616
+ message: `${name} is already in your skills.`
7617
+ },
7618
+ 409
7619
+ );
7620
+ }
7621
+ const row = await db.prepare(`SELECT ${SKILL_COLS} FROM user_skills WHERE user_id = ? AND name_key = ?`).bind(who.userId, canonicalSkill(name)).first();
7622
+ return c.json({ success: true, data: { skill: row } }, 201);
7623
+ }
7624
+ );
7625
+ app2.openapi(
7626
+ createRoute({
7627
+ method: "delete",
7628
+ path: "/skills/{id}",
7629
+ tags: ["Profile"],
7630
+ summary: "Remove a skill from the caller's list",
7631
+ request: {
7632
+ params: z.object({ id: z.coerce.number().int().positive() }),
7633
+ query: ownerNameQuery
7634
+ },
7635
+ responses: {
7636
+ 200: {
7637
+ description: "Removed",
7638
+ content: {
7639
+ "application/json": {
7640
+ schema: z.object({
7641
+ success: z.literal(true),
7642
+ data: z.object({ deleted: z.boolean() })
7643
+ })
7644
+ }
7645
+ }
7646
+ },
7647
+ ...ERRORS
7648
+ }
7649
+ }),
7650
+ async (c) => {
7651
+ const who = await effectiveUserId(c, c.req.valid("query").ownerName);
7652
+ if (isEffectiveUserError(who)) return c.json(who.error.body, who.error.status);
7653
+ const res = await c.env.JOB_PLATFORM_DB.prepare(
7654
+ "DELETE FROM user_skills WHERE id = ? AND user_id = ?"
7655
+ ).bind(c.req.valid("param").id, who.userId).run();
7656
+ if ((res.meta?.changes ?? 0) === 0) {
7657
+ return c.json(
7658
+ { success: false, error: "Not found", message: "No such skill in your list." },
7659
+ 404
7660
+ );
7661
+ }
7662
+ return c.json({ success: true, data: { deleted: true } }, 200);
7663
+ }
7664
+ );
7665
+ app2.openapi(
7666
+ createRoute({
7667
+ method: "get",
7668
+ path: "/jobs/{id}/match",
7669
+ tags: ["Jobs"],
7670
+ summary: "Which of a posting's skills the caller has, and which they lack",
7671
+ request: { params: z.object({ id: z.string() }), query: ownerNameQuery },
7672
+ responses: {
7673
+ 200: {
7674
+ description: "The match",
7675
+ content: { "application/json": { schema: JobMatchResponseSchema } }
7676
+ },
7677
+ ...ERRORS,
7678
+ 400: {
7679
+ description: "Bad request",
7680
+ content: { "application/json": { schema: ErrorResponseSchema } }
7681
+ }
7682
+ }
7683
+ }),
7684
+ async (c) => {
7685
+ const who = await effectiveUserId(c, c.req.valid("query").ownerName);
7686
+ if (isEffectiveUserError(who)) return c.json(who.error.body, who.error.status);
7687
+ const db = c.env.JOB_PLATFORM_DB;
7688
+ const job = await db.prepare("SELECT title, description FROM jobs WHERE id = ?").bind(c.req.valid("param").id).first();
7689
+ if (!job) {
7690
+ return c.json(
7691
+ { success: false, error: "Not found", message: "No such posting." },
7692
+ 404
7693
+ );
7694
+ }
7695
+ const detected = extractSkills(`${job.title}
7696
+ ${job.description}`);
7697
+ const listed = await db.prepare("SELECT name_key FROM user_skills WHERE user_id = ?").bind(who.userId).all();
7698
+ let against = "skills";
7699
+ let mine = new Set(listed.results.map((r) => r.name_key));
7700
+ if (mine.size === 0) {
7701
+ const stacks = await db.prepare("SELECT stack FROM profiles WHERE user_id = ?").bind(who.userId).all();
7702
+ mine = new Set(stacks.results.flatMap((p) => parseStringList(p.stack).map(canonicalSkill)));
7703
+ against = mine.size > 0 ? "profile_stack" : "none";
7704
+ }
7705
+ const matched = detected.filter((s) => mine.has(s));
7706
+ const missing = detected.filter((s) => !mine.has(s));
7707
+ const score = detected.length === 0 ? 0 : Math.round(100 * matched.length / detected.length);
7708
+ const summary = detected.length === 0 ? "This posting names none of the skills the matcher knows." : against === "none" ? `This posting asks for ${detected.length} skill${detected.length === 1 ? "" : "s"}; add yours to see how you match.` : `You have ${matched.length} of the ${detected.length} skill${detected.length === 1 ? "" : "s"} this posting names.`;
7709
+ return c.json(
7710
+ {
7711
+ success: true,
7712
+ data: { matched, missing, detected, score, summary, against }
7713
+ },
7714
+ 200
7715
+ );
7716
+ }
7717
+ );
7718
+ }
7430
7719
  const app$2 = new OpenAPIHono();
7431
7720
  registerFeedRoute(app$2);
7432
7721
  registerPreflightRoute(app$2);
@@ -7443,6 +7732,7 @@ registerBlockedRoutes(app$2);
7443
7732
  registerInsightsRoute(app$2);
7444
7733
  registerLocationsRoute(app$2);
7445
7734
  registerImportRoute(app$2);
7735
+ registerUserSkillRoutes(app$2);
7446
7736
  registerAnswerRoutes(app$2);
7447
7737
  registerOwnerRoutes(app$2);
7448
7738
  const jobRoutes = app$2;
@@ -7556,6 +7846,7 @@ const ERASED_TABLES = [
7556
7846
  { table: "mail_reconcile_state", sql: "DELETE FROM mail_reconcile_state WHERE user_id = ?1" },
7557
7847
  { table: "mail_unmatched", sql: "DELETE FROM mail_unmatched WHERE user_id = ?1" },
7558
7848
  { table: "blocked_companies", sql: "DELETE FROM blocked_companies WHERE user_id = ?1" },
7849
+ { table: "user_skills", sql: "DELETE FROM user_skills WHERE user_id = ?1" },
7559
7850
  { table: "owner_name_cache", sql: "DELETE FROM owner_name_cache WHERE user_id = ?1" }
7560
7851
  ];
7561
7852
  async function eraseUser(db, userId) {
@@ -7643,6 +7934,7 @@ export {
7643
7934
  AddJobEventSchema,
7644
7935
  AddProfileCompanyResponseSchema,
7645
7936
  AddProfileCompanySchema,
7937
+ AddSkillSchema,
7646
7938
  AnswerResponseSchema,
7647
7939
  AnswerSchema,
7648
7940
  AnswersResponseSchema,
@@ -7681,6 +7973,7 @@ export {
7681
7973
  JobEventSchema,
7682
7974
  JobEventsResponseSchema,
7683
7975
  JobFeedbackResponseSchema,
7976
+ JobMatchResponseSchema,
7684
7977
  JobResponseSchema,
7685
7978
  JobStateReadSchema,
7686
7979
  JobStateResponseSchema,
@@ -7714,6 +8007,10 @@ export {
7714
8007
  SetJobFeedbackSchema,
7715
8008
  SetJobStateSchema,
7716
8009
  SetTrackingSchema,
8010
+ SkillProficiencySchema,
8011
+ SkillResponseSchema,
8012
+ SkillSchema,
8013
+ SkillsResponseSchema,
7717
8014
  TrackingResponseSchema,
7718
8015
  TrackingSchema,
7719
8016
  UnansweredQuestionSchema,
@@ -1 +1 @@
1
- {"version":3,"file":"account.d.ts","sourceRoot":"","sources":["../../src/routes/account.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8DG;AACH,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAErD,mFAAmF;AACnF,eAAO,MAAM,aAAa,EAAE,SAAS;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,EA0BlE,CAAC;AAEF;;;GAGG;AACH,wBAAsB,SAAS,CAAC,EAAE,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAO/F;AAyBD,eAAO,MAAM,aAAa,oCAAM,CAAC"}
1
+ {"version":3,"file":"account.d.ts","sourceRoot":"","sources":["../../src/routes/account.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8DG;AACH,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAErD,mFAAmF;AACnF,eAAO,MAAM,aAAa,EAAE,SAAS;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,EA2BlE,CAAC;AAEF;;;GAGG;AACH,wBAAsB,SAAS,CAAC,EAAE,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAO/F;AAyBD,eAAO,MAAM,aAAa,oCAAM,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"applications.d.ts","sourceRoot":"","sources":["../../../src/routes/jobs/applications.ts"],"names":[],"mappings":"AAaA,OAAO,EAKN,KAAK,OAAO,EAEZ,MAAM,aAAa,CAAC;AAwCrB,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAUhF;AAiJD,wBAAgB,yBAAyB,CAAC,GAAG,EAAE,OAAO,GAAG,IAAI,CA+e5D"}
1
+ {"version":3,"file":"applications.d.ts","sourceRoot":"","sources":["../../../src/routes/jobs/applications.ts"],"names":[],"mappings":"AAcA,OAAO,EAKN,KAAK,OAAO,EAEZ,MAAM,aAAa,CAAC;AAwCrB,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAUhF;AAiHD,wBAAgB,yBAAyB,CAAC,GAAG,EAAE,OAAO,GAAG,IAAI,CA+e5D"}
@@ -1 +1 @@
1
- {"version":3,"file":"detail.d.ts","sourceRoot":"","sources":["../../../src/routes/jobs/detail.ts"],"names":[],"mappings":"AAWA,OAAO,EAON,KAAK,OAAO,EACZ,MAAM,aAAa,CAAC;AAErB,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,OAAO,GAAG,IAAI,CAsKtD"}
1
+ {"version":3,"file":"detail.d.ts","sourceRoot":"","sources":["../../../src/routes/jobs/detail.ts"],"names":[],"mappings":"AAYA,OAAO,EAON,KAAK,OAAO,EACZ,MAAM,aAAa,CAAC;AAErB,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,OAAO,GAAG,IAAI,CAgLtD"}
@@ -1,3 +1,9 @@
1
1
  import { type JobsApp } from './shared.js';
2
+ /**
3
+ * Free-text facts a form asks for that are not contact details: optional
4
+ * strings, each capped so one field cannot fill the row. JobPulse's profile
5
+ * carried these; master_resume_text is the whole résumé as plain text.
6
+ */
7
+ export declare const PROFILE_TEXT_LIMITS: Readonly<Record<string, number>>;
2
8
  export declare function registerFillRoutes(app: JobsApp): void;
3
9
  //# sourceMappingURL=fill.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"fill.d.ts","sourceRoot":"","sources":["../../../src/routes/jobs/fill.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAqD,KAAK,OAAO,EAAE,MAAM,aAAa,CAAC;AA+B9F,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,OAAO,QA0G9C"}
1
+ {"version":3,"file":"fill.d.ts","sourceRoot":"","sources":["../../../src/routes/jobs/fill.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAqD,KAAK,OAAO,EAAE,MAAM,aAAa,CAAC;AAiB9F;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAKhE,CAAC;AA2BF,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,OAAO,QA4G9C"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/routes/jobs/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAyChD,eAAO,MAAM,SAAS,oCAAM,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/routes/jobs/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AA2ChD,eAAO,MAAM,SAAS,oCAAM,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"insights.d.ts","sourceRoot":"","sources":["../../../src/routes/jobs/insights.ts"],"names":[],"mappings":"AAsBA,OAAO,EAKN,KAAK,OAAO,EACZ,MAAM,aAAa,CAAC;AAQrB,iEAAiE;AACjE,wBAAgB,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAK1C;AAgCD,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,OAAO,GAAG,IAAI,CA0KxD"}
1
+ {"version":3,"file":"insights.d.ts","sourceRoot":"","sources":["../../../src/routes/jobs/insights.ts"],"names":[],"mappings":"AAsBA,OAAO,EAKN,KAAK,OAAO,EACZ,MAAM,aAAa,CAAC;AAQrB,iEAAiE;AACjE,wBAAgB,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAK1C;AAqBD,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,OAAO,GAAG,IAAI,CA0KxD"}
@@ -1 +1 @@
1
- {"version":3,"file":"pipeline.d.ts","sourceRoot":"","sources":["../../../src/routes/jobs/pipeline.ts"],"names":[],"mappings":"AA+BA,OAAO,EAMN,KAAK,OAAO,EACZ,MAAM,aAAa,CAAC;AAmCrB,MAAM,WAAW,WAAW;IAC3B,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;CAC7B;AAGD,eAAO,MAAM,aAAa,+DAA+D,CAAC;AAqB1F,wBAAgB,UAAU,CAAC,CAAC,EAAE,WAAW;;;;;;EAQxC;AAgCD,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,OAAO,GAAG,IAAI,CAgTzD"}
1
+ {"version":3,"file":"pipeline.d.ts","sourceRoot":"","sources":["../../../src/routes/jobs/pipeline.ts"],"names":[],"mappings":"AAgCA,OAAO,EAMN,KAAK,OAAO,EACZ,MAAM,aAAa,CAAC;AAmCrB,MAAM,WAAW,WAAW;IAC3B,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;CAC7B;AAGD,eAAO,MAAM,aAAa,+DAA+D,CAAC;AAqB1F,wBAAgB,UAAU,CAAC,CAAC,EAAE,WAAW;;;;;;EAQxC;AAgCD,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,OAAO,GAAG,IAAI,CAuTzD"}
@@ -0,0 +1,3 @@
1
+ import { type JobsApp } from './shared.js';
2
+ export declare function registerUserSkillRoutes(app: JobsApp): void;
3
+ //# sourceMappingURL=userSkills.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"userSkills.d.ts","sourceRoot":"","sources":["../../../src/routes/jobs/userSkills.ts"],"names":[],"mappings":"AAwBA,OAAO,EAKN,KAAK,OAAO,EACZ,MAAM,aAAa,CAAC;AA+BrB,wBAAgB,uBAAuB,CAAC,GAAG,EAAE,OAAO,GAAG,IAAI,CAyM1D"}
package/dist/schemas.d.ts CHANGED
@@ -409,6 +409,8 @@ export declare const JobDetailSchema: z.ZodObject<{
409
409
  contact_name: z.ZodNullable<z.ZodString>;
410
410
  contact_email: z.ZodNullable<z.ZodString>;
411
411
  }, z.core.$strip>>;
412
+ last_seen_at: z.ZodNullable<z.ZodString>;
413
+ closed: z.ZodBoolean;
412
414
  }, z.core.$strip>;
413
415
  export declare const FEEDBACK_REASONS: readonly ["pay", "location", "stack", "domain", "level", "company", "comp", "fit", "other"];
414
416
  export declare const SetJobFeedbackSchema: z.ZodObject<{
@@ -670,6 +672,8 @@ export declare const JobResponseSchema: z.ZodObject<{
670
672
  contact_name: z.ZodNullable<z.ZodString>;
671
673
  contact_email: z.ZodNullable<z.ZodString>;
672
674
  }, z.core.$strip>>;
675
+ last_seen_at: z.ZodNullable<z.ZodString>;
676
+ closed: z.ZodBoolean;
673
677
  }, z.core.$strip>;
674
678
  }, z.core.$strip>;
675
679
  }, z.core.$strip>;
@@ -1328,6 +1332,8 @@ export declare const PipelineItemSchema: z.ZodObject<{
1328
1332
  }>>;
1329
1333
  applied_at: z.ZodNullable<z.ZodString>;
1330
1334
  last_event_at: z.ZodNullable<z.ZodString>;
1335
+ last_seen_at: z.ZodNullable<z.ZodString>;
1336
+ closed: z.ZodBoolean;
1331
1337
  }, z.core.$strip>;
1332
1338
  export declare const PipelineResponseSchema: z.ZodObject<{
1333
1339
  success: z.ZodLiteral<true>;
@@ -1371,6 +1377,8 @@ export declare const PipelineResponseSchema: z.ZodObject<{
1371
1377
  }>>;
1372
1378
  applied_at: z.ZodNullable<z.ZodString>;
1373
1379
  last_event_at: z.ZodNullable<z.ZodString>;
1380
+ last_seen_at: z.ZodNullable<z.ZodString>;
1381
+ closed: z.ZodBoolean;
1374
1382
  }, z.core.$strip>>;
1375
1383
  }, z.core.$strip>;
1376
1384
  }, z.core.$strip>;
@@ -1468,4 +1476,76 @@ export declare const InsightsResponseSchema: z.ZodObject<{
1468
1476
  skill_postings: z.ZodNumber;
1469
1477
  }, z.core.$strip>;
1470
1478
  }, z.core.$strip>;
1479
+ export declare const SkillProficiencySchema: z.ZodEnum<{
1480
+ beginner: "beginner";
1481
+ intermediate: "intermediate";
1482
+ expert: "expert";
1483
+ }>;
1484
+ export declare const SkillSchema: z.ZodObject<{
1485
+ id: z.ZodNumber;
1486
+ name: z.ZodString;
1487
+ category: z.ZodNullable<z.ZodString>;
1488
+ proficiency: z.ZodEnum<{
1489
+ beginner: "beginner";
1490
+ intermediate: "intermediate";
1491
+ expert: "expert";
1492
+ }>;
1493
+ created_at: z.ZodString;
1494
+ }, z.core.$strip>;
1495
+ export declare const AddSkillSchema: z.ZodObject<{
1496
+ name: z.ZodString;
1497
+ category: z.ZodOptional<z.ZodString>;
1498
+ proficiency: z.ZodDefault<z.ZodEnum<{
1499
+ beginner: "beginner";
1500
+ intermediate: "intermediate";
1501
+ expert: "expert";
1502
+ }>>;
1503
+ }, z.core.$strip>;
1504
+ export declare const SkillsResponseSchema: z.ZodObject<{
1505
+ success: z.ZodLiteral<true>;
1506
+ data: z.ZodObject<{
1507
+ skills: z.ZodArray<z.ZodObject<{
1508
+ id: z.ZodNumber;
1509
+ name: z.ZodString;
1510
+ category: z.ZodNullable<z.ZodString>;
1511
+ proficiency: z.ZodEnum<{
1512
+ beginner: "beginner";
1513
+ intermediate: "intermediate";
1514
+ expert: "expert";
1515
+ }>;
1516
+ created_at: z.ZodString;
1517
+ }, z.core.$strip>>;
1518
+ }, z.core.$strip>;
1519
+ }, z.core.$strip>;
1520
+ export declare const SkillResponseSchema: z.ZodObject<{
1521
+ success: z.ZodLiteral<true>;
1522
+ data: z.ZodObject<{
1523
+ skill: z.ZodObject<{
1524
+ id: z.ZodNumber;
1525
+ name: z.ZodString;
1526
+ category: z.ZodNullable<z.ZodString>;
1527
+ proficiency: z.ZodEnum<{
1528
+ beginner: "beginner";
1529
+ intermediate: "intermediate";
1530
+ expert: "expert";
1531
+ }>;
1532
+ created_at: z.ZodString;
1533
+ }, z.core.$strip>;
1534
+ }, z.core.$strip>;
1535
+ }, z.core.$strip>;
1536
+ export declare const JobMatchResponseSchema: z.ZodObject<{
1537
+ success: z.ZodLiteral<true>;
1538
+ data: z.ZodObject<{
1539
+ matched: z.ZodArray<z.ZodString>;
1540
+ missing: z.ZodArray<z.ZodString>;
1541
+ detected: z.ZodArray<z.ZodString>;
1542
+ score: z.ZodNumber;
1543
+ summary: z.ZodString;
1544
+ against: z.ZodEnum<{
1545
+ none: "none";
1546
+ skills: "skills";
1547
+ profile_stack: "profile_stack";
1548
+ }>;
1549
+ }, z.core.$strip>;
1550
+ }, z.core.$strip>;
1471
1551
  //# sourceMappingURL=schemas.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../src/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,mBAAmB,CAAC;AAItC,eAAO,MAAM,mBAAmB;;;;iBAA8B,CAAC;AAO/D,eAAO,MAAM,oBAAoB;;;;;;;;iBAMN,CAAC;AAS5B,eAAO,MAAM,kBAAkB;;;;EAA8D,CAAC;AAC9F,eAAO,MAAM,eAAe;;;;;;;;;;;;EAAiE,CAAC;AAE9F,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAcN,CAAC;AAErB,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAQN,CAAC;AAE3B,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAAyD,CAAC;AAE1F,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;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Ac;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAiCN,CAAC;AAEtB,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAAgD,CAAC;AAMpF,eAAO,MAAM,sBAAsB;;;;EAAiD,CAAC;AAErF,eAAO,MAAM,WAAW;;;;;;;;;;iBAQN,CAAC;AAEnB,eAAO,MAAM,cAAc;;;;;;;;iBAMN,CAAC;AAEtB,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;iBAEhC,CAAC;AACF,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;iBAA+D,CAAC;AAEhG,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;iBAcN,CAAC"}
package/dist/skills.d.ts CHANGED
@@ -20,4 +20,9 @@
20
20
  export declare function extractSkills(text: string): string[];
21
21
  /** Fold a person's own spelling ("K8s", "Postgres") onto the vocabulary's name. */
22
22
  export declare function canonicalSkill(term: string): string;
23
+ /**
24
+ * A JSON list column (profiles.stack, profiles.keywords) as strings. Malformed
25
+ * is empty, the default migration 0011 gives every profile.
26
+ */
27
+ export declare function parseStringList(raw: string | null | undefined): string[];
23
28
  //# sourceMappingURL=skills.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"skills.d.ts","sourceRoot":"","sources":["../src/skills.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAwHH,yEAAyE;AACzE,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAMpD;AAED,mFAAmF;AACnF,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAKnD"}
1
+ {"version":3,"file":"skills.d.ts","sourceRoot":"","sources":["../src/skills.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAwHH,yEAAyE;AACzE,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAMpD;AAED,mFAAmF;AACnF,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAKnD;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,EAAE,CASxE"}
@@ -0,0 +1,18 @@
1
+ -- A person's own skills list (GET/POST/DELETE /skills), the inventory
2
+ -- GET /jobs/:id/match compares a posting against. JobPulse kept it in local
3
+ -- SQLite; this makes it per-user in D1.
4
+ --
5
+ -- name_key is the vocabulary's canonical spelling (worker/src/skills.ts
6
+ -- canonicalSkill: "K8s" and "Kubernetes" are one skill), and is what a
7
+ -- posting's detected skills are matched on. One row per person per skill.
8
+ CREATE TABLE user_skills (
9
+ id INTEGER PRIMARY KEY AUTOINCREMENT,
10
+ user_id TEXT NOT NULL,
11
+ name TEXT NOT NULL,
12
+ name_key TEXT NOT NULL,
13
+ category TEXT,
14
+ proficiency TEXT NOT NULL DEFAULT 'intermediate'
15
+ CHECK (proficiency IN ('beginner', 'intermediate', 'expert')),
16
+ created_at TEXT NOT NULL,
17
+ UNIQUE (user_id, name_key)
18
+ );
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@hadoku/jobplatform-worker",
3
- "version": "2.32.43",
4
- "gitHead": "1894003df9c23d34d2488f9104836c8e9384e267",
3
+ "version": "2.32.45",
4
+ "gitHead": "8963df625c5750af5fa17bb22da399db180a4ec0",
5
5
  "description": "Job listings aggregation and tracking dashboard - Worker package",
6
6
  "license": "MIT",
7
7
  "type": "module",