sy-api-pro 0.0.7 → 0.0.11

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.
File without changes
File without changes
package/dist/index.umd.js CHANGED
@@ -1,12 +1,13 @@
1
- var M=(b,$,f)=>new Promise((x,w)=>{var c=h=>{try{a(f.next(h))}catch(I){w(I)}},l=h=>{try{a(f.throw(h))}catch(I){w(I)}},a=h=>h.done?x(h.value):Promise.resolve(h.value).then(c,l);a((f=f.apply(b,$)).next())});(function(b,$){typeof exports=="object"&&typeof module!="undefined"?$(require("axios")):typeof define=="function"&&define.amd?define(["axios"],$):$((b=typeof globalThis!="undefined"?globalThis:b||self).axios)})(this,function(b){"use strict";function $(t){return t&&typeof t=="object"&&"default"in t?t:{default:t}}var f=$(b);const x=t=>{var i;const o=(t||"").toLowerCase(),e={int:"number",integer:"number",long:"number",bigdecimal:"number",float:"number",double:"number",localdatetime:"string",date:"string",char:"string",byte:"string",short:"string",character:"string",string:"string",multipartfile:"string",boolean:"boolean",void:"void"},{listType:r}=((i=/^list<(?<listType>.+)>$/.exec(o))==null?void 0:i.groups)||{};return r?`Array<${e[r]||"any"}>`:e[o]||"any"},w=Object.freeze({_getDesc(t){const o=(t.title||"").trim();return o?` // ${o}`:""},getInterface:function({list:t,config:{ignoreParamsDTO:o,deleteParentDTO:e}}){const r=t.filter(i=>!i.id);return t.filter(i=>i.id&&!o.includes(i.type)).map(i=>{if(i.id&&i.json){const s=i.json.split(`
2
- `);return s.forEach((d,n)=>{var y;const u=/(?<space>\s*)"(?<name>[a-zA-Z0-9]+)"\s?:\s*"(?<desc>.*)".*$/;if(u.test(d)){const{space:p,name:g,desc:j}=((y=u.exec(d))==null?void 0:y.groups)||{},S=(g||"").trim(),B=(j||"").trim(),D=r.filter(F=>(F.name||"").trim()+(F.title||"").trim()===S+B);if(D.length>=1){const[{type:F}]=D,L=i.required?"?":"";s[n]=d.replace(u,`${p+g+L}: ${x(F)};${B?` // ${B}`:""}`)}}/\s*"[a-zA-Z0-9]+"\s*:\s*.+$/.test(d)&&(s[n]=s[n].replace(/(\s*)"([a-zA-Z0-9]+)"\s?(:\s*.+)$/,"$1$2$3")),s[n]=s[n].replace(/(.*)\[\s+{$/,"$1Array<{").replace(/(.*)}\s*].*$/,"$1}>")}),e.some(d=>{const n=Object.prototype.toString.call(d);return n==="[object RegExp]"?d.test(i.type):n==="[object String]"?d===i.type:void 0})?s.slice(1,-1).join(`
3
- `):[` ${i.name}${i.required?"":"?"}: {${this._getDesc(i)}`,...s.slice(1,-1).map(d=>` ${d}`)," }"].join(`
4
- `)}return` ${i.name}${i.required?"":"?"}: ${x(i.type)};${this._getDesc(i)}`})}}),c=require("fs"),l=require("path"),a=require("chalk");f.default.interceptors.response.use(t=>{var o,e;return((e=(o=t.data)==null?void 0:o.head)==null?void 0:e.successful)?t:Promise.reject(t)},t=>{throw t});const h=require("path"),{program:I}=require("commander"),P=require("chalk");I.version(require(h.resolve(__dirname,"../package.json")).version).requiredOption("-i, --id <id>","methodId").option("-n, --name <name>","customMethodName").requiredOption("--config <filePath>","configFilePath").requiredOption("--project-id <id>","projectId").parse();const{id:O,name:v,config:R,projectId:A}=I.opts();if(!O||!/^\d+$/.test(O))throw P.red("\u3010error\u3011\u8BF7\u4F20\u5165\u6B63\u786E\u7684 id");const q=require(h.resolve(process.cwd(),R)),m=(q.projects||[]).find(t=>+t.projectId==+A);if(m){if(!m.branchId)throw P.red("\u3010error\u3011\u8BF7\u4F20\u5165\u6B63\u786E\u7684 branchId");if(!q.api)throw P.red("\u3010error\u3011\u8BF7\u4F20\u5165\u6B63\u786E\u7684 api");new class{constructor(t){this.config={api:"",creatBaseFile:!0,customMethodName:"",projectId:void 0,branchId:void 0,methodId:void 0,outputPath:"",outputDirName:"",apiBaseName:"",ignoreParamsDTO:[],deleteParentDTO:[]},this.apiList=[],this.enums=[],Object.assign(this.config,t),this.getApiData()}getApiData(){return M(this,null,function*(){const{api:t,branchId:o,projectId:e,outputDirName:r,outputPath:i,methodId:s,creatBaseFile:d}=this.config;try{const{data:n}=yield f.default.get(`${t}/api/project/getProjectWithBranchById?id=${e}`);this.config.outputPath=l.join(process.cwd(),i,r||n.body.name);const u=n.body.branchList.find(p=>p.id===o);if(!u)throw a.red(`\u3010error\u3011branchId ${o} \u4E0D\u5B58\u5728`);console.log(a.blueBright(`\u3010info\u3011\u6B63\u5728\u4F7F\u7528 branchName: ${u.name} branchId: ${o} methodId: ${s}`));const y=yield f.default.get(`${t}/api/method/getMethodById?id=${s}`);this.apiList=[y.data.body]}catch(n){return console.log(a.red("\u3010error\u3011: \u63A5\u53E3\u83B7\u53D6\u5F02\u5E38")),void console.log(n)}try{yield this.checkApiOutputDir()}catch(n){return console.log(a.red("\u3010error\u3011: \u68C0\u67E5\u8F93\u51FA\u76EE\u5F55\u5F02\u5E38")),void console.log(n)}d&&(yield this.creatBaseFile());try{yield this.createFile()}catch(n){console.log(a.red("\u3010error\u3011: createFile \u5F02\u5E38")),console.log(n)}})}checkApiOutputDir(){const{outputPath:t}=this.config;console.log(a.blueBright(`\u3010info\u3011\u8F93\u51FA\u76EE\u5F55 ${t}`));try{c.statSync(t,{bigint:!0})}catch(o){c.mkdirSync(t,{recursive:!0})}}creatBaseFile(){return M(this,null,function*(){const{outputPath:t}=this.config,o=l.join(__dirname,"../template"),e=c.readdirSync(o),r=c.readdirSync(t);for(const i of e)if(!r.includes(i))try{const s=c.readFileSync(l.join(o,i));c.writeFileSync(l.join(t,i),s)}catch(s){console.log(a.red("\u3010error\u3011: \u57FA\u7840\u6587\u4EF6\u751F\u6210\u5F02\u5E38")),console.log(s)}})}createFile(){return M(this,null,function*(){const{apiBaseName:t,outputPath:o}=this.config;this.apiList.sort((e,r)=>e.path.localeCompare(r.path)),this.apiList.slice(0,1e3).forEach(e=>{var y;const r=e.path.replace(t,"").split("/")[1],i=p=>p.replace(/(-[a-z])|(^[a-z])/g,g=>g.replace("-","").toLocaleUpperCase()),s=i((e.name.startsWith(r)?"":`${r}-`)+e.name);try{c.statSync(l.join(o,r)).isDirectory()}catch(p){c.mkdirSync(l.join(o,r))}const d=(y=e.paramList)==null?void 0:y.length;let n=[];try{n=["/**************************************************/",...d?[`/** ${e.title} RequestModel */`,`export interface ${s}ReqModel {`,...w.getInterface({list:e.paramList||[],config:this.config}),"}",""]:[],`/** ${e.title} ResponseModel */`,`export interface ${s}ResModel {`,...w.getInterface({list:e.returnList||[],config:this.config}),"}",""]}catch(p){throw console.log(a.red(`\u3010error\u3011\u7C7B\u578B\u751F\u6210\u5931\u8D25 projectId: ${this.config.projectId} methodId: ${e.id} path: ${e.path}`)),a.red(p)}try{c.readFileSync(l.join(o,r,"models.ts")).toString().includes(`export interface ${s}ReqModel {`)?console.log(a.yellowBright(`\u3010warning\u3011models.ts \u5DF2\u5B58\u5728 ${s}ReqModel`)):(c.appendFileSync(l.join(o,`./${r}/models.ts`),[""].concat(n).join(`
5
- `)),console.log(a.greenBright(`\u3010success\u3011models.ts \u6210\u529F\u6DFB\u52A0 ${s}ReqModel`)))}catch(p){c.writeFileSync(l.join(o,`./${r}/models.ts`),n.join(`
6
- `)),console.log(a.greenBright(`\u3010success\u3011models.ts \u6210\u529F\u6DFB\u52A0 ${s}ReqModel`))}const u=[` /** ${e.title} */`,` ${e.name}(${d?`params: M.${s}ReqModel`:""}) {`,` return axios.${e.method.toLowerCase()}<ApiResponse<M.${s}ResModel>>(`,` \`\${ApiPrefix}/${e.path}\`,`,d&&` ${["post","put","patch"].includes(e.method.toLowerCase())?"params":"{ params }"},`," );"," },"].filter(Boolean);/^[a-zA-Z]+$/.test((e.method||"").trim())||console.log(a.yellowBright(`\u3010warning\u3011\u63A5\u53E3\u8BF7\u6C42\u7C7B\u578B\u5F02\u5E38\uFF0C\u8BF7\u624B\u52A8\u8865\u5168 method\uFF1A${e.method} path: ${e.path} methodId: ${this.config.methodId} projectId: ${this.config.projectId}`));try{const p=c.readFileSync(l.join(o,r,"api.ts")).toString();if(p.includes(` ${e.name}(`))console.log(a.yellowBright(`\u3010warning\u3011api.ts \u5DF2\u5B58\u5728 ${e.name}`));else{const g=p.split(`
7
- `);g.splice(g.map(j=>j.includes("}")).lastIndexOf(!0),0,u.join(`
8
- `)),c.writeFileSync(l.join(o,`./${r}/api.ts`),g.join(`
9
- `)),console.log(a.blueBright(`\u3010success\u3011api.ts \u6210\u529F\u6DFB\u52A0 ${e.name}`))}}catch(g){c.writeFileSync(l.join(o,`./${r}/api.ts`),["import axios from 'axios';","","import * as M from './models';","import { ApiResponse } from '../responseModel'","import { ApiPrefix } from '../apiPrefix'","","export * from './models';","",`export const ${i(r)}Api = {`,...u,"};"].join(`
10
- `)),console.log(a.blueBright(`\u3010success\u3011api.ts \u6210\u529F\u6DFB\u52A0 ${e.name}`));const p=c.readFileSync(l.join(o,"index.ts")).toString();if(!p.includes(`export * from './${r}/api'`)){const j=p.split(`
11
- `);j.push(`export * from './${r}/api';`);const S=j.slice(1).filter(Boolean);S.sort((B,D)=>B.localeCompare(D)),c.writeFileSync(l.join(o,"index.ts"),[j[0]||"","",...S,""].join(`
12
- `))}}})})}}({api:q.api,creatBaseFile:m.creatBaseFile||!0,methodId:O,customMethodName:v,outputPath:q.outputPath||"./src/apis",projectId:m.projectId,branchId:+m.branchId,outputDirName:m.outputDirName||"",apiBaseName:m.apiBaseName||"",ignoreParamsDTO:m.ignoreParamsDTO||[],deleteParentDTO:m.deleteParentDTO||[]})}else console.log(P.red(`\u3010error\u3011config \u914D\u7F6E\u6587\u4EF6\u4E2D projects \u672A\u5305\u542B\u4F20\u5165\u7684 projectId ${A}`))});
1
+ var R=(w,b,y)=>new Promise((q,D)=>{var a=m=>{try{s(y.next(m))}catch(x){D(x)}},c=m=>{try{s(y.throw(m))}catch(x){D(x)}},s=m=>m.done?q(m.value):Promise.resolve(m.value).then(a,c);s((y=y.apply(w,b)).next())});(function(w,b){typeof exports=="object"&&typeof module!="undefined"?b(require("axios")):typeof define=="function"&&define.amd?define(["axios"],b):b((w=typeof globalThis!="undefined"?globalThis:w||self).axios)})(this,function(w){"use strict";function b(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var y=b(w);const q=e=>{var r;const o=(e||"").toLowerCase(),h={int:"number",integer:"number",long:"number",bigdecimal:"number",float:"number",double:"number",localdatetime:"string",date:"string",char:"string",byte:"string",short:"string",character:"string",string:"string",multipartfile:"string",boolean:"boolean",void:"void"},{listType:i}=((r=/^list<(?<listType>.+)>$/.exec(o))==null?void 0:r.groups)||{};return i?`Array<${h[i]||"any"}>`:h[o]||"any"},D=Object.freeze({_getDesc(e){const o=(e.title||"").trim();return o?` // ${o}`:""},getInterface:function({list:e,config:{ignoreParamsDTO:o,deleteParentDTO:h}}){const i=e.filter(r=>!r.id);return e.filter(r=>r.id&&!o.includes(r.type)).map(r=>{if(r.id&&r.json){const l=r.json.split(`
2
+ `);return l.forEach((t,n)=>{var $;const d=/(?<space>\s*)"(?<name>[a-zA-Z0-9]+)"\s?:\s*"(?<desc>.*)".*$/;if(d.test(t)){const{space:u,name:B,desc:O}=(($=d.exec(t))==null?void 0:$.groups)||{},A=(B||"").trim(),P=(O||"").trim(),S=i.filter(p=>(p.name||"").trim()+(p.title||"").trim()===A+P);if(S.length>=1){const[{type:p}]=S,g=r.required?"?":"";l[n]=t.replace(d,`${u+B+g}: ${q(p)};${P?` // ${P}`:""}`)}}/\s*"[a-zA-Z0-9]+"\s*:\s*.+$/.test(t)&&(l[n]=l[n].replace(/(\s*)"([a-zA-Z0-9]+)"\s?(:\s*.+)$/,"$1$2$3")),l[n]=l[n].replace(/(.*)\[\s+{$/,"$1Array<{").replace(/(.*)}\s*].*$/,"$1}>")}),h.some(t=>{const n=Object.prototype.toString.call(t);return n==="[object RegExp]"?t.test(r.type):n==="[object String]"?t===r.type:void 0})?l.slice(1,-1).join(`
3
+ `):[` ${r.name}${r.required?"":"?"}: {${this._getDesc(r)}`,...l.slice(1,-1).map(t=>` ${t}`)," }"].join(`
4
+ `)}return` ${r.name}${r.required?"":"?"}: ${q(r.type)};${this._getDesc(r)}`})}}),a=require("fs"),c=require("path"),s=require("chalk");y.default.interceptors.response.use(e=>{var o,h;return((h=(o=e.data)==null?void 0:o.head)==null?void 0:h.successful)?e:Promise.reject(e)},e=>{throw e});const m=require("path"),{program:x}=require("commander"),F=require("chalk");x.version(require(m.resolve(__dirname,"../package.json")).version).requiredOption("-i, --id <id>","methodId").option("-n, --name <name>","customMethodName").requiredOption("--config <filePath>","configFilePath").requiredOption("--project-id <id>","projectId").parse();const{id:v,name:z,config:_,projectId:T}=x.opts();if(!v||!/^\d+$/.test(v))throw F.red("\u3010error\u3011\u8BF7\u4F20\u5165\u6B63\u786E\u7684 id");const M=require(m.resolve(process.cwd(),_)),f=(M.projects||[]).find(e=>+e.projectId==+T);if(f){if(!f.branchId)throw F.red("\u3010error\u3011\u8BF7\u4F20\u5165\u6B63\u786E\u7684 branchId");if(!M.api)throw F.red("\u3010error\u3011\u8BF7\u4F20\u5165\u6B63\u786E\u7684 api");new class{constructor(e){this.config={api:"",creatBaseFile:!0,customMethodName:"",projectId:void 0,branchId:void 0,methodId:void 0,outputPath:"",outputDirName:"",apiBaseName:"",ignoreParamsDTO:[],deleteParentDTO:[]},this.apiList=[],this.enums=[],Object.assign(this.config,e),this.getApiData()}getApiData(){return R(this,null,function*(){const{api:e,branchId:o,projectId:h,outputDirName:i,outputPath:r,methodId:l,creatBaseFile:t}=this.config;try{const{data:n}=yield y.default.get(`${e}/api/project/getProjectWithBranchById?id=${h}`);this.config.outputPath=c.join(process.cwd(),r,i||n.body.name);const d=n.body.branchList.find(u=>u.id===o);if(!d)throw s.red(`\u3010error\u3011branchId ${o} \u4E0D\u5B58\u5728`);console.log(s.blueBright(`\u3010info\u3011\u6B63\u5728\u4F7F\u7528 branchName: ${d.name} branchId: ${o} methodId: ${l}`));const $=yield y.default.get(`${e}/api/method/getMethodById?id=${l}`);this.apiList=[$.data.body]}catch(n){return console.log(s.red("\u3010error\u3011: \u63A5\u53E3\u83B7\u53D6\u5F02\u5E38")),void console.log(n)}try{yield this.checkApiOutputDir()}catch(n){return console.log(s.red("\u3010error\u3011: \u68C0\u67E5\u8F93\u51FA\u76EE\u5F55\u5F02\u5E38")),void console.log(n)}t&&(yield this.creatBaseFile());try{yield this.createFile()}catch(n){console.log(s.red("\u3010error\u3011: createFile \u5F02\u5E38")),console.log(n)}})}checkApiOutputDir(){const{outputPath:e}=this.config;console.log(s.blueBright(`\u3010info\u3011\u8F93\u51FA\u76EE\u5F55 ${e}`));try{a.statSync(e,{bigint:!0})}catch(o){a.mkdirSync(e,{recursive:!0})}}creatBaseFile(){return R(this,null,function*(){const{outputPath:e}=this.config,o=c.join(__dirname,"../template"),h=a.readdirSync(o),i=a.readdirSync(e);for(const r of h)if(!i.includes(r))try{const l=a.readFileSync(c.join(o,r));a.writeFileSync(c.join(e,r),l)}catch(l){console.log(s.red("\u3010error\u3011: \u57FA\u7840\u6587\u4EF6\u751F\u6210\u5F02\u5E38")),console.log(l)}})}createFile(){return R(this,null,function*(){const{apiBaseName:e,outputPath:o,customMethodName:h}=this.config;this.apiList.forEach(i=>{var A,P,S;const r=p=>p.replace(/(-[a-z])|(^[a-z])/g,g=>g.replace("-","").toLocaleUpperCase()),l=new RegExp(`(${e})?(/)?(?<apiDirName>[a-zA-Z0-9_]+)/.*$`),{apiDirName:t}=((A=l.exec(i.path))==null?void 0:A.groups)||{},n=h||i.name,d=r(`${t}-`+n);try{a.statSync(c.join(o,t)).isDirectory()}catch(p){a.mkdirSync(c.join(o,t))}let $="";try{$=a.readFileSync(c.join(o,t,"models.ts")).toString()}catch(p){a.writeFileSync(c.join(o,`./${t}/models.ts`),"")}let u=[],B=[];try{u=((P=i.paramList)==null?void 0:P.length)?[$?"":"/**************************************************/",`/** ${i.title} RequestModel */`,`export interface ${d}ReqModel {`,...D.getInterface({list:i.paramList||[],config:this.config}),"}",""]:[],B=((S=i.returnList)==null?void 0:S.length)?[u.length?"":"/**************************************************/",`/** ${i.title} ResponseModel */`,`export interface ${d}ResModel {`,...D.getInterface({list:i.returnList||[],config:this.config}),"}",""]:[]}catch(p){throw console.log(s.red(`\u3010error\u3011\u7C7B\u578B\u751F\u6210\u5931\u8D25 projectId: ${this.config.projectId} methodId: ${i.id} path: ${i.path}`)),s.red(p)}$.includes(`export interface ${d}ReqModel {`)?console.log(s.yellowBright(`\u3010warning\u3011./${t}/models.ts \u5DF2\u5B58\u5728 ${d}ReqModel`)):u.length&&(a.appendFileSync(c.join(o,`./${t}/models.ts`),u.join(`
5
+ `)),console.log(s.greenBright(`\u3010success\u3011./${t}/models.ts \u6210\u529F\u6DFB\u52A0 ${d}ReqModel`))),$.includes(`export interface ${d}ResModel {`)?console.log(s.yellowBright(`\u3010warning\u3011./${t}/models.ts \u5DF2\u5B58\u5728 ${d}ResModel`)):B.length&&(a.appendFileSync(c.join(o,`./${t}/models.ts`),B.join(`
6
+ `)),console.log(s.greenBright(`\u3010success\u3011./${t}/models.ts \u6210\u529F\u6DFB\u52A0 ${d}ResModel`)));const O=[i.title&&` /** ${i.title} */`,` ${n}(${u.length?`params: M.${d}ReqModel`:""}) {`,` return axios.${i.method.toLowerCase()}<ApiResponse<M.${d}ResModel>>(`,` \`\${ApiPrefix}/${i.path}\`,`,u.length&&` ${["post","put","patch"].includes(i.method.toLowerCase())?"params":"{ params }"},`," );"," },"].filter(Boolean);/^[a-zA-Z]+$/.test((i.method||"").trim())||console.log(s.yellowBright(`\u3010warning\u3011\u63A5\u53E3\u8BF7\u6C42\u7C7B\u578B\u5F02\u5E38\uFF0C\u8BF7\u624B\u52A8\u8865\u5168 method\uFF1A${i.method} path: ${i.path} methodId: ${this.config.methodId} projectId: ${this.config.projectId}`));try{const p=a.readFileSync(c.join(o,t,"api.ts")).toString(),g=p.split(`
7
+ `);if(p.includes(` ${n}(`)){const j=g.findIndex(I=>I.includes(` ${n}(`)),N=g.findIndex((I,L)=>L>j&&I===" },");console.log(s.yellowBright([`\u3010warning\u3011./${t}/api.ts \u5DF2\u5B58\u5728api`,...g.slice(j,N+1).map(I=>` ${I}`)].join(`
8
+ `))),console.log(s.yellowBright(`\u3010warning\u3011\u5F53\u524D\u9700\u8981\u751F\u6210\u7684 path \u4E3A ${i.path}, methodName \u4E3A ${n}`))}else g.splice(g.map(j=>j.includes("}")).lastIndexOf(!0),0,O.join(`
9
+ `)),a.writeFileSync(c.join(o,`./${t}/api.ts`),g.join(`
10
+ `)),console.log(s.greenBright(`\u3010success\u3011./${t}/api.ts \u6210\u529F\u6DFB\u52A0 ${n}`))}catch(g){a.writeFileSync(c.join(o,`./${t}/api.ts`),["import axios from 'axios';","","import * as M from './models';","import { ApiResponse } from '../responseModel';","import { ApiPrefix } from '../apiPrefix';","","export * from './models';","",`export const ${r(t)}Api = {`,...O,"};",""].join(`
11
+ `)),console.log(s.greenBright(`\u3010success\u3011./${t}/api.ts \u6210\u529F\u6DFB\u52A0 ${n}`));const p=a.readFileSync(c.join(o,"index.ts")).toString();if(!p.includes(`export * from './${t}/api'`)){const j=p.split(`
12
+ `);j.push(`export * from './${t}/api';`);const N=j.slice(1).filter(Boolean);N.sort((I,L)=>I.localeCompare(L)),a.writeFileSync(c.join(o,"index.ts"),[j[0]||"","",...N,""].join(`
13
+ `))}}})})}}({api:M.api,creatBaseFile:f.creatBaseFile||!0,methodId:v,customMethodName:z,outputPath:M.outputPath||"./src/apis",projectId:f.projectId,branchId:+f.branchId,outputDirName:f.outputDirName||"",apiBaseName:f.apiBaseName||"",ignoreParamsDTO:f.ignoreParamsDTO||[],deleteParentDTO:f.deleteParentDTO||[]})}else console.log(F.red(`\u3010error\u3011config \u914D\u7F6E\u6587\u4EF6\u4E2D projects \u672A\u5305\u542B\u4F20\u5165\u7684 projectId ${T}`))});
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "sy-api-pro",
3
- "version": "0.0.7",
4
- "main": "./bin/index.js",
5
- "types": "./bin/index.d.ts",
3
+ "version": "0.0.11",
4
+ "main": "./bin/index.ts",
5
+ "types": "./bin/model.d.ts",
6
6
  "bin": {
7
- "sy-api-pro": "./bin/index.js"
7
+ "sy-api-pro": "./bin/index.ts"
8
8
  },
9
9
  "license": "MIT",
10
10
  "exports": {
@@ -22,7 +22,7 @@
22
22
  "scripts": {
23
23
  "build": "vite build",
24
24
  "api": "ts-node src/index.ts --config ./src/.api-config.ts --project-id 804",
25
- "apiDist": "ts-node bin/index.js --config ./src/.api-config.ts --project-id 804"
25
+ "testDist": "ts-node bin/index.js --config ./src/.api-config.ts --project-id 804"
26
26
  },
27
27
  "description": "...",
28
28
  "dependencies": {
@@ -2,9 +2,12 @@ import axios, { AxiosResponse } from 'axios';
2
2
 
3
3
  import { ApiPrefix } from './apiPrefix';
4
4
 
5
- axios.interceptors.request.use(config => config, error => Promise.reject(error));
5
+ axios.interceptors.request.use(config => {
6
+ return config;
7
+ }, error => Promise.reject(error));
8
+
6
9
  axios.interceptors.response.use((response: AxiosResponse) => {
7
- if (!response.config.url?.startsWith(ApiPrefix)) return;
10
+ if (!response.config.url?.startsWith(ApiPrefix)) return response;
8
11
  //
9
12
  // if (response.data?.success) {
10
13
  // return response;
@@ -14,5 +17,3 @@ axios.interceptors.response.use((response: AxiosResponse) => {
14
17
  }, (error) => {
15
18
  console.error(error);
16
19
  });
17
-
18
-