@uploadista/core 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +5 -0
- package/.turbo/turbo-check.log +231 -0
- package/.turbo/turbo-format.log +5 -0
- package/LICENSE +21 -0
- package/README.md +1120 -0
- package/dist/chunk-CUT6urMc.cjs +1 -0
- package/dist/debounce-C2SeqcxD.js +2 -0
- package/dist/debounce-C2SeqcxD.js.map +1 -0
- package/dist/debounce-LZK7yS7Z.cjs +1 -0
- package/dist/errors/index.cjs +1 -0
- package/dist/errors/index.d.cts +3 -0
- package/dist/errors/index.d.ts +3 -0
- package/dist/errors/index.d.ts.map +1 -0
- package/dist/errors/index.js +2 -0
- package/dist/errors/uploadista-error.d.ts +209 -0
- package/dist/errors/uploadista-error.d.ts.map +1 -0
- package/dist/errors/uploadista-error.js +322 -0
- package/dist/errors-8i_aMxOE.js +1 -0
- package/dist/errors-CRm1FHHT.cjs +0 -0
- package/dist/flow/edge.d.ts +47 -0
- package/dist/flow/edge.d.ts.map +1 -0
- package/dist/flow/edge.js +40 -0
- package/dist/flow/event.d.ts +206 -0
- package/dist/flow/event.d.ts.map +1 -0
- package/dist/flow/event.js +53 -0
- package/dist/flow/flow-server.d.ts +223 -0
- package/dist/flow/flow-server.d.ts.map +1 -0
- package/dist/flow/flow-server.js +614 -0
- package/dist/flow/flow.d.ts +238 -0
- package/dist/flow/flow.d.ts.map +1 -0
- package/dist/flow/flow.js +629 -0
- package/dist/flow/index.cjs +1 -0
- package/dist/flow/index.d.cts +6 -0
- package/dist/flow/index.d.ts +24 -0
- package/dist/flow/index.d.ts.map +1 -0
- package/dist/flow/index.js +24 -0
- package/dist/flow/node.d.ts +136 -0
- package/dist/flow/node.d.ts.map +1 -0
- package/dist/flow/node.js +153 -0
- package/dist/flow/nodes/index.d.ts +8 -0
- package/dist/flow/nodes/index.d.ts.map +1 -0
- package/dist/flow/nodes/index.js +7 -0
- package/dist/flow/nodes/input-node.d.ts +78 -0
- package/dist/flow/nodes/input-node.d.ts.map +1 -0
- package/dist/flow/nodes/input-node.js +233 -0
- package/dist/flow/nodes/storage-node.d.ts +67 -0
- package/dist/flow/nodes/storage-node.d.ts.map +1 -0
- package/dist/flow/nodes/storage-node.js +94 -0
- package/dist/flow/nodes/streaming-input-node.d.ts +69 -0
- package/dist/flow/nodes/streaming-input-node.d.ts.map +1 -0
- package/dist/flow/nodes/streaming-input-node.js +156 -0
- package/dist/flow/nodes/transform-node.d.ts +85 -0
- package/dist/flow/nodes/transform-node.d.ts.map +1 -0
- package/dist/flow/nodes/transform-node.js +107 -0
- package/dist/flow/parallel-scheduler.d.ts +175 -0
- package/dist/flow/parallel-scheduler.d.ts.map +1 -0
- package/dist/flow/parallel-scheduler.js +193 -0
- package/dist/flow/plugins/credential-provider.d.ts +47 -0
- package/dist/flow/plugins/credential-provider.d.ts.map +1 -0
- package/dist/flow/plugins/credential-provider.js +24 -0
- package/dist/flow/plugins/image-ai-plugin.d.ts +61 -0
- package/dist/flow/plugins/image-ai-plugin.d.ts.map +1 -0
- package/dist/flow/plugins/image-ai-plugin.js +21 -0
- package/dist/flow/plugins/image-plugin.d.ts +52 -0
- package/dist/flow/plugins/image-plugin.d.ts.map +1 -0
- package/dist/flow/plugins/image-plugin.js +22 -0
- package/dist/flow/plugins/types/describe-image-node.d.ts +16 -0
- package/dist/flow/plugins/types/describe-image-node.d.ts.map +1 -0
- package/dist/flow/plugins/types/describe-image-node.js +9 -0
- package/dist/flow/plugins/types/index.d.ts +9 -0
- package/dist/flow/plugins/types/index.d.ts.map +1 -0
- package/dist/flow/plugins/types/index.js +8 -0
- package/dist/flow/plugins/types/optimize-node.d.ts +20 -0
- package/dist/flow/plugins/types/optimize-node.d.ts.map +1 -0
- package/dist/flow/plugins/types/optimize-node.js +11 -0
- package/dist/flow/plugins/types/remove-background-node.d.ts +16 -0
- package/dist/flow/plugins/types/remove-background-node.d.ts.map +1 -0
- package/dist/flow/plugins/types/remove-background-node.js +9 -0
- package/dist/flow/plugins/types/resize-node.d.ts +21 -0
- package/dist/flow/plugins/types/resize-node.d.ts.map +1 -0
- package/dist/flow/plugins/types/resize-node.js +16 -0
- package/dist/flow/plugins/zip-plugin.d.ts +62 -0
- package/dist/flow/plugins/zip-plugin.d.ts.map +1 -0
- package/dist/flow/plugins/zip-plugin.js +21 -0
- package/dist/flow/typed-flow.d.ts +90 -0
- package/dist/flow/typed-flow.d.ts.map +1 -0
- package/dist/flow/typed-flow.js +59 -0
- package/dist/flow/types/flow-file.d.ts +45 -0
- package/dist/flow/types/flow-file.d.ts.map +1 -0
- package/dist/flow/types/flow-file.js +27 -0
- package/dist/flow/types/flow-job.d.ts +118 -0
- package/dist/flow/types/flow-job.d.ts.map +1 -0
- package/dist/flow/types/flow-job.js +11 -0
- package/dist/flow/types/flow-types.d.ts +321 -0
- package/dist/flow/types/flow-types.d.ts.map +1 -0
- package/dist/flow/types/flow-types.js +52 -0
- package/dist/flow/types/index.d.ts +4 -0
- package/dist/flow/types/index.d.ts.map +1 -0
- package/dist/flow/types/index.js +3 -0
- package/dist/flow/types/run-args.d.ts +38 -0
- package/dist/flow/types/run-args.d.ts.map +1 -0
- package/dist/flow/types/run-args.js +30 -0
- package/dist/flow/types/type-validator.d.ts +26 -0
- package/dist/flow/types/type-validator.d.ts.map +1 -0
- package/dist/flow/types/type-validator.js +134 -0
- package/dist/flow/utils/resolve-upload-metadata.d.ts +11 -0
- package/dist/flow/utils/resolve-upload-metadata.d.ts.map +1 -0
- package/dist/flow/utils/resolve-upload-metadata.js +28 -0
- package/dist/flow-2zXnEiWL.cjs +1 -0
- package/dist/flow-CRaKy7Vj.js +2 -0
- package/dist/flow-CRaKy7Vj.js.map +1 -0
- package/dist/generate-id-Dm-Vboxq.d.ts +34 -0
- package/dist/generate-id-Dm-Vboxq.d.ts.map +1 -0
- package/dist/generate-id-LjJRLD6N.d.cts +34 -0
- package/dist/generate-id-LjJRLD6N.d.cts.map +1 -0
- package/dist/generate-id-xHp_Z7Cl.cjs +1 -0
- package/dist/generate-id-yohS1ZDk.js +2 -0
- package/dist/generate-id-yohS1ZDk.js.map +1 -0
- package/dist/index-BO8GZlbD.d.cts +1040 -0
- package/dist/index-BO8GZlbD.d.cts.map +1 -0
- package/dist/index-BoGG5KAY.d.ts +1 -0
- package/dist/index-BtBZHVmz.d.cts +1 -0
- package/dist/index-D-CoVpkZ.d.ts +1004 -0
- package/dist/index-D-CoVpkZ.d.ts.map +1 -0
- package/dist/index.cjs +1 -0
- package/dist/index.d.cts +6 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +5 -0
- package/dist/logger/logger.cjs +1 -0
- package/dist/logger/logger.d.cts +8 -0
- package/dist/logger/logger.d.cts.map +1 -0
- package/dist/logger/logger.d.ts +5 -0
- package/dist/logger/logger.d.ts.map +1 -0
- package/dist/logger/logger.js +10 -0
- package/dist/logger/logger.js.map +1 -0
- package/dist/semaphore-0ZwjVpyF.js +2 -0
- package/dist/semaphore-0ZwjVpyF.js.map +1 -0
- package/dist/semaphore-BHprIjFI.d.cts +37 -0
- package/dist/semaphore-BHprIjFI.d.cts.map +1 -0
- package/dist/semaphore-DThupBkc.d.ts +37 -0
- package/dist/semaphore-DThupBkc.d.ts.map +1 -0
- package/dist/semaphore-DVrONiAV.cjs +1 -0
- package/dist/stream-limiter-CoWKv39w.js +2 -0
- package/dist/stream-limiter-CoWKv39w.js.map +1 -0
- package/dist/stream-limiter-JgOwmkMa.cjs +1 -0
- package/dist/streams/multi-stream.cjs +1 -0
- package/dist/streams/multi-stream.d.cts +91 -0
- package/dist/streams/multi-stream.d.cts.map +1 -0
- package/dist/streams/multi-stream.d.ts +86 -0
- package/dist/streams/multi-stream.d.ts.map +1 -0
- package/dist/streams/multi-stream.js +149 -0
- package/dist/streams/multi-stream.js.map +1 -0
- package/dist/streams/stream-limiter.cjs +1 -0
- package/dist/streams/stream-limiter.d.cts +36 -0
- package/dist/streams/stream-limiter.d.cts.map +1 -0
- package/dist/streams/stream-limiter.d.ts +27 -0
- package/dist/streams/stream-limiter.d.ts.map +1 -0
- package/dist/streams/stream-limiter.js +49 -0
- package/dist/streams/stream-splitter.cjs +1 -0
- package/dist/streams/stream-splitter.d.cts +68 -0
- package/dist/streams/stream-splitter.d.cts.map +1 -0
- package/dist/streams/stream-splitter.d.ts +51 -0
- package/dist/streams/stream-splitter.d.ts.map +1 -0
- package/dist/streams/stream-splitter.js +175 -0
- package/dist/streams/stream-splitter.js.map +1 -0
- package/dist/types/data-store-registry.d.ts +13 -0
- package/dist/types/data-store-registry.d.ts.map +1 -0
- package/dist/types/data-store-registry.js +4 -0
- package/dist/types/data-store.d.ts +316 -0
- package/dist/types/data-store.d.ts.map +1 -0
- package/dist/types/data-store.js +157 -0
- package/dist/types/event-broadcaster.d.ts +28 -0
- package/dist/types/event-broadcaster.d.ts.map +1 -0
- package/dist/types/event-broadcaster.js +6 -0
- package/dist/types/event-emitter.d.ts +378 -0
- package/dist/types/event-emitter.d.ts.map +1 -0
- package/dist/types/event-emitter.js +223 -0
- package/dist/types/index.cjs +1 -0
- package/dist/types/index.d.cts +6 -0
- package/dist/types/index.d.ts +10 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +9 -0
- package/dist/types/input-file.d.ts +104 -0
- package/dist/types/input-file.d.ts.map +1 -0
- package/dist/types/input-file.js +27 -0
- package/dist/types/kv-store.d.ts +281 -0
- package/dist/types/kv-store.d.ts.map +1 -0
- package/dist/types/kv-store.js +234 -0
- package/dist/types/middleware.d.ts +17 -0
- package/dist/types/middleware.d.ts.map +1 -0
- package/dist/types/middleware.js +21 -0
- package/dist/types/upload-event.d.ts +105 -0
- package/dist/types/upload-event.d.ts.map +1 -0
- package/dist/types/upload-event.js +71 -0
- package/dist/types/upload-file.d.ts +136 -0
- package/dist/types/upload-file.d.ts.map +1 -0
- package/dist/types/upload-file.js +34 -0
- package/dist/types/websocket.d.ts +144 -0
- package/dist/types/websocket.d.ts.map +1 -0
- package/dist/types/websocket.js +40 -0
- package/dist/types-BT-cvi7T.cjs +1 -0
- package/dist/types-DhU2j-XF.js +2 -0
- package/dist/types-DhU2j-XF.js.map +1 -0
- package/dist/upload/convert-to-stream.d.ts +38 -0
- package/dist/upload/convert-to-stream.d.ts.map +1 -0
- package/dist/upload/convert-to-stream.js +43 -0
- package/dist/upload/convert-upload-to-flow-file.d.ts +14 -0
- package/dist/upload/convert-upload-to-flow-file.d.ts.map +1 -0
- package/dist/upload/convert-upload-to-flow-file.js +21 -0
- package/dist/upload/create-upload.d.ts +68 -0
- package/dist/upload/create-upload.d.ts.map +1 -0
- package/dist/upload/create-upload.js +157 -0
- package/dist/upload/index.cjs +1 -0
- package/dist/upload/index.d.cts +6 -0
- package/dist/upload/index.d.ts +4 -0
- package/dist/upload/index.d.ts.map +1 -0
- package/dist/upload/index.js +3 -0
- package/dist/upload/mime.d.ts +24 -0
- package/dist/upload/mime.d.ts.map +1 -0
- package/dist/upload/mime.js +351 -0
- package/dist/upload/upload-chunk.d.ts +58 -0
- package/dist/upload/upload-chunk.d.ts.map +1 -0
- package/dist/upload/upload-chunk.js +277 -0
- package/dist/upload/upload-server.d.ts +221 -0
- package/dist/upload/upload-server.d.ts.map +1 -0
- package/dist/upload/upload-server.js +181 -0
- package/dist/upload/upload-strategy-negotiator.d.ts +148 -0
- package/dist/upload/upload-strategy-negotiator.d.ts.map +1 -0
- package/dist/upload/upload-strategy-negotiator.js +217 -0
- package/dist/upload/upload-url.d.ts +68 -0
- package/dist/upload/upload-url.d.ts.map +1 -0
- package/dist/upload/upload-url.js +142 -0
- package/dist/upload/write-to-store.d.ts +77 -0
- package/dist/upload/write-to-store.d.ts.map +1 -0
- package/dist/upload/write-to-store.js +147 -0
- package/dist/upload-DLuICjpP.cjs +1 -0
- package/dist/upload-DaXO34dE.js +2 -0
- package/dist/upload-DaXO34dE.js.map +1 -0
- package/dist/uploadista-error-BB-Wdiz9.cjs +22 -0
- package/dist/uploadista-error-BVsVxqvz.js +23 -0
- package/dist/uploadista-error-BVsVxqvz.js.map +1 -0
- package/dist/uploadista-error-CwxYs4EB.d.ts +52 -0
- package/dist/uploadista-error-CwxYs4EB.d.ts.map +1 -0
- package/dist/uploadista-error-kKlhLRhY.d.cts +52 -0
- package/dist/uploadista-error-kKlhLRhY.d.cts.map +1 -0
- package/dist/utils/checksum.d.ts +22 -0
- package/dist/utils/checksum.d.ts.map +1 -0
- package/dist/utils/checksum.js +49 -0
- package/dist/utils/debounce.cjs +1 -0
- package/dist/utils/debounce.d.cts +38 -0
- package/dist/utils/debounce.d.cts.map +1 -0
- package/dist/utils/debounce.d.ts +36 -0
- package/dist/utils/debounce.d.ts.map +1 -0
- package/dist/utils/debounce.js +73 -0
- package/dist/utils/generate-id.cjs +1 -0
- package/dist/utils/generate-id.d.cts +2 -0
- package/dist/utils/generate-id.d.ts +32 -0
- package/dist/utils/generate-id.d.ts.map +1 -0
- package/dist/utils/generate-id.js +23 -0
- package/dist/utils/md5.cjs +1 -0
- package/dist/utils/md5.d.cts +73 -0
- package/dist/utils/md5.d.cts.map +1 -0
- package/dist/utils/md5.d.ts +71 -0
- package/dist/utils/md5.d.ts.map +1 -0
- package/dist/utils/md5.js +417 -0
- package/dist/utils/md5.js.map +1 -0
- package/dist/utils/once.cjs +1 -0
- package/dist/utils/once.d.cts +25 -0
- package/dist/utils/once.d.cts.map +1 -0
- package/dist/utils/once.d.ts +21 -0
- package/dist/utils/once.d.ts.map +1 -0
- package/dist/utils/once.js +54 -0
- package/dist/utils/once.js.map +1 -0
- package/dist/utils/semaphore.cjs +1 -0
- package/dist/utils/semaphore.d.cts +3 -0
- package/dist/utils/semaphore.d.ts +78 -0
- package/dist/utils/semaphore.d.ts.map +1 -0
- package/dist/utils/semaphore.js +134 -0
- package/dist/utils/throttle.cjs +1 -0
- package/dist/utils/throttle.d.cts +24 -0
- package/dist/utils/throttle.d.cts.map +1 -0
- package/dist/utils/throttle.d.ts +18 -0
- package/dist/utils/throttle.d.ts.map +1 -0
- package/dist/utils/throttle.js +20 -0
- package/dist/utils/throttle.js.map +1 -0
- package/docs/PARALLEL_EXECUTION.md +206 -0
- package/docs/PARALLEL_EXECUTION_QUICKSTART.md +142 -0
- package/docs/PARALLEL_EXECUTION_REFACTOR.md +184 -0
- package/package.json +80 -0
- package/src/errors/__tests__/uploadista-error.test.ts +251 -0
- package/src/errors/index.ts +2 -0
- package/src/errors/uploadista-error.ts +394 -0
- package/src/flow/README.md +352 -0
- package/src/flow/edge.test.ts +146 -0
- package/src/flow/edge.ts +60 -0
- package/src/flow/event.ts +229 -0
- package/src/flow/flow-server.ts +1089 -0
- package/src/flow/flow.ts +1050 -0
- package/src/flow/index.ts +28 -0
- package/src/flow/node.ts +249 -0
- package/src/flow/nodes/index.ts +8 -0
- package/src/flow/nodes/input-node.ts +296 -0
- package/src/flow/nodes/storage-node.ts +128 -0
- package/src/flow/nodes/transform-node.ts +154 -0
- package/src/flow/parallel-scheduler.ts +259 -0
- package/src/flow/plugins/credential-provider.ts +48 -0
- package/src/flow/plugins/image-ai-plugin.ts +66 -0
- package/src/flow/plugins/image-plugin.ts +60 -0
- package/src/flow/plugins/types/describe-image-node.ts +16 -0
- package/src/flow/plugins/types/index.ts +9 -0
- package/src/flow/plugins/types/optimize-node.ts +18 -0
- package/src/flow/plugins/types/remove-background-node.ts +18 -0
- package/src/flow/plugins/types/resize-node.ts +26 -0
- package/src/flow/plugins/zip-plugin.ts +69 -0
- package/src/flow/typed-flow.ts +279 -0
- package/src/flow/types/flow-file.ts +51 -0
- package/src/flow/types/flow-job.ts +138 -0
- package/src/flow/types/flow-types.ts +353 -0
- package/src/flow/types/index.ts +6 -0
- package/src/flow/types/run-args.ts +40 -0
- package/src/flow/types/type-validator.ts +204 -0
- package/src/flow/utils/resolve-upload-metadata.ts +48 -0
- package/src/index.ts +5 -0
- package/src/logger/logger.ts +14 -0
- package/src/streams/stream-limiter.test.ts +150 -0
- package/src/streams/stream-limiter.ts +75 -0
- package/src/types/data-store.ts +427 -0
- package/src/types/event-broadcaster.ts +39 -0
- package/src/types/event-emitter.ts +349 -0
- package/src/types/index.ts +9 -0
- package/src/types/input-file.ts +107 -0
- package/src/types/kv-store.ts +375 -0
- package/src/types/middleware.ts +54 -0
- package/src/types/upload-event.ts +75 -0
- package/src/types/upload-file.ts +139 -0
- package/src/types/websocket.ts +65 -0
- package/src/upload/convert-to-stream.ts +48 -0
- package/src/upload/create-upload.ts +214 -0
- package/src/upload/index.ts +3 -0
- package/src/upload/mime.ts +436 -0
- package/src/upload/upload-chunk.ts +364 -0
- package/src/upload/upload-server.ts +390 -0
- package/src/upload/upload-strategy-negotiator.ts +316 -0
- package/src/upload/upload-url.ts +173 -0
- package/src/upload/write-to-store.ts +211 -0
- package/src/utils/checksum.ts +61 -0
- package/src/utils/debounce.test.ts +126 -0
- package/src/utils/debounce.ts +89 -0
- package/src/utils/generate-id.ts +35 -0
- package/src/utils/md5.ts +475 -0
- package/src/utils/once.test.ts +83 -0
- package/src/utils/once.ts +63 -0
- package/src/utils/throttle.test.ts +101 -0
- package/src/utils/throttle.ts +29 -0
- package/tsconfig.json +20 -0
- package/tsconfig.tsbuildinfo +1 -0
- package/tsdown.config.ts +25 -0
- package/vitest.config.ts +15 -0
|
@@ -0,0 +1,1040 @@
|
|
|
1
|
+
import { UploadistaError as UploadistaError$1 } from "./uploadista-error-kKlhLRhY.cjs";
|
|
2
|
+
import { GenerateId, GenerateIdShape } from "./generate-id-LjJRLD6N.cjs";
|
|
3
|
+
import { Semaphore } from "./semaphore-BHprIjFI.cjs";
|
|
4
|
+
import * as effect_Types0 from "effect/Types";
|
|
5
|
+
import * as effect_Cause0 from "effect/Cause";
|
|
6
|
+
import { Context, Effect, Layer, Stream } from "effect";
|
|
7
|
+
import z$1, { z } from "zod";
|
|
8
|
+
|
|
9
|
+
//#region src/flow/node.d.ts
|
|
10
|
+
declare enum NodeType {
|
|
11
|
+
input = "input",
|
|
12
|
+
process = "process",
|
|
13
|
+
output = "output",
|
|
14
|
+
conditional = "conditional",
|
|
15
|
+
multiplex = "multiplex",
|
|
16
|
+
merge = "merge",
|
|
17
|
+
}
|
|
18
|
+
type ConditionField = "mimeType" | "size" | "width" | "height" | "extension";
|
|
19
|
+
type ConditionOperator = "equals" | "notEquals" | "greaterThan" | "lessThan" | "contains" | "startsWith";
|
|
20
|
+
type ConditionValue = string | number;
|
|
21
|
+
declare function createFlowNode<Input, Output, Requirements = never>({
|
|
22
|
+
id,
|
|
23
|
+
name,
|
|
24
|
+
description,
|
|
25
|
+
type,
|
|
26
|
+
inputSchema,
|
|
27
|
+
outputSchema,
|
|
28
|
+
run,
|
|
29
|
+
condition,
|
|
30
|
+
multiInput,
|
|
31
|
+
multiOutput,
|
|
32
|
+
pausable
|
|
33
|
+
}: {
|
|
34
|
+
id: string;
|
|
35
|
+
name: string;
|
|
36
|
+
description: string;
|
|
37
|
+
type: NodeType;
|
|
38
|
+
inputSchema: z.ZodSchema<Input>;
|
|
39
|
+
outputSchema: z.ZodSchema<Output>;
|
|
40
|
+
run: (args: {
|
|
41
|
+
data: Input;
|
|
42
|
+
runId: string;
|
|
43
|
+
storageId: string;
|
|
44
|
+
flowId: string;
|
|
45
|
+
}) => Effect.Effect<NodeExecutionResult<Output>, UploadistaError$1, Requirements>;
|
|
46
|
+
condition?: {
|
|
47
|
+
field: ConditionField;
|
|
48
|
+
operator: ConditionOperator;
|
|
49
|
+
value: ConditionValue;
|
|
50
|
+
};
|
|
51
|
+
multiInput?: boolean;
|
|
52
|
+
multiOutput?: boolean;
|
|
53
|
+
pausable?: boolean;
|
|
54
|
+
}): Effect.Effect<FlowNode<Input, Output, UploadistaError$1, Requirements>, UploadistaError$1>;
|
|
55
|
+
declare const getNodeData: <Requirements>(node: FlowNode<any, any, UploadistaError$1, Requirements>) => FlowNodeData;
|
|
56
|
+
//#endregion
|
|
57
|
+
//#region src/flow/event.d.ts
|
|
58
|
+
declare enum EventType {
|
|
59
|
+
JobStart = "job-start",
|
|
60
|
+
JobEnd = "job-end",
|
|
61
|
+
FlowStart = "flow-start",
|
|
62
|
+
FlowEnd = "flow-end",
|
|
63
|
+
NodeStart = "node-start",
|
|
64
|
+
NodeEnd = "node-end",
|
|
65
|
+
NodeError = "node-error",
|
|
66
|
+
NodeStream = "node-stream",
|
|
67
|
+
NodeResponse = "node-response",
|
|
68
|
+
}
|
|
69
|
+
type FlowEventJobStart = {
|
|
70
|
+
jobId: string;
|
|
71
|
+
eventType: EventType.JobStart;
|
|
72
|
+
};
|
|
73
|
+
type FlowEventJobEnd = {
|
|
74
|
+
eventId: string;
|
|
75
|
+
jobId: string;
|
|
76
|
+
eventType: EventType.JobEnd;
|
|
77
|
+
};
|
|
78
|
+
type FlowEventFlowStart = {
|
|
79
|
+
jobId: string;
|
|
80
|
+
flowId: string;
|
|
81
|
+
eventType: EventType.FlowStart;
|
|
82
|
+
};
|
|
83
|
+
type FlowEventFlowEnd = {
|
|
84
|
+
eventId: string;
|
|
85
|
+
jobId: string;
|
|
86
|
+
flowId: string;
|
|
87
|
+
eventType: EventType.FlowEnd;
|
|
88
|
+
};
|
|
89
|
+
type FlowEventNodeStart = {
|
|
90
|
+
jobId: string;
|
|
91
|
+
flowId: string;
|
|
92
|
+
nodeId: string;
|
|
93
|
+
eventType: EventType.NodeStart;
|
|
94
|
+
nodeName: string;
|
|
95
|
+
nodeType: NodeType;
|
|
96
|
+
};
|
|
97
|
+
type FlowEventNodeError = {
|
|
98
|
+
eventId: string;
|
|
99
|
+
jobId: string;
|
|
100
|
+
flowId: string;
|
|
101
|
+
nodeId: string;
|
|
102
|
+
nodeName: string;
|
|
103
|
+
eventType: EventType.NodeError;
|
|
104
|
+
error: string;
|
|
105
|
+
};
|
|
106
|
+
type FlowEventNodeEnd = {
|
|
107
|
+
eventId: string;
|
|
108
|
+
jobId: string;
|
|
109
|
+
flowId: string;
|
|
110
|
+
nodeId: string;
|
|
111
|
+
eventType: EventType.NodeEnd;
|
|
112
|
+
nodeName: string;
|
|
113
|
+
};
|
|
114
|
+
type FlowEventNodeResponse = {
|
|
115
|
+
jobId: string;
|
|
116
|
+
flowId: string;
|
|
117
|
+
nodeId: string;
|
|
118
|
+
eventType: EventType.NodeResponse;
|
|
119
|
+
nodeName: string;
|
|
120
|
+
data: unknown;
|
|
121
|
+
};
|
|
122
|
+
type FlowEvent = FlowEventJobStart | FlowEventJobEnd | FlowEventFlowStart | FlowEventFlowEnd | FlowEventNodeStart | FlowEventNodeEnd | FlowEventNodeError;
|
|
123
|
+
//#endregion
|
|
124
|
+
//#region src/flow/types/flow-types.d.ts
|
|
125
|
+
type NodeTypeMap = Record<string, {
|
|
126
|
+
input: unknown;
|
|
127
|
+
output: unknown;
|
|
128
|
+
}>;
|
|
129
|
+
type FlowNodeData = {
|
|
130
|
+
id: string;
|
|
131
|
+
name: string;
|
|
132
|
+
description: string;
|
|
133
|
+
type: NodeType;
|
|
134
|
+
};
|
|
135
|
+
type NodeExecutionResult<TOutput> = {
|
|
136
|
+
type: "complete";
|
|
137
|
+
data: TOutput;
|
|
138
|
+
} | {
|
|
139
|
+
type: "waiting";
|
|
140
|
+
partialData?: unknown;
|
|
141
|
+
};
|
|
142
|
+
declare const completeNodeExecution: <TOutput>(data: TOutput) => {
|
|
143
|
+
type: "complete";
|
|
144
|
+
data: TOutput;
|
|
145
|
+
};
|
|
146
|
+
declare const waitingNodeExecution: (partialData?: unknown) => {
|
|
147
|
+
type: "waiting";
|
|
148
|
+
partialData: unknown;
|
|
149
|
+
};
|
|
150
|
+
type FlowNode<TInput = unknown, TOutput = unknown, TError = UploadistaError$1, TRequirements = never> = FlowNodeData & {
|
|
151
|
+
inputSchema: z.ZodSchema<TInput>;
|
|
152
|
+
outputSchema: z.ZodSchema<TOutput>;
|
|
153
|
+
run: (args: {
|
|
154
|
+
data: TInput;
|
|
155
|
+
runId: string;
|
|
156
|
+
storageId: string;
|
|
157
|
+
flowId: string;
|
|
158
|
+
inputs?: Record<string, unknown>;
|
|
159
|
+
}) => Effect.Effect<NodeExecutionResult<TOutput>, TError, TRequirements>;
|
|
160
|
+
condition?: {
|
|
161
|
+
field: string;
|
|
162
|
+
operator: string;
|
|
163
|
+
value: unknown;
|
|
164
|
+
};
|
|
165
|
+
multiInput?: boolean;
|
|
166
|
+
multiOutput?: boolean;
|
|
167
|
+
pausable?: boolean;
|
|
168
|
+
};
|
|
169
|
+
type FlowEdge$1 = {
|
|
170
|
+
source: string;
|
|
171
|
+
target: string;
|
|
172
|
+
sourcePort?: string;
|
|
173
|
+
targetPort?: string;
|
|
174
|
+
};
|
|
175
|
+
type TypeCompatibilityChecker = (from: z.ZodSchema<any>, to: z.ZodSchema<any>) => boolean;
|
|
176
|
+
type NodeConnectionValidator = {
|
|
177
|
+
validateConnection: (sourceNode: FlowNode<any, any>, targetNode: FlowNode<any, any>, edge: FlowEdge$1) => boolean;
|
|
178
|
+
getCompatibleTypes: (sourceSchema: z.ZodSchema<any>, targetSchema: z.ZodSchema<any>) => boolean;
|
|
179
|
+
};
|
|
180
|
+
type FlowConfig<TFlowInputSchema extends z.ZodSchema<any>, TFlowOutputSchema extends z.ZodSchema<any>, TRequirements> = {
|
|
181
|
+
flowId: string;
|
|
182
|
+
name: string;
|
|
183
|
+
nodes: Array<FlowNode<any, any, UploadistaError$1, TRequirements>>;
|
|
184
|
+
edges: FlowEdge$1[];
|
|
185
|
+
inputSchema: TFlowInputSchema;
|
|
186
|
+
outputSchema: TFlowOutputSchema;
|
|
187
|
+
typeChecker?: TypeCompatibilityChecker;
|
|
188
|
+
onEvent?: (event: FlowEvent) => Effect.Effect<{
|
|
189
|
+
eventId: string | null;
|
|
190
|
+
}, UploadistaError$1>;
|
|
191
|
+
parallelExecution?: {
|
|
192
|
+
enabled?: boolean;
|
|
193
|
+
maxConcurrency?: number;
|
|
194
|
+
};
|
|
195
|
+
};
|
|
196
|
+
type FlowExecutionContext = {
|
|
197
|
+
runId: string;
|
|
198
|
+
flowId: string;
|
|
199
|
+
nodeResults: Map<string, unknown>;
|
|
200
|
+
nodeInputs: Map<string, Record<string, unknown>>;
|
|
201
|
+
};
|
|
202
|
+
//#endregion
|
|
203
|
+
//#region src/flow/edge.d.ts
|
|
204
|
+
type FlowEdge = FlowEdge$1;
|
|
205
|
+
declare function createFlowEdge({
|
|
206
|
+
source,
|
|
207
|
+
target,
|
|
208
|
+
sourcePort,
|
|
209
|
+
targetPort
|
|
210
|
+
}: {
|
|
211
|
+
source: string;
|
|
212
|
+
target: string;
|
|
213
|
+
sourcePort?: string;
|
|
214
|
+
targetPort?: string;
|
|
215
|
+
}): FlowEdge;
|
|
216
|
+
//#endregion
|
|
217
|
+
//#region src/flow/flow.d.ts
|
|
218
|
+
type FlowData = {
|
|
219
|
+
id: string;
|
|
220
|
+
name: string;
|
|
221
|
+
nodes: FlowNodeData[];
|
|
222
|
+
edges: FlowEdge[];
|
|
223
|
+
};
|
|
224
|
+
declare const getFlowData: <TRequirements>(flow: Flow<any, any, TRequirements>) => FlowData;
|
|
225
|
+
type FlowExecutionResult<TOutput> = {
|
|
226
|
+
type: "completed";
|
|
227
|
+
result: TOutput;
|
|
228
|
+
} | {
|
|
229
|
+
type: "paused";
|
|
230
|
+
nodeId: string;
|
|
231
|
+
executionState: {
|
|
232
|
+
nodeResults: Record<string, unknown>;
|
|
233
|
+
executionOrder: string[];
|
|
234
|
+
currentIndex: number;
|
|
235
|
+
inputs: Record<string, unknown>;
|
|
236
|
+
};
|
|
237
|
+
};
|
|
238
|
+
type Flow<TFlowInputSchema extends z.ZodSchema<any>, TFlowOutputSchema extends z.ZodSchema<any>, TRequirements> = {
|
|
239
|
+
id: string;
|
|
240
|
+
name: string;
|
|
241
|
+
nodes: FlowNode<any, any, UploadistaError$1, TRequirements>[];
|
|
242
|
+
edges: FlowEdge[];
|
|
243
|
+
inputSchema: TFlowInputSchema;
|
|
244
|
+
outputSchema: TFlowOutputSchema;
|
|
245
|
+
run: (args: {
|
|
246
|
+
inputs?: Record<string, z.infer<TFlowInputSchema>>;
|
|
247
|
+
storageId: string;
|
|
248
|
+
jobId: string;
|
|
249
|
+
}) => Effect.Effect<FlowExecutionResult<z.infer<TFlowOutputSchema>>, UploadistaError$1, TRequirements>;
|
|
250
|
+
resume: (args: {
|
|
251
|
+
jobId: string;
|
|
252
|
+
storageId: string;
|
|
253
|
+
executionState: {
|
|
254
|
+
nodeResults: Record<string, unknown>;
|
|
255
|
+
executionOrder: string[];
|
|
256
|
+
currentIndex: number;
|
|
257
|
+
inputs: Record<string, z.infer<TFlowInputSchema>>;
|
|
258
|
+
};
|
|
259
|
+
}) => Effect.Effect<FlowExecutionResult<z.infer<TFlowOutputSchema>>, UploadistaError$1, TRequirements>;
|
|
260
|
+
validateTypes: () => {
|
|
261
|
+
isValid: boolean;
|
|
262
|
+
errors: string[];
|
|
263
|
+
};
|
|
264
|
+
validateInputs: (inputs: unknown) => {
|
|
265
|
+
isValid: boolean;
|
|
266
|
+
errors: string[];
|
|
267
|
+
};
|
|
268
|
+
validateOutputs: (outputs: unknown) => {
|
|
269
|
+
isValid: boolean;
|
|
270
|
+
errors: string[];
|
|
271
|
+
};
|
|
272
|
+
};
|
|
273
|
+
declare function createFlow<TFlowInputSchema extends z.ZodSchema<any>, TFlowOutputSchema extends z.ZodSchema<any>, TRequirements>({
|
|
274
|
+
flowId,
|
|
275
|
+
name,
|
|
276
|
+
onEvent,
|
|
277
|
+
edges,
|
|
278
|
+
nodes,
|
|
279
|
+
inputSchema,
|
|
280
|
+
outputSchema,
|
|
281
|
+
typeChecker
|
|
282
|
+
}: FlowConfig<TFlowInputSchema, TFlowOutputSchema, TRequirements>): Flow<TFlowInputSchema, TFlowOutputSchema, TRequirements>;
|
|
283
|
+
//#endregion
|
|
284
|
+
//#region src/types/upload-file.d.ts
|
|
285
|
+
declare const uploadFileSchema: z.ZodObject<{
|
|
286
|
+
id: z.ZodString;
|
|
287
|
+
size: z.ZodOptional<z.ZodNumber>;
|
|
288
|
+
offset: z.ZodNumber;
|
|
289
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
290
|
+
creationDate: z.ZodOptional<z.ZodString>;
|
|
291
|
+
url: z.ZodOptional<z.ZodString>;
|
|
292
|
+
sizeIsDeferred: z.ZodOptional<z.ZodBoolean>;
|
|
293
|
+
storage: z.ZodObject<{
|
|
294
|
+
id: z.ZodString;
|
|
295
|
+
type: z.ZodString;
|
|
296
|
+
path: z.ZodOptional<z.ZodString>;
|
|
297
|
+
uploadId: z.ZodOptional<z.ZodString>;
|
|
298
|
+
bucket: z.ZodOptional<z.ZodString>;
|
|
299
|
+
}, z.core.$strip>;
|
|
300
|
+
}, z.core.$strip>;
|
|
301
|
+
type UploadFile = {
|
|
302
|
+
id: string;
|
|
303
|
+
offset: number;
|
|
304
|
+
storage: {
|
|
305
|
+
id: string;
|
|
306
|
+
isBuffer?: boolean;
|
|
307
|
+
type: string;
|
|
308
|
+
path?: string | undefined;
|
|
309
|
+
uploadId?: string | undefined;
|
|
310
|
+
bucket?: string | undefined;
|
|
311
|
+
};
|
|
312
|
+
size?: number | undefined;
|
|
313
|
+
metadata?: Record<string, string> | undefined;
|
|
314
|
+
creationDate?: string | undefined;
|
|
315
|
+
url?: string | undefined;
|
|
316
|
+
sizeIsDeferred?: boolean | undefined;
|
|
317
|
+
};
|
|
318
|
+
//#endregion
|
|
319
|
+
//#region src/types/data-store.d.ts
|
|
320
|
+
type DataStoreWriteOptions = {
|
|
321
|
+
file_id: string;
|
|
322
|
+
stream: Stream.Stream<Uint8Array, UploadistaError$1>;
|
|
323
|
+
offset: number;
|
|
324
|
+
};
|
|
325
|
+
type UploadStrategy = "single" | "parallel";
|
|
326
|
+
type DataStoreCapabilities = {
|
|
327
|
+
supportsParallelUploads: boolean;
|
|
328
|
+
supportsConcatenation: boolean;
|
|
329
|
+
supportsDeferredLength: boolean;
|
|
330
|
+
supportsResumableUploads: boolean;
|
|
331
|
+
supportsTransactionalUploads: boolean;
|
|
332
|
+
maxConcurrentUploads?: number;
|
|
333
|
+
minChunkSize?: number;
|
|
334
|
+
maxChunkSize?: number;
|
|
335
|
+
maxParts?: number;
|
|
336
|
+
optimalChunkSize?: number;
|
|
337
|
+
requiresOrderedChunks: boolean;
|
|
338
|
+
};
|
|
339
|
+
type DataStore<TData = unknown> = {
|
|
340
|
+
readonly bucket?: string;
|
|
341
|
+
readonly path?: string;
|
|
342
|
+
readonly create: (file: TData) => Effect.Effect<TData, UploadistaError$1>;
|
|
343
|
+
readonly remove: (file_id: string) => Effect.Effect<void, UploadistaError$1>;
|
|
344
|
+
readonly read: (file_id: string) => Effect.Effect<Uint8Array, UploadistaError$1>;
|
|
345
|
+
readonly write: (options: DataStoreWriteOptions, dependencies: {
|
|
346
|
+
onProgress?: (chunkSize: number) => void;
|
|
347
|
+
}) => Effect.Effect<number, UploadistaError$1>;
|
|
348
|
+
readonly deleteExpired?: Effect.Effect<number, UploadistaError$1>;
|
|
349
|
+
readonly getCapabilities: () => DataStoreCapabilities;
|
|
350
|
+
readonly validateUploadStrategy: (strategy: UploadStrategy) => Effect.Effect<boolean, never>;
|
|
351
|
+
};
|
|
352
|
+
declare const UploadFileDataStore_base: Context.TagClass<UploadFileDataStore, "UploadFileDataStore", DataStore<UploadFile>>;
|
|
353
|
+
declare class UploadFileDataStore extends UploadFileDataStore_base {}
|
|
354
|
+
declare const BufferedUploadFileDataStore_base: Context.TagClass<BufferedUploadFileDataStore, "BufferedUploadFileDataStore", DataStore<UploadFile>>;
|
|
355
|
+
declare class BufferedUploadFileDataStore extends BufferedUploadFileDataStore_base {}
|
|
356
|
+
type UploadFileDataStoresShape = {
|
|
357
|
+
getDataStore: (storageId: string, isBuffer?: boolean) => Effect.Effect<DataStore<UploadFile>, UploadistaError$1>;
|
|
358
|
+
};
|
|
359
|
+
declare const UploadFileDataStores_base: Context.TagClass<UploadFileDataStores, "UploadFileDataStores", UploadFileDataStoresShape>;
|
|
360
|
+
declare class UploadFileDataStores extends UploadFileDataStores_base {}
|
|
361
|
+
//#endregion
|
|
362
|
+
//#region src/types/data-store-registry.d.ts
|
|
363
|
+
declare const DataStoreRegistry_base: Context.TagClass<DataStoreRegistry, "DataStoreRegistry", {
|
|
364
|
+
readonly register: <T extends DataStore<UploadFile>>(id: string, store: Effect.Effect<T, UploadistaError$1>) => Effect.Effect<void, never>;
|
|
365
|
+
readonly get: (id: string) => Effect.Effect<DataStore<UploadFile>, UploadistaError$1>;
|
|
366
|
+
readonly list: () => Effect.Effect<Array<string>, never>;
|
|
367
|
+
}>;
|
|
368
|
+
declare class DataStoreRegistry extends DataStoreRegistry_base {}
|
|
369
|
+
//#endregion
|
|
370
|
+
//#region src/types/upload-event.d.ts
|
|
371
|
+
declare enum UploadEventType {
|
|
372
|
+
UPLOAD_STARTED = "upload-started",
|
|
373
|
+
UPLOAD_PROGRESS = "upload-progress",
|
|
374
|
+
UPLOAD_COMPLETE = "upload-complete",
|
|
375
|
+
UPLOAD_FAILED = "upload-failed",
|
|
376
|
+
}
|
|
377
|
+
declare const uploadEventSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
378
|
+
type: z.ZodUnion<readonly [z.ZodLiteral<UploadEventType.UPLOAD_STARTED>, z.ZodLiteral<UploadEventType.UPLOAD_COMPLETE>]>;
|
|
379
|
+
data: z.ZodObject<{
|
|
380
|
+
id: z.ZodString;
|
|
381
|
+
size: z.ZodOptional<z.ZodNumber>;
|
|
382
|
+
offset: z.ZodNumber;
|
|
383
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
384
|
+
creationDate: z.ZodOptional<z.ZodString>;
|
|
385
|
+
url: z.ZodOptional<z.ZodString>;
|
|
386
|
+
sizeIsDeferred: z.ZodOptional<z.ZodBoolean>;
|
|
387
|
+
storage: z.ZodObject<{
|
|
388
|
+
id: z.ZodString;
|
|
389
|
+
type: z.ZodString;
|
|
390
|
+
path: z.ZodOptional<z.ZodString>;
|
|
391
|
+
uploadId: z.ZodOptional<z.ZodString>;
|
|
392
|
+
bucket: z.ZodOptional<z.ZodString>;
|
|
393
|
+
}, z.core.$strip>;
|
|
394
|
+
}, z.core.$strip>;
|
|
395
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
396
|
+
type: z.ZodLiteral<UploadEventType.UPLOAD_PROGRESS>;
|
|
397
|
+
data: z.ZodObject<{
|
|
398
|
+
id: z.ZodString;
|
|
399
|
+
progress: z.ZodNumber;
|
|
400
|
+
total: z.ZodNumber;
|
|
401
|
+
}, z.core.$strip>;
|
|
402
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
403
|
+
type: z.ZodLiteral<UploadEventType.UPLOAD_FAILED>;
|
|
404
|
+
data: z.ZodObject<{
|
|
405
|
+
id: z.ZodString;
|
|
406
|
+
error: z.ZodString;
|
|
407
|
+
}, z.core.$strip>;
|
|
408
|
+
}, z.core.$strip>]>;
|
|
409
|
+
type UploadEvent = z.infer<typeof uploadEventSchema>;
|
|
410
|
+
//#endregion
|
|
411
|
+
//#region src/types/websocket.d.ts
|
|
412
|
+
/**
|
|
413
|
+
* Platform-agnostic WebSocket connection interface
|
|
414
|
+
*/
|
|
415
|
+
interface WebSocketConnection {
|
|
416
|
+
send(data: string): void;
|
|
417
|
+
close(code?: number, reason?: string): void;
|
|
418
|
+
readonly readyState: number;
|
|
419
|
+
readonly id: string;
|
|
420
|
+
}
|
|
421
|
+
/**
|
|
422
|
+
* WebSocket message that can be sent/received
|
|
423
|
+
*/
|
|
424
|
+
declare const webSocketMessageSchema: z$1.ZodUnion<readonly [z$1.ZodObject<{
|
|
425
|
+
type: z$1.ZodLiteral<"upload_event">;
|
|
426
|
+
payload: z$1.ZodUnion<readonly [z$1.ZodObject<{
|
|
427
|
+
type: z$1.ZodUnion<readonly [z$1.ZodLiteral<UploadEventType.UPLOAD_STARTED>, z$1.ZodLiteral<UploadEventType.UPLOAD_COMPLETE>]>;
|
|
428
|
+
data: z$1.ZodObject<{
|
|
429
|
+
id: z$1.ZodString;
|
|
430
|
+
size: z$1.ZodOptional<z$1.ZodNumber>;
|
|
431
|
+
offset: z$1.ZodNumber;
|
|
432
|
+
metadata: z$1.ZodOptional<z$1.ZodRecord<z$1.ZodString, z$1.ZodString>>;
|
|
433
|
+
creationDate: z$1.ZodOptional<z$1.ZodString>;
|
|
434
|
+
url: z$1.ZodOptional<z$1.ZodString>;
|
|
435
|
+
sizeIsDeferred: z$1.ZodOptional<z$1.ZodBoolean>;
|
|
436
|
+
storage: z$1.ZodObject<{
|
|
437
|
+
id: z$1.ZodString;
|
|
438
|
+
type: z$1.ZodString;
|
|
439
|
+
path: z$1.ZodOptional<z$1.ZodString>;
|
|
440
|
+
uploadId: z$1.ZodOptional<z$1.ZodString>;
|
|
441
|
+
bucket: z$1.ZodOptional<z$1.ZodString>;
|
|
442
|
+
}, z$1.core.$strip>;
|
|
443
|
+
}, z$1.core.$strip>;
|
|
444
|
+
}, z$1.core.$strip>, z$1.ZodObject<{
|
|
445
|
+
type: z$1.ZodLiteral<UploadEventType.UPLOAD_PROGRESS>;
|
|
446
|
+
data: z$1.ZodObject<{
|
|
447
|
+
id: z$1.ZodString;
|
|
448
|
+
progress: z$1.ZodNumber;
|
|
449
|
+
total: z$1.ZodNumber;
|
|
450
|
+
}, z$1.core.$strip>;
|
|
451
|
+
}, z$1.core.$strip>, z$1.ZodObject<{
|
|
452
|
+
type: z$1.ZodLiteral<UploadEventType.UPLOAD_FAILED>;
|
|
453
|
+
data: z$1.ZodObject<{
|
|
454
|
+
id: z$1.ZodString;
|
|
455
|
+
error: z$1.ZodString;
|
|
456
|
+
}, z$1.core.$strip>;
|
|
457
|
+
}, z$1.core.$strip>]>;
|
|
458
|
+
timestamp: z$1.ZodOptional<z$1.ZodString>;
|
|
459
|
+
}, z$1.core.$strip>, z$1.ZodObject<{
|
|
460
|
+
type: z$1.ZodLiteral<"flow_event">;
|
|
461
|
+
payload: z$1.ZodAny;
|
|
462
|
+
timestamp: z$1.ZodOptional<z$1.ZodString>;
|
|
463
|
+
}, z$1.core.$strip>, z$1.ZodObject<{
|
|
464
|
+
type: z$1.ZodLiteral<"subscribed">;
|
|
465
|
+
payload: z$1.ZodObject<{
|
|
466
|
+
uploadId: z$1.ZodString;
|
|
467
|
+
}, z$1.core.$strip>;
|
|
468
|
+
timestamp: z$1.ZodOptional<z$1.ZodString>;
|
|
469
|
+
}, z$1.core.$strip>, z$1.ZodObject<{
|
|
470
|
+
type: z$1.ZodLiteral<"error">;
|
|
471
|
+
message: z$1.ZodOptional<z$1.ZodString>;
|
|
472
|
+
}, z$1.core.$strip>, z$1.ZodObject<{
|
|
473
|
+
type: z$1.ZodLiteral<"pong">;
|
|
474
|
+
timestamp: z$1.ZodOptional<z$1.ZodString>;
|
|
475
|
+
}, z$1.core.$strip>, z$1.ZodObject<{
|
|
476
|
+
type: z$1.ZodLiteral<"ping">;
|
|
477
|
+
timestamp: z$1.ZodOptional<z$1.ZodString>;
|
|
478
|
+
}, z$1.core.$strip>, z$1.ZodObject<{
|
|
479
|
+
type: z$1.ZodLiteral<"connection">;
|
|
480
|
+
message: z$1.ZodOptional<z$1.ZodString>;
|
|
481
|
+
uploadId: z$1.ZodOptional<z$1.ZodString>;
|
|
482
|
+
timestamp: z$1.ZodOptional<z$1.ZodString>;
|
|
483
|
+
}, z$1.core.$strip>]>;
|
|
484
|
+
type WebSocketMessage<TEvent = unknown> = z$1.infer<typeof webSocketMessageSchema> | {
|
|
485
|
+
type: "upload_event";
|
|
486
|
+
payload: TEvent;
|
|
487
|
+
timestamp?: string;
|
|
488
|
+
} | {
|
|
489
|
+
type: "flow_event";
|
|
490
|
+
payload: TEvent;
|
|
491
|
+
timestamp?: string;
|
|
492
|
+
};
|
|
493
|
+
//#endregion
|
|
494
|
+
//#region src/types/event-emitter.d.ts
|
|
495
|
+
interface BaseEventEmitter {
|
|
496
|
+
readonly subscribe: (key: string, connection: WebSocketConnection) => Effect.Effect<void, UploadistaError$1>;
|
|
497
|
+
readonly unsubscribe: (key: string) => Effect.Effect<void, UploadistaError$1>;
|
|
498
|
+
readonly emit: (key: string, event: string) => Effect.Effect<void, UploadistaError$1>;
|
|
499
|
+
}
|
|
500
|
+
type EventEmitter<TEvent> = {
|
|
501
|
+
readonly subscribe: (key: string, connection: WebSocketConnection) => Effect.Effect<void, UploadistaError$1>;
|
|
502
|
+
readonly unsubscribe: (key: string) => Effect.Effect<void, UploadistaError$1>;
|
|
503
|
+
readonly emit: (key: string, event: TEvent) => Effect.Effect<void, UploadistaError$1>;
|
|
504
|
+
};
|
|
505
|
+
declare class TypedEventEmitter<TEvent> implements EventEmitter<TEvent> {
|
|
506
|
+
private baseEmitter;
|
|
507
|
+
private eventToMessage;
|
|
508
|
+
constructor(baseEmitter: BaseEventEmitter, eventToMessage: (event: TEvent) => string);
|
|
509
|
+
subscribe: (key: string, connection: WebSocketConnection) => Effect.Effect<void, UploadistaError$1>;
|
|
510
|
+
unsubscribe: (key: string) => Effect.Effect<void, UploadistaError$1>;
|
|
511
|
+
emit: (key: string, event: TEvent) => Effect.Effect<void, UploadistaError$1>;
|
|
512
|
+
}
|
|
513
|
+
declare const eventToMessageSerializer: (messageType: "upload_event" | "flow_event") => {
|
|
514
|
+
eventToMessage: <T>(event: T) => string;
|
|
515
|
+
};
|
|
516
|
+
declare const BaseEventEmitterService_base: Context.TagClass<BaseEventEmitterService, "BaseEventEmitter", BaseEventEmitter>;
|
|
517
|
+
declare class BaseEventEmitterService extends BaseEventEmitterService_base {}
|
|
518
|
+
declare const UploadEventEmitter_base: Context.TagClass<UploadEventEmitter, "UploadEventEmitter", EventEmitter<{
|
|
519
|
+
type: UploadEventType.UPLOAD_STARTED | UploadEventType.UPLOAD_COMPLETE;
|
|
520
|
+
data: {
|
|
521
|
+
id: string;
|
|
522
|
+
offset: number;
|
|
523
|
+
storage: {
|
|
524
|
+
id: string;
|
|
525
|
+
type: string;
|
|
526
|
+
path?: string | undefined;
|
|
527
|
+
uploadId?: string | undefined;
|
|
528
|
+
bucket?: string | undefined;
|
|
529
|
+
};
|
|
530
|
+
size?: number | undefined;
|
|
531
|
+
metadata?: Record<string, string> | undefined;
|
|
532
|
+
creationDate?: string | undefined;
|
|
533
|
+
url?: string | undefined;
|
|
534
|
+
sizeIsDeferred?: boolean | undefined;
|
|
535
|
+
};
|
|
536
|
+
} | {
|
|
537
|
+
type: UploadEventType.UPLOAD_PROGRESS;
|
|
538
|
+
data: {
|
|
539
|
+
id: string;
|
|
540
|
+
progress: number;
|
|
541
|
+
total: number;
|
|
542
|
+
};
|
|
543
|
+
} | {
|
|
544
|
+
type: UploadEventType.UPLOAD_FAILED;
|
|
545
|
+
data: {
|
|
546
|
+
id: string;
|
|
547
|
+
error: string;
|
|
548
|
+
};
|
|
549
|
+
}>>;
|
|
550
|
+
declare class UploadEventEmitter extends UploadEventEmitter_base {}
|
|
551
|
+
declare const uploadEventEmitter: Layer.Layer<UploadEventEmitter, never, BaseEventEmitterService>;
|
|
552
|
+
declare const FlowEventEmitter_base: Context.TagClass<FlowEventEmitter, "FlowEventEmitter", EventEmitter<FlowEvent>>;
|
|
553
|
+
declare class FlowEventEmitter extends FlowEventEmitter_base {}
|
|
554
|
+
declare const flowEventEmitter: Layer.Layer<FlowEventEmitter, never, BaseEventEmitterService>;
|
|
555
|
+
//#endregion
|
|
556
|
+
//#region src/types/input-file.d.ts
|
|
557
|
+
declare const inputFileSchema: z.ZodObject<{
|
|
558
|
+
uploadLengthDeferred: z.ZodOptional<z.ZodBoolean>;
|
|
559
|
+
storageId: z.ZodString;
|
|
560
|
+
size: z.ZodNumber;
|
|
561
|
+
type: z.ZodString;
|
|
562
|
+
fileName: z.ZodOptional<z.ZodString>;
|
|
563
|
+
lastModified: z.ZodOptional<z.ZodNumber>;
|
|
564
|
+
metadata: z.ZodOptional<z.ZodString>;
|
|
565
|
+
}, z.core.$strip>;
|
|
566
|
+
type InputFile = z.infer<typeof inputFileSchema>;
|
|
567
|
+
//#endregion
|
|
568
|
+
//#region src/types/kv-store.d.ts
|
|
569
|
+
interface BaseKvStore {
|
|
570
|
+
readonly get: (key: string) => Effect.Effect<string | null, UploadistaError$1>;
|
|
571
|
+
readonly set: (key: string, value: string) => Effect.Effect<void, UploadistaError$1>;
|
|
572
|
+
readonly delete: (key: string) => Effect.Effect<void, UploadistaError$1>;
|
|
573
|
+
readonly list?: () => Effect.Effect<Array<string>, UploadistaError$1>;
|
|
574
|
+
}
|
|
575
|
+
type KvStore<TData> = {
|
|
576
|
+
readonly get: (key: string) => Effect.Effect<TData, UploadistaError$1>;
|
|
577
|
+
readonly set: (key: string, value: TData) => Effect.Effect<void, UploadistaError$1>;
|
|
578
|
+
readonly delete: (key: string) => Effect.Effect<void, UploadistaError$1>;
|
|
579
|
+
readonly list?: () => Effect.Effect<Array<string>, UploadistaError$1>;
|
|
580
|
+
};
|
|
581
|
+
declare class TypedKvStore<TData> implements KvStore<TData> {
|
|
582
|
+
private baseStore;
|
|
583
|
+
private serialize;
|
|
584
|
+
private deserialize;
|
|
585
|
+
constructor(baseStore: BaseKvStore, serialize: (data: TData) => string, deserialize: (str: string) => TData);
|
|
586
|
+
get: (key: string) => Effect.Effect<TData, UploadistaError$1>;
|
|
587
|
+
set: (key: string, value: TData) => Effect.Effect<void, UploadistaError$1>;
|
|
588
|
+
delete: (key: string) => Effect.Effect<void, UploadistaError$1>;
|
|
589
|
+
list: () => Effect.Effect<Array<string>, UploadistaError$1>;
|
|
590
|
+
}
|
|
591
|
+
declare const jsonSerializer: {
|
|
592
|
+
serialize: <T>(data: T) => string;
|
|
593
|
+
deserialize: <T>(str: string) => T;
|
|
594
|
+
};
|
|
595
|
+
declare const BaseKvStoreService_base: Context.TagClass<BaseKvStoreService, "BaseKvStore", BaseKvStore>;
|
|
596
|
+
declare class BaseKvStoreService extends BaseKvStoreService_base {}
|
|
597
|
+
declare const UploadFileKVStore_base: Context.TagClass<UploadFileKVStore, "UploadFileKVStore", KvStore<UploadFile>>;
|
|
598
|
+
declare class UploadFileKVStore extends UploadFileKVStore_base {}
|
|
599
|
+
declare const uploadFileKvStore: Layer.Layer<UploadFileKVStore, never, BaseKvStoreService>;
|
|
600
|
+
declare const FlowJobKVStore_base: Context.TagClass<FlowJobKVStore, "FlowJobKVStore", KvStore<FlowJob>>;
|
|
601
|
+
declare class FlowJobKVStore extends FlowJobKVStore_base {}
|
|
602
|
+
declare const flowJobKvStore: Layer.Layer<FlowJobKVStore, never, BaseKvStoreService>;
|
|
603
|
+
//#endregion
|
|
604
|
+
//#region src/types/middleware.d.ts
|
|
605
|
+
type MiddlewareContext = {
|
|
606
|
+
request: Request;
|
|
607
|
+
uploadId?: string;
|
|
608
|
+
metadata?: Record<string, string>;
|
|
609
|
+
};
|
|
610
|
+
type MiddlewareNext = () => Promise<Response>;
|
|
611
|
+
type Middleware = (context: MiddlewareContext, next: MiddlewareNext) => Promise<Response>;
|
|
612
|
+
declare const MiddlewareService_base: Context.TagClass<MiddlewareService, "MiddlewareService", {
|
|
613
|
+
readonly execute: (middlewares: Middleware[], context: MiddlewareContext, handler: MiddlewareNext) => Effect.Effect<Response, UploadistaError$1>;
|
|
614
|
+
}>;
|
|
615
|
+
declare class MiddlewareService extends MiddlewareService_base {}
|
|
616
|
+
declare const MiddlewareServiceLive: Layer.Layer<MiddlewareService, never, never>;
|
|
617
|
+
//#endregion
|
|
618
|
+
//#region src/flow/types/flow-job.d.ts
|
|
619
|
+
type FlowJobTaskStatus = "started" | "pending" | "running" | "completed" | "failed";
|
|
620
|
+
type FlowJobTask = {
|
|
621
|
+
nodeId: string;
|
|
622
|
+
status: FlowJobTaskStatus;
|
|
623
|
+
createdAt: Date;
|
|
624
|
+
updatedAt: Date;
|
|
625
|
+
};
|
|
626
|
+
type FlowJob = {
|
|
627
|
+
id: string;
|
|
628
|
+
flowId: string;
|
|
629
|
+
storageId: string;
|
|
630
|
+
status: FlowJobStatus;
|
|
631
|
+
createdAt: Date;
|
|
632
|
+
updatedAt: Date;
|
|
633
|
+
tasks: FlowJobTask[];
|
|
634
|
+
error?: string;
|
|
635
|
+
endedAt?: Date;
|
|
636
|
+
pausedAt?: string;
|
|
637
|
+
executionState?: {
|
|
638
|
+
nodeResults: Record<string, unknown>;
|
|
639
|
+
executionOrder: string[];
|
|
640
|
+
currentIndex: number;
|
|
641
|
+
inputs: Record<string, unknown>;
|
|
642
|
+
};
|
|
643
|
+
};
|
|
644
|
+
type FlowJobStatus = "pending" | "running" | "completed" | "failed" | "started" | "paused";
|
|
645
|
+
//#endregion
|
|
646
|
+
//#region src/flow/flow-server.d.ts
|
|
647
|
+
type FlowProviderShape<TRequirements = any> = {
|
|
648
|
+
getFlow: (flowId: string) => Effect.Effect<Flow<any, any, TRequirements>, UploadistaError$1>;
|
|
649
|
+
};
|
|
650
|
+
declare const FlowProvider_base: Context.TagClass<FlowProvider, "FlowProvider", FlowProviderShape<any>>;
|
|
651
|
+
declare class FlowProvider extends FlowProvider_base {}
|
|
652
|
+
type FlowServerShape = {
|
|
653
|
+
getFlow: <TRequirements>(flowId: string) => Effect.Effect<Flow<any, any, TRequirements>, UploadistaError$1>;
|
|
654
|
+
getFlowData: (flowId: string) => Effect.Effect<FlowData, UploadistaError$1>;
|
|
655
|
+
runFlow: <TRequirements>(flowId: string, storageId: string, inputs: any) => Effect.Effect<FlowJob, UploadistaError$1, TRequirements>;
|
|
656
|
+
continueFlow: <TRequirements>(jobId: string, nodeId: string, newData: unknown) => Effect.Effect<FlowJob, UploadistaError$1, TRequirements>;
|
|
657
|
+
getJobStatus: (jobId: string) => Effect.Effect<FlowJob, UploadistaError$1>;
|
|
658
|
+
subscribeToFlowEvents: (jobId: string, connection: WebSocketConnection) => Effect.Effect<void, UploadistaError$1>;
|
|
659
|
+
unsubscribeFromFlowEvents: (jobId: string) => Effect.Effect<void, UploadistaError$1>;
|
|
660
|
+
};
|
|
661
|
+
declare const FlowServer_base: Context.TagClass<FlowServer, "FlowServer", FlowServerShape>;
|
|
662
|
+
declare class FlowServer extends FlowServer_base {}
|
|
663
|
+
type FlowServerOptions = {
|
|
664
|
+
getFlow: <TRequirements>({
|
|
665
|
+
flowId,
|
|
666
|
+
storageId
|
|
667
|
+
}: {
|
|
668
|
+
flowId: string;
|
|
669
|
+
storageId: string;
|
|
670
|
+
}) => Promise<Flow<any, any, TRequirements>>;
|
|
671
|
+
kvStore: KvStore<FlowJob>;
|
|
672
|
+
};
|
|
673
|
+
declare function createFlowServer(): Effect.Effect<{
|
|
674
|
+
getFlow: <TRequirements>(flowId: string) => Effect.Effect<Flow<any, any, any>, UploadistaError$1, never>;
|
|
675
|
+
getFlowData: (flowId: string) => Effect.Effect<FlowData, UploadistaError$1, never>;
|
|
676
|
+
runFlow: (flowId: string, storageId: string, inputs: unknown) => Effect.Effect<FlowJob, UploadistaError$1, any>;
|
|
677
|
+
getJobStatus: (jobId: string) => Effect.Effect<FlowJob, UploadistaError$1, never>;
|
|
678
|
+
continueFlow: (jobId: string, nodeId: string, newData: unknown) => Effect.Effect<FlowJob, UploadistaError$1, any>;
|
|
679
|
+
subscribeToFlowEvents: (jobId: string, connection: WebSocketConnection) => Effect.Effect<void, UploadistaError$1, never>;
|
|
680
|
+
unsubscribeFromFlowEvents: (jobId: string) => Effect.Effect<void, UploadistaError$1, never>;
|
|
681
|
+
}, never, FlowProvider | FlowJobKVStore | FlowEventEmitter>;
|
|
682
|
+
declare const flowServer: Layer.Layer<FlowServer, never, FlowProvider | FlowJobKVStore | FlowEventEmitter>;
|
|
683
|
+
type FlowServerLayer = typeof flowServer;
|
|
684
|
+
//#endregion
|
|
685
|
+
//#region src/flow/nodes/input-node.d.ts
|
|
686
|
+
declare function createInputNode(id: string, prepareFile?: (fileId: string) => Effect.Effect<string>): Effect.Effect<FlowNode<{
|
|
687
|
+
fileId: string;
|
|
688
|
+
}, {
|
|
689
|
+
path: string;
|
|
690
|
+
inputBytes: Uint8Array<ArrayBufferLike>;
|
|
691
|
+
metadata: {
|
|
692
|
+
mimeType: string;
|
|
693
|
+
size: number;
|
|
694
|
+
width?: number | undefined;
|
|
695
|
+
height?: number | undefined;
|
|
696
|
+
format?: string | undefined;
|
|
697
|
+
originalName?: string | undefined;
|
|
698
|
+
extension?: string | undefined;
|
|
699
|
+
};
|
|
700
|
+
}, UploadistaError$1, never>, UploadistaError$1, never>;
|
|
701
|
+
//#endregion
|
|
702
|
+
//#region src/upload/mime.d.ts
|
|
703
|
+
declare const detectMimeType: (buffer: Uint8Array, filename?: string) => string;
|
|
704
|
+
//#endregion
|
|
705
|
+
//#region src/upload/upload-server.d.ts
|
|
706
|
+
type UploadServerOptions = {
|
|
707
|
+
dataStore: ((storageId: string) => Promise<DataStore<UploadFile>>) | DataStore<UploadFile>;
|
|
708
|
+
kvStore: KvStore<UploadFile>;
|
|
709
|
+
eventEmitter: EventEmitter<UploadEvent>;
|
|
710
|
+
generateId?: GenerateIdShape;
|
|
711
|
+
middlewares?: Middleware[];
|
|
712
|
+
withTracing?: boolean;
|
|
713
|
+
};
|
|
714
|
+
type UploadServerShape = {
|
|
715
|
+
createUpload: (inputFile: InputFile, isBuffer?: boolean) => Effect.Effect<UploadFile, UploadistaError$1>;
|
|
716
|
+
uploadChunk: (uploadId: string, chunk: ReadableStream, isBuffer?: boolean) => Effect.Effect<UploadFile, UploadistaError$1>;
|
|
717
|
+
getCapabilities: (storageId: string) => Effect.Effect<DataStoreCapabilities, UploadistaError$1>;
|
|
718
|
+
upload: (file: InputFile, stream: ReadableStream) => Effect.Effect<UploadFile, UploadistaError$1>;
|
|
719
|
+
getUpload: (uploadId: string) => Effect.Effect<UploadFile, UploadistaError$1>;
|
|
720
|
+
read: (uploadId: string) => Effect.Effect<Uint8Array, UploadistaError$1>;
|
|
721
|
+
subscribeToUploadEvents: (uploadId: string, connection: WebSocketConnection) => Effect.Effect<void, UploadistaError$1>;
|
|
722
|
+
unsubscribeFromUploadEvents: (uploadId: string) => Effect.Effect<void, UploadistaError$1>;
|
|
723
|
+
};
|
|
724
|
+
declare const UploadServer_base: Context.TagClass<UploadServer, "UploadServer", UploadServerShape>;
|
|
725
|
+
declare class UploadServer extends UploadServer_base {}
|
|
726
|
+
declare function createUploadServer(): Effect.Effect<{
|
|
727
|
+
upload: (inputFile: InputFile, stream: ReadableStream) => Effect.Effect<UploadFile, UploadistaError$1, never>;
|
|
728
|
+
createUpload: (inputFile: InputFile) => Effect.Effect<UploadFile, UploadistaError$1, never>;
|
|
729
|
+
uploadChunk: (uploadId: string, chunk: ReadableStream) => Effect.Effect<UploadFile, UploadistaError$1, never>;
|
|
730
|
+
getUpload: (uploadId: string) => Effect.Effect<UploadFile, UploadistaError$1, never>;
|
|
731
|
+
read: (uploadId: string) => Effect.Effect<Uint8Array<ArrayBufferLike>, UploadistaError$1, never>;
|
|
732
|
+
getCapabilities: (storageId: string) => Effect.Effect<DataStoreCapabilities, UploadistaError$1, never>;
|
|
733
|
+
subscribeToUploadEvents: (uploadId: string, connection: WebSocketConnection) => Effect.Effect<void, UploadistaError$1, never>;
|
|
734
|
+
unsubscribeFromUploadEvents: (uploadId: string) => Effect.Effect<void, UploadistaError$1, never>;
|
|
735
|
+
}, never, GenerateId | UploadFileDataStores | UploadFileKVStore | UploadEventEmitter>;
|
|
736
|
+
declare const uploadServer: Layer.Layer<UploadServer, never, GenerateId | UploadFileDataStores | UploadFileKVStore | UploadEventEmitter>;
|
|
737
|
+
//#endregion
|
|
738
|
+
//#region src/upload/upload-strategy-negotiator.d.ts
|
|
739
|
+
type UploadStrategyOptions = {
|
|
740
|
+
fileSize: number;
|
|
741
|
+
preferredStrategy?: UploadStrategy;
|
|
742
|
+
preferredChunkSize?: number;
|
|
743
|
+
parallelUploads?: number;
|
|
744
|
+
minChunkSizeForParallel?: number;
|
|
745
|
+
};
|
|
746
|
+
type NegotiatedStrategy = {
|
|
747
|
+
strategy: UploadStrategy;
|
|
748
|
+
chunkSize: number;
|
|
749
|
+
parallelUploads: number;
|
|
750
|
+
reasoning: string[];
|
|
751
|
+
warnings: string[];
|
|
752
|
+
};
|
|
753
|
+
declare class UploadStrategyNegotiator {
|
|
754
|
+
private capabilities;
|
|
755
|
+
private validateUploadStrategy;
|
|
756
|
+
constructor(capabilities: DataStoreCapabilities, validateUploadStrategy: (strategy: UploadStrategy) => boolean);
|
|
757
|
+
negotiateStrategy(options: UploadStrategyOptions): NegotiatedStrategy;
|
|
758
|
+
getDataStoreCapabilities(): DataStoreCapabilities;
|
|
759
|
+
validateConfiguration(options: UploadStrategyOptions): {
|
|
760
|
+
valid: boolean;
|
|
761
|
+
errors: string[];
|
|
762
|
+
};
|
|
763
|
+
}
|
|
764
|
+
//#endregion
|
|
765
|
+
//#region src/flow/nodes/storage-node.d.ts
|
|
766
|
+
declare const storageParamsSchema: z.ZodObject<{}, z.core.$strip>;
|
|
767
|
+
type StorageParams = z.infer<typeof storageParamsSchema>;
|
|
768
|
+
declare function createStorageNode(id: string): Effect.Effect<FlowNode<{
|
|
769
|
+
id: string;
|
|
770
|
+
offset: number;
|
|
771
|
+
storage: {
|
|
772
|
+
id: string;
|
|
773
|
+
type: string;
|
|
774
|
+
path?: string | undefined;
|
|
775
|
+
uploadId?: string | undefined;
|
|
776
|
+
bucket?: string | undefined;
|
|
777
|
+
};
|
|
778
|
+
size?: number | undefined;
|
|
779
|
+
metadata?: Record<string, string> | undefined;
|
|
780
|
+
creationDate?: string | undefined;
|
|
781
|
+
url?: string | undefined;
|
|
782
|
+
sizeIsDeferred?: boolean | undefined;
|
|
783
|
+
}, {
|
|
784
|
+
id: string;
|
|
785
|
+
offset: number;
|
|
786
|
+
storage: {
|
|
787
|
+
id: string;
|
|
788
|
+
type: string;
|
|
789
|
+
path?: string | undefined;
|
|
790
|
+
uploadId?: string | undefined;
|
|
791
|
+
bucket?: string | undefined;
|
|
792
|
+
};
|
|
793
|
+
size?: number | undefined;
|
|
794
|
+
metadata?: Record<string, string> | undefined;
|
|
795
|
+
creationDate?: string | undefined;
|
|
796
|
+
url?: string | undefined;
|
|
797
|
+
sizeIsDeferred?: boolean | undefined;
|
|
798
|
+
}, UploadistaError$1, never>, UploadistaError$1, UploadServer>;
|
|
799
|
+
//#endregion
|
|
800
|
+
//#region src/flow/nodes/streaming-input-node.d.ts
|
|
801
|
+
declare function createStreamingInputNode(id: string): Effect.Effect<FlowNode<{
|
|
802
|
+
operation: "init";
|
|
803
|
+
storageId: string;
|
|
804
|
+
metadata?: {
|
|
805
|
+
originalName?: string | undefined;
|
|
806
|
+
mimeType?: string | undefined;
|
|
807
|
+
size?: number | undefined;
|
|
808
|
+
extension?: string | undefined;
|
|
809
|
+
} | undefined;
|
|
810
|
+
} | {
|
|
811
|
+
operation: "finalize";
|
|
812
|
+
uploadId: string;
|
|
813
|
+
}, {
|
|
814
|
+
id: string;
|
|
815
|
+
offset: number;
|
|
816
|
+
storage: {
|
|
817
|
+
id: string;
|
|
818
|
+
type: string;
|
|
819
|
+
path?: string | undefined;
|
|
820
|
+
uploadId?: string | undefined;
|
|
821
|
+
bucket?: string | undefined;
|
|
822
|
+
};
|
|
823
|
+
size?: number | undefined;
|
|
824
|
+
metadata?: Record<string, string> | undefined;
|
|
825
|
+
creationDate?: string | undefined;
|
|
826
|
+
url?: string | undefined;
|
|
827
|
+
sizeIsDeferred?: boolean | undefined;
|
|
828
|
+
}, UploadistaError$1, never>, UploadistaError$1, UploadServer>;
|
|
829
|
+
//#endregion
|
|
830
|
+
//#region src/flow/parallel-scheduler.d.ts
|
|
831
|
+
interface ExecutionLevel {
|
|
832
|
+
level: number;
|
|
833
|
+
nodes: string[];
|
|
834
|
+
}
|
|
835
|
+
interface ParallelSchedulerConfig {
|
|
836
|
+
maxConcurrency?: number;
|
|
837
|
+
resourceSemaphore?: Semaphore;
|
|
838
|
+
}
|
|
839
|
+
declare class ParallelScheduler {
|
|
840
|
+
private maxConcurrency;
|
|
841
|
+
private resourceSemaphore;
|
|
842
|
+
constructor(config?: ParallelSchedulerConfig);
|
|
843
|
+
/**
|
|
844
|
+
* Groups nodes into execution levels where nodes in the same level can run in parallel
|
|
845
|
+
* @param nodes Array of flow nodes
|
|
846
|
+
* @param edges Array of flow edges
|
|
847
|
+
* @returns Array of execution levels
|
|
848
|
+
*/
|
|
849
|
+
groupNodesByExecutionLevel(nodes: FlowNode<unknown, unknown>[], edges: Array<{
|
|
850
|
+
source: string;
|
|
851
|
+
target: string;
|
|
852
|
+
}>): ExecutionLevel[];
|
|
853
|
+
/**
|
|
854
|
+
* Executes a batch of nodes in parallel with resource management
|
|
855
|
+
* @param nodeExecutors Array of async functions that execute individual nodes
|
|
856
|
+
* @returns Promise that resolves when all nodes complete
|
|
857
|
+
*/
|
|
858
|
+
executeNodesInParallel<T>(nodeExecutors: Array<() => Promise<T>>): Promise<T[]>;
|
|
859
|
+
/**
|
|
860
|
+
* Determines if nodes can be safely executed in parallel
|
|
861
|
+
* @param nodes Nodes to check
|
|
862
|
+
* @param nodeResults Current execution results
|
|
863
|
+
* @returns true if all nodes have their dependencies satisfied
|
|
864
|
+
*/
|
|
865
|
+
canExecuteInParallel(nodeIds: string[], nodeResults: Map<string, unknown>, reverseGraph: Record<string, string[]>): boolean;
|
|
866
|
+
/**
|
|
867
|
+
* Gets execution statistics for monitoring
|
|
868
|
+
*/
|
|
869
|
+
getStats(): {
|
|
870
|
+
maxConcurrency: number;
|
|
871
|
+
};
|
|
872
|
+
}
|
|
873
|
+
//#endregion
|
|
874
|
+
//#region dist/uploadista-error-CwxYs4EB.d.ts
|
|
875
|
+
//#region src/errors/uploadista-error.d.ts
|
|
876
|
+
type UploadistaErrorCode = "MISSING_OFFSET" | "ABORTED" | "INVALID_TERMINATION" | "ERR_LOCK_TIMEOUT" | "INVALID_CONTENT_TYPE" | "FLOW_STRUCTURE_ERROR" | "FLOW_CYCLE_ERROR" | "FLOW_NODE_NOT_FOUND" | "FLOW_NODE_ERROR" | "FLOW_JOB_NOT_FOUND" | "FLOW_JOB_ERROR" | "DATASTORE_NOT_FOUND" | "FILE_NOT_FOUND" | "INVALID_OFFSET" | "FILE_NO_LONGER_EXISTS" | "ERR_SIZE_EXCEEDED" | "ERR_MAX_SIZE_EXCEEDED" | "INVALID_LENGTH" | "INVALID_METADATA" | "VALIDATION_ERROR" | "UNKNOWN_ERROR" | "FILE_WRITE_ERROR" | "UPLOAD_ID_NOT_FOUND" | "FLOW_OUTPUT_VALIDATION_ERROR" | "FLOW_INPUT_VALIDATION_ERROR";
|
|
877
|
+
declare const UploadistaError_base: new <A extends Record<string, any> = {}>(args: effect_Types0.Equals<A, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P] }) => effect_Cause0.YieldableError & {
|
|
878
|
+
readonly _tag: "UploadistaError";
|
|
879
|
+
} & Readonly<A>;
|
|
880
|
+
declare class UploadistaError extends UploadistaError_base {
|
|
881
|
+
readonly code: string;
|
|
882
|
+
readonly status: number;
|
|
883
|
+
readonly status_code: number;
|
|
884
|
+
readonly body: string;
|
|
885
|
+
readonly details?: unknown;
|
|
886
|
+
constructor({
|
|
887
|
+
code,
|
|
888
|
+
status,
|
|
889
|
+
body,
|
|
890
|
+
cause,
|
|
891
|
+
details
|
|
892
|
+
}: {
|
|
893
|
+
code: UploadistaErrorCode | string;
|
|
894
|
+
status: number;
|
|
895
|
+
body: string;
|
|
896
|
+
cause?: unknown;
|
|
897
|
+
details?: unknown;
|
|
898
|
+
});
|
|
899
|
+
static fromCode(code: UploadistaErrorCode, overrides?: Partial<Pick<UploadistaError, "status" | "body">> & {
|
|
900
|
+
details?: unknown;
|
|
901
|
+
cause?: unknown;
|
|
902
|
+
}): UploadistaError;
|
|
903
|
+
/**
|
|
904
|
+
* Convert this error to an Effect that fails
|
|
905
|
+
*/
|
|
906
|
+
toEffect<T = never>(): Effect.Effect<T, UploadistaError>;
|
|
907
|
+
}
|
|
908
|
+
//#endregion
|
|
909
|
+
//#region src/flow/plugins/types/optimize-node.d.ts
|
|
910
|
+
declare const optimizeParamsSchema: z.ZodObject<{
|
|
911
|
+
quality: z.ZodNumber;
|
|
912
|
+
format: z.ZodEnum<{
|
|
913
|
+
jpeg: "jpeg";
|
|
914
|
+
}>;
|
|
915
|
+
}, z.core.$strip>;
|
|
916
|
+
type OptimizeParams = z.infer<typeof optimizeParamsSchema>;
|
|
917
|
+
//#endregion
|
|
918
|
+
//#region src/flow/plugins/types/resize-node.d.ts
|
|
919
|
+
declare const resizeParamsSchema: z.ZodObject<{
|
|
920
|
+
width: z.ZodOptional<z.ZodNumber>;
|
|
921
|
+
height: z.ZodOptional<z.ZodNumber>;
|
|
922
|
+
fit: z.ZodEnum<{
|
|
923
|
+
fill: "fill";
|
|
924
|
+
contain: "contain";
|
|
925
|
+
cover: "cover";
|
|
926
|
+
}>;
|
|
927
|
+
}, z.core.$strip>;
|
|
928
|
+
type ResizeParams = z.infer<typeof resizeParamsSchema>;
|
|
929
|
+
//#endregion
|
|
930
|
+
//#region src/flow/plugins/image-plugin.d.ts
|
|
931
|
+
type ImagePluginShape = {
|
|
932
|
+
optimize: (input: Uint8Array, options: OptimizeParams) => Effect.Effect<Uint8Array, UploadistaError>;
|
|
933
|
+
resize: (input: Uint8Array, options: ResizeParams) => Effect.Effect<Uint8Array, UploadistaError>;
|
|
934
|
+
};
|
|
935
|
+
declare const ImagePlugin_base: Context.TagClass<ImagePlugin, "ImagePlugin", ImagePluginShape>;
|
|
936
|
+
declare class ImagePlugin extends ImagePlugin_base {}
|
|
937
|
+
//#endregion
|
|
938
|
+
//#region src/flow/types/flow-file.d.ts
|
|
939
|
+
type FlowFile = {
|
|
940
|
+
path: string;
|
|
941
|
+
inputBytes: Uint8Array<ArrayBufferLike>;
|
|
942
|
+
metadata: {
|
|
943
|
+
size: number;
|
|
944
|
+
mimeType: string;
|
|
945
|
+
width?: number;
|
|
946
|
+
height?: number;
|
|
947
|
+
format?: string;
|
|
948
|
+
originalName?: string;
|
|
949
|
+
extension?: string;
|
|
950
|
+
};
|
|
951
|
+
};
|
|
952
|
+
declare const flowFileSchema: z.ZodObject<{
|
|
953
|
+
path: z.ZodString;
|
|
954
|
+
inputBytes: z.ZodCustom<Uint8Array<ArrayBufferLike>, Uint8Array<ArrayBufferLike>>;
|
|
955
|
+
metadata: z.ZodObject<{
|
|
956
|
+
mimeType: z.ZodString;
|
|
957
|
+
size: z.ZodNumber;
|
|
958
|
+
width: z.ZodOptional<z.ZodNumber>;
|
|
959
|
+
height: z.ZodOptional<z.ZodNumber>;
|
|
960
|
+
format: z.ZodOptional<z.ZodString>;
|
|
961
|
+
originalName: z.ZodOptional<z.ZodString>;
|
|
962
|
+
extension: z.ZodOptional<z.ZodString>;
|
|
963
|
+
}, z.core.$strip>;
|
|
964
|
+
}, z.core.$strip>;
|
|
965
|
+
type FlowFileBatch = {
|
|
966
|
+
files: FlowFile[];
|
|
967
|
+
metadata?: {
|
|
968
|
+
batchId: string;
|
|
969
|
+
totalSize: number;
|
|
970
|
+
fileCount: number;
|
|
971
|
+
};
|
|
972
|
+
};
|
|
973
|
+
declare const flowFileBatchSchema: z.ZodObject<{
|
|
974
|
+
files: z.ZodArray<z.ZodObject<{
|
|
975
|
+
path: z.ZodString;
|
|
976
|
+
inputBytes: z.ZodCustom<Uint8Array<ArrayBufferLike>, Uint8Array<ArrayBufferLike>>;
|
|
977
|
+
metadata: z.ZodObject<{
|
|
978
|
+
mimeType: z.ZodString;
|
|
979
|
+
size: z.ZodNumber;
|
|
980
|
+
width: z.ZodOptional<z.ZodNumber>;
|
|
981
|
+
height: z.ZodOptional<z.ZodNumber>;
|
|
982
|
+
format: z.ZodOptional<z.ZodString>;
|
|
983
|
+
originalName: z.ZodOptional<z.ZodString>;
|
|
984
|
+
extension: z.ZodOptional<z.ZodString>;
|
|
985
|
+
}, z.core.$strip>;
|
|
986
|
+
}, z.core.$strip>>;
|
|
987
|
+
metadata: z.ZodOptional<z.ZodObject<{
|
|
988
|
+
batchId: z.ZodString;
|
|
989
|
+
totalSize: z.ZodNumber;
|
|
990
|
+
fileCount: z.ZodNumber;
|
|
991
|
+
}, z.core.$strip>>;
|
|
992
|
+
}, z.core.$strip>;
|
|
993
|
+
type FlowFileData = FlowFile | FlowFileBatch;
|
|
994
|
+
declare function isFlowFile(data: FlowFileData): data is FlowFile;
|
|
995
|
+
declare const flowDataSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
996
|
+
path: z.ZodString;
|
|
997
|
+
inputBytes: z.ZodCustom<Uint8Array<ArrayBufferLike>, Uint8Array<ArrayBufferLike>>;
|
|
998
|
+
metadata: z.ZodObject<{
|
|
999
|
+
mimeType: z.ZodString;
|
|
1000
|
+
size: z.ZodNumber;
|
|
1001
|
+
width: z.ZodOptional<z.ZodNumber>;
|
|
1002
|
+
height: z.ZodOptional<z.ZodNumber>;
|
|
1003
|
+
format: z.ZodOptional<z.ZodString>;
|
|
1004
|
+
originalName: z.ZodOptional<z.ZodString>;
|
|
1005
|
+
extension: z.ZodOptional<z.ZodString>;
|
|
1006
|
+
}, z.core.$strip>;
|
|
1007
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1008
|
+
files: z.ZodArray<z.ZodObject<{
|
|
1009
|
+
path: z.ZodString;
|
|
1010
|
+
inputBytes: z.ZodCustom<Uint8Array<ArrayBufferLike>, Uint8Array<ArrayBufferLike>>;
|
|
1011
|
+
metadata: z.ZodObject<{
|
|
1012
|
+
mimeType: z.ZodString;
|
|
1013
|
+
size: z.ZodNumber;
|
|
1014
|
+
width: z.ZodOptional<z.ZodNumber>;
|
|
1015
|
+
height: z.ZodOptional<z.ZodNumber>;
|
|
1016
|
+
format: z.ZodOptional<z.ZodString>;
|
|
1017
|
+
originalName: z.ZodOptional<z.ZodString>;
|
|
1018
|
+
extension: z.ZodOptional<z.ZodString>;
|
|
1019
|
+
}, z.core.$strip>;
|
|
1020
|
+
}, z.core.$strip>>;
|
|
1021
|
+
metadata: z.ZodOptional<z.ZodObject<{
|
|
1022
|
+
batchId: z.ZodString;
|
|
1023
|
+
totalSize: z.ZodNumber;
|
|
1024
|
+
fileCount: z.ZodNumber;
|
|
1025
|
+
}, z.core.$strip>>;
|
|
1026
|
+
}, z.core.$strip>]>;
|
|
1027
|
+
type FlowCondition = {
|
|
1028
|
+
field: "mimeType" | "size" | "width" | "height" | "extension";
|
|
1029
|
+
operator: "equals" | "notEquals" | "greaterThan" | "lessThan" | "contains" | "startsWith";
|
|
1030
|
+
value: string | number;
|
|
1031
|
+
};
|
|
1032
|
+
//#endregion
|
|
1033
|
+
//#region src/flow/types/run-args.d.ts
|
|
1034
|
+
declare const runArgsSchema: z.ZodObject<{
|
|
1035
|
+
inputs: z.ZodRecord<z.ZodString, z.ZodAny>;
|
|
1036
|
+
}, z.core.$strip>;
|
|
1037
|
+
type RunArgs = z.infer<typeof runArgsSchema>;
|
|
1038
|
+
//#endregion
|
|
1039
|
+
export { BaseEventEmitter, BaseEventEmitterService, BaseKvStore, BaseKvStoreService, BufferedUploadFileDataStore, ConditionField, ConditionOperator, ConditionValue, DataStore, DataStoreCapabilities, DataStoreRegistry, DataStoreWriteOptions, EventEmitter, EventType, ExecutionLevel, type Flow, FlowCondition, FlowConfig, type FlowData, type FlowEdge, type FlowEvent, FlowEventEmitter, type FlowEventFlowEnd, type FlowEventFlowStart, FlowEventJobEnd, FlowEventJobStart, FlowEventNodeEnd, FlowEventNodeError, FlowEventNodeResponse, FlowEventNodeStart, FlowExecutionContext, FlowExecutionResult, FlowFile, FlowFileBatch, FlowFileData, FlowJob, FlowJobKVStore, FlowJobStatus, FlowJobTask, FlowJobTaskStatus, FlowNode, FlowNodeData, FlowProvider, FlowProviderShape, FlowServer, FlowServerLayer, FlowServerOptions, FlowServerShape, ImagePlugin, ImagePluginShape, InputFile, KvStore, Middleware, MiddlewareContext, MiddlewareNext, MiddlewareService, MiddlewareServiceLive, NegotiatedStrategy, NodeConnectionValidator, NodeExecutionResult, NodeType, NodeTypeMap, OptimizeParams, ParallelScheduler, ParallelSchedulerConfig, ResizeParams, RunArgs, StorageParams, TypeCompatibilityChecker, TypedEventEmitter, TypedKvStore, UploadEvent, UploadEventEmitter, UploadEventType, UploadFile, UploadFileDataStore, UploadFileDataStores, UploadFileDataStoresShape, UploadFileKVStore, UploadServer, UploadServerOptions, UploadServerShape, UploadStrategy, UploadStrategyNegotiator, UploadStrategyOptions, WebSocketConnection, WebSocketMessage, completeNodeExecution, createFlow, createFlowEdge, createFlowNode, createFlowServer, createInputNode, createStorageNode, createStreamingInputNode, createUploadServer, detectMimeType, eventToMessageSerializer, flowDataSchema, flowEventEmitter, flowFileBatchSchema, flowFileSchema, flowJobKvStore, flowServer, getFlowData, getNodeData, inputFileSchema, isFlowFile, jsonSerializer, optimizeParamsSchema, resizeParamsSchema, runArgsSchema, storageParamsSchema, uploadEventEmitter, uploadEventSchema, uploadFileKvStore, uploadFileSchema, uploadServer, waitingNodeExecution, webSocketMessageSchema };
|
|
1040
|
+
//# sourceMappingURL=index-BO8GZlbD.d.cts.map
|