@spartaficial/openapi-to-k6 0.0.0-stage → 1.0.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.
@@ -0,0 +1,6 @@
1
+ /*!
2
+ * Copyright (c) 2026 Spartaficial - Cerios. All rights reserved.
3
+ * Proprietary software, licensed not sold. Unauthorized use, redistribution or
4
+ * circumvention of licensing is prohibited. See LICENSE for details.
5
+ */
6
+ const _0x1c4f06=_0x36ba;let e=require('@spartaficial/openapi-core'),t=require('@spartaficial/openapi-to-typescript'),n=require('node:fs'),r=require('node:path'),i=require('zod');var a=class extends e[_0x1c4f06(0x20c)]{constructor(_0x117ab3,_0x359263){super(_0x117ab3,'K6_CLIENT_GENERATION_ERROR',{'cause':_0x359263?.['message']}),this['name']='K6ClientGenerationError';}};function o(_0x2b8dbd,_0x4e19bb){const _0x57246a=_0x36ba;return _0x4e19bb[_0x57246a(0x183)]===0x0?'':_0x57246a(0x1a4)['concat'](''[_0x57246a(0x184)]((0x0,e['toPascalCase'])(_0x2b8dbd),_0x57246a(0x201)),'\x20=\x20{\x0a')[_0x57246a(0x184)](_0x4e19bb[_0x57246a(0x1c5)](_0x3c5771=>''['concat'](_0x3c5771[_0x57246a(0x1a1)]?_0x57246a(0x213)[_0x57246a(0x184)]((0x0,e['escapeJSDoc'])(_0x3c5771[_0x57246a(0x1a1)]),'\x20*/\x0a'):'','\x20\x20')[_0x57246a(0x184)]((0x0,e[_0x57246a(0x18d)])(_0x3c5771[_0x57246a(0x194)]))['concat'](_0x3c5771['required']?'':'?',':\x20')['concat'](_0x3c5771[_0x57246a(0x19e)],';'))['join']('\x0a'),_0x57246a(0x1ed));}function s(_0x25e9e3,_0x1c1db0,_0x48e5a8){const _0x2ae8c4=_0x36ba;return _0x1c1db0[_0x2ae8c4(0x183)]===0x0?'':_0x2ae8c4(0x1a4)['concat'](''[_0x2ae8c4(0x184)]((0x0,e['toPascalCase'])(_0x25e9e3))[_0x2ae8c4(0x184)](_0x48e5a8),'\x20=\x20{\x0a')['concat'](_0x1c1db0[_0x2ae8c4(0x1c5)](_0x1d9ab1=>''[_0x2ae8c4(0x184)](_0x1d9ab1[_0x2ae8c4(0x1a1)]?'\x20\x20/**\x20'[_0x2ae8c4(0x184)]((0x0,e['escapeJSDoc'])(_0x1d9ab1['description']),_0x2ae8c4(0x1e5)):'','\x20\x20')[_0x2ae8c4(0x184)]((0x0,e['formatPropertyName'])(_0x1d9ab1[_0x2ae8c4(0x194)]))['concat'](_0x1d9ab1[_0x2ae8c4(0x20a)]?'':'?',':\x20')['concat'](_0x1d9ab1[_0x2ae8c4(0x19e)],';'))['join']('\x0a'),'\x0a};');}function c(_0x1e6a93,_0x12ad6f){return s(_0x1e6a93,_0x12ad6f,'Headers');}function l(_0x5071b1,_0x83e89c){const _0x3886c5=_0x36ba;return s(_0x5071b1,_0x83e89c,_0x3886c5(0x1af));}function u(_0x6aa4b,_0x4241c6,_0x466dfc){const _0x5d66ed=_0x36ba;let {path:_0x1ce693,method:_0x4bf2de,methodName:_0x1c9353,pathParams:_0x4ae187,queryParams:_0x160912,requestBody:_0x65cda7}=_0x6aa4b,_0x34734b=_0x160912[_0x5d66ed(0x183)]>0x0,_0x3900da=!!_0x65cda7,_0x4a5bd7=[];for(let _0x2f0236 of _0x4ae187){let _0x1ec9e5=(0x0,e['sanitizeParamName'])(_0x2f0236);_0x4a5bd7[_0x5d66ed(0x206)](''['concat'](_0x1ec9e5,_0x5d66ed(0x1f7)));}let _0x43a01d=[];_0x34734b&&_0x43a01d[_0x5d66ed(0x206)]('params?:\x20QueryParams'),_0x43a01d['push'](_0x5d66ed(0x1a5)),_0x3900da&&_0x43a01d[_0x5d66ed(0x206)]('body?:\x20RequestBody\x20|\x20null'),_0x43a01d[_0x5d66ed(0x183)]>0x0&&_0x4a5bd7[_0x5d66ed(0x206)]('options?:\x20{\x0a\x20\x20\x20\x20'[_0x5d66ed(0x184)](_0x43a01d[_0x5d66ed(0x209)](';\x0a\x20\x20\x20\x20'),_0x5d66ed(0x205)));let _0x199a5f=(0x0,e['constructFullPath'])(_0x4241c6,_0x1ce693),_0x173e49=_0x199a5f,_0xd69c2=new Map(_0x6aa4b['pathParameters']['map'](_0x226c4f=>[_0x226c4f[_0x5d66ed(0x194)],_0x226c4f]));for(let _0x33ce8d of _0x4ae187){let _0x57f902=(0x0,e['sanitizeParamName'])(_0x33ce8d),_0x1b96dd=_0xd69c2[_0x5d66ed(0x217)](_0x33ce8d),_0xf02705=(0x0,e['resolvePathParameterSerialization'])(_0x1b96dd?.['style'],_0x1b96dd?.[_0x5d66ed(0x1cd)]),_0x48b712=(0x0,e['isNonDefaultPathSerialization'])(_0xf02705)?'${serializePathParam('['concat'](JSON[_0x5d66ed(0x1f3)](_0x33ce8d),',\x20')[_0x5d66ed(0x184)](_0x57f902,',\x20{\x20style:\x20')[_0x5d66ed(0x184)](JSON['stringify'](_0xf02705['style']),',\x20explode:\x20')[_0x5d66ed(0x184)](_0xf02705[_0x5d66ed(0x1cd)],'\x20})}'):_0x5d66ed(0x19d)['concat'](_0x57f902,_0x5d66ed(0x19f));_0x173e49=_0x173e49[_0x5d66ed(0x191)]('{'['concat'](_0x33ce8d,'}'),_0x48b712);}let _0x5098e5=(0x0,e[_0x5d66ed(0x1d3)])({'summary':_0x6aa4b['summary'],'description':_0x6aa4b[_0x5d66ed(0x1a1)],'deprecated':_0x6aa4b[_0x5d66ed(0x1f5)],'method':_0x6aa4b[_0x5d66ed(0x1c1)],'path':_0x199a5f,'includeDescriptions':_0x466dfc}),_0x35a065=_0x4bf2de['toUpperCase'](),_0xc5cb85=_0x160912[_0x5d66ed(0x1c5)](_0xc76753=>[_0xc76753[_0x5d66ed(0x194)],(0x0,e['resolveParameterSerialization'])(_0xc76753[_0x5d66ed(0x1b7)],_0xc76753['explode'],_0xc76753[_0x5d66ed(0x1b3)])])[_0x5d66ed(0x195)](([,_0x5019b4])=>(0x0,e[_0x5d66ed(0x202)])(_0x5019b4)),_0x45dcef=_0xc5cb85[_0x5d66ed(0x183)]>0x0?_0x5d66ed(0x18c)['concat'](_0xc5cb85[_0x5d66ed(0x1c5)](([_0x584c4d,_0x2f4299])=>''[_0x5d66ed(0x184)](JSON['stringify'](_0x584c4d),':\x20{\x20style:\x20')['concat'](JSON[_0x5d66ed(0x1f3)](_0x2f4299['style']),',\x20explode:\x20')['concat'](_0x2f4299[_0x5d66ed(0x1cd)])[_0x5d66ed(0x184)](_0x2f4299['allowReserved']?_0x5d66ed(0x190):'','\x20}'))['join'](',\x20'),'\x20}'):'',_0x197a39=_0x34734b?_0x5d66ed(0x200)['concat'](_0x173e49,_0x5d66ed(0x1bb))[_0x5d66ed(0x184)](_0x45dcef,');'):_0x5d66ed(0x200)[_0x5d66ed(0x184)](_0x173e49,'`;'),_0x52425f=_0x3900da?'options?.body':_0x5d66ed(0x1ea),_0x39a869=_0x65cda7?.[_0x5d66ed(0x1b9)]?.[_0x5d66ed(0x1ca)]()[_0x5d66ed(0x215)]('multipart/form-data'),_0x3fa649=_0x65cda7&&!_0x39a869?'\x22Content-Type\x22:\x20\x22'['concat'](_0x65cda7['contentType'],_0x5d66ed(0x1ab)):'';return'\x20\x20'[_0x5d66ed(0x184)](_0x5098e5,_0x5d66ed(0x1df))[_0x5d66ed(0x184)](_0x1c9353,'(')['concat'](_0x4a5bd7[_0x5d66ed(0x209)](',\x20'),'):\x20Response\x20{\x0a\x20\x20\x20\x20')['concat'](_0x197a39,_0x5d66ed(0x1b2))['concat'](_0x35a065,_0x5d66ed(0x1e7))[_0x5d66ed(0x184)](_0x52425f,_0x5d66ed(0x211))[_0x5d66ed(0x184)](_0x3fa649,_0x5d66ed(0x1e1));}function d(_0x5a0987,_0x2e9d99){const _0x143cde=_0x36ba;let _0x1b5bf6=(0x0,e['extractEndpoints'])(_0x5a0987,{'useOperationId':_0x2e9d99[_0x143cde(0x1cc)],'operationFilters':_0x2e9d99['operationFilters'],'ignoreHeaders':_0x2e9d99['ignoreHeaders'],'stripPathPrefix':_0x2e9d99[_0x143cde(0x1d2)],'preferredContentTypes':_0x2e9d99['preferredContentTypes']});if(_0x1b5bf6[_0x143cde(0x183)]===0x0)return'';let _0x3da0fd=[];for(let _0x4d4332 of _0x1b5bf6){let _0xd2b3f2=o(_0x4d4332['methodName'],_0x4d4332[_0x143cde(0x1a9)]);_0xd2b3f2&&_0x3da0fd[_0x143cde(0x206)](_0xd2b3f2);let _0x5568f1=c(_0x4d4332[_0x143cde(0x1f9)],_0x4d4332['headerParams']);_0x5568f1&&_0x3da0fd['push'](_0x5568f1);let _0xfa851e=l(_0x4d4332[_0x143cde(0x1f9)],_0x4d4332['cookieParams']);_0xfa851e&&_0x3da0fd['push'](_0xfa851e);}return _0x3da0fd[_0x143cde(0x183)]===0x0?'':''['concat'](_0x3da0fd[_0x143cde(0x209)]('\x0a\x0a'),'\x0a');}function f(_0x28029a,_0x115bd4,_0x1f8f64){const _0x20ce45=_0x36ba;let _0x2e2dd5=(0x0,e[_0x20ce45(0x17c)])(),_0x24b674=(0x0,e[_0x20ce45(0x180)])(_0x28029a,{'useOperationId':_0x115bd4['useOperationId'],'operationFilters':_0x115bd4['operationFilters'],'ignoreHeaders':_0x115bd4['ignoreHeaders'],'stripPathPrefix':_0x115bd4[_0x20ce45(0x1d2)],'preferredContentTypes':_0x115bd4[_0x20ce45(0x179)],'stats':_0x2e2dd5});if(_0x24b674['length']===0x0)return(0x0,e[_0x20ce45(0x19b)])(_0x2e2dd5,_0x115bd4['operationFilters'],_0x1f8f64),'';let _0x5ecd03=(0x0,e['deriveClassName'])(_0x115bd4[_0x20ce45(0x1d4)]),_0x4800b4=(0x0,e['normalizeBasePath'])(_0x115bd4['basePath']),_0x234fc9=_0x115bd4['includeDescriptions']??!0x0,_0x313a95=(0x0,e['createNameRegistry'])();for(let _0x44696b of _0x24b674){let _0x1f1d35=_0x313a95[_0x20ce45(0x198)](_0x44696b[_0x20ce45(0x1f9)],''[_0x20ce45(0x184)](_0x44696b['method']['toUpperCase'](),'\x20')['concat'](_0x44696b[_0x20ce45(0x1ce)]));_0x1f1d35!==void 0x0&&_0x1f8f64?.((0x0,e[_0x20ce45(0x1a6)])(_0x44696b['methodName'],''['concat'](_0x44696b[_0x20ce45(0x1c1)]['toUpperCase'](),'\x20')['concat'](_0x44696b['path']),_0x1f1d35));}let _0x23b75b=_0x24b674['some'](_0x5c6c7a=>_0x5c6c7a['queryParams'][_0x20ce45(0x183)]>0x0),_0x221e26=_0x24b674[_0x20ce45(0x1f2)](_0x46b857=>!!_0x46b857['requestBody']),_0x1e94f1=_0x24b674[_0x20ce45(0x1c5)](_0x50f2b4=>u(_0x50f2b4,_0x4800b4,_0x234fc9))[_0x20ce45(0x209)]('\x0a\x0a'),_0xc9976=[],_0x3367ea=[_0x20ce45(0x201),'Response'];_0x221e26&&_0x3367ea[_0x20ce45(0x206)]('RequestBody');let _0x168cce=[_0x20ce45(0x1ad),_0x20ce45(0x1b0)];_0x23b75b&&_0x168cce[_0x20ce45(0x1fa)]('buildQueryString'),_0x24b674[_0x20ce45(0x1f2)](_0x4cbaee=>_0x4cbaee[_0x20ce45(0x1b5)]['some'](_0x2694ef=>(0x0,e['isNonDefaultPathSerialization'])((0x0,e['resolvePathParameterSerialization'])(_0x2694ef[_0x20ce45(0x1b7)],_0x2694ef[_0x20ce45(0x1cd)]))))&&_0x168cce['push'](_0x20ce45(0x189));let _0x1924ee='import\x20http\x20from\x20\x22k6/http\x22;\x0aimport\x20type\x20{\x20'['concat'](_0x3367ea['join'](',\x20'),_0x20ce45(0x1d9));return _0x1924ee+=_0x23b75b?'\x0aimport\x20{\x20'['concat'](_0x168cce['join'](',\x20'),_0x20ce45(0x1e9)):_0x20ce45(0x1dc)[_0x20ce45(0x184)](_0x168cce['join'](',\x20'),'\x20}\x20from\x20\x22@spartaficial/openapi-to-k6/runtime\x22;'),_0xc9976['push'](_0x1924ee),_0xc9976['push'](_0x20ce45(0x1d6)[_0x20ce45(0x184)](_0x5ecd03,_0x20ce45(0x1eb))['concat'](_0x1e94f1,'\x0a}')),_0xc9976[_0x20ce45(0x209)]('\x0a');}function p(_0x4e93b8,_0x5522fb){const _0x5831e0=_0x36ba;return(0x0,e['getEndpointStats'])(_0x4e93b8,{'useOperationId':_0x5522fb['useOperationId'],'operationFilters':_0x5522fb[_0x5831e0(0x1c8)],'ignoreHeaders':_0x5522fb[_0x5831e0(0x1c2)],'stripPathPrefix':_0x5522fb[_0x5831e0(0x1d2)],'preferredContentTypes':_0x5522fb[_0x5831e0(0x179)]});}function m(_0x31f5cf,_0x20323e){const _0x589f20=_0x36ba;if(!_0x31f5cf)return _0x31f5cf;if(_0x31f5cf[_0x589f20(0x1de)]('[]'))return''[_0x589f20(0x184)](m(_0x31f5cf[_0x589f20(0x1d8)](0x0,-0x2),_0x20323e),'[]');let _0x332e34=(0x0,e['stripPrefix'])(_0x31f5cf,_0x20323e['stripSchemaPrefix']);return(0x0,e['applyFormatting'])(_0x332e34,_0x20323e['prefix'],_0x20323e[_0x589f20(0x1ec)]);}function h(_0x47eaf2){const _0x591bfb=_0x36ba;return[_0x591bfb(0x20d),_0x591bfb(0x1aa),_0x591bfb(0x1e8),'unknown',_0x591bfb(0x1e2),_0x591bfb(0x192),_0x591bfb(0x1ea),'undefined',_0x591bfb(0x1b4),'object']['includes'](_0x47eaf2)?!0x0:_0x47eaf2['endsWith']('[]')?h(_0x47eaf2['slice'](0x0,-0x2)):!!(_0x47eaf2[_0x591bfb(0x215)]('Record<')||_0x47eaf2['includes']('\x22'));}function g(_0x23c1c4,_0xc7ef51,_0x2a10a1){const _0x4ea4c2=_0x36ba;let {methodName:_0x5ad31c,pathParams:_0x44d0c2,queryParams:_0x575db8,headerParams:_0x528651,cookieParams:_0x19b4f7,requestBody:_0x29341a}=_0x23c1c4,_0x2bead1=[];for(let _0x1bda6c of _0x44d0c2){let _0x59db12=(0x0,e[_0x4ea4c2(0x18b)])(_0x1bda6c);_0x2bead1[_0x4ea4c2(0x206)](''[_0x4ea4c2(0x184)](_0x59db12,_0x4ea4c2(0x1f7)));}if(_0x528651['length']>0x0){let _0x23f919=''[_0x4ea4c2(0x184)]((0x0,e['toPascalCase'])(_0x5ad31c),'Headers'),_0x1bf3aa=_0x528651['every'](_0x555b15=>_0x555b15[_0x4ea4c2(0x20a)]);_0x2bead1[_0x4ea4c2(0x206)](_0x4ea4c2(0x19a)['concat'](_0x1bf3aa?'':'?',':\x20')[_0x4ea4c2(0x184)](_0x23f919));}if(_0x19b4f7[_0x4ea4c2(0x183)]>0x0){let _0x67899e=''['concat']((0x0,e['toPascalCase'])(_0x5ad31c),_0x4ea4c2(0x1af)),_0x4f6851=_0x19b4f7[_0x4ea4c2(0x177)](_0x20c9f3=>_0x20c9f3[_0x4ea4c2(0x20a)]);_0x2bead1['push'](_0x4ea4c2(0x18a)['concat'](_0x4f6851?'':'?',':\x20')['concat'](_0x67899e));}if(_0x575db8[_0x4ea4c2(0x183)]>0x0){let _0x28a56c=''['concat']((0x0,e['toPascalCase'])(_0x5ad31c),'Params'),_0xea3fbd=_0x575db8['every'](_0x389dfa=>_0x389dfa[_0x4ea4c2(0x20a)]);_0x2bead1[_0x4ea4c2(0x206)]('params'[_0x4ea4c2(0x184)](_0xea3fbd?'':'?',':\x20')['concat'](_0x28a56c));}if(_0x29341a){let _0x47b1f9=h(_0x29341a['typeName'])?_0x29341a['typeName']:m(_0x29341a[_0x4ea4c2(0x1c0)],_0x2a10a1);_0x2bead1['push'](_0x4ea4c2(0x197)['concat'](_0x29341a['required']?'':'?',':\x20')[_0x4ea4c2(0x184)](_0x47b1f9));}_0x2bead1[_0x4ea4c2(0x206)](_0x4ea4c2(0x1a5));let _0x503ee5='unknown';_0x23c1c4[_0x4ea4c2(0x17f)]&&(_0x503ee5=h(_0x23c1c4['successResponseType'])?_0x23c1c4['successResponseType']:m(_0x23c1c4['successResponseType'],_0x2a10a1));let _0x3377c3='K6ServiceResult<'['concat'](_0x503ee5,'>'),_0x2fb978=_0x23c1c4[_0x4ea4c2(0x178)]||0xc8,_0x3e222f=(0x0,e[_0x4ea4c2(0x1d3)])({'summary':_0x23c1c4[_0x4ea4c2(0x1bc)],'description':_0x23c1c4[_0x4ea4c2(0x1a1)],'deprecated':_0x23c1c4['deprecated'],'method':_0x23c1c4[_0x4ea4c2(0x1c1)],'path':_0x23c1c4[_0x4ea4c2(0x1ce)],'includeDescriptions':_0xc7ef51,'returns':_0x4ea4c2(0x1e4)}),_0x287933=_0x44d0c2[_0x4ea4c2(0x1c5)](_0x12abf5=>(0x0,e['sanitizeParamName'])(_0x12abf5))[_0x4ea4c2(0x209)](',\x20'),_0x53670b=[];_0x575db8['length']>0x0&&_0x53670b[_0x4ea4c2(0x206)]('params'),_0x53670b[_0x4ea4c2(0x206)](_0x4ea4c2(0x1db)),_0x29341a&&_0x53670b['push'](_0x4ea4c2(0x186)['concat'](JSON['stringify'](_0x29341a[_0x4ea4c2(0x1b9)]),')'));let _0x428622='{\x20'['concat'](_0x53670b[_0x4ea4c2(0x209)](',\x20'),'\x20}'),_0x4b5699=_0x287933?_0x4ea4c2(0x1f0)[_0x4ea4c2(0x184)](_0x5ad31c,'(')[_0x4ea4c2(0x184)](_0x287933,',\x20')['concat'](_0x428622,')'):_0x4ea4c2(0x1f0)[_0x4ea4c2(0x184)](_0x5ad31c,'(')[_0x4ea4c2(0x184)](_0x428622,')'),_0x286c84;if(_0x503ee5==='void')_0x286c84='const\x20data\x20=\x20undefined\x20as\x20void;';else{let {method:_0x3cf231}=(0x0,e[_0x4ea4c2(0x1cb)])(_0x23c1c4[_0x4ea4c2(0x181)]);_0x286c84=_0x3cf231==='json'?'const\x20data\x20=\x20response.json()\x20as\x20'['concat'](_0x503ee5,';'):'const\x20data\x20=\x20response.body\x20as\x20'[_0x4ea4c2(0x184)](_0x503ee5,';');}let _0x1f3e50='';_0x528651[_0x4ea4c2(0x183)]>0x0&&(_0x1f3e50=_0x4ea4c2(0x1a7));let _0x4a0c48='';return _0x19b4f7[_0x4ea4c2(0x183)]>0x0&&(_0x4a0c48=_0x4ea4c2(0x182)),'\x20\x20'[_0x4ea4c2(0x184)](_0x3e222f,_0x4ea4c2(0x1df))[_0x4ea4c2(0x184)](_0x5ad31c,'(')[_0x4ea4c2(0x184)](_0x2bead1[_0x4ea4c2(0x209)](',\x20'),'):\x20')[_0x4ea4c2(0x184)](_0x3377c3,'\x20{\x0a')['concat'](_0x1f3e50)['concat'](_0x4a0c48,'\x20\x20\x20\x20const\x20response\x20=\x20')['concat'](_0x4b5699,';\x0a\x0a\x20\x20\x20\x20//\x20Validate\x20status\x20code\x0a\x20\x20\x20\x20const\x20ok\x20=\x20check(response,\x20{\x0a\x20\x20\x20\x20\x20\x20\x22')[_0x4ea4c2(0x184)](_0x5ad31c,'\x20status\x20is\x20')[_0x4ea4c2(0x184)](_0x2fb978,_0x4ea4c2(0x219))['concat'](_0x2fb978,')\x20{\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20console.log(`')['concat'](_0x5ad31c,'\x20failed\x20with\x20status:\x20${r.status},\x20body:\x20${formatResponseBody(r.body)}`);\x0a\x20\x20\x20\x20\x20\x20\x20\x20}\x0a\x20\x20\x20\x20\x20\x20\x20\x20return\x20r.status\x20===\x20')[_0x4ea4c2(0x184)](_0x2fb978,';\x0a\x20\x20\x20\x20\x20\x20},\x0a\x20\x20\x20\x20});\x0a\x0a\x20\x20\x20\x20')[_0x4ea4c2(0x184)](_0x286c84,'\x0a\x20\x20\x20\x20return\x20{\x20response,\x20data,\x20ok\x20};\x0a\x20\x20}');}function _(_0x3798ba,_0x1a2162){const _0xb42325=_0x36ba;let _0x45ffc4=new Set();for(let _0x4799c4 of _0x3798ba){if(_0x4799c4[_0xb42325(0x17f)]&&_0x4799c4['successResponseType']!==_0xb42325(0x199)&&_0x4799c4['successResponseType']!==_0xb42325(0x192)&&!h(_0x4799c4['successResponseType'])){let _0x28d1bd=m(_0x4799c4[_0xb42325(0x17f)],_0x1a2162),_0x326d73=_0x28d1bd['endsWith']('[]')?_0x28d1bd[_0xb42325(0x1d8)](0x0,-0x2):_0x28d1bd;h(_0x326d73)||_0x45ffc4['add'](_0x326d73);}if(_0x4799c4['requestBody']?.[_0xb42325(0x1c0)]&&_0x4799c4[_0xb42325(0x1fe)][_0xb42325(0x1c0)]!==_0xb42325(0x199)&&!h(_0x4799c4['requestBody'][_0xb42325(0x1c0)])){let _0x20e60b=m(_0x4799c4['requestBody']['typeName'],_0x1a2162);_0x45ffc4[_0xb42325(0x1e6)](_0x20e60b);}}return Array['from'](_0x45ffc4);}function _0x3050(){const _0x1a7fc1=['zxzLCNK','C3vJy2vZC1n0yxr1C0nVzgu','ChjLzMvYCMvKq29UDgvUDfr5CgvZ','Dg90ywXqyxrOCW','sZztzxj2AwnLuMvZDwX0lcbMB3jTyxrszxnWB25ZzujVzhK','y3jLyxrLrMLSDgvYu3rHDgLZDgLJCW','B3b0Aw9UywW','B21PDa','C3vJy2vZC1jLC3bVBNnLvhLWzq','zxH0CMfJDevUzhbVAw50CW','C3vJy2vZC1jLC3bVBNnLq29UDgvUDfr5Cgu','icaGic8Vie1LCMDLignVB2TPzxmGAw50BYbYzxf1zxn0ihbHCMfTzxrLCNmkicaGigLMicGHCMvXDwvZDfbHCMfTzxrLCNmPihSkicaGicaGCMvXDwvZDfbHCMfTzxrLCNmGpsb7FtSkicaGih0kicaGihjLCxvLC3rqyxjHBwv0zxjZlMnVB2TPzxmGpsb7ic4UlNjLCxvLC3rqyxjHBwv0zxjZlMnVB2TPzxmSic4UlMnVB2TPzxmGFtSkcG','BgvUz3rO','y29Uy2f0','CgfYC2vtCgvJ','yM9KEtOGC2vYAwfSAxPLqM9KEsHIB2r5lca','z2vUzxjHDgvgAwXLsgvHzgvY','qhnWyxj0ywzPy2LHBc9VCgvUyxbPlxrVlwS2','C2vYAwfSAxPLugf0AfbHCMfT','y29VA2LLCW','C2fUAxrPEMvqyxjHBu5HBwu','lcb7ia','zM9YBwf0uhjVCgvYDhLoyw1L','z2vUzxjHDgvtzxj2AwnLu3rYAw5N','ihDHCW','lcbHBgXVD1jLC2vYDMvKoIb0CNvL','CMvWBgfJzq','DM9Pza','B21PDfvUzgvMAw5Lza','BMfTzq','zMLSDgvY','Bg9HzenVBMzPzW','yM9KEq','CMvNAxn0zxi','Dw5RBM93BG','AgvHzgvYCW','DMfSAwrHDgvgAwX0zxjZ','DgL0Bgu','jhTLBMnVzgvvuKLdB21WB25LBNqOu3rYAw5Nka','DhLWzq','ksL9','C3bLy0nHy2HL','zgvZy3jPChrPB24','D2fYBMLUz0nVBgXLy3rVCG','C3rYAwn0t2jQzwn0','zxHWB3j0ihr5CguG','CMvXDwvZDfbHCMfTzxrLCNm/oIbqyxjHBxm','zM9YBwf0tMfTzunVBgXPC2LVBG','icaGic8Vie1LCMDLigHLywrLCNmGAw50BYbYzxf1zxn0ihbHCMfTzxrLCNmkicaGigLMicGHCMvXDwvZDfbHCMfTzxrLCNmPihSkicaGicaGCMvXDwvZDfbHCMfTzxrLCNmGpsb7FtSkicaGih0kicaGihjLCxvLC3rqyxjHBwv0zxjZlMHLywrLCNmGpsb7ic4UlNjLCxvLC3rqyxjHBwv0zxjZlMHLywrLCNmSic4UlMHLywrLCNmGFtSkcG','cI8QkGOGkIblnIbbueKGC2vYDMLJzsb3AxrOihn0yxr1CYbJB2rLihzHBgLKyxrPB24kicOGr2vUzxjHDgvKigzYB20Gt3bLBKfqssbZCgvJAwzPy2f0Aw9UcIaQcIaQifDYyxbZihrOzsbJBgLLBNqGBwv0Ag9KCYb3AxrOoGOGkIaTifn0yxr1CYbJB2rLignOzwnRAw5NihvZAw5NieS2j3mGy2HLy2SOksbMDw5JDgLVBGOGkIaTifjLC3bVBNnLigjVzhKGCgfYC2LUzWOGkIaTieS2u2vYDMLJzvjLC3vSDcbYzxr1CM4GDhLWzsb3AxrOig9RigzSywCkicOVcMv4Cg9YDcbJBgfZCYa','CxvLCNLqyxjHBxm','BNvTyMvY','iIWkicaGicaGica','Aw5MBW','y2XLyw5cyxnLvxjS','rgLKihLVDsbTzwfUicDVDxrWDxrdBgLLBNqNig9YicDVDxrWDxruExbLCYC/ifrOzsaNB3v0Chv0jYbMAwvSzcb3yxmGCMvUyw1Lzc4','q29VA2LLCW','BwvYz2vszxf1zxn0ugfYyw1LDgvYCW','y29VA2LLugfYyw1Z','cIaGicbJB25ZDcbTzxjNzwrqyxjHBxmGpsbTzxjNzvjLCxvLC3rqyxjHBwv0zxjZkaOGicaGicbVChrPB25ZpY5Yzxf1zxn0ugfYyw1LDgvYCYb8Fcb7FsWkicaGicaGDgHPCY5JB21TB25szxf1zxn0ugfYyw1LDgvYCWOGicaGktSkcIaGicbYzxr1CM4GAhr0Cc5Yzxf1zxn0kci','ywXSB3DszxnLCNzLza','BMv2zxi','Cgf0AfbHCMfTzxrLCNm','z2vUzxjHDgvdDxn0B21gAwXLsgvHzgvY','C3r5Bgu','C2vYDMLJzq','y29UDgvUDfr5Cgu','Dg9qyxnJywXdyxnL','ycaRigj1AwXKuxvLCNLtDhjPBMCOB3b0Aw9UCZ8UCgfYyw1Z','C3vTBwfYEq','icdINjmGr2vUzxjHDgvKihr5CgvZoIa','ih0GzNjVBsaIqhnWyxj0ywzPy2LHBc9VCgvUyxbPlxrVlwS2l3j1BNrPBwuIoWPPBxbVCNqGEYa','yxjYyxK','DhLWzu5HBwu','Bwv0Ag9K','AwDUB3jLsgvHzgvYCW','y3jLyxrLq29UzMLNtg9HzgvY','B3v0Chv0u2vYDMLJzq','BwfW','zgvYAxzLq2XHC3noyw1L','rwfJAcbZCgvJig11C3qGC3bLy2LMEsbHBIbVDxrWDxqGzMLSzsbWyxrOigzVCIbNzw5LCMf0zwqGvhLWzvnJCMLWDcb0ExbLCY4','B3bLCMf0Aw9UrMLSDgvYCW','BwvYz2vbBgXtCgvJC1DPDgHezwzHDwX0CW','Dg9mB3DLCKnHC2u','z2v0uMvZCg9UC2vqyxjZzu1LDgHVza','DxnLt3bLCMf0Aw9Uswq','zxHWBg9Kzq','Cgf0Aa','DMvYC2LVBG','Aw5JBhvKzwrpCgvYyxrPB25Z','B3v0Chv0vhLWzxm','C3rYAxbqyxrOuhjLzML4','z2vUzxjHDgvpCgvYyxrPB25ku0rVyW','B3v0Chv0q2XPzw50','Bg9N','cI8QkGOGkIblnIbivfrqignSAwvUDcbMB3iGqvbjihrLC3rPBMCkicOGr2vUzxjHDgvKigzYB20Gt3bLBKfqssbZCgvJAwzPy2f0Aw9UcIaQcIaQifrOAxmGAxmGysb0AgLUihbHC3n0AhjVDwDOigXHEwvYic0GBM8GCMvZCg9UC2uGCgfYC2LUzYbVCIb2ywXPzgf0Aw9UlGOGkIbszxr1CM5ZihjHDYblnIbszxnWB25ZzsbVyMPLy3rZlIbvC2uGDgHLifnLCNzPy2uGy2XHC3mGzM9Yihr5CgvKihjLC3bVBNnLCY4kicOVcMv4Cg9YDcbJBgfZCYa','ChjLzML4','C2XPy2u','ih0GzNjVBsaIAZyVAhr0Cci7','AgvHzgvYugfYyw1Z','CMvXDwvZDfbHCMfTzxrLCNm','cMLTCg9YDcb7ia','zMX1C2G','zw5KC1DPDgG','cIaG','DhjPBq','lI4UBwvYz2vKugfYyw1ZpY5OzwfKzxjZlaOGicaGicb9laOGicaGFsK7cIaGFq','yw55','z2v0rw5KCg9PBNrtDgf0CW','sZztzxj2AwnLuMvZDwX0ihDPDgGGC3rHDhvZignOzwnRigfUzcbWyxjZzwqGzgf0yq','icOVcG','ywrK','iIWGDxjSlca','yM9VBgvHBG','lcb0ExbLiff1zxj5ugfYyw1Zih0GzNjVBsaIqhnWyxj0ywzPy2LHBc9VCgvUyxbPlxrVlwS2l3j1BNrPBwuIoW','BNvSBa','ihSkicbWCML2yxrLihjLywrVBMX5igjHC2vvCMW6ihn0CMLUzZSkicbWCML2yxrLihjLywrVBMX5ignVBw1VBLjLCxvLC3rqyxjHBwv0zxjZoIbqyxjHBxm7cGOGic8QkGOGicaQienYzwf0zxmGysbUzxCGqvbjignSAwvUDcbPBNn0yw5JzqOGicaQiebWyxjHBsbIyxnLvxjSic0GqMfZzsbvuKWGzM9YigfSBcbbueKGCMvXDwvZDhmGkhrYywLSAw5NihnSyxnOihDPBgWGyMuGCMvTB3zLzcKkicaGkIbaCgfYyw0Gy29TBw9UuMvXDwvZDfbHCMfTzxrLCNmGlsbdB21TB24GsZyGCMvXDwvZDcbWyxjHBwv0zxjZigfWCgXPzwqGDg8GywXSihjLCxvLC3rZcIaGicOVcIaGy29UC3rYDwn0B3iOyMfZzvvYBdOGC3rYAw5NlcbJB21TB25szxf1zxn0ugfYyw1LDgvYCZOGugfYyw1Zid0GE30PihSkicaGihrOAxmUyMfZzvvYBca9ignSzwfUqMfZzvvYBcHIyxnLvxjSktSkicaGihrOAxmUy29TBw9UuMvXDwvZDfbHCMfTzxrLCNmGpsbJB21TB25szxf1zxn0ugfYyw1LDgvYCZSkicb9cGO','C3vMzML4','cN07','zgvMyxvSDe51BgXHyMXL','z2vUzxjHDgvty2HLBwfuExbLC1n0CMLUzW','DgHPCY5Fy2XPzw50lG','DMfSAwrHDgvjz25VCMvqyxr0zxjUCW','C29Tzq','C3rYAw5NAwz5','C2HVD1n0yxrZ','zgvWCMvJyxrLza','B3bLBMfWAs10BY1RnG','oIbZDhjPBMC','zgvMAw5LuhjVCgvYDhK','Bwv0Ag9KtMfTzq','Dw5ZAgLMDa','D3jPDgvgAwXLu3LUyW','C3bLyW','sw5WDxqGzMLSzsbUB3qGzM91BMq6ia','CMvXDwvZDejVzhK','Aw1WB3j0ihr5CguGEYa','y29UC3qGDxjSid0GDgHPCY5IyxnLvxjSicSGya','ugfYyw1Z','AxnoB25ezwzHDwX0u2vYAwfSAxPHDgLVBG','Aw5WDxq','BM9YBwfSAxPL','oWOGih0','ChvZAa','z2vUzxjHDgvtDhjPBMC','zxH0zw5K','AM9PBG','CMvXDwLYzwq','DxrMltG','r2vUzxjHDg9YrxjYB3i','C3rYAw5N','Aw5JBhvKzurLC2nYAxb0Aw9UCW','Dg9szwXHDgL2zuLTCg9YDfbHDgG','C2HHCgu','lcb7cIaGicaGic4UlM1LCMDLzfbHCMfTCYWkicaGicaGAgvHzgvYCZOGEWOGicaGicaGia','icaGifnLCNzPy2uGBwv0Ag9KCZOG','icaVkIOG','ksb7cIaGicb0AgLZlL9JBgLLBNqGpsbJBgLLBNq7cIaGFqOk','C3rHCNrZv2L0Aa','B3b0Aw9UCW','z2v0','igfUzca','iJOGkhiPid0+ihSkicaGicaGicbPzIaOCI5ZDgf0DxmGit09ia','Aw1WB3j0ugf0AezYB21tzxj2AwnL','sZztzxj2AwnLuMvZDwX0lcbZzxjPywXPEMvcB2r5lcbMB3jTyxrszxnWB25ZzujVzhK'];_0x3050=function(){return _0x1a7fc1;};return _0x3050();}function v(_0x124e9f){const _0x3c1758=_0x36ba;let _0x213f37=[];for(let _0x93c055 of _0x124e9f)_0x93c055[_0x3c1758(0x1a9)][_0x3c1758(0x183)]>0x0&&_0x213f37[_0x3c1758(0x206)](''['concat']((0x0,e[_0x3c1758(0x1ba)])(_0x93c055[_0x3c1758(0x1f9)]),'Params')),_0x93c055[_0x3c1758(0x1da)][_0x3c1758(0x183)]>0x0&&_0x213f37['push'](''['concat']((0x0,e[_0x3c1758(0x1ba)])(_0x93c055['methodName']),'Headers')),_0x93c055[_0x3c1758(0x1b1)]['length']>0x0&&_0x213f37[_0x3c1758(0x206)](''['concat']((0x0,e[_0x3c1758(0x1ba)])(_0x93c055['methodName']),'Cookies'));return _0x213f37;}function y(_0x51c0b5,_0x112629,_0x59a2ed,_0x4523b4){const _0x30babe=_0x36ba;let _0x26ba3e=(0x0,e[_0x30babe(0x180)])(_0x51c0b5,{'useOperationId':_0x112629[_0x30babe(0x1cc)],'operationFilters':_0x112629['operationFilters'],'ignoreHeaders':_0x112629['ignoreHeaders'],'stripPathPrefix':_0x112629[_0x30babe(0x1d2)],'preferredContentTypes':_0x112629['preferredContentTypes'],'trackStatusCode':!0x0});if(_0x26ba3e[_0x30babe(0x183)]===0x0)return'';let _0x439dc2=(0x0,e[_0x30babe(0x1c6)])(_0x112629['outputClient'],'Client'),_0x3f6140=(0x0,e[_0x30babe(0x1c6)])(_0x112629[_0x30babe(0x1c4)]||_0x30babe(0x1b8),'Service'),_0x33bd47=_0x112629['includeDescriptions']??!0x0,_0x85d94f={'stripSchemaPrefix':_0x112629['stripSchemaPrefix'],'prefix':_0x112629[_0x30babe(0x1d7)],'suffix':_0x112629[_0x30babe(0x1ec)]},_0x42caec=v(_0x26ba3e),_0x5503a6=_(_0x26ba3e,_0x85d94f),_0xef03c9=_0x26ba3e['map'](_0x564c18=>g(_0x564c18,_0x33bd47,_0x85d94f))['join']('\x0a\x0a'),_0x3bf76a=[],_0x26257d=_0x26ba3e[_0x30babe(0x1f2)](_0x1b270b=>!!_0x1b270b['requestBody'])?_0x30babe(0x21b):_0x30babe(0x17b);_0x3bf76a['push']('import\x20{\x20check\x20}\x20from\x20\x22k6\x22;\x0aimport\x20type\x20{\x20Params\x20}\x20from\x20\x22k6/http\x22;\x0aimport\x20{\x20type\x20'['concat'](_0x26257d,_0x30babe(0x1be))[_0x30babe(0x184)](_0x439dc2,'\x20}\x20from\x20\x22')['concat'](_0x59a2ed,'\x22;'));let _0x26d08e=[..._0x42caec,..._0x5503a6];return _0x26d08e[_0x30babe(0x183)]>0x0&&_0x3bf76a['push'](_0x30babe(0x1ff)[_0x30babe(0x184)](_0x26d08e['join'](',\x20'),'\x20}\x20from\x20\x22')['concat'](_0x4523b4,'\x22;')),_0x3bf76a['push'](_0x30babe(0x1a8)['concat'](_0x3f6140,'\x20{\x0a\x20\x20private\x20readonly\x20_client:\x20')[_0x30babe(0x184)](_0x439dc2,';\x0a\x0a\x20\x20/**\x0a\x20\x20\x20*\x20Creates\x20a\x20new\x20API\x20service\x20instance\x0a\x20\x20\x20*\x20@param\x20client\x20-\x20The\x20K6\x20client\x20instance\x20to\x20wrap\x0a\x20\x20\x20*/\x0a\x20\x20constructor(client:\x20')[_0x30babe(0x184)](_0x439dc2,_0x30babe(0x214))[_0x30babe(0x184)](_0xef03c9,'\x0a}')),_0x3bf76a[_0x30babe(0x209)]('\x0a');}function b(_0x1ecf3a,_0x4ff11b){const _0x362b08=_0x36ba;return(0x0,e[_0x362b08(0x1e3)])(_0x1ecf3a,{'useOperationId':_0x4ff11b[_0x362b08(0x1cc)],'operationFilters':_0x4ff11b['operationFilters'],'ignoreHeaders':_0x4ff11b['ignoreHeaders'],'stripPathPrefix':_0x4ff11b[_0x362b08(0x1d2)],'preferredContentTypes':_0x4ff11b[_0x362b08(0x179)]});}var x=class i{['options'];[_0x1c4f06(0x1fc)]=null;static [_0x1c4f06(0x1a0)]=new e['LRUCache'](0x32);['warningCollector'];constructor(_0x43c47d){const _0x42f0c6=_0x36ba;if(!_0x43c47d[_0x42f0c6(0x203)])throw new e['FileOperationError']('Input\x20path\x20is\x20required','');if(!(0x0,n['existsSync'])(_0x43c47d[_0x42f0c6(0x203)]))throw new e['FileOperationError'](_0x42f0c6(0x1fd)[_0x42f0c6(0x184)](_0x43c47d['input']),_0x43c47d[_0x42f0c6(0x203)]);if(!_0x43c47d['outputTypes'])throw new a('Output\x20types\x20path\x20is\x20required');if(!_0x43c47d['outputClient'])throw new a('Output\x20client\x20path\x20is\x20required');let _0x1fa755=_0x43c47d['showWarnings']!==!0x1;this['warningCollector']=new e['WarningCollector']({'packageName':_0x42f0c6(0x188),'enabled':_0x1fa755}),this[_0x42f0c6(0x216)]={'includeDescriptions':_0x43c47d[_0x42f0c6(0x20e)]??!0x0,'showStats':_0x43c47d[_0x42f0c6(0x1f4)]??!0x0,'showWarnings':_0x1fa755,...(0x0,e[_0x42f0c6(0x193)])(_0x43c47d)};}['parseSpec'](){const _0x2bfffb=_0x36ba;return this['spec']||=(0x0,e['loadOpenAPISpecCached'])(this['options'][_0x2bfffb(0x203)],i[_0x2bfffb(0x1a0)],{'warn':_0x7acd87=>{const _0x327edb=_0x36ba;this['warningCollector'][_0x327edb(0x1e6)](_0x7acd87);},'refMappings':this['options']['refMappings']}),this['spec'];}['generateString'](){const _0xc1e63d=_0x36ba;let _0x1121b2=this['parseSpec'](),_0x48f96d=(0x0,e[_0xc1e63d(0x1b6)])(this[_0xc1e63d(0x216)]['fileHeader']),_0x4fd946=(0x0,e['generateFileHeader'])({'packageName':_0xc1e63d(0x188),'apiTitle':_0x1121b2['info']?.[_0xc1e63d(0x19c)],'apiVersion':_0x1121b2[_0xc1e63d(0x1ac)]?.['version']});(0x0,e[_0xc1e63d(0x1f1)])(this['options'][_0xc1e63d(0x1c2)],_0x1121b2,_0x19ccf8=>{const _0x148280=_0x36ba;this[_0x148280(0x1a2)][_0x148280(0x1e6)](_0x19ccf8);});let _0x5017b1=f(_0x1121b2,this['options'],_0x491f8d=>{const _0x22aaa5=_0x36ba;this[_0x22aaa5(0x1a2)][_0x22aaa5(0x1e6)](_0x491f8d);});return this['warningCollector']['flush'](),_0x48f96d+_0x4fd946+_0x5017b1;}['generateParamTypesString'](){const _0x3230f2=_0x36ba;return d(this[_0x3230f2(0x185)](),this['options']);}[_0x1c4f06(0x1ef)](){const _0x40c39e=_0x36ba;let _0x3f6eab={'input':this['options'][_0x40c39e(0x203)],'outputTypes':this['options'][_0x40c39e(0x1d1)],'includeDescriptions':this['options'][_0x40c39e(0x20e)],'prefix':this[_0x40c39e(0x216)][_0x40c39e(0x1d7)],'suffix':this['options'][_0x40c39e(0x1ec)],'stripSchemaPrefix':this['options']['stripSchemaPrefix'],'stripPathPrefix':this['options']['stripPathPrefix'],'useOperationId':this['options'][_0x40c39e(0x1cc)]??!0x1,'defaultNullable':this['options'][_0x40c39e(0x1ee)],'enumFormat':this[_0x40c39e(0x216)]['enumFormat']??'union','ignoreHeaders':this['options'][_0x40c39e(0x1c2)],'operationFilters':this[_0x40c39e(0x216)]['operationFilters'],'refMappings':this['options']['refMappings'],'showStats':this['options']['showStats'],'includeHeader':!0x1,'showWarnings':!0x1};return new t['TypeScriptGenerator'](_0x3f6eab)[_0x40c39e(0x207)]();}['generateServiceString'](_0x48c4a0,_0xac3e44){const _0x5da8b4=_0x36ba;let _0xccc54d=this[_0x5da8b4(0x185)](),_0x4e8d8a=(0x0,e['generateCustomFileHeader'])(this[_0x5da8b4(0x216)]['fileHeader']),_0x261331=(0x0,e['generateFileHeader'])({'packageName':_0x5da8b4(0x188),'apiTitle':_0xccc54d['info']?.[_0x5da8b4(0x19c)],'apiVersion':_0xccc54d[_0x5da8b4(0x1ac)]?.['version']}),_0x3c61ce=y(_0xccc54d,this['options'],_0x48c4a0,_0xac3e44);return _0x4e8d8a+_0x261331+_0x3c61ce;}['importPathFromService'](_0xb51861){const _0x5c8a65=_0x36ba;return this['options']['outputService']?(0x0,e[_0x5c8a65(0x20f)])(this['options']['outputService'],_0xb51861):'';}['generate'](){const _0x2f0657=_0x36ba;try{let _0x2e927e=this[_0x2f0657(0x185)](),_0x29badb=(0x0,r['normalize'])(this[_0x2f0657(0x216)]['outputClient']),_0x4c17f8=(0x0,e['generateCustomFileHeader'])(this[_0x2f0657(0x216)]['fileHeader'])+(0x0,e[_0x2f0657(0x187)])({'packageName':_0x2f0657(0x188),'apiTitle':_0x2e927e['info']?.['title'],'apiVersion':_0x2e927e[_0x2f0657(0x1ac)]?.[_0x2f0657(0x1cf)]});if(this[_0x2f0657(0x216)]['outputTypes']){let _0x3b62db=(0x0,r[_0x2f0657(0x204)])(this['options']['outputTypes']),_0xaf2d37=this['generateParamTypesString'](),_0x509c56=this[_0x2f0657(0x1ef)]()+(_0xaf2d37?'\x0a'['concat'](_0xaf2d37):'');_0x509c56[_0x2f0657(0x1e0)]()&&((0x0,e['ensureDirectoryExists'])(_0x3b62db),(0x0,n['writeFileSync'])(_0x3b62db,_0x4c17f8+_0x509c56,'utf-8'),console[_0x2f0657(0x1d5)](_0x2f0657(0x1bd)[_0x2f0657(0x184)](_0x3b62db)));}let _0x4ae26c=f(_0x2e927e,this[_0x2f0657(0x216)],_0x148fb4=>{const _0x5ea369=_0x36ba;this['warningCollector'][_0x5ea369(0x1e6)](_0x148fb4);});if(!_0x4ae26c){this['warningCollector']['add']('No\x20operations\x20to\x20generate\x20a\x20client\x20from,\x20so\x20'['concat'](_0x29badb)+(this[_0x2f0657(0x216)]['outputService']?_0x2f0657(0x218)[_0x2f0657(0x184)]((0x0,r['normalize'])(this[_0x2f0657(0x216)]['outputService']),'\x20were'):_0x2f0657(0x18f))+'\x20not\x20written.\x20Check\x20that\x20the\x20specification\x20declares\x20paths\x20and\x20that\x20any\x20operationFilters\x20still\x20match.'),this['warningCollector'][_0x2f0657(0x1dd)]();return;}if((0x0,e['ensureDirectoryExists'])(_0x29badb),(0x0,n[_0x2f0657(0x1fb)])(_0x29badb,_0x4c17f8+_0x4ae26c,_0x2f0657(0x20b)),console['log']('\x20\x20✓\x20Generated\x20K6\x20client:\x20'['concat'](_0x29badb)),this['options']['showStats']){let _0x488074=p(_0x2e927e,this[_0x2f0657(0x216)]);console['log']('\x20\x20\x20\x20Paths:\x20'[_0x2f0657(0x184)](_0x488074[_0x2f0657(0x17a)],',\x20Operations:\x20')['concat'](_0x488074[_0x2f0657(0x1d0)],'/')[_0x2f0657(0x184)](_0x488074['totalOperations']));}if(this[_0x2f0657(0x216)]['outputService']){let _0x6f3e61=(0x0,r['normalize'])(this[_0x2f0657(0x216)][_0x2f0657(0x1c4)]),_0x10a036=this[_0x2f0657(0x21a)](this[_0x2f0657(0x216)]['outputClient']),_0x36a7a0=this['importPathFromService'](this['options'][_0x2f0657(0x1d1)]),_0x3393e4=this[_0x2f0657(0x18e)](_0x10a036,_0x36a7a0);if(_0x3393e4&&((0x0,e['ensureDirectoryExists'])(_0x6f3e61),(0x0,n['writeFileSync'])(_0x6f3e61,_0x3393e4,_0x2f0657(0x20b)),console['log']('\x20\x20✓\x20Generated\x20K6\x20service:\x20'['concat'](_0x6f3e61)),this['options'][_0x2f0657(0x1f4)])){let _0x88077f=b(_0x2e927e,this[_0x2f0657(0x216)]);console[_0x2f0657(0x1d5)](_0x2f0657(0x212)['concat'](_0x88077f['includedOperations']));}}this[_0x2f0657(0x1a2)][_0x2f0657(0x1dd)]();}catch(_0x34eb2f){throw new a('Failed\x20to\x20generate\x20K6\x20client:\x20'[_0x2f0657(0x184)](_0x34eb2f instanceof Error?_0x34eb2f['message']:String(_0x34eb2f)),_0x34eb2f instanceof Error?_0x34eb2f:void 0x0);}}};function _0x36ba(_0x1aa71b,_0x305038){_0x1aa71b=_0x1aa71b-0x177;const _0x36babf=_0x3050();let _0x3a2f68=_0x36babf[_0x1aa71b];if(_0x36ba['QYFFMM']===undefined){var _0x41afae=function(_0x31f639){const _0x3b980e='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x117ab3='',_0x359263='';for(let _0x2b8dbd=0x0,_0x4e19bb,_0x3c5771,_0x25e9e3=0x0;_0x3c5771=_0x31f639['charAt'](_0x25e9e3++);~_0x3c5771&&(_0x4e19bb=_0x2b8dbd%0x4?_0x4e19bb*0x40+_0x3c5771:_0x3c5771,_0x2b8dbd++%0x4)?_0x117ab3+=String['fromCharCode'](0xff&_0x4e19bb>>(-0x2*_0x2b8dbd&0x6)):0x0){_0x3c5771=_0x3b980e['indexOf'](_0x3c5771);}for(let _0x1c1db0=0x0,_0x48e5a8=_0x117ab3['length'];_0x1c1db0<_0x48e5a8;_0x1c1db0++){_0x359263+='%'+('00'+_0x117ab3['charCodeAt'](_0x1c1db0)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x359263);};_0x36ba['OXcncL']=_0x41afae,_0x36ba['LqAbta']={},_0x36ba['QYFFMM']=!![];}const _0x1005d4=_0x36babf[0x0];_0x36ba['eTRxCx']!==_0x1005d4&&(_0x36ba['LqAbta']={},_0x36ba['eTRxCx']=_0x1005d4);const _0x532211=_0x36ba['LqAbta'][_0x1aa71b];return _0x532211===undefined?(_0x3a2f68=_0x36ba['OXcncL'](_0x3a2f68),_0x36ba['LqAbta'][_0x1aa71b]=_0x3a2f68):_0x3a2f68=_0x532211,_0x3a2f68;}const S=i['z'][_0x1c4f06(0x1a3)]({'outputClient':i['z'][_0x1c4f06(0x20d)](),'outputService':i['z']['string']()['optional'](),'operationFilters':e['OperationFiltersSchema'][_0x1c4f06(0x17d)](),'useOperationId':i['z']['boolean']()['optional'](),'basePath':i['z'][_0x1c4f06(0x20d)]()[_0x1c4f06(0x17d)](),'ignoreHeaders':i['z'][_0x1c4f06(0x1bf)](i['z'][_0x1c4f06(0x20d)]())['optional'](),'preferredContentTypes':i['z']['array'](i['z'][_0x1c4f06(0x20d)]())['optional']()}),C=t['TypeScriptGeneratorOptionsSchema'][_0x1c4f06(0x17e)]({'operationFilters':!0x0,'schemaType':!0x0})['extend']({...S[_0x1c4f06(0x210)]}),w=t['TypeScriptDefaultsSchema']['omit']({'operationFilters':!0x0,'schemaType':!0x0})[_0x1c4f06(0x208)]({...S[_0x1c4f06(0x17e)]({'outputClient':!0x0,'outputService':!0x0})['shape']}),T=i['z']['strictObject']({'defaults':w[_0x1c4f06(0x17d)](),'specs':i['z']['array'](C)['min'](0x1,{'message':'Configuration\x20must\x20include\x20at\x20least\x20one\x20specification.\x20Each\x20specification\x20should\x20have\x20\x27input\x27,\x20\x27outputClient\x27,\x20and\x20\x27outputTypes\x27\x20paths.'}),'executionMode':e['ExecutionModeSchema']['optional']()}),E=(0x0,e[_0x1c4f06(0x1c3)])({'packageName':_0x1c4f06(0x1f6),'errorMessages':{'missingFieldMessages':{'input':'Each\x20spec\x20must\x20specify\x20the\x20path\x20to\x20your\x20OpenAPI\x20specification\x20file.','outputClient':'Each\x20spec\x20must\x20specify\x20an\x20output\x20file\x20path\x20for\x20the\x20generated\x20K6\x20API\x20client.','outputTypes':_0x1c4f06(0x1c7)},'unrecognizedKeyMessages':{'output':_0x1c4f06(0x1ae)},'requiredFieldsHelp':'All\x20required\x20fields\x20are\x20present\x20(specs\x20array\x20with\x20input/outputClient/outputTypes)'}},T),D=E[_0x1c4f06(0x196)],O=E['getResolvedConfigPath'];function k(_0x5b4380){const _0x3d42d1=_0x36ba;return(0x0,e[_0x3d42d1(0x1c9)])(_0x5b4380);}Object['defineProperty'](exports,'a',{'enumerable':!0x0,'get':function(){return a;}}),Object[_0x1c4f06(0x1f8)](exports,'i',{'enumerable':!0x0,'get':function(){return x;}}),Object[_0x1c4f06(0x1f8)](exports,'n',{'enumerable':!0x0,'get':function(){return D;}}),Object['defineProperty'](exports,'r',{'enumerable':!0x0,'get':function(){return k;}}),Object[_0x1c4f06(0x1f8)](exports,'t',{'enumerable':!0x0,'get':function(){return O;}});
package/dist/index.cjs ADDED
@@ -0,0 +1,6 @@
1
+ /*!
2
+ * Copyright (c) 2026 Spartaficial - Cerios. All rights reserved.
3
+ * Proprietary software, licensed not sold. Unauthorized use, redistribution or
4
+ * circumvention of licensing is prohibited. See LICENSE for details.
5
+ */
6
+ const _0x3a1237=_0x7a38;Object[_0x3a1237(0x115)](exports,Symbol[_0x3a1237(0x10a)],{'value':'Module'});const e=require('./config-loader-CB7t7edy.cjs');let t=require('@spartaficial/openapi-core'),n=require('@spartaficial/openapi-to-typescript');function _0x7a38(_0x2678b7,_0x35cf04){_0x2678b7=_0x2678b7-0x108;const _0x7a3829=_0x35cf();let _0x594a44=_0x7a3829[_0x2678b7];if(_0x7a38['rXROtr']===undefined){var _0x1bcc62=function(_0x4b9bc3){const _0x306a3e='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x44a05c='',_0x17bed3='';for(let _0x18f251=0x0,_0x25e2e5,_0xcc108a,_0x37da8c=0x0;_0xcc108a=_0x4b9bc3['charAt'](_0x37da8c++);~_0xcc108a&&(_0x25e2e5=_0x18f251%0x4?_0x25e2e5*0x40+_0xcc108a:_0xcc108a,_0x18f251++%0x4)?_0x44a05c+=String['fromCharCode'](0xff&_0x25e2e5>>(-0x2*_0x18f251&0x6)):0x0){_0xcc108a=_0x306a3e['indexOf'](_0xcc108a);}for(let _0x1ba959=0x0,_0x40397d=_0x44a05c['length'];_0x1ba959<_0x40397d;_0x1ba959++){_0x17bed3+='%'+('00'+_0x44a05c['charCodeAt'](_0x1ba959)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x17bed3);};_0x7a38['lbhpnI']=_0x1bcc62,_0x7a38['fijaBC']={},_0x7a38['rXROtr']=!![];}const _0x1851a0=_0x7a3829[0x0];_0x7a38['biswUO']!==_0x1851a0&&(_0x7a38['fijaBC']={},_0x7a38['biswUO']=_0x1851a0);const _0x4978a0=_0x7a38['fijaBC'][_0x2678b7];return _0x4978a0===undefined?(_0x594a44=_0x7a38['lbhpnI'](_0x594a44),_0x7a38['fijaBC'][_0x2678b7]=_0x594a44):_0x594a44=_0x4978a0,_0x594a44;}function r(_0x44a05c){return _0x44a05c;}function _0x35cf(){const _0x149ae4=['q29UzMLNDxjHDgLVBKvYCM9Y','r2vUzxjHDg9YrxjYB3i','Dg9tDhjPBMDuywC','q2LYy3vSyxjszwzLCMvUy2vfCNjVCG','twLZC2LUz0rLCgvUzgvUy3LfCNjVCG','BwvYz2vdB25MAwDxAxrOrgvMyxvSDhm','rMLSzu9WzxjHDgLVBKvYCM9Y','u3bLy1zHBgLKyxrPB25fCNjVCG','z2v0qMf0y2HfEgL0q29Kzq','u2nOzw1Hr2vUzxjHDgLVBKvYCM9Y','q2XPt3b0Aw9UC0vYCM9Y','q29UzMLNvMfSAwrHDgLVBKvYCM9Y','vhLWzvnJCMLWDeDLBMvYyxrVCG','zgvMAw5LuhjVCgvYDhK'];_0x35cf=function(){return _0x149ae4;};return _0x35cf();}Object[_0x3a1237(0x115)](exports,'CircularReferenceError',{'enumerable':!0x0,'get':function(){const _0x344508=_0x7a38;return t[_0x344508(0x10b)];}}),Object['defineProperty'](exports,_0x3a1237(0x112),{'enumerable':!0x0,'get':function(){const _0x4dd511=_0x7a38;return t[_0x4dd511(0x112)];}}),Object['defineProperty'](exports,_0x3a1237(0x113),{'enumerable':!0x0,'get':function(){return t['ConfigValidationError'];}}),Object['defineProperty'](exports,'ConfigurationError',{'enumerable':!0x0,'get':function(){const _0x223526=_0x7a38;return t[_0x223526(0x108)];}}),Object[_0x3a1237(0x115)](exports,'FileOperationError',{'enumerable':!0x0,'get':function(){const _0x2a17c9=_0x7a38;return t[_0x2a17c9(0x10e)];}}),Object['defineProperty'](exports,_0x3a1237(0x109),{'enumerable':!0x0,'get':function(){return t['GeneratorError'];}}),exports['K6ClientGenerationError']=e['a'],Object[_0x3a1237(0x115)](exports,'MissingDependencyError',{'enumerable':!0x0,'get':function(){const _0x23db03=_0x7a38;return t[_0x23db03(0x10c)];}}),exports['OpenApiK6Generator']=e['i'],Object[_0x3a1237(0x115)](exports,'SchemaGenerationError',{'enumerable':!0x0,'get':function(){const _0x3885f0=_0x7a38;return t[_0x3885f0(0x111)];}}),Object['defineProperty'](exports,'SpecValidationError',{'enumerable':!0x0,'get':function(){const _0x70f21f=_0x7a38;return t[_0x70f21f(0x10f)];}}),Object['defineProperty'](exports,'TypeScriptGenerator',{'enumerable':!0x0,'get':function(){const _0x3856c3=_0x7a38;return n[_0x3856c3(0x114)];}}),exports['defineConfig']=r,Object[_0x3a1237(0x115)](exports,'executeBatch',{'enumerable':!0x0,'get':function(){return t['executeBatch'];}}),Object['defineProperty'](exports,_0x3a1237(0x110),{'enumerable':!0x0,'get':function(){return t['getBatchExitCode'];}}),exports['loadConfig']=e['n'],exports[_0x3a1237(0x10d)]=e['r'];
@@ -0,0 +1,257 @@
1
+ /*!
2
+ * Copyright (c) 2026 Spartaficial - Cerios. All rights reserved.
3
+ * Proprietary software, licensed not sold. Unauthorized use, redistribution or
4
+ * circumvention of licensing is prohibited. See LICENSE for details.
5
+ */
6
+ /**
7
+ * @spartaficial/openapi-to-k6
8
+ *
9
+ * Generate type-safe K6 HTTP clients from OpenAPI specifications
10
+ *
11
+ * @example
12
+ * ```typescript
13
+ * import { OpenApiK6Generator, defineConfig } from '@spartaficial/openapi-to-k6';
14
+ *
15
+ * // Using the generator directly
16
+ * const generator = new OpenApiK6Generator({
17
+ * input: './openapi.yaml',
18
+ * outputClient: './k6/api-client.ts',
19
+ * outputTypes: './k6/api-types.ts',
20
+ * });
21
+ * generator.generate();
22
+ *
23
+ * // Or generate to string
24
+ * const clientCode = generator.generateString();
25
+ * ```
26
+ */
27
+ import { BatchExecutionSummary, CircularReferenceError, CliOptionsError, ConfigFileSpecKeys, ConfigValidationError, ConfigurationError, FileOperationError, Generator, Generator as Generator$1, GeneratorError, GeneratorError as GeneratorError$1, MissingDependencyError, OperationFilters, OperationFilters as OperationFilters$1, SchemaGenerationError, SpecValidationError, executeBatch, getBatchExitCode } from "@spartaficial/openapi-core";
28
+ import { EnumFormat, TypeScriptGenerator, TypeScriptGeneratorOptions } from "@spartaficial/openapi-to-typescript";
29
+ /**
30
+ * Thrown when K6 client generation fails
31
+ */
32
+ export declare class K6ClientGenerationError extends GeneratorError$1 {
33
+ constructor(message: string, cause?: Error);
34
+ }
35
+ /**
36
+ * Generator options for K6 client generation
37
+ *
38
+ * schemaType is omitted deliberately: a load-test client both sends and receives, and the
39
+ * generated service methods use the same type for the request body and the parsed response,
40
+ * so choosing one direction globally has no coherent meaning here. It was previously
41
+ * inherited and silently ignored.
42
+ */
43
+ interface OpenApiK6GeneratorOptions extends Omit<TypeScriptGeneratorOptions, "operationFilters" | "schemaType"> {
44
+ /**
45
+ * Input OpenAPI specification file path (YAML or JSON)
46
+ */
47
+ input: string;
48
+ /**
49
+ * Output client file path for generated K6 client (passthrough layer)
50
+ */
51
+ outputClient: string;
52
+ /**
53
+ * Output service file path for generated K6 service (validation layer)
54
+ *
55
+ * When specified, generates a service class that:
56
+ * - Wraps the client methods
57
+ * - Validates status codes using K6's check() function
58
+ * - Parses response bodies
59
+ * - Returns K6ServiceResult<T> with response, data, and ok flag
60
+ *
61
+ * @default undefined (no service layer)
62
+ */
63
+ outputService?: string;
64
+ /**
65
+ * Operation filtering options
66
+ *
67
+ * @default undefined (every operation is included)
68
+ */
69
+ operationFilters?: OperationFilters$1;
70
+ /**
71
+ * Whether to use operationId from OpenAPI spec for generated naming
72
+ *
73
+ * When true: Uses operationId if available, falls back to generated names.
74
+ * When false: Always generates names from HTTP method + path.
75
+ *
76
+ * Affects:
77
+ * - Client and service method names
78
+ * - Operation-derived TypeScript type names (query/header/request/response)
79
+ * @example true: "getUserById" (from operationId)
80
+ * @example false: "getUsersByUserId" (generated from GET /users/{userId})
81
+ * @default false
82
+ */
83
+ useOperationId?: boolean;
84
+ /**
85
+ * Base path to prepend to all API endpoints
86
+ *
87
+ * Useful for API versioning or common path prefixes.
88
+ *
89
+ * @example "/api/v1" -> GET /api/v1/users
90
+ * @default undefined (no base path)
91
+ */
92
+ basePath?: string;
93
+ /**
94
+ * Strip a common prefix from all paths before processing
95
+ *
96
+ * Useful when OpenAPI spec has redundant path prefixes.
97
+ *
98
+ * Supports both literal strings and glob patterns:
99
+ * - Literal string: "/api/v1" (must match exactly)
100
+ * - Glob pattern: "/api/v*" (uses minimatch for pattern matching)
101
+ *
102
+ * @example "/api/v1" -> strips "/api/v1" from all paths
103
+ * @default undefined (no stripping)
104
+ */
105
+ stripPathPrefix?: string;
106
+ /**
107
+ * Header parameters to ignore during generation
108
+ *
109
+ * Supports glob patterns for flexible matching (e.g., "X-*", "Authorization").
110
+ * Use ["*"] to ignore all headers.
111
+ *
112
+ * Matching is case-insensitive (follows HTTP header semantics)
113
+ *
114
+ * @example ["Authorization"] - Ignore Authorization header
115
+ * @example ["X-*"] - Ignore all headers starting with X-
116
+ * @default undefined (include all headers)
117
+ */
118
+ ignoreHeaders?: string[];
119
+ /**
120
+ * Whether to include JSDoc comments with descriptions
121
+ * @default true
122
+ */
123
+ includeDescriptions?: boolean;
124
+ /**
125
+ * Whether to show generation statistics
126
+ * @default true
127
+ */
128
+ showStats?: boolean;
129
+ /**
130
+ * Preferred content types for request/response handling, in order of priority
131
+ *
132
+ * First match wins.
133
+ *
134
+ * @default ["application/json"]
135
+ */
136
+ preferredContentTypes?: string[];
137
+ /**
138
+ * Format for the enums in the generated types file
139
+ *
140
+ * @default 'union'
141
+ */
142
+ enumFormat?: EnumFormat;
143
+ }
144
+ /**
145
+ * Root configuration file structure for K6 generator
146
+ */
147
+ interface K6ConfigFile {
148
+ /**
149
+ * Global default options applied to all specs
150
+ * Can be overridden by individual spec configurations
151
+ * Note: File paths (input, outputClient, outputTypes, outputService) must be specified per-spec
152
+ */
153
+ defaults?: Partial<Omit<OpenApiK6GeneratorOptions, "input" | "outputClient" | "outputTypes" | "outputService">>;
154
+ /**
155
+ * Array of OpenAPI specifications to process
156
+ * Each spec must have input and output paths; `name` labels the entry in the batch output
157
+ */
158
+ specs: (OpenApiK6GeneratorOptions & ConfigFileSpecKeys)[];
159
+ /**
160
+ * Execution mode for batch processing
161
+ * @default "parallel"
162
+ */
163
+ executionMode?: "parallel" | "sequential";
164
+ }
165
+ /**
166
+ * Helper function for type-safe config file creation
167
+ * Provides IDE autocomplete and type checking for K6 config files
168
+ *
169
+ * @example
170
+ * ```typescript
171
+ * import { defineConfig } from '@spartaficial/openapi-to-k6';
172
+ *
173
+ * export default defineConfig({
174
+ * defaults: {
175
+ * includeDescriptions: true,
176
+ * preferredContentTypes: ['application/json']
177
+ * },
178
+ * specs: [
179
+ * {
180
+ * input: 'openapi.yaml',
181
+ * outputClient: 'k6/api-client.ts',
182
+ * outputTypes: 'k6/api-types.ts'
183
+ * }
184
+ * ]
185
+ * });
186
+ * ```
187
+ */
188
+ export declare function defineConfig(config: K6ConfigFile): K6ConfigFile;
189
+ /**
190
+ * Main generator class for K6 API clients
191
+ *
192
+ * Generates type-safe K6 HTTP clients from OpenAPI specifications
193
+ * with TypeScript types for request/response handling.
194
+ */
195
+ export declare class OpenApiK6Generator implements Generator$1 {
196
+ private readonly options;
197
+ private spec;
198
+ private static specCache;
199
+ /** Warning collector for deferred output */
200
+ private readonly warningCollector;
201
+ constructor(options: OpenApiK6GeneratorOptions);
202
+ /**
203
+ * Parse the OpenAPI specification file
204
+ */
205
+ private parseSpec;
206
+ /**
207
+ * Generate the K6 client as a string (with headers)
208
+ * @returns The generated K6 client TypeScript code including file headers
209
+ */
210
+ generateString(): string;
211
+ /**
212
+ * Generate parameter types (Params/Headers interfaces) as a string
213
+ * @returns The generated TypeScript interface code for K6 client parameters
214
+ */
215
+ generateParamTypesString(): string;
216
+ /**
217
+ * Generate TypeScript types as a string (using openapi-to-typescript)
218
+ * This generates schema types from OpenAPI components
219
+ * @returns The generated TypeScript types code
220
+ */
221
+ generateSchemaTypesString(): string;
222
+ /**
223
+ * Generate K6 service as a string (with headers)
224
+ * @param clientImportPath - Relative import path for the client
225
+ * @param typesImportPath - Relative import path for types
226
+ * @returns The generated K6 service TypeScript code including file headers
227
+ */
228
+ generateServiceString(clientImportPath: string, typesImportPath: string): string;
229
+ /**
230
+ * Compute a relative import path from the service file to one of its siblings
231
+ *
232
+ * Returns "" when no service file is being generated, since there is then nothing
233
+ * to import from.
234
+ */
235
+ private importPathFromService;
236
+ /**
237
+ * Generate and write output files
238
+ */
239
+ generate(): void;
240
+ }
241
+ /**
242
+ * Load and validate K6 configuration file
243
+ * Supports: openapi-to-k6.config.{ts,json}, package.json under "openapi-to-k6" key
244
+ *
245
+ * @param configPath - Optional explicit path to config file. If not provided, searches automatically
246
+ * @returns Validated K6ConfigFile object
247
+ * @throws Error if config file not found, invalid, or contains unknown properties
248
+ */
249
+ export declare const loadConfig: (configPath?: string) => Promise<K6ConfigFile>;
250
+ /**
251
+ * Merge config defaults with individual specs
252
+ *
253
+ * @param config - Validated K6 configuration file
254
+ * @returns Array of fully resolved OpenApiK6GeneratorOptions objects
255
+ */
256
+ export declare function mergeConfigWithDefaults(config: K6ConfigFile): OpenApiK6GeneratorOptions[];
257
+ export { type BatchExecutionSummary, CircularReferenceError, CliOptionsError, ConfigValidationError, ConfigurationError, FileOperationError, type Generator, GeneratorError, type K6ConfigFile, MissingDependencyError, type OpenApiK6GeneratorOptions, type OperationFilters, SchemaGenerationError, SpecValidationError, TypeScriptGenerator, executeBatch, getBatchExitCode };
@@ -0,0 +1,258 @@
1
+ /*!
2
+ * Copyright (c) 2026 Spartaficial - Cerios. All rights reserved.
3
+ * Proprietary software, licensed not sold. Unauthorized use, redistribution or
4
+ * circumvention of licensing is prohibited. See LICENSE for details.
5
+ */
6
+ /**
7
+ * @spartaficial/openapi-to-k6
8
+ *
9
+ * Generate type-safe K6 HTTP clients from OpenAPI specifications
10
+ *
11
+ * @example
12
+ * ```typescript
13
+ * import { OpenApiK6Generator, defineConfig } from '@spartaficial/openapi-to-k6';
14
+ *
15
+ * // Using the generator directly
16
+ * const generator = new OpenApiK6Generator({
17
+ * input: './openapi.yaml',
18
+ * outputClient: './k6/api-client.ts',
19
+ * outputTypes: './k6/api-types.ts',
20
+ * });
21
+ * generator.generate();
22
+ *
23
+ * // Or generate to string
24
+ * const clientCode = generator.generateString();
25
+ * ```
26
+ */
27
+ import { BatchExecutionSummary, CircularReferenceError, CliOptionsError, ConfigFileSpecKeys, ConfigValidationError, ConfigurationError, FileOperationError, Generator, Generator as Generator$1, GeneratorError, GeneratorError as GeneratorError$1, MissingDependencyError, OperationFilters, OperationFilters as OperationFilters$1, SchemaGenerationError, SpecValidationError, executeBatch, getBatchExitCode } from "@spartaficial/openapi-core";
28
+ import { EnumFormat, TypeScriptGenerator, TypeScriptGeneratorOptions } from "@spartaficial/openapi-to-typescript";
29
+ import "zod";
30
+ /**
31
+ * Thrown when K6 client generation fails
32
+ */
33
+ export declare class K6ClientGenerationError extends GeneratorError$1 {
34
+ constructor(message: string, cause?: Error);
35
+ }
36
+ /**
37
+ * Generator options for K6 client generation
38
+ *
39
+ * schemaType is omitted deliberately: a load-test client both sends and receives, and the
40
+ * generated service methods use the same type for the request body and the parsed response,
41
+ * so choosing one direction globally has no coherent meaning here. It was previously
42
+ * inherited and silently ignored.
43
+ */
44
+ interface OpenApiK6GeneratorOptions extends Omit<TypeScriptGeneratorOptions, "operationFilters" | "schemaType"> {
45
+ /**
46
+ * Input OpenAPI specification file path (YAML or JSON)
47
+ */
48
+ input: string;
49
+ /**
50
+ * Output client file path for generated K6 client (passthrough layer)
51
+ */
52
+ outputClient: string;
53
+ /**
54
+ * Output service file path for generated K6 service (validation layer)
55
+ *
56
+ * When specified, generates a service class that:
57
+ * - Wraps the client methods
58
+ * - Validates status codes using K6's check() function
59
+ * - Parses response bodies
60
+ * - Returns K6ServiceResult<T> with response, data, and ok flag
61
+ *
62
+ * @default undefined (no service layer)
63
+ */
64
+ outputService?: string;
65
+ /**
66
+ * Operation filtering options
67
+ *
68
+ * @default undefined (every operation is included)
69
+ */
70
+ operationFilters?: OperationFilters$1;
71
+ /**
72
+ * Whether to use operationId from OpenAPI spec for generated naming
73
+ *
74
+ * When true: Uses operationId if available, falls back to generated names.
75
+ * When false: Always generates names from HTTP method + path.
76
+ *
77
+ * Affects:
78
+ * - Client and service method names
79
+ * - Operation-derived TypeScript type names (query/header/request/response)
80
+ * @example true: "getUserById" (from operationId)
81
+ * @example false: "getUsersByUserId" (generated from GET /users/{userId})
82
+ * @default false
83
+ */
84
+ useOperationId?: boolean;
85
+ /**
86
+ * Base path to prepend to all API endpoints
87
+ *
88
+ * Useful for API versioning or common path prefixes.
89
+ *
90
+ * @example "/api/v1" -> GET /api/v1/users
91
+ * @default undefined (no base path)
92
+ */
93
+ basePath?: string;
94
+ /**
95
+ * Strip a common prefix from all paths before processing
96
+ *
97
+ * Useful when OpenAPI spec has redundant path prefixes.
98
+ *
99
+ * Supports both literal strings and glob patterns:
100
+ * - Literal string: "/api/v1" (must match exactly)
101
+ * - Glob pattern: "/api/v*" (uses minimatch for pattern matching)
102
+ *
103
+ * @example "/api/v1" -> strips "/api/v1" from all paths
104
+ * @default undefined (no stripping)
105
+ */
106
+ stripPathPrefix?: string;
107
+ /**
108
+ * Header parameters to ignore during generation
109
+ *
110
+ * Supports glob patterns for flexible matching (e.g., "X-*", "Authorization").
111
+ * Use ["*"] to ignore all headers.
112
+ *
113
+ * Matching is case-insensitive (follows HTTP header semantics)
114
+ *
115
+ * @example ["Authorization"] - Ignore Authorization header
116
+ * @example ["X-*"] - Ignore all headers starting with X-
117
+ * @default undefined (include all headers)
118
+ */
119
+ ignoreHeaders?: string[];
120
+ /**
121
+ * Whether to include JSDoc comments with descriptions
122
+ * @default true
123
+ */
124
+ includeDescriptions?: boolean;
125
+ /**
126
+ * Whether to show generation statistics
127
+ * @default true
128
+ */
129
+ showStats?: boolean;
130
+ /**
131
+ * Preferred content types for request/response handling, in order of priority
132
+ *
133
+ * First match wins.
134
+ *
135
+ * @default ["application/json"]
136
+ */
137
+ preferredContentTypes?: string[];
138
+ /**
139
+ * Format for the enums in the generated types file
140
+ *
141
+ * @default 'union'
142
+ */
143
+ enumFormat?: EnumFormat;
144
+ }
145
+ /**
146
+ * Root configuration file structure for K6 generator
147
+ */
148
+ interface K6ConfigFile {
149
+ /**
150
+ * Global default options applied to all specs
151
+ * Can be overridden by individual spec configurations
152
+ * Note: File paths (input, outputClient, outputTypes, outputService) must be specified per-spec
153
+ */
154
+ defaults?: Partial<Omit<OpenApiK6GeneratorOptions, "input" | "outputClient" | "outputTypes" | "outputService">>;
155
+ /**
156
+ * Array of OpenAPI specifications to process
157
+ * Each spec must have input and output paths; `name` labels the entry in the batch output
158
+ */
159
+ specs: (OpenApiK6GeneratorOptions & ConfigFileSpecKeys)[];
160
+ /**
161
+ * Execution mode for batch processing
162
+ * @default "parallel"
163
+ */
164
+ executionMode?: "parallel" | "sequential";
165
+ }
166
+ /**
167
+ * Helper function for type-safe config file creation
168
+ * Provides IDE autocomplete and type checking for K6 config files
169
+ *
170
+ * @example
171
+ * ```typescript
172
+ * import { defineConfig } from '@spartaficial/openapi-to-k6';
173
+ *
174
+ * export default defineConfig({
175
+ * defaults: {
176
+ * includeDescriptions: true,
177
+ * preferredContentTypes: ['application/json']
178
+ * },
179
+ * specs: [
180
+ * {
181
+ * input: 'openapi.yaml',
182
+ * outputClient: 'k6/api-client.ts',
183
+ * outputTypes: 'k6/api-types.ts'
184
+ * }
185
+ * ]
186
+ * });
187
+ * ```
188
+ */
189
+ export declare function defineConfig(config: K6ConfigFile): K6ConfigFile;
190
+ /**
191
+ * Main generator class for K6 API clients
192
+ *
193
+ * Generates type-safe K6 HTTP clients from OpenAPI specifications
194
+ * with TypeScript types for request/response handling.
195
+ */
196
+ export declare class OpenApiK6Generator implements Generator$1 {
197
+ private readonly options;
198
+ private spec;
199
+ private static specCache;
200
+ /** Warning collector for deferred output */
201
+ private readonly warningCollector;
202
+ constructor(options: OpenApiK6GeneratorOptions);
203
+ /**
204
+ * Parse the OpenAPI specification file
205
+ */
206
+ private parseSpec;
207
+ /**
208
+ * Generate the K6 client as a string (with headers)
209
+ * @returns The generated K6 client TypeScript code including file headers
210
+ */
211
+ generateString(): string;
212
+ /**
213
+ * Generate parameter types (Params/Headers interfaces) as a string
214
+ * @returns The generated TypeScript interface code for K6 client parameters
215
+ */
216
+ generateParamTypesString(): string;
217
+ /**
218
+ * Generate TypeScript types as a string (using openapi-to-typescript)
219
+ * This generates schema types from OpenAPI components
220
+ * @returns The generated TypeScript types code
221
+ */
222
+ generateSchemaTypesString(): string;
223
+ /**
224
+ * Generate K6 service as a string (with headers)
225
+ * @param clientImportPath - Relative import path for the client
226
+ * @param typesImportPath - Relative import path for types
227
+ * @returns The generated K6 service TypeScript code including file headers
228
+ */
229
+ generateServiceString(clientImportPath: string, typesImportPath: string): string;
230
+ /**
231
+ * Compute a relative import path from the service file to one of its siblings
232
+ *
233
+ * Returns "" when no service file is being generated, since there is then nothing
234
+ * to import from.
235
+ */
236
+ private importPathFromService;
237
+ /**
238
+ * Generate and write output files
239
+ */
240
+ generate(): void;
241
+ }
242
+ /**
243
+ * Load and validate K6 configuration file
244
+ * Supports: openapi-to-k6.config.{ts,json}, package.json under "openapi-to-k6" key
245
+ *
246
+ * @param configPath - Optional explicit path to config file. If not provided, searches automatically
247
+ * @returns Validated K6ConfigFile object
248
+ * @throws Error if config file not found, invalid, or contains unknown properties
249
+ */
250
+ export declare const loadConfig: (configPath?: string) => Promise<K6ConfigFile>;
251
+ /**
252
+ * Merge config defaults with individual specs
253
+ *
254
+ * @param config - Validated K6 configuration file
255
+ * @returns Array of fully resolved OpenApiK6GeneratorOptions objects
256
+ */
257
+ export declare function mergeConfigWithDefaults(config: K6ConfigFile): OpenApiK6GeneratorOptions[];
258
+ export { type BatchExecutionSummary, CircularReferenceError, CliOptionsError, ConfigValidationError, ConfigurationError, FileOperationError, type Generator, GeneratorError, type K6ConfigFile, MissingDependencyError, type OpenApiK6GeneratorOptions, type OperationFilters, SchemaGenerationError, SpecValidationError, TypeScriptGenerator, executeBatch, getBatchExitCode };
package/dist/index.mjs ADDED
@@ -0,0 +1,6 @@
1
+ /*!
2
+ * Copyright (c) 2026 Spartaficial - Cerios. All rights reserved.
3
+ * Proprietary software, licensed not sold. Unauthorized use, redistribution or
4
+ * circumvention of licensing is prohibited. See LICENSE for details.
5
+ */
6
+ import{a as _0xbe9bb0,c as _0x104f17,i as _0x24f8a3,n as _0x33b2c9,o as _0x5b7148,r as _0x571637,s as _0x372749}from'./config-loader-Bzjhl1Vk.mjs';import{CircularReferenceError as _0x4edc54,CliOptionsError as _0x3fe6d6,ConfigValidationError as _0x30e096,ConfigurationError as _0x44aae0,FileOperationError as _0x14bc0f,GeneratorError as _0x37db1c,MissingDependencyError as _0x33634d,SchemaGenerationError as _0x5750be,SpecValidationError as _0x5ae90d,executeBatch as _0xadc66,getBatchExitCode as _0x43e7a7}from'@spartaficial/openapi-core';import{TypeScriptGenerator as _0x138c16}from'@spartaficial/openapi-to-typescript';_0x104f17(),_0x5b7148();function y(_0x172c93){return _0x172c93;}_0x33b2c9();export{_0x4edc54 as CircularReferenceError,_0x3fe6d6 as CliOptionsError,_0x30e096 as ConfigValidationError,_0x44aae0 as ConfigurationError,_0x14bc0f as FileOperationError,_0x37db1c as GeneratorError,_0x372749 as K6ClientGenerationError,_0x33634d as MissingDependencyError,_0xbe9bb0 as OpenApiK6Generator,_0x5750be as SchemaGenerationError,_0x5ae90d as SpecValidationError,_0x138c16 as TypeScriptGenerator,y as defineConfig,_0xadc66 as executeBatch,_0x43e7a7 as getBatchExitCode,_0x571637 as loadConfig,_0x24f8a3 as mergeConfigWithDefaults};
@@ -0,0 +1,6 @@
1
+ /*!
2
+ * Copyright (c) 2026 Spartaficial - Cerios. All rights reserved.
3
+ * Proprietary software, licensed not sold. Unauthorized use, redistribution or
4
+ * circumvention of licensing is prohibited. See LICENSE for details.
5
+ */
6
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});function e(e,t){return{...t,...e,cookies:{...t?.cookies,...e?.cookies},headers:{...t?.headers,...e?.headers},tags:{...t?.tags,...e?.tags}}}function t(e){return encodeURIComponent(e).replace(/%20/g,`+`)}function n(e){return[...e].map(e=>`:/?#[]@!$&'()*+,;=`.includes(e)?e:t(e)).join(``)}const r={form:`,`,spaceDelimited:` `,pipeDelimited:`|`,deepObject:`,`},i={style:`form`,explode:!0};function a(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function o(e,t,n){if(t==null)return[];let{style:o,explode:s}=n??i;if(Array.isArray(t)){let n=t.filter(e=>e!=null);return s?n.map(t=>[e,String(t)]):n.length===0?[]:[[e,n.map(e=>String(e)).join(r[o])]]}if(a(t)){let n=Object.entries(t).filter(([,e])=>e!=null);return o===`deepObject`?n.map(([t,n])=>[`${e}[${t}]`,String(n)]):s?n.map(([e,t])=>[e,String(t)]):n.length===0?[]:[[e,n.flatMap(([e,t])=>[e,String(t)]).join(r[o])]]}return[[e,String(t)]]}function s(e,r){if(!e||Object.keys(e).length===0)return``;let i=[];for(let[a,s]of Object.entries(e)){let e=r?.[a]?.allowReserved??!1;for(let[c,l]of o(a,s,r?.[a])){let r=e?n(l):t(l);i.push(`${t(c)}=${r}`)}}let a=i.join(`&`);return a?`?${a}`:``}function c(e){return e.replace(/\/+$/,``)}function l(e){return typeof e==`object`&&!!e&&`data`in e}function u(e){return e===null?`null`:typeof e==`string`?e:`[ArrayBuffer: ${e.byteLength} bytes]`}const d=[`application/x-www-form-urlencoded`,`multipart/form-data`];function f(e,t){if(e==null||typeof e==`string`||e instanceof ArrayBuffer||l(e))return e;let n=t?.toLowerCase().split(`;`)[0].trim();return n&&d.includes(n)?e:JSON.stringify(e)}const p={style:`simple`,explode:!1};function m(e,t,n){if(t==null)return``;let{style:r,explode:i}=n??p,a=e=>encodeURIComponent(String(e)),o=r===`label`?`.`:r===`matrix`?`;${e}=`:``;if(Array.isArray(t)){let n=t.filter(e=>e!=null);return n.length===0?r===`matrix`?`;${e}=`:o:i?r===`label`?`.${n.map(a).join(`.`)}`:r===`matrix`?n.map(t=>`;${e}=${a(t)}`).join(``):n.map(a).join(`,`):`${o}${n.map(a).join(`,`)}`}if(typeof t==`object`){let n=Object.entries(t).filter(([,e])=>e!=null);if(n.length===0)return r===`matrix`?`;${e}=`:o;if(i){let e=n.map(([e,t])=>`${a(e)}=${a(t)}`);return r===`label`?`.${e.join(`.`)}`:r===`matrix`?`;${e.join(`;`)}`:e.join(`,`)}return`${o}${n.flatMap(([e,t])=>[a(e),a(t)]).join(`,`)}`}return`${o}${a(t)}`}exports.buildQueryString=s,exports.cleanBaseUrl=c,exports.formatResponseBody=u,exports.mergeRequestParameters=e,exports.serializeBody=f,exports.serializePathParam=m;