@oomol-lab/open-flow 0.1.0-beta.78 → 0.1.0-beta.79
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/dist/browser/{createResourceDialog-DCGxfKFM.js → createResourceDialog-DkovGogv.js} +2 -2
- package/dist/browser/{dialog-WzR4CRFH.js → dialog-CFFuRM8s.js} +27 -6
- package/dist/browser/{flowChanges-Bz4dbDN_.js → flowChanges-CN2R-m1M.js} +59 -40
- package/dist/browser/{flowWorkspace-BI6L6a4r.js → flowWorkspace-CXVL1FNv.js} +85 -39
- package/dist/browser/preview.js +122 -48
- package/dist/browser/{typeScriptSession-CRoezJPN.js → typeScriptSession-CoEIptNC.js} +1 -1
- package/dist/browser/workbench.js +4 -4
- package/dist/browser/{workbenchSelect-DtAd0zc4.js → workbenchSelect-CkOS95gX.js} +1 -1
- package/dist/command/index.js +29 -29
- package/dist/common/control-api-conformance.js +80 -7
- package/dist/common/control-api.d.ts +3 -2
- package/dist/common/control-api.js +40 -7
- package/dist/common/control-requests.d.ts +5 -0
- package/dist/common/control-requests.js +28 -5
- package/dist/common/flow-authoring.js +26 -5
- package/dist/common/flow-change.js +26 -5
- package/dist/common/flow-encoding.js +26 -5
- package/dist/common/flow-semantics.js +26 -5
- package/dist/common/flow-state.d.ts +33 -4
- package/dist/common/flow-state.js +49 -6
- package/dist/common/mcp.d.ts +32 -1
- package/dist/common/mcp.js +40 -8
- package/dist/common/runtime-contract.d.ts +4 -1
- package/dist/common/runtime-contract.js +60 -5
- package/dist/common/scheduler.js +26 -5
- package/dist/index.d.ts +1 -0
- package/package.json +1 -1
- package/src/control/common/api.ts +16 -4
- package/src/control/common/conformance.ts +31 -0
- package/src/control/common/mcp.ts +7 -2
- package/src/control/common/requests.ts +3 -0
- package/src/runtime/common/runtime.ts +39 -5
- package/src/state/common/conformance.ts +16 -0
- package/src/state/common/state.ts +41 -8
- package/src/types/index.ts +1 -0
|
@@ -8628,13 +8628,24 @@ var httpRequestConfigSchema = strictObject({
|
|
|
8628
8628
|
statusPolicy: _enum(["success", "all"]).default("success")
|
|
8629
8629
|
});
|
|
8630
8630
|
var httpRequestExecutorSchema = httpRequestConfigSchema.extend({ kind: literal("http-request") });
|
|
8631
|
+
//#endregion
|
|
8632
|
+
//#region src/state/common/state.ts
|
|
8633
|
+
var stateReadLimits = {
|
|
8634
|
+
maxKeys: 16,
|
|
8635
|
+
maxBytes: 1048576
|
|
8636
|
+
};
|
|
8637
|
+
var keySchema = string$1().min(1).refine((value) => new TextEncoder().encode(value).length <= 256);
|
|
8638
|
+
strictObject({
|
|
8639
|
+
scope: _enum(["draft", "live"]),
|
|
8640
|
+
values: literal(false).optional()
|
|
8641
|
+
});
|
|
8631
8642
|
strictObject({
|
|
8632
8643
|
scope: _enum(["draft", "live"]),
|
|
8633
|
-
|
|
8644
|
+
keys: array(keySchema).min(1).max(stateReadLimits.maxKeys).refine((keys) => new Set(keys).size === keys.length, "State keys must be distinct.")
|
|
8634
8645
|
});
|
|
8635
8646
|
strictObject({
|
|
8636
8647
|
scope: _enum(["draft", "live"]),
|
|
8637
|
-
key:
|
|
8648
|
+
key: keySchema.optional()
|
|
8638
8649
|
});
|
|
8639
8650
|
strictObject({
|
|
8640
8651
|
scope: _enum(["draft", "live"]),
|
|
@@ -8652,11 +8663,10 @@ var flowStateViewSchema = object({
|
|
|
8652
8663
|
maxIdentities: number().positive(),
|
|
8653
8664
|
maxRunWrites: number().positive()
|
|
8654
8665
|
}),
|
|
8655
|
-
values: array(
|
|
8666
|
+
values: array(strictObject({
|
|
8656
8667
|
key: string$1(),
|
|
8657
8668
|
size: number().nonnegative(),
|
|
8658
|
-
updatedAt: number()
|
|
8659
|
-
value: json$4().optional()
|
|
8669
|
+
updatedAt: number()
|
|
8660
8670
|
})),
|
|
8661
8671
|
spaces: array(object({
|
|
8662
8672
|
space: string$1(),
|
|
@@ -8666,6 +8676,17 @@ var flowStateViewSchema = object({
|
|
|
8666
8676
|
updatedAt: number()
|
|
8667
8677
|
}))
|
|
8668
8678
|
});
|
|
8679
|
+
var flowStateValuesSchema = object({
|
|
8680
|
+
version: literal(1),
|
|
8681
|
+
scope: _enum(["draft", "live"]),
|
|
8682
|
+
values: array(strictObject({
|
|
8683
|
+
key: keySchema,
|
|
8684
|
+
value: json$4()
|
|
8685
|
+
})).min(1).max(stateReadLimits.maxKeys)
|
|
8686
|
+
}).refine((response) => {
|
|
8687
|
+
const encoder = new TextEncoder();
|
|
8688
|
+
return response.values.reduce((bytes, item) => bytes + (item.value === null ? 0 : encoder.encode(JSON.stringify(item.value)).byteLength), 0) <= stateReadLimits.maxBytes;
|
|
8689
|
+
}, "State values exceed the 1 MiB read limit.");
|
|
8669
8690
|
function checkJsonDepth(value, depth = 0) {
|
|
8670
8691
|
if (depth > 64) throw new TypeError("Value exceeds the maximum JSON depth.");
|
|
8671
8692
|
if (value != null && typeof value == "object") for (const child of Object.values(value)) checkJsonDepth(child, depth + 1);
|
|
@@ -12171,10 +12192,22 @@ var ControlClient = class {
|
|
|
12171
12192
|
})
|
|
12172
12193
|
}));
|
|
12173
12194
|
}
|
|
12174
|
-
async getFlowState(flowId, scope
|
|
12175
|
-
const result = flowStateViewSchema.safeParse(await this.request(`/v1/flows/${segment(flowId)}/state?scope=${scope}
|
|
12195
|
+
async getFlowState(flowId, scope) {
|
|
12196
|
+
const result = flowStateViewSchema.safeParse(await this.request(`/v1/flows/${segment(flowId)}/state?scope=${scope}`));
|
|
12176
12197
|
return result.success && result.data.scope === scope ? result.data : invalidResponse();
|
|
12177
12198
|
}
|
|
12199
|
+
async getFlowStateValues(flowId, scope, keys, signal) {
|
|
12200
|
+
const result = flowStateValuesSchema.safeParse(await this.request(`/v1/flows/${segment(flowId)}/state/read`, {
|
|
12201
|
+
method: "POST",
|
|
12202
|
+
body: JSON.stringify({
|
|
12203
|
+
version: 1,
|
|
12204
|
+
scope,
|
|
12205
|
+
keys
|
|
12206
|
+
}),
|
|
12207
|
+
signal
|
|
12208
|
+
}));
|
|
12209
|
+
return result.success && result.data.scope === scope && result.data.values.length === keys.length && result.data.values.every((item, index) => item.key === keys[index]) ? result.data : invalidResponse();
|
|
12210
|
+
}
|
|
12178
12211
|
async clearFlowState(flowId, scope, key) {
|
|
12179
12212
|
const source = record$1(await this.request(`/v1/flows/${segment(flowId)}/state?scope=${scope}${key == null ? "" : `&key=${encodeURIComponent(key)}`}`, { method: "DELETE" }));
|
|
12180
12213
|
if (source.version !== 1 || source.cleared !== true) invalidResponse();
|
|
@@ -12866,6 +12899,46 @@ function liveRunRequest(harness, publicationId, key) {
|
|
|
12866
12899
|
});
|
|
12867
12900
|
}
|
|
12868
12901
|
var controlApiConformanceCases = [
|
|
12902
|
+
{
|
|
12903
|
+
name: "reads State metadata and bounded explicit keys without scope-wide value retrieval",
|
|
12904
|
+
async verify(harness) {
|
|
12905
|
+
const api = new ControlClient((url, init) => harness.request(new Request(new URL(url, harness.origin), init)));
|
|
12906
|
+
const flow = await api.createFlow("State reads");
|
|
12907
|
+
equal((await api.getFlowState(flow.flowId, "draft")).values, [], "New Flow State metadata");
|
|
12908
|
+
equal(await api.getFlowStateValues(flow.flowId, "live", ["second", "first"]), {
|
|
12909
|
+
version: 1,
|
|
12910
|
+
scope: "live",
|
|
12911
|
+
values: [{
|
|
12912
|
+
key: "second",
|
|
12913
|
+
value: null
|
|
12914
|
+
}, {
|
|
12915
|
+
key: "first",
|
|
12916
|
+
value: null
|
|
12917
|
+
}]
|
|
12918
|
+
}, "Missing named State keys");
|
|
12919
|
+
const metadata = await request(harness, `/v1/flows/${flow.flowId}/state?scope=draft&values=false`);
|
|
12920
|
+
await json(metadata, 200, "Legacy metadata-only query");
|
|
12921
|
+
equal(metadata.headers.get("cache-control"), "no-store", "State metadata cache policy");
|
|
12922
|
+
await error(await request(harness, `/v1/flows/${flow.flowId}/state?scope=draft&values=true`), 400, "flow.invalid", "Scope-wide State values");
|
|
12923
|
+
for (const input of [
|
|
12924
|
+
{
|
|
12925
|
+
scope: "draft",
|
|
12926
|
+
keys: []
|
|
12927
|
+
},
|
|
12928
|
+
{ keys: ["key"] },
|
|
12929
|
+
{
|
|
12930
|
+
scope: "draft",
|
|
12931
|
+
keys: Array.from({ length: 17 }, (_, index) => String(index))
|
|
12932
|
+
}
|
|
12933
|
+
]) await error(await request(harness, `/v1/flows/${flow.flowId}/state/read`, {
|
|
12934
|
+
method: "POST",
|
|
12935
|
+
body: JSON.stringify({
|
|
12936
|
+
version: 1,
|
|
12937
|
+
...input
|
|
12938
|
+
})
|
|
12939
|
+
}), 400, "flow.invalid", "Invalid named State read");
|
|
12940
|
+
}
|
|
12941
|
+
},
|
|
12869
12942
|
{
|
|
12870
12943
|
name: "imports workflow files atomically and exports a new unpublished draft with its Presentation",
|
|
12871
12944
|
async verify(harness) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { CanvasCommand } from './canvas-commands.js';
|
|
2
|
-
import type { FlowStateView, StateScope } from './flow-state.js';
|
|
2
|
+
import type { FlowStateValues, FlowStateView, StateScope } from './flow-state.js';
|
|
3
3
|
export type { CanvasCommand, CanvasCommandSubscriber } from './canvas-commands.js';
|
|
4
4
|
import type { LiveDetails } from './liveDetails.js';
|
|
5
5
|
export { liveEntries } from './liveDetails.js';
|
|
@@ -847,7 +847,8 @@ export declare class ControlClient {
|
|
|
847
847
|
deleteTag(tagId: string): Promise<void>;
|
|
848
848
|
setFlowTags(flowId: string, tagIds: readonly string[]): Promise<Flow>;
|
|
849
849
|
updateFlow(flowId: string, changes: FlowUpdate): Promise<Flow>;
|
|
850
|
-
getFlowState(flowId: string, scope: StateScope
|
|
850
|
+
getFlowState(flowId: string, scope: StateScope): Promise<FlowStateView>;
|
|
851
|
+
getFlowStateValues(flowId: string, scope: StateScope, keys: readonly string[], signal?: AbortSignal): Promise<FlowStateValues>;
|
|
851
852
|
clearFlowState(flowId: string, scope: StateScope, key?: string): Promise<void>;
|
|
852
853
|
clearFlowDedupe(flowId: string, scope: StateScope, space: string): Promise<void>;
|
|
853
854
|
renameFlow(flowId: string, name: string): Promise<Flow>;
|
|
@@ -5773,13 +5773,24 @@ function dequal(foo, bar) {
|
|
|
5773
5773
|
}
|
|
5774
5774
|
return foo !== foo && bar !== bar;
|
|
5775
5775
|
}
|
|
5776
|
+
//#endregion
|
|
5777
|
+
//#region src/state/common/state.ts
|
|
5778
|
+
var stateReadLimits = {
|
|
5779
|
+
maxKeys: 16,
|
|
5780
|
+
maxBytes: 1048576
|
|
5781
|
+
};
|
|
5782
|
+
var keySchema = string$1().min(1).refine((value) => new TextEncoder().encode(value).length <= 256);
|
|
5783
|
+
strictObject({
|
|
5784
|
+
scope: _enum(["draft", "live"]),
|
|
5785
|
+
values: literal(false).optional()
|
|
5786
|
+
});
|
|
5776
5787
|
strictObject({
|
|
5777
5788
|
scope: _enum(["draft", "live"]),
|
|
5778
|
-
|
|
5789
|
+
keys: array(keySchema).min(1).max(stateReadLimits.maxKeys).refine((keys) => new Set(keys).size === keys.length, "State keys must be distinct.")
|
|
5779
5790
|
});
|
|
5780
5791
|
strictObject({
|
|
5781
5792
|
scope: _enum(["draft", "live"]),
|
|
5782
|
-
key:
|
|
5793
|
+
key: keySchema.optional()
|
|
5783
5794
|
});
|
|
5784
5795
|
strictObject({
|
|
5785
5796
|
scope: _enum(["draft", "live"]),
|
|
@@ -5797,11 +5808,10 @@ var flowStateViewSchema = object({
|
|
|
5797
5808
|
maxIdentities: number().positive(),
|
|
5798
5809
|
maxRunWrites: number().positive()
|
|
5799
5810
|
}),
|
|
5800
|
-
values: array(
|
|
5811
|
+
values: array(strictObject({
|
|
5801
5812
|
key: string$1(),
|
|
5802
5813
|
size: number().nonnegative(),
|
|
5803
|
-
updatedAt: number()
|
|
5804
|
-
value: json$3().optional()
|
|
5814
|
+
updatedAt: number()
|
|
5805
5815
|
})),
|
|
5806
5816
|
spaces: array(object({
|
|
5807
5817
|
space: string$1(),
|
|
@@ -5811,6 +5821,17 @@ var flowStateViewSchema = object({
|
|
|
5811
5821
|
updatedAt: number()
|
|
5812
5822
|
}))
|
|
5813
5823
|
});
|
|
5824
|
+
var flowStateValuesSchema = object({
|
|
5825
|
+
version: literal(1),
|
|
5826
|
+
scope: _enum(["draft", "live"]),
|
|
5827
|
+
values: array(strictObject({
|
|
5828
|
+
key: keySchema,
|
|
5829
|
+
value: json$3()
|
|
5830
|
+
})).min(1).max(stateReadLimits.maxKeys)
|
|
5831
|
+
}).refine((response) => {
|
|
5832
|
+
const encoder = new TextEncoder();
|
|
5833
|
+
return response.values.reduce((bytes, item) => bytes + (item.value === null ? 0 : encoder.encode(JSON.stringify(item.value)).byteLength), 0) <= stateReadLimits.maxBytes;
|
|
5834
|
+
}, "State values exceed the 1 MiB read limit.");
|
|
5814
5835
|
//#endregion
|
|
5815
5836
|
//#region src/json-schema-subset/utils.ts
|
|
5816
5837
|
var nextId = 0;
|
|
@@ -12862,10 +12883,22 @@ var ControlClient = class {
|
|
|
12862
12883
|
})
|
|
12863
12884
|
}));
|
|
12864
12885
|
}
|
|
12865
|
-
async getFlowState(flowId, scope
|
|
12866
|
-
const result = flowStateViewSchema.safeParse(await this.request(`/v1/flows/${segment(flowId)}/state?scope=${scope}
|
|
12886
|
+
async getFlowState(flowId, scope) {
|
|
12887
|
+
const result = flowStateViewSchema.safeParse(await this.request(`/v1/flows/${segment(flowId)}/state?scope=${scope}`));
|
|
12867
12888
|
return result.success && result.data.scope === scope ? result.data : invalidResponse();
|
|
12868
12889
|
}
|
|
12890
|
+
async getFlowStateValues(flowId, scope, keys, signal) {
|
|
12891
|
+
const result = flowStateValuesSchema.safeParse(await this.request(`/v1/flows/${segment(flowId)}/state/read`, {
|
|
12892
|
+
method: "POST",
|
|
12893
|
+
body: JSON.stringify({
|
|
12894
|
+
version: 1,
|
|
12895
|
+
scope,
|
|
12896
|
+
keys
|
|
12897
|
+
}),
|
|
12898
|
+
signal
|
|
12899
|
+
}));
|
|
12900
|
+
return result.success && result.data.scope === scope && result.data.values.length === keys.length && result.data.values.every((item, index) => item.key === keys[index]) ? result.data : invalidResponse();
|
|
12901
|
+
}
|
|
12869
12902
|
async clearFlowState(flowId, scope, key) {
|
|
12870
12903
|
const source = record(await this.request(`/v1/flows/${segment(flowId)}/state?scope=${scope}${key == null ? "" : `&key=${encodeURIComponent(key)}`}`, { method: "DELETE" }));
|
|
12871
12904
|
if (source.version !== 1 || source.cleared !== true) invalidResponse();
|
|
@@ -10,6 +10,11 @@ export declare const waitActionBodySchema: {
|
|
|
10
10
|
};
|
|
11
11
|
};
|
|
12
12
|
export declare const controlRequests: {
|
|
13
|
+
readFlowState: (value: unknown) => {
|
|
14
|
+
scope: "draft" | "live";
|
|
15
|
+
keys: string[];
|
|
16
|
+
version: 1;
|
|
17
|
+
};
|
|
13
18
|
canvas: (value: unknown) => {
|
|
14
19
|
command: {
|
|
15
20
|
type: "focus";
|
|
@@ -12473,13 +12473,24 @@ function httpRequestInputs(mappings, previous, next) {
|
|
|
12473
12473
|
const rename = candidate != null && ["query.", "header."].some((prefix) => candidate.every((name) => name.startsWith(prefix))) ? candidate : void 0;
|
|
12474
12474
|
return remapInputMappings(mappings, next.inputs, rename);
|
|
12475
12475
|
}
|
|
12476
|
+
//#endregion
|
|
12477
|
+
//#region src/state/common/state.ts
|
|
12478
|
+
var stateReadLimits = {
|
|
12479
|
+
maxKeys: 16,
|
|
12480
|
+
maxBytes: 1048576
|
|
12481
|
+
};
|
|
12482
|
+
var keySchema = string().min(1).refine((value) => new TextEncoder().encode(value).length <= 256);
|
|
12476
12483
|
strictObject({
|
|
12477
12484
|
scope: _enum(["draft", "live"]),
|
|
12478
|
-
values:
|
|
12485
|
+
values: literal(false).optional()
|
|
12486
|
+
});
|
|
12487
|
+
var stateReadSchema = strictObject({
|
|
12488
|
+
scope: _enum(["draft", "live"]),
|
|
12489
|
+
keys: array(keySchema).min(1).max(stateReadLimits.maxKeys).refine((keys) => new Set(keys).size === keys.length, "State keys must be distinct.")
|
|
12479
12490
|
});
|
|
12480
12491
|
strictObject({
|
|
12481
12492
|
scope: _enum(["draft", "live"]),
|
|
12482
|
-
key:
|
|
12493
|
+
key: keySchema.optional()
|
|
12483
12494
|
});
|
|
12484
12495
|
strictObject({
|
|
12485
12496
|
scope: _enum(["draft", "live"]),
|
|
@@ -12516,11 +12527,10 @@ object$1({
|
|
|
12516
12527
|
maxIdentities: number().positive(),
|
|
12517
12528
|
maxRunWrites: number().positive()
|
|
12518
12529
|
}),
|
|
12519
|
-
values: array(
|
|
12530
|
+
values: array(strictObject({
|
|
12520
12531
|
key: string(),
|
|
12521
12532
|
size: number().nonnegative(),
|
|
12522
|
-
updatedAt: number()
|
|
12523
|
-
value: json$5().optional()
|
|
12533
|
+
updatedAt: number()
|
|
12524
12534
|
})),
|
|
12525
12535
|
spaces: array(object$1({
|
|
12526
12536
|
space: string(),
|
|
@@ -12530,6 +12540,17 @@ object$1({
|
|
|
12530
12540
|
updatedAt: number()
|
|
12531
12541
|
}))
|
|
12532
12542
|
});
|
|
12543
|
+
object$1({
|
|
12544
|
+
version: literal(1),
|
|
12545
|
+
scope: _enum(["draft", "live"]),
|
|
12546
|
+
values: array(strictObject({
|
|
12547
|
+
key: keySchema,
|
|
12548
|
+
value: json$5()
|
|
12549
|
+
})).min(1).max(stateReadLimits.maxKeys)
|
|
12550
|
+
}).refine((response) => {
|
|
12551
|
+
const encoder = new TextEncoder();
|
|
12552
|
+
return response.values.reduce((bytes, item) => bytes + (item.value === null ? 0 : encoder.encode(JSON.stringify(item.value)).byteLength), 0) <= stateReadLimits.maxBytes;
|
|
12553
|
+
}, "State values exceed the 1 MiB read limit.");
|
|
12533
12554
|
function checkJsonDepth(value, depth = 0) {
|
|
12534
12555
|
if (depth > 64) throw new TypeError("Value exceeds the maximum JSON depth.");
|
|
12535
12556
|
if (value != null && typeof value == "object") for (const child of Object.values(value)) checkJsonDepth(child, depth + 1);
|
|
@@ -17868,6 +17889,7 @@ var trigger = strictObject({
|
|
|
17868
17889
|
outputs: record$3(string(), json)
|
|
17869
17890
|
});
|
|
17870
17891
|
var schemas = {
|
|
17892
|
+
readFlowState: stateReadSchema.extend({ version }),
|
|
17871
17893
|
canvas: strictObject({
|
|
17872
17894
|
command: canvasCommandSchema,
|
|
17873
17895
|
version
|
|
@@ -18007,6 +18029,7 @@ function decoder(schema) {
|
|
|
18007
18029
|
return (value) => schema.parse(value);
|
|
18008
18030
|
}
|
|
18009
18031
|
var controlRequests = {
|
|
18032
|
+
readFlowState: decoder(schemas.readFlowState),
|
|
18010
18033
|
canvas: decoder(schemas.canvas),
|
|
18011
18034
|
authoringCheck: decoder(schemas.authoringCheck),
|
|
18012
18035
|
authoringEdit: decoder(schemas.authoringEdit),
|
|
@@ -8760,13 +8760,24 @@ var httpRequestExecutorSchema = strictObject({
|
|
|
8760
8760
|
]).default("auto"),
|
|
8761
8761
|
statusPolicy: _enum(["success", "all"]).default("success")
|
|
8762
8762
|
}).extend({ kind: literal("http-request") });
|
|
8763
|
+
//#endregion
|
|
8764
|
+
//#region src/state/common/state.ts
|
|
8765
|
+
var stateReadLimits = {
|
|
8766
|
+
maxKeys: 16,
|
|
8767
|
+
maxBytes: 1048576
|
|
8768
|
+
};
|
|
8769
|
+
var keySchema = string().min(1).refine((value) => new TextEncoder().encode(value).length <= 256);
|
|
8770
|
+
strictObject({
|
|
8771
|
+
scope: _enum(["draft", "live"]),
|
|
8772
|
+
values: literal(false).optional()
|
|
8773
|
+
});
|
|
8763
8774
|
strictObject({
|
|
8764
8775
|
scope: _enum(["draft", "live"]),
|
|
8765
|
-
|
|
8776
|
+
keys: array(keySchema).min(1).max(stateReadLimits.maxKeys).refine((keys) => new Set(keys).size === keys.length, "State keys must be distinct.")
|
|
8766
8777
|
});
|
|
8767
8778
|
strictObject({
|
|
8768
8779
|
scope: _enum(["draft", "live"]),
|
|
8769
|
-
key:
|
|
8780
|
+
key: keySchema.optional()
|
|
8770
8781
|
});
|
|
8771
8782
|
strictObject({
|
|
8772
8783
|
scope: _enum(["draft", "live"]),
|
|
@@ -8783,11 +8794,10 @@ object({
|
|
|
8783
8794
|
maxIdentities: number().positive(),
|
|
8784
8795
|
maxRunWrites: number().positive()
|
|
8785
8796
|
}),
|
|
8786
|
-
values: array(
|
|
8797
|
+
values: array(strictObject({
|
|
8787
8798
|
key: string(),
|
|
8788
8799
|
size: number().nonnegative(),
|
|
8789
|
-
updatedAt: number()
|
|
8790
|
-
value: json$1().optional()
|
|
8800
|
+
updatedAt: number()
|
|
8791
8801
|
})),
|
|
8792
8802
|
spaces: array(object({
|
|
8793
8803
|
space: string(),
|
|
@@ -8797,6 +8807,17 @@ object({
|
|
|
8797
8807
|
updatedAt: number()
|
|
8798
8808
|
}))
|
|
8799
8809
|
});
|
|
8810
|
+
object({
|
|
8811
|
+
version: literal(1),
|
|
8812
|
+
scope: _enum(["draft", "live"]),
|
|
8813
|
+
values: array(strictObject({
|
|
8814
|
+
key: keySchema,
|
|
8815
|
+
value: json$1()
|
|
8816
|
+
})).min(1).max(stateReadLimits.maxKeys)
|
|
8817
|
+
}).refine((response) => {
|
|
8818
|
+
const encoder = new TextEncoder();
|
|
8819
|
+
return response.values.reduce((bytes, item) => bytes + (item.value === null ? 0 : encoder.encode(JSON.stringify(item.value)).byteLength), 0) <= stateReadLimits.maxBytes;
|
|
8820
|
+
}, "State values exceed the 1 MiB read limit.");
|
|
8800
8821
|
function checkJsonDepth(value, depth = 0) {
|
|
8801
8822
|
if (depth > 64) throw new TypeError("Value exceeds the maximum JSON depth.");
|
|
8802
8823
|
if (value != null && typeof value == "object") for (const child of Object.values(value)) checkJsonDepth(child, depth + 1);
|
|
@@ -8833,13 +8833,24 @@ var httpRequestExecutorSchema = strictObject({
|
|
|
8833
8833
|
]).default("auto"),
|
|
8834
8834
|
statusPolicy: _enum(["success", "all"]).default("success")
|
|
8835
8835
|
}).extend({ kind: literal("http-request") });
|
|
8836
|
+
//#endregion
|
|
8837
|
+
//#region src/state/common/state.ts
|
|
8838
|
+
var stateReadLimits = {
|
|
8839
|
+
maxKeys: 16,
|
|
8840
|
+
maxBytes: 1048576
|
|
8841
|
+
};
|
|
8842
|
+
var keySchema = string().min(1).refine((value) => new TextEncoder().encode(value).length <= 256);
|
|
8843
|
+
strictObject({
|
|
8844
|
+
scope: _enum(["draft", "live"]),
|
|
8845
|
+
values: literal(false).optional()
|
|
8846
|
+
});
|
|
8836
8847
|
strictObject({
|
|
8837
8848
|
scope: _enum(["draft", "live"]),
|
|
8838
|
-
|
|
8849
|
+
keys: array(keySchema).min(1).max(stateReadLimits.maxKeys).refine((keys) => new Set(keys).size === keys.length, "State keys must be distinct.")
|
|
8839
8850
|
});
|
|
8840
8851
|
strictObject({
|
|
8841
8852
|
scope: _enum(["draft", "live"]),
|
|
8842
|
-
key:
|
|
8853
|
+
key: keySchema.optional()
|
|
8843
8854
|
});
|
|
8844
8855
|
strictObject({
|
|
8845
8856
|
scope: _enum(["draft", "live"]),
|
|
@@ -8856,11 +8867,10 @@ object({
|
|
|
8856
8867
|
maxIdentities: number().positive(),
|
|
8857
8868
|
maxRunWrites: number().positive()
|
|
8858
8869
|
}),
|
|
8859
|
-
values: array(
|
|
8870
|
+
values: array(strictObject({
|
|
8860
8871
|
key: string(),
|
|
8861
8872
|
size: number().nonnegative(),
|
|
8862
|
-
updatedAt: number()
|
|
8863
|
-
value: json$1().optional()
|
|
8873
|
+
updatedAt: number()
|
|
8864
8874
|
})),
|
|
8865
8875
|
spaces: array(object({
|
|
8866
8876
|
space: string(),
|
|
@@ -8870,6 +8880,17 @@ object({
|
|
|
8870
8880
|
updatedAt: number()
|
|
8871
8881
|
}))
|
|
8872
8882
|
});
|
|
8883
|
+
object({
|
|
8884
|
+
version: literal(1),
|
|
8885
|
+
scope: _enum(["draft", "live"]),
|
|
8886
|
+
values: array(strictObject({
|
|
8887
|
+
key: keySchema,
|
|
8888
|
+
value: json$1()
|
|
8889
|
+
})).min(1).max(stateReadLimits.maxKeys)
|
|
8890
|
+
}).refine((response) => {
|
|
8891
|
+
const encoder = new TextEncoder();
|
|
8892
|
+
return response.values.reduce((bytes, item) => bytes + (item.value === null ? 0 : encoder.encode(JSON.stringify(item.value)).byteLength), 0) <= stateReadLimits.maxBytes;
|
|
8893
|
+
}, "State values exceed the 1 MiB read limit.");
|
|
8873
8894
|
function checkJsonDepth(value, depth = 0) {
|
|
8874
8895
|
if (depth > 64) throw new TypeError("Value exceeds the maximum JSON depth.");
|
|
8875
8896
|
if (value != null && typeof value == "object") for (const child of Object.values(value)) checkJsonDepth(child, depth + 1);
|
|
@@ -8604,13 +8604,24 @@ var httpRequestExecutorSchema = strictObject({
|
|
|
8604
8604
|
]).default("auto"),
|
|
8605
8605
|
statusPolicy: _enum(["success", "all"]).default("success")
|
|
8606
8606
|
}).extend({ kind: literal("http-request") });
|
|
8607
|
+
//#endregion
|
|
8608
|
+
//#region src/state/common/state.ts
|
|
8609
|
+
var stateReadLimits = {
|
|
8610
|
+
maxKeys: 16,
|
|
8611
|
+
maxBytes: 1048576
|
|
8612
|
+
};
|
|
8613
|
+
var keySchema = string().min(1).refine((value) => new TextEncoder().encode(value).length <= 256);
|
|
8614
|
+
strictObject({
|
|
8615
|
+
scope: _enum(["draft", "live"]),
|
|
8616
|
+
values: literal(false).optional()
|
|
8617
|
+
});
|
|
8607
8618
|
strictObject({
|
|
8608
8619
|
scope: _enum(["draft", "live"]),
|
|
8609
|
-
|
|
8620
|
+
keys: array(keySchema).min(1).max(stateReadLimits.maxKeys).refine((keys) => new Set(keys).size === keys.length, "State keys must be distinct.")
|
|
8610
8621
|
});
|
|
8611
8622
|
strictObject({
|
|
8612
8623
|
scope: _enum(["draft", "live"]),
|
|
8613
|
-
key:
|
|
8624
|
+
key: keySchema.optional()
|
|
8614
8625
|
});
|
|
8615
8626
|
strictObject({
|
|
8616
8627
|
scope: _enum(["draft", "live"]),
|
|
@@ -8627,11 +8638,10 @@ object({
|
|
|
8627
8638
|
maxIdentities: number().positive(),
|
|
8628
8639
|
maxRunWrites: number().positive()
|
|
8629
8640
|
}),
|
|
8630
|
-
values: array(
|
|
8641
|
+
values: array(strictObject({
|
|
8631
8642
|
key: string(),
|
|
8632
8643
|
size: number().nonnegative(),
|
|
8633
|
-
updatedAt: number()
|
|
8634
|
-
value: json$1().optional()
|
|
8644
|
+
updatedAt: number()
|
|
8635
8645
|
})),
|
|
8636
8646
|
spaces: array(object({
|
|
8637
8647
|
space: string(),
|
|
@@ -8641,6 +8651,17 @@ object({
|
|
|
8641
8651
|
updatedAt: number()
|
|
8642
8652
|
}))
|
|
8643
8653
|
});
|
|
8654
|
+
object({
|
|
8655
|
+
version: literal(1),
|
|
8656
|
+
scope: _enum(["draft", "live"]),
|
|
8657
|
+
values: array(strictObject({
|
|
8658
|
+
key: keySchema,
|
|
8659
|
+
value: json$1()
|
|
8660
|
+
})).min(1).max(stateReadLimits.maxKeys)
|
|
8661
|
+
}).refine((response) => {
|
|
8662
|
+
const encoder = new TextEncoder();
|
|
8663
|
+
return response.values.reduce((bytes, item) => bytes + (item.value === null ? 0 : encoder.encode(JSON.stringify(item.value)).byteLength), 0) <= stateReadLimits.maxBytes;
|
|
8664
|
+
}, "State values exceed the 1 MiB read limit.");
|
|
8644
8665
|
//#endregion
|
|
8645
8666
|
//#region src/flow/common/json.ts
|
|
8646
8667
|
var maxJsonDepth = 64;
|
|
@@ -10362,13 +10362,24 @@ function openApiFieldIssues(task) {
|
|
|
10362
10362
|
function openApiIssues(task) {
|
|
10363
10363
|
return openApiFieldIssues(task).map((issue) => issue.message);
|
|
10364
10364
|
}
|
|
10365
|
+
//#endregion
|
|
10366
|
+
//#region src/state/common/state.ts
|
|
10367
|
+
var stateReadLimits = {
|
|
10368
|
+
maxKeys: 16,
|
|
10369
|
+
maxBytes: 1048576
|
|
10370
|
+
};
|
|
10371
|
+
var keySchema = string().min(1).refine((value) => new TextEncoder().encode(value).length <= 256);
|
|
10372
|
+
strictObject({
|
|
10373
|
+
scope: _enum(["draft", "live"]),
|
|
10374
|
+
values: literal(false).optional()
|
|
10375
|
+
});
|
|
10365
10376
|
strictObject({
|
|
10366
10377
|
scope: _enum(["draft", "live"]),
|
|
10367
|
-
|
|
10378
|
+
keys: array(keySchema).min(1).max(stateReadLimits.maxKeys).refine((keys) => new Set(keys).size === keys.length, "State keys must be distinct.")
|
|
10368
10379
|
});
|
|
10369
10380
|
strictObject({
|
|
10370
10381
|
scope: _enum(["draft", "live"]),
|
|
10371
|
-
key:
|
|
10382
|
+
key: keySchema.optional()
|
|
10372
10383
|
});
|
|
10373
10384
|
strictObject({
|
|
10374
10385
|
scope: _enum(["draft", "live"]),
|
|
@@ -10405,11 +10416,10 @@ object$1({
|
|
|
10405
10416
|
maxIdentities: number().positive(),
|
|
10406
10417
|
maxRunWrites: number().positive()
|
|
10407
10418
|
}),
|
|
10408
|
-
values: array(
|
|
10419
|
+
values: array(strictObject({
|
|
10409
10420
|
key: string(),
|
|
10410
10421
|
size: number().nonnegative(),
|
|
10411
|
-
updatedAt: number()
|
|
10412
|
-
value: json$1().optional()
|
|
10422
|
+
updatedAt: number()
|
|
10413
10423
|
})),
|
|
10414
10424
|
spaces: array(object$1({
|
|
10415
10425
|
space: string(),
|
|
@@ -10419,6 +10429,17 @@ object$1({
|
|
|
10419
10429
|
updatedAt: number()
|
|
10420
10430
|
}))
|
|
10421
10431
|
});
|
|
10432
|
+
object$1({
|
|
10433
|
+
version: literal(1),
|
|
10434
|
+
scope: _enum(["draft", "live"]),
|
|
10435
|
+
values: array(strictObject({
|
|
10436
|
+
key: keySchema,
|
|
10437
|
+
value: json$1()
|
|
10438
|
+
})).min(1).max(stateReadLimits.maxKeys)
|
|
10439
|
+
}).refine((response) => {
|
|
10440
|
+
const encoder = new TextEncoder();
|
|
10441
|
+
return response.values.reduce((bytes, item) => bytes + (item.value === null ? 0 : encoder.encode(JSON.stringify(item.value)).byteLength), 0) <= stateReadLimits.maxBytes;
|
|
10442
|
+
}, "State values exceed the 1 MiB read limit.");
|
|
10422
10443
|
//#endregion
|
|
10423
10444
|
//#region src/flow/common/inputValue.ts
|
|
10424
10445
|
/** An explicit clear suppresses the default; absent mappings still inherit it. */
|
|
@@ -2,13 +2,25 @@ import type { JsonValue, ManagedTaskDefinitionOf } from './flow-model.js';
|
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
export { stateConformanceCases, type StateConformanceHarness } from './state-conformance.js';
|
|
4
4
|
export type StateScope = 'draft' | 'live';
|
|
5
|
+
export declare const stateReadLimits: {
|
|
6
|
+
maxKeys: number;
|
|
7
|
+
maxBytes: number;
|
|
8
|
+
};
|
|
5
9
|
export declare const stateQuerySchema: z.ZodObject<{
|
|
6
10
|
scope: z.ZodEnum<{
|
|
7
11
|
draft: "draft";
|
|
8
12
|
live: "live";
|
|
9
13
|
}>;
|
|
10
|
-
values: z.ZodOptional<z.
|
|
14
|
+
values: z.ZodOptional<z.ZodLiteral<false>>;
|
|
11
15
|
}, z.core.$strict>;
|
|
16
|
+
export declare const stateReadSchema: z.ZodObject<{
|
|
17
|
+
scope: z.ZodEnum<{
|
|
18
|
+
draft: "draft";
|
|
19
|
+
live: "live";
|
|
20
|
+
}>;
|
|
21
|
+
keys: z.ZodArray<z.ZodString>;
|
|
22
|
+
}, z.core.$strict>;
|
|
23
|
+
export type StateRead = z.infer<typeof stateReadSchema>;
|
|
12
24
|
export declare const stateClearSchema: z.ZodObject<{
|
|
13
25
|
scope: z.ZodEnum<{
|
|
14
26
|
draft: "draft";
|
|
@@ -61,7 +73,6 @@ export interface FlowStateView {
|
|
|
61
73
|
readonly key: string;
|
|
62
74
|
readonly size: number;
|
|
63
75
|
readonly updatedAt: number;
|
|
64
|
-
readonly value?: JsonValue;
|
|
65
76
|
}[];
|
|
66
77
|
readonly spaces: readonly {
|
|
67
78
|
readonly space: string;
|
|
@@ -88,8 +99,7 @@ export declare const flowStateViewSchema: z.ZodObject<{
|
|
|
88
99
|
key: z.ZodString;
|
|
89
100
|
size: z.ZodNumber;
|
|
90
101
|
updatedAt: z.ZodNumber;
|
|
91
|
-
|
|
92
|
-
}, z.core.$strip>>;
|
|
102
|
+
}, z.core.$strict>>;
|
|
93
103
|
spaces: z.ZodArray<z.ZodObject<{
|
|
94
104
|
space: z.ZodString;
|
|
95
105
|
count: z.ZodNumber;
|
|
@@ -98,3 +108,22 @@ export declare const flowStateViewSchema: z.ZodObject<{
|
|
|
98
108
|
updatedAt: z.ZodNumber;
|
|
99
109
|
}, z.core.$strip>>;
|
|
100
110
|
}, z.core.$strip>;
|
|
111
|
+
export interface FlowStateValues {
|
|
112
|
+
readonly version: 1;
|
|
113
|
+
readonly scope: StateScope;
|
|
114
|
+
readonly values: readonly {
|
|
115
|
+
readonly key: string;
|
|
116
|
+
readonly value: JsonValue;
|
|
117
|
+
}[];
|
|
118
|
+
}
|
|
119
|
+
export declare const flowStateValuesSchema: z.ZodObject<{
|
|
120
|
+
version: z.ZodLiteral<1>;
|
|
121
|
+
scope: z.ZodEnum<{
|
|
122
|
+
draft: "draft";
|
|
123
|
+
live: "live";
|
|
124
|
+
}>;
|
|
125
|
+
values: z.ZodArray<z.ZodObject<{
|
|
126
|
+
key: z.ZodString;
|
|
127
|
+
value: z.ZodJSONSchema;
|
|
128
|
+
}, z.core.$strict>>;
|
|
129
|
+
}, z.core.$strip>;
|