@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.
Files changed (119) hide show
  1. package/README.md +1 -1
  2. package/dist/alerting/alert-manager.d.ts +5 -5
  3. package/dist/alerting/alert-manager.js +24 -6
  4. package/dist/alerting/index.d.ts +1 -1
  5. package/dist/alerting/types.d.ts +17 -13
  6. package/dist/alerting/types.js +5 -0
  7. package/dist/cli/generated/operation-catalog.snapshot.json +73 -0
  8. package/dist/cli/generated/operation-client.generated.d.ts +11 -2
  9. package/dist/cli/generated/operation-client.generated.js +2 -0
  10. package/dist/core/engine/disposal.js +7 -0
  11. package/dist/core/engine/engine-runtime-helpers.d.ts +3 -1
  12. package/dist/core/engine/engine-runtime-helpers.js +2 -2
  13. package/dist/core/engine/errors.d.ts +20 -0
  14. package/dist/core/engine/errors.js +8 -0
  15. package/dist/core/engine/index.d.ts +39 -17
  16. package/dist/core/engine/index.js +81 -9
  17. package/dist/core/engine/inline-launch-queue.d.ts +6 -2
  18. package/dist/core/engine/inline-launch-queue.js +41 -6
  19. package/dist/core/engine/internals.d.ts +2 -0
  20. package/dist/core/engine/lease-manager.d.ts +3 -2
  21. package/dist/core/engine/lease-manager.js +7 -3
  22. package/dist/core/engine/operations-time.js +6 -0
  23. package/dist/core/execution-strategy.d.ts +8 -0
  24. package/dist/core/inline-execution-strategy.d.ts +1 -0
  25. package/dist/core/inline-execution-strategy.js +33 -20
  26. package/dist/core/weft-error.d.ts +1 -1
  27. package/dist/core/weft-error.js +1 -0
  28. package/dist/core/worker-execution-strategy.d.ts +2 -0
  29. package/dist/core/worker-execution-strategy.js +7 -2
  30. package/dist/core/worker-turn-watchdog.d.ts +4 -1
  31. package/dist/core/worker-turn-watchdog.js +9 -4
  32. package/dist/index.d.ts +2 -2
  33. package/dist/index.js +1 -0
  34. package/dist/indexeddb.js +1 -1
  35. package/dist/json-schema.js +1 -1
  36. package/dist/mcp/tools.js +1 -3
  37. package/dist/server/authorization-scope.d.ts +32 -2
  38. package/dist/server/dashboard-assets.d.ts +12 -1
  39. package/dist/server/dashboard-assets.js +145 -31
  40. package/dist/server/index.d.ts +2 -0
  41. package/dist/server/index.js +4 -0
  42. package/dist/server/operations/aggregate-workflows.js +0 -7
  43. package/dist/server/operations/async-activity.js +5 -24
  44. package/dist/server/operations/bulk-cancel-workflows.js +3 -8
  45. package/dist/server/operations/bulk-delete-workflows.js +3 -8
  46. package/dist/server/operations/bulk-mutate-workflow-tags.js +3 -8
  47. package/dist/server/operations/bulk-operation-helpers.d.ts +2 -10
  48. package/dist/server/operations/bulk-operation-helpers.js +0 -6
  49. package/dist/server/operations/bulk-retry-failed-workflows.js +3 -8
  50. package/dist/server/operations/bulk-signal-workflows.js +3 -8
  51. package/dist/server/operations/cancel-schedule.js +1 -3
  52. package/dist/server/operations/cancel-workflow.js +1 -3
  53. package/dist/server/operations/create-schedule.js +2 -3
  54. package/dist/server/operations/fork-workflow.js +2 -3
  55. package/dist/server/operations/get-checkpoint-at.js +1 -6
  56. package/dist/server/operations/get-principal.d.ts +75 -0
  57. package/dist/server/operations/get-principal.js +41 -0
  58. package/dist/server/operations/get-registry.js +1 -7
  59. package/dist/server/operations/get-retention-overview.js +2 -15
  60. package/dist/server/operations/get-review.js +2 -15
  61. package/dist/server/operations/get-schedule.js +2 -8
  62. package/dist/server/operations/get-stream-chunks.js +2 -6
  63. package/dist/server/operations/get-system-lease.js +1 -7
  64. package/dist/server/operations/get-system-metrics.js +0 -4
  65. package/dist/server/operations/get-task-diagnostics.js +2 -13
  66. package/dist/server/operations/get-update-result.js +1 -6
  67. package/dist/server/operations/get-workflow-attributes.js +2 -15
  68. package/dist/server/operations/get-workflow-events.js +2 -15
  69. package/dist/server/operations/get-workflow-observability.js +2 -5
  70. package/dist/server/operations/get-workflow-result.js +0 -7
  71. package/dist/server/operations/get-workflow-timeline.js +1 -6
  72. package/dist/server/operations/get-workflow.d.ts +3 -6
  73. package/dist/server/operations/get-workflow.js +2 -12
  74. package/dist/server/operations/list-alerts.d.ts +5 -2
  75. package/dist/server/operations/list-alerts.js +2 -9
  76. package/dist/server/operations/list-checkpoints.js +1 -6
  77. package/dist/server/operations/list-reviews.js +0 -7
  78. package/dist/server/operations/list-schedules.js +3 -8
  79. package/dist/server/operations/list-task-queues.js +0 -4
  80. package/dist/server/operations/list-workers.js +0 -4
  81. package/dist/server/operations/list-workflows.js +0 -7
  82. package/dist/server/operations/pause-schedule.js +1 -3
  83. package/dist/server/operations/purge-workflows.js +2 -5
  84. package/dist/server/operations/query-workflow.js +4 -15
  85. package/dist/server/operations/replay-workflow.js +2 -6
  86. package/dist/server/operations/resume-schedule.js +1 -3
  87. package/dist/server/operations/resume-workflow.js +1 -3
  88. package/dist/server/operations/set-workflow-attributes.js +3 -15
  89. package/dist/server/operations/signal-workflow.js +3 -12
  90. package/dist/server/operations/single-workflow-tag-mutation.js +0 -7
  91. package/dist/server/operations/start-or-signal-workflow.js +2 -3
  92. package/dist/server/operations/start-workflow.js +2 -3
  93. package/dist/server/operations/static-registrations.d.ts +28 -0
  94. package/dist/server/operations/static-registrations.js +263 -0
  95. package/dist/server/operations/storage-capabilities.js +1 -3
  96. package/dist/server/operations/storage.js +7 -13
  97. package/dist/server/operations/submit-review-decision.js +3 -12
  98. package/dist/server/operations/suspend-workflow.js +1 -3
  99. package/dist/server/operations/timeout-workflow.js +1 -3
  100. package/dist/server/operations/update-schedule.js +1 -3
  101. package/dist/server/operations/update-workflow.js +2 -3
  102. package/dist/server/operations/worker-drain.js +0 -8
  103. package/dist/server/rest-binding.d.ts +3 -2
  104. package/dist/server/rest-bindings.d.ts +5 -0
  105. package/dist/server/rest-bindings.js +4 -312
  106. package/dist/server/route-model.d.ts +2 -0
  107. package/dist/server/route-model.js +1 -1
  108. package/dist/server/runtime/task-reconciliation.d.ts +10 -1
  109. package/dist/server/runtime/task-reconciliation.js +26 -2
  110. package/dist/server/serve-internals.js +12 -6
  111. package/dist/storage/indexeddb.js +28 -48
  112. package/dist/storage/testing.d.ts +6 -3
  113. package/dist/storage/testing.js +1 -1
  114. package/dist/version.d.ts +1 -1
  115. package/dist/version.js +1 -1
  116. package/dist/worker/protocol-schemas.d.ts +2 -2
  117. package/dist/worker/protocol-schemas.js +2 -2
  118. package/dist/worker/protocol.js +1 -1
  119. package/package.json +1 -1
@@ -0,0 +1,263 @@
1
+ import {
2
+ addWorkflowTagsOperation,
3
+ addWorkflowTagsRestBinding
4
+ } from "./add-workflow-tags.js";
5
+ import {
6
+ aggregateWorkflowsOperation,
7
+ aggregateWorkflowsRestBinding
8
+ } from "./aggregate-workflows.js";
9
+ import * as asyncActivity from "./async-activity.js";
10
+ import {
11
+ bulkCancelWorkflowsOperation,
12
+ bulkCancelWorkflowsRestBinding
13
+ } from "./bulk-cancel-workflows.js";
14
+ import {
15
+ bulkDeleteWorkflowsOperation,
16
+ bulkDeleteWorkflowsRestBinding
17
+ } from "./bulk-delete-workflows.js";
18
+ import {
19
+ bulkMutateWorkflowTagsOperation,
20
+ bulkMutateWorkflowTagsRestBinding
21
+ } from "./bulk-mutate-workflow-tags.js";
22
+ import {
23
+ bulkRetryFailedWorkflowsOperation,
24
+ bulkRetryFailedWorkflowsRestBinding
25
+ } from "./bulk-retry-failed-workflows.js";
26
+ import {
27
+ bulkSignalWorkflowsOperation,
28
+ bulkSignalWorkflowsRestBinding
29
+ } from "./bulk-signal-workflows.js";
30
+ import { cancelScheduleOperation, cancelScheduleRestBinding } from "./cancel-schedule.js";
31
+ import { cancelWorkflowOperation, cancelWorkflowRestBinding } from "./cancel-workflow.js";
32
+ import { createScheduleOperation, createScheduleRestBinding } from "./create-schedule.js";
33
+ import { fleetEventsSseOperation, fleetEventsSseRestBinding } from "./fleet-events-sse.js";
34
+ import { fleetEventsSubscriptionOperation } from "./fleet-events-subscription.js";
35
+ import { forkWorkflowOperation, forkWorkflowRestBinding } from "./fork-workflow.js";
36
+ import { getCheckpointAtOperation, getCheckpointAtRestBinding } from "./get-checkpoint-at.js";
37
+ import { getPrincipalOperation, getPrincipalRestBinding } from "./get-principal.js";
38
+ import { getRegistryOperation, getRegistryRestBinding } from "./get-registry.js";
39
+ import {
40
+ getRetentionOverviewOperation,
41
+ getRetentionOverviewRestBinding
42
+ } from "./get-retention-overview.js";
43
+ import { getReviewOperation, getReviewRestBinding } from "./get-review.js";
44
+ import { getScheduleOperation, getScheduleRestBinding } from "./get-schedule.js";
45
+ import { getStreamChunksOperation, getStreamChunksRestBinding } from "./get-stream-chunks.js";
46
+ import { getSystemLeaseOperation, getSystemLeaseRestBinding } from "./get-system-lease.js";
47
+ import {
48
+ clearTaskDeadLetterOperation,
49
+ clearTaskDeadLetterRestBinding,
50
+ getTaskDiagnosticsRestBinding
51
+ } from "./get-task-diagnostics.js";
52
+ import { getUpdateResultOperation, getUpdateResultRestBinding } from "./get-update-result.js";
53
+ import {
54
+ getWorkflowAttributesOperation,
55
+ getWorkflowAttributesRestBinding
56
+ } from "./get-workflow-attributes.js";
57
+ import {
58
+ getWorkflowEventsOperation,
59
+ getWorkflowEventsRestBinding
60
+ } from "./get-workflow-events.js";
61
+ import * as workflowObservability from "./get-workflow-observability.js";
62
+ import {
63
+ getWorkflowResultOperation,
64
+ getWorkflowResultRestBinding
65
+ } from "./get-workflow-result.js";
66
+ import {
67
+ getWorkflowTimelineOperation,
68
+ getWorkflowTimelineRestBinding
69
+ } from "./get-workflow-timeline.js";
70
+ import { getWorkflowOperation, getWorkflowRestBinding } from "./get-workflow.js";
71
+ import { listAlertsOperation, listAlertsRestBinding } from "./list-alerts.js";
72
+ import { listCheckpointsOperation, listCheckpointsRestBinding } from "./list-checkpoints.js";
73
+ import { listReviewsOperation, listReviewsRestBinding } from "./list-reviews.js";
74
+ import { listSchedulesOperation, listSchedulesRestBinding } from "./list-schedules.js";
75
+ import { listWorkflowsOperation, listWorkflowsRestBinding } from "./list-workflows.js";
76
+ import { pauseScheduleOperation, pauseScheduleRestBinding } from "./pause-schedule.js";
77
+ import { purgeWorkflowsOperation, purgeWorkflowsRestBinding } from "./purge-workflows.js";
78
+ import {
79
+ queryWorkflowOperation,
80
+ queryWorkflowRestBinding,
81
+ queryWorkflowWithInputRestBinding
82
+ } from "./query-workflow.js";
83
+ import { recoverAllOperation, recoverAllRestBinding } from "./recover-all.js";
84
+ import {
85
+ removeWorkflowTagsOperation,
86
+ removeWorkflowTagsRestBinding
87
+ } from "./remove-workflow-tags.js";
88
+ import { replayWorkflowOperation, replayWorkflowRestBinding } from "./replay-workflow.js";
89
+ import { resumeScheduleOperation, resumeScheduleRestBinding } from "./resume-schedule.js";
90
+ import { resumeWorkflowOperation, resumeWorkflowRestBinding } from "./resume-workflow.js";
91
+ import {
92
+ setWorkflowAttributesOperation,
93
+ setWorkflowAttributesRestBinding
94
+ } from "./set-workflow-attributes.js";
95
+ import { signalWorkflowOperation, signalWorkflowRestBinding } from "./signal-workflow.js";
96
+ import {
97
+ startOrSignalWorkflowOperation,
98
+ startOrSignalWorkflowRestBinding
99
+ } from "./start-or-signal-workflow.js";
100
+ import { startWorkflowOperation, startWorkflowRestBinding } from "./start-workflow.js";
101
+ import * as storageCapabilities from "./storage-capabilities.js";
102
+ import {
103
+ storageBatchOperation,
104
+ storageBatchRestBinding,
105
+ storageConditionalBatchOperation,
106
+ storageConditionalBatchRestBinding,
107
+ storageDeleteOperation,
108
+ storageDeleteRestBinding,
109
+ storageGetOperation,
110
+ storageGetRestBinding,
111
+ storagePutOperation,
112
+ storagePutRestBinding,
113
+ storageScanOperation,
114
+ storageScanRestBinding
115
+ } from "./storage.js";
116
+ import {
117
+ streamWorkflowSseOperation,
118
+ streamWorkflowSseRestBinding
119
+ } from "./stream-workflow-sse.js";
120
+ import {
121
+ submitReviewDecisionOperation,
122
+ submitReviewDecisionRestBinding
123
+ } from "./submit-review-decision.js";
124
+ import { suspendWorkflowOperation, suspendWorkflowRestBinding } from "./suspend-workflow.js";
125
+ import { timeoutWorkflowOperation, timeoutWorkflowRestBinding } from "./timeout-workflow.js";
126
+ import { updateScheduleOperation, updateScheduleRestBinding } from "./update-schedule.js";
127
+ import { updateWorkflowOperation, updateWorkflowRestBinding } from "./update-workflow.js";
128
+ import {
129
+ workflowEventsSseOperation,
130
+ workflowEventsSseRestBinding
131
+ } from "./workflow-events-sse.js";
132
+ import { workflowEventsSubscriptionOperation } from "./workflow-events-subscription.js";
133
+ export const STATIC_REST_BINDINGS = [
134
+ listAlertsRestBinding,
135
+ getPrincipalRestBinding,
136
+ startWorkflowRestBinding,
137
+ startOrSignalWorkflowRestBinding,
138
+ recoverAllRestBinding,
139
+ listWorkflowsRestBinding,
140
+ aggregateWorkflowsRestBinding,
141
+ purgeWorkflowsRestBinding,
142
+ bulkCancelWorkflowsRestBinding,
143
+ bulkSignalWorkflowsRestBinding,
144
+ bulkRetryFailedWorkflowsRestBinding,
145
+ bulkDeleteWorkflowsRestBinding,
146
+ bulkMutateWorkflowTagsRestBinding,
147
+ getWorkflowRestBinding,
148
+ cancelWorkflowRestBinding,
149
+ getWorkflowResultRestBinding,
150
+ getWorkflowAttributesRestBinding,
151
+ ...workflowObservability.workflowObservabilityRestBindings,
152
+ getWorkflowEventsRestBinding,
153
+ setWorkflowAttributesRestBinding,
154
+ signalWorkflowRestBinding,
155
+ asyncActivity.listPendingAsyncActivitiesRestBinding,
156
+ asyncActivity.completeAsyncActivityRestBinding,
157
+ asyncActivity.failAsyncActivityRestBinding,
158
+ queryWorkflowRestBinding,
159
+ queryWorkflowWithInputRestBinding,
160
+ resumeWorkflowRestBinding,
161
+ suspendWorkflowRestBinding,
162
+ forkWorkflowRestBinding,
163
+ timeoutWorkflowRestBinding,
164
+ updateWorkflowRestBinding,
165
+ createScheduleRestBinding,
166
+ updateScheduleRestBinding,
167
+ getRegistryRestBinding,
168
+ getSystemLeaseRestBinding,
169
+ getRetentionOverviewRestBinding,
170
+ getUpdateResultRestBinding,
171
+ listReviewsRestBinding,
172
+ getReviewRestBinding,
173
+ listCheckpointsRestBinding,
174
+ getCheckpointAtRestBinding,
175
+ getWorkflowTimelineRestBinding,
176
+ addWorkflowTagsRestBinding,
177
+ removeWorkflowTagsRestBinding,
178
+ submitReviewDecisionRestBinding,
179
+ cancelScheduleRestBinding,
180
+ pauseScheduleRestBinding,
181
+ resumeScheduleRestBinding,
182
+ getStreamChunksRestBinding,
183
+ streamWorkflowSseRestBinding,
184
+ workflowEventsSseRestBinding,
185
+ fleetEventsSseRestBinding,
186
+ getTaskDiagnosticsRestBinding,
187
+ clearTaskDeadLetterRestBinding,
188
+ listSchedulesRestBinding,
189
+ getScheduleRestBinding,
190
+ replayWorkflowRestBinding,
191
+ storageCapabilities.storageCapabilitiesRestBinding,
192
+ storageGetRestBinding,
193
+ storagePutRestBinding,
194
+ storageDeleteRestBinding,
195
+ storageScanRestBinding,
196
+ storageBatchRestBinding,
197
+ storageConditionalBatchRestBinding
198
+ ], STATIC_OPERATIONS = [
199
+ startWorkflowOperation,
200
+ startOrSignalWorkflowOperation,
201
+ recoverAllOperation,
202
+ listWorkflowsOperation,
203
+ aggregateWorkflowsOperation,
204
+ purgeWorkflowsOperation,
205
+ bulkCancelWorkflowsOperation,
206
+ bulkSignalWorkflowsOperation,
207
+ bulkRetryFailedWorkflowsOperation,
208
+ bulkDeleteWorkflowsOperation,
209
+ bulkMutateWorkflowTagsOperation,
210
+ getWorkflowOperation,
211
+ cancelWorkflowOperation,
212
+ getWorkflowResultOperation,
213
+ getWorkflowAttributesOperation,
214
+ ...workflowObservability.workflowObservabilityOperations,
215
+ getWorkflowEventsOperation,
216
+ setWorkflowAttributesOperation,
217
+ signalWorkflowOperation,
218
+ asyncActivity.listPendingAsyncActivitiesOperation,
219
+ asyncActivity.completeAsyncActivityOperation,
220
+ asyncActivity.failAsyncActivityOperation,
221
+ queryWorkflowOperation,
222
+ resumeWorkflowOperation,
223
+ suspendWorkflowOperation,
224
+ forkWorkflowOperation,
225
+ timeoutWorkflowOperation,
226
+ updateWorkflowOperation,
227
+ createScheduleOperation,
228
+ updateScheduleOperation,
229
+ getRegistryOperation,
230
+ getSystemLeaseOperation,
231
+ getRetentionOverviewOperation,
232
+ getUpdateResultOperation,
233
+ listReviewsOperation,
234
+ getReviewOperation,
235
+ listCheckpointsOperation,
236
+ getCheckpointAtOperation,
237
+ getWorkflowTimelineOperation,
238
+ addWorkflowTagsOperation,
239
+ removeWorkflowTagsOperation,
240
+ submitReviewDecisionOperation,
241
+ cancelScheduleOperation,
242
+ pauseScheduleOperation,
243
+ resumeScheduleOperation,
244
+ getStreamChunksOperation,
245
+ streamWorkflowSseOperation,
246
+ workflowEventsSseOperation,
247
+ fleetEventsSseOperation,
248
+ workflowEventsSubscriptionOperation,
249
+ fleetEventsSubscriptionOperation,
250
+ clearTaskDeadLetterOperation,
251
+ listSchedulesOperation,
252
+ listAlertsOperation,
253
+ getPrincipalOperation,
254
+ getScheduleOperation,
255
+ replayWorkflowOperation,
256
+ storageCapabilities.storageCapabilitiesOperation,
257
+ storageGetOperation,
258
+ storagePutOperation,
259
+ storageDeleteOperation,
260
+ storageScanOperation,
261
+ storageBatchOperation,
262
+ storageConditionalBatchOperation
263
+ ];
@@ -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 storageCapabilitiesInput = z.object({}), storageCapabilitiesOutput = z.object({
5
4
  persistence: z.enum(["ephemeral", "local", "remote"]),
6
5
  readAfterWrite: z.enum(["linearizable", "session", "eventual"]),
@@ -33,6 +32,5 @@ export const storageCapabilitiesOperation = defineOperation({
33
32
  inputSources: {},
34
33
  extractInput: async () => ({}),
35
34
  success: { kind: "json", status: 200 },
36
- shapeSuccess: (output) => Response.json(output),
37
- shapeFault: shapeRestFault
35
+ shapeSuccess: (output) => Response.json(output)
38
36
  };
@@ -11,7 +11,7 @@ import { raiseFault } from "../operation-catalog.js";
11
11
  import { defineOperation } from "../operation-registry.js";
12
12
  import { isAuthenticated } from "../principal.js";
13
13
  import { readRestBodyBounded, readRestJsonBody } from "../rest-body.js";
14
- import { invalidParamsFault, isOperationFault, shapeRestFault } from "./operation-helpers.js";
14
+ import { invalidParamsFault, isOperationFault } from "./operation-helpers.js";
15
15
  const rawStorageAccess = {
16
16
  kind: "scoped",
17
17
  scopes: { kind: "anyOf", scopes: ["storage:admin"] }
@@ -283,8 +283,7 @@ export const storageGetOperation = defineOperation({
283
283
  },
284
284
  extractInput: async (_request, pathParams) => ({ key: storageKeyFromPath(pathParams) }),
285
285
  success: { kind: "streaming", mediaType: "application/octet-stream" },
286
- shapeSuccess: (output) => createBinaryResponse(output),
287
- shapeFault: shapeRestFault
286
+ shapeSuccess: (output) => createBinaryResponse(output)
288
287
  }, storagePutRestBinding = {
289
288
  method: "PUT",
290
289
  path: "/v1/storage/:key",
@@ -299,8 +298,7 @@ export const storageGetOperation = defineOperation({
299
298
  value: await readRestBodyBounded(request, context)
300
299
  }),
301
300
  success: { kind: "empty", status: 204 },
302
- shapeSuccess: createNoContentResponse,
303
- shapeFault: shapeRestFault
301
+ shapeSuccess: createNoContentResponse
304
302
  }, storageDeleteRestBinding = {
305
303
  method: "DELETE",
306
304
  path: "/v1/storage/:key",
@@ -311,8 +309,7 @@ export const storageGetOperation = defineOperation({
311
309
  },
312
310
  extractInput: async (_request, pathParams) => ({ key: storageKeyFromPath(pathParams) }),
313
311
  success: { kind: "empty", status: 204 },
314
- shapeSuccess: createNoContentResponse,
315
- shapeFault: shapeRestFault
312
+ shapeSuccess: createNoContentResponse
316
313
  }, storageScanRestBinding = {
317
314
  method: "GET",
318
315
  path: "/v1/storage",
@@ -329,8 +326,7 @@ export const storageGetOperation = defineOperation({
329
326
  },
330
327
  extractInput: async (request) => extractStorageScanInput(request),
331
328
  success: { kind: "streaming", mediaType: "application/x-ndjson" },
332
- shapeSuccess: (output) => createNdjsonResponse(output),
333
- shapeFault: shapeRestFault
329
+ shapeSuccess: (output) => createNdjsonResponse(output)
334
330
  }, storageBatchRestBinding = {
335
331
  method: "POST",
336
332
  path: "/v1/storage/-/batch",
@@ -341,8 +337,7 @@ export const storageGetOperation = defineOperation({
341
337
  },
342
338
  extractInput: async (request, _pathParams, context) => readJsonRequestBody(request, context),
343
339
  success: { kind: "empty", status: 204 },
344
- shapeSuccess: createNoContentResponse,
345
- shapeFault: shapeRestFault
340
+ shapeSuccess: createNoContentResponse
346
341
  }, storageConditionalBatchRestBinding = {
347
342
  method: "POST",
348
343
  path: "/v1/storage/-/conditional-batch",
@@ -354,6 +349,5 @@ export const storageGetOperation = defineOperation({
354
349
  },
355
350
  extractInput: async (request, _pathParams, context) => readJsonRequestBody(request, context),
356
351
  success: { kind: "json", status: 200 },
357
- shapeSuccess: (output) => Response.json(output),
358
- shapeFault: shapeRestFault
352
+ shapeSuccess: (output) => Response.json(output)
359
353
  };
@@ -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, shapeRestFault } from "./operation-helpers.js";
4
+ import { isOperationFault } from "./operation-helpers.js";
5
5
  const VALID_DECISIONS = [
6
6
  "approved",
7
7
  "rejected",
@@ -92,14 +92,7 @@ export const submitReviewDecisionOperation = defineOperation({
92
92
  mapReviewDecisionError(error, input.reviewId);
93
93
  }
94
94
  }
95
- });
96
- function shapeSubmitReviewDecisionSuccess(output) {
97
- return new Response(JSON.stringify(output), {
98
- status: 200,
99
- headers: { "Content-Type": "application/json" }
100
- });
101
- }
102
- export const submitReviewDecisionRestBinding = {
95
+ }), submitReviewDecisionRestBinding = {
103
96
  method: "POST",
104
97
  path: "/v1/reviews/:reviewId/decision",
105
98
  pathParamNames: ["reviewId"],
@@ -127,7 +120,5 @@ export const submitReviewDecisionRestBinding = {
127
120
  workflowId: record.workflowId
128
121
  };
129
122
  },
130
- success: { kind: "json", status: 200 },
131
- shapeSuccess: (output) => shapeSubmitReviewDecisionSuccess(output),
132
- shapeFault: shapeRestFault
123
+ success: { kind: "json", status: 200 }
133
124
  };
@@ -1,6 +1,5 @@
1
1
  import { z } from "zod";
2
2
  import { WorkflowSuspendNotSupportedError } from "../../core/engine/errors.js";
3
- import { shapeRestFault } from "./operation-helpers.js";
4
3
  import {
5
4
  createSingleWorkflowControlOperation,
6
5
  extractWorkflowIdFromPath
@@ -31,6 +30,5 @@ export const suspendWorkflowOperation = createSingleWorkflowControlOperation({
31
30
  workflowId: { kind: "path", pathParam: "id" }
32
31
  },
33
32
  extractInput: async (_request, pathParams) => extractWorkflowIdFromPath(pathParams),
34
- success: { kind: "empty", status: 204 },
35
- shapeFault: shapeRestFault
33
+ success: { kind: "empty", status: 204 }
36
34
  };
@@ -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
@@ -29,6 +28,5 @@ export const timeoutWorkflowOperation = createSingleWorkflowControlOperation({
29
28
  workflowId: { kind: "path", pathParam: "id" }
30
29
  },
31
30
  extractInput: async (_request, pathParams) => extractWorkflowIdFromPath(pathParams),
32
- success: { kind: "empty", status: 204 },
33
- shapeFault: shapeRestFault
31
+ success: { kind: "empty", status: 204 }
34
32
  };
@@ -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 {
5
4
  mapScheduleErrorToFault,
6
5
  validateScheduleInputCadence,
@@ -62,6 +61,5 @@ export const updateScheduleOperation = defineOperation({
62
61
  ...extractSharedScheduleRestFields(record)
63
62
  };
64
63
  },
65
- success: { kind: "empty", status: 204 },
66
- shapeFault: shapeRestFault
64
+ success: { kind: "empty", status: 204 }
67
65
  };
@@ -6,7 +6,7 @@ import {
6
6
  } from "../../core/updates.js";
7
7
  import { defineOperation } from "../operation-registry.js";
8
8
  import { readRestJsonBody } from "../rest-body.js";
9
- import { isOperationFault, shapeRestFault } from "./operation-helpers.js";
9
+ import { isOperationFault } from "./operation-helpers.js";
10
10
  const DEFAULT_UPDATE_TIMEOUT_MS = 30000, updateWorkflowInput = z.object({
11
11
  workflowId: z.string().min(1),
12
12
  updateName: z.string().min(1),
@@ -108,6 +108,5 @@ export const updateWorkflowOperation = defineOperation({
108
108
  ...idempotencyKey !== void 0 ? { idempotencyKey } : {}
109
109
  };
110
110
  },
111
- success: { kind: "json", status: 200 },
112
- shapeFault: shapeRestFault
111
+ success: { kind: "json", status: 200 }
113
112
  };
@@ -159,7 +159,6 @@ function createWorkerDrainRestBinding(method, operationName) {
159
159
  ...method === "POST" ? await readDrainBody(request, context) : {}
160
160
  }),
161
161
  success: { kind: "json", status: 200 },
162
- shapeSuccess: shapeDrainSuccess,
163
162
  shapeFault: shapeOperationFaultAsJson
164
163
  };
165
164
  }
@@ -178,16 +177,9 @@ function createDeploymentDrainRestBinding(method, operationName) {
178
177
  ...method === "POST" ? await readDrainBody(request, context) : {}
179
178
  }),
180
179
  success: { kind: "json", status: 200 },
181
- shapeSuccess: shapeDrainSuccess,
182
180
  shapeFault: shapeOperationFaultAsJson
183
181
  };
184
182
  }
185
- function shapeDrainSuccess(output) {
186
- return new Response(JSON.stringify(output), {
187
- status: 200,
188
- headers: { "Content-Type": "application/json" }
189
- });
190
- }
191
183
  async function readDrainBody(request, context) {
192
184
  const text = await readRestTextBody(request, context);
193
185
  if (text.trim().length === 0)
@@ -98,8 +98,9 @@ export type RestBinding<Input, Output> = {
98
98
  readonly success: ResponseShape;
99
99
  /**
100
100
  * Optional override for response construction. When absent, transport
101
- * adapters default to `Response.json(output, { status: success.status })`
102
- * (or `new Response(null, { status })` for `empty`). Provide this
101
+ * adapters default to `jsonResponse(output, success.status)`, which emits
102
+ * `JSON.stringify(output)` with `Content-Type: application/json` (or
103
+ * `new Response(null, { status })` for `empty`). Provide this
103
104
  * when the wire representation differs from `output` verbatim.
104
105
  *
105
106
  * Receives the original `Request` so REST-only response shaping —
@@ -6,6 +6,11 @@
6
6
  * direct meta and discovery routes first; remaining requests then match
7
7
  * these operation-backed bindings.
8
8
  *
9
+ * Statically-configured operations and bindings live in
10
+ * `operations/static-registrations.ts`; this module owns the heterogeneous
11
+ * binding type, the per-server factory wiring (metrics, workers, task
12
+ * queues, diagnostics), and the composed live registry/binding builders.
13
+ *
9
14
  * @module server/rest-bindings
10
15
  */
11
16
  import type { MetricsCollector } from '../observability/metrics.ts';