dbgate-plugin-xml 5.2.7 → 5.2.9

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.
package/dist/backend.js CHANGED
@@ -1 +1 @@
1
- module.exports=function(t){var e={};function n(s){if(e[s])return e[s].exports;var r=e[s]={i:s,l:!1,exports:{}};return t[s].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=t,n.c=e,n.d=function(t,e,s){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:s})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var s=Object.create(null);if(n.r(s),Object.defineProperty(s,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)n.d(s,r,function(e){return t[e]}.bind(null,r));return s},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=2)}([function(t,e){t.exports=require("stream")},function(t,e){t.exports=require("fs")},function(t,e,n){const s=n(3),r=n(6);t.exports={packageName:"dbgate-plugin-xml",shellApi:{reader:s,writer:r}}},function(t,e,n){const s=n(1),r=n(0),i=n(4),{getLogger:o}=global.DBGATE_TOOLS,a=o("xmlReader");class u extends r.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,n)=>{e||1!=this.stack.length||(e=t),this.stack.push({name:t,attrs:n,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,n)=>{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,n){this.parser.write(t),n()}}t.exports=async function({fileName:t,encoding:e="utf-8",itemElementName:n}){a.info("Reading file "+t);const r=s.createReadStream(t,e),i=new u({itemElementName:n});return r.pipe(i),i}},function(t,e,n){"use strict";var s,r=n(5),i=(s=r)&&s.__esModule?s:{default:s};t.exports=i.default},function(t,e,n){"use strict";var s="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 r=function(){function t(t,e){for(var n=0;n<e.length;n++){var s=e[n];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(t,s.key,s)}}return function(e,n,s){return n&&t(e.prototype,n),s&&t(e,s),e}}();var i=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":s(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":s(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),r(e,[{key:"_write",value:function(t,e,n){t="string"!=typeof t?t.toString():t;for(var s=0;s<t.length;s++){var r=t[s],i=this.buffer[this.pos-1];switch(this.buffer+=r,this.pos++,this.state){case o.TEXT:"<"===r&&this._onStartNewTag();break;case o.TAG_NAME:"<"===i&&"?"===r&&this._onStartInstruction(),"<"===i&&"/"===r&&this._onCloseTagStart(),"<"===this.buffer[this.pos-3]&&"!"===i&&"["===r&&this._onCDATAStart(),"<"===this.buffer[this.pos-3]&&"!"===i&&"-"===r&&this._onCommentStart(),">"===r&&("/"===i&&(this.tagType=a.SELF_CLOSING),this._onTagCompleted());break;case o.INSTRUCTION:"?"===i&&">"===r&&this._onEndInstruction();break;case o.CDATA:"]"===this.buffer[this.pos-3]&&"]"===i&&">"===r&&this._onCDATAEnd();break;case o.IGNORE_COMMENT:"-"===this.buffer[this.pos-3]&&"-"===i&&">"===r&&this._onCommentEnd()}}n()}},{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(u.TEXT,t),this.state=o.TAG_NAME,this.tagType=a.OPENING}},{key:"_onTagCompleted",value:function(){var t=this._endRecording(),e=this._parseTagString(t),n=e.name,s=e.attributes;null===n&&this.emit(u.ERROR,new Error("Failed to parse name for tag"+t)),this.tagType&&this.tagType==a.OPENING&&this.emit(u.OPEN_TAG,n,s),this.tagType&&this.tagType===a.CLOSING&&this.emit(u.CLOSE_TAG,n,s),this.tagType&&this.tagType===a.SELF_CLOSING&&(0===Object.keys(s).length&&s.constructor===Object&&(s={___selfClosing___:!0}),this.emit(u.OPEN_TAG,n,s),this.emit(u.CLOSE_TAG,n,s)),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),n=e.name,s=e.attributes;null===n&&this.emit(u.ERROR,new Error("Failed to parse name for inst"+t)),this.emit(u.INSTRUCTION,n,s),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(u.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,n=/^([a-zäöüßÄÖÜA-Z0-9:_\-.\/]+?)(\s|$)/.exec(t);if(n&&n.length>0){e=n[1];for(var s=t.substr(e.length),r=/([a-zäöüßÄÖÜA-Z0-9:_\-.]+?)="([^"]+?)"/g,i=r.exec(s),o={};null!=i;)o[i[1]]=i[2],i=r.exec(s);return"/"===e[e.length-1]&&(e=e.substr(0,e.length-1)),{name:e,attributes:o}}return{name:null,attributes:{}}}}]),e}(n(0).Writable);e.default=i;var o={TEXT:0,TAG_NAME:1,INSTRUCTION:2,IGNORE_COMMENT:4,CDATA:8},a={NONE:0,OPENING:1,CLOSING:2,SELF_CLOSING:3},u=e.EVENTS={ERROR:"error",TEXT:"text",INSTRUCTION:"instruction",OPEN_TAG:"opentag",CLOSE_TAG:"closetag",CDATA:"cdata"}},function(t,e,n){const s=n(1),r=n(0),{getLogger:i}=global.DBGATE_TOOLS,o=i("xmlWriter");class a extends r.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,n){if(t.__isStreamHeader)n();else{this.startElement(this.itemElementName),this.push("\n");for(const e of Object.keys(t))this.elementValue(e,t[e]);this.endElement(this.itemElementName),n()}}_final(t){this.endElement(this.rootElementName),t()}}t.exports=async function({fileName:t,encoding:e="utf-8",itemElementName:n,rootElementName:r}){o.info("Writing file "+t);const i=new a({itemElementName:n,rootElementName:r}),u=s.createWriteStream(t,e);return i.pipe(u),i.finisher=u,i}}]);
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=a.TEXT,t.buffer="",t.pos=0,t.tagType=o.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 a.TEXT:"<"===i&&this._onStartNewTag();break;case a.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=o.SELF_CLOSING),this._onTagCompleted());break;case a.INSTRUCTION:"?"===r&&">"===i&&this._onEndInstruction();break;case a.CDATA:"]"===this.buffer[this.pos-3]&&"]"===r&&">"===i&&this._onCDATAEnd();break;case a.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=a.TAG_NAME,this.tagType=o.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==o.OPENING&&this.emit(h.OPEN_TAG,s,n),this.tagType&&this.tagType===o.CLOSING&&this.emit(h.CLOSE_TAG,s,n),this.tagType&&this.tagType===o.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=a.TEXT,this.tagType=o.NONE}},{key:"_onCloseTagStart",value:function(){this._endRecording(),this.tagType=o.CLOSING}},{key:"_onStartInstruction",value:function(){this._endRecording(),this.state=a.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=a.TEXT}},{key:"_onCDATAStart",value:function(){this._endRecording(),this.state=a.CDATA}},{key:"_onCDATAEnd",value:function(){var t=this._endRecording();t=t.slice(t.indexOf("[")+1,t.lastIndexOf("]>")-1),this.state=a.TEXT,this.emit(h.CDATA,t)}},{key:"_onCommentStart",value:function(){this.state=a.IGNORE_COMMENT}},{key:"_onCommentEnd",value:function(){this._endRecording(),this.state=a.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),a={};null!=r;)a[r[1]]=r[2],r=i.exec(n);return"/"===e[e.length-1]&&(e=e.substr(0,e.length-1)),{name:e,attributes:a}}return{name:null,attributes:{}}}}]),e}(s(203).Writable);e.default=r;var a={TEXT:0,TAG_NAME:1,INSTRUCTION:2,IGNORE_COMMENT:4,CDATA:8},o={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:a}=global.DBGATE_TOOLS,o=a("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}){o.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_TOOLS,a=r("xmlWriter");class o 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}){a.info(`Writing file ${t}`);const r=new o({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})();
package/dist/frontend.js CHANGED
@@ -1 +1 @@
1
- var plugin=function(e){var t={};function r(n){if(t[n])return t[n].exports;var l=t[n]={i:n,l:!1,exports:{}};return e[n].call(l.exports,l,l.exports,r),l.l=!0,l.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var l in e)r.d(n,l,function(t){return e[t]}.bind(null,l));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=0)}([function(e,t,r){"use strict";r.r(t);t.default={fileFormats:[{packageName:"dbgate-plugin-xml",storageType:"xml@dbgate-plugin-xml",extension:"xml",name:"XML file",readerFunc:"reader@dbgate-plugin-xml",writerFunc:"writer@dbgate-plugin-xml",args:[{type:"text",name:"rootElementName",label:"Root element name",apiName:"rootElementName",direction:"target"},{type:"text",name:"itemElementName",label:"Item element name",apiName:"itemElementName"}]}],quickExports:[{label:"XML file",extension:"xml",createWriter:e=>({functionName:"writer@dbgate-plugin-xml",props:{fileName:e}})}]}}]);
1
+ var plugin;(()=>{"use strict";var e={d:(t,a)=>{for(var l in a)e.o(a,l)&&!e.o(t,l)&&Object.defineProperty(t,l,{enumerable:!0,get:a[l]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{default:()=>a});const a={fileFormats:[{packageName:"dbgate-plugin-xml",storageType:"xml@dbgate-plugin-xml",extension:"xml",name:"XML file",readerFunc:"reader@dbgate-plugin-xml",writerFunc:"writer@dbgate-plugin-xml",args:[{type:"text",name:"rootElementName",label:"Root element name",apiName:"rootElementName",direction:"target"},{type:"text",name:"itemElementName",label:"Item element name",apiName:"itemElementName"}]}],quickExports:[{label:"XML file",extension:"xml",createWriter:e=>({functionName:"writer@dbgate-plugin-xml",props:{fileName:e}})}]};plugin=t})();
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.2.7",
4
+ "version": "5.2.9",
5
5
  "homepage": "https://dbgate.org",
6
6
  "description": "XML import/export plugin for DbGate",
7
7
  "repository": {
@@ -33,7 +33,7 @@
33
33
  "devDependencies": {
34
34
  "node-xml-stream-parser": "^1.0.12",
35
35
  "dbgate-plugin-tools": "^1.0.7",
36
- "webpack": "^4.42.0",
37
- "webpack-cli": "^3.3.11"
36
+ "webpack": "^5.91.0",
37
+ "webpack-cli": "^5.1.4"
38
38
  }
39
39
  }