@trigger.dev/sdk 0.0.0-cross-runtime-20231201154528 → 0.0.0-cross-runtime-20231201165423

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.mts CHANGED
@@ -3,6 +3,7 @@ import { AsyncMap, KeyValueStoreResponseBody, RunTaskBodyInput, CompleteTaskBody
3
3
  export { ConnectionAuth, DisplayProperty, EventFilter, Logger, NormalizedRequest, OverridableRunTaskOptions, Prettify, RedactString, RegisteredOptionsDiff, RunTaskOptions, SourceEventOption } from '@trigger.dev/core';
4
4
  import * as zod from 'zod';
5
5
  import { z, ZodType, TypeOf } from 'zod';
6
+ import { Buffer } from 'buffer';
6
7
  import { BinaryToTextEncoding, BinaryLike, KeyObject } from 'crypto';
7
8
 
8
9
  type QueryKeyValueStoreFunction = (action: "DELETE" | "GET" | "HAS" | "SET", data: {
@@ -1426,6 +1427,22 @@ declare class ConcurrencyLimit {
1426
1427
  get limit(): number;
1427
1428
  }
1428
1429
 
1430
+ declare class KeyValueStore {
1431
+ #private;
1432
+ private apiClient;
1433
+ private type;
1434
+ private namespace;
1435
+ constructor(apiClient: ApiClient, type?: string | null, namespace?: string);
1436
+ delete(cacheKey: string | any[], key: string): Promise<boolean>;
1437
+ delete(key: string): Promise<boolean>;
1438
+ get<T extends Json<T> = any>(cacheKey: string | any[], key: string): Promise<T>;
1439
+ get<T extends Json<T> = any>(key: string): Promise<T>;
1440
+ has(cacheKey: string | any[], key: string): Promise<boolean>;
1441
+ has(key: string): Promise<boolean>;
1442
+ set<T extends Json<T>>(cacheKey: string | any[], key: string, value: T): Promise<T>;
1443
+ set<T extends Json<T>>(key: string, value: T): Promise<T>;
1444
+ }
1445
+
1429
1446
  type WebhookCRUDContext<TParams extends any, TConfig extends Record<string, string[]>> = {
1430
1447
  active: boolean;
1431
1448
  params: TParams;
@@ -1561,22 +1578,6 @@ declare class WebhookTrigger<TEventSpecification extends EventSpecification<any>
1561
1578
  }>;
1562
1579
  }
1563
1580
 
1564
- declare class KeyValueStore {
1565
- #private;
1566
- private apiClient;
1567
- private type;
1568
- private namespace;
1569
- constructor(apiClient: ApiClient, type?: string | null, namespace?: string);
1570
- delete(cacheKey: string | any[], key: string): Promise<boolean>;
1571
- delete(key: string): Promise<boolean>;
1572
- get<T extends Json<T> = any>(cacheKey: string | any[], key: string): Promise<T>;
1573
- get<T extends Json<T> = any>(key: string): Promise<T>;
1574
- has(cacheKey: string | any[], key: string): Promise<boolean>;
1575
- has(key: string): Promise<boolean>;
1576
- set<T extends Json<T>>(cacheKey: string | any[], key: string, value: T): Promise<T>;
1577
- set<T extends Json<T>>(key: string, value: T): Promise<T>;
1578
- }
1579
-
1580
1581
  type TriggerClientOptions = {
1581
1582
  /** The `id` property is used to uniquely identify the client.
1582
1583
  */
package/dist/index.d.ts CHANGED
@@ -3,6 +3,7 @@ import { AsyncMap, KeyValueStoreResponseBody, RunTaskBodyInput, CompleteTaskBody
3
3
  export { ConnectionAuth, DisplayProperty, EventFilter, Logger, NormalizedRequest, OverridableRunTaskOptions, Prettify, RedactString, RegisteredOptionsDiff, RunTaskOptions, SourceEventOption } from '@trigger.dev/core';
4
4
  import * as zod from 'zod';
5
5
  import { z, ZodType, TypeOf } from 'zod';
6
+ import { Buffer } from 'buffer';
6
7
  import { BinaryToTextEncoding, BinaryLike, KeyObject } from 'crypto';
7
8
 
8
9
  type QueryKeyValueStoreFunction = (action: "DELETE" | "GET" | "HAS" | "SET", data: {
@@ -1426,6 +1427,22 @@ declare class ConcurrencyLimit {
1426
1427
  get limit(): number;
1427
1428
  }
1428
1429
 
1430
+ declare class KeyValueStore {
1431
+ #private;
1432
+ private apiClient;
1433
+ private type;
1434
+ private namespace;
1435
+ constructor(apiClient: ApiClient, type?: string | null, namespace?: string);
1436
+ delete(cacheKey: string | any[], key: string): Promise<boolean>;
1437
+ delete(key: string): Promise<boolean>;
1438
+ get<T extends Json<T> = any>(cacheKey: string | any[], key: string): Promise<T>;
1439
+ get<T extends Json<T> = any>(key: string): Promise<T>;
1440
+ has(cacheKey: string | any[], key: string): Promise<boolean>;
1441
+ has(key: string): Promise<boolean>;
1442
+ set<T extends Json<T>>(cacheKey: string | any[], key: string, value: T): Promise<T>;
1443
+ set<T extends Json<T>>(key: string, value: T): Promise<T>;
1444
+ }
1445
+
1429
1446
  type WebhookCRUDContext<TParams extends any, TConfig extends Record<string, string[]>> = {
1430
1447
  active: boolean;
1431
1448
  params: TParams;
@@ -1561,22 +1578,6 @@ declare class WebhookTrigger<TEventSpecification extends EventSpecification<any>
1561
1578
  }>;
1562
1579
  }
1563
1580
 
1564
- declare class KeyValueStore {
1565
- #private;
1566
- private apiClient;
1567
- private type;
1568
- private namespace;
1569
- constructor(apiClient: ApiClient, type?: string | null, namespace?: string);
1570
- delete(cacheKey: string | any[], key: string): Promise<boolean>;
1571
- delete(key: string): Promise<boolean>;
1572
- get<T extends Json<T> = any>(cacheKey: string | any[], key: string): Promise<T>;
1573
- get<T extends Json<T> = any>(key: string): Promise<T>;
1574
- has(cacheKey: string | any[], key: string): Promise<boolean>;
1575
- has(key: string): Promise<boolean>;
1576
- set<T extends Json<T>>(cacheKey: string | any[], key: string, value: T): Promise<T>;
1577
- set<T extends Json<T>>(key: string, value: T): Promise<T>;
1578
- }
1579
-
1580
1581
  type TriggerClientOptions = {
1581
1582
  /** The `id` property is used to uniquely identify the client.
1582
1583
  */
package/dist/index.js CHANGED
@@ -304,9 +304,11 @@ var Job = _Job;
304
304
 
305
305
  // src/triggerClient.ts
306
306
  var import_core8 = require("@trigger.dev/core");
307
+ var import_node_process2 = require("node:process");
307
308
 
308
309
  // src/apiClient.ts
309
310
  var import_core3 = require("@trigger.dev/core");
311
+ var import_node_process = require("node:process");
310
312
  var import_zod3 = require("zod");
311
313
 
312
314
  // src/io.ts
@@ -625,6 +627,7 @@ __name(_KeyValueStore, "KeyValueStore");
625
627
  var KeyValueStore = _KeyValueStore;
626
628
 
627
629
  // src/io.ts
630
+ var import_node_buffer = require("node:buffer");
628
631
  var _JSONOutputSerializer = class _JSONOutputSerializer {
629
632
  serialize(value) {
630
633
  return JSON.stringify(value);
@@ -1744,8 +1747,8 @@ async function generateIdempotencyKey(keyMaterial) {
1744
1747
  return stableStringify(key2);
1745
1748
  });
1746
1749
  const key = keys.join(":");
1747
- const hash = await import_node_crypto.webcrypto.subtle.digest("SHA-256", Buffer.from(key));
1748
- return Buffer.from(hash).toString("hex");
1750
+ const hash = await import_node_crypto.webcrypto.subtle.digest("SHA-256", import_node_buffer.Buffer.from(key));
1751
+ return import_node_buffer.Buffer.from(hash).toString("hex");
1749
1752
  }
1750
1753
  __name(generateIdempotencyKey, "generateIdempotencyKey");
1751
1754
  function stableStringify(obj) {
@@ -1900,7 +1903,7 @@ var _ApiClient = class _ApiClient {
1900
1903
  __privateAdd(this, _logger, void 0);
1901
1904
  __privateAdd(this, _storeClient, void 0);
1902
1905
  __privateSet(this, _options, options);
1903
- __privateSet(this, _apiUrl, __privateGet(this, _options).apiUrl ?? process.env.TRIGGER_API_URL ?? "https://api.trigger.dev");
1906
+ __privateSet(this, _apiUrl, __privateGet(this, _options).apiUrl ?? import_node_process.env.TRIGGER_API_URL ?? "https://api.trigger.dev");
1904
1907
  __privateSet(this, _logger, new import_core3.Logger("trigger.dev", __privateGet(this, _options).logLevel));
1905
1908
  __privateSet(this, _storeClient, new KeyValueStoreClient(__privateMethod(this, _queryKeyValueStore, queryKeyValueStore_fn).bind(this)));
1906
1909
  }
@@ -2338,7 +2341,7 @@ apiKey_fn = /* @__PURE__ */ __name(async function() {
2338
2341
  __name(_ApiClient, "ApiClient");
2339
2342
  var ApiClient = _ApiClient;
2340
2343
  function getApiKey(key) {
2341
- const apiKey = key ?? process.env.TRIGGER_API_KEY;
2344
+ const apiKey = key ?? import_node_process.env.TRIGGER_API_KEY;
2342
2345
  if (!apiKey) {
2343
2346
  return {
2344
2347
  status: "missing"
@@ -3003,7 +3006,7 @@ var DynamicSchedule = _DynamicSchedule;
3003
3006
  var import_node_events = __toESM(require("node:events"));
3004
3007
 
3005
3008
  // package.json
3006
- var version = "0.0.0-cross-runtime-20231201154528";
3009
+ var version = "0.0.0-cross-runtime-20231201165423";
3007
3010
 
3008
3011
  // src/concurrencyLimit.ts
3009
3012
  var _ConcurrencyLimit = class _ConcurrencyLimit {
@@ -3766,14 +3769,14 @@ var _TriggerClient = class _TriggerClient {
3766
3769
  if (typeof apiKey !== "string") {
3767
3770
  return "missing-header";
3768
3771
  }
3769
- const localApiKey = __privateGet(this, _options4).apiKey ?? process.env.TRIGGER_API_KEY;
3772
+ const localApiKey = __privateGet(this, _options4).apiKey ?? import_node_process2.env.TRIGGER_API_KEY;
3770
3773
  if (!localApiKey) {
3771
3774
  return "missing-client";
3772
3775
  }
3773
3776
  return apiKey === localApiKey ? "authorized" : "unauthorized";
3774
3777
  }
3775
3778
  apiKey() {
3776
- return __privateGet(this, _options4).apiKey ?? process.env.TRIGGER_API_KEY;
3779
+ return __privateGet(this, _options4).apiKey ?? import_node_process2.env.TRIGGER_API_KEY;
3777
3780
  }
3778
3781
  };
3779
3782
  _options4 = new WeakMap();