@lostgradient/weft 0.16.0 → 0.18.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/README.md +1 -1
- package/dist/alerting/alert-manager.d.ts +5 -5
- package/dist/alerting/alert-manager.js +24 -6
- package/dist/alerting/index.d.ts +1 -1
- package/dist/alerting/types.d.ts +17 -13
- package/dist/alerting/types.js +5 -0
- package/dist/cli/generated/operation-catalog.snapshot.json +73 -0
- package/dist/cli/generated/operation-client.generated.d.ts +11 -2
- package/dist/cli/generated/operation-client.generated.js +2 -0
- package/dist/core/engine/disposal.js +7 -0
- package/dist/core/engine/engine-runtime-helpers.d.ts +3 -1
- package/dist/core/engine/engine-runtime-helpers.js +2 -2
- package/dist/core/engine/errors.d.ts +20 -0
- package/dist/core/engine/errors.js +8 -0
- package/dist/core/engine/index.d.ts +39 -17
- package/dist/core/engine/index.js +81 -9
- package/dist/core/engine/inline-launch-queue.d.ts +6 -2
- package/dist/core/engine/inline-launch-queue.js +41 -6
- package/dist/core/engine/internals.d.ts +2 -0
- package/dist/core/engine/lease-manager.d.ts +3 -2
- package/dist/core/engine/lease-manager.js +7 -3
- package/dist/core/engine/operations-time.js +6 -0
- package/dist/core/execution-strategy.d.ts +8 -0
- package/dist/core/inline-execution-strategy.d.ts +1 -0
- package/dist/core/inline-execution-strategy.js +33 -20
- package/dist/core/weft-error.d.ts +1 -1
- package/dist/core/weft-error.js +1 -0
- package/dist/core/worker-execution-strategy.d.ts +2 -0
- package/dist/core/worker-execution-strategy.js +7 -2
- package/dist/core/worker-turn-watchdog.d.ts +4 -1
- package/dist/core/worker-turn-watchdog.js +9 -4
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -0
- package/dist/indexeddb.js +1 -1
- package/dist/json-schema.js +1 -1
- package/dist/mcp/tools.js +1 -3
- package/dist/server/authorization-scope.d.ts +32 -2
- package/dist/server/dashboard-assets.d.ts +12 -1
- package/dist/server/dashboard-assets.js +145 -31
- package/dist/server/index.d.ts +2 -0
- package/dist/server/index.js +4 -0
- package/dist/server/operations/aggregate-workflows.js +0 -7
- package/dist/server/operations/async-activity.js +5 -24
- package/dist/server/operations/bulk-cancel-workflows.js +3 -8
- package/dist/server/operations/bulk-delete-workflows.js +3 -8
- package/dist/server/operations/bulk-mutate-workflow-tags.js +3 -8
- package/dist/server/operations/bulk-operation-helpers.d.ts +2 -10
- package/dist/server/operations/bulk-operation-helpers.js +0 -6
- package/dist/server/operations/bulk-retry-failed-workflows.js +3 -8
- package/dist/server/operations/bulk-signal-workflows.js +3 -8
- package/dist/server/operations/cancel-schedule.js +1 -3
- package/dist/server/operations/cancel-workflow.js +1 -3
- package/dist/server/operations/create-schedule.js +2 -3
- package/dist/server/operations/fork-workflow.js +2 -3
- package/dist/server/operations/get-checkpoint-at.js +1 -6
- package/dist/server/operations/get-principal.d.ts +75 -0
- package/dist/server/operations/get-principal.js +41 -0
- package/dist/server/operations/get-registry.js +1 -7
- package/dist/server/operations/get-retention-overview.js +2 -15
- package/dist/server/operations/get-review.js +2 -15
- package/dist/server/operations/get-schedule.js +2 -8
- package/dist/server/operations/get-stream-chunks.js +2 -6
- package/dist/server/operations/get-system-lease.js +1 -7
- package/dist/server/operations/get-system-metrics.js +0 -4
- package/dist/server/operations/get-task-diagnostics.js +2 -13
- package/dist/server/operations/get-update-result.js +1 -6
- package/dist/server/operations/get-workflow-attributes.js +2 -15
- package/dist/server/operations/get-workflow-events.js +2 -15
- package/dist/server/operations/get-workflow-observability.js +2 -5
- package/dist/server/operations/get-workflow-result.js +0 -7
- package/dist/server/operations/get-workflow-timeline.js +1 -6
- package/dist/server/operations/get-workflow.d.ts +3 -6
- package/dist/server/operations/get-workflow.js +2 -12
- package/dist/server/operations/list-alerts.d.ts +5 -2
- package/dist/server/operations/list-alerts.js +2 -9
- package/dist/server/operations/list-checkpoints.js +1 -6
- package/dist/server/operations/list-reviews.js +0 -7
- package/dist/server/operations/list-schedules.js +3 -8
- package/dist/server/operations/list-task-queues.js +0 -4
- package/dist/server/operations/list-workers.js +0 -4
- package/dist/server/operations/list-workflows.js +0 -7
- package/dist/server/operations/pause-schedule.js +1 -3
- package/dist/server/operations/purge-workflows.js +2 -5
- package/dist/server/operations/query-workflow.js +4 -15
- package/dist/server/operations/replay-workflow.js +2 -6
- package/dist/server/operations/resume-schedule.js +1 -3
- package/dist/server/operations/resume-workflow.js +1 -3
- package/dist/server/operations/set-workflow-attributes.js +3 -15
- package/dist/server/operations/signal-workflow.js +3 -12
- package/dist/server/operations/single-workflow-tag-mutation.js +0 -7
- package/dist/server/operations/start-or-signal-workflow.js +2 -3
- package/dist/server/operations/start-workflow.js +2 -3
- package/dist/server/operations/static-registrations.d.ts +28 -0
- package/dist/server/operations/static-registrations.js +263 -0
- package/dist/server/operations/storage-capabilities.js +1 -3
- package/dist/server/operations/storage.js +7 -13
- package/dist/server/operations/submit-review-decision.js +3 -12
- package/dist/server/operations/suspend-workflow.js +1 -3
- package/dist/server/operations/timeout-workflow.js +1 -3
- package/dist/server/operations/update-schedule.js +1 -3
- package/dist/server/operations/update-workflow.js +2 -3
- package/dist/server/operations/worker-drain.js +0 -8
- package/dist/server/rest-binding.d.ts +3 -2
- package/dist/server/rest-bindings.d.ts +5 -0
- package/dist/server/rest-bindings.js +4 -312
- package/dist/server/route-model.d.ts +2 -0
- package/dist/server/route-model.js +1 -1
- package/dist/server/runtime/task-reconciliation.d.ts +10 -1
- package/dist/server/runtime/task-reconciliation.js +26 -2
- package/dist/server/serve-internals.js +12 -6
- package/dist/storage/indexeddb.js +28 -48
- package/dist/storage/testing.d.ts +6 -3
- package/dist/storage/testing.js +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/worker/protocol-schemas.d.ts +2 -2
- package/dist/worker/protocol-schemas.js +2 -2
- package/dist/worker/protocol.js +1 -1
- package/package.json +1 -1
|
@@ -6,11 +6,14 @@
|
|
|
6
6
|
* surface, not a configuration export.
|
|
7
7
|
*/
|
|
8
8
|
import { z } from 'zod';
|
|
9
|
-
import type { AlertMetric } from '../../alerting/types.ts';
|
|
10
9
|
import type { UnknownRestBinding } from '../rest-bindings.ts';
|
|
11
10
|
declare const listAlertsInput: z.ZodObject<{}, z.core.$strip>;
|
|
12
11
|
declare const activeAlertSchema: z.ZodObject<{
|
|
13
|
-
metric: z.
|
|
12
|
+
metric: z.ZodEnum<{
|
|
13
|
+
"workflow.failure_rate": "workflow.failure_rate";
|
|
14
|
+
"activity.p99_duration": "activity.p99_duration";
|
|
15
|
+
"storage.size": "storage.size";
|
|
16
|
+
}>;
|
|
14
17
|
threshold: z.ZodNumber;
|
|
15
18
|
currentValue: z.ZodNumber;
|
|
16
19
|
window: z.ZodNullable<z.ZodString>;
|
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
+
import { ALERT_METRICS } from "../../alerting/types.js";
|
|
2
3
|
import { shapeOperationFaultAsJson } from "../operation-fault.js";
|
|
3
4
|
import { defineOperation } from "../operation-registry.js";
|
|
4
|
-
const alertMetricSchema = z.enum(
|
|
5
|
-
"workflow.failure_rate",
|
|
6
|
-
"activity.p99_duration",
|
|
7
|
-
"storage.size"
|
|
8
|
-
]), listAlertsInput = z.object({}), activeAlertSchema = z.object({
|
|
5
|
+
const alertMetricSchema = z.enum(ALERT_METRICS), listAlertsInput = z.object({}), activeAlertSchema = z.object({
|
|
9
6
|
metric: alertMetricSchema,
|
|
10
7
|
threshold: z.number(),
|
|
11
8
|
currentValue: z.number(),
|
|
@@ -46,9 +43,5 @@ export const listAlertsOperation = defineOperation({
|
|
|
46
43
|
inputSources: {},
|
|
47
44
|
extractInput: async () => ({}),
|
|
48
45
|
success: { kind: "json", status: 200 },
|
|
49
|
-
shapeSuccess: (output) => new Response(JSON.stringify(output), {
|
|
50
|
-
status: 200,
|
|
51
|
-
headers: { "Content-Type": "application/json" }
|
|
52
|
-
}),
|
|
53
46
|
shapeFault: shapeOperationFaultAsJson
|
|
54
47
|
};
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { negotiatedResponse } from "../handler/response-helpers.js";
|
|
3
3
|
import { defineOperation } from "../operation-registry.js";
|
|
4
|
-
import { shapeRestFault } from "./operation-helpers.js";
|
|
5
4
|
const listCheckpointsInput = z.object({
|
|
6
5
|
workflowId: z.string().min(1)
|
|
7
6
|
}), listCheckpointsOutput = z.unknown();
|
|
@@ -23,9 +22,6 @@ export const listCheckpointsOperation = defineOperation({
|
|
|
23
22
|
function shapeListCheckpointsSuccess(result, request) {
|
|
24
23
|
return negotiatedResponse(request, result, 200);
|
|
25
24
|
}
|
|
26
|
-
function shapeListCheckpointsFault(fault) {
|
|
27
|
-
return shapeRestFault(fault);
|
|
28
|
-
}
|
|
29
25
|
export const listCheckpointsRestBinding = {
|
|
30
26
|
method: "GET",
|
|
31
27
|
path: "/v1/workflows/:id/checkpoints",
|
|
@@ -38,6 +34,5 @@ export const listCheckpointsRestBinding = {
|
|
|
38
34
|
workflowId: pathParams.id ?? ""
|
|
39
35
|
}),
|
|
40
36
|
success: { kind: "json", status: 200 },
|
|
41
|
-
shapeSuccess: (output, request) => shapeListCheckpointsSuccess(output, request)
|
|
42
|
-
shapeFault: shapeListCheckpointsFault
|
|
37
|
+
shapeSuccess: (output, request) => shapeListCheckpointsSuccess(output, request)
|
|
43
38
|
};
|
|
@@ -37,12 +37,6 @@ function extractListReviewsInput(request) {
|
|
|
37
37
|
filter.reviewType = reviewType;
|
|
38
38
|
return filter;
|
|
39
39
|
}
|
|
40
|
-
function shapeListReviewsSuccess(result) {
|
|
41
|
-
return new Response(JSON.stringify(result), {
|
|
42
|
-
status: 200,
|
|
43
|
-
headers: { "Content-Type": "application/json" }
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
40
|
export const listReviewsRestBinding = {
|
|
47
41
|
method: "GET",
|
|
48
42
|
path: "/v1/reviews",
|
|
@@ -55,6 +49,5 @@ export const listReviewsRestBinding = {
|
|
|
55
49
|
},
|
|
56
50
|
extractInput: async (request) => extractListReviewsInput(request),
|
|
57
51
|
success: { kind: "json", status: 200 },
|
|
58
|
-
shapeSuccess: (output) => shapeListReviewsSuccess(output),
|
|
59
52
|
shapeFault: shapeOperationFaultAsJson
|
|
60
53
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { defineOperation } from "../operation-registry.js";
|
|
3
|
-
import { invalidParamsFault
|
|
3
|
+
import { invalidParamsFault } from "./operation-helpers.js";
|
|
4
4
|
const VALID_SCHEDULE_STATUSES = new Set(["active", "paused", "cancelled"]);
|
|
5
5
|
function isValidScheduleStatus(value) {
|
|
6
6
|
return VALID_SCHEDULE_STATUSES.has(value);
|
|
@@ -71,11 +71,7 @@ export const listSchedulesOperation = defineOperation({
|
|
|
71
71
|
const e = engine, filter = validateListSchedulesQuery(input);
|
|
72
72
|
return e.listSchedules(filter);
|
|
73
73
|
}
|
|
74
|
-
})
|
|
75
|
-
function shapeListSchedulesFault(fault) {
|
|
76
|
-
return shapeRestFault(fault);
|
|
77
|
-
}
|
|
78
|
-
export const listSchedulesRestBinding = {
|
|
74
|
+
}), listSchedulesRestBinding = {
|
|
79
75
|
method: "GET",
|
|
80
76
|
path: "/v1/schedules",
|
|
81
77
|
pathParamNames: [],
|
|
@@ -103,6 +99,5 @@ export const listSchedulesRestBinding = {
|
|
|
103
99
|
result.offset = offset;
|
|
104
100
|
return result;
|
|
105
101
|
},
|
|
106
|
-
success: { kind: "json", status: 200 }
|
|
107
|
-
shapeFault: shapeListSchedulesFault
|
|
102
|
+
success: { kind: "json", status: 200 }
|
|
108
103
|
};
|
|
@@ -96,10 +96,6 @@ export function createListTaskQueuesRestBinding() {
|
|
|
96
96
|
inputSources: {},
|
|
97
97
|
extractInput: async () => ({}),
|
|
98
98
|
success: { kind: "json", status: 200 },
|
|
99
|
-
shapeSuccess: (output) => new Response(JSON.stringify(output), {
|
|
100
|
-
status: 200,
|
|
101
|
-
headers: { "Content-Type": "application/json" }
|
|
102
|
-
}),
|
|
103
99
|
shapeFault: shapeOperationFaultAsJson
|
|
104
100
|
};
|
|
105
101
|
}
|
|
@@ -83,10 +83,6 @@ export function createListWorkersRestBinding() {
|
|
|
83
83
|
inputSources: {},
|
|
84
84
|
extractInput: async () => ({}),
|
|
85
85
|
success: { kind: "json", status: 200 },
|
|
86
|
-
shapeSuccess: (output) => new Response(JSON.stringify(output), {
|
|
87
|
-
status: 200,
|
|
88
|
-
headers: { "Content-Type": "application/json" }
|
|
89
|
-
}),
|
|
90
86
|
shapeFault: shapeOperationFaultAsJson
|
|
91
87
|
};
|
|
92
88
|
}
|
|
@@ -87,12 +87,6 @@ function extractListWorkflowsInput(request) {
|
|
|
87
87
|
filter.include = includes;
|
|
88
88
|
return filter;
|
|
89
89
|
}
|
|
90
|
-
function shapeListWorkflowsSuccess(result) {
|
|
91
|
-
return new Response(JSON.stringify(result), {
|
|
92
|
-
status: 200,
|
|
93
|
-
headers: { "Content-Type": "application/json" }
|
|
94
|
-
});
|
|
95
|
-
}
|
|
96
90
|
function shapeListWorkflowsFault(fault) {
|
|
97
91
|
if (fault.code === "Unprocessable")
|
|
98
92
|
return shapeRestFault(fault, { status: 400 });
|
|
@@ -119,6 +113,5 @@ export const listWorkflowsRestBinding = {
|
|
|
119
113
|
},
|
|
120
114
|
extractInput: async (request) => extractListWorkflowsInput(request),
|
|
121
115
|
success: { kind: "json", status: 200 },
|
|
122
|
-
shapeSuccess: (output) => shapeListWorkflowsSuccess(output),
|
|
123
116
|
shapeFault: shapeListWorkflowsFault
|
|
124
117
|
};
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { defineOperation } from "../operation-registry.js";
|
|
3
|
-
import { shapeRestFault } from "./operation-helpers.js";
|
|
4
3
|
import { mapScheduleErrorToFault } from "./schedule-faults.js";
|
|
5
4
|
const pauseScheduleInput = z.object({
|
|
6
5
|
scheduleId: z.string().min(1)
|
|
@@ -38,6 +37,5 @@ export const pauseScheduleOperation = defineOperation({
|
|
|
38
37
|
extractInput: async (_request, pathParams) => ({
|
|
39
38
|
scheduleId: pathParams.id ?? ""
|
|
40
39
|
}),
|
|
41
|
-
success: { kind: "empty", status: 204 }
|
|
42
|
-
shapeFault: shapeRestFault
|
|
40
|
+
success: { kind: "empty", status: 204 }
|
|
43
41
|
};
|
|
@@ -8,8 +8,7 @@ import {
|
|
|
8
8
|
parseBulkListFilterFromBody,
|
|
9
9
|
readOptionalJsonBody
|
|
10
10
|
} from "./bulk-filter-helpers.js";
|
|
11
|
-
import {
|
|
12
|
-
import { invalidParamsFault, shapeRestFault } from "./operation-helpers.js";
|
|
11
|
+
import { invalidParamsFault } from "./operation-helpers.js";
|
|
13
12
|
const purgeWorkflowsOutput = z.unknown();
|
|
14
13
|
export const purgeWorkflowsOperation = defineOperation({
|
|
15
14
|
name: "weft.workflows.purge",
|
|
@@ -51,7 +50,5 @@ export const purgeWorkflowsOperation = defineOperation({
|
|
|
51
50
|
throw invalidParamsFault(faultMessage(error));
|
|
52
51
|
}
|
|
53
52
|
},
|
|
54
|
-
success: { kind: "json", status: 200 }
|
|
55
|
-
shapeSuccess: (output) => shapeBulkJsonSuccess(output),
|
|
56
|
-
shapeFault: shapeRestFault
|
|
53
|
+
success: { kind: "json", status: 200 }
|
|
57
54
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { defineOperation } from "../operation-registry.js";
|
|
3
3
|
import { readRestTextBody } from "../rest-body.js";
|
|
4
|
-
import { invalidParamsFault
|
|
4
|
+
import { invalidParamsFault } from "./operation-helpers.js";
|
|
5
5
|
const queryWorkflowInput = z.object({
|
|
6
6
|
workflowId: z.string().min(1),
|
|
7
7
|
queryName: z.string().min(1),
|
|
@@ -39,14 +39,7 @@ export const queryWorkflowOperation = defineOperation({
|
|
|
39
39
|
};
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
|
-
})
|
|
43
|
-
function shapeQueryWorkflowSuccess(result) {
|
|
44
|
-
return new Response(JSON.stringify(result), {
|
|
45
|
-
status: 200,
|
|
46
|
-
headers: { "Content-Type": "application/json" }
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
export const queryWorkflowRestBinding = {
|
|
42
|
+
}), queryWorkflowRestBinding = {
|
|
50
43
|
method: "GET",
|
|
51
44
|
path: "/v1/workflows/:id/query/:name",
|
|
52
45
|
pathParamNames: ["id", "name"],
|
|
@@ -59,9 +52,7 @@ export const queryWorkflowRestBinding = {
|
|
|
59
52
|
workflowId: pathParams.id ?? "",
|
|
60
53
|
queryName: pathParams.name ?? ""
|
|
61
54
|
}),
|
|
62
|
-
success: { kind: "json", status: 200 }
|
|
63
|
-
shapeSuccess: (output) => shapeQueryWorkflowSuccess(output),
|
|
64
|
-
shapeFault: shapeRestFault
|
|
55
|
+
success: { kind: "json", status: 200 }
|
|
65
56
|
}, queryWorkflowWithInputRestBinding = {
|
|
66
57
|
method: "POST",
|
|
67
58
|
path: "/v1/workflows/:id/query/:name",
|
|
@@ -94,7 +85,5 @@ export const queryWorkflowRestBinding = {
|
|
|
94
85
|
input: body.input
|
|
95
86
|
};
|
|
96
87
|
},
|
|
97
|
-
success: { kind: "json", status: 200 }
|
|
98
|
-
shapeSuccess: (output) => shapeQueryWorkflowSuccess(output),
|
|
99
|
-
shapeFault: shapeRestFault
|
|
88
|
+
success: { kind: "json", status: 200 }
|
|
100
89
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { negotiatedResponse } from "../handler/response-helpers.js";
|
|
3
3
|
import { defineOperation } from "../operation-registry.js";
|
|
4
|
-
import { invalidParamsFault
|
|
4
|
+
import { invalidParamsFault } from "./operation-helpers.js";
|
|
5
5
|
const replayWorkflowInput = z.object({
|
|
6
6
|
workflowId: z.string().min(1),
|
|
7
7
|
step: z.union([z.string(), z.number()])
|
|
@@ -44,9 +44,6 @@ export const replayWorkflowOperation = defineOperation({
|
|
|
44
44
|
return replay;
|
|
45
45
|
}
|
|
46
46
|
});
|
|
47
|
-
function shapeReplayWorkflowFault(fault) {
|
|
48
|
-
return shapeRestFault(fault);
|
|
49
|
-
}
|
|
50
47
|
function shapeReplayWorkflowSuccess(output, request) {
|
|
51
48
|
return negotiatedResponse(request, output, 200);
|
|
52
49
|
}
|
|
@@ -64,6 +61,5 @@ export const replayWorkflowRestBinding = {
|
|
|
64
61
|
step: pathParams.step ?? "0"
|
|
65
62
|
}),
|
|
66
63
|
success: { kind: "json", status: 200 },
|
|
67
|
-
shapeSuccess: (output, request) => shapeReplayWorkflowSuccess(output, request)
|
|
68
|
-
shapeFault: shapeReplayWorkflowFault
|
|
64
|
+
shapeSuccess: (output, request) => shapeReplayWorkflowSuccess(output, request)
|
|
69
65
|
};
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { defineOperation } from "../operation-registry.js";
|
|
3
|
-
import { shapeRestFault } from "./operation-helpers.js";
|
|
4
3
|
import { mapScheduleErrorToFault } from "./schedule-faults.js";
|
|
5
4
|
const resumeScheduleInput = z.object({
|
|
6
5
|
scheduleId: z.string().min(1)
|
|
@@ -38,6 +37,5 @@ export const resumeScheduleOperation = defineOperation({
|
|
|
38
37
|
extractInput: async (_request, pathParams) => ({
|
|
39
38
|
scheduleId: pathParams.id ?? ""
|
|
40
39
|
}),
|
|
41
|
-
success: { kind: "empty", status: 204 }
|
|
42
|
-
shapeFault: shapeRestFault
|
|
40
|
+
success: { kind: "empty", status: 204 }
|
|
43
41
|
};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import { shapeRestFault } from "./operation-helpers.js";
|
|
3
2
|
import {
|
|
4
3
|
createSingleWorkflowControlOperation,
|
|
5
4
|
extractWorkflowIdFromPath
|
|
@@ -35,6 +34,5 @@ export const resumeWorkflowOperation = createSingleWorkflowControlOperation({
|
|
|
35
34
|
workflowId: { kind: "path", pathParam: "id" }
|
|
36
35
|
},
|
|
37
36
|
extractInput: async (_request, pathParams) => extractWorkflowIdFromPath(pathParams),
|
|
38
|
-
success: { kind: "json", status: 200 }
|
|
39
|
-
shapeFault: shapeRestFault
|
|
37
|
+
success: { kind: "json", status: 200 }
|
|
40
38
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { defineOperation } from "../operation-registry.js";
|
|
3
3
|
import { readRestJsonBody } from "../rest-body.js";
|
|
4
|
-
import { isOperationFault
|
|
4
|
+
import { isOperationFault } from "./operation-helpers.js";
|
|
5
5
|
const setWorkflowAttributesInput = z.object({
|
|
6
6
|
workflowId: z.string().min(1),
|
|
7
7
|
attributes: z.unknown().optional()
|
|
@@ -32,17 +32,7 @@ export const setWorkflowAttributesOperation = defineOperation({
|
|
|
32
32
|
};
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
|
-
})
|
|
36
|
-
function shapeSetWorkflowAttributesSuccess(output) {
|
|
37
|
-
return new Response(JSON.stringify(output), {
|
|
38
|
-
status: 200,
|
|
39
|
-
headers: { "Content-Type": "application/json" }
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
function shapeSetWorkflowAttributesFault(fault) {
|
|
43
|
-
return shapeRestFault(fault);
|
|
44
|
-
}
|
|
45
|
-
export const setWorkflowAttributesRestBinding = {
|
|
35
|
+
}), setWorkflowAttributesRestBinding = {
|
|
46
36
|
method: "PATCH",
|
|
47
37
|
path: "/v1/workflows/:id/attributes",
|
|
48
38
|
pathParamNames: ["id"],
|
|
@@ -64,7 +54,5 @@ export const setWorkflowAttributesRestBinding = {
|
|
|
64
54
|
attributes: typeof body === "object" ? body.attributes : void 0
|
|
65
55
|
};
|
|
66
56
|
},
|
|
67
|
-
success: { kind: "json", status: 200 }
|
|
68
|
-
shapeSuccess: (output) => shapeSetWorkflowAttributesSuccess(output),
|
|
69
|
-
shapeFault: shapeSetWorkflowAttributesFault
|
|
57
|
+
success: { kind: "json", status: 200 }
|
|
70
58
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { isSignalIdWithinByteLimit } from "../../core/signal-id.js";
|
|
3
3
|
import { readRestJsonBody } from "../rest-body.js";
|
|
4
|
-
import { isOperationFault
|
|
4
|
+
import { isOperationFault } from "./operation-helpers.js";
|
|
5
5
|
import {
|
|
6
6
|
createSingleWorkflowControlOperation,
|
|
7
7
|
extractWorkflowIdFromPath
|
|
@@ -27,14 +27,7 @@ export const signalWorkflowOperation = createSingleWorkflowControlOperation({
|
|
|
27
27
|
await engine.signal(input.workflowId, input.signalName, input.payload, input.signalId === void 0 ? void 0 : { signalId: input.signalId });
|
|
28
28
|
return { ok: !0 };
|
|
29
29
|
}
|
|
30
|
-
})
|
|
31
|
-
function shapeSignalWorkflowSuccess(output) {
|
|
32
|
-
return new Response(JSON.stringify(output), {
|
|
33
|
-
status: 200,
|
|
34
|
-
headers: { "Content-Type": "application/json" }
|
|
35
|
-
});
|
|
36
|
-
}
|
|
37
|
-
export const signalWorkflowRestBinding = {
|
|
30
|
+
}), signalWorkflowRestBinding = {
|
|
38
31
|
method: "POST",
|
|
39
32
|
path: "/v1/workflows/:id/signal/:name",
|
|
40
33
|
pathParamNames: ["id", "name"],
|
|
@@ -57,7 +50,5 @@ export const signalWorkflowRestBinding = {
|
|
|
57
50
|
...signalId === void 0 ? {} : { signalId }
|
|
58
51
|
};
|
|
59
52
|
},
|
|
60
|
-
success: { kind: "json", status: 200 }
|
|
61
|
-
shapeSuccess: (output) => shapeSignalWorkflowSuccess(output),
|
|
62
|
-
shapeFault: shapeRestFault
|
|
53
|
+
success: { kind: "json", status: 200 }
|
|
63
54
|
};
|
|
@@ -66,16 +66,9 @@ export function createSingleWorkflowTagMutationRestBinding(configuration) {
|
|
|
66
66
|
};
|
|
67
67
|
},
|
|
68
68
|
success: { kind: "json", status: 200 },
|
|
69
|
-
shapeSuccess: shapeSingleWorkflowTagMutationSuccess,
|
|
70
69
|
shapeFault: shapeSingleWorkflowTagMutationFault
|
|
71
70
|
};
|
|
72
71
|
}
|
|
73
|
-
function shapeSingleWorkflowTagMutationSuccess(output) {
|
|
74
|
-
return new Response(JSON.stringify(output), {
|
|
75
|
-
status: 200,
|
|
76
|
-
headers: { "Content-Type": "application/json" }
|
|
77
|
-
});
|
|
78
|
-
}
|
|
79
72
|
function shapeSingleWorkflowTagMutationFault(fault) {
|
|
80
73
|
if (fault.code === "Unprocessable")
|
|
81
74
|
return shapeRestFault(fault, { status: 400 });
|
|
@@ -9,7 +9,7 @@ import { runtimeWorkflowEngine } from "../../core/runtime-workflow-engine.js";
|
|
|
9
9
|
import { isSignalIdWithinByteLimit } from "../../core/signal-id.js";
|
|
10
10
|
import { StartWorkflowValidationError } from "../../core/start-workflow-validation.js";
|
|
11
11
|
import { defineOperation } from "../operation-registry.js";
|
|
12
|
-
import { invalidParamsFault
|
|
12
|
+
import { invalidParamsFault } from "./operation-helpers.js";
|
|
13
13
|
import { buildStartOrSignalWorkflowOptions } from "./start-workflow-options.js";
|
|
14
14
|
import {
|
|
15
15
|
extractSharedStartWorkflowRestFields,
|
|
@@ -136,6 +136,5 @@ export const startOrSignalWorkflowOperation = defineOperation({
|
|
|
136
136
|
onTerminalConflict: record.onTerminalConflict
|
|
137
137
|
};
|
|
138
138
|
},
|
|
139
|
-
success: { kind: "json", status: 201 }
|
|
140
|
-
shapeFault: shapeRestFault
|
|
139
|
+
success: { kind: "json", status: 201 }
|
|
141
140
|
};
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
import { runtimeWorkflowEngine } from "../../core/runtime-workflow-engine.js";
|
|
8
8
|
import { StartWorkflowValidationError } from "../../core/start-workflow-validation.js";
|
|
9
9
|
import { defineOperation } from "../operation-registry.js";
|
|
10
|
-
import { invalidParamsFault
|
|
10
|
+
import { invalidParamsFault } from "./operation-helpers.js";
|
|
11
11
|
import { buildSharedStartWorkflowOptions } from "./start-workflow-options.js";
|
|
12
12
|
import {
|
|
13
13
|
extractSharedStartWorkflowRestFields,
|
|
@@ -99,6 +99,5 @@ export const startWorkflowOperation = defineOperation({
|
|
|
99
99
|
extractInput: async (request, _pathParams, context) => {
|
|
100
100
|
return extractSharedStartWorkflowRestFields(await parseStartWorkflowRequestRecord(request, context));
|
|
101
101
|
},
|
|
102
|
-
success: { kind: "json", status: 201 }
|
|
103
|
-
shapeFault: shapeRestFault
|
|
102
|
+
success: { kind: "json", status: 201 }
|
|
104
103
|
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Static operation and REST-binding registrations — every operation that
|
|
3
|
+
* needs no per-server configuration, in one place.
|
|
4
|
+
*
|
|
5
|
+
* `rest-bindings.ts` composes these arrays with the per-server factory
|
|
6
|
+
* operations (metrics, workers, task queues, diagnostics) to build the live
|
|
7
|
+
* registry and binding set. Adding a new statically-configured operation
|
|
8
|
+
* means adding its import and two array entries HERE; `rest-bindings.ts`
|
|
9
|
+
* itself only changes when an operation needs per-server wiring.
|
|
10
|
+
*
|
|
11
|
+
* @module server/operations/static-registrations
|
|
12
|
+
*/
|
|
13
|
+
import type { RegistrableOperation } from '../operation-catalog.ts';
|
|
14
|
+
import type { UnknownRestBinding } from '../rest-bindings.ts';
|
|
15
|
+
/**
|
|
16
|
+
* Static REST bindings for all operations that do not need per-server
|
|
17
|
+
* configuration. `rest-bindings.ts` re-exports this as `REST_BINDINGS` and
|
|
18
|
+
* appends the per-server factory bindings in `createLiveRestBindings()`.
|
|
19
|
+
*/
|
|
20
|
+
export declare const STATIC_REST_BINDINGS: ReadonlyArray<UnknownRestBinding>;
|
|
21
|
+
/**
|
|
22
|
+
* Statically-configured operations, in registration order.
|
|
23
|
+
* `rest-bindings.ts`'s `createLiveOperationRegistry()` appends the
|
|
24
|
+
* per-server factory operations (metrics, workers, task queues,
|
|
25
|
+
* diagnostics); the registry is keyed by operation name, so relative
|
|
26
|
+
* order carries no behavior.
|
|
27
|
+
*/
|
|
28
|
+
export declare const STATIC_OPERATIONS: ReadonlyArray<RegistrableOperation>;
|