inngest 2.4.2-pr-294.2 → 2.5.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 +24 -0
- package/components/Inngest.d.ts +6 -26
- package/components/Inngest.d.ts.map +1 -1
- package/components/Inngest.js.map +1 -1
- package/components/InngestCommHandler.d.ts +8 -9
- package/components/InngestCommHandler.d.ts.map +1 -1
- package/components/InngestCommHandler.js +113 -69
- package/components/InngestCommHandler.js.map +1 -1
- package/components/InngestFunction.d.ts +82 -4
- package/components/InngestFunction.d.ts.map +1 -1
- package/components/InngestFunction.js +406 -9
- package/components/InngestFunction.js.map +1 -1
- package/components/InngestMiddleware.d.ts +15 -7
- package/components/InngestMiddleware.d.ts.map +1 -1
- package/components/InngestMiddleware.js +3 -1
- package/components/InngestMiddleware.js.map +1 -1
- package/components/InngestStepTools.d.ts +11 -9
- package/components/InngestStepTools.d.ts.map +1 -1
- package/components/InngestStepTools.js +61 -67
- package/components/InngestStepTools.js.map +1 -1
- package/express.d.ts.map +1 -1
- package/express.js +6 -3
- package/express.js.map +1 -1
- package/helpers/functions.d.ts +2 -0
- package/helpers/functions.d.ts.map +1 -1
- package/helpers/functions.js +2 -0
- package/helpers/functions.js.map +1 -1
- package/helpers/promises.d.ts +0 -36
- package/helpers/promises.d.ts.map +1 -1
- package/helpers/promises.js +1 -49
- package/helpers/promises.js.map +1 -1
- package/helpers/types.d.ts +5 -0
- package/helpers/types.d.ts.map +1 -1
- package/package.json +3 -3
- package/types.d.ts +34 -26
- package/types.d.ts.map +1 -1
- package/types.js +0 -9
- package/types.js.map +1 -1
- package/version.d.ts +1 -1
- package/version.d.ts.map +1 -1
- package/version.js +1 -1
- package/version.js.map +1 -1
- package/components/InngestExecution.d.ts +0 -146
- package/components/InngestExecution.d.ts.map +0 -1
- package/components/InngestExecution.js +0 -468
- package/components/InngestExecution.js.map +0 -1
|
@@ -1,468 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
3
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
4
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
5
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
6
|
-
};
|
|
7
|
-
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
8
|
-
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
9
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
10
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
11
|
-
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
12
|
-
};
|
|
13
|
-
var __asyncValues = (this && this.__asyncValues) || function (o) {
|
|
14
|
-
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
15
|
-
var m = o[Symbol.asyncIterator], i;
|
|
16
|
-
return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
|
|
17
|
-
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
|
|
18
|
-
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
|
|
19
|
-
};
|
|
20
|
-
var __await = (this && this.__await) || function (v) { return this instanceof __await ? (this.v = v, this) : new __await(v); }
|
|
21
|
-
var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _arguments, generator) {
|
|
22
|
-
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
23
|
-
var g = generator.apply(thisArg, _arguments || []), i, q = [];
|
|
24
|
-
return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
|
|
25
|
-
function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
|
|
26
|
-
function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
|
|
27
|
-
function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
|
|
28
|
-
function fulfill(value) { resume("next", value); }
|
|
29
|
-
function reject(value) { resume("throw", value); }
|
|
30
|
-
function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
|
|
31
|
-
};
|
|
32
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
33
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
34
|
-
};
|
|
35
|
-
var _InngestExecution_instances, _InngestExecution_execution, _InngestExecution_debug, _InngestExecution_userFnToRun, _InngestExecution_start, _InngestExecution_createCheckpointHandlers, _InngestExecution_getCheckpointHandler, _InngestExecution_tryExecuteStep, _InngestExecution_getEarlyExecRunStep, _InngestExecution_filterNewSteps, _InngestExecution_executeStep, _InngestExecution_startExecution, _InngestExecution_transformInput, _InngestExecution_transformOutput, _InngestExecution_createExecutionState, _InngestExecution_createFnArg, _InngestExecution_getUserFnToRun, _InngestExecution_initializeTimer, _InngestExecution_initializeMiddleware;
|
|
36
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37
|
-
exports.InngestExecution = void 0;
|
|
38
|
-
const debug_1 = __importDefault(require("debug"));
|
|
39
|
-
const zod_1 = require("zod");
|
|
40
|
-
const errors_1 = require("../helpers/errors");
|
|
41
|
-
const promises_1 = require("../helpers/promises");
|
|
42
|
-
const types_1 = require("../types");
|
|
43
|
-
const InngestMiddleware_1 = require("./InngestMiddleware");
|
|
44
|
-
const InngestStepTools_1 = require("./InngestStepTools");
|
|
45
|
-
const NonRetriableError_1 = require("./NonRetriableError");
|
|
46
|
-
class InngestExecution {
|
|
47
|
-
constructor(options) {
|
|
48
|
-
_InngestExecution_instances.add(this);
|
|
49
|
-
this.timeoutDuration = 1000 * 10;
|
|
50
|
-
_InngestExecution_execution.set(this, void 0);
|
|
51
|
-
_InngestExecution_debug.set(this, (0, debug_1.default)("inngest"));
|
|
52
|
-
_InngestExecution_userFnToRun.set(this, void 0);
|
|
53
|
-
this.options = options;
|
|
54
|
-
__classPrivateFieldSet(this, _InngestExecution_userFnToRun, __classPrivateFieldGet(this, _InngestExecution_instances, "m", _InngestExecution_getUserFnToRun).call(this), "f");
|
|
55
|
-
this.state = __classPrivateFieldGet(this, _InngestExecution_instances, "m", _InngestExecution_createExecutionState).call(this, this.options.stepState);
|
|
56
|
-
this.fnArg = __classPrivateFieldGet(this, _InngestExecution_instances, "m", _InngestExecution_createFnArg).call(this, this.state);
|
|
57
|
-
this.checkpointHandlers = __classPrivateFieldGet(this, _InngestExecution_instances, "m", _InngestExecution_createCheckpointHandlers).call(this);
|
|
58
|
-
__classPrivateFieldGet(this, _InngestExecution_instances, "m", _InngestExecution_initializeTimer).call(this, this.state);
|
|
59
|
-
__classPrivateFieldSet(this, _InngestExecution_debug, __classPrivateFieldGet(this, _InngestExecution_debug, "f").extend(this.fnArg.runId), "f");
|
|
60
|
-
__classPrivateFieldGet(this, _InngestExecution_debug, "f").call(this, "created new execution for run;", this.options.requestedRunStep
|
|
61
|
-
? `wanting to run step "${this.options.requestedRunStep}"`
|
|
62
|
-
: "discovering steps");
|
|
63
|
-
__classPrivateFieldGet(this, _InngestExecution_debug, "f").call(this, "existing state keys:", Object.keys(this.state.stepState));
|
|
64
|
-
}
|
|
65
|
-
/**
|
|
66
|
-
* Idempotently start the execution of the user's function.
|
|
67
|
-
*/
|
|
68
|
-
start() {
|
|
69
|
-
var _a;
|
|
70
|
-
__classPrivateFieldGet(this, _InngestExecution_debug, "f").call(this, "starting execution");
|
|
71
|
-
return (__classPrivateFieldSet(this, _InngestExecution_execution, (_a = __classPrivateFieldGet(this, _InngestExecution_execution, "f")) !== null && _a !== void 0 ? _a : __classPrivateFieldGet(this, _InngestExecution_instances, "m", _InngestExecution_start).call(this).then((result) => {
|
|
72
|
-
__classPrivateFieldGet(this, _InngestExecution_debug, "f").call(this, "result:", result);
|
|
73
|
-
return result;
|
|
74
|
-
}), "f"));
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
exports.InngestExecution = InngestExecution;
|
|
78
|
-
_InngestExecution_execution = new WeakMap(), _InngestExecution_debug = new WeakMap(), _InngestExecution_userFnToRun = new WeakMap(), _InngestExecution_instances = new WeakSet(), _InngestExecution_start =
|
|
79
|
-
/**
|
|
80
|
-
* Starts execution of the user's function and the core loop.
|
|
81
|
-
*/
|
|
82
|
-
async function _InngestExecution_start() {
|
|
83
|
-
var _a, e_1, _b, _c;
|
|
84
|
-
var _d, _e;
|
|
85
|
-
try {
|
|
86
|
-
const allCheckpointHandler = __classPrivateFieldGet(this, _InngestExecution_instances, "m", _InngestExecution_getCheckpointHandler).call(this, "");
|
|
87
|
-
this.state.hooks = await __classPrivateFieldGet(this, _InngestExecution_instances, "m", _InngestExecution_initializeMiddleware).call(this);
|
|
88
|
-
await __classPrivateFieldGet(this, _InngestExecution_instances, "m", _InngestExecution_startExecution).call(this);
|
|
89
|
-
try {
|
|
90
|
-
for (var _f = true, _g = __asyncValues(this.state.loop), _h; _h = await _g.next(), _a = _h.done, !_a;) {
|
|
91
|
-
_c = _h.value;
|
|
92
|
-
_f = false;
|
|
93
|
-
try {
|
|
94
|
-
const checkpoint = _c;
|
|
95
|
-
await allCheckpointHandler(checkpoint);
|
|
96
|
-
const handler = __classPrivateFieldGet(this, _InngestExecution_instances, "m", _InngestExecution_getCheckpointHandler).call(this, checkpoint.type);
|
|
97
|
-
const result = await handler(checkpoint);
|
|
98
|
-
if (result) {
|
|
99
|
-
return result;
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
finally {
|
|
103
|
-
_f = true;
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
108
|
-
finally {
|
|
109
|
-
try {
|
|
110
|
-
if (!_f && !_a && (_b = _g.return)) await _b.call(_g);
|
|
111
|
-
}
|
|
112
|
-
finally { if (e_1) throw e_1.error; }
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
catch (error) {
|
|
116
|
-
return await __classPrivateFieldGet(this, _InngestExecution_instances, "m", _InngestExecution_transformOutput).call(this, { error });
|
|
117
|
-
}
|
|
118
|
-
finally {
|
|
119
|
-
void this.state.loop.return();
|
|
120
|
-
await ((_e = (_d = this.state.hooks) === null || _d === void 0 ? void 0 : _d.beforeResponse) === null || _e === void 0 ? void 0 : _e.call(_d));
|
|
121
|
-
}
|
|
122
|
-
throw new Error("TODO generator finished or blew up");
|
|
123
|
-
}, _InngestExecution_createCheckpointHandlers = function _InngestExecution_createCheckpointHandlers() {
|
|
124
|
-
return {
|
|
125
|
-
/**
|
|
126
|
-
* Run for all checkpoints. Best used for logging or common actions.
|
|
127
|
-
* Use other handlers to return values and interrupt the core loop.
|
|
128
|
-
*/
|
|
129
|
-
"": (checkpoint) => {
|
|
130
|
-
__classPrivateFieldGet(this, _InngestExecution_debug, "f").call(this, "checkpoint:", checkpoint);
|
|
131
|
-
},
|
|
132
|
-
/**
|
|
133
|
-
* The user's function has completed and returned a value.
|
|
134
|
-
*/
|
|
135
|
-
"function-resolved": async (checkpoint) => {
|
|
136
|
-
return await __classPrivateFieldGet(this, _InngestExecution_instances, "m", _InngestExecution_transformOutput).call(this, { data: checkpoint.data });
|
|
137
|
-
},
|
|
138
|
-
/**
|
|
139
|
-
* The user's function has thrown an error.
|
|
140
|
-
*/
|
|
141
|
-
"function-rejected": async (checkpoint) => {
|
|
142
|
-
return await __classPrivateFieldGet(this, _InngestExecution_instances, "m", _InngestExecution_transformOutput).call(this, { error: checkpoint.error });
|
|
143
|
-
},
|
|
144
|
-
/**
|
|
145
|
-
* We've found one or more steps. Here we may want to run a step or report
|
|
146
|
-
* them back to Inngest.
|
|
147
|
-
*/
|
|
148
|
-
"steps-found": async ({ steps }) => {
|
|
149
|
-
const stepResult = await __classPrivateFieldGet(this, _InngestExecution_instances, "m", _InngestExecution_tryExecuteStep).call(this, steps);
|
|
150
|
-
if (stepResult) {
|
|
151
|
-
const transformResult = await __classPrivateFieldGet(this, _InngestExecution_instances, "m", _InngestExecution_transformOutput).call(this, stepResult);
|
|
152
|
-
if (transformResult.type === "function-resolved") {
|
|
153
|
-
return {
|
|
154
|
-
type: "step-ran",
|
|
155
|
-
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
156
|
-
step: Object.assign(Object.assign({}, stepResult), transformResult.data),
|
|
157
|
-
};
|
|
158
|
-
}
|
|
159
|
-
return transformResult;
|
|
160
|
-
}
|
|
161
|
-
const newSteps = await __classPrivateFieldGet(this, _InngestExecution_instances, "m", _InngestExecution_filterNewSteps).call(this, steps);
|
|
162
|
-
if (newSteps) {
|
|
163
|
-
return {
|
|
164
|
-
type: "steps-found",
|
|
165
|
-
steps: newSteps,
|
|
166
|
-
};
|
|
167
|
-
}
|
|
168
|
-
},
|
|
169
|
-
/**
|
|
170
|
-
* While trying to find a step that Inngest has told us to run, we've
|
|
171
|
-
* timed out or have otherwise decided that it doesn't exist.
|
|
172
|
-
*/
|
|
173
|
-
"step-not-found": ({ step }) => {
|
|
174
|
-
return { type: "step-not-found", step };
|
|
175
|
-
},
|
|
176
|
-
};
|
|
177
|
-
}, _InngestExecution_getCheckpointHandler = function _InngestExecution_getCheckpointHandler(type) {
|
|
178
|
-
return this.checkpointHandlers[type];
|
|
179
|
-
}, _InngestExecution_tryExecuteStep = async function _InngestExecution_tryExecuteStep(steps) {
|
|
180
|
-
var _a, _b;
|
|
181
|
-
const stepIdToRun = this.options.requestedRunStep || __classPrivateFieldGet(this, _InngestExecution_instances, "m", _InngestExecution_getEarlyExecRunStep).call(this, steps);
|
|
182
|
-
if (!stepIdToRun) {
|
|
183
|
-
return;
|
|
184
|
-
}
|
|
185
|
-
const step = steps.find((step) => step.id === stepIdToRun && step.fn);
|
|
186
|
-
if (step) {
|
|
187
|
-
(_a = this.timeout) === null || _a === void 0 ? void 0 : _a.clear(); // TODO duplicate clean-up; bad
|
|
188
|
-
return await __classPrivateFieldGet(this, _InngestExecution_instances, "m", _InngestExecution_executeStep).call(this, step);
|
|
189
|
-
}
|
|
190
|
-
/**
|
|
191
|
-
* Ensure we reset the timeout if we have a requested run step but couldn't
|
|
192
|
-
* find it, but also that we don't reset if we found and executed it.
|
|
193
|
-
*/
|
|
194
|
-
void ((_b = this.timeout) === null || _b === void 0 ? void 0 : _b.reset());
|
|
195
|
-
}, _InngestExecution_getEarlyExecRunStep = function _InngestExecution_getEarlyExecRunStep(steps) {
|
|
196
|
-
/**
|
|
197
|
-
* We may have been disabled due to parallelism, in which case we can't
|
|
198
|
-
* immediately execute unless explicitly requested.
|
|
199
|
-
*/
|
|
200
|
-
if (this.options.disableImmediateExecution)
|
|
201
|
-
return;
|
|
202
|
-
const unfulfilledSteps = steps.filter((step) => !step.fulfilled);
|
|
203
|
-
if (unfulfilledSteps.length !== 1)
|
|
204
|
-
return;
|
|
205
|
-
const op = unfulfilledSteps[0];
|
|
206
|
-
if (op &&
|
|
207
|
-
op.op === types_1.StepOpCode.StepPlanned &&
|
|
208
|
-
typeof op.opts === "undefined") {
|
|
209
|
-
return op.id;
|
|
210
|
-
}
|
|
211
|
-
}, _InngestExecution_filterNewSteps = async function _InngestExecution_filterNewSteps(steps) {
|
|
212
|
-
var _a, _b, _c, _d, _e, _f;
|
|
213
|
-
if (this.options.requestedRunStep) {
|
|
214
|
-
return;
|
|
215
|
-
}
|
|
216
|
-
/**
|
|
217
|
-
* Gather any steps that aren't memoized and report them.
|
|
218
|
-
*/
|
|
219
|
-
const newSteps = steps.filter((step) => !step.fulfilled);
|
|
220
|
-
if (!newSteps.length) {
|
|
221
|
-
return;
|
|
222
|
-
}
|
|
223
|
-
/**
|
|
224
|
-
* Warn if we've found new steps but haven't yet seen all previous
|
|
225
|
-
* steps. This may indicate that step presence isn't determinate.
|
|
226
|
-
*/
|
|
227
|
-
const stepsToFulfil = Object.keys(this.state.stepState).length;
|
|
228
|
-
const fulfilledSteps = steps.filter((step) => step.fulfilled).length;
|
|
229
|
-
const foundAllCompletedSteps = stepsToFulfil === fulfilledSteps;
|
|
230
|
-
if (!foundAllCompletedSteps) {
|
|
231
|
-
console.warn((0, errors_1.prettyError)({
|
|
232
|
-
whatHappened: "TODO bad mate",
|
|
233
|
-
reassurance: "not cool",
|
|
234
|
-
why: "state looks wrong",
|
|
235
|
-
consequences: "may be over-sensitive; needs tests",
|
|
236
|
-
}));
|
|
237
|
-
}
|
|
238
|
-
/**
|
|
239
|
-
* We're finishing up; let's trigger the last of the hooks.
|
|
240
|
-
*/
|
|
241
|
-
await ((_b = (_a = this.state.hooks) === null || _a === void 0 ? void 0 : _a.afterMemoization) === null || _b === void 0 ? void 0 : _b.call(_a));
|
|
242
|
-
await ((_d = (_c = this.state.hooks) === null || _c === void 0 ? void 0 : _c.beforeExecution) === null || _d === void 0 ? void 0 : _d.call(_c));
|
|
243
|
-
await ((_f = (_e = this.state.hooks) === null || _e === void 0 ? void 0 : _e.afterExecution) === null || _f === void 0 ? void 0 : _f.call(_e));
|
|
244
|
-
return newSteps.map((step) => ({
|
|
245
|
-
op: step.op,
|
|
246
|
-
id: step.id,
|
|
247
|
-
name: step.name,
|
|
248
|
-
opts: step.opts,
|
|
249
|
-
}));
|
|
250
|
-
}, _InngestExecution_executeStep = async function _InngestExecution_executeStep({ id, name, opts, fn }) {
|
|
251
|
-
var _a, _b, _c, _d;
|
|
252
|
-
await ((_b = (_a = this.state.hooks) === null || _a === void 0 ? void 0 : _a.afterMemoization) === null || _b === void 0 ? void 0 : _b.call(_a));
|
|
253
|
-
await ((_d = (_c = this.state.hooks) === null || _c === void 0 ? void 0 : _c.beforeExecution) === null || _d === void 0 ? void 0 : _d.call(_c));
|
|
254
|
-
const outgoingOp = { id, op: types_1.StepOpCode.RunStep, name, opts };
|
|
255
|
-
this.state.executingStep = outgoingOp;
|
|
256
|
-
__classPrivateFieldGet(this, _InngestExecution_debug, "f").call(this, `executing step "${id}"`);
|
|
257
|
-
return (Promise.resolve(fn === null || fn === void 0 ? void 0 : fn())
|
|
258
|
-
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
|
259
|
-
.finally(async () => {
|
|
260
|
-
var _a, _b;
|
|
261
|
-
await ((_b = (_a = this.state.hooks) === null || _a === void 0 ? void 0 : _a.afterExecution) === null || _b === void 0 ? void 0 : _b.call(_a));
|
|
262
|
-
})
|
|
263
|
-
.then((data) => {
|
|
264
|
-
return Object.assign(Object.assign({}, outgoingOp), { data });
|
|
265
|
-
})
|
|
266
|
-
.catch((error) => {
|
|
267
|
-
return Object.assign(Object.assign({}, outgoingOp), {
|
|
268
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
269
|
-
error });
|
|
270
|
-
}));
|
|
271
|
-
}, _InngestExecution_startExecution =
|
|
272
|
-
/**
|
|
273
|
-
* Starts execution of the user's function, including triggering checkpoints
|
|
274
|
-
* and middleware hooks where appropriate.
|
|
275
|
-
*/
|
|
276
|
-
async function _InngestExecution_startExecution() {
|
|
277
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
278
|
-
/**
|
|
279
|
-
* Mutate input as neccessary based on middleware.
|
|
280
|
-
*/
|
|
281
|
-
await __classPrivateFieldGet(this, _InngestExecution_instances, "m", _InngestExecution_transformInput).call(this);
|
|
282
|
-
/**
|
|
283
|
-
* Start the timer to time out the run if needed.
|
|
284
|
-
*/
|
|
285
|
-
void ((_a = this.timeout) === null || _a === void 0 ? void 0 : _a.start());
|
|
286
|
-
await ((_c = (_b = this.state.hooks) === null || _b === void 0 ? void 0 : _b.beforeMemoization) === null || _c === void 0 ? void 0 : _c.call(_b));
|
|
287
|
-
/**
|
|
288
|
-
* If we had no state to begin with, immediately end the memoization phase.
|
|
289
|
-
*/
|
|
290
|
-
if (this.state.allStateUsed()) {
|
|
291
|
-
await ((_e = (_d = this.state.hooks) === null || _d === void 0 ? void 0 : _d.afterMemoization) === null || _e === void 0 ? void 0 : _e.call(_d));
|
|
292
|
-
await ((_g = (_f = this.state.hooks) === null || _f === void 0 ? void 0 : _f.beforeExecution) === null || _g === void 0 ? void 0 : _g.call(_f));
|
|
293
|
-
}
|
|
294
|
-
/**
|
|
295
|
-
* Trigger the user's function.
|
|
296
|
-
*/
|
|
297
|
-
Promise.resolve(__classPrivateFieldGet(this, _InngestExecution_userFnToRun, "f").call(this, this.fnArg))
|
|
298
|
-
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
|
299
|
-
.finally(async () => {
|
|
300
|
-
var _a, _b, _c, _d, _e, _f;
|
|
301
|
-
await ((_b = (_a = this.state.hooks) === null || _a === void 0 ? void 0 : _a.afterMemoization) === null || _b === void 0 ? void 0 : _b.call(_a));
|
|
302
|
-
await ((_d = (_c = this.state.hooks) === null || _c === void 0 ? void 0 : _c.beforeExecution) === null || _d === void 0 ? void 0 : _d.call(_c));
|
|
303
|
-
await ((_f = (_e = this.state.hooks) === null || _e === void 0 ? void 0 : _e.afterExecution) === null || _f === void 0 ? void 0 : _f.call(_e));
|
|
304
|
-
})
|
|
305
|
-
.then((data) => {
|
|
306
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
307
|
-
this.state.setCheckpoint({ type: "function-resolved", data });
|
|
308
|
-
})
|
|
309
|
-
.catch((error) => {
|
|
310
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
311
|
-
this.state.setCheckpoint({ type: "function-rejected", error });
|
|
312
|
-
});
|
|
313
|
-
}, _InngestExecution_transformInput =
|
|
314
|
-
/**
|
|
315
|
-
* Using middleware, transform input before running.
|
|
316
|
-
*/
|
|
317
|
-
async function _InngestExecution_transformInput() {
|
|
318
|
-
var _a, _b;
|
|
319
|
-
const inputMutations = await ((_b = (_a = this.state.hooks) === null || _a === void 0 ? void 0 : _a.transformInput) === null || _b === void 0 ? void 0 : _b.call(_a, {
|
|
320
|
-
ctx: Object.assign({}, this.fnArg),
|
|
321
|
-
steps: Object.values(this.state.stepState),
|
|
322
|
-
fn: this.options.fn,
|
|
323
|
-
}));
|
|
324
|
-
if (inputMutations === null || inputMutations === void 0 ? void 0 : inputMutations.ctx) {
|
|
325
|
-
this.fnArg = inputMutations.ctx;
|
|
326
|
-
}
|
|
327
|
-
if (inputMutations === null || inputMutations === void 0 ? void 0 : inputMutations.steps) {
|
|
328
|
-
this.state.stepState = inputMutations.steps.reduce((steps, step) => (Object.assign(Object.assign({}, steps), { [step.id]: step })), {});
|
|
329
|
-
}
|
|
330
|
-
}, _InngestExecution_transformOutput =
|
|
331
|
-
/**
|
|
332
|
-
* Using middleware, transform output before returning.
|
|
333
|
-
*/
|
|
334
|
-
async function _InngestExecution_transformOutput(dataOrError) {
|
|
335
|
-
var _a, _b;
|
|
336
|
-
const output = Object.assign({}, dataOrError);
|
|
337
|
-
if (typeof output.error !== "undefined") {
|
|
338
|
-
output.data = (0, errors_1.serializeError)(output.error);
|
|
339
|
-
}
|
|
340
|
-
const transformedOutput = await ((_b = (_a = this.state.hooks) === null || _a === void 0 ? void 0 : _a.transformOutput) === null || _b === void 0 ? void 0 : _b.call(_a, {
|
|
341
|
-
result: Object.assign({}, output),
|
|
342
|
-
step: this.state.executingStep,
|
|
343
|
-
}));
|
|
344
|
-
const { data, error } = Object.assign(Object.assign({}, output), transformedOutput === null || transformedOutput === void 0 ? void 0 : transformedOutput.result);
|
|
345
|
-
if (typeof error !== "undefined") {
|
|
346
|
-
/**
|
|
347
|
-
* Ensure we give middleware the chance to decide on retriable behaviour
|
|
348
|
-
* by looking at the error returned from output transformation.
|
|
349
|
-
*/
|
|
350
|
-
const retriable = !(error instanceof NonRetriableError_1.NonRetriableError);
|
|
351
|
-
const serializedError = (0, errors_1.serializeError)(error);
|
|
352
|
-
return { type: "function-rejected", error: serializedError, retriable };
|
|
353
|
-
}
|
|
354
|
-
return { type: "function-resolved", data };
|
|
355
|
-
}, _InngestExecution_createExecutionState = function _InngestExecution_createExecutionState(stepState) {
|
|
356
|
-
let { promise: checkpointPromise, resolve: checkpointResolve } = (0, promises_1.createDeferredPromise)();
|
|
357
|
-
const loop = (function (cleanUp) {
|
|
358
|
-
return __asyncGenerator(this, arguments, function* () {
|
|
359
|
-
try {
|
|
360
|
-
while (true) {
|
|
361
|
-
yield yield __await(yield __await(checkpointPromise));
|
|
362
|
-
}
|
|
363
|
-
}
|
|
364
|
-
finally {
|
|
365
|
-
cleanUp === null || cleanUp === void 0 ? void 0 : cleanUp();
|
|
366
|
-
}
|
|
367
|
-
});
|
|
368
|
-
})(() => {
|
|
369
|
-
var _a;
|
|
370
|
-
(_a = this.timeout) === null || _a === void 0 ? void 0 : _a.clear();
|
|
371
|
-
});
|
|
372
|
-
const state = {
|
|
373
|
-
stepState,
|
|
374
|
-
steps: {},
|
|
375
|
-
loop,
|
|
376
|
-
setCheckpoint: (checkpoint) => {
|
|
377
|
-
({ promise: checkpointPromise, resolve: checkpointResolve } =
|
|
378
|
-
checkpointResolve(checkpoint));
|
|
379
|
-
},
|
|
380
|
-
allStateUsed: () => {
|
|
381
|
-
return Object.values(state.stepState).every((step) => {
|
|
382
|
-
return step.fulfilled;
|
|
383
|
-
});
|
|
384
|
-
},
|
|
385
|
-
};
|
|
386
|
-
return state;
|
|
387
|
-
}, _InngestExecution_createFnArg = function _InngestExecution_createFnArg(state) {
|
|
388
|
-
var _a;
|
|
389
|
-
const step = (0, InngestStepTools_1.createStepTools)(this.options.client, state);
|
|
390
|
-
let fnArg = Object.assign(Object.assign({}, this.options.data), { step });
|
|
391
|
-
/**
|
|
392
|
-
* Handle use of the `onFailure` option by deserializing the error.
|
|
393
|
-
*/
|
|
394
|
-
if (this.options.isFailureHandler) {
|
|
395
|
-
const eventData = zod_1.z
|
|
396
|
-
.object({ error: types_1.failureEventErrorSchema })
|
|
397
|
-
.parse((_a = fnArg.event) === null || _a === void 0 ? void 0 : _a.data);
|
|
398
|
-
fnArg = Object.assign(Object.assign({}, fnArg), { error: (0, errors_1.deserializeError)(eventData.error) });
|
|
399
|
-
}
|
|
400
|
-
/**
|
|
401
|
-
* Handle use of the `fns` option by wrapping given functions in step
|
|
402
|
-
* tooling.
|
|
403
|
-
*/
|
|
404
|
-
const fnOpts = this.options.fn.opts;
|
|
405
|
-
if (fnOpts.fns) {
|
|
406
|
-
fnArg.fns = Object.entries(fnOpts.fns).reduce((acc, [key, fn]) => {
|
|
407
|
-
if (typeof fn !== "function") {
|
|
408
|
-
return acc;
|
|
409
|
-
}
|
|
410
|
-
return Object.assign(Object.assign({}, acc), {
|
|
411
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
|
412
|
-
[key]: (...args) => step.run(key, () => fn(...args)) });
|
|
413
|
-
}, {});
|
|
414
|
-
}
|
|
415
|
-
return fnArg;
|
|
416
|
-
}, _InngestExecution_getUserFnToRun = function _InngestExecution_getUserFnToRun() {
|
|
417
|
-
if (!this.options.isFailureHandler) {
|
|
418
|
-
return this.options.fn["fn"];
|
|
419
|
-
}
|
|
420
|
-
if (!this.options.fn["onFailureFn"]) {
|
|
421
|
-
throw new Error("TODO");
|
|
422
|
-
}
|
|
423
|
-
return this.options.fn["onFailureFn"];
|
|
424
|
-
}, _InngestExecution_initializeTimer = function _InngestExecution_initializeTimer(state) {
|
|
425
|
-
if (!this.options.requestedRunStep) {
|
|
426
|
-
return;
|
|
427
|
-
}
|
|
428
|
-
this.timeout = (0, promises_1.createTimeoutPromise)(this.timeoutDuration);
|
|
429
|
-
void this.timeout.then(async () => {
|
|
430
|
-
var _a, _b, _c, _d, _e, _f;
|
|
431
|
-
await ((_b = (_a = this.state.hooks) === null || _a === void 0 ? void 0 : _a.afterMemoization) === null || _b === void 0 ? void 0 : _b.call(_a));
|
|
432
|
-
await ((_d = (_c = this.state.hooks) === null || _c === void 0 ? void 0 : _c.beforeExecution) === null || _d === void 0 ? void 0 : _d.call(_c));
|
|
433
|
-
await ((_f = (_e = this.state.hooks) === null || _e === void 0 ? void 0 : _e.afterExecution) === null || _f === void 0 ? void 0 : _f.call(_e));
|
|
434
|
-
state.setCheckpoint({
|
|
435
|
-
type: "step-not-found",
|
|
436
|
-
step: {
|
|
437
|
-
id: this.options.requestedRunStep,
|
|
438
|
-
op: types_1.StepOpCode.StepNotFound,
|
|
439
|
-
},
|
|
440
|
-
});
|
|
441
|
-
});
|
|
442
|
-
}, _InngestExecution_initializeMiddleware = async function _InngestExecution_initializeMiddleware() {
|
|
443
|
-
const ctx = this.options.data;
|
|
444
|
-
const hooks = await (0, InngestMiddleware_1.getHookStack)(this.options.fn["middleware"], "onFunctionRun", {
|
|
445
|
-
ctx,
|
|
446
|
-
fn: this.options.fn,
|
|
447
|
-
steps: Object.values(this.options.stepState),
|
|
448
|
-
}, {
|
|
449
|
-
transformInput: (prev, output) => {
|
|
450
|
-
return {
|
|
451
|
-
ctx: Object.assign(Object.assign({}, prev.ctx), output === null || output === void 0 ? void 0 : output.ctx),
|
|
452
|
-
fn: this.options.fn,
|
|
453
|
-
steps: prev.steps.map((step, i) => {
|
|
454
|
-
var _a;
|
|
455
|
-
return (Object.assign(Object.assign({}, step), (_a = output === null || output === void 0 ? void 0 : output.steps) === null || _a === void 0 ? void 0 : _a[i]));
|
|
456
|
-
}),
|
|
457
|
-
};
|
|
458
|
-
},
|
|
459
|
-
transformOutput: (prev, output) => {
|
|
460
|
-
return {
|
|
461
|
-
result: Object.assign(Object.assign({}, prev.result), output === null || output === void 0 ? void 0 : output.result),
|
|
462
|
-
step: prev.step,
|
|
463
|
-
};
|
|
464
|
-
},
|
|
465
|
-
});
|
|
466
|
-
return hooks;
|
|
467
|
-
};
|
|
468
|
-
//# sourceMappingURL=InngestExecution.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"InngestExecution.js","sourceRoot":"","sources":["../../src/components/InngestExecution.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,kDAA6C;AAE7C,6BAAwB;AAExB,8CAI2B;AAC3B,kDAG6B;AAE7B,oCAYkB;AAIlB,2DAAsE;AACtE,yDAAqE;AACrE,2DAAwD;AAqCxD,MAAa,gBAAgB;IAmB3B,YAAY,OAAgC;;QAd5C,oBAAe,GAAG,IAAI,GAAG,EAAE,CAAC;QAC5B,8CAAiD;QACjD,kCAAmB,IAAA,eAAK,EAAC,SAAS,CAAC,EAAC;QACpC,gDAAyB;QAYvB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QAEvB,uBAAA,IAAI,iCAAgB,uBAAA,IAAI,qEAAgB,MAApB,IAAI,CAAkB,MAAA,CAAC;QAC3C,IAAI,CAAC,KAAK,GAAG,uBAAA,IAAI,2EAAsB,MAA1B,IAAI,EAAuB,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;QAChE,IAAI,CAAC,KAAK,GAAG,uBAAA,IAAI,kEAAa,MAAjB,IAAI,EAAc,IAAI,CAAC,KAAK,CAAC,CAAC;QAC3C,IAAI,CAAC,kBAAkB,GAAG,uBAAA,IAAI,+EAA0B,MAA9B,IAAI,CAA4B,CAAC;QAC3D,uBAAA,IAAI,sEAAiB,MAArB,IAAI,EAAkB,IAAI,CAAC,KAAK,CAAC,CAAC;QAElC,uBAAA,IAAI,2BAAU,uBAAA,IAAI,+BAAO,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,MAAA,CAAC;QAEnD,uBAAA,IAAI,+BAAO,MAAX,IAAI,EACF,gCAAgC,EAChC,IAAI,CAAC,OAAO,CAAC,gBAAgB;YAC3B,CAAC,CAAC,wBAAwB,IAAI,CAAC,OAAO,CAAC,gBAAgB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