@uploadista/flow-utility-zipjs 0.0.3 → 0.0.4

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.
@@ -1,5 +1,22 @@
1
1
 
2
2
  
3
- > @uploadista/flow-utility-zipjs@0.0.2 build /Users/denislaboureyras/Documents/uploadista/dev/uploadista-workspace/uploadista-sdk/packages/flow/utility/zipjs
4
- > tsc -b
3
+ > @uploadista/flow-utility-zipjs@0.0.3 build /Users/denislaboureyras/Documents/uploadista/dev/uploadista-workspace/uploadista-sdk/packages/flow/utility/zipjs
4
+ > tsdown
5
5
 
6
+ ℹ tsdown v0.15.9 powered by rolldown v1.0.0-beta.44
7
+ ℹ Using tsdown config: /Users/denislaboureyras/Documents/uploadista/dev/uploadista-workspace/uploadista-sdk/packages/flow/utility/zipjs/tsdown.config.ts
8
+ ℹ entry: src/index.ts
9
+ ℹ tsconfig: tsconfig.json
10
+ ℹ Build start
11
+ ℹ Cleaning 7 files
12
+ ℹ [CJS] dist/index.cjs 1.26 kB │ gzip: 0.75 kB
13
+ ℹ [CJS] 1 files, total: 1.26 kB
14
+ ℹ [ESM] dist/index.js 0.77 kB │ gzip: 0.51 kB
15
+ ℹ [ESM] dist/index.js.map 2.59 kB │ gzip: 1.07 kB
16
+ ℹ [ESM] dist/index.d.ts.map 0.14 kB │ gzip: 0.14 kB
17
+ ℹ [ESM] dist/index.d.ts 0.26 kB │ gzip: 0.19 kB
18
+ ℹ [ESM] 4 files, total: 3.76 kB
19
+ ℹ [CJS] dist/index.d.cts.map 0.14 kB │ gzip: 0.14 kB
20
+ ℹ [CJS] dist/index.d.cts 0.26 kB │ gzip: 0.20 kB
21
+ ℹ [CJS] 2 files, total: 0.40 kB
22
+ ✔ Build complete in 15133ms
package/dist/index.cjs ADDED
@@ -0,0 +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`);c=s(c);let l=require(`@uploadista/core/flow`);l=s(l);let u=require(`effect`);u=s(u);let d=require(`jszip`);d=s(d);const f=()=>u.Layer.succeed(l.ZipPlugin,l.ZipPlugin.of({zip:(e,t)=>u.Effect.gen(function*(){let{includeMetadata:n}=t,r=new d.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*u.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)})}));exports.zipJsPlugin=f;
@@ -0,0 +1,8 @@
1
+ import { ZipPlugin } from "@uploadista/core/flow";
2
+ import { Layer } from "effect";
3
+
4
+ //#region src/zip-plugin.d.ts
5
+ declare const zipJsPlugin: () => Layer.Layer<ZipPlugin, never, never>;
6
+ //#endregion
7
+ export { zipJsPlugin };
8
+ //# sourceMappingURL=index.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.cts","names":[],"sources":["../src/zip-plugin.ts"],"sourcesContent":[],"mappings":";;;;cAKa,mBAAW,KAAA,CAAA,MAAA"}
package/dist/index.d.ts CHANGED
@@ -1,2 +1,8 @@
1
- export * from "./zip-plugin";
1
+ import { ZipPlugin } from "@uploadista/core/flow";
2
+ import { Layer } from "effect";
3
+
4
+ //#region src/zip-plugin.d.ts
5
+ declare const zipJsPlugin: () => Layer.Layer<ZipPlugin, never, never>;
6
+ //#endregion
7
+ export { zipJsPlugin };
2
8
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC"}
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../src/zip-plugin.ts"],"sourcesContent":[],"mappings":";;;;cAKa,mBAAW,KAAA,CAAA,MAAA"}
package/dist/index.js CHANGED
@@ -1 +1,2 @@
1
- export * from "./zip-plugin";
1
+ import{UploadistaError as e}from"@uploadista/core/errors";import{ZipPlugin as t}from"@uploadista/core/flow";import{Effect as n,Layer as r}from"effect";import i from"jszip";const a=()=>r.succeed(t,t.of({zip:(t,r)=>n.gen(function*(){let{includeMetadata:a}=r,o=new i;for(let e of t){let t=e.metadata?.fileName||e.metadata?.originalName||e.id;o.file(t.toString(),e.data),a&&e.metadata&&o.file(`${t}.meta.json`,JSON.stringify(e.metadata,null,2))}let s=yield*n.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)})}));export{a as zipJsPlugin};
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":[],"sources":["../src/zip-plugin.ts"],"sourcesContent":["import { UploadistaError } from \"@uploadista/core/errors\";\nimport { ZipPlugin } from \"@uploadista/core/flow\";\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 });\n },\n }),\n );\n};\n"],"mappings":"4KAKA,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,CAEL,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.3",
4
+ "version": "0.0.4",
5
5
  "description": "ZipJS utility for Uploadista Flow",
6
6
  "license": "MIT",
7
7
  "author": "Uploadista",
@@ -16,14 +16,15 @@
16
16
  "effect": "3.18.4",
17
17
  "jszip": "3.10.1",
18
18
  "zod": "4.1.12",
19
- "@uploadista/core": "0.0.3"
19
+ "@uploadista/core": "0.0.4"
20
20
  },
21
21
  "devDependencies": {
22
22
  "@types/node": "24.8.1",
23
- "@uploadista/typescript-config": "0.0.3"
23
+ "tsdown": "0.15.9",
24
+ "@uploadista/typescript-config": "0.0.4"
24
25
  },
25
26
  "scripts": {
26
- "build": "tsc -b",
27
+ "build": "tsdown",
27
28
  "format": "biome format --write ./src",
28
29
  "lint": "biome lint --write ./src",
29
30
  "check": "biome check --write ./src"
@@ -0,0 +1,11 @@
1
+ import { defineConfig } from "tsdown";
2
+
3
+ export default defineConfig({
4
+ entry: {
5
+ index: "src/index.ts",
6
+ },
7
+ minify: true,
8
+ format: ["esm", "cjs"],
9
+ dts: true,
10
+ outDir: "dist",
11
+ });
@@ -1,4 +0,0 @@
1
- import { ZipPlugin } from "@uploadista/core/flow";
2
- import { Layer } from "effect";
3
- export declare const zipJsPlugin: () => Layer.Layer<ZipPlugin, never, never>;
4
- //# sourceMappingURL=zip-plugin.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"zip-plugin.d.ts","sourceRoot":"","sources":["../src/zip-plugin.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAU,KAAK,EAAE,MAAM,QAAQ,CAAC;AAGvC,eAAO,MAAM,WAAW,4CAwDvB,CAAC"}
@@ -1,42 +0,0 @@
1
- import { UploadistaError } from "@uploadista/core/errors";
2
- import { ZipPlugin } from "@uploadista/core/flow";
3
- import { Effect, Layer } from "effect";
4
- import JSZip from "jszip";
5
- export const zipJsPlugin = () => {
6
- return Layer.succeed(ZipPlugin, ZipPlugin.of({
7
- zip: (inputs, options) => {
8
- return Effect.gen(function* () {
9
- const { includeMetadata } = options;
10
- const zip = new JSZip();
11
- // Process all input files
12
- for (const input of inputs) {
13
- // Use metadata for filename if available, otherwise use id
14
- const fileName = input.metadata?.fileName ||
15
- input.metadata?.originalName ||
16
- input.id;
17
- zip.file(fileName.toString(), input.data);
18
- if (includeMetadata && input.metadata) {
19
- zip.file(`${fileName}.meta.json`, JSON.stringify(input.metadata, null, 2));
20
- }
21
- }
22
- // Generate the zip file
23
- const zipBuffer = yield* Effect.tryPromise({
24
- try: () => zip.generateAsync({
25
- type: "nodebuffer",
26
- compression: "DEFLATE",
27
- compressionOptions: {
28
- level: 6, // Good balance between speed and compression
29
- },
30
- }),
31
- catch: (error) => UploadistaError.fromCode("UNKNOWN_ERROR", {
32
- body: "Failed to generate zip file",
33
- cause: error,
34
- }),
35
- });
36
- // Convert to Uint8Array
37
- const zipBytes = new Uint8Array(zipBuffer.buffer, zipBuffer.byteOffset, zipBuffer.byteLength);
38
- return zipBytes;
39
- });
40
- },
41
- }));
42
- };