@thejob/schema 2.1.3 → 2.1.5
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/.claude/settings.local.json +5 -5
- package/CLAUDE.md +85 -0
- package/dist/index.cjs +234 -138
- package/dist/index.d.cts +203 -129
- package/dist/index.d.ts +203 -129
- package/dist/index.js +198 -107
- package/package.json +1 -1
- package/src/index.ts +6 -0
- package/src/saved-search/saved-search.constant.ts +17 -0
- package/src/saved-search/saved-search.schema.ts +84 -0
- package/src/user/general-detail.schema.ts +27 -5
- package/src/user/user.constant.ts +20 -0
|
@@ -112,11 +112,11 @@
|
|
|
112
112
|
"Bash(grep -n 'data\\\\.dict\\\\|dict\\\\b\\\\|$props\\\\|export let' /home/nadeem/Documents/GitHub/thejob-svelte-ui/src/lib/onboarding/wizards/job-seeker-wizard.svelte)",
|
|
113
113
|
"Bash(grep -v \"^$\")",
|
|
114
114
|
"Bash(grep -E '^\\\\s+\"[a-zA-Z]+\":\\\\s*\\\\{$' src/lib/i18n/dictionaries/en.json)",
|
|
115
|
-
"Bash(sed -i 's|<title>Job search timeline -
|
|
116
|
-
"Bash(sed -i 's|<title>Job locations -
|
|
117
|
-
"Bash(sed -i 's|<title>Minimum salary -
|
|
118
|
-
"Bash(sed -i 's|<title>Job role -
|
|
119
|
-
"Bash(sed -i 's|<title>Experience level -
|
|
115
|
+
"Bash(sed -i 's|<title>Job search timeline - The Job</title>|<title>{\\(data.dict?.pageTitles?.preferencesUrgency ?? \"Job search timeline\"\\)} - {\\(data.dict?.pageTitles?.siteName ?? \"The Job\"\\)}</title>|' urgency/+page.svelte)",
|
|
116
|
+
"Bash(sed -i 's|<title>Job locations - The Job</title>|<title>{\\(data.dict?.pageTitles?.preferencesLocations ?? \"Job locations\"\\)} - {\\(data.dict?.pageTitles?.siteName ?? \"The Job\"\\)}</title>|' locations/+page.svelte)",
|
|
117
|
+
"Bash(sed -i 's|<title>Minimum salary - The Job</title>|<title>{\\(data.dict?.pageTitles?.preferencesSalary ?? \"Minimum salary\"\\)} - {\\(data.dict?.pageTitles?.siteName ?? \"The Job\"\\)}</title>|' salary/+page.svelte)",
|
|
118
|
+
"Bash(sed -i 's|<title>Job role - The Job</title>|<title>{\\(data.dict?.pageTitles?.preferencesRole ?? \"Job role\"\\)} - {\\(data.dict?.pageTitles?.siteName ?? \"The Job\"\\)}</title>|' role/+page.svelte)",
|
|
119
|
+
"Bash(sed -i 's|<title>Experience level - The Job</title>|<title>{\\(data.dict?.pageTitles?.preferencesExperience ?? \"Experience level\"\\)} - {\\(data.dict?.pageTitles?.siteName ?? \"The Job\"\\)}</title>|' experience/+page.svelte)",
|
|
120
120
|
"Bash(python3 -c \"import json; d=json.load\\(open\\('src/lib/i18n/dictionaries/en.json'\\)\\); import sys; json.dump\\(d.get\\('search',{}\\), sys.stdout, indent=2\\)\")",
|
|
121
121
|
"Bash(python3 -c \"import json; d=json.load\\(open\\('src/lib/i18n/dictionaries/sv.json'\\)\\); import sys; sv=d.get\\('search',{}\\); print\\('HAS' if 'noResults' in sv else 'MISSING', 'sv search.noResults'\\)\")",
|
|
122
122
|
"Bash(grep -n \"[^=>]\\\\\"[A-Z][a-z][^\\\\\"]\\\\{5,\\\\}\\\\\"\\\\|>[A-Z][a-z][^<]\\\\{5,\\\\}<\" src/routes/\\\\[country\\\\]/\\\\[lang\\\\]/profile/+page.svelte)",
|
package/CLAUDE.md
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
# @thejob/schema — working notes for agents
|
|
2
|
+
|
|
3
|
+
Read this before changing anything. Fourteen repos depend on this package; a
|
|
4
|
+
careless edit here breaks all of them at once.
|
|
5
|
+
|
|
6
|
+
## What this is
|
|
7
|
+
|
|
8
|
+
The **single source of truth** for The Job's data shapes: Yup schemas plus the
|
|
9
|
+
constants and enums that go with them. Plain Yup, no runtime dependencies, built
|
|
10
|
+
with `tsup` to dual ESM/CJS.
|
|
11
|
+
|
|
12
|
+
Current line is **v2** (branch `v2`, published `2.1.x`). v2 dropped v1's `objectId`
|
|
13
|
+
and `oneOfSchema` extensions and uses import-type for types; only
|
|
14
|
+
`date-string.extension.ts` remains.
|
|
15
|
+
|
|
16
|
+
## Every schema lives here, and only here
|
|
17
|
+
|
|
18
|
+
**Never hand-roll a `yup.object` in a consuming service.** If a service needs a
|
|
19
|
+
partial validator, it derives one inline:
|
|
20
|
+
|
|
21
|
+
```ts
|
|
22
|
+
UserSchema.pick(['headline', 'aboutMe'])
|
|
23
|
+
GroupSchema.omit(['createdAt', 'updatedAt'])
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Do **not** add `Update*Schema` / `Create*Schema` wrapper exports here for that
|
|
27
|
+
purpose — the pick/omit call at the use site says what it means and does not
|
|
28
|
+
multiply this package's surface. If a consumer needs a field that does not exist
|
|
29
|
+
yet, add it here first, then derive.
|
|
30
|
+
|
|
31
|
+
## Changing a schema is a fourteen-repo change
|
|
32
|
+
|
|
33
|
+
The consumers on v2 are: admin, common, content, email, group, jobs, marketing,
|
|
34
|
+
page, sitemap, svelte-ui, taxonomy, user (plus data-processor and notification
|
|
35
|
+
transitively). **nestjs-api and nextjs-web are still pinned to v1 (`^1.0.106`)** and
|
|
36
|
+
are NOT to be bumped casually: that is a breaking major jump needing the tagged
|
|
37
|
+
`@todo SCHEMA-V2-MIGRATION` work, not a version bump. NestJS is decommissioned.
|
|
38
|
+
|
|
39
|
+
Practical consequences:
|
|
40
|
+
|
|
41
|
+
- **Adding** an optional field is safe. **Renaming, removing, or tightening** one is
|
|
42
|
+
not — it will typecheck here and fail in services you did not open.
|
|
43
|
+
- Publish, then update consumers deliberately. There is no workspace linking these;
|
|
44
|
+
each consumer pins a registry range.
|
|
45
|
+
- During development use **yalc** (`yalc publish` / `yalc push`), not a version bump,
|
|
46
|
+
so you are not burning versions to test a change. `pnpm dev` already runs
|
|
47
|
+
`tsup --watch --onSuccess "yalc publish --push"`.
|
|
48
|
+
|
|
49
|
+
## Enum casing is load-bearing
|
|
50
|
+
|
|
51
|
+
Enum string values are consumed as literals across services and stored in Mongo, so
|
|
52
|
+
their casing is data, not style. Group `managedBy` / `visibility` / `status` are
|
|
53
|
+
**lowercase** (`system`, `private`, `archived`), as are `SavedSearchStatus` and
|
|
54
|
+
`JobAlertFrequency`. Changing a case is a data migration, not a refactor —
|
|
55
|
+
existing documents will silently stop matching.
|
|
56
|
+
|
|
57
|
+
## The consent fields are a compliance surface
|
|
58
|
+
|
|
59
|
+
Three shapes here decide whether the platform may mail someone, and each behaves
|
|
60
|
+
differently on purpose:
|
|
61
|
+
|
|
62
|
+
- **`notificationPrefs`** (`user.schema.ts`) — per-channel, opt-**out**. The
|
|
63
|
+
consumer reads `!== false`, so a user whose document predates the field must
|
|
64
|
+
read as *enabled*. That is why adding it needed no backfill migration, and why
|
|
65
|
+
a "tidy-up" that made the fields required would silently mute every legacy user.
|
|
66
|
+
- **`marketingConsent.subscribed`** — opt-**in**, read as `=== true`. The exact
|
|
67
|
+
inverse. Do not collapse the two into one shape; they have different legal
|
|
68
|
+
footing, which email-service's footer rules already encode.
|
|
69
|
+
- **`marketingConsent.jobAlertFrequency`** — a *second* gate on job-alert mail
|
|
70
|
+
only, so a user can stop alerts while staying subscribed generally.
|
|
71
|
+
|
|
72
|
+
`NotificationChannel` values are duplicated as a string union in `@thejob/notify`
|
|
73
|
+
(so that package stays dependency-free). This package remains the source of
|
|
74
|
+
truth; adding a channel means editing the enum, the `notificationPrefs` object
|
|
75
|
+
keys, its `.default()`, and that union.
|
|
76
|
+
|
|
77
|
+
Full picture: `thejob-notification-service/NOTIFICATIONS.md`.
|
|
78
|
+
|
|
79
|
+
## Conventions
|
|
80
|
+
|
|
81
|
+
- One module per domain (`user/`, `job/`, `group/`, …), each exporting its schema and
|
|
82
|
+
its constants, re-exported from `src/index.ts`.
|
|
83
|
+
- Types are derived from schemas (`yup.InferType`), never declared alongside them —
|
|
84
|
+
a hand-written type that drifts from its schema is the failure this package exists
|
|
85
|
+
to prevent.
|