@n8n/engine 0.16.0 → 0.17.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/dist/auth/authenticate.d.ts +3 -0
- package/dist/auth/authenticate.js +29 -0
- package/dist/auth/authenticate.js.map +1 -0
- package/dist/auth/identity-token.d.ts +14 -0
- package/dist/auth/identity-token.js +66 -0
- package/dist/auth/identity-token.js.map +1 -0
- package/dist/auth/identity.types.d.ts +7 -0
- package/dist/auth/identity.types.js +3 -0
- package/dist/auth/identity.types.js.map +1 -0
- package/dist/auth/index.d.ts +3 -0
- package/dist/auth/index.js +15 -0
- package/dist/auth/index.js.map +1 -0
- package/dist/build.tsbuildinfo +1 -1
- package/dist/database/create-stores.d.ts +3 -2
- package/dist/database/create-stores.js.map +1 -1
- package/dist/database/entities/workflow-execution.entity.d.ts +2 -3
- package/dist/database/entities/workflow-execution.entity.js +3 -3
- package/dist/database/entities/workflow-execution.entity.js.map +1 -1
- package/dist/database/entities/workflow-step-execution.entity.d.ts +1 -0
- package/dist/database/entities/workflow-step-execution.entity.js +7 -3
- package/dist/database/entities/workflow-step-execution.entity.js.map +1 -1
- package/dist/database/index.d.ts +1 -0
- package/dist/database/index.js.map +1 -1
- package/dist/database/migrations/1778529600000-CreateWorkflowExecution.js +1 -1
- package/dist/database/migrations/1784890100000-CreateWorkflowStepExecution.js +13 -2
- package/dist/database/migrations/1784890100000-CreateWorkflowStepExecution.js.map +1 -1
- package/dist/database/typeorm-execution-store.js +1 -1
- package/dist/database/typeorm-execution-store.js.map +1 -1
- package/dist/database/typeorm-step-store.d.ts +5 -5
- package/dist/database/typeorm-step-store.js +57 -13
- package/dist/database/typeorm-step-store.js.map +1 -1
- package/dist/execution/completion.d.ts +2 -0
- package/dist/execution/completion.js +21 -0
- package/dist/execution/completion.js.map +1 -0
- package/dist/execution/execution-start-handler.js +3 -1
- package/dist/execution/execution-start-handler.js.map +1 -1
- package/dist/execution/execution-store.d.ts +3 -4
- package/dist/execution/execution-store.js.map +1 -1
- package/dist/execution/execution.types.d.ts +8 -0
- package/dist/execution/execution.types.js +6 -1
- package/dist/execution/execution.types.js.map +1 -1
- package/dist/execution/index.d.ts +3 -2
- package/dist/execution/index.js +3 -1
- package/dist/execution/index.js.map +1 -1
- package/dist/execution/iteration-mapping.d.ts +14 -0
- package/dist/execution/iteration-mapping.js +48 -0
- package/dist/execution/iteration-mapping.js.map +1 -0
- package/dist/execution/loop-ledger.d.ts +7 -0
- package/dist/execution/loop-ledger.js +38 -0
- package/dist/execution/loop-ledger.js.map +1 -0
- package/dist/execution/settlement.d.ts +6 -4
- package/dist/execution/settlement.js +73 -17
- package/dist/execution/settlement.js.map +1 -1
- package/dist/execution/start-execution.service.d.ts +2 -3
- package/dist/execution/start-execution.service.js +1 -1
- package/dist/execution/start-execution.service.js.map +1 -1
- package/dist/execution/step-ready-handler.d.ts +7 -1
- package/dist/execution/step-ready-handler.js +29 -10
- package/dist/execution/step-ready-handler.js.map +1 -1
- package/dist/execution/step-settled-handler.d.ts +1 -2
- package/dist/execution/step-settled-handler.js +27 -23
- package/dist/execution/step-settled-handler.js.map +1 -1
- package/dist/execution/step-store.d.ts +8 -5
- package/dist/execution/step-store.js.map +1 -1
- package/dist/graph/graph-validation.error.d.ts +3 -0
- package/dist/graph/graph-validation.error.js +11 -0
- package/dist/graph/graph-validation.error.js.map +1 -0
- package/dist/graph/index.d.ts +4 -1
- package/dist/graph/index.js +7 -2
- package/dist/graph/index.js.map +1 -1
- package/dist/graph/loops.d.ts +10 -0
- package/dist/graph/loops.js +161 -0
- package/dist/graph/loops.js.map +1 -0
- package/dist/graph/validate-executable-graph.d.ts +1 -3
- package/dist/graph/validate-executable-graph.js +9 -15
- package/dist/graph/validate-executable-graph.js.map +1 -1
- package/dist/index.d.ts +9 -6
- package/dist/index.js +7 -12
- package/dist/index.js.map +1 -1
- package/dist/runtime/create-engine-runtime.d.ts +18 -0
- package/dist/runtime/create-engine-runtime.js +26 -0
- package/dist/runtime/create-engine-runtime.js.map +1 -0
- package/dist/runtime/index.d.ts +2 -0
- package/dist/runtime/index.js +6 -0
- package/dist/runtime/index.js.map +1 -0
- package/dist/serve.js +18 -30
- package/dist/serve.js.map +1 -1
- package/dist/server/create-engine-server.d.ts +3 -9
- package/dist/server/create-engine-server.js +5 -9
- package/dist/server/create-engine-server.js.map +1 -1
- package/dist/server/error-response.d.ts +7 -0
- package/dist/server/error-response.js +12 -0
- package/dist/server/error-response.js.map +1 -0
- package/dist/server/index.d.ts +2 -1
- package/dist/server/index.js +3 -1
- package/dist/server/index.js.map +1 -1
- package/dist/server/routes/workflow-executions.js +7 -9
- package/dist/server/routes/workflow-executions.js.map +1 -1
- package/dist/testing/start-engine-server.d.ts +3 -2
- package/dist/testing/start-engine-server.js +2 -2
- package/dist/testing/start-engine-server.js.map +1 -1
- package/package.json +5 -3
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.deriveLoops = deriveLoops;
|
|
4
|
+
exports.validateLoops = validateLoops;
|
|
5
|
+
const common_1 = require("../common");
|
|
6
|
+
const graph_validation_error_1 = require("./graph-validation.error");
|
|
7
|
+
function deriveLoops(graph) {
|
|
8
|
+
const backEdgeTargets = [...new Set(graph.edges.filter((e) => e.isBackEdge).map((e) => e.to))];
|
|
9
|
+
if (backEdgeTargets.length === 0)
|
|
10
|
+
return [];
|
|
11
|
+
const sccByNode = computeSccMembership(graph, graph.edges);
|
|
12
|
+
return backEdgeTargets.map((batchNodeId) => {
|
|
13
|
+
const memberIds = sccByNode.get(batchNodeId) ?? new Set([batchNodeId]);
|
|
14
|
+
return {
|
|
15
|
+
batchNodeId,
|
|
16
|
+
memberIds,
|
|
17
|
+
backEdges: graph.edges.filter((e) => e.isBackEdge && e.to === batchNodeId),
|
|
18
|
+
entryEdges: graph.edges.filter((e) => !e.isBackEdge && e.to === batchNodeId && !memberIds.has(e.from)),
|
|
19
|
+
exitEdges: graph.edges.filter((e) => !e.isBackEdge && memberIds.has(e.from) && !memberIds.has(e.to)),
|
|
20
|
+
};
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
function computeSccMembership(graph, edges) {
|
|
24
|
+
const outgoing = new Map();
|
|
25
|
+
for (const edge of edges) {
|
|
26
|
+
const list = outgoing.get(edge.from);
|
|
27
|
+
if (list)
|
|
28
|
+
list.push(edge);
|
|
29
|
+
else
|
|
30
|
+
outgoing.set(edge.from, [edge]);
|
|
31
|
+
}
|
|
32
|
+
const indexById = new Map();
|
|
33
|
+
const lowlinkById = new Map();
|
|
34
|
+
const stack = [];
|
|
35
|
+
const onStack = new Set();
|
|
36
|
+
const membership = new Map();
|
|
37
|
+
let nextIndex = 0;
|
|
38
|
+
const connect = (nodeId) => {
|
|
39
|
+
indexById.set(nodeId, nextIndex);
|
|
40
|
+
lowlinkById.set(nodeId, nextIndex);
|
|
41
|
+
nextIndex += 1;
|
|
42
|
+
stack.push(nodeId);
|
|
43
|
+
onStack.add(nodeId);
|
|
44
|
+
for (const edge of outgoing.get(nodeId) ?? []) {
|
|
45
|
+
if (!indexById.has(edge.to)) {
|
|
46
|
+
connect(edge.to);
|
|
47
|
+
lowlinkById.set(nodeId, Math.min(lowlinkById.get(nodeId), lowlinkById.get(edge.to)));
|
|
48
|
+
}
|
|
49
|
+
else if (onStack.has(edge.to)) {
|
|
50
|
+
lowlinkById.set(nodeId, Math.min(lowlinkById.get(nodeId), indexById.get(edge.to)));
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
if (lowlinkById.get(nodeId) === indexById.get(nodeId)) {
|
|
54
|
+
const members = new Set();
|
|
55
|
+
let member;
|
|
56
|
+
do {
|
|
57
|
+
member = stack.pop();
|
|
58
|
+
onStack.delete(member);
|
|
59
|
+
members.add(member);
|
|
60
|
+
} while (member !== nodeId);
|
|
61
|
+
for (const id of members)
|
|
62
|
+
membership.set(id, members);
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
for (const node of graph.nodes) {
|
|
66
|
+
if (!indexById.has(node.id))
|
|
67
|
+
connect(node.id);
|
|
68
|
+
}
|
|
69
|
+
return membership;
|
|
70
|
+
}
|
|
71
|
+
function isCyclic(members, edges) {
|
|
72
|
+
if (members.size > 1)
|
|
73
|
+
return true;
|
|
74
|
+
const [only] = members;
|
|
75
|
+
return edges.some((edge) => edge.from === only && edge.to === only);
|
|
76
|
+
}
|
|
77
|
+
function validateLoops(graph) {
|
|
78
|
+
const namesById = new Map(graph.nodes.map((node) => [node.id, node.name]));
|
|
79
|
+
const name = (id) => namesById.get(id) ?? id;
|
|
80
|
+
const seenNodeIds = new Set();
|
|
81
|
+
for (const node of graph.nodes) {
|
|
82
|
+
if (seenNodeIds.has(node.id)) {
|
|
83
|
+
throw new graph_validation_error_1.GraphValidationError(`Two nodes share the id ${node.id}`);
|
|
84
|
+
}
|
|
85
|
+
seenNodeIds.add(node.id);
|
|
86
|
+
}
|
|
87
|
+
for (const edge of graph.edges) {
|
|
88
|
+
for (const endpoint of [edge.from, edge.to]) {
|
|
89
|
+
if (!namesById.has(endpoint)) {
|
|
90
|
+
throw new graph_validation_error_1.GraphValidationError(`Edge ${name(edge.from)} -> ${name(edge.to)} references ${endpoint}, which is not a node in the graph`);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
const forwardEdges = graph.edges.filter((edge) => !edge.isBackEdge);
|
|
95
|
+
for (const members of new Set(computeSccMembership(graph, forwardEdges).values())) {
|
|
96
|
+
if (isCyclic(members, forwardEdges)) {
|
|
97
|
+
throw new graph_validation_error_1.GraphValidationError(`Nodes ${[...members].map(name).join(', ')} form a cycle with no back-edge to close it, so none of them can ever become runnable`);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
const batchNodeIds = new Set(graph.nodes.filter((node) => node.type === 'batch').map((node) => node.id));
|
|
101
|
+
const loops = deriveLoops(graph);
|
|
102
|
+
const loopsByBatchNode = new Map(loops.map((loop) => [loop.batchNodeId, loop]));
|
|
103
|
+
for (const batchNodeId of batchNodeIds) {
|
|
104
|
+
if (!loopsByBatchNode.has(batchNodeId)) {
|
|
105
|
+
throw new graph_validation_error_1.GraphValidationError(`Batch node ${name(batchNodeId)} has no back-edge returning to it, so its loop could never advance`);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
for (const loop of loops) {
|
|
109
|
+
const { batchNodeId, memberIds, backEdges } = loop;
|
|
110
|
+
if (!batchNodeIds.has(batchNodeId)) {
|
|
111
|
+
throw new graph_validation_error_1.GraphValidationError(`Node ${name(batchNodeId)} has a back-edge returning to it but is not a batch node`);
|
|
112
|
+
}
|
|
113
|
+
for (const memberId of memberIds) {
|
|
114
|
+
if (memberId !== batchNodeId && batchNodeIds.has(memberId)) {
|
|
115
|
+
throw new common_1.UnimplementedError(`Batch node ${name(memberId)} sits inside the loop of ${name(batchNodeId)}; nested loops are not supported yet`);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
for (const edge of backEdges) {
|
|
119
|
+
if (edge.inputIndex !== 0) {
|
|
120
|
+
throw new graph_validation_error_1.GraphValidationError(`Back-edge ${name(edge.from)} -> ${name(edge.to)} feeds input slot ${edge.inputIndex}; returns feed the batch node's slot 0`);
|
|
121
|
+
}
|
|
122
|
+
if (!memberIds.has(edge.from)) {
|
|
123
|
+
throw new graph_validation_error_1.GraphValidationError(`Back-edge ${name(edge.from)} -> ${name(edge.to)} returns from outside the loop`);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
if (backEdges.length > 1) {
|
|
127
|
+
throw new common_1.UnimplementedError(`Batch node ${name(batchNodeId)} has ${backEdges.length} back-edges; multiple returns converge on one input slot, which is not supported yet`);
|
|
128
|
+
}
|
|
129
|
+
for (const edge of graph.edges) {
|
|
130
|
+
if (edge.to === batchNodeId && !edge.isBackEdge && edge.inputIndex !== 0) {
|
|
131
|
+
throw new graph_validation_error_1.GraphValidationError(`Edge ${name(edge.from)} -> ${name(edge.to)} feeds input slot ${edge.inputIndex} of a batch node, which has only slot 0`);
|
|
132
|
+
}
|
|
133
|
+
if (edge.from === batchNodeId && edge.outputIndex !== 0 && edge.outputIndex !== 1) {
|
|
134
|
+
throw new graph_validation_error_1.GraphValidationError(`Edge ${name(edge.from)} -> ${name(edge.to)} leaves output slot ${edge.outputIndex} of a batch node, which has only done (0) and loop (1)`);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
if (loop.entryEdges.length > 1) {
|
|
138
|
+
throw new common_1.UnimplementedError(`Batch node ${name(batchNodeId)} has ${loop.entryEdges.length} entry edges; converging entries on its input slot is not supported yet`);
|
|
139
|
+
}
|
|
140
|
+
for (const edge of loop.exitEdges) {
|
|
141
|
+
if (edge.from !== batchNodeId) {
|
|
142
|
+
throw new common_1.UnimplementedError(`Edge ${name(edge.from)} -> ${name(edge.to)} leaves the loop of ${name(batchNodeId)} mid-body; dangling body branches are not supported yet`);
|
|
143
|
+
}
|
|
144
|
+
if (edge.outputIndex !== 0) {
|
|
145
|
+
throw new graph_validation_error_1.GraphValidationError(`Edge ${name(edge.from)} -> ${name(edge.to)} leaves the loop from the loop slot; only the done slot (0) exits`);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
for (const edge of graph.edges) {
|
|
149
|
+
if (edge.from === batchNodeId && edge.outputIndex === 0 && memberIds.has(edge.to)) {
|
|
150
|
+
throw new graph_validation_error_1.GraphValidationError(`Done slot of ${name(batchNodeId)} feeds ${name(edge.to)}, a member of its own loop; a node cannot run both per iteration and after the loop`);
|
|
151
|
+
}
|
|
152
|
+
if (!edge.isBackEdge &&
|
|
153
|
+
memberIds.has(edge.to) &&
|
|
154
|
+
edge.to !== batchNodeId &&
|
|
155
|
+
!memberIds.has(edge.from)) {
|
|
156
|
+
throw new graph_validation_error_1.GraphValidationError(`Edge ${name(edge.from)} -> ${name(edge.to)} enters the loop of ${name(batchNodeId)} mid-body; the batch node is the only way in`);
|
|
157
|
+
}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|
3
|
-
constructor(message: string);
|
|
4
|
-
}
|
|
2
|
+
export declare const MAX_SLOT_INDEX = 100;
|
|
5
3
|
export declare function validateExecutableGraph(graph: WorkflowGraph): void;
|
|
@@ -1,24 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.MAX_SLOT_INDEX = void 0;
|
|
4
4
|
exports.validateExecutableGraph = validateExecutableGraph;
|
|
5
5
|
const common_1 = require("../common");
|
|
6
|
+
const graph_validation_error_1 = require("./graph-validation.error");
|
|
6
7
|
const workflow_graph_queries_1 = require("./workflow-graph-queries");
|
|
7
|
-
|
|
8
|
-
class GraphValidationError extends Error {
|
|
9
|
-
constructor(message) {
|
|
10
|
-
super(message);
|
|
11
|
-
this.name = 'GraphValidationError';
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
exports.GraphValidationError = GraphValidationError;
|
|
8
|
+
exports.MAX_SLOT_INDEX = 100;
|
|
15
9
|
function validateExecutableGraph(graph) {
|
|
16
10
|
const triggers = graph.nodes.filter((node) => node.type === 'trigger');
|
|
17
11
|
if (triggers.length === 0) {
|
|
18
|
-
throw new GraphValidationError('Graph has no trigger node to start from');
|
|
12
|
+
throw new graph_validation_error_1.GraphValidationError('Graph has no trigger node to start from');
|
|
19
13
|
}
|
|
20
14
|
if (triggers.length > 1) {
|
|
21
|
-
throw new GraphValidationError('Graph must have exactly one trigger node');
|
|
15
|
+
throw new graph_validation_error_1.GraphValidationError('Graph must have exactly one trigger node');
|
|
22
16
|
}
|
|
23
17
|
if (graph.edges.some((edge) => edge.isBackEdge)) {
|
|
24
18
|
throw new common_1.UnimplementedError('Graphs with back-edges (loops) are not supported yet');
|
|
@@ -27,16 +21,16 @@ function validateExecutableGraph(graph) {
|
|
|
27
21
|
const reachable = new Set([trigger.id, ...(0, workflow_graph_queries_1.getDescendantNodeIds)(graph, trigger.id)]);
|
|
28
22
|
for (const edge of graph.edges) {
|
|
29
23
|
if (reachable.has(edge.to) && !reachable.has(edge.from)) {
|
|
30
|
-
throw new GraphValidationError(`Edge ${edge.from}
|
|
24
|
+
throw new graph_validation_error_1.GraphValidationError(`Edge ${edge.from} -> ${edge.to} feeds a node the trigger reaches from one it cannot reach, so ${edge.to} would wait on ${edge.from} forever`);
|
|
31
25
|
}
|
|
32
26
|
}
|
|
33
27
|
for (const edge of graph.edges) {
|
|
34
28
|
for (const index of [edge.outputIndex, edge.inputIndex]) {
|
|
35
29
|
if (!Number.isInteger(index) || index < 0) {
|
|
36
|
-
throw new GraphValidationError(`Edge ${edge.from}
|
|
30
|
+
throw new graph_validation_error_1.GraphValidationError(`Edge ${edge.from} -> ${edge.to} has slot index ${index}; slot indices are non-negative integers`);
|
|
37
31
|
}
|
|
38
|
-
if (index > MAX_SLOT_INDEX) {
|
|
39
|
-
throw new GraphValidationError(`Edge ${edge.from}
|
|
32
|
+
if (index > exports.MAX_SLOT_INDEX) {
|
|
33
|
+
throw new graph_validation_error_1.GraphValidationError(`Edge ${edge.from} -> ${edge.to} has slot index ${index}; slot indices above ${exports.MAX_SLOT_INDEX} are not supported yet`);
|
|
40
34
|
}
|
|
41
35
|
}
|
|
42
36
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validate-executable-graph.js","sourceRoot":"","sources":["../../src/graph/validate-executable-graph.ts"],"names":[],"mappings":";;;;AAAA,sCAA+C;
|
|
1
|
+
{"version":3,"file":"validate-executable-graph.js","sourceRoot":"","sources":["../../src/graph/validate-executable-graph.ts"],"names":[],"mappings":";;;;AAAA,sCAA+C;AAC/C,qEAAgE;AAEhE,qEAAgE;AAEnD,QAAA,cAAc,GAAG,GAAG,CAAC;AAUlC,iCAAwC,KAAoB;IAC3D,MAAM,QAAQ,GAAG,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC;IAC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AC;gBAC3C,MAAM,IAAI,6CAAoB,CAC7B,QAAQ,IAAI,CAAC,IAAI,OAAO,IAAI,CAAC,EAAE,mBAAmB,KAAK,0CAA0C,CACjG,CAAC;YACH,CAAC;YACD,IAAI,KAAK,GAAG,QAAA,cAAc,EAAE,CAAC;gBAC5B,MAAM,IAAI,6CAAoB,CAC7B,QAAQ,IAAI,CAAC,IAAI,OAAO,IAAI,CAAC,EAAE,mBAAmB,KAAK,wBAAwB,QAAA,cAAc,wBAAwB,CACrH,CAAC;YACH,CAAC;QACF,CAAC;IACF,CAAC;IAID,MAAM,cAAc,GAAG,IAAI,GAAG,EAAU,CAAC;IACzC,KAAK,MAAM,IAAI,IAAI,KAAK,CAAC,KAAK,EAAE,CAAC;QAChC,MAAM,IAAI,GAAG,GAAG,IAAI,CAAC,EAAE,IAAI,IAAI,CAAC,UAAU,EAAE,CAAC;QAC7C,IAAI,cAAc,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;YAC9B,MAAM,IAAI,2BAAkB,CAC3B,QAAQ,IAAI,CAAC,EAAE,2CAA2C,IAAI,CAAC,UAAU,wDAAwD,CACjI,CAAC;QACH,CAAC;QACD,cAAc,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAC1B,CAAC;AACF,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export type {
|
|
1
|
+
export { createEngineRuntime } from './runtime';
|
|
2
|
+
export type { EngineRuntime, EngineRuntimeOptions } from './runtime';
|
|
3
|
+
export { InvalidIdentityTokenError, mintIdentityToken, SharedSecretIdentityVerifier, } from './auth';
|
|
4
|
+
export type { AuthenticatedCaller, IdentityVerifier } from './auth';
|
|
5
|
+
export type { EngineErrorResponse } from './server';
|
|
3
6
|
export type { JsonObject, JsonValue } from './common';
|
|
4
7
|
export type { GraphEdge, GraphNode, StepConfig, StepType, WorkflowGraph, } from './graph';
|
|
5
8
|
export type { ExternalDependencies, IStepExecutor, StepExecutionContext, StepExecutionRequest, StepExecutionResult, } from './dependencies';
|
|
6
9
|
export { AllowAllAdmittance, AdmittanceRejectedError } from './admittance';
|
|
7
10
|
export type { AdmittanceDecision, AdmittanceRequest, AdmittanceService, } from './admittance';
|
|
8
|
-
export { InMemoryWorkQueue } from './queue';
|
|
9
11
|
export type { ExecutionEnqueuedEvent, OrchestrationMessage, StepSettledEvent, StepMessage, StepReadyEvent, WorkQueue, } from './queue';
|
|
10
|
-
export { ExecutionNotFoundError,
|
|
11
|
-
export type { ExecutionMode, ExecutionRecord, ExecutionStatus, ExecutionStore, NewExecutionRecord, NewStepRecord, StartExecutionRequest, StartExecutionResult, StepError, StepRecord, StepSlots, StepStatus, StepStore, } from './execution';
|
|
12
|
-
export { createDataSource,
|
|
12
|
+
export { ExecutionNotFoundError, StepNotFoundError } from './execution';
|
|
13
|
+
export type { ExecutionMode, ExecutionRecord, ExecutionStatus, ExecutionStore, NewExecutionRecord, NewStepRecord, StartExecutionRequest, StartExecutionResult, StepError, StepKey, StepKeyId, StepRecord, StepSlots, StepStatus, StepStore, TriggerOutputs, } from './execution';
|
|
14
|
+
export { createDataSource, WorkflowExecution, WorkflowStepExecution } from './database';
|
|
15
|
+
export type { EngineStores } from './database';
|
package/dist/index.js
CHANGED
|
@@ -1,25 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.WorkflowStepExecution = exports.WorkflowExecution = exports.
|
|
4
|
-
var
|
|
5
|
-
Object.defineProperty(exports, "
|
|
3
|
+
exports.WorkflowStepExecution = exports.WorkflowExecution = exports.createDataSource = exports.StepNotFoundError = exports.ExecutionNotFoundError = exports.AdmittanceRejectedError = exports.AllowAllAdmittance = exports.SharedSecretIdentityVerifier = exports.mintIdentityToken = exports.InvalidIdentityTokenError = exports.createEngineRuntime = void 0;
|
|
4
|
+
var runtime_1 = require("./runtime");
|
|
5
|
+
Object.defineProperty(exports, "createEngineRuntime", { enumerable: true, get: function () { return runtime_1.createEngineRuntime; } });
|
|
6
|
+
var auth_1 = require("./auth");
|
|
7
|
+
Object.defineProperty(exports, "InvalidIdentityTokenError", { enumerable: true, get: function () { return auth_1.InvalidIdentityTokenError; } });
|
|
8
|
+
Object.defineProperty(exports, "mintIdentityToken", { enumerable: true, get: function () { return auth_1.mintIdentityToken; } });
|
|
9
|
+
Object.defineProperty(exports, "SharedSecretIdentityVerifier", { enumerable: true, get: function () { return auth_1.SharedSecretIdentityVerifier; } });
|
|
6
10
|
var admittance_1 = require("./admittance");
|
|
7
11
|
Object.defineProperty(exports, "AllowAllAdmittance", { enumerable: true, get: function () { return admittance_1.AllowAllAdmittance; } });
|
|
8
12
|
Object.defineProperty(exports, "AdmittanceRejectedError", { enumerable: true, get: function () { return admittance_1.AdmittanceRejectedError; } });
|
|
9
|
-
var queue_1 = require("./queue");
|
|
10
|
-
Object.defineProperty(exports, "InMemoryWorkQueue", { enumerable: true, get: function () { return queue_1.InMemoryWorkQueue; } });
|
|
11
13
|
var execution_1 = require("./execution");
|
|
12
14
|
Object.defineProperty(exports, "ExecutionNotFoundError", { enumerable: true, get: function () { return execution_1.ExecutionNotFoundError; } });
|
|
13
|
-
Object.defineProperty(exports, "ExecutionStartHandler", { enumerable: true, get: function () { return execution_1.ExecutionStartHandler; } });
|
|
14
|
-
Object.defineProperty(exports, "OrchestrationWorker", { enumerable: true, get: function () { return execution_1.OrchestrationWorker; } });
|
|
15
|
-
Object.defineProperty(exports, "StartExecutionService", { enumerable: true, get: function () { return execution_1.StartExecutionService; } });
|
|
16
15
|
Object.defineProperty(exports, "StepNotFoundError", { enumerable: true, get: function () { return execution_1.StepNotFoundError; } });
|
|
17
|
-
Object.defineProperty(exports, "StepReadyHandler", { enumerable: true, get: function () { return execution_1.StepReadyHandler; } });
|
|
18
|
-
Object.defineProperty(exports, "StepSettledHandler", { enumerable: true, get: function () { return execution_1.StepSettledHandler; } });
|
|
19
|
-
Object.defineProperty(exports, "StepWorker", { enumerable: true, get: function () { return execution_1.StepWorker; } });
|
|
20
16
|
var database_1 = require("./database");
|
|
21
17
|
Object.defineProperty(exports, "createDataSource", { enumerable: true, get: function () { return database_1.createDataSource; } });
|
|
22
|
-
Object.defineProperty(exports, "createStores", { enumerable: true, get: function () { return database_1.createStores; } });
|
|
23
18
|
Object.defineProperty(exports, "WorkflowExecution", { enumerable: true, get: function () { return database_1.WorkflowExecution; } });
|
|
24
19
|
Object.defineProperty(exports, "WorkflowStepExecution", { enumerable: true, get: function () { return database_1.WorkflowStepExecution; } });
|
|
25
20
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,qCAAgD;AAAvC,8GAAA,mBAAmB,OAAA;AAG5B,+BAIgB;AAHf,iHAAA,yBAAyB,OAAA;AACzB,yGAAA,iBAAiB,OAAA;AACjB,oHAAA,4BAA4B,OAAA;AAwB7B,2CAA2E;AAAlE,gHAAA,kBAAkB,OAAA;AAAE,qHAAA,uBAAuB,OAAA;AAgBpD,yCAAwE;AAA/D,mHAAA,sBAAsB,OAAA;AAAE,8GAAA,iBAAiB,OAAA;AAoBlD,uCAAwF;AAA/E,4GAAA,gBAAgB,OAAA;AAAE,6GAAA,iBAAiB,OAAA;AAAE,iHAAA,qBAAqB,OAAA"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { DataSource } from '@n8n/typeorm';
|
|
2
|
+
import type { Application } from 'express';
|
|
3
|
+
import type { AdmittanceService } from '../admittance';
|
|
4
|
+
import type { IdentityVerifier } from '../auth/identity.types';
|
|
5
|
+
import type { EngineStores } from '../database';
|
|
6
|
+
import type { ExternalDependencies } from '../dependencies';
|
|
7
|
+
export interface EngineRuntimeOptions {
|
|
8
|
+
dataSource: DataSource;
|
|
9
|
+
admittance: AdmittanceService;
|
|
10
|
+
identityVerifier: IdentityVerifier;
|
|
11
|
+
externalDependencies?: (stores: EngineStores) => ExternalDependencies;
|
|
12
|
+
}
|
|
13
|
+
export interface EngineRuntime {
|
|
14
|
+
app: Application;
|
|
15
|
+
start(): void;
|
|
16
|
+
stop(): Promise<void>;
|
|
17
|
+
}
|
|
18
|
+
export declare function createEngineRuntime({ dataSource, admittance, identityVerifier, externalDependencies, }: EngineRuntimeOptions): EngineRuntime;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createEngineRuntime = createEngineRuntime;
|
|
4
|
+
const database_1 = require("../database");
|
|
5
|
+
const execution_1 = require("../execution");
|
|
6
|
+
const queue_1 = require("../queue");
|
|
7
|
+
const server_1 = require("../server");
|
|
8
|
+
function createEngineRuntime({ dataSource, admittance, identityVerifier, externalDependencies, }) {
|
|
9
|
+
const orchestrationQueue = new queue_1.InMemoryWorkQueue();
|
|
10
|
+
const stepQueue = new queue_1.InMemoryWorkQueue();
|
|
11
|
+
const { executionStore, stepStore } = (0, database_1.createStores)(dataSource);
|
|
12
|
+
const orchestrationWorker = new execution_1.OrchestrationWorker(orchestrationQueue, new execution_1.ExecutionStartHandler(executionStore, stepStore, orchestrationQueue), new execution_1.StepSettledHandler(executionStore, stepStore, stepQueue, orchestrationQueue));
|
|
13
|
+
const stepWorker = new execution_1.StepWorker(stepQueue, new execution_1.StepReadyHandler(executionStore, stepStore, orchestrationQueue, externalDependencies?.({ executionStore, stepStore }) ?? {}));
|
|
14
|
+
const { app } = (0, server_1.createEngineServer)(new execution_1.StartExecutionService(admittance, executionStore, orchestrationQueue), identityVerifier);
|
|
15
|
+
return {
|
|
16
|
+
app,
|
|
17
|
+
start: () => {
|
|
18
|
+
orchestrationWorker.start();
|
|
19
|
+
stepWorker.start();
|
|
20
|
+
},
|
|
21
|
+
stop: async () => {
|
|
22
|
+
await Promise.all([orchestrationWorker.stop(), stepWorker.stop()]);
|
|
23
|
+
},
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=create-engine-runtime.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-engine-runtime.js","sourceRoot":"","sources":["../../src/runtime/create-engine-runtime.ts"],"names":[],"mappings":";;;AAKA,0CAA2C;AAG3C,4CAOsB;AACtB,oCAA6C;AAE7C,sCAA+C;AAsC/C,6BAAoC,EACnC,UAAU,EACV,UAAU,EACV,gBAAgB,EAChB,oBAAoB,GACE;IACtB,MAAM,kBAAkB,GAAG,IAAI,yBAAiB,EAAwB,CAAC;IACzE,MAAM,SAAS,GAAG,IAAI,yBAAiB,EAAe,CAAC;IACvD,MAAM,EAAE,cAAc,EAAE,SAAS,EAAE,GAAG,IAAA,uBAAY,EAAC,UAAU,CAAC,CAAC;IAE/D,MAAM,mBAAmB,GAAG,IAAI,+BAAmB,CAClD,kBAAkB,EAClB,IAAI,iCAAqB,CAAC,cAAc,EAAE,SAAS,EAAE,kBAAkB,CAAC,EACxE,IAAI,8BAAkB,CAAC,cAAc,EAAE,SAAS,EAAE,SAAS,EAAE,kBAAkB,CAAC,CAChF,CAAC;IACF,MAAM,UAAU,GAAG,IAAI,sBAAU,CAChC,SAAS,EACT,IAAI,4BAAgB,CACnB,cAAc,EACd,SAAS,EACT,kBAAkB,EAClB,oBAAoB,EAAE,CAAC,EAAE,cAAc,EAAE,SAAS,EAAE,CAAC,IAAI,EAAE,CAC3D,CACD,CAAC;IAEF,MAAM,EAAE,GAAG,EAAE,GAAG,IAAA,2BAAkB,EACjC,IAAI,iCAAqB,CAAC,UAAU,EAAE,cAAc,EAAE,kBAAkB,CAAC,EACzE,gBAAgB,CAChB,CAAC;IAEF,OAAO;QACN,GAAG;QAEH,KAAK,EAAE,GAAG,EAAE;YACX,mBAAmB,CAAC,KAAK,EAAE,CAAC;YAC5B,UAAU,CAAC,KAAK,EAAE,CAAC;QACpB,CAAC;QAED,IAAI,EAAE,KAAK,IAAI,EAAE;YAIhB,MAAM,OAAO,CAAC,GAAG,CAAC,CAAC,mBAAmB,CAAC,IAAI,EAAE,EAAE,UAAU,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;QACpE,CAAC;KACD,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createEngineRuntime = void 0;
|
|
4
|
+
var create_engine_runtime_1 = require("./create-engine-runtime");
|
|
5
|
+
Object.defineProperty(exports, "createEngineRuntime", { enumerable: true, get: function () { return create_engine_runtime_1.createEngineRuntime; } });
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/runtime/index.ts"],"names":[],"mappings":";;;AAAA,iEAA8D;AAArD,4HAAA,mBAAmB,OAAA"}
|
package/dist/serve.js
CHANGED
|
@@ -3,36 +3,27 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
const config_1 = require("@n8n/config");
|
|
4
4
|
const di_1 = require("@n8n/di");
|
|
5
5
|
const admittance_1 = require("./admittance");
|
|
6
|
+
const auth_1 = require("./auth");
|
|
6
7
|
const database_1 = require("./database");
|
|
7
|
-
const
|
|
8
|
-
const queue_1 = require("./queue");
|
|
9
|
-
const server_1 = require("./server");
|
|
8
|
+
const runtime_1 = require("./runtime");
|
|
10
9
|
async function main() {
|
|
11
10
|
const config = di_1.Container.get(config_1.EngineConfig);
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
dataSource = (0, database_1.createDataSource)(config.databaseUrl);
|
|
15
|
-
await dataSource.initialize();
|
|
16
|
-
await dataSource.runMigrations();
|
|
11
|
+
if (!config.databaseUrl) {
|
|
12
|
+
throw new Error('engine: N8N_ENGINE_DATABASE_URL is not set');
|
|
17
13
|
}
|
|
18
|
-
|
|
19
|
-
|
|
14
|
+
if (!config.authSecret) {
|
|
15
|
+
throw new Error('engine: N8N_ENGINE_AUTH_SECRET is not set');
|
|
20
16
|
}
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
}
|
|
32
|
-
const { app } = (0, server_1.createEngineServer)(dataSource
|
|
33
|
-
? { dataSource, admittance: new admittance_1.AllowAllAdmittance(), workQueue: orchestrationQueue }
|
|
34
|
-
: undefined);
|
|
35
|
-
const server = app.listen(config.port, config.host, () => {
|
|
17
|
+
const dataSource = (0, database_1.createDataSource)(config.databaseUrl);
|
|
18
|
+
await dataSource.initialize();
|
|
19
|
+
await dataSource.runMigrations();
|
|
20
|
+
const runtime = (0, runtime_1.createEngineRuntime)({
|
|
21
|
+
dataSource,
|
|
22
|
+
admittance: new admittance_1.AllowAllAdmittance(),
|
|
23
|
+
identityVerifier: new auth_1.SharedSecretIdentityVerifier(config.authSecret),
|
|
24
|
+
});
|
|
25
|
+
runtime.start();
|
|
26
|
+
const server = runtime.app.listen(config.port, config.host, () => {
|
|
36
27
|
console.log(`engine: listening on http://${config.host}:${config.port}`);
|
|
37
28
|
});
|
|
38
29
|
let shuttingDown = false;
|
|
@@ -44,11 +35,8 @@ async function main() {
|
|
|
44
35
|
await new Promise((resolve, reject) => {
|
|
45
36
|
server.close((error) => (error ? reject(error) : resolve()));
|
|
46
37
|
});
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
if (stepWorker)
|
|
50
|
-
await stepWorker.stop();
|
|
51
|
-
if (dataSource?.isInitialized)
|
|
38
|
+
await runtime.stop();
|
|
39
|
+
if (dataSource.isInitialized)
|
|
52
40
|
await dataSource.destroy();
|
|
53
41
|
process.exit(0);
|
|
54
42
|
};
|
package/dist/serve.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serve.js","sourceRoot":"","sources":["../src/serve.ts"],"names":[],"mappings":";;AAAA,wCAA2C;AAC3C,gCAAoC;
|
|
1
|
+
{"version":3,"file":"serve.js","sourceRoot":"","sources":["../src/serve.ts"],"names":[],"mappings":";;AAAA,wCAA2C;AAC3C,gCAAoC;AAEpC,6CAAkD;AAClD,iCAAsD;AACtD,yCAA8C;AAC9C,uCAAgD;AAEhD,KAAK,UAAU,IAAI;IAClB,MAAM,MAAM,GAAG,cAAS,CAAC,GAAG,CAAC,qBAAY,CAAC,CAAC;IAI3C,IAAI,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC;QACzB,MAAM,IAAI,KAAK,CAAC,4CAA4C,CAAC,CAAC;IAC/D,CAAC;IAED,IAAI,CAAC,MAAM,CAAC,UAAU,EAAE,CAAC;QACxB,MAAM,IAAI,KAAK,CAAC,2CAA2C,CAAC,CAAC;IAC9D,CAAC;IAED,MAAM,UAAU,GAAG,IAAA,2BAAgB,EAAC,MAAM,CAAC,WAAW,CAAC,CAAC;IACxD,MAAM,UAAU,CAAC,UAAU,EAAE,CAAC;IAC9B,MAAM,UAAU,CAAC,aAAa,EAAE,CAAC;IAEjC,MAAM,OAAO,GAAG,IAAA,6BAAmB,EAAC;QACnC,UAAU;QACV,UAAU,EAAE,IAAI,+BAAkB,EAAE;QACpC,gBAAgB,EAAE,IAAI,mCAA4B,CAAC,MAAM,CAAC,UAAU,CAAC;KACrE,CAAC,CAAC;IACH,OAAO,CAAC,KAAK,EAAE,CAAC;IAEhB,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,GAAG,EAAE;QAChE,OAAO,CAAC,GAAG,CAAC,+BAA+B,MAAM,CAAC,IAAI,IAAI,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC;IAC1E,CAAC,CAAC,CAAC;IAEH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EAAE,KAAK,CAAC,CAAC;IAChD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AACjB,CAAC,CAAC,CAAC"}
|
|
@@ -1,12 +1,6 @@
|
|
|
1
|
-
import type { DataSource } from '@n8n/typeorm';
|
|
2
1
|
import { type Application } from 'express';
|
|
3
|
-
import type {
|
|
4
|
-
import type {
|
|
5
|
-
export
|
|
6
|
-
dataSource: DataSource;
|
|
7
|
-
admittance: AdmittanceService;
|
|
8
|
-
workQueue: WorkQueue<OrchestrationMessage>;
|
|
9
|
-
}
|
|
10
|
-
export declare function createEngineServer(deps?: EngineServerDeps): {
|
|
2
|
+
import type { IdentityVerifier } from '../auth/identity.types';
|
|
3
|
+
import type { StartExecutionService } from '../execution/start-execution.service';
|
|
4
|
+
export declare function createEngineServer(startExecution: StartExecutionService, identityVerifier: IdentityVerifier): {
|
|
11
5
|
app: Application;
|
|
12
6
|
};
|
|
@@ -5,20 +5,16 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.createEngineServer = createEngineServer;
|
|
7
7
|
const express_1 = __importDefault(require("express"));
|
|
8
|
-
const
|
|
9
|
-
const start_execution_service_1 = require("../execution/start-execution.service");
|
|
8
|
+
const authenticate_1 = require("../auth/authenticate");
|
|
10
9
|
const workflow_executions_1 = require("./routes/workflow-executions");
|
|
11
|
-
function createEngineServer(
|
|
10
|
+
function createEngineServer(startExecution, identityVerifier) {
|
|
12
11
|
const app = (0, express_1.default)();
|
|
13
|
-
app.use(express_1.default.json());
|
|
14
12
|
app.get('/healthz', (_req, res) => {
|
|
15
13
|
res.status(200).json({ status: 'ok' });
|
|
16
14
|
});
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
app.use('/api/workflow-executions', (0, workflow_executions_1.createWorkflowExecutionsRouter)(startExecution));
|
|
21
|
-
}
|
|
15
|
+
app.use('/api', (0, authenticate_1.createAuthenticationMiddleware)(identityVerifier));
|
|
16
|
+
app.use('/api', express_1.default.json());
|
|
17
|
+
app.use('/api/workflow-executions', (0, workflow_executions_1.createWorkflowExecutionsRouter)(startExecution));
|
|
22
18
|
return { app };
|
|
23
19
|
}
|
|
24
20
|
//# sourceMappingURL=create-engine-server.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-engine-server.js","sourceRoot":"","sources":["../../src/server/create-engine-server.ts"],"names":[],"mappings":";;;;;;
|
|
1
|
+
{"version":3,"file":"create-engine-server.js","sourceRoot":"","sources":["../../src/server/create-engine-server.ts"],"names":[],"mappings":";;;;;;AAAA,sDAAoD;AAEpD,uDAAsE;AAGtE,sEAA8E;AAG9E,4BACC,cAAqC,EACrC,gBAAkC;IAElC,MAAM,GAAG,GAAG,IAAA,iBAAO,GAAE,CAAC;IAGtB,GAAG,CAAC,GAAG,CAAC,UAAU,EAAE,CAAC,IAAI,EAAE,GAAG,EAAE,EAAE;QACjC,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC;IACxC,CAAC,CAAC,CAAC;IAGH,GAAG,CAAC,GAAG,CAAC,MAAM,EAAE,IAAA,6CAA8B,EAAC,gBAAgB,CAAC,CAAC,CAAC;IAClE,GAAG,CAAC,GAAG,CAAC,MAAM,EAAE,iBAAO,CAAC,IAAI,EAAE,CAAC,CAAC;IAChC,GAAG,CAAC,GAAG,CAAC,0BAA0B,EAAE,IAAA,oDAA8B,EAAC,cAAc,CAAC,CAAC,CAAC;IAEpF,OAAO,EAAE,GAAG,EAAE,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.fail = fail;
|
|
7
|
+
const node_assert_1 = __importDefault(require("node:assert"));
|
|
8
|
+
function fail(res, status, body) {
|
|
9
|
+
(0, node_assert_1.default)(status >= 400, `fail() sends error responses only, but got status ${status}`);
|
|
10
|
+
res.status(status).json(body);
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=error-response.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error-response.js","sourceRoot":"","sources":["../../src/server/error-response.ts"],"names":[],"mappings":";;;;;;AACA,8DAAiC;AAiBjC,cAAqB,GAAa,EAAE,MAAc,EAAE,IAAyB;IAC5E,IAAA,qBAAM,EAAC,MAAM,IAAI,GAAG,EAAE,qDAAqD,MAAM,EAAE,CAAC,CAAC;IACrF,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC/B,CAAC"}
|
package/dist/server/index.d.ts
CHANGED
package/dist/server/index.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createEngineServer = void 0;
|
|
3
|
+
exports.fail = exports.createEngineServer = void 0;
|
|
4
4
|
var create_engine_server_1 = require("./create-engine-server");
|
|
5
5
|
Object.defineProperty(exports, "createEngineServer", { enumerable: true, get: function () { return create_engine_server_1.createEngineServer; } });
|
|
6
|
+
var error_response_1 = require("./error-response");
|
|
7
|
+
Object.defineProperty(exports, "fail", { enumerable: true, get: function () { return error_response_1.fail; } });
|
|
6
8
|
//# sourceMappingURL=index.js.map
|
package/dist/server/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/server/index.ts"],"names":[],"mappings":";;;AAAA,+DAA4D;AAAnD,0HAAA,kBAAkB,OAAA"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/server/index.ts"],"names":[],"mappings":";;;AAAA,+DAA4D;AAAnD,0HAAA,kBAAkB,OAAA;AAC3B,mDAAwC;AAA/B,sGAAA,IAAI,OAAA"}
|