@oomol-lab/open-flow 0.1.0-beta.25 → 0.1.0-beta.27

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.
@@ -1,6 +1,6 @@
1
1
  import { i as e } from "./main-BDnNHhkU.js";
2
2
  import { Bn as t, kt as n } from "./lite-BuKZ8joP.js";
3
- import { a as r, c as i, d as a, f as o, g as s, h as c, i as l, l as u, m as d, n as f, p, r as m, s as h, t as g } from "./workbenchSelect-CXeaZhuN.js";
3
+ import { a as r, c as i, d as a, f as o, g as s, h as c, i as l, l as u, m as d, n as f, p, r as m, s as h, t as g } from "./workbenchSelect-BUu7CjUA.js";
4
4
  import { Fragment as _, jsx as v, jsxs as y } from "react/jsx-runtime";
5
5
  import { useEffect as b, useRef as x, useState as S } from "react";
6
6
  //#region src/workbench/browser/runtime/shell/createResourceDialog.tsx
@@ -2,6 +2,20 @@ export { changeOperationsSchema, decodeChangeOperations } from './flow-change-sc
2
2
  export type JsonValue = null | boolean | number | string | readonly JsonValue[] | {
3
3
  readonly [key: string]: JsonValue;
4
4
  };
5
+ export type SchemaKeyword = 'const' | 'enum' | 'exclusiveMaximum' | 'exclusiveMinimum' | 'maximum' | 'maxItems' | 'maxLength' | 'maxProperties' | 'minimum' | 'minItems' | 'minLength' | 'minProperties' | 'multipleOf' | 'pattern' | 'required' | 'type';
6
+ export type SchemaMismatch = {
7
+ readonly kind: 'artifact' | 'binary' | 'nullable';
8
+ } | {
9
+ readonly kind: 'keyword';
10
+ readonly keyword: SchemaKeyword;
11
+ readonly path: readonly (string | number)[];
12
+ readonly source: JsonValue | undefined;
13
+ readonly target: JsonValue | undefined;
14
+ } | {
15
+ readonly kind: 'schema';
16
+ readonly path?: readonly (string | number)[];
17
+ };
18
+ export declare function isSchemaKeyword(value: string): value is SchemaKeyword;
5
19
  export declare const resourceNameMaxLength = 80;
6
20
  export type ResourceNameIssue = 'controlCharacter' | 'empty' | 'specialCharacter' | 'tooLong';
7
21
  export declare function resourceNameIssue(value: string): ResourceNameIssue | undefined;
@@ -4854,8 +4854,29 @@ function Ac(e) {
4854
4854
  }
4855
4855
  //#endregion
4856
4856
  //#region src/flow/common/change.ts
4857
- var jc = 80;
4857
+ var jc = /* @__PURE__ */ new Set([
4858
+ "const",
4859
+ "enum",
4860
+ "exclusiveMaximum",
4861
+ "exclusiveMinimum",
4862
+ "maximum",
4863
+ "maxItems",
4864
+ "maxLength",
4865
+ "maxProperties",
4866
+ "minimum",
4867
+ "minItems",
4868
+ "minLength",
4869
+ "minProperties",
4870
+ "multipleOf",
4871
+ "pattern",
4872
+ "required",
4873
+ "type"
4874
+ ]);
4858
4875
  function Mc(e) {
4876
+ return jc.has(e);
4877
+ }
4878
+ var Nc = 80;
4879
+ function Pc(e) {
4859
4880
  let t = e.trim();
4860
4881
  if (t.length == 0) return "empty";
4861
4882
  if (t.length > 80) return "tooLong";
@@ -4865,13 +4886,13 @@ function Mc(e) {
4865
4886
  }
4866
4887
  if (!/^[\p{L}\p{N}](?:[\p{L}\p{N} _-]*[\p{L}\p{N}])?$/u.test(t)) return "specialCharacter";
4867
4888
  }
4868
- function Nc(e) {
4889
+ function Fc(e) {
4869
4890
  return e.length <= 256 && /^[A-Za-z_][A-Za-z0-9_]*$/.test(e) && e.slice(0, 3).toUpperCase() != "OO_";
4870
4891
  }
4871
- function Pc(e) {
4892
+ function Ic(e) {
4872
4893
  return Object.fromEntries(e.flatMap((e) => "handle" in e ? [[e.handle, e]] : []));
4873
4894
  }
4874
- function Fc(e) {
4895
+ function Lc(e) {
4875
4896
  if (!Array.isArray(e)) throw TypeError("Connector capabilities must be an array.");
4876
4897
  let t = /* @__PURE__ */ new Set();
4877
4898
  return e.map((e) => {
@@ -4910,24 +4931,24 @@ function Fc(e) {
4910
4931
  function X(e) {
4911
4932
  return e.trim().normalize("NFC");
4912
4933
  }
4913
- function Ic(e, t) {
4934
+ function Rc(e, t) {
4914
4935
  let n = X(e), r = new Set([...t].map(X));
4915
4936
  if (!r.has(n)) return n;
4916
4937
  let i = /^(.*) \((\d+)\)$/.exec(n), a = i?.[2], o = a != null && Number(a) >= 2 ? Number(a) : void 0, s = o == null ? n : i?.[1] ?? n, c = o == null ? 2 : o + 1;
4917
4938
  for (; r.has(`${s} (${c})`);) c += 1;
4918
4939
  return `${s} (${c})`;
4919
4940
  }
4920
- function Lc(e, t, n) {
4941
+ function zc(e, t, n) {
4921
4942
  let r = X(n);
4922
4943
  return r.length == 0 ? "empty" : Object.entries(e.nodes).some(([e, n]) => e != t && n.name != null && X(n.name) == r) ? "duplicate" : void 0;
4923
4944
  }
4924
- var Rc = class extends Error {
4945
+ var Bc = class extends Error {
4925
4946
  constructor(e) {
4926
4947
  super(e), this.name = "FlowChangeError";
4927
4948
  }
4928
4949
  };
4929
4950
  function Z(e) {
4930
- throw new Rc(e);
4951
+ throw new Bc(e);
4931
4952
  }
4932
4953
  function Q(e, t) {
4933
4954
  if (t.kind == "flow") return e.graph;
@@ -4951,7 +4972,7 @@ function $(e, t, n) {
4951
4972
  }
4952
4973
  };
4953
4974
  }
4954
- function zc(e, t) {
4975
+ function Vc(e, t) {
4955
4976
  if (!("inputs" in e)) return e;
4956
4977
  let n = { ...e.inputs };
4957
4978
  for (let [e, r] of Object.entries(n)) {
@@ -4967,7 +4988,7 @@ function zc(e, t) {
4967
4988
  inputs: n
4968
4989
  };
4969
4990
  }
4970
- function Bc(e, n) {
4991
+ function Hc(e, n) {
4971
4992
  let r = { ...e.document }, i = { ...e.modules };
4972
4993
  for (let e of n) switch (e.kind) {
4973
4994
  case "binding.create":
@@ -5048,8 +5069,8 @@ function Bc(e, n) {
5048
5069
  }
5049
5070
  case "graph.node.create": {
5050
5071
  let t = Q(r, e.target);
5051
- t.nodes[e.nodeId] != null && Z("A Node with this ID already exists in the target graph."), e.target.kind == "subflow" && !("inputs" in e.node) && Z("Trigger Nodes cannot be created inside a Subflow."), e.node.kind == "manual" && Object.values(t.nodes).some((e) => e.kind == "manual") && Z("A graph can contain only one manual Trigger."), e.node.kind == "task" && e.node.task?.capabilities !== void 0 && Fc(e.node.task.capabilities), e.node.name ?? Z("A Node name cannot be empty.");
5052
- let n = X(e.node.name), i = Lc(t, e.nodeId, n);
5072
+ t.nodes[e.nodeId] != null && Z("A Node with this ID already exists in the target graph."), e.target.kind == "subflow" && !("inputs" in e.node) && Z("Trigger Nodes cannot be created inside a Subflow."), e.node.kind == "manual" && Object.values(t.nodes).some((e) => e.kind == "manual") && Z("A graph can contain only one manual Trigger."), e.node.kind == "task" && e.node.task?.capabilities !== void 0 && Lc(e.node.task.capabilities), e.node.name ?? Z("A Node name cannot be empty.");
5073
+ let n = X(e.node.name), i = zc(t, e.nodeId, n);
5053
5074
  i == "empty" && Z("A Node name cannot be empty."), i == "duplicate" && Z("A Node with this name already exists in the target graph.");
5054
5075
  let a = n == e.node.name ? e.node : {
5055
5076
  ...e.node,
@@ -5067,7 +5088,7 @@ function Bc(e, n) {
5067
5088
  case "graph.node.delete": {
5068
5089
  let t = Q(r, e.target);
5069
5090
  t.nodes[e.nodeId] ?? Z("The Node does not exist in the target graph.");
5070
- let n = /* @__PURE__ */ new Set([e.nodeId]), i = Object.fromEntries(Object.entries(t.nodes).flatMap(([e, t]) => n.has(e) ? [] : [[e, zc(t, n)]]));
5091
+ let n = /* @__PURE__ */ new Set([e.nodeId]), i = Object.fromEntries(Object.entries(t.nodes).flatMap(([e, t]) => n.has(e) ? [] : [[e, Vc(t, n)]]));
5071
5092
  if (Object.assign(r, $(r, e.target, {
5072
5093
  ...t,
5073
5094
  edges: t.edges.filter((e) => !n.has(e.source) && !n.has(e.target)),
@@ -5093,7 +5114,7 @@ function Bc(e, n) {
5093
5114
  let a = { ...i };
5094
5115
  if (e.field == "name") {
5095
5116
  typeof e.value != "string" && Z("A Node name cannot be empty.");
5096
- let t = X(e.value), r = Lc(n, e.nodeId, t);
5117
+ let t = X(e.value), r = zc(n, e.nodeId, t);
5097
5118
  r == "empty" && Z("A Node name cannot be empty."), r == "duplicate" && Z("A Node with this name already exists in the target graph."), Object.assign(a, { name: t });
5098
5119
  } else e.value == null ? Reflect.deleteProperty(a, e.field) : Object.assign(a, { [e.field]: e.value });
5099
5120
  Object.assign(r, $(r, e.target, {
@@ -5125,7 +5146,7 @@ function Bc(e, n) {
5125
5146
  let n = Q(r, e.target), i = n.nodes[e.nodeId];
5126
5147
  (i?.kind != "task" || i.task == null) && Z("The inline Task Node does not exist."), t(i.task.capabilities, e.before) || Z("The inline Task capabilities changed before this operation was applied.");
5127
5148
  let a = { ...i.task };
5128
- e.value === void 0 ? delete a.capabilities : a.capabilities = Fc(e.value), Object.assign(r, $(r, e.target, {
5149
+ e.value === void 0 ? delete a.capabilities : a.capabilities = Lc(e.value), Object.assign(r, $(r, e.target, {
5129
5150
  ...n,
5130
5151
  nodes: {
5131
5152
  ...n.nodes,
@@ -5291,7 +5312,7 @@ function Bc(e, n) {
5291
5312
  }
5292
5313
  case "subflow.create":
5293
5314
  r.subflows[e.subflowId] != null && Z("A Subflow with this ID already exists.");
5294
- for (let t of Object.values(e.subflow.graph.nodes)) t.kind == "task" && t.task?.capabilities !== void 0 && Fc(t.task.capabilities);
5315
+ for (let t of Object.values(e.subflow.graph.nodes)) t.kind == "task" && t.task?.capabilities !== void 0 && Lc(t.task.capabilities);
5295
5316
  r.subflows = {
5296
5317
  ...r.subflows,
5297
5318
  [e.subflowId]: e.subflow
@@ -5387,4 +5408,4 @@ function Bc(e, n) {
5387
5408
  };
5388
5409
  }
5389
5410
  //#endregion
5390
- export { Rc as FlowChangeError, Bc as applyFlowChanges, Ac as changeOperationsSchema, kc as decodeChangeOperations, Fc as decodeConnectorCapabilities, Ic as nextNodeName, Lc as nodeNameIssue, X as normalizeNodeName, Pc as portsByHandle, Mc as resourceNameIssue, jc as resourceNameMaxLength, Nc as validVariableName };
5411
+ export { Bc as FlowChangeError, Hc as applyFlowChanges, Ac as changeOperationsSchema, kc as decodeChangeOperations, Lc as decodeConnectorCapabilities, Mc as isSchemaKeyword, Rc as nextNodeName, zc as nodeNameIssue, X as normalizeNodeName, Ic as portsByHandle, Pc as resourceNameIssue, Nc as resourceNameMaxLength, Fc as validVariableName };