office-open 0.9.7 → 0.9.8
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/dist/generate.d.mts +3 -3
- package/dist/generate.d.mts.map +1 -1
- package/dist/generate.mjs.map +1 -1
- package/package.json +6 -6
package/dist/generate.d.mts
CHANGED
|
@@ -11,9 +11,9 @@ interface GenerateOptionsMap {
|
|
|
11
11
|
xlsx: WorkbookOptions;
|
|
12
12
|
}
|
|
13
13
|
interface GenerateOptions<T extends GenerateType = GenerateType> {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
type: T;
|
|
15
|
+
options: GenerateOptionsMap[T];
|
|
16
|
+
outputType?: OutputType$1;
|
|
17
17
|
}
|
|
18
18
|
declare function generate<T extends GenerateType>(options: GenerateOptions<T>): Promise<unknown>;
|
|
19
19
|
declare function parseInput(input: string): Promise<Record<string, unknown>>;
|
package/dist/generate.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
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;
|
|
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;EACxD,IAAA,EAAM,CAAA;EACN,OAAA,EAAS,kBAAA,CAAmB,CAAA;EAC5B,UAAA,GAAa,YAAA;AAAA;AAAA,iBAGO,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.map
CHANGED
|
@@ -1 +1 @@
|
|
|
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
|
|
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 type: T;\n options: GenerateOptionsMap[T];\n 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"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "office-open",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.8",
|
|
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",
|
|
@@ -77,11 +77,11 @@
|
|
|
77
77
|
"dependencies": {
|
|
78
78
|
"citty": "0.2.2",
|
|
79
79
|
"zod": "4.4.3",
|
|
80
|
-
"@office-open/core": "0.9.
|
|
81
|
-
"@office-open/
|
|
82
|
-
"@office-open/
|
|
83
|
-
"@office-open/pptx": "0.9.
|
|
84
|
-
"@office-open/
|
|
80
|
+
"@office-open/core": "0.9.8",
|
|
81
|
+
"@office-open/docx": "0.9.8",
|
|
82
|
+
"@office-open/xlsx": "0.9.8",
|
|
83
|
+
"@office-open/pptx": "0.9.8",
|
|
84
|
+
"@office-open/xml": "0.9.8"
|
|
85
85
|
},
|
|
86
86
|
"peerDependencies": {
|
|
87
87
|
"ai": "^6.0.0"
|