@uploadista/flow-images-replicate 0.1.3-beta.2 → 0.1.3-beta.3

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(`replicate`);f=s(f);const p=(e,t)=>{let n=typeof e==`string`,r=n?e:null,i=n?null:e.credentialProvider,a=n?!1:e.useCredentialProviderService,o=(n?t?.removeBackgroundModelId:e.removeBackgroundModelId)||`lucataco/remove-bg:95fcc2a26d3899cd6c2691c900465aaeff466285a65c14638cc5f36f34befaf1`,s=(n?t?.describeImageModelId:e.describeImageModelId)||`zsxkib/blip-3:499bec581d8f64060fd695ec0c34d7595c6824c4118259aa8b0788e0d2d903e1`,p=e=>r?d.Effect.succeed(r):a?d.Effect.gen(function*(){let t=yield*d.Effect.serviceOption(l.CredentialProvider);if(d.Option.isNone(t))return yield*d.Effect.fail(c.UploadistaError.fromCode(`UNKNOWN_ERROR`,{cause:Error(`Credential provider service not found`)}));{let n=yield*t.value.getCredential({clientId:e.clientId,serviceType:`replicate`});if(typeof n==`object`&&n&&`apiKey`in n&&typeof n.apiKey==`string`)return n.apiKey}return yield*d.Effect.fail(c.UploadistaError.fromCode(`UNKNOWN_ERROR`,{cause:Error(`Invalid credential format from service`)}))}):i?d.Effect.gen(function*(){return(yield*i({...e,serviceType:`replicate`})).apiKey}):d.Effect.fail(c.UploadistaError.fromCode(`UNKNOWN_ERROR`,{cause:Error(`No API credentials configured`)}));return d.Layer.succeed(l.ImageAiPlugin,l.ImageAiPlugin.of({removeBackground:(e,t)=>d.Effect.gen(function*(){let n=yield*p(t);return{outputUrl:(yield*d.Effect.tryPromise({try:async()=>{let t=new f.default({auth:n}),r={image:e};return console.log(`input`,r),await t.run(o,{input:r})},catch:e=>(console.log(`error`,e),c.UploadistaError.fromCode(`UNKNOWN_ERROR`,{cause:e}))})).url()}}).pipe((0,u.withOperationSpan)(`ai`,`remove-background`,{"ai.provider":`replicate`,"ai.model":o,"ai.client_id":t.clientId})),describeImage:(e,t)=>d.Effect.gen(function*(){let n=yield*p(t);return{description:yield*d.Effect.tryPromise({try:async()=>await new f.default({auth:n}).run(s,{input:{image:e,top_k:50,top_p:1,caption:!1,question:`What is shown in the image?`,do_sample:!1,num_beams:1,temperature:1,system_prompt:`A chat between a curious user and an artificial intelligence assistant. The assistant gives helpful, detailed, and polite answers to the user's questions.`,length_penalty:1,max_new_tokens:768,repetition_penalty:1}}),catch:e=>c.UploadistaError.fromCode(`UNKNOWN_ERROR`,{cause:e})})}}).pipe((0,u.withOperationSpan)(`ai`,`describe-image`,{"ai.provider":`replicate`,"ai.model":s,"ai.client_id":t.clientId}))}))};exports.imageAiPlugin=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(`replicate`);f=s(f);const p=(e,t)=>{let n=typeof e==`string`,r=n?e:null,i=n?null:e.credentialProvider,a=n?!1:e.useCredentialProviderService,o=(n?t?.removeBackgroundModelId:e.removeBackgroundModelId)||`lucataco/remove-bg:95fcc2a26d3899cd6c2691c900465aaeff466285a65c14638cc5f36f34befaf1`,s=(n?t?.describeImageModelId:e.describeImageModelId)||`zsxkib/blip-3:499bec581d8f64060fd695ec0c34d7595c6824c4118259aa8b0788e0d2d903e1`,p=e=>r?d.Effect.succeed(r):a?d.Effect.gen(function*(){let t=yield*d.Effect.serviceOption(l.CredentialProvider);if(d.Option.isNone(t))return yield*d.Effect.fail(c.UploadistaError.fromCode(`UNKNOWN_ERROR`,{cause:Error(`Credential provider service not found`)}));{let n=yield*t.value.getCredential({clientId:e.clientId,serviceType:`replicate`});if(typeof n==`object`&&n&&`apiKey`in n&&typeof n.apiKey==`string`)return n.apiKey}return yield*d.Effect.fail(c.UploadistaError.fromCode(`UNKNOWN_ERROR`,{cause:Error(`Invalid credential format from service`)}))}):i?d.Effect.gen(function*(){return(yield*i({...e,serviceType:`replicate`})).apiKey}):d.Effect.fail(c.UploadistaError.fromCode(`UNKNOWN_ERROR`,{cause:Error(`No API credentials configured`)}));return d.Layer.succeed(l.ImageAiPlugin,l.ImageAiPlugin.of({removeBackground:(e,t)=>d.Effect.gen(function*(){let n=yield*p(t);return{outputUrl:(yield*d.Effect.tryPromise({try:async()=>{let t=new t.default({auth:n}),r={image:e};return console.log(`input`,r),await t.run(o,{input:r})},catch:e=>(console.log(`error`,e),c.UploadistaError.fromCode(`UNKNOWN_ERROR`,{cause:e}))})).url()}}).pipe((0,u.withOperationSpan)(`ai`,`remove-background`,{"ai.provider":`replicate`,"ai.model":o,"ai.client_id":t.clientId})),describeImage:(e,t)=>d.Effect.gen(function*(){let n=yield*p(t);return{description:yield*d.Effect.tryPromise({try:async()=>await new f.default({auth:n}).run(s,{input:{image:e,top_k:50,top_p:1,caption:!1,question:`What is shown in the image?`,do_sample:!1,num_beams:1,temperature:1,system_prompt:`A chat between a curious user and an artificial intelligence assistant. The assistant gives helpful, detailed, and polite answers to the user's questions.`,length_penalty:1,max_new_tokens:768,repetition_penalty:1}}),catch:e=>c.UploadistaError.fromCode(`UNKNOWN_ERROR`,{cause:e})})}}).pipe((0,u.withOperationSpan)(`ai`,`describe-image`,{"ai.provider":`replicate`,"ai.model":s,"ai.client_id":t.clientId}))}))};exports.imageAiPlugin=p;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.cts","names":[],"sources":["../src/image-ai-plugin.ts"],"sourcesContent":[],"mappings":";;;;;KAUK,OAAA;KAMA,oBAAA;EANA,MAAA,EAAA,MAAO;AAAA,CAAA;AAMa,KAKpB,kBAAA,GAAkB,CAAA,OAAA,EACZ,cADY,GAAA;EACZ,WAAA,EAAA,WAAA;CACQ,EAAA,GAAd,MAAA,CAAO,MAAO,CAAA,oBAAA,EAAsB,eAAtB,CAAA;KAGd,YAAA,GAHoC,MAAA,GAAA;EAApC,kBAAO,CAAA,EAMe,kBANf;EAAM,4BAAA,CAAA,EAAA,OAAA;EAGb,uBAAY,CAAA,EAKe,OALf;EAGU,oBAAA,CAAA,EAGE,OAHF;CAEK;;;AAwBhC;;;;;;;;;;;;;;;;;;cAAa,wBACH;4BAEoB;yBACH;MACxB,KAAA,CAAA,MAAA"}
1
+ {"version":3,"file":"index.d.cts","names":[],"sources":["../src/image-ai-plugin.ts"],"mappings":";;;;;KAUK,OAAA;AAAA,KAMA,oBAAA;EACH,MAAA;AAAA;AAAA,KAIG,kBAAA,IACH,OAAA,EAAS,cAAA;EAAmB,WAAA;AAAA,MACzB,MAAA,CAAO,MAAA,CAAO,oBAAA,EAAsB,eAAA;AAAA,KAGpC,YAAA;EAGC,kBAAA,GAAqB,kBAAA;EACrB,4BAAA;EACA,uBAAA,GAA0B,OAAA;EAC1B,oBAAA,GAAuB,OAAA;AAAA;;;;;;;;;;;;;;;;;;AAT2B;;;cAgC3C,aAAA,GACX,MAAA,EAAQ,YAAA,EACR,OAAA;EACE,uBAAA,GAA0B,OAAA;EAC1B,oBAAA,GAAuB,OAAA;AAAA,MACxB,KAAA,CAAA,KAAA,CAAA,aAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","names":[],"sources":["../src/image-ai-plugin.ts"],"sourcesContent":[],"mappings":";;;;;KAUK,OAAA;KAMA,oBAAA;EANA,MAAA,EAAA,MAAO;AAAA,CAAA;AAMa,KAKpB,oBAAA,GAAA,CAAkB,OAAA,EACZ,cADY,GAAA;EACZ,WAAA,EAAA,WAAA;CACQ,EAAA,GAAd,MAAA,CAAO,MAAO,CAAA,oBAAA,EAAsB,eAAtB,CAAA;KAGd,YAAA,GAHoC,MAAA,GAAA;EAApC,kBAAO,CAAA,EAMe,oBANf;EAAM,4BAAA,CAAA,EAAA,OAAA;EAGb,uBAAY,CAAA,EAKe,OALf;EAGU,oBAAA,CAAA,EAGE,OAHF;CAEK;;;AAwBhC;;;;;;;;;;;;;;;;;;cAAa,wBACH;4BAEoB;yBACH;MACxB,KAAA,CAAA,MAAA"}
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../src/image-ai-plugin.ts"],"mappings":";;;;;KAUK,OAAA;AAAA,KAMA,oBAAA;EACH,MAAA;AAAA;AAAA,KAIG,oBAAA,IACH,OAAA,EAAS,cAAA;EAAmB,WAAA;AAAA,MACzB,MAAA,CAAO,MAAA,CAAO,oBAAA,EAAsB,eAAA;AAAA,KAGpC,YAAA;EAGC,kBAAA,GAAqB,oBAAA;EACrB,4BAAA;EACA,uBAAA,GAA0B,OAAA;EAC1B,oBAAA,GAAuB,OAAA;AAAA;;;;;;;;;;;;;;;;;;AAT2B;;;cAgC3C,aAAA,GACX,MAAA,EAAQ,YAAA,EACR,OAAA;EACE,uBAAA,GAA0B,OAAA;EAC1B,oBAAA,GAAuB,OAAA;AAAA,MACxB,KAAA,CAAA,KAAA,CAAA,aAAA"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@uploadista/flow-images-replicate",
3
3
  "type": "module",
4
- "version": "0.1.3-beta.2",
4
+ "version": "0.1.3-beta.3",
5
5
  "description": "Replicate image AI processing service for Uploadista Flow",
6
6
  "license": "MIT",
7
7
  "author": "Uploadista",
@@ -15,8 +15,8 @@
15
15
  },
16
16
  "dependencies": {
17
17
  "replicate": "1.4.0",
18
- "@uploadista/core": "0.1.3-beta.2",
19
- "@uploadista/observability": "0.1.3-beta.2"
18
+ "@uploadista/core": "0.1.3-beta.3",
19
+ "@uploadista/observability": "0.1.3-beta.3"
20
20
  },
21
21
  "peerDependencies": {
22
22
  "effect": "^3.0.0",
@@ -25,11 +25,11 @@
25
25
  "devDependencies": {
26
26
  "@effect/vitest": "0.27.0",
27
27
  "@types/node": "24.10.9",
28
- "effect": "3.19.14",
29
- "tsdown": "0.19.0",
30
- "vitest": "4.0.17",
28
+ "effect": "3.19.15",
29
+ "tsdown": "0.20.1",
30
+ "vitest": "4.0.18",
31
31
  "zod": "4.3.6",
32
- "@uploadista/typescript-config": "0.1.3-beta.2"
32
+ "@uploadista/typescript-config": "0.1.3-beta.3"
33
33
  },
34
34
  "scripts": {
35
35
  "build": "tsc --noEmit && tsdown",