@btc-embedded/cdk-extensions 0.23.4 → 0.23.6
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 +5 -5
- package/CHANGELOG.md +21 -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 +2 -0
- package/lib/platform/ApplicationLoadBalancerV2.js +17 -3
- package/lib/platform/AuroraPostgresDB.js +2 -2
- 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
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "fast-xml-builder",
|
|
3
|
+
"version": "1.2.0",
|
|
4
|
+
"description": "Build XML from JSON without C/C++ based libraries",
|
|
5
|
+
"main": "./lib/fxb.cjs",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"sideEffects": false,
|
|
8
|
+
"module": "./src/fxb.js",
|
|
9
|
+
"types": "./src/fxb.d.ts",
|
|
10
|
+
"exports": {
|
|
11
|
+
".": {
|
|
12
|
+
"import": {
|
|
13
|
+
"types": "./src/fxb.d.ts",
|
|
14
|
+
"default": "./src/fxb.js"
|
|
15
|
+
},
|
|
16
|
+
"require": {
|
|
17
|
+
"types": "./lib/fxb.d.cts",
|
|
18
|
+
"default": "./lib/fxb.cjs"
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
"scripts": {
|
|
23
|
+
"test": "c8 --reporter=lcov --reporter=text jasmine spec/*spec.js",
|
|
24
|
+
"test-types": "tsc --noEmit spec/typings/typings-test.ts",
|
|
25
|
+
"unit": "jasmine",
|
|
26
|
+
"lint": "eslint src/**/*.js spec/**/*.js benchmark/**/*.js",
|
|
27
|
+
"bundle": "webpack --config webpack.cjs.config.js",
|
|
28
|
+
"prettier": "prettier --write src/**/*.js",
|
|
29
|
+
"checkReadiness": "publish-please --dry-run",
|
|
30
|
+
"publish-please": "publish-please",
|
|
31
|
+
"prepublishOnly": "publish-please guard"
|
|
32
|
+
},
|
|
33
|
+
"files": [
|
|
34
|
+
"lib",
|
|
35
|
+
"src",
|
|
36
|
+
"CHANGELOG.md"
|
|
37
|
+
],
|
|
38
|
+
"repository": {
|
|
39
|
+
"type": "git",
|
|
40
|
+
"url": "git+https://github.com/NaturalIntelligence/fast-xml-builder.git"
|
|
41
|
+
},
|
|
42
|
+
"keywords": [
|
|
43
|
+
"xml",
|
|
44
|
+
"json",
|
|
45
|
+
"fast",
|
|
46
|
+
"builder",
|
|
47
|
+
"parser",
|
|
48
|
+
"js2xml",
|
|
49
|
+
"json2xml"
|
|
50
|
+
],
|
|
51
|
+
"author": "Amit Gupta (https://solothought.com)",
|
|
52
|
+
"license": "MIT",
|
|
53
|
+
"devDependencies": {
|
|
54
|
+
"@babel/core": "^7.13.10",
|
|
55
|
+
"@babel/plugin-transform-runtime": "^7.13.10",
|
|
56
|
+
"@babel/preset-env": "^7.13.10",
|
|
57
|
+
"@babel/register": "^7.13.8",
|
|
58
|
+
"@types/node": "20",
|
|
59
|
+
"babel-loader": "^8.2.2",
|
|
60
|
+
"c8": "^10.1.3",
|
|
61
|
+
"eslint": "^8.3.0",
|
|
62
|
+
"fast-xml-parser": "^5.3.9",
|
|
63
|
+
"he": "^1.2.0",
|
|
64
|
+
"jasmine": "^5.6.0",
|
|
65
|
+
"prettier": "^3.5.1",
|
|
66
|
+
"publish-please": "^5.5.2",
|
|
67
|
+
"typescript": "5",
|
|
68
|
+
"webpack": "^5.64.4",
|
|
69
|
+
"webpack-cli": "^4.9.1"
|
|
70
|
+
},
|
|
71
|
+
"funding": [
|
|
72
|
+
{
|
|
73
|
+
"type": "github",
|
|
74
|
+
"url": "https://github.com/sponsors/NaturalIntelligence"
|
|
75
|
+
}
|
|
76
|
+
],
|
|
77
|
+
"dependencies": {
|
|
78
|
+
"path-expression-matcher": "^1.5.0",
|
|
79
|
+
"xml-naming": "^0.1.0"
|
|
80
|
+
}
|
|
81
|
+
}
|
|
@@ -0,0 +1,270 @@
|
|
|
1
|
+
// import { Expression, Matcher } from 'path-expression-matcher';
|
|
2
|
+
|
|
3
|
+
//type Matcher = unknown;
|
|
4
|
+
type Expression = unknown;
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* A lightweight, live read-only view of a Matcher instance.
|
|
8
|
+
*
|
|
9
|
+
* Returned by `Matcher.readOnly()`. The same instance is reused across every
|
|
10
|
+
* callback invocation — no allocation overhead per call. Reads directly from
|
|
11
|
+
* the parent Matcher's internal state so it always reflects the current parser
|
|
12
|
+
* position with no copying or freezing.
|
|
13
|
+
*/
|
|
14
|
+
export class MatcherView {
|
|
15
|
+
readonly separator: string;
|
|
16
|
+
|
|
17
|
+
/** Check if current path matches an Expression. */
|
|
18
|
+
matches(expression: Expression): boolean;
|
|
19
|
+
|
|
20
|
+
/** Get current tag name, or `undefined` if path is empty. */
|
|
21
|
+
getCurrentTag(): string | undefined;
|
|
22
|
+
|
|
23
|
+
/** Get current namespace, or `undefined` if not present. */
|
|
24
|
+
getCurrentNamespace(): string | undefined;
|
|
25
|
+
|
|
26
|
+
/** Get attribute value of the current node. */
|
|
27
|
+
getAttrValue(attrName: string): any;
|
|
28
|
+
|
|
29
|
+
/** Check if the current node has a given attribute. */
|
|
30
|
+
hasAttr(attrName: string): boolean;
|
|
31
|
+
|
|
32
|
+
/** Sibling position of the current node (child index in parent). */
|
|
33
|
+
getPosition(): number;
|
|
34
|
+
|
|
35
|
+
/** Occurrence counter of the current tag name at this level. */
|
|
36
|
+
getCounter(): number;
|
|
37
|
+
|
|
38
|
+
/** Number of nodes in the current path. */
|
|
39
|
+
getDepth(): number;
|
|
40
|
+
|
|
41
|
+
/** Current path as a string (e.g. `"root.users.user"`). */
|
|
42
|
+
toString(separator?: string, includeNamespace?: boolean): string;
|
|
43
|
+
|
|
44
|
+
/** Current path as an array of tag names. */
|
|
45
|
+
toArray(): string[];
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export type XmlBuilderOptions = {
|
|
49
|
+
/**
|
|
50
|
+
* Give a prefix to the attribute name in the resulting JS object
|
|
51
|
+
*
|
|
52
|
+
* Defaults to '@_'
|
|
53
|
+
*/
|
|
54
|
+
attributeNamePrefix?: string;
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* A name to group all attributes of a tag under, or `false` to disable
|
|
58
|
+
*
|
|
59
|
+
* Defaults to `false`
|
|
60
|
+
*/
|
|
61
|
+
attributesGroupName?: false | string;
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* The name of the next node in the resulting JS
|
|
65
|
+
*
|
|
66
|
+
* Defaults to `#text`
|
|
67
|
+
*/
|
|
68
|
+
textNodeName?: string;
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Whether to ignore attributes when building
|
|
72
|
+
*
|
|
73
|
+
* When `true` - ignores all the attributes
|
|
74
|
+
*
|
|
75
|
+
* When `false` - builds all the attributes
|
|
76
|
+
*
|
|
77
|
+
* When `Array<string | RegExp>` - filters out attributes that match provided patterns
|
|
78
|
+
*
|
|
79
|
+
* When `Function` - calls the function for each attribute and filters out those for which the function returned `true`
|
|
80
|
+
*
|
|
81
|
+
* Defaults to `true`
|
|
82
|
+
*/
|
|
83
|
+
ignoreAttributes?: boolean | (string | RegExp)[] | ((attrName: string, jPath: string) => boolean);
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Give a property name to set CDATA values to instead of merging to tag's text value
|
|
87
|
+
*
|
|
88
|
+
* Defaults to `false`
|
|
89
|
+
*/
|
|
90
|
+
cdataPropName?: false | string;
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* If set, parse comments and set as this property
|
|
94
|
+
*
|
|
95
|
+
* Defaults to `false`
|
|
96
|
+
*/
|
|
97
|
+
commentPropName?: false | string;
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Whether to make output pretty instead of single line
|
|
101
|
+
*
|
|
102
|
+
* Defaults to `false`
|
|
103
|
+
*/
|
|
104
|
+
format?: boolean;
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* If `format` is set to `true`, sets the indent string
|
|
109
|
+
*
|
|
110
|
+
* Defaults to ` `
|
|
111
|
+
*/
|
|
112
|
+
indentBy?: string;
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* Give a name to a top-level array
|
|
116
|
+
*
|
|
117
|
+
* Defaults to `undefined`
|
|
118
|
+
*/
|
|
119
|
+
arrayNodeName?: string;
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* Create empty tags for tags with no text value
|
|
123
|
+
*
|
|
124
|
+
* Defaults to `false`
|
|
125
|
+
*/
|
|
126
|
+
suppressEmptyNode?: boolean;
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* Suppress an unpaired tag
|
|
130
|
+
*
|
|
131
|
+
* Defaults to `true`
|
|
132
|
+
*/
|
|
133
|
+
suppressUnpairedNode?: boolean;
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* Don't put a value for boolean attributes
|
|
137
|
+
*
|
|
138
|
+
* Defaults to `true`
|
|
139
|
+
*/
|
|
140
|
+
suppressBooleanAttributes?: boolean;
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* Preserve the order of tags in resulting JS object
|
|
144
|
+
*
|
|
145
|
+
* Defaults to `false`
|
|
146
|
+
*/
|
|
147
|
+
preserveOrder?: boolean;
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* List of tags without closing tags
|
|
151
|
+
*
|
|
152
|
+
* Defaults to `[]`
|
|
153
|
+
*/
|
|
154
|
+
unpairedTags?: string[];
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* Nodes to stop parsing at
|
|
158
|
+
*
|
|
159
|
+
* Accepts string patterns or Expression objects from path-expression-matcher
|
|
160
|
+
*
|
|
161
|
+
* String patterns starting with "*." are automatically converted to ".." for backward compatibility
|
|
162
|
+
*
|
|
163
|
+
* Defaults to `[]`
|
|
164
|
+
*/
|
|
165
|
+
stopNodes?: (string | Expression)[];
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* Control how tag value should be parsed. Called only if tag value is not empty
|
|
169
|
+
*
|
|
170
|
+
* @returns {undefined|null} `undefined` or `null` to set original value.
|
|
171
|
+
* @returns {unknown}
|
|
172
|
+
*
|
|
173
|
+
* 1. Different value or value with different data type to set new value.
|
|
174
|
+
* 2. Same value to set parsed value if `parseTagValue: true`.
|
|
175
|
+
*
|
|
176
|
+
* Defaults to `(tagName, val, jPath, hasAttributes, isLeafNode) => val`
|
|
177
|
+
*/
|
|
178
|
+
tagValueProcessor?: (name: string, value: unknown) => unknown;
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* Control how attribute value should be parsed
|
|
182
|
+
*
|
|
183
|
+
* @param attrName
|
|
184
|
+
* @param attrValue
|
|
185
|
+
* @param jPath
|
|
186
|
+
* @returns {undefined|null} `undefined` or `null` to set original value
|
|
187
|
+
* @returns {unknown}
|
|
188
|
+
*
|
|
189
|
+
* Defaults to `(attrName, val, jPath) => val`
|
|
190
|
+
*/
|
|
191
|
+
attributeValueProcessor?: (name: string, value: unknown) => unknown;
|
|
192
|
+
|
|
193
|
+
/**
|
|
194
|
+
* Whether to process default and DOCTYPE entities
|
|
195
|
+
*
|
|
196
|
+
* Defaults to `true`
|
|
197
|
+
*/
|
|
198
|
+
processEntities?: boolean;
|
|
199
|
+
|
|
200
|
+
|
|
201
|
+
oneListGroup?: boolean;
|
|
202
|
+
|
|
203
|
+
/**
|
|
204
|
+
* Maximum number of nested tags
|
|
205
|
+
*
|
|
206
|
+
* Defaults to `100`
|
|
207
|
+
*/
|
|
208
|
+
maxNestedTags?: number;
|
|
209
|
+
|
|
210
|
+
/**
|
|
211
|
+
* Validate or sanitize tag and attribute names before they are written to XML output.
|
|
212
|
+
*
|
|
213
|
+
* The context object provides:
|
|
214
|
+
* - `isAttribute` — `true` when the name being resolved is an attribute name,
|
|
215
|
+
* `false` when it is a tag name.
|
|
216
|
+
* - `matcher` — the current path matcher (readonly). Can be used to inspect the
|
|
217
|
+
* current element path, e.g. via `.toString()` or `.getDepth()`.
|
|
218
|
+
*
|
|
219
|
+
* Return the (possibly transformed) name to use in the output.
|
|
220
|
+
* Throw an error inside the function to reject an invalid name entirely.
|
|
221
|
+
*
|
|
222
|
+
* When set to `false` (default) all names are written as-is, preserving
|
|
223
|
+
* backward-compatible behaviour.
|
|
224
|
+
*
|
|
225
|
+
* @example
|
|
226
|
+
* // Auto-fix invalid names using xml-naming
|
|
227
|
+
* import { sanitize } from 'xml-naming';
|
|
228
|
+
* { sanitizeName: (name) => sanitize(name, 'qName') }
|
|
229
|
+
*
|
|
230
|
+
* @example
|
|
231
|
+
* // Reject invalid names
|
|
232
|
+
* import { qName } from 'xml-naming';
|
|
233
|
+
* { sanitizeName: (name) => { if (!qName(name)) throw new Error(`Invalid XML name: "${name}"`); return name; } }
|
|
234
|
+
*
|
|
235
|
+
* Defaults to `false`
|
|
236
|
+
*/
|
|
237
|
+
sanitizeName?: false | ((name: string, context: SanitizeNameContext) => string);
|
|
238
|
+
};
|
|
239
|
+
|
|
240
|
+
/**
|
|
241
|
+
* Context object passed as the second argument to {@link XmlBuilderOptions.sanitizeName}.
|
|
242
|
+
*/
|
|
243
|
+
export type SanitizeNameContext = {
|
|
244
|
+
/**
|
|
245
|
+
* `true` when the name being resolved is an XML attribute name;
|
|
246
|
+
* `false` when it is an XML element (tag) name.
|
|
247
|
+
*/
|
|
248
|
+
isAttribute: boolean;
|
|
249
|
+
|
|
250
|
+
/**
|
|
251
|
+
* The current path matcher at the point where the name is being resolved.
|
|
252
|
+
* Readonly from the callback's perspective — do not call mutating methods.
|
|
253
|
+
* Use `.toString()` to get the current jPath string, `.getDepth()` for nesting depth.
|
|
254
|
+
*/
|
|
255
|
+
matcher: MatcherView;
|
|
256
|
+
};
|
|
257
|
+
|
|
258
|
+
export interface XMLBuilder {
|
|
259
|
+
build(jObj: any): string;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
export interface XMLBuilderConstructor {
|
|
263
|
+
new(options?: XmlBuilderOptions): XMLBuilder;
|
|
264
|
+
(options?: XmlBuilderOptions): XMLBuilder;
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
declare const Builder: XMLBuilderConstructor;
|
|
268
|
+
|
|
269
|
+
export { Builder };
|
|
270
|
+
export default Builder;
|