@meistrari/tela-sdk-js 2.0.0 → 2.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +771 -1
- package/dist/index.cjs +356 -36
- package/dist/index.d.cts +653 -30
- package/dist/index.d.mts +653 -30
- package/dist/index.d.ts +653 -30
- package/dist/index.mjs +360 -41
- package/package.json +36 -35
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as _zod from 'zod';
|
|
2
|
+
import _zod__default, { ZodError, z } from 'zod';
|
|
3
|
+
import Emittery from 'emittery';
|
|
2
4
|
|
|
3
5
|
/**
|
|
4
6
|
* Base HTTP client with retry logic, request/response transformation, and streaming support.
|
|
@@ -245,7 +247,7 @@ type TelaFileOptions = BaseTelaFileOptions | TelaFileOptionsWithMimeType;
|
|
|
245
247
|
* which can be a URL string, Uint8Array, ReadableStream, ReadStream, Blob, or File.
|
|
246
248
|
*/
|
|
247
249
|
type TelaFileInput = string | Uint8Array | ReadableStream | Blob | File;
|
|
248
|
-
declare function TelaFileSchema():
|
|
250
|
+
declare function TelaFileSchema(): _zod__default.ZodCustom<TelaFile, TelaFile>;
|
|
249
251
|
/**
|
|
250
252
|
* Represents a file with support for various types including URLs, binary data, streams, and Blobs.
|
|
251
253
|
*
|
|
@@ -310,7 +312,8 @@ declare class TelaFile {
|
|
|
310
312
|
* @throws {InvalidFileURL} If the provided URL is not valid.
|
|
311
313
|
* @throws {EmptyFileError} If the provided file is empty.
|
|
312
314
|
*/
|
|
313
|
-
|
|
315
|
+
constructor(file: Blob | File | string, options?: BaseTelaFileOptions);
|
|
316
|
+
constructor(file: Uint8Array | ReadableStream, options: TelaFileOptionsWithMimeType);
|
|
314
317
|
static create(file: Blob | File | string, options?: BaseTelaFileOptions): TelaFile;
|
|
315
318
|
static create(file: Uint8Array | ReadableStream, options: TelaFileOptionsWithMimeType): TelaFile;
|
|
316
319
|
/**
|
|
@@ -408,6 +411,12 @@ interface BaseExecutionParams {
|
|
|
408
411
|
* This is required if a canvasId is not provided.
|
|
409
412
|
*/
|
|
410
413
|
applicationId?: string;
|
|
414
|
+
/**
|
|
415
|
+
* Optional label for this execution when using applicationId.
|
|
416
|
+
* This label can be used to identify or categorize the execution.
|
|
417
|
+
* Note: This field is only applicable when applicationId is provided.
|
|
418
|
+
*/
|
|
419
|
+
label?: string;
|
|
411
420
|
/**
|
|
412
421
|
* An array of previous messages in the conversation.
|
|
413
422
|
* Each message should have a 'role' (e.g., 'user', 'assistant') and 'content'.
|
|
@@ -456,6 +465,11 @@ interface BaseExecutionParams {
|
|
|
456
465
|
* @default false
|
|
457
466
|
*/
|
|
458
467
|
skipResultValidation?: boolean;
|
|
468
|
+
/**
|
|
469
|
+
* Optional array of tags to associate with this execution.
|
|
470
|
+
* Tags can be used for filtering, categorization, and analytics.
|
|
471
|
+
*/
|
|
472
|
+
tags?: string[];
|
|
459
473
|
}
|
|
460
474
|
/**
|
|
461
475
|
* Configuration for asynchronous canvas execution with polling.
|
|
@@ -523,6 +537,117 @@ interface SyncExecutionParams extends BaseExecutionParams {
|
|
|
523
537
|
*/
|
|
524
538
|
stream?: never;
|
|
525
539
|
}
|
|
540
|
+
/**
|
|
541
|
+
* Status of a canvas execution.
|
|
542
|
+
*
|
|
543
|
+
* Possible values:
|
|
544
|
+
* - `created` - Async execution queued on server (initial state)
|
|
545
|
+
* - `running` - Async execution actively processing
|
|
546
|
+
* - `succeeded` - Execution completed successfully (after validation)
|
|
547
|
+
* - `failed` - Execution failed (API error, validation error, or server failure)
|
|
548
|
+
* - `streaming` - Stream execution in progress
|
|
549
|
+
*
|
|
550
|
+
* @see {@link CanvasExecution.status} for status transitions and timing
|
|
551
|
+
*/
|
|
552
|
+
type ExecutionStatus = 'succeeded' | 'failed' | 'running' | 'created' | 'streaming';
|
|
553
|
+
type AsyncCompletionCreateResult = {
|
|
554
|
+
id: string;
|
|
555
|
+
status: ExecutionStatus;
|
|
556
|
+
input_content: {
|
|
557
|
+
files: Array<any>;
|
|
558
|
+
messages: Array<any>;
|
|
559
|
+
variables: {
|
|
560
|
+
body: string;
|
|
561
|
+
title: string;
|
|
562
|
+
};
|
|
563
|
+
};
|
|
564
|
+
output_content: null;
|
|
565
|
+
raw_input: {
|
|
566
|
+
async: boolean;
|
|
567
|
+
canvas_id: string;
|
|
568
|
+
variables: {
|
|
569
|
+
body: string;
|
|
570
|
+
title: string;
|
|
571
|
+
};
|
|
572
|
+
};
|
|
573
|
+
raw_output: any;
|
|
574
|
+
compatibility_date: string;
|
|
575
|
+
metadata: Array<{
|
|
576
|
+
promptVersion: {
|
|
577
|
+
modelConfigurations: {
|
|
578
|
+
type: string;
|
|
579
|
+
model: string;
|
|
580
|
+
temperature: number;
|
|
581
|
+
structuredOutput: {
|
|
582
|
+
schema: {
|
|
583
|
+
type: string;
|
|
584
|
+
title: string;
|
|
585
|
+
required: Array<string>;
|
|
586
|
+
properties: {
|
|
587
|
+
clickbaitMessages: {
|
|
588
|
+
id: string;
|
|
589
|
+
type: string;
|
|
590
|
+
items: {
|
|
591
|
+
id: string;
|
|
592
|
+
type: string;
|
|
593
|
+
};
|
|
594
|
+
description: string;
|
|
595
|
+
};
|
|
596
|
+
};
|
|
597
|
+
description: string;
|
|
598
|
+
};
|
|
599
|
+
enabled: boolean;
|
|
600
|
+
};
|
|
601
|
+
};
|
|
602
|
+
variablesDefinitions: Array<{
|
|
603
|
+
name: string;
|
|
604
|
+
type: string;
|
|
605
|
+
required: boolean;
|
|
606
|
+
}>;
|
|
607
|
+
};
|
|
608
|
+
}>;
|
|
609
|
+
credits_used: number;
|
|
610
|
+
prompt_id: string;
|
|
611
|
+
prompt_version_id: string;
|
|
612
|
+
prompt_application_id: any;
|
|
613
|
+
workspace_id: string;
|
|
614
|
+
created_at: string;
|
|
615
|
+
updated_at: string;
|
|
616
|
+
deleted_at: any;
|
|
617
|
+
};
|
|
618
|
+
/**
|
|
619
|
+
* Raw API response type. Represents the unprocessed response from the Tela API.
|
|
620
|
+
* This type will be refined in future versions with proper typing.
|
|
621
|
+
*/
|
|
622
|
+
type RawAPIResult = any;
|
|
623
|
+
/**
|
|
624
|
+
* Result returned when polling for asynchronous execution status.
|
|
625
|
+
*
|
|
626
|
+
* @template T - The type of the output content.
|
|
627
|
+
*/
|
|
628
|
+
type AsyncCompletionPollingResult<T> = {
|
|
629
|
+
/**
|
|
630
|
+
* Unique identifier for the execution.
|
|
631
|
+
*/
|
|
632
|
+
id: string;
|
|
633
|
+
/**
|
|
634
|
+
* Current status of the execution.
|
|
635
|
+
*/
|
|
636
|
+
status: ExecutionStatus;
|
|
637
|
+
/**
|
|
638
|
+
* The output content when execution succeeds.
|
|
639
|
+
*/
|
|
640
|
+
outputContent: {
|
|
641
|
+
/**
|
|
642
|
+
* The actual content result.
|
|
643
|
+
*/
|
|
644
|
+
content: T;
|
|
645
|
+
};
|
|
646
|
+
/**
|
|
647
|
+
* Raw output data from the execution.
|
|
648
|
+
*/
|
|
649
|
+
rawOutput: Record<string, any>;
|
|
650
|
+
};
|
|
526
651
|
/**
|
|
527
652
|
* Union type of all possible execution parameter configurations.
|
|
528
653
|
*/
|
|
@@ -537,29 +662,74 @@ type ExecutionParams = AsyncExecutionParams | StreamExecutionParams | SyncExecut
|
|
|
537
662
|
* @returns AsyncGenerator for streaming executions, Promise otherwise.
|
|
538
663
|
*/
|
|
539
664
|
type CanvasExecutionResult<TParams, TOutput = unknown> = TParams extends StreamExecutionParams ? AsyncGenerator<Partial<TOutput>> : Promise<TOutput>;
|
|
665
|
+
type CanvasExecutionEvents<TOutput> = {
|
|
666
|
+
poll: AsyncCompletionPollingResult<TOutput>;
|
|
667
|
+
success: TOutput;
|
|
668
|
+
error: ExecutionFailedError;
|
|
669
|
+
statusChange: ExecutionStatus;
|
|
670
|
+
};
|
|
540
671
|
/**
|
|
541
672
|
* Manages the execution lifecycle of a canvas.
|
|
542
673
|
*
|
|
543
674
|
* Handles synchronous, asynchronous (with polling), and streaming execution modes.
|
|
544
675
|
* Automatically uploads TelaFile instances and validates results based on output schema.
|
|
545
676
|
*
|
|
677
|
+
* ## Status Tracking
|
|
678
|
+
*
|
|
679
|
+
* The execution status can be accessed via the `status` property and tracks the lifecycle:
|
|
680
|
+
*
|
|
681
|
+
* - **Sync executions**: `succeeded` or `failed` (set after validation completes)
|
|
682
|
+
* - **Async executions**: `created` → `running` → `succeeded` or `failed` (updated during polling)
|
|
683
|
+
* - **Stream executions**: `streaming` (set when stream starts)
|
|
684
|
+
*
|
|
685
|
+
* Status is set to `failed` when:
|
|
686
|
+
* - API request fails
|
|
687
|
+
* - Validation fails (for both sync and async)
|
|
688
|
+
* - Polling reports failure status
|
|
689
|
+
*
|
|
690
|
+
* Status is set to `succeeded` only after:
|
|
691
|
+
* - API request succeeds AND
|
|
692
|
+
* - Output validation passes (if schema provided)
|
|
693
|
+
*
|
|
546
694
|
* @category Canvas
|
|
547
695
|
*
|
|
548
696
|
* @typeParam TParams - The execution parameters type
|
|
549
697
|
* @typeParam TInput - The input variables type
|
|
550
698
|
* @typeParam TOutput - The output result type
|
|
699
|
+
*
|
|
700
|
+
* @fires poll - Emitted during async polling with current status and output (async executions only)
|
|
701
|
+
* @fires success - Emitted when execution completes successfully with the final result
|
|
702
|
+
* @fires error - Emitted when execution fails (only if error listeners are registered, otherwise throws)
|
|
703
|
+
* @fires statusChange - Emitted when execution status transitions to a new state
|
|
704
|
+
*
|
|
705
|
+
* @example
|
|
706
|
+
* ```typescript
|
|
707
|
+
* const execution = await canvas.execute({ query: 'test' }, { async: true })
|
|
708
|
+
*
|
|
709
|
+
* // Track status changes
|
|
710
|
+
* execution.on('statusChange', (status) => {
|
|
711
|
+
* console.log(`Status: ${status}`) // created → running → succeeded
|
|
712
|
+
* })
|
|
713
|
+
*
|
|
714
|
+
* // Access current status at any time
|
|
715
|
+
* console.log(execution.status) // 'running'
|
|
716
|
+
*
|
|
717
|
+
* const result = await execution.result
|
|
718
|
+
* console.log(execution.status) // 'succeeded'
|
|
719
|
+
* ```
|
|
551
720
|
*/
|
|
552
|
-
declare class CanvasExecution<TParams extends ExecutionParams = SyncExecutionParams, TInput = unknown, TOutput = unknown> {
|
|
721
|
+
declare class CanvasExecution<TParams extends ExecutionParams = SyncExecutionParams, TInput = unknown, TOutput = unknown> extends Emittery<CanvasExecutionEvents<TOutput>> {
|
|
553
722
|
private _id;
|
|
723
|
+
private _status;
|
|
554
724
|
private readonly _variables;
|
|
555
725
|
private readonly _params;
|
|
556
726
|
private readonly _client;
|
|
557
727
|
private readonly _outputSchema;
|
|
558
728
|
private readonly _skipResultValidation;
|
|
559
729
|
private readonly _abortController;
|
|
560
|
-
private _startPropmise;
|
|
561
730
|
private _resultPromise;
|
|
562
731
|
private _stream;
|
|
732
|
+
private _rawResultValue;
|
|
563
733
|
/**
|
|
564
734
|
* Creates a new canvas execution instance.
|
|
565
735
|
*
|
|
@@ -568,14 +738,81 @@ declare class CanvasExecution<TParams extends ExecutionParams = SyncExecutionPar
|
|
|
568
738
|
* @param outputSchema - Zod schema or object schema for validating/parsing output.
|
|
569
739
|
* @param client - HTTP client instance for making API requests.
|
|
570
740
|
*/
|
|
571
|
-
constructor(variables: TInput, params: TParams | undefined, outputSchema:
|
|
741
|
+
constructor(variables: TInput, params: TParams | undefined, outputSchema: _zod__default.ZodType | Record<string, unknown>, client: BaseClient);
|
|
742
|
+
/**
|
|
743
|
+
* Fetches an existing asynchronous execution by its ID.
|
|
744
|
+
*
|
|
745
|
+
* This method retrieves the current state of an async execution and creates a new
|
|
746
|
+
* CanvasExecution instance with the fetched data. Only async executions can be
|
|
747
|
+
* fetched, as they are the only ones with persistent UUIDs on the server.
|
|
748
|
+
*
|
|
749
|
+
* @param id - The UUID of the async execution to fetch.
|
|
750
|
+
* @param outputSchema - Zod schema or object schema for validating/parsing output.
|
|
751
|
+
* @param client - HTTP client instance for making API requests.
|
|
752
|
+
* @param options - Optional configuration for polling behavior.
|
|
753
|
+
* @param options.pollingInterval - Time in milliseconds between polling attempts (default: 1000).
|
|
754
|
+
* @param options.pollingTimeout - Maximum time in milliseconds to wait for completion (default: 60000).
|
|
755
|
+
* @throws {InvalidExecutionModeError} If the provided ID is not a valid UUID.
|
|
756
|
+
* @returns A promise resolving to a CanvasExecution instance with the fetched state.
|
|
757
|
+
*
|
|
758
|
+
* @example
|
|
759
|
+
* ```typescript
|
|
760
|
+
* const execution = await CanvasExecution.fetch(
|
|
761
|
+
* 'execution-uuid',
|
|
762
|
+
* z.object({ result: z.string() }),
|
|
763
|
+
* client,
|
|
764
|
+
* { pollingInterval: 2000, pollingTimeout: 120000 }
|
|
765
|
+
* )
|
|
766
|
+
* console.log(execution.status) // 'running' or 'succeeded' or 'failed'
|
|
767
|
+
* ```
|
|
768
|
+
*/
|
|
769
|
+
static fetch<TOutput = unknown>(id: string, outputSchema: _zod__default.ZodType | Record<string, unknown>, client: BaseClient, options?: {
|
|
770
|
+
pollingInterval?: number;
|
|
771
|
+
pollingTimeout?: number;
|
|
772
|
+
}): Promise<CanvasExecution<AsyncExecutionParams, unknown, TOutput>>;
|
|
572
773
|
/**
|
|
573
774
|
* Gets the unique execution ID assigned by the server.
|
|
574
775
|
*
|
|
575
|
-
*
|
|
776
|
+
* Note: Streaming executions do not have an ID as they don't create a tracked execution on the server.
|
|
777
|
+
*
|
|
778
|
+
* @throws {ExecutionNotStartedError} If the execution has not been started yet.
|
|
779
|
+
* @throws {InvalidExecutionModeError} If called on a streaming execution (streams don't have IDs).
|
|
576
780
|
* @returns The execution ID.
|
|
577
781
|
*/
|
|
578
782
|
get id(): string;
|
|
783
|
+
/**
|
|
784
|
+
* Gets the latest known status of the execution.
|
|
785
|
+
*
|
|
786
|
+
* Status values and transitions:
|
|
787
|
+
* - **Sync**: `succeeded` (after validation) or `failed` (on any error)
|
|
788
|
+
* - **Async**: `created` → `running` → `succeeded` or `failed`
|
|
789
|
+
* - **Stream**: `streaming` (once started)
|
|
790
|
+
*
|
|
791
|
+
* **Important:** Status is set to `succeeded` only after successful validation.
|
|
792
|
+
* If validation fails, status will be `failed` even if the API request succeeded.
|
|
793
|
+
*
|
|
794
|
+
* Use the `statusChange` event to track status transitions in real-time.
|
|
795
|
+
*
|
|
796
|
+
* @throws {ExecutionNotStartedError} If the execution has not been started yet.
|
|
797
|
+
* @returns The current status of the execution.
|
|
798
|
+
*
|
|
799
|
+
* @example
|
|
800
|
+
* ```typescript
|
|
801
|
+
* const execution = await canvas.execute({ query: 'test' }, { async: true })
|
|
802
|
+
* console.log(execution.status) // 'created'
|
|
803
|
+
*
|
|
804
|
+
* await execution.result
|
|
805
|
+
* console.log(execution.status) // 'succeeded' or 'failed'
|
|
806
|
+
* ```
|
|
807
|
+
*/
|
|
808
|
+
get status(): ExecutionStatus;
|
|
809
|
+
/**
|
|
810
|
+
* Sets the status of the execution.
|
|
811
|
+
*
|
|
812
|
+
* @param status - The new status of the execution.
|
|
813
|
+
* @private
|
|
814
|
+
*/
|
|
815
|
+
private set status(value);
|
|
579
816
|
/**
|
|
580
817
|
* Gets the input variables provided to this execution.
|
|
581
818
|
*
|
|
@@ -606,6 +843,17 @@ declare class CanvasExecution<TParams extends ExecutionParams = SyncExecutionPar
|
|
|
606
843
|
* @returns True if stream mode is enabled.
|
|
607
844
|
*/
|
|
608
845
|
get isStream(): boolean;
|
|
846
|
+
/**
|
|
847
|
+
* Gets the raw API response without any processing or validation.
|
|
848
|
+
* Automatically starts execution and waits for completion (including polling for async executions).
|
|
849
|
+
*
|
|
850
|
+
* For sync executions, returns the complete API response.
|
|
851
|
+
* For async executions, returns the polling response with status and output.
|
|
852
|
+
*
|
|
853
|
+
* @throws {InvalidExecutionModeError} If called on a streaming execution.
|
|
854
|
+
* @returns A promise resolving to the raw API result.
|
|
855
|
+
*/
|
|
856
|
+
get rawResult(): Promise<RawAPIResult>;
|
|
609
857
|
/**
|
|
610
858
|
* Type guard to check if params indicate async execution.
|
|
611
859
|
*
|
|
@@ -619,9 +867,7 @@ declare class CanvasExecution<TParams extends ExecutionParams = SyncExecutionPar
|
|
|
619
867
|
*
|
|
620
868
|
* @returns A promise or async generator depending on execution mode.
|
|
621
869
|
*/
|
|
622
|
-
start(): Promise<CanvasExecutionResult<TParams, TOutput>> | AsyncGenerator<Partial<TOutput>, any, any> | Promise<AsyncGenerator<Partial<TOutput>, any, any>> | Promise<
|
|
623
|
-
id: string;
|
|
624
|
-
}>;
|
|
870
|
+
start(): Promise<CanvasExecutionResult<TParams, TOutput>> | AsyncGenerator<Partial<TOutput>, any, any> | Promise<AsyncGenerator<Partial<TOutput>, any, any>> | Promise<AsyncCompletionCreateResult>;
|
|
625
871
|
/**
|
|
626
872
|
* Gets the execution result. For async executions, automatically starts polling.
|
|
627
873
|
* For sync executions, returns the result promise. For streams, returns the generator.
|
|
@@ -633,9 +879,59 @@ declare class CanvasExecution<TParams extends ExecutionParams = SyncExecutionPar
|
|
|
633
879
|
* Cancels the ongoing execution by aborting all active requests and polling operations.
|
|
634
880
|
*/
|
|
635
881
|
cancel(): void;
|
|
882
|
+
/**
|
|
883
|
+
* Starts polling for the execution result without waiting for the promise to resolve.
|
|
884
|
+
* This allows users to track execution progress via events rather than awaiting a promise.
|
|
885
|
+
*
|
|
886
|
+
* The following events will be emitted during polling:
|
|
887
|
+
* - `statusChange`: Emitted when the execution status changes (e.g., 'created' → 'running' → 'succeeded')
|
|
888
|
+
* - `poll`: Emitted on each polling attempt with the server response
|
|
889
|
+
* - `success`: Emitted when the execution completes successfully with the final result
|
|
890
|
+
* - `error`: Emitted if the execution fails
|
|
891
|
+
*
|
|
892
|
+
* **Important:** Events are only emitted while polling is active. You must either call `poll()` or
|
|
893
|
+
* await `execution.result` to start polling. Simply setting up event listeners without starting
|
|
894
|
+
* polling will not trigger any events.
|
|
895
|
+
*
|
|
896
|
+
* **Note:** If the execution has already completed (succeeded or failed) when fetched, the `success`
|
|
897
|
+
* and `error` events will not fire since no polling is needed. Check the `status` property and
|
|
898
|
+
* access the `result` directly for already-completed executions.
|
|
899
|
+
*
|
|
900
|
+
* @throws {InvalidExecutionModeError} If called on a non-async execution (sync or stream).
|
|
901
|
+
* @throws {ExecutionNotStartedError} If the execution has not been started yet (no ID assigned).
|
|
902
|
+
*
|
|
903
|
+
* @example
|
|
904
|
+
* ```typescript
|
|
905
|
+
* const execution = await canvas.getExecution('execution-id')
|
|
906
|
+
*
|
|
907
|
+
* // Check if already completed
|
|
908
|
+
* if (execution.status === 'succeeded' || execution.status === 'failed') {
|
|
909
|
+
* // Access result directly - events won't fire
|
|
910
|
+
* const result = await execution.result
|
|
911
|
+
* console.log('Already completed:', result)
|
|
912
|
+
* } else {
|
|
913
|
+
* // Still running - set up events and start polling
|
|
914
|
+
* execution.on('statusChange', (status) => {
|
|
915
|
+
* console.log('Status:', status)
|
|
916
|
+
* })
|
|
917
|
+
*
|
|
918
|
+
* execution.on('success', (result) => {
|
|
919
|
+
* console.log('Completed:', result)
|
|
920
|
+
* })
|
|
921
|
+
*
|
|
922
|
+
* execution.on('error', (error) => {
|
|
923
|
+
* console.error('Failed:', error)
|
|
924
|
+
* })
|
|
925
|
+
*
|
|
926
|
+
* // Start polling without waiting
|
|
927
|
+
* execution.poll()
|
|
928
|
+
* }
|
|
929
|
+
* ```
|
|
930
|
+
*/
|
|
931
|
+
poll(): void;
|
|
636
932
|
/**
|
|
637
933
|
* Builds the base request body shared across all execution types.
|
|
638
|
-
* Includes messages, overrides, and structured output configuration.
|
|
934
|
+
* Includes messages, overrides, tags, label, and structured output configuration.
|
|
639
935
|
*
|
|
640
936
|
* @returns The base request body object.
|
|
641
937
|
*/
|
|
@@ -779,8 +1075,12 @@ interface CanvasOptions<TInput, TOutput> {
|
|
|
779
1075
|
* Variables of the canvas.
|
|
780
1076
|
*/
|
|
781
1077
|
variables: Array<CanvasVariable>;
|
|
1078
|
+
/**
|
|
1079
|
+
* Whether the canvas is a workflow.
|
|
1080
|
+
*/
|
|
1081
|
+
isWorkflow: boolean;
|
|
782
1082
|
}
|
|
783
|
-
type CanvasGetOptions<TInput extends ZodTypeOrRecord, TOutput extends ZodTypeOrRecord> = Omit<CanvasOptions<TInput, TOutput>, 'client' | 'variables'> & {
|
|
1083
|
+
type CanvasGetOptions<TInput extends ZodTypeOrRecord, TOutput extends ZodTypeOrRecord> = Omit<CanvasOptions<TInput, TOutput>, 'client' | 'variables' | 'isWorkflow'> & {
|
|
784
1084
|
/**
|
|
785
1085
|
* Whether to skip schema validation warnings during canvas retrieval.
|
|
786
1086
|
* When true, no warnings will be logged for schema mismatches.
|
|
@@ -789,19 +1089,294 @@ type CanvasGetOptions<TInput extends ZodTypeOrRecord, TOutput extends ZodTypeOrR
|
|
|
789
1089
|
skipSchemaValidation?: boolean;
|
|
790
1090
|
};
|
|
791
1091
|
declare const zod: {
|
|
792
|
-
string: typeof string;
|
|
793
|
-
number: typeof number;
|
|
794
|
-
boolean: typeof boolean;
|
|
795
|
-
object: typeof object;
|
|
796
|
-
array: typeof array;
|
|
797
1092
|
file: typeof TelaFileSchema;
|
|
798
|
-
|
|
799
|
-
|
|
1093
|
+
z: typeof _zod.z;
|
|
1094
|
+
default: typeof _zod.z;
|
|
1095
|
+
core: typeof _zod.core;
|
|
1096
|
+
globalRegistry: _zod.core.$ZodRegistry<_zod.core.GlobalMeta, _zod.core.$ZodType<unknown, unknown, _zod.core.$ZodTypeInternals<unknown, unknown>>>;
|
|
1097
|
+
registry: typeof _zod.core.registry;
|
|
1098
|
+
config: typeof _zod.core.config;
|
|
1099
|
+
$output: typeof _zod.core.$output;
|
|
1100
|
+
$input: typeof _zod.core.$input;
|
|
1101
|
+
$brand: typeof _zod.core.$brand;
|
|
1102
|
+
clone: typeof _zod.core.util.clone;
|
|
1103
|
+
regexes: typeof _zod.core.regexes;
|
|
1104
|
+
treeifyError: typeof _zod.core.treeifyError;
|
|
1105
|
+
prettifyError: typeof _zod.core.prettifyError;
|
|
1106
|
+
formatError: typeof _zod.core.formatError;
|
|
1107
|
+
flattenError: typeof _zod.core.flattenError;
|
|
1108
|
+
toJSONSchema: typeof _zod.core.toJSONSchema;
|
|
1109
|
+
TimePrecision: {
|
|
1110
|
+
readonly Any: null;
|
|
1111
|
+
readonly Minute: -1;
|
|
1112
|
+
readonly Second: 0;
|
|
1113
|
+
readonly Millisecond: 3;
|
|
1114
|
+
readonly Microsecond: 6;
|
|
1115
|
+
};
|
|
1116
|
+
util: typeof _zod.core.util;
|
|
1117
|
+
NEVER: never;
|
|
1118
|
+
locales: typeof _zod.core.locales;
|
|
1119
|
+
ZodISODateTime: _zod.core.$constructor<_zod.ZodISODateTime, _zod.core.$ZodISODateTimeDef>;
|
|
1120
|
+
ZodISODate: _zod.core.$constructor<_zod.ZodISODate, _zod.core.$ZodStringFormatDef<"date">>;
|
|
1121
|
+
ZodISOTime: _zod.core.$constructor<_zod.ZodISOTime, _zod.core.$ZodISOTimeDef>;
|
|
1122
|
+
ZodISODuration: _zod.core.$constructor<_zod.ZodISODuration, _zod.core.$ZodStringFormatDef<"duration">>;
|
|
1123
|
+
iso: typeof _zod.iso;
|
|
1124
|
+
coerce: typeof _zod.coerce;
|
|
1125
|
+
string(params?: string | _zod.core.$ZodStringParams): _zod.ZodString;
|
|
1126
|
+
string<T extends string>(params?: string | _zod.core.$ZodStringParams): _zod.core.$ZodType<T, T>;
|
|
1127
|
+
email(params?: string | _zod.core.$ZodEmailParams): _zod.ZodEmail;
|
|
1128
|
+
guid(params?: string | _zod.core.$ZodGUIDParams): _zod.ZodGUID;
|
|
1129
|
+
uuid(params?: string | _zod.core.$ZodUUIDParams): _zod.ZodUUID;
|
|
1130
|
+
uuidv4(params?: string | _zod.core.$ZodUUIDv4Params): _zod.ZodUUID;
|
|
1131
|
+
uuidv6(params?: string | _zod.core.$ZodUUIDv6Params): _zod.ZodUUID;
|
|
1132
|
+
uuidv7(params?: string | _zod.core.$ZodUUIDv7Params): _zod.ZodUUID;
|
|
1133
|
+
url(params?: string | _zod.core.$ZodURLParams): _zod.ZodURL;
|
|
1134
|
+
httpUrl(params?: string | Omit<_zod.core.$ZodURLParams, "protocol" | "hostname">): _zod.ZodURL;
|
|
1135
|
+
emoji(params?: string | _zod.core.$ZodEmojiParams): _zod.ZodEmoji;
|
|
1136
|
+
nanoid(params?: string | _zod.core.$ZodNanoIDParams): _zod.ZodNanoID;
|
|
1137
|
+
cuid(params?: string | _zod.core.$ZodCUIDParams): _zod.ZodCUID;
|
|
1138
|
+
cuid2(params?: string | _zod.core.$ZodCUID2Params): _zod.ZodCUID2;
|
|
1139
|
+
ulid(params?: string | _zod.core.$ZodULIDParams): _zod.ZodULID;
|
|
1140
|
+
xid(params?: string | _zod.core.$ZodXIDParams): _zod.ZodXID;
|
|
1141
|
+
ksuid(params?: string | _zod.core.$ZodKSUIDParams): _zod.ZodKSUID;
|
|
1142
|
+
ipv4(params?: string | _zod.core.$ZodIPv4Params): _zod.ZodIPv4;
|
|
1143
|
+
ipv6(params?: string | _zod.core.$ZodIPv6Params): _zod.ZodIPv6;
|
|
1144
|
+
cidrv4(params?: string | _zod.core.$ZodCIDRv4Params): _zod.ZodCIDRv4;
|
|
1145
|
+
cidrv6(params?: string | _zod.core.$ZodCIDRv6Params): _zod.ZodCIDRv6;
|
|
1146
|
+
base64(params?: string | _zod.core.$ZodBase64Params): _zod.ZodBase64;
|
|
1147
|
+
base64url(params?: string | _zod.core.$ZodBase64URLParams): _zod.ZodBase64URL;
|
|
1148
|
+
e164(params?: string | _zod.core.$ZodE164Params): _zod.ZodE164;
|
|
1149
|
+
jwt(params?: string | _zod.core.$ZodJWTParams): _zod.ZodJWT;
|
|
1150
|
+
stringFormat<Format extends string>(format: Format, fnOrRegex: ((arg: string) => _zod.core.util.MaybeAsync<unknown>) | RegExp, _params?: string | _zod.core.$ZodStringFormatParams): _zod.ZodCustomStringFormat<Format>;
|
|
1151
|
+
hostname(_params?: string | _zod.core.$ZodStringFormatParams): _zod.ZodCustomStringFormat<"hostname">;
|
|
1152
|
+
hex(_params?: string | _zod.core.$ZodStringFormatParams): _zod.ZodCustomStringFormat<"hex">;
|
|
1153
|
+
hash<Alg extends _zod.core.util.HashAlgorithm, Enc extends _zod.core.util.HashEncoding = "hex">(alg: Alg, params?: {
|
|
1154
|
+
enc?: Enc;
|
|
1155
|
+
} & _zod.core.$ZodStringFormatParams): _zod.ZodCustomStringFormat<`${Alg}_${Enc}`>;
|
|
1156
|
+
number(params?: string | _zod.core.$ZodNumberParams): _zod.ZodNumber;
|
|
1157
|
+
int(params?: string | _zod.core.$ZodCheckNumberFormatParams): _zod.ZodInt;
|
|
1158
|
+
float32(params?: string | _zod.core.$ZodCheckNumberFormatParams): _zod.ZodFloat32;
|
|
1159
|
+
float64(params?: string | _zod.core.$ZodCheckNumberFormatParams): _zod.ZodFloat64;
|
|
1160
|
+
int32(params?: string | _zod.core.$ZodCheckNumberFormatParams): _zod.ZodInt32;
|
|
1161
|
+
uint32(params?: string | _zod.core.$ZodCheckNumberFormatParams): _zod.ZodUInt32;
|
|
1162
|
+
boolean(params?: string | _zod.core.$ZodBooleanParams): _zod.ZodBoolean;
|
|
1163
|
+
bigint(params?: string | _zod.core.$ZodBigIntParams): _zod.ZodBigInt;
|
|
1164
|
+
int64(params?: string | _zod.core.$ZodBigIntFormatParams): _zod.ZodBigIntFormat;
|
|
1165
|
+
uint64(params?: string | _zod.core.$ZodBigIntFormatParams): _zod.ZodBigIntFormat;
|
|
1166
|
+
symbol(params?: string | _zod.core.$ZodSymbolParams): _zod.ZodSymbol;
|
|
1167
|
+
any(): _zod.ZodAny;
|
|
1168
|
+
unknown(): _zod.ZodUnknown;
|
|
1169
|
+
never(params?: string | _zod.core.$ZodNeverParams): _zod.ZodNever;
|
|
1170
|
+
date(params?: string | _zod.core.$ZodDateParams): _zod.ZodDate;
|
|
1171
|
+
array<T extends _zod.core.SomeType>(element: T, params?: string | _zod.core.$ZodArrayParams): _zod.ZodArray<T>;
|
|
1172
|
+
keyof<T extends _zod.ZodObject>(schema: T): _zod.ZodEnum<_zod.core.util.KeysEnum<T["_zod"]["output"]>>;
|
|
1173
|
+
object<T extends _zod.core.$ZodLooseShape = Partial<Record<never, _zod.core.SomeType>>>(shape?: T, params?: string | _zod.core.$ZodObjectParams): _zod.ZodObject<_zod.core.util.Writeable<T>, _zod.core.$strip>;
|
|
1174
|
+
strictObject<T extends _zod.core.$ZodLooseShape>(shape: T, params?: string | _zod.core.$ZodObjectParams): _zod.ZodObject<T, _zod.core.$strict>;
|
|
1175
|
+
looseObject<T extends _zod.core.$ZodLooseShape>(shape: T, params?: string | _zod.core.$ZodObjectParams): _zod.ZodObject<T, _zod.core.$loose>;
|
|
1176
|
+
union<const T extends readonly _zod.core.SomeType[]>(options: T, params?: string | _zod.core.$ZodUnionParams): _zod.ZodUnion<T>;
|
|
1177
|
+
discriminatedUnion<Types extends readonly [_zod.core.$ZodTypeDiscriminable, ..._zod.core.$ZodTypeDiscriminable[]], Disc extends string>(discriminator: Disc, options: Types, params?: string | _zod.core.$ZodDiscriminatedUnionParams): _zod.ZodDiscriminatedUnion<Types, Disc>;
|
|
1178
|
+
intersection<T extends _zod.core.SomeType, U extends _zod.core.SomeType>(left: T, right: U): _zod.ZodIntersection<T, U>;
|
|
1179
|
+
tuple<T extends readonly [_zod.core.SomeType, ..._zod.core.SomeType[]]>(items: T, params?: string | _zod.core.$ZodTupleParams): _zod.ZodTuple<T, null>;
|
|
1180
|
+
tuple<T extends readonly [_zod.core.SomeType, ..._zod.core.SomeType[]], Rest extends _zod.core.SomeType>(items: T, rest: Rest, params?: string | _zod.core.$ZodTupleParams): _zod.ZodTuple<T, Rest>;
|
|
1181
|
+
tuple(items: [], params?: string | _zod.core.$ZodTupleParams): _zod.ZodTuple<[], null>;
|
|
1182
|
+
record<Key extends _zod.core.$ZodRecordKey, Value extends _zod.core.SomeType>(keyType: Key, valueType: Value, params?: string | _zod.core.$ZodRecordParams): _zod.ZodRecord<Key, Value>;
|
|
1183
|
+
partialRecord<Key extends _zod.core.$ZodRecordKey, Value extends _zod.core.SomeType>(keyType: Key, valueType: Value, params?: string | _zod.core.$ZodRecordParams): _zod.ZodRecord<Key & _zod.core.$partial, Value>;
|
|
1184
|
+
map<Key extends _zod.core.SomeType, Value extends _zod.core.SomeType>(keyType: Key, valueType: Value, params?: string | _zod.core.$ZodMapParams): _zod.ZodMap<Key, Value>;
|
|
1185
|
+
set<Value extends _zod.core.SomeType>(valueType: Value, params?: string | _zod.core.$ZodSetParams): _zod.ZodSet<Value>;
|
|
1186
|
+
nativeEnum<T extends _zod.core.util.EnumLike>(entries: T, params?: string | _zod.core.$ZodEnumParams): _zod.ZodEnum<T>;
|
|
1187
|
+
literal<const T extends ReadonlyArray<_zod.core.util.Literal>>(value: T, params?: string | _zod.core.$ZodLiteralParams): _zod.ZodLiteral<T[number]>;
|
|
1188
|
+
literal<const T extends _zod.core.util.Literal>(value: T, params?: string | _zod.core.$ZodLiteralParams): _zod.ZodLiteral<T>;
|
|
1189
|
+
transform<I = unknown, O = I>(fn: (input: I, ctx: _zod.core.ParsePayload) => O): _zod.ZodTransform<Awaited<O>, I>;
|
|
1190
|
+
optional<T extends _zod.core.SomeType>(innerType: T): _zod.ZodOptional<T>;
|
|
1191
|
+
nullable<T extends _zod.core.SomeType>(innerType: T): _zod.ZodNullable<T>;
|
|
1192
|
+
nullish<T extends _zod.core.SomeType>(innerType: T): _zod.ZodOptional<_zod.ZodNullable<T>>;
|
|
1193
|
+
_default<T extends _zod.core.SomeType>(innerType: T, defaultValue: _zod.core.util.NoUndefined<_zod.core.output<T>> | (() => _zod.core.util.NoUndefined<_zod.core.output<T>>)): _zod.ZodDefault<T>;
|
|
1194
|
+
prefault<T extends _zod.core.SomeType>(innerType: T, defaultValue: _zod.core.input<T> | (() => _zod.core.input<T>)): _zod.ZodPrefault<T>;
|
|
1195
|
+
nonoptional<T extends _zod.core.SomeType>(innerType: T, params?: string | _zod.core.$ZodNonOptionalParams): _zod.ZodNonOptional<T>;
|
|
1196
|
+
success<T extends _zod.core.SomeType>(innerType: T): _zod.ZodSuccess<T>;
|
|
1197
|
+
nan(params?: string | _zod.core.$ZodNaNParams): _zod.ZodNaN;
|
|
1198
|
+
pipe<const A extends _zod.core.SomeType, B extends _zod.core.$ZodType<unknown, _zod.core.output<A>> = _zod.core.$ZodType<unknown, _zod.core.output<A>, _zod.core.$ZodTypeInternals<unknown, _zod.core.output<A>>>>(in_: A, out: B | _zod.core.$ZodType<unknown, _zod.core.output<A>>): _zod.ZodPipe<A, B>;
|
|
1199
|
+
codec<const A extends _zod.core.SomeType, B extends _zod.core.SomeType = _zod.core.$ZodType<unknown, unknown, _zod.core.$ZodTypeInternals<unknown, unknown>>>(in_: A, out: B, params: {
|
|
1200
|
+
decode: (value: _zod.core.output<A>, payload: _zod.core.ParsePayload<_zod.core.output<A>>) => _zod.core.util.MaybeAsync<_zod.core.input<B>>;
|
|
1201
|
+
encode: (value: _zod.core.input<B>, payload: _zod.core.ParsePayload<_zod.core.input<B>>) => _zod.core.util.MaybeAsync<_zod.core.output<A>>;
|
|
1202
|
+
}): _zod.ZodCodec<A, B>;
|
|
1203
|
+
readonly<T extends _zod.core.SomeType>(innerType: T): _zod.ZodReadonly<T>;
|
|
1204
|
+
templateLiteral<const Parts extends _zod.core.$ZodTemplateLiteralPart[]>(parts: Parts, params?: string | _zod.core.$ZodTemplateLiteralParams): _zod.ZodTemplateLiteral<_zod.core.$PartsToTemplateLiteral<Parts>>;
|
|
1205
|
+
lazy<T extends _zod.core.SomeType>(getter: () => T): _zod.ZodLazy<T>;
|
|
1206
|
+
promise<T extends _zod.core.SomeType>(innerType: T): _zod.ZodPromise<T>;
|
|
1207
|
+
_function(): _zod.ZodFunction;
|
|
1208
|
+
_function<const In extends ReadonlyArray<_zod.core.$ZodType>>(params: {
|
|
1209
|
+
input: In;
|
|
1210
|
+
}): _zod.ZodFunction<_zod.ZodTuple<In, null>, _zod.core.$ZodFunctionOut>;
|
|
1211
|
+
_function<const In extends ReadonlyArray<_zod.core.$ZodType>, const Out extends _zod.core.$ZodFunctionOut = _zod.core.$ZodFunctionOut>(params: {
|
|
1212
|
+
input: In;
|
|
1213
|
+
output: Out;
|
|
1214
|
+
}): _zod.ZodFunction<_zod.ZodTuple<In, null>, Out>;
|
|
1215
|
+
_function<const In extends _zod.core.$ZodFunctionIn = _zod.core.$ZodFunctionArgs>(params: {
|
|
1216
|
+
input: In;
|
|
1217
|
+
}): _zod.ZodFunction<In, _zod.core.$ZodFunctionOut>;
|
|
1218
|
+
_function<const Out extends _zod.core.$ZodFunctionOut = _zod.core.$ZodFunctionOut>(params: {
|
|
1219
|
+
output: Out;
|
|
1220
|
+
}): _zod.ZodFunction<_zod.core.$ZodFunctionIn, Out>;
|
|
1221
|
+
_function<In extends _zod.core.$ZodFunctionIn = _zod.core.$ZodFunctionArgs, Out extends _zod.core.$ZodType = _zod.core.$ZodType<unknown, unknown, _zod.core.$ZodTypeInternals<unknown, unknown>>>(params?: {
|
|
1222
|
+
input: In;
|
|
1223
|
+
output: Out;
|
|
1224
|
+
}): _zod.ZodFunction<In, Out>;
|
|
1225
|
+
check<O = unknown>(fn: _zod.core.CheckFn<O>): _zod.core.$ZodCheck<O>;
|
|
1226
|
+
custom<O>(fn?: (data: unknown) => unknown, _params?: string | _zod.core.$ZodCustomParams | undefined): _zod.ZodCustom<O, O>;
|
|
1227
|
+
refine<T>(fn: (arg: NoInfer<T>) => _zod.core.util.MaybeAsync<unknown>, _params?: string | _zod.core.$ZodCustomParams): _zod.core.$ZodCheck<T>;
|
|
1228
|
+
superRefine<T>(fn: (arg: T, payload: _zod.core.$RefinementCtx<T>) => void | Promise<void>): _zod.core.$ZodCheck<T>;
|
|
1229
|
+
json(params?: string | _zod.core.$ZodCustomParams): _zod.ZodJSONSchema;
|
|
1230
|
+
preprocess<A, U extends _zod.core.SomeType, B = unknown>(fn: (arg: B, ctx: _zod.core.$RefinementCtx) => A, schema: U): _zod.ZodPipe<_zod.ZodTransform<A, B>, U>;
|
|
1231
|
+
ZodType: _zod.core.$constructor<_zod.ZodType>;
|
|
1232
|
+
_ZodString: _zod.core.$constructor<_zod._ZodString>;
|
|
1233
|
+
ZodString: _zod.core.$constructor<_zod.ZodString>;
|
|
1234
|
+
ZodStringFormat: _zod.core.$constructor<_zod.ZodStringFormat>;
|
|
1235
|
+
ZodEmail: _zod.core.$constructor<_zod.ZodEmail>;
|
|
1236
|
+
ZodGUID: _zod.core.$constructor<_zod.ZodGUID>;
|
|
1237
|
+
ZodUUID: _zod.core.$constructor<_zod.ZodUUID>;
|
|
1238
|
+
ZodURL: _zod.core.$constructor<_zod.ZodURL>;
|
|
1239
|
+
ZodEmoji: _zod.core.$constructor<_zod.ZodEmoji>;
|
|
1240
|
+
ZodNanoID: _zod.core.$constructor<_zod.ZodNanoID>;
|
|
1241
|
+
ZodCUID: _zod.core.$constructor<_zod.ZodCUID>;
|
|
1242
|
+
ZodCUID2: _zod.core.$constructor<_zod.ZodCUID2>;
|
|
1243
|
+
ZodULID: _zod.core.$constructor<_zod.ZodULID>;
|
|
1244
|
+
ZodXID: _zod.core.$constructor<_zod.ZodXID>;
|
|
1245
|
+
ZodKSUID: _zod.core.$constructor<_zod.ZodKSUID>;
|
|
1246
|
+
ZodIPv4: _zod.core.$constructor<_zod.ZodIPv4>;
|
|
1247
|
+
ZodIPv6: _zod.core.$constructor<_zod.ZodIPv6>;
|
|
1248
|
+
ZodCIDRv4: _zod.core.$constructor<_zod.ZodCIDRv4>;
|
|
1249
|
+
ZodCIDRv6: _zod.core.$constructor<_zod.ZodCIDRv6>;
|
|
1250
|
+
ZodBase64: _zod.core.$constructor<_zod.ZodBase64>;
|
|
1251
|
+
ZodBase64URL: _zod.core.$constructor<_zod.ZodBase64URL>;
|
|
1252
|
+
ZodE164: _zod.core.$constructor<_zod.ZodE164>;
|
|
1253
|
+
ZodJWT: _zod.core.$constructor<_zod.ZodJWT>;
|
|
1254
|
+
ZodCustomStringFormat: _zod.core.$constructor<_zod.ZodCustomStringFormat>;
|
|
1255
|
+
ZodNumber: _zod.core.$constructor<_zod.ZodNumber>;
|
|
1256
|
+
ZodNumberFormat: _zod.core.$constructor<_zod.ZodNumberFormat>;
|
|
1257
|
+
ZodBoolean: _zod.core.$constructor<_zod.ZodBoolean>;
|
|
1258
|
+
ZodBigInt: _zod.core.$constructor<_zod.ZodBigInt>;
|
|
1259
|
+
ZodBigIntFormat: _zod.core.$constructor<_zod.ZodBigIntFormat>;
|
|
1260
|
+
ZodSymbol: _zod.core.$constructor<_zod.ZodSymbol>;
|
|
1261
|
+
ZodUndefined: _zod.core.$constructor<_zod.ZodUndefined>;
|
|
1262
|
+
undefined: typeof _zod.undefined;
|
|
1263
|
+
ZodNull: _zod.core.$constructor<_zod.ZodNull>;
|
|
1264
|
+
null: typeof _zod.null;
|
|
1265
|
+
ZodAny: _zod.core.$constructor<_zod.ZodAny>;
|
|
1266
|
+
ZodUnknown: _zod.core.$constructor<_zod.ZodUnknown>;
|
|
1267
|
+
ZodNever: _zod.core.$constructor<_zod.ZodNever>;
|
|
1268
|
+
ZodVoid: _zod.core.$constructor<_zod.ZodVoid>;
|
|
1269
|
+
void: typeof _zod.void;
|
|
1270
|
+
ZodDate: _zod.core.$constructor<_zod.ZodDate>;
|
|
1271
|
+
ZodArray: _zod.core.$constructor<_zod.ZodArray>;
|
|
1272
|
+
ZodObject: _zod.core.$constructor<_zod.ZodObject>;
|
|
1273
|
+
ZodUnion: _zod.core.$constructor<_zod.ZodUnion>;
|
|
1274
|
+
ZodDiscriminatedUnion: _zod.core.$constructor<_zod.ZodDiscriminatedUnion>;
|
|
1275
|
+
ZodIntersection: _zod.core.$constructor<_zod.ZodIntersection>;
|
|
1276
|
+
ZodTuple: _zod.core.$constructor<_zod.ZodTuple>;
|
|
1277
|
+
ZodRecord: _zod.core.$constructor<_zod.ZodRecord>;
|
|
1278
|
+
ZodMap: _zod.core.$constructor<_zod.ZodMap>;
|
|
1279
|
+
ZodSet: _zod.core.$constructor<_zod.ZodSet>;
|
|
1280
|
+
ZodEnum: _zod.core.$constructor<_zod.ZodEnum>;
|
|
1281
|
+
enum: typeof _zod.enum;
|
|
1282
|
+
ZodLiteral: _zod.core.$constructor<_zod.ZodLiteral>;
|
|
1283
|
+
ZodFile: _zod.core.$constructor<_zod.ZodFile>;
|
|
1284
|
+
ZodTransform: _zod.core.$constructor<_zod.ZodTransform>;
|
|
1285
|
+
ZodOptional: _zod.core.$constructor<_zod.ZodOptional>;
|
|
1286
|
+
ZodNullable: _zod.core.$constructor<_zod.ZodNullable>;
|
|
1287
|
+
ZodDefault: _zod.core.$constructor<_zod.ZodDefault>;
|
|
1288
|
+
ZodPrefault: _zod.core.$constructor<_zod.ZodPrefault>;
|
|
1289
|
+
ZodNonOptional: _zod.core.$constructor<_zod.ZodNonOptional>;
|
|
1290
|
+
ZodSuccess: _zod.core.$constructor<_zod.ZodSuccess>;
|
|
1291
|
+
ZodCatch: _zod.core.$constructor<_zod.ZodCatch>;
|
|
1292
|
+
catch: typeof _zod.catch;
|
|
1293
|
+
ZodNaN: _zod.core.$constructor<_zod.ZodNaN>;
|
|
1294
|
+
ZodPipe: _zod.core.$constructor<_zod.ZodPipe>;
|
|
1295
|
+
ZodCodec: _zod.core.$constructor<_zod.ZodCodec>;
|
|
1296
|
+
ZodReadonly: _zod.core.$constructor<_zod.ZodReadonly>;
|
|
1297
|
+
ZodTemplateLiteral: _zod.core.$constructor<_zod.ZodTemplateLiteral>;
|
|
1298
|
+
ZodLazy: _zod.core.$constructor<_zod.ZodLazy>;
|
|
1299
|
+
ZodPromise: _zod.core.$constructor<_zod.ZodPromise>;
|
|
1300
|
+
ZodFunction: _zod.core.$constructor<_zod.ZodFunction>;
|
|
1301
|
+
function: typeof _zod._function;
|
|
1302
|
+
ZodCustom: _zod.core.$constructor<_zod.ZodCustom>;
|
|
1303
|
+
instanceof: typeof _zod.instanceof;
|
|
1304
|
+
stringbool: (_params?: string | _zod.core.$ZodStringBoolParams) => _zod.ZodCodec<_zod.ZodString, _zod.ZodBoolean>;
|
|
1305
|
+
lt: typeof _zod.core._lt;
|
|
1306
|
+
lte: typeof _zod.core._lte;
|
|
1307
|
+
gt: typeof _zod.core._gt;
|
|
1308
|
+
gte: typeof _zod.core._gte;
|
|
1309
|
+
positive: typeof _zod.core._positive;
|
|
1310
|
+
negative: typeof _zod.core._negative;
|
|
1311
|
+
nonpositive: typeof _zod.core._nonpositive;
|
|
1312
|
+
nonnegative: typeof _zod.core._nonnegative;
|
|
1313
|
+
multipleOf: typeof _zod.core._multipleOf;
|
|
1314
|
+
maxSize: typeof _zod.core._maxSize;
|
|
1315
|
+
minSize: typeof _zod.core._minSize;
|
|
1316
|
+
size: typeof _zod.core._size;
|
|
1317
|
+
maxLength: typeof _zod.core._maxLength;
|
|
1318
|
+
minLength: typeof _zod.core._minLength;
|
|
1319
|
+
length: typeof _zod.core._length;
|
|
1320
|
+
regex: typeof _zod.core._regex;
|
|
1321
|
+
lowercase: typeof _zod.core._lowercase;
|
|
1322
|
+
uppercase: typeof _zod.core._uppercase;
|
|
1323
|
+
includes: typeof _zod.core._includes;
|
|
1324
|
+
startsWith: typeof _zod.core._startsWith;
|
|
1325
|
+
endsWith: typeof _zod.core._endsWith;
|
|
1326
|
+
property: typeof _zod.core._property;
|
|
1327
|
+
mime: typeof _zod.core._mime;
|
|
1328
|
+
overwrite: typeof _zod.core._overwrite;
|
|
1329
|
+
normalize: typeof _zod.core._normalize;
|
|
1330
|
+
trim: typeof _zod.core._trim;
|
|
1331
|
+
toLowerCase: typeof _zod.core._toLowerCase;
|
|
1332
|
+
toUpperCase: typeof _zod.core._toUpperCase;
|
|
1333
|
+
ZodError: _zod.core.$constructor<ZodError>;
|
|
1334
|
+
ZodRealError: _zod.core.$constructor<ZodError>;
|
|
1335
|
+
parse: <T extends _zod.core.$ZodType>(schema: T, value: unknown, _ctx?: _zod.core.ParseContext<_zod.core.$ZodIssue>, _params?: {
|
|
1336
|
+
callee?: _zod.core.util.AnyFunc;
|
|
1337
|
+
Err?: _zod.core.$ZodErrorClass;
|
|
1338
|
+
}) => _zod.core.output<T>;
|
|
1339
|
+
parseAsync: <T extends _zod.core.$ZodType>(schema: T, value: unknown, _ctx?: _zod.core.ParseContext<_zod.core.$ZodIssue>, _params?: {
|
|
1340
|
+
callee?: _zod.core.util.AnyFunc;
|
|
1341
|
+
Err?: _zod.core.$ZodErrorClass;
|
|
1342
|
+
}) => Promise<_zod.core.output<T>>;
|
|
1343
|
+
safeParse: <T extends _zod.core.$ZodType>(schema: T, value: unknown, _ctx?: _zod.core.ParseContext<_zod.core.$ZodIssue>) => _zod.ZodSafeParseResult<_zod.core.output<T>>;
|
|
1344
|
+
safeParseAsync: <T extends _zod.core.$ZodType>(schema: T, value: unknown, _ctx?: _zod.core.ParseContext<_zod.core.$ZodIssue>) => Promise<_zod.ZodSafeParseResult<_zod.core.output<T>>>;
|
|
1345
|
+
encode: <T extends _zod.core.$ZodType>(schema: T, value: _zod.core.output<T>, _ctx?: _zod.core.ParseContext<_zod.core.$ZodIssue>) => _zod.core.input<T>;
|
|
1346
|
+
decode: <T extends _zod.core.$ZodType>(schema: T, value: _zod.core.input<T>, _ctx?: _zod.core.ParseContext<_zod.core.$ZodIssue>) => _zod.core.output<T>;
|
|
1347
|
+
encodeAsync: <T extends _zod.core.$ZodType>(schema: T, value: _zod.core.output<T>, _ctx? /**
|
|
1348
|
+
* Unique identifier for this prompt version.
|
|
1349
|
+
*/: _zod.core.ParseContext<_zod.core.$ZodIssue>) => Promise<_zod.core.input<T>>;
|
|
1350
|
+
decodeAsync: <T extends _zod.core.$ZodType>(schema: T, value: _zod.core.input<T>, _ctx?: _zod.core.ParseContext<_zod.core.$ZodIssue>) => Promise<_zod.core.output<T>>;
|
|
1351
|
+
safeEncode: <T extends _zod.core.$ZodType>(schema: T, value: _zod.core.output<T>, _ctx? /**
|
|
1352
|
+
* Variables available in this prompt version.
|
|
1353
|
+
*/: _zod.core.ParseContext<_zod.core.$ZodIssue>) => _zod.ZodSafeParseResult<_zod.core.input<T>>;
|
|
1354
|
+
safeDecode: <T extends _zod.core.$ZodType>(schema: T, value: _zod.core.input<T>, _ctx? /**
|
|
1355
|
+
* Configuration settings for this prompt version.
|
|
1356
|
+
*/: _zod.core.ParseContext<_zod.core.$ZodIssue>) => _zod.ZodSafeParseResult<_zod.core.output<T>>;
|
|
1357
|
+
safeEncodeAsync: <T extends _zod.core.$ZodType>(schema: T, value: _zod.core.output<T>, _ctx?: _zod.core.ParseContext<_zod.core.$ZodIssue>) => Promise<_zod.ZodSafeParseResult<_zod.core.input<T>>>;
|
|
1358
|
+
safeDecodeAsync: <T extends _zod.core.$ZodType>(schema: T, value: _zod.core.input<T>, _ctx?: _zod.core.ParseContext<_zod.core.$ZodIssue>) => Promise<_zod.ZodSafeParseResult<_zod.core.output<T>>>;
|
|
1359
|
+
setErrorMap(map: _zod.core.$ZodErrorMap): void;
|
|
1360
|
+
getErrorMap(): _zod.core.$ZodErrorMap<_zod.core.$ZodIssue> | undefined;
|
|
1361
|
+
ZodIssueCode: {
|
|
1362
|
+
readonly invalid_type: "invalid_type";
|
|
1363
|
+
readonly too_big: "too_big";
|
|
1364
|
+
readonly too_small: "too_small";
|
|
1365
|
+
readonly invalid_format: "invalid_format";
|
|
1366
|
+
readonly not_multiple_of: "not_multiple_of";
|
|
1367
|
+
readonly unrecognized_keys: "unrecognized_keys";
|
|
1368
|
+
readonly invalid_union: "invalid_union";
|
|
1369
|
+
readonly invalid_key: "invalid_key";
|
|
1370
|
+
readonly invalid_element: "invalid_element";
|
|
1371
|
+
readonly invalid_value: "invalid_value";
|
|
1372
|
+
readonly custom: "custom";
|
|
1373
|
+
};
|
|
1374
|
+
ZodFirstPartyTypeKind: typeof _zod.ZodFirstPartyTypeKind;
|
|
800
1375
|
};
|
|
801
1376
|
type SchemaBuilder = typeof zod;
|
|
802
1377
|
type SchemaFunction<T> = (schema: SchemaBuilder) => T;
|
|
803
|
-
type Output<T> = T extends z
|
|
804
|
-
type ZodTypeOrRecord = z
|
|
1378
|
+
type Output<T> = T extends z.ZodType ? z.infer<T> : T;
|
|
1379
|
+
type ZodTypeOrRecord = z.ZodType | Record<string, unknown>;
|
|
805
1380
|
type CanvasExecutionPromiseLike<TParams extends ExecutionParams = SyncExecutionParams, TInput = unknown, TOutput = unknown> = PromiseLike<CanvasExecution<TParams, TInput, TOutput>> & {
|
|
806
1381
|
result: Promise<CanvasExecutionResult<TParams, TOutput>>;
|
|
807
1382
|
};
|
|
@@ -825,6 +1400,7 @@ declare class Canvas<TInput extends ZodTypeOrRecord, TOutput extends ZodTypeOrRe
|
|
|
825
1400
|
private readonly _output;
|
|
826
1401
|
private readonly _client;
|
|
827
1402
|
private readonly _variables;
|
|
1403
|
+
private readonly _isWorkflow;
|
|
828
1404
|
/**
|
|
829
1405
|
* Creates a new instance of the Canvas class. Usage of this constructor is not recommended.
|
|
830
1406
|
* Use the `tela.getCanvas` method instead.
|
|
@@ -873,6 +1449,12 @@ declare class Canvas<TInput extends ZodTypeOrRecord, TOutput extends ZodTypeOrRe
|
|
|
873
1449
|
* @returns The variables of the canvas.
|
|
874
1450
|
*/
|
|
875
1451
|
get variables(): Array<CanvasVariable>;
|
|
1452
|
+
/**
|
|
1453
|
+
* Gets whether this canvas is a workflow.
|
|
1454
|
+
*
|
|
1455
|
+
* @returns True if the canvas is a workflow.
|
|
1456
|
+
*/
|
|
1457
|
+
get isWorkflow(): boolean;
|
|
876
1458
|
/**
|
|
877
1459
|
* Validates and parses input variables using the canvas input schema.
|
|
878
1460
|
*
|
|
@@ -916,11 +1498,50 @@ declare class Canvas<TInput extends ZodTypeOrRecord, TOutput extends ZodTypeOrRe
|
|
|
916
1498
|
* ).result) {
|
|
917
1499
|
* console.log(chunk);
|
|
918
1500
|
* }
|
|
1501
|
+
*
|
|
1502
|
+
* // Execution with tags
|
|
1503
|
+
* const result = await canvas.execute(
|
|
1504
|
+
* { query: "Hello" },
|
|
1505
|
+
* { tags: ["production", "analytics"] }
|
|
1506
|
+
* ).result;
|
|
1507
|
+
* ```
|
|
1508
|
+
*/
|
|
1509
|
+
execute(variables: z.input<TInput>, params?: SyncExecutionParams): CanvasExecutionPromiseLike<SyncExecutionParams, Output<TInput>, Output<TOutput>>;
|
|
1510
|
+
execute(variables: z.input<TInput>, params?: AsyncExecutionParams): CanvasExecutionPromiseLike<AsyncExecutionParams, Output<TInput>, Output<TOutput>>;
|
|
1511
|
+
execute(variables: z.input<TInput>, params?: StreamExecutionParams): CanvasExecutionPromiseLike<StreamExecutionParams, Output<TInput>, Output<TOutput>>;
|
|
1512
|
+
/**
|
|
1513
|
+
* Fetches an existing async execution by its ID.
|
|
1514
|
+
*
|
|
1515
|
+
* This method retrieves the current state of an async execution that was previously
|
|
1516
|
+
* started on this canvas. Only async executions can be fetched, as they are the only
|
|
1517
|
+
* ones with persistent UUIDs on the server.
|
|
1518
|
+
*
|
|
1519
|
+
* @param id - The UUID of the async execution to fetch.
|
|
1520
|
+
* @param options - Optional configuration for polling behavior.
|
|
1521
|
+
* @param options.pollingInterval - Time in milliseconds between polling attempts (default: 1000).
|
|
1522
|
+
* @param options.pollingTimeout - Maximum time in milliseconds to wait for completion (default: 60000).
|
|
1523
|
+
* @throws {InvalidExecutionModeError} If the provided ID is not a valid UUID.
|
|
1524
|
+
* @returns A promise resolving to a CanvasExecution instance with the fetched state.
|
|
1525
|
+
*
|
|
1526
|
+
* @example
|
|
1527
|
+
* ```typescript
|
|
1528
|
+
* // Start an async execution
|
|
1529
|
+
* const execution = await canvas.execute({ query: 'test' }, { async: true })
|
|
1530
|
+
* const executionId = execution.id
|
|
1531
|
+
*
|
|
1532
|
+
* // Later, fetch the execution by ID
|
|
1533
|
+
* const fetched = await canvas.getExecution(executionId)
|
|
1534
|
+
* console.log(fetched.status) // 'running', 'succeeded', or 'failed'
|
|
1535
|
+
*
|
|
1536
|
+
* // Use poll() for event-driven progress tracking
|
|
1537
|
+
* fetched.on('statusChange', (status) => console.log('Status:', status))
|
|
1538
|
+
* fetched.poll()
|
|
919
1539
|
* ```
|
|
920
1540
|
*/
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
1541
|
+
getExecution(id: string, options?: {
|
|
1542
|
+
pollingInterval?: number;
|
|
1543
|
+
pollingTimeout?: number;
|
|
1544
|
+
}): Promise<CanvasExecution<AsyncExecutionParams, unknown, Output<TOutput>>>;
|
|
924
1545
|
}
|
|
925
1546
|
|
|
926
1547
|
/**
|
|
@@ -990,20 +1611,22 @@ declare class TelaSDK extends BaseClient {
|
|
|
990
1611
|
createFile: typeof TelaFile.create;
|
|
991
1612
|
/**
|
|
992
1613
|
* Retrieves a canvas by its ID, version ID, or application ID.
|
|
993
|
-
* Validates input and output schemas if
|
|
1614
|
+
* Validates input and output schemas if provided via schema builder functions.
|
|
994
1615
|
*
|
|
995
1616
|
* @param options - Options for retrieving the canvas.
|
|
996
1617
|
* @returns A promise resolving to a Canvas instance.
|
|
997
1618
|
*
|
|
998
1619
|
* @example
|
|
999
1620
|
* ```typescript
|
|
1000
|
-
* import { z } from 'zod';
|
|
1001
|
-
*
|
|
1002
1621
|
* // Get canvas by ID with schemas
|
|
1003
1622
|
* const canvas = await tela.canvas.get({
|
|
1004
1623
|
* id: 'canvas-id',
|
|
1005
|
-
* input:
|
|
1006
|
-
*
|
|
1624
|
+
* input: schema => schema.object({
|
|
1625
|
+
* query: schema.string()
|
|
1626
|
+
* }),
|
|
1627
|
+
* output: schema => schema.object({
|
|
1628
|
+
* response: schema.string()
|
|
1629
|
+
* })
|
|
1007
1630
|
* });
|
|
1008
1631
|
*
|
|
1009
1632
|
* // Get canvas by application ID
|
|
@@ -1017,7 +1640,7 @@ declare class TelaSDK extends BaseClient {
|
|
|
1017
1640
|
* ```
|
|
1018
1641
|
*/
|
|
1019
1642
|
canvas: {
|
|
1020
|
-
get: <TInput extends z
|
|
1643
|
+
get: <TInput extends z.ZodType | Record<string, unknown> = Record<string, unknown>, TOutput extends z.ZodType | Record<string, unknown> = Record<string, unknown>>(options: CanvasGetOptions<TInput, TOutput>) => Promise<Canvas<TInput, TOutput>>;
|
|
1021
1644
|
};
|
|
1022
1645
|
static TelaSDK: typeof TelaSDK;
|
|
1023
1646
|
static DEFAULT_TIMEOUT: number;
|