@factoidal/core 0.7.0 → 0.10.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 (193) hide show
  1. package/CHANGELOG.md +510 -1
  2. package/NOTICE +2 -21
  3. package/README.md +117 -993
  4. package/api.d.ts +53 -0
  5. package/api.js +5 -0
  6. package/api.mjs +56 -0
  7. package/bin/engine.mjs +38 -19
  8. package/bin/factoidal.mjs +513 -67
  9. package/bin/pack.mjs +37 -0
  10. package/bin/serve-worker.mjs +32 -0
  11. package/bin/serve.mjs +423 -0
  12. package/bin/store-worker-host.mjs +1 -1
  13. package/bin/store.mjs +1 -1
  14. package/browser.d.ts +110 -507
  15. package/browser.js +151 -2257
  16. package/docs/fuseki-replacement.md +108 -0
  17. package/fn.d.ts +24 -95
  18. package/fn.js +104 -150
  19. package/index.d.ts +598 -259
  20. package/index.js +4 -234
  21. package/index.mjs +176 -84
  22. package/l4-assets/l4factoidal.js +47 -7
  23. package/l4-assets/l4factoidal.mjs +1 -1
  24. package/l4-assets/l4factoidal.wasm +0 -0
  25. package/l4-assets/version.json +11 -7
  26. package/lib/api.mjs +2300 -0
  27. package/lib/browser-engine.mjs +69 -0
  28. package/lib/dataset.mjs +377 -0
  29. package/lib/delta-log-hosts.mjs +191 -0
  30. package/lib/lean-entry.mjs +204 -0
  31. package/lib/pure.mjs +98 -0
  32. package/lib/store.mjs +115 -0
  33. package/lib/version.mjs +5 -0
  34. package/lws/README.md +97 -0
  35. package/lws/server.mjs +331 -0
  36. package/package.json +59 -61
  37. package/rdfjs.js +5 -536
  38. package/rdfjs.mjs +594 -0
  39. package/sample-store.d.ts +8 -16
  40. package/sample-store.mjs +39 -29
  41. package/solid/client/README.md +100 -0
  42. package/solid/client/index.mjs +277 -0
  43. package/solid/server/README.md +96 -0
  44. package/solid/server/index.mjs +317 -0
  45. package/store-host/deno.mjs +8 -0
  46. package/store-host/index.mjs +12 -0
  47. package/store-host/node.mjs +8 -0
  48. package/xmpp/README.md +107 -0
  49. package/xmpp/index.mjs +229 -0
  50. package/browser-wasm.js +0 -872
  51. package/factoidal-npm-entry.js +0 -15477
  52. package/factoidal-npm-entry.wasm.assets/code-5a7fc68f2ab1323718b8.wasm +0 -0
  53. package/factoidal-npm-entry.wasm.js +0 -455
  54. package/factoidal.js +0 -13118
  55. package/factoidal.wasm.assets/code-bbe6099bfb5b10c4c3ab.wasm +0 -0
  56. package/factoidal.wasm.js +0 -457
  57. package/hacl-init.js +0 -92
  58. package/hacl-wasm/FStar.wasm +0 -0
  59. package/hacl-wasm/Hacl_Bignum.wasm +0 -0
  60. package/hacl-wasm/Hacl_Bignum25519_51.wasm +0 -0
  61. package/hacl-wasm/Hacl_Bignum_Base.wasm +0 -0
  62. package/hacl-wasm/Hacl_Curve25519_51.wasm +0 -0
  63. package/hacl-wasm/Hacl_Ed25519.wasm +0 -0
  64. package/hacl-wasm/Hacl_Ed25519_PrecompTable.wasm +0 -0
  65. package/hacl-wasm/Hacl_Hash_Base.wasm +0 -0
  66. package/hacl-wasm/Hacl_Hash_SHA2.wasm +0 -0
  67. package/hacl-wasm/Hacl_IntTypes_Intrinsics.wasm +0 -0
  68. package/hacl-wasm/LowStar_Endianness.wasm +0 -0
  69. package/hacl-wasm/WasmSupport.wasm +0 -0
  70. package/hacl-wasm/api.js +0 -775
  71. package/hacl-wasm/api.json +0 -3787
  72. package/hacl-wasm/layouts.json +0 -1
  73. package/hacl-wasm/loader.js +0 -568
  74. package/hacl-wasm/shell.js +0 -12
  75. package/l4-core.d.ts +0 -159
  76. package/l4-core.js +0 -188
  77. package/l4.d.ts +0 -50
  78. package/l4.js +0 -104
  79. package/lib/api.js +0 -2300
  80. package/lib/engine-js.js +0 -165
  81. package/lib/engine-wasm.js +0 -300
  82. package/sample-store/CURRENT +0 -1
  83. package/sample-store/gen-1/manifest.sbm2 +0 -0
  84. package/sample-store/gen-1/manifest.tsv +0 -14
  85. package/sample-store/gen-1/predicate-0.ibk3 +0 -0
  86. package/sample-store/gen-1/predicate-0.ibk3.merkle +0 -1
  87. package/sample-store/gen-1/predicate-0.ibk3.oli2 +0 -0
  88. package/sample-store/gen-1/predicate-0.ibk3.oli2.merkle +0 -1
  89. package/sample-store/gen-1/predicate-0.ibk3.sri2 +0 -0
  90. package/sample-store/gen-1/predicate-0.ibk3.sri2.merkle +0 -1
  91. package/sample-store/gen-1/predicate-0.ibk3.tli1 +0 -0
  92. package/sample-store/gen-1/predicate-0.ibk3.tli1.merkle +0 -0
  93. package/sample-store/gen-1/predicate-1.ibk3 +0 -0
  94. package/sample-store/gen-1/predicate-1.ibk3.merkle +0 -0
  95. package/sample-store/gen-1/predicate-1.ibk3.oli2 +0 -0
  96. package/sample-store/gen-1/predicate-1.ibk3.oli2.merkle +0 -0
  97. package/sample-store/gen-1/predicate-1.ibk3.sri2 +0 -0
  98. package/sample-store/gen-1/predicate-1.ibk3.sri2.merkle +0 -1
  99. package/sample-store/gen-1/predicate-1.ibk3.tli1 +0 -0
  100. package/sample-store/gen-1/predicate-1.ibk3.tli1.merkle +0 -1
  101. package/sample-store/gen-1/predicate-10.ibk3 +0 -0
  102. package/sample-store/gen-1/predicate-10.ibk3.merkle +0 -1
  103. package/sample-store/gen-1/predicate-10.ibk3.oli2 +0 -0
  104. package/sample-store/gen-1/predicate-10.ibk3.oli2.merkle +0 -0
  105. package/sample-store/gen-1/predicate-10.ibk3.sri2 +0 -0
  106. package/sample-store/gen-1/predicate-10.ibk3.sri2.merkle +0 -1
  107. package/sample-store/gen-1/predicate-10.ibk3.tli1 +0 -0
  108. package/sample-store/gen-1/predicate-10.ibk3.tli1.merkle +0 -1
  109. package/sample-store/gen-1/predicate-11.ibk3 +0 -0
  110. package/sample-store/gen-1/predicate-11.ibk3.merkle +0 -0
  111. package/sample-store/gen-1/predicate-11.ibk3.oli2 +0 -0
  112. package/sample-store/gen-1/predicate-11.ibk3.oli2.merkle +0 -1
  113. package/sample-store/gen-1/predicate-11.ibk3.sri2 +0 -0
  114. package/sample-store/gen-1/predicate-11.ibk3.sri2.merkle +0 -1
  115. package/sample-store/gen-1/predicate-11.ibk3.tli1 +0 -0
  116. package/sample-store/gen-1/predicate-11.ibk3.tli1.merkle +0 -1
  117. package/sample-store/gen-1/predicate-12.ibk3 +0 -0
  118. package/sample-store/gen-1/predicate-12.ibk3.merkle +0 -1
  119. package/sample-store/gen-1/predicate-12.ibk3.oli2 +0 -0
  120. package/sample-store/gen-1/predicate-12.ibk3.oli2.merkle +0 -1
  121. package/sample-store/gen-1/predicate-12.ibk3.sri2 +0 -0
  122. package/sample-store/gen-1/predicate-12.ibk3.sri2.merkle +0 -1
  123. package/sample-store/gen-1/predicate-12.ibk3.tli1 +0 -0
  124. package/sample-store/gen-1/predicate-12.ibk3.tli1.merkle +0 -1
  125. package/sample-store/gen-1/predicate-2.ibk3 +0 -0
  126. package/sample-store/gen-1/predicate-2.ibk3.merkle +0 -1
  127. package/sample-store/gen-1/predicate-2.ibk3.oli2 +0 -0
  128. package/sample-store/gen-1/predicate-2.ibk3.oli2.merkle +0 -1
  129. package/sample-store/gen-1/predicate-2.ibk3.sri2 +0 -0
  130. package/sample-store/gen-1/predicate-2.ibk3.sri2.merkle +0 -0
  131. package/sample-store/gen-1/predicate-2.ibk3.tli1 +0 -0
  132. package/sample-store/gen-1/predicate-2.ibk3.tli1.merkle +0 -0
  133. package/sample-store/gen-1/predicate-3.ibk3 +0 -0
  134. package/sample-store/gen-1/predicate-3.ibk3.merkle +0 -1
  135. package/sample-store/gen-1/predicate-3.ibk3.oli2 +0 -0
  136. package/sample-store/gen-1/predicate-3.ibk3.oli2.merkle +0 -1
  137. package/sample-store/gen-1/predicate-3.ibk3.sri2 +0 -0
  138. package/sample-store/gen-1/predicate-3.ibk3.sri2.merkle +0 -1
  139. package/sample-store/gen-1/predicate-3.ibk3.tli1 +0 -0
  140. package/sample-store/gen-1/predicate-3.ibk3.tli1.merkle +0 -1
  141. package/sample-store/gen-1/predicate-4.ibk3 +0 -0
  142. package/sample-store/gen-1/predicate-4.ibk3.merkle +0 -0
  143. package/sample-store/gen-1/predicate-4.ibk3.oli2 +0 -0
  144. package/sample-store/gen-1/predicate-4.ibk3.oli2.merkle +0 -1
  145. package/sample-store/gen-1/predicate-4.ibk3.sri2 +0 -0
  146. package/sample-store/gen-1/predicate-4.ibk3.sri2.merkle +0 -1
  147. package/sample-store/gen-1/predicate-4.ibk3.tli1 +0 -0
  148. package/sample-store/gen-1/predicate-4.ibk3.tli1.merkle +0 -2
  149. package/sample-store/gen-1/predicate-5.ibk3 +0 -0
  150. package/sample-store/gen-1/predicate-5.ibk3.merkle +0 -1
  151. package/sample-store/gen-1/predicate-5.ibk3.oli2 +0 -0
  152. package/sample-store/gen-1/predicate-5.ibk3.oli2.merkle +0 -1
  153. package/sample-store/gen-1/predicate-5.ibk3.sri2 +0 -0
  154. package/sample-store/gen-1/predicate-5.ibk3.sri2.merkle +0 -1
  155. package/sample-store/gen-1/predicate-5.ibk3.tli1 +0 -0
  156. package/sample-store/gen-1/predicate-5.ibk3.tli1.merkle +0 -1
  157. package/sample-store/gen-1/predicate-6.ibk3 +0 -0
  158. package/sample-store/gen-1/predicate-6.ibk3.merkle +0 -1
  159. package/sample-store/gen-1/predicate-6.ibk3.oli2 +0 -0
  160. package/sample-store/gen-1/predicate-6.ibk3.oli2.merkle +0 -1
  161. package/sample-store/gen-1/predicate-6.ibk3.sri2 +0 -0
  162. package/sample-store/gen-1/predicate-6.ibk3.sri2.merkle +0 -1
  163. package/sample-store/gen-1/predicate-6.ibk3.tli1 +0 -0
  164. package/sample-store/gen-1/predicate-6.ibk3.tli1.merkle +0 -0
  165. package/sample-store/gen-1/predicate-7.ibk3 +0 -0
  166. package/sample-store/gen-1/predicate-7.ibk3.merkle +0 -0
  167. package/sample-store/gen-1/predicate-7.ibk3.oli2 +0 -0
  168. package/sample-store/gen-1/predicate-7.ibk3.oli2.merkle +0 -2
  169. package/sample-store/gen-1/predicate-7.ibk3.sri2 +0 -0
  170. package/sample-store/gen-1/predicate-7.ibk3.sri2.merkle +0 -1
  171. package/sample-store/gen-1/predicate-7.ibk3.tli1 +0 -0
  172. package/sample-store/gen-1/predicate-7.ibk3.tli1.merkle +0 -1
  173. package/sample-store/gen-1/predicate-8.ibk3 +0 -0
  174. package/sample-store/gen-1/predicate-8.ibk3.merkle +0 -1
  175. package/sample-store/gen-1/predicate-8.ibk3.oli2 +0 -0
  176. package/sample-store/gen-1/predicate-8.ibk3.oli2.merkle +0 -1
  177. package/sample-store/gen-1/predicate-8.ibk3.sri2 +0 -0
  178. package/sample-store/gen-1/predicate-8.ibk3.sri2.merkle +0 -1
  179. package/sample-store/gen-1/predicate-8.ibk3.tli1 +0 -0
  180. package/sample-store/gen-1/predicate-8.ibk3.tli1.merkle +0 -1
  181. package/sample-store/gen-1/predicate-9.ibk3 +0 -0
  182. package/sample-store/gen-1/predicate-9.ibk3.merkle +0 -1
  183. package/sample-store/gen-1/predicate-9.ibk3.oli2 +0 -0
  184. package/sample-store/gen-1/predicate-9.ibk3.oli2.merkle +0 -1
  185. package/sample-store/gen-1/predicate-9.ibk3.sri2 +0 -0
  186. package/sample-store/gen-1/predicate-9.ibk3.sri2.merkle +0 -3
  187. package/sample-store/gen-1/predicate-9.ibk3.tli1 +0 -0
  188. package/sample-store/gen-1/predicate-9.ibk3.tli1.merkle +0 -2
  189. package/select.d.ts +0 -116
  190. package/select.js +0 -492
  191. package/version.json +0 -102
  192. package/wasm.d.ts +0 -130
  193. package/wasm.js +0 -158
package/index.d.ts CHANGED
@@ -1,4 +1,8 @@
1
- // TypeScript declarations for factoidal.
1
+ // TypeScript declarations for @factoidal/core 0.9: one engine, the Lean 4
2
+ // library L4Factoidal compiled to WebAssembly (formal/lean4). Every
3
+ // function below is a dispatch op of that module (Wasm/Dispatch.lean)
4
+ // behind a typed wrapper (lib/api.mjs). The same declarations describe
5
+ // browser.js (browser.d.ts re-exports them).
2
6
  //
3
7
  // Self-contained: the RDF/JS interfaces below are structurally
4
8
  // compatible with @rdfjs/types (same names and shapes) but declared
@@ -80,31 +84,156 @@ export interface DataFactory {
80
84
  export const dataFactory: DataFactory;
81
85
 
82
86
  /**
83
- * An in-memory RDF/JS DatasetCore
84
- * (https://rdf.js.org/dataset-spec/#datasetcore-interface) that also
85
- * round-trips to the engine's N-Quads interchange text.
87
+ * A parse failure that carries a position (issue #344): `line`/
88
+ * `column`/`offset` are set when the failing engine call reported one
89
+ * (Turtle, TriG, N-Triples, N-Quads); `undefined` for an RDF/XML or
90
+ * JSON-LD failure, or any non-parse engine error, which stay a plain
91
+ * `Error`. `name` is `'ParseError'`.
92
+ */
93
+ export class ParseError extends Error {
94
+ readonly name: 'ParseError';
95
+ /** 1-based line of the error. */
96
+ readonly line?: number;
97
+ /** 1-based column of the error, counted in Unicode scalar values. */
98
+ readonly column?: number;
99
+ /**
100
+ * The position of the error as a UTF-16 code-unit index into the input
101
+ * JavaScript string: `text.slice(err.offset)` starts at the error. A
102
+ * character outside the Basic Multilingual Plane (U+10000 and above)
103
+ * counts 2, as in every JavaScript string index. (The engine reports a
104
+ * count of Unicode scalar values; the wrapper converts.)
105
+ */
106
+ readonly offset?: number;
107
+ readonly format?: string;
108
+ }
109
+
110
+ /** One recoverable-parse diagnostic from a `{lenient:true}` parse() call. */
111
+ export interface ParseDiagnostic {
112
+ message: string;
113
+ /**
114
+ * The position of the error as a UTF-16 code-unit index into the input
115
+ * JavaScript string, as ParseError.offset: `text.slice(d.offset)` starts
116
+ * at the error.
117
+ */
118
+ offset: number;
119
+ /** 1-based; a line ends at each LINE FEED (CR LF is one line end). */
120
+ line: number;
121
+ /** 1-based, counted in Unicode scalar values from the start of the line. */
122
+ column: number;
123
+ /**
124
+ * The stable error class (https://github.com/danbri/factoidal/issues/716):
125
+ * 'undefined-prefix', 'relative-iri', 'bad-iri', 'bad-escape',
126
+ * 'unterminated-string', 'bad-literal', 'bad-blank-node',
127
+ * 'bad-prefixed-name', 'bad-directive', 'bad-graph-name', 'rdf12-syntax',
128
+ * 'unclosed-group', 'nesting-limit', 'unexpected-token', 'internal' or
129
+ * 'too-many-errors'.
130
+ */
131
+ class: string;
132
+ }
133
+
134
+ /** Every options key of Dataset.serialize(), serialize() and toString(). */
135
+ export interface WriteOptions {
136
+ /**
137
+ * 'nquads' (default; sorted line order), 'ntriples' (refused when the
138
+ * dataset has a named graph), 'turtle', 'trig', 'rdfxml', 'jsonld'
139
+ * (expanded JSON-LD 1.1), 'rdfc' (RDFC-1.0 canonical N-Quads). Turtle and
140
+ * RDF/XML write the named graphs as one graph. `formats()` lists what
141
+ * each writer supports.
142
+ */
143
+ format?: WriteFormat;
144
+ /** '1.1' refuses a dataset with an RDF 1.2 term; '1.2' (default) writes it. */
145
+ version?: '1.1' | '1.2';
146
+ /** 'turtle' only: prefix label -> namespace IRI, merged over `dataset.prefixes`. */
147
+ prefixes?: Record<string, string>;
148
+ /** 'turtle' only. Default true: integers, decimals, doubles and booleans print bare. */
149
+ literalShorthand?: boolean;
150
+ /** 'jsonld' only (JSON-LD 1.1 API section 8). */
151
+ useNativeTypes?: boolean;
152
+ /** 'jsonld' only. */
153
+ useRdfType?: boolean;
154
+ /** 'jsonld' only. */
155
+ rdfDirection?: string;
156
+ }
157
+
158
+ export type WriteFormat =
159
+ | 'nquads' | 'nq' | 'ntriples' | 'nt' | 'turtle' | 'ttl' | 'trig'
160
+ | 'rdfxml' | 'rdf-xml' | 'rdf' | 'jsonld' | 'json-ld' | 'rdfc' | 'canonical';
161
+
162
+ /** Results formats of query() with `output`. */
163
+ export type ResultsFormat = 'json' | 'xml' | 'csv' | 'tsv' | 'table' | 'ntriples';
164
+
165
+ /** One row of formats(). */
166
+ export interface FormatCapability {
167
+ name: string;
168
+ read11: boolean;
169
+ read12: boolean;
170
+ write11: boolean;
171
+ write12: boolean;
172
+ /** 'core' when both engines serve it; 'full' when only the full engine does. */
173
+ engine: 'core' | 'full';
174
+ }
175
+
176
+ /**
177
+ * An RDF dataset held inside the engine (https://github.com/danbri/factoidal/issues/882).
178
+ * Every producer (parse, csvwToRdf, rmlMap, jsonldToRdf, the closures,
179
+ * rifEval, CONSTRUCT) answers one; every consumer accepts one. The data
180
+ * stays in the wasm memory: a method sends the handle id, not the data.
181
+ * Release it with dispose() or `using`; a Dataset collected without
182
+ * dispose() is released by a FinalizationRegistry. A method of a disposed
183
+ * Dataset throws a TypeError.
86
184
  */
87
185
  export class Dataset implements Iterable<Quad> {
88
- constructor(quads?: Iterable<Quad>);
186
+ private constructor();
187
+ /** The engine's handle id (opaque). */
188
+ readonly handle: string;
189
+ /** Number of quads. */
89
190
  readonly size: number;
191
+ /** Prefixes the source document declared (label -> namespace IRI). */
192
+ readonly prefixes: Record<string, string>;
193
+ /** Diagnostics of a `{lenient:true}` parse; else empty. */
194
+ readonly diagnostics: ParseDiagnostic[];
195
+ /** The parse format tag, when the data was read from text. */
196
+ readonly format: string | undefined;
197
+ /** True when `format` was inferred because the caller gave none. */
198
+ readonly formatInferred: boolean;
199
+ /** True after dispose(). */
200
+ readonly disposed: boolean;
201
+ /** Members the producing op reported: `rounds` (rho-df, RDFS-Plus closures); `inputCount`, `derivedCount`, `fuel` (rifEval). */
202
+ readonly info: Record<string, unknown>;
203
+ query(sparql: string, options?: DatasetQueryOptions): Promise<Bindings[] | boolean | Dataset | string | object>;
204
+ /** SPARQL 1.1 Update in place; answers this Dataset. */
205
+ update(updateText: string, options?: Record<string, never>): Promise<this>;
206
+ validateShacl(shapes: DataInput, options?: { format?: DataFormat; baseIRI?: string }): Promise<ShaclValidateResult>;
207
+ validateShex(schema: string, options: { focus: string | NamedNode | BlankNode; shape?: string | NamedNode | BlankNode | null }): Promise<boolean>;
208
+ closure(regime: ClosureRegime): Promise<Dataset>;
209
+ canonicalize(): Promise<string>;
210
+ serialize(options?: WriteOptions): Promise<string>;
211
+ toString(formatOrOptions?: WriteFormat | WriteOptions): string;
212
+ toNQuads(): string;
213
+ clone(): Dataset;
214
+ /** RDF/JS DatasetCore (https://rdf.js.org/dataset-spec/); match and has use the engine indexes. */
215
+ has(quad: Quad): boolean;
90
216
  add(quad: Quad): this;
91
217
  delete(quad: Quad): this;
92
- has(quad: Quad): boolean;
93
- match(
94
- subject?: Term | null,
95
- predicate?: Term | null,
96
- object?: Term | null,
97
- graph?: Term | null
98
- ): Dataset;
99
- [Symbol.iterator](): Iterator<Quad>;
218
+ match(subject?: Term | null, predicate?: Term | null, object?: Term | null, graph?: Term | null): Dataset;
100
219
  toArray(): Quad[];
101
- /** N-Quads serialization of the quads (the engine interchange form). */
102
- toNQuads(): string;
103
- toString(): string;
104
- static fromNQuads(
105
- text: string,
106
- options?: { blankNodePrefix?: string; factory?: DataFactory }
107
- ): Dataset;
220
+ [Symbol.iterator](): Iterator<Quad>;
221
+ dispose(): void;
222
+ [Symbol.dispose](): void;
223
+ }
224
+
225
+ /** @deprecated The name of Dataset before 0.10.0; removed in 0.11.0. */
226
+ export const DatasetHandle: typeof Dataset;
227
+
228
+ export type ClosureRegime = 'rdfs' | 'owl-rl' | 'rho-df' | 'rdfs-plus';
229
+
230
+ export interface DatasetQueryOptions {
231
+ sparql12?: boolean;
232
+ version?: '1.1' | '1.2';
233
+ /** Close the default graph under a regime before the query. */
234
+ entail?: EntailRegime;
235
+ /** Answer the results document in this format (text; 'json' parsed). */
236
+ output?: ResultsFormat;
108
237
  }
109
238
 
110
239
  // ---------------------------------------------------------------------
@@ -118,7 +247,14 @@ export type DataFormat =
118
247
  | 'nquads' | 'nq'
119
248
  | 'trig'
120
249
  | 'rdfxml' | 'rdf-xml' | 'rdf'
121
- | 'jsonld' | 'json-ld';
250
+ | 'jsonld' | 'json-ld'
251
+ // RDF 1.2 parsers (triple terms, reifiers, annotations, VERSION,
252
+ // directional language tags). The names above parse RDF 1.1 and reject
253
+ // RDF 1.2 syntax with "requires RDF 1.2 mode".
254
+ | 'turtle12' | 'ttl12'
255
+ | 'ntriples12' | 'nt12'
256
+ | 'nquads12' | 'nq12'
257
+ | 'trig12';
122
258
 
123
259
  /** Entailment regime applied to the data before evaluation. */
124
260
  /**
@@ -133,52 +269,89 @@ export type EntailRegime = 'none' | 'RDFS' | 'OWL-RL' | 'x-rdfscore' | 'x-rdfspl
133
269
 
134
270
  /**
135
271
  * One SELECT solution: a Map from variable name (no leading '?') to
136
- * the bound RDF/JS term. Unbound variables are absent from the Map.
272
+ * the bound RDF/JS term. Unbound variables are absent from the Map. The
273
+ * Map iterates in the order of the SELECT clause (the `head.vars` of the
274
+ * SPARQL 1.1 Query Results JSON Format, section 3.1).
137
275
  */
138
276
  export type Bindings = Map<string, Term>;
139
277
 
140
- /** Input data: a Dataset, a document string, or several of either. */
278
+ /**
279
+ * Input data: a Dataset, a document string, or several of either. Text
280
+ * is read in `options.format`; with no format the engine infers one and
281
+ * the error (or `dataset.format`) reports it.
282
+ */
141
283
  export type DataInput =
142
284
  | Dataset
143
285
  | string
144
- | { text: string; format?: DataFormat }
145
- | Array<Dataset | string | { text: string; format?: DataFormat }>;
286
+ | { text: string; format?: DataFormat; baseIRI?: string }
287
+ | Array<Dataset | string | { text: string; format?: DataFormat; baseIRI?: string }>;
288
+
289
+ /** Same as DataInput (kept for 0.9 type imports). */
290
+ export type QueryInput = DataInput;
146
291
 
147
292
  export interface ParseOptions {
148
- /** Default: 'turtle'. */
293
+ /** Omitted: inferred by the engine (op detectFormat), reported in `dataset.format`. */
149
294
  format?: DataFormat;
150
295
  /** Base IRI for resolving relative IRIs (Turtle/TriG/RDF-XML). */
151
296
  baseIRI?: string;
297
+ /**
298
+ * Recover instead of rejecting on the first syntax error
299
+ * (https://github.com/danbri/factoidal/issues/716, engine op
300
+ * `parseDocument`): Turtle, TriG, N-Triples and N-Quads skip each bad
301
+ * statement and keep every good one; `dataset.diagnostics` has one
302
+ * entry per skipped statement. RDF/XML and JSON-LD parse strictly. A
303
+ * document with no error gives the strict result and no diagnostics.
304
+ * Default: false (strict; a syntax error, an undeclared prefix, or an
305
+ * unresolvable relative IRI rejects the whole parse with a ParseError).
306
+ */
307
+ lenient?: boolean;
308
+ /**
309
+ * With `lenient`: stop after this many diagnostics; the parse then ends
310
+ * with one diagnostic of class 'too-many-errors'. Default: no limit.
311
+ */
312
+ maxErrors?: number;
152
313
  }
153
314
 
154
- export interface QueryOptions {
155
- /** Format tag for string data inputs. Default: 'turtle'. */
315
+ export interface QueryOptions extends DatasetQueryOptions {
316
+ /** Format tag for string data inputs; omitted: inferred. */
156
317
  format?: DataFormat;
157
- /** Default: 'none'. */
158
- entail?: EntailRegime;
318
+ baseIRI?: string;
159
319
  }
160
320
 
161
- /** Parse one RDF document into a Dataset. */
162
- export function parse(text: string, options?: ParseOptions): Promise<Dataset>;
321
+ /**
322
+ * Parse one RDF document into a Dataset. The returned Dataset's quad
323
+ * order is sorted (canonical N-Quads order), not document order;
324
+ * anonymous blank-node labels (`_anonN`) DO reflect document order.
325
+ * See README.md's "Blank nodes, labels and statement order". Strict
326
+ * by default (issue #344): a syntax error rejects with a ParseError
327
+ * (`line`/`column`/`offset` for Turtle/TriG/N-Triples/N-Quads; a
328
+ * message only for RDF/XML and JSON-LD). `options.lenient` recovers
329
+ * instead; see ParseOptions.
330
+ */
331
+ export function parse(text: string, options?: ParseOptions | DataFormat): Promise<Dataset>;
163
332
 
164
333
  /**
165
- * Run a SPARQL 1.1 query.
334
+ * Run a SPARQL 1.1 query (or 1.2, with `sparql12`).
166
335
  * SELECT resolves to Bindings[]; ASK resolves to a boolean;
167
- * CONSTRUCT resolves to a Dataset (needs the npm-entry engine bundle
168
- * — rejects with an Error mentioning "pending npm-entry build" when
169
- * only the CLI bundle is available).
336
+ * CONSTRUCT and DESCRIBE resolve to a Dataset (DESCRIBE answers the
337
+ * Concise Bounded Description of each resource named). A `SERVICE <iri>`
338
+ * whose IRI no registerServiceEndpoint() call named answers no
339
+ * solutions even without SILENT
340
+ * (https://github.com/danbri/factoidal/issues/717). `data` may be a DatasetHandle
341
+ * from openDataset(), in which case this routes to `data.query()` and
342
+ * `options.entail` must be 'none' or omitted (a handle carries no
343
+ * entailment-closure step).
170
344
  */
171
345
  export function query(
172
- data: DataInput,
346
+ data: QueryInput,
173
347
  sparql: string,
174
- options?: QueryOptions
175
- ): Promise<Bindings[] | boolean | Dataset>;
348
+ options?: QueryOptions | DataFormat
349
+ ): Promise<Bindings[] | boolean | Dataset | string | object>;
176
350
 
177
351
  /**
178
352
  * Run a SPARQL 1.1 query against a read-only HDT (Header-Dictionary-
179
- * Triples) artifact's raw bytes (factoidal_cli.ml's `--data-hdt`
180
- * backend). No npm-entry engine bundle needed -- CLI-only. Default
181
- * graph only, SELECT/ASK only (no CONSTRUCT, no named graphs).
353
+ * Triples) file's raw bytes (op queryHdt; the bytes cross into the
354
+ * engine with no encoding). Default graph only, SELECT/ASK only.
182
355
  * @param hdtBytes whole .hdt file contents
183
356
  */
184
357
  export function queryHdt(
@@ -230,48 +403,56 @@ export function clearExtensionFunctions(): Promise<void>;
230
403
  export function registerServiceEndpoint(
231
404
  iri: string,
232
405
  data: DataInput,
233
- options?: { format?: DataFormat }
406
+ options?: { format?: DataFormat; baseIRI?: string }
234
407
  ): Promise<{ ok: true; count: number }>;
235
408
 
236
409
  /** Remove every registered SERVICE endpoint snapshot. */
237
410
  export function clearServiceEndpoints(): Promise<void>;
238
411
 
239
- /**
240
- * Apply a SPARQL 1.1 Update, returning the updated Dataset.
241
- * Needs the npm-entry engine bundle.
242
- */
412
+ /** Apply a SPARQL 1.1 Update and answer a NEW Dataset; a Dataset argument is unchanged. */
243
413
  export function update(
244
414
  data: DataInput,
245
415
  updateText: string,
246
- options?: { format?: DataFormat }
416
+ options?: { format?: DataFormat; baseIRI?: string } | DataFormat
247
417
  ): Promise<Dataset>;
248
418
 
249
- export interface SerializeOptions {
250
- /**
251
- * Output format. Default: 'nquads'. 'turtle' (prefix-compacted,
252
- * subject-grouped) needs the npm-entry bundle and flattens every
253
- * named graph into the default graph — use 'nquads' when graph names
254
- * must survive.
255
- */
256
- format?: 'nquads' | 'ntriples' | 'turtle' | 'ttl';
257
- /** Format tag for string data inputs. Default: 'turtle'. */
419
+ /** Open `data` as a Dataset (a Dataset argument is cloned). */
420
+ export function openDataset(
421
+ data: DataInput,
422
+ options?: { format?: DataFormat; baseIRI?: string } | DataFormat
423
+ ): Promise<Dataset>;
424
+
425
+ /** Closure of the default graph under `regime`, as a new Dataset. */
426
+ export function closure(
427
+ data: DataInput,
428
+ regime: ClosureRegime,
429
+ options?: { format?: DataFormat; baseIRI?: string }
430
+ ): Promise<Dataset>;
431
+
432
+ /** The syntaxes the engine reads and writes, from the engine (op datasetFormats). */
433
+ export function formats(): Promise<FormatCapability[]>;
434
+
435
+ export interface SerializeOptions extends WriteOptions {
436
+ /** Format of string `data`; omitted: inferred. */
258
437
  inputFormat?: DataFormat;
438
+ baseIRI?: string;
259
439
  }
260
440
 
261
- /** Serialize a dataset (engine-produced, sorted N-Quads order). */
441
+ /** Write a dataset in a concrete syntax (see WriteOptions). */
262
442
  export function serialize(
263
443
  data: DataInput,
264
- options?: SerializeOptions
444
+ options?: SerializeOptions | WriteFormat
265
445
  ): Promise<string>;
266
446
 
267
447
  /**
268
448
  * RDFC-1.0 dataset canonicalization: canonical blank-node labels plus
269
449
  * sorted canonical N-Quads. Two isomorphic inputs canonicalize to the
270
- * same string.
450
+ * same string. `data` may be a DatasetHandle, in which case this
451
+ * routes to `data.canonicalize()` (options are ignored for a handle).
271
452
  */
272
453
  export function canonicalize(
273
454
  data: DataInput,
274
- options?: { format?: DataFormat }
455
+ options?: { format?: DataFormat; baseIRI?: string } | DataFormat
275
456
  ): Promise<string>;
276
457
 
277
458
  /**
@@ -284,10 +465,12 @@ export function canonicalize(
284
465
  export function graphs(dataset: Dataset): Array<[iri: string, graph: Dataset]>;
285
466
 
286
467
  /**
287
- * RDFC-1.0 canonical hash of a single graph -- the graph-scoped
288
- * sibling of canonicalize(). Every quad's graph component is dropped
468
+ * RDFC-1.0 canonical form of a single graph -- the graph-scoped
469
+ * sibling of canonicalize(). It returns the canonical N-Quads TEXT, not
470
+ * a digest: hash the string yourself (for example `vcSha256Hex`) when a
471
+ * fixed-length value is needed. Every quad's graph component is dropped
289
472
  * before canonicalizing, so isomorphic graphs (including under
290
- * blank-node relabeling) hash to the same string regardless of what
473
+ * blank-node relabeling) give the same string regardless of what
291
474
  * graph name they were extracted from. Typically called with one
292
475
  * entry of graphs()'s output.
293
476
  */
@@ -296,27 +479,33 @@ export function canonicalHash(datasetOrGraph: Dataset): Promise<string>;
296
479
  /** A SHACL validation-report term (see shaclValidate). */
297
480
  export interface ShaclValidateResult {
298
481
  conforms: boolean;
299
- /** SHACL_Validation.validation_report_to_graph's graph as a Dataset. */
482
+ /** The validation report graph: one sh:ValidationReport with
483
+ * sh:conforms, and one sh:result per validation result. */
300
484
  report: Dataset;
301
485
  }
302
486
 
303
487
  /**
304
- * SHACL Core validation. Needs the npm-entry engine bundle.
488
+ * SHACL validation (SHACL Core, SHACL-SPARQL constraints, SHACL 1.2 node
489
+ * expressions) of the data graph's default graph. A shapes graph that
490
+ * uses the SPARQL-based target of SHACL-AF, and a validation failure in
491
+ * the sense of SHACL 5.3.2, reject.
305
492
  * @param data the data graph
306
493
  * @param shapes the shapes graph
307
494
  */
308
495
  export function shaclValidate(
309
496
  data: DataInput,
310
497
  shapes: DataInput,
311
- options?: { format?: DataFormat }
498
+ options?: { format?: DataFormat; baseIRI?: string }
312
499
  ): Promise<ShaclValidateResult>;
313
500
 
314
501
  /**
315
502
  * ShEx (Shape Expressions) validation of one focus node against one
316
- * shape. Needs the npm-entry engine bundle. `null` means "deferred" --
317
- * outside this engine's decidable ShEx fragment, never a guessed
318
- * answer.
319
- * @param schemaJson ShExJ (JSON Schema form), as text
503
+ * shape, over the default graph of `data`. The Lean validator decides
504
+ * every schema it reads, so the answer is a boolean (the type keeps
505
+ * `null`, which an engine that defers a schema would answer). An
506
+ * `IMPORT` in the schema is not followed.
507
+ * @param schemaJson the schema as text: ShExJ when its first
508
+ * non-whitespace character is '{', ShExC otherwise
320
509
  * @param focus an IRI, "_:label", or an RDF/JS NamedNode/BlankNode term
321
510
  * @param shape a shape label (same shapes as focus); omit/null for the
322
511
  * schema's own `start`
@@ -326,18 +515,17 @@ export function shexValidate(
326
515
  schemaJson: string,
327
516
  focus: string | NamedNode | BlankNode,
328
517
  shape?: string | NamedNode | BlankNode | null,
329
- options?: { format?: DataFormat }
518
+ options?: { format?: DataFormat; baseIRI?: string }
330
519
  ): Promise<boolean | null>;
331
520
 
332
521
  /**
333
522
  * RDFS or OWL-RL entailment closure, materialized as a new Dataset
334
- * (input triples + derived triples). Needs the npm-entry engine
335
- * bundle. Default graph only.
523
+ * (input triples + derived triples). Default graph only.
336
524
  */
337
525
  export function owlClosure(
338
526
  data: DataInput,
339
527
  mode: 'RDFS' | 'OWL-RL',
340
- options?: { format?: DataFormat }
528
+ options?: { format?: DataFormat; baseIRI?: string }
341
529
  ): Promise<Dataset>;
342
530
 
343
531
  /**
@@ -346,7 +534,7 @@ export function owlClosure(
346
534
  * `rho_df_closure`): rdfs2/3/5/7/9/11 only, with the machine-checked
347
535
  * decides-iff — on fragment inputs the result's simple query answers
348
536
  * are exactly the entailed consequences (see
349
- * docs/theorem-registry.md). Returns N-Triples text plus status.
537
+ * docs/theorem-registry.md). Returns the closure as a new Dataset.
350
538
  * "corerdfs" is this project's API name for the fragment the
351
539
  * literature calls ρdf (subPropertyOf/subClassOf/type/domain/range —
352
540
  * Muñoz, Pérez & Gutierrez, "Simple and Efficient Minimal RDFS",
@@ -354,29 +542,28 @@ export function owlClosure(
354
542
  */
355
543
  export function coreRdfsClosure(
356
544
  data: DataInput,
357
- options?: { format?: DataFormat }
358
- ): Promise<{ ok: boolean; ntriples: string }>;
545
+ options?: { format?: DataFormat; baseIRI?: string }
546
+ ): Promise<Dataset>;
359
547
 
360
548
  /**
361
- * Decidable core-RDFS fragment check (`is_rho_df_frag`, with its F*
362
- * lemma tying it to the prop the regime theorems quantify over): does
363
- * the certified path's guarantee apply to this data?
549
+ * Decidable core-RDFS fragment check (L4Factoidal/RDFS, `isRhoDfFrag`):
550
+ * is the data in the core-RDFS fragment coreRdfsClosure is defined for?
364
551
  */
365
552
  export function coreRdfsCheck(
366
553
  data: DataInput,
367
- options?: { format?: DataFormat }
554
+ options?: { format?: DataFormat; baseIRI?: string }
368
555
  ): Promise<{ ok: boolean; fragment: boolean }>;
369
556
 
370
557
  /** Literature-name alias for coreRdfsClosure (ρdf). */
371
558
  export function rhoDfClosure(
372
559
  data: DataInput,
373
- options?: { format?: DataFormat }
374
- ): Promise<{ ok: boolean; ntriples: string }>;
560
+ options?: { format?: DataFormat; baseIRI?: string }
561
+ ): Promise<Dataset>;
375
562
 
376
563
  /** Literature-name alias for coreRdfsCheck (ρdf). */
377
564
  export function rhoDfFragmentCheck(
378
565
  data: DataInput,
379
- options?: { format?: DataFormat }
566
+ options?: { format?: DataFormat; baseIRI?: string }
380
567
  ): Promise<{ ok: boolean; fragment: boolean }>;
381
568
 
382
569
  /**
@@ -389,41 +576,39 @@ export function rhoDfFragmentCheck(
389
576
  */
390
577
  export function rdfsPlusClosure(
391
578
  data: DataInput,
392
- options?: { format?: DataFormat }
393
- ): Promise<{ ok: boolean; ntriples: string; rounds: number }>;
579
+ options?: { format?: DataFormat; baseIRI?: string }
580
+ ): Promise<Dataset>;
394
581
 
395
582
  /**
396
- * OWL tableau materialisation (formal/fstar/Tableau.fst's
397
- * `tableau_materialise`): add `i rdf:type <ClassExpression>` for every
583
+ * OWL tableau materialisation (L4Factoidal/OWL/Materialise.lean,
584
+ * `materialiseWithBudget`): add `i rdf:type <ClassExpression>` for every
398
585
  * individual the model-construction reasoner proves is a member of an
399
586
  * OWL class expression (someValuesFrom / hasValue / unionOf /
400
587
  * intersectionOf, and the named class an equivalentClass restriction
401
- * defines). Needs the npm-entry engine bundle. Default graph only.
588
+ * defines). Default graph only.
402
589
  * `dataset` is input + tableau-derived triples; `addedCount` is how
403
- * many triples the tableau added.
590
+ * many triples the tableau added; `budgetHit` is true when the work
591
+ * budget ran out, so an absent membership is then a cap, not a proof.
404
592
  */
405
593
  export function tableauMaterialise(
406
594
  data: DataInput,
407
- options?: { format?: DataFormat }
408
- ): Promise<{ dataset: Dataset; addedCount: number }>;
595
+ options?: { format?: DataFormat; baseIRI?: string }
596
+ ): Promise<{ dataset: Dataset; addedCount: number; budgetHit?: boolean }>;
409
597
 
410
598
  /**
411
- * OWL DL inconsistency verdict (bin/owl-runner's DL pipeline: OWL-RL
412
- * closure -> tableau materialise -> OWL-RL closure -> is_inconsistent).
599
+ * OWL DL inconsistency verdict: OWL RL closure, one class-expression
600
+ * materialisation pass, OWL RL closure again, then the clash decision.
413
601
  * `rlAlone` is the plain OWL-RL verdict on the same input, so a caller
414
- * can see the cases the tableau adds. Needs the npm-entry engine
415
- * bundle. Default graph only.
602
+ * can see the cases the tableau adds. Default graph only.
416
603
  */
417
604
  export function tableauDlInconsistent(
418
605
  data: DataInput,
419
- options?: { format?: DataFormat }
606
+ options?: { format?: DataFormat; baseIRI?: string }
420
607
  ): Promise<{ inconsistent: boolean; rlAlone: boolean }>;
421
608
 
422
609
  /**
423
- * OWL DL consistency verdict via the verified clash-detecting tableau
424
- * (Tableau.Refute.tableau_consistent over the OWL-RL closure -- the
425
- * pure verified chain bin/owl-runner runs under `--regime dl`, minus
426
- * its native-only z3 oracle). Needs the npm-entry engine bundle.
610
+ * OWL DL consistency verdict via the clash-detecting tableau
611
+ * (L4Factoidal/OWL/Refute.lean) over the OWL RL closure.
427
612
  * Default graph only. `consistent` is three-valued: `false` (a clash on
428
613
  * every branch), `true` (a model built), or `null` -- a budget-out, with
429
614
  * `reason` naming the fuel cap (never a silent false).
@@ -434,11 +619,9 @@ export function owlIsConsistent(
434
619
  ): Promise<{ consistent: boolean | null; reason?: string }>;
435
620
 
436
621
  /**
437
- * OWL entailment check: does `premise` entail `conclusion`? Verified
438
- * two-path dispatch: `via: "closure"` (the conclusion is in the OWL-RL
622
+ * OWL entailment check: does `premise` entail `conclusion`? Two paths: `via: "closure"` (the conclusion is in the OWL-RL
439
623
  * closure of the premise) or `via: "refutation"` (the negated
440
- * conclusion is refuted on every goal). Needs the npm-entry engine
441
- * bundle. Default graph only. `entailed` is `true`, `false`, or `null`
624
+ * conclusion is refuted on every goal). Default graph only. `entailed` is `true`, `false`, or `null`
442
625
  * (a refutation budget-out, with `reason` naming the cap).
443
626
  */
444
627
  export function owlEntails(
@@ -449,8 +632,7 @@ export function owlEntails(
449
632
 
450
633
  /**
451
634
  * Evaluate an RML mapping graph against one logical source's raw data,
452
- * returning the generated triples as a Dataset. Needs the npm-entry
453
- * engine bundle. Every triples map in `mapping` reads the SAME
635
+ * returning the generated triples as a Dataset. Every triples map in `mapping` reads the SAME
454
636
  * `sourceData` -- joins across two different logical sources are out
455
637
  * of scope for this entry point.
456
638
  * @param mapping the RML mapping graph (Turtle by default)
@@ -460,7 +642,7 @@ export function rmlMap(
460
642
  mapping: DataInput,
461
643
  sourceData: string,
462
644
  sourceKind: 'json' | 'csv',
463
- options?: { format?: DataFormat }
645
+ options?: { format?: DataFormat; baseIRI?: string }
464
646
  ): Promise<Dataset>;
465
647
 
466
648
  export interface CsvwOptions {
@@ -480,7 +662,7 @@ export interface CsvwOptions {
480
662
  * CSVW csv2rdf conversion (w3.org/TR/csv2rdf): convert raw tabular
481
663
  * data plus an optional CSVW metadata document (JSON text -- '' or
482
664
  * omitted infers the schema from the CSV's own header row) into a
483
- * Dataset. Needs the npm-entry engine bundle. Every table in a
665
+ * Dataset. Every table in a
484
666
  * multi-table `tables` group reads the SAME `csvText`.
485
667
  */
486
668
  export function csvwToRdf(
@@ -498,9 +680,9 @@ export interface JsonLdOptions {
498
680
 
499
681
  /**
500
682
  * Parse a JSON-LD document into a Dataset, with JSON-LD-specific
501
- * options `parse()` has no room for. Needs the npm-entry engine
502
- * bundle (plain `parse(text, {format:'jsonld'})` also works for the
503
- * common case).
683
+ * options `parse()` has no room for (plain `parse(text,
684
+ * {format:'jsonld'})` also works for the common case). A remote
685
+ * `@context` is not fetched.
504
686
  */
505
687
  export function jsonldToRdf(
506
688
  jsonldText: string,
@@ -516,8 +698,7 @@ export interface JsonLdFromRdfOptions {
516
698
  /**
517
699
  * Serialize an RDF dataset as an expanded-form JSON-LD document -- the
518
700
  * reverse of jsonldToRdf (the verified JSONLD.FromRdf.from_rdf).
519
- * Returns the parsed JSON-LD value (an array of node objects). Needs
520
- * the npm-entry engine bundle.
701
+ * Returns the parsed JSON-LD value (an array of node objects).
521
702
  */
522
703
  export function jsonldFromRdf(
523
704
  data: DataInput,
@@ -527,14 +708,14 @@ export function jsonldFromRdf(
527
708
  /**
528
709
  * did:key resolution: resolve a `did:key:z6Mk...` (Ed25519) to its DID
529
710
  * Document, returned as a Dataset (the verified DID_Key.did_key_document).
530
- * Needs the npm-entry engine bundle.
711
+ *
531
712
  */
532
713
  export function didKeyResolve(didString: string): Promise<Dataset>;
533
714
 
534
715
  /**
535
- * Test whether an XML document is well-formed (Parser_XML). The
536
- * byte-oriented parser has no DOCTYPE/DTD production, so a document
537
- * containing a DOCTYPE reports false. Needs the npm-entry engine bundle.
716
+ * Test whether an XML document is well-formed (XML 1.0). A DOCTYPE with
717
+ * an internal subset is read (XML 1.0 section 2.8); an external DTD is
718
+ * not fetched.
538
719
  */
539
720
  export function xmlWellformed(xmlText: string): Promise<boolean>;
540
721
 
@@ -543,13 +724,16 @@ export interface XPathResult {
543
724
  resultType: 'nodeset' | 'string' | 'number' | 'boolean';
544
725
  count?: number;
545
726
  stringValue?: string;
727
+ /** `kind` includes 'root' and 'namespace' as well as 'element',
728
+ * 'attribute', 'text', 'comment' and 'processing-instruction'. */
546
729
  nodes?: Array<{ kind: string; name: string; value: string }>;
547
730
  value?: string | number | boolean;
548
731
  }
549
732
 
550
733
  /**
551
- * Evaluate an XPath 1.0 expression over an XML document
552
- * (XPath_Eval.eval_xpath_from_root). Needs the npm-entry engine bundle.
734
+ * Evaluate an XPath 1.0 expression over an XML document (the full
735
+ * XPath 1.0 function library). A number result is its XPath string form
736
+ * when it is not finite ('Infinity', 'NaN').
553
737
  */
554
738
  export function xpathEval(
555
739
  xmlText: string,
@@ -558,53 +742,228 @@ export function xpathEval(
558
742
 
559
743
  /**
560
744
  * RIF Core forward-chaining saturation, materialized as a new Dataset
561
- * (input triples + derived triples, default graph only). Needs the
562
- * npm-entry engine bundle.
745
+ * (input triples + derived triples, default graph only).
563
746
  * @param data the premise graph
564
747
  * @param rifRulesXml a RIF Core XML rule document
565
748
  */
566
749
  export function rifEval(
567
750
  data: DataInput,
568
751
  rifRulesXml: string,
569
- options?: { format?: DataFormat }
752
+ options?: { format?: DataFormat; baseIRI?: string }
570
753
  ): Promise<Dataset>;
571
754
 
572
755
  // ---------------------------------------------------------------------
573
- // In-memory COTTAS bytes store (docs/designissues/2026-07-06-inmemory-
574
- // bytes-store.md). openCottas()'s handle is NOT a Dataset: rows decode
575
- // lazily as queryCottas() touches them, never materializing the whole
576
- // corpus onto the heap. Needs the npm-entry engine bundle.
756
+ // The persisted store: Shardborough generations (IBK3, IBK4 and IBK5
757
+ // blocks with their index sidecars) that `factoidal pack` or the native
758
+ // l4block-shard-pack wrote. skills/shardborough-storage describes the
759
+ // format. A Store is a store handle inside the engine: every artifact it
760
+ // read was checked against the SHA-256 its manifest commits, once, and
761
+ // every query answers from the decoded, indexed blocks it retains.
577
762
  // ---------------------------------------------------------------------
578
763
 
579
- /** Open a COTTAS/Parquet artifact's raw bytes as a queryable, read-only store. */
580
- export function openCottas(bytes: Uint8Array | ArrayBuffer | string): Promise<string>;
764
+ /**
765
+ * Reads one file of a store: `path` is relative to the collection root
766
+ * ('CURRENT', 'gen-1/manifest.sbm2', 'gen-1/predicate-0.ibk3', ...). In a
767
+ * browser, a reader over fetch():
768
+ * `(p) => fetch(base + p).then((r) => r.arrayBuffer())`.
769
+ */
770
+ export type StoreReader =
771
+ (path: string) => Uint8Array | ArrayBuffer | Promise<Uint8Array | ArrayBuffer>;
772
+
773
+ export interface OpenStoreOptions {
774
+ /** Open this generation directory instead of the one CURRENT names. */
775
+ generation?: string;
776
+ /** Read only the artifacts this query's plan names. */
777
+ sparql?: string;
778
+ /** Read exactly these artifact keys. */
779
+ keys?: string[];
780
+ }
781
+
782
+ /** An open store handle (op storeOpen). */
783
+ export class Store {
784
+ readonly handle: string;
785
+ readonly generation: string;
786
+ /** True when the generation was opened through CURRENT. */
787
+ readonly activated: boolean;
788
+ readonly identity: string;
789
+ /** The manifest layout label, e.g. 'predicate-ibk3-ptd1-sri2-tli1-oli2-merkle-v0'. */
790
+ readonly layout: string;
791
+ readonly wireVersion: number;
792
+ /** Artifacts read and verified. */
793
+ readonly artifacts: number;
794
+ /** Artifact bytes read. */
795
+ readonly bytes: number;
796
+ /** Rows the handle retains. */
797
+ readonly rows: number;
798
+ readonly closed: boolean;
799
+ /** One SPARQL 1.1 query against the retained blocks. The engine refuses
800
+ * a query whose plan needs a block the handle did not read. */
801
+ query(sparql: string): Promise<Bindings[] | boolean | Dataset>;
802
+ /** The manifest, decoded by the engine (op storeManifestInspect). */
803
+ inspect(): Promise<Record<string, unknown>>;
804
+ /** Release the handle. Idempotent. */
805
+ close(): Promise<void>;
806
+ }
581
807
 
582
808
  /**
583
- * Run a SPARQL 1.1 query against a store opened by openCottas(). No
584
- * `entail` option and no write overlay (read-only) -- see
585
- * npm/factoidal/lib/api.js's queryCottas doc comment for the full
586
- * divergence list from query().
587
- * @param handle from openCottas()
809
+ * Open a store. `source` is a collection root path (Node; the directory
810
+ * holding CURRENT) or a StoreReader (any runtime). With no options every
811
+ * artifact the manifest declares is read. Large collections need a
812
+ * deeper call stack than Node's default: see
813
+ * `@factoidal/core/store-worker` (README "The persisted store").
588
814
  */
589
- export function queryCottas(
590
- handle: string,
591
- sparql: string
815
+ export function openStore(source: string | StoreReader, options?: OpenStoreOptions): Promise<Store>;
816
+
817
+ /** One query against a store: open with the query's plan, query, close. */
818
+ export function queryStore(
819
+ source: string | StoreReader,
820
+ sparql: string,
821
+ options?: { generation?: string }
592
822
  ): Promise<Bindings[] | boolean | Dataset>;
593
823
 
594
- /** Release a store opened by openCottas(). */
595
- export function closeCottas(handle: string): Promise<void>;
824
+ /** The store handles this engine instance holds open, with the residency caps (op storeHandleList). */
825
+ export function listStores(): Promise<Record<string, unknown>>;
826
+
827
+ /**
828
+ * A durable update log (hub post 18): the object deltaLogOpen() returns.
829
+ * In the browser the log is an IndexedDB database named `dbName`; under
830
+ * Node it lives in the memory of the process.
831
+ */
832
+ export interface DeltaLogHandle {
833
+ dbName: string;
834
+ }
835
+
836
+ /** What deltaLogInspect() reports (op deltaLogDecode). */
837
+ export interface DeltaLogInspection {
838
+ /** Batches (records) that verify, from the start of the log. */
839
+ batches: number;
840
+ /** Entries in those batches. */
841
+ entries: number;
842
+ /** The log ends with a torn final record: an append that did not complete. */
843
+ torn: boolean;
844
+ /** Bytes of that torn record (0 when the log is not torn). */
845
+ tornBytes: number;
846
+ /** Bytes of the whole log. */
847
+ logBytes: number;
848
+ records: Array<{ seq: number; epoch: number; entries: number }>;
849
+ }
850
+
851
+ /** Open (create when absent) a durable update log. Default name 'factoidal-delta-log'. */
852
+ export function deltaLogOpen(dbName?: string): Promise<DeltaLogHandle>;
853
+
854
+ /**
855
+ * Append one SPARQL Update request as one record (op deltaLogEncode).
856
+ * INSERT DATA, DELETE DATA, CLEAR DEFAULT, CLEAR GRAPH, DROP GRAPH and
857
+ * CREATE GRAPH are admitted; any other form rejects and nothing is written.
858
+ */
859
+ export function deltaLogAppend(
860
+ handle: DeltaLogHandle,
861
+ sparqlUpdate: string,
862
+ options?: { epoch?: number }
863
+ ): Promise<{ seq: number; opCount: number }>;
864
+
865
+ /** The records of the log, in commit order, as hexadecimal text joined by "\n". */
866
+ export function deltaLogReadAllHex(handle: DeltaLogHandle): Promise<string>;
867
+
868
+ /**
869
+ * Merge on read (op deltaLogMerge): `baseNQuads` with the batches of the log
870
+ * applied in commit order, as N-Quads. A torn final record (an append that
871
+ * did not complete) is not applied. A damaged record, or a record whose
872
+ * entries the engine cannot decode, makes the merge reject: the records after
873
+ * it would otherwise be lost (https://github.com/danbri/factoidal/issues/843).
874
+ */
875
+ export function deltaLogMerge(handle: DeltaLogHandle, baseNQuads: string): Promise<string>;
596
876
 
597
877
  /**
598
- * Serialize a dataset to COTTAS/Parquet bytes via the native writer
599
- * (RDF.CottasStore.BaseWriter.serialize_cottas_v2). Round-trips into
600
- * openCottas().
878
+ * What the log holds, record by record (op deltaLogDecode). Rejects for a
879
+ * damaged record or a record whose entries the engine cannot decode.
601
880
  */
602
- export function toCottas(data: DataInput): Promise<Uint8Array>;
881
+ export function deltaLogInspect(handle: DeltaLogHandle): Promise<DeltaLogInspection>;
882
+
883
+ /** Remove the log and its records. */
884
+ export function deltaLogDestroy(handle: DeltaLogHandle): Promise<void>;
885
+
886
+ /** TEST ONLY: cut the last 4 bytes of the last record, as a torn write would. False when the log is empty. */
887
+ export function _deltaLogCorruptLastForTest(handle: DeltaLogHandle): Promise<boolean>;
888
+
889
+
890
+
891
+ // ---------------------------------------------------------------------
892
+ // Common Logic (ISO/IEC 24707:2018) and IKL
893
+ // ---------------------------------------------------------------------
894
+
895
+ // Reads Common Logic Interchange Format
896
+ // text (ISO/IEC 24707:2018), with the IKL `that`-operator extension,
897
+ // and reports its shape -- it never produces RDF. `pureCL` is a
898
+ // DIALECT flag, not a validity or quality signal: true while the text
899
+ // stays inside ISO/IEC 24707 Common Logic, false once it uses IKL's
900
+ // `that` operator. A CLIF text that fails to parse rejects instead of
901
+ // returning either value.
902
+ export function clParse(clifText: string): Promise<{
903
+ ok: boolean;
904
+ sentences: number;
905
+ pureCL: boolean;
906
+ normalized: string;
907
+ }>;
908
+
909
+ // Reads CLIF text and writes it
910
+ // back out in canonical spacing. `roundTripProved` is ALWAYS `false`:
911
+ // `clif_roundTrip` (CL/ClifAdequacy.lean) is an OPEN lemma -- the
912
+ // fragment boundary `marksLexable` is MEASURED, not proved. The field
913
+ // is surfaced, not dropped or defaulted away, so a caller does not
914
+ // have to go find that out.
915
+ export function clSerialize(clifText: string): Promise<{
916
+ ok: boolean;
917
+ clif: string;
918
+ sentences: number;
919
+ roundTripProved: false;
920
+ }>;
921
+
922
+ // Alpha-normalises CLIF text: the
923
+ // canonical representative of each sentence's bound-variable-renaming
924
+ // equivalence class -- IKL GUIDE Appendix B condition (1), renaming a
925
+ // bound variable does not change the proposition expressed. Two
926
+ // sentences that differ only in bound-variable names produce
927
+ // byte-identical `clif` output.
928
+ export function clAlphaNorm(clifText: string): Promise<{
929
+ ok: boolean;
930
+ clif: string;
931
+ sentences: number;
932
+ }>;
933
+
934
+ // Hayes's reduction of IKL to
935
+ // Common Logic (danbri/factoidal#625), over a whole text.
936
+ //
937
+ // `preserves: "satisfiability"` -- the reduction preserves
938
+ // satisfiability, NOT equivalence. It suits entailment and consistency
939
+ // testing; it is not a transformation to apply to data you intend to
940
+ // keep.
941
+ //
942
+ // `noIntrusion` IS the proof hypothesis `CL.noIntrSs [] []` decides,
943
+ // not a paraphrase of it. The transformation runs and returns output
944
+ // either way; when `noIntrusion` is `false`, `tails_satisfiable` /
945
+ // `normalize_preserves` do not cover that output.
946
+ export function clNormalize(clifText: string): Promise<{
947
+ ok: boolean;
948
+ head: string[];
949
+ tail: string[];
950
+ clif: string;
951
+ sentences: number;
952
+ thatCount: number;
953
+ noIntrusion: boolean;
954
+ preserves: 'satisfiability';
955
+ provedUnder: string;
956
+ }>;
957
+
958
+ // clFiniteSat is DEFERRED from this typed surface (owner decision,
959
+ // 2026-08-26), not excluded: it takes a caller-supplied finite-
960
+ // interpretation JSON encoding that has no user yet. Reachable only
961
+ // through the raw dispatch ABI (`(await loadEngine()).call('clFiniteSat',
962
+ // [interpJson, clifText])`), which needs no typed shape commitment here.
603
963
 
604
964
  // ---------------------------------------------------------------------
605
965
  // Typed engine functions (#74 npm FP surface). Each is a pure,
606
- // value-in / value-out wrapper over one F*-extracted engine; all need
607
- // the npm-entry bundle.
966
+ // value-in / value-out wrapper over one engine op.
608
967
  // ---------------------------------------------------------------------
609
968
 
610
969
  /**
@@ -743,100 +1102,17 @@ export function toanSubst(
743
1102
  value: ToanExpr
744
1103
  ): Promise<string>;
745
1104
 
746
- /** A matrix/vector cell: an integer or an exact [num, den] rational. */
747
- export type MatrixCell = number | [number, number];
748
-
749
- /** The rendered result of a matrix/vector operation. */
750
- export interface MatrixResult {
751
- /** Math.Matrix.mres_to_string of the result ("undef" on failure). */
752
- result: string;
753
- /** The diagnostic reason when the result is undefined, else "". */
754
- reason: string;
755
- }
756
-
757
- /** Exact determinant of a square matrix (Math.Matrix.dyn_determinant). */
758
- export function matrixDeterminant(
759
- matrix: MatrixCell[][]
760
- ): Promise<MatrixResult>;
761
-
762
- /** Dot product of two vectors (Math.Matrix.dyn_scalarproduct). */
763
- export function matrixScalarProduct(
764
- a: MatrixCell[],
765
- b: MatrixCell[]
766
- ): Promise<MatrixResult>;
767
-
768
- /** Cross product of two 3-vectors (Math.Matrix.dyn_vectorproduct). */
769
- export function matrixVectorProduct(
770
- a: MatrixCell[],
771
- b: MatrixCell[]
772
- ): Promise<MatrixResult>;
773
-
774
- /** Outer product of two vectors (Math.Matrix.dyn_outerproduct). */
775
- export function matrixOuterProduct(
776
- a: MatrixCell[],
777
- b: MatrixCell[]
778
- ): Promise<MatrixResult>;
779
-
780
- /**
781
- * A fixed-precision decimal (Math.Sigmoid.scaled: mantissa / 10^scale),
782
- * the same (mantissa, scale) convention SPARQL11.Algebra.parse_to_scaled
783
- * uses for xsd:decimal literals. `decimal` is the same pair formatted
784
- * back to a string by SPARQL11_Algebra.format_scaled_value.
785
- */
786
- export interface ScaledValue {
787
- mantissa: string;
788
- scale: string;
789
- decimal: string;
790
- }
791
1105
 
792
- /** Parameters for {@link sigmoidPoints}: decimal-literal strings/numbers. */
793
- export interface SigmoidParams {
794
- k: number | string;
795
- x0: number | string;
796
- l: number | string;
797
- xmin: number | string;
798
- xmax: number | string;
799
- n: number | string;
800
- }
801
-
802
- /**
803
- * n+1 evenly spaced samples of the logistic sigmoid
804
- * L / (1 + exp(-k*(x - x0))) over [xmin, xmax] (Math.Sigmoid.
805
- * sigmoid_points). All arithmetic -- argument reduction, the
806
- * truncated Taylor series, repeated squaring, and the x samples
807
- * themselves -- runs as exact rational arithmetic inside
808
- * Math.Sigmoid.fst; see that module's header for the documented error
809
- * bound on the returned (rounded) values.
810
- */
811
- export function sigmoidPoints(
812
- params: SigmoidParams
813
- ): Promise<Array<{ x: ScaledValue; y: ScaledValue }>>;
814
-
815
- /**
816
- * Presentation MathML for the sigmoid formula L / (1 + exp(-k*(x - x0))),
817
- * engine-serialized (MathML.Present.to_presentation_mathml applied to a
818
- * fixed Math.Expr.expr) -- never hand-written MathML.
819
- */
820
- export function sigmoidFormulaMathml(): Promise<string>;
821
1106
 
822
1107
  // ---------------------------------------------------------------------
823
- // VC Data Integrity crypto (eddsa-rdfc-2022) — the F*-extracted
824
- // VC_DataIntegrity pipeline, its four crypto assume vals realised by
825
- // HACL*'s OWN official WebAssembly build (hacl-wasm). All need the
826
- // npm-entry bundle AND the HACL* wasm backend.
827
- //
828
- // Init story: on the Node entries (index.js/index.mjs and the /wasm
829
- // entry) these typed wrappers AUTO-AWAIT initHacl() on the first VC
830
- // call — a caller never has to remember the init step. In the browser
831
- // (browser.js) the page must initialise HACL* itself first (the
832
- // hacl-wasm URL is page-specific); see browser.js's VC section. Either
833
- // way, an uninitialised backend makes verify THROW, never silently
834
- // return true (#286, the throw-on-uninit contract).
1108
+ // VC Data Integrity crypto (eddsa-rdfc-2022), the ops of
1109
+ // formal/lean4/Wasm/Ops/Vc.lean. Ed25519 is HACL*'s C code compiled into
1110
+ // the wasm module; SHA-256 is the Lean hash. No initialisation step.
835
1111
  // ---------------------------------------------------------------------
836
1112
 
837
1113
  /**
838
1114
  * SHA-256 of a message string's bytes, as a lowercase hex digest
839
- * (VC_DataIntegrity.hash_sha256_hex, HACL* SHA-2).
1115
+ * (the Lean SHA-256).
840
1116
  */
841
1117
  export function vcSha256Hex(message: string): Promise<string>;
842
1118
 
@@ -885,7 +1161,7 @@ export function vcEddsaVerifyFromCanonical(
885
1161
 
886
1162
  /**
887
1163
  * VC Data Model 2.0 structural conformance check (VC.Credential.fst's
888
- * vc_check_from_string, F*-verified — 117 pass, 0 fail on the offline
1164
+ * vc_check_from_string, ported to L4Factoidal/VC/Credential.lean — 117 pass, 0 fail on the offline
889
1165
  * vc_stage1 fixture suite). Pure structural validation, no crypto.
890
1166
  * `v2ctxJson` is the vendored VCDM v2 base context document's raw JSON
891
1167
  * text (third_party/contexts/credentials-v2.jsonld); `credentialJson`
@@ -928,7 +1204,11 @@ export function vcCheckRelatedResourceDigests(
928
1204
  credentialJson: string
929
1205
  ): Promise<{ valid: boolean; reason?: string }>;
930
1206
 
931
- /** Feature probe for the currently available engine bundles. */
1207
+ /**
1208
+ * Feature probe: which ops the loaded wasm module serves. A module older
1209
+ * than this package can lack some; an operation whose op is missing
1210
+ * rejects naming it.
1211
+ */
932
1212
  export function capabilities(): Promise<{
933
1213
  entry: boolean;
934
1214
  construct: boolean;
@@ -954,21 +1234,32 @@ export function capabilities(): Promise<{
954
1234
  jsonSchema: boolean;
955
1235
  schematron: boolean;
956
1236
  toan: boolean;
957
- matrix: boolean;
958
- /** The sigmoid (Math.Sigmoid) ABI exports are present. */
959
- sigmoid: boolean;
960
- /**
961
- * The VC Data Integrity crypto ABI exports are present. Note: the
962
- * HACL* wasm backend is still initialised at call time — this flag
963
- * reports export availability, not that init has run.
964
- */
1237
+ /** The VC Data Integrity crypto ops are present. */
965
1238
  vcCrypto: boolean;
966
- /** The in-memory COTTAS bytes store exports are present. */
967
- cottasBytesStore: boolean;
1239
+ /** query()'s `entail` regimes (op queryRaw) are served. */
1240
+ entailment: boolean;
1241
+ /** queryHdt() (op queryHdt) is served. */
1242
+ hdt: boolean;
1243
+ /** query()'s `sparql12` and DatasetHandle.query's (queryDataset12, datasetQuery12). */
1244
+ sparql12: boolean;
1245
+ /** openStore() and the Store methods (storeOpen, storeHandleQuery). */
1246
+ store: boolean;
1247
+ /** The deltaLog* functions (deltaLogEncode, deltaLogDecode, deltaLogMerge). */
1248
+ deltaLog: boolean;
1249
+ /** 'full': the whole library is in the wasm module. */
1250
+ profile: 'full' | string;
1251
+ /** The dispatch ABI version string of the loaded wasm module. */
1252
+ abiVersion: string;
1253
+ /** openDataset()/DatasetHandle (datasetOpen/Query/Update/Serialize/Close) are present. */
1254
+ datasetHandles: boolean;
1255
+ /** parse()'s `{lenient:true}` (parseDocument) is present. */
1256
+ parseDiagnostics: boolean;
1257
+ /** serialize()'s `{prefixes, literalShorthand}` (serializeTurtleWith) is present. */
1258
+ turtlePrefixes: boolean;
968
1259
  }>;
969
1260
 
970
1261
  // ---------------------------------------------------------------------
971
- // Legacy raw surface (single-shot CLI shapes)
1262
+ // One call, serialised answer (op queryRaw)
972
1263
  // ---------------------------------------------------------------------
973
1264
 
974
1265
  /** SPARQL Results JSON term (https://www.w3.org/TR/sparql11-results-json/). */
@@ -989,8 +1280,13 @@ export type OutputFormat =
989
1280
  | 'json' | 'csv' | 'tsv' | 'xml' | 'table' | 'ntriples';
990
1281
 
991
1282
  /**
992
- * Legacy single-shot API: returns parsed SPARQL Results JSON when
993
- * output is 'json' (default), the raw output string otherwise.
1283
+ * One call, serialised answer: parse `dataString`, close the default
1284
+ * graph under `entail`, run the query. Resolves to parsed SPARQL Results
1285
+ * JSON when output is 'json' (default), the text otherwise. 'csv', 'tsv'
1286
+ * and 'xml' are the W3C SPARQL results formats (CSV and TSV have no ASK
1287
+ * encoding, so an ASK with those rejects); 'table' and 'ntriples' are
1288
+ * display formats. A CONSTRUCT or DESCRIBE answer is a graph and takes
1289
+ * 'ntriples' or 'table' only.
994
1290
  */
995
1291
  export function queryRaw(
996
1292
  dataString: string,
@@ -1002,14 +1298,33 @@ export function queryRaw(
1002
1298
  }
1003
1299
  ): Promise<SparqlResultsJson | string>;
1004
1300
 
1005
- /** Package version string, e.g. '0.1.0-alpha.0'. */
1301
+ /** Package version string, e.g. '0.9.0'. */
1006
1302
  export const version: string;
1007
1303
 
1304
+ /** The engine: 'lean4-wasm'. */
1305
+ export const engine: string;
1306
+
1307
+ /**
1308
+ * The loaded Lean engine handle, for the dispatch ops this package does
1309
+ * not wrap: `call(op, args)` answers the parsed envelope and throws on
1310
+ * {"ok":false}; `call('ops', [])` lists the op names. Node: index.mjs;
1311
+ * browser: browser.js.
1312
+ */
1313
+ export function loadEngine(): Promise<{
1314
+ version(): string;
1315
+ call(op: string, args: string[]): any;
1316
+ callBlob(op: string, args: string[], bytes: Uint8Array | ArrayBuffer): any;
1317
+ callBlobIO(op: string, args: string[], bytes?: Uint8Array | ArrayBuffer): { envelope: any; bytes: Uint8Array };
1318
+ }>;
1319
+
1008
1320
  declare const _default: {
1009
1321
  parse: typeof parse;
1010
1322
  query: typeof query;
1011
1323
  queryHdt: typeof queryHdt;
1012
1324
  update: typeof update;
1325
+ openDataset: typeof openDataset;
1326
+ closure: typeof closure;
1327
+ formats: typeof formats;
1013
1328
  serialize: typeof serialize;
1014
1329
  canonicalize: typeof canonicalize;
1015
1330
  graphs: typeof graphs;
@@ -1029,10 +1344,20 @@ declare const _default: {
1029
1344
  xmlWellformed: typeof xmlWellformed;
1030
1345
  xpathEval: typeof xpathEval;
1031
1346
  rifEval: typeof rifEval;
1032
- openCottas: typeof openCottas;
1033
- queryCottas: typeof queryCottas;
1034
- closeCottas: typeof closeCottas;
1035
- toCottas: typeof toCottas;
1347
+ clParse: typeof clParse;
1348
+ clSerialize: typeof clSerialize;
1349
+ clAlphaNorm: typeof clAlphaNorm;
1350
+ clNormalize: typeof clNormalize;
1351
+ openStore: typeof openStore;
1352
+ queryStore: typeof queryStore;
1353
+ listStores: typeof listStores;
1354
+ deltaLogOpen: typeof deltaLogOpen;
1355
+ deltaLogAppend: typeof deltaLogAppend;
1356
+ deltaLogReadAllHex: typeof deltaLogReadAllHex;
1357
+ deltaLogMerge: typeof deltaLogMerge;
1358
+ deltaLogInspect: typeof deltaLogInspect;
1359
+ deltaLogDestroy: typeof deltaLogDestroy;
1360
+ _deltaLogCorruptLastForTest: typeof _deltaLogCorruptLastForTest;
1036
1361
  xsltTransform: typeof xsltTransform;
1037
1362
  mathmlEval: typeof mathmlEval;
1038
1363
  xformsRecalc: typeof xformsRecalc;
@@ -1043,12 +1368,6 @@ declare const _default: {
1043
1368
  toanSimplify: typeof toanSimplify;
1044
1369
  toanDiff: typeof toanDiff;
1045
1370
  toanSubst: typeof toanSubst;
1046
- matrixDeterminant: typeof matrixDeterminant;
1047
- matrixScalarProduct: typeof matrixScalarProduct;
1048
- matrixVectorProduct: typeof matrixVectorProduct;
1049
- matrixOuterProduct: typeof matrixOuterProduct;
1050
- sigmoidPoints: typeof sigmoidPoints;
1051
- sigmoidFormulaMathml: typeof sigmoidFormulaMathml;
1052
1371
  vcSha256Hex: typeof vcSha256Hex;
1053
1372
  vcEd25519SecretToPublic: typeof vcEd25519SecretToPublic;
1054
1373
  vcEd25519Sign: typeof vcEd25519Sign;
@@ -1061,8 +1380,28 @@ declare const _default: {
1061
1380
  vcCheckRelatedResourceDigests: typeof vcCheckRelatedResourceDigests;
1062
1381
  capabilities: typeof capabilities;
1063
1382
  Dataset: typeof Dataset;
1383
+ DatasetHandle: typeof DatasetHandle;
1384
+ Store: typeof Store;
1385
+ ParseError: typeof ParseError;
1064
1386
  dataFactory: DataFactory;
1065
1387
  queryRaw: typeof queryRaw;
1066
1388
  version: string;
1389
+ engine: string;
1067
1390
  };
1068
1391
  export default _default;
1392
+
1393
+ // Added in 0.10.0 (lib/pure.mjs).
1394
+ export function aeadSeal(a: { key: Uint8Array; nonce: Uint8Array; plaintext?: Uint8Array; aad?: Uint8Array }): Promise<Uint8Array>;
1395
+ export function aeadOpen(a: { key: Uint8Array; nonce: Uint8Array; ciphertext: Uint8Array; aad?: Uint8Array }): Promise<Uint8Array>;
1396
+ export function hpkeSeal(a: { skE: Uint8Array; pkR: Uint8Array; plaintext?: Uint8Array; info?: Uint8Array; aad?: Uint8Array }): Promise<{ message: Uint8Array; enc: Uint8Array; ciphertext: Uint8Array }>;
1397
+ export function hpkeOpen(a: { skR: Uint8Array; message: Uint8Array; info?: Uint8Array; aad?: Uint8Array }): Promise<Uint8Array>;
1398
+ export function proofCheck(bundleJson: string): Promise<Record<string, unknown>>;
1399
+ export function proofInspect(bundleJson: string): Promise<Record<string, unknown>>;
1400
+ export function canonicalizeNQuads(nquads: string): Promise<string>;
1401
+ export function normalizeNQuads(nquads: string): Promise<string>;
1402
+ export function serveStore(root: string, options?: { port?: number; host?: string; queryPath?: string; gspPath?: string; tdb2?: boolean }): Promise<{ url: string; port: number; close(): Promise<void> }>;
1403
+
1404
+ /** Pack a small built-in store (Node only) under dir or a temporary directory; returns the collection root. */
1405
+ export function sampleStorePath(dir?: string): string;
1406
+ /** What the sample store holds. */
1407
+ export const sampleStoreFacts: Readonly<{ triples: number; source: string; layout: string }>;