@uploadista/core 0.0.13-beta.5 → 0.0.13

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 (101) hide show
  1. package/README.md +1 -1
  2. package/dist/{checksum-P9C2JlRk.mjs → checksum-CtOagryS.mjs} +2 -2
  3. package/dist/{checksum-P9C2JlRk.mjs.map → checksum-CtOagryS.mjs.map} +1 -1
  4. package/dist/errors/index.d.cts +2 -2
  5. package/dist/errors/index.d.mts +2 -2
  6. package/dist/errors/index.mjs +1 -1
  7. package/dist/flow/index.cjs +1 -1
  8. package/dist/flow/index.d.cts +5 -5
  9. package/dist/flow/index.d.mts +5 -5
  10. package/dist/flow/index.mjs +1 -1
  11. package/dist/{flow-DkTE3siV.cjs → flow-ChADffZ5.cjs} +1 -1
  12. package/dist/{flow-IgE8hj7H.mjs → flow-_J9-Dm_m.mjs} +2 -2
  13. package/dist/flow-_J9-Dm_m.mjs.map +1 -0
  14. package/dist/{index-CrZopnP9.d.cts → index-4VDJDcWM.d.cts} +227 -241
  15. package/dist/index-4VDJDcWM.d.cts.map +1 -0
  16. package/dist/{index-BPBI84iT.d.mts → index-Bi9YYid8.d.mts} +2 -2
  17. package/dist/{index-BPBI84iT.d.mts.map → index-Bi9YYid8.d.mts.map} +1 -1
  18. package/dist/{index-BteFEg-c.d.mts → index-Cbf1OPLp.d.mts} +2 -2
  19. package/dist/{index-BteFEg-c.d.mts.map → index-Cbf1OPLp.d.mts.map} +1 -1
  20. package/dist/{index-DMfADSSJ.d.cts → index-De4wQJwR.d.cts} +2 -2
  21. package/dist/{index-DMfADSSJ.d.cts.map → index-De4wQJwR.d.cts.map} +1 -1
  22. package/dist/{index-DHt7Ht_J.d.mts → index-RgOX4psL.d.mts} +305 -139
  23. package/dist/index-RgOX4psL.d.mts.map +1 -0
  24. package/dist/{index-DubOIur4.d.cts → index-qZ90PVNl.d.cts} +2 -2
  25. package/dist/index-qZ90PVNl.d.cts.map +1 -0
  26. package/dist/index.cjs +1 -1
  27. package/dist/index.d.cts +5 -5
  28. package/dist/index.d.mts +5 -5
  29. package/dist/index.mjs +1 -1
  30. package/dist/{stream-limiter-DFtRZczp.mjs → stream-limiter-D9KSAaoY.mjs} +2 -2
  31. package/dist/{stream-limiter-DFtRZczp.mjs.map → stream-limiter-D9KSAaoY.mjs.map} +1 -1
  32. package/dist/streams/index.d.cts +2 -2
  33. package/dist/streams/index.d.mts +2 -2
  34. package/dist/streams/index.mjs +1 -1
  35. package/dist/testing/index.cjs +1 -0
  36. package/dist/testing/index.d.cts +110 -0
  37. package/dist/testing/index.d.cts.map +1 -0
  38. package/dist/testing/index.d.mts +110 -0
  39. package/dist/testing/index.d.mts.map +1 -0
  40. package/dist/testing/index.mjs +2 -0
  41. package/dist/testing/index.mjs.map +1 -0
  42. package/dist/types/index.d.cts +5 -5
  43. package/dist/types/index.d.mts +5 -5
  44. package/dist/types/index.mjs +1 -1
  45. package/dist/{types-DGZ892my.mjs → types-BI_KmpTc.mjs} +2 -2
  46. package/dist/types-BI_KmpTc.mjs.map +1 -0
  47. package/dist/upload/index.d.cts +5 -5
  48. package/dist/upload/index.d.mts +5 -5
  49. package/dist/upload/index.mjs +1 -1
  50. package/dist/{upload-DJTptYqV.mjs → upload-Yj5lrtZo.mjs} +2 -2
  51. package/dist/{upload-DJTptYqV.mjs.map → upload-Yj5lrtZo.mjs.map} +1 -1
  52. package/dist/{uploadista-error-9yLWP7TC.d.cts → uploadista-error-BQLhNZcY.d.cts} +1 -1
  53. package/dist/{uploadista-error-9yLWP7TC.d.cts.map → uploadista-error-BQLhNZcY.d.cts.map} +1 -1
  54. package/dist/{uploadista-error-nZ_q-EZy.mjs → uploadista-error-Buscq-FR.mjs} +1 -1
  55. package/dist/{uploadista-error-nZ_q-EZy.mjs.map → uploadista-error-Buscq-FR.mjs.map} +1 -1
  56. package/dist/{uploadista-error-CBkvsyZ3.d.mts → uploadista-error-DUWw6OqS.d.mts} +1 -1
  57. package/dist/{uploadista-error-CBkvsyZ3.d.mts.map → uploadista-error-DUWw6OqS.d.mts.map} +1 -1
  58. package/dist/utils/index.d.cts +2 -2
  59. package/dist/utils/index.d.mts +2 -2
  60. package/dist/utils/index.mjs +1 -1
  61. package/dist/{utils-BicUw_lt.mjs → utils-BWiu6lqv.mjs} +2 -2
  62. package/dist/{utils-BicUw_lt.mjs.map → utils-BWiu6lqv.mjs.map} +1 -1
  63. package/package.json +14 -6
  64. package/src/flow/node.ts +4 -4
  65. package/src/flow/nodes/transform-node.ts +23 -2
  66. package/src/flow/plugins/credential-provider.ts +1 -1
  67. package/src/flow/plugins/image-ai-plugin.ts +1 -1
  68. package/src/flow/plugins/image-plugin.ts +1 -1
  69. package/src/flow/plugins/video-plugin.ts +1 -1
  70. package/src/flow/plugins/zip-plugin.ts +1 -1
  71. package/src/flow/types/type-utils.ts +14 -3
  72. package/src/testing/index.ts +14 -0
  73. package/src/testing/mock-image-ai-plugin.ts +33 -0
  74. package/src/testing/mock-image-plugin.ts +56 -0
  75. package/src/testing/mock-upload-server.ts +176 -0
  76. package/src/testing/mock-video-plugin.ts +94 -0
  77. package/src/testing/mock-zip-plugin.ts +41 -0
  78. package/src/types/data-store.ts +1 -1
  79. package/{src/errors/__tests__ → tests/errors}/uploadista-error.test.ts +23 -19
  80. package/{src → tests}/flow/edge.test.ts +1 -1
  81. package/tests/flow/flow.test.ts +853 -0
  82. package/tests/flow/node.test.ts +757 -0
  83. package/{src → tests}/streams/stream-limiter.test.ts +2 -2
  84. package/tests/types/typed-event-emitter.test.ts +282 -0
  85. package/{src → tests}/utils/debounce.test.ts +1 -1
  86. package/{src → tests}/utils/once.test.ts +1 -1
  87. package/tests/utils/test-layers.ts +183 -0
  88. package/{src → tests}/utils/throttle.test.ts +1 -1
  89. package/tsdown.config.ts +1 -0
  90. package/type-tests/flow.test-d.ts +93 -0
  91. package/type-tests/type-utils.test-d.ts +104 -51
  92. package/vitest.config.ts +19 -1
  93. package/dist/flow-IgE8hj7H.mjs.map +0 -1
  94. package/dist/index-CrZopnP9.d.cts.map +0 -1
  95. package/dist/index-DHt7Ht_J.d.mts.map +0 -1
  96. package/dist/index-DubOIur4.d.cts.map +0 -1
  97. package/dist/types-DGZ892my.mjs.map +0 -1
  98. /package/dist/{errors-C0zLx77t.mjs → errors-DEFjN-xn.mjs} +0 -0
  99. /package/dist/{index-BtBZHVmz.d.cts → index-C-svZlpj.d.mts} +0 -0
  100. /package/dist/{index-DEHBdV_z.d.mts → index-_wQ5ClJU.d.cts} +0 -0
  101. /package/dist/{streams-CJKKIAwy.mjs → streams-DPU17bYp.mjs} +0 -0
@@ -1,9 +1,9 @@
1
- import { n as UploadistaError } from "./uploadista-error-9yLWP7TC.cjs";
2
- import { l as GenerateId, p as GenerateIdShape } from "./index-DubOIur4.cjs";
3
- import * as effect_Types0 from "effect/Types";
4
- import * as effect_Cause0 from "effect/Cause";
1
+ import { n as UploadistaError } from "./uploadista-error-BQLhNZcY.cjs";
2
+ import { l as GenerateId, p as GenerateIdShape } from "./index-qZ90PVNl.cjs";
5
3
  import { Context, Effect, Layer, Option, Stream } from "effect";
4
+ import * as zod0 from "zod";
6
5
  import z$1, { z } from "zod";
6
+ import * as zod_v4_core0 from "zod/v4/core";
7
7
 
8
8
  //#region src/flow/node.d.ts
9
9
  /**
@@ -98,7 +98,7 @@ type ConditionValue = string | number;
98
98
  * });
99
99
  * ```
100
100
  */
101
- declare function createFlowNode<Input, Output>({
101
+ declare function createFlowNode<Input, Output, TType extends NodeType = NodeType>({
102
102
  id,
103
103
  name,
104
104
  description,
@@ -115,7 +115,7 @@ declare function createFlowNode<Input, Output>({
115
115
  id: string;
116
116
  name: string;
117
117
  description: string;
118
- type: NodeType;
118
+ type: TType;
119
119
  inputSchema: z.ZodSchema<Input>;
120
120
  outputSchema: z.ZodSchema<Output>;
121
121
  run: (args: {
@@ -138,7 +138,9 @@ declare function createFlowNode<Input, Output>({
138
138
  retryDelay?: number;
139
139
  exponentialBackoff?: boolean;
140
140
  };
141
- }): Effect.Effect<FlowNode<Input, Output, UploadistaError>>;
141
+ }): Effect.Effect<FlowNode<Input, Output, UploadistaError> & {
142
+ type: TType;
143
+ }>;
142
144
  /**
143
145
  * Extracts serializable node metadata from a FlowNode instance.
144
146
  *
@@ -1524,7 +1526,7 @@ type DataStore<TData = unknown> = {
1524
1526
  readonly write: (options: DataStoreWriteOptions, dependencies: {
1525
1527
  onProgress?: (chunkSize: number) => void;
1526
1528
  }) => Effect.Effect<number, UploadistaError>;
1527
- readonly deleteExpired?: Effect.Effect<number, UploadistaError>;
1529
+ readonly deleteExpired?: () => Effect.Effect<number, UploadistaError>;
1528
1530
  readonly getCapabilities: () => DataStoreCapabilities;
1529
1531
  readonly validateUploadStrategy: (strategy: UploadStrategy) => Effect.Effect<boolean, never>;
1530
1532
  };
@@ -3317,19 +3319,69 @@ type InputNodeParams = z.infer<typeof inputNodeParamsSchema>;
3317
3319
  * const openInputNode = yield* createInputNode("open-input");
3318
3320
  * ```
3319
3321
  */
3320
- declare function createInputNode(id: string, params?: InputNodeParams): Effect.Effect<FlowNode<{
3321
- operation: "init";
3322
- storageId: string;
3323
- metadata?: Record<string, any> | undefined;
3324
- } | {
3325
- operation: "finalize";
3326
- uploadId: string;
3327
- } | {
3328
- operation: "url";
3329
- url: string;
3330
- storageId?: string | undefined;
3331
- metadata?: Record<string, any> | undefined;
3332
- }, UploadFile, UploadistaError>, never, UploadServer>;
3322
+ declare function createInputNode(id: string, params?: InputNodeParams): Effect.Effect<FlowNodeData & {
3323
+ inputSchema: z.ZodType<{
3324
+ operation: "init";
3325
+ storageId: string;
3326
+ metadata?: Record<string, any> | undefined;
3327
+ } | {
3328
+ operation: "finalize";
3329
+ uploadId: string;
3330
+ } | {
3331
+ operation: "url";
3332
+ url: string;
3333
+ storageId?: string | undefined;
3334
+ metadata?: Record<string, any> | undefined;
3335
+ }, unknown, z.core.$ZodTypeInternals<{
3336
+ operation: "init";
3337
+ storageId: string;
3338
+ metadata?: Record<string, any> | undefined;
3339
+ } | {
3340
+ operation: "finalize";
3341
+ uploadId: string;
3342
+ } | {
3343
+ operation: "url";
3344
+ url: string;
3345
+ storageId?: string | undefined;
3346
+ metadata?: Record<string, any> | undefined;
3347
+ }, unknown>>;
3348
+ outputSchema: z.ZodType<UploadFile, unknown, z.core.$ZodTypeInternals<UploadFile, unknown>>;
3349
+ run: (args: {
3350
+ data: {
3351
+ operation: "init";
3352
+ storageId: string;
3353
+ metadata?: Record<string, any> | undefined;
3354
+ } | {
3355
+ operation: "finalize";
3356
+ uploadId: string;
3357
+ } | {
3358
+ operation: "url";
3359
+ url: string;
3360
+ storageId?: string | undefined;
3361
+ metadata?: Record<string, any> | undefined;
3362
+ };
3363
+ jobId: string;
3364
+ storageId: string;
3365
+ flowId: string;
3366
+ inputs?: Record<string, unknown>;
3367
+ clientId: string | null;
3368
+ }) => Effect.Effect<NodeExecutionResult<UploadFile>, UploadistaError, never>;
3369
+ condition?: {
3370
+ field: string;
3371
+ operator: string;
3372
+ value: unknown;
3373
+ };
3374
+ multiInput?: boolean;
3375
+ multiOutput?: boolean;
3376
+ pausable?: boolean;
3377
+ retry?: {
3378
+ maxRetries?: number;
3379
+ retryDelay?: number;
3380
+ exponentialBackoff?: boolean;
3381
+ };
3382
+ } & {
3383
+ type: NodeType.input;
3384
+ }, never, UploadServer>;
3333
3385
  //#endregion
3334
3386
  //#region src/flow/nodes/storage-node.d.ts
3335
3387
  /**
@@ -3370,34 +3422,114 @@ type StorageParams = z.infer<typeof storageParamsSchema>;
3370
3422
  * });
3371
3423
  * ```
3372
3424
  */
3373
- declare function createStorageNode(id: string, postProcessFile?: (file: UploadFile) => Effect.Effect<UploadFile>): Effect.Effect<FlowNode<{
3374
- id: string;
3375
- offset: number;
3376
- storage: {
3425
+ declare function createStorageNode(id: string, postProcessFile?: (file: UploadFile) => Effect.Effect<UploadFile>): Effect.Effect<FlowNodeData & {
3426
+ inputSchema: z.ZodType<{
3377
3427
  id: string;
3378
- type: string;
3379
- path?: string | undefined;
3380
- uploadId?: string | undefined;
3381
- bucket?: string | undefined;
3382
- parts?: {
3383
- partNumber: number;
3384
- etag: string;
3385
- size: number;
3386
- }[] | undefined;
3387
- };
3388
- size?: number | undefined;
3389
- metadata?: Record<string, string | number | boolean> | undefined;
3390
- creationDate?: string | undefined;
3391
- url?: string | undefined;
3392
- sizeIsDeferred?: boolean | undefined;
3393
- checksum?: string | undefined;
3394
- checksumAlgorithm?: string | undefined;
3395
- flow?: {
3396
- flowId: string;
3397
- nodeId: string;
3428
+ offset: number;
3429
+ storage: {
3430
+ id: string;
3431
+ type: string;
3432
+ path?: string | undefined;
3433
+ uploadId?: string | undefined;
3434
+ bucket?: string | undefined;
3435
+ parts?: {
3436
+ partNumber: number;
3437
+ etag: string;
3438
+ size: number;
3439
+ }[] | undefined;
3440
+ };
3441
+ size?: number | undefined;
3442
+ metadata?: Record<string, string | number | boolean> | undefined;
3443
+ creationDate?: string | undefined;
3444
+ url?: string | undefined;
3445
+ sizeIsDeferred?: boolean | undefined;
3446
+ checksum?: string | undefined;
3447
+ checksumAlgorithm?: string | undefined;
3448
+ flow?: {
3449
+ flowId: string;
3450
+ nodeId: string;
3451
+ jobId: string;
3452
+ } | undefined;
3453
+ }, unknown, z.core.$ZodTypeInternals<{
3454
+ id: string;
3455
+ offset: number;
3456
+ storage: {
3457
+ id: string;
3458
+ type: string;
3459
+ path?: string | undefined;
3460
+ uploadId?: string | undefined;
3461
+ bucket?: string | undefined;
3462
+ parts?: {
3463
+ partNumber: number;
3464
+ etag: string;
3465
+ size: number;
3466
+ }[] | undefined;
3467
+ };
3468
+ size?: number | undefined;
3469
+ metadata?: Record<string, string | number | boolean> | undefined;
3470
+ creationDate?: string | undefined;
3471
+ url?: string | undefined;
3472
+ sizeIsDeferred?: boolean | undefined;
3473
+ checksum?: string | undefined;
3474
+ checksumAlgorithm?: string | undefined;
3475
+ flow?: {
3476
+ flowId: string;
3477
+ nodeId: string;
3478
+ jobId: string;
3479
+ } | undefined;
3480
+ }, unknown>>;
3481
+ outputSchema: z.ZodType<UploadFile, unknown, z.core.$ZodTypeInternals<UploadFile, unknown>>;
3482
+ run: (args: {
3483
+ data: {
3484
+ id: string;
3485
+ offset: number;
3486
+ storage: {
3487
+ id: string;
3488
+ type: string;
3489
+ path?: string | undefined;
3490
+ uploadId?: string | undefined;
3491
+ bucket?: string | undefined;
3492
+ parts?: {
3493
+ partNumber: number;
3494
+ etag: string;
3495
+ size: number;
3496
+ }[] | undefined;
3497
+ };
3498
+ size?: number | undefined;
3499
+ metadata?: Record<string, string | number | boolean> | undefined;
3500
+ creationDate?: string | undefined;
3501
+ url?: string | undefined;
3502
+ sizeIsDeferred?: boolean | undefined;
3503
+ checksum?: string | undefined;
3504
+ checksumAlgorithm?: string | undefined;
3505
+ flow?: {
3506
+ flowId: string;
3507
+ nodeId: string;
3508
+ jobId: string;
3509
+ } | undefined;
3510
+ };
3398
3511
  jobId: string;
3399
- } | undefined;
3400
- }, UploadFile, UploadistaError>, never, UploadServer>;
3512
+ storageId: string;
3513
+ flowId: string;
3514
+ inputs?: Record<string, unknown>;
3515
+ clientId: string | null;
3516
+ }) => Effect.Effect<NodeExecutionResult<UploadFile>, UploadistaError, never>;
3517
+ condition?: {
3518
+ field: string;
3519
+ operator: string;
3520
+ value: unknown;
3521
+ };
3522
+ multiInput?: boolean;
3523
+ multiOutput?: boolean;
3524
+ pausable?: boolean;
3525
+ retry?: {
3526
+ maxRetries?: number;
3527
+ retryDelay?: number;
3528
+ exponentialBackoff?: boolean;
3529
+ };
3530
+ } & {
3531
+ type: NodeType.output;
3532
+ }, never, UploadServer>;
3401
3533
  //#endregion
3402
3534
  //#region src/flow/nodes/transform-node.d.ts
3403
3535
  /**
@@ -3462,7 +3594,33 @@ declare function createTransformNode({
3462
3594
  name,
3463
3595
  description,
3464
3596
  transform
3465
- }: TransformNodeConfig): Effect.Effect<FlowNode<UploadFile, UploadFile, UploadistaError>, never, UploadServer>;
3597
+ }: TransformNodeConfig): Effect.Effect<FlowNodeData & {
3598
+ inputSchema: zod0.ZodType<UploadFile, unknown, zod_v4_core0.$ZodTypeInternals<UploadFile, unknown>>;
3599
+ outputSchema: zod0.ZodType<UploadFile, unknown, zod_v4_core0.$ZodTypeInternals<UploadFile, unknown>>;
3600
+ run: (args: {
3601
+ data: UploadFile;
3602
+ jobId: string;
3603
+ storageId: string;
3604
+ flowId: string;
3605
+ inputs?: Record<string, unknown>;
3606
+ clientId: string | null;
3607
+ }) => Effect.Effect<NodeExecutionResult<UploadFile>, UploadistaError, never>;
3608
+ condition?: {
3609
+ field: string;
3610
+ operator: string;
3611
+ value: unknown;
3612
+ };
3613
+ multiInput?: boolean;
3614
+ multiOutput?: boolean;
3615
+ pausable?: boolean;
3616
+ retry?: {
3617
+ maxRetries?: number;
3618
+ retryDelay?: number;
3619
+ exponentialBackoff?: boolean;
3620
+ };
3621
+ } & {
3622
+ type: NodeType;
3623
+ }, never, UploadServer>;
3466
3624
  //#endregion
3467
3625
  //#region src/flow/parallel-scheduler.d.ts
3468
3626
  /**
@@ -3653,185 +3811,6 @@ declare const CredentialProvider_base: Context.TagClass<CredentialProvider, "Cre
3653
3811
  declare class CredentialProvider extends CredentialProvider_base {}
3654
3812
  type CredentialProviderLayer = Layer.Layer<CredentialProvider, never, never>;
3655
3813
  //#endregion
3656
- //#region dist/uploadista-error-CBkvsyZ3.d.mts
3657
- //#region src/errors/uploadista-error.d.ts
3658
-
3659
- /**
3660
- * Union type of all possible error codes in the Uploadista system.
3661
- *
3662
- * Each error code corresponds to a specific error condition with predefined
3663
- * HTTP status codes and messages in the ERROR_CATALOG.
3664
- */
3665
- 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_NOT_AUTHORIZED" | "FLOW_NOT_FOUND" | "FLOW_PAUSED" | "FLOW_CANCELLED" | "FILE_READ_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" | "STORAGE_NOT_AUTHORIZED" | "UNKNOWN_ERROR" | "FILE_WRITE_ERROR" | "UPLOAD_ID_NOT_FOUND" | "FLOW_OUTPUT_VALIDATION_ERROR" | "FLOW_INPUT_VALIDATION_ERROR" | "CHECKSUM_MISMATCH" | "MIMETYPE_MISMATCH" | "UNSUPPORTED_CHECKSUM_ALGORITHM" | "VIDEO_PROCESSING_FAILED" | "INVALID_VIDEO_FORMAT" | "CODEC_NOT_SUPPORTED" | "VIDEO_METADATA_EXTRACTION_FAILED" | "FFMPEG_NOT_INSTALLED";
3666
- /**
3667
- * Catalog of all predefined errors in the Uploadista system.
3668
- *
3669
- * Maps error codes to their HTTP status codes and default error messages.
3670
- * This centralized catalog ensures consistent error handling across all
3671
- * Uploadista packages and adapters.
3672
- *
3673
- * Each error entry contains:
3674
- * - `status`: HTTP status code (400-500 range)
3675
- * - `body`: Human-readable error message
3676
- *
3677
- * @example
3678
- * ```typescript
3679
- * // Access a specific error definition
3680
- * const fileNotFound = ERROR_CATALOG.FILE_NOT_FOUND;
3681
- * console.log(fileNotFound.status); // 404
3682
- * console.log(fileNotFound.body); // "The file for this url was not found\n"
3683
- *
3684
- * // Use with UploadistaError
3685
- * const error = UploadistaError.fromCode("FILE_NOT_FOUND");
3686
- * ```
3687
- */
3688
-
3689
- 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 & {
3690
- readonly _tag: "UploadistaError";
3691
- } & Readonly<A>;
3692
- /**
3693
- * Standard error class for all Uploadista operations.
3694
- *
3695
- * UploadistaError provides a consistent error handling approach across the entire
3696
- * Uploadista ecosystem. Each error has:
3697
- * - A typed error code from the ERROR_CATALOG
3698
- * - An HTTP-compatible status code
3699
- * - A human-readable error message (body)
3700
- * - Optional additional details and cause information
3701
- *
3702
- * This class integrates with Effect-TS for functional error handling and can be
3703
- * easily converted to an Effect that fails.
3704
- *
3705
- * @example
3706
- * ```typescript
3707
- * // Create from error code
3708
- * const error = UploadistaError.fromCode("FILE_NOT_FOUND");
3709
- *
3710
- * // Create with custom details
3711
- * const customError = UploadistaError.fromCode("FLOW_NODE_ERROR", {
3712
- * body: "Failed to process image",
3713
- * cause: originalError,
3714
- * details: { nodeId: "resize-1", fileId: "abc123" }
3715
- * });
3716
- *
3717
- * // Use with Effect
3718
- * const effect = customError.toEffect<void>();
3719
- *
3720
- * // In an Effect pipeline
3721
- * return Effect.gen(function* () {
3722
- * const file = yield* getFile(id);
3723
- * if (!file) {
3724
- * return yield* UploadistaError.fromCode("FILE_NOT_FOUND").toEffect();
3725
- * }
3726
- * return file;
3727
- * });
3728
- * ```
3729
- */
3730
- declare class UploadistaError$1 extends UploadistaError_base {
3731
- readonly code: string;
3732
- readonly status: number;
3733
- readonly status_code: number;
3734
- readonly body: string;
3735
- readonly details?: unknown;
3736
- constructor({
3737
- code,
3738
- status,
3739
- body,
3740
- cause,
3741
- details
3742
- }: {
3743
- code: UploadistaErrorCode | string;
3744
- status: number;
3745
- body: string;
3746
- cause?: unknown;
3747
- details?: unknown;
3748
- });
3749
- /**
3750
- * Creates an UploadistaError from a predefined error code.
3751
- *
3752
- * This is the primary way to create errors in the Uploadista system. Each error code
3753
- * has a default status and message defined in ERROR_CATALOG, but these can be overridden
3754
- * for specific use cases.
3755
- *
3756
- * @param code - One of the predefined error codes from UploadistaErrorCode
3757
- * @param overrides - Optional overrides for the default error properties
3758
- * @param overrides.status - Custom HTTP status code (overrides the default)
3759
- * @param overrides.body - Custom error message (overrides the default)
3760
- * @param overrides.details - Additional structured data about the error
3761
- * @param overrides.cause - The underlying error that caused this error (for error chaining)
3762
- *
3763
- * @returns A new UploadistaError instance
3764
- *
3765
- * @example
3766
- * ```typescript
3767
- * // Use default error
3768
- * const error = UploadistaError.fromCode("FILE_NOT_FOUND");
3769
- *
3770
- * // Override message
3771
- * const customError = UploadistaError.fromCode("FILE_NOT_FOUND", {
3772
- * body: `File with ID ${fileId} was not found in storage`
3773
- * });
3774
- *
3775
- * // Include cause and details
3776
- * const detailedError = UploadistaError.fromCode("DATASTORE_NOT_FOUND", {
3777
- * cause: storageException,
3778
- * details: { storageId: "s3-prod", region: "us-east-1" }
3779
- * });
3780
- * ```
3781
- */
3782
- static fromCode(code: UploadistaErrorCode, overrides?: Partial<Pick<UploadistaError$1, "status" | "body">> & {
3783
- details?: unknown;
3784
- cause?: unknown;
3785
- }): UploadistaError$1;
3786
- /**
3787
- * Converts this error to an Effect that immediately fails.
3788
- *
3789
- * This method integrates UploadistaError with Effect-TS's error handling system,
3790
- * allowing errors to be used in Effect pipelines with proper type checking.
3791
- *
3792
- * @template T - The success type of the Effect (defaults to never since it always fails)
3793
- * @returns An Effect that fails with this UploadistaError
3794
- *
3795
- * @example
3796
- * ```typescript
3797
- * const error = UploadistaError.fromCode("FILE_NOT_FOUND");
3798
- *
3799
- * // Use in an Effect pipeline
3800
- * return Effect.gen(function* () {
3801
- * const file = yield* kvStore.get(fileId);
3802
- * if (!file) {
3803
- * return yield* error.toEffect();
3804
- * }
3805
- * return file;
3806
- * });
3807
- * ```
3808
- */
3809
- toEffect<T = never>(): Effect.Effect<T, UploadistaError$1>;
3810
- }
3811
- /**
3812
- * Type guard to check if an unknown value is an UploadistaError.
3813
- *
3814
- * Useful for error handling when catching errors that might be from
3815
- * different sources or libraries.
3816
- *
3817
- * @param error - The value to check
3818
- * @returns True if the value is an UploadistaError instance
3819
- *
3820
- * @example
3821
- * ```typescript
3822
- * try {
3823
- * await someOperation();
3824
- * } catch (error) {
3825
- * if (isUploadistaError(error)) {
3826
- * console.log(`Uploadista error: ${error.code} (${error.status})`);
3827
- * console.log(error.body);
3828
- * } else {
3829
- * console.error("Unknown error:", error);
3830
- * }
3831
- * }
3832
- * ```
3833
- */
3834
- //#endregion
3835
3814
  //#region src/flow/plugins/image-ai-plugin.d.ts
3836
3815
  /**
3837
3816
  * Context information for AI image processing operations.
@@ -3856,7 +3835,7 @@ type ImageAiPluginShape = {
3856
3835
  */
3857
3836
  removeBackground: (inputUrl: string, context: ImageAiContext) => Effect.Effect<{
3858
3837
  outputUrl: string;
3859
- }, UploadistaError$1>;
3838
+ }, UploadistaError>;
3860
3839
  /**
3861
3840
  * Generates a textual description of an image using AI analysis.
3862
3841
  *
@@ -3867,7 +3846,7 @@ type ImageAiPluginShape = {
3867
3846
  */
3868
3847
  describeImage: (inputUrl: string, context: ImageAiContext) => Effect.Effect<{
3869
3848
  description: string;
3870
- }, UploadistaError$1>;
3849
+ }, UploadistaError>;
3871
3850
  };
3872
3851
  declare const ImageAiPlugin_base: Context.TagClass<ImageAiPlugin, "ImageAiPlugin", ImageAiPluginShape>;
3873
3852
  /**
@@ -4277,7 +4256,7 @@ type ImagePluginShape = {
4277
4256
  * @returns An Effect that resolves to the optimized image as a Uint8Array
4278
4257
  * @throws {UploadistaError} When image optimization fails
4279
4258
  */
4280
- optimize: (input: Uint8Array, options: OptimizeParams) => Effect.Effect<Uint8Array, UploadistaError$1>;
4259
+ optimize: (input: Uint8Array, options: OptimizeParams) => Effect.Effect<Uint8Array, UploadistaError>;
4281
4260
  /**
4282
4261
  * Resizes an image to specified dimensions.
4283
4262
  *
@@ -4286,7 +4265,7 @@ type ImagePluginShape = {
4286
4265
  * @returns An Effect that resolves to the resized image as a Uint8Array
4287
4266
  * @throws {UploadistaError} When image resizing fails
4288
4267
  */
4289
- resize: (input: Uint8Array, options: ResizeParams) => Effect.Effect<Uint8Array, UploadistaError$1>;
4268
+ resize: (input: Uint8Array, options: ResizeParams) => Effect.Effect<Uint8Array, UploadistaError>;
4290
4269
  /**
4291
4270
  * Applies a single transformation to an image.
4292
4271
  *
@@ -4321,7 +4300,7 @@ type ImagePluginShape = {
4321
4300
  * });
4322
4301
  * ```
4323
4302
  */
4324
- transform: (input: Uint8Array, transformation: Transformation) => Effect.Effect<Uint8Array, UploadistaError$1>;
4303
+ transform: (input: Uint8Array, transformation: Transformation) => Effect.Effect<Uint8Array, UploadistaError>;
4325
4304
  };
4326
4305
  declare const ImagePlugin_base: Context.TagClass<ImagePlugin, "ImagePlugin", ImagePluginShape>;
4327
4306
  /**
@@ -4478,7 +4457,7 @@ type VideoPluginShape = {
4478
4457
  * @returns An Effect that resolves to the transcoded video as a Uint8Array
4479
4458
  * @throws {UploadistaError} When video transcoding fails
4480
4459
  */
4481
- transcode: (input: Uint8Array, options: TranscodeVideoParams) => Effect.Effect<Uint8Array, UploadistaError$1>;
4460
+ transcode: (input: Uint8Array, options: TranscodeVideoParams) => Effect.Effect<Uint8Array, UploadistaError>;
4482
4461
  /**
4483
4462
  * Resizes a video to specified dimensions.
4484
4463
  *
@@ -4487,7 +4466,7 @@ type VideoPluginShape = {
4487
4466
  * @returns An Effect that resolves to the resized video as a Uint8Array
4488
4467
  * @throws {UploadistaError} When video resizing fails
4489
4468
  */
4490
- resize: (input: Uint8Array, options: ResizeVideoParams) => Effect.Effect<Uint8Array, UploadistaError$1>;
4469
+ resize: (input: Uint8Array, options: ResizeVideoParams) => Effect.Effect<Uint8Array, UploadistaError>;
4491
4470
  /**
4492
4471
  * Trims a video to extract a segment by time range.
4493
4472
  *
@@ -4496,7 +4475,7 @@ type VideoPluginShape = {
4496
4475
  * @returns An Effect that resolves to the trimmed video as a Uint8Array
4497
4476
  * @throws {UploadistaError} When video trimming fails
4498
4477
  */
4499
- trim: (input: Uint8Array, options: TrimVideoParams) => Effect.Effect<Uint8Array, UploadistaError$1>;
4478
+ trim: (input: Uint8Array, options: TrimVideoParams) => Effect.Effect<Uint8Array, UploadistaError>;
4500
4479
  /**
4501
4480
  * Extracts a single frame from the video at a specific timestamp.
4502
4481
  *
@@ -4505,7 +4484,7 @@ type VideoPluginShape = {
4505
4484
  * @returns An Effect that resolves to the extracted frame as a Uint8Array (image)
4506
4485
  * @throws {UploadistaError} When frame extraction fails
4507
4486
  */
4508
- extractFrame: (input: Uint8Array, options: ExtractFrameVideoParams) => Effect.Effect<Uint8Array, UploadistaError$1>;
4487
+ extractFrame: (input: Uint8Array, options: ExtractFrameVideoParams) => Effect.Effect<Uint8Array, UploadistaError>;
4509
4488
  /**
4510
4489
  * Extracts metadata from a video file.
4511
4490
  *
@@ -4513,7 +4492,7 @@ type VideoPluginShape = {
4513
4492
  * @returns An Effect that resolves to VideoMetadata with comprehensive video information
4514
4493
  * @throws {UploadistaError} When metadata extraction fails
4515
4494
  */
4516
- describe: (input: Uint8Array) => Effect.Effect<DescribeVideoMetadata, UploadistaError$1>;
4495
+ describe: (input: Uint8Array) => Effect.Effect<DescribeVideoMetadata, UploadistaError>;
4517
4496
  };
4518
4497
  declare const VideoPlugin_base: Context.TagClass<VideoPlugin, "VideoPlugin", VideoPluginShape>;
4519
4498
  /**
@@ -4573,7 +4552,7 @@ type ZipPluginShape = {
4573
4552
  * @returns An Effect that resolves to the ZIP file as a Uint8Array
4574
4553
  * @throws {UploadistaError} When ZIP creation fails
4575
4554
  */
4576
- zip: (inputs: ZipInput[], options: ZipParams) => Effect.Effect<Uint8Array, UploadistaError$1>;
4555
+ zip: (inputs: ZipInput[], options: ZipParams) => Effect.Effect<Uint8Array, UploadistaError>;
4577
4556
  };
4578
4557
  declare const ZipPlugin_base: Context.TagClass<ZipPlugin, "ZipPlugin", ZipPluginShape>;
4579
4558
  /**
@@ -4712,7 +4691,7 @@ type ExtractLayerService<T, TError$1 = never, TRequirements = never> = T extends
4712
4691
  * the services they provide, combining them into a single union type.
4713
4692
  *
4714
4693
  * @template T - A readonly tuple of Layer types
4715
- * @returns A union of all service types provided by the layers
4694
+ * @returns A union of all service types provided by the layers, or never for empty tuples
4716
4695
  *
4717
4696
  * @example
4718
4697
  * ```typescript
@@ -4733,8 +4712,15 @@ type ExtractLayerService<T, TError$1 = never, TRequirements = never> = T extends
4733
4712
  * type AllServices = ExtractLayerServices<PluginLayers>;
4734
4713
  * // AllServices = ImagePlugin | ZipPlugin
4735
4714
  * ```
4715
+ *
4716
+ * @example
4717
+ * ```typescript
4718
+ * type EmptyLayers = [];
4719
+ * type NoServices = ExtractLayerServices<EmptyLayers>;
4720
+ * // NoServices = never
4721
+ * ```
4736
4722
  */
4737
- type ExtractLayerServices<T extends readonly Layer.Layer<any, any, any>[]> = T[number] extends Layer.Layer<infer S, any, any> ? S : never;
4723
+ type ExtractLayerServices<T extends readonly Layer.Layer<any, any, any>[]> = T extends readonly [] ? never : { [K in keyof T]: T[K] extends Layer.Layer<infer S, any, any> ? S : never }[number];
4738
4724
  /**
4739
4725
  * Unwraps an Effect type to extract its success value type.
4740
4726
  *
@@ -5066,4 +5052,4 @@ type ResolvedUploadMetadata = {
5066
5052
  declare function resolveUploadMetadata(metadata: FileMetadata): ResolvedUploadMetadata;
5067
5053
  //#endregion
5068
5054
  export { LogoTransform as $, BaseKvStore as $n, FlowServerShape as $t, ZipPluginLayer as A, UploadEventEmitter as An, FlowEventFlowError as Ar, ImageAiPluginLayer as At, resizeVideoParamsSchema as B, EventBroadcaster as Bn, FlowEventNodeStart as Br, StorageParams as Bt, DescribeImageParams as C, InputFile as Cn, TypeCompatibilityChecker as Cr, watermarkTransformSchema as Ct, ZipInput as D, EventEmitter as Dn, FlowEvent as Dr, optimizeParamsSchema as Dt, PluginLayer as E, BaseEventEmitterService as En, EventType as Er, OptimizeParams as Et, TrimVideoParams as F, WebSocketMessage as Fn, FlowEventNodeEnd as Fr, ExecutionLevel as Ft, ImagePlugin as G, DataStoreConfig as Gn, createFlowNode as Gr, createInputNode as Gt, extractFrameVideoParamsSchema as H, BufferedUploadFileDataStore as Hn, ConditionOperator as Hr, storageParamsSchema as Ht, trimVideoParamsSchema as I, webSocketMessageSchema as In, FlowEventNodeError as Ir, ParallelScheduler as It, BlurTransform as J, UploadFileDataStores as Jn, FlowProvider as Jt, ImagePluginLayer as K, DataStoreWriteOptions as Kn, getNodeData as Kr, inputDataSchema as Kt, TranscodeVideoParams as L, UploadEvent as Ln, FlowEventNodePause as Lr, ParallelSchedulerConfig as Lt, VideoPlugin as M, flowEventEmitter as Mn, FlowEventFlowStart as Mr, CredentialProvider as Mt, VideoPluginLayer as N, uploadEventEmitter as Nn, FlowEventJobEnd as Nr, CredentialProviderLayer as Nt, ZipParams as O, FlowEventEmitter as On, FlowEventFlowCancel as Or, ImageAiContext as Ot, VideoPluginShape as P, WebSocketConnection as Pn, FlowEventJobStart as Pr, CredentialProviderShape as Pt, GrayscaleTransform as Q, isDataStore as Qn, FlowServerOptions as Qt, transcodeVideoParamsSchema as R, UploadEventType as Rn, FlowEventNodeResponse as Rr, TransformNodeConfig as Rt, removeBackgroundParamsSchema as S, MiddlewareServiceLive as Sn, NodeTypeMap as Sr, transformationSchema as St, Plugin as T, BaseEventEmitter as Tn, waitingNodeExecution as Tr, resizeParamsSchema as Tt, DescribeVideoMetadata as U, DataStore as Un, ConditionValue as Ur, InputData as Ut, ExtractFrameVideoParams as V, EventBroadcasterService as Vn, ConditionField as Vr, createStorageNode as Vt, describeVideoMetadataSchema as W, DataStoreCapabilities as Wn, NodeType as Wr, InputNodeParams as Wt, ContrastTransform as X, UploadStrategy as Xn, FlowServer as Xt, BrightnessTransform as Y, UploadFileDataStoresShape as Yn, FlowProviderShape as Yt, FlipTransform as Z, createDataStoreLayer as Zn, FlowServerLayer as Zt, ExtractLayerService as _, detectMimeType as _n, FlowConfig as _r, rotateTransformSchema as _t, FlowInputMap as a, FlowJobStatus as an, flowJobKvStore as ar, TextTransform as at, FlowCondition as b, MiddlewareNext as bn, NodeConnectionValidator as br, textTransformSchema as bt, FlowRequirements as c, NegotiatedStrategy as cn, UploadFile as cr, TransformationType as ct, TypedFlow as d, UploadServer as dn, FlowData as dr, brightnessTransformSchema as dt, FlowWaitUntil as en, BaseKvStoreService as er, OverlayPosition as et, TypedFlowConfig as f, UploadServerOptions as fn, FlowExecutionResult as fr, contrastTransformSchema as ft, ExtractEffectRequirements as g, compareMimeTypes as gn, createFlowEdge as gr, resizeTransformSchema as gt, ExtractEffectError as h, uploadServer as hn, FlowEdge as hr, logoTransformSchema as ht, runArgsSchema as i, FlowJob as in, UploadFileKVStore as ir, SharpenTransform as it, ZipPluginShape as j, eventToMessageSerializer as jn, FlowEventFlowPause as jr, ImageAiPluginShape as jt, ZipPlugin as k, TypedEventEmitter as kn, FlowEventFlowEnd as kr, ImageAiPlugin as kt, NodeDefinition as l, UploadStrategyNegotiator as ln, uploadFileSchema as lr, WatermarkTransform as lt, createFlow as m, createUploadServer as mn, getFlowData as mr, grayscaleTransformSchema as mt, resolveUploadMetadata as n, createFlowServer as nn, KvStore as nr, RotateTransform as nt, FlowOutputMap as o, FlowJobTask as on, jsonSerializer as or, TransformImageParams as ot, TypedFlowEdge as p, UploadServerShape as pn, createFlowWithSchema as pr, flipTransformSchema as pt, ImagePluginShape as q, UploadFileDataStore as qn, inputNodeParamsSchema as qt, RunArgs as r, flowServer as rn, TypedKvStore as rr, SepiaTransform as rt, FlowPluginRequirements as s, FlowJobTaskStatus as sn, uploadFileKvStore as sr, Transformation as st, ResolvedUploadMetadata as t, WaitUntilCallback as tn, FlowJobKVStore as tr, ResizeTransform as tt, NodeDefinitionsRecord as u, UploadStrategyOptions as un, Flow as ur, blurTransformSchema as ut, ExtractLayerServices as v, Middleware as vn, FlowNode as vr, sepiaTransformSchema as vt, describeImageParamsSchema as w, inputFileSchema as wn, completeNodeExecution as wr, ResizeParams as wt, RemoveBackgroundParams as x, MiddlewareService as xn, NodeExecutionResult as xr, transformImageParamsSchema as xt, ResolveEffect as y, MiddlewareContext as yn, FlowNodeData as yr, sharpenTransformSchema as yt, ResizeVideoParams as z, uploadEventSchema as zn, FlowEventNodeResume as zr, createTransformNode as zt };
5069
- //# sourceMappingURL=index-CrZopnP9.d.cts.map
5055
+ //# sourceMappingURL=index-4VDJDcWM.d.cts.map