job-forge 2.14.17 → 2.14.18
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/lib/jobforge-contracts.mjs +13 -1
- package/package.json +1 -1
- package/verify-pipeline.mjs +20 -1
|
@@ -53,7 +53,10 @@ export function getTrackerRowContract(projectDir = resolveProjectDir()) {
|
|
|
53
53
|
export function validateTrackerRow(record, options = {}) {
|
|
54
54
|
const projectDir = resolveProjectDir(options.projectDir);
|
|
55
55
|
const normalized = normalizeTrackerRowRecord(record, options);
|
|
56
|
-
|
|
56
|
+
const contract = options.allowMissingReport
|
|
57
|
+
? trackerRowContractWithOptionalReport(getTrackerRowContract(projectDir))
|
|
58
|
+
: getTrackerRowContract(projectDir);
|
|
59
|
+
return validateRecord(contract, normalized);
|
|
57
60
|
}
|
|
58
61
|
|
|
59
62
|
export function parseTrackerRow(text, formatName = 'tsv', options = {}) {
|
|
@@ -87,6 +90,15 @@ function normalizeTrackerRowRecord(record, options = {}) {
|
|
|
87
90
|
return out;
|
|
88
91
|
}
|
|
89
92
|
|
|
93
|
+
function trackerRowContractWithOptionalReport(contract) {
|
|
94
|
+
return {
|
|
95
|
+
...contract,
|
|
96
|
+
fields: contract.fields.map((field) => (
|
|
97
|
+
field.name === 'report' ? { ...field, required: false } : field
|
|
98
|
+
)),
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
|
|
90
102
|
function applyCanonicalStatusValues(input, projectDir) {
|
|
91
103
|
const statuses = canonicalStatusValues(projectDir);
|
|
92
104
|
for (const contract of input.contracts || []) {
|
package/package.json
CHANGED
package/verify-pipeline.mjs
CHANGED
|
@@ -270,7 +270,8 @@ if (source === 'day') {
|
|
|
270
270
|
if (badRows === 0) ok('All rows properly formatted');
|
|
271
271
|
|
|
272
272
|
for (const e of entries) {
|
|
273
|
-
const result = validateTrackerRow(e, {
|
|
273
|
+
const result = validateTrackerRow(contractRecordForEntry(e), {
|
|
274
|
+
allowMissingReport: true,
|
|
274
275
|
projectDir: PROJECT_DIR,
|
|
275
276
|
normalizeStatus: normalizeStatusForContract,
|
|
276
277
|
});
|
|
@@ -316,3 +317,21 @@ function normalizeStatusForContract(status) {
|
|
|
316
317
|
if (ALIASES[lower] === 'applied') return 'Applied';
|
|
317
318
|
return clean;
|
|
318
319
|
}
|
|
320
|
+
|
|
321
|
+
function contractRecordForEntry(entry) {
|
|
322
|
+
const record = {
|
|
323
|
+
num: entry.num,
|
|
324
|
+
date: entry.date,
|
|
325
|
+
company: entry.company,
|
|
326
|
+
role: entry.role,
|
|
327
|
+
score: entry.score,
|
|
328
|
+
status: entry.status,
|
|
329
|
+
pdf: entry.pdf,
|
|
330
|
+
report: entry.report,
|
|
331
|
+
notes: entry.notes,
|
|
332
|
+
};
|
|
333
|
+
if (!/\]\([^)]+\)/.test(String(record.report || ''))) {
|
|
334
|
+
delete record.report;
|
|
335
|
+
}
|
|
336
|
+
return record;
|
|
337
|
+
}
|