@trigger.dev/sdk 0.0.0-cross-runtime-20231201164903 → 0.0.0-cross-runtime-20231201165945

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: {
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: {
package/dist/index.js CHANGED
@@ -627,6 +627,7 @@ __name(_KeyValueStore, "KeyValueStore");
627
627
  var KeyValueStore = _KeyValueStore;
628
628
 
629
629
  // src/io.ts
630
+ var import_node_buffer = require("node:buffer");
630
631
  var _JSONOutputSerializer = class _JSONOutputSerializer {
631
632
  serialize(value) {
632
633
  return JSON.stringify(value);
@@ -1746,8 +1747,8 @@ async function generateIdempotencyKey(keyMaterial) {
1746
1747
  return stableStringify(key2);
1747
1748
  });
1748
1749
  const key = keys.join(":");
1749
- const hash = await import_node_crypto.webcrypto.subtle.digest("SHA-256", Buffer.from(key));
1750
- 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");
1751
1752
  }
1752
1753
  __name(generateIdempotencyKey, "generateIdempotencyKey");
1753
1754
  function stableStringify(obj) {
@@ -2360,10 +2361,7 @@ function getApiKey(key) {
2360
2361
  }
2361
2362
  __name(getApiKey, "getApiKey");
2362
2363
  async function zodfetchWithVersions(versionedSchemaMap, unversionedSchema, url, requestInit, options, retryCount = 0) {
2363
- const response = await fetch(url, {
2364
- ...requestInit,
2365
- cache: "no-cache"
2366
- });
2364
+ const response = await fetch(url, requestInitWithCache(requestInit));
2367
2365
  if ((!requestInit || requestInit.method === "GET") && response.status === 404 && options?.optional) {
2368
2366
  return;
2369
2367
  }
@@ -2397,15 +2395,23 @@ async function zodfetchWithVersions(versionedSchemaMap, unversionedSchema, url,
2397
2395
  };
2398
2396
  }
2399
2397
  __name(zodfetchWithVersions, "zodfetchWithVersions");
2398
+ function requestInitWithCache(requestInit) {
2399
+ try {
2400
+ return {
2401
+ ...requestInit,
2402
+ cache: "no-cache"
2403
+ };
2404
+ } catch (error) {
2405
+ return requestInit ?? {};
2406
+ }
2407
+ }
2408
+ __name(requestInitWithCache, "requestInitWithCache");
2400
2409
  async function fetchHead(url, requestInitWithoutMethod, retryCount = 0) {
2401
2410
  const requestInit = {
2402
2411
  ...requestInitWithoutMethod,
2403
2412
  method: "HEAD"
2404
2413
  };
2405
- const response = await fetch(url, {
2406
- ...requestInit,
2407
- cache: "no-cache"
2408
- });
2414
+ const response = await fetch(url, requestInitWithCache(requestInit));
2409
2415
  if (response.status >= 500 && retryCount < 6) {
2410
2416
  const delay = exponentialBackoff(retryCount + 1, 2, 50, 1150, 50);
2411
2417
  await new Promise((resolve) => setTimeout(resolve, delay));
@@ -2415,10 +2421,7 @@ async function fetchHead(url, requestInitWithoutMethod, retryCount = 0) {
2415
2421
  }
2416
2422
  __name(fetchHead, "fetchHead");
2417
2423
  async function zodfetch(schema, url, requestInit, options, retryCount = 0) {
2418
- const response = await fetch(url, {
2419
- ...requestInit,
2420
- cache: "no-cache"
2421
- });
2424
+ const response = await fetch(url, requestInitWithCache(requestInit));
2422
2425
  if ((!requestInit || requestInit.method === "GET") && response.status === 404 && options?.optional) {
2423
2426
  return;
2424
2427
  }
@@ -3005,7 +3008,7 @@ var DynamicSchedule = _DynamicSchedule;
3005
3008
  var import_node_events = __toESM(require("node:events"));
3006
3009
 
3007
3010
  // package.json
3008
- var version = "0.0.0-cross-runtime-20231201164903";
3011
+ var version = "0.0.0-cross-runtime-20231201165945";
3009
3012
 
3010
3013
  // src/concurrencyLimit.ts
3011
3014
  var _ConcurrencyLimit = class _ConcurrencyLimit {