@hey-api/openapi-ts 0.85.2 → 0.86.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 +1 -1
- package/dist/chunk-C-EqMg7d.js +1 -0
- package/dist/clients/nuxt/utils.ts +12 -4
- package/dist/getSpec-BlRTbnm6.js +24 -0
- package/dist/getSpec-BlRTbnm6.js.map +1 -0
- package/dist/getSpec-D8vjI0RE.cjs +24 -0
- package/dist/getSpec-D8vjI0RE.cjs.map +1 -0
- package/dist/index.cjs +180 -215
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +822 -1478
- package/dist/index.d.ts +822 -1478
- package/dist/index.js +171 -172
- package/dist/index.js.map +1 -1
- package/dist/internal.cjs +1 -25
- package/dist/internal.d.cts +36 -41
- package/dist/internal.d.ts +36 -41
- package/dist/internal.js +1 -2
- package/dist/{types.d-CGoxqmT9.d.cts → types-C7EJ2jAV.d.cts} +7948 -6907
- package/dist/{types.d-CGoxqmT9.d.ts → types-k8CRHWYM.d.ts} +7949 -6907
- package/package.json +7 -12
- package/dist/chunk-F2CVRHGI.js +0 -47
- package/dist/chunk-F2CVRHGI.js.map +0 -1
- package/dist/internal.cjs.map +0 -1
- package/dist/internal.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
var Be=b((io,$e)=>{$e.exports=De;De.sync=St;var He=a("fs");function kt(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 t=0;t<o.length;t++){var r=o[t].toLowerCase();if(r&&e.substr(-r.length).toLowerCase()===r)return true}return false}function Ie(e,n,o){return !e.isSymbolicLink()&&!e.isFile()?false:kt(n,o)}function De(e,n,o){He.stat(e,function(t,r){o(t,t?false:Ie(r,e,n));});}function St(e,n){return Ie(He.statSync(e),e,n)}});var Le=b((ao,Fe)=>{Fe.exports=_e;_e.sync=Ot;var je=a("fs");function _e(e,n,o){je.stat(e,function(t,r){o(t,t?false:Ne(r,n));});}function Ot(e,n){return Ne(je.statSync(e),n)}function Ne(e,n){return e.isFile()&&Ht(e,n)}function Ht(e,n){var o=e.mode,t=e.uid,r=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),p=parseInt("010",8),l=parseInt("001",8),c=i|p,f=o&l||o&p&&r===a||o&i&&t===s||o&c&&s===0;return f}});var We=b((po,Me)=>{a("fs");var W;process.platform==="win32"||global.TESTING_WINDOWS?W=Be():W=Le();Me.exports=X;X.sync=It;function X(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(t,r){X(e,n||{},function(s,a){s?r(s):t(a);});})}W(e,n||{},function(t,r){t&&(t.code==="EACCES"||n&&n.ignoreErrors)&&(t=null,r=false),o(t,r);});}function It(e,n){try{return W.sync(e,n||{})}catch(o){if(n&&n.ignoreErrors||o.code==="EACCES")return false;throw o}}});var Xe=b((uo,Ke)=>{var I=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",Ue=a("path"),Dt=I?";":":",Ve=We(),Ge=e=>Object.assign(new Error(`not found: ${e}`),{code:"ENOENT"}),ze=(e,n)=>{let o=n.colon||Dt,t=e.match(/\//)||I&&e.match(/\\/)?[""]:[...I?[process.cwd()]:[],...(n.path||process.env.PATH||"").split(o)],r=I?n.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",s=I?r.split(o):[""];return I&&e.indexOf(".")!==-1&&s[0]!==""&&s.unshift(""),{pathEnv:t,pathExt:s,pathExtExe:r}},Je=(e,n,o)=>{typeof n=="function"&&(o=n,n={}),n||(n={});let{pathEnv:t,pathExt:r,pathExtExe:s}=ze(e,n),a=[],i=l=>new Promise((c,f)=>{if(l===t.length)return n.all&&a.length?c(a):f(Ge(e));let m=t[l],d=/^".*"$/.test(m)?m.slice(1,-1):m,g=Ue.join(d,e),y=!d&&/^\.[\\\/]/.test(e)?e.slice(0,2)+g:g;c(p(y,l,0));}),p=(l,c,f)=>new Promise((m,d)=>{if(f===r.length)return m(i(c+1));let g=r[f];Ve(l+g,{pathExt:s},(y,R)=>{if(!y&&R)if(n.all)a.push(l+g);else return m(l+g);return m(p(l,c,f+1))});});return o?i(0).then(l=>o(null,l),o):i(0)},$t=(e,n)=>{n=n||{};let{pathEnv:o,pathExt:t,pathExtExe:r}=ze(e,n),s=[];for(let a=0;a<o.length;a++){let i=o[a],p=/^".*"$/.test(i)?i.slice(1,-1):i,l=Ue.join(p,e),c=!p&&/^\.[\\\/]/.test(e)?e.slice(0,2)+l:l;for(let f=0;f<t.length;f++){let m=c+t[f];try{if(Ve.sync(m,{pathExt:r}))if(n.all)s.push(m);else return m}catch{}}}if(n.all&&s.length)return s;if(n.nothrow)return null;throw Ge(e)};Ke.exports=Je;Je.sync=$t;});var Ye=b((co,Q)=>{var Qe=(e={})=>{let n=e.env||process.env;return (e.platform||process.platform)!=="win32"?"PATH":Object.keys(n).reverse().find(t=>t.toUpperCase()==="PATH")||"Path"};Q.exports=Qe;Q.exports.default=Qe;});var tn=b((fo,nn)=>{var Ze=a("path"),Bt=Xe(),jt=Ye();function en(e,n){let o=e.options.env||process.env,t=process.cwd(),r=e.options.cwd!=null,s=r&&process.chdir!==void 0&&!process.chdir.disabled;if(s)try{process.chdir(e.options.cwd);}catch{}let a;try{a=Bt.sync(e.command,{path:o[jt({env:o})],pathExt:n?Ze.delimiter:void 0});}catch{}finally{s&&process.chdir(t);}return a&&(a=Ze.resolve(r?e.options.cwd:"",a)),a}function _t(e){return en(e)||en(e,true)}nn.exports=_t;});var rn=b((mo,Z)=>{var Y=/([()\][%!^"`<>&|;, *?])/g;function Nt(e){return e=e.replace(Y,"^$1"),e}function Ft(e,n){return e=`${e}`,e=e.replace(/(?=(\\+?)?)\1"/g,'$1$1\\"'),e=e.replace(/(?=(\\+?)?)\1$/,"$1$1"),e=`"${e}"`,e=e.replace(Y,"^$1"),n&&(e=e.replace(Y,"^$1")),e}Z.exports.command=Nt;Z.exports.argument=Ft;});var sn=b((go,on)=>{on.exports=/^#!(.*)/;});var ln=b((yo,an)=>{var Lt=sn();an.exports=(e="")=>{let n=e.match(Lt);if(!n)return null;let[o,t]=n[0].replace(/#! ?/,"").split(" "),r=o.split("/").pop();return r==="env"?t:t?`${r} ${t}`:r};});var un=b((ho,pn)=>{var ee=a("fs"),Mt=ln();function Wt(e){let o=Buffer.alloc(150),t;try{t=ee.openSync(e,"r"),ee.readSync(t,o,0,150,0),ee.closeSync(t);}catch{}return Mt(o.toString())}pn.exports=Wt;});var dn=b((vo,mn)=>{var Ut=a("path"),cn=tn(),fn=rn(),Vt=un(),Gt=process.platform==="win32",zt=/\.(?:com|exe)$/i,Jt=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function Kt(e){e.file=cn(e);let n=e.file&&Vt(e.file);return n?(e.args.unshift(e.file),e.command=n,cn(e)):e.file}function Xt(e){if(!Gt)return e;let n=Kt(e),o=!zt.test(n);if(e.options.forceShell||o){let t=Jt.test(n);e.command=Ut.normalize(e.command),e.command=fn.command(e.command),e.args=e.args.map(s=>fn.argument(s,t));let r=[e.command].concat(e.args).join(" ");e.args=["/d","/s","/c",`"${r}"`],e.command=process.env.comspec||"cmd.exe",e.options.windowsVerbatimArguments=true;}return e}function Qt(e,n,o){n&&!Array.isArray(n)&&(o=n,n=null),n=n?n.slice(0):[],o=Object.assign({},o);let t={command:e,args:n,options:o,file:void 0,original:{command:e,args:n}};return o.shell?t:Xt(t)}mn.exports=Qt;});var hn=b((Ro,yn)=>{var ne=process.platform==="win32";function te(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 Yt(e,n){if(!ne)return;let o=e.emit;e.emit=function(t,r){if(t==="exit"){let s=gn(r,n);if(s)return o.call(e,"error",s)}return o.apply(e,arguments)};}function gn(e,n){return ne&&e===1&&!n.file?te(n.original,"spawn"):null}function Zt(e,n){return ne&&e===1&&!n.file?te(n.original,"spawnSync"):null}yn.exports={hookChildProcess:Yt,verifyENOENT:gn,verifyENOENTSync:Zt,notFoundError:te};});var xn=b((xo,D)=>{var vn=a("child_process"),re=dn(),oe=hn();function Rn(e,n,o){let t=re(e,n,o),r=vn.spawn(t.command,t.args,t.options);return oe.hookChildProcess(r,t),r}function er(e,n,o){let t=re(e,n,o),r=vn.spawnSync(t.command,t.args,t.options);return r.error=r.error||oe.verifyENOENTSync(r.status,t),r}D.exports=Rn;D.exports.spawn=Rn;D.exports.sync=er;D.exports._parse=re;D.exports._enoent=oe;});var qe=()=>{if(typeof Bun<"u"){let[e]=Bun.version.split(".").map(Number);if(e<1)throw new g(`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 g(`Unsupported Node version ${process.versions.node}. Please use Node 18 or newer.`)}};var M=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 Ae=async(e$1,n$1,o$1,t)=>{let r=o(),s=n(r),a=t.client({$config:r,...o$1,httpRequest:M(s.name),models:B$1(o$1.models),services:B$1(o$1.services)});q(r)&&(e(n$1),C$1.writeFileSync(q$1.resolve(n$1,`${q(r)}.ts`),a));};var Ee=async(e,n$1,o$1)=>{let t=o();if(t.exportCore){let r=n(t),s={httpRequest:M(r.name),server:t.base!==void 0?t.base:n$1.server,version:n$1.version};if(C$1.rmSync(q$1.resolve(e),{force:true,recursive:true}),C$1.mkdirSync(q$1.resolve(e),{recursive:true}),await C$1.writeFileSync(q$1.resolve(e,"OpenAPI.ts"),o$1.core.settings({$config:t,...s})),await C$1.writeFileSync(q$1.resolve(e,"ApiError.ts"),o$1.core.apiError({$config:t,...s})),await C$1.writeFileSync(q$1.resolve(e,"ApiRequestOptions.ts"),o$1.core.apiRequestOptions({$config:t,...s})),await C$1.writeFileSync(q$1.resolve(e,"ApiResult.ts"),o$1.core.apiResult({$config:t,...s})),r.name!=="legacy/angular"&&await C$1.writeFileSync(q$1.resolve(e,"CancelablePromise.ts"),o$1.core.cancelablePromise({$config:t,...s})),await C$1.writeFileSync(q$1.resolve(e,"request.ts"),o$1.core.request({$config:t,...s})),q(t)&&(await C$1.writeFileSync(q$1.resolve(e,"BaseHttpRequest.ts"),o$1.core.baseHttpRequest({$config:t,...s})),await C$1.writeFileSync(q$1.resolve(e,`${s.httpRequest}.ts`),o$1.core.httpRequest({$config:t,...s}))),t.request){let a=q$1.resolve(process.cwd(),t.request);if(!await C$1.existsSync(a))throw new Error(`Custom request file "${a}" does not exists`);await C$1.copyFileSync(a,q$1.resolve(e,"request.ts"));}}};var Te=({files:e})=>{let n$1=o();e.index=new I({dir:n$1.output.path,id:"index",name:"index.ts"}),q(n$1)&&e.index.add(v.exportNamedDeclaration({exports:q(n$1),module:`./${q(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"})),q(n$1)&&e.index.add(v.exportNamedDeclaration({exports:"BaseHttpRequest",module:"./core/BaseHttpRequest"})),n(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 t=e[o];o==="index"||t.isEmpty()||t.exportFromIndex&&e.index.add(v.exportAllDeclaration({module:`./${t.nameWithoutExtension()}`}));});};var we=async({client:e,openApi:n$1,templates:o$1})=>{let t=o(),r=n$1;if(e){if(t.plugins["@hey-api/sdk"]?.config.include&&t.plugins["@hey-api/sdk"].config.asClass){let p=new RegExp(t.plugins["@hey-api/sdk"].config.include);e.services=e.services.filter(l=>p.test(l.name));}if(t.plugins["@hey-api/typescript"]?.config.include){let p=new RegExp(t.plugins["@hey-api/typescript"].config.include);e.models=e.models.filter(l=>p.test(l.name));}}let s=q$1.resolve(t.output.path);t.output.clean&&f(s);let a=n(t);if(!p(t)&&"bundle"in a.config&&a.config.bundle){let p={importFileExtension:t.output.importFileExtension};G({meta:p,outputPath:s,plugin:a});}await Ae(r,s,e,o$1),await Ee(q$1.resolve(t.output.path,"core"),e,o$1);let i={};for(let p of t.pluginOrder){let l=t.plugins[p],c=(l.output??"").split("/"),f=q$1.resolve(t.output.path,...c.slice(0,c.length-1));i[l.name]=new I({dir:f,id:`legacy-unused-${l.name}`,name:`${c[c.length-1]}.ts`}),l.handlerLegacy?.({client:e,files:i,openApi:r,plugin:l});}Te({files:i}),Object.entries(i).forEach(([p,l])=>{t.dryRun||(p==="index"?l.write(`
|
|
3
|
-
`,t.output.tsConfig):l.write(`
|
|
1
|
+
import{i as e,r as t,t as n}from"./chunk-C-EqMg7d.js";import{A as r,C as i,D as a,E as o,F as s,M as c,N as l,O as u,P as d,S as f,T as p,_ as m,a as h,b as g,c as _,d as v,f as y,g as b,h as ee,i as x,j as te,k as ne,l as re,m as ie,n as ae,o as S,p as C,r as w,s as T,t as oe,u as se,v as E,w as D,x as O,y as ce}from"./getSpec-BlRTbnm6.js";import k from"ansi-colors";import le from"color-support";import A from"node:fs";import j from"node:path";import{$RefParser as M}from"@hey-api/json-schema-ref-parser";import N from"handlebars";const P=()=>{if(typeof Bun<`u`){let[e]=Bun.version.split(`.`).map(Number);if(e<1)throw new o(`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<20)throw new o(`Unsupported Node version ${process.versions.node}. Please use Node 20 or newer.`)}},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``}},I=async(e,t,n,r)=>{let i=f(),a=p(i),o=r.client({$config:i,...n,httpRequest:F(a.name),models:y(n.models),services:y(n.services)});D(i)&&(l(t),A.writeFileSync(j.resolve(t,`${D(i)}.ts`),o))},L=async(e,t,n)=>{let r=f();if(r.exportCore){let i=p(r),a={httpRequest:F(i.name),server:r.base===void 0?t.server:r.base,version:t.version};if(A.rmSync(j.resolve(e),{force:!0,recursive:!0}),A.mkdirSync(j.resolve(e),{recursive:!0}),await A.writeFileSync(j.resolve(e,`OpenAPI.ts`),n.core.settings({$config:r,...a})),await A.writeFileSync(j.resolve(e,`ApiError.ts`),n.core.apiError({$config:r,...a})),await A.writeFileSync(j.resolve(e,`ApiRequestOptions.ts`),n.core.apiRequestOptions({$config:r,...a})),await A.writeFileSync(j.resolve(e,`ApiResult.ts`),n.core.apiResult({$config:r,...a})),i.name!==`legacy/angular`&&await A.writeFileSync(j.resolve(e,`CancelablePromise.ts`),n.core.cancelablePromise({$config:r,...a})),await A.writeFileSync(j.resolve(e,`request.ts`),n.core.request({$config:r,...a})),D(r)&&(await A.writeFileSync(j.resolve(e,`BaseHttpRequest.ts`),n.core.baseHttpRequest({$config:r,...a})),await A.writeFileSync(j.resolve(e,`${a.httpRequest}.ts`),n.core.httpRequest({$config:r,...a}))),r.request){let t=j.resolve(process.cwd(),r.request);if(!await A.existsSync(t))throw Error(`Custom request file "${t}" does not exists`);await A.copyFileSync(t,j.resolve(e,`request.ts`))}}},R=({files:e})=>{let t=f();e.index=new x({dir:t.output.path,id:`index`,name:`index.ts`}),D(t)&&e.index.add(m.exportNamedDeclaration({exports:D(t),module:`./${D(t)}`})),t.exportCore&&(e.index.add(m.exportNamedDeclaration({exports:`ApiError`,module:`./core/ApiError`})),t.plugins[`@hey-api/sdk`]?.config.response===`response`&&e.index.add(m.exportNamedDeclaration({exports:{asType:!0,name:`ApiResult`},module:`./core/ApiResult`})),D(t)&&e.index.add(m.exportNamedDeclaration({exports:`BaseHttpRequest`,module:`./core/BaseHttpRequest`})),p(t).name!==`legacy/angular`&&e.index.add(m.exportNamedDeclaration({exports:[`CancelablePromise`,`CancelError`],module:`./core/CancelablePromise`})),e.index.add(m.exportNamedDeclaration({exports:[`OpenAPI`,{asType:!0,name:`OpenAPIConfig`}],module:`./core/OpenAPI`}))),Object.keys(e).sort().forEach(t=>{let n=e[t];t===`index`||n.isEmpty()||n.exportFromIndex&&e.index.add(m.exportAllDeclaration({module:`./${n.nameWithoutExtension()}`}))})},z=async({client:e,openApi:t,templates:n})=>{let r=f(),a=t;if(e){if(r.plugins[`@hey-api/sdk`]?.config.include&&r.plugins[`@hey-api/sdk`].config.asClass){let t=new RegExp(r.plugins[`@hey-api/sdk`].config.include);e.services=e.services.filter(e=>t.test(e.name))}if(r.plugins[`@hey-api/typescript`]?.config.include){let t=new RegExp(r.plugins[`@hey-api/typescript`].config.include);e.models=e.models.filter(e=>t.test(e.name))}}let o=j.resolve(r.output.path);r.output.clean&&d(o);let s=p(r);!i(r)&&`bundle`in s.config&&s.config.bundle&&S({meta:{importFileExtension:r.output.importFileExtension},outputPath:o,plugin:s}),await I(a,o,e,n),await L(j.resolve(r.output.path,`core`),e,n);let c={};for(let t of r.pluginOrder){let n=r.plugins[t],i=(n.output??``).split(`/`),o=j.resolve(r.output.path,...i.slice(0,i.length-1));c[n.name]=new x({dir:o,id:`legacy-unused-${n.name}`,name:`${i[i.length-1]}.ts`}),n.handlerLegacy?.({client:e,files:c,openApi:a,plugin:n})}R({files:c}),Object.entries(c).forEach(([e,t])=>{r.dryRun||(e===`index`?t.write(`
|
|
2
|
+
`,r.output.tsConfig):t.write(`
|
|
4
3
|
|
|
5
|
-
`,t.output.tsConfig));});};var Se=async({context:e})=>{let n$1=q$1.resolve(e.config.output.path);e.config.output.clean&&f(n$1);let o={importFileExtension:e.config.output.importFileExtension},t=n(e.config);"bundle"in t.config&&t.config.bundle&&(e.config._FRAGILE_CLIENT_BUNDLE_RENAMED=G({meta:o,outputPath:n$1,plugin:t,project:e.gen}));for(let r of e.registerPlugins())await r.run();for(let r of e.gen.render(o)){let s=q$1.resolve(n$1,r.path),a=q$1.dirname(s);e.config.dryRun||(C$1.mkdirSync(a,{recursive:true}),C$1.writeFileSync(s,r.content,{encoding:"utf8"}));}};var Oe=({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 t in e.schemas){let r=o.definitions[t];if(!r||typeof r!="object")continue;let s=e.schemas[t];s(r);}if(e.operations&&o.paths)for(let t in e.operations){let[r,s]=t.split(" ");if(!r||!s)continue;let a=o.paths[s];if(!a)continue;let i=a[r.toLocaleLowerCase()]||a[r.toLocaleUpperCase()];if(!i||typeof i!="object")continue;let p=e.operations[t];p(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 t in e.schemas){let r=o.components.schemas[t];if(!r||typeof r!="object")continue;let s=e.schemas[t];s(r);}if(e.parameters&&o.components.parameters)for(let t in e.parameters){let r=o.components.parameters[t];if(!r||typeof r!="object")continue;let s=e.parameters[t];s(r);}if(e.requestBodies&&o.components.requestBodies)for(let t in e.requestBodies){let r=o.components.requestBodies[t];if(!r||typeof r!="object")continue;let s=e.requestBodies[t];s(r);}if(e.responses&&o.components.responses)for(let t in e.responses){let r=o.components.responses[t];if(!r||typeof r!="object")continue;let s=e.responses[t];s(r);}}if(e.operations&&o.paths)for(let t in e.operations){let[r,s]=t.split(" ");if(!r||!s)continue;let a=o.paths[s];if(!a)continue;let i=a[r.toLocaleLowerCase()]||a[r.toLocaleUpperCase()];if(!i||typeof i!="object")continue;let p=e.operations[t];p(i);}};var se=c(xn(),1),nr={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"}},tr={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"}},Pn=({config:e})=>{if(e.output.format){let n=nr[e.output.format];console.log(`\u2728 Running ${n.name}`),(0, se.sync)(n.command,n.args(e.output.path));}if(e.output.lint){let n=tr[e.output.lint];console.log(`\u2728 Running ${n.name}`),(0, se.sync)(n.command,n.args(e.output.path));}};function bn(e,n){return {...e,config:n,models:e.models.map(o=>rr(o)),services:or(e.operations).map(sr),types:{}}}var rr=e=>({...e,$refs:e.$refs.filter((n,o,t)=>z(n,o,t)),enum:e.enum.filter((n,o,t)=>t.findIndex(r=>r.value===n.value)===o),enums:e.enums.filter((n,o,t)=>t.findIndex(r=>r.name===n.name)===o),imports:e.imports.filter((n,o,t)=>z(n,o,t)&&n!==e.name).sort(A)}),or=e=>{let n=o(),o$1=new Map;return e.forEach(t=>{(t.tags?.length&&(n.plugins["@hey-api/sdk"]?.config.asClass||q(n))?t.tags.filter(z):["Default"]).forEach(s=>{let a={...t,service:lr(s)},i=o$1.get(a.service)||ar(a);i.$refs=[...i.$refs,...a.$refs],i.imports=[...i.imports,...a.imports],i.operations=[...i.operations,a],o$1.set(a.service,i);});}),Array.from(o$1.values())},sr=e=>{let n={...e};return n.operations=ir(n),n.operations.forEach(o=>{n.imports.push(...o.imports);}),n.imports=n.imports.filter(z).sort(A),n},ir=e=>{let n=new Map;return e.operations.map(o=>{let t={...o};t.imports.push(...t.parameters.flatMap(i=>i.imports));let r=t.responses.filter(i=>i.responseTypes.includes("success"));t.imports.push(...r.flatMap(i=>i.imports));let s=t.name,a=n.get(s)||0;return a>0&&(t.name=`${s}${a}`),n.set(s,a+1),t})},ar=e=>({$refs:[],imports:[],name:e.service,operations:[]}),lr=e=>u({case:"PascalCase",value:x(e)});var cr=e=>{let n={...e,path:""};if(e.path&&(typeof e.path!="string"||e.registry!=="hey-api"))return n.path=e.path,n;let[o,t]=e.path.split("?"),s=(t||"").split("&").map(A=>A.split("=")),a=o||"";a.endsWith("/")&&(a=a.slice(0,a.length-1));let[,i]=a.split("://"),[p,l,c]=(i||"").split("/");n.organization=l||e.organization,n.project=c||e.project;let f=[],m="api_key";n.api_key=s.find(([A])=>A===m)?.[1]||e.api_key||process.env.HEY_API_TOKEN,n.api_key&&f.push(`${m}=${n.api_key}`);let d="branch";n.branch=s.find(([A])=>A===d)?.[1]||e.branch,n.branch&&f.push(`${d}=${n.branch}`);let g="commit_sha";n.commit_sha=s.find(([A])=>A===g)?.[1]||e.commit_sha,n.commit_sha&&f.push(`${g}=${n.commit_sha}`);let y="tags";n.tags=s.find(([A])=>A===y)?.[1]?.split(",")||e.tags,n.tags?.length&&f.push(`${y}=${n.tags.join(",")}`);let R="version";if(n.version=s.find(([A])=>A===R)?.[1]||e.version,n.version&&f.push(`${R}=${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 E=f.join("&"),k=p||"get.heyapi.dev",x=k.startsWith("localhost"),j=[x?"http":"https",k].join("://"),pe=x?[j,"v1","get",n.organization,n.project].join("/"):[j,n.organization,n.project].join("/");return n.path=E?`${pe}?${E}`:pe,n},Cn=(e,n)=>{let o=[],t=h.gray(`[Job ${n+1}] `),r=e.length,s=h.cyan(`Generating from ${r} ${r===1?"input":"inputs"}:`);o.push(`${t}\u23F3 ${s}`),e.forEach((a,i)=>{let p=` [${i+1}] `,l=h.cyan(p),c=" ".repeat(p.length);if(typeof a.path!="string"){o.push(`${t}${l}raw OpenAPI specification`);return}switch(a.registry){case "hey-api":{let f=[a.organization,a.project].filter(Boolean).join("/");o.push(`${t}${l}${f}`),a.branch&&o.push(`${t}${c}${h.gray("branch:")} ${h.green(a.branch)}`),a.commit_sha&&o.push(`${t}${c}${h.gray("commit:")} ${h.green(a.commit_sha)}`),a.tags?.length&&o.push(`${t}${c}${h.gray("tags:")} ${h.green(a.tags.join(", "))}`),a.version&&o.push(`${t}${c}${h.gray("version:")} ${h.green(a.version)}`),o.push(`${t}${c}${h.gray("registry:")} ${h.green("Hey API")}`);break}case "readme":{let f=[a.organization,a.project].filter(Boolean).join("/");f?o.push(`${t}${l}${f}`):o.push(`${t}${l}${a.path}`),a.uuid&&o.push(`${t}${c}${h.gray("uuid:")} ${h.green(a.uuid)}`),o.push(`${t}${c}${h.gray("registry:")} ${h.green("ReadMe")}`);break}case "scalar":{let f=[a.organization,a.project].filter(Boolean).join("/");o.push(`${t}${l}${f}`),o.push(`${t}${c}${h.gray("registry:")} ${h.green("Scalar")}`);break}default:o.push(`${t}${l}${a.path}`);break}});for(let a of o)console.log(a);},ie=async({config:e,dependencies:n,jobIndex:o,logger:t,templates:r,watches:s})=>{let a=s||Array.from({length:e.input.length},()=>({headers:new Headers})),i=e.input.map(d=>cr(d));e.logs.level!=="silent"&&!s&&Cn(i,o);let p$1=async(d,g)=>{let y=t.timeEvent("spec"),{arrayBuffer:R,error:E,resolvedInput:k,response:x}=await L({fetchOptions:d.fetch,inputPath:i[g].path,timeout:d.watch.timeout,watch:a[g]});if(y.timeEnd(),E&&!s)throw new Error(`Request failed with status ${x.status}: ${x.statusText}`);return {arrayBuffer:R,resolvedInput:k}},l=(await Promise.all(e.input.map((d,g)=>p$1(d,g)))).filter(d=>d.arrayBuffer||d.resolvedInput),c,f;if(l.length){let d=new $RefParser,g=l.length>1?await d.bundleMany({arrayBuffer:l.map(x=>x.arrayBuffer),pathOrUrlOrSchemas:[],resolvedInputs:l.map(x=>x.resolvedInput)}):await d.bundle({arrayBuffer:l[0].arrayBuffer,pathOrUrlOrSchema:void 0,resolvedInput:l[0].resolvedInput});e.logs.level!=="silent"&&s&&(console.clear(),Cn(i,o));let y=t.timeEvent("input.patch");Oe({patchOptions:e.parser.patch,spec:g}),y.timeEnd();let R=t.timeEvent("parser");if(e.experimentalParser&&!p(e)&&!q(e)&&(f=D({config:e,dependencies:n,logger:t,spec:g})),!f){let x=C({openApi:g});c=bn(x,e);}R.timeEnd();let E=t.timeEvent("generator");f?await Se({context:f}):c&&await we({client:c,openApi:g,templates:r}),E.timeEnd();let k=t.timeEvent("postprocess");if(!e.dryRun&&(Pn({config:e}),e.logs.level!=="silent")){let x=process.env.INIT_CWD?`./${q$1.relative(process.env.INIT_CWD,e.output.path)}`:e.output.path,j=h.gray(`[Job ${o+1}] `);console.log(`${j}${h.green("\u2705 Done!")} Your output is in ${h.cyanBright(x)}`);}k.timeEnd();}let m=e.input.find((d,g)=>d.watch.enabled&&typeof i[g].path=="string");return m&&setTimeout(()=>{ie({config:e,dependencies:n,jobIndex:o,logger:t,templates:r,watches:a});},m.watch.interval),f||c};var fr=`
|
|
4
|
+
`,r.output.tsConfig))})},B=async({context:e})=>{let t=j.resolve(e.config.output.path);e.config.output.clean&&d(t);let n={importFileExtension:e.config.output.importFileExtension},r=p(e.config);`bundle`in r.config&&r.config.bundle&&(e.config._FRAGILE_CLIENT_BUNDLE_RENAMED=S({meta:n,outputPath:t,plugin:r,project:e.gen}));for(let t of e.registerPlugins())await t.run();for(let r of e.gen.render(n)){let n=j.resolve(t,r.path),i=j.dirname(n);e.config.dryRun||(A.mkdirSync(i,{recursive:!0}),A.writeFileSync(n,r.content,{encoding:`utf8`}))}},V=({patchOptions:e,spec:t})=>{if(!e)return;let n=t;if(`swagger`in n){if(e.version&&n.swagger&&(n.swagger=typeof e.version==`string`?e.version:e.version(n.swagger)),e.meta&&n.info&&e.meta(n.info),e.schemas&&n.definitions)for(let t in e.schemas){let r=n.definitions[t];if(!r||typeof r!=`object`)continue;let i=e.schemas[t];i(r)}if(e.operations&&n.paths)for(let t in e.operations){let[r,i]=t.split(` `);if(!r||!i)continue;let a=n.paths[i];if(!a)continue;let o=a[r.toLocaleLowerCase()]||a[r.toLocaleUpperCase()];if(!o||typeof o!=`object`)continue;let s=e.operations[t];s(o)}return}if(e.version&&n.openapi&&(n.openapi=typeof e.version==`string`?e.version:e.version(n.openapi)),e.meta&&n.info&&e.meta(n.info),n.components){if(e.schemas&&n.components.schemas)for(let t in e.schemas){let r=n.components.schemas[t];if(!r||typeof r!=`object`)continue;let i=e.schemas[t];i(r)}if(e.parameters&&n.components.parameters)for(let t in e.parameters){let r=n.components.parameters[t];if(!r||typeof r!=`object`)continue;let i=e.parameters[t];i(r)}if(e.requestBodies&&n.components.requestBodies)for(let t in e.requestBodies){let r=n.components.requestBodies[t];if(!r||typeof r!=`object`)continue;let i=e.requestBodies[t];i(r)}if(e.responses&&n.components.responses)for(let t in e.responses){let r=n.components.responses[t];if(!r||typeof r!=`object`)continue;let i=e.responses[t];i(r)}}if(e.operations&&n.paths)for(let t in e.operations){let[r,i]=t.split(` `);if(!r||!i)continue;let a=n.paths[i];if(!a)continue;let o=a[r.toLocaleLowerCase()]||a[r.toLocaleUpperCase()];if(!o||typeof o!=`object`)continue;let s=e.operations[t];s(o)}};var H=n(((e,n)=>{n.exports=o,o.sync=s;var r=t(`fs`);function i(e,t){var n=t.pathExt===void 0?process.env.PATHEXT:t.pathExt;if(!n||(n=n.split(`;`),n.indexOf(``)!==-1))return!0;for(var r=0;r<n.length;r++){var i=n[r].toLowerCase();if(i&&e.substr(-i.length).toLowerCase()===i)return!0}return!1}function a(e,t,n){return!e.isSymbolicLink()&&!e.isFile()?!1:i(t,n)}function o(e,t,n){r.stat(e,function(r,i){n(r,r?!1:a(i,e,t))})}function s(e,t){return a(r.statSync(e),e,t)}})),U=n(((e,n)=>{n.exports=i,i.sync=a;var r=t(`fs`);function i(e,t,n){r.stat(e,function(e,r){n(e,e?!1:o(r,t))})}function a(e,t){return o(r.statSync(e),t)}function o(e,t){return e.isFile()&&s(e,t)}function s(e,t){var n=e.mode,r=e.uid,i=e.gid,a=t.uid===void 0?process.getuid&&process.getuid():t.uid,o=t.gid===void 0?process.getgid&&process.getgid():t.gid,s=64,c=8,l=1,u=s|c;return n&l||n&c&&i===o||n&s&&r===a||n&u&&a===0}})),W=n(((e,n)=>{t(`fs`);var r=process.platform===`win32`||global.TESTING_WINDOWS?H():U();n.exports=i,i.sync=a;function i(e,t,n){if(typeof t==`function`&&(n=t,t={}),!n){if(typeof Promise!=`function`)throw TypeError(`callback not provided`);return new Promise(function(n,r){i(e,t||{},function(e,t){e?r(e):n(t)})})}r(e,t||{},function(e,r){e&&(e.code===`EACCES`||t&&t.ignoreErrors)&&(e=null,r=!1),n(e,r)})}function a(e,t){try{return r.sync(e,t||{})}catch(e){if(t&&t.ignoreErrors||e.code===`EACCES`)return!1;throw e}}})),ue=n(((e,n)=>{let r=process.platform===`win32`||process.env.OSTYPE===`cygwin`||process.env.OSTYPE===`msys`,i=t(`path`),a=r?`;`:`:`,o=W(),s=e=>Object.assign(Error(`not found: ${e}`),{code:`ENOENT`}),c=(e,t)=>{let n=t.colon||a,i=e.match(/\//)||r&&e.match(/\\/)?[``]:[...r?[process.cwd()]:[],...(t.path||process.env.PATH||``).split(n)],o=r?t.pathExt||process.env.PATHEXT||`.EXE;.CMD;.BAT;.COM`:``,s=r?o.split(n):[``];return r&&e.indexOf(`.`)!==-1&&s[0]!==``&&s.unshift(``),{pathEnv:i,pathExt:s,pathExtExe:o}},l=(e,t,n)=>{typeof t==`function`&&(n=t,t={}),t||={};let{pathEnv:r,pathExt:a,pathExtExe:l}=c(e,t),u=[],d=n=>new Promise((a,o)=>{if(n===r.length)return t.all&&u.length?a(u):o(s(e));let c=r[n],l=/^".*"$/.test(c)?c.slice(1,-1):c,d=i.join(l,e);a(f(!l&&/^\.[\\\/]/.test(e)?e.slice(0,2)+d:d,n,0))}),f=(e,n,r)=>new Promise((i,s)=>{if(r===a.length)return i(d(n+1));let c=a[r];o(e+c,{pathExt:l},(a,o)=>{if(!a&&o)if(t.all)u.push(e+c);else return i(e+c);return i(f(e,n,r+1))})});return n?d(0).then(e=>n(null,e),n):d(0)};n.exports=l,l.sync=(e,t)=>{t||={};let{pathEnv:n,pathExt:r,pathExtExe:a}=c(e,t),l=[];for(let s=0;s<n.length;s++){let c=n[s],u=/^".*"$/.test(c)?c.slice(1,-1):c,d=i.join(u,e),f=!u&&/^\.[\\\/]/.test(e)?e.slice(0,2)+d:d;for(let e=0;e<r.length;e++){let n=f+r[e];try{if(o.sync(n,{pathExt:a}))if(t.all)l.push(n);else return n}catch{}}}if(t.all&&l.length)return l;if(t.nothrow)return null;throw s(e)}})),de=n(((e,t)=>{let n=(e={})=>{let t=e.env||process.env;return(e.platform||process.platform)===`win32`?Object.keys(t).reverse().find(e=>e.toUpperCase()===`PATH`)||`Path`:`PATH`};t.exports=n,t.exports.default=n})),fe=n(((e,n)=>{let r=t(`path`),i=ue(),a=de();function o(e,t){let n=e.options.env||process.env,o=process.cwd(),s=e.options.cwd!=null,c=s&&process.chdir!==void 0&&!process.chdir.disabled;if(c)try{process.chdir(e.options.cwd)}catch{}let l;try{l=i.sync(e.command,{path:n[a({env:n})],pathExt:t?r.delimiter:void 0})}catch{}finally{c&&process.chdir(o)}return l&&=r.resolve(s?e.options.cwd:``,l),l}function s(e){return o(e)||o(e,!0)}n.exports=s})),pe=n(((e,t)=>{let n=/([()\][%!^"`<>&|;, *?])/g;function r(e){return e=e.replace(n,`^$1`),e}function i(e,t){return e=`${e}`,e=e.replace(/(?=(\\+?)?)\1"/g,`$1$1\\"`),e=e.replace(/(?=(\\+?)?)\1$/,`$1$1`),e=`"${e}"`,e=e.replace(n,`^$1`),t&&(e=e.replace(n,`^$1`)),e}t.exports.command=r,t.exports.argument=i})),me=n(((e,t)=>{t.exports=/^#!(.*)/})),he=n(((e,t)=>{let n=me();t.exports=(e=``)=>{let t=e.match(n);if(!t)return null;let[r,i]=t[0].replace(/#! ?/,``).split(` `),a=r.split(`/`).pop();return a===`env`?i:i?`${a} ${i}`:a}})),ge=n(((e,n)=>{let r=t(`fs`),i=he();function a(e){let t=Buffer.alloc(150),n;try{n=r.openSync(e,`r`),r.readSync(n,t,0,150,0),r.closeSync(n)}catch{}return i(t.toString())}n.exports=a})),_e=n(((e,n)=>{let r=t(`path`),i=fe(),a=pe(),o=ge(),s=process.platform===`win32`,c=/\.(?:com|exe)$/i,l=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function u(e){e.file=i(e);let t=e.file&&o(e.file);return t?(e.args.unshift(e.file),e.command=t,i(e)):e.file}function d(e){if(!s)return e;let t=u(e),n=!c.test(t);if(e.options.forceShell||n){let n=l.test(t);e.command=r.normalize(e.command),e.command=a.command(e.command),e.args=e.args.map(e=>a.argument(e,n)),e.args=[`/d`,`/s`,`/c`,`"${[e.command].concat(e.args).join(` `)}"`],e.command=process.env.comspec||`cmd.exe`,e.options.windowsVerbatimArguments=!0}return e}function f(e,t,n){t&&!Array.isArray(t)&&(n=t,t=null),t=t?t.slice(0):[],n=Object.assign({},n);let r={command:e,args:t,options:n,file:void 0,original:{command:e,args:t}};return n.shell?r:d(r)}n.exports=f})),ve=n(((e,t)=>{let n=process.platform===`win32`;function r(e,t){return Object.assign(Error(`${t} ${e.command} ENOENT`),{code:`ENOENT`,errno:`ENOENT`,syscall:`${t} ${e.command}`,path:e.command,spawnargs:e.args})}function i(e,t){if(!n)return;let r=e.emit;e.emit=function(n,i){if(n===`exit`){let n=a(i,t);if(n)return r.call(e,`error`,n)}return r.apply(e,arguments)}}function a(e,t){return n&&e===1&&!t.file?r(t.original,`spawn`):null}function o(e,t){return n&&e===1&&!t.file?r(t.original,`spawnSync`):null}t.exports={hookChildProcess:i,verifyENOENT:a,verifyENOENTSync:o,notFoundError:r}})),G=e(n(((e,n)=>{let r=t(`child_process`),i=_e(),a=ve();function o(e,t,n){let o=i(e,t,n),s=r.spawn(o.command,o.args,o.options);return a.hookChildProcess(s,o),s}function s(e,t,n){let o=i(e,t,n),s=r.spawnSync(o.command,o.args,o.options);return s.error=s.error||a.verifyENOENTSync(s.status,o),s}n.exports=o,n.exports.spawn=o,n.exports.sync=s,n.exports._parse=i,n.exports._enoent=a}))(),1);const ye={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`}},be={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`}},xe=({config:e})=>{if(e.output.format){let t=ye[e.output.format];console.log(`✨ Running ${t.name}`),(0,G.sync)(t.command,t.args(e.output.path))}if(e.output.lint){let t=be[e.output.lint];console.log(`✨ Running ${t.name}`),(0,G.sync)(t.command,t.args(e.output.path))}};function Se(e,t){return{...e,config:t,models:e.models.map(e=>Ce(e)),services:we(e.operations).map(Te),types:{}}}const Ce=e=>({...e,$refs:e.$refs.filter((e,t,n)=>C(e,t,n)),enum:e.enum.filter((e,t,n)=>n.findIndex(t=>t.value===e.value)===t),enums:e.enums.filter((e,t,n)=>n.findIndex(t=>t.name===e.name)===t),imports:e.imports.filter((t,n,r)=>C(t,n,r)&&t!==e.name).sort(v)}),we=e=>{let t=f(),n=new Map;return e.forEach(e=>{(e.tags?.length&&(t.plugins[`@hey-api/sdk`]?.config.asClass||D(t))?e.tags.filter(C):[`Default`]).forEach(t=>{let r={...e,service:Oe(t)},i=n.get(r.service)||De(r);i.$refs=[...i.$refs,...r.$refs],i.imports=[...i.imports,...r.imports],i.operations=[...i.operations,r],n.set(r.service,i)})}),Array.from(n.values())},Te=e=>{let t={...e};return t.operations=Ee(t),t.operations.forEach(e=>{t.imports.push(...e.imports)}),t.imports=t.imports.filter(C).sort(v),t},Ee=e=>{let t=new Map;return e.operations.map(e=>{let n={...e};n.imports.push(...n.parameters.flatMap(e=>e.imports));let r=n.responses.filter(e=>e.responseTypes.includes(`success`));n.imports.push(...r.flatMap(e=>e.imports));let i=n.name,a=t.get(i)||0;return a>0&&(n.name=`${i}${a}`),t.set(i,a+1),n})},De=e=>({$refs:[],imports:[],name:e.service,operations:[]}),Oe=e=>E({case:`PascalCase`,value:ee(e)}),ke=e=>{let t={...e,path:``};if(e.path&&(typeof e.path!=`string`||e.registry!==`hey-api`))return t.path=e.path,t;let[n,r]=e.path.split(`?`),i=(r||``).split(`&`).map(e=>e.split(`=`)),a=n||``;a.endsWith(`/`)&&(a=a.slice(0,a.length-1));let[,o]=a.split(`://`),[s,c,l]=(o||``).split(`/`);t.organization=c||e.organization,t.project=l||e.project;let u=[],d=`api_key`;t.api_key=i.find(([e])=>e===d)?.[1]||e.api_key||process.env.HEY_API_TOKEN,t.api_key&&u.push(`${d}=${t.api_key}`);let f=`branch`;t.branch=i.find(([e])=>e===f)?.[1]||e.branch,t.branch&&u.push(`${f}=${t.branch}`);let p=`commit_sha`;t.commit_sha=i.find(([e])=>e===p)?.[1]||e.commit_sha,t.commit_sha&&u.push(`${p}=${t.commit_sha}`);let m=`tags`;t.tags=i.find(([e])=>e===m)?.[1]?.split(`,`)||e.tags,t.tags?.length&&u.push(`${m}=${t.tags.join(`,`)}`);let h=`version`;if(t.version=i.find(([e])=>e===h)?.[1]||e.version,t.version&&u.push(`${h}=${t.version}`),!t.organization)throw Error(`missing organization - from which Hey API Platform organization do you want to generate your output?`);if(!t.project)throw Error(`missing project - from which Hey API Platform project do you want to generate your output?`);let g=u.join(`&`),_=s||`get.heyapi.dev`,v=_.startsWith(`localhost`),y=[v?`http`:`https`,_].join(`://`),b=v?[y,`v1`,`get`,t.organization,t.project].join(`/`):[y,t.organization,t.project].join(`/`);return t.path=g?`${b}?${g}`:b,t},K=(e,t)=>{let n=[],r=k.gray(`[Job ${t+1}] `),i=e.length,a=k.cyan(`Generating from ${i} ${i===1?`input`:`inputs`}:`);n.push(`${r}⏳ ${a}`),e.forEach((e,t)=>{let i=` [${t+1}] `,a=k.cyan(i),o=` `.repeat(i.length);if(typeof e.path!=`string`){n.push(`${r}${a}raw OpenAPI specification`);return}switch(e.registry){case`hey-api`:{let t=[e.organization,e.project].filter(Boolean).join(`/`);n.push(`${r}${a}${t}`),e.branch&&n.push(`${r}${o}${k.gray(`branch:`)} ${k.green(e.branch)}`),e.commit_sha&&n.push(`${r}${o}${k.gray(`commit:`)} ${k.green(e.commit_sha)}`),e.tags?.length&&n.push(`${r}${o}${k.gray(`tags:`)} ${k.green(e.tags.join(`, `))}`),e.version&&n.push(`${r}${o}${k.gray(`version:`)} ${k.green(e.version)}`),n.push(`${r}${o}${k.gray(`registry:`)} ${k.green(`Hey API`)}`);break}case`readme`:{let t=[e.organization,e.project].filter(Boolean).join(`/`);t?n.push(`${r}${a}${t}`):n.push(`${r}${a}${e.path}`),e.uuid&&n.push(`${r}${o}${k.gray(`uuid:`)} ${k.green(e.uuid)}`),n.push(`${r}${o}${k.gray(`registry:`)} ${k.green(`ReadMe`)}`);break}case`scalar`:{let t=[e.organization,e.project].filter(Boolean).join(`/`);n.push(`${r}${a}${t}`),n.push(`${r}${o}${k.gray(`registry:`)} ${k.green(`Scalar`)}`);break}default:n.push(`${r}${a}${e.path}`);break}});for(let e of n)console.log(e)},q=async({config:e,dependencies:t,jobIndex:n,logger:r,templates:a,watches:o})=>{let s=o||Array.from({length:e.input.length},()=>({headers:new Headers})),c=e.input.map(e=>ke(e));e.logs.level!==`silent`&&!o&&K(c,n);let l=async(e,t)=>{let n=r.timeEvent(`spec`),{arrayBuffer:i,error:a,resolvedInput:l,response:u}=await oe({fetchOptions:e.fetch,inputPath:c[t].path,timeout:e.watch.timeout,watch:s[t]});if(n.timeEnd(),a&&!o)throw Error(`Request failed with status ${u.status}: ${u.statusText}`);return{arrayBuffer:i,resolvedInput:l}},u=(await Promise.all(e.input.map((e,t)=>l(e,t)))).filter(e=>e.arrayBuffer||e.resolvedInput),d,f;if(u.length){let s=new M,l=u.length>1?await s.bundleMany({arrayBuffer:u.map(e=>e.arrayBuffer),pathOrUrlOrSchemas:[],resolvedInputs:u.map(e=>e.resolvedInput)}):await s.bundle({arrayBuffer:u[0].arrayBuffer,pathOrUrlOrSchema:void 0,resolvedInput:u[0].resolvedInput});e.logs.level!==`silent`&&o&&(console.clear(),K(c,n));let p=r.timeEvent(`input.patch`);V({patchOptions:e.parser.patch,spec:l}),p.timeEnd();let m=r.timeEvent(`parser`);e.experimentalParser&&!i(e)&&!D(e)&&(f=se({config:e,dependencies:t,logger:r,spec:l})),f||(d=Se(re({openApi:l}),e)),m.timeEnd();let h=r.timeEvent(`generator`);f?await B({context:f}):d&&await z({client:d,openApi:l,templates:a}),h.timeEnd();let g=r.timeEvent(`postprocess`);if(!e.dryRun&&(xe({config:e}),e.logs.level!==`silent`)){let t=process.env.INIT_CWD?`./${j.relative(process.env.INIT_CWD,e.output.path)}`:e.output.path,r=k.gray(`[Job ${n+1}] `);console.log(`${r}${k.green(`✅ Done!`)} Your output is in ${k.cyanBright(t)}`)}g.timeEnd()}let p=e.input.find((e,t)=>e.watch.enabled&&typeof c[t].path==`string`);return p&&setTimeout(()=>{q({config:e,dependencies:t,jobIndex:n,logger:r,templates:a,watches:s})},p.watch.interval),f||d},Ae=(e,t)=>{let n=[],r=Array.from({length:t?.padding??0}).fill(``);n.push(...r);let i=0,a=``;for(let t of e)t===`
|
|
5
|
+
`?a&&=(n.push(a),i=Math.max(i,a.length),``):a+=t;return n.push(...r),{lines:n,maxLineLength:i}};function je(){let e=s(),t=Ae(`
|
|
6
6
|
888 | e 888~-_ 888
|
|
7
7
|
888___| e88~~8e Y88b / d8b 888 \\ 888
|
|
8
8
|
888 | d888 88b Y888/ /Y88b 888 | 888
|
|
@@ -10,8 +10,7 @@ var Be=b((io,$e)=>{$e.exports=De;De.sync=St;var He=a("fs");function kt(e,n){var
|
|
|
10
10
|
888 | Y888 , Y /____Y88b 888_-~ 888
|
|
11
11
|
888 | "88___/ / / Y88b 888 888
|
|
12
12
|
_/
|
|
13
|
-
`,
|
|
14
|
-
`?s&&(o.push(s),r=Math.max(r,s.length),s=""):s+=a;return o.push(...t),{lines:o,maxLineLength:r}};function An(){let e=d(),n=mr(fr,{padding:1});for(let o of n.lines)console.log(h.cyan(o));console.log(h.gray(`${e.name} v${e.version}`)),console.log("");}var En={1:function(e,n,o,t,r){return `import { NgModule} from '@angular/core';
|
|
13
|
+
`,{padding:1});for(let e of t.lines)console.log(k.cyan(e));console.log(k.gray(`${e.name} v${e.version}`)),console.log(``)}var Me={1:function(e,t,n,r,i){return`import { NgModule} from '@angular/core';
|
|
15
14
|
import { HttpClientModule } from '@angular/common/http';
|
|
16
15
|
|
|
17
16
|
import { AngularHttpRequest } from './core/AngularHttpRequest';
|
|
@@ -19,19 +18,19 @@ import { BaseHttpRequest } from './core/BaseHttpRequest';
|
|
|
19
18
|
import type { OpenAPIConfig } from './core/OpenAPI';
|
|
20
19
|
import { OpenAPI } from './core/OpenAPI';
|
|
21
20
|
import { Interceptors } from './core/OpenAPI';
|
|
22
|
-
`},3:function(e,n,
|
|
21
|
+
`},3:function(e,t,n,r,i){var a=e.strict,o=e.lambda;return`import type { BaseHttpRequest } from './core/BaseHttpRequest';
|
|
23
22
|
import type { OpenAPIConfig } from './core/OpenAPI';
|
|
24
23
|
import { Interceptors } from './core/OpenAPI';
|
|
25
|
-
import { `+((
|
|
26
|
-
`},5:function(e,n,
|
|
27
|
-
`},8:function(e,n,
|
|
24
|
+
import { `+(o(a(t,`httpRequest`,{start:{line:14,column:12},end:{line:14,column:23}}),t)??``)+` } from './core/`+(o(a(t,`httpRequest`,{start:{line:14,column:45},end:{line:14,column:56}}),t)??``)+`';
|
|
25
|
+
`},5:function(e,t,n,r,i){var a=e.lookupProperty||function(e,t){if(Object.prototype.hasOwnProperty.call(e,t))return e[t]};return a(n,`each`).call(t??(e.nullContext||{}),a(t,`services`),{name:`each`,hash:{},fn:e.program(6,i,0),inverse:e.noop,data:i,loc:{start:{line:18,column:0},end:{line:20,column:9}}})??``},6:function(e,t,n,r,i){var a=e.lookupProperty||function(e,t){if(Object.prototype.hasOwnProperty.call(e,t))return e[t]};return`import { `+(a(n,`transformServiceName`).call(t??(e.nullContext||{}),a(t,`name`),{name:`transformServiceName`,hash:{},data:i,loc:{start:{line:19,column:9},end:{line:19,column:40}}})??``)+` } from './sdk.gen';
|
|
26
|
+
`},8:function(e,t,n,r,i){var a=e.strict,o=e.lambda,s=e.lookupProperty||function(e,t){if(Object.prototype.hasOwnProperty.call(e,t))return e[t]};return`@NgModule({
|
|
28
27
|
imports: [HttpClientModule],
|
|
29
28
|
providers: [
|
|
30
29
|
{
|
|
31
30
|
provide: OpenAPI,
|
|
32
31
|
useValue: {
|
|
33
|
-
BASE: OpenAPI?.BASE ?? '`+((
|
|
34
|
-
VERSION: OpenAPI?.VERSION ?? '`+((
|
|
32
|
+
BASE: OpenAPI?.BASE ?? '`+(o(a(t,`server`,{start:{line:30,column:31},end:{line:30,column:37}}),t)??``)+`',
|
|
33
|
+
VERSION: OpenAPI?.VERSION ?? '`+(o(a(t,`version`,{start:{line:31,column:37},end:{line:31,column:44}}),t)??``)+`',
|
|
35
34
|
WITH_CREDENTIALS: OpenAPI?.WITH_CREDENTIALS ?? false,
|
|
36
35
|
CREDENTIALS: OpenAPI?.CREDENTIALS ?? 'include',
|
|
37
36
|
TOKEN: OpenAPI?.TOKEN,
|
|
@@ -48,21 +47,21 @@ import { `+((s=i(a(n,"httpRequest",{start:{line:14,column:12},end:{line:14,colum
|
|
|
48
47
|
provide: BaseHttpRequest,
|
|
49
48
|
useClass: AngularHttpRequest,
|
|
50
49
|
},
|
|
51
|
-
`+(
|
|
50
|
+
`+(s(n,`each`).call(t??(e.nullContext||{}),s(t,`services`),{name:`each`,hash:{},fn:e.program(9,i,0),inverse:e.noop,data:i,loc:{start:{line:48,column:2},end:{line:50,column:11}}})??``)+` ]
|
|
52
51
|
})
|
|
53
|
-
export class `+((
|
|
54
|
-
`},9:function(e,n,
|
|
55
|
-
`},11:function(e,n,
|
|
52
|
+
export class `+(o(a(s(s(i,`root`),`$config`),`name`,{start:{line:53,column:16},end:{line:53,column:34}}),t)??``)+` {}
|
|
53
|
+
`},9:function(e,t,n,r,i){var a=e.lookupProperty||function(e,t){if(Object.prototype.hasOwnProperty.call(e,t))return e[t]};return` `+(a(n,`transformServiceName`).call(t??(e.nullContext||{}),a(t,`name`),{name:`transformServiceName`,hash:{},data:i,loc:{start:{line:49,column:2},end:{line:49,column:33}}})??``)+`,
|
|
54
|
+
`},11:function(e,t,n,r,i){var a=e.strict,o=e.lambda,s=t??(e.nullContext||{}),c=e.lookupProperty||function(e,t){if(Object.prototype.hasOwnProperty.call(e,t))return e[t]};return`type HttpRequestConstructor = new (config: OpenAPIConfig) => BaseHttpRequest;
|
|
56
55
|
|
|
57
|
-
export class `+((
|
|
56
|
+
export class `+(o(a(c(c(i,`root`),`$config`),`name`,{start:{line:57,column:16},end:{line:57,column:34}}),t)??``)+` {
|
|
58
57
|
|
|
59
|
-
`+((
|
|
58
|
+
`+(c(n,`each`).call(s,c(t,`services`),{name:`each`,hash:{},fn:e.program(12,i,0),inverse:e.noop,data:i,loc:{start:{line:59,column:1},end:{line:61,column:10}}})??``)+`
|
|
60
59
|
public readonly request: BaseHttpRequest;
|
|
61
60
|
|
|
62
|
-
constructor(config?: Partial<OpenAPIConfig>, HttpRequest: HttpRequestConstructor = `+((
|
|
61
|
+
constructor(config?: Partial<OpenAPIConfig>, HttpRequest: HttpRequestConstructor = `+(o(a(t,`httpRequest`,{start:{line:65,column:87},end:{line:65,column:98}}),t)??``)+`) {
|
|
63
62
|
this.request = new HttpRequest({
|
|
64
|
-
BASE: config?.BASE ?? '`+((
|
|
65
|
-
VERSION: config?.VERSION ?? '`+((
|
|
63
|
+
BASE: config?.BASE ?? '`+(o(a(t,`server`,{start:{line:67,column:29},end:{line:67,column:35}}),t)??``)+`',
|
|
64
|
+
VERSION: config?.VERSION ?? '`+(o(a(t,`version`,{start:{line:68,column:35},end:{line:68,column:42}}),t)??``)+`',
|
|
66
65
|
WITH_CREDENTIALS: config?.WITH_CREDENTIALS ?? false,
|
|
67
66
|
CREDENTIALS: config?.CREDENTIALS ?? 'include',
|
|
68
67
|
TOKEN: config?.TOKEN,
|
|
@@ -76,13 +75,13 @@ export class `+((s=i(a(l(l(r,"root"),"$config"),"name",{start:{line:57,column:16
|
|
|
76
75
|
},
|
|
77
76
|
});
|
|
78
77
|
|
|
79
|
-
`+((
|
|
78
|
+
`+(c(n,`each`).call(s,c(t,`services`),{name:`each`,hash:{},fn:e.program(14,i,0),inverse:e.noop,data:i,loc:{start:{line:82,column:2},end:{line:84,column:11}}})??``)+` }
|
|
80
79
|
}
|
|
81
|
-
`},12:function(e,n,
|
|
82
|
-
`},14:function(e,n,
|
|
83
|
-
`},compiler:[8
|
|
84
|
-
`+((
|
|
85
|
-
`+((
|
|
80
|
+
`},12:function(e,t,n,r,i){var a=t??(e.nullContext||{}),o=e.lookupProperty||function(e,t){if(Object.prototype.hasOwnProperty.call(e,t))return e[t]};return` public readonly `+(o(n,`camelCase`).call(a,o(t,`name`),{name:`camelCase`,hash:{},data:i,loc:{start:{line:60,column:17},end:{line:60,column:37}}})??``)+`: `+(o(n,`transformServiceName`).call(a,o(t,`name`),{name:`transformServiceName`,hash:{},data:i,loc:{start:{line:60,column:39},end:{line:60,column:70}}})??``)+`;
|
|
81
|
+
`},14:function(e,t,n,r,i){var a=t??(e.nullContext||{}),o=e.lookupProperty||function(e,t){if(Object.prototype.hasOwnProperty.call(e,t))return e[t]};return` this.`+(o(n,`camelCase`).call(a,o(t,`name`),{name:`camelCase`,hash:{},data:i,loc:{start:{line:83,column:7},end:{line:83,column:27}}})??``)+` = new `+(o(n,`transformServiceName`).call(a,o(t,`name`),{name:`transformServiceName`,hash:{},data:i,loc:{start:{line:83,column:34},end:{line:83,column:65}}})??``)+`(this.request);
|
|
82
|
+
`},compiler:[8,`>= 4.3.0`],main:function(e,t,n,r,i){var a=t??(e.nullContext||{}),o=e.lookupProperty||function(e,t){if(Object.prototype.hasOwnProperty.call(e,t))return e[t]};return(o(n,`equals`).call(a,o(o(o(o(i,`root`),`$config`),`client`),`name`),`legacy/angular`,{name:`equals`,hash:{},fn:e.program(1,i,0),inverse:e.program(3,i,0),data:i,loc:{start:{line:1,column:0},end:{line:15,column:11}}})??``)+`
|
|
83
|
+
`+(o(n,`if`).call(a,o(t,`services`),{name:`if`,hash:{},fn:e.program(5,i,0),inverse:e.noop,data:i,loc:{start:{line:17,column:0},end:{line:21,column:7}}})??``)+`
|
|
84
|
+
`+(o(n,`equals`).call(a,o(o(o(o(i,`root`),`$config`),`client`),`name`),`legacy/angular`,{name:`equals`,hash:{},fn:e.program(8,i,0),inverse:e.program(11,i,0),data:i,loc:{start:{line:23,column:0},end:{line:87,column:11}}})??``)},useData:!0},Ne={compiler:[8,`>= 4.3.0`],main:function(e,t,n,r,i){return`export const getHeaders = <T>(config: OpenAPIConfig, options: ApiRequestOptions<T>): Observable<HttpHeaders> => {
|
|
86
85
|
return forkJoin({
|
|
87
86
|
// @ts-ignore
|
|
88
87
|
token: resolve(options, config.TOKEN),
|
|
@@ -129,7 +128,7 @@ export class `+((s=i(a(l(l(r,"root"),"$config"),"name",{start:{line:57,column:16
|
|
|
129
128
|
return new HttpHeaders(headers);
|
|
130
129
|
}),
|
|
131
130
|
);
|
|
132
|
-
};`},useData
|
|
131
|
+
};`},useData:!0},Pe={compiler:[8,`>= 4.3.0`],main:function(e,t,n,r,i){return`export const getRequestBody = (options: ApiRequestOptions): unknown => {
|
|
133
132
|
if (options.body) {
|
|
134
133
|
if (options.mediaType?.includes('application/json') || options.mediaType?.includes('+json')) {
|
|
135
134
|
return JSON.stringify(options.body);
|
|
@@ -140,12 +139,12 @@ export class `+((s=i(a(l(l(r,"root"),"$config"),"name",{start:{line:57,column:16
|
|
|
140
139
|
}
|
|
141
140
|
}
|
|
142
141
|
return undefined;
|
|
143
|
-
};`},useData
|
|
142
|
+
};`},useData:!0},Fe={compiler:[8,`>= 4.3.0`],main:function(e,t,n,r,i){return`export const getResponseBody = <T>(response: HttpResponse<T>): T | undefined => {
|
|
144
143
|
if (response.status !== 204 && response.body !== null) {
|
|
145
144
|
return response.body;
|
|
146
145
|
}
|
|
147
146
|
return undefined;
|
|
148
|
-
};`},useData
|
|
147
|
+
};`},useData:!0},Ie={compiler:[8,`>= 4.3.0`],main:function(e,t,n,r,i){return`export const getResponseHeader = <T>(response: HttpResponse<T>, responseHeader?: string): string | undefined => {
|
|
149
148
|
if (responseHeader) {
|
|
150
149
|
const value = response.headers.get(responseHeader);
|
|
151
150
|
if (isString(value)) {
|
|
@@ -153,7 +152,7 @@ export class `+((s=i(a(l(l(r,"root"),"$config"),"name",{start:{line:57,column:16
|
|
|
153
152
|
}
|
|
154
153
|
}
|
|
155
154
|
return undefined;
|
|
156
|
-
};`},useData
|
|
155
|
+
};`},useData:!0},Le={compiler:[8,`>= 4.3.0`],main:function(e,t,n,r,i){var a=e.lookupProperty||function(e,t){if(Object.prototype.hasOwnProperty.call(e,t))return e[t]};return`import { HttpClient, HttpHeaders } from '@angular/common/http';
|
|
157
156
|
import type { HttpResponse, HttpErrorResponse } from '@angular/common/http';
|
|
158
157
|
import { forkJoin, of, throwError } from 'rxjs';
|
|
159
158
|
import { catchError, map, switchMap } from 'rxjs/operators';
|
|
@@ -164,35 +163,35 @@ import type { ApiRequestOptions } from './ApiRequestOptions';
|
|
|
164
163
|
import type { ApiResult } from './ApiResult';
|
|
165
164
|
import type { OpenAPIConfig } from './OpenAPI';
|
|
166
165
|
|
|
167
|
-
`+(
|
|
166
|
+
`+(e.invokePartial(a(r,`functions/isString`),t,{name:`functions/isString`,data:i,helpers:n,partials:r,decorators:e.decorators})??``)+`
|
|
168
167
|
|
|
169
|
-
`+(
|
|
168
|
+
`+(e.invokePartial(a(r,`functions/isStringWithValue`),t,{name:`functions/isStringWithValue`,data:i,helpers:n,partials:r,decorators:e.decorators})??``)+`
|
|
170
169
|
|
|
171
|
-
`+(
|
|
170
|
+
`+(e.invokePartial(a(r,`functions/isBlob`),t,{name:`functions/isBlob`,data:i,helpers:n,partials:r,decorators:e.decorators})??``)+`
|
|
172
171
|
|
|
173
|
-
`+(
|
|
172
|
+
`+(e.invokePartial(a(r,`functions/isFormData`),t,{name:`functions/isFormData`,data:i,helpers:n,partials:r,decorators:e.decorators})??``)+`
|
|
174
173
|
|
|
175
|
-
`+(
|
|
174
|
+
`+(e.invokePartial(a(r,`functions/base64`),t,{name:`functions/base64`,data:i,helpers:n,partials:r,decorators:e.decorators})??``)+`
|
|
176
175
|
|
|
177
|
-
`+(
|
|
176
|
+
`+(e.invokePartial(a(r,`functions/getQueryString`),t,{name:`functions/getQueryString`,data:i,helpers:n,partials:r,decorators:e.decorators})??``)+`
|
|
178
177
|
|
|
179
|
-
`+(
|
|
178
|
+
`+(e.invokePartial(a(r,`functions/getUrl`),t,{name:`functions/getUrl`,data:i,helpers:n,partials:r,decorators:e.decorators})??``)+`
|
|
180
179
|
|
|
181
|
-
`+(
|
|
180
|
+
`+(e.invokePartial(a(r,`functions/getFormData`),t,{name:`functions/getFormData`,data:i,helpers:n,partials:r,decorators:e.decorators})??``)+`
|
|
182
181
|
|
|
183
|
-
`+(
|
|
182
|
+
`+(e.invokePartial(a(r,`functions/resolve`),t,{name:`functions/resolve`,data:i,helpers:n,partials:r,decorators:e.decorators})??``)+`
|
|
184
183
|
|
|
185
|
-
`+(
|
|
184
|
+
`+(e.invokePartial(a(r,`angular/getHeaders`),t,{name:`angular/getHeaders`,data:i,helpers:n,partials:r,decorators:e.decorators})??``)+`
|
|
186
185
|
|
|
187
|
-
`+(
|
|
186
|
+
`+(e.invokePartial(a(r,`angular/getRequestBody`),t,{name:`angular/getRequestBody`,data:i,helpers:n,partials:r,decorators:e.decorators})??``)+`
|
|
188
187
|
|
|
189
|
-
`+(
|
|
188
|
+
`+(e.invokePartial(a(r,`angular/sendRequest`),t,{name:`angular/sendRequest`,data:i,helpers:n,partials:r,decorators:e.decorators})??``)+`
|
|
190
189
|
|
|
191
|
-
`+(
|
|
190
|
+
`+(e.invokePartial(a(r,`angular/getResponseHeader`),t,{name:`angular/getResponseHeader`,data:i,helpers:n,partials:r,decorators:e.decorators})??``)+`
|
|
192
191
|
|
|
193
|
-
`+(
|
|
192
|
+
`+(e.invokePartial(a(r,`angular/getResponseBody`),t,{name:`angular/getResponseBody`,data:i,helpers:n,partials:r,decorators:e.decorators})??``)+`
|
|
194
193
|
|
|
195
|
-
`+(
|
|
194
|
+
`+(e.invokePartial(a(r,`functions/catchErrorCodes`),t,{name:`functions/catchErrorCodes`,data:i,helpers:n,partials:r,decorators:e.decorators})??``)+`
|
|
196
195
|
|
|
197
196
|
/**
|
|
198
197
|
* Request method
|
|
@@ -251,7 +250,7 @@ export const request = <T>(config: OpenAPIConfig, http: HttpClient, options: Api
|
|
|
251
250
|
return throwError(() => error);
|
|
252
251
|
}),
|
|
253
252
|
);
|
|
254
|
-
};`},usePartial
|
|
253
|
+
};`},usePartial:!0,useData:!0},Re={compiler:[8,`>= 4.3.0`],main:function(e,t,n,r,i){return`export const sendRequest = <T>(
|
|
255
254
|
config: OpenAPIConfig,
|
|
256
255
|
options: ApiRequestOptions<T>,
|
|
257
256
|
http: HttpClient,
|
|
@@ -266,7 +265,7 @@ export const request = <T>(config: OpenAPIConfig, http: HttpClient, options: Api
|
|
|
266
265
|
withCredentials: config.WITH_CREDENTIALS,
|
|
267
266
|
observe: 'response',
|
|
268
267
|
});
|
|
269
|
-
};`},useData
|
|
268
|
+
};`},useData:!0},ze={compiler:[8,`>= 4.3.0`],main:function(e,t,n,r,i){return`import type { ApiRequestOptions } from './ApiRequestOptions';
|
|
270
269
|
import type { ApiResult } from './ApiResult';
|
|
271
270
|
|
|
272
271
|
export class ApiError extends Error {
|
|
@@ -286,7 +285,7 @@ export class ApiError extends Error {
|
|
|
286
285
|
this.body = response.body;
|
|
287
286
|
this.request = request;
|
|
288
287
|
}
|
|
289
|
-
}`},useData
|
|
288
|
+
}`},useData:!0},Be={compiler:[8,`>= 4.3.0`],main:function(e,t,n,r,i){return`export type ApiRequestOptions<T = unknown> = {
|
|
290
289
|
readonly body?: any;
|
|
291
290
|
readonly cookies?: Record<string, unknown>;
|
|
292
291
|
readonly errors?: Record<number | string, string>;
|
|
@@ -306,13 +305,13 @@ export class ApiError extends Error {
|
|
|
306
305
|
readonly responseHeader?: string;
|
|
307
306
|
readonly responseTransformer?: (data: unknown) => Promise<T>;
|
|
308
307
|
readonly url: string;
|
|
309
|
-
};`},useData
|
|
308
|
+
};`},useData:!0},Ve={compiler:[8,`>= 4.3.0`],main:function(e,t,n,r,i){return`export type ApiResult<TData = any> = {
|
|
310
309
|
readonly body: TData;
|
|
311
310
|
readonly ok: boolean;
|
|
312
311
|
readonly status: number;
|
|
313
312
|
readonly statusText: string;
|
|
314
313
|
readonly url: string;
|
|
315
|
-
};`},useData
|
|
314
|
+
};`},useData:!0},He={compiler:[8,`>= 4.3.0`],main:function(e,t,n,r,i){return`export const getHeaders = async <T>(config: OpenAPIConfig, options: ApiRequestOptions<T>): Promise<Record<string, string>> => {
|
|
316
315
|
const [token, username, password, additionalHeaders] = await Promise.all([
|
|
317
316
|
// @ts-ignore
|
|
318
317
|
resolve(options, config.TOKEN),
|
|
@@ -361,17 +360,17 @@ export class ApiError extends Error {
|
|
|
361
360
|
}
|
|
362
361
|
|
|
363
362
|
return headers;
|
|
364
|
-
};`},useData
|
|
363
|
+
};`},useData:!0},Ue={compiler:[8,`>= 4.3.0`],main:function(e,t,n,r,i){return`export const getRequestBody = (options: ApiRequestOptions): unknown => {
|
|
365
364
|
if (options.body) {
|
|
366
365
|
return options.body;
|
|
367
366
|
}
|
|
368
367
|
return undefined;
|
|
369
|
-
};`},useData
|
|
368
|
+
};`},useData:!0},We={compiler:[8,`>= 4.3.0`],main:function(e,t,n,r,i){return`export const getResponseBody = (response: AxiosResponse<unknown>): unknown => {
|
|
370
369
|
if (response.status !== 204) {
|
|
371
370
|
return response.data;
|
|
372
371
|
}
|
|
373
372
|
return undefined;
|
|
374
|
-
};`},useData
|
|
373
|
+
};`},useData:!0},Ge={compiler:[8,`>= 4.3.0`],main:function(e,t,n,r,i){return`export const getResponseHeader = (response: AxiosResponse<unknown>, responseHeader?: string): string | undefined => {
|
|
375
374
|
if (responseHeader) {
|
|
376
375
|
const content = response.headers[responseHeader];
|
|
377
376
|
if (isString(content)) {
|
|
@@ -379,7 +378,7 @@ export class ApiError extends Error {
|
|
|
379
378
|
}
|
|
380
379
|
}
|
|
381
380
|
return undefined;
|
|
382
|
-
};`},useData
|
|
381
|
+
};`},useData:!0},Ke={1:function(e,t,n,r,i){return`ApiResult<T>`},3:function(e,t,n,r,i){return`T`},5:function(e,t,n,r,i){return`result.body`},7:function(e,t,n,r,i){return`result`},compiler:[8,`>= 4.3.0`],main:function(e,t,n,r,i){var a=t??(e.nullContext||{}),o=e.lookupProperty||function(e,t){if(Object.prototype.hasOwnProperty.call(e,t))return e[t]};return`import axios from 'axios';
|
|
383
382
|
import type { AxiosError, AxiosRequestConfig, AxiosResponse, AxiosInstance } from 'axios';
|
|
384
383
|
|
|
385
384
|
import { ApiError } from './ApiError';
|
|
@@ -389,47 +388,47 @@ import { CancelablePromise } from './CancelablePromise';
|
|
|
389
388
|
import type { OnCancel } from './CancelablePromise';
|
|
390
389
|
import type { OpenAPIConfig } from './OpenAPI';
|
|
391
390
|
|
|
392
|
-
`+(
|
|
391
|
+
`+(e.invokePartial(o(r,`functions/isString`),t,{name:`functions/isString`,data:i,helpers:n,partials:r,decorators:e.decorators})??``)+`
|
|
393
392
|
|
|
394
|
-
`+(
|
|
393
|
+
`+(e.invokePartial(o(r,`functions/isStringWithValue`),t,{name:`functions/isStringWithValue`,data:i,helpers:n,partials:r,decorators:e.decorators})??``)+`
|
|
395
394
|
|
|
396
|
-
`+(
|
|
395
|
+
`+(e.invokePartial(o(r,`functions/isBlob`),t,{name:`functions/isBlob`,data:i,helpers:n,partials:r,decorators:e.decorators})??``)+`
|
|
397
396
|
|
|
398
|
-
`+(
|
|
397
|
+
`+(e.invokePartial(o(r,`functions/isFormData`),t,{name:`functions/isFormData`,data:i,helpers:n,partials:r,decorators:e.decorators})??``)+`
|
|
399
398
|
|
|
400
|
-
`+(
|
|
399
|
+
`+(e.invokePartial(o(r,`functions/isSuccess`),t,{name:`functions/isSuccess`,data:i,helpers:n,partials:r,decorators:e.decorators})??``)+`
|
|
401
400
|
|
|
402
|
-
`+(
|
|
401
|
+
`+(e.invokePartial(o(r,`functions/base64`),t,{name:`functions/base64`,data:i,helpers:n,partials:r,decorators:e.decorators})??``)+`
|
|
403
402
|
|
|
404
|
-
`+(
|
|
403
|
+
`+(e.invokePartial(o(r,`functions/getQueryString`),t,{name:`functions/getQueryString`,data:i,helpers:n,partials:r,decorators:e.decorators})??``)+`
|
|
405
404
|
|
|
406
|
-
`+(
|
|
405
|
+
`+(e.invokePartial(o(r,`functions/getUrl`),t,{name:`functions/getUrl`,data:i,helpers:n,partials:r,decorators:e.decorators})??``)+`
|
|
407
406
|
|
|
408
|
-
`+(
|
|
407
|
+
`+(e.invokePartial(o(r,`functions/getFormData`),t,{name:`functions/getFormData`,data:i,helpers:n,partials:r,decorators:e.decorators})??``)+`
|
|
409
408
|
|
|
410
|
-
`+(
|
|
409
|
+
`+(e.invokePartial(o(r,`functions/resolve`),t,{name:`functions/resolve`,data:i,helpers:n,partials:r,decorators:e.decorators})??``)+`
|
|
411
410
|
|
|
412
|
-
`+(
|
|
411
|
+
`+(e.invokePartial(o(r,`axios/getHeaders`),t,{name:`axios/getHeaders`,data:i,helpers:n,partials:r,decorators:e.decorators})??``)+`
|
|
413
412
|
|
|
414
|
-
`+(
|
|
413
|
+
`+(e.invokePartial(o(r,`axios/getRequestBody`),t,{name:`axios/getRequestBody`,data:i,helpers:n,partials:r,decorators:e.decorators})??``)+`
|
|
415
414
|
|
|
416
|
-
`+(
|
|
415
|
+
`+(e.invokePartial(o(r,`axios/sendRequest`),t,{name:`axios/sendRequest`,data:i,helpers:n,partials:r,decorators:e.decorators})??``)+`
|
|
417
416
|
|
|
418
|
-
`+(
|
|
417
|
+
`+(e.invokePartial(o(r,`axios/getResponseHeader`),t,{name:`axios/getResponseHeader`,data:i,helpers:n,partials:r,decorators:e.decorators})??``)+`
|
|
419
418
|
|
|
420
|
-
`+(
|
|
419
|
+
`+(e.invokePartial(o(r,`axios/getResponseBody`),t,{name:`axios/getResponseBody`,data:i,helpers:n,partials:r,decorators:e.decorators})??``)+`
|
|
421
420
|
|
|
422
|
-
`+(
|
|
421
|
+
`+(e.invokePartial(o(r,`functions/catchErrorCodes`),t,{name:`functions/catchErrorCodes`,data:i,helpers:n,partials:r,decorators:e.decorators})??``)+`
|
|
423
422
|
|
|
424
423
|
/**
|
|
425
424
|
* Request method
|
|
426
425
|
* @param config The OpenAPI configuration object
|
|
427
426
|
* @param options The request options from the service
|
|
428
427
|
* @param axiosClient The axios client instance to use
|
|
429
|
-
* @returns CancelablePromise<`+((
|
|
428
|
+
* @returns CancelablePromise<`+(o(n,`ifServicesResponse`).call(a,`response`,{name:`ifServicesResponse`,hash:{},fn:e.program(1,i,0),inverse:e.program(3,i,0),data:i,loc:{start:{line:64,column:30},end:{line:64,column:108}}})??``)+`>
|
|
430
429
|
* @throws ApiError
|
|
431
430
|
*/
|
|
432
|
-
export const request = <T>(config: OpenAPIConfig, options: ApiRequestOptions<T>, axiosClient: AxiosInstance = axios): CancelablePromise<`+((
|
|
431
|
+
export const request = <T>(config: OpenAPIConfig, options: ApiRequestOptions<T>, axiosClient: AxiosInstance = axios): CancelablePromise<`+(o(n,`ifServicesResponse`).call(a,`response`,{name:`ifServicesResponse`,hash:{},fn:e.program(1,i,0),inverse:e.program(3,i,0),data:i,loc:{start:{line:67,column:136},end:{line:67,column:214}}})??``)+`> => {
|
|
433
432
|
return new CancelablePromise(async (resolve, reject, onCancel) => {
|
|
434
433
|
try {
|
|
435
434
|
const url = getUrl(config, options);
|
|
@@ -462,13 +461,13 @@ export const request = <T>(config: OpenAPIConfig, options: ApiRequestOptions<T>,
|
|
|
462
461
|
|
|
463
462
|
catchErrorCodes(options, result);
|
|
464
463
|
|
|
465
|
-
resolve(`+((
|
|
464
|
+
resolve(`+(o(n,`ifServicesResponse`).call(a,`body`,{name:`ifServicesResponse`,hash:{},fn:e.program(5,i,0),inverse:e.program(7,i,0),data:i,loc:{start:{line:100,column:12},end:{line:100,column:90}}})??``)+`);
|
|
466
465
|
}
|
|
467
466
|
} catch (error) {
|
|
468
467
|
reject(error);
|
|
469
468
|
}
|
|
470
469
|
});
|
|
471
|
-
};`},usePartial
|
|
470
|
+
};`},usePartial:!0,useData:!0},qe={compiler:[8,`>= 4.3.0`],main:function(e,t,n,r,i){return`export const sendRequest = async <T>(
|
|
472
471
|
config: OpenAPIConfig,
|
|
473
472
|
options: ApiRequestOptions<T>,
|
|
474
473
|
url: string,
|
|
@@ -504,26 +503,26 @@ export const request = <T>(config: OpenAPIConfig, options: ApiRequestOptions<T>,
|
|
|
504
503
|
}
|
|
505
504
|
throw error;
|
|
506
505
|
}
|
|
507
|
-
};`},useData
|
|
506
|
+
};`},useData:!0},Je={1:function(e,t,n,r,i){return`import type { HttpClient } from '@angular/common/http';
|
|
508
507
|
import type { Observable } from 'rxjs';
|
|
509
508
|
|
|
510
509
|
import type { ApiRequestOptions } from './ApiRequestOptions';
|
|
511
510
|
import type { OpenAPIConfig } from './OpenAPI';
|
|
512
|
-
`},3:function(e,n,
|
|
511
|
+
`},3:function(e,t,n,r,i){return`import type { ApiRequestOptions } from './ApiRequestOptions';
|
|
513
512
|
import type { CancelablePromise } from './CancelablePromise';
|
|
514
513
|
import type { OpenAPIConfig } from './OpenAPI';
|
|
515
|
-
`},5:function(e,n,
|
|
514
|
+
`},5:function(e,t,n,r,i){return` constructor(
|
|
516
515
|
public readonly config: OpenAPIConfig,
|
|
517
516
|
public readonly http: HttpClient,
|
|
518
517
|
) {}
|
|
519
|
-
`},7:function(e,n,
|
|
520
|
-
`},9:function(e,n,
|
|
521
|
-
`},11:function(e,n,
|
|
522
|
-
`},compiler:[8
|
|
518
|
+
`},7:function(e,t,n,r,i){return` constructor(public readonly config: OpenAPIConfig) {}
|
|
519
|
+
`},9:function(e,t,n,r,i){return` public abstract request<T>(options: ApiRequestOptions<T>): Observable<T>;
|
|
520
|
+
`},11:function(e,t,n,r,i){return` public abstract request<T>(options: ApiRequestOptions<T>): CancelablePromise<T>;
|
|
521
|
+
`},compiler:[8,`>= 4.3.0`],main:function(e,t,n,r,i){var a=t??(e.nullContext||{}),o=e.lookupProperty||function(e,t){if(Object.prototype.hasOwnProperty.call(e,t))return e[t]};return(o(n,`equals`).call(a,o(o(o(o(i,`root`),`$config`),`client`),`name`),`legacy/angular`,{name:`equals`,hash:{},fn:e.program(1,i,0),inverse:e.program(3,i,0),data:i,loc:{start:{line:1,column:0},end:{line:11,column:11}}})??``)+`
|
|
523
522
|
export abstract class BaseHttpRequest {
|
|
524
523
|
|
|
525
|
-
`+((
|
|
526
|
-
`+((
|
|
524
|
+
`+(o(n,`equals`).call(a,o(o(o(o(i,`root`),`$config`),`client`),`name`),`legacy/angular`,{name:`equals`,hash:{},fn:e.program(5,i,0),inverse:e.program(7,i,0),data:i,loc:{start:{line:15,column:1},end:{line:22,column:12}}})??``)+`
|
|
525
|
+
`+(o(n,`equals`).call(a,o(o(o(o(i,`root`),`$config`),`client`),`name`),`legacy/angular`,{name:`equals`,hash:{},fn:e.program(9,i,0),inverse:e.program(11,i,0),data:i,loc:{start:{line:24,column:1},end:{line:28,column:12}}})??``)+`}`},useData:!0},Ye={compiler:[8,`>= 4.3.0`],main:function(e,t,n,r,i){return`export class CancelError extends Error {
|
|
527
526
|
constructor(message: string) {
|
|
528
527
|
super(message);
|
|
529
528
|
this.name = 'CancelError';
|
|
@@ -648,7 +647,7 @@ export class CancelablePromise<T> implements Promise<T> {
|
|
|
648
647
|
public get isCancelled(): boolean {
|
|
649
648
|
return this._isCancelled;
|
|
650
649
|
}
|
|
651
|
-
}`},useData
|
|
650
|
+
}`},useData:!0},Xe={compiler:[8,`>= 4.3.0`],main:function(e,t,n,r,i){return`export const getHeaders = async <T>(config: OpenAPIConfig, options: ApiRequestOptions<T>): Promise<Headers> => {
|
|
652
651
|
const [token, username, password, additionalHeaders] = await Promise.all([
|
|
653
652
|
// @ts-ignore
|
|
654
653
|
resolve(options, config.TOKEN),
|
|
@@ -693,7 +692,7 @@ export class CancelablePromise<T> implements Promise<T> {
|
|
|
693
692
|
}
|
|
694
693
|
|
|
695
694
|
return new Headers(headers);
|
|
696
|
-
};`},useData
|
|
695
|
+
};`},useData:!0},Ze={compiler:[8,`>= 4.3.0`],main:function(e,t,n,r,i){return`export const getRequestBody = (options: ApiRequestOptions): unknown => {
|
|
697
696
|
if (options.body !== undefined) {
|
|
698
697
|
if (options.mediaType?.includes('application/json') || options.mediaType?.includes('+json')) {
|
|
699
698
|
return JSON.stringify(options.body);
|
|
@@ -704,7 +703,7 @@ export class CancelablePromise<T> implements Promise<T> {
|
|
|
704
703
|
}
|
|
705
704
|
}
|
|
706
705
|
return undefined;
|
|
707
|
-
};`},useData
|
|
706
|
+
};`},useData:!0},Qe={compiler:[8,`>= 4.3.0`],main:function(e,t,n,r,i){return`export const getResponseBody = async (response: Response): Promise<unknown> => {
|
|
708
707
|
if (response.status !== 204) {
|
|
709
708
|
try {
|
|
710
709
|
const contentType = response.headers.get('Content-Type');
|
|
@@ -725,7 +724,7 @@ export class CancelablePromise<T> implements Promise<T> {
|
|
|
725
724
|
}
|
|
726
725
|
}
|
|
727
726
|
return undefined;
|
|
728
|
-
};`},useData
|
|
727
|
+
};`},useData:!0},$e={compiler:[8,`>= 4.3.0`],main:function(e,t,n,r,i){return`export const getResponseHeader = (response: Response, responseHeader?: string): string | undefined => {
|
|
729
728
|
if (responseHeader) {
|
|
730
729
|
const content = response.headers.get(responseHeader);
|
|
731
730
|
if (isString(content)) {
|
|
@@ -733,54 +732,54 @@ export class CancelablePromise<T> implements Promise<T> {
|
|
|
733
732
|
}
|
|
734
733
|
}
|
|
735
734
|
return undefined;
|
|
736
|
-
};`},useData
|
|
735
|
+
};`},useData:!0},et={1:function(e,t,n,r,i){return`import fetch, { FormData, Headers } from 'node-fetch';
|
|
737
736
|
import type { RequestInit, Response } from 'node-fetch';
|
|
738
737
|
|
|
739
|
-
`},3:function(e,n,
|
|
738
|
+
`},3:function(e,t,n,r,i){return`ApiResult<T>`},5:function(e,t,n,r,i){return`T`},7:function(e,t,n,r,i){return`result.body`},9:function(e,t,n,r,i){return`result`},compiler:[8,`>= 4.3.0`],main:function(e,t,n,r,i){var a=t??(e.nullContext||{}),o=e.lookupProperty||function(e,t){if(Object.prototype.hasOwnProperty.call(e,t))return e[t]};return(o(n,`equals`).call(a,o(o(o(o(i,`root`),`$config`),`client`),`name`),`legacy/node`,{name:`equals`,hash:{},fn:e.program(1,i,0),inverse:e.noop,data:i,loc:{start:{line:1,column:0},end:{line:5,column:11}}})??``)+`import { ApiError } from './ApiError';
|
|
740
739
|
import type { ApiRequestOptions } from './ApiRequestOptions';
|
|
741
740
|
import type { ApiResult } from './ApiResult';
|
|
742
741
|
import { CancelablePromise } from './CancelablePromise';
|
|
743
742
|
import type { OnCancel } from './CancelablePromise';
|
|
744
743
|
import type { OpenAPIConfig } from './OpenAPI';
|
|
745
744
|
|
|
746
|
-
`+(
|
|
745
|
+
`+(e.invokePartial(o(r,`functions/isString`),t,{name:`functions/isString`,data:i,helpers:n,partials:r,decorators:e.decorators})??``)+`
|
|
747
746
|
|
|
748
|
-
`+(
|
|
747
|
+
`+(e.invokePartial(o(r,`functions/isStringWithValue`),t,{name:`functions/isStringWithValue`,data:i,helpers:n,partials:r,decorators:e.decorators})??``)+`
|
|
749
748
|
|
|
750
|
-
`+(
|
|
749
|
+
`+(e.invokePartial(o(r,`functions/isBlob`),t,{name:`functions/isBlob`,data:i,helpers:n,partials:r,decorators:e.decorators})??``)+`
|
|
751
750
|
|
|
752
|
-
`+(
|
|
751
|
+
`+(e.invokePartial(o(r,`functions/isFormData`),t,{name:`functions/isFormData`,data:i,helpers:n,partials:r,decorators:e.decorators})??``)+`
|
|
753
752
|
|
|
754
|
-
`+(
|
|
753
|
+
`+(e.invokePartial(o(r,`functions/base64`),t,{name:`functions/base64`,data:i,helpers:n,partials:r,decorators:e.decorators})??``)+`
|
|
755
754
|
|
|
756
|
-
`+(
|
|
755
|
+
`+(e.invokePartial(o(r,`functions/getQueryString`),t,{name:`functions/getQueryString`,data:i,helpers:n,partials:r,decorators:e.decorators})??``)+`
|
|
757
756
|
|
|
758
|
-
`+(
|
|
757
|
+
`+(e.invokePartial(o(r,`functions/getUrl`),t,{name:`functions/getUrl`,data:i,helpers:n,partials:r,decorators:e.decorators})??``)+`
|
|
759
758
|
|
|
760
|
-
`+(
|
|
759
|
+
`+(e.invokePartial(o(r,`functions/getFormData`),t,{name:`functions/getFormData`,data:i,helpers:n,partials:r,decorators:e.decorators})??``)+`
|
|
761
760
|
|
|
762
|
-
`+(
|
|
761
|
+
`+(e.invokePartial(o(r,`functions/resolve`),t,{name:`functions/resolve`,data:i,helpers:n,partials:r,decorators:e.decorators})??``)+`
|
|
763
762
|
|
|
764
|
-
`+(
|
|
763
|
+
`+(e.invokePartial(o(r,`fetch/getHeaders`),t,{name:`fetch/getHeaders`,data:i,helpers:n,partials:r,decorators:e.decorators})??``)+`
|
|
765
764
|
|
|
766
|
-
`+(
|
|
765
|
+
`+(e.invokePartial(o(r,`fetch/getRequestBody`),t,{name:`fetch/getRequestBody`,data:i,helpers:n,partials:r,decorators:e.decorators})??``)+`
|
|
767
766
|
|
|
768
|
-
`+(
|
|
767
|
+
`+(e.invokePartial(o(r,`fetch/sendRequest`),t,{name:`fetch/sendRequest`,data:i,helpers:n,partials:r,decorators:e.decorators})??``)+`
|
|
769
768
|
|
|
770
|
-
`+(
|
|
769
|
+
`+(e.invokePartial(o(r,`fetch/getResponseHeader`),t,{name:`fetch/getResponseHeader`,data:i,helpers:n,partials:r,decorators:e.decorators})??``)+`
|
|
771
770
|
|
|
772
|
-
`+(
|
|
771
|
+
`+(e.invokePartial(o(r,`fetch/getResponseBody`),t,{name:`fetch/getResponseBody`,data:i,helpers:n,partials:r,decorators:e.decorators})??``)+`
|
|
773
772
|
|
|
774
|
-
`+(
|
|
773
|
+
`+(e.invokePartial(o(r,`functions/catchErrorCodes`),t,{name:`functions/catchErrorCodes`,data:i,helpers:n,partials:r,decorators:e.decorators})??``)+`
|
|
775
774
|
|
|
776
775
|
/**
|
|
777
776
|
* Request method
|
|
778
777
|
* @param config The OpenAPI configuration object
|
|
779
778
|
* @param options The request options from the service
|
|
780
|
-
* @returns CancelablePromise<`+((
|
|
779
|
+
* @returns CancelablePromise<`+(o(n,`ifServicesResponse`).call(a,`response`,{name:`ifServicesResponse`,hash:{},fn:e.program(3,i,0),inverse:e.program(5,i,0),data:i,loc:{start:{line:62,column:30},end:{line:62,column:108}}})??``)+`>
|
|
781
780
|
* @throws ApiError
|
|
782
781
|
*/
|
|
783
|
-
export const request = <T>(config: OpenAPIConfig, options: ApiRequestOptions<T>): CancelablePromise<`+((
|
|
782
|
+
export const request = <T>(config: OpenAPIConfig, options: ApiRequestOptions<T>): CancelablePromise<`+(o(n,`ifServicesResponse`).call(a,`response`,{name:`ifServicesResponse`,hash:{},fn:e.program(3,i,0),inverse:e.program(5,i,0),data:i,loc:{start:{line:65,column:100},end:{line:65,column:178}}})??``)+`> => {
|
|
784
783
|
return new CancelablePromise(async (resolve, reject, onCancel) => {
|
|
785
784
|
try {
|
|
786
785
|
const url = getUrl(config, options);
|
|
@@ -813,16 +812,16 @@ export const request = <T>(config: OpenAPIConfig, options: ApiRequestOptions<T>)
|
|
|
813
812
|
|
|
814
813
|
catchErrorCodes(options, result);
|
|
815
814
|
|
|
816
|
-
resolve(`+((
|
|
815
|
+
resolve(`+(o(n,`ifServicesResponse`).call(a,`body`,{name:`ifServicesResponse`,hash:{},fn:e.program(7,i,0),inverse:e.program(9,i,0),data:i,loc:{start:{line:98,column:12},end:{line:98,column:90}}})??``)+`);
|
|
817
816
|
}
|
|
818
817
|
} catch (error) {
|
|
819
818
|
reject(error);
|
|
820
819
|
}
|
|
821
820
|
});
|
|
822
|
-
};`},usePartial
|
|
821
|
+
};`},usePartial:!0,useData:!0},tt={1:function(e,t,n,r,i){return` if (config.WITH_CREDENTIALS) {
|
|
823
822
|
request.credentials = config.CREDENTIALS;
|
|
824
823
|
}
|
|
825
|
-
`},compiler:[8
|
|
824
|
+
`},compiler:[8,`>= 4.3.0`],main:function(e,t,n,r,i){var a=e.lookupProperty||function(e,t){if(Object.prototype.hasOwnProperty.call(e,t))return e[t]};return`export const sendRequest = async (
|
|
826
825
|
config: OpenAPIConfig,
|
|
827
826
|
options: ApiRequestOptions,
|
|
828
827
|
url: string,
|
|
@@ -840,7 +839,7 @@ export const request = <T>(config: OpenAPIConfig, options: ApiRequestOptions<T>)
|
|
|
840
839
|
signal: controller.signal,
|
|
841
840
|
};
|
|
842
841
|
|
|
843
|
-
`+(
|
|
842
|
+
`+(a(n,`equals`).call(t??(e.nullContext||{}),a(a(a(a(i,`root`),`$config`),`client`),`name`),`legacy/fetch`,{name:`equals`,hash:{},fn:e.program(1,i,0),inverse:e.noop,data:i,loc:{start:{line:19,column:1},end:{line:23,column:12}}})??``)+`
|
|
844
843
|
for (const fn of config.interceptors.request._fns) {
|
|
845
844
|
request = await fn(request);
|
|
846
845
|
}
|
|
@@ -848,14 +847,14 @@ export const request = <T>(config: OpenAPIConfig, options: ApiRequestOptions<T>)
|
|
|
848
847
|
onCancel(() => controller.abort());
|
|
849
848
|
|
|
850
849
|
return await fetch(url, request);
|
|
851
|
-
};`},useData
|
|
850
|
+
};`},useData:!0},nt={compiler:[8,`>= 4.3.0`],main:function(e,t,n,r,i){return`export const base64 = (str: string): string => {
|
|
852
851
|
try {
|
|
853
852
|
return btoa(str);
|
|
854
853
|
} catch (err) {
|
|
855
854
|
// @ts-ignore
|
|
856
855
|
return Buffer.from(str).toString('base64');
|
|
857
856
|
}
|
|
858
|
-
};`},useData
|
|
857
|
+
};`},useData:!0},rt={compiler:[8,`>= 4.3.0`],main:function(e,t,n,r,i){return`export const catchErrorCodes = (options: ApiRequestOptions, result: ApiResult): void => {
|
|
859
858
|
const errors: Record<number, string> = {
|
|
860
859
|
400: 'Bad Request',
|
|
861
860
|
401: 'Unauthorized',
|
|
@@ -920,7 +919,7 @@ export const request = <T>(config: OpenAPIConfig, options: ApiRequestOptions<T>)
|
|
|
920
919
|
\`Generic Error: status: \${errorStatus}; status text: \${errorStatusText}; body: \${errorBody}\`
|
|
921
920
|
);
|
|
922
921
|
}
|
|
923
|
-
};`},useData
|
|
922
|
+
};`},useData:!0},it={compiler:[8,`>= 4.3.0`],main:function(e,t,n,r,i){return`export const getFormData = (options: ApiRequestOptions): FormData | undefined => {
|
|
924
923
|
if (options.formData) {
|
|
925
924
|
const formData = new FormData();
|
|
926
925
|
|
|
@@ -945,7 +944,7 @@ export const request = <T>(config: OpenAPIConfig, options: ApiRequestOptions<T>)
|
|
|
945
944
|
return formData;
|
|
946
945
|
}
|
|
947
946
|
return undefined;
|
|
948
|
-
};`},useData
|
|
947
|
+
};`},useData:!0},at={compiler:[8,`>= 4.3.0`],main:function(e,t,n,r,i){return`export const getQueryString = (params: Record<string, unknown>): string => {
|
|
949
948
|
const qs: string[] = [];
|
|
950
949
|
|
|
951
950
|
const append = (key: string, value: unknown) => {
|
|
@@ -971,7 +970,7 @@ export const request = <T>(config: OpenAPIConfig, options: ApiRequestOptions<T>)
|
|
|
971
970
|
Object.entries(params).forEach(([key, value]) => encodePair(key, value));
|
|
972
971
|
|
|
973
972
|
return qs.length ? \`?\${qs.join('&')}\` : '';
|
|
974
|
-
};`},useData
|
|
973
|
+
};`},useData:!0},ot={compiler:[8,`>= 4.3.0`],main:function(e,t,n,r,i){return`const getUrl = (config: OpenAPIConfig, options: ApiRequestOptions): string => {
|
|
975
974
|
const encoder = config.ENCODE_PATH || encodeURI;
|
|
976
975
|
|
|
977
976
|
const path = options.url
|
|
@@ -985,24 +984,24 @@ export const request = <T>(config: OpenAPIConfig, options: ApiRequestOptions<T>)
|
|
|
985
984
|
|
|
986
985
|
const url = config.BASE + path;
|
|
987
986
|
return options.query ? url + getQueryString(options.query) : url;
|
|
988
|
-
};`},useData
|
|
987
|
+
};`},useData:!0},st={compiler:[8,`>= 4.3.0`],main:function(e,t,n,r,i){return`export const isBlob = (value: any): value is Blob => {
|
|
989
988
|
return value instanceof Blob;
|
|
990
|
-
};`},useData
|
|
989
|
+
};`},useData:!0},ct={compiler:[8,`>= 4.3.0`],main:function(e,t,n,r,i){return`export const isFormData = (value: unknown): value is FormData => {
|
|
991
990
|
return value instanceof FormData;
|
|
992
|
-
};`},useData
|
|
991
|
+
};`},useData:!0},lt={compiler:[8,`>= 4.3.0`],main:function(e,t,n,r,i){return`export const isString = (value: unknown): value is string => {
|
|
993
992
|
return typeof value === 'string';
|
|
994
|
-
};`},useData
|
|
993
|
+
};`},useData:!0},ut={compiler:[8,`>= 4.3.0`],main:function(e,t,n,r,i){return`export const isStringWithValue = (value: unknown): value is string => {
|
|
995
994
|
return isString(value) && value !== '';
|
|
996
|
-
};`},useData
|
|
995
|
+
};`},useData:!0},dt={compiler:[8,`>= 4.3.0`],main:function(e,t,n,r,i){return`export const isSuccess = (status: number): boolean => {
|
|
997
996
|
return status >= 200 && status < 300;
|
|
998
|
-
};`},useData
|
|
997
|
+
};`},useData:!0},ft={compiler:[8,`>= 4.3.0`],main:function(e,t,n,r,i){return`type Resolver<T> = (options: ApiRequestOptions<T>) => Promise<T>;
|
|
999
998
|
|
|
1000
999
|
export const resolve = async <T>(options: ApiRequestOptions<T>, resolver?: T | Resolver<T>): Promise<T | undefined> => {
|
|
1001
1000
|
if (typeof resolver === 'function') {
|
|
1002
1001
|
return (resolver as Resolver<T>)(options);
|
|
1003
1002
|
}
|
|
1004
1003
|
return resolver;
|
|
1005
|
-
};`},useData
|
|
1004
|
+
};`},useData:!0},pt={1:function(e,t,n,r,i){return`import { Inject, Injectable } from '@angular/core';
|
|
1006
1005
|
import { HttpClient } from '@angular/common/http';
|
|
1007
1006
|
import type { Observable } from 'rxjs';
|
|
1008
1007
|
|
|
@@ -1011,23 +1010,23 @@ import { BaseHttpRequest } from './BaseHttpRequest';
|
|
|
1011
1010
|
import type { OpenAPIConfig } from './OpenAPI';
|
|
1012
1011
|
import { OpenAPI } from './OpenAPI';
|
|
1013
1012
|
import { request as __request } from './request';
|
|
1014
|
-
`},3:function(e,n,
|
|
1013
|
+
`},3:function(e,t,n,r,i){return`import type { ApiRequestOptions } from './ApiRequestOptions';
|
|
1015
1014
|
import { BaseHttpRequest } from './BaseHttpRequest';
|
|
1016
1015
|
import type { CancelablePromise } from './CancelablePromise';
|
|
1017
1016
|
import type { OpenAPIConfig } from './OpenAPI';
|
|
1018
1017
|
import { request as __request } from './request';
|
|
1019
|
-
`},5:function(e,n,
|
|
1020
|
-
`},7:function(e,n,
|
|
1018
|
+
`},5:function(e,t,n,r,i){return`@Injectable()
|
|
1019
|
+
`},7:function(e,t,n,r,i){return` constructor(
|
|
1021
1020
|
@Inject(OpenAPI)
|
|
1022
1021
|
config: OpenAPIConfig,
|
|
1023
1022
|
http: HttpClient,
|
|
1024
1023
|
) {
|
|
1025
1024
|
super(config, http);
|
|
1026
1025
|
}
|
|
1027
|
-
`},9:function(e,n,
|
|
1026
|
+
`},9:function(e,t,n,r,i){return` constructor(config: OpenAPIConfig) {
|
|
1028
1027
|
super(config);
|
|
1029
1028
|
}
|
|
1030
|
-
`},11:function(e,n,
|
|
1029
|
+
`},11:function(e,t,n,r,i){return` /**
|
|
1031
1030
|
* Request method
|
|
1032
1031
|
* @param options The request options from the service
|
|
1033
1032
|
* @returns Observable<T>
|
|
@@ -1036,7 +1035,7 @@ import { request as __request } from './request';
|
|
|
1036
1035
|
public override request<T>(options: ApiRequestOptions<T>): Observable<T> {
|
|
1037
1036
|
return __request(this.config, this.http, options);
|
|
1038
1037
|
}
|
|
1039
|
-
`},13:function(e,n,
|
|
1038
|
+
`},13:function(e,t,n,r,i){return` /**
|
|
1040
1039
|
* Request method
|
|
1041
1040
|
* @param options The request options from the service
|
|
1042
1041
|
* @returns CancelablePromise<T>
|
|
@@ -1045,22 +1044,22 @@ import { request as __request } from './request';
|
|
|
1045
1044
|
public override request<T>(options: ApiRequestOptions<T>): CancelablePromise<T> {
|
|
1046
1045
|
return __request(this.config, options);
|
|
1047
1046
|
}
|
|
1048
|
-
`},compiler:[8
|
|
1049
|
-
`+((
|
|
1050
|
-
|
|
1051
|
-
`+((
|
|
1052
|
-
`+((
|
|
1053
|
-
`},3:function(e,n,
|
|
1054
|
-
`},5:function(e,n,
|
|
1055
|
-
`},7:function(e,n,
|
|
1056
|
-
`},9:function(e,n,
|
|
1047
|
+
`},compiler:[8,`>= 4.3.0`],main:function(e,t,n,r,i){var a=t??(e.nullContext||{}),o=e.lookupProperty||function(e,t){if(Object.prototype.hasOwnProperty.call(e,t))return e[t]};return(o(n,`equals`).call(a,o(o(o(o(i,`root`),`$config`),`client`),`name`),`legacy/angular`,{name:`equals`,hash:{},fn:e.program(1,i,0),inverse:e.program(3,i,0),data:i,loc:{start:{line:1,column:0},end:{line:17,column:11}}})??``)+`
|
|
1048
|
+
`+(o(n,`equals`).call(a,o(o(o(o(i,`root`),`$config`),`client`),`name`),`legacy/angular`,{name:`equals`,hash:{},fn:e.program(5,i,0),inverse:e.noop,data:i,loc:{start:{line:19,column:0},end:{line:21,column:11}}})??``)+`export class `+(e.lambda(e.strict(t,`httpRequest`,{start:{line:22,column:15},end:{line:22,column:26}}),t)??``)+` extends BaseHttpRequest {
|
|
1049
|
+
|
|
1050
|
+
`+(o(n,`equals`).call(a,o(o(o(o(i,`root`),`$config`),`client`),`name`),`legacy/angular`,{name:`equals`,hash:{},fn:e.program(7,i,0),inverse:e.program(9,i,0),data:i,loc:{start:{line:24,column:1},end:{line:36,column:12}}})??``)+`
|
|
1051
|
+
`+(o(n,`equals`).call(a,o(o(o(o(i,`root`),`$config`),`client`),`name`),`legacy/angular`,{name:`equals`,hash:{},fn:e.program(11,i,0),inverse:e.program(13,i,0),data:i,loc:{start:{line:38,column:1},end:{line:58,column:12}}})??``)+`}`},useData:!0},mt={1:function(e,t,n,r,i){return`import type { HttpResponse } from '@angular/common/http';
|
|
1052
|
+
`},3:function(e,t,n,r,i){return`import type { AxiosRequestConfig, AxiosResponse } from 'axios';
|
|
1053
|
+
`},5:function(e,t,n,r,i){return`import type { RequestInit, Response } from 'node-fetch';
|
|
1054
|
+
`},7:function(e,t,n,r,i){return` response: Interceptors<HttpResponse<any>>;
|
|
1055
|
+
`},9:function(e,t,n,r,i){return` request: Interceptors<AxiosRequestConfig>;
|
|
1057
1056
|
response: Interceptors<AxiosResponse>;
|
|
1058
|
-
`},11:function(e,n,
|
|
1057
|
+
`},11:function(e,t,n,r,i){return` request: Interceptors<RequestInit>;
|
|
1059
1058
|
response: Interceptors<Response>;
|
|
1060
|
-
`},13:function(e,n,
|
|
1059
|
+
`},13:function(e,t,n,r,i){return` request: Interceptors<XMLHttpRequest>;
|
|
1061
1060
|
response: Interceptors<XMLHttpRequest>;
|
|
1062
|
-
`},15:function(e,n,
|
|
1063
|
-
`},compiler:[8
|
|
1061
|
+
`},15:function(e,t,n,r,i){return` request: new Interceptors(),
|
|
1062
|
+
`},compiler:[8,`>= 4.3.0`],main:function(e,t,n,r,i){var a=t??(e.nullContext||{}),o=e.strict,s=e.lambda,c=e.lookupProperty||function(e,t){if(Object.prototype.hasOwnProperty.call(e,t))return e[t]};return(c(n,`equals`).call(a,c(c(c(c(i,`root`),`$config`),`client`),`name`),`legacy/angular`,{name:`equals`,hash:{},fn:e.program(1,i,0),inverse:e.noop,data:i,loc:{start:{line:1,column:0},end:{line:3,column:11}}})??``)+(c(n,`equals`).call(a,c(c(c(c(i,`root`),`$config`),`client`),`name`),`legacy/axios`,{name:`equals`,hash:{},fn:e.program(3,i,0),inverse:e.noop,data:i,loc:{start:{line:4,column:0},end:{line:6,column:11}}})??``)+(c(n,`equals`).call(a,c(c(c(c(i,`root`),`$config`),`client`),`name`),`legacy/node`,{name:`equals`,hash:{},fn:e.program(5,i,0),inverse:e.noop,data:i,loc:{start:{line:7,column:0},end:{line:9,column:11}}})??``)+`import type { ApiRequestOptions } from './ApiRequestOptions';
|
|
1064
1063
|
|
|
1065
1064
|
type Headers = Record<string, string>;
|
|
1066
1065
|
type Middleware<T> = (value: T) => T | Promise<T>;
|
|
@@ -1096,23 +1095,23 @@ export type OpenAPIConfig = {
|
|
|
1096
1095
|
VERSION: string;
|
|
1097
1096
|
WITH_CREDENTIALS: boolean;
|
|
1098
1097
|
interceptors: {
|
|
1099
|
-
`+((
|
|
1098
|
+
`+(c(n,`equals`).call(a,c(c(c(c(i,`root`),`$config`),`client`),`name`),`legacy/angular`,{name:`equals`,hash:{},fn:e.program(7,i,0),inverse:e.noop,data:i,loc:{start:{line:46,column:2},end:{line:48,column:13}}})??``)+(c(n,`equals`).call(a,c(c(c(c(i,`root`),`$config`),`client`),`name`),`legacy/axios`,{name:`equals`,hash:{},fn:e.program(9,i,0),inverse:e.noop,data:i,loc:{start:{line:49,column:2},end:{line:52,column:13}}})??``)+(c(n,`equals`).call(a,c(c(c(c(i,`root`),`$config`),`client`),`name`),`legacy/fetch`,{name:`equals`,hash:{},fn:e.program(11,i,0),inverse:e.noop,data:i,loc:{start:{line:53,column:2},end:{line:56,column:13}}})??``)+(c(n,`equals`).call(a,c(c(c(c(i,`root`),`$config`),`client`),`name`),`legacy/node`,{name:`equals`,hash:{},fn:e.program(11,i,0),inverse:e.noop,data:i,loc:{start:{line:57,column:2},end:{line:60,column:13}}})??``)+(c(n,`equals`).call(a,c(c(c(c(i,`root`),`$config`),`client`),`name`),`legacy/xhr`,{name:`equals`,hash:{},fn:e.program(13,i,0),inverse:e.noop,data:i,loc:{start:{line:61,column:2},end:{line:64,column:13}}})??``)+` };
|
|
1100
1099
|
};
|
|
1101
1100
|
|
|
1102
1101
|
export const OpenAPI: OpenAPIConfig = {
|
|
1103
|
-
BASE: '`+(
|
|
1102
|
+
BASE: '`+(s(o(t,`server`,{start:{line:69,column:11},end:{line:69,column:17}}),t)??``)+`',
|
|
1104
1103
|
CREDENTIALS: 'include',
|
|
1105
1104
|
ENCODE_PATH: undefined,
|
|
1106
1105
|
HEADERS: undefined,
|
|
1107
1106
|
PASSWORD: undefined,
|
|
1108
1107
|
TOKEN: undefined,
|
|
1109
1108
|
USERNAME: undefined,
|
|
1110
|
-
VERSION: '`+(
|
|
1109
|
+
VERSION: '`+(s(o(t,`version`,{start:{line:76,column:14},end:{line:76,column:21}}),t)??``)+`',
|
|
1111
1110
|
WITH_CREDENTIALS: false,
|
|
1112
1111
|
interceptors: {
|
|
1113
|
-
`+((
|
|
1112
|
+
`+(c(n,`notEquals`).call(a,c(c(c(c(i,`root`),`$config`),`client`),`name`),`legacy/angular`,{name:`notEquals`,hash:{},fn:e.program(15,i,0),inverse:e.noop,data:i,loc:{start:{line:79,column:2},end:{line:81,column:16}}})??``)+` response: new Interceptors(),
|
|
1114
1113
|
},
|
|
1115
|
-
};`},useData
|
|
1114
|
+
};`},useData:!0},ht={1:function(e,t,n,r,i){var a=e.lookupProperty||function(e,t){if(Object.prototype.hasOwnProperty.call(e,t))return e[t]};return e.invokePartial(a(r,`angular/request`),t,{name:`angular/request`,data:i,helpers:n,partials:r,decorators:e.decorators})??``},3:function(e,t,n,r,i){var a=e.lookupProperty||function(e,t){if(Object.prototype.hasOwnProperty.call(e,t))return e[t]};return e.invokePartial(a(r,`axios/request`),t,{name:`axios/request`,data:i,helpers:n,partials:r,decorators:e.decorators})??``},5:function(e,t,n,r,i){var a=e.lookupProperty||function(e,t){if(Object.prototype.hasOwnProperty.call(e,t))return e[t]};return e.invokePartial(a(r,`fetch/request`),t,{name:`fetch/request`,data:i,helpers:n,partials:r,decorators:e.decorators})??``},7:function(e,t,n,r,i){var a=e.lookupProperty||function(e,t){if(Object.prototype.hasOwnProperty.call(e,t))return e[t]};return e.invokePartial(a(r,`xhr/request`),t,{name:`xhr/request`,data:i,helpers:n,partials:r,decorators:e.decorators})??``},compiler:[8,`>= 4.3.0`],main:function(e,t,n,r,i){var a=t??(e.nullContext||{}),o=e.lookupProperty||function(e,t){if(Object.prototype.hasOwnProperty.call(e,t))return e[t]};return(o(n,`equals`).call(a,o(o(o(o(i,`root`),`$config`),`client`),`name`),`legacy/angular`,{name:`equals`,hash:{},fn:e.program(1,i,0),inverse:e.noop,data:i,loc:{start:{line:1,column:0},end:{line:1,column:87}}})??``)+(o(n,`equals`).call(a,o(o(o(o(i,`root`),`$config`),`client`),`name`),`legacy/axios`,{name:`equals`,hash:{},fn:e.program(3,i,0),inverse:e.noop,data:i,loc:{start:{line:2,column:0},end:{line:2,column:83}}})??``)+(o(n,`equals`).call(a,o(o(o(o(i,`root`),`$config`),`client`),`name`),`legacy/fetch`,{name:`equals`,hash:{},fn:e.program(5,i,0),inverse:e.noop,data:i,loc:{start:{line:3,column:0},end:{line:3,column:83}}})??``)+(o(n,`equals`).call(a,o(o(o(o(i,`root`),`$config`),`client`),`name`),`legacy/node`,{name:`equals`,hash:{},fn:e.program(5,i,0),inverse:e.noop,data:i,loc:{start:{line:4,column:0},end:{line:4,column:82}}})??``)+(o(n,`equals`).call(a,o(o(o(o(i,`root`),`$config`),`client`),`name`),`legacy/xhr`,{name:`equals`,hash:{},fn:e.program(7,i,0),inverse:e.noop,data:i,loc:{start:{line:5,column:0},end:{line:5,column:79}}})??``)},usePartial:!0,useData:!0},gt={compiler:[8,`>= 4.3.0`],main:function(e,t,n,r,i){return`export const getHeaders = async <T>(config: OpenAPIConfig, options: ApiRequestOptions<T>): Promise<Headers> => {
|
|
1116
1115
|
const [token, username, password, additionalHeaders] = await Promise.all([
|
|
1117
1116
|
// @ts-ignore
|
|
1118
1117
|
resolve(options, config.TOKEN),
|
|
@@ -1157,7 +1156,7 @@ export const OpenAPI: OpenAPIConfig = {
|
|
|
1157
1156
|
}
|
|
1158
1157
|
|
|
1159
1158
|
return new Headers(headers);
|
|
1160
|
-
};`},useData
|
|
1159
|
+
};`},useData:!0},_t={compiler:[8,`>= 4.3.0`],main:function(e,t,n,r,i){return`export const getRequestBody = (options: ApiRequestOptions): unknown => {
|
|
1161
1160
|
if (options.body !== undefined) {
|
|
1162
1161
|
if (options.mediaType?.includes('application/json') || options.mediaType?.includes('+json')) {
|
|
1163
1162
|
return JSON.stringify(options.body);
|
|
@@ -1168,7 +1167,7 @@ export const OpenAPI: OpenAPIConfig = {
|
|
|
1168
1167
|
}
|
|
1169
1168
|
}
|
|
1170
1169
|
return undefined;
|
|
1171
|
-
};`},useData
|
|
1170
|
+
};`},useData:!0},vt={compiler:[8,`>= 4.3.0`],main:function(e,t,n,r,i){return`export const getResponseBody = (xhr: XMLHttpRequest): unknown => {
|
|
1172
1171
|
if (xhr.status !== 204) {
|
|
1173
1172
|
try {
|
|
1174
1173
|
const contentType = xhr.getResponseHeader('Content-Type');
|
|
@@ -1184,7 +1183,7 @@ export const OpenAPI: OpenAPIConfig = {
|
|
|
1184
1183
|
}
|
|
1185
1184
|
}
|
|
1186
1185
|
return undefined;
|
|
1187
|
-
};`},useData
|
|
1186
|
+
};`},useData:!0},yt={compiler:[8,`>= 4.3.0`],main:function(e,t,n,r,i){return`export const getResponseHeader = (xhr: XMLHttpRequest, responseHeader?: string): string | undefined => {
|
|
1188
1187
|
if (responseHeader) {
|
|
1189
1188
|
const content = xhr.getResponseHeader(responseHeader);
|
|
1190
1189
|
if (isString(content)) {
|
|
@@ -1192,53 +1191,53 @@ export const OpenAPI: OpenAPIConfig = {
|
|
|
1192
1191
|
}
|
|
1193
1192
|
}
|
|
1194
1193
|
return undefined;
|
|
1195
|
-
};`},useData
|
|
1194
|
+
};`},useData:!0},bt={1:function(e,t,n,r,i){return`ApiResult<T>`},3:function(e,t,n,r,i){return`T`},5:function(e,t,n,r,i){return`result.body`},7:function(e,t,n,r,i){return`result`},compiler:[8,`>= 4.3.0`],main:function(e,t,n,r,i){var a=t??(e.nullContext||{}),o=e.lookupProperty||function(e,t){if(Object.prototype.hasOwnProperty.call(e,t))return e[t]};return`import { ApiError } from './ApiError';
|
|
1196
1195
|
import type { ApiRequestOptions } from './ApiRequestOptions';
|
|
1197
1196
|
import type { ApiResult } from './ApiResult';
|
|
1198
1197
|
import { CancelablePromise } from './CancelablePromise';
|
|
1199
1198
|
import type { OnCancel } from './CancelablePromise';
|
|
1200
1199
|
import type { OpenAPIConfig } from './OpenAPI';
|
|
1201
1200
|
|
|
1202
|
-
`+(
|
|
1201
|
+
`+(e.invokePartial(o(r,`functions/isString`),t,{name:`functions/isString`,data:i,helpers:n,partials:r,decorators:e.decorators})??``)+`
|
|
1203
1202
|
|
|
1204
|
-
`+(
|
|
1203
|
+
`+(e.invokePartial(o(r,`functions/isStringWithValue`),t,{name:`functions/isStringWithValue`,data:i,helpers:n,partials:r,decorators:e.decorators})??``)+`
|
|
1205
1204
|
|
|
1206
|
-
`+(
|
|
1205
|
+
`+(e.invokePartial(o(r,`functions/isBlob`),t,{name:`functions/isBlob`,data:i,helpers:n,partials:r,decorators:e.decorators})??``)+`
|
|
1207
1206
|
|
|
1208
|
-
`+(
|
|
1207
|
+
`+(e.invokePartial(o(r,`functions/isFormData`),t,{name:`functions/isFormData`,data:i,helpers:n,partials:r,decorators:e.decorators})??``)+`
|
|
1209
1208
|
|
|
1210
|
-
`+(
|
|
1209
|
+
`+(e.invokePartial(o(r,`functions/isSuccess`),t,{name:`functions/isSuccess`,data:i,helpers:n,partials:r,decorators:e.decorators})??``)+`
|
|
1211
1210
|
|
|
1212
|
-
`+(
|
|
1211
|
+
`+(e.invokePartial(o(r,`functions/base64`),t,{name:`functions/base64`,data:i,helpers:n,partials:r,decorators:e.decorators})??``)+`
|
|
1213
1212
|
|
|
1214
|
-
`+(
|
|
1213
|
+
`+(e.invokePartial(o(r,`functions/getQueryString`),t,{name:`functions/getQueryString`,data:i,helpers:n,partials:r,decorators:e.decorators})??``)+`
|
|
1215
1214
|
|
|
1216
|
-
`+(
|
|
1215
|
+
`+(e.invokePartial(o(r,`functions/getUrl`),t,{name:`functions/getUrl`,data:i,helpers:n,partials:r,decorators:e.decorators})??``)+`
|
|
1217
1216
|
|
|
1218
|
-
`+(
|
|
1217
|
+
`+(e.invokePartial(o(r,`functions/getFormData`),t,{name:`functions/getFormData`,data:i,helpers:n,partials:r,decorators:e.decorators})??``)+`
|
|
1219
1218
|
|
|
1220
|
-
`+(
|
|
1219
|
+
`+(e.invokePartial(o(r,`functions/resolve`),t,{name:`functions/resolve`,data:i,helpers:n,partials:r,decorators:e.decorators})??``)+`
|
|
1221
1220
|
|
|
1222
|
-
`+(
|
|
1221
|
+
`+(e.invokePartial(o(r,`fetch/getHeaders`),t,{name:`fetch/getHeaders`,data:i,helpers:n,partials:r,decorators:e.decorators})??``)+`
|
|
1223
1222
|
|
|
1224
|
-
`+(
|
|
1223
|
+
`+(e.invokePartial(o(r,`xhr/getRequestBody`),t,{name:`xhr/getRequestBody`,data:i,helpers:n,partials:r,decorators:e.decorators})??``)+`
|
|
1225
1224
|
|
|
1226
|
-
`+(
|
|
1225
|
+
`+(e.invokePartial(o(r,`xhr/sendRequest`),t,{name:`xhr/sendRequest`,data:i,helpers:n,partials:r,decorators:e.decorators})??``)+`
|
|
1227
1226
|
|
|
1228
|
-
`+(
|
|
1227
|
+
`+(e.invokePartial(o(r,`xhr/getResponseHeader`),t,{name:`xhr/getResponseHeader`,data:i,helpers:n,partials:r,decorators:e.decorators})??``)+`
|
|
1229
1228
|
|
|
1230
|
-
`+(
|
|
1229
|
+
`+(e.invokePartial(o(r,`xhr/getResponseBody`),t,{name:`xhr/getResponseBody`,data:i,helpers:n,partials:r,decorators:e.decorators})??``)+`
|
|
1231
1230
|
|
|
1232
|
-
`+(
|
|
1231
|
+
`+(e.invokePartial(o(r,`functions/catchErrorCodes`),t,{name:`functions/catchErrorCodes`,data:i,helpers:n,partials:r,decorators:e.decorators})??``)+`
|
|
1233
1232
|
|
|
1234
1233
|
/**
|
|
1235
1234
|
* Request method
|
|
1236
1235
|
* @param config The OpenAPI configuration object
|
|
1237
1236
|
* @param options The request options from the service
|
|
1238
|
-
* @returns CancelablePromise<`+((
|
|
1237
|
+
* @returns CancelablePromise<`+(o(n,`ifServicesResponse`).call(a,`response`,{name:`ifServicesResponse`,hash:{},fn:e.program(1,i,0),inverse:e.program(3,i,0),data:i,loc:{start:{line:60,column:30},end:{line:60,column:108}}})??``)+`>
|
|
1239
1238
|
* @throws ApiError
|
|
1240
1239
|
*/
|
|
1241
|
-
export const request = <T>(config: OpenAPIConfig, options: ApiRequestOptions<T>): CancelablePromise<`+((
|
|
1240
|
+
export const request = <T>(config: OpenAPIConfig, options: ApiRequestOptions<T>): CancelablePromise<`+(o(n,`ifServicesResponse`).call(a,`response`,{name:`ifServicesResponse`,hash:{},fn:e.program(1,i,0),inverse:e.program(3,i,0),data:i,loc:{start:{line:63,column:100},end:{line:63,column:178}}})??``)+`> => {
|
|
1242
1241
|
return new CancelablePromise(async (resolve, reject, onCancel) => {
|
|
1243
1242
|
try {
|
|
1244
1243
|
const url = getUrl(config, options);
|
|
@@ -1271,13 +1270,13 @@ export const request = <T>(config: OpenAPIConfig, options: ApiRequestOptions<T>)
|
|
|
1271
1270
|
|
|
1272
1271
|
catchErrorCodes(options, result);
|
|
1273
1272
|
|
|
1274
|
-
resolve(`+((
|
|
1273
|
+
resolve(`+(o(n,`ifServicesResponse`).call(a,`body`,{name:`ifServicesResponse`,hash:{},fn:e.program(5,i,0),inverse:e.program(7,i,0),data:i,loc:{start:{line:96,column:12},end:{line:96,column:90}}})??``)+`);
|
|
1275
1274
|
}
|
|
1276
1275
|
} catch (error) {
|
|
1277
1276
|
reject(error);
|
|
1278
1277
|
}
|
|
1279
1278
|
});
|
|
1280
|
-
};`},usePartial
|
|
1279
|
+
};`},usePartial:!0,useData:!0},xt={compiler:[8,`>= 4.3.0`],main:function(e,t,n,r,i){return`export const sendRequest = async (
|
|
1281
1280
|
config: OpenAPIConfig,
|
|
1282
1281
|
options: ApiRequestOptions,
|
|
1283
1282
|
url: string,
|
|
@@ -1307,5 +1306,5 @@ export const request = <T>(config: OpenAPIConfig, options: ApiRequestOptions<T>)
|
|
|
1307
1306
|
|
|
1308
1307
|
onCancel(() => xhr.abort());
|
|
1309
1308
|
});
|
|
1310
|
-
};`},useData
|
|
1309
|
+
};`},useData:!0};const St=()=>{N.registerHelper(`camelCase`,function(e){return E({case:`camelCase`,value:e})}),N.registerHelper(`equals`,function(e,t,n){return e===t?n.fn(this):n.inverse(this)}),N.registerHelper(`ifServicesResponse`,function(e,t){return f().plugins[`@hey-api/sdk`]?.config.response===e?t.fn(this):t.inverse(this)}),N.registerHelper(`ifdef`,function(...e){let t=e.pop();return e.every(e=>!e)?t.inverse(this):t.fn(this)}),N.registerHelper(`notEquals`,function(e,t,n){return e===t?n.inverse(this):n.fn(this)}),N.registerHelper(`transformServiceName`,function(e){return ie({config:f(),name:e})})},Ct=()=>{St();let e={client:N.template(Me),core:{apiError:N.template(ze),apiRequestOptions:N.template(Be),apiResult:N.template(Ve),baseHttpRequest:N.template(Je),cancelablePromise:N.template(Ye),httpRequest:N.template(pt),request:N.template(ht),settings:N.template(mt)}};return N.registerPartial(`functions/base64`,N.template(nt)),N.registerPartial(`functions/catchErrorCodes`,N.template(rt)),N.registerPartial(`functions/getFormData`,N.template(it)),N.registerPartial(`functions/getQueryString`,N.template(at)),N.registerPartial(`functions/getUrl`,N.template(ot)),N.registerPartial(`functions/isBlob`,N.template(st)),N.registerPartial(`functions/isFormData`,N.template(ct)),N.registerPartial(`functions/isString`,N.template(lt)),N.registerPartial(`functions/isStringWithValue`,N.template(ut)),N.registerPartial(`functions/isSuccess`,N.template(dt)),N.registerPartial(`functions/resolve`,N.template(ft)),N.registerPartial(`fetch/getHeaders`,N.template(Xe)),N.registerPartial(`fetch/getRequestBody`,N.template(Ze)),N.registerPartial(`fetch/getResponseBody`,N.template(Qe)),N.registerPartial(`fetch/getResponseHeader`,N.template($e)),N.registerPartial(`fetch/request`,N.template(et)),N.registerPartial(`fetch/sendRequest`,N.template(tt)),N.registerPartial(`xhr/getHeaders`,N.template(gt)),N.registerPartial(`xhr/getRequestBody`,N.template(_t)),N.registerPartial(`xhr/getResponseBody`,N.template(vt)),N.registerPartial(`xhr/getResponseHeader`,N.template(yt)),N.registerPartial(`xhr/request`,N.template(bt)),N.registerPartial(`xhr/sendRequest`,N.template(xt)),N.registerPartial(`axios/getHeaders`,N.template(He)),N.registerPartial(`axios/getRequestBody`,N.template(Ue)),N.registerPartial(`axios/getResponseBody`,N.template(We)),N.registerPartial(`axios/getResponseHeader`,N.template(Ge)),N.registerPartial(`axios/request`,N.template(Ke)),N.registerPartial(`axios/sendRequest`,N.template(qe)),N.registerPartial(`angular/getHeaders`,N.template(Ne)),N.registerPartial(`angular/getRequestBody`,N.template(Pe)),N.registerPartial(`angular/getResponseBody`,N.template(Fe)),N.registerPartial(`angular/getResponseHeader`,N.template(Ie)),N.registerPartial(`angular/request`,N.template(Le)),N.registerPartial(`angular/sendRequest`,N.template(Re)),e};let wt=0;const J=e=>`${e}-${wt++}`,Y=e=>`${e}-end`,X=e=>`${e}-length`,Z=e=>`${e}-start`,Tt=(e,t)=>{if(e>200)return{color:k.red,type:`duration`};if(t>30)return{color:k.red,type:`percentage`};if(e>50)return{color:k.yellow,type:`duration`};if(t>10)return{color:k.yellow,type:`percentage`}};var Q=class{events=[];end(e){let t,n=this.events;for(let r of e.position)t=n[r],t?.events&&(n=t.events);t&&!t.end&&(t.end=performance.mark(Y(t.id)))}report(e=!0){let t=this.events[0];if(!t)return;let n=this.events[this.events.length-1],r=`root`,i=J(r),a=performance.measure(X(i),Z(t.id),Y(n.id));return e&&this.reportEvent({end:n.end,events:this.events,id:i,indent:0,measure:a,name:r,start:t.start}),a}reportEvent({indent:e,...t}){let n=e?k.gray:k.cyan,r=t.events.length-1;t.events.forEach((i,a)=>{let o=performance.measure(X(i.id),Z(i.id),Y(i.id)),s=Math.ceil(o.duration*100)/100,c=Math.ceil(o.duration/t.measure.duration*100*100)/100,l=e?Tt(s,c):void 0,u=`${s.toFixed(2).padStart(8)}ms`;l?.type===`duration`&&(u=l.color(u));let d=a===r?`└─ `:`├─ `,f=e?`│ `.repeat(e-1)+d:``,p=38-f.length,m=e?`↳ `:``,h=`${e?` `.repeat(e-1)+m:``}${c.toFixed(2)}%`;l?.type===`percentage`&&(h=l.color(h));let g=k.gray(`[root] `);console.log(`${g}${k.gray(f)}${n(`${i.name.padEnd(p)} ${u} (${h})`)}`),this.reportEvent({...i,indent:e+1,measure:o})})}start(e){return performance.mark(Z(e))}storeEvent({result:e,...t}){let n=t.events.length-1,r=t.events[n];if(r&&!r.end){e.position=[...e.position,n],this.storeEvent({...t,events:r.events,result:e});return}let i=t.events.push({...t,events:[]});e.position=[...e.position,i-1]}timeEvent(e){let t=J(e),n=this.start(t),r={events:this.events,id:t,name:e,start:n},i={position:[]};return this.storeEvent({...r,result:i}),{mark:n,timeEnd:()=>this.end(i)}}};const $={stringCase:E};k.enabled=le().hasBasic;const Et=async(e,t=new Q)=>{let n=typeof e==`function`?await e():e,i=n?n instanceof Array?n:[n]:[],o=i.find(e=>O(e).level!==`silent`)?.logs;typeof o==`string`&&(o=O({logs:o}));let s;try{P();let e=t.timeEvent(`createClient`),n=t.timeEvent(`config`);s=await ae({logger:t,userConfigs:i}),s.results.some(e=>e.config.logs.level!==`silent`)&&je(),n.timeEnd();let r=s.results.flatMap(e=>e.errors.map(t=>({error:t,jobIndex:e.jobIndex})));if(r.length)throw new a(r);let o=t.timeEvent(`handlebars`),c=Ct();o.timeEnd();let l=(await Promise.all(s.results.map(async e=>{try{return await q({config:e.config,dependencies:s.dependencies,jobIndex:e.jobIndex,logger:t,templates:c})}catch(t){throw new u(``,{error:t,jobIndex:e.jobIndex})}}))).filter(e=>!!e);e.timeEnd();let d=s.results.some(e=>e.config.logs.level===`debug`);return t.report(d),l}catch(e){let t=s?.results??[],n=t.find(e=>e.config.logs.level!==`silent`)?.config.logs??t[0]?.config.logs??o,a=t.some(e=>e.config.dryRun)??i.some(e=>e.dryRun)??!1,l=n?.file&&!a?ne(e,n.path??``):void 0;throw(!n||n.level!==`silent`)&&(te({error:e,logPath:l}),await c({error:e,isInteractive:t.some(e=>e.config.interactive)??i.some(e=>e.interactive)??!1})&&await r(e)),e}},Dt=async e=>typeof e==`function`?await e():e;export{Q as Logger,T as clientDefaultConfig,_ as clientDefaultMeta,h as clientPluginHandler,b as compiler,Et as createClient,g as defaultPaginationKeywords,w as defaultPlugins,Dt as defineConfig,ce as definePluginConfig,m as tsc,$ as utils};
|
|
1311
1310
|
//# sourceMappingURL=index.js.map
|