@oomol-lab/open-flow 0.1.0-beta.76 → 0.1.0-beta.77
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/dist/browser/{ContentIcon-Cm1hbVzW.js → ContentIcon-VZQO8VZU.js} +8 -5
- package/dist/browser/{FlowCanvas-NzKtla_c.js → FlowCanvas-BNGDMaWr.js} +15 -3
- package/dist/browser/{createResourceDialog-BgdedQqu.js → createResourceDialog-BmtakfVg.js} +63 -57
- package/dist/browser/{dialog-aSElFFw2.js → dialog-BcFBfRB1.js} +84 -15
- package/dist/browser/{exportSvg-Dcz4HTo_.js → exportSvg-CG8hEUNk.js} +2 -2
- package/dist/browser/{flowChanges-NZyS7HSp.js → flowChanges-BGo_4Ypo.js} +5849 -10882
- package/dist/browser/{flowWorkspace-Bl0SDehy.js → flowWorkspace-BFHGev7s.js} +1025 -2607
- package/dist/browser/preview.css +112 -5
- package/dist/browser/preview.js +1630 -9295
- package/dist/browser/theme.css +4 -2
- package/dist/browser/{tooltip-3XMK9jkr.js → tooltip-BAWSUexx.js} +1 -1
- package/dist/browser/{typeScriptSession-C9sBGOKZ.js → typeScriptSession-CRoezJPN.js} +1 -1
- package/dist/browser/ui.css +111 -4
- package/dist/browser/ui.js +3 -2
- package/dist/browser/workbench.css +9906 -9778
- package/dist/browser/workbench.d.ts +6 -2
- package/dist/browser/workbench.js +838 -499
- package/dist/browser/{workbenchSelect-DBGP7Y4Z.js → workbenchSelect-CjK-xdm3.js} +2 -2
- package/dist/command/index.js +48 -48
- package/dist/common/authoring.d.ts +4 -4
- package/dist/common/authoringExamples.d.ts +3 -2
- package/dist/common/authoringSchema.d.ts +23 -4
- package/dist/common/control-api-conformance.js +162 -15
- package/dist/common/control-api-errors.d.ts +12 -0
- package/dist/common/control-api.d.ts +35 -2
- package/dist/common/control-api.js +187 -37
- package/dist/common/control-requests.d.ts +22 -3
- package/dist/common/control-requests.js +152 -14
- package/dist/common/engine-contract.d.ts +3 -2
- package/dist/common/flow-authoring.js +55 -7
- package/dist/common/flow-change-schema.d.ts +1 -1
- package/dist/common/flow-change.d.ts +2 -2
- package/dist/common/flow-change.js +56 -8
- package/dist/common/flow-encoding.js +55 -7
- package/dist/common/flow-semantics.js +91 -7
- package/dist/common/flow-state.d.ts +123 -0
- package/dist/common/flow-state.js +5852 -0
- package/dist/common/mcp.d.ts +96 -3
- package/dist/common/mcp.js +165 -13
- package/dist/common/run-events.js +1 -0
- package/dist/common/runtime-contract.d.ts +14 -0
- package/dist/common/runtime-contract.js +118 -5
- package/dist/common/scheduler-node-execution.d.ts +1 -0
- package/dist/common/scheduler.d.ts +1 -1
- package/dist/common/scheduler.js +52 -3
- package/dist/common/state-conformance.d.ts +16 -0
- package/dist/common/tags.d.ts +4 -0
- package/dist/index.d.ts +11 -0
- package/package.json +5 -1
- package/src/control/common/api.ts +84 -11
- package/src/control/common/authoring.ts +6 -1
- package/src/control/common/authoringExamples.ts +8 -0
- package/src/control/common/authoringSchema.ts +18 -12
- package/src/control/common/errors.ts +6 -0
- package/src/control/common/flowDecoders.ts +1 -0
- package/src/control/common/mcp.ts +16 -0
- package/src/control/common/requests.ts +10 -2
- package/src/control/common/tags.ts +20 -0
- package/src/execution/common/events.ts +3 -0
- package/src/execution/common/node-execution.ts +3 -0
- package/src/execution/common/scheduler.ts +2 -0
- package/src/flow/common/change.ts +2 -1
- package/src/flow/common/changeSchema.ts +11 -1
- package/src/flow/common/errorHandling.ts +1 -1
- package/src/flow/common/semantics.ts +20 -0
- package/src/runtime/common/engineContract.ts +6 -3
- package/src/runtime/common/runtime.ts +116 -0
- package/src/state/common/conformance.ts +86 -0
- package/src/state/common/state.ts +169 -0
- package/src/types/index.ts +11 -0
|
@@ -8604,6 +8604,51 @@ var httpRequestExecutorSchema = strictObject({
|
|
|
8604
8604
|
]).default("auto"),
|
|
8605
8605
|
statusPolicy: _enum(["success", "all"]).default("success")
|
|
8606
8606
|
}).extend({ kind: literal("http-request") });
|
|
8607
|
+
strictObject({
|
|
8608
|
+
scope: _enum(["draft", "live"]),
|
|
8609
|
+
values: boolean().optional()
|
|
8610
|
+
});
|
|
8611
|
+
strictObject({
|
|
8612
|
+
scope: _enum(["draft", "live"]),
|
|
8613
|
+
key: string().min(1).refine((key) => new TextEncoder().encode(key).length <= 256).optional()
|
|
8614
|
+
});
|
|
8615
|
+
strictObject({
|
|
8616
|
+
scope: _enum(["draft", "live"]),
|
|
8617
|
+
space: string().regex(/^(flow|node:.+)$/)
|
|
8618
|
+
});
|
|
8619
|
+
var dedupeExecutorSchema = strictObject({
|
|
8620
|
+
field: string().default(""),
|
|
8621
|
+
mode: _enum(["new", "increasing"]).default("new"),
|
|
8622
|
+
space: _enum(["node", "flow"]).default("node")
|
|
8623
|
+
}).extend({ kind: literal("dedupe") });
|
|
8624
|
+
object({
|
|
8625
|
+
version: literal(1),
|
|
8626
|
+
scope: _enum(["draft", "live"]),
|
|
8627
|
+
limits: object({
|
|
8628
|
+
maxValueBytes: number().positive(),
|
|
8629
|
+
maxValues: number().int().positive(),
|
|
8630
|
+
maxSpaces: number().int().positive(),
|
|
8631
|
+
maxIdentities: number().positive(),
|
|
8632
|
+
maxRunWrites: number().positive()
|
|
8633
|
+
}),
|
|
8634
|
+
values: array(object({
|
|
8635
|
+
key: string(),
|
|
8636
|
+
size: number().nonnegative(),
|
|
8637
|
+
updatedAt: number(),
|
|
8638
|
+
value: json$1().optional()
|
|
8639
|
+
})),
|
|
8640
|
+
spaces: array(object({
|
|
8641
|
+
space: string(),
|
|
8642
|
+
mode: _enum(["new", "increasing"]),
|
|
8643
|
+
count: number().nonnegative(),
|
|
8644
|
+
watermark: union([
|
|
8645
|
+
string(),
|
|
8646
|
+
number(),
|
|
8647
|
+
_null()
|
|
8648
|
+
]),
|
|
8649
|
+
updatedAt: number()
|
|
8650
|
+
}))
|
|
8651
|
+
});
|
|
8607
8652
|
//#endregion
|
|
8608
8653
|
//#region src/flow/common/json.ts
|
|
8609
8654
|
var maxJsonDepth = 64;
|
|
@@ -8890,7 +8935,8 @@ var managedFields = object({
|
|
|
8890
8935
|
flowId: text,
|
|
8891
8936
|
revisionId: text
|
|
8892
8937
|
}),
|
|
8893
|
-
httpRequestExecutorSchema
|
|
8938
|
+
httpRequestExecutorSchema,
|
|
8939
|
+
dedupeExecutorSchema
|
|
8894
8940
|
])
|
|
8895
8941
|
});
|
|
8896
8942
|
var managed = managedFields.transform(limitDecisionTask);
|
|
@@ -9144,7 +9190,8 @@ var revision = object({
|
|
|
9144
9190
|
literal(9),
|
|
9145
9191
|
literal(10),
|
|
9146
9192
|
literal(11),
|
|
9147
|
-
literal(12)
|
|
9193
|
+
literal(12),
|
|
9194
|
+
literal(13)
|
|
9148
9195
|
]),
|
|
9149
9196
|
document,
|
|
9150
9197
|
modules: record$1(text, module)
|
|
@@ -9399,14 +9446,14 @@ function repairRevisionEnvelope(value) {
|
|
|
9399
9446
|
checkJsonDepth(value);
|
|
9400
9447
|
const envelopeSource = record(value);
|
|
9401
9448
|
if (envelopeSource.kind != "open-flow-flow-revision" || envelopeSource.version != 1) throw new TypeError("The value is not an Open Flow Revision envelope.");
|
|
9402
|
-
if (typeof envelopeSource.modelVersion == "number" && envelopeSource.modelVersion >
|
|
9449
|
+
if (typeof envelopeSource.modelVersion == "number" && envelopeSource.modelVersion > 13) throw new TypeError("The Flow model is newer than this package.");
|
|
9403
9450
|
let sourceDocument = record(envelopeSource.modelVersion == 1 || envelopeSource.modelVersion == 2 ? upgradeLegacyDocument(envelopeSource.document) : envelopeSource.document);
|
|
9404
9451
|
if (typeof envelopeSource.modelVersion == "number" && envelopeSource.modelVersion < 6) sourceDocument = upgradeTaskNodes(sourceDocument);
|
|
9405
9452
|
sourceDocument = record(normalizeDocument(sourceDocument));
|
|
9406
9453
|
const bindings = record(sourceDocument.bindings);
|
|
9407
9454
|
const sourceGraph = repairGraph(sourceDocument.graph, bindings);
|
|
9408
9455
|
return decodeRevisionContent({
|
|
9409
|
-
modelVersion:
|
|
9456
|
+
modelVersion: 13,
|
|
9410
9457
|
document: {
|
|
9411
9458
|
bindings: repairedEntries(sourceDocument.bindings, binding),
|
|
9412
9459
|
graph: sourceGraph
|
|
@@ -9608,6 +9655,7 @@ array(union([...new Map(Object.entries(shapes).map(([kind, shape]) => [kind, sha
|
|
|
9608
9655
|
...shape
|
|
9609
9656
|
})])).values()])).min(1);
|
|
9610
9657
|
function checkModelVersion(content) {
|
|
9658
|
+
if (content.modelVersion < 13 && Object.values(content.document.graph.nodes).some((candidateNode) => candidateNode.kind === "task" && "executor" in candidateNode.task && candidateNode.task.executor.kind === "dedupe")) throw new Error("Deduplication requires Flow model v13.");
|
|
9611
9659
|
if (content.modelVersion < 12 && Object.values(content.document.graph.nodes).some((candidateNode) => candidateNode.kind == "task" && "moduleId" in candidateNode.task && candidateNode.task.capabilities?.some((item) => item.kind == "http"))) throw new TypeError("Code HTTP access requires Flow model version 12.");
|
|
9612
9660
|
if (content.modelVersion < 11 && Object.values(content.document.graph.nodes).some((candidateNode) => candidateNode.kind == "task" && "executor" in candidateNode.task && candidateNode.task.executor.kind == "http-request")) throw new TypeError("HTTP Request requires Flow model version 11.");
|
|
9613
9661
|
if (content.modelVersion < 11 && Object.values(content.document.graph.nodes).some((candidateNode) => candidateNode.kind == "task" && ("moduleId" in candidateNode.task ? candidateNode.task.capabilities?.some((item) => item.kind == "workflow") : candidateNode.task.executor.kind == "agent" && candidateNode.task.executor.tools.some((item) => item.kind == "workflow")))) throw new TypeError("Workflow tools require Flow model version 11.");
|
|
@@ -9669,10 +9717,10 @@ function upgradeRevisionContent(content) {
|
|
|
9669
9717
|
function upgradeDecodedRevisionContent(content) {
|
|
9670
9718
|
const graph = content.document.graph;
|
|
9671
9719
|
const hasManual = Object.values(graph.nodes).some((node) => node.kind == "manual");
|
|
9672
|
-
if (!hasManual && content.modelVersion ==
|
|
9720
|
+
if (!hasManual && content.modelVersion == 13) return content;
|
|
9673
9721
|
return {
|
|
9674
9722
|
...content,
|
|
9675
|
-
modelVersion:
|
|
9723
|
+
modelVersion: 13,
|
|
9676
9724
|
document: {
|
|
9677
9725
|
...content.document,
|
|
9678
9726
|
graph: hasManual ? {
|
|
@@ -10244,7 +10292,7 @@ function revisionRepairKind(bytes) {
|
|
|
10244
10292
|
return;
|
|
10245
10293
|
}
|
|
10246
10294
|
const source = value;
|
|
10247
|
-
return typeof source.modelVersion == "number" && source.modelVersion <
|
|
10295
|
+
return typeof source.modelVersion == "number" && source.modelVersion < 13 ? "upgrade" : "repair";
|
|
10248
10296
|
}
|
|
10249
10297
|
function repairRevision(bytes) {
|
|
10250
10298
|
return repairRevisionEnvelope(revisionValue(bytes));
|
|
@@ -10362,6 +10362,71 @@ function openApiFieldIssues(task) {
|
|
|
10362
10362
|
function openApiIssues(task) {
|
|
10363
10363
|
return openApiFieldIssues(task).map((issue) => issue.message);
|
|
10364
10364
|
}
|
|
10365
|
+
strictObject({
|
|
10366
|
+
scope: _enum(["draft", "live"]),
|
|
10367
|
+
values: boolean().optional()
|
|
10368
|
+
});
|
|
10369
|
+
strictObject({
|
|
10370
|
+
scope: _enum(["draft", "live"]),
|
|
10371
|
+
key: string().min(1).refine((key) => new TextEncoder().encode(key).length <= 256).optional()
|
|
10372
|
+
});
|
|
10373
|
+
strictObject({
|
|
10374
|
+
scope: _enum(["draft", "live"]),
|
|
10375
|
+
space: string().regex(/^(flow|node:.+)$/)
|
|
10376
|
+
});
|
|
10377
|
+
var dedupeConfigSchema = strictObject({
|
|
10378
|
+
field: string().default(""),
|
|
10379
|
+
mode: _enum(["new", "increasing"]).default("new"),
|
|
10380
|
+
space: _enum(["node", "flow"]).default("node")
|
|
10381
|
+
});
|
|
10382
|
+
var dedupeExecutorSchema = dedupeConfigSchema.extend({ kind: literal("dedupe") });
|
|
10383
|
+
function dedupeTask(config = dedupeConfigSchema.parse({}), name = "Remove Duplicates") {
|
|
10384
|
+
return {
|
|
10385
|
+
name,
|
|
10386
|
+
executor: {
|
|
10387
|
+
...config,
|
|
10388
|
+
kind: "dedupe"
|
|
10389
|
+
},
|
|
10390
|
+
inputs: [{
|
|
10391
|
+
handle: "items",
|
|
10392
|
+
jsonSchema: { type: "array" },
|
|
10393
|
+
nullable: false
|
|
10394
|
+
}],
|
|
10395
|
+
outputs: ["items", "duplicates"].map((handle) => ({
|
|
10396
|
+
handle,
|
|
10397
|
+
jsonSchema: { type: "array" },
|
|
10398
|
+
nullable: false
|
|
10399
|
+
}))
|
|
10400
|
+
};
|
|
10401
|
+
}
|
|
10402
|
+
object$1({
|
|
10403
|
+
version: literal(1),
|
|
10404
|
+
scope: _enum(["draft", "live"]),
|
|
10405
|
+
limits: object$1({
|
|
10406
|
+
maxValueBytes: number().positive(),
|
|
10407
|
+
maxValues: number().int().positive(),
|
|
10408
|
+
maxSpaces: number().int().positive(),
|
|
10409
|
+
maxIdentities: number().positive(),
|
|
10410
|
+
maxRunWrites: number().positive()
|
|
10411
|
+
}),
|
|
10412
|
+
values: array(object$1({
|
|
10413
|
+
key: string(),
|
|
10414
|
+
size: number().nonnegative(),
|
|
10415
|
+
updatedAt: number(),
|
|
10416
|
+
value: json$1().optional()
|
|
10417
|
+
})),
|
|
10418
|
+
spaces: array(object$1({
|
|
10419
|
+
space: string(),
|
|
10420
|
+
mode: _enum(["new", "increasing"]),
|
|
10421
|
+
count: number().nonnegative(),
|
|
10422
|
+
watermark: union([
|
|
10423
|
+
string(),
|
|
10424
|
+
number(),
|
|
10425
|
+
_null()
|
|
10426
|
+
]),
|
|
10427
|
+
updatedAt: number()
|
|
10428
|
+
}))
|
|
10429
|
+
});
|
|
10365
10430
|
//#endregion
|
|
10366
10431
|
//#region src/flow/common/inputValue.ts
|
|
10367
10432
|
/** An explicit clear suppresses the default; absent mappings still inherit it. */
|
|
@@ -10736,7 +10801,8 @@ var managedFields = object$1({
|
|
|
10736
10801
|
flowId: text,
|
|
10737
10802
|
revisionId: text
|
|
10738
10803
|
}),
|
|
10739
|
-
httpRequestExecutorSchema
|
|
10804
|
+
httpRequestExecutorSchema,
|
|
10805
|
+
dedupeExecutorSchema
|
|
10740
10806
|
])
|
|
10741
10807
|
});
|
|
10742
10808
|
var managed = managedFields.transform(limitDecisionTask);
|
|
@@ -11006,7 +11072,8 @@ object$1({
|
|
|
11006
11072
|
literal(9),
|
|
11007
11073
|
literal(10),
|
|
11008
11074
|
literal(11),
|
|
11009
|
-
literal(12)
|
|
11075
|
+
literal(12),
|
|
11076
|
+
literal(13)
|
|
11010
11077
|
]),
|
|
11011
11078
|
document,
|
|
11012
11079
|
modules: record$1(text, module)
|
|
@@ -11352,7 +11419,7 @@ var nodeErrorSchema = {
|
|
|
11352
11419
|
}
|
|
11353
11420
|
};
|
|
11354
11421
|
function supportsNodeErrorHandling(node) {
|
|
11355
|
-
return supportsNodeRetry(node);
|
|
11422
|
+
return supportsNodeRetry(node) || node.kind === "task" && "executor" in node.task && node.task.executor.kind === "dedupe";
|
|
11356
11423
|
}
|
|
11357
11424
|
function nodeSystemOutputPorts(node) {
|
|
11358
11425
|
return supportsNodeErrorHandling(node) && node.onError == "error" ? { error: {
|
|
@@ -11880,8 +11947,8 @@ function normalizeTriggerOutputs(trigger, outputs) {
|
|
|
11880
11947
|
}
|
|
11881
11948
|
//#endregion
|
|
11882
11949
|
//#region src/runtime/common/engineContract.ts
|
|
11883
|
-
/**
|
|
11884
|
-
var currentEngineContract = "open-flow-engine/
|
|
11950
|
+
/** v10 adds persistent Flow State to the published v9 Node compatibility and fetch contract. */
|
|
11951
|
+
var currentEngineContract = "open-flow-engine/v10";
|
|
11885
11952
|
/** The published v8 Node compatibility contract, retained for existing Publications and Runs. */
|
|
11886
11953
|
var nodejsEngineContract = "open-flow-engine/v8/nodejs-compat-v1";
|
|
11887
11954
|
var platformSource = (contract) => `export const engineContract = ${JSON.stringify(contract)}
|
|
@@ -11926,13 +11993,19 @@ var nodejsContract = {
|
|
|
11926
11993
|
].flatMap((name) => [name, `node:${name}`])),
|
|
11927
11994
|
platformSource: platformSource(nodejsEngineContract)
|
|
11928
11995
|
};
|
|
11929
|
-
var
|
|
11996
|
+
var v9Contract = {
|
|
11930
11997
|
...nodejsContract,
|
|
11931
11998
|
codeFetch: true,
|
|
11999
|
+
platformSource: platformSource("open-flow-engine/v9")
|
|
12000
|
+
};
|
|
12001
|
+
var currentContract = {
|
|
12002
|
+
...v9Contract,
|
|
12003
|
+
flowState: true,
|
|
11932
12004
|
platformSource: platformSource(currentEngineContract)
|
|
11933
12005
|
};
|
|
11934
12006
|
function findEngineContract(contract) {
|
|
11935
|
-
if (contract == "open-flow-engine/
|
|
12007
|
+
if (contract == "open-flow-engine/v10") return currentContract;
|
|
12008
|
+
if (contract == "open-flow-engine/v9") return v9Contract;
|
|
11936
12009
|
if (contract == "open-flow-engine/v8") return v8Contract;
|
|
11937
12010
|
if (contract == "open-flow-engine/v8/nodejs-compat-v1") return nodejsContract;
|
|
11938
12011
|
if (contract == "open-flow-engine/v7" || contract == "open-flow-engine/v7/nodejs-compat-v1") return {
|
|
@@ -24934,6 +25007,16 @@ async function validateFlow(revision, engine) {
|
|
|
24934
25007
|
message,
|
|
24935
25008
|
path: `/document/graph/nodes/${nodeId}/task/executor`
|
|
24936
25009
|
});
|
|
25010
|
+
if (task.executor.kind === "dedupe") {
|
|
25011
|
+
const expected = dedupeTask(task.executor);
|
|
25012
|
+
if (!dequal(httpPortContracts(task.inputs), httpPortContracts(expected.inputs)) || !dequal(httpPortContracts(task.outputs), httpPortContracts(expected.outputs))) checked.diagnostics.push({
|
|
25013
|
+
code: "dedupe.ports-invalid",
|
|
25014
|
+
column: 0,
|
|
25015
|
+
line: 1,
|
|
25016
|
+
message: "Deduplication ports must match the fixed contract.",
|
|
25017
|
+
path: `/document/graph/nodes/${nodeId}/task`
|
|
25018
|
+
});
|
|
25019
|
+
}
|
|
24937
25020
|
if (task.executor.kind == "http-request") {
|
|
24938
25021
|
for (const issue of httpRequestIssues(task.executor)) checked.diagnostics.push({
|
|
24939
25022
|
code: "http-request.config-invalid",
|
|
@@ -25068,6 +25151,7 @@ var httpPortContracts = (ports) => ports.filter((port) => "handle" in port).map(
|
|
|
25068
25151
|
async function prepareFlow(revision, engineContract, triggerId) {
|
|
25069
25152
|
const engine = findEngineContract(engineContract);
|
|
25070
25153
|
if (engine == null) return { kind: "engine-unsupported" };
|
|
25154
|
+
if (!engine.flowState && Object.values(revision.document.graph.nodes).some((node) => node.kind === "task" && "executor" in node.task && node.task.executor.kind === "dedupe")) return { kind: "engine-unsupported" };
|
|
25071
25155
|
if (!engine.httpRequests && Object.values(revision.document.graph.nodes).some((node) => node.kind == "task" && "executor" in node.task && node.task.executor.kind == "http-request")) return { kind: "engine-unsupported" };
|
|
25072
25156
|
if (!engine.codeFetch && Object.values(revision.document.graph.nodes).some((node) => node.kind == "task" && "moduleId" in node.task && node.task.capabilities?.some((item) => item.kind == "http"))) return { kind: "engine-unsupported" };
|
|
25073
25157
|
if (!engine.workflowTools && Object.values(revision.document.graph.nodes).some((node) => nodeWorkflowReferences(node).some((ref) => ref.tool != null))) return { kind: "engine-unsupported" };
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import type { JsonValue, ManagedTaskDefinitionOf } from './flow-model.js';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
export { stateConformanceCases, type StateConformanceHarness } from './state-conformance.js';
|
|
4
|
+
export type StateScope = 'draft' | 'live';
|
|
5
|
+
export declare const stateQuerySchema: z.ZodObject<{
|
|
6
|
+
scope: z.ZodEnum<{
|
|
7
|
+
draft: "draft";
|
|
8
|
+
live: "live";
|
|
9
|
+
}>;
|
|
10
|
+
values: z.ZodOptional<z.ZodBoolean>;
|
|
11
|
+
}, z.core.$strict>;
|
|
12
|
+
export declare const stateClearSchema: z.ZodObject<{
|
|
13
|
+
scope: z.ZodEnum<{
|
|
14
|
+
draft: "draft";
|
|
15
|
+
live: "live";
|
|
16
|
+
}>;
|
|
17
|
+
key: z.ZodOptional<z.ZodString>;
|
|
18
|
+
}, z.core.$strict>;
|
|
19
|
+
export declare const dedupeClearSchema: z.ZodObject<{
|
|
20
|
+
scope: z.ZodEnum<{
|
|
21
|
+
draft: "draft";
|
|
22
|
+
live: "live";
|
|
23
|
+
}>;
|
|
24
|
+
space: z.ZodString;
|
|
25
|
+
}, z.core.$strict>;
|
|
26
|
+
export type DedupeIdentity = string | number;
|
|
27
|
+
export declare const dedupeConfigSchema: z.ZodObject<{
|
|
28
|
+
field: z.ZodDefault<z.ZodString>;
|
|
29
|
+
mode: z.ZodDefault<z.ZodEnum<{
|
|
30
|
+
increasing: "increasing";
|
|
31
|
+
new: "new";
|
|
32
|
+
}>>;
|
|
33
|
+
space: z.ZodDefault<z.ZodEnum<{
|
|
34
|
+
flow: "flow";
|
|
35
|
+
node: "node";
|
|
36
|
+
}>>;
|
|
37
|
+
}, z.core.$strict>;
|
|
38
|
+
export type DedupeConfig = z.infer<typeof dedupeConfigSchema>;
|
|
39
|
+
export interface DedupeExecutor extends DedupeConfig {
|
|
40
|
+
readonly kind: 'dedupe';
|
|
41
|
+
}
|
|
42
|
+
export declare const dedupeExecutorSchema: z.ZodObject<{
|
|
43
|
+
field: z.ZodDefault<z.ZodString>;
|
|
44
|
+
mode: z.ZodDefault<z.ZodEnum<{
|
|
45
|
+
increasing: "increasing";
|
|
46
|
+
new: "new";
|
|
47
|
+
}>>;
|
|
48
|
+
space: z.ZodDefault<z.ZodEnum<{
|
|
49
|
+
flow: "flow";
|
|
50
|
+
node: "node";
|
|
51
|
+
}>>;
|
|
52
|
+
kind: z.ZodLiteral<"dedupe">;
|
|
53
|
+
}, z.core.$strict>;
|
|
54
|
+
export declare function dedupeTask(config?: DedupeConfig, name?: string): ManagedTaskDefinitionOf<DedupeExecutor>;
|
|
55
|
+
export declare class StateError extends Error {
|
|
56
|
+
readonly retryable = false;
|
|
57
|
+
readonly catchable: boolean;
|
|
58
|
+
readonly code: 'capability.invalid' | 'capability.denied' | 'dedupe.full' | 'limit-exceeded';
|
|
59
|
+
constructor(code: StateError['code'], message: string);
|
|
60
|
+
}
|
|
61
|
+
export declare function stateKey(key: unknown): string;
|
|
62
|
+
export declare function dedupeIdentities(value: unknown): DedupeIdentity[];
|
|
63
|
+
export declare function hashIdentities(ids: readonly DedupeIdentity[]): Promise<Uint8Array[]>;
|
|
64
|
+
export declare function watermarkValue(id: DedupeIdentity): number;
|
|
65
|
+
export declare function increasingIdentities(ids: readonly DedupeIdentity[], watermark: DedupeIdentity | null): {
|
|
66
|
+
inserted: boolean[];
|
|
67
|
+
watermark: DedupeIdentity | null;
|
|
68
|
+
};
|
|
69
|
+
export declare function itemIdentities(items: JsonValue, field: string): DedupeIdentity[];
|
|
70
|
+
export interface FlowStateView {
|
|
71
|
+
readonly version: 1;
|
|
72
|
+
readonly scope: StateScope;
|
|
73
|
+
readonly limits: {
|
|
74
|
+
readonly maxValueBytes: number;
|
|
75
|
+
readonly maxValues: number;
|
|
76
|
+
readonly maxSpaces: number;
|
|
77
|
+
readonly maxIdentities: number;
|
|
78
|
+
readonly maxRunWrites: number;
|
|
79
|
+
};
|
|
80
|
+
readonly values: readonly {
|
|
81
|
+
readonly key: string;
|
|
82
|
+
readonly size: number;
|
|
83
|
+
readonly updatedAt: number;
|
|
84
|
+
readonly value?: JsonValue;
|
|
85
|
+
}[];
|
|
86
|
+
readonly spaces: readonly {
|
|
87
|
+
readonly space: string;
|
|
88
|
+
readonly mode: 'new' | 'increasing';
|
|
89
|
+
readonly count: number;
|
|
90
|
+
readonly watermark: DedupeIdentity | null;
|
|
91
|
+
readonly updatedAt: number;
|
|
92
|
+
}[];
|
|
93
|
+
}
|
|
94
|
+
export declare const flowStateViewSchema: z.ZodObject<{
|
|
95
|
+
version: z.ZodLiteral<1>;
|
|
96
|
+
scope: z.ZodEnum<{
|
|
97
|
+
draft: "draft";
|
|
98
|
+
live: "live";
|
|
99
|
+
}>;
|
|
100
|
+
limits: z.ZodObject<{
|
|
101
|
+
maxValueBytes: z.ZodNumber;
|
|
102
|
+
maxValues: z.ZodNumber;
|
|
103
|
+
maxSpaces: z.ZodNumber;
|
|
104
|
+
maxIdentities: z.ZodNumber;
|
|
105
|
+
maxRunWrites: z.ZodNumber;
|
|
106
|
+
}, z.core.$strip>;
|
|
107
|
+
values: z.ZodArray<z.ZodObject<{
|
|
108
|
+
key: z.ZodString;
|
|
109
|
+
size: z.ZodNumber;
|
|
110
|
+
updatedAt: z.ZodNumber;
|
|
111
|
+
value: z.ZodOptional<z.ZodJSONSchema>;
|
|
112
|
+
}, z.core.$strip>>;
|
|
113
|
+
spaces: z.ZodArray<z.ZodObject<{
|
|
114
|
+
space: z.ZodString;
|
|
115
|
+
mode: z.ZodEnum<{
|
|
116
|
+
increasing: "increasing";
|
|
117
|
+
new: "new";
|
|
118
|
+
}>;
|
|
119
|
+
count: z.ZodNumber;
|
|
120
|
+
watermark: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodNull]>;
|
|
121
|
+
updatedAt: z.ZodNumber;
|
|
122
|
+
}, z.core.$strip>>;
|
|
123
|
+
}, z.core.$strip>;
|