@btc-embedded/cdk-extensions 0.23.3 → 0.23.5

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.
Files changed (135) hide show
  1. package/.jsii +41 -41
  2. package/CHANGELOG.md +14 -0
  3. package/assets/cli/catnip.js +154 -166
  4. package/lib/constructs/EventPipe.js +1 -1
  5. package/lib/constructs/ExportedService.js +1 -1
  6. package/lib/constructs/S3Bucket.js +1 -1
  7. package/lib/constructs/SecureRestApi.js +1 -1
  8. package/lib/constructs/SecureRestApiV2.js +1 -1
  9. package/lib/constructs/api-keys/ApiKeyClientAuthorization.js +1 -1
  10. package/lib/constructs/api-keys/ApiKeyManagement.js +1 -1
  11. package/lib/constructs/api-keys/ApiKeyPreTokenHandler.js +1 -1
  12. package/lib/constructs/api-keys/ApiKeyStore.js +1 -1
  13. package/lib/extensions/ApiGatewayExtension.js +1 -1
  14. package/lib/extensions/ApplicationContainer.js +1 -1
  15. package/lib/extensions/ApplicationLoadBalancerExtension.js +1 -1
  16. package/lib/extensions/ApplicationLoadBalancerExtensionV2.js +1 -1
  17. package/lib/extensions/CloudMapExtension.js +1 -1
  18. package/lib/extensions/DeactivatableServiceExtension.js +1 -1
  19. package/lib/extensions/DeploymentConfigExtension.js +1 -1
  20. package/lib/extensions/DocumentDbAccessExtension.js +1 -1
  21. package/lib/extensions/DomainEventMessagingExtension.js +1 -1
  22. package/lib/extensions/EfsMountExtension.js +1 -1
  23. package/lib/extensions/ExtraContainerExtension.js +1 -1
  24. package/lib/extensions/HTTPApiExtension.js +1 -1
  25. package/lib/extensions/LogExtension.js +1 -1
  26. package/lib/extensions/ModifyContainerDefinitionExtension.js +1 -1
  27. package/lib/extensions/ModifyTaskDefinitionExtension.js +1 -1
  28. package/lib/extensions/OpenIdExtension.js +1 -1
  29. package/lib/extensions/OpenTelemetryExtension.js +1 -1
  30. package/lib/extensions/PostgresDbAccessExtension.js +1 -1
  31. package/lib/extensions/SharedVolumeExtension.js +1 -1
  32. package/lib/extensions/TcpKeepAliveExtension.js +1 -1
  33. package/lib/platform/ApiGateway.js +1 -1
  34. package/lib/platform/ApiGatewayVpcLink.js +2 -2
  35. package/lib/platform/ApplicationLoadBalancer.js +1 -1
  36. package/lib/platform/ApplicationLoadBalancerV2.d.ts +1 -0
  37. package/lib/platform/ApplicationLoadBalancerV2.js +10 -3
  38. package/lib/platform/AuroraPostgresDB.js +5 -4
  39. package/lib/platform/BTCLogGroup.js +1 -1
  40. package/lib/platform/CognitoUserPool.js +2 -2
  41. package/lib/platform/DefaultUserPoolClients.js +1 -1
  42. package/lib/platform/DocumentDB.js +2 -2
  43. package/lib/platform/EcsCluster.js +1 -1
  44. package/lib/platform/EfsFileSystem.js +1 -1
  45. package/lib/platform/HostedZone.js +1 -1
  46. package/lib/platform/PrivateDnsNamespace.js +1 -1
  47. package/lib/platform/ResourceServer.js +1 -1
  48. package/lib/platform/Vpc.js +1 -1
  49. package/lib/platform/VpcV2.js +1 -1
  50. package/lib/stacks/ApplicationStack.js +1 -1
  51. package/lib/utils/BasePlatformStackResolver.js +1 -1
  52. package/lib/utils/StackParameter.js +1 -1
  53. package/node_modules/@nodable/entities/README.md +41 -0
  54. package/node_modules/@nodable/entities/package.json +54 -0
  55. package/node_modules/@nodable/entities/src/EntityDecoder.js +543 -0
  56. package/node_modules/@nodable/entities/src/EntityEncoder.js +194 -0
  57. package/node_modules/@nodable/entities/src/entities.js +1177 -0
  58. package/node_modules/@nodable/entities/src/entityTries.js +49 -0
  59. package/node_modules/@nodable/entities/src/index.d.ts +264 -0
  60. package/node_modules/@nodable/entities/src/index.js +29 -0
  61. package/node_modules/fast-xml-builder/CHANGELOG.md +40 -0
  62. package/node_modules/fast-xml-builder/LICENSE +21 -0
  63. package/node_modules/fast-xml-builder/README.md +74 -0
  64. package/node_modules/fast-xml-builder/lib/fxb.cjs +1 -0
  65. package/node_modules/fast-xml-builder/lib/fxb.d.cts +270 -0
  66. package/node_modules/fast-xml-builder/lib/fxb.min.js +2 -0
  67. package/node_modules/fast-xml-builder/lib/fxb.min.js.map +1 -0
  68. package/node_modules/fast-xml-builder/package.json +81 -0
  69. package/node_modules/fast-xml-builder/src/fxb.d.ts +270 -0
  70. package/node_modules/fast-xml-builder/src/fxb.js +599 -0
  71. package/node_modules/fast-xml-builder/src/ignoreAttributes.js +18 -0
  72. package/node_modules/fast-xml-builder/src/orderedJs2Xml.js +359 -0
  73. package/node_modules/fast-xml-builder/src/util.js +16 -0
  74. package/node_modules/fast-xml-parser/CHANGELOG.md +165 -0
  75. package/node_modules/fast-xml-parser/README.md +21 -44
  76. package/node_modules/fast-xml-parser/lib/fxbuilder.min.js +1 -1
  77. package/node_modules/fast-xml-parser/lib/fxbuilder.min.js.map +1 -1
  78. package/node_modules/fast-xml-parser/lib/fxp.cjs +1 -1
  79. package/node_modules/fast-xml-parser/lib/fxp.d.cts +343 -31
  80. package/node_modules/fast-xml-parser/lib/fxp.min.js +1 -1
  81. package/node_modules/fast-xml-parser/lib/fxp.min.js.map +1 -1
  82. package/node_modules/fast-xml-parser/lib/fxparser.min.js +1 -1
  83. package/node_modules/fast-xml-parser/lib/fxparser.min.js.map +1 -1
  84. package/node_modules/fast-xml-parser/lib/fxvalidator.min.js +1 -1
  85. package/node_modules/fast-xml-parser/lib/fxvalidator.min.js.map +1 -1
  86. package/node_modules/fast-xml-parser/package.json +13 -8
  87. package/node_modules/fast-xml-parser/src/fxp.d.ts +335 -30
  88. package/node_modules/fast-xml-parser/src/fxp.js +1 -1
  89. package/node_modules/fast-xml-parser/src/util.js +18 -25
  90. package/node_modules/fast-xml-parser/src/v6/EntitiesParser.js +89 -87
  91. package/node_modules/fast-xml-parser/src/v6/OptionsBuilder.js +10 -10
  92. package/node_modules/fast-xml-parser/src/v6/OutputBuilders/BaseOutputBuilder.js +23 -23
  93. package/node_modules/fast-xml-parser/src/v6/OutputBuilders/JsArrBuilder.js +29 -29
  94. package/node_modules/fast-xml-parser/src/v6/OutputBuilders/JsMinArrBuilder.js +1 -1
  95. package/node_modules/fast-xml-parser/src/v6/OutputBuilders/JsObjBuilder.js +39 -39
  96. package/node_modules/fast-xml-parser/src/v6/OutputBuilders/ParserOptionsBuilder.js +21 -21
  97. package/node_modules/fast-xml-parser/src/v6/XMLParser.js +22 -22
  98. package/node_modules/fast-xml-parser/src/v6/valueParsers/EntitiesParser.js +85 -85
  99. package/node_modules/fast-xml-parser/src/validator.js +34 -34
  100. package/node_modules/fast-xml-parser/src/xmlbuilder/json2xml.js +5 -284
  101. package/node_modules/fast-xml-parser/src/xmlparser/DocTypeReader.js +335 -293
  102. package/node_modules/fast-xml-parser/src/xmlparser/OptionsBuilder.js +160 -43
  103. package/node_modules/fast-xml-parser/src/xmlparser/OrderedObjParser.js +540 -308
  104. package/node_modules/fast-xml-parser/src/xmlparser/XMLParser.js +26 -26
  105. package/node_modules/fast-xml-parser/src/xmlparser/node2json.js +99 -41
  106. package/node_modules/fast-xml-parser/src/xmlparser/xmlNode.js +10 -10
  107. package/node_modules/path-expression-matcher/LICENSE +21 -0
  108. package/node_modules/path-expression-matcher/README.md +872 -0
  109. package/node_modules/path-expression-matcher/lib/pem.cjs +1 -0
  110. package/node_modules/path-expression-matcher/lib/pem.d.cts +634 -0
  111. package/node_modules/path-expression-matcher/lib/pem.min.js +2 -0
  112. package/node_modules/path-expression-matcher/lib/pem.min.js.map +1 -0
  113. package/node_modules/path-expression-matcher/package.json +78 -0
  114. package/node_modules/path-expression-matcher/src/Expression.js +232 -0
  115. package/node_modules/path-expression-matcher/src/ExpressionSet.js +209 -0
  116. package/node_modules/path-expression-matcher/src/Matcher.js +570 -0
  117. package/node_modules/path-expression-matcher/src/index.d.ts +523 -0
  118. package/node_modules/path-expression-matcher/src/index.js +29 -0
  119. package/node_modules/strnum/CHANGELOG.md +12 -2
  120. package/node_modules/strnum/README.md +1 -0
  121. package/node_modules/strnum/package.json +5 -4
  122. package/node_modules/strnum/strnum.js +99 -65
  123. package/node_modules/xml-naming/README.md +189 -0
  124. package/node_modules/xml-naming/package.json +54 -0
  125. package/node_modules/xml-naming/src/index.d.ts +74 -0
  126. package/node_modules/xml-naming/src/index.js +270 -0
  127. package/package.json +3 -2
  128. package/renovate.json5 +1 -0
  129. package/node_modules/fast-xml-parser/src/xmlbuilder/orderedJs2Xml.js +0 -134
  130. package/node_modules/strnum/.github/SECURITY.md +0 -5
  131. package/node_modules/strnum/.vscode/launch.json +0 -25
  132. package/node_modules/strnum/algo.stflow +0 -84
  133. package/node_modules/strnum/strnum.test.js +0 -173
  134. package/node_modules/strnum/test.js +0 -9
  135. /package/node_modules/{fast-xml-parser/src/xmlbuilder → fast-xml-builder/src}/prettifyJs2Xml.js +0 -0
@@ -1,3 +1,224 @@
1
+ /**
2
+ * Types copied from path-expression-matcher
3
+ * @version <version>
4
+ * @updated <date>
5
+ *
6
+ * Update this file when path-expression-matcher releases a new version.
7
+ * Source: https://github.com/NaturalIntelligence/path-expression-matcher
8
+ */
9
+
10
+ /**
11
+ * Options for creating an Expression
12
+ */
13
+ export interface ExpressionOptions {
14
+ /**
15
+ * Path separator character
16
+ * @default '.'
17
+ */
18
+ separator?: string;
19
+ }
20
+
21
+ /**
22
+ * Parsed segment from an expression pattern
23
+ */
24
+ export interface Segment {
25
+ type: 'tag' | 'deep-wildcard';
26
+ tag?: string;
27
+ namespace?: string;
28
+ attrName?: string;
29
+ attrValue?: string;
30
+ position?: 'first' | 'last' | 'odd' | 'even' | 'nth';
31
+ positionValue?: number;
32
+ }
33
+
34
+ /**
35
+ * Expression - Parses and stores a tag pattern expression.
36
+ * Patterns are parsed once and stored in an optimized structure for fast matching.
37
+ *
38
+ * @example
39
+ * ```typescript
40
+ * const expr = new Expression("root.users.user");
41
+ * const expr2 = new Expression("..user[id]:first");
42
+ * const expr3 = new Expression("root/users/user", { separator: '/' });
43
+ * ```
44
+ *
45
+ * Pattern Syntax:
46
+ * - `root.users.user` — Match exact path
47
+ * - `..user` — Match "user" at any depth (deep wildcard)
48
+ * - `user[id]` — Match user tag with "id" attribute
49
+ * - `user[id=123]` — Match user tag where id="123"
50
+ * - `user:first` — Match first occurrence of user tag
51
+ * - `ns::user` — Match user tag with namespace "ns"
52
+ * - `ns::user[id]:first` — Combine namespace, attribute, and position
53
+ */
54
+ export class Expression {
55
+ readonly pattern: string;
56
+ readonly separator: string;
57
+ readonly segments: Segment[];
58
+
59
+ constructor(pattern: string, options?: ExpressionOptions);
60
+
61
+ get length(): number;
62
+ hasDeepWildcard(): boolean;
63
+ hasAttributeCondition(): boolean;
64
+ hasPositionSelector(): boolean;
65
+ toString(): string;
66
+ }
67
+
68
+ // ---------------------------------------------------------------------------
69
+ // MatcherView
70
+ // ---------------------------------------------------------------------------
71
+
72
+ /**
73
+ * A lightweight, live read-only view of a Matcher instance.
74
+ *
75
+ * Returned by `Matcher.readOnly()`. The same instance is reused across every
76
+ * callback invocation — no allocation overhead per call. Reads directly from
77
+ * the parent Matcher's internal state so it always reflects the current parser
78
+ * position with no copying or freezing.
79
+ *
80
+ * Mutation methods (`push`, `pop`, `reset`, `updateCurrent`, `restore`) are
81
+ * simply absent — misuse is caught at compile time by TypeScript.
82
+ *
83
+ * This is the type received by all FXP user callbacks when `jPath: false`.
84
+ */
85
+ export class MatcherView {
86
+ readonly separator: string;
87
+
88
+ /** Check if current path matches an Expression. */
89
+ matches(expression: Expression): boolean;
90
+
91
+ /** Get current tag name, or `undefined` if path is empty. */
92
+ getCurrentTag(): string | undefined;
93
+
94
+ /** Get current namespace, or `undefined` if not present. */
95
+ getCurrentNamespace(): string | undefined;
96
+
97
+ /** Get attribute value of the current node. */
98
+ getAttrValue(attrName: string): any;
99
+
100
+ /** Check if the current node has a given attribute. */
101
+ hasAttr(attrName: string): boolean;
102
+
103
+ /** Sibling position of the current node (child index in parent). */
104
+ getPosition(): number;
105
+
106
+ /** Occurrence counter of the current tag name at this level. */
107
+ getCounter(): number;
108
+
109
+ /** Number of nodes in the current path. */
110
+ getDepth(): number;
111
+
112
+ /** Current path as a string (e.g. `"root.users.user"`). */
113
+ toString(separator?: string, includeNamespace?: boolean): string;
114
+
115
+ /** Current path as an array of tag names. */
116
+ toArray(): string[];
117
+ }
118
+
119
+ /**
120
+ * @deprecated Use {@link MatcherView} instead.
121
+ * Alias kept for backward compatibility.
122
+ */
123
+ export type ReadonlyMatcher = MatcherView;
124
+
125
+ /** Internal node structure — exposed via snapshot only. */
126
+ export interface PathNode {
127
+ tag: string;
128
+ namespace?: string;
129
+ position: number;
130
+ counter: number;
131
+ values?: Record<string, any>;
132
+ }
133
+
134
+ /** Snapshot of matcher state returned by `snapshot()` and `readOnly().snapshot()`. */
135
+ export interface MatcherSnapshot {
136
+ path: PathNode[];
137
+ siblingStacks: Map<string, number>[];
138
+ }
139
+
140
+ /**********************************************************************
141
+ *
142
+ * END of path-expression-matcher relevant typings
143
+ *
144
+ **********************************************************************/
145
+
146
+ // jPath: true → string
147
+ // jPath: false → MatcherView
148
+ type JPathOrMatcher = string | MatcherView;
149
+ type JPathOrExpression = string | Expression;
150
+
151
+ export type ProcessEntitiesOptions = {
152
+ /**
153
+ * Whether to enable entity processing
154
+ *
155
+ * Defaults to `true`
156
+ */
157
+ enabled?: boolean;
158
+
159
+ /**
160
+ * Maximum size in characters for a single entity definition
161
+ *
162
+ * Defaults to `10000`
163
+ */
164
+ maxEntitySize?: number;
165
+
166
+ /**
167
+ * Maximum depth for nested entity references (reserved for future use)
168
+ *
169
+ * Defaults to `10`
170
+ */
171
+ maxExpansionDepth?: number;
172
+
173
+ /**
174
+ * Maximum total number of entity expansions allowed
175
+ *
176
+ * Defaults to `1000`
177
+ */
178
+ maxTotalExpansions?: number;
179
+
180
+ /**
181
+ * Maximum total expanded content length in characters
182
+ *
183
+ * Defaults to `100000`
184
+ */
185
+ maxExpandedLength?: number;
186
+
187
+ /**
188
+ * Maximum number of entities allowed in the XML
189
+ *
190
+ * Defaults to `100`
191
+ */
192
+ maxEntityCount?: number;
193
+
194
+ /**
195
+ * Array of tag names where entity replacement is allowed.
196
+ * If null, entities are replaced in all tags.
197
+ *
198
+ * Defaults to `null`
199
+ */
200
+ allowedTags?: string[] | null;
201
+
202
+ /**
203
+ * Custom filter function to determine if entities should be replaced in a tag
204
+ *
205
+ * @param tagName - The name of the current tag
206
+ * @param jPathOrMatcher - The jPath string (if jPath: true) or Matcher instance (if jPath: false)
207
+ * @returns `true` to allow entity replacement, `false` to skip
208
+ *
209
+ * Defaults to `null`
210
+ */
211
+ tagFilter?: ((tagName: string, jPathOrMatcher: JPathOrMatcher) => boolean) | null;
212
+ };
213
+
214
+ export type EntityDecoderOptions = {
215
+ setExternalEntities: (entities: Record<string, string>) => void;
216
+ addInputEntities: (entities: Record<string, string>) => void;
217
+ reset: () => void;
218
+ decode: (text: string) => string;
219
+ setXmlVersion: (version: string) => void;
220
+ }
221
+
1
222
  export type X2jOptions = {
2
223
  /**
3
224
  * Preserve the order of tags in resulting JS object
@@ -10,7 +231,7 @@ export type X2jOptions = {
10
231
  * Give a prefix to the attribute name in the resulting JS object
11
232
  *
12
233
  * Defaults to '@_'
13
- */
234
+ */
14
235
  attributeNamePrefix?: string;
15
236
 
16
237
  /**
@@ -40,7 +261,7 @@ export type X2jOptions = {
40
261
  *
41
262
  * Defaults to `true`
42
263
  */
43
- ignoreAttributes?: boolean | (string | RegExp)[] | ((attrName: string, jPath: string) => boolean);
264
+ ignoreAttributes?: boolean | (string | RegExp)[] | ((attrName: string, jPathOrMatcher: JPathOrMatcher) => boolean);
44
265
 
45
266
  /**
46
267
  * Whether to remove namespace string from tag and attribute names
@@ -64,7 +285,7 @@ export type X2jOptions = {
64
285
  parseTagValue?: boolean;
65
286
 
66
287
  /**
67
- * Whether to parse tag value with `strnum` package
288
+ * Whether to parse attribute value with `strnum` package
68
289
  *
69
290
  * Defaults to `false`
70
291
  */
@@ -94,28 +315,33 @@ export type X2jOptions = {
94
315
  /**
95
316
  * Control how tag value should be parsed. Called only if tag value is not empty
96
317
  *
318
+ * @param tagName - The name of the tag
319
+ * @param tagValue - The value of the tag
320
+ * @param jPathOrMatcher - The jPath string (if jPath: true) or Matcher instance (if jPath: false)
321
+ * @param hasAttributes - Whether the tag has attributes
322
+ * @param isLeafNode - Whether the tag is a leaf node
97
323
  * @returns {undefined|null} `undefined` or `null` to set original value.
98
324
  * @returns {unknown}
99
325
  *
100
326
  * 1. Different value or value with different data type to set new value.
101
327
  * 2. Same value to set parsed value if `parseTagValue: true`.
102
328
  *
103
- * Defaults to `(tagName, val, jPath, hasAttributes, isLeafNode) => val`
329
+ * Defaults to `(tagName, val, jPathOrMatcher, hasAttributes, isLeafNode) => val`
104
330
  */
105
- tagValueProcessor?: (tagName: string, tagValue: string, jPath: string, hasAttributes: boolean, isLeafNode: boolean) => unknown;
331
+ tagValueProcessor?: (tagName: string, tagValue: string, jPathOrMatcher: JPathOrMatcher, hasAttributes: boolean, isLeafNode: boolean) => unknown;
106
332
 
107
333
  /**
108
334
  * Control how attribute value should be parsed
109
335
  *
110
- * @param attrName
111
- * @param attrValue
112
- * @param jPath
336
+ * @param attrName - The name of the attribute
337
+ * @param attrValue - The value of the attribute
338
+ * @param jPathOrMatcher - The jPath string (if jPath: true) or Matcher instance (if jPath: false)
113
339
  * @returns {undefined|null} `undefined` or `null` to set original value
114
340
  * @returns {unknown}
115
341
  *
116
- * Defaults to `(attrName, val, jPath) => val`
342
+ * Defaults to `(attrName, val, jPathOrMatcher) => val`
117
343
  */
118
- attributeValueProcessor?: (attrName: string, attrValue: string, jPath: string) => unknown;
344
+ attributeValueProcessor?: (attrName: string, attrValue: string, jPathOrMatcher: JPathOrMatcher) => unknown;
119
345
 
120
346
  /**
121
347
  * Options to pass to `strnum` for parsing numbers
@@ -127,9 +353,13 @@ export type X2jOptions = {
127
353
  /**
128
354
  * Nodes to stop parsing at
129
355
  *
356
+ * Accepts string patterns or Expression objects from path-expression-matcher
357
+ *
358
+ * String patterns starting with "*." are automatically converted to ".." for backward compatibility
359
+ *
130
360
  * Defaults to `[]`
131
361
  */
132
- stopNodes?: string[];
362
+ stopNodes?: JPathOrExpression[];
133
363
 
134
364
  /**
135
365
  * List of tags without closing tags
@@ -148,30 +378,41 @@ export type X2jOptions = {
148
378
  /**
149
379
  * Determine whether a tag should be parsed as an array
150
380
  *
151
- * @param tagName
152
- * @param jPath
153
- * @param isLeafNode
154
- * @param isAttribute
381
+ * @param tagName - The name of the tag
382
+ * @param jPathOrMatcher - The jPath string (if jPath: true) or Matcher instance (if jPath: false)
383
+ * @param isLeafNode - Whether the tag is a leaf node
384
+ * @param isAttribute - Whether this is an attribute
155
385
  * @returns {boolean}
156
386
  *
157
387
  * Defaults to `() => false`
158
388
  */
159
- isArray?: (tagName: string, jPath: string, isLeafNode: boolean, isAttribute: boolean) => boolean;
389
+ isArray?: (tagName: string, jPathOrMatcher: JPathOrMatcher, isLeafNode: boolean, isAttribute: boolean) => boolean;
160
390
 
161
391
  /**
162
392
  * Whether to process default and DOCTYPE entities
163
393
  *
394
+ * When `true` - enables entity processing with default limits
395
+ *
396
+ * When `false` - disables all entity processing
397
+ *
398
+ * When `ProcessEntitiesOptions` - enables entity processing with custom configuration
399
+ *
164
400
  * Defaults to `true`
165
401
  */
166
- processEntities?: boolean;
402
+ processEntities?: boolean | ProcessEntitiesOptions;
167
403
 
168
404
  /**
169
405
  * Whether to process HTML entities
170
406
  *
171
407
  * Defaults to `false`
408
+ * @deprecated Use `entityDecoder` instead
172
409
  */
173
410
  htmlEntities?: boolean;
174
411
 
412
+ /**
413
+ * Custom entity decoder
414
+ */
415
+ entityDecoder?: EntityDecoderOptions;
175
416
  /**
176
417
  * Whether to ignore the declaration tag from output
177
418
  *
@@ -204,20 +445,60 @@ export type X2jOptions = {
204
445
  * Change the tag name when a different name is returned. Skip the tag from parsed result when false is returned.
205
446
  * Modify `attrs` object to control attributes for the given tag.
206
447
  *
448
+ * @param tagName - The name of the tag
449
+ * @param jPathOrMatcher - The jPath string (if jPath: true) or Matcher instance (if jPath: false)
450
+ * @param attrs - The attributes object
207
451
  * @returns {string} new tag name.
208
452
  * @returns false to skip the tag
209
453
  *
210
- * Defaults to `(tagName, jPath, attrs) => tagName`
454
+ * Defaults to `(tagName, jPathOrMatcher, attrs) => tagName`
211
455
  */
212
- updateTag?: (tagName: string, jPath: string, attrs: {[k: string]: string}) => string | boolean;
456
+ updateTag?: (tagName: string, jPathOrMatcher: JPathOrMatcher, attrs: { [k: string]: string }) => string | boolean;
213
457
 
214
458
  /**
215
459
  * If true, adds a Symbol to all object nodes, accessible by {@link XMLParser.getMetaDataSymbol} with
216
460
  * metadata about each the node in the XML file.
217
461
  */
218
462
  captureMetaData?: boolean;
463
+
464
+ /**
465
+ * Maximum number of nested tags
466
+ *
467
+ * Defaults to `100`
468
+ */
469
+ maxNestedTags?: number;
470
+
471
+ /**
472
+ * Whether to strictly validate tag names
473
+ *
474
+ * Defaults to `true`
475
+ */
476
+ strictReservedNames?: boolean;
477
+
478
+ /**
479
+ * Controls whether callbacks receive jPath as string or Matcher instance
480
+ *
481
+ * When `true` - callbacks receive jPath as string (backward compatible)
482
+ *
483
+ * When `false` - callbacks receive Matcher instance for advanced pattern matching
484
+ *
485
+ * Defaults to `true`
486
+ */
487
+ jPath?: boolean;
488
+
489
+ /**
490
+ * Function to sanitize dangerous property names
491
+ *
492
+ * @param name - The name of the property
493
+ * @returns {string} The sanitized name
494
+ *
495
+ * Defaults to `(name) => __name`
496
+ */
497
+ onDangerousProperty?: (name: string) => string;
219
498
  };
220
499
 
500
+
501
+
221
502
  export type strnumOptions = {
222
503
  hex: boolean;
223
504
  leadingZeros: boolean,
@@ -232,7 +513,7 @@ export type validationOptions = {
232
513
  * Defaults to `false`
233
514
  */
234
515
  allowBooleanAttributes?: boolean;
235
-
516
+
236
517
  /**
237
518
  * List of tags without closing tags
238
519
  *
@@ -246,7 +527,7 @@ export type XmlBuilderOptions = {
246
527
  * Give a prefix to the attribute name in the resulting JS object
247
528
  *
248
529
  * Defaults to '@_'
249
- */
530
+ */
250
531
  attributeNamePrefix?: string;
251
532
 
252
533
  /**
@@ -352,9 +633,11 @@ export type XmlBuilderOptions = {
352
633
  /**
353
634
  * Nodes to stop parsing at
354
635
  *
636
+ * Accepts string patterns or Expression objects from path-expression-matcher
637
+ *
355
638
  * Defaults to `[]`
356
639
  */
357
- stopNodes?: string[];
640
+ stopNodes?: JPathOrExpression[];
358
641
 
359
642
  /**
360
643
  * Control how tag value should be parsed. Called only if tag value is not empty
@@ -391,26 +674,41 @@ export type XmlBuilderOptions = {
391
674
 
392
675
 
393
676
  oneListGroup?: boolean;
677
+
678
+ /**
679
+ * Maximum number of nested tags
680
+ *
681
+ * Defaults to `100`
682
+ */
683
+ maxNestedTags?: number;
394
684
  };
395
685
 
396
- type ESchema = string | object | Array<string|object>;
686
+ type ESchema = string | object | Array<string | object>;
397
687
 
398
688
  export type ValidationError = {
399
- err: {
689
+ err: {
400
690
  code: string;
401
691
  msg: string,
402
692
  line: number,
403
- col: number
693
+ col: number
404
694
  };
405
695
  };
406
696
 
407
697
  export class XMLParser {
408
698
  constructor(options?: X2jOptions);
409
- parse(xmlData: string | Buffer ,validationOptions?: validationOptions | boolean): any;
699
+
700
+ parse(xmlData: string | Uint8Array): any;
701
+ /**
702
+ * @deprecated The `validationOptions` parameter is deprecated.
703
+ * Use the `fast-xml-validator` package instead for XML validation.
704
+ * @see https://www.npmjs.com/package/fast-xml-validator
705
+ */
706
+ parse(xmlData: string | Uint8Array, validationOptions: validationOptions | boolean): any;
410
707
  /**
411
708
  * Add Entity which is not by default supported by this library
412
709
  * @param entityIdentifier {string} Eg: 'ent' for &ent;
413
710
  * @param entityValue {string} Eg: '\r'
711
+ * @deprecated Use `entityDecoder` instead
414
712
  */
415
713
  addEntity(entityIdentifier: string, entityValue: string): void;
416
714
 
@@ -424,12 +722,19 @@ export class XMLParser {
424
722
  * The XMLMetaData property is only present when {@link X2jOptions.captureMetaData}
425
723
  * is true in the options.
426
724
  */
427
- static getMetaDataSymbol() : Symbol;
725
+ static getMetaDataSymbol(): Symbol;
428
726
  }
429
727
 
430
- export class XMLValidator{
431
- static validate( xmlData: string, options?: validationOptions): true | ValidationError;
728
+ /**
729
+ * @deprecated Use fast-xml-validator instead
730
+ * @see https://www.npmjs.com/package/fast-xml-validator
731
+ */
732
+ export class XMLValidator {
733
+ static validate(xmlData: string, options?: validationOptions): true | ValidationError;
432
734
  }
735
+ /**
736
+ * @deprecated Use npm package 'fast-xml-builder' instead
737
+ */
433
738
  export class XMLBuilder {
434
739
  constructor(options?: XmlBuilderOptions);
435
740
  build(jObj: any): string;
@@ -442,4 +747,4 @@ export class XMLBuilder {
442
747
  export interface XMLMetaData {
443
748
  /** The index, if available, of the character where the XML node began in the input stream. */
444
749
  startIndex?: number;
445
- }
750
+ }
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- import {validate} from './validator.js';
3
+ import { validate } from './validator.js';
4
4
  import XMLParser from './xmlparser/XMLParser.js';
5
5
  import XMLBuilder from './xmlbuilder/json2xml.js';
6
6
 
@@ -21,7 +21,7 @@ export function getAllMatches(string, regex) {
21
21
  return matches;
22
22
  }
23
23
 
24
- export const isName = function(string) {
24
+ export const isName = function (string) {
25
25
  const match = regexName.exec(string);
26
26
  return !(match === null || typeof match === 'undefined');
27
27
  }
@@ -34,28 +34,6 @@ export function isEmptyObject(obj) {
34
34
  return Object.keys(obj).length === 0;
35
35
  }
36
36
 
37
- /**
38
- * Copy all the properties of a into b.
39
- * @param {*} target
40
- * @param {*} a
41
- */
42
- export function merge(target, a, arrayMode) {
43
- if (a) {
44
- const keys = Object.keys(a); // will return an array of own properties
45
- const len = keys.length; //don't make it inline
46
- for (let i = 0; i < len; i++) {
47
- if (arrayMode === 'strict') {
48
- target[keys[i]] = [ a[keys[i]] ];
49
- } else {
50
- target[keys[i]] = a[keys[i]];
51
- }
52
- }
53
- }
54
- }
55
- /* exports.merge =function (b,a){
56
- return Object.assign(b,a);
57
- } */
58
-
59
37
  export function getValue(v) {
60
38
  if (exports.isExist(v)) {
61
39
  return v;
@@ -64,5 +42,20 @@ export function getValue(v) {
64
42
  }
65
43
  }
66
44
 
67
- // const fakeCall = function(a) {return a;};
68
- // const fakeCallNoReturn = function() {};
45
+ /**
46
+ * Dangerous property names that could lead to prototype pollution or security issues
47
+ */
48
+ export const DANGEROUS_PROPERTY_NAMES = [
49
+ // '__proto__',
50
+ // 'constructor',
51
+ // 'prototype',
52
+ 'hasOwnProperty',
53
+ 'toString',
54
+ 'valueOf',
55
+ '__defineGetter__',
56
+ '__defineSetter__',
57
+ '__lookupGetter__',
58
+ '__lookupSetter__'
59
+ ];
60
+
61
+ export const criticalProperties = ["__proto__", "constructor", "prototype"];