node-red-contrib-tak-registration 0.7.2 → 0.8.3

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 (102) hide show
  1. package/README.md +3 -1
  2. package/node_modules/@types/node/README.md +1 -1
  3. package/node_modules/@types/node/child_process.d.ts +5 -0
  4. package/node_modules/@types/node/dgram.d.ts +5 -0
  5. package/node_modules/@types/node/events.d.ts +35 -0
  6. package/node_modules/@types/node/fs/promises.d.ts +5 -0
  7. package/node_modules/@types/node/fs.d.ts +43 -5
  8. package/node_modules/@types/node/globals.d.ts +22 -0
  9. package/node_modules/@types/node/index.d.ts +1 -1
  10. package/node_modules/@types/node/inspector.d.ts +1 -1
  11. package/node_modules/@types/node/module.d.ts +103 -0
  12. package/node_modules/@types/node/net.d.ts +5 -0
  13. package/node_modules/@types/node/package.json +2 -2
  14. package/node_modules/@types/node/stream.d.ts +143 -0
  15. package/node_modules/@types/node/test.d.ts +33 -4
  16. package/node_modules/@types/node/timers.d.ts +12 -2
  17. package/node_modules/@types/node/ts4.8/child_process.d.ts +5 -0
  18. package/node_modules/@types/node/ts4.8/dgram.d.ts +5 -0
  19. package/node_modules/@types/node/ts4.8/events.d.ts +35 -0
  20. package/node_modules/@types/node/ts4.8/fs/promises.d.ts +5 -0
  21. package/node_modules/@types/node/ts4.8/fs.d.ts +43 -5
  22. package/node_modules/@types/node/ts4.8/globals.d.ts +22 -0
  23. package/node_modules/@types/node/ts4.8/inspector.d.ts +1 -1
  24. package/node_modules/@types/node/ts4.8/module.d.ts +103 -0
  25. package/node_modules/@types/node/ts4.8/net.d.ts +5 -0
  26. package/node_modules/@types/node/ts4.8/stream.d.ts +762 -728
  27. package/node_modules/@types/node/ts4.8/test.d.ts +97 -50
  28. package/node_modules/@types/node/ts4.8/timers.d.ts +12 -2
  29. package/node_modules/@types/node/ts4.8/vm.d.ts +2 -1
  30. package/node_modules/@types/node/vm.d.ts +2 -1
  31. package/node_modules/axios/CHANGELOG.md +23 -0
  32. package/node_modules/axios/README.md +33 -5
  33. package/node_modules/axios/dist/axios.js +26 -18
  34. package/node_modules/axios/dist/axios.js.map +1 -1
  35. package/node_modules/axios/dist/axios.min.js +1 -1
  36. package/node_modules/axios/dist/axios.min.js.map +1 -1
  37. package/node_modules/axios/dist/browser/axios.cjs +24 -20
  38. package/node_modules/axios/dist/browser/axios.cjs.map +1 -1
  39. package/node_modules/axios/dist/esm/axios.js +26 -21
  40. package/node_modules/axios/dist/esm/axios.js.map +1 -1
  41. package/node_modules/axios/dist/esm/axios.min.js +1 -1
  42. package/node_modules/axios/dist/esm/axios.min.js.map +1 -1
  43. package/node_modules/axios/dist/node/axios.cjs +27 -21
  44. package/node_modules/axios/dist/node/axios.cjs.map +1 -1
  45. package/node_modules/axios/index.d.cts +1 -0
  46. package/node_modules/axios/index.d.ts +3 -0
  47. package/node_modules/axios/index.js +2 -0
  48. package/node_modules/axios/lib/adapters/http.js +3 -1
  49. package/node_modules/axios/lib/axios.js +3 -0
  50. package/node_modules/axios/lib/core/Axios.js +2 -4
  51. package/node_modules/axios/lib/core/AxiosHeaders.js +11 -1
  52. package/node_modules/axios/lib/defaults/index.js +4 -11
  53. package/node_modules/axios/lib/env/data.js +1 -1
  54. package/node_modules/axios/lib/utils.js +3 -2
  55. package/node_modules/axios/package.json +3 -1
  56. package/node_modules/fast-xml-parser/CHANGELOG.md +561 -0
  57. package/node_modules/fast-xml-parser/README.md +134 -287
  58. package/node_modules/fast-xml-parser/package.json +17 -40
  59. package/node_modules/fast-xml-parser/{cli.js → src/cli/cli.js} +16 -24
  60. package/node_modules/fast-xml-parser/src/cli/man.js +12 -0
  61. package/node_modules/fast-xml-parser/src/fxp.d.ts +108 -0
  62. package/node_modules/fast-xml-parser/src/fxp.js +11 -0
  63. package/node_modules/fast-xml-parser/src/util.js +0 -36
  64. package/node_modules/fast-xml-parser/src/validator.js +15 -5
  65. package/node_modules/fast-xml-parser/src/xmlbuilder/json2xml.js +269 -0
  66. package/node_modules/fast-xml-parser/src/xmlbuilder/orderedJs2Xml.js +131 -0
  67. package/node_modules/fast-xml-parser/src/xmlbuilder/prettifyJs2Xml.js +0 -0
  68. package/node_modules/fast-xml-parser/src/xmlparser/DocTypeReader.js +152 -0
  69. package/node_modules/fast-xml-parser/src/xmlparser/OptionsBuilder.js +48 -0
  70. package/node_modules/fast-xml-parser/src/xmlparser/OrderedObjParser.js +589 -0
  71. package/node_modules/fast-xml-parser/src/xmlparser/XMLParser.js +58 -0
  72. package/node_modules/fast-xml-parser/src/xmlparser/node2json.js +113 -0
  73. package/node_modules/fast-xml-parser/src/xmlparser/xmlNode.js +25 -0
  74. package/node_modules/protobufjs/dist/light/protobuf.js +24 -13
  75. package/node_modules/protobufjs/dist/light/protobuf.js.map +1 -1
  76. package/node_modules/protobufjs/dist/light/protobuf.min.js +3 -3
  77. package/node_modules/protobufjs/dist/light/protobuf.min.js.map +1 -1
  78. package/node_modules/protobufjs/dist/minimal/protobuf.js +12 -7
  79. package/node_modules/protobufjs/dist/minimal/protobuf.js.map +1 -1
  80. package/node_modules/protobufjs/dist/minimal/protobuf.min.js +3 -3
  81. package/node_modules/protobufjs/dist/minimal/protobuf.min.js.map +1 -1
  82. package/node_modules/protobufjs/dist/protobuf.js +40 -18
  83. package/node_modules/protobufjs/dist/protobuf.js.map +1 -1
  84. package/node_modules/protobufjs/dist/protobuf.min.js +3 -3
  85. package/node_modules/protobufjs/dist/protobuf.min.js.map +1 -1
  86. package/node_modules/protobufjs/package.json +1 -1
  87. package/node_modules/protobufjs/src/converter.js +2 -2
  88. package/node_modules/protobufjs/src/parse.js +4 -1
  89. package/node_modules/protobufjs/src/reader.js +8 -3
  90. package/node_modules/protobufjs/src/tokenize.js +2 -4
  91. package/package.json +4 -4
  92. package/tak-ingest.js +4 -3
  93. package/tak-registration.js +14 -5
  94. package/node_modules/fast-xml-parser/src/json2xml.js +0 -280
  95. package/node_modules/fast-xml-parser/src/nimndata.js +0 -144
  96. package/node_modules/fast-xml-parser/src/node2json.js +0 -42
  97. package/node_modules/fast-xml-parser/src/node2json_str.js +0 -63
  98. package/node_modules/fast-xml-parser/src/parser.d.ts +0 -79
  99. package/node_modules/fast-xml-parser/src/parser.js +0 -76
  100. package/node_modules/fast-xml-parser/src/xmlNode.js +0 -17
  101. package/node_modules/fast-xml-parser/src/xmlstr2xmlnode.js +0 -339
  102. /package/node_modules/fast-xml-parser/src/{read.js → cli/read.js} +0 -0
@@ -0,0 +1,131 @@
1
+ const EOL = "\n";
2
+
3
+ /**
4
+ *
5
+ * @param {array} jArray
6
+ * @param {any} options
7
+ * @returns
8
+ */
9
+ function toXml(jArray, options) {
10
+ let indentation = "";
11
+ if (options.format && options.indentBy.length > 0) {
12
+ indentation = EOL;
13
+ }
14
+ return arrToStr(jArray, options, "", indentation);
15
+ }
16
+
17
+ function arrToStr(arr, options, jPath, indentation) {
18
+ let xmlStr = "";
19
+ let isPreviousElementTag = false;
20
+
21
+ for (let i = 0; i < arr.length; i++) {
22
+ const tagObj = arr[i];
23
+ const tagName = propName(tagObj);
24
+ let newJPath = "";
25
+ if (jPath.length === 0) newJPath = tagName
26
+ else newJPath = `${jPath}.${tagName}`;
27
+
28
+ if (tagName === options.textNodeName) {
29
+ let tagText = tagObj[tagName];
30
+ if (!isStopNode(newJPath, options)) {
31
+ tagText = options.tagValueProcessor(tagName, tagText);
32
+ tagText = replaceEntitiesValue(tagText, options);
33
+ }
34
+ if (isPreviousElementTag) {
35
+ xmlStr += indentation;
36
+ }
37
+ xmlStr += tagText;
38
+ isPreviousElementTag = false;
39
+ continue;
40
+ } else if (tagName === options.cdataPropName) {
41
+ if (isPreviousElementTag) {
42
+ xmlStr += indentation;
43
+ }
44
+ xmlStr += `<![CDATA[${tagObj[tagName][0][options.textNodeName]}]]>`;
45
+ isPreviousElementTag = false;
46
+ continue;
47
+ } else if (tagName === options.commentPropName) {
48
+ xmlStr += indentation + `<!--${tagObj[tagName][0][options.textNodeName]}-->`;
49
+ isPreviousElementTag = true;
50
+ continue;
51
+ } else if (tagName[0] === "?") {
52
+ const attStr = attr_to_str(tagObj[":@"], options);
53
+ const tempInd = tagName === "?xml" ? "" : indentation;
54
+ let piTextNodeName = tagObj[tagName][0][options.textNodeName];
55
+ piTextNodeName = piTextNodeName.length !== 0 ? " " + piTextNodeName : ""; //remove extra spacing
56
+ xmlStr += tempInd + `<${tagName}${piTextNodeName}${attStr}?>`;
57
+ isPreviousElementTag = true;
58
+ continue;
59
+ }
60
+ let newIdentation = indentation;
61
+ if (newIdentation !== "") {
62
+ newIdentation += options.indentBy;
63
+ }
64
+ const attStr = attr_to_str(tagObj[":@"], options);
65
+ const tagStart = indentation + `<${tagName}${attStr}`;
66
+ const tagValue = arrToStr(tagObj[tagName], options, newJPath, newIdentation);
67
+ if (options.unpairedTags.indexOf(tagName) !== -1) {
68
+ if (options.suppressUnpairedNode) xmlStr += tagStart + ">";
69
+ else xmlStr += tagStart + "/>";
70
+ } else if ((!tagValue || tagValue.length === 0) && options.suppressEmptyNode) {
71
+ xmlStr += tagStart + "/>";
72
+ } else if (tagValue && tagValue.endsWith(">")) {
73
+ xmlStr += tagStart + `>${tagValue}${indentation}</${tagName}>`;
74
+ } else {
75
+ xmlStr += tagStart + ">";
76
+ if (tagValue && indentation !== "" && (tagValue.includes("/>") || tagValue.includes("</"))) {
77
+ xmlStr += indentation + options.indentBy + tagValue + indentation;
78
+ } else {
79
+ xmlStr += tagValue;
80
+ }
81
+ xmlStr += `</${tagName}>`;
82
+ }
83
+ isPreviousElementTag = true;
84
+ }
85
+
86
+ return xmlStr;
87
+ }
88
+
89
+ function propName(obj) {
90
+ const keys = Object.keys(obj);
91
+ for (let i = 0; i < keys.length; i++) {
92
+ const key = keys[i];
93
+ if (key !== ":@") return key;
94
+ }
95
+ }
96
+
97
+ function attr_to_str(attrMap, options) {
98
+ let attrStr = "";
99
+ if (attrMap && !options.ignoreAttributes) {
100
+ for (let attr in attrMap) {
101
+ let attrVal = options.attributeValueProcessor(attr, attrMap[attr]);
102
+ attrVal = replaceEntitiesValue(attrVal, options);
103
+ if (attrVal === true && options.suppressBooleanAttributes) {
104
+ attrStr += ` ${attr.substr(options.attributeNamePrefix.length)}`;
105
+ } else {
106
+ attrStr += ` ${attr.substr(options.attributeNamePrefix.length)}="${attrVal}"`;
107
+ }
108
+ }
109
+ }
110
+ return attrStr;
111
+ }
112
+
113
+ function isStopNode(jPath, options) {
114
+ jPath = jPath.substr(0, jPath.length - options.textNodeName.length - 1);
115
+ let tagName = jPath.substr(jPath.lastIndexOf(".") + 1);
116
+ for (let index in options.stopNodes) {
117
+ if (options.stopNodes[index] === jPath || options.stopNodes[index] === "*." + tagName) return true;
118
+ }
119
+ return false;
120
+ }
121
+
122
+ function replaceEntitiesValue(textValue, options) {
123
+ if (textValue && textValue.length > 0 && options.processEntities) {
124
+ for (let i = 0; i < options.entities.length; i++) {
125
+ const entity = options.entities[i];
126
+ textValue = textValue.replace(entity.regex, entity.val);
127
+ }
128
+ }
129
+ return textValue;
130
+ }
131
+ module.exports = toXml;
@@ -0,0 +1,152 @@
1
+ const util = require('../util');
2
+
3
+ //TODO: handle comments
4
+ function readDocType(xmlData, i){
5
+
6
+ const entities = {};
7
+ if( xmlData[i + 3] === 'O' &&
8
+ xmlData[i + 4] === 'C' &&
9
+ xmlData[i + 5] === 'T' &&
10
+ xmlData[i + 6] === 'Y' &&
11
+ xmlData[i + 7] === 'P' &&
12
+ xmlData[i + 8] === 'E')
13
+ {
14
+ i = i+9;
15
+ let angleBracketsCount = 1;
16
+ let hasBody = false, comment = false;
17
+ let exp = "";
18
+ for(;i<xmlData.length;i++){
19
+ if (xmlData[i] === '<' && !comment) { //Determine the tag type
20
+ if( hasBody && isEntity(xmlData, i)){
21
+ i += 7;
22
+ [entityName, val,i] = readEntityExp(xmlData,i+1);
23
+ if(val.indexOf("&") === -1) //Parameter entities are not supported
24
+ entities[ validateEntityName(entityName) ] = {
25
+ regx : RegExp( `&${entityName};`,"g"),
26
+ val: val
27
+ };
28
+ }
29
+ else if( hasBody && isElement(xmlData, i)) i += 8;//Not supported
30
+ else if( hasBody && isAttlist(xmlData, i)) i += 8;//Not supported
31
+ else if( hasBody && isNotation(xmlData, i)) i += 9;//Not supported
32
+ else if( isComment) comment = true;
33
+ else throw new Error("Invalid DOCTYPE");
34
+
35
+ angleBracketsCount++;
36
+ exp = "";
37
+ } else if (xmlData[i] === '>') { //Read tag content
38
+ if(comment){
39
+ if( xmlData[i - 1] === "-" && xmlData[i - 2] === "-"){
40
+ comment = false;
41
+ angleBracketsCount--;
42
+ }
43
+ }else{
44
+ angleBracketsCount--;
45
+ }
46
+ if (angleBracketsCount === 0) {
47
+ break;
48
+ }
49
+ }else if( xmlData[i] === '['){
50
+ hasBody = true;
51
+ }else{
52
+ exp += xmlData[i];
53
+ }
54
+ }
55
+ if(angleBracketsCount !== 0){
56
+ throw new Error(`Unclosed DOCTYPE`);
57
+ }
58
+ }else{
59
+ throw new Error(`Invalid Tag instead of DOCTYPE`);
60
+ }
61
+ return {entities, i};
62
+ }
63
+
64
+ function readEntityExp(xmlData,i){
65
+ //External entities are not supported
66
+ // <!ENTITY ext SYSTEM "http://normal-website.com" >
67
+
68
+ //Parameter entities are not supported
69
+ // <!ENTITY entityname "&anotherElement;">
70
+
71
+ //Internal entities are supported
72
+ // <!ENTITY entityname "replacement text">
73
+
74
+ //read EntityName
75
+ let entityName = "";
76
+ for (; i < xmlData.length && (xmlData[i] !== "'" && xmlData[i] !== '"' ); i++) {
77
+ // if(xmlData[i] === " ") continue;
78
+ // else
79
+ entityName += xmlData[i];
80
+ }
81
+ entityName = entityName.trim();
82
+ if(entityName.indexOf(" ") !== -1) throw new Error("External entites are not supported");
83
+
84
+ //read Entity Value
85
+ const startChar = xmlData[i++];
86
+ let val = ""
87
+ for (; i < xmlData.length && xmlData[i] !== startChar ; i++) {
88
+ val += xmlData[i];
89
+ }
90
+ return [entityName, val, i];
91
+ }
92
+
93
+ function isComment(xmlData, i){
94
+ if(xmlData[i+1] === '!' &&
95
+ xmlData[i+2] === '-' &&
96
+ xmlData[i+3] === '-') return true
97
+ return false
98
+ }
99
+ function isEntity(xmlData, i){
100
+ if(xmlData[i+1] === '!' &&
101
+ xmlData[i+2] === 'E' &&
102
+ xmlData[i+3] === 'N' &&
103
+ xmlData[i+4] === 'T' &&
104
+ xmlData[i+5] === 'I' &&
105
+ xmlData[i+6] === 'T' &&
106
+ xmlData[i+7] === 'Y') return true
107
+ return false
108
+ }
109
+ function isElement(xmlData, i){
110
+ if(xmlData[i+1] === '!' &&
111
+ xmlData[i+2] === 'E' &&
112
+ xmlData[i+3] === 'L' &&
113
+ xmlData[i+4] === 'E' &&
114
+ xmlData[i+5] === 'M' &&
115
+ xmlData[i+6] === 'E' &&
116
+ xmlData[i+7] === 'N' &&
117
+ xmlData[i+8] === 'T') return true
118
+ return false
119
+ }
120
+
121
+ function isAttlist(xmlData, i){
122
+ if(xmlData[i+1] === '!' &&
123
+ xmlData[i+2] === 'A' &&
124
+ xmlData[i+3] === 'T' &&
125
+ xmlData[i+4] === 'T' &&
126
+ xmlData[i+5] === 'L' &&
127
+ xmlData[i+6] === 'I' &&
128
+ xmlData[i+7] === 'S' &&
129
+ xmlData[i+8] === 'T') return true
130
+ return false
131
+ }
132
+ function isNotation(xmlData, i){
133
+ if(xmlData[i+1] === '!' &&
134
+ xmlData[i+2] === 'N' &&
135
+ xmlData[i+3] === 'O' &&
136
+ xmlData[i+4] === 'T' &&
137
+ xmlData[i+5] === 'A' &&
138
+ xmlData[i+6] === 'T' &&
139
+ xmlData[i+7] === 'I' &&
140
+ xmlData[i+8] === 'O' &&
141
+ xmlData[i+9] === 'N') return true
142
+ return false
143
+ }
144
+
145
+ function validateEntityName(name){
146
+ if (util.isName(name))
147
+ return name;
148
+ else
149
+ throw new Error(`Invalid entity name ${name}`);
150
+ }
151
+
152
+ module.exports = readDocType;
@@ -0,0 +1,48 @@
1
+
2
+ const defaultOptions = {
3
+ preserveOrder: false,
4
+ attributeNamePrefix: '@_',
5
+ attributesGroupName: false,
6
+ textNodeName: '#text',
7
+ ignoreAttributes: true,
8
+ removeNSPrefix: false, // remove NS from tag name or attribute name if true
9
+ allowBooleanAttributes: false, //a tag can have attributes without any value
10
+ //ignoreRootElement : false,
11
+ parseTagValue: true,
12
+ parseAttributeValue: false,
13
+ trimValues: true, //Trim string values of tag and attributes
14
+ cdataPropName: false,
15
+ numberParseOptions: {
16
+ hex: true,
17
+ leadingZeros: true,
18
+ eNotation: true
19
+ },
20
+ tagValueProcessor: function(tagName, val) {
21
+ return val;
22
+ },
23
+ attributeValueProcessor: function(attrName, val) {
24
+ return val;
25
+ },
26
+ stopNodes: [], //nested tags will not be parsed even for errors
27
+ alwaysCreateTextNode: false,
28
+ isArray: () => false,
29
+ commentPropName: false,
30
+ unpairedTags: [],
31
+ processEntities: true,
32
+ htmlEntities: false,
33
+ ignoreDeclaration: false,
34
+ ignorePiTags: false,
35
+ transformTagName: false,
36
+ transformAttributeName: false,
37
+ updateTag: function(tagName, jPath, attrs){
38
+ return tagName
39
+ },
40
+ // skipEmptyListItem: false
41
+ };
42
+
43
+ const buildOptions = function(options) {
44
+ return Object.assign({}, defaultOptions, options);
45
+ };
46
+
47
+ exports.buildOptions = buildOptions;
48
+ exports.defaultOptions = defaultOptions;