@jjrawlins/cdk-diff-pr-github-action 1.4.3 → 1.5.0

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 (104) hide show
  1. package/.jsii +4 -4
  2. package/lib/CdkDiffIamTemplate.js +2 -2
  3. package/lib/CdkDiffIamTemplateStackSet.js +2 -2
  4. package/lib/CdkDiffStackWorkflow.js +1 -1
  5. package/lib/CdkDriftDetectionWorkflow.js +1 -1
  6. package/lib/CdkDriftIamTemplate.js +2 -2
  7. package/lib/bin/cdk-changeset-script.js +4 -2
  8. package/node_modules/@aws-sdk/client-cloudformation/package.json +12 -12
  9. package/node_modules/@aws-sdk/client-sso/package.json +11 -11
  10. package/node_modules/@aws-sdk/core/dist-cjs/index.js +15 -6
  11. package/node_modules/@aws-sdk/core/dist-cjs/submodules/protocols/index.js +15 -6
  12. package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/query/AwsEc2QueryProtocol.js +1 -0
  13. package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/query/QueryShapeSerializer.js +14 -6
  14. package/node_modules/@aws-sdk/core/dist-types/submodules/protocols/query/QuerySerializerSettings.d.ts +4 -0
  15. package/node_modules/@aws-sdk/core/dist-types/submodules/protocols/query/QueryShapeSerializer.d.ts +1 -1
  16. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/query/QuerySerializerSettings.d.ts +1 -0
  17. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/query/QueryShapeSerializer.d.ts +6 -1
  18. package/node_modules/@aws-sdk/core/package.json +4 -4
  19. package/node_modules/@aws-sdk/credential-provider-env/package.json +2 -2
  20. package/node_modules/@aws-sdk/credential-provider-http/package.json +3 -3
  21. package/node_modules/@aws-sdk/credential-provider-ini/package.json +9 -9
  22. package/node_modules/@aws-sdk/credential-provider-login/package.json +3 -3
  23. package/node_modules/@aws-sdk/credential-provider-node/package.json +7 -7
  24. package/node_modules/@aws-sdk/credential-provider-process/package.json +2 -2
  25. package/node_modules/@aws-sdk/credential-provider-sso/package.json +4 -4
  26. package/node_modules/@aws-sdk/credential-provider-web-identity/package.json +3 -3
  27. package/node_modules/@aws-sdk/middleware-user-agent/package.json +4 -4
  28. package/node_modules/@aws-sdk/nested-clients/package.json +11 -11
  29. package/node_modules/@aws-sdk/token-providers/package.json +3 -3
  30. package/node_modules/@aws-sdk/util-endpoints/package.json +1 -1
  31. package/node_modules/@aws-sdk/util-user-agent-node/package.json +2 -2
  32. package/node_modules/@aws-sdk/xml-builder/package.json +2 -2
  33. package/node_modules/@smithy/core/dist-cjs/submodules/event-streams/index.js +3 -0
  34. package/node_modules/@smithy/core/dist-cjs/submodules/protocols/index.js +3 -1
  35. package/node_modules/@smithy/core/dist-es/submodules/event-streams/EventStreamSerde.js +3 -0
  36. package/node_modules/@smithy/core/dist-es/submodules/protocols/HttpBindingProtocol.js +3 -1
  37. package/node_modules/@smithy/core/package.json +1 -1
  38. package/node_modules/@smithy/middleware-endpoint/package.json +2 -2
  39. package/node_modules/@smithy/middleware-retry/package.json +2 -2
  40. package/node_modules/@smithy/smithy-client/package.json +3 -3
  41. package/node_modules/@smithy/util-defaults-mode-browser/package.json +2 -2
  42. package/node_modules/@smithy/util-defaults-mode-node/package.json +2 -2
  43. package/node_modules/{@aws-sdk/xml-builder/node_modules/fast-xml-parser → fast-xml-parser}/CHANGELOG.md +13 -0
  44. package/node_modules/fast-xml-parser/lib/fxp.cjs +1 -0
  45. package/node_modules/{@aws-sdk/xml-builder/node_modules/fast-xml-parser → fast-xml-parser}/lib/fxp.d.cts +83 -14
  46. package/node_modules/fast-xml-parser/lib/fxp.min.js +2 -0
  47. package/node_modules/fast-xml-parser/lib/fxp.min.js.map +1 -0
  48. package/node_modules/fast-xml-parser/lib/fxparser.min.js +2 -0
  49. package/node_modules/fast-xml-parser/lib/fxparser.min.js.map +1 -0
  50. package/node_modules/{@aws-sdk/xml-builder/node_modules/fast-xml-parser → fast-xml-parser}/package.json +4 -4
  51. package/node_modules/{@aws-sdk/xml-builder/node_modules/fast-xml-parser → fast-xml-parser}/src/fxp.d.ts +74 -12
  52. package/node_modules/{@aws-sdk/xml-builder/node_modules/fast-xml-parser → fast-xml-parser}/src/v6/EntitiesParser.js +7 -5
  53. package/node_modules/{@aws-sdk/xml-builder/node_modules/fast-xml-parser → fast-xml-parser}/src/xmlparser/DocTypeReader.js +65 -53
  54. package/node_modules/fast-xml-parser/src/xmlparser/OptionsBuilder.js +86 -0
  55. package/node_modules/{@aws-sdk/xml-builder/node_modules/fast-xml-parser → fast-xml-parser}/src/xmlparser/OrderedObjParser.js +255 -187
  56. package/package.json +2 -2
  57. package/node_modules/@aws-sdk/xml-builder/node_modules/fast-xml-parser/lib/fxp.cjs +0 -1
  58. package/node_modules/@aws-sdk/xml-builder/node_modules/fast-xml-parser/lib/fxp.min.js +0 -2
  59. package/node_modules/@aws-sdk/xml-builder/node_modules/fast-xml-parser/lib/fxp.min.js.map +0 -1
  60. package/node_modules/@aws-sdk/xml-builder/node_modules/fast-xml-parser/lib/fxparser.min.js +0 -2
  61. package/node_modules/@aws-sdk/xml-builder/node_modules/fast-xml-parser/lib/fxparser.min.js.map +0 -1
  62. package/node_modules/@aws-sdk/xml-builder/node_modules/fast-xml-parser/src/xmlparser/OptionsBuilder.js +0 -46
  63. /package/node_modules/{@aws-sdk/xml-builder/node_modules/fast-xml-parser → fast-xml-parser}/LICENSE +0 -0
  64. /package/node_modules/{@aws-sdk/xml-builder/node_modules/fast-xml-parser → fast-xml-parser}/README.md +0 -0
  65. /package/node_modules/{@aws-sdk/xml-builder/node_modules/fast-xml-parser → fast-xml-parser}/lib/fxbuilder.min.js +0 -0
  66. /package/node_modules/{@aws-sdk/xml-builder/node_modules/fast-xml-parser → fast-xml-parser}/lib/fxbuilder.min.js.map +0 -0
  67. /package/node_modules/{@aws-sdk/xml-builder/node_modules/fast-xml-parser → fast-xml-parser}/lib/fxvalidator.min.js +0 -0
  68. /package/node_modules/{@aws-sdk/xml-builder/node_modules/fast-xml-parser → fast-xml-parser}/lib/fxvalidator.min.js.map +0 -0
  69. /package/node_modules/{@aws-sdk/xml-builder/node_modules/fast-xml-parser → fast-xml-parser}/src/cli/cli.js +0 -0
  70. /package/node_modules/{@aws-sdk/xml-builder/node_modules/fast-xml-parser → fast-xml-parser}/src/cli/man.js +0 -0
  71. /package/node_modules/{@aws-sdk/xml-builder/node_modules/fast-xml-parser → fast-xml-parser}/src/cli/read.js +0 -0
  72. /package/node_modules/{@aws-sdk/xml-builder/node_modules/fast-xml-parser → fast-xml-parser}/src/fxp.js +0 -0
  73. /package/node_modules/{@aws-sdk/xml-builder/node_modules/fast-xml-parser → fast-xml-parser}/src/ignoreAttributes.js +0 -0
  74. /package/node_modules/{@aws-sdk/xml-builder/node_modules/fast-xml-parser → fast-xml-parser}/src/util.js +0 -0
  75. /package/node_modules/{@aws-sdk/xml-builder/node_modules/fast-xml-parser → fast-xml-parser}/src/v6/CharsSymbol.js +0 -0
  76. /package/node_modules/{@aws-sdk/xml-builder/node_modules/fast-xml-parser → fast-xml-parser}/src/v6/OptionsBuilder.js +0 -0
  77. /package/node_modules/{@aws-sdk/xml-builder/node_modules/fast-xml-parser → fast-xml-parser}/src/v6/OutputBuilders/BaseOutputBuilder.js +0 -0
  78. /package/node_modules/{@aws-sdk/xml-builder/node_modules/fast-xml-parser → fast-xml-parser}/src/v6/OutputBuilders/JsArrBuilder.js +0 -0
  79. /package/node_modules/{@aws-sdk/xml-builder/node_modules/fast-xml-parser → fast-xml-parser}/src/v6/OutputBuilders/JsMinArrBuilder.js +0 -0
  80. /package/node_modules/{@aws-sdk/xml-builder/node_modules/fast-xml-parser → fast-xml-parser}/src/v6/OutputBuilders/JsObjBuilder.js +0 -0
  81. /package/node_modules/{@aws-sdk/xml-builder/node_modules/fast-xml-parser → fast-xml-parser}/src/v6/OutputBuilders/ParserOptionsBuilder.js +0 -0
  82. /package/node_modules/{@aws-sdk/xml-builder/node_modules/fast-xml-parser → fast-xml-parser}/src/v6/Report.js +0 -0
  83. /package/node_modules/{@aws-sdk/xml-builder/node_modules/fast-xml-parser → fast-xml-parser}/src/v6/TagPath.js +0 -0
  84. /package/node_modules/{@aws-sdk/xml-builder/node_modules/fast-xml-parser → fast-xml-parser}/src/v6/TagPathMatcher.js +0 -0
  85. /package/node_modules/{@aws-sdk/xml-builder/node_modules/fast-xml-parser → fast-xml-parser}/src/v6/XMLParser.js +0 -0
  86. /package/node_modules/{@aws-sdk/xml-builder/node_modules/fast-xml-parser → fast-xml-parser}/src/v6/Xml2JsParser.js +0 -0
  87. /package/node_modules/{@aws-sdk/xml-builder/node_modules/fast-xml-parser → fast-xml-parser}/src/v6/XmlPartReader.js +0 -0
  88. /package/node_modules/{@aws-sdk/xml-builder/node_modules/fast-xml-parser → fast-xml-parser}/src/v6/XmlSpecialTagsReader.js +0 -0
  89. /package/node_modules/{@aws-sdk/xml-builder/node_modules/fast-xml-parser → fast-xml-parser}/src/v6/inputSource/BufferSource.js +0 -0
  90. /package/node_modules/{@aws-sdk/xml-builder/node_modules/fast-xml-parser → fast-xml-parser}/src/v6/inputSource/StringSource.js +0 -0
  91. /package/node_modules/{@aws-sdk/xml-builder/node_modules/fast-xml-parser → fast-xml-parser}/src/v6/valueParsers/EntitiesParser.js +0 -0
  92. /package/node_modules/{@aws-sdk/xml-builder/node_modules/fast-xml-parser → fast-xml-parser}/src/v6/valueParsers/booleanParser.js +0 -0
  93. /package/node_modules/{@aws-sdk/xml-builder/node_modules/fast-xml-parser → fast-xml-parser}/src/v6/valueParsers/booleanParserExt.js +0 -0
  94. /package/node_modules/{@aws-sdk/xml-builder/node_modules/fast-xml-parser → fast-xml-parser}/src/v6/valueParsers/currency.js +0 -0
  95. /package/node_modules/{@aws-sdk/xml-builder/node_modules/fast-xml-parser → fast-xml-parser}/src/v6/valueParsers/join.js +0 -0
  96. /package/node_modules/{@aws-sdk/xml-builder/node_modules/fast-xml-parser → fast-xml-parser}/src/v6/valueParsers/number.js +0 -0
  97. /package/node_modules/{@aws-sdk/xml-builder/node_modules/fast-xml-parser → fast-xml-parser}/src/v6/valueParsers/trim.js +0 -0
  98. /package/node_modules/{@aws-sdk/xml-builder/node_modules/fast-xml-parser → fast-xml-parser}/src/validator.js +0 -0
  99. /package/node_modules/{@aws-sdk/xml-builder/node_modules/fast-xml-parser → fast-xml-parser}/src/xmlbuilder/json2xml.js +0 -0
  100. /package/node_modules/{@aws-sdk/xml-builder/node_modules/fast-xml-parser → fast-xml-parser}/src/xmlbuilder/orderedJs2Xml.js +0 -0
  101. /package/node_modules/{@aws-sdk/xml-builder/node_modules/fast-xml-parser → fast-xml-parser}/src/xmlbuilder/prettifyJs2Xml.js +0 -0
  102. /package/node_modules/{@aws-sdk/xml-builder/node_modules/fast-xml-parser → fast-xml-parser}/src/xmlparser/XMLParser.js +0 -0
  103. /package/node_modules/{@aws-sdk/xml-builder/node_modules/fast-xml-parser → fast-xml-parser}/src/xmlparser/node2json.js +0 -0
  104. /package/node_modules/{@aws-sdk/xml-builder/node_modules/fast-xml-parser → fast-xml-parser}/src/xmlparser/xmlNode.js +0 -0
@@ -1,80 +1,82 @@
1
- import {isName} from '../util.js';
1
+ import { isName } from '../util.js';
2
2
 
3
- export default class DocTypeReader{
4
- constructor(processEntities){
5
- this.suppressValidationErr = !processEntities;
3
+ export default class DocTypeReader {
4
+ constructor(options) {
5
+ this.suppressValidationErr = !options;
6
+ this.options = options;
6
7
  }
7
-
8
- readDocType(xmlData, i){
9
-
8
+
9
+ readDocType(xmlData, i) {
10
+
10
11
  const entities = {};
11
- if( xmlData[i + 3] === 'O' &&
12
+ if (xmlData[i + 3] === 'O' &&
12
13
  xmlData[i + 4] === 'C' &&
13
14
  xmlData[i + 5] === 'T' &&
14
15
  xmlData[i + 6] === 'Y' &&
15
16
  xmlData[i + 7] === 'P' &&
16
- xmlData[i + 8] === 'E')
17
- {
18
- i = i+9;
17
+ xmlData[i + 8] === 'E') {
18
+ i = i + 9;
19
19
  let angleBracketsCount = 1;
20
20
  let hasBody = false, comment = false;
21
21
  let exp = "";
22
- for(;i<xmlData.length;i++){
22
+ for (; i < xmlData.length; i++) {
23
23
  if (xmlData[i] === '<' && !comment) { //Determine the tag type
24
- if( hasBody && hasSeq(xmlData, "!ENTITY",i)){
25
- i += 7;
24
+ if (hasBody && hasSeq(xmlData, "!ENTITY", i)) {
25
+ i += 7;
26
26
  let entityName, val;
27
- [entityName, val,i] = this.readEntityExp(xmlData,i+1,this.suppressValidationErr);
28
- if(val.indexOf("&") === -1) //Parameter entities are not supported
29
- entities[ entityName ] = {
30
- regx : RegExp( `&${entityName};`,"g"),
27
+ [entityName, val, i] = this.readEntityExp(xmlData, i + 1, this.suppressValidationErr);
28
+ if (val.indexOf("&") === -1) { //Parameter entities are not supported
29
+ const escaped = entityName.replace(/[.\-+*:]/g, '\\.');
30
+ entities[entityName] = {
31
+ regx: RegExp(`&${escaped};`, "g"),
31
32
  val: val
32
33
  };
34
+ }
33
35
  }
34
- else if( hasBody && hasSeq(xmlData, "!ELEMENT",i)) {
36
+ else if (hasBody && hasSeq(xmlData, "!ELEMENT", i)) {
35
37
  i += 8;//Not supported
36
- const {index} = this.readElementExp(xmlData,i+1);
38
+ const { index } = this.readElementExp(xmlData, i + 1);
37
39
  i = index;
38
- }else if( hasBody && hasSeq(xmlData, "!ATTLIST",i)){
40
+ } else if (hasBody && hasSeq(xmlData, "!ATTLIST", i)) {
39
41
  i += 8;//Not supported
40
42
  // const {index} = this.readAttlistExp(xmlData,i+1);
41
43
  // i = index;
42
- }else if( hasBody && hasSeq(xmlData, "!NOTATION",i)) {
44
+ } else if (hasBody && hasSeq(xmlData, "!NOTATION", i)) {
43
45
  i += 9;//Not supported
44
- const {index} = this.readNotationExp(xmlData,i+1,this.suppressValidationErr);
46
+ const { index } = this.readNotationExp(xmlData, i + 1, this.suppressValidationErr);
45
47
  i = index;
46
- }else if( hasSeq(xmlData, "!--",i) ) comment = true;
48
+ } else if (hasSeq(xmlData, "!--", i)) comment = true;
47
49
  else throw new Error(`Invalid DOCTYPE`);
48
50
 
49
51
  angleBracketsCount++;
50
52
  exp = "";
51
53
  } else if (xmlData[i] === '>') { //Read tag content
52
- if(comment){
53
- if( xmlData[i - 1] === "-" && xmlData[i - 2] === "-"){
54
+ if (comment) {
55
+ if (xmlData[i - 1] === "-" && xmlData[i - 2] === "-") {
54
56
  comment = false;
55
57
  angleBracketsCount--;
56
58
  }
57
- }else{
59
+ } else {
58
60
  angleBracketsCount--;
59
61
  }
60
62
  if (angleBracketsCount === 0) {
61
- break;
63
+ break;
62
64
  }
63
- }else if( xmlData[i] === '['){
65
+ } else if (xmlData[i] === '[') {
64
66
  hasBody = true;
65
- }else{
67
+ } else {
66
68
  exp += xmlData[i];
67
69
  }
68
70
  }
69
- if(angleBracketsCount !== 0){
71
+ if (angleBracketsCount !== 0) {
70
72
  throw new Error(`Unclosed DOCTYPE`);
71
73
  }
72
- }else{
74
+ } else {
73
75
  throw new Error(`Invalid Tag instead of DOCTYPE`);
74
76
  }
75
- return {entities, i};
77
+ return { entities, i };
76
78
  }
77
- readEntityExp(xmlData, i) {
79
+ readEntityExp(xmlData, i) {
78
80
  //External entities are not supported
79
81
  // <!ENTITY ext SYSTEM "http://normal-website.com" >
80
82
 
@@ -99,10 +101,10 @@ export default class DocTypeReader{
99
101
  i = skipWhitespace(xmlData, i);
100
102
 
101
103
  // Check for unsupported constructs (external entities or parameter entities)
102
- if(!this.suppressValidationErr){
104
+ if (!this.suppressValidationErr) {
103
105
  if (xmlData.substring(i, i + 6).toUpperCase() === "SYSTEM") {
104
106
  throw new Error("External entities are not supported");
105
- }else if (xmlData[i] === "%") {
107
+ } else if (xmlData[i] === "%") {
106
108
  throw new Error("Parameter entities are not supported");
107
109
  }
108
110
  }
@@ -110,8 +112,18 @@ export default class DocTypeReader{
110
112
  // Read entity value (internal entity)
111
113
  let entityValue = "";
112
114
  [i, entityValue] = this.readIdentifierVal(xmlData, i, "entity");
115
+
116
+ // Validate entity size
117
+ if (this.options.enabled !== false &&
118
+ this.options.maxEntitySize &&
119
+ entityValue.length > this.options.maxEntitySize) {
120
+ throw new Error(
121
+ `Entity "${entityName}" size (${entityValue.length}) exceeds maximum allowed size (${this.options.maxEntitySize})`
122
+ );
123
+ }
124
+
113
125
  i--;
114
- return [entityName, entityValue, i ];
126
+ return [entityName, entityValue, i];
115
127
  }
116
128
 
117
129
  readNotationExp(xmlData, i) {
@@ -144,25 +156,25 @@ export default class DocTypeReader{
144
156
  let systemIdentifier = null;
145
157
 
146
158
  if (identifierType === "PUBLIC") {
147
- [i, publicIdentifier ] = this.readIdentifierVal(xmlData, i, "publicIdentifier");
159
+ [i, publicIdentifier] = this.readIdentifierVal(xmlData, i, "publicIdentifier");
148
160
 
149
161
  // Skip whitespace after public identifier
150
162
  i = skipWhitespace(xmlData, i);
151
163
 
152
164
  // Optionally read system identifier
153
165
  if (xmlData[i] === '"' || xmlData[i] === "'") {
154
- [i, systemIdentifier ] = this.readIdentifierVal(xmlData, i,"systemIdentifier");
166
+ [i, systemIdentifier] = this.readIdentifierVal(xmlData, i, "systemIdentifier");
155
167
  }
156
168
  } else if (identifierType === "SYSTEM") {
157
169
  // Read system identifier (mandatory for SYSTEM)
158
- [i, systemIdentifier ] = this.readIdentifierVal(xmlData, i, "systemIdentifier");
170
+ [i, systemIdentifier] = this.readIdentifierVal(xmlData, i, "systemIdentifier");
159
171
 
160
172
  if (!this.suppressValidationErr && !systemIdentifier) {
161
173
  throw new Error("Missing mandatory system identifier for SYSTEM notation");
162
174
  }
163
175
  }
164
-
165
- return {notationName, publicIdentifier, systemIdentifier, index: --i};
176
+
177
+ return { notationName, publicIdentifier, systemIdentifier, index: --i };
166
178
  }
167
179
 
168
180
  readIdentifierVal(xmlData, i, type) {
@@ -191,7 +203,7 @@ export default class DocTypeReader{
191
203
  // <!ELEMENT title (#PCDATA)>
192
204
  // <!ELEMENT book (title, author+)>
193
205
  // <!ELEMENT name (content-model)>
194
-
206
+
195
207
  // Skip leading whitespace after <!ELEMENT
196
208
  i = skipWhitespace(xmlData, i);
197
209
 
@@ -211,8 +223,8 @@ export default class DocTypeReader{
211
223
  i = skipWhitespace(xmlData, i);
212
224
  let contentModel = "";
213
225
  // Expect '(' to start content model
214
- if(xmlData[i] === "E" && hasSeq(xmlData, "MPTY",i)) i+=4;
215
- else if(xmlData[i] === "A" && hasSeq(xmlData, "NY",i)) i+=2;
226
+ if (xmlData[i] === "E" && hasSeq(xmlData, "MPTY", i)) i += 4;
227
+ else if (xmlData[i] === "A" && hasSeq(xmlData, "NY", i)) i += 2;
216
228
  else if (xmlData[i] === "(") {
217
229
  i++; // Move past '('
218
230
 
@@ -225,10 +237,10 @@ export default class DocTypeReader{
225
237
  throw new Error("Unterminated content model");
226
238
  }
227
239
 
228
- }else if(!this.suppressValidationErr){
240
+ } else if (!this.suppressValidationErr) {
229
241
  throw new Error(`Invalid Element Expression, found "${xmlData[i]}"`);
230
242
  }
231
-
243
+
232
244
  return {
233
245
  elementName,
234
246
  contentModel: contentModel.trim(),
@@ -364,16 +376,16 @@ const skipWhitespace = (data, index) => {
364
376
 
365
377
 
366
378
 
367
- function hasSeq(data, seq,i){
368
- for(let j=0;j<seq.length;j++){
369
- if(seq[j]!==data[i+j+1]) return false;
379
+ function hasSeq(data, seq, i) {
380
+ for (let j = 0; j < seq.length; j++) {
381
+ if (seq[j] !== data[i + j + 1]) return false;
370
382
  }
371
383
  return true;
372
384
  }
373
385
 
374
- function validateEntityName(name){
386
+ function validateEntityName(name) {
375
387
  if (isName(name))
376
- return name;
388
+ return name;
377
389
  else
378
390
  throw new Error(`Invalid entity name ${name}`);
379
- }
391
+ }
@@ -0,0 +1,86 @@
1
+ export const defaultOptions = {
2
+ preserveOrder: false,
3
+ attributeNamePrefix: '@_',
4
+ attributesGroupName: false,
5
+ textNodeName: '#text',
6
+ ignoreAttributes: true,
7
+ removeNSPrefix: false, // remove NS from tag name or attribute name if true
8
+ allowBooleanAttributes: false, //a tag can have attributes without any value
9
+ //ignoreRootElement : false,
10
+ parseTagValue: true,
11
+ parseAttributeValue: false,
12
+ trimValues: true, //Trim string values of tag and attributes
13
+ cdataPropName: false,
14
+ numberParseOptions: {
15
+ hex: true,
16
+ leadingZeros: true,
17
+ eNotation: true
18
+ },
19
+ tagValueProcessor: function (tagName, val) {
20
+ return val;
21
+ },
22
+ attributeValueProcessor: function (attrName, val) {
23
+ return val;
24
+ },
25
+ stopNodes: [], //nested tags will not be parsed even for errors
26
+ alwaysCreateTextNode: false,
27
+ isArray: () => false,
28
+ commentPropName: false,
29
+ unpairedTags: [],
30
+ processEntities: true,
31
+ htmlEntities: false,
32
+ ignoreDeclaration: false,
33
+ ignorePiTags: false,
34
+ transformTagName: false,
35
+ transformAttributeName: false,
36
+ updateTag: function (tagName, jPath, attrs) {
37
+ return tagName
38
+ },
39
+ // skipEmptyListItem: false
40
+ captureMetaData: false,
41
+ };
42
+
43
+ /**
44
+ * Normalizes processEntities option for backward compatibility
45
+ * @param {boolean|object} value
46
+ * @returns {object} Always returns normalized object
47
+ */
48
+ function normalizeProcessEntities(value) {
49
+ // Boolean backward compatibility
50
+ if (typeof value === 'boolean') {
51
+ return {
52
+ enabled: value, // true or false
53
+ maxEntitySize: 10000,
54
+ maxExpansionDepth: 10,
55
+ maxTotalExpansions: 1000,
56
+ maxExpandedLength: 100000,
57
+ allowedTags: null,
58
+ tagFilter: null
59
+ };
60
+ }
61
+
62
+ // Object config - merge with defaults
63
+ if (typeof value === 'object' && value !== null) {
64
+ return {
65
+ enabled: value.enabled !== false, // default true if not specified
66
+ maxEntitySize: value.maxEntitySize ?? 10000,
67
+ maxExpansionDepth: value.maxExpansionDepth ?? 10,
68
+ maxTotalExpansions: value.maxTotalExpansions ?? 1000,
69
+ maxExpandedLength: value.maxExpandedLength ?? 100000,
70
+ allowedTags: value.allowedTags ?? null,
71
+ tagFilter: value.tagFilter ?? null
72
+ };
73
+ }
74
+
75
+ // Default to enabled with limits
76
+ return normalizeProcessEntities(true);
77
+ }
78
+
79
+ export const buildOptions = function (options) {
80
+ const built = Object.assign({}, defaultOptions, options);
81
+
82
+ // Always normalize processEntities for backward compatibility and validation
83
+ built.processEntities = normalizeProcessEntities(built.processEntities);
84
+ //console.debug(built.processEntities)
85
+ return built;
86
+ };