@cdk8s/awscdk-resolver 0.0.318 → 0.0.319

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 (134) hide show
  1. package/.jsii +3 -3
  2. package/lib/resolve.js +1 -1
  3. package/node_modules/@aws-sdk/client-cloudformation/package.json +14 -14
  4. package/node_modules/@aws-sdk/client-sso/package.json +13 -13
  5. package/node_modules/@aws-sdk/core/package.json +4 -4
  6. package/node_modules/@aws-sdk/credential-provider-env/package.json +2 -2
  7. package/node_modules/@aws-sdk/credential-provider-http/package.json +6 -6
  8. package/node_modules/@aws-sdk/credential-provider-ini/package.json +8 -8
  9. package/node_modules/@aws-sdk/credential-provider-node/package.json +7 -7
  10. package/node_modules/@aws-sdk/credential-provider-process/package.json +2 -2
  11. package/node_modules/@aws-sdk/credential-provider-sso/package.json +4 -4
  12. package/node_modules/@aws-sdk/credential-provider-web-identity/package.json +3 -3
  13. package/node_modules/@aws-sdk/middleware-user-agent/package.json +4 -4
  14. package/node_modules/@aws-sdk/nested-clients/package.json +13 -13
  15. package/node_modules/@aws-sdk/token-providers/package.json +3 -3
  16. package/node_modules/@aws-sdk/util-endpoints/dist-cjs/index.js +30 -0
  17. package/node_modules/@aws-sdk/util-endpoints/dist-es/index.js +1 -0
  18. package/node_modules/@aws-sdk/util-endpoints/dist-es/resolveDefaultAwsRegionalEndpointsConfig.js +21 -0
  19. package/node_modules/@aws-sdk/util-endpoints/dist-types/index.d.ts +1 -0
  20. package/node_modules/@aws-sdk/util-endpoints/dist-types/resolveDefaultAwsRegionalEndpointsConfig.d.ts +56 -0
  21. package/node_modules/@aws-sdk/util-endpoints/dist-types/ts3.4/index.d.ts +1 -0
  22. package/node_modules/@aws-sdk/util-endpoints/dist-types/ts3.4/resolveDefaultAwsRegionalEndpointsConfig.d.ts +35 -0
  23. package/node_modules/@aws-sdk/util-endpoints/package.json +2 -1
  24. package/node_modules/@aws-sdk/util-user-agent-node/package.json +2 -2
  25. package/node_modules/@smithy/core/dist-cjs/submodules/protocols/index.js +20 -20
  26. package/node_modules/@smithy/core/dist-cjs/submodules/schema/index.js +80 -6
  27. package/node_modules/@smithy/core/dist-es/submodules/protocols/HttpBindingProtocol.js +20 -20
  28. package/node_modules/@smithy/core/dist-es/submodules/schema/schemas/ErrorSchema.js +10 -0
  29. package/node_modules/@smithy/core/dist-es/submodules/schema/schemas/ListSchema.js +10 -0
  30. package/node_modules/@smithy/core/dist-es/submodules/schema/schemas/MapSchema.js +10 -0
  31. package/node_modules/@smithy/core/dist-es/submodules/schema/schemas/NormalizedSchema.js +10 -0
  32. package/node_modules/@smithy/core/dist-es/submodules/schema/schemas/SimpleSchema.js +10 -0
  33. package/node_modules/@smithy/core/dist-es/submodules/schema/schemas/StructureSchema.js +10 -0
  34. package/node_modules/@smithy/core/dist-types/submodules/protocols/HttpBindingProtocol.d.ts +1 -1
  35. package/node_modules/@smithy/core/dist-types/submodules/schema/schemas/ErrorSchema.d.ts +3 -0
  36. package/node_modules/@smithy/core/dist-types/submodules/schema/schemas/ListSchema.d.ts +3 -0
  37. package/node_modules/@smithy/core/dist-types/submodules/schema/schemas/MapSchema.d.ts +3 -0
  38. package/node_modules/@smithy/core/dist-types/submodules/schema/schemas/NormalizedSchema.d.ts +3 -0
  39. package/node_modules/@smithy/core/dist-types/submodules/schema/schemas/SimpleSchema.d.ts +3 -0
  40. package/node_modules/@smithy/core/dist-types/submodules/schema/schemas/StructureSchema.d.ts +3 -0
  41. package/node_modules/@smithy/core/dist-types/ts3.4/submodules/protocols/HttpBindingProtocol.d.ts +1 -1
  42. package/node_modules/@smithy/core/dist-types/ts3.4/submodules/schema/schemas/ErrorSchema.d.ts +3 -0
  43. package/node_modules/@smithy/core/dist-types/ts3.4/submodules/schema/schemas/ListSchema.d.ts +3 -0
  44. package/node_modules/@smithy/core/dist-types/ts3.4/submodules/schema/schemas/MapSchema.d.ts +3 -0
  45. package/node_modules/@smithy/core/dist-types/ts3.4/submodules/schema/schemas/NormalizedSchema.d.ts +3 -0
  46. package/node_modules/@smithy/core/dist-types/ts3.4/submodules/schema/schemas/SimpleSchema.d.ts +3 -0
  47. package/node_modules/@smithy/core/dist-types/ts3.4/submodules/schema/schemas/StructureSchema.d.ts +3 -0
  48. package/node_modules/@smithy/core/package.json +2 -2
  49. package/node_modules/@smithy/fetch-http-handler/dist-cjs/index.js +2 -2
  50. package/node_modules/@smithy/fetch-http-handler/dist-es/fetch-http-handler.js +4 -4
  51. package/node_modules/@smithy/fetch-http-handler/dist-types/fetch-http-handler.d.ts +1 -1
  52. package/node_modules/@smithy/fetch-http-handler/dist-types/ts3.4/fetch-http-handler.d.ts +1 -1
  53. package/node_modules/@smithy/fetch-http-handler/package.json +1 -1
  54. package/node_modules/@smithy/middleware-endpoint/dist-cjs/index.js +5 -2
  55. package/node_modules/@smithy/middleware-endpoint/dist-es/adaptors/createConfigValueProvider.js +3 -0
  56. package/node_modules/@smithy/middleware-endpoint/dist-es/adaptors/getEndpointFromInstructions.js +1 -1
  57. package/node_modules/@smithy/middleware-endpoint/dist-es/endpointMiddleware.js +1 -1
  58. package/node_modules/@smithy/middleware-endpoint/dist-types/resolveEndpointConfig.d.ts +5 -2
  59. package/node_modules/@smithy/middleware-endpoint/dist-types/ts3.4/resolveEndpointConfig.d.ts +5 -2
  60. package/node_modules/@smithy/middleware-endpoint/package.json +2 -2
  61. package/node_modules/@smithy/middleware-retry/package.json +2 -2
  62. package/node_modules/@smithy/node-http-handler/dist-cjs/index.js +11 -9
  63. package/node_modules/@smithy/node-http-handler/dist-es/node-http-handler.js +4 -3
  64. package/node_modules/@smithy/node-http-handler/dist-es/node-http2-handler.js +7 -6
  65. package/node_modules/@smithy/node-http-handler/dist-types/node-http-handler.d.ts +1 -1
  66. package/node_modules/@smithy/node-http-handler/dist-types/node-http2-handler.d.ts +1 -1
  67. package/node_modules/@smithy/node-http-handler/dist-types/ts3.4/node-http-handler.d.ts +1 -1
  68. package/node_modules/@smithy/node-http-handler/dist-types/ts3.4/node-http2-handler.d.ts +1 -1
  69. package/node_modules/@smithy/node-http-handler/package.json +1 -1
  70. package/node_modules/@smithy/smithy-client/package.json +4 -4
  71. package/node_modules/@smithy/util-defaults-mode-browser/package.json +2 -2
  72. package/node_modules/@smithy/util-defaults-mode-node/package.json +2 -2
  73. package/node_modules/@smithy/util-stream/package.json +3 -3
  74. package/node_modules/fast-xml-parser/CHANGELOG.md +77 -0
  75. package/node_modules/fast-xml-parser/README.md +39 -52
  76. package/node_modules/fast-xml-parser/lib/fxbuilder.min.js +2 -0
  77. package/node_modules/fast-xml-parser/lib/fxbuilder.min.js.map +1 -0
  78. package/node_modules/fast-xml-parser/lib/fxp.cjs +1 -0
  79. package/node_modules/fast-xml-parser/lib/fxp.d.cts +458 -0
  80. package/node_modules/fast-xml-parser/lib/fxp.min.js +2 -0
  81. package/node_modules/fast-xml-parser/lib/fxp.min.js.map +1 -0
  82. package/node_modules/fast-xml-parser/lib/fxparser.min.js +2 -0
  83. package/node_modules/fast-xml-parser/lib/fxparser.min.js.map +1 -0
  84. package/node_modules/fast-xml-parser/lib/fxvalidator.min.js +2 -0
  85. package/node_modules/fast-xml-parser/lib/fxvalidator.min.js.map +1 -0
  86. package/node_modules/fast-xml-parser/package.json +36 -20
  87. package/node_modules/fast-xml-parser/src/cli/cli.js +16 -12
  88. package/node_modules/fast-xml-parser/src/cli/man.js +6 -1
  89. package/node_modules/fast-xml-parser/src/cli/read.js +30 -79
  90. package/node_modules/fast-xml-parser/src/fxp.d.ts +52 -9
  91. package/node_modules/fast-xml-parser/src/fxp.js +11 -8
  92. package/node_modules/fast-xml-parser/src/ignoreAttributes.js +18 -0
  93. package/node_modules/fast-xml-parser/src/util.js +14 -18
  94. package/node_modules/fast-xml-parser/src/{v5 → v6}/CharsSymbol.js +1 -1
  95. package/node_modules/fast-xml-parser/src/{v5/valueParsers → v6}/EntitiesParser.js +3 -6
  96. package/node_modules/fast-xml-parser/src/{v5 → v6}/OptionsBuilder.js +3 -6
  97. package/node_modules/fast-xml-parser/src/{v5 → v6}/OutputBuilders/BaseOutputBuilder.js +1 -3
  98. package/node_modules/fast-xml-parser/src/{v5 → v6}/OutputBuilders/JsArrBuilder.js +3 -3
  99. package/node_modules/fast-xml-parser/src/{v5 → v6}/OutputBuilders/JsMinArrBuilder.js +3 -5
  100. package/node_modules/fast-xml-parser/src/{v5 → v6}/OutputBuilders/JsObjBuilder.js +3 -5
  101. package/node_modules/fast-xml-parser/src/{v5 → v6}/OutputBuilders/ParserOptionsBuilder.js +6 -11
  102. package/node_modules/fast-xml-parser/src/{v5 → v6}/TagPath.js +1 -1
  103. package/node_modules/fast-xml-parser/src/{v5 → v6}/TagPathMatcher.js +3 -5
  104. package/node_modules/fast-xml-parser/src/{v5 → v6}/XMLParser.js +3 -5
  105. package/node_modules/fast-xml-parser/src/{v5 → v6}/Xml2JsParser.js +8 -10
  106. package/node_modules/fast-xml-parser/src/{v5 → v6}/XmlPartReader.js +24 -26
  107. package/node_modules/fast-xml-parser/src/{v5 → v6}/XmlSpecialTagsReader.js +5 -12
  108. package/node_modules/fast-xml-parser/src/{v5 → v6}/inputSource/BufferSource.js +1 -3
  109. package/node_modules/fast-xml-parser/src/{v5 → v6}/inputSource/StringSource.js +1 -3
  110. package/node_modules/fast-xml-parser/src/{v5 → v6/valueParsers}/EntitiesParser.js +3 -5
  111. package/node_modules/fast-xml-parser/src/{v5 → v6}/valueParsers/booleanParser.js +1 -2
  112. package/node_modules/fast-xml-parser/src/{v5 → v6}/valueParsers/booleanParserExt.js +1 -2
  113. package/node_modules/fast-xml-parser/src/{v5 → v6}/valueParsers/currency.js +1 -3
  114. package/node_modules/fast-xml-parser/src/{v5 → v6}/valueParsers/join.js +1 -2
  115. package/node_modules/fast-xml-parser/src/{v5 → v6}/valueParsers/number.js +2 -4
  116. package/node_modules/fast-xml-parser/src/{v5 → v6}/valueParsers/trim.js +1 -3
  117. package/node_modules/fast-xml-parser/src/validator.js +5 -5
  118. package/node_modules/fast-xml-parser/src/xmlbuilder/json2xml.js +17 -13
  119. package/node_modules/fast-xml-parser/src/xmlbuilder/orderedJs2Xml.js +1 -2
  120. package/node_modules/fast-xml-parser/src/xmlparser/DocTypeReader.js +288 -71
  121. package/node_modules/fast-xml-parser/src/xmlparser/OptionsBuilder.js +3 -5
  122. package/node_modules/fast-xml-parser/src/xmlparser/OrderedObjParser.js +28 -23
  123. package/node_modules/fast-xml-parser/src/xmlparser/XMLParser.js +21 -8
  124. package/node_modules/fast-xml-parser/src/xmlparser/node2json.js +8 -2
  125. package/node_modules/fast-xml-parser/src/xmlparser/xmlNode.js +22 -7
  126. package/node_modules/strnum/.github/SECURITY.md +5 -0
  127. package/node_modules/strnum/CHANGELOG.md +11 -0
  128. package/node_modules/strnum/algo.stflow +84 -0
  129. package/node_modules/strnum/package.json +2 -1
  130. package/node_modules/strnum/strnum.js +53 -35
  131. package/node_modules/strnum/strnum.test.js +9 -1
  132. package/node_modules/strnum/test.js +9 -0
  133. package/package.json +4 -4
  134. /package/node_modules/fast-xml-parser/src/{v5 → v6}/Report.js +0 -0
@@ -2,17 +2,17 @@
2
2
 
3
3
  /**
4
4
  * find paired tag for a stop node
5
- * @param {string} xmlDoc
6
- * @param {string} tagName
5
+ * @param {string} xmlDoc
6
+ * @param {string} tagName
7
7
  * @param {number} i : start index
8
8
  */
9
- function readStopNode(xmlDoc, tagName, i){
9
+ export function readStopNode(xmlDoc, tagName, i){
10
10
  const startIndex = i;
11
11
  // Starting at 1 since we already have an open tag
12
12
  let openTagCount = 1;
13
-
13
+
14
14
  for (; i < xmlDoc.length; i++) {
15
- if( xmlDoc[i] === "<"){
15
+ if( xmlDoc[i] === "<"){
16
16
  if (xmlDoc[i+1] === "/") {//close tag
17
17
  const closeIndex = findSubStrIndex(xmlDoc, ">", i, `${tagName} is not closed`);
18
18
  let closeTagName = xmlDoc.substring(i+2,closeIndex).trim();
@@ -26,18 +26,18 @@ function readStopNode(xmlDoc, tagName, i){
26
26
  }
27
27
  }
28
28
  i=closeIndex;
29
- } else if(xmlDoc[i+1] === '?') {
29
+ } else if(xmlDoc[i+1] === '?') {
30
30
  const closeIndex = findSubStrIndex(xmlDoc, "?>", i+1, "StopNode is not closed.")
31
31
  i=closeIndex;
32
- } else if(xmlDoc.substr(i + 1, 3) === '!--') {
32
+ } else if(xmlDoc.substr(i + 1, 3) === '!--') {
33
33
  const closeIndex = findSubStrIndex(xmlDoc, "-->", i+3, "StopNode is not closed.")
34
34
  i=closeIndex;
35
- } else if(xmlDoc.substr(i + 1, 2) === '![') {
35
+ } else if(xmlDoc.substr(i + 1, 2) === '![') {
36
36
  const closeIndex = findSubStrIndex(xmlDoc, "]]>", i, "StopNode is not closed.") - 2;
37
37
  i=closeIndex;
38
38
  } else {
39
39
  const tagData = readTagExp(xmlDoc, i, '>')
40
-
40
+
41
41
  if (tagData) {
42
42
  const openTagName = tagData && tagData.tagName;
43
43
  if (openTagName === tagName && tagData.tagExp[tagData.tagExp.length-1] !== "/") {
@@ -52,10 +52,10 @@ function readStopNode(xmlDoc, tagName, i){
52
52
 
53
53
  /**
54
54
  * Read closing tag name
55
- * @param {Source} source
55
+ * @param {Source} source
56
56
  * @returns tag name
57
57
  */
58
- function readClosingTagName(source){
58
+ export function readClosingTagName(source){
59
59
  let text = ""; //temporary data
60
60
  while(source.canRead()){
61
61
  let ch = source.readCh();
@@ -73,11 +73,11 @@ function readClosingTagName(source){
73
73
  * This function can be used to read normal tag, pi tag.
74
74
  * This function can't be used to read comment, CDATA, DOCTYPE.
75
75
  * Eg <tag attr = ' some"' attr= ">" bool>
76
- * @param {string} xmlDoc
76
+ * @param {string} xmlDoc
77
77
  * @param {number} startIndex starting index
78
- * @returns tag expression includes tag name & attribute string
78
+ * @returns tag expression includes tag name & attribute string
79
79
  */
80
- function readTagExp(parser) {
80
+ export function readTagExp(parser) {
81
81
  let inSingleQuotes = false;
82
82
  let inDoubleQuotes = false;
83
83
  let i;
@@ -100,14 +100,14 @@ function readTagExp(parser) {
100
100
  if(inSingleQuotes || inDoubleQuotes){
101
101
  throw new Error("Invalid attribute expression. Quote is not properly closed");
102
102
  }else if(!EOE) throw new Error("Unexpected closing of source. Waiting for '>'");
103
-
104
-
103
+
104
+
105
105
  const exp = parser.source.readStr(i);
106
106
  parser.source.updateBufferBoundary(i + 1);
107
107
  return buildTagExpObj(exp, parser)
108
108
  }
109
109
 
110
- function readPiExp(parser) {
110
+ export function readPiExp(parser) {
111
111
  let inSingleQuotes = false;
112
112
  let inDoubleQuotes = false;
113
113
  let i;
@@ -133,7 +133,7 @@ function readPiExp(parser) {
133
133
  if(inSingleQuotes || inDoubleQuotes){
134
134
  throw new Error("Invalid attribute expression. Quote is not properly closed in PI tag expression");
135
135
  }else if(!EOE) throw new Error("Unexpected closing of source. Waiting for '?>'");
136
-
136
+
137
137
  if(!parser.options.attributes.ignore){
138
138
  //TODO: use regex to verify attributes if not set to ignore
139
139
  }
@@ -150,7 +150,11 @@ function buildTagExpObj(exp, parser){
150
150
  };
151
151
  let attrsExp = "";
152
152
 
153
- if(exp[exp.length -1] === "/") tagExp.selfClosing = true;
153
+ // Check for self-closing tag before setting the name
154
+ if(exp[exp.length -1] === "/") {
155
+ tagExp.selfClosing = true;
156
+ exp = exp.slice(0, -1); // Remove the trailing slash
157
+ }
154
158
 
155
159
  //separate tag name
156
160
  let i = 0;
@@ -182,7 +186,7 @@ function parseAttributesExp(attrStr, parser) {
182
186
  for (let i = 0; i < len; i++) {
183
187
  let attrName = parser.processAttrName(matches[i][1]);
184
188
  let attrVal = parser.replaceEntities(matches[i][4] || true);
185
-
189
+
186
190
  parser.outputBuilder.addAttribute(attrName, attrVal);
187
191
  }
188
192
  }
@@ -204,9 +208,3 @@ const getAllMatches = function(string, regex) {
204
208
  return matches;
205
209
  };
206
210
 
207
- module.exports = {
208
- readStopNode: readStopNode,
209
- readClosingTagName: readClosingTagName,
210
- readTagExp: readTagExp,
211
- readPiExp: readPiExp,
212
- }
@@ -1,6 +1,6 @@
1
- const {readPiExp} = require("./XmlPartReader");
1
+ import {readPiExp} from './XmlPartReader.js';
2
2
 
3
- function readCdata(parser){
3
+ export function readCdata(parser){
4
4
  //<![ are already read till this point
5
5
  let str = parser.source.readStr(6); //CDATA[
6
6
  parser.source.updateBufferBoundary(6);
@@ -10,7 +10,7 @@ function readCdata(parser){
10
10
  let text = parser.source.readUpto("]]>");
11
11
  parser.outputBuilder.addCdata(text);
12
12
  }
13
- function readPiTag(parser){
13
+ export function readPiTag(parser){
14
14
  //<? are already read till this point
15
15
  let tagExp = readPiExp(parser, "?>");
16
16
  if(!tagExp) throw new Error("Invalid Pi Tag expression.");
@@ -22,7 +22,7 @@ function readPiTag(parser){
22
22
  }
23
23
  }
24
24
 
25
- function readComment(parser){
25
+ export function readComment(parser){
26
26
  //<!- are already read till this point
27
27
  let ch = parser.source.readCh();
28
28
  if(ch !== "-") throw new Error(`Invalid comment expression at ${parser.source.line}:${parser.source.cols}`);
@@ -36,7 +36,7 @@ const DOCTYPE_tags = {
36
36
  "AT":/^TLIST\s+[^\s]+\s+[^\s]+\s+[^\s]+\s+[^\s]+\s+$/m,
37
37
  "NO":/^TATION.+$/m
38
38
  }
39
- function readDocType(parser){
39
+ export function readDocType(parser){
40
40
  //<!D are already read till this point
41
41
  let str = parser.source.readStr(6); //OCTYPE
42
42
  parser.source.updateBufferBoundary(6);
@@ -109,10 +109,3 @@ function registerEntity(parser){
109
109
  }
110
110
  }
111
111
  }
112
-
113
- module.exports = {
114
- readCdata: readCdata,
115
- readComment:readComment,
116
- readDocType:readDocType,
117
- readPiTag:readPiTag
118
- }
@@ -2,7 +2,7 @@ const Constants = {
2
2
  space: 32,
3
3
  tab: 9
4
4
  }
5
- class BufferSource{
5
+ export default class BufferSource{
6
6
  constructor(bytesArr){
7
7
  this.line = 1;
8
8
  this.cols = 0;
@@ -114,5 +114,3 @@ readUptoCloseTag(stopStr) { //stopStr: "</tagname"
114
114
  }
115
115
 
116
116
  }
117
-
118
- module.exports = BufferSource;
@@ -1,7 +1,7 @@
1
1
  const whiteSpaces = [" ", "\n", "\t"];
2
2
 
3
3
 
4
- class StringSource{
4
+ export default class StringSource{
5
5
  constructor(str){
6
6
  this.line = 1;
7
7
  this.cols = 0;
@@ -119,5 +119,3 @@ class StringSource{
119
119
  }
120
120
 
121
121
  }
122
-
123
- module.exports = StringSource;
@@ -13,11 +13,11 @@ const htmlEntities = {
13
13
  "copyright" : { regex: /&(copy|#169);/g, val: "©" },
14
14
  "reg" : { regex: /&(reg|#174);/g, val: "®" },
15
15
  "inr" : { regex: /&(inr|#8377);/g, val: "₹" },
16
- "num_dec": { regex: /&#([0-9]{1,7});/g, val : (_, str) => String.fromCharCode(Number.parseInt(str, 10)) },
17
- "num_hex": { regex: /&#x([0-9a-fA-F]{1,6});/g, val : (_, str) => String.fromCharCode(Number.parseInt(str, 16)) },
16
+ "num_dec": { regex: /&#([0-9]{1,7});/g, val : (_, str) => String.fromCodePoint(Number.parseInt(str, 10)) },
17
+ "num_hex": { regex: /&#x([0-9a-fA-F]{1,6});/g, val : (_, str) => String.fromCodePoint(Number.parseInt(str, 16)) },
18
18
  };
19
19
 
20
- class EntitiesParser{
20
+ export default class EntitiesParser{
21
21
  constructor(replaceHtmlEntities) {
22
22
  this.replaceHtmlEntities = replaceHtmlEntities;
23
23
  this.docTypeEntities = {};
@@ -103,5 +103,3 @@ function validateEntityName(name){
103
103
  }
104
104
  return name;
105
105
  }
106
-
107
- module.exports = EntitiesParser;
@@ -1,4 +1,4 @@
1
- class boolParser{
1
+ export default class boolParser{
2
2
  constructor(trueList, falseList){
3
3
  if(trueList)
4
4
  this.trueList = trueList;
@@ -20,4 +20,3 @@ class boolParser{
20
20
  return val;
21
21
  }
22
22
  }
23
- module.exports = boolParser;
@@ -1,4 +1,4 @@
1
- function boolParserExt(val){
1
+ export default function boolParserExt(val){
2
2
  if(isArray(val)){
3
3
  for (let i = 0; i < val.length; i++) {
4
4
  val[i] = parse(val[i])
@@ -17,4 +17,3 @@ function parse(val){
17
17
  }
18
18
  return val;
19
19
  }
20
- module.exports = boolParserExt;
@@ -16,7 +16,7 @@ const symbol = "(?:\$|€|¥|₹)?";
16
16
 
17
17
  const currencyCheckRegex = /^\s*(?:-|\+)?(?:\d+|\d{1,3}(?:,\d{3})+)?(?:\.\d{1,2})?\s*(?:\$|€|¥|₹)?\s*$/u;
18
18
 
19
- class CurrencyParser{
19
+ export default class CurrencyParser{
20
20
  constructor(options){
21
21
  this.options = options || defaultOptions;
22
22
  }
@@ -36,5 +36,3 @@ class CurrencyParser{
36
36
  }
37
37
  }
38
38
  CurrencyParser.defaultOptions = defaultOptions;
39
-
40
- module.exports = CurrencyParser;
@@ -4,11 +4,10 @@
4
4
  * @param {string} by
5
5
  * @returns
6
6
  */
7
- function join(val, by=" "){
7
+ export default function join(val, by=" "){
8
8
  if(isArray(val)){
9
9
  val.join(by)
10
10
  }
11
11
  return val;
12
12
  }
13
13
 
14
- module.exports = join;
@@ -1,7 +1,7 @@
1
- const toNumber = require("strnum");
1
+ import toNumber from "strnum";
2
2
 
3
3
 
4
- class numParser{
4
+ export default class numParser{
5
5
  constructor(options){
6
6
  this.options = options;
7
7
  }
@@ -12,5 +12,3 @@ class numParser{
12
12
  return val;
13
13
  }
14
14
  }
15
-
16
- module.exports = numParser;
@@ -1,8 +1,6 @@
1
- class trimmer{
1
+ export default class trimmer{
2
2
  parse(val){
3
3
  if(typeof val === "string") return val.trim();
4
4
  else return val;
5
5
  }
6
6
  }
7
-
8
- module.exports = trimmer;
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- const util = require('./util');
3
+ import {getAllMatches, isName} from './util.js';
4
4
 
5
5
  const defaultOptions = {
6
6
  allowBooleanAttributes: false, //A tag can have attributes without any value
@@ -8,7 +8,7 @@ const defaultOptions = {
8
8
  };
9
9
 
10
10
  //const tagsPattern = new RegExp("<\\/?([\\w:\\-_\.]+)\\s*\/?>","g");
11
- exports.validate = function (xmlData, options) {
11
+ export function validate(xmlData, options) {
12
12
  options = Object.assign({}, defaultOptions, options);
13
13
 
14
14
  //xmlData = xmlData.replace(/(\r\n|\n|\r)/gm,"");//make it single line
@@ -321,7 +321,7 @@ function validateAttributeString(attrStr, options) {
321
321
 
322
322
  //if(attrStr.trim().length === 0) return true; //empty string
323
323
 
324
- const matches = util.getAllMatches(attrStr, validAttrStrRegxp);
324
+ const matches = getAllMatches(attrStr, validAttrStrRegxp);
325
325
  const attrNames = {};
326
326
 
327
327
  for (let i = 0; i < matches.length; i++) {
@@ -399,13 +399,13 @@ function getErrorObject(code, message, lineNumber) {
399
399
  }
400
400
 
401
401
  function validateAttrName(attrName) {
402
- return util.isName(attrName);
402
+ return isName(attrName);
403
403
  }
404
404
 
405
405
  // const startsWithXML = /^xml/i;
406
406
 
407
407
  function validateTagName(tagname) {
408
- return util.isName(tagname) /* && !tagname.match(startsWithXML) */;
408
+ return isName(tagname) /* && !tagname.match(startsWithXML) */;
409
409
  }
410
410
 
411
411
  //this function returns the line number for the character at the given index
@@ -1,6 +1,7 @@
1
1
  'use strict';
2
2
  //parse Empty Node as self closing node
3
- const buildFromOrderedJs = require('./orderedJs2Xml');
3
+ import buildFromOrderedJs from './orderedJs2Xml.js';
4
+ import getIgnoreAttributesFn from "../ignoreAttributes.js";
4
5
 
5
6
  const defaultOptions = {
6
7
  attributeNamePrefix: '@_',
@@ -36,13 +37,14 @@ const defaultOptions = {
36
37
  oneListGroup: false
37
38
  };
38
39
 
39
- function Builder(options) {
40
+ export default function Builder(options) {
40
41
  this.options = Object.assign({}, defaultOptions, options);
41
- if (this.options.ignoreAttributes || this.options.attributesGroupName) {
42
+ if (this.options.ignoreAttributes === true || this.options.attributesGroupName) {
42
43
  this.isAttribute = function(/*a*/) {
43
44
  return false;
44
45
  };
45
46
  } else {
47
+ this.ignoreAttributesFn = getIgnoreAttributesFn(this.options.ignoreAttributes)
46
48
  this.attrPrefixLen = this.options.attributeNamePrefix.length;
47
49
  this.isAttribute = isAttribute;
48
50
  }
@@ -71,13 +73,14 @@ Builder.prototype.build = function(jObj) {
71
73
  [this.options.arrayNodeName] : jObj
72
74
  }
73
75
  }
74
- return this.j2x(jObj, 0).val;
76
+ return this.j2x(jObj, 0, []).val;
75
77
  }
76
78
  };
77
79
 
78
- Builder.prototype.j2x = function(jObj, level) {
80
+ Builder.prototype.j2x = function(jObj, level, ajPath) {
79
81
  let attrStr = '';
80
82
  let val = '';
83
+ const jPath = ajPath.join('.')
81
84
  for (let key in jObj) {
82
85
  if(!Object.prototype.hasOwnProperty.call(jObj, key)) continue;
83
86
  if (typeof jObj[key] === 'undefined') {
@@ -89,6 +92,8 @@ Builder.prototype.j2x = function(jObj, level) {
89
92
  // null attribute should be ignored by the attribute list, but should not cause the tag closing
90
93
  if (this.isAttribute(key)) {
91
94
  val += '';
95
+ } else if (key === this.options.cdataPropName) {
96
+ val += '';
92
97
  } else if (key[0] === '?') {
93
98
  val += this.indentate(level) + '<' + key + '?' + this.tagEndChar;
94
99
  } else {
@@ -100,9 +105,9 @@ Builder.prototype.j2x = function(jObj, level) {
100
105
  } else if (typeof jObj[key] !== 'object') {
101
106
  //premitive type
102
107
  const attr = this.isAttribute(key);
103
- if (attr) {
108
+ if (attr && !this.ignoreAttributesFn(attr, jPath)) {
104
109
  attrStr += this.buildAttrPairStr(attr, '' + jObj[key]);
105
- }else {
110
+ } else if (!attr) {
106
111
  //tag value
107
112
  if (key === this.options.textNodeName) {
108
113
  let newval = this.options.tagValueProcessor(key, '' + jObj[key]);
@@ -126,13 +131,13 @@ Builder.prototype.j2x = function(jObj, level) {
126
131
  // val += this.indentate(level) + '<' + key + '/' + this.tagEndChar;
127
132
  } else if (typeof item === 'object') {
128
133
  if(this.options.oneListGroup){
129
- const result = this.j2x(item, level + 1);
134
+ const result = this.j2x(item, level + 1, ajPath.concat(key));
130
135
  listTagVal += result.val;
131
136
  if (this.options.attributesGroupName && item.hasOwnProperty(this.options.attributesGroupName)) {
132
137
  listTagAttr += result.attrStr
133
138
  }
134
139
  }else{
135
- listTagVal += this.processTextOrObjNode(item, key, level)
140
+ listTagVal += this.processTextOrObjNode(item, key, level, ajPath)
136
141
  }
137
142
  } else {
138
143
  if (this.options.oneListGroup) {
@@ -157,7 +162,7 @@ Builder.prototype.j2x = function(jObj, level) {
157
162
  attrStr += this.buildAttrPairStr(Ks[j], '' + jObj[key][Ks[j]]);
158
163
  }
159
164
  } else {
160
- val += this.processTextOrObjNode(jObj[key], key, level)
165
+ val += this.processTextOrObjNode(jObj[key], key, level, ajPath)
161
166
  }
162
167
  }
163
168
  }
@@ -172,8 +177,8 @@ Builder.prototype.buildAttrPairStr = function(attrName, val){
172
177
  } else return ' ' + attrName + '="' + val + '"';
173
178
  }
174
179
 
175
- function processTextOrObjNode (object, key, level) {
176
- const result = this.j2x(object, level + 1);
180
+ function processTextOrObjNode (object, key, level, ajPath) {
181
+ const result = this.j2x(object, level + 1, ajPath.concat(key));
177
182
  if (object[this.options.textNodeName] !== undefined && Object.keys(object).length === 1) {
178
183
  return this.buildTextValNode(object[this.options.textNodeName], key, result.attrStr, level);
179
184
  } else {
@@ -278,4 +283,3 @@ function isAttribute(name /*, options*/) {
278
283
  }
279
284
  }
280
285
 
281
- module.exports = Builder;
@@ -6,7 +6,7 @@ const EOL = "\n";
6
6
  * @param {any} options
7
7
  * @returns
8
8
  */
9
- function toXml(jArray, options) {
9
+ export default function toXml(jArray, options) {
10
10
  let indentation = "";
11
11
  if (options.format && options.indentBy.length > 0) {
12
12
  indentation = EOL;
@@ -132,4 +132,3 @@ function replaceEntitiesValue(textValue, options) {
132
132
  }
133
133
  return textValue;
134
134
  }
135
- module.exports = toXml;