inngest 3.52.5 → 3.52.6

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.
Files changed (42) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/api/schema.d.cts +2 -2
  3. package/api/schema.d.cts.map +1 -1
  4. package/api/schema.d.ts +2 -2
  5. package/api/schema.d.ts.map +1 -1
  6. package/components/Fetch.js +5 -5
  7. package/components/Fetch.js.map +1 -1
  8. package/components/InngestCommHandler.js +2 -2
  9. package/components/InngestCommHandler.js.map +1 -1
  10. package/components/connect/buffer.js +2 -2
  11. package/components/connect/buffer.js.map +1 -1
  12. package/components/connect/index.js +2 -2
  13. package/components/connect/index.js.map +1 -1
  14. package/components/connect/strategies/core/BaseStrategy.js +2 -2
  15. package/components/connect/strategies/core/BaseStrategy.js.map +1 -1
  16. package/components/execution/InngestExecution.js +2 -2
  17. package/components/execution/InngestExecution.js.map +1 -1
  18. package/components/execution/otel/middleware.js +9 -9
  19. package/components/execution/otel/middleware.js.map +1 -1
  20. package/components/execution/otel/processor.js +9 -9
  21. package/components/execution/otel/processor.js.map +1 -1
  22. package/components/execution/v1.cjs +2 -0
  23. package/components/execution/v1.cjs.map +1 -1
  24. package/components/execution/v1.d.cts.map +1 -1
  25. package/components/execution/v1.d.ts.map +1 -1
  26. package/components/execution/v1.js +2 -0
  27. package/components/execution/v1.js.map +1 -1
  28. package/components/execution/v2.cjs +2 -1
  29. package/components/execution/v2.cjs.map +1 -1
  30. package/components/execution/v2.d.cts.map +1 -1
  31. package/components/execution/v2.d.ts.map +1 -1
  32. package/components/execution/v2.js +2 -1
  33. package/components/execution/v2.js.map +1 -1
  34. package/package.json +1 -1
  35. package/types.d.cts +1 -1
  36. package/types.d.ts +1 -1
  37. package/version.cjs +1 -1
  38. package/version.cjs.map +1 -1
  39. package/version.d.cts +1 -1
  40. package/version.d.ts +1 -1
  41. package/version.js +1 -1
  42. package/version.js.map +1 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # inngest
2
2
 
3
+ ## 3.52.6
4
+
5
+ ### Patch Changes
6
+
7
+ - [#1350](https://github.com/inngest/inngest-js/pull/1350) [`470fdb98`](https://github.com/inngest/inngest-js/commit/470fdb9845514b6597e0bd7c6db469d3808f6dcf) Thanks [@amh4r](https://github.com/amh4r)! - Fix false NESTING_STEPS error
8
+
9
+ - [#1356](https://github.com/inngest/inngest-js/pull/1356) [`2e961c21`](https://github.com/inngest/inngest-js/commit/2e961c2169a451d60c3a14e8b9cc19e19ad0dec6) Thanks [@amh4r](https://github.com/amh4r)! - Fix checkpointing maxRuntime causing function run hang
10
+
3
11
  ## 3.52.5
4
12
 
5
13
  ### Patch Changes
package/api/schema.d.cts CHANGED
@@ -7,11 +7,11 @@ declare const errorSchema: z.ZodObject<{
7
7
  error: z.ZodString;
8
8
  status: z.ZodNumber;
9
9
  }, "strip", z.ZodTypeAny, {
10
- error: string;
11
10
  status: number;
12
- }, {
13
11
  error: string;
12
+ }, {
14
13
  status: number;
14
+ error: string;
15
15
  }>;
16
16
  type ErrorResponse = z.infer<typeof errorSchema>;
17
17
  declare const stepsSchemas: {
@@ -1 +1 @@
1
- {"version":3,"file":"schema.d.cts","names":[],"sources":["../../src/api/schema.ts"],"sourcesContent":[],"mappings":";;;;;cAIa,aAAW,CAAA,CAAA;;EAAX,MAAA,aAGX;CAAA,EAAA,OAAA,cAAA,EAAA;;;;OAHsB,EAAA,MAAA;EAAA,MAAA,EAAA,MAAA;AAIxB,CAAA,CAAA;AAAyB,KAAb,aAAA,GAAgB,CAAA,CAAE,KAAL,CAAA,OAAkB,WAAlB,CAAA;AAAkB,cAsD9B,YAtD8B,EAAA;kBAAb,cAAA,YAAA,YAAA,cAAA,SAAA,EAAA,GAAA,EAAA,GAAA,CAAA,CAAA,CAAA,CAAA;EAAK,CAAA,cAAA,YAAA,YAAA,YAAA,CAAA,WAAA,CAAA,WAAA,CAAA,YAAA,CAAA;IAsDtB,IAAA,cAI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AAA,OAAA,GAAA,SAAA;IAAf,KAAE,CAAA,EAAA,GAAA;EAAK,CAAA,CAAA,CAAA,CAAA,cAAA,SAAA,EAAA;;;;;KAPvB,aAAA,WACJ,mBAAmB,CAAA,CAAE,cAAc,cAAc,MACvD;cAEW,aAAW,CAAA,CAAA,SAAA,CAAA,CAAA,WAAA,CAAA,CAAA,UAAA,CAAA,CAAA,WAAA,CAAA,CAAA,SAAA,mBAAA;KAGZ,aAAA,GAAgB,CAAA,CAAE,aAAa"}
package/api/schema.d.ts CHANGED
@@ -7,11 +7,11 @@ declare const errorSchema: z.ZodObject<{
7
7
  error: z.ZodString;
8
8
  status: z.ZodNumber;
9
9
  }, "strip", z.ZodTypeAny, {
10
- error: string;
11
10
  status: number;
12
- }, {
13
11
  error: string;
12
+ }, {
14
13
  status: number;
14
+ error: string;
15
15
  }>;
16
16
  type ErrorResponse = z.infer<typeof errorSchema>;
17
17
  declare const stepsSchemas: {
@@ -1 +1 @@
1
- {"version":3,"file":"schema.d.ts","names":[],"sources":["../../src/api/schema.ts"],"sourcesContent":[],"mappings":";;;;;cAIa,aAAW,CAAA,CAAA;;EAAX,MAAA,aAGX;CAAA,EAAA,OAAA,cAAA,EAAA;;;;OAHsB,EAAA,MAAA;EAAA,MAAA,EAAA,MAAA;AAIxB,CAAA,CAAA;AAAyB,KAAb,aAAA,GAAgB,CAAA,CAAE,KAAL,CAAA,OAAkB,WAAlB,CAAA;AAAkB,cAsD9B,YAtD8B,EAAA;kBAAb,cAAA,YAAA,YAAA,cAAA,SAAA,EAAA,GAAA,EAAA,GAAA,CAAA,CAAA,CAAA,CAAA;EAAK,CAAA,cAAA,YAAA,YAAA,YAAA,CAAA,WAAA,CAAA,WAAA,CAAA,YAAA,CAAA;IAsDtB,IAAA,cAIoC,cAAA,aAAA,CAAA,MAAA,CAAA,CAAA,CAAA;IAAA,IAAA,cAAA,SAAA,EAAA,GAAA,EAAA,GAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;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,CAAA,CAAE,cAAc,cAAc,MACvD;cAEW,aAAW,CAAA,CAAA,SAAA,CAAA,CAAA,WAAA,CAAA,CAAA,UAAA,CAAA,CAAA,WAAA,CAAA,CAAA,SAAA,mBAAA;KAGZ,aAAA,GAAgB,CAAA,CAAE,aAAa"}
@@ -1,26 +1,26 @@
1
1
  import { getAsyncCtx } from "./execution/als.js";
2
2
  import { gatewaySymbol } from "./InngestStepTools.js";
3
- import Debug from "debug";
3
+ import debug from "debug";
4
4
 
5
5
  //#region src/components/Fetch.ts
6
6
  const globalFetch = globalThis.fetch;
7
- const debug = Debug("inngest:fetch");
7
+ const debug$1 = debug("inngest:fetch");
8
8
  const createFetchShim = () => {
9
9
  let stepFetch;
10
10
  const fetch$1 = async (input, init) => {
11
11
  const ctx = await getAsyncCtx();
12
12
  if (!ctx?.execution) {
13
13
  if (!stepFetch.fallback) throw new Error("step.fetch() called outside of a function and had no fallback set");
14
- debug("step.fetch() called outside of a function; falling back to global fetch");
14
+ debug$1("step.fetch() called outside of a function; falling back to global fetch");
15
15
  return stepFetch.fallback(input, init);
16
16
  }
17
17
  if (ctx.execution.executingStep) {
18
18
  if (!stepFetch.fallback) throw new Error(`step.fetch() called inside step "${ctx.execution.executingStep.id}" and had no fallback set`);
19
- debug(`step.fetch() called inside step "${ctx.execution.executingStep.id}"; falling back to global fetch`);
19
+ debug$1(`step.fetch() called inside step "${ctx.execution.executingStep.id}"; falling back to global fetch`);
20
20
  return stepFetch.fallback(input, init);
21
21
  }
22
22
  const targetUrl = new URL(input instanceof Request ? input.url : input.toString());
23
- debug("step.fetch() shimming request to", targetUrl.hostname);
23
+ debug$1("step.fetch() shimming request to", targetUrl.hostname);
24
24
  const jsonRes = await ctx.execution.ctx.step[gatewaySymbol](`step.fetch: ${targetUrl.hostname}`, input, init);
25
25
  return new Response(jsonRes.body, {
26
26
  headers: jsonRes.headers,
@@ -1 +1 @@
1
- {"version":3,"file":"Fetch.js","names":["stepFetch: StepFetch","fetch: Fetch","optionsRef: StepFetch.Options","extras: StepFetch.Extras","fetch"],"sources":["../../src/components/Fetch.ts"],"sourcesContent":["import Debug from \"debug\";\nimport type { Simplify } from \"../helpers/types.ts\";\nimport { getAsyncCtx } from \"./execution/als.ts\";\nimport { gatewaySymbol, type InternalStepTools } from \"./InngestStepTools.ts\";\n\nconst globalFetch = globalThis.fetch;\ntype Fetch = typeof globalFetch;\n\nexport type StepFetch = Fetch &\n Simplify<\n {\n config: (options: StepFetch.Options) => StepFetch;\n } & Readonly<StepFetch.Options>\n >;\n\nexport namespace StepFetch {\n export interface Options {\n fallback?: Fetch | undefined;\n }\n\n export interface Extras extends Options {\n config: (options: Options) => StepFetch;\n }\n}\n\nconst debug = Debug(\"inngest:fetch\");\n\nconst createFetchShim = (): StepFetch => {\n // biome-ignore lint/style/useConst: need this to allow fns to be defined\n let stepFetch: StepFetch;\n\n const fetch: Fetch = async (input, init) => {\n const ctx = await getAsyncCtx();\n if (!ctx?.execution) {\n // Not in a function run\n if (!stepFetch.fallback) {\n // TODO Tell the user how to solve\n throw new Error(\n \"step.fetch() called outside of a function and had no fallback set\",\n );\n }\n\n debug(\n \"step.fetch() called outside of a function; falling back to global fetch\",\n );\n\n return stepFetch.fallback(input, init);\n }\n\n // In a function run\n if (ctx.execution.executingStep) {\n // Inside a step\n if (!stepFetch.fallback) {\n // TODO Tell the user how to solve\n throw new Error(\n `step.fetch() called inside step \"${ctx.execution.executingStep.id}\" and had no fallback set`,\n );\n }\n\n debug(\n `step.fetch() called inside step \"${ctx.execution.executingStep.id}\"; falling back to global fetch`,\n );\n\n return stepFetch.fallback(input, init);\n }\n\n // TODO Do we need to make this better with deferred (global) step tooling?\n // hmmmmm\n\n const targetUrl = new URL(\n input instanceof Request ? input.url : input.toString(),\n );\n\n debug(\"step.fetch() shimming request to\", targetUrl.hostname);\n\n // Purposefully do not try/cacth this; if it throws then we treat that as a\n // regular `fetch()` throw, which also would not return a `Response`.\n const jsonRes = await (ctx.execution.ctx.step as InternalStepTools)[\n gatewaySymbol\n ](`step.fetch: ${targetUrl.hostname}`, input, init);\n\n return new Response(jsonRes.body, {\n headers: jsonRes.headers,\n status: jsonRes.status_code,\n });\n };\n\n const optionsRef: StepFetch.Options = {\n fallback: globalFetch,\n };\n\n const extras: StepFetch.Extras = {\n config: (options) => {\n Object.assign(optionsRef, options);\n Object.assign(stepFetch, optionsRef);\n\n return stepFetch;\n },\n ...optionsRef,\n };\n\n stepFetch = Object.assign(fetch, extras);\n\n return stepFetch;\n};\n\n/**\n * `fetch` is a Fetch API-compatible function that can be used to make any HTTP\n * code durable if it's called within an Inngest function.\n *\n * It will gracefully fall back to the global `fetch` if called outside of this\n * context, and a custom fallback can be set using the `config` method.\n *\n * @example Basic usage\n * ```ts\n * import { fetch } from \"inngest\";\n *\n * const api = new MyProductApi({ fetch });\n * ```\n *\n * @example Setting a custom fallback\n * ```ts\n * import { fetch } from \"inngest\";\n *\n * const api = new MyProductApi({\n * fetch: fetch.config({ fallback: myCustomFetch }),\n * });\n * ```\n *\n * @example Do not allow fallback\n * ```ts\n * import { fetch } from \"inngest\";\n *\n * const api = new MyProductApi({\n * fetch: fetch.config({ fallback: undefined }),\n * });\n * ```\n */\nexport const fetch = createFetchShim();\n"],"mappings":";;;;;AAKA,MAAM,cAAc,WAAW;AAoB/B,MAAM,QAAQ,MAAM,gBAAgB;AAEpC,MAAM,wBAAmC;CAEvC,IAAIA;CAEJ,MAAMC,UAAe,OAAO,OAAO,SAAS;EAC1C,MAAM,MAAM,MAAM,aAAa;AAC/B,MAAI,CAAC,KAAK,WAAW;AAEnB,OAAI,CAAC,UAAU,SAEb,OAAM,IAAI,MACR,oEACD;AAGH,SACE,0EACD;AAED,UAAO,UAAU,SAAS,OAAO,KAAK;;AAIxC,MAAI,IAAI,UAAU,eAAe;AAE/B,OAAI,CAAC,UAAU,SAEb,OAAM,IAAI,MACR,oCAAoC,IAAI,UAAU,cAAc,GAAG,2BACpE;AAGH,SACE,oCAAoC,IAAI,UAAU,cAAc,GAAG,iCACpE;AAED,UAAO,UAAU,SAAS,OAAO,KAAK;;EAMxC,MAAM,YAAY,IAAI,IACpB,iBAAiB,UAAU,MAAM,MAAM,MAAM,UAAU,CACxD;AAED,QAAM,oCAAoC,UAAU,SAAS;EAI7D,MAAM,UAAU,MAAO,IAAI,UAAU,IAAI,KACvC,eACA,eAAe,UAAU,YAAY,OAAO,KAAK;AAEnD,SAAO,IAAI,SAAS,QAAQ,MAAM;GAChC,SAAS,QAAQ;GACjB,QAAQ,QAAQ;GACjB,CAAC;;CAGJ,MAAMC,aAAgC,EACpC,UAAU,aACX;CAED,MAAMC,SAA2B;EAC/B,SAAS,YAAY;AACnB,UAAO,OAAO,YAAY,QAAQ;AAClC,UAAO,OAAO,WAAW,WAAW;AAEpC,UAAO;;EAET,GAAG;EACJ;AAED,aAAY,OAAO,OAAOC,SAAO,OAAO;AAExC,QAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmCT,MAAa,QAAQ,iBAAiB"}
1
+ {"version":3,"file":"Fetch.js","names":["debug","Debug","stepFetch: StepFetch","fetch: Fetch","optionsRef: StepFetch.Options","extras: StepFetch.Extras","fetch"],"sources":["../../src/components/Fetch.ts"],"sourcesContent":["import Debug from \"debug\";\nimport type { Simplify } from \"../helpers/types.ts\";\nimport { getAsyncCtx } from \"./execution/als.ts\";\nimport { gatewaySymbol, type InternalStepTools } from \"./InngestStepTools.ts\";\n\nconst globalFetch = globalThis.fetch;\ntype Fetch = typeof globalFetch;\n\nexport type StepFetch = Fetch &\n Simplify<\n {\n config: (options: StepFetch.Options) => StepFetch;\n } & Readonly<StepFetch.Options>\n >;\n\nexport namespace StepFetch {\n export interface Options {\n fallback?: Fetch | undefined;\n }\n\n export interface Extras extends Options {\n config: (options: Options) => StepFetch;\n }\n}\n\nconst debug = Debug(\"inngest:fetch\");\n\nconst createFetchShim = (): StepFetch => {\n // biome-ignore lint/style/useConst: need this to allow fns to be defined\n let stepFetch: StepFetch;\n\n const fetch: Fetch = async (input, init) => {\n const ctx = await getAsyncCtx();\n if (!ctx?.execution) {\n // Not in a function run\n if (!stepFetch.fallback) {\n // TODO Tell the user how to solve\n throw new Error(\n \"step.fetch() called outside of a function and had no fallback set\",\n );\n }\n\n debug(\n \"step.fetch() called outside of a function; falling back to global fetch\",\n );\n\n return stepFetch.fallback(input, init);\n }\n\n // In a function run\n if (ctx.execution.executingStep) {\n // Inside a step\n if (!stepFetch.fallback) {\n // TODO Tell the user how to solve\n throw new Error(\n `step.fetch() called inside step \"${ctx.execution.executingStep.id}\" and had no fallback set`,\n );\n }\n\n debug(\n `step.fetch() called inside step \"${ctx.execution.executingStep.id}\"; falling back to global fetch`,\n );\n\n return stepFetch.fallback(input, init);\n }\n\n // TODO Do we need to make this better with deferred (global) step tooling?\n // hmmmmm\n\n const targetUrl = new URL(\n input instanceof Request ? input.url : input.toString(),\n );\n\n debug(\"step.fetch() shimming request to\", targetUrl.hostname);\n\n // Purposefully do not try/cacth this; if it throws then we treat that as a\n // regular `fetch()` throw, which also would not return a `Response`.\n const jsonRes = await (ctx.execution.ctx.step as InternalStepTools)[\n gatewaySymbol\n ](`step.fetch: ${targetUrl.hostname}`, input, init);\n\n return new Response(jsonRes.body, {\n headers: jsonRes.headers,\n status: jsonRes.status_code,\n });\n };\n\n const optionsRef: StepFetch.Options = {\n fallback: globalFetch,\n };\n\n const extras: StepFetch.Extras = {\n config: (options) => {\n Object.assign(optionsRef, options);\n Object.assign(stepFetch, optionsRef);\n\n return stepFetch;\n },\n ...optionsRef,\n };\n\n stepFetch = Object.assign(fetch, extras);\n\n return stepFetch;\n};\n\n/**\n * `fetch` is a Fetch API-compatible function that can be used to make any HTTP\n * code durable if it's called within an Inngest function.\n *\n * It will gracefully fall back to the global `fetch` if called outside of this\n * context, and a custom fallback can be set using the `config` method.\n *\n * @example Basic usage\n * ```ts\n * import { fetch } from \"inngest\";\n *\n * const api = new MyProductApi({ fetch });\n * ```\n *\n * @example Setting a custom fallback\n * ```ts\n * import { fetch } from \"inngest\";\n *\n * const api = new MyProductApi({\n * fetch: fetch.config({ fallback: myCustomFetch }),\n * });\n * ```\n *\n * @example Do not allow fallback\n * ```ts\n * import { fetch } from \"inngest\";\n *\n * const api = new MyProductApi({\n * fetch: fetch.config({ fallback: undefined }),\n * });\n * ```\n */\nexport const fetch = createFetchShim();\n"],"mappings":";;;;;AAKA,MAAM,cAAc,WAAW;AAoB/B,MAAMA,UAAQC,MAAM,gBAAgB;AAEpC,MAAM,wBAAmC;CAEvC,IAAIC;CAEJ,MAAMC,UAAe,OAAO,OAAO,SAAS;EAC1C,MAAM,MAAM,MAAM,aAAa;AAC/B,MAAI,CAAC,KAAK,WAAW;AAEnB,OAAI,CAAC,UAAU,SAEb,OAAM,IAAI,MACR,oEACD;AAGH,WACE,0EACD;AAED,UAAO,UAAU,SAAS,OAAO,KAAK;;AAIxC,MAAI,IAAI,UAAU,eAAe;AAE/B,OAAI,CAAC,UAAU,SAEb,OAAM,IAAI,MACR,oCAAoC,IAAI,UAAU,cAAc,GAAG,2BACpE;AAGH,WACE,oCAAoC,IAAI,UAAU,cAAc,GAAG,iCACpE;AAED,UAAO,UAAU,SAAS,OAAO,KAAK;;EAMxC,MAAM,YAAY,IAAI,IACpB,iBAAiB,UAAU,MAAM,MAAM,MAAM,UAAU,CACxD;AAED,UAAM,oCAAoC,UAAU,SAAS;EAI7D,MAAM,UAAU,MAAO,IAAI,UAAU,IAAI,KACvC,eACA,eAAe,UAAU,YAAY,OAAO,KAAK;AAEnD,SAAO,IAAI,SAAS,QAAQ,MAAM;GAChC,SAAS,QAAQ;GACjB,QAAQ,QAAQ;GACjB,CAAC;;CAGJ,MAAMC,aAAgC,EACpC,UAAU,aACX;CAED,MAAMC,SAA2B;EAC/B,SAAS,YAAY;AACnB,UAAO,OAAO,YAAY,QAAQ;AAClC,UAAO,OAAO,WAAW,WAAW;AAEpC,UAAO;;EAET,GAAG;EACJ;AAED,aAAY,OAAO,OAAOC,SAAO,OAAO;AAExC,QAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmCT,MAAa,QAAQ,iBAAiB"}
@@ -15,7 +15,7 @@ import { createStream } from "../helpers/stream.js";
15
15
  import { getAsyncCtx } from "./execution/als.js";
16
16
  import { InngestFunction } from "./InngestFunction.js";
17
17
  import { _internals } from "./execution/v1.js";
18
- import Debug from "debug";
18
+ import debug from "debug";
19
19
  import { z } from "zod/v3";
20
20
 
21
21
  //#region src/components/InngestCommHandler.ts
@@ -232,7 +232,7 @@ var InngestCommHandler = class {
232
232
  * the following `.enable()` call failing, so we just try carefully to
233
233
  * enable it here.
234
234
  */
235
- if (Debug.enable && typeof Debug.enable === "function") Debug.enable(`${debugPrefix}:*`);
235
+ if (debug.enable && typeof debug.enable === "function") debug.enable(`${debugPrefix}:*`);
236
236
  }
237
237
  const defaultStreamingOption = false;
238
238
  this.streaming = z.union([z.enum(["allow", "force"]), z.literal(false)]).default(defaultStreamingOption).catch((ctx) => {