@lostgradient/weft 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/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/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/dashboard-assets.d.ts +12 -1
- package/dist/server/dashboard-assets.js +145 -31
- 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-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/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/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
|
@@ -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
|
const getScheduleInput = z.object({
|
|
5
4
|
scheduleId: z.string().min(1)
|
|
6
5
|
}), getScheduleOutput = z.unknown();
|
|
@@ -28,11 +27,7 @@ export const getScheduleOperation = defineOperation({
|
|
|
28
27
|
};
|
|
29
28
|
return schedule;
|
|
30
29
|
}
|
|
31
|
-
})
|
|
32
|
-
function shapeGetScheduleFault(fault) {
|
|
33
|
-
return shapeRestFault(fault);
|
|
34
|
-
}
|
|
35
|
-
export const getScheduleRestBinding = {
|
|
30
|
+
}), getScheduleRestBinding = {
|
|
36
31
|
method: "GET",
|
|
37
32
|
path: "/v1/schedules/:id",
|
|
38
33
|
pathParamNames: ["id"],
|
|
@@ -43,6 +38,5 @@ export const getScheduleRestBinding = {
|
|
|
43
38
|
extractInput: async (_request, pathParams) => ({
|
|
44
39
|
scheduleId: pathParams.id ?? ""
|
|
45
40
|
}),
|
|
46
|
-
success: { kind: "json", status: 200 }
|
|
47
|
-
shapeFault: shapeGetScheduleFault
|
|
41
|
+
success: { kind: "json", status: 200 }
|
|
48
42
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { defineOperation } from "../operation-registry.js";
|
|
3
3
|
import { parseOptionalSequenceCursor } from "../sequence-cursor.js";
|
|
4
|
-
import { invalidParamsFault
|
|
4
|
+
import { invalidParamsFault } from "./operation-helpers.js";
|
|
5
5
|
import { createStoredChunkSSEStream, SSE_RESPONSE_HEADERS } from "./sse-stream.js";
|
|
6
6
|
const getStreamChunksInput = z.object({
|
|
7
7
|
workflowId: z.string().min(1),
|
|
@@ -31,9 +31,6 @@ export const getStreamChunksOperation = defineOperation({
|
|
|
31
31
|
return { chunks: after !== void 0 ? await e.getStreamChunks(input.workflowId, input.key, { after }) : await e.getStreamChunks(input.workflowId, input.key) };
|
|
32
32
|
}
|
|
33
33
|
});
|
|
34
|
-
function shapeGetStreamChunksFault(fault) {
|
|
35
|
-
return shapeRestFault(fault);
|
|
36
|
-
}
|
|
37
34
|
function shapeGetStreamChunksSuccess(output, request) {
|
|
38
35
|
if ((request.headers.get("Accept") ?? "").includes("text/event-stream"))
|
|
39
36
|
return new Response(createStoredChunkSSEStream(output.chunks, (chunk) => JSON.stringify({ sequence: chunk.sequence, value: chunk.value })), { status: 200, headers: SSE_RESPONSE_HEADERS });
|
|
@@ -61,6 +58,5 @@ export const getStreamChunksRestBinding = {
|
|
|
61
58
|
};
|
|
62
59
|
},
|
|
63
60
|
success: { kind: "streaming", mediaType: "text/event-stream" },
|
|
64
|
-
shapeSuccess: shapeGetStreamChunksSuccess
|
|
65
|
-
shapeFault: shapeGetStreamChunksFault
|
|
61
|
+
shapeSuccess: shapeGetStreamChunksSuccess
|
|
66
62
|
};
|
|
@@ -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
|
const getSystemLeaseInput = z.object({}), getSystemLeaseOutput = z.object({
|
|
5
4
|
mode: z.enum(["none", "lease"]),
|
|
6
5
|
status: z.enum(["disabled", "healthy", "no-lease", "contested"]),
|
|
@@ -39,10 +38,5 @@ export const getSystemLeaseOperation = defineOperation({
|
|
|
39
38
|
operationName: "weft.system.lease",
|
|
40
39
|
inputSources: {},
|
|
41
40
|
extractInput: async () => ({}),
|
|
42
|
-
success: { kind: "json", status: 200 }
|
|
43
|
-
shapeSuccess: (output) => new Response(JSON.stringify(output), {
|
|
44
|
-
status: 200,
|
|
45
|
-
headers: { "Content-Type": "application/json" }
|
|
46
|
-
}),
|
|
47
|
-
shapeFault: shapeRestFault
|
|
41
|
+
success: { kind: "json", status: 200 }
|
|
48
42
|
};
|
|
@@ -34,10 +34,6 @@ export function createGetSystemMetricsRestBinding() {
|
|
|
34
34
|
inputSources: {},
|
|
35
35
|
extractInput: async () => ({}),
|
|
36
36
|
success: { kind: "json", status: 200 },
|
|
37
|
-
shapeSuccess: (output) => new Response(JSON.stringify(output), {
|
|
38
|
-
status: 200,
|
|
39
|
-
headers: { "Content-Type": "application/json" }
|
|
40
|
-
}),
|
|
41
37
|
shapeFault: shapeOperationFaultAsJson
|
|
42
38
|
};
|
|
43
39
|
}
|
|
@@ -12,7 +12,6 @@ import {
|
|
|
12
12
|
isQueuedRecord,
|
|
13
13
|
isResolvedRecord
|
|
14
14
|
} from "../task-state.js";
|
|
15
|
-
import { shapeRestFault } from "./operation-helpers.js";
|
|
16
15
|
const DEFAULT_STALE_QUEUED_AFTER_MS = 60000, DEFAULT_STALE_HEARTBEAT_AFTER_MS = 60000, DEFAULT_RETRY_STORM_MINIMUM_ATTEMPTS = 3, DEFAULT_LIMIT = 50, MAX_LIMIT = 200, RESOLVED_HISTORY_SCAN_LIMIT = 1000, taskDiagnosticKindSchema = z.enum([
|
|
17
16
|
"stuck-queued",
|
|
18
17
|
"stale-inflight",
|
|
@@ -408,12 +407,7 @@ export const getTaskDiagnosticsRestBinding = {
|
|
|
408
407
|
limit: parseOptionalNumber(url.searchParams.get("limit"))
|
|
409
408
|
};
|
|
410
409
|
},
|
|
411
|
-
success: { kind: "json", status: 200 }
|
|
412
|
-
shapeSuccess: (output) => new Response(JSON.stringify(output), {
|
|
413
|
-
status: 200,
|
|
414
|
-
headers: { "Content-Type": "application/json" }
|
|
415
|
-
}),
|
|
416
|
-
shapeFault: shapeRestFault
|
|
410
|
+
success: { kind: "json", status: 200 }
|
|
417
411
|
}, clearTaskDeadLetterRestBinding = {
|
|
418
412
|
method: "DELETE",
|
|
419
413
|
path: "/v1/tasks/diagnostics/dead-letter/:operationId",
|
|
@@ -425,10 +419,5 @@ export const getTaskDiagnosticsRestBinding = {
|
|
|
425
419
|
extractInput: async (_request, pathParams) => ({
|
|
426
420
|
operationId: pathParams.operationId ?? ""
|
|
427
421
|
}),
|
|
428
|
-
success: { kind: "json", status: 200 }
|
|
429
|
-
shapeSuccess: (output) => new Response(JSON.stringify(output), {
|
|
430
|
-
status: 200,
|
|
431
|
-
headers: { "Content-Type": "application/json" }
|
|
432
|
-
}),
|
|
433
|
-
shapeFault: shapeRestFault
|
|
422
|
+
success: { kind: "json", status: 200 }
|
|
434
423
|
};
|
|
@@ -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
|
const getUpdateResultInput = z.object({
|
|
5
4
|
updateId: z.string().min(1)
|
|
6
5
|
}), getUpdateResultOutput = z.unknown();
|
|
@@ -37,9 +36,6 @@ function shapeGetUpdateResultSuccess(result) {
|
|
|
37
36
|
headers: { "Content-Type": "application/json" }
|
|
38
37
|
});
|
|
39
38
|
}
|
|
40
|
-
function shapeGetUpdateResultFault(fault) {
|
|
41
|
-
return shapeRestFault(fault);
|
|
42
|
-
}
|
|
43
39
|
export const getUpdateResultRestBinding = {
|
|
44
40
|
method: "GET",
|
|
45
41
|
path: "/v1/updates/:updateId",
|
|
@@ -50,6 +46,5 @@ export const getUpdateResultRestBinding = {
|
|
|
50
46
|
},
|
|
51
47
|
extractInput: async (_request, pathParams) => ({ updateId: pathParams.updateId ?? "" }),
|
|
52
48
|
success: { kind: "json", status: 200 },
|
|
53
|
-
shapeSuccess: (output) => shapeGetUpdateResultSuccess(output)
|
|
54
|
-
shapeFault: shapeGetUpdateResultFault
|
|
49
|
+
shapeSuccess: (output) => shapeGetUpdateResultSuccess(output)
|
|
55
50
|
};
|
|
@@ -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
|
const getWorkflowAttributesInput = z.object({
|
|
5
4
|
workflowId: z.string().min(1)
|
|
6
5
|
}), getWorkflowAttributesOutput = z.unknown();
|
|
@@ -26,17 +25,7 @@ export const getWorkflowAttributesOperation = defineOperation({
|
|
|
26
25
|
};
|
|
27
26
|
return attributes;
|
|
28
27
|
}
|
|
29
|
-
})
|
|
30
|
-
function shapeGetWorkflowAttributesSuccess(result) {
|
|
31
|
-
return new Response(JSON.stringify(result), {
|
|
32
|
-
status: 200,
|
|
33
|
-
headers: { "Content-Type": "application/json" }
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
function shapeGetWorkflowAttributesFault(fault) {
|
|
37
|
-
return shapeRestFault(fault);
|
|
38
|
-
}
|
|
39
|
-
export const getWorkflowAttributesRestBinding = {
|
|
28
|
+
}), getWorkflowAttributesRestBinding = {
|
|
40
29
|
method: "GET",
|
|
41
30
|
path: "/v1/workflows/:id/attributes",
|
|
42
31
|
pathParamNames: ["id"],
|
|
@@ -45,7 +34,5 @@ export const getWorkflowAttributesRestBinding = {
|
|
|
45
34
|
workflowId: { kind: "path", pathParam: "id" }
|
|
46
35
|
},
|
|
47
36
|
extractInput: async (_request, pathParams) => ({ workflowId: pathParams.id ?? "" }),
|
|
48
|
-
success: { kind: "json", status: 200 }
|
|
49
|
-
shapeSuccess: (output) => shapeGetWorkflowAttributesSuccess(output),
|
|
50
|
-
shapeFault: shapeGetWorkflowAttributesFault
|
|
37
|
+
success: { kind: "json", status: 200 }
|
|
51
38
|
};
|
|
@@ -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
|
const getWorkflowEventsInput = z.object({
|
|
5
4
|
workflowId: z.string().min(1)
|
|
6
5
|
}), getWorkflowEventsOutput = z.unknown();
|
|
@@ -26,17 +25,7 @@ export const getWorkflowEventsOperation = defineOperation({
|
|
|
26
25
|
};
|
|
27
26
|
return { events: await e.getEvents(input.workflowId) };
|
|
28
27
|
}
|
|
29
|
-
})
|
|
30
|
-
function shapeGetWorkflowEventsSuccess(result) {
|
|
31
|
-
return new Response(JSON.stringify(result), {
|
|
32
|
-
status: 200,
|
|
33
|
-
headers: { "Content-Type": "application/json" }
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
function shapeGetWorkflowEventsFault(fault) {
|
|
37
|
-
return shapeRestFault(fault);
|
|
38
|
-
}
|
|
39
|
-
export const getWorkflowEventsRestBinding = {
|
|
28
|
+
}), getWorkflowEventsRestBinding = {
|
|
40
29
|
method: "GET",
|
|
41
30
|
path: "/v1/workflows/:id/events",
|
|
42
31
|
pathParamNames: ["id"],
|
|
@@ -45,7 +34,5 @@ export const getWorkflowEventsRestBinding = {
|
|
|
45
34
|
workflowId: { kind: "path", pathParam: "id" }
|
|
46
35
|
},
|
|
47
36
|
extractInput: async (_request, pathParams) => ({ workflowId: pathParams.id ?? "" }),
|
|
48
|
-
success: { kind: "json", status: 200 }
|
|
49
|
-
shapeSuccess: (output) => shapeGetWorkflowEventsSuccess(output),
|
|
50
|
-
shapeFault: shapeGetWorkflowEventsFault
|
|
37
|
+
success: { kind: "json", status: 200 }
|
|
51
38
|
};
|
|
@@ -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
|
const workflowObservabilityInput = z.object({
|
|
5
4
|
workflowId: z.string().min(1)
|
|
6
5
|
}), scheduleProvenanceOutput = z.object({
|
|
@@ -60,8 +59,7 @@ export const getWorkflowScheduleProvenanceOperation = defineOperation({
|
|
|
60
59
|
operationName: "weft.workflows.scheduleprovenance.get",
|
|
61
60
|
inputSources: { workflowId: { kind: "path", pathParam: "id" } },
|
|
62
61
|
extractInput: async (_request, pathParams) => ({ workflowId: pathParams.id ?? "" }),
|
|
63
|
-
success: { kind: "json", status: 200 }
|
|
64
|
-
shapeFault: shapeRestFault
|
|
62
|
+
success: { kind: "json", status: 200 }
|
|
65
63
|
}, getWorkflowFinalizerRestBinding = {
|
|
66
64
|
method: "GET",
|
|
67
65
|
path: "/v1/workflows/:id/finalizer",
|
|
@@ -69,8 +67,7 @@ export const getWorkflowScheduleProvenanceOperation = defineOperation({
|
|
|
69
67
|
operationName: "weft.workflows.finalizer.get",
|
|
70
68
|
inputSources: { workflowId: { kind: "path", pathParam: "id" } },
|
|
71
69
|
extractInput: async (_request, pathParams) => ({ workflowId: pathParams.id ?? "" }),
|
|
72
|
-
success: { kind: "json", status: 200 }
|
|
73
|
-
shapeFault: shapeRestFault
|
|
70
|
+
success: { kind: "json", status: 200 }
|
|
74
71
|
}, workflowObservabilityRestBindings = [
|
|
75
72
|
getWorkflowScheduleProvenanceRestBinding,
|
|
76
73
|
getWorkflowFinalizerRestBinding
|
|
@@ -67,12 +67,6 @@ export const getWorkflowResultOperation = defineOperation({
|
|
|
67
67
|
}
|
|
68
68
|
}
|
|
69
69
|
});
|
|
70
|
-
function shapeGetWorkflowResultSuccess(result) {
|
|
71
|
-
return new Response(JSON.stringify(result), {
|
|
72
|
-
status: 200,
|
|
73
|
-
headers: { "Content-Type": "application/json" }
|
|
74
|
-
});
|
|
75
|
-
}
|
|
76
70
|
function shapeGetWorkflowResultFault(fault) {
|
|
77
71
|
if (fault.code === "Timeout")
|
|
78
72
|
return shapeRestFault(fault, { message: "Timeout waiting for workflow result", status: 408 });
|
|
@@ -88,6 +82,5 @@ export const getWorkflowResultRestBinding = {
|
|
|
88
82
|
},
|
|
89
83
|
extractInput: async (_request, pathParams) => ({ workflowId: pathParams.id ?? "" }),
|
|
90
84
|
success: { kind: "json", status: 200 },
|
|
91
|
-
shapeSuccess: (output) => shapeGetWorkflowResultSuccess(output),
|
|
92
85
|
shapeFault: shapeGetWorkflowResultFault
|
|
93
86
|
};
|
|
@@ -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 getWorkflowTimelineInput = z.object({
|
|
6
5
|
workflowId: z.string().min(1)
|
|
7
6
|
}), getWorkflowTimelineOutput = z.unknown();
|
|
@@ -31,9 +30,6 @@ export const getWorkflowTimelineOperation = defineOperation({
|
|
|
31
30
|
function shapeGetWorkflowTimelineSuccess(result, request) {
|
|
32
31
|
return negotiatedResponse(request, result, 200);
|
|
33
32
|
}
|
|
34
|
-
function shapeGetWorkflowTimelineFault(fault) {
|
|
35
|
-
return shapeRestFault(fault);
|
|
36
|
-
}
|
|
37
33
|
export const getWorkflowTimelineRestBinding = {
|
|
38
34
|
method: "GET",
|
|
39
35
|
path: "/v1/workflows/:id/timeline",
|
|
@@ -46,6 +42,5 @@ export const getWorkflowTimelineRestBinding = {
|
|
|
46
42
|
workflowId: pathParams.id ?? ""
|
|
47
43
|
}),
|
|
48
44
|
success: { kind: "json", status: 200 },
|
|
49
|
-
shapeSuccess: (output, request) => shapeGetWorkflowTimelineSuccess(output, request)
|
|
50
|
-
shapeFault: shapeGetWorkflowTimelineFault
|
|
45
|
+
shapeSuccess: (output, request) => shapeGetWorkflowTimelineSuccess(output, request)
|
|
51
46
|
};
|
|
@@ -3,8 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Returns a workflow's state by id. REST response shape preserves the
|
|
5
5
|
* historical format: 200 with the serialized `WorkflowState`, or a 4xx/5xx
|
|
6
|
-
* with the string `error` plus audited structured `data
|
|
7
|
-
* `shapeFault` below.
|
|
6
|
+
* with the string `error` plus audited structured `data`.
|
|
8
7
|
*
|
|
9
8
|
* @module server/operations/get-workflow
|
|
10
9
|
*/
|
|
@@ -27,10 +26,8 @@ export declare const getWorkflowOperation: import("../operation-catalog.ts").Ope
|
|
|
27
26
|
* Typed as `UnknownRestBinding` at the module boundary so the router's
|
|
28
27
|
* heterogeneous `ReadonlyArray<UnknownRestBinding>` storage doesn't
|
|
29
28
|
* run into `exactOptionalPropertyTypes` contravariance on
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
* where real type checking matters (did the output come out wrong?).
|
|
33
|
-
* The router itself only sees a shape-uniform `RestBinding<any, any>`.
|
|
29
|
+
* the binding shape. The router itself only sees a shape-uniform
|
|
30
|
+
* `RestBinding<any, any>`.
|
|
34
31
|
*/
|
|
35
32
|
export declare const getWorkflowRestBinding: UnknownRestBinding;
|
|
36
33
|
export {};
|
|
@@ -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
|
const getWorkflowInput = z.object({
|
|
5
4
|
workflowId: z.string().min(1)
|
|
6
5
|
}), getWorkflowOutput = z.unknown();
|
|
@@ -27,14 +26,7 @@ export const getWorkflowOperation = defineOperation({
|
|
|
27
26
|
};
|
|
28
27
|
return state;
|
|
29
28
|
}
|
|
30
|
-
})
|
|
31
|
-
function shapeGetWorkflowSuccess(state) {
|
|
32
|
-
return new Response(JSON.stringify(state), {
|
|
33
|
-
status: 200,
|
|
34
|
-
headers: { "Content-Type": "application/json" }
|
|
35
|
-
});
|
|
36
|
-
}
|
|
37
|
-
export const getWorkflowRestBinding = {
|
|
29
|
+
}), getWorkflowRestBinding = {
|
|
38
30
|
method: "GET",
|
|
39
31
|
path: "/v1/workflows/:id",
|
|
40
32
|
pathParamNames: ["id"],
|
|
@@ -43,7 +35,5 @@ export const getWorkflowRestBinding = {
|
|
|
43
35
|
workflowId: { kind: "path", pathParam: "id" }
|
|
44
36
|
},
|
|
45
37
|
extractInput: async (_request, pathParams) => ({ workflowId: pathParams.id ?? "" }),
|
|
46
|
-
success: { kind: "json", status: 200 }
|
|
47
|
-
shapeSuccess: (output) => shapeGetWorkflowSuccess(output),
|
|
48
|
-
shapeFault: shapeRestFault
|
|
38
|
+
success: { kind: "json", status: 200 }
|
|
49
39
|
};
|
|
@@ -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
|
};
|