office-open 0.8.1 → 0.9.1

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/README.md CHANGED
@@ -87,9 +87,9 @@ try {
87
87
  ### Import from Sub-Packages
88
88
 
89
89
  ```typescript
90
- import { Document, Packer } from "office-open/docx";
91
- import { Presentation, Packer } from "office-open/pptx";
92
- import { Workbook, Packer } from "office-open/xlsx";
90
+ import { generateDocument, parseDocument, patchDocument } from "office-open/docx";
91
+ import { generatePresentation, parsePresentation, patchPresentation } from "office-open/pptx";
92
+ import { generateWorkbook, parseWorkbook, patchWorkbook } from "office-open/xlsx";
93
93
  import { convertInchesToTwip } from "office-open/core";
94
94
  import { xml2js, js2xml } from "office-open/xml";
95
95
  ```
@@ -1,3 +1,6 @@
1
+ //#region src/ai/error.d.ts
2
+ declare function formatToolError(type: string, error: unknown): string;
3
+ //#endregion
1
4
  //#region src/ai/index.d.ts
2
5
  declare const docxTool: import("ai").Tool<{
3
6
  [x: string]: unknown;
@@ -742,5 +745,5 @@ declare const officeOpenTools: {
742
745
  }>;
743
746
  };
744
747
  //#endregion
745
- export { docxTool, officeOpenTools, pptxTool, xlsxTool };
748
+ export { docxTool, formatToolError, officeOpenTools, pptxTool, xlsxTool };
746
749
  //# sourceMappingURL=index.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","names":[],"sources":["../../src/ai/index.ts"],"mappings":";cAQa,QAAA,eAAQ,IAAA;EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAsBR,QAAA,eAAQ,IAAA;EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAsBR,QAAA,eAAQ,IAAA;EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAsBR,eAAA;EAAA"}
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../../src/ai/error.ts","../../src/ai/index.ts"],"mappings":";iBAWgB,eAAA,CAAgB,IAAA,UAAc,KAAc;;;cCE/C,QAAA,eAAQ,IAAA;EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cA6BR,QAAA,eAAQ,IAAA;EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cA6BR,QAAA,eAAQ,IAAA;EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cA4BR,eAAA;EAAA"}
package/dist/ai/index.mjs CHANGED
@@ -1,47 +1,79 @@
1
1
  import { generate } from "../generate.mjs";
2
- import { a as docxSchema, i as pptxSchema, n as validateDocumentInput, r as xlsxSchema } from "../schemas-BhTmC2Jb.mjs";
2
+ import { n as pptxSchema, r as docxSchema, t as xlsxSchema } from "../xlsx-Bd0Vtakp.mjs";
3
3
  import { tool } from "ai";
4
+ //#region src/ai/error.ts
5
+ /**
6
+ * Format tool execution errors into LLM-friendly messages.
7
+ *
8
+ * When a tool's `execute` function throws, the AI SDK captures the error as a
9
+ * `tool-error` content part and sends it back to the LLM for self-correction.
10
+ * This module rewrites internal runtime errors into messages the LLM can
11
+ * understand and act on.
12
+ *
13
+ * @module
14
+ */
15
+ function formatToolError(type, error) {
16
+ const msg = error instanceof Error ? error.message : String(error);
17
+ if (msg.includes("Unsupported paragraph child type:")) return `Invalid paragraph child "${msg.split(": ").pop() ?? ""}". Paragraph children must use a wrapper key: { paragraph: { children: [{ text: "...", bold?: true }] } }, { table: { rows: [...] } }, { image: { ... } }, { toc: { ... } }, { textbox: { ... } }, { pageBreak: true }, { columnBreak: true }, etc. Do not use raw property names like { bold: ... } as paragraph children.`;
18
+ if (msg.includes("Unsupported run child type:")) return `Invalid run child "${msg.split(": ").pop() ?? ""}". Run children must be text objects: { text: "...", bold?: true, italic?: true, size?: number, color?: "RRGGBB", ... }. The "text" key is required. Plain strings are also accepted as children. Do not use bare property objects like { bold: true } without a "text" key.`;
19
+ if (msg.includes("Unknown section child type")) return "Unknown section child. Section children must use a wrapper key: { paragraph: { ... } }, { table: { ... } }, { image: { ... } }, { toc: { ... } }, { textbox: { ... } }, { pageBreak: true }, { sdt: { ... } }, { altChunk: { ... } }, etc.";
20
+ if (msg.includes("not iterable")) return `"${type === "docx" ? "sections" : type === "pptx" ? "slides" : "worksheets"}" must be an array. Received a non-iterable value.`;
21
+ return `${type.toUpperCase()} generation failed: ${msg}`;
22
+ }
23
+ //#endregion
4
24
  //#region src/ai/index.ts
5
25
  const docxTool = tool({
6
- description: "Generate a .docx Word document. The input is the document options directly — must include a 'sections' array. Each section has 'children' (paragraphs, tables, etc.). Paragraphs use { paragraph: { children: [{ text: '...' }] }}, tables use { table: { rows: [...] } }. Optional metadata: title, creator, subject, styles, numbering, comments, footnotes, endnotes, background, features.",
26
+ description: "Generate a .docx Word document. The input is the document options directly — must include a 'sections' array. Each section has 'children' (paragraphs, tables, etc.). IMPORTANT: Section children must use wrapper keys: { paragraph: {...} }, { table: {...} }, { image: {...} }, etc. Paragraph children must use: { text: '...', bold?: true, italic?: true, size?: number, ... }. The 'text' key is required in run objects. Plain strings are also accepted. Colors are hex WITHOUT '#': 'FF0000', not '#FF0000'. Optional metadata: title, creator, subject, styles, numbering, comments, footnotes, endnotes, background, features.",
7
27
  inputSchema: docxSchema,
8
28
  execute: async (options) => {
9
- return {
10
- base64: await generate({
11
- type: "docx",
12
- options: validateDocumentInput("docx", options),
13
- outputType: "base64"
14
- }),
15
- mimeType: "application/vnd.openxmlformats-officedocument.wordprocessingml.document"
16
- };
29
+ try {
30
+ return {
31
+ base64: await generate({
32
+ type: "docx",
33
+ options,
34
+ outputType: "base64"
35
+ }),
36
+ mimeType: "application/vnd.openxmlformats-officedocument.wordprocessingml.document"
37
+ };
38
+ } catch (error) {
39
+ throw new Error(formatToolError("docx", error));
40
+ }
17
41
  }
18
42
  });
19
43
  const pptxTool = tool({
20
- description: "Generate a .pptx PowerPoint presentation. The input is the document options directly — must include a 'slides' array. Each slide has 'children' (shapes, pictures, tables, charts, groups, etc.). Shapes use { shape: { x, y, width, height, text?, fill?, ... } }. Optional: size ('16:9' or '4:3' or { width, height }), title, creator, masters, show.",
44
+ description: "Generate a .pptx PowerPoint presentation. The input is the document options directly — must include a 'slides' array. Each slide has 'children' (shapes, pictures, tables, charts, groups, etc.). Shapes use { shape: { x, y, width, height, textBody?, fill?, ... } }. IMPORTANT: Shape positions (x, y, width, height) are in pixels. Colors are hex WITHOUT '#': 'FF0000', not '#FF0000'. Fill can be a hex color string or a fill object: '4472C4' or { type: 'solidFill', color: '4472C4' }. Optional: size ('16:9' or '4:3' or { width, height }), title, creator, masters, show.",
21
45
  inputSchema: pptxSchema,
22
46
  execute: async (options) => {
23
- return {
24
- base64: await generate({
25
- type: "pptx",
26
- options: validateDocumentInput("pptx", options),
27
- outputType: "base64"
28
- }),
29
- mimeType: "application/vnd.openxmlformats-officedocument.presentationml.presentation"
30
- };
47
+ try {
48
+ return {
49
+ base64: await generate({
50
+ type: "pptx",
51
+ options,
52
+ outputType: "base64"
53
+ }),
54
+ mimeType: "application/vnd.openxmlformats-officedocument.presentationml.presentation"
55
+ };
56
+ } catch (error) {
57
+ throw new Error(formatToolError("pptx", error));
58
+ }
31
59
  }
32
60
  });
33
61
  const xlsxTool = tool({
34
- description: "Generate a .xlsx Excel spreadsheet. The input is the document options directly — must include a 'worksheets' array. Each worksheet has 'rows' — an array of row objects, each with 'cells'. Cell values: string, number, boolean. Use 'style' for formatting. Optional: columns, mergeCells, freezePanes, autoFilter, images, charts, dataValidations, conditionalFormats.",
62
+ description: "Generate a .xlsx Excel spreadsheet. The input is the document options directly — must include a 'worksheets' array. Each worksheet has 'rows' — an array of row objects, each with 'cells'. Cell values: string, number, boolean, null. Use 'style' for formatting. IMPORTANT: Cells can be shorthand values (string, number, boolean) or objects: { value: 'hello', style: { ... } }. Column widths use 'width' as a number. Optional: columns, mergeCells, freezePanes, autoFilter, images, charts, dataValidations, conditionalFormats.",
35
63
  inputSchema: xlsxSchema,
36
64
  execute: async (options) => {
37
- return {
38
- base64: await generate({
39
- type: "xlsx",
40
- options: validateDocumentInput("xlsx", options),
41
- outputType: "base64"
42
- }),
43
- mimeType: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
44
- };
65
+ try {
66
+ return {
67
+ base64: await generate({
68
+ type: "xlsx",
69
+ options,
70
+ outputType: "base64"
71
+ }),
72
+ mimeType: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
73
+ };
74
+ } catch (error) {
75
+ throw new Error(formatToolError("xlsx", error));
76
+ }
45
77
  }
46
78
  });
47
79
  const officeOpenTools = {
@@ -50,6 +82,6 @@ const officeOpenTools = {
50
82
  "generate-xlsx": xlsxTool
51
83
  };
52
84
  //#endregion
53
- export { docxTool, officeOpenTools, pptxTool, xlsxTool };
85
+ export { docxTool, formatToolError, officeOpenTools, pptxTool, xlsxTool };
54
86
 
55
87
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":[],"sources":["../../src/ai/index.ts"],"sourcesContent":["import { tool } from \"ai\";\n\nimport { generate } from \"../generate\";\nimport { validateDocumentInput } from \"../schemas\";\nimport { docxSchema } from \"../schemas/docx\";\nimport { pptxSchema } from \"../schemas/pptx\";\nimport { xlsxSchema } from \"../schemas/xlsx\";\n\nexport const docxTool = tool({\n description:\n \"Generate a .docx Word document. \" +\n \"The input is the document options directly — must include a 'sections' array. \" +\n \"Each section has 'children' (paragraphs, tables, etc.). \" +\n \"Paragraphs use { paragraph: { children: [{ text: '...' }] }}, tables use { table: { rows: [...] } }. \" +\n \"Optional metadata: title, creator, subject, styles, numbering, comments, footnotes, endnotes, background, features.\",\n inputSchema: docxSchema,\n execute: async (options) => {\n const validated = validateDocumentInput(\"docx\", options);\n const base64 = (await generate({\n type: \"docx\",\n options: validated,\n outputType: \"base64\",\n })) as string;\n return {\n base64,\n mimeType: \"application/vnd.openxmlformats-officedocument.wordprocessingml.document\",\n };\n },\n});\n\nexport const pptxTool = tool({\n description:\n \"Generate a .pptx PowerPoint presentation. \" +\n \"The input is the document options directly — must include a 'slides' array. \" +\n \"Each slide has 'children' (shapes, pictures, tables, charts, groups, etc.). \" +\n \"Shapes use { shape: { x, y, width, height, text?, fill?, ... } }. \" +\n \"Optional: size ('16:9' or '4:3' or { width, height }), title, creator, masters, show.\",\n inputSchema: pptxSchema,\n execute: async (options) => {\n const validated = validateDocumentInput(\"pptx\", options);\n const base64 = (await generate({\n type: \"pptx\",\n options: validated,\n outputType: \"base64\",\n })) as string;\n return {\n base64,\n mimeType: \"application/vnd.openxmlformats-officedocument.presentationml.presentation\",\n };\n },\n});\n\nexport const xlsxTool = tool({\n description:\n \"Generate a .xlsx Excel spreadsheet. \" +\n \"The input is the document options directly — must include a 'worksheets' array. \" +\n \"Each worksheet has 'rows' — an array of row objects, each with 'cells'. \" +\n \"Cell values: string, number, boolean. Use 'style' for formatting. \" +\n \"Optional: columns, mergeCells, freezePanes, autoFilter, images, charts, dataValidations, conditionalFormats.\",\n inputSchema: xlsxSchema,\n execute: async (options) => {\n const validated = validateDocumentInput(\"xlsx\", options);\n const base64 = (await generate({\n type: \"xlsx\",\n options: validated,\n outputType: \"base64\",\n })) as string;\n return {\n base64,\n mimeType: \"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet\",\n };\n },\n});\n\nexport const officeOpenTools = {\n \"generate-docx\": docxTool,\n \"generate-pptx\": pptxTool,\n \"generate-xlsx\": xlsxTool,\n} as const;\n"],"mappings":";;;;AAQA,MAAa,WAAW,KAAK;CAC3B,aACE;CAKF,aAAa;CACb,SAAS,OAAO,YAAY;EAO1B,OAAO;GACL,QAAA,MANoB,SAAS;IAC7B,MAAM;IACN,SAHgB,sBAAsB,QAAQ,OAG7B;IACjB,YAAY;GACd,CAAC;GAGC,UAAU;EACZ;CACF;AACF,CAAC;AAED,MAAa,WAAW,KAAK;CAC3B,aACE;CAKF,aAAa;CACb,SAAS,OAAO,YAAY;EAO1B,OAAO;GACL,QAAA,MANoB,SAAS;IAC7B,MAAM;IACN,SAHgB,sBAAsB,QAAQ,OAG7B;IACjB,YAAY;GACd,CAAC;GAGC,UAAU;EACZ;CACF;AACF,CAAC;AAED,MAAa,WAAW,KAAK;CAC3B,aACE;CAKF,aAAa;CACb,SAAS,OAAO,YAAY;EAO1B,OAAO;GACL,QAAA,MANoB,SAAS;IAC7B,MAAM;IACN,SAHgB,sBAAsB,QAAQ,OAG7B;IACjB,YAAY;GACd,CAAC;GAGC,UAAU;EACZ;CACF;AACF,CAAC;AAED,MAAa,kBAAkB;CAC7B,iBAAiB;CACjB,iBAAiB;CACjB,iBAAiB;AACnB"}
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../../src/ai/error.ts","../../src/ai/index.ts"],"sourcesContent":["/**\n * Format tool execution errors into LLM-friendly messages.\n *\n * When a tool's `execute` function throws, the AI SDK captures the error as a\n * `tool-error` content part and sends it back to the LLM for self-correction.\n * This module rewrites internal runtime errors into messages the LLM can\n * understand and act on.\n *\n * @module\n */\n\nexport function formatToolError(type: string, error: unknown): string {\n const msg = error instanceof Error ? error.message : String(error);\n\n // ── DOCX: paragraph child errors ──\n\n if (msg.includes(\"Unsupported paragraph child type:\")) {\n const keys = msg.split(\": \").pop() ?? \"\";\n return (\n `Invalid paragraph child \"${keys}\". ` +\n `Paragraph children must use a wrapper key: ` +\n `{ paragraph: { children: [{ text: \"...\", bold?: true }] } }, ` +\n `{ table: { rows: [...] } }, { image: { ... } }, ` +\n `{ toc: { ... } }, { textbox: { ... } }, ` +\n `{ pageBreak: true }, { columnBreak: true }, etc. ` +\n `Do not use raw property names like { bold: ... } as paragraph children.`\n );\n }\n\n if (msg.includes(\"Unsupported run child type:\")) {\n const keys = msg.split(\": \").pop() ?? \"\";\n return (\n `Invalid run child \"${keys}\". ` +\n `Run children must be text objects: { text: \"...\", bold?: true, italic?: true, size?: number, color?: \"RRGGBB\", ... }. ` +\n `The \"text\" key is required. Plain strings are also accepted as children. ` +\n `Do not use bare property objects like { bold: true } without a \"text\" key.`\n );\n }\n\n if (msg.includes(\"Unknown section child type\")) {\n return (\n `Unknown section child. ` +\n `Section children must use a wrapper key: ` +\n `{ paragraph: { ... } }, { table: { ... } }, { image: { ... } }, ` +\n `{ toc: { ... } }, { textbox: { ... } }, { pageBreak: true }, ` +\n `{ sdt: { ... } }, { altChunk: { ... } }, etc.`\n );\n }\n\n // ── General: iterable errors ──\n\n if (msg.includes(\"not iterable\")) {\n const field = type === \"docx\" ? \"sections\" : type === \"pptx\" ? \"slides\" : \"worksheets\";\n return `\"${field}\" must be an array. Received a non-iterable value.`;\n }\n\n // ── Fallback ──\n\n return `${type.toUpperCase()} generation failed: ${msg}`;\n}\n","import type { DocumentOptions } from \"@office-open/docx\";\nimport type { PresentationOptions } from \"@office-open/pptx\";\nimport type { WorkbookOptions } from \"@office-open/xlsx\";\nimport { tool } from \"ai\";\n\nexport { formatToolError } from \"./error\";\n\nimport { generate } from \"../generate\";\nimport { docxSchema } from \"../schemas/docx\";\nimport { pptxSchema } from \"../schemas/pptx\";\nimport { xlsxSchema } from \"../schemas/xlsx\";\nimport { formatToolError } from \"./error\";\n\nexport const docxTool = tool({\n description:\n \"Generate a .docx Word document. \" +\n \"The input is the document options directly — must include a 'sections' array. \" +\n \"Each section has 'children' (paragraphs, tables, etc.). \" +\n \"IMPORTANT: \" +\n \"Section children must use wrapper keys: { paragraph: {...} }, { table: {...} }, { image: {...} }, etc. \" +\n \"Paragraph children must use: { text: '...', bold?: true, italic?: true, size?: number, ... }. \" +\n \"The 'text' key is required in run objects. Plain strings are also accepted. \" +\n \"Colors are hex WITHOUT '#': 'FF0000', not '#FF0000'. \" +\n \"Optional metadata: title, creator, subject, styles, numbering, comments, footnotes, endnotes, background, features.\",\n inputSchema: docxSchema,\n execute: async (options) => {\n try {\n const base64 = (await generate({\n type: \"docx\",\n options: options as unknown as DocumentOptions,\n outputType: \"base64\",\n })) as string;\n return {\n base64,\n mimeType: \"application/vnd.openxmlformats-officedocument.wordprocessingml.document\",\n };\n } catch (error) {\n throw new Error(formatToolError(\"docx\", error));\n }\n },\n});\n\nexport const pptxTool = tool({\n description:\n \"Generate a .pptx PowerPoint presentation. \" +\n \"The input is the document options directly — must include a 'slides' array. \" +\n \"Each slide has 'children' (shapes, pictures, tables, charts, groups, etc.). \" +\n \"Shapes use { shape: { x, y, width, height, textBody?, fill?, ... } }. \" +\n \"IMPORTANT: \" +\n \"Shape positions (x, y, width, height) are in pixels. \" +\n \"Colors are hex WITHOUT '#': 'FF0000', not '#FF0000'. \" +\n \"Fill can be a hex color string or a fill object: '4472C4' or { type: 'solidFill', color: '4472C4' }. \" +\n \"Optional: size ('16:9' or '4:3' or { width, height }), title, creator, masters, show.\",\n inputSchema: pptxSchema,\n execute: async (options) => {\n try {\n const base64 = (await generate({\n type: \"pptx\",\n options: options as PresentationOptions,\n outputType: \"base64\",\n })) as string;\n return {\n base64,\n mimeType: \"application/vnd.openxmlformats-officedocument.presentationml.presentation\",\n };\n } catch (error) {\n throw new Error(formatToolError(\"pptx\", error));\n }\n },\n});\n\nexport const xlsxTool = tool({\n description:\n \"Generate a .xlsx Excel spreadsheet. \" +\n \"The input is the document options directly — must include a 'worksheets' array. \" +\n \"Each worksheet has 'rows' — an array of row objects, each with 'cells'. \" +\n \"Cell values: string, number, boolean, null. Use 'style' for formatting. \" +\n \"IMPORTANT: \" +\n \"Cells can be shorthand values (string, number, boolean) or objects: { value: 'hello', style: { ... } }. \" +\n \"Column widths use 'width' as a number. \" +\n \"Optional: columns, mergeCells, freezePanes, autoFilter, images, charts, dataValidations, conditionalFormats.\",\n inputSchema: xlsxSchema,\n execute: async (options) => {\n try {\n const base64 = (await generate({\n type: \"xlsx\",\n options: options as WorkbookOptions,\n outputType: \"base64\",\n })) as string;\n return {\n base64,\n mimeType: \"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet\",\n };\n } catch (error) {\n throw new Error(formatToolError(\"xlsx\", error));\n }\n },\n});\n\nexport const officeOpenTools = {\n \"generate-docx\": docxTool,\n \"generate-pptx\": pptxTool,\n \"generate-xlsx\": xlsxTool,\n} as const;\n"],"mappings":";;;;;;;;;;;;;;AAWA,SAAgB,gBAAgB,MAAc,OAAwB;CACpE,MAAM,MAAM,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK;CAIjE,IAAI,IAAI,SAAS,mCAAmC,GAElD,OACE,4BAFW,IAAI,MAAM,IAAI,EAAE,IAAI,KAAK,GAEH;CAUrC,IAAI,IAAI,SAAS,6BAA6B,GAE5C,OACE,sBAFW,IAAI,MAAM,IAAI,EAAE,IAAI,KAAK,GAET;CAO/B,IAAI,IAAI,SAAS,4BAA4B,GAC3C,OACE;CAUJ,IAAI,IAAI,SAAS,cAAc,GAE7B,OAAO,IADO,SAAS,SAAS,aAAa,SAAS,SAAS,WAAW,aACzD;CAKnB,OAAO,GAAG,KAAK,YAAY,EAAE,sBAAsB;AACrD;;;AC9CA,MAAa,WAAW,KAAK;CAC3B,aACE;CASF,aAAa;CACb,SAAS,OAAO,YAAY;EAC1B,IAAI;GAMF,OAAO;IACL,QAAA,MANoB,SAAS;KAC7B,MAAM;KACG;KACT,YAAY;IACd,CAAC;IAGC,UAAU;GACZ;EACF,SAAS,OAAO;GACd,MAAM,IAAI,MAAM,gBAAgB,QAAQ,KAAK,CAAC;EAChD;CACF;AACF,CAAC;AAED,MAAa,WAAW,KAAK;CAC3B,aACE;CASF,aAAa;CACb,SAAS,OAAO,YAAY;EAC1B,IAAI;GAMF,OAAO;IACL,QAAA,MANoB,SAAS;KAC7B,MAAM;KACG;KACT,YAAY;IACd,CAAC;IAGC,UAAU;GACZ;EACF,SAAS,OAAO;GACd,MAAM,IAAI,MAAM,gBAAgB,QAAQ,KAAK,CAAC;EAChD;CACF;AACF,CAAC;AAED,MAAa,WAAW,KAAK;CAC3B,aACE;CAQF,aAAa;CACb,SAAS,OAAO,YAAY;EAC1B,IAAI;GAMF,OAAO;IACL,QAAA,MANoB,SAAS;KAC7B,MAAM;KACG;KACT,YAAY;IACd,CAAC;IAGC,UAAU;GACZ;EACF,SAAS,OAAO;GACd,MAAM,IAAI,MAAM,gBAAgB,QAAQ,KAAK,CAAC;EAChD;CACF;AACF,CAAC;AAED,MAAa,kBAAkB;CAC7B,iBAAiB;CACjB,iBAAiB;CACjB,iBAAiB;AACnB"}
package/dist/cli.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  import { generateToFile, parseInput } from "./generate.mjs";
2
- import { n as validateDocumentInput } from "./schemas-BhTmC2Jb.mjs";
2
+ import { validateDocumentInput } from "./schemas/index.mjs";
3
3
  import { defineCommand, runMain } from "citty";
4
4
  //#region src/cli.ts
5
5
  function createConvertCommand(type, defaultExt) {
@@ -1,15 +1,23 @@
1
+ import { DocumentOptions } from "@office-open/docx";
2
+ import { PresentationOptions } from "@office-open/pptx";
3
+ import { WorkbookOptions } from "@office-open/xlsx";
1
4
  import { OutputType, OutputType as OutputType$1 } from "@office-open/core";
2
5
 
3
6
  //#region src/generate.d.ts
4
7
  type GenerateType = "docx" | "pptx" | "xlsx";
5
- interface GenerateOptions {
6
- readonly type: GenerateType;
7
- readonly options: Record<string, unknown>;
8
+ interface GenerateOptionsMap {
9
+ docx: DocumentOptions;
10
+ pptx: PresentationOptions;
11
+ xlsx: WorkbookOptions;
12
+ }
13
+ interface GenerateOptions<T extends GenerateType = GenerateType> {
14
+ readonly type: T;
15
+ readonly options: GenerateOptionsMap[T];
8
16
  readonly outputType?: OutputType$1;
9
17
  }
10
- declare function generate(options: GenerateOptions): Promise<unknown>;
18
+ declare function generate<T extends GenerateType>(options: GenerateOptions<T>): Promise<unknown>;
11
19
  declare function parseInput(input: string): Promise<Record<string, unknown>>;
12
20
  declare function generateToFile(outputPath: string, options: GenerateOptions): Promise<void>;
13
21
  //#endregion
14
- export { GenerateOptions, GenerateType, type OutputType, generate, generateToFile, parseInput };
22
+ export { GenerateOptions, GenerateOptionsMap, GenerateType, type OutputType, generate, generateToFile, parseInput };
15
23
  //# sourceMappingURL=generate.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"generate.d.mts","names":[],"sources":["../src/generate.ts"],"mappings":";;;KAYY,YAAA;AAAA,UAEK,eAAA;EAAA,SACN,IAAA,EAAM,YAAA;EAAA,SACN,OAAA,EAAS,MAAA;EAAA,SACT,UAAA,GAAa,YAAA;AAAA;AAAA,iBAwBF,QAAA,CAAS,OAAA,EAAS,eAAA,GAAkB,OAAO;AAAA,iBAO3C,UAAA,CAAW,KAAA,WAAgB,OAAO,CAAC,MAAA;AAAA,iBASnC,cAAA,CAAe,UAAA,UAAoB,OAAA,EAAS,eAAA,GAAkB,OAAO"}
1
+ {"version":3,"file":"generate.d.mts","names":[],"sources":["../src/generate.ts"],"mappings":";;;;;;KAYY,YAAA;AAAA,UAGK,kBAAA;EACf,IAAA,EAAM,eAAA;EACN,IAAA,EAAM,mBAAA;EACN,IAAA,EAAM,eAAA;AAAA;AAAA,UAGS,eAAA,WAA0B,YAAA,GAAe,YAAA;EAAA,SAC/C,IAAA,EAAM,CAAA;EAAA,SACN,OAAA,EAAS,kBAAA,CAAmB,CAAA;EAAA,SAC5B,UAAA,GAAa,YAAA;AAAA;AAAA,iBAGF,QAAA,WAAmB,YAAA,EACvC,OAAA,EAAS,eAAA,CAAgB,CAAA,IACxB,OAAA;AAAA,iBAuBmB,UAAA,CAAW,KAAA,WAAgB,OAAO,CAAC,MAAA;AAAA,iBASnC,cAAA,CAAe,UAAA,UAAoB,OAAA,EAAS,eAAA,GAAkB,OAAO"}
package/dist/generate.mjs CHANGED
@@ -1,26 +1,16 @@
1
1
  import { readFile, writeFile } from "node:fs/promises";
2
- import { Document, Packer } from "@office-open/docx";
3
- import { Packer as Packer$1, Presentation } from "@office-open/pptx";
4
- import { Packer as Packer$2, Workbook } from "@office-open/xlsx";
2
+ import { generateDocument } from "@office-open/docx";
3
+ import { generatePresentation } from "@office-open/pptx";
4
+ import { generateWorkbook } from "@office-open/xlsx";
5
5
  //#region src/generate.ts
6
- const PACKERS = {
7
- docx: {
8
- newFile: (opts) => new Document(opts),
9
- pack: (file, type) => Packer.pack(file, type)
10
- },
11
- pptx: {
12
- newFile: (opts) => new Presentation(opts),
13
- pack: (file, type) => Packer$1.pack(file, type)
14
- },
15
- xlsx: {
16
- newFile: (opts) => new Workbook(opts),
17
- pack: (file, type) => Packer$2.pack(file, type)
18
- }
19
- };
20
6
  async function generate(options) {
21
7
  const { type, options: docOptions, outputType = "nodebuffer" } = options;
22
- const { newFile, pack } = PACKERS[type];
23
- return pack(newFile(docOptions), outputType);
8
+ const packerOpts = { type: outputType };
9
+ switch (type) {
10
+ case "docx": return generateDocument(docOptions, packerOpts);
11
+ case "pptx": return generatePresentation(docOptions, packerOpts);
12
+ case "xlsx": return generateWorkbook(docOptions, packerOpts);
13
+ }
24
14
  }
25
15
  async function parseInput(input) {
26
16
  const trimmed = input.trim();
@@ -1 +1 @@
1
- {"version":3,"file":"generate.mjs","names":["DocxPacker","PptxPacker","XlsxPacker"],"sources":["../src/generate.ts"],"sourcesContent":["import { readFile, writeFile } from \"node:fs/promises\";\n\nimport type { OutputType } from \"@office-open/core\";\nexport { type OutputType } from \"@office-open/core\";\n\nimport { Document, Packer as DocxPacker } from \"@office-open/docx\";\nimport type { PropertiesOptions } from \"@office-open/docx\";\nimport { Presentation, Packer as PptxPacker } from \"@office-open/pptx\";\nimport type { PresentationOptions } from \"@office-open/pptx\";\nimport { Workbook, Packer as XlsxPacker } from \"@office-open/xlsx\";\nimport type { WorkbookOptions } from \"@office-open/xlsx\";\n\nexport type GenerateType = \"docx\" | \"pptx\" | \"xlsx\";\n\nexport interface GenerateOptions {\n readonly type: GenerateType;\n readonly options: Record<string, unknown>;\n readonly outputType?: OutputType;\n}\n\nconst PACKERS = {\n docx: {\n newFile: (opts: unknown) => new Document(opts as unknown as PropertiesOptions),\n pack: (file: unknown, type: OutputType) => DocxPacker.pack(file as Document, type),\n },\n pptx: {\n newFile: (opts: unknown) => new Presentation(opts as unknown as PresentationOptions),\n pack: (file: unknown, type: OutputType) => PptxPacker.pack(file as Presentation, type),\n },\n xlsx: {\n newFile: (opts: unknown) => new Workbook(opts as unknown as WorkbookOptions),\n pack: (file: unknown, type: OutputType) => XlsxPacker.pack(file as Workbook, type),\n },\n} as const satisfies Record<\n GenerateType,\n {\n newFile: (opts: unknown) => unknown;\n pack: (file: unknown, type: OutputType) => Promise<unknown>;\n }\n>;\n\nexport async function generate(options: GenerateOptions): Promise<unknown> {\n const { type, options: docOptions, outputType = \"nodebuffer\" as OutputType } = options;\n const { newFile, pack } = PACKERS[type];\n const file = newFile(docOptions);\n return pack(file, outputType);\n}\n\nexport async function parseInput(input: string): Promise<Record<string, unknown>> {\n const trimmed = input.trim();\n if (trimmed.startsWith(\"{\") || trimmed.startsWith(\"[\")) {\n return JSON.parse(trimmed) as Record<string, unknown>;\n }\n const content = await readFile(trimmed, \"utf-8\");\n return JSON.parse(content) as Record<string, unknown>;\n}\n\nexport async function generateToFile(outputPath: string, options: GenerateOptions): Promise<void> {\n const buffer = (await generate({ ...options, outputType: \"nodebuffer\" })) as Buffer;\n await writeFile(outputPath, buffer);\n}\n"],"mappings":";;;;;AAoBA,MAAM,UAAU;CACd,MAAM;EACJ,UAAU,SAAkB,IAAI,SAAS,IAAoC;EAC7E,OAAO,MAAe,SAAqBA,OAAW,KAAK,MAAkB,IAAI;CACnF;CACA,MAAM;EACJ,UAAU,SAAkB,IAAI,aAAa,IAAsC;EACnF,OAAO,MAAe,SAAqBC,SAAW,KAAK,MAAsB,IAAI;CACvF;CACA,MAAM;EACJ,UAAU,SAAkB,IAAI,SAAS,IAAkC;EAC3E,OAAO,MAAe,SAAqBC,SAAW,KAAK,MAAkB,IAAI;CACnF;AACF;AAQA,eAAsB,SAAS,SAA4C;CACzE,MAAM,EAAE,MAAM,SAAS,YAAY,aAAa,iBAA+B;CAC/E,MAAM,EAAE,SAAS,SAAS,QAAQ;CAElC,OAAO,KADM,QAAQ,UACN,GAAG,UAAU;AAC9B;AAEA,eAAsB,WAAW,OAAiD;CAChF,MAAM,UAAU,MAAM,KAAK;CAC3B,IAAI,QAAQ,WAAW,GAAG,KAAK,QAAQ,WAAW,GAAG,GACnD,OAAO,KAAK,MAAM,OAAO;CAE3B,MAAM,UAAU,MAAM,SAAS,SAAS,OAAO;CAC/C,OAAO,KAAK,MAAM,OAAO;AAC3B;AAEA,eAAsB,eAAe,YAAoB,SAAyC;CAEhG,MAAM,UAAU,YAAY,MADN,SAAS;EAAE,GAAG;EAAS,YAAY;CAAa,CAAC,CACrC;AACpC"}
1
+ {"version":3,"file":"generate.mjs","names":[],"sources":["../src/generate.ts"],"sourcesContent":["import { readFile, writeFile } from \"node:fs/promises\";\n\nimport type { OutputType, PackerOptions } from \"@office-open/core\";\nexport { type OutputType } from \"@office-open/core\";\n\nimport { generateDocument } from \"@office-open/docx\";\nimport type { DocumentOptions } from \"@office-open/docx\";\nimport { generatePresentation } from \"@office-open/pptx\";\nimport type { PresentationOptions } from \"@office-open/pptx\";\nimport { generateWorkbook } from \"@office-open/xlsx\";\nimport type { WorkbookOptions } from \"@office-open/xlsx\";\n\nexport type GenerateType = \"docx\" | \"pptx\" | \"xlsx\";\n\n/** Map from type string to the corresponding options type. */\nexport interface GenerateOptionsMap {\n docx: DocumentOptions;\n pptx: PresentationOptions;\n xlsx: WorkbookOptions;\n}\n\nexport interface GenerateOptions<T extends GenerateType = GenerateType> {\n readonly type: T;\n readonly options: GenerateOptionsMap[T];\n readonly outputType?: OutputType;\n}\n\nexport async function generate<T extends GenerateType>(\n options: GenerateOptions<T>,\n): Promise<unknown> {\n const { type, options: docOptions, outputType = \"nodebuffer\" as OutputType } = options;\n const packerOpts = { type: outputType } as PackerOptions<OutputType>;\n\n switch (type) {\n case \"docx\":\n return generateDocument(\n docOptions as DocumentOptions,\n packerOpts as PackerOptions<\"nodebuffer\">,\n );\n case \"pptx\":\n return generatePresentation(\n docOptions as PresentationOptions,\n packerOpts as PackerOptions<\"nodebuffer\">,\n );\n case \"xlsx\":\n return generateWorkbook(\n docOptions as WorkbookOptions,\n packerOpts as PackerOptions<\"nodebuffer\">,\n );\n }\n}\n\nexport async function parseInput(input: string): Promise<Record<string, unknown>> {\n const trimmed = input.trim();\n if (trimmed.startsWith(\"{\") || trimmed.startsWith(\"[\")) {\n return JSON.parse(trimmed) as Record<string, unknown>;\n }\n const content = await readFile(trimmed, \"utf-8\");\n return JSON.parse(content) as Record<string, unknown>;\n}\n\nexport async function generateToFile(outputPath: string, options: GenerateOptions): Promise<void> {\n const buffer = (await generate({ ...options, outputType: \"nodebuffer\" })) as Buffer;\n await writeFile(outputPath, buffer);\n}\n"],"mappings":";;;;;AA2BA,eAAsB,SACpB,SACkB;CAClB,MAAM,EAAE,MAAM,SAAS,YAAY,aAAa,iBAA+B;CAC/E,MAAM,aAAa,EAAE,MAAM,WAAW;CAEtC,QAAQ,MAAR;EACE,KAAK,QACH,OAAO,iBACL,YACA,UACF;EACF,KAAK,QACH,OAAO,qBACL,YACA,UACF;EACF,KAAK,QACH,OAAO,iBACL,YACA,UACF;CACJ;AACF;AAEA,eAAsB,WAAW,OAAiD;CAChF,MAAM,UAAU,MAAM,KAAK;CAC3B,IAAI,QAAQ,WAAW,GAAG,KAAK,QAAQ,WAAW,GAAG,GACnD,OAAO,KAAK,MAAM,OAAO;CAE3B,MAAM,UAAU,MAAM,SAAS,SAAS,OAAO;CAC/C,OAAO,KAAK,MAAM,OAAO;AAC3B;AAEA,eAAsB,eAAe,YAAoB,SAAyC;CAEhG,MAAM,UAAU,YAAY,MADN,SAAS;EAAE,GAAG;EAAS,YAAY;CAAa,CAAC,CACrC;AACpC"}
@@ -1,2 +1,20 @@
1
- import { a as docxSchema, i as pptxSchema, n as validateDocumentInput, r as xlsxSchema, t as SCHEMAS } from "../schemas-BhTmC2Jb.mjs";
1
+ import { n as pptxSchema, r as docxSchema, t as xlsxSchema } from "../xlsx-Bd0Vtakp.mjs";
2
+ //#region src/schemas/index.ts
3
+ const SCHEMAS = {
4
+ docx: docxSchema,
5
+ pptx: pptxSchema,
6
+ xlsx: xlsxSchema
7
+ };
8
+ function validateDocumentInput(type, data) {
9
+ const result = SCHEMAS[type].safeParse(data);
10
+ if (!result.success) {
11
+ const issue = result.error.issues[0];
12
+ const path = issue.path.join(".");
13
+ throw new Error(`Invalid ${type} options${path ? ` at "${path}"` : ""}: ${issue.message}`);
14
+ }
15
+ return result.data;
16
+ }
17
+ //#endregion
2
18
  export { SCHEMAS, docxSchema, pptxSchema, validateDocumentInput, xlsxSchema };
19
+
20
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../../src/schemas/index.ts"],"sourcesContent":["import { docxSchema } from \"./docx\";\nimport { pptxSchema } from \"./pptx\";\nimport { xlsxSchema } from \"./xlsx\";\n\nexport { docxSchema } from \"./docx\";\nexport { pptxSchema } from \"./pptx\";\nexport { xlsxSchema } from \"./xlsx\";\n\nexport const SCHEMAS = {\n docx: docxSchema,\n pptx: pptxSchema,\n xlsx: xlsxSchema,\n} as const;\n\nexport type DocumentType = \"docx\" | \"pptx\" | \"xlsx\";\n\nexport function validateDocumentInput(type: DocumentType, data: unknown): Record<string, unknown> {\n const result = SCHEMAS[type].safeParse(data);\n if (!result.success) {\n const issue = result.error.issues[0];\n const path = issue.path.join(\".\");\n throw new Error(`Invalid ${type} options${path ? ` at \"${path}\"` : \"\"}: ${issue.message}`);\n }\n return result.data as Record<string, unknown>;\n}\n"],"mappings":";;AAQA,MAAa,UAAU;CACrB,MAAM;CACN,MAAM;CACN,MAAM;AACR;AAIA,SAAgB,sBAAsB,MAAoB,MAAwC;CAChG,MAAM,SAAS,QAAQ,MAAM,UAAU,IAAI;CAC3C,IAAI,CAAC,OAAO,SAAS;EACnB,MAAM,QAAQ,OAAO,MAAM,OAAO;EAClC,MAAM,OAAO,MAAM,KAAK,KAAK,GAAG;EAChC,MAAM,IAAI,MAAM,WAAW,KAAK,UAAU,OAAO,QAAQ,KAAK,KAAK,GAAG,IAAI,MAAM,SAAS;CAC3F;CACA,OAAO,OAAO;AAChB"}
@@ -270,22 +270,6 @@ const xlsxSchema = z.object({
270
270
  revision: z.number().optional()
271
271
  }).passthrough();
272
272
  //#endregion
273
- //#region src/schemas/index.ts
274
- const SCHEMAS = {
275
- docx: docxSchema,
276
- pptx: pptxSchema,
277
- xlsx: xlsxSchema
278
- };
279
- function validateDocumentInput(type, data) {
280
- const result = SCHEMAS[type].safeParse(data);
281
- if (!result.success) {
282
- const issue = result.error.issues[0];
283
- const path = issue.path.join(".");
284
- throw new Error(`Invalid ${type} options${path ? ` at "${path}"` : ""}: ${issue.message}`);
285
- }
286
- return result.data;
287
- }
288
- //#endregion
289
- export { docxSchema as a, pptxSchema as i, validateDocumentInput as n, xlsxSchema as r, SCHEMAS as t };
273
+ export { pptxSchema as n, docxSchema as r, xlsxSchema as t };
290
274
 
291
- //# sourceMappingURL=schemas-BhTmC2Jb.mjs.map
275
+ //# sourceMappingURL=xlsx-Bd0Vtakp.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"xlsx-Bd0Vtakp.mjs","names":["anyObject","anyObject"],"sources":["../src/schemas/docx.ts","../src/schemas/pptx.ts","../src/schemas/xlsx.ts"],"sourcesContent":["import { z } from \"zod\";\n\nconst anyObject = z.record(z.string(), z.unknown()).describe(\"JSON object\");\n\nconst sectionChild = z.union([\n z.object({ paragraph: anyObject }).passthrough(),\n z.object({ table: anyObject }).passthrough(),\n z.object({ toc: anyObject }).passthrough(),\n z.object({ textbox: anyObject }).passthrough(),\n z.object({ sdt: anyObject }).passthrough(),\n z.object({ altChunk: anyObject }).passthrough(),\n z.object({ subDoc: anyObject }).passthrough(),\n anyObject,\n]);\n\nconst headerFooterGroup = z\n .object({\n default: anyObject.or(z.array(sectionChild.or(z.string()))).optional(),\n first: anyObject.or(z.array(sectionChild.or(z.string()))).optional(),\n even: anyObject.or(z.array(sectionChild.or(z.string()))).optional(),\n })\n .passthrough();\n\nexport const docxSchema = z\n .object({\n sections: z\n .array(\n z\n .object({\n properties: anyObject.optional(),\n children: z\n .array(sectionChild.or(z.string()))\n .describe(\n \"Section content: paragraphs ({ paragraph: {...} }), tables ({ table: {...} }), images, TOCs, etc.\",\n ),\n headers: headerFooterGroup.optional(),\n footers: headerFooterGroup.optional(),\n })\n .passthrough(),\n )\n .describe(\"Document sections (required)\"),\n title: z.string().optional(),\n subject: z.string().optional(),\n creator: z.string().optional(),\n keywords: z.string().optional(),\n description: z.string().optional(),\n lastModifiedBy: z.string().optional(),\n revision: z.number().optional(),\n externalStyles: z.string().optional(),\n styles: anyObject.optional(),\n numbering: anyObject.optional(),\n comments: anyObject.optional(),\n bibliography: anyObject.optional(),\n footnotes: z.record(z.string(), anyObject).optional(),\n endnotes: z.record(z.string(), anyObject).optional(),\n background: anyObject.optional(),\n features: anyObject.optional(),\n compatabilityModeVersion: z.number().optional(),\n compatibility: anyObject.optional(),\n customProperties: z.array(anyObject).optional(),\n evenAndOddHeaderAndFooters: z.boolean().optional(),\n defaultTabStop: z.number().optional(),\n fonts: z.array(anyObject).optional(),\n hyphenation: anyObject.optional(),\n characterSpacingControl: z.enum([\"compressPunctuation\", \"doNotCompress\"]).optional(),\n view: z.enum([\"none\", \"print\", \"outline\", \"masterPages\", \"normal\", \"web\"]).optional(),\n zoom: z\n .object({\n percent: z.number().optional(),\n val: z.enum([\"none\", \"fullPage\", \"bestFit\", \"textFit\"]).optional(),\n })\n .passthrough()\n .optional(),\n writeProtection: anyObject.optional(),\n displayBackgroundShape: z.boolean().optional(),\n embedTrueTypeFonts: z.boolean().optional(),\n embedSystemFonts: z.boolean().optional(),\n saveSubsetFonts: z.boolean().optional(),\n docVars: z.array(z.object({ name: z.string(), val: z.string() }).passthrough()).optional(),\n colorSchemeMapping: anyObject.optional(),\n })\n .passthrough();\n","import { z } from \"zod\";\n\nconst anyObject = z.record(z.string(), z.unknown()).describe(\"JSON object\");\n\nconst slideChild = z.union([\n z.object({ shape: anyObject }).passthrough(),\n z.object({ picture: anyObject }).passthrough(),\n z.object({ table: anyObject }).passthrough(),\n z.object({ chart: anyObject }).passthrough(),\n z.object({ line: anyObject }).passthrough(),\n z.object({ connector: anyObject }).passthrough(),\n z.object({ video: anyObject }).passthrough(),\n z.object({ audio: anyObject }).passthrough(),\n z.object({ group: anyObject }).passthrough(),\n z.object({ smartart: anyObject }).passthrough(),\n anyObject,\n]);\n\nconst slideComment = z\n .object({\n author: z.string(),\n text: z.string(),\n x: z.number(),\n y: z.number(),\n initials: z.string().optional(),\n date: z.string().optional(),\n })\n .passthrough();\n\nexport const pptxSchema = z\n .object({\n slides: z\n .array(\n z\n .object({\n children: z\n .array(slideChild.or(z.string()))\n .describe(\n \"Slide content: shapes ({ shape: {...} }), pictures ({ picture: {...} }), tables, charts, groups, lines, etc.\",\n ),\n background: anyObject.optional(),\n transition: anyObject.optional(),\n notes: z.string().optional(),\n layout: z\n .enum([\n \"blank\",\n \"title\",\n \"tx\",\n \"twoColTx\",\n \"titleOnly\",\n \"obj\",\n \"secHead\",\n \"chart\",\n \"tbl\",\n \"picTx\",\n \"twoObj\",\n \"twoTxTwoObj\",\n \"objTx\",\n \"vertTx\",\n \"vertTitleAndTx\",\n ])\n .optional(),\n master: z.string().optional(),\n comments: z.array(slideComment).optional(),\n headerFooter: anyObject.optional(),\n })\n .passthrough(),\n )\n .describe(\"Presentation slides (required)\"),\n size: z\n .union([z.enum([\"16:9\", \"4:3\"]), z.object({ width: z.number(), height: z.number() })])\n .optional()\n .describe('Slide size: \"16:9\", \"4:3\", or { width, height }'),\n masters: z.array(anyObject).optional().describe(\"Slide master definitions\"),\n show: z\n .object({\n loop: z.boolean().optional(),\n kiosk: z.boolean().optional(),\n showNarration: z.boolean().optional(),\n useTimings: z.boolean().optional(),\n })\n .passthrough()\n .optional(),\n title: z.string().optional(),\n subject: z.string().optional(),\n creator: z.string().optional(),\n keywords: z.string().optional(),\n description: z.string().optional(),\n lastModifiedBy: z.string().optional(),\n revision: z.number().optional(),\n })\n .passthrough();\n","import { z } from \"zod\";\n\nconst anyObject = z.record(z.string(), z.unknown()).describe(\"JSON object\");\n\nconst cellValue = z.union([z.string(), z.number(), z.boolean(), z.null()]);\n\nconst cellOptions = z.union([\n z\n .object({\n value: cellValue.optional(),\n reference: z.string().optional(),\n styleIndex: z.number().optional(),\n style: anyObject.optional(),\n formula: anyObject.optional(),\n })\n .passthrough(),\n cellValue,\n]);\n\nconst columnOptions = z\n .object({\n min: z.number(),\n max: z.number(),\n width: z.number().optional(),\n hidden: z.boolean().optional(),\n customWidth: z.boolean().optional(),\n })\n .passthrough();\n\nconst mergeCellOptions = z\n .object({\n from: z.object({ row: z.number(), col: z.number() }),\n to: z.object({ row: z.number(), col: z.number() }),\n })\n .passthrough();\n\nconst freezePaneOptions = z\n .object({\n row: z.number().optional(),\n col: z.number().optional(),\n })\n .passthrough();\n\nconst dataValidationOptions = z\n .object({\n sqref: z.string(),\n type: z\n .enum([\"none\", \"whole\", \"decimal\", \"list\", \"date\", \"time\", \"textLength\", \"custom\"])\n .optional(),\n operator: z\n .enum([\n \"between\",\n \"notBetween\",\n \"equal\",\n \"notEqual\",\n \"greaterThan\",\n \"lessThan\",\n \"greaterThanOrEqual\",\n \"lessThanOrEqual\",\n ])\n .optional(),\n formula1: z.string().optional(),\n formula2: z.string().optional(),\n allowBlank: z.boolean().optional(),\n showErrorMessage: z.boolean().optional(),\n errorTitle: z.string().optional(),\n error: z.string().optional(),\n showInputMessage: z.boolean().optional(),\n promptTitle: z.string().optional(),\n prompt: z.string().optional(),\n })\n .passthrough();\n\nconst conditionalFormatOptions = z\n .object({\n sqref: z.string(),\n rules: z.array(\n z\n .object({\n type: z.enum([\"cellIs\", \"containsText\", \"expression\", \"top10\", \"aboveAverage\"]),\n operator: z\n .enum([\n \"lessThan\",\n \"lessThanOrEqual\",\n \"equal\",\n \"notEqual\",\n \"greaterThanOrEqual\",\n \"greaterThan\",\n \"between\",\n \"notBetween\",\n \"containsText\",\n \"notContains\",\n \"beginsWith\",\n \"endsWith\",\n ])\n .optional(),\n formulas: z.array(z.string()).optional(),\n priority: z.number().optional(),\n dxfId: z.number().optional(),\n })\n .passthrough(),\n ),\n })\n .passthrough();\n\nexport const xlsxSchema = z\n .object({\n worksheets: z\n .array(\n z\n .object({\n name: z.string().optional().describe(\"Sheet display name\"),\n rows: z\n .array(\n z\n .object({\n cells: z.array(cellOptions).optional(),\n height: z.number().optional(),\n hidden: z.boolean().optional(),\n rowNumber: z.number().optional(),\n })\n .passthrough(),\n )\n .optional()\n .describe('Worksheet rows, each with \"cells\" array'),\n columns: z.array(columnOptions).optional(),\n mergeCells: z.array(mergeCellOptions).optional(),\n freezePanes: freezePaneOptions.optional(),\n autoFilter: z.string().optional(),\n images: z.array(anyObject).optional(),\n charts: z.array(anyObject).optional(),\n dataValidations: z.array(dataValidationOptions).optional(),\n conditionalFormats: z.array(conditionalFormatOptions).optional(),\n })\n .passthrough(),\n )\n .describe(\"Workbook worksheets (required)\"),\n title: z.string().optional(),\n subject: z.string().optional(),\n creator: z.string().optional(),\n keywords: z.string().optional(),\n description: z.string().optional(),\n lastModifiedBy: z.string().optional(),\n revision: z.number().optional(),\n })\n .passthrough();\n"],"mappings":";;AAEA,MAAMA,cAAY,EAAE,OAAO,EAAE,OAAO,GAAG,EAAE,QAAQ,CAAC,EAAE,SAAS,aAAa;AAE1E,MAAM,eAAe,EAAE,MAAM;CAC3B,EAAE,OAAO,EAAE,WAAWA,YAAU,CAAC,EAAE,YAAY;CAC/C,EAAE,OAAO,EAAE,OAAOA,YAAU,CAAC,EAAE,YAAY;CAC3C,EAAE,OAAO,EAAE,KAAKA,YAAU,CAAC,EAAE,YAAY;CACzC,EAAE,OAAO,EAAE,SAASA,YAAU,CAAC,EAAE,YAAY;CAC7C,EAAE,OAAO,EAAE,KAAKA,YAAU,CAAC,EAAE,YAAY;CACzC,EAAE,OAAO,EAAE,UAAUA,YAAU,CAAC,EAAE,YAAY;CAC9C,EAAE,OAAO,EAAE,QAAQA,YAAU,CAAC,EAAE,YAAY;CAC5CA;AACF,CAAC;AAED,MAAM,oBAAoB,EACvB,OAAO;CACN,SAASA,YAAU,GAAG,EAAE,MAAM,aAAa,GAAG,EAAE,OAAO,CAAC,CAAC,CAAC,EAAE,SAAS;CACrE,OAAOA,YAAU,GAAG,EAAE,MAAM,aAAa,GAAG,EAAE,OAAO,CAAC,CAAC,CAAC,EAAE,SAAS;CACnE,MAAMA,YAAU,GAAG,EAAE,MAAM,aAAa,GAAG,EAAE,OAAO,CAAC,CAAC,CAAC,EAAE,SAAS;AACpE,CAAC,EACA,YAAY;AAEf,MAAa,aAAa,EACvB,OAAO;CACN,UAAU,EACP,MACC,EACG,OAAO;EACN,YAAYA,YAAU,SAAS;EAC/B,UAAU,EACP,MAAM,aAAa,GAAG,EAAE,OAAO,CAAC,CAAC,EACjC,SACC,mGACF;EACF,SAAS,kBAAkB,SAAS;EACpC,SAAS,kBAAkB,SAAS;CACtC,CAAC,EACA,YAAY,CACjB,EACC,SAAS,8BAA8B;CAC1C,OAAO,EAAE,O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B,EAAE,SAAS;EAC/C,aAAa,kBAAkB,SAAS;EACxC,YAAY,EAAE,OAAO,EAAE,SAAS;EAChC,QAAQ,EAAE,MAAM,SAAS,EAAE,SAAS;EACpC,QAAQ,EAAE,MAAM,SAAS,EAAE,SAAS;EACpC,iBAAiB,EAAE,MAAM,qBAAqB,EAAE,SAAS;EACzD,oBAAoB,EAAE,MAAM,wBAAwB,EAAE,SAAS;CACjE,CAAC,EACA,YAAY,CACjB,EACC,SAAS,gCAAgC;CAC5C,OAAO,EAAE,OAAO,EAAE,SAAS;CAC3B,SAAS,EAAE,OAAO,EAAE,SAAS;CAC7B,SAAS,EAAE,OAAO,EAAE,SAAS;CAC7B,UAAU,EAAE,OAAO,EAAE,SAAS;CAC9B,aAAa,EAAE,OAAO,EAAE,SAAS;CACjC,gBAAgB,EAAE,OAAO,EAAE,SAAS;CACpC,UAAU,EAAE,OAAO,EAAE,SAAS;AAChC,CAAC,EACA,YAAY"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "office-open",
3
- "version": "0.8.1",
3
+ "version": "0.9.1",
4
4
  "description": "Unified Office document toolkit — CLI, AI SDK tools, Zod schemas, and all packages in one install",
5
5
  "keywords": [
6
6
  "ai",
@@ -21,7 +21,7 @@
21
21
  "author": {
22
22
  "name": "Demo Macro",
23
23
  "email": "abc@imst.xyz",
24
- "url": "https://imst.xyz/"
24
+ "url": "https://www.demomacro.com/"
25
25
  },
26
26
  "repository": {
27
27
  "type": "git",
@@ -77,11 +77,11 @@
77
77
  "dependencies": {
78
78
  "citty": "0.2.2",
79
79
  "zod": "4.4.3",
80
- "@office-open/xlsx": "0.8.1",
81
- "@office-open/core": "0.8.1",
82
- "@office-open/pptx": "0.8.1",
83
- "@office-open/xml": "0.8.1",
84
- "@office-open/docx": "0.8.1"
80
+ "@office-open/xlsx": "0.9.1",
81
+ "@office-open/core": "0.9.1",
82
+ "@office-open/pptx": "0.9.1",
83
+ "@office-open/xml": "0.9.1",
84
+ "@office-open/docx": "0.9.1"
85
85
  },
86
86
  "peerDependencies": {
87
87
  "ai": "^6.0.0"
@@ -1 +0,0 @@
1
- {"version":3,"file":"schemas-BhTmC2Jb.mjs","names":["anyObject","anyObject"],"sources":["../src/schemas/docx.ts","../src/schemas/pptx.ts","../src/schemas/xlsx.ts","../src/schemas/index.ts"],"sourcesContent":["import { z } from \"zod\";\n\nconst anyObject = z.record(z.string(), z.unknown()).describe(\"JSON object\");\n\nconst sectionChild = z.union([\n z.object({ paragraph: anyObject }).passthrough(),\n z.object({ table: anyObject }).passthrough(),\n z.object({ toc: anyObject }).passthrough(),\n z.object({ textbox: anyObject }).passthrough(),\n z.object({ sdt: anyObject }).passthrough(),\n z.object({ altChunk: anyObject }).passthrough(),\n z.object({ subDoc: anyObject }).passthrough(),\n anyObject,\n]);\n\nconst headerFooterGroup = z\n .object({\n default: anyObject.or(z.array(sectionChild.or(z.string()))).optional(),\n first: anyObject.or(z.array(sectionChild.or(z.string()))).optional(),\n even: anyObject.or(z.array(sectionChild.or(z.string()))).optional(),\n })\n .passthrough();\n\nexport const docxSchema = z\n .object({\n sections: z\n .array(\n z\n .object({\n properties: anyObject.optional(),\n children: z\n .array(sectionChild.or(z.string()))\n .describe(\n \"Section content: paragraphs ({ paragraph: {...} }), tables ({ table: {...} }), images, TOCs, etc.\",\n ),\n headers: headerFooterGroup.optional(),\n footers: headerFooterGroup.optional(),\n })\n .passthrough(),\n )\n .describe(\"Document sections (required)\"),\n title: z.string().optional(),\n subject: z.string().optional(),\n creator: z.string().optional(),\n keywords: z.string().optional(),\n description: z.string().optional(),\n lastModifiedBy: z.string().optional(),\n revision: z.number().optional(),\n externalStyles: z.string().optional(),\n styles: anyObject.optional(),\n numbering: anyObject.optional(),\n comments: anyObject.optional(),\n bibliography: anyObject.optional(),\n footnotes: z.record(z.string(), anyObject).optional(),\n endnotes: z.record(z.string(), anyObject).optional(),\n background: anyObject.optional(),\n features: anyObject.optional(),\n compatabilityModeVersion: z.number().optional(),\n compatibility: anyObject.optional(),\n customProperties: z.array(anyObject).optional(),\n evenAndOddHeaderAndFooters: z.boolean().optional(),\n defaultTabStop: z.number().optional(),\n fonts: z.array(anyObject).optional(),\n hyphenation: anyObject.optional(),\n characterSpacingControl: z.enum([\"compressPunctuation\", \"doNotCompress\"]).optional(),\n view: z.enum([\"none\", \"print\", \"outline\", \"masterPages\", \"normal\", \"web\"]).optional(),\n zoom: z\n .object({\n percent: z.number().optional(),\n val: z.enum([\"none\", \"fullPage\", \"bestFit\", \"textFit\"]).optional(),\n })\n .passthrough()\n .optional(),\n writeProtection: anyObject.optional(),\n displayBackgroundShape: z.boolean().optional(),\n embedTrueTypeFonts: z.boolean().optional(),\n embedSystemFonts: z.boolean().optional(),\n saveSubsetFonts: z.boolean().optional(),\n docVars: z.array(z.object({ name: z.string(), val: z.string() }).passthrough()).optional(),\n colorSchemeMapping: anyObject.optional(),\n })\n .passthrough();\n","import { z } from \"zod\";\n\nconst anyObject = z.record(z.string(), z.unknown()).describe(\"JSON object\");\n\nconst slideChild = z.union([\n z.object({ shape: anyObject }).passthrough(),\n z.object({ picture: anyObject }).passthrough(),\n z.object({ table: anyObject }).passthrough(),\n z.object({ chart: anyObject }).passthrough(),\n z.object({ line: anyObject }).passthrough(),\n z.object({ connector: anyObject }).passthrough(),\n z.object({ video: anyObject }).passthrough(),\n z.object({ audio: anyObject }).passthrough(),\n z.object({ group: anyObject }).passthrough(),\n z.object({ smartart: anyObject }).passthrough(),\n anyObject,\n]);\n\nconst slideComment = z\n .object({\n author: z.string(),\n text: z.string(),\n x: z.number(),\n y: z.number(),\n initials: z.string().optional(),\n date: z.string().optional(),\n })\n .passthrough();\n\nexport const pptxSchema = z\n .object({\n slides: z\n .array(\n z\n .object({\n children: z\n .array(slideChild.or(z.string()))\n .describe(\n \"Slide content: shapes ({ shape: {...} }), pictures ({ picture: {...} }), tables, charts, groups, lines, etc.\",\n ),\n background: anyObject.optional(),\n transition: anyObject.optional(),\n notes: z.string().optional(),\n layout: z\n .enum([\n \"blank\",\n \"title\",\n \"tx\",\n \"twoColTx\",\n \"titleOnly\",\n \"obj\",\n \"secHead\",\n \"chart\",\n \"tbl\",\n \"picTx\",\n \"twoObj\",\n \"twoTxTwoObj\",\n \"objTx\",\n \"vertTx\",\n \"vertTitleAndTx\",\n ])\n .optional(),\n master: z.string().optional(),\n comments: z.array(slideComment).optional(),\n headerFooter: anyObject.optional(),\n })\n .passthrough(),\n )\n .describe(\"Presentation slides (required)\"),\n size: z\n .union([z.enum([\"16:9\", \"4:3\"]), z.object({ width: z.number(), height: z.number() })])\n .optional()\n .describe('Slide size: \"16:9\", \"4:3\", or { width, height }'),\n masters: z.array(anyObject).optional().describe(\"Slide master definitions\"),\n show: z\n .object({\n loop: z.boolean().optional(),\n kiosk: z.boolean().optional(),\n showNarration: z.boolean().optional(),\n useTimings: z.boolean().optional(),\n })\n .passthrough()\n .optional(),\n title: z.string().optional(),\n subject: z.string().optional(),\n creator: z.string().optional(),\n keywords: z.string().optional(),\n description: z.string().optional(),\n lastModifiedBy: z.string().optional(),\n revision: z.number().optional(),\n })\n .passthrough();\n","import { z } from \"zod\";\n\nconst anyObject = z.record(z.string(), z.unknown()).describe(\"JSON object\");\n\nconst cellValue = z.union([z.string(), z.number(), z.boolean(), z.null()]);\n\nconst cellOptions = z.union([\n z\n .object({\n value: cellValue.optional(),\n reference: z.string().optional(),\n styleIndex: z.number().optional(),\n style: anyObject.optional(),\n formula: anyObject.optional(),\n })\n .passthrough(),\n cellValue,\n]);\n\nconst columnOptions = z\n .object({\n min: z.number(),\n max: z.number(),\n width: z.number().optional(),\n hidden: z.boolean().optional(),\n customWidth: z.boolean().optional(),\n })\n .passthrough();\n\nconst mergeCellOptions = z\n .object({\n from: z.object({ row: z.number(), col: z.number() }),\n to: z.object({ row: z.number(), col: z.number() }),\n })\n .passthrough();\n\nconst freezePaneOptions = z\n .object({\n row: z.number().optional(),\n col: z.number().optional(),\n })\n .passthrough();\n\nconst dataValidationOptions = z\n .object({\n sqref: z.string(),\n type: z\n .enum([\"none\", \"whole\", \"decimal\", \"list\", \"date\", \"time\", \"textLength\", \"custom\"])\n .optional(),\n operator: z\n .enum([\n \"between\",\n \"notBetween\",\n \"equal\",\n \"notEqual\",\n \"greaterThan\",\n \"lessThan\",\n \"greaterThanOrEqual\",\n \"lessThanOrEqual\",\n ])\n .optional(),\n formula1: z.string().optional(),\n formula2: z.string().optional(),\n allowBlank: z.boolean().optional(),\n showErrorMessage: z.boolean().optional(),\n errorTitle: z.string().optional(),\n error: z.string().optional(),\n showInputMessage: z.boolean().optional(),\n promptTitle: z.string().optional(),\n prompt: z.string().optional(),\n })\n .passthrough();\n\nconst conditionalFormatOptions = z\n .object({\n sqref: z.string(),\n rules: z.array(\n z\n .object({\n type: z.enum([\"cellIs\", \"containsText\", \"expression\", \"top10\", \"aboveAverage\"]),\n operator: z\n .enum([\n \"lessThan\",\n \"lessThanOrEqual\",\n \"equal\",\n \"notEqual\",\n \"greaterThanOrEqual\",\n \"greaterThan\",\n \"between\",\n \"notBetween\",\n \"containsText\",\n \"notContains\",\n \"beginsWith\",\n \"endsWith\",\n ])\n .optional(),\n formulas: z.array(z.string()).optional(),\n priority: z.number().optional(),\n dxfId: z.number().optional(),\n })\n .passthrough(),\n ),\n })\n .passthrough();\n\nexport const xlsxSchema = z\n .object({\n worksheets: z\n .array(\n z\n .object({\n name: z.string().optional().describe(\"Sheet display name\"),\n rows: z\n .array(\n z\n .object({\n cells: z.array(cellOptions).optional(),\n height: z.number().optional(),\n hidden: z.boolean().optional(),\n rowNumber: z.number().optional(),\n })\n .passthrough(),\n )\n .optional()\n .describe('Worksheet rows, each with \"cells\" array'),\n columns: z.array(columnOptions).optional(),\n mergeCells: z.array(mergeCellOptions).optional(),\n freezePanes: freezePaneOptions.optional(),\n autoFilter: z.string().optional(),\n images: z.array(anyObject).optional(),\n charts: z.array(anyObject).optional(),\n dataValidations: z.array(dataValidationOptions).optional(),\n conditionalFormats: z.array(conditionalFormatOptions).optional(),\n })\n .passthrough(),\n )\n .describe(\"Workbook worksheets (required)\"),\n title: z.string().optional(),\n subject: z.string().optional(),\n creator: z.string().optional(),\n keywords: z.string().optional(),\n description: z.string().optional(),\n lastModifiedBy: z.string().optional(),\n revision: z.number().optional(),\n })\n .passthrough();\n","import { docxSchema } from \"./docx\";\nimport { pptxSchema } from \"./pptx\";\nimport { xlsxSchema } from \"./xlsx\";\n\nexport { docxSchema } from \"./docx\";\nexport { pptxSchema } from \"./pptx\";\nexport { xlsxSchema } from \"./xlsx\";\n\nexport const SCHEMAS = {\n docx: docxSchema,\n pptx: pptxSchema,\n xlsx: xlsxSchema,\n} as const;\n\nexport type DocumentType = \"docx\" | \"pptx\" | \"xlsx\";\n\nexport function validateDocumentInput(type: DocumentType, data: unknown): Record<string, unknown> {\n const result = SCHEMAS[type].safeParse(data);\n if (!result.success) {\n const issue = result.error.issues[0];\n const path = issue.path.join(\".\");\n throw new Error(`Invalid ${type} options${path ? ` at \"${path}\"` : \"\"}: ${issue.message}`);\n }\n return result.data as Record<string, unknown>;\n}\n"],"mappings":";;AAEA,MAAMA,cAAY,EAAE,OAAO,EAAE,OAAO,GAAG,EAAE,QAAQ,CAAC,EAAE,SAAS,aAAa;AAE1E,MAAM,eAAe,EAAE,MAAM;CAC3B,EAAE,OAAO,EAAE,WAAWA,YAAU,CAAC,EAAE,YAAY;CAC/C,EAAE,OAAO,EAAE,OAAOA,YAAU,CAAC,EAAE,YAAY;CAC3C,EAAE,OAAO,EAAE,KAAKA,YAAU,CAAC,EAAE,YAAY;CACzC,EAAE,OAAO,EAAE,SAASA,YAAU,CAAC,EAAE,YAAY;CAC7C,EAAE,OAAO,EAAE,KAAKA,YAAU,CAAC,EAAE,YAAY;CACzC,EAAE,OAAO,EAAE,UAAUA,YAAU,CAAC,EAAE,YAAY;CAC9C,EAAE,OAAO,EAAE,QAAQA,YAAU,CAAC,EAAE,YAAY;CAC5CA;AACF,CAAC;AAED,MAAM,oBAAoB,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