@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.
- package/.jsii +41 -41
- package/CHANGELOG.md +14 -0
- package/assets/cli/catnip.js +154 -166
- package/lib/constructs/EventPipe.js +1 -1
- package/lib/constructs/ExportedService.js +1 -1
- package/lib/constructs/S3Bucket.js +1 -1
- package/lib/constructs/SecureRestApi.js +1 -1
- package/lib/constructs/SecureRestApiV2.js +1 -1
- package/lib/constructs/api-keys/ApiKeyClientAuthorization.js +1 -1
- package/lib/constructs/api-keys/ApiKeyManagement.js +1 -1
- package/lib/constructs/api-keys/ApiKeyPreTokenHandler.js +1 -1
- package/lib/constructs/api-keys/ApiKeyStore.js +1 -1
- package/lib/extensions/ApiGatewayExtension.js +1 -1
- package/lib/extensions/ApplicationContainer.js +1 -1
- package/lib/extensions/ApplicationLoadBalancerExtension.js +1 -1
- package/lib/extensions/ApplicationLoadBalancerExtensionV2.js +1 -1
- package/lib/extensions/CloudMapExtension.js +1 -1
- package/lib/extensions/DeactivatableServiceExtension.js +1 -1
- package/lib/extensions/DeploymentConfigExtension.js +1 -1
- package/lib/extensions/DocumentDbAccessExtension.js +1 -1
- package/lib/extensions/DomainEventMessagingExtension.js +1 -1
- package/lib/extensions/EfsMountExtension.js +1 -1
- package/lib/extensions/ExtraContainerExtension.js +1 -1
- package/lib/extensions/HTTPApiExtension.js +1 -1
- package/lib/extensions/LogExtension.js +1 -1
- package/lib/extensions/ModifyContainerDefinitionExtension.js +1 -1
- package/lib/extensions/ModifyTaskDefinitionExtension.js +1 -1
- package/lib/extensions/OpenIdExtension.js +1 -1
- package/lib/extensions/OpenTelemetryExtension.js +1 -1
- package/lib/extensions/PostgresDbAccessExtension.js +1 -1
- package/lib/extensions/SharedVolumeExtension.js +1 -1
- package/lib/extensions/TcpKeepAliveExtension.js +1 -1
- package/lib/platform/ApiGateway.js +1 -1
- package/lib/platform/ApiGatewayVpcLink.js +2 -2
- package/lib/platform/ApplicationLoadBalancer.js +1 -1
- package/lib/platform/ApplicationLoadBalancerV2.d.ts +1 -0
- package/lib/platform/ApplicationLoadBalancerV2.js +10 -3
- package/lib/platform/AuroraPostgresDB.js +5 -4
- package/lib/platform/BTCLogGroup.js +1 -1
- package/lib/platform/CognitoUserPool.js +2 -2
- package/lib/platform/DefaultUserPoolClients.js +1 -1
- package/lib/platform/DocumentDB.js +2 -2
- package/lib/platform/EcsCluster.js +1 -1
- package/lib/platform/EfsFileSystem.js +1 -1
- package/lib/platform/HostedZone.js +1 -1
- package/lib/platform/PrivateDnsNamespace.js +1 -1
- package/lib/platform/ResourceServer.js +1 -1
- package/lib/platform/Vpc.js +1 -1
- package/lib/platform/VpcV2.js +1 -1
- package/lib/stacks/ApplicationStack.js +1 -1
- package/lib/utils/BasePlatformStackResolver.js +1 -1
- package/lib/utils/StackParameter.js +1 -1
- package/node_modules/@nodable/entities/README.md +41 -0
- package/node_modules/@nodable/entities/package.json +54 -0
- package/node_modules/@nodable/entities/src/EntityDecoder.js +543 -0
- package/node_modules/@nodable/entities/src/EntityEncoder.js +194 -0
- package/node_modules/@nodable/entities/src/entities.js +1177 -0
- package/node_modules/@nodable/entities/src/entityTries.js +49 -0
- package/node_modules/@nodable/entities/src/index.d.ts +264 -0
- package/node_modules/@nodable/entities/src/index.js +29 -0
- package/node_modules/fast-xml-builder/CHANGELOG.md +40 -0
- package/node_modules/fast-xml-builder/LICENSE +21 -0
- package/node_modules/fast-xml-builder/README.md +74 -0
- package/node_modules/fast-xml-builder/lib/fxb.cjs +1 -0
- package/node_modules/fast-xml-builder/lib/fxb.d.cts +270 -0
- 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 +81 -0
- package/node_modules/fast-xml-builder/src/fxb.d.ts +270 -0
- package/node_modules/fast-xml-builder/src/fxb.js +599 -0
- package/node_modules/fast-xml-builder/src/ignoreAttributes.js +18 -0
- package/node_modules/fast-xml-builder/src/orderedJs2Xml.js +359 -0
- package/node_modules/fast-xml-builder/src/util.js +16 -0
- package/node_modules/fast-xml-parser/CHANGELOG.md +165 -0
- package/node_modules/fast-xml-parser/README.md +21 -44
- package/node_modules/fast-xml-parser/lib/fxbuilder.min.js +1 -1
- package/node_modules/fast-xml-parser/lib/fxbuilder.min.js.map +1 -1
- package/node_modules/fast-xml-parser/lib/fxp.cjs +1 -1
- package/node_modules/fast-xml-parser/lib/fxp.d.cts +343 -31
- package/node_modules/fast-xml-parser/lib/fxp.min.js +1 -1
- package/node_modules/fast-xml-parser/lib/fxp.min.js.map +1 -1
- package/node_modules/fast-xml-parser/lib/fxparser.min.js +1 -1
- package/node_modules/fast-xml-parser/lib/fxparser.min.js.map +1 -1
- package/node_modules/fast-xml-parser/lib/fxvalidator.min.js +1 -1
- package/node_modules/fast-xml-parser/lib/fxvalidator.min.js.map +1 -1
- package/node_modules/fast-xml-parser/package.json +13 -8
- package/node_modules/fast-xml-parser/src/fxp.d.ts +335 -30
- package/node_modules/fast-xml-parser/src/fxp.js +1 -1
- package/node_modules/fast-xml-parser/src/util.js +18 -25
- package/node_modules/fast-xml-parser/src/v6/EntitiesParser.js +89 -87
- package/node_modules/fast-xml-parser/src/v6/OptionsBuilder.js +10 -10
- package/node_modules/fast-xml-parser/src/v6/OutputBuilders/BaseOutputBuilder.js +23 -23
- package/node_modules/fast-xml-parser/src/v6/OutputBuilders/JsArrBuilder.js +29 -29
- package/node_modules/fast-xml-parser/src/v6/OutputBuilders/JsMinArrBuilder.js +1 -1
- package/node_modules/fast-xml-parser/src/v6/OutputBuilders/JsObjBuilder.js +39 -39
- package/node_modules/fast-xml-parser/src/v6/OutputBuilders/ParserOptionsBuilder.js +21 -21
- package/node_modules/fast-xml-parser/src/v6/XMLParser.js +22 -22
- package/node_modules/fast-xml-parser/src/v6/valueParsers/EntitiesParser.js +85 -85
- package/node_modules/fast-xml-parser/src/validator.js +34 -34
- package/node_modules/fast-xml-parser/src/xmlbuilder/json2xml.js +5 -284
- package/node_modules/fast-xml-parser/src/xmlparser/DocTypeReader.js +335 -293
- package/node_modules/fast-xml-parser/src/xmlparser/OptionsBuilder.js +160 -43
- package/node_modules/fast-xml-parser/src/xmlparser/OrderedObjParser.js +540 -308
- package/node_modules/fast-xml-parser/src/xmlparser/XMLParser.js +26 -26
- package/node_modules/fast-xml-parser/src/xmlparser/node2json.js +99 -41
- package/node_modules/fast-xml-parser/src/xmlparser/xmlNode.js +10 -10
- package/node_modules/path-expression-matcher/LICENSE +21 -0
- package/node_modules/path-expression-matcher/README.md +872 -0
- package/node_modules/path-expression-matcher/lib/pem.cjs +1 -0
- package/node_modules/path-expression-matcher/lib/pem.d.cts +634 -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/ExpressionSet.js +209 -0
- package/node_modules/path-expression-matcher/src/Matcher.js +570 -0
- package/node_modules/path-expression-matcher/src/index.d.ts +523 -0
- package/node_modules/path-expression-matcher/src/index.js +29 -0
- package/node_modules/strnum/CHANGELOG.md +12 -2
- package/node_modules/strnum/README.md +1 -0
- package/node_modules/strnum/package.json +5 -4
- package/node_modules/strnum/strnum.js +99 -65
- package/node_modules/xml-naming/README.md +189 -0
- package/node_modules/xml-naming/package.json +54 -0
- package/node_modules/xml-naming/src/index.d.ts +74 -0
- package/node_modules/xml-naming/src/index.js +270 -0
- package/package.json +3 -2
- package/renovate.json5 +1 -0
- package/node_modules/fast-xml-parser/src/xmlbuilder/orderedJs2Xml.js +0 -134
- package/node_modules/strnum/.github/SECURITY.md +0 -5
- package/node_modules/strnum/.vscode/launch.json +0 -25
- package/node_modules/strnum/algo.stflow +0 -84
- package/node_modules/strnum/strnum.test.js +0 -173
- package/node_modules/strnum/test.js +0 -9
- /package/node_modules/{fast-xml-parser/src/xmlbuilder → fast-xml-builder/src}/prettifyJs2Xml.js +0 -0
|
@@ -1,3 +1,232 @@
|
|
|
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
|
+
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
|
+
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
|
+
declare 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
|
+
interface 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
|
+
* Create a snapshot of the current state.
|
|
120
|
+
* The snapshot can be passed to the real Matcher.restore() if needed.
|
|
121
|
+
*/
|
|
122
|
+
snapshot(): MatcherSnapshot;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* @deprecated Use {@link MatcherView} instead.
|
|
127
|
+
* Alias kept for backward compatibility.
|
|
128
|
+
*/
|
|
129
|
+
type ReadonlyMatcher = MatcherView;
|
|
130
|
+
|
|
131
|
+
/** Internal node structure — exposed via snapshot only. */
|
|
132
|
+
interface PathNode {
|
|
133
|
+
tag: string;
|
|
134
|
+
namespace?: string;
|
|
135
|
+
position: number;
|
|
136
|
+
counter: number;
|
|
137
|
+
values?: Record<string, any>;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/** Snapshot of matcher state returned by `snapshot()` and `readOnly().snapshot()`. */
|
|
141
|
+
interface MatcherSnapshot {
|
|
142
|
+
path: PathNode[];
|
|
143
|
+
siblingStacks: Map<string, number>[];
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
/**********************************************************************
|
|
147
|
+
*
|
|
148
|
+
* END of path-expression-matcher relevant typings
|
|
149
|
+
*
|
|
150
|
+
**********************************************************************/
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
// jPath: true → string
|
|
155
|
+
// jPath: false → MatcherView
|
|
156
|
+
type JPathOrMatcher = string | MatcherView;
|
|
157
|
+
type JPathOrExpression = string | Expression;
|
|
158
|
+
|
|
159
|
+
type ProcessEntitiesOptions = {
|
|
160
|
+
/**
|
|
161
|
+
* Whether to enable entity processing
|
|
162
|
+
*
|
|
163
|
+
* Defaults to `true`
|
|
164
|
+
*/
|
|
165
|
+
enabled?: boolean;
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* Maximum size in characters for a single entity definition
|
|
169
|
+
*
|
|
170
|
+
* Defaults to `10000`
|
|
171
|
+
*/
|
|
172
|
+
maxEntitySize?: number;
|
|
173
|
+
|
|
174
|
+
/**
|
|
175
|
+
* Maximum depth for nested entity references (reserved for future use)
|
|
176
|
+
*
|
|
177
|
+
* Defaults to `10`
|
|
178
|
+
*/
|
|
179
|
+
maxExpansionDepth?: number;
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* Maximum total number of entity expansions allowed
|
|
183
|
+
*
|
|
184
|
+
* Defaults to `1000`
|
|
185
|
+
*/
|
|
186
|
+
maxTotalExpansions?: number;
|
|
187
|
+
|
|
188
|
+
/**
|
|
189
|
+
* Maximum total expanded content length in characters
|
|
190
|
+
*
|
|
191
|
+
* Defaults to `100000`
|
|
192
|
+
*/
|
|
193
|
+
maxExpandedLength?: number;
|
|
194
|
+
|
|
195
|
+
/**
|
|
196
|
+
* Maximum number of entities allowed in the XML
|
|
197
|
+
*
|
|
198
|
+
* Defaults to `100`
|
|
199
|
+
*/
|
|
200
|
+
maxEntityCount?: number;
|
|
201
|
+
|
|
202
|
+
/**
|
|
203
|
+
* Array of tag names where entity replacement is allowed.
|
|
204
|
+
* If null, entities are replaced in all tags.
|
|
205
|
+
*
|
|
206
|
+
* Defaults to `null`
|
|
207
|
+
*/
|
|
208
|
+
allowedTags?: string[] | null;
|
|
209
|
+
|
|
210
|
+
/**
|
|
211
|
+
* Custom filter function to determine if entities should be replaced in a tag
|
|
212
|
+
*
|
|
213
|
+
* @param tagName - The name of the current tag
|
|
214
|
+
* @param jPathOrMatcher - The jPath string (if jPath: true) or Matcher instance (if jPath: false)
|
|
215
|
+
* @returns `true` to allow entity replacement, `false` to skip
|
|
216
|
+
*
|
|
217
|
+
* Defaults to `null`
|
|
218
|
+
*/
|
|
219
|
+
tagFilter?: ((tagName: string, jPathOrMatcher: JPathOrMatcher) => boolean) | null;
|
|
220
|
+
};
|
|
221
|
+
|
|
222
|
+
type EntityDecoderOptions = {
|
|
223
|
+
setExternalEntities: (entities: Record<string, string>) => void;
|
|
224
|
+
addInputEntities: (entities: Record<string, string>) => void;
|
|
225
|
+
reset: () => void;
|
|
226
|
+
decode: (text: string) => string;
|
|
227
|
+
setXmlVersion: (version: string) => void;
|
|
228
|
+
}
|
|
229
|
+
|
|
1
230
|
type X2jOptions = {
|
|
2
231
|
/**
|
|
3
232
|
* Preserve the order of tags in resulting JS object
|
|
@@ -10,7 +239,7 @@ type X2jOptions = {
|
|
|
10
239
|
* Give a prefix to the attribute name in the resulting JS object
|
|
11
240
|
*
|
|
12
241
|
* Defaults to '@_'
|
|
13
|
-
*/
|
|
242
|
+
*/
|
|
14
243
|
attributeNamePrefix?: string;
|
|
15
244
|
|
|
16
245
|
/**
|
|
@@ -40,7 +269,7 @@ type X2jOptions = {
|
|
|
40
269
|
*
|
|
41
270
|
* Defaults to `true`
|
|
42
271
|
*/
|
|
43
|
-
ignoreAttributes?: boolean | (string | RegExp)[] | ((attrName: string,
|
|
272
|
+
ignoreAttributes?: boolean | (string | RegExp)[] | ((attrName: string, jPathOrMatcher: JPathOrMatcher) => boolean);
|
|
44
273
|
|
|
45
274
|
/**
|
|
46
275
|
* Whether to remove namespace string from tag and attribute names
|
|
@@ -64,7 +293,7 @@ type X2jOptions = {
|
|
|
64
293
|
parseTagValue?: boolean;
|
|
65
294
|
|
|
66
295
|
/**
|
|
67
|
-
* Whether to parse
|
|
296
|
+
* Whether to parse attribute value with `strnum` package
|
|
68
297
|
*
|
|
69
298
|
* Defaults to `false`
|
|
70
299
|
*/
|
|
@@ -94,28 +323,33 @@ type X2jOptions = {
|
|
|
94
323
|
/**
|
|
95
324
|
* Control how tag value should be parsed. Called only if tag value is not empty
|
|
96
325
|
*
|
|
326
|
+
* @param tagName - The name of the tag
|
|
327
|
+
* @param tagValue - The value of the tag
|
|
328
|
+
* @param jPathOrMatcher - The jPath string (if jPath: true) or Matcher instance (if jPath: false)
|
|
329
|
+
* @param hasAttributes - Whether the tag has attributes
|
|
330
|
+
* @param isLeafNode - Whether the tag is a leaf node
|
|
97
331
|
* @returns {undefined|null} `undefined` or `null` to set original value.
|
|
98
332
|
* @returns {unknown}
|
|
99
333
|
*
|
|
100
334
|
* 1. Different value or value with different data type to set new value.
|
|
101
335
|
* 2. Same value to set parsed value if `parseTagValue: true`.
|
|
102
336
|
*
|
|
103
|
-
* Defaults to `(tagName, val,
|
|
337
|
+
* Defaults to `(tagName, val, jPathOrMatcher, hasAttributes, isLeafNode) => val`
|
|
104
338
|
*/
|
|
105
|
-
tagValueProcessor?: (tagName: string, tagValue: string,
|
|
339
|
+
tagValueProcessor?: (tagName: string, tagValue: string, jPathOrMatcher: JPathOrMatcher, hasAttributes: boolean, isLeafNode: boolean) => unknown;
|
|
106
340
|
|
|
107
341
|
/**
|
|
108
342
|
* Control how attribute value should be parsed
|
|
109
343
|
*
|
|
110
|
-
* @param attrName
|
|
111
|
-
* @param attrValue
|
|
112
|
-
* @param jPath
|
|
344
|
+
* @param attrName - The name of the attribute
|
|
345
|
+
* @param attrValue - The value of the attribute
|
|
346
|
+
* @param jPathOrMatcher - The jPath string (if jPath: true) or Matcher instance (if jPath: false)
|
|
113
347
|
* @returns {undefined|null} `undefined` or `null` to set original value
|
|
114
348
|
* @returns {unknown}
|
|
115
349
|
*
|
|
116
|
-
* Defaults to `(attrName, val,
|
|
350
|
+
* Defaults to `(attrName, val, jPathOrMatcher) => val`
|
|
117
351
|
*/
|
|
118
|
-
attributeValueProcessor?: (attrName: string, attrValue: string,
|
|
352
|
+
attributeValueProcessor?: (attrName: string, attrValue: string, jPathOrMatcher: JPathOrMatcher) => unknown;
|
|
119
353
|
|
|
120
354
|
/**
|
|
121
355
|
* Options to pass to `strnum` for parsing numbers
|
|
@@ -127,9 +361,13 @@ type X2jOptions = {
|
|
|
127
361
|
/**
|
|
128
362
|
* Nodes to stop parsing at
|
|
129
363
|
*
|
|
364
|
+
* Accepts string patterns or Expression objects from path-expression-matcher
|
|
365
|
+
*
|
|
366
|
+
* String patterns starting with "*." are automatically converted to ".." for backward compatibility
|
|
367
|
+
*
|
|
130
368
|
* Defaults to `[]`
|
|
131
369
|
*/
|
|
132
|
-
stopNodes?:
|
|
370
|
+
stopNodes?: JPathOrExpression[];
|
|
133
371
|
|
|
134
372
|
/**
|
|
135
373
|
* List of tags without closing tags
|
|
@@ -148,30 +386,41 @@ type X2jOptions = {
|
|
|
148
386
|
/**
|
|
149
387
|
* Determine whether a tag should be parsed as an array
|
|
150
388
|
*
|
|
151
|
-
* @param tagName
|
|
152
|
-
* @param jPath
|
|
153
|
-
* @param isLeafNode
|
|
154
|
-
* @param isAttribute
|
|
389
|
+
* @param tagName - The name of the tag
|
|
390
|
+
* @param jPathOrMatcher - The jPath string (if jPath: true) or Matcher instance (if jPath: false)
|
|
391
|
+
* @param isLeafNode - Whether the tag is a leaf node
|
|
392
|
+
* @param isAttribute - Whether this is an attribute
|
|
155
393
|
* @returns {boolean}
|
|
156
394
|
*
|
|
157
395
|
* Defaults to `() => false`
|
|
158
396
|
*/
|
|
159
|
-
isArray?: (tagName: string,
|
|
397
|
+
isArray?: (tagName: string, jPathOrMatcher: JPathOrMatcher, isLeafNode: boolean, isAttribute: boolean) => boolean;
|
|
160
398
|
|
|
161
399
|
/**
|
|
162
400
|
* Whether to process default and DOCTYPE entities
|
|
163
401
|
*
|
|
402
|
+
* When `true` - enables entity processing with default limits
|
|
403
|
+
*
|
|
404
|
+
* When `false` - disables all entity processing
|
|
405
|
+
*
|
|
406
|
+
* When `ProcessEntitiesOptions` - enables entity processing with custom configuration
|
|
407
|
+
*
|
|
164
408
|
* Defaults to `true`
|
|
165
409
|
*/
|
|
166
|
-
processEntities?: boolean;
|
|
410
|
+
processEntities?: boolean | ProcessEntitiesOptions;
|
|
167
411
|
|
|
168
412
|
/**
|
|
169
413
|
* Whether to process HTML entities
|
|
170
414
|
*
|
|
171
415
|
* Defaults to `false`
|
|
416
|
+
* @deprecated Use `entityDecoder` instead
|
|
172
417
|
*/
|
|
173
418
|
htmlEntities?: boolean;
|
|
174
419
|
|
|
420
|
+
/**
|
|
421
|
+
* Custom entity decoder
|
|
422
|
+
*/
|
|
423
|
+
entityDecoder?: EntityDecoderOptions;
|
|
175
424
|
/**
|
|
176
425
|
* Whether to ignore the declaration tag from output
|
|
177
426
|
*
|
|
@@ -204,18 +453,56 @@ type X2jOptions = {
|
|
|
204
453
|
* Change the tag name when a different name is returned. Skip the tag from parsed result when false is returned.
|
|
205
454
|
* Modify `attrs` object to control attributes for the given tag.
|
|
206
455
|
*
|
|
456
|
+
* @param tagName - The name of the tag
|
|
457
|
+
* @param jPathOrMatcher - The jPath string (if jPath: true) or Matcher instance (if jPath: false)
|
|
458
|
+
* @param attrs - The attributes object
|
|
207
459
|
* @returns {string} new tag name.
|
|
208
460
|
* @returns false to skip the tag
|
|
209
461
|
*
|
|
210
|
-
* Defaults to `(tagName,
|
|
462
|
+
* Defaults to `(tagName, jPathOrMatcher, attrs) => tagName`
|
|
211
463
|
*/
|
|
212
|
-
updateTag?: (tagName: string,
|
|
464
|
+
updateTag?: (tagName: string, jPathOrMatcher: JPathOrMatcher, attrs: { [k: string]: string }) => string | boolean;
|
|
213
465
|
|
|
214
466
|
/**
|
|
215
467
|
* If true, adds a Symbol to all object nodes, accessible by {@link XMLParser.getMetaDataSymbol} with
|
|
216
468
|
* metadata about each the node in the XML file.
|
|
217
469
|
*/
|
|
218
470
|
captureMetaData?: boolean;
|
|
471
|
+
|
|
472
|
+
/**
|
|
473
|
+
* Maximum number of nested tags
|
|
474
|
+
*
|
|
475
|
+
* Defaults to `100`
|
|
476
|
+
*/
|
|
477
|
+
maxNestedTags?: number;
|
|
478
|
+
|
|
479
|
+
/**
|
|
480
|
+
* Whether to strictly validate tag names
|
|
481
|
+
*
|
|
482
|
+
* Defaults to `true`
|
|
483
|
+
*/
|
|
484
|
+
strictReservedNames?: boolean;
|
|
485
|
+
|
|
486
|
+
/**
|
|
487
|
+
* Controls whether callbacks receive jPath as string or Matcher instance
|
|
488
|
+
*
|
|
489
|
+
* When `true` - callbacks receive jPath as string (backward compatible)
|
|
490
|
+
*
|
|
491
|
+
* When `false` - callbacks receive Matcher instance for advanced pattern matching
|
|
492
|
+
*
|
|
493
|
+
* Defaults to `true`
|
|
494
|
+
*/
|
|
495
|
+
jPath?: boolean;
|
|
496
|
+
|
|
497
|
+
/**
|
|
498
|
+
* Function to sanitize dangerous property names
|
|
499
|
+
*
|
|
500
|
+
* @param name - The name of the property
|
|
501
|
+
* @returns {string} The sanitized name
|
|
502
|
+
*
|
|
503
|
+
* Defaults to `(name) => __name`
|
|
504
|
+
*/
|
|
505
|
+
onDangerousProperty?: (name: string) => string;
|
|
219
506
|
};
|
|
220
507
|
|
|
221
508
|
type strnumOptions = {
|
|
@@ -232,7 +519,7 @@ type validationOptions = {
|
|
|
232
519
|
* Defaults to `false`
|
|
233
520
|
*/
|
|
234
521
|
allowBooleanAttributes?: boolean;
|
|
235
|
-
|
|
522
|
+
|
|
236
523
|
/**
|
|
237
524
|
* List of tags without closing tags
|
|
238
525
|
*
|
|
@@ -246,7 +533,7 @@ type XmlBuilderOptions = {
|
|
|
246
533
|
* Give a prefix to the attribute name in the resulting JS object
|
|
247
534
|
*
|
|
248
535
|
* Defaults to '@_'
|
|
249
|
-
*/
|
|
536
|
+
*/
|
|
250
537
|
attributeNamePrefix?: string;
|
|
251
538
|
|
|
252
539
|
/**
|
|
@@ -352,9 +639,11 @@ type XmlBuilderOptions = {
|
|
|
352
639
|
/**
|
|
353
640
|
* Nodes to stop parsing at
|
|
354
641
|
*
|
|
642
|
+
* Accepts string patterns or Expression objects from path-expression-matcher
|
|
643
|
+
*
|
|
355
644
|
* Defaults to `[]`
|
|
356
645
|
*/
|
|
357
|
-
stopNodes?:
|
|
646
|
+
stopNodes?: JPathOrExpression[];
|
|
358
647
|
|
|
359
648
|
/**
|
|
360
649
|
* Control how tag value should be parsed. Called only if tag value is not empty
|
|
@@ -391,26 +680,34 @@ type XmlBuilderOptions = {
|
|
|
391
680
|
|
|
392
681
|
|
|
393
682
|
oneListGroup?: boolean;
|
|
683
|
+
|
|
684
|
+
/**
|
|
685
|
+
* Maximum number of nested tags
|
|
686
|
+
*
|
|
687
|
+
* Defaults to `100`
|
|
688
|
+
*/
|
|
689
|
+
maxNestedTags?: number;
|
|
394
690
|
};
|
|
395
691
|
|
|
396
|
-
type ESchema = string | object | Array<string|object>;
|
|
692
|
+
type ESchema = string | object | Array<string | object>;
|
|
397
693
|
|
|
398
694
|
type ValidationError = {
|
|
399
|
-
err: {
|
|
695
|
+
err: {
|
|
400
696
|
code: string;
|
|
401
697
|
msg: string,
|
|
402
698
|
line: number,
|
|
403
|
-
col: number
|
|
699
|
+
col: number
|
|
404
700
|
};
|
|
405
701
|
};
|
|
406
702
|
|
|
407
703
|
declare class XMLParser {
|
|
408
704
|
constructor(options?: X2jOptions);
|
|
409
|
-
parse(xmlData: string |
|
|
705
|
+
parse(xmlData: string | Uint8Array, validationOptions?: validationOptions | boolean): any;
|
|
410
706
|
/**
|
|
411
707
|
* Add Entity which is not by default supported by this library
|
|
412
708
|
* @param entityIdentifier {string} Eg: 'ent' for &ent;
|
|
413
709
|
* @param entityValue {string} Eg: '\r'
|
|
710
|
+
* @deprecated Use `entityDecoder` instead
|
|
414
711
|
*/
|
|
415
712
|
addEntity(entityIdentifier: string, entityValue: string): void;
|
|
416
713
|
|
|
@@ -424,13 +721,15 @@ declare class XMLParser {
|
|
|
424
721
|
* The XMLMetaData property is only present when {@link X2jOptions.captureMetaData}
|
|
425
722
|
* is true in the options.
|
|
426
723
|
*/
|
|
427
|
-
static getMetaDataSymbol()
|
|
724
|
+
static getMetaDataSymbol(): Symbol;
|
|
428
725
|
}
|
|
429
726
|
|
|
430
|
-
declare class XMLValidator{
|
|
727
|
+
declare class XMLValidator {
|
|
431
728
|
static validate(xmlData: string, options?: validationOptions): true | ValidationError;
|
|
432
729
|
}
|
|
433
|
-
|
|
730
|
+
/**
|
|
731
|
+
* @deprecated Use npm package 'fast-xml-builder' instead
|
|
732
|
+
*/
|
|
434
733
|
declare class XMLBuilder {
|
|
435
734
|
constructor(options?: XmlBuilderOptions);
|
|
436
735
|
build(jObj: any): string;
|
|
@@ -451,8 +750,21 @@ declare namespace fxp {
|
|
|
451
750
|
XMLParser,
|
|
452
751
|
XMLValidator,
|
|
453
752
|
XMLBuilder,
|
|
454
|
-
XMLMetaData
|
|
753
|
+
XMLMetaData,
|
|
754
|
+
XmlBuilderOptions,
|
|
755
|
+
X2jOptions,
|
|
756
|
+
ESchema,
|
|
757
|
+
ValidationError,
|
|
758
|
+
strnumOptions,
|
|
759
|
+
validationOptions,
|
|
760
|
+
ProcessEntitiesOptions,
|
|
761
|
+
Expression,
|
|
762
|
+
ReadonlyMatcher,
|
|
763
|
+
MatcherView,
|
|
764
|
+
JPathOrMatcher,
|
|
765
|
+
JPathOrExpression,
|
|
766
|
+
EntityDecoderOptions
|
|
455
767
|
}
|
|
456
768
|
}
|
|
457
769
|
|
|
458
|
-
export = fxp;
|
|
770
|
+
export = fxp;
|