@trigger.dev/sdk 2.0.0-next.7 → 2.0.0-next.8

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.d.ts CHANGED
@@ -1475,13 +1475,44 @@ declare const RedactStringSchema: z.ZodObject<{
1475
1475
  type RedactString = z.infer<typeof RedactStringSchema>;
1476
1476
  type CachedTask = z.infer<typeof CachedTaskSchema>;
1477
1477
  declare const RunTaskOptionsSchema: z.ZodObject<{
1478
+ /** The name of the Task is required. This is displayed on the Task in the logs. */
1478
1479
  name: z.ZodString;
1480
+ /** The Task will wait and only start at the specified Date */
1481
+ delayUntil: z.ZodOptional<z.ZodDate>;
1482
+ /** Retry options */
1483
+ retry: z.ZodOptional<z.ZodObject<{
1484
+ /** The maximum number of times to retry the request. */
1485
+ limit: z.ZodOptional<z.ZodNumber>;
1486
+ /** The exponential factor to use when calculating the next retry time. */
1487
+ factor: z.ZodOptional<z.ZodNumber>;
1488
+ /** The minimum amount of time to wait before retrying the request. */
1489
+ minTimeoutInMs: z.ZodOptional<z.ZodNumber>;
1490
+ /** The maximum amount of time to wait before retrying the request. */
1491
+ maxTimeoutInMs: z.ZodOptional<z.ZodNumber>;
1492
+ /** Whether to randomize the retry time. */
1493
+ randomize: z.ZodOptional<z.ZodBoolean>;
1494
+ }, "strip", z.ZodTypeAny, {
1495
+ limit?: number | undefined;
1496
+ factor?: number | undefined;
1497
+ minTimeoutInMs?: number | undefined;
1498
+ maxTimeoutInMs?: number | undefined;
1499
+ randomize?: boolean | undefined;
1500
+ }, {
1501
+ limit?: number | undefined;
1502
+ factor?: number | undefined;
1503
+ minTimeoutInMs?: number | undefined;
1504
+ maxTimeoutInMs?: number | undefined;
1505
+ randomize?: boolean | undefined;
1506
+ }>>;
1507
+ /** The icon for the Task, it will appear in the logs.
1508
+ * You can use the name of a company in lowercase, e.g. "github".
1509
+ * Or any icon name that [Font Awesome](https://fontawesome.com/icons) supports. */
1479
1510
  icon: z.ZodOptional<z.ZodString>;
1511
+ /** The key for the Task that you want to appear in the logs */
1480
1512
  displayKey: z.ZodOptional<z.ZodString>;
1481
- noop: z.ZodDefault<z.ZodBoolean>;
1482
- operation: z.ZodOptional<z.ZodEnum<["fetch"]>>;
1483
- delayUntil: z.ZodOptional<z.ZodDate>;
1513
+ /** A description of the Task */
1484
1514
  description: z.ZodOptional<z.ZodString>;
1515
+ /** Properties that are displayed in the logs */
1485
1516
  properties: z.ZodOptional<z.ZodArray<z.ZodObject<{
1486
1517
  label: z.ZodString;
1487
1518
  text: z.ZodString;
@@ -1495,7 +1526,32 @@ declare const RunTaskOptionsSchema: z.ZodObject<{
1495
1526
  label: string;
1496
1527
  text: string;
1497
1528
  }>, "many">>;
1529
+ /** The input params to the Task, will be displayed in the logs */
1498
1530
  params: z.ZodAny;
1531
+ /** The style of the log entry. */
1532
+ style: z.ZodOptional<z.ZodObject<{
1533
+ style: z.ZodEnum<["normal", "minimal"]>;
1534
+ variant: z.ZodOptional<z.ZodString>;
1535
+ }, "strip", z.ZodTypeAny, {
1536
+ variant?: string | undefined;
1537
+ style: "normal" | "minimal";
1538
+ }, {
1539
+ variant?: string | undefined;
1540
+ style: "normal" | "minimal";
1541
+ }>>;
1542
+ /** Allows you to link the Integration connection in the logs. This is handled automatically in integrations. */
1543
+ connectionKey: z.ZodOptional<z.ZodString>;
1544
+ /** An operation you want to perform on the Trigger.dev platform, current only "fetch" is supported. If you wish to `fetch` use [`io.backgroundFetch()`](https://trigger.dev/docs/sdk/io/backgroundfetch) instead. */
1545
+ operation: z.ZodOptional<z.ZodEnum<["fetch"]>>;
1546
+ /** A No Operation means that the code won't be executed. This is used internally to implement features like [io.wait()](https://trigger.dev/docs/sdk/io/wait). */
1547
+ noop: z.ZodDefault<z.ZodBoolean>;
1548
+ redact: z.ZodOptional<z.ZodObject<{
1549
+ paths: z.ZodArray<z.ZodString, "many">;
1550
+ }, "strip", z.ZodTypeAny, {
1551
+ paths: string[];
1552
+ }, {
1553
+ paths: string[];
1554
+ }>>;
1499
1555
  trigger: z.ZodOptional<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
1500
1556
  type: z.ZodLiteral<"dynamic">;
1501
1557
  id: z.ZodString;
@@ -1643,48 +1699,6 @@ declare const RunTaskOptionsSchema: z.ZodObject<{
1643
1699
  type: "interval";
1644
1700
  };
1645
1701
  }>]>>;
1646
- redact: z.ZodOptional<z.ZodObject<{
1647
- paths: z.ZodArray<z.ZodString, "many">;
1648
- }, "strip", z.ZodTypeAny, {
1649
- paths: string[];
1650
- }, {
1651
- paths: string[];
1652
- }>>;
1653
- connectionKey: z.ZodOptional<z.ZodString>;
1654
- style: z.ZodOptional<z.ZodObject<{
1655
- style: z.ZodEnum<["normal", "minimal"]>;
1656
- variant: z.ZodOptional<z.ZodString>;
1657
- }, "strip", z.ZodTypeAny, {
1658
- variant?: string | undefined;
1659
- style: "normal" | "minimal";
1660
- }, {
1661
- variant?: string | undefined;
1662
- style: "normal" | "minimal";
1663
- }>>;
1664
- retry: z.ZodOptional<z.ZodObject<{
1665
- /** The maximum number of times to retry the request. */
1666
- limit: z.ZodOptional<z.ZodNumber>;
1667
- /** The exponential factor to use when calculating the next retry time. */
1668
- factor: z.ZodOptional<z.ZodNumber>;
1669
- /** The minimum amount of time to wait before retrying the request. */
1670
- minTimeoutInMs: z.ZodOptional<z.ZodNumber>;
1671
- /** The maximum amount of time to wait before retrying the request. */
1672
- maxTimeoutInMs: z.ZodOptional<z.ZodNumber>;
1673
- /** Whether to randomize the retry time. */
1674
- randomize: z.ZodOptional<z.ZodBoolean>;
1675
- }, "strip", z.ZodTypeAny, {
1676
- limit?: number | undefined;
1677
- factor?: number | undefined;
1678
- minTimeoutInMs?: number | undefined;
1679
- maxTimeoutInMs?: number | undefined;
1680
- randomize?: boolean | undefined;
1681
- }, {
1682
- limit?: number | undefined;
1683
- factor?: number | undefined;
1684
- minTimeoutInMs?: number | undefined;
1685
- maxTimeoutInMs?: number | undefined;
1686
- randomize?: boolean | undefined;
1687
- }>>;
1688
1702
  }, "strip", z.ZodTypeAny, {
1689
1703
  icon?: string | undefined;
1690
1704
  delayUntil?: Date | undefined;
@@ -1733,11 +1747,6 @@ declare const RunTaskOptionsSchema: z.ZodObject<{
1733
1747
  type: "interval";
1734
1748
  };
1735
1749
  } | undefined;
1736
- displayKey?: string | undefined;
1737
- redact?: {
1738
- paths: string[];
1739
- } | undefined;
1740
- connectionKey?: string | undefined;
1741
1750
  retry?: {
1742
1751
  limit?: number | undefined;
1743
1752
  factor?: number | undefined;
@@ -1745,6 +1754,11 @@ declare const RunTaskOptionsSchema: z.ZodObject<{
1745
1754
  maxTimeoutInMs?: number | undefined;
1746
1755
  randomize?: boolean | undefined;
1747
1756
  } | undefined;
1757
+ displayKey?: string | undefined;
1758
+ connectionKey?: string | undefined;
1759
+ redact?: {
1760
+ paths: string[];
1761
+ } | undefined;
1748
1762
  name: string;
1749
1763
  noop: boolean;
1750
1764
  }, {
@@ -1796,11 +1810,6 @@ declare const RunTaskOptionsSchema: z.ZodObject<{
1796
1810
  type: "interval";
1797
1811
  };
1798
1812
  } | undefined;
1799
- displayKey?: string | undefined;
1800
- redact?: {
1801
- paths: string[];
1802
- } | undefined;
1803
- connectionKey?: string | undefined;
1804
1813
  retry?: {
1805
1814
  limit?: number | undefined;
1806
1815
  factor?: number | undefined;
@@ -1808,17 +1817,53 @@ declare const RunTaskOptionsSchema: z.ZodObject<{
1808
1817
  maxTimeoutInMs?: number | undefined;
1809
1818
  randomize?: boolean | undefined;
1810
1819
  } | undefined;
1820
+ displayKey?: string | undefined;
1821
+ connectionKey?: string | undefined;
1822
+ redact?: {
1823
+ paths: string[];
1824
+ } | undefined;
1811
1825
  name: string;
1812
1826
  }>;
1813
1827
  type RunTaskOptions = z.input<typeof RunTaskOptionsSchema>;
1814
1828
  declare const RunTaskBodyInputSchema: z.ZodObject<z.extendShape<{
1829
+ /** The name of the Task is required. This is displayed on the Task in the logs. */
1815
1830
  name: z.ZodString;
1831
+ /** The Task will wait and only start at the specified Date */
1832
+ delayUntil: z.ZodOptional<z.ZodDate>;
1833
+ /** Retry options */
1834
+ retry: z.ZodOptional<z.ZodObject<{
1835
+ /** The maximum number of times to retry the request. */
1836
+ limit: z.ZodOptional<z.ZodNumber>;
1837
+ /** The exponential factor to use when calculating the next retry time. */
1838
+ factor: z.ZodOptional<z.ZodNumber>;
1839
+ /** The minimum amount of time to wait before retrying the request. */
1840
+ minTimeoutInMs: z.ZodOptional<z.ZodNumber>;
1841
+ /** The maximum amount of time to wait before retrying the request. */
1842
+ maxTimeoutInMs: z.ZodOptional<z.ZodNumber>;
1843
+ /** Whether to randomize the retry time. */
1844
+ randomize: z.ZodOptional<z.ZodBoolean>;
1845
+ }, "strip", z.ZodTypeAny, {
1846
+ limit?: number | undefined;
1847
+ factor?: number | undefined;
1848
+ minTimeoutInMs?: number | undefined;
1849
+ maxTimeoutInMs?: number | undefined;
1850
+ randomize?: boolean | undefined;
1851
+ }, {
1852
+ limit?: number | undefined;
1853
+ factor?: number | undefined;
1854
+ minTimeoutInMs?: number | undefined;
1855
+ maxTimeoutInMs?: number | undefined;
1856
+ randomize?: boolean | undefined;
1857
+ }>>;
1858
+ /** The icon for the Task, it will appear in the logs.
1859
+ * You can use the name of a company in lowercase, e.g. "github".
1860
+ * Or any icon name that [Font Awesome](https://fontawesome.com/icons) supports. */
1816
1861
  icon: z.ZodOptional<z.ZodString>;
1862
+ /** The key for the Task that you want to appear in the logs */
1817
1863
  displayKey: z.ZodOptional<z.ZodString>;
1818
- noop: z.ZodDefault<z.ZodBoolean>;
1819
- operation: z.ZodOptional<z.ZodEnum<["fetch"]>>;
1820
- delayUntil: z.ZodOptional<z.ZodDate>;
1864
+ /** A description of the Task */
1821
1865
  description: z.ZodOptional<z.ZodString>;
1866
+ /** Properties that are displayed in the logs */
1822
1867
  properties: z.ZodOptional<z.ZodArray<z.ZodObject<{
1823
1868
  label: z.ZodString;
1824
1869
  text: z.ZodString;
@@ -1832,7 +1877,32 @@ declare const RunTaskBodyInputSchema: z.ZodObject<z.extendShape<{
1832
1877
  label: string;
1833
1878
  text: string;
1834
1879
  }>, "many">>;
1880
+ /** The input params to the Task, will be displayed in the logs */
1835
1881
  params: z.ZodAny;
1882
+ /** The style of the log entry. */
1883
+ style: z.ZodOptional<z.ZodObject<{
1884
+ style: z.ZodEnum<["normal", "minimal"]>;
1885
+ variant: z.ZodOptional<z.ZodString>;
1886
+ }, "strip", z.ZodTypeAny, {
1887
+ variant?: string | undefined;
1888
+ style: "normal" | "minimal";
1889
+ }, {
1890
+ variant?: string | undefined;
1891
+ style: "normal" | "minimal";
1892
+ }>>;
1893
+ /** Allows you to link the Integration connection in the logs. This is handled automatically in integrations. */
1894
+ connectionKey: z.ZodOptional<z.ZodString>;
1895
+ /** An operation you want to perform on the Trigger.dev platform, current only "fetch" is supported. If you wish to `fetch` use [`io.backgroundFetch()`](https://trigger.dev/docs/sdk/io/backgroundfetch) instead. */
1896
+ operation: z.ZodOptional<z.ZodEnum<["fetch"]>>;
1897
+ /** A No Operation means that the code won't be executed. This is used internally to implement features like [io.wait()](https://trigger.dev/docs/sdk/io/wait). */
1898
+ noop: z.ZodDefault<z.ZodBoolean>;
1899
+ redact: z.ZodOptional<z.ZodObject<{
1900
+ paths: z.ZodArray<z.ZodString, "many">;
1901
+ }, "strip", z.ZodTypeAny, {
1902
+ paths: string[];
1903
+ }, {
1904
+ paths: string[];
1905
+ }>>;
1836
1906
  trigger: z.ZodOptional<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
1837
1907
  type: z.ZodLiteral<"dynamic">;
1838
1908
  id: z.ZodString;
@@ -1980,48 +2050,6 @@ declare const RunTaskBodyInputSchema: z.ZodObject<z.extendShape<{
1980
2050
  type: "interval";
1981
2051
  };
1982
2052
  }>]>>;
1983
- redact: z.ZodOptional<z.ZodObject<{
1984
- paths: z.ZodArray<z.ZodString, "many">;
1985
- }, "strip", z.ZodTypeAny, {
1986
- paths: string[];
1987
- }, {
1988
- paths: string[];
1989
- }>>;
1990
- connectionKey: z.ZodOptional<z.ZodString>;
1991
- style: z.ZodOptional<z.ZodObject<{
1992
- style: z.ZodEnum<["normal", "minimal"]>;
1993
- variant: z.ZodOptional<z.ZodString>;
1994
- }, "strip", z.ZodTypeAny, {
1995
- variant?: string | undefined;
1996
- style: "normal" | "minimal";
1997
- }, {
1998
- variant?: string | undefined;
1999
- style: "normal" | "minimal";
2000
- }>>;
2001
- retry: z.ZodOptional<z.ZodObject<{
2002
- /** The maximum number of times to retry the request. */
2003
- limit: z.ZodOptional<z.ZodNumber>;
2004
- /** The exponential factor to use when calculating the next retry time. */
2005
- factor: z.ZodOptional<z.ZodNumber>;
2006
- /** The minimum amount of time to wait before retrying the request. */
2007
- minTimeoutInMs: z.ZodOptional<z.ZodNumber>;
2008
- /** The maximum amount of time to wait before retrying the request. */
2009
- maxTimeoutInMs: z.ZodOptional<z.ZodNumber>;
2010
- /** Whether to randomize the retry time. */
2011
- randomize: z.ZodOptional<z.ZodBoolean>;
2012
- }, "strip", z.ZodTypeAny, {
2013
- limit?: number | undefined;
2014
- factor?: number | undefined;
2015
- minTimeoutInMs?: number | undefined;
2016
- maxTimeoutInMs?: number | undefined;
2017
- randomize?: boolean | undefined;
2018
- }, {
2019
- limit?: number | undefined;
2020
- factor?: number | undefined;
2021
- minTimeoutInMs?: number | undefined;
2022
- maxTimeoutInMs?: number | undefined;
2023
- randomize?: boolean | undefined;
2024
- }>>;
2025
2053
  }, {
2026
2054
  idempotencyKey: z.ZodString;
2027
2055
  parentId: z.ZodOptional<z.ZodString>;
@@ -2074,11 +2102,6 @@ declare const RunTaskBodyInputSchema: z.ZodObject<z.extendShape<{
2074
2102
  type: "interval";
2075
2103
  };
2076
2104
  } | undefined;
2077
- displayKey?: string | undefined;
2078
- redact?: {
2079
- paths: string[];
2080
- } | undefined;
2081
- connectionKey?: string | undefined;
2082
2105
  retry?: {
2083
2106
  limit?: number | undefined;
2084
2107
  factor?: number | undefined;
@@ -2086,6 +2109,11 @@ declare const RunTaskBodyInputSchema: z.ZodObject<z.extendShape<{
2086
2109
  maxTimeoutInMs?: number | undefined;
2087
2110
  randomize?: boolean | undefined;
2088
2111
  } | undefined;
2112
+ displayKey?: string | undefined;
2113
+ connectionKey?: string | undefined;
2114
+ redact?: {
2115
+ paths: string[];
2116
+ } | undefined;
2089
2117
  name: string;
2090
2118
  noop: boolean;
2091
2119
  idempotencyKey: string;
@@ -2139,11 +2167,6 @@ declare const RunTaskBodyInputSchema: z.ZodObject<z.extendShape<{
2139
2167
  type: "interval";
2140
2168
  };
2141
2169
  } | undefined;
2142
- displayKey?: string | undefined;
2143
- redact?: {
2144
- paths: string[];
2145
- } | undefined;
2146
- connectionKey?: string | undefined;
2147
2170
  retry?: {
2148
2171
  limit?: number | undefined;
2149
2172
  factor?: number | undefined;
@@ -2151,18 +2174,54 @@ declare const RunTaskBodyInputSchema: z.ZodObject<z.extendShape<{
2151
2174
  maxTimeoutInMs?: number | undefined;
2152
2175
  randomize?: boolean | undefined;
2153
2176
  } | undefined;
2177
+ displayKey?: string | undefined;
2178
+ connectionKey?: string | undefined;
2179
+ redact?: {
2180
+ paths: string[];
2181
+ } | undefined;
2154
2182
  name: string;
2155
2183
  idempotencyKey: string;
2156
2184
  }>;
2157
2185
  type RunTaskBodyInput = z.infer<typeof RunTaskBodyInputSchema>;
2158
2186
  declare const CompleteTaskBodyInputSchema: z.ZodObject<z.extendShape<Pick<z.extendShape<{
2187
+ /** The name of the Task is required. This is displayed on the Task in the logs. */
2159
2188
  name: z.ZodString;
2189
+ /** The Task will wait and only start at the specified Date */
2190
+ delayUntil: z.ZodOptional<z.ZodDate>;
2191
+ /** Retry options */
2192
+ retry: z.ZodOptional<z.ZodObject<{
2193
+ /** The maximum number of times to retry the request. */
2194
+ limit: z.ZodOptional<z.ZodNumber>;
2195
+ /** The exponential factor to use when calculating the next retry time. */
2196
+ factor: z.ZodOptional<z.ZodNumber>;
2197
+ /** The minimum amount of time to wait before retrying the request. */
2198
+ minTimeoutInMs: z.ZodOptional<z.ZodNumber>;
2199
+ /** The maximum amount of time to wait before retrying the request. */
2200
+ maxTimeoutInMs: z.ZodOptional<z.ZodNumber>;
2201
+ /** Whether to randomize the retry time. */
2202
+ randomize: z.ZodOptional<z.ZodBoolean>;
2203
+ }, "strip", z.ZodTypeAny, {
2204
+ limit?: number | undefined;
2205
+ factor?: number | undefined;
2206
+ minTimeoutInMs?: number | undefined;
2207
+ maxTimeoutInMs?: number | undefined;
2208
+ randomize?: boolean | undefined;
2209
+ }, {
2210
+ limit?: number | undefined;
2211
+ factor?: number | undefined;
2212
+ minTimeoutInMs?: number | undefined;
2213
+ maxTimeoutInMs?: number | undefined;
2214
+ randomize?: boolean | undefined;
2215
+ }>>;
2216
+ /** The icon for the Task, it will appear in the logs.
2217
+ * You can use the name of a company in lowercase, e.g. "github".
2218
+ * Or any icon name that [Font Awesome](https://fontawesome.com/icons) supports. */
2160
2219
  icon: z.ZodOptional<z.ZodString>;
2220
+ /** The key for the Task that you want to appear in the logs */
2161
2221
  displayKey: z.ZodOptional<z.ZodString>;
2162
- noop: z.ZodDefault<z.ZodBoolean>;
2163
- operation: z.ZodOptional<z.ZodEnum<["fetch"]>>;
2164
- delayUntil: z.ZodOptional<z.ZodDate>;
2222
+ /** A description of the Task */
2165
2223
  description: z.ZodOptional<z.ZodString>;
2224
+ /** Properties that are displayed in the logs */
2166
2225
  properties: z.ZodOptional<z.ZodArray<z.ZodObject<{
2167
2226
  label: z.ZodString;
2168
2227
  text: z.ZodString;
@@ -2176,7 +2235,32 @@ declare const CompleteTaskBodyInputSchema: z.ZodObject<z.extendShape<Pick<z.exte
2176
2235
  label: string;
2177
2236
  text: string;
2178
2237
  }>, "many">>;
2238
+ /** The input params to the Task, will be displayed in the logs */
2179
2239
  params: z.ZodAny;
2240
+ /** The style of the log entry. */
2241
+ style: z.ZodOptional<z.ZodObject<{
2242
+ style: z.ZodEnum<["normal", "minimal"]>;
2243
+ variant: z.ZodOptional<z.ZodString>;
2244
+ }, "strip", z.ZodTypeAny, {
2245
+ variant?: string | undefined;
2246
+ style: "normal" | "minimal";
2247
+ }, {
2248
+ variant?: string | undefined;
2249
+ style: "normal" | "minimal";
2250
+ }>>;
2251
+ /** Allows you to link the Integration connection in the logs. This is handled automatically in integrations. */
2252
+ connectionKey: z.ZodOptional<z.ZodString>;
2253
+ /** An operation you want to perform on the Trigger.dev platform, current only "fetch" is supported. If you wish to `fetch` use [`io.backgroundFetch()`](https://trigger.dev/docs/sdk/io/backgroundfetch) instead. */
2254
+ operation: z.ZodOptional<z.ZodEnum<["fetch"]>>;
2255
+ /** A No Operation means that the code won't be executed. This is used internally to implement features like [io.wait()](https://trigger.dev/docs/sdk/io/wait). */
2256
+ noop: z.ZodDefault<z.ZodBoolean>;
2257
+ redact: z.ZodOptional<z.ZodObject<{
2258
+ paths: z.ZodArray<z.ZodString, "many">;
2259
+ }, "strip", z.ZodTypeAny, {
2260
+ paths: string[];
2261
+ }, {
2262
+ paths: string[];
2263
+ }>>;
2180
2264
  trigger: z.ZodOptional<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
2181
2265
  type: z.ZodLiteral<"dynamic">;
2182
2266
  id: z.ZodString;
@@ -2324,48 +2408,6 @@ declare const CompleteTaskBodyInputSchema: z.ZodObject<z.extendShape<Pick<z.exte
2324
2408
  type: "interval";
2325
2409
  };
2326
2410
  }>]>>;
2327
- redact: z.ZodOptional<z.ZodObject<{
2328
- paths: z.ZodArray<z.ZodString, "many">;
2329
- }, "strip", z.ZodTypeAny, {
2330
- paths: string[];
2331
- }, {
2332
- paths: string[];
2333
- }>>;
2334
- connectionKey: z.ZodOptional<z.ZodString>;
2335
- style: z.ZodOptional<z.ZodObject<{
2336
- style: z.ZodEnum<["normal", "minimal"]>;
2337
- variant: z.ZodOptional<z.ZodString>;
2338
- }, "strip", z.ZodTypeAny, {
2339
- variant?: string | undefined;
2340
- style: "normal" | "minimal";
2341
- }, {
2342
- variant?: string | undefined;
2343
- style: "normal" | "minimal";
2344
- }>>;
2345
- retry: z.ZodOptional<z.ZodObject<{
2346
- /** The maximum number of times to retry the request. */
2347
- limit: z.ZodOptional<z.ZodNumber>;
2348
- /** The exponential factor to use when calculating the next retry time. */
2349
- factor: z.ZodOptional<z.ZodNumber>;
2350
- /** The minimum amount of time to wait before retrying the request. */
2351
- minTimeoutInMs: z.ZodOptional<z.ZodNumber>;
2352
- /** The maximum amount of time to wait before retrying the request. */
2353
- maxTimeoutInMs: z.ZodOptional<z.ZodNumber>;
2354
- /** Whether to randomize the retry time. */
2355
- randomize: z.ZodOptional<z.ZodBoolean>;
2356
- }, "strip", z.ZodTypeAny, {
2357
- limit?: number | undefined;
2358
- factor?: number | undefined;
2359
- minTimeoutInMs?: number | undefined;
2360
- maxTimeoutInMs?: number | undefined;
2361
- randomize?: boolean | undefined;
2362
- }, {
2363
- limit?: number | undefined;
2364
- factor?: number | undefined;
2365
- minTimeoutInMs?: number | undefined;
2366
- maxTimeoutInMs?: number | undefined;
2367
- randomize?: boolean | undefined;
2368
- }>>;
2369
2411
  }, {
2370
2412
  idempotencyKey: z.ZodString;
2371
2413
  parentId: z.ZodOptional<z.ZodString>;
@@ -2752,9 +2794,13 @@ declare const ErrorWithStackSchema: z.ZodObject<{
2752
2794
  }>;
2753
2795
  type ErrorWithStack = z.infer<typeof ErrorWithStackSchema>;
2754
2796
 
2797
+ /** A property that is displayed in the logs */
2755
2798
  declare const DisplayPropertySchema: z.ZodObject<{
2799
+ /** The label for the property */
2756
2800
  label: z.ZodString;
2801
+ /** The value of the property */
2757
2802
  text: z.ZodString;
2803
+ /** The URL to link to when the property is clicked */
2758
2804
  url: z.ZodOptional<z.ZodString>;
2759
2805
  }, "strip", z.ZodTypeAny, {
2760
2806
  url?: string | undefined;
@@ -2845,14 +2891,19 @@ declare const ScheduledPayloadSchema: z.ZodObject<{
2845
2891
  }>;
2846
2892
  type ScheduledPayload = z.infer<typeof ScheduledPayloadSchema>;
2847
2893
  declare const IntervalOptionsSchema: z.ZodObject<{
2894
+ /** The number of seconds for the interval. Min = 60, Max = 86400 (1 day) */
2848
2895
  seconds: z.ZodNumber;
2849
2896
  }, "strip", z.ZodTypeAny, {
2850
2897
  seconds: number;
2851
2898
  }, {
2852
2899
  seconds: number;
2853
2900
  }>;
2901
+ /** Interval options */
2854
2902
  type IntervalOptions = z.infer<typeof IntervalOptionsSchema>;
2855
2903
  declare const CronOptionsSchema: z.ZodObject<{
2904
+ /** A CRON expression that defines the schedule. A useful tool when writing CRON
2905
+ expressions is [crontab guru](https://crontab.guru). Note that the timezone
2906
+ used is UTC. */
2856
2907
  cron: z.ZodString;
2857
2908
  }, "strip", z.ZodTypeAny, {
2858
2909
  cron: string;
@@ -2861,14 +2912,18 @@ declare const CronOptionsSchema: z.ZodObject<{
2861
2912
  }>;
2862
2913
  type CronOptions = z.infer<typeof CronOptionsSchema>;
2863
2914
  declare const ScheduleMetadataSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
2915
+ /** An interval reoccurs at the specified number of seconds */
2864
2916
  type: z.ZodLiteral<"interval">;
2917
+ /** An object containing options about the interval. */
2865
2918
  options: z.ZodObject<{
2919
+ /** The number of seconds for the interval. Min = 60, Max = 86400 (1 day) */
2866
2920
  seconds: z.ZodNumber;
2867
2921
  }, "strip", z.ZodTypeAny, {
2868
2922
  seconds: number;
2869
2923
  }, {
2870
2924
  seconds: number;
2871
2925
  }>;
2926
+ /** Any additional metadata about the schedule. */
2872
2927
  metadata: z.ZodAny;
2873
2928
  }, "strip", z.ZodTypeAny, {
2874
2929
  metadata?: any;
@@ -2885,6 +2940,9 @@ declare const ScheduleMetadataSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObje
2885
2940
  }>, z.ZodObject<{
2886
2941
  type: z.ZodLiteral<"cron">;
2887
2942
  options: z.ZodObject<{
2943
+ /** A CRON expression that defines the schedule. A useful tool when writing CRON
2944
+ expressions is [crontab guru](https://crontab.guru). Note that the timezone
2945
+ used is UTC. */
2888
2946
  cron: z.ZodString;
2889
2947
  }, "strip", z.ZodTypeAny, {
2890
2948
  cron: string;
@@ -3703,7 +3761,10 @@ declare class TriggerClient {
3703
3761
  type: "oauth2";
3704
3762
  accessToken: string;
3705
3763
  } | undefined>;
3706
- /** You can call this function from anywhere in your code to send an event. The other way to send an event is by using `io.sendEvent()` from inside a `run()` function.
3764
+ /** You can call this function from anywhere in your code to send an event. The other way to send an event is by using [`io.sendEvent()`](https://trigger.dev/docs/sdk/io/sendevent) from inside a `run()` function.
3765
+ * @param event The event to send.
3766
+ * @param options Options for sending the event.
3767
+ * @returns A promise that resolves to the event details
3707
3768
  */
3708
3769
  sendEvent(event: SendEvent, options?: SendEventOptions): Promise<{
3709
3770
  context?: DeserializedJson | undefined;
@@ -3918,6 +3979,13 @@ declare class IO {
3918
3979
  id: string;
3919
3980
  key: string;
3920
3981
  }>;
3982
+ /** `io.registerInterval()` allows you to register a [DynamicSchedule](https://trigger.dev/docs/sdk/dynamicschedule) that will trigger any jobs it's attached to on a regular interval.
3983
+ * @param key Should be a stable and unique key inside the `run()`. See [resumability](https://trigger.dev/docs/documentation/concepts/resumability) for more information.
3984
+ * @param dynamicSchedule The [DynamicSchedule](https://trigger.dev/docs/sdk/dynamicschedule) to register a new schedule on.
3985
+ * @param id A unique id for the interval. This is used to identify and unregister the interval later.
3986
+ * @param options The options for the interval.
3987
+ * @returns A promise that has information about the interval.
3988
+ */
3921
3989
  registerInterval(key: string | any[], dynamicSchedule: DynamicSchedule, id: string, options: IntervalOptions): Promise<{
3922
3990
  metadata?: any;
3923
3991
  id: string;
@@ -3936,9 +4004,20 @@ declare class IO {
3936
4004
  };
3937
4005
  active: boolean;
3938
4006
  }>;
4007
+ /** `io.unregisterInterval()` allows you to unregister a [DynamicSchedule](https://trigger.dev/docs/sdk/dynamicschedule) that was previously registered with `io.registerInterval()`.
4008
+ * @param key Should be a stable and unique key inside the `run()`. See [resumability](https://trigger.dev/docs/documentation/concepts/resumability) for more information.
4009
+ * @param dynamicSchedule The [DynamicSchedule](https://trigger.dev/docs/sdk/dynamicschedule) to unregister a schedule on.
4010
+ * @param id A unique id for the interval. This is used to identify and unregister the interval later.
4011
+ */
3939
4012
  unregisterInterval(key: string | any[], dynamicSchedule: DynamicSchedule, id: string): Promise<{
3940
4013
  ok: boolean;
3941
4014
  }>;
4015
+ /** `io.registerCron()` allows you to register a [DynamicSchedule](https://trigger.dev/docs/sdk/dynamicschedule) that will trigger any jobs it's attached to on a regular CRON schedule.
4016
+ * @param key Should be a stable and unique key inside the `run()`. See [resumability](https://trigger.dev/docs/documentation/concepts/resumability) for more information.
4017
+ * @param dynamicSchedule The [DynamicSchedule](https://trigger.dev/docs/sdk/dynamicschedule) to register a new schedule on.
4018
+ * @param id A unique id for the schedule. This is used to identify and unregister the schedule later.
4019
+ * @param options The options for the CRON schedule.
4020
+ */
3942
4021
  registerCron(key: string | any[], dynamicSchedule: DynamicSchedule, id: string, options: CronOptions): Promise<{
3943
4022
  metadata?: any;
3944
4023
  id: string;
@@ -3957,19 +4036,44 @@ declare class IO {
3957
4036
  };
3958
4037
  active: boolean;
3959
4038
  }>;
4039
+ /** `io.unregisterCron()` allows you to unregister a [DynamicSchedule](https://trigger.dev/docs/sdk/dynamicschedule) that was previously registered with `io.registerCron()`.
4040
+ * @param key Should be a stable and unique key inside the `run()`. See [resumability](https://trigger.dev/docs/documentation/concepts/resumability) for more information.
4041
+ * @param dynamicSchedule The [DynamicSchedule](https://trigger.dev/docs/sdk/dynamicschedule) to unregister a schedule on.
4042
+ * @param id A unique id for the interval. This is used to identify and unregister the interval later.
4043
+ */
3960
4044
  unregisterCron(key: string | any[], dynamicSchedule: DynamicSchedule, id: string): Promise<{
3961
4045
  ok: boolean;
3962
4046
  }>;
4047
+ /** `io.registerTrigger()` allows you to register a [DynamicTrigger](https://trigger.dev/docs/sdk/dynamictrigger) with the specified trigger params.
4048
+ * @param key Should be a stable and unique key inside the `run()`. See [resumability](https://trigger.dev/docs/documentation/concepts/resumability) for more information.
4049
+ * @param trigger The [DynamicTrigger](https://trigger.dev/docs/sdk/dynamictrigger) to register.
4050
+ * @param id A unique id for the trigger. This is used to identify and unregister the trigger later.
4051
+ * @param params The params for the trigger.
4052
+ */
3963
4053
  registerTrigger<TTrigger extends DynamicTrigger<EventSpecification<any>, ExternalSource<any, any, any>>>(key: string | any[], trigger: TTrigger, id: string, params: ExternalSourceParams<TTrigger["source"]>): Promise<{
3964
4054
  id: string;
3965
4055
  key: string;
3966
4056
  } | undefined>;
3967
4057
  getAuth(key: string | any[], clientId?: string): Promise<ConnectionAuth | undefined>;
4058
+ /** `io.runTask()` allows you to run a [Task](https://trigger.dev/docs/documentation/concepts/tasks) from inside a Job run. A Task is a resumable unit of a Run that can be retried, resumed and is logged. [Integrations](https://trigger.dev/docs/integrations) use Tasks internally to perform their actions.
4059
+ *
4060
+ * @param key Should be a stable and unique key inside the `run()`. See [resumability](https://trigger.dev/docs/documentation/concepts/resumability) for more information.
4061
+ * @param options The options of how you'd like to run and log the Task. Name is required.
4062
+ * @param callback The callback that will be called when the Task is run. The callback receives the Task and the IO as parameters.
4063
+ = * @param onError The callback that will be called when the Task fails. The callback receives the error, the Task and the IO as parameters. If you wish to retry then return an object with a `retryAt` property.
4064
+ * @returns A Promise that resolves with the returned value of the callback.
4065
+ */
3968
4066
  runTask<TResult extends SerializableJson | void = void>(key: string | any[], options: RunTaskOptions, callback: (task: IOTask, io: IO) => Promise<TResult>, onError?: (error: unknown, task: IOTask, io: IO) => {
3969
4067
  retryAt: Date;
3970
4068
  error?: Error;
3971
4069
  jitter?: number;
3972
4070
  } | undefined | void): Promise<TResult>;
4071
+ /** `io.try()` allows you to run Tasks and catch any errors that are thrown, it's similar to a normal `try/catch` block but works with [io.runTask()](/sdk/io/runtask).
4072
+ * A regular `try/catch` block on its own won't work as expected with Tasks. Internally `runTask()` throws some special errors to control flow execution. This is necessary to deal with resumability, serverless timeouts, and retrying Tasks.
4073
+ * @param tryCallback The code you wish to run
4074
+ * @param catchCallback Thhis will be called if the Task fails. The callback receives the error
4075
+ * @returns A Promise that resolves with the returned value or the error
4076
+ */
3973
4077
  try<TResult, TCatchResult>(tryCallback: () => Promise<TResult>, catchCallback: (error: unknown) => Promise<TCatchResult>): Promise<TResult | TCatchResult>;
3974
4078
  }
3975
4079
  type CallbackFunction = (level: "DEBUG" | "INFO" | "WARN" | "ERROR" | "LOG", message: string, properties?: Record<string, any>) => Promise<void>;
@@ -4236,6 +4340,12 @@ declare class RetryWithTaskError {
4236
4340
  retryAt: Date;
4237
4341
  constructor(cause: ErrorWithStack, task: ServerTask, retryAt: Date);
4238
4342
  }
4343
+ /** Use this function if you're using a `try/catch` block to catch errors.
4344
+ * It checks if a thrown error is a special internal error that you should ignore.
4345
+ * If this returns `true` then you must rethrow the error: `throw err;`
4346
+ * @param err The error to check
4347
+ * @returns `true` if the error is a Trigger Error, `false` otherwise.
4348
+ */
4239
4349
  declare function isTriggerError(err: unknown): err is ResumeWithTaskError | RetryWithTaskError;
4240
4350
 
4241
4351
  type Task = ServerTask;
package/dist/index.js CHANGED
@@ -785,21 +785,21 @@ var RetryOptionsSchema = import_zod9.z.object({
785
785
  });
786
786
  var RunTaskOptionsSchema = import_zod9.z.object({
787
787
  name: import_zod9.z.string(),
788
+ delayUntil: import_zod9.z.coerce.date().optional(),
789
+ retry: RetryOptionsSchema.optional(),
788
790
  icon: import_zod9.z.string().optional(),
789
791
  displayKey: import_zod9.z.string().optional(),
790
- noop: import_zod9.z.boolean().default(false),
791
- operation: import_zod9.z.enum([
792
- "fetch"
793
- ]).optional(),
794
- delayUntil: import_zod9.z.coerce.date().optional(),
795
792
  description: import_zod9.z.string().optional(),
796
793
  properties: import_zod9.z.array(DisplayPropertySchema).optional(),
797
794
  params: import_zod9.z.any(),
798
- trigger: TriggerMetadataSchema.optional(),
799
- redact: RedactSchema.optional(),
800
- connectionKey: import_zod9.z.string().optional(),
801
795
  style: StyleSchema.optional(),
802
- retry: RetryOptionsSchema.optional()
796
+ connectionKey: import_zod9.z.string().optional(),
797
+ operation: import_zod9.z.enum([
798
+ "fetch"
799
+ ]).optional(),
800
+ noop: import_zod9.z.boolean().default(false),
801
+ redact: RedactSchema.optional(),
802
+ trigger: TriggerMetadataSchema.optional()
803
803
  });
804
804
  var RunTaskBodyInputSchema = RunTaskOptionsSchema.extend({
805
805
  idempotencyKey: import_zod9.z.string(),