@trigger.dev/sdk 4.7.3 → 4.7.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (119) hide show
  1. package/dist/commonjs/v3/ai.d.ts +26 -0
  2. package/dist/commonjs/v3/ai.js +7 -5
  3. package/dist/commonjs/v3/ai.js.map +1 -1
  4. package/dist/commonjs/v3/concurrencyLimits.d.ts +37 -7
  5. package/dist/commonjs/v3/concurrencyLimits.js +38 -70
  6. package/dist/commonjs/v3/concurrencyLimits.js.map +1 -1
  7. package/dist/commonjs/v3/index.d.ts +1 -1
  8. package/dist/commonjs/v3/index.js.map +1 -1
  9. package/dist/commonjs/v3/query.d.ts +434 -1
  10. package/dist/commonjs/v3/query.js +115 -0
  11. package/dist/commonjs/v3/query.js.map +1 -1
  12. package/dist/commonjs/v3/runs.d.ts +22 -1
  13. package/dist/commonjs/v3/runs.js +6 -3
  14. package/dist/commonjs/v3/runs.js.map +1 -1
  15. package/dist/commonjs/version.js +1 -1
  16. package/dist/esm/v3/ai.d.ts +26 -0
  17. package/dist/esm/v3/ai.js +7 -5
  18. package/dist/esm/v3/ai.js.map +1 -1
  19. package/dist/esm/v3/concurrencyLimits.d.ts +37 -7
  20. package/dist/esm/v3/concurrencyLimits.js +38 -70
  21. package/dist/esm/v3/concurrencyLimits.js.map +1 -1
  22. package/dist/esm/v3/index.d.ts +1 -1
  23. package/dist/esm/v3/index.js.map +1 -1
  24. package/dist/esm/v3/query.d.ts +434 -1
  25. package/dist/esm/v3/query.js +115 -0
  26. package/dist/esm/v3/query.js.map +1 -1
  27. package/dist/esm/v3/runs.d.ts +22 -1
  28. package/dist/esm/v3/runs.js +6 -3
  29. package/dist/esm/v3/runs.js.map +1 -1
  30. package/dist/esm/version.js +1 -1
  31. package/docs/ai-chat/actions.mdx +6 -1
  32. package/docs/ai-chat/backend.mdx +47 -0
  33. package/docs/ai-chat/patterns/redacting-telemetry.mdx +117 -0
  34. package/docs/ai-chat/patterns/sub-agents.mdx +33 -0
  35. package/docs/ai-chat/pending-messages.mdx +2 -0
  36. package/docs/ai-chat/reference.mdx +53 -2
  37. package/docs/ai-chat/transcript-storage.mdx +1 -1
  38. package/docs/apikeys.mdx +9 -7
  39. package/docs/billing-limits.mdx +1 -1
  40. package/docs/cli-env-commands.mdx +5 -4
  41. package/docs/cli-init-commands.mdx +27 -1
  42. package/docs/cli-login-commands.mdx +20 -0
  43. package/docs/cli-projects-commands.mdx +13 -1
  44. package/docs/cli-runs-commands.mdx +3 -2
  45. package/docs/cli-tasks-commands.mdx +95 -0
  46. package/docs/cli-update-commands.mdx +9 -3
  47. package/docs/cli-whoami-commands.mdx +12 -0
  48. package/docs/concurrency.mdx +32 -0
  49. package/docs/config/config-file.mdx +58 -0
  50. package/docs/config/extensions/audioWaveform.mdx +4 -1
  51. package/docs/config/extensions/overview.mdx +2 -0
  52. package/docs/config/extensions/prismaExtension.mdx +6 -7
  53. package/docs/config/extensions/puppeteer.mdx +3 -5
  54. package/docs/config/extensions/pythonExtension.mdx +9 -1
  55. package/docs/config/extensions/syncEnvVars.mdx +6 -0
  56. package/docs/deploy-environment-variables.mdx +5 -1
  57. package/docs/deployment/atomic-deployment.mdx +5 -3
  58. package/docs/deployment/dev-branches.mdx +5 -5
  59. package/docs/deployment/overview.mdx +9 -8
  60. package/docs/deployment/preview-branches.mdx +7 -4
  61. package/docs/errors-retrying.mdx +4 -4
  62. package/docs/github-actions.mdx +3 -3
  63. package/docs/how-it-works.mdx +5 -5
  64. package/docs/introduction.mdx +6 -0
  65. package/docs/limits.mdx +32 -8
  66. package/docs/logging.mdx +1 -1
  67. package/docs/machines.mdx +1 -1
  68. package/docs/manual-setup.mdx +1 -1
  69. package/docs/mcp-introduction.mdx +8 -7
  70. package/docs/mcp-tools.mdx +113 -3
  71. package/docs/migrating-from-v3.mdx +1 -1
  72. package/docs/observability/dashboards.mdx +64 -0
  73. package/docs/observability/query.mdx +6 -2
  74. package/docs/private-networking/aws-console-setup.mdx +1 -1
  75. package/docs/private-networking/overview.mdx +1 -1
  76. package/docs/quick-start.mdx +3 -40
  77. package/docs/realtime/auth.mdx +1 -1
  78. package/docs/realtime/backend/input-streams.mdx +159 -0
  79. package/docs/realtime/backend/streams.mdx +25 -10
  80. package/docs/realtime/how-it-works.mdx +1 -1
  81. package/docs/realtime/react-hooks/overview.mdx +1 -1
  82. package/docs/realtime/react-hooks/streams.mdx +2 -2
  83. package/docs/realtime/react-hooks/subscribe.mdx +19 -3
  84. package/docs/realtime/react-hooks/triggering.mdx +2 -2
  85. package/docs/realtime/react-hooks/use-wait-token.mdx +1 -1
  86. package/docs/realtime/run-object.mdx +47 -24
  87. package/docs/replaying.mdx +26 -1
  88. package/docs/reports.mdx +4 -2
  89. package/docs/run-tests.mdx +2 -2
  90. package/docs/run-usage.mdx +3 -3
  91. package/docs/runs/heartbeats.mdx +2 -2
  92. package/docs/runs/list-best-practices.mdx +234 -0
  93. package/docs/runs/max-duration.mdx +4 -0
  94. package/docs/runs/metadata.mdx +7 -10
  95. package/docs/runs.mdx +18 -8
  96. package/docs/self-hosting/env/supervisor.mdx +3 -0
  97. package/docs/self-hosting/env/webapp.mdx +5 -0
  98. package/docs/self-hosting/overview.mdx +26 -0
  99. package/docs/tags.mdx +6 -0
  100. package/docs/tasks/scheduled.mdx +11 -5
  101. package/docs/triggering.mdx +8 -0
  102. package/docs/troubleshooting-alerts.mdx +102 -3
  103. package/docs/troubleshooting.mdx +1 -1
  104. package/docs/upgrading-packages.mdx +3 -3
  105. package/docs/vercel-integration.mdx +13 -3
  106. package/docs/versioning.mdx +1 -1
  107. package/docs/wait-for-token.mdx +3 -3
  108. package/docs/webhooks/channels.mdx +158 -0
  109. package/docs/webhooks/connect.mdx +84 -0
  110. package/docs/webhooks/deliveries.mdx +103 -0
  111. package/docs/webhooks/filters.mdx +144 -0
  112. package/docs/webhooks/human-in-the-loop.mdx +162 -0
  113. package/docs/webhooks/linear.mdx +190 -0
  114. package/docs/webhooks/overview.mdx +119 -0
  115. package/docs/webhooks/session-routing.mdx +145 -0
  116. package/docs/webhooks/slack.mdx +397 -0
  117. package/docs/webhooks/sources.mdx +221 -0
  118. package/docs/webhooks/waiters.mdx +194 -0
  119. package/package.json +3 -2
@@ -1,5 +1,6 @@
1
- import type { ApiRequestOptions, Prettify } from "@trigger.dev/core/v3";
1
+ import type { AddDashboardWidgetRequestBody, ApiRequestOptions, CreateDashboardRequestBody, Prettify, ReplaceDashboardRequestBody, UpdateDashboardRequestBody, UpdateDashboardWidgetRequestBody } from "@trigger.dev/core/v3";
2
2
  export type { QueryTable, RunsTableRow, RunFriendlyStatus } from "@trigger.dev/core/v3";
3
+ export type { DashboardObject, DashboardSummary, DashboardWidget, DashboardWidgetDisplay, DashboardWidgetInput, DashboardWidgetPosition, } from "@trigger.dev/core/v3";
3
4
  export type QueryScope = "environment" | "project" | "organization";
4
5
  export type QueryFormat = "json" | "csv";
5
6
  /**
@@ -107,6 +108,438 @@ declare function execute<TRow extends Record<string, any> = Record<string, any>>
107
108
  format: "json";
108
109
  results: Array<Prettify<TRow>>;
109
110
  }>;
111
+ /**
112
+ * Lists the built-in dashboards and your organization's custom dashboards, with their widgets.
113
+ */
114
+ declare function listDashboards(requestOptions?: ApiRequestOptions): Promise<{
115
+ dashboards: {
116
+ key: string;
117
+ title: string;
118
+ type?: "builtIn" | "custom" | undefined;
119
+ description?: string | undefined;
120
+ widgets: {
121
+ id: string;
122
+ title: string;
123
+ query: string;
124
+ type: "bignumber" | "chart" | "table" | "title";
125
+ }[];
126
+ }[];
127
+ }>;
128
+ /**
129
+ * Retrieves a custom dashboard, including every widget, its query and its grid position.
130
+ */
131
+ declare function retrieveDashboard(dashboardId: string, requestOptions?: ApiRequestOptions): import("@trigger.dev/core/v3").ApiPromise<{
132
+ id: string;
133
+ title: string;
134
+ description: string;
135
+ revision: string;
136
+ createdAt: Date;
137
+ updatedAt: Date;
138
+ widgets: {
139
+ id: string;
140
+ title: string;
141
+ query: string;
142
+ display: {
143
+ type: "table";
144
+ prettyFormatting: boolean;
145
+ sorting: {
146
+ desc: boolean;
147
+ id: string;
148
+ }[];
149
+ } | {
150
+ chartType: "bar" | "line";
151
+ xAxisColumn: string | null;
152
+ yAxisColumns: string[];
153
+ groupByColumn: string | null;
154
+ stacked: boolean;
155
+ sortByColumn: string | null;
156
+ sortDirection: "asc" | "desc";
157
+ aggregation: "avg" | "count" | "max" | "min" | "sum";
158
+ seriesColors?: Record<string, string> | undefined;
159
+ type: "chart";
160
+ } | {
161
+ column: string;
162
+ aggregation: "avg" | "count" | "first" | "last" | "max" | "min" | "sum";
163
+ sortDirection?: "asc" | "desc" | undefined;
164
+ abbreviate: boolean;
165
+ prefix?: string | undefined;
166
+ suffix?: string | undefined;
167
+ type: "bignumber";
168
+ } | {
169
+ type: "title";
170
+ };
171
+ fillGaps?: boolean | undefined;
172
+ position: {
173
+ x: number;
174
+ y: number;
175
+ w: number;
176
+ h: number;
177
+ };
178
+ }[];
179
+ }>;
180
+ /**
181
+ * Creates a custom dashboard, optionally with its widgets.
182
+ *
183
+ * @example
184
+ * ```ts
185
+ * const dashboard = await query.dashboards.create({
186
+ * title: "Email tasks",
187
+ * widgets: [
188
+ * {
189
+ * title: "Runs per day",
190
+ * query: "SELECT timeBucket(), count() AS runs FROM runs GROUP BY timeBucket ORDER BY timeBucket",
191
+ * display: {
192
+ * type: "chart",
193
+ * chartType: "bar",
194
+ * xAxisColumn: "timebucket",
195
+ * yAxisColumns: ["runs"],
196
+ * groupByColumn: null,
197
+ * stacked: false,
198
+ * sortByColumn: null,
199
+ * sortDirection: "asc",
200
+ * aggregation: "sum",
201
+ * },
202
+ * },
203
+ * ],
204
+ * });
205
+ * ```
206
+ */
207
+ declare function createDashboard(body: CreateDashboardRequestBody, requestOptions?: ApiRequestOptions): import("@trigger.dev/core/v3").ApiPromise<{
208
+ id: string;
209
+ title: string;
210
+ description: string;
211
+ revision: string;
212
+ createdAt: Date;
213
+ updatedAt: Date;
214
+ widgets: {
215
+ id: string;
216
+ title: string;
217
+ query: string;
218
+ display: {
219
+ type: "table";
220
+ prettyFormatting: boolean;
221
+ sorting: {
222
+ desc: boolean;
223
+ id: string;
224
+ }[];
225
+ } | {
226
+ chartType: "bar" | "line";
227
+ xAxisColumn: string | null;
228
+ yAxisColumns: string[];
229
+ groupByColumn: string | null;
230
+ stacked: boolean;
231
+ sortByColumn: string | null;
232
+ sortDirection: "asc" | "desc";
233
+ aggregation: "avg" | "count" | "max" | "min" | "sum";
234
+ seriesColors?: Record<string, string> | undefined;
235
+ type: "chart";
236
+ } | {
237
+ column: string;
238
+ aggregation: "avg" | "count" | "first" | "last" | "max" | "min" | "sum";
239
+ sortDirection?: "asc" | "desc" | undefined;
240
+ abbreviate: boolean;
241
+ prefix?: string | undefined;
242
+ suffix?: string | undefined;
243
+ type: "bignumber";
244
+ } | {
245
+ type: "title";
246
+ };
247
+ fillGaps?: boolean | undefined;
248
+ position: {
249
+ x: number;
250
+ y: number;
251
+ w: number;
252
+ h: number;
253
+ };
254
+ }[];
255
+ }>;
256
+ /**
257
+ * Renames a custom dashboard or changes its description.
258
+ */
259
+ declare function updateDashboard(dashboardId: string, body: UpdateDashboardRequestBody, requestOptions?: ApiRequestOptions): import("@trigger.dev/core/v3").ApiPromise<{
260
+ id: string;
261
+ title: string;
262
+ description: string;
263
+ revision: string;
264
+ createdAt: Date;
265
+ updatedAt: Date;
266
+ widgets: {
267
+ id: string;
268
+ title: string;
269
+ query: string;
270
+ display: {
271
+ type: "table";
272
+ prettyFormatting: boolean;
273
+ sorting: {
274
+ desc: boolean;
275
+ id: string;
276
+ }[];
277
+ } | {
278
+ chartType: "bar" | "line";
279
+ xAxisColumn: string | null;
280
+ yAxisColumns: string[];
281
+ groupByColumn: string | null;
282
+ stacked: boolean;
283
+ sortByColumn: string | null;
284
+ sortDirection: "asc" | "desc";
285
+ aggregation: "avg" | "count" | "max" | "min" | "sum";
286
+ seriesColors?: Record<string, string> | undefined;
287
+ type: "chart";
288
+ } | {
289
+ column: string;
290
+ aggregation: "avg" | "count" | "first" | "last" | "max" | "min" | "sum";
291
+ sortDirection?: "asc" | "desc" | undefined;
292
+ abbreviate: boolean;
293
+ prefix?: string | undefined;
294
+ suffix?: string | undefined;
295
+ type: "bignumber";
296
+ } | {
297
+ type: "title";
298
+ };
299
+ fillGaps?: boolean | undefined;
300
+ position: {
301
+ x: number;
302
+ y: number;
303
+ w: number;
304
+ h: number;
305
+ };
306
+ }[];
307
+ }>;
308
+ /**
309
+ * Replaces every widget on a custom dashboard. A widget that already exists keeps its position
310
+ * unless you pass a new one; new widgets without a `position` are placed full width below the others,
311
+ * in order. Pass the `revision` you last read to reject the write if someone else changed the
312
+ * dashboard in the meantime.
313
+ */
314
+ declare function replaceDashboard(dashboardId: string, body: ReplaceDashboardRequestBody, requestOptions?: ApiRequestOptions): import("@trigger.dev/core/v3").ApiPromise<{
315
+ id: string;
316
+ title: string;
317
+ description: string;
318
+ revision: string;
319
+ createdAt: Date;
320
+ updatedAt: Date;
321
+ widgets: {
322
+ id: string;
323
+ title: string;
324
+ query: string;
325
+ display: {
326
+ type: "table";
327
+ prettyFormatting: boolean;
328
+ sorting: {
329
+ desc: boolean;
330
+ id: string;
331
+ }[];
332
+ } | {
333
+ chartType: "bar" | "line";
334
+ xAxisColumn: string | null;
335
+ yAxisColumns: string[];
336
+ groupByColumn: string | null;
337
+ stacked: boolean;
338
+ sortByColumn: string | null;
339
+ sortDirection: "asc" | "desc";
340
+ aggregation: "avg" | "count" | "max" | "min" | "sum";
341
+ seriesColors?: Record<string, string> | undefined;
342
+ type: "chart";
343
+ } | {
344
+ column: string;
345
+ aggregation: "avg" | "count" | "first" | "last" | "max" | "min" | "sum";
346
+ sortDirection?: "asc" | "desc" | undefined;
347
+ abbreviate: boolean;
348
+ prefix?: string | undefined;
349
+ suffix?: string | undefined;
350
+ type: "bignumber";
351
+ } | {
352
+ type: "title";
353
+ };
354
+ fillGaps?: boolean | undefined;
355
+ position: {
356
+ x: number;
357
+ y: number;
358
+ w: number;
359
+ h: number;
360
+ };
361
+ }[];
362
+ }>;
363
+ /**
364
+ * Deletes a custom dashboard.
365
+ */
366
+ declare function deleteDashboard(dashboardId: string, requestOptions?: ApiRequestOptions): import("@trigger.dev/core/v3").ApiPromise<{
367
+ id: string;
368
+ }>;
369
+ /**
370
+ * Adds a widget to a custom dashboard. Without a `position` it is placed full width at the bottom.
371
+ */
372
+ declare function addDashboardWidget(dashboardId: string, body: AddDashboardWidgetRequestBody, requestOptions?: ApiRequestOptions): import("@trigger.dev/core/v3").ApiPromise<{
373
+ widgetId: string;
374
+ dashboard: {
375
+ id: string;
376
+ title: string;
377
+ description: string;
378
+ revision: string;
379
+ createdAt: Date;
380
+ updatedAt: Date;
381
+ widgets: {
382
+ id: string;
383
+ title: string;
384
+ query: string;
385
+ display: {
386
+ type: "table";
387
+ prettyFormatting: boolean;
388
+ sorting: {
389
+ desc: boolean;
390
+ id: string;
391
+ }[];
392
+ } | {
393
+ chartType: "bar" | "line";
394
+ xAxisColumn: string | null;
395
+ yAxisColumns: string[];
396
+ groupByColumn: string | null;
397
+ stacked: boolean;
398
+ sortByColumn: string | null;
399
+ sortDirection: "asc" | "desc";
400
+ aggregation: "avg" | "count" | "max" | "min" | "sum";
401
+ seriesColors?: Record<string, string> | undefined;
402
+ type: "chart";
403
+ } | {
404
+ column: string;
405
+ aggregation: "avg" | "count" | "first" | "last" | "max" | "min" | "sum";
406
+ sortDirection?: "asc" | "desc" | undefined;
407
+ abbreviate: boolean;
408
+ prefix?: string | undefined;
409
+ suffix?: string | undefined;
410
+ type: "bignumber";
411
+ } | {
412
+ type: "title";
413
+ };
414
+ fillGaps?: boolean | undefined;
415
+ position: {
416
+ x: number;
417
+ y: number;
418
+ w: number;
419
+ h: number;
420
+ };
421
+ }[];
422
+ };
423
+ }>;
424
+ /**
425
+ * Changes a widget's title, query, display, or position.
426
+ */
427
+ declare function updateDashboardWidget(dashboardId: string, widgetId: string, body: UpdateDashboardWidgetRequestBody, requestOptions?: ApiRequestOptions): import("@trigger.dev/core/v3").ApiPromise<{
428
+ id: string;
429
+ title: string;
430
+ description: string;
431
+ revision: string;
432
+ createdAt: Date;
433
+ updatedAt: Date;
434
+ widgets: {
435
+ id: string;
436
+ title: string;
437
+ query: string;
438
+ display: {
439
+ type: "table";
440
+ prettyFormatting: boolean;
441
+ sorting: {
442
+ desc: boolean;
443
+ id: string;
444
+ }[];
445
+ } | {
446
+ chartType: "bar" | "line";
447
+ xAxisColumn: string | null;
448
+ yAxisColumns: string[];
449
+ groupByColumn: string | null;
450
+ stacked: boolean;
451
+ sortByColumn: string | null;
452
+ sortDirection: "asc" | "desc";
453
+ aggregation: "avg" | "count" | "max" | "min" | "sum";
454
+ seriesColors?: Record<string, string> | undefined;
455
+ type: "chart";
456
+ } | {
457
+ column: string;
458
+ aggregation: "avg" | "count" | "first" | "last" | "max" | "min" | "sum";
459
+ sortDirection?: "asc" | "desc" | undefined;
460
+ abbreviate: boolean;
461
+ prefix?: string | undefined;
462
+ suffix?: string | undefined;
463
+ type: "bignumber";
464
+ } | {
465
+ type: "title";
466
+ };
467
+ fillGaps?: boolean | undefined;
468
+ position: {
469
+ x: number;
470
+ y: number;
471
+ w: number;
472
+ h: number;
473
+ };
474
+ }[];
475
+ }>;
476
+ /**
477
+ * Removes a widget from a custom dashboard.
478
+ */
479
+ declare function deleteDashboardWidget(dashboardId: string, widgetId: string, options?: {
480
+ revision?: string;
481
+ }, requestOptions?: ApiRequestOptions): import("@trigger.dev/core/v3").ApiPromise<{
482
+ id: string;
483
+ title: string;
484
+ description: string;
485
+ revision: string;
486
+ createdAt: Date;
487
+ updatedAt: Date;
488
+ widgets: {
489
+ id: string;
490
+ title: string;
491
+ query: string;
492
+ display: {
493
+ type: "table";
494
+ prettyFormatting: boolean;
495
+ sorting: {
496
+ desc: boolean;
497
+ id: string;
498
+ }[];
499
+ } | {
500
+ chartType: "bar" | "line";
501
+ xAxisColumn: string | null;
502
+ yAxisColumns: string[];
503
+ groupByColumn: string | null;
504
+ stacked: boolean;
505
+ sortByColumn: string | null;
506
+ sortDirection: "asc" | "desc";
507
+ aggregation: "avg" | "count" | "max" | "min" | "sum";
508
+ seriesColors?: Record<string, string> | undefined;
509
+ type: "chart";
510
+ } | {
511
+ column: string;
512
+ aggregation: "avg" | "count" | "first" | "last" | "max" | "min" | "sum";
513
+ sortDirection?: "asc" | "desc" | undefined;
514
+ abbreviate: boolean;
515
+ prefix?: string | undefined;
516
+ suffix?: string | undefined;
517
+ type: "bignumber";
518
+ } | {
519
+ type: "title";
520
+ };
521
+ fillGaps?: boolean | undefined;
522
+ position: {
523
+ x: number;
524
+ y: number;
525
+ w: number;
526
+ h: number;
527
+ };
528
+ }[];
529
+ }>;
110
530
  export declare const query: {
111
531
  execute: typeof execute;
532
+ dashboards: {
533
+ list: typeof listDashboards;
534
+ retrieve: typeof retrieveDashboard;
535
+ create: typeof createDashboard;
536
+ update: typeof updateDashboard;
537
+ replace: typeof replaceDashboard;
538
+ del: typeof deleteDashboard;
539
+ widgets: {
540
+ add: typeof addDashboardWidget;
541
+ update: typeof updateDashboardWidget;
542
+ del: typeof deleteDashboardWidget;
543
+ };
544
+ };
112
545
  };
@@ -39,7 +39,122 @@ function dateToISOString(date) {
39
39
  }
40
40
  return new Date(date).toISOString();
41
41
  }
42
+ function dashboardRequestOptions(name, attributes, requestOptions) {
43
+ return mergeRequestOptions({ tracer, name, icon: "query", attributes }, requestOptions);
44
+ }
45
+ /**
46
+ * Lists the built-in dashboards and your organization's custom dashboards, with their widgets.
47
+ */
48
+ function listDashboards(requestOptions) {
49
+ return apiClientManager
50
+ .clientOrThrow()
51
+ .listDashboards(dashboardRequestOptions("query.dashboards.list()", {}, requestOptions));
52
+ }
53
+ /**
54
+ * Retrieves a custom dashboard, including every widget, its query and its grid position.
55
+ */
56
+ function retrieveDashboard(dashboardId, requestOptions) {
57
+ return apiClientManager
58
+ .clientOrThrow()
59
+ .retrieveDashboard(dashboardId, dashboardRequestOptions("query.dashboards.retrieve()", { dashboardId }, requestOptions));
60
+ }
61
+ /**
62
+ * Creates a custom dashboard, optionally with its widgets.
63
+ *
64
+ * @example
65
+ * ```ts
66
+ * const dashboard = await query.dashboards.create({
67
+ * title: "Email tasks",
68
+ * widgets: [
69
+ * {
70
+ * title: "Runs per day",
71
+ * query: "SELECT timeBucket(), count() AS runs FROM runs GROUP BY timeBucket ORDER BY timeBucket",
72
+ * display: {
73
+ * type: "chart",
74
+ * chartType: "bar",
75
+ * xAxisColumn: "timebucket",
76
+ * yAxisColumns: ["runs"],
77
+ * groupByColumn: null,
78
+ * stacked: false,
79
+ * sortByColumn: null,
80
+ * sortDirection: "asc",
81
+ * aggregation: "sum",
82
+ * },
83
+ * },
84
+ * ],
85
+ * });
86
+ * ```
87
+ */
88
+ function createDashboard(body, requestOptions) {
89
+ return apiClientManager
90
+ .clientOrThrow()
91
+ .createDashboard(body, dashboardRequestOptions("query.dashboards.create()", { title: body.title }, requestOptions));
92
+ }
93
+ /**
94
+ * Renames a custom dashboard or changes its description.
95
+ */
96
+ function updateDashboard(dashboardId, body, requestOptions) {
97
+ return apiClientManager
98
+ .clientOrThrow()
99
+ .updateDashboard(dashboardId, body, dashboardRequestOptions("query.dashboards.update()", { dashboardId }, requestOptions));
100
+ }
101
+ /**
102
+ * Replaces every widget on a custom dashboard. A widget that already exists keeps its position
103
+ * unless you pass a new one; new widgets without a `position` are placed full width below the others,
104
+ * in order. Pass the `revision` you last read to reject the write if someone else changed the
105
+ * dashboard in the meantime.
106
+ */
107
+ function replaceDashboard(dashboardId, body, requestOptions) {
108
+ return apiClientManager
109
+ .clientOrThrow()
110
+ .replaceDashboard(dashboardId, body, dashboardRequestOptions("query.dashboards.replace()", { dashboardId }, requestOptions));
111
+ }
112
+ /**
113
+ * Deletes a custom dashboard.
114
+ */
115
+ function deleteDashboard(dashboardId, requestOptions) {
116
+ return apiClientManager
117
+ .clientOrThrow()
118
+ .deleteDashboard(dashboardId, dashboardRequestOptions("query.dashboards.del()", { dashboardId }, requestOptions));
119
+ }
120
+ /**
121
+ * Adds a widget to a custom dashboard. Without a `position` it is placed full width at the bottom.
122
+ */
123
+ function addDashboardWidget(dashboardId, body, requestOptions) {
124
+ return apiClientManager
125
+ .clientOrThrow()
126
+ .addDashboardWidget(dashboardId, body, dashboardRequestOptions("query.dashboards.widgets.add()", { dashboardId }, requestOptions));
127
+ }
128
+ /**
129
+ * Changes a widget's title, query, display, or position.
130
+ */
131
+ function updateDashboardWidget(dashboardId, widgetId, body, requestOptions) {
132
+ return apiClientManager
133
+ .clientOrThrow()
134
+ .updateDashboardWidget(dashboardId, widgetId, body, dashboardRequestOptions("query.dashboards.widgets.update()", { dashboardId, widgetId }, requestOptions));
135
+ }
136
+ /**
137
+ * Removes a widget from a custom dashboard.
138
+ */
139
+ function deleteDashboardWidget(dashboardId, widgetId, options, requestOptions) {
140
+ return apiClientManager
141
+ .clientOrThrow()
142
+ .deleteDashboardWidget(dashboardId, widgetId, options, dashboardRequestOptions("query.dashboards.widgets.del()", { dashboardId, widgetId }, requestOptions));
143
+ }
42
144
  export const query = {
43
145
  execute,
146
+ dashboards: {
147
+ list: listDashboards,
148
+ retrieve: retrieveDashboard,
149
+ create: createDashboard,
150
+ update: updateDashboard,
151
+ replace: replaceDashboard,
152
+ del: deleteDashboard,
153
+ widgets: {
154
+ add: addDashboardWidget,
155
+ update: updateDashboardWidget,
156
+ del: deleteDashboardWidget,
157
+ },
158
+ },
44
159
  };
45
160
  //# sourceMappingURL=query.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"query.js","sourceRoot":"","sources":["../../../src/v3/query.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAC7E,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAqHrC,iBAAiB;AACjB,SAAS,OAAO,CACd,KAAa,EACb,OAAsB,EACtB,cAAkC;IAElC,MAAM,SAAS,GA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AAe;QACvB,MAAM,EAAE,eAAe;QACvB,OAAO,EAAE,gBAAgB;QACzB,GAAG,EAAE,eAAe;QACpB,OAAO,EAAE;YACP,GAAG,EAAE,kBAAkB;YACvB,MAAM,EAAE,qBAAqB;YAC7B,GAAG,EAAE,qBAAqB;SAC3B;KACF;CACF,CAAC"}
@@ -1,4 +1,4 @@
1
- import type { AnyRetrieveRunResult, AnyRunShape, ApiRequestOptions, CreateBulkCancelActionOptions, CreateBulkReplayActionOptions, InferRunTypes, ListBulkActionsQueryParams, ListProjectRunsQueryParams, ListRunsQueryParams, RescheduleRunRequestBody, RetrieveRunResult, RunShape, RealtimeRun, AnyRealtimeRun, RunSubscription, TaskRunShape, AnyBatchedRunHandle, AsyncIterableStream, ApiPromise, RealtimeRunSkipColumns, AbortBulkActionResponseBody, BulkActionObject, CanceledRunResponse, CreateBulkActionResponseBody, CursorPagePromise, ListRunResponseItem, ReplayRunResponse, RetrieveRunResponse } from "@trigger.dev/core/v3";
1
+ import type { AnyRetrieveRunResult, AnyRunShape, ApiRequestOptions, CreateBulkCancelActionOptions, CreateBulkReplayActionOptions, InferRunTypes, ListBulkActionsQueryParams, ListProjectRunsQueryParams, ListRunsQueryParams, RescheduleRunRequestBody, RetrieveRunResult, RunShape, RealtimeRun, AnyRealtimeRun, RunSubscription, TaskRunShape, AnyBatchedRunHandle, AsyncIterableStream, ApiPromise, RealtimeRunSkipColumns, AbortBulkActionResponseBody, BulkActionObject, CanceledRunResponse, CreateBulkActionResponseBody, CursorPagePromise, IdempotencyKey, ListRunResponseItem, ReplayRunResponse, RetrieveRunResponse, TriggerOptions } from "@trigger.dev/core/v3";
2
2
  import type { AnyRunHandle, AnyTask } from "./shared.js";
3
3
  export type { AnyRetrieveRunResult, AnyRunShape, RetrieveRunResult, RunShape, TaskRunShape, RealtimeRun, AnyRealtimeRun, };
4
4
  export declare const runs: {
@@ -26,6 +26,27 @@ declare function listRuns(projectRef: string, params?: ListProjectRunsQueryParam
26
26
  declare function listRuns(params?: ListRunsQueryParams, requestOptions?: ApiRequestOptions): CursorPagePromise<typeof ListRunResponseItem>;
27
27
  type RunId<TRunId> = TRunId extends AnyRunHandle | AnyBatchedRunHandle ? TRunId : TRunId extends AnyTask ? string : TRunId extends string ? TRunId : never;
28
28
  declare function retrieveRun<TRunId extends AnyRunHandle | AnyBatchedRunHandle | AnyTask | string>(runId: RunId<TRunId>, requestOptions?: ApiRequestOptions): ApiPromise<RetrieveRunResult<TRunId>>;
29
+ export type ReplayRunOptions = Pick<TriggerOptions, "metadata" | "tags" | "queue" | "concurrencyKey" | "machine" | "version" | "region" | "delay" | "ttl" | "idempotencyKeyTTL" | "maxAttempts" | "maxDuration" | "priority"> & {
30
+ /**
31
+ * The payload for the new run. Omit it to reuse the original run's payload.
32
+ */
33
+ payload?: unknown;
34
+ /**
35
+ * An idempotency key for the new run. A plain string is used as-is: unlike `trigger()`, it is
36
+ * not scoped to the current run. Use `idempotencyKeys.create()` for a scoped key.
37
+ */
38
+ idempotencyKey?: IdempotencyKey | string;
39
+ };
40
+ /**
41
+ * Replays a run: creates a new run of the same task from the original run's payload and options.
42
+ * Pass `options` to override any of them for the new run.
43
+ *
44
+ * @example
45
+ * ```ts
46
+ * const { id } = await runs.replay("run_1234", { payload: { userId: "123" }, delay: "1h" });
47
+ * ```
48
+ */
49
+ declare function replayRun(runId: string, options?: ReplayRunOptions, requestOptions?: ApiRequestOptions): ApiPromise<ReplayRunResponse>;
29
50
  declare function replayRun(runId: string, requestOptions?: ApiRequestOptions): ApiPromise<ReplayRunResponse>;
30
51
  declare function cancelRun(runId: string, requestOptions?: ApiRequestOptions): ApiPromise<CanceledRunResponse>;
31
52
  declare function bulkCancelRuns(options: CreateBulkCancelActionOptions, requestOptions?: ApiRequestOptions): ApiPromise<CreateBulkActionResponseBody>;
@@ -126,8 +126,11 @@ async function resolvePayloadAndOutputUrls(run) {
126
126
  }
127
127
  return resolvedRun;
128
128
  }
129
- function replayRun(runId, requestOptions) {
129
+ function replayRun(runId, optionsOrRequestOptions, requestOptions) {
130
130
  const apiClient = apiClientManager.clientOrThrow();
131
+ const options = isRequestOptions(optionsOrRequestOptions)
132
+ ? undefined
133
+ : optionsOrRequestOptions;
131
134
  const $requestOptions = mergeRequestOptions({
132
135
  tracer,
133
136
  name: "runs.replay()",
@@ -144,8 +147,8 @@ function replayRun(runId, requestOptions) {
144
147
  style: "codepath",
145
148
  }),
146
149
  },
147
- }, requestOptions);
148
- return apiClient.replayRun(runId, $requestOptions);
150
+ }, isRequestOptions(optionsOrRequestOptions) ? optionsOrRequestOptions : requestOptions);
151
+ return apiClient.replayRun(runId, options, $requestOptions);
149
152
  }
150
153
  function cancelRun(runId, requestOptions) {
151
154
  const apiClient = apiClientManager.clientOrThrow();