@ygracs/xobj-lib-js 0.2.5-b → 0.2.6-b
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/CHANGELOG.md +1 -0
- package/index.d.ts +76 -53
- package/index.js +8 -1
- package/lib/xObj-defs.d.ts +142 -166
- package/lib/xObj-defs.js +1 -31
- package/lib/xObj-errors.d.ts +41 -0
- package/lib/xObj-errors.js +71 -0
- package/lib/xObj-lib.d.ts +297 -301
- package/lib/xObj-lib.js +82 -96
- package/package.json +2 -1
package/CHANGELOG.md
CHANGED
package/index.d.ts
CHANGED
|
@@ -1,53 +1,76 @@
|
|
|
1
|
-
declare const _exports: {
|
|
2
|
-
readXObjParamRaw: typeof import("./lib/xObj-lib").readXObjParamRaw;
|
|
3
|
-
readXObjParam: typeof import("./lib/xObj-lib").readXObjParam;
|
|
4
|
-
readXObjParamAsBool: typeof import("./lib/xObj-lib").readXObjParamAsBool;
|
|
5
|
-
readXObjParamAsNum: typeof import("./lib/xObj-lib").readXObjParamAsNum;
|
|
6
|
-
readXObjParamEx: typeof import("./lib/xObj-lib").readXObjParamEx;
|
|
7
|
-
readXObjParamAsIndex: typeof import("./lib/xObj-lib").readXObjParamAsIndex;
|
|
8
|
-
writeXObjParamRaw: typeof import("./lib/xObj-lib").writeXObjParamRaw;
|
|
9
|
-
writeXObjParam: typeof import("./lib/xObj-lib").writeXObjParam;
|
|
10
|
-
writeXObjParamAsBool: typeof import("./lib/xObj-lib").writeXObjParamAsBool;
|
|
11
|
-
writeXObjParamAsNum: typeof import("./lib/xObj-lib").writeXObjParamAsNum;
|
|
12
|
-
writeXObjParamAsIndex: typeof import("./lib/xObj-lib").writeXObjParamAsIndex;
|
|
13
|
-
writeXObjParamEx: typeof import("./lib/xObj-lib").writeXObjParamEx;
|
|
14
|
-
readXObjAttrRaw: typeof import("./lib/xObj-lib").readXObjAttrRaw;
|
|
15
|
-
readXObjAttr: typeof import("./lib/xObj-lib").readXObjAttr;
|
|
16
|
-
readXObjAttrAsBool: typeof import("./lib/xObj-lib").readXObjAttrAsBool;
|
|
17
|
-
readXObjAttrAsNum: typeof import("./lib/xObj-lib").readXObjAttrAsNum;
|
|
18
|
-
readXObjAttrEx: typeof import("./lib/xObj-lib").readXObjAttrEx;
|
|
19
|
-
readXObjAttrAsIndex: typeof import("./lib/xObj-lib").readXObjAttrAsIndex;
|
|
20
|
-
writeXObjAttrRaw: typeof import("./lib/xObj-lib").writeXObjAttrRaw;
|
|
21
|
-
writeXObjAttr: typeof import("./lib/xObj-lib").writeXObjAttr;
|
|
22
|
-
writeXObjAttrAsBool: typeof import("./lib/xObj-lib").writeXObjAttrAsBool;
|
|
23
|
-
writeXObjAttrAsNum: typeof import("./lib/xObj-lib").writeXObjAttrAsNum;
|
|
24
|
-
writeXObjAttrAsIndex: typeof import("./lib/xObj-lib").writeXObjAttrAsIndex;
|
|
25
|
-
writeXObjAttrEx: typeof import("./lib/xObj-lib").writeXObjAttrEx;
|
|
26
|
-
getXObjAttributes: typeof import("./lib/xObj-lib").getXObjAttributes;
|
|
27
|
-
checkXObjAttribute: typeof import("./lib/xObj-lib").checkXObjAttribute;
|
|
28
|
-
deleteXObjAttribute: typeof import("./lib/xObj-lib").deleteXObjAttribute;
|
|
29
|
-
renameXObjAttribute: typeof import("./lib/xObj-lib").renameXObjAttribute;
|
|
30
|
-
getXObjElement: typeof import("./lib/xObj-lib").getXObjElement;
|
|
31
|
-
addXObjElement: typeof import("./lib/xObj-lib").addXObjElement;
|
|
32
|
-
insertXObjElement: typeof import("./lib/xObj-lib").insertXObjElement;
|
|
33
|
-
insertXObjElementEx: typeof import("./lib/xObj-lib").insertXObjElementEx;
|
|
34
|
-
deleteXObjElement: typeof import("./lib/xObj-lib").deleteXObjElement;
|
|
35
|
-
deleteXObjElementEx: typeof import("./lib/xObj-lib").deleteXObjElementEx;
|
|
36
|
-
renameXObjElement: typeof import("./lib/xObj-lib").renameXObjElement;
|
|
37
|
-
evalXObjEName: typeof import("./lib/xObj-lib").evalXObjEName;
|
|
38
|
-
insertXObjEList: typeof import("./lib/xObj-lib").insertXObjEList;
|
|
39
|
-
insertXObjEListEx: typeof import("./lib/xObj-lib").insertXObjEListEx;
|
|
40
|
-
evalKeyName: typeof import("./lib/xObj-lib").evalKeyName;
|
|
41
|
-
genXObjENameDescr: typeof import("./lib/xObj-lib").genXObjENameDescr;
|
|
42
|
-
insertXObjElements: typeof import("./lib/xObj-lib").insertXObjElements;
|
|
43
|
-
insertXObjEChain: typeof import("./lib/xObj-lib").insertXObjEChain;
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
1
|
+
declare const _exports: {
|
|
2
|
+
readXObjParamRaw: typeof import("./lib/xObj-lib").readXObjParamRaw;
|
|
3
|
+
readXObjParam: typeof import("./lib/xObj-lib").readXObjParam;
|
|
4
|
+
readXObjParamAsBool: typeof import("./lib/xObj-lib").readXObjParamAsBool;
|
|
5
|
+
readXObjParamAsNum: typeof import("./lib/xObj-lib").readXObjParamAsNum;
|
|
6
|
+
readXObjParamEx: typeof import("./lib/xObj-lib").readXObjParamEx;
|
|
7
|
+
readXObjParamAsIndex: typeof import("./lib/xObj-lib").readXObjParamAsIndex;
|
|
8
|
+
writeXObjParamRaw: typeof import("./lib/xObj-lib").writeXObjParamRaw;
|
|
9
|
+
writeXObjParam: typeof import("./lib/xObj-lib").writeXObjParam;
|
|
10
|
+
writeXObjParamAsBool: typeof import("./lib/xObj-lib").writeXObjParamAsBool;
|
|
11
|
+
writeXObjParamAsNum: typeof import("./lib/xObj-lib").writeXObjParamAsNum;
|
|
12
|
+
writeXObjParamAsIndex: typeof import("./lib/xObj-lib").writeXObjParamAsIndex;
|
|
13
|
+
writeXObjParamEx: typeof import("./lib/xObj-lib").writeXObjParamEx;
|
|
14
|
+
readXObjAttrRaw: typeof import("./lib/xObj-lib").readXObjAttrRaw;
|
|
15
|
+
readXObjAttr: typeof import("./lib/xObj-lib").readXObjAttr;
|
|
16
|
+
readXObjAttrAsBool: typeof import("./lib/xObj-lib").readXObjAttrAsBool;
|
|
17
|
+
readXObjAttrAsNum: typeof import("./lib/xObj-lib").readXObjAttrAsNum;
|
|
18
|
+
readXObjAttrEx: typeof import("./lib/xObj-lib").readXObjAttrEx;
|
|
19
|
+
readXObjAttrAsIndex: typeof import("./lib/xObj-lib").readXObjAttrAsIndex;
|
|
20
|
+
writeXObjAttrRaw: typeof import("./lib/xObj-lib").writeXObjAttrRaw;
|
|
21
|
+
writeXObjAttr: typeof import("./lib/xObj-lib").writeXObjAttr;
|
|
22
|
+
writeXObjAttrAsBool: typeof import("./lib/xObj-lib").writeXObjAttrAsBool;
|
|
23
|
+
writeXObjAttrAsNum: typeof import("./lib/xObj-lib").writeXObjAttrAsNum;
|
|
24
|
+
writeXObjAttrAsIndex: typeof import("./lib/xObj-lib").writeXObjAttrAsIndex;
|
|
25
|
+
writeXObjAttrEx: typeof import("./lib/xObj-lib").writeXObjAttrEx;
|
|
26
|
+
getXObjAttributes: typeof import("./lib/xObj-lib").getXObjAttributes;
|
|
27
|
+
checkXObjAttribute: typeof import("./lib/xObj-lib").checkXObjAttribute;
|
|
28
|
+
deleteXObjAttribute: typeof import("./lib/xObj-lib").deleteXObjAttribute;
|
|
29
|
+
renameXObjAttribute: typeof import("./lib/xObj-lib").renameXObjAttribute;
|
|
30
|
+
getXObjElement: typeof import("./lib/xObj-lib").getXObjElement;
|
|
31
|
+
addXObjElement: typeof import("./lib/xObj-lib").addXObjElement;
|
|
32
|
+
insertXObjElement: typeof import("./lib/xObj-lib").insertXObjElement;
|
|
33
|
+
insertXObjElementEx: typeof import("./lib/xObj-lib").insertXObjElementEx;
|
|
34
|
+
deleteXObjElement: typeof import("./lib/xObj-lib").deleteXObjElement;
|
|
35
|
+
deleteXObjElementEx: typeof import("./lib/xObj-lib").deleteXObjElementEx;
|
|
36
|
+
renameXObjElement: typeof import("./lib/xObj-lib").renameXObjElement;
|
|
37
|
+
evalXObjEName: typeof import("./lib/xObj-lib").evalXObjEName;
|
|
38
|
+
insertXObjEList: typeof import("./lib/xObj-lib").insertXObjEList;
|
|
39
|
+
insertXObjEListEx: typeof import("./lib/xObj-lib").insertXObjEListEx;
|
|
40
|
+
evalKeyName: typeof import("./lib/xObj-lib").evalKeyName;
|
|
41
|
+
genXObjENameDescr: typeof import("./lib/xObj-lib").genXObjENameDescr;
|
|
42
|
+
insertXObjElements: typeof import("./lib/xObj-lib").insertXObjElements;
|
|
43
|
+
insertXObjEChain: typeof import("./lib/xObj-lib").insertXObjEChain;
|
|
44
|
+
TXmlContentParseOptions: typeof TXmlContentParseOptions;
|
|
45
|
+
DEF_XML_PARSE_OPTIONS: typeof DEF_XML_PARSE_OPTIONS;
|
|
46
|
+
XOBJ_DEF_TNAMES: typeof XOBJ_DEF_TNAMES;
|
|
47
|
+
EvalKeyNameError: typeof EvalKeyNameError;
|
|
48
|
+
|
|
49
|
+
xml2jsParseOptions: xml2jsParseOptions;
|
|
50
|
+
js2xmlParseOptions: js2xmlParseOptions;
|
|
51
|
+
OPT_parserOptions: OPT_parserOptions;
|
|
52
|
+
|
|
53
|
+
XObjENameDescr: XObjENameDescr;
|
|
54
|
+
OPT_inselops_L: OPT_inselops_L;
|
|
55
|
+
OPT_inselops_S: OPT_inselops_S;
|
|
56
|
+
RVAL_reason: RVAL_reason;
|
|
57
|
+
RVAL_emodif: RVAL_emodif;
|
|
58
|
+
VCOR_evalkname: VCOR_evalkname;
|
|
59
|
+
};
|
|
60
|
+
export = _exports;
|
|
61
|
+
import { TXmlContentParseOptions } from "./lib/xObj-defs";
|
|
62
|
+
import { DEF_XML_PARSE_OPTIONS } from "./lib/xObj-defs";
|
|
63
|
+
import { XOBJ_DEF_TNAMES } from "./lib/xObj-defs";
|
|
64
|
+
import { EvalKeyNameError } from "./lib/xObj-errors";
|
|
65
|
+
|
|
66
|
+
import type {
|
|
67
|
+
xml2jsParseOptions, js2xmlParseOptions,
|
|
68
|
+
OPT_parserOptions,
|
|
69
|
+
} from "./lib/xObj-defs";
|
|
70
|
+
|
|
71
|
+
import type {
|
|
72
|
+
XObjENameDescr,
|
|
73
|
+
OPT_inselops_L, OPT_inselops_S,
|
|
74
|
+
RVAL_reason, RVAL_emodif,
|
|
75
|
+
VCOR_evalkname,
|
|
76
|
+
} from "./lib/xObj-lib";
|
package/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// [v0.1.
|
|
1
|
+
// [v0.1.014-20251228]
|
|
2
2
|
|
|
3
3
|
// === module init block ===
|
|
4
4
|
|
|
@@ -8,6 +8,10 @@ const {
|
|
|
8
8
|
XOBJ_DEF_TNAMES,
|
|
9
9
|
} = require('./lib/xObj-defs');
|
|
10
10
|
|
|
11
|
+
const {
|
|
12
|
+
EvalKeyNameError,
|
|
13
|
+
} = require('./lib/xObj-errors');
|
|
14
|
+
|
|
11
15
|
// === module inner block ===
|
|
12
16
|
|
|
13
17
|
// === module main block ===
|
|
@@ -15,6 +19,9 @@ const {
|
|
|
15
19
|
// === module exports block ===
|
|
16
20
|
|
|
17
21
|
module.exports = require('./lib/xObj-lib');
|
|
22
|
+
|
|
18
23
|
module.exports.TXmlContentParseOptions = TXmlContentParseOptions;
|
|
19
24
|
module.exports.DEF_XML_PARSE_OPTIONS = DEF_XML_PARSE_OPTIONS;
|
|
20
25
|
module.exports.XOBJ_DEF_TNAMES = XOBJ_DEF_TNAMES;
|
|
26
|
+
|
|
27
|
+
module.exports.EvalKeyNameError = EvalKeyNameError;
|
package/lib/xObj-defs.d.ts
CHANGED
|
@@ -1,166 +1,142 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* A parser options settings
|
|
3
|
-
*/
|
|
4
|
-
export type OPT_parserOptions = {
|
|
5
|
-
compact?: boolean
|
|
6
|
-
declarationKey?: string
|
|
7
|
-
attributesKey?: string
|
|
8
|
-
textKey?: string
|
|
9
|
-
commentKey?: string
|
|
10
|
-
cdataKey?: string
|
|
11
|
-
nameKey?: string
|
|
12
|
-
typeKey?: string
|
|
13
|
-
parentKey?: string
|
|
14
|
-
elementsKey?: string
|
|
15
|
-
ignoreDeclaration?: boolean
|
|
16
|
-
ignoreDocType?: boolean
|
|
17
|
-
ignoreInstraction?: boolean
|
|
18
|
-
ignoreText?: boolean
|
|
19
|
-
ignoreComment?: boolean
|
|
20
|
-
ignoreCData?: boolean
|
|
21
|
-
fullTagEmptyElement?: boolean
|
|
22
|
-
addParent?: boolean
|
|
23
|
-
trim?: boolean
|
|
24
|
-
spaces?: any;
|
|
25
|
-
};
|
|
26
|
-
/**
|
|
27
|
-
* A parser options to convert an 'XML'-string into a 'JS'-object
|
|
28
|
-
*/
|
|
29
|
-
export type xml2jsParseOptions = {
|
|
30
|
-
compact?: boolean
|
|
31
|
-
declarationKey?: string
|
|
32
|
-
attributesKey?: string
|
|
33
|
-
textKey?: string
|
|
34
|
-
commentKey?: string
|
|
35
|
-
cdataKey?: string
|
|
36
|
-
nameKey?: string
|
|
37
|
-
typeKey?: string
|
|
38
|
-
parentKey?: string
|
|
39
|
-
elementsKey?: string
|
|
40
|
-
ignoreDeclaration?: boolean
|
|
41
|
-
ignoreDocType?: boolean
|
|
42
|
-
ignoreInstraction?: boolean
|
|
43
|
-
ignoreText?: boolean
|
|
44
|
-
ignoreComment?: boolean
|
|
45
|
-
ignoreCData?: boolean
|
|
46
|
-
addParent?: boolean
|
|
47
|
-
trim?: boolean
|
|
48
|
-
};
|
|
49
|
-
/**
|
|
50
|
-
* A parser options to convert a 'JS'-object into an 'XML'-string
|
|
51
|
-
*/
|
|
52
|
-
export type js2xmlParseOptions = {
|
|
53
|
-
compact?: boolean
|
|
54
|
-
declarationKey?: string
|
|
55
|
-
attributesKey?: string
|
|
56
|
-
textKey?: string
|
|
57
|
-
commentKey?: string
|
|
58
|
-
cdataKey?: string
|
|
59
|
-
nameKey?: string
|
|
60
|
-
typeKey?: string
|
|
61
|
-
parentKey?: string
|
|
62
|
-
elementsKey?: string
|
|
63
|
-
ignoreDeclaration?: boolean
|
|
64
|
-
ignoreDocType?: boolean
|
|
65
|
-
ignoreInstraction?: boolean
|
|
66
|
-
ignoreText?: boolean
|
|
67
|
-
ignoreComment?: boolean
|
|
68
|
-
ignoreCData?: boolean
|
|
69
|
-
fullTagEmptyElement?: boolean
|
|
70
|
-
spaces?: any;
|
|
71
|
-
};
|
|
72
|
-
|
|
73
|
-
export const
|
|
74
|
-
export
|
|
75
|
-
|
|
76
|
-
export {
|
|
77
|
-
export {
|
|
78
|
-
export {
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
export
|
|
83
|
-
export {
|
|
84
|
-
export {
|
|
85
|
-
export {
|
|
86
|
-
export
|
|
87
|
-
export {
|
|
88
|
-
export
|
|
89
|
-
export
|
|
90
|
-
export
|
|
91
|
-
export
|
|
92
|
-
export
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
export let
|
|
96
|
-
export
|
|
97
|
-
export
|
|
98
|
-
|
|
99
|
-
export let
|
|
100
|
-
export
|
|
101
|
-
export let
|
|
102
|
-
export let
|
|
103
|
-
export let
|
|
104
|
-
export let
|
|
105
|
-
export let
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
/**
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
* Contains a set of a settings for converting an 'JS'-object to 'XML'
|
|
144
|
-
*/
|
|
145
|
-
get js2xml(): js2xmlParseOptions;
|
|
146
|
-
/**
|
|
147
|
-
* Contains a set of a reserved key words
|
|
148
|
-
*/
|
|
149
|
-
get reservedKeys(): Set<string>;
|
|
150
|
-
#private;
|
|
151
|
-
}
|
|
152
|
-
declare const XOBJ_DEF_DECL_TNAME: "__decl";
|
|
153
|
-
declare const XOBJ_DEF_CDATA_TNAME: "__cdata";
|
|
154
|
-
declare const XOBJ_TE_NOBJ_EMSG: "invalid argument (an object expected)";
|
|
155
|
-
declare const XOBJ_TE_NOBJ_ECODE: "ERR_XOBJ_NOBJ";
|
|
156
|
-
declare const XOBJ_TE_NARR_EMSG: "invalid argument (an array expected)";
|
|
157
|
-
declare const XOBJ_TE_NARR_ECODE: "ERR_XOBJ_NARR";
|
|
158
|
-
declare const XOBJ_TE_NSTR_EMSG: "invalid argument (a string expected)";
|
|
159
|
-
declare const XOBJ_TE_NSTR_ECODE: "ERR_XOBJ_NSTR";
|
|
160
|
-
declare const XOBJ_TE_NPOBJ_EMSG: "invalid argument (a plain object expected)";
|
|
161
|
-
declare const XOBJ_TE_NPOBJ_ECODE: "ERR_XOBJ_NPOBJ";
|
|
162
|
-
declare const XOBJ_TE_ANES_EMSG: "<attr_name> must be a non-empty string";
|
|
163
|
-
declare const XOBJ_TE_ANES_ECODE: "ERR_XOBJ_INVARG_ATTR";
|
|
164
|
-
declare const XOBJ_TE_KNES_EMSG: "<key_name> must be a non-empty string";
|
|
165
|
-
declare const XOBJ_TE_KNES_ECODE: "ERR_XOBJ_INVARG_KEY";
|
|
166
|
-
export {};
|
|
1
|
+
/**
|
|
2
|
+
* A parser options settings
|
|
3
|
+
*/
|
|
4
|
+
export type OPT_parserOptions = {
|
|
5
|
+
compact?: boolean;
|
|
6
|
+
declarationKey?: string;
|
|
7
|
+
attributesKey?: string;
|
|
8
|
+
textKey?: string;
|
|
9
|
+
commentKey?: string;
|
|
10
|
+
cdataKey?: string;
|
|
11
|
+
nameKey?: string;
|
|
12
|
+
typeKey?: string;
|
|
13
|
+
parentKey?: string;
|
|
14
|
+
elementsKey?: string;
|
|
15
|
+
ignoreDeclaration?: boolean;
|
|
16
|
+
ignoreDocType?: boolean;
|
|
17
|
+
ignoreInstraction?: boolean;
|
|
18
|
+
ignoreText?: boolean;
|
|
19
|
+
ignoreComment?: boolean;
|
|
20
|
+
ignoreCData?: boolean;
|
|
21
|
+
fullTagEmptyElement?: boolean;
|
|
22
|
+
addParent?: boolean;
|
|
23
|
+
trim?: boolean;
|
|
24
|
+
spaces?: any;
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* A parser options to convert an 'XML'-string into a 'JS'-object
|
|
28
|
+
*/
|
|
29
|
+
export type xml2jsParseOptions = {
|
|
30
|
+
compact?: boolean;
|
|
31
|
+
declarationKey?: string;
|
|
32
|
+
attributesKey?: string;
|
|
33
|
+
textKey?: string;
|
|
34
|
+
commentKey?: string;
|
|
35
|
+
cdataKey?: string;
|
|
36
|
+
nameKey?: string;
|
|
37
|
+
typeKey?: string;
|
|
38
|
+
parentKey?: string;
|
|
39
|
+
elementsKey?: string;
|
|
40
|
+
ignoreDeclaration?: boolean;
|
|
41
|
+
ignoreDocType?: boolean;
|
|
42
|
+
ignoreInstraction?: boolean;
|
|
43
|
+
ignoreText?: boolean;
|
|
44
|
+
ignoreComment?: boolean;
|
|
45
|
+
ignoreCData?: boolean;
|
|
46
|
+
addParent?: boolean;
|
|
47
|
+
trim?: boolean;
|
|
48
|
+
};
|
|
49
|
+
/**
|
|
50
|
+
* A parser options to convert a 'JS'-object into an 'XML'-string
|
|
51
|
+
*/
|
|
52
|
+
export type js2xmlParseOptions = {
|
|
53
|
+
compact?: boolean;
|
|
54
|
+
declarationKey?: string;
|
|
55
|
+
attributesKey?: string;
|
|
56
|
+
textKey?: string;
|
|
57
|
+
commentKey?: string;
|
|
58
|
+
cdataKey?: string;
|
|
59
|
+
nameKey?: string;
|
|
60
|
+
typeKey?: string;
|
|
61
|
+
parentKey?: string;
|
|
62
|
+
elementsKey?: string;
|
|
63
|
+
ignoreDeclaration?: boolean;
|
|
64
|
+
ignoreDocType?: boolean;
|
|
65
|
+
ignoreInstraction?: boolean;
|
|
66
|
+
ignoreText?: boolean;
|
|
67
|
+
ignoreComment?: boolean;
|
|
68
|
+
ignoreCData?: boolean;
|
|
69
|
+
fullTagEmptyElement?: boolean;
|
|
70
|
+
spaces?: any;
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
export const XOBJ_DEF_PARAM_TNAME: "__text";
|
|
74
|
+
export const XOBJ_DEF_ATTR_TNAME: "__attr";
|
|
75
|
+
export namespace XOBJ_DEF_TNAMES {
|
|
76
|
+
export { XOBJ_DEF_PARAM_TNAME };
|
|
77
|
+
export { XOBJ_DEF_ATTR_TNAME };
|
|
78
|
+
export { XOBJ_DEF_DECL_TNAME };
|
|
79
|
+
export { XOBJ_DEF_CDATA_TNAME };
|
|
80
|
+
}
|
|
81
|
+
export namespace DEF_XML_PARSE_OPTIONS {
|
|
82
|
+
export let compact: boolean;
|
|
83
|
+
export { XOBJ_DEF_DECL_TNAME as declarationKey };
|
|
84
|
+
export { XOBJ_DEF_ATTR_TNAME as attributesKey };
|
|
85
|
+
export { XOBJ_DEF_PARAM_TNAME as textKey };
|
|
86
|
+
export let commentKey: string;
|
|
87
|
+
export { XOBJ_DEF_CDATA_TNAME as cdataKey };
|
|
88
|
+
export let nameKey: string;
|
|
89
|
+
export let typeKey: string;
|
|
90
|
+
export let parentKey: string;
|
|
91
|
+
export let elementsKey: string;
|
|
92
|
+
export let ignoreDeclaration: boolean;
|
|
93
|
+
export let ignoreDocType: boolean;
|
|
94
|
+
/** @deprecated */
|
|
95
|
+
export let ignoreInstractions: boolean;
|
|
96
|
+
export let ignoreInstraction: boolean;
|
|
97
|
+
export let ignoreText: boolean;
|
|
98
|
+
/** @deprecated */
|
|
99
|
+
export let ignoreComments: boolean;
|
|
100
|
+
export let ignoreComment: boolean;
|
|
101
|
+
export let ignoreCData: boolean;
|
|
102
|
+
export let fullTagEmptyElement: boolean;
|
|
103
|
+
export let addParent: boolean;
|
|
104
|
+
export let trim: boolean;
|
|
105
|
+
export let spaces: number;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* @classdesc Implements a container that provide a functionality to work
|
|
110
|
+
* with options for an XML-parser
|
|
111
|
+
*/
|
|
112
|
+
export class TXmlContentParseOptions {
|
|
113
|
+
/**
|
|
114
|
+
* Creates a container instance
|
|
115
|
+
*/
|
|
116
|
+
static createNewOptionsSet(opt?: any): OPT_parserOptions;
|
|
117
|
+
/**
|
|
118
|
+
* Creates a container instance
|
|
119
|
+
*/
|
|
120
|
+
constructor(param?: any);
|
|
121
|
+
/**
|
|
122
|
+
* Contains a set of a current settings
|
|
123
|
+
*/
|
|
124
|
+
get settings(): OPT_parserOptions;
|
|
125
|
+
/**
|
|
126
|
+
* Contains a set of a settings for converting an 'XML' to 'JS'-object
|
|
127
|
+
*/
|
|
128
|
+
get xml2js(): xml2jsParseOptions;
|
|
129
|
+
/**
|
|
130
|
+
* Contains a set of a settings for converting an 'JS'-object to 'XML'
|
|
131
|
+
*/
|
|
132
|
+
get js2xml(): js2xmlParseOptions;
|
|
133
|
+
/**
|
|
134
|
+
* Contains a set of a reserved key words
|
|
135
|
+
*/
|
|
136
|
+
get reservedKeys(): Set<string>;
|
|
137
|
+
#private;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
declare const XOBJ_DEF_DECL_TNAME: "__decl";
|
|
141
|
+
declare const XOBJ_DEF_CDATA_TNAME: "__cdata";
|
|
142
|
+
export {};
|
package/lib/xObj-defs.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// [v0.1.
|
|
1
|
+
// [v0.1.068-20251229]
|
|
2
2
|
|
|
3
3
|
// === module init block ===
|
|
4
4
|
|
|
@@ -26,35 +26,6 @@ const XOBJ_DEF_TNAMES = {
|
|
|
26
26
|
XOBJ_DEF_CDATA_TNAME,
|
|
27
27
|
};
|
|
28
28
|
|
|
29
|
-
const XOBJ_TE_INVARG_EMSG = 'invalid argument';
|
|
30
|
-
const XOBJ_TE_NOBJ_EMSG = `${XOBJ_TE_INVARG_EMSG} (an object expected)`;
|
|
31
|
-
const XOBJ_TE_NOBJ_ECODE = 'ERR_XOBJ_NOBJ';
|
|
32
|
-
const XOBJ_TE_NARR_EMSG = `${XOBJ_TE_INVARG_EMSG} (an array expected)`;
|
|
33
|
-
const XOBJ_TE_NARR_ECODE = 'ERR_XOBJ_NARR';
|
|
34
|
-
const XOBJ_TE_NSTR_EMSG = `${XOBJ_TE_INVARG_EMSG} (a string expected)`;
|
|
35
|
-
const XOBJ_TE_NSTR_ECODE = 'ERR_XOBJ_NSTR';
|
|
36
|
-
const XOBJ_TE_NPOBJ_EMSG = `${XOBJ_TE_INVARG_EMSG} (a plain object expected)`;
|
|
37
|
-
const XOBJ_TE_NPOBJ_ECODE = 'ERR_XOBJ_NPOBJ';
|
|
38
|
-
const XOBJ_TE_ANES_EMSG = '<attr_name> must be a non-empty string';
|
|
39
|
-
const XOBJ_TE_ANES_ECODE = 'ERR_XOBJ_INVARG_ATTR';
|
|
40
|
-
const XOBJ_TE_KNES_EMSG = '<key_name> must be a non-empty string';
|
|
41
|
-
const XOBJ_TE_KNES_ECODE = 'ERR_XOBJ_INVARG_KEY';
|
|
42
|
-
|
|
43
|
-
const XOBJ_ECODE_TABLE = {
|
|
44
|
-
XOBJ_TE_NOBJ_EMSG,
|
|
45
|
-
XOBJ_TE_NOBJ_ECODE,
|
|
46
|
-
XOBJ_TE_NARR_EMSG,
|
|
47
|
-
XOBJ_TE_NARR_ECODE,
|
|
48
|
-
XOBJ_TE_NSTR_EMSG,
|
|
49
|
-
XOBJ_TE_NSTR_ECODE,
|
|
50
|
-
XOBJ_TE_NPOBJ_EMSG,
|
|
51
|
-
XOBJ_TE_NPOBJ_ECODE,
|
|
52
|
-
XOBJ_TE_ANES_EMSG,
|
|
53
|
-
XOBJ_TE_ANES_ECODE,
|
|
54
|
-
XOBJ_TE_KNES_EMSG,
|
|
55
|
-
XOBJ_TE_KNES_ECODE,
|
|
56
|
-
};
|
|
57
|
-
|
|
58
29
|
/**
|
|
59
30
|
* A parser options settings
|
|
60
31
|
* @typedef {Object} OPT_parserOptions
|
|
@@ -316,7 +287,6 @@ class TXmlContentParseOptions {
|
|
|
316
287
|
module.exports.XOBJ_DEF_PARAM_TNAME = XOBJ_DEF_PARAM_TNAME;
|
|
317
288
|
module.exports.XOBJ_DEF_ATTR_TNAME = XOBJ_DEF_ATTR_TNAME;
|
|
318
289
|
module.exports.XOBJ_DEF_TNAMES = XOBJ_DEF_TNAMES;
|
|
319
|
-
module.exports.XOBJ_ECODE_TABLE = XOBJ_ECODE_TABLE;
|
|
320
290
|
module.exports.DEF_XML_PARSE_OPTIONS = DEF_XML_PARSE_OPTIONS;
|
|
321
291
|
|
|
322
292
|
module.exports.TXmlContentParseOptions = TXmlContentParseOptions;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
export namespace XOBJ_ECODE_TABLE {
|
|
2
|
+
export { XOBJ_TE_NOBJ_EMSG };
|
|
3
|
+
export { XOBJ_TE_NOBJ_ECODE };
|
|
4
|
+
export { XOBJ_TE_NARR_EMSG };
|
|
5
|
+
export { XOBJ_TE_NARR_ECODE };
|
|
6
|
+
export { XOBJ_TE_NSTR_EMSG };
|
|
7
|
+
export { XOBJ_TE_NSTR_ECODE };
|
|
8
|
+
export { XOBJ_TE_NPOBJ_EMSG };
|
|
9
|
+
export { XOBJ_TE_NPOBJ_ECODE };
|
|
10
|
+
export { XOBJ_TE_ANES_EMSG };
|
|
11
|
+
export { XOBJ_TE_ANES_ECODE };
|
|
12
|
+
export { XOBJ_TE_KNES_EMSG };
|
|
13
|
+
export { XOBJ_TE_KNES_ECODE };
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* @classdesc Extends a base `TypeError` object to provide some information
|
|
17
|
+
* on the errors thrown when a key name evaluation failed
|
|
18
|
+
*/
|
|
19
|
+
export class EvalKeyNameError extends TypeError {
|
|
20
|
+
/**
|
|
21
|
+
* Creates a new instance
|
|
22
|
+
*/
|
|
23
|
+
constructor(msg: string, options?: any);
|
|
24
|
+
/**
|
|
25
|
+
* Represents an error code
|
|
26
|
+
*/
|
|
27
|
+
code: string;
|
|
28
|
+
}
|
|
29
|
+
declare const XOBJ_TE_NOBJ_EMSG: "invalid argument (an object expected)";
|
|
30
|
+
declare const XOBJ_TE_NOBJ_ECODE: "ERR_XOBJ_NOBJ";
|
|
31
|
+
declare const XOBJ_TE_NARR_EMSG: "invalid argument (an array expected)";
|
|
32
|
+
declare const XOBJ_TE_NARR_ECODE: "ERR_XOBJ_NARR";
|
|
33
|
+
declare const XOBJ_TE_NSTR_EMSG: "invalid argument (a string expected)";
|
|
34
|
+
declare const XOBJ_TE_NSTR_ECODE: "ERR_XOBJ_NSTR";
|
|
35
|
+
declare const XOBJ_TE_NPOBJ_EMSG: "invalid argument (a plain object expected)";
|
|
36
|
+
declare const XOBJ_TE_NPOBJ_ECODE: "ERR_XOBJ_NPOBJ";
|
|
37
|
+
declare const XOBJ_TE_ANES_EMSG: "<attr_name> must be a non-empty string";
|
|
38
|
+
declare const XOBJ_TE_ANES_ECODE: "ERR_XOBJ_INVARG_ATTR";
|
|
39
|
+
declare const XOBJ_TE_KNES_EMSG: "<key_name> must be a non-empty string";
|
|
40
|
+
declare const XOBJ_TE_KNES_ECODE: "ERR_XOBJ_INVARG_KEY";
|
|
41
|
+
export {};
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
// [v0.1.003-20251229]
|
|
2
|
+
|
|
3
|
+
// === module init block ===
|
|
4
|
+
|
|
5
|
+
const {
|
|
6
|
+
isPlainObject,
|
|
7
|
+
} = require('@ygracs/bsfoc-lib-js');
|
|
8
|
+
|
|
9
|
+
// === module inner block ===
|
|
10
|
+
|
|
11
|
+
// === module main block ===
|
|
12
|
+
|
|
13
|
+
const XOBJ_TE_INVARG_EMSG = 'invalid argument';
|
|
14
|
+
const XOBJ_TE_NOBJ_EMSG = `${XOBJ_TE_INVARG_EMSG} (an object expected)`;
|
|
15
|
+
const XOBJ_TE_NOBJ_ECODE = 'ERR_XOBJ_NOBJ';
|
|
16
|
+
const XOBJ_TE_NARR_EMSG = `${XOBJ_TE_INVARG_EMSG} (an array expected)`;
|
|
17
|
+
const XOBJ_TE_NARR_ECODE = 'ERR_XOBJ_NARR';
|
|
18
|
+
const XOBJ_TE_NSTR_EMSG = `${XOBJ_TE_INVARG_EMSG} (a string expected)`;
|
|
19
|
+
const XOBJ_TE_NSTR_ECODE = 'ERR_XOBJ_NSTR';
|
|
20
|
+
const XOBJ_TE_NPOBJ_EMSG = `${XOBJ_TE_INVARG_EMSG} (a plain object expected)`;
|
|
21
|
+
const XOBJ_TE_NPOBJ_ECODE = 'ERR_XOBJ_NPOBJ';
|
|
22
|
+
const XOBJ_TE_ANES_EMSG = '<attr_name> must be a non-empty string';
|
|
23
|
+
const XOBJ_TE_ANES_ECODE = 'ERR_XOBJ_INVARG_ATTR';
|
|
24
|
+
const XOBJ_TE_KNES_EMSG = '<key_name> must be a non-empty string';
|
|
25
|
+
const XOBJ_TE_KNES_ECODE = 'ERR_XOBJ_INVARG_KEY';
|
|
26
|
+
|
|
27
|
+
const XOBJ_ECODE_TABLE = {
|
|
28
|
+
XOBJ_TE_NOBJ_EMSG,
|
|
29
|
+
XOBJ_TE_NOBJ_ECODE,
|
|
30
|
+
XOBJ_TE_NARR_EMSG,
|
|
31
|
+
XOBJ_TE_NARR_ECODE,
|
|
32
|
+
XOBJ_TE_NSTR_EMSG,
|
|
33
|
+
XOBJ_TE_NSTR_ECODE,
|
|
34
|
+
XOBJ_TE_NPOBJ_EMSG,
|
|
35
|
+
XOBJ_TE_NPOBJ_ECODE,
|
|
36
|
+
XOBJ_TE_ANES_EMSG,
|
|
37
|
+
XOBJ_TE_ANES_ECODE,
|
|
38
|
+
XOBJ_TE_KNES_EMSG,
|
|
39
|
+
XOBJ_TE_KNES_ECODE,
|
|
40
|
+
};
|
|
41
|
+
module.exports.XOBJ_ECODE_TABLE = XOBJ_ECODE_TABLE;
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* @augments TypeError
|
|
45
|
+
* @classdesc Extends a base `TypeError` object to provide some information
|
|
46
|
+
* on the errors thrown when a key name evaluation failed
|
|
47
|
+
*/
|
|
48
|
+
class EvalKeyNameError extends TypeError {
|
|
49
|
+
/**
|
|
50
|
+
* Creates a new instance
|
|
51
|
+
* @param {string} msg - some user error message
|
|
52
|
+
* @param {*} [options] - user options
|
|
53
|
+
*/
|
|
54
|
+
constructor(msg, options) {
|
|
55
|
+
super(msg, options);
|
|
56
|
+
/** @type {string} */
|
|
57
|
+
this.name = 'EvalKeyNameError';
|
|
58
|
+
const code = (
|
|
59
|
+
isPlainObject(options) && typeof options.code === 'string'
|
|
60
|
+
? options.code
|
|
61
|
+
: ''
|
|
62
|
+
);
|
|
63
|
+
/**
|
|
64
|
+
* Represents an error code
|
|
65
|
+
* @type {string}
|
|
66
|
+
*/
|
|
67
|
+
this.code = code;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
};
|
|
71
|
+
module.exports.EvalKeyNameError = EvalKeyNameError;
|