xml-model 0.1.0 → 0.2.0
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/build/main/defaults/index.js +22 -16
- package/build/main/defaults/models.js +4 -4
- package/build/main/errors.d.ts +4 -0
- package/build/main/errors.js +35 -0
- package/build/main/middleware.js +11 -11
- package/build/main/model/index.d.ts +7 -9
- package/build/main/model/index.js +94 -72
- package/build/main/model/property.js +25 -23
- package/build/main/model/types.d.ts +5 -1
- package/build/main/model/types.js +86 -70
- package/build/main/xml.d.ts +2 -0
- package/build/main/xml.js +20 -10
- package/build/module/defaults/index.d.ts +11 -10
- package/build/module/defaults/index.js +139 -46
- package/build/module/defaults/models.js +37 -6
- package/build/module/errors.d.ts +3 -2
- package/build/module/errors.js +15 -20
- package/build/module/index.d.ts +2 -1
- package/build/module/index.js +1 -0
- package/build/module/middleware.js +11 -11
- package/build/module/model/index.d.ts +24 -0
- package/build/module/model/index.js +316 -0
- package/build/module/model/property.d.ts +5 -0
- package/build/module/model/property.js +96 -0
- package/build/module/model/types.d.ts +73 -0
- package/build/module/model/types.js +230 -0
- package/build/module/types.d.ts +6 -11
- package/build/module/types.js +2 -25
- package/build/module/xml.d.ts +22 -4
- package/build/module/xml.js +36 -15
- package/package.json +8 -6
- package/.eslintignore +0 -3
- package/.eslintrc.js +0 -6
- package/.gitignore +0 -2
- package/.vscode/launch.json +0 -21
- package/.vscode/settings.json +0 -3
- package/build/main/model.spec.d.ts +0 -1
- package/build/main/model.spec.js +0 -261
- package/build/module/model.d.ts +0 -71
- package/build/module/model.js +0 -466
- package/build/module/model.spec.d.ts +0 -1
- package/build/module/model.spec.js +0 -76
- package/build/module/xml-from-object.d.ts +0 -11
- package/build/module/xml-from-object.js +0 -58
- package/build/module/xml-from-object.spec.d.ts +0 -1
- package/build/module/xml-from-object.spec.js +0 -104
- package/build/module/xml-to-object.d.ts +0 -11
- package/build/module/xml-to-object.js +0 -55
- package/register-ts-node.js +0 -9
- package/src/defaults/index.ts +0 -181
- package/src/defaults/models.ts +0 -45
- package/src/index.ts +0 -6
- package/src/middleware.ts +0 -34
- package/src/model/index.ts +0 -245
- package/src/model/property.ts +0 -104
- package/src/model/types.ts +0 -99
- package/src/model.spec.ts +0 -178
- package/src/types.ts +0 -8
- package/src/xml.ts +0 -80
- package/tsconfig.json +0 -106
- package/tsconfig.module.json +0 -9
- package/yarn.lock +0 -2217
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
const __RΦ = { m: (k, v) => (t, ...a) => t && Reflect.metadata ? Reflect.metadata(k, v)(t, ...a) : void 0, f: (f, d, n) => (d.forEach(d => d(f)), Object.defineProperty(f, "name", { value: n, writable: false }), f), c: (c, d, dp, dsp, n) => (d.forEach(d => d(c)), dp.forEach(([p, d]) => d(c.prototype, p)), dsp.forEach(([p, d]) => d(c, p)), n ? Object.defineProperty(c, "name", { value: n, writable: false }) : undefined, c), r: (o, a) => (Object.assign(o, a)), a: id => {
|
|
2
|
+
let t = __RΦ.t[id];
|
|
3
|
+
if (t === void 0)
|
|
4
|
+
return void 0;
|
|
5
|
+
if (t.RΦ) {
|
|
6
|
+
let r = t.RΦ;
|
|
7
|
+
delete t.RΦ;
|
|
8
|
+
__RΦ.r(t, r(t));
|
|
9
|
+
}
|
|
10
|
+
else if (t.LΦ) {
|
|
11
|
+
let l = t.LΦ();
|
|
12
|
+
delete t.LΦ;
|
|
13
|
+
__RΦ.t[id] = t = l;
|
|
14
|
+
}
|
|
15
|
+
return t;
|
|
16
|
+
}, t: { [1359]: { RΦ: t => ({ TΦ: "g", t: __RΦ.a(206), p: [__RΦ.a(1330)] }) }, [206]: { TΦ: "5", name: "XMLModelPropertyOptions" }, [1330]: { LΦ: t => Object }, [1363]: { LΦ: t => Object }, [488]: { RΦ: t => ({ TΦ: "g", t: __RΦ.a(206), p: [__RΦ.a(370)] }) }, [370]: { LΦ: t => Object }, [102]: { RΦ: t => ({ TΦ: "[", e: __RΦ.a(101) }) }, [101]: { LΦ: t => LΦ_0.IΦElement }, [491]: { LΦ: t => Object }, [492]: { LΦ: t => LΦ_1.ReflectedProperty }, [13]: { LΦ: t => String }, [20]: { LΦ: t => Boolean }, [500]: { RΦ: t => ({ TΦ: "g", t: __RΦ.a(497), p: [__RΦ.a(1)] }) }, [497]: { LΦ: t => LΦ_2.XMLModel }, [1]: { RΦ: t => ({ TΦ: "~" }) }, [352]: { RΦ: t => ({ TΦ: "F", r: __RΦ.a(20), p: [{ n: "element", t: () => __RΦ.a(101), v: null }, { n: "context", t: () => __RΦ.a(394), v: null }], f: "" }) }, [394]: { RΦ: t => ({ TΦ: "m", t: __RΦ.a(395), p: [__RΦ.a(372), __RΦ.a(373)] }) }, [395]: { LΦ: t => Object }, [372]: { RΦ: t => ({ TΦ: "g", t: __RΦ.a(369), p: [__RΦ.a(207)] }) }, [369]: { TΦ: "5", name: "PropertyFromXMLContext" }, [207]: { LΦ: t => Object }, [373]: { LΦ: t => "elements" }, [1210]: { RΦ: t => ({ TΦ: "F", r: __RΦ.a(102), p: [{ n: "context", t: () => __RΦ.a(394), v: null }], f: "" }) }, [1212]: { RΦ: t => ({ TΦ: "F", r: __RΦ.a(1325), p: [{ n: "context", t: () => __RΦ.a(372), v: null }], f: "" }) }, [1325]: { LΦ: t => Object }, [1214]: { RΦ: t => ({ TΦ: "F", r: __RΦ.a(103), p: [{ n: "context", t: () => __RΦ.a(1332), v: null }], f: "" }) }, [103]: { RΦ: t => ({ TΦ: "O", m: [{ n: "elements", f: "", t: __RΦ.a(102) }] }) }, [1332]: { RΦ: t => ({ TΦ: "g", t: __RΦ.a(1329), p: [__RΦ.a(207)] }) }, [1329]: { TΦ: "5", name: "PropertyToXMLContext" }, [1373]: { RΦ: t => ({ TΦ: "|", t: [__RΦ.a(13), __RΦ.a(74), __RΦ.a(1372)] }) }, [74]: { LΦ: t => RegExp }, [1372]: { RΦ: t => ({ TΦ: "O", m: [{ n: "__call", f: "", t: __RΦ.a(4) }] }) }, [4]: { RΦ: t => ({ TΦ: "~" }) }, [1266]: { RΦ: t => ({ TΦ: "O", m: [{ n: "__call", f: "", t: __RΦ.a(4) }] }) }, [1335]: { RΦ: t => ({ TΦ: "O", m: [{ n: "__call", f: "", t: __RΦ.a(4) }] }) }, [1288]: { RΦ: t => ({ TΦ: "O", m: [{ n: "__call", f: "", t: __RΦ.a(4) }] }) }, [501]: { RΦ: t => ({ TΦ: "|", t: [__RΦ.a(10), __RΦ.a(500)] }) }, [10]: { RΦ: t => ({ TΦ: "u" }) }, [605]: { RΦ: t => ({ TΦ: "|", t: [__RΦ.a(12), __RΦ.a(597)] }) }, [12]: { RΦ: t => ({ TΦ: "n" }) }, [597]: { TΦ: "5", name: "ConversionOptions" }, [608]: { RΦ: t => ({ TΦ: "[", e: __RΦ.a(607) }) }, [607]: { RΦ: t => ({ TΦ: "O", m: [{ n: "__call", f: "", t: __RΦ.a(4) }] }) }, [644]: { RΦ: t => ({ TΦ: "m", t: __RΦ.a(645), p: [__RΦ.a(376)] }) }, [645]: { LΦ: t => Object }, [376]: { LΦ: t => Object }, [514]: { RΦ: t => ({ TΦ: "g", t: __RΦ.a(497), p: [__RΦ.a(376)] }) }, [850]: { LΦ: t => Object }, [877]: { RΦ: t => ({ TΦ: "m", t: __RΦ.a(878), p: [__RΦ.a(850)] }) }, [878]: { LΦ: t => Object }, [915]: { RΦ: t => ({ TΦ: "g", t: __RΦ.a(497), p: [__RΦ.a(850)] }) }, [523]: { RΦ: t => ({ TΦ: "g", t: __RΦ.a(497), p: [__RΦ.a(518)] }) }, [518]: { LΦ: t => Object }, [648]: { RΦ: t => ({ TΦ: "O", m: [{ n: "fromXML", f: "", t: __RΦ.a(655) }, { n: "toXML", f: "", t: __RΦ.a(887) }, { n: "options", f: "", t: __RΦ.a(1063) }] }) }, [655]: { RΦ: t => ({ TΦ: "g", t: __RΦ.a(597), p: [__RΦ.a(651), __RΦ.a(653)] }) }, [651]: { RΦ: t => ({ TΦ: "m", t: __RΦ.a(652), p: [__RΦ.a(601), __RΦ.a(379)] }) }, [652]: { LΦ: t => Object }, [601]: { RΦ: t => ({ TΦ: "g", t: __RΦ.a(375), p: [__RΦ.a(518)] }) }, [375]: { TΦ: "5", name: "fromXMLContext" }, [379]: { LΦ: t => "properties" }, [653]: { RΦ: t => ({ TΦ: "m", t: __RΦ.a(654), p: [__RΦ.a(518)] }) }, [654]: { LΦ: t => Object }, [887]: { RΦ: t => ({ TΦ: "g", t: __RΦ.a(597), p: [__RΦ.a(883), __RΦ.a(885)] }) }, [883]: { RΦ: t => ({ TΦ: "m", t: __RΦ.a(884), p: [__RΦ.a(852), __RΦ.a(379)] }) }, [884]: { LΦ: t => Object }, [852]: { RΦ: t => ({ TΦ: "g", t: __RΦ.a(849), p: [__RΦ.a(518)] }) }, [849]: { TΦ: "5", name: "toXMLContext" }, [885]: { RΦ: t => ({ TΦ: "m", t: __RΦ.a(886), p: [__RΦ.a(518)] }) }, [886]: { LΦ: t => Object }, [1063]: { RΦ: t => ({ TΦ: "g", t: __RΦ.a(1053), p: [__RΦ.a(1061), __RΦ.a(1062)] }) }, [1053]: { LΦ: t => Map }, [1061]: { LΦ: t => Object }, [1062]: { RΦ: t => ({ TΦ: "g", t: __RΦ.a(206), p: [__RΦ.a(518)] }) }, [602]: { RΦ: t => ({ TΦ: "g", t: __RΦ.a(597), p: [__RΦ.a(601), __RΦ.a(518)] }) }, [853]: { RΦ: t => ({ TΦ: "g", t: __RΦ.a(597), p: [__RΦ.a(852), __RΦ.a(103)] }) }, [1837]: { RΦ: t => ({ TΦ: "|", t: [__RΦ.a(10), __RΦ.a(1836)] }) }, [1836]: { RΦ: t => ({ TΦ: "g", t: __RΦ.a(497), p: [__RΦ.a(1643)] }) }, [1643]: { LΦ: t => Object }, [1664]: { RΦ: t => ({ TΦ: "O", m: [{ n: "__call", f: "", t: __RΦ.a(4) }] }) }, [1654]: { RΦ: t => ({ TΦ: "O", m: [{ n: "__call", f: "", t: __RΦ.a(4) }] }) } } };
|
|
17
|
+
var IΦPropertyToXMLContext = { name: "PropertyToXMLContext", prototype: {}, identity: Symbol("PropertyToXMLContext (interface)") };
|
|
18
|
+
export { IΦPropertyToXMLContext };
|
|
19
|
+
(t => __RΦ.t[1329] = t)(IΦPropertyToXMLContext);
|
|
20
|
+
__RΦ.m("rt:P", ["property", "value"])(IΦPropertyToXMLContext);
|
|
21
|
+
__RΦ.m("rt:m", [])(IΦPropertyToXMLContext);
|
|
22
|
+
__RΦ.m("rt:i", [() => IΦOmit])(IΦPropertyToXMLContext);
|
|
23
|
+
__RΦ.m("rt:f", "Ie")(IΦPropertyToXMLContext);
|
|
24
|
+
__RΦ.m("rt:t", () => __RΦ.a(1359))(IΦPropertyToXMLContext.prototype, "property");
|
|
25
|
+
__RΦ.m("rt:f", "P")(IΦPropertyToXMLContext.prototype, "property");
|
|
26
|
+
__RΦ.m("rt:t", () => __RΦ.a(1363))(IΦPropertyToXMLContext.prototype, "value");
|
|
27
|
+
__RΦ.m("rt:f", "P")(IΦPropertyToXMLContext.prototype, "value");
|
|
28
|
+
__RΦ.m("rt:t", () => __RΦ.a(1359))(IΦPropertyToXMLContext.prototype, "property");
|
|
29
|
+
__RΦ.m("rt:f", "P")(IΦPropertyToXMLContext.prototype, "property");
|
|
30
|
+
__RΦ.m("rt:t", () => __RΦ.a(1363))(IΦPropertyToXMLContext.prototype, "value");
|
|
31
|
+
__RΦ.m("rt:f", "P")(IΦPropertyToXMLContext.prototype, "value");
|
|
32
|
+
import * as LΦ_0 from "xml-js/types";
|
|
33
|
+
var IΦPropertyFromXMLContext = { name: "PropertyFromXMLContext", prototype: {}, identity: Symbol("PropertyFromXMLContext (interface)") };
|
|
34
|
+
export { IΦPropertyFromXMLContext };
|
|
35
|
+
(t => __RΦ.t[369] = t)(IΦPropertyFromXMLContext);
|
|
36
|
+
__RΦ.m("rt:P", ["property", "elements"])(IΦPropertyFromXMLContext);
|
|
37
|
+
__RΦ.m("rt:m", [])(IΦPropertyFromXMLContext);
|
|
38
|
+
__RΦ.m("rt:i", [() => IΦOmit])(IΦPropertyFromXMLContext);
|
|
39
|
+
__RΦ.m("rt:f", "Ie")(IΦPropertyFromXMLContext);
|
|
40
|
+
__RΦ.m("rt:t", () => __RΦ.a(488))(IΦPropertyFromXMLContext.prototype, "property");
|
|
41
|
+
__RΦ.m("rt:f", "P")(IΦPropertyFromXMLContext.prototype, "property");
|
|
42
|
+
__RΦ.m("rt:t", () => __RΦ.a(102))(IΦPropertyFromXMLContext.prototype, "elements");
|
|
43
|
+
__RΦ.m("rt:f", "P")(IΦPropertyFromXMLContext.prototype, "elements");
|
|
44
|
+
__RΦ.m("rt:t", () => __RΦ.a(488))(IΦPropertyFromXMLContext.prototype, "property");
|
|
45
|
+
__RΦ.m("rt:f", "P")(IΦPropertyFromXMLContext.prototype, "property");
|
|
46
|
+
__RΦ.m("rt:t", () => __RΦ.a(102))(IΦPropertyFromXMLContext.prototype, "elements");
|
|
47
|
+
__RΦ.m("rt:f", "P")(IΦPropertyFromXMLContext.prototype, "elements");
|
|
48
|
+
import * as LΦ_1 from "typescript-rtti";
|
|
49
|
+
import * as LΦ_2 from "../model";
|
|
50
|
+
var IΦXMLModelPropertyOptions = { name: "XMLModelPropertyOptions", prototype: {}, identity: Symbol("XMLModelPropertyOptions (interface)") };
|
|
51
|
+
export { IΦXMLModelPropertyOptions };
|
|
52
|
+
(t => __RΦ.t[206] = t)(IΦXMLModelPropertyOptions);
|
|
53
|
+
__RΦ.m("rt:P", ["name", "reflected", "tagname", "ignored", "inline", "model", "isSourceElement", "resolveElements", "fromXML", "toXML"])(IΦXMLModelPropertyOptions);
|
|
54
|
+
__RΦ.m("rt:m", [])(IΦXMLModelPropertyOptions);
|
|
55
|
+
__RΦ.m("rt:f", "Ie")(IΦXMLModelPropertyOptions);
|
|
56
|
+
__RΦ.m("rt:t", () => __RΦ.a(491))(IΦXMLModelPropertyOptions.prototype, "name");
|
|
57
|
+
__RΦ.m("rt:f", "P")(IΦXMLModelPropertyOptions.prototype, "name");
|
|
58
|
+
__RΦ.m("rt:t", () => __RΦ.a(492))(IΦXMLModelPropertyOptions.prototype, "reflected");
|
|
59
|
+
__RΦ.m("rt:f", "P")(IΦXMLModelPropertyOptions.prototype, "reflected");
|
|
60
|
+
__RΦ.m("rt:t", () => __RΦ.a(13))(IΦXMLModelPropertyOptions.prototype, "tagname");
|
|
61
|
+
__RΦ.m("rt:f", "P")(IΦXMLModelPropertyOptions.prototype, "tagname");
|
|
62
|
+
__RΦ.m("rt:t", () => __RΦ.a(20))(IΦXMLModelPropertyOptions.prototype, "ignored");
|
|
63
|
+
__RΦ.m("rt:f", "P")(IΦXMLModelPropertyOptions.prototype, "ignored");
|
|
64
|
+
__RΦ.m("rt:t", () => __RΦ.a(20))(IΦXMLModelPropertyOptions.prototype, "inline");
|
|
65
|
+
__RΦ.m("rt:f", "P")(IΦXMLModelPropertyOptions.prototype, "inline");
|
|
66
|
+
__RΦ.m("rt:t", () => __RΦ.a(500))(IΦXMLModelPropertyOptions.prototype, "model");
|
|
67
|
+
__RΦ.m("rt:f", "P?")(IΦXMLModelPropertyOptions.prototype, "model");
|
|
68
|
+
__RΦ.m("rt:t", () => __RΦ.a(352))(IΦXMLModelPropertyOptions.prototype, "isSourceElement");
|
|
69
|
+
__RΦ.m("rt:f", "P")(IΦXMLModelPropertyOptions.prototype, "isSourceElement");
|
|
70
|
+
__RΦ.m("rt:t", () => __RΦ.a(1210))(IΦXMLModelPropertyOptions.prototype, "resolveElements");
|
|
71
|
+
__RΦ.m("rt:f", "P")(IΦXMLModelPropertyOptions.prototype, "resolveElements");
|
|
72
|
+
__RΦ.m("rt:t", () => __RΦ.a(1212))(IΦXMLModelPropertyOptions.prototype, "fromXML");
|
|
73
|
+
__RΦ.m("rt:f", "P")(IΦXMLModelPropertyOptions.prototype, "fromXML");
|
|
74
|
+
__RΦ.m("rt:t", () => __RΦ.a(1214))(IΦXMLModelPropertyOptions.prototype, "toXML");
|
|
75
|
+
__RΦ.m("rt:f", "P")(IΦXMLModelPropertyOptions.prototype, "toXML");
|
|
76
|
+
__RΦ.m("rt:t", () => __RΦ.a(491))(IΦXMLModelPropertyOptions.prototype, "name");
|
|
77
|
+
__RΦ.m("rt:f", "P")(IΦXMLModelPropertyOptions.prototype, "name");
|
|
78
|
+
__RΦ.m("rt:t", () => __RΦ.a(492))(IΦXMLModelPropertyOptions.prototype, "reflected");
|
|
79
|
+
__RΦ.m("rt:f", "P")(IΦXMLModelPropertyOptions.prototype, "reflected");
|
|
80
|
+
__RΦ.m("rt:t", () => __RΦ.a(13))(IΦXMLModelPropertyOptions.prototype, "tagname");
|
|
81
|
+
__RΦ.m("rt:f", "P")(IΦXMLModelPropertyOptions.prototype, "tagname");
|
|
82
|
+
__RΦ.m("rt:t", () => __RΦ.a(20))(IΦXMLModelPropertyOptions.prototype, "ignored");
|
|
83
|
+
__RΦ.m("rt:f", "P")(IΦXMLModelPropertyOptions.prototype, "ignored");
|
|
84
|
+
__RΦ.m("rt:t", () => __RΦ.a(20))(IΦXMLModelPropertyOptions.prototype, "inline");
|
|
85
|
+
__RΦ.m("rt:f", "P")(IΦXMLModelPropertyOptions.prototype, "inline");
|
|
86
|
+
__RΦ.m("rt:t", () => __RΦ.a(500))(IΦXMLModelPropertyOptions.prototype, "model");
|
|
87
|
+
__RΦ.m("rt:f", "P?")(IΦXMLModelPropertyOptions.prototype, "model");
|
|
88
|
+
__RΦ.m("rt:t", () => __RΦ.a(352))(IΦXMLModelPropertyOptions.prototype, "isSourceElement");
|
|
89
|
+
__RΦ.m("rt:f", "P")(IΦXMLModelPropertyOptions.prototype, "isSourceElement");
|
|
90
|
+
__RΦ.m("rt:t", () => __RΦ.a(1210))(IΦXMLModelPropertyOptions.prototype, "resolveElements");
|
|
91
|
+
__RΦ.m("rt:f", "P")(IΦXMLModelPropertyOptions.prototype, "resolveElements");
|
|
92
|
+
__RΦ.m("rt:t", () => __RΦ.a(1212))(IΦXMLModelPropertyOptions.prototype, "fromXML");
|
|
93
|
+
__RΦ.m("rt:f", "P")(IΦXMLModelPropertyOptions.prototype, "fromXML");
|
|
94
|
+
__RΦ.m("rt:t", () => __RΦ.a(1214))(IΦXMLModelPropertyOptions.prototype, "toXML");
|
|
95
|
+
__RΦ.m("rt:f", "P")(IΦXMLModelPropertyOptions.prototype, "toXML");
|
|
96
|
+
var IΦCreateXMLModelPropertyOptions = { name: "CreateXMLModelPropertyOptions", prototype: {}, identity: Symbol("CreateXMLModelPropertyOptions (interface)") };
|
|
97
|
+
export { IΦCreateXMLModelPropertyOptions };
|
|
98
|
+
(t => __RΦ.t[190] = t)(IΦCreateXMLModelPropertyOptions);
|
|
99
|
+
__RΦ.m("rt:P", ["tagname", "sourceElements", "resolveElements", "toXML", "fromXML", "inline", "ignore", "model"])(IΦCreateXMLModelPropertyOptions);
|
|
100
|
+
__RΦ.m("rt:m", [])(IΦCreateXMLModelPropertyOptions);
|
|
101
|
+
__RΦ.m("rt:f", "Ie")(IΦCreateXMLModelPropertyOptions);
|
|
102
|
+
__RΦ.m("rt:t", () => __RΦ.a(13))(IΦCreateXMLModelPropertyOptions.prototype, "tagname");
|
|
103
|
+
__RΦ.m("rt:f", "P?")(IΦCreateXMLModelPropertyOptions.prototype, "tagname");
|
|
104
|
+
__RΦ.m("rt:t", () => __RΦ.a(1373))(IΦCreateXMLModelPropertyOptions.prototype, "sourceElements");
|
|
105
|
+
__RΦ.m("rt:f", "P?")(IΦCreateXMLModelPropertyOptions.prototype, "sourceElements");
|
|
106
|
+
__RΦ.m("rt:t", () => __RΦ.a(1266))(IΦCreateXMLModelPropertyOptions.prototype, "resolveElements");
|
|
107
|
+
__RΦ.m("rt:f", "P?")(IΦCreateXMLModelPropertyOptions.prototype, "resolveElements");
|
|
108
|
+
__RΦ.m("rt:t", () => __RΦ.a(1335))(IΦCreateXMLModelPropertyOptions.prototype, "toXML");
|
|
109
|
+
__RΦ.m("rt:f", "P?")(IΦCreateXMLModelPropertyOptions.prototype, "toXML");
|
|
110
|
+
__RΦ.m("rt:t", () => __RΦ.a(1288))(IΦCreateXMLModelPropertyOptions.prototype, "fromXML");
|
|
111
|
+
__RΦ.m("rt:f", "P?")(IΦCreateXMLModelPropertyOptions.prototype, "fromXML");
|
|
112
|
+
__RΦ.m("rt:t", () => __RΦ.a(20))(IΦCreateXMLModelPropertyOptions.prototype, "inline");
|
|
113
|
+
__RΦ.m("rt:f", "P?")(IΦCreateXMLModelPropertyOptions.prototype, "inline");
|
|
114
|
+
__RΦ.m("rt:t", () => __RΦ.a(20))(IΦCreateXMLModelPropertyOptions.prototype, "ignore");
|
|
115
|
+
__RΦ.m("rt:f", "P?")(IΦCreateXMLModelPropertyOptions.prototype, "ignore");
|
|
116
|
+
__RΦ.m("rt:t", () => __RΦ.a(501))(IΦCreateXMLModelPropertyOptions.prototype, "model");
|
|
117
|
+
__RΦ.m("rt:f", "P?")(IΦCreateXMLModelPropertyOptions.prototype, "model");
|
|
118
|
+
__RΦ.m("rt:t", () => __RΦ.a(13))(IΦCreateXMLModelPropertyOptions.prototype, "tagname");
|
|
119
|
+
__RΦ.m("rt:f", "P?")(IΦCreateXMLModelPropertyOptions.prototype, "tagname");
|
|
120
|
+
__RΦ.m("rt:t", () => __RΦ.a(1373))(IΦCreateXMLModelPropertyOptions.prototype, "sourceElements");
|
|
121
|
+
__RΦ.m("rt:f", "P?")(IΦCreateXMLModelPropertyOptions.prototype, "sourceElements");
|
|
122
|
+
__RΦ.m("rt:t", () => __RΦ.a(1266))(IΦCreateXMLModelPropertyOptions.prototype, "resolveElements");
|
|
123
|
+
__RΦ.m("rt:f", "P?")(IΦCreateXMLModelPropertyOptions.prototype, "resolveElements");
|
|
124
|
+
__RΦ.m("rt:t", () => __RΦ.a(1335))(IΦCreateXMLModelPropertyOptions.prototype, "toXML");
|
|
125
|
+
__RΦ.m("rt:f", "P?")(IΦCreateXMLModelPropertyOptions.prototype, "toXML");
|
|
126
|
+
__RΦ.m("rt:t", () => __RΦ.a(1288))(IΦCreateXMLModelPropertyOptions.prototype, "fromXML");
|
|
127
|
+
__RΦ.m("rt:f", "P?")(IΦCreateXMLModelPropertyOptions.prototype, "fromXML");
|
|
128
|
+
__RΦ.m("rt:t", () => __RΦ.a(20))(IΦCreateXMLModelPropertyOptions.prototype, "inline");
|
|
129
|
+
__RΦ.m("rt:f", "P?")(IΦCreateXMLModelPropertyOptions.prototype, "inline");
|
|
130
|
+
__RΦ.m("rt:t", () => __RΦ.a(20))(IΦCreateXMLModelPropertyOptions.prototype, "ignore");
|
|
131
|
+
__RΦ.m("rt:f", "P?")(IΦCreateXMLModelPropertyOptions.prototype, "ignore");
|
|
132
|
+
__RΦ.m("rt:t", () => __RΦ.a(501))(IΦCreateXMLModelPropertyOptions.prototype, "model");
|
|
133
|
+
__RΦ.m("rt:f", "P?")(IΦCreateXMLModelPropertyOptions.prototype, "model");
|
|
134
|
+
var IΦConversionOptions = { name: "ConversionOptions", prototype: {}, identity: Symbol("ConversionOptions (interface)") };
|
|
135
|
+
(t => __RΦ.t[597] = t)(IΦConversionOptions);
|
|
136
|
+
__RΦ.m("rt:P", ["parent", "middlewares"])(IΦConversionOptions);
|
|
137
|
+
__RΦ.m("rt:m", [])(IΦConversionOptions);
|
|
138
|
+
__RΦ.m("rt:f", "I")(IΦConversionOptions);
|
|
139
|
+
__RΦ.m("rt:t", () => __RΦ.a(605))(IΦConversionOptions.prototype, "parent");
|
|
140
|
+
__RΦ.m("rt:f", "P")(IΦConversionOptions.prototype, "parent");
|
|
141
|
+
__RΦ.m("rt:t", () => __RΦ.a(608))(IΦConversionOptions.prototype, "middlewares");
|
|
142
|
+
__RΦ.m("rt:f", "P")(IΦConversionOptions.prototype, "middlewares");
|
|
143
|
+
__RΦ.m("rt:t", () => __RΦ.a(605))(IΦConversionOptions.prototype, "parent");
|
|
144
|
+
__RΦ.m("rt:f", "P")(IΦConversionOptions.prototype, "parent");
|
|
145
|
+
__RΦ.m("rt:t", () => __RΦ.a(608))(IΦConversionOptions.prototype, "middlewares");
|
|
146
|
+
__RΦ.m("rt:f", "P")(IΦConversionOptions.prototype, "middlewares");
|
|
147
|
+
var IΦfromXMLContext = { name: "fromXMLContext", prototype: {}, identity: Symbol("fromXMLContext (interface)") };
|
|
148
|
+
export { IΦfromXMLContext };
|
|
149
|
+
(t => __RΦ.t[375] = t)(IΦfromXMLContext);
|
|
150
|
+
__RΦ.m("rt:P", ["xml", "properties", "model"])(IΦfromXMLContext);
|
|
151
|
+
__RΦ.m("rt:m", [])(IΦfromXMLContext);
|
|
152
|
+
__RΦ.m("rt:f", "Ie")(IΦfromXMLContext);
|
|
153
|
+
__RΦ.m("rt:t", () => __RΦ.a(103))(IΦfromXMLContext.prototype, "xml");
|
|
154
|
+
__RΦ.m("rt:f", "P")(IΦfromXMLContext.prototype, "xml");
|
|
155
|
+
__RΦ.m("rt:t", () => __RΦ.a(644))(IΦfromXMLContext.prototype, "properties");
|
|
156
|
+
__RΦ.m("rt:f", "P")(IΦfromXMLContext.prototype, "properties");
|
|
157
|
+
__RΦ.m("rt:t", () => __RΦ.a(514))(IΦfromXMLContext.prototype, "model");
|
|
158
|
+
__RΦ.m("rt:f", "P")(IΦfromXMLContext.prototype, "model");
|
|
159
|
+
__RΦ.m("rt:t", () => __RΦ.a(103))(IΦfromXMLContext.prototype, "xml");
|
|
160
|
+
__RΦ.m("rt:f", "P")(IΦfromXMLContext.prototype, "xml");
|
|
161
|
+
__RΦ.m("rt:t", () => __RΦ.a(644))(IΦfromXMLContext.prototype, "properties");
|
|
162
|
+
__RΦ.m("rt:f", "P")(IΦfromXMLContext.prototype, "properties");
|
|
163
|
+
__RΦ.m("rt:t", () => __RΦ.a(514))(IΦfromXMLContext.prototype, "model");
|
|
164
|
+
__RΦ.m("rt:f", "P")(IΦfromXMLContext.prototype, "model");
|
|
165
|
+
var IΦtoXMLContext = { name: "toXMLContext", prototype: {}, identity: Symbol("toXMLContext (interface)") };
|
|
166
|
+
export { IΦtoXMLContext };
|
|
167
|
+
(t => __RΦ.t[849] = t)(IΦtoXMLContext);
|
|
168
|
+
__RΦ.m("rt:P", ["object", "properties", "model"])(IΦtoXMLContext);
|
|
169
|
+
__RΦ.m("rt:m", [])(IΦtoXMLContext);
|
|
170
|
+
__RΦ.m("rt:f", "Ie")(IΦtoXMLContext);
|
|
171
|
+
__RΦ.m("rt:t", () => __RΦ.a(850))(IΦtoXMLContext.prototype, "object");
|
|
172
|
+
__RΦ.m("rt:f", "P")(IΦtoXMLContext.prototype, "object");
|
|
173
|
+
__RΦ.m("rt:t", () => __RΦ.a(877))(IΦtoXMLContext.prototype, "properties");
|
|
174
|
+
__RΦ.m("rt:f", "P")(IΦtoXMLContext.prototype, "properties");
|
|
175
|
+
__RΦ.m("rt:t", () => __RΦ.a(915))(IΦtoXMLContext.prototype, "model");
|
|
176
|
+
__RΦ.m("rt:f", "P")(IΦtoXMLContext.prototype, "model");
|
|
177
|
+
__RΦ.m("rt:t", () => __RΦ.a(850))(IΦtoXMLContext.prototype, "object");
|
|
178
|
+
__RΦ.m("rt:f", "P")(IΦtoXMLContext.prototype, "object");
|
|
179
|
+
__RΦ.m("rt:t", () => __RΦ.a(877))(IΦtoXMLContext.prototype, "properties");
|
|
180
|
+
__RΦ.m("rt:f", "P")(IΦtoXMLContext.prototype, "properties");
|
|
181
|
+
__RΦ.m("rt:t", () => __RΦ.a(915))(IΦtoXMLContext.prototype, "model");
|
|
182
|
+
__RΦ.m("rt:f", "P")(IΦtoXMLContext.prototype, "model");
|
|
183
|
+
var IΦXMLModelOptions = { name: "XMLModelOptions", prototype: {}, identity: Symbol("XMLModelOptions (interface)") };
|
|
184
|
+
export { IΦXMLModelOptions };
|
|
185
|
+
(t => __RΦ.t[517] = t)(IΦXMLModelOptions);
|
|
186
|
+
__RΦ.m("rt:P", ["parent", "properties", "fromXML", "toXML", "tagname"])(IΦXMLModelOptions);
|
|
187
|
+
__RΦ.m("rt:m", [])(IΦXMLModelOptions);
|
|
188
|
+
__RΦ.m("rt:f", "Ie")(IΦXMLModelOptions);
|
|
189
|
+
__RΦ.m("rt:t", () => __RΦ.a(523))(IΦXMLModelOptions.prototype, "parent");
|
|
190
|
+
__RΦ.m("rt:f", "P?")(IΦXMLModelOptions.prototype, "parent");
|
|
191
|
+
__RΦ.m("rt:t", () => __RΦ.a(648))(IΦXMLModelOptions.prototype, "properties");
|
|
192
|
+
__RΦ.m("rt:f", "P")(IΦXMLModelOptions.prototype, "properties");
|
|
193
|
+
__RΦ.m("rt:t", () => __RΦ.a(602))(IΦXMLModelOptions.prototype, "fromXML");
|
|
194
|
+
__RΦ.m("rt:f", "P")(IΦXMLModelOptions.prototype, "fromXML");
|
|
195
|
+
__RΦ.m("rt:t", () => __RΦ.a(853))(IΦXMLModelOptions.prototype, "toXML");
|
|
196
|
+
__RΦ.m("rt:f", "P")(IΦXMLModelOptions.prototype, "toXML");
|
|
197
|
+
__RΦ.m("rt:t", () => __RΦ.a(13))(IΦXMLModelOptions.prototype, "tagname");
|
|
198
|
+
__RΦ.m("rt:f", "P")(IΦXMLModelOptions.prototype, "tagname");
|
|
199
|
+
__RΦ.m("rt:t", () => __RΦ.a(523))(IΦXMLModelOptions.prototype, "parent");
|
|
200
|
+
__RΦ.m("rt:f", "P?")(IΦXMLModelOptions.prototype, "parent");
|
|
201
|
+
__RΦ.m("rt:t", () => __RΦ.a(648))(IΦXMLModelOptions.prototype, "properties");
|
|
202
|
+
__RΦ.m("rt:f", "P")(IΦXMLModelOptions.prototype, "properties");
|
|
203
|
+
__RΦ.m("rt:t", () => __RΦ.a(602))(IΦXMLModelOptions.prototype, "fromXML");
|
|
204
|
+
__RΦ.m("rt:f", "P")(IΦXMLModelOptions.prototype, "fromXML");
|
|
205
|
+
__RΦ.m("rt:t", () => __RΦ.a(853))(IΦXMLModelOptions.prototype, "toXML");
|
|
206
|
+
__RΦ.m("rt:f", "P")(IΦXMLModelOptions.prototype, "toXML");
|
|
207
|
+
__RΦ.m("rt:t", () => __RΦ.a(13))(IΦXMLModelOptions.prototype, "tagname");
|
|
208
|
+
__RΦ.m("rt:f", "P")(IΦXMLModelOptions.prototype, "tagname");
|
|
209
|
+
var IΦCreateXMLModelOptions = { name: "CreateXMLModelOptions", prototype: {}, identity: Symbol("CreateXMLModelOptions (interface)") };
|
|
210
|
+
export { IΦCreateXMLModelOptions };
|
|
211
|
+
(t => __RΦ.t[1642] = t)(IΦCreateXMLModelOptions);
|
|
212
|
+
__RΦ.m("rt:P", ["parent", "fromXML", "toXML", "tagname"])(IΦCreateXMLModelOptions);
|
|
213
|
+
__RΦ.m("rt:m", [])(IΦCreateXMLModelOptions);
|
|
214
|
+
__RΦ.m("rt:f", "Ie")(IΦCreateXMLModelOptions);
|
|
215
|
+
__RΦ.m("rt:t", () => __RΦ.a(1837))(IΦCreateXMLModelOptions.prototype, "parent");
|
|
216
|
+
__RΦ.m("rt:f", "P?")(IΦCreateXMLModelOptions.prototype, "parent");
|
|
217
|
+
__RΦ.m("rt:t", () => __RΦ.a(1664))(IΦCreateXMLModelOptions.prototype, "fromXML");
|
|
218
|
+
__RΦ.m("rt:f", "P?")(IΦCreateXMLModelOptions.prototype, "fromXML");
|
|
219
|
+
__RΦ.m("rt:t", () => __RΦ.a(1654))(IΦCreateXMLModelOptions.prototype, "toXML");
|
|
220
|
+
__RΦ.m("rt:f", "P?")(IΦCreateXMLModelOptions.prototype, "toXML");
|
|
221
|
+
__RΦ.m("rt:t", () => __RΦ.a(13))(IΦCreateXMLModelOptions.prototype, "tagname");
|
|
222
|
+
__RΦ.m("rt:f", "P?")(IΦCreateXMLModelOptions.prototype, "tagname");
|
|
223
|
+
__RΦ.m("rt:t", () => __RΦ.a(1837))(IΦCreateXMLModelOptions.prototype, "parent");
|
|
224
|
+
__RΦ.m("rt:f", "P?")(IΦCreateXMLModelOptions.prototype, "parent");
|
|
225
|
+
__RΦ.m("rt:t", () => __RΦ.a(1664))(IΦCreateXMLModelOptions.prototype, "fromXML");
|
|
226
|
+
__RΦ.m("rt:f", "P?")(IΦCreateXMLModelOptions.prototype, "fromXML");
|
|
227
|
+
__RΦ.m("rt:t", () => __RΦ.a(1654))(IΦCreateXMLModelOptions.prototype, "toXML");
|
|
228
|
+
__RΦ.m("rt:f", "P?")(IΦCreateXMLModelOptions.prototype, "toXML");
|
|
229
|
+
__RΦ.m("rt:t", () => __RΦ.a(13))(IΦCreateXMLModelOptions.prototype, "tagname");
|
|
230
|
+
__RΦ.m("rt:f", "P?")(IΦCreateXMLModelOptions.prototype, "tagname");
|
package/build/module/types.d.ts
CHANGED
|
@@ -1,13 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
export interface ClassType<T = any> {
|
|
3
|
-
new (...args: any[]): T;
|
|
4
|
-
}
|
|
1
|
+
export type { Constructor } from "typescript-rtti";
|
|
5
2
|
export declare type UnknownRecord = Record<string | number | symbol, unknown>;
|
|
6
3
|
export declare type UnknownObject = object;
|
|
7
|
-
|
|
8
|
-
export declare type
|
|
9
|
-
export declare type
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
export declare const bannedTypes: Function[];
|
|
13
|
-
export declare function typeToString(type: TypeValue): string;
|
|
4
|
+
import type { Element as _XMLElement } from "xml-js";
|
|
5
|
+
export declare type XMLElement = _XMLElement;
|
|
6
|
+
export declare type XMLRoot = {
|
|
7
|
+
elements: XMLElement[];
|
|
8
|
+
};
|
package/build/module/types.js
CHANGED
|
@@ -13,28 +13,5 @@ const __RΦ = { m: (k, v) => (t, ...a) => t && Reflect.metadata ? Reflect.metada
|
|
|
13
13
|
__RΦ.t[id] = t = l;
|
|
14
14
|
}
|
|
15
15
|
return t;
|
|
16
|
-
}, t: {
|
|
17
|
-
|
|
18
|
-
export { IΦClassType };
|
|
19
|
-
(t => __RΦ.t[100] = t)(IΦClassType);
|
|
20
|
-
__RΦ.m("rt:P", [])(IΦClassType);
|
|
21
|
-
__RΦ.m("rt:m", [])(IΦClassType);
|
|
22
|
-
__RΦ.m("rt:f", "Ie")(IΦClassType);
|
|
23
|
-
export const allowedTypes = [String, Number, Date, Boolean];
|
|
24
|
-
export const bannedTypes = [Promise, Array, Object, Function];
|
|
25
|
-
export function typeToString(type) {
|
|
26
|
-
// primitives
|
|
27
|
-
switch (typeof type) {
|
|
28
|
-
case "symbol":
|
|
29
|
-
return String(type);
|
|
30
|
-
default:
|
|
31
|
-
break;
|
|
32
|
-
}
|
|
33
|
-
if ("name" in type)
|
|
34
|
-
return type.name;
|
|
35
|
-
else
|
|
36
|
-
return String(type);
|
|
37
|
-
}
|
|
38
|
-
__RΦ.m("rt:p", [{ n: "type", t: () => __RΦ.a(117), v: null }])(typeToString);
|
|
39
|
-
__RΦ.m("rt:f", "F")(typeToString);
|
|
40
|
-
__RΦ.m("rt:t", () => __RΦ.a(13))(typeToString);
|
|
16
|
+
}, t: {} };
|
|
17
|
+
export {};
|
package/build/module/xml.d.ts
CHANGED
|
@@ -1,15 +1,33 @@
|
|
|
1
1
|
import { js2xml } from "xml-js";
|
|
2
|
-
import { XMLElement } from "./types";
|
|
3
|
-
export declare function parse(string: string):
|
|
4
|
-
export declare function stringify(xml:
|
|
2
|
+
import { XMLElement, XMLRoot } from "./types";
|
|
3
|
+
export declare function parse(string: string): XMLRoot;
|
|
4
|
+
export declare function stringify(xml: XMLRoot, options?: Parameters<typeof js2xml>[1]): string;
|
|
5
5
|
export declare function getContent(xml: XMLElement): string | number | boolean | undefined;
|
|
6
|
-
export declare function fromContent(content
|
|
6
|
+
export declare function fromContent(content: string): {
|
|
7
|
+
elements: [{
|
|
8
|
+
type: "text";
|
|
9
|
+
text: string;
|
|
10
|
+
}] | [];
|
|
11
|
+
};
|
|
12
|
+
export declare function fromContent(content: string, tag: string, attributes?: XMLElement["attributes"]): {
|
|
13
|
+
type: "element";
|
|
14
|
+
name: string;
|
|
15
|
+
attributes?: XMLElement["attributes"];
|
|
16
|
+
elements: [{
|
|
17
|
+
type: "text";
|
|
18
|
+
text: string;
|
|
19
|
+
}] | [];
|
|
20
|
+
};
|
|
7
21
|
export declare function addElement(xml: XMLElement, element: XMLElement): void;
|
|
22
|
+
export declare function setAttribute(xml: XMLElement, attribute: string, value: string): void;
|
|
23
|
+
export declare function deleteAttribute(xml: XMLElement, attribute: string): void;
|
|
8
24
|
declare const XML: {
|
|
9
25
|
parse: typeof parse;
|
|
10
26
|
stringify: typeof stringify;
|
|
11
27
|
fromContent: typeof fromContent;
|
|
12
28
|
getContent: typeof getContent;
|
|
13
29
|
addElement: typeof addElement;
|
|
30
|
+
setAttribute: typeof setAttribute;
|
|
31
|
+
deleteAttribute: typeof deleteAttribute;
|
|
14
32
|
};
|
|
15
33
|
export default XML;
|
package/build/module/xml.js
CHANGED
|
@@ -13,7 +13,7 @@ const __RΦ = { m: (k, v) => (t, ...a) => t && Reflect.metadata ? Reflect.metada
|
|
|
13
13
|
__RΦ.t[id] = t = l;
|
|
14
14
|
}
|
|
15
15
|
return t;
|
|
16
|
-
}, t: { [13]: { LΦ: t => String }, [
|
|
16
|
+
}, t: { [13]: { LΦ: t => String }, [103]: { RΦ: t => ({ TΦ: "O", m: [{ n: "elements", f: "", t: __RΦ.a(102) }] }) }, [102]: { RΦ: t => ({ TΦ: "[", e: __RΦ.a(101) }) }, [101]: { LΦ: t => LΦ_0.IΦElement }, [1501]: { RΦ: t => ({ TΦ: "|", t: [__RΦ.a(10), __RΦ.a(1498)] }) }, [10]: { RΦ: t => ({ TΦ: "u" }) }, [1498]: { LΦ: t => LΦ_0.IΦJS2XML }, [1525]: { RΦ: t => ({ TΦ: "|", t: [__RΦ.a(10), __RΦ.a(13), __RΦ.a(14), __RΦ.a(17), __RΦ.a(19)] }) }, [14]: { LΦ: t => Number }, [17]: { RΦ: t => ({ TΦ: "0" }) }, [19]: { RΦ: t => ({ TΦ: "1" }) }, [46]: { LΦ: t => "" }, [1541]: { RΦ: t => ({ TΦ: "|", t: [__RΦ.a(10), __RΦ.a(1540)] }) }, [1540]: { LΦ: t => LΦ_0.IΦAttributes }, [22]: { RΦ: t => ({ TΦ: "V" }) } } };
|
|
17
17
|
import { xml2js, js2xml } from "xml-js";
|
|
18
18
|
import * as LΦ_0 from "xml-js/types";
|
|
19
19
|
export function parse(string) {
|
|
@@ -21,54 +21,75 @@ export function parse(string) {
|
|
|
21
21
|
}
|
|
22
22
|
__RΦ.m("rt:p", [{ n: "string", t: () => __RΦ.a(13), v: null }])(parse);
|
|
23
23
|
__RΦ.m("rt:f", "F")(parse);
|
|
24
|
-
__RΦ.m("rt:t", () => __RΦ.a(
|
|
24
|
+
__RΦ.m("rt:t", () => __RΦ.a(103))(parse);
|
|
25
25
|
export function stringify(xml, options) {
|
|
26
26
|
return js2xml(xml, options);
|
|
27
27
|
}
|
|
28
|
-
__RΦ.m("rt:p", [{ n: "xml", t: () => __RΦ.a(
|
|
28
|
+
__RΦ.m("rt:p", [{ n: "xml", t: () => __RΦ.a(103), v: null }, { n: "options", t: () => __RΦ.a(1501), v: null, f: "?" }])(stringify);
|
|
29
29
|
__RΦ.m("rt:f", "F")(stringify);
|
|
30
30
|
__RΦ.m("rt:t", () => __RΦ.a(13))(stringify);
|
|
31
31
|
export function getContent(xml) {
|
|
32
|
-
if (
|
|
33
|
-
return "";
|
|
34
|
-
}
|
|
35
|
-
else if (xml.elements?.length === 1) {
|
|
32
|
+
if (xml.elements?.length === 1) {
|
|
36
33
|
const content = xml.elements[0];
|
|
37
34
|
if (content.type === "text")
|
|
38
35
|
return content.text;
|
|
39
36
|
}
|
|
40
|
-
|
|
37
|
+
if (!xml.elements)
|
|
38
|
+
return "";
|
|
39
|
+
throw new TypeError(`can't get text from XMLElement: ${JSON.stringify(xml)}`);
|
|
41
40
|
}
|
|
42
|
-
__RΦ.m("rt:p", [{ n: "xml", t: () => __RΦ.a(
|
|
41
|
+
__RΦ.m("rt:p", [{ n: "xml", t: () => __RΦ.a(101), v: null }])(getContent);
|
|
43
42
|
__RΦ.m("rt:f", "F")(getContent);
|
|
44
|
-
__RΦ.m("rt:t", () => __RΦ.a(
|
|
43
|
+
__RΦ.m("rt:t", () => __RΦ.a(1525))(getContent);
|
|
45
44
|
export function fromContent(content = "", tag, attributes) {
|
|
46
45
|
const el = {
|
|
47
|
-
type: "element",
|
|
48
46
|
elements: content ? [{ type: "text", text: String(content) }] : [],
|
|
49
47
|
};
|
|
50
48
|
if (tag)
|
|
51
49
|
el.name = tag;
|
|
52
|
-
if (attributes)
|
|
50
|
+
if (attributes) {
|
|
51
|
+
if (!el.name)
|
|
52
|
+
throw new TypeError("please provide a name if you want to provide attributes");
|
|
53
53
|
el.attributes = attributes;
|
|
54
|
+
}
|
|
55
|
+
if (el.name)
|
|
56
|
+
el.type = "element";
|
|
54
57
|
return el;
|
|
55
58
|
}
|
|
56
|
-
__RΦ.m("rt:p", [{ n: "content", t: () => __RΦ.a(46), v: function () { return ""; } }, { n: "tag", t: () => __RΦ.a(13), v: null, f: "?" }, { n: "attributes", t: () => __RΦ.a(
|
|
59
|
+
__RΦ.m("rt:p", [{ n: "content", t: () => __RΦ.a(46), v: function () { return ""; } }, { n: "tag", t: () => __RΦ.a(13), v: null, f: "?" }, { n: "attributes", t: () => __RΦ.a(1541), v: null, f: "?" }])(fromContent);
|
|
57
60
|
__RΦ.m("rt:f", "F")(fromContent);
|
|
58
|
-
__RΦ.m("rt:t", () => __RΦ.a(
|
|
61
|
+
__RΦ.m("rt:t", () => __RΦ.a(101))(fromContent);
|
|
59
62
|
export function addElement(xml, element) {
|
|
60
63
|
if (!xml.elements)
|
|
61
64
|
xml.elements = [];
|
|
62
65
|
xml.elements.push(element);
|
|
63
66
|
}
|
|
64
|
-
__RΦ.m("rt:p", [{ n: "xml", t: () => __RΦ.a(
|
|
67
|
+
__RΦ.m("rt:p", [{ n: "xml", t: () => __RΦ.a(101), v: null }, { n: "element", t: () => __RΦ.a(101), v: null }])(addElement);
|
|
65
68
|
__RΦ.m("rt:f", "F")(addElement);
|
|
66
69
|
__RΦ.m("rt:t", () => __RΦ.a(22))(addElement);
|
|
70
|
+
export function setAttribute(xml, attribute, value) {
|
|
71
|
+
if (!xml.attributes)
|
|
72
|
+
xml.attributes = {};
|
|
73
|
+
xml.attributes[attribute] = value;
|
|
74
|
+
}
|
|
75
|
+
__RΦ.m("rt:p", [{ n: "xml", t: () => __RΦ.a(101), v: null }, { n: "attribute", t: () => __RΦ.a(13), v: null }, { n: "value", t: () => __RΦ.a(13), v: null }])(setAttribute);
|
|
76
|
+
__RΦ.m("rt:f", "F")(setAttribute);
|
|
77
|
+
__RΦ.m("rt:t", () => __RΦ.a(22))(setAttribute);
|
|
78
|
+
export function deleteAttribute(xml, attribute) {
|
|
79
|
+
if (!xml.attributes)
|
|
80
|
+
return;
|
|
81
|
+
delete xml.attributes[attribute];
|
|
82
|
+
}
|
|
83
|
+
__RΦ.m("rt:p", [{ n: "xml", t: () => __RΦ.a(101), v: null }, { n: "attribute", t: () => __RΦ.a(13), v: null }])(deleteAttribute);
|
|
84
|
+
__RΦ.m("rt:f", "F")(deleteAttribute);
|
|
85
|
+
__RΦ.m("rt:t", () => __RΦ.a(22))(deleteAttribute);
|
|
67
86
|
const XML = {
|
|
68
87
|
parse,
|
|
69
88
|
stringify,
|
|
70
89
|
fromContent,
|
|
71
90
|
getContent,
|
|
72
91
|
addElement,
|
|
92
|
+
setAttribute,
|
|
93
|
+
deleteAttribute,
|
|
73
94
|
};
|
|
74
95
|
export default XML;
|
package/package.json
CHANGED
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "xml-model",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"main": "build/main/index.js",
|
|
5
5
|
"typings": "build/main/index.d.ts",
|
|
6
6
|
"module": "build/module/index.js",
|
|
7
7
|
"author": "MathisTLD",
|
|
8
8
|
"license": "MIT",
|
|
9
|
-
"private": false,
|
|
10
9
|
"scripts": {
|
|
11
|
-
"
|
|
10
|
+
"preversion": "npm test",
|
|
11
|
+
"version": "npm run build",
|
|
12
|
+
"postversion": "git push && git push --tags",
|
|
13
|
+
"test": "npm run lint && mocha -r ./register-ts-node --colors src/**/*.spec.ts",
|
|
12
14
|
"build": "run-p build:*",
|
|
13
15
|
"build:main": "rimraf build/main && ttsc -p tsconfig.json",
|
|
14
16
|
"build:module": "rimraf build/module && ttsc -p tsconfig.module.json",
|
|
@@ -17,7 +19,7 @@
|
|
|
17
19
|
"dependencies": {
|
|
18
20
|
"lodash": "^4.17.21",
|
|
19
21
|
"reflect-metadata": "^0.1.13",
|
|
20
|
-
"typescript-rtti": "^0.
|
|
22
|
+
"typescript-rtti": "^0.8.0",
|
|
21
23
|
"xml-js": "^1.6.11"
|
|
22
24
|
},
|
|
23
25
|
"devDependencies": {
|
|
@@ -38,8 +40,8 @@
|
|
|
38
40
|
"typescript": "^4.7.4"
|
|
39
41
|
},
|
|
40
42
|
"files": [
|
|
41
|
-
"build/main",
|
|
42
|
-
"build/module",
|
|
43
|
+
"build/main/**",
|
|
44
|
+
"build/module/**",
|
|
43
45
|
"!**/*.spec.*",
|
|
44
46
|
"CHANGELOG.md",
|
|
45
47
|
"LICENSE",
|
package/.eslintignore
DELETED
package/.eslintrc.js
DELETED
package/.gitignore
DELETED
package/.vscode/launch.json
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": "0.2.0",
|
|
3
|
-
"configurations": [
|
|
4
|
-
{
|
|
5
|
-
"type": "node",
|
|
6
|
-
"request": "launch",
|
|
7
|
-
"name": "Mocha All",
|
|
8
|
-
"program": "${workspaceFolder}/node_modules/mocha/bin/_mocha",
|
|
9
|
-
"args": [
|
|
10
|
-
"-r",
|
|
11
|
-
"./register-ts-node",
|
|
12
|
-
"--timeout",
|
|
13
|
-
"999999",
|
|
14
|
-
"--colors",
|
|
15
|
-
"${workspaceFolder}/src/**/*.spec.ts"
|
|
16
|
-
],
|
|
17
|
-
"console": "integratedTerminal",
|
|
18
|
-
"internalConsoleOptions": "neverOpen"
|
|
19
|
-
}
|
|
20
|
-
]
|
|
21
|
-
}
|
package/.vscode/settings.json
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import "mocha";
|