resuml 1.13.1 → 1.13.2
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/bin/resuml +13 -15
- package/dist/{api.d.cts → api.d.ts} +2 -2
- package/dist/api.js +18 -0
- package/dist/api.js.map +1 -0
- package/dist/{api.cjs → chunk-4ZOTZUAW.js} +50 -240
- package/dist/chunk-4ZOTZUAW.js.map +1 -0
- package/dist/chunk-CBMPNRQN.js +43 -0
- package/dist/chunk-CBMPNRQN.js.map +1 -0
- package/dist/{mcp/server.cjs → chunk-SZAL46QV.js} +11 -756
- package/dist/chunk-SZAL46QV.js.map +1 -0
- package/dist/chunk-ZLA7NFYP.js +90 -0
- package/dist/chunk-ZLA7NFYP.js.map +1 -0
- package/dist/{index.d.cts → index.d.ts} +2 -2
- package/dist/index.js +635 -0
- package/dist/index.js.map +1 -0
- package/dist/mcp/server.js +632 -0
- package/dist/mcp/server.js.map +1 -0
- package/dist/themeLoader-ZGWEGYXG.js +7 -0
- package/dist/themeLoader-ZGWEGYXG.js.map +1 -0
- package/package.json +2 -2
- package/dist/api.cjs.map +0 -1
- package/dist/index.cjs +0 -10023
- package/dist/index.cjs.map +0 -1
- package/dist/mcp/server.cjs.map +0 -1
- /package/dist/mcp/{server.d.cts → server.d.ts} +0 -0
- /package/dist/{themeLoader-C7CBqNiC.d.cts → themeLoader-C7CBqNiC.d.ts} +0 -0
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
// src/core.ts
|
|
2
|
+
import { parse } from "yaml";
|
|
3
|
+
import merge from "lodash.merge";
|
|
4
|
+
import { validate } from "@jsonresume/schema";
|
|
5
|
+
async function processResumeData(yamlContents) {
|
|
6
|
+
if (yamlContents.length === 0) {
|
|
7
|
+
throw new Error("No YAML content provided for processing.");
|
|
8
|
+
}
|
|
9
|
+
const dataObjects = yamlContents.map((content) => {
|
|
10
|
+
try {
|
|
11
|
+
return parse(content);
|
|
12
|
+
} catch (error) {
|
|
13
|
+
console.warn("Failed to parse YAML content:", error);
|
|
14
|
+
return null;
|
|
15
|
+
}
|
|
16
|
+
}).filter((data) => typeof data === "object" && data !== null);
|
|
17
|
+
if (dataObjects.length === 0) {
|
|
18
|
+
throw new Error("No valid YAML content found after parsing.");
|
|
19
|
+
}
|
|
20
|
+
const customizer = (objValue, srcValue) => {
|
|
21
|
+
if (Array.isArray(objValue)) {
|
|
22
|
+
return objValue.concat(srcValue);
|
|
23
|
+
}
|
|
24
|
+
return void 0;
|
|
25
|
+
};
|
|
26
|
+
const mergedData = dataObjects.reduce((acc, data) => merge(acc, data, customizer), {});
|
|
27
|
+
return new Promise((resolve, reject) => {
|
|
28
|
+
validate(mergedData, (errors, isValid) => {
|
|
29
|
+
if (!isValid) {
|
|
30
|
+
reject(
|
|
31
|
+
new Error(`Resume data failed schema validation: ${JSON.stringify(errors, null, 2)}`)
|
|
32
|
+
);
|
|
33
|
+
} else {
|
|
34
|
+
resolve(mergedData);
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export {
|
|
41
|
+
processResumeData
|
|
42
|
+
};
|
|
43
|
+
//# sourceMappingURL=chunk-CBMPNRQN.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/core.ts"],"sourcesContent":["// Placeholder for core logic\n\nimport { parse } from 'yaml';\nimport merge from 'lodash.merge';\nimport { validate } from '@jsonresume/schema';\nimport type { ResumeSchema as Resume } from './types/resume';\n\nexport type { Resume };\n\n/**\n * Merges and validates resume data objects against the JSON Resume schema.\n * @param yamlContents - An array of YAML strings containing resume data.\n * @returns The merged and validated resume data.\n * @throws Error if validation fails.\n */\nexport async function processResumeData(yamlContents: string[]): Promise<Resume> {\n if (yamlContents.length === 0) {\n throw new Error('No YAML content provided for processing.');\n }\n\n // Parse YAML content and filter out invalid objects\n const dataObjects = yamlContents\n .map((content) => {\n try {\n return parse(content) as Partial<Resume>;\n } catch (error) {\n console.warn('Failed to parse YAML content:', error);\n return null;\n }\n })\n .filter((data): data is Partial<Resume> => typeof data === 'object' && data !== null);\n\n if (dataObjects.length === 0) {\n throw new Error('No valid YAML content found after parsing.');\n }\n\n // Custom array merge to ensure arrays are concatenated\n const customizer = (objValue: unknown, srcValue: unknown) => {\n if (Array.isArray(objValue)) {\n return (objValue as unknown[]).concat(srcValue as unknown[]);\n }\n return undefined; // Let lodash handle it\n };\n\n // Merge data: Concatenate arrays, deep merge objects\n const mergedData = dataObjects.reduce((acc, data) => merge(acc, data, customizer), {}) as Resume;\n\n // Validate using the official JSON Resume validator\n return new Promise((resolve, reject) => {\n validate(mergedData, (errors, isValid) => {\n if (!isValid) {\n reject(\n new Error(`Resume data failed schema validation: ${JSON.stringify(errors, null, 2)}`)\n );\n } else {\n resolve(mergedData);\n }\n });\n });\n}\n"],"mappings":";AAEA,SAAS,aAAa;AACtB,OAAO,WAAW;AAClB,SAAS,gBAAgB;AAWzB,eAAsB,kBAAkB,cAAyC;AAC/E,MAAI,aAAa,WAAW,GAAG;AAC7B,UAAM,IAAI,MAAM,0CAA0C;AAAA,EAC5D;AAGA,QAAM,cAAc,aACjB,IAAI,CAAC,YAAY;AAChB,QAAI;AACF,aAAO,MAAM,OAAO;AAAA,IACtB,SAAS,OAAO;AACd,cAAQ,KAAK,iCAAiC,KAAK;AACnD,aAAO;AAAA,IACT;AAAA,EACF,CAAC,EACA,OAAO,CAAC,SAAkC,OAAO,SAAS,YAAY,SAAS,IAAI;AAEtF,MAAI,YAAY,WAAW,GAAG;AAC5B,UAAM,IAAI,MAAM,4CAA4C;AAAA,EAC9D;AAGA,QAAM,aAAa,CAAC,UAAmB,aAAsB;AAC3D,QAAI,MAAM,QAAQ,QAAQ,GAAG;AAC3B,aAAQ,SAAuB,OAAO,QAAqB;AAAA,IAC7D;AACA,WAAO;AAAA,EACT;AAGA,QAAM,aAAa,YAAY,OAAO,CAAC,KAAK,SAAS,MAAM,KAAK,MAAM,UAAU,GAAG,CAAC,CAAC;AAGrF,SAAO,IAAI,QAAQ,CAAC,SAAS,WAAW;AACtC,aAAS,YAAY,CAAC,QAAQ,YAAY;AACxC,UAAI,CAAC,SAAS;AACZ;AAAA,UACE,IAAI,MAAM,yCAAyC,KAAK,UAAU,QAAQ,MAAM,CAAC,CAAC,EAAE;AAAA,QACtF;AAAA,MACF,OAAO;AACL,gBAAQ,UAAU;AAAA,MACpB;AAAA,IACF,CAAC;AAAA,EACH,CAAC;AACH;","names":[]}
|