@dialecte/core 0.2.10 → 0.2.11
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/dist/{index-1D8DELEq.js → index-BdP_eGXx.js} +373 -370
- package/dist/index.js +1 -1
- package/dist/test/config.d.ts +6 -15
- package/dist/test/config.d.ts.map +1 -1
- package/dist/test/generated/constants.generated.d.ts.map +1 -1
- package/dist/test/generated/definition.generated.d.ts +6 -15
- package/dist/test/generated/definition.generated.d.ts.map +1 -1
- package/dist/test/generated/types.generated.d.ts +0 -2
- package/dist/test/generated/types.generated.d.ts.map +1 -1
- package/dist/test/run-test-cases.d.ts +6 -15
- package/dist/test/run-test-cases.d.ts.map +1 -1
- package/dist/test/test-record.d.ts +48 -120
- package/dist/test/test-record.d.ts.map +1 -1
- package/dist/test.js +23 -27
- package/package.json +1 -1
package/dist/test.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { expect as m, it as p } from "vitest";
|
|
2
|
-
import { x as
|
|
2
|
+
import { x as L, D as T, P as w } from "./index-BdP_eGXx.js";
|
|
3
3
|
import { D as g, s as O, o as M, n as k } from "./merge-extensions-dj7By9gG.js";
|
|
4
4
|
function E(a) {
|
|
5
5
|
const e = R(a);
|
|
@@ -107,7 +107,7 @@ ${A ? x({ xml: A.outerHTML }) : "(none)"}`;
|
|
|
107
107
|
function x(a) {
|
|
108
108
|
const { xml: e } = a;
|
|
109
109
|
try {
|
|
110
|
-
return
|
|
110
|
+
return L(e, { indentation: " ", collapseContent: !0 });
|
|
111
111
|
} catch {
|
|
112
112
|
return e;
|
|
113
113
|
}
|
|
@@ -123,7 +123,7 @@ function N(a) {
|
|
|
123
123
|
r ?? null,
|
|
124
124
|
XPathResult.FIRST_ORDERED_NODE_TYPE,
|
|
125
125
|
null
|
|
126
|
-
).singleNodeValue, u = s === 0 ? B[0] : t.slice(B[s - 1].length),
|
|
126
|
+
).singleNodeValue, u = s === 0 ? B[0] : t.slice(B[s - 1].length), o = s === 0 ? "[Document root — no parent context]" : `[Parent element found at step ${s}]:
|
|
127
127
|
${C ? x({ xml: C.outerHTML }) : "(none)"}`;
|
|
128
128
|
m(
|
|
129
129
|
i,
|
|
@@ -131,7 +131,7 @@ ${C ? x({ xml: C.outerHTML }) : "(none)"}`;
|
|
|
131
131
|
The query passes but for the wrong reason — an ancestor is missing, not the target element.
|
|
132
132
|
Missing at step ${s + 1}/${B.length}: ${u.trim()}
|
|
133
133
|
Full XPath: ${t}
|
|
134
|
-
${
|
|
134
|
+
${o}`
|
|
135
135
|
).toBeTruthy(), C = i;
|
|
136
136
|
}
|
|
137
137
|
}
|
|
@@ -440,8 +440,6 @@ const d = {
|
|
|
440
440
|
BB_1: {
|
|
441
441
|
aBB_1: "",
|
|
442
442
|
bBB_1: "",
|
|
443
|
-
dBB_1: "",
|
|
444
|
-
eBB_1: "",
|
|
445
443
|
"ext:cBB_1": ""
|
|
446
444
|
},
|
|
447
445
|
BB_2: {
|
|
@@ -840,7 +838,7 @@ const d = {
|
|
|
840
838
|
selector: [{ steps: [{ kind: "name", value: "BB_1" }] }],
|
|
841
839
|
fields: [
|
|
842
840
|
{ target: { kind: "attribute", value: "aBB_1", isAttribute: !0 } },
|
|
843
|
-
{ target: { kind: "attribute", value: "
|
|
841
|
+
{ target: { kind: "attribute", value: "bBB_1", isAttribute: !0 } }
|
|
844
842
|
]
|
|
845
843
|
},
|
|
846
844
|
{
|
|
@@ -932,7 +930,7 @@ const d = {
|
|
|
932
930
|
sequence: ["aBBB_1", "bBBB_1", "ext:cBBB_1"],
|
|
933
931
|
details: {
|
|
934
932
|
aBBB_1: { required: !0, facets: { whiteSpace: "preserve" } },
|
|
935
|
-
bBBB_1: { facets: { whiteSpace: "preserve" } },
|
|
933
|
+
bBBB_1: { default: "false", facets: { whiteSpace: "preserve" } },
|
|
936
934
|
"ext:cBBB_1": {
|
|
937
935
|
namespace: { prefix: "ext", uri: "http://dialecte.dev/XML/DEV-EXT" },
|
|
938
936
|
facets: { whiteSpace: "preserve" }
|
|
@@ -1020,18 +1018,16 @@ const d = {
|
|
|
1020
1018
|
namespace: { prefix: "", uri: "http://dialecte.dev/XML/DEFAULT" },
|
|
1021
1019
|
parents: ["B"],
|
|
1022
1020
|
attributes: {
|
|
1023
|
-
sequence: ["aBB_1", "bBB_1", "
|
|
1021
|
+
sequence: ["aBB_1", "bBB_1", "ext:cBB_1"],
|
|
1024
1022
|
details: {
|
|
1025
1023
|
aBB_1: { required: !0, facets: { whiteSpace: "preserve" } },
|
|
1026
|
-
bBB_1: { facets: { whiteSpace: "preserve" } },
|
|
1027
|
-
dBB_1: { default: "", facets: { whiteSpace: "preserve" } },
|
|
1028
|
-
eBB_1: { default: "", facets: { whiteSpace: "preserve" } },
|
|
1024
|
+
bBB_1: { default: "", facets: { whiteSpace: "preserve" } },
|
|
1029
1025
|
"ext:cBB_1": {
|
|
1030
1026
|
namespace: { prefix: "ext", uri: "http://dialecte.dev/XML/DEV-EXT" },
|
|
1031
1027
|
facets: { whiteSpace: "preserve" }
|
|
1032
1028
|
}
|
|
1033
1029
|
},
|
|
1034
|
-
identityFields: ["aBB_1", "
|
|
1030
|
+
identityFields: ["aBB_1", "bBB_1"]
|
|
1035
1031
|
},
|
|
1036
1032
|
children: {
|
|
1037
1033
|
sequence: ["BBB_1", "BBB_2", "BBB_3"],
|
|
@@ -1080,7 +1076,7 @@ const d = {
|
|
|
1080
1076
|
sequence: ["aBB_2", "bBB_2", "ext:cBB_2"],
|
|
1081
1077
|
details: {
|
|
1082
1078
|
aBB_2: { required: !0, facets: { whiteSpace: "preserve" } },
|
|
1083
|
-
bBB_2: { facets: { whiteSpace: "preserve" } },
|
|
1079
|
+
bBB_2: { default: "", facets: { whiteSpace: "preserve" } },
|
|
1084
1080
|
"ext:cBB_2": {
|
|
1085
1081
|
namespace: { prefix: "ext", uri: "http://dialecte.dev/XML/DEV-EXT" },
|
|
1086
1082
|
facets: { whiteSpace: "preserve" }
|
|
@@ -1492,7 +1488,7 @@ const d = {
|
|
|
1492
1488
|
selector: [{ steps: [{ kind: "name", value: "BB_1" }] }],
|
|
1493
1489
|
fields: [
|
|
1494
1490
|
{ target: { kind: "attribute", value: "aBB_1", isAttribute: !0 } },
|
|
1495
|
-
{ target: { kind: "attribute", value: "
|
|
1491
|
+
{ target: { kind: "attribute", value: "bBB_1", isAttribute: !0 } }
|
|
1496
1492
|
]
|
|
1497
1493
|
},
|
|
1498
1494
|
{
|
|
@@ -1549,7 +1545,7 @@ const d = {
|
|
|
1549
1545
|
schema: "id, tagName, [id+tagName], parent.id, parent.tagName, *children.id, *children.tagName"
|
|
1550
1546
|
}
|
|
1551
1547
|
}
|
|
1552
|
-
},
|
|
1548
|
+
}, l = {
|
|
1553
1549
|
rootElementName: G,
|
|
1554
1550
|
singletonElements: H,
|
|
1555
1551
|
elements: $,
|
|
@@ -1567,10 +1563,10 @@ async function b(a) {
|
|
|
1567
1563
|
const {
|
|
1568
1564
|
sourceXml: e,
|
|
1569
1565
|
targetXml: t,
|
|
1570
|
-
dialecteConfig: r =
|
|
1566
|
+
dialecteConfig: r = l,
|
|
1571
1567
|
extensions: B,
|
|
1572
1568
|
hooks: A
|
|
1573
|
-
} = a, _ = `test-${crypto.randomUUID()}`, C = await new
|
|
1569
|
+
} = a, _ = `test-${crypto.randomUUID()}`, C = await new w({
|
|
1574
1570
|
configs: { default: r },
|
|
1575
1571
|
defaultConfigKey: "default",
|
|
1576
1572
|
storage: { type: "local" },
|
|
@@ -1597,7 +1593,7 @@ async function b(a) {
|
|
|
1597
1593
|
return { project: C, source: c, target: n };
|
|
1598
1594
|
}
|
|
1599
1595
|
async function ie(a) {
|
|
1600
|
-
const { databaseName: e, dialecteConfig: t, documentId: r } = a, B = new
|
|
1596
|
+
const { databaseName: e, dialecteConfig: t, documentId: r } = a, B = new T(e, {
|
|
1601
1597
|
recordSchema: t.database.recordSchema
|
|
1602
1598
|
});
|
|
1603
1599
|
return await B.open(), {
|
|
@@ -1621,14 +1617,14 @@ function J(a) {
|
|
|
1621
1617
|
act: t,
|
|
1622
1618
|
extensions: r,
|
|
1623
1619
|
hooks: B,
|
|
1624
|
-
dialecteConfig: A =
|
|
1620
|
+
dialecteConfig: A = l
|
|
1625
1621
|
} = a, { assertExpectedElementQueries: _, assertUnexpectedElementQueries: C } = V({
|
|
1626
1622
|
namespaces: A.namespaces
|
|
1627
1623
|
});
|
|
1628
1624
|
for (const [s, c] of Object.entries(e))
|
|
1629
1625
|
(c.only ? p.only : p)(s, async () => {
|
|
1630
1626
|
crypto.randomUUID = X;
|
|
1631
|
-
const { project: i, source: u, target:
|
|
1627
|
+
const { project: i, source: u, target: o } = await b({
|
|
1632
1628
|
sourceXml: c.sourceXml,
|
|
1633
1629
|
targetXml: c.targetXml,
|
|
1634
1630
|
dialecteConfig: A,
|
|
@@ -1641,8 +1637,8 @@ function J(a) {
|
|
|
1641
1637
|
testCase: c,
|
|
1642
1638
|
project: i,
|
|
1643
1639
|
source: u.document,
|
|
1644
|
-
target:
|
|
1645
|
-
}), S = f?.assertOn ?? "source", D = f?.withDatabaseIds ?? !0, h = S === "target" ?
|
|
1640
|
+
target: o?.document
|
|
1641
|
+
}), S = f?.assertOn ?? "source", D = f?.withDatabaseIds ?? !0, h = S === "target" ? o?.documentId : u.documentId;
|
|
1646
1642
|
if (!h) throw new Error("documentId required for export");
|
|
1647
1643
|
const { xmlDocument: v } = await i.export(h, { withDatabaseIds: D });
|
|
1648
1644
|
c.expectedQueries?.length && _({ xmlDocument: v, queries: c.expectedQueries }), c.unexpectedQueries?.length && C({ xmlDocument: v, queries: c.unexpectedQueries });
|
|
@@ -1657,7 +1653,7 @@ function ee(a) {
|
|
|
1657
1653
|
act: t,
|
|
1658
1654
|
extensions: r,
|
|
1659
1655
|
hooks: B,
|
|
1660
|
-
dialecteConfig: A =
|
|
1656
|
+
dialecteConfig: A = l
|
|
1661
1657
|
} = a;
|
|
1662
1658
|
for (const [_, C] of Object.entries(e))
|
|
1663
1659
|
(C.only ? p.only : p)(_, async () => {
|
|
@@ -1680,7 +1676,7 @@ function te(a, e) {
|
|
|
1680
1676
|
for (const [t, r] of Object.entries(a))
|
|
1681
1677
|
(r.only ? p.only : p)(t, () => e(r));
|
|
1682
1678
|
}
|
|
1683
|
-
const ne = ae({ dialecteConfig:
|
|
1679
|
+
const ne = ae({ dialecteConfig: l });
|
|
1684
1680
|
function ae(a) {
|
|
1685
1681
|
const { dialecteConfig: e, hooks: t, extensions: r } = a;
|
|
1686
1682
|
return {
|
|
@@ -1705,12 +1701,12 @@ function Be(a) {
|
|
|
1705
1701
|
}
|
|
1706
1702
|
return e;
|
|
1707
1703
|
}
|
|
1708
|
-
const ue = Be(
|
|
1704
|
+
const ue = Be(l);
|
|
1709
1705
|
export {
|
|
1710
1706
|
Z as DATABASE_CONFIG,
|
|
1711
1707
|
d as DIALECTE_NAMESPACES,
|
|
1712
1708
|
W as IO_CONFIG,
|
|
1713
|
-
|
|
1709
|
+
l as TEST_DIALECTE_CONFIG,
|
|
1714
1710
|
_e as XMLNS_DEFAULT_NAMESPACE,
|
|
1715
1711
|
se as XMLNS_DEV_NAMESPACE,
|
|
1716
1712
|
ce as XMLNS_EXT_NAMESPACE,
|