@jjrawlins/cdk-diff-pr-github-action 1.9.14 → 1.9.16
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/cdkdiffprgithubaction/jsii/jsii.go +2 -2
- package/cdkdiffprgithubaction/version +1 -1
- package/lib/CdkDiffIamTemplate.js +2 -2
- package/lib/CdkDiffIamTemplateStackSet.js +2 -2
- package/lib/CdkDiffStackWorkflow.js +1 -1
- package/lib/CdkDriftDetectionWorkflow.js +1 -1
- package/lib/CdkDriftIamTemplate.js +2 -2
- package/node_modules/@aws-sdk/client-cloudformation/package.json +12 -12
- package/node_modules/@aws-sdk/core/package.json +3 -3
- package/node_modules/@aws-sdk/credential-provider-env/package.json +2 -2
- package/node_modules/@aws-sdk/credential-provider-http/package.json +3 -3
- package/node_modules/@aws-sdk/credential-provider-ini/package.json +9 -9
- package/node_modules/@aws-sdk/credential-provider-login/package.json +3 -3
- package/node_modules/@aws-sdk/credential-provider-node/package.json +7 -7
- package/node_modules/@aws-sdk/credential-provider-process/package.json +2 -2
- package/node_modules/@aws-sdk/credential-provider-sso/package.json +4 -4
- package/node_modules/@aws-sdk/credential-provider-web-identity/package.json +3 -3
- package/node_modules/@aws-sdk/middleware-user-agent/package.json +2 -2
- package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/cognito-identity/CognitoIdentity.js +1 -1
- package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/cognito-identity/CognitoIdentity.d.ts +2 -2
- package/node_modules/@aws-sdk/nested-clients/package.json +11 -11
- package/node_modules/@aws-sdk/region-config-resolver/package.json +2 -2
- package/node_modules/@aws-sdk/token-providers/package.json +3 -3
- package/node_modules/@aws-sdk/util-user-agent-node/package.json +2 -2
- package/node_modules/@aws-sdk/xml-builder/dist-cjs/index.js +21 -11
- package/node_modules/@aws-sdk/xml-builder/dist-cjs/xml-parser.js +5 -1
- package/node_modules/@aws-sdk/xml-builder/dist-es/escape-attribute.js +8 -1
- package/node_modules/@aws-sdk/xml-builder/dist-es/escape-element.js +13 -10
- package/node_modules/@aws-sdk/xml-builder/dist-es/xml-parser.js +5 -1
- package/node_modules/@aws-sdk/xml-builder/package.json +2 -2
- package/node_modules/@smithy/config-resolver/dist-cjs/index.js +12 -0
- package/node_modules/@smithy/config-resolver/dist-es/endpointsConfig/NodeUseDualstackEndpointConfigOptions.js +5 -0
- package/node_modules/@smithy/config-resolver/dist-es/endpointsConfig/NodeUseFipsEndpointConfigOptions.js +5 -0
- package/node_modules/@smithy/config-resolver/dist-types/endpointsConfig/NodeUseDualstackEndpointConfigOptions.d.ts +6 -0
- package/node_modules/@smithy/config-resolver/dist-types/endpointsConfig/NodeUseFipsEndpointConfigOptions.d.ts +6 -0
- package/node_modules/@smithy/config-resolver/dist-types/ts3.4/endpointsConfig/NodeUseDualstackEndpointConfigOptions.d.ts +6 -0
- package/node_modules/@smithy/config-resolver/dist-types/ts3.4/endpointsConfig/NodeUseFipsEndpointConfigOptions.d.ts +6 -0
- package/node_modules/@smithy/config-resolver/package.json +1 -1
- package/node_modules/@smithy/middleware-endpoint/dist-types/resolveEndpointConfig.d.ts +2 -2
- package/node_modules/@smithy/middleware-endpoint/dist-types/ts3.4/resolveEndpointConfig.d.ts +2 -2
- package/node_modules/@smithy/middleware-endpoint/package.json +1 -1
- package/node_modules/@smithy/middleware-retry/package.json +2 -2
- package/node_modules/@smithy/smithy-client/package.json +2 -2
- package/node_modules/@smithy/util-defaults-mode-browser/package.json +2 -2
- package/node_modules/@smithy/util-defaults-mode-node/package.json +3 -3
- package/node_modules/fast-xml-parser/CHANGELOG.md +7 -0
- 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 +20 -12
- 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/pem.d.cts +148 -0
- package/node_modules/fast-xml-parser/package.json +3 -3
- package/node_modules/fast-xml-parser/src/fxp.d.ts +13 -11
- package/node_modules/fast-xml-parser/src/pem.d.ts +135 -0
- package/node_modules/fast-xml-parser/src/xmlparser/DocTypeReader.js +26 -17
- package/node_modules/fast-xml-parser/src/xmlparser/OptionsBuilder.js +6 -6
- package/node_modules/fast-xml-parser/src/xmlparser/OrderedObjParser.js +22 -16
- package/node_modules/fast-xml-parser/src/xmlparser/XMLParser.js +2 -2
- package/node_modules/fast-xml-parser/src/xmlparser/node2json.js +10 -11
- package/node_modules/path-expression-matcher/README.md +98 -13
- package/node_modules/path-expression-matcher/lib/pem.cjs +1 -1
- package/node_modules/path-expression-matcher/lib/pem.d.cts +188 -0
- package/node_modules/path-expression-matcher/lib/pem.min.js +1 -1
- package/node_modules/path-expression-matcher/lib/pem.min.js.map +1 -1
- package/node_modules/path-expression-matcher/package.json +2 -2
- package/node_modules/path-expression-matcher/src/Matcher.js +84 -0
- package/node_modules/path-expression-matcher/src/index.d.ts +152 -0
- package/node_modules/strnum/CHANGELOG.md +5 -2
- package/node_modules/strnum/package.json +1 -1
- package/node_modules/strnum/strnum.js +9 -4
- package/node_modules/strnum/tests/strnum_test.js +2 -0
- package/node_modules/strnum/tests/temp.js +8 -0
- package/package.json +2 -2
|
@@ -0,0 +1,148 @@
|
|
|
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
|
+
// ReadonlyMatcher
|
|
70
|
+
// ---------------------------------------------------------------------------
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* A live read-only view of a Matcher instance, returned by Matcher.readOnly().
|
|
74
|
+
*
|
|
75
|
+
* All query and inspection methods work normally and always reflect the current
|
|
76
|
+
* state of the underlying matcher. State-mutating methods (`push`, `pop`,
|
|
77
|
+
* `reset`, `updateCurrent`, `restore`) are not present — calling them on the
|
|
78
|
+
* underlying Proxy throws a `TypeError` at runtime.
|
|
79
|
+
*
|
|
80
|
+
* This is the type received by all FXP user callbacks when `jPath: false`.
|
|
81
|
+
*/
|
|
82
|
+
interface ReadonlyMatcher {
|
|
83
|
+
readonly separator: string;
|
|
84
|
+
|
|
85
|
+
/** Check if current path matches an Expression. */
|
|
86
|
+
matches(expression: Expression): boolean;
|
|
87
|
+
|
|
88
|
+
/** Get current tag name, or `undefined` if path is empty. */
|
|
89
|
+
getCurrentTag(): string | undefined;
|
|
90
|
+
|
|
91
|
+
/** Get current namespace, or `undefined` if not present. */
|
|
92
|
+
getCurrentNamespace(): string | undefined;
|
|
93
|
+
|
|
94
|
+
/** Get attribute value of the current node. */
|
|
95
|
+
getAttrValue(attrName: string): any;
|
|
96
|
+
|
|
97
|
+
/** Check if the current node has a given attribute. */
|
|
98
|
+
hasAttr(attrName: string): boolean;
|
|
99
|
+
|
|
100
|
+
/** Sibling position of the current node (child index in parent). */
|
|
101
|
+
getPosition(): number;
|
|
102
|
+
|
|
103
|
+
/** Occurrence counter of the current tag name at this level. */
|
|
104
|
+
getCounter(): number;
|
|
105
|
+
|
|
106
|
+
/** Number of nodes in the current path. */
|
|
107
|
+
getDepth(): number;
|
|
108
|
+
|
|
109
|
+
/** Current path as a string (e.g. `"root.users.user"`). */
|
|
110
|
+
toString(separator?: string, includeNamespace?: boolean): string;
|
|
111
|
+
|
|
112
|
+
/** Current path as an array of tag names. */
|
|
113
|
+
toArray(): string[];
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* Create a snapshot of the current state.
|
|
117
|
+
* The snapshot can be passed to the real Matcher.restore() if needed.
|
|
118
|
+
*/
|
|
119
|
+
snapshot(): MatcherSnapshot;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/** Internal node structure — exposed via snapshot only. */
|
|
123
|
+
interface PathNode {
|
|
124
|
+
tag: string;
|
|
125
|
+
namespace?: string;
|
|
126
|
+
position: number;
|
|
127
|
+
counter: number;
|
|
128
|
+
values?: Record<string, any>;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
/** Snapshot of matcher state returned by `snapshot()` and `readOnly().snapshot()`. */
|
|
132
|
+
interface MatcherSnapshot {
|
|
133
|
+
path: PathNode[];
|
|
134
|
+
siblingStacks: Map<string, number>[];
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
declare namespace pem {
|
|
138
|
+
export {
|
|
139
|
+
Expression,
|
|
140
|
+
ExpressionOptions,
|
|
141
|
+
Segment,
|
|
142
|
+
ReadonlyMatcher,
|
|
143
|
+
PathNode,
|
|
144
|
+
MatcherSnapshot,
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
export = pem;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fast-xml-parser",
|
|
3
|
-
"version": "5.5.
|
|
3
|
+
"version": "5.5.8",
|
|
4
4
|
"description": "Validate XML, Parse XML, Build XML without C/C++ based libraries",
|
|
5
5
|
"main": "./lib/fxp.cjs",
|
|
6
6
|
"type": "module",
|
|
@@ -88,7 +88,7 @@
|
|
|
88
88
|
],
|
|
89
89
|
"dependencies": {
|
|
90
90
|
"fast-xml-builder": "^1.1.4",
|
|
91
|
-
"path-expression-matcher": "^1.
|
|
92
|
-
"strnum": "^2.
|
|
91
|
+
"path-expression-matcher": "^1.2.0",
|
|
92
|
+
"strnum": "^2.2.0"
|
|
93
93
|
}
|
|
94
94
|
}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
import type { Expression, ReadonlyMatcher } from './pem';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
// jPath: true → string
|
|
4
|
+
// jPath: false → ReadonlyMatcher
|
|
5
|
+
type JPathOrMatcher = string | ReadonlyMatcher;
|
|
6
|
+
type JPathOrExpression = string | Expression;
|
|
5
7
|
|
|
6
8
|
export type ProcessEntitiesOptions = {
|
|
7
9
|
/**
|
|
@@ -63,7 +65,7 @@ export type ProcessEntitiesOptions = {
|
|
|
63
65
|
*
|
|
64
66
|
* Defaults to `null`
|
|
65
67
|
*/
|
|
66
|
-
tagFilter?: ((tagName: string, jPathOrMatcher:
|
|
68
|
+
tagFilter?: ((tagName: string, jPathOrMatcher: JPathOrMatcher) => boolean) | null;
|
|
67
69
|
};
|
|
68
70
|
|
|
69
71
|
export type X2jOptions = {
|
|
@@ -108,7 +110,7 @@ export type X2jOptions = {
|
|
|
108
110
|
*
|
|
109
111
|
* Defaults to `true`
|
|
110
112
|
*/
|
|
111
|
-
ignoreAttributes?: boolean | (string | RegExp)[] | ((attrName: string, jPathOrMatcher:
|
|
113
|
+
ignoreAttributes?: boolean | (string | RegExp)[] | ((attrName: string, jPathOrMatcher: JPathOrMatcher) => boolean);
|
|
112
114
|
|
|
113
115
|
/**
|
|
114
116
|
* Whether to remove namespace string from tag and attribute names
|
|
@@ -175,7 +177,7 @@ export type X2jOptions = {
|
|
|
175
177
|
*
|
|
176
178
|
* Defaults to `(tagName, val, jPathOrMatcher, hasAttributes, isLeafNode) => val`
|
|
177
179
|
*/
|
|
178
|
-
tagValueProcessor?: (tagName: string, tagValue: string, jPathOrMatcher:
|
|
180
|
+
tagValueProcessor?: (tagName: string, tagValue: string, jPathOrMatcher: JPathOrMatcher, hasAttributes: boolean, isLeafNode: boolean) => unknown;
|
|
179
181
|
|
|
180
182
|
/**
|
|
181
183
|
* Control how attribute value should be parsed
|
|
@@ -188,7 +190,7 @@ export type X2jOptions = {
|
|
|
188
190
|
*
|
|
189
191
|
* Defaults to `(attrName, val, jPathOrMatcher) => val`
|
|
190
192
|
*/
|
|
191
|
-
attributeValueProcessor?: (attrName: string, attrValue: string, jPathOrMatcher:
|
|
193
|
+
attributeValueProcessor?: (attrName: string, attrValue: string, jPathOrMatcher: JPathOrMatcher) => unknown;
|
|
192
194
|
|
|
193
195
|
/**
|
|
194
196
|
* Options to pass to `strnum` for parsing numbers
|
|
@@ -206,7 +208,7 @@ export type X2jOptions = {
|
|
|
206
208
|
*
|
|
207
209
|
* Defaults to `[]`
|
|
208
210
|
*/
|
|
209
|
-
stopNodes?:
|
|
211
|
+
stopNodes?: JPathOrExpression[];
|
|
210
212
|
|
|
211
213
|
/**
|
|
212
214
|
* List of tags without closing tags
|
|
@@ -233,7 +235,7 @@ export type X2jOptions = {
|
|
|
233
235
|
*
|
|
234
236
|
* Defaults to `() => false`
|
|
235
237
|
*/
|
|
236
|
-
isArray?: (tagName: string, jPathOrMatcher:
|
|
238
|
+
isArray?: (tagName: string, jPathOrMatcher: JPathOrMatcher, isLeafNode: boolean, isAttribute: boolean) => boolean;
|
|
237
239
|
|
|
238
240
|
/**
|
|
239
241
|
* Whether to process default and DOCTYPE entities
|
|
@@ -295,7 +297,7 @@ export type X2jOptions = {
|
|
|
295
297
|
*
|
|
296
298
|
* Defaults to `(tagName, jPathOrMatcher, attrs) => tagName`
|
|
297
299
|
*/
|
|
298
|
-
updateTag?: (tagName: string, jPathOrMatcher:
|
|
300
|
+
updateTag?: (tagName: string, jPathOrMatcher: JPathOrMatcher, attrs: { [k: string]: string }) => string | boolean;
|
|
299
301
|
|
|
300
302
|
/**
|
|
301
303
|
* If true, adds a Symbol to all object nodes, accessible by {@link XMLParser.getMetaDataSymbol} with
|
|
@@ -479,7 +481,7 @@ export type XmlBuilderOptions = {
|
|
|
479
481
|
*
|
|
480
482
|
* Defaults to `[]`
|
|
481
483
|
*/
|
|
482
|
-
stopNodes?:
|
|
484
|
+
stopNodes?: JPathOrExpression[];
|
|
483
485
|
|
|
484
486
|
/**
|
|
485
487
|
* Control how tag value should be parsed. Called only if tag value is not empty
|
|
@@ -0,0 +1,135 @@
|
|
|
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
|
+
// ReadonlyMatcher
|
|
70
|
+
// ---------------------------------------------------------------------------
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* A live read-only view of a {@link Matcher} instance, returned by {@link Matcher.readOnly}.
|
|
74
|
+
*
|
|
75
|
+
* All query and inspection methods work normally and always reflect the current
|
|
76
|
+
* state of the underlying matcher. State-mutating methods (`push`, `pop`,
|
|
77
|
+
* `reset`, `updateCurrent`, `restore`) are not present — calling them on the
|
|
78
|
+
* underlying Proxy throws a `TypeError` at runtime.
|
|
79
|
+
*
|
|
80
|
+
* This is the type received by all FXP user callbacks when `jPath: false`.
|
|
81
|
+
*/
|
|
82
|
+
export interface ReadonlyMatcher {
|
|
83
|
+
readonly separator: string;
|
|
84
|
+
|
|
85
|
+
/** Check if current path matches an Expression. */
|
|
86
|
+
matches(expression: Expression): boolean;
|
|
87
|
+
|
|
88
|
+
/** Get current tag name, or `undefined` if path is empty. */
|
|
89
|
+
getCurrentTag(): string | undefined;
|
|
90
|
+
|
|
91
|
+
/** Get current namespace, or `undefined` if not present. */
|
|
92
|
+
getCurrentNamespace(): string | undefined;
|
|
93
|
+
|
|
94
|
+
/** Get attribute value of the current node. */
|
|
95
|
+
getAttrValue(attrName: string): any;
|
|
96
|
+
|
|
97
|
+
/** Check if the current node has a given attribute. */
|
|
98
|
+
hasAttr(attrName: string): boolean;
|
|
99
|
+
|
|
100
|
+
/** Sibling position of the current node (child index in parent). */
|
|
101
|
+
getPosition(): number;
|
|
102
|
+
|
|
103
|
+
/** Occurrence counter of the current tag name at this level. */
|
|
104
|
+
getCounter(): number;
|
|
105
|
+
|
|
106
|
+
/** Number of nodes in the current path. */
|
|
107
|
+
getDepth(): number;
|
|
108
|
+
|
|
109
|
+
/** Current path as a string (e.g. `"root.users.user"`). */
|
|
110
|
+
toString(separator?: string, includeNamespace?: boolean): string;
|
|
111
|
+
|
|
112
|
+
/** Current path as an array of tag names. */
|
|
113
|
+
toArray(): string[];
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* Create a snapshot of the current state.
|
|
117
|
+
* The snapshot can be passed to the real {@link Matcher.restore} if needed.
|
|
118
|
+
*/
|
|
119
|
+
snapshot(): MatcherSnapshot;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/** Internal node structure — exposed via snapshot only. */
|
|
123
|
+
export interface PathNode {
|
|
124
|
+
tag: string;
|
|
125
|
+
namespace?: string;
|
|
126
|
+
position: number;
|
|
127
|
+
counter: number;
|
|
128
|
+
values?: Record<string, any>;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
/** Snapshot of matcher state returned by `snapshot()` and `readOnly().snapshot()`. */
|
|
132
|
+
export interface MatcherSnapshot {
|
|
133
|
+
path: PathNode[];
|
|
134
|
+
siblingStacks: Map<string, number>[];
|
|
135
|
+
}
|
|
@@ -28,7 +28,7 @@ export default class DocTypeReader {
|
|
|
28
28
|
[entityName, val, i] = this.readEntityExp(xmlData, i + 1, this.suppressValidationErr);
|
|
29
29
|
if (val.indexOf("&") === -1) { //Parameter entities are not supported
|
|
30
30
|
if (this.options.enabled !== false &&
|
|
31
|
-
this.options.maxEntityCount &&
|
|
31
|
+
this.options.maxEntityCount != null &&
|
|
32
32
|
entityCount >= this.options.maxEntityCount) {
|
|
33
33
|
throw new Error(
|
|
34
34
|
`Entity count (${entityCount + 1}) exceeds maximum allowed (${this.options.maxEntityCount})`
|
|
@@ -100,11 +100,12 @@ export default class DocTypeReader {
|
|
|
100
100
|
i = skipWhitespace(xmlData, i);
|
|
101
101
|
|
|
102
102
|
// Read entity name
|
|
103
|
-
|
|
103
|
+
const startIndex = i;
|
|
104
104
|
while (i < xmlData.length && !/\s/.test(xmlData[i]) && xmlData[i] !== '"' && xmlData[i] !== "'") {
|
|
105
|
-
entityName += xmlData[i];
|
|
106
105
|
i++;
|
|
107
106
|
}
|
|
107
|
+
let entityName = xmlData.substring(startIndex, i);
|
|
108
|
+
|
|
108
109
|
validateEntityName(entityName);
|
|
109
110
|
|
|
110
111
|
// Skip whitespace after entity name
|
|
@@ -125,7 +126,7 @@ export default class DocTypeReader {
|
|
|
125
126
|
|
|
126
127
|
// Validate entity size
|
|
127
128
|
if (this.options.enabled !== false &&
|
|
128
|
-
this.options.maxEntitySize &&
|
|
129
|
+
this.options.maxEntitySize != null &&
|
|
129
130
|
entityValue.length > this.options.maxEntitySize) {
|
|
130
131
|
throw new Error(
|
|
131
132
|
`Entity "${entityName}" size (${entityValue.length}) exceeds maximum allowed size (${this.options.maxEntitySize})`
|
|
@@ -141,11 +142,13 @@ export default class DocTypeReader {
|
|
|
141
142
|
i = skipWhitespace(xmlData, i);
|
|
142
143
|
|
|
143
144
|
// Read notation name
|
|
144
|
-
|
|
145
|
+
|
|
146
|
+
const startIndex = i;
|
|
145
147
|
while (i < xmlData.length && !/\s/.test(xmlData[i])) {
|
|
146
|
-
notationName += xmlData[i];
|
|
147
148
|
i++;
|
|
148
149
|
}
|
|
150
|
+
let notationName = xmlData.substring(startIndex, i);
|
|
151
|
+
|
|
149
152
|
!this.suppressValidationErr && validateEntityName(notationName);
|
|
150
153
|
|
|
151
154
|
// Skip whitespace after notation name
|
|
@@ -195,10 +198,11 @@ export default class DocTypeReader {
|
|
|
195
198
|
}
|
|
196
199
|
i++;
|
|
197
200
|
|
|
201
|
+
const startIndex = i;
|
|
198
202
|
while (i < xmlData.length && xmlData[i] !== startChar) {
|
|
199
|
-
identifierVal += xmlData[i];
|
|
200
203
|
i++;
|
|
201
204
|
}
|
|
205
|
+
identifierVal = xmlData.substring(startIndex, i);
|
|
202
206
|
|
|
203
207
|
if (xmlData[i] !== startChar) {
|
|
204
208
|
throw new Error(`Unterminated ${type} value`);
|
|
@@ -218,11 +222,11 @@ export default class DocTypeReader {
|
|
|
218
222
|
i = skipWhitespace(xmlData, i);
|
|
219
223
|
|
|
220
224
|
// Read element name
|
|
221
|
-
|
|
225
|
+
const startIndex = i;
|
|
222
226
|
while (i < xmlData.length && !/\s/.test(xmlData[i])) {
|
|
223
|
-
elementName += xmlData[i];
|
|
224
227
|
i++;
|
|
225
228
|
}
|
|
229
|
+
let elementName = xmlData.substring(startIndex, i);
|
|
226
230
|
|
|
227
231
|
// Validate element name
|
|
228
232
|
if (!this.suppressValidationErr && !isName(elementName)) {
|
|
@@ -239,10 +243,12 @@ export default class DocTypeReader {
|
|
|
239
243
|
i++; // Move past '('
|
|
240
244
|
|
|
241
245
|
// Read content model
|
|
246
|
+
const startIndex = i;
|
|
242
247
|
while (i < xmlData.length && xmlData[i] !== ")") {
|
|
243
|
-
contentModel += xmlData[i];
|
|
244
248
|
i++;
|
|
245
249
|
}
|
|
250
|
+
contentModel = xmlData.substring(startIndex, i);
|
|
251
|
+
|
|
246
252
|
if (xmlData[i] !== ")") {
|
|
247
253
|
throw new Error("Unterminated content model");
|
|
248
254
|
}
|
|
@@ -263,11 +269,11 @@ export default class DocTypeReader {
|
|
|
263
269
|
i = skipWhitespace(xmlData, i);
|
|
264
270
|
|
|
265
271
|
// Read element name
|
|
266
|
-
let
|
|
272
|
+
let startIndex = i;
|
|
267
273
|
while (i < xmlData.length && !/\s/.test(xmlData[i])) {
|
|
268
|
-
elementName += xmlData[i];
|
|
269
274
|
i++;
|
|
270
275
|
}
|
|
276
|
+
let elementName = xmlData.substring(startIndex, i);
|
|
271
277
|
|
|
272
278
|
// Validate element name
|
|
273
279
|
validateEntityName(elementName)
|
|
@@ -276,11 +282,11 @@ export default class DocTypeReader {
|
|
|
276
282
|
i = skipWhitespace(xmlData, i);
|
|
277
283
|
|
|
278
284
|
// Read attribute name
|
|
279
|
-
|
|
285
|
+
startIndex = i;
|
|
280
286
|
while (i < xmlData.length && !/\s/.test(xmlData[i])) {
|
|
281
|
-
attributeName += xmlData[i];
|
|
282
287
|
i++;
|
|
283
288
|
}
|
|
289
|
+
let attributeName = xmlData.substring(startIndex, i);
|
|
284
290
|
|
|
285
291
|
// Validate attribute name
|
|
286
292
|
if (!validateEntityName(attributeName)) {
|
|
@@ -308,11 +314,13 @@ export default class DocTypeReader {
|
|
|
308
314
|
// Read the list of allowed notations
|
|
309
315
|
let allowedNotations = [];
|
|
310
316
|
while (i < xmlData.length && xmlData[i] !== ")") {
|
|
311
|
-
|
|
317
|
+
|
|
318
|
+
|
|
319
|
+
const startIndex = i;
|
|
312
320
|
while (i < xmlData.length && xmlData[i] !== "|" && xmlData[i] !== ")") {
|
|
313
|
-
notation += xmlData[i];
|
|
314
321
|
i++;
|
|
315
322
|
}
|
|
323
|
+
let notation = xmlData.substring(startIndex, i);
|
|
316
324
|
|
|
317
325
|
// Validate notation name
|
|
318
326
|
notation = notation.trim();
|
|
@@ -338,10 +346,11 @@ export default class DocTypeReader {
|
|
|
338
346
|
attributeType += " (" + allowedNotations.join("|") + ")";
|
|
339
347
|
} else {
|
|
340
348
|
// Handle simple types (e.g., CDATA, ID, IDREF, etc.)
|
|
349
|
+
const startIndex = i;
|
|
341
350
|
while (i < xmlData.length && !/\s/.test(xmlData[i])) {
|
|
342
|
-
attributeType += xmlData[i];
|
|
343
351
|
i++;
|
|
344
352
|
}
|
|
353
|
+
attributeType += xmlData.substring(startIndex, i);
|
|
345
354
|
|
|
346
355
|
// Validate simple attribute type
|
|
347
356
|
const validTypes = ["CDATA", "ID", "IDREF", "IDREFS", "ENTITY", "ENTITIES", "NMTOKEN", "NMTOKENS"];
|
|
@@ -103,12 +103,12 @@ function normalizeProcessEntities(value) {
|
|
|
103
103
|
// Object config - merge with defaults
|
|
104
104
|
if (typeof value === 'object' && value !== null) {
|
|
105
105
|
return {
|
|
106
|
-
enabled: value.enabled !== false,
|
|
107
|
-
maxEntitySize: value.maxEntitySize ?? 10000,
|
|
108
|
-
maxExpansionDepth: value.maxExpansionDepth ?? 10,
|
|
109
|
-
maxTotalExpansions: value.maxTotalExpansions ?? 1000,
|
|
110
|
-
maxExpandedLength: value.maxExpandedLength ?? 100000,
|
|
111
|
-
maxEntityCount: value.maxEntityCount ?? 100,
|
|
106
|
+
enabled: value.enabled !== false,
|
|
107
|
+
maxEntitySize: Math.max(1, value.maxEntitySize ?? 10000),
|
|
108
|
+
maxExpansionDepth: Math.max(1, value.maxExpansionDepth ?? 10),
|
|
109
|
+
maxTotalExpansions: Math.max(1, value.maxTotalExpansions ?? 1000),
|
|
110
|
+
maxExpandedLength: Math.max(1, value.maxExpandedLength ?? 100000),
|
|
111
|
+
maxEntityCount: Math.max(1, value.maxEntityCount ?? 100),
|
|
112
112
|
allowedTags: value.allowedTags ?? null,
|
|
113
113
|
tagFilter: value.tagFilter ?? null
|
|
114
114
|
};
|