@trigger.dev/core 3.0.0-beta.27 → 3.0.0-beta.29

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.
@@ -11,7 +11,6 @@ var sdkTraceNode = require('@opentelemetry/sdk-trace-node');
11
11
  var semanticConventions = require('@opentelemetry/semantic-conventions');
12
12
  var zod = require('zod');
13
13
  var zodValidationError = require('zod-validation-error');
14
- var async_hooks = require('async_hooks');
15
14
  var preciseDate = require('@google-cloud/precise-date');
16
15
  var util = require('util');
17
16
 
@@ -1415,19 +1414,6 @@ function requestInitWithCache(requestInit) {
1415
1414
  }
1416
1415
  }
1417
1416
  __name(requestInitWithCache, "requestInitWithCache");
1418
- var _SafeAsyncLocalStorage = class _SafeAsyncLocalStorage {
1419
- constructor() {
1420
- this.storage = new async_hooks.AsyncLocalStorage();
1421
- }
1422
- runWith(context2, fn) {
1423
- return this.storage.run(context2, fn);
1424
- }
1425
- getStore() {
1426
- return this.storage.getStore();
1427
- }
1428
- };
1429
- __name(_SafeAsyncLocalStorage, "SafeAsyncLocalStorage");
1430
- var SafeAsyncLocalStorage = _SafeAsyncLocalStorage;
1431
1417
 
1432
1418
  // src/v3/apiClient/index.ts
1433
1419
  var zodFetchOptions = {
@@ -1579,19 +1565,33 @@ getHeaders_fn = /* @__PURE__ */ __name(function(spanParentAsLink) {
1579
1565
  }, "#getHeaders");
1580
1566
  __name(_ApiClient, "ApiClient");
1581
1567
  var ApiClient = _ApiClient;
1582
- var _getStore, getStore_fn;
1583
- var _ApiClientManager = class _ApiClientManager {
1568
+
1569
+ // src/v3/apiClientManager/index.ts
1570
+ var API_NAME2 = "api-client";
1571
+ var _getConfig, getConfig_fn;
1572
+ var _APIClientManagerAPI = class _APIClientManagerAPI {
1584
1573
  constructor() {
1585
- __privateAdd(this, _getStore);
1586
- __publicField(this, "_storage", new SafeAsyncLocalStorage());
1574
+ __privateAdd(this, _getConfig);
1575
+ }
1576
+ static getInstance() {
1577
+ if (!this._instance) {
1578
+ this._instance = new _APIClientManagerAPI();
1579
+ }
1580
+ return this._instance;
1581
+ }
1582
+ disable() {
1583
+ unregisterGlobal(API_NAME2);
1584
+ }
1585
+ setGlobalAPIClientConfiguration(config) {
1586
+ return registerGlobal(API_NAME2, config);
1587
1587
  }
1588
1588
  get baseURL() {
1589
- const store = __privateMethod(this, _getStore, getStore_fn).call(this);
1589
+ const store = __privateMethod(this, _getConfig, getConfig_fn).call(this);
1590
1590
  return store?.baseURL ?? getEnvVar("TRIGGER_API_URL") ?? "https://api.trigger.dev";
1591
1591
  }
1592
1592
  get accessToken() {
1593
- const store = __privateMethod(this, _getStore, getStore_fn).call(this);
1594
- return store?.accessToken ?? getEnvVar("TRIGGER_SECRET_KEY");
1593
+ const store = __privateMethod(this, _getConfig, getConfig_fn).call(this);
1594
+ return store?.secretKey ?? getEnvVar("TRIGGER_SECRET_KEY");
1595
1595
  }
1596
1596
  get client() {
1597
1597
  if (!this.baseURL || !this.accessToken) {
@@ -1599,17 +1599,16 @@ var _ApiClientManager = class _ApiClientManager {
1599
1599
  }
1600
1600
  return new ApiClient(this.baseURL, this.accessToken);
1601
1601
  }
1602
- runWith(context2, fn) {
1603
- return this._storage.runWith(context2, fn);
1604
- }
1605
1602
  };
1606
- _getStore = new WeakSet();
1607
- getStore_fn = /* @__PURE__ */ __name(function() {
1608
- return this._storage.getStore();
1609
- }, "#getStore");
1610
- __name(_ApiClientManager, "ApiClientManager");
1611
- var ApiClientManager = _ApiClientManager;
1612
- var apiClientManager = new ApiClientManager();
1603
+ _getConfig = new WeakSet();
1604
+ getConfig_fn = /* @__PURE__ */ __name(function() {
1605
+ return getGlobal(API_NAME2);
1606
+ }, "#getConfig");
1607
+ __name(_APIClientManagerAPI, "APIClientManagerAPI");
1608
+ var APIClientManagerAPI = _APIClientManagerAPI;
1609
+
1610
+ // src/v3/apiClientManager-api.ts
1611
+ var apiClientManager = APIClientManagerAPI.getInstance();
1613
1612
 
1614
1613
  // src/v3/utils/ioSerialization.ts
1615
1614
  async function parsePacket(value) {
@@ -2280,7 +2279,7 @@ __name(_SimpleClock, "SimpleClock");
2280
2279
  var SimpleClock = _SimpleClock;
2281
2280
 
2282
2281
  // src/v3/clock/index.ts
2283
- var API_NAME2 = "clock";
2282
+ var API_NAME3 = "clock";
2284
2283
  var SIMPLE_CLOCK = new SimpleClock();
2285
2284
  var _getClock, getClock_fn;
2286
2285
  var _ClockAPI = class _ClockAPI {
@@ -2294,7 +2293,7 @@ var _ClockAPI = class _ClockAPI {
2294
2293
  return this._instance;
2295
2294
  }
2296
2295
  setGlobalClock(clock2) {
2297
- return registerGlobal(API_NAME2, clock2);
2296
+ return registerGlobal(API_NAME3, clock2);
2298
2297
  }
2299
2298
  preciseNow() {
2300
2299
  return __privateMethod(this, _getClock, getClock_fn).call(this).preciseNow();
@@ -2305,7 +2304,7 @@ var _ClockAPI = class _ClockAPI {
2305
2304
  };
2306
2305
  _getClock = new WeakSet();
2307
2306
  getClock_fn = /* @__PURE__ */ __name(function() {
2308
- return getGlobal(API_NAME2) ?? SIMPLE_CLOCK;
2307
+ return getGlobal(API_NAME3) ?? SIMPLE_CLOCK;
2309
2308
  }, "#getClock");
2310
2309
  __name(_ClockAPI, "ClockAPI");
2311
2310
  var ClockAPI = _ClockAPI;