@treasuredata/tdx 0.7.2 → 0.7.4

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.
Files changed (116) hide show
  1. package/dist/bin.js +1 -1
  2. package/dist/build-info.json +2 -2
  3. package/dist/cli-categories.js +1 -1
  4. package/dist/cli.d.ts.map +1 -1
  5. package/dist/cli.js +1 -1
  6. package/dist/cli.js.map +1 -1
  7. package/dist/client/cdp-api-client.d.ts +20 -1
  8. package/dist/client/cdp-api-client.d.ts.map +1 -1
  9. package/dist/client/cdp-api-client.js +1 -1
  10. package/dist/client/cdp-api-client.js.map +1 -1
  11. package/dist/client/engage-api-client.js +1 -1
  12. package/dist/client/http-client.js +1 -1
  13. package/dist/client/llm-api-client.js +1 -1
  14. package/dist/client/rate-limiter.js +1 -1
  15. package/dist/client/td-api-client.js +1 -1
  16. package/dist/client/trino-api-client.js +1 -1
  17. package/dist/client/workflow-client.js +1 -1
  18. package/dist/commands/activations.js +1 -1
  19. package/dist/commands/api-command.js +1 -1
  20. package/dist/commands/auth-command.js +1 -1
  21. package/dist/commands/chat-command.js +1 -1
  22. package/dist/commands/claude-command.js +1 -1
  23. package/dist/commands/claude-statusline-command.js +1 -1
  24. package/dist/commands/claude-usage-command.js +1 -1
  25. package/dist/commands/command.js +1 -1
  26. package/dist/commands/context-command.js +1 -1
  27. package/dist/commands/databases.js +1 -1
  28. package/dist/commands/describe.js +1 -1
  29. package/dist/commands/engage-command.js +1 -1
  30. package/dist/commands/job-command.js +1 -1
  31. package/dist/commands/llm-command.js +1 -1
  32. package/dist/commands/llm-proxy.js +1 -1
  33. package/dist/commands/parent-segment-command.d.ts +5 -4
  34. package/dist/commands/parent-segment-command.d.ts.map +1 -1
  35. package/dist/commands/parent-segment-command.js +1 -1
  36. package/dist/commands/parent-segment-command.js.map +1 -1
  37. package/dist/commands/profiles-command.js +1 -1
  38. package/dist/commands/query-command.js +1 -1
  39. package/dist/commands/segment-command.js +1 -1
  40. package/dist/commands/segment-create-command.js +1 -1
  41. package/dist/commands/segment-fields-command.js +1 -1
  42. package/dist/commands/segment-pwd-command.js +1 -1
  43. package/dist/commands/segment-update-command.js +1 -1
  44. package/dist/commands/segment-use-command.js +1 -1
  45. package/dist/commands/segments.js +1 -1
  46. package/dist/commands/show.js +1 -1
  47. package/dist/commands/tables.js +1 -1
  48. package/dist/commands/use-command.js +1 -1
  49. package/dist/commands/workflow-command.js +1 -1
  50. package/dist/core/auth.js +1 -1
  51. package/dist/core/config.js +1 -1
  52. package/dist/core/credential-cache.js +1 -1
  53. package/dist/core/global-context.js +1 -1
  54. package/dist/core/keychain.js +1 -1
  55. package/dist/core/profile.js +1 -1
  56. package/dist/core/project-config.js +1 -1
  57. package/dist/core/session.js +1 -1
  58. package/dist/index.js +1 -1
  59. package/dist/proxy/anthropic-adapter.js +1 -1
  60. package/dist/proxy/claude-usage-tracker.js +1 -1
  61. package/dist/proxy/context-signature.js +1 -1
  62. package/dist/proxy/conversation-utils.js +1 -1
  63. package/dist/proxy/server.js +1 -1
  64. package/dist/proxy/session-cache.js +1 -1
  65. package/dist/sdk/api.js +1 -1
  66. package/dist/sdk/engage.js +1 -1
  67. package/dist/sdk/errors.js +1 -1
  68. package/dist/sdk/index.js +1 -1
  69. package/dist/sdk/job.js +1 -1
  70. package/dist/sdk/llm.js +1 -1
  71. package/dist/sdk/query.js +1 -1
  72. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  73. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  74. package/dist/sdk/segment.d.ts.map +1 -1
  75. package/dist/sdk/segment.js +1 -1
  76. package/dist/sdk/segment.js.map +1 -1
  77. package/dist/sdk/workflow.js +1 -1
  78. package/dist/types/cdp.d.ts +59 -0
  79. package/dist/types/cdp.d.ts.map +1 -1
  80. package/dist/types/endpoints.js +1 -1
  81. package/dist/types/index.d.ts +1 -1
  82. package/dist/types/index.d.ts.map +1 -1
  83. package/dist/types/index.js +1 -1
  84. package/dist/utils/agent-ref-parser.js +1 -1
  85. package/dist/utils/chat-cache.js +1 -1
  86. package/dist/utils/colors.js +1 -1
  87. package/dist/utils/command-output.js +1 -1
  88. package/dist/utils/constants.js +1 -1
  89. package/dist/utils/diff.js +1 -1
  90. package/dist/utils/fields-display.d.ts +1 -0
  91. package/dist/utils/fields-display.d.ts.map +1 -1
  92. package/dist/utils/fields-display.js +1 -1
  93. package/dist/utils/fields-display.js.map +1 -1
  94. package/dist/utils/file-permissions.js +1 -1
  95. package/dist/utils/format-detector.js +1 -1
  96. package/dist/utils/formatters.js +1 -1
  97. package/dist/utils/json-loader.js +1 -1
  98. package/dist/utils/llm-backup-utils.js +1 -1
  99. package/dist/utils/model-aliases.js +1 -1
  100. package/dist/utils/model-factors.js +1 -1
  101. package/dist/utils/option-validation.js +1 -1
  102. package/dist/utils/port.js +1 -1
  103. package/dist/utils/process.js +1 -1
  104. package/dist/utils/prompt.js +1 -1
  105. package/dist/utils/segment-path-parser.js +1 -1
  106. package/dist/utils/segment-ref-parser.js +1 -1
  107. package/dist/utils/spinner.js +1 -1
  108. package/dist/utils/sql-parser.js +1 -1
  109. package/dist/utils/sse-parser.js +1 -1
  110. package/dist/utils/string-utils.js +1 -1
  111. package/dist/utils/table-ref-parser.js +1 -1
  112. package/dist/utils/tdx-logger.js +1 -1
  113. package/dist/utils/tree-formatter.js +1 -1
  114. package/dist/utils/version-check.js +1 -1
  115. package/dist/utils/workflow-utils.js +1 -1
  116. package/package.json +1 -1
@@ -1 +1 @@
1
- function a5_0x47e6(_0x3051dc,_0xb861aa){const _0x2490e1=a5_0x2490();return a5_0x47e6=function(_0x47e6b0,_0x1ebdb1){_0x47e6b0=_0x47e6b0-0xf5;let _0x42e664=_0x2490e1[_0x47e6b0];return _0x42e664;},a5_0x47e6(_0x3051dc,_0xb861aa);}const a5_0x42b867=a5_0x47e6;(function(_0x533971,_0x3532ce){const _0x3101b1=a5_0x47e6,_0x4cccf9=_0x533971();while(!![]){try{const _0xb0905a=parseInt(_0x3101b1(0xf8))/0x1+parseInt(_0x3101b1(0xfe))/0x2+parseInt(_0x3101b1(0x103))/0x3*(parseInt(_0x3101b1(0x124))/0x4)+-parseInt(_0x3101b1(0x113))/0x5*(parseInt(_0x3101b1(0x10f))/0x6)+parseInt(_0x3101b1(0x13a))/0x7*(parseInt(_0x3101b1(0x13d))/0x8)+parseInt(_0x3101b1(0x10a))/0x9+parseInt(_0x3101b1(0x10e))/0xa*(-parseInt(_0x3101b1(0x142))/0xb);if(_0xb0905a===_0x3532ce)break;else _0x4cccf9['push'](_0x4cccf9['shift']());}catch(_0x43b06c){_0x4cccf9['push'](_0x4cccf9['shift']());}}}(a5_0x2490,0x59a3a));import{ErrorCode,SDKError}from'../sdk/errors.js';import a5_0x3ee83f from'json-bigint';const DEFAULT_RETRY_CONFIG={'maxRetries':0x3,'baseDelay':0x3e8,'maxDelay':0x1f40};function a5_0x2490(){const _0x42727c=[']\x20Request\x20failed\x20with\x20','5484969EVZIDI','baseUrl','pow','info','951650bWcogx','18NMMHIX','HTTP_REQUEST_FAILURE','signal','name','974945yjmyyO','detail','Error','NOT_FOUND','Error\x20response\x20body:\x20','\x20failed:\x20','severity','HTTP\x20','addEventListener','get','parseProblemDetails','object','debug','text','retrying\x20in\x20','INTERNAL','stringify','24SmQUry','\x0a\x20\x20Details:\x20','retryConfig','baseDelay','application/json','Request\x20failed\x20after\x20retries','Request\x20to\x20','Content-Type','status','trace',']\x20Request\x20to\x20','message','sleep','maxRetries','HTTPClientError','UNAUTHENTICATED','title','Retry-After','body','type','extractErrorMessage','instance','770bkfMMO','maxDelay','ms...','51736pBmkcK','Request\x20cancelled\x20by\x20user','arraybuffer','includes','status_code','154iMQgqG','aborted','code','safeParseJSON','string','abort','warn','round','headers','problemDetails','handleErrorResponse','request\x20body:\x20','request','from','[binary\x20data]',']:\x20','errors','min','[Retry\x20','arrayBuffer','584603OHKJGu','Request:\x20','AbortError','parse','Response\x20[','combineSignals','608230RiBsVG','length','defaultHeaders','INVALID_ARGUMENT','requestSSE','37455MHjLIZ',']\x20Request\x20failed\x20with\x20HTTP\x20','statusText','logger','already\x20running','PERMISSION_DENIED'];a5_0x2490=function(){return _0x42727c;};return a5_0x2490();}function isRetryableStatus(_0x2fbef5){return _0x2fbef5>=0x1f4||_0x2fbef5===0x1ad;}function isNonRetryable429(_0x412adb){const _0x2aeaf1=a5_0x47e6;return _0x412adb[_0x2aeaf1(0x140)](_0x2aeaf1(0x107));}function getRetryDelay(_0xb75300,_0xd9297){const _0x463a90=a5_0x47e6,_0x5cdeb3=Math[_0x463a90(0xf5)](_0xd9297[_0x463a90(0x127)]*Math[_0x463a90(0x10c)](0x2,_0xb75300),_0xd9297[_0x463a90(0x13b)]);return Math['random']()*_0x5cdeb3;}function statusCodeToErrorCode(_0x5a3e35){const _0x36623f=a5_0x47e6;if(_0x5a3e35===0x191)return ErrorCode[_0x36623f(0x133)];else{if(_0x5a3e35===0x193)return ErrorCode[_0x36623f(0x108)];else{if(_0x5a3e35===0x194)return ErrorCode[_0x36623f(0x116)];else{if(_0x5a3e35===0x1ad)return ErrorCode['RATE_LIMITED'];else return _0x5a3e35>=0x1f4?ErrorCode['UNAVAILABLE']:ErrorCode[_0x36623f(0x101)];}}}}export class HTTPClientError extends Error{['status'];[a5_0x42b867(0x14b)];['code'];constructor(_0x3f25c2,_0x328223,_0x3a73ba){const _0x345fe1=a5_0x42b867,_0x3770b6=statusCodeToErrorCode(_0x328223);super('['+_0x3770b6+']\x20'+_0x3f25c2),this[_0x345fe1(0x12c)]=_0x328223,this['problemDetails']=_0x3a73ba,this[_0x345fe1(0x112)]=_0x345fe1(0x132),this[_0x345fe1(0x144)]=_0x3770b6;}}export class HTTPClient{[a5_0x42b867(0x126)];[a5_0x42b867(0x10b)];['defaultHeaders'];['logger'];constructor(_0x32f319,_0xd92328,_0x54e8ca,_0x4d5328){const _0x140347=a5_0x42b867;this[_0x140347(0x10b)]=_0x32f319,this[_0x140347(0x100)]=_0xd92328,this[_0x140347(0x126)]={...DEFAULT_RETRY_CONFIG,..._0x4d5328},this['logger']=_0x54e8ca;}async[a5_0x42b867(0x14e)](_0x1065d1,_0x147e63,_0x152b58={}){const _0x301248=a5_0x42b867,{headers:headers={},body:_0x2a2f83,timeout:timeout=0x7530,retries:retries=this[_0x301248(0x126)][_0x301248(0x131)],signal:_0x4b429c,includeHeaders:includeHeaders=![],responseType:responseType='json'}=_0x152b58,_0x9c5a5c=''+this[_0x301248(0x10b)]+_0x147e63;this[_0x301248(0x106)][_0x301248(0x10d)](_0x301248(0xf9)+_0x1065d1+'\x20'+_0x9c5a5c);const _0x136e53={...this[_0x301248(0x100)],...headers};if(_0x2a2f83&&!_0x136e53['Content-Type']){if(_0x2a2f83 instanceof Buffer){}else _0x136e53[_0x301248(0x12b)]=_0x301248(0x128);}let _0x39a7dc;_0x2a2f83&&(_0x2a2f83 instanceof Buffer?_0x39a7dc=_0x2a2f83:_0x39a7dc=typeof _0x2a2f83==='string'?_0x2a2f83:JSON[_0x301248(0x123)](_0x2a2f83));_0x39a7dc&&this[_0x301248(0x106)][_0x301248(0x11f)](_0x301248(0x14d)+(typeof _0x39a7dc===_0x301248(0x146)?_0x39a7dc:_0x301248(0x150)));let _0x57e808=null;for(let _0x2f5560=0x0;_0x2f5560<=retries;_0x2f5560++){try{const _0x3c88a9=new AbortController(),_0x50ed61=setTimeout(()=>_0x3c88a9[_0x301248(0x147)](),timeout);if(_0x4b429c){if(_0x4b429c[_0x301248(0x143)])throw new Error(_0x301248(0x13e));_0x4b429c[_0x301248(0x11b)](_0x301248(0x147),()=>_0x3c88a9[_0x301248(0x147)](),{'once':!![]});}const _0x59280e=await fetch(_0x9c5a5c,{'method':_0x1065d1,'headers':_0x136e53,'body':_0x39a7dc,'signal':_0x3c88a9[_0x301248(0x111)]});clearTimeout(_0x50ed61);if(_0x2f5560<retries&&isRetryableStatus(_0x59280e[_0x301248(0x12c)])){if(_0x59280e['status']===0x1ad){const _0x25d701=await _0x59280e['text']();if(isNonRetryable429(_0x25d701)){const _0x441614=this[_0x301248(0x138)](_0x25d701)||_0x59280e['statusText'];throw new HTTPClientError(_0x441614,_0x59280e[_0x301248(0x12c)]);}}const _0x2e6d03=_0x59280e[_0x301248(0x14a)][_0x301248(0x11c)](_0x301248(0x135)),_0x199a64=_0x2e6d03?parseInt(_0x2e6d03,0xa)*0x3e8:getRetryDelay(_0x2f5560,this[_0x301248(0x126)]);console[_0x301248(0x148)]('[Retry\x20'+(_0x2f5560+0x1)+'/'+retries+_0x301248(0x109)+_0x59280e['status']+',\x20'+(_0x301248(0x121)+Math['round'](_0x199a64)+_0x301248(0x13c))),await this[_0x301248(0x130)](_0x199a64);continue;}!_0x59280e['ok']&&await this[_0x301248(0x14c)](_0x59280e);let _0x1513d5;if(responseType===_0x301248(0x13f)){const _0x3e7bd1=await _0x59280e[_0x301248(0xf7)]();_0x1513d5=Buffer[_0x301248(0x14f)](_0x3e7bd1);}else responseType===_0x301248(0x120)?_0x1513d5=await _0x59280e['text']():_0x1513d5=await this[_0x301248(0x145)](_0x59280e);this[_0x301248(0x106)][_0x301248(0x11f)](_0x301248(0xfc)+_0x59280e[_0x301248(0x12c)]+_0x301248(0x151)+_0x1065d1+'\x20'+_0x147e63),this[_0x301248(0x106)][_0x301248(0x12d)](JSON[_0x301248(0x123)](_0x1513d5,null,0x2));if(includeHeaders){const _0x58b002={};return _0x59280e[_0x301248(0x14a)]['forEach']((_0x2bfd3c,_0x531090)=>{_0x58b002[_0x531090]=_0x2bfd3c;}),{'data':_0x1513d5,'status':_0x59280e['status'],'headers':_0x58b002};}return _0x1513d5;}catch(_0x28b831){_0x57e808=_0x28b831 instanceof Error?_0x28b831:new Error(String(_0x28b831));if(_0x28b831 instanceof HTTPClientError){if(!isRetryableStatus(_0x28b831[_0x301248(0x12c)])||_0x28b831[_0x301248(0x12c)]===0x1ad&&isNonRetryable429(_0x28b831['message']))throw _0x28b831;}if(_0x2f5560>=retries)throw _0x57e808;const _0x247392=getRetryDelay(_0x2f5560,this[_0x301248(0x126)]);let _0x792f07;_0x57e808 instanceof HTTPClientError?_0x792f07=_0x301248(0xf6)+(_0x2f5560+0x1)+'/'+retries+_0x301248(0x104)+_0x57e808['status']+':\x20'+_0x57e808[_0x301248(0x12f)]+',\x20'+('retrying\x20in\x20'+Math[_0x301248(0x149)](_0x247392)+_0x301248(0x13c)):_0x792f07=_0x301248(0xf6)+(_0x2f5560+0x1)+'/'+retries+_0x301248(0x12e)+_0x9c5a5c+_0x301248(0x118)+_0x57e808[_0x301248(0x12f)]+',\x20'+(_0x301248(0x121)+Math[_0x301248(0x149)](_0x247392)+'ms...'),console[_0x301248(0x148)](_0x792f07),await this[_0x301248(0x130)](_0x247392);}}if(_0x57e808&&!(_0x57e808 instanceof HTTPClientError))throw new SDKError(ErrorCode[_0x301248(0x110)],_0x301248(0x12a)+_0x9c5a5c+'\x20failed:\x20'+_0x57e808['message'],_0x57e808);throw _0x57e808||new SDKError(ErrorCode[_0x301248(0x122)],_0x301248(0x129));}async[a5_0x42b867(0x145)](_0x1b5117){const _0x409eb2=a5_0x42b867,_0x4349ac=await _0x1b5117[_0x409eb2(0x120)]();if(!_0x4349ac)return null;try{const _0x3b113f=a5_0x3ee83f({'storeAsString':!![]});return _0x3b113f[_0x409eb2(0xfb)](_0x4349ac);}catch{return{'body':_0x4349ac};}}[a5_0x42b867(0x11d)](_0x3efd4d,_0x303f5b){const _0x490b=a5_0x42b867;if(!_0x3efd4d||typeof _0x3efd4d!==_0x490b(0x11e))return undefined;let _0x1aa40b=_0x3efd4d;_0x1aa40b[_0x490b(0x152)]&&typeof _0x1aa40b[_0x490b(0x152)]===_0x490b(0x11e)&&(_0x1aa40b=_0x1aa40b[_0x490b(0x152)]);if(_0x1aa40b[_0x490b(0x137)]||_0x1aa40b[_0x490b(0x134)]||_0x1aa40b['detail'])return{'type':_0x1aa40b['type']||'about:blank','title':_0x1aa40b[_0x490b(0x134)]||_0x490b(0x115),'status':_0x1aa40b[_0x490b(0x12c)]||_0x303f5b,'detail':_0x1aa40b[_0x490b(0x114)]||'An\x20error\x20occurred','instance':_0x1aa40b[_0x490b(0x139)]||'',..._0x1aa40b};const _0x43ee44=_0x1aa40b['message']||_0x1aa40b['error']||_0x1aa40b['text'];if(typeof _0x43ee44===_0x490b(0x146))return{'type':'about:blank','title':_0x1aa40b[_0x490b(0x119)]||_0x490b(0x115),'status':_0x1aa40b[_0x490b(0x141)]||_0x303f5b,'detail':_0x43ee44,'instance':'',..._0x1aa40b};return undefined;}async[a5_0x42b867(0x14c)](_0x288209){const _0x51b28e=a5_0x42b867,_0x48f0ec=await this['safeParseJSON'](_0x288209),_0x44a43b=this['parseProblemDetails'](_0x48f0ec,_0x288209[_0x51b28e(0x12c)]);_0x48f0ec&&this[_0x51b28e(0x106)][_0x51b28e(0x11f)](_0x51b28e(0x117)+JSON[_0x51b28e(0x123)](_0x48f0ec));let _0xab7d5d;if(_0x44a43b?.['detail'])_0xab7d5d=_0x44a43b[_0x51b28e(0x114)];else _0x48f0ec?_0xab7d5d=_0x51b28e(0x11a)+_0x288209['status']+':\x20'+_0x288209['statusText']+_0x51b28e(0x125)+JSON[_0x51b28e(0x123)](_0x48f0ec):_0xab7d5d=_0x51b28e(0x11a)+_0x288209[_0x51b28e(0x12c)]+':\x20'+_0x288209[_0x51b28e(0x105)];throw new HTTPClientError(_0xab7d5d,_0x288209[_0x51b28e(0x12c)],_0x44a43b);}['sleep'](_0x32099b){return new Promise(_0x45e2e4=>setTimeout(_0x45e2e4,_0x32099b));}['extractErrorMessage'](_0x5bb558){const _0x193de6=a5_0x42b867;try{const _0x4e9be9=JSON['parse'](_0x5bb558);return _0x4e9be9[_0x193de6(0x114)]||_0x4e9be9[_0x193de6(0x12f)]||_0x4e9be9['error']||null;}catch{return _0x5bb558[_0x193de6(0xff)]<0x1f4?_0x5bb558:null;}}async[a5_0x42b867(0x102)](_0x3f7fe5,_0xdf12b9,_0xf1b3fa={}){const _0x3d1e7a=a5_0x42b867,{headers:headers={},body:_0x7d5d40,timeout:timeout=0x7530,signal:_0x882feb}=_0xf1b3fa,_0x2b6957=''+this[_0x3d1e7a(0x10b)]+_0xdf12b9,_0x6b6cef={...this['defaultHeaders'],...headers},_0x93c5fd=new AbortController(),_0x4ac98d=setTimeout(()=>_0x93c5fd['abort'](),timeout),_0x2c56cc=_0x882feb?[_0x93c5fd[_0x3d1e7a(0x111)],_0x882feb]:[_0x93c5fd[_0x3d1e7a(0x111)]],_0x1e2afb=this['combineSignals'](_0x2c56cc);try{const _0x167a54={'method':_0x3f7fe5,'headers':_0x6b6cef,'signal':_0x1e2afb};if(_0x7d5d40){if(typeof _0x7d5d40===_0x3d1e7a(0x146))_0x167a54['body']=_0x7d5d40;else _0x7d5d40 instanceof Buffer?_0x167a54[_0x3d1e7a(0x136)]=_0x7d5d40:_0x167a54['body']=JSON['stringify'](_0x7d5d40);}const _0x247eff=await fetch(_0x2b6957,_0x167a54);return clearTimeout(_0x4ac98d),!_0x247eff['ok']&&await this['handleErrorResponse'](_0x247eff),_0x247eff;}catch(_0x49705d){clearTimeout(_0x4ac98d);if(_0x49705d instanceof HTTPClientError)throw _0x49705d;if(_0x49705d[_0x3d1e7a(0x112)]===_0x3d1e7a(0xfa))throw new Error(_0x3d1e7a(0x13e));throw _0x49705d;}}[a5_0x42b867(0xfd)](_0x26a2ad){const _0x27f271=a5_0x42b867,_0x30c86b=new AbortController();for(const _0x578f50 of _0x26a2ad){if(_0x578f50[_0x27f271(0x143)])return _0x30c86b[_0x27f271(0x147)](),_0x30c86b[_0x27f271(0x111)];_0x578f50[_0x27f271(0x11b)]('abort',()=>_0x30c86b['abort'](),{'once':!![]});}return _0x30c86b[_0x27f271(0x111)];}}
1
+ const a5_0x15d6d6=a5_0x9a8e;function a5_0x9a8e(_0x42b939,_0x304f3e){const _0x4e9f63=a5_0x4e9f();return a5_0x9a8e=function(_0x9a8ee,_0x2193fd){_0x9a8ee=_0x9a8ee-0x11d;let _0x3e0add=_0x4e9f63[_0x9a8ee];return _0x3e0add;},a5_0x9a8e(_0x42b939,_0x304f3e);}(function(_0x11460d,_0x16eebe){const _0x1e5cc9=a5_0x9a8e,_0xa7aec5=_0x11460d();while(!![]){try{const _0x3d620e=parseInt(_0x1e5cc9(0x167))/0x1*(-parseInt(_0x1e5cc9(0x156))/0x2)+parseInt(_0x1e5cc9(0x13f))/0x3*(parseInt(_0x1e5cc9(0x146))/0x4)+-parseInt(_0x1e5cc9(0x16d))/0x5+parseInt(_0x1e5cc9(0x12f))/0x6*(-parseInt(_0x1e5cc9(0x145))/0x7)+parseInt(_0x1e5cc9(0x155))/0x8+parseInt(_0x1e5cc9(0x14d))/0x9*(parseInt(_0x1e5cc9(0x137))/0xa)+parseInt(_0x1e5cc9(0x136))/0xb;if(_0x3d620e===_0x16eebe)break;else _0xa7aec5['push'](_0xa7aec5['shift']());}catch(_0xa1459c){_0xa7aec5['push'](_0xa7aec5['shift']());}}}(a5_0x4e9f,0x797f0));import{ErrorCode,SDKError}from'../sdk/errors.js';import a5_0x54c96e from'json-bigint';const DEFAULT_RETRY_CONFIG={'maxRetries':0x3,'baseDelay':0x3e8,'maxDelay':0x1f40};function isRetryableStatus(_0x3c08d7){return _0x3c08d7>=0x1f4||_0x3c08d7===0x1ad;}function isNonRetryable429(_0xfe620){const _0x368ab9=a5_0x9a8e;return _0xfe620['includes'](_0x368ab9(0x174));}function getRetryDelay(_0x4cb79a,_0x3d1baf){const _0x41488d=a5_0x9a8e,_0x423d92=Math[_0x41488d(0x157)](_0x3d1baf[_0x41488d(0x133)]*Math[_0x41488d(0x13e)](0x2,_0x4cb79a),_0x3d1baf['maxDelay']);return Math[_0x41488d(0x12a)]()*_0x423d92;}function statusCodeToErrorCode(_0x58a3e7){const _0x492859=a5_0x9a8e;if(_0x58a3e7===0x191)return ErrorCode[_0x492859(0x130)];else{if(_0x58a3e7===0x193)return ErrorCode[_0x492859(0x149)];else{if(_0x58a3e7===0x194)return ErrorCode[_0x492859(0x177)];else{if(_0x58a3e7===0x1ad)return ErrorCode[_0x492859(0x166)];else return _0x58a3e7>=0x1f4?ErrorCode[_0x492859(0x13b)]:ErrorCode[_0x492859(0x11f)];}}}}export class HTTPClientError extends Error{['status'];[a5_0x15d6d6(0x124)];[a5_0x15d6d6(0x165)];constructor(_0x344d49,_0xe6d6b9,_0x35608a){const _0x1e4184=a5_0x15d6d6,_0x26564c=statusCodeToErrorCode(_0xe6d6b9);super('['+_0x26564c+']\x20'+_0x344d49),this[_0x1e4184(0x170)]=_0xe6d6b9,this[_0x1e4184(0x124)]=_0x35608a,this['name']=_0x1e4184(0x12e),this['code']=_0x26564c;}}export class HTTPClient{[a5_0x15d6d6(0x159)];[a5_0x15d6d6(0x16f)];[a5_0x15d6d6(0x158)];[a5_0x15d6d6(0x14e)];constructor(_0x5a1f10,_0x2b26d6,_0x5c77c3,_0x9671a4){const _0x2090bd=a5_0x15d6d6;this[_0x2090bd(0x16f)]=_0x5a1f10,this[_0x2090bd(0x158)]=_0x2b26d6,this[_0x2090bd(0x159)]={...DEFAULT_RETRY_CONFIG,..._0x9671a4},this[_0x2090bd(0x14e)]=_0x5c77c3;}async['request'](_0x535bc8,_0x37da5a,_0x530b1a={}){const _0x3e0bba=a5_0x15d6d6,{headers:headers={},body:_0x5cf4a1,timeout:timeout=0x7530,retries:retries=this[_0x3e0bba(0x159)][_0x3e0bba(0x120)],signal:_0xd7a72a,includeHeaders:includeHeaders=![],responseType:responseType=_0x3e0bba(0x154)}=_0x530b1a,_0x8d9480=''+this[_0x3e0bba(0x16f)]+_0x37da5a;this[_0x3e0bba(0x14e)][_0x3e0bba(0x16c)](_0x3e0bba(0x12d)+_0x535bc8+'\x20'+_0x8d9480);const _0x336387={...this[_0x3e0bba(0x158)],...headers};if(_0x5cf4a1&&!_0x336387[_0x3e0bba(0x147)]){if(_0x5cf4a1 instanceof Buffer){}else _0x336387[_0x3e0bba(0x147)]='application/json';}let _0x2a0b8f;_0x5cf4a1&&(_0x5cf4a1 instanceof Buffer?_0x2a0b8f=_0x5cf4a1:_0x2a0b8f=typeof _0x5cf4a1===_0x3e0bba(0x15c)?_0x5cf4a1:JSON[_0x3e0bba(0x11d)](_0x5cf4a1));_0x2a0b8f&&this[_0x3e0bba(0x14e)][_0x3e0bba(0x16e)](_0x3e0bba(0x148)+(typeof _0x2a0b8f===_0x3e0bba(0x15c)?_0x2a0b8f:_0x3e0bba(0x139)));let _0x4afe13=null;for(let _0x3d8031=0x0;_0x3d8031<=retries;_0x3d8031++){try{const _0x456dab=new AbortController(),_0x2845bb=setTimeout(()=>_0x456dab['abort'](),timeout);if(_0xd7a72a){if(_0xd7a72a[_0x3e0bba(0x14c)])throw new Error('Request\x20cancelled\x20by\x20user');_0xd7a72a[_0x3e0bba(0x15d)](_0x3e0bba(0x132),()=>_0x456dab[_0x3e0bba(0x132)](),{'once':!![]});}const _0x327a4c=await fetch(_0x8d9480,{'method':_0x535bc8,'headers':_0x336387,'body':_0x2a0b8f,'signal':_0x456dab[_0x3e0bba(0x162)]});clearTimeout(_0x2845bb);if(_0x3d8031<retries&&isRetryableStatus(_0x327a4c[_0x3e0bba(0x170)])){if(_0x327a4c[_0x3e0bba(0x170)]===0x1ad){const _0x534643=await _0x327a4c[_0x3e0bba(0x151)]();if(isNonRetryable429(_0x534643)){const _0x3e5e9d=this[_0x3e0bba(0x16a)](_0x534643)||_0x327a4c[_0x3e0bba(0x152)];throw new HTTPClientError(_0x3e5e9d,_0x327a4c[_0x3e0bba(0x170)]);}}const _0x47b297=_0x327a4c['headers'][_0x3e0bba(0x168)](_0x3e0bba(0x169)),_0x515141=_0x47b297?parseInt(_0x47b297,0xa)*0x3e8:getRetryDelay(_0x3d8031,this['retryConfig']);console['warn'](_0x3e0bba(0x171)+(_0x3d8031+0x1)+'/'+retries+_0x3e0bba(0x121)+_0x327a4c[_0x3e0bba(0x170)]+',\x20'+(_0x3e0bba(0x126)+Math['round'](_0x515141)+_0x3e0bba(0x12c))),await this[_0x3e0bba(0x13d)](_0x515141);continue;}!_0x327a4c['ok']&&await this[_0x3e0bba(0x173)](_0x327a4c);let _0x201e8b;if(responseType===_0x3e0bba(0x129)){const _0x459414=await _0x327a4c['arrayBuffer']();_0x201e8b=Buffer[_0x3e0bba(0x141)](_0x459414);}else responseType===_0x3e0bba(0x151)?_0x201e8b=await _0x327a4c[_0x3e0bba(0x151)]():_0x201e8b=await this[_0x3e0bba(0x144)](_0x327a4c);this[_0x3e0bba(0x14e)][_0x3e0bba(0x16e)](_0x3e0bba(0x163)+_0x327a4c[_0x3e0bba(0x170)]+_0x3e0bba(0x15a)+_0x535bc8+'\x20'+_0x37da5a),this[_0x3e0bba(0x14e)][_0x3e0bba(0x172)](JSON['stringify'](_0x201e8b,null,0x2));if(includeHeaders){const _0x25f9ac={};return _0x327a4c[_0x3e0bba(0x123)][_0x3e0bba(0x13c)]((_0xeb56d2,_0x1ed5aa)=>{_0x25f9ac[_0x1ed5aa]=_0xeb56d2;}),{'data':_0x201e8b,'status':_0x327a4c['status'],'headers':_0x25f9ac};}return _0x201e8b;}catch(_0x32ad68){_0x4afe13=_0x32ad68 instanceof Error?_0x32ad68:new Error(String(_0x32ad68));if(_0x32ad68 instanceof HTTPClientError){if(!isRetryableStatus(_0x32ad68[_0x3e0bba(0x170)])||_0x32ad68[_0x3e0bba(0x170)]===0x1ad&&isNonRetryable429(_0x32ad68[_0x3e0bba(0x14a)]))throw _0x32ad68;}if(_0x3d8031>=retries)throw _0x4afe13;const _0xd944d4=getRetryDelay(_0x3d8031,this['retryConfig']);let _0x24fe1e;_0x4afe13 instanceof HTTPClientError?_0x24fe1e='[Retry\x20'+(_0x3d8031+0x1)+'/'+retries+']\x20Request\x20failed\x20with\x20HTTP\x20'+_0x4afe13[_0x3e0bba(0x170)]+':\x20'+_0x4afe13['message']+',\x20'+(_0x3e0bba(0x126)+Math[_0x3e0bba(0x16b)](_0xd944d4)+_0x3e0bba(0x12c)):_0x24fe1e='[Retry\x20'+(_0x3d8031+0x1)+'/'+retries+']\x20Request\x20to\x20'+_0x8d9480+_0x3e0bba(0x160)+_0x4afe13[_0x3e0bba(0x14a)]+',\x20'+(_0x3e0bba(0x126)+Math['round'](_0xd944d4)+_0x3e0bba(0x12c)),console[_0x3e0bba(0x176)](_0x24fe1e),await this[_0x3e0bba(0x13d)](_0xd944d4);}}if(_0x4afe13&&!(_0x4afe13 instanceof HTTPClientError))throw new SDKError(ErrorCode[_0x3e0bba(0x134)],_0x3e0bba(0x142)+_0x8d9480+_0x3e0bba(0x160)+_0x4afe13[_0x3e0bba(0x14a)],_0x4afe13);throw _0x4afe13||new SDKError(ErrorCode[_0x3e0bba(0x15f)],'Request\x20failed\x20after\x20retries');}async['safeParseJSON'](_0x25fe23){const _0x2018db=a5_0x15d6d6,_0x33bb4a=await _0x25fe23[_0x2018db(0x151)]();if(!_0x33bb4a)return null;try{const _0x4b1cdd=a5_0x54c96e({'storeAsString':!![]});return _0x4b1cdd[_0x2018db(0x13a)](_0x33bb4a);}catch{return{'body':_0x33bb4a};}}['parseProblemDetails'](_0x106017,_0x1216ff){const _0xeec4c6=a5_0x15d6d6;if(!_0x106017||typeof _0x106017!=='object')return undefined;let _0x598344=_0x106017;_0x598344[_0xeec4c6(0x125)]&&typeof _0x598344[_0xeec4c6(0x125)]===_0xeec4c6(0x15b)&&(_0x598344=_0x598344[_0xeec4c6(0x125)]);if(_0x598344[_0xeec4c6(0x14b)]||_0x598344[_0xeec4c6(0x140)]||_0x598344[_0xeec4c6(0x15e)])return{'type':_0x598344[_0xeec4c6(0x14b)]||'about:blank','title':_0x598344[_0xeec4c6(0x140)]||_0xeec4c6(0x127),'status':_0x598344[_0xeec4c6(0x170)]||_0x1216ff,'detail':_0x598344['detail']||_0xeec4c6(0x122),'instance':_0x598344[_0xeec4c6(0x175)]||'',..._0x598344};const _0x2711e5=_0x598344['message']||_0x598344[_0xeec4c6(0x143)]||_0x598344[_0xeec4c6(0x151)];if(typeof _0x2711e5===_0xeec4c6(0x15c))return{'type':_0xeec4c6(0x14f),'title':_0x598344[_0xeec4c6(0x161)]||_0xeec4c6(0x127),'status':_0x598344[_0xeec4c6(0x135)]||_0x1216ff,'detail':_0x2711e5,'instance':'',..._0x598344};return undefined;}async[a5_0x15d6d6(0x173)](_0x142b4f){const _0x13576a=a5_0x15d6d6,_0x2576b5=await this[_0x13576a(0x144)](_0x142b4f),_0x10a16c=this[_0x13576a(0x11e)](_0x2576b5,_0x142b4f[_0x13576a(0x170)]);_0x2576b5&&this['logger'][_0x13576a(0x16e)]('Error\x20response\x20body:\x20'+JSON[_0x13576a(0x11d)](_0x2576b5));let _0xb9e5ce;if(_0x10a16c?.[_0x13576a(0x15e)])_0xb9e5ce=_0x10a16c[_0x13576a(0x15e)];else _0x2576b5?_0xb9e5ce=_0x13576a(0x131)+_0x142b4f['status']+':\x20'+_0x142b4f['statusText']+_0x13576a(0x138)+JSON[_0x13576a(0x11d)](_0x2576b5):_0xb9e5ce=_0x13576a(0x131)+_0x142b4f['status']+':\x20'+_0x142b4f[_0x13576a(0x152)];throw new HTTPClientError(_0xb9e5ce,_0x142b4f[_0x13576a(0x170)],_0x10a16c);}[a5_0x15d6d6(0x13d)](_0x163bfc){return new Promise(_0x16bb63=>setTimeout(_0x16bb63,_0x163bfc));}[a5_0x15d6d6(0x16a)](_0x962020){const _0x1f0e05=a5_0x15d6d6;try{const _0x35747b=JSON[_0x1f0e05(0x13a)](_0x962020);return _0x35747b[_0x1f0e05(0x15e)]||_0x35747b[_0x1f0e05(0x14a)]||_0x35747b['error']||null;}catch{return _0x962020['length']<0x1f4?_0x962020:null;}}async[a5_0x15d6d6(0x128)](_0x26d5ef,_0x30f6b4,_0x497e9a={}){const _0x1bcd6b=a5_0x15d6d6,{headers:headers={},body:_0x1227de,timeout:timeout=0x7530,signal:_0x4c3c1f}=_0x497e9a,_0x2d8323=''+this[_0x1bcd6b(0x16f)]+_0x30f6b4,_0x2c98d3={...this[_0x1bcd6b(0x158)],...headers},_0x2345a3=new AbortController(),_0x4c4072=setTimeout(()=>_0x2345a3[_0x1bcd6b(0x132)](),timeout),_0x44e203=_0x4c3c1f?[_0x2345a3['signal'],_0x4c3c1f]:[_0x2345a3['signal']],_0x40ca4c=this[_0x1bcd6b(0x150)](_0x44e203);try{const _0x586c84={'method':_0x26d5ef,'headers':_0x2c98d3,'signal':_0x40ca4c};if(_0x1227de){if(typeof _0x1227de===_0x1bcd6b(0x15c))_0x586c84[_0x1bcd6b(0x12b)]=_0x1227de;else _0x1227de instanceof Buffer?_0x586c84['body']=_0x1227de:_0x586c84[_0x1bcd6b(0x12b)]=JSON[_0x1bcd6b(0x11d)](_0x1227de);}const _0x182faa=await fetch(_0x2d8323,_0x586c84);return clearTimeout(_0x4c4072),!_0x182faa['ok']&&await this[_0x1bcd6b(0x173)](_0x182faa),_0x182faa;}catch(_0x188d2f){clearTimeout(_0x4c4072);if(_0x188d2f instanceof HTTPClientError)throw _0x188d2f;if(_0x188d2f[_0x1bcd6b(0x153)]===_0x1bcd6b(0x164))throw new Error('Request\x20cancelled\x20by\x20user');throw _0x188d2f;}}[a5_0x15d6d6(0x150)](_0x5a9bda){const _0x154aab=a5_0x15d6d6,_0x2a9bc1=new AbortController();for(const _0x4f0300 of _0x5a9bda){if(_0x4f0300[_0x154aab(0x14c)])return _0x2a9bc1['abort'](),_0x2a9bc1['signal'];_0x4f0300[_0x154aab(0x15d)]('abort',()=>_0x2a9bc1[_0x154aab(0x132)](),{'once':!![]});}return _0x2a9bc1[_0x154aab(0x162)];}}function a5_0x4e9f(){const _0x5847a9=['9aGGIiE','logger','about:blank','combineSignals','text','statusText','name','json','2831416znlSHG','406zMmmpV','min','defaultHeaders','retryConfig',']:\x20','object','string','addEventListener','detail','INTERNAL','\x20failed:\x20','severity','signal','Response\x20[','AbortError','code','RATE_LIMITED','957MITzxM','get','Retry-After','extractErrorMessage','round','info','3952435GpJlXg','debug','baseUrl','status','[Retry\x20','trace','handleErrorResponse','already\x20running','instance','warn','NOT_FOUND','stringify','parseProblemDetails','INVALID_ARGUMENT','maxRetries',']\x20Request\x20failed\x20with\x20','An\x20error\x20occurred','headers','problemDetails','errors','retrying\x20in\x20','Error','requestSSE','arraybuffer','random','body','ms...','Request:\x20','HTTPClientError','530886kvAdpM','UNAUTHENTICATED','HTTP\x20','abort','baseDelay','HTTP_REQUEST_FAILURE','status_code','9256610XxzPvT','1347550aqEDAh','\x0a\x20\x20Details:\x20','[binary\x20data]','parse','UNAVAILABLE','forEach','sleep','pow','1365iRIBhs','title','from','Request\x20to\x20','error','safeParseJSON','7AlFgiy','2116ZqMVft','Content-Type','request\x20body:\x20','PERMISSION_DENIED','message','type','aborted'];a5_0x4e9f=function(){return _0x5847a9;};return a5_0x4e9f();}
@@ -1 +1 @@
1
- const a6_0x4d180e=a6_0x25f6;(function(_0x25ba13,_0x31b633){const _0x293cd2=a6_0x25f6,_0x18fe64=_0x25ba13();while(!![]){try{const _0xd069ca=parseInt(_0x293cd2(0x192))/0x1+-parseInt(_0x293cd2(0x1ab))/0x2+parseInt(_0x293cd2(0x17c))/0x3*(-parseInt(_0x293cd2(0x1a7))/0x4)+parseInt(_0x293cd2(0x180))/0x5*(-parseInt(_0x293cd2(0x1b3))/0x6)+parseInt(_0x293cd2(0x182))/0x7+-parseInt(_0x293cd2(0x1b2))/0x8*(-parseInt(_0x293cd2(0x18f))/0x9)+parseInt(_0x293cd2(0x1a0))/0xa*(parseInt(_0x293cd2(0x175))/0xb);if(_0xd069ca===_0x31b633)break;else _0x18fe64['push'](_0x18fe64['shift']());}catch(_0x3e1527){_0x18fe64['push'](_0x18fe64['shift']());}}}(a6_0x4b92,0x80662));import{HTTPClient}from'./http-client.js';function a6_0x4b92(){const _0x5115a1=['toString','sort','/api/chats?','Failed\x20to\x20create\x20chat:\x20unexpected\x20error','chats','LLM_EMPTY_MESSAGE','165LKfKIl','createAgent','systemPrompt','knowledge_bases','name','getProject','logger','1451013ZnsnzY','getUserSettings','listChats','/api/projects/','29870oORpZL','listProjects','4061533XeTeGZ','/api/agents','status','listAgentsFull','debug','append','site','deleteProject','push','description','requestSSE','httpClient','length','41553txQmhY','reasoningEffort','/api/integrations','301332MFCmBD','request','data','getChatInfo','text/event-stream','updateAgent','llm','paginateAll','search','/api/chats/','startsWith','projectId','createPrompt','LLM_STREAM_ERROR','78210SkNhHk','/api/knowledge_bases?filter[projectId]=','LLM_CHAT_CREATION_FAILURE','listPrompts','warn','Message\x20cannot\x20be\x20empty\x20or\x20whitespace\x20only','/api/chats','8AZDRkF','\x20with\x20message\x20size:\x20','/api/agents/','/api/projects?page[limit]=','760830sbCpCe','ms...','&page[limit]=50','application/json','apiKey','baseUrl','agentId','1816BubzQR','174YUjsdg','integrations','Please\x20provide\x20a\x20non-empty\x20message\x20to\x20continue\x20the\x20chat.','pathname','Failed\x20to\x20create\x20chat\x20after\x20','Failed\x20to\x20continue\x20chat\x20(chatId:\x20','application/vnd.api+json','/api/integrations?filter[projectId]=','starterMessage','POST','/continue','trim','temperature','prompt','authHeaders','DELETE','maxToolIterations','GET','/api/prompts?filter[projectId]=','links','modelType'];a6_0x4b92=function(){return _0x5115a1;};return a6_0x4b92();}import{getEndpoint}from'../types/index.js';import{getAuthHeaders,toHeaderRecord}from'../core/auth.js';import{parseSSEStream}from'../utils/sse-parser.js';import{ErrorCode,SDKError}from'../sdk/errors.js';function a6_0x25f6(_0x325de9,_0x47ddf5){const _0x4b9265=a6_0x4b92();return a6_0x25f6=function(_0x25f6f2,_0x11051e){_0x25f6f2=_0x25f6f2-0x16c;let _0x3f9603=_0x4b9265[_0x25f6f2];return _0x3f9603;},a6_0x25f6(_0x325de9,_0x47ddf5);}export class LLMApiClient{[a6_0x4d180e(0x18d)];['baseUrl'];[a6_0x4d180e(0x1c1)];[a6_0x4d180e(0x17b)];constructor(_0x248aba,_0x48c171){const _0x39ac2e=a6_0x4d180e;this[_0x39ac2e(0x1b0)]=getEndpoint(_0x248aba[_0x39ac2e(0x188)],_0x39ac2e(0x198)),this[_0x39ac2e(0x1c1)]=toHeaderRecord(getAuthHeaders(_0x248aba[_0x39ac2e(0x188)],_0x248aba[_0x39ac2e(0x1af)])),this['logger']=_0x48c171,this[_0x39ac2e(0x18d)]=new HTTPClient(this[_0x39ac2e(0x1b0)],this[_0x39ac2e(0x1c1)],_0x48c171);}async['paginateAll'](_0x9f0680){const _0x430981=a6_0x4d180e,_0x72b077=[];let _0x2a5d31=_0x9f0680;while(_0x2a5d31){const _0x56250a=await this[_0x430981(0x18d)][_0x430981(0x193)]('GET',_0x2a5d31);_0x56250a['data']&&_0x72b077[_0x430981(0x18a)](..._0x56250a[_0x430981(0x194)]);_0x2a5d31=_0x56250a[_0x430981(0x16d)]?.['next'];if(_0x2a5d31&&_0x2a5d31[_0x430981(0x19c)]('http')){const _0x22c92c=new URL(_0x2a5d31);_0x2a5d31=_0x22c92c[_0x430981(0x1b6)]+_0x22c92c[_0x430981(0x19a)];}}return _0x72b077;}async[a6_0x4d180e(0x17d)](){const _0x588fd8=a6_0x4d180e;return await this['httpClient'][_0x588fd8(0x193)]('GET','/api/users/current_settings');}async['createProject'](_0x20388a){const _0xe739a6=a6_0x4d180e,_0x39d7ac={'data':{'type':'projects','attributes':{'name':_0x20388a[_0xe739a6(0x179)],..._0x20388a['description']&&{'description':_0x20388a[_0xe739a6(0x18b)]}}}},_0xe315b5=await this['httpClient'][_0xe739a6(0x193)]('POST','/api/projects',{'headers':{'Content-Type':_0xe739a6(0x1b9),'Accept':_0xe739a6(0x1b9)},'body':_0x39d7ac});return _0xe315b5['data'];}async[a6_0x4d180e(0x189)](_0x16e96f){const _0x124a54=a6_0x4d180e,_0x44bd1b=_0x124a54(0x17f)+encodeURIComponent(_0x16e96f);await this[_0x124a54(0x18d)][_0x124a54(0x193)](_0x124a54(0x1c2),_0x44bd1b);}async[a6_0x4d180e(0x181)](_0x3496b1=0x32){const _0x447b3b=a6_0x4d180e;return this['paginateAll'](_0x447b3b(0x1aa)+_0x3496b1);}async['listAgents'](_0x3cb6da){const _0x45a2ec=a6_0x4d180e;let _0x3186ce=_0x45a2ec(0x183);_0x3cb6da&&(_0x3186ce+='?filter[project_id]='+encodeURIComponent(_0x3cb6da));const _0x4a5748=await this[_0x45a2ec(0x18d)][_0x45a2ec(0x193)](_0x45a2ec(0x1c4),_0x3186ce);return _0x4a5748[_0x45a2ec(0x194)]||[];}async['getAgent'](_0x40a36e){const _0x5cfc7f=a6_0x4d180e,_0x5d3d05='/api/agents/'+encodeURIComponent(_0x40a36e),_0x11b20d=await this[_0x5cfc7f(0x18d)][_0x5cfc7f(0x193)](_0x5cfc7f(0x1c4),_0x5d3d05);return _0x11b20d['data'];}async[a6_0x4d180e(0x176)](_0xb11b71){const _0x27828c=a6_0x4d180e,_0x4e7d06={'name':_0xb11b71['name'],'projectId':_0xb11b71[_0x27828c(0x19d)],'modelType':_0xb11b71[_0x27828c(0x16e)],'maxToolIterations':_0xb11b71[_0x27828c(0x1c3)]??0x4,'temperature':_0xb11b71[_0x27828c(0x1bf)]??0.7};_0xb11b71['systemPrompt']!==undefined&&(_0x4e7d06['systemPrompt']=_0xb11b71[_0x27828c(0x177)]);_0xb11b71[_0x27828c(0x1bb)]&&(_0x4e7d06[_0x27828c(0x1bb)]=_0xb11b71[_0x27828c(0x1bb)]);_0xb11b71[_0x27828c(0x190)]&&(_0x4e7d06['reasoningEffort']=_0xb11b71[_0x27828c(0x190)]);const _0x28246c={'data':{'type':'agents','attributes':_0x4e7d06}},_0x4eab1f=await this[_0x27828c(0x18d)]['request'](_0x27828c(0x1bc),_0x27828c(0x183),{'headers':{'Content-Type':_0x27828c(0x1b9),'Accept':_0x27828c(0x1b9)},'body':_0x28246c});return _0x4eab1f[_0x27828c(0x194)];}async[a6_0x4d180e(0x197)](_0x25eaef,_0x36cd40){const _0x4dd4bb=a6_0x4d180e,_0x936167={'data':{'type':'agents','id':_0x25eaef,'attributes':{..._0x36cd40['name']&&{'name':_0x36cd40[_0x4dd4bb(0x179)]},..._0x36cd40[_0x4dd4bb(0x18b)]&&{'description':_0x36cd40[_0x4dd4bb(0x18b)]},..._0x36cd40[_0x4dd4bb(0x1c0)]&&{'prompt':_0x36cd40[_0x4dd4bb(0x1c0)]},..._0x36cd40['starterMessage']&&{'starter_message':_0x36cd40['starterMessage']},..._0x36cd40[_0x4dd4bb(0x190)]&&{'reasoningEffort':_0x36cd40['reasoningEffort']}}}},_0x16a3b7=_0x4dd4bb(0x1a9)+encodeURIComponent(_0x25eaef),_0x1868dd=await this[_0x4dd4bb(0x18d)][_0x4dd4bb(0x193)]('PATCH',_0x16a3b7,{'body':_0x936167});return _0x1868dd[_0x4dd4bb(0x194)];}async['deleteAgent'](_0x22a7be){const _0xcaf495=a6_0x4d180e,_0x1e11cc='/api/agents/'+encodeURIComponent(_0x22a7be);await this[_0xcaf495(0x18d)][_0xcaf495(0x193)](_0xcaf495(0x1c2),_0x1e11cc);}async[a6_0x4d180e(0x17e)](_0x4fe259=0x32){const _0x3b8b9b=a6_0x4d180e,_0xa86453=new URLSearchParams();_0xa86453[_0x3b8b9b(0x187)]('page[limit]',String(_0x4fe259)),_0xa86453['append'](_0x3b8b9b(0x170),'-last_conversation_at');const _0x5dfd6b=_0x3b8b9b(0x171)+_0xa86453[_0x3b8b9b(0x16f)](),_0x5b359e=await this['httpClient'][_0x3b8b9b(0x193)](_0x3b8b9b(0x1c4),_0x5dfd6b);return _0x5b359e['data']||[];}async[a6_0x4d180e(0x195)](_0x358bfe){const _0x36c207=a6_0x4d180e,_0x303a1d=_0x36c207(0x19b)+encodeURIComponent(_0x358bfe),_0x3d916e=await this[_0x36c207(0x18d)][_0x36c207(0x193)]('GET',_0x303a1d);return _0x3d916e[_0x36c207(0x194)];}async['getChatHistory'](_0x3e0e98){const _0x58549a=a6_0x4d180e,_0x4c9608=_0x58549a(0x19b)+encodeURIComponent(_0x3e0e98)+'/history';return await this[_0x58549a(0x18d)]['request']('GET',_0x4c9608);}async['startChat'](_0x299f14){const _0x2c0255=a6_0x4d180e,_0x234f66={'data':{'type':_0x2c0255(0x173),'attributes':{'agentId':_0x299f14[_0x2c0255(0x1b1)]}}},_0x4ae55b=0x3,_0x5ca594=[0x3e8,0x7d0,0xfa0];for(let _0x1ffc2f=0x0;_0x1ffc2f<=_0x4ae55b;_0x1ffc2f++){const _0x434f6d=await this['httpClient'][_0x2c0255(0x193)]('POST',_0x2c0255(0x1a6),{'headers':{'Content-Type':_0x2c0255(0x1b9),'Accept':_0x2c0255(0x1b9)},'body':_0x234f66});if(_0x434f6d['data']&&_0x434f6d[_0x2c0255(0x194)]['id'])return _0x434f6d['data'];if(_0x1ffc2f>=_0x4ae55b)throw new SDKError(ErrorCode['LLM_CHAT_CREATION_FAILURE'],_0x2c0255(0x1b7)+(_0x4ae55b+0x1)+'\x20attempts:\x20API\x20returned\x20empty\x20chat\x20ID');const _0x5275bf=_0x5ca594[_0x1ffc2f];console[_0x2c0255(0x1a4)]('[Retry\x20'+(_0x1ffc2f+0x1)+'/'+_0x4ae55b+']\x20Chat\x20creation\x20returned\x20empty\x20ID,\x20retrying\x20in\x20'+_0x5275bf+_0x2c0255(0x1ac)),await new Promise(_0x5a247e=>setTimeout(_0x5a247e,_0x5275bf));}throw new SDKError(ErrorCode[_0x2c0255(0x1a2)],_0x2c0255(0x172));}async*['continueChat'](_0x1b8267,_0x5c2610,_0x2a99f2){const _0x287c5e=a6_0x4d180e,_0x4301c0=_0x5c2610[_0x287c5e(0x1be)]();if(!_0x4301c0)throw new SDKError(ErrorCode[_0x287c5e(0x174)],_0x287c5e(0x1a5),undefined,{'helpText':_0x287c5e(0x1b5)});this[_0x287c5e(0x17b)][_0x287c5e(0x186)]('Continuing\x20chat\x20'+_0x1b8267+_0x287c5e(0x1a8)+_0x5c2610['length']+'\x20characters');const _0xb533b5='/api/chats/'+encodeURIComponent(_0x1b8267)+_0x287c5e(0x1bd),_0x198d6f={'input':_0x5c2610};try{const _0x38e6f9=await this[_0x287c5e(0x18d)][_0x287c5e(0x18c)](_0x287c5e(0x1bc),_0xb533b5,{'headers':{'Content-Type':_0x287c5e(0x1ae),'Accept':_0x287c5e(0x196)},'body':_0x198d6f,'signal':_0x2a99f2});this[_0x287c5e(0x17b)][_0x287c5e(0x186)]('['+_0x38e6f9[_0x287c5e(0x184)]+']\x20Streaming\x20SSE\x20stream\x20for\x20chatId:\x20'+_0x1b8267),yield*parseSSEStream(_0x38e6f9,this[_0x287c5e(0x17b)]);}catch(_0x24acea){throw new SDKError(ErrorCode[_0x287c5e(0x19f)],_0x287c5e(0x1b8)+_0x1b8267+',\x20message\x20length:\x20'+_0x5c2610[_0x287c5e(0x18e)]+')',_0x24acea);}}async[a6_0x4d180e(0x17a)](_0x344199){const _0x56be6f=a6_0x4d180e,_0x534342=_0x56be6f(0x17f)+encodeURIComponent(_0x344199),_0x593a74=await this['httpClient'][_0x56be6f(0x193)]('GET',_0x534342);return _0x593a74[_0x56be6f(0x194)];}async['listKnowledgeBases'](_0x1dcdc3){const _0x1bfc10=a6_0x4d180e;return this[_0x1bfc10(0x199)](_0x1bfc10(0x1a1)+encodeURIComponent(_0x1dcdc3)+_0x1bfc10(0x1ad));}async['createKnowledgeBase'](_0x16aec9){const _0x1ff93f=a6_0x4d180e,_0x3fa287={'data':{'type':_0x1ff93f(0x178),'attributes':_0x16aec9}},_0x4d973c=await this[_0x1ff93f(0x18d)]['request'](_0x1ff93f(0x1bc),'/api/knowledge_bases',{'headers':{'Content-Type':_0x1ff93f(0x1b9),'Accept':'application/vnd.api+json'},'body':_0x3fa287});return _0x4d973c[_0x1ff93f(0x194)];}async[a6_0x4d180e(0x1a3)](_0x17b303){const _0x47a8f7=a6_0x4d180e;return this[_0x47a8f7(0x199)](_0x47a8f7(0x16c)+encodeURIComponent(_0x17b303)+_0x47a8f7(0x1ad));}async[a6_0x4d180e(0x19e)](_0x981f47){const _0x547f35=a6_0x4d180e,{jsonSchemaHint:_0x4b76b4,..._0x5ec9fe}=_0x981f47,_0x3aeee7={'data':{'type':'prompts','attributes':_0x5ec9fe}},_0x277214=await this[_0x547f35(0x18d)]['request'](_0x547f35(0x1bc),'/api/prompts',{'headers':{'Content-Type':_0x547f35(0x1b9),'Accept':_0x547f35(0x1b9)},'body':_0x3aeee7});return _0x277214['data'];}async['listIntegrations'](_0x36212e){const _0x22794c=a6_0x4d180e;return this[_0x22794c(0x199)](_0x22794c(0x1ba)+encodeURIComponent(_0x36212e)+'&page[limit]=50');}async['createIntegration'](_0x1bb13c){const _0x126b6e=a6_0x4d180e,_0x188512={'data':{'type':_0x126b6e(0x1b4),'attributes':_0x1bb13c}},_0x4dac57=await this[_0x126b6e(0x18d)][_0x126b6e(0x193)](_0x126b6e(0x1bc),_0x126b6e(0x191),{'headers':{'Content-Type':_0x126b6e(0x1b9),'Accept':_0x126b6e(0x1b9)},'body':_0x188512});return _0x4dac57['data'];}async[a6_0x4d180e(0x185)](_0x542d11){const _0x296d6c=a6_0x4d180e,_0x14135e=await this['listAgents'](_0x542d11),_0x44d46e=[];for(const _0x172ea3 of _0x14135e){const _0x9c29ae=_0x296d6c(0x1a9)+encodeURIComponent(_0x172ea3['id']),_0x1cd254=await this[_0x296d6c(0x18d)][_0x296d6c(0x193)](_0x296d6c(0x1c4),_0x9c29ae);_0x44d46e[_0x296d6c(0x18a)](_0x1cd254[_0x296d6c(0x194)]);}return _0x44d46e;}async['createAgentFull'](_0x4f3bf2){const _0x56e677=a6_0x4d180e,_0x18ba11={'data':{'type':'agents','attributes':_0x4f3bf2}},_0x5b5f0c=await this[_0x56e677(0x18d)][_0x56e677(0x193)](_0x56e677(0x1bc),_0x56e677(0x183),{'headers':{'Content-Type':_0x56e677(0x1b9),'Accept':_0x56e677(0x1b9)},'body':_0x18ba11});return _0x5b5f0c[_0x56e677(0x194)];}}
1
+ function a6_0x3cd7(){const _0x54ec66=['request','getChatInfo','prompt','projectId','baseUrl','/api/prompts','10Ggfyhh','createProject','getProject','text/event-stream','modelType','createKnowledgeBase','agents','getAgent','2220057jbxFlv','/api/chats/',']\x20Chat\x20creation\x20returned\x20empty\x20ID,\x20retrying\x20in\x20','llm','LLM_CHAT_CREATION_FAILURE','2960258HxaDBS','listAgentsFull','debug','prompts','/api/projects?page[limit]=','listAgents','createPrompt','Failed\x20to\x20continue\x20chat\x20(chatId:\x20','/api/projects','site','Failed\x20to\x20create\x20chat:\x20unexpected\x20error','description','httpClient','toString','/api/integrations?filter[projectId]=','LLM_EMPTY_MESSAGE','ms...','5xbCBWz','next','/api/agents','agentId',',\x20message\x20length:\x20','warn','/api/users/current_settings','application/vnd.api+json','27770655KoIYDV','systemPrompt','startChat','reasoningEffort','updateAgent','582390HODzPS','/api/integrations','name','projects','16dAUKUl','links','authHeaders','/api/agents/','getChatHistory','append','33479xpCEBq','knowledge_bases','getUserSettings','POST','6394398jOUiMP','paginateAll','Failed\x20to\x20create\x20chat\x20after\x20','/continue','listProjects','chats','\x20attempts:\x20API\x20returned\x20empty\x20chat\x20ID','trim','pathname','Continuing\x20chat\x20','logger','4dfkkEg',']\x20Streaming\x20SSE\x20stream\x20for\x20chatId:\x20','LLM_STREAM_ERROR','length','integrations','apiKey','\x20with\x20message\x20size:\x20','listKnowledgeBases','6754410RNxyFq','deleteAgent','\x20characters','GET','PATCH','/api/chats?','?filter[project_id]=','starterMessage','data','/history','/api/prompts?filter[projectId]=','DELETE','/api/knowledge_bases','/api/projects/','listChats','http'];a6_0x3cd7=function(){return _0x54ec66;};return a6_0x3cd7();}const a6_0x7f3dd9=a6_0x13a7;function a6_0x13a7(_0x1f029a,_0x2ceede){const _0x3cd720=a6_0x3cd7();return a6_0x13a7=function(_0x13a706,_0x4b43a5){_0x13a706=_0x13a706-0x192;let _0x11540e=_0x3cd720[_0x13a706];return _0x11540e;},a6_0x13a7(_0x1f029a,_0x2ceede);}(function(_0x5140b7,_0x502a98){const _0x5eb1e7=a6_0x13a7,_0x54244b=_0x5140b7();while(!![]){try{const _0x13e545=parseInt(_0x5eb1e7(0x1a0))/0x1*(parseInt(_0x5eb1e7(0x1cd))/0x2)+parseInt(_0x5eb1e7(0x1d5))/0x3*(parseInt(_0x5eb1e7(0x1af))/0x4)+-parseInt(_0x5eb1e7(0x1eb))/0x5*(parseInt(_0x5eb1e7(0x1a4))/0x6)+parseInt(_0x5eb1e7(0x1da))/0x7*(-parseInt(_0x5eb1e7(0x19a))/0x8)+-parseInt(_0x5eb1e7(0x1b7))/0x9+-parseInt(_0x5eb1e7(0x196))/0xa+parseInt(_0x5eb1e7(0x1f3))/0xb;if(_0x13e545===_0x502a98)break;else _0x54244b['push'](_0x54244b['shift']());}catch(_0x249dc0){_0x54244b['push'](_0x54244b['shift']());}}}(a6_0x3cd7,0xadc59));import{HTTPClient}from'./http-client.js';import{getEndpoint}from'../types/index.js';import{getAuthHeaders,toHeaderRecord}from'../core/auth.js';import{parseSSEStream}from'../utils/sse-parser.js';import{ErrorCode,SDKError}from'../sdk/errors.js';export class LLMApiClient{['httpClient'];[a6_0x7f3dd9(0x1cb)];[a6_0x7f3dd9(0x19c)];['logger'];constructor(_0x3f9fc8,_0x498e9e){const _0x3e6f8c=a6_0x7f3dd9;this[_0x3e6f8c(0x1cb)]=getEndpoint(_0x3f9fc8[_0x3e6f8c(0x1e3)],_0x3e6f8c(0x1d8)),this['authHeaders']=toHeaderRecord(getAuthHeaders(_0x3f9fc8['site'],_0x3f9fc8[_0x3e6f8c(0x1b4)])),this[_0x3e6f8c(0x1ae)]=_0x498e9e,this[_0x3e6f8c(0x1e6)]=new HTTPClient(this[_0x3e6f8c(0x1cb)],this['authHeaders'],_0x498e9e);}async[a6_0x7f3dd9(0x1a5)](_0x18ed65){const _0x2107dd=a6_0x7f3dd9,_0x4d614c=[];let _0x3b0039=_0x18ed65;while(_0x3b0039){const _0x1aa186=await this[_0x2107dd(0x1e6)]['request'](_0x2107dd(0x1ba),_0x3b0039);_0x1aa186['data']&&_0x4d614c['push'](..._0x1aa186[_0x2107dd(0x1bf)]);_0x3b0039=_0x1aa186[_0x2107dd(0x19b)]?.[_0x2107dd(0x1ec)];if(_0x3b0039&&_0x3b0039['startsWith'](_0x2107dd(0x1c6))){const _0x2e2335=new URL(_0x3b0039);_0x3b0039=_0x2e2335[_0x2107dd(0x1ac)]+_0x2e2335['search'];}}return _0x4d614c;}async[a6_0x7f3dd9(0x1a2)](){const _0x49aa7e=a6_0x7f3dd9;return await this[_0x49aa7e(0x1e6)][_0x49aa7e(0x1c7)](_0x49aa7e(0x1ba),_0x49aa7e(0x1f1));}async[a6_0x7f3dd9(0x1ce)](_0x454488){const _0x409eb9=a6_0x7f3dd9,_0x5b2472={'data':{'type':_0x409eb9(0x199),'attributes':{'name':_0x454488['name'],..._0x454488[_0x409eb9(0x1e5)]&&{'description':_0x454488[_0x409eb9(0x1e5)]}}}},_0xab4640=await this[_0x409eb9(0x1e6)][_0x409eb9(0x1c7)](_0x409eb9(0x1a3),_0x409eb9(0x1e2),{'headers':{'Content-Type':'application/vnd.api+json','Accept':_0x409eb9(0x1f2)},'body':_0x5b2472});return _0xab4640[_0x409eb9(0x1bf)];}async['deleteProject'](_0xfcf0f5){const _0x4d5f17=a6_0x7f3dd9,_0x3dc4d5=_0x4d5f17(0x1c4)+encodeURIComponent(_0xfcf0f5);await this['httpClient'][_0x4d5f17(0x1c7)](_0x4d5f17(0x1c2),_0x3dc4d5);}async[a6_0x7f3dd9(0x1a8)](_0x35d114=0x32){const _0x9f454d=a6_0x7f3dd9;return this[_0x9f454d(0x1a5)](_0x9f454d(0x1de)+_0x35d114);}async[a6_0x7f3dd9(0x1df)](_0x23809a){const _0x127cac=a6_0x7f3dd9;let _0x4d5ecd=_0x127cac(0x1ed);_0x23809a&&(_0x4d5ecd+=_0x127cac(0x1bd)+encodeURIComponent(_0x23809a));const _0x315a49=await this[_0x127cac(0x1e6)][_0x127cac(0x1c7)](_0x127cac(0x1ba),_0x4d5ecd);return _0x315a49[_0x127cac(0x1bf)]||[];}async[a6_0x7f3dd9(0x1d4)](_0x504ea5){const _0x4b5ee0=a6_0x7f3dd9,_0x6378ed=_0x4b5ee0(0x19d)+encodeURIComponent(_0x504ea5),_0x46412e=await this['httpClient']['request'](_0x4b5ee0(0x1ba),_0x6378ed);return _0x46412e[_0x4b5ee0(0x1bf)];}async['createAgent'](_0x18de35){const _0x3d81c6=a6_0x7f3dd9,_0x41d47d={'name':_0x18de35[_0x3d81c6(0x198)],'projectId':_0x18de35[_0x3d81c6(0x1ca)],'modelType':_0x18de35[_0x3d81c6(0x1d1)],'maxToolIterations':_0x18de35['maxToolIterations']??0x4,'temperature':_0x18de35['temperature']??0.7};_0x18de35['systemPrompt']!==undefined&&(_0x41d47d[_0x3d81c6(0x192)]=_0x18de35[_0x3d81c6(0x192)]);_0x18de35[_0x3d81c6(0x1be)]&&(_0x41d47d['starterMessage']=_0x18de35['starterMessage']);_0x18de35[_0x3d81c6(0x194)]&&(_0x41d47d['reasoningEffort']=_0x18de35[_0x3d81c6(0x194)]);const _0x1fb193={'data':{'type':_0x3d81c6(0x1d3),'attributes':_0x41d47d}},_0x3c0108=await this[_0x3d81c6(0x1e6)][_0x3d81c6(0x1c7)](_0x3d81c6(0x1a3),_0x3d81c6(0x1ed),{'headers':{'Content-Type':_0x3d81c6(0x1f2),'Accept':'application/vnd.api+json'},'body':_0x1fb193});return _0x3c0108[_0x3d81c6(0x1bf)];}async[a6_0x7f3dd9(0x195)](_0x293846,_0x129646){const _0x362392=a6_0x7f3dd9,_0x3a5c0d={'data':{'type':_0x362392(0x1d3),'id':_0x293846,'attributes':{..._0x129646['name']&&{'name':_0x129646[_0x362392(0x198)]},..._0x129646['description']&&{'description':_0x129646['description']},..._0x129646[_0x362392(0x1c9)]&&{'prompt':_0x129646[_0x362392(0x1c9)]},..._0x129646[_0x362392(0x1be)]&&{'starter_message':_0x129646[_0x362392(0x1be)]},..._0x129646[_0x362392(0x194)]&&{'reasoningEffort':_0x129646[_0x362392(0x194)]}}}},_0x8b7873=_0x362392(0x19d)+encodeURIComponent(_0x293846),_0x37ccc9=await this['httpClient']['request'](_0x362392(0x1bb),_0x8b7873,{'body':_0x3a5c0d});return _0x37ccc9[_0x362392(0x1bf)];}async[a6_0x7f3dd9(0x1b8)](_0x539390){const _0x58f251=a6_0x7f3dd9,_0x3d9269=_0x58f251(0x19d)+encodeURIComponent(_0x539390);await this[_0x58f251(0x1e6)][_0x58f251(0x1c7)](_0x58f251(0x1c2),_0x3d9269);}async[a6_0x7f3dd9(0x1c5)](_0x3b102d=0x32){const _0xe76fc8=a6_0x7f3dd9,_0x49502e=new URLSearchParams();_0x49502e[_0xe76fc8(0x19f)]('page[limit]',String(_0x3b102d)),_0x49502e[_0xe76fc8(0x19f)]('sort','-last_conversation_at');const _0x33889f=_0xe76fc8(0x1bc)+_0x49502e[_0xe76fc8(0x1e7)](),_0x3aab4c=await this[_0xe76fc8(0x1e6)][_0xe76fc8(0x1c7)](_0xe76fc8(0x1ba),_0x33889f);return _0x3aab4c[_0xe76fc8(0x1bf)]||[];}async[a6_0x7f3dd9(0x1c8)](_0x45c0c6){const _0x2b4367=a6_0x7f3dd9,_0xe94061=_0x2b4367(0x1d6)+encodeURIComponent(_0x45c0c6),_0x11dc1f=await this[_0x2b4367(0x1e6)][_0x2b4367(0x1c7)](_0x2b4367(0x1ba),_0xe94061);return _0x11dc1f[_0x2b4367(0x1bf)];}async[a6_0x7f3dd9(0x19e)](_0x3110e7){const _0x3b1e8e=a6_0x7f3dd9,_0x5cc710=_0x3b1e8e(0x1d6)+encodeURIComponent(_0x3110e7)+_0x3b1e8e(0x1c0);return await this[_0x3b1e8e(0x1e6)][_0x3b1e8e(0x1c7)]('GET',_0x5cc710);}async[a6_0x7f3dd9(0x193)](_0xc52a8b){const _0x557c24=a6_0x7f3dd9,_0x372c38={'data':{'type':_0x557c24(0x1a9),'attributes':{'agentId':_0xc52a8b[_0x557c24(0x1ee)]}}},_0x4a85f1=0x3,_0x270439=[0x3e8,0x7d0,0xfa0];for(let _0x23d850=0x0;_0x23d850<=_0x4a85f1;_0x23d850++){const _0x3908eb=await this[_0x557c24(0x1e6)][_0x557c24(0x1c7)]('POST','/api/chats',{'headers':{'Content-Type':'application/vnd.api+json','Accept':_0x557c24(0x1f2)},'body':_0x372c38});if(_0x3908eb[_0x557c24(0x1bf)]&&_0x3908eb['data']['id'])return _0x3908eb['data'];if(_0x23d850>=_0x4a85f1)throw new SDKError(ErrorCode[_0x557c24(0x1d9)],_0x557c24(0x1a6)+(_0x4a85f1+0x1)+_0x557c24(0x1aa));const _0x19d0f8=_0x270439[_0x23d850];console[_0x557c24(0x1f0)]('[Retry\x20'+(_0x23d850+0x1)+'/'+_0x4a85f1+_0x557c24(0x1d7)+_0x19d0f8+_0x557c24(0x1ea)),await new Promise(_0x12dc44=>setTimeout(_0x12dc44,_0x19d0f8));}throw new SDKError(ErrorCode[_0x557c24(0x1d9)],_0x557c24(0x1e4));}async*['continueChat'](_0x8bffce,_0x5965ff,_0x903514){const _0x2b9a02=a6_0x7f3dd9,_0x24f1f4=_0x5965ff[_0x2b9a02(0x1ab)]();if(!_0x24f1f4)throw new SDKError(ErrorCode[_0x2b9a02(0x1e9)],'Message\x20cannot\x20be\x20empty\x20or\x20whitespace\x20only',undefined,{'helpText':'Please\x20provide\x20a\x20non-empty\x20message\x20to\x20continue\x20the\x20chat.'});this[_0x2b9a02(0x1ae)][_0x2b9a02(0x1dc)](_0x2b9a02(0x1ad)+_0x8bffce+_0x2b9a02(0x1b5)+_0x5965ff[_0x2b9a02(0x1b2)]+_0x2b9a02(0x1b9));const _0x3bfb88='/api/chats/'+encodeURIComponent(_0x8bffce)+_0x2b9a02(0x1a7),_0xc5cd0e={'input':_0x5965ff};try{const _0x22c418=await this[_0x2b9a02(0x1e6)]['requestSSE']('POST',_0x3bfb88,{'headers':{'Content-Type':'application/json','Accept':_0x2b9a02(0x1d0)},'body':_0xc5cd0e,'signal':_0x903514});this['logger'][_0x2b9a02(0x1dc)]('['+_0x22c418['status']+_0x2b9a02(0x1b0)+_0x8bffce),yield*parseSSEStream(_0x22c418,this[_0x2b9a02(0x1ae)]);}catch(_0x2e620a){throw new SDKError(ErrorCode[_0x2b9a02(0x1b1)],_0x2b9a02(0x1e1)+_0x8bffce+_0x2b9a02(0x1ef)+_0x5965ff[_0x2b9a02(0x1b2)]+')',_0x2e620a);}}async[a6_0x7f3dd9(0x1cf)](_0xd1ff9f){const _0x1a22c4=a6_0x7f3dd9,_0x3e9cab=_0x1a22c4(0x1c4)+encodeURIComponent(_0xd1ff9f),_0x45b8e7=await this[_0x1a22c4(0x1e6)][_0x1a22c4(0x1c7)](_0x1a22c4(0x1ba),_0x3e9cab);return _0x45b8e7[_0x1a22c4(0x1bf)];}async[a6_0x7f3dd9(0x1b6)](_0x13bcdc){const _0x4a4a14=a6_0x7f3dd9;return this[_0x4a4a14(0x1a5)]('/api/knowledge_bases?filter[projectId]='+encodeURIComponent(_0x13bcdc)+'&page[limit]=50');}async[a6_0x7f3dd9(0x1d2)](_0x41dbf4){const _0x39bcee=a6_0x7f3dd9,_0x249743={'data':{'type':_0x39bcee(0x1a1),'attributes':_0x41dbf4}},_0x292ae6=await this[_0x39bcee(0x1e6)]['request']('POST',_0x39bcee(0x1c3),{'headers':{'Content-Type':'application/vnd.api+json','Accept':_0x39bcee(0x1f2)},'body':_0x249743});return _0x292ae6[_0x39bcee(0x1bf)];}async['listPrompts'](_0xab6395){const _0x53086e=a6_0x7f3dd9;return this[_0x53086e(0x1a5)](_0x53086e(0x1c1)+encodeURIComponent(_0xab6395)+'&page[limit]=50');}async[a6_0x7f3dd9(0x1e0)](_0x436e36){const _0x25e785=a6_0x7f3dd9,{jsonSchemaHint:_0x26579d,..._0x31392d}=_0x436e36,_0x339308={'data':{'type':_0x25e785(0x1dd),'attributes':_0x31392d}},_0x1a27e6=await this[_0x25e785(0x1e6)][_0x25e785(0x1c7)](_0x25e785(0x1a3),_0x25e785(0x1cc),{'headers':{'Content-Type':_0x25e785(0x1f2),'Accept':_0x25e785(0x1f2)},'body':_0x339308});return _0x1a27e6[_0x25e785(0x1bf)];}async['listIntegrations'](_0x17d38f){const _0x365f2b=a6_0x7f3dd9;return this[_0x365f2b(0x1a5)](_0x365f2b(0x1e8)+encodeURIComponent(_0x17d38f)+'&page[limit]=50');}async['createIntegration'](_0x8868a6){const _0x3e40ca=a6_0x7f3dd9,_0x1ddee5={'data':{'type':_0x3e40ca(0x1b3),'attributes':_0x8868a6}},_0x374fde=await this[_0x3e40ca(0x1e6)]['request'](_0x3e40ca(0x1a3),_0x3e40ca(0x197),{'headers':{'Content-Type':_0x3e40ca(0x1f2),'Accept':_0x3e40ca(0x1f2)},'body':_0x1ddee5});return _0x374fde[_0x3e40ca(0x1bf)];}async[a6_0x7f3dd9(0x1db)](_0x5ef17e){const _0x216a23=a6_0x7f3dd9,_0xe5eada=await this['listAgents'](_0x5ef17e),_0x193678=[];for(const _0x3e753c of _0xe5eada){const _0x59cdc8=_0x216a23(0x19d)+encodeURIComponent(_0x3e753c['id']),_0x1ebab5=await this[_0x216a23(0x1e6)][_0x216a23(0x1c7)](_0x216a23(0x1ba),_0x59cdc8);_0x193678['push'](_0x1ebab5[_0x216a23(0x1bf)]);}return _0x193678;}async['createAgentFull'](_0x6f842b){const _0x1e3355=a6_0x7f3dd9,_0x20e4e5={'data':{'type':'agents','attributes':_0x6f842b}},_0x3ed7d2=await this[_0x1e3355(0x1e6)][_0x1e3355(0x1c7)]('POST',_0x1e3355(0x1ed),{'headers':{'Content-Type':_0x1e3355(0x1f2),'Accept':_0x1e3355(0x1f2)},'body':_0x20e4e5});return _0x3ed7d2[_0x1e3355(0x1bf)];}}
@@ -1 +1 @@
1
- const a7_0x1cb432=a7_0x1ec6;function a7_0x1ec6(_0x4cfb7a,_0x4b31c4){const _0x1969e6=a7_0x1969();return a7_0x1ec6=function(_0x1ec69b,_0x30c240){_0x1ec69b=_0x1ec69b-0x17d;let _0xf7d499=_0x1969e6[_0x1ec69b];return _0xf7d499;},a7_0x1ec6(_0x4cfb7a,_0x4b31c4);}(function(_0x52f919,_0x35e9c0){const _0x502faf=a7_0x1ec6,_0x4ec4f1=_0x52f919();while(!![]){try{const _0x4c31f1=parseInt(_0x502faf(0x183))/0x1+-parseInt(_0x502faf(0x18f))/0x2*(parseInt(_0x502faf(0x18d))/0x3)+parseInt(_0x502faf(0x180))/0x4+-parseInt(_0x502faf(0x17e))/0x5*(-parseInt(_0x502faf(0x191))/0x6)+parseInt(_0x502faf(0x17d))/0x7+-parseInt(_0x502faf(0x186))/0x8+-parseInt(_0x502faf(0x189))/0x9*(parseInt(_0x502faf(0x18c))/0xa);if(_0x4c31f1===_0x35e9c0)break;else _0x4ec4f1['push'](_0x4ec4f1['shift']());}catch(_0x3c2b5e){_0x4ec4f1['push'](_0x4ec4f1['shift']());}}}(a7_0x1969,0xcaa4e));function a7_0x1969(){const _0x5f2cbd=['4755328CNYwZp','max','refillRate','20876616FiRvuH','ceil','lastRefill','10FXhKip','1765644QvdCYo','reset','2aTbdLp','tokens','30MsnYgo','acquire','tryAcquire','now','getAvailableTokens','maxRequests','9303308HWitWW','485100wevhaQ','sleep','5756680qAMefC','refill','floor','1079304DaxDGG','maxTokens','min'];a7_0x1969=function(){return _0x5f2cbd;};return a7_0x1969();}export class RateLimiter{[a7_0x1cb432(0x190)];['lastRefill'];['maxTokens'];[a7_0x1cb432(0x188)];constructor(_0x568c06){const _0x4371eb=a7_0x1cb432;this['maxTokens']=_0x568c06['maxRequests'],this[_0x4371eb(0x190)]=_0x568c06[_0x4371eb(0x196)],this[_0x4371eb(0x18b)]=Date[_0x4371eb(0x194)](),this[_0x4371eb(0x188)]=_0x568c06[_0x4371eb(0x196)]/_0x568c06['windowMs'];}async[a7_0x1cb432(0x192)](){const _0xe92b6a=a7_0x1cb432;while(!![]){this[_0xe92b6a(0x181)]();if(this[_0xe92b6a(0x190)]>=0x1){this[_0xe92b6a(0x190)]-=0x1;return;}const _0x5725f9=Math[_0xe92b6a(0x187)](0x1,Math[_0xe92b6a(0x18a)](0x1/this[_0xe92b6a(0x188)]));await this[_0xe92b6a(0x17f)](_0x5725f9);}}[a7_0x1cb432(0x193)](){const _0x4939d2=a7_0x1cb432;this['refill']();if(this[_0x4939d2(0x190)]>=0x1)return this[_0x4939d2(0x190)]-=0x1,!![];return![];}[a7_0x1cb432(0x181)](){const _0x20596f=a7_0x1cb432,_0x57c295=Date[_0x20596f(0x194)](),_0x2d5a58=_0x57c295-this[_0x20596f(0x18b)];if(_0x2d5a58>0x0){const _0xca192=_0x2d5a58*this['refillRate'];this[_0x20596f(0x190)]=Math[_0x20596f(0x185)](this['maxTokens'],this[_0x20596f(0x190)]+_0xca192),this[_0x20596f(0x18b)]=_0x57c295;}}[a7_0x1cb432(0x195)](){const _0x228209=a7_0x1cb432;return this[_0x228209(0x181)](),Math[_0x228209(0x182)](this[_0x228209(0x190)]);}[a7_0x1cb432(0x18e)](){const _0x369c2d=a7_0x1cb432;this[_0x369c2d(0x190)]=this[_0x369c2d(0x184)],this[_0x369c2d(0x18b)]=Date[_0x369c2d(0x194)]();}[a7_0x1cb432(0x17f)](_0x16dde0){return new Promise(_0x3cf415=>setTimeout(_0x3cf415,_0x16dde0));}}export const defaultRateLimiter=new RateLimiter({'maxRequests':0x64,'windowMs':0xea60});
1
+ const a7_0x2b65da=a7_0x3858;function a7_0x3539(){const _0xa81d19=['maxRequests','sleep','670VKOXAQ','tokens','1577216cXnEkV','144TVEkad','refill','228HKSRqT','1447299HsIKxt','863631PxJVyT','windowMs','42kMRCNw','maxTokens','lastRefill','refillRate','tryAcquire','max','acquire','floor','now','1612602AChSPI','479170AQCrrZ','375617wFjvYs','37779buxSHW'];a7_0x3539=function(){return _0xa81d19;};return a7_0x3539();}(function(_0x14da05,_0xdee11e){const _0xc99ea4=a7_0x3858,_0x25586d=_0x14da05();while(!![]){try{const _0xa5c003=-parseInt(_0xc99ea4(0x1d4))/0x1+parseInt(_0xc99ea4(0x1dc))/0x2+parseInt(_0xc99ea4(0x1d7))/0x3*(parseInt(_0xc99ea4(0x1df))/0x4)+parseInt(_0xc99ea4(0x1d5))/0x5*(parseInt(_0xc99ea4(0x1e3))/0x6)+-parseInt(_0xc99ea4(0x1e0))/0x7+-parseInt(_0xc99ea4(0x1dd))/0x8*(parseInt(_0xc99ea4(0x1e1))/0x9)+-parseInt(_0xc99ea4(0x1da))/0xa*(-parseInt(_0xc99ea4(0x1d6))/0xb);if(_0xa5c003===_0xdee11e)break;else _0x25586d['push'](_0x25586d['shift']());}catch(_0x2fe783){_0x25586d['push'](_0x25586d['shift']());}}}(a7_0x3539,0xe03cb));function a7_0x3858(_0x9c4291,_0x47bf66){const _0x3539a3=a7_0x3539();return a7_0x3858=function(_0x385811,_0x21e906){_0x385811=_0x385811-0x1ce;let _0x311ba0=_0x3539a3[_0x385811];return _0x311ba0;},a7_0x3858(_0x9c4291,_0x47bf66);}export class RateLimiter{[a7_0x2b65da(0x1db)];[a7_0x2b65da(0x1e5)];[a7_0x2b65da(0x1e4)];[a7_0x2b65da(0x1ce)];constructor(_0x387d48){const _0x68b636=a7_0x2b65da;this[_0x68b636(0x1e4)]=_0x387d48[_0x68b636(0x1d8)],this[_0x68b636(0x1db)]=_0x387d48[_0x68b636(0x1d8)],this[_0x68b636(0x1e5)]=Date[_0x68b636(0x1d3)](),this[_0x68b636(0x1ce)]=_0x387d48[_0x68b636(0x1d8)]/_0x387d48[_0x68b636(0x1e2)];}async[a7_0x2b65da(0x1d1)](){const _0x37f88d=a7_0x2b65da;while(!![]){this['refill']();if(this[_0x37f88d(0x1db)]>=0x1){this[_0x37f88d(0x1db)]-=0x1;return;}const _0x31e009=Math[_0x37f88d(0x1d0)](0x1,Math['ceil'](0x1/this[_0x37f88d(0x1ce)]));await this[_0x37f88d(0x1d9)](_0x31e009);}}[a7_0x2b65da(0x1cf)](){const _0x46d8e2=a7_0x2b65da;this[_0x46d8e2(0x1de)]();if(this[_0x46d8e2(0x1db)]>=0x1)return this['tokens']-=0x1,!![];return![];}[a7_0x2b65da(0x1de)](){const _0x5f4933=a7_0x2b65da,_0x3aad74=Date[_0x5f4933(0x1d3)](),_0x49b57c=_0x3aad74-this[_0x5f4933(0x1e5)];if(_0x49b57c>0x0){const _0xb004dc=_0x49b57c*this[_0x5f4933(0x1ce)];this[_0x5f4933(0x1db)]=Math['min'](this[_0x5f4933(0x1e4)],this[_0x5f4933(0x1db)]+_0xb004dc),this[_0x5f4933(0x1e5)]=_0x3aad74;}}['getAvailableTokens'](){const _0x15e9f9=a7_0x2b65da;return this[_0x15e9f9(0x1de)](),Math[_0x15e9f9(0x1d2)](this[_0x15e9f9(0x1db)]);}['reset'](){const _0x555ecd=a7_0x2b65da;this[_0x555ecd(0x1db)]=this[_0x555ecd(0x1e4)],this['lastRefill']=Date[_0x555ecd(0x1d3)]();}[a7_0x2b65da(0x1d9)](_0xb34c20){return new Promise(_0x3251a3=>setTimeout(_0x3251a3,_0xb34c20));}}export const defaultRateLimiter=new RateLimiter({'maxRequests':0x64,'windowMs':0xea60});
@@ -1 +1 @@
1
- const a8_0x584b74=a8_0x5a28;(function(_0x45c50e,_0x15a75c){const _0x40b074=a8_0x5a28,_0x2c8d7e=_0x45c50e();while(!![]){try{const _0x3dcc4e=parseInt(_0x40b074(0x1c8))/0x1+-parseInt(_0x40b074(0x1bc))/0x2+parseInt(_0x40b074(0x19c))/0x3+parseInt(_0x40b074(0x197))/0x4+-parseInt(_0x40b074(0x1cb))/0x5*(-parseInt(_0x40b074(0x196))/0x6)+-parseInt(_0x40b074(0x19b))/0x7+-parseInt(_0x40b074(0x1b7))/0x8;if(_0x3dcc4e===_0x15a75c)break;else _0x2c8d7e['push'](_0x2c8d7e['shift']());}catch(_0xa777e2){_0x2c8d7e['push'](_0x2c8d7e['shift']());}}}(a8_0x403b,0x2e3b2));function a8_0x5a28(_0x134d5c,_0x2fae53){const _0x403b07=a8_0x403b();return a8_0x5a28=function(_0x5a28d0,_0x276e0b){_0x5a28d0=_0x5a28d0-0x194;let _0x25523d=_0x403b07[_0x5a28d0];return _0x25523d;},a8_0x5a28(_0x134d5c,_0x2fae53);}import{HTTPClient}from'./http-client.js';function a8_0x403b(){const _0x51e969=['apiKey','152649LuTzwW','79611zkXOKU','authHeaders','parse','deleteTable','status','createDatabase','showJob','/v3/job/list?','filter','request','/v3/table/show/','application/json','tables','showDatabase','forEach','trim','from','push','append','site','/v3/job/show/','jobs','Failed\x20to\x20parse\x20NDJSON\x20line\x20','/v3/job/kill/','/v3/job/list','length','/v3/job/issue/hive/','29064plEuEe','GET','/v3/job/result/','httpClient','getJobResult','574798PojjKa','/v3/table/list/','/v3/job/issue/presto/','warn','/v3/table/create/','/v3/table/delete/','listTables','getUserInfo','databases','toString','cancelJob','/v3/database/create/','51487MzTsBx','POST','string','11125xuPtHB','split','createTable','990dINKBA','228208dilMcC','deleteDatabase','/v3/user/show'];a8_0x403b=function(){return _0x51e969;};return a8_0x403b();}import{getEndpoint}from'../types/index.js';import{getAuthHeaders,toHeaderRecord}from'../core/auth.js';export class TDApiClient{[a8_0x584b74(0x1ba)];[a8_0x584b74(0x19d)];constructor(_0x3ba79b,_0x249a2e){const _0x3bd2cf=a8_0x584b74,_0x526377=getEndpoint(_0x3ba79b[_0x3bd2cf(0x1af)],'td');this[_0x3bd2cf(0x19d)]=toHeaderRecord(getAuthHeaders(_0x3ba79b[_0x3bd2cf(0x1af)],_0x3ba79b[_0x3bd2cf(0x19a)])),this['httpClient']=new HTTPClient(_0x526377,this['authHeaders'],_0x249a2e);}async['listDatabases'](){const _0x2b8296=a8_0x584b74,_0x37ba69=await this['httpClient'][_0x2b8296(0x1a5)](_0x2b8296(0x1b8),'/v3/database/list');return _0x37ba69[_0x2b8296(0x1c4)];}async[a8_0x584b74(0x1a9)](_0x1b088f){const _0x96a642=a8_0x584b74,_0x4e2bda=await this[_0x96a642(0x1ba)][_0x96a642(0x1a5)](_0x96a642(0x1b8),'/v3/database/show/'+encodeURIComponent(_0x1b088f));return _0x4e2bda;}async[a8_0x584b74(0x1a1)](_0x4b3613){const _0x51262e=a8_0x584b74;await this[_0x51262e(0x1ba)][_0x51262e(0x1a5)](_0x51262e(0x1c9),_0x51262e(0x1c7)+encodeURIComponent(_0x4b3613));}async[a8_0x584b74(0x198)](_0x40e3ac){const _0x925007=a8_0x584b74;await this[_0x925007(0x1ba)][_0x925007(0x1a5)](_0x925007(0x1c9),'/v3/database/delete/'+encodeURIComponent(_0x40e3ac));}async[a8_0x584b74(0x1c2)](_0x103df6){const _0x520f4f=a8_0x584b74,_0x336ca2=await this[_0x520f4f(0x1ba)]['request']('GET',_0x520f4f(0x1bd)+encodeURIComponent(_0x103df6));return _0x336ca2[_0x520f4f(0x1a8)];}async['showTable'](_0x193304,_0x2bacd0){const _0x4dc715=a8_0x584b74,_0x520b43=await this[_0x4dc715(0x1ba)][_0x4dc715(0x1a5)]('GET',_0x4dc715(0x1a6)+encodeURIComponent(_0x193304)+'/'+encodeURIComponent(_0x2bacd0));return _0x520b43;}async[a8_0x584b74(0x195)](_0xa842d9,_0x1a205e){const _0x36d46e=a8_0x584b74;await this[_0x36d46e(0x1ba)][_0x36d46e(0x1a5)](_0x36d46e(0x1c9),_0x36d46e(0x1c0)+encodeURIComponent(_0xa842d9)+'/'+encodeURIComponent(_0x1a205e));}async[a8_0x584b74(0x19f)](_0x400ca2,_0x167c4f){const _0x4975f1=a8_0x584b74;await this[_0x4975f1(0x1ba)][_0x4975f1(0x1a5)](_0x4975f1(0x1c9),_0x4975f1(0x1c1)+encodeURIComponent(_0x400ca2)+'/'+encodeURIComponent(_0x167c4f));}async['submitHiveJob'](_0x265819,_0x4683d9){const _0x3b2630=a8_0x584b74,_0x3304e5=await this[_0x3b2630(0x1ba)][_0x3b2630(0x1a5)](_0x3b2630(0x1c9),_0x3b2630(0x1b6)+encodeURIComponent(_0x265819),{'body':{'query':_0x4683d9}});return _0x3304e5;}async['submitPrestoJob'](_0x4e1d5d,_0xbf1670){const _0x2f276c=a8_0x584b74,_0x46454a=await this[_0x2f276c(0x1ba)]['request'](_0x2f276c(0x1c9),_0x2f276c(0x1be)+encodeURIComponent(_0x4e1d5d),{'body':{'query':_0xbf1670}});return _0x46454a;}async['listJobs'](_0x43c7e8){const _0x3e14af=a8_0x584b74,_0x4c7772=new URLSearchParams();if(_0x43c7e8?.[_0x3e14af(0x1ac)]!==undefined)_0x4c7772['append'](_0x3e14af(0x1ac),_0x43c7e8[_0x3e14af(0x1ac)][_0x3e14af(0x1c5)]());if(_0x43c7e8?.['to']!==undefined)_0x4c7772[_0x3e14af(0x1ae)]('to',_0x43c7e8['to']['toString']());if(_0x43c7e8?.['status'])_0x4c7772[_0x3e14af(0x1ae)]('status',_0x43c7e8[_0x3e14af(0x1a0)]);const _0x8453c7=_0x4c7772['toString'](),_0x510e05=_0x8453c7?_0x3e14af(0x1a3)+_0x8453c7:_0x3e14af(0x1b4),_0x19785c=await this[_0x3e14af(0x1ba)][_0x3e14af(0x1a5)](_0x3e14af(0x1b8),_0x510e05);return _0x19785c[_0x3e14af(0x1b1)];}async[a8_0x584b74(0x1a2)](_0x1dec15){const _0x537ddc=a8_0x584b74,_0x3b85ea=await this['httpClient']['request'](_0x537ddc(0x1b8),_0x537ddc(0x1b0)+encodeURIComponent(_0x1dec15));return _0x3b85ea;}async[a8_0x584b74(0x1c6)](_0x3a73dd){const _0x218b4d=a8_0x584b74;await this[_0x218b4d(0x1ba)][_0x218b4d(0x1a5)](_0x218b4d(0x1c9),_0x218b4d(0x1b3)+encodeURIComponent(_0x3a73dd));}async[a8_0x584b74(0x1c3)](){const _0x5c5e28=a8_0x584b74,_0x5d93b3=await this['httpClient'][_0x5c5e28(0x1a5)]('GET',_0x5c5e28(0x199));return _0x5d93b3;}async[a8_0x584b74(0x1bb)](_0x1f9288){const _0x3fac3e=a8_0x584b74,_0x26681f=await this['httpClient'][_0x3fac3e(0x1a5)](_0x3fac3e(0x1b8),_0x3fac3e(0x1b9)+encodeURIComponent(_0x1f9288)+'?header=true',{'headers':{'Accept':_0x3fac3e(0x1a7)},'responseType':'text'});if(typeof _0x26681f===_0x3fac3e(0x1ca)){const _0x52384d=_0x26681f[_0x3fac3e(0x194)]('\x0a')[_0x3fac3e(0x1a4)](_0x13ee93=>_0x13ee93[_0x3fac3e(0x1ab)]());if(_0x52384d[_0x3fac3e(0x1b5)]===0x0)return[];let _0x4d9041;try{_0x4d9041=JSON[_0x3fac3e(0x19e)](_0x52384d[0x0]);}catch(_0x363b7c){return console[_0x3fac3e(0x1bf)]('Failed\x20to\x20parse\x20column\x20names:\x20'+(_0x363b7c instanceof Error?_0x363b7c['message']:String(_0x363b7c))),[];}const _0x3d96a9=[];for(let _0x2fb7ca=0x1;_0x2fb7ca<_0x52384d[_0x3fac3e(0x1b5)];_0x2fb7ca++){const _0x316464=_0x52384d[_0x2fb7ca][_0x3fac3e(0x1ab)]();if(!_0x316464)continue;try{const _0x556b67=JSON['parse'](_0x316464),_0x4596dc={};_0x4d9041[_0x3fac3e(0x1aa)]((_0x3e8236,_0xe28a0e)=>{_0x4596dc[_0x3e8236]=_0x556b67[_0xe28a0e];}),_0x3d96a9[_0x3fac3e(0x1ad)](_0x4596dc);}catch(_0x3b54d3){console[_0x3fac3e(0x1bf)](_0x3fac3e(0x1b2)+(_0x2fb7ca+0x1)+':\x20'+(_0x3b54d3 instanceof Error?_0x3b54d3['message']:String(_0x3b54d3)));}}return _0x3d96a9;}return[];}}export function createTDApiClient(_0x2f6dc1,_0x57dbf9){return new TDApiClient(_0x2f6dc1,_0x57dbf9);}
1
+ const a8_0x23491e=a8_0x5acb;function a8_0x5acb(_0x4b7791,_0x57f5ef){const _0x3e060a=a8_0x3e06();return a8_0x5acb=function(_0x5acb98,_0x133034){_0x5acb98=_0x5acb98-0x154;let _0x1537e7=_0x3e060a[_0x5acb98];return _0x1537e7;},a8_0x5acb(_0x4b7791,_0x57f5ef);}(function(_0x23b775,_0x39c882){const _0x2fcfe6=a8_0x5acb,_0x492fc8=_0x23b775();while(!![]){try{const _0x7dbbb9=-parseInt(_0x2fcfe6(0x186))/0x1+-parseInt(_0x2fcfe6(0x162))/0x2+parseInt(_0x2fcfe6(0x159))/0x3*(-parseInt(_0x2fcfe6(0x18b))/0x4)+parseInt(_0x2fcfe6(0x168))/0x5*(parseInt(_0x2fcfe6(0x189))/0x6)+parseInt(_0x2fcfe6(0x181))/0x7*(parseInt(_0x2fcfe6(0x177))/0x8)+parseInt(_0x2fcfe6(0x160))/0x9+parseInt(_0x2fcfe6(0x182))/0xa;if(_0x7dbbb9===_0x39c882)break;else _0x492fc8['push'](_0x492fc8['shift']());}catch(_0x585e7b){_0x492fc8['push'](_0x492fc8['shift']());}}}(a8_0x3e06,0xab1be));import{HTTPClient}from'./http-client.js';import{getEndpoint}from'../types/index.js';function a8_0x3e06(){const _0x110dbb=['authHeaders','trim','status','push','6333876JUkLCd','getUserInfo','197002hxmcEe','showTable','Failed\x20to\x20parse\x20NDJSON\x20line\x20','listDatabases','request','/v3/table/show/','3724225DRiYZM','application/json','showJob','createDatabase','/v3/job/issue/presto/','cancelJob','?header=true','length','forEach','/v3/database/show/','POST','string','toString','/v3/job/list','site','2012232RYMKLq','parse','message','split','httpClient','Failed\x20to\x20parse\x20column\x20names:\x20','jobs','deleteDatabase','/v3/job/show/','/v3/database/delete/','14oRszGm','133790pQMEtF','/v3/job/issue/hive/','append','/v3/table/list/','229853YgHKDm','/v3/job/list?','filter','6DHNGGl','/v3/job/result/','116xzuVKa','deleteTable','/v3/job/kill/','/v3/table/create/','from','listTables','GET','/v3/database/list','96810FXNSln','warn','submitPrestoJob'];a8_0x3e06=function(){return _0x110dbb;};return a8_0x3e06();}import{getAuthHeaders,toHeaderRecord}from'../core/auth.js';export class TDApiClient{[a8_0x23491e(0x17b)];['authHeaders'];constructor(_0x3a13b4,_0x473066){const _0x3e858a=a8_0x23491e,_0xcdd3ad=getEndpoint(_0x3a13b4[_0x3e858a(0x176)],'td');this[_0x3e858a(0x15c)]=toHeaderRecord(getAuthHeaders(_0x3a13b4['site'],_0x3a13b4['apiKey'])),this[_0x3e858a(0x17b)]=new HTTPClient(_0xcdd3ad,this[_0x3e858a(0x15c)],_0x473066);}async[a8_0x23491e(0x165)](){const _0x3abaeb=a8_0x23491e,_0x2db554=await this[_0x3abaeb(0x17b)]['request'](_0x3abaeb(0x157),_0x3abaeb(0x158));return _0x2db554['databases'];}async['showDatabase'](_0xa9a0ae){const _0x35dc79=a8_0x23491e,_0x3cea6a=await this[_0x35dc79(0x17b)][_0x35dc79(0x166)]('GET',_0x35dc79(0x171)+encodeURIComponent(_0xa9a0ae));return _0x3cea6a;}async[a8_0x23491e(0x16b)](_0x17cb45){const _0x3e611e=a8_0x23491e;await this[_0x3e611e(0x17b)][_0x3e611e(0x166)](_0x3e611e(0x172),'/v3/database/create/'+encodeURIComponent(_0x17cb45));}async[a8_0x23491e(0x17e)](_0x4866a2){const _0x5bebfc=a8_0x23491e;await this[_0x5bebfc(0x17b)][_0x5bebfc(0x166)]('POST',_0x5bebfc(0x180)+encodeURIComponent(_0x4866a2));}async[a8_0x23491e(0x156)](_0x338f80){const _0x3246e0=a8_0x23491e,_0x58a38b=await this[_0x3246e0(0x17b)][_0x3246e0(0x166)](_0x3246e0(0x157),_0x3246e0(0x185)+encodeURIComponent(_0x338f80));return _0x58a38b['tables'];}async[a8_0x23491e(0x163)](_0x4915a4,_0x27cca8){const _0x1375e0=a8_0x23491e,_0x4f3dd8=await this['httpClient']['request'](_0x1375e0(0x157),_0x1375e0(0x167)+encodeURIComponent(_0x4915a4)+'/'+encodeURIComponent(_0x27cca8));return _0x4f3dd8;}async['createTable'](_0x4a4699,_0x1fed83){const _0x28f090=a8_0x23491e;await this[_0x28f090(0x17b)][_0x28f090(0x166)]('POST',_0x28f090(0x154)+encodeURIComponent(_0x4a4699)+'/'+encodeURIComponent(_0x1fed83));}async[a8_0x23491e(0x18c)](_0x34c74c,_0x26e94b){const _0x19f3a7=a8_0x23491e;await this[_0x19f3a7(0x17b)]['request'](_0x19f3a7(0x172),'/v3/table/delete/'+encodeURIComponent(_0x34c74c)+'/'+encodeURIComponent(_0x26e94b));}async['submitHiveJob'](_0x1dfc1a,_0xe32075){const _0x1b07ba=a8_0x23491e,_0x387077=await this[_0x1b07ba(0x17b)][_0x1b07ba(0x166)]('POST',_0x1b07ba(0x183)+encodeURIComponent(_0x1dfc1a),{'body':{'query':_0xe32075}});return _0x387077;}async[a8_0x23491e(0x15b)](_0x598ed6,_0x41c109){const _0x15978d=a8_0x23491e,_0x1767b1=await this['httpClient']['request']('POST',_0x15978d(0x16c)+encodeURIComponent(_0x598ed6),{'body':{'query':_0x41c109}});return _0x1767b1;}async['listJobs'](_0x113635){const _0x316841=a8_0x23491e,_0x5e4c30=new URLSearchParams();if(_0x113635?.[_0x316841(0x155)]!==undefined)_0x5e4c30[_0x316841(0x184)](_0x316841(0x155),_0x113635[_0x316841(0x155)]['toString']());if(_0x113635?.['to']!==undefined)_0x5e4c30['append']('to',_0x113635['to'][_0x316841(0x174)]());if(_0x113635?.[_0x316841(0x15e)])_0x5e4c30['append']('status',_0x113635[_0x316841(0x15e)]);const _0x1c57bd=_0x5e4c30[_0x316841(0x174)](),_0x5e5ca1=_0x1c57bd?_0x316841(0x187)+_0x1c57bd:_0x316841(0x175),_0x2b0713=await this[_0x316841(0x17b)][_0x316841(0x166)](_0x316841(0x157),_0x5e5ca1);return _0x2b0713[_0x316841(0x17d)];}async[a8_0x23491e(0x16a)](_0x2d481f){const _0x1a22f2=a8_0x23491e,_0x4fbd7f=await this[_0x1a22f2(0x17b)][_0x1a22f2(0x166)](_0x1a22f2(0x157),_0x1a22f2(0x17f)+encodeURIComponent(_0x2d481f));return _0x4fbd7f;}async[a8_0x23491e(0x16d)](_0x116d6d){const _0x5db451=a8_0x23491e;await this[_0x5db451(0x17b)][_0x5db451(0x166)](_0x5db451(0x172),_0x5db451(0x18d)+encodeURIComponent(_0x116d6d));}async[a8_0x23491e(0x161)](){const _0x39f0f5=a8_0x23491e,_0x55b850=await this['httpClient'][_0x39f0f5(0x166)](_0x39f0f5(0x157),'/v3/user/show');return _0x55b850;}async['getJobResult'](_0x4525dc){const _0x1a131f=a8_0x23491e,_0x5ef8e7=await this[_0x1a131f(0x17b)]['request']('GET',_0x1a131f(0x18a)+encodeURIComponent(_0x4525dc)+_0x1a131f(0x16e),{'headers':{'Accept':_0x1a131f(0x169)},'responseType':'text'});if(typeof _0x5ef8e7===_0x1a131f(0x173)){const _0x2c4395=_0x5ef8e7[_0x1a131f(0x17a)]('\x0a')[_0x1a131f(0x188)](_0x47fadf=>_0x47fadf[_0x1a131f(0x15d)]());if(_0x2c4395['length']===0x0)return[];let _0x5c09ac;try{_0x5c09ac=JSON[_0x1a131f(0x178)](_0x2c4395[0x0]);}catch(_0x24a6b9){return console[_0x1a131f(0x15a)](_0x1a131f(0x17c)+(_0x24a6b9 instanceof Error?_0x24a6b9['message']:String(_0x24a6b9))),[];}const _0x2f64da=[];for(let _0x34b502=0x1;_0x34b502<_0x2c4395[_0x1a131f(0x16f)];_0x34b502++){const _0x5a9e6e=_0x2c4395[_0x34b502][_0x1a131f(0x15d)]();if(!_0x5a9e6e)continue;try{const _0x37d62e=JSON[_0x1a131f(0x178)](_0x5a9e6e),_0x17cc3d={};_0x5c09ac[_0x1a131f(0x170)]((_0x14050f,_0x25a6b0)=>{_0x17cc3d[_0x14050f]=_0x37d62e[_0x25a6b0];}),_0x2f64da[_0x1a131f(0x15f)](_0x17cc3d);}catch(_0x2f5e37){console['warn'](_0x1a131f(0x164)+(_0x34b502+0x1)+':\x20'+(_0x2f5e37 instanceof Error?_0x2f5e37[_0x1a131f(0x179)]:String(_0x2f5e37)));}}return _0x2f64da;}return[];}}export function createTDApiClient(_0x34596e,_0xc91fe7){return new TDApiClient(_0x34596e,_0xc91fe7);}
@@ -1 +1 @@
1
- const a9_0x1b9eb2=a9_0x2ce0;(function(_0x422218,_0x3cbdf8){const _0x47cba8=a9_0x2ce0,_0x445911=_0x422218();while(!![]){try{const _0x3f11b4=-parseInt(_0x47cba8(0x14f))/0x1*(-parseInt(_0x47cba8(0x15a))/0x2)+parseInt(_0x47cba8(0x13d))/0x3*(-parseInt(_0x47cba8(0x13f))/0x4)+-parseInt(_0x47cba8(0x16a))/0x5*(-parseInt(_0x47cba8(0x14b))/0x6)+-parseInt(_0x47cba8(0x137))/0x7*(-parseInt(_0x47cba8(0x164))/0x8)+-parseInt(_0x47cba8(0x16e))/0x9*(-parseInt(_0x47cba8(0x160))/0xa)+-parseInt(_0x47cba8(0x152))/0xb*(-parseInt(_0x47cba8(0x170))/0xc)+-parseInt(_0x47cba8(0x13c))/0xd;if(_0x3f11b4===_0x3cbdf8)break;else _0x445911['push'](_0x445911['shift']());}catch(_0x567cf7){_0x445911['push'](_0x445911['shift']());}}}(a9_0x36f5,0x8bea7));function a9_0x2ce0(_0x31cb5b,_0x202a24){const _0x36f550=a9_0x36f5();return a9_0x2ce0=function(_0x2ce006,_0x9a3fbe){_0x2ce006=_0x2ce006-0x12f;let _0x3f8f6a=_0x36f550[_0x2ce006];return _0x3f8f6a;},a9_0x2ce0(_0x31cb5b,_0x202a24);}function a9_0x36f5(){const _0x4e80b4=['1075090zKfsNH','dim','USER_ERROR','streamResults','8kDhoEV','repeat','padStart','TRINO_NOT_FOUND','push','TRINO_INTERNAL_ERROR','1410505luhWyG','forEach','toLocaleString','consider\x20adding\x20LIMIT\x20clause','36OFfXcV','GET','12192sPqbAK','max','\x20rows)\x20-\x20','DELETE','length','totalSplits','TRINO_INVALID_ARGUMENT','Failed\x20to\x20cancel\x20query:','stdout','TRINO_SYNTAX_ERROR','Warning:\x20Large\x20result\x20set\x20(','warnings','Query\x20cancelled\x20by\x20user','map','EXTERNAL','completedSplits','join','Invalid\x20nextUri\x20format:\x20','TRINO_INSUFFICIENT_RESOURCES','4718581KyJzCW','nextUri','POST','red','INTERNAL','29323983GTirDn','180900cAWpbL','cancelQuery','64sjnxRX','PERMISSION_DENIED','errorLocation','errorType','checkResponseError','ALREADY_EXISTS','x-td-jobid','/v1/statement','warn','request','data','split','24FZIDJh','columns','INTERNAL_ERROR','httpClient','13cqkvOB','isTTY','state','4631iUajtN','error','trino','[query]','processedRows','convertRowsToObjects','stats','aborted','174358ijueuL','errorCode','min','text/plain','INSUFFICIENT_RESOURCES','TRINO_USER_CANCELLED'];a9_0x36f5=function(){return _0x4e80b4;};return a9_0x36f5();}import{HTTPClient}from'./http-client.js';import{getEndpoint}from'../types/index.js';import{getTrinoHeaders}from'../core/auth.js';import{SDKError,ErrorCode}from'../sdk/errors.js';import{Chalk}from'chalk';export class TrinoApiClient{[a9_0x1b9eb2(0x14e)];constructor(_0x5ed9c8,_0x207572){const _0xa54531=a9_0x1b9eb2,_0x5465d6=getEndpoint(_0x5ed9c8['site'],_0xa54531(0x154)),_0x296d13=getTrinoHeaders(_0x5ed9c8['site'],_0x5ed9c8['apiKey']);this[_0xa54531(0x14e)]=new HTTPClient(_0x5465d6,_0x296d13,_0x207572);}async['executeQuery'](_0x13e65a,_0x3a40c7={}){const _0x1fd366=a9_0x1b9eb2,{catalog:_0x1da6e1,schema:_0x48e13e,timeout:_0x459874,signal:_0x384316,onJobId:_0x2695f3,onProgress:_0x19576c}=_0x3a40c7,_0x48c7c2={'Content-Type':_0x1fd366(0x15d)};(_0x1da6e1||_0x48e13e)&&(_0x48c7c2['X-Trino-Catalog']=_0x1da6e1||'td');_0x48e13e&&(_0x48c7c2['X-Trino-Schema']=_0x48e13e);const _0x2042f2=await this[_0x1fd366(0x14e)][_0x1fd366(0x148)](_0x1fd366(0x139),_0x1fd366(0x146),{'headers':_0x48c7c2,'body':_0x13e65a,'timeout':_0x459874,'signal':_0x384316,'includeHeaders':!![]}),_0x1c38c8=_0x2042f2[_0x1fd366(0x149)],_0x312f20=_0x2042f2['headers'],_0x595699=_0x312f20[_0x1fd366(0x145)]||_0x312f20['X-TD-JobId'];_0x595699&&_0x2695f3&&_0x2695f3(_0x595699);this['checkResponseError'](_0x1c38c8,_0x1c38c8['id'],_0x13e65a);const _0x934cbd=await this[_0x1fd366(0x163)](_0x1c38c8,_0x13e65a,_0x384316,_0x19576c);return _0x595699&&(_0x934cbd['jobId']=_0x595699),_0x934cbd;}async['streamResults'](_0x517960,_0x2af003,_0x496322,_0x18e174){const _0x544fe5=a9_0x1b9eb2,_0x4c16ed=_0x517960['id'];let _0x459b48=[];const _0x1a8105=[],_0x2649bf=[];let _0x287fda=_0x517960;const _0x3a35ea=0x186a0;_0x287fda[_0x544fe5(0x14c)]&&(_0x459b48=_0x287fda[_0x544fe5(0x14c)]);_0x287fda[_0x544fe5(0x149)]&&_0x1a8105[_0x544fe5(0x168)](..._0x287fda['data']);_0x287fda['warnings']&&_0x2649bf[_0x544fe5(0x168)](..._0x287fda[_0x544fe5(0x12f)]);_0x18e174&&_0x287fda[_0x544fe5(0x158)]&&_0x18e174({'state':_0x287fda[_0x544fe5(0x158)][_0x544fe5(0x151)],'processedRows':_0x287fda[_0x544fe5(0x158)]['processedRows'],'completedSplits':_0x287fda['stats'][_0x544fe5(0x133)],'totalSplits':_0x287fda[_0x544fe5(0x158)][_0x544fe5(0x175)]});while(_0x287fda[_0x544fe5(0x138)]){if(_0x496322?.[_0x544fe5(0x159)]){await this['cancelQuery'](_0x287fda[_0x544fe5(0x138)]);throw new Error(_0x544fe5(0x130));}let _0x48d29c;try{_0x48d29c=new URL(_0x287fda[_0x544fe5(0x138)])['pathname'];}catch{throw new Error(_0x544fe5(0x135)+_0x287fda[_0x544fe5(0x138)]);}_0x287fda=await this[_0x544fe5(0x14e)]['request'](_0x544fe5(0x16f),_0x48d29c,{'signal':_0x496322}),this[_0x544fe5(0x143)](_0x287fda,_0x4c16ed,_0x2af003),_0x287fda[_0x544fe5(0x14c)]&&_0x459b48[_0x544fe5(0x174)]===0x0&&(_0x459b48=_0x287fda[_0x544fe5(0x14c)]),_0x287fda['data']&&(_0x1a8105[_0x544fe5(0x168)](..._0x287fda[_0x544fe5(0x149)]),_0x1a8105['length']>_0x3a35ea&&_0x1a8105[_0x544fe5(0x174)]%0xc350===0x0&&console[_0x544fe5(0x147)](_0x544fe5(0x17a)+_0x1a8105[_0x544fe5(0x174)][_0x544fe5(0x16c)]()+_0x544fe5(0x172)+_0x544fe5(0x16d))),_0x287fda[_0x544fe5(0x12f)]&&_0x2649bf[_0x544fe5(0x168)](..._0x287fda[_0x544fe5(0x12f)]),_0x18e174&&_0x287fda[_0x544fe5(0x158)]&&_0x18e174({'state':_0x287fda[_0x544fe5(0x158)]['state'],'processedRows':_0x287fda[_0x544fe5(0x158)][_0x544fe5(0x156)],'completedSplits':_0x287fda[_0x544fe5(0x158)][_0x544fe5(0x133)],'totalSplits':_0x287fda[_0x544fe5(0x158)][_0x544fe5(0x175)]});}const _0x59d281=this[_0x544fe5(0x157)](_0x459b48,_0x1a8105);return{'queryId':_0x4c16ed,'columns':_0x459b48,'data':_0x59d281,'stats':_0x287fda['stats'],'warnings':_0x2649bf[_0x544fe5(0x174)]>0x0?_0x2649bf:undefined};}[a9_0x1b9eb2(0x143)](_0x16bb9e,_0x445965,_0x37bdb6){const _0x48fcf1=a9_0x1b9eb2;if(!_0x16bb9e['error'])return;const _0xdb1dfb=_0x16bb9e[_0x48fcf1(0x153)],_0x4577df=mapTrinoErrorToErrorCode(_0xdb1dfb),_0x154ecf=process[_0x48fcf1(0x178)][_0x48fcf1(0x150)]?new Chalk({'level':0x3}):new Chalk({'level':0x0}),_0x201568='['+_0xdb1dfb['errorName']+']\x20Query\x20ID:\x20'+_0x445965;let _0x4b21c9=_0x154ecf[_0x48fcf1(0x13a)](_0x201568+'\x0a'+_0xdb1dfb['message']);if(_0x37bdb6&&_0xdb1dfb[_0x48fcf1(0x141)]){const {lineNumber:_0x418eb5,columnNumber:_0x5410a7}=_0xdb1dfb[_0x48fcf1(0x141)];_0x4b21c9+='\x0a\x0a'+_0x154ecf[_0x48fcf1(0x161)](_0x48fcf1(0x155))+'\x0a'+formatSqlErrorContext(_0x37bdb6,_0x418eb5,_0x5410a7);}throw new SDKError(_0x4577df,_0x4b21c9,_0xdb1dfb);}['convertRowsToObjects'](_0x2f80cf,_0x35b24b){const _0x904335=a9_0x1b9eb2;if(_0x2f80cf[_0x904335(0x174)]===0x0)return _0x35b24b;return _0x35b24b[_0x904335(0x131)](_0x5ef711=>{const _0x4e1203=_0x904335,_0x23aa1a={};return _0x2f80cf[_0x4e1203(0x16b)]((_0xbc473,_0x15e10a)=>{_0x23aa1a[_0xbc473['name']]=_0x5ef711[_0x15e10a];}),_0x23aa1a;});}async[a9_0x1b9eb2(0x13e)](_0x588f8c){const _0x5e1887=a9_0x1b9eb2;try{const _0x10707e=new URL(_0x588f8c)['pathname'];await this['httpClient'][_0x5e1887(0x148)](_0x5e1887(0x173),_0x10707e);}catch(_0x4fef36){console[_0x5e1887(0x147)](_0x5e1887(0x177),_0x4fef36);}}}function formatSqlErrorContext(_0x2fe499,_0x1d47cc,_0x4b5f78){const _0x3bc5d5=a9_0x1b9eb2,_0x5e6497=_0x2fe499[_0x3bc5d5(0x14a)]('\x0a');if(_0x1d47cc<0x1||_0x1d47cc>_0x5e6497[_0x3bc5d5(0x174)])return _0x2fe499;const _0x147289=_0x1d47cc-0x1,_0x4a2522=Math[_0x3bc5d5(0x171)](0x0,_0x147289-0x2),_0x2e9838=Math[_0x3bc5d5(0x15c)](_0x5e6497[_0x3bc5d5(0x174)],_0x147289+0x3),_0x53959f=[],_0x19de51=process['stdout']['isTTY']?new Chalk({'level':0x3}):new Chalk({'level':0x0});for(let _0x5b017b=_0x4a2522;_0x5b017b<_0x2e9838;_0x5b017b++){const _0x510894=_0x5b017b===_0x147289?'>\x20':'\x20\x20',_0x4d1f2b=String(_0x5b017b+0x1)[_0x3bc5d5(0x166)](0x3,'\x20'),_0x799d32=_0x19de51[_0x3bc5d5(0x161)](''+_0x510894+_0x4d1f2b+'\x20|');_0x53959f[_0x3bc5d5(0x168)](_0x799d32+'\x20'+_0x5e6497[_0x5b017b]);if(_0x5b017b===_0x147289){const _0x512bb5=0x8+(_0x4b5f78-0x1);_0x53959f[_0x3bc5d5(0x168)]('\x20'[_0x3bc5d5(0x165)](_0x512bb5)+'^');}}return _0x53959f[_0x3bc5d5(0x134)]('\x0a');}function mapTrinoErrorToErrorCode(_0xc0aaaf){const _0x4c677d=a9_0x1b9eb2,_0xd5f382=_0xc0aaaf[_0x4c677d(0x142)],_0x3dc9e3=_0xc0aaaf[_0x4c677d(0x15b)];if(_0xd5f382===_0x4c677d(0x162))switch(_0x3dc9e3){case 0x1:return ErrorCode[_0x4c677d(0x179)];case 0x3:return ErrorCode[_0x4c677d(0x15f)];case 0x4:return ErrorCode[_0x4c677d(0x140)];case 0x5:case 0x2c:case 0x2d:case 0x2e:case 0x2f:return ErrorCode[_0x4c677d(0x167)];case 0xc:case 0x31:case 0x32:return ErrorCode[_0x4c677d(0x144)];default:return ErrorCode[_0x4c677d(0x176)];}else{if(_0xd5f382===_0x4c677d(0x14d))return ErrorCode['TRINO_INTERNAL_ERROR'];else{if(_0xd5f382===_0x4c677d(0x15e))return ErrorCode[_0x4c677d(0x136)];else{if(_0xd5f382===_0x4c677d(0x132))return ErrorCode[_0x4c677d(0x169)];}}}return ErrorCode[_0x4c677d(0x13b)];}
1
+ const a9_0x26285d=a9_0x3d8d;(function(_0x1c1fbc,_0x4590f4){const _0x559627=a9_0x3d8d,_0x5f3163=_0x1c1fbc();while(!![]){try{const _0x3658a4=parseInt(_0x559627(0x1b1))/0x1*(parseInt(_0x559627(0x1dd))/0x2)+-parseInt(_0x559627(0x1ee))/0x3*(-parseInt(_0x559627(0x1e5))/0x4)+parseInt(_0x559627(0x1e3))/0x5*(parseInt(_0x559627(0x1ca))/0x6)+parseInt(_0x559627(0x1c8))/0x7*(-parseInt(_0x559627(0x1f0))/0x8)+-parseInt(_0x559627(0x1ec))/0x9*(-parseInt(_0x559627(0x1c2))/0xa)+-parseInt(_0x559627(0x1af))/0xb*(-parseInt(_0x559627(0x1d5))/0xc)+-parseInt(_0x559627(0x1e8))/0xd*(parseInt(_0x559627(0x1b8))/0xe);if(_0x3658a4===_0x4590f4)break;else _0x5f3163['push'](_0x5f3163['shift']());}catch(_0x1bfeb1){_0x5f3163['push'](_0x5f3163['shift']());}}}(a9_0x2b99,0xd4b86));import{HTTPClient}from'./http-client.js';import{getEndpoint}from'../types/index.js';function a9_0x2b99(){const _0x17b78e=['max','4880060XwJizd','ALREADY_EXISTS','convertRowsToObjects','jobId','padStart','red','15162LAOMJS','name','324rUBkeg','nextUri','[query]','dim','checkResponseError','processedRows','warn','state','stats','map','totalSplits','106404baOsff','Warning:\x20Large\x20result\x20set\x20(','USER_ERROR','TRINO_INTERNAL_ERROR','text/plain','error','INTERNAL','errorName','58678lXIDIl','x-td-jobid','Query\x20cancelled\x20by\x20user','httpClient','pathname','request','70810OXqLar','columns','119556tUsNhC','errorLocation','isTTY','664365kdWZhG','push','\x20rows)\x20-\x20','INTERNAL_ERROR','9iapBpV','cancelQuery','12gUynys','stdout','5968uOILoB','X-Trino-Schema','/v1/statement','errorType','split','TRINO_USER_CANCELLED','errorCode','consider\x20adding\x20LIMIT\x20clause','message','1727yBsujA','PERMISSION_DENIED','1rRynzB','TRINO_SYNTAX_ERROR','aborted','TRINO_INVALID_ARGUMENT','INSUFFICIENT_RESOURCES','DELETE','completedSplits','84abBiRo','data','executeQuery','trino','warnings','site','X-TD-JobId','length','streamResults'];a9_0x2b99=function(){return _0x17b78e;};return a9_0x2b99();}import{getTrinoHeaders}from'../core/auth.js';import{SDKError,ErrorCode}from'../sdk/errors.js';import{Chalk}from'chalk';function a9_0x3d8d(_0x21be2f,_0x1c3483){const _0x2b9923=a9_0x2b99();return a9_0x3d8d=function(_0x3d8d1c,_0x4fb5be){_0x3d8d1c=_0x3d8d1c-0x1ad;let _0x28ecb0=_0x2b9923[_0x3d8d1c];return _0x28ecb0;},a9_0x3d8d(_0x21be2f,_0x1c3483);}export class TrinoApiClient{['httpClient'];constructor(_0x5c67d8,_0x4c0d30){const _0x3c1ca5=a9_0x3d8d,_0x68a0f1=getEndpoint(_0x5c67d8[_0x3c1ca5(0x1bd)],_0x3c1ca5(0x1bb)),_0x5ebd8c=getTrinoHeaders(_0x5c67d8['site'],_0x5c67d8['apiKey']);this['httpClient']=new HTTPClient(_0x68a0f1,_0x5ebd8c,_0x4c0d30);}async[a9_0x26285d(0x1ba)](_0x41409c,_0x2b4377={}){const _0x2bb83b=a9_0x26285d,{catalog:_0x23e8fb,schema:_0x3a0e75,timeout:_0x2e307b,signal:_0x103fda,onJobId:_0x31a06f,onProgress:_0x49d020}=_0x2b4377,_0x202101={'Content-Type':_0x2bb83b(0x1d9)};(_0x23e8fb||_0x3a0e75)&&(_0x202101['X-Trino-Catalog']=_0x23e8fb||'td');_0x3a0e75&&(_0x202101[_0x2bb83b(0x1f1)]=_0x3a0e75);const _0x3a72cb=await this[_0x2bb83b(0x1e0)][_0x2bb83b(0x1e2)]('POST',_0x2bb83b(0x1f2),{'headers':_0x202101,'body':_0x41409c,'timeout':_0x2e307b,'signal':_0x103fda,'includeHeaders':!![]}),_0x389ac7=_0x3a72cb[_0x2bb83b(0x1b9)],_0x12e92e=_0x3a72cb['headers'],_0x6886ec=_0x12e92e[_0x2bb83b(0x1de)]||_0x12e92e[_0x2bb83b(0x1be)];_0x6886ec&&_0x31a06f&&_0x31a06f(_0x6886ec);this['checkResponseError'](_0x389ac7,_0x389ac7['id'],_0x41409c);const _0x2d2074=await this[_0x2bb83b(0x1c0)](_0x389ac7,_0x41409c,_0x103fda,_0x49d020);return _0x6886ec&&(_0x2d2074[_0x2bb83b(0x1c5)]=_0x6886ec),_0x2d2074;}async[a9_0x26285d(0x1c0)](_0x53fa0e,_0x461dbf,_0x414988,_0xc0918b){const _0x4ed929=a9_0x26285d,_0xedd094=_0x53fa0e['id'];let _0x1e920f=[];const _0x66a8dd=[],_0x320263=[];let _0x4f8baf=_0x53fa0e;const _0x37a1eb=0x186a0;_0x4f8baf['columns']&&(_0x1e920f=_0x4f8baf[_0x4ed929(0x1e4)]);_0x4f8baf[_0x4ed929(0x1b9)]&&_0x66a8dd['push'](..._0x4f8baf[_0x4ed929(0x1b9)]);_0x4f8baf[_0x4ed929(0x1bc)]&&_0x320263[_0x4ed929(0x1e9)](..._0x4f8baf[_0x4ed929(0x1bc)]);_0xc0918b&&_0x4f8baf['stats']&&_0xc0918b({'state':_0x4f8baf['stats'][_0x4ed929(0x1d1)],'processedRows':_0x4f8baf['stats'][_0x4ed929(0x1cf)],'completedSplits':_0x4f8baf[_0x4ed929(0x1d2)]['completedSplits'],'totalSplits':_0x4f8baf['stats'][_0x4ed929(0x1d4)]});while(_0x4f8baf['nextUri']){if(_0x414988?.[_0x4ed929(0x1b3)]){await this[_0x4ed929(0x1ed)](_0x4f8baf[_0x4ed929(0x1cb)]);throw new Error(_0x4ed929(0x1df));}let _0x2f1001;try{_0x2f1001=new URL(_0x4f8baf[_0x4ed929(0x1cb)])[_0x4ed929(0x1e1)];}catch{throw new Error('Invalid\x20nextUri\x20format:\x20'+_0x4f8baf['nextUri']);}_0x4f8baf=await this[_0x4ed929(0x1e0)][_0x4ed929(0x1e2)]('GET',_0x2f1001,{'signal':_0x414988}),this[_0x4ed929(0x1ce)](_0x4f8baf,_0xedd094,_0x461dbf),_0x4f8baf[_0x4ed929(0x1e4)]&&_0x1e920f['length']===0x0&&(_0x1e920f=_0x4f8baf[_0x4ed929(0x1e4)]),_0x4f8baf[_0x4ed929(0x1b9)]&&(_0x66a8dd['push'](..._0x4f8baf[_0x4ed929(0x1b9)]),_0x66a8dd['length']>_0x37a1eb&&_0x66a8dd[_0x4ed929(0x1bf)]%0xc350===0x0&&console['warn'](_0x4ed929(0x1d6)+_0x66a8dd['length']['toLocaleString']()+_0x4ed929(0x1ea)+_0x4ed929(0x1ad))),_0x4f8baf[_0x4ed929(0x1bc)]&&_0x320263[_0x4ed929(0x1e9)](..._0x4f8baf[_0x4ed929(0x1bc)]),_0xc0918b&&_0x4f8baf[_0x4ed929(0x1d2)]&&_0xc0918b({'state':_0x4f8baf[_0x4ed929(0x1d2)]['state'],'processedRows':_0x4f8baf[_0x4ed929(0x1d2)][_0x4ed929(0x1cf)],'completedSplits':_0x4f8baf['stats'][_0x4ed929(0x1b7)],'totalSplits':_0x4f8baf[_0x4ed929(0x1d2)]['totalSplits']});}const _0x497211=this[_0x4ed929(0x1c4)](_0x1e920f,_0x66a8dd);return{'queryId':_0xedd094,'columns':_0x1e920f,'data':_0x497211,'stats':_0x4f8baf['stats'],'warnings':_0x320263[_0x4ed929(0x1bf)]>0x0?_0x320263:undefined};}[a9_0x26285d(0x1ce)](_0x36d858,_0x10bc1b,_0x20f2b5){const _0x2dc7bb=a9_0x26285d;if(!_0x36d858[_0x2dc7bb(0x1da)])return;const _0x4489b3=_0x36d858[_0x2dc7bb(0x1da)],_0x491501=mapTrinoErrorToErrorCode(_0x4489b3),_0x5d245d=process['stdout'][_0x2dc7bb(0x1e7)]?new Chalk({'level':0x3}):new Chalk({'level':0x0}),_0x2e4830='['+_0x4489b3[_0x2dc7bb(0x1dc)]+']\x20Query\x20ID:\x20'+_0x10bc1b;let _0x9d301b=_0x5d245d[_0x2dc7bb(0x1c7)](_0x2e4830+'\x0a'+_0x4489b3[_0x2dc7bb(0x1ae)]);if(_0x20f2b5&&_0x4489b3[_0x2dc7bb(0x1e6)]){const {lineNumber:_0x261d0e,columnNumber:_0x55c2f6}=_0x4489b3[_0x2dc7bb(0x1e6)];_0x9d301b+='\x0a\x0a'+_0x5d245d[_0x2dc7bb(0x1cd)](_0x2dc7bb(0x1cc))+'\x0a'+formatSqlErrorContext(_0x20f2b5,_0x261d0e,_0x55c2f6);}throw new SDKError(_0x491501,_0x9d301b,_0x4489b3);}[a9_0x26285d(0x1c4)](_0x2dcceb,_0x19ba72){const _0x4c88c2=a9_0x26285d;if(_0x2dcceb[_0x4c88c2(0x1bf)]===0x0)return _0x19ba72;return _0x19ba72[_0x4c88c2(0x1d3)](_0xd5afb3=>{const _0x4db831={};return _0x2dcceb['forEach']((_0x87285d,_0x62d163)=>{const _0x4f54a1=a9_0x3d8d;_0x4db831[_0x87285d[_0x4f54a1(0x1c9)]]=_0xd5afb3[_0x62d163];}),_0x4db831;});}async[a9_0x26285d(0x1ed)](_0x4b59df){const _0x18df32=a9_0x26285d;try{const _0x4c0ad6=new URL(_0x4b59df)['pathname'];await this['httpClient']['request'](_0x18df32(0x1b6),_0x4c0ad6);}catch(_0x15fe19){console[_0x18df32(0x1d0)]('Failed\x20to\x20cancel\x20query:',_0x15fe19);}}}function formatSqlErrorContext(_0x5b2523,_0x2a122b,_0x18f9cc){const _0x2c6701=a9_0x26285d,_0x464969=_0x5b2523[_0x2c6701(0x1f4)]('\x0a');if(_0x2a122b<0x1||_0x2a122b>_0x464969[_0x2c6701(0x1bf)])return _0x5b2523;const _0x299228=_0x2a122b-0x1,_0x459af3=Math[_0x2c6701(0x1c1)](0x0,_0x299228-0x2),_0x37b9ad=Math['min'](_0x464969['length'],_0x299228+0x3),_0x3362f1=[],_0x44f85e=process[_0x2c6701(0x1ef)][_0x2c6701(0x1e7)]?new Chalk({'level':0x3}):new Chalk({'level':0x0});for(let _0x24a263=_0x459af3;_0x24a263<_0x37b9ad;_0x24a263++){const _0x332d39=_0x24a263===_0x299228?'>\x20':'\x20\x20',_0x1f9b4b=String(_0x24a263+0x1)[_0x2c6701(0x1c6)](0x3,'\x20'),_0x5f5547=_0x44f85e[_0x2c6701(0x1cd)](''+_0x332d39+_0x1f9b4b+'\x20|');_0x3362f1[_0x2c6701(0x1e9)](_0x5f5547+'\x20'+_0x464969[_0x24a263]);if(_0x24a263===_0x299228){const _0x2af874=0x8+(_0x18f9cc-0x1);_0x3362f1[_0x2c6701(0x1e9)]('\x20'['repeat'](_0x2af874)+'^');}}return _0x3362f1['join']('\x0a');}function mapTrinoErrorToErrorCode(_0x120206){const _0x368b65=a9_0x26285d,_0x1306ad=_0x120206[_0x368b65(0x1f3)],_0x318567=_0x120206[_0x368b65(0x1f6)];if(_0x1306ad===_0x368b65(0x1d7))switch(_0x318567){case 0x1:return ErrorCode[_0x368b65(0x1b2)];case 0x3:return ErrorCode[_0x368b65(0x1f5)];case 0x4:return ErrorCode[_0x368b65(0x1b0)];case 0x5:case 0x2c:case 0x2d:case 0x2e:case 0x2f:return ErrorCode['TRINO_NOT_FOUND'];case 0xc:case 0x31:case 0x32:return ErrorCode[_0x368b65(0x1c3)];default:return ErrorCode[_0x368b65(0x1b4)];}else{if(_0x1306ad===_0x368b65(0x1eb))return ErrorCode[_0x368b65(0x1d8)];else{if(_0x1306ad===_0x368b65(0x1b5))return ErrorCode['TRINO_INSUFFICIENT_RESOURCES'];else{if(_0x1306ad==='EXTERNAL')return ErrorCode[_0x368b65(0x1d8)];}}}return ErrorCode[_0x368b65(0x1db)];}
@@ -1 +1 @@
1
- const a10_0x121bcd=a10_0x2c32;(function(_0x4504e7,_0x4d7550){const _0x20d954=a10_0x2c32,_0x1e5a26=_0x4504e7();while(!![]){try{const _0x59b51e=parseInt(_0x20d954(0x127))/0x1+parseInt(_0x20d954(0x11f))/0x2+parseInt(_0x20d954(0xe1))/0x3*(parseInt(_0x20d954(0xf0))/0x4)+parseInt(_0x20d954(0xf4))/0x5*(-parseInt(_0x20d954(0xe8))/0x6)+-parseInt(_0x20d954(0x100))/0x7+parseInt(_0x20d954(0xe0))/0x8+-parseInt(_0x20d954(0x11c))/0x9;if(_0x59b51e===_0x4d7550)break;else _0x1e5a26['push'](_0x1e5a26['shift']());}catch(_0x400366){_0x1e5a26['push'](_0x1e5a26['shift']());}}}(a10_0x45e6,0x9f066));function a10_0x45e6(){const _0x33d91a=['1397920AUemMJ','last_id','workflowId','lastId','project_name','/tasks?','/logs?','/api/projects?','217575bpFhBK','scheduleFrom','readFile','/archive','filter','workflow','retrySession','request','retryAttemptName','killAttempt','status','getTaskLogs','uploadProjectArchive','/archive?','replace','clearSchedule','/files','POST','/api/workflows?','toString','clearScheduleAll','revision','resume_from','site','getAttempt','8783568CCZjOH','33090UzHVEB','from_time','task','sessionTime','search_project_name','/api/attempts','/kill','3432xzsphv','/api/attempts/','attempts','workflows','/files?','authHeaders','files','from_task','344pfabHR','name_pattern','clear_schedule','httpClient','8335IsKZTJ','downloadProjectArchive','DELETE','workflowName','project','/logs','to_time','listProjects','/api/projects/','allowQueueing','true','name','4813242VWXBqy','append','/api/sessions/','project_id','schedule_from','forEach','projectName','workflow_name','limit','/tasks','include_retried','listLogFiles','/retry','GET','retry_params','listWorkflows','offset','include_subtasks','application/gzip','force','projects','/api/projects','/api/workflows','deleteProject','/api/logs/','getAttemptTasks','reason','sessions','6035085ttsvhw','/sessions','/tasks/'];a10_0x45e6=function(){return _0x33d91a;};return a10_0x45e6();}import{HTTPClient}from'./http-client.js';import{getEndpoint}from'../types/index.js';import{getAuthHeaders,toHeaderRecord}from'../core/auth.js';function a10_0x2c32(_0x3b16b1,_0x412dbe){const _0x45e688=a10_0x45e6();return a10_0x2c32=function(_0x2c329e,_0x514fa2){_0x2c329e=_0x2c329e-0xce;let _0x38d602=_0x45e688[_0x2c329e];return _0x38d602;},a10_0x2c32(_0x3b16b1,_0x412dbe);}import{matchGlobPattern}from'../utils/string-utils.js';export class WorkflowApiClient{['httpClient'];[a10_0x121bcd(0xed)];constructor(_0x2cc7b8,_0x41973d){const _0x12dc48=a10_0x121bcd,_0xc94c83=getEndpoint(_0x2cc7b8[_0x12dc48(0xde)],'workflow');this[_0x12dc48(0xed)]=toHeaderRecord(getAuthHeaders(_0x2cc7b8[_0x12dc48(0xde)],_0x2cc7b8['apiKey'])),this[_0x12dc48(0xf3)]=new HTTPClient(_0xc94c83,this[_0x12dc48(0xed)],_0x41973d);}async[a10_0x121bcd(0xfb)](_0x351d16){const _0xe45151=a10_0x121bcd,_0x2d4984=new URLSearchParams();if(_0x351d16?.[_0xe45151(0x108)])_0x2d4984[_0xe45151(0x101)](_0xe45151(0x108),String(_0x351d16[_0xe45151(0x108)]));if(_0x351d16?.[_0xe45151(0x120)])_0x2d4984[_0xe45151(0x101)]('last_id',_0x351d16['last_id']);if(_0x351d16?.[_0xe45151(0xf1)]){const _0x1a482d=_0x351d16[_0xe45151(0xf1)][_0xe45151(0xd5)](/[*?]/g,'');_0x1a482d&&_0x2d4984[_0xe45151(0x101)](_0xe45151(0xf1),_0x1a482d);}const _0x36a207=_0x2d4984[_0xe45151(0xda)](),_0x331ca9=_0x36a207?_0xe45151(0x126)+_0x36a207:_0xe45151(0x115),_0xb8a9a9=await this[_0xe45151(0xf3)][_0xe45151(0xce)](_0xe45151(0x10d),_0x331ca9);let _0x2b6c47=_0xb8a9a9[_0xe45151(0x114)]||[];return _0x351d16?.[_0xe45151(0xf1)]&&(_0x2b6c47=_0x2b6c47[_0xe45151(0x12b)](_0x2429d3=>{const _0xe72681=_0xe45151;return matchGlobPattern(_0x2429d3[_0xe72681(0xff)],_0x351d16[_0xe72681(0xf1)]);})),{'data':_0x2b6c47,'lastId':_0xb8a9a9[_0xe45151(0x122)]};}async[a10_0x121bcd(0x10f)](_0x117a72){const _0x41fb02=a10_0x121bcd,_0x548569=new URLSearchParams();if(_0x117a72?.[_0x41fb02(0x108)])_0x548569[_0x41fb02(0x101)](_0x41fb02(0x108),String(_0x117a72[_0x41fb02(0x108)]));if(_0x117a72?.[_0x41fb02(0x120)])_0x548569[_0x41fb02(0x101)]('last_id',_0x117a72[_0x41fb02(0x120)]);if(_0x117a72?.[_0x41fb02(0x123)]){const _0x2fe423=_0x117a72[_0x41fb02(0x123)][_0x41fb02(0xd5)](/[*?]/g,'');_0x2fe423&&(_0x548569[_0x41fb02(0x101)]('name_pattern',_0x2fe423),_0x548569[_0x41fb02(0x101)](_0x41fb02(0xe5),'true'));}const _0x3ebece=_0x548569[_0x41fb02(0xda)](),_0x58c39b=_0x3ebece?_0x41fb02(0xd9)+_0x3ebece:_0x41fb02(0x116),_0xe482a7=await this[_0x41fb02(0xf3)]['request'](_0x41fb02(0x10d),_0x58c39b);let _0x232539=_0xe482a7[_0x41fb02(0xeb)]||[];return _0x117a72?.[_0x41fb02(0x123)]&&(_0x232539=_0x232539[_0x41fb02(0x12b)](_0x321013=>{const _0x35fff5=_0x41fb02,_0x31f5e1=_0x321013[_0x35fff5(0xf8)]?.[_0x35fff5(0xff)];if(!_0x31f5e1)return![];return matchGlobPattern(_0x31f5e1,_0x117a72[_0x35fff5(0x123)]);})),{'data':_0x232539,'lastId':_0xe482a7['lastId']};}async['listSessions'](_0x3ecdcb){const _0x353750=a10_0x121bcd;let _0x4b9501='/api/sessions';_0x3ecdcb?.['project_id']&&(_0x4b9501=_0x353750(0xfc)+encodeURIComponent(_0x3ecdcb[_0x353750(0x103)])+_0x353750(0x11d));const _0x1d18fc=new URLSearchParams();if(_0x3ecdcb?.[_0x353750(0x107)])_0x1d18fc['append']('workflow',_0x3ecdcb[_0x353750(0x107)]);if(_0x3ecdcb?.[_0x353750(0xd1)])_0x1d18fc['append'](_0x353750(0xd1),_0x3ecdcb[_0x353750(0xd1)]);if(_0x3ecdcb?.[_0x353750(0xe2)])_0x1d18fc['append'](_0x353750(0xe2),_0x3ecdcb[_0x353750(0xe2)]);if(_0x3ecdcb?.[_0x353750(0xfa)])_0x1d18fc['append'](_0x353750(0xfa),_0x3ecdcb[_0x353750(0xfa)]);if(_0x3ecdcb?.['limit'])_0x1d18fc[_0x353750(0x101)](_0x353750(0x108),String(_0x3ecdcb['limit']));if(_0x3ecdcb?.[_0x353750(0x120)])_0x1d18fc[_0x353750(0x101)]('last_id',_0x3ecdcb['last_id']);const _0x477e8f=_0x1d18fc[_0x353750(0xda)]();_0x477e8f&&(_0x4b9501=_0x4b9501+'?'+_0x477e8f);const _0x5bbdee=await this[_0x353750(0xf3)][_0x353750(0xce)](_0x353750(0x10d),_0x4b9501);return{'data':_0x5bbdee[_0x353750(0x11b)]||[],'lastId':_0x5bbdee[_0x353750(0x122)]};}async['listAttempts'](_0x305297){const _0xe95ad6=a10_0x121bcd,_0x288093=new URLSearchParams();if(_0x305297?.[_0xe95ad6(0x123)])_0x288093[_0xe95ad6(0x101)](_0xe95ad6(0xf8),_0x305297[_0xe95ad6(0x123)]);if(_0x305297?.[_0xe95ad6(0x107)])_0x288093[_0xe95ad6(0x101)](_0xe95ad6(0x12c),_0x305297['workflow_name']);if(_0x305297?.[_0xe95ad6(0x10a)])_0x288093[_0xe95ad6(0x101)](_0xe95ad6(0x10a),'1');if(_0x305297?.[_0xe95ad6(0x108)])_0x288093[_0xe95ad6(0x101)](_0xe95ad6(0x108),String(_0x305297[_0xe95ad6(0x108)]));if(_0x305297?.[_0xe95ad6(0x120)])_0x288093['append'](_0xe95ad6(0x120),_0x305297['last_id']);const _0x96c1a4=_0x288093[_0xe95ad6(0xda)](),_0x3c230e=_0x96c1a4?'/api/attempts?'+_0x96c1a4:_0xe95ad6(0xe6),_0x1ed4eb=await this[_0xe95ad6(0xf3)][_0xe95ad6(0xce)](_0xe95ad6(0x10d),_0x3c230e);return{'data':_0x1ed4eb[_0xe95ad6(0xea)]||[],'lastId':_0x1ed4eb[_0xe95ad6(0x122)]};}async[a10_0x121bcd(0xdf)](_0x321e5d){const _0x420c20=a10_0x121bcd;return await this['httpClient']['request']('GET',_0x420c20(0xe9)+encodeURIComponent(_0x321e5d));}async[a10_0x121bcd(0x119)](_0x442f9f,_0x6cac75=![]){const _0x41e06b=a10_0x121bcd,_0x795e55=new URLSearchParams();_0x6cac75&&_0x795e55['append'](_0x41e06b(0x111),_0x41e06b(0xfe));const _0xcd90c4=_0x795e55[_0x41e06b(0xda)](),_0x592a7f=_0xcd90c4?_0x41e06b(0xe9)+encodeURIComponent(_0x442f9f)+_0x41e06b(0x124)+_0xcd90c4:'/api/attempts/'+encodeURIComponent(_0x442f9f)+_0x41e06b(0x109),_0x423c86=await this[_0x41e06b(0xf3)][_0x41e06b(0xce)]('GET',_0x592a7f);return _0x423c86['tasks']||[];}async[a10_0x121bcd(0xd2)](_0x5486fd,_0x1243cb,_0x83110b){const _0x23dff4=a10_0x121bcd,_0x5663f7=new URLSearchParams();_0x83110b?.[_0x23dff4(0x110)]!==undefined&&_0x5663f7[_0x23dff4(0x101)](_0x23dff4(0x110),String(_0x83110b[_0x23dff4(0x110)]));_0x83110b?.[_0x23dff4(0x108)]!==undefined&&_0x5663f7['append']('limit',String(_0x83110b[_0x23dff4(0x108)]));const _0x7d6220=_0x5663f7[_0x23dff4(0xda)](),_0x3fa8c0=_0x7d6220?_0x23dff4(0xe9)+encodeURIComponent(_0x5486fd)+_0x23dff4(0x11e)+encodeURIComponent(_0x1243cb)+_0x23dff4(0x125)+_0x7d6220:_0x23dff4(0xe9)+encodeURIComponent(_0x5486fd)+'/tasks/'+encodeURIComponent(_0x1243cb)+_0x23dff4(0xf9),_0x46f8fb=await this[_0x23dff4(0xf3)]['request'](_0x23dff4(0x10d),_0x3fa8c0);return _0x46f8fb['logs']||[];}async[a10_0x121bcd(0x10b)](_0x4949a8,_0x177a17){const _0x3926dc=a10_0x121bcd,_0x55b35f=new URLSearchParams();_0x177a17&&_0x55b35f['append'](_0x3926dc(0xe3),_0x177a17);const _0xa314ca=_0x55b35f[_0x3926dc(0xda)](),_0x1aa325=_0xa314ca?_0x3926dc(0x118)+encodeURIComponent(_0x4949a8)+_0x3926dc(0xec)+_0xa314ca:_0x3926dc(0x118)+encodeURIComponent(_0x4949a8)+_0x3926dc(0xd7),_0x2617bd=await this['httpClient']['request']('GET',_0x1aa325);return _0x2617bd[_0x3926dc(0xee)]||[];}async[a10_0x121bcd(0xd0)](_0x41ad14,_0x27c36b){const _0xdfbc5e=a10_0x121bcd,_0x4c7110={};return _0x27c36b&&(_0x4c7110[_0xdfbc5e(0x11a)]=_0x27c36b),await this['httpClient'][_0xdfbc5e(0xce)]('POST',_0xdfbc5e(0xe9)+encodeURIComponent(_0x41ad14)+_0xdfbc5e(0xe7),{'body':_0x4c7110});}async[a10_0x121bcd(0x12d)](_0x2653ca,_0x20ef0e){const _0x1d6252=a10_0x121bcd,_0x2fd4b5={};return _0x20ef0e?.['from_task']&&(_0x2fd4b5[_0x1d6252(0xef)]=_0x20ef0e[_0x1d6252(0xef)]),_0x20ef0e?.[_0x1d6252(0x10e)]&&(_0x2fd4b5[_0x1d6252(0x10e)]=_0x20ef0e[_0x1d6252(0x10e)]),await this[_0x1d6252(0xf3)][_0x1d6252(0xce)](_0x1d6252(0xd8),_0x1d6252(0x102)+encodeURIComponent(_0x2653ca)+_0x1d6252(0x10c),{'body':_0x2fd4b5});}async['retryAttempt'](_0x4ec26a,_0x10712f){const _0x4cf80d=a10_0x121bcd,_0x13be94={};return _0x10712f?.[_0x4cf80d(0xdd)]&&(_0x13be94[_0x4cf80d(0xdd)]=_0x10712f[_0x4cf80d(0xdd)]),_0x10712f?.[_0x4cf80d(0x10e)]&&(_0x13be94[_0x4cf80d(0x10e)]=_0x10712f[_0x4cf80d(0x10e)]),_0x10712f?.[_0x4cf80d(0x113)]&&(_0x13be94['force']=_0x10712f['force']),await this[_0x4cf80d(0xf3)][_0x4cf80d(0xce)](_0x4cf80d(0xd8),'/api/attempts/'+encodeURIComponent(_0x4ec26a)+'/retry',{'body':_0x13be94});}async['startAttempt'](_0x453022){const _0x4ca251=a10_0x121bcd,_0x2503a3={'sessionTime':_0x453022[_0x4ca251(0xe4)],'params':_0x453022['params']};return _0x453022[_0x4ca251(0x121)]&&(_0x2503a3[_0x4ca251(0x121)]=_0x453022[_0x4ca251(0x121)]),_0x453022[_0x4ca251(0x106)]&&(_0x2503a3['projectName']=_0x453022[_0x4ca251(0x106)]),_0x453022['workflowName']&&(_0x2503a3[_0x4ca251(0xf7)]=_0x453022[_0x4ca251(0xf7)]),_0x453022[_0x4ca251(0xcf)]&&(_0x2503a3[_0x4ca251(0xcf)]=_0x453022[_0x4ca251(0xcf)]),_0x453022[_0x4ca251(0xfd)]!==undefined&&(_0x2503a3[_0x4ca251(0xfd)]=_0x453022[_0x4ca251(0xfd)]),await this['httpClient'][_0x4ca251(0xce)]('PUT','/api/attempts',{'body':_0x2503a3});}async[a10_0x121bcd(0xf5)](_0x465f9e,_0x238a41,_0x3a37bb){const _0x522046=a10_0x121bcd,{promises:_0x26c12a}=await import('fs'),_0x549571=new URLSearchParams();_0x3a37bb&&_0x549571[_0x522046(0x101)](_0x522046(0xdc),_0x3a37bb);const _0x441393=_0x549571[_0x522046(0xda)](),_0x40381a=_0x441393?_0x522046(0xfc)+encodeURIComponent(_0x465f9e)+_0x522046(0xd4)+_0x441393:_0x522046(0xfc)+encodeURIComponent(_0x465f9e)+_0x522046(0x12a),_0x17c14c=await this[_0x522046(0xf3)][_0x522046(0xce)](_0x522046(0x10d),_0x40381a,{'headers':{'Accept':'application/gzip'},'responseType':'arraybuffer'});return await _0x26c12a['writeFile'](_0x238a41,_0x17c14c),_0x238a41;}async[a10_0x121bcd(0xd3)](_0x3f2503,_0x40fed5,_0x509378,_0x19caa9){const _0x5a0462=a10_0x121bcd,{promises:_0xdb6e8e}=await import('fs'),_0x178bb4=new URLSearchParams();_0x178bb4[_0x5a0462(0x101)]('project',_0x3f2503),_0x178bb4[_0x5a0462(0x101)](_0x5a0462(0xdc),_0x40fed5);_0x19caa9?.['scheduleFrom']&&_0x178bb4[_0x5a0462(0x101)](_0x5a0462(0x104),_0x19caa9[_0x5a0462(0x128)]);_0x19caa9?.[_0x5a0462(0xd6)]&&_0x19caa9[_0x5a0462(0xd6)][_0x5a0462(0x105)](_0x13433a=>{const _0xfea03c=_0x5a0462;_0x178bb4[_0xfea03c(0x101)](_0xfea03c(0xf2),_0x13433a);});_0x19caa9?.[_0x5a0462(0xdb)]&&_0x178bb4['append']('clear_schedule_all','true');const _0x5746e7=_0x178bb4[_0x5a0462(0xda)](),_0x54f7bf=_0x5a0462(0x126)+_0x5746e7,_0x23f398=await _0xdb6e8e[_0x5a0462(0x129)](_0x509378);return await this[_0x5a0462(0xf3)]['request']('PUT',_0x54f7bf,{'body':_0x23f398,'headers':{'Content-Type':_0x5a0462(0x112)}});}async[a10_0x121bcd(0x117)](_0x4f47fa){const _0x55a2a1=a10_0x121bcd;return await this['httpClient']['request'](_0x55a2a1(0xf6),'/api/projects/'+encodeURIComponent(_0x4f47fa));}}
1
+ const a10_0x2f939d=a10_0x9950;(function(_0x23b0f4,_0x75806c){const _0x344e27=a10_0x9950,_0x433a35=_0x23b0f4();while(!![]){try{const _0x139e80=parseInt(_0x344e27(0x1ff))/0x1+parseInt(_0x344e27(0x1e1))/0x2+parseInt(_0x344e27(0x1f0))/0x3+parseInt(_0x344e27(0x1f6))/0x4*(parseInt(_0x344e27(0x20f))/0x5)+-parseInt(_0x344e27(0x1cd))/0x6+parseInt(_0x344e27(0x1ca))/0x7+-parseInt(_0x344e27(0x1ed))/0x8;if(_0x139e80===_0x75806c)break;else _0x433a35['push'](_0x433a35['shift']());}catch(_0xbec089){_0x433a35['push'](_0x433a35['shift']());}}}(a10_0x30a3,0xc5c91));import{HTTPClient}from'./http-client.js';import{getEndpoint}from'../types/index.js';function a10_0x9950(_0x452f70,_0x388e20){const _0x30a3f7=a10_0x30a3();return a10_0x9950=function(_0x9950e9,_0x534e7b){_0x9950e9=_0x9950e9-0x1c0;let _0x3b45dd=_0x30a3f7[_0x9950e9];return _0x3b45dd;},a10_0x9950(_0x452f70,_0x388e20);}import{getAuthHeaders,toHeaderRecord}from'../core/auth.js';import{matchGlobPattern}from'../utils/string-utils.js';export class WorkflowApiClient{[a10_0x2f939d(0x1d6)];[a10_0x2f939d(0x1c6)];constructor(_0x3e7871,_0x54eb37){const _0x169357=a10_0x2f939d,_0x5aa5a9=getEndpoint(_0x3e7871[_0x169357(0x1de)],_0x169357(0x214));this[_0x169357(0x1c6)]=toHeaderRecord(getAuthHeaders(_0x3e7871[_0x169357(0x1de)],_0x3e7871[_0x169357(0x1ce)])),this[_0x169357(0x1d6)]=new HTTPClient(_0x5aa5a9,this['authHeaders'],_0x54eb37);}async['listProjects'](_0x195185){const _0x2ca28d=a10_0x2f939d,_0x363e0e=new URLSearchParams();if(_0x195185?.['limit'])_0x363e0e[_0x2ca28d(0x201)](_0x2ca28d(0x20b),String(_0x195185[_0x2ca28d(0x20b)]));if(_0x195185?.[_0x2ca28d(0x1c7)])_0x363e0e[_0x2ca28d(0x201)]('last_id',_0x195185['last_id']);if(_0x195185?.['name_pattern']){const _0x5b053a=_0x195185[_0x2ca28d(0x1e8)]['replace'](/[*?]/g,'');_0x5b053a&&_0x363e0e[_0x2ca28d(0x201)](_0x2ca28d(0x1e8),_0x5b053a);}const _0x5721d8=_0x363e0e['toString'](),_0xb2a1d9=_0x5721d8?_0x2ca28d(0x1e2)+_0x5721d8:_0x2ca28d(0x1d8),_0x3a89e7=await this[_0x2ca28d(0x1d6)][_0x2ca28d(0x1f3)](_0x2ca28d(0x1fc),_0xb2a1d9);let _0x3adc71=_0x3a89e7[_0x2ca28d(0x1ee)]||[];return _0x195185?.[_0x2ca28d(0x1e8)]&&(_0x3adc71=_0x3adc71[_0x2ca28d(0x200)](_0x46490d=>{const _0x38c17f=_0x2ca28d;return matchGlobPattern(_0x46490d[_0x38c17f(0x1dd)],_0x195185[_0x38c17f(0x1e8)]);})),{'data':_0x3adc71,'lastId':_0x3a89e7['lastId']};}async[a10_0x2f939d(0x1cf)](_0x1f759f){const _0x29e773=a10_0x2f939d,_0x23411f=new URLSearchParams();if(_0x1f759f?.[_0x29e773(0x20b)])_0x23411f[_0x29e773(0x201)](_0x29e773(0x20b),String(_0x1f759f['limit']));if(_0x1f759f?.['last_id'])_0x23411f[_0x29e773(0x201)](_0x29e773(0x1c7),_0x1f759f['last_id']);if(_0x1f759f?.['project_name']){const _0x238777=_0x1f759f[_0x29e773(0x1c0)][_0x29e773(0x1fb)](/[*?]/g,'');_0x238777&&(_0x23411f['append'](_0x29e773(0x1e8),_0x238777),_0x23411f['append']('search_project_name',_0x29e773(0x206)));}const _0x4a9e38=_0x23411f[_0x29e773(0x1ea)](),_0x35f91a=_0x4a9e38?'/api/workflows?'+_0x4a9e38:_0x29e773(0x1db),_0x37401e=await this[_0x29e773(0x1d6)][_0x29e773(0x1f3)](_0x29e773(0x1fc),_0x35f91a);let _0x2032fe=_0x37401e[_0x29e773(0x1f8)]||[];return _0x1f759f?.['project_name']&&(_0x2032fe=_0x2032fe[_0x29e773(0x200)](_0x1552f7=>{const _0x58cba0=_0x29e773,_0x1fcc1c=_0x1552f7[_0x58cba0(0x1cc)]?.[_0x58cba0(0x1dd)];if(!_0x1fcc1c)return![];return matchGlobPattern(_0x1fcc1c,_0x1f759f['project_name']);})),{'data':_0x2032fe,'lastId':_0x37401e[_0x29e773(0x1dc)]};}async[a10_0x2f939d(0x213)](_0xd49f3a){const _0x1f0a34=a10_0x2f939d;let _0x4c40ab=_0x1f0a34(0x1e3);_0xd49f3a?.['project_id']&&(_0x4c40ab='/api/projects/'+encodeURIComponent(_0xd49f3a['project_id'])+_0x1f0a34(0x217));const _0x286c5e=new URLSearchParams();if(_0xd49f3a?.[_0x1f0a34(0x1e9)])_0x286c5e['append'](_0x1f0a34(0x214),_0xd49f3a[_0x1f0a34(0x1e9)]);if(_0xd49f3a?.[_0x1f0a34(0x1da)])_0x286c5e['append'](_0x1f0a34(0x1da),_0xd49f3a[_0x1f0a34(0x1da)]);if(_0xd49f3a?.[_0x1f0a34(0x1c1)])_0x286c5e[_0x1f0a34(0x201)]('from_time',_0xd49f3a[_0x1f0a34(0x1c1)]);if(_0xd49f3a?.[_0x1f0a34(0x1e7)])_0x286c5e[_0x1f0a34(0x201)](_0x1f0a34(0x1e7),_0xd49f3a[_0x1f0a34(0x1e7)]);if(_0xd49f3a?.[_0x1f0a34(0x20b)])_0x286c5e[_0x1f0a34(0x201)](_0x1f0a34(0x20b),String(_0xd49f3a[_0x1f0a34(0x20b)]));if(_0xd49f3a?.[_0x1f0a34(0x1c7)])_0x286c5e[_0x1f0a34(0x201)](_0x1f0a34(0x1c7),_0xd49f3a[_0x1f0a34(0x1c7)]);const _0x96cf02=_0x286c5e[_0x1f0a34(0x1ea)]();_0x96cf02&&(_0x4c40ab=_0x4c40ab+'?'+_0x96cf02);const _0x79e322=await this['httpClient']['request'](_0x1f0a34(0x1fc),_0x4c40ab);return{'data':_0x79e322['sessions']||[],'lastId':_0x79e322[_0x1f0a34(0x1dc)]};}async[a10_0x2f939d(0x1f5)](_0x3b4fb5){const _0x2ea620=a10_0x2f939d,_0x55b49e=new URLSearchParams();if(_0x3b4fb5?.['project_name'])_0x55b49e[_0x2ea620(0x201)]('project',_0x3b4fb5[_0x2ea620(0x1c0)]);if(_0x3b4fb5?.[_0x2ea620(0x1e9)])_0x55b49e[_0x2ea620(0x201)](_0x2ea620(0x214),_0x3b4fb5[_0x2ea620(0x1e9)]);if(_0x3b4fb5?.[_0x2ea620(0x1c8)])_0x55b49e[_0x2ea620(0x201)]('include_retried','1');if(_0x3b4fb5?.['limit'])_0x55b49e[_0x2ea620(0x201)](_0x2ea620(0x20b),String(_0x3b4fb5[_0x2ea620(0x20b)]));if(_0x3b4fb5?.[_0x2ea620(0x1c7)])_0x55b49e[_0x2ea620(0x201)](_0x2ea620(0x1c7),_0x3b4fb5[_0x2ea620(0x1c7)]);const _0x30f022=_0x55b49e[_0x2ea620(0x1ea)](),_0x277f8f=_0x30f022?'/api/attempts?'+_0x30f022:_0x2ea620(0x209),_0x69fa1f=await this[_0x2ea620(0x1d6)][_0x2ea620(0x1f3)](_0x2ea620(0x1fc),_0x277f8f);return{'data':_0x69fa1f[_0x2ea620(0x1d7)]||[],'lastId':_0x69fa1f[_0x2ea620(0x1dc)]};}async[a10_0x2f939d(0x1c5)](_0x49b5c7){const _0x473fb8=a10_0x2f939d;return await this['httpClient'][_0x473fb8(0x1f3)](_0x473fb8(0x1fc),_0x473fb8(0x1e6)+encodeURIComponent(_0x49b5c7));}async[a10_0x2f939d(0x204)](_0x4773f5,_0xd9886c=![]){const _0x1cab74=a10_0x2f939d,_0x43e395=new URLSearchParams();_0xd9886c&&_0x43e395[_0x1cab74(0x201)](_0x1cab74(0x218),_0x1cab74(0x206));const _0x2cd0b0=_0x43e395[_0x1cab74(0x1ea)](),_0xd0e2b6=_0x2cd0b0?_0x1cab74(0x1e6)+encodeURIComponent(_0x4773f5)+_0x1cab74(0x1cb)+_0x2cd0b0:_0x1cab74(0x1e6)+encodeURIComponent(_0x4773f5)+_0x1cab74(0x20a),_0x31013c=await this[_0x1cab74(0x1d6)][_0x1cab74(0x1f3)](_0x1cab74(0x1fc),_0xd0e2b6);return _0x31013c[_0x1cab74(0x1e0)]||[];}async['getTaskLogs'](_0x221558,_0x2077ea,_0x33deb5){const _0x43c254=a10_0x2f939d,_0x338635=new URLSearchParams();_0x33deb5?.['offset']!==undefined&&_0x338635['append']('offset',String(_0x33deb5[_0x43c254(0x1eb)]));_0x33deb5?.[_0x43c254(0x20b)]!==undefined&&_0x338635['append'](_0x43c254(0x20b),String(_0x33deb5[_0x43c254(0x20b)]));const _0x49f55f=_0x338635[_0x43c254(0x1ea)](),_0x391a75=_0x49f55f?_0x43c254(0x1e6)+encodeURIComponent(_0x221558)+_0x43c254(0x1d4)+encodeURIComponent(_0x2077ea)+_0x43c254(0x1d9)+_0x49f55f:'/api/attempts/'+encodeURIComponent(_0x221558)+_0x43c254(0x1d4)+encodeURIComponent(_0x2077ea)+_0x43c254(0x1e4),_0x428136=await this[_0x43c254(0x1d6)][_0x43c254(0x1f3)](_0x43c254(0x1fc),_0x391a75);return _0x428136['logs']||[];}async[a10_0x2f939d(0x20e)](_0x139537,_0x40c485){const _0x536a5e=a10_0x2f939d,_0xde406c=new URLSearchParams();_0x40c485&&_0xde406c[_0x536a5e(0x201)]('task',_0x40c485);const _0x5817f1=_0xde406c['toString'](),_0x5053f7=_0x5817f1?_0x536a5e(0x202)+encodeURIComponent(_0x139537)+_0x536a5e(0x21a)+_0x5817f1:'/api/logs/'+encodeURIComponent(_0x139537)+_0x536a5e(0x1fe),_0x277e36=await this['httpClient'][_0x536a5e(0x1f3)](_0x536a5e(0x1fc),_0x5053f7);return _0x277e36['files']||[];}async['killAttempt'](_0x6ff057,_0x10b0f3){const _0x5e25c5=a10_0x2f939d,_0x52c89a={};return _0x10b0f3&&(_0x52c89a[_0x5e25c5(0x1c4)]=_0x10b0f3),await this['httpClient'][_0x5e25c5(0x1f3)]('POST',_0x5e25c5(0x1e6)+encodeURIComponent(_0x6ff057)+'/kill',{'body':_0x52c89a});}async[a10_0x2f939d(0x203)](_0x1eaa8d,_0x1035e9){const _0xc5bfeb=a10_0x2f939d,_0x3dc893={};return _0x1035e9?.[_0xc5bfeb(0x1c9)]&&(_0x3dc893['from_task']=_0x1035e9[_0xc5bfeb(0x1c9)]),_0x1035e9?.['retry_params']&&(_0x3dc893[_0xc5bfeb(0x1e5)]=_0x1035e9['retry_params']),await this[_0xc5bfeb(0x1d6)][_0xc5bfeb(0x1f3)](_0xc5bfeb(0x1c3),'/api/sessions/'+encodeURIComponent(_0x1eaa8d)+_0xc5bfeb(0x1d3),{'body':_0x3dc893});}async[a10_0x2f939d(0x1d1)](_0x53c4ed,_0x42eb96){const _0x33d845=a10_0x2f939d,_0x167f64={};return _0x42eb96?.['resume_from']&&(_0x167f64[_0x33d845(0x207)]=_0x42eb96[_0x33d845(0x207)]),_0x42eb96?.[_0x33d845(0x1e5)]&&(_0x167f64['retry_params']=_0x42eb96[_0x33d845(0x1e5)]),_0x42eb96?.[_0x33d845(0x1fa)]&&(_0x167f64[_0x33d845(0x1fa)]=_0x42eb96['force']),await this[_0x33d845(0x1d6)][_0x33d845(0x1f3)]('POST','/api/attempts/'+encodeURIComponent(_0x53c4ed)+_0x33d845(0x1d3),{'body':_0x167f64});}async[a10_0x2f939d(0x1f2)](_0x5f1728){const _0x504bbe=a10_0x2f939d,_0x4dd36f={'sessionTime':_0x5f1728[_0x504bbe(0x1ec)],'params':_0x5f1728[_0x504bbe(0x1d5)]};return _0x5f1728['workflowId']&&(_0x4dd36f[_0x504bbe(0x1fd)]=_0x5f1728['workflowId']),_0x5f1728[_0x504bbe(0x208)]&&(_0x4dd36f[_0x504bbe(0x208)]=_0x5f1728['projectName']),_0x5f1728[_0x504bbe(0x210)]&&(_0x4dd36f[_0x504bbe(0x210)]=_0x5f1728['workflowName']),_0x5f1728[_0x504bbe(0x212)]&&(_0x4dd36f[_0x504bbe(0x212)]=_0x5f1728['retryAttemptName']),_0x5f1728[_0x504bbe(0x1d0)]!==undefined&&(_0x4dd36f[_0x504bbe(0x1d0)]=_0x5f1728[_0x504bbe(0x1d0)]),await this[_0x504bbe(0x1d6)][_0x504bbe(0x1f3)](_0x504bbe(0x219),_0x504bbe(0x209),{'body':_0x4dd36f});}async['downloadProjectArchive'](_0x1ce74c,_0x3b6a1d,_0xe96055){const _0x15d2ce=a10_0x2f939d,{promises:_0x156c2b}=await import('fs'),_0xd50444=new URLSearchParams();_0xe96055&&_0xd50444[_0x15d2ce(0x201)](_0x15d2ce(0x1f1),_0xe96055);const _0x264796=_0xd50444['toString'](),_0x3c59a3=_0x264796?'/api/projects/'+encodeURIComponent(_0x1ce74c)+'/archive?'+_0x264796:_0x15d2ce(0x216)+encodeURIComponent(_0x1ce74c)+_0x15d2ce(0x211),_0x2cc741=await this[_0x15d2ce(0x1d6)]['request']('GET',_0x3c59a3,{'headers':{'Accept':'application/gzip'},'responseType':'arraybuffer'});return await _0x156c2b['writeFile'](_0x3b6a1d,_0x2cc741),_0x3b6a1d;}async['uploadProjectArchive'](_0x4e13cb,_0x381a7d,_0x42ad8a,_0x56993b){const _0x408d31=a10_0x2f939d,{promises:_0x3815df}=await import('fs'),_0x3e12b6=new URLSearchParams();_0x3e12b6[_0x408d31(0x201)]('project',_0x4e13cb),_0x3e12b6['append'](_0x408d31(0x1f1),_0x381a7d);_0x56993b?.[_0x408d31(0x1f4)]&&_0x3e12b6[_0x408d31(0x201)](_0x408d31(0x20d),_0x56993b[_0x408d31(0x1f4)]);_0x56993b?.[_0x408d31(0x1f9)]&&_0x56993b[_0x408d31(0x1f9)][_0x408d31(0x1f7)](_0x136674=>{const _0x36371e=_0x408d31;_0x3e12b6[_0x36371e(0x201)](_0x36371e(0x1d2),_0x136674);});_0x56993b?.[_0x408d31(0x205)]&&_0x3e12b6[_0x408d31(0x201)](_0x408d31(0x1df),_0x408d31(0x206));const _0x409e14=_0x3e12b6[_0x408d31(0x1ea)](),_0x2aa7af=_0x408d31(0x1e2)+_0x409e14,_0x1dc261=await _0x3815df[_0x408d31(0x1c2)](_0x42ad8a);return await this[_0x408d31(0x1d6)][_0x408d31(0x1f3)](_0x408d31(0x219),_0x2aa7af,{'body':_0x1dc261,'headers':{'Content-Type':_0x408d31(0x20c)}});}async[a10_0x2f939d(0x1ef)](_0x4c19ea){const _0x3e0856=a10_0x2f939d;return await this[_0x3e0856(0x1d6)][_0x3e0856(0x1f3)](_0x3e0856(0x215),_0x3e0856(0x216)+encodeURIComponent(_0x4c19ea));}}function a10_0x30a3(){const _0x8b902=['DELETE','/api/projects/','/sessions','include_subtasks','PUT','/files?','project_name','from_time','readFile','POST','reason','getAttempt','authHeaders','last_id','include_retried','from_task','1665342naCZAG','/tasks?','project','7498422jHpblj','apiKey','listWorkflows','allowQueueing','retryAttempt','clear_schedule','/retry','/tasks/','params','httpClient','attempts','/api/projects','/logs?','status','/api/workflows','lastId','name','site','clear_schedule_all','tasks','3037966eSofGn','/api/projects?','/api/sessions','/logs','retry_params','/api/attempts/','to_time','name_pattern','workflow_name','toString','offset','sessionTime','13769304onWsGX','projects','deleteProject','3200775vRpOEA','revision','startAttempt','request','scheduleFrom','listAttempts','1856940tMaJAA','forEach','workflows','clearSchedule','force','replace','GET','workflowId','/files','492980ozCfbt','filter','append','/api/logs/','retrySession','getAttemptTasks','clearScheduleAll','true','resume_from','projectName','/api/attempts','/tasks','limit','application/gzip','schedule_from','listLogFiles','5gYRxmD','workflowName','/archive','retryAttemptName','listSessions','workflow'];a10_0x30a3=function(){return _0x8b902;};return a10_0x30a3();}
@@ -1 +1 @@
1
- const a11_0x2fbae0=a11_0x2455;(function(_0x205046,_0x570ad6){const _0x4ebb15=a11_0x2455,_0x795756=_0x205046();while(!![]){try{const _0x3b170c=-parseInt(_0x4ebb15(0x193))/0x1*(-parseInt(_0x4ebb15(0x1a3))/0x2)+-parseInt(_0x4ebb15(0x1af))/0x3+-parseInt(_0x4ebb15(0x1a4))/0x4*(-parseInt(_0x4ebb15(0x191))/0x5)+parseInt(_0x4ebb15(0x19f))/0x6*(parseInt(_0x4ebb15(0x18a))/0x7)+-parseInt(_0x4ebb15(0x1a8))/0x8+-parseInt(_0x4ebb15(0x18d))/0x9*(-parseInt(_0x4ebb15(0x192))/0xa)+parseInt(_0x4ebb15(0x190))/0xb*(-parseInt(_0x4ebb15(0x195))/0xc);if(_0x3b170c===_0x570ad6)break;else _0x795756['push'](_0x795756['shift']());}catch(_0x5e1653){_0x795756['push'](_0x795756['shift']());}}}(a11_0x30df,0xeb806));import{BaseCommand}from'./command.js';function a11_0x2455(_0x4013a9,_0x345d32){const _0x30df45=a11_0x30df();return a11_0x2455=function(_0x2455a2,_0x4a1965){_0x2455a2=_0x2455a2-0x18a;let _0x3cea5f=_0x30df45[_0x2455a2];return _0x3cea5f;},a11_0x2455(_0x4013a9,_0x345d32);}import{SDKError}from'../sdk/index.js';import{handleSDKOutput}from'../utils/command-output.js';import{withSpinner}from'../utils/spinner.js';function a11_0x30df(){const _0x408668=['13713183yYimgW','Error:\x20Child\x20segment\x20name\x20is\x20required\x20for\x20activations','Parent\x20name:\x20','9962722zrhYnI','3071955AFfluj','10xewsqP','90791LnQAaP','site','36ORUdbe','listActivations','length','\x20activation','resolveParentId','verbose','name','data','List\x20activations\x20for\x20a\x20segment','activations','12fnlZMV','Listing\x20activations\x20for\x20segment\x20\x27','Error:\x20','✔\x20Found\x20','30uNBlTE','12huBTaF','message','Usage:\x20tdx\x20activations\x20<parent_name/child_name>','Error:\x20Segment\x20name\x20is\x20required','9191368wOVoQY','\x20\x20Cause:\x20','Site:\x20','Resolved\x20child\x20ID:\x20','description','error','Resolving\x20parent\x20segment\x20\x27','4344888mrrxue','segment','\x27...','5425742tMwXER','Resolving\x20child\x20segment\x20\x27','execute'];a11_0x30df=function(){return _0x408668;};return a11_0x30df();}import{parseSegmentRef}from'../utils/segment-ref-parser.js';export class ActivationsCommand extends BaseCommand{[a11_0x2fbae0(0x19b)]=a11_0x2fbae0(0x19e);[a11_0x2fbae0(0x1ac)]=a11_0x2fbae0(0x19d);async[a11_0x2fbae0(0x18c)](_0x1371ae){const _0x16c1c6=a11_0x2fbae0,{options:_0x141f16,args:_0x515591,tdx:_0x5466f9}=_0x1371ae;if(_0x515591[_0x16c1c6(0x197)]===0x0)return console[_0x16c1c6(0x1ad)](_0x16c1c6(0x1a7)),console[_0x16c1c6(0x1ad)]('Usage:\x20tdx\x20activations\x20<parent_name/child_name>'),0x1;try{const {parentId:_0x30cb74,childId:_0x422256}=parseSegmentRef(_0x515591[0x0]);if(!_0x422256)return console[_0x16c1c6(0x1ad)](_0x16c1c6(0x18e)),console[_0x16c1c6(0x1ad)](_0x16c1c6(0x1a6)),0x1;_0x141f16[_0x16c1c6(0x19a)]&&(console[_0x16c1c6(0x1ad)](_0x16c1c6(0x1aa)+_0x141f16[_0x16c1c6(0x194)]),console[_0x16c1c6(0x1ad)](_0x16c1c6(0x18f)+_0x30cb74),console['error']('Child\x20name:\x20'+_0x422256));const _0x38746e=await withSpinner(_0x16c1c6(0x1ae)+_0x30cb74+_0x16c1c6(0x1b1),()=>_0x5466f9[_0x16c1c6(0x1b0)][_0x16c1c6(0x199)](_0x30cb74),{'verbose':_0x141f16[_0x16c1c6(0x19a)]}),_0x35dcf1=_0x38746e[_0x16c1c6(0x19c)];_0x141f16[_0x16c1c6(0x19a)]&&console['error']('Resolved\x20parent\x20ID:\x20'+_0x35dcf1);const _0x57af6d=await withSpinner(_0x16c1c6(0x18b)+_0x422256+'\x27...',()=>_0x5466f9[_0x16c1c6(0x1b0)]['resolveSegmentId'](_0x35dcf1,_0x422256),{'verbose':_0x141f16['verbose']}),_0xe7fd06=_0x57af6d[_0x16c1c6(0x19c)];_0x141f16[_0x16c1c6(0x19a)]&&console[_0x16c1c6(0x1ad)](_0x16c1c6(0x1ab)+_0xe7fd06);const _0x428da3=await withSpinner(_0x16c1c6(0x1a0)+_0x422256+_0x16c1c6(0x1b1),()=>_0x5466f9['segment'][_0x16c1c6(0x196)](_0x35dcf1,_0xe7fd06),{'verbose':_0x141f16[_0x16c1c6(0x19a)]}),_0x4e7469=_0x428da3[_0x16c1c6(0x19c)];return console[_0x16c1c6(0x1ad)](_0x16c1c6(0x1a2)+_0x4e7469[_0x16c1c6(0x197)]+_0x16c1c6(0x198)+(_0x4e7469[_0x16c1c6(0x197)]!==0x1?'s':'')),await handleSDKOutput(_0x4e7469,_0x141f16),0x0;}catch(_0x1bf3b0){if(_0x1bf3b0 instanceof SDKError)return console[_0x16c1c6(0x1ad)](_0x16c1c6(0x1a1)+_0x1bf3b0[_0x16c1c6(0x1a5)]),_0x1bf3b0['cause']&&console['error'](_0x16c1c6(0x1a9)+_0x1bf3b0['cause']),0x1;throw _0x1bf3b0;}}}
1
+ const a11_0x33a19c=a11_0x2840;(function(_0x623d64,_0x124aff){const _0x5eceb6=a11_0x2840,_0x417aae=_0x623d64();while(!![]){try{const _0x4bf15e=-parseInt(_0x5eceb6(0x1e3))/0x1+-parseInt(_0x5eceb6(0x1de))/0x2*(-parseInt(_0x5eceb6(0x1f0))/0x3)+parseInt(_0x5eceb6(0x1dc))/0x4+parseInt(_0x5eceb6(0x1d7))/0x5*(parseInt(_0x5eceb6(0x1ee))/0x6)+-parseInt(_0x5eceb6(0x1cc))/0x7*(-parseInt(_0x5eceb6(0x1dd))/0x8)+parseInt(_0x5eceb6(0x1da))/0x9+-parseInt(_0x5eceb6(0x1ea))/0xa;if(_0x4bf15e===_0x124aff)break;else _0x417aae['push'](_0x417aae['shift']());}catch(_0x181cab){_0x417aae['push'](_0x417aae['shift']());}}}(a11_0xd1b8,0xf22d7));import{BaseCommand}from'./command.js';function a11_0x2840(_0x2067d4,_0x3183b8){const _0xd1b859=a11_0xd1b8();return a11_0x2840=function(_0x28400f,_0x17c93c){_0x28400f=_0x28400f-0x1cb;let _0x6fe8ba=_0xd1b859[_0x28400f];return _0x6fe8ba;},a11_0x2840(_0x2067d4,_0x3183b8);}import{SDKError}from'../sdk/index.js';function a11_0xd1b8(){const _0xddf84d=['error','Site:\x20','listActivations','resolveSegmentId','Resolved\x20parent\x20ID:\x20','Listing\x20activations\x20for\x20segment\x20\x27','name','description','resolveParentId','cause','5jSekWe','Error:\x20Segment\x20name\x20is\x20required','length','9752193rjSFJE','Child\x20name:\x20','2713432gVwedY','32WGRCFC','2115936xdTRGh','Resolved\x20child\x20ID:\x20','Usage:\x20tdx\x20activations\x20<parent_name/child_name>','message','site','473984TNfOBQ','segment','List\x20activations\x20for\x20a\x20segment','Resolving\x20parent\x20segment\x20\x27','verbose','data','✔\x20Found\x20','29677950bBLEht','\x27...','\x20\x20Cause:\x20','Error:\x20Child\x20segment\x20name\x20is\x20required\x20for\x20activations','9655410fgaktq','Error:\x20','3PubahV','execute','8050nkgyEm'];a11_0xd1b8=function(){return _0xddf84d;};return a11_0xd1b8();}import{handleSDKOutput}from'../utils/command-output.js';import{withSpinner}from'../utils/spinner.js';import{parseSegmentRef}from'../utils/segment-ref-parser.js';export class ActivationsCommand extends BaseCommand{[a11_0x33a19c(0x1d3)]='activations';[a11_0x33a19c(0x1d4)]=a11_0x33a19c(0x1e5);async[a11_0x33a19c(0x1cb)](_0x348c1d){const _0x5c7e8f=a11_0x33a19c,{options:_0x3576b3,args:_0x181a6e,tdx:_0x1c4285}=_0x348c1d;if(_0x181a6e[_0x5c7e8f(0x1d9)]===0x0)return console['error'](_0x5c7e8f(0x1d8)),console[_0x5c7e8f(0x1cd)]('Usage:\x20tdx\x20activations\x20<parent_name/child_name>'),0x1;try{const {parentId:_0x42542c,childId:_0x4ad6b0}=parseSegmentRef(_0x181a6e[0x0]);if(!_0x4ad6b0)return console[_0x5c7e8f(0x1cd)](_0x5c7e8f(0x1ed)),console[_0x5c7e8f(0x1cd)](_0x5c7e8f(0x1e0)),0x1;_0x3576b3[_0x5c7e8f(0x1e7)]&&(console[_0x5c7e8f(0x1cd)](_0x5c7e8f(0x1ce)+_0x3576b3[_0x5c7e8f(0x1e2)]),console['error']('Parent\x20name:\x20'+_0x42542c),console[_0x5c7e8f(0x1cd)](_0x5c7e8f(0x1db)+_0x4ad6b0));const _0x310be4=await withSpinner(_0x5c7e8f(0x1e6)+_0x42542c+_0x5c7e8f(0x1eb),()=>_0x1c4285['segment'][_0x5c7e8f(0x1d5)](_0x42542c),{'verbose':_0x3576b3[_0x5c7e8f(0x1e7)]}),_0x5b0dfd=_0x310be4['data'];_0x3576b3['verbose']&&console[_0x5c7e8f(0x1cd)](_0x5c7e8f(0x1d1)+_0x5b0dfd);const _0x2f02ee=await withSpinner('Resolving\x20child\x20segment\x20\x27'+_0x4ad6b0+'\x27...',()=>_0x1c4285[_0x5c7e8f(0x1e4)][_0x5c7e8f(0x1d0)](_0x5b0dfd,_0x4ad6b0),{'verbose':_0x3576b3[_0x5c7e8f(0x1e7)]}),_0x419492=_0x2f02ee[_0x5c7e8f(0x1e8)];_0x3576b3['verbose']&&console[_0x5c7e8f(0x1cd)](_0x5c7e8f(0x1df)+_0x419492);const _0x24f267=await withSpinner(_0x5c7e8f(0x1d2)+_0x4ad6b0+_0x5c7e8f(0x1eb),()=>_0x1c4285['segment'][_0x5c7e8f(0x1cf)](_0x5b0dfd,_0x419492),{'verbose':_0x3576b3[_0x5c7e8f(0x1e7)]}),_0x1a5328=_0x24f267[_0x5c7e8f(0x1e8)];return console[_0x5c7e8f(0x1cd)](_0x5c7e8f(0x1e9)+_0x1a5328[_0x5c7e8f(0x1d9)]+'\x20activation'+(_0x1a5328[_0x5c7e8f(0x1d9)]!==0x1?'s':'')),await handleSDKOutput(_0x1a5328,_0x3576b3),0x0;}catch(_0xd66bca){if(_0xd66bca instanceof SDKError)return console[_0x5c7e8f(0x1cd)](_0x5c7e8f(0x1ef)+_0xd66bca[_0x5c7e8f(0x1e1)]),_0xd66bca[_0x5c7e8f(0x1d6)]&&console[_0x5c7e8f(0x1cd)](_0x5c7e8f(0x1ec)+_0xd66bca[_0x5c7e8f(0x1d6)]),0x1;throw _0xd66bca;}}}
@@ -1 +1 @@
1
- const a12_0x2115f3=a12_0x5529;function a12_0x5529(_0x392d00,_0x1a5f35){const _0xc956b6=a12_0xc956();return a12_0x5529=function(_0x5529a1,_0x5a48b8){_0x5529a1=_0x5529a1-0xb4;let _0x3d4aea=_0xc956b6[_0x5529a1];return _0x3d4aea;},a12_0x5529(_0x392d00,_0x1a5f35);}(function(_0x17bfa4,_0x2b9c18){const _0x3ddf90=a12_0x5529,_0x4499d8=_0x17bfa4();while(!![]){try{const _0x15da0e=-parseInt(_0x3ddf90(0xc1))/0x1+parseInt(_0x3ddf90(0xe7))/0x2+parseInt(_0x3ddf90(0xc4))/0x3+-parseInt(_0x3ddf90(0xb7))/0x4*(-parseInt(_0x3ddf90(0xd5))/0x5)+parseInt(_0x3ddf90(0xe5))/0x6*(parseInt(_0x3ddf90(0xbb))/0x7)+-parseInt(_0x3ddf90(0xd3))/0x8*(parseInt(_0x3ddf90(0xe4))/0x9)+-parseInt(_0x3ddf90(0xf5))/0xa*(parseInt(_0x3ddf90(0xc0))/0xb);if(_0x15da0e===_0x2b9c18)break;else _0x4499d8['push'](_0x4499d8['shift']());}catch(_0x1043e9){_0x4499d8['push'](_0x4499d8['shift']());}}}(a12_0xc956,0x954a8));import{BaseCommand}from'./command.js';import{RawAPI}from'../sdk/api.js';function a12_0xc956(){const _0x4b67b4=['set-cookie','136XWptxF','length','set-cookie2','x-xsrf-token','33929AkGGrQ','Endpoint\x20is\x20required.\x20Example:\x20tdx\x20api\x20/v3/database/list','request','verbose','proxy-authorization','11xeccHc','800102eMMkrv','Invalid\x20API\x20type:\x20','trim','3273753VcgmVM','Invalid\x20HTTP\x20method:\x20','error','substring','.\x20Valid\x20types:\x20','validate','toLowerCase','Cannot\x20use\x20both\x20--data\x20and\x20--file\x20options.\x20Choose\x20one.','includes','color','trino','x-trino-user','status','authorization','body','11368dnUDYS','noColor','12150XATerb','Header\x20key\x20cannot\x20be\x20empty:\x20\x22','toUpperCase','has','api','type','Error:\x20','entries','PATCH','llm','startsWith','<\x20HTTP/1.1\x20','execute','Invalid\x20header\x20format:\x20\x22','\x22.\x20','4563BRpyCx','1464CBdlPi','join','343014HhSEjL','PUT','file','header','site','headers','stack','cdp','message','DELETE','name','method','Results\x20saved\x20to\x20','Endpoint\x20must\x20start\x20with\x20/:\x20','3960010eyYnlg','GET','data','output','POST'];a12_0xc956=function(){return _0x4b67b4;};return a12_0xc956();}import{colorizeJSON}from'../utils/colors.js';import{writeFileSync}from'fs';import{getEndpoint}from'../types/index.js';import{resolveSite}from'../core/config.js';import{getAuthHeaders}from'../core/auth.js';const SENSITIVE_HEADERS=new Set([a12_0x2115f3(0xd1),a12_0x2115f3(0xbf),'cookie',a12_0x2115f3(0xb6),a12_0x2115f3(0xb9),a12_0x2115f3(0xba),'x-auth-token',a12_0x2115f3(0xcf)]);function isSensitiveHeader(_0x2ec897){const _0x23811f=a12_0x2115f3;return SENSITIVE_HEADERS[_0x23811f(0xd8)](_0x2ec897[_0x23811f(0xca)]());}function parseHeader(_0x396cc9){const _0x2ddb2c=a12_0x2115f3,_0x4dc510=_0x396cc9['indexOf'](':');if(_0x4dc510===-0x1)throw new Error(_0x2ddb2c(0xe2)+_0x396cc9+_0x2ddb2c(0xe3)+'Expected\x20format:\x20\x22Key:\x20Value\x22\x20or\x20\x22Key:Value\x22');const _0x2f71ee=_0x396cc9[_0x2ddb2c(0xc7)](0x0,_0x4dc510)[_0x2ddb2c(0xc3)](),_0xa86953=_0x396cc9[_0x2ddb2c(0xc7)](_0x4dc510+0x1)[_0x2ddb2c(0xc3)]();if(!_0x2f71ee)throw new Error(_0x2ddb2c(0xd6)+_0x396cc9+'\x22');return[_0x2f71ee,_0xa86953];}export class ApiCommand extends BaseCommand{[a12_0x2115f3(0xf1)]=a12_0x2115f3(0xd9);['description']='Make\x20raw\x20HTTP\x20requests\x20to\x20TD\x20APIs';[a12_0x2115f3(0xc9)](_0x1b0e7d){const _0x3b6dab=a12_0x2115f3,{args:_0xc4d1d2,options:_0x16b4f4}=_0x1b0e7d,_0x266077=_0x16b4f4;if(_0xc4d1d2[_0x3b6dab(0xb8)]===0x0)return _0x3b6dab(0xbc);const _0x2ee4a5=_0xc4d1d2[0x0];if(!_0x2ee4a5[_0x3b6dab(0xdf)]('/'))return _0x3b6dab(0xf4)+_0x2ee4a5;const _0x59f4f3=_0x266077[_0x3b6dab(0xf7)],_0x11f423=_0x266077['file'];if(_0x59f4f3&&_0x11f423)return _0x3b6dab(0xcb);const _0x2eda16=_0x266077[_0x3b6dab(0xf2)]||_0x3b6dab(0xf6),_0x4e9fa2=[_0x3b6dab(0xf6),_0x3b6dab(0xb5),_0x3b6dab(0xe8),_0x3b6dab(0xf0),_0x3b6dab(0xdd)];if(!_0x4e9fa2[_0x3b6dab(0xcc)](_0x2eda16['toUpperCase']()))return _0x3b6dab(0xc5)+_0x2eda16+'.\x20Valid\x20methods:\x20'+_0x4e9fa2[_0x3b6dab(0xe6)](',\x20');const _0x5a4745=_0x266077[_0x3b6dab(0xda)]||'td',_0x5b00e0=['td',_0x3b6dab(0xee),'workflow',_0x3b6dab(0xce),_0x3b6dab(0xde)];if(!_0x5b00e0[_0x3b6dab(0xcc)](_0x5a4745))return _0x3b6dab(0xc2)+_0x5a4745+_0x3b6dab(0xc8)+_0x5b00e0[_0x3b6dab(0xe6)](',\x20');return undefined;}async[a12_0x2115f3(0xe1)](_0x30c7c2){const _0x3deca4=a12_0x2115f3,{options:_0x10e5bc,args:_0x2b1086,tdx:_0x3b1d45}=_0x30c7c2,_0xe0b7bf=_0x10e5bc,_0x5b228b=_0x2b1086[0x0],_0x5ba96d=(_0xe0b7bf[_0x3deca4(0xf2)]||'GET')[_0x3deca4(0xd7)](),_0x1230a6=_0xe0b7bf[_0x3deca4(0xf7)],_0x50e508=_0xe0b7bf[_0x3deca4(0xe9)],_0x274ac2=_0xe0b7bf[_0x3deca4(0xea)],_0x59954d=_0xe0b7bf[_0x3deca4(0xda)]||'td';try{const _0x3a05f1={};if(_0x274ac2){const _0x1dce95=Array['isArray'](_0x274ac2)?_0x274ac2:[_0x274ac2];for(const _0x2662fa of _0x1dce95){const [_0x38494e,_0x5cca51]=parseHeader(_0x2662fa);_0x3a05f1[_0x38494e]=_0x5cca51;}}let _0x115cc5;if(_0x1230a6)_0x115cc5=_0x1230a6;else{if(_0x50e508)try{_0x115cc5=RawAPI['readBodyFromFile'](_0x50e508);}catch(_0x245a29){return console[_0x3deca4(0xc6)]('Error:\x20'+(_0x245a29 instanceof Error?_0x245a29['message']:String(_0x245a29))),0x1;}}const _0x157be0={'method':_0x5ba96d,'apiType':_0x59954d,'includeHeaders':_0x10e5bc['verbose']};_0x115cc5&&(_0x157be0[_0x3deca4(0xd2)]=_0x115cc5);Object['keys'](_0x3a05f1)[_0x3deca4(0xb8)]>0x0&&(_0x157be0[_0x3deca4(0xec)]=_0x3a05f1);if(_0x10e5bc['verbose']){const _0x127ba9=resolveSite(_0x10e5bc[_0x3deca4(0xeb)]),_0x4998e2=getEndpoint(_0x127ba9,_0x59954d),_0x2fc172=''+_0x4998e2+_0x5b228b;console['error']('>\x20'+_0x5ba96d+'\x20'+_0x2fc172);const _0x2bd194=getAuthHeaders(_0x127ba9),_0x5c16e9={..._0x2bd194,..._0x3a05f1};for(const [_0xb959d4,_0x2a2e53]of Object[_0x3deca4(0xdc)](_0x5c16e9)){!isSensitiveHeader(_0xb959d4)&&console[_0x3deca4(0xc6)]('>\x20'+_0xb959d4+':\x20'+_0x2a2e53);}_0x115cc5&&console[_0x3deca4(0xc6)]('>'),console[_0x3deca4(0xc6)]('');}const _0x331a06=await _0x3b1d45[_0x3deca4(0xd9)][_0x3deca4(0xbd)](_0x5b228b,_0x157be0);if(_0x10e5bc[_0x3deca4(0xbe)]&&_0x331a06[_0x3deca4(0xec)]){console[_0x3deca4(0xc6)](_0x3deca4(0xe0)+_0x331a06[_0x3deca4(0xd0)]);for(const [_0x543176,_0x568b26]of Object[_0x3deca4(0xdc)](_0x331a06[_0x3deca4(0xec)])){!isSensitiveHeader(_0x543176)&&console[_0x3deca4(0xc6)]('<\x20'+_0x543176+':\x20'+_0x568b26);}console[_0x3deca4(0xc6)]('');}const _0x5698ff=Boolean(_0x10e5bc[_0x3deca4(0xb4)]),_0x523de7={'color':_0x10e5bc['color'],'noColor':_0x10e5bc[_0x3deca4(0xd4)]||_0x5698ff&&!_0x10e5bc[_0x3deca4(0xcd)]},_0x123c59=colorizeJSON(_0x331a06[_0x3deca4(0xf7)],_0x523de7);return _0x10e5bc['output']?(writeFileSync(_0x10e5bc[_0x3deca4(0xb4)],_0x123c59),console['error'](_0x3deca4(0xf3)+_0x10e5bc[_0x3deca4(0xb4)])):console['log'](_0x123c59),0x0;}catch(_0x5bb1a0){return _0x5bb1a0 instanceof Error?(console['error'](_0x3deca4(0xdb)+_0x5bb1a0[_0x3deca4(0xef)]),_0x10e5bc[_0x3deca4(0xbe)]&&_0x5bb1a0[_0x3deca4(0xed)]&&console[_0x3deca4(0xc6)]('\x0aStack\x20trace:\x0a'+_0x5bb1a0['stack'])):console[_0x3deca4(0xc6)](_0x3deca4(0xdb)+String(_0x5bb1a0)),0x1;}}}
1
+ const a12_0x2aed46=a12_0x3c8e;(function(_0x3fbf3e,_0xbfa7ba){const _0x3090db=a12_0x3c8e,_0x3e3531=_0x3fbf3e();while(!![]){try{const _0x11aade=-parseInt(_0x3090db(0x20a))/0x1+-parseInt(_0x3090db(0x20d))/0x2+parseInt(_0x3090db(0x1ed))/0x3*(parseInt(_0x3090db(0x1f0))/0x4)+parseInt(_0x3090db(0x204))/0x5*(parseInt(_0x3090db(0x1eb))/0x6)+parseInt(_0x3090db(0x210))/0x7+-parseInt(_0x3090db(0x1fb))/0x8*(parseInt(_0x3090db(0x206))/0x9)+parseInt(_0x3090db(0x1f1))/0xa*(parseInt(_0x3090db(0x20e))/0xb);if(_0x11aade===_0xbfa7ba)break;else _0x3e3531['push'](_0x3e3531['shift']());}catch(_0x3b4712){_0x3e3531['push'](_0x3e3531['shift']());}}}(a12_0x15cd,0xb4690));import{BaseCommand}from'./command.js';import{RawAPI}from'../sdk/api.js';import{colorizeJSON}from'../utils/colors.js';import{writeFileSync}from'fs';import{getEndpoint}from'../types/index.js';function a12_0x15cd(){const _0x1d3db1=['216501jHtEdz','has','set-cookie','12dwodEq','685310RRpNdb','Endpoint\x20is\x20required.\x20Example:\x20tdx\x20api\x20/v3/database/list','cookie','toUpperCase','x-trino-user','verbose','keys','isArray','headers','length','1423384wybWjk','description','proxy-authorization','header','log','entries','Make\x20raw\x20HTTP\x20requests\x20to\x20TD\x20APIs','Expected\x20format:\x20\x22Key:\x20Value\x22\x20or\x20\x22Key:Value\x22','join','1343535KNOpmj','GET','9ttMUVC','trim','PUT','trino','176115lteHgx','x-xsrf-token','includes','1385896rcoumZ','11vrKpJd','data','2982602YrQJDl','message','body','POST','readBodyFromFile','Error:\x20','Invalid\x20API\x20type:\x20','toLowerCase','site','cdp','type','output','Invalid\x20HTTP\x20method:\x20','Results\x20saved\x20to\x20','\x0aStack\x20trace:\x0a','llm','request','error','method','.\x20Valid\x20methods:\x20','startsWith','status','color','execute','api','stack','file','x-auth-token','substring','\x22.\x20','Invalid\x20header\x20format:\x20\x22','24SfBmiD','workflow'];a12_0x15cd=function(){return _0x1d3db1;};return a12_0x15cd();}import{resolveSite}from'../core/config.js';function a12_0x3c8e(_0xb35df9,_0x3e0107){const _0x15cd61=a12_0x15cd();return a12_0x3c8e=function(_0x3c8e2f,_0x491c88){_0x3c8e2f=_0x3c8e2f-0x1dc;let _0x269a49=_0x15cd61[_0x3c8e2f];return _0x269a49;},a12_0x3c8e(_0xb35df9,_0x3e0107);}import{getAuthHeaders}from'../core/auth.js';const SENSITIVE_HEADERS=new Set(['authorization',a12_0x2aed46(0x1fd),a12_0x2aed46(0x1f3),a12_0x2aed46(0x1ef),'set-cookie2',a12_0x2aed46(0x20b),a12_0x2aed46(0x1e7),a12_0x2aed46(0x1f5)]);function isSensitiveHeader(_0x332a81){const _0x4508f0=a12_0x2aed46;return SENSITIVE_HEADERS[_0x4508f0(0x1ee)](_0x332a81[_0x4508f0(0x217)]());}function parseHeader(_0x665d74){const _0x173637=a12_0x2aed46,_0x4c35f1=_0x665d74['indexOf'](':');if(_0x4c35f1===-0x1)throw new Error(_0x173637(0x1ea)+_0x665d74+_0x173637(0x1e9)+_0x173637(0x202));const _0x1a1deb=_0x665d74[_0x173637(0x1e8)](0x0,_0x4c35f1)[_0x173637(0x207)](),_0x149ad6=_0x665d74[_0x173637(0x1e8)](_0x4c35f1+0x1)[_0x173637(0x207)]();if(!_0x1a1deb)throw new Error('Header\x20key\x20cannot\x20be\x20empty:\x20\x22'+_0x665d74+'\x22');return[_0x1a1deb,_0x149ad6];}export class ApiCommand extends BaseCommand{['name']=a12_0x2aed46(0x1e4);[a12_0x2aed46(0x1fc)]=a12_0x2aed46(0x201);['validate'](_0x7a4a92){const _0x31095d=a12_0x2aed46,{args:_0x559ad6,options:_0x1d39b2}=_0x7a4a92,_0x3fedb4=_0x1d39b2;if(_0x559ad6[_0x31095d(0x1fa)]===0x0)return _0x31095d(0x1f2);const _0x32260f=_0x559ad6[0x0];if(!_0x32260f[_0x31095d(0x1e0)]('/'))return'Endpoint\x20must\x20start\x20with\x20/:\x20'+_0x32260f;const _0x2812e9=_0x3fedb4[_0x31095d(0x20f)],_0x4ffa97=_0x3fedb4[_0x31095d(0x1e6)];if(_0x2812e9&&_0x4ffa97)return'Cannot\x20use\x20both\x20--data\x20and\x20--file\x20options.\x20Choose\x20one.';const _0x599ea5=_0x3fedb4[_0x31095d(0x1de)]||_0x31095d(0x205),_0xb1be9d=[_0x31095d(0x205),_0x31095d(0x213),_0x31095d(0x208),'DELETE','PATCH'];if(!_0xb1be9d[_0x31095d(0x20c)](_0x599ea5[_0x31095d(0x1f4)]()))return _0x31095d(0x21c)+_0x599ea5+_0x31095d(0x1df)+_0xb1be9d['join'](',\x20');const _0x4efc7c=_0x3fedb4[_0x31095d(0x21a)]||'td',_0x41cef3=['td',_0x31095d(0x219),_0x31095d(0x1ec),_0x31095d(0x209),_0x31095d(0x21f)];if(!_0x41cef3[_0x31095d(0x20c)](_0x4efc7c))return _0x31095d(0x216)+_0x4efc7c+'.\x20Valid\x20types:\x20'+_0x41cef3[_0x31095d(0x203)](',\x20');return undefined;}async[a12_0x2aed46(0x1e3)](_0x51f074){const _0x4d788f=a12_0x2aed46,{options:_0x363f76,args:_0xa3609e,tdx:_0x21d835}=_0x51f074,_0x17f5f6=_0x363f76,_0x666862=_0xa3609e[0x0],_0x19aa13=(_0x17f5f6['method']||_0x4d788f(0x205))[_0x4d788f(0x1f4)](),_0x3ed4bc=_0x17f5f6[_0x4d788f(0x20f)],_0x325cd3=_0x17f5f6[_0x4d788f(0x1e6)],_0x5de409=_0x17f5f6[_0x4d788f(0x1fe)],_0x25e474=_0x17f5f6[_0x4d788f(0x21a)]||'td';try{const _0x502849={};if(_0x5de409){const _0x71d9b4=Array[_0x4d788f(0x1f8)](_0x5de409)?_0x5de409:[_0x5de409];for(const _0x443033 of _0x71d9b4){const [_0x1e4364,_0x2af66d]=parseHeader(_0x443033);_0x502849[_0x1e4364]=_0x2af66d;}}let _0x162a14;if(_0x3ed4bc)_0x162a14=_0x3ed4bc;else{if(_0x325cd3)try{_0x162a14=RawAPI[_0x4d788f(0x214)](_0x325cd3);}catch(_0x34a7b3){return console[_0x4d788f(0x1dd)](_0x4d788f(0x215)+(_0x34a7b3 instanceof Error?_0x34a7b3[_0x4d788f(0x211)]:String(_0x34a7b3))),0x1;}}const _0x13267b={'method':_0x19aa13,'apiType':_0x25e474,'includeHeaders':_0x363f76[_0x4d788f(0x1f6)]};_0x162a14&&(_0x13267b[_0x4d788f(0x212)]=_0x162a14);Object[_0x4d788f(0x1f7)](_0x502849)[_0x4d788f(0x1fa)]>0x0&&(_0x13267b[_0x4d788f(0x1f9)]=_0x502849);if(_0x363f76[_0x4d788f(0x1f6)]){const _0x27342f=resolveSite(_0x363f76[_0x4d788f(0x218)]),_0x51a1a0=getEndpoint(_0x27342f,_0x25e474),_0x25f6a0=''+_0x51a1a0+_0x666862;console[_0x4d788f(0x1dd)]('>\x20'+_0x19aa13+'\x20'+_0x25f6a0);const _0x342494=getAuthHeaders(_0x27342f),_0xf724b8={..._0x342494,..._0x502849};for(const [_0x1e4a00,_0x1bc4ef]of Object[_0x4d788f(0x200)](_0xf724b8)){!isSensitiveHeader(_0x1e4a00)&&console[_0x4d788f(0x1dd)]('>\x20'+_0x1e4a00+':\x20'+_0x1bc4ef);}_0x162a14&&console[_0x4d788f(0x1dd)]('>'),console[_0x4d788f(0x1dd)]('');}const _0xedbb0=await _0x21d835[_0x4d788f(0x1e4)][_0x4d788f(0x1dc)](_0x666862,_0x13267b);if(_0x363f76[_0x4d788f(0x1f6)]&&_0xedbb0[_0x4d788f(0x1f9)]){console[_0x4d788f(0x1dd)]('<\x20HTTP/1.1\x20'+_0xedbb0[_0x4d788f(0x1e1)]);for(const [_0x47f9d7,_0x4342fb]of Object[_0x4d788f(0x200)](_0xedbb0[_0x4d788f(0x1f9)])){!isSensitiveHeader(_0x47f9d7)&&console[_0x4d788f(0x1dd)]('<\x20'+_0x47f9d7+':\x20'+_0x4342fb);}console[_0x4d788f(0x1dd)]('');}const _0x488d65=Boolean(_0x363f76[_0x4d788f(0x21b)]),_0x3386cb={'color':_0x363f76[_0x4d788f(0x1e2)],'noColor':_0x363f76['noColor']||_0x488d65&&!_0x363f76[_0x4d788f(0x1e2)]},_0x26dcc5=colorizeJSON(_0xedbb0['data'],_0x3386cb);return _0x363f76[_0x4d788f(0x21b)]?(writeFileSync(_0x363f76[_0x4d788f(0x21b)],_0x26dcc5),console[_0x4d788f(0x1dd)](_0x4d788f(0x21d)+_0x363f76[_0x4d788f(0x21b)])):console[_0x4d788f(0x1ff)](_0x26dcc5),0x0;}catch(_0x52c557){return _0x52c557 instanceof Error?(console[_0x4d788f(0x1dd)](_0x4d788f(0x215)+_0x52c557[_0x4d788f(0x211)]),_0x363f76['verbose']&&_0x52c557[_0x4d788f(0x1e5)]&&console[_0x4d788f(0x1dd)](_0x4d788f(0x21e)+_0x52c557['stack'])):console[_0x4d788f(0x1dd)](_0x4d788f(0x215)+String(_0x52c557)),0x1;}}}
@@ -1 +1 @@
1
- const a13_0x2eaad2=a13_0x4467;(function(_0x3b1a09,_0x130582){const _0x6cf3c3=a13_0x4467,_0xfdc190=_0x3b1a09();while(!![]){try{const _0x266136=-parseInt(_0x6cf3c3(0xa2))/0x1+parseInt(_0x6cf3c3(0xd1))/0x2*(-parseInt(_0x6cf3c3(0xc0))/0x3)+parseInt(_0x6cf3c3(0xcf))/0x4+parseInt(_0x6cf3c3(0xb6))/0x5+-parseInt(_0x6cf3c3(0xb2))/0x6*(parseInt(_0x6cf3c3(0xa7))/0x7)+-parseInt(_0x6cf3c3(0xe5))/0x8*(parseInt(_0x6cf3c3(0xac))/0x9)+parseInt(_0x6cf3c3(0xd7))/0xa;if(_0x266136===_0x130582)break;else _0xfdc190['push'](_0xfdc190['shift']());}catch(_0x215121){_0xfdc190['push'](_0xfdc190['shift']());}}}(a13_0x3e01,0xe2410));import{BaseCommand,printAuthError}from'./command.js';import{saveAPIKeyAsync,resolveSite,resolveAPIKeyAsync}from'../core/config.js';import{saveProfileToUserConfig}from'../core/profile.js';import{getConsoleUrl}from'../types/endpoints.js';import{deleteKeychainAPIKey,isKeychainAvailable}from'../core/keychain.js';import{clearCredentialCache}from'../core/credential-cache.js';import a13_0x2c2bce from'prompts';import{HTTPClientError}from'../client/http-client.js';import{TDX}from'../sdk/index.js';import{LogLevel}from'../utils/tdx-logger.js';import a13_0x1e3024 from'chalk';export class AuthSetupCommand extends BaseCommand{[a13_0x2eaad2(0x9d)]=a13_0x2eaad2(0xb9);[a13_0x2eaad2(0x9e)]='Setup\x20API\x20key\x20authentication\x20interactively';async[a13_0x2eaad2(0xb8)](_0x485dfd){const _0x53fbff=a13_0x2eaad2,{options:_0x3f35fe}=_0x485dfd,_0x33a66c=_0x3f35fe[_0x53fbff(0x99)];console[_0x53fbff(0xcc)](a13_0x1e3024[_0x53fbff(0xa1)](_0x53fbff(0xeb)));const _0x5e2241=_0x3f35fe[_0x53fbff(0xea)]||'us01',_0xc305e1=[{'title':_0x53fbff(0x9a),'value':_0x53fbff(0xb3)},{'title':'jp\x20\x20\x20-\x20Japan','value':_0x53fbff(0xd6)},{'title':'eu\x20\x20\x20-\x20Europe','value':_0x53fbff(0xbc)},{'title':_0x53fbff(0xe2),'value':'ap02'}];let _0x379af8=_0xc305e1['findIndex'](_0x7593a4=>_0x7593a4[_0x53fbff(0xc9)]===_0x5e2241);_0x379af8===-0x1&&_0x5e2241!==_0x53fbff(0xb3)&&(_0xc305e1[_0x53fbff(0xe4)]({'title':_0x5e2241,'value':_0x5e2241}),_0x379af8=_0xc305e1[_0x53fbff(0xc5)]-0x1);_0xc305e1[_0x53fbff(0xe4)]({'title':'Enter\x20custom\x20site','value':'other'});const _0x5e248a=_0x33a66c?'Select\x20your\x20Treasure\x20Data\x20site\x20(for\x20profile:\x20'+_0x33a66c+'):':'Select\x20your\x20Treasure\x20Data\x20site:',_0x370f91=await a13_0x2c2bce({'type':_0x53fbff(0xc6),'name':_0x53fbff(0xea),'message':_0x5e248a,'choices':_0xc305e1,'initial':_0x379af8>=0x0?_0x379af8:0x0});if(!_0x370f91['site'])return console['log'](_0x53fbff(0xe0)),0x1;let _0x45b505;if(_0x370f91['site']===_0x53fbff(0x9c)){const _0x28ad6f=await a13_0x2c2bce({'type':_0x53fbff(0xd9),'name':_0x53fbff(0xae),'message':_0x53fbff(0xa0),'initial':'us01','validate':_0x4eae4d=>{const _0x39569c=_0x53fbff;if(!_0x4eae4d||!_0x4eae4d['trim']())return'Site\x20name\x20cannot\x20be\x20empty';if(!/^[a-z0-9-]+$/['test'](_0x4eae4d[_0x39569c(0xe3)]()))return _0x39569c(0xdc);return!![];}});if(!_0x28ad6f[_0x53fbff(0xae)])return console['log'](_0x53fbff(0xe0)),0x1;_0x45b505=_0x28ad6f['customSite'];}else _0x45b505=_0x370f91[_0x53fbff(0xea)];const _0x107c19=resolveSite(_0x45b505);console[_0x53fbff(0xcc)](_0x53fbff(0xb4)+_0x107c19),console[_0x53fbff(0xcc)](_0x53fbff(0xa3)),console[_0x53fbff(0xcc)]('\x20\x20'+getConsoleUrl(_0x107c19,_0x53fbff(0xbe)));const _0x3bcdef=await a13_0x2c2bce({'type':_0x53fbff(0xb5),'name':_0x53fbff(0xdf),'message':_0x53fbff(0xd2),'validate':_0x4defd3=>{const _0x4d7ed6=_0x53fbff;if(!_0x4defd3||!_0x4defd3[_0x4d7ed6(0xe3)]())return'API\x20key\x20cannot\x20be\x20empty';return!![];}});if(!_0x3bcdef['apiKey'])return console[_0x53fbff(0xcc)](_0x53fbff(0xe0)),0x1;const _0x14f889=_0x3bcdef[_0x53fbff(0xdf)];console[_0x53fbff(0xcc)](_0x53fbff(0xd5));try{const _0x38b7e9=TDX[_0x53fbff(0xe8)]({'site':_0x107c19,'apiKey':_0x14f889[_0x53fbff(0xe3)](),'logLevel':_0x3f35fe[_0x53fbff(0xa4)]??LogLevel[_0x53fbff(0xd0)]}),_0x2cad58=await _0x38b7e9[_0x53fbff(0xbb)][_0x53fbff(0xe7)]();console[_0x53fbff(0xcc)](_0x53fbff(0xe1)+_0x2cad58[_0x53fbff(0xde)]+')');const _0x344601=await isKeychainAvailable();_0x344601?(await saveAPIKeyAsync(_0x14f889[_0x53fbff(0xe3)](),_0x107c19,_0x33a66c),console[_0x53fbff(0xcc)]('✓\x20API\x20key\x20saved\x20to\x20system\x20keychain'+(_0x33a66c?'\x20(profile:\x20'+_0x33a66c+')':''))):(console[_0x53fbff(0x9f)](a13_0x1e3024[_0x53fbff(0xba)](_0x53fbff(0xc4))),console[_0x53fbff(0x9f)](a13_0x1e3024[_0x53fbff(0xba)]('\x20\x20Set\x20TD_API_KEY\x20environment\x20variable\x20for\x20authentication.')));if(_0x33a66c){const _0x57a0ed={'site':_0x107c19};saveProfileToUserConfig(_0x33a66c,_0x57a0ed),console[_0x53fbff(0xcc)](_0x53fbff(0xbd)+_0x33a66c+_0x53fbff(0xd8));}const _0x1502c5=_0x33a66c?_0x53fbff(0xca)+_0x33a66c:'';return console[_0x53fbff(0xcc)](),console[_0x53fbff(0xcc)](_0x53fbff(0xa8)),console[_0x53fbff(0xcc)](_0x53fbff(0xec)+_0x1502c5+_0x53fbff(0xe9)),console[_0x53fbff(0xcc)]('\x20\x20tdx'+_0x1502c5+_0x53fbff(0xbf)),0x0;}catch(_0x100a54){if(_0x100a54 instanceof HTTPClientError&&_0x100a54[_0x53fbff(0xb1)]===0x191)return printAuthError(_0x100a54),0x1;return console[_0x53fbff(0xd3)](a13_0x1e3024['red'](_0x53fbff(0xd4)+(_0x100a54 instanceof Error?_0x100a54[_0x53fbff(0xc1)]:String(_0x100a54)))),console[_0x53fbff(0xd3)]('API\x20key\x20was\x20not\x20saved.\x20Please\x20try\x20again.'),0x1;}}}export class AuthStatusCommand extends BaseCommand{[a13_0x2eaad2(0x9d)]='auth';[a13_0x2eaad2(0x9e)]=a13_0x2eaad2(0xce);async[a13_0x2eaad2(0xb8)](_0x524859){const _0x697d22=a13_0x2eaad2,{options:_0x2ba785,tdx:_0x37afd3}=_0x524859,_0x47711c=_0x2ba785[_0x697d22(0xea)],_0x4dd1f5=_0x2ba785[_0x697d22(0x99)],_0x513f82=_0x4dd1f5?_0x4dd1f5:_0x697d22(0xdd);console['log']('tdx\x20profile:\x20'+_0x513f82+_0x697d22(0xc8)+_0x47711c+')');const _0x33241a=await resolveAPIKeyAsync(_0x47711c,_0x4dd1f5);if(_0x33241a){const {source:_0x4d2836,isDeprecated:_0x7ddd5}=_0x33241a,_0x2e87cf=_0x697d22(0xa6)+_0x4d2836;console[_0x697d22(0xcc)](_0x7ddd5?a13_0x1e3024[_0x697d22(0xba)](_0x2e87cf):_0x2e87cf);}else console[_0x697d22(0xcc)](a13_0x1e3024[_0x697d22(0xba)](_0x697d22(0xdb)));try{const _0x4d5be7=await _0x37afd3['jobs']['getUserInfo']();return console[_0x697d22(0xcc)](a13_0x1e3024[_0x697d22(0xb0)](_0x697d22(0xc2))),console[_0x697d22(0xcc)](_0x697d22(0xab)+_0x4d5be7[_0x697d22(0xde)]),(_0x4d5be7[_0x697d22(0x9b)]||_0x4d5be7['last_name'])&&console[_0x697d22(0xcc)](_0x697d22(0xda)+[_0x4d5be7[_0x697d22(0x9b)],_0x4d5be7[_0x697d22(0xaf)]]['filter'](Boolean)[_0x697d22(0xcd)]('\x20')),0x0;}catch(_0x1ba72c){return _0x1ba72c instanceof HTTPClientError&&_0x1ba72c['status']===0x191?printAuthError(_0x1ba72c,!![],_0x4dd1f5):console[_0x697d22(0xd3)](a13_0x1e3024[_0x697d22(0xa9)](_0x697d22(0xd4)+(_0x1ba72c instanceof Error?_0x1ba72c[_0x697d22(0xc1)]:String(_0x1ba72c)))),0x1;}}}export class AuthClearCommand extends BaseCommand{['name']=a13_0x2eaad2(0xc3);[a13_0x2eaad2(0x9e)]=a13_0x2eaad2(0xe6);async[a13_0x2eaad2(0xb8)](_0x24e849){const _0x77eac3=a13_0x2eaad2,{options:_0x5851fd}=_0x24e849,_0x25f09f=_0x5851fd[_0x77eac3(0x99)];console[_0x77eac3(0xcc)](a13_0x1e3024[_0x77eac3(0xa1)](_0x77eac3(0xaa)));const _0x2d2a6b=await isKeychainAvailable();if(!_0x2d2a6b)return console['error'](a13_0x1e3024[_0x77eac3(0xa9)](_0x77eac3(0xad))),0x1;const _0x3772df=await deleteKeychainAPIKey(_0x25f09f);return _0x3772df?(clearCredentialCache(),console[_0x77eac3(0xcc)](_0x77eac3(0xc7)+(_0x25f09f?_0x77eac3(0xb7)+_0x25f09f+')':'')),0x0):(console[_0x77eac3(0xcc)](_0x77eac3(0xcb)+(_0x25f09f?_0x77eac3(0xa5)+_0x25f09f:'')),0x1);}}function a13_0x4467(_0x3309cc,_0x132968){const _0x3e0141=a13_0x3e01();return a13_0x4467=function(_0x44674b,_0x25aedd){_0x44674b=_0x44674b-0x99;let _0x1fd7f1=_0x3e0141[_0x44674b];return _0x1fd7f1;},a13_0x4467(_0x3309cc,_0x132968);}function a13_0x3e01(){const _0x199a02=['execute','auth:setup','yellow','jobs','eu01','✓\x20Profile\x20\x27','/app/mp/ak','\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases','1953roKAHH','message','✓\x20Authentication\x20successful\x0a','auth:clear','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','length','select','✓\x20API\x20key\x20removed\x20from\x20keychain','\x20(site:\x20','value','\x20--profile\x20','No\x20API\x20key\x20found\x20in\x20keychain','log','join','Show\x20authentication\x20status\x20and\x20validate\x20API\x20key','175852UWFiap','ERROR','3108pzfRuU','Enter\x20your\x20TD\x20API\x20key:','error','✗\x20Validation\x20failed:\x20','Validating\x20API\x20key...','jp01','52965050WhcZdZ','\x27\x20registered','text','Name:\x20','No\x20credential\x20found','Site\x20name\x20must\x20contain\x20only\x20lowercase\x20letters,\x20numbers,\x20and\x20hyphens','N/A','email','apiKey','\x0aSetup\x20cancelled','✓\x20API\x20key\x20is\x20valid\x20(User:\x20','ap02\x20-\x20Korea','trim','push','4156184GJEwDD','Remove\x20API\x20key\x20from\x20system\x20keychain','getUserInfo','create','\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication','site','tdx:\x20auth\x20setup','\x20\x20tdx','profile','us\x20\x20\x20-\x20United\x20States','first_name','other','name','description','warn','Enter\x20site\x20name:','bold','695778IMttlT','You\x20can\x20find\x20your\x20API\x20key\x20at:','logLevel','\x20for\x20profile:\x20','Read\x20credential\x20from\x20','11028164ueNgFG','You\x20can\x20now\x20use\x20tdx\x20commands.\x20Try:','red','tdx:\x20auth\x20clear','User:\x20','27nNyOcj','System\x20keychain\x20is\x20not\x20available','customSite','last_name','green','status','6dIpBNm','us01','Setting\x20up\x20authentication\x20for\x20site:\x20','password','2138605ysoQPZ','\x20(profile:\x20'];a13_0x3e01=function(){return _0x199a02;};return a13_0x3e01();}
1
+ const a13_0x61e6ed=a13_0x1aa6;(function(_0x45e837,_0x16dd38){const _0x5dbff0=a13_0x1aa6,_0x381706=_0x45e837();while(!![]){try{const _0x3e35a5=parseInt(_0x5dbff0(0x203))/0x1+parseInt(_0x5dbff0(0x217))/0x2*(-parseInt(_0x5dbff0(0x21a))/0x3)+-parseInt(_0x5dbff0(0x20b))/0x4+-parseInt(_0x5dbff0(0x204))/0x5+-parseInt(_0x5dbff0(0x1d4))/0x6+-parseInt(_0x5dbff0(0x218))/0x7+parseInt(_0x5dbff0(0x20f))/0x8;if(_0x3e35a5===_0x16dd38)break;else _0x381706['push'](_0x381706['shift']());}catch(_0x55b539){_0x381706['push'](_0x381706['shift']());}}}(a13_0x51d8,0xae134));import{BaseCommand,printAuthError}from'./command.js';import{saveAPIKeyAsync,resolveSite,resolveAPIKeyAsync}from'../core/config.js';import{saveProfileToUserConfig}from'../core/profile.js';function a13_0x51d8(){const _0x4d7d97=['email','✓\x20Profile\x20\x27','\x20(profile:\x20','Enter\x20custom\x20site','ERROR','red','execute','No\x20credential\x20found','/app/mp/ak','tdx:\x20auth\x20setup','ap02','create','418153PsBffj','1956850zhGmoT','N/A','✓\x20API\x20key\x20is\x20valid\x20(User:\x20','Validating\x20API\x20key...','first_name','ap02\x20-\x20Korea','Name:\x20','4755148HnalKW','last_name','description','trim','26185096ZOFmkC','findIndex','join','\x0aSetup\x20cancelled','site','warn','Select\x20your\x20Treasure\x20Data\x20site:','API\x20key\x20cannot\x20be\x20empty','2sMQUXN','1347206qrerQE','us\x20\x20\x20-\x20United\x20States','722391cEVuLY','eu01','logLevel','green','filter','error','message','apiKey','\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases','jp\x20\x20\x20-\x20Japan','value','Enter\x20your\x20TD\x20API\x20key:','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','auth','yellow','5789196ultcZM','You\x20can\x20find\x20your\x20API\x20key\x20at:','\x20(site:\x20','customSite','status','name','test','length','System\x20keychain\x20is\x20not\x20available','API\x20key\x20was\x20not\x20saved.\x20Please\x20try\x20again.','Setup\x20API\x20key\x20authentication\x20interactively','✓\x20API\x20key\x20saved\x20to\x20system\x20keychain','select','Remove\x20API\x20key\x20from\x20system\x20keychain','jobs','other','bold','Site\x20name\x20must\x20contain\x20only\x20lowercase\x20letters,\x20numbers,\x20and\x20hyphens','\x20for\x20profile:\x20','\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication','✗\x20Validation\x20failed:\x20','password','auth:clear','Show\x20authentication\x20status\x20and\x20validate\x20API\x20key','✓\x20API\x20key\x20removed\x20from\x20keychain','eu\x20\x20\x20-\x20Europe','log','getUserInfo','User:\x20','Enter\x20site\x20name:','Site\x20name\x20cannot\x20be\x20empty','us01','tdx:\x20auth\x20clear','push','\x20\x20tdx'];a13_0x51d8=function(){return _0x4d7d97;};return a13_0x51d8();}function a13_0x1aa6(_0x167d8e,_0x5c3b63){const _0x51d875=a13_0x51d8();return a13_0x1aa6=function(_0x1aa6fe,_0x350362){_0x1aa6fe=_0x1aa6fe-0x1cf;let _0x34e2ba=_0x51d875[_0x1aa6fe];return _0x34e2ba;},a13_0x1aa6(_0x167d8e,_0x5c3b63);}import{getConsoleUrl}from'../types/endpoints.js';import{deleteKeychainAPIKey,isKeychainAvailable}from'../core/keychain.js';import{clearCredentialCache}from'../core/credential-cache.js';import a13_0x30ad0f from'prompts';import{HTTPClientError}from'../client/http-client.js';import{TDX}from'../sdk/index.js';import{LogLevel}from'../utils/tdx-logger.js';import a13_0x97d37 from'chalk';export class AuthSetupCommand extends BaseCommand{[a13_0x61e6ed(0x1d9)]='auth:setup';[a13_0x61e6ed(0x20d)]=a13_0x61e6ed(0x1de);async['execute'](_0x53198b){const _0x3e403d=a13_0x61e6ed,{options:_0x5d4c3d}=_0x53198b,_0x5abfff=_0x5d4c3d['profile'];console['log'](a13_0x97d37[_0x3e403d(0x1e4)](_0x3e403d(0x200)));const _0x429fb2=_0x5d4c3d[_0x3e403d(0x213)]||'us01',_0x517f1a=[{'title':_0x3e403d(0x219),'value':_0x3e403d(0x1f3)},{'title':_0x3e403d(0x223),'value':'jp01'},{'title':_0x3e403d(0x1ed),'value':_0x3e403d(0x21b)},{'title':_0x3e403d(0x209),'value':_0x3e403d(0x201)}];let _0x106ac0=_0x517f1a[_0x3e403d(0x210)](_0xb8b4d2=>_0xb8b4d2[_0x3e403d(0x1cf)]===_0x429fb2);_0x106ac0===-0x1&&_0x429fb2!==_0x3e403d(0x1f3)&&(_0x517f1a[_0x3e403d(0x1f5)]({'title':_0x429fb2,'value':_0x429fb2}),_0x106ac0=_0x517f1a[_0x3e403d(0x1db)]-0x1);_0x517f1a[_0x3e403d(0x1f5)]({'title':_0x3e403d(0x1fa),'value':_0x3e403d(0x1e3)});const _0x44e031=_0x5abfff?'Select\x20your\x20Treasure\x20Data\x20site\x20(for\x20profile:\x20'+_0x5abfff+'):':_0x3e403d(0x215),_0xac692=await a13_0x30ad0f({'type':_0x3e403d(0x1e0),'name':'site','message':_0x44e031,'choices':_0x517f1a,'initial':_0x106ac0>=0x0?_0x106ac0:0x0});if(!_0xac692[_0x3e403d(0x213)])return console[_0x3e403d(0x1ee)]('\x0aSetup\x20cancelled'),0x1;let _0x46b1cd;if(_0xac692[_0x3e403d(0x213)]==='other'){const _0x2d83fe=await a13_0x30ad0f({'type':'text','name':_0x3e403d(0x1d7),'message':_0x3e403d(0x1f1),'initial':'us01','validate':_0x325c30=>{const _0x34bc38=_0x3e403d;if(!_0x325c30||!_0x325c30[_0x34bc38(0x20e)]())return _0x34bc38(0x1f2);if(!/^[a-z0-9-]+$/[_0x34bc38(0x1da)](_0x325c30[_0x34bc38(0x20e)]()))return _0x34bc38(0x1e5);return!![];}});if(!_0x2d83fe[_0x3e403d(0x1d7)])return console[_0x3e403d(0x1ee)](_0x3e403d(0x212)),0x1;_0x46b1cd=_0x2d83fe[_0x3e403d(0x1d7)];}else _0x46b1cd=_0xac692['site'];const _0x5019c0=resolveSite(_0x46b1cd);console[_0x3e403d(0x1ee)]('Setting\x20up\x20authentication\x20for\x20site:\x20'+_0x5019c0),console[_0x3e403d(0x1ee)](_0x3e403d(0x1d5)),console['log']('\x20\x20'+getConsoleUrl(_0x5019c0,_0x3e403d(0x1ff)));const _0x11035e=await a13_0x30ad0f({'type':_0x3e403d(0x1e9),'name':'apiKey','message':_0x3e403d(0x1d0),'validate':_0xef486c=>{const _0x360173=_0x3e403d;if(!_0xef486c||!_0xef486c['trim']())return _0x360173(0x216);return!![];}});if(!_0x11035e['apiKey'])return console['log'](_0x3e403d(0x212)),0x1;const _0x21bccd=_0x11035e[_0x3e403d(0x221)];console[_0x3e403d(0x1ee)](_0x3e403d(0x207));try{const _0x2507b8=TDX[_0x3e403d(0x202)]({'site':_0x5019c0,'apiKey':_0x21bccd['trim'](),'logLevel':_0x5d4c3d[_0x3e403d(0x21c)]??LogLevel[_0x3e403d(0x1fb)]}),_0x38f8ac=await _0x2507b8['jobs'][_0x3e403d(0x1ef)]();console[_0x3e403d(0x1ee)](_0x3e403d(0x206)+_0x38f8ac[_0x3e403d(0x1f7)]+')');const _0x28117a=await isKeychainAvailable();_0x28117a?(await saveAPIKeyAsync(_0x21bccd[_0x3e403d(0x20e)](),_0x5019c0,_0x5abfff),console[_0x3e403d(0x1ee)](_0x3e403d(0x1df)+(_0x5abfff?_0x3e403d(0x1f9)+_0x5abfff+')':''))):(console[_0x3e403d(0x214)](a13_0x97d37['yellow'](_0x3e403d(0x1d1))),console[_0x3e403d(0x214)](a13_0x97d37[_0x3e403d(0x1d3)]('\x20\x20Set\x20TD_API_KEY\x20environment\x20variable\x20for\x20authentication.')));if(_0x5abfff){const _0xeebc7c={'site':_0x5019c0};saveProfileToUserConfig(_0x5abfff,_0xeebc7c),console[_0x3e403d(0x1ee)](_0x3e403d(0x1f8)+_0x5abfff+'\x27\x20registered');}const _0x3accbb=_0x5abfff?'\x20--profile\x20'+_0x5abfff:'';return console['log'](),console[_0x3e403d(0x1ee)]('You\x20can\x20now\x20use\x20tdx\x20commands.\x20Try:'),console[_0x3e403d(0x1ee)](_0x3e403d(0x1f6)+_0x3accbb+_0x3e403d(0x1e7)),console[_0x3e403d(0x1ee)](_0x3e403d(0x1f6)+_0x3accbb+_0x3e403d(0x222)),0x0;}catch(_0x2620ce){if(_0x2620ce instanceof HTTPClientError&&_0x2620ce[_0x3e403d(0x1d8)]===0x191)return printAuthError(_0x2620ce),0x1;return console['error'](a13_0x97d37['red'](_0x3e403d(0x1e8)+(_0x2620ce instanceof Error?_0x2620ce[_0x3e403d(0x220)]:String(_0x2620ce)))),console[_0x3e403d(0x21f)](_0x3e403d(0x1dd)),0x1;}}}export class AuthStatusCommand extends BaseCommand{[a13_0x61e6ed(0x1d9)]=a13_0x61e6ed(0x1d2);[a13_0x61e6ed(0x20d)]=a13_0x61e6ed(0x1eb);async['execute'](_0x4e768d){const _0x4d5611=a13_0x61e6ed,{options:_0x57fbd1,tdx:_0xff2042}=_0x4e768d,_0x55341d=_0x57fbd1[_0x4d5611(0x213)],_0xb780ad=_0x57fbd1['profile'],_0x4361ef=_0xb780ad?_0xb780ad:_0x4d5611(0x205);console[_0x4d5611(0x1ee)]('tdx\x20profile:\x20'+_0x4361ef+_0x4d5611(0x1d6)+_0x55341d+')');const _0x22308b=await resolveAPIKeyAsync(_0x55341d,_0xb780ad);if(_0x22308b){const {source:_0x24db6b,isDeprecated:_0x4ebd41}=_0x22308b,_0xa8adf2='Read\x20credential\x20from\x20'+_0x24db6b;console[_0x4d5611(0x1ee)](_0x4ebd41?a13_0x97d37[_0x4d5611(0x1d3)](_0xa8adf2):_0xa8adf2);}else console['log'](a13_0x97d37[_0x4d5611(0x1d3)](_0x4d5611(0x1fe)));try{const _0x41e95c=await _0xff2042[_0x4d5611(0x1e2)][_0x4d5611(0x1ef)]();return console['log'](a13_0x97d37[_0x4d5611(0x21d)]('✓\x20Authentication\x20successful\x0a')),console[_0x4d5611(0x1ee)](_0x4d5611(0x1f0)+_0x41e95c['email']),(_0x41e95c[_0x4d5611(0x208)]||_0x41e95c[_0x4d5611(0x20c)])&&console[_0x4d5611(0x1ee)](_0x4d5611(0x20a)+[_0x41e95c['first_name'],_0x41e95c[_0x4d5611(0x20c)]][_0x4d5611(0x21e)](Boolean)[_0x4d5611(0x211)]('\x20')),0x0;}catch(_0x29357c){return _0x29357c instanceof HTTPClientError&&_0x29357c[_0x4d5611(0x1d8)]===0x191?printAuthError(_0x29357c,!![],_0xb780ad):console[_0x4d5611(0x21f)](a13_0x97d37['red'](_0x4d5611(0x1e8)+(_0x29357c instanceof Error?_0x29357c[_0x4d5611(0x220)]:String(_0x29357c)))),0x1;}}}export class AuthClearCommand extends BaseCommand{[a13_0x61e6ed(0x1d9)]=a13_0x61e6ed(0x1ea);['description']=a13_0x61e6ed(0x1e1);async[a13_0x61e6ed(0x1fd)](_0x3356f2){const _0x33509e=a13_0x61e6ed,{options:_0x341464}=_0x3356f2,_0x545dec=_0x341464['profile'];console[_0x33509e(0x1ee)](a13_0x97d37[_0x33509e(0x1e4)](_0x33509e(0x1f4)));const _0xa07d4a=await isKeychainAvailable();if(!_0xa07d4a)return console['error'](a13_0x97d37[_0x33509e(0x1fc)](_0x33509e(0x1dc))),0x1;const _0x56f10c=await deleteKeychainAPIKey(_0x545dec);return _0x56f10c?(clearCredentialCache(),console[_0x33509e(0x1ee)](_0x33509e(0x1ec)+(_0x545dec?_0x33509e(0x1f9)+_0x545dec+')':'')),0x0):(console[_0x33509e(0x1ee)]('No\x20API\x20key\x20found\x20in\x20keychain'+(_0x545dec?_0x33509e(0x1e6)+_0x545dec:'')),0x1);}}