@dialecte/core 0.2.8 → 0.2.10

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.
@@ -1,14 +1,14 @@
1
1
  import { TEST_DIALECTE_CONFIG } from './config';
2
2
  import { Project } from '../project';
3
- import { Document, Context } from '../document';
3
+ import { Document, Context, ExtensionModules } from '../document';
4
4
  import { AnyDialecteConfig, TransactionHooks } from '../types';
5
5
  type TestDialecteConfig = typeof TEST_DIALECTE_CONFIG;
6
6
  export type TestDocument<GenericConfig extends AnyDialecteConfig> = {
7
7
  documentId: string;
8
8
  document: Document<GenericConfig>;
9
9
  };
10
- export type TestProjectResult<GenericConfig extends AnyDialecteConfig> = {
11
- project: Project<GenericConfig>;
10
+ export type TestProjectResult<GenericConfig extends AnyDialecteConfig, GenericModules extends ExtensionModules = Record<never, never>> = {
11
+ project: Project<GenericConfig, GenericModules>;
12
12
  source: TestDocument<GenericConfig>;
13
13
  target?: TestDocument<GenericConfig>;
14
14
  };
@@ -16,12 +16,16 @@ export type TestProjectResult<GenericConfig extends AnyDialecteConfig> = {
16
16
  * Spin up a Project with source (and optionally target) file imported.
17
17
  * Returns project + pre-opened documents. Caller owns lifecycle via project.destroy().
18
18
  */
19
- export declare function createTestProject<GenericConfig extends AnyDialecteConfig = TestDialecteConfig>(params: {
19
+ export declare function createTestProject<GenericConfig extends AnyDialecteConfig = TestDialecteConfig, GenericModules extends ExtensionModules = Record<never, never>>(params: {
20
20
  sourceXml: string;
21
21
  targetXml?: string;
22
22
  dialecteConfig?: GenericConfig;
23
+ extensions?: {
24
+ base?: ExtensionModules;
25
+ custom?: ExtensionModules;
26
+ };
23
27
  hooks?: TransactionHooks<GenericConfig>;
24
- }): Promise<TestProjectResult<GenericConfig>>;
28
+ }): Promise<TestProjectResult<GenericConfig, GenericModules>>;
25
29
  /**
26
30
  * Create a Context directly from a databaseName for testing FP query functions.
27
31
  * Opens the store to discover existing tables.
@@ -1 +1 @@
1
- {"version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E,aAAa,CAAA;IAC9B,UAAU,CAAC,EAAE;QAAE,IAAI,CAAC,EAAE,gBAAgB,CAAC;QAAC,MAAM,CAAC,EAAE,gBAAgB,CAAA;KAAE,CAAA;IACnE,KAAK,CAAC,EAAE,gBAAgB,CAAC,aAAa,CAAC,CAAA;CACvC,GAAG,OAAO,CAAC,iBAAiB,CAAC,aAAa,EAAE,cAAc,CAAC,CAAC,CA+C5D;AAED;;;GAGG;AACH,wBAAsB,iBAAiB,CAAC,aAAa,SAAS,iBAAiB,EAAE,MAAM,EAAE;IACxF,YAAY,EAAE,MAAM,CAAA;IACpB,cAAc,EAAE,aAAa,CAAA;IAC7B,UAAU,EAAE,MAAM,CAAA;CAClB,GAAG,OAAO,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC,CAalC"}
@@ -1,4 +1,5 @@
1
1
  import { TestRunner } from './run-test-cases.type';
2
+ import { ExtensionModules } from '../document';
2
3
  import { AnyDialecteConfig, TransactionHooks } from '../types';
3
4
  export declare function createMockRandomUUID(): () => `${string}-${string}-${string}-${string}-${string}`;
4
5
  export declare const runTestCases: TestRunner<{
@@ -2146,6 +2147,13 @@ export declare const runTestCases: TestRunner<{
2146
2147
  }];
2147
2148
  };
2148
2149
  };
2149
- }>;
2150
- export declare function createTestRunner<GenericConfig extends AnyDialecteConfig>(dialecteConfig: GenericConfig, hooks?: TransactionHooks<GenericConfig>): TestRunner<GenericConfig>;
2150
+ }, Record<never, never>>;
2151
+ export declare function createTestRunner<GenericConfig extends AnyDialecteConfig, GenericModules extends ExtensionModules = Record<never, never>>(params: {
2152
+ dialecteConfig: GenericConfig;
2153
+ hooks?: TransactionHooks<GenericConfig>;
2154
+ extensions?: {
2155
+ base?: ExtensionModules;
2156
+ custom?: ExtensionModules;
2157
+ };
2158
+ }): TestRunner<GenericConfig, GenericModules>;
2151
2159
  //# sourceMappingURL=run-test-cases.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"run-test-cases.d.ts","sourceRoot":"","sources":["../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AAC,EAC7D,MAAM,EAAE;IACT,cAAc,EAAE,aAAa,CAAA;IAC7B,KAAK,CAAC,EAAE,gBAAgB,CAAC,aAAa,CAAC,CAAA;IACvC,UAAU,CAAC,EAAE;QAAE,IAAI,CAAC,EAAE,gBAAgB,CAAC;QAAC,MAAM,CAAC,EAAE,gBAAgB,CAAA;KAAE,CAAA;CACnE,GAAG,UAAU,CAAC,aAAa,EAAE,cAAc,CAAC,CAO5C"}
@@ -1,4 +1,5 @@
1
- import { Document } from '../document';
1
+ import { Document, ExtensionModules } from '../document';
2
+ import { Project } from '../project';
2
3
  import { AnyDialecteConfig, TransactionHooks } from '../types';
3
4
  export type BaseTestCase = {
4
5
  only?: boolean;
@@ -10,8 +11,9 @@ export type BaseXmlTestCase = BaseTestCase & {
10
11
  unexpectedQueries?: string[];
11
12
  };
12
13
  export type TestCases<GenericTestCase extends BaseXmlTestCase> = Record<string, GenericTestCase>;
13
- export type ActParams<GenericConfig extends AnyDialecteConfig, GenericTestCase extends BaseXmlTestCase> = {
14
+ export type ActParams<GenericConfig extends AnyDialecteConfig, GenericTestCase extends BaseXmlTestCase, GenericModules extends ExtensionModules = Record<never, never>> = {
14
15
  testCase: GenericTestCase;
16
+ project: Project<GenericConfig, GenericModules>;
15
17
  source: Document<GenericConfig>;
16
18
  target?: Document<GenericConfig>;
17
19
  };
@@ -19,16 +21,16 @@ export type ActResult = {
19
21
  assertOn?: 'source' | 'target';
20
22
  withDatabaseIds?: boolean;
21
23
  };
22
- export type TestRunner<GenericConfig extends AnyDialecteConfig> = {
24
+ export type TestRunner<GenericConfig extends AnyDialecteConfig, GenericModules extends ExtensionModules = Record<never, never>> = {
23
25
  withExport<GenericTestCase extends BaseXmlTestCase>(params: {
24
26
  testCases: TestCases<GenericTestCase>;
25
- act: (params: ActParams<GenericConfig, GenericTestCase>) => Promise<ActResult | void>;
27
+ act: (params: ActParams<GenericConfig, GenericTestCase, GenericModules>) => Promise<ActResult | void>;
26
28
  dialecteConfig?: GenericConfig;
27
29
  hooks?: TransactionHooks<GenericConfig>;
28
30
  }): void;
29
31
  withoutExport<GenericTestCase extends BaseXmlTestCase>(params: {
30
32
  testCases: TestCases<GenericTestCase>;
31
- act: (params: ActParams<GenericConfig, GenericTestCase>) => Promise<void>;
33
+ act: (params: ActParams<GenericConfig, GenericTestCase, GenericModules>) => Promise<void>;
32
34
  dialecteConfig?: GenericConfig;
33
35
  hooks?: TransactionHooks<GenericConfig>;
34
36
  }): void;
@@ -1 +1 @@
1
- {"version":3,"file":"run-test-cases.type.d.ts","sourceRoot":"","sources":["../../src/test/run-test-cases.type.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AAC1C,OAAO,KAAK,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAA;AAElE,MAAM,MAAM,YAAY,GAAG;IAC1B,IAAI,CAAC,EAAE,OAAO,CAAA;CACd,CAAA;AAED,MAAM,MAAM,eAAe,GAAG,YAAY,GAAG;IAC5C,SAAS,EAAE,MAAM,CAAA;IACjB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,eAAe,CAAC,EAAE,MAAM,EAAE,CAAA;IAC1B,iBAAiB,CAAC,EAAE,MAAM,EAAE,CAAA;CAC5B,CAAA;AAED,MAAM,MAAM,SAAS,CAAC,eAAe,SAAS,eAAe,IAAI,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAA;AAEhG,MAAM,MAAM,SAAS,CACpB,aAAa,SAAS,iBAAiB,EACvC,eAAe,SAAS,eAAe,IACpC;IACH,QAAQ,EAAE,eAAe,CAAA;IACzB,MAAM,EAAE,QAAQ,CAAC,aAAa,CAAC,CAAA;IAC/B,MAAM,CAAC,EAAE,QAAQ,CAAC,aAAa,CAAC,CAAA;CAChC,CAAA;AAED,MAAM,MAAM,SAAS,GAAG;IACvB,QAAQ,CAAC,EAAE,QAAQ,GAAG,QAAQ,CAAA;IAC9B,eAAe,CAAC,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AAC,EAAE,aAAa,CAAA;QAC9B,KAAK,CAAC,EAAE,gBAAgB,CAAC,aAAa,CAAC,CAAA;KACvC,GAAG,IAAI,CAAA;IACR,aAAa,CAAC,eAAe,SAAS,eAAe,EAAE,MAAM,EAAE;QAC9D,SAAS,EAAE,SAAS,CAAC,eAAe,CAAC,CAAA;QACrC,GAAG,EAAE,CAAC,MAAM,EAAE,SAAS,CAAC,aAAa,EAAE,eAAe,EAAE,cAAc,CAAC,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;QACzF,cAAc,CAAC,EAAE,aAAa,CAAA;QAC9B,KAAK,CAAC,EAAE,gBAAgB,CAAC,aAAa,CAAC,CAAA;KACvC,GAAG,IAAI,CAAA;IACR,OAAO,CAAC,eAAe,SAAS,YAAY,EAC3C,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,EAC1C,GAAG,EAAE,CAAC,QAAQ,EAAE,eAAe,KAAK,IAAI,GACtC,IAAI,CAAA;CACP,CAAA"}
package/dist/test.js CHANGED
@@ -1,141 +1,141 @@
1
1
  import { expect as m, it as p } from "vitest";
2
- import { x as D, D as w, P as L } from "./index-1D8DELEq.js";
3
- import { D as T, s as g, o as O, n as M } from "./merge-extensions-dj7By9gG.js";
4
- function v(B) {
5
- const e = k(B);
2
+ import { x as w, D as L, P as T } from "./index-1D8DELEq.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 [B];
7
+ return [a];
8
8
  const t = [];
9
9
  for (const r of e)
10
- t.push(B.slice(0, r));
11
- return t.push(B), t;
10
+ t.push(a.slice(0, r));
11
+ return t.push(a), t;
12
12
  }
13
- function k(B) {
13
+ function R(a) {
14
14
  const e = [];
15
- let t = 0, r = 0, a = null;
16
- for (let C = 0; C < B.length; C++) {
17
- const A = B[C];
18
- if (a) {
19
- A === a && (a = null);
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 (A === '"' || A === "'") {
23
- a = A;
22
+ if (_ === '"' || _ === "'") {
23
+ B = _;
24
24
  continue;
25
25
  }
26
- if (A === "[") {
26
+ if (_ === "[") {
27
27
  t++;
28
28
  continue;
29
29
  }
30
- if (A === "]") {
30
+ if (_ === "]") {
31
31
  t--;
32
32
  continue;
33
33
  }
34
- if (A === "(") {
34
+ if (_ === "(") {
35
35
  r++;
36
36
  continue;
37
37
  }
38
- if (A === ")") {
38
+ if (_ === ")") {
39
39
  r--;
40
40
  continue;
41
41
  }
42
- if (!(t > 0 || r > 0) && A === "/") {
43
- if (C === 0) {
44
- B[C + 1] === "/" && C++;
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 && C === 1 && B[0] === "/")
47
+ if (e.length === 0 && A === 1 && a[0] === "/")
48
48
  continue;
49
- e.push(C), B[C + 1] === "/" && C++;
49
+ e.push(A), a[A + 1] === "/" && A++;
50
50
  }
51
51
  }
52
52
  return e;
53
53
  }
54
- function R(B) {
55
- const { namespaces: e } = B, t = F(e);
54
+ function V(a) {
55
+ const { namespaces: e } = a, t = y(e);
56
56
  return {
57
57
  assertExpectedElementQueries(r) {
58
- V({ ...r, nsResolver: t });
58
+ F({ ...r, nsResolver: t });
59
59
  },
60
60
  assertUnexpectedElementQueries(r) {
61
- y({ ...r, nsResolver: t });
61
+ I({ ...r, nsResolver: t });
62
62
  }
63
63
  };
64
64
  }
65
- function V(B) {
66
- const { xmlDocument: e, queries: t, nsResolver: r } = B;
67
- for (const a of t)
68
- I({ xmlDocument: e, xpath: a, nsResolver: r });
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 F(B) {
71
- return (e) => e ? B[e]?.uri ?? null : null;
70
+ function y(a) {
71
+ return (e) => e ? a[e]?.uri ?? null : null;
72
72
  }
73
- function y(B) {
74
- const { xmlDocument: e, queries: t, nsResolver: r } = B;
75
- for (const a of t)
76
- U({ xmlDocument: e, xpath: a, nsResolver: r });
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 I(B) {
79
- const { xmlDocument: e, xpath: t, nsResolver: r } = B, a = v(t);
80
- let C = null, A = 0;
81
- for (let s = 0; s < a.length; s++) {
82
- const _ = a[s], c = e.evaluate(
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 (c) {
90
- C = c, A = s + 1;
89
+ if (n) {
90
+ A = n, _ = C + 1;
91
91
  continue;
92
92
  }
93
- const n = s === 0 ? a[0] : t.slice(a[s - 1].length), u = A === 0 ? `[No parent matched — failed from document root]
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 ${A}/${a.length}]:
96
- ${C ? x({ xml: C.outerHTML }) : "(none)"}`;
95
+ ${x({ xml: new XMLSerializer().serializeToString(e) })}` : `[Last match at step ${_}/${B.length}]:
96
+ ${A ? x({ xml: A.outerHTML }) : "(none)"}`;
97
97
  m(
98
- c,
98
+ n,
99
99
  `Element not found in XML.
100
- Failed at step ${s + 1}/${a.length}: ${n.trim()}
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(B) {
108
- const { xml: e } = B;
107
+ function x(a) {
108
+ const { xml: e } = a;
109
109
  try {
110
- return D(e, { indentation: " ", collapseContent: !0 });
110
+ return w(e, { indentation: " ", collapseContent: !0 });
111
111
  } catch {
112
112
  return e;
113
113
  }
114
114
  }
115
- function U(B) {
116
- const { xmlDocument: e, xpath: t, nsResolver: r } = B, a = v(t);
117
- if (a.length > 1) {
118
- let s = null;
119
- for (let _ = 0; _ < a.length - 1; _++) {
120
- const i = a[_], n = e.evaluate(
121
- i,
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 = _ === 0 ? a[0] : t.slice(a[_ - 1].length), o = _ === 0 ? "[Document root — no parent context]" : `[Parent element found at step ${_}]:
127
- ${s ? x({ xml: s.outerHTML }) : "(none)"}`;
126
+ ).singleNodeValue, u = s === 0 ? B[0] : t.slice(B[s - 1].length), l = s === 0 ? "[Document root — no parent context]" : `[Parent element found at step ${s}]:
127
+ ${C ? x({ xml: C.outerHTML }) : "(none)"}`;
128
128
  m(
129
- n,
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 ${_ + 1}/${a.length}: ${u.trim()}
132
+ Missing at step ${s + 1}/${B.length}: ${u.trim()}
133
133
  Full XPath: ${t}
134
- ${o}`
135
- ).toBeTruthy(), s = n;
134
+ ${l}`
135
+ ).toBeTruthy(), C = i;
136
136
  }
137
137
  }
138
- const A = e.evaluate(
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
- A,
146
+ _,
147
147
  `Element should NOT exist in XML but was found.
148
148
  XPath: ${t}
149
149
  Found:
150
- ${A ? x({ xml: A.outerHTML }) : "(none)"}`
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: T,
158
+ dev: g,
159
159
  ext: {
160
160
  uri: "http://dialecte.dev/XML/DEV-EXT",
161
161
  prefix: "ext"
162
162
  }
163
- }, Ce = `xmlns="${d.default.uri}"`, _e = `xmlns:${d.dev.prefix}="${d.dev.uri}"`, se = `xmlns:${d.ext.prefix}="${d.ext.uri}"`, N = [
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
- }, P = {
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
- }, Q = {
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
- }, j = {
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
- }, z = "Root", G = ["A", "AA_1", "B", "BB_1", "C", "CC_1", "CC_2", "Root"], H = {
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: "",
@@ -508,7 +508,7 @@ const d = {
508
508
  "ext:root": "",
509
509
  root: ""
510
510
  }
511
- }, Y = {
511
+ }, K = {
512
512
  A: {
513
513
  tag: "A",
514
514
  namespace: { prefix: "", uri: "http://dialecte.dev/XML/DEFAULT" },
@@ -1533,9 +1533,9 @@ const d = {
1533
1533
  }
1534
1534
  ]
1535
1535
  }
1536
- }, K = {
1537
- supportedFileExtensions: [".xml"]
1538
1536
  }, W = {
1537
+ supportedFileExtensions: [".xml"]
1538
+ }, Z = {
1539
1539
  recordSchema: {
1540
1540
  primaryKey: "id",
1541
1541
  indexes: ["tagName", "parent.id", "parent.tagName"],
@@ -1549,168 +1549,180 @@ const d = {
1549
1549
  schema: "id, tagName, [id+tagName], parent.id, parent.tagName, *children.id, *children.tagName"
1550
1550
  }
1551
1551
  }
1552
- }, l = {
1553
- rootElementName: z,
1554
- singletonElements: G,
1555
- elements: N,
1552
+ }, o = {
1553
+ rootElementName: G,
1554
+ singletonElements: H,
1555
+ elements: $,
1556
1556
  namespaces: d,
1557
- attributes: H,
1558
- children: $,
1559
- parents: P,
1560
- descendants: Q,
1561
- ancestors: j,
1562
- database: W,
1563
- io: K,
1564
- definition: Y
1557
+ attributes: Y,
1558
+ children: P,
1559
+ parents: Q,
1560
+ descendants: j,
1561
+ ancestors: z,
1562
+ database: Z,
1563
+ io: W,
1564
+ definition: K
1565
1565
  };
1566
- async function E(B) {
1566
+ async function b(a) {
1567
1567
  const {
1568
1568
  sourceXml: e,
1569
1569
  targetXml: t,
1570
- dialecteConfig: r = l,
1571
- hooks: a
1572
- } = B, C = `test-${crypto.randomUUID()}`, A = await new L({
1570
+ dialecteConfig: r = o,
1571
+ extensions: B,
1572
+ hooks: A
1573
+ } = a, _ = `test-${crypto.randomUUID()}`, C = await new T({
1573
1574
  configs: { default: r },
1574
1575
  defaultConfigKey: "default",
1575
1576
  storage: { type: "local" },
1576
- hooks: a
1577
- }).open(C), [s] = await A.import(
1577
+ extensions: B,
1578
+ hooks: A
1579
+ }).open(_), [s] = await C.import(
1578
1580
  [new File([e], "source.xml", { type: "text/xml" })],
1579
1581
  { useCustomRecordsIds: !0 }
1580
- ), _ = {
1582
+ ), c = {
1581
1583
  documentId: s.documentId,
1582
- document: A.openDocument(s.documentId)
1584
+ document: C.openDocument(s.documentId)
1583
1585
  };
1584
- let i;
1586
+ let n;
1585
1587
  if (t) {
1586
- const [c] = await A.import(
1588
+ const [i] = await C.import(
1587
1589
  [new File([t], "target.xml", { type: "text/xml" })],
1588
1590
  { useCustomRecordsIds: !0 }
1589
1591
  );
1590
- i = {
1591
- documentId: c.documentId,
1592
- document: A.openDocument(c.documentId)
1592
+ n = {
1593
+ documentId: i.documentId,
1594
+ document: C.openDocument(i.documentId)
1593
1595
  };
1594
1596
  }
1595
- return { project: A, source: _, target: i };
1597
+ return { project: C, source: c, target: n };
1596
1598
  }
1597
- async function ce(B) {
1598
- const { databaseName: e, dialecteConfig: t, documentId: r } = B, a = new w(e, {
1599
+ async function ie(a) {
1600
+ const { databaseName: e, dialecteConfig: t, documentId: r } = a, B = new L(e, {
1599
1601
  recordSchema: t.database.recordSchema
1600
1602
  });
1601
- return await a.open(), {
1603
+ return await B.open(), {
1602
1604
  dialecteConfig: t,
1603
- store: a,
1605
+ store: B,
1604
1606
  documentId: r,
1605
1607
  recordCache: /* @__PURE__ */ new Map(),
1606
1608
  stagedOperations: []
1607
1609
  };
1608
1610
  }
1609
- const b = crypto.randomUUID.bind(crypto);
1610
- function X() {
1611
- let B = 0;
1611
+ const X = crypto.randomUUID.bind(crypto);
1612
+ function q() {
1613
+ let a = 0;
1612
1614
  return function() {
1613
- return `${B++}`;
1615
+ return `${a++}`;
1614
1616
  };
1615
1617
  }
1616
- function Z(B) {
1618
+ function J(a) {
1617
1619
  const {
1618
1620
  testCases: e,
1619
1621
  act: t,
1620
- hooks: r,
1621
- dialecteConfig: a = l
1622
- } = B, { assertExpectedElementQueries: C, assertUnexpectedElementQueries: A } = R({
1623
- namespaces: a.namespaces
1622
+ extensions: r,
1623
+ hooks: B,
1624
+ dialecteConfig: A = o
1625
+ } = a, { assertExpectedElementQueries: _, assertUnexpectedElementQueries: C } = V({
1626
+ namespaces: A.namespaces
1624
1627
  });
1625
- for (const [s, _] of Object.entries(e))
1626
- (_.only ? p.only : p)(s, async () => {
1627
- crypto.randomUUID = b;
1628
- const { project: c, source: n, target: u } = await E({
1629
- sourceXml: _.sourceXml,
1630
- targetXml: _.targetXml,
1631
- dialecteConfig: a,
1632
- hooks: r
1628
+ for (const [s, c] of Object.entries(e))
1629
+ (c.only ? p.only : p)(s, async () => {
1630
+ crypto.randomUUID = X;
1631
+ const { project: i, source: u, target: l } = await b({
1632
+ sourceXml: c.sourceXml,
1633
+ targetXml: c.targetXml,
1634
+ dialecteConfig: A,
1635
+ extensions: r,
1636
+ hooks: B
1633
1637
  });
1634
1638
  try {
1635
- crypto.randomUUID = X();
1636
- const o = await t({ testCase: _, source: n.document, target: u?.document }), q = o?.assertOn ?? "source", S = o?.withDatabaseIds ?? !0, f = q === "target" ? u?.documentId : n.documentId;
1637
- if (!f) throw new Error("documentId required for export");
1638
- const { xmlDocument: h } = await c.export(f, { withDatabaseIds: S });
1639
- _.expectedQueries?.length && C({ xmlDocument: h, queries: _.expectedQueries }), _.unexpectedQueries?.length && A({ xmlDocument: h, queries: _.unexpectedQueries });
1639
+ crypto.randomUUID = q();
1640
+ const f = await t({
1641
+ testCase: c,
1642
+ project: i,
1643
+ source: u.document,
1644
+ target: l?.document
1645
+ }), S = f?.assertOn ?? "source", D = f?.withDatabaseIds ?? !0, h = S === "target" ? l?.documentId : u.documentId;
1646
+ if (!h) throw new Error("documentId required for export");
1647
+ const { xmlDocument: v } = await i.export(h, { withDatabaseIds: D });
1648
+ c.expectedQueries?.length && _({ xmlDocument: v, queries: c.expectedQueries }), c.unexpectedQueries?.length && C({ xmlDocument: v, queries: c.unexpectedQueries });
1640
1649
  } finally {
1641
- await c.destroy();
1650
+ await i.destroy();
1642
1651
  }
1643
1652
  });
1644
1653
  }
1645
- function J(B) {
1654
+ function ee(a) {
1646
1655
  const {
1647
1656
  testCases: e,
1648
1657
  act: t,
1649
- hooks: r,
1650
- dialecteConfig: a = l
1651
- } = B;
1652
- for (const [C, A] of Object.entries(e))
1653
- (A.only ? p.only : p)(C, async () => {
1654
- crypto.randomUUID = b;
1655
- const { project: _, source: i, target: c } = await E({
1656
- sourceXml: A.sourceXml,
1657
- targetXml: A.targetXml,
1658
- dialecteConfig: a,
1659
- hooks: r
1658
+ extensions: r,
1659
+ hooks: B,
1660
+ dialecteConfig: A = o
1661
+ } = a;
1662
+ for (const [_, C] of Object.entries(e))
1663
+ (C.only ? p.only : p)(_, async () => {
1664
+ crypto.randomUUID = X;
1665
+ const { project: c, source: n, target: i } = await b({
1666
+ sourceXml: C.sourceXml,
1667
+ targetXml: C.targetXml,
1668
+ dialecteConfig: A,
1669
+ extensions: r,
1670
+ hooks: B
1660
1671
  });
1661
1672
  try {
1662
- crypto.randomUUID = X(), await t({ testCase: A, source: i.document, target: c?.document });
1673
+ crypto.randomUUID = q(), await t({ testCase: C, project: c, source: n.document, target: i?.document });
1663
1674
  } finally {
1664
- await _.destroy();
1675
+ await c.destroy();
1665
1676
  }
1666
1677
  });
1667
1678
  }
1668
- function ee(B, e) {
1669
- for (const [t, r] of Object.entries(B))
1679
+ function te(a, e) {
1680
+ for (const [t, r] of Object.entries(a))
1670
1681
  (r.only ? p.only : p)(t, () => e(r));
1671
1682
  }
1672
- const ie = te(l);
1673
- function te(B, e) {
1683
+ const ne = ae({ dialecteConfig: o });
1684
+ function ae(a) {
1685
+ const { dialecteConfig: e, hooks: t, extensions: r } = a;
1674
1686
  return {
1675
- withExport: (t) => Z({ dialecteConfig: B, hooks: e, ...t }),
1676
- withoutExport: (t) => J({ dialecteConfig: B, hooks: e, ...t }),
1677
- generic: ee
1687
+ withExport: (B) => J({ dialecteConfig: e, extensions: r, hooks: t, ...B }),
1688
+ withoutExport: (B) => ee({ dialecteConfig: e, extensions: r, hooks: t, ...B }),
1689
+ generic: te
1678
1690
  };
1679
1691
  }
1680
- function Be(B) {
1692
+ function Be(a) {
1681
1693
  function e(t) {
1682
- const { record: r, type: a = "raw" } = t, C = g({ record: r, dialecteConfig: B });
1683
- switch (a) {
1694
+ const { record: r, type: B = "raw" } = t, A = O({ record: r, dialecteConfig: a });
1695
+ switch (B) {
1684
1696
  case "raw":
1685
- return C;
1697
+ return A;
1686
1698
  case "tracked":
1687
- return M({ record: C });
1699
+ return k({ record: A });
1688
1700
  case "tree":
1689
- return O({ record: C });
1701
+ return M({ record: A });
1690
1702
  default:
1691
- throw new Error(`Unsupported record type: ${a}`);
1703
+ throw new Error(`Unsupported record type: ${B}`);
1692
1704
  }
1693
1705
  }
1694
1706
  return e;
1695
1707
  }
1696
- const ne = Be(l);
1708
+ const ue = Be(o);
1697
1709
  export {
1698
- W as DATABASE_CONFIG,
1710
+ Z as DATABASE_CONFIG,
1699
1711
  d as DIALECTE_NAMESPACES,
1700
- K as IO_CONFIG,
1701
- l as TEST_DIALECTE_CONFIG,
1702
- Ce as XMLNS_DEFAULT_NAMESPACE,
1703
- _e as XMLNS_DEV_NAMESPACE,
1704
- se as XMLNS_EXT_NAMESPACE,
1705
- V as assertExpectedElementQueries,
1706
- y as assertUnexpectedElementQueries,
1707
- X as createMockRandomUUID,
1708
- ce as createTestContext,
1709
- E as createTestProject,
1710
- ne as createTestRecord,
1712
+ W as IO_CONFIG,
1713
+ o as TEST_DIALECTE_CONFIG,
1714
+ _e as XMLNS_DEFAULT_NAMESPACE,
1715
+ se as XMLNS_DEV_NAMESPACE,
1716
+ ce as XMLNS_EXT_NAMESPACE,
1717
+ F as assertExpectedElementQueries,
1718
+ I as assertUnexpectedElementQueries,
1719
+ q as createMockRandomUUID,
1720
+ ie as createTestContext,
1721
+ b as createTestProject,
1722
+ ue as createTestRecord,
1711
1723
  Be as createTestRecordFactory,
1712
- te as createTestRunner,
1713
- R as createXmlAssertions,
1714
- ie as runTestCases,
1715
- v as splitXpathIntoSteps
1724
+ ae as createTestRunner,
1725
+ V as createXmlAssertions,
1726
+ ne as runTestCases,
1727
+ E as splitXpathIntoSteps
1716
1728
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dialecte/core",
3
- "version": "0.2.8",
3
+ "version": "0.2.10",
4
4
  "description": "Dialecte - Core functionality for Dialecte SDK",
5
5
  "license": "MIT",
6
6
  "repository": {