@hey-api/openapi-ts 0.78.3 → 0.79.1
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/README.md +34 -13
- package/bin/index.cjs +8 -0
- package/dist/chunk-H4ADXQ4D.js +39 -0
- package/dist/chunk-H4ADXQ4D.js.map +1 -0
- package/dist/clients/axios/types.ts +2 -1
- package/dist/clients/core/params.ts +10 -0
- package/dist/clients/core/types.ts +14 -0
- package/dist/index.cjs +65 -65
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +13 -13
- package/dist/index.d.ts +13 -13
- package/dist/index.js +49 -49
- package/dist/index.js.map +1 -1
- package/dist/internal.cjs +11 -11
- package/dist/internal.cjs.map +1 -1
- package/dist/internal.d.cts +1 -1
- package/dist/internal.d.ts +1 -1
- package/dist/internal.js +1 -1
- package/dist/{types.d-CaH9PF-K.d.cts → types.d-BRYhp7DX.d.cts} +1783 -268
- package/dist/{types.d-CaH9PF-K.d.ts → types.d-BRYhp7DX.d.ts} +1783 -268
- package/package.json +2 -1
- package/dist/chunk-YJGQGZQU.js +0 -39
- package/dist/chunk-YJGQGZQU.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {createRequire}from'module';import {b,a,c,q,
|
|
2
|
-
var Se=b((Xr,Ee)=>{Ee.exports=we;we.sync=qt;var ke=a("fs");function bt(e,n){var o=n.pathExt!==void 0?n.pathExt:process.env.PATHEXT;if(!o||(o=o.split(";"),o.indexOf("")!==-1))return true;for(var r=0;r<o.length;r++){var t=o[r].toLowerCase();if(t&&e.substr(-t.length).toLowerCase()===t)return true}return false}function Oe(e,n,o){return !e.isSymbolicLink()&&!e.isFile()?false:bt(n,o)}function we(e,n,o){ke.stat(e,function(r,t){o(r,r?false:Oe(t,e,n));});}function qt(e,n){return Oe(ke.statSync(e),e,n)}});var je=b((Qr,Be)=>{Be.exports=De;De.sync=At;var He=a("fs");function De(e,n,o){He.stat(e,function(r,t){o(r,r?false:Ie(t,n));});}function At(e,n){return Ie(He.statSync(e),n)}function Ie(e,n){return e.isFile()&&Tt(e,n)}function Tt(e,n){var o=e.mode,r=e.uid,t=e.gid,s=n.uid!==void 0?n.uid:process.getuid&&process.getuid(),a=n.gid!==void 0?n.gid:process.getgid&&process.getgid(),i=parseInt("100",8),u=parseInt("010",8),l=parseInt("001",8),c=i|u,f=o&l||o&u&&t===a||o&i&&r===s||o&c&&s===0;return f}});var Ne=b((Yr,$e)=>{a("fs");var _;process.platform==="win32"||global.TESTING_WINDOWS?_=Se():_=je();$e.exports=V;V.sync=kt;function V(e,n,o){if(typeof n=="function"&&(o=n,n={}),!o){if(typeof Promise!="function")throw new TypeError("callback not provided");return new Promise(function(r,t){V(e,n||{},function(s,a){s?t(s):r(a);});})}_(e,n||{},function(r,t){r&&(r.code==="EACCES"||n&&n.ignoreErrors)&&(r=null,t=false),o(r,t);});}function kt(e,n){try{return _.sync(e,n||{})}catch(o){if(n&&n.ignoreErrors||o.code==="EACCES")return false;throw o}}});var Ve=b((Zr,Ue)=>{var w=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",Fe=a("path"),Ot=w?";":":",_e=Ne(),Le=e=>Object.assign(new Error(`not found: ${e}`),{code:"ENOENT"}),Me=(e,n)=>{let o=n.colon||Ot,r=e.match(/\//)||w&&e.match(/\\/)?[""]:[...w?[process.cwd()]:[],...(n.path||process.env.PATH||"").split(o)],t=w?n.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",s=w?t.split(o):[""];return w&&e.indexOf(".")!==-1&&s[0]!==""&&s.unshift(""),{pathEnv:r,pathExt:s,pathExtExe:t}},We=(e,n,o)=>{typeof n=="function"&&(o=n,n={}),n||(n={});let{pathEnv:r,pathExt:t,pathExtExe:s}=Me(e,n),a=[],i=l=>new Promise((c,f)=>{if(l===r.length)return n.all&&a.length?c(a):f(Le(e));let d=r[l],A=/^".*"$/.test(d)?d.slice(1,-1):d,q=Fe.join(A,e),k=!A&&/^\.[\\\/]/.test(e)?e.slice(0,2)+q:q;c(u(k,l,0));}),u=(l,c,f)=>new Promise((d,A)=>{if(f===t.length)return d(i(c+1));let q=t[f];_e(l+q,{pathExt:s},(k,H)=>{if(!k&&H)if(n.all)a.push(l+q);else return d(l+q);return d(u(l,c,f+1))});});return o?i(0).then(l=>o(null,l),o):i(0)},wt=(e,n)=>{n=n||{};let{pathEnv:o,pathExt:r,pathExtExe:t}=Me(e,n),s=[];for(let a=0;a<o.length;a++){let i=o[a],u=/^".*"$/.test(i)?i.slice(1,-1):i,l=Fe.join(u,e),c=!u&&/^\.[\\\/]/.test(e)?e.slice(0,2)+l:l;for(let f=0;f<r.length;f++){let d=c+r[f];try{if(_e.sync(d,{pathExt:t}))if(n.all)s.push(d);else return d}catch{}}}if(n.all&&s.length)return s;if(n.nothrow)return null;throw Le(e)};Ue.exports=We;We.sync=wt;});var ze=b((eo,G)=>{var Ge=(e={})=>{let n=e.env||process.env;return (e.platform||process.platform)!=="win32"?"PATH":Object.keys(n).reverse().find(r=>r.toUpperCase()==="PATH")||"Path"};G.exports=Ge;G.exports.default=Ge;});var Je=b((no,Qe)=>{var Ke=a("path"),Et=Ve(),St=ze();function Xe(e,n){let o=e.options.env||process.env,r=process.cwd(),t=e.options.cwd!=null,s=t&&process.chdir!==void 0&&!process.chdir.disabled;if(s)try{process.chdir(e.options.cwd);}catch{}let a;try{a=Et.sync(e.command,{path:o[St({env:o})],pathExt:n?Ke.delimiter:void 0});}catch{}finally{s&&process.chdir(r);}return a&&(a=Ke.resolve(t?e.options.cwd:"",a)),a}function Ht(e){return Xe(e)||Xe(e,true)}Qe.exports=Ht;});var Ye=b((to,K)=>{var z=/([()\][%!^"`<>&|;, *?])/g;function Dt(e){return e=e.replace(z,"^$1"),e}function It(e,n){return e=`${e}`,e=e.replace(/(?=(\\+?)?)\1"/g,'$1$1\\"'),e=e.replace(/(?=(\\+?)?)\1$/,"$1$1"),e=`"${e}"`,e=e.replace(z,"^$1"),n&&(e=e.replace(z,"^$1")),e}K.exports.command=Dt;K.exports.argument=It;});var en=b((ro,Ze)=>{Ze.exports=/^#!(.*)/;});var tn=b((oo,nn)=>{var Bt=en();nn.exports=(e="")=>{let n=e.match(Bt);if(!n)return null;let[o,r]=n[0].replace(/#! ?/,"").split(" "),t=o.split("/").pop();return t==="env"?r:r?`${t} ${r}`:t};});var on=b((so,rn)=>{var X=a("fs"),jt=tn();function $t(e){let o=Buffer.alloc(150),r;try{r=X.openSync(e,"r"),X.readSync(r,o,0,150,0),X.closeSync(r);}catch{}return jt(o.toString())}rn.exports=$t;});var un=b((io,ln)=>{var Nt=a("path"),sn=Je(),an=Ye(),Ft=on(),_t=process.platform==="win32",Lt=/\.(?:com|exe)$/i,Mt=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function Wt(e){e.file=sn(e);let n=e.file&&Ft(e.file);return n?(e.args.unshift(e.file),e.command=n,sn(e)):e.file}function Ut(e){if(!_t)return e;let n=Wt(e),o=!Lt.test(n);if(e.options.forceShell||o){let r=Mt.test(n);e.command=Nt.normalize(e.command),e.command=an.command(e.command),e.args=e.args.map(s=>an.argument(s,r));let t=[e.command].concat(e.args).join(" ");e.args=["/d","/s","/c",`"${t}"`],e.command=process.env.comspec||"cmd.exe",e.options.windowsVerbatimArguments=true;}return e}function Vt(e,n,o){n&&!Array.isArray(n)&&(o=n,n=null),n=n?n.slice(0):[],o=Object.assign({},o);let r={command:e,args:n,options:o,file:void 0,original:{command:e,args:n}};return o.shell?r:Ut(r)}ln.exports=Vt;});var fn=b((ao,cn)=>{var Q=process.platform==="win32";function J(e,n){return Object.assign(new Error(`${n} ${e.command} ENOENT`),{code:"ENOENT",errno:"ENOENT",syscall:`${n} ${e.command}`,path:e.command,spawnargs:e.args})}function Gt(e,n){if(!Q)return;let o=e.emit;e.emit=function(r,t){if(r==="exit"){let s=pn(t,n);if(s)return o.call(e,"error",s)}return o.apply(e,arguments)};}function pn(e,n){return Q&&e===1&&!n.file?J(n.original,"spawn"):null}function zt(e,n){return Q&&e===1&&!n.file?J(n.original,"spawnSync"):null}cn.exports={hookChildProcess:Gt,verifyENOENT:pn,verifyENOENTSync:zt,notFoundError:J};});var gn=b((lo,E)=>{var mn=a("child_process"),Y=un(),Z=fn();function dn(e,n,o){let r=Y(e,n,o),t=mn.spawn(r.command,r.args,r.options);return Z.hookChildProcess(t,r),t}function Kt(e,n,o){let r=Y(e,n,o),t=mn.spawnSync(r.command,r.args,r.options);return t.error=t.error||Z.verifyENOENTSync(t.status,r),t}E.exports=dn;E.exports.spawn=dn;E.exports.sync=Kt;E.exports._parse=Y;E.exports._enoent=Z;});var F=e=>{switch(e){case "legacy/angular":return "AngularHttpRequest";case "legacy/axios":return "AxiosHttpRequest";case "legacy/fetch":return "FetchHttpRequest";case "legacy/node":return "NodeHttpRequest";case "legacy/xhr":return "XHRHttpRequest";default:return ""}};var xe=async(e$1,n$1,o,r)=>{let t=e(),s=d(t),a=r.client({$config:t,...o,httpRequest:F(s.name),models:D(o.models),services:D(o.services)});g(t)&&(n(n$1),v$1.writeFileSync(R.resolve(n$1,`${g(t)}.ts`),a));};var Ce=async(e$1,n,o)=>{let r=e();if(r.exportCore){let t=d(r),s={httpRequest:F(t.name),server:r.base!==void 0?r.base:n.server,version:n.version};if(v$1.rmSync(R.resolve(e$1),{force:true,recursive:true}),v$1.mkdirSync(R.resolve(e$1),{recursive:true}),await v$1.writeFileSync(R.resolve(e$1,"OpenAPI.ts"),o.core.settings({$config:r,...s})),await v$1.writeFileSync(R.resolve(e$1,"ApiError.ts"),o.core.apiError({$config:r,...s})),await v$1.writeFileSync(R.resolve(e$1,"ApiRequestOptions.ts"),o.core.apiRequestOptions({$config:r,...s})),await v$1.writeFileSync(R.resolve(e$1,"ApiResult.ts"),o.core.apiResult({$config:r,...s})),t.name!=="legacy/angular"&&await v$1.writeFileSync(R.resolve(e$1,"CancelablePromise.ts"),o.core.cancelablePromise({$config:r,...s})),await v$1.writeFileSync(R.resolve(e$1,"request.ts"),o.core.request({$config:r,...s})),g(r)&&(await v$1.writeFileSync(R.resolve(e$1,"BaseHttpRequest.ts"),o.core.baseHttpRequest({$config:r,...s})),await v$1.writeFileSync(R.resolve(e$1,`${s.httpRequest}.ts`),o.core.httpRequest({$config:r,...s}))),r.request){let a=R.resolve(process.cwd(),r.request);if(!await v$1.existsSync(a))throw new Error(`Custom request file "${a}" does not exists`);await v$1.copyFileSync(a,R.resolve(e$1,"request.ts"));}}};var be=({files:e$1})=>{let n=e();e$1.index=new s({dir:n.output.path,id:"index",name:"index.ts"}),g(n)&&e$1.index.add(m$1.exportNamedDeclaration({exports:g(n),module:`./${g(n)}`})),n.exportCore&&(e$1.index.add(m$1.exportNamedDeclaration({exports:"ApiError",module:"./core/ApiError"})),n.plugins["@hey-api/sdk"]?.config.response==="response"&&e$1.index.add(m$1.exportNamedDeclaration({exports:{asType:true,name:"ApiResult"},module:"./core/ApiResult"})),g(n)&&e$1.index.add(m$1.exportNamedDeclaration({exports:"BaseHttpRequest",module:"./core/BaseHttpRequest"})),d(n).name!=="legacy/angular"&&e$1.index.add(m$1.exportNamedDeclaration({exports:["CancelablePromise","CancelError"],module:"./core/CancelablePromise"})),e$1.index.add(m$1.exportNamedDeclaration({exports:["OpenAPI",{asType:true,name:"OpenAPIConfig"}],module:"./core/OpenAPI"}))),Object.keys(e$1).sort().forEach(o=>{let r=e$1[o];o==="index"||r.isEmpty()||r.exportFromIndex&&e$1.index.add(m$1.exportAllDeclaration({module:`./${r.nameWithoutExtension()}`}));});};var qe=async({client:e$1,openApi:n,templates:o$1})=>{let r=e(),t$1=n;if(e$1){if(r.plugins["@hey-api/sdk"]?.config.include&&r.plugins["@hey-api/sdk"].config.asClass){let l=new RegExp(r.plugins["@hey-api/sdk"].config.include);e$1.services=e$1.services.filter(c=>l.test(c.name));}if(r.plugins["@hey-api/typescript"]?.config.include){let l=new RegExp(r.plugins["@hey-api/typescript"].config.include);e$1.models=e$1.models.filter(c=>l.test(c.name));}}let s$1=R.resolve(r.output.path);r.output.clean&&o(s$1);let a=u(t(r.output.tsConfigPath)),i=d(r);!f(r)&&"bundle"in i.config&&i.config.bundle&&p$1({outputPath:s$1,plugin:i,tsConfig:a}),await xe(t$1,s$1,e$1,o$1),await Ce(R.resolve(r.output.path,"core"),e$1,o$1);let u$1={};for(let l of r.pluginOrder){let c=r.plugins[l],f=(c.output??"").split("/"),d=R.resolve(r.output.path,...f.slice(0,f.length-1));u$1[c.name]=new s({dir:d,id:`legacy-unused-${c.name}`,name:`${f[f.length-1]}.ts`}),c.handlerLegacy?.({client:e$1,files:u$1,openApi:t$1,plugin:c});}be({files:u$1}),Object.entries(u$1).forEach(([l,c])=>{r.dryRun||(l==="index"?c.write(`
|
|
1
|
+
import {createRequire}from'module';import {b,a,c,y,I,q,i,k,l,j,h,J,o,p as p$1,G,F as F$1,n,B,g,e,d,m as m$1,w,v,z,C as C$1,D,E,f,A}from'./chunk-H4ADXQ4D.js';export{t as clientDefaultConfig,u as clientDefaultMeta,x as clientPluginHandler,v as compiler,r as defaultPaginationKeywords,H as defaultPlugins,s as definePluginConfig}from'./chunk-H4ADXQ4D.js';import C from'ansi-colors';import pr from'color-support';import R from'node:path';import v$1 from'node:fs';import qt from'typescript';import p from'handlebars';createRequire(import.meta.url);
|
|
2
|
+
var De=b((Zr,He)=>{He.exports=Se;Se.sync=Tt;var Oe=a("fs");function At(e,n){var o=n.pathExt!==void 0?n.pathExt:process.env.PATHEXT;if(!o||(o=o.split(";"),o.indexOf("")!==-1))return true;for(var r=0;r<o.length;r++){var t=o[r].toLowerCase();if(t&&e.substr(-t.length).toLowerCase()===t)return true}return false}function Ee(e,n,o){return !e.isSymbolicLink()&&!e.isFile()?false:At(n,o)}function Se(e,n,o){Oe.stat(e,function(r,t){o(r,r?false:Ee(t,e,n));});}function Tt(e,n){return Ee(Oe.statSync(e),e,n)}});var Ne=b((eo,$e)=>{$e.exports=Be;Be.sync=kt;var Ie=a("fs");function Be(e,n,o){Ie.stat(e,function(r,t){o(r,r?false:je(t,n));});}function kt(e,n){return je(Ie.statSync(e),n)}function je(e,n){return e.isFile()&&wt(e,n)}function wt(e,n){var o=e.mode,r=e.uid,t=e.gid,s=n.uid!==void 0?n.uid:process.getuid&&process.getuid(),a=n.gid!==void 0?n.gid:process.getgid&&process.getgid(),i=parseInt("100",8),u=parseInt("010",8),l=parseInt("001",8),c=i|u,f=o&l||o&u&&t===a||o&i&&r===s||o&c&&s===0;return f}});var _e=b((to,Fe)=>{a("fs");var _;process.platform==="win32"||global.TESTING_WINDOWS?_=De():_=Ne();Fe.exports=G;G.sync=Ot;function G(e,n,o){if(typeof n=="function"&&(o=n,n={}),!o){if(typeof Promise!="function")throw new TypeError("callback not provided");return new Promise(function(r,t){G(e,n||{},function(s,a){s?t(s):r(a);});})}_(e,n||{},function(r,t){r&&(r.code==="EACCES"||n&&n.ignoreErrors)&&(r=null,t=false),o(r,t);});}function Ot(e,n){try{return _.sync(e,n||{})}catch(o){if(n&&n.ignoreErrors||o.code==="EACCES")return false;throw o}}});var ze=b((ro,Ge)=>{var O=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",Le=a("path"),Et=O?";":":",Me=_e(),We=e=>Object.assign(new Error(`not found: ${e}`),{code:"ENOENT"}),Ue=(e,n)=>{let o=n.colon||Et,r=e.match(/\//)||O&&e.match(/\\/)?[""]:[...O?[process.cwd()]:[],...(n.path||process.env.PATH||"").split(o)],t=O?n.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",s=O?t.split(o):[""];return O&&e.indexOf(".")!==-1&&s[0]!==""&&s.unshift(""),{pathEnv:r,pathExt:s,pathExtExe:t}},Ve=(e,n,o)=>{typeof n=="function"&&(o=n,n={}),n||(n={});let{pathEnv:r,pathExt:t,pathExtExe:s}=Ue(e,n),a=[],i=l=>new Promise((c,f)=>{if(l===r.length)return n.all&&a.length?c(a):f(We(e));let d=r[l],A=/^".*"$/.test(d)?d.slice(1,-1):d,q=Le.join(A,e),k=!A&&/^\.[\\\/]/.test(e)?e.slice(0,2)+q:q;c(u(k,l,0));}),u=(l,c,f)=>new Promise((d,A)=>{if(f===t.length)return d(i(c+1));let q=t[f];Me(l+q,{pathExt:s},(k,H)=>{if(!k&&H)if(n.all)a.push(l+q);else return d(l+q);return d(u(l,c,f+1))});});return o?i(0).then(l=>o(null,l),o):i(0)},St=(e,n)=>{n=n||{};let{pathEnv:o,pathExt:r,pathExtExe:t}=Ue(e,n),s=[];for(let a=0;a<o.length;a++){let i=o[a],u=/^".*"$/.test(i)?i.slice(1,-1):i,l=Le.join(u,e),c=!u&&/^\.[\\\/]/.test(e)?e.slice(0,2)+l:l;for(let f=0;f<r.length;f++){let d=c+r[f];try{if(Me.sync(d,{pathExt:t}))if(n.all)s.push(d);else return d}catch{}}}if(n.all&&s.length)return s;if(n.nothrow)return null;throw We(e)};Ge.exports=Ve;Ve.sync=St;});var Xe=b((oo,z)=>{var Ke=(e={})=>{let n=e.env||process.env;return (e.platform||process.platform)!=="win32"?"PATH":Object.keys(n).reverse().find(r=>r.toUpperCase()==="PATH")||"Path"};z.exports=Ke;z.exports.default=Ke;});var Ze=b((so,Ye)=>{var Qe=a("path"),Ht=ze(),Dt=Xe();function Je(e,n){let o=e.options.env||process.env,r=process.cwd(),t=e.options.cwd!=null,s=t&&process.chdir!==void 0&&!process.chdir.disabled;if(s)try{process.chdir(e.options.cwd);}catch{}let a;try{a=Ht.sync(e.command,{path:o[Dt({env:o})],pathExt:n?Qe.delimiter:void 0});}catch{}finally{s&&process.chdir(r);}return a&&(a=Qe.resolve(t?e.options.cwd:"",a)),a}function It(e){return Je(e)||Je(e,true)}Ye.exports=It;});var en=b((io,X)=>{var K=/([()\][%!^"`<>&|;, *?])/g;function Bt(e){return e=e.replace(K,"^$1"),e}function jt(e,n){return e=`${e}`,e=e.replace(/(?=(\\+?)?)\1"/g,'$1$1\\"'),e=e.replace(/(?=(\\+?)?)\1$/,"$1$1"),e=`"${e}"`,e=e.replace(K,"^$1"),n&&(e=e.replace(K,"^$1")),e}X.exports.command=Bt;X.exports.argument=jt;});var tn=b((ao,nn)=>{nn.exports=/^#!(.*)/;});var on=b((lo,rn)=>{var $t=tn();rn.exports=(e="")=>{let n=e.match($t);if(!n)return null;let[o,r]=n[0].replace(/#! ?/,"").split(" "),t=o.split("/").pop();return t==="env"?r:r?`${t} ${r}`:t};});var an=b((uo,sn)=>{var Q=a("fs"),Nt=on();function Ft(e){let o=Buffer.alloc(150),r;try{r=Q.openSync(e,"r"),Q.readSync(r,o,0,150,0),Q.closeSync(r);}catch{}return Nt(o.toString())}sn.exports=Ft;});var cn=b((po,pn)=>{var _t=a("path"),ln=Ze(),un=en(),Lt=an(),Mt=process.platform==="win32",Wt=/\.(?:com|exe)$/i,Ut=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function Vt(e){e.file=ln(e);let n=e.file&&Lt(e.file);return n?(e.args.unshift(e.file),e.command=n,ln(e)):e.file}function Gt(e){if(!Mt)return e;let n=Vt(e),o=!Wt.test(n);if(e.options.forceShell||o){let r=Ut.test(n);e.command=_t.normalize(e.command),e.command=un.command(e.command),e.args=e.args.map(s=>un.argument(s,r));let t=[e.command].concat(e.args).join(" ");e.args=["/d","/s","/c",`"${t}"`],e.command=process.env.comspec||"cmd.exe",e.options.windowsVerbatimArguments=true;}return e}function zt(e,n,o){n&&!Array.isArray(n)&&(o=n,n=null),n=n?n.slice(0):[],o=Object.assign({},o);let r={command:e,args:n,options:o,file:void 0,original:{command:e,args:n}};return o.shell?r:Gt(r)}pn.exports=zt;});var dn=b((co,mn)=>{var J=process.platform==="win32";function Y(e,n){return Object.assign(new Error(`${n} ${e.command} ENOENT`),{code:"ENOENT",errno:"ENOENT",syscall:`${n} ${e.command}`,path:e.command,spawnargs:e.args})}function Kt(e,n){if(!J)return;let o=e.emit;e.emit=function(r,t){if(r==="exit"){let s=fn(t,n);if(s)return o.call(e,"error",s)}return o.apply(e,arguments)};}function fn(e,n){return J&&e===1&&!n.file?Y(n.original,"spawn"):null}function Xt(e,n){return J&&e===1&&!n.file?Y(n.original,"spawnSync"):null}mn.exports={hookChildProcess:Kt,verifyENOENT:fn,verifyENOENTSync:Xt,notFoundError:Y};});var yn=b((fo,E)=>{var gn=a("child_process"),Z=cn(),ee=dn();function hn(e,n,o){let r=Z(e,n,o),t=gn.spawn(r.command,r.args,r.options);return ee.hookChildProcess(t,r),t}function Qt(e,n,o){let r=Z(e,n,o),t=gn.spawnSync(r.command,r.args,r.options);return t.error=t.error||ee.verifyENOENTSync(t.status,r),t}E.exports=hn;E.exports.spawn=hn;E.exports.sync=Qt;E.exports._parse=Z;E.exports._enoent=ee;});var Ce=()=>{if(typeof Bun<"u"){let[e]=Bun.version.split(".").map(Number);if(e<1)throw new h(`Unsupported Bun version ${Bun.version}. Please use Bun 1.0.0 or newer.`)}else if(typeof process<"u"&&process.versions?.node){let[e]=process.versions.node.split(".").map(Number);if(e<18)throw new h(`Unsupported Node version ${process.versions.node}. Please use Node 18 or newer.`)}};var F=e=>{switch(e){case "legacy/angular":return "AngularHttpRequest";case "legacy/axios":return "AxiosHttpRequest";case "legacy/fetch":return "FetchHttpRequest";case "legacy/node":return "NodeHttpRequest";case "legacy/xhr":return "XHRHttpRequest";default:return ""}};var be=async(e,n$1,o,r)=>{let t=n(),s=m$1(t),a=r.client({$config:t,...o,httpRequest:F(s.name),models:E(o.models),services:E(o.services)});p$1(t)&&(f(n$1),v$1.writeFileSync(R.resolve(n$1,`${p$1(t)}.ts`),a));};var qe=async(e,n$1,o)=>{let r=n();if(r.exportCore){let t=m$1(r),s={httpRequest:F(t.name),server:r.base!==void 0?r.base:n$1.server,version:n$1.version};if(v$1.rmSync(R.resolve(e),{force:true,recursive:true}),v$1.mkdirSync(R.resolve(e),{recursive:true}),await v$1.writeFileSync(R.resolve(e,"OpenAPI.ts"),o.core.settings({$config:r,...s})),await v$1.writeFileSync(R.resolve(e,"ApiError.ts"),o.core.apiError({$config:r,...s})),await v$1.writeFileSync(R.resolve(e,"ApiRequestOptions.ts"),o.core.apiRequestOptions({$config:r,...s})),await v$1.writeFileSync(R.resolve(e,"ApiResult.ts"),o.core.apiResult({$config:r,...s})),t.name!=="legacy/angular"&&await v$1.writeFileSync(R.resolve(e,"CancelablePromise.ts"),o.core.cancelablePromise({$config:r,...s})),await v$1.writeFileSync(R.resolve(e,"request.ts"),o.core.request({$config:r,...s})),p$1(r)&&(await v$1.writeFileSync(R.resolve(e,"BaseHttpRequest.ts"),o.core.baseHttpRequest({$config:r,...s})),await v$1.writeFileSync(R.resolve(e,`${s.httpRequest}.ts`),o.core.httpRequest({$config:r,...s}))),r.request){let a=R.resolve(process.cwd(),r.request);if(!await v$1.existsSync(a))throw new Error(`Custom request file "${a}" does not exists`);await v$1.copyFileSync(a,R.resolve(e,"request.ts"));}}};var Ae=({files:e})=>{let n$1=n();e.index=new z({dir:n$1.output.path,id:"index",name:"index.ts"}),p$1(n$1)&&e.index.add(v.exportNamedDeclaration({exports:p$1(n$1),module:`./${p$1(n$1)}`})),n$1.exportCore&&(e.index.add(v.exportNamedDeclaration({exports:"ApiError",module:"./core/ApiError"})),n$1.plugins["@hey-api/sdk"]?.config.response==="response"&&e.index.add(v.exportNamedDeclaration({exports:{asType:true,name:"ApiResult"},module:"./core/ApiResult"})),p$1(n$1)&&e.index.add(v.exportNamedDeclaration({exports:"BaseHttpRequest",module:"./core/BaseHttpRequest"})),m$1(n$1).name!=="legacy/angular"&&e.index.add(v.exportNamedDeclaration({exports:["CancelablePromise","CancelError"],module:"./core/CancelablePromise"})),e.index.add(v.exportNamedDeclaration({exports:["OpenAPI",{asType:true,name:"OpenAPIConfig"}],module:"./core/OpenAPI"}))),Object.keys(e).sort().forEach(o=>{let r=e[o];o==="index"||r.isEmpty()||r.exportFromIndex&&e.index.add(v.exportAllDeclaration({module:`./${r.nameWithoutExtension()}`}));});};var Te=async({client:e$1,openApi:n$1,templates:o$1})=>{let r=n(),t=n$1;if(e$1){if(r.plugins["@hey-api/sdk"]?.config.include&&r.plugins["@hey-api/sdk"].config.asClass){let l=new RegExp(r.plugins["@hey-api/sdk"].config.include);e$1.services=e$1.services.filter(c=>l.test(c.name));}if(r.plugins["@hey-api/typescript"]?.config.include){let l=new RegExp(r.plugins["@hey-api/typescript"].config.include);e$1.models=e$1.models.filter(c=>l.test(c.name));}}let s=R.resolve(r.output.path);r.output.clean&&g(s);let a=e(d(r.output.tsConfigPath)),i=m$1(r);!o(r)&&"bundle"in i.config&&i.config.bundle&&w({outputPath:s,plugin:i,tsConfig:a}),await be(t,s,e$1,o$1),await qe(R.resolve(r.output.path,"core"),e$1,o$1);let u={};for(let l of r.pluginOrder){let c=r.plugins[l],f=(c.output??"").split("/"),d=R.resolve(r.output.path,...f.slice(0,f.length-1));u[c.name]=new z({dir:d,id:`legacy-unused-${c.name}`,name:`${f[f.length-1]}.ts`}),c.handlerLegacy?.({client:e$1,files:u,openApi:t,plugin:c});}Ae({files:u}),Object.entries(u).forEach(([l,c])=>{r.dryRun||(l==="index"?c.write(`
|
|
3
3
|
`,a):c.write(`
|
|
4
4
|
|
|
5
|
-
`,a));});};var
|
|
5
|
+
`,a));});};var ke=async({context:e$1})=>{let n=R.resolve(e$1.config.output.path);e$1.config.output.clean&&g(n);let o=e(d(e$1.config.output.tsConfigPath)),r=o?.options.moduleResolution===qt.ModuleResolutionKind.NodeNext,t=m$1(e$1.config);"bundle"in t.config&&t.config.bundle&&w({outputPath:n,plugin:t,tsConfig:o});for(let s of e$1.registerPlugins())await s.run();if(!e$1.config.dryRun){let s=e$1.createFile({id:"_index",path:"index"});for(let a of Object.values(e$1.files))if(a.nameWithoutExtension()!==s.nameWithoutExtension()){if(!a.isEmpty()&&a.exportFromIndex&&e$1.config.output.indexFile){let u=s.relativePathToFile({context:e$1,id:a.id});r&&(u.startsWith("./")||u.startsWith("../"))&&(u==="./client"?u="./client/index.js":u=`${u}.js`),s.add(v.exportAllDeclaration({module:u}));}a.write(`
|
|
6
6
|
|
|
7
|
-
`,o
|
|
8
|
-
`,o
|
|
7
|
+
`,o);}e$1.config.output.indexFile&&s.write(`
|
|
8
|
+
`,o);}};var we=({patchOptions:e,spec:n})=>{if(!e)return;let o=n;if("swagger"in o){if(e.version&&o.swagger&&(o.swagger=typeof e.version=="string"?e.version:e.version(o.swagger)),e.meta&&o.info&&e.meta(o.info),e.schemas&&o.definitions)for(let r in e.schemas){let t=o.definitions[r];if(!t||typeof t!="object")continue;let s=e.schemas[r];s(t);}if(e.operations&&o.paths)for(let r in e.operations){let[t,s]=r.split(" ");if(!t||!s)continue;let a=o.paths[s];if(!a)continue;let i=a[t.toLocaleLowerCase()]||a[t.toLocaleUpperCase()];if(!i||typeof i!="object")continue;let u=e.operations[r];u(i);}return}if(e.version&&o.openapi&&(o.openapi=typeof e.version=="string"?e.version:e.version(o.openapi)),e.meta&&o.info&&e.meta(o.info),o.components){if(e.schemas&&o.components.schemas)for(let r in e.schemas){let t=o.components.schemas[r];if(!t||typeof t!="object")continue;let s=e.schemas[r];s(t);}if(e.parameters&&o.components.parameters)for(let r in e.parameters){let t=o.components.parameters[r];if(!t||typeof t!="object")continue;let s=e.parameters[r];s(t);}if(e.requestBodies&&o.components.requestBodies)for(let r in e.requestBodies){let t=o.components.requestBodies[r];if(!t||typeof t!="object")continue;let s=e.requestBodies[r];s(t);}if(e.responses&&o.components.responses)for(let r in e.responses){let t=o.components.responses[r];if(!t||typeof t!="object")continue;let s=e.responses[r];s(t);}}if(e.operations&&o.paths)for(let r in e.operations){let[t,s]=r.split(" ");if(!t||!s)continue;let a=o.paths[s];if(!a)continue;let i=a[t.toLocaleLowerCase()]||a[t.toLocaleUpperCase()];if(!i||typeof i!="object")continue;let u=e.operations[r];u(i);}};var ne=c(yn(),1),Jt={biome:{args:e=>["format","--write",e],command:"biome",name:"Biome (Format)"},prettier:{args:e=>["--ignore-unknown",e,"--write","--ignore-path","./.prettierignore"],command:"prettier",name:"Prettier"}},Yt={biome:{args:e=>["lint","--apply",e],command:"biome",name:"Biome (Lint)"},eslint:{args:e=>[e,"--fix"],command:"eslint",name:"ESLint"},oxlint:{args:e=>["--fix",e],command:"oxlint",name:"oxlint"}},vn=({config:e})=>{if(e.output.format){let n=Jt[e.output.format];console.log(`\u2728 Running ${n.name}`),(0, ne.sync)(n.command,n.args(e.output.path));}if(e.output.lint){let n=Yt[e.output.lint];console.log(`\u2728 Running ${n.name}`),(0, ne.sync)(n.command,n.args(e.output.path));}};var Rn=e=>`${e}-end`,te=e=>`${e}-length`,Pn=e=>`${e}-start`,m={clear:()=>{performance.clearMarks(),performance.clearMeasures();},end:e=>performance.mark(Rn(e)),getEntriesByName:e=>performance.getEntriesByName(te(e)),measure:e=>performance.measure(te(e),Pn(e),Rn(e)),start:e=>performance.mark(Pn(e))},L=class{totalMeasure;constructor({totalMark:n}){this.totalMeasure=m.measure(n);}report({marks:n}){let o=Math.ceil(this.totalMeasure.duration*100)/100,r=this.totalMeasure.name;console.warn(`${r.substring(0,r.length-te("").length)}: ${o.toFixed(2)}ms`),n.forEach(t=>{try{let s=m.measure(t),a=Math.ceil(s.duration*100)/100,i=Math.ceil(s.duration/this.totalMeasure.duration*100*100)/100;console.warn(`${t}: ${a.toFixed(2)}ms (${i.toFixed(2)}%)`);}catch{}});}};function xn(e,n){return {...e,config:n,models:e.models.map(o=>Zt(o)),services:er(e.operations).map(nr),types:{}}}var Zt=e=>({...e,$refs:e.$refs.filter((n,o,r)=>C$1(n,o,r)),enum:e.enum.filter((n,o,r)=>r.findIndex(t=>t.value===n.value)===o),enums:e.enums.filter((n,o,r)=>r.findIndex(t=>t.name===n.name)===o),imports:e.imports.filter((n,o,r)=>C$1(n,o,r)&&n!==e.name).sort(D)}),er=e=>{let n$1=n(),o=new Map;return e.forEach(r=>{(r.tags?.length&&(n$1.plugins["@hey-api/sdk"]?.config.asClass||p$1(n$1))?r.tags.filter(C$1):["Default"]).forEach(s=>{let a={...r,service:or(s)},i=o.get(a.service)||rr(a);i.$refs=[...i.$refs,...a.$refs],i.imports=[...i.imports,...a.imports],i.operations=[...i.operations,a],o.set(a.service,i);});}),Array.from(o.values())},nr=e=>{let n={...e};return n.operations=tr(n),n.operations.forEach(o=>{n.imports.push(...o.imports);}),n.imports=n.imports.filter(C$1).sort(D),n},tr=e=>{let n=new Map;return e.operations.map(o=>{let r={...o};r.imports.push(...r.parameters.flatMap(i=>i.imports));let t=r.responses.filter(i=>i.responseTypes.includes("success"));r.imports.push(...t.flatMap(i=>i.imports));let s=r.name,a=n.get(s)||0;return a>0&&(r.name=`${s}${a}`),n.set(s,a+1),r})},rr=e=>({$refs:[],imports:[],name:e.service,operations:[]}),or=e=>y({case:"PascalCase",value:A(e)});var re=e=>e.startsWith("https://get.heyapi.dev"),ir=e=>{let n={path:""};if(e.path&&(typeof e.path!="string"||!re(e.path)))return n.path=e.path,n;let[o,r]=e.path.split("?"),s=(r||"").split("&").map(P=>P.split("=")),a=o||"";a.endsWith("/")&&(a=a.slice(0,a.length-1));let[,i]=a.split("://"),[u,l,c]=(i||"").split("/");n.organization=l||e.organization,n.project=c||e.project;let f=[],d="api_key";n.api_key=s.find(([P])=>P===d)?.[1]||e.api_key||process.env.HEY_API_TOKEN,n.api_key&&f.push(`${d}=${n.api_key}`);let A="branch";n.branch=s.find(([P])=>P===A)?.[1]||e.branch,n.branch&&f.push(`${A}=${n.branch}`);let q="commit_sha";n.commit_sha=s.find(([P])=>P===q)?.[1]||e.commit_sha,n.commit_sha&&f.push(`${q}=${n.commit_sha}`);let k="tags";n.tags=s.find(([P])=>P===k)?.[1]?.split(",")||e.tags,n.tags?.length&&f.push(`${k}=${n.tags.join(",")}`);let H="version";if(n.version=s.find(([P])=>P===H)?.[1]||e.version,n.version&&f.push(`${H}=${n.version}`),!n.organization)throw new Error("missing organization - from which Hey API Platform organization do you want to generate your output?");if(!n.project)throw new Error("missing project - from which Hey API Platform project do you want to generate your output?");let se=f.join("&"),ie=u||"get.heyapi.dev",ae=ie.startsWith("localhost"),le=[ae?"http":"https",ie].join("://"),ue=ae?[le,"v1","get",n.organization,n.project].join("/"):[le,n.organization,n.project].join("/");return n.path=se?`${ue}?${se}`:ue,n},Cn=e=>{let n=C.cyan("Generating from");if(typeof e.path=="string"){let o=re(e.path)?`${e.organization??""}/${e.project??""}`:e.path;console.log(`\u23F3 ${n} ${o}`),re(e.path)&&(e.branch&&console.log(`${C.gray("branch:")} ${C.green(e.branch)}`),e.commit_sha&&console.log(`${C.gray("commit:")} ${C.green(e.commit_sha)}`),e.tags?.length&&console.log(`${C.gray("tags:")} ${C.green(e.tags.join(", "))}`),e.version&&console.log(`${C.gray("version:")} ${C.green(e.version)}`));}else console.log(`\u23F3 ${n} raw OpenAPI specification`);},oe=async({config:e,templates:n,watch:o$1})=>{let r=ir(e.input),{timeout:t}=e.input.watch,s=o$1||{headers:new Headers};e.logs.level!=="silent"&&!o$1&&Cn(r),m.start("spec");let{data:a,error:i,response:u}=await J({fetchOptions:e.input.fetch,inputPath:r.path,timeout:t,watch:s});if(m.end("spec"),i&&!o$1)throw new Error(`Request failed with status ${u.status}: ${u.statusText}`);let l,c;if(a){if(e.logs.level!=="silent"&&o$1&&(console.clear(),Cn(r)),m.start("input.patch"),we({patchOptions:e.parser.patch,spec:a}),m.end("input.patch"),m.start("parser"),e.experimentalParser&&!o(e)&&!p$1(e)&&(c=G({config:e,spec:a})),!c){let f=F$1({openApi:a});l=xn(f,e);}if(m.end("parser"),m.start("generator"),c?await ke({context:c}):l&&await Te({client:l,openApi:a,templates:n}),m.end("generator"),m.start("postprocess"),!e.dryRun&&(vn({config:e}),e.logs.level!=="silent")){let f=process.env.INIT_CWD?`./${R.relative(process.env.INIT_CWD,e.output.path)}`:e.output.path;console.log(`${C.green("\u{1F680} Done!")} Your output is in ${C.cyanBright(f)}`);}m.end("postprocess");}return e.input.watch.enabled&&typeof r.path=="string"&&setTimeout(()=>{oe({config:e,templates:n,watch:s});},e.input.watch.interval),c||l};var bn={1:function(e,n,o,r,t){return `import { NgModule} from '@angular/core';
|
|
9
9
|
import { HttpClientModule } from '@angular/common/http';
|
|
10
10
|
|
|
11
11
|
import { AngularHttpRequest } from './core/AngularHttpRequest';
|
|
@@ -76,7 +76,7 @@ export class `+((s=i(a(l(l(t,"root"),"$config"),"name",{start:{line:57,column:16
|
|
|
76
76
|
`},14:function(e,n,o,r,t){var s,a=n??(e.nullContext||{}),i=e.lookupProperty||function(u,l){if(Object.prototype.hasOwnProperty.call(u,l))return u[l]};return " this."+((s=i(o,"camelCase").call(a,i(n,"name"),{name:"camelCase",hash:{},data:t,loc:{start:{line:83,column:7},end:{line:83,column:27}}}))!=null?s:"")+" = new "+((s=i(o,"transformServiceName").call(a,i(n,"name"),{name:"transformServiceName",hash:{},data:t,loc:{start:{line:83,column:34},end:{line:83,column:65}}}))!=null?s:"")+`(this.request);
|
|
77
77
|
`},compiler:[8,">= 4.3.0"],main:function(e,n,o,r,t){var s,a=n??(e.nullContext||{}),i=e.lookupProperty||function(u,l){if(Object.prototype.hasOwnProperty.call(u,l))return u[l]};return ((s=i(o,"equals").call(a,i(i(i(i(t,"root"),"$config"),"client"),"name"),"legacy/angular",{name:"equals",hash:{},fn:e.program(1,t,0),inverse:e.program(3,t,0),data:t,loc:{start:{line:1,column:0},end:{line:15,column:11}}}))!=null?s:"")+`
|
|
78
78
|
`+((s=i(o,"if").call(a,i(n,"services"),{name:"if",hash:{},fn:e.program(5,t,0),inverse:e.noop,data:t,loc:{start:{line:17,column:0},end:{line:21,column:7}}}))!=null?s:"")+`
|
|
79
|
-
`+((s=i(o,"equals").call(a,i(i(i(i(t,"root"),"$config"),"client"),"name"),"legacy/angular",{name:"equals",hash:{},fn:e.program(8,t,0),inverse:e.program(11,t,0),data:t,loc:{start:{line:23,column:0},end:{line:87,column:11}}}))!=null?s:"")},useData:true};var
|
|
79
|
+
`+((s=i(o,"equals").call(a,i(i(i(i(t,"root"),"$config"),"client"),"name"),"legacy/angular",{name:"equals",hash:{},fn:e.program(8,t,0),inverse:e.program(11,t,0),data:t,loc:{start:{line:23,column:0},end:{line:87,column:11}}}))!=null?s:"")},useData:true};var qn={compiler:[8,">= 4.3.0"],main:function(e,n,o,r,t){return `export const getHeaders = <T>(config: OpenAPIConfig, options: ApiRequestOptions<T>): Observable<HttpHeaders> => {
|
|
80
80
|
return forkJoin({
|
|
81
81
|
// @ts-ignore
|
|
82
82
|
token: resolve(options, config.TOKEN),
|
|
@@ -123,7 +123,7 @@ export class `+((s=i(a(l(l(t,"root"),"$config"),"name",{start:{line:57,column:16
|
|
|
123
123
|
return new HttpHeaders(headers);
|
|
124
124
|
}),
|
|
125
125
|
);
|
|
126
|
-
};`},useData:true};var
|
|
126
|
+
};`},useData:true};var An={compiler:[8,">= 4.3.0"],main:function(e,n,o,r,t){return `export const getRequestBody = (options: ApiRequestOptions): unknown => {
|
|
127
127
|
if (options.body) {
|
|
128
128
|
if (options.mediaType?.includes('application/json') || options.mediaType?.includes('+json')) {
|
|
129
129
|
return JSON.stringify(options.body);
|
|
@@ -134,12 +134,12 @@ export class `+((s=i(a(l(l(t,"root"),"$config"),"name",{start:{line:57,column:16
|
|
|
134
134
|
}
|
|
135
135
|
}
|
|
136
136
|
return undefined;
|
|
137
|
-
};`},useData:true};var
|
|
137
|
+
};`},useData:true};var Tn={compiler:[8,">= 4.3.0"],main:function(e,n,o,r,t){return `export const getResponseBody = <T>(response: HttpResponse<T>): T | undefined => {
|
|
138
138
|
if (response.status !== 204 && response.body !== null) {
|
|
139
139
|
return response.body;
|
|
140
140
|
}
|
|
141
141
|
return undefined;
|
|
142
|
-
};`},useData:true};var
|
|
142
|
+
};`},useData:true};var kn={compiler:[8,">= 4.3.0"],main:function(e,n,o,r,t){return `export const getResponseHeader = <T>(response: HttpResponse<T>, responseHeader?: string): string | undefined => {
|
|
143
143
|
if (responseHeader) {
|
|
144
144
|
const value = response.headers.get(responseHeader);
|
|
145
145
|
if (isString(value)) {
|
|
@@ -147,7 +147,7 @@ export class `+((s=i(a(l(l(t,"root"),"$config"),"name",{start:{line:57,column:16
|
|
|
147
147
|
}
|
|
148
148
|
}
|
|
149
149
|
return undefined;
|
|
150
|
-
};`},useData:true};var
|
|
150
|
+
};`},useData:true};var wn={compiler:[8,">= 4.3.0"],main:function(e,n,o,r,t){var s,a=e.lookupProperty||function(i,u){if(Object.prototype.hasOwnProperty.call(i,u))return i[u]};return `import { HttpClient, HttpHeaders } from '@angular/common/http';
|
|
151
151
|
import type { HttpResponse, HttpErrorResponse } from '@angular/common/http';
|
|
152
152
|
import { forkJoin, of, throwError } from 'rxjs';
|
|
153
153
|
import { catchError, map, switchMap } from 'rxjs/operators';
|
|
@@ -245,7 +245,7 @@ export const request = <T>(config: OpenAPIConfig, http: HttpClient, options: Api
|
|
|
245
245
|
return throwError(() => error);
|
|
246
246
|
}),
|
|
247
247
|
);
|
|
248
|
-
};`},usePartial:true,useData:true};var
|
|
248
|
+
};`},usePartial:true,useData:true};var On={compiler:[8,">= 4.3.0"],main:function(e,n,o,r,t){return `export const sendRequest = <T>(
|
|
249
249
|
config: OpenAPIConfig,
|
|
250
250
|
options: ApiRequestOptions<T>,
|
|
251
251
|
http: HttpClient,
|
|
@@ -260,7 +260,7 @@ export const request = <T>(config: OpenAPIConfig, http: HttpClient, options: Api
|
|
|
260
260
|
withCredentials: config.WITH_CREDENTIALS,
|
|
261
261
|
observe: 'response',
|
|
262
262
|
});
|
|
263
|
-
};`},useData:true};var
|
|
263
|
+
};`},useData:true};var En={compiler:[8,">= 4.3.0"],main:function(e,n,o,r,t){return `import type { ApiRequestOptions } from './ApiRequestOptions';
|
|
264
264
|
import type { ApiResult } from './ApiResult';
|
|
265
265
|
|
|
266
266
|
export class ApiError extends Error {
|
|
@@ -280,7 +280,7 @@ export class ApiError extends Error {
|
|
|
280
280
|
this.body = response.body;
|
|
281
281
|
this.request = request;
|
|
282
282
|
}
|
|
283
|
-
}`},useData:true};var
|
|
283
|
+
}`},useData:true};var Sn={compiler:[8,">= 4.3.0"],main:function(e,n,o,r,t){return `export type ApiRequestOptions<T = unknown> = {
|
|
284
284
|
readonly body?: any;
|
|
285
285
|
readonly cookies?: Record<string, unknown>;
|
|
286
286
|
readonly errors?: Record<number | string, string>;
|
|
@@ -300,13 +300,13 @@ export class ApiError extends Error {
|
|
|
300
300
|
readonly responseHeader?: string;
|
|
301
301
|
readonly responseTransformer?: (data: unknown) => Promise<T>;
|
|
302
302
|
readonly url: string;
|
|
303
|
-
};`},useData:true};var
|
|
303
|
+
};`},useData:true};var Hn={compiler:[8,">= 4.3.0"],main:function(e,n,o,r,t){return `export type ApiResult<TData = any> = {
|
|
304
304
|
readonly body: TData;
|
|
305
305
|
readonly ok: boolean;
|
|
306
306
|
readonly status: number;
|
|
307
307
|
readonly statusText: string;
|
|
308
308
|
readonly url: string;
|
|
309
|
-
};`},useData:true};var
|
|
309
|
+
};`},useData:true};var Dn={compiler:[8,">= 4.3.0"],main:function(e,n,o,r,t){return `export const getHeaders = async <T>(config: OpenAPIConfig, options: ApiRequestOptions<T>): Promise<Record<string, string>> => {
|
|
310
310
|
const [token, username, password, additionalHeaders] = await Promise.all([
|
|
311
311
|
// @ts-ignore
|
|
312
312
|
resolve(options, config.TOKEN),
|
|
@@ -355,17 +355,17 @@ export class ApiError extends Error {
|
|
|
355
355
|
}
|
|
356
356
|
|
|
357
357
|
return headers;
|
|
358
|
-
};`},useData:true};var
|
|
358
|
+
};`},useData:true};var In={compiler:[8,">= 4.3.0"],main:function(e,n,o,r,t){return `export const getRequestBody = (options: ApiRequestOptions): unknown => {
|
|
359
359
|
if (options.body) {
|
|
360
360
|
return options.body;
|
|
361
361
|
}
|
|
362
362
|
return undefined;
|
|
363
|
-
};`},useData:true};var
|
|
363
|
+
};`},useData:true};var Bn={compiler:[8,">= 4.3.0"],main:function(e,n,o,r,t){return `export const getResponseBody = (response: AxiosResponse<unknown>): unknown => {
|
|
364
364
|
if (response.status !== 204) {
|
|
365
365
|
return response.data;
|
|
366
366
|
}
|
|
367
367
|
return undefined;
|
|
368
|
-
};`},useData:true};var
|
|
368
|
+
};`},useData:true};var jn={compiler:[8,">= 4.3.0"],main:function(e,n,o,r,t){return `export const getResponseHeader = (response: AxiosResponse<unknown>, responseHeader?: string): string | undefined => {
|
|
369
369
|
if (responseHeader) {
|
|
370
370
|
const content = response.headers[responseHeader];
|
|
371
371
|
if (isString(content)) {
|
|
@@ -373,7 +373,7 @@ export class ApiError extends Error {
|
|
|
373
373
|
}
|
|
374
374
|
}
|
|
375
375
|
return undefined;
|
|
376
|
-
};`},useData:true};var
|
|
376
|
+
};`},useData:true};var $n={1:function(e,n,o,r,t){return "ApiResult<T>"},3:function(e,n,o,r,t){return "T"},5:function(e,n,o,r,t){return "result.body"},7:function(e,n,o,r,t){return "result"},compiler:[8,">= 4.3.0"],main:function(e,n,o,r,t){var s,a=n??(e.nullContext||{}),i=e.lookupProperty||function(u,l){if(Object.prototype.hasOwnProperty.call(u,l))return u[l]};return `import axios from 'axios';
|
|
377
377
|
import type { AxiosError, AxiosRequestConfig, AxiosResponse, AxiosInstance } from 'axios';
|
|
378
378
|
|
|
379
379
|
import { ApiError } from './ApiError';
|
|
@@ -462,7 +462,7 @@ export const request = <T>(config: OpenAPIConfig, options: ApiRequestOptions<T>,
|
|
|
462
462
|
reject(error);
|
|
463
463
|
}
|
|
464
464
|
});
|
|
465
|
-
};`},usePartial:true,useData:true};var
|
|
465
|
+
};`},usePartial:true,useData:true};var Nn={compiler:[8,">= 4.3.0"],main:function(e,n,o,r,t){return `export const sendRequest = async <T>(
|
|
466
466
|
config: OpenAPIConfig,
|
|
467
467
|
options: ApiRequestOptions<T>,
|
|
468
468
|
url: string,
|
|
@@ -498,7 +498,7 @@ export const request = <T>(config: OpenAPIConfig, options: ApiRequestOptions<T>,
|
|
|
498
498
|
}
|
|
499
499
|
throw error;
|
|
500
500
|
}
|
|
501
|
-
};`},useData:true};var
|
|
501
|
+
};`},useData:true};var Fn={1:function(e,n,o,r,t){return `import type { HttpClient } from '@angular/common/http';
|
|
502
502
|
import type { Observable } from 'rxjs';
|
|
503
503
|
|
|
504
504
|
import type { ApiRequestOptions } from './ApiRequestOptions';
|
|
@@ -517,7 +517,7 @@ import type { OpenAPIConfig } from './OpenAPI';
|
|
|
517
517
|
export abstract class BaseHttpRequest {
|
|
518
518
|
|
|
519
519
|
`+((s=i(o,"equals").call(a,i(i(i(i(t,"root"),"$config"),"client"),"name"),"legacy/angular",{name:"equals",hash:{},fn:e.program(5,t,0),inverse:e.program(7,t,0),data:t,loc:{start:{line:15,column:1},end:{line:22,column:12}}}))!=null?s:"")+`
|
|
520
|
-
`+((s=i(o,"equals").call(a,i(i(i(i(t,"root"),"$config"),"client"),"name"),"legacy/angular",{name:"equals",hash:{},fn:e.program(9,t,0),inverse:e.program(11,t,0),data:t,loc:{start:{line:24,column:1},end:{line:28,column:12}}}))!=null?s:"")+"}"},useData:true};var
|
|
520
|
+
`+((s=i(o,"equals").call(a,i(i(i(i(t,"root"),"$config"),"client"),"name"),"legacy/angular",{name:"equals",hash:{},fn:e.program(9,t,0),inverse:e.program(11,t,0),data:t,loc:{start:{line:24,column:1},end:{line:28,column:12}}}))!=null?s:"")+"}"},useData:true};var _n={compiler:[8,">= 4.3.0"],main:function(e,n,o,r,t){return `export class CancelError extends Error {
|
|
521
521
|
constructor(message: string) {
|
|
522
522
|
super(message);
|
|
523
523
|
this.name = 'CancelError';
|
|
@@ -599,7 +599,7 @@ export class CancelablePromise<T> implements Promise<T> {
|
|
|
599
599
|
});
|
|
600
600
|
}
|
|
601
601
|
|
|
602
|
-
get [Symbol.toStringTag]() {
|
|
602
|
+
get [Symbol.toStringTag](): string {
|
|
603
603
|
return "Cancellable Promise";
|
|
604
604
|
}
|
|
605
605
|
|
|
@@ -642,7 +642,7 @@ export class CancelablePromise<T> implements Promise<T> {
|
|
|
642
642
|
public get isCancelled(): boolean {
|
|
643
643
|
return this._isCancelled;
|
|
644
644
|
}
|
|
645
|
-
}`},useData:true};var
|
|
645
|
+
}`},useData:true};var Ln={compiler:[8,">= 4.3.0"],main:function(e,n,o,r,t){return `export const getHeaders = async <T>(config: OpenAPIConfig, options: ApiRequestOptions<T>): Promise<Headers> => {
|
|
646
646
|
const [token, username, password, additionalHeaders] = await Promise.all([
|
|
647
647
|
// @ts-ignore
|
|
648
648
|
resolve(options, config.TOKEN),
|
|
@@ -687,7 +687,7 @@ export class CancelablePromise<T> implements Promise<T> {
|
|
|
687
687
|
}
|
|
688
688
|
|
|
689
689
|
return new Headers(headers);
|
|
690
|
-
};`},useData:true};var
|
|
690
|
+
};`},useData:true};var Mn={compiler:[8,">= 4.3.0"],main:function(e,n,o,r,t){return `export const getRequestBody = (options: ApiRequestOptions): unknown => {
|
|
691
691
|
if (options.body !== undefined) {
|
|
692
692
|
if (options.mediaType?.includes('application/json') || options.mediaType?.includes('+json')) {
|
|
693
693
|
return JSON.stringify(options.body);
|
|
@@ -698,7 +698,7 @@ export class CancelablePromise<T> implements Promise<T> {
|
|
|
698
698
|
}
|
|
699
699
|
}
|
|
700
700
|
return undefined;
|
|
701
|
-
};`},useData:true};var
|
|
701
|
+
};`},useData:true};var Wn={compiler:[8,">= 4.3.0"],main:function(e,n,o,r,t){return `export const getResponseBody = async (response: Response): Promise<unknown> => {
|
|
702
702
|
if (response.status !== 204) {
|
|
703
703
|
try {
|
|
704
704
|
const contentType = response.headers.get('Content-Type');
|
|
@@ -719,7 +719,7 @@ export class CancelablePromise<T> implements Promise<T> {
|
|
|
719
719
|
}
|
|
720
720
|
}
|
|
721
721
|
return undefined;
|
|
722
|
-
};`},useData:true};var
|
|
722
|
+
};`},useData:true};var Un={compiler:[8,">= 4.3.0"],main:function(e,n,o,r,t){return `export const getResponseHeader = (response: Response, responseHeader?: string): string | undefined => {
|
|
723
723
|
if (responseHeader) {
|
|
724
724
|
const content = response.headers.get(responseHeader);
|
|
725
725
|
if (isString(content)) {
|
|
@@ -727,7 +727,7 @@ export class CancelablePromise<T> implements Promise<T> {
|
|
|
727
727
|
}
|
|
728
728
|
}
|
|
729
729
|
return undefined;
|
|
730
|
-
};`},useData:true};var
|
|
730
|
+
};`},useData:true};var Vn={1:function(e,n,o,r,t){return `import fetch, { FormData, Headers } from 'node-fetch';
|
|
731
731
|
import type { RequestInit, Response } from 'node-fetch';
|
|
732
732
|
|
|
733
733
|
`},3:function(e,n,o,r,t){return "ApiResult<T>"},5:function(e,n,o,r,t){return "T"},7:function(e,n,o,r,t){return "result.body"},9:function(e,n,o,r,t){return "result"},compiler:[8,">= 4.3.0"],main:function(e,n,o,r,t){var s,a=n??(e.nullContext||{}),i=e.lookupProperty||function(u,l){if(Object.prototype.hasOwnProperty.call(u,l))return u[l]};return ((s=i(o,"equals").call(a,i(i(i(i(t,"root"),"$config"),"client"),"name"),"legacy/node",{name:"equals",hash:{},fn:e.program(1,t,0),inverse:e.noop,data:t,loc:{start:{line:1,column:0},end:{line:5,column:11}}}))!=null?s:"")+`import { ApiError } from './ApiError';
|
|
@@ -813,7 +813,7 @@ export const request = <T>(config: OpenAPIConfig, options: ApiRequestOptions<T>)
|
|
|
813
813
|
reject(error);
|
|
814
814
|
}
|
|
815
815
|
});
|
|
816
|
-
};`},usePartial:true,useData:true};var
|
|
816
|
+
};`},usePartial:true,useData:true};var Gn={1:function(e,n,o,r,t){return ` if (config.WITH_CREDENTIALS) {
|
|
817
817
|
request.credentials = config.CREDENTIALS;
|
|
818
818
|
}
|
|
819
819
|
`},compiler:[8,">= 4.3.0"],main:function(e,n,o,r,t){var s,a=e.lookupProperty||function(i,u){if(Object.prototype.hasOwnProperty.call(i,u))return i[u]};return `export const sendRequest = async (
|
|
@@ -842,14 +842,14 @@ export const request = <T>(config: OpenAPIConfig, options: ApiRequestOptions<T>)
|
|
|
842
842
|
onCancel(() => controller.abort());
|
|
843
843
|
|
|
844
844
|
return await fetch(url, request);
|
|
845
|
-
};`},useData:true};var
|
|
845
|
+
};`},useData:true};var zn={compiler:[8,">= 4.3.0"],main:function(e,n,o,r,t){return `export const base64 = (str: string): string => {
|
|
846
846
|
try {
|
|
847
847
|
return btoa(str);
|
|
848
848
|
} catch (err) {
|
|
849
849
|
// @ts-ignore
|
|
850
850
|
return Buffer.from(str).toString('base64');
|
|
851
851
|
}
|
|
852
|
-
};`},useData:true};var
|
|
852
|
+
};`},useData:true};var Kn={compiler:[8,">= 4.3.0"],main:function(e,n,o,r,t){return `export const catchErrorCodes = (options: ApiRequestOptions, result: ApiResult): void => {
|
|
853
853
|
const errors: Record<number, string> = {
|
|
854
854
|
400: 'Bad Request',
|
|
855
855
|
401: 'Unauthorized',
|
|
@@ -914,7 +914,7 @@ export const request = <T>(config: OpenAPIConfig, options: ApiRequestOptions<T>)
|
|
|
914
914
|
\`Generic Error: status: \${errorStatus}; status text: \${errorStatusText}; body: \${errorBody}\`
|
|
915
915
|
);
|
|
916
916
|
}
|
|
917
|
-
};`},useData:true};var
|
|
917
|
+
};`},useData:true};var Xn={compiler:[8,">= 4.3.0"],main:function(e,n,o,r,t){return `export const getFormData = (options: ApiRequestOptions): FormData | undefined => {
|
|
918
918
|
if (options.formData) {
|
|
919
919
|
const formData = new FormData();
|
|
920
920
|
|
|
@@ -939,7 +939,7 @@ export const request = <T>(config: OpenAPIConfig, options: ApiRequestOptions<T>)
|
|
|
939
939
|
return formData;
|
|
940
940
|
}
|
|
941
941
|
return undefined;
|
|
942
|
-
};`},useData:true};var
|
|
942
|
+
};`},useData:true};var Qn={compiler:[8,">= 4.3.0"],main:function(e,n,o,r,t){return `export const getQueryString = (params: Record<string, unknown>): string => {
|
|
943
943
|
const qs: string[] = [];
|
|
944
944
|
|
|
945
945
|
const append = (key: string, value: unknown) => {
|
|
@@ -965,7 +965,7 @@ export const request = <T>(config: OpenAPIConfig, options: ApiRequestOptions<T>)
|
|
|
965
965
|
Object.entries(params).forEach(([key, value]) => encodePair(key, value));
|
|
966
966
|
|
|
967
967
|
return qs.length ? \`?\${qs.join('&')}\` : '';
|
|
968
|
-
};`},useData:true};var
|
|
968
|
+
};`},useData:true};var Jn={compiler:[8,">= 4.3.0"],main:function(e,n,o,r,t){return `const getUrl = (config: OpenAPIConfig, options: ApiRequestOptions): string => {
|
|
969
969
|
const encoder = config.ENCODE_PATH || encodeURI;
|
|
970
970
|
|
|
971
971
|
const path = options.url
|
|
@@ -979,24 +979,24 @@ export const request = <T>(config: OpenAPIConfig, options: ApiRequestOptions<T>)
|
|
|
979
979
|
|
|
980
980
|
const url = config.BASE + path;
|
|
981
981
|
return options.query ? url + getQueryString(options.query) : url;
|
|
982
|
-
};`},useData:true};var
|
|
982
|
+
};`},useData:true};var Yn={compiler:[8,">= 4.3.0"],main:function(e,n,o,r,t){return `export const isBlob = (value: any): value is Blob => {
|
|
983
983
|
return value instanceof Blob;
|
|
984
|
-
};`},useData:true};var
|
|
984
|
+
};`},useData:true};var Zn={compiler:[8,">= 4.3.0"],main:function(e,n,o,r,t){return `export const isFormData = (value: unknown): value is FormData => {
|
|
985
985
|
return value instanceof FormData;
|
|
986
|
-
};`},useData:true};var
|
|
986
|
+
};`},useData:true};var et={compiler:[8,">= 4.3.0"],main:function(e,n,o,r,t){return `export const isString = (value: unknown): value is string => {
|
|
987
987
|
return typeof value === 'string';
|
|
988
|
-
};`},useData:true};var
|
|
988
|
+
};`},useData:true};var nt={compiler:[8,">= 4.3.0"],main:function(e,n,o,r,t){return `export const isStringWithValue = (value: unknown): value is string => {
|
|
989
989
|
return isString(value) && value !== '';
|
|
990
|
-
};`},useData:true};var
|
|
990
|
+
};`},useData:true};var tt={compiler:[8,">= 4.3.0"],main:function(e,n,o,r,t){return `export const isSuccess = (status: number): boolean => {
|
|
991
991
|
return status >= 200 && status < 300;
|
|
992
|
-
};`},useData:true};var
|
|
992
|
+
};`},useData:true};var rt={compiler:[8,">= 4.3.0"],main:function(e,n,o,r,t){return `type Resolver<T> = (options: ApiRequestOptions<T>) => Promise<T>;
|
|
993
993
|
|
|
994
994
|
export const resolve = async <T>(options: ApiRequestOptions<T>, resolver?: T | Resolver<T>): Promise<T | undefined> => {
|
|
995
995
|
if (typeof resolver === 'function') {
|
|
996
996
|
return (resolver as Resolver<T>)(options);
|
|
997
997
|
}
|
|
998
998
|
return resolver;
|
|
999
|
-
};`},useData:true};var
|
|
999
|
+
};`},useData:true};var ot={1:function(e,n,o,r,t){return `import { Inject, Injectable } from '@angular/core';
|
|
1000
1000
|
import { HttpClient } from '@angular/common/http';
|
|
1001
1001
|
import type { Observable } from 'rxjs';
|
|
1002
1002
|
|
|
@@ -1043,7 +1043,7 @@ import { request as __request } from './request';
|
|
|
1043
1043
|
`+((s=i(o,"equals").call(a,i(i(i(i(t,"root"),"$config"),"client"),"name"),"legacy/angular",{name:"equals",hash:{},fn:e.program(5,t,0),inverse:e.noop,data:t,loc:{start:{line:19,column:0},end:{line:21,column:11}}}))!=null?s:"")+"export class "+((s=e.lambda(e.strict(n,"httpRequest",{start:{line:22,column:15},end:{line:22,column:26}}),n))!=null?s:"")+` extends BaseHttpRequest {
|
|
1044
1044
|
|
|
1045
1045
|
`+((s=i(o,"equals").call(a,i(i(i(i(t,"root"),"$config"),"client"),"name"),"legacy/angular",{name:"equals",hash:{},fn:e.program(7,t,0),inverse:e.program(9,t,0),data:t,loc:{start:{line:24,column:1},end:{line:36,column:12}}}))!=null?s:"")+`
|
|
1046
|
-
`+((s=i(o,"equals").call(a,i(i(i(i(t,"root"),"$config"),"client"),"name"),"legacy/angular",{name:"equals",hash:{},fn:e.program(11,t,0),inverse:e.program(13,t,0),data:t,loc:{start:{line:38,column:1},end:{line:58,column:12}}}))!=null?s:"")+"}"},useData:true};var
|
|
1046
|
+
`+((s=i(o,"equals").call(a,i(i(i(i(t,"root"),"$config"),"client"),"name"),"legacy/angular",{name:"equals",hash:{},fn:e.program(11,t,0),inverse:e.program(13,t,0),data:t,loc:{start:{line:38,column:1},end:{line:58,column:12}}}))!=null?s:"")+"}"},useData:true};var st={1:function(e,n,o,r,t){return `import type { HttpResponse } from '@angular/common/http';
|
|
1047
1047
|
`},3:function(e,n,o,r,t){return `import type { AxiosRequestConfig, AxiosResponse } from 'axios';
|
|
1048
1048
|
`},5:function(e,n,o,r,t){return `import type { RequestInit, Response } from 'node-fetch';
|
|
1049
1049
|
`},7:function(e,n,o,r,t){return ` response: Interceptors<HttpResponse<any>>;
|
|
@@ -1106,7 +1106,7 @@ export const OpenAPI: OpenAPIConfig = {
|
|
|
1106
1106
|
interceptors: {
|
|
1107
1107
|
`+((s=l(o,"notEquals").call(a,l(l(l(l(t,"root"),"$config"),"client"),"name"),"legacy/angular",{name:"notEquals",hash:{},fn:e.program(15,t,0),inverse:e.noop,data:t,loc:{start:{line:79,column:2},end:{line:81,column:16}}}))!=null?s:"")+` response: new Interceptors(),
|
|
1108
1108
|
},
|
|
1109
|
-
};`},useData:true};var
|
|
1109
|
+
};`},useData:true};var it={1:function(e,n,o,r,t){var s,a=e.lookupProperty||function(i,u){if(Object.prototype.hasOwnProperty.call(i,u))return i[u]};return (s=e.invokePartial(a(r,"angular/request"),n,{name:"angular/request",data:t,helpers:o,partials:r,decorators:e.decorators}))!=null?s:""},3:function(e,n,o,r,t){var s,a=e.lookupProperty||function(i,u){if(Object.prototype.hasOwnProperty.call(i,u))return i[u]};return (s=e.invokePartial(a(r,"axios/request"),n,{name:"axios/request",data:t,helpers:o,partials:r,decorators:e.decorators}))!=null?s:""},5:function(e,n,o,r,t){var s,a=e.lookupProperty||function(i,u){if(Object.prototype.hasOwnProperty.call(i,u))return i[u]};return (s=e.invokePartial(a(r,"fetch/request"),n,{name:"fetch/request",data:t,helpers:o,partials:r,decorators:e.decorators}))!=null?s:""},7:function(e,n,o,r,t){var s,a=e.lookupProperty||function(i,u){if(Object.prototype.hasOwnProperty.call(i,u))return i[u]};return (s=e.invokePartial(a(r,"xhr/request"),n,{name:"xhr/request",data:t,helpers:o,partials:r,decorators:e.decorators}))!=null?s:""},compiler:[8,">= 4.3.0"],main:function(e,n,o,r,t){var s,a=n??(e.nullContext||{}),i=e.lookupProperty||function(u,l){if(Object.prototype.hasOwnProperty.call(u,l))return u[l]};return ((s=i(o,"equals").call(a,i(i(i(i(t,"root"),"$config"),"client"),"name"),"legacy/angular",{name:"equals",hash:{},fn:e.program(1,t,0),inverse:e.noop,data:t,loc:{start:{line:1,column:0},end:{line:1,column:87}}}))!=null?s:"")+((s=i(o,"equals").call(a,i(i(i(i(t,"root"),"$config"),"client"),"name"),"legacy/axios",{name:"equals",hash:{},fn:e.program(3,t,0),inverse:e.noop,data:t,loc:{start:{line:2,column:0},end:{line:2,column:83}}}))!=null?s:"")+((s=i(o,"equals").call(a,i(i(i(i(t,"root"),"$config"),"client"),"name"),"legacy/fetch",{name:"equals",hash:{},fn:e.program(5,t,0),inverse:e.noop,data:t,loc:{start:{line:3,column:0},end:{line:3,column:83}}}))!=null?s:"")+((s=i(o,"equals").call(a,i(i(i(i(t,"root"),"$config"),"client"),"name"),"legacy/node",{name:"equals",hash:{},fn:e.program(5,t,0),inverse:e.noop,data:t,loc:{start:{line:4,column:0},end:{line:4,column:82}}}))!=null?s:"")+((s=i(o,"equals").call(a,i(i(i(i(t,"root"),"$config"),"client"),"name"),"legacy/xhr",{name:"equals",hash:{},fn:e.program(7,t,0),inverse:e.noop,data:t,loc:{start:{line:5,column:0},end:{line:5,column:79}}}))!=null?s:"")},usePartial:true,useData:true};var at={compiler:[8,">= 4.3.0"],main:function(e,n,o,r,t){return `export const getHeaders = async <T>(config: OpenAPIConfig, options: ApiRequestOptions<T>): Promise<Headers> => {
|
|
1110
1110
|
const [token, username, password, additionalHeaders] = await Promise.all([
|
|
1111
1111
|
// @ts-ignore
|
|
1112
1112
|
resolve(options, config.TOKEN),
|
|
@@ -1151,7 +1151,7 @@ export const OpenAPI: OpenAPIConfig = {
|
|
|
1151
1151
|
}
|
|
1152
1152
|
|
|
1153
1153
|
return new Headers(headers);
|
|
1154
|
-
};`},useData:true};var
|
|
1154
|
+
};`},useData:true};var lt={compiler:[8,">= 4.3.0"],main:function(e,n,o,r,t){return `export const getRequestBody = (options: ApiRequestOptions): unknown => {
|
|
1155
1155
|
if (options.body !== undefined) {
|
|
1156
1156
|
if (options.mediaType?.includes('application/json') || options.mediaType?.includes('+json')) {
|
|
1157
1157
|
return JSON.stringify(options.body);
|
|
@@ -1162,7 +1162,7 @@ export const OpenAPI: OpenAPIConfig = {
|
|
|
1162
1162
|
}
|
|
1163
1163
|
}
|
|
1164
1164
|
return undefined;
|
|
1165
|
-
};`},useData:true};var
|
|
1165
|
+
};`},useData:true};var ut={compiler:[8,">= 4.3.0"],main:function(e,n,o,r,t){return `export const getResponseBody = (xhr: XMLHttpRequest): unknown => {
|
|
1166
1166
|
if (xhr.status !== 204) {
|
|
1167
1167
|
try {
|
|
1168
1168
|
const contentType = xhr.getResponseHeader('Content-Type');
|
|
@@ -1178,7 +1178,7 @@ export const OpenAPI: OpenAPIConfig = {
|
|
|
1178
1178
|
}
|
|
1179
1179
|
}
|
|
1180
1180
|
return undefined;
|
|
1181
|
-
};`},useData:true};var
|
|
1181
|
+
};`},useData:true};var pt={compiler:[8,">= 4.3.0"],main:function(e,n,o,r,t){return `export const getResponseHeader = (xhr: XMLHttpRequest, responseHeader?: string): string | undefined => {
|
|
1182
1182
|
if (responseHeader) {
|
|
1183
1183
|
const content = xhr.getResponseHeader(responseHeader);
|
|
1184
1184
|
if (isString(content)) {
|
|
@@ -1186,7 +1186,7 @@ export const OpenAPI: OpenAPIConfig = {
|
|
|
1186
1186
|
}
|
|
1187
1187
|
}
|
|
1188
1188
|
return undefined;
|
|
1189
|
-
};`},useData:true};var
|
|
1189
|
+
};`},useData:true};var ct={1:function(e,n,o,r,t){return "ApiResult<T>"},3:function(e,n,o,r,t){return "T"},5:function(e,n,o,r,t){return "result.body"},7:function(e,n,o,r,t){return "result"},compiler:[8,">= 4.3.0"],main:function(e,n,o,r,t){var s,a=n??(e.nullContext||{}),i=e.lookupProperty||function(u,l){if(Object.prototype.hasOwnProperty.call(u,l))return u[l]};return `import { ApiError } from './ApiError';
|
|
1190
1190
|
import type { ApiRequestOptions } from './ApiRequestOptions';
|
|
1191
1191
|
import type { ApiResult } from './ApiResult';
|
|
1192
1192
|
import { CancelablePromise } from './CancelablePromise';
|
|
@@ -1271,7 +1271,7 @@ export const request = <T>(config: OpenAPIConfig, options: ApiRequestOptions<T>)
|
|
|
1271
1271
|
reject(error);
|
|
1272
1272
|
}
|
|
1273
1273
|
});
|
|
1274
|
-
};`},usePartial:true,useData:true};var
|
|
1274
|
+
};`},usePartial:true,useData:true};var ft={compiler:[8,">= 4.3.0"],main:function(e,n,o,r,t){return `export const sendRequest = async (
|
|
1275
1275
|
config: OpenAPIConfig,
|
|
1276
1276
|
options: ApiRequestOptions,
|
|
1277
1277
|
url: string,
|
|
@@ -1301,5 +1301,5 @@ export const request = <T>(config: OpenAPIConfig, options: ApiRequestOptions<T>)
|
|
|
1301
1301
|
|
|
1302
1302
|
onCancel(() => xhr.abort());
|
|
1303
1303
|
});
|
|
1304
|
-
};`},useData:true};var
|
|
1304
|
+
};`},useData:true};var ar=()=>{p.registerHelper("camelCase",function(e){return y({case:"camelCase",value:e})}),p.registerHelper("equals",function(e,n,o){return e===n?o.fn(this):o.inverse(this)}),p.registerHelper("ifServicesResponse",function(e,n$1){return n().plugins["@hey-api/sdk"]?.config.response===e?n$1.fn(this):n$1.inverse(this)}),p.registerHelper("ifdef",function(...e){let n=e.pop();return e.every(o=>!o)?n.inverse(this):n.fn(this)}),p.registerHelper("notEquals",function(e,n,o){return e!==n?o.fn(this):o.inverse(this)}),p.registerHelper("transformServiceName",function(e){return B({config:n(),name:e})});},mt=()=>{ar();let e={client:p.template(bn),core:{apiError:p.template(En),apiRequestOptions:p.template(Sn),apiResult:p.template(Hn),baseHttpRequest:p.template(Fn),cancelablePromise:p.template(_n),httpRequest:p.template(ot),request:p.template(it),settings:p.template(st)}};return p.registerPartial("functions/base64",p.template(zn)),p.registerPartial("functions/catchErrorCodes",p.template(Kn)),p.registerPartial("functions/getFormData",p.template(Xn)),p.registerPartial("functions/getQueryString",p.template(Qn)),p.registerPartial("functions/getUrl",p.template(Jn)),p.registerPartial("functions/isBlob",p.template(Yn)),p.registerPartial("functions/isFormData",p.template(Zn)),p.registerPartial("functions/isString",p.template(et)),p.registerPartial("functions/isStringWithValue",p.template(nt)),p.registerPartial("functions/isSuccess",p.template(tt)),p.registerPartial("functions/resolve",p.template(rt)),p.registerPartial("fetch/getHeaders",p.template(Ln)),p.registerPartial("fetch/getRequestBody",p.template(Mn)),p.registerPartial("fetch/getResponseBody",p.template(Wn)),p.registerPartial("fetch/getResponseHeader",p.template(Un)),p.registerPartial("fetch/request",p.template(Vn)),p.registerPartial("fetch/sendRequest",p.template(Gn)),p.registerPartial("xhr/getHeaders",p.template(at)),p.registerPartial("xhr/getRequestBody",p.template(lt)),p.registerPartial("xhr/getResponseBody",p.template(ut)),p.registerPartial("xhr/getResponseHeader",p.template(pt)),p.registerPartial("xhr/request",p.template(ct)),p.registerPartial("xhr/sendRequest",p.template(ft)),p.registerPartial("axios/getHeaders",p.template(Dn)),p.registerPartial("axios/getRequestBody",p.template(In)),p.registerPartial("axios/getResponseBody",p.template(Bn)),p.registerPartial("axios/getResponseHeader",p.template(jn)),p.registerPartial("axios/request",p.template($n)),p.registerPartial("axios/sendRequest",p.template(Nn)),p.registerPartial("angular/getHeaders",p.template(qn)),p.registerPartial("angular/getRequestBody",p.template(An)),p.registerPartial("angular/getResponseBody",p.template(Tn)),p.registerPartial("angular/getResponseHeader",p.template(kn)),p.registerPartial("angular/request",p.template(wn)),p.registerPartial("angular/sendRequest",p.template(On)),e};var lr={stringCase:y};C.enabled=pr().hasBasic;var Ei=async e=>{let n=typeof e=="function"?await e():e,o=[];try{Ce(),m.start("createClient"),m.start("config");for(let i of await I(n))if(o.push(i.config),i.errors.length)throw i.errors[0];m.end("config"),m.start("handlebars");let r=mt();m.end("handlebars");let s=(await Promise.all(o.map(i=>oe({config:i,templates:r})))).filter(i=>!!i);m.end("createClient");let a=o[0];return a&&a.logs.level==="debug"&&new L({totalMark:"createClient"}).report({marks:["config","openapi","handlebars","parser","generator","postprocess"]}),s}catch(r){let t=o[0],s=t?t.dryRun:n?.dryRun,a=t?t.interactive:n?.interactive,i$1=t?.logs??q(n),u;throw i$1.level!=="silent"&&i$1.file&&!s&&(u=i(r,i$1.path??"")),i$1.level!=="silent"&&(k({error:r,logPath:u}),await l({error:r,isInteractive:a})&&await j(r)),r}},Si=async e=>typeof e=="function"?await e():e;export{Ei as createClient,Si as defineConfig,lr as utils};//# sourceMappingURL=index.js.map
|
|
1305
1305
|
//# sourceMappingURL=index.js.map
|