@uploadista/flow-images-sharp 0.0.8 → 0.0.9

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`);c=s(c);let l=require(`@uploadista/core/flow`);l=s(l);let u=require(`effect`);u=s(u);let d=require(`sharp`);d=s(d);const f=e=>{switch(e){case`fill`:return`cover`;case`contain`:return`contain`}},p=u.Layer.succeed(l.ImagePlugin,l.ImagePlugin.of({optimize:(e,{quality:t,format:n})=>u.Effect.gen(function*(){let r=yield*u.Effect.tryPromise({try:async()=>await(0,d.default)(e).toFormat(n,{quality:t}).toBuffer(),catch:e=>c.UploadistaError.fromCode(`UNKNOWN_ERROR`,{cause:e})});return new Uint8Array(r)}),resize:(e,{width:t,height:n,fit:r})=>u.Effect.gen(function*(){if(!t&&!n)throw Error(`Either width or height must be specified for resize`);let i=f(r),a=yield*u.Effect.tryPromise({try:async()=>await(0,d.default)(e).resize(t,n,{fit:i}).toBuffer(),catch:e=>c.UploadistaError.fromCode(`UNKNOWN_ERROR`,{cause:e})});return new Uint8Array(a)})}));exports.imagePlugin=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(`effect`),d=require(`sharp`);d=s(d);const f=e=>{switch(e){case`fill`:return`cover`;case`contain`:return`contain`}},p=u.Layer.succeed(l.ImagePlugin,l.ImagePlugin.of({optimize:(e,{quality:t,format:n})=>u.Effect.gen(function*(){let r=yield*u.Effect.tryPromise({try:async()=>await(0,d.default)(e).toFormat(n,{quality:t}).toBuffer(),catch:e=>c.UploadistaError.fromCode(`UNKNOWN_ERROR`,{cause:e})});return new Uint8Array(r)}),resize:(e,{width:t,height:n,fit:r})=>u.Effect.gen(function*(){if(!t&&!n)throw Error(`Either width or height must be specified for resize`);let i=f(r),a=yield*u.Effect.tryPromise({try:async()=>await(0,d.default)(e).resize(t,n,{fit:i}).toBuffer(),catch:e=>c.UploadistaError.fromCode(`UNKNOWN_ERROR`,{cause:e})});return new Uint8Array(a)})}));exports.imagePlugin=p;
package/dist/index.d.cts CHANGED
@@ -1,8 +1,7 @@
1
- import { ImagePlugin } from "@uploadista/core/flow";
2
1
  import { Layer } from "effect";
3
2
 
4
3
  //#region src/image-plugin.d.ts
5
- declare const imagePlugin: Layer.Layer<ImagePlugin, never, never>;
4
+ declare const imagePlugin: Layer.Layer<unknown, never, never>;
6
5
  //#endregion
7
6
  export { imagePlugin };
8
7
  //# sourceMappingURL=index.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.cts","names":[],"sources":["../src/image-plugin.ts"],"sourcesContent":[],"mappings":";;;;cAca,aAAW,KAAA,CAAA,MAAA"}
1
+ {"version":3,"file":"index.d.cts","names":[],"sources":["../src/image-plugin.ts"],"sourcesContent":[],"mappings":";;;cAca,aAAW,KAAA,CAAA"}
@@ -0,0 +1,7 @@
1
+ import { Layer } from "effect";
2
+
3
+ //#region src/image-plugin.d.ts
4
+ declare const imagePlugin: Layer.Layer<unknown, never, never>;
5
+ //#endregion
6
+ export { imagePlugin };
7
+ //# sourceMappingURL=index.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../src/image-plugin.ts"],"sourcesContent":[],"mappings":";;;cAca,aAAW,KAAA,CAAA"}
@@ -1,2 +1,2 @@
1
1
  import{UploadistaError as e}from"@uploadista/core/errors";import{ImagePlugin as t}from"@uploadista/core/flow";import{Effect as n,Layer as r}from"effect";import i from"sharp";const a=e=>{switch(e){case`fill`:return`cover`;case`contain`:return`contain`}},o=r.succeed(t,t.of({optimize:(t,{quality:r,format:a})=>n.gen(function*(){let o=yield*n.tryPromise({try:async()=>await i(t).toFormat(a,{quality:r}).toBuffer(),catch:t=>e.fromCode(`UNKNOWN_ERROR`,{cause:t})});return new Uint8Array(o)}),resize:(t,{width:r,height:o,fit:s})=>n.gen(function*(){if(!r&&!o)throw Error(`Either width or height must be specified for resize`);let c=a(s),l=yield*n.tryPromise({try:async()=>await i(t).resize(r,o,{fit:c}).toBuffer(),catch:t=>e.fromCode(`UNKNOWN_ERROR`,{cause:t})});return new Uint8Array(l)})}));export{o as imagePlugin};
2
- //# sourceMappingURL=index.js.map
2
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../src/image-plugin.ts"],"sourcesContent":["import { UploadistaError } from \"@uploadista/core/errors\";\nimport { ImagePlugin } from \"@uploadista/core/flow\";\nimport { Effect, Layer } from \"effect\";\nimport sharp from \"sharp\";\n\nconst mapFitToSharp = (fit: \"fill\" | \"contain\" | \"cover\") => {\n switch (fit) {\n case \"fill\":\n return \"cover\";\n case \"contain\":\n return \"contain\";\n }\n};\n\nexport const imagePlugin = Layer.succeed(\n ImagePlugin,\n ImagePlugin.of({\n optimize: (inputBytes, { quality, format }) => {\n return Effect.gen(function* () {\n const outputBytes = yield* Effect.tryPromise({\n try: async () =>\n await sharp(inputBytes).toFormat(format, { quality }).toBuffer(),\n catch: (error) => {\n return UploadistaError.fromCode(\"UNKNOWN_ERROR\", {\n cause: error,\n });\n },\n });\n return new Uint8Array(outputBytes);\n });\n },\n resize: (inputBytes, { width, height, fit }) => {\n return Effect.gen(function* () {\n if (!width && !height) {\n throw new Error(\n \"Either width or height must be specified for resize\",\n );\n }\n\n const sharpFit = mapFitToSharp(fit);\n const outputBytes = yield* Effect.tryPromise({\n try: async () =>\n await sharp(inputBytes)\n .resize(width, height, { fit: sharpFit })\n .toBuffer(),\n catch: (error) => {\n return UploadistaError.fromCode(\"UNKNOWN_ERROR\", {\n cause: error,\n });\n },\n });\n\n return new Uint8Array(outputBytes);\n });\n },\n }),\n);\n"],"mappings":"8KAKA,MAAM,EAAiB,GAAsC,CAC3D,OAAQ,EAAR,CACE,IAAK,OACH,MAAO,QACT,IAAK,UACH,MAAO,YAIA,EAAc,EAAM,QAC/B,EACA,EAAY,GAAG,CACb,UAAW,EAAY,CAAE,UAAS,YACzB,EAAO,IAAI,WAAa,CAC7B,IAAM,EAAc,MAAO,EAAO,WAAW,CAC3C,IAAK,SACH,MAAM,EAAM,EAAW,CAAC,SAAS,EAAQ,CAAE,UAAS,CAAC,CAAC,UAAU,CAClE,MAAQ,GACC,EAAgB,SAAS,gBAAiB,CAC/C,MAAO,EACR,CAAC,CAEL,CAAC,CACF,OAAO,IAAI,WAAW,EAAY,EAClC,CAEJ,QAAS,EAAY,CAAE,QAAO,SAAQ,SAC7B,EAAO,IAAI,WAAa,CAC7B,GAAI,CAAC,GAAS,CAAC,EACb,MAAU,MACR,sDACD,CAGH,IAAM,EAAW,EAAc,EAAI,CAC7B,EAAc,MAAO,EAAO,WAAW,CAC3C,IAAK,SACH,MAAM,EAAM,EAAW,CACpB,OAAO,EAAO,EAAQ,CAAE,IAAK,EAAU,CAAC,CACxC,UAAU,CACf,MAAQ,GACC,EAAgB,SAAS,gBAAiB,CAC/C,MAAO,EACR,CAAC,CAEL,CAAC,CAEF,OAAO,IAAI,WAAW,EAAY,EAClC,CAEL,CAAC,CACH"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@uploadista/flow-images-sharp",
3
3
  "type": "module",
4
- "version": "0.0.8",
4
+ "version": "0.0.9",
5
5
  "description": "Sharp image processing service for Uploadista Flow",
6
6
  "license": "MIT",
7
7
  "author": "Uploadista",
@@ -14,16 +14,16 @@
14
14
  },
15
15
  "dependencies": {
16
16
  "sharp": "0.34.4",
17
- "effect": "3.18.4",
17
+ "effect": "3.19.0",
18
18
  "tinycolor2": "1.6.0",
19
19
  "zod": "4.1.12",
20
- "@uploadista/core": "0.0.8"
20
+ "@uploadista/core": "0.0.9"
21
21
  },
22
22
  "devDependencies": {
23
- "@types/node": "24.9.1",
23
+ "@types/node": "24.10.0",
24
24
  "@types/tinycolor2": "1.4.6",
25
- "tsdown": "0.15.10",
26
- "@uploadista/typescript-config": "0.0.8"
25
+ "tsdown": "0.16.0",
26
+ "@uploadista/typescript-config": "0.0.9"
27
27
  },
28
28
  "scripts": {
29
29
  "build": "tsdown",
package/dist/index.d.ts DELETED
@@ -1,8 +0,0 @@
1
- import { ImagePlugin } from "@uploadista/core/flow";
2
- import { Layer } from "effect";
3
-
4
- //#region src/image-plugin.d.ts
5
- declare const imagePlugin: Layer.Layer<ImagePlugin, never, never>;
6
- //#endregion
7
- export { imagePlugin };
8
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","names":[],"sources":["../src/image-plugin.ts"],"sourcesContent":[],"mappings":";;;;cAca,aAAW,KAAA,CAAA,MAAA"}
package/dist/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../src/image-plugin.ts"],"sourcesContent":["import { UploadistaError } from \"@uploadista/core/errors\";\nimport { ImagePlugin } from \"@uploadista/core/flow\";\nimport { Effect, Layer } from \"effect\";\nimport sharp from \"sharp\";\n\nconst mapFitToSharp = (fit: \"fill\" | \"contain\" | \"cover\") => {\n switch (fit) {\n case \"fill\":\n return \"cover\";\n case \"contain\":\n return \"contain\";\n }\n};\n\nexport const imagePlugin = Layer.succeed(\n ImagePlugin,\n ImagePlugin.of({\n optimize: (inputBytes, { quality, format }) => {\n return Effect.gen(function* () {\n const outputBytes = yield* Effect.tryPromise({\n try: async () =>\n await sharp(inputBytes).toFormat(format, { quality }).toBuffer(),\n catch: (error) => {\n return UploadistaError.fromCode(\"UNKNOWN_ERROR\", {\n cause: error,\n });\n },\n });\n return new Uint8Array(outputBytes);\n });\n },\n resize: (inputBytes, { width, height, fit }) => {\n return Effect.gen(function* () {\n if (!width && !height) {\n throw new Error(\n \"Either width or height must be specified for resize\",\n );\n }\n\n const sharpFit = mapFitToSharp(fit);\n const outputBytes = yield* Effect.tryPromise({\n try: async () =>\n await sharp(inputBytes)\n .resize(width, height, { fit: sharpFit })\n .toBuffer(),\n catch: (error) => {\n return UploadistaError.fromCode(\"UNKNOWN_ERROR\", {\n cause: error,\n });\n },\n });\n\n return new Uint8Array(outputBytes);\n });\n },\n }),\n);\n"],"mappings":"8KAKA,MAAM,EAAiB,GAAsC,CAC3D,OAAQ,EAAR,CACE,IAAK,OACH,MAAO,QACT,IAAK,UACH,MAAO,YAIA,EAAc,EAAM,QAC/B,EACA,EAAY,GAAG,CACb,UAAW,EAAY,CAAE,UAAS,YACzB,EAAO,IAAI,WAAa,CAC7B,IAAM,EAAc,MAAO,EAAO,WAAW,CAC3C,IAAK,SACH,MAAM,EAAM,EAAW,CAAC,SAAS,EAAQ,CAAE,UAAS,CAAC,CAAC,UAAU,CAClE,MAAQ,GACC,EAAgB,SAAS,gBAAiB,CAC/C,MAAO,EACR,CAAC,CAEL,CAAC,CACF,OAAO,IAAI,WAAW,EAAY,EAClC,CAEJ,QAAS,EAAY,CAAE,QAAO,SAAQ,SAC7B,EAAO,IAAI,WAAa,CAC7B,GAAI,CAAC,GAAS,CAAC,EACb,MAAU,MACR,sDACD,CAGH,IAAM,EAAW,EAAc,EAAI,CAC7B,EAAc,MAAO,EAAO,WAAW,CAC3C,IAAK,SACH,MAAM,EAAM,EAAW,CACpB,OAAO,EAAO,EAAQ,CAAE,IAAK,EAAU,CAAC,CACxC,UAAU,CACf,MAAQ,GACC,EAAgB,SAAS,gBAAiB,CAC/C,MAAO,EACR,CAAC,CAEL,CAAC,CAEF,OAAO,IAAI,WAAW,EAAY,EAClC,CAEL,CAAC,CACH"}