@cavuno/board 1.40.0 → 1.42.0

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.
Files changed (48) hide show
  1. package/dist/{_spec-DRbgPIlN.d.mts → _spec-LdkTxfx0.d.mts} +55 -0
  2. package/dist/{_spec-DRbgPIlN.d.ts → _spec-LdkTxfx0.d.ts} +55 -0
  3. package/dist/{board-DCiNpgFf.d.mts → board-Cs93Lf23.d.mts} +1 -1
  4. package/dist/{board-BxPUtrOl.d.ts → board-FxC9Wdhi.d.ts} +1 -1
  5. package/dist/filters.d.mts +2 -2
  6. package/dist/filters.d.ts +2 -2
  7. package/dist/format.d.mts +3 -3
  8. package/dist/format.d.ts +3 -3
  9. package/dist/go.d.mts +65 -0
  10. package/dist/go.d.ts +65 -0
  11. package/dist/go.js +130 -0
  12. package/dist/go.mjs +107 -0
  13. package/dist/index.d.mts +44 -10
  14. package/dist/index.d.ts +44 -10
  15. package/dist/index.js +42 -1
  16. package/dist/index.mjs +42 -1
  17. package/dist/{jobs-DhePKSRe.d.mts → jobs-BtazrWfv.d.mts} +1 -1
  18. package/dist/{jobs-DAGAVHQL.d.ts → jobs-TIAPH3Ol.d.ts} +1 -1
  19. package/dist/paths.d.mts +25 -1
  20. package/dist/paths.d.ts +25 -1
  21. package/dist/paths.js +20 -1
  22. package/dist/paths.mjs +20 -1
  23. package/dist/roles-vY0AXhoc.d.mts +82 -0
  24. package/dist/roles-vY0AXhoc.d.ts +82 -0
  25. package/dist/route-contract.d.mts +257 -0
  26. package/dist/route-contract.d.ts +257 -0
  27. package/dist/route-contract.js +1131 -0
  28. package/dist/route-contract.mjs +1108 -0
  29. package/dist/{salaries-cqb78kg0.d.ts → salaries-BEAqkaFt.d.ts} +2 -2
  30. package/dist/{salaries-D6SUVMmt.d.mts → salaries-CB9Ve4kS.d.mts} +2 -2
  31. package/dist/{search-BalPAS0P.d.ts → search-DWmHHXn8.d.ts} +1 -1
  32. package/dist/{search-DYUQzCq_.d.mts → search-YhoVpXFY.d.mts} +1 -1
  33. package/dist/seo.d.mts +4 -4
  34. package/dist/seo.d.ts +4 -4
  35. package/dist/server.d.mts +5 -5
  36. package/dist/server.d.ts +5 -5
  37. package/dist/sitemap.d.mts +5 -5
  38. package/dist/sitemap.d.ts +5 -5
  39. package/dist/sitemap.js +8 -1
  40. package/dist/sitemap.mjs +8 -1
  41. package/dist/suggest.d.mts +2 -2
  42. package/dist/suggest.d.ts +2 -2
  43. package/dist/well-known.d.mts +113 -0
  44. package/dist/well-known.d.ts +113 -0
  45. package/dist/well-known.js +561 -0
  46. package/dist/well-known.mjs +538 -0
  47. package/package.json +31 -1
  48. package/skills/manifest.json +1 -1
@@ -1995,6 +1995,28 @@ interface components {
1995
1995
  */
1996
1996
  public: string | null;
1997
1997
  };
1998
+ EmployerJobStat: {
1999
+ /** @enum {string} */
2000
+ object: "employer_job_stat";
2001
+ /** @description The Convex job id these stats belong to. */
2002
+ jobId: string;
2003
+ /** @description Job-detail page-views over the all-time window. */
2004
+ views: number;
2005
+ /** @description Apply-click events over the all-time window. */
2006
+ applyClicks: number;
2007
+ /** @description Native ATS application count, or `null` for an external-apply job (no native pipeline). */
2008
+ applications: number | null;
2009
+ };
2010
+ EmployerJobStatsPoint: {
2011
+ /** @enum {string} */
2012
+ object: "employer_job_stats_point";
2013
+ /** @description The UTC day this bucket covers (`YYYY-MM-DD`). */
2014
+ date: string;
2015
+ /** @description Job-detail page-views on this day. */
2016
+ views: number;
2017
+ /** @description Apply-click events on this day. */
2018
+ applyClicks: number;
2019
+ };
1998
2020
  EmployerJobSummary: {
1999
2021
  /** @description Unique identifier for the object. Use this value as the `{id}` path parameter for the job endpoints (e.g. `GET /v1/jobs/{id}`). */
2000
2022
  id: string;
@@ -4818,6 +4840,39 @@ interface components {
4818
4840
  /** @description Space-separated list of scopes granted on the issued token. */
4819
4841
  scope: string;
4820
4842
  };
4843
+ Transaction: {
4844
+ id: string;
4845
+ /** @enum {string} */
4846
+ object: "transaction";
4847
+ /** @enum {string} */
4848
+ kind: "card_post" | "invoice" | "subscription";
4849
+ /** @enum {string} */
4850
+ status: "paid" | "open" | "void" | "uncollectible";
4851
+ /** @enum {string} */
4852
+ method: "card" | "invoice";
4853
+ /** @description Amount in Stripe minor units (cents for most currencies). */
4854
+ amountCents: number;
4855
+ currency: string;
4856
+ description: string;
4857
+ customerLabel: string;
4858
+ customerEmail: string | null;
4859
+ /** @description ISO-8601 transaction date. */
4860
+ date: string;
4861
+ /** @description ISO-8601 invoice due date, or null. Past-due is client-derived from this field. */
4862
+ invoiceDueAt: string | null;
4863
+ stripeInvoiceId: string | null;
4864
+ hostedInvoiceUrl: string | null;
4865
+ receiptUrl: string | null;
4866
+ methodBrand: string | null;
4867
+ methodLast4: string | null;
4868
+ methodType: string | null;
4869
+ /** @enum {string|null} */
4870
+ publishTiming: "on_issue" | "on_payment" | null;
4871
+ /** @description jobOrders id when this row is order-sourced. */
4872
+ orderId: string | null;
4873
+ /** @description employerSubscriptions id when this row is a subscription renewal. Cross-link: GET /v1/employer-subscriptions/:id. */
4874
+ subscriptionId: string | null;
4875
+ };
4821
4876
  TransferOwnershipBody: {
4822
4877
  /** @description The user ID of the member who will become the primary owner. */
4823
4878
  newOwnerUserId: string;
@@ -1995,6 +1995,28 @@ interface components {
1995
1995
  */
1996
1996
  public: string | null;
1997
1997
  };
1998
+ EmployerJobStat: {
1999
+ /** @enum {string} */
2000
+ object: "employer_job_stat";
2001
+ /** @description The Convex job id these stats belong to. */
2002
+ jobId: string;
2003
+ /** @description Job-detail page-views over the all-time window. */
2004
+ views: number;
2005
+ /** @description Apply-click events over the all-time window. */
2006
+ applyClicks: number;
2007
+ /** @description Native ATS application count, or `null` for an external-apply job (no native pipeline). */
2008
+ applications: number | null;
2009
+ };
2010
+ EmployerJobStatsPoint: {
2011
+ /** @enum {string} */
2012
+ object: "employer_job_stats_point";
2013
+ /** @description The UTC day this bucket covers (`YYYY-MM-DD`). */
2014
+ date: string;
2015
+ /** @description Job-detail page-views on this day. */
2016
+ views: number;
2017
+ /** @description Apply-click events on this day. */
2018
+ applyClicks: number;
2019
+ };
1998
2020
  EmployerJobSummary: {
1999
2021
  /** @description Unique identifier for the object. Use this value as the `{id}` path parameter for the job endpoints (e.g. `GET /v1/jobs/{id}`). */
2000
2022
  id: string;
@@ -4818,6 +4840,39 @@ interface components {
4818
4840
  /** @description Space-separated list of scopes granted on the issued token. */
4819
4841
  scope: string;
4820
4842
  };
4843
+ Transaction: {
4844
+ id: string;
4845
+ /** @enum {string} */
4846
+ object: "transaction";
4847
+ /** @enum {string} */
4848
+ kind: "card_post" | "invoice" | "subscription";
4849
+ /** @enum {string} */
4850
+ status: "paid" | "open" | "void" | "uncollectible";
4851
+ /** @enum {string} */
4852
+ method: "card" | "invoice";
4853
+ /** @description Amount in Stripe minor units (cents for most currencies). */
4854
+ amountCents: number;
4855
+ currency: string;
4856
+ description: string;
4857
+ customerLabel: string;
4858
+ customerEmail: string | null;
4859
+ /** @description ISO-8601 transaction date. */
4860
+ date: string;
4861
+ /** @description ISO-8601 invoice due date, or null. Past-due is client-derived from this field. */
4862
+ invoiceDueAt: string | null;
4863
+ stripeInvoiceId: string | null;
4864
+ hostedInvoiceUrl: string | null;
4865
+ receiptUrl: string | null;
4866
+ methodBrand: string | null;
4867
+ methodLast4: string | null;
4868
+ methodType: string | null;
4869
+ /** @enum {string|null} */
4870
+ publishTiming: "on_issue" | "on_payment" | null;
4871
+ /** @description jobOrders id when this row is order-sourced. */
4872
+ orderId: string | null;
4873
+ /** @description employerSubscriptions id when this row is a subscription renewal. Cross-link: GET /v1/employer-subscriptions/:id. */
4874
+ subscriptionId: string | null;
4875
+ };
4821
4876
  TransferOwnershipBody: {
4822
4877
  /** @description The user ID of the member who will become the primary owner. */
4823
4878
  newOwnerUserId: string;
@@ -1,4 +1,4 @@
1
- import { S as Schemas } from './_spec-DRbgPIlN.mjs';
1
+ import { S as Schemas } from './_spec-LdkTxfx0.mjs';
2
2
 
3
3
  type PublicBoard = Schemas['PublicBoardContext'];
4
4
  type PublicBoardFeatures = PublicBoard['features'];
@@ -1,4 +1,4 @@
1
- import { S as Schemas } from './_spec-DRbgPIlN.js';
1
+ import { S as Schemas } from './_spec-LdkTxfx0.js';
2
2
 
3
3
  type PublicBoard = Schemas['PublicBoardContext'];
4
4
  type PublicBoardFeatures = PublicBoard['features'];
@@ -1,6 +1,6 @@
1
1
  import { B as BoardLabelOverrides } from './ui-copy-CKfFTtLk.mjs';
2
- import { J as JobSort, E as EmploymentType, R as RemoteOption, S as Seniority } from './jobs-DhePKSRe.mjs';
3
- import './_spec-DRbgPIlN.mjs';
2
+ import { J as JobSort, E as EmploymentType, R as RemoteOption, S as Seniority } from './jobs-BtazrWfv.mjs';
3
+ import './_spec-LdkTxfx0.mjs';
4
4
 
5
5
  declare const REMOTE_OPTIONS: readonly RemoteOption[];
6
6
  /**
package/dist/filters.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { B as BoardLabelOverrides } from './ui-copy-CKfFTtLk.js';
2
- import { J as JobSort, E as EmploymentType, R as RemoteOption, S as Seniority } from './jobs-DAGAVHQL.js';
3
- import './_spec-DRbgPIlN.js';
2
+ import { J as JobSort, E as EmploymentType, R as RemoteOption, S as Seniority } from './jobs-TIAPH3Ol.js';
3
+ import './_spec-LdkTxfx0.js';
4
4
 
5
5
  declare const REMOTE_OPTIONS: readonly RemoteOption[];
6
6
  /**
package/dist/format.d.mts CHANGED
@@ -1,8 +1,8 @@
1
- import { P as PublicJob, a as PublicJobCard, C as CustomFieldValues } from './jobs-DhePKSRe.mjs';
1
+ import { P as PublicJob, a as PublicJobCard, C as CustomFieldValues } from './jobs-BtazrWfv.mjs';
2
2
  import { B as BoardLabelOverrides } from './ui-copy-CKfFTtLk.mjs';
3
3
  export { A as AlertsCopy, a as ApplyCopy, b as BlogCopy, c as BreadcrumbsCopy, C as CopyLinkCopy, E as EntityCopy, F as FooterCopy, J as JobCardCopy, d as JobDetailCopy, e as JobSearchCopy, N as NavCopy, P as PUBLIC_LABEL_GROUPS, f as PaginationCopy, S as SalaryCopy, U as UiCopy, u as uiCopy } from './ui-copy-CKfFTtLk.mjs';
4
- import { C as CustomFieldDefinition } from './board-DCiNpgFf.mjs';
5
- import './_spec-DRbgPIlN.mjs';
4
+ import { C as CustomFieldDefinition } from './board-Cs93Lf23.mjs';
5
+ import './_spec-LdkTxfx0.mjs';
6
6
 
7
7
  /**
8
8
  * Date display helpers in the board language (required leading parameter,
package/dist/format.d.ts CHANGED
@@ -1,8 +1,8 @@
1
- import { P as PublicJob, a as PublicJobCard, C as CustomFieldValues } from './jobs-DAGAVHQL.js';
1
+ import { P as PublicJob, a as PublicJobCard, C as CustomFieldValues } from './jobs-TIAPH3Ol.js';
2
2
  import { B as BoardLabelOverrides } from './ui-copy-CKfFTtLk.js';
3
3
  export { A as AlertsCopy, a as ApplyCopy, b as BlogCopy, c as BreadcrumbsCopy, C as CopyLinkCopy, E as EntityCopy, F as FooterCopy, J as JobCardCopy, d as JobDetailCopy, e as JobSearchCopy, N as NavCopy, P as PUBLIC_LABEL_GROUPS, f as PaginationCopy, S as SalaryCopy, U as UiCopy, u as uiCopy } from './ui-copy-CKfFTtLk.js';
4
- import { C as CustomFieldDefinition } from './board-BxPUtrOl.js';
5
- import './_spec-DRbgPIlN.js';
4
+ import { C as CustomFieldDefinition } from './board-FxC9Wdhi.js';
5
+ import './_spec-LdkTxfx0.js';
6
6
 
7
7
  /**
8
8
  * Date display helpers in the board language (required leading parameter,
package/dist/go.d.mts ADDED
@@ -0,0 +1,65 @@
1
+ /**
2
+ * Pure `/go` indirection for self-deployed SDK boards (LNK-04).
3
+ *
4
+ * Mirrors the hosted-app contract:
5
+ * - `/go/job/<id>` → 302 to jobDetailPath(companySlug, jobSlug)
6
+ * - `/go/alerts-manage` / `/go/alerts-confirm` → 302 carrying query
7
+ * - unknown / unresolvable → 302 to BOARD_PATHS.jobs
8
+ * - every response: `X-Robots-Tag: noindex, nofollow`
9
+ *
10
+ * Framework-portable: takes a standard Request, returns a standard
11
+ * Response. No Next.js imports (same discipline as the sitemap walker).
12
+ */
13
+ interface ResolvedJobSlugs {
14
+ companySlug: string;
15
+ jobSlug: string;
16
+ }
17
+ interface GoRedirectResult {
18
+ location: string;
19
+ status: 302;
20
+ }
21
+ /**
22
+ * Optional job-id → slugs lookup. The public Board API currently exposes
23
+ * job retrieve **by slug only** (`board.jobs.retrieve(jobSlug)`); there is
24
+ * no publishable-key endpoint that resolves an immutable job id to slugs.
25
+ *
26
+ * When `lookupJob` is omitted, `/go/job/<id>` degrades to the jobs index
27
+ * (safe, never 404). Pass a custom lookup when a data-plane endpoint lands
28
+ * (see TODO(LNK-04-followup)).
29
+ */
30
+ type GoJobLookup = (jobId: string) => Promise<ResolvedJobSlugs | null> | ResolvedJobSlugs | null;
31
+ interface CreateGoHandlerConfig {
32
+ /**
33
+ * Optional job resolver. Injected so tests can fake the data client and
34
+ * so callers can wire a future Board API id-lookup without an SDK release.
35
+ */
36
+ lookupJob?: GoJobLookup;
37
+ /**
38
+ * Base origin used to absolutize Location (e.g. `https://jobs.example.com`).
39
+ * When omitted, Location is absolute against the incoming request URL —
40
+ * correct for same-host mounts.
41
+ */
42
+ origin?: string;
43
+ }
44
+ declare function goResponseHeaders(): Record<string, string>;
45
+ /**
46
+ * Pure role → location resolver. Shared by the handler so unit tests can
47
+ * assert the contract without spinning a Request.
48
+ */
49
+ declare function resolveGoRedirect(parts: readonly string[] | undefined, search: string, resolvedJob: ResolvedJobSlugs | null): GoRedirectResult;
50
+ /**
51
+ * Create a `(request) => Response` handler the starter mounts at `/go/*`.
52
+ *
53
+ * @example
54
+ * // Next.js App Router
55
+ * import { createGoHandler } from '@cavuno/board/go';
56
+ * export const GET = createGoHandler({});
57
+ *
58
+ * // With a future id-lookup:
59
+ * export const GET = createGoHandler({
60
+ * lookupJob: async (id) => board.jobs.retrieveById?.(id) ?? null,
61
+ * });
62
+ */
63
+ declare function createGoHandler(config?: CreateGoHandlerConfig): (request: Request) => Promise<Response>;
64
+
65
+ export { type CreateGoHandlerConfig, type GoJobLookup, type GoRedirectResult, type ResolvedJobSlugs, createGoHandler, goResponseHeaders, resolveGoRedirect };
package/dist/go.d.ts ADDED
@@ -0,0 +1,65 @@
1
+ /**
2
+ * Pure `/go` indirection for self-deployed SDK boards (LNK-04).
3
+ *
4
+ * Mirrors the hosted-app contract:
5
+ * - `/go/job/<id>` → 302 to jobDetailPath(companySlug, jobSlug)
6
+ * - `/go/alerts-manage` / `/go/alerts-confirm` → 302 carrying query
7
+ * - unknown / unresolvable → 302 to BOARD_PATHS.jobs
8
+ * - every response: `X-Robots-Tag: noindex, nofollow`
9
+ *
10
+ * Framework-portable: takes a standard Request, returns a standard
11
+ * Response. No Next.js imports (same discipline as the sitemap walker).
12
+ */
13
+ interface ResolvedJobSlugs {
14
+ companySlug: string;
15
+ jobSlug: string;
16
+ }
17
+ interface GoRedirectResult {
18
+ location: string;
19
+ status: 302;
20
+ }
21
+ /**
22
+ * Optional job-id → slugs lookup. The public Board API currently exposes
23
+ * job retrieve **by slug only** (`board.jobs.retrieve(jobSlug)`); there is
24
+ * no publishable-key endpoint that resolves an immutable job id to slugs.
25
+ *
26
+ * When `lookupJob` is omitted, `/go/job/<id>` degrades to the jobs index
27
+ * (safe, never 404). Pass a custom lookup when a data-plane endpoint lands
28
+ * (see TODO(LNK-04-followup)).
29
+ */
30
+ type GoJobLookup = (jobId: string) => Promise<ResolvedJobSlugs | null> | ResolvedJobSlugs | null;
31
+ interface CreateGoHandlerConfig {
32
+ /**
33
+ * Optional job resolver. Injected so tests can fake the data client and
34
+ * so callers can wire a future Board API id-lookup without an SDK release.
35
+ */
36
+ lookupJob?: GoJobLookup;
37
+ /**
38
+ * Base origin used to absolutize Location (e.g. `https://jobs.example.com`).
39
+ * When omitted, Location is absolute against the incoming request URL —
40
+ * correct for same-host mounts.
41
+ */
42
+ origin?: string;
43
+ }
44
+ declare function goResponseHeaders(): Record<string, string>;
45
+ /**
46
+ * Pure role → location resolver. Shared by the handler so unit tests can
47
+ * assert the contract without spinning a Request.
48
+ */
49
+ declare function resolveGoRedirect(parts: readonly string[] | undefined, search: string, resolvedJob: ResolvedJobSlugs | null): GoRedirectResult;
50
+ /**
51
+ * Create a `(request) => Response` handler the starter mounts at `/go/*`.
52
+ *
53
+ * @example
54
+ * // Next.js App Router
55
+ * import { createGoHandler } from '@cavuno/board/go';
56
+ * export const GET = createGoHandler({});
57
+ *
58
+ * // With a future id-lookup:
59
+ * export const GET = createGoHandler({
60
+ * lookupJob: async (id) => board.jobs.retrieveById?.(id) ?? null,
61
+ * });
62
+ */
63
+ declare function createGoHandler(config?: CreateGoHandlerConfig): (request: Request) => Promise<Response>;
64
+
65
+ export { type CreateGoHandlerConfig, type GoJobLookup, type GoRedirectResult, type ResolvedJobSlugs, createGoHandler, goResponseHeaders, resolveGoRedirect };
package/dist/go.js ADDED
@@ -0,0 +1,130 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/go/index.ts
21
+ var go_exports = {};
22
+ __export(go_exports, {
23
+ createGoHandler: () => createGoHandler,
24
+ goResponseHeaders: () => goResponseHeaders,
25
+ resolveGoRedirect: () => resolveGoRedirect
26
+ });
27
+ module.exports = __toCommonJS(go_exports);
28
+
29
+ // src/paths/index.ts
30
+ function jobDetailPath(companySlug, jobSlug) {
31
+ return `/companies/${companySlug}/jobs/${jobSlug}`;
32
+ }
33
+ var BOARD_PATHS = {
34
+ home: "/",
35
+ jobs: "/jobs",
36
+ companies: "/companies",
37
+ salaries: "/salaries",
38
+ salaryCompanies: "/salaries/companies",
39
+ salaryTitles: "/salaries/titles",
40
+ salarySkills: "/salaries/skills",
41
+ salaryLocations: "/salaries/locations",
42
+ blog: "/blog",
43
+ about: "/about",
44
+ privacyPolicy: "/privacy-policy",
45
+ termsOfService: "/terms-of-service",
46
+ cookiePolicy: "/cookie-policy",
47
+ impressum: "/impressum",
48
+ talent: "/talent",
49
+ employers: "/employers",
50
+ /**
51
+ * Alert-email surfaces (ADR-0090 D1/D4). Promoted out of raw literals in
52
+ * the job-alerts composer so /go indirection and email composition share
53
+ * one definition.
54
+ */
55
+ alertsManage: "/alerts/manage",
56
+ alertsConfirm: "/alerts/confirm"
57
+ };
58
+
59
+ // src/go/create-go-handler.ts
60
+ var NOINDEX_ROBOTS = "noindex, nofollow";
61
+ function goResponseHeaders() {
62
+ return {
63
+ "X-Robots-Tag": NOINDEX_ROBOTS,
64
+ "Cache-Control": "private, no-store"
65
+ };
66
+ }
67
+ function resolveGoRedirect(parts, search, resolvedJob) {
68
+ const role = parts?.[0];
69
+ const id = parts?.[1];
70
+ const query = search.startsWith("?") ? search : search ? `?${search}` : "";
71
+ if (role === "job") {
72
+ if (id && resolvedJob?.companySlug && resolvedJob.jobSlug) {
73
+ return {
74
+ location: jobDetailPath(resolvedJob.companySlug, resolvedJob.jobSlug),
75
+ status: 302
76
+ };
77
+ }
78
+ return { location: BOARD_PATHS.jobs, status: 302 };
79
+ }
80
+ if (role === "alerts-manage") {
81
+ return {
82
+ location: `${BOARD_PATHS.alertsManage}${query}`,
83
+ status: 302
84
+ };
85
+ }
86
+ if (role === "alerts-confirm") {
87
+ return {
88
+ location: `${BOARD_PATHS.alertsConfirm}${query}`,
89
+ status: 302
90
+ };
91
+ }
92
+ return { location: BOARD_PATHS.jobs, status: 302 };
93
+ }
94
+ function partsFromRequest(request) {
95
+ const { pathname } = new URL(request.url);
96
+ const segments = pathname.split("/").map((s) => s.trim()).filter(Boolean);
97
+ const goIdx = segments.findIndex((s) => s === "go");
98
+ if (goIdx >= 0) {
99
+ return segments.slice(goIdx + 1);
100
+ }
101
+ return segments;
102
+ }
103
+ function createGoHandler(config = {}) {
104
+ const { lookupJob, origin } = config;
105
+ return async function goHandler(request) {
106
+ const url = new URL(request.url);
107
+ const parts = partsFromRequest(request);
108
+ let resolvedJob = null;
109
+ if (parts[0] === "job" && parts[1]) {
110
+ if (lookupJob) {
111
+ try {
112
+ resolvedJob = await lookupJob(parts[1]) ?? null;
113
+ } catch {
114
+ resolvedJob = null;
115
+ }
116
+ } else {
117
+ resolvedJob = null;
118
+ }
119
+ }
120
+ const result = resolveGoRedirect(parts, url.search, resolvedJob);
121
+ const locationBase = origin ?? url.origin;
122
+ return new Response(null, {
123
+ status: result.status,
124
+ headers: {
125
+ ...goResponseHeaders(),
126
+ Location: new URL(result.location, locationBase).toString()
127
+ }
128
+ });
129
+ };
130
+ }
package/dist/go.mjs ADDED
@@ -0,0 +1,107 @@
1
+ // src/paths/index.ts
2
+ function jobDetailPath(companySlug, jobSlug) {
3
+ return `/companies/${companySlug}/jobs/${jobSlug}`;
4
+ }
5
+ var BOARD_PATHS = {
6
+ home: "/",
7
+ jobs: "/jobs",
8
+ companies: "/companies",
9
+ salaries: "/salaries",
10
+ salaryCompanies: "/salaries/companies",
11
+ salaryTitles: "/salaries/titles",
12
+ salarySkills: "/salaries/skills",
13
+ salaryLocations: "/salaries/locations",
14
+ blog: "/blog",
15
+ about: "/about",
16
+ privacyPolicy: "/privacy-policy",
17
+ termsOfService: "/terms-of-service",
18
+ cookiePolicy: "/cookie-policy",
19
+ impressum: "/impressum",
20
+ talent: "/talent",
21
+ employers: "/employers",
22
+ /**
23
+ * Alert-email surfaces (ADR-0090 D1/D4). Promoted out of raw literals in
24
+ * the job-alerts composer so /go indirection and email composition share
25
+ * one definition.
26
+ */
27
+ alertsManage: "/alerts/manage",
28
+ alertsConfirm: "/alerts/confirm"
29
+ };
30
+
31
+ // src/go/create-go-handler.ts
32
+ var NOINDEX_ROBOTS = "noindex, nofollow";
33
+ function goResponseHeaders() {
34
+ return {
35
+ "X-Robots-Tag": NOINDEX_ROBOTS,
36
+ "Cache-Control": "private, no-store"
37
+ };
38
+ }
39
+ function resolveGoRedirect(parts, search, resolvedJob) {
40
+ const role = parts?.[0];
41
+ const id = parts?.[1];
42
+ const query = search.startsWith("?") ? search : search ? `?${search}` : "";
43
+ if (role === "job") {
44
+ if (id && resolvedJob?.companySlug && resolvedJob.jobSlug) {
45
+ return {
46
+ location: jobDetailPath(resolvedJob.companySlug, resolvedJob.jobSlug),
47
+ status: 302
48
+ };
49
+ }
50
+ return { location: BOARD_PATHS.jobs, status: 302 };
51
+ }
52
+ if (role === "alerts-manage") {
53
+ return {
54
+ location: `${BOARD_PATHS.alertsManage}${query}`,
55
+ status: 302
56
+ };
57
+ }
58
+ if (role === "alerts-confirm") {
59
+ return {
60
+ location: `${BOARD_PATHS.alertsConfirm}${query}`,
61
+ status: 302
62
+ };
63
+ }
64
+ return { location: BOARD_PATHS.jobs, status: 302 };
65
+ }
66
+ function partsFromRequest(request) {
67
+ const { pathname } = new URL(request.url);
68
+ const segments = pathname.split("/").map((s) => s.trim()).filter(Boolean);
69
+ const goIdx = segments.findIndex((s) => s === "go");
70
+ if (goIdx >= 0) {
71
+ return segments.slice(goIdx + 1);
72
+ }
73
+ return segments;
74
+ }
75
+ function createGoHandler(config = {}) {
76
+ const { lookupJob, origin } = config;
77
+ return async function goHandler(request) {
78
+ const url = new URL(request.url);
79
+ const parts = partsFromRequest(request);
80
+ let resolvedJob = null;
81
+ if (parts[0] === "job" && parts[1]) {
82
+ if (lookupJob) {
83
+ try {
84
+ resolvedJob = await lookupJob(parts[1]) ?? null;
85
+ } catch {
86
+ resolvedJob = null;
87
+ }
88
+ } else {
89
+ resolvedJob = null;
90
+ }
91
+ }
92
+ const result = resolveGoRedirect(parts, url.search, resolvedJob);
93
+ const locationBase = origin ?? url.origin;
94
+ return new Response(null, {
95
+ status: result.status,
96
+ headers: {
97
+ ...goResponseHeaders(),
98
+ Location: new URL(result.location, locationBase).toString()
99
+ }
100
+ });
101
+ };
102
+ }
103
+ export {
104
+ createGoHandler,
105
+ goResponseHeaders,
106
+ resolveGoRedirect
107
+ };