@kanzo-tech/graph 0.1.0 → 0.3.0

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 (56) hide show
  1. package/README.md +15 -7
  2. package/dist/bounded.d.ts +119 -69
  3. package/dist/bounded.d.ts.map +1 -1
  4. package/dist/bounded.js +13 -34
  5. package/dist/bounded.js.map +1 -1
  6. package/dist/duck-source.d.ts +60 -72
  7. package/dist/duck-source.d.ts.map +1 -1
  8. package/dist/duck-source.js +185 -255
  9. package/dist/duck-source.js.map +1 -1
  10. package/dist/graph-canvas.d.ts +1 -1
  11. package/dist/graph-canvas.js.map +1 -1
  12. package/dist/graph-looks.d.ts +63 -18
  13. package/dist/graph-looks.d.ts.map +1 -1
  14. package/dist/graph-looks.js +37 -26
  15. package/dist/graph-looks.js.map +1 -1
  16. package/dist/graph-model.d.ts +2 -2
  17. package/dist/graph-model.d.ts.map +1 -1
  18. package/dist/graph-model.js +19 -14
  19. package/dist/graph-model.js.map +1 -1
  20. package/dist/graph-sim.d.ts +15 -1
  21. package/dist/graph-sim.d.ts.map +1 -1
  22. package/dist/graph-sim.js +17 -13
  23. package/dist/graph-sim.js.map +1 -1
  24. package/dist/index.d.ts +14 -14
  25. package/dist/index.d.ts.map +1 -1
  26. package/dist/index.js +30 -48
  27. package/dist/index.js.map +1 -1
  28. package/dist/obligations.d.ts +1 -3
  29. package/dist/obligations.d.ts.map +1 -1
  30. package/dist/shape-glyph.d.ts +30 -0
  31. package/dist/shape-glyph.d.ts.map +1 -0
  32. package/dist/shape-glyph.js +15 -0
  33. package/dist/shape-glyph.js.map +1 -0
  34. package/dist/slice-client.d.ts.map +1 -1
  35. package/dist/slice-client.js +36 -36
  36. package/dist/slice-client.js.map +1 -1
  37. package/dist/use-graph-overlays.d.ts +21 -30
  38. package/dist/use-graph-overlays.d.ts.map +1 -1
  39. package/dist/use-graph-overlays.js +39 -37
  40. package/dist/use-graph-overlays.js.map +1 -1
  41. package/dist/use-graph.d.ts +38 -12
  42. package/dist/use-graph.d.ts.map +1 -1
  43. package/dist/use-graph.js +62 -61
  44. package/dist/use-graph.js.map +1 -1
  45. package/dist/use-query-loop.d.ts +8 -4
  46. package/dist/use-query-loop.d.ts.map +1 -1
  47. package/dist/use-query-loop.js +93 -96
  48. package/dist/use-query-loop.js.map +1 -1
  49. package/dist/use-renderer.d.ts.map +1 -1
  50. package/dist/use-renderer.js +69 -66
  51. package/dist/use-renderer.js.map +1 -1
  52. package/package.json +11 -5
  53. package/dist/memory-source.d.ts +0 -32
  54. package/dist/memory-source.d.ts.map +0 -1
  55. package/dist/memory-source.js +0 -134
  56. package/dist/memory-source.js.map +0 -1
@@ -1,18 +1,20 @@
1
+ import { OpenOptions } from '@fossil-lang/corpus';
1
2
  import { Coordinator, Selection } from '@kanzo-tech/mosaic';
2
3
  import { BoundedSource } from './bounded';
3
4
  import { VertexId } from './resident';
4
5
  /**
5
- * A `BoundedSource` over two ordinary relations in DuckDB.
6
+ * The source: a corpus fossil wrote, read through DuckDB.
6
7
  *
7
- * On a subpath because Mosaic is an optional peer and this is the half that needs it: a host drawing
8
- * arrays it already holds takes `memorySource` and pays for no database. Splitting them is what lets
9
- * that promise be true rather than merely stated.
8
+ * On a subpath because Mosaic and fossil's reader are optional peers and this is the half that needs
9
+ * them. The root barrel ships no source at all, which is the whole of what that split now means: a
10
+ * host that installs neither gets the rendering surface and draws nothing.
10
11
  *
11
- * **Neutral about storage, and that is the point.** The neutrality let bounded be measured against
12
- * unbounded before anything committed to a layout on disk — and it is the reason this file survived
13
- * a decision on the other side of the seam. The verb it was written to sit beside never landed:
14
- * `viewport` was dropped and GraphAr with it, because the camera is addressed rather than queried.
15
- * What replaces it is a tile fetched by a computed URL, which is another source.
12
+ * **There used to be two here and the second was neutral about storage.** `duckBoundedSource` took
13
+ * two ordinary relations and the column names that made sense of them, and that neutrality earned
14
+ * its keep once — it let bounded be measured against unbounded before anything committed to a layout
15
+ * on disk. What it cost afterwards is the reason it is gone: a corpus already declares those names
16
+ * in its manifest, so the second source was this side writing down what the other side owns, and the
17
+ * two answered the same question in two dialects of the same SQL.
16
18
  *
17
19
  * **Every query in this file goes through a `SliceRead`, and there is no other path.** `onceQuery`
18
20
  * was the other one — a throwaway client per query, on this subpath, re-exported for the two
@@ -39,62 +41,8 @@ export interface DuckSource extends BoundedSource {
39
41
  */
40
42
  publish(vertices: readonly VertexId[] | null): void;
41
43
  }
42
- export interface DuckSourceOptions {
43
- coordinator: Coordinator;
44
- /**
45
- * The crossfilter this graph draws inside.
46
- *
47
- * Given, the page's predicate rides in the slice query and the canvas draws **what survives**.
48
- * Omitted, the source is a reader of a relation and nothing else — which is what a graph with no
49
- * charts beside it is.
50
- */
51
- filterBy?: Selection;
52
- /** The node relation. */
53
- nodes: string;
54
- /** The edge relation, as pairs of node ids. */
55
- edges: string;
56
- /**
57
- * Which vertex type this relation is.
58
- *
59
- * Required, and with no default, because the source is the only thing that knows: a `dense_id`
60
- * numbers within one type, so the identity a slice carries is only completed here. A corpus of one
61
- * type is type `0` and has to say so — a defaulted `0` would let a second relation ship the same
62
- * identities as the first with nothing raised.
63
- */
64
- typeIndex: number;
65
- /**
66
- * A **dense** integer id — `0..n-1`, no gaps.
67
- *
68
- * Dense because `links` refers to positions rather than to ids, so a consumer never pays for an
69
- * id→index map. GraphAr's `dense_id` is this column by another name.
70
- */
71
- idField?: string;
72
- /**
73
- * The identity column — the subject IRI. **Omitted, a slice carries addresses only.**
74
- *
75
- * A `dense_id` says where a vertex is; the IRI says which vertex it is, and only the second
76
- * survives the layout being redone. The corpus writes it as `subject`, non-null and unique within
77
- * a type, which is why that is the name here — but it stays opt-in rather than defaulted, because
78
- * reading it costs 1.87× the drawing tile and most points are painted rather than named.
79
- *
80
- * Set it when something outlives a session: a bookmark, a link out, a selection that has to mean
81
- * the same thing after the next `fossil run`.
82
- */
83
- subjectField?: string;
84
- xField?: string;
85
- yField?: string;
86
- /**
87
- * **What colours and what sizes are not here**, and their absence is the shape rather than an
88
- * omission: they are `fill` and `r` on the request, because a channel is what the caller wants
89
- * drawn now and this object is where the bytes are. Given here too, recolouring meant building a
90
- * second source — and two places deciding one colour is the state that move ended.
91
- */
92
- sourceField?: string;
93
- targetField?: string;
94
- }
95
- export declare function duckBoundedSource(options: DuckSourceOptions): DuckSource;
96
44
  /**
97
- * A corpus that fossil wrote, read by address.
45
+ * A corpus that fossil wrote, read by address — **and the addressing is fossil's.**
98
46
  *
99
47
  * **The five things a call site used to know, and now does not.** Drawing a corpus meant deriving
100
48
  * the chunk URLs from a `chunk_size` copied by hand, knowing how a tile is named, knowing what the
@@ -107,18 +55,28 @@ export declare function duckBoundedSource(options: DuckSourceOptions): DuckSourc
107
55
  * The consumer knows one thing: **where the corpus is.**
108
56
  *
109
57
  * ```ts
110
- * const { source } = await openCorpus({ coordinator, dest: "/bench/1000000" });
58
+ * const { source } = await openCorpus({ coordinator, dest: "/bench/1000000", wasmUrl });
111
59
  * ```
112
60
  *
113
- * **Addressed, not queried.** The manifest and the per-tile boxes are read once and kept; after that
114
- * a camera move is arithmetic over boxes and a list of URLs. There is deliberately no request on the
115
- * path between the camera moving and a URL being computable — the moment there is one, this has
116
- * become the `viewport` verb fossil deleted.
61
+ * **And this side no longer knows the conventions either, which is the change.** It used to remove
62
+ * that defect for its callers by committing it one level down — a YAML line-scanner, a
63
+ * `chunk{k}.parquet` spelling, a `by_source/tile{k}.parquet` spelling and a `HEAD`-probing search
64
+ * for a tile count — and by the time those were deleted all four were **wrong**: fossil writes
65
+ * `container: rowgroups`, one `tiles.parquet` whose row groups are the tiles, and `vertex_count`
66
+ * had been in the manifest the whole time the search was probing for it. Fossil's `open` is
67
+ * `fossil_graph::plan` compiled to wasm32: the arithmetic the native reader runs, not a second
68
+ * implementation of it that agrees until it does not.
69
+ *
70
+ * **Addressed, not queried.** The manifests and the per-tile boxes are read once and kept; after
71
+ * that a camera move is arithmetic over boxes and a list of URLs. There is deliberately no request
72
+ * on the path between the camera moving and a URL being computable — the moment there is one, this
73
+ * has become the `viewport` verb fossil deleted.
117
74
  *
118
75
  * **What it is not.** It takes no column names and no type index. Those come from the manifest or
119
- * they do not come: a corpus reader that also accepts `idField` is `duckBoundedSource` with extra
120
- * steps, and there is already one of those for the case this is not — an arbitrary relation with
121
- * `x`/`y` that nobody wrote as a corpus.
76
+ * they do not come. There used to be a second source here for the case this is not — an arbitrary
77
+ * relation with `x`/`y` that nobody wrote as a corpus — and taking `idField` here would have been
78
+ * that one with extra steps. It is gone, so the rule is simpler than the guard against it: a column
79
+ * name reaching this door is a name the manifest should have carried.
122
80
  */
123
81
  export interface OpenCorpusOptions {
124
82
  coordinator: Coordinator;
@@ -130,6 +88,17 @@ export interface OpenCorpusOptions {
130
88
  filterBy?: Selection;
131
89
  /** Where the corpus lives, without a trailing slash — the directory holding `graph.graph.yml`. */
132
90
  dest: string;
91
+ /**
92
+ * Where `fossil_graph_wasm_bg.wasm` is.
93
+ *
94
+ * **The one thing about fossil's reader a caller still has to say, and not ours to default.** The
95
+ * addressing runs in WASM, so the module has to be up before a URL can be composed, and only the
96
+ * caller knows how its bundler resolves an asset — `?url` under Vite, an asset import under Next,
97
+ * a `Response` over the bytes in Node. Passed straight through, spelled as fossil spells it.
98
+ * Omitted, the boot is left to whoever already did it: it is memoised for the session, so a host
99
+ * on its second corpus need not say it again.
100
+ */
101
+ wasmUrl?: OpenOptions["wasmUrl"];
133
102
  /**
134
103
  * Which vertex type to draw, when a corpus carries more than one.
135
104
  *
@@ -143,6 +112,25 @@ export interface OpenCorpusOptions {
143
112
  * asks for names when something has to be *named* rather than painted.
144
113
  */
145
114
  subjects?: boolean;
115
+ /**
116
+ * How a manifest is read, when a plain `fetch` of its URL is not how this host reads one.
117
+ *
118
+ * **The default is `manifest` below, and it is the whole of what this file knows about reading a
119
+ * corpus** — right for a corpus served off an origin the page can already read, and wrong for a
120
+ * host whose blobs sit behind a signature. There the URL fossil composes is correct and
121
+ * unreadable, and nothing else on these options carries a credential.
122
+ *
123
+ * Passed straight through to fossil's `open`, which is where the capability belongs: `open`
124
+ * composes every address and lends the reader to each one, so a host that signs a URL signs the
125
+ * index and the per-type manifests the index names **without knowing which files those are**.
126
+ * That is the point of lending a reader rather than handing over bytes — and it is what keeps a
127
+ * signing host on this door, because the alternative it otherwise reaches for is composing the
128
+ * addresses itself, which is the convention-copying `openCorpus` exists to end.
129
+ *
130
+ * It reads manifests and nothing else. The payload is read by the coordinator's own connector,
131
+ * which is the host's already.
132
+ */
133
+ readText?: OpenOptions["readText"];
146
134
  }
147
135
  /**
148
136
  * An opened corpus: the half that **draws** and the half that **answers**.
@@ -1 +1 @@
1
- {"version":3,"file":"duck-source.d.ts","sourceRoot":"","sources":["../src/duck-source.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,WAAW,EAAc,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC7E,OAAO,EAAgC,KAAK,aAAa,EAAgD,MAAM,WAAW,CAAC;AAE3H,OAAO,EAA6B,KAAK,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtE;;;;;;;;;;;;;;;;;GAiBG;AAEH;;;;;;;GAOG;AACH,MAAM,WAAW,UAAW,SAAQ,aAAa;IAC/C;;;;;;;;OAQG;IACH,OAAO,CAAC,QAAQ,EAAE,SAAS,QAAQ,EAAE,GAAG,IAAI,GAAG,IAAI,CAAC;CACrD;AAED,MAAM,WAAW,iBAAiB;IAChC,WAAW,EAAE,WAAW,CAAC;IACzB;;;;;;OAMG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,yBAAyB;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,+CAA+C;IAC/C,KAAK,EAAE,MAAM,CAAC;IACd;;;;;;;OAOG;IACH,SAAS,EAAE,MAAM,CAAC;IAClB;;;;;OAKG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;;;;;;;;OAUG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,MAAM,CAAC,EAAE,MAAM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