@fluidgrids/workflows 2026.1029.1 → 2026.1030.1
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/README.md +112 -4
- package/dist/{activation-CESehfYi.d.cts → activation-DqUfpHzk.d.cts} +1 -1
- package/dist/{activation-BnVQMv9y.d.ts → activation-xpx1oWuo.d.ts} +1 -1
- package/dist/{chunk-MJ5TGYVG.js → chunk-2D3MYIIF.js} +969 -153
- package/dist/{chunk-2B37XAFQ.cjs → chunk-3U2NU7YC.cjs} +24 -11
- package/dist/{chunk-NEIUQASE.cjs → chunk-4QKB4ARC.cjs} +3 -3
- package/dist/{chunk-GBQ33SIZ.cjs → chunk-54FLQNUM.cjs} +12 -1
- package/dist/{chunk-2DDULZFM.js → chunk-5HIVIV53.js} +86 -75
- package/dist/chunk-5MFVJM76.js +1222 -0
- package/dist/{chunk-EWYADREB.cjs → chunk-672KMMBK.cjs} +2 -2
- package/dist/{chunk-KXJDRQ6G.js → chunk-6A2FGSUS.js} +22 -2
- package/dist/{chunk-OIX4O6UR.js → chunk-6OLN6BMB.js} +16 -3
- package/dist/{chunk-6FSHT5IL.js → chunk-7EZIANC7.js} +1 -1
- package/dist/chunk-A5SXCA62.cjs +93 -0
- package/dist/chunk-AC6ZEXVR.js +85 -0
- package/dist/{chunk-FWBRQWRX.js → chunk-AE5Q6ZAJ.js} +167 -10
- package/dist/{chunk-7ILGCUI6.js → chunk-C4F5KJTI.js} +142 -3
- package/dist/{chunk-WXXNCHUY.js → chunk-G5H32GIG.js} +1 -1
- package/dist/{chunk-OMY3CKUZ.cjs → chunk-GEQDGUGB.cjs} +1042 -226
- package/dist/{chunk-25BKWR2O.js → chunk-HCM7ZC7Q.js} +1 -1
- package/dist/{chunk-I47EENR4.cjs → chunk-HMZUGSMU.cjs} +673 -156
- package/dist/{chunk-NXFBVDOI.cjs → chunk-IQPXHQQQ.cjs} +8 -4
- package/dist/{chunk-RUQIMTN5.cjs → chunk-ISOIA7NV.cjs} +178 -15
- package/dist/chunk-JSC75O5C.cjs +167 -0
- package/dist/{chunk-BD7ZPG53.js → chunk-NWQ5WRLE.js} +10 -2
- package/dist/chunk-ODZ2IAR2.cjs +1247 -0
- package/dist/{chunk-FQSJI5NV.js → chunk-SR7TR5KX.js} +6 -2
- package/dist/{chunk-OKX3FYIM.cjs → chunk-TCTE7DX5.cjs} +3 -3
- package/dist/{chunk-3FIDHONL.cjs → chunk-TYF56RGB.cjs} +99 -80
- package/dist/{chunk-J3PYFGKA.cjs → chunk-VA4OFR72.cjs} +162 -4
- package/dist/chunk-VU5S5A7V.js +150 -0
- package/dist/{chunk-A36CCOWS.js → chunk-YEHR4NNE.js} +633 -128
- package/dist/{chunk-ELL2RBML.cjs → chunk-ZCGKGDCL.cjs} +23 -1
- package/dist/codegen/index.d.cts +2 -2
- package/dist/codegen/index.d.ts +2 -2
- package/dist/{collect-BTHjQaSp.d.ts → collect-6NIEufHd.d.ts} +20 -3
- package/dist/{collect-CSyOg5XC.d.cts → collect-CcTCKqx6.d.cts} +20 -3
- package/dist/{file-cgL9l9l8.d.cts → file-BxYpwjRQ.d.cts} +250 -15
- package/dist/{file-olQudcx5.d.ts → file-CFdPQJI9.d.ts} +250 -15
- package/dist/history/index.cjs +283 -106
- package/dist/history/index.d.cts +549 -10
- package/dist/history/index.d.ts +549 -10
- package/dist/history/index.js +5 -4
- package/dist/index.cjs +146 -53
- package/dist/index.d.cts +38 -14
- package/dist/index.d.ts +38 -14
- package/dist/index.js +6 -5
- package/dist/interceptors-CNcr2dlk.d.ts +159 -0
- package/dist/interceptors-CqkNZVfI.d.cts +159 -0
- package/dist/ir/index.cjs +339 -36
- package/dist/ir/index.d.cts +244 -8
- package/dist/ir/index.d.ts +244 -8
- package/dist/ir/index.js +306 -21
- package/dist/{lower-3S6PsqjJ.d.cts → lower-BtRfIW2A.d.cts} +23 -9
- package/dist/{lower-DmZpQ8hJ.d.ts → lower-CpsMFOFX.d.ts} +23 -9
- package/dist/{manifest-BJjrQt77.d.ts → manifest-D-I_twys.d.ts} +1 -1
- package/dist/{manifest-gRI2Q5Fj.d.cts → manifest-DahBQVM8.d.cts} +1 -1
- package/dist/node-evaluator-DGQDPSPI.cjs +24 -0
- package/dist/node-evaluator-LEEVD7H7.js +14 -0
- package/dist/payload-fields-BVRQn2yH.d.cts +122 -0
- package/dist/payload-fields-oOBWxDiG.d.ts +122 -0
- package/dist/quickjs/index.cjs +27 -27
- package/dist/quickjs/index.d.cts +6 -6
- package/dist/quickjs/index.d.ts +6 -6
- package/dist/quickjs/index.js +9 -9
- package/dist/roundtrip/index.cjs +72 -66
- package/dist/roundtrip/index.d.cts +25 -11
- package/dist/roundtrip/index.d.ts +25 -11
- package/dist/roundtrip/index.js +13 -11
- package/dist/runtime/index.cjs +19 -19
- package/dist/runtime/index.d.cts +139 -12
- package/dist/runtime/index.d.ts +139 -12
- package/dist/runtime/index.js +6 -6
- package/dist/testing/index.cjs +688 -121
- package/dist/testing/index.d.cts +174 -10
- package/dist/testing/index.d.ts +174 -10
- package/dist/testing/index.js +646 -82
- package/dist/{types-CnIOinoz.d.ts → types-Bv2i4cBX.d.cts} +126 -23
- package/dist/{types-CQKOhPTa.d.cts → types-DGx-b9eq.d.ts} +126 -23
- package/dist/{types-Bb2wRnJ5.d.cts → types-V7jEEUaL.d.cts} +1 -1
- package/dist/{types-Bb2wRnJ5.d.ts → types-V7jEEUaL.d.ts} +1 -1
- package/dist/{workflow-8uRU9rhL.d.ts → workflow-B18OeF7g.d.ts} +2 -2
- package/dist/{workflow-DWTPHFbt.d.ts → workflow-BGnv8SS6.d.ts} +261 -14
- package/dist/{workflow-CZOXUlQ5.d.cts → workflow-BJPFv3cp.d.cts} +2 -2
- package/dist/{workflow-O6e64ZcG.d.cts → workflow-DS32Gtws.d.cts} +261 -14
- package/fixtures/histories/activity-options-updated.history.json +159 -0
- package/fixtures/histories/activity-paused-unpaused.history.json +160 -0
- package/fixtures/histories/codec-opaque.history.json +229 -0
- package/fixtures/histories/dynamic-workflow.history.json +150 -0
- package/fixtures/histories/interceptor-headers.history.json +339 -0
- package/fixtures/histories/query-custom.history.json +213 -0
- package/fixtures/histories/query-default-handler.history.json +120 -0
- package/fixtures/histories/reset-forked-reapplied-signals.history.json +239 -0
- package/fixtures/histories/reset-reapplied-update-admitted.history.json +228 -0
- package/fixtures/histories/search-attributes-upserted.history.json +177 -0
- package/fixtures/histories/update-accepted-completed.history.json +45 -30
- package/fixtures/histories/update-default-handler.history.json +246 -0
- package/fixtures/histories/update-handler-awaits-activity.history.json +196 -0
- package/fixtures/histories/update-not-handled.history.json +138 -0
- package/fixtures/histories/update-rejected-no-event.history.json +190 -0
- package/fixtures/histories/update-with-start-admitted.history.json +150 -0
- package/fixtures/histories/user-activity-cancel.history.json +149 -0
- package/fixtures/histories/user-activity-retry.history.json +143 -0
- package/fixtures/histories/user-activity.history.json +149 -0
- package/package.json +1 -1
- package/schema/bridge-v2.schema.json +1062 -0
- package/schema/history-file.schema.json +255 -81
- package/schema/ir-v2.schema.json +246 -1
- package/schema/payload-fields.json +162 -0
- package/schema/run-event.schema.json +239 -80
- package/schema/workflow-command.schema.json +210 -84
- package/schema/workflow-task.schema.json +532 -167
- package/dist/chunk-6QPOJZT6.cjs +0 -1180
- package/dist/chunk-A2OHX3UQ.js +0 -1156
- package/dist/chunk-PWIUEWC3.js +0 -81
- package/dist/chunk-YHBVMOMK.cjs +0 -87
- package/dist/node-evaluator-SOADN23V.js +0 -14
- package/dist/node-evaluator-YGDEXK4U.cjs +0 -24
|
@@ -1,8 +1,365 @@
|
|
|
1
|
+
import { PAYLOAD_FIELDS_DOCUMENT } from './chunk-VU5S5A7V.js';
|
|
1
2
|
import { isRecord } from './chunk-PMCM2OH4.js';
|
|
2
|
-
import { isWorkflowCommandEnabled, isReliefCommand, unsupportedMessage } from './chunk-
|
|
3
|
-
import {
|
|
3
|
+
import { isWorkflowCommandEnabled, isReliefCommand, unsupportedMessage, utf8Bytes } from './chunk-AE5Q6ZAJ.js';
|
|
4
|
+
import { isActivityNodeTypeAllowed } from './chunk-AC6ZEXVR.js';
|
|
5
|
+
import { TASK_FAILURE_CAUSES, VERSIONING_BEHAVIORS, WORKFLOW_ID_CONFLICT_POLICIES, WORKFLOW_ID_REUSE_POLICIES, CHILD_CANCELLATION_TYPES, PARENT_CLOSE_POLICIES, ERROR_TYPES, ACTIVITY_CANCELLATION_TYPES, WORKFLOW_TIMEOUT_TYPES, EVENT_TYPES, COMMAND_TYPES, BUILT_IN_QUERIES, FAIRNESS_WEIGHT_MAX, FAIRNESS_WEIGHT_MIN, FAIRNESS_KEY_MAX_LENGTH, MAX_ACTIVITY_CONNECTIONS, TASK_QUEUE_NAME_PATTERN, ACTIVITY_NAME_PATTERN, HISTORY_PROTOCOL, MAX_SINK_CALLS, LOCAL_ACTIVITY_MAX_TIMEOUT_MS, TERMINAL_COMMANDS, MAX_HEADERS_BYTES } from './chunk-5HIVIV53.js';
|
|
4
6
|
import { Ajv2020 } from 'ajv/dist/2020.js';
|
|
5
7
|
|
|
8
|
+
// src/history/bridge.ts
|
|
9
|
+
var BRIDGE_PROTOCOL_VERSION = 2;
|
|
10
|
+
var BRIDGE_PATH = "/runner-bridge";
|
|
11
|
+
var BRIDGE_PING_SECONDS = 20;
|
|
12
|
+
var BRIDGE_WORKER_HEARTBEAT_SECONDS = 30;
|
|
13
|
+
var BRIDGE_IDLE_TIMEOUT_MS = 65e3;
|
|
14
|
+
var BRIDGE_MAX_FRAME_BYTES = 10 * 1024 * 1024;
|
|
15
|
+
var BRIDGE_MAX_HISTORY_TAIL_BYTES = 4 * 1024 * 1024;
|
|
16
|
+
var BridgeCloseCode = {
|
|
17
|
+
Unauthorized: 4001,
|
|
18
|
+
Revoked: 4002,
|
|
19
|
+
Replaced: 4003,
|
|
20
|
+
/** Also a v2 hello on a RUNNER token, or a v1 hello on a WORKER token. */
|
|
21
|
+
ProtocolError: 4004,
|
|
22
|
+
IdleTimeout: 4008,
|
|
23
|
+
/** The service is shutting down, or `WORKER_BRIDGE_ENABLED` is off. */
|
|
24
|
+
ShuttingDown: 4009,
|
|
25
|
+
/** The workspace has no free worker seat (`fluidgrids.workers.count`). */
|
|
26
|
+
QuotaExceeded: 4010,
|
|
27
|
+
/** The token does not allow a task queue the hello names. */
|
|
28
|
+
QueueNotAllowed: 4011,
|
|
29
|
+
/** `fluidgrids.self-hosted-workers` (or a prerequisite) is off for the workspace. */
|
|
30
|
+
FeatureDisabled: 4012
|
|
31
|
+
};
|
|
32
|
+
var BRIDGE_REQUEST_METHODS = ["history.page", "activity.connection"];
|
|
33
|
+
var ID = { type: "string", minLength: 1, maxLength: 256 };
|
|
34
|
+
var COUNT = { type: "integer", minimum: 0 };
|
|
35
|
+
var POSITIVE = { type: "integer", minimum: 1 };
|
|
36
|
+
var STRINGS = { type: "array", items: { type: "string", minLength: 1 } };
|
|
37
|
+
function frame(type, required, properties) {
|
|
38
|
+
return {
|
|
39
|
+
type: "object",
|
|
40
|
+
required: ["type", ...required],
|
|
41
|
+
properties: { type: { const: type }, ...properties },
|
|
42
|
+
additionalProperties: false
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
var SLOT_USAGE = {
|
|
46
|
+
type: "object",
|
|
47
|
+
required: ["used", "total"],
|
|
48
|
+
properties: { used: COUNT, total: COUNT },
|
|
49
|
+
additionalProperties: false
|
|
50
|
+
};
|
|
51
|
+
var TASK_FAILURE = {
|
|
52
|
+
type: "object",
|
|
53
|
+
required: ["cause", "message"],
|
|
54
|
+
properties: {
|
|
55
|
+
cause: { enum: [...TASK_FAILURE_CAUSES] },
|
|
56
|
+
message: { type: "string" },
|
|
57
|
+
stackTrace: { type: "string" },
|
|
58
|
+
seq: { type: "integer" },
|
|
59
|
+
errorType: { type: "string" }
|
|
60
|
+
},
|
|
61
|
+
additionalProperties: false
|
|
62
|
+
};
|
|
63
|
+
var BRIDGE_V2_SCHEMA_ID = "https://docs.fluidgrids.ai/schemas/bridge-v2.schema.json";
|
|
64
|
+
var BRIDGE_V2_SCHEMA = {
|
|
65
|
+
$schema: "https://json-schema.org/draft/2020-12/schema",
|
|
66
|
+
$id: BRIDGE_V2_SCHEMA_ID,
|
|
67
|
+
title: "FluidGrids worker bridge, protocol 2",
|
|
68
|
+
description: "Frames between a self-hosted worker and wspace-sandbox-svc over /runner-bridge (JSON text frames, Bearer fgr_ token of kind WORKER, ping every 20 s, 65 s idle timeout, 10 MiB frame cap). Close codes: 4001 Unauthorized, 4002 Revoked, 4003 Replaced, 4004 ProtocolError, 4008 IdleTimeout, 4009 ShuttingDown, 4010 QuotaExceeded, 4011 QueueNotAllowed, 4012 FeatureDisabled.",
|
|
69
|
+
oneOf: [{ $ref: "#/$defs/workerFrame" }, { $ref: "#/$defs/serviceFrame" }],
|
|
70
|
+
$defs: {
|
|
71
|
+
workflowTaskRef: {
|
|
72
|
+
type: "object",
|
|
73
|
+
required: ["kind", "runId", "taskId", "attempt", "expectedHistoryLength"],
|
|
74
|
+
properties: {
|
|
75
|
+
kind: { const: "workflow" },
|
|
76
|
+
runId: ID,
|
|
77
|
+
taskId: ID,
|
|
78
|
+
attempt: POSITIVE,
|
|
79
|
+
expectedHistoryLength: POSITIVE
|
|
80
|
+
},
|
|
81
|
+
additionalProperties: false
|
|
82
|
+
},
|
|
83
|
+
queryTaskRef: {
|
|
84
|
+
type: "object",
|
|
85
|
+
required: ["kind", "runId", "queryTaskId"],
|
|
86
|
+
properties: { kind: { const: "query" }, runId: ID, queryTaskId: ID },
|
|
87
|
+
additionalProperties: false
|
|
88
|
+
},
|
|
89
|
+
activityTaskRef: {
|
|
90
|
+
type: "object",
|
|
91
|
+
required: ["kind", "runId", "activityId", "attempt"],
|
|
92
|
+
properties: { kind: { const: "activity" }, runId: ID, activityId: ID, attempt: POSITIVE },
|
|
93
|
+
additionalProperties: false
|
|
94
|
+
},
|
|
95
|
+
taskRef: {
|
|
96
|
+
oneOf: [
|
|
97
|
+
{ $ref: "#/$defs/workflowTaskRef" },
|
|
98
|
+
{ $ref: "#/$defs/queryTaskRef" },
|
|
99
|
+
{ $ref: "#/$defs/activityTaskRef" }
|
|
100
|
+
]
|
|
101
|
+
},
|
|
102
|
+
historyPage: {
|
|
103
|
+
type: "object",
|
|
104
|
+
required: ["events", "from", "nextAfter", "hasMore"],
|
|
105
|
+
properties: {
|
|
106
|
+
events: { type: "array", items: { type: "object" } },
|
|
107
|
+
from: POSITIVE,
|
|
108
|
+
nextAfter: { oneOf: [{ type: "null" }, POSITIVE] },
|
|
109
|
+
hasMore: { type: "boolean" }
|
|
110
|
+
},
|
|
111
|
+
additionalProperties: false
|
|
112
|
+
},
|
|
113
|
+
queryRequests: {
|
|
114
|
+
type: "array",
|
|
115
|
+
items: {
|
|
116
|
+
type: "object",
|
|
117
|
+
required: ["queryId", "name"],
|
|
118
|
+
properties: { queryId: ID, name: ID, args: {} },
|
|
119
|
+
additionalProperties: false
|
|
120
|
+
}
|
|
121
|
+
},
|
|
122
|
+
queryResults: {
|
|
123
|
+
type: "array",
|
|
124
|
+
items: {
|
|
125
|
+
type: "object",
|
|
126
|
+
required: ["queryId"],
|
|
127
|
+
properties: {
|
|
128
|
+
queryId: ID,
|
|
129
|
+
value: {},
|
|
130
|
+
error: { type: "string" },
|
|
131
|
+
rejected: { type: "boolean" }
|
|
132
|
+
},
|
|
133
|
+
additionalProperties: false
|
|
134
|
+
}
|
|
135
|
+
},
|
|
136
|
+
hello: frame(
|
|
137
|
+
"hello",
|
|
138
|
+
[
|
|
139
|
+
"protocol",
|
|
140
|
+
"kind",
|
|
141
|
+
"sdk",
|
|
142
|
+
"identity",
|
|
143
|
+
"taskQueues",
|
|
144
|
+
"buildIds",
|
|
145
|
+
"workflows",
|
|
146
|
+
"activities",
|
|
147
|
+
"slots",
|
|
148
|
+
"host",
|
|
149
|
+
"encodings"
|
|
150
|
+
],
|
|
151
|
+
{
|
|
152
|
+
protocol: { const: BRIDGE_PROTOCOL_VERSION },
|
|
153
|
+
kind: { const: "worker" },
|
|
154
|
+
sdk: {
|
|
155
|
+
type: "object",
|
|
156
|
+
required: ["language", "version"],
|
|
157
|
+
properties: { language: { enum: ["typescript", "python"] }, version: ID },
|
|
158
|
+
additionalProperties: false
|
|
159
|
+
},
|
|
160
|
+
identity: ID,
|
|
161
|
+
taskQueues: { ...STRINGS, minItems: 1 },
|
|
162
|
+
buildIds: STRINGS,
|
|
163
|
+
workflows: STRINGS,
|
|
164
|
+
activities: STRINGS,
|
|
165
|
+
slots: {
|
|
166
|
+
type: "object",
|
|
167
|
+
required: ["workflow", "activity", "localActivity"],
|
|
168
|
+
properties: { workflow: COUNT, activity: COUNT, localActivity: COUNT },
|
|
169
|
+
additionalProperties: false
|
|
170
|
+
},
|
|
171
|
+
host: {
|
|
172
|
+
type: "object",
|
|
173
|
+
properties: {
|
|
174
|
+
os: { type: "string" },
|
|
175
|
+
arch: { type: "string" },
|
|
176
|
+
hostname: { type: "string" },
|
|
177
|
+
runtime: { type: "string" }
|
|
178
|
+
},
|
|
179
|
+
additionalProperties: false
|
|
180
|
+
},
|
|
181
|
+
encodings: STRINGS
|
|
182
|
+
}
|
|
183
|
+
),
|
|
184
|
+
ping: frame("ping", [], { t: { type: "number" } }),
|
|
185
|
+
pollers: frame("pollers", ["workflow", "activity"], { workflow: COUNT, activity: COUNT }),
|
|
186
|
+
taskResult: {
|
|
187
|
+
oneOf: [
|
|
188
|
+
frame("taskResult", ["taskRef", "commands", "logs", "cachedUpTo"], {
|
|
189
|
+
taskRef: { $ref: "#/$defs/workflowTaskRef" },
|
|
190
|
+
commands: { type: "array", items: { type: "object" } },
|
|
191
|
+
logs: { type: "array", items: { type: "object" } },
|
|
192
|
+
cachedUpTo: COUNT,
|
|
193
|
+
queryResults: { $ref: "#/$defs/queryResults" },
|
|
194
|
+
unfinishedHandlers: { type: "array", items: { type: "object" } }
|
|
195
|
+
}),
|
|
196
|
+
frame("taskResult", ["taskRef", "result"], {
|
|
197
|
+
taskRef: { $ref: "#/$defs/activityTaskRef" },
|
|
198
|
+
result: {}
|
|
199
|
+
}),
|
|
200
|
+
frame("taskResult", ["taskRef", "queryResults"], {
|
|
201
|
+
taskRef: { $ref: "#/$defs/queryTaskRef" },
|
|
202
|
+
queryResults: { $ref: "#/$defs/queryResults" }
|
|
203
|
+
})
|
|
204
|
+
]
|
|
205
|
+
},
|
|
206
|
+
taskFailed: {
|
|
207
|
+
oneOf: [
|
|
208
|
+
frame("taskFailed", ["taskRef", "failure"], {
|
|
209
|
+
taskRef: {
|
|
210
|
+
oneOf: [{ $ref: "#/$defs/workflowTaskRef" }, { $ref: "#/$defs/queryTaskRef" }]
|
|
211
|
+
},
|
|
212
|
+
failure: TASK_FAILURE
|
|
213
|
+
}),
|
|
214
|
+
frame("taskFailed", ["taskRef", "failure"], {
|
|
215
|
+
taskRef: { $ref: "#/$defs/activityTaskRef" },
|
|
216
|
+
failure: {
|
|
217
|
+
type: "object",
|
|
218
|
+
required: ["errorType", "message"],
|
|
219
|
+
description: "An activity failure (run-event failure shape)."
|
|
220
|
+
}
|
|
221
|
+
})
|
|
222
|
+
]
|
|
223
|
+
},
|
|
224
|
+
heartbeat: frame("heartbeat", ["reqId", "taskRef"], {
|
|
225
|
+
reqId: ID,
|
|
226
|
+
taskRef: { $ref: "#/$defs/activityTaskRef" },
|
|
227
|
+
details: {}
|
|
228
|
+
}),
|
|
229
|
+
workerHeartbeat: frame("workerHeartbeat", ["slots", "pollers", "tasksInFlight", "cachedRuns"], {
|
|
230
|
+
slots: {
|
|
231
|
+
type: "object",
|
|
232
|
+
required: ["workflow", "activity", "localActivity"],
|
|
233
|
+
properties: { workflow: SLOT_USAGE, activity: SLOT_USAGE, localActivity: SLOT_USAGE },
|
|
234
|
+
additionalProperties: false
|
|
235
|
+
},
|
|
236
|
+
pollers: {
|
|
237
|
+
type: "object",
|
|
238
|
+
required: ["workflow", "activity"],
|
|
239
|
+
properties: { workflow: COUNT, activity: COUNT },
|
|
240
|
+
additionalProperties: false
|
|
241
|
+
},
|
|
242
|
+
tasksInFlight: COUNT,
|
|
243
|
+
cachedRuns: COUNT
|
|
244
|
+
}),
|
|
245
|
+
req: frame("req", ["id", "method", "params"], {
|
|
246
|
+
id: ID,
|
|
247
|
+
method: { enum: [...BRIDGE_REQUEST_METHODS] },
|
|
248
|
+
params: { type: "object" }
|
|
249
|
+
}),
|
|
250
|
+
bye: frame("bye", ["reason"], { reason: { type: "string" } }),
|
|
251
|
+
welcome: frame(
|
|
252
|
+
"welcome",
|
|
253
|
+
[
|
|
254
|
+
"protocol",
|
|
255
|
+
"sessionId",
|
|
256
|
+
"workerId",
|
|
257
|
+
"workspaceId",
|
|
258
|
+
"heartbeatSeconds",
|
|
259
|
+
"workerHeartbeatSeconds",
|
|
260
|
+
"maxFrameBytes"
|
|
261
|
+
],
|
|
262
|
+
{
|
|
263
|
+
protocol: { const: BRIDGE_PROTOCOL_VERSION },
|
|
264
|
+
sessionId: ID,
|
|
265
|
+
workerId: { type: "string", pattern: "^worker:.+$" },
|
|
266
|
+
workspaceId: ID,
|
|
267
|
+
heartbeatSeconds: POSITIVE,
|
|
268
|
+
workerHeartbeatSeconds: POSITIVE,
|
|
269
|
+
maxFrameBytes: POSITIVE
|
|
270
|
+
}
|
|
271
|
+
),
|
|
272
|
+
task: {
|
|
273
|
+
oneOf: [
|
|
274
|
+
frame("task", ["taskRef", "lease", "request", "history"], {
|
|
275
|
+
taskRef: { $ref: "#/$defs/workflowTaskRef" },
|
|
276
|
+
lease: { type: "object" },
|
|
277
|
+
request: {
|
|
278
|
+
type: "object",
|
|
279
|
+
required: ["workflowFn", "info", "nowMs"],
|
|
280
|
+
properties: {
|
|
281
|
+
workflowFn: ID,
|
|
282
|
+
info: { type: "object" },
|
|
283
|
+
nowMs: { type: "number" },
|
|
284
|
+
updates: { type: "array", items: { type: "object" } },
|
|
285
|
+
queries: { $ref: "#/$defs/queryRequests" }
|
|
286
|
+
},
|
|
287
|
+
additionalProperties: false
|
|
288
|
+
},
|
|
289
|
+
history: { $ref: "#/$defs/historyPage" }
|
|
290
|
+
}),
|
|
291
|
+
frame("task", ["taskRef", "request", "history"], {
|
|
292
|
+
taskRef: { $ref: "#/$defs/queryTaskRef" },
|
|
293
|
+
request: {
|
|
294
|
+
type: "object",
|
|
295
|
+
required: ["workflowFn", "info", "queries"],
|
|
296
|
+
properties: {
|
|
297
|
+
workflowFn: ID,
|
|
298
|
+
info: { type: "object" },
|
|
299
|
+
queries: { $ref: "#/$defs/queryRequests" }
|
|
300
|
+
},
|
|
301
|
+
additionalProperties: false
|
|
302
|
+
},
|
|
303
|
+
history: { $ref: "#/$defs/historyPage" }
|
|
304
|
+
}),
|
|
305
|
+
frame("task", ["taskRef", "lease"], {
|
|
306
|
+
taskRef: { $ref: "#/$defs/activityTaskRef" },
|
|
307
|
+
lease: { type: "object" }
|
|
308
|
+
})
|
|
309
|
+
]
|
|
310
|
+
},
|
|
311
|
+
heartbeatAck: frame("heartbeatAck", ["reqId", "cancelRequested", "paused"], {
|
|
312
|
+
reqId: ID,
|
|
313
|
+
cancelRequested: { type: "boolean" },
|
|
314
|
+
paused: { type: "boolean" },
|
|
315
|
+
pauseReason: { type: "string" }
|
|
316
|
+
}),
|
|
317
|
+
cancel: frame("cancel", ["taskRef", "reason"], {
|
|
318
|
+
taskRef: { $ref: "#/$defs/taskRef" },
|
|
319
|
+
reason: { type: "string" }
|
|
320
|
+
}),
|
|
321
|
+
res: {
|
|
322
|
+
...frame("res", ["id", "ok"], {
|
|
323
|
+
id: ID,
|
|
324
|
+
ok: { type: "boolean" },
|
|
325
|
+
result: {},
|
|
326
|
+
error: {
|
|
327
|
+
type: "object",
|
|
328
|
+
required: ["code", "message"],
|
|
329
|
+
properties: { code: { type: "string" }, message: { type: "string" } },
|
|
330
|
+
additionalProperties: false
|
|
331
|
+
}
|
|
332
|
+
}),
|
|
333
|
+
if: { properties: { ok: { const: false } }, required: ["ok"] },
|
|
334
|
+
then: { required: ["error"] }
|
|
335
|
+
},
|
|
336
|
+
pong: frame("pong", [], { t: { type: "number" } }),
|
|
337
|
+
workerFrame: {
|
|
338
|
+
oneOf: [
|
|
339
|
+
{ $ref: "#/$defs/hello" },
|
|
340
|
+
{ $ref: "#/$defs/ping" },
|
|
341
|
+
{ $ref: "#/$defs/pollers" },
|
|
342
|
+
{ $ref: "#/$defs/taskResult" },
|
|
343
|
+
{ $ref: "#/$defs/taskFailed" },
|
|
344
|
+
{ $ref: "#/$defs/heartbeat" },
|
|
345
|
+
{ $ref: "#/$defs/workerHeartbeat" },
|
|
346
|
+
{ $ref: "#/$defs/req" },
|
|
347
|
+
{ $ref: "#/$defs/bye" }
|
|
348
|
+
]
|
|
349
|
+
},
|
|
350
|
+
serviceFrame: {
|
|
351
|
+
oneOf: [
|
|
352
|
+
{ $ref: "#/$defs/welcome" },
|
|
353
|
+
{ $ref: "#/$defs/task" },
|
|
354
|
+
{ $ref: "#/$defs/heartbeatAck" },
|
|
355
|
+
{ $ref: "#/$defs/cancel" },
|
|
356
|
+
{ $ref: "#/$defs/res" },
|
|
357
|
+
{ $ref: "#/$defs/pong" }
|
|
358
|
+
]
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
};
|
|
362
|
+
|
|
6
363
|
// src/history/schema.ts
|
|
7
364
|
var BASE = "https://docs.fluidgrids.ai/schemas";
|
|
8
365
|
var RUN_EVENT_SCHEMA_ID = `${BASE}/run-event.schema.json`;
|
|
@@ -10,9 +367,27 @@ var WORKFLOW_COMMAND_SCHEMA_ID = `${BASE}/workflow-command.schema.json`;
|
|
|
10
367
|
var WORKFLOW_TASK_SCHEMA_ID = `${BASE}/workflow-task.schema.json`;
|
|
11
368
|
var HISTORY_FILE_SCHEMA_ID = `${BASE}/history-file.schema.json`;
|
|
12
369
|
var HISTORY_FILE_FORMAT = "fluidgrids.history";
|
|
13
|
-
var
|
|
370
|
+
var ID2 = { type: "string", minLength: 1, maxLength: 256 };
|
|
14
371
|
var NON_NEGATIVE_MS = { type: "integer", minimum: 0 };
|
|
15
|
-
var STRING_MAP = {
|
|
372
|
+
var STRING_MAP = {
|
|
373
|
+
type: "object",
|
|
374
|
+
additionalProperties: { type: "string" },
|
|
375
|
+
description: "Interceptor headers (11 \xA72.10): string values; a user activity carries at most 16 KiB of JSON (checked by validateCommands)."
|
|
376
|
+
};
|
|
377
|
+
var FAIRNESS_KEY = {
|
|
378
|
+
type: "string",
|
|
379
|
+
minLength: 1,
|
|
380
|
+
maxLength: FAIRNESS_KEY_MAX_LENGTH,
|
|
381
|
+
description: "Phase C: the fairness key of the task (11 \xA72.11); default the workspace id."
|
|
382
|
+
};
|
|
383
|
+
var FAIRNESS_WEIGHT = {
|
|
384
|
+
type: "number",
|
|
385
|
+
minimum: FAIRNESS_WEIGHT_MIN,
|
|
386
|
+
maximum: FAIRNESS_WEIGHT_MAX,
|
|
387
|
+
description: "Phase C: the weight of the fairness key, 0.1 to 10 (default 1)."
|
|
388
|
+
};
|
|
389
|
+
var ACTIVITY_NAME = { type: "string", pattern: ACTIVITY_NAME_PATTERN };
|
|
390
|
+
var TASK_QUEUE_NAME = { type: "string", pattern: TASK_QUEUE_NAME_PATTERN };
|
|
16
391
|
var SHARED_DEFS = {
|
|
17
392
|
json: {
|
|
18
393
|
description: "Any JSON value."
|
|
@@ -54,7 +429,7 @@ var SHARED_DEFS = {
|
|
|
54
429
|
{
|
|
55
430
|
type: "object",
|
|
56
431
|
required: ["runId"],
|
|
57
|
-
properties: { runId:
|
|
432
|
+
properties: { runId: ID2 },
|
|
58
433
|
additionalProperties: false
|
|
59
434
|
},
|
|
60
435
|
{
|
|
@@ -66,14 +441,14 @@ var SHARED_DEFS = {
|
|
|
66
441
|
{
|
|
67
442
|
type: "object",
|
|
68
443
|
required: ["childId"],
|
|
69
|
-
properties: { childId:
|
|
444
|
+
properties: { childId: ID2 },
|
|
70
445
|
additionalProperties: false
|
|
71
446
|
},
|
|
72
447
|
{
|
|
73
448
|
type: "object",
|
|
74
449
|
required: ["workflowKey", "workflowId"],
|
|
75
450
|
description: "The open run of a workflow id, following its continue-as-new chain; firstRunId pins the chain (R2).",
|
|
76
|
-
properties: { workflowKey:
|
|
451
|
+
properties: { workflowKey: ID2, workflowId: ID2, firstRunId: ID2 },
|
|
77
452
|
additionalProperties: false
|
|
78
453
|
}
|
|
79
454
|
]
|
|
@@ -108,8 +483,8 @@ var SHARED_DEFS = {
|
|
|
108
483
|
properties: {
|
|
109
484
|
parentClosePolicy: { enum: [...PARENT_CLOSE_POLICIES] },
|
|
110
485
|
cancellationType: { enum: [...CHILD_CANCELLATION_TYPES] },
|
|
111
|
-
taskQueue:
|
|
112
|
-
workflowId:
|
|
486
|
+
taskQueue: ID2,
|
|
487
|
+
workflowId: ID2,
|
|
113
488
|
priority: { type: "integer", minimum: 1, maximum: 5 },
|
|
114
489
|
summary: { type: "string", maxLength: 200 },
|
|
115
490
|
details: { type: "string" },
|
|
@@ -121,7 +496,9 @@ var SHARED_DEFS = {
|
|
|
121
496
|
retry: { $ref: "#/$defs/runRetryPolicy" },
|
|
122
497
|
versioningBehavior: { enum: [...VERSIONING_BEHAVIORS] },
|
|
123
498
|
idReusePolicy: { enum: [...WORKFLOW_ID_REUSE_POLICIES] },
|
|
124
|
-
idConflictPolicy: { enum: [...WORKFLOW_ID_CONFLICT_POLICIES] }
|
|
499
|
+
idConflictPolicy: { enum: [...WORKFLOW_ID_CONFLICT_POLICIES] },
|
|
500
|
+
fairnessKey: FAIRNESS_KEY,
|
|
501
|
+
fairnessWeight: FAIRNESS_WEIGHT
|
|
125
502
|
}
|
|
126
503
|
},
|
|
127
504
|
legacyCanRetryPolicy: {
|
|
@@ -142,7 +519,7 @@ var SHARED_DEFS = {
|
|
|
142
519
|
type: "object",
|
|
143
520
|
description: "Options of a CONTINUE_AS_NEW command (C-SCHEMA, frozen in R2). retry is the R2 run-retry policy of the new run, or the R1 activity shape (retryDelay, maxRetries, maxDelay) that R1 bundles wrote and R2 bundles still write for that shape: it never had a meaning, and the service ignores it instead of reading it as a run-retry policy.",
|
|
144
521
|
properties: {
|
|
145
|
-
taskQueue:
|
|
522
|
+
taskQueue: ID2,
|
|
146
523
|
retry: {
|
|
147
524
|
oneOf: [{ $ref: "#/$defs/runRetryPolicy" }, { $ref: "#/$defs/legacyCanRetryPolicy" }]
|
|
148
525
|
},
|
|
@@ -162,41 +539,68 @@ function command(type, required, properties) {
|
|
|
162
539
|
additionalProperties: false
|
|
163
540
|
};
|
|
164
541
|
}
|
|
542
|
+
var ACTIVITY_COMMON = {
|
|
543
|
+
activityId: ID2,
|
|
544
|
+
args: {},
|
|
545
|
+
retry: { $ref: "#/$defs/retryPolicy" },
|
|
546
|
+
startToCloseTimeout: NON_NEGATIVE_MS,
|
|
547
|
+
scheduleToCloseTimeout: NON_NEGATIVE_MS,
|
|
548
|
+
scheduleToStartTimeout: NON_NEGATIVE_MS,
|
|
549
|
+
heartbeatTimeout: NON_NEGATIVE_MS,
|
|
550
|
+
cancellationType: { enum: [...ACTIVITY_CANCELLATION_TYPES] },
|
|
551
|
+
priority: { type: "integer", minimum: 1, maximum: 5 },
|
|
552
|
+
summary: { type: "string", maxLength: 200 },
|
|
553
|
+
fairnessKey: FAIRNESS_KEY,
|
|
554
|
+
fairnessWeight: FAIRNESS_WEIGHT
|
|
555
|
+
};
|
|
556
|
+
var NODE_ACTIVITY = {
|
|
557
|
+
kind: { const: "node" },
|
|
558
|
+
nodeType: ID2,
|
|
559
|
+
nodeVersion: { type: "string" },
|
|
560
|
+
operation: ID2,
|
|
561
|
+
connection: ID2,
|
|
562
|
+
runOn: { type: "string" }
|
|
563
|
+
};
|
|
564
|
+
var USER_ACTIVITY = {
|
|
565
|
+
kind: { const: "user" },
|
|
566
|
+
activityName: ACTIVITY_NAME,
|
|
567
|
+
taskQueue: TASK_QUEUE_NAME,
|
|
568
|
+
connections: {
|
|
569
|
+
type: "array",
|
|
570
|
+
maxItems: MAX_ACTIVITY_CONNECTIONS,
|
|
571
|
+
uniqueItems: true,
|
|
572
|
+
items: ID2,
|
|
573
|
+
description: "Connection names the worker may resolve for each started attempt (H2: declared by the definition and on the worker token allow-list)."
|
|
574
|
+
}
|
|
575
|
+
};
|
|
576
|
+
var NODE_ACTIVITY_REQUIRED = ["activityId", "kind", "nodeType", "operation", "args", "retry"];
|
|
577
|
+
var USER_ACTIVITY_REQUIRED = ["activityId", "kind", "activityName", "taskQueue", "args", "retry"];
|
|
165
578
|
var COMMAND_DEFS = {
|
|
166
|
-
SCHEDULE_ACTIVITY:
|
|
167
|
-
"
|
|
168
|
-
[
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
scheduleToStartTimeout: NON_NEGATIVE_MS,
|
|
181
|
-
heartbeatTimeout: NON_NEGATIVE_MS,
|
|
182
|
-
cancellationType: { enum: [...ACTIVITY_CANCELLATION_TYPES] },
|
|
183
|
-
priority: { type: "integer", minimum: 1, maximum: 5 },
|
|
184
|
-
summary: { type: "string", maxLength: 200 },
|
|
185
|
-
runOn: { type: "string" }
|
|
186
|
-
}
|
|
187
|
-
),
|
|
188
|
-
REQUEST_CANCEL_ACTIVITY: command("REQUEST_CANCEL_ACTIVITY", ["activityId"], { activityId: ID }),
|
|
579
|
+
SCHEDULE_ACTIVITY: {
|
|
580
|
+
description: "A oneOf on kind (C-CMD-C): node runs a canvas node operation; user (Phase C) runs a user activity on a self-hosted task queue.",
|
|
581
|
+
oneOf: [
|
|
582
|
+
command("SCHEDULE_ACTIVITY", NODE_ACTIVITY_REQUIRED.slice(), {
|
|
583
|
+
...ACTIVITY_COMMON,
|
|
584
|
+
...NODE_ACTIVITY
|
|
585
|
+
}),
|
|
586
|
+
command("SCHEDULE_ACTIVITY", USER_ACTIVITY_REQUIRED.slice(), {
|
|
587
|
+
...ACTIVITY_COMMON,
|
|
588
|
+
...USER_ACTIVITY
|
|
589
|
+
})
|
|
590
|
+
]
|
|
591
|
+
},
|
|
592
|
+
REQUEST_CANCEL_ACTIVITY: command("REQUEST_CANCEL_ACTIVITY", ["activityId"], { activityId: ID2 }),
|
|
189
593
|
START_TIMER: command("START_TIMER", ["timerId", "durationMs"], {
|
|
190
|
-
timerId:
|
|
594
|
+
timerId: ID2,
|
|
191
595
|
durationMs: { type: "integer", minimum: 1 },
|
|
192
596
|
summary: { type: "string", maxLength: 200 }
|
|
193
597
|
}),
|
|
194
|
-
CANCEL_TIMER: command("CANCEL_TIMER", ["timerId"], { timerId:
|
|
598
|
+
CANCEL_TIMER: command("CANCEL_TIMER", ["timerId"], { timerId: ID2 }),
|
|
195
599
|
START_CHILD_RUN: {
|
|
196
600
|
...command("START_CHILD_RUN", ["childId", "input", "options"], {
|
|
197
|
-
childId:
|
|
198
|
-
workflowKey:
|
|
199
|
-
workflowFn:
|
|
601
|
+
childId: ID2,
|
|
602
|
+
workflowKey: ID2,
|
|
603
|
+
workflowFn: ID2,
|
|
200
604
|
version: { type: "string", minLength: 1 },
|
|
201
605
|
input: {},
|
|
202
606
|
options: { $ref: "#/$defs/childOptions" }
|
|
@@ -204,16 +608,16 @@ var COMMAND_DEFS = {
|
|
|
204
608
|
oneOf: [{ required: ["workflowKey"] }, { required: ["workflowFn"] }]
|
|
205
609
|
},
|
|
206
610
|
SIGNAL_RUN: command("SIGNAL_RUN", ["externalId", "target", "name", "payload"], {
|
|
207
|
-
externalId:
|
|
611
|
+
externalId: ID2,
|
|
208
612
|
target: { $ref: "#/$defs/runTarget" },
|
|
209
|
-
name:
|
|
613
|
+
name: ID2,
|
|
210
614
|
payload: {}
|
|
211
615
|
}),
|
|
212
616
|
RECORD_SIDE_EFFECT: command("RECORD_SIDE_EFFECT", ["sideEffectId", "value"], {
|
|
213
|
-
sideEffectId:
|
|
617
|
+
sideEffectId: ID2,
|
|
214
618
|
value: {}
|
|
215
619
|
}),
|
|
216
|
-
RECORD_MARKER: command("RECORD_MARKER", ["markerId", "data"], { markerId:
|
|
620
|
+
RECORD_MARKER: command("RECORD_MARKER", ["markerId", "data"], { markerId: ID2, data: {} }),
|
|
217
621
|
COMPLETE_WORKFLOW: command("COMPLETE_WORKFLOW", ["output"], { output: {} }),
|
|
218
622
|
FAIL_WORKFLOW: command("FAIL_WORKFLOW", ["failure"], {
|
|
219
623
|
failure: { $ref: "#/$defs/failure" }
|
|
@@ -222,12 +626,12 @@ var COMMAND_DEFS = {
|
|
|
222
626
|
UPSERT_CONTEXT: command("UPSERT_CONTEXT", ["entries"], { entries: { type: "object" } }),
|
|
223
627
|
RECORD_LOCAL_ACTIVITY: {
|
|
224
628
|
...command("RECORD_LOCAL_ACTIVITY", ["localActivityId", "attempts"], {
|
|
225
|
-
localActivityId:
|
|
629
|
+
localActivityId: ID2,
|
|
226
630
|
result: {},
|
|
227
631
|
failure: { $ref: "#/$defs/failure" },
|
|
228
632
|
attempts: { type: "integer", minimum: 1 },
|
|
229
|
-
nodeType:
|
|
230
|
-
operation:
|
|
633
|
+
nodeType: ID2,
|
|
634
|
+
operation: ID2,
|
|
231
635
|
summary: { type: "string", maxLength: 200 }
|
|
232
636
|
}),
|
|
233
637
|
oneOf: [{ required: ["result"] }, { required: ["failure"] }]
|
|
@@ -237,19 +641,19 @@ var COMMAND_DEFS = {
|
|
|
237
641
|
options: { $ref: "#/$defs/canOptions" }
|
|
238
642
|
}),
|
|
239
643
|
REQUEST_CANCEL_EXTERNAL_RUN: command("REQUEST_CANCEL_EXTERNAL_RUN", ["externalId", "target"], {
|
|
240
|
-
externalId:
|
|
644
|
+
externalId: ID2,
|
|
241
645
|
target: { $ref: "#/$defs/runTarget" }
|
|
242
646
|
}),
|
|
243
647
|
UPSERT_SEARCH_ATTRIBUTES: command("UPSERT_SEARCH_ATTRIBUTES", ["attributes"], {
|
|
244
648
|
attributes: { type: "object" }
|
|
245
649
|
}),
|
|
246
|
-
ACCEPT_UPDATE: command("ACCEPT_UPDATE", ["updateId"], { updateId:
|
|
650
|
+
ACCEPT_UPDATE: command("ACCEPT_UPDATE", ["updateId"], { updateId: ID2 }),
|
|
247
651
|
REJECT_UPDATE: command("REJECT_UPDATE", ["updateId", "failure"], {
|
|
248
|
-
updateId:
|
|
652
|
+
updateId: ID2,
|
|
249
653
|
failure: { $ref: "#/$defs/failure" }
|
|
250
654
|
}),
|
|
251
655
|
COMPLETE_UPDATE: command("COMPLETE_UPDATE", ["updateId"], {
|
|
252
|
-
updateId:
|
|
656
|
+
updateId: ID2,
|
|
253
657
|
result: {},
|
|
254
658
|
failure: { $ref: "#/$defs/failure" }
|
|
255
659
|
})
|
|
@@ -260,7 +664,7 @@ function payload(required, properties) {
|
|
|
260
664
|
var FAILURE_REF = { $ref: "#/$defs/failure" };
|
|
261
665
|
var EVENT_PAYLOADS = {
|
|
262
666
|
WORKFLOW_STARTED: payload(["workflowFn", "input"], {
|
|
263
|
-
workflowFn:
|
|
667
|
+
workflowFn: ID2,
|
|
264
668
|
input: {},
|
|
265
669
|
workflowKey: { type: "string" },
|
|
266
670
|
version: {},
|
|
@@ -282,7 +686,7 @@ var EVENT_PAYLOADS = {
|
|
|
282
686
|
workflowTaskTimeout: NON_NEGATIVE_MS,
|
|
283
687
|
versioningBehavior: { enum: [...VERSIONING_BEHAVIORS] },
|
|
284
688
|
/** Seed of `ctx.random()`/`ctx.uuid()`; the service writes the run id. Absent: `info.runId`. */
|
|
285
|
-
randomnessSeed:
|
|
689
|
+
randomnessSeed: ID2,
|
|
286
690
|
startDelayMs: {
|
|
287
691
|
...NON_NEGATIVE_MS,
|
|
288
692
|
description: "R2: the start delay of a delayed run (11 \xA72.23); the first task waits for it."
|
|
@@ -299,14 +703,21 @@ var EVENT_PAYLOADS = {
|
|
|
299
703
|
workflowId: { type: "string", description: "R2: the same value as businessId." },
|
|
300
704
|
timeouts: { $ref: "#/$defs/timeouts" },
|
|
301
705
|
retry: { $ref: "#/$defs/runRetryPolicy" },
|
|
302
|
-
priority: { type: "integer", minimum: 1, maximum: 5 }
|
|
706
|
+
priority: { type: "integer", minimum: 1, maximum: 5 },
|
|
707
|
+
headers: { $ref: "#/$defs/headers" },
|
|
708
|
+
searchAttributes: {
|
|
709
|
+
type: "object",
|
|
710
|
+
description: "Phase C: the search attributes the start set (11 \xA72.8)."
|
|
711
|
+
},
|
|
712
|
+
fairnessKey: FAIRNESS_KEY,
|
|
713
|
+
fairnessWeight: FAIRNESS_WEIGHT
|
|
303
714
|
}),
|
|
304
715
|
WORKFLOW_TASK_SCHEDULED: payload(["taskId"], {
|
|
305
|
-
taskId:
|
|
716
|
+
taskId: ID2,
|
|
306
717
|
attempt: { type: "integer", minimum: 1 }
|
|
307
718
|
}),
|
|
308
719
|
WORKFLOW_TASK_STARTED: payload(["taskId", "attempt"], {
|
|
309
|
-
taskId:
|
|
720
|
+
taskId: ID2,
|
|
310
721
|
attempt: { type: "integer", minimum: 1 },
|
|
311
722
|
workerId: { type: "string" },
|
|
312
723
|
buildId: { type: "string" },
|
|
@@ -324,12 +735,12 @@ var EVENT_PAYLOADS = {
|
|
|
324
735
|
}
|
|
325
736
|
}),
|
|
326
737
|
WORKFLOW_TASK_COMPLETED: payload(["taskId"], {
|
|
327
|
-
taskId:
|
|
738
|
+
taskId: ID2,
|
|
328
739
|
buildId: { type: "string" },
|
|
329
740
|
workerId: { type: "string" }
|
|
330
741
|
}),
|
|
331
742
|
WORKFLOW_TASK_FAILED: payload(["taskId", "attempt", "cause"], {
|
|
332
|
-
taskId:
|
|
743
|
+
taskId: ID2,
|
|
333
744
|
attempt: { type: "integer", minimum: 1 },
|
|
334
745
|
cause: { enum: [...TASK_FAILURE_CAUSES] },
|
|
335
746
|
message: { type: "string" },
|
|
@@ -337,102 +748,125 @@ var EVENT_PAYLOADS = {
|
|
|
337
748
|
buildId: { type: "string" }
|
|
338
749
|
}),
|
|
339
750
|
WORKFLOW_TASK_TIMED_OUT: payload(["taskId", "attempt"], {
|
|
340
|
-
taskId:
|
|
751
|
+
taskId: ID2,
|
|
341
752
|
attempt: { type: "integer", minimum: 1 }
|
|
342
753
|
}),
|
|
343
|
-
ACTIVITY_SCHEDULED:
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
754
|
+
ACTIVITY_SCHEDULED: {
|
|
755
|
+
description: "The SCHEDULE_ACTIVITY command as the service accepted it: kind node, or kind user (Phase C) with activityName, taskQueue, fairness, connections and headers.",
|
|
756
|
+
oneOf: [
|
|
757
|
+
payload(NODE_ACTIVITY_REQUIRED.slice(), {
|
|
758
|
+
...ACTIVITY_COMMON,
|
|
759
|
+
...NODE_ACTIVITY,
|
|
760
|
+
headers: { $ref: "#/$defs/headers" }
|
|
761
|
+
}),
|
|
762
|
+
payload(USER_ACTIVITY_REQUIRED.slice(), {
|
|
763
|
+
...ACTIVITY_COMMON,
|
|
764
|
+
...USER_ACTIVITY,
|
|
765
|
+
headers: { $ref: "#/$defs/headers" }
|
|
766
|
+
})
|
|
767
|
+
]
|
|
768
|
+
},
|
|
347
769
|
ACTIVITY_STARTED: payload(["activityId", "attempt"], {
|
|
348
|
-
activityId:
|
|
770
|
+
activityId: ID2,
|
|
349
771
|
attempt: { type: "integer", minimum: 1 },
|
|
350
772
|
workerId: { type: "string" }
|
|
351
773
|
}),
|
|
352
|
-
ACTIVITY_HEARTBEAT: payload(["activityId"], { activityId:
|
|
774
|
+
ACTIVITY_HEARTBEAT: payload(["activityId"], { activityId: ID2, details: {} }),
|
|
353
775
|
ACTIVITY_COMPLETED: payload(["activityId", "attempt"], {
|
|
354
|
-
activityId:
|
|
776
|
+
activityId: ID2,
|
|
355
777
|
attempt: { type: "integer", minimum: 1 },
|
|
356
778
|
result: {}
|
|
357
779
|
}),
|
|
358
780
|
ACTIVITY_FAILED: payload(["activityId", "attempt", "failure"], {
|
|
359
|
-
activityId:
|
|
781
|
+
activityId: ID2,
|
|
360
782
|
attempt: { type: "integer", minimum: 1 },
|
|
361
783
|
failure: FAILURE_REF
|
|
362
784
|
}),
|
|
363
785
|
ACTIVITY_TIMED_OUT: payload(["activityId", "attempt", "timeoutType"], {
|
|
364
|
-
activityId:
|
|
786
|
+
activityId: ID2,
|
|
365
787
|
attempt: { type: "integer", minimum: 1 },
|
|
366
788
|
timeoutType: {
|
|
367
789
|
enum: ["START_TO_CLOSE", "SCHEDULE_TO_START", "SCHEDULE_TO_CLOSE", "HEARTBEAT"]
|
|
368
790
|
},
|
|
369
791
|
failure: FAILURE_REF
|
|
370
792
|
}),
|
|
371
|
-
ACTIVITY_CANCEL_REQUESTED: payload(["activityId"], { activityId:
|
|
372
|
-
ACTIVITY_CANCELLED: payload(["activityId"], { activityId:
|
|
373
|
-
ACTIVITY_PAUSED: payload(["activityId"], { activityId:
|
|
374
|
-
ACTIVITY_UNPAUSED: payload(["activityId"], { activityId:
|
|
375
|
-
ACTIVITY_RESET: payload(["activityId"], { activityId:
|
|
793
|
+
ACTIVITY_CANCEL_REQUESTED: payload(["activityId"], { activityId: ID2 }),
|
|
794
|
+
ACTIVITY_CANCELLED: payload(["activityId"], { activityId: ID2, details: {} }),
|
|
795
|
+
ACTIVITY_PAUSED: payload(["activityId"], { activityId: ID2, reason: { type: "string" } }),
|
|
796
|
+
ACTIVITY_UNPAUSED: payload(["activityId"], { activityId: ID2 }),
|
|
797
|
+
ACTIVITY_RESET: payload(["activityId"], { activityId: ID2 }),
|
|
376
798
|
ACTIVITY_OPTIONS_UPDATED: payload(["activityId"], {
|
|
377
|
-
activityId:
|
|
799
|
+
activityId: ID2,
|
|
378
800
|
options: { type: "object" }
|
|
379
801
|
}),
|
|
380
802
|
TIMER_STARTED: payload(["timerId", "durationMs", "fireAt"], {
|
|
381
|
-
timerId:
|
|
803
|
+
timerId: ID2,
|
|
382
804
|
durationMs: { type: "integer", minimum: 1 },
|
|
383
805
|
fireAt: { type: "string" },
|
|
384
806
|
summary: { type: "string" }
|
|
385
807
|
}),
|
|
386
|
-
TIMER_FIRED: payload(["timerId"], { timerId:
|
|
387
|
-
TIMER_CANCELLED: payload(["timerId"], { timerId:
|
|
808
|
+
TIMER_FIRED: payload(["timerId"], { timerId: ID2 }),
|
|
809
|
+
TIMER_CANCELLED: payload(["timerId"], { timerId: ID2 }),
|
|
388
810
|
SIGNAL_RECEIVED: payload(["name"], {
|
|
389
|
-
name:
|
|
811
|
+
name: ID2,
|
|
390
812
|
payload: {},
|
|
391
813
|
receivedAt: { type: "string" },
|
|
392
814
|
actor: {},
|
|
393
|
-
idempotencyKey: { type: "string" }
|
|
815
|
+
idempotencyKey: { type: "string" },
|
|
816
|
+
headers: { $ref: "#/$defs/headers" }
|
|
817
|
+
}),
|
|
818
|
+
UPDATE_ADMITTED: payload(["updateId", "name"], {
|
|
819
|
+
updateId: ID2,
|
|
820
|
+
name: ID2,
|
|
821
|
+
args: {},
|
|
822
|
+
headers: { $ref: "#/$defs/headers" }
|
|
394
823
|
}),
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
824
|
+
UPDATE_ACCEPTED: payload(["updateId", "name"], {
|
|
825
|
+
updateId: ID2,
|
|
826
|
+
name: ID2,
|
|
827
|
+
args: {},
|
|
828
|
+
headers: { $ref: "#/$defs/headers" }
|
|
829
|
+
}),
|
|
830
|
+
UPDATE_COMPLETED: payload(["updateId"], { updateId: ID2, result: {}, failure: FAILURE_REF }),
|
|
398
831
|
CHILD_RUN_INITIATED: payload(["childId", "input", "options"], {
|
|
399
|
-
childId:
|
|
400
|
-
workflowKey:
|
|
401
|
-
workflowFn:
|
|
832
|
+
childId: ID2,
|
|
833
|
+
workflowKey: ID2,
|
|
834
|
+
workflowFn: ID2,
|
|
402
835
|
version: { type: "string" },
|
|
403
836
|
input: {},
|
|
404
837
|
options: { $ref: "#/$defs/childOptions" },
|
|
405
838
|
childRunId: { type: "string" },
|
|
406
|
-
executionKind: { enum: ["GRAPH", "DURABLE_FN"] }
|
|
839
|
+
executionKind: { enum: ["GRAPH", "DURABLE_FN"] },
|
|
840
|
+
headers: { $ref: "#/$defs/headers" }
|
|
407
841
|
}),
|
|
408
842
|
CHILD_RUN_STARTED: payload(["childId", "childRunId"], {
|
|
409
|
-
childId:
|
|
410
|
-
childRunId:
|
|
843
|
+
childId: ID2,
|
|
844
|
+
childRunId: ID2,
|
|
411
845
|
executionKind: { enum: ["GRAPH", "DURABLE_FN"] }
|
|
412
846
|
}),
|
|
413
|
-
CHILD_RUN_COMPLETED: payload(["childId"], { childId:
|
|
847
|
+
CHILD_RUN_COMPLETED: payload(["childId"], { childId: ID2, childRunId: ID2, result: {} }),
|
|
414
848
|
CHILD_RUN_FAILED: payload(["childId", "failure"], {
|
|
415
|
-
childId:
|
|
416
|
-
childRunId:
|
|
849
|
+
childId: ID2,
|
|
850
|
+
childRunId: ID2,
|
|
417
851
|
failure: FAILURE_REF
|
|
418
852
|
}),
|
|
419
|
-
CHILD_RUN_CANCELLED: payload(["childId"], { childId:
|
|
853
|
+
CHILD_RUN_CANCELLED: payload(["childId"], { childId: ID2, childRunId: ID2 }),
|
|
420
854
|
CHILD_RUN_TERMINATED: payload(["childId"], {
|
|
421
|
-
childId:
|
|
422
|
-
childRunId:
|
|
855
|
+
childId: ID2,
|
|
856
|
+
childRunId: ID2,
|
|
423
857
|
reason: { type: "string" }
|
|
424
858
|
}),
|
|
425
859
|
CHILD_RUN_TIMED_OUT: payload(["childId"], {
|
|
426
|
-
childId:
|
|
427
|
-
childRunId:
|
|
860
|
+
childId: ID2,
|
|
861
|
+
childRunId: ID2,
|
|
428
862
|
timeoutType: { enum: [...WORKFLOW_TIMEOUT_TYPES] }
|
|
429
863
|
}),
|
|
430
864
|
EXTERNAL_RUN_CANCEL_REQUESTED: payload(["externalId", "target"], {
|
|
431
|
-
externalId:
|
|
865
|
+
externalId: ID2,
|
|
432
866
|
target: { $ref: "#/$defs/runTarget" }
|
|
433
867
|
}),
|
|
434
868
|
EXTERNAL_RUN_CANCEL_RESOLVED: payload(["externalId", "ok"], {
|
|
435
|
-
externalId:
|
|
869
|
+
externalId: ID2,
|
|
436
870
|
ok: { type: "boolean" },
|
|
437
871
|
targetRunId: { type: "string" },
|
|
438
872
|
failure: FAILURE_REF
|
|
@@ -442,9 +876,9 @@ var EVENT_PAYLOADS = {
|
|
|
442
876
|
required: ["externalId"],
|
|
443
877
|
description: "Two forms. Initiated (appended for the SIGNAL_RUN command): {externalId, target, name, payload}. Resolved (appended by the service after delivery, dedupeKey signal-out:<runId>:<externalId>): {externalId, resolved: true, ok, failure?, targetRunId?}.",
|
|
444
878
|
properties: {
|
|
445
|
-
externalId:
|
|
879
|
+
externalId: ID2,
|
|
446
880
|
target: { $ref: "#/$defs/runTarget" },
|
|
447
|
-
name:
|
|
881
|
+
name: ID2,
|
|
448
882
|
payload: {},
|
|
449
883
|
resolved: { const: true },
|
|
450
884
|
ok: { type: "boolean" },
|
|
@@ -455,34 +889,37 @@ var EVENT_PAYLOADS = {
|
|
|
455
889
|
then: { required: ["ok"] },
|
|
456
890
|
else: { required: ["target", "name"] }
|
|
457
891
|
},
|
|
458
|
-
SIDE_EFFECT_RECORDED: payload(["sideEffectId", "value"], { sideEffectId:
|
|
892
|
+
SIDE_EFFECT_RECORDED: payload(["sideEffectId", "value"], { sideEffectId: ID2, value: {} }),
|
|
459
893
|
LOCAL_ACTIVITY_COMPLETED: payload(["localActivityId", "attempts"], {
|
|
460
|
-
localActivityId:
|
|
894
|
+
localActivityId: ID2,
|
|
461
895
|
result: {},
|
|
462
896
|
attempts: { type: "integer", minimum: 1 },
|
|
463
|
-
nodeType:
|
|
464
|
-
operation:
|
|
897
|
+
nodeType: ID2,
|
|
898
|
+
operation: ID2,
|
|
465
899
|
summary: { type: "string" }
|
|
466
900
|
}),
|
|
467
901
|
LOCAL_ACTIVITY_FAILED: payload(["localActivityId", "attempts", "failure"], {
|
|
468
|
-
localActivityId:
|
|
902
|
+
localActivityId: ID2,
|
|
469
903
|
failure: FAILURE_REF,
|
|
470
904
|
attempts: { type: "integer", minimum: 1 },
|
|
471
|
-
nodeType:
|
|
472
|
-
operation:
|
|
905
|
+
nodeType: ID2,
|
|
906
|
+
operation: ID2,
|
|
473
907
|
summary: { type: "string" }
|
|
474
908
|
}),
|
|
475
909
|
SEARCH_ATTRIBUTES_UPSERTED: payload(["attributes"], { attributes: { type: "object" } }),
|
|
476
910
|
CONTEXT_UPSERTED: payload(["entries"], { entries: { type: "object" } }),
|
|
477
911
|
MARKER_RECORDED: payload(["markerId", "data"], {
|
|
478
|
-
markerId:
|
|
912
|
+
markerId: ID2,
|
|
479
913
|
data: {}
|
|
480
914
|
}),
|
|
481
915
|
WORKFLOW_CANCEL_REQUESTED: payload([], { actor: {}, reason: { type: "string" } }),
|
|
482
916
|
WORKFLOW_RESET: payload(["fromRunId", "toSeq"], {
|
|
483
|
-
fromRunId:
|
|
917
|
+
fromRunId: ID2,
|
|
484
918
|
toSeq: { type: "integer", minimum: 1 },
|
|
485
|
-
reason: { type: "string" }
|
|
919
|
+
reason: { type: "string" },
|
|
920
|
+
actor: {},
|
|
921
|
+
reapplySignals: { type: "boolean" },
|
|
922
|
+
reapplyUpdates: { type: "boolean" }
|
|
486
923
|
}),
|
|
487
924
|
VERSIONING_OVERRIDE_SET: payload(["override"], {
|
|
488
925
|
override: {
|
|
@@ -581,7 +1018,7 @@ var WORKFLOW_COMMAND_SCHEMA = {
|
|
|
581
1018
|
$schema: "https://json-schema.org/draft/2020-12/schema",
|
|
582
1019
|
$id: WORKFLOW_COMMAND_SCHEMA_ID,
|
|
583
1020
|
title: "FluidGrids workflow-task command",
|
|
584
|
-
description: "A flat object discriminated by an UPPER_SNAKE type. Commands travel as [JSON!]! (DB4). UPSERT_SEARCH_ATTRIBUTES, ACCEPT_UPDATE, REJECT_UPDATE and
|
|
1021
|
+
description: "A flat object discriminated by an UPPER_SNAKE type. Commands travel as [JSON!]! (DB4). UPSERT_SEARCH_ATTRIBUTES, ACCEPT_UPDATE, REJECT_UPDATE, COMPLETE_UPDATE and SCHEDULE_ACTIVITY of kind user are Phase C: the service accepts them only for the C-GATE features its flags enable (c.searchAttributes, c.updates, c.userActivity).",
|
|
585
1022
|
...COMMAND_ONE_OF,
|
|
586
1023
|
$defs: { ...SHARED_DEFS, ...commandDefs() }
|
|
587
1024
|
};
|
|
@@ -601,8 +1038,8 @@ var WORKFLOW_TASK_SCHEMA = {
|
|
|
601
1038
|
type: "object",
|
|
602
1039
|
required: ["runId", "workspaceId"],
|
|
603
1040
|
properties: {
|
|
604
|
-
runId:
|
|
605
|
-
workspaceId:
|
|
1041
|
+
runId: ID2,
|
|
1042
|
+
workspaceId: ID2,
|
|
606
1043
|
workflowKey: { type: "string" },
|
|
607
1044
|
version: {},
|
|
608
1045
|
buildId: { type: "string" },
|
|
@@ -635,9 +1072,36 @@ var WORKFLOW_TASK_SCHEMA = {
|
|
|
635
1072
|
context: { type: "object" },
|
|
636
1073
|
memo: { type: "object" },
|
|
637
1074
|
versioningBehavior: { enum: [...VERSIONING_BEHAVIORS] },
|
|
638
|
-
retry: { $ref: "#/$defs/runRetryPolicy" }
|
|
1075
|
+
retry: { $ref: "#/$defs/runRetryPolicy" },
|
|
1076
|
+
searchAttributes: { type: "object" },
|
|
1077
|
+
fairnessKey: FAIRNESS_KEY,
|
|
1078
|
+
fairnessWeight: FAIRNESS_WEIGHT
|
|
639
1079
|
}
|
|
640
1080
|
},
|
|
1081
|
+
updateRequest: {
|
|
1082
|
+
type: "object",
|
|
1083
|
+
required: ["updateId", "name"],
|
|
1084
|
+
description: "Phase C (C-ABI-H): a pending update the lease delivers. admitted marks one history already holds as UPDATE_ADMITTED; the runtime delivers that one from the event.",
|
|
1085
|
+
properties: {
|
|
1086
|
+
updateId: ID2,
|
|
1087
|
+
name: ID2,
|
|
1088
|
+
args: {},
|
|
1089
|
+
admitted: { type: "boolean" },
|
|
1090
|
+
headers: { $ref: "#/$defs/headers" }
|
|
1091
|
+
},
|
|
1092
|
+
additionalProperties: false
|
|
1093
|
+
},
|
|
1094
|
+
sinkCall: {
|
|
1095
|
+
type: "object",
|
|
1096
|
+
required: ["sink", "fn", "args"],
|
|
1097
|
+
description: "Phase C: a call of ctx.sinks.<sink>.<fn>(...args), never made on replay.",
|
|
1098
|
+
properties: {
|
|
1099
|
+
sink: ID2,
|
|
1100
|
+
fn: ID2,
|
|
1101
|
+
args: { type: "array" }
|
|
1102
|
+
},
|
|
1103
|
+
additionalProperties: false
|
|
1104
|
+
},
|
|
641
1105
|
localActivityRequest: {
|
|
642
1106
|
type: "object",
|
|
643
1107
|
required: [
|
|
@@ -653,13 +1117,13 @@ var WORKFLOW_TASK_SCHEMA = {
|
|
|
653
1117
|
],
|
|
654
1118
|
description: "R2: a local activity the task needs (11 \xA72.12). Run attempt `attempt` after waiting backoffMs, then run the same task again with the outcome in localActivityResults.",
|
|
655
1119
|
properties: {
|
|
656
|
-
localActivityId:
|
|
1120
|
+
localActivityId: ID2,
|
|
657
1121
|
kind: { const: "node" },
|
|
658
|
-
nodeType:
|
|
1122
|
+
nodeType: ID2,
|
|
659
1123
|
nodeVersion: { type: "string" },
|
|
660
|
-
operation:
|
|
1124
|
+
operation: ID2,
|
|
661
1125
|
args: {},
|
|
662
|
-
connection:
|
|
1126
|
+
connection: ID2,
|
|
663
1127
|
retry: { $ref: "#/$defs/retryPolicy" },
|
|
664
1128
|
startToCloseTimeout: {
|
|
665
1129
|
type: "integer",
|
|
@@ -678,7 +1142,7 @@ var WORKFLOW_TASK_SCHEMA = {
|
|
|
678
1142
|
properties: {
|
|
679
1143
|
protocol: { const: HISTORY_PROTOCOL },
|
|
680
1144
|
kind: { enum: ["task", "query", "verify"] },
|
|
681
|
-
workflowFn:
|
|
1145
|
+
workflowFn: ID2,
|
|
682
1146
|
info: { $ref: "#/$defs/info" },
|
|
683
1147
|
history: { type: "array", items: { $ref: "#/$defs/event" } },
|
|
684
1148
|
nowMs: { type: "number" },
|
|
@@ -688,24 +1152,37 @@ var WORKFLOW_TASK_SCHEMA = {
|
|
|
688
1152
|
type: "object",
|
|
689
1153
|
required: ["localActivityId", "attempts"],
|
|
690
1154
|
properties: {
|
|
691
|
-
localActivityId:
|
|
1155
|
+
localActivityId: ID2,
|
|
692
1156
|
result: {},
|
|
693
1157
|
failure: FAILURE_REF,
|
|
694
1158
|
attempts: { type: "integer", minimum: 1 }
|
|
695
1159
|
}
|
|
696
1160
|
}
|
|
697
1161
|
},
|
|
1162
|
+
updates: {
|
|
1163
|
+
type: "array",
|
|
1164
|
+
items: { $ref: "#/$defs/updateRequest" }
|
|
1165
|
+
},
|
|
698
1166
|
queries: {
|
|
699
1167
|
type: "array",
|
|
700
1168
|
items: {
|
|
701
1169
|
type: "object",
|
|
702
1170
|
required: ["queryId", "name"],
|
|
703
1171
|
properties: {
|
|
704
|
-
queryId:
|
|
705
|
-
name: {
|
|
1172
|
+
queryId: ID2,
|
|
1173
|
+
name: {
|
|
1174
|
+
...ID2,
|
|
1175
|
+
description: `A built-in query (${BUILT_IN_QUERIES.join(", ")}) or, from C-R1, the name of a custom query.`
|
|
1176
|
+
},
|
|
706
1177
|
args: {}
|
|
707
1178
|
}
|
|
708
1179
|
}
|
|
1180
|
+
},
|
|
1181
|
+
features: {
|
|
1182
|
+
type: "array",
|
|
1183
|
+
items: { type: "string", minLength: 1 },
|
|
1184
|
+
uniqueItems: true,
|
|
1185
|
+
description: "The bundle features (code.features names) the workspace enables for this task. From C-R1 the runtime reads `interceptors`: a task of a bundle that exports interceptors fails with UNSUPPORTED_COMMAND unless it is listed."
|
|
709
1186
|
}
|
|
710
1187
|
}
|
|
711
1188
|
},
|
|
@@ -739,9 +1216,22 @@ var WORKFLOW_TASK_SCHEMA = {
|
|
|
739
1216
|
items: {
|
|
740
1217
|
type: "object",
|
|
741
1218
|
required: ["queryId"],
|
|
742
|
-
properties: {
|
|
1219
|
+
properties: {
|
|
1220
|
+
queryId: ID2,
|
|
1221
|
+
value: {},
|
|
1222
|
+
error: { type: "string" },
|
|
1223
|
+
rejected: {
|
|
1224
|
+
type: "boolean",
|
|
1225
|
+
description: "Phase C: no handler took the query name (the service answers VALIDATION)."
|
|
1226
|
+
}
|
|
1227
|
+
}
|
|
743
1228
|
}
|
|
744
1229
|
},
|
|
1230
|
+
sinkCalls: {
|
|
1231
|
+
type: "array",
|
|
1232
|
+
maxItems: MAX_SINK_CALLS,
|
|
1233
|
+
items: { $ref: "#/$defs/sinkCall" }
|
|
1234
|
+
},
|
|
745
1235
|
failure: {
|
|
746
1236
|
type: "object",
|
|
747
1237
|
required: ["cause", "message"],
|
|
@@ -781,7 +1271,7 @@ var HISTORY_FILE_SCHEMA = {
|
|
|
781
1271
|
formatVersion: { const: HISTORY_PROTOCOL },
|
|
782
1272
|
name: { type: "string" },
|
|
783
1273
|
description: { type: "string" },
|
|
784
|
-
workflowFn:
|
|
1274
|
+
workflowFn: ID2,
|
|
785
1275
|
source: { type: "string", description: "Fixture source module, relative to the file." },
|
|
786
1276
|
replaySource: {
|
|
787
1277
|
type: "string",
|
|
@@ -789,7 +1279,7 @@ var HISTORY_FILE_SCHEMA = {
|
|
|
789
1279
|
},
|
|
790
1280
|
replay: {
|
|
791
1281
|
type: "boolean",
|
|
792
|
-
description: "False for histories that
|
|
1282
|
+
description: "False for histories that are parsed and projected but not replayed (written by hand for a feature the recording runtime did not have)."
|
|
793
1283
|
},
|
|
794
1284
|
info: { $ref: "#/$defs/info" },
|
|
795
1285
|
nowMs: {
|
|
@@ -813,7 +1303,9 @@ var HISTORY_SCHEMA_FILES = [
|
|
|
813
1303
|
["run-event.schema.json", RUN_EVENT_SCHEMA],
|
|
814
1304
|
["workflow-command.schema.json", WORKFLOW_COMMAND_SCHEMA],
|
|
815
1305
|
["workflow-task.schema.json", WORKFLOW_TASK_SCHEMA],
|
|
816
|
-
["history-file.schema.json", HISTORY_FILE_SCHEMA]
|
|
1306
|
+
["history-file.schema.json", HISTORY_FILE_SCHEMA],
|
|
1307
|
+
["bridge-v2.schema.json", BRIDGE_V2_SCHEMA],
|
|
1308
|
+
["payload-fields.json", PAYLOAD_FIELDS_DOCUMENT]
|
|
817
1309
|
];
|
|
818
1310
|
var tools;
|
|
819
1311
|
function schemaTools() {
|
|
@@ -823,7 +1315,8 @@ function schemaTools() {
|
|
|
823
1315
|
ajv,
|
|
824
1316
|
command: ajv.compile(WORKFLOW_COMMAND_SCHEMA),
|
|
825
1317
|
event: ajv.compile(RUN_EVENT_SCHEMA),
|
|
826
|
-
file: ajv.compile(HISTORY_FILE_SCHEMA)
|
|
1318
|
+
file: ajv.compile(HISTORY_FILE_SCHEMA),
|
|
1319
|
+
bridge: ajv.compile(BRIDGE_V2_SCHEMA)
|
|
827
1320
|
};
|
|
828
1321
|
}
|
|
829
1322
|
return tools;
|
|
@@ -916,13 +1409,20 @@ function validateCommands(commands, options = {}) {
|
|
|
916
1409
|
code: "commands.terminalNotLast",
|
|
917
1410
|
message: `${command2.type} must be the last command of the batch`
|
|
918
1411
|
});
|
|
919
|
-
if (command2.type === "SCHEDULE_ACTIVITY" && !isActivityNodeTypeAllowed(command2.nodeType))
|
|
1412
|
+
if (command2.type === "SCHEDULE_ACTIVITY" && command2.kind === "node" && !isActivityNodeTypeAllowed(command2.nodeType))
|
|
920
1413
|
issues.push({
|
|
921
1414
|
index,
|
|
922
1415
|
code: "durable.activityTypeNotAllowed",
|
|
923
1416
|
message: `${command2.nodeType} cannot run as a durable activity`,
|
|
924
1417
|
path: "/nodeType"
|
|
925
1418
|
});
|
|
1419
|
+
if (command2.type === "SCHEDULE_ACTIVITY" && command2.kind === "user" && command2.headers !== void 0 && utf8Bytes(JSON.stringify(command2.headers)) > MAX_HEADERS_BYTES)
|
|
1420
|
+
issues.push({
|
|
1421
|
+
index,
|
|
1422
|
+
code: "commands.headersTooLarge",
|
|
1423
|
+
message: `The headers of ${command2.type} exceed ${MAX_HEADERS_BYTES} bytes`,
|
|
1424
|
+
path: "/headers"
|
|
1425
|
+
});
|
|
926
1426
|
valid.push(command2);
|
|
927
1427
|
});
|
|
928
1428
|
if (issues.length > 0)
|
|
@@ -956,6 +1456,11 @@ function validateHistoryFile(value) {
|
|
|
956
1456
|
if (validate(value)) return validateHistory(isRecord(value) ? value["events"] : void 0);
|
|
957
1457
|
return { ok: false, issues: issuesOf(0, validate.errors) };
|
|
958
1458
|
}
|
|
1459
|
+
function validateBridgeFrame(value) {
|
|
1460
|
+
const { bridge: validate } = schemaTools();
|
|
1461
|
+
if (validate(value)) return { ok: true, frame: value };
|
|
1462
|
+
return { ok: false, issues: issuesOf(0, validate.errors) };
|
|
1463
|
+
}
|
|
959
1464
|
function compilePayloadValidator(schema) {
|
|
960
1465
|
const { ajv } = schemaTools();
|
|
961
1466
|
const validate = ajv.compile(schema);
|
|
@@ -1014,4 +1519,4 @@ function serializeHistoryFile(file) {
|
|
|
1014
1519
|
`;
|
|
1015
1520
|
}
|
|
1016
1521
|
|
|
1017
|
-
export { HISTORY_FILE_FORMAT, HISTORY_FILE_SCHEMA, HISTORY_FILE_SCHEMA_ID, HISTORY_SCHEMA_FILES, HistoryFileError, RUN_EVENT_SCHEMA, RUN_EVENT_SCHEMA_ID, WORKFLOW_COMMAND_SCHEMA, WORKFLOW_COMMAND_SCHEMA_ID, WORKFLOW_TASK_SCHEMA, WORKFLOW_TASK_SCHEMA_ID, compilePayloadValidator, createHistoryFile, parseHistoryFile, serializeHistoryFile, validateCommand, validateCommands, validateHistory, validateHistoryFile };
|
|
1522
|
+
export { BRIDGE_IDLE_TIMEOUT_MS, BRIDGE_MAX_FRAME_BYTES, BRIDGE_MAX_HISTORY_TAIL_BYTES, BRIDGE_PATH, BRIDGE_PING_SECONDS, BRIDGE_PROTOCOL_VERSION, BRIDGE_REQUEST_METHODS, BRIDGE_V2_SCHEMA, BRIDGE_V2_SCHEMA_ID, BRIDGE_WORKER_HEARTBEAT_SECONDS, BridgeCloseCode, HISTORY_FILE_FORMAT, HISTORY_FILE_SCHEMA, HISTORY_FILE_SCHEMA_ID, HISTORY_SCHEMA_FILES, HistoryFileError, RUN_EVENT_SCHEMA, RUN_EVENT_SCHEMA_ID, WORKFLOW_COMMAND_SCHEMA, WORKFLOW_COMMAND_SCHEMA_ID, WORKFLOW_TASK_SCHEMA, WORKFLOW_TASK_SCHEMA_ID, compilePayloadValidator, createHistoryFile, parseHistoryFile, serializeHistoryFile, validateBridgeFrame, validateCommand, validateCommands, validateHistory, validateHistoryFile };
|