@trigger.dev/core 3.0.0-beta.26 → 3.0.0-beta.28
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/{catalog-XNyNDUOF.d.ts → catalog-KbyTBoap.d.ts} +3 -3
- package/dist/{catalog-g2Qc0Ukb.d.mts → catalog-ck7x04PV.d.mts} +3 -3
- package/dist/v3/index.d.mts +108 -16
- package/dist/v3/index.d.ts +108 -16
- package/dist/v3/index.js +98 -58
- package/dist/v3/index.js.map +1 -1
- package/dist/v3/index.mjs +96 -58
- package/dist/v3/index.mjs.map +1 -1
- package/dist/v3/otel/index.js.map +1 -1
- package/dist/v3/otel/index.mjs.map +1 -1
- package/dist/v3/prod/index.js.map +1 -1
- package/dist/v3/prod/index.mjs.map +1 -1
- package/dist/v3/workers/index.d.mts +2 -2
- package/dist/v3/workers/index.d.ts +2 -2
- package/dist/v3/workers/index.js +74 -37
- package/dist/v3/workers/index.js.map +1 -1
- package/dist/v3/workers/index.mjs +74 -37
- package/dist/v3/workers/index.mjs.map +1 -1
- package/dist/v3/zodMessageHandler.d.mts +1 -1
- package/dist/v3/zodMessageHandler.d.ts +1 -1
- package/package.json +3 -3
|
@@ -9,7 +9,6 @@ import { NodeTracerProvider, BatchSpanProcessor, SimpleSpanProcessor } from '@op
|
|
|
9
9
|
import { SemanticResourceAttributes } from '@opentelemetry/semantic-conventions';
|
|
10
10
|
import { z } from 'zod';
|
|
11
11
|
import { fromZodError } from 'zod-validation-error';
|
|
12
|
-
import { AsyncLocalStorage } from 'node:async_hooks';
|
|
13
12
|
import { PreciseDate } from '@google-cloud/precise-date';
|
|
14
13
|
import util from 'node:util';
|
|
15
14
|
|
|
@@ -1081,6 +1080,39 @@ z.object({
|
|
|
1081
1080
|
page: z.number().optional(),
|
|
1082
1081
|
perPage: z.number().optional()
|
|
1083
1082
|
});
|
|
1083
|
+
var RunStatus = z.enum([
|
|
1084
|
+
"PENDING",
|
|
1085
|
+
"EXECUTING",
|
|
1086
|
+
"PAUSED",
|
|
1087
|
+
"COMPLETED",
|
|
1088
|
+
"FAILED",
|
|
1089
|
+
"CANCELED"
|
|
1090
|
+
]);
|
|
1091
|
+
var AttemptStatus = z.enum([
|
|
1092
|
+
"PENDING",
|
|
1093
|
+
"EXECUTING",
|
|
1094
|
+
"PAUSED",
|
|
1095
|
+
"COMPLETED",
|
|
1096
|
+
"FAILED",
|
|
1097
|
+
"CANCELED"
|
|
1098
|
+
]);
|
|
1099
|
+
var RetrieveRunResponse = z.object({
|
|
1100
|
+
id: z.string(),
|
|
1101
|
+
status: RunStatus,
|
|
1102
|
+
taskIdentifier: z.string(),
|
|
1103
|
+
idempotencyKey: z.string().optional(),
|
|
1104
|
+
version: z.string().optional(),
|
|
1105
|
+
createdAt: z.coerce.date(),
|
|
1106
|
+
updatedAt: z.coerce.date(),
|
|
1107
|
+
attempts: z.array(z.object({
|
|
1108
|
+
id: z.string(),
|
|
1109
|
+
status: AttemptStatus,
|
|
1110
|
+
createdAt: z.coerce.date(),
|
|
1111
|
+
updatedAt: z.coerce.date(),
|
|
1112
|
+
startedAt: z.coerce.date().optional(),
|
|
1113
|
+
completedAt: z.coerce.date().optional()
|
|
1114
|
+
}).optional())
|
|
1115
|
+
});
|
|
1084
1116
|
|
|
1085
1117
|
// src/v3/apiErrors.ts
|
|
1086
1118
|
var _APIError = class _APIError extends Error {
|
|
@@ -1376,19 +1408,6 @@ function requestInitWithCache(requestInit) {
|
|
|
1376
1408
|
}
|
|
1377
1409
|
}
|
|
1378
1410
|
__name(requestInitWithCache, "requestInitWithCache");
|
|
1379
|
-
var _SafeAsyncLocalStorage = class _SafeAsyncLocalStorage {
|
|
1380
|
-
constructor() {
|
|
1381
|
-
this.storage = new AsyncLocalStorage();
|
|
1382
|
-
}
|
|
1383
|
-
runWith(context2, fn) {
|
|
1384
|
-
return this.storage.run(context2, fn);
|
|
1385
|
-
}
|
|
1386
|
-
getStore() {
|
|
1387
|
-
return this.storage.getStore();
|
|
1388
|
-
}
|
|
1389
|
-
};
|
|
1390
|
-
__name(_SafeAsyncLocalStorage, "SafeAsyncLocalStorage");
|
|
1391
|
-
var SafeAsyncLocalStorage = _SafeAsyncLocalStorage;
|
|
1392
1411
|
|
|
1393
1412
|
// src/v3/apiClient/index.ts
|
|
1394
1413
|
var zodFetchOptions = {
|
|
@@ -1454,6 +1473,12 @@ var _ApiClient = class _ApiClient {
|
|
|
1454
1473
|
headers: __privateMethod(this, _getHeaders, getHeaders_fn).call(this, false)
|
|
1455
1474
|
}, zodFetchOptions);
|
|
1456
1475
|
}
|
|
1476
|
+
retrieveRun(runId) {
|
|
1477
|
+
return zodfetch(RetrieveRunResponse, `${this.baseUrl}/api/v3/runs/${runId}`, {
|
|
1478
|
+
method: "GET",
|
|
1479
|
+
headers: __privateMethod(this, _getHeaders, getHeaders_fn).call(this, false)
|
|
1480
|
+
}, zodFetchOptions);
|
|
1481
|
+
}
|
|
1457
1482
|
replayRun(runId) {
|
|
1458
1483
|
return zodfetch(ReplayRunResponse, `${this.baseUrl}/api/v1/runs/${runId}/replay`, {
|
|
1459
1484
|
method: "POST",
|
|
@@ -1534,19 +1559,33 @@ getHeaders_fn = /* @__PURE__ */ __name(function(spanParentAsLink) {
|
|
|
1534
1559
|
}, "#getHeaders");
|
|
1535
1560
|
__name(_ApiClient, "ApiClient");
|
|
1536
1561
|
var ApiClient = _ApiClient;
|
|
1537
|
-
|
|
1538
|
-
|
|
1562
|
+
|
|
1563
|
+
// src/v3/apiClientManager/index.ts
|
|
1564
|
+
var API_NAME2 = "api-client";
|
|
1565
|
+
var _getConfig, getConfig_fn;
|
|
1566
|
+
var _APIClientManagerAPI = class _APIClientManagerAPI {
|
|
1539
1567
|
constructor() {
|
|
1540
|
-
__privateAdd(this,
|
|
1541
|
-
|
|
1568
|
+
__privateAdd(this, _getConfig);
|
|
1569
|
+
}
|
|
1570
|
+
static getInstance() {
|
|
1571
|
+
if (!this._instance) {
|
|
1572
|
+
this._instance = new _APIClientManagerAPI();
|
|
1573
|
+
}
|
|
1574
|
+
return this._instance;
|
|
1575
|
+
}
|
|
1576
|
+
disable() {
|
|
1577
|
+
unregisterGlobal(API_NAME2);
|
|
1578
|
+
}
|
|
1579
|
+
setGlobalAPIClientConfiguration(config) {
|
|
1580
|
+
return registerGlobal(API_NAME2, config);
|
|
1542
1581
|
}
|
|
1543
1582
|
get baseURL() {
|
|
1544
|
-
const store = __privateMethod(this,
|
|
1583
|
+
const store = __privateMethod(this, _getConfig, getConfig_fn).call(this);
|
|
1545
1584
|
return store?.baseURL ?? getEnvVar("TRIGGER_API_URL") ?? "https://api.trigger.dev";
|
|
1546
1585
|
}
|
|
1547
1586
|
get accessToken() {
|
|
1548
|
-
const store = __privateMethod(this,
|
|
1549
|
-
return store?.
|
|
1587
|
+
const store = __privateMethod(this, _getConfig, getConfig_fn).call(this);
|
|
1588
|
+
return store?.secretKey ?? getEnvVar("TRIGGER_SECRET_KEY");
|
|
1550
1589
|
}
|
|
1551
1590
|
get client() {
|
|
1552
1591
|
if (!this.baseURL || !this.accessToken) {
|
|
@@ -1554,17 +1593,16 @@ var _ApiClientManager = class _ApiClientManager {
|
|
|
1554
1593
|
}
|
|
1555
1594
|
return new ApiClient(this.baseURL, this.accessToken);
|
|
1556
1595
|
}
|
|
1557
|
-
runWith(context2, fn) {
|
|
1558
|
-
return this._storage.runWith(context2, fn);
|
|
1559
|
-
}
|
|
1560
1596
|
};
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
return
|
|
1564
|
-
}, "#
|
|
1565
|
-
__name(
|
|
1566
|
-
var
|
|
1567
|
-
|
|
1597
|
+
_getConfig = new WeakSet();
|
|
1598
|
+
getConfig_fn = /* @__PURE__ */ __name(function() {
|
|
1599
|
+
return getGlobal(API_NAME2);
|
|
1600
|
+
}, "#getConfig");
|
|
1601
|
+
__name(_APIClientManagerAPI, "APIClientManagerAPI");
|
|
1602
|
+
var APIClientManagerAPI = _APIClientManagerAPI;
|
|
1603
|
+
|
|
1604
|
+
// src/v3/apiClientManager-api.ts
|
|
1605
|
+
var apiClientManager = APIClientManagerAPI.getInstance();
|
|
1568
1606
|
|
|
1569
1607
|
// src/v3/utils/ioSerialization.ts
|
|
1570
1608
|
async function parsePacket(value) {
|
|
@@ -2235,7 +2273,7 @@ __name(_SimpleClock, "SimpleClock");
|
|
|
2235
2273
|
var SimpleClock = _SimpleClock;
|
|
2236
2274
|
|
|
2237
2275
|
// src/v3/clock/index.ts
|
|
2238
|
-
var
|
|
2276
|
+
var API_NAME3 = "clock";
|
|
2239
2277
|
var SIMPLE_CLOCK = new SimpleClock();
|
|
2240
2278
|
var _getClock, getClock_fn;
|
|
2241
2279
|
var _ClockAPI = class _ClockAPI {
|
|
@@ -2249,7 +2287,7 @@ var _ClockAPI = class _ClockAPI {
|
|
|
2249
2287
|
return this._instance;
|
|
2250
2288
|
}
|
|
2251
2289
|
setGlobalClock(clock2) {
|
|
2252
|
-
return registerGlobal(
|
|
2290
|
+
return registerGlobal(API_NAME3, clock2);
|
|
2253
2291
|
}
|
|
2254
2292
|
preciseNow() {
|
|
2255
2293
|
return __privateMethod(this, _getClock, getClock_fn).call(this).preciseNow();
|
|
@@ -2260,7 +2298,7 @@ var _ClockAPI = class _ClockAPI {
|
|
|
2260
2298
|
};
|
|
2261
2299
|
_getClock = new WeakSet();
|
|
2262
2300
|
getClock_fn = /* @__PURE__ */ __name(function() {
|
|
2263
|
-
return getGlobal(
|
|
2301
|
+
return getGlobal(API_NAME3) ?? SIMPLE_CLOCK;
|
|
2264
2302
|
}, "#getClock");
|
|
2265
2303
|
__name(_ClockAPI, "ClockAPI");
|
|
2266
2304
|
var ClockAPI = _ClockAPI;
|
|
@@ -2273,7 +2311,6 @@ var logLevels = [
|
|
|
2273
2311
|
"none",
|
|
2274
2312
|
"error",
|
|
2275
2313
|
"warn",
|
|
2276
|
-
"log",
|
|
2277
2314
|
"info",
|
|
2278
2315
|
"debug"
|
|
2279
2316
|
];
|
|
@@ -2286,7 +2323,7 @@ var _OtelTaskLogger = class _OtelTaskLogger {
|
|
|
2286
2323
|
this._level = logLevels.indexOf(_config.level);
|
|
2287
2324
|
}
|
|
2288
2325
|
debug(message, properties) {
|
|
2289
|
-
if (this._level <
|
|
2326
|
+
if (this._level < 4)
|
|
2290
2327
|
return;
|
|
2291
2328
|
__privateMethod(this, _emitLog, emitLog_fn).call(this, message, __privateMethod(this, _getTimestampInHrTime, getTimestampInHrTime_fn).call(this), "debug", SeverityNumber.DEBUG, properties);
|
|
2292
2329
|
}
|
|
@@ -2296,7 +2333,7 @@ var _OtelTaskLogger = class _OtelTaskLogger {
|
|
|
2296
2333
|
__privateMethod(this, _emitLog, emitLog_fn).call(this, message, __privateMethod(this, _getTimestampInHrTime, getTimestampInHrTime_fn).call(this), "log", SeverityNumber.INFO, properties);
|
|
2297
2334
|
}
|
|
2298
2335
|
info(message, properties) {
|
|
2299
|
-
if (this._level <
|
|
2336
|
+
if (this._level < 3)
|
|
2300
2337
|
return;
|
|
2301
2338
|
__privateMethod(this, _emitLog, emitLog_fn).call(this, message, __privateMethod(this, _getTimestampInHrTime, getTimestampInHrTime_fn).call(this), "info", SeverityNumber.INFO, properties);
|
|
2302
2339
|
}
|