apps 0.0.1-beta.109 → 0.0.1-beta.110
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/framework-reference.json +1 -1
- package/js/host.js +37 -22
- package/package.json +1 -1
- package/runtime.json +1 -1
package/js/host.js
CHANGED
|
@@ -151,38 +151,53 @@ var isolatedWorkflowExecution = (run, deliver, signal) => {
|
|
|
151
151
|
invoke: (input) => request({ operation: "invoke", ...input })
|
|
152
152
|
};
|
|
153
153
|
};
|
|
154
|
+
var unanswered = ({ operation, key }, unread) => {
|
|
155
|
+
const cause = unread ? `This app's apps release could not read Executor's reply to ctx.workflows.${operation}; redeploy the app on the current apps release.` : `Executor did not answer ctx.workflows.${operation}.`;
|
|
156
|
+
switch (operation) {
|
|
157
|
+
case "start":
|
|
158
|
+
return new WorkflowFailure({
|
|
159
|
+
reason: "engine",
|
|
160
|
+
retryable: false,
|
|
161
|
+
message: key === void 0 ? `${cause} The run may have started. This start had no key, so check ctx.workflows.list before starting again: another start creates another run.` : `${cause} The run may have started. Start it again with the same key and input, which returns the run if it exists, or check ctx.workflows.list before starting another.`
|
|
162
|
+
});
|
|
163
|
+
case "terminate":
|
|
164
|
+
return new WorkflowFailure({
|
|
165
|
+
reason: "engine",
|
|
166
|
+
retryable: false,
|
|
167
|
+
message: `${cause} The run may have stopped. Read it with ctx.workflows.get before terminating it again.`
|
|
168
|
+
});
|
|
169
|
+
default:
|
|
170
|
+
return new WorkflowFailure({
|
|
171
|
+
reason: "engine",
|
|
172
|
+
retryable: !unread,
|
|
173
|
+
message: unread ? cause : `${cause} Try again.`
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
};
|
|
154
177
|
var isolatedWorkflowControls = (deliver) => {
|
|
155
|
-
const request = (input) => (
|
|
178
|
+
const request = (input, schema) => (
|
|
156
179
|
// oxlint-disable-next-line executor/authored-code-through-adapter -- the host's workflow RPC
|
|
157
180
|
Effect_exports.tryPromise({
|
|
158
181
|
try: () => deliver(input),
|
|
159
|
-
catch: () =>
|
|
182
|
+
catch: () => unanswered(input, false)
|
|
160
183
|
}).pipe(
|
|
161
|
-
Effect_exports.flatMap(Schema_exports.decodeUnknownEffect(WorkflowRpcResult)),
|
|
162
|
-
Effect_exports.mapError(() => new WorkflowFailure({ reason: "engine", retryable: true })),
|
|
163
184
|
Effect_exports.flatMap(
|
|
164
|
-
(
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
185
|
+
(reply) => Schema_exports.decodeUnknownEffect(WorkflowRpcResult)(reply).pipe(
|
|
186
|
+
Effect_exports.mapError(() => unanswered(input, true))
|
|
187
|
+
)
|
|
188
|
+
),
|
|
189
|
+
Effect_exports.flatMap(
|
|
190
|
+
(result) => result.ok ? Schema_exports.decodeUnknownEffect(schema)(result.value).pipe(
|
|
191
|
+
Effect_exports.mapError(() => unanswered(input, true))
|
|
192
|
+
) : Effect_exports.fail(result.error)
|
|
172
193
|
)
|
|
173
194
|
)
|
|
174
195
|
);
|
|
175
196
|
return {
|
|
176
|
-
start: (input) =>
|
|
177
|
-
get: (input) =>
|
|
178
|
-
terminate: (input) =>
|
|
179
|
-
list: (input) => request({ operation: "list", ...input })
|
|
180
|
-
Effect_exports.flatMap(
|
|
181
|
-
(value) => Schema_exports.decodeUnknownEffect(WorkflowRunPage)(value).pipe(
|
|
182
|
-
Effect_exports.mapError(() => new WorkflowFailure({ reason: "engine", retryable: true }))
|
|
183
|
-
)
|
|
184
|
-
)
|
|
185
|
-
)
|
|
197
|
+
start: (input) => request({ operation: "start", ...input }, WorkflowRun),
|
|
198
|
+
get: (input) => request({ operation: "get", ...input }, WorkflowRun),
|
|
199
|
+
terminate: (input) => request({ operation: "terminate", ...input }, WorkflowRun),
|
|
200
|
+
list: (input) => request({ operation: "list", ...input }, WorkflowRunPage)
|
|
186
201
|
};
|
|
187
202
|
};
|
|
188
203
|
|