@serverless-devs/s 2.0.95-beta.1 → 2.0.95
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/docs/zh/awesome.md +15 -291
- package/docs/zh/cicd.md +31 -0
- package/docs/zh/yaml.md +5 -1
- package/lib/clean/index.js +1 -1
- package/lib/cli/index.js +46 -45
- package/lib/component/index.js +1 -1
- package/lib/config/add/index.js +16 -16
- package/lib/config/delete/index.js +38 -37
- package/lib/config/get/index.js +30 -30
- package/lib/config/index.js +1 -1
- package/lib/core/command/command-manager.d.ts +1 -0
- package/lib/core/command/command-manager.js +46 -19
- package/lib/index.js +96 -96
- package/lib/init/index.js +88 -87
- package/lib/init/init-config.d.ts +37 -7
- package/lib/init/init-config.js +426 -90
- package/lib/init/init-manager.js +16 -17
- package/lib/set/analysis/index.js +1 -1
- package/lib/set/index.js +1 -1
- package/lib/set/locale/index.js +41 -40
- package/lib/set/registry/index.js +41 -40
- package/lib/set/workspace/index.js +1 -1
- package/lib/update-notifier/index.js +1 -1
- package/lib/utils/command-util.d.ts +1 -0
- package/lib/utils/command-util.js +33 -3
- package/package.json +3 -3
- package/lib/init/template.d.ts +0 -20
- package/lib/init/template.js +0 -314
- package/lib/init/update-template.d.ts +0 -1
- package/lib/init/update-template.js +0 -33
package/lib/component/index.js
CHANGED
|
@@ -42,7 +42,7 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
42
42
|
`)),console.log((0,rc.bgRed)("ERROR:")+`
|
|
43
43
|
`+t+`
|
|
44
44
|
`),a!=="disable"&&console.log(Nn.gray("Please copy traceId: "+this.traceId+" and join Dingding group: 33947367 for consultation.")),console.log(Nn.gray("You can run 's clean --cache' to prune Serverless devs.")),console.log(Nn.gray(`And run again with the '--debug' option or 's -h' to get more logs.
|
|
45
|
-
`))}return r.prototype.report=function(e){return WI(this,void 0,void 0,function(){return GI(this,function(t){return zI({type:"jsError",content:e.message+"||"+e.stack,traceId:this.traceId}),[2]})})},r}();Ke.HandleError=n8});var Cm=C((wN,i8)=>{i8.exports={name:"@serverless-devs/s",version:"2.0.95-beta.1",description:"Serverless devs tool, serverless developer tool, supports Alibaba cloud, AWS, azure, baidu cloud, Huawei cloud, Google cloud and Tencent cloud.",homepage:"https://www.serverless-devs.com",keywords:["serverless","alibaba","tencent","azure","baidu","huawei","google","function","faas","serverless-devs"],publishConfig:{access:"public",registry:"https://registry.npmjs.org"},license:"MIT",repository:{type:"git",url:"https://github.com/Serverless-Devs/Serverless-Devs"},bugs:{url:"https://github.com/Serverless-Devs/Serverless-Devs/issues"},scripts:{prewatch:"rm -rf lib/* && cp -r ./src/daemon ./lib",watch:"tsc -w",test:"npx jest",prebuild:"rm -rf lib",build:"tsc && cp -r ./src/daemon ./lib",postbuild:"./shell/postbuild.sh","test:cov":"jest --coverage",lint:"npm run typecheck && f2elint scan -i src",fix:"f2elint fix",typecheck:"npx tsc -p tsconfig.json --noEmit",update:"rm -rf yarn.lock && rm -rf package-lock.json && rm -rf node_modules && yarn",beta:"npm publish --tag=beta"},main:"./lib/index.js",bin:{s:"bin/s"},devDependencies:{"@types/jest":"^27.0.1","@types/lodash":"^4.14.168","@types/node":"^14.0.23","@typescript-eslint/eslint-plugin":"^4.14.1","@typescript-eslint/parser":"^4.14.1","babel-eslint":"^10.1.0",boxen:"^5.0.0",commander:"^6.0.0",dotenv:"^10.0.0",esbuild:"^0.13.6",eslint:"^7.7.0","eslint-config-prettier":"^7.2.0","eslint-plugin-import":"^2.20.1","eslint-plugin-prettier":"^3.1.2",husky:"^4.2.3",inquirer:"^8.2.0","inquirer-autocomplete-prompt":"^1.3.0",jest:"^27.1.0","latest-version":"^5.1.0","lint-staged":"^10.0.8",lodash:"^4.17.20","os-locale":"5.0.0",prettier:"^2.2.1",semver:"^7.3.5","semver-diff":"^3.1.1","ts-jest":"^27.0.1","ts-node":"^9.1.1","tty-table":"^4.1.5",typescript:"^4.1.3"},"lint-staged":{"**/*.{js,jsx,ts}":"f2elint exec eslint"},jest:{coverageDirectory:"coverage",testEnvironment:"node",coverageProvider:"v8",preset:"ts-jest",testMatch:["**/test/**/*test.[jt]s"],setupFilesAfterEnv:["./jest.setup.ts"]},dependencies:{"@serverless-devs/core":"^0.1.15-beta.2"}}});var Fi=C(be=>{"use strict";var s8=be&&be.__createBinding||(Object.create?function(r,e,t,s){s===void 0&&(s=t),Object.defineProperty(r,s,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,s){s===void 0&&(s=t),r[s]=e[t]}),o8=be&&be.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),u8=be&&be.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&s8(e,r,t);return o8(e,r),e},Am=be&&be.__awaiter||function(r,e,t,s){function o(a){return a instanceof t?a:new t(function(c){c(a)})}return new(t||(t=Promise))(function(a,c){function f(m){try{p(s.next(m))}catch(b){c(b)}}function d(m){try{p(s.throw(m))}catch(b){c(b)}}function p(m){m.done?a(m.value):o(m.value).then(f,d)}p((s=s.apply(r,e||[])).next())})},Om=be&&be.__generator||function(r,e){var t={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},s,o,a,c;return c={next:f(0),throw:f(1),return:f(2)},typeof Symbol=="function"&&(c[Symbol.iterator]=function(){return this}),c;function f(p){return function(m){return d([p,m])}}function d(p){if(s)throw new TypeError("Generator is already executing.");for(;t;)try{if(s=1,o&&(a=p[0]&2?o.return:p[0]?o.throw||((a=o.return)&&a.call(o),0):o.next)&&!(a=a.call(o,p[1])).done)return a;switch(o=0,a&&(p=[p[0]&2,a.value]),p[0]){case 0:case 1:a=p;break;case 4:return t.label++,{value:p[1],done:!1};case 5:t.label++,o=p[1],p=[0];continue;case 7:p=t.ops.pop(),t.trys.pop();continue;default:if(a=t.trys,!(a=a.length>0&&a[a.length-1])&&(p[0]===6||p[0]===2)){t=0;continue}if(p[0]===3&&(!a||p[1]>a[0]&&p[1]<a[3])){t.label=p[1];break}if(p[0]===6&&t.label<a[1]){t.label=a[1],a=p;break}if(a&&t.label<a[2]){t.label=a[2],t.ops.push(p);break}a[2]&&t.ops.pop(),t.trys.pop();continue}p=e.call(r,t)}catch(m){p=[6,m],o=0}finally{s=a=0}if(p[0]&5)throw p[1];return{value:p[0]?p[1]:void 0,done:!0}}},gu=be&&be.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(be,"__esModule",{value:!0});be.emoji=be.mark=be.replaceTemplate=be.getTemplatekey=be.replaceFun=be.getLang=be.printn=be.checkTemplateFile=be.checkAndReturnTemplateFile=be.yamlLoad=be.getFolderSize=be.getVersion=be.bgRed=be.red=void 0;var vt=gu(require("path")),Vt=gu(require("fs")),oc=gu(im()),a8=gu(require("os")),l8=sc(),mu=u8(Fr()),uc=mu.default.colors,c8=mu.default.jsyaml,yu=Cm();be.red=uc.hex("#fd5750");be.bgRed=uc.hex("#000").bgHex("#fd5750");function f8(){return(0,mu.getCoreVersion)()?yu.name+": "+yu.version+", @serverless-devs/core: "+(0,mu.getCoreVersion)()+", "+process.platform+"-"+process.arch+", node-"+process.version:yu.name+": "+yu.version+", "+process.platform+"-"+process.arch+", node-"+process.version}be.getVersion=f8;function h8(r){return Am(this,void 0,void 0,function(){function e(o){return Am(this,void 0,void 0,function(){var a,c;return Om(this,function(f){switch(f.label){case 0:return a=Vt.default.lstatSync(o),typeof a!="object"?[2]:(t.set(a.ino,a.size),a.isDirectory()?(c=Vt.default.readdirSync(o),typeof c!="object"?[2]:[4,Promise.all(c.map(function(d){return e(vt.default.join(o,d))}))]):[3,2]);case 1:f.sent(),f.label=2;case 2:return[2]}})})}var t,s;return Om(this,function(o){switch(o.label){case 0:return t=new Map,[4,e(r)];case 1:return o.sent(),s=Array.from(t.values()).reduce(function(a,c){return a+c},0),[2,s]}})})}be.getFolderSize=h8;function Fm(r){var e=Vt.default.readFileSync(r,"utf8");try{return c8.load(e)}catch{if(["-h","--help"].includes(process.argv[2]))return;var t=vt.default.basename(r);new l8.HumanError({errorMessage:t+" format is incorrect",tips:"Please check the configuration of "+t+", Serverless Devs' Yaml specification document can refer to\uFF1A"+uc.underline("https://github.com/Serverless-Devs/Serverless-Devs/blob/master/docs/zh/yaml.md")}),process.exit(1)}}be.yamlLoad=Fm;function Is(r,e){e===void 0&&(e=!1);var t=Vt.default.readFileSync(r,"utf8"),s=e?JSON.parse(t):Fm(r);if(!s)return!1;for(var o in s)if(s[o].Component&&s[o].Provider&&s[o].Properties)return!0;return s.hasOwnProperty("edition")}function Sm(){if(process.env.serverless_devs_temp_template)return process.env.serverless_devs_temp_template;var r=process.cwd(),e=process.argv.includes("-t")?"-t":process.argv.includes("--template")?"--template":null,t=e?process.argv.indexOf(e):-1;if(t!==-1){var s=t+1,o=process.argv[s];if(o&&(o.endsWith(".yaml")||o.endsWith(".yml")||o.endsWith(".json"))){var a=!!o.endsWith(".json");if(Vt.default.existsSync(vt.default.join(r,o))&&Is(vt.default.join(r,o),a)){process.argv.splice(t,2);var c=JSON.parse(process.env.serverless_devs_temp_argv);return c.splice(c.indexOf(e),2),process.env.serverless_devs_temp_argv=JSON.stringify(c),process.env.serverless_devs_temp_template=vt.default.join(r,o),vt.default.join(r,o)}else if(Vt.default.existsSync(o)&&Is(o,a)){process.argv.splice(t,2);var c=JSON.parse(process.env.serverless_devs_temp_argv);return c.splice(c.indexOf(e),2),process.env.serverless_devs_temp_argv=JSON.stringify(c),process.env.serverless_devs_temp_template=o,o}}}return Vt.default.existsSync(vt.default.join(r,"s.yaml"))&&Is(vt.default.join(r,"s.yaml"))?(process.env.serverless_devs_temp_template=vt.default.join(r,"s.yaml"),vt.default.join(r,"s.yaml")):Vt.default.existsSync(vt.default.join(r,"s.yml"))&&Is(vt.default.join(r,"s.yml"))?(process.env.serverless_devs_temp_template=vt.default.join(r,"s.yml"),vt.default.join(r,"s.yml")):Vt.default.existsSync(vt.default.join(r,"s.json"))&&Is(vt.default.join(r,"s.json"),!0)?(process.env.serverless_devs_temp_template=vt.default.join(r,"s.json"),vt.default.join(r,"s.json")):null}be.checkAndReturnTemplateFile=Sm;function Im(r){return Vt.default.existsSync(r)?r:null}be.checkTemplateFile=Im;function Rm(r,e){e===void 0&&(e=" ");for(var t="",s=0;s<r;s++)t=t+e;return t}be.printn=Rm;function Tm(){return"en"}be.getLang=Tm;function ac(r,e){var t=/\{\{(.*?)\}\}/g,s=r.match(t);if(s)for(var o=0;o<s.length;o++){var a=s[o].replace(/{{|}}/g,""),c=oc.default.trim(a.split("|")[0]);e[c]&&(r=r.replace(s[o],e[c]))}return r}be.replaceFun=ac;function qm(r){var e=/\{\{(.*?)\}\}/g,t=r.match(e);return t?t.filter(function(s){return s}).map(function(s){var o=s.replace(/{{|}}/g,""),a=o.split("|");return{name:oc.default.trim(a[0]),desc:oc.default.trim(a[1])}}):[]}be.getTemplatekey=qm;function Pm(r,e){r.forEach(function(t){if(Vt.default.existsSync(t)){var s=Vt.default.readFileSync(t,"utf-8"),o=ac(s,e);Vt.default.writeFileSync(t,o,"utf-8")}})}be.replaceTemplate=Pm;function $m(r){if(!r)return r;var e=r.slice(-4);return"***********"+e}be.mark=$m;function p8(r){return a8.default.platform()==="win32"?"":r}be.emoji=p8;be.default={checkAndReturnTemplateFile:Sm,checkTemplateFile:Im,printn:Rm,mark:$m,getLang:Tm,replaceTemplate:Pm,replaceFun:ac,getTemplatekey:qm}});var Bm=C(lc=>{"use strict";Object.defineProperty(lc,"__esModule",{value:!0});lc.default={clean_up_the_environment:"\u6E05\u7406\u73AF\u5883",display_help_for_command:"\u663E\u793A\u547D\u4EE4\u5E2E\u52A9",remove_components:"\u5220\u9664\u7EC4\u4EF6",delete_the_file_under_the_cache:"\u5220\u9664\u7F13\u5B58\u91CC\u7684\u7684<dirname>\u6587\u4EF6",record_your_log_information:"\u662F\u5426\u8BB0\u5F55\u60A8\u7684\u65E5\u5FD7\u4FE1\u606F\uFF1F",init_pproject_deploy_tip:"\u662F\u5426\u7ACB\u5373\u90E8\u7F72\u8BE5\u9879\u76EE\uFF1F",tip_for_a_serverless_project:"\u68C0\u6D4B\u5230\u5F53\u524D\u76EE\u5F55\u4E0B\u5DF2\u5B58\u5728\u4E00\u4E2AServerless-Devs\u9879\u76EE\uFF0C\u8BF7\u901A\u8FC7 's deploy' \u8FDB\u884C\u90E8\u7F72\u6216\u901A\u8FC7 's -h' \u83B7\u53D6\u66F4\u591A\u4FE1\u606F",create_a_new_project:"\u672A\u68C0\u6D4B\u5230 Serverless-Devs \u9879\u76EE\uFF0C\u662F\u5426\u65B0\u5EFA\u4E00\u4E2A\u9879\u76EE\uFF1F",en:"English (en)",zh:"\u4E2D\u6587 (zh)",select_current_language:"\u8BF7\u9009\u62E9\u5F53\u524D\u8BED\u8A00","app-tip":"\u8BF7\u9009\u62E9\u60A8\u5E0C\u671B\u521B\u5EFA\u7684 Serverless-Devs \u5E94\u7528","template-tip":"\u8BF7\u9009\u62E9\u60A8\u559C\u6B22\u7684\u6A21\u7248","fc-runtime-starter":"fc-runtime-starter - \u5FEB\u901F\u90E8\u7F72\u4E00\u4E2A FC \u51FD\u6570","fc-custom-container-stater":"fc-custom-container-stater - \u5FEB\u901F\u90E8\u7F72\u4E00\u4E2A custom-container \u5E94\u7528",web:"web-framework-stater - \u5FEB\u901F\u90E8\u7F72\u4E00\u4E2A Web \u6846\u67B6","static-site":"static-website-stater - \u5FEB\u901F\u90E8\u7F72\u4E00\u4E2A\u9759\u6001\u7F51\u7AD9","best-practice":"serverless-best-practice - \u5FEB\u901F\u4F53\u9A8C Serverless \u6700\u4F73\u5B9E\u8DF5","devs-template":"Serverless Devs \u5F00\u53D1\u6A21\u677F","fc-http-nodejs":"fc-http-nodejs - \u5FEB\u901F\u90E8\u7F72\u4E00\u4E2A nodejs12 \u51FD\u6570","fc-http-python":"fc-http-python - \u5FEB\u901F\u90E8\u7F72\u4E00\u4E2A python3 \u51FD\u6570","fc-http-java":"fc-http-java - \u5FEB\u901F\u90E8\u7F72\u4E00\u4E2A java8 \u51FD\u6570","fc-custom-container-event-python3":"fc-custom-container-event-python3 - \u5FEB\u901F\u90E8\u7F72\u4E00\u4E2A\u901A\u8FC7\u4E8B\u4EF6\u89E6\u53D1\u7684 python3 \u5E94\u7528","fc-custom-container-event-cpp":"fc-custom-container-event-cpp - \u5FEB\u901F\u90E8\u7F72\u4E00\u4E2A\u901A\u8FC7\u4E8B\u4EF6\u89E6\u53D1\u7684 cpp \u5E94\u7528","fc-custom-container-http-springboot":"fc-custom-container-http-springboot - \u5FEB\u901F\u90E8\u7F72\u4E00\u4E2A\u901A\u8FC7 HTTP \u8BF7\u6C42\u89E6\u53D1\u7684 springboot \u5E94\u7528","fc-custom-container-http-aspdotnetcore":"fc-custom-container-http-aspdotnetcore - \u5FEB\u901F\u90E8\u7F72\u4E00\u4E2A\u901A\u8FC7 HTTP \u8BF7\u6C42\u89E6\u53D1\u7684 aspdotnetcore \u5E94\u7528","express-starter":"express-starter - \u5FEB\u901F\u90E8\u7F72\u4E00\u4E2A express \u57FA\u7840\u5E94\u7528","koa-starter":"koa-starter - \u5FEB\u901F\u90E8\u7F72\u4E00\u4E2A koa \u57FA\u7840\u5E94\u7528","nuxtjs-starter":"nuxtjs-starter - \u5FEB\u901F\u90E8\u7F72\u4E00\u4E2A nuxtjs \u57FA\u7840\u5E94\u7528","eggjs-starter":"eggjs-starter - \u5FEB\u901F\u90E8\u7F72\u4E00\u4E2A eggjs \u57FA\u7840\u5E94\u7528","flask-starter":"flask-starter - \u5FEB\u901F\u90E8\u7F72\u4E00\u4E2A flask \u57FA\u7840\u5E94\u7528","SpringBoot-starter":"SpringBoot-starter - \u5FEB\u901F\u90E8\u7F72\u4E00\u4E2A SpringBoot \u57FA\u7840\u5E94\u7528","Zblog-starter":"Zblog-starter - \u5FEB\u901F\u90E8\u7F72\u4E00\u4E2A Zblog \u57FA\u7840\u5E94\u7528","website-starter":"website-starter - \u5FEB\u901F\u90E8\u7F72\u4E00\u4E2A\u9759\u6001\u7F51\u7AD9","react-starter":"react-starter - \u5FEB\u901F\u90E8\u7F72\u4E00\u4E2A React.js \u5E94\u7528","vue-starter":"vue-starter - \u5FEB\u901F\u90E8\u7F72\u4E00\u4E2A Vue.js \u5E94\u7528",puppeteer:"puppeteer - \u5FEB\u901F\u90E8\u7F72\u4E00\u4E2A\u57FA\u4E8E puppeteer \u622A\u56FE\u7684 Web \u5E94\u7528",ffmpeg:"ffmpeg - \u5FEB\u901F\u90E8\u7F72\u4E00\u4E2A\u57FA\u4E8E ffmpeg \u5B9E\u73B0\u97F3\u89C6\u9891\u5904\u7406\u5E94\u7528",pdf2Img:"pdf2Img - \u5FEB\u901F\u90E8\u7F72\u4E00\u4E2A pdf \u8F6C\u56FE\u7247\u5E94\u7528",tensorflow:"tensorflow - \u5FEB\u901F\u90E8\u7F72\u4E00\u4E2A tensorflow \u5E94\u7528",todoList:"todoList - \u5FEB\u901F\u90E8\u7F72\u4E00\u4E2A\u57FA\u4E8E nodejs \u7684\u7F51\u9875 TodoList \u5E94\u7528"}});var Nm=C(cc=>{"use strict";Object.defineProperty(cc,"__esModule",{value:!0});cc.default={clean_up_the_environment:"Clean up the environment",display_help_for_command:"Display help for command",remove_components:"Remove component (like: fc, fc@0.0.1)",delete_the_file_under_the_cache:"Delete the <dirname> file in the cache",record_your_log_information:"Do you record your log information?",init_pproject_deploy_tip:"Do you want to deploy the project immediately?",tip_for_a_serverless_project:"A Serverless-Devs project is detected in the current directory, please deploy via 's deploy' or get more information via 's -h'",create_a_new_project:"No Serverless-Devs project is currently detected. Do you want to create a new project?",en:"English (en)",zh:"Chinese (zh)",select_current_language:"Please select current language","app-tip":"Hello, serverlesser. Which template do you like?","template-tip":"Which template do you like?","fc-runtime-starter":"fc-runtime-starter - Deploy FC function in 5 minutes","fc-custom-container-stater":"fc-custom-container-stater - Deploy FC function with custom-container",web:"web-framework-stater-Quickly deploy a web framework","static-site":"static-website-stater-Quickly deploy a static website","best-practice":"serverless-best-practice-Quickly experience serverless best practices","devs-template":"Serverless Develop scaffold","fc-http-nodejs":"fc-http-nodejs - Deploy FC nodejs12 runtime function","fc-http-python":"fc-http-python - Deploy FC python3 runtime function","fc-http-java":"fc-http-java - Deploy FC java8 runtime function","fc-custom-container-event-python3":"fc-custom-container-event-python3 - Deploy python3 event-triggered application","fc-custom-container-event-cpp":"fc-custom-container-event-cpp - Deploy cpp event-triggered application","fc-custom-container-http-springboot":"fc-custom-container-http-springboot - Deploy springboot HTTP Request-triggered application","fc-custom-container-http-aspdotnetcore":"fc-custom-container-http-aspdotnetcore - Deploy dotnetcore HTTP Request-triggered application","express-starter":"express-starter - Deploy express application","koa-starter":"koa-starter - Deploy koa application","nuxtjs-starter":"nuxtjs-starter - Deploy nuxtjs application","eggjs-starter":"eggjs-starter - Deploy eggjs application","flask-starter":"flask-starter - Deploy flask application","SpringBoot-starter":"SpringBoot-starter - Deploy SpringBoot application","Zblog-starter":"Zblog-starter - Deploy Zblog application","website-starter":"website-starter - Deploy static website","react-starter":"react-starter - Deploy React.js application","vue-starter":"vue-starter - Deploy Vue.js application",puppeteer:"puppeteer - Deploy screenshot application base on puppeteer + fc",ffmpeg:"ffmpeg - Deploy audio and video processing application base on ffmpeg + fc",pdf2Img:"pdf2Img - Deploy pdf to images application",tensorflow:"tensorflow - Deploy tensorflow application",todoList:"todoList - Deploy todoList application"}});var Lm=C(Rs=>{"use strict";var jm=Rs&&Rs.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Rs,"__esModule",{value:!0});var d8=Fi(),g8=jm(Bm()),m8=jm(Nm()),fc={en:m8.default,zh:g8.default},y8=function(r){var e=(0,d8.getLang)(),t=fc[e]?fc[e][r]:fc.en[r];return t||r};Rs.default=y8});var km=C(Ts=>{"use strict";var D8=Ts&&Ts.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Ts,"__esModule",{value:!0});var Mm=D8(Fr()),v8=Mm.default.Logger,_8=Mm.default.spinner,jn=new v8("S-CLI"),b8=function(){function r(){}return r.log=function(e){jn.log(e)},r.info=function(e){jn.info(e)},r.debug=function(e){jn.debug(e)},r.error=function(e){jn.error(e)},r.warning=function(e){jn.warn(e)},r.success=function(e){jn.log(e,"green")},r.spinner=function(e){return _8(e)},r.output=function(e){return jn.output(e)},r}();Ts.default=b8});var Gm=C((SN,hc)=>{var Wm=require("stream"),E8=require("util");hc.exports=function(){let r,e;arguments.length===2?(r=arguments[0],e=arguments[1]):arguments.length===1?typeof arguments[0]=="function"?(r={},e=arguments[0]):r=arguments[0]:arguments.length===0&&(r={});let t=new Generator(r);if(e){let s=[];t.on("readable",function(){let o;for(;o=t.read();)s.push(o)}),t.on("error",e),t.on("end",function(){t.options.objectMode?e(null,s):t.options.encoding?e(null,s.join("")):e(null,Buffer.concat(s))})}return t};Generator=function(r={}){r.high_water_mark&&(r.highWaterMark=r.high_water_mark),r.object_mode&&(r.objectMode=r.object_mode),Wm.Readable.call(this,r),this.options={};for(let s in r)this.options[Generator.camelize(s)]=r[s];let e={columns:8,delimiter:",",duration:null,encoding:null,end:null,eof:!1,fixedSize:!1,length:-1,maxWordLength:16,rowDelimiter:`
|
|
45
|
+
`))}return r.prototype.report=function(e){return WI(this,void 0,void 0,function(){return GI(this,function(t){return zI({type:"jsError",content:e.message+"||"+e.stack,traceId:this.traceId}),[2]})})},r}();Ke.HandleError=n8});var Cm=C((wN,i8)=>{i8.exports={name:"@serverless-devs/s",version:"2.0.95",description:"Serverless devs tool, serverless developer tool, supports Alibaba cloud, AWS, azure, baidu cloud, Huawei cloud, Google cloud and Tencent cloud.",homepage:"https://www.serverless-devs.com",keywords:["serverless","alibaba","tencent","azure","baidu","huawei","google","function","faas","serverless-devs"],publishConfig:{access:"public",registry:"https://registry.npmjs.org"},license:"MIT",repository:{type:"git",url:"https://github.com/Serverless-Devs/Serverless-Devs"},bugs:{url:"https://github.com/Serverless-Devs/Serverless-Devs/issues"},scripts:{prewatch:"rm -rf lib/* && cp -r ./src/daemon ./lib",watch:"tsc -w",test:"npx jest",prebuild:"rm -rf lib/*",build:"tsc && cp -r ./src/daemon ./lib",postbuild:"./shell/postbuild.sh","test:cov":"jest --coverage",lint:"npm run typecheck && f2elint scan -i src",fix:"f2elint fix",typecheck:"npx tsc -p tsconfig.json --noEmit",update:"rm -rf yarn.lock && rm -rf package-lock.json && rm -rf node_modules && yarn",beta:"npm publish --tag=beta"},main:"./lib/index.js",bin:{s:"bin/s"},devDependencies:{"@types/jest":"^27.0.1","@types/lodash":"^4.14.168","@types/node":"^14.0.23","@typescript-eslint/eslint-plugin":"^4.14.1","@typescript-eslint/parser":"^4.14.1","babel-eslint":"^10.1.0",boxen:"^5.0.0",commander:"^6.0.0",dotenv:"^10.0.0",esbuild:"^0.13.6",eslint:"^7.7.0","eslint-config-prettier":"^7.2.0","eslint-plugin-import":"^2.20.1","eslint-plugin-prettier":"^3.1.2",husky:"^4.2.3",inquirer:"^8.2.0","inquirer-autocomplete-prompt":"^1.3.0",jest:"^27.1.0","latest-version":"^5.1.0","lint-staged":"^10.0.8",lodash:"^4.17.20","os-locale":"5.0.0",prettier:"^2.2.1",semver:"^7.3.5","semver-diff":"^3.1.1","ts-jest":"^27.0.1","ts-node":"^9.1.1","tty-table":"^4.1.5",typescript:"^4.1.3"},"lint-staged":{"**/*.{js,jsx,ts}":"f2elint exec eslint"},jest:{coverageDirectory:"coverage",testEnvironment:"node",coverageProvider:"v8",preset:"ts-jest",testMatch:["**/test/**/*test.[jt]s"],setupFilesAfterEnv:["./jest.setup.ts"]},dependencies:{"@serverless-devs/core":"latest"}}});var Fi=C(be=>{"use strict";var s8=be&&be.__createBinding||(Object.create?function(r,e,t,s){s===void 0&&(s=t),Object.defineProperty(r,s,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,s){s===void 0&&(s=t),r[s]=e[t]}),o8=be&&be.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),u8=be&&be.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&s8(e,r,t);return o8(e,r),e},Am=be&&be.__awaiter||function(r,e,t,s){function o(a){return a instanceof t?a:new t(function(c){c(a)})}return new(t||(t=Promise))(function(a,c){function f(m){try{p(s.next(m))}catch(b){c(b)}}function d(m){try{p(s.throw(m))}catch(b){c(b)}}function p(m){m.done?a(m.value):o(m.value).then(f,d)}p((s=s.apply(r,e||[])).next())})},Om=be&&be.__generator||function(r,e){var t={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},s,o,a,c;return c={next:f(0),throw:f(1),return:f(2)},typeof Symbol=="function"&&(c[Symbol.iterator]=function(){return this}),c;function f(p){return function(m){return d([p,m])}}function d(p){if(s)throw new TypeError("Generator is already executing.");for(;t;)try{if(s=1,o&&(a=p[0]&2?o.return:p[0]?o.throw||((a=o.return)&&a.call(o),0):o.next)&&!(a=a.call(o,p[1])).done)return a;switch(o=0,a&&(p=[p[0]&2,a.value]),p[0]){case 0:case 1:a=p;break;case 4:return t.label++,{value:p[1],done:!1};case 5:t.label++,o=p[1],p=[0];continue;case 7:p=t.ops.pop(),t.trys.pop();continue;default:if(a=t.trys,!(a=a.length>0&&a[a.length-1])&&(p[0]===6||p[0]===2)){t=0;continue}if(p[0]===3&&(!a||p[1]>a[0]&&p[1]<a[3])){t.label=p[1];break}if(p[0]===6&&t.label<a[1]){t.label=a[1],a=p;break}if(a&&t.label<a[2]){t.label=a[2],t.ops.push(p);break}a[2]&&t.ops.pop(),t.trys.pop();continue}p=e.call(r,t)}catch(m){p=[6,m],o=0}finally{s=a=0}if(p[0]&5)throw p[1];return{value:p[0]?p[1]:void 0,done:!0}}},gu=be&&be.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(be,"__esModule",{value:!0});be.emoji=be.mark=be.replaceTemplate=be.getTemplatekey=be.replaceFun=be.getLang=be.printn=be.checkTemplateFile=be.checkAndReturnTemplateFile=be.yamlLoad=be.getFolderSize=be.getVersion=be.bgRed=be.red=void 0;var vt=gu(require("path")),Vt=gu(require("fs")),oc=gu(im()),a8=gu(require("os")),l8=sc(),mu=u8(Fr()),uc=mu.default.colors,c8=mu.default.jsyaml,yu=Cm();be.red=uc.hex("#fd5750");be.bgRed=uc.hex("#000").bgHex("#fd5750");function f8(){return(0,mu.getCoreVersion)()?yu.name+": "+yu.version+", @serverless-devs/core: "+(0,mu.getCoreVersion)()+", "+process.platform+"-"+process.arch+", node-"+process.version:yu.name+": "+yu.version+", "+process.platform+"-"+process.arch+", node-"+process.version}be.getVersion=f8;function h8(r){return Am(this,void 0,void 0,function(){function e(o){return Am(this,void 0,void 0,function(){var a,c;return Om(this,function(f){switch(f.label){case 0:return a=Vt.default.lstatSync(o),typeof a!="object"?[2]:(t.set(a.ino,a.size),a.isDirectory()?(c=Vt.default.readdirSync(o),typeof c!="object"?[2]:[4,Promise.all(c.map(function(d){return e(vt.default.join(o,d))}))]):[3,2]);case 1:f.sent(),f.label=2;case 2:return[2]}})})}var t,s;return Om(this,function(o){switch(o.label){case 0:return t=new Map,[4,e(r)];case 1:return o.sent(),s=Array.from(t.values()).reduce(function(a,c){return a+c},0),[2,s]}})})}be.getFolderSize=h8;function Fm(r){var e=Vt.default.readFileSync(r,"utf8");try{return c8.load(e)}catch{if(["-h","--help"].includes(process.argv[2]))return;var t=vt.default.basename(r);new l8.HumanError({errorMessage:t+" format is incorrect",tips:"Please check the configuration of "+t+", Serverless Devs' Yaml specification document can refer to\uFF1A"+uc.underline("https://github.com/Serverless-Devs/Serverless-Devs/blob/master/docs/zh/yaml.md")}),process.exit(1)}}be.yamlLoad=Fm;function Is(r,e){e===void 0&&(e=!1);var t=Vt.default.readFileSync(r,"utf8"),s=e?JSON.parse(t):Fm(r);if(!s)return!1;for(var o in s)if(s[o].Component&&s[o].Provider&&s[o].Properties)return!0;return s.hasOwnProperty("edition")}function Sm(){if(process.env.serverless_devs_temp_template)return process.env.serverless_devs_temp_template;var r=process.cwd(),e=process.argv.includes("-t")?"-t":process.argv.includes("--template")?"--template":null,t=e?process.argv.indexOf(e):-1;if(t!==-1){var s=t+1,o=process.argv[s];if(o&&(o.endsWith(".yaml")||o.endsWith(".yml")||o.endsWith(".json"))){var a=!!o.endsWith(".json");if(Vt.default.existsSync(vt.default.join(r,o))&&Is(vt.default.join(r,o),a)){process.argv.splice(t,2);var c=JSON.parse(process.env.serverless_devs_temp_argv);return c.splice(c.indexOf(e),2),process.env.serverless_devs_temp_argv=JSON.stringify(c),process.env.serverless_devs_temp_template=vt.default.join(r,o),vt.default.join(r,o)}else if(Vt.default.existsSync(o)&&Is(o,a)){process.argv.splice(t,2);var c=JSON.parse(process.env.serverless_devs_temp_argv);return c.splice(c.indexOf(e),2),process.env.serverless_devs_temp_argv=JSON.stringify(c),process.env.serverless_devs_temp_template=o,o}}}return Vt.default.existsSync(vt.default.join(r,"s.yaml"))&&Is(vt.default.join(r,"s.yaml"))?(process.env.serverless_devs_temp_template=vt.default.join(r,"s.yaml"),vt.default.join(r,"s.yaml")):Vt.default.existsSync(vt.default.join(r,"s.yml"))&&Is(vt.default.join(r,"s.yml"))?(process.env.serverless_devs_temp_template=vt.default.join(r,"s.yml"),vt.default.join(r,"s.yml")):Vt.default.existsSync(vt.default.join(r,"s.json"))&&Is(vt.default.join(r,"s.json"),!0)?(process.env.serverless_devs_temp_template=vt.default.join(r,"s.json"),vt.default.join(r,"s.json")):null}be.checkAndReturnTemplateFile=Sm;function Im(r){return Vt.default.existsSync(r)?r:null}be.checkTemplateFile=Im;function Rm(r,e){e===void 0&&(e=" ");for(var t="",s=0;s<r;s++)t=t+e;return t}be.printn=Rm;function Tm(){return"en"}be.getLang=Tm;function ac(r,e){var t=/\{\{(.*?)\}\}/g,s=r.match(t);if(s)for(var o=0;o<s.length;o++){var a=s[o].replace(/{{|}}/g,""),c=oc.default.trim(a.split("|")[0]);e[c]&&(r=r.replace(s[o],e[c]))}return r}be.replaceFun=ac;function qm(r){var e=/\{\{(.*?)\}\}/g,t=r.match(e);return t?t.filter(function(s){return s}).map(function(s){var o=s.replace(/{{|}}/g,""),a=o.split("|");return{name:oc.default.trim(a[0]),desc:oc.default.trim(a[1])}}):[]}be.getTemplatekey=qm;function Pm(r,e){r.forEach(function(t){if(Vt.default.existsSync(t)){var s=Vt.default.readFileSync(t,"utf-8"),o=ac(s,e);Vt.default.writeFileSync(t,o,"utf-8")}})}be.replaceTemplate=Pm;function $m(r){if(!r)return r;var e=r.slice(-4);return"***********"+e}be.mark=$m;function p8(r){return a8.default.platform()==="win32"?"":r}be.emoji=p8;be.default={checkAndReturnTemplateFile:Sm,checkTemplateFile:Im,printn:Rm,mark:$m,getLang:Tm,replaceTemplate:Pm,replaceFun:ac,getTemplatekey:qm}});var Bm=C(lc=>{"use strict";Object.defineProperty(lc,"__esModule",{value:!0});lc.default={clean_up_the_environment:"\u6E05\u7406\u73AF\u5883",display_help_for_command:"\u663E\u793A\u547D\u4EE4\u5E2E\u52A9",remove_components:"\u5220\u9664\u7EC4\u4EF6",delete_the_file_under_the_cache:"\u5220\u9664\u7F13\u5B58\u91CC\u7684\u7684<dirname>\u6587\u4EF6",record_your_log_information:"\u662F\u5426\u8BB0\u5F55\u60A8\u7684\u65E5\u5FD7\u4FE1\u606F\uFF1F",init_pproject_deploy_tip:"\u662F\u5426\u7ACB\u5373\u90E8\u7F72\u8BE5\u9879\u76EE\uFF1F",tip_for_a_serverless_project:"\u68C0\u6D4B\u5230\u5F53\u524D\u76EE\u5F55\u4E0B\u5DF2\u5B58\u5728\u4E00\u4E2AServerless-Devs\u9879\u76EE\uFF0C\u8BF7\u901A\u8FC7 's deploy' \u8FDB\u884C\u90E8\u7F72\u6216\u901A\u8FC7 's -h' \u83B7\u53D6\u66F4\u591A\u4FE1\u606F",create_a_new_project:"\u672A\u68C0\u6D4B\u5230 Serverless-Devs \u9879\u76EE\uFF0C\u662F\u5426\u65B0\u5EFA\u4E00\u4E2A\u9879\u76EE\uFF1F",en:"English (en)",zh:"\u4E2D\u6587 (zh)",select_current_language:"\u8BF7\u9009\u62E9\u5F53\u524D\u8BED\u8A00","app-tip":"\u8BF7\u9009\u62E9\u60A8\u5E0C\u671B\u521B\u5EFA\u7684 Serverless-Devs \u5E94\u7528","template-tip":"\u8BF7\u9009\u62E9\u60A8\u559C\u6B22\u7684\u6A21\u7248","fc-runtime-starter":"fc-runtime-starter - \u5FEB\u901F\u90E8\u7F72\u4E00\u4E2A FC \u51FD\u6570","fc-custom-container-stater":"fc-custom-container-stater - \u5FEB\u901F\u90E8\u7F72\u4E00\u4E2A custom-container \u5E94\u7528",web:"web-framework-stater - \u5FEB\u901F\u90E8\u7F72\u4E00\u4E2A Web \u6846\u67B6","static-site":"static-website-stater - \u5FEB\u901F\u90E8\u7F72\u4E00\u4E2A\u9759\u6001\u7F51\u7AD9","best-practice":"serverless-best-practice - \u5FEB\u901F\u4F53\u9A8C Serverless \u6700\u4F73\u5B9E\u8DF5","devs-template":"Serverless Devs \u5F00\u53D1\u6A21\u677F","fc-http-nodejs":"fc-http-nodejs - \u5FEB\u901F\u90E8\u7F72\u4E00\u4E2A nodejs12 \u51FD\u6570","fc-http-python":"fc-http-python - \u5FEB\u901F\u90E8\u7F72\u4E00\u4E2A python3 \u51FD\u6570","fc-http-java":"fc-http-java - \u5FEB\u901F\u90E8\u7F72\u4E00\u4E2A java8 \u51FD\u6570","fc-custom-container-event-python3":"fc-custom-container-event-python3 - \u5FEB\u901F\u90E8\u7F72\u4E00\u4E2A\u901A\u8FC7\u4E8B\u4EF6\u89E6\u53D1\u7684 python3 \u5E94\u7528","fc-custom-container-event-cpp":"fc-custom-container-event-cpp - \u5FEB\u901F\u90E8\u7F72\u4E00\u4E2A\u901A\u8FC7\u4E8B\u4EF6\u89E6\u53D1\u7684 cpp \u5E94\u7528","fc-custom-container-http-springboot":"fc-custom-container-http-springboot - \u5FEB\u901F\u90E8\u7F72\u4E00\u4E2A\u901A\u8FC7 HTTP \u8BF7\u6C42\u89E6\u53D1\u7684 springboot \u5E94\u7528","fc-custom-container-http-aspdotnetcore":"fc-custom-container-http-aspdotnetcore - \u5FEB\u901F\u90E8\u7F72\u4E00\u4E2A\u901A\u8FC7 HTTP \u8BF7\u6C42\u89E6\u53D1\u7684 aspdotnetcore \u5E94\u7528","express-starter":"express-starter - \u5FEB\u901F\u90E8\u7F72\u4E00\u4E2A express \u57FA\u7840\u5E94\u7528","koa-starter":"koa-starter - \u5FEB\u901F\u90E8\u7F72\u4E00\u4E2A koa \u57FA\u7840\u5E94\u7528","nuxtjs-starter":"nuxtjs-starter - \u5FEB\u901F\u90E8\u7F72\u4E00\u4E2A nuxtjs \u57FA\u7840\u5E94\u7528","eggjs-starter":"eggjs-starter - \u5FEB\u901F\u90E8\u7F72\u4E00\u4E2A eggjs \u57FA\u7840\u5E94\u7528","flask-starter":"flask-starter - \u5FEB\u901F\u90E8\u7F72\u4E00\u4E2A flask \u57FA\u7840\u5E94\u7528","SpringBoot-starter":"SpringBoot-starter - \u5FEB\u901F\u90E8\u7F72\u4E00\u4E2A SpringBoot \u57FA\u7840\u5E94\u7528","Zblog-starter":"Zblog-starter - \u5FEB\u901F\u90E8\u7F72\u4E00\u4E2A Zblog \u57FA\u7840\u5E94\u7528","website-starter":"website-starter - \u5FEB\u901F\u90E8\u7F72\u4E00\u4E2A\u9759\u6001\u7F51\u7AD9","react-starter":"react-starter - \u5FEB\u901F\u90E8\u7F72\u4E00\u4E2A React.js \u5E94\u7528","vue-starter":"vue-starter - \u5FEB\u901F\u90E8\u7F72\u4E00\u4E2A Vue.js \u5E94\u7528",puppeteer:"puppeteer - \u5FEB\u901F\u90E8\u7F72\u4E00\u4E2A\u57FA\u4E8E puppeteer \u622A\u56FE\u7684 Web \u5E94\u7528",ffmpeg:"ffmpeg - \u5FEB\u901F\u90E8\u7F72\u4E00\u4E2A\u57FA\u4E8E ffmpeg \u5B9E\u73B0\u97F3\u89C6\u9891\u5904\u7406\u5E94\u7528",pdf2Img:"pdf2Img - \u5FEB\u901F\u90E8\u7F72\u4E00\u4E2A pdf \u8F6C\u56FE\u7247\u5E94\u7528",tensorflow:"tensorflow - \u5FEB\u901F\u90E8\u7F72\u4E00\u4E2A tensorflow \u5E94\u7528",todoList:"todoList - \u5FEB\u901F\u90E8\u7F72\u4E00\u4E2A\u57FA\u4E8E nodejs \u7684\u7F51\u9875 TodoList \u5E94\u7528"}});var Nm=C(cc=>{"use strict";Object.defineProperty(cc,"__esModule",{value:!0});cc.default={clean_up_the_environment:"Clean up the environment",display_help_for_command:"Display help for command",remove_components:"Remove component (like: fc, fc@0.0.1)",delete_the_file_under_the_cache:"Delete the <dirname> file in the cache",record_your_log_information:"Do you record your log information?",init_pproject_deploy_tip:"Do you want to deploy the project immediately?",tip_for_a_serverless_project:"A Serverless-Devs project is detected in the current directory, please deploy via 's deploy' or get more information via 's -h'",create_a_new_project:"No Serverless-Devs project is currently detected. Do you want to create a new project?",en:"English (en)",zh:"Chinese (zh)",select_current_language:"Please select current language","app-tip":"Hello, serverlesser. Which template do you like?","template-tip":"Which template do you like?","fc-runtime-starter":"fc-runtime-starter - Deploy FC function in 5 minutes","fc-custom-container-stater":"fc-custom-container-stater - Deploy FC function with custom-container",web:"web-framework-stater-Quickly deploy a web framework","static-site":"static-website-stater-Quickly deploy a static website","best-practice":"serverless-best-practice-Quickly experience serverless best practices","devs-template":"Serverless Develop scaffold","fc-http-nodejs":"fc-http-nodejs - Deploy FC nodejs12 runtime function","fc-http-python":"fc-http-python - Deploy FC python3 runtime function","fc-http-java":"fc-http-java - Deploy FC java8 runtime function","fc-custom-container-event-python3":"fc-custom-container-event-python3 - Deploy python3 event-triggered application","fc-custom-container-event-cpp":"fc-custom-container-event-cpp - Deploy cpp event-triggered application","fc-custom-container-http-springboot":"fc-custom-container-http-springboot - Deploy springboot HTTP Request-triggered application","fc-custom-container-http-aspdotnetcore":"fc-custom-container-http-aspdotnetcore - Deploy dotnetcore HTTP Request-triggered application","express-starter":"express-starter - Deploy express application","koa-starter":"koa-starter - Deploy koa application","nuxtjs-starter":"nuxtjs-starter - Deploy nuxtjs application","eggjs-starter":"eggjs-starter - Deploy eggjs application","flask-starter":"flask-starter - Deploy flask application","SpringBoot-starter":"SpringBoot-starter - Deploy SpringBoot application","Zblog-starter":"Zblog-starter - Deploy Zblog application","website-starter":"website-starter - Deploy static website","react-starter":"react-starter - Deploy React.js application","vue-starter":"vue-starter - Deploy Vue.js application",puppeteer:"puppeteer - Deploy screenshot application base on puppeteer + fc",ffmpeg:"ffmpeg - Deploy audio and video processing application base on ffmpeg + fc",pdf2Img:"pdf2Img - Deploy pdf to images application",tensorflow:"tensorflow - Deploy tensorflow application",todoList:"todoList - Deploy todoList application"}});var Lm=C(Rs=>{"use strict";var jm=Rs&&Rs.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Rs,"__esModule",{value:!0});var d8=Fi(),g8=jm(Bm()),m8=jm(Nm()),fc={en:m8.default,zh:g8.default},y8=function(r){var e=(0,d8.getLang)(),t=fc[e]?fc[e][r]:fc.en[r];return t||r};Rs.default=y8});var km=C(Ts=>{"use strict";var D8=Ts&&Ts.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Ts,"__esModule",{value:!0});var Mm=D8(Fr()),v8=Mm.default.Logger,_8=Mm.default.spinner,jn=new v8("S-CLI"),b8=function(){function r(){}return r.log=function(e){jn.log(e)},r.info=function(e){jn.info(e)},r.debug=function(e){jn.debug(e)},r.error=function(e){jn.error(e)},r.warning=function(e){jn.warn(e)},r.success=function(e){jn.log(e,"green")},r.spinner=function(e){return _8(e)},r.output=function(e){return jn.output(e)},r}();Ts.default=b8});var Gm=C((SN,hc)=>{var Wm=require("stream"),E8=require("util");hc.exports=function(){let r,e;arguments.length===2?(r=arguments[0],e=arguments[1]):arguments.length===1?typeof arguments[0]=="function"?(r={},e=arguments[0]):r=arguments[0]:arguments.length===0&&(r={});let t=new Generator(r);if(e){let s=[];t.on("readable",function(){let o;for(;o=t.read();)s.push(o)}),t.on("error",e),t.on("end",function(){t.options.objectMode?e(null,s):t.options.encoding?e(null,s.join("")):e(null,Buffer.concat(s))})}return t};Generator=function(r={}){r.high_water_mark&&(r.highWaterMark=r.high_water_mark),r.object_mode&&(r.objectMode=r.object_mode),Wm.Readable.call(this,r),this.options={};for(let s in r)this.options[Generator.camelize(s)]=r[s];let e={columns:8,delimiter:",",duration:null,encoding:null,end:null,eof:!1,fixedSize:!1,length:-1,maxWordLength:16,rowDelimiter:`
|
|
46
46
|
`,seed:!1,sleep:0};for(let s in e)this.options[s]===void 0&&(this.options[s]=e[s]);this.options.eof===!0&&(this.options.eof=this.options.rowDelimiter),this._={start_time:this.options.duration?Date.now():null,fixed_size_buffer:"",count_written:0,count_created:0},typeof this.options.columns=="number"&&(this.options.columns=new Array(this.options.columns));let t=Object.keys(Generator).filter(s=>!["super_","camelize"].includes(s));for(let s=0;s<this.options.columns.length;s++){let o=this.options.columns[s]||"ascii";if(typeof o=="string"){if(!t.includes(o))throw Error(`Invalid column type: got "${o}", default values are ${JSON.stringify(t)}`);this.options.columns[s]=Generator[o]}}return this};E8.inherits(Generator,Wm.Readable);hc.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(r){let e=[],t=this._.fixed_size_buffer.length;for(t!==0&&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(let a of e)this.__push(a);else this.__push(e.join("")+(this.options.eof?this.options.eof:""));return this.push(null)}let s=[],o;if(this.options.columns.forEach(a=>{s.push(a(this))}),this.options.objectMode){o=0;for(let a of s)o+=a.length}else s=(this._.count_created===0?"":this.options.rowDelimiter)+s.join(this.options.delimiter),o=s.length;if(this._.count_created++,t+o>r){if(this.options.objectMode){e.push(s);for(let a of e)this.__push(a)}else this.options.fixedSize?(this._.fixed_size_buffer=s.substr(r-t),e.push(s.substr(0,r-t))):e.push(s),this.__push(e.join(""));return}t+=o,e.push(s)}};Generator.prototype.__push=function(r){this._.count_written++,this.options.sleep>0?setTimeout(()=>{this.push(r)},this.options.sleep):this.push(r)};Generator.ascii=function(r){let e=[],t=Math.ceil(r.random()*r.options.maxWordLength);for(let s=0;s<t;s++){let o=Math.floor(r.random()*32);e.push(String.fromCharCode(o+(o<16?65:97-16)))}return e.join("")};Generator.int=function(r){return Math.floor(r.random()*Math.pow(2,52))};Generator.bool=function(r){return Math.floor(r.random()*2)};Generator.camelize=function(r){return r.replace(/_([a-z])/gi,function(e,t,s){return t.toUpperCase()})}});var zm=C((IN,Hm)=>{var Um=class{constructor(e=100){this.size=e,this.length=0,this.buf=Buffer.alloc(e)}prepend(e){if(Buffer.isBuffer(e)){let t=this.length+e.length;if(t>=this.size&&(this.resize(),t>=this.size))throw Error("INVALID_BUFFER_STATE");let s=this.buf;this.buf=Buffer.alloc(this.size),e.copy(this.buf,0),s.copy(this.buf,e.length),this.length+=e.length}else{let t=this.length++;t===this.size&&this.resize();let s=this.clone();this.buf[0]=e,s.copy(this.buf,1,0,t)}}append(e){let t=this.length++;t===this.size&&this.resize(),this.buf[t]=e}clone(){return Buffer.from(this.buf.slice(0,this.length))}resize(){let e=this.length;this.size=this.size*2;let t=Buffer.alloc(this.size);this.buf.copy(t,0,0,e),this.buf=t}toString(e){return e?this.buf.slice(0,this.length).toString(e):Uint8Array.prototype.slice.call(this.buf.slice(0,this.length))}toJSON(){return this.toString("utf8")}reset(){this.length=0}};Hm.exports=Um});var Zm=C((RN,Xm)=>{var{Transform:w8}=require("stream"),Vm=zm(),x8=9,Du=10,C8=12,pc=13,A8=32,vu={utf8:Buffer.from([239,187,191]),utf16le:Buffer.from([255,254])},dc=class extends w8{constructor(e={}){super(sn(qt({readableObjectMode:!0},e),{encoding:null}));this.__originalOptions=e,this.__normalizeOptions(e)}__normalizeOptions(e){let t={};for(let c in e)t[O8(c)]=e[c];if(t.encoding===void 0||t.encoding===!0)t.encoding="utf8";else if(t.encoding===null||t.encoding===!1)t.encoding=null;else if(typeof t.encoding!="string"&&t.encoding!==null)throw new Ue("CSV_INVALID_OPTION_ENCODING",["Invalid option encoding:","encoding must be a string or null to return a buffer,",`got ${JSON.stringify(t.encoding)}`],t);if(t.bom===void 0||t.bom===null||t.bom===!1)t.bom=!1;else if(t.bom!==!0)throw new Ue("CSV_INVALID_OPTION_BOM",["Invalid option bom:","bom must be true,",`got ${JSON.stringify(t.bom)}`],t);let s=null;if(t.cast===void 0||t.cast===null||t.cast===!1||t.cast==="")t.cast=void 0;else if(typeof t.cast=="function")s=t.cast,t.cast=!0;else if(t.cast!==!0)throw new Ue("CSV_INVALID_OPTION_CAST",["Invalid option cast:","cast must be true or a function,",`got ${JSON.stringify(t.cast)}`],t);if(t.cast_date===void 0||t.cast_date===null||t.cast_date===!1||t.cast_date==="")t.cast_date=!1;else if(t.cast_date===!0)t.cast_date=function(c){let f=Date.parse(c);return isNaN(f)?c:new Date(f)};else throw new Ue("CSV_INVALID_OPTION_CAST_DATE",["Invalid option cast_date:","cast_date must be true or a function,",`got ${JSON.stringify(t.cast_date)}`],t);let o=null;if(t.columns===!0)o=void 0;else if(typeof t.columns=="function")o=t.columns,t.columns=!0;else if(Array.isArray(t.columns))t.columns=Ym(t.columns);else if(t.columns===void 0||t.columns===null||t.columns===!1)t.columns=!1;else throw new Ue("CSV_INVALID_OPTION_COLUMNS",["Invalid option columns:","expect an array, a function or true,",`got ${JSON.stringify(t.columns)}`],t);if(t.columns_duplicates_to_array===void 0||t.columns_duplicates_to_array===null||t.columns_duplicates_to_array===!1)t.columns_duplicates_to_array=!1;else{if(t.columns_duplicates_to_array!==!0)throw new Ue("CSV_INVALID_OPTION_COLUMNS_DUPLICATES_TO_ARRAY",["Invalid option columns_duplicates_to_array:","expect an boolean,",`got ${JSON.stringify(t.columns_duplicates_to_array)}`],t);if(t.columns===!1)throw new Ue("CSV_INVALID_OPTION_COLUMNS_DUPLICATES_TO_ARRAY",["Invalid option columns_duplicates_to_array:","the `columns` mode must be activated."],t)}if(t.comment===void 0||t.comment===null||t.comment===!1||t.comment==="")t.comment=null;else if(typeof t.comment=="string"&&(t.comment=Buffer.from(t.comment,t.encoding)),!Buffer.isBuffer(t.comment))throw new Ue("CSV_INVALID_OPTION_COMMENT",["Invalid option comment:","comment must be a buffer or a string,",`got ${JSON.stringify(t.comment)}`],t);let a=JSON.stringify(t.delimiter);if(Array.isArray(t.delimiter)||(t.delimiter=[t.delimiter]),t.delimiter.length===0)throw new Ue("CSV_INVALID_OPTION_DELIMITER",["Invalid option delimiter:","delimiter must be a non empty string or buffer or array of string|buffer,",`got ${a}`],t);if(t.delimiter=t.delimiter.map(function(c){if(c==null||c===!1)return Buffer.from(",",t.encoding);if(typeof c=="string"&&(c=Buffer.from(c,t.encoding)),!Buffer.isBuffer(c)||c.length===0)throw new Ue("CSV_INVALID_OPTION_DELIMITER",["Invalid option delimiter:","delimiter must be a non empty string or buffer or array of string|buffer,",`got ${a}`],t);return c}),t.escape===void 0||t.escape===!0?t.escape=Buffer.from('"',t.encoding):typeof t.escape=="string"?t.escape=Buffer.from(t.escape,t.encoding):(t.escape===null||t.escape===!1)&&(t.escape=null),t.escape!==null&&!Buffer.isBuffer(t.escape))throw new Error(`Invalid Option: escape must be a buffer, a string or a boolean, got ${JSON.stringify(t.escape)}`);if(t.from===void 0||t.from===null)t.from=1;else if(typeof t.from=="string"&&/\d+/.test(t.from)&&(t.from=parseInt(t.from)),Number.isInteger(t.from)){if(t.from<0)throw new Error(`Invalid Option: from must be a positive integer, got ${JSON.stringify(e.from)}`)}else throw new Error(`Invalid Option: from must be an integer, got ${JSON.stringify(t.from)}`);if(t.from_line===void 0||t.from_line===null)t.from_line=1;else if(typeof t.from_line=="string"&&/\d+/.test(t.from_line)&&(t.from_line=parseInt(t.from_line)),Number.isInteger(t.from_line)){if(t.from_line<=0)throw new Error(`Invalid Option: from_line must be a positive integer greater than 0, got ${JSON.stringify(e.from_line)}`)}else throw new Error(`Invalid Option: from_line must be an integer, got ${JSON.stringify(e.from_line)}`);if(t.ignore_last_delimiters===void 0||t.ignore_last_delimiters===null)t.ignore_last_delimiters=!1;else if(typeof t.ignore_last_delimiters=="number")t.ignore_last_delimiters=Math.floor(t.ignore_last_delimiters),t.ignore_last_delimiters===0&&(t.ignore_last_delimiters=!1);else if(typeof t.ignore_last_delimiters!="boolean")throw new Ue("CSV_INVALID_OPTION_IGNORE_LAST_DELIMITERS",["Invalid option `ignore_last_delimiters`:","the value must be a boolean value or an integer,",`got ${JSON.stringify(t.ignore_last_delimiters)}`],t);if(t.ignore_last_delimiters===!0&&t.columns===!1)throw new Ue("CSV_IGNORE_LAST_DELIMITERS_REQUIRES_COLUMNS",["The option `ignore_last_delimiters`","requires the activation of the `columns` option"],t);if(t.info===void 0||t.info===null||t.info===!1)t.info=!1;else if(t.info!==!0)throw new Error(`Invalid Option: info must be true, got ${JSON.stringify(t.info)}`);if(t.max_record_size===void 0||t.max_record_size===null||t.max_record_size===!1)t.max_record_size=0;else if(!(Number.isInteger(t.max_record_size)&&t.max_record_size>=0))if(typeof t.max_record_size=="string"&&/\d+/.test(t.max_record_size))t.max_record_size=parseInt(t.max_record_size);else throw new Error(`Invalid Option: max_record_size must be a positive integer, got ${JSON.stringify(t.max_record_size)}`);if(t.objname===void 0||t.objname===null||t.objname===!1)t.objname=void 0;else if(Buffer.isBuffer(t.objname)){if(t.objname.length===0)throw new Error("Invalid Option: objname must be a non empty buffer");t.encoding===null||(t.objname=t.objname.toString(t.encoding))}else if(typeof t.objname=="string"){if(t.objname.length===0)throw new Error("Invalid Option: objname must be a non empty string")}else throw new Error(`Invalid Option: objname must be a string or a buffer, got ${t.objname}`);if(t.on_record===void 0||t.on_record===null)t.on_record=void 0;else if(typeof t.on_record!="function")throw new Ue("CSV_INVALID_OPTION_ON_RECORD",["Invalid option `on_record`:","expect a function,",`got ${JSON.stringify(t.on_record)}`],t);if(t.quote===null||t.quote===!1||t.quote==="")t.quote=null;else if(t.quote===void 0||t.quote===!0?t.quote=Buffer.from('"',t.encoding):typeof t.quote=="string"&&(t.quote=Buffer.from(t.quote,t.encoding)),!Buffer.isBuffer(t.quote))throw new Error(`Invalid Option: quote must be a buffer or a string, got ${JSON.stringify(t.quote)}`);if(t.raw===void 0||t.raw===null||t.raw===!1)t.raw=!1;else if(t.raw!==!0)throw new Error(`Invalid Option: raw must be true, got ${JSON.stringify(t.raw)}`);if(t.record_delimiter?Array.isArray(t.record_delimiter)||(t.record_delimiter=[t.record_delimiter]):t.record_delimiter=[],t.record_delimiter=t.record_delimiter.map(function(c){return typeof c=="string"&&(c=Buffer.from(c,t.encoding)),c}),typeof t.relax!="boolean")if(t.relax===void 0||t.relax===null)t.relax=!1;else throw new Error(`Invalid Option: relax must be a boolean, got ${JSON.stringify(t.relax)}`);if(typeof t.relax_column_count!="boolean")if(t.relax_column_count===void 0||t.relax_column_count===null)t.relax_column_count=!1;else throw new Error(`Invalid Option: relax_column_count must be a boolean, got ${JSON.stringify(t.relax_column_count)}`);if(typeof t.relax_column_count_less!="boolean")if(t.relax_column_count_less===void 0||t.relax_column_count_less===null)t.relax_column_count_less=!1;else throw new Error(`Invalid Option: relax_column_count_less must be a boolean, got ${JSON.stringify(t.relax_column_count_less)}`);if(typeof t.relax_column_count_more!="boolean")if(t.relax_column_count_more===void 0||t.relax_column_count_more===null)t.relax_column_count_more=!1;else throw new Error(`Invalid Option: relax_column_count_more must be a boolean, got ${JSON.stringify(t.relax_column_count_more)}`);if(typeof t.skip_empty_lines!="boolean")if(t.skip_empty_lines===void 0||t.skip_empty_lines===null)t.skip_empty_lines=!1;else throw new Error(`Invalid Option: skip_empty_lines must be a boolean, got ${JSON.stringify(t.skip_empty_lines)}`);if(typeof t.skip_lines_with_empty_values!="boolean")if(t.skip_lines_with_empty_values===void 0||t.skip_lines_with_empty_values===null)t.skip_lines_with_empty_values=!1;else throw new Error(`Invalid Option: skip_lines_with_empty_values must be a boolean, got ${JSON.stringify(t.skip_lines_with_empty_values)}`);if(typeof t.skip_lines_with_error!="boolean")if(t.skip_lines_with_error===void 0||t.skip_lines_with_error===null)t.skip_lines_with_error=!1;else throw new Error(`Invalid Option: skip_lines_with_error must be a boolean, got ${JSON.stringify(t.skip_lines_with_error)}`);if(t.rtrim===void 0||t.rtrim===null||t.rtrim===!1)t.rtrim=!1;else if(t.rtrim!==!0)throw new Error(`Invalid Option: rtrim must be a boolean, got ${JSON.stringify(t.rtrim)}`);if(t.ltrim===void 0||t.ltrim===null||t.ltrim===!1)t.ltrim=!1;else if(t.ltrim!==!0)throw new Error(`Invalid Option: ltrim must be a boolean, got ${JSON.stringify(t.ltrim)}`);if(t.trim===void 0||t.trim===null||t.trim===!1)t.trim=!1;else if(t.trim!==!0)throw new Error(`Invalid Option: trim must be a boolean, got ${JSON.stringify(t.trim)}`);if(t.trim===!0&&e.ltrim!==!1?t.ltrim=!0:t.ltrim!==!0&&(t.ltrim=!1),t.trim===!0&&e.rtrim!==!1?t.rtrim=!0:t.rtrim!==!0&&(t.rtrim=!1),t.to===void 0||t.to===null)t.to=-1;else if(typeof t.to=="string"&&/\d+/.test(t.to)&&(t.to=parseInt(t.to)),Number.isInteger(t.to)){if(t.to<=0)throw new Error(`Invalid Option: to must be a positive integer greater than 0, got ${JSON.stringify(e.to)}`)}else throw new Error(`Invalid Option: to must be an integer, got ${JSON.stringify(e.to)}`);if(t.to_line===void 0||t.to_line===null)t.to_line=-1;else if(typeof t.to_line=="string"&&/\d+/.test(t.to_line)&&(t.to_line=parseInt(t.to_line)),Number.isInteger(t.to_line)){if(t.to_line<=0)throw new Error(`Invalid Option: to_line must be a positive integer greater than 0, got ${JSON.stringify(e.to_line)}`)}else throw new Error(`Invalid Option: to_line must be an integer, got ${JSON.stringify(e.to_line)}`);this.info={bytes:0,comment_lines:0,empty_lines:0,invalid_field_length:0,lines:1,records:0},this.options=t,this.state={bomSkipped:!1,bufBytesStart:0,castField:s,commenting:!1,error:void 0,enabled:t.from_line===1,escaping:!1,escapeIsQuote:Buffer.isBuffer(t.escape)&&Buffer.isBuffer(t.quote)&&Buffer.compare(t.escape,t.quote)===0,expectedRecordLength:Array.isArray(t.columns)?t.columns.length:void 0,field:new Vm(20),firstLineToHeaders:o,needMoreDataSize:Math.max(t.comment!==null?t.comment.length:0,...t.delimiter.map(c=>c.length),t.quote!==null?t.quote.length:0),previousBuf:void 0,quoting:!1,stop:!1,rawBuffer:new Vm(100),record:[],recordHasError:!1,record_length:0,recordDelimiterMaxLength:t.record_delimiter.length===0?2:Math.max(...t.record_delimiter.map(c=>c.length)),trimChars:[Buffer.from(" ",t.encoding)[0],Buffer.from(" ",t.encoding)[0]],wasQuoting:!1,wasRowDelimiter:!1}}_transform(e,t,s){if(this.state.stop===!0)return;let o=this.__parse(e,!1);o!==void 0&&(this.state.stop=!0),s(o)}_flush(e){if(this.state.stop===!0)return;let t=this.__parse(void 0,!0);e(t)}__parse(e,t){let{bom:s,comment:o,escape:a,from_line:c,ltrim:f,max_record_size:d,quote:p,raw:m,relax:b,rtrim:w,skip_empty_lines:q,to:I,to_line:_}=this.options,{record_delimiter:T}=this.options,{bomSkipped:M,previousBuf:W,rawBuffer:K,escapeIsQuote:Y}=this.state,Q;if(W===void 0)if(e===void 0){this.push(null);return}else Q=e;else W!==void 0&&e===void 0?Q=W:Q=Buffer.concat([W,e]);if(M===!1)if(s===!1)this.state.bomSkipped=!0;else if(Q.length<3){if(t===!1){this.state.previousBuf=Q;return}}else{for(let $ in vu)if(vu[$].compare(Q,0,vu[$].length)===0){let G=vu[$].length;this.state.bufBytesStart+=G,Q=Q.slice(G),this.__normalizeOptions(sn(qt({},this.__originalOptions),{encoding:$}));break}this.state.bomSkipped=!0}let Pe=Q.length,X;for(X=0;X<Pe&&!this.__needMoreData(X,Pe,t);X++){if(this.state.wasRowDelimiter===!0&&(this.info.lines++,this.state.wasRowDelimiter=!1),_!==-1&&this.info.lines>_){this.state.stop=!0,this.push(null);return}this.state.quoting===!1&&T.length===0&&this.__autoDiscoverRecordDelimiter(Q,X)&&(T=this.options.record_delimiter);let $=Q[X];if(m===!0&&K.append($),($===pc||$===Du)&&this.state.wasRowDelimiter===!1&&(this.state.wasRowDelimiter=!0),this.state.escaping===!0)this.state.escaping=!1;else{if(a!==null&&this.state.quoting===!0&&this.__isEscape(Q,X,$)&&X+a.length<Pe)if(Y){if(this.__isQuote(Q,X+a.length)){this.state.escaping=!0,X+=a.length-1;continue}}else{this.state.escaping=!0,X+=a.length-1;continue}if(this.state.commenting===!1&&this.__isQuote(Q,X))if(this.state.quoting===!0){let ee=Q[X+p.length],Se=w&&this.__isCharTrimable(ee),Oe=o!==null&&this.__compareBytes(o,Q,X+p.length,ee),Ie=this.__isDelimiter(Q,X+p.length,ee),ze=T.length===0?this.__autoDiscoverRecordDelimiter(Q,X+p.length):this.__isRecordDelimiter(ee,Q,X+p.length);if(a!==null&&this.__isEscape(Q,X,$)&&this.__isQuote(Q,X+a.length))X+=a.length-1;else if(!ee||Ie||ze||Oe||Se){this.state.quoting=!1,this.state.wasQuoting=!0,X+=p.length-1;continue}else if(b===!1){let ye=this.__error(new Ue("CSV_INVALID_CLOSING_QUOTE",["Invalid Closing Quote:",`got "${String.fromCharCode(ee)}"`,`at line ${this.info.lines}`,"instead of delimiter, record delimiter, trimable character","(if activated) or comment"],this.options,this.__infoField()));if(ye!==void 0)return ye}else this.state.quoting=!1,this.state.wasQuoting=!0,this.state.field.prepend(p),X+=p.length-1}else if(this.state.field.length!==0){if(b===!1){let ee=this.__error(new Ue("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(ee!==void 0)return ee}}else{this.state.quoting=!0,X+=p.length-1;continue}if(this.state.quoting===!1){let ee=this.__isRecordDelimiter($,Q,X);if(ee!==0){if(this.state.commenting&&this.state.wasQuoting===!1&&this.state.record.length===0&&this.state.field.length===0)this.info.comment_lines++;else{if(this.state.enabled===!1&&this.info.lines+(this.state.wasRowDelimiter===!0?1:0)>=c){this.state.enabled=!0,this.__resetField(),this.__resetRecord(),X+=ee-1;continue}if(q===!0&&this.state.wasQuoting===!1&&this.state.record.length===0&&this.state.field.length===0){this.info.empty_lines++,X+=ee-1;continue}this.info.bytes=this.state.bufBytesStart+X;let ze=this.__onField();if(ze!==void 0)return ze;this.info.bytes=this.state.bufBytesStart+X+ee;let ye=this.__onRecord();if(ye!==void 0)return ye;if(I!==-1&&this.info.records>=I){this.state.stop=!0,this.push(null);return}}this.state.commenting=!1,X+=ee-1;continue}if(this.state.commenting)continue;if((o===null?0:this.__compareBytes(o,Q,X,$))!==0){this.state.commenting=!0;continue}let Oe=this.__isDelimiter(Q,X,$);if(Oe!==0){this.info.bytes=this.state.bufBytesStart+X;let Ie=this.__onField();if(Ie!==void 0)return Ie;X+=Oe-1;continue}}}if(this.state.commenting===!1&&d!==0&&this.state.record_length+this.state.field.length>d){let ee=this.__error(new Ue("CSV_MAX_RECORD_SIZE",["Max Record Size:","record exceed the maximum number of tolerated bytes",`of ${d}`,`at line ${this.info.lines}`],this.options,this.__infoField()));if(ee!==void 0)return ee}let G=f===!1||this.state.quoting===!0||this.state.field.length!==0||!this.__isCharTrimable($),fe=w===!1||this.state.wasQuoting===!1;if(G===!0&&fe===!0)this.state.field.append($);else if(w===!0&&!this.__isCharTrimable($)){let ee=this.__error(new Ue("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(ee!==void 0)return ee}}if(t===!0)if(this.state.quoting===!0){let $=this.__error(new Ue("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)return $}else if(this.state.wasQuoting===!0||this.state.record.length!==0||this.state.field.length!==0){this.info.bytes=this.state.bufBytesStart+X;let $=this.__onField();if($!==void 0)return $;let G=this.__onRecord();if(G!==void 0)return G}else this.state.wasRowDelimiter===!0?this.info.empty_lines++:this.state.commenting===!0&&this.info.comment_lines++;else this.state.bufBytesStart+=X,this.state.previousBuf=Q.slice(X);this.state.wasRowDelimiter===!0&&(this.info.lines++,this.state.wasRowDelimiter=!1)}__onRecord(){let{columns:e,columns_duplicates_to_array:t,encoding:s,info:o,from:a,relax_column_count:c,relax_column_count_less:f,relax_column_count_more:d,raw:p,skip_lines_with_empty_values:m}=this.options,{enabled:b,record:w}=this.state;if(b===!1)return this.__resetRecord();let q=w.length;if(e===!0){if(m===!0&&Km(w)){this.__resetRecord();return}return this.__firstLineToColumns(w)}if(e===!1&&this.info.records===0&&(this.state.expectedRecordLength=q),q!==this.state.expectedRecordLength){let I=e===!1?new Ue("CSV_INCONSISTENT_RECORD_LENGTH",["Invalid Record Length:",`expect ${this.state.expectedRecordLength},`,`got ${q} on line ${this.info.lines}`],this.options,this.__infoField(),{record:w}):new Ue("CSV_RECORD_DONT_MATCH_COLUMNS_LENGTH",["Invalid Record Length:",`columns length is ${e.length},`,`got ${q} on line ${this.info.lines}`],this.options,this.__infoField(),{record:w});if(c===!0||f===!0&&q<this.state.expectedRecordLength||d===!0&&q>this.state.expectedRecordLength)this.info.invalid_field_length++,this.state.error=I;else{let _=this.__error(I);if(_)return _}}if(m===!0&&Km(w)){this.__resetRecord();return}if(this.state.recordHasError===!0){this.__resetRecord(),this.state.recordHasError=!1;return}if(this.info.records++,a===1||this.info.records>=a)if(e!==!1){let I={};for(let T=0,M=w.length;T<M;T++)e[T]===void 0||e[T].disabled||(t===!0&&I[e[T].name]!==void 0?Array.isArray(I[e[T].name])?I[e[T].name]=I[e[T].name].concat(w[T]):I[e[T].name]=[I[e[T].name],w[T]]:I[e[T].name]=w[T]);let{objname:_}=this.options;if(_===void 0)if(p===!0||o===!0){let T=this.__push(Object.assign({record:I},p===!0?{raw:this.state.rawBuffer.toString(s)}:{},o===!0?{info:this.__infoRecord()}:{}));if(T)return T}else{let T=this.__push(I);if(T)return T}else if(p===!0||o===!0){let T=this.__push(Object.assign({record:[I[_],I]},p===!0?{raw:this.state.rawBuffer.toString(s)}:{},o===!0?{info:this.__infoRecord()}:{}));if(T)return T}else{let T=this.__push([I[_],I]);if(T)return T}}else if(p===!0||o===!0){let I=this.__push(Object.assign({record:w},p===!0?{raw:this.state.rawBuffer.toString(s)}:{},o===!0?{info:this.__infoRecord()}:{}));if(I)return I}else{let I=this.__push(w);if(I)return I}this.__resetRecord()}__firstLineToColumns(e){let{firstLineToHeaders:t}=this.state;try{let s=t===void 0?e:t.call(null,e);if(!Array.isArray(s))return this.__error(new Ue("CSV_INVALID_COLUMN_MAPPING",["Invalid Column Mapping:","expect an array from column function,",`got ${JSON.stringify(s)}`],this.options,this.__infoField(),{headers:s}));let o=Ym(s);this.state.expectedRecordLength=o.length,this.options.columns=o,this.__resetRecord();return}catch(s){return s}}__resetRecord(){this.options.raw===!0&&this.state.rawBuffer.reset(),this.state.error=void 0,this.state.record=[],this.state.record_length=0}__onField(){let{cast:e,encoding:t,rtrim:s,max_record_size:o}=this.options,{enabled:a,wasQuoting:c}=this.state;if(a===!1)return this.__resetField();let f=this.state.field.toString(t);if(s===!0&&c===!1&&(f=f.trimRight()),e===!0){let[d,p]=this.__cast(f);if(d!==void 0)return d;f=p}this.state.record.push(f),o!==0&&typeof f=="string"&&(this.state.record_length+=f.length),this.__resetField()}__resetField(){this.state.field.reset(),this.state.wasQuoting=!1}__push(e){let{on_record:t}=this.options;if(t!==void 0){let s=this.__infoRecord();try{e=t.call(null,e,s)}catch(o){return o}if(e==null)return}this.push(e)}__cast(e){let{columns:t,relax_column_count:s}=this.options;if(Array.isArray(t)===!0&&s&&this.options.columns.length<=this.state.record.length)return[void 0,void 0];if(this.state.castField!==null)try{let a=this.__infoField();return[void 0,this.state.castField.call(null,e,a)]}catch(a){return[a]}if(this.__isFloat(e))return[void 0,parseFloat(e)];if(this.options.cast_date!==!1){let a=this.__infoField();return[void 0,this.options.cast_date.call(null,e,a)]}return[void 0,e]}__isCharTrimable(e){return e===A8||e===x8||e===pc||e===Du||e===C8}__isFloat(e){return e-parseFloat(e)+1>=0}__compareBytes(e,t,s,o){if(e[0]!==o)return 0;let a=e.length;for(let c=1;c<a;c++)if(e[c]!==t[s+c])return 0;return a}__needMoreData(e,t,s){if(s)return!1;let{quote:o}=this.options,{quoting:a,needMoreDataSize:c,recordDelimiterMaxLength:f}=this.state,d=t-e-1,p=Math.max(c,f,a?o.length+f:0);return d<p}__isDelimiter(e,t,s){let{delimiter:o,ignore_last_delimiters:a}=this.options;if(a===!0&&this.state.record.length===this.options.columns.length-1)return 0;if(a!==!1&&typeof a=="number"&&this.state.record.length===a-1)return 0;e:for(let c=0;c<o.length;c++){let f=o[c];if(f[0]===s){for(let d=1;d<f.length;d++)if(f[d]!==e[t+d])continue e;return f.length}}return 0}__isRecordDelimiter(e,t,s){let{record_delimiter:o}=this.options,a=o.length;e:for(let c=0;c<a;c++){let f=o[c],d=f.length;if(f[0]===e){for(let p=1;p<d;p++)if(f[p]!==t[s+p])continue e;return f.length}}return 0}__isEscape(e,t,s){let{escape:o}=this.options;if(o===null)return!1;let a=o.length;if(o[0]===s){for(let c=0;c<a;c++)if(o[c]!==e[t+c])return!1;return!0}return!1}__isQuote(e,t){let{quote:s}=this.options;if(s===null)return!1;let o=s.length;for(let a=0;a<o;a++)if(s[a]!==e[t+a])return!1;return!0}__autoDiscoverRecordDelimiter(e,t){let{encoding:s}=this.options,o=e[t];return o===pc?e[t+1]===Du?(this.options.record_delimiter.push(Buffer.from(`\r
|
|
47
47
|
`,s)),this.state.recordDelimiterMaxLength=2,2):(this.options.record_delimiter.push(Buffer.from("\r",s)),this.state.recordDelimiterMaxLength=1,1):o===Du?(this.options.record_delimiter.push(Buffer.from(`
|
|
48
48
|
`,s)),this.state.recordDelimiterMaxLength=1,1):0}__error(e){let{skip_lines_with_error:t}=this.options,s=typeof e=="string"?new Error(e):e;if(t){this.state.recordHasError=!0,this.emit("skip",s);return}else return s}__infoDataSet(){return sn(qt({},this.info),{columns:this.options.columns})}__infoRecord(){let{columns:e}=this.options;return sn(qt({},this.__infoDataSet()),{error:this.state.error,header:e===!0,index:this.state.record.length})}__infoField(){let{columns:e}=this.options,t=Array.isArray(e);return sn(qt({},this.__infoRecord()),{column:t===!0?e.length>this.state.record.length?e[this.state.record.length].name:null:this.state.record.length,quoting:this.state.wasQuoting})}},gc=function(){let r,e,t;for(let o in arguments){let a=arguments[o],c=typeof a;if(r===void 0&&(typeof a=="string"||Buffer.isBuffer(a)))r=a;else if(e===void 0&&Jm(a))e=a;else if(t===void 0&&c==="function")t=a;else throw new Ue("CSV_INVALID_ARGUMENT",["Invalid argument:",`got ${JSON.stringify(a)} at index ${o}`],e||{})}let s=new dc(e);if(t){let o=e===void 0||e.objname===void 0?[]:{};s.on("readable",function(){let a;for(;(a=this.read())!==null;)e===void 0||e.objname===void 0?o.push(a):o[a[0]]=a[1]}),s.on("error",function(a){t(a,void 0,s.__infoDataSet())}),s.on("end",function(){t(void 0,o,s.__infoDataSet())})}return r!==void 0&&(typeof setImmediate=="function"?setImmediate(function(){s.write(r),s.end()}):(s.write(r),s.end())),s},Ue=class extends Error{constructor(e,t,s,...o){Array.isArray(t)&&(t=t.join(" "));super(t);Error.captureStackTrace!==void 0&&Error.captureStackTrace(this,Ue),this.code=e;for(let a of o)for(let c in a){let f=a[c];this[c]=Buffer.isBuffer(f)?f.toString(s.encoding):f==null?f:JSON.parse(JSON.stringify(f))}}};gc.Parser=dc;gc.CsvError=Ue;Xm.exports=gc;var O8=function(r){return r.replace(/([A-Z])/g,function(e,t){return"_"+t.toLowerCase()})},Jm=function(r){return typeof r=="object"&&r!==null&&!Array.isArray(r)},Km=function(r){return r.every(e=>e==null||e.toString&&e.toString().trim()==="")},Ym=function(r){let e=[];for(let t=0,s=r.length;t<s;t++){let o=r[t];if(o==null||o===!1)e[t]={disabled:!0};else if(typeof o=="string")e[t]={name:o};else if(Jm(o)){if(typeof o.name!="string")throw new Ue("CSV_OPTION_COLUMNS_MISSING_NAME",["Option columns missing name:",`property "name" is required at position ${t}`,"when column is an object literal"]);e[t]=o}else throw new Ue("CSV_INVALID_COLUMN_DEFINITION",["Invalid column definition:","expect a string or a literal object,",`got ${JSON.stringify(o)} at position ${t}`])}return e}});var ey=C(We=>{"use strict";Object.defineProperty(We,"__esModule",{value:!0});function Ii(r){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Ii=function(e){return typeof e}:Ii=function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ii(r)}var Qm;We.clone=void 0;We.compare=void 0;We.is_object=void 0;We.is_object_literal=void 0;We.merge=void 0;We.mutate=void 0;We.snake_case=void 0;We.merge=function(){return We.mutate.apply(void 0,[{}].concat(Array.prototype.slice.call(arguments)))};We.clone=function(e){return Array.isArray(e)?e.map(function(t){return We.clone(t)}):e&&Ii(e)==="object"?We.mutate({},e):e};We.mutate=function(){var e,t,s,o,a,c,f;for(c=arguments[0],e=t=1,o=arguments.length;1<=o?t<o:t>o;e=1<=o?++t:--t)if(a=arguments[e],We.is_object_literal(a)){We.is_object_literal(c)||(c={});for(s in a)/__proto__|prototype/.test(s)||(c[s]=We.mutate(c[s],a[s]))}else Array.isArray(a)?c=function(){var d,p,m;for(m=[],d=0,p=a.length;d<p;d++)f=a[d],m.push(We.mutate(void 0,f));return m}():a!==void 0&&(c=a);return c};We.snake_case=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,s,o,a,c;if(a={},We.is_object_literal(e)){c=typeof t=="number"&&t>0?t-1:t;for(s in e)o=e[s],t&&(s=Qm(s)),a[s]=We.snake_case(o,c)}else a=e;return a};We.compare=function(e,t){var s,o,a,c,f,d,p,m;if(We.is_object_literal(e)){if(!We.is_object_literal(t)||(f=Object.keys(e).sort(),d=Object.keys(t).sort(),f.length!==d.length))return!1;for(s=o=0,p=f.length;o<p;s=++o)if(c=f[s],c!==d[s]||!We.compare(e[c],t[c]))return!1}else if(Array.isArray(e)){if(!Array.isArray(t)||e.length!==t.length)return!1;for(s=a=0,m=e.length;0<=m?a<m:a>m;s=0<=m?++a:--a)if(!We.compare(e[s],t[s]))return!1}else if(e!==t)return!1;return!0};Qm=function(e){return e.replace(/([A-Z])/g,function(t,s,o){return"_"+s.toLowerCase()})};We.is_object=function(e){return e&&Ii(e)==="object"&&!Array.isArray(e)};We.is_object_literal=function(e){var t;if(t=e,Ii(e)!=="object"||e===null)return!1;if(Object.getPrototypeOf(t)===null)return!0;for(;Object.getPrototypeOf(t=Object.getPrototypeOf(t))!==null;);return Object.getPrototypeOf(e)===t}});var ny=C((qN,yc)=>{var Ln,ty,mc,ry;mc=require("stream");ry=require("util");({clone:ty}=ey());yc.exports=function(){var r,e,t,s,o,a,c,f,d,p,m,b;for(f={},o=a=0,c=arguments.length;a<c;o=++a)if(r=arguments[o],b=typeof r,r===null?b="null":b==="object"&&Array.isArray(r)&&(b="array"),b==="array")d=r;else if(b==="object")f=ty(r);else if(b==="function")s&&o===arguments.length-1?e=r:s=r;else if(b!=="null")throw new Error(`Invalid Arguments: got ${JSON.stringify(r)} at position ${o}`);return m=new Ln(f,s),t=!1,d&&setImmediate(function(){var w,q,I;for(w=0,q=d.length;w<q&&(I=d[w],!t);w++)m.write(I);return m.end()}),(e||f.consume)&&(p=[],m.on("readable",function(){var w,q;for(q=[];w=m.read();)e?q.push(p.push(w)):q.push(void 0);return q}),m.on("error",function(w){if(t=!0,e)return e(w)}),m.on("end",function(){if(e&&!t)return e(null,p)})),m};Ln=function(r={},e){var t,s;return this.options=r,this.handler=e,(t=this.options).consume==null&&(t.consume=!1),this.options.objectMode=!0,(s=this.options).parallel==null&&(s.parallel=100),mc.Transform.call(this,this.options),this.state={running:0,started:0,finished:0},this};ry.inherits(Ln,mc.Transform);yc.exports.Transformer=Ln;Ln.prototype._transform=function(r,e,t){var s,o,a;this.state.started++,this.state.running++,this.state.running<this.options.parallel&&(t(),t=null);try{if(a=this.handler.length,this.options.params!=null&&a--,a===1)this.__done(null,[this.handler.call(this,r,this.options.params)],t);else if(a===2)s=(c,...f)=>this.__done(c,f,t),this.handler.call(this,r,s,this.options.params);else throw Error("Invalid handler arguments");return!1}catch(c){return o=c,this.__done(o)}};Ln.prototype._flush=function(r){return this._ending=function(){if(this.state.running===0)return this._ending=void 0,r()},this._ending()};Ln.prototype.__done=function(r,e,t){var s,o,a;if(this.state.running--,r)return this.emit("error",r);for(this.state.finished++,o=0,a=e.length;o<a;o++)s=e[o],typeof s=="number"&&(s=`${s}`),s!=null&&s!==""&&this.push(s);if(t&&t(),this._ending)return this._ending()}});var uy=C((PN,oy)=>{var{Transform:F8}=require("stream"),S8=Buffer.from([239,187,191]),Dc=class extends F8{constructor(e={}){super(qt({writableObjectMode:!0},e));let t={},s;for(let o in e)t[I8(o)]=e[o];if(s=this.normalize(t))throw s;switch(t.record_delimiter){case"auto":t.record_delimiter=null;break;case"unix":t.record_delimiter=`
|