@uploadista/core 0.0.2 → 0.0.4

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.
Files changed (331) hide show
  1. package/README.md +6 -20
  2. package/dist/checksum-C5qE-5eg.js +2 -0
  3. package/dist/checksum-C5qE-5eg.js.map +1 -0
  4. package/dist/checksum-wSBuXX84.cjs +1 -0
  5. package/dist/errors/index.cjs +1 -1
  6. package/dist/errors/index.d.cts +2 -2
  7. package/dist/errors/index.d.ts +3 -3
  8. package/dist/errors/index.js +1 -2
  9. package/dist/flow/index.cjs +1 -1
  10. package/dist/flow/index.d.cts +5 -5
  11. package/dist/flow/index.d.ts +6 -24
  12. package/dist/flow/index.js +1 -24
  13. package/dist/flow-B0mMJM5Y.js +2 -0
  14. package/dist/flow-B0mMJM5Y.js.map +1 -0
  15. package/dist/flow-s5bgJsdb.cjs +1 -0
  16. package/dist/index-B46hb7yB.d.cts +36 -0
  17. package/dist/index-B46hb7yB.d.cts.map +1 -0
  18. package/dist/index-BnGZO47X.d.ts +3952 -0
  19. package/dist/index-BnGZO47X.d.ts.map +1 -0
  20. package/dist/{streams/stream-limiter.d.cts → index-C1mxuUxK.d.ts} +3 -3
  21. package/dist/index-C1mxuUxK.d.ts.map +1 -0
  22. package/dist/index-DM69UMgG.d.cts +4132 -0
  23. package/dist/index-DM69UMgG.d.cts.map +1 -0
  24. package/dist/index-DMJv8Tvo.d.ts +168 -0
  25. package/dist/index-DMJv8Tvo.d.ts.map +1 -0
  26. package/dist/index-GLPiXqj4.d.cts +168 -0
  27. package/dist/index-GLPiXqj4.d.cts.map +1 -0
  28. package/dist/index.cjs +1 -1
  29. package/dist/index.d.cts +5 -5
  30. package/dist/index.d.ts +6 -5
  31. package/dist/index.js +1 -5
  32. package/dist/stream-limiter-CTuiXkcq.js +2 -0
  33. package/dist/{stream-limiter-CoWKv39w.js.map → stream-limiter-CTuiXkcq.js.map} +1 -1
  34. package/dist/stream-limiter-DYGG4t9f.cjs +1 -0
  35. package/dist/streams/index.cjs +1 -0
  36. package/dist/streams/index.d.cts +3 -0
  37. package/dist/streams/index.d.ts +3 -0
  38. package/dist/streams/index.js +1 -0
  39. package/dist/streams-BiD_pOPH.cjs +0 -0
  40. package/dist/streams-Bs3GDNKJ.js +1 -0
  41. package/dist/types/index.cjs +1 -1
  42. package/dist/types/index.d.cts +5 -5
  43. package/dist/types/index.d.ts +6 -10
  44. package/dist/types/index.js +1 -9
  45. package/dist/types-Dj9g8ocl.cjs +1 -0
  46. package/dist/types-m26wrG-Z.js +2 -0
  47. package/dist/types-m26wrG-Z.js.map +1 -0
  48. package/dist/upload/index.cjs +1 -1
  49. package/dist/upload/index.d.cts +5 -5
  50. package/dist/upload/index.d.ts +6 -4
  51. package/dist/upload/index.js +1 -3
  52. package/dist/upload-BzU7ifyH.js +2 -0
  53. package/dist/upload-BzU7ifyH.js.map +1 -0
  54. package/dist/upload-DvLp6TXO.cjs +1 -0
  55. package/dist/uploadista-error-CAtkQiAv.d.cts +221 -0
  56. package/dist/uploadista-error-CAtkQiAv.d.cts.map +1 -0
  57. package/dist/{uploadista-error-BVsVxqvz.js → uploadista-error-CjfcFnVa.js} +9 -2
  58. package/dist/uploadista-error-CjfcFnVa.js.map +1 -0
  59. package/dist/uploadista-error-D9SONF9K.d.ts +221 -0
  60. package/dist/uploadista-error-D9SONF9K.d.ts.map +1 -0
  61. package/dist/{uploadista-error-BB-Wdiz9.cjs → uploadista-error-DdTP-Rjx.cjs} +9 -2
  62. package/dist/utils/index.cjs +1 -0
  63. package/dist/utils/index.d.cts +3 -0
  64. package/dist/utils/index.d.ts +3 -0
  65. package/dist/utils/index.js +1 -0
  66. package/dist/utils-BILytQlb.js +2 -0
  67. package/dist/utils-BILytQlb.js.map +1 -0
  68. package/dist/utils-BLsIUd8c.cjs +1 -0
  69. package/package.json +13 -17
  70. package/src/index.ts +2 -0
  71. package/src/streams/index.ts +1 -0
  72. package/src/utils/index.ts +5 -0
  73. package/tsdown.config.ts +2 -10
  74. package/.turbo/turbo-build.log +0 -5
  75. package/.turbo/turbo-check.log +0 -231
  76. package/.turbo/turbo-format.log +0 -5
  77. package/dist/chunk-CUT6urMc.cjs +0 -1
  78. package/dist/debounce-C2SeqcxD.js +0 -2
  79. package/dist/debounce-C2SeqcxD.js.map +0 -1
  80. package/dist/debounce-LZK7yS7Z.cjs +0 -1
  81. package/dist/errors/index.d.ts.map +0 -1
  82. package/dist/errors/uploadista-error.d.ts +0 -209
  83. package/dist/errors/uploadista-error.d.ts.map +0 -1
  84. package/dist/errors/uploadista-error.js +0 -322
  85. package/dist/flow/edge.d.ts +0 -47
  86. package/dist/flow/edge.d.ts.map +0 -1
  87. package/dist/flow/edge.js +0 -40
  88. package/dist/flow/event.d.ts +0 -206
  89. package/dist/flow/event.d.ts.map +0 -1
  90. package/dist/flow/event.js +0 -53
  91. package/dist/flow/flow-server.d.ts +0 -223
  92. package/dist/flow/flow-server.d.ts.map +0 -1
  93. package/dist/flow/flow-server.js +0 -614
  94. package/dist/flow/flow.d.ts +0 -238
  95. package/dist/flow/flow.d.ts.map +0 -1
  96. package/dist/flow/flow.js +0 -629
  97. package/dist/flow/index.d.ts.map +0 -1
  98. package/dist/flow/node.d.ts +0 -136
  99. package/dist/flow/node.d.ts.map +0 -1
  100. package/dist/flow/node.js +0 -153
  101. package/dist/flow/nodes/index.d.ts +0 -8
  102. package/dist/flow/nodes/index.d.ts.map +0 -1
  103. package/dist/flow/nodes/index.js +0 -7
  104. package/dist/flow/nodes/input-node.d.ts +0 -78
  105. package/dist/flow/nodes/input-node.d.ts.map +0 -1
  106. package/dist/flow/nodes/input-node.js +0 -233
  107. package/dist/flow/nodes/storage-node.d.ts +0 -67
  108. package/dist/flow/nodes/storage-node.d.ts.map +0 -1
  109. package/dist/flow/nodes/storage-node.js +0 -94
  110. package/dist/flow/nodes/streaming-input-node.d.ts +0 -69
  111. package/dist/flow/nodes/streaming-input-node.d.ts.map +0 -1
  112. package/dist/flow/nodes/streaming-input-node.js +0 -156
  113. package/dist/flow/nodes/transform-node.d.ts +0 -85
  114. package/dist/flow/nodes/transform-node.d.ts.map +0 -1
  115. package/dist/flow/nodes/transform-node.js +0 -107
  116. package/dist/flow/parallel-scheduler.d.ts +0 -175
  117. package/dist/flow/parallel-scheduler.d.ts.map +0 -1
  118. package/dist/flow/parallel-scheduler.js +0 -193
  119. package/dist/flow/plugins/credential-provider.d.ts +0 -47
  120. package/dist/flow/plugins/credential-provider.d.ts.map +0 -1
  121. package/dist/flow/plugins/credential-provider.js +0 -24
  122. package/dist/flow/plugins/image-ai-plugin.d.ts +0 -61
  123. package/dist/flow/plugins/image-ai-plugin.d.ts.map +0 -1
  124. package/dist/flow/plugins/image-ai-plugin.js +0 -21
  125. package/dist/flow/plugins/image-plugin.d.ts +0 -52
  126. package/dist/flow/plugins/image-plugin.d.ts.map +0 -1
  127. package/dist/flow/plugins/image-plugin.js +0 -22
  128. package/dist/flow/plugins/types/describe-image-node.d.ts +0 -16
  129. package/dist/flow/plugins/types/describe-image-node.d.ts.map +0 -1
  130. package/dist/flow/plugins/types/describe-image-node.js +0 -9
  131. package/dist/flow/plugins/types/index.d.ts +0 -9
  132. package/dist/flow/plugins/types/index.d.ts.map +0 -1
  133. package/dist/flow/plugins/types/index.js +0 -8
  134. package/dist/flow/plugins/types/optimize-node.d.ts +0 -20
  135. package/dist/flow/plugins/types/optimize-node.d.ts.map +0 -1
  136. package/dist/flow/plugins/types/optimize-node.js +0 -11
  137. package/dist/flow/plugins/types/remove-background-node.d.ts +0 -16
  138. package/dist/flow/plugins/types/remove-background-node.d.ts.map +0 -1
  139. package/dist/flow/plugins/types/remove-background-node.js +0 -9
  140. package/dist/flow/plugins/types/resize-node.d.ts +0 -21
  141. package/dist/flow/plugins/types/resize-node.d.ts.map +0 -1
  142. package/dist/flow/plugins/types/resize-node.js +0 -16
  143. package/dist/flow/plugins/zip-plugin.d.ts +0 -62
  144. package/dist/flow/plugins/zip-plugin.d.ts.map +0 -1
  145. package/dist/flow/plugins/zip-plugin.js +0 -21
  146. package/dist/flow/typed-flow.d.ts +0 -90
  147. package/dist/flow/typed-flow.d.ts.map +0 -1
  148. package/dist/flow/typed-flow.js +0 -59
  149. package/dist/flow/types/flow-file.d.ts +0 -45
  150. package/dist/flow/types/flow-file.d.ts.map +0 -1
  151. package/dist/flow/types/flow-file.js +0 -27
  152. package/dist/flow/types/flow-job.d.ts +0 -118
  153. package/dist/flow/types/flow-job.d.ts.map +0 -1
  154. package/dist/flow/types/flow-job.js +0 -11
  155. package/dist/flow/types/flow-types.d.ts +0 -321
  156. package/dist/flow/types/flow-types.d.ts.map +0 -1
  157. package/dist/flow/types/flow-types.js +0 -52
  158. package/dist/flow/types/index.d.ts +0 -4
  159. package/dist/flow/types/index.d.ts.map +0 -1
  160. package/dist/flow/types/index.js +0 -3
  161. package/dist/flow/types/run-args.d.ts +0 -38
  162. package/dist/flow/types/run-args.d.ts.map +0 -1
  163. package/dist/flow/types/run-args.js +0 -30
  164. package/dist/flow/types/type-validator.d.ts +0 -26
  165. package/dist/flow/types/type-validator.d.ts.map +0 -1
  166. package/dist/flow/types/type-validator.js +0 -134
  167. package/dist/flow/utils/resolve-upload-metadata.d.ts +0 -11
  168. package/dist/flow/utils/resolve-upload-metadata.d.ts.map +0 -1
  169. package/dist/flow/utils/resolve-upload-metadata.js +0 -28
  170. package/dist/flow-2zXnEiWL.cjs +0 -1
  171. package/dist/flow-CRaKy7Vj.js +0 -2
  172. package/dist/flow-CRaKy7Vj.js.map +0 -1
  173. package/dist/generate-id-Dm-Vboxq.d.ts +0 -34
  174. package/dist/generate-id-Dm-Vboxq.d.ts.map +0 -1
  175. package/dist/generate-id-LjJRLD6N.d.cts +0 -34
  176. package/dist/generate-id-LjJRLD6N.d.cts.map +0 -1
  177. package/dist/generate-id-xHp_Z7Cl.cjs +0 -1
  178. package/dist/generate-id-yohS1ZDk.js +0 -2
  179. package/dist/generate-id-yohS1ZDk.js.map +0 -1
  180. package/dist/index-BO8GZlbD.d.cts +0 -1040
  181. package/dist/index-BO8GZlbD.d.cts.map +0 -1
  182. package/dist/index-D-CoVpkZ.d.ts +0 -1004
  183. package/dist/index-D-CoVpkZ.d.ts.map +0 -1
  184. package/dist/index.d.ts.map +0 -1
  185. package/dist/logger/logger.cjs +0 -1
  186. package/dist/logger/logger.d.cts +0 -8
  187. package/dist/logger/logger.d.cts.map +0 -1
  188. package/dist/logger/logger.d.ts +0 -5
  189. package/dist/logger/logger.d.ts.map +0 -1
  190. package/dist/logger/logger.js +0 -10
  191. package/dist/logger/logger.js.map +0 -1
  192. package/dist/semaphore-0ZwjVpyF.js +0 -2
  193. package/dist/semaphore-0ZwjVpyF.js.map +0 -1
  194. package/dist/semaphore-BHprIjFI.d.cts +0 -37
  195. package/dist/semaphore-BHprIjFI.d.cts.map +0 -1
  196. package/dist/semaphore-DThupBkc.d.ts +0 -37
  197. package/dist/semaphore-DThupBkc.d.ts.map +0 -1
  198. package/dist/semaphore-DVrONiAV.cjs +0 -1
  199. package/dist/stream-limiter-CoWKv39w.js +0 -2
  200. package/dist/stream-limiter-JgOwmkMa.cjs +0 -1
  201. package/dist/streams/multi-stream.cjs +0 -1
  202. package/dist/streams/multi-stream.d.cts +0 -91
  203. package/dist/streams/multi-stream.d.cts.map +0 -1
  204. package/dist/streams/multi-stream.d.ts +0 -86
  205. package/dist/streams/multi-stream.d.ts.map +0 -1
  206. package/dist/streams/multi-stream.js +0 -149
  207. package/dist/streams/multi-stream.js.map +0 -1
  208. package/dist/streams/stream-limiter.cjs +0 -1
  209. package/dist/streams/stream-limiter.d.cts.map +0 -1
  210. package/dist/streams/stream-limiter.d.ts +0 -27
  211. package/dist/streams/stream-limiter.d.ts.map +0 -1
  212. package/dist/streams/stream-limiter.js +0 -49
  213. package/dist/streams/stream-splitter.cjs +0 -1
  214. package/dist/streams/stream-splitter.d.cts +0 -68
  215. package/dist/streams/stream-splitter.d.cts.map +0 -1
  216. package/dist/streams/stream-splitter.d.ts +0 -51
  217. package/dist/streams/stream-splitter.d.ts.map +0 -1
  218. package/dist/streams/stream-splitter.js +0 -175
  219. package/dist/streams/stream-splitter.js.map +0 -1
  220. package/dist/types/data-store-registry.d.ts +0 -13
  221. package/dist/types/data-store-registry.d.ts.map +0 -1
  222. package/dist/types/data-store-registry.js +0 -4
  223. package/dist/types/data-store.d.ts +0 -316
  224. package/dist/types/data-store.d.ts.map +0 -1
  225. package/dist/types/data-store.js +0 -157
  226. package/dist/types/event-broadcaster.d.ts +0 -28
  227. package/dist/types/event-broadcaster.d.ts.map +0 -1
  228. package/dist/types/event-broadcaster.js +0 -6
  229. package/dist/types/event-emitter.d.ts +0 -378
  230. package/dist/types/event-emitter.d.ts.map +0 -1
  231. package/dist/types/event-emitter.js +0 -223
  232. package/dist/types/index.d.ts.map +0 -1
  233. package/dist/types/input-file.d.ts +0 -104
  234. package/dist/types/input-file.d.ts.map +0 -1
  235. package/dist/types/input-file.js +0 -27
  236. package/dist/types/kv-store.d.ts +0 -281
  237. package/dist/types/kv-store.d.ts.map +0 -1
  238. package/dist/types/kv-store.js +0 -234
  239. package/dist/types/middleware.d.ts +0 -17
  240. package/dist/types/middleware.d.ts.map +0 -1
  241. package/dist/types/middleware.js +0 -21
  242. package/dist/types/upload-event.d.ts +0 -105
  243. package/dist/types/upload-event.d.ts.map +0 -1
  244. package/dist/types/upload-event.js +0 -71
  245. package/dist/types/upload-file.d.ts +0 -136
  246. package/dist/types/upload-file.d.ts.map +0 -1
  247. package/dist/types/upload-file.js +0 -34
  248. package/dist/types/websocket.d.ts +0 -144
  249. package/dist/types/websocket.d.ts.map +0 -1
  250. package/dist/types/websocket.js +0 -40
  251. package/dist/types-BT-cvi7T.cjs +0 -1
  252. package/dist/types-DhU2j-XF.js +0 -2
  253. package/dist/types-DhU2j-XF.js.map +0 -1
  254. package/dist/upload/convert-to-stream.d.ts +0 -38
  255. package/dist/upload/convert-to-stream.d.ts.map +0 -1
  256. package/dist/upload/convert-to-stream.js +0 -43
  257. package/dist/upload/convert-upload-to-flow-file.d.ts +0 -14
  258. package/dist/upload/convert-upload-to-flow-file.d.ts.map +0 -1
  259. package/dist/upload/convert-upload-to-flow-file.js +0 -21
  260. package/dist/upload/create-upload.d.ts +0 -68
  261. package/dist/upload/create-upload.d.ts.map +0 -1
  262. package/dist/upload/create-upload.js +0 -157
  263. package/dist/upload/index.d.ts.map +0 -1
  264. package/dist/upload/mime.d.ts +0 -24
  265. package/dist/upload/mime.d.ts.map +0 -1
  266. package/dist/upload/mime.js +0 -351
  267. package/dist/upload/upload-chunk.d.ts +0 -58
  268. package/dist/upload/upload-chunk.d.ts.map +0 -1
  269. package/dist/upload/upload-chunk.js +0 -277
  270. package/dist/upload/upload-server.d.ts +0 -221
  271. package/dist/upload/upload-server.d.ts.map +0 -1
  272. package/dist/upload/upload-server.js +0 -181
  273. package/dist/upload/upload-strategy-negotiator.d.ts +0 -148
  274. package/dist/upload/upload-strategy-negotiator.d.ts.map +0 -1
  275. package/dist/upload/upload-strategy-negotiator.js +0 -217
  276. package/dist/upload/upload-url.d.ts +0 -68
  277. package/dist/upload/upload-url.d.ts.map +0 -1
  278. package/dist/upload/upload-url.js +0 -142
  279. package/dist/upload/write-to-store.d.ts +0 -77
  280. package/dist/upload/write-to-store.d.ts.map +0 -1
  281. package/dist/upload/write-to-store.js +0 -147
  282. package/dist/upload-DLuICjpP.cjs +0 -1
  283. package/dist/upload-DaXO34dE.js +0 -2
  284. package/dist/upload-DaXO34dE.js.map +0 -1
  285. package/dist/uploadista-error-BVsVxqvz.js.map +0 -1
  286. package/dist/uploadista-error-CwxYs4EB.d.ts +0 -52
  287. package/dist/uploadista-error-CwxYs4EB.d.ts.map +0 -1
  288. package/dist/uploadista-error-kKlhLRhY.d.cts +0 -52
  289. package/dist/uploadista-error-kKlhLRhY.d.cts.map +0 -1
  290. package/dist/utils/checksum.d.ts +0 -22
  291. package/dist/utils/checksum.d.ts.map +0 -1
  292. package/dist/utils/checksum.js +0 -49
  293. package/dist/utils/debounce.cjs +0 -1
  294. package/dist/utils/debounce.d.cts +0 -38
  295. package/dist/utils/debounce.d.cts.map +0 -1
  296. package/dist/utils/debounce.d.ts +0 -36
  297. package/dist/utils/debounce.d.ts.map +0 -1
  298. package/dist/utils/debounce.js +0 -73
  299. package/dist/utils/generate-id.cjs +0 -1
  300. package/dist/utils/generate-id.d.cts +0 -2
  301. package/dist/utils/generate-id.d.ts +0 -32
  302. package/dist/utils/generate-id.d.ts.map +0 -1
  303. package/dist/utils/generate-id.js +0 -23
  304. package/dist/utils/md5.cjs +0 -1
  305. package/dist/utils/md5.d.cts +0 -73
  306. package/dist/utils/md5.d.cts.map +0 -1
  307. package/dist/utils/md5.d.ts +0 -71
  308. package/dist/utils/md5.d.ts.map +0 -1
  309. package/dist/utils/md5.js +0 -417
  310. package/dist/utils/md5.js.map +0 -1
  311. package/dist/utils/once.cjs +0 -1
  312. package/dist/utils/once.d.cts +0 -25
  313. package/dist/utils/once.d.cts.map +0 -1
  314. package/dist/utils/once.d.ts +0 -21
  315. package/dist/utils/once.d.ts.map +0 -1
  316. package/dist/utils/once.js +0 -54
  317. package/dist/utils/once.js.map +0 -1
  318. package/dist/utils/semaphore.cjs +0 -1
  319. package/dist/utils/semaphore.d.cts +0 -3
  320. package/dist/utils/semaphore.d.ts +0 -78
  321. package/dist/utils/semaphore.d.ts.map +0 -1
  322. package/dist/utils/semaphore.js +0 -134
  323. package/dist/utils/throttle.cjs +0 -1
  324. package/dist/utils/throttle.d.cts +0 -24
  325. package/dist/utils/throttle.d.cts.map +0 -1
  326. package/dist/utils/throttle.d.ts +0 -18
  327. package/dist/utils/throttle.d.ts.map +0 -1
  328. package/dist/utils/throttle.js +0 -20
  329. package/dist/utils/throttle.js.map +0 -1
  330. package/src/logger/logger.ts +0 -14
  331. /package/dist/{errors-CRm1FHHT.cjs → errors-D-K-vxsP.cjs} +0 -0
package/README.md CHANGED
@@ -481,7 +481,7 @@ if (capabilities.supportsParallelUploads) {
481
481
  }
482
482
  ```
483
483
 
484
- ### Streams Module (`/streams/*`)
484
+ ### Streams Module (`/streams`)
485
485
 
486
486
  Advanced stream manipulation utilities:
487
487
 
@@ -502,14 +502,14 @@ const limiter = new StreamLimiter({
502
502
  const limited = inputStream.pipeThrough(limiter.transform);
503
503
  ```
504
504
 
505
- ### Utils Module (`/utils/*`)
505
+ ### Utils Module (`/utils`)
506
506
 
507
507
  Utility functions for common operations:
508
508
 
509
509
  #### Debounce
510
510
 
511
511
  ```typescript
512
- import { debounce } from "@uploadista/core/utils/debounce";
512
+ import { debounce } from "@uploadista/core/utils";
513
513
 
514
514
  const debouncedFn = debounce(
515
515
  (value: string) => console.log("Search:", value),
@@ -526,7 +526,7 @@ debouncedFn("abc"); // Logs "Search: abc" after 300ms
526
526
  #### Throttle
527
527
 
528
528
  ```typescript
529
- import { throttle } from "@uploadista/core/utils/throttle";
529
+ import { throttle } from "@uploadista/core/utils";
530
530
 
531
531
  const throttledFn = throttle(
532
532
  (value: number) => console.log("Value:", value),
@@ -546,7 +546,7 @@ throttledFn(4); // Logs "Value: 4"
546
546
  Ensure a function runs only once:
547
547
 
548
548
  ```typescript
549
- import { once } from "@uploadista/core/utils/once";
549
+ import { once } from "@uploadista/core/utils";
550
550
 
551
551
  const initialize = once(() => {
552
552
  console.log("Initializing...");
@@ -563,7 +563,7 @@ initialize(); // Does nothing
563
563
  Generate unique identifiers:
564
564
 
565
565
  ```typescript
566
- import { GenerateId } from "@uploadista/core/utils/generate-id";
566
+ import { GenerateId } from "@uploadista/core/utils";
567
567
  import { Effect } from "effect";
568
568
 
569
569
  const program = Effect.gen(function* () {
@@ -573,20 +573,6 @@ const program = Effect.gen(function* () {
573
573
  });
574
574
  ```
575
575
 
576
- ### Logger Module (`/logger/*`)
577
-
578
- Simple logging utilities:
579
-
580
- ```typescript
581
- import { createLogger } from "@uploadista/core/logger/logger";
582
-
583
- const logger = createLogger(true); // enabled
584
- logger.log("Processing file..."); // Logs to console
585
-
586
- const disabledLogger = createLogger(false); // disabled
587
- disabledLogger.log("This won't log"); // Silent
588
- ```
589
-
590
576
  ### WebSocket Module (`/websocket`)
591
577
 
592
578
  Real-time event streaming:
@@ -0,0 +1,2 @@
1
+ import{n as e}from"./uploadista-error-CjfcFnVa.js";import{Context as t,Effect as n,Layer as r}from"effect";var i=class extends t.Tag(`UploadistaGenerateIdService`)(){};const a=i.Service,o=i.of({generateId:()=>n.succeed(crypto.randomUUID())}),s=r.succeed(i,o),c=i.of({generateId:()=>n.succeed(`${Date.now()}-${Math.random().toString(36).slice(2,11)}`)}),l=[`sha256`];function u(e){return l.includes(e)}function d(t,r){return n.gen(function*(){if(!u(r))return yield*e.fromCode(`UNSUPPORTED_CHECKSUM_ALGORITHM`,{body:`Checksum algorithm '${r}' is not supported. Supported algorithms: ${l.join(`, `)}`,details:{algorithm:r,supportedAlgorithms:l}}).toEffect();let i=r.toUpperCase().replace(/\d+/,`-$&`),a=yield*n.tryPromise({try:()=>crypto.subtle.digest(i,t),catch:t=>e.fromCode(`UNKNOWN_ERROR`,{body:`Failed to compute checksum: ${t instanceof Error?t.message:`Unknown error`}`,cause:t,details:{algorithm:r}})});return Array.from(new Uint8Array(a)).map(e=>e.toString(16).padStart(2,`0`)).join(``)})}export{o as a,s as i,u as n,a as o,i as r,c as s,d as t};
2
+ //# sourceMappingURL=checksum-C5qE-5eg.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"checksum-C5qE-5eg.js","names":[],"sources":["../src/utils/generate-id.ts","../src/utils/checksum.ts"],"sourcesContent":["import { Context, Effect, Layer } from \"effect\";\n\nexport type GenerateIdShape = {\n generateId: () => Effect.Effect<string>;\n};\n\n// Declaring a tag for a service that generates random id\nexport class GenerateId extends Context.Tag(\"UploadistaGenerateIdService\")<\n GenerateId,\n { readonly generateId: () => Effect.Effect<string> }\n>() {}\n\n/**\n * Effect-based ID generation services\n */\nexport const GenerateIdService = GenerateId.Service;\n\n/**\n * Generates a random UUID using Effect\n * @returns Effect that produces a random UUID string\n */\nexport const GenerateIdRandom = GenerateId.of({\n generateId: () => Effect.succeed(crypto.randomUUID()),\n});\n\nexport const GenerateIdLive = Layer.succeed(GenerateId, GenerateIdRandom);\n\n/**\n * Generates a timestamp-based ID using Effect\n * @returns Effect that produces a timestamp-based ID\n */\nexport const GenerateIdTimestamp = GenerateId.of({\n generateId: () =>\n Effect.succeed(`${Date.now()}-${Math.random().toString(36).slice(2, 11)}`),\n});\n","import { Effect } from \"effect\";\nimport { UploadistaError } from \"../errors/uploadista-error\";\n\n/**\n * Supported checksum algorithms\n */\nconst SUPPORTED_ALGORITHMS = [\"sha256\"] as const;\nexport type ChecksumAlgorithm = (typeof SUPPORTED_ALGORITHMS)[number];\n\n/**\n * Check if a checksum algorithm is supported\n */\nexport function isSupportedAlgorithm(algorithm: string): algorithm is ChecksumAlgorithm {\n return SUPPORTED_ALGORITHMS.includes(algorithm as ChecksumAlgorithm);\n}\n\n/**\n * Compute checksum of file bytes using the Web Crypto API.\n * This works across all modern platforms: browsers, Node.js 15+, Deno, Bun, and Cloudflare Workers.\n *\n * @param bytes - File content as Uint8Array\n * @param algorithm - Hashing algorithm to use (currently only 'sha256' is supported)\n * @returns Effect that resolves to hex-encoded checksum string\n */\nexport function computeChecksum(\n bytes: Uint8Array,\n algorithm: string,\n): Effect.Effect<string, UploadistaError> {\n return Effect.gen(function* () {\n // Validate algorithm is supported\n if (!isSupportedAlgorithm(algorithm)) {\n return yield* UploadistaError.fromCode(\"UNSUPPORTED_CHECKSUM_ALGORITHM\", {\n body: `Checksum algorithm '${algorithm}' is not supported. Supported algorithms: ${SUPPORTED_ALGORITHMS.join(\", \")}`,\n details: { algorithm, supportedAlgorithms: SUPPORTED_ALGORITHMS },\n }).toEffect();\n }\n\n // Map algorithm name to Web Crypto API algorithm name\n const webCryptoAlgorithm = algorithm.toUpperCase().replace(/\\d+/, \"-$&\"); // \"sha256\" -> \"SHA-256\"\n\n // Compute hash using Web Crypto API (available in browsers, Node.js 15+, Deno, Bun, Cloudflare Workers)\n // Pass Uint8Array directly - it's a valid BufferSource\n const hashBuffer = yield* Effect.tryPromise({\n try: () => crypto.subtle.digest(webCryptoAlgorithm, bytes as BufferSource),\n catch: (error) =>\n UploadistaError.fromCode(\"UNKNOWN_ERROR\", {\n body: `Failed to compute checksum: ${error instanceof Error ? error.message : \"Unknown error\"}`,\n cause: error,\n details: { algorithm },\n }),\n });\n\n // Convert ArrayBuffer to hex string\n const hashArray = Array.from(new Uint8Array(hashBuffer));\n const hashHex = hashArray\n .map((byte) => byte.toString(16).padStart(2, \"0\"))\n .join(\"\");\n\n return hashHex;\n });\n}\n"],"mappings":"2GAOA,IAAa,EAAb,cAAgC,EAAQ,IAAI,8BAA8B,EAGvE,AAAC,GAKJ,MAAa,EAAoB,EAAW,QAM/B,EAAmB,EAAW,GAAG,CAC5C,eAAkB,EAAO,QAAQ,OAAO,YAAY,CAAC,CACtD,CAAC,CAEW,EAAiB,EAAM,QAAQ,EAAY,EAAiB,CAM5D,EAAsB,EAAW,GAAG,CAC/C,eACE,EAAO,QAAQ,GAAG,KAAK,KAAK,CAAC,GAAG,KAAK,QAAQ,CAAC,SAAS,GAAG,CAAC,MAAM,EAAG,GAAG,GAAG,CAC7E,CAAC,CC5BI,EAAuB,CAAC,SAAS,CAMvC,SAAgB,EAAqB,EAAmD,CACtF,OAAO,EAAqB,SAAS,EAA+B,CAWtE,SAAgB,EACd,EACA,EACwC,CACxC,OAAO,EAAO,IAAI,WAAa,CAE7B,GAAI,CAAC,EAAqB,EAAU,CAClC,OAAO,MAAO,EAAgB,SAAS,iCAAkC,CACvE,KAAM,uBAAuB,EAAU,4CAA4C,EAAqB,KAAK,KAAK,GAClH,QAAS,CAAE,YAAW,oBAAqB,EAAsB,CAClE,CAAC,CAAC,UAAU,CAIf,IAAM,EAAqB,EAAU,aAAa,CAAC,QAAQ,MAAO,MAAM,CAIlE,EAAa,MAAO,EAAO,WAAW,CAC1C,QAAW,OAAO,OAAO,OAAO,EAAoB,EAAsB,CAC1E,MAAQ,GACN,EAAgB,SAAS,gBAAiB,CACxC,KAAM,+BAA+B,aAAiB,MAAQ,EAAM,QAAU,kBAC9E,MAAO,EACP,QAAS,CAAE,YAAW,CACvB,CAAC,CACL,CAAC,CAQF,OALkB,MAAM,KAAK,IAAI,WAAW,EAAW,CAAC,CAErD,IAAK,GAAS,EAAK,SAAS,GAAG,CAAC,SAAS,EAAG,IAAI,CAAC,CACjD,KAAK,GAAG,EAGX"}
@@ -0,0 +1 @@
1
+ const e=require(`./uploadista-error-DdTP-Rjx.cjs`);let t=require(`effect`);t=e.a(t);var n=class extends t.Context.Tag(`UploadistaGenerateIdService`)(){};const r=n.Service,i=n.of({generateId:()=>t.Effect.succeed(crypto.randomUUID())}),a=t.Layer.succeed(n,i),o=n.of({generateId:()=>t.Effect.succeed(`${Date.now()}-${Math.random().toString(36).slice(2,11)}`)}),s=[`sha256`];function c(e){return s.includes(e)}function l(n,r){return t.Effect.gen(function*(){if(!c(r))return yield*e.n.fromCode(`UNSUPPORTED_CHECKSUM_ALGORITHM`,{body:`Checksum algorithm '${r}' is not supported. Supported algorithms: ${s.join(`, `)}`,details:{algorithm:r,supportedAlgorithms:s}}).toEffect();let i=r.toUpperCase().replace(/\d+/,`-$&`),a=yield*t.Effect.tryPromise({try:()=>crypto.subtle.digest(i,n),catch:t=>e.n.fromCode(`UNKNOWN_ERROR`,{body:`Failed to compute checksum: ${t instanceof Error?t.message:`Unknown error`}`,cause:t,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 i}}),Object.defineProperty(exports,`i`,{enumerable:!0,get:function(){return a}}),Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return c}}),Object.defineProperty(exports,`o`,{enumerable:!0,get:function(){return r}}),Object.defineProperty(exports,`r`,{enumerable:!0,get:function(){return n}}),Object.defineProperty(exports,`s`,{enumerable:!0,get:function(){return o}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return l}});
@@ -1 +1 @@
1
- const e=require(`../uploadista-error-BB-Wdiz9.cjs`);require(`../errors-CRm1FHHT.cjs`),exports.ERRORS=e.ERROR_CATALOG,exports.ERROR_CATALOG=e.ERROR_CATALOG,exports.UploadistaError=e.UploadistaError,exports.httpFailureEffect=e.httpFailureEffect,exports.isUploadistaError=e.isUploadistaError;
1
+ const e=require(`../uploadista-error-DdTP-Rjx.cjs`);require(`../errors-D-K-vxsP.cjs`),exports.ERRORS=e.t,exports.ERROR_CATALOG=e.t,exports.UploadistaError=e.n,exports.httpFailure=e.r,exports.isUploadistaError=e.i;
@@ -1,3 +1,3 @@
1
- import { ERROR_CATALOG, UploadistaError, UploadistaErrorCode, httpFailureEffect, isUploadistaError } from "../uploadista-error-kKlhLRhY.cjs";
1
+ import { a as isUploadistaError, i as httpFailure, n as UploadistaError, r as UploadistaErrorCode, t as ERROR_CATALOG } from "../uploadista-error-CAtkQiAv.cjs";
2
2
  import "../index-BtBZHVmz.cjs";
3
- export { ERROR_CATALOG as ERRORS, ERROR_CATALOG, UploadistaError, UploadistaErrorCode, httpFailureEffect, isUploadistaError };
3
+ export { ERROR_CATALOG as ERRORS, ERROR_CATALOG, UploadistaError, UploadistaErrorCode, httpFailure, isUploadistaError };
@@ -1,3 +1,3 @@
1
- export * from "./uploadista-error.js";
2
- export { ERROR_CATALOG as ERRORS } from "./uploadista-error.js";
3
- //# sourceMappingURL=index.d.ts.map
1
+ import { a as isUploadistaError, i as httpFailure, n as UploadistaError, r as UploadistaErrorCode, t as ERROR_CATALOG } from "../uploadista-error-D9SONF9K.js";
2
+ import "../index-BoGG5KAY.js";
3
+ export { ERROR_CATALOG as ERRORS, ERROR_CATALOG, UploadistaError, UploadistaErrorCode, httpFailure, isUploadistaError };
@@ -1,2 +1 @@
1
- export * from "./uploadista-error.js";
2
- export { ERROR_CATALOG as ERRORS } from "./uploadista-error.js";
1
+ import{i as e,n as t,r as n,t as r}from"../uploadista-error-CjfcFnVa.js";import"../errors-8i_aMxOE.js";export{r as ERRORS,r as ERROR_CATALOG,t as UploadistaError,n as httpFailure,e as isUploadistaError};
@@ -1 +1 @@
1
- require(`../uploadista-error-BB-Wdiz9.cjs`),require(`../errors-CRm1FHHT.cjs`);const e=require(`../flow-2zXnEiWL.cjs`);require(`../types-BT-cvi7T.cjs`),require(`../upload-DLuICjpP.cjs`),require(`../generate-id-xHp_Z7Cl.cjs`),require(`../stream-limiter-JgOwmkMa.cjs`),require(`../semaphore-DVrONiAV.cjs`),exports.EventType=e.EventType,exports.FlowProvider=e.FlowProvider,exports.FlowServer=e.FlowServer,exports.ImagePlugin=e.ImagePlugin,exports.NodeType=e.NodeType,exports.ParallelScheduler=e.ParallelScheduler,exports.completeNodeExecution=e.completeNodeExecution,exports.createFlow=e.createFlow,exports.createFlowEdge=e.createFlowEdge,exports.createFlowNode=e.createFlowNode,exports.createFlowServer=e.createFlowServer,exports.createInputNode=e.createInputNode,exports.createStorageNode=e.createStorageNode,exports.createStreamingInputNode=e.createStreamingInputNode,exports.flowDataSchema=e.flowDataSchema,exports.flowFileBatchSchema=e.flowFileBatchSchema,exports.flowFileSchema=e.flowFileSchema,exports.flowServer=e.flowServer,exports.getFlowData=e.getFlowData,exports.getNodeData=e.getNodeData,exports.isFlowFile=e.isFlowFile,exports.optimizeParamsSchema=e.optimizeParamsSchema,exports.resizeParamsSchema=e.resizeParamsSchema,exports.runArgsSchema=e.runArgsSchema,exports.storageParamsSchema=e.storageParamsSchema,exports.waitingNodeExecution=e.waitingNodeExecution;
1
+ require(`../uploadista-error-DdTP-Rjx.cjs`),require(`../errors-D-K-vxsP.cjs`);const e=require(`../flow-s5bgJsdb.cjs`);require(`../types-Dj9g8ocl.cjs`),require(`../upload-DvLp6TXO.cjs`),require(`../checksum-wSBuXX84.cjs`),require(`../stream-limiter-DYGG4t9f.cjs`),exports.CredentialProvider=e.u,exports.EventType=e.A,exports.FlowProvider=e.b,exports.FlowServer=e.x,exports.ImageAiPlugin=e.l,exports.ImagePlugin=e.c,exports.NodeType=e.D,exports.ParallelScheduler=e.E,exports.ZipPlugin=e.r,exports.completeNodeExecution=e.v,exports.createFlow=e.n,exports.createFlowEdge=e.j,exports.createFlowNode=e.O,exports.createFlowServer=e.S,exports.createFlowWithSchema=e.w,exports.createInputNode=e.m,exports.createStorageNode=e.f,exports.createTransformNode=e.d,exports.describeImageParamsSchema=e.s,exports.flowServer=e.C,exports.getFlowData=e.T,exports.getNodeData=e.k,exports.inputDataSchema=e.h,exports.inputNodeParamsSchema=e.g,exports.optimizeParamsSchema=e.o,exports.removeBackgroundParamsSchema=e.a,exports.resizeParamsSchema=e.i,exports.resolveUploadMetadata=e._,exports.runArgsSchema=e.t,exports.storageParamsSchema=e.p,exports.waitingNodeExecution=e.y;
@@ -1,6 +1,6 @@
1
- import "../uploadista-error-kKlhLRhY.cjs";
1
+ import "../uploadista-error-CAtkQiAv.cjs";
2
2
  import "../index-BtBZHVmz.cjs";
3
- import { ConditionField, ConditionOperator, ConditionValue, EventType, ExecutionLevel, Flow, FlowCondition, FlowConfig, FlowData, FlowEdge, FlowEvent, FlowEventFlowEnd, FlowEventFlowStart, FlowEventJobEnd, FlowEventJobStart, FlowEventNodeEnd, FlowEventNodeError, FlowEventNodeResponse, FlowEventNodeStart, FlowExecutionContext, FlowExecutionResult, FlowFile, FlowFileBatch, FlowFileData, FlowJob, FlowJobStatus, FlowJobTask, FlowJobTaskStatus, FlowNode, FlowNodeData, FlowProvider, FlowProviderShape, FlowServer, FlowServerLayer, FlowServerOptions, FlowServerShape, ImagePlugin, ImagePluginShape, NodeConnectionValidator, NodeExecutionResult, NodeType, NodeTypeMap, OptimizeParams, ParallelScheduler, ParallelSchedulerConfig, ResizeParams, RunArgs, StorageParams, TypeCompatibilityChecker, completeNodeExecution, createFlow, createFlowEdge, createFlowNode, createFlowServer, createInputNode, createStorageNode, createStreamingInputNode, flowDataSchema, flowFileBatchSchema, flowFileSchema, flowServer, getFlowData, getNodeData, isFlowFile, optimizeParamsSchema, resizeParamsSchema, runArgsSchema, storageParamsSchema, waitingNodeExecution } from "../index-BO8GZlbD.cjs";
4
- import "../generate-id-LjJRLD6N.cjs";
5
- import "../semaphore-BHprIjFI.cjs";
6
- export { ConditionField, ConditionOperator, ConditionValue, EventType, ExecutionLevel, Flow, FlowCondition, FlowConfig, FlowData, FlowEdge, FlowEvent, FlowEventFlowEnd, FlowEventFlowStart, FlowEventJobEnd, FlowEventJobStart, FlowEventNodeEnd, FlowEventNodeError, FlowEventNodeResponse, FlowEventNodeStart, FlowExecutionContext, FlowExecutionResult, FlowFile, FlowFileBatch, FlowFileData, FlowJob, FlowJobStatus, FlowJobTask, FlowJobTaskStatus, FlowNode, FlowNodeData, FlowProvider, FlowProviderShape, FlowServer, FlowServerLayer, FlowServerOptions, FlowServerShape, ImagePlugin, ImagePluginShape, NodeConnectionValidator, NodeExecutionResult, NodeType, NodeTypeMap, OptimizeParams, ParallelScheduler, ParallelSchedulerConfig, ResizeParams, RunArgs, StorageParams, TypeCompatibilityChecker, completeNodeExecution, createFlow, createFlowEdge, createFlowNode, createFlowServer, createInputNode, createStorageNode, createStreamingInputNode, flowDataSchema, flowFileBatchSchema, flowFileSchema, flowServer, getFlowData, getNodeData, isFlowFile, optimizeParamsSchema, resizeParamsSchema, runArgsSchema, storageParamsSchema, waitingNodeExecution };
3
+ import { $ as FlowServerShape, A as ImageAiContext, An as FlowEventJobStart, B as StorageParams, Bn as NodeType, C as describeImageParamsSchema, Cn as waitingNodeExecution, D as resizeParamsSchema, Dn as FlowEventFlowError, E as ResizeParams, En as FlowEventFlowEnd, F as ExecutionLevel, Fn as FlowEventNodeResume, G as createInputNode, H as storageParamsSchema, Hn as getNodeData, I as ParallelScheduler, In as FlowEventNodeStart, J as FlowProvider, K as inputDataSchema, L as ParallelSchedulerConfig, Ln as ConditionField, M as ImageAiPluginShape, Mn as FlowEventNodeError, N as CredentialProvider, Nn as FlowEventNodePause, O as OptimizeParams, On as FlowEventFlowStart, P as CredentialProviderShape, Pn as FlowEventNodeResponse, Q as FlowServerOptions, R as TransformNodeConfig, Rn as ConditionOperator, S as DescribeImageParams, Sn as completeNodeExecution, T as ImagePluginShape, Tn as FlowEvent, U as InputData, V as createStorageNode, Vn as createFlowNode, W as InputNodeParams, X as FlowServer, Y as FlowProviderShape, Z as FlowServerLayer, _ as ZipParams, _n as FlowNodeData, a as FlowCondition, at as FlowJobTaskStatus, b as RemoveBackgroundParams, bn as NodeTypeMap, c as FlowPluginRequirements, cn as Flow, d as NodeDefinitionsRecord, dn as createFlowWithSchema, et as createFlowServer, f as TypedFlow, fn as getFlowData, g as ZipInput, gn as FlowNode, h as createFlow, hn as FlowConfig, i as runArgsSchema, it as FlowJobTask, j as ImageAiPlugin, jn as FlowEventNodeEnd, k as optimizeParamsSchema, kn as FlowEventJobEnd, l as FlowRequirements, ln as FlowData, m as TypedFlowEdge, mn as createFlowEdge, n as resolveUploadMetadata, nt as FlowJob, o as FlowInputMap, p as TypedFlowConfig, pn as FlowEdge, q as inputNodeParamsSchema, r as RunArgs, rt as FlowJobStatus, s as FlowOutputMap, t as ResolvedUploadMetadata, tt as flowServer, u as NodeDefinition, un as FlowExecutionResult, v as ZipPlugin, vn as NodeConnectionValidator, w as ImagePlugin, wn as EventType, x as removeBackgroundParamsSchema, xn as TypeCompatibilityChecker, y as ZipPluginShape, yn as NodeExecutionResult, z as createTransformNode, zn as ConditionValue } from "../index-DM69UMgG.cjs";
4
+ import "../index-GLPiXqj4.cjs";
5
+ import "../index-B46hb7yB.cjs";
6
+ export { ConditionField, ConditionOperator, ConditionValue, CredentialProvider, CredentialProviderShape, DescribeImageParams, EventType, ExecutionLevel, Flow, FlowCondition, FlowConfig, FlowData, FlowEdge, FlowEvent, FlowEventFlowEnd, FlowEventFlowError, FlowEventFlowStart, FlowEventJobEnd, FlowEventJobStart, FlowEventNodeEnd, FlowEventNodeError, FlowEventNodePause, FlowEventNodeResponse, FlowEventNodeResume, FlowEventNodeStart, FlowExecutionResult, FlowInputMap, FlowJob, FlowJobStatus, FlowJobTask, FlowJobTaskStatus, FlowNode, FlowNodeData, FlowOutputMap, FlowPluginRequirements, FlowProvider, FlowProviderShape, FlowRequirements, FlowServer, FlowServerLayer, FlowServerOptions, FlowServerShape, ImageAiContext, ImageAiPlugin, ImageAiPluginShape, ImagePlugin, ImagePluginShape, InputData, InputNodeParams, NodeConnectionValidator, NodeDefinition, NodeDefinitionsRecord, NodeExecutionResult, NodeType, NodeTypeMap, OptimizeParams, ParallelScheduler, ParallelSchedulerConfig, RemoveBackgroundParams, ResizeParams, ResolvedUploadMetadata, RunArgs, StorageParams, TransformNodeConfig, TypeCompatibilityChecker, TypedFlow, TypedFlowConfig, TypedFlowEdge, ZipInput, ZipParams, ZipPlugin, ZipPluginShape, completeNodeExecution, createFlow, createFlowEdge, createFlowNode, createFlowServer, createFlowWithSchema, createInputNode, createStorageNode, createTransformNode, describeImageParamsSchema, flowServer, getFlowData, getNodeData, inputDataSchema, inputNodeParamsSchema, optimizeParamsSchema, removeBackgroundParamsSchema, resizeParamsSchema, resolveUploadMetadata, runArgsSchema, storageParamsSchema, waitingNodeExecution };
@@ -1,24 +1,6 @@
1
- export type { FlowEdge } from "./edge";
2
- export * from "./edge";
3
- export * from "./event";
4
- export type { Flow, FlowData } from "./flow";
5
- export * from "./flow";
6
- export { createFlowWithSchema } from "./flow";
7
- export * from "./flow-server";
8
- export * from "./node";
9
- export { createFlowNode, NodeType } from "./node";
10
- export * from "./nodes";
11
- export * from "./parallel-scheduler";
12
- export * from "./plugins/credential-provider";
13
- export * from "./plugins/image-ai-plugin";
14
- export * from "./plugins/image-plugin";
15
- export * from "./plugins/types";
16
- export * from "./plugins/zip-plugin";
17
- export * from "./typed-flow";
18
- export { createFlow } from "./typed-flow";
19
- export * from "./types/flow-file";
20
- export * from "./types/flow-job";
21
- export * from "./types/flow-types";
22
- export * from "./types/run-args";
23
- export * from "./utils/resolve-upload-metadata";
24
- //# sourceMappingURL=index.d.ts.map
1
+ import "../uploadista-error-D9SONF9K.js";
2
+ import "../index-BoGG5KAY.js";
3
+ import { $ as FlowServerShape, A as ImageAiContext, An as FlowEventJobStart, B as StorageParams, Bn as NodeType, C as describeImageParamsSchema, Cn as waitingNodeExecution, D as resizeParamsSchema, Dn as FlowEventFlowError, E as ResizeParams, En as FlowEventFlowEnd, F as ExecutionLevel, Fn as FlowEventNodeResume, G as createInputNode, H as storageParamsSchema, Hn as getNodeData, I as ParallelScheduler, In as FlowEventNodeStart, J as FlowProvider, K as inputDataSchema, L as ParallelSchedulerConfig, Ln as ConditionField, M as ImageAiPluginShape, Mn as FlowEventNodeError, N as CredentialProvider, Nn as FlowEventNodePause, O as OptimizeParams, On as FlowEventFlowStart, P as CredentialProviderShape, Pn as FlowEventNodeResponse, Q as FlowServerOptions, R as TransformNodeConfig, Rn as ConditionOperator, S as DescribeImageParams, Sn as completeNodeExecution, T as ImagePluginShape, Tn as FlowEvent, U as InputData, V as createStorageNode, Vn as createFlowNode, W as InputNodeParams, X as FlowServer, Y as FlowProviderShape, Z as FlowServerLayer, _ as ZipParams, _n as FlowNodeData, a as FlowCondition, at as FlowJobTaskStatus, b as RemoveBackgroundParams, bn as NodeTypeMap, c as FlowPluginRequirements, cn as Flow, d as NodeDefinitionsRecord, dn as createFlowWithSchema, et as createFlowServer, f as TypedFlow, fn as getFlowData, g as ZipInput, gn as FlowNode, h as createFlow, hn as FlowConfig, i as runArgsSchema, it as FlowJobTask, j as ImageAiPlugin, jn as FlowEventNodeEnd, k as optimizeParamsSchema, kn as FlowEventJobEnd, l as FlowRequirements, ln as FlowData, m as TypedFlowEdge, mn as createFlowEdge, n as resolveUploadMetadata, nt as FlowJob, o as FlowInputMap, p as TypedFlowConfig, pn as FlowEdge, q as inputNodeParamsSchema, r as RunArgs, rt as FlowJobStatus, s as FlowOutputMap, t as ResolvedUploadMetadata, tt as flowServer, u as NodeDefinition, un as FlowExecutionResult, v as ZipPlugin, vn as NodeConnectionValidator, w as ImagePlugin, wn as EventType, x as removeBackgroundParamsSchema, xn as TypeCompatibilityChecker, y as ZipPluginShape, yn as NodeExecutionResult, z as createTransformNode, zn as ConditionValue } from "../index-BnGZO47X.js";
4
+ import "../index-DMJv8Tvo.js";
5
+ import "../index-C1mxuUxK.js";
6
+ export { ConditionField, ConditionOperator, ConditionValue, CredentialProvider, CredentialProviderShape, DescribeImageParams, EventType, ExecutionLevel, Flow, FlowCondition, FlowConfig, FlowData, FlowEdge, FlowEvent, FlowEventFlowEnd, FlowEventFlowError, FlowEventFlowStart, FlowEventJobEnd, FlowEventJobStart, FlowEventNodeEnd, FlowEventNodeError, FlowEventNodePause, FlowEventNodeResponse, FlowEventNodeResume, FlowEventNodeStart, FlowExecutionResult, FlowInputMap, FlowJob, FlowJobStatus, FlowJobTask, FlowJobTaskStatus, FlowNode, FlowNodeData, FlowOutputMap, FlowPluginRequirements, FlowProvider, FlowProviderShape, FlowRequirements, FlowServer, FlowServerLayer, FlowServerOptions, FlowServerShape, ImageAiContext, ImageAiPlugin, ImageAiPluginShape, ImagePlugin, ImagePluginShape, InputData, InputNodeParams, NodeConnectionValidator, NodeDefinition, NodeDefinitionsRecord, NodeExecutionResult, NodeType, NodeTypeMap, OptimizeParams, ParallelScheduler, ParallelSchedulerConfig, RemoveBackgroundParams, ResizeParams, ResolvedUploadMetadata, RunArgs, StorageParams, TransformNodeConfig, TypeCompatibilityChecker, TypedFlow, TypedFlowConfig, TypedFlowEdge, ZipInput, ZipParams, ZipPlugin, ZipPluginShape, completeNodeExecution, createFlow, createFlowEdge, createFlowNode, createFlowServer, createFlowWithSchema, createInputNode, createStorageNode, createTransformNode, describeImageParamsSchema, flowServer, getFlowData, getNodeData, inputDataSchema, inputNodeParamsSchema, optimizeParamsSchema, removeBackgroundParamsSchema, resizeParamsSchema, resolveUploadMetadata, runArgsSchema, storageParamsSchema, waitingNodeExecution };
@@ -1,24 +1 @@
1
- export * from "./edge";
2
- export * from "./event";
3
- export * from "./flow";
4
- // Core flow engine
5
- export { createFlowWithSchema } from "./flow";
6
- export * from "./flow-server";
7
- export * from "./node";
8
- // Node types and interfaces
9
- export { createFlowNode, NodeType } from "./node";
10
- export * from "./nodes";
11
- // Parallel execution
12
- export * from "./parallel-scheduler";
13
- export * from "./plugins/credential-provider";
14
- export * from "./plugins/image-ai-plugin";
15
- export * from "./plugins/image-plugin";
16
- export * from "./plugins/types";
17
- export * from "./plugins/zip-plugin";
18
- export * from "./typed-flow";
19
- export { createFlow } from "./typed-flow";
20
- export * from "./types/flow-file";
21
- export * from "./types/flow-job";
22
- export * from "./types/flow-types";
23
- export * from "./types/run-args";
24
- export * from "./utils/resolve-upload-metadata";
1
+ import"../uploadista-error-CjfcFnVa.js";import"../errors-8i_aMxOE.js";import{A as e,C as t,D as n,E as r,O as i,S as a,T as o,_ as s,a as c,b as l,c as u,d,f,g as p,h as m,i as h,j as g,k as _,l as v,m as y,n as b,o as x,p as S,r as C,s as w,t as T,u as E,v as D,w as O,x as k,y as A}from"../flow-B0mMJM5Y.js";import"../types-m26wrG-Z.js";import"../upload-BzU7ifyH.js";import"../checksum-C5qE-5eg.js";import"../stream-limiter-CTuiXkcq.js";export{E as CredentialProvider,e as EventType,l as FlowProvider,k as FlowServer,v as ImageAiPlugin,u as ImagePlugin,n as NodeType,r as ParallelScheduler,C as ZipPlugin,D as completeNodeExecution,b as createFlow,g as createFlowEdge,i as createFlowNode,a as createFlowServer,O as createFlowWithSchema,y as createInputNode,f as createStorageNode,d as createTransformNode,w as describeImageParamsSchema,t as flowServer,o as getFlowData,_ as getNodeData,m as inputDataSchema,p as inputNodeParamsSchema,x as optimizeParamsSchema,c as removeBackgroundParamsSchema,h as resizeParamsSchema,s as resolveUploadMetadata,T as runArgsSchema,S as storageParamsSchema,A as waitingNodeExecution};
@@ -0,0 +1,2 @@
1
+ import{n as e}from"./uploadista-error-CjfcFnVa.js";import{c as t,g as n,i as r}from"./types-m26wrG-Z.js";import{a as i,n as a,o}from"./upload-BzU7ifyH.js";import{Context as s,Effect as c,Layer as l}from"effect";import{z as u}from"zod";function d({source:e,target:t,sourcePort:n,targetPort:r}){return{source:e,target:t,sourcePort:n,targetPort:r}}let f=function(e){return e.JobStart=`job-start`,e.JobEnd=`job-end`,e.FlowStart=`flow-start`,e.FlowEnd=`flow-end`,e.FlowError=`flow-error`,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}({}),p=function(e){return e.input=`input`,e.process=`process`,e.output=`output`,e.conditional=`conditional`,e.multiplex=`multiplex`,e.merge=`merge`,e}({});function m({id:t,name:n,description:r,type:i,inputSchema:a,outputSchema:o,run:s,condition:l,multiInput:u=!1,multiOutput:d=!1,pausable:f=!1,retry:p}){return c.succeed({id:t,name:n,description:r,type:i,inputSchema:a,outputSchema:o,pausable:f,run:({data:r,jobId:i,flowId:l,storageId:u,clientId:d})=>c.gen(function*(){let f=yield*s({data:yield*c.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:u,flowId:l,clientId:d});return f.type===`waiting`?f:{type:`complete`,data:yield*c.try({try:()=>o.parse(f.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})}})}}),condition:l,multiInput:u,multiOutput:d,retry:p})}const h=e=>({id:e.id,name:e.name,description:e.description,type:e.type});var g=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 c.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}}};const _=(e,t)=>{if(e===t)return!0;try{return!!(e&&t&&typeof e==`object`&&typeof t==`object`)}catch{return!0}};var v=class{typeChecker;constructor(e=_){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`]}}}};const y=e=>({id:e.id,name:e.name,nodes:e.nodes.map(h),edges:e.edges});function b(t){return c.gen(function*(){let n=yield*c.all(t.nodes.map(e=>c.isEffect(e)?e:c.succeed(e))),{flowId:r,name:i,onEvent:a,edges:o,inputSchema:s,outputSchema:l,typeChecker:d}=t,p=n,m=new v(d),h=()=>{let e={},t={},n={};return p.forEach(r=>{e[r.id]=[],n[r.id]=[],t[r.id]=0}),o.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}},_=()=>{let{graph:e,inDegree:t}=h(),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},y=(e,t)=>{if(!e.condition)return c.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 c.succeed(s)},b=(e,t)=>{let{reverseGraph:n}=h(),r=n[e]||[],i={};return r.forEach(e=>{let n=t.get(e);n!==void 0&&(i[e]=n)}),i},x=e=>{let t=p.filter(e=>e.type===`input`),n={};return t.forEach(t=>{e&&typeof e==`object`&&t.id in e&&(n[t.id]=s.parse(e[t.id]))}),n},S=e=>{let t=p.filter(e=>e.type===`output`),n={};return t.forEach(t=>{let r=e.get(t.id);r!==void 0&&(n[t.id]=r)}),n},C=(t,n,i,o,s,l,u)=>c.gen(function*(){let d=s.get(t);if(!d)return yield*e.fromCode(`FLOW_NODE_NOT_FOUND`).toEffect();a&&(yield*a({jobId:l,flowId:r,nodeId:t,eventType:f.NodeStart,nodeName:d.name,nodeType:d.type}));let p=d.retry?.maxRetries??0,m=d.retry?.retryDelay??1e3,h=d.retry?.exponentialBackoff??!0,g=0,_=null;for(;g<=p;)try{let s,c={};if(d.type===`input`){if(s=i[t],s===void 0)return yield*e.fromCode(`FLOW_NODE_ERROR`,{cause:Error(`Input node ${t} has no input data`)}).toEffect()}else{if(c=b(t,o),Object.keys(c).length===0)return yield*e.fromCode(`FLOW_NODE_ERROR`,{cause:Error(`Node ${t} has no input data`)}).toEffect();if(d.multiInput)s=c;else{let n=Object.keys(c)[0];if(!n)return yield*e.fromCode(`FLOW_NODE_ERROR`,{cause:Error(`Node ${t} has no input data`)}).toEffect();s=c[n]}}if(d.type===`conditional`&&!(yield*y(d,s)))return a&&(yield*a({jobId:l,flowId:r,nodeId:t,eventType:f.NodeEnd,nodeName:d.name})),{nodeId:t,result:s,success:!0,waiting:!1};let p=yield*d.run({data:s,inputs:c,jobId:l,flowId:r,storageId:n,clientId:u});if(p.type===`waiting`){let e=p.partialData;return a&&(yield*a({jobId:l,flowId:r,nodeId:t,eventType:f.NodePause,nodeName:d.name,partialData:e})),{nodeId:t,result:e,success:!0,waiting:!0}}let m=p.data;return a&&(yield*a({jobId:l,flowId:r,nodeId:t,eventType:f.NodeEnd,nodeName:d.name,result:m})),{nodeId:t,result:m,success:!0,waiting:!1}}catch(n){if(_=n instanceof e?n:e.fromCode(`FLOW_NODE_ERROR`,{cause:n}),g<p){g++;let e=h?m*2**(g-1):m;yield*c.logWarning(`Node ${t} (${d.name}) failed, retrying (${g}/${p}) after ${e}ms`),yield*c.sleep(e);continue}return a&&(yield*a({jobId:l,flowId:r,nodeId:t,eventType:f.NodeError,nodeName:d.name,error:_.body,retryCount:g})),yield*_.toEffect()}return _?yield*_.toEffect():yield*e.fromCode(`FLOW_NODE_ERROR`,{cause:Error(`Unexpected error in retry loop`)}).toEffect()}),w=({inputs:n,storageId:i,jobId:s,resumeFrom:d,clientId:m})=>c.gen(function*(){!d&&a&&(yield*a({jobId:s,eventType:f.FlowStart,flowId:r}));let h=x(n||{}),v,y,b;if(d)v=d.executionOrder,y=d.nodeResults,b=d.currentIndex;else if(v=_(),y=new Map,b=0,v.length!==p.length)return yield*e.fromCode(`FLOW_CYCLE_ERROR`).toEffect();let w=new Map(p.map(e=>[e.id,e]));if(t.parallelExecution?.enabled??!1){yield*c.logDebug(`Flow ${r}: Executing in parallel mode (maxConcurrency: ${t.parallelExecution?.maxConcurrency??4})`);let e=new g({maxConcurrency:t.parallelExecution?.maxConcurrency??4}),n=e.groupNodesByExecutionLevel(p,o);yield*c.logDebug(`Flow ${r}: Grouped nodes into ${n.length} execution levels`);let l={};p.forEach(e=>{l[e.id]=[]}),o.forEach(e=>{l[e.target]?.push(e.source)});for(let t of n){yield*c.logDebug(`Flow ${r}: Executing level ${t.level} with nodes: ${t.nodes.join(`, `)}`);let n=t.nodes.map(e=>()=>c.gen(function*(){if(d&&e===d.executionOrder[b]&&a){let t=w.get(e);t&&(yield*a({jobId:s,flowId:r,nodeId:e,eventType:f.NodeResume,nodeName:t.name,nodeType:t.type}))}return{nodeId:e,nodeResult:yield*C(e,i,h,y,w,s,m)}})),o=yield*e.executeNodesInParallel(n);for(let{nodeId:e,nodeResult:t}of o){if(t.waiting)return t.result!==void 0&&y.set(e,t.result),{type:`paused`,nodeId:e,executionState:{executionOrder:v,currentIndex:v.indexOf(e),inputs:h}};t.success&&y.set(e,t.result)}}}else{yield*c.logDebug(`Flow ${r}: Executing in sequential mode`);for(let t=b;t<v.length;t++){let n=v[t];if(!n)return yield*e.fromCode(`FLOW_NODE_NOT_FOUND`).toEffect();if(d&&t===b&&a){let e=w.get(n);e&&(yield*a({jobId:s,flowId:r,nodeId:n,eventType:f.NodeResume,nodeName:e.name,nodeType:e.type}))}let o=yield*C(n,i,h,y,w,s,m);if(o.waiting)return o.result!==void 0&&y.set(o.nodeId,o.result),{type:`paused`,nodeId:o.nodeId,executionState:{executionOrder:v,currentIndex:t,inputs:h}};o.success&&y.set(o.nodeId,o.result)}}let T=S(y),E=u.record(u.string(),l).safeParse(T);if(!E.success){let t=`Flow output validation failed: ${E.error.message}. Expected outputs: ${JSON.stringify(Object.keys(S(y)))}. Output nodes: ${p.filter(e=>e.type===`output`).map(e=>e.id).join(`, `)}`;return a&&(yield*a({jobId:s,eventType:f.FlowError,flowId:r,error:t})),yield*e.fromCode(`FLOW_OUTPUT_VALIDATION_ERROR`,{body:t,cause:E.error}).toEffect()}let D=E.data;return a&&(yield*a({jobId:s,eventType:f.FlowEnd,flowId:r,result:D})),{type:`completed`,result:D}});return{id:r,name:i,nodes:p,edges:o,inputSchema:s,outputSchema:l,onEvent:a,run:({inputs:e,storageId:t,jobId:n,clientId:r})=>w({inputs:e,storageId:t,jobId:n,clientId:r}),resume:({jobId:e,storageId:t,nodeResults:n,executionState:r,clientId:i})=>w({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=p;return m.validateFlow(e,o)},validateInputs:e=>m.validateData(e,s),validateOutputs:e=>m.validateData(e,l)}})}var x=class extends s.Tag(`FlowProvider`)(){},S=class extends s.Tag(`FlowServer`)(){};const C=e=>typeof e==`object`&&!!e&&`id`in e;function w(e,t,n){let r=r=>{let i=e=>c.gen(function*(){let t=yield*n.get(r);t&&(yield*n.set(r,{...t,...e,updatedAt:new Date}))});return a=>c.gen(function*(){switch(e.onEvent&&(yield*c.catchAll(e.onEvent(a),e=>(c.logError(`Original onEvent failed`,e),c.succeed({eventId:null})))),yield*t.emit(r,a),c.logInfo(`Updating job ${r} with event ${a.eventType}`),a.eventType){case f.FlowStart:yield*i({status:`running`});break;case f.FlowEnd:break;case f.FlowError:yield*i({status:`failed`,error:a.error});break;case f.NodeStart:yield*c.gen(function*(){let e=yield*n.get(r);if(e){let t=e.tasks.find(e=>e.nodeId===a.nodeId)?e.tasks.map(e=>e.nodeId===a.nodeId?{...e,status:`running`,updatedAt:new Date}:e):[...e.tasks,{nodeId:a.nodeId,status:`running`,createdAt:new Date,updatedAt:new Date}];yield*n.set(r,{...e,tasks:t,updatedAt:new Date})}});break;case f.NodePause:yield*c.gen(function*(){let e=yield*n.get(r);if(e){let t=e.tasks.find(e=>e.nodeId===a.nodeId)?e.tasks.map(e=>e.nodeId===a.nodeId?{...e,status:`paused`,result:a.partialData,updatedAt:new Date}:e):[...e.tasks,{nodeId:a.nodeId,status:`paused`,result:a.partialData,createdAt:new Date,updatedAt:new Date}];yield*n.set(r,{...e,tasks:t,updatedAt:new Date})}});break;case f.NodeResume:yield*c.gen(function*(){let e=yield*n.get(r);if(e){let t=e.tasks.map(e=>e.nodeId===a.nodeId?{...e,status:`running`,updatedAt:new Date}:e);yield*n.set(r,{...e,tasks:t,updatedAt:new Date})}});break;case f.NodeEnd:yield*c.gen(function*(){let t=yield*n.get(r);if(t){let i=t.tasks.map(e=>e.nodeId===a.nodeId?{...e,status:`completed`,result:a.result,updatedAt:new Date}:e),o=e.nodes.find(e=>e.id===a.nodeId)?.type===`output`,s=a.result,c=t.intermediateFiles||[];o&&C(s)&&s.id?c=c.filter(e=>e!==s.id):!o&&C(s)&&s.id&&(c.includes(s.id)||c.push(s.id)),yield*n.set(r,{...t,tasks:i,intermediateFiles:c,updatedAt:new Date})}});break;case f.NodeError:yield*c.gen(function*(){let e=yield*n.get(r);if(e){let t=e.tasks.map(e=>e.nodeId===a.nodeId?{...e,status:`failed`,error:a.error,retryCount:a.retryCount,updatedAt:new Date}:e);yield*n.set(r,{...e,tasks:t,error:a.error,updatedAt:new Date})}});break}return{eventId:r}})};return{...e,run:t=>c.gen(function*(){let n=t.jobId||crypto.randomUUID(),i=r(n);return yield*(yield*b({flowId:e.id,name:e.name,nodes:e.nodes,edges:e.edges,inputSchema:e.inputSchema,outputSchema:e.outputSchema,onEvent:i})).run({...t,jobId:n,clientId:t.clientId})}),resume:t=>c.gen(function*(){let n=t.jobId,i=r(n);return yield*(yield*b({flowId:e.id,name:e.name,nodes:e.nodes,edges:e.edges,inputSchema:e.inputSchema,outputSchema:e.outputSchema,onEvent:i})).resume(t)})}}function T(){return c.gen(function*(){let r=yield*x,i=yield*n,o=yield*t,s=yield*a,l=(t,n)=>c.gen(function*(){let r=yield*o.get(t);return r?yield*o.set(t,{...r,...n}):yield*c.fail(e.fromCode(`FLOW_JOB_NOT_FOUND`,{cause:`Job ${t} not found`}))}),u=(e,t)=>c.gen(function*(){let n=yield*o.get(e);!n||!n.intermediateFiles||n.intermediateFiles.length===0||(yield*c.logInfo(`Cleaning up ${n.intermediateFiles.length} intermediate files for job ${e}`),yield*c.all(n.intermediateFiles.map(e=>c.gen(function*(){yield*s.delete(e,t),yield*c.logDebug(`Deleted intermediate file ${e}`)}).pipe(c.catchAll(t=>c.gen(function*(){return yield*c.logWarning(`Failed to delete intermediate file ${e}: ${t}`),c.succeed(void 0)})))),{concurrency:5}),yield*l(e,{intermediateFiles:[]}))}),d=({jobId:t,flow:n,storageId:r,clientId:a,inputs:s})=>c.gen(function*(){yield*l(t,{status:`running`});let e=yield*w(n,i,o).run({inputs:s,storageId:r,jobId:t,clientId:a});return e.type===`paused`?yield*l(t,{status:`paused`,pausedAt:e.nodeId,executionState:e.executionState,updatedAt:new Date}):(yield*l(t,{status:`completed`,result:e.result,updatedAt:new Date,endedAt:new Date}),yield*u(t,a)),e}).pipe(c.catchAll(n=>c.gen(function*(){yield*c.logError(`Flow execution failed`,n);let r=n instanceof e?n.body:String(n);yield*c.logInfo(`Updating job ${t} to failed status with error: ${r}`),yield*l(t,{status:`failed`,error:r,updatedAt:new Date}).pipe(c.catchAll(e=>c.gen(function*(){return yield*c.logError(`Failed to update job ${t}`,e),c.succeed(void 0)})));let s=yield*o.get(t);return s&&(yield*i.emit(t,{jobId:t,eventType:f.FlowError,flowId:s.flowId,error:r}).pipe(c.catchAll(e=>c.gen(function*(){return yield*c.logError(`Failed to emit FlowError event for job ${t}`,e),c.succeed(void 0)})))),yield*u(t,a).pipe(c.catchAll(e=>c.gen(function*(){return yield*c.logWarning(`Failed to cleanup intermediate files for job ${t}`,e),c.succeed(void 0)}))),c.fail(n)})));return{getFlow:(e,t)=>c.gen(function*(){return yield*r.getFlow(e,t)}),getFlowData:(e,t)=>c.gen(function*(){return y(yield*r.getFlow(e,t))}),runFlow:({flowId:t,storageId:n,clientId:i,inputs:a})=>c.gen(function*(){let s=yield*c.try({try:()=>X.parse({inputs:a}),catch:t=>e.fromCode(`FLOW_INPUT_VALIDATION_ERROR`,{cause:t})}),l=crypto.randomUUID(),u=new Date,f={id:l,flowId:t,storageId:n,clientId:i,status:`started`,createdAt:u,updatedAt:u,tasks:[]};yield*o.set(l,f);let p=yield*r.getFlow(t,i);return yield*c.forkDaemon(d({jobId:l,flow:p,storageId:n,clientId:i,inputs:s.inputs}).pipe(c.tapErrorCause(e=>c.logError(`Flow execution failed`,e)))),f}),getJobStatus:t=>c.gen(function*(){return(yield*o.get(t))||(yield*c.fail(e.fromCode(`FLOW_JOB_NOT_FOUND`,{cause:`Job ${t} not found`})))}),continueFlow:({jobId:t,nodeId:n,newData:a,clientId:s})=>c.gen(function*(){console.log(`continueFlow`,t,n,a);let d=yield*o.get(t);if(!d)return console.error(`Job not found`),yield*c.fail(e.fromCode(`FLOW_JOB_NOT_FOUND`,{cause:`Job ${t} not found`}));if(d.status!==`paused`)return console.error(`Job is not paused`),yield*c.fail(e.fromCode(`FLOW_JOB_ERROR`,{cause:`Job ${t} is not paused (status: ${d.status})`}));if(d.pausedAt!==n)return console.error(`Job is not paused at the expected node`),yield*c.fail(e.fromCode(`FLOW_JOB_ERROR`,{cause:`Job ${t} is paused at node ${d.pausedAt}, not ${n}`}));if(!d.executionState)return console.error(`Job has no execution state`),yield*c.fail(e.fromCode(`FLOW_JOB_ERROR`,{cause:`Job ${t} has no execution state`}));let p={...d.tasks.reduce((e,t)=>(t.result!==void 0&&(e[t.nodeId]=t.result),e),{}),[n]:a},m={...d.executionState.inputs,[n]:a};yield*l(t,{status:`running`});let h=yield*r.getFlow(d.flowId,d.clientId),g=c.gen(function*(){let n=w(h,i,o);if(!d.executionState)return yield*c.fail(e.fromCode(`FLOW_JOB_ERROR`,{cause:`Job ${t} has no execution state`}));let r=yield*n.resume({jobId:t,storageId:d.storageId,nodeResults:p,executionState:{...d.executionState,inputs:m},clientId:d.clientId});return r.type===`paused`?yield*l(t,{status:`paused`,pausedAt:r.nodeId,executionState:r.executionState,updatedAt:new Date}):(yield*l(t,{status:`completed`,pausedAt:void 0,executionState:void 0,result:r.result,updatedAt:new Date,endedAt:new Date}),yield*u(t,s)),r}).pipe(c.catchAll(n=>c.gen(function*(){yield*c.logError(`Flow resume failed`,n);let r=n instanceof e?n.body:String(n);yield*c.logInfo(`Updating job ${t} to failed status with error: ${r}`),yield*l(t,{status:`failed`,error:r,updatedAt:new Date}).pipe(c.catchAll(e=>c.gen(function*(){return yield*c.logError(`Failed to update job ${t}`,e),c.succeed(void 0)})));let a=yield*o.get(t);return a&&(yield*i.emit(t,{jobId:t,eventType:f.FlowError,flowId:a.flowId,error:r}).pipe(c.catchAll(e=>c.gen(function*(){return yield*c.logError(`Failed to emit FlowError event for job ${t}`,e),c.succeed(void 0)})))),yield*u(t,s).pipe(c.catchAll(e=>c.gen(function*(){return yield*c.logWarning(`Failed to cleanup intermediate files for job ${t}`,e),c.succeed(void 0)}))),c.fail(n)})));return yield*c.forkDaemon(g.pipe(c.tapErrorCause(e=>c.logError(`Flow resume failed`,e)))),(yield*o.get(t))||(yield*c.fail(e.fromCode(`FLOW_JOB_NOT_FOUND`,{cause:`Job ${t} not found after update`})))}),subscribeToFlowEvents:(e,t)=>c.gen(function*(){yield*i.subscribe(e,t)}),unsubscribeFromFlowEvents:e=>c.gen(function*(){yield*i.unsubscribe(e)})}})}const E=l.effect(S,T()),D=e=>({type:`complete`,data:e}),O=e=>({type:`waiting`,partialData:e});function k(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 A=u.object({operation:u.literal(`init`),storageId:u.string(),metadata:u.record(u.string(),u.any()).optional()}),j=u.object({operation:u.literal(`finalize`),uploadId:u.string()}),M=u.object({operation:u.literal(`url`),url:u.string(),storageId:u.string().optional(),metadata:u.record(u.string(),u.any()).optional()}),N=u.union([A,j,M]),P=u.object({allowedMimeTypes:u.array(u.string()).optional(),minSize:u.number().positive().optional(),maxSize:u.number().positive().optional()});function F(t,n){return c.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 I(t,n){return c.gen(function*(){let s=yield*a;return yield*m({id:t,name:`Input`,description:`Handles file input through multiple methods - streaming upload (init/finalize) or direct URL fetch`,type:p.input,inputSchema:N,outputSchema:r,run:({data:r,flowId:a,jobId:l,clientId:u})=>c.gen(function*(){switch(r.operation){case`init`:{let e={storageId:r.storageId,size:r.metadata?.size||0,type:r.metadata?.mimeType||`application/octet-stream`,fileName:r.metadata?.originalName,lastModified:r.metadata?.size?Date.now():void 0,metadata:r.metadata?JSON.stringify(r.metadata):void 0,flow:{flowId:a,nodeId:t,jobId:l}};return O(yield*s.createUpload(e,u))}case`finalize`:{let e=yield*s.getUpload(r.uploadId),{type:t}=k(e.metadata);return yield*F({type:t,size:e.size||0},n),D(e)}case`url`:{let e=yield*o(r.url),c=yield*i(e),d=r.metadata?.mimeType||e.headers.get(`content-type`)||`application/octet-stream`,f=r.metadata?.size||Number(e.headers.get(`content-length`)||0),p=r.metadata?.originalName||r.url.split(`/`).pop()||`file`;yield*F({type:d,size:f},n);let m=new ReadableStream({start(e){e.enqueue(new Uint8Array(c)),e.close()}}),h={storageId:r.storageId||`buffer`,size:f,type:d,fileName:p,lastModified:Date.now(),metadata:r.metadata?JSON.stringify(r.metadata):void 0};return D({...yield*s.upload(h,u,m),flow:{flowId:a,nodeId:t,jobId:l}})}default:throw yield*e.fromCode(`VALIDATION_ERROR`,{cause:Error(`Invalid operation`)}).toEffect()}})})})}const L=u.object({});function R(t,n=e=>c.succeed(e)){return c.gen(function*(){let i=yield*a;return yield*m({id:t,name:`Storage`,description:`Stores a file in the storage`,type:p.output,inputSchema:r,outputSchema:r,run:({data:r,storageId:a,flowId:o,jobId:s,clientId:l})=>c.gen(function*(){let{type:u,fileName:d,metadata:f,metadataJson:p}=k(r.metadata),m={flowId:o,nodeId:t,jobId:s},h=f?{...r,metadata:f}:r,g=yield*i.getUpload(r.id);if(!g.id)return yield*c.fail(e.fromCode(`FILE_READ_ERROR`,Error(`Upload Key is undefined`)));if(g.storage.id===a)return D(yield*n({...h,flow:m}));let _=yield*i.read(r.id,l),v=new ReadableStream({start(e){e.enqueue(_),e.close()}}),y=yield*i.upload({storageId:a,size:_.byteLength,type:u,fileName:d,lastModified:0,metadata:p,flow:m},l,v),b=k(y.metadata);return D(yield*n(b.metadata?{...y,metadata:b.metadata}:y))})})})}function z({id:e,name:t,description:n,transform:i}){return c.gen(function*(){let o=yield*a;return yield*m({id:e,name:t,description:n,type:p.process,inputSchema:r,outputSchema:r,run:({data:t,storageId:n,flowId:r,jobId:a,clientId:s})=>c.gen(function*(){let c={flowId:r,nodeId:e,jobId:a},l=yield*i(yield*o.read(t.id,s),t),u=l instanceof Uint8Array?l:l.bytes,d=l instanceof Uint8Array?void 0:l.type,f=l instanceof Uint8Array?void 0:l.fileName,p=new ReadableStream({start(e){e.enqueue(u),e.close()}}),{type:m,fileName:h,metadata:g,metadataJson:_}=k(t.metadata),v=yield*o.upload({storageId:n,size:u.byteLength,type:d??m,fileName:f??h,lastModified:0,metadata:_,flow:c},s,p);return D(g?{...v,metadata:g}:v)})})})}var B=class extends s.Tag(`CredentialProvider`)(){},V=class extends s.Tag(`ImageAiPlugin`)(){},H=class extends s.Tag(`ImagePlugin`)(){};const U=u.object({serviceType:u.enum([`replicate`]).optional()}),W=u.object({quality:u.number().min(0).max(100),format:u.enum([`jpeg`,`webp`,`png`,`avif`])}),G=u.object({serviceType:u.enum([`replicate`]).optional()}),K=u.object({width:u.number().positive().optional(),height:u.number().positive().optional(),fit:u.enum([`contain`,`cover`,`fill`])}).refine(e=>e.width||e.height,`Either width or height must be specified for resize`);var q=class extends s.Tag(`ZipPlugin`)(){};const J=(e,t)=>{if(e.length===0)return t;let[n,...r]=e;return r.reduce((e,t)=>u.union([e,t]),n)};function Y(t){return c.gen(function*(){let n=Object.entries(t.nodes),r=e=>c.isEffect(e)?e:c.succeed(e),i=yield*c.forEach(n,([t,n])=>c.flatMap(r(n),n=>n.id===t?c.succeed([t,n]):c.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===p.input).map(([,e])=>e.inputSchema),l=i.filter(([,e])=>e.type===p.output).map(([,e])=>e.outputSchema),d=t.inputSchema??J(s,u.unknown()),f=t.outputSchema??J(l,u.unknown()),m=t.edges.map(e=>({source:a[e.source]?.id??e.source,target:a[e.target]?.id??e.target,sourcePort:e.sourcePort,targetPort:e.targetPort}));return yield*b({flowId:t.flowId,name:t.name,nodes:o,edges:m,inputSchema:d,outputSchema:f,typeChecker:t.typeChecker,onEvent:t.onEvent,parallelExecution:t.parallelExecution})})}const X=u.object({inputs:u.record(u.string(),u.any())});export{f as A,E as C,p as D,g as E,m as O,T as S,y as T,k as _,G as a,x as b,H as c,z as d,R as f,P as g,N as h,K as i,d as j,h as k,V as l,I as m,Y as n,W as o,L as p,q as r,U as s,X as t,B as u,D as v,b as w,S as x,O as y};
2
+ //# sourceMappingURL=flow-B0mMJM5Y.js.map