@cdk8s/awscdk-resolver 0.0.509 → 0.0.511
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/.jsii +3 -3
- package/lib/resolve.js +1 -1
- package/node_modules/@aws-sdk/client-cloudformation/package.json +2 -2
- package/node_modules/@smithy/util-waiter/dist-cjs/index.js +1 -1
- package/node_modules/@smithy/util-waiter/dist-es/poller.js +1 -1
- package/node_modules/@smithy/util-waiter/package.json +1 -1
- package/node_modules/fast-xml-builder/CHANGELOG.md +13 -0
- package/node_modules/fast-xml-builder/README.md +1 -1
- package/node_modules/fast-xml-builder/lib/fxb.cjs +1 -0
- package/node_modules/fast-xml-builder/lib/fxb.d.cts +13 -9
- package/node_modules/fast-xml-builder/lib/fxb.min.js +2 -0
- package/node_modules/fast-xml-builder/lib/fxb.min.js.map +1 -0
- package/node_modules/fast-xml-builder/package.json +7 -5
- package/node_modules/fast-xml-builder/src/fxb.d.ts +17 -3
- package/node_modules/fast-xml-builder/src/fxb.js +262 -21
- package/node_modules/fast-xml-builder/src/orderedJs2Xml.js +161 -18
- package/node_modules/path-expression-matcher/LICENSE +21 -0
- package/node_modules/path-expression-matcher/README.md +635 -0
- package/node_modules/path-expression-matcher/lib/pem.cjs +1 -0
- package/node_modules/path-expression-matcher/lib/pem.d.cts +335 -0
- package/node_modules/path-expression-matcher/lib/pem.min.js +2 -0
- package/node_modules/path-expression-matcher/lib/pem.min.js.map +1 -0
- package/node_modules/path-expression-matcher/package.json +78 -0
- package/node_modules/path-expression-matcher/src/Expression.js +232 -0
- package/node_modules/path-expression-matcher/src/Matcher.js +414 -0
- package/node_modules/path-expression-matcher/src/index.d.ts +366 -0
- package/node_modules/path-expression-matcher/src/index.js +28 -0
- package/package.json +2 -2
- package/node_modules/fast-xml-builder/lib/builder.cjs +0 -1
- package/node_modules/fast-xml-builder/lib/builder.min.js +0 -2
- package/node_modules/fast-xml-builder/lib/builder.min.js.map +0 -1
|
@@ -0,0 +1,366 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TypeScript definitions for path-expression-matcher
|
|
3
|
+
*
|
|
4
|
+
* Provides efficient path tracking and pattern matching for XML/JSON parsers.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Options for creating an Expression
|
|
9
|
+
*/
|
|
10
|
+
export interface ExpressionOptions {
|
|
11
|
+
/**
|
|
12
|
+
* Path separator character
|
|
13
|
+
* @default '.'
|
|
14
|
+
*/
|
|
15
|
+
separator?: string;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Parsed segment from an expression pattern
|
|
20
|
+
*/
|
|
21
|
+
export interface Segment {
|
|
22
|
+
/**
|
|
23
|
+
* Type of segment
|
|
24
|
+
*/
|
|
25
|
+
type: 'tag' | 'deep-wildcard';
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Tag name (e.g., "user", "*" for wildcard)
|
|
29
|
+
* Only present when type is 'tag'
|
|
30
|
+
*/
|
|
31
|
+
tag?: string;
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Namespace prefix (e.g., "ns" in "ns::user")
|
|
35
|
+
* Only present when namespace is specified
|
|
36
|
+
*/
|
|
37
|
+
namespace?: string;
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Attribute name to match (e.g., "id" in "user[id]")
|
|
41
|
+
* Only present when attribute condition exists
|
|
42
|
+
*/
|
|
43
|
+
attrName?: string;
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Attribute value to match (e.g., "123" in "user[id=123]")
|
|
47
|
+
* Only present when attribute value is specified
|
|
48
|
+
*/
|
|
49
|
+
attrValue?: string;
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Position selector type
|
|
53
|
+
* Only present when position selector exists
|
|
54
|
+
*/
|
|
55
|
+
position?: 'first' | 'last' | 'odd' | 'even' | 'nth';
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Numeric value for nth() selector
|
|
59
|
+
* Only present when position is 'nth'
|
|
60
|
+
*/
|
|
61
|
+
positionValue?: number;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Expression - Parses and stores a tag pattern expression
|
|
66
|
+
*
|
|
67
|
+
* Patterns are parsed once and stored in an optimized structure for fast matching.
|
|
68
|
+
*
|
|
69
|
+
* @example
|
|
70
|
+
* ```typescript
|
|
71
|
+
* const expr = new Expression("root.users.user");
|
|
72
|
+
* const expr2 = new Expression("..user[id]:first");
|
|
73
|
+
* const expr3 = new Expression("root/users/user", { separator: '/' });
|
|
74
|
+
* ```
|
|
75
|
+
*
|
|
76
|
+
* Pattern Syntax:
|
|
77
|
+
* - `root.users.user` - Match exact path
|
|
78
|
+
* - `..user` - Match "user" at any depth (deep wildcard)
|
|
79
|
+
* - `user[id]` - Match user tag with "id" attribute
|
|
80
|
+
* - `user[id=123]` - Match user tag where id="123"
|
|
81
|
+
* - `user:first` - Match first occurrence of user tag
|
|
82
|
+
* - `ns::user` - Match user tag with namespace "ns"
|
|
83
|
+
* - `ns::user[id]:first` - Combine namespace, attribute, and position
|
|
84
|
+
*/
|
|
85
|
+
export class Expression {
|
|
86
|
+
/**
|
|
87
|
+
* Original pattern string
|
|
88
|
+
*/
|
|
89
|
+
readonly pattern: string;
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Path separator character
|
|
93
|
+
*/
|
|
94
|
+
readonly separator: string;
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Parsed segments
|
|
98
|
+
*/
|
|
99
|
+
readonly segments: Segment[];
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Create a new Expression
|
|
103
|
+
* @param pattern - Pattern string (e.g., "root.users.user", "..user[id]")
|
|
104
|
+
* @param options - Configuration options
|
|
105
|
+
*/
|
|
106
|
+
constructor(pattern: string, options?: ExpressionOptions);
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* Get the number of segments
|
|
110
|
+
*/
|
|
111
|
+
get length(): number;
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Check if expression contains deep wildcard (..)
|
|
115
|
+
*/
|
|
116
|
+
hasDeepWildcard(): boolean;
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* Check if expression has attribute conditions
|
|
120
|
+
*/
|
|
121
|
+
hasAttributeCondition(): boolean;
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* Check if expression has position selectors
|
|
125
|
+
*/
|
|
126
|
+
hasPositionSelector(): boolean;
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* Get string representation
|
|
130
|
+
*/
|
|
131
|
+
toString(): string;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* Options for creating a Matcher
|
|
136
|
+
*/
|
|
137
|
+
export interface MatcherOptions {
|
|
138
|
+
/**
|
|
139
|
+
* Default path separator
|
|
140
|
+
* @default '.'
|
|
141
|
+
*/
|
|
142
|
+
separator?: string;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* Internal node structure in the path stack
|
|
147
|
+
*/
|
|
148
|
+
export interface PathNode {
|
|
149
|
+
/**
|
|
150
|
+
* Tag name
|
|
151
|
+
*/
|
|
152
|
+
tag: string;
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* Namespace (if present)
|
|
156
|
+
*/
|
|
157
|
+
namespace?: string;
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* Position in sibling list (child index in parent)
|
|
161
|
+
*/
|
|
162
|
+
position: number;
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* Counter (occurrence count of this tag name)
|
|
166
|
+
*/
|
|
167
|
+
counter: number;
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* Attribute key-value pairs
|
|
171
|
+
* Only present for the current (last) node in path
|
|
172
|
+
*/
|
|
173
|
+
values?: Record<string, any>;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
/**
|
|
177
|
+
* Snapshot of matcher state
|
|
178
|
+
*/
|
|
179
|
+
export interface MatcherSnapshot {
|
|
180
|
+
/**
|
|
181
|
+
* Copy of the path stack
|
|
182
|
+
*/
|
|
183
|
+
path: PathNode[];
|
|
184
|
+
|
|
185
|
+
/**
|
|
186
|
+
* Copy of sibling tracking maps
|
|
187
|
+
*/
|
|
188
|
+
siblingStacks: Map<string, number>[];
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
/**
|
|
192
|
+
* Matcher - Tracks current path in XML/JSON tree and matches against Expressions
|
|
193
|
+
*
|
|
194
|
+
* The matcher maintains a stack of nodes representing the current path from root to
|
|
195
|
+
* current tag. It only stores attribute values for the current (top) node to minimize
|
|
196
|
+
* memory usage.
|
|
197
|
+
*
|
|
198
|
+
* @example
|
|
199
|
+
* ```typescript
|
|
200
|
+
* const matcher = new Matcher();
|
|
201
|
+
* matcher.push("root", {});
|
|
202
|
+
* matcher.push("users", {});
|
|
203
|
+
* matcher.push("user", { id: "123", type: "admin" });
|
|
204
|
+
*
|
|
205
|
+
* const expr = new Expression("root.users.user");
|
|
206
|
+
* matcher.matches(expr); // true
|
|
207
|
+
*
|
|
208
|
+
* matcher.pop();
|
|
209
|
+
* matcher.matches(expr); // false
|
|
210
|
+
* ```
|
|
211
|
+
*/
|
|
212
|
+
export class Matcher {
|
|
213
|
+
/**
|
|
214
|
+
* Default path separator
|
|
215
|
+
*/
|
|
216
|
+
readonly separator: string;
|
|
217
|
+
|
|
218
|
+
/**
|
|
219
|
+
* Current path stack
|
|
220
|
+
*/
|
|
221
|
+
readonly path: PathNode[];
|
|
222
|
+
|
|
223
|
+
/**
|
|
224
|
+
* Create a new Matcher
|
|
225
|
+
* @param options - Configuration options
|
|
226
|
+
*/
|
|
227
|
+
constructor(options?: MatcherOptions);
|
|
228
|
+
|
|
229
|
+
/**
|
|
230
|
+
* Push a new tag onto the path
|
|
231
|
+
* @param tagName - Name of the tag
|
|
232
|
+
* @param attrValues - Attribute key-value pairs for current node (optional)
|
|
233
|
+
* @param namespace - Namespace for the tag (optional)
|
|
234
|
+
*
|
|
235
|
+
* @example
|
|
236
|
+
* ```typescript
|
|
237
|
+
* matcher.push("user", { id: "123", type: "admin" });
|
|
238
|
+
* matcher.push("user", { id: "456" }, "ns");
|
|
239
|
+
* matcher.push("container", null);
|
|
240
|
+
* ```
|
|
241
|
+
*/
|
|
242
|
+
push(tagName: string, attrValues?: Record<string, any> | null, namespace?: string | null): void;
|
|
243
|
+
|
|
244
|
+
/**
|
|
245
|
+
* Pop the last tag from the path
|
|
246
|
+
* @returns The popped node or undefined if path is empty
|
|
247
|
+
*/
|
|
248
|
+
pop(): PathNode | undefined;
|
|
249
|
+
|
|
250
|
+
/**
|
|
251
|
+
* Update current node's attribute values
|
|
252
|
+
* Useful when attributes are parsed after push
|
|
253
|
+
* @param attrValues - Attribute values
|
|
254
|
+
*/
|
|
255
|
+
updateCurrent(attrValues: Record<string, any>): void;
|
|
256
|
+
|
|
257
|
+
/**
|
|
258
|
+
* Get current tag name
|
|
259
|
+
* @returns Current tag name or undefined if path is empty
|
|
260
|
+
*/
|
|
261
|
+
getCurrentTag(): string | undefined;
|
|
262
|
+
|
|
263
|
+
/**
|
|
264
|
+
* Get current namespace
|
|
265
|
+
* @returns Current namespace or undefined if not present or path is empty
|
|
266
|
+
*/
|
|
267
|
+
getCurrentNamespace(): string | undefined;
|
|
268
|
+
|
|
269
|
+
/**
|
|
270
|
+
* Get current node's attribute value
|
|
271
|
+
* @param attrName - Attribute name
|
|
272
|
+
* @returns Attribute value or undefined
|
|
273
|
+
*/
|
|
274
|
+
getAttrValue(attrName: string): any;
|
|
275
|
+
|
|
276
|
+
/**
|
|
277
|
+
* Check if current node has an attribute
|
|
278
|
+
* @param attrName - Attribute name
|
|
279
|
+
*/
|
|
280
|
+
hasAttr(attrName: string): boolean;
|
|
281
|
+
|
|
282
|
+
/**
|
|
283
|
+
* Get current node's sibling position (child index in parent)
|
|
284
|
+
* @returns Position index or -1 if path is empty
|
|
285
|
+
*/
|
|
286
|
+
getPosition(): number;
|
|
287
|
+
|
|
288
|
+
/**
|
|
289
|
+
* Get current node's repeat counter (occurrence count of this tag name)
|
|
290
|
+
* @returns Counter value or -1 if path is empty
|
|
291
|
+
*/
|
|
292
|
+
getCounter(): number;
|
|
293
|
+
|
|
294
|
+
/**
|
|
295
|
+
* Get current node's sibling index (alias for getPosition for backward compatibility)
|
|
296
|
+
* @returns Index or -1 if path is empty
|
|
297
|
+
* @deprecated Use getPosition() or getCounter() instead
|
|
298
|
+
*/
|
|
299
|
+
getIndex(): number;
|
|
300
|
+
|
|
301
|
+
/**
|
|
302
|
+
* Get current path depth
|
|
303
|
+
* @returns Number of nodes in the path
|
|
304
|
+
*/
|
|
305
|
+
getDepth(): number;
|
|
306
|
+
|
|
307
|
+
/**
|
|
308
|
+
* Get path as string
|
|
309
|
+
* @param separator - Optional separator (uses default if not provided)
|
|
310
|
+
* @param includeNamespace - Whether to include namespace in output
|
|
311
|
+
* @returns Path string (e.g., "root.users.user" or "ns:root.ns:users.user")
|
|
312
|
+
*/
|
|
313
|
+
toString(separator?: string, includeNamespace?: boolean): string;
|
|
314
|
+
|
|
315
|
+
/**
|
|
316
|
+
* Get path as array of tag names
|
|
317
|
+
* @returns Array of tag names
|
|
318
|
+
*/
|
|
319
|
+
toArray(): string[];
|
|
320
|
+
|
|
321
|
+
/**
|
|
322
|
+
* Reset the path to empty
|
|
323
|
+
*/
|
|
324
|
+
reset(): void;
|
|
325
|
+
|
|
326
|
+
/**
|
|
327
|
+
* Match current path against an Expression
|
|
328
|
+
* @param expression - The expression to match against
|
|
329
|
+
* @returns True if current path matches the expression
|
|
330
|
+
*
|
|
331
|
+
* @example
|
|
332
|
+
* ```typescript
|
|
333
|
+
* const expr = new Expression("root.users.user[id]");
|
|
334
|
+
* const matcher = new Matcher();
|
|
335
|
+
*
|
|
336
|
+
* matcher.push("root");
|
|
337
|
+
* matcher.push("users");
|
|
338
|
+
* matcher.push("user", { id: "123" });
|
|
339
|
+
*
|
|
340
|
+
* matcher.matches(expr); // true
|
|
341
|
+
* ```
|
|
342
|
+
*/
|
|
343
|
+
matches(expression: Expression): boolean;
|
|
344
|
+
|
|
345
|
+
/**
|
|
346
|
+
* Create a snapshot of current state
|
|
347
|
+
* @returns State snapshot that can be restored later
|
|
348
|
+
*/
|
|
349
|
+
snapshot(): MatcherSnapshot;
|
|
350
|
+
|
|
351
|
+
/**
|
|
352
|
+
* Restore state from snapshot
|
|
353
|
+
* @param snapshot - State snapshot from previous snapshot() call
|
|
354
|
+
*/
|
|
355
|
+
restore(snapshot: MatcherSnapshot): void;
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
/**
|
|
359
|
+
* Default export containing both Expression and Matcher
|
|
360
|
+
*/
|
|
361
|
+
declare const _default: {
|
|
362
|
+
Expression: typeof Expression;
|
|
363
|
+
Matcher: typeof Matcher;
|
|
364
|
+
};
|
|
365
|
+
|
|
366
|
+
export default _default;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* fast-xml-tagger - XML/JSON path matching library
|
|
3
|
+
*
|
|
4
|
+
* Provides efficient path tracking and pattern matching for XML/JSON parsers.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* import { Expression, Matcher } from 'fast-xml-tagger';
|
|
8
|
+
*
|
|
9
|
+
* // Create expression (parse once)
|
|
10
|
+
* const expr = new Expression("root.users.user[id]");
|
|
11
|
+
*
|
|
12
|
+
* // Create matcher (track path)
|
|
13
|
+
* const matcher = new Matcher();
|
|
14
|
+
* matcher.push("root", [], {}, 0);
|
|
15
|
+
* matcher.push("users", [], {}, 0);
|
|
16
|
+
* matcher.push("user", ["id", "type"], { id: "123", type: "admin" }, 0);
|
|
17
|
+
*
|
|
18
|
+
* // Match
|
|
19
|
+
* if (matcher.matches(expr)) {
|
|
20
|
+
* console.log("Match found!");
|
|
21
|
+
* }
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
import Expression from './Expression.js';
|
|
25
|
+
import Matcher from './Matcher.js';
|
|
26
|
+
|
|
27
|
+
export { Expression, Matcher };
|
|
28
|
+
export default { Expression, Matcher };
|
package/package.json
CHANGED
|
@@ -77,7 +77,7 @@
|
|
|
77
77
|
"constructs": "^10.3.0"
|
|
78
78
|
},
|
|
79
79
|
"dependencies": {
|
|
80
|
-
"@aws-sdk/client-cloudformation": "^3.
|
|
80
|
+
"@aws-sdk/client-cloudformation": "^3.1007.0"
|
|
81
81
|
},
|
|
82
82
|
"bundledDependencies": [
|
|
83
83
|
"@aws-sdk/client-cloudformation"
|
|
@@ -93,7 +93,7 @@
|
|
|
93
93
|
"publishConfig": {
|
|
94
94
|
"access": "public"
|
|
95
95
|
},
|
|
96
|
-
"version": "0.0.
|
|
96
|
+
"version": "0.0.511",
|
|
97
97
|
"jest": {
|
|
98
98
|
"coverageProvider": "v8",
|
|
99
99
|
"testMatch": [
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(()=>{"use strict";var t={d:(e,i)=>{for(var s in i)t.o(i,s)&&!t.o(e,s)&&Object.defineProperty(e,s,{enumerable:!0,get:i[s]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};function i(t,e){let i="";return e.format&&e.indentBy.length>0&&(i="\n"),s(t,e,"",i)}function s(t,e,i,p){let u="",h=!1;if(!Array.isArray(t)){if(null!=t){let i=t.toString();return i=a(i,e),i}return""}for(let l=0;l<t.length;l++){const d=t[l],c=n(d);if(void 0===c)continue;let f="";if(f=0===i.length?c:`${i}.${c}`,c===e.textNodeName){let t=d[c];r(f,e)||(t=e.tagValueProcessor(c,t),t=a(t,e)),h&&(u+=p),u+=t,h=!1;continue}if(c===e.cdataPropName){h&&(u+=p),u+=`<![CDATA[${d[c][0][e.textNodeName]}]]>`,h=!1;continue}if(c===e.commentPropName){u+=p+`\x3c!--${d[c][0][e.textNodeName]}--\x3e`,h=!0;continue}if("?"===c[0]){const t=o(d[":@"],e),i="?xml"===c?"":p;let s=d[c][0][e.textNodeName];s=0!==s.length?" "+s:"",u+=i+`<${c}${s}${t}?>`,h=!0;continue}let g=p;""!==g&&(g+=e.indentBy);const N=p+`<${c}${o(d[":@"],e)}`,b=s(d[c],e,f,g);-1!==e.unpairedTags.indexOf(c)?e.suppressUnpairedNode?u+=N+">":u+=N+"/>":b&&0!==b.length||!e.suppressEmptyNode?b&&b.endsWith(">")?u+=N+`>${b}${p}</${c}>`:(u+=N+">",b&&""!==p&&(b.includes("/>")||b.includes("</"))?u+=p+e.indentBy+b+p:u+=b,u+=`</${c}>`):u+=N+"/>",h=!0}return u}function n(t){const e=Object.keys(t);for(let i=0;i<e.length;i++){const s=e[i];if(Object.prototype.hasOwnProperty.call(t,s)&&":@"!==s)return s}}function o(t,e){let i="";if(t&&!e.ignoreAttributes)for(let s in t){if(!Object.prototype.hasOwnProperty.call(t,s))continue;let n=e.attributeValueProcessor(s,t[s]);n=a(n,e),!0===n&&e.suppressBooleanAttributes?i+=` ${s.substr(e.attributeNamePrefix.length)}`:i+=` ${s.substr(e.attributeNamePrefix.length)}="${n}"`}return i}function r(t,e){let i=(t=t.substr(0,t.length-e.textNodeName.length-1)).substr(t.lastIndexOf(".")+1);for(let s in e.stopNodes)if(e.stopNodes[s]===t||e.stopNodes[s]==="*."+i)return!0;return!1}function a(t,e){if(t&&t.length>0&&e.processEntities)for(let i=0;i<e.entities.length;i++){const s=e.entities[i];t=t.replace(s.regex,s.val)}return t}t.r(e),t.d(e,{default:()=>u});const p={attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,cdataPropName:!1,format:!1,indentBy:" ",suppressEmptyNode:!1,suppressUnpairedNode:!0,suppressBooleanAttributes:!0,tagValueProcessor:function(t,e){return e},attributeValueProcessor:function(t,e){return e},preserveOrder:!1,commentPropName:!1,unpairedTags:[],entities:[{regex:new RegExp("&","g"),val:"&"},{regex:new RegExp(">","g"),val:">"},{regex:new RegExp("<","g"),val:"<"},{regex:new RegExp("'","g"),val:"'"},{regex:new RegExp('"',"g"),val:"""}],processEntities:!0,stopNodes:[],oneListGroup:!1};function u(t){var e;this.options=Object.assign({},p,t),!0===this.options.ignoreAttributes||this.options.attributesGroupName?this.isAttribute=function(){return!1}:(this.ignoreAttributesFn="function"==typeof(e=this.options.ignoreAttributes)?e:Array.isArray(e)?t=>{for(const i of e){if("string"==typeof i&&t===i)return!0;if(i instanceof RegExp&&i.test(t))return!0}}:()=>!1,this.attrPrefixLen=this.options.attributeNamePrefix.length,this.isAttribute=d),this.processTextOrObjNode=h,this.options.format?(this.indentate=l,this.tagEndChar=">\n",this.newLine="\n"):(this.indentate=function(){return""},this.tagEndChar=">",this.newLine="")}function h(t,e,i,s){const n=this.j2x(t,i+1,s.concat(e));return void 0!==t[this.options.textNodeName]&&1===Object.keys(t).length?this.buildTextValNode(t[this.options.textNodeName],e,n.attrStr,i):this.buildObjectNode(n.val,e,n.attrStr,i)}function l(t){return this.options.indentBy.repeat(t)}function d(t){return!(!t.startsWith(this.options.attributeNamePrefix)||t===this.options.textNodeName)&&t.substr(this.attrPrefixLen)}u.prototype.build=function(t){return this.options.preserveOrder?i(t,this.options):(Array.isArray(t)&&this.options.arrayNodeName&&this.options.arrayNodeName.length>1&&(t={[this.options.arrayNodeName]:t}),this.j2x(t,0,[]).val)},u.prototype.j2x=function(t,e,i){let s="",n="";const o=i.join(".");for(let r in t)if(Object.prototype.hasOwnProperty.call(t,r))if(void 0===t[r])this.isAttribute(r)&&(n+="");else if(null===t[r])this.isAttribute(r)||r===this.options.cdataPropName?n+="":"?"===r[0]?n+=this.indentate(e)+"<"+r+"?"+this.tagEndChar:n+=this.indentate(e)+"<"+r+"/"+this.tagEndChar;else if(t[r]instanceof Date)n+=this.buildTextValNode(t[r],r,"",e);else if("object"!=typeof t[r]){const i=this.isAttribute(r);if(i&&!this.ignoreAttributesFn(i,o))s+=this.buildAttrPairStr(i,""+t[r]);else if(!i)if(r===this.options.textNodeName){let e=this.options.tagValueProcessor(r,""+t[r]);n+=this.replaceEntitiesValue(e)}else n+=this.buildTextValNode(t[r],r,"",e)}else if(Array.isArray(t[r])){const s=t[r].length;let o="",a="";for(let p=0;p<s;p++){const s=t[r][p];if(void 0===s);else if(null===s)"?"===r[0]?n+=this.indentate(e)+"<"+r+"?"+this.tagEndChar:n+=this.indentate(e)+"<"+r+"/"+this.tagEndChar;else if("object"==typeof s)if(this.options.oneListGroup){const t=this.j2x(s,e+1,i.concat(r));o+=t.val,this.options.attributesGroupName&&s.hasOwnProperty(this.options.attributesGroupName)&&(a+=t.attrStr)}else o+=this.processTextOrObjNode(s,r,e,i);else if(this.options.oneListGroup){let t=this.options.tagValueProcessor(r,s);t=this.replaceEntitiesValue(t),o+=t}else o+=this.buildTextValNode(s,r,"",e)}this.options.oneListGroup&&(o=this.buildObjectNode(o,r,a,e)),n+=o}else if(this.options.attributesGroupName&&r===this.options.attributesGroupName){const e=Object.keys(t[r]),i=e.length;for(let n=0;n<i;n++)s+=this.buildAttrPairStr(e[n],""+t[r][e[n]])}else n+=this.processTextOrObjNode(t[r],r,e,i);return{attrStr:s,val:n}},u.prototype.buildAttrPairStr=function(t,e){return e=this.options.attributeValueProcessor(t,""+e),e=this.replaceEntitiesValue(e),this.options.suppressBooleanAttributes&&"true"===e?" "+t:" "+t+'="'+e+'"'},u.prototype.buildObjectNode=function(t,e,i,s){if(""===t)return"?"===e[0]?this.indentate(s)+"<"+e+i+"?"+this.tagEndChar:this.indentate(s)+"<"+e+i+this.closeTag(e)+this.tagEndChar;{let n="</"+e+this.tagEndChar,o="";return"?"===e[0]&&(o="?",n=""),!i&&""!==i||-1!==t.indexOf("<")?!1!==this.options.commentPropName&&e===this.options.commentPropName&&0===o.length?this.indentate(s)+`\x3c!--${t}--\x3e`+this.newLine:this.indentate(s)+"<"+e+i+o+this.tagEndChar+t+this.indentate(s)+n:this.indentate(s)+"<"+e+i+o+">"+t+n}},u.prototype.closeTag=function(t){let e="";return-1!==this.options.unpairedTags.indexOf(t)?this.options.suppressUnpairedNode||(e="/"):e=this.options.suppressEmptyNode?"/":`></${t}`,e},u.prototype.buildTextValNode=function(t,e,i,s){if(!1!==this.options.cdataPropName&&e===this.options.cdataPropName)return this.indentate(s)+`<![CDATA[${t}]]>`+this.newLine;if(!1!==this.options.commentPropName&&e===this.options.commentPropName)return this.indentate(s)+`\x3c!--${t}--\x3e`+this.newLine;if("?"===e[0])return this.indentate(s)+"<"+e+i+"?"+this.tagEndChar;{let n=this.options.tagValueProcessor(e,t);return n=this.replaceEntitiesValue(n),""===n?this.indentate(s)+"<"+e+i+this.closeTag(e)+this.tagEndChar:this.indentate(s)+"<"+e+i+">"+n+"</"+e+this.tagEndChar}},u.prototype.replaceEntitiesValue=function(t){if(t&&t.length>0&&this.options.processEntities)for(let e=0;e<this.options.entities.length;e++){const i=this.options.entities[e];t=t.replace(i.regex,i.val)}return t},module.exports=e})();
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.fxpBuilder=e():t.fxpBuilder=e()}(this,()=>(()=>{"use strict";var t={d:(e,r)=>{for(var i in r)t.o(r,i)&&!t.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:r[i]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};function r(t,e){var r="";return e.format&&e.indentBy.length>0&&(r="\n"),i(t,e,"",r)}function i(t,e,r,u){var p="",h=!1;if(!Array.isArray(t)){if(null!=t){var l=t.toString();return a(l,e)}return""}for(var d=0;d<t.length;d++){var f=t[d],c=n(f);if(void 0!==c){var g;if(g=0===r.length?c:r+"."+c,c!==e.textNodeName)if(c!==e.cdataPropName)if(c!==e.commentPropName)if("?"!==c[0]){var b=u;""!==b&&(b+=e.indentBy);var m=u+"<"+c+o(f[":@"],e),v=i(f[c],e,g,b);-1!==e.unpairedTags.indexOf(c)?e.suppressUnpairedNode?p+=m+">":p+=m+"/>":v&&0!==v.length||!e.suppressEmptyNode?v&&v.endsWith(">")?p+=m+">"+v+u+"</"+c+">":(p+=m+">",v&&""!==u&&(v.includes("/>")||v.includes("</"))?p+=u+e.indentBy+v+u:p+=v,p+="</"+c+">"):p+=m+"/>",h=!0}else{var N=o(f[":@"],e),y="?xml"===c?"":u,x=f[c][0][e.textNodeName];p+=y+"<"+c+(x=0!==x.length?" "+x:"")+N+"?>",h=!0}else p+=u+"\x3c!--"+f[c][0][e.textNodeName]+"--\x3e",h=!0;else h&&(p+=u),p+="<![CDATA["+f[c][0][e.textNodeName]+"]]>",h=!1;else{var P=f[c];s(g,e)||(P=a(P=e.tagValueProcessor(c,P),e)),h&&(p+=u),p+=P,h=!1}}}return p}function n(t){for(var e=Object.keys(t),r=0;r<e.length;r++){var i=e[r];if(Object.prototype.hasOwnProperty.call(t,i)&&":@"!==i)return i}}function o(t,e){var r="";if(t&&!e.ignoreAttributes)for(var i in t)if(Object.prototype.hasOwnProperty.call(t,i)){var n=e.attributeValueProcessor(i,t[i]);!0===(n=a(n,e))&&e.suppressBooleanAttributes?r+=" "+i.substr(e.attributeNamePrefix.length):r+=" "+i.substr(e.attributeNamePrefix.length)+'="'+n+'"'}return r}function s(t,e){var r=(t=t.substr(0,t.length-e.textNodeName.length-1)).substr(t.lastIndexOf(".")+1);for(var i in e.stopNodes)if(e.stopNodes[i]===t||e.stopNodes[i]==="*."+r)return!0;return!1}function a(t,e){if(t&&t.length>0&&e.processEntities)for(var r=0;r<e.entities.length;r++){var i=e.entities[r];t=t.replace(i.regex,i.val)}return t}function u(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,i=Array(e);r<e;r++)i[r]=t[r];return i}t.r(e),t.d(e,{default:()=>h});var p={attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,cdataPropName:!1,format:!1,indentBy:" ",suppressEmptyNode:!1,suppressUnpairedNode:!0,suppressBooleanAttributes:!0,tagValueProcessor:function(t,e){return e},attributeValueProcessor:function(t,e){return e},preserveOrder:!1,commentPropName:!1,unpairedTags:[],entities:[{regex:new RegExp("&","g"),val:"&"},{regex:new RegExp(">","g"),val:">"},{regex:new RegExp("<","g"),val:"<"},{regex:new RegExp("'","g"),val:"'"},{regex:new RegExp('"',"g"),val:"""}],processEntities:!0,stopNodes:[],oneListGroup:!1};function h(t){var e;this.options=Object.assign({},p,t),!0===this.options.ignoreAttributes||this.options.attributesGroupName?this.isAttribute=function(){return!1}:(this.ignoreAttributesFn="function"==typeof(e=this.options.ignoreAttributes)?e:Array.isArray(e)?function(t){for(var r,i=function(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(r)return(r=r.call(t)).next.bind(r);if(Array.isArray(t)||(r=function(t,e){if(t){if("string"==typeof t)return u(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?u(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var i=0;return function(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(e);!(r=i()).done;){var n=r.value;if("string"==typeof n&&t===n)return!0;if(n instanceof RegExp&&n.test(t))return!0}}:function(){return!1},this.attrPrefixLen=this.options.attributeNamePrefix.length,this.isAttribute=f),this.processTextOrObjNode=l,this.options.format?(this.indentate=d,this.tagEndChar=">\n",this.newLine="\n"):(this.indentate=function(){return""},this.tagEndChar=">",this.newLine="")}function l(t,e,r,i){var n=this.j2x(t,r+1,i.concat(e));return void 0!==t[this.options.textNodeName]&&1===Object.keys(t).length?this.buildTextValNode(t[this.options.textNodeName],e,n.attrStr,r):this.buildObjectNode(n.val,e,n.attrStr,r)}function d(t){return this.options.indentBy.repeat(t)}function f(t){return!(!t.startsWith(this.options.attributeNamePrefix)||t===this.options.textNodeName)&&t.substr(this.attrPrefixLen)}return h.prototype.build=function(t){return this.options.preserveOrder?r(t,this.options):(Array.isArray(t)&&this.options.arrayNodeName&&this.options.arrayNodeName.length>1&&((e={})[this.options.arrayNodeName]=t,t=e),this.j2x(t,0,[]).val);var e},h.prototype.j2x=function(t,e,r){var i="",n="",o=r.join(".");for(var s in t)if(Object.prototype.hasOwnProperty.call(t,s))if(void 0===t[s])this.isAttribute(s)&&(n+="");else if(null===t[s])this.isAttribute(s)||s===this.options.cdataPropName?n+="":"?"===s[0]?n+=this.indentate(e)+"<"+s+"?"+this.tagEndChar:n+=this.indentate(e)+"<"+s+"/"+this.tagEndChar;else if(t[s]instanceof Date)n+=this.buildTextValNode(t[s],s,"",e);else if("object"!=typeof t[s]){var a=this.isAttribute(s);if(a&&!this.ignoreAttributesFn(a,o))i+=this.buildAttrPairStr(a,""+t[s]);else if(!a)if(s===this.options.textNodeName){var u=this.options.tagValueProcessor(s,""+t[s]);n+=this.replaceEntitiesValue(u)}else n+=this.buildTextValNode(t[s],s,"",e)}else if(Array.isArray(t[s])){for(var p=t[s].length,h="",l="",d=0;d<p;d++){var f=t[s][d];if(void 0===f);else if(null===f)"?"===s[0]?n+=this.indentate(e)+"<"+s+"?"+this.tagEndChar:n+=this.indentate(e)+"<"+s+"/"+this.tagEndChar;else if("object"==typeof f)if(this.options.oneListGroup){var c=this.j2x(f,e+1,r.concat(s));h+=c.val,this.options.attributesGroupName&&f.hasOwnProperty(this.options.attributesGroupName)&&(l+=c.attrStr)}else h+=this.processTextOrObjNode(f,s,e,r);else if(this.options.oneListGroup){var g=this.options.tagValueProcessor(s,f);h+=g=this.replaceEntitiesValue(g)}else h+=this.buildTextValNode(f,s,"",e)}this.options.oneListGroup&&(h=this.buildObjectNode(h,s,l,e)),n+=h}else if(this.options.attributesGroupName&&s===this.options.attributesGroupName)for(var b=Object.keys(t[s]),m=b.length,v=0;v<m;v++)i+=this.buildAttrPairStr(b[v],""+t[s][b[v]]);else n+=this.processTextOrObjNode(t[s],s,e,r);return{attrStr:i,val:n}},h.prototype.buildAttrPairStr=function(t,e){return e=this.options.attributeValueProcessor(t,""+e),e=this.replaceEntitiesValue(e),this.options.suppressBooleanAttributes&&"true"===e?" "+t:" "+t+'="'+e+'"'},h.prototype.buildObjectNode=function(t,e,r,i){if(""===t)return"?"===e[0]?this.indentate(i)+"<"+e+r+"?"+this.tagEndChar:this.indentate(i)+"<"+e+r+this.closeTag(e)+this.tagEndChar;var n="</"+e+this.tagEndChar,o="";return"?"===e[0]&&(o="?",n=""),!r&&""!==r||-1!==t.indexOf("<")?!1!==this.options.commentPropName&&e===this.options.commentPropName&&0===o.length?this.indentate(i)+"\x3c!--"+t+"--\x3e"+this.newLine:this.indentate(i)+"<"+e+r+o+this.tagEndChar+t+this.indentate(i)+n:this.indentate(i)+"<"+e+r+o+">"+t+n},h.prototype.closeTag=function(t){var e="";return-1!==this.options.unpairedTags.indexOf(t)?this.options.suppressUnpairedNode||(e="/"):e=this.options.suppressEmptyNode?"/":"></"+t,e},h.prototype.buildTextValNode=function(t,e,r,i){if(!1!==this.options.cdataPropName&&e===this.options.cdataPropName)return this.indentate(i)+"<![CDATA["+t+"]]>"+this.newLine;if(!1!==this.options.commentPropName&&e===this.options.commentPropName)return this.indentate(i)+"\x3c!--"+t+"--\x3e"+this.newLine;if("?"===e[0])return this.indentate(i)+"<"+e+r+"?"+this.tagEndChar;var n=this.options.tagValueProcessor(e,t);return""===(n=this.replaceEntitiesValue(n))?this.indentate(i)+"<"+e+r+this.closeTag(e)+this.tagEndChar:this.indentate(i)+"<"+e+r+">"+n+"</"+e+this.tagEndChar},h.prototype.replaceEntitiesValue=function(t){if(t&&t.length>0&&this.options.processEntities)for(var e=0;e<this.options.entities.length;e++){var r=this.options.entities[e];t=t.replace(r.regex,r.val)}return t},e})());
|
|
2
|
-
//# sourceMappingURL=builder.min.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"./lib/builder.min.js","mappings":"CAAA,SAA2CA,EAAMC,GAC1B,iBAAZC,SAA0C,iBAAXC,OACxCA,OAAOD,QAAUD,IACQ,mBAAXG,QAAyBA,OAAOC,IAC9CD,OAAO,GAAIH,GACe,iBAAZC,QACdA,QAAoB,WAAID,IAExBD,EAAiB,WAAIC,GACtB,CATD,CASGK,KAAM,I,mBCRT,IAAIC,EAAsB,CCA1BA,EAAwB,CAACL,EAASM,KACjC,IAAI,IAAIC,KAAOD,EACXD,EAAoBG,EAAEF,EAAYC,KAASF,EAAoBG,EAAER,EAASO,IAC5EE,OAAOC,eAAeV,EAASO,EAAK,CAAEI,YAAY,EAAMC,IAAKN,EAAWC,MCJ3EF,EAAwB,CAACQ,EAAKC,IAAUL,OAAOM,UAAUC,eAAeC,KAAKJ,EAAKC,GCClFT,EAAyBL,IACH,oBAAXkB,QAA0BA,OAAOC,aAC1CV,OAAOC,eAAeV,EAASkB,OAAOC,YAAa,CAAEC,MAAO,WAE7DX,OAAOC,eAAeV,EAAS,aAAc,CAAEoB,OAAO,M,KCGxC,SAASC,EAAMC,EAAQC,GAClC,IAAIC,EAAc,GAIlB,OAHID,EAAQE,QAAUF,EAAQG,SAASC,OAAS,IAC5CH,EAXI,MAaDI,EAASN,EAAQC,EAAS,GAAIC,EACzC,CAEA,SAASI,EAASC,EAAKN,EAASO,EAAON,GACnC,IAAIO,EAAS,GACTC,GAAuB,EAG3B,IAAKC,MAAMC,QAAQL,GAAM,CAErB,GAAIA,QAAmC,CACnC,IAAIM,EAAON,EAAIO,WAEf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ACjD,GAAIA,GAAaA,EAAUjD,OAAS,GAAKvB,KAAKmB,QAAQsD,gBACpD,IAAK,IAAIvC,EAAI,EAAGA,EAAIlC,KAAKmB,QAAQuD,SAASnD,OAAQW,IAAK,CACrD,IAAMyC,EAAS3E,KAAKmB,QAAQuD,SAASxC,GACrCsC,EAAYA,EAAUI,QAAQD,EAAOE,MAAOF,EAAOG,IACrD,CAEF,OAAON,CACT,E","sources":["webpack://fxpBuilder/webpack/universalModuleDefinition","webpack://fxpBuilder/webpack/bootstrap","webpack://fxpBuilder/webpack/runtime/define property getters","webpack://fxpBuilder/webpack/runtime/hasOwnProperty shorthand","webpack://fxpBuilder/webpack/runtime/make namespace object","webpack://fxpBuilder/./src/orderedJs2Xml.js","webpack://fxpBuilder/./src/builder.js","webpack://fxpBuilder/./src/ignoreAttributes.js"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"fxpBuilder\"] = factory();\n\telse\n\t\troot[\"fxpBuilder\"] = factory();\n})(this, () => {\nreturn ","// The require scope\nvar __webpack_require__ = {};\n\n","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","const EOL = \"\\n\";\n\n/**\n * \n * @param {array} jArray \n * @param {any} options \n * @returns \n */\nexport default function toXml(jArray, options) {\n let indentation = \"\";\n if (options.format && options.indentBy.length > 0) {\n indentation = EOL;\n }\n return arrToStr(jArray, options, \"\", indentation);\n}\n\nfunction arrToStr(arr, options, jPath, indentation) {\n let xmlStr = \"\";\n let isPreviousElementTag = false;\n\n\n if (!Array.isArray(arr)) {\n // Non-array values (e.g. string tag values) should be treated as text content\n if (arr !== undefined && arr !== null) {\n let text = arr.toString();\n text = replaceEntitiesValue(text, options);\n return text;\n }\n return \"\";\n }\n\n for (let i = 0; i < arr.length; i++) {\n const tagObj = arr[i];\n const tagName = propName(tagObj);\n if (tagName === undefined) continue;\n\n let newJPath = \"\";\n if (jPath.length === 0) newJPath = tagName\n else newJPath = `${jPath}.${tagName}`;\n\n if (tagName === options.textNodeName) {\n let tagText = tagObj[tagName];\n if (!isStopNode(newJPath, options)) {\n tagText = options.tagValueProcessor(tagName, tagText);\n tagText = replaceEntitiesValue(tagText, options);\n }\n if (isPreviousElementTag) {\n xmlStr += indentation;\n }\n xmlStr += tagText;\n isPreviousElementTag = false;\n continue;\n } else if (tagName === options.cdataPropName) {\n if (isPreviousElementTag) {\n xmlStr += indentation;\n }\n xmlStr += `<![CDATA[${tagObj[tagName][0][options.textNodeName]}]]>`;\n isPreviousElementTag = false;\n continue;\n } else if (tagName === options.commentPropName) {\n xmlStr += indentation + `<!--${tagObj[tagName][0][options.textNodeName]}-->`;\n isPreviousElementTag = true;\n continue;\n } else if (tagName[0] === \"?\") {\n const attStr = attr_to_str(tagObj[\":@\"], options);\n const tempInd = tagName === \"?xml\" ? \"\" : indentation;\n let piTextNodeName = tagObj[tagName][0][options.textNodeName];\n piTextNodeName = piTextNodeName.length !== 0 ? \" \" + piTextNodeName : \"\"; //remove extra spacing\n xmlStr += tempInd + `<${tagName}${piTextNodeName}${attStr}?>`;\n isPreviousElementTag = true;\n continue;\n }\n let newIdentation = indentation;\n if (newIdentation !== \"\") {\n newIdentation += options.indentBy;\n }\n const attStr = attr_to_str(tagObj[\":@\"], options);\n const tagStart = indentation + `<${tagName}${attStr}`;\n const tagValue = arrToStr(tagObj[tagName], options, newJPath, newIdentation);\n if (options.unpairedTags.indexOf(tagName) !== -1) {\n if (options.suppressUnpairedNode) xmlStr += tagStart + \">\";\n else xmlStr += tagStart + \"/>\";\n } else if ((!tagValue || tagValue.length === 0) && options.suppressEmptyNode) {\n xmlStr += tagStart + \"/>\";\n } else if (tagValue && tagValue.endsWith(\">\")) {\n xmlStr += tagStart + `>${tagValue}${indentation}</${tagName}>`;\n } else {\n xmlStr += tagStart + \">\";\n if (tagValue && indentation !== \"\" && (tagValue.includes(\"/>\") || tagValue.includes(\"</\"))) {\n xmlStr += indentation + options.indentBy + tagValue + indentation;\n } else {\n xmlStr += tagValue;\n }\n xmlStr += `</${tagName}>`;\n }\n isPreviousElementTag = true;\n }\n\n return xmlStr;\n}\n\nfunction propName(obj) {\n const keys = Object.keys(obj);\n for (let i = 0; i < keys.length; i++) {\n const key = keys[i];\n if (!Object.prototype.hasOwnProperty.call(obj, key)) continue;\n if (key !== \":@\") return key;\n }\n}\n\nfunction attr_to_str(attrMap, options) {\n let attrStr = \"\";\n if (attrMap && !options.ignoreAttributes) {\n for (let attr in attrMap) {\n if (!Object.prototype.hasOwnProperty.call(attrMap, attr)) continue;\n let attrVal = options.attributeValueProcessor(attr, attrMap[attr]);\n attrVal = replaceEntitiesValue(attrVal, options);\n if (attrVal === true && options.suppressBooleanAttributes) {\n attrStr += ` ${attr.substr(options.attributeNamePrefix.length)}`;\n } else {\n attrStr += ` ${attr.substr(options.attributeNamePrefix.length)}=\"${attrVal}\"`;\n }\n }\n }\n return attrStr;\n}\n\nfunction isStopNode(jPath, options) {\n jPath = jPath.substr(0, jPath.length - options.textNodeName.length - 1);\n let tagName = jPath.substr(jPath.lastIndexOf(\".\") + 1);\n for (let index in options.stopNodes) {\n if (options.stopNodes[index] === jPath || options.stopNodes[index] === \"*.\" + tagName) return true;\n }\n return false;\n}\n\nfunction replaceEntitiesValue(textValue, options) {\n if (textValue && textValue.length > 0 && options.processEntities) {\n for (let i = 0; i < options.entities.length; i++) {\n const entity = options.entities[i];\n textValue = textValue.replace(entity.regex, entity.val);\n }\n }\n return textValue;\n}\n","'use strict';\n//parse Empty Node as self closing node\nimport buildFromOrderedJs from './orderedJs2Xml.js';\nimport getIgnoreAttributesFn from \"./ignoreAttributes.js\";\n\nconst defaultOptions = {\n attributeNamePrefix: '@_',\n attributesGroupName: false,\n textNodeName: '#text',\n ignoreAttributes: true,\n cdataPropName: false,\n format: false,\n indentBy: ' ',\n suppressEmptyNode: false,\n suppressUnpairedNode: true,\n suppressBooleanAttributes: true,\n tagValueProcessor: function (key, a) {\n return a;\n },\n attributeValueProcessor: function (attrName, a) {\n return a;\n },\n preserveOrder: false,\n commentPropName: false,\n unpairedTags: [],\n entities: [\n { regex: new RegExp(\"&\", \"g\"), val: \"&\" },//it must be on top\n { regex: new RegExp(\">\", \"g\"), val: \">\" },\n { regex: new RegExp(\"<\", \"g\"), val: \"<\" },\n { regex: new RegExp(\"\\'\", \"g\"), val: \"'\" },\n { regex: new RegExp(\"\\\"\", \"g\"), val: \""\" }\n ],\n processEntities: true,\n stopNodes: [],\n // transformTagName: false,\n // transformAttributeName: false,\n oneListGroup: false\n};\n\nexport default function Builder(options) {\n this.options = Object.assign({}, defaultOptions, options);\n if (this.options.ignoreAttributes === true || this.options.attributesGroupName) {\n this.isAttribute = function (/*a*/) {\n return false;\n };\n } else {\n this.ignoreAttributesFn = getIgnoreAttributesFn(this.options.ignoreAttributes)\n this.attrPrefixLen = this.options.attributeNamePrefix.length;\n this.isAttribute = isAttribute;\n }\n\n this.processTextOrObjNode = processTextOrObjNode\n\n if (this.options.format) {\n this.indentate = indentate;\n this.tagEndChar = '>\\n';\n this.newLine = '\\n';\n } else {\n this.indentate = function () {\n return '';\n };\n this.tagEndChar = '>';\n this.newLine = '';\n }\n}\n\nBuilder.prototype.build = function (jObj) {\n if (this.options.preserveOrder) {\n return buildFromOrderedJs(jObj, this.options);\n } else {\n if (Array.isArray(jObj) && this.options.arrayNodeName && this.options.arrayNodeName.length > 1) {\n jObj = {\n [this.options.arrayNodeName]: jObj\n }\n }\n return this.j2x(jObj, 0, []).val;\n }\n};\n\nBuilder.prototype.j2x = function (jObj, level, ajPath) {\n let attrStr = '';\n let val = '';\n const jPath = ajPath.join('.')\n for (let key in jObj) {\n if (!Object.prototype.hasOwnProperty.call(jObj, key)) continue;\n if (typeof jObj[key] === 'undefined') {\n // supress undefined node only if it is not an attribute\n if (this.isAttribute(key)) {\n val += '';\n }\n } else if (jObj[key] === null) {\n // null attribute should be ignored by the attribute list, but should not cause the tag closing\n if (this.isAttribute(key)) {\n val += '';\n } else if (key === this.options.cdataPropName) {\n val += '';\n } else if (key[0] === '?') {\n val += this.indentate(level) + '<' + key + '?' + this.tagEndChar;\n } else {\n val += this.indentate(level) + '<' + key + '/' + this.tagEndChar;\n }\n // val += this.indentate(level) + '<' + key + '/' + this.tagEndChar;\n } else if (jObj[key] instanceof Date) {\n val += this.buildTextValNode(jObj[key], key, '', level);\n } else if (typeof jObj[key] !== 'object') {\n //premitive type\n const attr = this.isAttribute(key);\n if (attr && !this.ignoreAttributesFn(attr, jPath)) {\n attrStr += this.buildAttrPairStr(attr, '' + jObj[key]);\n } else if (!attr) {\n //tag value\n if (key === this.options.textNodeName) {\n let newval = this.options.tagValueProcessor(key, '' + jObj[key]);\n val += this.replaceEntitiesValue(newval);\n } else {\n val += this.buildTextValNode(jObj[key], key, '', level);\n }\n }\n } else if (Array.isArray(jObj[key])) {\n //repeated nodes\n const arrLen = jObj[key].length;\n let listTagVal = \"\";\n let listTagAttr = \"\";\n for (let j = 0; j < arrLen; j++) {\n const item = jObj[key][j];\n if (typeof item === 'undefined') {\n // supress undefined node\n } else if (item === null) {\n if (key[0] === \"?\") val += this.indentate(level) + '<' + key + '?' + this.tagEndChar;\n else val += this.indentate(level) + '<' + key + '/' + this.tagEndChar;\n // val += this.indentate(level) + '<' + key + '/' + this.tagEndChar;\n } else if (typeof item === 'object') {\n if (this.options.oneListGroup) {\n const result = this.j2x(item, level + 1, ajPath.concat(key));\n listTagVal += result.val;\n if (this.options.attributesGroupName && item.hasOwnProperty(this.options.attributesGroupName)) {\n listTagAttr += result.attrStr\n }\n } else {\n listTagVal += this.processTextOrObjNode(item, key, level, ajPath)\n }\n } else {\n if (this.options.oneListGroup) {\n let textValue = this.options.tagValueProcessor(key, item);\n textValue = this.replaceEntitiesValue(textValue);\n listTagVal += textValue;\n } else {\n listTagVal += this.buildTextValNode(item, key, '', level);\n }\n }\n }\n if (this.options.oneListGroup) {\n listTagVal = this.buildObjectNode(listTagVal, key, listTagAttr, level);\n }\n val += listTagVal;\n } else {\n //nested node\n if (this.options.attributesGroupName && key === this.options.attributesGroupName) {\n const Ks = Object.keys(jObj[key]);\n const L = Ks.length;\n for (let j = 0; j < L; j++) {\n attrStr += this.buildAttrPairStr(Ks[j], '' + jObj[key][Ks[j]]);\n }\n } else {\n val += this.processTextOrObjNode(jObj[key], key, level, ajPath)\n }\n }\n }\n return { attrStr: attrStr, val: val };\n};\n\nBuilder.prototype.buildAttrPairStr = function (attrName, val) {\n val = this.options.attributeValueProcessor(attrName, '' + val);\n val = this.replaceEntitiesValue(val);\n if (this.options.suppressBooleanAttributes && val === \"true\") {\n return ' ' + attrName;\n } else return ' ' + attrName + '=\"' + val + '\"';\n}\n\nfunction processTextOrObjNode(object, key, level, ajPath) {\n const result = this.j2x(object, level + 1, ajPath.concat(key));\n if (object[this.options.textNodeName] !== undefined && Object.keys(object).length === 1) {\n return this.buildTextValNode(object[this.options.textNodeName], key, result.attrStr, level);\n } else {\n return this.buildObjectNode(result.val, key, result.attrStr, level);\n }\n}\n\nBuilder.prototype.buildObjectNode = function (val, key, attrStr, level) {\n if (val === \"\") {\n if (key[0] === \"?\") return this.indentate(level) + '<' + key + attrStr + '?' + this.tagEndChar;\n else {\n return this.indentate(level) + '<' + key + attrStr + this.closeTag(key) + this.tagEndChar;\n }\n } else {\n\n let tagEndExp = '</' + key + this.tagEndChar;\n let piClosingChar = \"\";\n\n if (key[0] === \"?\") {\n piClosingChar = \"?\";\n tagEndExp = \"\";\n }\n\n // attrStr is an empty string in case the attribute came as undefined or null\n if ((attrStr || attrStr === '') && val.indexOf('<') === -1) {\n return (this.indentate(level) + '<' + key + attrStr + piClosingChar + '>' + val + tagEndExp);\n } else if (this.options.commentPropName !== false && key === this.options.commentPropName && piClosingChar.length === 0) {\n return this.indentate(level) + `<!--${val}-->` + this.newLine;\n } else {\n return (\n this.indentate(level) + '<' + key + attrStr + piClosingChar + this.tagEndChar +\n val +\n this.indentate(level) + tagEndExp);\n }\n }\n}\n\nBuilder.prototype.closeTag = function (key) {\n let closeTag = \"\";\n if (this.options.unpairedTags.indexOf(key) !== -1) { //unpaired\n if (!this.options.suppressUnpairedNode) closeTag = \"/\"\n } else if (this.options.suppressEmptyNode) { //empty\n closeTag = \"/\";\n } else {\n closeTag = `></${key}`\n }\n return closeTag;\n}\n\nfunction buildEmptyObjNode(val, key, attrStr, level) {\n if (val !== '') {\n return this.buildObjectNode(val, key, attrStr, level);\n } else {\n if (key[0] === \"?\") return this.indentate(level) + '<' + key + attrStr + '?' + this.tagEndChar;\n else {\n return this.indentate(level) + '<' + key + attrStr + '/' + this.tagEndChar;\n // return this.buildTagStr(level,key, attrStr);\n }\n }\n}\n\nBuilder.prototype.buildTextValNode = function (val, key, attrStr, level) {\n if (this.options.cdataPropName !== false && key === this.options.cdataPropName) {\n return this.indentate(level) + `<![CDATA[${val}]]>` + this.newLine;\n } else if (this.options.commentPropName !== false && key === this.options.commentPropName) {\n return this.indentate(level) + `<!--${val}-->` + this.newLine;\n } else if (key[0] === \"?\") {//PI tag\n return this.indentate(level) + '<' + key + attrStr + '?' + this.tagEndChar;\n } else {\n let textValue = this.options.tagValueProcessor(key, val);\n textValue = this.replaceEntitiesValue(textValue);\n\n if (textValue === '') {\n return this.indentate(level) + '<' + key + attrStr + this.closeTag(key) + this.tagEndChar;\n } else {\n return this.indentate(level) + '<' + key + attrStr + '>' +\n textValue +\n '</' + key + this.tagEndChar;\n }\n }\n}\n\nBuilder.prototype.replaceEntitiesValue = function (textValue) {\n if (textValue && textValue.length > 0 && this.options.processEntities) {\n for (let i = 0; i < this.options.entities.length; i++) {\n const entity = this.options.entities[i];\n textValue = textValue.replace(entity.regex, entity.val);\n }\n }\n return textValue;\n}\n\nfunction indentate(level) {\n return this.options.indentBy.repeat(level);\n}\n\nfunction isAttribute(name /*, options*/) {\n if (name.startsWith(this.options.attributeNamePrefix) && name !== this.options.textNodeName) {\n return name.substr(this.attrPrefixLen);\n } else {\n return false;\n }\n}\n\n","export default function getIgnoreAttributesFn(ignoreAttributes) {\n if (typeof ignoreAttributes === 'function') {\n return ignoreAttributes\n }\n if (Array.isArray(ignoreAttributes)) {\n return (attrName) => {\n for (const pattern of ignoreAttributes) {\n if (typeof pattern === 'string' && attrName === pattern) {\n return true\n }\n if (pattern instanceof RegExp && pattern.test(attrName)) {\n return true\n }\n }\n }\n }\n return () => false\n}"],"names":["root","factory","exports","module","define","amd","this","__webpack_require__","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","Symbol","toStringTag","value","toXml","jArray","options","indentation","format","indentBy","length","arrToStr","arr","jPath","xmlStr","isPreviousElementTag","Array","isArray","text","toString","replaceEntitiesValue","i","tagObj","tagName","propName","undefined","newJPath","textNodeName","cdataPropName","commentPropName","newIdentation","tagStart","attr_to_str","tagValue","unpairedTags","indexOf","suppressUnpairedNode","suppressEmptyNode","endsWith","includes","attStr","tempInd","piTextNodeName","tagText","isStopNode","tagValueProcessor","keys","attrMap","attrStr","ignoreAttributes","attr","attrVal","attributeValueProcessor","suppressBooleanAttributes","substr","attributeNamePrefix","lastIndexOf","index","stopNodes","textValue","processEntities","entities","entity","replace","regex","val","defaultOptions","attributesGroupName","a","attrName","preserveOrder","RegExp","oneListGroup","Builder","assign","isAttribute","ignoreAttributesFn","_step","_iterator","_createForOfIteratorHelperLoose","done","pattern","test","attrPrefixLen","processTextOrObjNode","indentate","tagEndChar","newLine","object","level","ajPath","result","j2x","concat","buildTextValNode","buildObjectNode","repeat","name","startsWith","build","jObj","buildFromOrderedJs","arrayNodeName","_jObj","join","Date","buildAttrPairStr","newval","arrLen","listTagVal","listTagAttr","j","item","Ks","L","closeTag","tagEndExp","piClosingChar"],"sourceRoot":""}
|