@uploadista/flow-images-nodes 0.0.17 → 0.0.18-beta.1
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 +1 -1
- package/dist/index.d.cts +33 -33
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +39 -39
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +9 -5
- package/src/describe-image-node.ts +1 -1
- package/src/optimize-node.ts +1 -1
- package/src/remove-background-node.ts +1 -1
- package/src/resize-node.ts +1 -1
- package/src/transform-image-node.ts +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
let e=require(`@uploadista/core/errors`),t=require(`@uploadista/core/flow`),n=require(`@uploadista/core/types`),r=require(`effect`),i=require(`@uploadista/core/upload`);function a(t,n={}){let{maxWaitTime:i=1e4,retryDelay:a=500}=n;return r.Effect.gen(function*(){let n=Date.now();for(;Date.now()-n<i;){let e=yield*r.Effect.tryPromise(()=>fetch(t,{method:`HEAD`})).pipe(r.Effect.catchAll(()=>r.Effect.succeed(null)));if(e?.ok){yield*r.Effect.logInfo(`URL ${t} is now available`);return}e?yield*r.Effect.logDebug(`URL not ready yet (${e.status}), retrying...`):yield*r.Effect.logDebug(`URL check failed, retrying...`),yield*r.Effect.sleep(a)}return yield*e.UploadistaError.fromCode(`FLOW_NODE_ERROR`,{cause:`URL ${t} not available after ${i}ms`}).toEffect()})}function o(i,{credentialId:o,keepOutput:s}={}){return r.Effect.gen(function*(){let c=yield*t.ImageAiPlugin;return yield*(0,t.createFlowNode)({id:i,name:`Describe Image`,description:`Describes the image using AI`,type:t.NodeType.process,
|
|
1
|
+
let e=require(`@uploadista/core/errors`),t=require(`@uploadista/core/flow`),n=require(`@uploadista/core/types`),r=require(`effect`),i=require(`@uploadista/core/upload`);function a(t,n={}){let{maxWaitTime:i=1e4,retryDelay:a=500}=n;return r.Effect.gen(function*(){let n=Date.now();for(;Date.now()-n<i;){let e=yield*r.Effect.tryPromise(()=>fetch(t,{method:`HEAD`})).pipe(r.Effect.catchAll(()=>r.Effect.succeed(null)));if(e?.ok){yield*r.Effect.logInfo(`URL ${t} is now available`);return}e?yield*r.Effect.logDebug(`URL not ready yet (${e.status}), retrying...`):yield*r.Effect.logDebug(`URL check failed, retrying...`),yield*r.Effect.sleep(a)}return yield*e.UploadistaError.fromCode(`FLOW_NODE_ERROR`,{cause:`URL ${t} not available after ${i}ms`}).toEffect()})}function o(i,{credentialId:o,keepOutput:s}={}){return r.Effect.gen(function*(){let c=yield*t.ImageAiPlugin;return yield*(0,t.createFlowNode)({id:i,name:`Describe Image`,description:`Describes the image using AI`,type:t.NodeType.process,outputTypeId:t.IMAGE_DESCRIPTION_OUTPUT_TYPE_ID,keepOutput:s,inputSchema:n.uploadFileSchema,outputSchema:t.imageDescriptionOutputSchema,run:({data:n,flowId:s,jobId:l,clientId:u})=>r.Effect.gen(function*(){let d={flowId:s,nodeId:i,jobId:l},f=n.url;if(!f)return yield*e.UploadistaError.fromCode(`FLOW_NODE_ERROR`,{cause:`URL is required for describe image operation`}).toEffect();yield*r.Effect.logInfo(`Describing image for file ${n.id} at URL: ${f}`),yield*a(f);let p={clientId:u,credentialId:o},m=yield*c.describeImage(f,p).pipe(r.Effect.catchAll(t=>r.Effect.gen(function*(){return yield*r.Effect.logError(`Failed to describe image`,t),yield*e.UploadistaError.fromCode(`FLOW_NODE_ERROR`,{cause:t instanceof Error?t.message:`Failed to describe image`}).toEffect()})));return yield*r.Effect.logInfo(`Successfully described image for file ${n.id}`),(0,t.completeNodeExecution)({description:m.description,flow:d})})})})}const s={jpeg:`image/jpeg`,webp:`image/webp`,png:`image/png`,avif:`image/avif`},c={jpeg:`jpg`,webp:`webp`,png:`png`,avif:`avif`};function l(e,{quality:n,format:i},a){return r.Effect.gen(function*(){let o=yield*t.ImagePlugin;return yield*(0,t.createTransformNode)({id:e,name:`Optimize`,description:`Optimizes an image for web delivery`,outputTypeId:t.STORAGE_OUTPUT_TYPE_ID,keepOutput:a?.keepOutput,transform:(e,t)=>r.Effect.map(o.optimize(e,{quality:n,format:i}),e=>{let n=s[i],r=c[i],a=t.metadata?.fileName;return{bytes:e,type:n,fileName:a&&typeof a==`string`?a.replace(/\.[^.]+$/,`.${r}`):void 0}})})})}function u(o,{credentialId:s,keepOutput:c}={}){return r.Effect.gen(function*(){let l=yield*t.ImageAiPlugin,u=yield*i.UploadServer;return yield*(0,t.createFlowNode)({id:o,name:`Remove Background`,description:`Removes the background from an image`,type:t.NodeType.process,outputTypeId:t.STORAGE_OUTPUT_TYPE_ID,keepOutput:c,inputSchema:n.uploadFileSchema,outputSchema:n.uploadFileSchema,run:({data:n,flowId:i,jobId:c,storageId:d,clientId:f})=>r.Effect.gen(function*(){let p={flowId:i,nodeId:o,jobId:c},m=n.url;if(!m)return yield*e.UploadistaError.fromCode(`FLOW_NODE_ERROR`,{cause:`URL is required for remove background operation`}).toEffect();yield*r.Effect.logInfo(`Removing background for file ${n.id} at URL: ${n.url}`),yield*a(m);let h={clientId:f,credentialId:s},{outputUrl:g}=yield*l.removeBackground(m,h).pipe(r.Effect.catchAll(t=>r.Effect.gen(function*(){return yield*r.Effect.logError(`Failed to remove background`,t),yield*e.UploadistaError.fromCode(`FLOW_NODE_ERROR`,{cause:t instanceof Error?t.message:`Failed to remove background from image`}).toEffect()}))),{type:_,fileName:v,metadata:y,metadataJson:b}=(0,t.resolveUploadMetadata)(n.metadata);yield*r.Effect.logInfo(`Uploading processed file to storage`);let x=yield*u.uploadFromUrl({storageId:d,size:0,type:_,fileName:v,lastModified:0,metadata:b,flow:p},f,g).pipe(r.Effect.catchAll(t=>r.Effect.gen(function*(){return yield*r.Effect.logError(`Failed to upload processed file`,t),yield*e.UploadistaError.fromCode(`FLOW_NODE_ERROR`,{cause:t instanceof Error?t.message:`Failed to upload processed file`}).toEffect()})));return yield*r.Effect.logInfo(`Successfully removed background for file ${n.id}`),(0,t.completeNodeExecution)(y?{...x,metadata:y}:x)})})})}function d(e,{width:n,height:i,fit:a},o){return r.Effect.gen(function*(){let r=yield*t.ImagePlugin;return yield*(0,t.createTransformNode)({id:e,name:`Resize`,description:`Resizes an image to the specified dimensions`,outputTypeId:t.STORAGE_OUTPUT_TYPE_ID,keepOutput:o?.keepOutput,transform:e=>r.resize(e,{height:i,width:n,fit:a})})})}function f(e,t,n){return r.Effect.reduce(n,t,(t,n)=>e.transform(t,n))}function p(e,{transformations:n},i){return r.Effect.gen(function*(){let r=yield*t.ImagePlugin;return yield*(0,t.createTransformNode)({id:e,name:`Transform Image`,description:`Apply ${n.length} transformation${n.length===1?``:`s`} to the image`,outputTypeId:t.STORAGE_OUTPUT_TYPE_ID,keepOutput:i?.keepOutput,transform:e=>f(r,e,n)})})}exports.createDescribeImageNode=o,exports.createOptimizeNode=l,exports.createRemoveBackgroundNode=u,exports.createResizeNode=d,exports.createTransformImageNode=p,exports.waitForUrlAvailability=a;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as _uploadista_core_flow0 from "@uploadista/core/flow";
|
|
2
2
|
import { ImageAiPlugin, ImagePlugin, NodeType, OptimizeParams, ResizeParams, TransformImageParams } from "@uploadista/core/flow";
|
|
3
|
-
import * as
|
|
4
|
-
import * as
|
|
3
|
+
import * as zod_v4_core0 from "zod/v4/core";
|
|
4
|
+
import * as zod0 from "zod";
|
|
5
5
|
import * as _uploadista_core_errors0 from "@uploadista/core/errors";
|
|
6
6
|
import { UploadistaError } from "@uploadista/core/errors";
|
|
7
7
|
import { Effect } from "effect";
|
|
@@ -16,8 +16,8 @@ declare function createDescribeImageNode(id: string, {
|
|
|
16
16
|
}?: {
|
|
17
17
|
credentialId?: string;
|
|
18
18
|
keepOutput?: boolean;
|
|
19
|
-
}): Effect.Effect<
|
|
20
|
-
inputSchema:
|
|
19
|
+
}): Effect.Effect<_uploadista_core_flow0.FlowNodeData & {
|
|
20
|
+
inputSchema: zod0.ZodType<{
|
|
21
21
|
id: string;
|
|
22
22
|
offset: number;
|
|
23
23
|
storage: {
|
|
@@ -44,7 +44,7 @@ declare function createDescribeImageNode(id: string, {
|
|
|
44
44
|
nodeId: string;
|
|
45
45
|
jobId: string;
|
|
46
46
|
} | undefined;
|
|
47
|
-
}, unknown,
|
|
47
|
+
}, unknown, zod_v4_core0.$ZodTypeInternals<{
|
|
48
48
|
id: string;
|
|
49
49
|
offset: number;
|
|
50
50
|
storage: {
|
|
@@ -72,11 +72,11 @@ declare function createDescribeImageNode(id: string, {
|
|
|
72
72
|
jobId: string;
|
|
73
73
|
} | undefined;
|
|
74
74
|
}, unknown>>;
|
|
75
|
-
outputSchema:
|
|
75
|
+
outputSchema: zod0.ZodType<{
|
|
76
76
|
description: string;
|
|
77
77
|
confidence?: number | undefined;
|
|
78
78
|
metadata?: Record<string, unknown> | undefined;
|
|
79
|
-
}, unknown,
|
|
79
|
+
}, unknown, zod_v4_core0.$ZodTypeInternals<{
|
|
80
80
|
description: string;
|
|
81
81
|
confidence?: number | undefined;
|
|
82
82
|
metadata?: Record<string, unknown> | undefined;
|
|
@@ -115,7 +115,7 @@ declare function createDescribeImageNode(id: string, {
|
|
|
115
115
|
flowId: string;
|
|
116
116
|
inputs?: Record<string, unknown>;
|
|
117
117
|
clientId: string | null;
|
|
118
|
-
}) => Effect.Effect<
|
|
118
|
+
}) => Effect.Effect<_uploadista_core_flow0.NodeExecutionResult<{
|
|
119
119
|
description: string;
|
|
120
120
|
confidence?: number | undefined;
|
|
121
121
|
metadata?: Record<string, unknown> | undefined;
|
|
@@ -143,9 +143,9 @@ declare function createOptimizeNode(id: string, {
|
|
|
143
143
|
format
|
|
144
144
|
}: OptimizeParams, options?: {
|
|
145
145
|
keepOutput?: boolean;
|
|
146
|
-
}): Effect.Effect<
|
|
147
|
-
inputSchema:
|
|
148
|
-
outputSchema:
|
|
146
|
+
}): Effect.Effect<_uploadista_core_flow0.FlowNodeData & {
|
|
147
|
+
inputSchema: zod0.ZodType<_uploadista_core_types0.UploadFile, unknown, zod_v4_core0.$ZodTypeInternals<_uploadista_core_types0.UploadFile, unknown>>;
|
|
148
|
+
outputSchema: zod0.ZodType<_uploadista_core_types0.UploadFile, unknown, zod_v4_core0.$ZodTypeInternals<_uploadista_core_types0.UploadFile, unknown>>;
|
|
149
149
|
run: (args: {
|
|
150
150
|
data: _uploadista_core_types0.UploadFile;
|
|
151
151
|
jobId: string;
|
|
@@ -153,7 +153,7 @@ declare function createOptimizeNode(id: string, {
|
|
|
153
153
|
flowId: string;
|
|
154
154
|
inputs?: Record<string, unknown>;
|
|
155
155
|
clientId: string | null;
|
|
156
|
-
}) => Effect.Effect<
|
|
156
|
+
}) => Effect.Effect<_uploadista_core_flow0.NodeExecutionResult<_uploadista_core_types0.UploadFile>, _uploadista_core_errors0.UploadistaError, never>;
|
|
157
157
|
condition?: {
|
|
158
158
|
field: string;
|
|
159
159
|
operator: string;
|
|
@@ -168,8 +168,8 @@ declare function createOptimizeNode(id: string, {
|
|
|
168
168
|
exponentialBackoff?: boolean;
|
|
169
169
|
};
|
|
170
170
|
} & {
|
|
171
|
-
type:
|
|
172
|
-
}, _uploadista_core_errors0.UploadistaError,
|
|
171
|
+
type: _uploadista_core_flow0.NodeType;
|
|
172
|
+
}, _uploadista_core_errors0.UploadistaError, _uploadista_core_upload0.UploadServer | ImagePlugin>;
|
|
173
173
|
//#endregion
|
|
174
174
|
//#region src/remove-background-node.d.ts
|
|
175
175
|
declare function createRemoveBackgroundNode(id: string, {
|
|
@@ -178,8 +178,8 @@ declare function createRemoveBackgroundNode(id: string, {
|
|
|
178
178
|
}?: {
|
|
179
179
|
credentialId?: string;
|
|
180
180
|
keepOutput?: boolean;
|
|
181
|
-
}): Effect.Effect<
|
|
182
|
-
inputSchema:
|
|
181
|
+
}): Effect.Effect<_uploadista_core_flow0.FlowNodeData & {
|
|
182
|
+
inputSchema: zod0.ZodType<{
|
|
183
183
|
id: string;
|
|
184
184
|
offset: number;
|
|
185
185
|
storage: {
|
|
@@ -206,7 +206,7 @@ declare function createRemoveBackgroundNode(id: string, {
|
|
|
206
206
|
nodeId: string;
|
|
207
207
|
jobId: string;
|
|
208
208
|
} | undefined;
|
|
209
|
-
}, unknown,
|
|
209
|
+
}, unknown, zod_v4_core0.$ZodTypeInternals<{
|
|
210
210
|
id: string;
|
|
211
211
|
offset: number;
|
|
212
212
|
storage: {
|
|
@@ -234,7 +234,7 @@ declare function createRemoveBackgroundNode(id: string, {
|
|
|
234
234
|
jobId: string;
|
|
235
235
|
} | undefined;
|
|
236
236
|
}, unknown>>;
|
|
237
|
-
outputSchema:
|
|
237
|
+
outputSchema: zod0.ZodType<_uploadista_core_types0.UploadFile, unknown, zod_v4_core0.$ZodTypeInternals<_uploadista_core_types0.UploadFile, unknown>>;
|
|
238
238
|
run: (args: {
|
|
239
239
|
data: {
|
|
240
240
|
id: string;
|
|
@@ -269,7 +269,7 @@ declare function createRemoveBackgroundNode(id: string, {
|
|
|
269
269
|
flowId: string;
|
|
270
270
|
inputs?: Record<string, unknown>;
|
|
271
271
|
clientId: string | null;
|
|
272
|
-
}) => Effect.Effect<
|
|
272
|
+
}) => Effect.Effect<_uploadista_core_flow0.NodeExecutionResult<_uploadista_core_types0.UploadFile>, UploadistaError, never>;
|
|
273
273
|
condition?: {
|
|
274
274
|
field: string;
|
|
275
275
|
operator: string;
|
|
@@ -285,7 +285,7 @@ declare function createRemoveBackgroundNode(id: string, {
|
|
|
285
285
|
};
|
|
286
286
|
} & {
|
|
287
287
|
type: NodeType.process;
|
|
288
|
-
}, UploadistaError,
|
|
288
|
+
}, UploadistaError, UploadServer | ImageAiPlugin>;
|
|
289
289
|
//#endregion
|
|
290
290
|
//#region src/resize-node.d.ts
|
|
291
291
|
declare function createResizeNode(id: string, {
|
|
@@ -294,9 +294,9 @@ declare function createResizeNode(id: string, {
|
|
|
294
294
|
fit
|
|
295
295
|
}: ResizeParams, options?: {
|
|
296
296
|
keepOutput?: boolean;
|
|
297
|
-
}): Effect.Effect<
|
|
298
|
-
inputSchema:
|
|
299
|
-
outputSchema:
|
|
297
|
+
}): Effect.Effect<_uploadista_core_flow0.FlowNodeData & {
|
|
298
|
+
inputSchema: zod0.ZodType<_uploadista_core_types0.UploadFile, unknown, zod_v4_core0.$ZodTypeInternals<_uploadista_core_types0.UploadFile, unknown>>;
|
|
299
|
+
outputSchema: zod0.ZodType<_uploadista_core_types0.UploadFile, unknown, zod_v4_core0.$ZodTypeInternals<_uploadista_core_types0.UploadFile, unknown>>;
|
|
300
300
|
run: (args: {
|
|
301
301
|
data: _uploadista_core_types0.UploadFile;
|
|
302
302
|
jobId: string;
|
|
@@ -304,7 +304,7 @@ declare function createResizeNode(id: string, {
|
|
|
304
304
|
flowId: string;
|
|
305
305
|
inputs?: Record<string, unknown>;
|
|
306
306
|
clientId: string | null;
|
|
307
|
-
}) => Effect.Effect<
|
|
307
|
+
}) => Effect.Effect<_uploadista_core_flow0.NodeExecutionResult<_uploadista_core_types0.UploadFile>, _uploadista_core_errors0.UploadistaError, never>;
|
|
308
308
|
condition?: {
|
|
309
309
|
field: string;
|
|
310
310
|
operator: string;
|
|
@@ -319,8 +319,8 @@ declare function createResizeNode(id: string, {
|
|
|
319
319
|
exponentialBackoff?: boolean;
|
|
320
320
|
};
|
|
321
321
|
} & {
|
|
322
|
-
type:
|
|
323
|
-
}, _uploadista_core_errors0.UploadistaError,
|
|
322
|
+
type: _uploadista_core_flow0.NodeType;
|
|
323
|
+
}, _uploadista_core_errors0.UploadistaError, _uploadista_core_upload0.UploadServer | ImagePlugin>;
|
|
324
324
|
//#endregion
|
|
325
325
|
//#region src/transform-image-node.d.ts
|
|
326
326
|
/**
|
|
@@ -363,9 +363,9 @@ declare function createTransformImageNode(id: string, {
|
|
|
363
363
|
transformations
|
|
364
364
|
}: TransformImageParams, options?: {
|
|
365
365
|
keepOutput?: boolean;
|
|
366
|
-
}): Effect.Effect<
|
|
367
|
-
inputSchema:
|
|
368
|
-
outputSchema:
|
|
366
|
+
}): Effect.Effect<_uploadista_core_flow0.FlowNodeData & {
|
|
367
|
+
inputSchema: zod0.ZodType<_uploadista_core_types0.UploadFile, unknown, zod_v4_core0.$ZodTypeInternals<_uploadista_core_types0.UploadFile, unknown>>;
|
|
368
|
+
outputSchema: zod0.ZodType<_uploadista_core_types0.UploadFile, unknown, zod_v4_core0.$ZodTypeInternals<_uploadista_core_types0.UploadFile, unknown>>;
|
|
369
369
|
run: (args: {
|
|
370
370
|
data: _uploadista_core_types0.UploadFile;
|
|
371
371
|
jobId: string;
|
|
@@ -373,7 +373,7 @@ declare function createTransformImageNode(id: string, {
|
|
|
373
373
|
flowId: string;
|
|
374
374
|
inputs?: Record<string, unknown>;
|
|
375
375
|
clientId: string | null;
|
|
376
|
-
}) => Effect.Effect<
|
|
376
|
+
}) => Effect.Effect<_uploadista_core_flow0.NodeExecutionResult<_uploadista_core_types0.UploadFile>, _uploadista_core_errors0.UploadistaError, never>;
|
|
377
377
|
condition?: {
|
|
378
378
|
field: string;
|
|
379
379
|
operator: string;
|
|
@@ -388,8 +388,8 @@ declare function createTransformImageNode(id: string, {
|
|
|
388
388
|
exponentialBackoff?: boolean;
|
|
389
389
|
};
|
|
390
390
|
} & {
|
|
391
|
-
type:
|
|
392
|
-
}, _uploadista_core_errors0.UploadistaError,
|
|
391
|
+
type: _uploadista_core_flow0.NodeType;
|
|
392
|
+
}, _uploadista_core_errors0.UploadistaError, _uploadista_core_upload0.UploadServer | ImagePlugin>;
|
|
393
393
|
//#endregion
|
|
394
394
|
//#region src/wait-for-url.d.ts
|
|
395
395
|
/**
|
package/dist/index.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/describe-image-node.ts","../src/optimize-node.ts","../src/remove-background-node.ts","../src/resize-node.ts","../src/transform-image-node.ts","../src/wait-for-url.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;;;iBAcgB,uBAAA;;;;;;IAEoE,MAAA,CAAA,OAAxD,
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/describe-image-node.ts","../src/optimize-node.ts","../src/remove-background-node.ts","../src/resize-node.ts","../src/transform-image-node.ts","../src/wait-for-url.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;;;iBAcgB,uBAAA;;;;;;IAEoE,MAAA,CAAA,OAAxD,sBAAA,CAAwD,YAAA;;;;;;MAFpE,IAAA,EAAA,MAAA;MAEZ,IAAA,CAAA,EAAA,MAAA,GAAA,SAAA;MAAc,QAAA,CAAA,EAAA,MAAA,GAAA,SAAA;MAAU,MAAA,CAAA,EAAA,MAAwD,GAAA,SAAA;;;;;;;;;;;;;;;;;;IAAA,CAAA,GAAA,SAAA;EAAA,CAAA,EAAA,OAAA,gCAAA,CAAA;;;;MCQpE,EAAA,EAAA,MAAA;MAEZ,IAAA,EAAA,MAAA;MAAS,IAAA,CAAA,EAAA,MAAA,GAAA,SAAA;MAAU,QAAA,CAAA,EAAA,MAAA,GAAA,SAAA;MAAc,MAAA,CAAA,EAAA,MACD,GAAA,SAAA;MAAA,KAAA,CAAA,EAAA;;;;;;;;;IAsC48rI,GAAA,CAAA,EAAA,MAAA,GAAA,SAAA;IAAA,cAAA,CAAA,EAAA,OAAA,GAAA,SAAA;;;;;;;;EAtC58rI,CAAA,EAAA,OAAA,CAAA,CAAA;EAAA,YAAA,cAAA,CAAA;;;;ECbpB,CAAA,EAAA,OAAA,gCAA0B,CAAA;IAEtC,WAAA,EAAA,MAAA;IAAc,UAAA,CAAA,EAAA,MAAA,GAAA,SAAA;IAAU,QAAA,CAAA,QAAwD,CAAA,MAAA,EAAA,OAAA,CAAA,GAAA,SAAA;;;;;;;;;;;;;;;;;;;MAAA,QAAA,CAAA,QAAA,CAAA,MAAA,EAAA,MAAA,GAAA,MAAA,GAAA,OAAA,CAAA,GAAA,SAAA;MAAA,YAAA,CAAA,EAAA,MAAA,GAAA,S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B,UAAA,CAAA,EAAA,OAAA;CAAS,CAAA,EGwCuB,MAAA,CAAA,MHxCvB,CGuC8B,sBAAA,CACP,YAAA,GHxCvB;EAAU,WAAA,cAAA,CGwCa,uBAAA,CAAA,UAAA,EHxCb,OAAA,gCAAA,qCAAA,OAAA,CAAA,CAAA;EAAc,YAAA,cACD,qCAAA,OAAA,gCAAA,qCAAA,OAAA,CAAA,CAAA;EAAA,GAAA,EAAA,CAAA,IAAA,EAAA;;;;;aGuDwgqI;;iEAAA,uBAAA,CAAA,UAAA;;IHjBo8B,KAAA,EAAA,MAAA;IAAA,QAAA,EAAA,MAAA;;;;;;;;IAtC58rI,UAAA,CAAA,EAAA,MAAA;IAAA,kBAAA,CAAA,EAAA,OAAA;;;;ACbpC,CAAA,+FAA0C,CAAA;;;;;;;;;;;;;AFA1C;AAEI,iBKFY,sBAAA,CLEZ,GAAA,EAAA,MAAA,EAAA,QAAA,EAAA;EAAc,WAAA,CAAA,EAAA,MAAA;EAAU,UAAA,CAAA,EAAA,MAAA;IKIzB,MAAA,CAAO,aAAa"}
|
package/dist/index.d.mts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as _uploadista_core_errors3 from "@uploadista/core/errors";
|
|
2
2
|
import { UploadistaError } from "@uploadista/core/errors";
|
|
3
|
-
import * as
|
|
3
|
+
import * as _uploadista_core_flow7 from "@uploadista/core/flow";
|
|
4
4
|
import { ImageAiPlugin, ImagePlugin, NodeType, OptimizeParams, ResizeParams, TransformImageParams } from "@uploadista/core/flow";
|
|
5
|
-
import * as
|
|
5
|
+
import * as _uploadista_core_types14 from "@uploadista/core/types";
|
|
6
6
|
import { Effect } from "effect";
|
|
7
|
-
import * as
|
|
7
|
+
import * as _uploadista_core_upload1 from "@uploadista/core/upload";
|
|
8
8
|
import { UploadServer } from "@uploadista/core/upload";
|
|
9
|
-
import * as
|
|
10
|
-
import * as
|
|
9
|
+
import * as zod_v4_core5 from "zod/v4/core";
|
|
10
|
+
import * as zod5 from "zod";
|
|
11
11
|
|
|
12
12
|
//#region src/describe-image-node.d.ts
|
|
13
13
|
declare function createDescribeImageNode(id: string, {
|
|
@@ -16,8 +16,8 @@ declare function createDescribeImageNode(id: string, {
|
|
|
16
16
|
}?: {
|
|
17
17
|
credentialId?: string;
|
|
18
18
|
keepOutput?: boolean;
|
|
19
|
-
}): Effect.Effect<
|
|
20
|
-
inputSchema:
|
|
19
|
+
}): Effect.Effect<_uploadista_core_flow7.FlowNodeData & {
|
|
20
|
+
inputSchema: zod5.ZodType<{
|
|
21
21
|
id: string;
|
|
22
22
|
offset: number;
|
|
23
23
|
storage: {
|
|
@@ -44,7 +44,7 @@ declare function createDescribeImageNode(id: string, {
|
|
|
44
44
|
nodeId: string;
|
|
45
45
|
jobId: string;
|
|
46
46
|
} | undefined;
|
|
47
|
-
}, unknown,
|
|
47
|
+
}, unknown, zod_v4_core5.$ZodTypeInternals<{
|
|
48
48
|
id: string;
|
|
49
49
|
offset: number;
|
|
50
50
|
storage: {
|
|
@@ -72,11 +72,11 @@ declare function createDescribeImageNode(id: string, {
|
|
|
72
72
|
jobId: string;
|
|
73
73
|
} | undefined;
|
|
74
74
|
}, unknown>>;
|
|
75
|
-
outputSchema:
|
|
75
|
+
outputSchema: zod5.ZodType<{
|
|
76
76
|
description: string;
|
|
77
77
|
confidence?: number | undefined;
|
|
78
78
|
metadata?: Record<string, unknown> | undefined;
|
|
79
|
-
}, unknown,
|
|
79
|
+
}, unknown, zod_v4_core5.$ZodTypeInternals<{
|
|
80
80
|
description: string;
|
|
81
81
|
confidence?: number | undefined;
|
|
82
82
|
metadata?: Record<string, unknown> | undefined;
|
|
@@ -115,7 +115,7 @@ declare function createDescribeImageNode(id: string, {
|
|
|
115
115
|
flowId: string;
|
|
116
116
|
inputs?: Record<string, unknown>;
|
|
117
117
|
clientId: string | null;
|
|
118
|
-
}) => Effect.Effect<
|
|
118
|
+
}) => Effect.Effect<_uploadista_core_flow7.NodeExecutionResult<{
|
|
119
119
|
description: string;
|
|
120
120
|
confidence?: number | undefined;
|
|
121
121
|
metadata?: Record<string, unknown> | undefined;
|
|
@@ -143,17 +143,17 @@ declare function createOptimizeNode(id: string, {
|
|
|
143
143
|
format
|
|
144
144
|
}: OptimizeParams, options?: {
|
|
145
145
|
keepOutput?: boolean;
|
|
146
|
-
}): Effect.Effect<
|
|
147
|
-
inputSchema:
|
|
148
|
-
outputSchema:
|
|
146
|
+
}): Effect.Effect<_uploadista_core_flow7.FlowNodeData & {
|
|
147
|
+
inputSchema: zod5.ZodType<_uploadista_core_types14.UploadFile, unknown, zod_v4_core5.$ZodTypeInternals<_uploadista_core_types14.UploadFile, unknown>>;
|
|
148
|
+
outputSchema: zod5.ZodType<_uploadista_core_types14.UploadFile, unknown, zod_v4_core5.$ZodTypeInternals<_uploadista_core_types14.UploadFile, unknown>>;
|
|
149
149
|
run: (args: {
|
|
150
|
-
data:
|
|
150
|
+
data: _uploadista_core_types14.UploadFile;
|
|
151
151
|
jobId: string;
|
|
152
152
|
storageId: string;
|
|
153
153
|
flowId: string;
|
|
154
154
|
inputs?: Record<string, unknown>;
|
|
155
155
|
clientId: string | null;
|
|
156
|
-
}) => Effect.Effect<
|
|
156
|
+
}) => Effect.Effect<_uploadista_core_flow7.NodeExecutionResult<_uploadista_core_types14.UploadFile>, _uploadista_core_errors3.UploadistaError, never>;
|
|
157
157
|
condition?: {
|
|
158
158
|
field: string;
|
|
159
159
|
operator: string;
|
|
@@ -168,8 +168,8 @@ declare function createOptimizeNode(id: string, {
|
|
|
168
168
|
exponentialBackoff?: boolean;
|
|
169
169
|
};
|
|
170
170
|
} & {
|
|
171
|
-
type:
|
|
172
|
-
},
|
|
171
|
+
type: _uploadista_core_flow7.NodeType;
|
|
172
|
+
}, _uploadista_core_errors3.UploadistaError, _uploadista_core_upload1.UploadServer | ImagePlugin>;
|
|
173
173
|
//#endregion
|
|
174
174
|
//#region src/remove-background-node.d.ts
|
|
175
175
|
declare function createRemoveBackgroundNode(id: string, {
|
|
@@ -178,8 +178,8 @@ declare function createRemoveBackgroundNode(id: string, {
|
|
|
178
178
|
}?: {
|
|
179
179
|
credentialId?: string;
|
|
180
180
|
keepOutput?: boolean;
|
|
181
|
-
}): Effect.Effect<
|
|
182
|
-
inputSchema:
|
|
181
|
+
}): Effect.Effect<_uploadista_core_flow7.FlowNodeData & {
|
|
182
|
+
inputSchema: zod5.ZodType<{
|
|
183
183
|
id: string;
|
|
184
184
|
offset: number;
|
|
185
185
|
storage: {
|
|
@@ -206,7 +206,7 @@ declare function createRemoveBackgroundNode(id: string, {
|
|
|
206
206
|
nodeId: string;
|
|
207
207
|
jobId: string;
|
|
208
208
|
} | undefined;
|
|
209
|
-
}, unknown,
|
|
209
|
+
}, unknown, zod_v4_core5.$ZodTypeInternals<{
|
|
210
210
|
id: string;
|
|
211
211
|
offset: number;
|
|
212
212
|
storage: {
|
|
@@ -234,7 +234,7 @@ declare function createRemoveBackgroundNode(id: string, {
|
|
|
234
234
|
jobId: string;
|
|
235
235
|
} | undefined;
|
|
236
236
|
}, unknown>>;
|
|
237
|
-
outputSchema:
|
|
237
|
+
outputSchema: zod5.ZodType<_uploadista_core_types14.UploadFile, unknown, zod_v4_core5.$ZodTypeInternals<_uploadista_core_types14.UploadFile, unknown>>;
|
|
238
238
|
run: (args: {
|
|
239
239
|
data: {
|
|
240
240
|
id: string;
|
|
@@ -269,7 +269,7 @@ declare function createRemoveBackgroundNode(id: string, {
|
|
|
269
269
|
flowId: string;
|
|
270
270
|
inputs?: Record<string, unknown>;
|
|
271
271
|
clientId: string | null;
|
|
272
|
-
}) => Effect.Effect<
|
|
272
|
+
}) => Effect.Effect<_uploadista_core_flow7.NodeExecutionResult<_uploadista_core_types14.UploadFile>, UploadistaError, never>;
|
|
273
273
|
condition?: {
|
|
274
274
|
field: string;
|
|
275
275
|
operator: string;
|
|
@@ -285,7 +285,7 @@ declare function createRemoveBackgroundNode(id: string, {
|
|
|
285
285
|
};
|
|
286
286
|
} & {
|
|
287
287
|
type: NodeType.process;
|
|
288
|
-
}, UploadistaError,
|
|
288
|
+
}, UploadistaError, UploadServer | ImageAiPlugin>;
|
|
289
289
|
//#endregion
|
|
290
290
|
//#region src/resize-node.d.ts
|
|
291
291
|
declare function createResizeNode(id: string, {
|
|
@@ -294,17 +294,17 @@ declare function createResizeNode(id: string, {
|
|
|
294
294
|
fit
|
|
295
295
|
}: ResizeParams, options?: {
|
|
296
296
|
keepOutput?: boolean;
|
|
297
|
-
}): Effect.Effect<
|
|
298
|
-
inputSchema:
|
|
299
|
-
outputSchema:
|
|
297
|
+
}): Effect.Effect<_uploadista_core_flow7.FlowNodeData & {
|
|
298
|
+
inputSchema: zod5.ZodType<_uploadista_core_types14.UploadFile, unknown, zod_v4_core5.$ZodTypeInternals<_uploadista_core_types14.UploadFile, unknown>>;
|
|
299
|
+
outputSchema: zod5.ZodType<_uploadista_core_types14.UploadFile, unknown, zod_v4_core5.$ZodTypeInternals<_uploadista_core_types14.UploadFile, unknown>>;
|
|
300
300
|
run: (args: {
|
|
301
|
-
data:
|
|
301
|
+
data: _uploadista_core_types14.UploadFile;
|
|
302
302
|
jobId: string;
|
|
303
303
|
storageId: string;
|
|
304
304
|
flowId: string;
|
|
305
305
|
inputs?: Record<string, unknown>;
|
|
306
306
|
clientId: string | null;
|
|
307
|
-
}) => Effect.Effect<
|
|
307
|
+
}) => Effect.Effect<_uploadista_core_flow7.NodeExecutionResult<_uploadista_core_types14.UploadFile>, _uploadista_core_errors3.UploadistaError, never>;
|
|
308
308
|
condition?: {
|
|
309
309
|
field: string;
|
|
310
310
|
operator: string;
|
|
@@ -319,8 +319,8 @@ declare function createResizeNode(id: string, {
|
|
|
319
319
|
exponentialBackoff?: boolean;
|
|
320
320
|
};
|
|
321
321
|
} & {
|
|
322
|
-
type:
|
|
323
|
-
},
|
|
322
|
+
type: _uploadista_core_flow7.NodeType;
|
|
323
|
+
}, _uploadista_core_errors3.UploadistaError, _uploadista_core_upload1.UploadServer | ImagePlugin>;
|
|
324
324
|
//#endregion
|
|
325
325
|
//#region src/transform-image-node.d.ts
|
|
326
326
|
/**
|
|
@@ -363,17 +363,17 @@ declare function createTransformImageNode(id: string, {
|
|
|
363
363
|
transformations
|
|
364
364
|
}: TransformImageParams, options?: {
|
|
365
365
|
keepOutput?: boolean;
|
|
366
|
-
}): Effect.Effect<
|
|
367
|
-
inputSchema:
|
|
368
|
-
outputSchema:
|
|
366
|
+
}): Effect.Effect<_uploadista_core_flow7.FlowNodeData & {
|
|
367
|
+
inputSchema: zod5.ZodType<_uploadista_core_types14.UploadFile, unknown, zod_v4_core5.$ZodTypeInternals<_uploadista_core_types14.UploadFile, unknown>>;
|
|
368
|
+
outputSchema: zod5.ZodType<_uploadista_core_types14.UploadFile, unknown, zod_v4_core5.$ZodTypeInternals<_uploadista_core_types14.UploadFile, unknown>>;
|
|
369
369
|
run: (args: {
|
|
370
|
-
data:
|
|
370
|
+
data: _uploadista_core_types14.UploadFile;
|
|
371
371
|
jobId: string;
|
|
372
372
|
storageId: string;
|
|
373
373
|
flowId: string;
|
|
374
374
|
inputs?: Record<string, unknown>;
|
|
375
375
|
clientId: string | null;
|
|
376
|
-
}) => Effect.Effect<
|
|
376
|
+
}) => Effect.Effect<_uploadista_core_flow7.NodeExecutionResult<_uploadista_core_types14.UploadFile>, _uploadista_core_errors3.UploadistaError, never>;
|
|
377
377
|
condition?: {
|
|
378
378
|
field: string;
|
|
379
379
|
operator: string;
|
|
@@ -388,8 +388,8 @@ declare function createTransformImageNode(id: string, {
|
|
|
388
388
|
exponentialBackoff?: boolean;
|
|
389
389
|
};
|
|
390
390
|
} & {
|
|
391
|
-
type:
|
|
392
|
-
},
|
|
391
|
+
type: _uploadista_core_flow7.NodeType;
|
|
392
|
+
}, _uploadista_core_errors3.UploadistaError, _uploadista_core_upload1.UploadServer | ImagePlugin>;
|
|
393
393
|
//#endregion
|
|
394
394
|
//#region src/wait-for-url.d.ts
|
|
395
395
|
/**
|
package/dist/index.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/describe-image-node.ts","../src/optimize-node.ts","../src/remove-background-node.ts","../src/resize-node.ts","../src/transform-image-node.ts","../src/wait-for-url.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;;;iBAcgB,uBAAA;;;;;;IAEoE,MAAA,CAAA,OAAxD,sBAAA,CAAwD,YAAA;;;;;;MAFpE,IAAA,EAAA,MAAA;MAEZ,IAAA,CAAA,EAAA,MAAA,GAAA,SAAA;MAAc,QAAA,CAAA,EAAA,MAAA,GAAA,SAAA;MAAU,MAAA,CAAA,EAAA,MAAwD,GAAA,SAAA;;;;;;;;;;;;;;;;;;IAAA,CAAA,GAAA,SAAA;EAAA,CAAA,EAAA,OAAA,gCAAA,CAAA;;;;MCQpE,EAAA,EAAA,MAAA;MAEZ,IAAA,EAAA,MAAA;MAAS,IAAA,CAAA,EAAA,MAAA,GAAA,SAAA;MAAU,QAAA,CAAA,EAAA,MAAA,GAAA,SAAA;MAAc,MAAA,CAAA,EAAA,MACD,GAAA,SAAA;MAAA,KAAA,CAAA,EAAA;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/describe-image-node.ts","../src/optimize-node.ts","../src/remove-background-node.ts","../src/resize-node.ts","../src/transform-image-node.ts","../src/wait-for-url.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;;;iBAcgB,uBAAA;;;;;;IAEoE,MAAA,CAAA,OAAxD,sBAAA,CAAwD,YAAA;;;;;;MAFpE,IAAA,EAAA,MAAA;MAEZ,IAAA,CAAA,EAAA,MAAA,GAAA,SAAA;MAAc,QAAA,CAAA,EAAA,MAAA,GAAA,SAAA;MAAU,MAAA,CAAA,EAAA,MAAwD,GAAA,SAAA;;;;;;;;;;;;;;;;;;IAAA,CAAA,GAAA,SAAA;EAAA,CAAA,EAAA,OAAA,gCAAA,CAAA;;;;MCQpE,EAAA,EAAA,MAA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,EAAA,QAAA,EAAA;EAAc,WAAA,CAAA,EAAA,MAAA;EAAU,UAAA,CAAA,EAAA,MAAA;IKIzB,MAAA,CAAO,aAAa"}
|
package/dist/index.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{UploadistaError as e}from"@uploadista/core/errors";import{IMAGE_DESCRIPTION_OUTPUT_TYPE_ID as t,ImageAiPlugin as n,ImagePlugin as r,NodeType as i,STORAGE_OUTPUT_TYPE_ID as a,completeNodeExecution as o,createFlowNode as s,createTransformNode as c,imageDescriptionOutputSchema as l,resolveUploadMetadata as u}from"@uploadista/core/flow";import{uploadFileSchema as d}from"@uploadista/core/types";import{Effect as f}from"effect";import{UploadServer as p}from"@uploadista/core/upload";function m(t,n={}){let{maxWaitTime:r=1e4,retryDelay:i=500}=n;return f.gen(function*(){let n=Date.now();for(;Date.now()-n<r;){let e=yield*f.tryPromise(()=>fetch(t,{method:`HEAD`})).pipe(f.catchAll(()=>f.succeed(null)));if(e?.ok){yield*f.logInfo(`URL ${t} is now available`);return}e?yield*f.logDebug(`URL not ready yet (${e.status}), retrying...`):yield*f.logDebug(`URL check failed, retrying...`),yield*f.sleep(i)}return yield*e.fromCode(`FLOW_NODE_ERROR`,{cause:`URL ${t} not available after ${r}ms`}).toEffect()})}function h(r,{credentialId:a,keepOutput:c}={}){return f.gen(function*(){let u=yield*n;return yield*s({id:r,name:`Describe Image`,description:`Describes the image using AI`,type:i.process,
|
|
1
|
+
import{UploadistaError as e}from"@uploadista/core/errors";import{IMAGE_DESCRIPTION_OUTPUT_TYPE_ID as t,ImageAiPlugin as n,ImagePlugin as r,NodeType as i,STORAGE_OUTPUT_TYPE_ID as a,completeNodeExecution as o,createFlowNode as s,createTransformNode as c,imageDescriptionOutputSchema as l,resolveUploadMetadata as u}from"@uploadista/core/flow";import{uploadFileSchema as d}from"@uploadista/core/types";import{Effect as f}from"effect";import{UploadServer as p}from"@uploadista/core/upload";function m(t,n={}){let{maxWaitTime:r=1e4,retryDelay:i=500}=n;return f.gen(function*(){let n=Date.now();for(;Date.now()-n<r;){let e=yield*f.tryPromise(()=>fetch(t,{method:`HEAD`})).pipe(f.catchAll(()=>f.succeed(null)));if(e?.ok){yield*f.logInfo(`URL ${t} is now available`);return}e?yield*f.logDebug(`URL not ready yet (${e.status}), retrying...`):yield*f.logDebug(`URL check failed, retrying...`),yield*f.sleep(i)}return yield*e.fromCode(`FLOW_NODE_ERROR`,{cause:`URL ${t} not available after ${r}ms`}).toEffect()})}function h(r,{credentialId:a,keepOutput:c}={}){return f.gen(function*(){let u=yield*n;return yield*s({id:r,name:`Describe Image`,description:`Describes the image using AI`,type:i.process,outputTypeId:t,keepOutput:c,inputSchema:d,outputSchema:l,run:({data:t,flowId:n,jobId:i,clientId:s})=>f.gen(function*(){let c={flowId:n,nodeId:r,jobId:i},l=t.url;if(!l)return yield*e.fromCode(`FLOW_NODE_ERROR`,{cause:`URL is required for describe image operation`}).toEffect();yield*f.logInfo(`Describing image for file ${t.id} at URL: ${l}`),yield*m(l);let d={clientId:s,credentialId:a},p=yield*u.describeImage(l,d).pipe(f.catchAll(t=>f.gen(function*(){return yield*f.logError(`Failed to describe image`,t),yield*e.fromCode(`FLOW_NODE_ERROR`,{cause:t instanceof Error?t.message:`Failed to describe image`}).toEffect()})));return yield*f.logInfo(`Successfully described image for file ${t.id}`),o({description:p.description,flow:c})})})})}const g={jpeg:`image/jpeg`,webp:`image/webp`,png:`image/png`,avif:`image/avif`},_={jpeg:`jpg`,webp:`webp`,png:`png`,avif:`avif`};function v(e,{quality:t,format:n},i){return f.gen(function*(){let o=yield*r;return yield*c({id:e,name:`Optimize`,description:`Optimizes an image for web delivery`,outputTypeId:a,keepOutput:i?.keepOutput,transform:(e,r)=>f.map(o.optimize(e,{quality:t,format:n}),e=>{let t=g[n],i=_[n],a=r.metadata?.fileName;return{bytes:e,type:t,fileName:a&&typeof a==`string`?a.replace(/\.[^.]+$/,`.${i}`):void 0}})})})}function y(t,{credentialId:r,keepOutput:c}={}){return f.gen(function*(){let l=yield*n,h=yield*p;return yield*s({id:t,name:`Remove Background`,description:`Removes the background from an image`,type:i.process,outputTypeId:a,keepOutput:c,inputSchema:d,outputSchema:d,run:({data:n,flowId:i,jobId:a,storageId:s,clientId:c})=>f.gen(function*(){let d={flowId:i,nodeId:t,jobId:a},p=n.url;if(!p)return yield*e.fromCode(`FLOW_NODE_ERROR`,{cause:`URL is required for remove background operation`}).toEffect();yield*f.logInfo(`Removing background for file ${n.id} at URL: ${n.url}`),yield*m(p);let g={clientId:c,credentialId:r},{outputUrl:_}=yield*l.removeBackground(p,g).pipe(f.catchAll(t=>f.gen(function*(){return yield*f.logError(`Failed to remove background`,t),yield*e.fromCode(`FLOW_NODE_ERROR`,{cause:t instanceof Error?t.message:`Failed to remove background from image`}).toEffect()}))),{type:v,fileName:y,metadata:b,metadataJson:x}=u(n.metadata);yield*f.logInfo(`Uploading processed file to storage`);let S=yield*h.uploadFromUrl({storageId:s,size:0,type:v,fileName:y,lastModified:0,metadata:x,flow:d},c,_).pipe(f.catchAll(t=>f.gen(function*(){return yield*f.logError(`Failed to upload processed file`,t),yield*e.fromCode(`FLOW_NODE_ERROR`,{cause:t instanceof Error?t.message:`Failed to upload processed file`}).toEffect()})));return yield*f.logInfo(`Successfully removed background for file ${n.id}`),o(b?{...S,metadata:b}:S)})})})}function b(e,{width:t,height:n,fit:i},o){return f.gen(function*(){let s=yield*r;return yield*c({id:e,name:`Resize`,description:`Resizes an image to the specified dimensions`,outputTypeId:a,keepOutput:o?.keepOutput,transform:e=>s.resize(e,{height:n,width:t,fit:i})})})}function x(e,t,n){return f.reduce(n,t,(t,n)=>e.transform(t,n))}function S(e,{transformations:t},n){return f.gen(function*(){let i=yield*r;return yield*c({id:e,name:`Transform Image`,description:`Apply ${t.length} transformation${t.length===1?``:`s`} to the image`,outputTypeId:a,keepOutput:n?.keepOutput,transform:e=>x(i,e,t)})})}export{h as createDescribeImageNode,v as createOptimizeNode,y as createRemoveBackgroundNode,b as createResizeNode,S as createTransformImageNode,m as waitForUrlAvailability};
|
|
2
2
|
//# sourceMappingURL=index.mjs.map
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":["formatToMimeType: Record<OptimizeParams[\"format\"], string>","formatToExtension: Record<OptimizeParams[\"format\"], string>"],"sources":["../src/wait-for-url.ts","../src/describe-image-node.ts","../src/optimize-node.ts","../src/remove-background-node.ts","../src/resize-node.ts","../src/transform-image-node.ts"],"sourcesContent":["import { UploadistaError } from \"@uploadista/core/errors\";\nimport { Effect } from \"effect\";\n\n/**\n * Waits for a URL to become available by periodically checking its accessibility.\n * This is useful when a file has just been uploaded and may not be immediately\n * accessible due to CDN propagation or storage consistency delays.\n *\n * @param url - The URL to check for availability\n * @param options - Configuration options\n * @param options.maxWaitTime - Maximum time to wait in milliseconds (default: 10000)\n * @param options.retryDelay - Delay between retries in milliseconds (default: 500)\n * @returns Effect that succeeds when URL is available or fails with UploadistaError\n */\nexport function waitForUrlAvailability(\n url: string,\n options: {\n maxWaitTime?: number;\n retryDelay?: number;\n } = {},\n): Effect.Effect<void, UploadistaError> {\n const { maxWaitTime = 10000, retryDelay = 500 } = options;\n\n return Effect.gen(function* () {\n const startTime = Date.now();\n\n while (Date.now() - startTime < maxWaitTime) {\n const response = yield* Effect.tryPromise(() =>\n fetch(url, { method: \"HEAD\" }),\n ).pipe(Effect.catchAll(() => Effect.succeed(null)));\n\n if (response?.ok) {\n yield* Effect.logInfo(`URL ${url} is now available`);\n return;\n }\n\n if (response) {\n yield* Effect.logDebug(\n `URL not ready yet (${response.status}), retrying...`,\n );\n } else {\n yield* Effect.logDebug(`URL check failed, retrying...`);\n }\n\n yield* Effect.sleep(retryDelay);\n }\n\n return yield* UploadistaError.fromCode(\"FLOW_NODE_ERROR\", {\n cause: `URL ${url} not available after ${maxWaitTime}ms`,\n }).toEffect();\n });\n}\n","import { UploadistaError } from \"@uploadista/core/errors\";\nimport {\n completeNodeExecution,\n createFlowNode,\n IMAGE_DESCRIPTION_OUTPUT_TYPE_ID,\n ImageAiPlugin,\n imageDescriptionOutputSchema,\n NodeType,\n} from \"@uploadista/core/flow\";\nimport { uploadFileSchema } from \"@uploadista/core/types\";\n\nimport { Effect } from \"effect\";\nimport { waitForUrlAvailability } from \"./wait-for-url\";\n\nexport function createDescribeImageNode(\n id: string,\n { credentialId, keepOutput }: { credentialId?: string; keepOutput?: boolean } = {},\n) {\n return Effect.gen(function* () {\n const imageAiService = yield* ImageAiPlugin;\n\n return yield* createFlowNode({\n id,\n name: \"Describe Image\",\n description: \"Describes the image using AI\",\n type: NodeType.process,\n nodeTypeId: IMAGE_DESCRIPTION_OUTPUT_TYPE_ID,\n keepOutput,\n inputSchema: uploadFileSchema,\n outputSchema: imageDescriptionOutputSchema,\n run: ({ data: file, flowId, jobId, clientId }) => {\n return Effect.gen(function* () {\n const flow = {\n flowId,\n nodeId: id,\n jobId,\n };\n\n const fileUrl = file.url;\n\n // Validate input\n if (!fileUrl) {\n return yield* UploadistaError.fromCode(\"FLOW_NODE_ERROR\", {\n cause: \"URL is required for describe image operation\",\n }).toEffect();\n }\n\n yield* Effect.logInfo(\n `Describing image for file ${file.id} at URL: ${fileUrl}`,\n );\n\n // Wait for URL to be available with retry mechanism\n yield* waitForUrlAvailability(fileUrl);\n\n // Build context for ImageAI plugin\n const context = {\n clientId,\n credentialId,\n };\n\n // Describe image with error handling\n const result = yield* imageAiService\n .describeImage(fileUrl, context)\n .pipe(\n Effect.catchAll((error) =>\n Effect.gen(function* () {\n yield* Effect.logError(\"Failed to describe image\", error);\n return yield* UploadistaError.fromCode(\"FLOW_NODE_ERROR\", {\n cause:\n error instanceof Error\n ? error.message\n : \"Failed to describe image\",\n }).toEffect();\n }),\n ),\n );\n\n yield* Effect.logInfo(\n `Successfully described image for file ${file.id}`,\n );\n\n // Return structured image description output (not UploadFile)\n return completeNodeExecution({\n description: result.description,\n flow,\n });\n });\n },\n });\n });\n}\n","import {\n createTransformNode,\n ImagePlugin,\n type OptimizeParams,\n STORAGE_OUTPUT_TYPE_ID,\n} from \"@uploadista/core/flow\";\nimport { Effect } from \"effect\";\n\n// Map image format to MIME type\nconst formatToMimeType: Record<OptimizeParams[\"format\"], string> = {\n jpeg: \"image/jpeg\",\n webp: \"image/webp\",\n png: \"image/png\",\n avif: \"image/avif\",\n};\n\n// Map image format to file extension\nconst formatToExtension: Record<OptimizeParams[\"format\"], string> = {\n jpeg: \"jpg\",\n webp: \"webp\",\n png: \"png\",\n avif: \"avif\",\n};\n\nexport function createOptimizeNode(\n id: string,\n { quality, format }: OptimizeParams,\n options?: { keepOutput?: boolean },\n) {\n return Effect.gen(function* () {\n const imageService = yield* ImagePlugin;\n\n return yield* createTransformNode({\n id,\n name: \"Optimize\",\n description: \"Optimizes an image for web delivery\",\n nodeTypeId: STORAGE_OUTPUT_TYPE_ID,\n keepOutput: options?.keepOutput,\n transform: (inputBytes, file) =>\n Effect.map(\n imageService.optimize(inputBytes, { quality, format }),\n (optimizedBytes) => {\n // Return bytes with updated metadata if format changes\n const newType = formatToMimeType[format];\n const newExtension = formatToExtension[format];\n\n // Update file extension if format changed\n const fileName = file.metadata?.fileName;\n const newFileName =\n fileName && typeof fileName === \"string\"\n ? fileName.replace(/\\.[^.]+$/, `.${newExtension}`)\n : undefined;\n\n return {\n bytes: optimizedBytes,\n type: newType,\n fileName: newFileName,\n } as\n | Uint8Array\n | { bytes: Uint8Array; type: string; fileName?: string };\n },\n ),\n });\n });\n}\n","import { UploadistaError } from \"@uploadista/core/errors\";\nimport {\n completeNodeExecution,\n createFlowNode,\n ImageAiPlugin,\n NodeType,\n resolveUploadMetadata,\n STORAGE_OUTPUT_TYPE_ID,\n} from \"@uploadista/core/flow\";\nimport { uploadFileSchema } from \"@uploadista/core/types\";\nimport { UploadServer } from \"@uploadista/core/upload\";\nimport { Effect } from \"effect\";\nimport { waitForUrlAvailability } from \"./wait-for-url\";\n\nexport function createRemoveBackgroundNode(\n id: string,\n { credentialId, keepOutput }: { credentialId?: string; keepOutput?: boolean } = {},\n) {\n return Effect.gen(function* () {\n const imageAiService = yield* ImageAiPlugin;\n const uploadServer = yield* UploadServer;\n\n return yield* createFlowNode({\n id,\n name: \"Remove Background\",\n description: \"Removes the background from an image\",\n type: NodeType.process,\n nodeTypeId: STORAGE_OUTPUT_TYPE_ID,\n keepOutput,\n inputSchema: uploadFileSchema,\n outputSchema: uploadFileSchema,\n run: ({ data: file, flowId, jobId, storageId, clientId }) => {\n return Effect.gen(function* () {\n const flow = {\n flowId,\n nodeId: id,\n jobId,\n };\n\n const fileUrl = file.url;\n\n // Validate input\n if (!fileUrl) {\n return yield* UploadistaError.fromCode(\"FLOW_NODE_ERROR\", {\n cause: \"URL is required for remove background operation\",\n }).toEffect();\n }\n\n yield* Effect.logInfo(\n `Removing background for file ${file.id} at URL: ${file.url}`,\n );\n\n // Wait for URL to be available with retry mechanism\n yield* waitForUrlAvailability(fileUrl);\n\n // Build context for ImageAI plugin\n const context = {\n clientId,\n credentialId,\n };\n\n // Remove background with error handling\n const backgroundRemovalResult = yield* imageAiService\n .removeBackground(fileUrl, context)\n .pipe(\n Effect.catchAll((error) =>\n Effect.gen(function* () {\n yield* Effect.logError(\"Failed to remove background\", error);\n return yield* UploadistaError.fromCode(\"FLOW_NODE_ERROR\", {\n cause:\n error instanceof Error\n ? error.message\n : \"Failed to remove background from image\",\n }).toEffect();\n }),\n ),\n );\n\n const { outputUrl } = backgroundRemovalResult;\n const { type, fileName, metadata, metadataJson } =\n resolveUploadMetadata(file.metadata);\n\n yield* Effect.logInfo(`Uploading processed file to storage`);\n\n // Upload the transformed bytes back to the upload server with error handling\n const result = yield* uploadServer\n .uploadFromUrl(\n {\n storageId,\n size: 0,\n type,\n fileName,\n lastModified: 0,\n metadata: metadataJson,\n flow,\n },\n clientId,\n outputUrl,\n )\n .pipe(\n Effect.catchAll((error) =>\n Effect.gen(function* () {\n yield* Effect.logError(\n \"Failed to upload processed file\",\n error,\n );\n return yield* UploadistaError.fromCode(\"FLOW_NODE_ERROR\", {\n cause:\n error instanceof Error\n ? error.message\n : \"Failed to upload processed file\",\n }).toEffect();\n }),\n ),\n );\n\n yield* Effect.logInfo(\n `Successfully removed background for file ${file.id}`,\n );\n\n return completeNodeExecution(\n metadata\n ? {\n ...result,\n metadata,\n }\n : result,\n );\n });\n },\n });\n });\n}\n","import {\n createTransformNode,\n ImagePlugin,\n type ResizeParams,\n STORAGE_OUTPUT_TYPE_ID,\n} from \"@uploadista/core/flow\";\nimport { Effect } from \"effect\";\n\nexport function createResizeNode(\n id: string,\n { width, height, fit }: ResizeParams,\n options?: { keepOutput?: boolean },\n) {\n return Effect.gen(function* () {\n const imageService = yield* ImagePlugin;\n\n return yield* createTransformNode({\n id,\n name: \"Resize\",\n description: \"Resizes an image to the specified dimensions\",\n nodeTypeId: STORAGE_OUTPUT_TYPE_ID,\n keepOutput: options?.keepOutput,\n transform: (inputBytes) =>\n imageService.resize(inputBytes, { height, width, fit }),\n });\n });\n}\n","import {\n createTransformNode,\n ImagePlugin,\n STORAGE_OUTPUT_TYPE_ID,\n type TransformImageParams,\n} from \"@uploadista/core/flow\";\nimport { Effect } from \"effect\";\n\n/**\n * Apply a chain of transformations to an image by reducing over the transformations array.\n * Each transformation receives the output of the previous transformation as input.\n *\n * @param imageService - The image plugin service to use for transformations\n * @param inputBytes - The input image bytes\n * @param transformations - Array of transformations to apply in sequence\n * @returns Effect that resolves to the final transformed image bytes\n */\nfunction applyTransformationChain(\n imageService: ReturnType<typeof ImagePlugin.of>,\n inputBytes: Uint8Array,\n transformations: TransformImageParams[\"transformations\"],\n) {\n return Effect.reduce(transformations, inputBytes, (bytes, transformation) =>\n imageService.transform(bytes, transformation),\n );\n}\n\n/**\n * Creates a transform image node that applies multiple transformations sequentially.\n *\n * This node enables complex image processing workflows by chaining multiple transformations\n * together. Each transformation is applied to the output of the previous transformation,\n * allowing for powerful image manipulation pipelines.\n *\n * Supported transformations include:\n * - Basic: resize, blur, rotate, flip\n * - Filters: grayscale, sepia, brightness, contrast\n * - Effects: sharpen\n * - Advanced: watermark, logo, text\n *\n * Note: Watermark and logo transformations require imagePath to be a valid URL.\n * Images will be fetched from the provided URL during transformation.\n *\n * @param id - Unique identifier for this node\n * @param params - Parameters including the transformations array\n * @returns Effect that resolves to a transform node\n *\n * @example\n * ```typescript\n * const node = createTransformImageNode(\"transform-1\", {\n * transformations: [\n * { type: 'resize', width: 800, height: 600, fit: 'cover' },\n * { type: 'brightness', value: 20 },\n * {\n * type: 'watermark',\n * imagePath: 'https://cdn.example.com/watermark.png',\n * position: 'bottom-right',\n * opacity: 0.5\n * }\n * ]\n * });\n * ```\n */\nexport function createTransformImageNode(\n id: string,\n { transformations }: TransformImageParams,\n options?: { keepOutput?: boolean },\n) {\n return Effect.gen(function* () {\n const imageService = yield* ImagePlugin;\n\n return yield* createTransformNode({\n id,\n name: \"Transform Image\",\n description: `Apply ${transformations.length} transformation${transformations.length === 1 ? \"\" : \"s\"} to the image`,\n nodeTypeId: STORAGE_OUTPUT_TYPE_ID,\n keepOutput: options?.keepOutput,\n transform: (inputBytes) =>\n applyTransformationChain(imageService, inputBytes, transformations),\n });\n });\n}\n"],"mappings":"ueAcA,SAAgB,EACd,EACA,EAGI,EAAE,CACgC,CACtC,GAAM,CAAE,cAAc,IAAO,aAAa,KAAQ,EAElD,OAAO,EAAO,IAAI,WAAa,CAC7B,IAAM,EAAY,KAAK,KAAK,CAE5B,KAAO,KAAK,KAAK,CAAG,EAAY,GAAa,CAC3C,IAAM,EAAW,MAAO,EAAO,eAC7B,MAAM,EAAK,CAAE,OAAQ,OAAQ,CAAC,CAC/B,CAAC,KAAK,EAAO,aAAe,EAAO,QAAQ,KAAK,CAAC,CAAC,CAEnD,GAAI,GAAU,GAAI,CAChB,MAAO,EAAO,QAAQ,OAAO,EAAI,mBAAmB,CACpD,OAGE,EACF,MAAO,EAAO,SACZ,sBAAsB,EAAS,OAAO,gBACvC,CAED,MA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WACrB,UAAY,GACV,EAAyB,EAAc,EAAY,EAAgB,CACtE,CAAC,EACF"}
|
|
1
|
+
{"version":3,"file":"index.mjs","names":["formatToMimeType: Record<OptimizeParams[\"format\"], string>","formatToExtension: Record<OptimizeParams[\"format\"], string>"],"sources":["../src/wait-for-url.ts","../src/describe-image-node.ts","../src/optimize-node.ts","../src/remove-background-node.ts","../src/resize-node.ts","../src/transform-image-node.ts"],"sourcesContent":["import { UploadistaError } from \"@uploadista/core/errors\";\nimport { Effect } from \"effect\";\n\n/**\n * Waits for a URL to become available by periodically checking its accessibility.\n * This is useful when a file has just been uploaded and may not be immediately\n * accessible due to CDN propagation or storage consistency delays.\n *\n * @param url - The URL to check for availability\n * @param options - Configuration options\n * @param options.maxWaitTime - Maximum time to wait in milliseconds (default: 10000)\n * @param options.retryDelay - Delay between retries in milliseconds (default: 500)\n * @returns Effect that succeeds when URL is available or fails with UploadistaError\n */\nexport function waitForUrlAvailability(\n url: string,\n options: {\n maxWaitTime?: number;\n retryDelay?: number;\n } = {},\n): Effect.Effect<void, UploadistaError> {\n const { maxWaitTime = 10000, retryDelay = 500 } = options;\n\n return Effect.gen(function* () {\n const startTime = Date.now();\n\n while (Date.now() - startTime < maxWaitTime) {\n const response = yield* Effect.tryPromise(() =>\n fetch(url, { method: \"HEAD\" }),\n ).pipe(Effect.catchAll(() => Effect.succeed(null)));\n\n if (response?.ok) {\n yield* Effect.logInfo(`URL ${url} is now available`);\n return;\n }\n\n if (response) {\n yield* Effect.logDebug(\n `URL not ready yet (${response.status}), retrying...`,\n );\n } else {\n yield* Effect.logDebug(`URL check failed, retrying...`);\n }\n\n yield* Effect.sleep(retryDelay);\n }\n\n return yield* UploadistaError.fromCode(\"FLOW_NODE_ERROR\", {\n cause: `URL ${url} not available after ${maxWaitTime}ms`,\n }).toEffect();\n });\n}\n","import { UploadistaError } from \"@uploadista/core/errors\";\nimport {\n completeNodeExecution,\n createFlowNode,\n IMAGE_DESCRIPTION_OUTPUT_TYPE_ID,\n ImageAiPlugin,\n imageDescriptionOutputSchema,\n NodeType,\n} from \"@uploadista/core/flow\";\nimport { uploadFileSchema } from \"@uploadista/core/types\";\n\nimport { Effect } from \"effect\";\nimport { waitForUrlAvailability } from \"./wait-for-url\";\n\nexport function createDescribeImageNode(\n id: string,\n { credentialId, keepOutput }: { credentialId?: string; keepOutput?: boolean } = {},\n) {\n return Effect.gen(function* () {\n const imageAiService = yield* ImageAiPlugin;\n\n return yield* createFlowNode({\n id,\n name: \"Describe Image\",\n description: \"Describes the image using AI\",\n type: NodeType.process,\n outputTypeId: IMAGE_DESCRIPTION_OUTPUT_TYPE_ID,\n keepOutput,\n inputSchema: uploadFileSchema,\n outputSchema: imageDescriptionOutputSchema,\n run: ({ data: file, flowId, jobId, clientId }) => {\n return Effect.gen(function* () {\n const flow = {\n flowId,\n nodeId: id,\n jobId,\n };\n\n const fileUrl = file.url;\n\n // Validate input\n if (!fileUrl) {\n return yield* UploadistaError.fromCode(\"FLOW_NODE_ERROR\", {\n cause: \"URL is required for describe image operation\",\n }).toEffect();\n }\n\n yield* Effect.logInfo(\n `Describing image for file ${file.id} at URL: ${fileUrl}`,\n );\n\n // Wait for URL to be available with retry mechanism\n yield* waitForUrlAvailability(fileUrl);\n\n // Build context for ImageAI plugin\n const context = {\n clientId,\n credentialId,\n };\n\n // Describe image with error handling\n const result = yield* imageAiService\n .describeImage(fileUrl, context)\n .pipe(\n Effect.catchAll((error) =>\n Effect.gen(function* () {\n yield* Effect.logError(\"Failed to describe image\", error);\n return yield* UploadistaError.fromCode(\"FLOW_NODE_ERROR\", {\n cause:\n error instanceof Error\n ? error.message\n : \"Failed to describe image\",\n }).toEffect();\n }),\n ),\n );\n\n yield* Effect.logInfo(\n `Successfully described image for file ${file.id}`,\n );\n\n // Return structured image description output (not UploadFile)\n return completeNodeExecution({\n description: result.description,\n flow,\n });\n });\n },\n });\n });\n}\n","import {\n createTransformNode,\n ImagePlugin,\n type OptimizeParams,\n STORAGE_OUTPUT_TYPE_ID,\n} from \"@uploadista/core/flow\";\nimport { Effect } from \"effect\";\n\n// Map image format to MIME type\nconst formatToMimeType: Record<OptimizeParams[\"format\"], string> = {\n jpeg: \"image/jpeg\",\n webp: \"image/webp\",\n png: \"image/png\",\n avif: \"image/avif\",\n};\n\n// Map image format to file extension\nconst formatToExtension: Record<OptimizeParams[\"format\"], string> = {\n jpeg: \"jpg\",\n webp: \"webp\",\n png: \"png\",\n avif: \"avif\",\n};\n\nexport function createOptimizeNode(\n id: string,\n { quality, format }: OptimizeParams,\n options?: { keepOutput?: boolean },\n) {\n return Effect.gen(function* () {\n const imageService = yield* ImagePlugin;\n\n return yield* createTransformNode({\n id,\n name: \"Optimize\",\n description: \"Optimizes an image for web delivery\",\n outputTypeId: STORAGE_OUTPUT_TYPE_ID,\n keepOutput: options?.keepOutput,\n transform: (inputBytes, file) =>\n Effect.map(\n imageService.optimize(inputBytes, { quality, format }),\n (optimizedBytes) => {\n // Return bytes with updated metadata if format changes\n const newType = formatToMimeType[format];\n const newExtension = formatToExtension[format];\n\n // Update file extension if format changed\n const fileName = file.metadata?.fileName;\n const newFileName =\n fileName && typeof fileName === \"string\"\n ? fileName.replace(/\\.[^.]+$/, `.${newExtension}`)\n : undefined;\n\n return {\n bytes: optimizedBytes,\n type: newType,\n fileName: newFileName,\n } as\n | Uint8Array\n | { bytes: Uint8Array; type: string; fileName?: string };\n },\n ),\n });\n });\n}\n","import { UploadistaError } from \"@uploadista/core/errors\";\nimport {\n completeNodeExecution,\n createFlowNode,\n ImageAiPlugin,\n NodeType,\n resolveUploadMetadata,\n STORAGE_OUTPUT_TYPE_ID,\n} from \"@uploadista/core/flow\";\nimport { uploadFileSchema } from \"@uploadista/core/types\";\nimport { UploadServer } from \"@uploadista/core/upload\";\nimport { Effect } from \"effect\";\nimport { waitForUrlAvailability } from \"./wait-for-url\";\n\nexport function createRemoveBackgroundNode(\n id: string,\n { credentialId, keepOutput }: { credentialId?: string; keepOutput?: boolean } = {},\n) {\n return Effect.gen(function* () {\n const imageAiService = yield* ImageAiPlugin;\n const uploadServer = yield* UploadServer;\n\n return yield* createFlowNode({\n id,\n name: \"Remove Background\",\n description: \"Removes the background from an image\",\n type: NodeType.process,\n outputTypeId: STORAGE_OUTPUT_TYPE_ID,\n keepOutput,\n inputSchema: uploadFileSchema,\n outputSchema: uploadFileSchema,\n run: ({ data: file, flowId, jobId, storageId, clientId }) => {\n return Effect.gen(function* () {\n const flow = {\n flowId,\n nodeId: id,\n jobId,\n };\n\n const fileUrl = file.url;\n\n // Validate input\n if (!fileUrl) {\n return yield* UploadistaError.fromCode(\"FLOW_NODE_ERROR\", {\n cause: \"URL is required for remove background operation\",\n }).toEffect();\n }\n\n yield* Effect.logInfo(\n `Removing background for file ${file.id} at URL: ${file.url}`,\n );\n\n // Wait for URL to be available with retry mechanism\n yield* waitForUrlAvailability(fileUrl);\n\n // Build context for ImageAI plugin\n const context = {\n clientId,\n credentialId,\n };\n\n // Remove background with error handling\n const backgroundRemovalResult = yield* imageAiService\n .removeBackground(fileUrl, context)\n .pipe(\n Effect.catchAll((error) =>\n Effect.gen(function* () {\n yield* Effect.logError(\"Failed to remove background\", error);\n return yield* UploadistaError.fromCode(\"FLOW_NODE_ERROR\", {\n cause:\n error instanceof Error\n ? error.message\n : \"Failed to remove background from image\",\n }).toEffect();\n }),\n ),\n );\n\n const { outputUrl } = backgroundRemovalResult;\n const { type, fileName, metadata, metadataJson } =\n resolveUploadMetadata(file.metadata);\n\n yield* Effect.logInfo(`Uploading processed file to storage`);\n\n // Upload the transformed bytes back to the upload server with error handling\n const result = yield* uploadServer\n .uploadFromUrl(\n {\n storageId,\n size: 0,\n type,\n fileName,\n lastModified: 0,\n metadata: metadataJson,\n flow,\n },\n clientId,\n outputUrl,\n )\n .pipe(\n Effect.catchAll((error) =>\n Effect.gen(function* () {\n yield* Effect.logError(\n \"Failed to upload processed file\",\n error,\n );\n return yield* UploadistaError.fromCode(\"FLOW_NODE_ERROR\", {\n cause:\n error instanceof Error\n ? error.message\n : \"Failed to upload processed file\",\n }).toEffect();\n }),\n ),\n );\n\n yield* Effect.logInfo(\n `Successfully removed background for file ${file.id}`,\n );\n\n return completeNodeExecution(\n metadata\n ? {\n ...result,\n metadata,\n }\n : result,\n );\n });\n },\n });\n });\n}\n","import {\n createTransformNode,\n ImagePlugin,\n type ResizeParams,\n STORAGE_OUTPUT_TYPE_ID,\n} from \"@uploadista/core/flow\";\nimport { Effect } from \"effect\";\n\nexport function createResizeNode(\n id: string,\n { width, height, fit }: ResizeParams,\n options?: { keepOutput?: boolean },\n) {\n return Effect.gen(function* () {\n const imageService = yield* ImagePlugin;\n\n return yield* createTransformNode({\n id,\n name: \"Resize\",\n description: \"Resizes an image to the specified dimensions\",\n outputTypeId: STORAGE_OUTPUT_TYPE_ID,\n keepOutput: options?.keepOutput,\n transform: (inputBytes) =>\n imageService.resize(inputBytes, { height, width, fit }),\n });\n });\n}\n","import {\n createTransformNode,\n ImagePlugin,\n STORAGE_OUTPUT_TYPE_ID,\n type TransformImageParams,\n} from \"@uploadista/core/flow\";\nimport { Effect } from \"effect\";\n\n/**\n * Apply a chain of transformations to an image by reducing over the transformations array.\n * Each transformation receives the output of the previous transformation as input.\n *\n * @param imageService - The image plugin service to use for transformations\n * @param inputBytes - The input image bytes\n * @param transformations - Array of transformations to apply in sequence\n * @returns Effect that resolves to the final transformed image bytes\n */\nfunction applyTransformationChain(\n imageService: ReturnType<typeof ImagePlugin.of>,\n inputBytes: Uint8Array,\n transformations: TransformImageParams[\"transformations\"],\n) {\n return Effect.reduce(transformations, inputBytes, (bytes, transformation) =>\n imageService.transform(bytes, transformation),\n );\n}\n\n/**\n * Creates a transform image node that applies multiple transformations sequentially.\n *\n * This node enables complex image processing workflows by chaining multiple transformations\n * together. Each transformation is applied to the output of the previous transformation,\n * allowing for powerful image manipulation pipelines.\n *\n * Supported transformations include:\n * - Basic: resize, blur, rotate, flip\n * - Filters: grayscale, sepia, brightness, contrast\n * - Effects: sharpen\n * - Advanced: watermark, logo, text\n *\n * Note: Watermark and logo transformations require imagePath to be a valid URL.\n * Images will be fetched from the provided URL during transformation.\n *\n * @param id - Unique identifier for this node\n * @param params - Parameters including the transformations array\n * @returns Effect that resolves to a transform node\n *\n * @example\n * ```typescript\n * const node = createTransformImageNode(\"transform-1\", {\n * transformations: [\n * { type: 'resize', width: 800, height: 600, fit: 'cover' },\n * { type: 'brightness', value: 20 },\n * {\n * type: 'watermark',\n * imagePath: 'https://cdn.example.com/watermark.png',\n * position: 'bottom-right',\n * opacity: 0.5\n * }\n * ]\n * });\n * ```\n */\nexport function createTransformImageNode(\n id: string,\n { transformations }: TransformImageParams,\n options?: { keepOutput?: boolean },\n) {\n return Effect.gen(function* () {\n const imageService = yield* ImagePlugin;\n\n return yield* createTransformNode({\n id,\n name: \"Transform Image\",\n description: `Apply ${transformations.length} transformation${transformations.length === 1 ? \"\" : \"s\"} to the image`,\n outputTypeId: STORAGE_OUTPUT_TYPE_ID,\n keepOutput: options?.keepOutput,\n transform: (inputBytes) =>\n applyTransformationChain(imageService, inputBytes, transformations),\n });\n });\n}\n"],"mappings":"ueAcA,SAAgB,EACd,EACA,EAGI,EAAE,CACgC,CACtC,GAAM,CAAE,cAAc,IAAO,aAAa,KAAQ,EAElD,OAAO,EAAO,IAAI,WAAa,CAC7B,IAAM,EAAY,KAAK,KAAK,CAE5B,KAAO,KAAK,KAAK,CAAG,EAAY,GAAa,CAC3C,IAAM,EAAW,MAAO,EAAO,eAC7B,MAAM,EAAK,CAAE,OAAQ,OAAQ,CAAC,CAC/B,CAAC,KAAK,EAAO,aAAe,EAAO,QAAQ,KAAK,CAAC,CAAC,CAEnD,GAAI,GAAU,GAAI,CAChB,MAAO,EAAO,QAAQ,OAAO,EAAI,mBAAmB,CACpD,OAGE,EACF,MAAO,EAAO,SACZ,sBAAsB,EAAS,OAAO,gBACvC,CAED,MAAO,EAAO,SAAS,gCAAgC,CAGzD,MAAO,EAAO,MAAM,EAAW,CAGjC,OAAO,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ANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uploadista/flow-images-nodes",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.18-beta.1",
|
|
5
5
|
"description": "Image processing nodes for Uploadista Flow",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"author": "Uploadista",
|
|
@@ -14,16 +14,20 @@
|
|
|
14
14
|
}
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
"@uploadista/core": "0.0.18-beta.1"
|
|
18
|
+
},
|
|
19
|
+
"peerDependencies": {
|
|
20
|
+
"effect": "^3.0.0",
|
|
21
|
+
"zod": "^4.0.0"
|
|
20
22
|
},
|
|
21
23
|
"devDependencies": {
|
|
22
24
|
"@effect/vitest": "0.27.0",
|
|
23
25
|
"@types/node": "24.10.1",
|
|
26
|
+
"effect": "3.19.6",
|
|
24
27
|
"tsdown": "0.16.6",
|
|
25
28
|
"vitest": "4.0.13",
|
|
26
|
-
"
|
|
29
|
+
"zod": "4.1.13",
|
|
30
|
+
"@uploadista/typescript-config": "0.0.18-beta.1"
|
|
27
31
|
},
|
|
28
32
|
"scripts": {
|
|
29
33
|
"build": "tsdown",
|
|
@@ -24,7 +24,7 @@ export function createDescribeImageNode(
|
|
|
24
24
|
name: "Describe Image",
|
|
25
25
|
description: "Describes the image using AI",
|
|
26
26
|
type: NodeType.process,
|
|
27
|
-
|
|
27
|
+
outputTypeId: IMAGE_DESCRIPTION_OUTPUT_TYPE_ID,
|
|
28
28
|
keepOutput,
|
|
29
29
|
inputSchema: uploadFileSchema,
|
|
30
30
|
outputSchema: imageDescriptionOutputSchema,
|
package/src/optimize-node.ts
CHANGED
|
@@ -34,7 +34,7 @@ export function createOptimizeNode(
|
|
|
34
34
|
id,
|
|
35
35
|
name: "Optimize",
|
|
36
36
|
description: "Optimizes an image for web delivery",
|
|
37
|
-
|
|
37
|
+
outputTypeId: STORAGE_OUTPUT_TYPE_ID,
|
|
38
38
|
keepOutput: options?.keepOutput,
|
|
39
39
|
transform: (inputBytes, file) =>
|
|
40
40
|
Effect.map(
|
|
@@ -25,7 +25,7 @@ export function createRemoveBackgroundNode(
|
|
|
25
25
|
name: "Remove Background",
|
|
26
26
|
description: "Removes the background from an image",
|
|
27
27
|
type: NodeType.process,
|
|
28
|
-
|
|
28
|
+
outputTypeId: STORAGE_OUTPUT_TYPE_ID,
|
|
29
29
|
keepOutput,
|
|
30
30
|
inputSchema: uploadFileSchema,
|
|
31
31
|
outputSchema: uploadFileSchema,
|
package/src/resize-node.ts
CHANGED
|
@@ -18,7 +18,7 @@ export function createResizeNode(
|
|
|
18
18
|
id,
|
|
19
19
|
name: "Resize",
|
|
20
20
|
description: "Resizes an image to the specified dimensions",
|
|
21
|
-
|
|
21
|
+
outputTypeId: STORAGE_OUTPUT_TYPE_ID,
|
|
22
22
|
keepOutput: options?.keepOutput,
|
|
23
23
|
transform: (inputBytes) =>
|
|
24
24
|
imageService.resize(inputBytes, { height, width, fit }),
|
|
@@ -73,7 +73,7 @@ export function createTransformImageNode(
|
|
|
73
73
|
id,
|
|
74
74
|
name: "Transform Image",
|
|
75
75
|
description: `Apply ${transformations.length} transformation${transformations.length === 1 ? "" : "s"} to the image`,
|
|
76
|
-
|
|
76
|
+
outputTypeId: STORAGE_OUTPUT_TYPE_ID,
|
|
77
77
|
keepOutput: options?.keepOutput,
|
|
78
78
|
transform: (inputBytes) =>
|
|
79
79
|
applyTransformationChain(imageService, inputBytes, transformations),
|