@oomol-lab/open-flow 0.1.0-beta.19 → 0.1.0-beta.20

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,4 +1,4 @@
1
- import type { CodeModule, FlowDocument, Graph, Group, InputPort, JsonValue, OutputMapping, Port, RevisionContent } from '@oomol-lab/open-flow/flow-change';
1
+ import type { CodeModule, FlowDocument, Graph, Group, InputPort, JsonValue, OutputMapping, Port, RevisionContent, TriggerNode } from '@oomol-lab/open-flow/flow-change';
2
2
  export { maxJsonDepth } from './flow-json.js';
3
3
  export { decodeFlowDocument, decodeRevisionContent } from '../browser/flow-change-schema.js';
4
4
  export declare function canonicalJsonBytes(value: JsonValue): Uint8Array;
@@ -7,6 +7,7 @@ export declare function canonicalPorts(value: readonly (InputPort | Port | Group
7
7
  export declare function canonicalOutputs(value: readonly (OutputMapping & Port)[]): JsonValue;
8
8
  export declare function canonicalGraph(value: Graph): JsonValue;
9
9
  export declare function canonicalTask(task: FlowDocument['tasks'][string]): JsonValue;
10
+ export declare function triggerRuntimeJson(trigger: TriggerNode): string;
10
11
  export declare function canonicalDocument(document: FlowDocument): JsonValue;
11
12
  export declare function canonicalModule(module: CodeModule): JsonValue;
12
13
  export declare function encodeRevision(content: RevisionContent): Uint8Array;
@@ -4729,20 +4729,20 @@ V(U([...new Map(Object.entries(uc).map(([e, t]) => [e, t instanceof L ? t : H({
4729
4729
  //#endregion
4730
4730
  //#region src/flow/common/encoding.ts
4731
4731
  var dc = new TextEncoder();
4732
- function fc(e) {
4732
+ function Q(e) {
4733
4733
  if (e == null || typeof e == "boolean" || typeof e == "string" || typeof e == "number") return JSON.stringify(e);
4734
- if (Array.isArray(e)) return `[${e.map(fc).join(",")}]`;
4734
+ if (Array.isArray(e)) return `[${e.map(Q).join(",")}]`;
4735
4735
  let t = e;
4736
- return `{${Object.keys(t).toSorted().map((e) => `${JSON.stringify(e)}:${fc(t[e])}`).join(",")}}`;
4736
+ return `{${Object.keys(t).toSorted().map((e) => `${JSON.stringify(e)}:${Q(t[e])}`).join(",")}}`;
4737
4737
  }
4738
- function pc(e) {
4739
- return dc.encode(fc(e));
4738
+ function fc(e) {
4739
+ return dc.encode(Q(e));
4740
4740
  }
4741
- async function mc(e) {
4741
+ async function pc(e) {
4742
4742
  let t = new Uint8Array(e.byteLength);
4743
4743
  return t.set(e), `sha256:${[...new Uint8Array(await crypto.subtle.digest("SHA-256", t))].map((e) => e.toString(16).padStart(2, "0")).join("")}`;
4744
4744
  }
4745
- function Q(e) {
4745
+ function mc(e) {
4746
4746
  return Object.keys(e).toSorted().map((t) => [t, e[t]]);
4747
4747
  }
4748
4748
  function hc(e) {
@@ -4773,7 +4773,7 @@ function gc(e) {
4773
4773
  }
4774
4774
  }
4775
4775
  function _c(e) {
4776
- return Object.fromEntries(Q(e).map(([e, t]) => [e, gc(t)]));
4776
+ return Object.fromEntries(mc(e).map(([e, t]) => [e, gc(t)]));
4777
4777
  }
4778
4778
  function vc(e) {
4779
4779
  return e.map((e) => ({
@@ -4852,10 +4852,10 @@ function yc(e) {
4852
4852
  function bc(e) {
4853
4853
  return {
4854
4854
  edges: e.edges.map((e) => ({ ...e })).toSorted((e, t) => {
4855
- let n = fc(e), r = fc(t);
4855
+ let n = Q(e), r = Q(t);
4856
4856
  return n < r ? -1 : +(n > r);
4857
4857
  }),
4858
- nodes: Object.fromEntries(Q(e.nodes).map(([e, t]) => [e, yc(t)]))
4858
+ nodes: Object.fromEntries(mc(e.nodes).map(([e, t]) => [e, yc(t)]))
4859
4859
  };
4860
4860
  }
4861
4861
  function xc(e) {
@@ -4958,39 +4958,43 @@ function Ec(e) {
4958
4958
  }
4959
4959
  }
4960
4960
  function Dc(e) {
4961
+ let { name: t, description: n, icon: r, ...i } = e;
4962
+ return Q(i);
4963
+ }
4964
+ function Oc(e) {
4961
4965
  return {
4962
- bindings: Object.fromEntries(Q(e.bindings)),
4966
+ bindings: Object.fromEntries(mc(e.bindings)),
4963
4967
  graph: bc(e.graph),
4964
- subflows: Object.fromEntries(Q(e.subflows).map(([e, t]) => [e, {
4968
+ subflows: Object.fromEntries(mc(e.subflows).map(([e, t]) => [e, {
4965
4969
  graph: bc(t.graph),
4966
4970
  inputs: $(t.inputs),
4967
4971
  name: t.name,
4968
4972
  outputs: vc(t.outputs)
4969
4973
  }])),
4970
- tasks: Object.fromEntries(Q(e.tasks).map(([e, t]) => [e, xc(t)]))
4974
+ tasks: Object.fromEntries(mc(e.tasks).map(([e, t]) => [e, xc(t)]))
4971
4975
  };
4972
4976
  }
4973
- function Oc(e) {
4977
+ function kc(e) {
4974
4978
  return {
4975
4979
  imports: e.imports.toSorted(),
4976
4980
  name: e.name,
4977
4981
  source: e.source
4978
4982
  };
4979
4983
  }
4980
- function kc(e) {
4984
+ function Ac(e) {
4981
4985
  return {
4982
- document: Dc(e.document),
4986
+ document: Oc(e.document),
4983
4987
  kind: "open-flow-flow-revision",
4984
4988
  modelVersion: e.modelVersion,
4985
- modules: Object.fromEntries(Q(e.modules).map(([e, t]) => [e, Oc(t)])),
4989
+ modules: Object.fromEntries(mc(e.modules).map(([e, t]) => [e, kc(t)])),
4986
4990
  version: 1
4987
4991
  };
4988
4992
  }
4989
- function Ac(e) {
4990
- return pc(kc(e));
4991
- }
4992
4993
  function jc(e) {
4994
+ return fc(Ac(e));
4995
+ }
4996
+ function Mc(e) {
4993
4997
  return lc(JSON.parse(new TextDecoder("utf-8", { fatal: !0 }).decode(e)));
4994
4998
  }
4995
4999
  //#endregion
4996
- export { Dc as canonicalDocument, bc as canonicalGraph, pc as canonicalJsonBytes, Oc as canonicalModule, vc as canonicalOutputs, $ as canonicalPorts, xc as canonicalTask, sc as decodeFlowDocument, jc as decodeRevision, cc as decodeRevisionContent, mc as digestBytes, Ac as encodeRevision, Os as maxJsonDepth };
5000
+ export { Oc as canonicalDocument, bc as canonicalGraph, fc as canonicalJsonBytes, kc as canonicalModule, vc as canonicalOutputs, $ as canonicalPorts, xc as canonicalTask, sc as decodeFlowDocument, Mc as decodeRevision, cc as decodeRevisionContent, pc as digestBytes, jc as encodeRevision, Os as maxJsonDepth, Dc as triggerRuntimeJson };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oomol-lab/open-flow",
3
- "version": "0.1.0-beta.19",
3
+ "version": "0.1.0-beta.20",
4
4
  "description": "TypeScript contracts and Browser runtime for Open Flow.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {