@resumekit/schema 0.0.0-stage → 0.1.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.
- package/LICENSE +21 -0
- package/README.md +27 -2
- package/dist/collections.d.ts +572 -0
- package/dist/collections.d.ts.map +1 -0
- package/dist/collections.js +479 -0
- package/dist/export-contract.d.ts +52 -0
- package/dist/export-contract.d.ts.map +1 -0
- package/dist/export-contract.js +17 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +8 -0
- package/dist/letter.d.ts +13 -0
- package/dist/letter.d.ts.map +1 -0
- package/dist/letter.js +1 -0
- package/dist/library.d.ts +60 -0
- package/dist/library.d.ts.map +1 -0
- package/dist/library.js +118 -0
- package/dist/locale.d.ts +11 -0
- package/dist/locale.d.ts.map +1 -0
- package/dist/locale.js +6 -0
- package/dist/resume-dates.d.ts +122 -0
- package/dist/resume-dates.d.ts.map +1 -0
- package/dist/resume-dates.js +185 -0
- package/dist/resume.d.ts +271 -0
- package/dist/resume.d.ts.map +1 -0
- package/dist/resume.js +367 -0
- package/dist/template.d.ts +1705 -0
- package/dist/template.d.ts.map +1 -0
- package/dist/template.js +1958 -0
- package/package.json +51 -3
- package/src/collections.ts +595 -0
- package/src/export-contract.ts +64 -0
- package/src/index.ts +8 -0
- package/src/letter.ts +12 -0
- package/src/library.ts +179 -0
- package/src/locale.ts +8 -0
- package/src/resume-dates.ts +252 -0
- package/src/resume.ts +410 -0
- package/src/template.ts +2248 -0
package/src/resume.ts
ADDED
|
@@ -0,0 +1,410 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Contact details. EVERY field is optional on purpose: text extraction routinely
|
|
5
|
+
* loses the email (it lives in a PDF header, a hyperlink, or a graphic). A
|
|
6
|
+
* required field with no honest source would force the writer to invent one —
|
|
7
|
+
* violating the product's defining constraint — or to fail validation on every
|
|
8
|
+
* repair attempt at full model cost. Absent details are the renderer's problem,
|
|
9
|
+
* not a reason to fabricate. See `llm-cost-optimization`.
|
|
10
|
+
*/
|
|
11
|
+
export const ContactSchema = z.object({
|
|
12
|
+
email: z
|
|
13
|
+
.string()
|
|
14
|
+
.optional()
|
|
15
|
+
.describe(
|
|
16
|
+
'Email exactly as it appears in the source resume. Omit if the resume ' +
|
|
17
|
+
'does not contain one — never invent or guess an address.',
|
|
18
|
+
),
|
|
19
|
+
phone: z
|
|
20
|
+
.string()
|
|
21
|
+
.optional()
|
|
22
|
+
.describe('Phone as written in the source resume.'),
|
|
23
|
+
location: z
|
|
24
|
+
.string()
|
|
25
|
+
.optional()
|
|
26
|
+
.describe("Location as written, e.g. 'Berlin, DE'."),
|
|
27
|
+
});
|
|
28
|
+
export type Contact = z.infer<typeof ContactSchema>;
|
|
29
|
+
|
|
30
|
+
export const LinkSchema = z.object({
|
|
31
|
+
label: z.string().optional().describe("Display label, e.g. 'GitHub'."),
|
|
32
|
+
url: z.string().min(1).describe('The URL as written in the source resume.'),
|
|
33
|
+
});
|
|
34
|
+
export type Link = z.infer<typeof LinkSchema>;
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* The only schemes a document's link may use.
|
|
38
|
+
*
|
|
39
|
+
* A résumé is exported to PDF and HTML, mailed to strangers, and reopened in
|
|
40
|
+
* readers this product does not control. A `javascript:` or `data:` target in
|
|
41
|
+
* that document is a script-injection vector rather than a formatting mistake,
|
|
42
|
+
* so the allowlist is a security boundary and lives in the domain where every
|
|
43
|
+
* surface inherits it.
|
|
44
|
+
*/
|
|
45
|
+
const SAFE_LINK_SCHEMES: readonly string[] = ['http:', 'https:'];
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* A ceiling on a stored target.
|
|
49
|
+
*
|
|
50
|
+
* Not a correctness rule — it is the de-facto address-bar limit, and it stops a
|
|
51
|
+
* pasted megabyte of `data:` payload becoming part of a document that is
|
|
52
|
+
* synced, versioned and re-parsed on every render.
|
|
53
|
+
*/
|
|
54
|
+
const MAX_LINK_LENGTH = 2048;
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Whether a string may be used as a link target in a document.
|
|
58
|
+
*
|
|
59
|
+
* PARSED, never prefix-matched. `startsWith('http')` is defeated by
|
|
60
|
+
* `javascript:` with an embedded tab or newline (the URL parser strips those
|
|
61
|
+
* before determining the scheme, so the string and the parsed scheme disagree),
|
|
62
|
+
* by unusual casing, and by percent-encoding. Asking the parser what the scheme
|
|
63
|
+
* actually is and then checking that against the allowlist has no such gap.
|
|
64
|
+
*
|
|
65
|
+
* A relative address (`github.com/me`) is REFUSED rather than silently promoted
|
|
66
|
+
* to `https://`. Guessing the scheme is inventing intent, and the surface that
|
|
67
|
+
* collected the value is the right place to say "start with https://".
|
|
68
|
+
*/
|
|
69
|
+
export function isSafeLinkTarget(value: string): boolean {
|
|
70
|
+
const trimmed = value.trim();
|
|
71
|
+
if (trimmed.length === 0 || trimmed.length > MAX_LINK_LENGTH) return false;
|
|
72
|
+
let parsed: URL;
|
|
73
|
+
try {
|
|
74
|
+
parsed = new URL(trimmed);
|
|
75
|
+
} catch {
|
|
76
|
+
// No scheme, or unparseable. Either way it is not something to link to.
|
|
77
|
+
return false;
|
|
78
|
+
}
|
|
79
|
+
return SAFE_LINK_SCHEMES.includes(parsed.protocol);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* A validated link target.
|
|
84
|
+
*
|
|
85
|
+
* Refused loudly: a caller gets a parse error it can report, rather than a
|
|
86
|
+
* quietly dropped value that leaves a word looking linked and doing nothing.
|
|
87
|
+
*/
|
|
88
|
+
export const LinkTargetSchema = z
|
|
89
|
+
.string()
|
|
90
|
+
.refine(isSafeLinkTarget, {
|
|
91
|
+
message: 'A link must be an http:// or https:// address.',
|
|
92
|
+
})
|
|
93
|
+
.describe('An absolute http(s) address a field points at.');
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Who put a piece of the document there.
|
|
97
|
+
*
|
|
98
|
+
* An enum of one today, and deliberately an enum: the product's guarantee is
|
|
99
|
+
* that the WRITER never states what it cannot ground, and that stays checkable
|
|
100
|
+
* only while writer output and candidate typing remain distinguishable to every
|
|
101
|
+
* later reader. Stored rather than inferred — see `editor-structural-authoring`,
|
|
102
|
+
* decision 2.
|
|
103
|
+
*/
|
|
104
|
+
export const CONTENT_AUTHORS = ['candidate'] as const;
|
|
105
|
+
export const ContentAuthorSchema = z.enum(CONTENT_AUTHORS);
|
|
106
|
+
export type ContentAuthor = z.infer<typeof ContentAuthorSchema>;
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* One entry in a candidate-authored section.
|
|
110
|
+
*
|
|
111
|
+
* Deliberately the same shape as the entries the templates already draw — a
|
|
112
|
+
* title, an optional qualifier line, and bullets — so a custom section renders
|
|
113
|
+
* through each template's existing section machinery rather than needing a
|
|
114
|
+
* layout of its own. A section carries content; it never carries a layout.
|
|
115
|
+
*/
|
|
116
|
+
export const CustomEntrySchema = z.object({
|
|
117
|
+
title: z.string().min(1).describe('The entry’s headline, e.g. a project.'),
|
|
118
|
+
detail: z
|
|
119
|
+
.string()
|
|
120
|
+
.optional()
|
|
121
|
+
.describe('Qualifier line, e.g. an organisation or a date range.'),
|
|
122
|
+
bullets: z.array(z.string().min(1)).default([]),
|
|
123
|
+
});
|
|
124
|
+
export type CustomEntry = z.infer<typeof CustomEntrySchema>;
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* A section the schema has no concept of — Projects, Volunteering, Awards.
|
|
128
|
+
*
|
|
129
|
+
* `id` is minted when the section is created and is what the overlay addresses,
|
|
130
|
+
* so the section survives the writer producing a different résumé underneath it.
|
|
131
|
+
* `author` is what keeps the never-invent claim checkable once one document
|
|
132
|
+
* contains both writer output and candidate typing.
|
|
133
|
+
*/
|
|
134
|
+
export const CustomSectionSchema = z.object({
|
|
135
|
+
id: z.string().min(1),
|
|
136
|
+
heading: z.string().min(1).describe("Section heading, e.g. 'Volunteering'."),
|
|
137
|
+
entries: z.array(CustomEntrySchema).default([]),
|
|
138
|
+
author: ContentAuthorSchema,
|
|
139
|
+
});
|
|
140
|
+
export type CustomSection = z.infer<typeof CustomSectionSchema>;
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* A title with a short paragraph under it — an achievement, a course, a passion.
|
|
144
|
+
*
|
|
145
|
+
* The shape is taken from the references rather than guessed. Every one of the
|
|
146
|
+
* thirteen sets an achievement as a bold or accented title with a paragraph
|
|
147
|
+
* beneath it; not one sets it as bullets. `description` is therefore a single
|
|
148
|
+
* `string` and not a `string[]`, so the record cannot express a list no template
|
|
149
|
+
* draws — the same discipline {@link SkillGroupSchema} applies when it refuses
|
|
150
|
+
* prose.
|
|
151
|
+
*
|
|
152
|
+
* ONE schema for three sections because they share a shape, and three FIELDS
|
|
153
|
+
* rather than one tagged list because they do not share a place on the page: a
|
|
154
|
+
* template resolves where a section sits from the field it is reading, not from
|
|
155
|
+
* a discriminator it has to match. Keying behaviour off a string is the mistake
|
|
156
|
+
* `isLanguages` made, and it is not repeated here.
|
|
157
|
+
*/
|
|
158
|
+
export const DescribedEntrySchema = z.object({
|
|
159
|
+
title: z.string().min(1).describe('The entry’s headline, e.g. an award.'),
|
|
160
|
+
description: z
|
|
161
|
+
.string()
|
|
162
|
+
.describe(
|
|
163
|
+
'One short paragraph. Never a list — no template draws bullets here.',
|
|
164
|
+
),
|
|
165
|
+
});
|
|
166
|
+
export type DescribedEntry = z.infer<typeof DescribedEntrySchema>;
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* How well the candidate speaks a language.
|
|
170
|
+
*
|
|
171
|
+
* FIVE values, because the meter five of the references draw has five steps.
|
|
172
|
+
* That correspondence is the whole reason a meter is allowed to exist here at
|
|
173
|
+
* all: `docs/template-contract.md` refuses a proficiency meter whose
|
|
174
|
+
* proportions nothing recorded, and this one renders one step per stored enum
|
|
175
|
+
* value rather than a percentage somebody chose. A sixth level would break the
|
|
176
|
+
* correspondence and force that rule to be re-decided — stated here so it is
|
|
177
|
+
* decided knowingly rather than discovered.
|
|
178
|
+
*
|
|
179
|
+
* There is no zero: a language the candidate does not speak is not on the
|
|
180
|
+
* résumé.
|
|
181
|
+
*/
|
|
182
|
+
export const LANGUAGE_LEVELS = [
|
|
183
|
+
'native',
|
|
184
|
+
'fluent',
|
|
185
|
+
'advanced',
|
|
186
|
+
'intermediate',
|
|
187
|
+
'beginner',
|
|
188
|
+
] as const;
|
|
189
|
+
export const LanguageLevelSchema = z.enum(LANGUAGE_LEVELS);
|
|
190
|
+
export type LanguageLevel = z.infer<typeof LanguageLevelSchema>;
|
|
191
|
+
|
|
192
|
+
export const LanguageSchema = z.object({
|
|
193
|
+
name: z.string().min(1).describe("A language, e.g. 'Spanish'."),
|
|
194
|
+
level: LanguageLevelSchema.describe('How well the candidate speaks it.'),
|
|
195
|
+
});
|
|
196
|
+
export type Language = z.infer<typeof LanguageSchema>;
|
|
197
|
+
|
|
198
|
+
/** A flat keyword list grouped by type (no rating bars / years-per-skill). */
|
|
199
|
+
export const SkillGroupSchema = z.object({
|
|
200
|
+
category: z
|
|
201
|
+
.string()
|
|
202
|
+
.min(1)
|
|
203
|
+
.describe("Group name, e.g. 'Languages', 'Cloud & Infra'."),
|
|
204
|
+
items: z
|
|
205
|
+
.array(z.string().min(1))
|
|
206
|
+
.describe(
|
|
207
|
+
'Flat keyword list. No rating bars, no years-per-skill, no prose.',
|
|
208
|
+
),
|
|
209
|
+
});
|
|
210
|
+
export type SkillGroup = z.infer<typeof SkillGroupSchema>;
|
|
211
|
+
|
|
212
|
+
export const ExperienceSchema = z.object({
|
|
213
|
+
company: z
|
|
214
|
+
.string()
|
|
215
|
+
.min(1)
|
|
216
|
+
.describe('Employer name exactly as in the resume.'),
|
|
217
|
+
title: z.string().min(1).describe('Job title exactly as in the resume.'),
|
|
218
|
+
/*
|
|
219
|
+
* Where the job was, which the résumé had nowhere to put.
|
|
220
|
+
*
|
|
221
|
+
* The same gap `Education.location` closed, in the sibling entry: Harvard has
|
|
222
|
+
* drawn an empty slot beside the employer since it was written, so every
|
|
223
|
+
* résumé printed a blank there and no candidate could type into it. A real
|
|
224
|
+
* résumé states it — `Doral Health & Wellness New York, NY` — and a recruiter
|
|
225
|
+
* filtering by place is reading exactly this line.
|
|
226
|
+
*
|
|
227
|
+
* Optional, because remote roles and plenty of résumés state none, and
|
|
228
|
+
* inventing a city is worse than omitting one.
|
|
229
|
+
*/
|
|
230
|
+
location: z
|
|
231
|
+
.string()
|
|
232
|
+
.optional()
|
|
233
|
+
.describe("Where the job was, e.g. 'New York, NY'. Omit if not stated."),
|
|
234
|
+
start: z
|
|
235
|
+
.string()
|
|
236
|
+
.min(1)
|
|
237
|
+
.describe("Start date as 'YYYY-MM', e.g. '2021-03'. Never empty."),
|
|
238
|
+
end: z
|
|
239
|
+
.string()
|
|
240
|
+
.min(1)
|
|
241
|
+
.describe(
|
|
242
|
+
"End date as 'YYYY-MM', or exactly 'Present' for a current role. Never empty.",
|
|
243
|
+
),
|
|
244
|
+
bullets: z
|
|
245
|
+
.array(z.string().min(1))
|
|
246
|
+
.describe(
|
|
247
|
+
'Each bullet: action verb + what you did + tool + quantified outcome. ' +
|
|
248
|
+
"No 'responsible for'.",
|
|
249
|
+
),
|
|
250
|
+
tech: z
|
|
251
|
+
.array(z.string().min(1))
|
|
252
|
+
.default([])
|
|
253
|
+
.describe('Technologies used in this role, as ATS keyword strings.'),
|
|
254
|
+
});
|
|
255
|
+
export type Experience = z.infer<typeof ExperienceSchema>;
|
|
256
|
+
|
|
257
|
+
export const EducationSchema = z.object({
|
|
258
|
+
school: z.string().min(1).describe('Institution name as in the resume.'),
|
|
259
|
+
degree: z.string().optional().describe("e.g. 'BSc'."),
|
|
260
|
+
field: z.string().optional().describe("e.g. 'Computer Science'."),
|
|
261
|
+
/*
|
|
262
|
+
* Where the institution is, which the résumé had nowhere to put.
|
|
263
|
+
*
|
|
264
|
+
* Every template draws a slot beside the school for it — Harvard has carried
|
|
265
|
+
* an empty `__where` since it was written — and the record it was drawn from
|
|
266
|
+
* could not hold one, so it printed blank on every résumé and no candidate
|
|
267
|
+
* could type it in. Optional, because plenty of qualifications are stated
|
|
268
|
+
* without a city and inventing one is worse than omitting it.
|
|
269
|
+
*/
|
|
270
|
+
location: z
|
|
271
|
+
.string()
|
|
272
|
+
.optional()
|
|
273
|
+
.describe("Where the institution is, e.g. 'Madrid, Spain'."),
|
|
274
|
+
start: z.string().optional().describe("'YYYY' or 'YYYY-MM'."),
|
|
275
|
+
end: z.string().optional().describe("'YYYY', 'YYYY-MM', or 'Present'."),
|
|
276
|
+
});
|
|
277
|
+
export type Education = z.infer<typeof EducationSchema>;
|
|
278
|
+
|
|
279
|
+
/**
|
|
280
|
+
* The structured resume — NOT a text blob — so a template can render it without
|
|
281
|
+
* re-parsing free text, and "same resume, different template" is a data operation.
|
|
282
|
+
*
|
|
283
|
+
* @pii This object is dense personal data. See {@link PersonalData} and README.
|
|
284
|
+
*/
|
|
285
|
+
export const ResumeObjectSchema = z.object({
|
|
286
|
+
name: z.string().min(1).describe("The candidate's full name."),
|
|
287
|
+
contact: ContactSchema,
|
|
288
|
+
links: z.array(LinkSchema).default([]),
|
|
289
|
+
headline: z
|
|
290
|
+
.string()
|
|
291
|
+
.optional()
|
|
292
|
+
.describe('One line mirroring the target job title.'),
|
|
293
|
+
summary: z
|
|
294
|
+
.string()
|
|
295
|
+
.describe(
|
|
296
|
+
'Short paragraph proving the target title. Grounded only in the source ' +
|
|
297
|
+
"resume and the candidate's answers.",
|
|
298
|
+
),
|
|
299
|
+
skills: z.array(SkillGroupSchema).default([]),
|
|
300
|
+
experience: z
|
|
301
|
+
.array(ExperienceSchema)
|
|
302
|
+
.describe('Reverse chronological — most recent role first.'),
|
|
303
|
+
education: z.array(EducationSchema).default([]),
|
|
304
|
+
certifications: z.array(z.string().min(1)).default([]),
|
|
305
|
+
/*
|
|
306
|
+
* The four sections every reference draws and the record could not hold.
|
|
307
|
+
*
|
|
308
|
+
* Achievements is in all thirteen references, usually directly under the
|
|
309
|
+
* summary or at the top of the rail; Courses is in ten, Passions in six,
|
|
310
|
+
* Languages in five. Until they existed here, seventeen templates each had
|
|
311
|
+
* four holes a stylesheet could not fill, because there was nowhere for a
|
|
312
|
+
* candidate to type the content.
|
|
313
|
+
*
|
|
314
|
+
* DEFAULTED EMPTY, so every résumé stored before these fields existed parses
|
|
315
|
+
* unchanged and nothing is migrated.
|
|
316
|
+
*
|
|
317
|
+
* DELIBERATELY ABSENT from `TailoredResumeSchema`, on the same terms as
|
|
318
|
+
* `custom_sections` below: a section the pipeline cannot express is a section
|
|
319
|
+
* the pipeline cannot invent, so every entry here is known to be the
|
|
320
|
+
* candidate's own. It also keeps the JSON Schema sent to the provider
|
|
321
|
+
* byte-identical, so the fields cost no tokens.
|
|
322
|
+
*/
|
|
323
|
+
achievements: z.array(DescribedEntrySchema).default([]),
|
|
324
|
+
courses: z.array(DescribedEntrySchema).default([]),
|
|
325
|
+
passions: z.array(DescribedEntrySchema).default([]),
|
|
326
|
+
/*
|
|
327
|
+
* Read from here rather than from whichever skills group a candidate happened
|
|
328
|
+
* to name "Languages", which is how every template found them before this
|
|
329
|
+
* field existed. That stopgap had no level, so no meter; no section id, so no
|
|
330
|
+
* adjustable gap; and it rendered nothing at all for the candidate who had not
|
|
331
|
+
* guessed the magic category name.
|
|
332
|
+
*/
|
|
333
|
+
languages: z.array(LanguageSchema).default([]),
|
|
334
|
+
/*
|
|
335
|
+
* What each section is CALLED, where the candidate renamed it.
|
|
336
|
+
*
|
|
337
|
+
* Keyed by `ResumeSectionId`, and absent for every section the candidate left
|
|
338
|
+
* alone — so the template's own heading is the default and nothing is stored
|
|
339
|
+
* until somebody types. A custom section has carried an editable `heading`
|
|
340
|
+
* since it was introduced; this is the same capability for the sections the
|
|
341
|
+
* schema names, which a candidate could read on the page and not change.
|
|
342
|
+
*
|
|
343
|
+
* The VALUE type is a loose `Record<string, string>` rather than a record
|
|
344
|
+
* keyed by the enum, deliberately. A rename arrives as an ordinary `set` edit
|
|
345
|
+
* on `section_headings.<id>`, and an overlay is data at rest that outlives the
|
|
346
|
+
* code that wrote it — so an edit naming a section this build no longer has
|
|
347
|
+
* would make the whole résumé fail to parse, and `presentedResume` would fall
|
|
348
|
+
* back to the writer's copy and silently discard every OTHER edit with it. A
|
|
349
|
+
* key nothing reads costs nothing; a résumé that will not open costs the
|
|
350
|
+
* candidate their work. The same reasoning `applyPresentation` gives for
|
|
351
|
+
* skipping a stale path rather than throwing.
|
|
352
|
+
*/
|
|
353
|
+
section_headings: z.record(z.string(), z.string()).default({}),
|
|
354
|
+
/*
|
|
355
|
+
* Sections the candidate added, which this schema has no other concept of.
|
|
356
|
+
*
|
|
357
|
+
* Defaulted empty, so every résumé written before this field existed parses
|
|
358
|
+
* unchanged and nothing is migrated. Rendered after the sections a template
|
|
359
|
+
* knows, in declaration order.
|
|
360
|
+
*
|
|
361
|
+
* DELIBERATELY ABSENT from the schema the writer produces (`TailoredResume`):
|
|
362
|
+
* a section the pipeline cannot express is a section the pipeline cannot
|
|
363
|
+
* invent, so a custom section can only ever have come from a candidate.
|
|
364
|
+
*/
|
|
365
|
+
custom_sections: z.array(CustomSectionSchema).default([]),
|
|
366
|
+
});
|
|
367
|
+
export type ResumeObject = z.infer<typeof ResumeObjectSchema>;
|
|
368
|
+
|
|
369
|
+
/**
|
|
370
|
+
* The résumé fields the writer cannot express.
|
|
371
|
+
*
|
|
372
|
+
* One list, used by `TailoredResumeSchema` to omit them and by
|
|
373
|
+
* {@link asResumeObject} to put them back, so the two can never disagree about
|
|
374
|
+
* which fields are candidate-only.
|
|
375
|
+
*/
|
|
376
|
+
export const CANDIDATE_ONLY_FIELDS = [
|
|
377
|
+
'custom_sections',
|
|
378
|
+
'section_headings',
|
|
379
|
+
'achievements',
|
|
380
|
+
'courses',
|
|
381
|
+
'passions',
|
|
382
|
+
'languages',
|
|
383
|
+
] as const;
|
|
384
|
+
export type CandidateOnlyField = (typeof CANDIDATE_ONLY_FIELDS)[number];
|
|
385
|
+
|
|
386
|
+
/**
|
|
387
|
+
* A writer résumé widened to a full {@link ResumeObject}.
|
|
388
|
+
*
|
|
389
|
+
* `TailoredResumeSchema` omits every {@link CANDIDATE_ONLY_FIELDS} member so the
|
|
390
|
+
* model cannot express a section it did not ground. Everything that RENDERS a
|
|
391
|
+
* résumé takes the full object, so the two meet here: a writer résumé has none
|
|
392
|
+
* of them, and saying that once beats each caller spreading five empty arrays
|
|
393
|
+
* and hoping they stay the right defaults.
|
|
394
|
+
*
|
|
395
|
+
* The parameter is typed by the same list, so a sixth candidate-only field is a
|
|
396
|
+
* type error here until it is handled rather than a silently missing default.
|
|
397
|
+
*/
|
|
398
|
+
export function asResumeObject(
|
|
399
|
+
written: Omit<ResumeObject, CandidateOnlyField>,
|
|
400
|
+
): ResumeObject {
|
|
401
|
+
return {
|
|
402
|
+
...written,
|
|
403
|
+
custom_sections: [],
|
|
404
|
+
section_headings: {},
|
|
405
|
+
achievements: [],
|
|
406
|
+
courses: [],
|
|
407
|
+
passions: [],
|
|
408
|
+
languages: [],
|
|
409
|
+
};
|
|
410
|
+
}
|