dbgate-plugin-xml 5.5.7-alpha.28 → 5.5.7-alpha.32

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 (2) hide show
  1. package/dist/backend.js +1 -1
  2. package/package.json +4 -2
package/dist/backend.js CHANGED
@@ -1 +1 @@
1
- (()=>{var t={814:(t,e,s)=>{"use strict";var n,i=(n=s(567))&&n.__esModule?n:{default:n};t.exports=i.default},567:(t,e,s)=>{"use strict";var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};Object.defineProperty(e,"__esModule",{value:!0}),e.EVENTS=void 0;var i=function(){function t(t,e){for(var s=0;s<e.length;s++){var n=e[s];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,s,n){return s&&t(e.prototype,s),n&&t(e,n),e}}(),r=function(t){function e(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e);var t=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!==(void 0===e?"undefined":n(e))&&"function"!=typeof e?t:e}(this,(e.__proto__||Object.getPrototypeOf(e)).call(this));return t.state=o.TEXT,t.buffer="",t.pos=0,t.tagType=a.NONE,t}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+(void 0===e?"undefined":n(e)));t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,t),i(e,[{key:"_write",value:function(t,e,s){t="string"!=typeof t?t.toString():t;for(var n=0;n<t.length;n++){var i=t[n],r=this.buffer[this.pos-1];switch(this.buffer+=i,this.pos++,this.state){case o.TEXT:"<"===i&&this._onStartNewTag();break;case o.TAG_NAME:"<"===r&&"?"===i&&this._onStartInstruction(),"<"===r&&"/"===i&&this._onCloseTagStart(),"<"===this.buffer[this.pos-3]&&"!"===r&&"["===i&&this._onCDATAStart(),"<"===this.buffer[this.pos-3]&&"!"===r&&"-"===i&&this._onCommentStart(),">"===i&&("/"===r&&(this.tagType=a.SELF_CLOSING),this._onTagCompleted());break;case o.INSTRUCTION:"?"===r&&">"===i&&this._onEndInstruction();break;case o.CDATA:"]"===this.buffer[this.pos-3]&&"]"===r&&">"===i&&this._onCDATAEnd();break;case o.IGNORE_COMMENT:"-"===this.buffer[this.pos-3]&&"-"===r&&">"===i&&this._onCommentEnd()}}s()}},{key:"_endRecording",value:function(){var t=this.buffer.slice(1,this.pos-1);return this.buffer=this.buffer.slice(-1),this.pos=1,t}},{key:"_onStartNewTag",value:function(){var t=this._endRecording().trim();t&&this.emit(h.TEXT,t),this.state=o.TAG_NAME,this.tagType=a.OPENING}},{key:"_onTagCompleted",value:function(){var t=this._endRecording(),e=this._parseTagString(t),s=e.name,n=e.attributes;null===s&&this.emit(h.ERROR,new Error("Failed to parse name for tag"+t)),this.tagType&&this.tagType==a.OPENING&&this.emit(h.OPEN_TAG,s,n),this.tagType&&this.tagType===a.CLOSING&&this.emit(h.CLOSE_TAG,s,n),this.tagType&&this.tagType===a.SELF_CLOSING&&(0===Object.keys(n).length&&n.constructor===Object&&(n={___selfClosing___:!0}),this.emit(h.OPEN_TAG,s,n),this.emit(h.CLOSE_TAG,s,n)),this.state=o.TEXT,this.tagType=a.NONE}},{key:"_onCloseTagStart",value:function(){this._endRecording(),this.tagType=a.CLOSING}},{key:"_onStartInstruction",value:function(){this._endRecording(),this.state=o.INSTRUCTION}},{key:"_onEndInstruction",value:function(){this.pos-=1;var t=this._endRecording(),e=this._parseTagString(t),s=e.name,n=e.attributes;null===s&&this.emit(h.ERROR,new Error("Failed to parse name for inst"+t)),this.emit(h.INSTRUCTION,s,n),this.state=o.TEXT}},{key:"_onCDATAStart",value:function(){this._endRecording(),this.state=o.CDATA}},{key:"_onCDATAEnd",value:function(){var t=this._endRecording();t=t.slice(t.indexOf("[")+1,t.lastIndexOf("]>")-1),this.state=o.TEXT,this.emit(h.CDATA,t)}},{key:"_onCommentStart",value:function(){this.state=o.IGNORE_COMMENT}},{key:"_onCommentEnd",value:function(){this._endRecording(),this.state=o.TEXT}},{key:"_parseTagString",value:function(t){var e=void 0,s=/^([a-zäöüßÄÖÜA-Z0-9:_\-.\/]+?)(\s|$)/.exec(t);if(s&&s.length>0){e=s[1];for(var n=t.substr(e.length),i=/([a-zäöüßÄÖÜA-Z0-9:_\-.]+?)="([^"]+?)"/g,r=i.exec(n),o={};null!=r;)o[r[1]]=r[2],r=i.exec(n);return"/"===e[e.length-1]&&(e=e.substr(0,e.length-1)),{name:e,attributes:o}}return{name:null,attributes:{}}}}]),e}(s(203).Writable);e.default=r;var o={TEXT:0,TAG_NAME:1,INSTRUCTION:2,IGNORE_COMMENT:4,CDATA:8},a={NONE:0,OPENING:1,CLOSING:2,SELF_CLOSING:3},h=e.EVENTS={ERROR:"error",TEXT:"text",INSTRUCTION:"instruction",OPEN_TAG:"opentag",CLOSE_TAG:"closetag",CDATA:"cdata"}},237:(t,e,s)=>{const n=s(514),i=s(370);t.exports={packageName:"dbgate-plugin-xml",shellApi:{reader:n,writer:i}}},514:(t,e,s)=>{const n=s(896),i=s(203),r=s(814),{getLogger:o}=global.DBGATE_PACKAGES["dbgate-tools"],a=o("xmlReader");class h extends i.Transform{constructor({itemElementName:t}){super({objectMode:!0});let e=t;this.push({__isStreamHeader:!0,__isDynamicStructure:!0}),this.rowsWritten=0,this.parser=new r,this.stack=[],this.parser.on("opentag",((t,s)=>{e||1!=this.stack.length||(e=t),this.stack.push({name:t,attrs:s,nodes:{}})})),this.parser.on("text",(t=>{this.stack.length>=2&&(this.stack[this.stack.length-2].nodes[this.stack[this.stack.length-1].name]=t),this.stack.length>=1&&(this.stack[this.stack.length-1].nodes.$text=t)})),this.parser.on("cdata",(t=>{this.stack.length>=2&&(this.stack[this.stack.length-2].nodes[this.stack[this.stack.length-1].name]=t),this.stack.length>=1&&(this.stack[this.stack.length-1].nodes.$text=t)})),this.parser.on("closetag",((t,s)=>{if(t==e){const t={...this.stack[this.stack.length-1].attrs,...this.stack[this.stack.length-1].nodes};Object.keys(t).length>0&&(this.rowsWritten+=1,this.push(t))}this.stack.splice(-1)}))}_transform(t,e,s){this.parser.write(t),s()}}t.exports=async function({fileName:t,encoding:e="utf-8",itemElementName:s}){a.info(`Reading file ${t}`);const i=n.createReadStream(t,e),r=new h({itemElementName:s});return i.pipe(r),r}},370:(t,e,s)=>{const n=s(896),i=s(203),{getLogger:r}=global.DBGATE_PACKAGES["dbgate-tools"],o=r("xmlWriter");class a extends i.Transform{constructor({itemElementName:t,rootElementName:e}){super({objectMode:!0}),this.itemElementName=t||"row",this.rootElementName=e||"root",this.startElement(this.rootElementName),this.push("\n")}startElement(t){this.push("<"),this.push(t),this.push(">")}endElement(t){this.push("</"),this.push(t),this.push(">\n")}elementValue(t,e){this.startElement(t),this.push(function(t){return t.replace(/[<>&'"]/g,(function(t){switch(t){case"<":return"&lt;";case">":return"&gt;";case"&":return"&amp;";case"'":return"&apos;";case'"':return"&quot;"}}))}(`${e}`)),this.endElement(t)}_transform(t,e,s){if(t.__isStreamHeader)s();else{this.startElement(this.itemElementName),this.push("\n");for(const e of Object.keys(t))this.elementValue(e,t[e]);this.endElement(this.itemElementName),s()}}_final(t){this.endElement(this.rootElementName),t()}}t.exports=async function({fileName:t,encoding:e="utf-8",itemElementName:s,rootElementName:i}){o.info(`Writing file ${t}`);const r=new a({itemElementName:s,rootElementName:i}),h=n.createWriteStream(t,e);return r.pipe(h),r.finisher=h,r}},896:t=>{"use strict";t.exports=require("fs")},203:t=>{"use strict";t.exports=require("stream")}},e={},s=function s(n){var i=e[n];if(void 0!==i)return i.exports;var r=e[n]={exports:{}};return t[n](r,r.exports,s),r.exports}(237);module.exports=s})();
1
+ (()=>{var t={237:(t,e,s)=>{const r=s(514),n=s(370);t.exports={packageName:"dbgate-plugin-xml",shellApi:{reader:r,writer:n}}},514:(t,e,s)=>{const r=s(896),n=s(203),i=s(557),{getLogger:a}=global.DBGATE_PACKAGES["dbgate-tools"],h=a("xmlReader");class o extends n.Transform{constructor({itemElementName:t}){super({objectMode:!0});let e=t;this.push({__isStreamHeader:!0,__isDynamicStructure:!0}),this.rowsWritten=0,this.parser=new i,this.stack=[],this.parser.on("opentag",((t,s)=>{e||1!=this.stack.length||(e=t),this.stack.push({name:t,attrs:s,nodes:{}})})),this.parser.on("text",(t=>{this.stack.length>=2&&(this.stack[this.stack.length-2].nodes[this.stack[this.stack.length-1].name]=t),this.stack.length>=1&&(this.stack[this.stack.length-1].nodes.$text=t)})),this.parser.on("cdata",(t=>{this.stack.length>=2&&(this.stack[this.stack.length-2].nodes[this.stack[this.stack.length-1].name]=t),this.stack.length>=1&&(this.stack[this.stack.length-1].nodes.$text=t)})),this.parser.on("closetag",((t,s)=>{if(t==e){const t={...this.stack[this.stack.length-1].attrs,...this.stack[this.stack.length-1].nodes};Object.keys(t).length>0&&(this.rowsWritten+=1,this.push(t))}this.stack.splice(-1)}))}_transform(t,e,s){this.parser.write(t),s()}}t.exports=async function({fileName:t,encoding:e="utf-8",itemElementName:s}){h.info(`Reading file ${t}`);const n=r.createReadStream(t,e),i=new o({itemElementName:s});return n.pipe(i),i}},370:(t,e,s)=>{const r=s(896),n=s(203),{getLogger:i}=global.DBGATE_PACKAGES["dbgate-tools"],a=i("xmlWriter");class h extends n.Transform{constructor({itemElementName:t,rootElementName:e}){super({objectMode:!0}),this.itemElementName=t||"row",this.rootElementName=e||"root",this.startElement(this.rootElementName),this.push("\n")}startElement(t){this.push("<"),this.push(t),this.push(">")}endElement(t){this.push("</"),this.push(t),this.push(">\n")}elementValue(t,e){this.startElement(t),this.push(function(t){return t.replace(/[<>&'"]/g,(function(t){switch(t){case"<":return"&lt;";case">":return"&gt;";case"&":return"&amp;";case"'":return"&apos;";case'"':return"&quot;"}}))}(`${e}`)),this.endElement(t)}_transform(t,e,s){if(t.__isStreamHeader)s();else{this.startElement(this.itemElementName),this.push("\n");for(const e of Object.keys(t))this.elementValue(e,t[e]);this.endElement(this.itemElementName),s()}}_final(t){this.endElement(this.rootElementName),t()}}t.exports=async function({fileName:t,encoding:e="utf-8",itemElementName:s,rootElementName:n}){a.info(`Writing file ${t}`);const i=new h({itemElementName:s,rootElementName:n}),o=r.createWriteStream(t,e);return i.pipe(o),i.finisher=o,i}},557:t=>{"use strict";t.exports=require("node-xml-stream-parser")},896:t=>{"use strict";t.exports=require("fs")},203:t=>{"use strict";t.exports=require("stream")}},e={},s=function s(r){var n=e[r];if(void 0!==n)return n.exports;var i=e[r]={exports:{}};return t[r](i,i.exports,s),i.exports}(237);module.exports=s})();
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "dbgate-plugin-xml",
3
3
  "main": "dist/backend.js",
4
- "version": "5.5.7-alpha.28",
4
+ "version": "5.5.7-alpha.32",
5
5
  "homepage": "https://dbgate.org",
6
6
  "description": "XML import/export plugin for DbGate",
7
7
  "repository": {
@@ -31,9 +31,11 @@
31
31
  "prepublishOnly": "yarn build"
32
32
  },
33
33
  "devDependencies": {
34
- "node-xml-stream-parser": "^1.0.12",
35
34
  "dbgate-plugin-tools": "^1.0.7",
36
35
  "webpack": "^5.91.0",
37
36
  "webpack-cli": "^5.1.4"
37
+ },
38
+ "dependencies": {
39
+ "node-xml-stream-parser": "^1.0.12"
38
40
  }
39
41
  }