@lostgradient/weft 0.14.0 → 0.16.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 +3 -8
- package/dist/alerting/alert-manager.d.ts +2 -0
- package/dist/alerting/alert-manager.js +3 -0
- package/dist/cli/api.js +5 -19
- package/dist/cli/console.d.ts +12 -0
- package/dist/cli/console.js +62 -0
- package/dist/cli/generated/operation-catalog.snapshot.json +1061 -90
- package/dist/cli/generated/operation-client.generated.d.ts +29 -23
- package/dist/cli/generated/operation-client.generated.js +2 -0
- package/dist/cli/help-text.d.ts +1 -1
- package/dist/cli/help-text.js +1 -0
- package/dist/cli/index.d.ts +1 -0
- package/dist/cli/index.js +1 -0
- package/dist/cli/json-input.d.ts +20 -0
- package/dist/cli/json-input.js +33 -0
- package/dist/cli/parse-arguments.js +2 -0
- package/dist/cli/schedule.js +7 -9
- package/dist/cli/types.d.ts +1 -0
- package/dist/cli/workflow-commands.js +5 -25
- package/dist/cli-main.js +4 -2
- package/dist/core/aggregate-validation.d.ts +2 -5
- package/dist/core/aggregate-validation.js +2 -10
- package/dist/core/atomic-state.js +21 -24
- package/dist/core/engine/index.d.ts +3 -0
- package/dist/core/engine/index.js +3 -0
- package/dist/core/engine/schedules.js +4 -1
- package/dist/core/inline-execution-strategy.js +8 -46
- package/dist/core/list-filter-validation.d.ts +2 -5
- package/dist/core/list-filter-validation.js +2 -10
- package/dist/core/types/schedules.d.ts +13 -31
- package/dist/core/validation-issues.d.ts +13 -0
- package/dist/core/validation-issues.js +9 -0
- package/dist/diagnostics/recommendations.js +1 -9
- package/dist/http.js +2 -2
- package/dist/indexeddb.js +1 -1
- package/dist/mcp/session.js +2 -10
- package/dist/mcp/tools.js +2 -10
- package/dist/mcp/tuple-list-equality.d.ts +1 -0
- package/dist/mcp/tuple-list-equality.js +12 -0
- package/dist/server/authorization-scope.d.ts +1 -1
- package/dist/server/authorization-scope.js +0 -2
- package/dist/server/dashboard-assets.d.ts +26 -0
- package/dist/server/dashboard-assets.js +95 -0
- package/dist/server/index.d.ts +10 -1
- package/dist/server/index.js +11 -2
- package/dist/server/interactive-operations.js +1 -0
- package/dist/server/operation-catalog/types.d.ts +1 -1
- package/dist/server/operation-registry.d.ts +2 -31
- package/dist/server/operations/bulk-filter-helpers.d.ts +17 -17
- package/dist/server/operations/bulk-filter-helpers.js +16 -37
- package/dist/server/operations/bulk-mutate-workflow-tags.d.ts +27 -27
- package/dist/server/operations/bulk-signal-workflows.d.ts +26 -26
- package/dist/server/operations/create-schedule.js +26 -65
- package/dist/server/operations/event-stream-contracts.d.ts +20 -0
- package/dist/server/operations/event-stream-contracts.js +67 -0
- package/dist/server/operations/fleet-events-sse.js +21 -50
- package/dist/server/operations/fleet-events-subscription.js +8 -12
- package/dist/server/operations/list-alerts.d.ts +26 -0
- package/dist/server/operations/list-alerts.js +54 -0
- package/dist/server/operations/list-workflows.d.ts +43 -43
- package/dist/server/operations/list-workflows.js +9 -30
- package/dist/server/operations/purge-workflows.d.ts +11 -11
- package/dist/server/operations/schedule-faults.d.ts +9 -1
- package/dist/server/operations/schedule-faults.js +51 -0
- package/dist/server/operations/schedule-rest-body.d.ts +11 -0
- package/dist/server/operations/schedule-rest-body.js +28 -0
- package/dist/server/operations/update-schedule.js +13 -72
- package/dist/server/operations/workflow-events-sse.js +29 -67
- package/dist/server/operations/workflow-events-subscription.js +9 -27
- package/dist/server/rest-bindings.js +3 -0
- package/dist/server/runtime/task-polling.js +3 -5
- package/dist/server/task-state.d.ts +2 -8
- package/dist/server/task-state.js +10 -7
- package/dist/service-worker/index.d.ts +4 -1
- package/dist/service-worker/index.js +2 -2
- package/dist/service-worker/setup.d.ts +20 -0
- package/dist/service-worker/setup.js +5 -5
- package/dist/storage/bun-sql.js +65 -80
- package/dist/storage/conditional-batch-body.d.ts +7 -0
- package/dist/storage/conditional-batch-body.js +14 -0
- package/dist/storage/lmdb.js +1 -1
- package/dist/storage/memory.js +1 -1
- package/dist/storage/neon.js +2 -2
- package/dist/storage/node-sqlite-loader.d.ts +2 -2
- package/dist/storage/node-sqlite.js +32 -17
- package/dist/storage/postgres.js +2 -2
- package/dist/storage/resolve.js +1 -1
- package/dist/storage/scoped-storage.js +1 -1
- package/dist/storage/testing.js +1 -1
- package/dist/storage/turso.js +2 -2
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/web-extension.js +1 -1
- package/dist/worker/execute-with-interceptors.d.ts +1 -1
- package/dist/worker/execute-with-interceptors.js +2 -2
- package/dist/worker/index.js +5 -5
- package/dist/worker/long-poll.js +3 -4
- package/dist/worker/protocol-messages.d.ts +11 -19
- package/dist/worker/protocol-schemas.d.ts +8 -8
- package/dist/worker/protocol-schemas.js +4 -4
- package/dist/worker/protocol-task-result.d.ts +1 -0
- package/dist/worker/protocol-task-result.js +1 -3
- package/dist/worker/protocol.js +1 -1
- package/dist/worker/registry/types.d.ts +2 -7
- package/dist/worker/registry.d.ts +3 -9
- package/dist/worker/registry.js +2 -5
- package/package.json +5 -1
|
@@ -1,46 +1,46 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import type {
|
|
2
|
+
import type { BulkOperationCommitOptions, BulkOperationDryRunOptions, ListFilter, WorkflowStatus } from '../../core/types.ts';
|
|
3
3
|
import type { OperationFault } from '../operation-fault.ts';
|
|
4
4
|
import type { Principal } from '../principal.ts';
|
|
5
5
|
import type { RestInputContext } from '../rest-binding.ts';
|
|
6
6
|
export declare const bulkListFilterInputSchema: z.ZodObject<{
|
|
7
|
-
status: z.ZodOptional<z.ZodUnion<readonly [z.
|
|
7
|
+
status: z.ZodOptional<z.ZodUnion<readonly [z.ZodType<WorkflowStatus, unknown, z.core.$ZodTypeInternals<WorkflowStatus, unknown>>, z.ZodArray<z.ZodType<WorkflowStatus, unknown, z.core.$ZodTypeInternals<WorkflowStatus, unknown>>>]>>;
|
|
8
8
|
type: z.ZodOptional<z.ZodString>;
|
|
9
9
|
scheduleId: z.ZodOptional<z.ZodString>;
|
|
10
10
|
parentWorkflowId: z.ZodOptional<z.ZodString>;
|
|
11
11
|
parentWorkflowExecutionToken: z.ZodOptional<z.ZodString>;
|
|
12
12
|
tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
13
13
|
attributes: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
14
|
-
key: z.ZodString
|
|
15
|
-
value: z.ZodOptional<z.
|
|
16
|
-
gt: z.ZodOptional<z.
|
|
17
|
-
lt: z.ZodOptional<z.
|
|
18
|
-
gte: z.ZodOptional<z.
|
|
19
|
-
lte: z.ZodOptional<z.
|
|
14
|
+
key: z.ZodUnion<readonly [z.ZodString, z.ZodAny]>;
|
|
15
|
+
value: z.ZodOptional<z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>;
|
|
16
|
+
gt: z.ZodOptional<z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>;
|
|
17
|
+
lt: z.ZodOptional<z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>;
|
|
18
|
+
gte: z.ZodOptional<z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>;
|
|
19
|
+
lte: z.ZodOptional<z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>;
|
|
20
20
|
}, z.core.$strip>>>;
|
|
21
|
-
limit: z.ZodOptional<z.ZodNumber>;
|
|
22
21
|
offset: z.ZodOptional<z.ZodNumber>;
|
|
23
22
|
idPrefix: z.ZodOptional<z.ZodString>;
|
|
24
|
-
failureCategory: z.ZodOptional<z.ZodUnion<readonly [z.ZodCustom<FailureCategory, FailureCategory>, z.ZodArray<z.ZodCustom<FailureCategory, FailureCategory>>]>>;
|
|
25
23
|
createdAt: z.ZodOptional<z.ZodObject<{
|
|
26
24
|
gte: z.ZodOptional<z.ZodNumber>;
|
|
27
|
-
gt: z.ZodOptional<z.ZodNumber>;
|
|
28
25
|
lte: z.ZodOptional<z.ZodNumber>;
|
|
26
|
+
gt: z.ZodOptional<z.ZodNumber>;
|
|
29
27
|
lt: z.ZodOptional<z.ZodNumber>;
|
|
30
|
-
}, z.core.$
|
|
28
|
+
}, z.core.$strict>>;
|
|
31
29
|
updatedAt: z.ZodOptional<z.ZodObject<{
|
|
32
30
|
gte: z.ZodOptional<z.ZodNumber>;
|
|
33
|
-
gt: z.ZodOptional<z.ZodNumber>;
|
|
34
31
|
lte: z.ZodOptional<z.ZodNumber>;
|
|
32
|
+
gt: z.ZodOptional<z.ZodNumber>;
|
|
35
33
|
lt: z.ZodOptional<z.ZodNumber>;
|
|
36
|
-
}, z.core.$
|
|
34
|
+
}, z.core.$strict>>;
|
|
37
35
|
executionDeadline: z.ZodOptional<z.ZodObject<{
|
|
38
36
|
gte: z.ZodOptional<z.ZodNumber>;
|
|
39
|
-
gt: z.ZodOptional<z.ZodNumber>;
|
|
40
37
|
lte: z.ZodOptional<z.ZodNumber>;
|
|
38
|
+
gt: z.ZodOptional<z.ZodNumber>;
|
|
41
39
|
lt: z.ZodOptional<z.ZodNumber>;
|
|
42
|
-
}, z.core.$
|
|
43
|
-
|
|
40
|
+
}, z.core.$strict>>;
|
|
41
|
+
failureCategory: z.ZodOptional<z.ZodUnion<readonly [z.ZodType<import("../../index.ts").FailureCategory, unknown, z.core.$ZodTypeInternals<import("../../index.ts").FailureCategory, unknown>>, z.ZodArray<z.ZodType<import("../../index.ts").FailureCategory, unknown, z.core.$ZodTypeInternals<import("../../index.ts").FailureCategory, unknown>>>]>>;
|
|
42
|
+
limit: z.ZodOptional<z.ZodNumber>;
|
|
43
|
+
}, z.core.$strict>;
|
|
44
44
|
export type BulkListFilterInput = z.infer<typeof bulkListFilterInputSchema>;
|
|
45
45
|
export declare const bulkOperationControlInputSchema: z.ZodObject<{
|
|
46
46
|
dryRun: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { assertScopedBulkWorkflowFilter } from "../../core/bulk-workflow-filter.js";
|
|
3
|
-
import {
|
|
3
|
+
import { listFilterObjectSchema, normalizeListFilter } from "../../core/list-filter-validation.js";
|
|
4
4
|
import { coerceStartWorkflowTags } from "../../core/start-workflow-validation.js";
|
|
5
5
|
import {
|
|
6
6
|
MAX_BULK_CONFIRMATION_TOKEN_LENGTH,
|
|
@@ -9,38 +9,8 @@ import {
|
|
|
9
9
|
import { readRestTextBody } from "../rest-body.js";
|
|
10
10
|
import { parseOptionalFailureCategoryFilter } from "./failure-category-filter.js";
|
|
11
11
|
import { invalidParamsFault, isOperationFault } from "./operation-helpers.js";
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
return !0;
|
|
15
|
-
return Array.isArray(value) && value.every((entry) => typeof entry === "string" || typeof entry === "number" || typeof entry === "boolean");
|
|
16
|
-
}), attributeFilterScalarValueSchema = z.custom((value) => typeof value === "string" || typeof value === "number" || typeof value === "boolean"), attributeFilterSchema = z.object({
|
|
17
|
-
key: z.string().min(1),
|
|
18
|
-
value: searchAttributeValueSchema.optional(),
|
|
19
|
-
gt: attributeFilterScalarValueSchema.optional(),
|
|
20
|
-
lt: attributeFilterScalarValueSchema.optional(),
|
|
21
|
-
gte: attributeFilterScalarValueSchema.optional(),
|
|
22
|
-
lte: attributeFilterScalarValueSchema.optional()
|
|
23
|
-
}), failureCategorySchema = z.custom(isFailureCategory), timeRangeSchema = z.object({
|
|
24
|
-
gte: z.number().optional(),
|
|
25
|
-
gt: z.number().optional(),
|
|
26
|
-
lte: z.number().optional(),
|
|
27
|
-
lt: z.number().optional()
|
|
28
|
-
});
|
|
29
|
-
export const bulkListFilterInputSchema = z.object({
|
|
30
|
-
status: z.union([workflowStatusSchema, z.array(workflowStatusSchema)]).optional(),
|
|
31
|
-
type: z.string().optional(),
|
|
32
|
-
scheduleId: z.string().min(1).optional(),
|
|
33
|
-
parentWorkflowId: z.string().min(1).optional(),
|
|
34
|
-
parentWorkflowExecutionToken: z.string().min(1).optional(),
|
|
35
|
-
tags: z.array(z.string()).optional(),
|
|
36
|
-
attributes: z.array(attributeFilterSchema).optional(),
|
|
37
|
-
limit: z.number().int().min(0).optional(),
|
|
38
|
-
offset: z.number().int().min(0).optional(),
|
|
39
|
-
idPrefix: z.string().optional(),
|
|
40
|
-
failureCategory: z.union([failureCategorySchema, z.array(failureCategorySchema)]).optional(),
|
|
41
|
-
createdAt: timeRangeSchema.optional(),
|
|
42
|
-
updatedAt: timeRangeSchema.optional(),
|
|
43
|
-
executionDeadline: timeRangeSchema.optional()
|
|
12
|
+
export const bulkListFilterInputSchema = listFilterObjectSchema.extend({
|
|
13
|
+
limit: z.number().int().min(0).optional()
|
|
44
14
|
}), bulkOperationControlInputSchema = z.object({
|
|
45
15
|
dryRun: z.boolean().optional(),
|
|
46
16
|
confirmationToken: z.string().min(1).max(MAX_BULK_CONFIRMATION_TOKEN_LENGTH).optional(),
|
|
@@ -223,7 +193,7 @@ export function parseBulkListFilterFromBody(body) {
|
|
|
223
193
|
const filterRecord = rawFilter, filter = {};
|
|
224
194
|
for (const applyDimension of BULK_FILTER_DIMENSION_PARSERS)
|
|
225
195
|
applyDimension(filter, filterRecord);
|
|
226
|
-
return filter;
|
|
196
|
+
return normalizeBulkListFilter(filter);
|
|
227
197
|
}
|
|
228
198
|
const TIME_RANGE_BOUNDS = ["gte", "gt", "lte", "lt"];
|
|
229
199
|
function parseOptionalTimeRange(value) {
|
|
@@ -254,7 +224,13 @@ export function listFilterFromBulkInput(input) {
|
|
|
254
224
|
applyBasicBulkFilterFields(filter, input);
|
|
255
225
|
applyExtendedBulkFilterFields(filter, input);
|
|
256
226
|
applyBulkTimeRangeFields(filter, input);
|
|
257
|
-
return filter;
|
|
227
|
+
return normalizeBulkListFilter(filter);
|
|
228
|
+
}
|
|
229
|
+
function normalizeBulkListFilter(filter) {
|
|
230
|
+
const limit = filter.limit;
|
|
231
|
+
delete filter.limit;
|
|
232
|
+
const normalized = normalizeListFilter(filter);
|
|
233
|
+
return limit === void 0 ? normalized : { ...normalized, limit };
|
|
258
234
|
}
|
|
259
235
|
function applyBasicBulkFilterFields(filter, input) {
|
|
260
236
|
if (input.status !== void 0)
|
|
@@ -272,8 +248,11 @@ function applyBasicBulkFilterFields(filter, input) {
|
|
|
272
248
|
}
|
|
273
249
|
function copyAttributeFilter(attribute) {
|
|
274
250
|
const filter = { key: attribute.key };
|
|
275
|
-
if (attribute.value !== void 0)
|
|
251
|
+
if (attribute.value !== void 0) {
|
|
252
|
+
if (!isJsonSearchAttributeValue(attribute.value))
|
|
253
|
+
throw Error('Field "filter.attributes[].value" must be a string, number, boolean, or scalar array');
|
|
276
254
|
filter.value = attribute.value;
|
|
255
|
+
}
|
|
277
256
|
if (attribute.gt !== void 0)
|
|
278
257
|
filter.gt = copyAttributeRangeBound(attribute.gt, "gt");
|
|
279
258
|
if (attribute.lt !== void 0)
|
|
@@ -285,7 +264,7 @@ function copyAttributeFilter(attribute) {
|
|
|
285
264
|
return filter;
|
|
286
265
|
}
|
|
287
266
|
function copyAttributeRangeBound(value, property) {
|
|
288
|
-
if (Array.isArray(value))
|
|
267
|
+
if (!isJsonSearchAttributeValue(value) || Array.isArray(value))
|
|
289
268
|
throw Error(`Field "filter.attributes[].${property}" must be a string, number, or boolean`);
|
|
290
269
|
return value;
|
|
291
270
|
}
|
|
@@ -3,43 +3,43 @@ import type { BulkOperationDryRunResult, BulkTagResult } from '../../core/types.
|
|
|
3
3
|
import type { UnknownRestBinding } from '../rest-bindings.ts';
|
|
4
4
|
declare const bulkMutateWorkflowTagsInput: z.ZodObject<{
|
|
5
5
|
filter: z.ZodOptional<z.ZodObject<{
|
|
6
|
-
status: z.ZodOptional<z.ZodUnion<readonly [z.
|
|
6
|
+
status: z.ZodOptional<z.ZodUnion<readonly [z.ZodType<import("../../index.ts").WorkflowStatus, unknown, z.core.$ZodTypeInternals<import("../../index.ts").WorkflowStatus, unknown>>, z.ZodArray<z.ZodType<import("../../index.ts").WorkflowStatus, unknown, z.core.$ZodTypeInternals<import("../../index.ts").WorkflowStatus, unknown>>>]>>;
|
|
7
7
|
type: z.ZodOptional<z.ZodString>;
|
|
8
8
|
scheduleId: z.ZodOptional<z.ZodString>;
|
|
9
9
|
parentWorkflowId: z.ZodOptional<z.ZodString>;
|
|
10
10
|
parentWorkflowExecutionToken: z.ZodOptional<z.ZodString>;
|
|
11
11
|
tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
12
12
|
attributes: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
13
|
-
key: z.ZodString
|
|
14
|
-
value: z.ZodOptional<z.
|
|
15
|
-
gt: z.ZodOptional<z.
|
|
16
|
-
lt: z.ZodOptional<z.
|
|
17
|
-
gte: z.ZodOptional<z.
|
|
18
|
-
lte: z.ZodOptional<z.
|
|
13
|
+
key: z.ZodUnion<readonly [z.ZodString, z.ZodAny]>;
|
|
14
|
+
value: z.ZodOptional<z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>;
|
|
15
|
+
gt: z.ZodOptional<z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>;
|
|
16
|
+
lt: z.ZodOptional<z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>;
|
|
17
|
+
gte: z.ZodOptional<z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>;
|
|
18
|
+
lte: z.ZodOptional<z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>;
|
|
19
19
|
}, z.core.$strip>>>;
|
|
20
|
-
limit: z.ZodOptional<z.ZodNumber>;
|
|
21
20
|
offset: z.ZodOptional<z.ZodNumber>;
|
|
22
21
|
idPrefix: z.ZodOptional<z.ZodString>;
|
|
23
|
-
failureCategory: z.ZodOptional<z.ZodUnion<readonly [z.ZodCustom<import("../../index.ts").FailureCategory, import("../../index.ts").FailureCategory>, z.ZodArray<z.ZodCustom<import("../../index.ts").FailureCategory, import("../../index.ts").FailureCategory>>]>>;
|
|
24
22
|
createdAt: z.ZodOptional<z.ZodObject<{
|
|
25
23
|
gte: z.ZodOptional<z.ZodNumber>;
|
|
26
|
-
gt: z.ZodOptional<z.ZodNumber>;
|
|
27
24
|
lte: z.ZodOptional<z.ZodNumber>;
|
|
25
|
+
gt: z.ZodOptional<z.ZodNumber>;
|
|
28
26
|
lt: z.ZodOptional<z.ZodNumber>;
|
|
29
|
-
}, z.core.$
|
|
27
|
+
}, z.core.$strict>>;
|
|
30
28
|
updatedAt: z.ZodOptional<z.ZodObject<{
|
|
31
29
|
gte: z.ZodOptional<z.ZodNumber>;
|
|
32
|
-
gt: z.ZodOptional<z.ZodNumber>;
|
|
33
30
|
lte: z.ZodOptional<z.ZodNumber>;
|
|
31
|
+
gt: z.ZodOptional<z.ZodNumber>;
|
|
34
32
|
lt: z.ZodOptional<z.ZodNumber>;
|
|
35
|
-
}, z.core.$
|
|
33
|
+
}, z.core.$strict>>;
|
|
36
34
|
executionDeadline: z.ZodOptional<z.ZodObject<{
|
|
37
35
|
gte: z.ZodOptional<z.ZodNumber>;
|
|
38
|
-
gt: z.ZodOptional<z.ZodNumber>;
|
|
39
36
|
lte: z.ZodOptional<z.ZodNumber>;
|
|
37
|
+
gt: z.ZodOptional<z.ZodNumber>;
|
|
40
38
|
lt: z.ZodOptional<z.ZodNumber>;
|
|
41
|
-
}, z.core.$
|
|
42
|
-
|
|
39
|
+
}, z.core.$strict>>;
|
|
40
|
+
failureCategory: z.ZodOptional<z.ZodUnion<readonly [z.ZodType<import("../../index.ts").FailureCategory, unknown, z.core.$ZodTypeInternals<import("../../index.ts").FailureCategory, unknown>>, z.ZodArray<z.ZodType<import("../../index.ts").FailureCategory, unknown, z.core.$ZodTypeInternals<import("../../index.ts").FailureCategory, unknown>>>]>>;
|
|
41
|
+
limit: z.ZodOptional<z.ZodNumber>;
|
|
42
|
+
}, z.core.$strict>>;
|
|
43
43
|
tags: z.ZodArray<z.ZodString>;
|
|
44
44
|
operation: z.ZodEnum<{
|
|
45
45
|
add: "add";
|
|
@@ -63,35 +63,35 @@ export declare const bulkMutateWorkflowTagsOperation: import("../operation-catal
|
|
|
63
63
|
parentWorkflowExecutionToken?: string | undefined;
|
|
64
64
|
tags?: string[] | undefined;
|
|
65
65
|
attributes?: {
|
|
66
|
-
key:
|
|
67
|
-
value?:
|
|
68
|
-
gt?:
|
|
69
|
-
lt?:
|
|
70
|
-
gte?:
|
|
71
|
-
lte?:
|
|
66
|
+
key: any;
|
|
67
|
+
value?: unknown;
|
|
68
|
+
gt?: unknown;
|
|
69
|
+
lt?: unknown;
|
|
70
|
+
gte?: unknown;
|
|
71
|
+
lte?: unknown;
|
|
72
72
|
}[] | undefined;
|
|
73
|
-
limit?: number | undefined;
|
|
74
73
|
offset?: number | undefined;
|
|
75
74
|
idPrefix?: string | undefined;
|
|
76
|
-
failureCategory?: import("../../index.ts").FailureCategory | import("../../index.ts").FailureCategory[] | undefined;
|
|
77
75
|
createdAt?: {
|
|
78
76
|
gte?: number | undefined;
|
|
79
|
-
gt?: number | undefined;
|
|
80
77
|
lte?: number | undefined;
|
|
78
|
+
gt?: number | undefined;
|
|
81
79
|
lt?: number | undefined;
|
|
82
80
|
} | undefined;
|
|
83
81
|
updatedAt?: {
|
|
84
82
|
gte?: number | undefined;
|
|
85
|
-
gt?: number | undefined;
|
|
86
83
|
lte?: number | undefined;
|
|
84
|
+
gt?: number | undefined;
|
|
87
85
|
lt?: number | undefined;
|
|
88
86
|
} | undefined;
|
|
89
87
|
executionDeadline?: {
|
|
90
88
|
gte?: number | undefined;
|
|
91
|
-
gt?: number | undefined;
|
|
92
89
|
lte?: number | undefined;
|
|
90
|
+
gt?: number | undefined;
|
|
93
91
|
lt?: number | undefined;
|
|
94
92
|
} | undefined;
|
|
93
|
+
failureCategory?: import("../../index.ts").FailureCategory | import("../../index.ts").FailureCategory[] | undefined;
|
|
94
|
+
limit?: number | undefined;
|
|
95
95
|
} | undefined;
|
|
96
96
|
dryRun?: boolean | undefined;
|
|
97
97
|
confirmationToken?: string | undefined;
|
|
@@ -2,42 +2,42 @@ import { z } from 'zod';
|
|
|
2
2
|
import type { BulkOperationDryRunResult, BulkSignalResult } from '../../core/types.ts';
|
|
3
3
|
import type { UnknownRestBinding } from '../rest-bindings.ts';
|
|
4
4
|
declare const bulkSignalWorkflowsInput: z.ZodObject<{
|
|
5
|
-
status: z.ZodOptional<z.ZodUnion<readonly [z.
|
|
5
|
+
status: z.ZodOptional<z.ZodUnion<readonly [z.ZodType<import("../../index.ts").WorkflowStatus, unknown, z.core.$ZodTypeInternals<import("../../index.ts").WorkflowStatus, unknown>>, z.ZodArray<z.ZodType<import("../../index.ts").WorkflowStatus, unknown, z.core.$ZodTypeInternals<import("../../index.ts").WorkflowStatus, unknown>>>]>>;
|
|
6
6
|
type: z.ZodOptional<z.ZodString>;
|
|
7
7
|
scheduleId: z.ZodOptional<z.ZodString>;
|
|
8
8
|
parentWorkflowId: z.ZodOptional<z.ZodString>;
|
|
9
9
|
parentWorkflowExecutionToken: z.ZodOptional<z.ZodString>;
|
|
10
10
|
tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
11
11
|
attributes: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
12
|
-
key: z.ZodString
|
|
13
|
-
value: z.ZodOptional<z.
|
|
14
|
-
gt: z.ZodOptional<z.
|
|
15
|
-
lt: z.ZodOptional<z.
|
|
16
|
-
gte: z.ZodOptional<z.
|
|
17
|
-
lte: z.ZodOptional<z.
|
|
12
|
+
key: z.ZodUnion<readonly [z.ZodString, z.ZodAny]>;
|
|
13
|
+
value: z.ZodOptional<z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>;
|
|
14
|
+
gt: z.ZodOptional<z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>;
|
|
15
|
+
lt: z.ZodOptional<z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>;
|
|
16
|
+
gte: z.ZodOptional<z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>;
|
|
17
|
+
lte: z.ZodOptional<z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>;
|
|
18
18
|
}, z.core.$strip>>>;
|
|
19
|
-
limit: z.ZodOptional<z.ZodNumber>;
|
|
20
19
|
offset: z.ZodOptional<z.ZodNumber>;
|
|
21
20
|
idPrefix: z.ZodOptional<z.ZodString>;
|
|
22
|
-
failureCategory: z.ZodOptional<z.ZodUnion<readonly [z.ZodCustom<import("../../index.ts").FailureCategory, import("../../index.ts").FailureCategory>, z.ZodArray<z.ZodCustom<import("../../index.ts").FailureCategory, import("../../index.ts").FailureCategory>>]>>;
|
|
23
21
|
createdAt: z.ZodOptional<z.ZodObject<{
|
|
24
22
|
gte: z.ZodOptional<z.ZodNumber>;
|
|
25
|
-
gt: z.ZodOptional<z.ZodNumber>;
|
|
26
23
|
lte: z.ZodOptional<z.ZodNumber>;
|
|
24
|
+
gt: z.ZodOptional<z.ZodNumber>;
|
|
27
25
|
lt: z.ZodOptional<z.ZodNumber>;
|
|
28
|
-
}, z.core.$
|
|
26
|
+
}, z.core.$strict>>;
|
|
29
27
|
updatedAt: z.ZodOptional<z.ZodObject<{
|
|
30
28
|
gte: z.ZodOptional<z.ZodNumber>;
|
|
31
|
-
gt: z.ZodOptional<z.ZodNumber>;
|
|
32
29
|
lte: z.ZodOptional<z.ZodNumber>;
|
|
30
|
+
gt: z.ZodOptional<z.ZodNumber>;
|
|
33
31
|
lt: z.ZodOptional<z.ZodNumber>;
|
|
34
|
-
}, z.core.$
|
|
32
|
+
}, z.core.$strict>>;
|
|
35
33
|
executionDeadline: z.ZodOptional<z.ZodObject<{
|
|
36
34
|
gte: z.ZodOptional<z.ZodNumber>;
|
|
37
|
-
gt: z.ZodOptional<z.ZodNumber>;
|
|
38
35
|
lte: z.ZodOptional<z.ZodNumber>;
|
|
36
|
+
gt: z.ZodOptional<z.ZodNumber>;
|
|
39
37
|
lt: z.ZodOptional<z.ZodNumber>;
|
|
40
|
-
}, z.core.$
|
|
38
|
+
}, z.core.$strict>>;
|
|
39
|
+
failureCategory: z.ZodOptional<z.ZodUnion<readonly [z.ZodType<import("../../index.ts").FailureCategory, unknown, z.core.$ZodTypeInternals<import("../../index.ts").FailureCategory, unknown>>, z.ZodArray<z.ZodType<import("../../index.ts").FailureCategory, unknown, z.core.$ZodTypeInternals<import("../../index.ts").FailureCategory, unknown>>>]>>;
|
|
40
|
+
limit: z.ZodOptional<z.ZodNumber>;
|
|
41
41
|
name: z.ZodString;
|
|
42
42
|
payload: z.ZodOptional<z.ZodUnknown>;
|
|
43
43
|
dryRun: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -56,35 +56,35 @@ export declare const bulkSignalWorkflowsOperation: import("../operation-catalog.
|
|
|
56
56
|
parentWorkflowExecutionToken?: string | undefined;
|
|
57
57
|
tags?: string[] | undefined;
|
|
58
58
|
attributes?: {
|
|
59
|
-
key:
|
|
60
|
-
value?:
|
|
61
|
-
gt?:
|
|
62
|
-
lt?:
|
|
63
|
-
gte?:
|
|
64
|
-
lte?:
|
|
59
|
+
key: any;
|
|
60
|
+
value?: unknown;
|
|
61
|
+
gt?: unknown;
|
|
62
|
+
lt?: unknown;
|
|
63
|
+
gte?: unknown;
|
|
64
|
+
lte?: unknown;
|
|
65
65
|
}[] | undefined;
|
|
66
|
-
limit?: number | undefined;
|
|
67
66
|
offset?: number | undefined;
|
|
68
67
|
idPrefix?: string | undefined;
|
|
69
|
-
failureCategory?: import("../../index.ts").FailureCategory | import("../../index.ts").FailureCategory[] | undefined;
|
|
70
68
|
createdAt?: {
|
|
71
69
|
gte?: number | undefined;
|
|
72
|
-
gt?: number | undefined;
|
|
73
70
|
lte?: number | undefined;
|
|
71
|
+
gt?: number | undefined;
|
|
74
72
|
lt?: number | undefined;
|
|
75
73
|
} | undefined;
|
|
76
74
|
updatedAt?: {
|
|
77
75
|
gte?: number | undefined;
|
|
78
|
-
gt?: number | undefined;
|
|
79
76
|
lte?: number | undefined;
|
|
77
|
+
gt?: number | undefined;
|
|
80
78
|
lt?: number | undefined;
|
|
81
79
|
} | undefined;
|
|
82
80
|
executionDeadline?: {
|
|
83
81
|
gte?: number | undefined;
|
|
84
|
-
gt?: number | undefined;
|
|
85
82
|
lte?: number | undefined;
|
|
83
|
+
gt?: number | undefined;
|
|
86
84
|
lt?: number | undefined;
|
|
87
85
|
} | undefined;
|
|
86
|
+
failureCategory?: import("../../index.ts").FailureCategory | import("../../index.ts").FailureCategory[] | undefined;
|
|
87
|
+
limit?: number | undefined;
|
|
88
88
|
payload?: unknown;
|
|
89
89
|
dryRun?: boolean | undefined;
|
|
90
90
|
confirmationToken?: string | undefined;
|
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { defineOperation } from "../operation-registry.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
3
|
+
import { invalidParamsFault, shapeRestFault } from "./operation-helpers.js";
|
|
4
|
+
import {
|
|
5
|
+
mapScheduleErrorToFault,
|
|
6
|
+
validateScheduleInputCadence,
|
|
7
|
+
validateScheduleMutableOptions
|
|
8
|
+
} from "./schedule-faults.js";
|
|
9
|
+
import {
|
|
10
|
+
extractSharedScheduleRestFields,
|
|
11
|
+
parseScheduleRestBodyRequestRecord
|
|
12
|
+
} from "./schedule-rest-body.js";
|
|
13
|
+
const createScheduleInput = z.object({
|
|
12
14
|
type: z.unknown().describe("Workflow type name. Runtime validation requires a non-empty string."),
|
|
13
15
|
cronExpression: z.unknown().optional().describe("Cron expression. Supply exactly one of cronExpression or every; runtime validation requires a non-empty string."),
|
|
14
16
|
every: z.unknown().optional().describe("Interval period (duration string or milliseconds). Supply exactly one of cronExpression or every."),
|
|
@@ -26,43 +28,21 @@ function validateRequiredScheduleFields(input) {
|
|
|
26
28
|
throw invalidParamsFault("Missing required field: type");
|
|
27
29
|
return { type: input.type, spec: validateScheduleInputCadence(input) };
|
|
28
30
|
}
|
|
31
|
+
function validateScheduleId(value) {
|
|
32
|
+
if (value === void 0)
|
|
33
|
+
return;
|
|
34
|
+
if (typeof value !== "string" || value.length === 0)
|
|
35
|
+
throw invalidParamsFault('Field "id" must be a non-empty string');
|
|
36
|
+
return value;
|
|
37
|
+
}
|
|
29
38
|
function validateOptionalScheduleFields(input) {
|
|
30
|
-
|
|
31
|
-
if (input.id !== void 0) {
|
|
32
|
-
if (typeof input.id !== "string" || input.id.length === 0)
|
|
33
|
-
throw invalidParamsFault('Field "id" must be a non-empty string');
|
|
34
|
-
validatedId = input.id;
|
|
35
|
-
}
|
|
36
|
-
let validatedDescription;
|
|
37
|
-
if (input.description !== void 0) {
|
|
38
|
-
if (typeof input.description !== "string")
|
|
39
|
-
throw invalidParamsFault('Field "description" must be a string');
|
|
40
|
-
validatedDescription = input.description;
|
|
41
|
-
}
|
|
42
|
-
let validatedOverlap;
|
|
43
|
-
if (input.overlap !== void 0) {
|
|
44
|
-
if (typeof input.overlap !== "string" || !isScheduleOverlapPolicy(input.overlap))
|
|
45
|
-
throw invalidParamsFault('Field "overlap" must be one of skip, queue, cancel-running, allow');
|
|
46
|
-
validatedOverlap = input.overlap;
|
|
47
|
-
}
|
|
48
|
-
let validatedBackfill;
|
|
49
|
-
if (input.backfill !== void 0) {
|
|
50
|
-
if (typeof input.backfill !== "boolean")
|
|
51
|
-
throw invalidParamsFault('Field "backfill" must be a boolean');
|
|
52
|
-
validatedBackfill = input.backfill;
|
|
53
|
-
}
|
|
54
|
-
let validatedJitter;
|
|
55
|
-
if (input.jitter !== void 0) {
|
|
56
|
-
if (typeof input.jitter !== "string" && typeof input.jitter !== "number")
|
|
57
|
-
throw invalidParamsFault('Field "jitter" must be a duration string or a number of milliseconds');
|
|
58
|
-
validatedJitter = input.jitter;
|
|
59
|
-
}
|
|
39
|
+
const validatedId = validateScheduleId(input.id), validatedOptions = validateScheduleMutableOptions(input);
|
|
60
40
|
return {
|
|
61
41
|
id: validatedId,
|
|
62
|
-
description:
|
|
63
|
-
overlap:
|
|
64
|
-
backfill:
|
|
65
|
-
jitter:
|
|
42
|
+
description: validatedOptions.description,
|
|
43
|
+
overlap: validatedOptions.overlap,
|
|
44
|
+
backfill: validatedOptions.backfill,
|
|
45
|
+
jitter: validatedOptions.jitter
|
|
66
46
|
};
|
|
67
47
|
}
|
|
68
48
|
function validateCreateScheduleInput(input) {
|
|
@@ -96,11 +76,7 @@ export const createScheduleOperation = defineOperation({
|
|
|
96
76
|
throw mapScheduleErrorToFault(validated.id ?? "", error);
|
|
97
77
|
}
|
|
98
78
|
}
|
|
99
|
-
})
|
|
100
|
-
function isScheduleOverlapPolicy(value) {
|
|
101
|
-
return VALID_SCHEDULE_OVERLAP_POLICIES.has(value);
|
|
102
|
-
}
|
|
103
|
-
export const createScheduleRestBinding = {
|
|
79
|
+
}), createScheduleRestBinding = {
|
|
104
80
|
method: "POST",
|
|
105
81
|
path: "/v1/schedules",
|
|
106
82
|
pathParamNames: [],
|
|
@@ -117,27 +93,12 @@ export const createScheduleRestBinding = {
|
|
|
117
93
|
jitter: { kind: "body-field", bodyField: "jitter" }
|
|
118
94
|
},
|
|
119
95
|
extractInput: async (request, _pathParams, context) => {
|
|
120
|
-
|
|
121
|
-
try {
|
|
122
|
-
body = await readRestJsonBody(request, context);
|
|
123
|
-
} catch (error) {
|
|
124
|
-
if (isOperationFault(error))
|
|
125
|
-
throw error;
|
|
126
|
-
throw invalidParamsFault("Invalid JSON body");
|
|
127
|
-
}
|
|
128
|
-
if (typeof body !== "object" || body === null)
|
|
129
|
-
throw invalidParamsFault("Request body must be a JSON object");
|
|
130
|
-
const record = body;
|
|
96
|
+
const record = await parseScheduleRestBodyRequestRecord(request, context);
|
|
131
97
|
return {
|
|
132
98
|
type: record.type,
|
|
133
|
-
cronExpression: Object.hasOwn(record, "cronExpression") ? record.cronExpression : void 0,
|
|
134
|
-
every: Object.hasOwn(record, "every") ? record.every : void 0,
|
|
135
99
|
input: record.input,
|
|
136
100
|
id: record.id,
|
|
137
|
-
|
|
138
|
-
overlap: record.overlap,
|
|
139
|
-
backfill: record.backfill,
|
|
140
|
-
jitter: record.jitter
|
|
101
|
+
...extractSharedScheduleRestFields(record)
|
|
141
102
|
};
|
|
142
103
|
},
|
|
143
104
|
success: { kind: "json", status: 201 },
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import type { FleetEventEnvelope } from '../fleet-event-feed.ts';
|
|
3
|
+
import type { ParameterizedAccessHint } from '../operation-catalog/types.ts';
|
|
4
|
+
import type { EventEnvelope } from '../workflow-event-feed.ts';
|
|
5
|
+
export declare const fleetEventEnvelopeSchema: z.ZodType<FleetEventEnvelope>;
|
|
6
|
+
export declare const workflowEventEnvelopeSchema: z.ZodType<EventEnvelope>;
|
|
7
|
+
export declare const workflowEventParameterizedAccess: ParameterizedAccessHint;
|
|
8
|
+
export type ClosableAsyncIterable<T> = AsyncIterable<T> & {
|
|
9
|
+
close(): Promise<void>;
|
|
10
|
+
};
|
|
11
|
+
export type ReplayAwareClosableIterable<T> = ClosableAsyncIterable<T> & {
|
|
12
|
+
readonly replayComplete: Promise<void>;
|
|
13
|
+
};
|
|
14
|
+
type ReplayAwareClosableIterableOptions = {
|
|
15
|
+
readonly close: () => void | Promise<void>;
|
|
16
|
+
};
|
|
17
|
+
export declare function createReplayAwareClosableIterable<T>(createSource: (onReplayComplete: () => void) => AsyncIterable<T>, options: ReplayAwareClosableIterableOptions): ReplayAwareClosableIterable<T>;
|
|
18
|
+
export declare function isClosableAsyncIterable<T>(value: unknown): value is ClosableAsyncIterable<T>;
|
|
19
|
+
export declare function isReplayAwareClosableIterable<T>(value: unknown): value is ReplayAwareClosableIterable<T>;
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export const fleetEventEnvelopeSchema = z.object({
|
|
3
|
+
kind: z.string(),
|
|
4
|
+
workflowId: z.string().optional(),
|
|
5
|
+
sequence: z.number(),
|
|
6
|
+
cursor: z.string(),
|
|
7
|
+
emittedAtMs: z.number(),
|
|
8
|
+
payload: z.unknown()
|
|
9
|
+
}), workflowEventEnvelopeSchema = z.object({
|
|
10
|
+
kind: z.string(),
|
|
11
|
+
workflowId: z.string(),
|
|
12
|
+
selector: z.enum(["events", "tokens"]),
|
|
13
|
+
sequence: z.number(),
|
|
14
|
+
cursor: z.string(),
|
|
15
|
+
emittedAtMs: z.number(),
|
|
16
|
+
payload: z.unknown()
|
|
17
|
+
}), workflowEventParameterizedAccess = {
|
|
18
|
+
discriminator: "selector",
|
|
19
|
+
defaultValue: "events",
|
|
20
|
+
variants: [
|
|
21
|
+
{
|
|
22
|
+
value: "events",
|
|
23
|
+
access: { kind: "scoped", scopes: { kind: "anyOf", scopes: ["events:read"] } }
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
value: "tokens",
|
|
27
|
+
access: { kind: "scoped", scopes: { kind: "anyOf", scopes: ["streams:read"] } }
|
|
28
|
+
}
|
|
29
|
+
]
|
|
30
|
+
};
|
|
31
|
+
export function createReplayAwareClosableIterable(createSource, options) {
|
|
32
|
+
const replayComplete = Promise.withResolvers();
|
|
33
|
+
let closePromise;
|
|
34
|
+
const close = () => {
|
|
35
|
+
if (closePromise !== void 0)
|
|
36
|
+
return closePromise;
|
|
37
|
+
closePromise = Promise.resolve().then(options.close);
|
|
38
|
+
return closePromise;
|
|
39
|
+
};
|
|
40
|
+
let source;
|
|
41
|
+
try {
|
|
42
|
+
source = createSource(() => replayComplete.resolve());
|
|
43
|
+
} catch (error) {
|
|
44
|
+
close();
|
|
45
|
+
throw error;
|
|
46
|
+
}
|
|
47
|
+
return {
|
|
48
|
+
async* [Symbol.asyncIterator]() {
|
|
49
|
+
try {
|
|
50
|
+
for await (const value of source)
|
|
51
|
+
yield value;
|
|
52
|
+
} finally {
|
|
53
|
+
await close();
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
replayComplete: replayComplete.promise,
|
|
57
|
+
close
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
export function isClosableAsyncIterable(value) {
|
|
61
|
+
if (typeof value !== "object" || value === null)
|
|
62
|
+
return !1;
|
|
63
|
+
return typeof value.close === "function";
|
|
64
|
+
}
|
|
65
|
+
export function isReplayAwareClosableIterable(value) {
|
|
66
|
+
return isClosableAsyncIterable(value) && "replayComplete" in value && value.replayComplete instanceof Promise;
|
|
67
|
+
}
|