@hey-api/openapi-ts 0.85.1 → 0.86.0
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/bin/index.cjs +3 -2
- package/dist/chunk-BJUc-MpE.js +1 -0
- package/dist/clients/axios/client.ts +17 -8
- package/dist/clients/nuxt/utils.ts +12 -4
- package/dist/getSpec-CZ8YOkGf.js +24 -0
- package/dist/getSpec-CZ8YOkGf.js.map +1 -0
- package/dist/getSpec-_5jk-wUD.cjs +24 -0
- package/dist/getSpec-_5jk-wUD.cjs.map +1 -0
- package/dist/index.cjs +180 -225
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +822 -1468
- package/dist/index.d.ts +822 -1468
- package/dist/index.js +172 -183
- 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-DIu3K5QP.d.cts → types-BesMf-H-.d.ts} +7950 -6898
- package/dist/{types.d-DIu3K5QP.d.ts → types-CFN6tBkJ.d.cts} +7950 -6898
- package/package.json +8 -8
- package/dist/chunk-SA4IKOSG.js +0 -47
- package/dist/chunk-SA4IKOSG.js.map +0 -1
- package/dist/internal.cjs.map +0 -1
- package/dist/internal.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,18 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
var Be=b((ao,$e)=>{$e.exports=De;De.sync=Ot;var He=a("fs");function St(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:St(n,o)}function De(e,n,o){He.stat(e,function(t,r){o(t,t?false:Ie(r,e,n));});}function Ot(e,n){return Ie(He.statSync(e),e,n)}});var Le=b((lo,Fe)=>{Fe.exports=_e;_e.sync=Ht;var je=a("fs");function _e(e,n,o){je.stat(e,function(t,r){o(t,t?false:Ne(r,n));});}function Ht(e,n){return Ne(je.statSync(e),n)}function Ne(e,n){return e.isFile()&&It(e,n)}function It(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((uo,Me)=>{a("fs");var W;process.platform==="win32"||global.TESTING_WINDOWS?W=Be():W=Le();Me.exports=K;K.sync=Dt;function K(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){K(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 Dt(e,n){try{return W.sync(e,n||{})}catch(o){if(n&&n.ignoreErrors||o.code==="EACCES")return false;throw o}}});var Ke=b((co,Je)=>{var I=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",Ue=a("path"),$t=I?";":":",Ve=We(),Ge=e=>Object.assign(new Error(`not found: ${e}`),{code:"ENOENT"}),ze=(e,n)=>{let o=n.colon||$t,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}},Ye=(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)},Bt=(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)};Je.exports=Ye;Ye.sync=Bt;});var Qe=b((fo,X)=>{var Xe=(e={})=>{let n=e.env||process.env;return (e.platform||process.platform)!=="win32"?"PATH":Object.keys(n).reverse().find(t=>t.toUpperCase()==="PATH")||"Path"};X.exports=Xe;X.exports.default=Xe;});var tn=b((mo,nn)=>{var Ze=a("path"),jt=Ke(),_t=Qe();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=jt.sync(e.command,{path:o[_t({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 Nt(e){return en(e)||en(e,true)}nn.exports=Nt;});var rn=b((go,Z)=>{var Q=/([()\][%!^"`<>&|;, *?])/g;function Ft(e){return e=e.replace(Q,"^$1"),e}function Lt(e,n){return e=`${e}`,e=e.replace(/(?=(\\+?)?)\1"/g,'$1$1\\"'),e=e.replace(/(?=(\\+?)?)\1$/,"$1$1"),e=`"${e}"`,e=e.replace(Q,"^$1"),n&&(e=e.replace(Q,"^$1")),e}Z.exports.command=Ft;Z.exports.argument=Lt;});var sn=b((yo,on)=>{on.exports=/^#!(.*)/;});var ln=b((ho,an)=>{var Mt=sn();an.exports=(e="")=>{let n=e.match(Mt);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((vo,pn)=>{var ee=a("fs"),Wt=ln();function Ut(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 Wt(o.toString())}pn.exports=Ut;});var dn=b((Ro,mn)=>{var Vt=a("path"),cn=tn(),fn=rn(),Gt=un(),zt=process.platform==="win32",Yt=/\.(?:com|exe)$/i,Jt=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function Kt(e){e.file=cn(e);let n=e.file&&Gt(e.file);return n?(e.args.unshift(e.file),e.command=n,cn(e)):e.file}function Xt(e){if(!zt)return e;let n=Kt(e),o=!Yt.test(n);if(e.options.forceShell||o){let t=Jt.test(n);e.command=Vt.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((xo,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 Zt(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 er(e,n){return ne&&e===1&&!n.file?te(n.original,"spawnSync"):null}yn.exports={hookChildProcess:Zt,verifyENOENT:gn,verifyENOENTSync:er,notFoundError:te};});var xn=b((Po,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 nr(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=nr;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
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
db e888888e
|
|
7
|
-
d8 Y88Y ~8b
|
|
8
|
-
dY "" "" Yb
|
|
9
|
-
8 88 88 8
|
|
10
|
-
8 o 8 8
|
|
11
|
-
Yb b8d eb ,b
|
|
12
|
-
Yb_____Y ,b
|
|
13
|
-
8 dY
|
|
14
|
-
8 e 8
|
|
15
|
-
`,dr=`
|
|
1
|
+
import{__commonJSMin as e,__require as t,__toESM as n}from"./chunk-BJUc-MpE.js";import{ConfigError as r,ConfigValidationError as i,GeneratedFile as a,JobError as o,clientDefaultConfig as s,clientDefaultMeta as c,clientPluginHandler as l,compiler as u,defaultPaginationKeywords as d,defaultPlugins as f,definePluginConfig as p,ensureDirSync as m,generateClientBundle as h,getClientPlugin as g,getConfig as _,getLogs as v,getSpec as y,initConfigs as b,isLegacyClient as x,legacyNameFromConfig as S,loadPackageJson as ee,logCrashReport as te,openGitHubIssueWithCrashReport as C,parseLegacy as ne,parseOpenApiSpec as re,printCrashReport as ie,removeDirSync as w,sanitizeNamespaceIdentifier as ae,shouldReportCrash as oe,sort as T,sortByName as E,stringCase as D,transformClassName as se,tsc as O,unique as k}from"./getSpec-CZ8YOkGf.js";import A from"ansi-colors";import ce from"color-support";import j from"node:fs";import M from"node:path";import{$RefParser as le}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 r(`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 r(`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=_(),a=g(i),o=r.client({$config:i,...n,httpRequest:F(a.name),models:E(n.models),services:E(n.services)});S(i)&&(m(t),j.writeFileSync(M.resolve(t,`${S(i)}.ts`),o))},L=async(e,t,n)=>{let r=_();if(r.exportCore){let i=g(r),a={httpRequest:F(i.name),server:r.base===void 0?t.server:r.base,version:t.version};if(j.rmSync(M.resolve(e),{force:!0,recursive:!0}),j.mkdirSync(M.resolve(e),{recursive:!0}),await j.writeFileSync(M.resolve(e,`OpenAPI.ts`),n.core.settings({$config:r,...a})),await j.writeFileSync(M.resolve(e,`ApiError.ts`),n.core.apiError({$config:r,...a})),await j.writeFileSync(M.resolve(e,`ApiRequestOptions.ts`),n.core.apiRequestOptions({$config:r,...a})),await j.writeFileSync(M.resolve(e,`ApiResult.ts`),n.core.apiResult({$config:r,...a})),i.name!==`legacy/angular`&&await j.writeFileSync(M.resolve(e,`CancelablePromise.ts`),n.core.cancelablePromise({$config:r,...a})),await j.writeFileSync(M.resolve(e,`request.ts`),n.core.request({$config:r,...a})),S(r)&&(await j.writeFileSync(M.resolve(e,`BaseHttpRequest.ts`),n.core.baseHttpRequest({$config:r,...a})),await j.writeFileSync(M.resolve(e,`${a.httpRequest}.ts`),n.core.httpRequest({$config:r,...a}))),r.request){let t=M.resolve(process.cwd(),r.request);if(!await j.existsSync(t))throw Error(`Custom request file "${t}" does not exists`);await j.copyFileSync(t,M.resolve(e,`request.ts`))}}},R=({files:e})=>{let t=_();e.index=new a({dir:t.output.path,id:`index`,name:`index.ts`}),S(t)&&e.index.add(O.exportNamedDeclaration({exports:S(t),module:`./${S(t)}`})),t.exportCore&&(e.index.add(O.exportNamedDeclaration({exports:`ApiError`,module:`./core/ApiError`})),t.plugins[`@hey-api/sdk`]?.config.response===`response`&&e.index.add(O.exportNamedDeclaration({exports:{asType:!0,name:`ApiResult`},module:`./core/ApiResult`})),S(t)&&e.index.add(O.exportNamedDeclaration({exports:`BaseHttpRequest`,module:`./core/BaseHttpRequest`})),g(t).name!==`legacy/angular`&&e.index.add(O.exportNamedDeclaration({exports:[`CancelablePromise`,`CancelError`],module:`./core/CancelablePromise`})),e.index.add(O.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(O.exportAllDeclaration({module:`./${n.nameWithoutExtension()}`}))})},z=async({client:e,openApi:t,templates:n})=>{let r=_(),i=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=M.resolve(r.output.path);r.output.clean&&w(o);let s=g(r);!x(r)&&`bundle`in s.config&&s.config.bundle&&h({meta:{importFileExtension:r.output.importFileExtension},outputPath:o,plugin:s}),await I(i,o,e,n),await L(M.resolve(r.output.path,`core`),e,n);let c={};for(let t of r.pluginOrder){let n=r.plugins[t],o=(n.output??``).split(`/`),s=M.resolve(r.output.path,...o.slice(0,o.length-1));c[n.name]=new a({dir:s,id:`legacy-unused-${n.name}`,name:`${o[o.length-1]}.ts`}),n.handlerLegacy?.({client:e,files:c,openApi:i,plugin:n})}R({files:c}),Object.entries(c).forEach(([e,t])=>{r.dryRun||(e===`index`?t.write(`
|
|
2
|
+
`,r.output.tsConfig):t.write(`
|
|
3
|
+
|
|
4
|
+
`,r.output.tsConfig))})},B=async({context:e})=>{let t=M.resolve(e.config.output.path);e.config.output.clean&&w(t);let n={importFileExtension:e.config.output.importFileExtension},r=g(e.config);`bundle`in r.config&&r.config.bundle&&(e.config._FRAGILE_CLIENT_BUNDLE_RENAMED=h({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=M.resolve(t,r.path),i=M.dirname(n);e.config.dryRun||(j.mkdirSync(i,{recursive:!0}),j.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=e(((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=e(((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=e(((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=e(((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=e(((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=e(((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=e(((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=e(((e,t)=>{t.exports=/^#!(.*)/})),he=e(((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=e(((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=e(((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=e(((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=n(e(((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)=>k(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)=>k(t,n,r)&&t!==e.name).sort(T)}),we=e=>{let t=_(),n=new Map;return e.forEach(e=>{(e.tags?.length&&(t.plugins[`@hey-api/sdk`]?.config.asClass||S(t))?e.tags.filter(k):[`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(k).sort(T),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=>D({case:`PascalCase`,value:ae(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=A.gray(`[Job ${t+1}] `),i=e.length,a=A.cyan(`Generating from ${i} ${i===1?`input`:`inputs`}:`);n.push(`${r}⏳ ${a}`),e.forEach((e,t)=>{let i=` [${t+1}] `,a=A.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}${A.gray(`branch:`)} ${A.green(e.branch)}`),e.commit_sha&&n.push(`${r}${o}${A.gray(`commit:`)} ${A.green(e.commit_sha)}`),e.tags?.length&&n.push(`${r}${o}${A.gray(`tags:`)} ${A.green(e.tags.join(`, `))}`),e.version&&n.push(`${r}${o}${A.gray(`version:`)} ${A.green(e.version)}`),n.push(`${r}${o}${A.gray(`registry:`)} ${A.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}${A.gray(`uuid:`)} ${A.green(e.uuid)}`),n.push(`${r}${o}${A.gray(`registry:`)} ${A.green(`ReadMe`)}`);break}case`scalar`:{let t=[e.organization,e.project].filter(Boolean).join(`/`);n.push(`${r}${a}${t}`),n.push(`${r}${o}${A.gray(`registry:`)} ${A.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:i,watches:a})=>{let o=a||Array.from({length:e.input.length},()=>({headers:new Headers})),s=e.input.map(e=>ke(e));e.logs.level!==`silent`&&!a&&K(s,n);let c=async(e,t)=>{let n=r.timeEvent(`spec`),{arrayBuffer:i,error:c,resolvedInput:l,response:u}=await y({fetchOptions:e.fetch,inputPath:s[t].path,timeout:e.watch.timeout,watch:o[t]});if(n.timeEnd(),c&&!a)throw Error(`Request failed with status ${u.status}: ${u.statusText}`);return{arrayBuffer:i,resolvedInput:l}},l=(await Promise.all(e.input.map((e,t)=>c(e,t)))).filter(e=>e.arrayBuffer||e.resolvedInput),u,d;if(l.length){let o=new le,c=l.length>1?await o.bundleMany({arrayBuffer:l.map(e=>e.arrayBuffer),pathOrUrlOrSchemas:[],resolvedInputs:l.map(e=>e.resolvedInput)}):await o.bundle({arrayBuffer:l[0].arrayBuffer,pathOrUrlOrSchema:void 0,resolvedInput:l[0].resolvedInput});e.logs.level!==`silent`&&a&&(console.clear(),K(s,n));let f=r.timeEvent(`input.patch`);V({patchOptions:e.parser.patch,spec:c}),f.timeEnd();let p=r.timeEvent(`parser`);e.experimentalParser&&!x(e)&&!S(e)&&(d=re({config:e,dependencies:t,logger:r,spec:c})),d||(u=Se(ne({openApi:c}),e)),p.timeEnd();let m=r.timeEvent(`generator`);d?await B({context:d}):u&&await z({client:u,openApi:c,templates:i}),m.timeEnd();let h=r.timeEvent(`postprocess`);if(!e.dryRun&&(xe({config:e}),e.logs.level!==`silent`)){let t=process.env.INIT_CWD?`./${M.relative(process.env.INIT_CWD,e.output.path)}`:e.output.path,r=A.gray(`[Job ${n+1}] `);console.log(`${r}${A.green(`✅ Done!`)} Your output is in ${A.cyanBright(t)}`)}h.timeEnd()}let f=e.input.find((e,t)=>e.watch.enabled&&typeof s[t].path==`string`);return f&&setTimeout(()=>{q({config:e,dependencies:t,jobIndex:n,logger:r,templates:i,watches:o})},f.watch.interval),d||u},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=ee(),t=Ae(`
|
|
16
6
|
888 | e 888~-_ 888
|
|
17
7
|
888___| e88~~8e Y88b / d8b 888 \\ 888
|
|
18
8
|
888 | d888 88b Y888/ /Y88b 888 | 888
|
|
@@ -20,8 +10,7 @@ dY "" "" Yb
|
|
|
20
10
|
888 | Y888 , Y /____Y88b 888_-~ 888
|
|
21
11
|
888 | "88___/ / / Y88b 888 888
|
|
22
12
|
_/
|
|
23
|
-
`,
|
|
24
|
-
`?t&&(n.push(t),o=Math.max(o,t.length),t=""):t+=r;return {lines:n,maxLineLength:o}};function En(){let e=d(),n=An(mr),o=An(dr),t=Math.floor((n.lines.length-o.lines.length)/2),r=n.lines.map((s,a)=>{let i=s.padEnd(n.maxLineLength);return a>=t&&n.lines.length-a-1>=t&&(i+=` ${o.lines[a-t]}`),i});for(let s of r)console.log(h.cyan(s));console.log(""),console.log(h.gray(`${e.name} v${e.version}`)),console.log("");}var Tn={1:function(e,n,o,t,r){return `import { NgModule} from '@angular/core';
|
|
13
|
+
`,{padding:1});for(let e of t.lines)console.log(A.cyan(e));console.log(A.gray(`${e.name} v${e.version}`)),console.log(``)}var Me={1:function(e,t,n,r,i){return`import { NgModule} from '@angular/core';
|
|
25
14
|
import { HttpClientModule } from '@angular/common/http';
|
|
26
15
|
|
|
27
16
|
import { AngularHttpRequest } from './core/AngularHttpRequest';
|
|
@@ -29,19 +18,19 @@ import { BaseHttpRequest } from './core/BaseHttpRequest';
|
|
|
29
18
|
import type { OpenAPIConfig } from './core/OpenAPI';
|
|
30
19
|
import { OpenAPI } from './core/OpenAPI';
|
|
31
20
|
import { Interceptors } from './core/OpenAPI';
|
|
32
|
-
`},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';
|
|
33
22
|
import type { OpenAPIConfig } from './core/OpenAPI';
|
|
34
23
|
import { Interceptors } from './core/OpenAPI';
|
|
35
|
-
import { `+((
|
|
36
|
-
`},5:function(e,n,
|
|
37
|
-
`},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({
|
|
38
27
|
imports: [HttpClientModule],
|
|
39
28
|
providers: [
|
|
40
29
|
{
|
|
41
30
|
provide: OpenAPI,
|
|
42
31
|
useValue: {
|
|
43
|
-
BASE: OpenAPI?.BASE ?? '`+((
|
|
44
|
-
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)??``)+`',
|
|
45
34
|
WITH_CREDENTIALS: OpenAPI?.WITH_CREDENTIALS ?? false,
|
|
46
35
|
CREDENTIALS: OpenAPI?.CREDENTIALS ?? 'include',
|
|
47
36
|
TOKEN: OpenAPI?.TOKEN,
|
|
@@ -58,21 +47,21 @@ import { `+((s=i(a(n,"httpRequest",{start:{line:14,column:12},end:{line:14,colum
|
|
|
58
47
|
provide: BaseHttpRequest,
|
|
59
48
|
useClass: AngularHttpRequest,
|
|
60
49
|
},
|
|
61
|
-
`+(
|
|
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}}})??``)+` ]
|
|
62
51
|
})
|
|
63
|
-
export class `+((
|
|
64
|
-
`},9:function(e,n,
|
|
65
|
-
`},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;
|
|
66
55
|
|
|
67
|
-
export class `+((
|
|
56
|
+
export class `+(o(a(c(c(i,`root`),`$config`),`name`,{start:{line:57,column:16},end:{line:57,column:34}}),t)??``)+` {
|
|
68
57
|
|
|
69
|
-
`+((
|
|
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}}})??``)+`
|
|
70
59
|
public readonly request: BaseHttpRequest;
|
|
71
60
|
|
|
72
|
-
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)??``)+`) {
|
|
73
62
|
this.request = new HttpRequest({
|
|
74
|
-
BASE: config?.BASE ?? '`+((
|
|
75
|
-
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)??``)+`',
|
|
76
65
|
WITH_CREDENTIALS: config?.WITH_CREDENTIALS ?? false,
|
|
77
66
|
CREDENTIALS: config?.CREDENTIALS ?? 'include',
|
|
78
67
|
TOKEN: config?.TOKEN,
|
|
@@ -86,13 +75,13 @@ export class `+((s=i(a(l(l(r,"root"),"$config"),"name",{start:{line:57,column:16
|
|
|
86
75
|
},
|
|
87
76
|
});
|
|
88
77
|
|
|
89
|
-
`+((
|
|
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}}})??``)+` }
|
|
90
79
|
}
|
|
91
|
-
`},12:function(e,n,
|
|
92
|
-
`},14:function(e,n,
|
|
93
|
-
`},compiler:[8
|
|
94
|
-
`+((
|
|
95
|
-
`+((
|
|
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> => {
|
|
96
85
|
return forkJoin({
|
|
97
86
|
// @ts-ignore
|
|
98
87
|
token: resolve(options, config.TOKEN),
|
|
@@ -139,7 +128,7 @@ export class `+((s=i(a(l(l(r,"root"),"$config"),"name",{start:{line:57,column:16
|
|
|
139
128
|
return new HttpHeaders(headers);
|
|
140
129
|
}),
|
|
141
130
|
);
|
|
142
|
-
};`},useData
|
|
131
|
+
};`},useData:!0},Pe={compiler:[8,`>= 4.3.0`],main:function(e,t,n,r,i){return`export const getRequestBody = (options: ApiRequestOptions): unknown => {
|
|
143
132
|
if (options.body) {
|
|
144
133
|
if (options.mediaType?.includes('application/json') || options.mediaType?.includes('+json')) {
|
|
145
134
|
return JSON.stringify(options.body);
|
|
@@ -150,12 +139,12 @@ export class `+((s=i(a(l(l(r,"root"),"$config"),"name",{start:{line:57,column:16
|
|
|
150
139
|
}
|
|
151
140
|
}
|
|
152
141
|
return undefined;
|
|
153
|
-
};`},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 => {
|
|
154
143
|
if (response.status !== 204 && response.body !== null) {
|
|
155
144
|
return response.body;
|
|
156
145
|
}
|
|
157
146
|
return undefined;
|
|
158
|
-
};`},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 => {
|
|
159
148
|
if (responseHeader) {
|
|
160
149
|
const value = response.headers.get(responseHeader);
|
|
161
150
|
if (isString(value)) {
|
|
@@ -163,7 +152,7 @@ export class `+((s=i(a(l(l(r,"root"),"$config"),"name",{start:{line:57,column:16
|
|
|
163
152
|
}
|
|
164
153
|
}
|
|
165
154
|
return undefined;
|
|
166
|
-
};`},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';
|
|
167
156
|
import type { HttpResponse, HttpErrorResponse } from '@angular/common/http';
|
|
168
157
|
import { forkJoin, of, throwError } from 'rxjs';
|
|
169
158
|
import { catchError, map, switchMap } from 'rxjs/operators';
|
|
@@ -174,35 +163,35 @@ import type { ApiRequestOptions } from './ApiRequestOptions';
|
|
|
174
163
|
import type { ApiResult } from './ApiResult';
|
|
175
164
|
import type { OpenAPIConfig } from './OpenAPI';
|
|
176
165
|
|
|
177
|
-
`+(
|
|
166
|
+
`+(e.invokePartial(a(r,`functions/isString`),t,{name:`functions/isString`,data:i,helpers:n,partials:r,decorators:e.decorators})??``)+`
|
|
178
167
|
|
|
179
|
-
`+(
|
|
168
|
+
`+(e.invokePartial(a(r,`functions/isStringWithValue`),t,{name:`functions/isStringWithValue`,data:i,helpers:n,partials:r,decorators:e.decorators})??``)+`
|
|
180
169
|
|
|
181
|
-
`+(
|
|
170
|
+
`+(e.invokePartial(a(r,`functions/isBlob`),t,{name:`functions/isBlob`,data:i,helpers:n,partials:r,decorators:e.decorators})??``)+`
|
|
182
171
|
|
|
183
|
-
`+(
|
|
172
|
+
`+(e.invokePartial(a(r,`functions/isFormData`),t,{name:`functions/isFormData`,data:i,helpers:n,partials:r,decorators:e.decorators})??``)+`
|
|
184
173
|
|
|
185
|
-
`+(
|
|
174
|
+
`+(e.invokePartial(a(r,`functions/base64`),t,{name:`functions/base64`,data:i,helpers:n,partials:r,decorators:e.decorators})??``)+`
|
|
186
175
|
|
|
187
|
-
`+(
|
|
176
|
+
`+(e.invokePartial(a(r,`functions/getQueryString`),t,{name:`functions/getQueryString`,data:i,helpers:n,partials:r,decorators:e.decorators})??``)+`
|
|
188
177
|
|
|
189
|
-
`+(
|
|
178
|
+
`+(e.invokePartial(a(r,`functions/getUrl`),t,{name:`functions/getUrl`,data:i,helpers:n,partials:r,decorators:e.decorators})??``)+`
|
|
190
179
|
|
|
191
|
-
`+(
|
|
180
|
+
`+(e.invokePartial(a(r,`functions/getFormData`),t,{name:`functions/getFormData`,data:i,helpers:n,partials:r,decorators:e.decorators})??``)+`
|
|
192
181
|
|
|
193
|
-
`+(
|
|
182
|
+
`+(e.invokePartial(a(r,`functions/resolve`),t,{name:`functions/resolve`,data:i,helpers:n,partials:r,decorators:e.decorators})??``)+`
|
|
194
183
|
|
|
195
|
-
`+(
|
|
184
|
+
`+(e.invokePartial(a(r,`angular/getHeaders`),t,{name:`angular/getHeaders`,data:i,helpers:n,partials:r,decorators:e.decorators})??``)+`
|
|
196
185
|
|
|
197
|
-
`+(
|
|
186
|
+
`+(e.invokePartial(a(r,`angular/getRequestBody`),t,{name:`angular/getRequestBody`,data:i,helpers:n,partials:r,decorators:e.decorators})??``)+`
|
|
198
187
|
|
|
199
|
-
`+(
|
|
188
|
+
`+(e.invokePartial(a(r,`angular/sendRequest`),t,{name:`angular/sendRequest`,data:i,helpers:n,partials:r,decorators:e.decorators})??``)+`
|
|
200
189
|
|
|
201
|
-
`+(
|
|
190
|
+
`+(e.invokePartial(a(r,`angular/getResponseHeader`),t,{name:`angular/getResponseHeader`,data:i,helpers:n,partials:r,decorators:e.decorators})??``)+`
|
|
202
191
|
|
|
203
|
-
`+(
|
|
192
|
+
`+(e.invokePartial(a(r,`angular/getResponseBody`),t,{name:`angular/getResponseBody`,data:i,helpers:n,partials:r,decorators:e.decorators})??``)+`
|
|
204
193
|
|
|
205
|
-
`+(
|
|
194
|
+
`+(e.invokePartial(a(r,`functions/catchErrorCodes`),t,{name:`functions/catchErrorCodes`,data:i,helpers:n,partials:r,decorators:e.decorators})??``)+`
|
|
206
195
|
|
|
207
196
|
/**
|
|
208
197
|
* Request method
|
|
@@ -261,7 +250,7 @@ export const request = <T>(config: OpenAPIConfig, http: HttpClient, options: Api
|
|
|
261
250
|
return throwError(() => error);
|
|
262
251
|
}),
|
|
263
252
|
);
|
|
264
|
-
};`},usePartial
|
|
253
|
+
};`},usePartial:!0,useData:!0},Re={compiler:[8,`>= 4.3.0`],main:function(e,t,n,r,i){return`export const sendRequest = <T>(
|
|
265
254
|
config: OpenAPIConfig,
|
|
266
255
|
options: ApiRequestOptions<T>,
|
|
267
256
|
http: HttpClient,
|
|
@@ -276,7 +265,7 @@ export const request = <T>(config: OpenAPIConfig, http: HttpClient, options: Api
|
|
|
276
265
|
withCredentials: config.WITH_CREDENTIALS,
|
|
277
266
|
observe: 'response',
|
|
278
267
|
});
|
|
279
|
-
};`},useData
|
|
268
|
+
};`},useData:!0},ze={compiler:[8,`>= 4.3.0`],main:function(e,t,n,r,i){return`import type { ApiRequestOptions } from './ApiRequestOptions';
|
|
280
269
|
import type { ApiResult } from './ApiResult';
|
|
281
270
|
|
|
282
271
|
export class ApiError extends Error {
|
|
@@ -296,7 +285,7 @@ export class ApiError extends Error {
|
|
|
296
285
|
this.body = response.body;
|
|
297
286
|
this.request = request;
|
|
298
287
|
}
|
|
299
|
-
}`},useData
|
|
288
|
+
}`},useData:!0},Be={compiler:[8,`>= 4.3.0`],main:function(e,t,n,r,i){return`export type ApiRequestOptions<T = unknown> = {
|
|
300
289
|
readonly body?: any;
|
|
301
290
|
readonly cookies?: Record<string, unknown>;
|
|
302
291
|
readonly errors?: Record<number | string, string>;
|
|
@@ -316,13 +305,13 @@ export class ApiError extends Error {
|
|
|
316
305
|
readonly responseHeader?: string;
|
|
317
306
|
readonly responseTransformer?: (data: unknown) => Promise<T>;
|
|
318
307
|
readonly url: string;
|
|
319
|
-
};`},useData
|
|
308
|
+
};`},useData:!0},Ve={compiler:[8,`>= 4.3.0`],main:function(e,t,n,r,i){return`export type ApiResult<TData = any> = {
|
|
320
309
|
readonly body: TData;
|
|
321
310
|
readonly ok: boolean;
|
|
322
311
|
readonly status: number;
|
|
323
312
|
readonly statusText: string;
|
|
324
313
|
readonly url: string;
|
|
325
|
-
};`},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>> => {
|
|
326
315
|
const [token, username, password, additionalHeaders] = await Promise.all([
|
|
327
316
|
// @ts-ignore
|
|
328
317
|
resolve(options, config.TOKEN),
|
|
@@ -371,17 +360,17 @@ export class ApiError extends Error {
|
|
|
371
360
|
}
|
|
372
361
|
|
|
373
362
|
return headers;
|
|
374
|
-
};`},useData
|
|
363
|
+
};`},useData:!0},Ue={compiler:[8,`>= 4.3.0`],main:function(e,t,n,r,i){return`export const getRequestBody = (options: ApiRequestOptions): unknown => {
|
|
375
364
|
if (options.body) {
|
|
376
365
|
return options.body;
|
|
377
366
|
}
|
|
378
367
|
return undefined;
|
|
379
|
-
};`},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 => {
|
|
380
369
|
if (response.status !== 204) {
|
|
381
370
|
return response.data;
|
|
382
371
|
}
|
|
383
372
|
return undefined;
|
|
384
|
-
};`},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 => {
|
|
385
374
|
if (responseHeader) {
|
|
386
375
|
const content = response.headers[responseHeader];
|
|
387
376
|
if (isString(content)) {
|
|
@@ -389,7 +378,7 @@ export class ApiError extends Error {
|
|
|
389
378
|
}
|
|
390
379
|
}
|
|
391
380
|
return undefined;
|
|
392
|
-
};`},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';
|
|
393
382
|
import type { AxiosError, AxiosRequestConfig, AxiosResponse, AxiosInstance } from 'axios';
|
|
394
383
|
|
|
395
384
|
import { ApiError } from './ApiError';
|
|
@@ -399,47 +388,47 @@ import { CancelablePromise } from './CancelablePromise';
|
|
|
399
388
|
import type { OnCancel } from './CancelablePromise';
|
|
400
389
|
import type { OpenAPIConfig } from './OpenAPI';
|
|
401
390
|
|
|
402
|
-
`+(
|
|
391
|
+
`+(e.invokePartial(o(r,`functions/isString`),t,{name:`functions/isString`,data:i,helpers:n,partials:r,decorators:e.decorators})??``)+`
|
|
403
392
|
|
|
404
|
-
`+(
|
|
393
|
+
`+(e.invokePartial(o(r,`functions/isStringWithValue`),t,{name:`functions/isStringWithValue`,data:i,helpers:n,partials:r,decorators:e.decorators})??``)+`
|
|
405
394
|
|
|
406
|
-
`+(
|
|
395
|
+
`+(e.invokePartial(o(r,`functions/isBlob`),t,{name:`functions/isBlob`,data:i,helpers:n,partials:r,decorators:e.decorators})??``)+`
|
|
407
396
|
|
|
408
|
-
`+(
|
|
397
|
+
`+(e.invokePartial(o(r,`functions/isFormData`),t,{name:`functions/isFormData`,data:i,helpers:n,partials:r,decorators:e.decorators})??``)+`
|
|
409
398
|
|
|
410
|
-
`+(
|
|
399
|
+
`+(e.invokePartial(o(r,`functions/isSuccess`),t,{name:`functions/isSuccess`,data:i,helpers:n,partials:r,decorators:e.decorators})??``)+`
|
|
411
400
|
|
|
412
|
-
`+(
|
|
401
|
+
`+(e.invokePartial(o(r,`functions/base64`),t,{name:`functions/base64`,data:i,helpers:n,partials:r,decorators:e.decorators})??``)+`
|
|
413
402
|
|
|
414
|
-
`+(
|
|
403
|
+
`+(e.invokePartial(o(r,`functions/getQueryString`),t,{name:`functions/getQueryString`,data:i,helpers:n,partials:r,decorators:e.decorators})??``)+`
|
|
415
404
|
|
|
416
|
-
`+(
|
|
405
|
+
`+(e.invokePartial(o(r,`functions/getUrl`),t,{name:`functions/getUrl`,data:i,helpers:n,partials:r,decorators:e.decorators})??``)+`
|
|
417
406
|
|
|
418
|
-
`+(
|
|
407
|
+
`+(e.invokePartial(o(r,`functions/getFormData`),t,{name:`functions/getFormData`,data:i,helpers:n,partials:r,decorators:e.decorators})??``)+`
|
|
419
408
|
|
|
420
|
-
`+(
|
|
409
|
+
`+(e.invokePartial(o(r,`functions/resolve`),t,{name:`functions/resolve`,data:i,helpers:n,partials:r,decorators:e.decorators})??``)+`
|
|
421
410
|
|
|
422
|
-
`+(
|
|
411
|
+
`+(e.invokePartial(o(r,`axios/getHeaders`),t,{name:`axios/getHeaders`,data:i,helpers:n,partials:r,decorators:e.decorators})??``)+`
|
|
423
412
|
|
|
424
|
-
`+(
|
|
413
|
+
`+(e.invokePartial(o(r,`axios/getRequestBody`),t,{name:`axios/getRequestBody`,data:i,helpers:n,partials:r,decorators:e.decorators})??``)+`
|
|
425
414
|
|
|
426
|
-
`+(
|
|
415
|
+
`+(e.invokePartial(o(r,`axios/sendRequest`),t,{name:`axios/sendRequest`,data:i,helpers:n,partials:r,decorators:e.decorators})??``)+`
|
|
427
416
|
|
|
428
|
-
`+(
|
|
417
|
+
`+(e.invokePartial(o(r,`axios/getResponseHeader`),t,{name:`axios/getResponseHeader`,data:i,helpers:n,partials:r,decorators:e.decorators})??``)+`
|
|
429
418
|
|
|
430
|
-
`+(
|
|
419
|
+
`+(e.invokePartial(o(r,`axios/getResponseBody`),t,{name:`axios/getResponseBody`,data:i,helpers:n,partials:r,decorators:e.decorators})??``)+`
|
|
431
420
|
|
|
432
|
-
`+(
|
|
421
|
+
`+(e.invokePartial(o(r,`functions/catchErrorCodes`),t,{name:`functions/catchErrorCodes`,data:i,helpers:n,partials:r,decorators:e.decorators})??``)+`
|
|
433
422
|
|
|
434
423
|
/**
|
|
435
424
|
* Request method
|
|
436
425
|
* @param config The OpenAPI configuration object
|
|
437
426
|
* @param options The request options from the service
|
|
438
427
|
* @param axiosClient The axios client instance to use
|
|
439
|
-
* @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}}})??``)+`>
|
|
440
429
|
* @throws ApiError
|
|
441
430
|
*/
|
|
442
|
-
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}}})??``)+`> => {
|
|
443
432
|
return new CancelablePromise(async (resolve, reject, onCancel) => {
|
|
444
433
|
try {
|
|
445
434
|
const url = getUrl(config, options);
|
|
@@ -472,13 +461,13 @@ export const request = <T>(config: OpenAPIConfig, options: ApiRequestOptions<T>,
|
|
|
472
461
|
|
|
473
462
|
catchErrorCodes(options, result);
|
|
474
463
|
|
|
475
|
-
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}}})??``)+`);
|
|
476
465
|
}
|
|
477
466
|
} catch (error) {
|
|
478
467
|
reject(error);
|
|
479
468
|
}
|
|
480
469
|
});
|
|
481
|
-
};`},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>(
|
|
482
471
|
config: OpenAPIConfig,
|
|
483
472
|
options: ApiRequestOptions<T>,
|
|
484
473
|
url: string,
|
|
@@ -514,26 +503,26 @@ export const request = <T>(config: OpenAPIConfig, options: ApiRequestOptions<T>,
|
|
|
514
503
|
}
|
|
515
504
|
throw error;
|
|
516
505
|
}
|
|
517
|
-
};`},useData
|
|
506
|
+
};`},useData:!0},Je={1:function(e,t,n,r,i){return`import type { HttpClient } from '@angular/common/http';
|
|
518
507
|
import type { Observable } from 'rxjs';
|
|
519
508
|
|
|
520
509
|
import type { ApiRequestOptions } from './ApiRequestOptions';
|
|
521
510
|
import type { OpenAPIConfig } from './OpenAPI';
|
|
522
|
-
`},3:function(e,n,
|
|
511
|
+
`},3:function(e,t,n,r,i){return`import type { ApiRequestOptions } from './ApiRequestOptions';
|
|
523
512
|
import type { CancelablePromise } from './CancelablePromise';
|
|
524
513
|
import type { OpenAPIConfig } from './OpenAPI';
|
|
525
|
-
`},5:function(e,n,
|
|
514
|
+
`},5:function(e,t,n,r,i){return` constructor(
|
|
526
515
|
public readonly config: OpenAPIConfig,
|
|
527
516
|
public readonly http: HttpClient,
|
|
528
517
|
) {}
|
|
529
|
-
`},7:function(e,n,
|
|
530
|
-
`},9:function(e,n,
|
|
531
|
-
`},11:function(e,n,
|
|
532
|
-
`},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}}})??``)+`
|
|
533
522
|
export abstract class BaseHttpRequest {
|
|
534
523
|
|
|
535
|
-
`+((
|
|
536
|
-
`+((
|
|
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 {
|
|
537
526
|
constructor(message: string) {
|
|
538
527
|
super(message);
|
|
539
528
|
this.name = 'CancelError';
|
|
@@ -658,7 +647,7 @@ export class CancelablePromise<T> implements Promise<T> {
|
|
|
658
647
|
public get isCancelled(): boolean {
|
|
659
648
|
return this._isCancelled;
|
|
660
649
|
}
|
|
661
|
-
}`},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> => {
|
|
662
651
|
const [token, username, password, additionalHeaders] = await Promise.all([
|
|
663
652
|
// @ts-ignore
|
|
664
653
|
resolve(options, config.TOKEN),
|
|
@@ -703,7 +692,7 @@ export class CancelablePromise<T> implements Promise<T> {
|
|
|
703
692
|
}
|
|
704
693
|
|
|
705
694
|
return new Headers(headers);
|
|
706
|
-
};`},useData
|
|
695
|
+
};`},useData:!0},Ze={compiler:[8,`>= 4.3.0`],main:function(e,t,n,r,i){return`export const getRequestBody = (options: ApiRequestOptions): unknown => {
|
|
707
696
|
if (options.body !== undefined) {
|
|
708
697
|
if (options.mediaType?.includes('application/json') || options.mediaType?.includes('+json')) {
|
|
709
698
|
return JSON.stringify(options.body);
|
|
@@ -714,7 +703,7 @@ export class CancelablePromise<T> implements Promise<T> {
|
|
|
714
703
|
}
|
|
715
704
|
}
|
|
716
705
|
return undefined;
|
|
717
|
-
};`},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> => {
|
|
718
707
|
if (response.status !== 204) {
|
|
719
708
|
try {
|
|
720
709
|
const contentType = response.headers.get('Content-Type');
|
|
@@ -735,7 +724,7 @@ export class CancelablePromise<T> implements Promise<T> {
|
|
|
735
724
|
}
|
|
736
725
|
}
|
|
737
726
|
return undefined;
|
|
738
|
-
};`},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 => {
|
|
739
728
|
if (responseHeader) {
|
|
740
729
|
const content = response.headers.get(responseHeader);
|
|
741
730
|
if (isString(content)) {
|
|
@@ -743,54 +732,54 @@ export class CancelablePromise<T> implements Promise<T> {
|
|
|
743
732
|
}
|
|
744
733
|
}
|
|
745
734
|
return undefined;
|
|
746
|
-
};`},useData
|
|
735
|
+
};`},useData:!0},et={1:function(e,t,n,r,i){return`import fetch, { FormData, Headers } from 'node-fetch';
|
|
747
736
|
import type { RequestInit, Response } from 'node-fetch';
|
|
748
737
|
|
|
749
|
-
`},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';
|
|
750
739
|
import type { ApiRequestOptions } from './ApiRequestOptions';
|
|
751
740
|
import type { ApiResult } from './ApiResult';
|
|
752
741
|
import { CancelablePromise } from './CancelablePromise';
|
|
753
742
|
import type { OnCancel } from './CancelablePromise';
|
|
754
743
|
import type { OpenAPIConfig } from './OpenAPI';
|
|
755
744
|
|
|
756
|
-
`+(
|
|
745
|
+
`+(e.invokePartial(o(r,`functions/isString`),t,{name:`functions/isString`,data:i,helpers:n,partials:r,decorators:e.decorators})??``)+`
|
|
757
746
|
|
|
758
|
-
`+(
|
|
747
|
+
`+(e.invokePartial(o(r,`functions/isStringWithValue`),t,{name:`functions/isStringWithValue`,data:i,helpers:n,partials:r,decorators:e.decorators})??``)+`
|
|
759
748
|
|
|
760
|
-
`+(
|
|
749
|
+
`+(e.invokePartial(o(r,`functions/isBlob`),t,{name:`functions/isBlob`,data:i,helpers:n,partials:r,decorators:e.decorators})??``)+`
|
|
761
750
|
|
|
762
|
-
`+(
|
|
751
|
+
`+(e.invokePartial(o(r,`functions/isFormData`),t,{name:`functions/isFormData`,data:i,helpers:n,partials:r,decorators:e.decorators})??``)+`
|
|
763
752
|
|
|
764
|
-
`+(
|
|
753
|
+
`+(e.invokePartial(o(r,`functions/base64`),t,{name:`functions/base64`,data:i,helpers:n,partials:r,decorators:e.decorators})??``)+`
|
|
765
754
|
|
|
766
|
-
`+(
|
|
755
|
+
`+(e.invokePartial(o(r,`functions/getQueryString`),t,{name:`functions/getQueryString`,data:i,helpers:n,partials:r,decorators:e.decorators})??``)+`
|
|
767
756
|
|
|
768
|
-
`+(
|
|
757
|
+
`+(e.invokePartial(o(r,`functions/getUrl`),t,{name:`functions/getUrl`,data:i,helpers:n,partials:r,decorators:e.decorators})??``)+`
|
|
769
758
|
|
|
770
|
-
`+(
|
|
759
|
+
`+(e.invokePartial(o(r,`functions/getFormData`),t,{name:`functions/getFormData`,data:i,helpers:n,partials:r,decorators:e.decorators})??``)+`
|
|
771
760
|
|
|
772
|
-
`+(
|
|
761
|
+
`+(e.invokePartial(o(r,`functions/resolve`),t,{name:`functions/resolve`,data:i,helpers:n,partials:r,decorators:e.decorators})??``)+`
|
|
773
762
|
|
|
774
|
-
`+(
|
|
763
|
+
`+(e.invokePartial(o(r,`fetch/getHeaders`),t,{name:`fetch/getHeaders`,data:i,helpers:n,partials:r,decorators:e.decorators})??``)+`
|
|
775
764
|
|
|
776
|
-
`+(
|
|
765
|
+
`+(e.invokePartial(o(r,`fetch/getRequestBody`),t,{name:`fetch/getRequestBody`,data:i,helpers:n,partials:r,decorators:e.decorators})??``)+`
|
|
777
766
|
|
|
778
|
-
`+(
|
|
767
|
+
`+(e.invokePartial(o(r,`fetch/sendRequest`),t,{name:`fetch/sendRequest`,data:i,helpers:n,partials:r,decorators:e.decorators})??``)+`
|
|
779
768
|
|
|
780
|
-
`+(
|
|
769
|
+
`+(e.invokePartial(o(r,`fetch/getResponseHeader`),t,{name:`fetch/getResponseHeader`,data:i,helpers:n,partials:r,decorators:e.decorators})??``)+`
|
|
781
770
|
|
|
782
|
-
`+(
|
|
771
|
+
`+(e.invokePartial(o(r,`fetch/getResponseBody`),t,{name:`fetch/getResponseBody`,data:i,helpers:n,partials:r,decorators:e.decorators})??``)+`
|
|
783
772
|
|
|
784
|
-
`+(
|
|
773
|
+
`+(e.invokePartial(o(r,`functions/catchErrorCodes`),t,{name:`functions/catchErrorCodes`,data:i,helpers:n,partials:r,decorators:e.decorators})??``)+`
|
|
785
774
|
|
|
786
775
|
/**
|
|
787
776
|
* Request method
|
|
788
777
|
* @param config The OpenAPI configuration object
|
|
789
778
|
* @param options The request options from the service
|
|
790
|
-
* @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}}})??``)+`>
|
|
791
780
|
* @throws ApiError
|
|
792
781
|
*/
|
|
793
|
-
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}}})??``)+`> => {
|
|
794
783
|
return new CancelablePromise(async (resolve, reject, onCancel) => {
|
|
795
784
|
try {
|
|
796
785
|
const url = getUrl(config, options);
|
|
@@ -823,16 +812,16 @@ export const request = <T>(config: OpenAPIConfig, options: ApiRequestOptions<T>)
|
|
|
823
812
|
|
|
824
813
|
catchErrorCodes(options, result);
|
|
825
814
|
|
|
826
|
-
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}}})??``)+`);
|
|
827
816
|
}
|
|
828
817
|
} catch (error) {
|
|
829
818
|
reject(error);
|
|
830
819
|
}
|
|
831
820
|
});
|
|
832
|
-
};`},usePartial
|
|
821
|
+
};`},usePartial:!0,useData:!0},tt={1:function(e,t,n,r,i){return` if (config.WITH_CREDENTIALS) {
|
|
833
822
|
request.credentials = config.CREDENTIALS;
|
|
834
823
|
}
|
|
835
|
-
`},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 (
|
|
836
825
|
config: OpenAPIConfig,
|
|
837
826
|
options: ApiRequestOptions,
|
|
838
827
|
url: string,
|
|
@@ -850,7 +839,7 @@ export const request = <T>(config: OpenAPIConfig, options: ApiRequestOptions<T>)
|
|
|
850
839
|
signal: controller.signal,
|
|
851
840
|
};
|
|
852
841
|
|
|
853
|
-
`+(
|
|
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}}})??``)+`
|
|
854
843
|
for (const fn of config.interceptors.request._fns) {
|
|
855
844
|
request = await fn(request);
|
|
856
845
|
}
|
|
@@ -858,14 +847,14 @@ export const request = <T>(config: OpenAPIConfig, options: ApiRequestOptions<T>)
|
|
|
858
847
|
onCancel(() => controller.abort());
|
|
859
848
|
|
|
860
849
|
return await fetch(url, request);
|
|
861
|
-
};`},useData
|
|
850
|
+
};`},useData:!0},nt={compiler:[8,`>= 4.3.0`],main:function(e,t,n,r,i){return`export const base64 = (str: string): string => {
|
|
862
851
|
try {
|
|
863
852
|
return btoa(str);
|
|
864
853
|
} catch (err) {
|
|
865
854
|
// @ts-ignore
|
|
866
855
|
return Buffer.from(str).toString('base64');
|
|
867
856
|
}
|
|
868
|
-
};`},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 => {
|
|
869
858
|
const errors: Record<number, string> = {
|
|
870
859
|
400: 'Bad Request',
|
|
871
860
|
401: 'Unauthorized',
|
|
@@ -930,7 +919,7 @@ export const request = <T>(config: OpenAPIConfig, options: ApiRequestOptions<T>)
|
|
|
930
919
|
\`Generic Error: status: \${errorStatus}; status text: \${errorStatusText}; body: \${errorBody}\`
|
|
931
920
|
);
|
|
932
921
|
}
|
|
933
|
-
};`},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 => {
|
|
934
923
|
if (options.formData) {
|
|
935
924
|
const formData = new FormData();
|
|
936
925
|
|
|
@@ -955,7 +944,7 @@ export const request = <T>(config: OpenAPIConfig, options: ApiRequestOptions<T>)
|
|
|
955
944
|
return formData;
|
|
956
945
|
}
|
|
957
946
|
return undefined;
|
|
958
|
-
};`},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 => {
|
|
959
948
|
const qs: string[] = [];
|
|
960
949
|
|
|
961
950
|
const append = (key: string, value: unknown) => {
|
|
@@ -981,7 +970,7 @@ export const request = <T>(config: OpenAPIConfig, options: ApiRequestOptions<T>)
|
|
|
981
970
|
Object.entries(params).forEach(([key, value]) => encodePair(key, value));
|
|
982
971
|
|
|
983
972
|
return qs.length ? \`?\${qs.join('&')}\` : '';
|
|
984
|
-
};`},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 => {
|
|
985
974
|
const encoder = config.ENCODE_PATH || encodeURI;
|
|
986
975
|
|
|
987
976
|
const path = options.url
|
|
@@ -995,24 +984,24 @@ export const request = <T>(config: OpenAPIConfig, options: ApiRequestOptions<T>)
|
|
|
995
984
|
|
|
996
985
|
const url = config.BASE + path;
|
|
997
986
|
return options.query ? url + getQueryString(options.query) : url;
|
|
998
|
-
};`},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 => {
|
|
999
988
|
return value instanceof Blob;
|
|
1000
|
-
};`},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 => {
|
|
1001
990
|
return value instanceof FormData;
|
|
1002
|
-
};`},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 => {
|
|
1003
992
|
return typeof value === 'string';
|
|
1004
|
-
};`},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 => {
|
|
1005
994
|
return isString(value) && value !== '';
|
|
1006
|
-
};`},useData
|
|
995
|
+
};`},useData:!0},dt={compiler:[8,`>= 4.3.0`],main:function(e,t,n,r,i){return`export const isSuccess = (status: number): boolean => {
|
|
1007
996
|
return status >= 200 && status < 300;
|
|
1008
|
-
};`},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>;
|
|
1009
998
|
|
|
1010
999
|
export const resolve = async <T>(options: ApiRequestOptions<T>, resolver?: T | Resolver<T>): Promise<T | undefined> => {
|
|
1011
1000
|
if (typeof resolver === 'function') {
|
|
1012
1001
|
return (resolver as Resolver<T>)(options);
|
|
1013
1002
|
}
|
|
1014
1003
|
return resolver;
|
|
1015
|
-
};`},useData
|
|
1004
|
+
};`},useData:!0},pt={1:function(e,t,n,r,i){return`import { Inject, Injectable } from '@angular/core';
|
|
1016
1005
|
import { HttpClient } from '@angular/common/http';
|
|
1017
1006
|
import type { Observable } from 'rxjs';
|
|
1018
1007
|
|
|
@@ -1021,23 +1010,23 @@ import { BaseHttpRequest } from './BaseHttpRequest';
|
|
|
1021
1010
|
import type { OpenAPIConfig } from './OpenAPI';
|
|
1022
1011
|
import { OpenAPI } from './OpenAPI';
|
|
1023
1012
|
import { request as __request } from './request';
|
|
1024
|
-
`},3:function(e,n,
|
|
1013
|
+
`},3:function(e,t,n,r,i){return`import type { ApiRequestOptions } from './ApiRequestOptions';
|
|
1025
1014
|
import { BaseHttpRequest } from './BaseHttpRequest';
|
|
1026
1015
|
import type { CancelablePromise } from './CancelablePromise';
|
|
1027
1016
|
import type { OpenAPIConfig } from './OpenAPI';
|
|
1028
1017
|
import { request as __request } from './request';
|
|
1029
|
-
`},5:function(e,n,
|
|
1030
|
-
`},7:function(e,n,
|
|
1018
|
+
`},5:function(e,t,n,r,i){return`@Injectable()
|
|
1019
|
+
`},7:function(e,t,n,r,i){return` constructor(
|
|
1031
1020
|
@Inject(OpenAPI)
|
|
1032
1021
|
config: OpenAPIConfig,
|
|
1033
1022
|
http: HttpClient,
|
|
1034
1023
|
) {
|
|
1035
1024
|
super(config, http);
|
|
1036
1025
|
}
|
|
1037
|
-
`},9:function(e,n,
|
|
1026
|
+
`},9:function(e,t,n,r,i){return` constructor(config: OpenAPIConfig) {
|
|
1038
1027
|
super(config);
|
|
1039
1028
|
}
|
|
1040
|
-
`},11:function(e,n,
|
|
1029
|
+
`},11:function(e,t,n,r,i){return` /**
|
|
1041
1030
|
* Request method
|
|
1042
1031
|
* @param options The request options from the service
|
|
1043
1032
|
* @returns Observable<T>
|
|
@@ -1046,7 +1035,7 @@ import { request as __request } from './request';
|
|
|
1046
1035
|
public override request<T>(options: ApiRequestOptions<T>): Observable<T> {
|
|
1047
1036
|
return __request(this.config, this.http, options);
|
|
1048
1037
|
}
|
|
1049
|
-
`},13:function(e,n,
|
|
1038
|
+
`},13:function(e,t,n,r,i){return` /**
|
|
1050
1039
|
* Request method
|
|
1051
1040
|
* @param options The request options from the service
|
|
1052
1041
|
* @returns CancelablePromise<T>
|
|
@@ -1055,22 +1044,22 @@ import { request as __request } from './request';
|
|
|
1055
1044
|
public override request<T>(options: ApiRequestOptions<T>): CancelablePromise<T> {
|
|
1056
1045
|
return __request(this.config, options);
|
|
1057
1046
|
}
|
|
1058
|
-
`},compiler:[8
|
|
1059
|
-
`+((
|
|
1060
|
-
|
|
1061
|
-
`+((
|
|
1062
|
-
`+((
|
|
1063
|
-
`},3:function(e,n,
|
|
1064
|
-
`},5:function(e,n,
|
|
1065
|
-
`},7:function(e,n,
|
|
1066
|
-
`},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>;
|
|
1067
1056
|
response: Interceptors<AxiosResponse>;
|
|
1068
|
-
`},11:function(e,n,
|
|
1057
|
+
`},11:function(e,t,n,r,i){return` request: Interceptors<RequestInit>;
|
|
1069
1058
|
response: Interceptors<Response>;
|
|
1070
|
-
`},13:function(e,n,
|
|
1059
|
+
`},13:function(e,t,n,r,i){return` request: Interceptors<XMLHttpRequest>;
|
|
1071
1060
|
response: Interceptors<XMLHttpRequest>;
|
|
1072
|
-
`},15:function(e,n,
|
|
1073
|
-
`},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';
|
|
1074
1063
|
|
|
1075
1064
|
type Headers = Record<string, string>;
|
|
1076
1065
|
type Middleware<T> = (value: T) => T | Promise<T>;
|
|
@@ -1106,23 +1095,23 @@ export type OpenAPIConfig = {
|
|
|
1106
1095
|
VERSION: string;
|
|
1107
1096
|
WITH_CREDENTIALS: boolean;
|
|
1108
1097
|
interceptors: {
|
|
1109
|
-
`+((
|
|
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}}})??``)+` };
|
|
1110
1099
|
};
|
|
1111
1100
|
|
|
1112
1101
|
export const OpenAPI: OpenAPIConfig = {
|
|
1113
|
-
BASE: '`+(
|
|
1102
|
+
BASE: '`+(s(o(t,`server`,{start:{line:69,column:11},end:{line:69,column:17}}),t)??``)+`',
|
|
1114
1103
|
CREDENTIALS: 'include',
|
|
1115
1104
|
ENCODE_PATH: undefined,
|
|
1116
1105
|
HEADERS: undefined,
|
|
1117
1106
|
PASSWORD: undefined,
|
|
1118
1107
|
TOKEN: undefined,
|
|
1119
1108
|
USERNAME: undefined,
|
|
1120
|
-
VERSION: '`+(
|
|
1109
|
+
VERSION: '`+(s(o(t,`version`,{start:{line:76,column:14},end:{line:76,column:21}}),t)??``)+`',
|
|
1121
1110
|
WITH_CREDENTIALS: false,
|
|
1122
1111
|
interceptors: {
|
|
1123
|
-
`+((
|
|
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(),
|
|
1124
1113
|
},
|
|
1125
|
-
};`},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> => {
|
|
1126
1115
|
const [token, username, password, additionalHeaders] = await Promise.all([
|
|
1127
1116
|
// @ts-ignore
|
|
1128
1117
|
resolve(options, config.TOKEN),
|
|
@@ -1167,7 +1156,7 @@ export const OpenAPI: OpenAPIConfig = {
|
|
|
1167
1156
|
}
|
|
1168
1157
|
|
|
1169
1158
|
return new Headers(headers);
|
|
1170
|
-
};`},useData
|
|
1159
|
+
};`},useData:!0},_t={compiler:[8,`>= 4.3.0`],main:function(e,t,n,r,i){return`export const getRequestBody = (options: ApiRequestOptions): unknown => {
|
|
1171
1160
|
if (options.body !== undefined) {
|
|
1172
1161
|
if (options.mediaType?.includes('application/json') || options.mediaType?.includes('+json')) {
|
|
1173
1162
|
return JSON.stringify(options.body);
|
|
@@ -1178,7 +1167,7 @@ export const OpenAPI: OpenAPIConfig = {
|
|
|
1178
1167
|
}
|
|
1179
1168
|
}
|
|
1180
1169
|
return undefined;
|
|
1181
|
-
};`},useData
|
|
1170
|
+
};`},useData:!0},vt={compiler:[8,`>= 4.3.0`],main:function(e,t,n,r,i){return`export const getResponseBody = (xhr: XMLHttpRequest): unknown => {
|
|
1182
1171
|
if (xhr.status !== 204) {
|
|
1183
1172
|
try {
|
|
1184
1173
|
const contentType = xhr.getResponseHeader('Content-Type');
|
|
@@ -1194,7 +1183,7 @@ export const OpenAPI: OpenAPIConfig = {
|
|
|
1194
1183
|
}
|
|
1195
1184
|
}
|
|
1196
1185
|
return undefined;
|
|
1197
|
-
};`},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 => {
|
|
1198
1187
|
if (responseHeader) {
|
|
1199
1188
|
const content = xhr.getResponseHeader(responseHeader);
|
|
1200
1189
|
if (isString(content)) {
|
|
@@ -1202,53 +1191,53 @@ export const OpenAPI: OpenAPIConfig = {
|
|
|
1202
1191
|
}
|
|
1203
1192
|
}
|
|
1204
1193
|
return undefined;
|
|
1205
|
-
};`},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';
|
|
1206
1195
|
import type { ApiRequestOptions } from './ApiRequestOptions';
|
|
1207
1196
|
import type { ApiResult } from './ApiResult';
|
|
1208
1197
|
import { CancelablePromise } from './CancelablePromise';
|
|
1209
1198
|
import type { OnCancel } from './CancelablePromise';
|
|
1210
1199
|
import type { OpenAPIConfig } from './OpenAPI';
|
|
1211
1200
|
|
|
1212
|
-
`+(
|
|
1201
|
+
`+(e.invokePartial(o(r,`functions/isString`),t,{name:`functions/isString`,data:i,helpers:n,partials:r,decorators:e.decorators})??``)+`
|
|
1213
1202
|
|
|
1214
|
-
`+(
|
|
1203
|
+
`+(e.invokePartial(o(r,`functions/isStringWithValue`),t,{name:`functions/isStringWithValue`,data:i,helpers:n,partials:r,decorators:e.decorators})??``)+`
|
|
1215
1204
|
|
|
1216
|
-
`+(
|
|
1205
|
+
`+(e.invokePartial(o(r,`functions/isBlob`),t,{name:`functions/isBlob`,data:i,helpers:n,partials:r,decorators:e.decorators})??``)+`
|
|
1217
1206
|
|
|
1218
|
-
`+(
|
|
1207
|
+
`+(e.invokePartial(o(r,`functions/isFormData`),t,{name:`functions/isFormData`,data:i,helpers:n,partials:r,decorators:e.decorators})??``)+`
|
|
1219
1208
|
|
|
1220
|
-
`+(
|
|
1209
|
+
`+(e.invokePartial(o(r,`functions/isSuccess`),t,{name:`functions/isSuccess`,data:i,helpers:n,partials:r,decorators:e.decorators})??``)+`
|
|
1221
1210
|
|
|
1222
|
-
`+(
|
|
1211
|
+
`+(e.invokePartial(o(r,`functions/base64`),t,{name:`functions/base64`,data:i,helpers:n,partials:r,decorators:e.decorators})??``)+`
|
|
1223
1212
|
|
|
1224
|
-
`+(
|
|
1213
|
+
`+(e.invokePartial(o(r,`functions/getQueryString`),t,{name:`functions/getQueryString`,data:i,helpers:n,partials:r,decorators:e.decorators})??``)+`
|
|
1225
1214
|
|
|
1226
|
-
`+(
|
|
1215
|
+
`+(e.invokePartial(o(r,`functions/getUrl`),t,{name:`functions/getUrl`,data:i,helpers:n,partials:r,decorators:e.decorators})??``)+`
|
|
1227
1216
|
|
|
1228
|
-
`+(
|
|
1217
|
+
`+(e.invokePartial(o(r,`functions/getFormData`),t,{name:`functions/getFormData`,data:i,helpers:n,partials:r,decorators:e.decorators})??``)+`
|
|
1229
1218
|
|
|
1230
|
-
`+(
|
|
1219
|
+
`+(e.invokePartial(o(r,`functions/resolve`),t,{name:`functions/resolve`,data:i,helpers:n,partials:r,decorators:e.decorators})??``)+`
|
|
1231
1220
|
|
|
1232
|
-
`+(
|
|
1221
|
+
`+(e.invokePartial(o(r,`fetch/getHeaders`),t,{name:`fetch/getHeaders`,data:i,helpers:n,partials:r,decorators:e.decorators})??``)+`
|
|
1233
1222
|
|
|
1234
|
-
`+(
|
|
1223
|
+
`+(e.invokePartial(o(r,`xhr/getRequestBody`),t,{name:`xhr/getRequestBody`,data:i,helpers:n,partials:r,decorators:e.decorators})??``)+`
|
|
1235
1224
|
|
|
1236
|
-
`+(
|
|
1225
|
+
`+(e.invokePartial(o(r,`xhr/sendRequest`),t,{name:`xhr/sendRequest`,data:i,helpers:n,partials:r,decorators:e.decorators})??``)+`
|
|
1237
1226
|
|
|
1238
|
-
`+(
|
|
1227
|
+
`+(e.invokePartial(o(r,`xhr/getResponseHeader`),t,{name:`xhr/getResponseHeader`,data:i,helpers:n,partials:r,decorators:e.decorators})??``)+`
|
|
1239
1228
|
|
|
1240
|
-
`+(
|
|
1229
|
+
`+(e.invokePartial(o(r,`xhr/getResponseBody`),t,{name:`xhr/getResponseBody`,data:i,helpers:n,partials:r,decorators:e.decorators})??``)+`
|
|
1241
1230
|
|
|
1242
|
-
`+(
|
|
1231
|
+
`+(e.invokePartial(o(r,`functions/catchErrorCodes`),t,{name:`functions/catchErrorCodes`,data:i,helpers:n,partials:r,decorators:e.decorators})??``)+`
|
|
1243
1232
|
|
|
1244
1233
|
/**
|
|
1245
1234
|
* Request method
|
|
1246
1235
|
* @param config The OpenAPI configuration object
|
|
1247
1236
|
* @param options The request options from the service
|
|
1248
|
-
* @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}}})??``)+`>
|
|
1249
1238
|
* @throws ApiError
|
|
1250
1239
|
*/
|
|
1251
|
-
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}}})??``)+`> => {
|
|
1252
1241
|
return new CancelablePromise(async (resolve, reject, onCancel) => {
|
|
1253
1242
|
try {
|
|
1254
1243
|
const url = getUrl(config, options);
|
|
@@ -1281,13 +1270,13 @@ export const request = <T>(config: OpenAPIConfig, options: ApiRequestOptions<T>)
|
|
|
1281
1270
|
|
|
1282
1271
|
catchErrorCodes(options, result);
|
|
1283
1272
|
|
|
1284
|
-
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}}})??``)+`);
|
|
1285
1274
|
}
|
|
1286
1275
|
} catch (error) {
|
|
1287
1276
|
reject(error);
|
|
1288
1277
|
}
|
|
1289
1278
|
});
|
|
1290
|
-
};`},usePartial
|
|
1279
|
+
};`},usePartial:!0,useData:!0},xt={compiler:[8,`>= 4.3.0`],main:function(e,t,n,r,i){return`export const sendRequest = async (
|
|
1291
1280
|
config: OpenAPIConfig,
|
|
1292
1281
|
options: ApiRequestOptions,
|
|
1293
1282
|
url: string,
|
|
@@ -1317,5 +1306,5 @@ export const request = <T>(config: OpenAPIConfig, options: ApiRequestOptions<T>)
|
|
|
1317
1306
|
|
|
1318
1307
|
onCancel(() => xhr.abort());
|
|
1319
1308
|
});
|
|
1320
|
-
};`},useData
|
|
1309
|
+
};`},useData:!0};const St=()=>{N.registerHelper(`camelCase`,function(e){return D({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 _().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 se({config:_(),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:A.red,type:`duration`};if(t>30)return{color:A.red,type:`percentage`};if(e>50)return{color:A.yellow,type:`duration`};if(t>10)return{color:A.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?A.gray:A.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=A.gray(`[root] `);console.log(`${g}${A.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:D};A.enabled=ce().hasBasic;const Et=async(e,t=new Q)=>{let n=typeof e==`function`?await e():e,r=n?n instanceof Array?n:[n]:[],a=r.find(e=>v(e).level!==`silent`)?.logs;typeof a==`string`&&(a=v({logs:a}));let s;try{P();let e=t.timeEvent(`createClient`),n=t.timeEvent(`config`);s=await b({logger:t,userConfigs:r}),s.results.some(e=>e.config.logs.level!==`silent`)&&je(),n.timeEnd();let a=s.results.flatMap(e=>e.errors.map(t=>({error:t,jobIndex:e.jobIndex})));if(a.length)throw new i(a);let c=t.timeEvent(`handlebars`),l=Ct();c.timeEnd();let u=(await Promise.all(s.results.map(async e=>{try{return await q({config:e.config,dependencies:s.dependencies,jobIndex:e.jobIndex,logger:t,templates:l})}catch(t){throw new o(``,{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),u}catch(e){let t=s?.results??[],n=t.find(e=>e.config.logs.level!==`silent`)?.config.logs??t[0]?.config.logs??a,i=t.some(e=>e.config.dryRun)??r.some(e=>e.dryRun)??!1,o=n?.file&&!i?te(e,n.path??``):void 0;throw(!n||n.level!==`silent`)&&(ie({error:e,logPath:o}),await oe({error:e,isInteractive:t.some(e=>e.config.interactive)??r.some(e=>e.interactive)??!1})&&await C(e)),e}},Dt=async e=>typeof e==`function`?await e():e;export{Q as Logger,s as clientDefaultConfig,c as clientDefaultMeta,l as clientPluginHandler,u as compiler,Et as createClient,d as defaultPaginationKeywords,f as defaultPlugins,Dt as defineConfig,p as definePluginConfig,O as tsc,$ as utils};
|
|
1321
1310
|
//# sourceMappingURL=index.js.map
|