dbgate-plugin-csv
Advanced tools
Comparing version 5.4.5-alpha.5 to 5.5.1
@@ -1,1 +0,1 @@ | ||
(()=>{var t={608:(t,e,i)=>{const r=i(203),o=i(23);t.exports=function(){let t,e;2===arguments.length?(t=arguments[0],e=arguments[1]):1===arguments.length?"function"==typeof arguments[0]?(t={},e=arguments[0]):t=arguments[0]:0===arguments.length&&(t={});const i=new Generator(t);if(e){const t=[];i.on("readable",(function(){let e;for(;e=i.read();)t.push(e)})),i.on("error",e),i.on("end",(function(){i.options.objectMode?e(null,t):i.options.encoding?e(null,t.join("")):e(null,Buffer.concat(t))}))}return i},Generator=function(t={}){t.high_water_mark&&(t.highWaterMark=t.high_water_mark),t.object_mode&&(t.objectMode=t.object_mode),r.Readable.call(this,t),this.options={};for(let e in t)this.options[Generator.camelize(e)]=t[e];const e={columns:8,delimiter:",",duration:null,encoding:null,end:null,eof:!1,fixedSize:!1,length:-1,maxWordLength:16,rowDelimiter:"\n",seed:!1,sleep:0};for(const t in e)void 0===this.options[t]&&(this.options[t]=e[t]);!0===this.options.eof&&(this.options.eof=this.options.rowDelimiter),this._={start_time:this.options.duration?Date.now():null,fixed_size_buffer:"",count_written:0,count_created:0},"number"==typeof this.options.columns&&(this.options.columns=new Array(this.options.columns));const i=Object.keys(Generator).filter((t=>!["super_","camelize"].includes(t)));for(let t=0;t<this.options.columns.length;t++){const e=this.options.columns[t]||"ascii";if("string"==typeof e){if(!i.includes(e))throw Error(`Invalid column type: got "${e}", default values are ${JSON.stringify(i)}`);this.options.columns[t]=Generator[e]}}return this},o.inherits(Generator,r.Readable),t.exports.Generator=Generator,Generator.prototype.random=function(){return this.options.seed?this.options.seed=this.options.seed*Math.PI*100%100/100:Math.random()},Generator.prototype.end=function(){this.push(null)},Generator.prototype._read=function(t){const e=[];let i=this._.fixed_size_buffer.length;for(0!==i&&e.push(this._.fixed_size_buffer);;){if(this._.count_created===this.options.length||this.options.end&&Date.now()>this.options.end||this.options.duration&&Date.now()>this._.start_time+this.options.duration){if(e.length)if(this.options.objectMode)for(const t of e)this.__push(t);else this.__push(e.join("")+(this.options.eof?this.options.eof:""));return this.push(null)}let r,o=[];if(this.options.columns.forEach((t=>{o.push(t(this))})),this.options.objectMode){r=0;for(const t of o)r+=t.length}else o=(0===this._.count_created?"":this.options.rowDelimiter)+o.join(this.options.delimiter),r=o.length;if(this._.count_created++,i+r>t){if(this.options.objectMode){e.push(o);for(const t of e)this.__push(t)}else this.options.fixedSize?(this._.fixed_size_buffer=o.substr(t-i),e.push(o.substr(0,t-i))):e.push(o),this.__push(e.join(""));return}i+=r,e.push(o)}},Generator.prototype.__push=function(t){this._.count_written++,this.options.sleep>0?setTimeout((()=>{this.push(t)}),this.options.sleep):this.push(t)},Generator.ascii=function(t){const e=[],i=Math.ceil(t.random()*t.options.maxWordLength);for(let r=0;r<i;r++){const i=Math.floor(32*t.random());e.push(String.fromCharCode(i+(i<16?65:81)))}return e.join("")},Generator.int=function(t){return Math.floor(t.random()*Math.pow(2,52))},Generator.bool=function(t){return Math.floor(2*t.random())},Generator.camelize=function(t){return t.replace(/_([a-z])/gi,(function(t,e,i){return e.toUpperCase()}))}},610:t=>{t.exports=class{constructor(t=100){this.size=t,this.length=0,this.buf=Buffer.alloc(t)}prepend(t){if(Buffer.isBuffer(t)){const e=this.length+t.length;if(e>=this.size&&(this.resize(),e>=this.size))throw Error("INVALID_BUFFER_STATE");const i=this.buf;this.buf=Buffer.alloc(this.size),t.copy(this.buf,0),i.copy(this.buf,t.length),this.length+=t.length}else{const e=this.length++;e===this.size&&this.resize();const i=this.clone();this.buf[0]=t,i.copy(this.buf,1,0,e)}}append(t){const e=this.length++;e===this.size&&this.resize(),this.buf[e]=t}clone(){return Buffer.from(this.buf.slice(0,this.length))}resize(){const t=this.length;this.size=2*this.size;const e=Buffer.alloc(this.size);this.buf.copy(e,0,0,t),this.buf=e}toString(t){return t?this.buf.slice(0,this.length).toString(t):Uint8Array.prototype.slice.call(this.buf.slice(0,this.length))}toJSON(){return this.toString("utf8")}reset(){this.length=0}}},438:(t,e,i)=>{const{Transform:r}=i(203),o=i(610),n={utf8:Buffer.from([239,187,191]),utf16le:Buffer.from([255,254])};class s extends r{constructor(t={}){super({readableObjectMode:!0,...t,encoding:null}),this.__originalOptions=t,this.__normalizeOptions(t)}__normalizeOptions(t){const e={};for(let i in t)e[u(i)]=t[i];if(void 0===e.encoding||!0===e.encoding)e.encoding="utf8";else if(null===e.encoding||!1===e.encoding)e.encoding=null;else if("string"!=typeof e.encoding&&null!==e.encoding)throw new a("CSV_INVALID_OPTION_ENCODING",["Invalid option encoding:","encoding must be a string or null to return a buffer,",`got ${JSON.stringify(e.encoding)}`],e);if(void 0===e.bom||null===e.bom||!1===e.bom)e.bom=!1;else if(!0!==e.bom)throw new a("CSV_INVALID_OPTION_BOM",["Invalid option bom:","bom must be true,",`got ${JSON.stringify(e.bom)}`],e);let i=null;if(void 0===e.cast||null===e.cast||!1===e.cast||""===e.cast)e.cast=void 0;else if("function"==typeof e.cast)i=e.cast,e.cast=!0;else if(!0!==e.cast)throw new a("CSV_INVALID_OPTION_CAST",["Invalid option cast:","cast must be true or a function,",`got ${JSON.stringify(e.cast)}`],e);if(void 0===e.cast_date||null===e.cast_date||!1===e.cast_date||""===e.cast_date)e.cast_date=!1;else{if(!0!==e.cast_date)throw new a("CSV_INVALID_OPTION_CAST_DATE",["Invalid option cast_date:","cast_date must be true or a function,",`got ${JSON.stringify(e.cast_date)}`],e);e.cast_date=function(t){const e=Date.parse(t);return isNaN(e)?t:new Date(e)}}let r=null;if(!0===e.columns)r=void 0;else if("function"==typeof e.columns)r=e.columns,e.columns=!0;else if(Array.isArray(e.columns))e.columns=h(e.columns);else{if(void 0!==e.columns&&null!==e.columns&&!1!==e.columns)throw new a("CSV_INVALID_OPTION_COLUMNS",["Invalid option columns:","expect an array, a function or true,",`got ${JSON.stringify(e.columns)}`],e);e.columns=!1}if(void 0===e.columns_duplicates_to_array||null===e.columns_duplicates_to_array||!1===e.columns_duplicates_to_array)e.columns_duplicates_to_array=!1;else{if(!0!==e.columns_duplicates_to_array)throw new a("CSV_INVALID_OPTION_COLUMNS_DUPLICATES_TO_ARRAY",["Invalid option columns_duplicates_to_array:","expect an boolean,",`got ${JSON.stringify(e.columns_duplicates_to_array)}`],e);if(!1===e.columns)throw new a("CSV_INVALID_OPTION_COLUMNS_DUPLICATES_TO_ARRAY",["Invalid option columns_duplicates_to_array:","the `columns` mode must be activated."],e)}if(void 0===e.comment||null===e.comment||!1===e.comment||""===e.comment)e.comment=null;else if("string"==typeof e.comment&&(e.comment=Buffer.from(e.comment,e.encoding)),!Buffer.isBuffer(e.comment))throw new a("CSV_INVALID_OPTION_COMMENT",["Invalid option comment:","comment must be a buffer or a string,",`got ${JSON.stringify(e.comment)}`],e);const n=JSON.stringify(e.delimiter);if(Array.isArray(e.delimiter)||(e.delimiter=[e.delimiter]),0===e.delimiter.length)throw new a("CSV_INVALID_OPTION_DELIMITER",["Invalid option delimiter:","delimiter must be a non empty string or buffer or array of string|buffer,",`got ${n}`],e);if(e.delimiter=e.delimiter.map((function(t){if(null==t||!1===t)return Buffer.from(",",e.encoding);if("string"==typeof t&&(t=Buffer.from(t,e.encoding)),!Buffer.isBuffer(t)||0===t.length)throw new a("CSV_INVALID_OPTION_DELIMITER",["Invalid option delimiter:","delimiter must be a non empty string or buffer or array of string|buffer,",`got ${n}`],e);return t})),void 0===e.escape||!0===e.escape?e.escape=Buffer.from('"',e.encoding):"string"==typeof e.escape?e.escape=Buffer.from(e.escape,e.encoding):null!==e.escape&&!1!==e.escape||(e.escape=null),null!==e.escape&&!Buffer.isBuffer(e.escape))throw new Error(`Invalid Option: escape must be a buffer, a string or a boolean, got ${JSON.stringify(e.escape)}`);if(void 0===e.from||null===e.from)e.from=1;else{if("string"==typeof e.from&&/\d+/.test(e.from)&&(e.from=parseInt(e.from)),!Number.isInteger(e.from))throw new Error(`Invalid Option: from must be an integer, got ${JSON.stringify(e.from)}`);if(e.from<0)throw new Error(`Invalid Option: from must be a positive integer, got ${JSON.stringify(t.from)}`)}if(void 0===e.from_line||null===e.from_line)e.from_line=1;else{if("string"==typeof e.from_line&&/\d+/.test(e.from_line)&&(e.from_line=parseInt(e.from_line)),!Number.isInteger(e.from_line))throw new Error(`Invalid Option: from_line must be an integer, got ${JSON.stringify(t.from_line)}`);if(e.from_line<=0)throw new Error(`Invalid Option: from_line must be a positive integer greater than 0, got ${JSON.stringify(t.from_line)}`)}if(void 0===e.ignore_last_delimiters||null===e.ignore_last_delimiters)e.ignore_last_delimiters=!1;else if("number"==typeof e.ignore_last_delimiters)e.ignore_last_delimiters=Math.floor(e.ignore_last_delimiters),0===e.ignore_last_delimiters&&(e.ignore_last_delimiters=!1);else if("boolean"!=typeof e.ignore_last_delimiters)throw new a("CSV_INVALID_OPTION_IGNORE_LAST_DELIMITERS",["Invalid option `ignore_last_delimiters`:","the value must be a boolean value or an integer,",`got ${JSON.stringify(e.ignore_last_delimiters)}`],e);if(!0===e.ignore_last_delimiters&&!1===e.columns)throw new a("CSV_IGNORE_LAST_DELIMITERS_REQUIRES_COLUMNS",["The option `ignore_last_delimiters`","requires the activation of the `columns` option"],e);if(void 0===e.info||null===e.info||!1===e.info)e.info=!1;else if(!0!==e.info)throw new Error(`Invalid Option: info must be true, got ${JSON.stringify(e.info)}`);if(void 0===e.max_record_size||null===e.max_record_size||!1===e.max_record_size)e.max_record_size=0;else if(Number.isInteger(e.max_record_size)&&e.max_record_size>=0);else{if("string"!=typeof e.max_record_size||!/\d+/.test(e.max_record_size))throw new Error(`Invalid Option: max_record_size must be a positive integer, got ${JSON.stringify(e.max_record_size)}`);e.max_record_size=parseInt(e.max_record_size)}if(void 0===e.objname||null===e.objname||!1===e.objname)e.objname=void 0;else if(Buffer.isBuffer(e.objname)){if(0===e.objname.length)throw new Error("Invalid Option: objname must be a non empty buffer");null===e.encoding||(e.objname=e.objname.toString(e.encoding))}else{if("string"!=typeof e.objname)throw new Error(`Invalid Option: objname must be a string or a buffer, got ${e.objname}`);if(0===e.objname.length)throw new Error("Invalid Option: objname must be a non empty string")}if(void 0===e.on_record||null===e.on_record)e.on_record=void 0;else if("function"!=typeof e.on_record)throw new a("CSV_INVALID_OPTION_ON_RECORD",["Invalid option `on_record`:","expect a function,",`got ${JSON.stringify(e.on_record)}`],e);if(null===e.quote||!1===e.quote||""===e.quote)e.quote=null;else if(void 0===e.quote||!0===e.quote?e.quote=Buffer.from('"',e.encoding):"string"==typeof e.quote&&(e.quote=Buffer.from(e.quote,e.encoding)),!Buffer.isBuffer(e.quote))throw new Error(`Invalid Option: quote must be a buffer or a string, got ${JSON.stringify(e.quote)}`);if(void 0===e.raw||null===e.raw||!1===e.raw)e.raw=!1;else if(!0!==e.raw)throw new Error(`Invalid Option: raw must be true, got ${JSON.stringify(e.raw)}`);if(e.record_delimiter?Array.isArray(e.record_delimiter)||(e.record_delimiter=[e.record_delimiter]):e.record_delimiter=[],e.record_delimiter=e.record_delimiter.map((function(t){return"string"==typeof t&&(t=Buffer.from(t,e.encoding)),t})),"boolean"==typeof e.relax);else{if(void 0!==e.relax&&null!==e.relax)throw new Error(`Invalid Option: relax must be a boolean, got ${JSON.stringify(e.relax)}`);e.relax=!1}if("boolean"==typeof e.relax_column_count);else{if(void 0!==e.relax_column_count&&null!==e.relax_column_count)throw new Error(`Invalid Option: relax_column_count must be a boolean, got ${JSON.stringify(e.relax_column_count)}`);e.relax_column_count=!1}if("boolean"==typeof e.relax_column_count_less);else{if(void 0!==e.relax_column_count_less&&null!==e.relax_column_count_less)throw new Error(`Invalid Option: relax_column_count_less must be a boolean, got ${JSON.stringify(e.relax_column_count_less)}`);e.relax_column_count_less=!1}if("boolean"==typeof e.relax_column_count_more);else{if(void 0!==e.relax_column_count_more&&null!==e.relax_column_count_more)throw new Error(`Invalid Option: relax_column_count_more must be a boolean, got ${JSON.stringify(e.relax_column_count_more)}`);e.relax_column_count_more=!1}if("boolean"==typeof e.skip_empty_lines);else{if(void 0!==e.skip_empty_lines&&null!==e.skip_empty_lines)throw new Error(`Invalid Option: skip_empty_lines must be a boolean, got ${JSON.stringify(e.skip_empty_lines)}`);e.skip_empty_lines=!1}if("boolean"==typeof e.skip_lines_with_empty_values);else{if(void 0!==e.skip_lines_with_empty_values&&null!==e.skip_lines_with_empty_values)throw new Error(`Invalid Option: skip_lines_with_empty_values must be a boolean, got ${JSON.stringify(e.skip_lines_with_empty_values)}`);e.skip_lines_with_empty_values=!1}if("boolean"==typeof e.skip_lines_with_error);else{if(void 0!==e.skip_lines_with_error&&null!==e.skip_lines_with_error)throw new Error(`Invalid Option: skip_lines_with_error must be a boolean, got ${JSON.stringify(e.skip_lines_with_error)}`);e.skip_lines_with_error=!1}if(void 0===e.rtrim||null===e.rtrim||!1===e.rtrim)e.rtrim=!1;else if(!0!==e.rtrim)throw new Error(`Invalid Option: rtrim must be a boolean, got ${JSON.stringify(e.rtrim)}`);if(void 0===e.ltrim||null===e.ltrim||!1===e.ltrim)e.ltrim=!1;else if(!0!==e.ltrim)throw new Error(`Invalid Option: ltrim must be a boolean, got ${JSON.stringify(e.ltrim)}`);if(void 0===e.trim||null===e.trim||!1===e.trim)e.trim=!1;else if(!0!==e.trim)throw new Error(`Invalid Option: trim must be a boolean, got ${JSON.stringify(e.trim)}`);if(!0===e.trim&&!1!==t.ltrim?e.ltrim=!0:!0!==e.ltrim&&(e.ltrim=!1),!0===e.trim&&!1!==t.rtrim?e.rtrim=!0:!0!==e.rtrim&&(e.rtrim=!1),void 0===e.to||null===e.to)e.to=-1;else{if("string"==typeof e.to&&/\d+/.test(e.to)&&(e.to=parseInt(e.to)),!Number.isInteger(e.to))throw new Error(`Invalid Option: to must be an integer, got ${JSON.stringify(t.to)}`);if(e.to<=0)throw new Error(`Invalid Option: to must be a positive integer greater than 0, got ${JSON.stringify(t.to)}`)}if(void 0===e.to_line||null===e.to_line)e.to_line=-1;else{if("string"==typeof e.to_line&&/\d+/.test(e.to_line)&&(e.to_line=parseInt(e.to_line)),!Number.isInteger(e.to_line))throw new Error(`Invalid Option: to_line must be an integer, got ${JSON.stringify(t.to_line)}`);if(e.to_line<=0)throw new Error(`Invalid Option: to_line must be a positive integer greater than 0, got ${JSON.stringify(t.to_line)}`)}this.info={bytes:0,comment_lines:0,empty_lines:0,invalid_field_length:0,lines:1,records:0},this.options=e,this.state={bomSkipped:!1,bufBytesStart:0,castField:i,commenting:!1,error:void 0,enabled:1===e.from_line,escaping:!1,escapeIsQuote:Buffer.isBuffer(e.escape)&&Buffer.isBuffer(e.quote)&&0===Buffer.compare(e.escape,e.quote),expectedRecordLength:Array.isArray(e.columns)?e.columns.length:void 0,field:new o(20),firstLineToHeaders:r,needMoreDataSize:Math.max(null!==e.comment?e.comment.length:0,...e.delimiter.map((t=>t.length)),null!==e.quote?e.quote.length:0),previousBuf:void 0,quoting:!1,stop:!1,rawBuffer:new o(100),record:[],recordHasError:!1,record_length:0,recordDelimiterMaxLength:0===e.record_delimiter.length?2:Math.max(...e.record_delimiter.map((t=>t.length))),trimChars:[Buffer.from(" ",e.encoding)[0],Buffer.from("\t",e.encoding)[0]],wasQuoting:!1,wasRowDelimiter:!1}}_transform(t,e,i){if(!0===this.state.stop)return;const r=this.__parse(t,!1);void 0!==r&&(this.state.stop=!0),i(r)}_flush(t){!0!==this.state.stop&&t(this.__parse(void 0,!0))}__parse(t,e){const{bom:i,comment:r,escape:o,from_line:s,ltrim:l,max_record_size:u,quote:c,raw:f,relax:h,rtrim:d,skip_empty_lines:_,to:m,to_line:p}=this.options;let{record_delimiter:g}=this.options;const{bomSkipped:y,previousBuf:b,rawBuffer:v,escapeIsQuote:w}=this.state;let O;if(void 0===b){if(void 0===t)return void this.push(null);O=t}else O=void 0!==b&&void 0===t?b:Buffer.concat([b,t]);if(!1===y)if(!1===i)this.state.bomSkipped=!0;else if(O.length<3){if(!1===e)return void(this.state.previousBuf=O)}else{for(let t in n)if(0===n[t].compare(O,0,n[t].length)){let e=n[t].length;this.state.bufBytesStart+=e,O=O.slice(e),this.__normalizeOptions({...this.__originalOptions,encoding:t});break}this.state.bomSkipped=!0}const I=O.length;let S;for(S=0;S<I&&!this.__needMoreData(S,I,e);S++){if(!0===this.state.wasRowDelimiter&&(this.info.lines++,this.state.wasRowDelimiter=!1),-1!==p&&this.info.lines>p)return this.state.stop=!0,void this.push(null);!1===this.state.quoting&&0===g.length&&this.__autoDiscoverRecordDelimiter(O,S)&&(g=this.options.record_delimiter);const t=O[S];if(!0===f&&v.append(t),13!==t&&10!==t||!1!==this.state.wasRowDelimiter||(this.state.wasRowDelimiter=!0),!0===this.state.escaping)this.state.escaping=!1;else{if(null!==o&&!0===this.state.quoting&&this.__isEscape(O,S,t)&&S+o.length<I){if(!w){this.state.escaping=!0,S+=o.length-1;continue}if(this.__isQuote(O,S+o.length)){this.state.escaping=!0,S+=o.length-1;continue}}if(!1===this.state.commenting&&this.__isQuote(O,S))if(!0===this.state.quoting){const e=O[S+c.length],i=d&&this.__isCharTrimable(e),n=null!==r&&this.__compareBytes(r,O,S+c.length,e),s=this.__isDelimiter(O,S+c.length,e),l=0===g.length?this.__autoDiscoverRecordDelimiter(O,S+c.length):this.__isRecordDelimiter(e,O,S+c.length);if(null!==o&&this.__isEscape(O,S,t)&&this.__isQuote(O,S+o.length))S+=o.length-1;else{if(!e||s||l||n||i){this.state.quoting=!1,this.state.wasQuoting=!0,S+=c.length-1;continue}if(!1===h){const t=this.__error(new a("CSV_INVALID_CLOSING_QUOTE",["Invalid Closing Quote:",`got "${String.fromCharCode(e)}"`,`at line ${this.info.lines}`,"instead of delimiter, record delimiter, trimable character","(if activated) or comment"],this.options,this.__infoField()));if(void 0!==t)return t}else this.state.quoting=!1,this.state.wasQuoting=!0,this.state.field.prepend(c),S+=c.length-1}}else{if(0===this.state.field.length){this.state.quoting=!0,S+=c.length-1;continue}if(!1===h){const t=this.__error(new a("INVALID_OPENING_QUOTE",["Invalid Opening Quote:",`a quote is found inside a field at line ${this.info.lines}`],this.options,this.__infoField(),{field:this.state.field}));if(void 0!==t)return t}}if(!1===this.state.quoting){let e=this.__isRecordDelimiter(t,O,S);if(0!==e){if(this.state.commenting&&!1===this.state.wasQuoting&&0===this.state.record.length&&0===this.state.field.length)this.info.comment_lines++;else{if(!1===this.state.enabled&&this.info.lines+(!0===this.state.wasRowDelimiter?1:0)>=s){this.state.enabled=!0,this.__resetField(),this.__resetRecord(),S+=e-1;continue}if(!0===_&&!1===this.state.wasQuoting&&0===this.state.record.length&&0===this.state.field.length){this.info.empty_lines++,S+=e-1;continue}this.info.bytes=this.state.bufBytesStart+S;const t=this.__onField();if(void 0!==t)return t;this.info.bytes=this.state.bufBytesStart+S+e;const i=this.__onRecord();if(void 0!==i)return i;if(-1!==m&&this.info.records>=m)return this.state.stop=!0,void this.push(null)}this.state.commenting=!1,S+=e-1;continue}if(this.state.commenting)continue;if(0!==(null===r?0:this.__compareBytes(r,O,S,t))){this.state.commenting=!0;continue}let i=this.__isDelimiter(O,S,t);if(0!==i){this.info.bytes=this.state.bufBytesStart+S;const t=this.__onField();if(void 0!==t)return t;S+=i-1;continue}}}if(!1===this.state.commenting&&0!==u&&this.state.record_length+this.state.field.length>u){const t=this.__error(new a("CSV_MAX_RECORD_SIZE",["Max Record Size:","record exceed the maximum number of tolerated bytes",`of ${u}`,`at line ${this.info.lines}`],this.options,this.__infoField()));if(void 0!==t)return t}const e=!1===l||!0===this.state.quoting||0!==this.state.field.length||!this.__isCharTrimable(t),i=!1===d||!1===this.state.wasQuoting;if(!0===e&&!0===i)this.state.field.append(t);else if(!0===d&&!this.__isCharTrimable(t)){const t=this.__error(new a("CSV_NON_TRIMABLE_CHAR_AFTER_CLOSING_QUOTE",["Invalid Closing Quote:","found non trimable byte after quote",`at line ${this.info.lines}`],this.options,this.__infoField()));if(void 0!==t)return t}}if(!0===e)if(!0===this.state.quoting){const t=this.__error(new a("CSV_QUOTE_NOT_CLOSED",["Quote Not Closed:",`the parsing is finished with an opening quote at line ${this.info.lines}`],this.options,this.__infoField()));if(void 0!==t)return t}else if(!0===this.state.wasQuoting||0!==this.state.record.length||0!==this.state.field.length){this.info.bytes=this.state.bufBytesStart+S;const t=this.__onField();if(void 0!==t)return t;const e=this.__onRecord();if(void 0!==e)return e}else!0===this.state.wasRowDelimiter?this.info.empty_lines++:!0===this.state.commenting&&this.info.comment_lines++;else this.state.bufBytesStart+=S,this.state.previousBuf=O.slice(S);!0===this.state.wasRowDelimiter&&(this.info.lines++,this.state.wasRowDelimiter=!1)}__onRecord(){const{columns:t,columns_duplicates_to_array:e,encoding:i,info:r,from:o,relax_column_count:n,relax_column_count_less:s,relax_column_count_more:l,raw:u,skip_lines_with_empty_values:c}=this.options,{enabled:h,record:d}=this.state;if(!1===h)return this.__resetRecord();const _=d.length;if(!0===t)return!0===c&&f(d)?void this.__resetRecord():this.__firstLineToColumns(d);if(!1===t&&0===this.info.records&&(this.state.expectedRecordLength=_),_!==this.state.expectedRecordLength){const e=!1===t?new a("CSV_INCONSISTENT_RECORD_LENGTH",["Invalid Record Length:",`expect ${this.state.expectedRecordLength},`,`got ${_} on line ${this.info.lines}`],this.options,this.__infoField(),{record:d}):new a("CSV_RECORD_DONT_MATCH_COLUMNS_LENGTH",["Invalid Record Length:",`columns length is ${t.length},`,`got ${_} on line ${this.info.lines}`],this.options,this.__infoField(),{record:d});if(!0===n||!0===s&&_<this.state.expectedRecordLength||!0===l&&_>this.state.expectedRecordLength)this.info.invalid_field_length++,this.state.error=e;else{const t=this.__error(e);if(t)return t}}if(!0===c&&f(d))this.__resetRecord();else{if(!0===this.state.recordHasError)return this.__resetRecord(),void(this.state.recordHasError=!1);if(this.info.records++,1===o||this.info.records>=o)if(!1!==t){const o={};for(let i=0,r=d.length;i<r;i++)void 0===t[i]||t[i].disabled||(!0===e&&void 0!==o[t[i].name]?Array.isArray(o[t[i].name])?o[t[i].name]=o[t[i].name].concat(d[i]):o[t[i].name]=[o[t[i].name],d[i]]:o[t[i].name]=d[i]);const{objname:n}=this.options;if(void 0===n)if(!0===u||!0===r){const t=this.__push(Object.assign({record:o},!0===u?{raw:this.state.rawBuffer.toString(i)}:{},!0===r?{info:this.__infoRecord()}:{}));if(t)return t}else{const t=this.__push(o);if(t)return t}else if(!0===u||!0===r){const t=this.__push(Object.assign({record:[o[n],o]},!0===u?{raw:this.state.rawBuffer.toString(i)}:{},!0===r?{info:this.__infoRecord()}:{}));if(t)return t}else{const t=this.__push([o[n],o]);if(t)return t}}else if(!0===u||!0===r){const t=this.__push(Object.assign({record:d},!0===u?{raw:this.state.rawBuffer.toString(i)}:{},!0===r?{info:this.__infoRecord()}:{}));if(t)return t}else{const t=this.__push(d);if(t)return t}this.__resetRecord()}}__firstLineToColumns(t){const{firstLineToHeaders:e}=this.state;try{const i=void 0===e?t:e.call(null,t);if(!Array.isArray(i))return this.__error(new a("CSV_INVALID_COLUMN_MAPPING",["Invalid Column Mapping:","expect an array from column function,",`got ${JSON.stringify(i)}`],this.options,this.__infoField(),{headers:i}));const r=h(i);return this.state.expectedRecordLength=r.length,this.options.columns=r,void this.__resetRecord()}catch(t){return t}}__resetRecord(){!0===this.options.raw&&this.state.rawBuffer.reset(),this.state.error=void 0,this.state.record=[],this.state.record_length=0}__onField(){const{cast:t,encoding:e,rtrim:i,max_record_size:r}=this.options,{enabled:o,wasQuoting:n}=this.state;if(!1===o)return this.__resetField();let s=this.state.field.toString(e);if(!0===i&&!1===n&&(s=s.trimRight()),!0===t){const[t,e]=this.__cast(s);if(void 0!==t)return t;s=e}this.state.record.push(s),0!==r&&"string"==typeof s&&(this.state.record_length+=s.length),this.__resetField()}__resetField(){this.state.field.reset(),this.state.wasQuoting=!1}__push(t){const{on_record:e}=this.options;if(void 0!==e){const i=this.__infoRecord();try{t=e.call(null,t,i)}catch(t){return t}if(null==t)return}this.push(t)}__cast(t){const{columns:e,relax_column_count:i}=this.options;if(!0===Array.isArray(e)&&i&&this.options.columns.length<=this.state.record.length)return[void 0,void 0];if(null!==this.state.castField)try{const e=this.__infoField();return[void 0,this.state.castField.call(null,t,e)]}catch(t){return[t]}if(this.__isFloat(t))return[void 0,parseFloat(t)];if(!1!==this.options.cast_date){const e=this.__infoField();return[void 0,this.options.cast_date.call(null,t,e)]}return[void 0,t]}__isCharTrimable(t){return 32===t||9===t||13===t||10===t||12===t}__isFloat(t){return t-parseFloat(t)+1>=0}__compareBytes(t,e,i,r){if(t[0]!==r)return 0;const o=t.length;for(let r=1;r<o;r++)if(t[r]!==e[i+r])return 0;return o}__needMoreData(t,e,i){if(i)return!1;const{quote:r}=this.options,{quoting:o,needMoreDataSize:n,recordDelimiterMaxLength:s}=this.state;return e-t-1<Math.max(n,s,o?r.length+s:0)}__isDelimiter(t,e,i){const{delimiter:r,ignore_last_delimiters:o}=this.options;if(!0===o&&this.state.record.length===this.options.columns.length-1)return 0;if(!1!==o&&"number"==typeof o&&this.state.record.length===o-1)return 0;t:for(let o=0;o<r.length;o++){const n=r[o];if(n[0]===i){for(let i=1;i<n.length;i++)if(n[i]!==t[e+i])continue t;return n.length}}return 0}__isRecordDelimiter(t,e,i){const{record_delimiter:r}=this.options,o=r.length;t:for(let n=0;n<o;n++){const o=r[n],s=o.length;if(o[0]===t){for(let t=1;t<s;t++)if(o[t]!==e[i+t])continue t;return o.length}}return 0}__isEscape(t,e,i){const{escape:r}=this.options;if(null===r)return!1;const o=r.length;if(r[0]===i){for(let i=0;i<o;i++)if(r[i]!==t[e+i])return!1;return!0}return!1}__isQuote(t,e){const{quote:i}=this.options;if(null===i)return!1;const r=i.length;for(let o=0;o<r;o++)if(i[o]!==t[e+o])return!1;return!0}__autoDiscoverRecordDelimiter(t,e){const{encoding:i}=this.options,r=t[e];return 13===r?10===t[e+1]?(this.options.record_delimiter.push(Buffer.from("\r\n",i)),this.state.recordDelimiterMaxLength=2,2):(this.options.record_delimiter.push(Buffer.from("\r",i)),this.state.recordDelimiterMaxLength=1,1):10===r?(this.options.record_delimiter.push(Buffer.from("\n",i)),this.state.recordDelimiterMaxLength=1,1):0}__error(t){const{skip_lines_with_error:e}=this.options,i="string"==typeof t?new Error(t):t;return e?(this.state.recordHasError=!0,void this.emit("skip",i)):i}__infoDataSet(){return{...this.info,columns:this.options.columns}}__infoRecord(){const{columns:t}=this.options;return{...this.__infoDataSet(),error:this.state.error,header:!0===t,index:this.state.record.length}}__infoField(){const{columns:t}=this.options,e=Array.isArray(t);return{...this.__infoRecord(),column:!0===e?t.length>this.state.record.length?t[this.state.record.length].name:null:this.state.record.length,quoting:this.state.wasQuoting}}}const l=function(){let t,e,i;for(let r in arguments){const o=arguments[r],n=typeof o;if(void 0!==t||"string"!=typeof o&&!Buffer.isBuffer(o))if(void 0===e&&c(o))e=o;else{if(void 0!==i||"function"!==n)throw new a("CSV_INVALID_ARGUMENT",["Invalid argument:",`got ${JSON.stringify(o)} at index ${r}`],e||{});i=o}else t=o}const r=new s(e);if(i){const t=void 0===e||void 0===e.objname?[]:{};r.on("readable",(function(){let i;for(;null!==(i=this.read());)void 0===e||void 0===e.objname?t.push(i):t[i[0]]=i[1]})),r.on("error",(function(t){i(t,void 0,r.__infoDataSet())})),r.on("end",(function(){i(void 0,t,r.__infoDataSet())}))}return void 0!==t&&("function"==typeof setImmediate?setImmediate((function(){r.write(t),r.end()})):(r.write(t),r.end())),r};class a extends Error{constructor(t,e,i,...r){Array.isArray(e)&&(e=e.join(" ")),super(e),void 0!==Error.captureStackTrace&&Error.captureStackTrace(this,a),this.code=t;for(const t of r)for(const e in t){const r=t[e];this[e]=Buffer.isBuffer(r)?r.toString(i.encoding):null==r?r:JSON.parse(JSON.stringify(r))}}}l.Parser=s,l.CsvError=a,t.exports=l;const u=function(t){return t.replace(/([A-Z])/g,(function(t,e){return"_"+e.toLowerCase()}))},c=function(t){return"object"==typeof t&&null!==t&&!Array.isArray(t)},f=function(t){return t.every((t=>null==t||t.toString&&""===t.toString().trim()))},h=function(t){const e=[];for(let i=0,r=t.length;i<r;i++){const r=t[i];if(null==r||!1===r)e[i]={disabled:!0};else if("string"==typeof r)e[i]={name:r};else{if(!c(r))throw new a("CSV_INVALID_COLUMN_DEFINITION",["Invalid column definition:","expect a string or a literal object,",`got ${JSON.stringify(r)} at position ${i}`]);if("string"!=typeof r.name)throw new a("CSV_OPTION_COLUMNS_MISSING_NAME",["Option columns missing name:",`property "name" is required at position ${i}`,"when column is an object literal"]);e[i]=r}}return e}},164:(t,e,r)=>{const{Transform:o}=r(203),n=Buffer.from([239,187,191]);class s extends o{constructor(t={}){super({writableObjectMode:!0,...t});const e={};let i;for(let i in t)e[c(i)]=t[i];if(i=this.normalize(e))throw i;switch(e.record_delimiter){case"auto":e.record_delimiter=null;break;case"unix":e.record_delimiter="\n";break;case"mac":e.record_delimiter="\r";break;case"windows":e.record_delimiter="\r\n";break;case"ascii":e.record_delimiter="";break;case"unicode":e.record_delimiter="\u2028"}this.options=e,this.state={stop:!1},this.info={records:0}}normalize(t){if(void 0===t.bom||null===t.bom||!1===t.bom)t.bom=!1;else if(!0!==t.bom)return new a("CSV_OPTION_BOOLEAN_INVALID_TYPE",["option `bom` is optional and must be a boolean value,",`got ${JSON.stringify(t.bom)}`]);if(void 0===t.delimiter||null===t.delimiter)t.delimiter=",";else if(Buffer.isBuffer(t.delimiter))t.delimiter=t.delimiter.toString();else if("string"!=typeof t.delimiter)return new a("CSV_OPTION_DELIMITER_INVALID_TYPE",["option `delimiter` must be a buffer or a string,",`got ${JSON.stringify(t.delimiter)}`]);if(void 0===t.quote||null===t.quote)t.quote='"';else if(!0===t.quote)t.quote='"';else if(!1===t.quote)t.quote="";else if(Buffer.isBuffer(t.quote))t.quote=t.quote.toString();else if("string"!=typeof t.quote)return new a("CSV_OPTION_QUOTE_INVALID_TYPE",["option `quote` must be a boolean, a buffer or a string,",`got ${JSON.stringify(t.quote)}`]);if(void 0!==t.quoted&&null!==t.quoted||(t.quoted=!1),void 0!==t.quoted_empty&&null!==t.quoted_empty||(t.quoted_empty=void 0),void 0===t.quoted_match||null===t.quoted_match||!1===t.quoted_match?t.quoted_match=null:Array.isArray(t.quoted_match)||(t.quoted_match=[t.quoted_match]),t.quoted_match)for(let e of t.quoted_match){const t=e instanceof RegExp;if("string"!=typeof e&&!t)return Error(`Invalid Option: quoted_match must be a string or a regex, got ${JSON.stringify(e)}`)}if(void 0!==t.quoted_string&&null!==t.quoted_string||(t.quoted_string=!1),void 0!==t.eof&&null!==t.eof||(t.eof=!0),void 0===t.escape||null===t.escape)t.escape='"';else if(Buffer.isBuffer(t.escape))t.escape=t.escape.toString();else if("string"!=typeof t.escape)return Error(`Invalid Option: escape must be a buffer or a string, got ${JSON.stringify(t.escape)}`);if(t.escape.length>1)return Error(`Invalid Option: escape must be one character, got ${t.escape.length} characters`);if(void 0!==t.header&&null!==t.header||(t.header=!1),t.columns=this.normalize_columns(t.columns),void 0!==t.quoted&&null!==t.quoted||(t.quoted=!1),void 0!==t.cast&&null!==t.cast||(t.cast={}),void 0!==t.cast.bigint&&null!==t.cast.bigint||(t.cast.bigint=t=>""+t),void 0!==t.cast.boolean&&null!==t.cast.boolean||(t.cast.boolean=t=>t?"1":""),void 0!==t.cast.date&&null!==t.cast.date||(t.cast.date=t=>""+t.getTime()),void 0!==t.cast.number&&null!==t.cast.number||(t.cast.number=t=>""+t),void 0!==t.cast.object&&null!==t.cast.object||(t.cast.object=t=>JSON.stringify(t)),void 0!==t.cast.string&&null!==t.cast.string||(t.cast.string=function(t){return t}),void 0===t.record_delimiter||null===t.record_delimiter)t.record_delimiter="\n";else if(Buffer.isBuffer(t.record_delimiter))t.record_delimiter=t.record_delimiter.toString();else if("string"!=typeof t.record_delimiter)return Error(`Invalid Option: record_delimiter must be a buffer or a string, got ${JSON.stringify(t.record_delimiter)}`)}_transform(t,e,i){if(!0===this.state.stop)return;if(!Array.isArray(t)&&"object"!=typeof t)return this.state.stop=!0,i(Error(`Invalid Record: expect an array or an object, got ${JSON.stringify(t)}`));if(0===this.info.records)if(Array.isArray(t)){if(!0===this.options.header&&!this.options.columns)return this.state.stop=!0,i(Error("Undiscoverable Columns: header option requires column option or object records"))}else void 0!==this.options.columns&&null!==this.options.columns||(this.options.columns=this.normalize_columns(Object.keys(t)));0===this.info.records&&(this.bom(),this.headers());try{this.emit("record",t,this.info.records)}catch(t){return this.state.stop=!0,this.emit("error",t)}let r;if(this.options.eof){if(r=this.stringify(t),void 0===r)return;r+=this.options.record_delimiter}else{if(r=this.stringify(t),void 0===r)return;(this.options.header||this.info.records)&&(r=this.options.record_delimiter+r)}this.info.records++,this.push(r),i()}_flush(t){0===this.info.records&&(this.bom(),this.headers()),t()}stringify(t,e=!1){if("object"!=typeof t)return t;const{columns:r,header:o}=this.options,n=[];if(Array.isArray(t)){r&&t.splice(r.length);for(let i=0;i<t.length;i++){const r=t[i],[o,s]=this.__cast(r,{index:i,column:i,records:this.info.records,header:e});if(o)return void this.emit("error",o);n[i]=[s,r]}}else if(r)for(let i=0;i<r.length;i++){const o=y(t,r[i].key),[s,l]=this.__cast(o,{index:i,column:r[i].key,records:this.info.records,header:e});if(s)return void this.emit("error",s);n[i]=[l,o]}else for(let o of t){const s=t[o],[l,a]=this.__cast(s,{index:i,column:r[i].key,records:this.info.records,header:e});if(l)return void this.emit("error",l);n.push([a,s])}let s="";for(let t=0;t<n.length;t++){let e,i,[r,o]=n[t];if("string"==typeof r)e=this.options;else if(u(r)){if(e=r,r=e.value,delete e.value,"string"!=typeof r&&null!=r)return void this.emit("error",Error(`Invalid Casting Value: returned value must return a string, null or undefined, got ${JSON.stringify(r)}`));if(e={...this.options,...e},i=this.normalize(e))return void this.emit("error",i)}else{if(null!=r)return void this.emit("error",Error(`Invalid Casting Value: returned value must return a string, an object, null or undefined, got ${JSON.stringify(r)}`));e=this.options}const{delimiter:l,escape:a,quote:c,quoted:f,quoted_empty:h,quoted_string:d,quoted_match:_,record_delimiter:m}=e;if(r){if("string"!=typeof r)return this.emit("error",Error(`Formatter must return a string, null or undefined, got ${JSON.stringify(r)}`)),null;const t=l.length&&r.indexOf(l)>=0,e=""!==c&&r.indexOf(c)>=0,i=r.indexOf(a)>=0&&a!==c,n=r.indexOf(m)>=0,u=d&&"string"==typeof o;let h=_&&_.filter((t=>"string"==typeof t?-1!==r.indexOf(t):t.test(r)));h=h&&h.length>0;const p=!0===e||t||n||f||u||h;if(!0===p&&!0===i){const t="\\"===a?new RegExp(a+a,"g"):new RegExp(a,"g");r=r.replace(t,a+a)}if(!0===e){const t=new RegExp(c,"g");r=r.replace(t,a+c)}!0===p&&(r=c+r+c),s+=r}else(!0===h||""===o&&!0===d&&!1!==h)&&(s+=c+c);t!==n.length-1&&(s+=l)}return s}bom(){!0===this.options.bom&&this.push(n)}headers(){if(!1===this.options.header)return;if(void 0===this.options.columns)return;let t=this.options.columns.map((t=>t.header));t=this.options.eof?this.stringify(t,!0)+this.options.record_delimiter:this.stringify(t),this.push(t)}__cast(t,e){const i=typeof t;try{return"string"===i?[void 0,this.options.cast.string(t,e)]:"bigint"===i?[void 0,this.options.cast.bigint(t,e)]:"number"===i?[void 0,this.options.cast.number(t,e)]:"boolean"===i?[void 0,this.options.cast.boolean(t,e)]:t instanceof Date?[void 0,this.options.cast.date(t,e)]:"object"===i&&null!==t?[void 0,this.options.cast.object(t,e)]:[void 0,t,t]}catch(t){return[t]}}normalize_columns(t){if(null!=t){if("object"!=typeof t)throw Error('Invalid option "columns": expect an array or an object');if(Array.isArray(t)){const e=[];for(let i of t)if("string"==typeof i)e.push({key:i,header:i});else{if("object"!=typeof i||void 0===i||Array.isArray(i))throw Error("Invalid column definition: expect a string or an object");if(!i.key)throw Error('Invalid column definition: property "key" is required');void 0===i.header&&(i.header=i.key),e.push(i)}t=e}else{const e=[];for(let i in t)e.push({key:i,header:t[i]});t=e}return t}}}const l=function(){let t,e,i;for(let r in arguments){const o=arguments[r],n=typeof o;if(void 0===t&&Array.isArray(o))t=o;else if(void 0===e&&u(o))e=o;else{if(void 0!==i||"function"!==n)throw new a("CSV_INVALID_ARGUMENT",["Invalid argument:",`got ${JSON.stringify(o)} at index ${r}`]);i=o}}const r=new s(e);if(i){const t=[];r.on("readable",(function(){let e;for(;null!==(e=this.read());)t.push(e)})),r.on("error",(function(t){i(t)})),r.on("end",(function(){i(void 0,t.join(""))}))}if(void 0!==t)if("function"==typeof setImmediate)setImmediate((function(){for(let e of t)r.write(e);r.end()}));else{for(let e of t)r.write(e);r.end()}return r};class a extends Error{constructor(t,e,...i){Array.isArray(e)&&(e=e.join(" ")),super(e),void 0!==Error.captureStackTrace&&Error.captureStackTrace(this,a),this.code=t;for(const t of i)for(const e in t){const i=t[e];this[e]=Buffer.isBuffer(i)?i.toString():null==i?i:JSON.parse(JSON.stringify(i))}}}l.Stringifier=s,l.CsvError=a,t.exports=l;const u=function(t){return"object"==typeof t&&null!==t&&!Array.isArray(t)},c=function(t){return t.replace(/([A-Z])/g,(function(t,e){return"_"+e.toLowerCase()}))},f=".".charCodeAt(0),h=/\\(\\)?/g,d=RegExp("[^.[\\]]+|\\[(?:([^\"'][^[]*)|([\"'])((?:(?!\\2)[^\\\\]|\\\\.)*?)\\2)\\]|(?=(?:\\.|\\[\\])(?:\\.|\\[\\]|$))","g"),_=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,m=/^\w*$/,p=function(t){const e=typeof t;return"symbol"===e||"object"===e&&t&&"[object Symbol]"===function(t){return Object.prototype.toString.call(t)}(t)},g=function(t){if("string"==typeof t||p(t))return t;const e=`${t}`;return"0"==e&&1/t==-INFINITY?"-0":e},y=function(t,e){let i=0;const r=(e=function(t,e){return Array.isArray(t)?t:function(t,e){if(Array.isArray(t))return!1;const i=typeof t;return!("number"!==i&&"symbol"!==i&&"boolean"!==i&&t&&!p(t))||m.test(t)||!_.test(t)||null!=e&&t in Object(e)}(t,e)?[t]:function(t){const e=[];return t.charCodeAt(0)===f&&e.push(""),t.replace(d,(function(t,i,r,o){let n=t;r?n=o.replace(h,"$1"):i&&(n=i.trim()),e.push(n)})),e}(t)}(e,t)).length;for(;null!=t&&i<r;)t=t[g(e[i++])];return i&&i===r?t:void 0}},888:(t,e,i)=>{t.exports={generate:i(608),parse:i(438),transform:i(485),stringify:i(164)}},432:(t,e,i)=>{var r=i(36).Symbol;t.exports=r},312:(t,e,i)=>{var r=i(571),o=i(679),n=Object.prototype.hasOwnProperty;t.exports=function(t,e,i){var s=t[e];n.call(t,e)&&o(s,i)&&(void 0!==i||e in t)||r(t,e,i)}},571:(t,e,i)=>{var r=i(133);t.exports=function(t,e,i){"__proto__"==e&&r?r(t,e,{configurable:!0,enumerable:!0,value:i,writable:!0}):t[e]=i}},77:(t,e,i)=>{var r=i(432),o=i(444),n=i(371),s=r?r.toStringTag:void 0;t.exports=function(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":s&&s in Object(t)?o(t):n(t)}},950:(t,e,i)=>{var r=i(553),o=i(909),n=i(130),s=i(760),l=/^\[object .+?Constructor\]$/,a=Function.prototype,u=Object.prototype,c=a.toString,f=u.hasOwnProperty,h=RegExp("^"+c.call(f).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");t.exports=function(t){return!(!n(t)||o(t))&&(r(t)?h:l).test(s(t))}},141:t=>{t.exports=function(t,e,i){for(var r=-1,o=t.length,n=e.length,s={};++r<o;){var l=r<n?e[r]:void 0;i(s,t[r],l)}return s}},780:(t,e,i)=>{var r=i(36)["__core-js_shared__"];t.exports=r},133:(t,e,i)=>{var r=i(789),o=function(){try{var t=r(Object,"defineProperty");return t({},"",{}),t}catch(t){}}();t.exports=o},565:t=>{var e="object"==typeof global&&global&&global.Object===Object&&global;t.exports=e},789:(t,e,i)=>{var r=i(950),o=i(869);t.exports=function(t,e){var i=o(t,e);return r(i)?i:void 0}},444:(t,e,i)=>{var r=i(432),o=Object.prototype,n=o.hasOwnProperty,s=o.toString,l=r?r.toStringTag:void 0;t.exports=function(t){var e=n.call(t,l),i=t[l];try{t[l]=void 0;var r=!0}catch(t){}var o=s.call(t);return r&&(e?t[l]=i:delete t[l]),o}},869:t=>{t.exports=function(t,e){return null==t?void 0:t[e]}},909:(t,e,i)=>{var r,o=i(780),n=(r=/[^.]+$/.exec(o&&o.keys&&o.keys.IE_PROTO||""))?"Symbol(src)_1."+r:"";t.exports=function(t){return!!n&&n in t}},371:t=>{var e=Object.prototype.toString;t.exports=function(t){return e.call(t)}},36:(t,e,i)=>{var r=i(565),o="object"==typeof self&&self&&self.Object===Object&&self,n=r||o||Function("return this")();t.exports=n},760:t=>{var e=Function.prototype.toString;t.exports=function(t){if(null!=t){try{return e.call(t)}catch(t){}try{return t+""}catch(t){}}return""}},679:t=>{t.exports=function(t,e){return t===e||t!=t&&e!=e}},553:(t,e,i)=>{var r=i(77),o=i(130);t.exports=function(t){if(!o(t))return!1;var e=r(t);return"[object Function]"==e||"[object GeneratorFunction]"==e||"[object AsyncFunction]"==e||"[object Proxy]"==e}},130:t=>{t.exports=function(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}},613:(t,e,i)=>{var r=i(312),o=i(141);t.exports=function(t,e){return o(t||[],e||[],r)}},485:(t,e,i)=>{var r,o,n,s;n=i(203),s=i(23),({clone:o}=i(268)),t.exports=function(){var t,e,i,n,s,l,a,u,c,f,h,d;for(u={},s=l=0,a=arguments.length;l<a;s=++l)if(d=typeof(t=arguments[s]),null===t?d="null":"object"===d&&Array.isArray(t)&&(d="array"),"array"===d)c=t;else if("object"===d)u=o(t);else if("function"===d)n&&s===arguments.length-1?e=t:n=t;else if("null"!==d)throw new Error(`Invalid Arguments: got ${JSON.stringify(t)} at position ${s}`);return h=new r(u,n),i=!1,c&&setImmediate((function(){var t,e,r;for(t=0,e=c.length;t<e&&(r=c[t],!i);t++)h.write(r);return h.end()})),(e||u.consume)&&(f=[],h.on("readable",(function(){var t,i;for(i=[];t=h.read();)e?i.push(f.push(t)):i.push(void 0);return i})),h.on("error",(function(t){if(i=!0,e)return e(t)})),h.on("end",(function(){if(e&&!i)return e(null,f)}))),h},r=function(t={},e){var i,r;return this.options=t,this.handler=e,null==(i=this.options).consume&&(i.consume=!1),this.options.objectMode=!0,null==(r=this.options).parallel&&(r.parallel=100),n.Transform.call(this,this.options),this.state={running:0,started:0,finished:0},this},s.inherits(r,n.Transform),t.exports.Transformer=r,r.prototype._transform=function(t,e,i){var r,o,n;this.state.started++,this.state.running++,this.state.running<this.options.parallel&&(i(),i=null);try{if(n=this.handler.length,null!=this.options.params&&n--,1===n)this.__done(null,[this.handler.call(this,t,this.options.params)],i);else{if(2!==n)throw Error("Invalid handler arguments");r=(t,...e)=>this.__done(t,e,i),this.handler.call(this,t,r,this.options.params)}return!1}catch(t){return o=t,this.__done(o)}},r.prototype._flush=function(t){return this._ending=function(){if(0===this.state.running)return this._ending=void 0,t()},this._ending()},r.prototype.__done=function(t,e,i){var r,o,n;if(this.state.running--,t)return this.emit("error",t);for(this.state.finished++,o=0,n=e.length;o<n;o++)"number"==typeof(r=e[o])&&(r=`${r}`),null!=r&&""!==r&&this.push(r);return i&&i(),this._ending?this._ending():void 0}},237:(t,e,i)=>{const r=i(514),o=i(370);t.exports={packageName:"dbgate-plugin-csv",shellApi:{reader:r,writer:o},initialize(t){r.initialize(t)}}},514:(t,e,i)=>{const r=i(613),o=i(888),n=i(896),s=i(203);let l;class a extends s.Transform{constructor({header:t}){super({objectMode:!0}),this.structure=null,this.header=t}_transform(t,e,i){this.structure?(this.push(r(this.structure.columns.map((t=>t.columnName)),t)),i()):(this.header?(this.structure={__isStreamHeader:!0,columns:t.map((t=>({columnName:t})))},this.push(this.structure)):(this.structure={__isStreamHeader:!0,columns:t.map(((t,e)=>({columnName:`col${e+1}`})))},this.push(this.structure),this.push(r(this.structure.columns.map((t=>t.columnName)),t))),i())}}async function u({fileName:t,encoding:e="utf-8",header:i=!0,delimiter:r,limitRows:s}){console.log(`Reading file ${t}`);const u=o.parse({delimiter:r,skip_lines_with_error:!0,to_line:s?s+1:void 0}),c=await l.download(t),f=n.createReadStream(c,e),h=new a({header:i});return f.pipe(u),u.pipe(h),h}u.initialize=t=>{l=t.dbgateApi},t.exports=u},370:(t,e,i)=>{const r=i(888),o=i(896),n=i(203),{getLogger:s}=global.DBGATE_PACKAGES["dbgate-tools"],l=s("csvWriter");class a extends n.Transform{constructor({header:t}){super({objectMode:!0}),this.structure=null,this.header=t}_transform(t,e,i){this.structure?(this.push(this.structure.columns.map((e=>t[e.columnName]))),i()):(this.structure=t,this.header&&this.push(t.columns.map((t=>t.columnName))),i())}}t.exports=async function({fileName:t,encoding:e="utf-8",header:i=!0,delimiter:n,quoted:s}){l.info(`Writing file ${t}`);const u=new a({header:i}),c=r.stringify({delimiter:n,quoted:s}),f=o.createWriteStream(t,e);return u.pipe(c),c.pipe(f),u.finisher=f,u.requireFixedStructure=!0,u}},896:t=>{"use strict";t.exports=require("fs")},203:t=>{"use strict";t.exports=require("stream")},23:t=>{"use strict";t.exports=require("util")},268:(t,e)=>{"use strict";function i(t){return i="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},i(t)}function r(t){return Array.isArray(t)?t.map((function(t){return r(t)})):t&&"object"===i(t)?o({},t):t}function o(){for(var t=arguments[0],e=1;e<arguments.length;e++){var i=arguments[e];if(s(i)){s(t)||(t={});for(var n=0,l=Object.keys(i);n<l.length;n++){var a=l[n];/__proto__|prototype/.test(a)||(t[a]=o(t[a],i[a]))}}else Array.isArray(i)?t=i.map((function(t){return r(t)})):void 0!==i&&(t=i)}return t}function n(t){return t.replace(/([a-z\d])([A-Z]+)/g,"$1_$2").replace(/[-\s]+/g,"_").toLowerCase()}function s(t){var e=t;if("object"!==i(t)||null===t)return!1;if(null===Object.getPrototypeOf(e))return!0;for(;null!==Object.getPrototypeOf(e=Object.getPrototypeOf(e)););return Object.getPrototypeOf(t)===e}e.clone=r,e.compare=function t(e,i){if(s(e)){if(!s(i))return!1;var r=Object.keys(e).sort(),o=Object.keys(i).sort();if(r.length!==o.length)return!1;for(var n=0;n<r.length;n++){var l=r[n];if(l!==o[n])return!1;if(!t(e[l],i[l]))return!1}}else if(Array.isArray(e)){if(!Array.isArray(i))return!1;if(e.length!==i.length)return!1;for(var a=0;a<e.length;a++)if(!t(e[a],i[a]))return!1}else if(e!==i)return!1;return!0},e.is_object=function(t){return t&&"object"===i(t)&&!Array.isArray(t)},e.is_object_literal=s,e.merge=function(){return o.apply(void 0,[{}].concat(Array.prototype.slice.call(arguments)))},e.mutate=o,e.snake_case=function t(e){var i=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],r={};if(s(e))for(var o="number"==typeof i&&i>0?i-1:i,l=0,a=Object.keys(e);l<a.length;l++){var u=a[l],c=e[u];i&&(u=n(u)),r[u]=t(c,o)}else r=e;return r},e.snake_case_str=n}},e={},r=function i(r){var o=e[r];if(void 0!==o)return o.exports;var n=e[r]={exports:{}};return t[r](n,n.exports,i),n.exports}(237);module.exports=r})(); | ||
(()=>{var t={918:(t,e,i)=>{"use strict";var n=i(896),o=i(193).StringDecoder;function r(t,e,i){var r;if(e instanceof Function&&(i=e,e=void 0),"function"==typeof t.read)r=t;else{if(!("string"==typeof t||t instanceof String))return void i(new Error("Invalid file argument for LineReader.open. Must be filename or stream."));r=n.createReadStream(t)}r.pause(),function(t,e,i){e instanceof Function&&(i=e,e=void 0),e||(e={});var n,r,s,l=e.encoding||"utf8",a=e.separator||/\r\n?|\n/,u=e.bufferSize||1024,f="",c=new o(l),d=!1,h=!1,_=-1,m=!1;function p(){return t}function g(e){d||(d=!0,"function"==typeof t.close&&t.close(),setImmediate(e))}function b(t){g((function(e){return i(t||e)}))}function v(){return!d}function y(){return d}function w(){r&&(r(),r=null)}function O(e){!function(t){m?t():r=t}((function(){var i;try{i=t.read(u)}catch(t){e(t)}i?f+=c.write(i.slice(0,i.length)):m=!1,e()}))}function I(){return s(),_<0&&!h}function S(t,e,i){t()?e((function(n){n?i(n):setImmediate(S,t,e,i)})):i()}function N(t){S(I,O,t)}function x(){return f.length>0||!h}function E(t){if(d)return t(new Error("LineReader has been closed"));function e(e){if(e)return t(e);_<0&&h&&(_=f.length);var i=f.substring(0,_);f=f.substring(_+n),_=-1,t(void 0,i)}if(s(),_<0)if(h){if(!x())return t(new Error("No more lines to read."));_=f.length,e()}else N(e);else e()}a instanceof RegExp?s=function(){var t=a.exec(f);t&&(t.index+t[0].length<f.length||h)?(_=t.index,n=t[0].length):(_=-1,n=0)}:(n=a.length,s=function(){_=f.indexOf(a)}),t.on("readable",(function(){m=!0,w()})),t.on("end",(function(){h=!0,w()})),t.on("error",b),N((function(t){if(!t)return i(void 0,{hasNextLine:x,nextLine:E,close:g,isOpen:v,isClosed:y,getReadStream:p});b(t)}))}(r,e,i)}t.exports.open=r,t.exports.eachLine=function(t,e,i,n){e instanceof Function&&(n=i,i=e,e=void 0);var o,s,l=3===i.length;return r(t,e,(function(t,e){function r(t){e.close((function(e){n&&n(t||e)}))}function a(){e.hasNextLine()?setImmediate(f):r()}function u(t){!1!==t?a():r()}function f(){e.nextLine((function(t,n){t&&r(t);var o=!e.hasNextLine();l?i(n,o,u):!1!==i(n,o)?a():r()}))}o=e,s&&s(e),t?n&&n(t):a()})),{getReader:function(t){o?t(o):s=t}}}},432:(t,e,i)=>{var n=i(36).Symbol;t.exports=n},312:(t,e,i)=>{var n=i(571),o=i(679),r=Object.prototype.hasOwnProperty;t.exports=function(t,e,i){var s=t[e];r.call(t,e)&&o(s,i)&&(void 0!==i||e in t)||n(t,e,i)}},571:(t,e,i)=>{var n=i(133);t.exports=function(t,e,i){"__proto__"==e&&n?n(t,e,{configurable:!0,enumerable:!0,value:i,writable:!0}):t[e]=i}},77:(t,e,i)=>{var n=i(432),o=i(444),r=i(371),s=n?n.toStringTag:void 0;t.exports=function(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":s&&s in Object(t)?o(t):r(t)}},950:(t,e,i)=>{var n=i(553),o=i(909),r=i(130),s=i(760),l=/^\[object .+?Constructor\]$/,a=Function.prototype,u=Object.prototype,f=a.toString,c=u.hasOwnProperty,d=RegExp("^"+f.call(c).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");t.exports=function(t){return!(!r(t)||o(t))&&(n(t)?d:l).test(s(t))}},141:t=>{t.exports=function(t,e,i){for(var n=-1,o=t.length,r=e.length,s={};++n<o;){var l=n<r?e[n]:void 0;i(s,t[n],l)}return s}},780:(t,e,i)=>{var n=i(36)["__core-js_shared__"];t.exports=n},133:(t,e,i)=>{var n=i(789),o=function(){try{var t=n(Object,"defineProperty");return t({},"",{}),t}catch(t){}}();t.exports=o},565:t=>{var e="object"==typeof global&&global&&global.Object===Object&&global;t.exports=e},789:(t,e,i)=>{var n=i(950),o=i(869);t.exports=function(t,e){var i=o(t,e);return n(i)?i:void 0}},444:(t,e,i)=>{var n=i(432),o=Object.prototype,r=o.hasOwnProperty,s=o.toString,l=n?n.toStringTag:void 0;t.exports=function(t){var e=r.call(t,l),i=t[l];try{t[l]=void 0;var n=!0}catch(t){}var o=s.call(t);return n&&(e?t[l]=i:delete t[l]),o}},869:t=>{t.exports=function(t,e){return null==t?void 0:t[e]}},909:(t,e,i)=>{var n,o=i(780),r=(n=/[^.]+$/.exec(o&&o.keys&&o.keys.IE_PROTO||""))?"Symbol(src)_1."+n:"";t.exports=function(t){return!!r&&r in t}},371:t=>{var e=Object.prototype.toString;t.exports=function(t){return e.call(t)}},36:(t,e,i)=>{var n=i(565),o="object"==typeof self&&self&&self.Object===Object&&self,r=n||o||Function("return this")();t.exports=r},760:t=>{var e=Function.prototype.toString;t.exports=function(t){if(null!=t){try{return e.call(t)}catch(t){}try{return t+""}catch(t){}}return""}},679:t=>{t.exports=function(t,e){return t===e||t!=t&&e!=e}},553:(t,e,i)=>{var n=i(77),o=i(130);t.exports=function(t){if(!o(t))return!1;var e=n(t);return"[object Function]"==e||"[object GeneratorFunction]"==e||"[object AsyncFunction]"==e||"[object Proxy]"==e}},130:t=>{t.exports=function(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}},613:(t,e,i)=>{var n=i(312),o=i(141);t.exports=function(t,e){return o(t||[],e||[],n)}},237:(t,e,i)=>{const n=i(514),o=i(370);t.exports={packageName:"dbgate-plugin-csv",shellApi:{reader:n,writer:o},initialize(t){n.initialize(t)}}},514:(t,e,i)=>{const n=i(613),o=i(836),r=i(896),s=i(203),l=i(918);let a;class u extends s.Transform{constructor({header:t}){super({objectMode:!0}),this.structure=null,this.header=t}_transform(t,e,i){this.structure?(this.push(n(this.structure.columns.map((t=>t.columnName)),t)),i()):(this.header?(this.structure={__isStreamHeader:!0,columns:t.map((t=>({columnName:t})))},this.push(this.structure)):(this.structure={__isStreamHeader:!0,columns:t.map(((t,e)=>({columnName:`col${e+1}`})))},this.push(this.structure),this.push(n(this.structure.columns.map((t=>t.columnName)),t))),i())}}async function f({fileName:t,encoding:e="utf-8",header:i=!0,delimiter:n,limitRows:s}){console.log(`Reading file ${t}`);const f=await a.download(t);if(!n){const t=await(c=f,new Promise(((t,e)=>{l.open(c,((i,n)=>{i?e(i):n.hasNextLine()?n.nextLine(((i,o)=>{i?n.close((()=>e(i))):n.close((()=>t(o)))})):n.close((()=>t(null)))}))})));if(t){const e={",":t.replace(/[^,]/g,"").length,";":t.replace(/[^;]/g,"").length,"|":t.replace(/[^|]/g,"").length};n=Object.keys(e).reduce(((t,i)=>e[t]>e[i]?t:i),",")}}var c;const d=o.parse({delimiter:n,skip_lines_with_error:!0,to_line:s?s+1:void 0,ltrim:!0}),h=r.createReadStream(f,e),_=new u({header:i});return h.pipe(d),d.pipe(_),_}f.initialize=t=>{a=t.dbgateApi},t.exports=f},370:(t,e,i)=>{const n=i(836),o=i(896),r=i(203),{getLogger:s}=global.DBGATE_PACKAGES["dbgate-tools"],l=s("csvWriter");class a extends r.Transform{constructor({header:t}){super({objectMode:!0}),this.structure=null,this.header=t}_transform(t,e,i){this.structure?(this.push(this.structure.columns.map((e=>t[e.columnName]))),i()):(this.structure=t,this.header&&this.push(t.columns.map((t=>t.columnName))),i())}}t.exports=async function({fileName:t,encoding:e="utf-8",header:i=!0,delimiter:r,quoted:s}){l.info(`Writing file ${t}`);const u=new a({header:i}),f=n.stringify({delimiter:r,quoted:s}),c=o.createWriteStream(t,e);return u.pipe(f),f.pipe(c),u.finisher=c,u.requireFixedStructure=!0,u}},896:t=>{"use strict";t.exports=require("fs")},203:t=>{"use strict";t.exports=require("stream")},193:t=>{"use strict";t.exports=require("string_decoder")},23:t=>{"use strict";t.exports=require("util")},836:(t,e,i)=>{"use strict";var n=i(203),o=i(23);const r=function(t={}){return t.seed?t.seed=t.seed*Math.PI*100%100/100:Math.random()},s={ascii:function({options:t}){const e=[],i=Math.ceil(r(t)*t.maxWordLength);for(let n=0;n<i;n++){const i=Math.floor(32*r(t));e.push(String.fromCharCode(i+(i<16?65:81)))}return e.join("")},int:function({options:t}){return Math.floor(r(t)*Math.pow(2,52))},bool:function({options:t}){return Math.floor(2*r(t))}},l=function(t={}){return this.options=(t=>{t.object_mode&&(t.objectMode=t.object_mode),t.high_water_mark&&(t.highWaterMark=t.high_water_mark);const e={};for(const n in t)e[(i=n,i.replace(/_([a-z])/gi,(function(t,e){return e.toUpperCase()})))]=t[n];var i;const n={columns:8,delimiter:",",duration:null,encoding:null,end:null,eof:!1,fixedSize:!1,length:-1,maxWordLength:16,rowDelimiter:"\n",seed:!1,sleep:0};for(const t in n)void 0===e[t]&&(e[t]=n[t]);!0===e.eof&&(e.eof=e.rowDelimiter),"number"==typeof e.columns&&(e.columns=new Array(e.columns));const o=Object.keys(s).filter((t=>!["super_","camelize"].includes(t)));for(let t=0;t<e.columns.length;t++){const i=e.columns[t]||"ascii";if("string"==typeof i){if(!o.includes(i))throw Error(`Invalid column type: got "${i}", default values are ${JSON.stringify(o)}`);e.columns[t]=s[i]}}return e})(t),n.Readable.call(this,this.options),this.state=(t=>({start_time:this.options.duration?Date.now():null,fixed_size_buffer:"",count_written:0,count_created:0}))(),this};o.inherits(l,n.Readable),l.prototype.end=function(){this.push(null)},l.prototype._read=function(t){setImmediate((()=>{this.__read(t)}))},l.prototype.__read=function(t){((t,e,i,n,o)=>{const r=[];let s=0;for(t.fixedSize&&(s=e.fixed_size_buffer.length,0!==s&&r.push(e.fixed_size_buffer));;){if(e.count_created===t.length||t.end&&Date.now()>t.end||t.duration&&Date.now()>e.start_time+t.duration){if(r.length){if(t.objectMode)for(const t of r)n(t);else n(r.join("")+(t.eof?t.eof:""));e.end=!0}else o();return}let l,a=[];for(const i of t.columns){const n=i({options:t,state:e}),r=typeof n;if(null!==n&&"string"!==r&&"number"!==r)return void o(Error(["INVALID_VALUE:","values returned by column function must be","a string, a number or null,",`got ${JSON.stringify(n)}`].join(" ")));a.push(n)}if(t.objectMode){l=0;for(const t of a)l+=t.length}else a=(0===e.count_created?"":t.rowDelimiter)+a.join(t.delimiter),l=a.length;if(e.count_created++,s+l>i){if(t.objectMode){r.push(a);for(const t of r)n(t)}else t.fixedSize?(e.fixed_size_buffer=a.substr(i-s),r.push(a.substr(0,i-s))):r.push(a),n(r.join(""));return}s+=l,r.push(a)}})(this.options,this.state,t,(t=>{this.__push(t)}),(t=>{t?this.destroy(t):this.push(null)}))},l.prototype.__push=function(t){const e=()=>{if(this.state.count_written++,this.push(t),!0===this.state.end)return this.push(null)};this.options.sleep>0?setTimeout(e,this.options.sleep):e()};const a=function(t){return"object"==typeof t&&null!==t&&!Array.isArray(t)};let u=class t extends Error{constructor(e,i,n,...o){Array.isArray(i)&&(i=i.join(" ").trim()),super(i),void 0!==Error.captureStackTrace&&Error.captureStackTrace(this,t),this.code=e;for(const t of o)for(const e in t){const i=t[e];this[e]=Buffer.isBuffer(i)?i.toString(n.encoding):null==i?i:JSON.parse(JSON.stringify(i))}}};const f=function(t){const e=[];for(let i=0,n=t.length;i<n;i++){const n=t[i];if(null==n||!1===n)e[i]={disabled:!0};else if("string"==typeof n)e[i]={name:n};else{if(!a(n))throw new u("CSV_INVALID_COLUMN_DEFINITION",["Invalid column definition:","expect a string or a literal object,",`got ${JSON.stringify(n)} at position ${i}`]);if("string"!=typeof n.name)throw new u("CSV_OPTION_COLUMNS_MISSING_NAME",["Option columns missing name:",`property "name" is required at position ${i}`,"when column is an object literal"]);e[i]=n}}return e};class c{constructor(t=100){this.size=t,this.length=0,this.buf=Buffer.allocUnsafe(t)}prepend(t){if(Buffer.isBuffer(t)){const e=this.length+t.length;if(e>=this.size&&(this.resize(),e>=this.size))throw Error("INVALID_BUFFER_STATE");const i=this.buf;this.buf=Buffer.allocUnsafe(this.size),t.copy(this.buf,0),i.copy(this.buf,t.length),this.length+=t.length}else{const e=this.length++;e===this.size&&this.resize();const i=this.clone();this.buf[0]=t,i.copy(this.buf,1,0,e)}}append(t){const e=this.length++;e===this.size&&this.resize(),this.buf[e]=t}clone(){return Buffer.from(this.buf.slice(0,this.length))}resize(){const t=this.length;this.size=2*this.size;const e=Buffer.allocUnsafe(this.size);this.buf.copy(e,0,0,t),this.buf=e}toString(t){return t?this.buf.slice(0,this.length).toString(t):Uint8Array.prototype.slice.call(this.buf.slice(0,this.length))}toJSON(){return this.toString("utf8")}reset(){this.length=0}}const d=function(t){return{bomSkipped:!1,bufBytesStart:0,castField:t.cast_function,commenting:!1,error:void 0,enabled:1===t.from_line,escaping:!1,escapeIsQuote:Buffer.isBuffer(t.escape)&&Buffer.isBuffer(t.quote)&&0===Buffer.compare(t.escape,t.quote),expectedRecordLength:Array.isArray(t.columns)?t.columns.length:void 0,field:new c(20),firstLineToHeaders:t.cast_first_line_to_header,needMoreDataSize:Math.max(null!==t.comment?t.comment.length:0,...t.delimiter.map((t=>t.length)),null!==t.quote?t.quote.length:0),previousBuf:void 0,quoting:!1,stop:!1,rawBuffer:new c(100),record:[],recordHasError:!1,record_length:0,recordDelimiterMaxLength:0===t.record_delimiter.length?0:Math.max(...t.record_delimiter.map((t=>t.length))),trimChars:[Buffer.from(" ",t.encoding)[0],Buffer.from("\t",t.encoding)[0]],wasQuoting:!1,wasRowDelimiter:!1,timchars:[Buffer.from(Buffer.from([13],"utf8").toString(),t.encoding),Buffer.from(Buffer.from([10],"utf8").toString(),t.encoding),Buffer.from(Buffer.from([12],"utf8").toString(),t.encoding),Buffer.from(Buffer.from([32],"utf8").toString(),t.encoding),Buffer.from(Buffer.from([9],"utf8").toString(),t.encoding)]}},h=function(t){const e={};for(const n in t)e[(i=n,i.replace(/([A-Z])/g,(function(t,e){return"_"+e.toLowerCase()})))]=t[n];var i;if(void 0===e.encoding||!0===e.encoding)e.encoding="utf8";else if(null===e.encoding||!1===e.encoding)e.encoding=null;else if("string"!=typeof e.encoding&&null!==e.encoding)throw new u("CSV_INVALID_OPTION_ENCODING",["Invalid option encoding:","encoding must be a string or null to return a buffer,",`got ${JSON.stringify(e.encoding)}`],e);if(void 0===e.bom||null===e.bom||!1===e.bom)e.bom=!1;else if(!0!==e.bom)throw new u("CSV_INVALID_OPTION_BOM",["Invalid option bom:","bom must be true,",`got ${JSON.stringify(e.bom)}`],e);if(e.cast_function=null,void 0===e.cast||null===e.cast||!1===e.cast||""===e.cast)e.cast=void 0;else if("function"==typeof e.cast)e.cast_function=e.cast,e.cast=!0;else if(!0!==e.cast)throw new u("CSV_INVALID_OPTION_CAST",["Invalid option cast:","cast must be true or a function,",`got ${JSON.stringify(e.cast)}`],e);if(void 0===e.cast_date||null===e.cast_date||!1===e.cast_date||""===e.cast_date)e.cast_date=!1;else if(!0===e.cast_date)e.cast_date=function(t){const e=Date.parse(t);return isNaN(e)?t:new Date(e)};else if("function"!=typeof e.cast_date)throw new u("CSV_INVALID_OPTION_CAST_DATE",["Invalid option cast_date:","cast_date must be true or a function,",`got ${JSON.stringify(e.cast_date)}`],e);if(e.cast_first_line_to_header=null,!0===e.columns)e.cast_first_line_to_header=void 0;else if("function"==typeof e.columns)e.cast_first_line_to_header=e.columns,e.columns=!0;else if(Array.isArray(e.columns))e.columns=f(e.columns);else{if(void 0!==e.columns&&null!==e.columns&&!1!==e.columns)throw new u("CSV_INVALID_OPTION_COLUMNS",["Invalid option columns:","expect an array, a function or true,",`got ${JSON.stringify(e.columns)}`],e);e.columns=!1}if(void 0===e.group_columns_by_name||null===e.group_columns_by_name||!1===e.group_columns_by_name)e.group_columns_by_name=!1;else{if(!0!==e.group_columns_by_name)throw new u("CSV_INVALID_OPTION_GROUP_COLUMNS_BY_NAME",["Invalid option group_columns_by_name:","expect an boolean,",`got ${JSON.stringify(e.group_columns_by_name)}`],e);if(!1===e.columns)throw new u("CSV_INVALID_OPTION_GROUP_COLUMNS_BY_NAME",["Invalid option group_columns_by_name:","the `columns` mode must be activated."],e)}if(void 0===e.comment||null===e.comment||!1===e.comment||""===e.comment)e.comment=null;else if("string"==typeof e.comment&&(e.comment=Buffer.from(e.comment,e.encoding)),!Buffer.isBuffer(e.comment))throw new u("CSV_INVALID_OPTION_COMMENT",["Invalid option comment:","comment must be a buffer or a string,",`got ${JSON.stringify(e.comment)}`],e);if(void 0===e.comment_no_infix||null===e.comment_no_infix||!1===e.comment_no_infix)e.comment_no_infix=!1;else if(!0!==e.comment_no_infix)throw new u("CSV_INVALID_OPTION_COMMENT",["Invalid option comment_no_infix:","value must be a boolean,",`got ${JSON.stringify(e.comment_no_infix)}`],e);const n=JSON.stringify(e.delimiter);if(Array.isArray(e.delimiter)||(e.delimiter=[e.delimiter]),0===e.delimiter.length)throw new u("CSV_INVALID_OPTION_DELIMITER",["Invalid option delimiter:","delimiter must be a non empty string or buffer or array of string|buffer,",`got ${n}`],e);if(e.delimiter=e.delimiter.map((function(t){if(null==t||!1===t)return Buffer.from(",",e.encoding);if("string"==typeof t&&(t=Buffer.from(t,e.encoding)),!Buffer.isBuffer(t)||0===t.length)throw new u("CSV_INVALID_OPTION_DELIMITER",["Invalid option delimiter:","delimiter must be a non empty string or buffer or array of string|buffer,",`got ${n}`],e);return t})),void 0===e.escape||!0===e.escape?e.escape=Buffer.from('"',e.encoding):"string"==typeof e.escape?e.escape=Buffer.from(e.escape,e.encoding):null!==e.escape&&!1!==e.escape||(e.escape=null),null!==e.escape&&!Buffer.isBuffer(e.escape))throw new Error(`Invalid Option: escape must be a buffer, a string or a boolean, got ${JSON.stringify(e.escape)}`);if(void 0===e.from||null===e.from)e.from=1;else{if("string"==typeof e.from&&/\d+/.test(e.from)&&(e.from=parseInt(e.from)),!Number.isInteger(e.from))throw new Error(`Invalid Option: from must be an integer, got ${JSON.stringify(e.from)}`);if(e.from<0)throw new Error(`Invalid Option: from must be a positive integer, got ${JSON.stringify(t.from)}`)}if(void 0===e.from_line||null===e.from_line)e.from_line=1;else{if("string"==typeof e.from_line&&/\d+/.test(e.from_line)&&(e.from_line=parseInt(e.from_line)),!Number.isInteger(e.from_line))throw new Error(`Invalid Option: from_line must be an integer, got ${JSON.stringify(t.from_line)}`);if(e.from_line<=0)throw new Error(`Invalid Option: from_line must be a positive integer greater than 0, got ${JSON.stringify(t.from_line)}`)}if(void 0===e.ignore_last_delimiters||null===e.ignore_last_delimiters)e.ignore_last_delimiters=!1;else if("number"==typeof e.ignore_last_delimiters)e.ignore_last_delimiters=Math.floor(e.ignore_last_delimiters),0===e.ignore_last_delimiters&&(e.ignore_last_delimiters=!1);else if("boolean"!=typeof e.ignore_last_delimiters)throw new u("CSV_INVALID_OPTION_IGNORE_LAST_DELIMITERS",["Invalid option `ignore_last_delimiters`:","the value must be a boolean value or an integer,",`got ${JSON.stringify(e.ignore_last_delimiters)}`],e);if(!0===e.ignore_last_delimiters&&!1===e.columns)throw new u("CSV_IGNORE_LAST_DELIMITERS_REQUIRES_COLUMNS",["The option `ignore_last_delimiters`","requires the activation of the `columns` option"],e);if(void 0===e.info||null===e.info||!1===e.info)e.info=!1;else if(!0!==e.info)throw new Error(`Invalid Option: info must be true, got ${JSON.stringify(e.info)}`);if(void 0===e.max_record_size||null===e.max_record_size||!1===e.max_record_size)e.max_record_size=0;else if(Number.isInteger(e.max_record_size)&&e.max_record_size>=0);else{if("string"!=typeof e.max_record_size||!/\d+/.test(e.max_record_size))throw new Error(`Invalid Option: max_record_size must be a positive integer, got ${JSON.stringify(e.max_record_size)}`);e.max_record_size=parseInt(e.max_record_size)}if(void 0===e.objname||null===e.objname||!1===e.objname)e.objname=void 0;else if(Buffer.isBuffer(e.objname)){if(0===e.objname.length)throw new Error("Invalid Option: objname must be a non empty buffer");null===e.encoding||(e.objname=e.objname.toString(e.encoding))}else if("string"==typeof e.objname){if(0===e.objname.length)throw new Error("Invalid Option: objname must be a non empty string")}else if("number"!=typeof e.objname)throw new Error(`Invalid Option: objname must be a string or a buffer, got ${e.objname}`);if(void 0!==e.objname)if("number"==typeof e.objname){if(!1!==e.columns)throw Error("Invalid Option: objname index cannot be combined with columns or be defined as a field")}else if(!1===e.columns)throw Error("Invalid Option: objname field must be combined with columns or be defined as an index");if(void 0===e.on_record||null===e.on_record)e.on_record=void 0;else if("function"!=typeof e.on_record)throw new u("CSV_INVALID_OPTION_ON_RECORD",["Invalid option `on_record`:","expect a function,",`got ${JSON.stringify(e.on_record)}`],e);if(void 0!==e.on_skip&&null!==e.on_skip&&"function"!=typeof e.on_skip)throw new Error(`Invalid Option: on_skip must be a function, got ${JSON.stringify(e.on_skip)}`);if(null===e.quote||!1===e.quote||""===e.quote)e.quote=null;else if(void 0===e.quote||!0===e.quote?e.quote=Buffer.from('"',e.encoding):"string"==typeof e.quote&&(e.quote=Buffer.from(e.quote,e.encoding)),!Buffer.isBuffer(e.quote))throw new Error(`Invalid Option: quote must be a buffer or a string, got ${JSON.stringify(e.quote)}`);if(void 0===e.raw||null===e.raw||!1===e.raw)e.raw=!1;else if(!0!==e.raw)throw new Error(`Invalid Option: raw must be true, got ${JSON.stringify(e.raw)}`);if(void 0===e.record_delimiter)e.record_delimiter=[];else if("string"==typeof e.record_delimiter||Buffer.isBuffer(e.record_delimiter)){if(0===e.record_delimiter.length)throw new u("CSV_INVALID_OPTION_RECORD_DELIMITER",["Invalid option `record_delimiter`:","value must be a non empty string or buffer,",`got ${JSON.stringify(e.record_delimiter)}`],e);e.record_delimiter=[e.record_delimiter]}else if(!Array.isArray(e.record_delimiter))throw new u("CSV_INVALID_OPTION_RECORD_DELIMITER",["Invalid option `record_delimiter`:","value must be a string, a buffer or array of string|buffer,",`got ${JSON.stringify(e.record_delimiter)}`],e);if(e.record_delimiter=e.record_delimiter.map((function(t,i){if("string"!=typeof t&&!Buffer.isBuffer(t))throw new u("CSV_INVALID_OPTION_RECORD_DELIMITER",["Invalid option `record_delimiter`:","value must be a string, a buffer or array of string|buffer",`at index ${i},`,`got ${JSON.stringify(t)}`],e);if(0===t.length)throw new u("CSV_INVALID_OPTION_RECORD_DELIMITER",["Invalid option `record_delimiter`:","value must be a non empty string or buffer",`at index ${i},`,`got ${JSON.stringify(t)}`],e);return"string"==typeof t&&(t=Buffer.from(t,e.encoding)),t})),"boolean"==typeof e.relax_column_count);else{if(void 0!==e.relax_column_count&&null!==e.relax_column_count)throw new Error(`Invalid Option: relax_column_count must be a boolean, got ${JSON.stringify(e.relax_column_count)}`);e.relax_column_count=!1}if("boolean"==typeof e.relax_column_count_less);else{if(void 0!==e.relax_column_count_less&&null!==e.relax_column_count_less)throw new Error(`Invalid Option: relax_column_count_less must be a boolean, got ${JSON.stringify(e.relax_column_count_less)}`);e.relax_column_count_less=!1}if("boolean"==typeof e.relax_column_count_more);else{if(void 0!==e.relax_column_count_more&&null!==e.relax_column_count_more)throw new Error(`Invalid Option: relax_column_count_more must be a boolean, got ${JSON.stringify(e.relax_column_count_more)}`);e.relax_column_count_more=!1}if("boolean"==typeof e.relax_quotes);else{if(void 0!==e.relax_quotes&&null!==e.relax_quotes)throw new Error(`Invalid Option: relax_quotes must be a boolean, got ${JSON.stringify(e.relax_quotes)}`);e.relax_quotes=!1}if("boolean"==typeof e.skip_empty_lines);else{if(void 0!==e.skip_empty_lines&&null!==e.skip_empty_lines)throw new Error(`Invalid Option: skip_empty_lines must be a boolean, got ${JSON.stringify(e.skip_empty_lines)}`);e.skip_empty_lines=!1}if("boolean"==typeof e.skip_records_with_empty_values);else{if(void 0!==e.skip_records_with_empty_values&&null!==e.skip_records_with_empty_values)throw new Error(`Invalid Option: skip_records_with_empty_values must be a boolean, got ${JSON.stringify(e.skip_records_with_empty_values)}`);e.skip_records_with_empty_values=!1}if("boolean"==typeof e.skip_records_with_error);else{if(void 0!==e.skip_records_with_error&&null!==e.skip_records_with_error)throw new Error(`Invalid Option: skip_records_with_error must be a boolean, got ${JSON.stringify(e.skip_records_with_error)}`);e.skip_records_with_error=!1}if(void 0===e.rtrim||null===e.rtrim||!1===e.rtrim)e.rtrim=!1;else if(!0!==e.rtrim)throw new Error(`Invalid Option: rtrim must be a boolean, got ${JSON.stringify(e.rtrim)}`);if(void 0===e.ltrim||null===e.ltrim||!1===e.ltrim)e.ltrim=!1;else if(!0!==e.ltrim)throw new Error(`Invalid Option: ltrim must be a boolean, got ${JSON.stringify(e.ltrim)}`);if(void 0===e.trim||null===e.trim||!1===e.trim)e.trim=!1;else if(!0!==e.trim)throw new Error(`Invalid Option: trim must be a boolean, got ${JSON.stringify(e.trim)}`);if(!0===e.trim&&!1!==t.ltrim?e.ltrim=!0:!0!==e.ltrim&&(e.ltrim=!1),!0===e.trim&&!1!==t.rtrim?e.rtrim=!0:!0!==e.rtrim&&(e.rtrim=!1),void 0===e.to||null===e.to)e.to=-1;else{if("string"==typeof e.to&&/\d+/.test(e.to)&&(e.to=parseInt(e.to)),!Number.isInteger(e.to))throw new Error(`Invalid Option: to must be an integer, got ${JSON.stringify(t.to)}`);if(e.to<=0)throw new Error(`Invalid Option: to must be a positive integer greater than 0, got ${JSON.stringify(t.to)}`)}if(void 0===e.to_line||null===e.to_line)e.to_line=-1;else{if("string"==typeof e.to_line&&/\d+/.test(e.to_line)&&(e.to_line=parseInt(e.to_line)),!Number.isInteger(e.to_line))throw new Error(`Invalid Option: to_line must be an integer, got ${JSON.stringify(t.to_line)}`);if(e.to_line<=0)throw new Error(`Invalid Option: to_line must be a positive integer greater than 0, got ${JSON.stringify(t.to_line)}`)}return e},_=function(t){return t.every((t=>null==t||t.toString&&""===t.toString().trim()))},m={utf8:Buffer.from([239,187,191]),utf16le:Buffer.from([255,254])};class p extends n.Transform{constructor(t={}){super({readableObjectMode:!0,...t,encoding:null}),this.api=function(t={}){const e=h(t);return{info:{bytes:0,comment_lines:0,empty_lines:0,invalid_field_length:0,lines:1,records:0},original_options:t,options:e,state:d(e),__needMoreData:function(t,e,i){if(i)return!1;const{encoding:n,escape:o,quote:r}=this.options,{quoting:s,needMoreDataSize:l,recordDelimiterMaxLength:a}=this.state;return e-t-1<Math.max(l,0===a?Buffer.from("\r\n",n).length:a,s?(null===o?0:o.length)+r.length:0,s?r.length+a:0)},parse:function(t,e,i,n){const{bom:o,comment_no_infix:r,encoding:s,from_line:l,ltrim:a,max_record_size:f,raw:c,relax_quotes:d,rtrim:_,skip_empty_lines:p,to:g,to_line:b}=this.options;let{comment:v,escape:y,quote:w,record_delimiter:O}=this.options;const{bomSkipped:I,previousBuf:S,rawBuffer:N,escapeIsQuote:x}=this.state;let E;if(void 0===S){if(void 0===t)return void n();E=t}else E=void 0!==S&&void 0===t?S:Buffer.concat([S,t]);if(!1===I)if(!1===o)this.state.bomSkipped=!0;else if(E.length<3){if(!1===e)return void(this.state.previousBuf=E)}else{for(const t in m)if(0===m[t].compare(E,0,m[t].length)){const e=m[t].length;this.state.bufBytesStart+=e,E=E.slice(e),this.options=h({...this.original_options,encoding:t}),({comment:v,escape:y,quote:w}=this.options);break}this.state.bomSkipped=!0}const A=E.length;let R;for(R=0;R<A&&!this.__needMoreData(R,A,e);R++){if(!0===this.state.wasRowDelimiter&&(this.info.lines++,this.state.wasRowDelimiter=!1),-1!==b&&this.info.lines>b)return this.state.stop=!0,void n();!1===this.state.quoting&&0===O.length&&this.__autoDiscoverRecordDelimiter(E,R)&&(O=this.options.record_delimiter);const t=E[R];if(!0===c&&N.append(t),13!==t&&10!==t||!1!==this.state.wasRowDelimiter||(this.state.wasRowDelimiter=!0),!0===this.state.escaping)this.state.escaping=!1;else{if(null!==y&&!0===this.state.quoting&&this.__isEscape(E,R,t)&&R+y.length<A){if(!x){this.state.escaping=!0,R+=y.length-1;continue}if(this.__isQuote(E,R+y.length)){this.state.escaping=!0,R+=y.length-1;continue}}if(!1===this.state.commenting&&this.__isQuote(E,R))if(!0===this.state.quoting){const e=E[R+w.length],i=_&&this.__isCharTrimable(E,R+w.length),n=null!==v&&this.__compareBytes(v,E,R+w.length,e),o=this.__isDelimiter(E,R+w.length,e),r=0===O.length?this.__autoDiscoverRecordDelimiter(E,R+w.length):this.__isRecordDelimiter(e,E,R+w.length);if(null!==y&&this.__isEscape(E,R,t)&&this.__isQuote(E,R+y.length))R+=y.length-1;else{if(!e||o||r||n||i){this.state.quoting=!1,this.state.wasQuoting=!0,R+=w.length-1;continue}if(!1===d){const t=this.__error(new u("CSV_INVALID_CLOSING_QUOTE",["Invalid Closing Quote:",`got "${String.fromCharCode(e)}"`,`at line ${this.info.lines}`,"instead of delimiter, record delimiter, trimable character","(if activated) or comment"],this.options,this.__infoField()));if(void 0!==t)return t}else this.state.quoting=!1,this.state.wasQuoting=!0,this.state.field.prepend(w),R+=w.length-1}}else{if(0===this.state.field.length){this.state.quoting=!0,R+=w.length-1;continue}if(!1===d){const t=this.__infoField(),e=Object.keys(m).map((t=>!!m[t].equals(this.state.field.toString())&&t)).filter(Boolean)[0],i=this.__error(new u("INVALID_OPENING_QUOTE",["Invalid Opening Quote:",`a quote is found on field ${JSON.stringify(t.column)} at line ${t.lines}, value is ${JSON.stringify(this.state.field.toString(s))}`,e?`(${e} bom)`:void 0],this.options,t,{field:this.state.field}));if(void 0!==i)return i}}if(!1===this.state.quoting){const e=this.__isRecordDelimiter(t,E,R);if(0!==e){if(this.state.commenting&&!1===this.state.wasQuoting&&0===this.state.record.length&&0===this.state.field.length)this.info.comment_lines++;else{if(!1===this.state.enabled&&this.info.lines+(!0===this.state.wasRowDelimiter?1:0)>=l){this.state.enabled=!0,this.__resetField(),this.__resetRecord(),R+=e-1;continue}if(!0===p&&!1===this.state.wasQuoting&&0===this.state.record.length&&0===this.state.field.length){this.info.empty_lines++,R+=e-1;continue}this.info.bytes=this.state.bufBytesStart+R;const t=this.__onField();if(void 0!==t)return t;this.info.bytes=this.state.bufBytesStart+R+e;const o=this.__onRecord(i);if(void 0!==o)return o;if(-1!==g&&this.info.records>=g)return this.state.stop=!0,void n()}this.state.commenting=!1,R+=e-1;continue}if(this.state.commenting)continue;if(null!==v&&(!1===r||0===this.state.record.length&&0===this.state.field.length)&&0!==this.__compareBytes(v,E,R,t)){this.state.commenting=!0;continue}const o=this.__isDelimiter(E,R,t);if(0!==o){this.info.bytes=this.state.bufBytesStart+R;const t=this.__onField();if(void 0!==t)return t;R+=o-1;continue}}}if(!1===this.state.commenting&&0!==f&&this.state.record_length+this.state.field.length>f)return this.__error(new u("CSV_MAX_RECORD_SIZE",["Max Record Size:","record exceed the maximum number of tolerated bytes",`of ${f}`,`at line ${this.info.lines}`],this.options,this.__infoField()));const e=!1===a||!0===this.state.quoting||0!==this.state.field.length||!this.__isCharTrimable(E,R),o=!1===_||!1===this.state.wasQuoting;if(!0!==e||!0!==o){if(!0!==_||this.__isCharTrimable(E,R)){!1===e&&(R+=this.__isCharTrimable(E,R)-1);continue}return this.__error(new u("CSV_NON_TRIMABLE_CHAR_AFTER_CLOSING_QUOTE",["Invalid Closing Quote:","found non trimable byte after quote",`at line ${this.info.lines}`],this.options,this.__infoField()))}this.state.field.append(t)}if(!0===e)if(!0===this.state.quoting){const t=this.__error(new u("CSV_QUOTE_NOT_CLOSED",["Quote Not Closed:",`the parsing is finished with an opening quote at line ${this.info.lines}`],this.options,this.__infoField()));if(void 0!==t)return t}else if(!0===this.state.wasQuoting||0!==this.state.record.length||0!==this.state.field.length){this.info.bytes=this.state.bufBytesStart+R;const t=this.__onField();if(void 0!==t)return t;const e=this.__onRecord(i);if(void 0!==e)return e}else!0===this.state.wasRowDelimiter?this.info.empty_lines++:!0===this.state.commenting&&this.info.comment_lines++;else this.state.bufBytesStart+=R,this.state.previousBuf=E.slice(R);!0===this.state.wasRowDelimiter&&(this.info.lines++,this.state.wasRowDelimiter=!1)},__onRecord:function(t){const{columns:e,group_columns_by_name:i,encoding:n,info:o,from:r,relax_column_count:s,relax_column_count_less:l,relax_column_count_more:a,raw:f,skip_records_with_empty_values:c}=this.options,{enabled:d,record:h}=this.state;if(!1===d)return this.__resetRecord();const m=h.length;if(!0===e)return!0===c&&_(h)?void this.__resetRecord():this.__firstLineToColumns(h);if(!1===e&&0===this.info.records&&(this.state.expectedRecordLength=m),m!==this.state.expectedRecordLength){const t=!1===e?new u("CSV_RECORD_INCONSISTENT_FIELDS_LENGTH",["Invalid Record Length:",`expect ${this.state.expectedRecordLength},`,`got ${m} on line ${this.info.lines}`],this.options,this.__infoField(),{record:h}):new u("CSV_RECORD_INCONSISTENT_COLUMNS",["Invalid Record Length:",`columns length is ${e.length},`,`got ${m} on line ${this.info.lines}`],this.options,this.__infoField(),{record:h});if(!0===s||!0===l&&m<this.state.expectedRecordLength||!0===a&&m>this.state.expectedRecordLength)this.info.invalid_field_length++,this.state.error=t;else{const e=this.__error(t);if(e)return e}}if(!0===c&&_(h))this.__resetRecord();else{if(!0===this.state.recordHasError)return this.__resetRecord(),void(this.state.recordHasError=!1);if(this.info.records++,1===r||this.info.records>=r){const{objname:r}=this.options;if(!1!==e){const s={};for(let t=0,n=h.length;t<n;t++)void 0===e[t]||e[t].disabled||(!0===i&&void 0!==s[e[t].name]?Array.isArray(s[e[t].name])?s[e[t].name]=s[e[t].name].concat(h[t]):s[e[t].name]=[s[e[t].name],h[t]]:s[e[t].name]=h[t]);if(!0===f||!0===o){const e=Object.assign({record:s},!0===f?{raw:this.state.rawBuffer.toString(n)}:{},!0===o?{info:this.__infoRecord()}:{}),i=this.__push(void 0===r?e:[s[r],e],t);if(i)return i}else{const e=this.__push(void 0===r?s:[s[r],s],t);if(e)return e}}else if(!0===f||!0===o){const e=Object.assign({record:h},!0===f?{raw:this.state.rawBuffer.toString(n)}:{},!0===o?{info:this.__infoRecord()}:{}),i=this.__push(void 0===r?e:[h[r],e],t);if(i)return i}else{const e=this.__push(void 0===r?h:[h[r],h],t);if(e)return e}}this.__resetRecord()}},__firstLineToColumns:function(t){const{firstLineToHeaders:e}=this.state;try{const i=void 0===e?t:e.call(null,t);if(!Array.isArray(i))return this.__error(new u("CSV_INVALID_COLUMN_MAPPING",["Invalid Column Mapping:","expect an array from column function,",`got ${JSON.stringify(i)}`],this.options,this.__infoField(),{headers:i}));const n=f(i);return this.state.expectedRecordLength=n.length,this.options.columns=n,void this.__resetRecord()}catch(t){return t}},__resetRecord:function(){!0===this.options.raw&&this.state.rawBuffer.reset(),this.state.error=void 0,this.state.record=[],this.state.record_length=0},__onField:function(){const{cast:t,encoding:e,rtrim:i,max_record_size:n}=this.options,{enabled:o,wasQuoting:r}=this.state;if(!1===o)return this.__resetField();let s=this.state.field.toString(e);if(!0===i&&!1===r&&(s=s.trimRight()),!0===t){const[t,e]=this.__cast(s);if(void 0!==t)return t;s=e}this.state.record.push(s),0!==n&&"string"==typeof s&&(this.state.record_length+=s.length),this.__resetField()},__resetField:function(){this.state.field.reset(),this.state.wasQuoting=!1},__push:function(t,e){const{on_record:i}=this.options;if(void 0!==i){const e=this.__infoRecord();try{t=i.call(null,t,e)}catch(t){return t}if(null==t)return}e(t)},__cast:function(t){const{columns:e,relax_column_count:i}=this.options;if(!0===Array.isArray(e)&&i&&this.options.columns.length<=this.state.record.length)return[void 0,void 0];if(null!==this.state.castField)try{const e=this.__infoField();return[void 0,this.state.castField.call(null,t,e)]}catch(t){return[t]}if(this.__isFloat(t))return[void 0,parseFloat(t)];if(!1!==this.options.cast_date){const e=this.__infoField();return[void 0,this.options.cast_date.call(null,t,e)]}return[void 0,t]},__isCharTrimable:function(t,e){return((t,e)=>{const{timchars:i}=this.state;t:for(let n=0;n<i.length;n++){const o=i[n];for(let i=0;i<o.length;i++)if(o[i]!==t[e+i])continue t;return o.length}return 0})(t,e)},__isFloat:function(t){return t-parseFloat(t)+1>=0},__compareBytes:function(t,e,i,n){if(t[0]!==n)return 0;const o=t.length;for(let n=1;n<o;n++)if(t[n]!==e[i+n])return 0;return o},__isDelimiter:function(t,e,i){const{delimiter:n,ignore_last_delimiters:o}=this.options;if(!0===o&&this.state.record.length===this.options.columns.length-1)return 0;if(!1!==o&&"number"==typeof o&&this.state.record.length===o-1)return 0;t:for(let o=0;o<n.length;o++){const r=n[o];if(r[0]===i){for(let i=1;i<r.length;i++)if(r[i]!==t[e+i])continue t;return r.length}}return 0},__isRecordDelimiter:function(t,e,i){const{record_delimiter:n}=this.options,o=n.length;t:for(let r=0;r<o;r++){const o=n[r],s=o.length;if(o[0]===t){for(let t=1;t<s;t++)if(o[t]!==e[i+t])continue t;return o.length}}return 0},__isEscape:function(t,e,i){const{escape:n}=this.options;if(null===n)return!1;const o=n.length;if(n[0]===i){for(let i=0;i<o;i++)if(n[i]!==t[e+i])return!1;return!0}return!1},__isQuote:function(t,e){const{quote:i}=this.options;if(null===i)return!1;const n=i.length;for(let o=0;o<n;o++)if(i[o]!==t[e+o])return!1;return!0},__autoDiscoverRecordDelimiter:function(t,e){const{encoding:i}=this.options,n=[Buffer.from("\r\n",i),Buffer.from("\n",i),Buffer.from("\r",i)];t:for(let i=0;i<n.length;i++){const o=n[i].length;for(let r=0;r<o;r++)if(n[i][r]!==t[e+r])continue t;return this.options.record_delimiter.push(n[i]),this.state.recordDelimiterMaxLength=n[i].length,n[i].length}return 0},__error:function(t){const{encoding:e,raw:i,skip_records_with_error:n}=this.options,o="string"==typeof t?new Error(t):t;return n?(this.state.recordHasError=!0,void(void 0!==this.options.on_skip&&this.options.on_skip(o,i?this.state.rawBuffer.toString(e):void 0))):o},__infoDataSet:function(){return{...this.info,columns:this.options.columns}},__infoRecord:function(){const{columns:t,raw:e,encoding:i}=this.options;return{...this.__infoDataSet(),error:this.state.error,header:!0===t,index:this.state.record.length,raw:e?this.state.rawBuffer.toString(i):void 0}},__infoField:function(){const{columns:t}=this.options,e=Array.isArray(t);return{...this.__infoRecord(),column:!0===e?t.length>this.state.record.length?t[this.state.record.length].name:null:this.state.record.length,quoting:this.state.wasQuoting}}}}({on_skip:(t,e)=>{this.emit("skip",t,e)},...t}),this.state=this.api.state,this.options=this.api.options,this.info=this.api.info}_transform(t,e,i){if(!0===this.state.stop)return;const n=this.api.parse(t,!1,(t=>{this.push(t)}),(()=>{this.push(null),this.end(),this.on("end",this.destroy)}));void 0!==n&&(this.state.stop=!0),i(n)}_flush(t){!0!==this.state.stop&&t(this.api.parse(void 0,!0,(t=>{this.push(t)}),(()=>{this.push(null),this.on("end",this.destroy)})))}}const g=function(t={},e){return this.options=t,void 0!==t.consume&&null!==t.consume||(this.options.consume=!1),this.options.objectMode=!0,void 0!==t.parallel&&null!==t.parallel||(this.options.parallel=100),void 0!==t.params&&null!==t.params||(t.params=null),this.handler=e,n.Transform.call(this,this.options),this.state={running:0,started:0,finished:0,paused:!1},this};o.inherits(g,n.Transform),g.prototype._transform=function(t,e,i){this.state.started++,this.state.running++,!this.state.paused&&this.state.running<this.options.parallel&&(i(),i=null);try{let e=this.handler.length;if(null!==this.options.params&&e--,1===e){const e=this.handler.call(this,t,this.options.params);e&&e.then?(e.then((t=>{this.__done(null,[t],i)})),e.catch((t=>{this.__done(t)}))):this.__done(null,[e],i)}else{if(2!==e)throw Error("Invalid handler arguments");{const e=(t,...e)=>this.__done(t,e,i);this.handler.call(this,t,e,this.options.params)}}return!1}catch(t){this.__done(t)}},g.prototype._flush=function(t){0===this.state.running?t():this._ending=function(){t()}},g.prototype.__done=function(t,e,i){if(this.state.running--,t)return this.destroy(t);this.state.finished++;for(let t of e)"number"==typeof t&&(t=`${t}`),null!=t&&""!==t&&(this.state.paused=!this.push(t));i&&i(),this._ending&&0===this.state.running&&this._ending()};class b extends Error{constructor(t,e,...i){Array.isArray(e)&&(e=e.join(" ")),super(e),void 0!==Error.captureStackTrace&&Error.captureStackTrace(this,b),this.code=t;for(const t of i)for(const e in t){const i=t[e];this[e]=Buffer.isBuffer(i)?i.toString():null==i?i:JSON.parse(JSON.stringify(i))}}}const v=function(t){return"object"==typeof t&&null!==t&&!Array.isArray(t)},y=".".charCodeAt(0),w=/\\(\\)?/g,O=RegExp("[^.[\\]]+|\\[(?:([^\"'][^[]*)|([\"'])((?:(?!\\2)[^\\\\]|\\\\.)*?)\\2)\\]|(?=(?:\\.|\\[\\])(?:\\.|\\[\\]|$))","g"),I=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,S=/^\w*$/,N=function(t){const e=typeof t;return"symbol"===e||"object"===e&&t&&"[object Symbol]"===function(t){return Object.prototype.toString.call(t)}(t)},x=function(t){if("string"==typeof t||N(t))return t;const e=`${t}`;return"0"==e&&1/t==-INFINITY?"-0":e},E=function(t,e){let i=0;const n=(e=function(t,e){return Array.isArray(t)?t:function(t,e){if(Array.isArray(t))return!1;const i=typeof t;return!("number"!==i&&"symbol"!==i&&"boolean"!==i&&t&&!N(t))||S.test(t)||!I.test(t)||null!=e&&t in Object(e)}(t,e)?[t]:function(t){const e=[];return t.charCodeAt(0)===y&&e.push(""),t.replace(O,(function(t,i,n,o){let r=t;n?r=o.replace(w,"$1"):i&&(r=i.trim()),e.push(r)})),e}(t)}(e,t)).length;for(;null!=t&&i<n;)t=t[x(e[i++])];return i&&i===n?t:void 0},A=function(t){if(null==t)return[void 0,void 0];if("object"!=typeof t)return[Error('Invalid option "columns": expect an array or an object')];if(Array.isArray(t)){const e=[];for(const i of t)if("string"==typeof i)e.push({key:i,header:i});else{if("object"!=typeof i||null===i||Array.isArray(i))return[Error("Invalid column definition: expect a string or an object")];if(!i.key)return[Error('Invalid column definition: property "key" is required')];void 0===i.header&&(i.header=i.key),e.push(i)}t=e}else{const e=[];for(const i in t)e.push({key:i,header:t[i]});t=e}return[void 0,t]},R=function(t){const e={};for(const n in t)e[(i=n,i.replace(/([A-Z])/g,(function(t,e){return"_"+e.toLowerCase()})))]=t[n];var i;if(void 0===e.bom||null===e.bom||!1===e.bom)e.bom=!1;else if(!0!==e.bom)return[new b("CSV_OPTION_BOOLEAN_INVALID_TYPE",["option `bom` is optional and must be a boolean value,",`got ${JSON.stringify(e.bom)}`])];if(void 0===e.delimiter||null===e.delimiter)e.delimiter=",";else if(Buffer.isBuffer(e.delimiter))e.delimiter=e.delimiter.toString();else if("string"!=typeof e.delimiter)return[new b("CSV_OPTION_DELIMITER_INVALID_TYPE",["option `delimiter` must be a buffer or a string,",`got ${JSON.stringify(e.delimiter)}`])];if(void 0===e.quote||null===e.quote)e.quote='"';else if(!0===e.quote)e.quote='"';else if(!1===e.quote)e.quote="";else if(Buffer.isBuffer(e.quote))e.quote=e.quote.toString();else if("string"!=typeof e.quote)return[new b("CSV_OPTION_QUOTE_INVALID_TYPE",["option `quote` must be a boolean, a buffer or a string,",`got ${JSON.stringify(e.quote)}`])];if(void 0!==e.quoted&&null!==e.quoted||(e.quoted=!1),void 0===e.escape_formulas||null===e.escape_formulas)e.escape_formulas=!1;else if("boolean"!=typeof e.escape_formulas)return[new b("CSV_OPTION_ESCAPE_FORMULAS_INVALID_TYPE",["option `escape_formulas` must be a boolean,",`got ${JSON.stringify(e.escape_formulas)}`])];if(void 0!==e.quoted_empty&&null!==e.quoted_empty||(e.quoted_empty=void 0),void 0===e.quoted_match||null===e.quoted_match||!1===e.quoted_match?e.quoted_match=null:Array.isArray(e.quoted_match)||(e.quoted_match=[e.quoted_match]),e.quoted_match)for(const t of e.quoted_match){const e=t instanceof RegExp;if("string"!=typeof t&&!e)return[Error(`Invalid Option: quoted_match must be a string or a regex, got ${JSON.stringify(t)}`)]}if(void 0!==e.quoted_string&&null!==e.quoted_string||(e.quoted_string=!1),void 0!==e.eof&&null!==e.eof||(e.eof=!0),void 0===e.escape||null===e.escape)e.escape='"';else if(Buffer.isBuffer(e.escape))e.escape=e.escape.toString();else if("string"!=typeof e.escape)return[Error(`Invalid Option: escape must be a buffer or a string, got ${JSON.stringify(e.escape)}`)];if(e.escape.length>1)return[Error(`Invalid Option: escape must be one character, got ${e.escape.length} characters`)];void 0!==e.header&&null!==e.header||(e.header=!1);const[n,o]=A(e.columns);if(void 0!==n)return[n];if(e.columns=o,void 0!==e.quoted&&null!==e.quoted||(e.quoted=!1),void 0!==e.cast&&null!==e.cast||(e.cast={}),void 0!==e.cast.bigint&&null!==e.cast.bigint||(e.cast.bigint=t=>""+t),void 0!==e.cast.boolean&&null!==e.cast.boolean||(e.cast.boolean=t=>t?"1":""),void 0!==e.cast.date&&null!==e.cast.date||(e.cast.date=t=>""+t.getTime()),void 0!==e.cast.number&&null!==e.cast.number||(e.cast.number=t=>""+t),void 0!==e.cast.object&&null!==e.cast.object||(e.cast.object=t=>JSON.stringify(t)),void 0!==e.cast.string&&null!==e.cast.string||(e.cast.string=function(t){return t}),void 0!==e.on_record&&"function"!=typeof e.on_record)return[Error('Invalid Option: "on_record" must be a function.')];if(void 0===e.record_delimiter||null===e.record_delimiter)e.record_delimiter="\n";else if(Buffer.isBuffer(e.record_delimiter))e.record_delimiter=e.record_delimiter.toString();else if("string"!=typeof e.record_delimiter)return[Error(`Invalid Option: record_delimiter must be a buffer or a string, got ${JSON.stringify(e.record_delimiter)}`)];switch(e.record_delimiter){case"unix":e.record_delimiter="\n";break;case"mac":e.record_delimiter="\r";break;case"windows":e.record_delimiter="\r\n";break;case"ascii":e.record_delimiter="";break;case"unicode":e.record_delimiter="\u2028"}return[void 0,e]},$=Buffer.from([239,187,191]);class B extends n.Transform{constructor(t={}){super({writableObjectMode:!0,...t});const[e,i]=R(t);if(void 0!==e)throw e;this.options=i,this.state={stop:!1},this.info={records:0},this.api=function(t,e,i){return{options:t,state:e,info:i,__transform:function(t,e){if(!Array.isArray(t)&&"object"!=typeof t)return Error(`Invalid Record: expect an array or an object, got ${JSON.stringify(t)}`);if(0===this.info.records)if(Array.isArray(t)){if(!0===this.options.header&&void 0===this.options.columns)return Error("Undiscoverable Columns: header option requires column option or object records")}else if(void 0===this.options.columns){const[e,i]=A(Object.keys(t));if(e)return;this.options.columns=i}if(0===this.info.records){this.bom(e);const t=this.headers(e);if(t)return t}try{this.options.on_record&&this.options.on_record(t,this.info.records)}catch(i){return i}let i,n;if(this.options.eof){if([i,n]=this.stringify(t),i)return i;if(void 0===n)return;n+=this.options.record_delimiter}else{if([i,n]=this.stringify(t),i)return i;if(void 0===n)return;(this.options.header||this.info.records)&&(n=this.options.record_delimiter+n)}this.info.records++,e(n)},stringify:function(t,e=!1){if("object"!=typeof t)return[void 0,t];const{columns:i}=this.options,n=[];if(Array.isArray(t)){i&&t.splice(i.length);for(let i=0;i<t.length;i++){const o=t[i],[r,s]=this.__cast(o,{index:i,column:i,records:this.info.records,header:e});if(r)return[r];n[i]=[s,o]}}else for(let o=0;o<i.length;o++){const r=E(t,i[o].key),[s,l]=this.__cast(r,{index:o,column:i[o].key,records:this.info.records,header:e});if(s)return[s];n[o]=[l,r]}let o="";for(let t=0;t<n.length;t++){let e,i,[r,s]=n[t];if("string"==typeof r)e=this.options;else if(v(r)){if(e=r,r=e.value,delete e.value,"string"!=typeof r&&null!=r&&i)return[Error(`Invalid Casting Value: returned value must return a string, null or undefined, got ${JSON.stringify(r)}`)];if(e={...this.options,...e},[i,e]=R(e),void 0!==i)return[i]}else{if(null!=r)return[Error(`Invalid Casting Value: returned value must return a string, an object, null or undefined, got ${JSON.stringify(r)}`)];e=this.options}const{delimiter:l,escape:a,quote:u,quoted:f,quoted_empty:c,quoted_string:d,quoted_match:h,record_delimiter:_,escape_formulas:m}=e;if(""===r&&""===s){let t=h&&h.filter((t=>"string"==typeof t?-1!==r.indexOf(t):t.test(r)));t=t&&t.length>0,!0===(t||!0===c||!0===d&&!1!==c)&&(r=u+r+u),o+=r}else if(r){if("string"!=typeof r)return[Error(`Formatter must return a string, null or undefined, got ${JSON.stringify(r)}`)];const t=l.length&&r.indexOf(l)>=0,e=""!==u&&r.indexOf(u)>=0,i=r.indexOf(a)>=0&&a!==u,n=r.indexOf(_)>=0,c=d&&"string"==typeof s;let p=h&&h.filter((t=>"string"==typeof t?-1!==r.indexOf(t):t.test(r)));if(p=p&&p.length>0,m)switch(r[0]){case"=":case"+":case"-":case"@":case"\t":case"\r":case"=":case"+":case"-":case"@":r=`'${r}`}const g=!0===e||t||n||f||c||p;if(!0===g&&!0===i){const t="\\"===a?new RegExp(a+a,"g"):new RegExp(a,"g");r=r.replace(t,a+a)}if(!0===e){const t=new RegExp(u,"g");r=r.replace(t,a+u)}!0===g&&(r=u+r+u),o+=r}else(!0===c||""===s&&!0===d&&!1!==c)&&(o+=u+u);t!==n.length-1&&(o+=l)}return[void 0,o]},bom:function(t){!0===this.options.bom&&t($)},headers:function(t){if(!1===this.options.header)return;if(void 0===this.options.columns)return;let e,i=this.options.columns.map((t=>t.header));if(this.options.eof?([e,i]=this.stringify(i,!0),i+=this.options.record_delimiter):[e,i]=this.stringify(i),e)return e;t(i)},__cast:function(t,e){const i=typeof t;try{return"string"===i?[void 0,this.options.cast.string(t,e)]:"bigint"===i?[void 0,this.options.cast.bigint(t,e)]:"number"===i?[void 0,this.options.cast.number(t,e)]:"boolean"===i?[void 0,this.options.cast.boolean(t,e)]:t instanceof Date?[void 0,this.options.cast.date(t,e)]:"object"===i&&null!==t?[void 0,this.options.cast.object(t,e)]:[void 0,t,t]}catch(t){return[t]}}}}(this.options,this.state,this.info),this.api.options.on_record=(...t)=>{this.emit("record",...t)}}_transform(t,e,i){if(!0===this.state.stop)return;const n=this.api.__transform(t,this.push.bind(this));void 0!==n&&(this.state.stop=!0),i(n)}_flush(t){if(!0!==this.state.stop){if(0===this.info.records){this.api.bom(this.push.bind(this));const e=this.api.headers(this.push.bind(this));e&&t(e)}t()}}}e.generate=function(){let t,e;2===arguments.length?(t=arguments[0],e=arguments[1]):1===arguments.length?"function"==typeof arguments[0]?(t={},e=arguments[0]):t=arguments[0]:0===arguments.length&&(t={});const i=new l(t);if(e){const t=[];i.on("readable",(function(){let e;for(;null!==(e=i.read());)t.push(e)})),i.on("error",e),i.on("end",(function(){i.options.objectMode?e(null,t):i.options.encoding?e(null,t.join("")):e(null,Buffer.concat(t))}))}return i},e.parse=function(){let t,e,i;for(const n in arguments){const o=arguments[n],r=typeof o;if(void 0!==t||"string"!=typeof o&&!Buffer.isBuffer(o))if(void 0===e&&a(o))e=o;else{if(void 0!==i||"function"!==r)throw new u("CSV_INVALID_ARGUMENT",["Invalid argument:",`got ${JSON.stringify(o)} at index ${n}`],e||{});i=o}else t=o}const n=new p(e);if(i){const t=void 0===e||void 0===e.objname?[]:{};n.on("readable",(function(){let i;for(;null!==(i=this.read());)void 0===e||void 0===e.objname?t.push(i):t[i[0]]=i[1]})),n.on("error",(function(t){i(t,void 0,n.api.__infoDataSet())})),n.on("end",(function(){i(void 0,t,n.api.__infoDataSet())}))}if(void 0!==t){const e=function(){n.write(t),n.end()};"function"==typeof setImmediate?setImmediate(e):setTimeout(e,0)}return n},e.stringify=function(){let t,e,i;for(const n in arguments){const o=arguments[n],r=typeof o;if(void 0===t&&Array.isArray(o))t=o;else if(void 0===e&&v(o))e=o;else{if(void 0!==i||"function"!==r)throw new b("CSV_INVALID_ARGUMENT",["Invalid argument:",`got ${JSON.stringify(o)} at index ${n}`]);i=o}}const n=new B(e);if(i){const t=[];n.on("readable",(function(){let e;for(;null!==(e=this.read());)t.push(e)})),n.on("error",(function(t){i(t)})),n.on("end",(function(){try{i(void 0,t.join(""))}catch(t){return void i(t)}}))}if(void 0!==t){const e=function(){for(const e of t)n.write(e);n.end()};"function"==typeof setImmediate?setImmediate(e):setTimeout(e,0)}return n},e.transform=function(){let t,e,i,n={};for(let o=0;o<arguments.length;o++){const r=arguments[o];let s=typeof r;if(null===r?s="null":"object"===s&&Array.isArray(r)&&(s="array"),"array"===s)i=r;else if("object"===s)n={...r};else if("function"===s)e&&o===arguments.length-1?t=r:e=r;else if("null"!==s)throw new Error(`Invalid Arguments: got ${JSON.stringify(r)} at position ${o}`)}const o=new g(n,e);let r=!1;if(i){const t=function(){for(const t of i){if(r)break;o.write(t)}o.end()};"function"==typeof setImmediate?setImmediate(t):setTimeout(t,0)}if(t||n.consume){const e=[];o.on("readable",(function(){let i;for(;null!==(i=o.read());)t&&e.push(i)})),o.on("error",(function(e){r=!0,t&&t(e)})),o.on("end",(function(){t&&!r&&t(null,e)}))}return o}}},e={},i=function i(n){var o=e[n];if(void 0!==o)return o.exports;var r=e[n]={exports:{}};return t[n](r,r.exports,i),r.exports}(237);module.exports=i})(); |
@@ -1,1 +0,1 @@ | ||
var plugin;(()=>{"use strict";var e={d:(a,t)=>{for(var r in t)e.o(t,r)&&!e.o(a,r)&&Object.defineProperty(a,r,{enumerable:!0,get:t[r]})},o:(e,a)=>Object.prototype.hasOwnProperty.call(e,a),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},a={};e.r(a),e.d(a,{default:()=>t});const t={fileFormats:[{packageName:"dbgate-plugin-csv",storageType:"csv",extension:"csv",name:"CSV",readerFunc:"reader@dbgate-plugin-csv",writerFunc:"writer@dbgate-plugin-csv",args:[{type:"select",name:"delimiter",label:"Delimiter",options:[{name:"Comma (,)",value:","},{name:"Semicolon (;)",value:";"},{name:"Tab",value:"\t"},{name:"Pipe (|)",value:"|"}],apiName:"delimiter"},{type:"checkbox",name:"quoted",label:"Quoted",apiName:"quoted",direction:"target"},{type:"checkbox",name:"header",label:"Has header row",apiName:"header",default:!0}]}],quickExports:[{label:"CSV file",extension:"csv",createWriter:e=>({functionName:"writer@dbgate-plugin-csv",props:{fileName:e,delimiter:","}})},{label:"CSV file (semicolon separated)",extension:"csv",createWriter:e=>({functionName:"writer@dbgate-plugin-csv",props:{fileName:e,delimiter:";"}})}]};plugin=a})(); | ||
var plugin;(()=>{"use strict";var e={d:(a,t)=>{for(var r in t)e.o(t,r)&&!e.o(a,r)&&Object.defineProperty(a,r,{enumerable:!0,get:t[r]})},o:(e,a)=>Object.prototype.hasOwnProperty.call(e,a),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},a={};e.r(a),e.d(a,{default:()=>t});const t={fileFormats:[{packageName:"dbgate-plugin-csv",storageType:"csv",extension:"csv",name:"CSV",readerFunc:"reader@dbgate-plugin-csv",writerFunc:"writer@dbgate-plugin-csv",args:[{type:"select",name:"delimiter",label:"Delimiter",options:[{name:"Auto-detect",value:""},{name:"Comma (,)",value:","},{name:"Semicolon (;)",value:";"},{name:"Tab",value:"\t"},{name:"Pipe (|)",value:"|"}],apiName:"delimiter"},{type:"checkbox",name:"quoted",label:"Quoted",apiName:"quoted",direction:"target"},{type:"checkbox",name:"header",label:"Has header row",apiName:"header",default:!0}]}],quickExports:[{label:"CSV file",extension:"csv",createWriter:e=>({functionName:"writer@dbgate-plugin-csv",props:{fileName:e,delimiter:","}})},{label:"CSV file (semicolon separated)",extension:"csv",createWriter:e=>({functionName:"writer@dbgate-plugin-csv",props:{fileName:e,delimiter:";"}})}]};plugin=a})(); |
{ | ||
"name": "dbgate-plugin-csv", | ||
"main": "dist/backend.js", | ||
"version": "5.4.5-alpha.5", | ||
"version": "5.5.1", | ||
"homepage": "https://dbgate.org", | ||
@@ -35,4 +35,5 @@ "description": "CSV import/export plugin for DbGate", | ||
"devDependencies": { | ||
"csv": "^5.3.2", | ||
"csv": "^6.3.10", | ||
"dbgate-plugin-tools": "^1.0.7", | ||
"line-reader": "^0.4.0", | ||
"lodash": "^4.17.21", | ||
@@ -39,0 +40,0 @@ "webpack": "^5.91.0", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
59182
1
6
3