@uploadista/flow-utility-zipjs 0.0.20-beta.8 → 0.0.20

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/index.cjs CHANGED
@@ -1 +1 @@
1
- var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},s=(n,r,a)=>(a=n==null?{}:e(i(n)),o(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));let c=require(`@uploadista/core/errors`),l=require(`@uploadista/core/flow`),u=require(`@uploadista/observability`),d=require(`effect`),f=require(`jszip`);f=s(f);const p=()=>d.Layer.succeed(l.ZipPlugin,l.ZipPlugin.of({zip:(e,t)=>d.Effect.gen(function*(){let{includeMetadata:n}=t,r=new f.default;for(let t of e){let e=t.metadata?.fileName||t.metadata?.originalName||t.id;r.file(e.toString(),t.data),n&&t.metadata&&r.file(`${e}.meta.json`,JSON.stringify(t.metadata,null,2))}let i=yield*d.Effect.tryPromise({try:()=>r.generateAsync({type:`nodebuffer`,compression:`DEFLATE`,compressionOptions:{level:6}}),catch:e=>c.UploadistaError.fromCode(`UNKNOWN_ERROR`,{body:`Failed to generate zip file`,cause:e})});return new Uint8Array(i.buffer,i.byteOffset,i.byteLength)}).pipe((0,u.withOperationSpan)(`zip`,`create`,{"zip.file_count":e.length,"zip.include_metadata":t.includeMetadata}))}));exports.zipJsPlugin=p;
1
+ var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},s=(n,r,a)=>(a=n==null?{}:e(i(n)),o(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));let c=require(`@uploadista/core/errors`),l=require(`@uploadista/core/flow`),u=require(`@uploadista/observability`),d=require(`effect`),f=require(`jszip`);f=s(f);const p=()=>d.Layer.succeed(l.ZipPlugin,l.ZipPlugin.of({zip:(e,t)=>d.Effect.gen(function*(){let{includeMetadata:n}=t,r=new f.default;for(let t of e){let e=t.metadata?.fileName||t.metadata?.originalName||t.id;r.file(e.toString(),t.data),n&&t.metadata&&r.file(`${e}.meta.json`,JSON.stringify(t.metadata,null,2))}let i=yield*d.Effect.tryPromise({try:()=>r.generateAsync({type:`nodebuffer`,compression:`DEFLATE`,compressionOptions:{level:6}}),catch:e=>c.UploadistaError.fromCode(`UNKNOWN_ERROR`,{body:`Failed to generate zip file`,cause:e})});return new Uint8Array(i.buffer,i.byteOffset,i.byteLength)}).pipe((0,u.withOperationSpan)(`zip`,`create`,{"zip.file_count":e.length,"zip.include_metadata":t.includeMetadata}))}));exports.zipPlugin=p;
package/dist/index.d.cts CHANGED
@@ -2,7 +2,7 @@ import { ZipPlugin } from "@uploadista/core/flow";
2
2
  import { Layer } from "effect";
3
3
 
4
4
  //#region src/zip-plugin.d.ts
5
- declare const zipJsPlugin: () => Layer.Layer<ZipPlugin, never, never>;
5
+ declare const zipPlugin: () => Layer.Layer<ZipPlugin, never, never>;
6
6
  //#endregion
7
- export { zipJsPlugin };
7
+ export { zipPlugin };
8
8
  //# sourceMappingURL=index.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.cts","names":[],"sources":["../src/zip-plugin.ts"],"sourcesContent":[],"mappings":";;;;cAMa,mBAAW,KAAA,CAAA,MAAA"}
1
+ {"version":3,"file":"index.d.cts","names":[],"sources":["../src/zip-plugin.ts"],"sourcesContent":[],"mappings":";;;;cAMa,iBAAS,KAAA,CAAA,MAAA"}
package/dist/index.d.mts CHANGED
@@ -2,7 +2,7 @@ import { ZipPlugin } from "@uploadista/core/flow";
2
2
  import { Layer } from "effect";
3
3
 
4
4
  //#region src/zip-plugin.d.ts
5
- declare const zipJsPlugin: () => Layer.Layer<ZipPlugin, never, never>;
5
+ declare const zipPlugin: () => Layer.Layer<ZipPlugin, never, never>;
6
6
  //#endregion
7
- export { zipJsPlugin };
7
+ export { zipPlugin };
8
8
  //# sourceMappingURL=index.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","names":[],"sources":["../src/zip-plugin.ts"],"sourcesContent":[],"mappings":";;;;cAMa,mBAAW,KAAA,CAAA,MAAA"}
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../src/zip-plugin.ts"],"sourcesContent":[],"mappings":";;;;cAMa,iBAAS,KAAA,CAAA,MAAA"}
package/dist/index.mjs CHANGED
@@ -1,2 +1,2 @@
1
- import{UploadistaError as e}from"@uploadista/core/errors";import{ZipPlugin as t}from"@uploadista/core/flow";import{withOperationSpan as n}from"@uploadista/observability";import{Effect as r,Layer as i}from"effect";import a from"jszip";const o=()=>i.succeed(t,t.of({zip:(t,i)=>r.gen(function*(){let{includeMetadata:n}=i,o=new a;for(let e of t){let t=e.metadata?.fileName||e.metadata?.originalName||e.id;o.file(t.toString(),e.data),n&&e.metadata&&o.file(`${t}.meta.json`,JSON.stringify(e.metadata,null,2))}let s=yield*r.tryPromise({try:()=>o.generateAsync({type:`nodebuffer`,compression:`DEFLATE`,compressionOptions:{level:6}}),catch:t=>e.fromCode(`UNKNOWN_ERROR`,{body:`Failed to generate zip file`,cause:t})});return new Uint8Array(s.buffer,s.byteOffset,s.byteLength)}).pipe(n(`zip`,`create`,{"zip.file_count":t.length,"zip.include_metadata":i.includeMetadata}))}));export{o as zipJsPlugin};
1
+ import{UploadistaError as e}from"@uploadista/core/errors";import{ZipPlugin as t}from"@uploadista/core/flow";import{withOperationSpan as n}from"@uploadista/observability";import{Effect as r,Layer as i}from"effect";import a from"jszip";const o=()=>i.succeed(t,t.of({zip:(t,i)=>r.gen(function*(){let{includeMetadata:n}=i,o=new a;for(let e of t){let t=e.metadata?.fileName||e.metadata?.originalName||e.id;o.file(t.toString(),e.data),n&&e.metadata&&o.file(`${t}.meta.json`,JSON.stringify(e.metadata,null,2))}let s=yield*r.tryPromise({try:()=>o.generateAsync({type:`nodebuffer`,compression:`DEFLATE`,compressionOptions:{level:6}}),catch:t=>e.fromCode(`UNKNOWN_ERROR`,{body:`Failed to generate zip file`,cause:t})});return new Uint8Array(s.buffer,s.byteOffset,s.byteLength)}).pipe(n(`zip`,`create`,{"zip.file_count":t.length,"zip.include_metadata":i.includeMetadata}))}));export{o as zipPlugin};
2
2
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":[],"sources":["../src/zip-plugin.ts"],"sourcesContent":["import { UploadistaError } from \"@uploadista/core/errors\";\nimport { ZipPlugin } from \"@uploadista/core/flow\";\nimport { withOperationSpan } from \"@uploadista/observability\";\nimport { Effect, Layer } from \"effect\";\nimport JSZip from \"jszip\";\n\nexport const zipJsPlugin = () => {\n return Layer.succeed(\n ZipPlugin,\n ZipPlugin.of({\n zip: (inputs, options) => {\n return Effect.gen(function* () {\n const { includeMetadata } = options;\n const zip = new JSZip();\n\n // Process all input files\n for (const input of inputs) {\n // Use metadata for filename if available, otherwise use id\n const fileName =\n input.metadata?.fileName ||\n input.metadata?.originalName ||\n input.id;\n\n zip.file(fileName.toString(), input.data);\n\n if (includeMetadata && input.metadata) {\n zip.file(\n `${fileName}.meta.json`,\n JSON.stringify(input.metadata, null, 2),\n );\n }\n }\n\n // Generate the zip file\n const zipBuffer = yield* Effect.tryPromise({\n try: () =>\n zip.generateAsync({\n type: \"nodebuffer\",\n compression: \"DEFLATE\",\n compressionOptions: {\n level: 6, // Good balance between speed and compression\n },\n }),\n catch: (error) =>\n UploadistaError.fromCode(\"UNKNOWN_ERROR\", {\n body: \"Failed to generate zip file\",\n cause: error,\n }),\n });\n\n // Convert to Uint8Array\n const zipBytes = new Uint8Array(\n zipBuffer.buffer,\n zipBuffer.byteOffset,\n zipBuffer.byteLength,\n );\n\n return zipBytes;\n }).pipe(\n withOperationSpan(\"zip\", \"create\", {\n \"zip.file_count\": inputs.length,\n \"zip.include_metadata\": options.includeMetadata,\n }),\n );\n },\n }),\n );\n};\n"],"mappings":"0OAMA,MAAa,MACJ,EAAM,QACX,EACA,EAAU,GAAG,CACX,KAAM,EAAQ,IACL,EAAO,IAAI,WAAa,CAC7B,GAAM,CAAE,mBAAoB,EACtB,EAAM,IAAI,EAGhB,IAAK,IAAM,KAAS,EAAQ,CAE1B,IAAM,EACJ,EAAM,UAAU,UAChB,EAAM,UAAU,cAChB,EAAM,GAER,EAAI,KAAK,EAAS,UAAU,CAAE,EAAM,KAAK,CAErC,GAAmB,EAAM,UAC3B,EAAI,KACF,GAAG,EAAS,YACZ,KAAK,UAAU,EAAM,SAAU,KAAM,EAAE,CACxC,CAKL,IAAM,EAAY,MAAO,EAAO,WAAW,CACzC,QACE,EAAI,cAAc,CAChB,KAAM,aACN,YAAa,UACb,mBAAoB,CAClB,MAAO,EACR,CACF,CAAC,CACJ,MAAQ,GACN,EAAgB,SAAS,gBAAiB,CACxC,KAAM,8BACN,MAAO,EACR,CAAC,CACL,CAAC,CASF,OANiB,IAAI,WACnB,EAAU,OACV,EAAU,WACV,EAAU,WACX,EAGD,CAAC,KACD,EAAkB,MAAO,SAAU,CACjC,iBAAkB,EAAO,OACzB,uBAAwB,EAAQ,gBACjC,CAAC,CACH,CAEJ,CAAC,CACH"}
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../src/zip-plugin.ts"],"sourcesContent":["import { UploadistaError } from \"@uploadista/core/errors\";\nimport { ZipPlugin } from \"@uploadista/core/flow\";\nimport { withOperationSpan } from \"@uploadista/observability\";\nimport { Effect, Layer } from \"effect\";\nimport JSZip from \"jszip\";\n\nexport const zipPlugin = () => {\n return Layer.succeed(\n ZipPlugin,\n ZipPlugin.of({\n zip: (inputs, options) => {\n return Effect.gen(function* () {\n const { includeMetadata } = options;\n const zip = new JSZip();\n\n // Process all input files\n for (const input of inputs) {\n // Use metadata for filename if available, otherwise use id\n const fileName =\n input.metadata?.fileName ||\n input.metadata?.originalName ||\n input.id;\n\n zip.file(fileName.toString(), input.data);\n\n if (includeMetadata && input.metadata) {\n zip.file(\n `${fileName}.meta.json`,\n JSON.stringify(input.metadata, null, 2),\n );\n }\n }\n\n // Generate the zip file\n const zipBuffer = yield* Effect.tryPromise({\n try: () =>\n zip.generateAsync({\n type: \"nodebuffer\",\n compression: \"DEFLATE\",\n compressionOptions: {\n level: 6, // Good balance between speed and compression\n },\n }),\n catch: (error) =>\n UploadistaError.fromCode(\"UNKNOWN_ERROR\", {\n body: \"Failed to generate zip file\",\n cause: error,\n }),\n });\n\n // Convert to Uint8Array\n const zipBytes = new Uint8Array(\n zipBuffer.buffer,\n zipBuffer.byteOffset,\n zipBuffer.byteLength,\n );\n\n return zipBytes;\n }).pipe(\n withOperationSpan(\"zip\", \"create\", {\n \"zip.file_count\": inputs.length,\n \"zip.include_metadata\": options.includeMetadata,\n }),\n );\n },\n }),\n );\n};\n"],"mappings":"0OAMA,MAAa,MACJ,EAAM,QACX,EACA,EAAU,GAAG,CACX,KAAM,EAAQ,IACL,EAAO,IAAI,WAAa,CAC7B,GAAM,CAAE,mBAAoB,EACtB,EAAM,IAAI,EAGhB,IAAK,IAAM,KAAS,EAAQ,CAE1B,IAAM,EACJ,EAAM,UAAU,UAChB,EAAM,UAAU,cAChB,EAAM,GAER,EAAI,KAAK,EAAS,UAAU,CAAE,EAAM,KAAK,CAErC,GAAmB,EAAM,UAC3B,EAAI,KACF,GAAG,EAAS,YACZ,KAAK,UAAU,EAAM,SAAU,KAAM,EAAE,CACxC,CAKL,IAAM,EAAY,MAAO,EAAO,WAAW,CACzC,QACE,EAAI,cAAc,CAChB,KAAM,aACN,YAAa,UACb,mBAAoB,CAClB,MAAO,EACR,CACF,CAAC,CACJ,MAAQ,GACN,EAAgB,SAAS,gBAAiB,CACxC,KAAM,8BACN,MAAO,EACR,CAAC,CACL,CAAC,CASF,OANiB,IAAI,WACnB,EAAU,OACV,EAAU,WACV,EAAU,WACX,EAGD,CAAC,KACD,EAAkB,MAAO,SAAU,CACjC,iBAAkB,EAAO,OACzB,uBAAwB,EAAQ,gBACjC,CAAC,CACH,CAEJ,CAAC,CACH"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@uploadista/flow-utility-zipjs",
3
3
  "type": "module",
4
- "version": "0.0.20-beta.8",
4
+ "version": "0.0.20",
5
5
  "description": "ZipJS utility for Uploadista Flow",
6
6
  "license": "MIT",
7
7
  "author": "Uploadista",
@@ -15,8 +15,8 @@
15
15
  },
16
16
  "dependencies": {
17
17
  "jszip": "3.10.1",
18
- "@uploadista/core": "0.0.20-beta.8",
19
- "@uploadista/observability": "0.0.20-beta.8"
18
+ "@uploadista/core": "0.0.20",
19
+ "@uploadista/observability": "0.0.20"
20
20
  },
21
21
  "peerDependencies": {
22
22
  "effect": "^3.0.0",
@@ -29,7 +29,7 @@
29
29
  "tsdown": "0.18.0",
30
30
  "vitest": "4.0.15",
31
31
  "zod": "4.2.0",
32
- "@uploadista/typescript-config": "0.0.20-beta.8"
32
+ "@uploadista/typescript-config": "0.0.20"
33
33
  },
34
34
  "scripts": {
35
35
  "build": "tsc --noEmit && tsdown",
package/src/zip-plugin.ts CHANGED
@@ -4,7 +4,7 @@ import { withOperationSpan } from "@uploadista/observability";
4
4
  import { Effect, Layer } from "effect";
5
5
  import JSZip from "jszip";
6
6
 
7
- export const zipJsPlugin = () => {
7
+ export const zipPlugin = () => {
8
8
  return Layer.succeed(
9
9
  ZipPlugin,
10
10
  ZipPlugin.of({