@party-stack/ontology-devtools 0.8.7 → 0.8.9

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/lib/Pinned.d.ts CHANGED
@@ -1,11 +1,22 @@
1
- import { LiveOntology, OntologyIR, PinStatus } from "@party-stack/ontology";
1
+ import { LiveOntology, OntologyIR, QueryDocument } from "@party-stack/ontology";
2
2
  //#region src/Pinned.d.ts
3
+ /** One download's definition and readiness, as the inspector shows it. */
4
+ export interface DownloadStatus {
5
+ readonly query: QueryDocument;
6
+ readonly inputs?: Readonly<Record<string, unknown>>;
7
+ readonly attachments: "none" | "all";
8
+ readonly ready: boolean;
9
+ readonly error?: {
10
+ readonly kind: string;
11
+ readonly message: string;
12
+ };
13
+ }
3
14
  export declare function Pinned({ ontology }: {
4
15
  ontology: LiveOntology;
5
16
  }): import("react").JSX.Element;
6
17
  export declare function PinnedContent({ ir, status, loading, error, title }: {
7
18
  ir: OntologyIR;
8
- status?: PinStatus;
19
+ status?: DownloadStatus;
9
20
  loading?: boolean;
10
21
  error?: unknown;
11
22
  title?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"Pinned.d.ts","names":[],"sources":["../src/Pinned.tsx"],"mappings":";;wBASgB,SAAS;EAAc,UAAU;oBAAc,IAAA;wBAgE/C,gBACZ,IACA,QACA,SACA,OACA;EAEA,IAAI;EACJ,SAAS;EACT;EACA;EACA;oBACH,IAAA"}
1
+ {"version":3,"file":"Pinned.d.ts","names":[],"sources":["../src/Pinned.tsx"],"mappings":";;;iBAUiB;WACJ,OAAO;WACP,SAAS,SAAS;WAClB;WACA;WACA;aAAmB;aAAuB;;;wBAGvC,SAAS;EAAc,UAAU;oBAAc,IAAA;wBAiC/C,gBACZ,IACA,QACA,SACA,OACA;EAEA,IAAI;EACJ,SAAS;EACT;EACA;EACA;oBACH,IAAA"}
package/lib/Pinned.js CHANGED
@@ -3,7 +3,7 @@ import { QueryDocumentView, QueryExpression } from "./QueryView.js";
3
3
  import { PinnedFamily, groupPinDownloads } from "./PinnedFamily.js";
4
4
  import { CircleAlert, CircleCheck, LoaderCircle, Paperclip, Pin } from "lucide-react";
5
5
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
6
- import { Suspense, useEffect, useState } from "react";
6
+ import { Suspense } from "react";
7
7
  import { useLiveSuspenseQuery } from "@tanstack/react-db";
8
8
  import { PartyStackLogomark } from "@party-stack/design-system/brand";
9
9
  //#region src/Pinned.tsx
@@ -22,47 +22,12 @@ function Pinned({ ontology }) {
22
22
  function PinInventory({ ontology }) {
23
23
  const { pins } = ontology;
24
24
  const { data: downloads } = useLiveSuspenseQuery((q) => q.from({ pin: pins.collection }).orderBy(({ pin }) => pin.name, "asc").orderBy(({ pin }) => pin.id, "asc"));
25
- const [snapshot, setSnapshot] = useState();
26
- useEffect(() => {
27
- let active = true;
28
- let unsubscribe = () => {};
29
- const onError = (error) => {
30
- if (active) setSnapshot({
31
- pins,
32
- error
33
- });
34
- };
35
- try {
36
- unsubscribe = pins.subscribe((status) => {
37
- if (active) setSnapshot({
38
- pins,
39
- status
40
- });
41
- }, onError);
42
- } catch (error) {
43
- onError(error);
44
- }
45
- return () => {
46
- active = false;
47
- unsubscribe();
48
- };
49
- }, [pins]);
50
- const current = snapshot?.pins === pins ? snapshot : void 0;
51
- if (!downloads.length) return /* @__PURE__ */ jsx(PinnedContent, {
52
- ir: ontology.ir,
53
- status: current?.status,
54
- loading: !current,
55
- error: current?.error
56
- });
57
- return /* @__PURE__ */ jsxs(Fragment, { children: [groupPinDownloads(downloads).map((family) => /* @__PURE__ */ jsx(PinnedFamily, {
25
+ if (!downloads.length) return /* @__PURE__ */ jsx(PinnedContent, { ir: ontology.ir });
26
+ return /* @__PURE__ */ jsx(Fragment, { children: groupPinDownloads(downloads).map((family) => /* @__PURE__ */ jsx(PinnedFamily, {
58
27
  family,
59
28
  ir: ontology.ir,
60
29
  remove: ontology.pins.remove
61
- }, family.name)), current?.status && /* @__PURE__ */ jsx(PinnedContent, {
62
- ir: ontology.ir,
63
- status: current.status,
64
- title: "Legacy application download"
65
- })] });
30
+ }, family.name)) });
66
31
  }
67
32
  function PinnedContent({ ir, status, loading = false, error, title = "Pinned graph" }) {
68
33
  if (loading) return /* @__PURE__ */ jsx("div", {
@@ -117,10 +82,6 @@ function PinnedContent({ ir, status, loading = false, error, title = "Pinned gra
117
82
  role: "alert",
118
83
  children: failure
119
84
  }),
120
- status.previousGraphRetained && /* @__PURE__ */ jsx("p", {
121
- className: "ps-pinned-retained",
122
- children: "The previous graph is retained until this replacement is ready."
123
- }),
124
85
  status.inputs && Object.keys(status.inputs).length > 0 && /* @__PURE__ */ jsxs("details", {
125
86
  className: "ps-pinned-inputs",
126
87
  children: [/* @__PURE__ */ jsx(DisclosureSummary, { children: "Inputs" }), /* @__PURE__ */ jsx(QueryExpression, { expression: {
package/lib/Pinned.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"Pinned.js","names":[],"sources":["../src/Pinned.tsx"],"sourcesContent":["import { PartyStackLogomark } from \"@party-stack/design-system/brand\";\nimport { useLiveSuspenseQuery } from \"@tanstack/react-db\";\nimport { CircleAlert, CircleCheck, LoaderCircle, Paperclip, Pin } from \"lucide-react\";\nimport { Suspense, useEffect, useState } from \"react\";\nimport { DisclosureSummary } from \"./DisclosureSummary.js\";\nimport { PinnedFamily, groupPinDownloads } from \"./PinnedFamily.js\";\nimport { QueryDocumentView, QueryExpression } from \"./QueryView.js\";\nimport type { LiveOntology, OntologyIR, PinStatus } from \"@party-stack/ontology\";\n\nexport function Pinned({ ontology }: { ontology: LiveOntology }) {\n return (\n <div className=\"ps-pinned-inventory\">\n <Suspense fallback={<PinnedContent ir={ontology.ir} loading />}>\n <PinInventory ontology={ontology} />\n </Suspense>\n </div>\n );\n}\n\nfunction PinInventory({ ontology }: { ontology: LiveOntology }) {\n const { pins } = ontology;\n const { data: downloads } = useLiveSuspenseQuery((q) =>\n q\n .from({ pin: pins.collection })\n .orderBy(({ pin }) => pin.name, \"asc\")\n .orderBy(({ pin }) => pin.id, \"asc\")\n );\n const [snapshot, setSnapshot] = useState<{ pins: typeof pins; status?: PinStatus; error?: unknown }>();\n useEffect(() => {\n let active = true;\n let unsubscribe = () => {};\n const onError = (error: unknown) => {\n if (active) setSnapshot({ pins, error });\n };\n try {\n unsubscribe = pins.subscribe((status) => {\n if (active) setSnapshot({ pins, status });\n }, onError);\n } catch (error) {\n onError(error);\n }\n return () => {\n active = false;\n unsubscribe();\n };\n }, [pins]);\n const current = snapshot?.pins === pins ? snapshot : undefined;\n if (!downloads.length)\n return (\n <PinnedContent\n ir={ontology.ir}\n status={current?.status}\n loading={!current}\n error={current?.error}\n />\n );\n return (\n <>\n {groupPinDownloads(downloads).map((family) => (\n <PinnedFamily\n key={family.name}\n family={family}\n ir={ontology.ir}\n remove={ontology.pins.remove}\n />\n ))}\n {current?.status && (\n <PinnedContent ir={ontology.ir} status={current.status} title=\"Legacy application download\" />\n )}\n </>\n );\n}\n\nexport function PinnedContent({\n ir,\n status,\n loading = false,\n error,\n title = \"Pinned graph\",\n}: {\n ir: OntologyIR;\n status?: PinStatus;\n loading?: boolean;\n error?: unknown;\n title?: string;\n}) {\n if (loading)\n return (\n <div className=\"ps-pinned-empty\">\n <output aria-label=\"Reading pinned graph\">\n <span className=\"ps-pinned-logo\">\n <PartyStackLogomark />\n </span>\n </output>\n </div>\n );\n const failure =\n error instanceof Error\n ? error.message\n : typeof error === \"string\"\n ? error\n : error\n ? \"Could not read the pinned graph.\"\n : status?.error?.message;\n if (!status)\n return (\n <div className=\"ps-pinned-empty\">\n <Pin size={24} aria-hidden />\n <p role={failure ? \"alert\" : undefined}>{failure ?? \"No pinned graph.\"}</p>\n </div>\n );\n const state = failure ? \"error\" : status.ready ? \"ready\" : \"loading\";\n const Icon = failure ? CircleAlert : status.ready ? CircleCheck : LoaderCircle;\n return (\n <div className=\"ps-diagnostics-screen ps-pinned-screen\" aria-label=\"Pinned inspector\">\n <header className=\"ps-pinned-header\">\n <div>\n <h2>{title}</h2>\n <div className=\"ps-pinned-meta\">\n <output className=\"ps-pinned-status\" data-state={state}>\n <Icon size={15} aria-hidden />\n {failure\n ? \"Download interrupted\"\n : status.ready\n ? \"Available offline\"\n : \"Loading pinned graph…\"}\n </output>\n <span className=\"ps-pinned-attachments\">\n <Paperclip size={14} aria-hidden />\n {status.attachments === \"all\" ? \"Includes attachment bytes\" : \"Objects only\"}\n </span>\n </div>\n </div>\n </header>\n {failure && (\n <p className=\"ps-replication-error\" role=\"alert\">\n {failure}\n </p>\n )}\n {status.previousGraphRetained && (\n <p className=\"ps-pinned-retained\">\n The previous graph is retained until this replacement is ready.\n </p>\n )}\n {status.inputs && Object.keys(status.inputs).length > 0 && (\n <details className=\"ps-pinned-inputs\">\n <DisclosureSummary>Inputs</DisclosureSummary>\n <QueryExpression expression={{ kind: \"literal\", value: { value: status.inputs } }} />\n </details>\n )}\n <QueryDocumentView query={status.query} ir={ir} showFields={false} />\n </div>\n );\n}\n"],"mappings":";;;;;;;;;AASA,SAAgB,OAAO,EAAE,YAAwC;CAC7D,OACI,oBAAC,OAAD;EAAK,WAAU;EACX,UAAA,oBAAC,UAAD;GAAU,UAAU,oBAAC,eAAD;IAAe,IAAI,SAAS;IAAI,SAAA;GAAS,CAAA;GACzD,UAAA,oBAAC,cAAD,EAAwB,SAAW,CAAA;EAC7B,CAAA;CACT,CAAA;AAEb;AAEA,SAAS,aAAa,EAAE,YAAwC;CAC5D,MAAM,EAAE,SAAS;CACjB,MAAM,EAAE,MAAM,cAAc,sBAAsB,MAC9C,EACK,KAAK,EAAE,KAAK,KAAK,WAAW,CAAC,CAAC,CAC9B,SAAS,EAAE,UAAU,IAAI,MAAM,KAAK,CAAC,CACrC,SAAS,EAAE,UAAU,IAAI,IAAI,KAAK,CAC3C;CACA,MAAM,CAAC,UAAU,eAAe,SAAqE;CACrG,gBAAgB;EACZ,IAAI,SAAS;EACb,IAAI,oBAAoB,CAAC;EACzB,MAAM,WA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;;AAEb"}
1
+ {"version":3,"file":"Pinned.js","names":[],"sources":["../src/Pinned.tsx"],"sourcesContent":["import { PartyStackLogomark } from \"@party-stack/design-system/brand\";\nimport { useLiveSuspenseQuery } from \"@tanstack/react-db\";\nimport { CircleAlert, CircleCheck, LoaderCircle, Paperclip, Pin } from \"lucide-react\";\nimport { Suspense } from \"react\";\nimport { DisclosureSummary } from \"./DisclosureSummary.js\";\nimport { PinnedFamily, groupPinDownloads } from \"./PinnedFamily.js\";\nimport { QueryDocumentView, QueryExpression } from \"./QueryView.js\";\nimport type { LiveOntology, OntologyIR, QueryDocument } from \"@party-stack/ontology\";\n\n/** One download's definition and readiness, as the inspector shows it. */\nexport interface DownloadStatus {\n readonly query: QueryDocument;\n readonly inputs?: Readonly<Record<string, unknown>>;\n readonly attachments: \"none\" | \"all\";\n readonly ready: boolean;\n readonly error?: { readonly kind: string; readonly message: string };\n}\n\nexport function Pinned({ ontology }: { ontology: LiveOntology }) {\n return (\n <div className=\"ps-pinned-inventory\">\n <Suspense fallback={<PinnedContent ir={ontology.ir} loading />}>\n <PinInventory ontology={ontology} />\n </Suspense>\n </div>\n );\n}\n\nfunction PinInventory({ ontology }: { ontology: LiveOntology }) {\n const { pins } = ontology;\n const { data: downloads } = useLiveSuspenseQuery((q) =>\n q\n .from({ pin: pins.collection })\n .orderBy(({ pin }) => pin.name, \"asc\")\n .orderBy(({ pin }) => pin.id, \"asc\")\n );\n if (!downloads.length) return <PinnedContent ir={ontology.ir} />;\n return (\n <>\n {groupPinDownloads(downloads).map((family) => (\n <PinnedFamily\n key={family.name}\n family={family}\n ir={ontology.ir}\n remove={ontology.pins.remove}\n />\n ))}\n </>\n );\n}\n\nexport function PinnedContent({\n ir,\n status,\n loading = false,\n error,\n title = \"Pinned graph\",\n}: {\n ir: OntologyIR;\n status?: DownloadStatus;\n loading?: boolean;\n error?: unknown;\n title?: string;\n}) {\n if (loading)\n return (\n <div className=\"ps-pinned-empty\">\n <output aria-label=\"Reading pinned graph\">\n <span className=\"ps-pinned-logo\">\n <PartyStackLogomark />\n </span>\n </output>\n </div>\n );\n const failure =\n error instanceof Error\n ? error.message\n : typeof error === \"string\"\n ? error\n : error\n ? \"Could not read the pinned graph.\"\n : status?.error?.message;\n if (!status)\n return (\n <div className=\"ps-pinned-empty\">\n <Pin size={24} aria-hidden />\n <p role={failure ? \"alert\" : undefined}>{failure ?? \"No pinned graph.\"}</p>\n </div>\n );\n const state = failure ? \"error\" : status.ready ? \"ready\" : \"loading\";\n const Icon = failure ? CircleAlert : status.ready ? CircleCheck : LoaderCircle;\n return (\n <div className=\"ps-diagnostics-screen ps-pinned-screen\" aria-label=\"Pinned inspector\">\n <header className=\"ps-pinned-header\">\n <div>\n <h2>{title}</h2>\n <div className=\"ps-pinned-meta\">\n <output className=\"ps-pinned-status\" data-state={state}>\n <Icon size={15} aria-hidden />\n {failure\n ? \"Download interrupted\"\n : status.ready\n ? \"Available offline\"\n : \"Loading pinned graph…\"}\n </output>\n <span className=\"ps-pinned-attachments\">\n <Paperclip size={14} aria-hidden />\n {status.attachments === \"all\" ? \"Includes attachment bytes\" : \"Objects only\"}\n </span>\n </div>\n </div>\n </header>\n {failure && (\n <p className=\"ps-replication-error\" role=\"alert\">\n {failure}\n </p>\n )}\n {status.inputs && Object.keys(status.inputs).length > 0 && (\n <details className=\"ps-pinned-inputs\">\n <DisclosureSummary>Inputs</DisclosureSummary>\n <QueryExpression expression={{ kind: \"literal\", value: { value: status.inputs } }} />\n </details>\n )}\n <QueryDocumentView query={status.query} ir={ir} showFields={false} />\n </div>\n );\n}\n"],"mappings":";;;;;;;;;AAkBA,SAAgB,OAAO,EAAE,YAAwC;CAC7D,OACI,oBAAC,OAAD;EAAK,WAAU;EACX,UAAA,oBAAC,UAAD;GAAU,UAAU,oBAAC,eAAD;IAAe,IAAI,SAAS;IAAI,SAAA;GAAS,CAAA;GACzD,UAAA,oBAAC,cAAD,EAAwB,SAAW,CAAA;EAC7B,CAAA;CACT,CAAA;AAEb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ACI,oBAAC,UAAD;IAAQ,WAAU;IACd,UAAA,qBAAC,OAAD,EAAA,UAAA,CACI,oBAAC,MAAD,EAAA,UAAK,MAAU,CAAA,GACf,qBAAC,OAAD;KAAK,WAAU;KAAf,UAAA,CACI,qBAAC,UAAD;MAAQ,WAAU;MAAmB,cAAY;MAAjD,UAAA,CACI,oBAAC,MAAD;OAAM,MAAM;OAAI,eAAA;MAAa,CAAA,GAC5B,UACK,yBACA,OAAO,QACL,sBACA,uBACJ;KACR,CAAA,GAAA,qBAAC,QAAD;MAAM,WAAU;MAAhB,UAAA,CACI,oBAAC,WAAD;OAAW,MAAM;OAAI,eAAA;MAAa,CAAA,GACjC,OAAO,gBAAgB,QAAQ,8BAA8B,cAC5D;KACL,CAAA,CAAA;IACJ,CAAA,CAAA,EAAA,CAAA;GACD,CAAA;GACP,WACG,oBAAC,KAAD;IAAG,WAAU;IAAuB,MAAK;IACpC,UAAA;GACF,CAAA;GAEN,OAAO,UAAU,OAAO,KAAK,OAAO,MAAM,CAAC,CAAC,SAAS,KAClD,qBAAC,WAAD;IAAS,WAAU;IAAnB,UAAA,CACI,oBAAC,mBAAD,EAAA,UAAmB,SAAyB,CAAA,GAC5C,oBAAC,iBAAD,EAAiB,YAAY;KAAE,MAAM;KAAW,OAAO,EAAE,OAAO,OAAO,OAAO;IAAE,EAAI,CAAA,CAC/E;;GAEb,oBAAC,mBAAD;IAAmB,OAAO,OAAO;IAAW;IAAI,YAAY;GAAQ,CAAA;EACnE;;AAEb"}
@@ -1,7 +1,7 @@
1
1
  import { ReplicationDemand, ReplicationLoad } from "./replicationActivity.js";
2
2
  import { ReactNode } from "react";
3
- import { CollectionDemandDiagnostic } from "@party-stack/ontology/tanstack";
4
3
  import { ObjectTypeDef } from "@party-stack/ontology";
4
+ import { CollectionDemandDiagnostic } from "@party-stack/ontology/tanstack";
5
5
  //#region src/QueryPushdown.d.ts
6
6
  export declare function RequestedQuery({ request, demand, object }: {
7
7
  request: CollectionDemandDiagnostic;
@@ -1 +1 @@
1
- {"version":3,"file":"schemaLayout.d.ts","names":[],"sources":["../src/schemaLayout.ts"],"mappings":";;;UAUU;EACN,YAAY;EACZ;EACA;;UAGM;EACN;EACA;EACA;EACA;EACA;EACA,QAAQ;;wBAUI,gBACZ,IAAI,YACJ,MAAM,2CACN;;wBAYY,mBAAmB,MAAM;;;;;;;;wBAYzB,aAAa,IAAI;EAC7B,OAAO;EACP,OAAO;EACP;EACA"}
1
+ {"version":3,"file":"schemaLayout.d.ts","names":[],"sources":["../src/schemaLayout.ts"],"mappings":";;;UAWU;EACN,YAAY;EACZ;EACA;;UAGM;EACN;EACA;EACA;EACA;EACA;EACA,QAAQ;;wBAUI,gBACZ,IAAI,YACJ,MAAM,2CACN;;wBAYY,mBAAmB,MAAM;;;;;;;;wBAYzB,aAAa,IAAI;EAC7B,OAAO;EACP,OAAO;EACP;EACA"}
@@ -1,4 +1,5 @@
1
1
  import { Graph, layout } from "@dagrejs/dagre";
2
+ import { linkTypeId } from "@party-stack/ontology";
2
3
  //#region src/schemaLayout.ts
3
4
  const SCHEMA_CARD_WIDTH = 230;
4
5
  const SCHEMA_CARD_HEIGHT = 176;
@@ -10,7 +11,7 @@ function schemaLinkLabel(ir, side, cardinality) {
10
11
  function schemaRelationship(link) {
11
12
  const label = link.cardinality === "many" ? "one-to-many" : "one-to-one";
12
13
  return {
13
- id: link.id,
14
+ id: linkTypeId(link),
14
15
  source: link.target.objectType,
15
16
  target: link.source.objectType,
16
17
  cardinality: link.cardinality,
@@ -36,7 +37,7 @@ function layoutSchema(ir) {
36
37
  height: 24,
37
38
  label: edgeLabel.label,
38
39
  width: edgeLabel.width
39
- }, link.id);
40
+ }, linkTypeId(link));
40
41
  }
41
42
  layout(graph);
42
43
  const objectTypeByName = new Map(ir.objectTypes.map((objectType) => [objectType.name, objectType]));
@@ -1 +1 @@
1
- {"version":3,"file":"schemaLayout.js","names":[],"sources":["../src/schemaLayout.ts"],"sourcesContent":["import {\n Graph,\n layout as layoutGraph,\n type EdgeLabel,\n type GraphLabel,\n type NodeLabel,\n type Point,\n} from \"@dagrejs/dagre\";\nimport type { ObjectTypeDef, OntologyIR } from \"@party-stack/ontology\";\n\ninterface SchemaNode {\n objectType: ObjectTypeDef;\n x: number;\n y: number;\n}\n\ninterface SchemaEdge {\n id: string;\n label: string;\n labelWidth: number;\n labelX: number;\n labelY: number;\n points: Point[];\n}\n\ninterface SchemaGraphEdgeLabel extends EdgeLabel {\n label: string;\n}\n\nconst SCHEMA_CARD_WIDTH = 230;\nconst SCHEMA_CARD_HEIGHT = 176;\n\nexport function schemaLinkLabel(\n ir: OntologyIR,\n side: OntologyIR[\"linkTypes\"][number][\"source\"],\n cardinality: \"one\" | \"many\"\n): string {\n const object = ir.objectTypes.find((type) => type.name === side.objectType);\n // Preserve relationship-specific labels; use the type's plural only for a default singular label.\n const label =\n cardinality === \"many\" && object?.displayName === side.displayName\n ? object.pluralDisplayName\n : side.displayName;\n return `${cardinality} ${label}`;\n}\n\n/** Diagram arrows run from the referenced object to dependents, so many means one-to-many. */\nexport function schemaRelationship(link: OntologyIR[\"linkTypes\"][number]) {\n const label = link.cardinality === \"many\" ? \"one-to-many\" : \"one-to-one\";\n return {\n id: link.id,\n source: link.target.objectType,\n target: link.source.objectType,\n cardinality: link.cardinality,\n label,\n width: Math.min(180, Math.max(72, label.length * 6 + 16)),\n };\n}\n\nexport function layoutSchema(ir: OntologyIR): {\n nodes: SchemaNode[];\n edges: SchemaEdge[];\n width: number;\n height: number;\n} {\n const graph = new Graph<GraphLabel, NodeLabel, SchemaGraphEdgeLabel>({ multigraph: true })\n .setGraph({\n marginx: 24,\n marginy: 24,\n nodesep: 32,\n rankdir: \"LR\",\n ranksep: 100,\n })\n .setDefaultEdgeLabel(() => ({ label: \"\" }));\n\n for (const objectType of ir.objectTypes) {\n graph.setNode(objectType.name, {\n height: SCHEMA_CARD_HEIGHT,\n width: SCHEMA_CARD_WIDTH,\n });\n }\n for (const link of ir.linkTypes) {\n const edgeLabel = schemaRelationship(link);\n graph.setEdge(\n edgeLabel.source,\n edgeLabel.target,\n {\n height: 24,\n label: edgeLabel.label,\n width: edgeLabel.width,\n },\n link.id\n );\n }\n\n layoutGraph(graph);\n\n const objectTypeByName = new Map(ir.objectTypes.map((objectType) => [objectType.name, objectType]));\n const nodes = graph\n .nodes()\n .map((name) => {\n const objectType = objectTypeByName.get(name);\n const node = graph.node(name);\n if (!objectType || !node) return undefined;\n return {\n objectType,\n x: (node.x ?? 0) - SCHEMA_CARD_WIDTH / 2,\n y: (node.y ?? 0) - SCHEMA_CARD_HEIGHT / 2,\n };\n })\n .filter((node): node is SchemaNode => node !== undefined);\n const edges = graph.edges().map((edge) => {\n const value = graph.edge(edge);\n return {\n id: edge.name ?? `${edge.v}-${edge.w}`,\n label: value.label ?? \"\",\n labelWidth: value.width ?? 72,\n labelX: value.x ?? value.points?.[0]?.x ?? 0,\n labelY: value.y ?? value.points?.[0]?.y ?? 0,\n points: value.points ?? [],\n };\n });\n const graphSize = graph.graph();\n\n return {\n nodes,\n edges,\n width: Math.max(310, graphSize.width ?? 0),\n height: Math.max(256, graphSize.height ?? 0),\n };\n}\n"],"mappings":";;AA6BA,MAAM,oBAAoB;AAC1B,MAAM,qBAAqB;AAE3B,SAAgB,gBACZ,IACA,MACA,aACM;CACN,MAAM,SAAS,GAAG,YAAY,MAAM,SAAS,KAAK,SAAS,KAAK,UAAU;CAM1E,OAAO,GAAG,YAAY,GAHlB,gBAAgB,UAAU,QAAQ,gBAAgB,KAAK,cACjD,OAAO,oBACP,KAAK;AAEnB;;AAGA,SAAgB,mBAAmB,MAAuC;CACtE,MAAM,QAAQ,KAAK,gBAAgB,SAAS,gBAAgB;CAC5D,OAAO;EACH,IAAI,KAAK;EACT,QAAQ,KAAK,OAAO;EACpB,QAAQ,KAAK,OAAO;EACpB,aAAa,KAAK;EAClB;EACA,OAAO,KAAK,IAAI,KAAK,KAAK,IAAI,IAAI,MAAM,SAAS,IAAI,EAAE,CAAC;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M,KAAK,MAAM,SAAS,EAAE,EAAE,KAAK;GAC3C,QAAQ,MAAM,UAAU,CAAC;EAC7B;CACJ,CAAC;CACD,MAAM,YAAY,MAAM,MAAM;CAE9B,OAAO;EACH;EACA;EACA,OAAO,KAAK,IAAI,KAAK,UAAU,SAAS,CAAC;EACzC,QAAQ,KAAK,IAAI,KAAK,UAAU,UAAU,CAAC;CAC/C;AACJ"}
1
+ {"version":3,"file":"schemaLayout.js","names":[],"sources":["../src/schemaLayout.ts"],"sourcesContent":["import {\n Graph,\n layout as layoutGraph,\n type EdgeLabel,\n type GraphLabel,\n type NodeLabel,\n type Point,\n} from \"@dagrejs/dagre\";\nimport { linkTypeId } from \"@party-stack/ontology\";\nimport type { ObjectTypeDef, OntologyIR } from \"@party-stack/ontology\";\n\ninterface SchemaNode {\n objectType: ObjectTypeDef;\n x: number;\n y: number;\n}\n\ninterface SchemaEdge {\n id: string;\n label: string;\n labelWidth: number;\n labelX: number;\n labelY: number;\n points: Point[];\n}\n\ninterface SchemaGraphEdgeLabel extends EdgeLabel {\n label: string;\n}\n\nconst SCHEMA_CARD_WIDTH = 230;\nconst SCHEMA_CARD_HEIGHT = 176;\n\nexport function schemaLinkLabel(\n ir: OntologyIR,\n side: OntologyIR[\"linkTypes\"][number][\"source\"],\n cardinality: \"one\" | \"many\"\n): string {\n const object = ir.objectTypes.find((type) => type.name === side.objectType);\n // Preserve relationship-specific labels; use the type's plural only for a default singular label.\n const label =\n cardinality === \"many\" && object?.displayName === side.displayName\n ? object.pluralDisplayName\n : side.displayName;\n return `${cardinality} ${label}`;\n}\n\n/** Diagram arrows run from the referenced object to dependents, so many means one-to-many. */\nexport function schemaRelationship(link: OntologyIR[\"linkTypes\"][number]) {\n const label = link.cardinality === \"many\" ? \"one-to-many\" : \"one-to-one\";\n return {\n id: linkTypeId(link),\n source: link.target.objectType,\n target: link.source.objectType,\n cardinality: link.cardinality,\n label,\n width: Math.min(180, Math.max(72, label.length * 6 + 16)),\n };\n}\n\nexport function layoutSchema(ir: OntologyIR): {\n nodes: SchemaNode[];\n edges: SchemaEdge[];\n width: number;\n height: number;\n} {\n const graph = new Graph<GraphLabel, NodeLabel, SchemaGraphEdgeLabel>({ multigraph: true })\n .setGraph({\n marginx: 24,\n marginy: 24,\n nodesep: 32,\n rankdir: \"LR\",\n ranksep: 100,\n })\n .setDefaultEdgeLabel(() => ({ label: \"\" }));\n\n for (const objectType of ir.objectTypes) {\n graph.setNode(objectType.name, {\n height: SCHEMA_CARD_HEIGHT,\n width: SCHEMA_CARD_WIDTH,\n });\n }\n for (const link of ir.linkTypes) {\n const edgeLabel = schemaRelationship(link);\n graph.setEdge(\n edgeLabel.source,\n edgeLabel.target,\n {\n height: 24,\n label: edgeLabel.label,\n width: edgeLabel.width,\n },\n linkTypeId(link)\n );\n }\n\n layoutGraph(graph);\n\n const objectTypeByName = new Map(ir.objectTypes.map((objectType) => [objectType.name, objectType]));\n const nodes = graph\n .nodes()\n .map((name) => {\n const objectType = objectTypeByName.get(name);\n const node = graph.node(name);\n if (!objectType || !node) return undefined;\n return {\n objectType,\n x: (node.x ?? 0) - SCHEMA_CARD_WIDTH / 2,\n y: (node.y ?? 0) - SCHEMA_CARD_HEIGHT / 2,\n };\n })\n .filter((node): node is SchemaNode => node !== undefined);\n const edges = graph.edges().map((edge) => {\n const value = graph.edge(edge);\n return {\n id: edge.name ?? `${edge.v}-${edge.w}`,\n label: value.label ?? \"\",\n labelWidth: value.width ?? 72,\n labelX: value.x ?? value.points?.[0]?.x ?? 0,\n labelY: value.y ?? value.points?.[0]?.y ?? 0,\n points: value.points ?? [],\n };\n });\n const graphSize = graph.graph();\n\n return {\n nodes,\n edges,\n width: Math.max(310, graphSize.width ?? 0),\n height: Math.max(256, graphSize.height ?? 0),\n };\n}\n"],"mappings":";;;AA8BA,MAAM,oBAAoB;AAC1B,MAAM,qBAAqB;AAE3B,SAAgB,gBACZ,IACA,MACA,aACM;CACN,MAAM,SAAS,GAAG,YAAY,MAAM,SAAS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AAK,oBAAoB;GACvC,IAAI,KAAK,KAAK,KAAK,qBAAqB;EAC5C;CACJ,CAAC,CAAC,CACD,QAAQ,SAA6B,SAAS,KAAA,CAAS;CAC5D,MAAM,QAAQ,MAAM,MAAM,CAAC,CAAC,KAAK,SAAS;EACtC,MAAM,QAAQ,MAAM,KAAK,IAAI;EAC7B,OAAO;GACH,IAAI,KAAK,QAAQ,GAAG,KAAK,EAAE,GAAG,KAAK;GACnC,OAAO,MAAM,SAAS;GACtB,YAAY,MAAM,SAAS;GAC3B,QAAQ,MAAM,KAAK,MAAM,SAAS,EAAE,EAAE,KAAK;GAC3C,QAAQ,MAAM,KAAK,MAAM,SAAS,EAAE,EAAE,KAAK;GAC3C,QAAQ,MAAM,UAAU,CAAC;EAC7B;CACJ,CAAC;CACD,MAAM,YAAY,MAAM,MAAM;CAE9B,OAAO;EACH;EACA;EACA,OAAO,KAAK,IAAI,KAAK,UAAU,SAAS,CAAC;EACzC,QAAQ,KAAK,IAAI,KAAK,UAAU,UAAU,CAAC;CAC/C;AACJ"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@party-stack/ontology-devtools",
3
- "version": "0.8.7",
3
+ "version": "0.8.9",
4
4
  "files": [
5
5
  "lib"
6
6
  ],
@@ -32,8 +32,8 @@
32
32
  "@party-stack/design-system": "0.1.0",
33
33
  "@party-stack/icons": "0.2.1",
34
34
  "@party-stack/icons-lucide": "0.2.1",
35
- "@party-stack/ontology": "0.23.7",
36
- "@party-stack/runtime": "0.6.2"
35
+ "@party-stack/ontology": "0.25.0",
36
+ "@party-stack/runtime": "0.7.0"
37
37
  },
38
38
  "devDependencies": {
39
39
  "@tailwindcss/postcss": "^4.1.17",
@@ -52,7 +52,7 @@
52
52
  "vite": "npm:@voidzero-dev/vite-plus-core@1.2.0",
53
53
  "vite-plus": "1.2.0",
54
54
  "@party-stack/build-config": "0.2.0",
55
- "@party-stack/ontology-backend": "0.5.0"
55
+ "@party-stack/ontology-backend": "0.7.0"
56
56
  },
57
57
  "peerDependencies": {
58
58
  "@tanstack/db": "1.0.0-rc.1.4",