@dialecte/core 0.2.9 → 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/create-test-dialecte.d.ts +9 -5
- package/dist/test/create-test-dialecte.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 +16 -17
- package/dist/test/run-test-cases.d.ts.map +1 -1
- package/dist/test/run-test-cases.type.d.ts +6 -6
- package/dist/test/run-test-cases.type.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 +193 -190
- package/package.json +1 -1
package/dist/test.js
CHANGED
|
@@ -1,141 +1,141 @@
|
|
|
1
1
|
import { expect as m, it as p } from "vitest";
|
|
2
|
-
import { x as
|
|
3
|
-
import { D as
|
|
4
|
-
function
|
|
5
|
-
const e =
|
|
2
|
+
import { x as L, D as T, P as w } from "./index-BdP_eGXx.js";
|
|
3
|
+
import { D as g, s as O, o as M, n as k } from "./merge-extensions-dj7By9gG.js";
|
|
4
|
+
function E(a) {
|
|
5
|
+
const e = R(a);
|
|
6
6
|
if (e.length === 0)
|
|
7
|
-
return [
|
|
7
|
+
return [a];
|
|
8
8
|
const t = [];
|
|
9
9
|
for (const r of e)
|
|
10
|
-
t.push(
|
|
11
|
-
return t.push(
|
|
10
|
+
t.push(a.slice(0, r));
|
|
11
|
+
return t.push(a), t;
|
|
12
12
|
}
|
|
13
|
-
function
|
|
13
|
+
function R(a) {
|
|
14
14
|
const e = [];
|
|
15
|
-
let t = 0, r = 0,
|
|
16
|
-
for (let
|
|
17
|
-
const
|
|
18
|
-
if (
|
|
19
|
-
|
|
15
|
+
let t = 0, r = 0, B = null;
|
|
16
|
+
for (let A = 0; A < a.length; A++) {
|
|
17
|
+
const _ = a[A];
|
|
18
|
+
if (B) {
|
|
19
|
+
_ === B && (B = null);
|
|
20
20
|
continue;
|
|
21
21
|
}
|
|
22
|
-
if (
|
|
23
|
-
|
|
22
|
+
if (_ === '"' || _ === "'") {
|
|
23
|
+
B = _;
|
|
24
24
|
continue;
|
|
25
25
|
}
|
|
26
|
-
if (
|
|
26
|
+
if (_ === "[") {
|
|
27
27
|
t++;
|
|
28
28
|
continue;
|
|
29
29
|
}
|
|
30
|
-
if (
|
|
30
|
+
if (_ === "]") {
|
|
31
31
|
t--;
|
|
32
32
|
continue;
|
|
33
33
|
}
|
|
34
|
-
if (
|
|
34
|
+
if (_ === "(") {
|
|
35
35
|
r++;
|
|
36
36
|
continue;
|
|
37
37
|
}
|
|
38
|
-
if (
|
|
38
|
+
if (_ === ")") {
|
|
39
39
|
r--;
|
|
40
40
|
continue;
|
|
41
41
|
}
|
|
42
|
-
if (!(t > 0 || r > 0) &&
|
|
43
|
-
if (
|
|
44
|
-
|
|
42
|
+
if (!(t > 0 || r > 0) && _ === "/") {
|
|
43
|
+
if (A === 0) {
|
|
44
|
+
a[A + 1] === "/" && A++;
|
|
45
45
|
continue;
|
|
46
46
|
}
|
|
47
|
-
if (e.length === 0 &&
|
|
47
|
+
if (e.length === 0 && A === 1 && a[0] === "/")
|
|
48
48
|
continue;
|
|
49
|
-
e.push(
|
|
49
|
+
e.push(A), a[A + 1] === "/" && A++;
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
52
|
return e;
|
|
53
53
|
}
|
|
54
|
-
function
|
|
55
|
-
const { namespaces: e } =
|
|
54
|
+
function V(a) {
|
|
55
|
+
const { namespaces: e } = a, t = y(e);
|
|
56
56
|
return {
|
|
57
57
|
assertExpectedElementQueries(r) {
|
|
58
|
-
|
|
58
|
+
F({ ...r, nsResolver: t });
|
|
59
59
|
},
|
|
60
60
|
assertUnexpectedElementQueries(r) {
|
|
61
|
-
|
|
61
|
+
I({ ...r, nsResolver: t });
|
|
62
62
|
}
|
|
63
63
|
};
|
|
64
64
|
}
|
|
65
|
-
function
|
|
66
|
-
const { xmlDocument: e, queries: t, nsResolver: r } =
|
|
67
|
-
for (const
|
|
68
|
-
|
|
65
|
+
function F(a) {
|
|
66
|
+
const { xmlDocument: e, queries: t, nsResolver: r } = a;
|
|
67
|
+
for (const B of t)
|
|
68
|
+
U({ xmlDocument: e, xpath: B, nsResolver: r });
|
|
69
69
|
}
|
|
70
|
-
function
|
|
71
|
-
return (e) => e ?
|
|
70
|
+
function y(a) {
|
|
71
|
+
return (e) => e ? a[e]?.uri ?? null : null;
|
|
72
72
|
}
|
|
73
|
-
function
|
|
74
|
-
const { xmlDocument: e, queries: t, nsResolver: r } =
|
|
75
|
-
for (const
|
|
76
|
-
|
|
73
|
+
function I(a) {
|
|
74
|
+
const { xmlDocument: e, queries: t, nsResolver: r } = a;
|
|
75
|
+
for (const B of t)
|
|
76
|
+
N({ xmlDocument: e, xpath: B, nsResolver: r });
|
|
77
77
|
}
|
|
78
|
-
function
|
|
79
|
-
const { xmlDocument: e, xpath: t, nsResolver: r } =
|
|
80
|
-
let
|
|
81
|
-
for (let
|
|
82
|
-
const
|
|
83
|
-
|
|
78
|
+
function U(a) {
|
|
79
|
+
const { xmlDocument: e, xpath: t, nsResolver: r } = a, B = E(t);
|
|
80
|
+
let A = null, _ = 0;
|
|
81
|
+
for (let C = 0; C < B.length; C++) {
|
|
82
|
+
const s = B[C], n = e.evaluate(
|
|
83
|
+
s,
|
|
84
84
|
e,
|
|
85
85
|
r ?? null,
|
|
86
86
|
XPathResult.FIRST_ORDERED_NODE_TYPE,
|
|
87
87
|
null
|
|
88
88
|
).singleNodeValue;
|
|
89
|
-
if (
|
|
90
|
-
|
|
89
|
+
if (n) {
|
|
90
|
+
A = n, _ = C + 1;
|
|
91
91
|
continue;
|
|
92
92
|
}
|
|
93
|
-
const
|
|
93
|
+
const i = C === 0 ? B[0] : t.slice(B[C - 1].length), u = _ === 0 ? `[No parent matched — failed from document root]
|
|
94
94
|
Document:
|
|
95
|
-
${x({ xml: new XMLSerializer().serializeToString(e) })}` : `[Last match at step ${
|
|
96
|
-
${
|
|
95
|
+
${x({ xml: new XMLSerializer().serializeToString(e) })}` : `[Last match at step ${_}/${B.length}]:
|
|
96
|
+
${A ? x({ xml: A.outerHTML }) : "(none)"}`;
|
|
97
97
|
m(
|
|
98
|
-
|
|
98
|
+
n,
|
|
99
99
|
`Element not found in XML.
|
|
100
|
-
Failed at step ${
|
|
100
|
+
Failed at step ${C + 1}/${B.length}: ${i.trim()}
|
|
101
101
|
Full XPath: ${t}
|
|
102
102
|
${u}`
|
|
103
103
|
).toBeTruthy();
|
|
104
104
|
return;
|
|
105
105
|
}
|
|
106
106
|
}
|
|
107
|
-
function x(
|
|
108
|
-
const { xml: e } =
|
|
107
|
+
function x(a) {
|
|
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
|
}
|
|
114
114
|
}
|
|
115
|
-
function
|
|
116
|
-
const { xmlDocument: e, xpath: t, nsResolver: r } =
|
|
117
|
-
if (
|
|
118
|
-
let
|
|
119
|
-
for (let
|
|
120
|
-
const
|
|
121
|
-
|
|
115
|
+
function N(a) {
|
|
116
|
+
const { xmlDocument: e, xpath: t, nsResolver: r } = a, B = E(t);
|
|
117
|
+
if (B.length > 1) {
|
|
118
|
+
let C = null;
|
|
119
|
+
for (let s = 0; s < B.length - 1; s++) {
|
|
120
|
+
const c = B[s], i = e.evaluate(
|
|
121
|
+
c,
|
|
122
122
|
e,
|
|
123
123
|
r ?? null,
|
|
124
124
|
XPathResult.FIRST_ORDERED_NODE_TYPE,
|
|
125
125
|
null
|
|
126
|
-
).singleNodeValue, u =
|
|
127
|
-
${
|
|
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
|
+
${C ? x({ xml: C.outerHTML }) : "(none)"}`;
|
|
128
128
|
m(
|
|
129
|
-
|
|
129
|
+
i,
|
|
130
130
|
`Absent assertion is unreliable: ancestor step does not exist.
|
|
131
131
|
The query passes but for the wrong reason — an ancestor is missing, not the target element.
|
|
132
|
-
Missing at step ${
|
|
132
|
+
Missing at step ${s + 1}/${B.length}: ${u.trim()}
|
|
133
133
|
Full XPath: ${t}
|
|
134
134
|
${o}`
|
|
135
|
-
).toBeTruthy(),
|
|
135
|
+
).toBeTruthy(), C = i;
|
|
136
136
|
}
|
|
137
137
|
}
|
|
138
|
-
const
|
|
138
|
+
const _ = e.evaluate(
|
|
139
139
|
t,
|
|
140
140
|
e,
|
|
141
141
|
r ?? null,
|
|
@@ -143,11 +143,11 @@ ${s ? x({ xml: s.outerHTML }) : "(none)"}`;
|
|
|
143
143
|
null
|
|
144
144
|
).singleNodeValue;
|
|
145
145
|
m(
|
|
146
|
-
|
|
146
|
+
_,
|
|
147
147
|
`Element should NOT exist in XML but was found.
|
|
148
148
|
XPath: ${t}
|
|
149
149
|
Found:
|
|
150
|
-
${
|
|
150
|
+
${_ ? x({ xml: _.outerHTML }) : "(none)"}`
|
|
151
151
|
).toBeFalsy();
|
|
152
152
|
}
|
|
153
153
|
const d = {
|
|
@@ -155,12 +155,12 @@ const d = {
|
|
|
155
155
|
uri: "http://dialecte.dev/XML/DEFAULT",
|
|
156
156
|
prefix: ""
|
|
157
157
|
},
|
|
158
|
-
dev:
|
|
158
|
+
dev: g,
|
|
159
159
|
ext: {
|
|
160
160
|
uri: "http://dialecte.dev/XML/DEV-EXT",
|
|
161
161
|
prefix: "ext"
|
|
162
162
|
}
|
|
163
|
-
},
|
|
163
|
+
}, _e = `xmlns="${d.default.uri}"`, se = `xmlns:${d.dev.prefix}="${d.dev.uri}"`, ce = `xmlns:${d.ext.prefix}="${d.ext.uri}"`, $ = [
|
|
164
164
|
"A",
|
|
165
165
|
"AAAA_1",
|
|
166
166
|
"AAAA_2",
|
|
@@ -192,7 +192,7 @@ const d = {
|
|
|
192
192
|
"CC_2",
|
|
193
193
|
"CC_3",
|
|
194
194
|
"Root"
|
|
195
|
-
],
|
|
195
|
+
], P = {
|
|
196
196
|
A: ["AA_1", "AA_2", "AA_3"],
|
|
197
197
|
AAAA_1: [],
|
|
198
198
|
AAAA_2: [],
|
|
@@ -224,7 +224,7 @@ const d = {
|
|
|
224
224
|
CC_2: ["CCC_1", "CCC_2", "CCC_3"],
|
|
225
225
|
CC_3: ["CCC_1", "CCC_2", "CCC_3"],
|
|
226
226
|
Root: ["A", "B", "C"]
|
|
227
|
-
},
|
|
227
|
+
}, Q = {
|
|
228
228
|
A: ["Root"],
|
|
229
229
|
AAAA_1: ["AAA_1", "AAA_2", "AAA_3"],
|
|
230
230
|
AAAA_2: ["AAA_1", "AAA_2", "AAA_3"],
|
|
@@ -256,7 +256,7 @@ const d = {
|
|
|
256
256
|
CC_2: ["C"],
|
|
257
257
|
CC_3: ["C"],
|
|
258
258
|
Root: []
|
|
259
|
-
},
|
|
259
|
+
}, j = {
|
|
260
260
|
A: ["AAAA_1", "AAAA_2", "AAAA_3", "AAA_1", "AAA_2", "AAA_3", "AA_1", "AA_2", "AA_3"],
|
|
261
261
|
AAAA_1: [],
|
|
262
262
|
AAAA_2: [],
|
|
@@ -319,7 +319,7 @@ const d = {
|
|
|
319
319
|
"CC_2",
|
|
320
320
|
"CC_3"
|
|
321
321
|
]
|
|
322
|
-
},
|
|
322
|
+
}, z = {
|
|
323
323
|
A: ["Root"],
|
|
324
324
|
AAAA_1: ["A", "AAA_1", "AAA_2", "AAA_3", "AA_1", "AA_2", "AA_3", "Root"],
|
|
325
325
|
AAAA_2: ["A", "AAA_1", "AAA_2", "AAA_3", "AA_1", "AA_2", "AA_3", "Root"],
|
|
@@ -351,7 +351,7 @@ const d = {
|
|
|
351
351
|
CC_2: ["C", "Root"],
|
|
352
352
|
CC_3: ["C", "Root"],
|
|
353
353
|
Root: []
|
|
354
|
-
},
|
|
354
|
+
}, G = "Root", H = ["A", "AA_1", "B", "BB_1", "C", "CC_1", "CC_2", "Root"], Y = {
|
|
355
355
|
A: {
|
|
356
356
|
aA: "",
|
|
357
357
|
bA: "",
|
|
@@ -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: {
|
|
@@ -508,7 +506,7 @@ const d = {
|
|
|
508
506
|
"ext:root": "",
|
|
509
507
|
root: ""
|
|
510
508
|
}
|
|
511
|
-
},
|
|
509
|
+
}, K = {
|
|
512
510
|
A: {
|
|
513
511
|
tag: "A",
|
|
514
512
|
namespace: { prefix: "", uri: "http://dialecte.dev/XML/DEFAULT" },
|
|
@@ -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
|
{
|
|
@@ -1533,9 +1529,9 @@ const d = {
|
|
|
1533
1529
|
}
|
|
1534
1530
|
]
|
|
1535
1531
|
}
|
|
1536
|
-
}, K = {
|
|
1537
|
-
supportedFileExtensions: [".xml"]
|
|
1538
1532
|
}, W = {
|
|
1533
|
+
supportedFileExtensions: [".xml"]
|
|
1534
|
+
}, Z = {
|
|
1539
1535
|
recordSchema: {
|
|
1540
1536
|
primaryKey: "id",
|
|
1541
1537
|
indexes: ["tagName", "parent.id", "parent.tagName"],
|
|
@@ -1550,172 +1546,179 @@ const d = {
|
|
|
1550
1546
|
}
|
|
1551
1547
|
}
|
|
1552
1548
|
}, l = {
|
|
1553
|
-
rootElementName:
|
|
1554
|
-
singletonElements:
|
|
1555
|
-
elements:
|
|
1549
|
+
rootElementName: G,
|
|
1550
|
+
singletonElements: H,
|
|
1551
|
+
elements: $,
|
|
1556
1552
|
namespaces: d,
|
|
1557
|
-
attributes:
|
|
1558
|
-
children:
|
|
1559
|
-
parents:
|
|
1560
|
-
descendants:
|
|
1561
|
-
ancestors:
|
|
1562
|
-
database:
|
|
1563
|
-
io:
|
|
1564
|
-
definition:
|
|
1553
|
+
attributes: Y,
|
|
1554
|
+
children: P,
|
|
1555
|
+
parents: Q,
|
|
1556
|
+
descendants: j,
|
|
1557
|
+
ancestors: z,
|
|
1558
|
+
database: Z,
|
|
1559
|
+
io: W,
|
|
1560
|
+
definition: K
|
|
1565
1561
|
};
|
|
1566
|
-
async function
|
|
1562
|
+
async function b(a) {
|
|
1567
1563
|
const {
|
|
1568
1564
|
sourceXml: e,
|
|
1569
1565
|
targetXml: t,
|
|
1570
1566
|
dialecteConfig: r = l,
|
|
1571
|
-
|
|
1572
|
-
|
|
1567
|
+
extensions: B,
|
|
1568
|
+
hooks: A
|
|
1569
|
+
} = a, _ = `test-${crypto.randomUUID()}`, C = await new w({
|
|
1573
1570
|
configs: { default: r },
|
|
1574
1571
|
defaultConfigKey: "default",
|
|
1575
1572
|
storage: { type: "local" },
|
|
1576
|
-
|
|
1577
|
-
|
|
1573
|
+
extensions: B,
|
|
1574
|
+
hooks: A
|
|
1575
|
+
}).open(_), [s] = await C.import(
|
|
1578
1576
|
[new File([e], "source.xml", { type: "text/xml" })],
|
|
1579
1577
|
{ useCustomRecordsIds: !0 }
|
|
1580
|
-
),
|
|
1578
|
+
), c = {
|
|
1581
1579
|
documentId: s.documentId,
|
|
1582
|
-
document:
|
|
1580
|
+
document: C.openDocument(s.documentId)
|
|
1583
1581
|
};
|
|
1584
|
-
let
|
|
1582
|
+
let n;
|
|
1585
1583
|
if (t) {
|
|
1586
|
-
const [
|
|
1584
|
+
const [i] = await C.import(
|
|
1587
1585
|
[new File([t], "target.xml", { type: "text/xml" })],
|
|
1588
1586
|
{ useCustomRecordsIds: !0 }
|
|
1589
1587
|
);
|
|
1590
|
-
|
|
1591
|
-
documentId:
|
|
1592
|
-
document:
|
|
1588
|
+
n = {
|
|
1589
|
+
documentId: i.documentId,
|
|
1590
|
+
document: C.openDocument(i.documentId)
|
|
1593
1591
|
};
|
|
1594
1592
|
}
|
|
1595
|
-
return { project:
|
|
1593
|
+
return { project: C, source: c, target: n };
|
|
1596
1594
|
}
|
|
1597
|
-
async function
|
|
1598
|
-
const { databaseName: e, dialecteConfig: t, documentId: r } =
|
|
1595
|
+
async function ie(a) {
|
|
1596
|
+
const { databaseName: e, dialecteConfig: t, documentId: r } = a, B = new T(e, {
|
|
1599
1597
|
recordSchema: t.database.recordSchema
|
|
1600
1598
|
});
|
|
1601
|
-
return await
|
|
1599
|
+
return await B.open(), {
|
|
1602
1600
|
dialecteConfig: t,
|
|
1603
|
-
store:
|
|
1601
|
+
store: B,
|
|
1604
1602
|
documentId: r,
|
|
1605
1603
|
recordCache: /* @__PURE__ */ new Map(),
|
|
1606
1604
|
stagedOperations: []
|
|
1607
1605
|
};
|
|
1608
1606
|
}
|
|
1609
|
-
const
|
|
1610
|
-
function
|
|
1611
|
-
let
|
|
1607
|
+
const X = crypto.randomUUID.bind(crypto);
|
|
1608
|
+
function q() {
|
|
1609
|
+
let a = 0;
|
|
1612
1610
|
return function() {
|
|
1613
|
-
return `${
|
|
1611
|
+
return `${a++}`;
|
|
1614
1612
|
};
|
|
1615
1613
|
}
|
|
1616
|
-
function
|
|
1614
|
+
function J(a) {
|
|
1617
1615
|
const {
|
|
1618
1616
|
testCases: e,
|
|
1619
1617
|
act: t,
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1618
|
+
extensions: r,
|
|
1619
|
+
hooks: B,
|
|
1620
|
+
dialecteConfig: A = l
|
|
1621
|
+
} = a, { assertExpectedElementQueries: _, assertUnexpectedElementQueries: C } = V({
|
|
1622
|
+
namespaces: A.namespaces
|
|
1624
1623
|
});
|
|
1625
|
-
for (const [s,
|
|
1626
|
-
(
|
|
1627
|
-
crypto.randomUUID =
|
|
1628
|
-
const { project:
|
|
1629
|
-
sourceXml:
|
|
1630
|
-
targetXml:
|
|
1631
|
-
dialecteConfig:
|
|
1632
|
-
|
|
1624
|
+
for (const [s, c] of Object.entries(e))
|
|
1625
|
+
(c.only ? p.only : p)(s, async () => {
|
|
1626
|
+
crypto.randomUUID = X;
|
|
1627
|
+
const { project: i, source: u, target: o } = await b({
|
|
1628
|
+
sourceXml: c.sourceXml,
|
|
1629
|
+
targetXml: c.targetXml,
|
|
1630
|
+
dialecteConfig: A,
|
|
1631
|
+
extensions: r,
|
|
1632
|
+
hooks: B
|
|
1633
1633
|
});
|
|
1634
1634
|
try {
|
|
1635
|
-
crypto.randomUUID =
|
|
1636
|
-
const
|
|
1637
|
-
testCase:
|
|
1638
|
-
project:
|
|
1639
|
-
source:
|
|
1640
|
-
target:
|
|
1641
|
-
}),
|
|
1642
|
-
if (!
|
|
1643
|
-
const { xmlDocument:
|
|
1644
|
-
|
|
1635
|
+
crypto.randomUUID = q();
|
|
1636
|
+
const f = await t({
|
|
1637
|
+
testCase: c,
|
|
1638
|
+
project: i,
|
|
1639
|
+
source: u.document,
|
|
1640
|
+
target: o?.document
|
|
1641
|
+
}), S = f?.assertOn ?? "source", D = f?.withDatabaseIds ?? !0, h = S === "target" ? o?.documentId : u.documentId;
|
|
1642
|
+
if (!h) throw new Error("documentId required for export");
|
|
1643
|
+
const { xmlDocument: v } = await i.export(h, { withDatabaseIds: D });
|
|
1644
|
+
c.expectedQueries?.length && _({ xmlDocument: v, queries: c.expectedQueries }), c.unexpectedQueries?.length && C({ xmlDocument: v, queries: c.unexpectedQueries });
|
|
1645
1645
|
} finally {
|
|
1646
|
-
await
|
|
1646
|
+
await i.destroy();
|
|
1647
1647
|
}
|
|
1648
1648
|
});
|
|
1649
1649
|
}
|
|
1650
|
-
function
|
|
1650
|
+
function ee(a) {
|
|
1651
1651
|
const {
|
|
1652
1652
|
testCases: e,
|
|
1653
1653
|
act: t,
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1654
|
+
extensions: r,
|
|
1655
|
+
hooks: B,
|
|
1656
|
+
dialecteConfig: A = l
|
|
1657
|
+
} = a;
|
|
1658
|
+
for (const [_, C] of Object.entries(e))
|
|
1659
|
+
(C.only ? p.only : p)(_, async () => {
|
|
1660
|
+
crypto.randomUUID = X;
|
|
1661
|
+
const { project: c, source: n, target: i } = await b({
|
|
1662
|
+
sourceXml: C.sourceXml,
|
|
1663
|
+
targetXml: C.targetXml,
|
|
1664
|
+
dialecteConfig: A,
|
|
1665
|
+
extensions: r,
|
|
1666
|
+
hooks: B
|
|
1665
1667
|
});
|
|
1666
1668
|
try {
|
|
1667
|
-
crypto.randomUUID =
|
|
1669
|
+
crypto.randomUUID = q(), await t({ testCase: C, project: c, source: n.document, target: i?.document });
|
|
1668
1670
|
} finally {
|
|
1669
|
-
await
|
|
1671
|
+
await c.destroy();
|
|
1670
1672
|
}
|
|
1671
1673
|
});
|
|
1672
1674
|
}
|
|
1673
|
-
function
|
|
1674
|
-
for (const [t, r] of Object.entries(
|
|
1675
|
+
function te(a, e) {
|
|
1676
|
+
for (const [t, r] of Object.entries(a))
|
|
1675
1677
|
(r.only ? p.only : p)(t, () => e(r));
|
|
1676
1678
|
}
|
|
1677
|
-
const
|
|
1678
|
-
function
|
|
1679
|
+
const ne = ae({ dialecteConfig: l });
|
|
1680
|
+
function ae(a) {
|
|
1681
|
+
const { dialecteConfig: e, hooks: t, extensions: r } = a;
|
|
1679
1682
|
return {
|
|
1680
|
-
withExport: (
|
|
1681
|
-
withoutExport: (
|
|
1682
|
-
generic:
|
|
1683
|
+
withExport: (B) => J({ dialecteConfig: e, extensions: r, hooks: t, ...B }),
|
|
1684
|
+
withoutExport: (B) => ee({ dialecteConfig: e, extensions: r, hooks: t, ...B }),
|
|
1685
|
+
generic: te
|
|
1683
1686
|
};
|
|
1684
1687
|
}
|
|
1685
|
-
function Be(
|
|
1688
|
+
function Be(a) {
|
|
1686
1689
|
function e(t) {
|
|
1687
|
-
const { record: r, type:
|
|
1688
|
-
switch (
|
|
1690
|
+
const { record: r, type: B = "raw" } = t, A = O({ record: r, dialecteConfig: a });
|
|
1691
|
+
switch (B) {
|
|
1689
1692
|
case "raw":
|
|
1690
|
-
return
|
|
1693
|
+
return A;
|
|
1691
1694
|
case "tracked":
|
|
1692
|
-
return
|
|
1695
|
+
return k({ record: A });
|
|
1693
1696
|
case "tree":
|
|
1694
|
-
return
|
|
1697
|
+
return M({ record: A });
|
|
1695
1698
|
default:
|
|
1696
|
-
throw new Error(`Unsupported record type: ${
|
|
1699
|
+
throw new Error(`Unsupported record type: ${B}`);
|
|
1697
1700
|
}
|
|
1698
1701
|
}
|
|
1699
1702
|
return e;
|
|
1700
1703
|
}
|
|
1701
|
-
const
|
|
1704
|
+
const ue = Be(l);
|
|
1702
1705
|
export {
|
|
1703
|
-
|
|
1706
|
+
Z as DATABASE_CONFIG,
|
|
1704
1707
|
d as DIALECTE_NAMESPACES,
|
|
1705
|
-
|
|
1708
|
+
W as IO_CONFIG,
|
|
1706
1709
|
l as TEST_DIALECTE_CONFIG,
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1710
|
+
_e as XMLNS_DEFAULT_NAMESPACE,
|
|
1711
|
+
se as XMLNS_DEV_NAMESPACE,
|
|
1712
|
+
ce as XMLNS_EXT_NAMESPACE,
|
|
1713
|
+
F as assertExpectedElementQueries,
|
|
1714
|
+
I as assertUnexpectedElementQueries,
|
|
1715
|
+
q as createMockRandomUUID,
|
|
1716
|
+
ie as createTestContext,
|
|
1717
|
+
b as createTestProject,
|
|
1718
|
+
ue as createTestRecord,
|
|
1716
1719
|
Be as createTestRecordFactory,
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1720
|
+
ae as createTestRunner,
|
|
1721
|
+
V as createXmlAssertions,
|
|
1722
|
+
ne as runTestCases,
|
|
1723
|
+
E as splitXpathIntoSteps
|
|
1721
1724
|
};
|