@uploadista/core 0.0.20 → 0.1.0-beta.5
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/{checksum-DVPe3Db4.cjs → checksum-CTpNXWEL.cjs} +1 -1
- package/dist/errors/index.cjs +1 -1
- package/dist/errors/index.d.mts +2 -2
- package/dist/flow/index.cjs +1 -1
- package/dist/flow/index.d.cts +2 -2
- package/dist/flow/index.d.mts +6 -6
- package/dist/flow/index.mjs +1 -1
- package/dist/flow-CA8xO6wP.mjs +2 -0
- package/dist/flow-CA8xO6wP.mjs.map +1 -0
- package/dist/flow-DKJaCPxL.cjs +1 -0
- package/dist/index-9gyMMEIB.d.cts.map +1 -1
- package/dist/{index-RuQUCROH.d.mts → index-BNhJmMuC.d.mts} +228 -167
- package/dist/index-BNhJmMuC.d.mts.map +1 -0
- package/dist/{index-DMqaf28W.d.cts → index-BmkhRBV6.d.cts} +226 -165
- package/dist/index-BmkhRBV6.d.cts.map +1 -0
- package/dist/{index-B9V5SSxl.d.mts → index-D8MZ6P3o.d.mts} +2 -2
- package/dist/{index-B9V5SSxl.d.mts.map → index-D8MZ6P3o.d.mts.map} +1 -1
- package/dist/{index-BFSHumky.d.mts → index-DQuMQssI.d.mts} +2 -2
- package/dist/{index-BFSHumky.d.mts.map → index-DQuMQssI.d.mts.map} +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.mts +6 -6
- package/dist/index.mjs +1 -1
- package/dist/{stream-limiter-BvkaZXcz.cjs → stream-limiter-DH0vv46_.cjs} +1 -1
- package/dist/streams/index.cjs +1 -1
- package/dist/streams/index.d.mts +2 -2
- package/dist/streams/index.mjs +1 -1
- package/dist/testing/index.cjs +2 -2
- package/dist/testing/index.d.cts +1 -1
- package/dist/testing/index.d.cts.map +1 -1
- package/dist/testing/index.d.mts +5 -5
- package/dist/testing/index.d.mts.map +1 -1
- package/dist/testing/index.mjs +2 -2
- package/dist/testing/index.mjs.map +1 -1
- package/dist/types/index.cjs +1 -1
- package/dist/types/index.d.cts +2 -2
- package/dist/types/index.d.mts +6 -6
- package/dist/types/index.mjs +1 -1
- package/dist/types-BF_tvkRh.cjs +1 -0
- package/dist/types-BRnwrJDg.mjs +2 -0
- package/dist/types-BRnwrJDg.mjs.map +1 -0
- package/dist/upload/index.cjs +1 -1
- package/dist/upload/index.d.cts +1 -1
- package/dist/upload/index.d.mts +5 -5
- package/dist/upload/index.mjs +1 -1
- package/dist/upload-CLHJ1SFS.cjs +1 -0
- package/dist/upload-CpsShjP3.mjs +2 -0
- package/dist/upload-CpsShjP3.mjs.map +1 -0
- package/dist/{uploadista-error-DR0XimpE.d.mts → uploadista-error-B1qbOy9N.d.mts} +1 -1
- package/dist/{uploadista-error-DR0XimpE.d.mts.map → uploadista-error-B1qbOy9N.d.mts.map} +1 -1
- package/dist/{uploadista-error-BgQU45we.cjs → uploadista-error-CLWoRAAr.cjs} +1 -1
- package/dist/uploadista-error-CkSxSyNo.mjs.map +1 -1
- package/dist/utils/index.cjs +1 -1
- package/dist/utils/index.d.mts +2 -2
- package/dist/utils/index.mjs +1 -1
- package/dist/{utils-UUJt8ILJ.cjs → utils-CvZJUNEo.cjs} +1 -1
- package/dist/{utils-B-ZhQ6b0.mjs → utils-DVwfrVBJ.mjs} +1 -1
- package/dist/utils-DVwfrVBJ.mjs.map +1 -0
- package/package.json +8 -8
- package/src/flow/circuit-breaker-store.ts +7 -8
- package/src/flow/flow.ts +6 -5
- package/src/flow/nodes/transform-node.ts +15 -1
- package/src/flow/plugins/image-plugin.ts +12 -3
- package/src/flow/plugins/video-plugin.ts +12 -3
- package/src/flow/types/flow-types.ts +75 -6
- package/src/flow/types/retry-policy.ts +5 -2
- package/src/flow/types/type-utils.ts +4 -6
- package/src/flow/utils/file-naming.ts +36 -11
- package/src/testing/mock-upload-engine.ts +18 -1
- package/src/types/circuit-breaker-store.ts +2 -2
- package/src/types/data-store.ts +4 -1
- package/src/types/kv-store.ts +13 -12
- package/src/types/upload-file.ts +29 -4
- package/src/upload/upload-chunk.ts +1 -1
- package/dist/flow-BHVkk_6W.cjs +0 -1
- package/dist/flow-DlhHOlMk.mjs +0 -2
- package/dist/flow-DlhHOlMk.mjs.map +0 -1
- package/dist/index-DMqaf28W.d.cts.map +0 -1
- package/dist/index-RuQUCROH.d.mts.map +0 -1
- package/dist/streams-BiD_pOPH.cjs +0 -0
- package/dist/streams-Cqjxk2rI.mjs +0 -1
- package/dist/types-Cws60JHC.cjs +0 -1
- package/dist/types-DKGQJIEr.mjs +0 -2
- package/dist/types-DKGQJIEr.mjs.map +0 -1
- package/dist/upload-C-C7hn1-.mjs +0 -2
- package/dist/upload-C-C7hn1-.mjs.map +0 -1
- package/dist/upload-DWBlRXHh.cjs +0 -1
- package/dist/utils-B-ZhQ6b0.mjs.map +0 -1
- /package/dist/{index-C-svZlpj.d.mts → index-DWe68pTi.d.mts} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require(`./types-
|
|
1
|
+
const e=require(`./types-BF_tvkRh.cjs`),t=require(`./uploadista-error-CLWoRAAr.cjs`);let n=require(`effect`);var r=class extends n.Context.Tag(`UploadistaGenerateIdService`)(){};const i=r.Service,a=r.of({generateId:()=>n.Effect.succeed(crypto.randomUUID())}),o=n.Layer.succeed(r,a),s=r.of({generateId:()=>n.Effect.succeed(`${Date.now()}-${Math.random().toString(36).slice(2,11)}`)}),c=[`sha256`];function l(e){return c.includes(e)}function u(e,r){return n.Effect.gen(function*(){if(!l(r))return yield*t.n.fromCode(`UNSUPPORTED_CHECKSUM_ALGORITHM`,{body:`Checksum algorithm '${r}' is not supported. Supported algorithms: ${c.join(`, `)}`,details:{algorithm:r,supportedAlgorithms:c}}).toEffect();let i=r.toUpperCase().replace(/\d+/,`-$&`),a=yield*n.Effect.tryPromise({try:()=>crypto.subtle.digest(i,e),catch:e=>t.n.fromCode(`UNKNOWN_ERROR`,{body:`Failed to compute checksum: ${e instanceof Error?e.message:`Unknown error`}`,cause:e,details:{algorithm:r}})});return Array.from(new Uint8Array(a)).map(e=>e.toString(16).padStart(2,`0`)).join(``)})}Object.defineProperty(exports,`a`,{enumerable:!0,get:function(){return a}}),Object.defineProperty(exports,`i`,{enumerable:!0,get:function(){return o}}),Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return l}}),Object.defineProperty(exports,`o`,{enumerable:!0,get:function(){return i}}),Object.defineProperty(exports,`r`,{enumerable:!0,get:function(){return r}}),Object.defineProperty(exports,`s`,{enumerable:!0,get:function(){return s}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return u}});
|
package/dist/errors/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require(`../uploadista-error-
|
|
1
|
+
const e=require(`../uploadista-error-CLWoRAAr.cjs`);require(`../errors-CRm1FHHT.cjs`),exports.ERRORS=e.t,exports.ERROR_CATALOG=e.t,exports.UploadistaError=e.n,exports.httpFailure=e.r,exports.isUploadistaError=e.i;
|
package/dist/errors/index.d.mts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { a as isUploadistaError, i as httpFailure, n as UploadistaError, r as UploadistaErrorCode, t as ERROR_CATALOG } from "../uploadista-error-
|
|
2
|
-
import "../index-
|
|
1
|
+
import { a as isUploadistaError, i as httpFailure, n as UploadistaError, r as UploadistaErrorCode, t as ERROR_CATALOG } from "../uploadista-error-B1qbOy9N.mjs";
|
|
2
|
+
import "../index-DWe68pTi.mjs";
|
|
3
3
|
export { ERROR_CATALOG as ERRORS, ERROR_CATALOG, UploadistaError, UploadistaErrorCode, httpFailure, isUploadistaError };
|
package/dist/flow/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require(`../types-
|
|
1
|
+
const e=require(`../types-BF_tvkRh.cjs`);require(`../uploadista-error-CLWoRAAr.cjs`),require(`../errors-CRm1FHHT.cjs`);const t=require(`../flow-DKJaCPxL.cjs`);require(`../upload-CLHJ1SFS.cjs`),require(`../checksum-CTpNXWEL.cjs`),require(`../stream-limiter-DH0vv46_.cjs`),exports.AVAILABLE_TEMPLATE_VARIABLES=t.F,exports.CredentialProvider=t.N,exports.DEFAULT_CIRCUIT_BREAKER_CONFIG=t.Yt,exports.DEFAULT_RETRY_POLICY=t.pt,exports.DEFAULT_STREAMING_CONFIG=e.b,exports.DeadLetterQueueService=t.ut,exports.DistributedCircuitBreaker=t.Ut,exports.DistributedCircuitBreakerRegistry=t.Wt,exports.DocumentAiPlugin=t.M,exports.DocumentPlugin=t.j,exports.EventType=t.Vt,exports.FlowEngine=t.H,exports.FlowProvider=t.U,exports.FlowWaitUntil=t.W,exports.IMAGE_DESCRIPTION_OUTPUT_TYPE_ID=t._t,exports.ImageAiPlugin=t.A,exports.ImagePlugin=t.k,exports.InputTypeRegistry=t.Rt,exports.NodeType=t.Mt,exports.OCR_OUTPUT_TYPE_ID=t.vt,exports.OutputTypeRegistry=t.Ft,exports.ParallelScheduler=t.lt,exports.STORAGE_OUTPUT_TYPE_ID=t.yt,exports.STREAMING_INPUT_TYPE_ID=t.bt,exports.VideoPlugin=t.a,exports.VirusScanPlugin=t.i,exports.ZipPlugin=t.r,exports.applyFileNaming=t.I,exports.blurTransformSchema=t.s,exports.brightnessTransformSchema=t.c,exports.buildNamingContext=t.L,exports.calculateBackoffDelay=t.mt,exports.calculateExpirationDate=t.ht,exports.completeNodeExecution=t.Dt,exports.contrastTransformSchema=t.l,exports.createDeadLetterQueueService=t.dt,exports.createFlow=t.n,exports.createFlowEdge=t.Ht,exports.createFlowEngine=t.G,exports.createFlowNode=t.Nt,exports.createFlowWithSchema=t.q,exports.createInputNode=t.Ct,exports.createOutputGuard=t.Ot,exports.createTransformNode=t.P,exports.createTypeGuard=t.Y,exports.deadLetterQueueService=t.ft,exports.describeImageParamsSchema=t.O,exports.describeVideoMetadataSchema=t.D,exports.extractFrameVideoParamsSchema=t.E,exports.filterOutputsByType=t.X,exports.flipTransformSchema=t.u,exports.flowEngine=t.K,exports.getBaseName=t.R,exports.getExtension=t.z,exports.getFirstOutputByType=t.Z,exports.getFlowData=t.J,exports.getNodeData=t.Pt,exports.getOutputByNodeId=t.Q,exports.getSingleOutputByType=t.$,exports.grayscaleTransformSchema=t.d,exports.hasOutputOfType=t.et,exports.imageDescriptionOutputSchema=t.xt,exports.inputDataSchema=t.wt,exports.inputNodeParamsSchema=t.Tt,exports.inputTypeRegistry=t.zt,exports.interpolateFileName=t.B,exports.isErrorRetryable=t.gt,exports.isFinalizeOperation=t.tt,exports.isImageDescriptionOutput=t.nt,exports.isInitOperation=t.rt,exports.isOcrOutput=t.it,exports.isStorageOutput=t.at,exports.isStorageOutputV1=t.kt,exports.isStreamingInputV1=t.At,exports.isUploadFile=t.ot,exports.isUploadOperation=t.st,exports.isUrlOperation=t.ct,exports.kvCircuitBreakerStoreLayer=t.Gt,exports.logoTransformSchema=t.f,exports.makeKvCircuitBreakerStore=t.Kt,exports.makeMemoryCircuitBreakerStore=t.qt,exports.memoryCircuitBreakerStoreLayer=t.Jt,exports.ocrOutputSchema=t.St,exports.optimizeParamsSchema=t.T,exports.outputTypeRegistry=t.It,exports.removeBackgroundParamsSchema=t.w,exports.resizeParamsSchema=t.C,exports.resizeTransformSchema=t.p,exports.resizeVideoParamsSchema=t.S,exports.resolveUploadMetadata=t.Et,exports.rotateTransformSchema=t.m,exports.runArgsSchema=t.t,exports.sepiaTransformSchema=t.h,exports.sharpenTransformSchema=t.g,exports.textTransformSchema=t._,exports.transcodeVideoParamsSchema=t.x,exports.transformImageParamsSchema=t.v,exports.transformationSchema=t.y,exports.trimVideoParamsSchema=t.o,exports.validateFlowInput=t.Bt,exports.validateFlowOutput=t.Lt,exports.validatePattern=t.V,exports.waitingNodeExecution=t.jt,exports.watermarkTransformSchema=t.b;
|
package/dist/flow/index.d.cts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { $ as VideoPlugin, $a as
|
|
2
|
-
export { AVAILABLE_TEMPLATE_VARIABLES, AllowRequestResult, AutoNamingSuffixGenerator, BackoffStrategy, BlurTransform, BrightnessTransform, BuiltInTypedOutput, CircuitBreakerConfig, CircuitBreakerEvent, CircuitBreakerEventHandler, CircuitBreakerFallback, CircuitBreakerState, ConditionField, ConditionOperator, ConditionValue, ContrastTransform, CredentialProvider, CredentialProviderLayer, CredentialProviderShape, CustomTypedOutput, DEFAULT_CIRCUIT_BREAKER_CONFIG, DEFAULT_RETRY_POLICY, DEFAULT_STREAMING_CONFIG, DeadLetterCleanupOptions, DeadLetterCleanupResult, DeadLetterError, DeadLetterItem, DeadLetterItemStatus, DeadLetterListOptions, DeadLetterProcessResult, DeadLetterQueueService, DeadLetterQueueServiceShape, DeadLetterQueueStats, DeadLetterRetryAllResult, DeadLetterRetryAttempt, DescribeImageParams, DescribeVideoMetadata, DistributedCircuitBreaker, DistributedCircuitBreakerRegistry, DlqEvent, DocumentAiContext, DocumentAiPlugin, DocumentAiPluginLayer, DocumentAiPluginShape, DocumentMetadata, DocumentPlugin, DocumentPluginLayer, DocumentPluginShape, EventType, ExecutionLevel, ExponentialBackoff, ExtractEffectError, ExtractEffectRequirements, ExtractFrameVideoParams, ExtractLayerService, ExtractLayerServices, FileNamingConfig, FileNamingFunction, FixedBackoff, FlipTransform, Flow, FlowCircuitBreakerConfig, FlowCircuitBreakerFallback, FlowCondition, FlowConfig, FlowData, FlowDeadLetterQueueConfig, FlowEdge, FlowEngine, FlowEngineLayer, FlowEngineOptions, FlowEngineShape, FlowEvent, FlowEventDlqItemAdded, FlowEventDlqItemExhausted, FlowEventDlqItemResolved, FlowEventDlqRetryFailed, FlowEventDlqRetryStart, FlowEventDlqRetrySuccess, FlowEventFlowCancel, FlowEventFlowEnd, FlowEventFlowError, FlowEventFlowPause, FlowEventFlowStart, FlowEventJobEnd, FlowEventJobStart, FlowEventNodeEnd, FlowEventNodeError, FlowEventNodePause, FlowEventNodeResponse, FlowEventNodeResume, FlowEventNodeStart, FlowExecutionResult, FlowInputMap, FlowJob, FlowJobStatus, FlowJobTask, FlowJobTaskStatus, FlowJobTraceContext, FlowNode, FlowNodeData, FlowOutputMap, FlowPluginRequirements, FlowProvider, FlowProviderShape, FlowRequirements, FlowWaitUntil, GrayscaleTransform, IMAGE_DESCRIPTION_OUTPUT_TYPE_ID, ImageAiContext, ImageAiPlugin, ImageAiPluginLayer, ImageAiPluginShape, ImageDescriptionOutput, ImagePlugin, ImagePluginLayer, ImagePluginShape, ImmediateBackoff, InputData, InputNodeParams, InputTypeDefinition, InputTypeRegistry, InputValidationResult, LogoTransform, MergePdfParams, NamingContext, NarrowedTypedOutput, NodeConnectionValidator, NodeDefinition, NodeDefinitionsRecord, NodeExecutionResult, NodeType, NodeTypeMap, OCR_OUTPUT_TYPE_ID, OcrOutput, OcrParams, OcrResolution, OcrResult, OcrTaskType, OptimizeParams, OutputTypeDefinition, OutputTypeRegistry, OutputValidationResult, OverlayPosition, ParallelScheduler, ParallelSchedulerConfig, Plugin, PluginLayer, RemoveBackgroundParams, ResizeParams, ResizeTransform, ResizeVideoParams, ResolveEffect, ResolvedUploadMetadata, RetryPolicy, RotateTransform, RunArgs, STORAGE_OUTPUT_TYPE_ID, STREAMING_INPUT_TYPE_ID, ScanMetadata, ScanResult, SepiaTransform, SharpenTransform, SplitPdfParams, SplitPdfResult, StreamingConfig, StreamingTransformFn, StreamingTransformResult, TextTransform, TranscodeVideoParams, TransformImageParams, TransformMode, TransformNodeConfig, Transformation, TransformationType, TrimVideoParams, TypeCompatibilityChecker, TypedFlow, TypedFlowConfig, TypedFlowEdge, TypedOutput, VideoPlugin, VideoPluginLayer, VideoPluginShape, VideoStreamInput, VideoStreamOptions, VirusScanPlugin, VirusScanPluginLayer, VirusScanPluginShape, WaitUntilCallback, WatermarkTransform, ZipInput, ZipParams, ZipPlugin, ZipPluginLayer, ZipPluginShape, applyFileNaming, blurTransformSchema, brightnessTransformSchema, buildNamingContext, calculateBackoffDelay, calculateExpirationDate, completeNodeExecution, contrastTransformSchema, createDeadLetterQueueService, createFlow, createFlowEdge, createFlowEngine, createFlowNode, createFlowWithSchema, createInputNode, createTransformNode, createTypeGuard, deadLetterQueueService, describeImageParamsSchema, describeVideoMetadataSchema, extractFrameVideoParamsSchema, filterOutputsByType, flipTransformSchema, flowEngine, getBaseName, getExtension, getFirstOutputByType, getFlowData, getNodeData, getOutputByNodeId, getSingleOutputByType, grayscaleTransformSchema, hasOutputOfType, imageDescriptionOutputSchema, inputDataSchema, inputNodeParamsSchema, inputTypeRegistry, interpolateFileName, isErrorRetryable, isFinalizeOperation, isImageDescriptionOutput, isInitOperation, isOcrOutput, isStorageOutput, isUploadFile, isUploadOperation, isUrlOperation, kvCircuitBreakerStoreLayer, logoTransformSchema, makeKvCircuitBreakerStore, makeMemoryCircuitBreakerStore, memoryCircuitBreakerStoreLayer, ocrOutputSchema, optimizeParamsSchema, outputTypeRegistry, removeBackgroundParamsSchema, resizeParamsSchema, resizeTransformSchema, resizeVideoParamsSchema, resolveUploadMetadata, rotateTransformSchema, runArgsSchema, sepiaTransformSchema, sharpenTransformSchema, textTransformSchema, transcodeVideoParamsSchema, transformImageParamsSchema, transformationSchema, trimVideoParamsSchema, validateFlowInput, validateFlowOutput, validatePattern, waitingNodeExecution, watermarkTransformSchema };
|
|
1
|
+
import { $ as VideoPlugin, $a as AllowRequestResult, $i as FlowConfig, $r as DeadLetterListOptions, $t as ImageAiPluginLayer, A as isImageDescriptionOutput, Aa as FlowEventDlqItemResolved, An as ExtractLayerServices, Ao as CircuitBreakerEventHandler, At as Transformation, B as describeImageParamsSchema, Ba as FlowEventJobStart, Bn as FlowEngineOptions, Br as DeadLetterQueueServiceShape, Bt as rotateTransformSchema, C as createTypeGuard, Ca as calculateExpirationDate, Ci as FlowData, Cn as StreamingTransformResult, Ct as OverlayPosition, D as getSingleOutputByType, Da as FlowEvent, Dn as ExtractEffectError, Dt as SharpenTransform, E as getOutputByNodeId, Ea as EventType, Ei as getFlowData, En as createTransformNode, Et as SepiaTransform, F as isUploadOperation, Fa as FlowEventFlowEnd, Fn as createInputNode, Ft as contrastTransformSchema, G as ZipPlugin, Ga as FlowEventNodeResume, Gi as AutoNamingSuffixGenerator, Gn as WaitUntilCallback, Gr as FlowJobTask, Gt as transformationSchema, H as PluginLayer, Ha as FlowEventNodeError, Hn as FlowProvider, Hr as deadLetterQueueService, Ht as sharpenTransformSchema, I as isUrlOperation, Ia as FlowEventFlowError, Ii as StreamingConfig, In as inputDataSchema, It as flipTransformSchema, J as ScanMetadata, Ja as ConditionOperator, Ji as CustomTypedOutput, Jr as DeadLetterCleanupOptions, Jt as resizeParamsSchema, K as ZipPluginLayer, Ka as FlowEventNodeStart, Ki as BuiltInNodeType, Kn as createFlowEngine, Kr as FlowJobTaskStatus, Kt as watermarkTransformSchema, L as RemoveBackgroundParams, La as FlowEventFlowPause, Ln as inputNodeParamsSchema, Lt as grayscaleTransformSchema, M as isOcrOutput, Ma as FlowEventDlqRetryStart, Mn as FlowCondition, Mo as CircuitBreakerState, Mt as WatermarkTransform, N as isStorageOutput, Na as FlowEventDlqRetrySuccess, Nn as InputData, No as DEFAULT_CIRCUIT_BREAKER_CONFIG, Nt as blurTransformSchema, O as hasOutputOfType, Oa as FlowEventDlqItemAdded, On as ExtractEffectRequirements, Oo as CircuitBreakerConfig, Ot as TextTransform, P as isUploadFile, Pa as FlowEventFlowCancel, Pn as InputNodeParams, Pt as brightnessTransformSchema, Q as VirusScanPluginShape, Qa as getNodeData, Qi as FlowCircuitBreakerFallback, Qr as DeadLetterItemStatus, Qt as ImageAiPlugin, R as removeBackgroundParamsSchema, Ra as FlowEventFlowStart, Rn as FlowEngine, Rt as logoTransformSchema, S as NarrowedTypedOutput, Sa as calculateBackoffDelay, Si as Flow, Sn as StreamingTransformFn, St as LogoTransform, T as getFirstOutputByType, Ta as DlqEvent, Ti as createFlowWithSchema, Tn as TransformNodeConfig, Tt as RotateTransform, U as ZipInput, Ua as FlowEventNodePause, Ui as FlowEdge, Un as FlowProviderShape, Ur as FlowJob, Ut as textTransformSchema, V as Plugin, Va as FlowEventNodeEnd, Vn as FlowEngineShape, Vr as createDeadLetterQueueService, Vt as sepiaTransformSchema, W as ZipParams, Wa as FlowEventNodeResponse, Wi as createFlowEdge, Wn as FlowWaitUntil, Wr as FlowJobStatus, Wt as transformImageParamsSchema, X as VirusScanPlugin, Xa as NodeType, Xi as FileNamingFunction, Xr as DeadLetterError, Xt as optimizeParamsSchema, Y as ScanResult, Ya as ConditionValue, Yi as FileNamingConfig, Yr as DeadLetterCleanupResult, Yt as OptimizeParams, Z as VirusScanPluginLayer, Za as createFlowNode, Zi as FlowCircuitBreakerConfig, Zr as DeadLetterItem, Zt as ImageAiContext, _ as NodeDefinitionsRecord, _a as DEFAULT_RETRY_POLICY, _i as InputTypeDefinition, _n as CredentialProviderLayer, _t as BlurTransform, a as buildNamingContext, aa as NodeConnectionValidator, ai as ImageDescriptionOutput, an as MergePdfParams, ao as memoryCircuitBreakerStoreLayer, at as trimVideoParamsSchema, b as TypedFlowEdge, ba as ImmediateBackoff, bi as inputTypeRegistry, bn as ParallelScheduler, bt as FlipTransform, c as interpolateFileName, ca as TypeCompatibilityChecker, ci as STORAGE_OUTPUT_TYPE_ID, cn as DocumentAiContext, ct as ResizeVideoParams, d as runArgsSchema, da as completeNodeExecution, di as ocrOutputSchema, dn as DocumentAiPluginShape, dt as extractFrameVideoParamsSchema, ea as FlowDeadLetterQueueConfig, ei as DeadLetterProcessResult, en as ImageAiPluginShape, eo as DistributedCircuitBreaker, et as VideoPluginLayer, f as FlowInputMap, fa as createOutputGuard, fi as OutputTypeDefinition, fn as OcrParams, ft as DescribeVideoMetadata, g as NodeDefinition, ga as BackoffStrategy, gi as validateFlowOutput, gn as CredentialProvider, gt as ImagePluginShape, h as FlowRequirements, ha as waitingNodeExecution, hi as outputTypeRegistry, hn as OcrTaskType, ht as ImagePluginLayer, i as applyFileNaming, ia as NarrowTypedOutput, ii as IMAGE_DESCRIPTION_OUTPUT_TYPE_ID, in as DocumentPluginShape, io as makeMemoryCircuitBreakerStore, it as TrimVideoParams, j as isInitOperation, ja as FlowEventDlqRetryFailed, jn as ResolveEffect, jo as CircuitBreakerFallback, jt as TransformationType, k as isFinalizeOperation, ka as FlowEventDlqItemExhausted, ki as DEFAULT_STREAMING_CONFIG, kn as ExtractLayerService, ko as CircuitBreakerEvent, kt as TransformImageParams, l as validatePattern, la as TypedOutput, li as STREAMING_INPUT_TYPE_ID, ln as DocumentAiPlugin, lt as resizeVideoParamsSchema, m as FlowPluginRequirements, ma as isStreamingInputV1, mi as OutputValidationResult, mn as OcrResult, mt as ImagePlugin, n as resolveUploadMetadata, na as FlowNodeData, ni as DeadLetterRetryAllResult, nn as DocumentPlugin, no as kvCircuitBreakerStoreLayer, nt as VideoStreamInput, o as getBaseName, oa as NodeExecutionResult, oi as OCR_OUTPUT_TYPE_ID, on as SplitPdfParams, ot as TranscodeVideoParams, p as FlowOutputMap, pa as isStorageOutputV1, pi as OutputTypeRegistry, pn as OcrResolution, pt as describeVideoMetadataSchema, q as ZipPluginShape, qa as ConditionField, qi as BuiltInTypedOutput, qn as flowEngine, qr as FlowJobTraceContext, qt as ResizeParams, r as AVAILABLE_TEMPLATE_VARIABLES, ra as NamingContext, ri as DeadLetterRetryAttempt, rn as DocumentPluginLayer, ro as makeKvCircuitBreakerStore, rt as VideoStreamOptions, s as getExtension, sa as NodeTypeMap, si as OcrOutput, sn as SplitPdfResult, st as transcodeVideoParamsSchema, t as ResolvedUploadMetadata, ta as FlowNode, ti as DeadLetterQueueStats, tn as DocumentMetadata, to as DistributedCircuitBreakerRegistry, tt as VideoPluginShape, u as RunArgs, ua as TypedOutputGuard, ui as imageDescriptionOutputSchema, un as DocumentAiPluginLayer, ut as ExtractFrameVideoParams, v as TypedFlow, va as ExponentialBackoff, vi as InputTypeRegistry, vn as CredentialProviderShape, vt as BrightnessTransform, w as filterOutputsByType, wa as isErrorRetryable, wi as FlowExecutionResult, wn as TransformMode, wt as ResizeTransform, x as createFlow, xa as RetryPolicy, xi as validateFlowInput, xn as ParallelSchedulerConfig, xt as GrayscaleTransform, y as TypedFlowConfig, ya as FixedBackoff, yi as InputValidationResult, yn as ExecutionLevel, yt as ContrastTransform, z as DescribeImageParams, za as FlowEventJobEnd, zn as FlowEngineLayer, zr as DeadLetterQueueService, zt as resizeTransformSchema } from "../index-BmkhRBV6.cjs";
|
|
2
|
+
export { AVAILABLE_TEMPLATE_VARIABLES, AllowRequestResult, AutoNamingSuffixGenerator, BackoffStrategy, BlurTransform, BrightnessTransform, BuiltInNodeType, BuiltInTypedOutput, CircuitBreakerConfig, CircuitBreakerEvent, CircuitBreakerEventHandler, CircuitBreakerFallback, CircuitBreakerState, ConditionField, ConditionOperator, ConditionValue, ContrastTransform, CredentialProvider, CredentialProviderLayer, CredentialProviderShape, CustomTypedOutput, DEFAULT_CIRCUIT_BREAKER_CONFIG, DEFAULT_RETRY_POLICY, DEFAULT_STREAMING_CONFIG, DeadLetterCleanupOptions, DeadLetterCleanupResult, DeadLetterError, DeadLetterItem, DeadLetterItemStatus, DeadLetterListOptions, DeadLetterProcessResult, DeadLetterQueueService, DeadLetterQueueServiceShape, DeadLetterQueueStats, DeadLetterRetryAllResult, DeadLetterRetryAttempt, DescribeImageParams, DescribeVideoMetadata, DistributedCircuitBreaker, DistributedCircuitBreakerRegistry, DlqEvent, DocumentAiContext, DocumentAiPlugin, DocumentAiPluginLayer, DocumentAiPluginShape, DocumentMetadata, DocumentPlugin, DocumentPluginLayer, DocumentPluginShape, EventType, ExecutionLevel, ExponentialBackoff, ExtractEffectError, ExtractEffectRequirements, ExtractFrameVideoParams, ExtractLayerService, ExtractLayerServices, FileNamingConfig, FileNamingFunction, FixedBackoff, FlipTransform, Flow, FlowCircuitBreakerConfig, FlowCircuitBreakerFallback, FlowCondition, FlowConfig, FlowData, FlowDeadLetterQueueConfig, FlowEdge, FlowEngine, FlowEngineLayer, FlowEngineOptions, FlowEngineShape, FlowEvent, FlowEventDlqItemAdded, FlowEventDlqItemExhausted, FlowEventDlqItemResolved, FlowEventDlqRetryFailed, FlowEventDlqRetryStart, FlowEventDlqRetrySuccess, FlowEventFlowCancel, FlowEventFlowEnd, FlowEventFlowError, FlowEventFlowPause, FlowEventFlowStart, FlowEventJobEnd, FlowEventJobStart, FlowEventNodeEnd, FlowEventNodeError, FlowEventNodePause, FlowEventNodeResponse, FlowEventNodeResume, FlowEventNodeStart, FlowExecutionResult, FlowInputMap, FlowJob, FlowJobStatus, FlowJobTask, FlowJobTaskStatus, FlowJobTraceContext, FlowNode, FlowNodeData, FlowOutputMap, FlowPluginRequirements, FlowProvider, FlowProviderShape, FlowRequirements, FlowWaitUntil, GrayscaleTransform, IMAGE_DESCRIPTION_OUTPUT_TYPE_ID, ImageAiContext, ImageAiPlugin, ImageAiPluginLayer, ImageAiPluginShape, ImageDescriptionOutput, ImagePlugin, ImagePluginLayer, ImagePluginShape, ImmediateBackoff, InputData, InputNodeParams, InputTypeDefinition, InputTypeRegistry, InputValidationResult, LogoTransform, MergePdfParams, NamingContext, NarrowTypedOutput, NarrowedTypedOutput, NodeConnectionValidator, NodeDefinition, NodeDefinitionsRecord, NodeExecutionResult, NodeType, NodeTypeMap, OCR_OUTPUT_TYPE_ID, OcrOutput, OcrParams, OcrResolution, OcrResult, OcrTaskType, OptimizeParams, OutputTypeDefinition, OutputTypeRegistry, OutputValidationResult, OverlayPosition, ParallelScheduler, ParallelSchedulerConfig, Plugin, PluginLayer, RemoveBackgroundParams, ResizeParams, ResizeTransform, ResizeVideoParams, ResolveEffect, ResolvedUploadMetadata, RetryPolicy, RotateTransform, RunArgs, STORAGE_OUTPUT_TYPE_ID, STREAMING_INPUT_TYPE_ID, ScanMetadata, ScanResult, SepiaTransform, SharpenTransform, SplitPdfParams, SplitPdfResult, StreamingConfig, StreamingTransformFn, StreamingTransformResult, TextTransform, TranscodeVideoParams, TransformImageParams, TransformMode, TransformNodeConfig, Transformation, TransformationType, TrimVideoParams, TypeCompatibilityChecker, TypedFlow, TypedFlowConfig, TypedFlowEdge, TypedOutput, TypedOutputGuard, VideoPlugin, VideoPluginLayer, VideoPluginShape, VideoStreamInput, VideoStreamOptions, VirusScanPlugin, VirusScanPluginLayer, VirusScanPluginShape, WaitUntilCallback, WatermarkTransform, ZipInput, ZipParams, ZipPlugin, ZipPluginLayer, ZipPluginShape, applyFileNaming, blurTransformSchema, brightnessTransformSchema, buildNamingContext, calculateBackoffDelay, calculateExpirationDate, completeNodeExecution, contrastTransformSchema, createDeadLetterQueueService, createFlow, createFlowEdge, createFlowEngine, createFlowNode, createFlowWithSchema, createInputNode, createOutputGuard, createTransformNode, createTypeGuard, deadLetterQueueService, describeImageParamsSchema, describeVideoMetadataSchema, extractFrameVideoParamsSchema, filterOutputsByType, flipTransformSchema, flowEngine, getBaseName, getExtension, getFirstOutputByType, getFlowData, getNodeData, getOutputByNodeId, getSingleOutputByType, grayscaleTransformSchema, hasOutputOfType, imageDescriptionOutputSchema, inputDataSchema, inputNodeParamsSchema, inputTypeRegistry, interpolateFileName, isErrorRetryable, isFinalizeOperation, isImageDescriptionOutput, isInitOperation, isOcrOutput, isStorageOutput, isStorageOutputV1, isStreamingInputV1, isUploadFile, isUploadOperation, isUrlOperation, kvCircuitBreakerStoreLayer, logoTransformSchema, makeKvCircuitBreakerStore, makeMemoryCircuitBreakerStore, memoryCircuitBreakerStoreLayer, ocrOutputSchema, optimizeParamsSchema, outputTypeRegistry, removeBackgroundParamsSchema, resizeParamsSchema, resizeTransformSchema, resizeVideoParamsSchema, resolveUploadMetadata, rotateTransformSchema, runArgsSchema, sepiaTransformSchema, sharpenTransformSchema, textTransformSchema, transcodeVideoParamsSchema, transformImageParamsSchema, transformationSchema, trimVideoParamsSchema, validateFlowInput, validateFlowOutput, validatePattern, waitingNodeExecution, watermarkTransformSchema };
|
package/dist/flow/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import "../uploadista-error-
|
|
2
|
-
import "../index-
|
|
3
|
-
import { $ as VideoPlugin, $a as
|
|
4
|
-
import "../index-
|
|
5
|
-
import "../index-
|
|
6
|
-
export { AVAILABLE_TEMPLATE_VARIABLES, AllowRequestResult, AutoNamingSuffixGenerator, BackoffStrategy, BlurTransform, BrightnessTransform, BuiltInTypedOutput, CircuitBreakerConfig, CircuitBreakerEvent, CircuitBreakerEventHandler, CircuitBreakerFallback, CircuitBreakerState, ConditionField, ConditionOperator, ConditionValue, ContrastTransform, CredentialProvider, CredentialProviderLayer, CredentialProviderShape, CustomTypedOutput, DEFAULT_CIRCUIT_BREAKER_CONFIG, DEFAULT_RETRY_POLICY, DEFAULT_STREAMING_CONFIG, DeadLetterCleanupOptions, DeadLetterCleanupResult, DeadLetterError, DeadLetterItem, DeadLetterItemStatus, DeadLetterListOptions, DeadLetterProcessResult, DeadLetterQueueService, DeadLetterQueueServiceShape, DeadLetterQueueStats, DeadLetterRetryAllResult, DeadLetterRetryAttempt, DescribeImageParams, DescribeVideoMetadata, DistributedCircuitBreaker, DistributedCircuitBreakerRegistry, DlqEvent, DocumentAiContext, DocumentAiPlugin, DocumentAiPluginLayer, DocumentAiPluginShape, DocumentMetadata, DocumentPlugin, DocumentPluginLayer, DocumentPluginShape, EventType, ExecutionLevel, ExponentialBackoff, ExtractEffectError, ExtractEffectRequirements, ExtractFrameVideoParams, ExtractLayerService, ExtractLayerServices, FileNamingConfig, FileNamingFunction, FixedBackoff, FlipTransform, Flow, FlowCircuitBreakerConfig, FlowCircuitBreakerFallback, FlowCondition, FlowConfig, FlowData, FlowDeadLetterQueueConfig, FlowEdge, FlowEngine, FlowEngineLayer, FlowEngineOptions, FlowEngineShape, FlowEvent, FlowEventDlqItemAdded, FlowEventDlqItemExhausted, FlowEventDlqItemResolved, FlowEventDlqRetryFailed, FlowEventDlqRetryStart, FlowEventDlqRetrySuccess, FlowEventFlowCancel, FlowEventFlowEnd, FlowEventFlowError, FlowEventFlowPause, FlowEventFlowStart, FlowEventJobEnd, FlowEventJobStart, FlowEventNodeEnd, FlowEventNodeError, FlowEventNodePause, FlowEventNodeResponse, FlowEventNodeResume, FlowEventNodeStart, FlowExecutionResult, FlowInputMap, FlowJob, FlowJobStatus, FlowJobTask, FlowJobTaskStatus, FlowJobTraceContext, FlowNode, FlowNodeData, FlowOutputMap, FlowPluginRequirements, FlowProvider, FlowProviderShape, FlowRequirements, FlowWaitUntil, GrayscaleTransform, IMAGE_DESCRIPTION_OUTPUT_TYPE_ID, ImageAiContext, ImageAiPlugin, ImageAiPluginLayer, ImageAiPluginShape, ImageDescriptionOutput, ImagePlugin, ImagePluginLayer, ImagePluginShape, ImmediateBackoff, InputData, InputNodeParams, InputTypeDefinition, InputTypeRegistry, InputValidationResult, LogoTransform, MergePdfParams, NamingContext, NarrowedTypedOutput, NodeConnectionValidator, NodeDefinition, NodeDefinitionsRecord, NodeExecutionResult, NodeType, NodeTypeMap, OCR_OUTPUT_TYPE_ID, OcrOutput, OcrParams, OcrResolution, OcrResult, OcrTaskType, OptimizeParams, OutputTypeDefinition, OutputTypeRegistry, OutputValidationResult, OverlayPosition, ParallelScheduler, ParallelSchedulerConfig, Plugin, PluginLayer, RemoveBackgroundParams, ResizeParams, ResizeTransform, ResizeVideoParams, ResolveEffect, ResolvedUploadMetadata, RetryPolicy, RotateTransform, RunArgs, STORAGE_OUTPUT_TYPE_ID, STREAMING_INPUT_TYPE_ID, ScanMetadata, ScanResult, SepiaTransform, SharpenTransform, SplitPdfParams, SplitPdfResult, StreamingConfig, StreamingTransformFn, StreamingTransformResult, TextTransform, TranscodeVideoParams, TransformImageParams, TransformMode, TransformNodeConfig, Transformation, TransformationType, TrimVideoParams, TypeCompatibilityChecker, TypedFlow, TypedFlowConfig, TypedFlowEdge, TypedOutput, VideoPlugin, VideoPluginLayer, VideoPluginShape, VideoStreamInput, VideoStreamOptions, VirusScanPlugin, VirusScanPluginLayer, VirusScanPluginShape, WaitUntilCallback, WatermarkTransform, ZipInput, ZipParams, ZipPlugin, ZipPluginLayer, ZipPluginShape, applyFileNaming, blurTransformSchema, brightnessTransformSchema, buildNamingContext, calculateBackoffDelay, calculateExpirationDate, completeNodeExecution, contrastTransformSchema, createDeadLetterQueueService, createFlow, createFlowEdge, createFlowEngine, createFlowNode, createFlowWithSchema, createInputNode, createTransformNode, createTypeGuard, deadLetterQueueService, describeImageParamsSchema, describeVideoMetadataSchema, extractFrameVideoParamsSchema, filterOutputsByType, flipTransformSchema, flowEngine, getBaseName, getExtension, getFirstOutputByType, getFlowData, getNodeData, getOutputByNodeId, getSingleOutputByType, grayscaleTransformSchema, hasOutputOfType, imageDescriptionOutputSchema, inputDataSchema, inputNodeParamsSchema, inputTypeRegistry, interpolateFileName, isErrorRetryable, isFinalizeOperation, isImageDescriptionOutput, isInitOperation, isOcrOutput, isStorageOutput, isUploadFile, isUploadOperation, isUrlOperation, kvCircuitBreakerStoreLayer, logoTransformSchema, makeKvCircuitBreakerStore, makeMemoryCircuitBreakerStore, memoryCircuitBreakerStoreLayer, ocrOutputSchema, optimizeParamsSchema, outputTypeRegistry, removeBackgroundParamsSchema, resizeParamsSchema, resizeTransformSchema, resizeVideoParamsSchema, resolveUploadMetadata, rotateTransformSchema, runArgsSchema, sepiaTransformSchema, sharpenTransformSchema, textTransformSchema, transcodeVideoParamsSchema, transformImageParamsSchema, transformationSchema, trimVideoParamsSchema, validateFlowInput, validateFlowOutput, validatePattern, waitingNodeExecution, watermarkTransformSchema };
|
|
1
|
+
import "../uploadista-error-B1qbOy9N.mjs";
|
|
2
|
+
import "../index-DWe68pTi.mjs";
|
|
3
|
+
import { $ as VideoPlugin, $a as AllowRequestResult, $i as FlowConfig, $r as DeadLetterListOptions, $t as ImageAiPluginLayer, A as isImageDescriptionOutput, Aa as FlowEventDlqItemResolved, An as ExtractLayerServices, Ao as CircuitBreakerEventHandler, At as Transformation, B as describeImageParamsSchema, Ba as FlowEventJobStart, Bn as FlowEngineOptions, Br as DeadLetterQueueServiceShape, Bt as rotateTransformSchema, C as createTypeGuard, Ca as calculateExpirationDate, Ci as FlowData, Cn as StreamingTransformResult, Ct as OverlayPosition, D as getSingleOutputByType, Da as FlowEvent, Dn as ExtractEffectError, Dt as SharpenTransform, E as getOutputByNodeId, Ea as EventType, Ei as getFlowData, En as createTransformNode, Et as SepiaTransform, F as isUploadOperation, Fa as FlowEventFlowEnd, Fn as createInputNode, Ft as contrastTransformSchema, G as ZipPlugin, Ga as FlowEventNodeResume, Gi as AutoNamingSuffixGenerator, Gn as WaitUntilCallback, Gr as FlowJobTask, Gt as transformationSchema, H as PluginLayer, Ha as FlowEventNodeError, Hn as FlowProvider, Hr as deadLetterQueueService, Ht as sharpenTransformSchema, I as isUrlOperation, Ia as FlowEventFlowError, Ii as StreamingConfig, In as inputDataSchema, It as flipTransformSchema, J as ScanMetadata, Ja as ConditionOperator, Ji as CustomTypedOutput, Jr as DeadLetterCleanupOptions, Jt as resizeParamsSchema, K as ZipPluginLayer, Ka as FlowEventNodeStart, Ki as BuiltInNodeType, Kn as createFlowEngine, Kr as FlowJobTaskStatus, Kt as watermarkTransformSchema, L as RemoveBackgroundParams, La as FlowEventFlowPause, Ln as inputNodeParamsSchema, Lt as grayscaleTransformSchema, M as isOcrOutput, Ma as FlowEventDlqRetryStart, Mn as FlowCondition, Mo as CircuitBreakerState, Mt as WatermarkTransform, N as isStorageOutput, Na as FlowEventDlqRetrySuccess, Nn as InputData, No as DEFAULT_CIRCUIT_BREAKER_CONFIG, Nt as blurTransformSchema, O as hasOutputOfType, Oa as FlowEventDlqItemAdded, On as ExtractEffectRequirements, Oo as CircuitBreakerConfig, Ot as TextTransform, P as isUploadFile, Pa as FlowEventFlowCancel, Pn as InputNodeParams, Pt as brightnessTransformSchema, Q as VirusScanPluginShape, Qa as getNodeData, Qi as FlowCircuitBreakerFallback, Qr as DeadLetterItemStatus, Qt as ImageAiPlugin, R as removeBackgroundParamsSchema, Ra as FlowEventFlowStart, Rn as FlowEngine, Rt as logoTransformSchema, S as NarrowedTypedOutput, Sa as calculateBackoffDelay, Si as Flow, Sn as StreamingTransformFn, St as LogoTransform, T as getFirstOutputByType, Ta as DlqEvent, Ti as createFlowWithSchema, Tn as TransformNodeConfig, Tt as RotateTransform, U as ZipInput, Ua as FlowEventNodePause, Ui as FlowEdge, Un as FlowProviderShape, Ur as FlowJob, Ut as textTransformSchema, V as Plugin, Va as FlowEventNodeEnd, Vn as FlowEngineShape, Vr as createDeadLetterQueueService, Vt as sepiaTransformSchema, W as ZipParams, Wa as FlowEventNodeResponse, Wi as createFlowEdge, Wn as FlowWaitUntil, Wr as FlowJobStatus, Wt as transformImageParamsSchema, X as VirusScanPlugin, Xa as NodeType, Xi as FileNamingFunction, Xr as DeadLetterError, Xt as optimizeParamsSchema, Y as ScanResult, Ya as ConditionValue, Yi as FileNamingConfig, Yr as DeadLetterCleanupResult, Yt as OptimizeParams, Z as VirusScanPluginLayer, Za as createFlowNode, Zi as FlowCircuitBreakerConfig, Zr as DeadLetterItem, Zt as ImageAiContext, _ as NodeDefinitionsRecord, _a as DEFAULT_RETRY_POLICY, _i as InputTypeDefinition, _n as CredentialProviderLayer, _t as BlurTransform, a as buildNamingContext, aa as NodeConnectionValidator, ai as ImageDescriptionOutput, an as MergePdfParams, ao as memoryCircuitBreakerStoreLayer, at as trimVideoParamsSchema, b as TypedFlowEdge, ba as ImmediateBackoff, bi as inputTypeRegistry, bn as ParallelScheduler, bt as FlipTransform, c as interpolateFileName, ca as TypeCompatibilityChecker, ci as STORAGE_OUTPUT_TYPE_ID, cn as DocumentAiContext, ct as ResizeVideoParams, d as runArgsSchema, da as completeNodeExecution, di as ocrOutputSchema, dn as DocumentAiPluginShape, dt as extractFrameVideoParamsSchema, ea as FlowDeadLetterQueueConfig, ei as DeadLetterProcessResult, en as ImageAiPluginShape, eo as DistributedCircuitBreaker, et as VideoPluginLayer, f as FlowInputMap, fa as createOutputGuard, fi as OutputTypeDefinition, fn as OcrParams, ft as DescribeVideoMetadata, g as NodeDefinition, ga as BackoffStrategy, gi as validateFlowOutput, gn as CredentialProvider, gt as ImagePluginShape, h as FlowRequirements, ha as waitingNodeExecution, hi as outputTypeRegistry, hn as OcrTaskType, ht as ImagePluginLayer, i as applyFileNaming, ia as NarrowTypedOutput, ii as IMAGE_DESCRIPTION_OUTPUT_TYPE_ID, in as DocumentPluginShape, io as makeMemoryCircuitBreakerStore, it as TrimVideoParams, j as isInitOperation, ja as FlowEventDlqRetryFailed, jn as ResolveEffect, jo as CircuitBreakerFallback, jt as TransformationType, k as isFinalizeOperation, ka as FlowEventDlqItemExhausted, ki as DEFAULT_STREAMING_CONFIG, kn as ExtractLayerService, ko as CircuitBreakerEvent, kt as TransformImageParams, l as validatePattern, la as TypedOutput, li as STREAMING_INPUT_TYPE_ID, ln as DocumentAiPlugin, lt as resizeVideoParamsSchema, m as FlowPluginRequirements, ma as isStreamingInputV1, mi as OutputValidationResult, mn as OcrResult, mt as ImagePlugin, n as resolveUploadMetadata, na as FlowNodeData, ni as DeadLetterRetryAllResult, nn as DocumentPlugin, no as kvCircuitBreakerStoreLayer, nt as VideoStreamInput, o as getBaseName, oa as NodeExecutionResult, oi as OCR_OUTPUT_TYPE_ID, on as SplitPdfParams, ot as TranscodeVideoParams, p as FlowOutputMap, pa as isStorageOutputV1, pi as OutputTypeRegistry, pn as OcrResolution, pt as describeVideoMetadataSchema, q as ZipPluginShape, qa as ConditionField, qi as BuiltInTypedOutput, qn as flowEngine, qr as FlowJobTraceContext, qt as ResizeParams, r as AVAILABLE_TEMPLATE_VARIABLES, ra as NamingContext, ri as DeadLetterRetryAttempt, rn as DocumentPluginLayer, ro as makeKvCircuitBreakerStore, rt as VideoStreamOptions, s as getExtension, sa as NodeTypeMap, si as OcrOutput, sn as SplitPdfResult, st as transcodeVideoParamsSchema, t as ResolvedUploadMetadata, ta as FlowNode, ti as DeadLetterQueueStats, tn as DocumentMetadata, to as DistributedCircuitBreakerRegistry, tt as VideoPluginShape, u as RunArgs, ua as TypedOutputGuard, ui as imageDescriptionOutputSchema, un as DocumentAiPluginLayer, ut as ExtractFrameVideoParams, v as TypedFlow, va as ExponentialBackoff, vi as InputTypeRegistry, vn as CredentialProviderShape, vt as BrightnessTransform, w as filterOutputsByType, wa as isErrorRetryable, wi as FlowExecutionResult, wn as TransformMode, wt as ResizeTransform, x as createFlow, xa as RetryPolicy, xi as validateFlowInput, xn as ParallelSchedulerConfig, xt as GrayscaleTransform, y as TypedFlowConfig, ya as FixedBackoff, yi as InputValidationResult, yn as ExecutionLevel, yt as ContrastTransform, z as DescribeImageParams, za as FlowEventJobEnd, zn as FlowEngineLayer, zr as DeadLetterQueueService, zt as resizeTransformSchema } from "../index-BNhJmMuC.mjs";
|
|
4
|
+
import "../index-D8MZ6P3o.mjs";
|
|
5
|
+
import "../index-DQuMQssI.mjs";
|
|
6
|
+
export { AVAILABLE_TEMPLATE_VARIABLES, AllowRequestResult, AutoNamingSuffixGenerator, BackoffStrategy, BlurTransform, BrightnessTransform, BuiltInNodeType, BuiltInTypedOutput, CircuitBreakerConfig, CircuitBreakerEvent, CircuitBreakerEventHandler, CircuitBreakerFallback, CircuitBreakerState, ConditionField, ConditionOperator, ConditionValue, ContrastTransform, CredentialProvider, CredentialProviderLayer, CredentialProviderShape, CustomTypedOutput, DEFAULT_CIRCUIT_BREAKER_CONFIG, DEFAULT_RETRY_POLICY, DEFAULT_STREAMING_CONFIG, DeadLetterCleanupOptions, DeadLetterCleanupResult, DeadLetterError, DeadLetterItem, DeadLetterItemStatus, DeadLetterListOptions, DeadLetterProcessResult, DeadLetterQueueService, DeadLetterQueueServiceShape, DeadLetterQueueStats, DeadLetterRetryAllResult, DeadLetterRetryAttempt, DescribeImageParams, DescribeVideoMetadata, DistributedCircuitBreaker, DistributedCircuitBreakerRegistry, DlqEvent, DocumentAiContext, DocumentAiPlugin, DocumentAiPluginLayer, DocumentAiPluginShape, DocumentMetadata, DocumentPlugin, DocumentPluginLayer, DocumentPluginShape, EventType, ExecutionLevel, ExponentialBackoff, ExtractEffectError, ExtractEffectRequirements, ExtractFrameVideoParams, ExtractLayerService, ExtractLayerServices, FileNamingConfig, FileNamingFunction, FixedBackoff, FlipTransform, Flow, FlowCircuitBreakerConfig, FlowCircuitBreakerFallback, FlowCondition, FlowConfig, FlowData, FlowDeadLetterQueueConfig, FlowEdge, FlowEngine, FlowEngineLayer, FlowEngineOptions, FlowEngineShape, FlowEvent, FlowEventDlqItemAdded, FlowEventDlqItemExhausted, FlowEventDlqItemResolved, FlowEventDlqRetryFailed, FlowEventDlqRetryStart, FlowEventDlqRetrySuccess, FlowEventFlowCancel, FlowEventFlowEnd, FlowEventFlowError, FlowEventFlowPause, FlowEventFlowStart, FlowEventJobEnd, FlowEventJobStart, FlowEventNodeEnd, FlowEventNodeError, FlowEventNodePause, FlowEventNodeResponse, FlowEventNodeResume, FlowEventNodeStart, FlowExecutionResult, FlowInputMap, FlowJob, FlowJobStatus, FlowJobTask, FlowJobTaskStatus, FlowJobTraceContext, FlowNode, FlowNodeData, FlowOutputMap, FlowPluginRequirements, FlowProvider, FlowProviderShape, FlowRequirements, FlowWaitUntil, GrayscaleTransform, IMAGE_DESCRIPTION_OUTPUT_TYPE_ID, ImageAiContext, ImageAiPlugin, ImageAiPluginLayer, ImageAiPluginShape, ImageDescriptionOutput, ImagePlugin, ImagePluginLayer, ImagePluginShape, ImmediateBackoff, InputData, InputNodeParams, InputTypeDefinition, InputTypeRegistry, InputValidationResult, LogoTransform, MergePdfParams, NamingContext, NarrowTypedOutput, NarrowedTypedOutput, NodeConnectionValidator, NodeDefinition, NodeDefinitionsRecord, NodeExecutionResult, NodeType, NodeTypeMap, OCR_OUTPUT_TYPE_ID, OcrOutput, OcrParams, OcrResolution, OcrResult, OcrTaskType, OptimizeParams, OutputTypeDefinition, OutputTypeRegistry, OutputValidationResult, OverlayPosition, ParallelScheduler, ParallelSchedulerConfig, Plugin, PluginLayer, RemoveBackgroundParams, ResizeParams, ResizeTransform, ResizeVideoParams, ResolveEffect, ResolvedUploadMetadata, RetryPolicy, RotateTransform, RunArgs, STORAGE_OUTPUT_TYPE_ID, STREAMING_INPUT_TYPE_ID, ScanMetadata, ScanResult, SepiaTransform, SharpenTransform, SplitPdfParams, SplitPdfResult, StreamingConfig, StreamingTransformFn, StreamingTransformResult, TextTransform, TranscodeVideoParams, TransformImageParams, TransformMode, TransformNodeConfig, Transformation, TransformationType, TrimVideoParams, TypeCompatibilityChecker, TypedFlow, TypedFlowConfig, TypedFlowEdge, TypedOutput, TypedOutputGuard, VideoPlugin, VideoPluginLayer, VideoPluginShape, VideoStreamInput, VideoStreamOptions, VirusScanPlugin, VirusScanPluginLayer, VirusScanPluginShape, WaitUntilCallback, WatermarkTransform, ZipInput, ZipParams, ZipPlugin, ZipPluginLayer, ZipPluginShape, applyFileNaming, blurTransformSchema, brightnessTransformSchema, buildNamingContext, calculateBackoffDelay, calculateExpirationDate, completeNodeExecution, contrastTransformSchema, createDeadLetterQueueService, createFlow, createFlowEdge, createFlowEngine, createFlowNode, createFlowWithSchema, createInputNode, createOutputGuard, createTransformNode, createTypeGuard, deadLetterQueueService, describeImageParamsSchema, describeVideoMetadataSchema, extractFrameVideoParamsSchema, filterOutputsByType, flipTransformSchema, flowEngine, getBaseName, getExtension, getFirstOutputByType, getFlowData, getNodeData, getOutputByNodeId, getSingleOutputByType, grayscaleTransformSchema, hasOutputOfType, imageDescriptionOutputSchema, inputDataSchema, inputNodeParamsSchema, inputTypeRegistry, interpolateFileName, isErrorRetryable, isFinalizeOperation, isImageDescriptionOutput, isInitOperation, isOcrOutput, isStorageOutput, isStorageOutputV1, isStreamingInputV1, isUploadFile, isUploadOperation, isUrlOperation, kvCircuitBreakerStoreLayer, logoTransformSchema, makeKvCircuitBreakerStore, makeMemoryCircuitBreakerStore, memoryCircuitBreakerStoreLayer, ocrOutputSchema, optimizeParamsSchema, outputTypeRegistry, removeBackgroundParamsSchema, resizeParamsSchema, resizeTransformSchema, resizeVideoParamsSchema, resolveUploadMetadata, rotateTransformSchema, runArgsSchema, sepiaTransformSchema, sharpenTransformSchema, textTransformSchema, transcodeVideoParamsSchema, transformImageParamsSchema, transformationSchema, trimVideoParamsSchema, validateFlowInput, validateFlowOutput, validatePattern, waitingNodeExecution, watermarkTransformSchema };
|
package/dist/flow/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import"../uploadista-error-CkSxSyNo.mjs";import"../errors-CtPUOWNd.mjs";import{$ as e,A as t,At as n,B as r,Bt as i,C as a,Ct as o,D as s,Dt as c,E as l,Et as u,F as d,Ft as f,G as p,Gt as m,H as h,Ht as g,I as _,It as v,J as y,
|
|
1
|
+
import"../uploadista-error-CkSxSyNo.mjs";import"../errors-CtPUOWNd.mjs";import{$ as e,A as t,At as n,B as r,Bt as i,C as a,Ct as o,D as s,Dt as c,E as l,Et as u,F as d,Ft as f,G as p,Gt as m,H as h,Ht as g,I as _,It as v,J as y,Jt as b,K as x,Kt as S,L as C,Lt as w,M as T,Mt as E,N as D,Nt as O,O as k,Ot as A,P as j,Pt as M,Q as N,R as P,Rt as F,S as I,St as L,T as R,Tt as z,U as B,Ut as V,V as H,Vt as U,W,Wt as G,X as K,Y as q,Yt as J,Z as Y,_ as X,_t as Z,a as Q,at as $,b as ee,bt as te,c as ne,ct as re,d as ie,dt as ae,et as oe,f as se,ft as ce,g as le,gt as ue,h as de,ht as fe,i as pe,it as me,j as he,jt as ge,k as _e,kt as ve,l as ye,lt as be,m as xe,mt as Se,n as Ce,nt as we,o as Te,ot as Ee,p as De,pt as Oe,q as ke,qt as Ae,r as je,rt as Me,s as Ne,st as Pe,t as Fe,tt as Ie,u as Le,ut as Re,v as ze,vt as Be,w as Ve,wt as He,x as Ue,xt as We,y as Ge,yt as Ke,z as qe,zt as Je}from"../flow-CA8xO6wP.mjs";import{b as Ye}from"../types-BRnwrJDg.mjs";import"../upload-CpsShjP3.mjs";import"../checksum-COoD-F1l.mjs";import"../stream-limiter-B9nsn2gb.mjs";export{d as AVAILABLE_TEMPLATE_VARIABLES,D as CredentialProvider,J as DEFAULT_CIRCUIT_BREAKER_CONFIG,Oe as DEFAULT_RETRY_POLICY,Ye as DEFAULT_STREAMING_CONFIG,Re as DeadLetterQueueService,V as DistributedCircuitBreaker,G as DistributedCircuitBreakerRegistry,T as DocumentAiPlugin,he as DocumentPlugin,U as EventType,h as FlowEngine,B as FlowProvider,W as FlowWaitUntil,Z as IMAGE_DESCRIPTION_OUTPUT_TYPE_ID,t as ImageAiPlugin,_e as ImagePlugin,F as InputTypeRegistry,E as NodeType,Be as OCR_OUTPUT_TYPE_ID,f as OutputTypeRegistry,be as ParallelScheduler,Ke as STORAGE_OUTPUT_TYPE_ID,te as STREAMING_INPUT_TYPE_ID,Q as VideoPlugin,pe as VirusScanPlugin,je as ZipPlugin,_ as applyFileNaming,Ne as blurTransformSchema,ne as brightnessTransformSchema,C as buildNamingContext,Se as calculateBackoffDelay,fe as calculateExpirationDate,c as completeNodeExecution,ye as contrastTransformSchema,ae as createDeadLetterQueueService,Ce as createFlow,g as createFlowEdge,p as createFlowEngine,O as createFlowNode,ke as createFlowWithSchema,o as createInputNode,A as createOutputGuard,j as createTransformNode,q as createTypeGuard,ce as deadLetterQueueService,k as describeImageParamsSchema,s as describeVideoMetadataSchema,l as extractFrameVideoParamsSchema,K as filterOutputsByType,Le as flipTransformSchema,x as flowEngine,P as getBaseName,qe as getExtension,Y as getFirstOutputByType,y as getFlowData,M as getNodeData,N as getOutputByNodeId,e as getSingleOutputByType,ie as grayscaleTransformSchema,oe as hasOutputOfType,We as imageDescriptionOutputSchema,He as inputDataSchema,z as inputNodeParamsSchema,Je as inputTypeRegistry,r as interpolateFileName,ue as isErrorRetryable,Ie as isFinalizeOperation,we as isImageDescriptionOutput,Me as isInitOperation,me as isOcrOutput,$ as isStorageOutput,ve as isStorageOutputV1,n as isStreamingInputV1,Ee as isUploadFile,Pe as isUploadOperation,re as isUrlOperation,m as kvCircuitBreakerStoreLayer,se as logoTransformSchema,S as makeKvCircuitBreakerStore,Ae as makeMemoryCircuitBreakerStore,b as memoryCircuitBreakerStoreLayer,L as ocrOutputSchema,R as optimizeParamsSchema,v as outputTypeRegistry,Ve as removeBackgroundParamsSchema,a as resizeParamsSchema,De as resizeTransformSchema,I as resizeVideoParamsSchema,u as resolveUploadMetadata,xe as rotateTransformSchema,Fe as runArgsSchema,de as sepiaTransformSchema,le as sharpenTransformSchema,X as textTransformSchema,Ue as transcodeVideoParamsSchema,ze as transformImageParamsSchema,Ge as transformationSchema,Te as trimVideoParamsSchema,i as validateFlowInput,w as validateFlowOutput,H as validatePattern,ge as waitingNodeExecution,ee as watermarkTransformSchema};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{n as e}from"./uploadista-error-CkSxSyNo.mjs";import{D as t,E as n,I as r,L as i,O as a,P as o,S as s,b as c,d as l,k as u}from"./types-BRnwrJDg.mjs";import{a as d,n as f,o as p}from"./upload-CpsShjP3.mjs";import{Context as m,Effect as h,Layer as g,Option as _,Runtime as v,Stream as y,Tracer as b}from"effect";import{z as x}from"zod";import{render as S}from"micromustache";const C={enabled:!1,failureThreshold:5,resetTimeout:3e4,halfOpenRequests:3,windowDuration:6e4,fallback:{type:`fail`}},w=`uploadista:circuit-breaker:`;function T(e){let t=e=>`${w}${e}`,n=n=>h.gen(function*(){let r=t(n),i=yield*e.get(r);if(i===null)return null;try{return o.deserialize(i)}catch{return yield*e.delete(r),null}}),r=(n,r)=>{let i=t(n),a=o.serialize(r);return e.set(i,a)};return{getState:n,setState:r,incrementFailures:(e,t)=>h.gen(function*(){let a=Date.now(),o=yield*n(e);return o===null&&(o=i({failureThreshold:5,resetTimeout:3e4,halfOpenRequests:3,windowDuration:t})),o=a-o.windowStart>t?{...o,failureCount:1,windowStart:a}:{...o,failureCount:o.failureCount+1},yield*r(e,o),o.failureCount}),resetFailures:e=>h.gen(function*(){let t=yield*n(e);t!==null&&(yield*r(e,{...t,failureCount:0,windowStart:Date.now()}))}),incrementHalfOpenSuccesses:e=>h.gen(function*(){let t=yield*n(e);if(t===null)return 1;let i={...t,halfOpenSuccesses:t.halfOpenSuccesses+1};return yield*r(e,i),i.halfOpenSuccesses}),getAllStats:()=>h.gen(function*(){let t=new Map;if(!e.list)return t;let r=yield*e.list(w),i=Date.now();for(let e of r){let r=e,a=yield*n(r);if(a!==null){let e=i-a.lastStateChange;t.set(r,{nodeType:r,state:a.state,failureCount:a.failureCount,halfOpenSuccesses:a.halfOpenSuccesses,timeSinceLastStateChange:e,timeUntilHalfOpen:a.state===`open`?Math.max(0,a.config.resetTimeout-e):void 0})}}return t}),delete:n=>e.delete(t(n))}}function E(){let e=new Map;return{getState:t=>h.succeed(e.get(t)??null),setState:(t,n)=>h.sync(()=>{e.set(t,n)}),incrementFailures:(t,n)=>h.sync(()=>{let r=Date.now(),a=e.get(t);return a===void 0&&(a=i({failureThreshold:5,resetTimeout:3e4,halfOpenRequests:3,windowDuration:n})),a=r-a.windowStart>n?{...a,failureCount:1,windowStart:r}:{...a,failureCount:a.failureCount+1},e.set(t,a),a.failureCount}),resetFailures:t=>h.sync(()=>{let n=e.get(t);n!==void 0&&e.set(t,{...n,failureCount:0,windowStart:Date.now()})}),incrementHalfOpenSuccesses:t=>h.sync(()=>{let n=e.get(t);if(n===void 0)return 1;let r={...n,halfOpenSuccesses:n.halfOpenSuccesses+1};return e.set(t,r),r.halfOpenSuccesses}),getAllStats:()=>h.sync(()=>{let t=new Map,n=Date.now();for(let[r,i]of e){let e=n-i.lastStateChange;t.set(r,{nodeType:r,state:i.state,failureCount:i.failureCount,halfOpenSuccesses:i.halfOpenSuccesses,timeSinceLastStateChange:e,timeUntilHalfOpen:i.state===`open`?Math.max(0,i.config.resetTimeout-e):void 0})}return t}),delete:t=>h.sync(()=>{e.delete(t)})}}const D=g.effect(r,h.gen(function*(){return T(yield*t)})),O=g.succeed(r,E());var k=class{eventHandler;nodeType;config;store;constructor(e,t,n){this.nodeType=e,this.config={enabled:t.enabled??C.enabled,failureThreshold:t.failureThreshold??C.failureThreshold,resetTimeout:t.resetTimeout??C.resetTimeout,halfOpenRequests:t.halfOpenRequests??C.halfOpenRequests,windowDuration:t.windowDuration??C.windowDuration,fallback:t.fallback??C.fallback},this.store=n}setEventHandler(e){this.eventHandler=e}allowRequest(){let e=this;return h.gen(function*(){if(!e.config.enabled)return{allowed:!0,state:`closed`,failureCount:0};let t=yield*e.store.getState(e.nodeType),n=Date.now();if(t===null&&(t=i({failureThreshold:e.config.failureThreshold,resetTimeout:e.config.resetTimeout,halfOpenRequests:e.config.halfOpenRequests,windowDuration:e.config.windowDuration}),yield*e.store.setState(e.nodeType,t)),t.state===`open`&&n-t.lastStateChange>=e.config.resetTimeout){let r=t.state;t={...t,state:`half-open`,halfOpenSuccesses:0,lastStateChange:n},yield*e.store.setState(e.nodeType,t),yield*e.emitEvent(r,`half-open`,t.failureCount)}return{allowed:t.state!==`open`,state:t.state,failureCount:t.failureCount}})}getState(){let e=this;return h.gen(function*(){return(yield*e.store.getState(e.nodeType))?.state??`closed`})}getFailureCount(){let e=this;return h.gen(function*(){return(yield*e.store.getState(e.nodeType))?.failureCount??0})}recordSuccess(){let e=this;return h.gen(function*(){if(!e.config.enabled)return;let t=yield*e.store.getState(e.nodeType);t!==null&&(t.state===`half-open`?(yield*e.store.incrementHalfOpenSuccesses(e.nodeType))>=e.config.halfOpenRequests&&(yield*e.transitionTo(`closed`,t.failureCount)):t.state===`closed`&&(yield*e.store.resetFailures(e.nodeType)))})}recordFailure(e){let t=this;return h.gen(function*(){if(!t.config.enabled)return;let e=yield*t.store.getState(t.nodeType);if(e===null||e.state===`closed`){let e=yield*t.store.incrementFailures(t.nodeType,t.config.windowDuration);e>=t.config.failureThreshold&&(yield*t.transitionTo(`open`,e))}else e.state===`half-open`&&(yield*t.transitionTo(`open`,e.failureCount))})}getFallback(){return this.config.fallback}reset(){let e=this;return h.gen(function*(){let t=(yield*e.store.getState(e.nodeType))?.state??`closed`;yield*e.store.setState(e.nodeType,i({failureThreshold:e.config.failureThreshold,resetTimeout:e.config.resetTimeout,halfOpenRequests:e.config.halfOpenRequests,windowDuration:e.config.windowDuration})),t!==`closed`&&(yield*e.emitEvent(t,`closed`,0))})}transitionTo(e,t){let n=this;return h.gen(function*(){let r=yield*n.store.getState(n.nodeType),i=r?.state??`closed`;if(i===e)return;let a=Date.now(),o={state:e,failureCount:e===`closed`?0:t,lastStateChange:a,halfOpenSuccesses:0,windowStart:e===`closed`?a:r?.windowStart??a,config:{failureThreshold:n.config.failureThreshold,resetTimeout:n.config.resetTimeout,halfOpenRequests:n.config.halfOpenRequests,windowDuration:n.config.windowDuration}};yield*n.store.setState(n.nodeType,o),yield*n.emitEvent(i,e,t)})}emitEvent(e,t,n){let r=this;return h.gen(function*(){r.eventHandler&&(yield*r.eventHandler({nodeType:r.nodeType,previousState:e,newState:t,timestamp:Date.now(),failureCount:n}))})}},ee=class{breakers=new Map;eventHandler;constructor(e){this.store=e}setEventHandler(e){this.eventHandler=e;for(let t of this.breakers.values())t.setEventHandler(e)}getOrCreate(e,t){let n=this.breakers.get(e);return n||(n=new k(e,t,this.store),this.eventHandler&&n.setEventHandler(this.eventHandler),this.breakers.set(e,n)),n}get(e){return this.breakers.get(e)}getAllStats(){return this.store.getAllStats()}resetAll(){let e=this;return h.gen(function*(){for(let t of e.breakers.values())yield*t.reset()})}clear(){this.breakers.clear()}};function A({source:e,target:t,sourcePort:n,targetPort:r}){return{source:e,target:t,sourcePort:n,targetPort:r}}let j=function(e){return e.JobStart=`job-start`,e.JobEnd=`job-end`,e.FlowStart=`flow-start`,e.FlowEnd=`flow-end`,e.FlowError=`flow-error`,e.FlowPause=`flow-pause`,e.FlowCancel=`flow-cancel`,e.NodeStart=`node-start`,e.NodeEnd=`node-end`,e.NodePause=`node-pause`,e.NodeResume=`node-resume`,e.NodeError=`node-error`,e.NodeStream=`node-stream`,e.NodeResponse=`node-response`,e.DlqItemAdded=`dlq-item-added`,e.DlqRetryStart=`dlq-retry-start`,e.DlqRetrySuccess=`dlq-retry-success`,e.DlqRetryFailed=`dlq-retry-failed`,e.DlqItemExhausted=`dlq-item-exhausted`,e.DlqItemResolved=`dlq-item-resolved`,e}({});var M=class{types;constructor(){this.types=new Map}register(t){if(this.types.has(t.id))throw e.fromCode(`VALIDATION_ERROR`,{body:`Input type "${t.id}" is already registered. Types cannot be modified or re-registered.`,details:{typeId:t.id}});this.types.set(t.id,t)}get(e){return this.types.get(e)}list(){return Array.from(this.types.values())}validate(t,n){let r=this.types.get(t);if(!r)return{success:!1,error:e.fromCode(`VALIDATION_ERROR`,{body:`Input type "${t}" is not registered`,details:{typeId:t}})};try{return{success:!0,data:r.schema.parse(n)}}catch(n){return{success:!1,error:e.fromCode(`VALIDATION_ERROR`,{body:`Data validation failed for input type "${t}"`,cause:n,details:{typeId:t,validationErrors:n}})}}}has(e){return this.types.has(e)}size(){return this.types.size}};const N=new M;function te(e,t){return N.validate(e,t)}var ne=class{types;constructor(){this.types=new Map}register(t){if(this.types.has(t.id))throw e.fromCode(`VALIDATION_ERROR`,{body:`Output type "${t.id}" is already registered. Types cannot be modified or re-registered.`,details:{typeId:t.id}});this.types.set(t.id,t)}get(e){return this.types.get(e)}list(){return Array.from(this.types.values())}validate(t,n){let r=this.types.get(t);if(!r)return{success:!1,error:e.fromCode(`VALIDATION_ERROR`,{body:`Output type "${t}" is not registered`,details:{typeId:t}})};try{return{success:!0,data:r.schema.parse(n)}}catch(n){return{success:!1,error:e.fromCode(`VALIDATION_ERROR`,{body:`Data validation failed for output type "${t}"`,cause:n,details:{typeId:t,validationErrors:n}})}}}has(e){return this.types.has(e)}size(){return this.types.size}};const P=new ne;function re(e,t){return P.validate(e,t)}let F=function(e){return e.input=`input`,e.process=`process`,e.conditional=`conditional`,e.multiplex=`multiplex`,e.merge=`merge`,e}({});function I({id:t,name:n,description:r,type:i,inputSchema:a,outputSchema:o,run:s,condition:c,multiInput:l=!1,multiOutput:u=!1,pausable:d=!1,retry:f,inputTypeId:p,outputTypeId:m,keepOutput:g=!1,circuitBreaker:_,nodeTypeId:v}){return h.gen(function*(){return p&&!N.get(p)?yield*e.fromCode(`INVALID_INPUT_TYPE`,{body:`Input type "${p}" is not registered in inputTypeRegistry`,details:{inputTypeId:p,nodeId:t}}).toEffect():m&&!P.get(m)?yield*e.fromCode(`INVALID_OUTPUT_TYPE`,{body:`Output type "${m}" is not registered in outputTypeRegistry`,details:{outputTypeId:m,nodeId:t}}).toEffect():{id:t,name:n,description:r,type:i,inputTypeId:p,outputTypeId:m,keepOutput:g,inputSchema:a,outputSchema:o,pausable:d,run:({data:r,jobId:i,flowId:c,storageId:l,clientId:u})=>h.gen(function*(){let d=yield*s({data:yield*h.try({try:()=>a.parse(r),catch:r=>{let i=r instanceof Error?r.message:String(r);return e.fromCode(`FLOW_INPUT_VALIDATION_ERROR`,{body:`Node '${n}' (${t}) input validation failed: ${i}`,cause:r})}}),jobId:i,storageId:l,flowId:c,clientId:u});return d.type===`waiting`?{type:`waiting`,partialData:d.partialData,nodeType:m,nodeId:t}:{type:`complete`,data:yield*h.try({try:()=>o.parse(d.data),catch:r=>{let i=r instanceof Error?r.message:String(r);return e.fromCode(`FLOW_OUTPUT_VALIDATION_ERROR`,{body:`Node '${n}' (${t}) output validation failed: ${i}`,cause:r})}}),nodeType:m,nodeId:t}}),condition:c,multiInput:l,multiOutput:u,retry:f,circuitBreaker:_,nodeTypeId:v}})}const ie=e=>({id:e.id,name:e.name,description:e.description,type:e.type,inputTypeId:e.inputTypeId,outputTypeId:e.outputTypeId,nodeTypeId:e.nodeTypeId}),L=e=>t=>t.nodeType===e,ae=L(`storage-output-v1`),oe=L(`streaming-input-v1`),R=e=>({type:`complete`,data:e}),se=e=>({type:`waiting`,partialData:e}),ce=(e,t)=>{if(e===t)return!0;try{return!!(e&&t&&typeof e==`object`&&typeof t==`object`)}catch{return!0}};var le=class{typeChecker;constructor(e=ce){this.typeChecker=e}validateConnection(e,t,n){return this.getCompatibleTypes(e.outputSchema,t.inputSchema)}getCompatibleTypes(e,t){return this.typeChecker(e,t)}validateFlow(e,t){let n=[],r=new Map(e.map(e=>[e.id,e]));for(let e of t){let t=r.get(e.source),i=r.get(e.target);if(!t){n.push(`Source node ${e.source} not found`);continue}if(!i){n.push(`Target node ${e.target} not found`);continue}this.validateConnection(t,i,e)||n.push(`Schema mismatch: ${t.id} output schema incompatible with ${i.id} input schema`)}return{isValid:n.length===0,errors:n}}getExpectedInputSchemas(e,t,n){let r=new Map(t.map(e=>[e.id,e])),i={};for(let t of n)if(t.target===e){let e=r.get(t.source);if(e){let n=t.sourcePort||t.source;i[n]=e.outputSchema}}return i}getActualOutputSchemas(e,t,n){let r=new Map(t.map(e=>[e.id,e])),i={};for(let t of n)if(t.source===e){let e=r.get(t.target);if(e){let n=t.targetPort||t.target;i[n]=e.inputSchema}}return i}validateData(e,t){try{return t.parse(e),{isValid:!0,errors:[]}}catch(e){return e instanceof Error&&`errors`in e?{isValid:!1,errors:e.errors.map(e=>`${e.path.join(`.`)}: ${e.message}`)}:{isValid:!1,errors:[e instanceof Error?e.message:`Validation failed`]}}}};function z(e){if(!e)return{type:``,fileName:``,metadata:void 0,metadataJson:void 0};let t={...e},n=String(t.type||t.mimeType||t[`content-type`]||``);n&&(t.type||=n,t.mimeType||=n);let r=String(t.fileName||t.originalName||t.name||``);return r&&(t.fileName||=r,t.originalName||=r,t.name||=r),{type:n,fileName:r,metadata:t,metadataJson:JSON.stringify(t)}}const ue=x.object({operation:x.literal(`init`),storageId:x.string(),metadata:x.record(x.string(),x.any()).optional()}),de=x.object({operation:x.literal(`finalize`),uploadId:x.string()}),fe=x.object({operation:x.literal(`url`),url:x.string(),storageId:x.string().optional(),metadata:x.record(x.string(),x.any()).optional()}),B=x.union([ue,de,fe]),pe=x.object({allowedMimeTypes:x.array(x.string()).optional(),minSize:x.number().positive().optional(),maxSize:x.number().positive().optional()});function me(t,n){return h.gen(function*(){if(n){if(n.allowedMimeTypes&&n.allowedMimeTypes.length>0&&!n.allowedMimeTypes.some(e=>{if(e.endsWith(`/*`)){let n=e.slice(0,-2);return t.type.startsWith(n)}return t.type===e}))throw yield*e.fromCode(`VALIDATION_ERROR`,{cause:Error(`File type "${t.type}" is not allowed. Allowed types: ${n.allowedMimeTypes.join(`, `)}`)}).toEffect();if(n.minSize!==void 0&&t.size<n.minSize)throw yield*e.fromCode(`VALIDATION_ERROR`,{cause:Error(`File size (${t.size} bytes) is below minimum (${n.minSize} bytes)`)}).toEffect();if(n.maxSize!==void 0&&t.size>n.maxSize)throw yield*e.fromCode(`VALIDATION_ERROR`,{cause:Error(`File size (${t.size} bytes) exceeds maximum (${n.maxSize} bytes)`)}).toEffect()}})}function he(t,r,i){let a=i?.keepOutput??!1;return h.gen(function*(){let i=yield*f;return yield*I({id:t,name:`Input`,description:`Handles file input through multiple methods - streaming upload (init/finalize) or direct URL fetch`,type:F.input,nodeTypeId:`input`,inputSchema:B,outputSchema:n,keepOutput:a,inputTypeId:W,outputTypeId:V,run:({data:n,flowId:a,jobId:o,clientId:s})=>h.gen(function*(){switch(n.operation){case`init`:{let e={storageId:n.storageId,size:n.metadata?.size||0,type:n.metadata?.mimeType||`application/octet-stream`,fileName:n.metadata?.originalName,lastModified:n.metadata?.size?Date.now():void 0,metadata:n.metadata?JSON.stringify(n.metadata):void 0,flow:{flowId:a,nodeId:t,jobId:o}};return se(yield*i.createUpload(e,s))}case`finalize`:{let e=yield*i.getUpload(n.uploadId),{type:t}=z(e.metadata);return yield*me({type:t,size:e.size||0},r),R(e)}case`url`:{let e=yield*p(n.url),c=yield*d(e),l=n.metadata?.mimeType||e.headers.get(`content-type`)||`application/octet-stream`,u=n.metadata?.size||Number(e.headers.get(`content-length`)||0),f=n.metadata?.originalName||n.url.split(`/`).pop()||`file`;yield*me({type:l,size:u},r);let m=new ReadableStream({start(e){e.enqueue(new Uint8Array(c)),e.close()}}),h={storageId:n.storageId||`buffer`,size:u,type:l,fileName:f,lastModified:Date.now(),metadata:n.metadata?JSON.stringify(n.metadata):void 0};return R({...yield*i.upload(h,s,m),flow:{flowId:a,nodeId:t,jobId:o}})}default:throw yield*e.fromCode(`VALIDATION_ERROR`,{cause:Error(`Invalid operation`)}).toEffect()}})})})}const V=`storage-output-v1`,H=`ocr-output-v1`,U=`image-description-output-v1`,W=`streaming-input-v1`,ge=x.object({extractedText:x.string(),format:x.enum([`markdown`,`plain`,`structured`]),taskType:x.enum([`convertToMarkdown`,`freeOcr`,`parseFigure`,`locateObject`]),confidence:x.number().min(0).max(1).optional()}),_e=x.object({description:x.string(),confidence:x.number().min(0).max(1).optional(),metadata:x.record(x.string(),x.unknown()).optional()});N.register({id:W,schema:B,version:`1.0.0`,description:`Streaming file input with init/finalize/url operations for flexible file ingestion`}),P.register({id:V,schema:n,version:`1.0.0`,description:`Storage output node that saves files to configured storage backend`}),P.register({id:H,schema:ge,version:`1.0.0`,description:`OCR output node that extracts structured text from documents using AI`}),P.register({id:U,schema:_e,version:`1.0.0`,description:`Image description output node that generates AI-powered descriptions of images`});const G={enabled:!0,maxRetries:3,backoff:{type:`exponential`,initialDelayMs:1e3,maxDelayMs:3e5,multiplier:2,jitter:!0},ttlMs:6048e5};function K(e,t){switch(e.type){case`immediate`:return 0;case`fixed`:return e.delayMs;case`exponential`:{let n=e.initialDelayMs*e.multiplier**t,r=Math.min(n,e.maxDelayMs);if(e.jitter){let e=.5+Math.random();return Math.floor(r*e)}return r}default:return 0}}function ve(e,t){return!t.enabled||t.nonRetryableErrors?.includes(e)?!1:t.retryableErrors&&t.retryableErrors.length>0?t.retryableErrors.includes(e):!0}function ye(e,t){if(!(t===void 0||t<=0))return new Date(e.getTime()+t)}var q=class e extends m.Tag(`DeadLetterQueueService`)(){static optional=h.serviceOption(e)};function be(){return h.gen(function*(){let e=yield*a,t=()=>`dlq_${crypto.randomUUID()}`,n=e=>({...e,createdAt:new Date(e.createdAt),updatedAt:new Date(e.updatedAt),expiresAt:e.expiresAt?new Date(e.expiresAt):void 0,nextRetryAt:e.nextRetryAt?new Date(e.nextRetryAt):void 0,retryHistory:e.retryHistory.map(e=>({...e,attemptedAt:new Date(e.attemptedAt)}))}),r=()=>h.gen(function*(){if(!e.list)return[];let t=yield*e.list(),r=[];for(let i of t){let t=yield*h.catchAll(e.get(i),()=>h.succeed(null));t&&r.push(n(t))}return r});return{add:(n,r,i=G)=>h.gen(function*(){let a=t(),o=new Date,s={code:r.code||`UNKNOWN_ERROR`,message:r.body||r.message||`Unknown error`,nodeId:void 0,stack:r.stack},c=n.tasks.find(e=>e.status===`failed`);c&&(s.nodeId=c.nodeId);let l={};for(let e of n.tasks)e.result!==void 0&&(l[e.nodeId]=e.result);let u=ve(s.code,i),d;if(i.enabled&&u&&i.maxRetries>0){let e=K(i.backoff,0);d=new Date(o.getTime()+e)}let f={id:a,jobId:n.id,flowId:n.flowId,storageId:n.storageId,clientId:n.clientId,error:s,inputs:n.executionState?.inputs||{},nodeResults:l,failedAtNodeId:s.nodeId,retryCount:0,maxRetries:i.maxRetries,nextRetryAt:d,retryHistory:[],createdAt:o,updatedAt:o,expiresAt:ye(o,i.ttlMs),status:u&&i.enabled?`pending`:`exhausted`};return yield*e.set(a,f),f}),get:t=>h.gen(function*(){return n(yield*e.get(t))}),getOption:t=>h.gen(function*(){let r=yield*h.either(e.get(t));return r._tag===`Left`?r.left.code===`FILE_NOT_FOUND`?_.none():yield*h.fail(r.left):_.some(n(r.right))}),delete:t=>e.delete(t),list:(e={})=>h.gen(function*(){let t=yield*r(),{status:n,flowId:i,clientId:a,limit:o=50,offset:s=0}=e,c=t;n&&(c=c.filter(e=>e.status===n)),i&&(c=c.filter(e=>e.flowId===i)),a&&(c=c.filter(e=>e.clientId===a)),c.sort((e,t)=>t.createdAt.getTime()-e.createdAt.getTime());let l=c.length;return{items:c.slice(s,s+o),total:l}}),update:(t,r)=>h.gen(function*(){let i={...n(yield*e.get(t)),...r,updatedAt:new Date};return yield*e.set(t,i),i}),markRetrying:t=>h.gen(function*(){let r={...n(yield*e.get(t)),status:`retrying`,updatedAt:new Date};return yield*e.set(t,r),r}),recordRetryFailure:(t,r,i)=>h.gen(function*(){let a=n(yield*e.get(t)),o=new Date,s=a.retryCount+1,c=[...a.retryHistory,{attemptedAt:o,error:r,durationMs:i}],l=`pending`,u;if(s>=a.maxRetries)l=`exhausted`,u=void 0;else{let e=K(G.backoff,s);u=new Date(o.getTime()+e)}let d={...a,retryCount:s,retryHistory:c,status:l,nextRetryAt:u,updatedAt:o};return yield*e.set(t,d),d}),markResolved:t=>h.gen(function*(){let r={...n(yield*e.get(t)),status:`resolved`,nextRetryAt:void 0,updatedAt:new Date};return yield*e.set(t,r),r}),getScheduledRetries:(e=100)=>h.gen(function*(){let t=yield*r(),n=new Date;return t.filter(e=>e.status===`pending`&&e.nextRetryAt&&e.nextRetryAt<=n).sort((e,t)=>(e.nextRetryAt?.getTime()||0)-(t.nextRetryAt?.getTime()||0)).slice(0,e)}),cleanup:(t={})=>h.gen(function*(){let n=yield*r(),{olderThan:i,status:a}=t,o=new Date,s=0;for(let t of n){let n=!1;t.expiresAt&&t.expiresAt<=o&&(n=!0),i&&t.createdAt<=i&&(a?n=t.status===a:(t.status===`exhausted`||t.status===`resolved`)&&(n=!0)),n&&(yield*h.catchAll(e.delete(t.id),()=>h.succeed(void 0)),s++)}return{deleted:s}}),getStats:()=>h.gen(function*(){let e=yield*r(),t={pending:0,retrying:0,exhausted:0,resolved:0},n={},i,a=0;for(let r of e)t[r.status]++,n[r.flowId]=(n[r.flowId]||0)+1,(!i||r.createdAt<i)&&(i=r.createdAt),a+=r.retryCount;let o=e.length>0?a/e.length:0;return{totalItems:e.length,byStatus:t,byFlow:n,oldestItem:i,averageRetryCount:o}})}})}const xe=g.effect(q,be());var Se=class{maxConcurrency;constructor(e={}){this.maxConcurrency=e.maxConcurrency??4}groupNodesByExecutionLevel(e,t){let n={},r={};e.forEach(e=>{n[e.id]=[],r[e.id]=0}),t.forEach(e=>{n[e.source]?.push(e.target),r[e.target]=(r[e.target]||0)+1});let i=[],a=new Set,o=0;for(;a.size<e.length;){let e=Object.keys(r).filter(e=>r[e]===0&&!a.has(e));if(e.length===0)throw Error(`Cycle detected in flow graph - cannot execute in parallel`);i.push({level:o++,nodes:e}),e.forEach(e=>{a.add(e),delete r[e],n[e]?.forEach(e=>{r[e]!==void 0&&r[e]--})})}return i}executeNodesInParallel(e){return h.all(e.map(e=>e()),{concurrency:this.maxConcurrency})}canExecuteInParallel(e,t,n){return e.every(e=>(n[e]||[]).every(e=>t.has(e)))}getStats(){return{maxConcurrency:this.maxConcurrency}}};function J(e){return t=>{if(t.nodeType!==e)return!1;let n=P.get(e);return n?n.schema.safeParse(t.data).success:!1}}function Ce(e){return!e||typeof e!=`object`?!1:n.safeParse(e).success}const we=J(`storage-output-v1`),Te=J(H),Ee=J(U);function Y(e,t){return e.filter(t)}function De(t,n){return h.gen(function*(){let r=Y(t,n);return r.length===0?yield*e.fromCode(`OUTPUT_NOT_FOUND`,{body:`No output of the specified type was found in the flow results`}).toEffect():r.length>1?yield*e.fromCode(`MULTIPLE_OUTPUTS_FOUND`,{body:`Found ${r.length} outputs of the specified type, expected exactly one`,details:{foundCount:r.length,nodeIds:r.map(e=>e.nodeId)}}).toEffect():r[0]})}function Oe(e,t){return Y(e,t)[0]}function ke(e,t){return e.find(e=>e.nodeId===t)}function Ae(e,t){return e.some(t)}function je(e){return e.operation===`init`}function Me(e){return e.operation===`finalize`}function Ne(e){return e.operation===`url`}function Pe(e){return e.operation===`init`||e.operation===`url`}const Fe=e=>({id:e.id,name:e.name,nodes:e.nodes.map(ie),edges:e.edges});function X(t){return h.gen(function*(){let n=yield*h.all(t.nodes.map(e=>h.isEffect(e)?e:h.succeed(e))),{flowId:i,name:a,onEvent:o,checkJobStatus:c,edges:l,inputSchema:u,outputSchema:d,typeChecker:f,circuitBreaker:p}=t,m=n,g=new le(f),_=e=>{let t=e.circuitBreaker,n=e.nodeTypeId?p?.nodeTypeOverrides?.[e.nodeTypeId]:void 0,r=p?.defaults;if(!(!t&&!n&&!r))return{...r,...n,...t}},v=()=>{let e={},t={},n={};return m.forEach(r=>{e[r.id]=[],n[r.id]=[],t[r.id]=0}),l.forEach(r=>{e[r.source]?.push(r.target),n[r.target]?.push(r.source),t[r.target]=(t[r.target]||0)+1}),{graph:e,reverseGraph:n,inDegree:t}},b=()=>{let{graph:e,inDegree:t}=v(),n=[],r=[];for(Object.keys(t).forEach(e=>{t[e]===0&&n.push(e)});n.length>0;){let i=n.shift();if(!i)throw Error(`No current node found`);r.push(i),e[i]?.forEach(e=>{t[e]=(t[e]||0)-1,t[e]===0&&n.push(e)})}return r},S=(e,t)=>{if(!e.condition)return h.succeed(!0);let{field:n,operator:r,value:i}=e.condition,a=t,o=a?.metadata?.[n]||a?.[n],s=(()=>{switch(r){case`equals`:return o===i;case`notEquals`:return o!==i;case`greaterThan`:return Number(o)>Number(i);case`lessThan`:return Number(o)<Number(i);case`contains`:return String(o).includes(String(i));case`startsWith`:return String(o).startsWith(String(i));default:return!0}})();return h.succeed(s)},C=(e,t)=>{let{reverseGraph:n}=v(),r=n[e]||[],i={};return r.forEach(e=>{let n=t.get(e);n!==void 0&&(i[e]=n)}),i},w=e=>{let t=m.filter(e=>e.type===`input`),n={};return t.forEach(t=>{e&&typeof e==`object`&&t.id in e&&(n[t.id]=u.parse(e[t.id]))}),n},T=e=>!l.some(t=>t.source===e),E=e=>{let t=m.find(t=>t.id===e);return T(e)||t?.keepOutput===!0},D=e=>{let t=m.filter(e=>E(e.id)),n={};return t.forEach(t=>{let r=e.get(t.id);r!==void 0&&(n[t.id]=r)}),n},O=(e,t)=>{let n=m.filter(e=>E(e.id)),r=[];return n.forEach(n=>{let i=e.get(n.id);if(i!==void 0){let e=t.get(n.id);r.push({nodeId:n.id,nodeType:e,data:i,timestamp:new Date().toISOString()})}}),r},k=(e,t,n)=>h.gen(function*(){if(e.storage.id===t)return e;let r=yield*s,i=yield*r.getDataStore(e.storage.id,n),a=yield*r.getDataStore(t,n),o=yield*i.read(e.id),c=y.make(o),l={...e,storage:{id:t,type:e.storage.type}},u=yield*a.create(l);return yield*a.write({file_id:u.id,stream:c,offset:0},{}),u}),A=(n,r,a,s,l,u,d,f)=>h.gen(function*(){let p=l.get(n);if(!p)return yield*e.fromCode(`FLOW_NODE_NOT_FOUND`).toEffect();if(c){let t=yield*c(u);if(t===`paused`)return yield*e.fromCode(`FLOW_PAUSED`,{cause:`Flow ${i} was paused by user at job ${u}`}).toEffect();if(t===`cancelled`)return yield*e.fromCode(`FLOW_CANCELLED`,{cause:`Flow ${i} was cancelled by user at job ${u}`}).toEffect()}o&&(yield*o({jobId:u,flowId:i,nodeId:n,eventType:j.NodeStart,nodeName:p.name,nodeType:p.type}));let m=p.retry?.maxRetries??0,g=p.retry?.retryDelay??1e3,v=p.retry?.exponentialBackoff??!0,y=_(p),b=y?.enabled&&p.nodeTypeId&&f?f.getOrCreate(p.nodeTypeId,y):null;if(b){let{allowed:t,state:r,failureCount:s}=yield*b.allowRequest();if(!t){let t=b.getFallback();return yield*h.logWarning(`Circuit breaker OPEN for node type "${p.nodeTypeId}" - applying fallback`),t.type===`skip`?(o&&(yield*o({jobId:u,flowId:i,nodeId:n,eventType:j.NodeEnd,nodeName:p.name})),{nodeId:n,result:a[n],success:!0,waiting:!1}):t.type===`default`?(o&&(yield*o({jobId:u,flowId:i,nodeId:n,eventType:j.NodeEnd,nodeName:p.name,result:t.value})),{nodeId:n,result:t.value,success:!0,waiting:!1}):yield*e.fromCode(`CIRCUIT_BREAKER_OPEN`,{body:`Circuit breaker is open for node type "${p.name}"`,details:{nodeType:p.name,nodeId:n,state:r,failureCount:s}}).toEffect()}}let x=0,w=null;for(;x<=m;)try{let c,l={};if(p.type===`input`){if(c=a[n],c===void 0)return yield*h.logError(`Input node ${n} has no input data`),yield*e.fromCode(`FLOW_NODE_ERROR`,{cause:Error(`Input node ${n} has no input data`)}).toEffect()}else{if(l=C(n,s),Object.keys(l).length===0)return yield*h.logError(`Node ${n} has no input data`),yield*e.fromCode(`FLOW_NODE_ERROR`,{cause:Error(`Node ${n} has no input data`)}).toEffect();if(p.multiInput)c=l;else{let t=Object.keys(l)[0];if(!t)return yield*e.fromCode(`FLOW_NODE_ERROR`,{cause:Error(`Node ${n} has no input data`)}).toEffect();c=l[t]}}if(p.type===`conditional`&&!(yield*S(p,c)))return o&&(yield*o({jobId:u,flowId:i,nodeId:n,eventType:j.NodeEnd,nodeName:p.name})),{nodeId:n,result:c,success:!0,waiting:!1};let f=yield*p.run({data:c,inputs:l,jobId:u,flowId:i,storageId:r,clientId:d});if(f.type===`waiting`){let e=f.partialData;return o&&(yield*o({jobId:u,flowId:i,nodeId:n,eventType:j.NodePause,nodeName:p.name,partialData:e})),{nodeId:n,result:e,success:!0,waiting:!0,nodeType:f.nodeType}}let m=f.data;if(E(n)&&(Ce(m)&&m.storage.id!==r&&(yield*h.logDebug(`Auto-persisting output node ${n} output from ${m.storage.id} to ${r}`),m=yield*k(m,r,d)),t.hooks?.onNodeOutput)){yield*h.logDebug(`Calling onNodeOutput hook for sink node ${n}`);let e=t.hooks.onNodeOutput({output:m,nodeId:n,flowId:i,jobId:u,storageId:r,clientId:d});m=yield*h.isEffect(e)?e:h.promise(()=>e)}return b&&(yield*b.recordSuccess()),o&&(yield*o({jobId:u,flowId:i,nodeId:n,eventType:j.NodeEnd,nodeName:p.name,result:m})),{nodeId:n,result:m,success:!0,waiting:!1,nodeType:f.nodeType}}catch(t){if(w=t instanceof e?t:e.fromCode(`FLOW_NODE_ERROR`,{cause:t}),b&&(yield*b.recordFailure(w.body)),x<m){x++;let e=v?g*2**(x-1):g;yield*h.logWarning(`Node ${n} (${p.name}) failed, retrying (${x}/${m}) after ${e}ms`),yield*h.sleep(e);continue}return o&&(yield*o({jobId:u,flowId:i,nodeId:n,eventType:j.NodeError,nodeName:p.name,error:w.body,retryCount:x})),yield*w.toEffect()}return w?yield*w.toEffect():yield*e.fromCode(`FLOW_NODE_ERROR`,{cause:Error(`Unexpected error in retry loop`)}).toEffect()}).pipe((()=>{let e=l.get(n),t=e?.nodeTypeId??e?.type??`unknown`;return h.withSpan(`node-${t}`,{attributes:{"node.id":n,"node.type":e?.type??`unknown`,"node.type_id":e?.nodeTypeId??`unknown`,"node.name":e?.name??`unknown`,"flow.id":i,"flow.job_id":u}})})()),M=({inputs:n,storageId:a,jobId:s,resumeFrom:c,clientId:u})=>h.gen(function*(){let f=yield*h.serviceOption(r),p=f._tag===`Some`?new ee(f.value):null;!c&&o&&(yield*o({jobId:s,eventType:j.FlowStart,flowId:i}));let g=w(n||{}),_,v,y;c?(_=c.executionOrder,v=c.nodeResults,y=c.currentIndex):(_=b(),v=new Map,y=0);let S=new Map;if(_.length!==m.length)return yield*e.fromCode(`FLOW_CYCLE_ERROR`).toEffect();let C=new Map(m.map(e=>[e.id,e]));if(t.parallelExecution?.enabled??!1){yield*h.logDebug(`Flow ${i}: Executing in parallel mode (maxConcurrency: ${t.parallelExecution?.maxConcurrency??4})`);let e=new Se({maxConcurrency:t.parallelExecution?.maxConcurrency??4}),n=e.groupNodesByExecutionLevel(m,l);yield*h.logDebug(`Flow ${i}: Grouped nodes into ${n.length} execution levels`);let r={};m.forEach(e=>{r[e.id]=[]}),l.forEach(e=>{r[e.target]?.push(e.source)});for(let t of n){yield*h.logDebug(`Flow ${i}: Executing level ${t.level} with nodes: ${t.nodes.join(`, `)}`);let n=t.nodes.map(e=>()=>h.gen(function*(){if(c&&e===c.executionOrder[y]&&o){let t=C.get(e);t&&(yield*o({jobId:s,flowId:i,nodeId:e,eventType:j.NodeResume,nodeName:t.name,nodeType:t.type}))}return{nodeId:e,nodeResult:yield*A(e,a,g,v,C,s,u,p)}})),r=yield*e.executeNodesInParallel(n);for(let{nodeId:e,nodeResult:t}of r){if(t.waiting)return t.result!==void 0&&(v.set(e,t.result),t.nodeType&&S.set(e,t.nodeType)),{type:`paused`,nodeId:e,executionState:{executionOrder:_,currentIndex:_.indexOf(e),inputs:g}};t.success&&(v.set(e,t.result),t.nodeType&&S.set(e,t.nodeType))}}}else{yield*h.logDebug(`Flow ${i}: Executing in sequential mode`);for(let t=y;t<_.length;t++){let n=_[t];if(!n)return yield*e.fromCode(`FLOW_NODE_NOT_FOUND`).toEffect();if(c&&t===y&&o){let e=C.get(n);e&&(yield*o({jobId:s,flowId:i,nodeId:n,eventType:j.NodeResume,nodeName:e.name,nodeType:e.type}))}let r=yield*A(n,a,g,v,C,s,u,p);if(r.waiting)return r.result!==void 0&&(v.set(r.nodeId,r.result),r.nodeType&&S.set(r.nodeId,r.nodeType)),{type:`paused`,nodeId:r.nodeId,executionState:{executionOrder:_,currentIndex:t,inputs:g}};r.success&&(v.set(r.nodeId,r.result),r.nodeType&&S.set(r.nodeId,r.nodeType))}}let T=D(v),k=O(v,S),M=x.record(x.string(),d).safeParse(T);if(!M.success){let t=`Flow output validation failed: ${M.error.message}. Expected outputs: ${JSON.stringify(Object.keys(D(v)))}. Output nodes (sinks + keepOutput): ${m.filter(e=>E(e.id)).map(e=>e.id).join(`, `)}`;return o&&(yield*o({jobId:s,eventType:j.FlowError,flowId:i,error:t})),yield*e.fromCode(`FLOW_OUTPUT_VALIDATION_ERROR`,{body:t,cause:M.error}).toEffect()}let N=M.data;return o&&(yield*o({jobId:s,eventType:j.FlowEnd,flowId:i,outputs:k,result:N})),{type:`completed`,result:N,outputs:k}});return{id:i,name:a,nodes:m,edges:l,inputSchema:u,outputSchema:d,onEvent:o,checkJobStatus:c,hooks:t.hooks,run:({inputs:e,storageId:t,jobId:n,clientId:r})=>M({inputs:e,storageId:t,jobId:n,clientId:r}),resume:({jobId:e,storageId:t,nodeResults:n,executionState:r,clientId:i})=>M({inputs:r.inputs,storageId:t,jobId:e,resumeFrom:{executionOrder:r.executionOrder,nodeResults:new Map(Object.entries(n)),currentIndex:r.currentIndex},clientId:i}),validateTypes:()=>{let e=m;return g.validateFlow(e,l)},validateInputs:e=>g.validateData(e,u),validateOutputs:e=>g.validateData(e,d)}})}var Z=class e extends m.Tag(`FlowWaitUntil`)(){static optional=h.serviceOption(e)},Ie=class extends m.Tag(`FlowProvider`)(){},Le=class extends m.Tag(`FlowEngine`)(){};const Re=e=>typeof e==`object`&&!!e&&`id`in e,ze=e=>typeof e==`object`&&e&&`nodeId`in e&&`data`in e&&`timestamp`in e?e.data:e;function Be(t,n,r){let i=e=>{let i=t=>h.gen(function*(){let n=yield*r.get(e);n&&(yield*r.set(e,{...n,...t,updatedAt:new Date}))});return a=>h.gen(function*(){switch(t.onEvent&&(yield*h.catchAll(t.onEvent(a),e=>(h.logError(`Original onEvent failed`,e),h.succeed({eventId:null})))),yield*n.emit(e,a),h.logInfo(`Updating job ${e} with event ${a.eventType}`),a.eventType){case j.FlowStart:yield*i({status:`running`});break;case j.FlowEnd:yield*h.gen(function*(){let t=yield*r.get(e);t&&a.outputs&&(yield*r.set(e,{...t,result:a.outputs,updatedAt:new Date}))});break;case j.FlowError:yield*i({status:`failed`,error:a.error});break;case j.NodeStart:yield*h.gen(function*(){let t=yield*r.get(e);if(t){let n=t.tasks.find(e=>e.nodeId===a.nodeId)?t.tasks.map(e=>e.nodeId===a.nodeId?{...e,status:`running`,updatedAt:new Date}:e):[...t.tasks,{nodeId:a.nodeId,status:`running`,createdAt:new Date,updatedAt:new Date}];yield*r.set(e,{...t,tasks:n,updatedAt:new Date})}});break;case j.NodePause:yield*h.gen(function*(){let t=yield*r.get(e);if(t){let n=t.tasks.find(e=>e.nodeId===a.nodeId)?t.tasks.map(e=>e.nodeId===a.nodeId?{...e,status:`paused`,result:a.partialData,updatedAt:new Date}:e):[...t.tasks,{nodeId:a.nodeId,status:`paused`,result:a.partialData,createdAt:new Date,updatedAt:new Date}];yield*r.set(e,{...t,tasks:n,updatedAt:new Date})}});break;case j.NodeResume:yield*h.gen(function*(){let t=yield*r.get(e);if(t){let n=t.tasks.map(e=>e.nodeId===a.nodeId?{...e,status:`running`,updatedAt:new Date}:e);yield*r.set(e,{...t,tasks:n,updatedAt:new Date})}});break;case j.NodeEnd:yield*h.gen(function*(){let n=yield*r.get(e);if(n){let i=n.tasks.map(e=>e.nodeId===a.nodeId?{...e,status:`completed`,result:a.result,updatedAt:new Date}:e),o=!t.edges.some(e=>e.source===a.nodeId),s=t.nodes.find(e=>e.id===a.nodeId)?.keepOutput===!0,c=a.result,l=ze(c),u=n.intermediateFiles||[],d=o||s;d&&Re(l)&&l.id?(u=u.filter(e=>e!==l.id),s&&!o&&h.logInfo(`Preserving output from node ${a.nodeId} due to keepOutput flag`)):!d&&Re(l)&&l.id&&(u.includes(l.id)||u.push(l.id)),yield*r.set(e,{...n,tasks:i,intermediateFiles:u,updatedAt:new Date})}});break;case j.NodeError:yield*h.gen(function*(){let t=yield*r.get(e);if(t){let n=t.tasks.map(e=>e.nodeId===a.nodeId?{...e,status:`failed`,error:a.error,retryCount:a.retryCount,updatedAt:new Date}:e);yield*r.set(e,{...t,tasks:n,error:a.error,updatedAt:new Date})}});break}return{eventId:e}})},a=t=>t=>h.gen(function*(){let n=yield*r.get(t);return n?n.status===`paused`?`paused`:n.status===`cancelled`?`cancelled`:`running`:yield*h.fail(e.fromCode(`FLOW_JOB_NOT_FOUND`,{cause:`Job ${t} not found`}))});return{...t,run:e=>h.gen(function*(){let n=e.jobId||crypto.randomUUID(),r=i(n),o=a(n);return yield*(yield*X({flowId:t.id,name:t.name,nodes:t.nodes,edges:t.edges,inputSchema:t.inputSchema,outputSchema:t.outputSchema,onEvent:r,checkJobStatus:o})).run({...e,jobId:n,clientId:e.clientId})}),resume:e=>h.gen(function*(){let n=e.jobId,r=i(n),o=a(n);return yield*(yield*X({flowId:t.id,name:t.name,nodes:t.nodes,edges:t.edges,inputSchema:t.inputSchema,outputSchema:t.outputSchema,onEvent:r,checkJobStatus:o})).resume(e)})}}function Ve(){return h.gen(function*(){let t=yield*Ie,n=yield*l,r=yield*u,i=yield*f,a=yield*q.optional,o=(t,n)=>h.gen(function*(){let i=yield*r.get(t);return i?yield*r.set(t,{...i,...n}):yield*h.fail(e.fromCode(`FLOW_JOB_NOT_FOUND`,{cause:`Job ${t} not found`}))}),s=(e,t)=>h.gen(function*(){let n=yield*r.get(e);!n||!n.intermediateFiles||n.intermediateFiles.length===0||(yield*h.logInfo(`Cleaning up ${n.intermediateFiles.length} intermediate files for job ${e}`),yield*h.all(n.intermediateFiles.map(e=>h.gen(function*(){yield*i.delete(e,t),yield*h.logDebug(`Deleted intermediate file ${e}`)}).pipe(h.catchAll(t=>h.gen(function*(){return yield*h.logWarning(`Failed to delete intermediate file ${e}: ${t}`),h.succeed(void 0)})))),{concurrency:5}),yield*o(e,{intermediateFiles:[]}))}),c=(e,t)=>h.gen(function*(){if(_.isNone(a)){yield*h.logDebug(`[FlowServer] DLQ not configured, skipping for job: ${e}`);return}let n=a.value,i=yield*h.catchAll(r.get(e),()=>h.succeed(null));if(!i){yield*h.logWarning(`[FlowServer] Job ${e} not found when adding to DLQ`);return}yield*h.catchAll(n.add(i,t),t=>h.gen(function*(){return yield*h.logError(`[FlowServer] Failed to add job ${e} to DLQ`,t),h.succeed(void 0)})),yield*h.logInfo(`[FlowServer] Added job ${e} to Dead Letter Queue`)}),d=h.gen(function*(){let e=yield*h.currentSpan.pipe(h.option);return _.match(e,{onNone:()=>void 0,onSome:e=>({traceId:e.traceId,spanId:e.spanId,traceFlags:e.sampled?1:0})})}),p=({jobId:t,flow:i,storageId:a,clientId:l,inputs:u})=>h.gen(function*(){return console.log(`[FlowServer] executeFlowInBackground started for job: ${t}`),yield*o(t,{status:`running`,traceContext:yield*d}),yield*h.gen(function*(){console.log(`[FlowServer] Creating flowWithEvents for job: ${t}`);let e=Be(i,n,r);console.log(`[FlowServer] Running flow for job: ${t}`);let c=yield*e.run({inputs:u,storageId:a,jobId:t,clientId:l});return console.log(`[FlowServer] Flow completed for job: ${t}, result type: ${c.type}`),c.type===`paused`?yield*o(t,{status:`paused`,pausedAt:c.nodeId,executionState:c.executionState,updatedAt:new Date}):(yield*o(t,{status:`completed`,updatedAt:new Date,endedAt:new Date}),yield*s(t,l)),c}).pipe(h.withSpan(`flow-execution`,{attributes:{"flow.id":i.id,"flow.name":i.name,"flow.job_id":t,"flow.storage_id":a,"flow.node_count":i.nodes.length}}))}).pipe(h.withSpan(`flow`,{attributes:{"flow.id":i.id,"flow.name":i.name,"flow.job_id":t,"flow.storage_id":a,"flow.node_count":i.nodes.length}}),h.catchAll(a=>h.gen(function*(){yield*h.logError(`Flow execution failed`,a);let u=a instanceof e?a.body:String(a);yield*h.logInfo(`Updating job ${t} to failed status with error: ${u}`),yield*o(t,{status:`failed`,error:u,updatedAt:new Date}).pipe(h.catchAll(e=>h.gen(function*(){return yield*h.logError(`Failed to update job ${t}`,e),h.succeed(void 0)})));let d=yield*r.get(t);throw d&&(yield*n.emit(t,{jobId:t,eventType:j.FlowError,flowId:d.flowId,error:u}).pipe(h.catchAll(e=>h.gen(function*(){return yield*h.logError(`Failed to emit FlowError event for job ${t}`,e),h.succeed(void 0)})))),i.onEvent&&(yield*i.onEvent({jobId:t,eventType:j.FlowError,flowId:i.id,error:u}).pipe(h.catchAll(e=>h.gen(function*(){return yield*h.logError(`Failed to call flow.onEvent for FlowError event for job ${t}`,e),h.succeed({eventId:null})})))),yield*s(t,l).pipe(h.catchAll(e=>h.gen(function*(){return yield*h.logWarning(`Failed to cleanup intermediate files for job ${t}`,e),h.succeed(void 0)}))),yield*c(t,a instanceof e?a:new e({code:`UNKNOWN_ERROR`,status:500,body:String(a),cause:a})),a})));return{getFlow:(e,n)=>h.gen(function*(){return yield*t.getFlow(e,n)}),getFlowData:(e,n)=>h.gen(function*(){return Fe(yield*t.getFlow(e,n))}),runFlow:({flowId:n,storageId:i,clientId:a,inputs:o})=>h.gen(function*(){let s=yield*Z.optional,c=yield*h.try({try:()=>kt.parse({inputs:o}),catch:t=>e.fromCode(`FLOW_INPUT_VALIDATION_ERROR`,{cause:t})}),l=crypto.randomUUID(),u=new Date,d={id:l,flowId:n,storageId:i,clientId:a,status:`started`,createdAt:u,updatedAt:u,tasks:[]};yield*r.set(l,d);let f=yield*t.getFlow(n,a);console.log(`[FlowServer] About to fork flow execution for job: ${l}`);let m=p({jobId:l,flow:f,storageId:i,clientId:a,inputs:c.inputs}).pipe(h.tapErrorCause(e=>h.logError(`Flow execution failed`,e)));if(_.isSome(s)){console.log(`[FlowServer] Using waitUntil for job: ${l}`);let e=yield*h.runtime(),t=v.runPromise(e)(m);s.value(t)}else console.log(`[FlowServer] Using Effect.forkDaemon for job: ${l}`),yield*h.forkDaemon(m);return console.log(`[FlowServer] Flow execution started for job: ${l}`),d}),getJobStatus:t=>h.gen(function*(){return(yield*r.get(t))||(yield*h.fail(e.fromCode(`FLOW_JOB_NOT_FOUND`,{cause:`Job ${t} not found`})))}),resumeFlow:({jobId:i,nodeId:a,newData:l,clientId:u})=>h.gen(function*(){let d=yield*Z.optional,f=yield*r.get(i);if(!f)return console.error(`Job not found`),yield*h.fail(e.fromCode(`FLOW_JOB_NOT_FOUND`,{cause:`Job ${i} not found`}));if(f.status!==`paused`)return console.error(`Job is not paused`),yield*h.fail(e.fromCode(`FLOW_JOB_ERROR`,{cause:`Job ${i} is not paused (status: ${f.status})`}));if(f.pausedAt!==a)return console.error(`Job is not paused at the expected node`),yield*h.fail(e.fromCode(`FLOW_JOB_ERROR`,{cause:`Job ${i} is paused at node ${f.pausedAt}, not ${a}`}));if(!f.executionState)return console.error(`Job has no execution state`),yield*h.fail(e.fromCode(`FLOW_JOB_ERROR`,{cause:`Job ${i} has no execution state`}));let p={...f.tasks.reduce((e,t)=>(t.result!==void 0&&(e[t.nodeId]=t.result),e),{}),[a]:l},m={...f.executionState.inputs,[a]:l};yield*o(i,{status:`running`});let g=yield*t.getFlow(f.flowId,f.clientId),y=f.traceContext?b.externalSpan({traceId:f.traceContext.traceId,spanId:f.traceContext.spanId,sampled:f.traceContext.traceFlags===1}):void 0,x=h.gen(function*(){let t=Be(g,n,r);if(!f.executionState)return yield*h.fail(e.fromCode(`FLOW_JOB_ERROR`,{cause:`Job ${i} has no execution state`}));let a=yield*t.resume({jobId:i,storageId:f.storageId,nodeResults:p,executionState:{...f.executionState,inputs:m},clientId:f.clientId});return a.type===`paused`?yield*o(i,{status:`paused`,pausedAt:a.nodeId,executionState:a.executionState,updatedAt:new Date}):(yield*o(i,{status:`completed`,pausedAt:void 0,executionState:void 0,updatedAt:new Date,endedAt:new Date}),yield*s(i,u)),a}).pipe(h.withSpan(`flow-execution-resume`,{attributes:{"flow.id":g.id,"flow.name":g.name,"flow.job_id":i,"flow.storage_id":f.storageId,"flow.resumed_from_node":a},parent:y})).pipe(h.catchAll(t=>h.gen(function*(){yield*h.logError(`Flow resume failed`,t);let a=t instanceof e?t.body:String(t);yield*h.logInfo(`Updating job ${i} to failed status with error: ${a}`),yield*o(i,{status:`failed`,error:a,updatedAt:new Date}).pipe(h.catchAll(e=>h.gen(function*(){return yield*h.logError(`Failed to update job ${i}`,e),h.succeed(void 0)})));let l=yield*r.get(i);throw l&&(yield*n.emit(i,{jobId:i,eventType:j.FlowError,flowId:l.flowId,error:a}).pipe(h.catchAll(e=>h.gen(function*(){return yield*h.logError(`Failed to emit FlowError event for job ${i}`,e),h.succeed(void 0)})))),yield*s(i,u).pipe(h.catchAll(e=>h.gen(function*(){return yield*h.logWarning(`Failed to cleanup intermediate files for job ${i}`,e),h.succeed(void 0)}))),yield*c(i,t instanceof e?t:new e({code:`UNKNOWN_ERROR`,status:500,body:String(t),cause:t})),t}))).pipe(h.tapErrorCause(e=>h.logError(`Flow resume failed`,e)));if(_.isSome(d)){console.log(`[FlowServer] Using waitUntil for resume job: ${i}`);let e=yield*h.runtime(),t=v.runPromise(e)(x);d.value(t)}else console.log(`[FlowServer] Using Effect.forkDaemon for resume job: ${i}`),yield*h.forkDaemon(x);return(yield*r.get(i))||(yield*h.fail(e.fromCode(`FLOW_JOB_NOT_FOUND`,{cause:`Job ${i} not found after update`})))}),pauseFlow:(t,i)=>h.gen(function*(){let a=yield*r.get(t);if(!a)return yield*h.fail(e.fromCode(`FLOW_JOB_NOT_FOUND`,{cause:`Job ${t} not found`}));if(i!==null&&a.clientId!==i)return yield*h.fail(e.fromCode(`FLOW_NOT_AUTHORIZED`,{cause:`Client ${i} is not authorized to pause job ${t}`}));if(a.status!==`running`)return yield*h.fail(e.fromCode(`FLOW_JOB_ERROR`,{cause:`Job ${t} cannot be paused (current status: ${a.status})`}));let s=a.tasks.find(e=>e.status===`running`)?.nodeId;return yield*o(t,{status:`paused`,pausedAt:s,updatedAt:new Date}),yield*n.emit(t,{jobId:t,flowId:a.flowId,eventType:j.FlowPause,pausedAt:s}),(yield*r.get(t))||(yield*h.fail(e.fromCode(`FLOW_JOB_NOT_FOUND`,{cause:`Job ${t} not found after pause`})))}),cancelFlow:(t,i)=>h.gen(function*(){let a=yield*r.get(t);return a?i!==null&&a.clientId!==i?yield*h.fail(e.fromCode(`FLOW_NOT_AUTHORIZED`,{cause:`Client ${i} is not authorized to cancel job ${t}`})):a.status!==`running`&&a.status!==`paused`&&a.status!==`started`?yield*h.fail(e.fromCode(`FLOW_JOB_ERROR`,{cause:`Job ${t} cannot be cancelled (current status: ${a.status})`})):(yield*o(t,{status:`cancelled`,updatedAt:new Date,endedAt:new Date}),yield*n.emit(t,{jobId:t,flowId:a.flowId,eventType:j.FlowCancel}),yield*s(t,i),(yield*r.get(t))||(yield*h.fail(e.fromCode(`FLOW_JOB_NOT_FOUND`,{cause:`Job ${t} not found after cancellation`})))):yield*h.fail(e.fromCode(`FLOW_JOB_NOT_FOUND`,{cause:`Job ${t} not found`}))}),subscribeToFlowEvents:(e,t)=>h.gen(function*(){yield*n.subscribe(e,t)}),unsubscribeFromFlowEvents:e=>h.gen(function*(){yield*n.unsubscribe(e)})}})}const He=g.effect(Le,Ve());function Ue(e){let t=e.lastIndexOf(`.`);return t===-1||t===0?e:e.substring(0,t)}function We(e){let t=e.lastIndexOf(`.`);return t===-1||t===0?``:e.substring(t+1)}function Q(e,t,n){let r=e.metadata??{},i=r.fileName??r.originalName??r.name??`unnamed`;return{baseName:Ue(i),extension:We(i),fileName:i,nodeType:t.nodeType,nodeId:t.nodeId,flowId:t.flowId,jobId:t.jobId,timestamp:new Date().toISOString(),...n}}function Ge(e,t){try{let n={};for(let[e,r]of Object.entries(t))r!==void 0&&(n[e]=String(r));return S(e,n)}catch{return e}}function Ke(e,t,n){let r=t.fileName;if(!n)return r;try{if(n.mode===`auto`){if(n.autoSuffix){let e=n.autoSuffix(t);if(e){let{baseName:n,extension:r}=t;return r?`${n}-${e}.${r}`:`${n}-${e}`}}return r}if(n.mode===`custom`){if(n.rename)return n.rename(e,t)||r;if(n.pattern)return Ge(n.pattern,t)||r}return r}catch{return r}}function qe(e){if(!e||e.trim()===``)return{isValid:!1,error:`Pattern cannot be empty`};let t=(e.match(/\{\{/g)||[]).length,n=(e.match(/\}\}/g)||[]).length;if(t!==n)return{isValid:!1,error:`Unbalanced braces: ${t} opening, ${n} closing`};let r=e.match(/\{\{[^}]*[^a-zA-Z0-9_}][^}]*\}\}/g);return r?{isValid:!1,error:`Invalid variable syntax: ${r[0]}`}:{isValid:!0}}const Je=[{name:`baseName`,description:`Filename without extension`,example:`photo`},{name:`extension`,description:`File extension without dot`,example:`jpg`},{name:`fileName`,description:`Full original filename`,example:`photo.jpg`},{name:`nodeType`,description:`Type of processing node`,example:`resize`},{name:`nodeId`,description:`Specific node instance ID`,example:`resize-1`},{name:`flowId`,description:`Flow identifier`,example:`flow-abc`},{name:`jobId`,description:`Execution job ID`,example:`job-123`},{name:`timestamp`,description:`ISO 8601 processing time`,example:`2024-01-15T10:30:00Z`},{name:`width`,description:`Output width (image/video)`,example:`800`},{name:`height`,description:`Output height (image/video)`,example:`600`},{name:`format`,description:`Output format`,example:`webp`},{name:`quality`,description:`Quality setting`,example:`80`},{name:`pageNumber`,description:`Page number (documents)`,example:`1`}];function $(e){return!(`stream`in e)}function Ye({id:e,name:t,description:r,outputTypeId:i,keepOutput:a,naming:o,nodeType:s=`transform`,nodeTypeId:l,namingVars:u,circuitBreaker:d,mode:p=`auto`,streamingConfig:m,transform:g,streamingTransform:_}){if(p===`streaming`&&!_)throw Error(`Transform node "${e}": mode is "streaming" but no streamingTransform function provided`);if(p===`buffered`&&!g)throw Error(`Transform node "${e}": mode is "buffered" but no transform function provided`);if(p===`auto`&&!g&&!_)throw Error(`Transform node "${e}": mode is "auto" but neither transform nor streamingTransform provided`);let v={...c,...m};return h.gen(function*(){let c=yield*f;return yield*I({id:e,name:t,description:r,type:F.process,outputTypeId:i,keepOutput:a,nodeTypeId:l,circuitBreaker:d,inputSchema:n,outputSchema:n,run:({data:t,storageId:n,flowId:r,jobId:i,clientId:a})=>h.gen(function*(){let l={flowId:r,nodeId:e,jobId:i},d=yield*h.gen(function*(){if(p===`buffered`)return!1;if(p===`streaming`)return!0;let e=t.size??0,r=v.fileSizeThreshold;return e>0&&e<r?(yield*h.logDebug(`File ${t.id} (${e} bytes) below threshold (${r}), using buffered mode`),!1):_?(yield*c.getCapabilities(n,a)).supportsStreamingRead?(yield*h.logDebug(`File ${t.id} qualifies for streaming mode`),!0):(yield*h.logDebug(`DataStore doesn't support streaming read, using buffered mode`),!1):(yield*h.logDebug(`No streamingTransform function, using buffered mode`),!1)}),{type:f,fileName:m,metadata:b,metadataJson:x}=z(t.metadata);if(d&&_){yield*h.logDebug(`Using streaming transform for ${t.id}`);let d=yield*_(yield*c.readStream(t.id,a,v),t),p=$(d)?d:d.stream,g=$(d)?void 0:d.type,S=$(d)?void 0:d.estimatedSize,C=$(d)?void 0:d.fileName;!C&&o&&(C=Ke(t,Q(t,{flowId:r,jobId:i,nodeId:e,nodeType:s},u),o));let w=yield*c.getCapabilities(n,a),T;if(w.supportsStreamingWrite)yield*h.logDebug(`Using streaming write for ${t.id} - no intermediate buffering`),T=yield*c.uploadStream({storageId:n,uploadLengthDeferred:!0,sizeHint:S,type:g??f,fileName:C??m,lastModified:0,metadata:x,flow:l},a,p);else{yield*h.logDebug(`Falling back to buffered upload for ${t.id} (streaming write not supported)`);let e=[];yield*y.runForEach(p,t=>h.sync(()=>{e.push(t)}));let r=e.reduce((e,t)=>e+t.byteLength,0),i=new Uint8Array(r),o=0;for(let t of e)i.set(t,o),o+=t.byteLength;let s=new ReadableStream({start(e){e.enqueue(i),e.close()}});T=yield*c.upload({storageId:n,size:i.byteLength,type:g??f,fileName:C??m,lastModified:0,metadata:x,flow:l},a,s)}let E=b?{...b,...g&&{mimeType:g,type:g,"content-type":g},...C&&{fileName:C,originalName:C,name:C,extension:C.split(`.`).pop()||b.extension}}:T.metadata;return R(E?{...T,metadata:E}:T)}if(!g)throw Error(`Transform node "${e}": buffered mode selected but no transform function provided`);let S=yield*g(yield*c.read(t.id,a),t),C=S instanceof Uint8Array?S:S.bytes,w=S instanceof Uint8Array?void 0:S.type,T=S instanceof Uint8Array?void 0:S.fileName,E=S instanceof Uint8Array?void 0:S.metadata;!T&&o&&(T=Ke(t,Q(t,{flowId:r,jobId:i,nodeId:e,nodeType:s},u),o));let D=new ReadableStream({start(e){e.enqueue(C),e.close()}}),O=yield*c.upload({storageId:n,size:C.byteLength,type:w??f,fileName:T??m,lastModified:0,metadata:x,flow:l},a,D),k=b?{...b,...E,...w&&{mimeType:w,type:w,"content-type":w},...T&&{fileName:T,originalName:T,name:T,extension:T.split(`.`).pop()||b.extension}}:O.metadata;return R(k?{...O,metadata:k}:O)})})})}var Xe=class extends m.Tag(`CredentialProvider`)(){},Ze=class extends m.Tag(`DocumentAiPlugin`)(){},Qe=class extends m.Tag(`DocumentPlugin`)(){},$e=class extends m.Tag(`ImageAiPlugin`)(){},et=class extends m.Tag(`ImagePlugin`)(){};const tt=x.object({serviceType:x.enum([`replicate`]).optional()}),nt=x.object({duration:x.number().nonnegative(),width:x.number().positive(),height:x.number().positive(),codec:x.string(),format:x.string(),bitrate:x.number().nonnegative(),frameRate:x.number().positive(),aspectRatio:x.string(),hasAudio:x.boolean(),audioCodec:x.string().optional(),audioBitrate:x.number().nonnegative().optional(),size:x.number().nonnegative()}),rt=x.object({timestamp:x.number().nonnegative(),format:x.enum([`png`,`jpeg`]).optional(),quality:x.number().min(1).max(100).optional()}),it=x.object({quality:x.number().min(0).max(100),format:x.enum([`jpeg`,`webp`,`png`,`avif`])}),at=x.object({serviceType:x.enum([`replicate`]).optional()}),ot=x.object({width:x.number().positive().optional(),height:x.number().positive().optional(),fit:x.enum([`contain`,`cover`,`fill`])}).refine(e=>e.width||e.height,`Either width or height must be specified for resize`),st=x.object({width:x.number().positive().optional(),height:x.number().positive().optional(),aspectRatio:x.enum([`keep`,`ignore`]).optional(),scaling:x.enum([`bicubic`,`bilinear`,`lanczos`]).optional()}).refine(e=>e.width||e.height,`Either width or height must be specified for video resize`),ct=x.object({format:x.enum([`mp4`,`webm`,`mov`,`avi`]),codec:x.enum([`h264`,`h265`,`vp9`,`av1`]).optional(),videoBitrate:x.string().optional(),audioBitrate:x.string().optional(),audioCodec:x.enum([`aac`,`mp3`,`opus`,`vorbis`]).optional()}),lt=x.object({type:x.literal(`resize`),width:x.number().positive().optional(),height:x.number().positive().optional(),fit:x.enum([`contain`,`cover`,`fill`])}),ut=x.object({type:x.literal(`blur`),sigma:x.number().min(.3).max(1e3)}),dt=x.object({type:x.literal(`rotate`),angle:x.number(),background:x.string().optional()}),ft=x.object({type:x.literal(`flip`),direction:x.enum([`horizontal`,`vertical`])}),pt=x.object({type:x.literal(`grayscale`)}),mt=x.object({type:x.literal(`sepia`)}),ht=x.object({type:x.literal(`brightness`),value:x.number().min(-100).max(100)}),gt=x.object({type:x.literal(`contrast`),value:x.number().min(-100).max(100)}),_t=x.object({type:x.literal(`sharpen`),sigma:x.number().positive().optional()}),vt=x.object({type:x.literal(`watermark`),imagePath:x.string().min(1).url(),position:x.enum([`top-left`,`top-right`,`bottom-left`,`bottom-right`,`center`]),opacity:x.number().min(0).max(1),offsetX:x.number().optional(),offsetY:x.number().optional()}),yt=x.object({type:x.literal(`logo`),imagePath:x.string().min(1).url(),position:x.enum([`top-left`,`top-right`,`bottom-left`,`bottom-right`,`center`]),scale:x.number().min(.1).max(2),offsetX:x.number().optional(),offsetY:x.number().optional()}),bt=x.object({type:x.literal(`text`),text:x.string().min(1),position:x.enum([`top-left`,`top-right`,`bottom-left`,`bottom-right`,`center`]),fontSize:x.number().positive(),color:x.string().min(1),fontFamily:x.string().optional(),offsetX:x.number().optional(),offsetY:x.number().optional()}),xt=x.discriminatedUnion(`type`,[lt,ut,dt,ft,pt,mt,ht,gt,_t,vt,yt,bt]),St=x.object({transformations:x.array(xt).min(1)}),Ct=x.object({startTime:x.number().nonnegative(),endTime:x.number().positive().optional(),duration:x.number().positive().optional()}).refine(e=>!e.endTime||!e.duration,`Cannot specify both endTime and duration`).refine(e=>!e.endTime||e.endTime>e.startTime,`endTime must be greater than startTime`);var wt=class extends m.Tag(`VideoPlugin`)(){},Tt=class extends m.Tag(`VirusScanPlugin`)(){},Et=class extends m.Tag(`ZipPlugin`)(){};const Dt=(e,t)=>{if(e.length===0)return t;let[n,...r]=e;return r.reduce((e,t)=>x.union([e,t]),n)};function Ot(t){return h.gen(function*(){let n=Object.entries(t.nodes),r=e=>h.isEffect(e)?e:h.succeed(e),i=yield*h.forEach(n,([t,n])=>h.flatMap(r(n),n=>n.id===t?h.succeed([t,n]):h.fail(e.fromCode(`FLOW_NODE_ERROR`,{cause:Error(`Node key ${t} does not match node id ${n.id}`)})))),a=Object.fromEntries(i),o=i.map(([,e])=>e),s=i.filter(([,e])=>e.type===F.input).map(([,e])=>e.inputSchema),c=t.edges.map(e=>({source:a[e.source]?.id??e.source,target:a[e.target]?.id??e.target,sourcePort:e.sourcePort,targetPort:e.targetPort})),l=new Set(i.map(([e])=>a[e]?.id).filter(e=>e&&!c.some(t=>t.source===e))),u=i.filter(([,e])=>l.has(e.id)).map(([,e])=>e.outputSchema),d=t.inputSchema??Dt(s,x.unknown()),f=t.outputSchema??Dt(u,x.unknown());return yield*X({flowId:t.flowId,name:t.name,nodes:o,edges:c,inputSchema:d,outputSchema:f,typeChecker:t.typeChecker,onEvent:t.onEvent,parallelExecution:t.parallelExecution,hooks:t.hooks,circuitBreaker:t.circuitBreaker})})}const kt=x.object({inputs:x.record(x.string(),x.any())});export{De as $,$e as A,oe as At,Ge as B,te as Bt,ot as C,he as Ct,nt as D,R as Dt,rt as E,z as Et,Je as F,ne as Ft,Ve as G,D as Gt,Le as H,A as Ht,Ke as I,P as It,Fe as J,O as Jt,He as K,T as Kt,Q as L,re as Lt,Ze as M,F as Mt,Xe as N,I as Nt,tt as O,L as Ot,Ye as P,ie as Pt,ke as Q,Ue as R,M as Rt,st as S,ge as St,it as T,pe as Tt,Ie as U,k as Ut,qe as V,j as Vt,Z as W,ee as Wt,Y as X,J as Y,C as Yt,Oe as Z,bt as _,U as _t,wt as a,we as at,vt as b,W as bt,ht as c,Ne as ct,pt as d,be as dt,Ae as et,yt as f,xe as ft,_t as g,ve as gt,mt as h,ye as ht,Tt as i,Te as it,Qe as j,se as jt,et as k,ae as kt,gt as l,Se as lt,dt as m,K as mt,Ot as n,Ee as nt,Ct as o,Ce as ot,lt as p,G as pt,X as q,E as qt,Et as r,je as rt,ut as s,Pe as st,kt as t,Me as tt,ft as u,q as ut,St as v,H as vt,at as w,B as wt,ct as x,_e as xt,xt as y,V as yt,We as z,N as zt};
|
|
2
|
+
//# sourceMappingURL=flow-CA8xO6wP.mjs.map
|