@dialecte/core 0.1.3 → 0.1.5
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/dialecte/main.d.ts +4 -3
- package/dist/dialecte/main.d.ts.map +1 -1
- package/dist/document/bind-extensions.d.ts +10 -0
- package/dist/document/bind-extensions.d.ts.map +1 -0
- package/dist/document/document.d.ts +10 -6
- package/dist/document/document.d.ts.map +1 -1
- package/dist/document/query/find/ancestor/find-ancestor.d.ts +17 -0
- package/dist/document/query/find/ancestor/find-ancestor.d.ts.map +1 -0
- package/dist/document/query/find/ancestor/find-ancestor.types.d.ts +6 -0
- package/dist/document/query/find/ancestor/find-ancestor.types.d.ts.map +1 -0
- package/dist/document/query/find/ancestor/index.d.ts +3 -0
- package/dist/document/query/find/ancestor/index.d.ts.map +1 -0
- package/dist/document/query/find/index.d.ts +1 -0
- package/dist/document/query/find/index.d.ts.map +1 -1
- package/dist/document/query/get/record/get-child.d.ts +13 -0
- package/dist/document/query/get/record/get-child.d.ts.map +1 -0
- package/dist/document/query/get/record/get-children.d.ts +13 -0
- package/dist/document/query/get/record/get-children.d.ts.map +1 -0
- package/dist/document/query/get/record/get-record.d.ts +2 -2
- package/dist/document/query/get/record/get-record.d.ts.map +1 -1
- package/dist/document/query/get/record/get-records.d.ts +2 -2
- package/dist/document/query/get/record/get-records.d.ts.map +1 -1
- package/dist/document/query/get/record/index.d.ts +2 -0
- package/dist/document/query/get/record/index.d.ts.map +1 -1
- package/dist/document/query/main.d.ts +56 -16
- package/dist/document/query/main.d.ts.map +1 -1
- package/dist/document/transaction/clone/clone.d.ts.map +1 -1
- package/dist/document/transaction/clone/clone.types.d.ts +2 -2
- package/dist/document/transaction/clone/clone.types.d.ts.map +1 -1
- package/dist/document/transaction/create/create.d.ts +2 -2
- package/dist/document/transaction/create/create.d.ts.map +1 -1
- package/dist/document/transaction/delete/delete.d.ts +2 -2
- package/dist/document/transaction/delete/delete.d.ts.map +1 -1
- package/dist/document/transaction/ensure/ensure.d.ts +24 -0
- package/dist/document/transaction/ensure/ensure.d.ts.map +1 -0
- package/dist/document/transaction/ensure/index.d.ts +2 -0
- package/dist/document/transaction/ensure/index.d.ts.map +1 -0
- package/dist/document/transaction/main.d.ts +39 -17
- package/dist/document/transaction/main.d.ts.map +1 -1
- package/dist/document/transaction/update/update.d.ts +2 -2
- package/dist/document/transaction/update/update.d.ts.map +1 -1
- package/dist/document/types.d.ts +3 -7
- package/dist/document/types.d.ts.map +1 -1
- package/dist/helpers/guard.d.ts +20 -1
- package/dist/helpers/guard.d.ts.map +1 -1
- package/dist/helpers/index.d.ts +1 -0
- package/dist/helpers/index.d.ts.map +1 -1
- package/dist/helpers/merge-extensions.d.ts +13 -0
- package/dist/helpers/merge-extensions.d.ts.map +1 -0
- package/dist/helpers.js +22 -124
- package/dist/{index-ni-jr0mc.js → index-Cl4q6wr5.js} +2384 -2233
- package/dist/index.js +26 -23
- package/dist/standardizing-27Zk5ECm.js +136 -0
- package/dist/{test-fixtures → test}/assert-xml/assert-xml.d.ts +1 -1
- package/dist/test/assert-xml/assert-xml.d.ts.map +1 -0
- package/dist/test/assert-xml/index.d.ts.map +1 -0
- package/dist/test/assert-xml/types.d.ts.map +1 -0
- package/dist/test/assert-xml/xpath-parser.d.ts.map +1 -0
- package/dist/test/config.d.ts +2109 -0
- package/dist/{test-fixtures/test-record.d.ts.map → test/config.d.ts.map} +1 -1
- package/dist/test/constant.d.ts.map +1 -0
- package/dist/{test-fixtures → test}/create-test-dialecte.d.ts +0 -3
- package/dist/test/create-test-dialecte.d.ts.map +1 -0
- package/dist/{test-fixtures → test}/generated/constants.generated.d.ts +105 -121
- package/dist/test/generated/constants.generated.d.ts.map +1 -0
- package/dist/test/generated/definition.generated.d.ts +1901 -0
- package/dist/test/generated/definition.generated.d.ts.map +1 -0
- package/dist/test/generated/index.d.ts +4 -0
- package/dist/test/generated/index.d.ts.map +1 -0
- package/dist/{test-fixtures → test}/generated/types.generated.d.ts +52 -53
- package/dist/test/generated/types.generated.d.ts.map +1 -0
- package/dist/{test-fixtures → test}/index.d.ts +2 -0
- package/dist/test/index.d.ts.map +1 -0
- package/dist/test/run-test-cases.d.ts +12 -0
- package/dist/test/run-test-cases.d.ts.map +1 -0
- package/dist/test/run-test-cases.type.d.ts +24 -0
- package/dist/test/run-test-cases.type.d.ts.map +1 -0
- package/dist/test/test-record.d.ts +16804 -0
- package/dist/test/test-record.d.ts.map +1 -0
- package/dist/test/test-record.types.d.ts.map +1 -0
- package/dist/test.d.ts +1 -1
- package/dist/test.js +1494 -12226
- package/dist/types/definition.d.ts +67 -50
- package/dist/types/definition.d.ts.map +1 -1
- package/dist/types/extensions.d.ts +73 -0
- package/dist/types/extensions.d.ts.map +1 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/ref.d.ts +0 -1
- package/dist/types/ref.d.ts.map +1 -1
- package/package.json +2 -1
- package/dist/document/query/main.types.d.ts +0 -22
- package/dist/document/query/main.types.d.ts.map +0 -1
- package/dist/magic-string.es-uPKorP4O.js +0 -663
- package/dist/script/generate-test-fixtures.d.ts +0 -16
- package/dist/script/generate-test-fixtures.d.ts.map +0 -1
- package/dist/test-fixtures/assert-xml/assert-xml.d.ts.map +0 -1
- package/dist/test-fixtures/assert-xml/index.d.ts.map +0 -1
- package/dist/test-fixtures/assert-xml/types.d.ts.map +0 -1
- package/dist/test-fixtures/assert-xml/xpath-parser.d.ts.map +0 -1
- package/dist/test-fixtures/config.d.ts +0 -210
- package/dist/test-fixtures/config.d.ts.map +0 -1
- package/dist/test-fixtures/constant.d.ts.map +0 -1
- package/dist/test-fixtures/create-test-dialecte.d.ts.map +0 -1
- package/dist/test-fixtures/generated/constants.generated.d.ts.map +0 -1
- package/dist/test-fixtures/generated/definition.d.ts +0 -3
- package/dist/test-fixtures/generated/definition.d.ts.map +0 -1
- package/dist/test-fixtures/generated/index.d.ts +0 -4
- package/dist/test-fixtures/generated/index.d.ts.map +0 -1
- package/dist/test-fixtures/generated/types.generated.d.ts.map +0 -1
- package/dist/test-fixtures/index.d.ts.map +0 -1
- package/dist/test-fixtures/test-record.d.ts +0 -1612
- package/dist/test-fixtures/test-record.types.d.ts.map +0 -1
- /package/dist/{test-fixtures → test}/assert-xml/index.d.ts +0 -0
- /package/dist/{test-fixtures → test}/assert-xml/types.d.ts +0 -0
- /package/dist/{test-fixtures → test}/assert-xml/xpath-parser.d.ts +0 -0
- /package/dist/{test-fixtures → test}/constant.d.ts +0 -0
- /package/dist/{test-fixtures → test}/test-record.types.d.ts +0 -0
package/dist/index.js
CHANGED
|
@@ -1,34 +1,37 @@
|
|
|
1
|
-
import { D as s, a, Q as r, T as
|
|
2
|
-
import { E as
|
|
1
|
+
import { D as s, a, Q as r, T as i, b as o, c as l, d, f as c, g as u, h as b, e as n, j as A, k as g, l as m, m as D, n as R, p, q as T, r as f, s as E, t as x, u as F, v as h, w as k, y as B, z as C, i as _, A as y, B as I, C as O, o as j } from "./index-Cl4q6wr5.js";
|
|
2
|
+
import { E as U, t as X } from "./index-CqwLClK7.js";
|
|
3
3
|
export {
|
|
4
4
|
s as DexieStore,
|
|
5
5
|
a as Document,
|
|
6
|
-
|
|
6
|
+
U as ERROR_CATALOG,
|
|
7
7
|
r as Query,
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
i as TEMP_IDB_ID_ATTRIBUTE_NAME,
|
|
9
|
+
o as Transaction,
|
|
10
10
|
l as bulkAddRecords,
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
d as bulkDeleteRecords,
|
|
12
|
+
c as bulkUpdateRecordAttributes,
|
|
13
|
+
u as bulkUpdateRecords,
|
|
14
14
|
b as deleteDatabaseIfExists,
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
n as exportXmlFile,
|
|
16
|
+
A as findAncestors,
|
|
17
|
+
g as findByAttributes,
|
|
18
|
+
m as findDescendants,
|
|
18
19
|
D as formatXml,
|
|
19
20
|
R as getAttribute,
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
k as
|
|
21
|
+
p as getAttributeFullObject,
|
|
22
|
+
T as getAttributes,
|
|
23
|
+
f as getAttributesFullObject,
|
|
24
|
+
E as getChild,
|
|
25
|
+
x as getChildren,
|
|
26
|
+
F as getDatabaseName,
|
|
27
|
+
h as getRecord,
|
|
28
|
+
k as getRecords,
|
|
29
|
+
B as getRecordsByTagName,
|
|
30
|
+
C as getTree,
|
|
28
31
|
_ as importXmlFiles,
|
|
29
32
|
y as isFileSupported,
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
33
|
+
I as isTransactionContext,
|
|
34
|
+
O as matchesAttributeFilter,
|
|
35
|
+
j as openDialecteDocument,
|
|
36
|
+
X as throwDialecteError
|
|
34
37
|
};
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import { a as D } from "./index-CqwLClK7.js";
|
|
2
|
+
const _ = "db-id", C = {
|
|
3
|
+
uri: "http://dialecte.dev/XML/DEV",
|
|
4
|
+
prefix: "dev"
|
|
5
|
+
}, z = `${C.prefix}:${_}`, m = [
|
|
6
|
+
"id",
|
|
7
|
+
"tagName",
|
|
8
|
+
"namespace",
|
|
9
|
+
"attributes",
|
|
10
|
+
"children",
|
|
11
|
+
"parent",
|
|
12
|
+
"value"
|
|
13
|
+
], R = [...m, "status"], O = [...R, "tree"];
|
|
14
|
+
function u(e, t) {
|
|
15
|
+
if (typeof e != "object" || e === null)
|
|
16
|
+
return !1;
|
|
17
|
+
const n = Object.keys(e);
|
|
18
|
+
return t.every((a) => a in e) && n.every((a) => t.includes(a)) && n.length === t.length;
|
|
19
|
+
}
|
|
20
|
+
function S(e) {
|
|
21
|
+
return Array.isArray(e);
|
|
22
|
+
}
|
|
23
|
+
function j(e) {
|
|
24
|
+
return u(e, m);
|
|
25
|
+
}
|
|
26
|
+
function F(e) {
|
|
27
|
+
return u(e, R);
|
|
28
|
+
}
|
|
29
|
+
function K(e) {
|
|
30
|
+
return u(e, O);
|
|
31
|
+
}
|
|
32
|
+
function V(e, t) {
|
|
33
|
+
return e.tagName === t;
|
|
34
|
+
}
|
|
35
|
+
function Y(e, t) {
|
|
36
|
+
return e.tagName === t;
|
|
37
|
+
}
|
|
38
|
+
function w(e, t) {
|
|
39
|
+
return e.tagName === t;
|
|
40
|
+
}
|
|
41
|
+
function y(e) {
|
|
42
|
+
return {
|
|
43
|
+
id: e.id,
|
|
44
|
+
tagName: e.tagName,
|
|
45
|
+
namespace: e.namespace,
|
|
46
|
+
attributes: e.attributes,
|
|
47
|
+
value: e.value,
|
|
48
|
+
parent: e.parent,
|
|
49
|
+
children: e.children
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
function I(e) {
|
|
53
|
+
const { record: t, status: n } = e, a = n ?? ("status" in t ? t.status : "unchanged");
|
|
54
|
+
return {
|
|
55
|
+
...y(t),
|
|
56
|
+
status: a
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
function B(e) {
|
|
60
|
+
const { record: t, status: n, tree: a } = e, r = a ?? ("tree" in t ? t.tree : []);
|
|
61
|
+
return {
|
|
62
|
+
...I({ record: t, status: n }),
|
|
63
|
+
tree: r
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
function x(e) {
|
|
67
|
+
const { dialecteConfig: t, tagName: n, attributes: a } = e;
|
|
68
|
+
return S(a) ? a : Object.entries(a).map(
|
|
69
|
+
([r, i]) => ({
|
|
70
|
+
name: r,
|
|
71
|
+
value: i,
|
|
72
|
+
namespace: t.definition[n]?.attributes.details[r]?.namespace || void 0
|
|
73
|
+
})
|
|
74
|
+
);
|
|
75
|
+
}
|
|
76
|
+
function L(e) {
|
|
77
|
+
return D(e, {
|
|
78
|
+
detail: "The record or ref is undefined"
|
|
79
|
+
}), {
|
|
80
|
+
id: e.id,
|
|
81
|
+
tagName: e.tagName
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
function P(e) {
|
|
85
|
+
const { dialecteConfig: t, record: n } = e, { id: a, tagName: r, attributes: i, namespace: E, value: b } = n, A = a ?? crypto.randomUUID(), c = i ? x({ tagName: r, attributes: i, dialecteConfig: t }) : [], l = {
|
|
86
|
+
id: A,
|
|
87
|
+
tagName: r,
|
|
88
|
+
attributes: c,
|
|
89
|
+
namespace: E ?? {
|
|
90
|
+
prefix: "prefixNeededForNotSupportedNamespace",
|
|
91
|
+
uri: "uriNeededForNotSupportedNamespace"
|
|
92
|
+
},
|
|
93
|
+
value: b ?? "",
|
|
94
|
+
parent: n.parent ?? null,
|
|
95
|
+
children: n.children ?? []
|
|
96
|
+
};
|
|
97
|
+
if (!t.elements.includes(r)) return l;
|
|
98
|
+
const f = t.definition[r].attributes.sequence, o = t.definition[r].attributes.details, T = f.flatMap((s) => {
|
|
99
|
+
const N = o[s].required, h = o[s]?.namespace || void 0, p = c.find((v) => v.name === s)?.value || (N ? o[s]?.default || "" : void 0);
|
|
100
|
+
return p === void 0 ? [] : [
|
|
101
|
+
{
|
|
102
|
+
name: s,
|
|
103
|
+
value: p,
|
|
104
|
+
namespace: h
|
|
105
|
+
}
|
|
106
|
+
];
|
|
107
|
+
}), g = c.filter(
|
|
108
|
+
(s) => "namespace" in s && s.namespace != null && !f.includes(s.name)
|
|
109
|
+
);
|
|
110
|
+
let d = {
|
|
111
|
+
...l,
|
|
112
|
+
namespace: t.definition[r].namespace,
|
|
113
|
+
attributes: [...T, ...g]
|
|
114
|
+
};
|
|
115
|
+
return t.hooks?.afterStandardizedRecord && (d = t.hooks.afterStandardizedRecord({
|
|
116
|
+
record: d
|
|
117
|
+
})), d;
|
|
118
|
+
}
|
|
119
|
+
export {
|
|
120
|
+
z as C,
|
|
121
|
+
C as D,
|
|
122
|
+
_ as a,
|
|
123
|
+
S as b,
|
|
124
|
+
w as c,
|
|
125
|
+
j as d,
|
|
126
|
+
V as e,
|
|
127
|
+
F as f,
|
|
128
|
+
K as g,
|
|
129
|
+
y as h,
|
|
130
|
+
Y as i,
|
|
131
|
+
L as j,
|
|
132
|
+
I as k,
|
|
133
|
+
B as l,
|
|
134
|
+
P as s,
|
|
135
|
+
x as t
|
|
136
|
+
};
|
|
@@ -3,7 +3,7 @@ import { Namespace } from '../../types';
|
|
|
3
3
|
/**
|
|
4
4
|
* Creates a pair of assertion functions pre-configured with a namespace resolver
|
|
5
5
|
* derived from a prefix → URI map. Intended to be instantiated once per dialecte
|
|
6
|
-
* (e.g. in scl test
|
|
6
|
+
* (e.g. in scl test) and re-exported alongside createTestDialecte.
|
|
7
7
|
*/
|
|
8
8
|
export declare function createXmlAssertions(params: {
|
|
9
9
|
namespaces: Record<string, Namespace>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"assert-xml.d.ts","sourceRoot":"","sources":["../../../src/test/assert-xml/assert-xml.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AACzC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA;AAExC;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE;IAAE,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAA;CAAE;yCAK9C;QAAE,WAAW,EAAE,WAAW,CAAC;QAAC,OAAO,EAAE,MAAM,EAAE,CAAA;KAAE;2CAG7C;QAAE,WAAW,EAAE,WAAW,CAAC;QAAC,OAAO,EAAE,MAAM,EAAE,CAAA;KAAE;EAIvF;AACD;;;;GAIG;AACH,wBAAgB,4BAA4B,CAAC,MAAM,EAAE;IACpD,WAAW,EAAE,WAAW,CAAA;IACxB,OAAO,EAAE,MAAM,EAAE,CAAA;IACjB,UAAU,CAAC,EAAE,UAAU,CAAA;CACvB,QAKA;AAWD;;;;;;;;;;GAUG;AACH,wBAAgB,8BAA8B,CAAC,MAAM,EAAE;IACtD,WAAW,EAAE,WAAW,CAAA;IACxB,OAAO,EAAE,MAAM,EAAE,CAAA;IACjB,UAAU,CAAC,EAAE,UAAU,CAAA;CACvB,QAKA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/test/assert-xml/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,4BAA4B,EAC5B,8BAA8B,EAC9B,mBAAmB,GACnB,MAAM,cAAc,CAAA;AACrB,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/test/assert-xml/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,UAAU,GAAG,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,KAAK,MAAM,GAAG,IAAI,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"xpath-parser.d.ts","sourceRoot":"","sources":["../../../src/test/assert-xml/xpath-parser.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,CAa3D"}
|