@cdk8s/awscdk-resolver 0.0.547 → 0.0.549

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 +3 -3
  2. package/lib/resolve.js +1 -1
  3. package/node_modules/@aws-sdk/client-cloudformation/dist-cjs/index.js +9 -9
  4. package/node_modules/@aws-sdk/client-cloudformation/dist-es/waiters/waitForChangeSetCreateComplete.js +2 -2
  5. package/node_modules/@aws-sdk/client-cloudformation/dist-es/waiters/waitForStackCreateComplete.js +2 -2
  6. package/node_modules/@aws-sdk/client-cloudformation/dist-es/waiters/waitForStackDeleteComplete.js +2 -2
  7. package/node_modules/@aws-sdk/client-cloudformation/dist-es/waiters/waitForStackExists.js +2 -2
  8. package/node_modules/@aws-sdk/client-cloudformation/dist-es/waiters/waitForStackImportComplete.js +2 -2
  9. package/node_modules/@aws-sdk/client-cloudformation/dist-es/waiters/waitForStackRefactorCreateComplete.js +1 -1
  10. package/node_modules/@aws-sdk/client-cloudformation/dist-es/waiters/waitForStackRefactorExecuteComplete.js +1 -1
  11. package/node_modules/@aws-sdk/client-cloudformation/dist-es/waiters/waitForStackRollbackComplete.js +2 -2
  12. package/node_modules/@aws-sdk/client-cloudformation/dist-es/waiters/waitForStackUpdateComplete.js +2 -2
  13. package/node_modules/@aws-sdk/client-cloudformation/dist-types/CloudFormation.d.ts +11 -10
  14. package/node_modules/@aws-sdk/client-cloudformation/dist-types/ts3.4/CloudFormation.d.ts +13 -10
  15. package/node_modules/@aws-sdk/client-cloudformation/dist-types/ts3.4/waiters/waitForChangeSetCreateComplete.d.ts +9 -3
  16. package/node_modules/@aws-sdk/client-cloudformation/dist-types/ts3.4/waiters/waitForStackCreateComplete.d.ts +9 -3
  17. package/node_modules/@aws-sdk/client-cloudformation/dist-types/ts3.4/waiters/waitForStackDeleteComplete.d.ts +11 -3
  18. package/node_modules/@aws-sdk/client-cloudformation/dist-types/ts3.4/waiters/waitForStackExists.d.ts +9 -3
  19. package/node_modules/@aws-sdk/client-cloudformation/dist-types/ts3.4/waiters/waitForStackImportComplete.d.ts +9 -3
  20. package/node_modules/@aws-sdk/client-cloudformation/dist-types/ts3.4/waiters/waitForStackRefactorCreateComplete.d.ts +11 -3
  21. package/node_modules/@aws-sdk/client-cloudformation/dist-types/ts3.4/waiters/waitForStackRefactorExecuteComplete.d.ts +11 -3
  22. package/node_modules/@aws-sdk/client-cloudformation/dist-types/ts3.4/waiters/waitForStackRollbackComplete.d.ts +9 -3
  23. package/node_modules/@aws-sdk/client-cloudformation/dist-types/ts3.4/waiters/waitForStackUpdateComplete.d.ts +9 -3
  24. package/node_modules/@aws-sdk/client-cloudformation/dist-types/ts3.4/waiters/waitForTypeRegistrationComplete.d.ts +11 -3
  25. package/node_modules/@aws-sdk/client-cloudformation/dist-types/waiters/waitForChangeSetCreateComplete.d.ts +4 -3
  26. package/node_modules/@aws-sdk/client-cloudformation/dist-types/waiters/waitForStackCreateComplete.d.ts +4 -3
  27. package/node_modules/@aws-sdk/client-cloudformation/dist-types/waiters/waitForStackDeleteComplete.d.ts +4 -3
  28. package/node_modules/@aws-sdk/client-cloudformation/dist-types/waiters/waitForStackExists.d.ts +4 -3
  29. package/node_modules/@aws-sdk/client-cloudformation/dist-types/waiters/waitForStackImportComplete.d.ts +4 -3
  30. package/node_modules/@aws-sdk/client-cloudformation/dist-types/waiters/waitForStackRefactorCreateComplete.d.ts +4 -3
  31. package/node_modules/@aws-sdk/client-cloudformation/dist-types/waiters/waitForStackRefactorExecuteComplete.d.ts +4 -3
  32. package/node_modules/@aws-sdk/client-cloudformation/dist-types/waiters/waitForStackRollbackComplete.d.ts +4 -3
  33. package/node_modules/@aws-sdk/client-cloudformation/dist-types/waiters/waitForStackUpdateComplete.d.ts +4 -3
  34. package/node_modules/@aws-sdk/client-cloudformation/dist-types/waiters/waitForTypeRegistrationComplete.d.ts +4 -3
  35. package/node_modules/@aws-sdk/client-cloudformation/package.json +8 -8
  36. package/node_modules/@aws-sdk/core/package.json +3 -3
  37. package/node_modules/@aws-sdk/credential-provider-env/package.json +2 -2
  38. package/node_modules/@aws-sdk/credential-provider-http/package.json +2 -2
  39. package/node_modules/@aws-sdk/credential-provider-ini/package.json +9 -9
  40. package/node_modules/@aws-sdk/credential-provider-login/package.json +3 -3
  41. package/node_modules/@aws-sdk/credential-provider-node/package.json +7 -7
  42. package/node_modules/@aws-sdk/credential-provider-process/package.json +2 -2
  43. package/node_modules/@aws-sdk/credential-provider-sso/package.json +4 -4
  44. package/node_modules/@aws-sdk/credential-provider-web-identity/package.json +3 -3
  45. package/node_modules/@aws-sdk/middleware-sdk-s3/package.json +2 -2
  46. package/node_modules/@aws-sdk/middleware-user-agent/package.json +3 -3
  47. package/node_modules/@aws-sdk/nested-clients/package.json +7 -7
  48. package/node_modules/@aws-sdk/signature-v4-multi-region/package.json +2 -2
  49. package/node_modules/@aws-sdk/token-providers/package.json +3 -3
  50. package/node_modules/@aws-sdk/util-user-agent-node/package.json +2 -2
  51. package/node_modules/@aws-sdk/xml-builder/dist-cjs/xml-external/nodable_entities.js +336 -0
  52. package/node_modules/@aws-sdk/xml-builder/dist-cjs/xml-parser.js +26 -0
  53. package/node_modules/@aws-sdk/xml-builder/dist-es/xml-external/nodable_entities.js +332 -0
  54. package/node_modules/@aws-sdk/xml-builder/dist-es/xml-parser.js +26 -0
  55. package/node_modules/@aws-sdk/xml-builder/dist-types/ts3.4/XmlNode.d.ts +49 -29
  56. package/node_modules/@aws-sdk/xml-builder/dist-types/ts3.4/XmlText.d.ts +11 -6
  57. package/node_modules/@aws-sdk/xml-builder/dist-types/ts3.4/escape-attribute.d.ts +6 -1
  58. package/node_modules/@aws-sdk/xml-builder/dist-types/ts3.4/escape-element.d.ts +6 -1
  59. package/node_modules/@aws-sdk/xml-builder/dist-types/ts3.4/index.d.ts +12 -3
  60. package/node_modules/@aws-sdk/xml-builder/dist-types/ts3.4/stringable.d.ts +6 -3
  61. package/node_modules/@aws-sdk/xml-builder/dist-types/ts3.4/xml-external/nodable_entities.d.ts +65 -0
  62. package/node_modules/@aws-sdk/xml-builder/dist-types/ts3.4/xml-parser.browser.d.ts +9 -1
  63. package/node_modules/@aws-sdk/xml-builder/dist-types/ts3.4/xml-parser.d.ts +4 -1
  64. package/node_modules/@aws-sdk/xml-builder/dist-types/xml-external/nodable_entities.d.ts +65 -0
  65. package/node_modules/@aws-sdk/xml-builder/package.json +3 -2
  66. package/node_modules/@smithy/middleware-retry/package.json +3 -3
  67. package/node_modules/@smithy/service-error-classification/dist-cjs/index.js +1 -0
  68. package/node_modules/@smithy/service-error-classification/dist-es/index.js +1 -0
  69. package/node_modules/@smithy/service-error-classification/package.json +1 -1
  70. package/node_modules/@smithy/util-retry/dist-cjs/index.js +7 -3
  71. package/node_modules/@smithy/util-retry/dist-es/AdaptiveRetryStrategy.js +5 -2
  72. package/node_modules/@smithy/util-retry/dist-es/DefaultRateLimiter.js +2 -1
  73. package/node_modules/@smithy/util-retry/package.json +2 -2
  74. package/node_modules/@smithy/util-waiter/dist-cjs/index.js +59 -34
  75. package/node_modules/@smithy/util-waiter/dist-es/poller.js +61 -34
  76. package/node_modules/@smithy/util-waiter/dist-types/createWaiter.d.ts +1 -1
  77. package/node_modules/@smithy/util-waiter/dist-types/poller.d.ts +2 -1
  78. package/node_modules/@smithy/util-waiter/dist-types/waiter.d.ts +13 -13
  79. package/node_modules/@smithy/util-waiter/package.json +1 -1
  80. package/node_modules/{@aws-sdk/xml-builder/node_modules/fast-xml-parser → fast-xml-parser}/CHANGELOG.md +8 -0
  81. package/node_modules/{@aws-sdk/xml-builder/node_modules/fast-xml-parser → fast-xml-parser}/lib/fxp.cjs +1 -1
  82. package/node_modules/{@aws-sdk/xml-builder/node_modules/fast-xml-parser → fast-xml-parser}/lib/fxp.min.js +1 -1
  83. package/node_modules/fast-xml-parser/lib/fxp.min.js.map +1 -0
  84. package/node_modules/{@aws-sdk/xml-builder/node_modules/fast-xml-parser → fast-xml-parser}/lib/fxparser.min.js +1 -1
  85. package/node_modules/fast-xml-parser/lib/fxparser.min.js.map +1 -0
  86. package/node_modules/{@aws-sdk/xml-builder/node_modules/fast-xml-parser → fast-xml-parser}/package.json +1 -1
  87. package/node_modules/{@aws-sdk/xml-builder/node_modules/fast-xml-parser → fast-xml-parser}/src/xmlparser/OrderedObjParser.js +16 -11
  88. package/node_modules/{@aws-sdk/xml-builder/node_modules/fast-xml-parser → fast-xml-parser}/src/xmlparser/XMLParser.js +2 -2
  89. package/package.json +3 -3
  90. package/node_modules/@aws-sdk/xml-builder/node_modules/fast-xml-parser/lib/fxp.min.js.map +0 -1
  91. package/node_modules/@aws-sdk/xml-builder/node_modules/fast-xml-parser/lib/fxparser.min.js.map +0 -1
  92. /package/node_modules/{@aws-sdk/xml-builder/node_modules/fast-xml-parser → fast-xml-parser}/LICENSE +0 -0
  93. /package/node_modules/{@aws-sdk/xml-builder/node_modules/fast-xml-parser → fast-xml-parser}/README.md +0 -0
  94. /package/node_modules/{@aws-sdk/xml-builder/node_modules/fast-xml-parser → fast-xml-parser}/lib/fxbuilder.min.js +0 -0
  95. /package/node_modules/{@aws-sdk/xml-builder/node_modules/fast-xml-parser → fast-xml-parser}/lib/fxbuilder.min.js.map +0 -0
  96. /package/node_modules/{@aws-sdk/xml-builder/node_modules/fast-xml-parser → fast-xml-parser}/lib/fxp.d.cts +0 -0
  97. /package/node_modules/{@aws-sdk/xml-builder/node_modules/fast-xml-parser → fast-xml-parser}/lib/fxvalidator.min.js +0 -0
  98. /package/node_modules/{@aws-sdk/xml-builder/node_modules/fast-xml-parser → fast-xml-parser}/lib/fxvalidator.min.js.map +0 -0
  99. /package/node_modules/{@aws-sdk/xml-builder/node_modules/fast-xml-parser → fast-xml-parser}/src/cli/cli.js +0 -0
  100. /package/node_modules/{@aws-sdk/xml-builder/node_modules/fast-xml-parser → fast-xml-parser}/src/cli/man.js +0 -0
  101. /package/node_modules/{@aws-sdk/xml-builder/node_modules/fast-xml-parser → fast-xml-parser}/src/cli/read.js +0 -0
  102. /package/node_modules/{@aws-sdk/xml-builder/node_modules/fast-xml-parser → fast-xml-parser}/src/fxp.d.ts +0 -0
  103. /package/node_modules/{@aws-sdk/xml-builder/node_modules/fast-xml-parser → fast-xml-parser}/src/fxp.js +0 -0
  104. /package/node_modules/{@aws-sdk/xml-builder/node_modules/fast-xml-parser → fast-xml-parser}/src/ignoreAttributes.js +0 -0
  105. /package/node_modules/{@aws-sdk/xml-builder/node_modules/fast-xml-parser → fast-xml-parser}/src/util.js +0 -0
  106. /package/node_modules/{@aws-sdk/xml-builder/node_modules/fast-xml-parser → fast-xml-parser}/src/v6/CharsSymbol.js +0 -0
  107. /package/node_modules/{@aws-sdk/xml-builder/node_modules/fast-xml-parser → fast-xml-parser}/src/v6/EntitiesParser.js +0 -0
  108. /package/node_modules/{@aws-sdk/xml-builder/node_modules/fast-xml-parser → fast-xml-parser}/src/v6/OptionsBuilder.js +0 -0
  109. /package/node_modules/{@aws-sdk/xml-builder/node_modules/fast-xml-parser → fast-xml-parser}/src/v6/OutputBuilders/BaseOutputBuilder.js +0 -0
  110. /package/node_modules/{@aws-sdk/xml-builder/node_modules/fast-xml-parser → fast-xml-parser}/src/v6/OutputBuilders/JsArrBuilder.js +0 -0
  111. /package/node_modules/{@aws-sdk/xml-builder/node_modules/fast-xml-parser → fast-xml-parser}/src/v6/OutputBuilders/JsMinArrBuilder.js +0 -0
  112. /package/node_modules/{@aws-sdk/xml-builder/node_modules/fast-xml-parser → fast-xml-parser}/src/v6/OutputBuilders/JsObjBuilder.js +0 -0
  113. /package/node_modules/{@aws-sdk/xml-builder/node_modules/fast-xml-parser → fast-xml-parser}/src/v6/OutputBuilders/ParserOptionsBuilder.js +0 -0
  114. /package/node_modules/{@aws-sdk/xml-builder/node_modules/fast-xml-parser → fast-xml-parser}/src/v6/Report.js +0 -0
  115. /package/node_modules/{@aws-sdk/xml-builder/node_modules/fast-xml-parser → fast-xml-parser}/src/v6/TagPath.js +0 -0
  116. /package/node_modules/{@aws-sdk/xml-builder/node_modules/fast-xml-parser → fast-xml-parser}/src/v6/TagPathMatcher.js +0 -0
  117. /package/node_modules/{@aws-sdk/xml-builder/node_modules/fast-xml-parser → fast-xml-parser}/src/v6/XMLParser.js +0 -0
  118. /package/node_modules/{@aws-sdk/xml-builder/node_modules/fast-xml-parser → fast-xml-parser}/src/v6/Xml2JsParser.js +0 -0
  119. /package/node_modules/{@aws-sdk/xml-builder/node_modules/fast-xml-parser → fast-xml-parser}/src/v6/XmlPartReader.js +0 -0
  120. /package/node_modules/{@aws-sdk/xml-builder/node_modules/fast-xml-parser → fast-xml-parser}/src/v6/XmlSpecialTagsReader.js +0 -0
  121. /package/node_modules/{@aws-sdk/xml-builder/node_modules/fast-xml-parser → fast-xml-parser}/src/v6/inputSource/BufferSource.js +0 -0
  122. /package/node_modules/{@aws-sdk/xml-builder/node_modules/fast-xml-parser → fast-xml-parser}/src/v6/inputSource/StringSource.js +0 -0
  123. /package/node_modules/{@aws-sdk/xml-builder/node_modules/fast-xml-parser → fast-xml-parser}/src/v6/valueParsers/EntitiesParser.js +0 -0
  124. /package/node_modules/{@aws-sdk/xml-builder/node_modules/fast-xml-parser → fast-xml-parser}/src/v6/valueParsers/booleanParser.js +0 -0
  125. /package/node_modules/{@aws-sdk/xml-builder/node_modules/fast-xml-parser → fast-xml-parser}/src/v6/valueParsers/booleanParserExt.js +0 -0
  126. /package/node_modules/{@aws-sdk/xml-builder/node_modules/fast-xml-parser → fast-xml-parser}/src/v6/valueParsers/currency.js +0 -0
  127. /package/node_modules/{@aws-sdk/xml-builder/node_modules/fast-xml-parser → fast-xml-parser}/src/v6/valueParsers/join.js +0 -0
  128. /package/node_modules/{@aws-sdk/xml-builder/node_modules/fast-xml-parser → fast-xml-parser}/src/v6/valueParsers/number.js +0 -0
  129. /package/node_modules/{@aws-sdk/xml-builder/node_modules/fast-xml-parser → fast-xml-parser}/src/v6/valueParsers/trim.js +0 -0
  130. /package/node_modules/{@aws-sdk/xml-builder/node_modules/fast-xml-parser → fast-xml-parser}/src/validator.js +0 -0
  131. /package/node_modules/{@aws-sdk/xml-builder/node_modules/fast-xml-parser → fast-xml-parser}/src/xmlbuilder/json2xml.js +0 -0
  132. /package/node_modules/{@aws-sdk/xml-builder/node_modules/fast-xml-parser → fast-xml-parser}/src/xmlparser/DocTypeReader.js +0 -0
  133. /package/node_modules/{@aws-sdk/xml-builder/node_modules/fast-xml-parser → fast-xml-parser}/src/xmlparser/OptionsBuilder.js +0 -0
  134. /package/node_modules/{@aws-sdk/xml-builder/node_modules/fast-xml-parser → fast-xml-parser}/src/xmlparser/node2json.js +0 -0
  135. /package/node_modules/{@aws-sdk/xml-builder/node_modules/fast-xml-parser → fast-xml-parser}/src/xmlparser/xmlNode.js +0 -0
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aws-sdk/util-user-agent-node",
3
- "version": "3.973.21",
3
+ "version": "3.973.22",
4
4
  "scripts": {
5
5
  "build": "concurrently 'yarn:build:types' 'yarn:build:es' && yarn build:cjs",
6
6
  "build:cjs": "node ../../scripts/compilation/inline util-user-agent-node",
@@ -24,7 +24,7 @@
24
24
  },
25
25
  "license": "Apache-2.0",
26
26
  "dependencies": {
27
- "@aws-sdk/middleware-user-agent": "^3.972.35",
27
+ "@aws-sdk/middleware-user-agent": "^3.972.36",
28
28
  "@aws-sdk/types": "^3.973.8",
29
29
  "@smithy/node-config-provider": "^4.3.14",
30
30
  "@smithy/types": "^4.14.1",
@@ -0,0 +1,336 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.EntityDecoderImpl = exports.CURRENCY = exports.COMMON_HTML = exports.XML = void 0;
4
+ exports.XML = {
5
+ amp: "&",
6
+ apos: "'",
7
+ gt: ">",
8
+ lt: "<",
9
+ quot: '"',
10
+ };
11
+ exports.COMMON_HTML = {
12
+ nbsp: "\u00a0",
13
+ copy: "\u00a9",
14
+ reg: "\u00ae",
15
+ trade: "\u2122",
16
+ mdash: "\u2014",
17
+ ndash: "\u2013",
18
+ hellip: "\u2026",
19
+ laquo: "\u00ab",
20
+ raquo: "\u00bb",
21
+ lsquo: "\u2018",
22
+ rsquo: "\u2019",
23
+ ldquo: "\u201c",
24
+ rdquo: "\u201d",
25
+ bull: "\u2022",
26
+ para: "\u00b6",
27
+ sect: "\u00a7",
28
+ deg: "\u00b0",
29
+ frac12: "\u00bd",
30
+ frac14: "\u00bc",
31
+ frac34: "\u00be",
32
+ };
33
+ exports.CURRENCY = {
34
+ cent: "\u00a2",
35
+ pound: "\u00a3",
36
+ curren: "\u00a4",
37
+ yen: "\u00a5",
38
+ euro: "\u20ac",
39
+ dollar: "$",
40
+ fnof: "\u0192",
41
+ inr: "\u20b9",
42
+ af: "\u060b",
43
+ birr: "\u1265\u122d",
44
+ peso: "\u20b1",
45
+ rub: "\u20bd",
46
+ won: "\u20a9",
47
+ yuan: "\u00a5",
48
+ cedil: "\u00b8",
49
+ };
50
+ const SPECIAL_CHARS = new Set("!?\\/[]$%{}^&*()<>|+");
51
+ function validateEntityName(name) {
52
+ if (name[0] === "#") {
53
+ throw new Error(`[EntityReplacer] Invalid character '#' in entity name: "${name}"`);
54
+ }
55
+ for (const ch of name) {
56
+ if (SPECIAL_CHARS.has(ch)) {
57
+ throw new Error(`[EntityReplacer] Invalid character '${ch}' in entity name: "${name}"`);
58
+ }
59
+ }
60
+ return name;
61
+ }
62
+ function mergeEntityMaps(...maps) {
63
+ const out = Object.create(null);
64
+ for (const map of maps) {
65
+ if (!map) {
66
+ continue;
67
+ }
68
+ for (const key of Object.keys(map)) {
69
+ const raw = map[key];
70
+ if (typeof raw === "string") {
71
+ out[key] = raw;
72
+ }
73
+ else if (raw && typeof raw === "object" && raw.val !== undefined) {
74
+ const val = raw.val;
75
+ if (typeof val === "string") {
76
+ out[key] = val;
77
+ }
78
+ }
79
+ }
80
+ }
81
+ return out;
82
+ }
83
+ const LIMIT_TIER_EXTERNAL = "external";
84
+ const LIMIT_TIER_BASE = "base";
85
+ const LIMIT_TIER_ALL = "all";
86
+ function parseLimitTiers(raw) {
87
+ if (!raw || raw === LIMIT_TIER_EXTERNAL) {
88
+ return new Set([LIMIT_TIER_EXTERNAL]);
89
+ }
90
+ if (raw === LIMIT_TIER_ALL) {
91
+ return new Set([LIMIT_TIER_ALL]);
92
+ }
93
+ if (raw === LIMIT_TIER_BASE) {
94
+ return new Set([LIMIT_TIER_BASE]);
95
+ }
96
+ if (Array.isArray(raw)) {
97
+ return new Set(raw);
98
+ }
99
+ return new Set([LIMIT_TIER_EXTERNAL]);
100
+ }
101
+ const NCR_LEVEL = Object.freeze({ allow: 0, leave: 1, remove: 2, throw: 3 });
102
+ const XML10_ALLOWED_C0 = new Set([0x09, 0x0a, 0x0d]);
103
+ function parseNCRConfig(ncr) {
104
+ if (!ncr) {
105
+ return { xmlVersion: 1.0, onLevel: NCR_LEVEL.allow, nullLevel: NCR_LEVEL.remove };
106
+ }
107
+ const xmlVersion = ncr.xmlVersion === 1.1 ? 1.1 : 1.0;
108
+ const onLevel = NCR_LEVEL[ncr.onNCR ?? "allow"] ?? NCR_LEVEL.allow;
109
+ const nullLevel = NCR_LEVEL[ncr.nullNCR ?? "remove"] ?? NCR_LEVEL.remove;
110
+ const clampedNull = Math.max(nullLevel, NCR_LEVEL.remove);
111
+ return { xmlVersion, onLevel, nullLevel: clampedNull };
112
+ }
113
+ const EntityDecoderImpl = class EntityDecoderImpl {
114
+ _limit;
115
+ _maxTotalExpansions;
116
+ _maxExpandedLength;
117
+ _postCheck;
118
+ _limitTiers;
119
+ _numericAllowed;
120
+ _baseMap;
121
+ _externalMap;
122
+ _inputMap;
123
+ _totalExpansions;
124
+ _expandedLength;
125
+ _removeSet;
126
+ _leaveSet;
127
+ _ncrXmlVersion;
128
+ _ncrOnLevel;
129
+ _ncrNullLevel;
130
+ constructor(options = {}) {
131
+ this._limit = options.limit || {};
132
+ this._maxTotalExpansions = this._limit.maxTotalExpansions || 0;
133
+ this._maxExpandedLength = this._limit.maxExpandedLength || 0;
134
+ this._postCheck = typeof options.postCheck === "function" ? options.postCheck : (r) => r;
135
+ this._limitTiers = parseLimitTiers(this._limit.applyLimitsTo ?? LIMIT_TIER_EXTERNAL);
136
+ this._numericAllowed = options.numericAllowed ?? true;
137
+ this._baseMap = mergeEntityMaps(exports.XML, options.namedEntities || null);
138
+ this._externalMap = Object.create(null);
139
+ this._inputMap = Object.create(null);
140
+ this._totalExpansions = 0;
141
+ this._expandedLength = 0;
142
+ this._removeSet = new Set(options.remove && Array.isArray(options.remove) ? options.remove : []);
143
+ this._leaveSet = new Set(options.leave && Array.isArray(options.leave) ? options.leave : []);
144
+ const ncrCfg = parseNCRConfig(options.ncr);
145
+ this._ncrXmlVersion = ncrCfg.xmlVersion;
146
+ this._ncrOnLevel = ncrCfg.onLevel;
147
+ this._ncrNullLevel = ncrCfg.nullLevel;
148
+ }
149
+ setExternalEntities(map) {
150
+ if (map) {
151
+ for (const key of Object.keys(map)) {
152
+ validateEntityName(key);
153
+ }
154
+ }
155
+ this._externalMap = mergeEntityMaps(map);
156
+ }
157
+ addExternalEntity(key, value) {
158
+ validateEntityName(key);
159
+ if (typeof value === "string" && value.indexOf("&") === -1) {
160
+ this._externalMap[key] = value;
161
+ }
162
+ }
163
+ addInputEntities(map) {
164
+ this._totalExpansions = 0;
165
+ this._expandedLength = 0;
166
+ this._inputMap = mergeEntityMaps(map);
167
+ }
168
+ reset() {
169
+ this._inputMap = Object.create(null);
170
+ this._totalExpansions = 0;
171
+ this._expandedLength = 0;
172
+ return this;
173
+ }
174
+ setXmlVersion(version) {
175
+ this._ncrXmlVersion = version === "1.1" || version === 1.1 ? 1.1 : 1.0;
176
+ }
177
+ decode(str) {
178
+ if (typeof str !== "string" || str.length === 0) {
179
+ return str;
180
+ }
181
+ const original = str;
182
+ const chunks = [];
183
+ const len = str.length;
184
+ let last = 0;
185
+ let i = 0;
186
+ const limitExpansions = this._maxTotalExpansions > 0;
187
+ const limitLength = this._maxExpandedLength > 0;
188
+ const checkLimits = limitExpansions || limitLength;
189
+ while (i < len) {
190
+ if (str.charCodeAt(i) !== 38) {
191
+ i++;
192
+ continue;
193
+ }
194
+ let j = i + 1;
195
+ while (j < len && str.charCodeAt(j) !== 59 && j - i <= 32) {
196
+ j++;
197
+ }
198
+ if (j >= len || str.charCodeAt(j) !== 59) {
199
+ i++;
200
+ continue;
201
+ }
202
+ const token = str.slice(i + 1, j);
203
+ if (token.length === 0) {
204
+ i++;
205
+ continue;
206
+ }
207
+ let replacement;
208
+ let tier;
209
+ if (this._removeSet.has(token)) {
210
+ replacement = "";
211
+ if (tier === undefined) {
212
+ tier = LIMIT_TIER_EXTERNAL;
213
+ }
214
+ }
215
+ else if (this._leaveSet.has(token)) {
216
+ i++;
217
+ continue;
218
+ }
219
+ else if (token.charCodeAt(0) === 35) {
220
+ const ncrResult = this._resolveNCR(token);
221
+ if (ncrResult === undefined) {
222
+ i++;
223
+ continue;
224
+ }
225
+ replacement = ncrResult;
226
+ tier = LIMIT_TIER_BASE;
227
+ }
228
+ else {
229
+ const resolved = this._resolveName(token);
230
+ replacement = resolved?.value;
231
+ tier = resolved?.tier;
232
+ }
233
+ if (replacement === undefined) {
234
+ i++;
235
+ continue;
236
+ }
237
+ if (i > last) {
238
+ chunks.push(str.slice(last, i));
239
+ }
240
+ chunks.push(replacement);
241
+ last = j + 1;
242
+ i = last;
243
+ if (checkLimits && this._tierCounts(tier)) {
244
+ if (limitExpansions) {
245
+ this._totalExpansions++;
246
+ if (this._totalExpansions > this._maxTotalExpansions) {
247
+ throw new Error(`[EntityReplacer] Entity expansion count limit exceeded: ` +
248
+ `${this._totalExpansions} > ${this._maxTotalExpansions}`);
249
+ }
250
+ }
251
+ if (limitLength) {
252
+ const delta = replacement.length - (token.length + 2);
253
+ if (delta > 0) {
254
+ this._expandedLength += delta;
255
+ if (this._expandedLength > this._maxExpandedLength) {
256
+ throw new Error(`[EntityReplacer] Expanded content length limit exceeded: ` +
257
+ `${this._expandedLength} > ${this._maxExpandedLength}`);
258
+ }
259
+ }
260
+ }
261
+ }
262
+ }
263
+ if (last < len) {
264
+ chunks.push(str.slice(last));
265
+ }
266
+ const result = chunks.length === 0 ? str : chunks.join("");
267
+ return this._postCheck(result, original);
268
+ }
269
+ _tierCounts(tier) {
270
+ if (this._limitTiers.has(LIMIT_TIER_ALL)) {
271
+ return true;
272
+ }
273
+ return this._limitTiers.has(tier);
274
+ }
275
+ _resolveName(name) {
276
+ if (name in this._inputMap) {
277
+ return { value: this._inputMap[name], tier: LIMIT_TIER_EXTERNAL };
278
+ }
279
+ if (name in this._externalMap) {
280
+ return { value: this._externalMap[name], tier: LIMIT_TIER_EXTERNAL };
281
+ }
282
+ if (name in this._baseMap) {
283
+ return { value: this._baseMap[name], tier: LIMIT_TIER_BASE };
284
+ }
285
+ return undefined;
286
+ }
287
+ _classifyNCR(cp) {
288
+ if (cp === 0) {
289
+ return this._ncrNullLevel;
290
+ }
291
+ if (cp >= 0xd800 && cp <= 0xdfff) {
292
+ return NCR_LEVEL.remove;
293
+ }
294
+ if (this._ncrXmlVersion === 1.0) {
295
+ if (cp >= 0x01 && cp <= 0x1f && !XML10_ALLOWED_C0.has(cp)) {
296
+ return NCR_LEVEL.remove;
297
+ }
298
+ }
299
+ return -1;
300
+ }
301
+ _applyNCRAction(action, token, cp) {
302
+ switch (action) {
303
+ case NCR_LEVEL.allow:
304
+ return String.fromCodePoint(cp);
305
+ case NCR_LEVEL.remove:
306
+ return "";
307
+ case NCR_LEVEL.leave:
308
+ return undefined;
309
+ case NCR_LEVEL.throw:
310
+ throw new Error(`[EntityDecoder] Prohibited numeric character reference ` +
311
+ `&${token}; (U+${cp.toString(16).toUpperCase().padStart(4, "0")})`);
312
+ default:
313
+ return String.fromCodePoint(cp);
314
+ }
315
+ }
316
+ _resolveNCR(token) {
317
+ const second = token.charCodeAt(1);
318
+ let cp;
319
+ if (second === 120 || second === 88) {
320
+ cp = parseInt(token.slice(2), 16);
321
+ }
322
+ else {
323
+ cp = parseInt(token.slice(1), 10);
324
+ }
325
+ if (Number.isNaN(cp) || cp < 0 || cp > 0x10ffff) {
326
+ return undefined;
327
+ }
328
+ const minimum = this._classifyNCR(cp);
329
+ if (!this._numericAllowed && minimum < NCR_LEVEL.remove) {
330
+ return undefined;
331
+ }
332
+ const effective = minimum === -1 ? this._ncrOnLevel : Math.max(this._ncrOnLevel, minimum);
333
+ return this._applyNCRAction(effective, token, cp);
334
+ }
335
+ };
336
+ exports.EntityDecoderImpl = EntityDecoderImpl;
@@ -2,6 +2,17 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.parseXML = parseXML;
4
4
  const fast_xml_parser_1 = require("fast-xml-parser");
5
+ const nodable_entities_1 = require("./xml-external/nodable_entities");
6
+ const entityDecoder = new nodable_entities_1.EntityDecoderImpl({
7
+ namedEntities: { ...nodable_entities_1.XML, ...nodable_entities_1.COMMON_HTML, ...nodable_entities_1.CURRENCY },
8
+ numericAllowed: true,
9
+ limit: {
10
+ maxTotalExpansions: Infinity,
11
+ },
12
+ ncr: {
13
+ xmlVersion: 1.1,
14
+ },
15
+ });
5
16
  const parser = new fast_xml_parser_1.XMLParser({
6
17
  attributeNamePrefix: "",
7
18
  processEntities: {
@@ -9,6 +20,21 @@ const parser = new fast_xml_parser_1.XMLParser({
9
20
  maxTotalExpansions: Infinity,
10
21
  },
11
22
  htmlEntities: true,
23
+ entityDecoder: {
24
+ setExternalEntities: (entities) => {
25
+ entityDecoder.setExternalEntities(entities);
26
+ },
27
+ addInputEntities: (entities) => {
28
+ entityDecoder.addInputEntities(entities);
29
+ },
30
+ reset: () => {
31
+ entityDecoder.reset();
32
+ },
33
+ decode: (text) => {
34
+ return entityDecoder.decode(text);
35
+ },
36
+ setXmlVersion: (version) => void {},
37
+ },
12
38
  ignoreAttributes: false,
13
39
  ignoreDeclaration: true,
14
40
  parseTagValue: false,