@ai-matrx/alchemy 0.16.0 → 0.17.5

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.
Files changed (45) hide show
  1. package/CHANGELOG.md +43 -1
  2. package/dist/core.cjs.map +1 -1
  3. package/dist/core.js +2 -2
  4. package/dist/core.js.map +1 -1
  5. package/dist/index.cjs.map +1 -1
  6. package/dist/index.js +2 -2
  7. package/dist/index.js.map +1 -1
  8. package/dist/operate-capture.cjs +1 -1
  9. package/dist/operate-capture.cjs.map +1 -1
  10. package/dist/operate-capture.d.cts +30 -1
  11. package/dist/operate-capture.d.ts +30 -1
  12. package/dist/operate-capture.js +1 -1
  13. package/dist/operate-capture.js.map +1 -1
  14. package/dist/operate-document.cjs.map +1 -1
  15. package/dist/operate-document.js +1 -1
  16. package/dist/operate-document.js.map +1 -1
  17. package/dist/operate-pptx.cjs +151 -0
  18. package/dist/operate-pptx.cjs.map +1 -0
  19. package/dist/operate-pptx.d.cts +2695 -0
  20. package/dist/operate-pptx.d.ts +2695 -0
  21. package/dist/operate-pptx.js +151 -0
  22. package/dist/operate-pptx.js.map +1 -0
  23. package/dist/operate-read.cjs +2 -2
  24. package/dist/operate-read.cjs.map +1 -1
  25. package/dist/operate-read.js +2 -2
  26. package/dist/operate-read.js.map +1 -1
  27. package/dist/operate-rich-html.cjs.map +1 -1
  28. package/dist/operate-rich-html.js +1 -1
  29. package/dist/operate-rich-html.js.map +1 -1
  30. package/dist/operate-server.cjs.map +1 -1
  31. package/dist/operate-server.js +1 -1
  32. package/dist/operate-server.js.map +1 -1
  33. package/dist/operate-xlsx.cjs.map +1 -1
  34. package/dist/operate-xlsx.js +1 -1
  35. package/dist/operate-xlsx.js.map +1 -1
  36. package/dist/operate-zip.cjs +2 -0
  37. package/dist/operate-zip.cjs.map +1 -0
  38. package/dist/operate-zip.d.cts +35 -0
  39. package/dist/operate-zip.d.ts +35 -0
  40. package/dist/operate-zip.js +2 -0
  41. package/dist/operate-zip.js.map +1 -0
  42. package/dist/operate.cjs.map +1 -1
  43. package/dist/operate.js +2 -2
  44. package/dist/operate.js.map +1 -1
  45. package/package.json +26 -4
@@ -0,0 +1,2 @@
1
+ "use strict";var __create=Object.create;var __defProp=Object.defineProperty;var __getOwnPropDesc=Object.getOwnPropertyDescriptor;var __getOwnPropNames=Object.getOwnPropertyNames;var __getProtoOf=Object.getPrototypeOf,__hasOwnProp=Object.prototype.hasOwnProperty;var __export=(target,all)=>{for(var name in all)__defProp(target,name,{get:all[name],enumerable:!0})},__copyProps=(to,from,except,desc)=>{if(from&&typeof from=="object"||typeof from=="function")for(let key of __getOwnPropNames(from))!__hasOwnProp.call(to,key)&&key!==except&&__defProp(to,key,{get:()=>from[key],enumerable:!(desc=__getOwnPropDesc(from,key))||desc.enumerable});return to};var __toESM=(mod,isNodeMode,target)=>(target=mod!=null?__create(__getProtoOf(mod)):{},__copyProps(isNodeMode||!mod||!mod.__esModule?__defProp(target,"default",{value:mod,enumerable:!0}):target,mod)),__toCommonJS=mod=>__copyProps(__defProp({},"__esModule",{value:!0}),mod);var operate_zip_exports={};__export(operate_zip_exports,{buildZip:()=>buildZip,readZip:()=>readZip});module.exports=__toCommonJS(operate_zip_exports);async function buildZip(entries,options={}){let{default:JSZip}=await import("jszip"),zip=new JSZip;for(let e of entries)zip.file(e.path,e.data,e.date?{date:e.date}:void 0);return zip.generateAsync({type:"blob",compression:options.compression??"STORE",...options.level?{compressionOptions:{level:options.level}}:{},...options.comment?{comment:options.comment}:{}})}async function readZip(input){let{default:JSZip}=await import("jszip"),zip=await JSZip.loadAsync(input),wrap=o=>({path:o.name,directory:o.dir,text:()=>o.async("string"),bytes:()=>o.async("uint8array")});return{files:Object.values(zip.files).map(wrap),get:path=>zip.file(path)?wrap(zip.file(path)):null}}
2
+ //# sourceMappingURL=operate-zip.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/operate-zip.ts","../src/operate/zip.ts"],"sourcesContent":["/** `@ai-matrx/alchemy/operate/zip` — the one zip door (files → archive Blob, archive → files). JSZip loads on first use. */\nexport { buildZip, readZip, type ZipArchive, type ZipBuildOptions, type ZipEntry, type ZipFile } from \"./operate/zip\";\n","/**\n * `@ai-matrx/alchemy/operate/zip` — THE zip door: files in → one archive Blob, an archive in → its files.\n * JSZip loads on first use (`import()`), so a page that never zips never downloads it.\n */\n\nexport type ZipEntry = {\n /** Path inside the archive; `a/b.txt` creates the folder. */\n path: string;\n data: string | Uint8Array | ArrayBuffer | Blob;\n /** A fixed modification time keeps the bytes reproducible. */\n date?: Date;\n};\nexport type ZipBuildOptions = {\n compression?: \"STORE\" | \"DEFLATE\";\n /** 1 (fast) – 9 (small); DEFLATE only. */\n level?: number;\n comment?: string;\n};\n\n/** Pack entries into a zip Blob. */\nexport async function buildZip(entries: readonly ZipEntry[], options: ZipBuildOptions = {}): Promise<Blob> {\n const { default: JSZip } = await import(\"jszip\");\n const zip = new JSZip();\n for (const e of entries) zip.file(e.path, e.data, e.date ? { date: e.date } : undefined);\n return zip.generateAsync({\n type: \"blob\",\n compression: options.compression ?? \"STORE\",\n ...(options.level ? { compressionOptions: { level: options.level } } : {}),\n ...(options.comment ? { comment: options.comment } : {}),\n });\n}\n\nexport type ZipFile = {\n path: string;\n directory: boolean;\n text(): Promise<string>;\n bytes(): Promise<Uint8Array>;\n};\nexport type ZipArchive = {\n /** Every entry (folders included), in archive order. */\n files: ZipFile[];\n /** One entry by exact path, or null. */\n get(path: string): ZipFile | null;\n};\n\n/** Open an archive from bytes or a Blob/File. Throws when the bytes are not a zip. */\nexport async function readZip(input: Uint8Array | ArrayBuffer | Blob): Promise<ZipArchive> {\n const { default: JSZip } = await import(\"jszip\");\n const zip = await JSZip.loadAsync(input);\n const wrap = (o: import(\"jszip\").JSZipObject): ZipFile => ({\n path: o.name,\n directory: o.dir,\n text: () => o.async(\"string\"),\n bytes: () => o.async(\"uint8array\"),\n });\n const files = Object.values(zip.files).map(wrap);\n return { files, get: (path) => (zip.file(path) ? wrap(zip.file(path)!) : null) };\n}\n"],"mappings":"y5BAAA,sJCoBA,eAAsB,SAAS,QAA8B,QAA2B,CAAC,EAAkB,CACzG,GAAM,CAAE,QAAS,KAAM,EAAI,KAAM,QAAO,OAAO,EACzC,IAAM,IAAI,MAChB,QAAW,KAAK,QAAS,IAAI,KAAK,EAAE,KAAM,EAAE,KAAM,EAAE,KAAO,CAAE,KAAM,EAAE,IAAK,EAAI,MAAS,EACvF,OAAO,IAAI,cAAc,CACvB,KAAM,OACN,YAAa,QAAQ,aAAe,QACpC,GAAI,QAAQ,MAAQ,CAAE,mBAAoB,CAAE,MAAO,QAAQ,KAAM,CAAE,EAAI,CAAC,EACxE,GAAI,QAAQ,QAAU,CAAE,QAAS,QAAQ,OAAQ,EAAI,CAAC,CACxD,CAAC,CACH,CAgBA,eAAsB,QAAQ,MAA6D,CACzF,GAAM,CAAE,QAAS,KAAM,EAAI,KAAM,QAAO,OAAO,EACzC,IAAM,MAAM,MAAM,UAAU,KAAK,EACjC,KAAQ,IAA6C,CACzD,KAAM,EAAE,KACR,UAAW,EAAE,IACb,KAAM,IAAM,EAAE,MAAM,QAAQ,EAC5B,MAAO,IAAM,EAAE,MAAM,YAAY,CACnC,GAEA,MAAO,CAAE,MADK,OAAO,OAAO,IAAI,KAAK,EAAE,IAAI,IAAI,EAC/B,IAAM,MAAU,IAAI,KAAK,IAAI,EAAI,KAAK,IAAI,KAAK,IAAI,CAAE,EAAI,IAAM,CACjF","names":[]}
@@ -0,0 +1,35 @@
1
+ /**
2
+ * `@ai-matrx/alchemy/operate/zip` — THE zip door: files in → one archive Blob, an archive in → its files.
3
+ * JSZip loads on first use (`import()`), so a page that never zips never downloads it.
4
+ */
5
+ type ZipEntry = {
6
+ /** Path inside the archive; `a/b.txt` creates the folder. */
7
+ path: string;
8
+ data: string | Uint8Array | ArrayBuffer | Blob;
9
+ /** A fixed modification time keeps the bytes reproducible. */
10
+ date?: Date;
11
+ };
12
+ type ZipBuildOptions = {
13
+ compression?: "STORE" | "DEFLATE";
14
+ /** 1 (fast) – 9 (small); DEFLATE only. */
15
+ level?: number;
16
+ comment?: string;
17
+ };
18
+ /** Pack entries into a zip Blob. */
19
+ declare function buildZip(entries: readonly ZipEntry[], options?: ZipBuildOptions): Promise<Blob>;
20
+ type ZipFile = {
21
+ path: string;
22
+ directory: boolean;
23
+ text(): Promise<string>;
24
+ bytes(): Promise<Uint8Array>;
25
+ };
26
+ type ZipArchive = {
27
+ /** Every entry (folders included), in archive order. */
28
+ files: ZipFile[];
29
+ /** One entry by exact path, or null. */
30
+ get(path: string): ZipFile | null;
31
+ };
32
+ /** Open an archive from bytes or a Blob/File. Throws when the bytes are not a zip. */
33
+ declare function readZip(input: Uint8Array | ArrayBuffer | Blob): Promise<ZipArchive>;
34
+
35
+ export { type ZipArchive, type ZipBuildOptions, type ZipEntry, type ZipFile, buildZip, readZip };
@@ -0,0 +1,35 @@
1
+ /**
2
+ * `@ai-matrx/alchemy/operate/zip` — THE zip door: files in → one archive Blob, an archive in → its files.
3
+ * JSZip loads on first use (`import()`), so a page that never zips never downloads it.
4
+ */
5
+ type ZipEntry = {
6
+ /** Path inside the archive; `a/b.txt` creates the folder. */
7
+ path: string;
8
+ data: string | Uint8Array | ArrayBuffer | Blob;
9
+ /** A fixed modification time keeps the bytes reproducible. */
10
+ date?: Date;
11
+ };
12
+ type ZipBuildOptions = {
13
+ compression?: "STORE" | "DEFLATE";
14
+ /** 1 (fast) – 9 (small); DEFLATE only. */
15
+ level?: number;
16
+ comment?: string;
17
+ };
18
+ /** Pack entries into a zip Blob. */
19
+ declare function buildZip(entries: readonly ZipEntry[], options?: ZipBuildOptions): Promise<Blob>;
20
+ type ZipFile = {
21
+ path: string;
22
+ directory: boolean;
23
+ text(): Promise<string>;
24
+ bytes(): Promise<Uint8Array>;
25
+ };
26
+ type ZipArchive = {
27
+ /** Every entry (folders included), in archive order. */
28
+ files: ZipFile[];
29
+ /** One entry by exact path, or null. */
30
+ get(path: string): ZipFile | null;
31
+ };
32
+ /** Open an archive from bytes or a Blob/File. Throws when the bytes are not a zip. */
33
+ declare function readZip(input: Uint8Array | ArrayBuffer | Blob): Promise<ZipArchive>;
34
+
35
+ export { type ZipArchive, type ZipBuildOptions, type ZipEntry, type ZipFile, buildZip, readZip };
@@ -0,0 +1,2 @@
1
+ async function buildZip(entries,options={}){let{default:JSZip}=await import("jszip"),zip=new JSZip;for(let e of entries)zip.file(e.path,e.data,e.date?{date:e.date}:void 0);return zip.generateAsync({type:"blob",compression:options.compression??"STORE",...options.level?{compressionOptions:{level:options.level}}:{},...options.comment?{comment:options.comment}:{}})}async function readZip(input){let{default:JSZip}=await import("jszip"),zip=await JSZip.loadAsync(input),wrap=o=>({path:o.name,directory:o.dir,text:()=>o.async("string"),bytes:()=>o.async("uint8array")});return{files:Object.values(zip.files).map(wrap),get:path=>zip.file(path)?wrap(zip.file(path)):null}}export{buildZip,readZip};
2
+ //# sourceMappingURL=operate-zip.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/operate/zip.ts"],"sourcesContent":["/**\n * `@ai-matrx/alchemy/operate/zip` — THE zip door: files in → one archive Blob, an archive in → its files.\n * JSZip loads on first use (`import()`), so a page that never zips never downloads it.\n */\n\nexport type ZipEntry = {\n /** Path inside the archive; `a/b.txt` creates the folder. */\n path: string;\n data: string | Uint8Array | ArrayBuffer | Blob;\n /** A fixed modification time keeps the bytes reproducible. */\n date?: Date;\n};\nexport type ZipBuildOptions = {\n compression?: \"STORE\" | \"DEFLATE\";\n /** 1 (fast) – 9 (small); DEFLATE only. */\n level?: number;\n comment?: string;\n};\n\n/** Pack entries into a zip Blob. */\nexport async function buildZip(entries: readonly ZipEntry[], options: ZipBuildOptions = {}): Promise<Blob> {\n const { default: JSZip } = await import(\"jszip\");\n const zip = new JSZip();\n for (const e of entries) zip.file(e.path, e.data, e.date ? { date: e.date } : undefined);\n return zip.generateAsync({\n type: \"blob\",\n compression: options.compression ?? \"STORE\",\n ...(options.level ? { compressionOptions: { level: options.level } } : {}),\n ...(options.comment ? { comment: options.comment } : {}),\n });\n}\n\nexport type ZipFile = {\n path: string;\n directory: boolean;\n text(): Promise<string>;\n bytes(): Promise<Uint8Array>;\n};\nexport type ZipArchive = {\n /** Every entry (folders included), in archive order. */\n files: ZipFile[];\n /** One entry by exact path, or null. */\n get(path: string): ZipFile | null;\n};\n\n/** Open an archive from bytes or a Blob/File. Throws when the bytes are not a zip. */\nexport async function readZip(input: Uint8Array | ArrayBuffer | Blob): Promise<ZipArchive> {\n const { default: JSZip } = await import(\"jszip\");\n const zip = await JSZip.loadAsync(input);\n const wrap = (o: import(\"jszip\").JSZipObject): ZipFile => ({\n path: o.name,\n directory: o.dir,\n text: () => o.async(\"string\"),\n bytes: () => o.async(\"uint8array\"),\n });\n const files = Object.values(zip.files).map(wrap);\n return { files, get: (path) => (zip.file(path) ? wrap(zip.file(path)!) : null) };\n}\n"],"mappings":"AAoBA,eAAsB,SAAS,QAA8B,QAA2B,CAAC,EAAkB,CACzG,GAAM,CAAE,QAAS,KAAM,EAAI,KAAM,QAAO,OAAO,EACzC,IAAM,IAAI,MAChB,QAAW,KAAK,QAAS,IAAI,KAAK,EAAE,KAAM,EAAE,KAAM,EAAE,KAAO,CAAE,KAAM,EAAE,IAAK,EAAI,MAAS,EACvF,OAAO,IAAI,cAAc,CACvB,KAAM,OACN,YAAa,QAAQ,aAAe,QACpC,GAAI,QAAQ,MAAQ,CAAE,mBAAoB,CAAE,MAAO,QAAQ,KAAM,CAAE,EAAI,CAAC,EACxE,GAAI,QAAQ,QAAU,CAAE,QAAS,QAAQ,OAAQ,EAAI,CAAC,CACxD,CAAC,CACH,CAgBA,eAAsB,QAAQ,MAA6D,CACzF,GAAM,CAAE,QAAS,KAAM,EAAI,KAAM,QAAO,OAAO,EACzC,IAAM,MAAM,MAAM,UAAU,KAAK,EACjC,KAAQ,IAA6C,CACzD,KAAM,EAAE,KACR,UAAW,EAAE,IACb,KAAM,IAAM,EAAE,MAAM,QAAQ,EAC5B,MAAO,IAAM,EAAE,MAAM,YAAY,CACnC,GAEA,MAAO,CAAE,MADK,OAAO,OAAO,IAAI,KAAK,EAAE,IAAI,IAAI,EAC/B,IAAM,MAAU,IAAI,KAAK,IAAI,EAAI,KAAK,IAAI,KAAK,IAAI,CAAE,EAAI,IAAM,CACjF","names":[]}