@dialecte/core 0.2.17 → 0.2.19
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/helpers/constant.d.ts +1 -0
- package/dist/helpers/constant.d.ts.map +1 -1
- package/dist/helpers.js +30 -30
- package/dist/index.js +1 -1
- package/dist/{project-BLDf8nj6.js → project-B6LoveZA.js} +3 -2
- package/dist/test.js +1 -1
- package/dist/xml/inspect-xml.d.ts +2 -0
- package/dist/xml/inspect-xml.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constant.d.ts","sourceRoot":"","sources":["../../src/helpers/constant.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,+BAA+B,UAAU,CAAA;AAEtD,eAAO,MAAM,sBAAsB;;;CAGlC,CAAA;AAED,eAAO,MAAM,0BAA0B,QAAwE,CAAA;AAE/G,eAAO,MAAM,aAAa;;;CAGzB,CAAA;AAED,eAAO,MAAM,mBAAmB;;;;;;;;;CAG/B,CAAA"}
|
|
1
|
+
{"version":3,"file":"constant.d.ts","sourceRoot":"","sources":["../../src/helpers/constant.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,+BAA+B,UAAU,CAAA;AAEtD,eAAO,MAAM,sBAAsB;;;CAGlC,CAAA;AAED,eAAO,MAAM,0BAA0B,QAAwE,CAAA;AAE/G,eAAO,MAAM,aAAa;;;CAGzB,CAAA;AAED,eAAO,MAAM,mBAAmB,QAAyD,CAAA;AAEzF,eAAO,MAAM,mBAAmB;;;;;;;;;CAG/B,CAAA"}
|
package/dist/helpers.js
CHANGED
|
@@ -6,10 +6,10 @@ var t = "db-id", n = {
|
|
|
6
6
|
}, r = `${n.prefix}:${t}`, i = {
|
|
7
7
|
uri: "http://www.w3.org/2001/XMLSchema-instance",
|
|
8
8
|
prefix: "xsi"
|
|
9
|
-
}, a = {
|
|
9
|
+
}, a = `xmlns:${i.prefix}="${i.uri}"`, o = {
|
|
10
10
|
dev: n,
|
|
11
11
|
xsi: i
|
|
12
|
-
},
|
|
12
|
+
}, s = [
|
|
13
13
|
"id",
|
|
14
14
|
"tagName",
|
|
15
15
|
"namespace",
|
|
@@ -17,26 +17,23 @@ var t = "db-id", n = {
|
|
|
17
17
|
"children",
|
|
18
18
|
"parent",
|
|
19
19
|
"value"
|
|
20
|
-
],
|
|
21
|
-
function
|
|
20
|
+
], c = [...s, "status"], l = [...c, "tree"];
|
|
21
|
+
function u(e, t) {
|
|
22
22
|
if (typeof e != "object" || !e) return !1;
|
|
23
23
|
let n = Object.keys(e);
|
|
24
24
|
return t.every((t) => t in e) && n.every((e) => t.includes(e)) && n.length === t.length;
|
|
25
25
|
}
|
|
26
|
-
function u(e) {
|
|
27
|
-
return Array.isArray(e);
|
|
28
|
-
}
|
|
29
26
|
function d(e) {
|
|
30
|
-
return
|
|
27
|
+
return Array.isArray(e);
|
|
31
28
|
}
|
|
32
29
|
function f(e) {
|
|
33
|
-
return
|
|
30
|
+
return u(e, s);
|
|
34
31
|
}
|
|
35
32
|
function p(e) {
|
|
36
|
-
return
|
|
33
|
+
return u(e, c);
|
|
37
34
|
}
|
|
38
|
-
function m(e
|
|
39
|
-
return e
|
|
35
|
+
function m(e) {
|
|
36
|
+
return u(e, l);
|
|
40
37
|
}
|
|
41
38
|
function h(e, t) {
|
|
42
39
|
return e.tagName === t;
|
|
@@ -45,14 +42,17 @@ function g(e, t) {
|
|
|
45
42
|
return e.tagName === t;
|
|
46
43
|
}
|
|
47
44
|
function _(e, t) {
|
|
48
|
-
return t
|
|
45
|
+
return e.tagName === t;
|
|
49
46
|
}
|
|
50
47
|
function v(e, t) {
|
|
48
|
+
return t.elements.includes(e);
|
|
49
|
+
}
|
|
50
|
+
function y(e, t) {
|
|
51
51
|
return e.attributes.some((e) => e.name === t);
|
|
52
52
|
}
|
|
53
53
|
//#endregion
|
|
54
54
|
//#region src/helpers/converter.ts
|
|
55
|
-
function
|
|
55
|
+
function b(e) {
|
|
56
56
|
return {
|
|
57
57
|
id: e.id,
|
|
58
58
|
tagName: e.tagName,
|
|
@@ -63,32 +63,32 @@ function y(e) {
|
|
|
63
63
|
children: e.children
|
|
64
64
|
};
|
|
65
65
|
}
|
|
66
|
-
function
|
|
66
|
+
function x(e) {
|
|
67
67
|
let { record: t, status: n } = e, r = n ?? ("status" in t ? t.status : "unchanged");
|
|
68
68
|
return {
|
|
69
|
-
...
|
|
69
|
+
...b(t),
|
|
70
70
|
status: r
|
|
71
71
|
};
|
|
72
72
|
}
|
|
73
|
-
function
|
|
73
|
+
function S(e) {
|
|
74
74
|
let { record: t, status: n, tree: r } = e, i = r ?? ("tree" in t ? t.tree : []);
|
|
75
75
|
return {
|
|
76
|
-
...
|
|
76
|
+
...x({
|
|
77
77
|
record: t,
|
|
78
78
|
status: n
|
|
79
79
|
}),
|
|
80
80
|
tree: i
|
|
81
81
|
};
|
|
82
82
|
}
|
|
83
|
-
function
|
|
83
|
+
function C(e) {
|
|
84
84
|
let { dialecteConfig: t, tagName: n, attributes: r } = e;
|
|
85
|
-
return
|
|
85
|
+
return d(r) ? r : Object.entries(r).map(([e, r]) => ({
|
|
86
86
|
name: e,
|
|
87
87
|
value: r,
|
|
88
88
|
namespace: t.definition[n]?.attributes.details[e]?.namespace || void 0
|
|
89
89
|
}));
|
|
90
90
|
}
|
|
91
|
-
function
|
|
91
|
+
function w(t) {
|
|
92
92
|
return e(t, { detail: "The record or ref is undefined" }), {
|
|
93
93
|
id: t.id,
|
|
94
94
|
tagName: t.tagName
|
|
@@ -96,8 +96,8 @@ function C(t) {
|
|
|
96
96
|
}
|
|
97
97
|
//#endregion
|
|
98
98
|
//#region src/helpers/standardizing.ts
|
|
99
|
-
function
|
|
100
|
-
let { dialecteConfig: t, hooks: n, record: r } = e, { id: i, tagName: a, attributes: o, namespace: s, value: c } = r, l = i ?? crypto.randomUUID(), u = o ?
|
|
99
|
+
function T(e) {
|
|
100
|
+
let { dialecteConfig: t, hooks: n, record: r } = e, { id: i, tagName: a, attributes: o, namespace: s, value: c } = r, l = i ?? crypto.randomUUID(), u = o ? C({
|
|
101
101
|
tagName: a,
|
|
102
102
|
attributes: o,
|
|
103
103
|
dialecteConfig: t
|
|
@@ -130,7 +130,7 @@ function w(e) {
|
|
|
130
130
|
}
|
|
131
131
|
//#endregion
|
|
132
132
|
//#region src/helpers/merge-extensions.ts
|
|
133
|
-
function
|
|
133
|
+
function E(t, n, r, i) {
|
|
134
134
|
if (!t || !n) return;
|
|
135
135
|
let a = Object.keys(n).filter((e) => e in t);
|
|
136
136
|
e(a.length === 0, {
|
|
@@ -138,12 +138,12 @@ function T(t, n, r, i) {
|
|
|
138
138
|
detail: `Module "${r}" has conflicting ${i} method(s): ${a.map((e) => `"${e}"`).join(", ")}`
|
|
139
139
|
});
|
|
140
140
|
}
|
|
141
|
-
function
|
|
141
|
+
function D(e) {
|
|
142
142
|
let t = {}, n = {}, r = [...Object.entries(e.base ?? {}), ...Object.entries(e.custom ?? {})];
|
|
143
|
-
for (let [e, i] of r) i.query && (
|
|
143
|
+
for (let [e, i] of r) i.query && (E(t[e], i.query, e, "query"), t[e] = {
|
|
144
144
|
...t[e],
|
|
145
145
|
...i.query
|
|
146
|
-
}), i.transaction && (
|
|
146
|
+
}), i.transaction && (E(n[e], i.transaction, e, "transaction"), n[e] = {
|
|
147
147
|
...n[e],
|
|
148
148
|
...i.transaction
|
|
149
149
|
});
|
|
@@ -154,15 +154,15 @@ function E(e) {
|
|
|
154
154
|
}
|
|
155
155
|
//#endregion
|
|
156
156
|
//#region src/helpers/strip-attributes.ts
|
|
157
|
-
function
|
|
157
|
+
function O(e, t) {
|
|
158
158
|
let n = new Set(t), r = {
|
|
159
159
|
...e,
|
|
160
160
|
attributes: e.attributes.filter((e) => !n.has(e.name))
|
|
161
161
|
};
|
|
162
162
|
return "tree" in e ? {
|
|
163
163
|
...r,
|
|
164
|
-
tree: e.tree.map((e) =>
|
|
164
|
+
tree: e.tree.map((e) => O(e, t))
|
|
165
165
|
} : r;
|
|
166
166
|
}
|
|
167
167
|
//#endregion
|
|
168
|
-
export { r as CUSTOM_RECORD_ID_ATTRIBUTE, t as CUSTOM_RECORD_ID_ATTRIBUTE_NAME, n as DIALECTE_DEV_NAMESPACE,
|
|
168
|
+
export { r as CUSTOM_RECORD_ID_ATTRIBUTE, t as CUSTOM_RECORD_ID_ATTRIBUTE_NAME, n as DIALECTE_DEV_NAMESPACE, o as DIALECTE_NAMESPACES, a as XMLNS_XSI_NAMESPACE, i as XSI_NAMESPACE, y as isAttributeOf, g as isChildOf, v as isElementOf, d as isFullAttributeArray, _ as isParentOf, f as isRawRecord, h as isRecordOf, p as isTrackedRecord, m as isTreeRecord, D as mergeExtensions, T as standardizeRecord, O as stripAttributes, C as toFullAttributeArray, b as toRawRecord, w as toRef, x as toTrackedRecord, S as toTreeRecord };
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { A as e, B as t, C as n, D as r, E as i, F as a, G as o, H as s, I as c, J as l, K as u, L as d, M as f, N as p, O as m, P as h, Q as g, R as _, S as v, T as y, U as b, V as x, W as S, X as C, Y as w, Z as T, _ as E, a as D, b as O, c as k, d as A, f as j, g as M, i as N, j as P, k as F, l as I, m as L, n as R, o as z, p as B, q as V, r as H, s as U, t as W, u as G, v as K, w as q, x as J, y as Y, z as X } from "./project-
|
|
1
|
+
import { A as e, B as t, C as n, D as r, E as i, F as a, G as o, H as s, I as c, J as l, K as u, L as d, M as f, N as p, O as m, P as h, Q as g, R as _, S as v, T as y, U as b, V as x, W as S, X as C, Y as w, Z as T, _ as E, a as D, b as O, c as k, d as A, f as j, g as M, i as N, j as P, k as F, l as I, m as L, n as R, o as z, p as B, q as V, r as H, s as U, t as W, u as G, v as K, w as q, x as J, y as Y, z as X } from "./project-B6LoveZA.js";
|
|
2
2
|
import { i as Z, r as Q } from "./utils-CmyVTqDb.js";
|
|
3
3
|
export { d as AnyQuery, a as AnyTransaction, Y as BLOBS_SCHEMA, O as BLOB_DATA_SCHEMA, J as CHANGELOG_SCHEMA, v as DOCUMENTS_SCHEMA, K as DexieStore, f as Document, Z as ERROR_CATALOG, E as InMemoryStore, n as META_SCHEMA, I as ParseSession, W as Project, c as Query, q as TABLE_BLOBS, y as TABLE_BLOB_PREFIX, i as TABLE_CHANGELOG, r as TABLE_DOCUMENTS, m as TABLE_META, F as TABLE_RECORD_PREFIX, B as TEMP_IDB_ID_ATTRIBUTE_NAME, h as Transaction, g as bindExtensions, e as blobTableName, N as buildDocumentState, A as buildXmlDocument, j as downloadFile, z as exportBlob, U as exportDocument, u as findAncestors, S as findByAttributes, b as findDescendants, L as formatXml, x as getAttribute, s as getAttributeFullObject, X as getAttributes, t as getAttributesFullObject, l as getChild, V as getChildren, T as getRecord, C as getRecords, w as getRecordsByTagName, _ as getTree, H as importDocument, R as initEmptyDocument, G as inspectXml, p as isTransactionContext, o as matchesAttributeFilter, k as parseXmlFile, D as reconcileDocumentState, P as recordTableName, M as resolveStore, Q as throwDialecteError };
|
|
@@ -7158,10 +7158,11 @@ function jt(e, n) {
|
|
|
7158
7158
|
if (!r.has(n)) return;
|
|
7159
7159
|
let a = {};
|
|
7160
7160
|
for (let e of Object.values(t.attributes)) {
|
|
7161
|
-
let t = e.prefix ? e.local : e.name;
|
|
7161
|
+
let t = e.prefix === "xmlns" && e.local === "" ? "xmlns" : e.prefix ? e.local : e.name;
|
|
7162
7162
|
a[t] = e.value;
|
|
7163
7163
|
}
|
|
7164
7164
|
i[n] = {
|
|
7165
|
+
namespace: t.uri,
|
|
7165
7166
|
attributes: a,
|
|
7166
7167
|
value: "",
|
|
7167
7168
|
children: []
|
|
@@ -7329,7 +7330,7 @@ function Bt(e) {
|
|
|
7329
7330
|
uri: e.uri
|
|
7330
7331
|
} : void 0;
|
|
7331
7332
|
return {
|
|
7332
|
-
name: t ? e.local : e.name,
|
|
7333
|
+
name: e.prefix === "xmlns" && e.local === "" ? "xmlns" : t ? e.local : e.name,
|
|
7333
7334
|
value: e.value,
|
|
7334
7335
|
...t && { namespace: t }
|
|
7335
7336
|
};
|
package/dist/test.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as e, h as t, t as n, v as r } from "./project-
|
|
1
|
+
import { $ as e, h as t, t as n, v as r } from "./project-B6LoveZA.js";
|
|
2
2
|
import { DIALECTE_NAMESPACES as i, standardizeRecord as a, toTrackedRecord as o, toTreeRecord as s } from "./helpers.js";
|
|
3
3
|
import { expect as c, it as l } from "vitest";
|
|
4
4
|
//#region src/test/assert-xml/xpath-parser.ts
|
|
@@ -14,6 +14,8 @@ import { AnyDialecteConfig, AttributesValueObjectOf, ChildrenOf, ElementsOf } fr
|
|
|
14
14
|
* // report.Project?.attributes.schemaVersion → string | undefined
|
|
15
15
|
*/
|
|
16
16
|
export type InspectedElement<GenericConfig extends AnyDialecteConfig, GenericElement extends ElementsOf<GenericConfig>> = {
|
|
17
|
+
/** Namespace URI of this element (from its default or prefixed xmlns declaration). */
|
|
18
|
+
namespace: string;
|
|
17
19
|
/** All attributes found on the opening tag, keyed by local name. */
|
|
18
20
|
attributes: Partial<AttributesValueObjectOf<GenericConfig, GenericElement>>;
|
|
19
21
|
/** Names of child elements found directly under this element. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inspect-xml.d.ts","sourceRoot":"","sources":["../../src/xml/inspect-xml.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,iBAAiB,EAAE,uBAAuB,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AAEjG;;;;;;;;;;;;;GAaG;AAEH,MAAM,MAAM,gBAAgB,CAC3B,aAAa,SAAS,iBAAiB,EACvC,cAAc,SAAS,UAAU,CAAC,aAAa,CAAC,IAC7C;IACH,oEAAoE;IACpE,UAAU,EAAE,OAAO,CAAC,uBAAuB,CAAC,aAAa,EAAE,cAAc,CAAC,CAAC,CAAA;IAC3E,iEAAiE;IACjE,QAAQ,EAAE,UAAU,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