inngest 4.12.0 → 4.13.0
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/CHANGELOG.md +12 -0
- package/api/schema.d.cts +2 -2
- package/api/schema.d.ts +2 -2
- package/components/execution/InngestExecution.cjs.map +1 -1
- package/components/execution/InngestExecution.d.cts +3 -1
- package/components/execution/InngestExecution.d.cts.map +1 -1
- package/components/execution/InngestExecution.d.ts +3 -1
- package/components/execution/InngestExecution.d.ts.map +1 -1
- package/components/execution/InngestExecution.js.map +1 -1
- package/components/execution/engine.cjs +52 -11
- package/components/execution/engine.cjs.map +1 -1
- package/components/execution/engine.d.cts +3 -1
- package/components/execution/engine.d.cts.map +1 -1
- package/components/execution/engine.d.ts +3 -1
- package/components/execution/engine.d.ts.map +1 -1
- package/components/execution/engine.js +52 -11
- package/components/execution/engine.js.map +1 -1
- package/components/execution/lazyOps.cjs +3 -0
- package/components/execution/lazyOps.cjs.map +1 -1
- package/components/execution/lazyOps.js +4 -1
- package/components/execution/lazyOps.js.map +1 -1
- package/components/execution/otel/middleware.d.cts +5 -5
- package/components/execution/otel/middleware.d.ts +5 -5
- package/components/execution/otel/processor.cjs +3 -2
- package/components/execution/otel/processor.cjs.map +1 -1
- package/components/execution/otel/processor.d.cts +2 -2
- package/components/execution/otel/processor.d.cts.map +1 -1
- package/components/execution/otel/processor.d.ts +2 -2
- package/components/execution/otel/processor.d.ts.map +1 -1
- package/components/execution/otel/processor.js +3 -2
- package/components/execution/otel/processor.js.map +1 -1
- package/components/realtime/types.d.cts +7 -7
- package/components/realtime/types.d.cts.map +1 -1
- package/components/realtime/types.d.ts +7 -7
- package/components/realtime/types.d.ts.map +1 -1
- package/helpers/functions.cjs +1 -1
- package/helpers/functions.cjs.map +1 -1
- package/helpers/functions.js +1 -1
- package/helpers/functions.js.map +1 -1
- package/package.json +1 -1
- package/types.cjs.map +1 -1
- package/types.d.cts +41 -28
- package/types.d.cts.map +1 -1
- package/types.d.ts +41 -28
- package/types.d.ts.map +1 -1
- package/types.js.map +1 -1
- package/version.cjs +1 -1
- package/version.cjs.map +1 -1
- package/version.d.cts +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/version.js.map +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# inngest
|
|
2
2
|
|
|
3
|
+
## 4.13.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#1630](https://github.com/inngest/inngest-js/pull/1630) [`7b5907e4`](https://github.com/inngest/inngest-js/commit/7b5907e44f9662cd64c45ede8802d0d2d42dc8c3) Thanks [@Linell](https://github.com/Linell)! - Added support for aborting deferred runs via defer().abort()
|
|
8
|
+
|
|
9
|
+
## 4.12.1
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [#1622](https://github.com/inngest/inngest-js/pull/1622) [`0706a1f5`](https://github.com/inngest/inngest-js/commit/0706a1f51316e0748b3b24c0e9bca864233e75c0) Thanks [@amh4r](https://github.com/amh4r)! - Fix step.run not JSON-serializing during checkpointing
|
|
14
|
+
|
|
3
15
|
## 4.12.0
|
|
4
16
|
|
|
5
17
|
### Minor Changes
|
package/api/schema.d.cts
CHANGED
|
@@ -27,8 +27,8 @@ declare const stepSchema: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnion<[z.Zo
|
|
|
27
27
|
error: z.ZodType<JsonError, z.ZodTypeDef, JsonError>;
|
|
28
28
|
}, "strict", z.ZodTypeAny, {
|
|
29
29
|
error: {
|
|
30
|
-
name?: string | undefined;
|
|
31
30
|
error?: string | undefined;
|
|
31
|
+
name?: string | undefined;
|
|
32
32
|
message?: string | undefined;
|
|
33
33
|
stack?: string | undefined;
|
|
34
34
|
} & {
|
|
@@ -39,8 +39,8 @@ declare const stepSchema: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnion<[z.Zo
|
|
|
39
39
|
type: "error";
|
|
40
40
|
}, {
|
|
41
41
|
error: {
|
|
42
|
-
name?: string | undefined;
|
|
43
42
|
error?: string | undefined;
|
|
43
|
+
name?: string | undefined;
|
|
44
44
|
message?: string | undefined;
|
|
45
45
|
stack?: string | undefined;
|
|
46
46
|
} & {
|
package/api/schema.d.ts
CHANGED
|
@@ -27,8 +27,8 @@ declare const stepSchema: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnion<[z.Zo
|
|
|
27
27
|
error: z.ZodType<JsonError, z.ZodTypeDef, JsonError>;
|
|
28
28
|
}, "strict", z.ZodTypeAny, {
|
|
29
29
|
error: {
|
|
30
|
-
name?: string | undefined;
|
|
31
30
|
error?: string | undefined;
|
|
31
|
+
name?: string | undefined;
|
|
32
32
|
message?: string | undefined;
|
|
33
33
|
stack?: string | undefined;
|
|
34
34
|
} & {
|
|
@@ -39,8 +39,8 @@ declare const stepSchema: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnion<[z.Zo
|
|
|
39
39
|
type: "error";
|
|
40
40
|
}, {
|
|
41
41
|
error: {
|
|
42
|
-
name?: string | undefined;
|
|
43
42
|
error?: string | undefined;
|
|
43
|
+
name?: string | undefined;
|
|
44
44
|
message?: string | undefined;
|
|
45
45
|
stack?: string | undefined;
|
|
46
46
|
} & {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InngestExecution.cjs","names":["ExecutionVersion","options: InngestExecutionOptions","debugPrefix"],"sources":["../../../src/components/execution/InngestExecution.ts"],"sourcesContent":["import Debug, { type Debugger } from \"debug\";\nimport { debugPrefix, ExecutionVersion } from \"../../helpers/consts.ts\";\nimport type { ServerTiming } from \"../../helpers/ServerTiming.ts\";\nimport type { MaybePromise, Simplify } from \"../../helpers/types.ts\";\nimport type {\n Context,\n IncomingOp,\n InternalCheckpointingOptions,\n OutgoingOp,\n StepMode,\n} from \"../../types.ts\";\nimport type { Inngest } from \"../Inngest.ts\";\nimport type { ActionResponse } from \"../InngestCommHandler.ts\";\nimport type { InngestFunction } from \"../InngestFunction.ts\";\nimport type {\n MetadataKind,\n MetadataOpcode,\n MetadataScope,\n} from \"../InngestMetadata.ts\";\nimport type { Middleware } from \"../middleware/middleware.ts\";\n\n// Re-export ExecutionVersion so it's correctly recognized as an enum and not\n// just a type. This can be lost when bundling if we don't re-export it here.\n// See `pnpm run test:dist`.\nexport { ExecutionVersion };\n\n/**\n * The possible results of an execution.\n */\nexport interface ExecutionResults {\n \"function-resolved\": { data: unknown };\n \"step-ran\": { step: OutgoingOp; retriable?: boolean | string };\n \"function-rejected\": { error: unknown; retriable: boolean | string };\n \"steps-found\": { steps: [OutgoingOp, ...OutgoingOp[]] };\n \"step-not-found\": {\n step: OutgoingOp;\n foundSteps: BasicFoundStep[];\n totalFoundSteps: number;\n };\n\n /**\n * Indicates that we need to relinquish control back to Inngest in order to\n * change step modes.\n */\n \"change-mode\": {\n to: StepMode;\n token: string;\n };\n}\n\nexport type ExecutionResult = {\n [K in keyof ExecutionResults]: Simplify<\n {\n type: K;\n ctx: Context.Any;\n ops: Record<string, MemoizedOp>;\n } & ExecutionResults[K]\n >;\n}[keyof ExecutionResults];\n\nexport interface BasicFoundStep {\n id: string;\n displayName?: string;\n}\n\nexport type ExecutionResultHandler<T = ActionResponse> = (\n result: ExecutionResult,\n) => MaybePromise<T>;\n\nexport type ExecutionResultHandlers<T = ActionResponse> = {\n [E in ExecutionResult as E[\"type\"]]: (result: E) => MaybePromise<T>;\n};\n\nexport interface MemoizedOp extends IncomingOp {\n /**\n * If the step has been hit during this run, these will be the arguments\n * passed to it.\n */\n rawArgs?: unknown[];\n fulfilled?: boolean;\n\n /**\n * The promise that has been returned to userland code.\n */\n promise?: Promise<unknown>;\n seen?: boolean;\n}\n\n/**\n * The preferred execution version that will be used by the SDK when handling\n * brand new runs where the Executor is allowing us to choose.\n *\n * Changing this should not ever be a breaking change, as this will only change\n * new runs, not existing ones.\n */\nexport const PREFERRED_ASYNC_EXECUTION_VERSION =\n ExecutionVersion.V2 satisfies ExecutionVersion;\n\n/**\n * Options for creating a new {@link InngestExecution} instance.\n */\nexport interface InngestExecutionOptions {\n client: Inngest.Any;\n fn: InngestFunction.Any;\n\n /**\n * The UUID that represents this function in Inngest.\n *\n * This is used to reference the function during async checkpointing, when we\n * know the function/run already exists and just wish to reference it\n * directly.\n */\n internalFnId?: string;\n reqArgs: unknown[];\n runId: string;\n data: Omit<Context.Any, \"step\" | \"group\" | \"publish\" | \"defer\">;\n stepState: Record<string, MemoizedOp>;\n\n /**\n * A map of hashed defer step IDs to their backend-side metadata\n * (e.g. `{ abortable: true }`). Defer ops are not steps in the\n * memoization sense — they don't produce results — but the backend\n * tracks which ones it has already received so the SDK can avoid\n * re-emitting them on replay.\n */\n priorDefers?: Record<string,
|
|
1
|
+
{"version":3,"file":"InngestExecution.cjs","names":["ExecutionVersion","options: InngestExecutionOptions","debugPrefix"],"sources":["../../../src/components/execution/InngestExecution.ts"],"sourcesContent":["import Debug, { type Debugger } from \"debug\";\nimport { debugPrefix, ExecutionVersion } from \"../../helpers/consts.ts\";\nimport type { ServerTiming } from \"../../helpers/ServerTiming.ts\";\nimport type { MaybePromise, Simplify } from \"../../helpers/types.ts\";\nimport type {\n Context,\n IncomingOp,\n InternalCheckpointingOptions,\n OutgoingOp,\n StepMode,\n} from \"../../types.ts\";\nimport type { Inngest } from \"../Inngest.ts\";\nimport type { ActionResponse } from \"../InngestCommHandler.ts\";\nimport type { InngestFunction } from \"../InngestFunction.ts\";\nimport type {\n MetadataKind,\n MetadataOpcode,\n MetadataScope,\n} from \"../InngestMetadata.ts\";\nimport type { Middleware } from \"../middleware/middleware.ts\";\n\n// Re-export ExecutionVersion so it's correctly recognized as an enum and not\n// just a type. This can be lost when bundling if we don't re-export it here.\n// See `pnpm run test:dist`.\nexport { ExecutionVersion };\n\n/**\n * The possible results of an execution.\n */\nexport interface ExecutionResults {\n \"function-resolved\": { data: unknown };\n \"step-ran\": { step: OutgoingOp; retriable?: boolean | string };\n \"function-rejected\": { error: unknown; retriable: boolean | string };\n \"steps-found\": { steps: [OutgoingOp, ...OutgoingOp[]] };\n \"step-not-found\": {\n step: OutgoingOp;\n foundSteps: BasicFoundStep[];\n totalFoundSteps: number;\n };\n\n /**\n * Indicates that we need to relinquish control back to Inngest in order to\n * change step modes.\n */\n \"change-mode\": {\n to: StepMode;\n token: string;\n };\n}\n\nexport type ExecutionResult = {\n [K in keyof ExecutionResults]: Simplify<\n {\n type: K;\n ctx: Context.Any;\n ops: Record<string, MemoizedOp>;\n } & ExecutionResults[K]\n >;\n}[keyof ExecutionResults];\n\nexport interface BasicFoundStep {\n id: string;\n displayName?: string;\n}\n\nexport type ExecutionResultHandler<T = ActionResponse> = (\n result: ExecutionResult,\n) => MaybePromise<T>;\n\nexport type ExecutionResultHandlers<T = ActionResponse> = {\n [E in ExecutionResult as E[\"type\"]]: (result: E) => MaybePromise<T>;\n};\n\nexport interface MemoizedOp extends IncomingOp {\n /**\n * If the step has been hit during this run, these will be the arguments\n * passed to it.\n */\n rawArgs?: unknown[];\n fulfilled?: boolean;\n\n /**\n * The promise that has been returned to userland code.\n */\n promise?: Promise<unknown>;\n seen?: boolean;\n}\n\n/**\n * The preferred execution version that will be used by the SDK when handling\n * brand new runs where the Executor is allowing us to choose.\n *\n * Changing this should not ever be a breaking change, as this will only change\n * new runs, not existing ones.\n */\nexport const PREFERRED_ASYNC_EXECUTION_VERSION =\n ExecutionVersion.V2 satisfies ExecutionVersion;\n\n/**\n * Options for creating a new {@link InngestExecution} instance.\n */\nexport interface InngestExecutionOptions {\n client: Inngest.Any;\n fn: InngestFunction.Any;\n\n /**\n * The UUID that represents this function in Inngest.\n *\n * This is used to reference the function during async checkpointing, when we\n * know the function/run already exists and just wish to reference it\n * directly.\n */\n internalFnId?: string;\n reqArgs: unknown[];\n runId: string;\n data: Omit<Context.Any, \"step\" | \"group\" | \"publish\" | \"defer\">;\n stepState: Record<string, MemoizedOp>;\n\n /**\n * A map of hashed defer step IDs to their backend-side metadata\n * (e.g. `{ abortable: true }`). Defer ops are not steps in the\n * memoization sense — they don't produce results — but the backend\n * tracks which ones it has already received so the SDK can avoid\n * re-emitting them on replay.\n */\n priorDefers?: Record<string, { abortable?: boolean }>;\n\n stepCompletionOrder: string[];\n stepMode: StepMode;\n checkpointingConfig?: InternalCheckpointingOptions;\n\n /**\n * If this execution is being run from a queue job, this will be an identifier\n * used to reference this execution in Inngest. SDKs are expected to parrot\n * this back in some responses to correctly attribute actions to this queue\n * item.\n */\n queueItemId?: string;\n\n /**\n * Unique identifier for each execution request\n */\n requestId?: string;\n\n /**\n * Incrementing ID used to denote the generation in which this job was queued\n */\n generationId?: number;\n\n /**\n * Time the SDK starts handling an execution request. Format is unix millis.\n */\n requestStartedAt?: number;\n\n /**\n * Headers to be sent with any request to Inngest during this execution.\n */\n headers: Record<string, string>;\n requestedRunStep?: string;\n timer?: ServerTiming;\n /**\n * Which handler variant is being executed. `\"failure\"` skips\n * trigger-schema validation and resolves `onFailure` instead of the\n * main handler. `\"defer\"` marks the fn as a standalone defer function\n * (created via `createDefer`); incoming event data is validated\n * against the defer function's schema.\n *\n * @default \"main\"\n */\n handlerKind?: \"main\" | \"failure\" | \"defer\";\n\n /**\n * Whether this execution is part of a Durable Endpoint flow. Could be either\n * sync mode (request not from Inngest) or async mode (request from Inngest).\n *\n * @default false\n */\n isDurableEndpoint?: boolean;\n\n disableImmediateExecution?: boolean;\n\n /**\n * Information about the incoming HTTP request that triggered this execution.\n * Used by middleware `wrapRequest` hooks.\n */\n requestInfo?: Middleware.Request;\n\n /**\n * Pre-created middleware instances to use for this execution. When provided,\n * the execution will use these instead of instantiating new ones from the\n * client. This ensures `wrapRequest` and other hooks share state on `this`.\n */\n middlewareInstances?: Middleware.BaseMiddleware[];\n\n /**\n * Whether the client accepts SSE (`Accept: text/event-stream`). When true,\n * the execution engine may deliver the result as an SSE stream even if\n * `stream.push()` was not called.\n */\n acceptsSse?: boolean;\n\n /**\n * Provide the ability to transform the context passed to the function before\n * the execution starts.\n */\n transformCtx?: (ctx: Readonly<Context.Any>) => Context.Any;\n\n /**\n * A hook that is called to create an {@link ActionResponse} from the returned\n * value of an execution.\n *\n * This is required for checkpointing executions.\n */\n createResponse?: (data: unknown) => MaybePromise<ActionResponse>;\n}\n\nexport type InngestExecutionFactory = (\n options: InngestExecutionOptions,\n) => IInngestExecution;\n\nexport class InngestExecution {\n protected devDebug: Debugger;\n\n constructor(protected options: InngestExecutionOptions) {\n this.devDebug = Debug(`${debugPrefix}:${this.options.runId}`);\n }\n}\n\nexport interface IInngestExecution {\n version: ExecutionVersion;\n start(): Promise<ExecutionResult>;\n\n addMetadata(\n stepId: string,\n kind: MetadataKind,\n scope: MetadataScope,\n op: MetadataOpcode,\n values: Record<string, unknown>,\n ): boolean;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AA+FA,MAAa,oCACXA,gCAAiB;AA4HnB,IAAa,mBAAb,MAA8B;CAC5B,AAAU;CAEV,YAAY,AAAUC,SAAkC;EAAlC;AACpB,OAAK,8BAAiB,GAAGC,2BAAY,GAAG,KAAK,QAAQ,QAAQ"}
|
|
@@ -102,7 +102,9 @@ interface InngestExecutionOptions {
|
|
|
102
102
|
* tracks which ones it has already received so the SDK can avoid
|
|
103
103
|
* re-emitting them on replay.
|
|
104
104
|
*/
|
|
105
|
-
priorDefers?: Record<string,
|
|
105
|
+
priorDefers?: Record<string, {
|
|
106
|
+
abortable?: boolean;
|
|
107
|
+
}>;
|
|
106
108
|
stepCompletionOrder: string[];
|
|
107
109
|
stepMode: StepMode;
|
|
108
110
|
checkpointingConfig?: InternalCheckpointingOptions;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InngestExecution.d.cts","names":[],"sources":["../../../src/components/execution/InngestExecution.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;;;;;;;;;UA6BiB,gBAAA;;;;;UAEK;;;;;;;;IAFL,KAAA,EAAA,CAIU,UAJM,EAAA,GAIS,UAJT,EAAA,CAAA;E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mB,UAJI,CAAA;;;;;SACc,CAAA,EAAA,OAAA,EAAA;EAAY,SAAA,CAAA,EAAA,OAAA;EAGjD;;;SAAmB,CAAA,EAWxB,OAXwB,CAAA,OAAA,CAAA;EAAU,IAAA,CAAA,EAAA,OAAA;AAsB9C;AAMA;;;;;;;AAea,cArBA,iCAAA,GAqBA,gBAAA,CAAA,EAAA;;;;AAyCF,UAxDM,uBAAA,CAwDN;QAED,EAzDA,OAAA,CAAQ,GAyDR;MAxDJ,eAAA,CAAgB,GAkFK;;;;;;;;EA+Bf,YAAA,CAAA,EAAA,MAAA;EAAuB,OAAA,EAAA,OAAA,EAAA;OACxB,EAAA,MAAA;MACN,EAvGG,IAuGH,CAvGQ,OAAA,CAAQ,GAuGhB,EAAA,MAAA,GAAA,OAAA,GAAA,SAAA,GAAA,OAAA,CAAA;EAAiB,SAAA,EAtGT,MAsGS,CAAA,MAAA,EAtGM,UAsGN,CAAA;EAET;;;;;;AAQb;EAAkC,WAAA,CAAA,EAvGlB,MAuGkB,CAAA,MAAA,EAAA;IACvB,SAAA,CAAA,EAAA,OAAA;;qBACA,EAAA,MAAA,EAAA;UAID,EA1GE,QA0GF;qBACC,CAAA,EA1Ga,4BA0Gb;;;;;;;;;;;;;;;;;;;;;;;WA9EA;;UAED;;;;;;;;;;;;;;;;;;;;;;;gBA0BM,UAAA,CAAW;;;;;;wBAOH,UAAA,CAAW;;;;;;;;;;;uBAaZ,SAAS,OAAA,CAAQ,SAAS,OAAA,CAAQ;;;;;;;sCAQnB,aAAa;;KAGvC,uBAAA,aACD,4BACN;cAEQ,gBAAA;qBAGoB;sBAFX;uBAEW;;UAKhB,iBAAA;WACN;WACA,QAAQ;oCAIT,qBACC,mBACH,wBACI"}
|
|
@@ -102,7 +102,9 @@ interface InngestExecutionOptions {
|
|
|
102
102
|
* tracks which ones it has already received so the SDK can avoid
|
|
103
103
|
* re-emitting them on replay.
|
|
104
104
|
*/
|
|
105
|
-
priorDefers?: Record<string,
|
|
105
|
+
priorDefers?: Record<string, {
|
|
106
|
+
abortable?: boolean;
|
|
107
|
+
}>;
|
|
106
108
|
stepCompletionOrder: string[];
|
|
107
109
|
stepMode: StepMode;
|
|
108
110
|
checkpointingConfig?: InternalCheckpointingOptions;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InngestExecution.d.ts","names":[],"sources":["../../../src/components/execution/InngestExecution.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;;;;;;;;;UA6BiB,gBAAA;;;;;UAEK;;;;;;;;IAFL,KAAA,EAAA,CAIU,UAJM,EAAA,GAIS,UAJT,EAAA,CAAA;EAAA,CAAA;kBAEX,EAAA;IAEK,IAAA,EAEjB,UAFiB;IAAe,UAAA,EAG1B,cAH0B,EAAA;IAEhC,eAAA,EAAA,MAAA;;;;AAeV;;eACc,EAAA;IAEF,EAAA,EARJ,QAQI;IACD,KAAA,EAAQ,MAAA;;;AAEX,KANI,eAAA,GAMJ,QAAiB,MALX,gBAKW,GALQ,QAKR,CAAA;EALQ,IAAA,EAErB,CAFqB;EAOzB,GAAA,EAJG,OAAA,CAAQ,GAIX;EAAgB,GAAA,EAHb,MAGa,CAAA,MAAA,EAHE,UAGF,CAAA;AAEP,CAAA,GAJT,gBAIuB,CAJN,CAIM,CAAA,CAAA,EAK/B,CAAA,MAPQ,gBAOI,CAAA;AAAsB,UALjB,cAAA,CAKiB;MAAK,MAAA;aAC7B,CAAA,EAAA,MAAA;;AACL,KAFO,sBAEP,CAAA,IAFkC,cAElC,CAAA,GAAA,CAAA,MAAA,EADK,eACL,EAAA,GAAA,YAAA,CAAa,CAAb,CAAA;AAAY,KAEL,uBAFK,CAAA,IAEuB,cAFvB,CAAA,GAAA,QAGT,eADI,IACe,CADQ,CAAA,MAAA,CAAA,GAAA,CAAA,MAAA,EACa,CADb,EAAA,GACmB,YADnB,CACgC,CADhC,CAAA,EAAA;AAAK,UAIvB,UAAA,SAAmB,UAJI,CAAA;;;;;SACc,CAAA,EAAA,OAAA,E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;wBAOH,UAAA,CAAW;;;;;;;;;;;uBAaZ,SAAS,OAAA,CAAQ,SAAS,OAAA,CAAQ;;;;;;;sCAQnB,aAAa;;KAGvC,uBAAA,aACD,4BACN;cAEQ,gBAAA;qBAGoB;sBAFX;uBAEW;;UAKhB,iBAAA;WACN;WACA,QAAQ;oCAIT,qBACC,mBACH,wBACI"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InngestExecution.js","names":["options: InngestExecutionOptions"],"sources":["../../../src/components/execution/InngestExecution.ts"],"sourcesContent":["import Debug, { type Debugger } from \"debug\";\nimport { debugPrefix, ExecutionVersion } from \"../../helpers/consts.ts\";\nimport type { ServerTiming } from \"../../helpers/ServerTiming.ts\";\nimport type { MaybePromise, Simplify } from \"../../helpers/types.ts\";\nimport type {\n Context,\n IncomingOp,\n InternalCheckpointingOptions,\n OutgoingOp,\n StepMode,\n} from \"../../types.ts\";\nimport type { Inngest } from \"../Inngest.ts\";\nimport type { ActionResponse } from \"../InngestCommHandler.ts\";\nimport type { InngestFunction } from \"../InngestFunction.ts\";\nimport type {\n MetadataKind,\n MetadataOpcode,\n MetadataScope,\n} from \"../InngestMetadata.ts\";\nimport type { Middleware } from \"../middleware/middleware.ts\";\n\n// Re-export ExecutionVersion so it's correctly recognized as an enum and not\n// just a type. This can be lost when bundling if we don't re-export it here.\n// See `pnpm run test:dist`.\nexport { ExecutionVersion };\n\n/**\n * The possible results of an execution.\n */\nexport interface ExecutionResults {\n \"function-resolved\": { data: unknown };\n \"step-ran\": { step: OutgoingOp; retriable?: boolean | string };\n \"function-rejected\": { error: unknown; retriable: boolean | string };\n \"steps-found\": { steps: [OutgoingOp, ...OutgoingOp[]] };\n \"step-not-found\": {\n step: OutgoingOp;\n foundSteps: BasicFoundStep[];\n totalFoundSteps: number;\n };\n\n /**\n * Indicates that we need to relinquish control back to Inngest in order to\n * change step modes.\n */\n \"change-mode\": {\n to: StepMode;\n token: string;\n };\n}\n\nexport type ExecutionResult = {\n [K in keyof ExecutionResults]: Simplify<\n {\n type: K;\n ctx: Context.Any;\n ops: Record<string, MemoizedOp>;\n } & ExecutionResults[K]\n >;\n}[keyof ExecutionResults];\n\nexport interface BasicFoundStep {\n id: string;\n displayName?: string;\n}\n\nexport type ExecutionResultHandler<T = ActionResponse> = (\n result: ExecutionResult,\n) => MaybePromise<T>;\n\nexport type ExecutionResultHandlers<T = ActionResponse> = {\n [E in ExecutionResult as E[\"type\"]]: (result: E) => MaybePromise<T>;\n};\n\nexport interface MemoizedOp extends IncomingOp {\n /**\n * If the step has been hit during this run, these will be the arguments\n * passed to it.\n */\n rawArgs?: unknown[];\n fulfilled?: boolean;\n\n /**\n * The promise that has been returned to userland code.\n */\n promise?: Promise<unknown>;\n seen?: boolean;\n}\n\n/**\n * The preferred execution version that will be used by the SDK when handling\n * brand new runs where the Executor is allowing us to choose.\n *\n * Changing this should not ever be a breaking change, as this will only change\n * new runs, not existing ones.\n */\nexport const PREFERRED_ASYNC_EXECUTION_VERSION =\n ExecutionVersion.V2 satisfies ExecutionVersion;\n\n/**\n * Options for creating a new {@link InngestExecution} instance.\n */\nexport interface InngestExecutionOptions {\n client: Inngest.Any;\n fn: InngestFunction.Any;\n\n /**\n * The UUID that represents this function in Inngest.\n *\n * This is used to reference the function during async checkpointing, when we\n * know the function/run already exists and just wish to reference it\n * directly.\n */\n internalFnId?: string;\n reqArgs: unknown[];\n runId: string;\n data: Omit<Context.Any, \"step\" | \"group\" | \"publish\" | \"defer\">;\n stepState: Record<string, MemoizedOp>;\n\n /**\n * A map of hashed defer step IDs to their backend-side metadata\n * (e.g. `{ abortable: true }`). Defer ops are not steps in the\n * memoization sense — they don't produce results — but the backend\n * tracks which ones it has already received so the SDK can avoid\n * re-emitting them on replay.\n */\n priorDefers?: Record<string,
|
|
1
|
+
{"version":3,"file":"InngestExecution.js","names":["options: InngestExecutionOptions"],"sources":["../../../src/components/execution/InngestExecution.ts"],"sourcesContent":["import Debug, { type Debugger } from \"debug\";\nimport { debugPrefix, ExecutionVersion } from \"../../helpers/consts.ts\";\nimport type { ServerTiming } from \"../../helpers/ServerTiming.ts\";\nimport type { MaybePromise, Simplify } from \"../../helpers/types.ts\";\nimport type {\n Context,\n IncomingOp,\n InternalCheckpointingOptions,\n OutgoingOp,\n StepMode,\n} from \"../../types.ts\";\nimport type { Inngest } from \"../Inngest.ts\";\nimport type { ActionResponse } from \"../InngestCommHandler.ts\";\nimport type { InngestFunction } from \"../InngestFunction.ts\";\nimport type {\n MetadataKind,\n MetadataOpcode,\n MetadataScope,\n} from \"../InngestMetadata.ts\";\nimport type { Middleware } from \"../middleware/middleware.ts\";\n\n// Re-export ExecutionVersion so it's correctly recognized as an enum and not\n// just a type. This can be lost when bundling if we don't re-export it here.\n// See `pnpm run test:dist`.\nexport { ExecutionVersion };\n\n/**\n * The possible results of an execution.\n */\nexport interface ExecutionResults {\n \"function-resolved\": { data: unknown };\n \"step-ran\": { step: OutgoingOp; retriable?: boolean | string };\n \"function-rejected\": { error: unknown; retriable: boolean | string };\n \"steps-found\": { steps: [OutgoingOp, ...OutgoingOp[]] };\n \"step-not-found\": {\n step: OutgoingOp;\n foundSteps: BasicFoundStep[];\n totalFoundSteps: number;\n };\n\n /**\n * Indicates that we need to relinquish control back to Inngest in order to\n * change step modes.\n */\n \"change-mode\": {\n to: StepMode;\n token: string;\n };\n}\n\nexport type ExecutionResult = {\n [K in keyof ExecutionResults]: Simplify<\n {\n type: K;\n ctx: Context.Any;\n ops: Record<string, MemoizedOp>;\n } & ExecutionResults[K]\n >;\n}[keyof ExecutionResults];\n\nexport interface BasicFoundStep {\n id: string;\n displayName?: string;\n}\n\nexport type ExecutionResultHandler<T = ActionResponse> = (\n result: ExecutionResult,\n) => MaybePromise<T>;\n\nexport type ExecutionResultHandlers<T = ActionResponse> = {\n [E in ExecutionResult as E[\"type\"]]: (result: E) => MaybePromise<T>;\n};\n\nexport interface MemoizedOp extends IncomingOp {\n /**\n * If the step has been hit during this run, these will be the arguments\n * passed to it.\n */\n rawArgs?: unknown[];\n fulfilled?: boolean;\n\n /**\n * The promise that has been returned to userland code.\n */\n promise?: Promise<unknown>;\n seen?: boolean;\n}\n\n/**\n * The preferred execution version that will be used by the SDK when handling\n * brand new runs where the Executor is allowing us to choose.\n *\n * Changing this should not ever be a breaking change, as this will only change\n * new runs, not existing ones.\n */\nexport const PREFERRED_ASYNC_EXECUTION_VERSION =\n ExecutionVersion.V2 satisfies ExecutionVersion;\n\n/**\n * Options for creating a new {@link InngestExecution} instance.\n */\nexport interface InngestExecutionOptions {\n client: Inngest.Any;\n fn: InngestFunction.Any;\n\n /**\n * The UUID that represents this function in Inngest.\n *\n * This is used to reference the function during async checkpointing, when we\n * know the function/run already exists and just wish to reference it\n * directly.\n */\n internalFnId?: string;\n reqArgs: unknown[];\n runId: string;\n data: Omit<Context.Any, \"step\" | \"group\" | \"publish\" | \"defer\">;\n stepState: Record<string, MemoizedOp>;\n\n /**\n * A map of hashed defer step IDs to their backend-side metadata\n * (e.g. `{ abortable: true }`). Defer ops are not steps in the\n * memoization sense — they don't produce results — but the backend\n * tracks which ones it has already received so the SDK can avoid\n * re-emitting them on replay.\n */\n priorDefers?: Record<string, { abortable?: boolean }>;\n\n stepCompletionOrder: string[];\n stepMode: StepMode;\n checkpointingConfig?: InternalCheckpointingOptions;\n\n /**\n * If this execution is being run from a queue job, this will be an identifier\n * used to reference this execution in Inngest. SDKs are expected to parrot\n * this back in some responses to correctly attribute actions to this queue\n * item.\n */\n queueItemId?: string;\n\n /**\n * Unique identifier for each execution request\n */\n requestId?: string;\n\n /**\n * Incrementing ID used to denote the generation in which this job was queued\n */\n generationId?: number;\n\n /**\n * Time the SDK starts handling an execution request. Format is unix millis.\n */\n requestStartedAt?: number;\n\n /**\n * Headers to be sent with any request to Inngest during this execution.\n */\n headers: Record<string, string>;\n requestedRunStep?: string;\n timer?: ServerTiming;\n /**\n * Which handler variant is being executed. `\"failure\"` skips\n * trigger-schema validation and resolves `onFailure` instead of the\n * main handler. `\"defer\"` marks the fn as a standalone defer function\n * (created via `createDefer`); incoming event data is validated\n * against the defer function's schema.\n *\n * @default \"main\"\n */\n handlerKind?: \"main\" | \"failure\" | \"defer\";\n\n /**\n * Whether this execution is part of a Durable Endpoint flow. Could be either\n * sync mode (request not from Inngest) or async mode (request from Inngest).\n *\n * @default false\n */\n isDurableEndpoint?: boolean;\n\n disableImmediateExecution?: boolean;\n\n /**\n * Information about the incoming HTTP request that triggered this execution.\n * Used by middleware `wrapRequest` hooks.\n */\n requestInfo?: Middleware.Request;\n\n /**\n * Pre-created middleware instances to use for this execution. When provided,\n * the execution will use these instead of instantiating new ones from the\n * client. This ensures `wrapRequest` and other hooks share state on `this`.\n */\n middlewareInstances?: Middleware.BaseMiddleware[];\n\n /**\n * Whether the client accepts SSE (`Accept: text/event-stream`). When true,\n * the execution engine may deliver the result as an SSE stream even if\n * `stream.push()` was not called.\n */\n acceptsSse?: boolean;\n\n /**\n * Provide the ability to transform the context passed to the function before\n * the execution starts.\n */\n transformCtx?: (ctx: Readonly<Context.Any>) => Context.Any;\n\n /**\n * A hook that is called to create an {@link ActionResponse} from the returned\n * value of an execution.\n *\n * This is required for checkpointing executions.\n */\n createResponse?: (data: unknown) => MaybePromise<ActionResponse>;\n}\n\nexport type InngestExecutionFactory = (\n options: InngestExecutionOptions,\n) => IInngestExecution;\n\nexport class InngestExecution {\n protected devDebug: Debugger;\n\n constructor(protected options: InngestExecutionOptions) {\n this.devDebug = Debug(`${debugPrefix}:${this.options.runId}`);\n }\n}\n\nexport interface IInngestExecution {\n version: ExecutionVersion;\n start(): Promise<ExecutionResult>;\n\n addMetadata(\n stepId: string,\n kind: MetadataKind,\n scope: MetadataScope,\n op: MetadataOpcode,\n values: Record<string, unknown>,\n ): boolean;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AA+FA,MAAa,oCACX,iBAAiB;AA4HnB,IAAa,mBAAb,MAA8B;CAC5B,AAAU;CAEV,YAAY,AAAUA,SAAkC;EAAlC;AACpB,OAAK,WAAW,MAAM,GAAG,YAAY,GAAG,KAAK,QAAQ,QAAQ"}
|
|
@@ -9,6 +9,7 @@ const require_types$1 = require('../../helpers/types.cjs');
|
|
|
9
9
|
const require_functions = require('../../helpers/functions.cjs');
|
|
10
10
|
const require_marker = require('../../helpers/marker.cjs');
|
|
11
11
|
const require_temporal = require('../../helpers/temporal.cjs');
|
|
12
|
+
const require_strings = require('../../helpers/strings.cjs');
|
|
12
13
|
const require_promises = require('../../helpers/promises.cjs');
|
|
13
14
|
const require_als = require('./als.cjs');
|
|
14
15
|
const require_aiExtractor = require('./otel/aiExtractor.cjs');
|
|
@@ -556,7 +557,7 @@ var InngestExecutionEngine = class extends require_InngestExecution.InngestExecu
|
|
|
556
557
|
delete this.state.executingStep;
|
|
557
558
|
this.state.checkpointingStepBuffer.push({
|
|
558
559
|
...stepToResume,
|
|
559
|
-
data:
|
|
560
|
+
data: stepToResume.data
|
|
560
561
|
});
|
|
561
562
|
}
|
|
562
563
|
if (force || !this.options.checkpointingConfig?.bufferedSteps || this.state.checkpointingStepBuffer.length >= this.options.checkpointingConfig.bufferedSteps) {
|
|
@@ -1488,45 +1489,48 @@ var InngestExecutionEngine = class extends require_InngestExecution.InngestExecu
|
|
|
1488
1489
|
return (idOrOptions, { function: deferFn, data, experiment }) => {
|
|
1489
1490
|
const log = this.options.client[require_Inngest.internalLoggerSymbol];
|
|
1490
1491
|
const runId = this.fnArg.runId;
|
|
1492
|
+
const noopHandle = { abort: () => {} };
|
|
1491
1493
|
try {
|
|
1492
1494
|
if (!require_marker.isDeferredFunction(deferFn)) {
|
|
1493
1495
|
log.error({ runId }, "defer skipped: function not created via createDefer");
|
|
1494
|
-
return;
|
|
1496
|
+
return noopHandle;
|
|
1495
1497
|
}
|
|
1496
1498
|
const { schema } = deferFn;
|
|
1497
1499
|
const deferFnSlug = deferFn.id(this.options.client.id);
|
|
1500
|
+
const stepOptions = require_InngestStepTools.getStepOptions(idOrOptions);
|
|
1501
|
+
const hashedId = _internals.hashId(stepOptions.id);
|
|
1498
1502
|
let input = data;
|
|
1499
1503
|
if (schema) {
|
|
1500
1504
|
const result = schema["~standard"].validate(data);
|
|
1501
1505
|
if (result instanceof Promise) {
|
|
1502
1506
|
log.error({ runId }, "defer() requires a synchronous schema validator. The defer call was skipped.");
|
|
1503
|
-
return;
|
|
1507
|
+
return noopHandle;
|
|
1504
1508
|
}
|
|
1505
1509
|
if (result.issues) {
|
|
1506
1510
|
log.error({
|
|
1507
1511
|
runId,
|
|
1508
1512
|
issues: result.issues
|
|
1509
1513
|
}, "defer skipped: schema validation failed");
|
|
1510
|
-
return;
|
|
1514
|
+
return noopHandle;
|
|
1511
1515
|
}
|
|
1512
1516
|
input = result.value ?? data;
|
|
1513
1517
|
}
|
|
1514
1518
|
stepHandler({
|
|
1515
|
-
args: [
|
|
1519
|
+
args: [stepOptions, experiment && require_types$1.isRecord(input) ? {
|
|
1516
1520
|
...input,
|
|
1517
1521
|
[require_consts.deferExperimentKey]: experiment
|
|
1518
1522
|
} : input],
|
|
1519
|
-
matchOp: (stepOptions, inputArg) => ({
|
|
1520
|
-
id: stepOptions.id,
|
|
1523
|
+
matchOp: (stepOptions$1, inputArg) => ({
|
|
1524
|
+
id: stepOptions$1.id,
|
|
1521
1525
|
mode: require_types.StepMode.Sync,
|
|
1522
1526
|
op: require_types.StepOpCode.DeferAdd,
|
|
1523
|
-
name: stepOptions.name ?? stepOptions.id,
|
|
1524
|
-
displayName: stepOptions.name ?? stepOptions.id,
|
|
1527
|
+
name: stepOptions$1.name ?? stepOptions$1.id,
|
|
1528
|
+
displayName: stepOptions$1.name ?? stepOptions$1.id,
|
|
1525
1529
|
opts: {
|
|
1526
1530
|
fn_slug: deferFnSlug,
|
|
1527
1531
|
input: inputArg
|
|
1528
1532
|
},
|
|
1529
|
-
userland: { id: stepOptions.id }
|
|
1533
|
+
userland: { id: stepOptions$1.id }
|
|
1530
1534
|
})
|
|
1531
1535
|
}).catch((err) => {
|
|
1532
1536
|
log.error({
|
|
@@ -1534,11 +1538,48 @@ var InngestExecutionEngine = class extends require_InngestExecution.InngestExecu
|
|
|
1534
1538
|
err
|
|
1535
1539
|
}, "defer skipped: unexpected error");
|
|
1536
1540
|
});
|
|
1541
|
+
return { abort: () => {
|
|
1542
|
+
try {
|
|
1543
|
+
if (this.state.priorDefers[hashedId]?.abortable === false) return;
|
|
1544
|
+
const abortId = `${hashedId}:abort`;
|
|
1545
|
+
if (this.state.lazyOps.hasId(_internals.hashId(abortId))) return;
|
|
1546
|
+
stepHandler({
|
|
1547
|
+
args: [{
|
|
1548
|
+
id: abortId,
|
|
1549
|
+
name: stepOptions.name
|
|
1550
|
+
}, null],
|
|
1551
|
+
matchOp: (abortStepOptions) => ({
|
|
1552
|
+
id: abortStepOptions.id,
|
|
1553
|
+
mode: require_types.StepMode.Sync,
|
|
1554
|
+
op: require_types.StepOpCode.DeferAbort,
|
|
1555
|
+
name: stepOptions.name ?? stepOptions.id,
|
|
1556
|
+
displayName: stepOptions.name ?? stepOptions.id,
|
|
1557
|
+
opts: {
|
|
1558
|
+
target_hashed_id: hashedId,
|
|
1559
|
+
fn_slug: deferFnSlug,
|
|
1560
|
+
id: stepOptions.id
|
|
1561
|
+
},
|
|
1562
|
+
userland: { id: stepOptions.id }
|
|
1563
|
+
})
|
|
1564
|
+
}).catch((err) => {
|
|
1565
|
+
log.error({
|
|
1566
|
+
runId,
|
|
1567
|
+
err
|
|
1568
|
+
}, "defer abort skipped: unexpected error");
|
|
1569
|
+
});
|
|
1570
|
+
} catch (err) {
|
|
1571
|
+
log.error({
|
|
1572
|
+
runId,
|
|
1573
|
+
err
|
|
1574
|
+
}, "defer abort skipped: unexpected error");
|
|
1575
|
+
}
|
|
1576
|
+
} };
|
|
1537
1577
|
} catch (err) {
|
|
1538
1578
|
log.error({
|
|
1539
1579
|
runId,
|
|
1540
1580
|
err
|
|
1541
1581
|
}, "defer skipped: unexpected error");
|
|
1582
|
+
return noopHandle;
|
|
1542
1583
|
}
|
|
1543
1584
|
};
|
|
1544
1585
|
}
|
|
@@ -1608,7 +1649,7 @@ var InngestExecutionEngine = class extends require_InngestExecution.InngestExecu
|
|
|
1608
1649
|
resumeStepWithResult(resultOp, resume = true) {
|
|
1609
1650
|
const userlandStep = this.state.steps.get(resultOp.id);
|
|
1610
1651
|
if (!userlandStep) throw new Error("Step not found in memoization state during async checkpointing; this should never happen and is a bug in the Inngest SDK");
|
|
1611
|
-
userlandStep.data = require_functions.undefinedToNull(resultOp.data);
|
|
1652
|
+
userlandStep.data = JSON.parse(require_strings.stringify(require_functions.undefinedToNull(resultOp.data)));
|
|
1612
1653
|
userlandStep.timing = resultOp.timing;
|
|
1613
1654
|
userlandStep.op = resultOp.op;
|
|
1614
1655
|
userlandStep.id = resultOp.id;
|