@factoidal/core 0.21.0 → 0.22.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 +33 -0
- package/browser.d.ts +4 -0
- package/browser.js +4 -0
- package/index.d.ts +77 -0
- package/index.mjs +4 -0
- package/l4-assets/l4factoidal.js +1 -1
- package/l4-assets/l4factoidal.wasm +0 -0
- package/l4-assets/version.json +6 -6
- package/lib/api.mjs +67 -0
- package/lib/errors.mjs +6 -0
- package/lib/version.mjs +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,39 @@
|
|
|
2
2
|
|
|
3
3
|
## Unreleased
|
|
4
4
|
|
|
5
|
+
- RIF BLD (W3C Recommendation, Second Edition 2013) in the Lean engine, `L4Factoidal/RIF/Bld.lean`, over the RIF Core engine: equality in rule conclusions with congruence and list injectivity, inconsistency when two data values are made equal, the semantic conditions on `#` and `##`, rules whose body does not bind every variable, named-argument uniterms, open lists and conjunctive conclusions in the presentation syntax. W3C BLD suite: 28 pass, 0 fail (out of 28 decided), 1 undecided, 3 excluded (defective test data, https://github.com/danbri/factoidal/issues/1186). No npm or wasm op yet.
|
|
6
|
+
|
|
7
|
+
## 0.22.0 (2026-10-29)
|
|
8
|
+
|
|
9
|
+
### XPath 4.0, XQuery 4.0 and XSLT 4.0 in the package
|
|
10
|
+
|
|
11
|
+
- XPath 4.0, XQuery 4.0 and XSLT 4.0: new functions `xpath4Eval(xmlText, expr)`, `xqueryEval(query, contextXml?)` and `xslt4Transform(stylesheetXml, sourceXml)`, in Node, Deno and the browser, over the Lean engines `L4Factoidal/XPath4`, `XQuery4` and `XSLT4`. `xpath4Eval` and `xqueryEval` give `{count, items, adaptive, xml}` (each item with its type and its Serialization 4.0 adaptive form; the whole sequence with the adaptive and the xml method); `xslt4Transform` gives `{output, method, secondary, messages}` (the principal result serialized with the stylesheet's output definition, the `xsl:result-document` results, the `xsl:message` texts). An error rejects with a `FactoidalError` (code `xml.failed`) whose new member `qtError` is `{code, namespace, message}`, for example `XPST0003`. No I/O: `fn:doc`, `fn:unparsed-text`, `fn:json-doc`, `file:` functions, `import module`, `xsl:import` and `xsl:include` of anything but the arguments fail with the specification's error code (FODC0002, FOUT1170, `file:io-error`, XQST0059, XTSE0165). An evaluation deeper than 4,000 nested steps fails with FOER0000; in the wasm module the host's call stack ends first for a document of more than about 6,000 sibling elements, a recursion more than about 400 calls deep or an expression nested more than about 200 levels, measured under Node's default stack; the limits depend on the host's stack size (the call rejects with `op.failed`, https://github.com/danbri/factoidal/issues/1110). New wasm ops `xpath4Eval`, `xqueryEval`, `xslt4Transform` (full engine only); `capabilities().xpath4`, `.xquery`, `.xslt4`. `xpathEval` (XPath 1.0) and `xsltTransform` (XSLT 1.0) do not change.
|
|
12
|
+
|
|
13
|
+
### Verifiable Credentials and JSON-LD
|
|
14
|
+
|
|
15
|
+
- JSON-LD expansion of a `null` document gives `[]` (JSON-LD 1.1 API §5.1.2 step 1 and the `expand()` method); it was the error `not JSON-LD`.
|
|
16
|
+
- Verifiable Credentials: the Data Integrity ECDSA cryptosuites `ecdsa-rdfc-2019` and `ecdsa-jcs-2019` (Data Integrity ECDSA Cryptosuites v1.0) with P-256 keys, in one table with `eddsa-rdfc-2022` (`L4Factoidal/VC/Cryptosuite.lean`; https://github.com/danbri/factoidal/issues/1165). New wasm ops `vcDiKey`, `vcDiSecure` and `vcDiVerify` (through `loadEngine().call`): secure and verify a credential at the document level, with did:key resolution on Ed25519, P-256 and P-384. P-384 is refused (HACL\* has no P-384: https://github.com/danbri/factoidal/issues/1166).
|
|
17
|
+
- Verifiable Credentials: `eddsa-jcs-2022` (Data Integrity EdDSA Cryptosuites v1.0 §3.4) in the same table, through the same ops.
|
|
18
|
+
- Verifiable Credentials: Bitstring Status List v1.0 (`L4Factoidal/VC/StatusList.lean`): entries, list credentials, the GZIP and base64url list, and the §3.2 validation, through new wasm ops `vcStatusEntryNew`, `vcStatusListCredential`, `vcStatusEntryCheck` and `vcStatusValidate`.
|
|
19
|
+
- VC DI §2.4 data-loss check: also refuses a top-level member that no context of the document defines, and reads `credentialSubject` keys under the subject's type-scoped contexts.
|
|
20
|
+
- Fixed: base64url decoding of long inputs no longer overflows the wasm stack (loop forms with `csimp` proofs).
|
|
21
|
+
- Fixed: the RFC 8785 (JCS) writer sorts object member names by UTF-16 code units (RFC 8785 §3.2.3); it used code-point order, which differs for names with characters above U+FFFF. This changes the canonical form of JSON-LD `@json` literals with such names.
|
|
22
|
+
|
|
23
|
+
### In the Lean tree (native runners; not new package functions)
|
|
24
|
+
|
|
25
|
+
- XML Schema 1.1 structures (`L4Factoidal/XSD11/`): schema components, schema documents (include, import, redefine, override), content models by derivatives with counted repetition and 1.1 `all`, assessment to a PSVI, identity constraints, type alternatives and assertions; the schema-aware parts of XPath 4.0, XQuery 4.0 and XSLT 4.0 use it (https://github.com/danbri/factoidal-core/pull/206, https://github.com/danbri/factoidal-core/pull/217). Native `l4xsd11`: 41086 pass, 479 fail, 103 unsupported (out of 41668), measured on that PR.
|
|
26
|
+
- XSLT 4.0 (https://github.com/danbri/factoidal-core/pull/208) and XSLT Streaming 4.0 (https://github.com/danbri/factoidal-core/pull/213): xslt40-test, all vendored sets, 9096 pass, 1557 fail, 3149 unsupported (out of 13802), measured on PR 213.
|
|
27
|
+
- XQuery 4.0: `%private` across modules and the `xml` prefix in constructors (https://github.com/danbri/factoidal-core/pull/210). qt4tests in XQuery mode, measured on PR 206: 42202 pass, 1788 fail, 1956 unsupported (out of 45946); XPath mode 28248 pass, 707 fail, 9704 unsupported (out of 38659).
|
|
28
|
+
- RDF Data Cube 2014: normalization and the integrity constraints IC-0 to IC-21 (`L4Factoidal/DataCube/`, `lake exe l4datacube`), each computed two ways (the SPARQL queries of the Recommendation and a direct Lean definition) that must agree; 31 pass, 0 fail (out of 31) project cases (the Recommendation has no test suite); theorems `normalize_extensive`, `phase1_rdfs_sound` (https://github.com/danbri/factoidal-core/pull/219).
|
|
29
|
+
- Design records for RDFa and Microdata, XForms, MathML and SMIL 3.0 (https://github.com/danbri/factoidal-core/pull/218).
|
|
30
|
+
- XPath 4.0 and F&O 4.0 toward all qt4tests (https://github.com/danbri/factoidal-core/pull/205).
|
|
31
|
+
- N3 (Notation3): reasoner and built-ins in Lean (https://github.com/danbri/factoidal-core/pull/234).
|
|
32
|
+
- YAML-LD 1.0: a YAML 1.2.2 loader with the JSON-LD 1.1 API on it (https://github.com/danbri/factoidal-core/pull/235).
|
|
33
|
+
|
|
34
|
+
### Hub
|
|
35
|
+
|
|
36
|
+
- New pages: "WebDAV, LWS and custodians" (the 0.21.0 theorems and the design behind them), "Pods, bots and access control" (rewritten for 0.21.0), "SPARQL-RL, and how it compares with RIF"; the hub pages load this release.
|
|
37
|
+
|
|
5
38
|
## 0.21.0 (2026-10-28)
|
|
6
39
|
|
|
7
40
|
### Security: WebDAV (https://github.com/danbri/factoidal/issues/1147)
|
package/browser.d.ts
CHANGED
|
@@ -15,6 +15,7 @@ export type {
|
|
|
15
15
|
LiteralValueData, LiteralValueResult,
|
|
16
16
|
ExplainResult, StageInfo, EvidenceRecord, Wire, FactoidalNode, Pipeline, RunResult, RunOptions,
|
|
17
17
|
NodePort, GraphSource, GraphSpec, GraphIssue, GraphCheck, FactoidalGraph, GraphRunResult,
|
|
18
|
+
QtError, Qt4Item, Qt4Result, Xslt4Result,
|
|
18
19
|
} from './index';
|
|
19
20
|
|
|
20
21
|
export {
|
|
@@ -94,6 +95,9 @@ export {
|
|
|
94
95
|
xmlWellformed,
|
|
95
96
|
xpathEval,
|
|
96
97
|
xsltTransform,
|
|
98
|
+
xpath4Eval,
|
|
99
|
+
xqueryEval,
|
|
100
|
+
xslt4Transform,
|
|
97
101
|
schematronValidate,
|
|
98
102
|
jsonSchemaValidate,
|
|
99
103
|
mathmlEval,
|
package/browser.js
CHANGED
|
@@ -157,6 +157,10 @@ export const jsonldFromRdf = api.jsonldFromRdf;
|
|
|
157
157
|
export const xmlWellformed = api.xmlWellformed;
|
|
158
158
|
export const xpathEval = api.xpathEval;
|
|
159
159
|
export const xsltTransform = api.xsltTransform;
|
|
160
|
+
// XPath 4.0, XQuery 4.0 and XSLT 4.0 (formal/lean4/Wasm/Ops/Qt4.lean).
|
|
161
|
+
export const xpath4Eval = api.xpath4Eval;
|
|
162
|
+
export const xqueryEval = api.xqueryEval;
|
|
163
|
+
export const xslt4Transform = api.xslt4Transform;
|
|
160
164
|
export const schematronValidate = api.schematronValidate;
|
|
161
165
|
export const jsonSchemaValidate = api.jsonSchemaValidate;
|
|
162
166
|
export const mathmlEval = api.mathmlEval;
|
package/index.d.ts
CHANGED
|
@@ -167,6 +167,20 @@ export class FactoidalError extends Error {
|
|
|
167
167
|
readonly format?: string;
|
|
168
168
|
/** For a parse failure of text: true when the syntax was inferred. */
|
|
169
169
|
readonly formatInferred?: boolean;
|
|
170
|
+
/**
|
|
171
|
+
* For xpath4Eval, xqueryEval and xslt4Transform: the error that the
|
|
172
|
+
* XPath, XQuery or XSLT 4.0 specification names (code `XPST0003`,
|
|
173
|
+
* namespace `http://www.w3.org/2005/xqt-errors`, ...).
|
|
174
|
+
*/
|
|
175
|
+
readonly qtError?: QtError;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
/** An error of XPath 4.0, XQuery 4.0 or XSLT 4.0: the local part and the
|
|
179
|
+
* namespace of the error QName, and the engine's message. */
|
|
180
|
+
export interface QtError {
|
|
181
|
+
code: string;
|
|
182
|
+
namespace: string;
|
|
183
|
+
message: string;
|
|
170
184
|
}
|
|
171
185
|
|
|
172
186
|
/** One recoverable-parse diagnostic from a `{lenient:true}` parse() call. */
|
|
@@ -1709,6 +1723,63 @@ export function xsltTransform(
|
|
|
1709
1723
|
sourceXml: string
|
|
1710
1724
|
): Promise<string>;
|
|
1711
1725
|
|
|
1726
|
+
/** One item of an XPath 4.0 or XQuery 4.0 result. */
|
|
1727
|
+
export interface Qt4Item {
|
|
1728
|
+
/** The item's type: `xs:integer`, `element()`, `map(*)`, `array(*)`,
|
|
1729
|
+
* `function(*)`, ... */
|
|
1730
|
+
type: string;
|
|
1731
|
+
/** The item serialized with the Serialization 4.0 adaptive method. */
|
|
1732
|
+
value: string;
|
|
1733
|
+
}
|
|
1734
|
+
|
|
1735
|
+
/** The value shape returned by {@link xpath4Eval} and {@link xqueryEval}. */
|
|
1736
|
+
export interface Qt4Result {
|
|
1737
|
+
count: number;
|
|
1738
|
+
items: Qt4Item[];
|
|
1739
|
+
/** The whole sequence, Serialization 4.0 adaptive method. */
|
|
1740
|
+
adaptive: string;
|
|
1741
|
+
/** The whole sequence, xml method (no XML declaration); null when the
|
|
1742
|
+
* xml method cannot serialize it (a map, an array, a function). */
|
|
1743
|
+
xml: string | null;
|
|
1744
|
+
}
|
|
1745
|
+
|
|
1746
|
+
/**
|
|
1747
|
+
* Evaluate an XPath 4.0 expression with `xmlText` as the context item
|
|
1748
|
+
* ('' for no context item). The engine does no I/O: fn:doc and
|
|
1749
|
+
* fn:unparsed-text of a URI fail (FODC0002, FOUT1170). A QT4 error rejects
|
|
1750
|
+
* with a FactoidalError whose `qtError` names the error code.
|
|
1751
|
+
*/
|
|
1752
|
+
export function xpath4Eval(xmlText: string, expr: string): Promise<Qt4Result>;
|
|
1753
|
+
|
|
1754
|
+
/**
|
|
1755
|
+
* Evaluate an XQuery 4.0 main module, with `contextXml` as the context item
|
|
1756
|
+
* when it is given and not ''. `import module` of a module that is not
|
|
1757
|
+
* given fails with XQST0059; no resource is fetched.
|
|
1758
|
+
*/
|
|
1759
|
+
export function xqueryEval(query: string, contextXml?: string): Promise<Qt4Result>;
|
|
1760
|
+
|
|
1761
|
+
/** The value shape returned by {@link xslt4Transform}. */
|
|
1762
|
+
export interface Xslt4Result {
|
|
1763
|
+
/** The principal result, serialized with the stylesheet's unnamed output definition. */
|
|
1764
|
+
output: string;
|
|
1765
|
+
/** The output method used for `output` (xml, html, xhtml, text, json, adaptive, csv). */
|
|
1766
|
+
method: string;
|
|
1767
|
+
/** The results of xsl:result-document, each serialized with its output definition. */
|
|
1768
|
+
secondary: Array<{ href: string; output: string }>;
|
|
1769
|
+
/** The texts of xsl:message. */
|
|
1770
|
+
messages: string[];
|
|
1771
|
+
}
|
|
1772
|
+
|
|
1773
|
+
/**
|
|
1774
|
+
* XSLT 4.0 transform of `sourceXml` ('' for no global context item) by a
|
|
1775
|
+
* stylesheet of one module. xsl:import and xsl:include of another module
|
|
1776
|
+
* fail with XTSE0165: no module is fetched.
|
|
1777
|
+
*/
|
|
1778
|
+
export function xslt4Transform(
|
|
1779
|
+
stylesheetXml: string,
|
|
1780
|
+
sourceXml: string
|
|
1781
|
+
): Promise<Xslt4Result>;
|
|
1782
|
+
|
|
1712
1783
|
/** The exact value a Content MathML expression evaluates to. */
|
|
1713
1784
|
export type MathValue =
|
|
1714
1785
|
| { kind: 'rat'; num: number; den: number }
|
|
@@ -2078,6 +2149,9 @@ export function capabilities(): Promise<{
|
|
|
2078
2149
|
xpath: boolean;
|
|
2079
2150
|
rif: boolean;
|
|
2080
2151
|
xslt: boolean;
|
|
2152
|
+
xpath4: boolean;
|
|
2153
|
+
xquery: boolean;
|
|
2154
|
+
xslt4: boolean;
|
|
2081
2155
|
mathml: boolean;
|
|
2082
2156
|
xforms: boolean;
|
|
2083
2157
|
jsonSchema: boolean;
|
|
@@ -2225,6 +2299,9 @@ declare const _default: {
|
|
|
2225
2299
|
deltaLogDestroy: typeof deltaLogDestroy;
|
|
2226
2300
|
_deltaLogCorruptLastForTest: typeof _deltaLogCorruptLastForTest;
|
|
2227
2301
|
xsltTransform: typeof xsltTransform;
|
|
2302
|
+
xpath4Eval: typeof xpath4Eval;
|
|
2303
|
+
xqueryEval: typeof xqueryEval;
|
|
2304
|
+
xslt4Transform: typeof xslt4Transform;
|
|
2228
2305
|
mathmlEval: typeof mathmlEval;
|
|
2229
2306
|
xformsRecalc: typeof xformsRecalc;
|
|
2230
2307
|
jsonSchemaValidate: typeof jsonSchemaValidate;
|
package/index.mjs
CHANGED
|
@@ -153,6 +153,10 @@ export const jsonldFromRdf = api.jsonldFromRdf;
|
|
|
153
153
|
export const xmlWellformed = api.xmlWellformed;
|
|
154
154
|
export const xpathEval = api.xpathEval;
|
|
155
155
|
export const xsltTransform = api.xsltTransform;
|
|
156
|
+
// XPath 4.0, XQuery 4.0 and XSLT 4.0 (formal/lean4/Wasm/Ops/Qt4.lean).
|
|
157
|
+
export const xpath4Eval = api.xpath4Eval;
|
|
158
|
+
export const xqueryEval = api.xqueryEval;
|
|
159
|
+
export const xslt4Transform = api.xslt4Transform;
|
|
156
160
|
export const schematronValidate = api.schematronValidate;
|
|
157
161
|
export const jsonSchemaValidate = api.jsonSchemaValidate;
|
|
158
162
|
export const mathmlEval = api.mathmlEval;
|
package/l4-assets/l4factoidal.js
CHANGED
|
Binary file
|
package/l4-assets/version.json
CHANGED
|
@@ -2,17 +2,17 @@
|
|
|
2
2
|
"engine": "lean4",
|
|
3
3
|
"note": "The Lean 4 (L4Factoidal) engine build provenance and claims: the only engine of @factoidal/core since 0.9.0 (issue 713). This committed file is a placeholder. tools/fetch-builds.sh --set web (through tools/stamp-l4-version.mjs) writes the provenance members from the danbri/factoidal-builds release that built the wasm; formal/lean4/Wasm/build-wasm.sh step 9 writes them for a local build. Do not commit a stamped copy.",
|
|
4
4
|
"stamped": true,
|
|
5
|
-
"release": "danbri/factoidal-builds build-
|
|
6
|
-
"releaseRun": "https://github.com/danbri/factoidal-builds/actions/runs/
|
|
7
|
-
"gitSha": "
|
|
8
|
-
"builtAt": "2026-10-
|
|
5
|
+
"release": "danbri/factoidal-builds build-24e7d6edaa7d-web",
|
|
6
|
+
"releaseRun": "https://github.com/danbri/factoidal-builds/actions/runs/40826788173",
|
|
7
|
+
"gitSha": "24e7d6edaa7da12a9445922c949f762ddacdf17c",
|
|
8
|
+
"builtAt": "2026-10-29T07:16:14Z",
|
|
9
9
|
"leanToolchain": "leanprover/lean4:v4.33.1",
|
|
10
10
|
"emscripten": "6.0.8",
|
|
11
11
|
"abiVersion": "1",
|
|
12
12
|
"engineVersion": "l4factoidal-wasm 0.2.0 (dispatch: RDF parse/serialize, SPARQL query+update, RDFS/OWL-RL closures, RDFC-1.0, CL/IKL)",
|
|
13
13
|
"version": "l4factoidal-wasm 0.2.0 (dispatch: RDF parse/serialize, SPARQL query+update, RDFS/OWL-RL closures, RDFC-1.0, CL/IKL)",
|
|
14
|
-
"wasmSha256": "
|
|
15
|
-
"wasmBytes":
|
|
14
|
+
"wasmSha256": "b4f1a5b8cc1d6d5307a836120ba8d09bc7dd7680530bb276366d47a8f95f0d12",
|
|
15
|
+
"wasmBytes": 29931615,
|
|
16
16
|
"claims": {
|
|
17
17
|
"source": "formal/lean4 (L4Factoidal): no sorry, no user axioms, no native_decide; W3C behaviour pinned by build-time #guard",
|
|
18
18
|
"suitesAtBuildSha": "see docs/test-results and formal/lean4/PORT_NOTES.md at gitSha"
|
package/lib/api.mjs
CHANGED
|
@@ -2033,6 +2033,67 @@ function buildApi(driver) {
|
|
|
2033
2033
|
return r.output;
|
|
2034
2034
|
}
|
|
2035
2035
|
|
|
2036
|
+
// XPath 4.0, XQuery 4.0 and XSLT 4.0 (formal/lean4/Wasm/Ops/Qt4.lean). The
|
|
2037
|
+
// engine evaluates and serializes; these functions check argument types and
|
|
2038
|
+
// unwrap the envelope. A QT4 error rejects with a FactoidalError (code
|
|
2039
|
+
// `xml.failed`) whose `qtError` is {code, namespace, message}: the error
|
|
2040
|
+
// code the specification names (XPST0003, FODC0002, XTSE0165, ...).
|
|
2041
|
+
// The engine does no I/O: fn:doc, fn:unparsed-text, import module,
|
|
2042
|
+
// xsl:import and xsl:include of anything but the arguments fail with the
|
|
2043
|
+
// specification's error code.
|
|
2044
|
+
function qt4Result(r) {
|
|
2045
|
+
const { ok: _ok, ...rest } = r;
|
|
2046
|
+
return rest;
|
|
2047
|
+
}
|
|
2048
|
+
|
|
2049
|
+
/**
|
|
2050
|
+
* Evaluate an XPath 4.0 expression with an XML document as context item.
|
|
2051
|
+
* @param {string} xmlText the context document, or '' for no context item
|
|
2052
|
+
* @param {string} expr an XPath 4.0 expression
|
|
2053
|
+
* @returns {Promise<{count:number, items:Array<{type:string,value:string}>, adaptive:string, xml:string|null}>}
|
|
2054
|
+
*/
|
|
2055
|
+
async function xpath4Eval(xmlText, expr) {
|
|
2056
|
+
if (typeof xmlText !== 'string' || typeof expr !== 'string') {
|
|
2057
|
+
throw new TypeError('xpath4Eval: xmlText and expr must be strings');
|
|
2058
|
+
}
|
|
2059
|
+
const e = await entry();
|
|
2060
|
+
requireEntryFn(e, 'xpath4Eval', 'XPath 4.0 evaluation');
|
|
2061
|
+
return qt4Result(entryResult(e.xpath4Eval(xmlText, expr), 'xpath4Eval'));
|
|
2062
|
+
}
|
|
2063
|
+
|
|
2064
|
+
/**
|
|
2065
|
+
* Evaluate an XQuery 4.0 main module, optionally with an XML document as
|
|
2066
|
+
* context item.
|
|
2067
|
+
* @param {string} query an XQuery 4.0 main module
|
|
2068
|
+
* @param {string} [contextXml] the context document ('' or absent: none)
|
|
2069
|
+
* @returns {Promise<{count:number, items:Array<{type:string,value:string}>, adaptive:string, xml:string|null}>}
|
|
2070
|
+
*/
|
|
2071
|
+
async function xqueryEval(query, contextXml) {
|
|
2072
|
+
if (typeof query !== 'string' || (contextXml !== undefined && typeof contextXml !== 'string')) {
|
|
2073
|
+
throw new TypeError('xqueryEval: query must be a string, contextXml a string when given');
|
|
2074
|
+
}
|
|
2075
|
+
const e = await entry();
|
|
2076
|
+
requireEntryFn(e, 'xqueryEval', 'XQuery 4.0 evaluation');
|
|
2077
|
+
return qt4Result(entryResult(e.xqueryEval(query, contextXml ?? ''), 'xqueryEval'));
|
|
2078
|
+
}
|
|
2079
|
+
|
|
2080
|
+
/**
|
|
2081
|
+
* XSLT 4.0 transform. The principal result is serialized with the
|
|
2082
|
+
* stylesheet's unnamed output definition; `secondary` holds the results of
|
|
2083
|
+
* xsl:result-document, `messages` the xsl:message texts.
|
|
2084
|
+
* @param {string} stylesheetXml an XSLT stylesheet (one module)
|
|
2085
|
+
* @param {string} sourceXml the source document, or '' for no global context item
|
|
2086
|
+
* @returns {Promise<{output:string, method:string, secondary:Array<{href:string,output:string}>, messages:string[]}>}
|
|
2087
|
+
*/
|
|
2088
|
+
async function xslt4Transform(stylesheetXml, sourceXml) {
|
|
2089
|
+
if (typeof stylesheetXml !== 'string' || typeof sourceXml !== 'string') {
|
|
2090
|
+
throw new TypeError('xslt4Transform: stylesheetXml and sourceXml must be strings');
|
|
2091
|
+
}
|
|
2092
|
+
const e = await entry();
|
|
2093
|
+
requireEntryFn(e, 'xslt4Transform', 'XSLT 4.0 transform');
|
|
2094
|
+
return qt4Result(entryResult(e.xslt4Transform(stylesheetXml, sourceXml), 'xslt4Transform'));
|
|
2095
|
+
}
|
|
2096
|
+
|
|
2036
2097
|
/**
|
|
2037
2098
|
* Evaluate a Content MathML document (entry_jsoo.ml's mathmlEval
|
|
2038
2099
|
* export -> MathML.Content.eval_doc_env). `bindings` maps
|
|
@@ -2508,6 +2569,9 @@ function buildApi(driver) {
|
|
|
2508
2569
|
xpath: has('xpathEval'),
|
|
2509
2570
|
rif: has('rifEval'),
|
|
2510
2571
|
xslt: has('xsltTransform'),
|
|
2572
|
+
xpath4: has('xpath4Eval'),
|
|
2573
|
+
xquery: has('xqueryEval'),
|
|
2574
|
+
xslt4: has('xslt4Transform'),
|
|
2511
2575
|
mathml: has('mathmlEval'),
|
|
2512
2576
|
xforms: has('xformsRecalc'),
|
|
2513
2577
|
jsonSchema: has('jsonSchemaValidate'),
|
|
@@ -2688,6 +2752,9 @@ function buildApi(driver) {
|
|
|
2688
2752
|
clNormalize,
|
|
2689
2753
|
rifEval,
|
|
2690
2754
|
xsltTransform,
|
|
2755
|
+
xpath4Eval,
|
|
2756
|
+
xqueryEval,
|
|
2757
|
+
xslt4Transform,
|
|
2691
2758
|
mathmlEval,
|
|
2692
2759
|
xformsRecalc,
|
|
2693
2760
|
jsonSchemaValidate,
|
package/lib/errors.mjs
CHANGED
|
@@ -24,6 +24,10 @@
|
|
|
24
24
|
* - `cause`: the underlying error, when there is one.
|
|
25
25
|
* - `format`, `formatInferred`: for a parse failure of text, the syntax it
|
|
26
26
|
* was read as and whether that syntax was inferred.
|
|
27
|
+
* - `qtError`: for xpath4Eval, xqueryEval and xslt4Transform, the error the
|
|
28
|
+
* XPath, XQuery or XSLT 4.0 specification names: `{code, namespace,
|
|
29
|
+
* message}` (for example code `XPST0003` in
|
|
30
|
+
* http://www.w3.org/2005/xqt-errors).
|
|
27
31
|
*/
|
|
28
32
|
export class FactoidalError extends Error {
|
|
29
33
|
constructor(message, info) {
|
|
@@ -35,6 +39,7 @@ export class FactoidalError extends Error {
|
|
|
35
39
|
this.spec = i.spec || null;
|
|
36
40
|
if (i.format !== undefined) this.format = i.format;
|
|
37
41
|
if (i.formatInferred !== undefined) this.formatInferred = i.formatInferred;
|
|
42
|
+
if (i.qtError !== undefined) this.qtError = i.qtError;
|
|
38
43
|
if (typeof Error.captureStackTrace === 'function') {
|
|
39
44
|
Error.captureStackTrace(this, FactoidalError);
|
|
40
45
|
}
|
|
@@ -81,6 +86,7 @@ export function errorFromEnvelope(env, text) {
|
|
|
81
86
|
spec: env && env.spec,
|
|
82
87
|
position,
|
|
83
88
|
format: env && env.format,
|
|
89
|
+
qtError: env && env.qtError && typeof env.qtError === 'object' ? env.qtError : undefined,
|
|
84
90
|
});
|
|
85
91
|
}
|
|
86
92
|
|
package/lib/version.mjs
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@factoidal/core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.22.0",
|
|
4
4
|
"description": "EXPERIMENTAL UNREVIEWED CODE: do not run public services on it without careful independent expert review. RDF parsing and writing (Turtle, TriG, N-Triples, N-Quads, RDF/XML, JSON-LD), SPARQL 1.1 and 1.2, RDFS and OWL reasoning, SHACL and ShEx validation, CSVW and RML mapping, RDFC-1.0, and SPARQL, LWS and Solid servers, for Node, Deno and browsers.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"sparql",
|