@dialecte/core 0.2.17 → 0.2.18
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/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 };
|