@factoidal/core 0.1.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.
- package/CHANGELOG.md +121 -0
- package/LICENSE +201 -0
- package/README.md +514 -0
- package/browser-wasm.js +872 -0
- package/browser.d.ts +514 -0
- package/browser.js +2276 -0
- package/factoidal-npm-entry.js +32609 -0
- package/factoidal-npm-entry.wasm.assets/code-7ac046580f1bbdda8dc6.wasm +0 -0
- package/factoidal-npm-entry.wasm.js +455 -0
- package/factoidal.js +27560 -0
- package/factoidal.wasm.assets/code-bbe6099bfb5b10c4c3ab.wasm +0 -0
- package/factoidal.wasm.js +457 -0
- package/fn.d.ts +519 -0
- package/fn.js +916 -0
- package/hacl-init.js +92 -0
- package/hacl-wasm/FStar.wasm +0 -0
- package/hacl-wasm/Hacl_Bignum.wasm +0 -0
- package/hacl-wasm/Hacl_Bignum25519_51.wasm +0 -0
- package/hacl-wasm/Hacl_Bignum_Base.wasm +0 -0
- package/hacl-wasm/Hacl_Curve25519_51.wasm +0 -0
- package/hacl-wasm/Hacl_Ed25519.wasm +0 -0
- package/hacl-wasm/Hacl_Ed25519_PrecompTable.wasm +0 -0
- package/hacl-wasm/Hacl_Hash_Base.wasm +0 -0
- package/hacl-wasm/Hacl_Hash_SHA2.wasm +0 -0
- package/hacl-wasm/Hacl_IntTypes_Intrinsics.wasm +0 -0
- package/hacl-wasm/LowStar_Endianness.wasm +0 -0
- package/hacl-wasm/WasmSupport.wasm +0 -0
- package/hacl-wasm/api.js +775 -0
- package/hacl-wasm/api.json +3787 -0
- package/hacl-wasm/layouts.json +1 -0
- package/hacl-wasm/loader.js +568 -0
- package/hacl-wasm/shell.js +12 -0
- package/index.d.ts +1068 -0
- package/index.js +237 -0
- package/index.mjs +85 -0
- package/lib/api.js +2140 -0
- package/lib/engine-js.js +165 -0
- package/lib/engine-wasm.js +300 -0
- package/package.json +101 -0
- package/rdfjs.js +540 -0
- package/version.json +101 -0
- package/wasm.d.ts +130 -0
- package/wasm.js +158 -0
package/browser.d.ts
ADDED
|
@@ -0,0 +1,514 @@
|
|
|
1
|
+
// TypeScript declarations for factoidal/browser (browser.js) — the
|
|
2
|
+
// browser ESM entry. This is a DIFFERENT surface from the Node entry
|
|
3
|
+
// (index.d.ts): the browser functions drive the js_of_ocaml CLI bundle
|
|
4
|
+
// over fetch() and the persistent npm-entry ABI directly, so most
|
|
5
|
+
// return the ABI's own parsed {ok, ...} envelope (or SPARQL-Results
|
|
6
|
+
// JSON) rather than the RDF/JS Dataset shapes the Node API returns.
|
|
7
|
+
//
|
|
8
|
+
// Shared value shapes (SPARQL-Results JSON, MathML/XForms/Schematron/
|
|
9
|
+
// TOAN/matrix codecs) are imported from ./index so the two declaration
|
|
10
|
+
// files can never disagree about them.
|
|
11
|
+
|
|
12
|
+
import type {
|
|
13
|
+
SparqlResultsJson,
|
|
14
|
+
MathValue,
|
|
15
|
+
XFormsBind,
|
|
16
|
+
XFormsNodeValidity,
|
|
17
|
+
SchematronFinding,
|
|
18
|
+
ToanExpr,
|
|
19
|
+
MatrixCell,
|
|
20
|
+
MatrixResult,
|
|
21
|
+
XPathResult,
|
|
22
|
+
} from './index';
|
|
23
|
+
|
|
24
|
+
export type {
|
|
25
|
+
SparqlResultsJson,
|
|
26
|
+
MathValue,
|
|
27
|
+
XFormsBind,
|
|
28
|
+
XFormsNodeValidity,
|
|
29
|
+
SchematronFinding,
|
|
30
|
+
ToanExpr,
|
|
31
|
+
MatrixCell,
|
|
32
|
+
MatrixResult,
|
|
33
|
+
XPathResult,
|
|
34
|
+
ScaledValue,
|
|
35
|
+
SigmoidParams,
|
|
36
|
+
} from './index';
|
|
37
|
+
|
|
38
|
+
/** Entailment regime accepted by the browser query paths. */
|
|
39
|
+
export type EntailRegime = 'none' | 'RDFS' | 'OWL-RL';
|
|
40
|
+
/** CLI output formats the browser query paths accept. */
|
|
41
|
+
export type OutputFormat = 'json' | 'csv' | 'tsv' | 'xml' | 'table' | 'ntriples';
|
|
42
|
+
|
|
43
|
+
/** One document for the fake filesystem (runFactoidalCli). */
|
|
44
|
+
export interface CliFile {
|
|
45
|
+
/** Must start with '/static/'. */
|
|
46
|
+
name: string;
|
|
47
|
+
content: string;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/** The result of one in-browser CLI invocation. */
|
|
51
|
+
export interface CliResult {
|
|
52
|
+
stdout: string;
|
|
53
|
+
stderr: string;
|
|
54
|
+
exitCode: number;
|
|
55
|
+
engineMs: number;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/** One named-graph document for queryDataset(). */
|
|
59
|
+
export interface DatasetFile {
|
|
60
|
+
content: string;
|
|
61
|
+
/** Named-graph IRI; omitted means the default graph. */
|
|
62
|
+
graph?: string;
|
|
63
|
+
/** Default: 'turtle'. */
|
|
64
|
+
dataFormat?: string;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// ---------------------------------------------------------------------
|
|
68
|
+
// Bundle-URL + CLI plumbing.
|
|
69
|
+
// ---------------------------------------------------------------------
|
|
70
|
+
|
|
71
|
+
/** Override where `factoidal.js` (the CLI bundle) is fetched from. */
|
|
72
|
+
export function setFactoidalUrl(url: string): void;
|
|
73
|
+
/** Current `factoidal.js` source URL. */
|
|
74
|
+
export function getFactoidalUrl(): string;
|
|
75
|
+
/**
|
|
76
|
+
* Pack a JS string's UTF-8 bytes one-char-per-byte for the bundle's
|
|
77
|
+
* fake filesystem / argv (a no-op for pure-ASCII input).
|
|
78
|
+
*/
|
|
79
|
+
export function encodeTextAsBundleBytes(s: string): string;
|
|
80
|
+
/** Run one in-browser CLI invocation of the js_of_ocaml bundle. */
|
|
81
|
+
export function runFactoidalCli(
|
|
82
|
+
args: string[],
|
|
83
|
+
files: CliFile[],
|
|
84
|
+
options?: { transformSource?: (src: string) => string }
|
|
85
|
+
): Promise<CliResult>;
|
|
86
|
+
|
|
87
|
+
// ---------------------------------------------------------------------
|
|
88
|
+
// CLI-bundle operations (no npm-entry bundle needed).
|
|
89
|
+
// ---------------------------------------------------------------------
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Run a SPARQL query against one in-memory RDF document. Returns parsed
|
|
93
|
+
* SPARQL-Results JSON when `output` is 'json' (default), the raw output
|
|
94
|
+
* string otherwise.
|
|
95
|
+
*/
|
|
96
|
+
export function query(
|
|
97
|
+
dataString: string,
|
|
98
|
+
queryString: string,
|
|
99
|
+
options?: { dataFormat?: string; entail?: EntailRegime; output?: OutputFormat }
|
|
100
|
+
): Promise<SparqlResultsJson | string>;
|
|
101
|
+
|
|
102
|
+
/** Parse a document and dump sorted N-Quads (default input format: 'jsonld'). */
|
|
103
|
+
export function toRdf(
|
|
104
|
+
text: string,
|
|
105
|
+
options?: { format?: string; baseIRI?: string }
|
|
106
|
+
): Promise<string>;
|
|
107
|
+
|
|
108
|
+
/** RDFC-1.0 canonicalization: canonical blank-node labels + sorted N-Quads. */
|
|
109
|
+
export function canonicalize(
|
|
110
|
+
text: string,
|
|
111
|
+
options?: { format?: string; baseIRI?: string }
|
|
112
|
+
): Promise<string>;
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* Run a SPARQL query against a multi-file, multi-named-graph dataset,
|
|
116
|
+
* on the js_of_ocaml (default) or wasm_of_ocaml engine.
|
|
117
|
+
*/
|
|
118
|
+
export function queryDataset(
|
|
119
|
+
files: DatasetFile[],
|
|
120
|
+
queryString: string,
|
|
121
|
+
options?: {
|
|
122
|
+
entail?: EntailRegime;
|
|
123
|
+
output?: OutputFormat;
|
|
124
|
+
engine?: 'js' | 'wasm';
|
|
125
|
+
wasmUrl?: string;
|
|
126
|
+
transformSource?: (src: string) => string;
|
|
127
|
+
}
|
|
128
|
+
): Promise<SparqlResultsJson | string>;
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* Run a SPARQL 1.1 query against a read-only HDT artifact's raw bytes
|
|
132
|
+
* (CLI's `--data-hdt` backend). Default graph only, SELECT/ASK only.
|
|
133
|
+
*/
|
|
134
|
+
export function queryHdt(
|
|
135
|
+
hdtBytes: Uint8Array | ArrayBuffer | string,
|
|
136
|
+
sparql: string,
|
|
137
|
+
options?: { output?: OutputFormat }
|
|
138
|
+
): Promise<SparqlResultsJson | string>;
|
|
139
|
+
|
|
140
|
+
// ---------------------------------------------------------------------
|
|
141
|
+
// npm-entry ABI loader + operations that need it. These return the
|
|
142
|
+
// ABI's own parsed {ok, ...} envelope.
|
|
143
|
+
// ---------------------------------------------------------------------
|
|
144
|
+
|
|
145
|
+
/** Override where `factoidal-npm-entry.js` is fetched from. */
|
|
146
|
+
export function setFactoidalNpmEntryUrl(url: string): void;
|
|
147
|
+
/** Fetch + evaluate the npm-entry bundle once, returning its ABI object. */
|
|
148
|
+
export function loadNpmEntry(): Promise<Record<string, (...args: string[]) => string>>;
|
|
149
|
+
|
|
150
|
+
/** RIF Core smoke saturation (a fixed capability probe, no user input). */
|
|
151
|
+
export function rifSmoke(): Promise<{
|
|
152
|
+
inputNquads: string;
|
|
153
|
+
saturatedNquads: string;
|
|
154
|
+
inputCount: number;
|
|
155
|
+
derivedCount: number;
|
|
156
|
+
rounds: number;
|
|
157
|
+
fuel: number;
|
|
158
|
+
engineMs: number;
|
|
159
|
+
}>;
|
|
160
|
+
|
|
161
|
+
/** RIF Core forward-chaining saturation over a premise graph. */
|
|
162
|
+
export function rifEval(
|
|
163
|
+
rifXml: string,
|
|
164
|
+
dataNQuads: string
|
|
165
|
+
): Promise<{ ok: true; saturatedNquads: string; [k: string]: unknown }>;
|
|
166
|
+
|
|
167
|
+
/** SHACL Core validation (dataset-handle N-Quads in). */
|
|
168
|
+
export function shaclValidate(
|
|
169
|
+
dataNQuads: string,
|
|
170
|
+
shapesNQuads: string
|
|
171
|
+
): Promise<{ ok: true; conforms: boolean; reportNquads: string }>;
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* ShEx validation of one focus node against one shape. `verdict` null
|
|
175
|
+
* (deferred:true) means outside the decidable fragment — never guessed.
|
|
176
|
+
*/
|
|
177
|
+
export function shexValidate(
|
|
178
|
+
dataNQuads: string,
|
|
179
|
+
schemaJson: string,
|
|
180
|
+
focus: string,
|
|
181
|
+
shapeLabel?: string
|
|
182
|
+
): Promise<{ ok: true; verdict: boolean | null; deferred: boolean }>;
|
|
183
|
+
|
|
184
|
+
/** RDFS/OWL-RL entailment closure (default graph only). */
|
|
185
|
+
export function owlClosure(
|
|
186
|
+
dataNQuads: string,
|
|
187
|
+
mode: 'RDFS' | 'OWL-RL'
|
|
188
|
+
): Promise<{ ok: true; nquads: string }>;
|
|
189
|
+
|
|
190
|
+
/**
|
|
191
|
+
* Certified six-rule core-RDFS closure (theorem-backed; see
|
|
192
|
+
* docs/theorem-registry.md). "corerdfs" is this project's API name for
|
|
193
|
+
* the fragment the literature calls ρdf (Muñoz, Pérez & Gutierrez,
|
|
194
|
+
* "Simple and Efficient Minimal RDFS", J. Web Semantics 7(3), 2009).
|
|
195
|
+
*/
|
|
196
|
+
export function coreRdfsClosure(
|
|
197
|
+
data: string,
|
|
198
|
+
options?: { format?: string; baseIRI?: string }
|
|
199
|
+
): Promise<{ ok: true; ntriples: string }>;
|
|
200
|
+
|
|
201
|
+
/** Decidable core-RDFS fragment check — the regime theorems' fragment hypothesis. */
|
|
202
|
+
export function coreRdfsCheck(
|
|
203
|
+
data: string,
|
|
204
|
+
options?: { format?: string; baseIRI?: string }
|
|
205
|
+
): Promise<{ ok: true; fragment: boolean }>;
|
|
206
|
+
|
|
207
|
+
/** Literature-name alias for coreRdfsClosure (ρdf). */
|
|
208
|
+
export function rhoDfClosure(
|
|
209
|
+
data: string,
|
|
210
|
+
options?: { format?: string; baseIRI?: string }
|
|
211
|
+
): Promise<{ ok: true; ntriples: string }>;
|
|
212
|
+
|
|
213
|
+
/** Literature-name alias for coreRdfsCheck (ρdf). */
|
|
214
|
+
export function rhoDfFragmentCheck(
|
|
215
|
+
data: string,
|
|
216
|
+
options?: { format?: string; baseIRI?: string }
|
|
217
|
+
): Promise<{ ok: true; fragment: boolean }>;
|
|
218
|
+
|
|
219
|
+
/**
|
|
220
|
+
* RDFS-Plus closure — RDFS plus the practical OWL subset (sameAs,
|
|
221
|
+
* inverseOf, Symmetric/Transitive/Functional/InverseFunctional,
|
|
222
|
+
* equivalentClass/Property). Per-rule proved certificates; no
|
|
223
|
+
* chain-level completeness claim (see the theorem registry).
|
|
224
|
+
*/
|
|
225
|
+
export function rdfsPlusClosure(
|
|
226
|
+
data: string,
|
|
227
|
+
options?: { format?: string; baseIRI?: string }
|
|
228
|
+
): Promise<{ ok: true; ntriples: string; rounds: number }>;
|
|
229
|
+
|
|
230
|
+
/** OWL tableau class-expression materialisation (default graph only). */
|
|
231
|
+
export function tableauMaterialise(
|
|
232
|
+
dataNQuads: string
|
|
233
|
+
): Promise<{ ok: true; nquads: string; addedCount: number }>;
|
|
234
|
+
|
|
235
|
+
/** OWL DL inconsistency verdict (RL -> tableau -> RL -> is_inconsistent);
|
|
236
|
+
* `rlAlone` is the plain OWL-RL verdict on the same input. */
|
|
237
|
+
export function tableauDlInconsistent(
|
|
238
|
+
dataNQuads: string
|
|
239
|
+
): Promise<{ ok: true; inconsistent: boolean; rlAlone: boolean }>;
|
|
240
|
+
|
|
241
|
+
/** OWL DL consistency verdict via the verified clash-detecting tableau
|
|
242
|
+
* (Tableau.Refute over the OWL-RL closure); `consistent` is
|
|
243
|
+
* true|false|null (null = budget-out, `reason` names the fuel cap). */
|
|
244
|
+
export function owlIsConsistent(
|
|
245
|
+
dataNQuads: string,
|
|
246
|
+
optsJson?: string
|
|
247
|
+
): Promise<{ ok: true; consistent: boolean | null; reason?: string }>;
|
|
248
|
+
|
|
249
|
+
/** OWL entailment check (OWL-RL closure path then negate-and-refute);
|
|
250
|
+
* `entailed` is true|false|null, `via` is 'closure' | 'refutation'. */
|
|
251
|
+
export function owlEntails(
|
|
252
|
+
premiseNQuads: string,
|
|
253
|
+
conclusionNQuads: string,
|
|
254
|
+
optsJson?: string
|
|
255
|
+
): Promise<{ ok: true; entailed: boolean | null; via: string; reason?: string }>;
|
|
256
|
+
|
|
257
|
+
/** RML mapping evaluation against one logical source. */
|
|
258
|
+
export function rmlMap(
|
|
259
|
+
mappingNQuads: string,
|
|
260
|
+
sourceData: string,
|
|
261
|
+
sourceKind: 'json' | 'csv'
|
|
262
|
+
): Promise<{ ok: true; nquads: string }>;
|
|
263
|
+
|
|
264
|
+
/** CSVW csv2rdf conversion. */
|
|
265
|
+
export function csvwToRdf(
|
|
266
|
+
csvText: string,
|
|
267
|
+
metadataJson?: string,
|
|
268
|
+
options?: { mode?: 'standard' | 'minimal'; base?: string; url?: string }
|
|
269
|
+
): Promise<{ ok: true; nquads: string }>;
|
|
270
|
+
|
|
271
|
+
/** JSON-LD parsing with JSON-LD-specific options. */
|
|
272
|
+
export function jsonldToRdf(
|
|
273
|
+
jsonldText: string,
|
|
274
|
+
options?: {
|
|
275
|
+
base?: string;
|
|
276
|
+
rdfDirection?: string;
|
|
277
|
+
expandContext?: string;
|
|
278
|
+
processingMode?: string;
|
|
279
|
+
}
|
|
280
|
+
): Promise<{ ok: true; nquads: string }>;
|
|
281
|
+
|
|
282
|
+
/** Serialize N-Quads as expanded-form JSON-LD (JCS-canonical string). */
|
|
283
|
+
export function jsonldFromRdf(
|
|
284
|
+
nquads: string,
|
|
285
|
+
options?: { useNativeTypes?: boolean; useRdfType?: boolean }
|
|
286
|
+
): Promise<{ ok: true; jsonld: string }>;
|
|
287
|
+
|
|
288
|
+
/** did:key (Ed25519) resolution to a DID Document (N-Triples). */
|
|
289
|
+
export function didKeyResolve(
|
|
290
|
+
didString: string
|
|
291
|
+
): Promise<{ ok: true; did: string; nquads: string }>;
|
|
292
|
+
|
|
293
|
+
/** XML 1.0 well-formedness (no DOCTYPE/DTD production). */
|
|
294
|
+
export function xmlWellformed(
|
|
295
|
+
xmlText: string
|
|
296
|
+
): Promise<{ ok: true; wellformed: boolean }>;
|
|
297
|
+
|
|
298
|
+
/** XPath 1.0 evaluation over an XML document. */
|
|
299
|
+
export function xpathEval(
|
|
300
|
+
xmlText: string,
|
|
301
|
+
xpathExpr: string
|
|
302
|
+
): Promise<{ ok: true } & XPathResult>;
|
|
303
|
+
|
|
304
|
+
// ---------------------------------------------------------------------
|
|
305
|
+
// VC Data Integrity crypto (eddsa-rdfc-2022, HACL* wasm backend).
|
|
306
|
+
//
|
|
307
|
+
// INIT (browser): unlike the Node entry (which auto-awaits initHacl()),
|
|
308
|
+
// a page MUST initialise the HACL* wasm backend itself before the first
|
|
309
|
+
// VC call — the hacl-wasm URL is page-specific (serve `hacl-wasm/` and
|
|
310
|
+
// `await initHacl({ apiUrl })` from hacl-init.js). An uninitialised
|
|
311
|
+
// backend makes verify THROW (the {ok:false} error surfaces), never
|
|
312
|
+
// return a false-positive true (#286, the throw-on-uninit contract).
|
|
313
|
+
// ---------------------------------------------------------------------
|
|
314
|
+
|
|
315
|
+
export function vcSha256Hex(message: string): Promise<{ ok: true; sha256: string }>;
|
|
316
|
+
export function vcEd25519SecretToPublic(
|
|
317
|
+
secretKeyHex: string
|
|
318
|
+
): Promise<{ ok: true; publicKeyHex: string }>;
|
|
319
|
+
export function vcEd25519Sign(
|
|
320
|
+
secretKeyHex: string,
|
|
321
|
+
messageHex: string
|
|
322
|
+
): Promise<{ ok: true; signatureHex: string }>;
|
|
323
|
+
export function vcEd25519Verify(
|
|
324
|
+
publicKeyHex: string,
|
|
325
|
+
messageHex: string,
|
|
326
|
+
signatureHex: string
|
|
327
|
+
): Promise<{ ok: true; valid: boolean }>;
|
|
328
|
+
export function vcEddsaCreateFromCanonical(
|
|
329
|
+
secretKeyHex: string,
|
|
330
|
+
canonicalDocument: string,
|
|
331
|
+
canonicalConfig: string
|
|
332
|
+
): Promise<{ ok: true; proofValue: string }>;
|
|
333
|
+
export function vcEddsaVerifyFromCanonical(
|
|
334
|
+
publicKeyHex: string,
|
|
335
|
+
canonicalDocument: string,
|
|
336
|
+
canonicalConfig: string,
|
|
337
|
+
proofValue: string
|
|
338
|
+
): Promise<{ ok: true; verified: boolean }>;
|
|
339
|
+
|
|
340
|
+
// ---------------------------------------------------------------------
|
|
341
|
+
// In-memory COTTAS/Parquet bytes store.
|
|
342
|
+
// ---------------------------------------------------------------------
|
|
343
|
+
|
|
344
|
+
/** Open a COTTAS artifact's bytes as a read-only store; returns a handle. */
|
|
345
|
+
export function openCottas(
|
|
346
|
+
bytes: Uint8Array | ArrayBuffer | string
|
|
347
|
+
): Promise<string>;
|
|
348
|
+
/** SPARQL over a store opened by openCottas() (read-only, no entail). */
|
|
349
|
+
export function queryCottas(
|
|
350
|
+
handle: string,
|
|
351
|
+
sparql: string
|
|
352
|
+
): Promise<
|
|
353
|
+
| { ok: true; kind: 'select'; srj: SparqlResultsJson }
|
|
354
|
+
| { ok: true; kind: 'ask'; boolean: boolean }
|
|
355
|
+
| { ok: true; kind: 'construct'; nquads: string }
|
|
356
|
+
>;
|
|
357
|
+
/** Release a store handle (does not evict the underlying byte cache). */
|
|
358
|
+
export function closeCottas(handle: string): Promise<void>;
|
|
359
|
+
/** Serialize dataset-handle N-Quads to COTTAS/Parquet bytes. */
|
|
360
|
+
export function toCottas(nQuads: string): Promise<Uint8Array>;
|
|
361
|
+
|
|
362
|
+
// ---------------------------------------------------------------------
|
|
363
|
+
// Typed engine functions (#74 FP surface, browser side). Same value
|
|
364
|
+
// shapes as the Node entry (index.d.ts).
|
|
365
|
+
// ---------------------------------------------------------------------
|
|
366
|
+
|
|
367
|
+
export function xsltTransform(stylesheetXml: string, sourceXml: string): Promise<string>;
|
|
368
|
+
export function mathmlEval(
|
|
369
|
+
contentMathmlXml: string,
|
|
370
|
+
bindings?: Record<string, string>
|
|
371
|
+
): Promise<MathValue>;
|
|
372
|
+
export function xformsRecalc(
|
|
373
|
+
instanceXml: string,
|
|
374
|
+
binds: XFormsBind[]
|
|
375
|
+
): Promise<{ instance: string; validity: XFormsNodeValidity[] }>;
|
|
376
|
+
export function jsonSchemaValidate(
|
|
377
|
+
schemaJson: string,
|
|
378
|
+
instanceJson: string
|
|
379
|
+
): Promise<{ valid: boolean; result: 'pass' | 'fail' | 'unsupported'; errors: string[] }>;
|
|
380
|
+
export function schematronValidate(
|
|
381
|
+
schematronXml: string,
|
|
382
|
+
instanceXml: string
|
|
383
|
+
): Promise<{ findings: SchematronFinding[] }>;
|
|
384
|
+
export function toanSummation(
|
|
385
|
+
bodyExpr: ToanExpr,
|
|
386
|
+
idx: string,
|
|
387
|
+
lo: number,
|
|
388
|
+
hi: number
|
|
389
|
+
): Promise<string>;
|
|
390
|
+
export function toanProduct(
|
|
391
|
+
bodyExpr: ToanExpr,
|
|
392
|
+
idx: string,
|
|
393
|
+
lo: number,
|
|
394
|
+
hi: number
|
|
395
|
+
): Promise<string>;
|
|
396
|
+
export function toanSimplify(expr: ToanExpr): Promise<string>;
|
|
397
|
+
export function toanDiff(expr: ToanExpr, variable: string): Promise<string>;
|
|
398
|
+
export function toanSubst(
|
|
399
|
+
expr: ToanExpr,
|
|
400
|
+
variable: string,
|
|
401
|
+
value: ToanExpr
|
|
402
|
+
): Promise<string>;
|
|
403
|
+
export function matrixDeterminant(matrix: MatrixCell[][]): Promise<MatrixResult>;
|
|
404
|
+
export function matrixScalarProduct(a: MatrixCell[], b: MatrixCell[]): Promise<MatrixResult>;
|
|
405
|
+
export function matrixVectorProduct(a: MatrixCell[], b: MatrixCell[]): Promise<MatrixResult>;
|
|
406
|
+
export function matrixOuterProduct(a: MatrixCell[], b: MatrixCell[]): Promise<MatrixResult>;
|
|
407
|
+
export function sigmoidPoints(
|
|
408
|
+
params: SigmoidParams
|
|
409
|
+
): Promise<Array<{ x: ScaledValue; y: ScaledValue }>>;
|
|
410
|
+
export function sigmoidFormulaMathml(): Promise<string>;
|
|
411
|
+
|
|
412
|
+
// ---------------------------------------------------------------------
|
|
413
|
+
// Durable browser persistence (IndexedDB-backed delta log). Browser-
|
|
414
|
+
// only: these use `indexedDB` and have no Node analogue — a Node caller
|
|
415
|
+
// drives the raw npm-entry ABI (deltaBatchToHex / deltaMergeApplyBrowser)
|
|
416
|
+
// or an injected storage layer directly (see tests/hub/post18_test.mjs's
|
|
417
|
+
// Map-backed stub, which mirrors this exact contract).
|
|
418
|
+
// ---------------------------------------------------------------------
|
|
419
|
+
|
|
420
|
+
/** A handle naming one IndexedDB-backed delta log. */
|
|
421
|
+
export interface DeltaLogHandle {
|
|
422
|
+
dbName: string;
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
/** Open (creating if needed) a browser-persistent delta log. */
|
|
426
|
+
export function deltaLogOpen(dbName?: string): Promise<DeltaLogHandle>;
|
|
427
|
+
/**
|
|
428
|
+
* Translate one SPARQL Update (INSERT/DELETE DATA, CLEAR, DROP, CREATE)
|
|
429
|
+
* into a delta_batch and durably append it as one IndexedDB record.
|
|
430
|
+
*/
|
|
431
|
+
export function deltaLogAppend(
|
|
432
|
+
handle: DeltaLogHandle,
|
|
433
|
+
sparqlUpdate: string,
|
|
434
|
+
options?: { epoch?: number }
|
|
435
|
+
): Promise<{ seq: number; opCount: number }>;
|
|
436
|
+
/** Read every committed batch back, seq order, as newline-joined hex blobs. */
|
|
437
|
+
export function deltaLogReadAllHex(handle: DeltaLogHandle): Promise<string>;
|
|
438
|
+
/** Read the durable log back and merge it onto a base dataset (N-Quads). */
|
|
439
|
+
export function deltaLogMerge(
|
|
440
|
+
handle: DeltaLogHandle,
|
|
441
|
+
baseNQuads: string
|
|
442
|
+
): Promise<string>;
|
|
443
|
+
/** Delete a browser-persistent delta log entirely (test/demo cleanup). */
|
|
444
|
+
export function deltaLogDestroy(handle: DeltaLogHandle): Promise<void>;
|
|
445
|
+
|
|
446
|
+
/** Package version string. */
|
|
447
|
+
export const version: string;
|
|
448
|
+
|
|
449
|
+
declare const _default: {
|
|
450
|
+
query: typeof query;
|
|
451
|
+
toRdf: typeof toRdf;
|
|
452
|
+
canonicalize: typeof canonicalize;
|
|
453
|
+
runFactoidalCli: typeof runFactoidalCli;
|
|
454
|
+
setFactoidalUrl: typeof setFactoidalUrl;
|
|
455
|
+
getFactoidalUrl: typeof getFactoidalUrl;
|
|
456
|
+
encodeTextAsBundleBytes: typeof encodeTextAsBundleBytes;
|
|
457
|
+
queryDataset: typeof queryDataset;
|
|
458
|
+
version: string;
|
|
459
|
+
loadNpmEntry: typeof loadNpmEntry;
|
|
460
|
+
setFactoidalNpmEntryUrl: typeof setFactoidalNpmEntryUrl;
|
|
461
|
+
rifSmoke: typeof rifSmoke;
|
|
462
|
+
rifEval: typeof rifEval;
|
|
463
|
+
shaclValidate: typeof shaclValidate;
|
|
464
|
+
shexValidate: typeof shexValidate;
|
|
465
|
+
didKeyResolve: typeof didKeyResolve;
|
|
466
|
+
owlClosure: typeof owlClosure;
|
|
467
|
+
coreRdfsClosure: typeof coreRdfsClosure;
|
|
468
|
+
coreRdfsCheck: typeof coreRdfsCheck;
|
|
469
|
+
rdfsPlusClosure: typeof rdfsPlusClosure;
|
|
470
|
+
rhoDfClosure: typeof rhoDfClosure;
|
|
471
|
+
rhoDfFragmentCheck: typeof rhoDfFragmentCheck;
|
|
472
|
+
tableauMaterialise: typeof tableauMaterialise;
|
|
473
|
+
tableauDlInconsistent: typeof tableauDlInconsistent;
|
|
474
|
+
owlIsConsistent: typeof owlIsConsistent;
|
|
475
|
+
owlEntails: typeof owlEntails;
|
|
476
|
+
rmlMap: typeof rmlMap;
|
|
477
|
+
jsonldToRdf: typeof jsonldToRdf;
|
|
478
|
+
jsonldFromRdf: typeof jsonldFromRdf;
|
|
479
|
+
xmlWellformed: typeof xmlWellformed;
|
|
480
|
+
xpathEval: typeof xpathEval;
|
|
481
|
+
deltaLogOpen: typeof deltaLogOpen;
|
|
482
|
+
deltaLogAppend: typeof deltaLogAppend;
|
|
483
|
+
deltaLogReadAllHex: typeof deltaLogReadAllHex;
|
|
484
|
+
deltaLogMerge: typeof deltaLogMerge;
|
|
485
|
+
deltaLogDestroy: typeof deltaLogDestroy;
|
|
486
|
+
openCottas: typeof openCottas;
|
|
487
|
+
queryCottas: typeof queryCottas;
|
|
488
|
+
closeCottas: typeof closeCottas;
|
|
489
|
+
toCottas: typeof toCottas;
|
|
490
|
+
xsltTransform: typeof xsltTransform;
|
|
491
|
+
mathmlEval: typeof mathmlEval;
|
|
492
|
+
xformsRecalc: typeof xformsRecalc;
|
|
493
|
+
jsonSchemaValidate: typeof jsonSchemaValidate;
|
|
494
|
+
schematronValidate: typeof schematronValidate;
|
|
495
|
+
toanSummation: typeof toanSummation;
|
|
496
|
+
toanProduct: typeof toanProduct;
|
|
497
|
+
toanSimplify: typeof toanSimplify;
|
|
498
|
+
toanDiff: typeof toanDiff;
|
|
499
|
+
toanSubst: typeof toanSubst;
|
|
500
|
+
matrixDeterminant: typeof matrixDeterminant;
|
|
501
|
+
matrixScalarProduct: typeof matrixScalarProduct;
|
|
502
|
+
matrixVectorProduct: typeof matrixVectorProduct;
|
|
503
|
+
matrixOuterProduct: typeof matrixOuterProduct;
|
|
504
|
+
sigmoidPoints: typeof sigmoidPoints;
|
|
505
|
+
sigmoidFormulaMathml: typeof sigmoidFormulaMathml;
|
|
506
|
+
vcSha256Hex: typeof vcSha256Hex;
|
|
507
|
+
vcEd25519SecretToPublic: typeof vcEd25519SecretToPublic;
|
|
508
|
+
vcEd25519Sign: typeof vcEd25519Sign;
|
|
509
|
+
vcEd25519Verify: typeof vcEd25519Verify;
|
|
510
|
+
vcEddsaCreateFromCanonical: typeof vcEddsaCreateFromCanonical;
|
|
511
|
+
vcEddsaVerifyFromCanonical: typeof vcEddsaVerifyFromCanonical;
|
|
512
|
+
queryHdt: typeof queryHdt;
|
|
513
|
+
};
|
|
514
|
+
export default _default;
|