@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/dist/index.cjs CHANGED
@@ -3,6 +3,7 @@
3
3
  const changeCase = require('change-case');
4
4
  const minimatch = require('minimatch');
5
5
  const z = require('zod');
6
+ const Emittery = require('emittery');
6
7
 
7
8
  function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e.default : e; }
8
9
 
@@ -20,8 +21,10 @@ function _interopNamespaceCompat(e) {
20
21
 
21
22
  const changeCase__namespace = /*#__PURE__*/_interopNamespaceCompat(changeCase);
22
23
  const z__default = /*#__PURE__*/_interopDefaultCompat(z);
24
+ const z__namespace = /*#__PURE__*/_interopNamespaceCompat(z);
25
+ const Emittery__default = /*#__PURE__*/_interopDefaultCompat(Emittery);
23
26
 
24
- const version = "2.0.0";
27
+ const version = "2.2.0";
25
28
 
26
29
  var __defProp$7 = Object.defineProperty;
27
30
  var __defNormalProp$7 = (obj, key, value) => key in obj ? __defProp$7(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
@@ -1045,14 +1048,6 @@ function TelaFileSchema() {
1045
1048
  return z__default.custom((value) => value instanceof TelaFile, { message: "Value must be an instance of TelaFile" }).meta({ isTelaFile: true });
1046
1049
  }
1047
1050
  class TelaFile {
1048
- /**
1049
- * Creates an instance of `TelaFile`.
1050
- *
1051
- * @param file - The source of the file. Can be a URL string, Uint8Array, ReadableStream, ReadStream, Blob, or File.
1052
- * @param options - Optional configuration options such as byte range.
1053
- * @throws {InvalidFileURL} If the provided URL is not valid.
1054
- * @throws {EmptyFileError} If the provided file is empty.
1055
- */
1056
1051
  constructor(file, options = {}) {
1057
1052
  __publicField$4(this, "_file");
1058
1053
  __publicField$4(this, "_options");
@@ -1430,7 +1425,7 @@ class Poller {
1430
1425
  const resultPromise = async () => {
1431
1426
  try {
1432
1427
  while (!this._abortSignal.aborted) {
1433
- const result = await Promise.try(callback, this._abortSignal);
1428
+ const result = await callback(this._abortSignal);
1434
1429
  if (result.done) {
1435
1430
  return result.value;
1436
1431
  }
@@ -1492,7 +1487,38 @@ function isTelaFile(obj) {
1492
1487
  function isTelaFileArray(obj) {
1493
1488
  return Array.isArray(obj) && obj.length > 0 && obj.every(isTelaFile);
1494
1489
  }
1495
- class CanvasExecution {
1490
+ function isUUID(str) {
1491
+ const uuidRegex = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
1492
+ return uuidRegex.test(str);
1493
+ }
1494
+ function isSyncWorkflowResult(obj) {
1495
+ return "output" in obj;
1496
+ }
1497
+ function isAsyncWorkflowResult(obj) {
1498
+ return "outputContent" in obj && "output" in obj.outputContent;
1499
+ }
1500
+ function isSyncCanvasResult(obj) {
1501
+ return "choices" in obj;
1502
+ }
1503
+ function isAsyncCanvasResult(obj) {
1504
+ return "outputContent" in obj && "content" in obj.outputContent;
1505
+ }
1506
+ function getResultFromPollingResponse(response) {
1507
+ if (isSyncWorkflowResult(response)) {
1508
+ return response.output.output;
1509
+ }
1510
+ if (isAsyncWorkflowResult(response)) {
1511
+ return response.outputContent.output.output;
1512
+ }
1513
+ if (isSyncCanvasResult(response)) {
1514
+ return response.choices?.[0]?.message?.content;
1515
+ }
1516
+ if (isAsyncCanvasResult(response)) {
1517
+ return response.outputContent.content;
1518
+ }
1519
+ throw new Error("Invalid response type");
1520
+ }
1521
+ class CanvasExecution extends Emittery__default {
1496
1522
  /**
1497
1523
  * Creates a new canvas execution instance.
1498
1524
  *
@@ -1502,16 +1528,18 @@ class CanvasExecution {
1502
1528
  * @param client - HTTP client instance for making API requests.
1503
1529
  */
1504
1530
  constructor(variables, params = { async: false }, outputSchema, client) {
1531
+ super();
1505
1532
  __publicField$2(this, "_id");
1533
+ __publicField$2(this, "_status");
1506
1534
  __publicField$2(this, "_variables");
1507
1535
  __publicField$2(this, "_params");
1508
1536
  __publicField$2(this, "_client");
1509
1537
  __publicField$2(this, "_outputSchema");
1510
1538
  __publicField$2(this, "_skipResultValidation");
1511
1539
  __publicField$2(this, "_abortController");
1512
- __publicField$2(this, "_startPropmise");
1513
1540
  __publicField$2(this, "_resultPromise");
1514
1541
  __publicField$2(this, "_stream");
1542
+ __publicField$2(this, "_rawResultValue");
1515
1543
  this._variables = variables;
1516
1544
  this._params = params;
1517
1545
  this._outputSchema = outputSchema;
@@ -1519,18 +1547,138 @@ class CanvasExecution {
1519
1547
  this._client = client;
1520
1548
  this._abortController = new AbortController();
1521
1549
  }
1550
+ /**
1551
+ * Fetches an existing asynchronous execution by its ID.
1552
+ *
1553
+ * This method retrieves the current state of an async execution and creates a new
1554
+ * CanvasExecution instance with the fetched data. Only async executions can be
1555
+ * fetched, as they are the only ones with persistent UUIDs on the server.
1556
+ *
1557
+ * @param id - The UUID of the async execution to fetch.
1558
+ * @param outputSchema - Zod schema or object schema for validating/parsing output.
1559
+ * @param client - HTTP client instance for making API requests.
1560
+ * @param options - Optional configuration for polling behavior.
1561
+ * @param options.pollingInterval - Time in milliseconds between polling attempts (default: 1000).
1562
+ * @param options.pollingTimeout - Maximum time in milliseconds to wait for completion (default: 60000).
1563
+ * @throws {InvalidExecutionModeError} If the provided ID is not a valid UUID.
1564
+ * @returns A promise resolving to a CanvasExecution instance with the fetched state.
1565
+ *
1566
+ * @example
1567
+ * ```typescript
1568
+ * const execution = await CanvasExecution.fetch(
1569
+ * 'execution-uuid',
1570
+ * z.object({ result: z.string() }),
1571
+ * client,
1572
+ * { pollingInterval: 2000, pollingTimeout: 120000 }
1573
+ * )
1574
+ * console.log(execution.status) // 'running' or 'succeeded' or 'failed'
1575
+ * ```
1576
+ */
1577
+ static async fetch(id, outputSchema, client, options) {
1578
+ if (!isUUID(id)) {
1579
+ throw new InvalidExecutionModeError(
1580
+ "Only async executions can be fetched by ID. The provided ID is not a valid UUID."
1581
+ );
1582
+ }
1583
+ const response = await client.get(
1584
+ `/v2/chat/completions/${id}`
1585
+ );
1586
+ const params = {
1587
+ async: true,
1588
+ pollingInterval: options?.pollingInterval,
1589
+ pollingTimeout: options?.pollingTimeout
1590
+ };
1591
+ const execution = new CanvasExecution(
1592
+ {},
1593
+ // No variables needed for fetched execution
1594
+ params,
1595
+ outputSchema,
1596
+ client
1597
+ );
1598
+ execution._id = response.id;
1599
+ execution.status = response.status;
1600
+ if (response.status === "succeeded") {
1601
+ execution._rawResultValue = response;
1602
+ const content = getResultFromPollingResponse(response);
1603
+ try {
1604
+ const validatedContent = execution._skipResultValidation || !(outputSchema instanceof z__default.ZodType) ? content : outputSchema.parse(content);
1605
+ execution._resultPromise = Promise.resolve(validatedContent);
1606
+ } catch (error) {
1607
+ execution._resultPromise = Promise.reject(error);
1608
+ execution._resultPromise.catch(() => {
1609
+ });
1610
+ }
1611
+ } else if (response.status === "failed") {
1612
+ execution._rawResultValue = response;
1613
+ const error = new ExecutionFailedError(response.rawOutput);
1614
+ execution._resultPromise = Promise.reject(error);
1615
+ execution._resultPromise.catch(() => {
1616
+ });
1617
+ }
1618
+ return execution;
1619
+ }
1522
1620
  /**
1523
1621
  * Gets the unique execution ID assigned by the server.
1524
1622
  *
1525
- * @throws {Error} If the execution has not been started yet.
1623
+ * Note: Streaming executions do not have an ID as they don't create a tracked execution on the server.
1624
+ *
1625
+ * @throws {ExecutionNotStartedError} If the execution has not been started yet.
1626
+ * @throws {InvalidExecutionModeError} If called on a streaming execution (streams don't have IDs).
1526
1627
  * @returns The execution ID.
1527
1628
  */
1528
1629
  get id() {
1630
+ if (this.isStream) {
1631
+ throw new InvalidExecutionModeError("Streaming executions do not have an execution ID");
1632
+ }
1529
1633
  if (!this._id) {
1530
1634
  throw new ExecutionNotStartedError();
1531
1635
  }
1532
1636
  return this._id;
1533
1637
  }
1638
+ /**
1639
+ * Gets the latest known status of the execution.
1640
+ *
1641
+ * Status values and transitions:
1642
+ * - **Sync**: `succeeded` (after validation) or `failed` (on any error)
1643
+ * - **Async**: `created` → `running` → `succeeded` or `failed`
1644
+ * - **Stream**: `streaming` (once started)
1645
+ *
1646
+ * **Important:** Status is set to `succeeded` only after successful validation.
1647
+ * If validation fails, status will be `failed` even if the API request succeeded.
1648
+ *
1649
+ * Use the `statusChange` event to track status transitions in real-time.
1650
+ *
1651
+ * @throws {ExecutionNotStartedError} If the execution has not been started yet.
1652
+ * @returns The current status of the execution.
1653
+ *
1654
+ * @example
1655
+ * ```typescript
1656
+ * const execution = await canvas.execute({ query: 'test' }, { async: true })
1657
+ * console.log(execution.status) // 'created'
1658
+ *
1659
+ * await execution.result
1660
+ * console.log(execution.status) // 'succeeded' or 'failed'
1661
+ * ```
1662
+ */
1663
+ get status() {
1664
+ if (!this._status) {
1665
+ throw new ExecutionNotStartedError();
1666
+ }
1667
+ return this._status;
1668
+ }
1669
+ /**
1670
+ * Sets the status of the execution.
1671
+ *
1672
+ * @param status - The new status of the execution.
1673
+ * @private
1674
+ */
1675
+ set status(status) {
1676
+ const changed = this._status !== status;
1677
+ this._status = status;
1678
+ if (changed) {
1679
+ this.emit("statusChange", status);
1680
+ }
1681
+ }
1534
1682
  /**
1535
1683
  * Gets the input variables provided to this execution.
1536
1684
  *
@@ -1571,6 +1719,31 @@ class CanvasExecution {
1571
1719
  get isStream() {
1572
1720
  return Boolean(this._params.stream);
1573
1721
  }
1722
+ /**
1723
+ * Gets the raw API response without any processing or validation.
1724
+ * Automatically starts execution and waits for completion (including polling for async executions).
1725
+ *
1726
+ * For sync executions, returns the complete API response.
1727
+ * For async executions, returns the polling response with status and output.
1728
+ *
1729
+ * @throws {InvalidExecutionModeError} If called on a streaming execution.
1730
+ * @returns A promise resolving to the raw API result.
1731
+ */
1732
+ get rawResult() {
1733
+ if (this.isStream) {
1734
+ throw new InvalidExecutionModeError("rawResult is not available for streaming executions");
1735
+ }
1736
+ if (this.isSync) {
1737
+ if (!this._resultPromise) {
1738
+ throw new ExecutionNotStartedError();
1739
+ }
1740
+ return this._resultPromise.then(() => this._rawResultValue);
1741
+ }
1742
+ if (!this._resultPromise) {
1743
+ this._resultPromise = this.startPolling();
1744
+ }
1745
+ return this._resultPromise.then(() => this._rawResultValue);
1746
+ }
1574
1747
  /**
1575
1748
  * Type guard to check if params indicate async execution.
1576
1749
  *
@@ -1629,18 +1802,88 @@ class CanvasExecution {
1629
1802
  cancel() {
1630
1803
  this._abortController.abort();
1631
1804
  }
1805
+ /**
1806
+ * Starts polling for the execution result without waiting for the promise to resolve.
1807
+ * This allows users to track execution progress via events rather than awaiting a promise.
1808
+ *
1809
+ * The following events will be emitted during polling:
1810
+ * - `statusChange`: Emitted when the execution status changes (e.g., 'created' → 'running' → 'succeeded')
1811
+ * - `poll`: Emitted on each polling attempt with the server response
1812
+ * - `success`: Emitted when the execution completes successfully with the final result
1813
+ * - `error`: Emitted if the execution fails
1814
+ *
1815
+ * **Important:** Events are only emitted while polling is active. You must either call `poll()` or
1816
+ * await `execution.result` to start polling. Simply setting up event listeners without starting
1817
+ * polling will not trigger any events.
1818
+ *
1819
+ * **Note:** If the execution has already completed (succeeded or failed) when fetched, the `success`
1820
+ * and `error` events will not fire since no polling is needed. Check the `status` property and
1821
+ * access the `result` directly for already-completed executions.
1822
+ *
1823
+ * @throws {InvalidExecutionModeError} If called on a non-async execution (sync or stream).
1824
+ * @throws {ExecutionNotStartedError} If the execution has not been started yet (no ID assigned).
1825
+ *
1826
+ * @example
1827
+ * ```typescript
1828
+ * const execution = await canvas.getExecution('execution-id')
1829
+ *
1830
+ * // Check if already completed
1831
+ * if (execution.status === 'succeeded' || execution.status === 'failed') {
1832
+ * // Access result directly - events won't fire
1833
+ * const result = await execution.result
1834
+ * console.log('Already completed:', result)
1835
+ * } else {
1836
+ * // Still running - set up events and start polling
1837
+ * execution.on('statusChange', (status) => {
1838
+ * console.log('Status:', status)
1839
+ * })
1840
+ *
1841
+ * execution.on('success', (result) => {
1842
+ * console.log('Completed:', result)
1843
+ * })
1844
+ *
1845
+ * execution.on('error', (error) => {
1846
+ * console.error('Failed:', error)
1847
+ * })
1848
+ *
1849
+ * // Start polling without waiting
1850
+ * execution.poll()
1851
+ * }
1852
+ * ```
1853
+ */
1854
+ poll() {
1855
+ if (!this.isAsync) {
1856
+ throw new InvalidExecutionModeError("Polling is only supported for async executions");
1857
+ }
1858
+ if (!this._id) {
1859
+ throw new ExecutionNotStartedError();
1860
+ }
1861
+ if (this._resultPromise) {
1862
+ return;
1863
+ }
1864
+ this._resultPromise = this.startPolling();
1865
+ this._resultPromise.catch(() => {
1866
+ });
1867
+ }
1632
1868
  /**
1633
1869
  * Builds the base request body shared across all execution types.
1634
- * Includes messages, overrides, and structured output configuration.
1870
+ * Includes messages, overrides, tags, label, and structured output configuration.
1635
1871
  *
1636
1872
  * @returns The base request body object.
1637
1873
  */
1638
1874
  get baseBody() {
1875
+ if (this._params.label && !this._params.applicationId) {
1876
+ console.warn(
1877
+ '[Tela SDK - WARNING] The "label" field is only applicable when using applicationId. It will be ignored since no applicationId is provided.'
1878
+ );
1879
+ }
1639
1880
  const body = {
1640
1881
  canvasId: this._params.canvasId,
1641
1882
  applicationId: this._params.applicationId,
1642
1883
  versionId: this._params.versionId,
1643
- messages: this._params.messages
1884
+ messages: this._params.messages,
1885
+ tags: this._params.tags,
1886
+ label: this._params.label
1644
1887
  };
1645
1888
  if (this._params.override && this._outputSchema instanceof z__default.ZodType) {
1646
1889
  return {
@@ -1694,12 +1937,20 @@ class CanvasExecution {
1694
1937
  signal: this._abortController.signal
1695
1938
  }).then((response) => {
1696
1939
  this._id = response.id;
1697
- return response.choices?.[0]?.message?.content;
1940
+ this._rawResultValue = response;
1941
+ return getResultFromPollingResponse(response);
1698
1942
  }).then((content) => {
1699
- if (this._skipResultValidation || !(this._outputSchema instanceof z__default.ZodType)) {
1700
- return content;
1943
+ const validatedContent = this._skipResultValidation || !(this._outputSchema instanceof z__default.ZodType) ? content : this._outputSchema.parse(content);
1944
+ this.status = "succeeded";
1945
+ this.emit("success", validatedContent);
1946
+ return validatedContent;
1947
+ }).catch((error) => {
1948
+ this.status = "failed";
1949
+ if (this.listenerCount("error") > 0) {
1950
+ this.emit("error", error);
1951
+ return;
1701
1952
  }
1702
- return this._outputSchema.parse(content);
1953
+ throw error;
1703
1954
  });
1704
1955
  return this._resultPromise;
1705
1956
  }
@@ -1723,6 +1974,13 @@ class CanvasExecution {
1723
1974
  signal: this._abortController.signal
1724
1975
  }).then((response) => {
1725
1976
  this._id = response.id;
1977
+ this.status = response.status;
1978
+ this.emit("poll", {
1979
+ id: response.id,
1980
+ status: response.status,
1981
+ outputContent: response.output_content,
1982
+ rawOutput: response.raw_output
1983
+ });
1726
1984
  return response;
1727
1985
  });
1728
1986
  }
@@ -1743,6 +2001,7 @@ class CanvasExecution {
1743
2001
  stream: true,
1744
2002
  signal: this._abortController.signal
1745
2003
  });
2004
+ this.status = "streaming";
1746
2005
  return this._stream;
1747
2006
  }
1748
2007
  /**
@@ -1771,8 +2030,12 @@ class CanvasExecution {
1771
2030
  signal
1772
2031
  }
1773
2032
  );
2033
+ this.status = response.status;
2034
+ this.emit("poll", response);
1774
2035
  if (response.status === "failed") {
1775
- throw new ExecutionFailedError(response.rawOutput);
2036
+ const error = new ExecutionFailedError(response.rawOutput);
2037
+ this.emit("error", error);
2038
+ throw error;
1776
2039
  }
1777
2040
  if (response.status !== "succeeded") {
1778
2041
  return {
@@ -1780,15 +2043,28 @@ class CanvasExecution {
1780
2043
  value: void 0
1781
2044
  };
1782
2045
  }
2046
+ this._rawResultValue = response;
2047
+ this.emit("success", getResultFromPollingResponse(response));
1783
2048
  return {
1784
2049
  done: response.status === "succeeded",
1785
- value: response.outputContent.content
2050
+ value: getResultFromPollingResponse(response)
1786
2051
  };
1787
2052
  }).then((value) => {
1788
2053
  if (this._skipResultValidation || !(this._outputSchema instanceof z__default.ZodType)) {
1789
2054
  return value;
1790
2055
  }
1791
2056
  return this._outputSchema.parse(value);
2057
+ }).catch((error) => {
2058
+ if (this._status !== "failed") {
2059
+ this.status = "failed";
2060
+ }
2061
+ if (this.listenerCount("error") > 0) {
2062
+ if (!(error instanceof ExecutionFailedError)) {
2063
+ this.emit("error", error);
2064
+ }
2065
+ return;
2066
+ }
2067
+ throw error;
1792
2068
  });
1793
2069
  }
1794
2070
  /**
@@ -1881,14 +2157,8 @@ var __publicField$1 = (obj, key, value) => {
1881
2157
  return value;
1882
2158
  };
1883
2159
  const zod = {
1884
- string: z.string,
1885
- number: z.number,
1886
- boolean: z.boolean,
1887
- object: z.object,
1888
- array: z.array,
1889
- file: TelaFileSchema,
1890
- any: z.any,
1891
- unknown: z.unknown
2160
+ ...z__namespace,
2161
+ file: TelaFileSchema
1892
2162
  };
1893
2163
  function fetchById(id, client) {
1894
2164
  return client.get(`/prompt/${id}/promoted-version`);
@@ -1968,7 +2238,7 @@ class Canvas {
1968
2238
  *
1969
2239
  * @private
1970
2240
  */
1971
- constructor({ id, applicationId, name, versionId, input, output, client, variables }) {
2241
+ constructor({ id, applicationId, name, versionId, input, output, client, variables, isWorkflow }) {
1972
2242
  __publicField$1(this, "_id");
1973
2243
  __publicField$1(this, "_versionId");
1974
2244
  __publicField$1(this, "_applicationId");
@@ -1977,6 +2247,7 @@ class Canvas {
1977
2247
  __publicField$1(this, "_output");
1978
2248
  __publicField$1(this, "_client");
1979
2249
  __publicField$1(this, "_variables");
2250
+ __publicField$1(this, "_isWorkflow");
1980
2251
  this._id = id;
1981
2252
  this._applicationId = applicationId;
1982
2253
  this._name = name;
@@ -1985,6 +2256,7 @@ class Canvas {
1985
2256
  this._output = output && output(zod);
1986
2257
  this._client = client;
1987
2258
  this._variables = variables;
2259
+ this._isWorkflow = isWorkflow;
1988
2260
  }
1989
2261
  /**
1990
2262
  * Gets a canvas by its ID.
@@ -2013,7 +2285,8 @@ class Canvas {
2013
2285
  input,
2014
2286
  output,
2015
2287
  client,
2016
- variables: promptVersion.variables
2288
+ variables: promptVersion.variables,
2289
+ isWorkflow: promptVersion.isWorkflow
2017
2290
  });
2018
2291
  }
2019
2292
  /**
@@ -2064,6 +2337,14 @@ class Canvas {
2064
2337
  get variables() {
2065
2338
  return this._variables;
2066
2339
  }
2340
+ /**
2341
+ * Gets whether this canvas is a workflow.
2342
+ *
2343
+ * @returns True if the canvas is a workflow.
2344
+ */
2345
+ get isWorkflow() {
2346
+ return this._isWorkflow;
2347
+ }
2067
2348
  /**
2068
2349
  * Validates and parses input variables using the canvas input schema.
2069
2350
  *
@@ -2102,6 +2383,43 @@ class Canvas {
2102
2383
  }
2103
2384
  };
2104
2385
  }
2386
+ /**
2387
+ * Fetches an existing async execution by its ID.
2388
+ *
2389
+ * This method retrieves the current state of an async execution that was previously
2390
+ * started on this canvas. Only async executions can be fetched, as they are the only
2391
+ * ones with persistent UUIDs on the server.
2392
+ *
2393
+ * @param id - The UUID of the async execution to fetch.
2394
+ * @param options - Optional configuration for polling behavior.
2395
+ * @param options.pollingInterval - Time in milliseconds between polling attempts (default: 1000).
2396
+ * @param options.pollingTimeout - Maximum time in milliseconds to wait for completion (default: 60000).
2397
+ * @throws {InvalidExecutionModeError} If the provided ID is not a valid UUID.
2398
+ * @returns A promise resolving to a CanvasExecution instance with the fetched state.
2399
+ *
2400
+ * @example
2401
+ * ```typescript
2402
+ * // Start an async execution
2403
+ * const execution = await canvas.execute({ query: 'test' }, { async: true })
2404
+ * const executionId = execution.id
2405
+ *
2406
+ * // Later, fetch the execution by ID
2407
+ * const fetched = await canvas.getExecution(executionId)
2408
+ * console.log(fetched.status) // 'running', 'succeeded', or 'failed'
2409
+ *
2410
+ * // Use poll() for event-driven progress tracking
2411
+ * fetched.on('statusChange', (status) => console.log('Status:', status))
2412
+ * fetched.poll()
2413
+ * ```
2414
+ */
2415
+ async getExecution(id, options) {
2416
+ return CanvasExecution.fetch(
2417
+ id,
2418
+ this._output,
2419
+ this._client,
2420
+ options
2421
+ );
2422
+ }
2105
2423
  }
2106
2424
 
2107
2425
  var __defProp = Object.defineProperty;
@@ -2129,20 +2447,22 @@ const _TelaSDK = class _TelaSDK extends BaseClient {
2129
2447
  __publicField(this, "createFile", TelaFile.create.bind(this));
2130
2448
  /**
2131
2449
  * Retrieves a canvas by its ID, version ID, or application ID.
2132
- * Validates input and output schemas if Zod schemas are provided.
2450
+ * Validates input and output schemas if provided via schema builder functions.
2133
2451
  *
2134
2452
  * @param options - Options for retrieving the canvas.
2135
2453
  * @returns A promise resolving to a Canvas instance.
2136
2454
  *
2137
2455
  * @example
2138
2456
  * ```typescript
2139
- * import { z } from 'zod';
2140
- *
2141
2457
  * // Get canvas by ID with schemas
2142
2458
  * const canvas = await tela.canvas.get({
2143
2459
  * id: 'canvas-id',
2144
- * input: z.object({ query: z.string() }),
2145
- * output: z.object({ response: z.string() })
2460
+ * input: schema => schema.object({
2461
+ * query: schema.string()
2462
+ * }),
2463
+ * output: schema => schema.object({
2464
+ * response: schema.string()
2465
+ * })
2146
2466
  * });
2147
2467
  *
2148
2468
  * // Get canvas by application ID