@oomol-lab/open-flow 0.1.0-beta.90 → 0.1.0-beta.91
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/{FlowCanvas-C4iuvVKB.js → FlowCanvas-CZEphIhX.js} +169 -2324
- package/dist/browser/{createResourceDialog-BstGO0m4.js → createResourceDialog-CJbZa2gA.js} +2 -2
- package/dist/browser/{dialog-Bi-MVTGj.js → dialog-E1WkapJU.js} +10 -2
- package/dist/browser/{exportPng-DMsB9ku_.js → exportPng-c4or5th8.js} +2 -2
- package/dist/browser/{flowChanges-SKYJBr6X.js → flowChanges-DsLZdENA.js} +20 -37
- package/dist/browser/{flowWorkspace-4UHRaHcz.js → flowWorkspace-CxLQWUdj.js} +54 -19
- package/dist/browser/{markdownContent-B75ojl0E.js → markdownContent-BsdTdwBU.js} +1 -1
- package/dist/browser/preview.js +231 -68
- package/dist/browser/workbench.js +6 -6
- package/dist/browser/{workbenchSelect-CHOeceKA.js → workbenchSelect-BfQfMWuY.js} +1 -1
- package/dist/browser/{wrapLayout-DU5HG1qH.js → wrapLayout-ZOG4AikN.js} +2493 -200
- package/dist/command/index.js +58 -55
- package/dist/common/control-api-conformance.js +896 -8
- package/dist/common/control-api.js +896 -8
- package/dist/common/control-requests.js +17 -6
- package/dist/common/decision.js +10 -2
- package/dist/common/flow-authoring.js +896 -8
- package/dist/common/flow-change.js +896 -8
- package/dist/common/flow-encoding.js +896 -8
- package/dist/common/flow-semantics.js +10 -2
- package/dist/common/integration-trigger.js +10 -2
- package/dist/common/licenses.md +2 -0
- package/dist/common/mcp.js +896 -8
- package/dist/common/openapi.js +10 -2
- package/dist/common/poll-trigger.js +10 -2
- package/dist/common/provider-triggers.js +1 -1
- package/dist/common/scheduler.js +10 -2
- package/dist/common/webhook-trigger.js +890 -2
- package/dist/common/workflow.js +14 -3
- package/dist/render/browser/runtime.js +966 -59
- package/dist/render/node/index.js +792 -4
- package/package.json +1 -1
- package/src/control/common/authoringTools.ts +4 -2
- package/src/flow/common/schemaComparer.ts +12 -2
- package/src/json-schema-subset/checker/equals.ts +3 -0
- package/src/trigger/providers/catalog.generated.json +9 -1
- package/src/workflow/common/workflow.ts +4 -3
|
@@ -27043,9 +27043,24 @@ var OpenFlowRenderer = (function(exports) {
|
|
|
27043
27043
|
//#region src/canvas/browser/base/routeLayout.ts
|
|
27044
27044
|
var clearance = 16;
|
|
27045
27045
|
var portOffset = 24;
|
|
27046
|
+
function componentIndex(sets) {
|
|
27047
|
+
return new Map(sets.flatMap((ids, index) => ids.map((id) => [id, index])));
|
|
27048
|
+
}
|
|
27046
27049
|
/** Orthogonal channels around the measured cards, in primary/cross coordinates. */
|
|
27047
|
-
function routeLayout(nodes, edges) {
|
|
27050
|
+
function routeLayout(nodes, edges, options = {}) {
|
|
27048
27051
|
const byId = new Map(nodes.map((node) => [node.id, node]));
|
|
27052
|
+
const graph = new ie.Graph();
|
|
27053
|
+
for (const node of nodes) graph.setNode(node.id);
|
|
27054
|
+
for (const edge of edges) graph.setEdge(edge.source, edge.target);
|
|
27055
|
+
const components = componentIndex(ie.alg.components(graph));
|
|
27056
|
+
const cycles = componentIndex(ie.alg.tarjan(graph));
|
|
27057
|
+
const obstacles = nodes.map((node) => ({
|
|
27058
|
+
component: components.get(node.id),
|
|
27059
|
+
left: node.x - clearance,
|
|
27060
|
+
right: node.x + node.width + clearance,
|
|
27061
|
+
top: node.y - clearance,
|
|
27062
|
+
bottom: node.y + node.height + clearance
|
|
27063
|
+
}));
|
|
27049
27064
|
const connections = edges.map((edge) => {
|
|
27050
27065
|
const source = byId.get(edge.source);
|
|
27051
27066
|
const target = byId.get(edge.target);
|
|
@@ -27058,11 +27073,15 @@ var OpenFlowRenderer = (function(exports) {
|
|
|
27058
27073
|
y: target.y + (edge.targetOffset?.y ?? target.height / 2)
|
|
27059
27074
|
};
|
|
27060
27075
|
const offset = output.x < input.x ? Math.min(portOffset, (input.x - output.x) / 2) : portOffset;
|
|
27076
|
+
const feedback = input.x <= output.x && cycles.get(edge.source) === cycles.get(edge.target);
|
|
27061
27077
|
return {
|
|
27062
27078
|
id: edge.id,
|
|
27079
|
+
component: components.get(edge.source),
|
|
27063
27080
|
source: output,
|
|
27064
27081
|
target: input,
|
|
27065
27082
|
returnSide: input.x <= output.x ? Math.sign(input.y - output.y) : 0,
|
|
27083
|
+
feedback,
|
|
27084
|
+
returnLane: void 0,
|
|
27066
27085
|
start: {
|
|
27067
27086
|
x: output.x + offset,
|
|
27068
27087
|
y: output.y
|
|
@@ -27073,12 +27092,23 @@ var OpenFlowRenderer = (function(exports) {
|
|
|
27073
27092
|
}
|
|
27074
27093
|
};
|
|
27075
27094
|
});
|
|
27076
|
-
const
|
|
27077
|
-
|
|
27078
|
-
|
|
27079
|
-
|
|
27080
|
-
|
|
27081
|
-
|
|
27095
|
+
const feedback = connections.filter((edge) => edge.feedback).toSorted((a, b) => a.source.x - a.target.x - (b.source.x - b.target.x));
|
|
27096
|
+
for (const [index, edge] of feedback.entries()) {
|
|
27097
|
+
const side = edge.source.y <= edge.target.y ? -1 : 1;
|
|
27098
|
+
const span = obstacles.filter((rect) => rect.component === edge.component && rect.right >= edge.end.x && rect.left <= edge.start.x);
|
|
27099
|
+
let lane = side < 0 ? Math.min(...span.map((rect) => rect.top)) : Math.max(...span.map((rect) => rect.bottom));
|
|
27100
|
+
let previousLane;
|
|
27101
|
+
do {
|
|
27102
|
+
previousLane = lane;
|
|
27103
|
+
for (const rect of obstacles) if (rect.right >= edge.end.x && rect.left <= edge.start.x && lane > rect.top && lane < rect.bottom) lane = side < 0 ? rect.top : rect.bottom;
|
|
27104
|
+
for (const other of feedback.slice(0, index)) {
|
|
27105
|
+
if (other.component !== edge.component || other.start.x < edge.end.x || other.end.x > edge.start.x) continue;
|
|
27106
|
+
if (side < 0 && other.returnLane <= lane) lane = other.returnLane - clearance;
|
|
27107
|
+
if (side > 0 && other.returnLane >= lane) lane = other.returnLane + clearance;
|
|
27108
|
+
}
|
|
27109
|
+
} while (lane !== previousLane);
|
|
27110
|
+
edge.returnLane = lane;
|
|
27111
|
+
}
|
|
27082
27112
|
const routes = /* @__PURE__ */ new Map();
|
|
27083
27113
|
const pending = connections.filter((edge) => {
|
|
27084
27114
|
if (edge.start.x > edge.end.x) return true;
|
|
@@ -27110,7 +27140,11 @@ var OpenFlowRenderer = (function(exports) {
|
|
|
27110
27140
|
});
|
|
27111
27141
|
if (!pending.length) return routes;
|
|
27112
27142
|
const xs = [.../* @__PURE__ */ new Set([...obstacles.flatMap((rect) => [rect.left, rect.right]), ...pending.flatMap((edge) => [edge.start.x, edge.end.x])])].toSorted((a, b) => a - b);
|
|
27113
|
-
const ys = [.../* @__PURE__ */ new Set([...obstacles.flatMap((rect) => [rect.top, rect.bottom]), ...pending.flatMap((edge) => [edge.start.y, edge.end.y]
|
|
27143
|
+
const ys = [.../* @__PURE__ */ new Set([...obstacles.flatMap((rect) => [rect.top, rect.bottom]), ...pending.flatMap((edge) => edge.returnLane == null ? [edge.start.y, edge.end.y] : [
|
|
27144
|
+
edge.start.y,
|
|
27145
|
+
edge.end.y,
|
|
27146
|
+
edge.returnLane
|
|
27147
|
+
])])].toSorted((a, b) => a - b);
|
|
27114
27148
|
const xIndex = new Map(xs.map((value, index) => [value, index]));
|
|
27115
27149
|
const yIndex = new Map(ys.map((value, index) => [value, index]));
|
|
27116
27150
|
const columns = xs.length;
|
|
@@ -27160,7 +27194,9 @@ var OpenFlowRenderer = (function(exports) {
|
|
|
27160
27194
|
];
|
|
27161
27195
|
for (const [index, next] of moves.entries()) {
|
|
27162
27196
|
if (next < 0 || vertex === start && index === 0 || next === end && index === 0) continue;
|
|
27163
|
-
if (edge.
|
|
27197
|
+
if (edge.returnLane != null) {
|
|
27198
|
+
if (index === 0 && ys[y] !== edge.returnLane) continue;
|
|
27199
|
+
} else if (edge.returnSide * (ys[Math.floor(next / columns)] - edge.start.y) < -1e-6) continue;
|
|
27164
27200
|
const axis = index < 2 ? 0 : 1;
|
|
27165
27201
|
const state = next * 2 + axis;
|
|
27166
27202
|
const length = Math.abs(xs[next % columns] - xs[x]) + Math.abs(ys[Math.floor(next / columns)] - ys[y]);
|
|
@@ -27175,7 +27211,10 @@ var OpenFlowRenderer = (function(exports) {
|
|
|
27175
27211
|
});
|
|
27176
27212
|
}
|
|
27177
27213
|
}
|
|
27178
|
-
if (finish < 0)
|
|
27214
|
+
if (finish < 0) {
|
|
27215
|
+
if (options.allowBlockedPorts) continue;
|
|
27216
|
+
throw new Error("Could not route the compact workflow connection.");
|
|
27217
|
+
}
|
|
27179
27218
|
const points = [];
|
|
27180
27219
|
for (let state = finish; state >= 0; state = previous[state]) {
|
|
27181
27220
|
const vertex = Math.floor(state / 2);
|
|
@@ -33545,7 +33584,8 @@ var OpenFlowRenderer = (function(exports) {
|
|
|
33545
33584
|
constructor(model, editable, language, callbacks, options = {}) {
|
|
33546
33585
|
this.canDeleteNodes = true;
|
|
33547
33586
|
this.dispose = disposableStore();
|
|
33548
|
-
this.
|
|
33587
|
+
this.exportRoutes = this.dispose.add(val(/* @__PURE__ */ new Map()));
|
|
33588
|
+
this.layoutRequest = this.dispose.add(val(0));
|
|
33549
33589
|
this.ignoredNodeIds = this.dispose.add(val([]));
|
|
33550
33590
|
this.ignoreNodes = (nodeIds, ignored) => {
|
|
33551
33591
|
if (this.$.editable.value) this.#callbacks.onIgnoreNodes?.(nodeIds, ignored);
|
|
@@ -33572,16 +33612,27 @@ var OpenFlowRenderer = (function(exports) {
|
|
|
33572
33612
|
};
|
|
33573
33613
|
this.disposed = false;
|
|
33574
33614
|
this.layoutMeasurementAttempts = 0;
|
|
33615
|
+
this.initialLayoutPending = false;
|
|
33575
33616
|
this.#modelDirection = "horizontal";
|
|
33576
33617
|
this.pendingNodeDeletes = /* @__PURE__ */ new Set();
|
|
33577
33618
|
this.pendingDisconnects = /* @__PURE__ */ new Map();
|
|
33578
33619
|
this.#entries = /* @__PURE__ */ new Map();
|
|
33579
33620
|
this.#modelPositions = /* @__PURE__ */ new Map();
|
|
33580
33621
|
this.#selectedNodeIds = /* @__PURE__ */ new Set();
|
|
33622
|
+
this.requestLayout = () => {
|
|
33623
|
+
if (this.disposed) return;
|
|
33624
|
+
this.layoutComplete = false;
|
|
33625
|
+
this.layoutMeasurementAttempts = 0;
|
|
33626
|
+
this.initialLayoutPending = true;
|
|
33627
|
+
this.layoutRequest.set(this.layoutRequest.value + 1);
|
|
33628
|
+
};
|
|
33581
33629
|
this.completeLayout = (availableWidth) => {
|
|
33582
33630
|
if (this.disposed || this.layoutComplete) return true;
|
|
33583
33631
|
const nodes = this.allLayoutNodes();
|
|
33584
|
-
if (nodes.length === 0 && !this.$.changingDirection.value)
|
|
33632
|
+
if (nodes.length === 0 && !this.$.changingDirection.value) {
|
|
33633
|
+
this.resolveInitialLayout(void 0);
|
|
33634
|
+
return true;
|
|
33635
|
+
}
|
|
33585
33636
|
for (const node of nodes) {
|
|
33586
33637
|
const measured = node.$.measured.value;
|
|
33587
33638
|
if (!measured?.width || !measured.height) {
|
|
@@ -33589,6 +33640,7 @@ var OpenFlowRenderer = (function(exports) {
|
|
|
33589
33640
|
this.layoutMeasurementAttempts = 0;
|
|
33590
33641
|
this.layoutComplete = true;
|
|
33591
33642
|
this.#restoreDirection();
|
|
33643
|
+
this.resolveInitialLayout(void 0);
|
|
33592
33644
|
return true;
|
|
33593
33645
|
}
|
|
33594
33646
|
}
|
|
@@ -33596,6 +33648,10 @@ var OpenFlowRenderer = (function(exports) {
|
|
|
33596
33648
|
this.applyPositions(positions);
|
|
33597
33649
|
this.layoutMeasurementAttempts = 0;
|
|
33598
33650
|
this.layoutComplete = true;
|
|
33651
|
+
this.resolveInitialLayout({
|
|
33652
|
+
direction: this.$.direction.value,
|
|
33653
|
+
positions
|
|
33654
|
+
});
|
|
33599
33655
|
if (this.$.changingDirection.value) this.#saveDirection(positions);
|
|
33600
33656
|
else this.#callbacks.onMoveNodes(positions);
|
|
33601
33657
|
return "relayout";
|
|
@@ -33730,7 +33786,7 @@ var OpenFlowRenderer = (function(exports) {
|
|
|
33730
33786
|
const commentNodes = this.dispose.add(reactiveMap(null, { onDeleted: dispose }));
|
|
33731
33787
|
const viewport = this.dispose.add(val(model.viewport, { equal: isSameViewport }));
|
|
33732
33788
|
this.rfCommand = this.dispose.add(createRFCommand(nodes));
|
|
33733
|
-
this.layoutComplete =
|
|
33789
|
+
this.layoutComplete = true;
|
|
33734
33790
|
this.#runStatus = this.dispose.add(val(model.runStatus == "running" ? FLOW_RUN_STATUS.Running : FLOW_RUN_STATUS.Idle));
|
|
33735
33791
|
this.#connections = this.dispose.add(val([]));
|
|
33736
33792
|
const edges = this.dispose.add(deriveEdges(this.#connections, nodes));
|
|
@@ -33767,8 +33823,14 @@ var OpenFlowRenderer = (function(exports) {
|
|
|
33767
33823
|
nodeMiniMapPhase: this.dispose.add(compute((get) => getNodeMinimap(get(nodes.$).size + get(commentNodes.$).size, get(viewport)?.zoom ?? 1)))
|
|
33768
33824
|
};
|
|
33769
33825
|
this.#syncModel(model);
|
|
33826
|
+
if (options.autoLayout) this.requestLayout();
|
|
33770
33827
|
if (options.defaultDirection != null) this.changeDirection(options.defaultDirection);
|
|
33771
33828
|
}
|
|
33829
|
+
resolveInitialLayout(layout) {
|
|
33830
|
+
if (!this.initialLayoutPending) return;
|
|
33831
|
+
this.initialLayoutPending = false;
|
|
33832
|
+
this.#callbacks.onInitialLayout?.(layout);
|
|
33833
|
+
}
|
|
33772
33834
|
async #saveDirection(positions) {
|
|
33773
33835
|
try {
|
|
33774
33836
|
if (!await this.#callbacks.onChangeDirection?.(this.$.direction.value, positions) && !this.disposed) this.#restoreDirection();
|
|
@@ -33874,7 +33936,7 @@ var OpenFlowRenderer = (function(exports) {
|
|
|
33874
33936
|
edges
|
|
33875
33937
|
}, insets, aspectRatio);
|
|
33876
33938
|
this.applyPositions(result.positions);
|
|
33877
|
-
this.
|
|
33939
|
+
this.exportRoutes.set(result.routes);
|
|
33878
33940
|
return result.bounds;
|
|
33879
33941
|
}
|
|
33880
33942
|
doRemoveNodes(nodes) {
|
|
@@ -56887,6 +56949,71 @@ var OpenFlowRenderer = (function(exports) {
|
|
|
56887
56949
|
return `${path} L ${end.x} ${end.y}`;
|
|
56888
56950
|
}
|
|
56889
56951
|
//#endregion
|
|
56952
|
+
//#region src/canvas/browser/graph/Edges/ConnectionRoutes.tsx
|
|
56953
|
+
init_use_value_enhancer();
|
|
56954
|
+
var emptyRoutes = /* @__PURE__ */ new Map();
|
|
56955
|
+
var emptyNodes = [];
|
|
56956
|
+
var emptyEdges = [];
|
|
56957
|
+
var ConnectionRoutesContext = (0, import_react$4.createContext)(emptyRoutes);
|
|
56958
|
+
function inactiveNodes() {
|
|
56959
|
+
return emptyNodes;
|
|
56960
|
+
}
|
|
56961
|
+
function measuredNodes(state) {
|
|
56962
|
+
return [...state.nodeLookup.values()].flatMap((node) => node.hidden || !node.measured.width || !node.measured.height ? [] : [{
|
|
56963
|
+
id: node.id,
|
|
56964
|
+
...layoutAxes(node.internals.positionAbsolute, "vertical"),
|
|
56965
|
+
width: node.measured.height,
|
|
56966
|
+
height: node.measured.width,
|
|
56967
|
+
column: 0,
|
|
56968
|
+
handles: node.internals.handleBounds
|
|
56969
|
+
}]);
|
|
56970
|
+
}
|
|
56971
|
+
function sameNodes(a, b) {
|
|
56972
|
+
return a.length === b.length && a.every((node, index) => shallowPlainObjectEqual(node, b[index]));
|
|
56973
|
+
}
|
|
56974
|
+
/** Share obstacle-aware routes using React Flow's measured cards and actual ports. */
|
|
56975
|
+
function ConnectionRoutesProvider({ direction, routes$, children }) {
|
|
56976
|
+
const planned = useVal(routes$);
|
|
56977
|
+
const active = direction === "vertical" && !planned?.size;
|
|
56978
|
+
const nodes = useStore$1(active ? measuredNodes : inactiveNodes, sameNodes);
|
|
56979
|
+
const edges = useStore$1((state) => active ? state.edges : emptyEdges);
|
|
56980
|
+
const routes = (0, import_react$4.useMemo)(() => {
|
|
56981
|
+
if (planned?.size) return planned;
|
|
56982
|
+
if (direction !== "vertical") return emptyRoutes;
|
|
56983
|
+
const byId = new Map(nodes.map((node) => [node.id, node]));
|
|
56984
|
+
const connections = edges.flatMap((edge) => {
|
|
56985
|
+
const source = byId.get(edge.source);
|
|
56986
|
+
const target = byId.get(edge.target);
|
|
56987
|
+
const output = source?.handles?.source?.find((handle) => edge.sourceHandle == null || handle.id === edge.sourceHandle);
|
|
56988
|
+
const input = target?.handles?.target?.find((handle) => edge.targetHandle == null || handle.id === edge.targetHandle);
|
|
56989
|
+
if (edge.hidden || !source || !target || output?.position !== Position$1.Bottom || input?.position !== Position$1.Top) return [];
|
|
56990
|
+
return [{
|
|
56991
|
+
id: edge.id,
|
|
56992
|
+
source: edge.source,
|
|
56993
|
+
target: edge.target,
|
|
56994
|
+
sourceOffset: {
|
|
56995
|
+
x: output.y + output.height,
|
|
56996
|
+
y: output.x + output.width / 2
|
|
56997
|
+
},
|
|
56998
|
+
targetOffset: {
|
|
56999
|
+
x: input.y,
|
|
57000
|
+
y: input.x + input.width / 2
|
|
57001
|
+
}
|
|
57002
|
+
}];
|
|
57003
|
+
});
|
|
57004
|
+
return new Map([...routeLayout(nodes, connections, { allowBlockedPorts: true })].map(([id, points]) => [id, points.map((point) => layoutAxes(point, "vertical"))]));
|
|
57005
|
+
}, [
|
|
57006
|
+
direction,
|
|
57007
|
+
nodes,
|
|
57008
|
+
edges,
|
|
57009
|
+
planned
|
|
57010
|
+
]);
|
|
57011
|
+
return /* @__PURE__ */ (0, import_jsx_runtime$2.jsx)(ConnectionRoutesContext.Provider, {
|
|
57012
|
+
value: routes,
|
|
57013
|
+
children
|
|
57014
|
+
});
|
|
57015
|
+
}
|
|
57016
|
+
//#endregion
|
|
56890
57017
|
//#region src/canvas/browser/graph/Edges/EdgeGradient.tsx
|
|
56891
57018
|
function EdgeGradient({ id, sourceX, sourceY, targetX, targetY, sourceColor, targetColor }) {
|
|
56892
57019
|
return /* @__PURE__ */ (0, import_jsx_runtime$2.jsx)("defs", { children: /* @__PURE__ */ (0, import_jsx_runtime$2.jsxs)("linearGradient", {
|
|
@@ -56914,7 +57041,7 @@ var OpenFlowRenderer = (function(exports) {
|
|
|
56914
57041
|
const error = useVal(edgeStore?.$.error);
|
|
56915
57042
|
const canvasStore = useCanvasStore();
|
|
56916
57043
|
const scale = useVal(canvasStore.$.scale);
|
|
56917
|
-
const routes =
|
|
57044
|
+
const routes = (0, import_react$4.useContext)(ConnectionRoutesContext);
|
|
56918
57045
|
const gap = 3;
|
|
56919
57046
|
const targetX = props.targetX + (props.targetPosition == Position$1.Left ? -3 : props.targetPosition == Position$1.Right ? gap : 0);
|
|
56920
57047
|
const targetY = props.targetY + (props.targetPosition == Position$1.Top ? -3 : props.targetPosition == Position$1.Bottom ? gap : 0);
|
|
@@ -123616,7 +123743,7 @@ var OpenFlowRenderer = (function(exports) {
|
|
|
123616
123743
|
* @returns {Location}
|
|
123617
123744
|
* Accessors for index.
|
|
123618
123745
|
*/
|
|
123619
|
-
function location(file) {
|
|
123746
|
+
function location$1(file) {
|
|
123620
123747
|
const value = String(file);
|
|
123621
123748
|
/**
|
|
123622
123749
|
* List, where each index is a line number (0-based), and each value is the
|
|
@@ -123736,7 +123863,7 @@ var OpenFlowRenderer = (function(exports) {
|
|
|
123736
123863
|
};
|
|
123737
123864
|
if (state.file && state.location) {
|
|
123738
123865
|
const document = String(state.file);
|
|
123739
|
-
const loc = location(document);
|
|
123866
|
+
const loc = location$1(document);
|
|
123740
123867
|
const start = loc.toPoint(0);
|
|
123741
123868
|
const end = loc.toPoint(document.length);
|
|
123742
123869
|
result.position = {
|
|
@@ -243402,7 +243529,7 @@ ${seriesRules.join("\n")}${tipRules}
|
|
|
243402
243529
|
};
|
|
243403
243530
|
var COMPILE_INVALID = /* @__PURE__ */ Symbol.for("zod.compile.invalid");
|
|
243404
243531
|
var COMPILE_FALLBACK = /* @__PURE__ */ Symbol.for("zod.compile.fallback");
|
|
243405
|
-
var validate = ((schema, value, _ctx) => {
|
|
243532
|
+
var validate$1 = ((schema, value, _ctx) => {
|
|
243406
243533
|
const validator = schema._zod.bag.validator;
|
|
243407
243534
|
if (validator !== void 0) {
|
|
243408
243535
|
if (validator(value) !== COMPILE_INVALID) return true;
|
|
@@ -247436,7 +247563,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
247436
247563
|
own(this, "spa", value);
|
|
247437
247564
|
},
|
|
247438
247565
|
validate(data, params) {
|
|
247439
|
-
return validate(this, data, params);
|
|
247566
|
+
return validate$1(this, data, params);
|
|
247440
247567
|
},
|
|
247441
247568
|
validateAsync(data, params) {
|
|
247442
247569
|
return validateAsync$1(this, data, params);
|
|
@@ -249685,9 +249812,13 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
249685
249812
|
i18n: props.i18n,
|
|
249686
249813
|
children: /* @__PURE__ */ (0, import_jsx_runtime$2.jsx)(TooltipProvider, {
|
|
249687
249814
|
delay: 300,
|
|
249688
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime$2.jsx)(ReactFlowProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime$2.jsx)(
|
|
249689
|
-
|
|
249690
|
-
|
|
249815
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime$2.jsx)(ReactFlowProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime$2.jsx)(ConnectionRoutesProvider, {
|
|
249816
|
+
direction: props.direction,
|
|
249817
|
+
routes$: props.connectionRoutes$,
|
|
249818
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime$2.jsx)(HandleContextProvider, {
|
|
249819
|
+
Handle: Handle$1,
|
|
249820
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime$2.jsx)(ReactFlowContainerInner, { ...props })
|
|
249821
|
+
})
|
|
249691
249822
|
}) })
|
|
249692
249823
|
})
|
|
249693
249824
|
})
|
|
@@ -249939,7 +250070,11 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
249939
250070
|
]);
|
|
249940
250071
|
(0, import_react$4.useLayoutEffect)(() => {
|
|
249941
250072
|
setLayoutReady(props.layoutMotion !== false || props.onLayoutMeasured == null);
|
|
249942
|
-
}, [
|
|
250073
|
+
}, [
|
|
250074
|
+
props.layoutMotion,
|
|
250075
|
+
props.onLayoutMeasured,
|
|
250076
|
+
props.layoutRequest
|
|
250077
|
+
]);
|
|
249943
250078
|
(0, import_react$4.useEffect)(() => {
|
|
249944
250079
|
let active = true;
|
|
249945
250080
|
let measurementFrame = 0;
|
|
@@ -249986,6 +250121,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
249986
250121
|
onBeforeFitView,
|
|
249987
250122
|
props.layoutMotion,
|
|
249988
250123
|
props.onLayoutMeasured,
|
|
250124
|
+
props.layoutRequest,
|
|
249989
250125
|
props.direction,
|
|
249990
250126
|
rf,
|
|
249991
250127
|
updateNodeInternals
|
|
@@ -250412,6 +250548,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
250412
250548
|
var FlowCanvas = ({ flowCanvasStore, annotationContext, onActivateSelection, onSelectionStart, onSelectionEnd, onInspectSelection, inspectorOpen = false, onRequestAddNode, cornerTools, cornerLeading, topLeftTools, bottomRightTools, toolbar, dark, dottedBackground, fitView, nodesDraggable, layoutMotion, className, addNodeRequest, addItemRequest, onInit, onMove, onMoveEnd, onNodeDragStop, onSelectionChange, isValidConnection, onDropAddItem }) => {
|
|
250413
250549
|
const editable = useVal(flowCanvasStore.$.editable);
|
|
250414
250550
|
const direction = useVal(flowCanvasStore.$.direction);
|
|
250551
|
+
const layoutRequest = useVal(flowCanvasStore.layoutRequest);
|
|
250415
250552
|
const changingDirection = useVal(flowCanvasStore.$.changingDirection);
|
|
250416
250553
|
const nodeMiniMapPhase = useVal(flowCanvasStore.$.nodeMiniMapPhase);
|
|
250417
250554
|
(0, import_react$4.useEffect)(flowCanvasStore.setupForceDelete, []);
|
|
@@ -250445,12 +250582,14 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
250445
250582
|
fitView: fitView ?? !editable,
|
|
250446
250583
|
fitViewOptions,
|
|
250447
250584
|
layoutMotion,
|
|
250585
|
+
layoutRequest,
|
|
250448
250586
|
nodeTypes: NODE_TYPES,
|
|
250449
250587
|
edgeTypes: EDGE_TYPES,
|
|
250450
250588
|
miniMapExpanded$: flowCanvasStore.$$.miniMapExpanded,
|
|
250451
250589
|
interactiveMode$: flowCanvasStore.$$.interactiveMode,
|
|
250452
250590
|
nodes$: flowCanvasStore.$.rfNodes,
|
|
250453
250591
|
edges$: flowCanvasStore.$.rfEdges,
|
|
250592
|
+
connectionRoutes$: flowCanvasStore.exportRoutes,
|
|
250454
250593
|
viewport$: flowCanvasStore.$$.viewport,
|
|
250455
250594
|
onRequestAddNode,
|
|
250456
250595
|
addNodeRequest,
|
|
@@ -261369,6 +261508,136 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
261369
261508
|
bodyFormat: _enum(["none", "json"]).default("none")
|
|
261370
261509
|
}).extend({ kind: literal("connector-proxy") });
|
|
261371
261510
|
//#endregion
|
|
261511
|
+
//#region ../../node_modules/.bun/@cfworker+json-schema@4.1.1/node_modules/@cfworker/json-schema/dist/esm/deep-compare-strict.js
|
|
261512
|
+
function deepCompareStrict(a, b) {
|
|
261513
|
+
const typeofa = typeof a;
|
|
261514
|
+
if (typeofa !== typeof b) return false;
|
|
261515
|
+
if (Array.isArray(a)) {
|
|
261516
|
+
if (!Array.isArray(b)) return false;
|
|
261517
|
+
const length = a.length;
|
|
261518
|
+
if (length !== b.length) return false;
|
|
261519
|
+
for (let i = 0; i < length; i++) if (!deepCompareStrict(a[i], b[i])) return false;
|
|
261520
|
+
return true;
|
|
261521
|
+
}
|
|
261522
|
+
if (typeofa === "object") {
|
|
261523
|
+
if (!a || !b) return a === b;
|
|
261524
|
+
const aKeys = Object.keys(a);
|
|
261525
|
+
const bKeys = Object.keys(b);
|
|
261526
|
+
if (aKeys.length !== bKeys.length) return false;
|
|
261527
|
+
for (const k of aKeys) if (!deepCompareStrict(a[k], b[k])) return false;
|
|
261528
|
+
return true;
|
|
261529
|
+
}
|
|
261530
|
+
return a === b;
|
|
261531
|
+
}
|
|
261532
|
+
//#endregion
|
|
261533
|
+
//#region ../../node_modules/.bun/@cfworker+json-schema@4.1.1/node_modules/@cfworker/json-schema/dist/esm/pointer.js
|
|
261534
|
+
function encodePointer(p) {
|
|
261535
|
+
return encodeURI(escapePointer(p));
|
|
261536
|
+
}
|
|
261537
|
+
function escapePointer(p) {
|
|
261538
|
+
return p.replace(/~/g, "~0").replace(/\//g, "~1");
|
|
261539
|
+
}
|
|
261540
|
+
//#endregion
|
|
261541
|
+
//#region ../../node_modules/.bun/@cfworker+json-schema@4.1.1/node_modules/@cfworker/json-schema/dist/esm/dereference.js
|
|
261542
|
+
var schemaArrayKeyword = {
|
|
261543
|
+
prefixItems: true,
|
|
261544
|
+
items: true,
|
|
261545
|
+
allOf: true,
|
|
261546
|
+
anyOf: true,
|
|
261547
|
+
oneOf: true
|
|
261548
|
+
};
|
|
261549
|
+
var schemaMapKeyword = {
|
|
261550
|
+
$defs: true,
|
|
261551
|
+
definitions: true,
|
|
261552
|
+
properties: true,
|
|
261553
|
+
patternProperties: true,
|
|
261554
|
+
dependentSchemas: true
|
|
261555
|
+
};
|
|
261556
|
+
var ignoredKeyword = {
|
|
261557
|
+
id: true,
|
|
261558
|
+
$id: true,
|
|
261559
|
+
$ref: true,
|
|
261560
|
+
$schema: true,
|
|
261561
|
+
$anchor: true,
|
|
261562
|
+
$vocabulary: true,
|
|
261563
|
+
$comment: true,
|
|
261564
|
+
default: true,
|
|
261565
|
+
enum: true,
|
|
261566
|
+
const: true,
|
|
261567
|
+
required: true,
|
|
261568
|
+
type: true,
|
|
261569
|
+
maximum: true,
|
|
261570
|
+
minimum: true,
|
|
261571
|
+
exclusiveMaximum: true,
|
|
261572
|
+
exclusiveMinimum: true,
|
|
261573
|
+
multipleOf: true,
|
|
261574
|
+
maxLength: true,
|
|
261575
|
+
minLength: true,
|
|
261576
|
+
pattern: true,
|
|
261577
|
+
format: true,
|
|
261578
|
+
maxItems: true,
|
|
261579
|
+
minItems: true,
|
|
261580
|
+
uniqueItems: true,
|
|
261581
|
+
maxProperties: true,
|
|
261582
|
+
minProperties: true
|
|
261583
|
+
};
|
|
261584
|
+
var initialBaseURI = typeof self !== "undefined" && self.location && self.location.origin !== "null" ? new URL(self.location.origin + self.location.pathname + location.search) : new URL("https://github.com/cfworker");
|
|
261585
|
+
function dereference(schema, lookup = Object.create(null), baseURI = initialBaseURI, basePointer = "") {
|
|
261586
|
+
if (schema && typeof schema === "object" && !Array.isArray(schema)) {
|
|
261587
|
+
const id = schema.$id || schema.id;
|
|
261588
|
+
if (id) {
|
|
261589
|
+
const url = new URL(id, baseURI.href);
|
|
261590
|
+
if (url.hash.length > 1) lookup[url.href] = schema;
|
|
261591
|
+
else {
|
|
261592
|
+
url.hash = "";
|
|
261593
|
+
if (basePointer === "") baseURI = url;
|
|
261594
|
+
else dereference(schema, lookup, baseURI);
|
|
261595
|
+
}
|
|
261596
|
+
}
|
|
261597
|
+
} else if (schema !== true && schema !== false) return lookup;
|
|
261598
|
+
const schemaURI = baseURI.href + (basePointer ? "#" + basePointer : "");
|
|
261599
|
+
if (lookup[schemaURI] !== void 0) throw new Error(`Duplicate schema URI "${schemaURI}".`);
|
|
261600
|
+
lookup[schemaURI] = schema;
|
|
261601
|
+
if (schema === true || schema === false) return lookup;
|
|
261602
|
+
if (schema.__absolute_uri__ === void 0) Object.defineProperty(schema, "__absolute_uri__", {
|
|
261603
|
+
enumerable: false,
|
|
261604
|
+
value: schemaURI
|
|
261605
|
+
});
|
|
261606
|
+
if (schema.$ref && schema.__absolute_ref__ === void 0) {
|
|
261607
|
+
const url = new URL(schema.$ref, baseURI.href);
|
|
261608
|
+
url.hash = url.hash;
|
|
261609
|
+
Object.defineProperty(schema, "__absolute_ref__", {
|
|
261610
|
+
enumerable: false,
|
|
261611
|
+
value: url.href
|
|
261612
|
+
});
|
|
261613
|
+
}
|
|
261614
|
+
if (schema.$recursiveRef && schema.__absolute_recursive_ref__ === void 0) {
|
|
261615
|
+
const url = new URL(schema.$recursiveRef, baseURI.href);
|
|
261616
|
+
url.hash = url.hash;
|
|
261617
|
+
Object.defineProperty(schema, "__absolute_recursive_ref__", {
|
|
261618
|
+
enumerable: false,
|
|
261619
|
+
value: url.href
|
|
261620
|
+
});
|
|
261621
|
+
}
|
|
261622
|
+
if (schema.$anchor) {
|
|
261623
|
+
const url = new URL("#" + schema.$anchor, baseURI.href);
|
|
261624
|
+
lookup[url.href] = schema;
|
|
261625
|
+
}
|
|
261626
|
+
for (let key in schema) {
|
|
261627
|
+
if (ignoredKeyword[key]) continue;
|
|
261628
|
+
const keyBase = `${basePointer}/${encodePointer(key)}`;
|
|
261629
|
+
const subSchema = schema[key];
|
|
261630
|
+
if (Array.isArray(subSchema)) {
|
|
261631
|
+
if (schemaArrayKeyword[key]) {
|
|
261632
|
+
const length = subSchema.length;
|
|
261633
|
+
for (let i = 0; i < length; i++) dereference(subSchema[i], lookup, baseURI, `${keyBase}/${i}`);
|
|
261634
|
+
}
|
|
261635
|
+
} else if (schemaMapKeyword[key]) for (let subKey in subSchema) dereference(subSchema[subKey], lookup, baseURI, `${keyBase}/${encodePointer(subKey)}`);
|
|
261636
|
+
else dereference(subSchema, lookup, baseURI, keyBase);
|
|
261637
|
+
}
|
|
261638
|
+
return lookup;
|
|
261639
|
+
}
|
|
261640
|
+
//#endregion
|
|
261372
261641
|
//#region ../../node_modules/.bun/@cfworker+json-schema@4.1.1/node_modules/@cfworker/json-schema/dist/esm/format.js
|
|
261373
261642
|
var DATE = /^(\d\d\d\d)-(\d\d)-(\d\d)$/;
|
|
261374
261643
|
var DAYS = [
|
|
@@ -261469,6 +261738,656 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
261469
261738
|
}
|
|
261470
261739
|
}
|
|
261471
261740
|
//#endregion
|
|
261741
|
+
//#region ../../node_modules/.bun/@cfworker+json-schema@4.1.1/node_modules/@cfworker/json-schema/dist/esm/ucs2-length.js
|
|
261742
|
+
function ucs2length(s) {
|
|
261743
|
+
let result = 0;
|
|
261744
|
+
let length = s.length;
|
|
261745
|
+
let index = 0;
|
|
261746
|
+
let charCode;
|
|
261747
|
+
while (index < length) {
|
|
261748
|
+
result++;
|
|
261749
|
+
charCode = s.charCodeAt(index++);
|
|
261750
|
+
if (charCode >= 55296 && charCode <= 56319 && index < length) {
|
|
261751
|
+
charCode = s.charCodeAt(index);
|
|
261752
|
+
if ((charCode & 64512) == 56320) index++;
|
|
261753
|
+
}
|
|
261754
|
+
}
|
|
261755
|
+
return result;
|
|
261756
|
+
}
|
|
261757
|
+
//#endregion
|
|
261758
|
+
//#region ../../node_modules/.bun/@cfworker+json-schema@4.1.1/node_modules/@cfworker/json-schema/dist/esm/validate.js
|
|
261759
|
+
function validate(instance, schema, draft = "2019-09", lookup = dereference(schema), shortCircuit = true, recursiveAnchor = null, instanceLocation = "#", schemaLocation = "#", evaluated = Object.create(null)) {
|
|
261760
|
+
if (schema === true) return {
|
|
261761
|
+
valid: true,
|
|
261762
|
+
errors: []
|
|
261763
|
+
};
|
|
261764
|
+
if (schema === false) return {
|
|
261765
|
+
valid: false,
|
|
261766
|
+
errors: [{
|
|
261767
|
+
instanceLocation,
|
|
261768
|
+
keyword: "false",
|
|
261769
|
+
keywordLocation: instanceLocation,
|
|
261770
|
+
error: "False boolean schema."
|
|
261771
|
+
}]
|
|
261772
|
+
};
|
|
261773
|
+
const rawInstanceType = typeof instance;
|
|
261774
|
+
let instanceType;
|
|
261775
|
+
switch (rawInstanceType) {
|
|
261776
|
+
case "boolean":
|
|
261777
|
+
case "number":
|
|
261778
|
+
case "string":
|
|
261779
|
+
instanceType = rawInstanceType;
|
|
261780
|
+
break;
|
|
261781
|
+
case "object":
|
|
261782
|
+
if (instance === null) instanceType = "null";
|
|
261783
|
+
else if (Array.isArray(instance)) instanceType = "array";
|
|
261784
|
+
else instanceType = "object";
|
|
261785
|
+
break;
|
|
261786
|
+
default: throw new Error(`Instances of "${rawInstanceType}" type are not supported.`);
|
|
261787
|
+
}
|
|
261788
|
+
const { $ref, $recursiveRef, $recursiveAnchor, type: $type, const: $const, enum: $enum, required: $required, not: $not, anyOf: $anyOf, allOf: $allOf, oneOf: $oneOf, if: $if, then: $then, else: $else, format: $format, properties: $properties, patternProperties: $patternProperties, additionalProperties: $additionalProperties, unevaluatedProperties: $unevaluatedProperties, minProperties: $minProperties, maxProperties: $maxProperties, propertyNames: $propertyNames, dependentRequired: $dependentRequired, dependentSchemas: $dependentSchemas, dependencies: $dependencies, prefixItems: $prefixItems, items: $items, additionalItems: $additionalItems, unevaluatedItems: $unevaluatedItems, contains: $contains, minContains: $minContains, maxContains: $maxContains, minItems: $minItems, maxItems: $maxItems, uniqueItems: $uniqueItems, minimum: $minimum, maximum: $maximum, exclusiveMinimum: $exclusiveMinimum, exclusiveMaximum: $exclusiveMaximum, multipleOf: $multipleOf, minLength: $minLength, maxLength: $maxLength, pattern: $pattern, __absolute_ref__, __absolute_recursive_ref__ } = schema;
|
|
261789
|
+
const errors = [];
|
|
261790
|
+
if ($recursiveAnchor === true && recursiveAnchor === null) recursiveAnchor = schema;
|
|
261791
|
+
if ($recursiveRef === "#") {
|
|
261792
|
+
const refSchema = recursiveAnchor === null ? lookup[__absolute_recursive_ref__] : recursiveAnchor;
|
|
261793
|
+
const keywordLocation = `${schemaLocation}/$recursiveRef`;
|
|
261794
|
+
const result = validate(instance, recursiveAnchor === null ? schema : recursiveAnchor, draft, lookup, shortCircuit, refSchema, instanceLocation, keywordLocation, evaluated);
|
|
261795
|
+
if (!result.valid) errors.push({
|
|
261796
|
+
instanceLocation,
|
|
261797
|
+
keyword: "$recursiveRef",
|
|
261798
|
+
keywordLocation,
|
|
261799
|
+
error: "A subschema had errors."
|
|
261800
|
+
}, ...result.errors);
|
|
261801
|
+
}
|
|
261802
|
+
if ($ref !== void 0) {
|
|
261803
|
+
const refSchema = lookup[__absolute_ref__ || $ref];
|
|
261804
|
+
if (refSchema === void 0) {
|
|
261805
|
+
let message = `Unresolved $ref "${$ref}".`;
|
|
261806
|
+
if (__absolute_ref__ && __absolute_ref__ !== $ref) message += ` Absolute URI "${__absolute_ref__}".`;
|
|
261807
|
+
message += `\nKnown schemas:\n- ${Object.keys(lookup).join("\n- ")}`;
|
|
261808
|
+
throw new Error(message);
|
|
261809
|
+
}
|
|
261810
|
+
const keywordLocation = `${schemaLocation}/$ref`;
|
|
261811
|
+
const result = validate(instance, refSchema, draft, lookup, shortCircuit, recursiveAnchor, instanceLocation, keywordLocation, evaluated);
|
|
261812
|
+
if (!result.valid) errors.push({
|
|
261813
|
+
instanceLocation,
|
|
261814
|
+
keyword: "$ref",
|
|
261815
|
+
keywordLocation,
|
|
261816
|
+
error: "A subschema had errors."
|
|
261817
|
+
}, ...result.errors);
|
|
261818
|
+
if (draft === "4" || draft === "7") return {
|
|
261819
|
+
valid: errors.length === 0,
|
|
261820
|
+
errors
|
|
261821
|
+
};
|
|
261822
|
+
}
|
|
261823
|
+
if (Array.isArray($type)) {
|
|
261824
|
+
let length = $type.length;
|
|
261825
|
+
let valid = false;
|
|
261826
|
+
for (let i = 0; i < length; i++) if (instanceType === $type[i] || $type[i] === "integer" && instanceType === "number" && instance % 1 === 0 && instance === instance) {
|
|
261827
|
+
valid = true;
|
|
261828
|
+
break;
|
|
261829
|
+
}
|
|
261830
|
+
if (!valid) errors.push({
|
|
261831
|
+
instanceLocation,
|
|
261832
|
+
keyword: "type",
|
|
261833
|
+
keywordLocation: `${schemaLocation}/type`,
|
|
261834
|
+
error: `Instance type "${instanceType}" is invalid. Expected "${$type.join("\", \"")}".`
|
|
261835
|
+
});
|
|
261836
|
+
} else if ($type === "integer") {
|
|
261837
|
+
if (instanceType !== "number" || instance % 1 || instance !== instance) errors.push({
|
|
261838
|
+
instanceLocation,
|
|
261839
|
+
keyword: "type",
|
|
261840
|
+
keywordLocation: `${schemaLocation}/type`,
|
|
261841
|
+
error: `Instance type "${instanceType}" is invalid. Expected "${$type}".`
|
|
261842
|
+
});
|
|
261843
|
+
} else if ($type !== void 0 && instanceType !== $type) errors.push({
|
|
261844
|
+
instanceLocation,
|
|
261845
|
+
keyword: "type",
|
|
261846
|
+
keywordLocation: `${schemaLocation}/type`,
|
|
261847
|
+
error: `Instance type "${instanceType}" is invalid. Expected "${$type}".`
|
|
261848
|
+
});
|
|
261849
|
+
if ($const !== void 0) {
|
|
261850
|
+
if (instanceType === "object" || instanceType === "array") {
|
|
261851
|
+
if (!deepCompareStrict(instance, $const)) errors.push({
|
|
261852
|
+
instanceLocation,
|
|
261853
|
+
keyword: "const",
|
|
261854
|
+
keywordLocation: `${schemaLocation}/const`,
|
|
261855
|
+
error: `Instance does not match ${JSON.stringify($const)}.`
|
|
261856
|
+
});
|
|
261857
|
+
} else if (instance !== $const) errors.push({
|
|
261858
|
+
instanceLocation,
|
|
261859
|
+
keyword: "const",
|
|
261860
|
+
keywordLocation: `${schemaLocation}/const`,
|
|
261861
|
+
error: `Instance does not match ${JSON.stringify($const)}.`
|
|
261862
|
+
});
|
|
261863
|
+
}
|
|
261864
|
+
if ($enum !== void 0) {
|
|
261865
|
+
if (instanceType === "object" || instanceType === "array") {
|
|
261866
|
+
if (!$enum.some((value) => deepCompareStrict(instance, value))) errors.push({
|
|
261867
|
+
instanceLocation,
|
|
261868
|
+
keyword: "enum",
|
|
261869
|
+
keywordLocation: `${schemaLocation}/enum`,
|
|
261870
|
+
error: `Instance does not match any of ${JSON.stringify($enum)}.`
|
|
261871
|
+
});
|
|
261872
|
+
} else if (!$enum.some((value) => instance === value)) errors.push({
|
|
261873
|
+
instanceLocation,
|
|
261874
|
+
keyword: "enum",
|
|
261875
|
+
keywordLocation: `${schemaLocation}/enum`,
|
|
261876
|
+
error: `Instance does not match any of ${JSON.stringify($enum)}.`
|
|
261877
|
+
});
|
|
261878
|
+
}
|
|
261879
|
+
if ($not !== void 0) {
|
|
261880
|
+
const keywordLocation = `${schemaLocation}/not`;
|
|
261881
|
+
if (validate(instance, $not, draft, lookup, shortCircuit, recursiveAnchor, instanceLocation, keywordLocation).valid) errors.push({
|
|
261882
|
+
instanceLocation,
|
|
261883
|
+
keyword: "not",
|
|
261884
|
+
keywordLocation,
|
|
261885
|
+
error: "Instance matched \"not\" schema."
|
|
261886
|
+
});
|
|
261887
|
+
}
|
|
261888
|
+
let subEvaluateds = [];
|
|
261889
|
+
if ($anyOf !== void 0) {
|
|
261890
|
+
const keywordLocation = `${schemaLocation}/anyOf`;
|
|
261891
|
+
const errorsLength = errors.length;
|
|
261892
|
+
let anyValid = false;
|
|
261893
|
+
for (let i = 0; i < $anyOf.length; i++) {
|
|
261894
|
+
const subSchema = $anyOf[i];
|
|
261895
|
+
const subEvaluated = Object.create(evaluated);
|
|
261896
|
+
const result = validate(instance, subSchema, draft, lookup, shortCircuit, $recursiveAnchor === true ? recursiveAnchor : null, instanceLocation, `${keywordLocation}/${i}`, subEvaluated);
|
|
261897
|
+
errors.push(...result.errors);
|
|
261898
|
+
anyValid = anyValid || result.valid;
|
|
261899
|
+
if (result.valid) subEvaluateds.push(subEvaluated);
|
|
261900
|
+
}
|
|
261901
|
+
if (anyValid) errors.length = errorsLength;
|
|
261902
|
+
else errors.splice(errorsLength, 0, {
|
|
261903
|
+
instanceLocation,
|
|
261904
|
+
keyword: "anyOf",
|
|
261905
|
+
keywordLocation,
|
|
261906
|
+
error: "Instance does not match any subschemas."
|
|
261907
|
+
});
|
|
261908
|
+
}
|
|
261909
|
+
if ($allOf !== void 0) {
|
|
261910
|
+
const keywordLocation = `${schemaLocation}/allOf`;
|
|
261911
|
+
const errorsLength = errors.length;
|
|
261912
|
+
let allValid = true;
|
|
261913
|
+
for (let i = 0; i < $allOf.length; i++) {
|
|
261914
|
+
const subSchema = $allOf[i];
|
|
261915
|
+
const subEvaluated = Object.create(evaluated);
|
|
261916
|
+
const result = validate(instance, subSchema, draft, lookup, shortCircuit, $recursiveAnchor === true ? recursiveAnchor : null, instanceLocation, `${keywordLocation}/${i}`, subEvaluated);
|
|
261917
|
+
errors.push(...result.errors);
|
|
261918
|
+
allValid = allValid && result.valid;
|
|
261919
|
+
if (result.valid) subEvaluateds.push(subEvaluated);
|
|
261920
|
+
}
|
|
261921
|
+
if (allValid) errors.length = errorsLength;
|
|
261922
|
+
else errors.splice(errorsLength, 0, {
|
|
261923
|
+
instanceLocation,
|
|
261924
|
+
keyword: "allOf",
|
|
261925
|
+
keywordLocation,
|
|
261926
|
+
error: `Instance does not match every subschema.`
|
|
261927
|
+
});
|
|
261928
|
+
}
|
|
261929
|
+
if ($oneOf !== void 0) {
|
|
261930
|
+
const keywordLocation = `${schemaLocation}/oneOf`;
|
|
261931
|
+
const errorsLength = errors.length;
|
|
261932
|
+
const matches = $oneOf.filter((subSchema, i) => {
|
|
261933
|
+
const subEvaluated = Object.create(evaluated);
|
|
261934
|
+
const result = validate(instance, subSchema, draft, lookup, shortCircuit, $recursiveAnchor === true ? recursiveAnchor : null, instanceLocation, `${keywordLocation}/${i}`, subEvaluated);
|
|
261935
|
+
errors.push(...result.errors);
|
|
261936
|
+
if (result.valid) subEvaluateds.push(subEvaluated);
|
|
261937
|
+
return result.valid;
|
|
261938
|
+
}).length;
|
|
261939
|
+
if (matches === 1) errors.length = errorsLength;
|
|
261940
|
+
else errors.splice(errorsLength, 0, {
|
|
261941
|
+
instanceLocation,
|
|
261942
|
+
keyword: "oneOf",
|
|
261943
|
+
keywordLocation,
|
|
261944
|
+
error: `Instance does not match exactly one subschema (${matches} matches).`
|
|
261945
|
+
});
|
|
261946
|
+
}
|
|
261947
|
+
if (instanceType === "object" || instanceType === "array") Object.assign(evaluated, ...subEvaluateds);
|
|
261948
|
+
if ($if !== void 0) {
|
|
261949
|
+
const keywordLocation = `${schemaLocation}/if`;
|
|
261950
|
+
if (validate(instance, $if, draft, lookup, shortCircuit, recursiveAnchor, instanceLocation, keywordLocation, evaluated).valid) {
|
|
261951
|
+
if ($then !== void 0) {
|
|
261952
|
+
const thenResult = validate(instance, $then, draft, lookup, shortCircuit, recursiveAnchor, instanceLocation, `${schemaLocation}/then`, evaluated);
|
|
261953
|
+
if (!thenResult.valid) errors.push({
|
|
261954
|
+
instanceLocation,
|
|
261955
|
+
keyword: "if",
|
|
261956
|
+
keywordLocation,
|
|
261957
|
+
error: `Instance does not match "then" schema.`
|
|
261958
|
+
}, ...thenResult.errors);
|
|
261959
|
+
}
|
|
261960
|
+
} else if ($else !== void 0) {
|
|
261961
|
+
const elseResult = validate(instance, $else, draft, lookup, shortCircuit, recursiveAnchor, instanceLocation, `${schemaLocation}/else`, evaluated);
|
|
261962
|
+
if (!elseResult.valid) errors.push({
|
|
261963
|
+
instanceLocation,
|
|
261964
|
+
keyword: "if",
|
|
261965
|
+
keywordLocation,
|
|
261966
|
+
error: `Instance does not match "else" schema.`
|
|
261967
|
+
}, ...elseResult.errors);
|
|
261968
|
+
}
|
|
261969
|
+
}
|
|
261970
|
+
if (instanceType === "object") {
|
|
261971
|
+
if ($required !== void 0) {
|
|
261972
|
+
for (const key of $required) if (!(key in instance)) errors.push({
|
|
261973
|
+
instanceLocation,
|
|
261974
|
+
keyword: "required",
|
|
261975
|
+
keywordLocation: `${schemaLocation}/required`,
|
|
261976
|
+
error: `Instance does not have required property "${key}".`
|
|
261977
|
+
});
|
|
261978
|
+
}
|
|
261979
|
+
const keys = Object.keys(instance);
|
|
261980
|
+
if ($minProperties !== void 0 && keys.length < $minProperties) errors.push({
|
|
261981
|
+
instanceLocation,
|
|
261982
|
+
keyword: "minProperties",
|
|
261983
|
+
keywordLocation: `${schemaLocation}/minProperties`,
|
|
261984
|
+
error: `Instance does not have at least ${$minProperties} properties.`
|
|
261985
|
+
});
|
|
261986
|
+
if ($maxProperties !== void 0 && keys.length > $maxProperties) errors.push({
|
|
261987
|
+
instanceLocation,
|
|
261988
|
+
keyword: "maxProperties",
|
|
261989
|
+
keywordLocation: `${schemaLocation}/maxProperties`,
|
|
261990
|
+
error: `Instance does not have at least ${$maxProperties} properties.`
|
|
261991
|
+
});
|
|
261992
|
+
if ($propertyNames !== void 0) {
|
|
261993
|
+
const keywordLocation = `${schemaLocation}/propertyNames`;
|
|
261994
|
+
for (const key in instance) {
|
|
261995
|
+
const subInstancePointer = `${instanceLocation}/${encodePointer(key)}`;
|
|
261996
|
+
const result = validate(key, $propertyNames, draft, lookup, shortCircuit, recursiveAnchor, subInstancePointer, keywordLocation);
|
|
261997
|
+
if (!result.valid) errors.push({
|
|
261998
|
+
instanceLocation,
|
|
261999
|
+
keyword: "propertyNames",
|
|
262000
|
+
keywordLocation,
|
|
262001
|
+
error: `Property name "${key}" does not match schema.`
|
|
262002
|
+
}, ...result.errors);
|
|
262003
|
+
}
|
|
262004
|
+
}
|
|
262005
|
+
if ($dependentRequired !== void 0) {
|
|
262006
|
+
const keywordLocation = `${schemaLocation}/dependantRequired`;
|
|
262007
|
+
for (const key in $dependentRequired) if (key in instance) {
|
|
262008
|
+
const required = $dependentRequired[key];
|
|
262009
|
+
for (const dependantKey of required) if (!(dependantKey in instance)) errors.push({
|
|
262010
|
+
instanceLocation,
|
|
262011
|
+
keyword: "dependentRequired",
|
|
262012
|
+
keywordLocation,
|
|
262013
|
+
error: `Instance has "${key}" but does not have "${dependantKey}".`
|
|
262014
|
+
});
|
|
262015
|
+
}
|
|
262016
|
+
}
|
|
262017
|
+
if ($dependentSchemas !== void 0) for (const key in $dependentSchemas) {
|
|
262018
|
+
const keywordLocation = `${schemaLocation}/dependentSchemas`;
|
|
262019
|
+
if (key in instance) {
|
|
262020
|
+
const result = validate(instance, $dependentSchemas[key], draft, lookup, shortCircuit, recursiveAnchor, instanceLocation, `${keywordLocation}/${encodePointer(key)}`, evaluated);
|
|
262021
|
+
if (!result.valid) errors.push({
|
|
262022
|
+
instanceLocation,
|
|
262023
|
+
keyword: "dependentSchemas",
|
|
262024
|
+
keywordLocation,
|
|
262025
|
+
error: `Instance has "${key}" but does not match dependant schema.`
|
|
262026
|
+
}, ...result.errors);
|
|
262027
|
+
}
|
|
262028
|
+
}
|
|
262029
|
+
if ($dependencies !== void 0) {
|
|
262030
|
+
const keywordLocation = `${schemaLocation}/dependencies`;
|
|
262031
|
+
for (const key in $dependencies) if (key in instance) {
|
|
262032
|
+
const propsOrSchema = $dependencies[key];
|
|
262033
|
+
if (Array.isArray(propsOrSchema)) {
|
|
262034
|
+
for (const dependantKey of propsOrSchema) if (!(dependantKey in instance)) errors.push({
|
|
262035
|
+
instanceLocation,
|
|
262036
|
+
keyword: "dependencies",
|
|
262037
|
+
keywordLocation,
|
|
262038
|
+
error: `Instance has "${key}" but does not have "${dependantKey}".`
|
|
262039
|
+
});
|
|
262040
|
+
} else {
|
|
262041
|
+
const result = validate(instance, propsOrSchema, draft, lookup, shortCircuit, recursiveAnchor, instanceLocation, `${keywordLocation}/${encodePointer(key)}`);
|
|
262042
|
+
if (!result.valid) errors.push({
|
|
262043
|
+
instanceLocation,
|
|
262044
|
+
keyword: "dependencies",
|
|
262045
|
+
keywordLocation,
|
|
262046
|
+
error: `Instance has "${key}" but does not match dependant schema.`
|
|
262047
|
+
}, ...result.errors);
|
|
262048
|
+
}
|
|
262049
|
+
}
|
|
262050
|
+
}
|
|
262051
|
+
const thisEvaluated = Object.create(null);
|
|
262052
|
+
let stop = false;
|
|
262053
|
+
if ($properties !== void 0) {
|
|
262054
|
+
const keywordLocation = `${schemaLocation}/properties`;
|
|
262055
|
+
for (const key in $properties) {
|
|
262056
|
+
if (!(key in instance)) continue;
|
|
262057
|
+
const subInstancePointer = `${instanceLocation}/${encodePointer(key)}`;
|
|
262058
|
+
const result = validate(instance[key], $properties[key], draft, lookup, shortCircuit, recursiveAnchor, subInstancePointer, `${keywordLocation}/${encodePointer(key)}`);
|
|
262059
|
+
if (result.valid) evaluated[key] = thisEvaluated[key] = true;
|
|
262060
|
+
else {
|
|
262061
|
+
stop = shortCircuit;
|
|
262062
|
+
errors.push({
|
|
262063
|
+
instanceLocation,
|
|
262064
|
+
keyword: "properties",
|
|
262065
|
+
keywordLocation,
|
|
262066
|
+
error: `Property "${key}" does not match schema.`
|
|
262067
|
+
}, ...result.errors);
|
|
262068
|
+
if (stop) break;
|
|
262069
|
+
}
|
|
262070
|
+
}
|
|
262071
|
+
}
|
|
262072
|
+
if (!stop && $patternProperties !== void 0) {
|
|
262073
|
+
const keywordLocation = `${schemaLocation}/patternProperties`;
|
|
262074
|
+
for (const pattern in $patternProperties) {
|
|
262075
|
+
const regex = new RegExp(pattern, "u");
|
|
262076
|
+
const subSchema = $patternProperties[pattern];
|
|
262077
|
+
for (const key in instance) {
|
|
262078
|
+
if (!regex.test(key)) continue;
|
|
262079
|
+
const subInstancePointer = `${instanceLocation}/${encodePointer(key)}`;
|
|
262080
|
+
const result = validate(instance[key], subSchema, draft, lookup, shortCircuit, recursiveAnchor, subInstancePointer, `${keywordLocation}/${encodePointer(pattern)}`);
|
|
262081
|
+
if (result.valid) evaluated[key] = thisEvaluated[key] = true;
|
|
262082
|
+
else {
|
|
262083
|
+
stop = shortCircuit;
|
|
262084
|
+
errors.push({
|
|
262085
|
+
instanceLocation,
|
|
262086
|
+
keyword: "patternProperties",
|
|
262087
|
+
keywordLocation,
|
|
262088
|
+
error: `Property "${key}" matches pattern "${pattern}" but does not match associated schema.`
|
|
262089
|
+
}, ...result.errors);
|
|
262090
|
+
}
|
|
262091
|
+
}
|
|
262092
|
+
}
|
|
262093
|
+
}
|
|
262094
|
+
if (!stop && $additionalProperties !== void 0) {
|
|
262095
|
+
const keywordLocation = `${schemaLocation}/additionalProperties`;
|
|
262096
|
+
for (const key in instance) {
|
|
262097
|
+
if (thisEvaluated[key]) continue;
|
|
262098
|
+
const subInstancePointer = `${instanceLocation}/${encodePointer(key)}`;
|
|
262099
|
+
const result = validate(instance[key], $additionalProperties, draft, lookup, shortCircuit, recursiveAnchor, subInstancePointer, keywordLocation);
|
|
262100
|
+
if (result.valid) evaluated[key] = true;
|
|
262101
|
+
else {
|
|
262102
|
+
stop = shortCircuit;
|
|
262103
|
+
errors.push({
|
|
262104
|
+
instanceLocation,
|
|
262105
|
+
keyword: "additionalProperties",
|
|
262106
|
+
keywordLocation,
|
|
262107
|
+
error: `Property "${key}" does not match additional properties schema.`
|
|
262108
|
+
}, ...result.errors);
|
|
262109
|
+
}
|
|
262110
|
+
}
|
|
262111
|
+
} else if (!stop && $unevaluatedProperties !== void 0) {
|
|
262112
|
+
const keywordLocation = `${schemaLocation}/unevaluatedProperties`;
|
|
262113
|
+
for (const key in instance) if (!evaluated[key]) {
|
|
262114
|
+
const subInstancePointer = `${instanceLocation}/${encodePointer(key)}`;
|
|
262115
|
+
const result = validate(instance[key], $unevaluatedProperties, draft, lookup, shortCircuit, recursiveAnchor, subInstancePointer, keywordLocation);
|
|
262116
|
+
if (result.valid) evaluated[key] = true;
|
|
262117
|
+
else errors.push({
|
|
262118
|
+
instanceLocation,
|
|
262119
|
+
keyword: "unevaluatedProperties",
|
|
262120
|
+
keywordLocation,
|
|
262121
|
+
error: `Property "${key}" does not match unevaluated properties schema.`
|
|
262122
|
+
}, ...result.errors);
|
|
262123
|
+
}
|
|
262124
|
+
}
|
|
262125
|
+
} else if (instanceType === "array") {
|
|
262126
|
+
if ($maxItems !== void 0 && instance.length > $maxItems) errors.push({
|
|
262127
|
+
instanceLocation,
|
|
262128
|
+
keyword: "maxItems",
|
|
262129
|
+
keywordLocation: `${schemaLocation}/maxItems`,
|
|
262130
|
+
error: `Array has too many items (${instance.length} > ${$maxItems}).`
|
|
262131
|
+
});
|
|
262132
|
+
if ($minItems !== void 0 && instance.length < $minItems) errors.push({
|
|
262133
|
+
instanceLocation,
|
|
262134
|
+
keyword: "minItems",
|
|
262135
|
+
keywordLocation: `${schemaLocation}/minItems`,
|
|
262136
|
+
error: `Array has too few items (${instance.length} < ${$minItems}).`
|
|
262137
|
+
});
|
|
262138
|
+
const length = instance.length;
|
|
262139
|
+
let i = 0;
|
|
262140
|
+
let stop = false;
|
|
262141
|
+
if ($prefixItems !== void 0) {
|
|
262142
|
+
const keywordLocation = `${schemaLocation}/prefixItems`;
|
|
262143
|
+
const length2 = Math.min($prefixItems.length, length);
|
|
262144
|
+
for (; i < length2; i++) {
|
|
262145
|
+
const result = validate(instance[i], $prefixItems[i], draft, lookup, shortCircuit, recursiveAnchor, `${instanceLocation}/${i}`, `${keywordLocation}/${i}`);
|
|
262146
|
+
evaluated[i] = true;
|
|
262147
|
+
if (!result.valid) {
|
|
262148
|
+
stop = shortCircuit;
|
|
262149
|
+
errors.push({
|
|
262150
|
+
instanceLocation,
|
|
262151
|
+
keyword: "prefixItems",
|
|
262152
|
+
keywordLocation,
|
|
262153
|
+
error: `Items did not match schema.`
|
|
262154
|
+
}, ...result.errors);
|
|
262155
|
+
if (stop) break;
|
|
262156
|
+
}
|
|
262157
|
+
}
|
|
262158
|
+
}
|
|
262159
|
+
if ($items !== void 0) {
|
|
262160
|
+
const keywordLocation = `${schemaLocation}/items`;
|
|
262161
|
+
if (Array.isArray($items)) {
|
|
262162
|
+
const length2 = Math.min($items.length, length);
|
|
262163
|
+
for (; i < length2; i++) {
|
|
262164
|
+
const result = validate(instance[i], $items[i], draft, lookup, shortCircuit, recursiveAnchor, `${instanceLocation}/${i}`, `${keywordLocation}/${i}`);
|
|
262165
|
+
evaluated[i] = true;
|
|
262166
|
+
if (!result.valid) {
|
|
262167
|
+
stop = shortCircuit;
|
|
262168
|
+
errors.push({
|
|
262169
|
+
instanceLocation,
|
|
262170
|
+
keyword: "items",
|
|
262171
|
+
keywordLocation,
|
|
262172
|
+
error: `Items did not match schema.`
|
|
262173
|
+
}, ...result.errors);
|
|
262174
|
+
if (stop) break;
|
|
262175
|
+
}
|
|
262176
|
+
}
|
|
262177
|
+
} else for (; i < length; i++) {
|
|
262178
|
+
const result = validate(instance[i], $items, draft, lookup, shortCircuit, recursiveAnchor, `${instanceLocation}/${i}`, keywordLocation);
|
|
262179
|
+
evaluated[i] = true;
|
|
262180
|
+
if (!result.valid) {
|
|
262181
|
+
stop = shortCircuit;
|
|
262182
|
+
errors.push({
|
|
262183
|
+
instanceLocation,
|
|
262184
|
+
keyword: "items",
|
|
262185
|
+
keywordLocation,
|
|
262186
|
+
error: `Items did not match schema.`
|
|
262187
|
+
}, ...result.errors);
|
|
262188
|
+
if (stop) break;
|
|
262189
|
+
}
|
|
262190
|
+
}
|
|
262191
|
+
if (!stop && $additionalItems !== void 0) {
|
|
262192
|
+
const keywordLocation = `${schemaLocation}/additionalItems`;
|
|
262193
|
+
for (; i < length; i++) {
|
|
262194
|
+
const result = validate(instance[i], $additionalItems, draft, lookup, shortCircuit, recursiveAnchor, `${instanceLocation}/${i}`, keywordLocation);
|
|
262195
|
+
evaluated[i] = true;
|
|
262196
|
+
if (!result.valid) {
|
|
262197
|
+
stop = shortCircuit;
|
|
262198
|
+
errors.push({
|
|
262199
|
+
instanceLocation,
|
|
262200
|
+
keyword: "additionalItems",
|
|
262201
|
+
keywordLocation,
|
|
262202
|
+
error: `Items did not match additional items schema.`
|
|
262203
|
+
}, ...result.errors);
|
|
262204
|
+
}
|
|
262205
|
+
}
|
|
262206
|
+
}
|
|
262207
|
+
}
|
|
262208
|
+
if ($contains !== void 0) {
|
|
262209
|
+
if (length === 0 && $minContains === void 0) errors.push({
|
|
262210
|
+
instanceLocation,
|
|
262211
|
+
keyword: "contains",
|
|
262212
|
+
keywordLocation: `${schemaLocation}/contains`,
|
|
262213
|
+
error: `Array is empty. It must contain at least one item matching the schema.`
|
|
262214
|
+
});
|
|
262215
|
+
else if ($minContains !== void 0 && length < $minContains) errors.push({
|
|
262216
|
+
instanceLocation,
|
|
262217
|
+
keyword: "minContains",
|
|
262218
|
+
keywordLocation: `${schemaLocation}/minContains`,
|
|
262219
|
+
error: `Array has less items (${length}) than minContains (${$minContains}).`
|
|
262220
|
+
});
|
|
262221
|
+
else {
|
|
262222
|
+
const keywordLocation = `${schemaLocation}/contains`;
|
|
262223
|
+
const errorsLength = errors.length;
|
|
262224
|
+
let contained = 0;
|
|
262225
|
+
for (let j = 0; j < length; j++) {
|
|
262226
|
+
const result = validate(instance[j], $contains, draft, lookup, shortCircuit, recursiveAnchor, `${instanceLocation}/${j}`, keywordLocation);
|
|
262227
|
+
if (result.valid) {
|
|
262228
|
+
evaluated[j] = true;
|
|
262229
|
+
contained++;
|
|
262230
|
+
} else errors.push(...result.errors);
|
|
262231
|
+
}
|
|
262232
|
+
if (contained >= ($minContains || 0)) errors.length = errorsLength;
|
|
262233
|
+
if ($minContains === void 0 && $maxContains === void 0 && contained === 0) errors.splice(errorsLength, 0, {
|
|
262234
|
+
instanceLocation,
|
|
262235
|
+
keyword: "contains",
|
|
262236
|
+
keywordLocation,
|
|
262237
|
+
error: `Array does not contain item matching schema.`
|
|
262238
|
+
});
|
|
262239
|
+
else if ($minContains !== void 0 && contained < $minContains) errors.push({
|
|
262240
|
+
instanceLocation,
|
|
262241
|
+
keyword: "minContains",
|
|
262242
|
+
keywordLocation: `${schemaLocation}/minContains`,
|
|
262243
|
+
error: `Array must contain at least ${$minContains} items matching schema. Only ${contained} items were found.`
|
|
262244
|
+
});
|
|
262245
|
+
else if ($maxContains !== void 0 && contained > $maxContains) errors.push({
|
|
262246
|
+
instanceLocation,
|
|
262247
|
+
keyword: "maxContains",
|
|
262248
|
+
keywordLocation: `${schemaLocation}/maxContains`,
|
|
262249
|
+
error: `Array may contain at most ${$maxContains} items matching schema. ${contained} items were found.`
|
|
262250
|
+
});
|
|
262251
|
+
}
|
|
262252
|
+
}
|
|
262253
|
+
if (!stop && $unevaluatedItems !== void 0) {
|
|
262254
|
+
const keywordLocation = `${schemaLocation}/unevaluatedItems`;
|
|
262255
|
+
for (; i < length; i++) {
|
|
262256
|
+
if (evaluated[i]) continue;
|
|
262257
|
+
const result = validate(instance[i], $unevaluatedItems, draft, lookup, shortCircuit, recursiveAnchor, `${instanceLocation}/${i}`, keywordLocation);
|
|
262258
|
+
evaluated[i] = true;
|
|
262259
|
+
if (!result.valid) errors.push({
|
|
262260
|
+
instanceLocation,
|
|
262261
|
+
keyword: "unevaluatedItems",
|
|
262262
|
+
keywordLocation,
|
|
262263
|
+
error: `Items did not match unevaluated items schema.`
|
|
262264
|
+
}, ...result.errors);
|
|
262265
|
+
}
|
|
262266
|
+
}
|
|
262267
|
+
if ($uniqueItems) for (let j = 0; j < length; j++) {
|
|
262268
|
+
const a = instance[j];
|
|
262269
|
+
const ao = typeof a === "object" && a !== null;
|
|
262270
|
+
for (let k = 0; k < length; k++) {
|
|
262271
|
+
if (j === k) continue;
|
|
262272
|
+
const b = instance[k];
|
|
262273
|
+
if (a === b || ao && typeof b === "object" && b !== null && deepCompareStrict(a, b)) {
|
|
262274
|
+
errors.push({
|
|
262275
|
+
instanceLocation,
|
|
262276
|
+
keyword: "uniqueItems",
|
|
262277
|
+
keywordLocation: `${schemaLocation}/uniqueItems`,
|
|
262278
|
+
error: `Duplicate items at indexes ${j} and ${k}.`
|
|
262279
|
+
});
|
|
262280
|
+
j = Number.MAX_SAFE_INTEGER;
|
|
262281
|
+
k = Number.MAX_SAFE_INTEGER;
|
|
262282
|
+
}
|
|
262283
|
+
}
|
|
262284
|
+
}
|
|
262285
|
+
} else if (instanceType === "number") {
|
|
262286
|
+
if (draft === "4") {
|
|
262287
|
+
if ($minimum !== void 0 && ($exclusiveMinimum === true && instance <= $minimum || instance < $minimum)) errors.push({
|
|
262288
|
+
instanceLocation,
|
|
262289
|
+
keyword: "minimum",
|
|
262290
|
+
keywordLocation: `${schemaLocation}/minimum`,
|
|
262291
|
+
error: `${instance} is less than ${$exclusiveMinimum ? "or equal to " : ""} ${$minimum}.`
|
|
262292
|
+
});
|
|
262293
|
+
if ($maximum !== void 0 && ($exclusiveMaximum === true && instance >= $maximum || instance > $maximum)) errors.push({
|
|
262294
|
+
instanceLocation,
|
|
262295
|
+
keyword: "maximum",
|
|
262296
|
+
keywordLocation: `${schemaLocation}/maximum`,
|
|
262297
|
+
error: `${instance} is greater than ${$exclusiveMaximum ? "or equal to " : ""} ${$maximum}.`
|
|
262298
|
+
});
|
|
262299
|
+
} else {
|
|
262300
|
+
if ($minimum !== void 0 && instance < $minimum) errors.push({
|
|
262301
|
+
instanceLocation,
|
|
262302
|
+
keyword: "minimum",
|
|
262303
|
+
keywordLocation: `${schemaLocation}/minimum`,
|
|
262304
|
+
error: `${instance} is less than ${$minimum}.`
|
|
262305
|
+
});
|
|
262306
|
+
if ($maximum !== void 0 && instance > $maximum) errors.push({
|
|
262307
|
+
instanceLocation,
|
|
262308
|
+
keyword: "maximum",
|
|
262309
|
+
keywordLocation: `${schemaLocation}/maximum`,
|
|
262310
|
+
error: `${instance} is greater than ${$maximum}.`
|
|
262311
|
+
});
|
|
262312
|
+
if ($exclusiveMinimum !== void 0 && instance <= $exclusiveMinimum) errors.push({
|
|
262313
|
+
instanceLocation,
|
|
262314
|
+
keyword: "exclusiveMinimum",
|
|
262315
|
+
keywordLocation: `${schemaLocation}/exclusiveMinimum`,
|
|
262316
|
+
error: `${instance} is less than ${$exclusiveMinimum}.`
|
|
262317
|
+
});
|
|
262318
|
+
if ($exclusiveMaximum !== void 0 && instance >= $exclusiveMaximum) errors.push({
|
|
262319
|
+
instanceLocation,
|
|
262320
|
+
keyword: "exclusiveMaximum",
|
|
262321
|
+
keywordLocation: `${schemaLocation}/exclusiveMaximum`,
|
|
262322
|
+
error: `${instance} is greater than or equal to ${$exclusiveMaximum}.`
|
|
262323
|
+
});
|
|
262324
|
+
}
|
|
262325
|
+
if ($multipleOf !== void 0) {
|
|
262326
|
+
const remainder = instance % $multipleOf;
|
|
262327
|
+
if (Math.abs(0 - remainder) >= 1.1920929e-7 && Math.abs($multipleOf - remainder) >= 1.1920929e-7) errors.push({
|
|
262328
|
+
instanceLocation,
|
|
262329
|
+
keyword: "multipleOf",
|
|
262330
|
+
keywordLocation: `${schemaLocation}/multipleOf`,
|
|
262331
|
+
error: `${instance} is not a multiple of ${$multipleOf}.`
|
|
262332
|
+
});
|
|
262333
|
+
}
|
|
262334
|
+
} else if (instanceType === "string") {
|
|
262335
|
+
const length = $minLength === void 0 && $maxLength === void 0 ? 0 : ucs2length(instance);
|
|
262336
|
+
if ($minLength !== void 0 && length < $minLength) errors.push({
|
|
262337
|
+
instanceLocation,
|
|
262338
|
+
keyword: "minLength",
|
|
262339
|
+
keywordLocation: `${schemaLocation}/minLength`,
|
|
262340
|
+
error: `String is too short (${length} < ${$minLength}).`
|
|
262341
|
+
});
|
|
262342
|
+
if ($maxLength !== void 0 && length > $maxLength) errors.push({
|
|
262343
|
+
instanceLocation,
|
|
262344
|
+
keyword: "maxLength",
|
|
262345
|
+
keywordLocation: `${schemaLocation}/maxLength`,
|
|
262346
|
+
error: `String is too long (${length} > ${$maxLength}).`
|
|
262347
|
+
});
|
|
262348
|
+
if ($pattern !== void 0 && !new RegExp($pattern, "u").test(instance)) errors.push({
|
|
262349
|
+
instanceLocation,
|
|
262350
|
+
keyword: "pattern",
|
|
262351
|
+
keywordLocation: `${schemaLocation}/pattern`,
|
|
262352
|
+
error: `String does not match pattern.`
|
|
262353
|
+
});
|
|
262354
|
+
if ($format !== void 0 && format[$format] && !format[$format](instance)) errors.push({
|
|
262355
|
+
instanceLocation,
|
|
262356
|
+
keyword: "format",
|
|
262357
|
+
keywordLocation: `${schemaLocation}/format`,
|
|
262358
|
+
error: `String does not match format "${$format}".`
|
|
262359
|
+
});
|
|
262360
|
+
}
|
|
262361
|
+
return {
|
|
262362
|
+
valid: errors.length === 0,
|
|
262363
|
+
errors
|
|
262364
|
+
};
|
|
262365
|
+
}
|
|
262366
|
+
//#endregion
|
|
262367
|
+
//#region ../../node_modules/.bun/@cfworker+json-schema@4.1.1/node_modules/@cfworker/json-schema/dist/esm/validator.js
|
|
262368
|
+
var Validator = class {
|
|
262369
|
+
schema;
|
|
262370
|
+
draft;
|
|
262371
|
+
shortCircuit;
|
|
262372
|
+
lookup;
|
|
262373
|
+
constructor(schema, draft = "2019-09", shortCircuit = true) {
|
|
262374
|
+
this.schema = schema;
|
|
262375
|
+
this.draft = draft;
|
|
262376
|
+
this.shortCircuit = shortCircuit;
|
|
262377
|
+
this.lookup = dereference(schema);
|
|
262378
|
+
}
|
|
262379
|
+
validate(instance) {
|
|
262380
|
+
return validate(instance, this.schema, this.draft, this.lookup, this.shortCircuit);
|
|
262381
|
+
}
|
|
262382
|
+
addSchema(schema, id) {
|
|
262383
|
+
if (id) schema = {
|
|
262384
|
+
...schema,
|
|
262385
|
+
$id: id
|
|
262386
|
+
};
|
|
262387
|
+
dereference(schema, this.lookup);
|
|
262388
|
+
}
|
|
262389
|
+
};
|
|
262390
|
+
//#endregion
|
|
261472
262391
|
//#region src/json-schema-subset/utils.ts
|
|
261473
262392
|
var nextId = 0;
|
|
261474
262393
|
function createId() {
|
|
@@ -263422,6 +264341,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
263422
264341
|
if (value1 === null || value2 === null) return false;
|
|
263423
264342
|
if (typeof value1 !== "object") return false;
|
|
263424
264343
|
if (typeof value1 !== typeof value2) return false;
|
|
264344
|
+
if (extendsContext.isExtendsSchema(value1) || extendsContext.isExtendsSchema(value2)) return extendsContext.equals(value1, value2);
|
|
263425
264345
|
if (isCompiledSchema(value1) && isCompiledSchema(value2)) return isCompiledSchemaEquals(value1, value2);
|
|
263426
264346
|
return isObjectLikeEquals(value1, value2);
|
|
263427
264347
|
}
|
|
@@ -264145,10 +265065,17 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
264145
265065
|
}
|
|
264146
265066
|
constructor(id, value, context) {
|
|
264147
265067
|
if (!SingleSelectSchema.isMatch(value)) throw new TypeError("Invalid single-select schema.");
|
|
264148
|
-
|
|
265068
|
+
const validator = new Validator(structuredClone(value), "7");
|
|
265069
|
+
super(id, { enum: value.enum.filter((item) => validator.validate(item).valid) }, context);
|
|
264149
265070
|
}
|
|
264150
265071
|
compareImpl(other) {
|
|
264151
|
-
if (
|
|
265072
|
+
if (this.value.enum.length == 0) return [(other instanceof SingleSelectSchema ? other.value.enum.length == 0 : isCompiledSchema(other) && getKind(other) === CompiledKind.Never) ? ExpressionSingleResult.Equals : ExpressionSingleResult.ContainedBy];
|
|
265073
|
+
if (isStringLikeSchema(other)) {
|
|
265074
|
+
const validator = new Validator(structuredClone(other), "7");
|
|
265075
|
+
const accepted = this.value.enum.filter((item) => validator.validate(item).valid).length;
|
|
265076
|
+
if (accepted == this.value.enum.length) return [ExpressionSingleResult.ContainedBy];
|
|
265077
|
+
return [accepted == 0 ? ExpressionSingleResult.Rejection : ExpressionSingleResult.Intersection];
|
|
265078
|
+
}
|
|
264152
265079
|
if (other instanceof SingleSelectSchema) {
|
|
264153
265080
|
const f = new Set(this.value.enum);
|
|
264154
265081
|
let result = ExpressionSingleResult.Equals;
|
|
@@ -267710,9 +268637,8 @@ export function identity(value) { return value }
|
|
|
267710
268637
|
edges
|
|
267711
268638
|
};
|
|
267712
268639
|
}
|
|
267713
|
-
function
|
|
268640
|
+
function orderNodes(nodeIds, dependencies, dependents) {
|
|
267714
268641
|
const indegree = new Map([...dependencies].map(([nodeId, sources]) => [nodeId, sources.size]));
|
|
267715
|
-
const depth = /* @__PURE__ */ new Map();
|
|
267716
268642
|
const ordered = [];
|
|
267717
268643
|
const orderedIds = /* @__PURE__ */ new Set();
|
|
267718
268644
|
const ready = [...indegree].filter(([, count]) => count == 0).map(([nodeId]) => nodeId).toSorted();
|
|
@@ -267720,23 +268646,14 @@ export function identity(value) { return value }
|
|
|
267720
268646
|
const nodeId = ready[cursor];
|
|
267721
268647
|
ordered.push(nodeId);
|
|
267722
268648
|
orderedIds.add(nodeId);
|
|
267723
|
-
const nextDepth = (depth.get(nodeId) ?? 0) + 1;
|
|
267724
268649
|
for (const targetId of [...dependents.get(nodeId)].toSorted()) {
|
|
267725
|
-
depth.set(targetId, Math.max(depth.get(targetId) ?? 0, nextDepth));
|
|
267726
268650
|
const count = indegree.get(targetId) - 1;
|
|
267727
268651
|
indegree.set(targetId, count);
|
|
267728
268652
|
if (count == 0) ready.push(targetId);
|
|
267729
268653
|
}
|
|
267730
268654
|
}
|
|
267731
|
-
const
|
|
267732
|
-
|
|
267733
|
-
depth.set(nodeId, cycleDepth);
|
|
267734
|
-
ordered.push(nodeId);
|
|
267735
|
-
}
|
|
267736
|
-
return {
|
|
267737
|
-
depth,
|
|
267738
|
-
ordered
|
|
267739
|
-
};
|
|
268655
|
+
for (const nodeId of [...nodeIds].filter((candidate) => !orderedIds.has(candidate)).toSorted()) ordered.push(nodeId);
|
|
268656
|
+
return ordered;
|
|
267740
268657
|
}
|
|
267741
268658
|
function designerInputs(nodeId, node, ports, revision) {
|
|
267742
268659
|
if (isTriggerNode(node)) return [];
|
|
@@ -267933,6 +268850,7 @@ export function identity(value) { return value }
|
|
|
267933
268850
|
const graph = revision == null ? void 0 : revision.graph();
|
|
267934
268851
|
if (revision == null || graph == null) return {
|
|
267935
268852
|
edges: [],
|
|
268853
|
+
needsLayout: false,
|
|
267936
268854
|
nodes: [],
|
|
267937
268855
|
viewport: {
|
|
267938
268856
|
x: 0,
|
|
@@ -267946,7 +268864,7 @@ export function identity(value) { return value }
|
|
|
267946
268864
|
const nodeIds = new Set(entries.map(([nodeId]) => nodeId));
|
|
267947
268865
|
const ports = new Map([...definitions].map(([nodeId, node]) => [nodeId, nodePorts(node, revision)]));
|
|
267948
268866
|
const edgeProjection = projectEdges(graph, nodeIds);
|
|
267949
|
-
const
|
|
268867
|
+
const ordered = orderNodes(nodeIds, edgeProjection.dependencies, edgeProjection.dependents);
|
|
267950
268868
|
const direction = savedDirection(presentation);
|
|
267951
268869
|
const positions = savedPositions(presentation);
|
|
267952
268870
|
const hiddenNodeContent = savedHiddenNodeContent(presentation);
|
|
@@ -267961,33 +268879,21 @@ export function identity(value) { return value }
|
|
|
267961
268879
|
runNodes: projectedRun.nodes,
|
|
267962
268880
|
t
|
|
267963
268881
|
};
|
|
267964
|
-
const
|
|
267965
|
-
|
|
267966
|
-
|
|
267967
|
-
const row = rows.get(column) ?? 0;
|
|
267968
|
-
rows.set(column, row + 1);
|
|
267969
|
-
return direction === "vertical" ? {
|
|
267970
|
-
id: nodeId,
|
|
267971
|
-
column,
|
|
267972
|
-
x: 80 + row * 400,
|
|
267973
|
-
y: 80 + column * 240,
|
|
267974
|
-
width: 320,
|
|
267975
|
-
height: 160
|
|
267976
|
-
} : {
|
|
268882
|
+
const defaultNodes = ordered.every((nodeId) => positions[nodeId] != null) ? [] : graphLayout(ordered.map((nodeId) => {
|
|
268883
|
+
const { kind } = definitions.get(nodeId);
|
|
268884
|
+
return {
|
|
267977
268885
|
id: nodeId,
|
|
267978
|
-
|
|
267979
|
-
|
|
267980
|
-
|
|
267981
|
-
width: 420,
|
|
267982
|
-
height: 240
|
|
268886
|
+
width: direction === "vertical" ? 320 : 420,
|
|
268887
|
+
height: direction === "vertical" ? 160 : 240,
|
|
268888
|
+
branchHandles: kind === "condition" || kind === "approval" || kind === "wait" ? [...ports.get(nodeId).outputs.keys()].map((handle) => "$branch:" + handle) : void 0
|
|
267983
268889
|
};
|
|
267984
|
-
});
|
|
268890
|
+
}), edgeProjection.edges, direction).nodes;
|
|
267985
268891
|
const automaticPositions = direction === "horizontal" ? wrapLayout(defaultNodes) : Object.fromEntries(defaultNodes.map(({ id, x, y }) => [id, {
|
|
267986
268892
|
x,
|
|
267987
268893
|
y
|
|
267988
268894
|
}]));
|
|
267989
268895
|
const nodes = [];
|
|
267990
|
-
for (const nodeId of
|
|
268896
|
+
for (const nodeId of ordered) {
|
|
267991
268897
|
const position = positions[nodeId] ?? automaticPositions[nodeId];
|
|
267992
268898
|
const resolved = definitions.get(nodeId);
|
|
267993
268899
|
if (resolved.kind == "trigger") {
|
|
@@ -268015,6 +268921,7 @@ export function identity(value) { return value }
|
|
|
268015
268921
|
return {
|
|
268016
268922
|
direction,
|
|
268017
268923
|
edges: edgeProjection.edges,
|
|
268924
|
+
needsLayout: nodes.length > 0 && nodes.every((node) => positions[node.id] == null),
|
|
268018
268925
|
nodes,
|
|
268019
268926
|
...projectedRun.status == null ? {} : { runStatus: projectedRun.status },
|
|
268020
268927
|
viewport: savedViewport(presentation)
|