@trigger.dev/core 3.0.0-beta.27 → 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.
@@ -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
 
@@ -1409,19 +1408,6 @@ function requestInitWithCache(requestInit) {
1409
1408
  }
1410
1409
  }
1411
1410
  __name(requestInitWithCache, "requestInitWithCache");
1412
- var _SafeAsyncLocalStorage = class _SafeAsyncLocalStorage {
1413
- constructor() {
1414
- this.storage = new AsyncLocalStorage();
1415
- }
1416
- runWith(context2, fn) {
1417
- return this.storage.run(context2, fn);
1418
- }
1419
- getStore() {
1420
- return this.storage.getStore();
1421
- }
1422
- };
1423
- __name(_SafeAsyncLocalStorage, "SafeAsyncLocalStorage");
1424
- var SafeAsyncLocalStorage = _SafeAsyncLocalStorage;
1425
1411
 
1426
1412
  // src/v3/apiClient/index.ts
1427
1413
  var zodFetchOptions = {
@@ -1573,19 +1559,33 @@ getHeaders_fn = /* @__PURE__ */ __name(function(spanParentAsLink) {
1573
1559
  }, "#getHeaders");
1574
1560
  __name(_ApiClient, "ApiClient");
1575
1561
  var ApiClient = _ApiClient;
1576
- var _getStore, getStore_fn;
1577
- var _ApiClientManager = class _ApiClientManager {
1562
+
1563
+ // src/v3/apiClientManager/index.ts
1564
+ var API_NAME2 = "api-client";
1565
+ var _getConfig, getConfig_fn;
1566
+ var _APIClientManagerAPI = class _APIClientManagerAPI {
1578
1567
  constructor() {
1579
- __privateAdd(this, _getStore);
1580
- __publicField(this, "_storage", new SafeAsyncLocalStorage());
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);
1581
1581
  }
1582
1582
  get baseURL() {
1583
- const store = __privateMethod(this, _getStore, getStore_fn).call(this);
1583
+ const store = __privateMethod(this, _getConfig, getConfig_fn).call(this);
1584
1584
  return store?.baseURL ?? getEnvVar("TRIGGER_API_URL") ?? "https://api.trigger.dev";
1585
1585
  }
1586
1586
  get accessToken() {
1587
- const store = __privateMethod(this, _getStore, getStore_fn).call(this);
1588
- return store?.accessToken ?? getEnvVar("TRIGGER_SECRET_KEY");
1587
+ const store = __privateMethod(this, _getConfig, getConfig_fn).call(this);
1588
+ return store?.secretKey ?? getEnvVar("TRIGGER_SECRET_KEY");
1589
1589
  }
1590
1590
  get client() {
1591
1591
  if (!this.baseURL || !this.accessToken) {
@@ -1593,17 +1593,16 @@ var _ApiClientManager = class _ApiClientManager {
1593
1593
  }
1594
1594
  return new ApiClient(this.baseURL, this.accessToken);
1595
1595
  }
1596
- runWith(context2, fn) {
1597
- return this._storage.runWith(context2, fn);
1598
- }
1599
1596
  };
1600
- _getStore = new WeakSet();
1601
- getStore_fn = /* @__PURE__ */ __name(function() {
1602
- return this._storage.getStore();
1603
- }, "#getStore");
1604
- __name(_ApiClientManager, "ApiClientManager");
1605
- var ApiClientManager = _ApiClientManager;
1606
- var apiClientManager = new ApiClientManager();
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();
1607
1606
 
1608
1607
  // src/v3/utils/ioSerialization.ts
1609
1608
  async function parsePacket(value) {
@@ -2274,7 +2273,7 @@ __name(_SimpleClock, "SimpleClock");
2274
2273
  var SimpleClock = _SimpleClock;
2275
2274
 
2276
2275
  // src/v3/clock/index.ts
2277
- var API_NAME2 = "clock";
2276
+ var API_NAME3 = "clock";
2278
2277
  var SIMPLE_CLOCK = new SimpleClock();
2279
2278
  var _getClock, getClock_fn;
2280
2279
  var _ClockAPI = class _ClockAPI {
@@ -2288,7 +2287,7 @@ var _ClockAPI = class _ClockAPI {
2288
2287
  return this._instance;
2289
2288
  }
2290
2289
  setGlobalClock(clock2) {
2291
- return registerGlobal(API_NAME2, clock2);
2290
+ return registerGlobal(API_NAME3, clock2);
2292
2291
  }
2293
2292
  preciseNow() {
2294
2293
  return __privateMethod(this, _getClock, getClock_fn).call(this).preciseNow();
@@ -2299,7 +2298,7 @@ var _ClockAPI = class _ClockAPI {
2299
2298
  };
2300
2299
  _getClock = new WeakSet();
2301
2300
  getClock_fn = /* @__PURE__ */ __name(function() {
2302
- return getGlobal(API_NAME2) ?? SIMPLE_CLOCK;
2301
+ return getGlobal(API_NAME3) ?? SIMPLE_CLOCK;
2303
2302
  }, "#getClock");
2304
2303
  __name(_ClockAPI, "ClockAPI");
2305
2304
  var ClockAPI = _ClockAPI;