@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.
- package/.turbo/turbo-build.log +19 -2
- package/dist/index.cjs +1 -0
- package/dist/index.d.cts +8 -0
- package/dist/index.d.cts.map +1 -0
- package/dist/index.d.ts +7 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -0
- package/package.json +5 -4
- package/tsdown.config.ts +11 -0
- package/dist/zip-plugin.d.ts +0 -4
- package/dist/zip-plugin.d.ts.map +0 -1
- package/dist/zip-plugin.js +0 -42
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
|
|
2
2
|
|
|
3
|
-
> @uploadista/flow-utility-zipjs@0.0.
|
|
4
|
-
>
|
|
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
|
+
[34mℹ[39m tsdown [2mv0.15.9[22m powered by rolldown [2mv1.0.0-beta.44[22m
|
|
7
|
+
[34mℹ[39m Using tsdown config: [4m/Users/denislaboureyras/Documents/uploadista/dev/uploadista-workspace/uploadista-sdk/packages/flow/utility/zipjs/tsdown.config.ts[24m
|
|
8
|
+
[34mℹ[39m entry: [34msrc/index.ts[39m
|
|
9
|
+
[34mℹ[39m tsconfig: [34mtsconfig.json[39m
|
|
10
|
+
[34mℹ[39m Build start
|
|
11
|
+
[34mℹ[39m Cleaning 7 files
|
|
12
|
+
[34mℹ[39m [33m[CJS][39m [2mdist/[22m[1mindex.cjs[22m [2m1.26 kB[22m [2m│ gzip: 0.75 kB[22m
|
|
13
|
+
[34mℹ[39m [33m[CJS][39m 1 files, total: 1.26 kB
|
|
14
|
+
[34mℹ[39m [34m[ESM][39m [2mdist/[22m[1mindex.js[22m [2m0.77 kB[22m [2m│ gzip: 0.51 kB[22m
|
|
15
|
+
[34mℹ[39m [34m[ESM][39m [2mdist/[22mindex.js.map [2m2.59 kB[22m [2m│ gzip: 1.07 kB[22m
|
|
16
|
+
[34mℹ[39m [34m[ESM][39m [2mdist/[22mindex.d.ts.map [2m0.14 kB[22m [2m│ gzip: 0.14 kB[22m
|
|
17
|
+
[34mℹ[39m [34m[ESM][39m [2mdist/[22m[32m[1mindex.d.ts[22m[39m [2m0.26 kB[22m [2m│ gzip: 0.19 kB[22m
|
|
18
|
+
[34mℹ[39m [34m[ESM][39m 4 files, total: 3.76 kB
|
|
19
|
+
[34mℹ[39m [33m[CJS][39m [2mdist/[22mindex.d.cts.map [2m0.14 kB[22m [2m│ gzip: 0.14 kB[22m
|
|
20
|
+
[34mℹ[39m [33m[CJS][39m [2mdist/[22m[32m[1mindex.d.cts[22m[39m [2m0.26 kB[22m [2m│ gzip: 0.20 kB[22m
|
|
21
|
+
[34mℹ[39m [33m[CJS][39m 2 files, total: 0.40 kB
|
|
22
|
+
[32m✔[39m Build complete in [32m15133ms[39m
|
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;
|
package/dist/index.d.cts
ADDED
|
@@ -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
|
-
|
|
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
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","
|
|
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
|
-
|
|
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.
|
|
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.
|
|
19
|
+
"@uploadista/core": "0.0.4"
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
22
22
|
"@types/node": "24.8.1",
|
|
23
|
-
"
|
|
23
|
+
"tsdown": "0.15.9",
|
|
24
|
+
"@uploadista/typescript-config": "0.0.4"
|
|
24
25
|
},
|
|
25
26
|
"scripts": {
|
|
26
|
-
"build": "
|
|
27
|
+
"build": "tsdown",
|
|
27
28
|
"format": "biome format --write ./src",
|
|
28
29
|
"lint": "biome lint --write ./src",
|
|
29
30
|
"check": "biome check --write ./src"
|
package/tsdown.config.ts
ADDED
package/dist/zip-plugin.d.ts
DELETED
package/dist/zip-plugin.d.ts.map
DELETED
|
@@ -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"}
|
package/dist/zip-plugin.js
DELETED
|
@@ -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
|
-
};
|