@okfit/core 0.13.1 → 0.13.3

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.
Files changed (3) hide show
  1. package/Graph.js +14 -14
  2. package/index.d.ts +5 -0
  3. package/package.json +11 -11
package/Graph.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { DiagnosticRange } from "./Diagnostic.js";
2
2
  import { frontmatterFieldSpan, pathFieldsOf, resolvePathField, resolveTarget } from "./internal/links.js";
3
- import { Graph, Option, Schema } from "effect";
3
+ import { Graph as Graph$1, Option, Schema } from "effect";
4
4
 
5
5
  // src/Graph.ts
6
6
  /**
@@ -69,9 +69,9 @@ var LinkGraph = class LinkGraph {
69
69
  constructor(graph, index) {
70
70
  this.graph = graph;
71
71
  this.index = index;
72
- const byIndex = new Map(Graph.entries(Graph.nodes(graph)));
72
+ const byIndex = new Map(Graph$1.entries(Graph$1.nodes(graph)));
73
73
  this.nodes = [...byIndex.values()];
74
- this.edges = Array.from(Graph.values(Graph.edges(graph)), (edge) => ({
74
+ this.edges = Array.from(Graph$1.values(Graph$1.edges(graph)), (edge) => ({
75
75
  from: byIndex.get(edge.source)?.id ?? "",
76
76
  to: byIndex.get(edge.target)?.id ?? "",
77
77
  data: edge.data
@@ -82,15 +82,15 @@ var LinkGraph = class LinkGraph {
82
82
  /** The node with `id`, if present. */
83
83
  node(id) {
84
84
  const at = this.index.get(id);
85
- return at === void 0 ? Option.none() : Graph.getNode(this.graph, at);
85
+ return at === void 0 ? Option.none() : Graph$1.getNode(this.graph, at);
86
86
  }
87
87
  /** Unique targets of outgoing edges; `[]` for an unknown id. */
88
88
  successors(id) {
89
- return this.neighbours(id, (graph, at) => Graph.successors(graph, at));
89
+ return this.neighbours(id, (graph, at) => Graph$1.successors(graph, at));
90
90
  }
91
91
  /** Unique sources of incoming edges; `[]` for an unknown id. */
92
92
  predecessors(id) {
93
- return this.neighbours(id, (graph, at) => Graph.predecessors(graph, at));
93
+ return this.neighbours(id, (graph, at) => Graph$1.predecessors(graph, at));
94
94
  }
95
95
  /** Edges whose target is a `missing` node; the input of lint `broken-links`. */
96
96
  dangling() {
@@ -98,14 +98,14 @@ var LinkGraph = class LinkGraph {
98
98
  }
99
99
  /** Mermaid flowchart; nodes labelled by id, frontmatter edges by field. */
100
100
  toMermaid(options) {
101
- return Graph.toMermaid(this.graph, {
101
+ return Graph$1.toMermaid(this.graph, {
102
102
  ...defaultLabels,
103
103
  ...options
104
104
  });
105
105
  }
106
106
  /** GraphViz DOT; same labelling defaults as `toMermaid`. */
107
107
  toGraphViz(options) {
108
- return Graph.toGraphViz(this.graph, {
108
+ return Graph$1.toGraphViz(this.graph, {
109
109
  ...defaultLabels,
110
110
  ...options
111
111
  });
@@ -113,7 +113,7 @@ var LinkGraph = class LinkGraph {
113
113
  neighbours(id, pick) {
114
114
  const at = this.index.get(id);
115
115
  if (at === void 0) return [];
116
- return [...new Set(pick(this.graph, at))].flatMap((next) => Option.toArray(Graph.getNode(this.graph, next)));
116
+ return [...new Set(pick(this.graph, at))].flatMap((next) => Option.toArray(Graph$1.getNode(this.graph, next)));
117
117
  }
118
118
  };
119
119
  const indexes = /* @__PURE__ */ new WeakMap();
@@ -133,7 +133,7 @@ const indexOf = (bundle) => {
133
133
  *
134
134
  * @public
135
135
  */
136
- var Graph$1 = class {
136
+ var Graph = class {
137
137
  constructor() {}
138
138
  /**
139
139
  * Pure. Resolve `raw`, written in the file at bundle-relative `from`, the way the graph does; `field`
@@ -153,11 +153,11 @@ var Graph$1 = class {
153
153
  concepts: new Set(bundle.concepts.keys())
154
154
  };
155
155
  const index = /* @__PURE__ */ new Map();
156
- const graph = Graph.directed((mutable) => {
156
+ const graph = Graph$1.directed((mutable) => {
157
157
  const node = (id, kind) => {
158
158
  const found = index.get(id);
159
159
  if (found !== void 0) return found;
160
- const created = Graph.addNode(mutable, {
160
+ const created = Graph$1.addNode(mutable, {
161
161
  id,
162
162
  kind
163
163
  });
@@ -167,11 +167,11 @@ var Graph$1 = class {
167
167
  for (const id of bundle.concepts.keys()) node(id, "concept");
168
168
  for (const [id, concept] of bundle.concepts) {
169
169
  const from = node(id, "concept");
170
- for (const edge of edgesOf(concept, lookup)) Graph.addEdge(mutable, from, node(edge.to, edge.kind), edge.data);
170
+ for (const edge of edgesOf(concept, lookup)) Graph$1.addEdge(mutable, from, node(edge.to, edge.kind), edge.data);
171
171
  }
172
172
  });
173
173
  return LinkGraph._make(graph, index);
174
174
  };
175
175
  };
176
176
 
177
- export { Graph$1 as Graph, GraphNodeKind, LinkGraph };
177
+ export { Graph, GraphNodeKind, LinkGraph };
package/index.d.ts CHANGED
@@ -1,3 +1,8 @@
1
+ /**
2
+ * Spec-level Open Knowledge Format (OKF) support for Effect.
3
+ *
4
+ * @packageDocumentation
5
+ */
1
6
  import { Brand, DateTime, Duration, Effect, FileSystem, Graph as Graph$1, Option, Path, Schema } from "effect";
2
7
  import { MarkdownDocument } from "@effected/markdown";
3
8
  import { ConfigReadError } from "@effected/config-file";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@okfit/core",
3
- "version": "0.13.1",
3
+ "version": "0.13.3",
4
4
  "private": false,
5
5
  "description": "Spec-level Open Knowledge Format (OKF) v0.2 schemas, bundle loading, graph, derivation, and validation for Effect.",
6
6
  "keywords": [
@@ -37,16 +37,16 @@
37
37
  "./package.json": "./package.json"
38
38
  },
39
39
  "peerDependencies": {
40
- "@effected/config-file": "^0.26.0",
41
- "@effected/glob": "^0.20.0",
42
- "@effected/jsonc": "^0.24.0",
43
- "@effected/markdown": "^0.28.0",
44
- "@effected/schemastore": "^0.31.0",
45
- "@effected/source": "^0.4.0",
46
- "@effected/toml": "^0.19.1",
47
- "@effected/walker": "^0.26.0",
48
- "@effected/yaml": "^0.29.0",
49
- "effect": "~4.1.2"
40
+ "@effected/config-file": "^0.27.0",
41
+ "@effected/glob": "^0.21.0",
42
+ "@effected/jsonc": "^0.25.0",
43
+ "@effected/markdown": "^0.29.0",
44
+ "@effected/schemastore": "^0.32.0",
45
+ "@effected/source": "^0.5.0",
46
+ "@effected/toml": "^0.20.0",
47
+ "@effected/walker": "^0.28.0",
48
+ "@effected/yaml": "^0.30.0",
49
+ "effect": "~4.1.0"
50
50
  },
51
51
  "engines": {
52
52
  "node": ">=24.11.0"