@treasuredata/tdx 0.4.1 → 0.4.3

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 (104) hide show
  1. package/dist/build-info.json +2 -2
  2. package/dist/cli.js +1 -1
  3. package/dist/cli.js.map +1 -1
  4. package/dist/client/cdp-api-client.js +1 -1
  5. package/dist/client/http-client.js +1 -1
  6. package/dist/client/llm-api-client.d.ts +129 -1
  7. package/dist/client/llm-api-client.d.ts.map +1 -1
  8. package/dist/client/llm-api-client.js +1 -1
  9. package/dist/client/llm-api-client.js.map +1 -1
  10. package/dist/client/rate-limiter.js +1 -1
  11. package/dist/client/td-api-client.js +1 -1
  12. package/dist/client/trino-api-client.js +1 -1
  13. package/dist/client/workflow-client.js +1 -1
  14. package/dist/commands/activations.js +1 -1
  15. package/dist/commands/api-command.js +1 -1
  16. package/dist/commands/auth-command.js +1 -1
  17. package/dist/commands/chat-command.js +1 -1
  18. package/dist/commands/claude-command.js +1 -1
  19. package/dist/commands/command.js +1 -1
  20. package/dist/commands/context-command.js +1 -1
  21. package/dist/commands/databases.js +1 -1
  22. package/dist/commands/describe.js +1 -1
  23. package/dist/commands/job-command.js +1 -1
  24. package/dist/commands/llm-command.d.ts +18 -0
  25. package/dist/commands/llm-command.d.ts.map +1 -1
  26. package/dist/commands/llm-command.js +1 -1
  27. package/dist/commands/llm-command.js.map +1 -1
  28. package/dist/commands/llm-proxy.js +1 -1
  29. package/dist/commands/parent-segment-command.js +1 -1
  30. package/dist/commands/profiles-command.js +1 -1
  31. package/dist/commands/query-command.js +1 -1
  32. package/dist/commands/segment-command.js +1 -1
  33. package/dist/commands/segment-create-command.js +1 -1
  34. package/dist/commands/segment-fields-command.js +1 -1
  35. package/dist/commands/segment-pwd-command.js +1 -1
  36. package/dist/commands/segment-update-command.js +1 -1
  37. package/dist/commands/segment-use-command.js +1 -1
  38. package/dist/commands/segments.js +1 -1
  39. package/dist/commands/show.js +1 -1
  40. package/dist/commands/tables.js +1 -1
  41. package/dist/commands/use-command.js +1 -1
  42. package/dist/commands/workflow-command.js +1 -1
  43. package/dist/core/auth.js +1 -1
  44. package/dist/core/config.js +1 -1
  45. package/dist/core/credential-cache.js +1 -1
  46. package/dist/core/global-context.js +1 -1
  47. package/dist/core/keychain.d.ts +19 -0
  48. package/dist/core/keychain.d.ts.map +1 -1
  49. package/dist/core/keychain.js +1 -1
  50. package/dist/core/keychain.js.map +1 -1
  51. package/dist/core/profile.js +1 -1
  52. package/dist/core/project-config.js +1 -1
  53. package/dist/core/session.js +1 -1
  54. package/dist/index.js +1 -1
  55. package/dist/proxy/anthropic-adapter.js +1 -1
  56. package/dist/proxy/server.js +1 -1
  57. package/dist/proxy/session-cache.js +1 -1
  58. package/dist/sdk/api.js +1 -1
  59. package/dist/sdk/errors.js +1 -1
  60. package/dist/sdk/index.js +1 -1
  61. package/dist/sdk/job.js +1 -1
  62. package/dist/sdk/llm.d.ts +90 -1
  63. package/dist/sdk/llm.d.ts.map +1 -1
  64. package/dist/sdk/llm.js +1 -1
  65. package/dist/sdk/llm.js.map +1 -1
  66. package/dist/sdk/query.js +1 -1
  67. package/dist/sdk/segment.js +1 -1
  68. package/dist/sdk/workflow.js +1 -1
  69. package/dist/types/endpoints.js +1 -1
  70. package/dist/types/index.d.ts +1 -1
  71. package/dist/types/index.d.ts.map +1 -1
  72. package/dist/types/index.js +1 -1
  73. package/dist/types/llm.d.ts +241 -0
  74. package/dist/types/llm.d.ts.map +1 -1
  75. package/dist/utils/agent-ref-parser.js +1 -1
  76. package/dist/utils/chat-cache.js +1 -1
  77. package/dist/utils/colors.js +1 -1
  78. package/dist/utils/command-output.js +1 -1
  79. package/dist/utils/constants.js +1 -1
  80. package/dist/utils/file-permissions.js +1 -1
  81. package/dist/utils/format-detector.js +1 -1
  82. package/dist/utils/formatters.js +1 -1
  83. package/dist/utils/json-loader.js +1 -1
  84. package/dist/utils/llm-backup-utils.d.ts +37 -0
  85. package/dist/utils/llm-backup-utils.d.ts.map +1 -0
  86. package/dist/utils/llm-backup-utils.js +1 -0
  87. package/dist/utils/llm-backup-utils.js.map +1 -0
  88. package/dist/utils/model-aliases.js +1 -1
  89. package/dist/utils/option-validation.js +1 -1
  90. package/dist/utils/port.js +1 -1
  91. package/dist/utils/process.js +1 -1
  92. package/dist/utils/prompt.js +1 -1
  93. package/dist/utils/segment-path-parser.js +1 -1
  94. package/dist/utils/segment-ref-parser.js +1 -1
  95. package/dist/utils/spinner.js +1 -1
  96. package/dist/utils/sql-parser.js +1 -1
  97. package/dist/utils/sse-parser.js +1 -1
  98. package/dist/utils/string-utils.js +1 -1
  99. package/dist/utils/table-ref-parser.js +1 -1
  100. package/dist/utils/tdx-logger.js +1 -1
  101. package/dist/utils/tree-formatter.js +1 -1
  102. package/dist/utils/version-check.js +1 -1
  103. package/dist/utils/workflow-utils.js +1 -1
  104. package/package.json +1 -1
@@ -1 +1 @@
1
- function a7_0x1aac(){const _0x18ccda=['projects','getTaskLogs','sessions','downloadProjectArchive','include_subtasks','workflowId','name','true','last_id','/archive?','getAttemptTasks','/api/attempts','1888116GjjHcC','retry_params','/retry','/files?','/kill','retrySession','PUT','project_id','getAttempt','application/gzip','arraybuffer','name_pattern','from_time','7177554dfzneT','project','listLogFiles','24slbrzp','730586eBYljS','183whYnfL','request','filter','listSessions','/sessions','/api/projects/','sessionTime','deleteProject','forEach','from_task','tasks','reason','workflows','listWorkflows','offset','project_name','append','/api/workflows?','/tasks','authHeaders','schedule_from','29132vkipuL','/api/attempts/','/tasks?','/api/projects','revision','POST','retryAttempt','/api/projects?','lastId','logs','/tasks/','to_time','httpClient','workflow_name','/api/attempts?','workflow','workflowName','clearSchedule','toString','/api/logs/','force','status','limit','/archive','include_retried','11516630JNgOPM','clear_schedule','1YznyFh','task','/api/workflows','projectName','retryAttemptName','scheduleFrom','startAttempt','GET','4822640IKDvbm','/api/sessions','files','replace','resume_from','945133wFXANA','/api/sessions/','allowQueueing','11RwJyNf','site'];a7_0x1aac=function(){return _0x18ccda;};return a7_0x1aac();}function a7_0x9c5e(_0x35ef84,_0x4efaee){const _0x1aac53=a7_0x1aac();return a7_0x9c5e=function(_0x9c5e79,_0x199d5a){_0x9c5e79=_0x9c5e79-0x67;let _0x2f56e7=_0x1aac53[_0x9c5e79];return _0x2f56e7;},a7_0x9c5e(_0x35ef84,_0x4efaee);}const a7_0x57f096=a7_0x9c5e;(function(_0x1e90a7,_0x33323f){const _0x41f3b0=a7_0x9c5e,_0x3fcd43=_0x1e90a7();while(!![]){try{const _0x52afa6=-parseInt(_0x41f3b0(0x90))/0x1*(-parseInt(_0x41f3b0(0xbf))/0x2)+-parseInt(_0x41f3b0(0xc0))/0x3*(-parseInt(_0x41f3b0(0x75))/0x4)+parseInt(_0x41f3b0(0x98))/0x5+parseInt(_0x41f3b0(0xae))/0x6+parseInt(_0x41f3b0(0x9d))/0x7*(parseInt(_0x41f3b0(0xbe))/0x8)+-parseInt(_0x41f3b0(0xbb))/0x9+parseInt(_0x41f3b0(0x8e))/0xa*(-parseInt(_0x41f3b0(0xa0))/0xb);if(_0x52afa6===_0x33323f)break;else _0x3fcd43['push'](_0x3fcd43['shift']());}catch(_0x53043a){_0x3fcd43['push'](_0x3fcd43['shift']());}}}(a7_0x1aac,0x84f92));import{HTTPClient}from'./http-client.js';import{getEndpoint}from'../types/index.js';import{getAuthHeaders,toHeaderRecord}from'../core/auth.js';import{matchGlobPattern}from'../utils/string-utils.js';export class WorkflowApiClient{[a7_0x57f096(0x81)];[a7_0x57f096(0x73)];constructor(_0x373851,_0x13dd82){const _0x15073b=a7_0x57f096,_0x1a4a05=getEndpoint(_0x373851[_0x15073b(0xa1)],_0x15073b(0x84));this[_0x15073b(0x73)]=toHeaderRecord(getAuthHeaders(_0x373851['site'],_0x373851['apiKey'])),this['httpClient']=new HTTPClient(_0x1a4a05,this[_0x15073b(0x73)],_0x13dd82);}async['listProjects'](_0x174a8f){const _0x4e6be0=a7_0x57f096,_0x3f8558=new URLSearchParams();if(_0x174a8f?.[_0x4e6be0(0x8b)])_0x3f8558[_0x4e6be0(0x70)](_0x4e6be0(0x8b),String(_0x174a8f['limit']));if(_0x174a8f?.[_0x4e6be0(0xaa)])_0x3f8558[_0x4e6be0(0x70)](_0x4e6be0(0xaa),_0x174a8f['last_id']);if(_0x174a8f?.[_0x4e6be0(0xb9)]){const _0x461c1f=_0x174a8f[_0x4e6be0(0xb9)][_0x4e6be0(0x9b)](/[*?]/g,'');_0x461c1f&&_0x3f8558[_0x4e6be0(0x70)](_0x4e6be0(0xb9),_0x461c1f);}const _0x5588f5=_0x3f8558[_0x4e6be0(0x87)](),_0x134f9d=_0x5588f5?_0x4e6be0(0x7c)+_0x5588f5:_0x4e6be0(0x78),_0x12c20c=await this[_0x4e6be0(0x81)][_0x4e6be0(0xc1)]('GET',_0x134f9d);let _0x25bffb=_0x12c20c[_0x4e6be0(0xa2)]||[];return _0x174a8f?.[_0x4e6be0(0xb9)]&&(_0x25bffb=_0x25bffb['filter'](_0x39ec61=>{const _0x41cf05=_0x4e6be0;return matchGlobPattern(_0x39ec61[_0x41cf05(0xa8)],_0x174a8f[_0x41cf05(0xb9)]);})),{'data':_0x25bffb,'lastId':_0x12c20c[_0x4e6be0(0x7d)]};}async[a7_0x57f096(0x6d)](_0x77f67b){const _0x507acf=a7_0x57f096,_0x1fc0e7=new URLSearchParams();if(_0x77f67b?.[_0x507acf(0x8b)])_0x1fc0e7[_0x507acf(0x70)](_0x507acf(0x8b),String(_0x77f67b['limit']));if(_0x77f67b?.[_0x507acf(0xaa)])_0x1fc0e7[_0x507acf(0x70)](_0x507acf(0xaa),_0x77f67b[_0x507acf(0xaa)]);if(_0x77f67b?.[_0x507acf(0x6f)]){const _0x19e5e7=_0x77f67b[_0x507acf(0x6f)][_0x507acf(0x9b)](/[*?]/g,'');_0x19e5e7&&(_0x1fc0e7['append']('name_pattern',_0x19e5e7),_0x1fc0e7['append']('search_project_name','true'));}const _0x552261=_0x1fc0e7[_0x507acf(0x87)](),_0x304f1b=_0x552261?_0x507acf(0x71)+_0x552261:_0x507acf(0x92),_0x38bc75=await this[_0x507acf(0x81)][_0x507acf(0xc1)](_0x507acf(0x97),_0x304f1b);let _0x19b129=_0x38bc75[_0x507acf(0x6c)]||[];return _0x77f67b?.['project_name']&&(_0x19b129=_0x19b129[_0x507acf(0xc2)](_0x588df7=>{const _0x418887=_0x507acf,_0x5283be=_0x588df7[_0x418887(0xbc)]?.[_0x418887(0xa8)];if(!_0x5283be)return![];return matchGlobPattern(_0x5283be,_0x77f67b['project_name']);})),{'data':_0x19b129,'lastId':_0x38bc75[_0x507acf(0x7d)]};}async[a7_0x57f096(0xc3)](_0x3daa76){const _0x282728=a7_0x57f096;let _0x3f8648=_0x282728(0x99);_0x3daa76?.[_0x282728(0xb5)]&&(_0x3f8648=_0x282728(0xc5)+encodeURIComponent(_0x3daa76['project_id'])+_0x282728(0xc4));const _0x520e71=new URLSearchParams();if(_0x3daa76?.[_0x282728(0x82)])_0x520e71[_0x282728(0x70)](_0x282728(0x84),_0x3daa76[_0x282728(0x82)]);if(_0x3daa76?.[_0x282728(0x8a)])_0x520e71[_0x282728(0x70)](_0x282728(0x8a),_0x3daa76['status']);if(_0x3daa76?.[_0x282728(0xba)])_0x520e71[_0x282728(0x70)](_0x282728(0xba),_0x3daa76['from_time']);if(_0x3daa76?.['to_time'])_0x520e71[_0x282728(0x70)](_0x282728(0x80),_0x3daa76[_0x282728(0x80)]);if(_0x3daa76?.['limit'])_0x520e71['append'](_0x282728(0x8b),String(_0x3daa76['limit']));if(_0x3daa76?.[_0x282728(0xaa)])_0x520e71[_0x282728(0x70)]('last_id',_0x3daa76['last_id']);const _0x49cfbd=_0x520e71[_0x282728(0x87)]();_0x49cfbd&&(_0x3f8648=_0x3f8648+'?'+_0x49cfbd);const _0x430ad2=await this['httpClient'][_0x282728(0xc1)](_0x282728(0x97),_0x3f8648);return{'data':_0x430ad2[_0x282728(0xa4)]||[],'lastId':_0x430ad2[_0x282728(0x7d)]};}async['listAttempts'](_0x1a8c23){const _0x33d373=a7_0x57f096,_0x3f0bb2=new URLSearchParams();if(_0x1a8c23?.[_0x33d373(0x6f)])_0x3f0bb2[_0x33d373(0x70)](_0x33d373(0xbc),_0x1a8c23[_0x33d373(0x6f)]);if(_0x1a8c23?.[_0x33d373(0x82)])_0x3f0bb2[_0x33d373(0x70)](_0x33d373(0x84),_0x1a8c23[_0x33d373(0x82)]);if(_0x1a8c23?.[_0x33d373(0x8d)])_0x3f0bb2[_0x33d373(0x70)]('include_retried','1');if(_0x1a8c23?.['limit'])_0x3f0bb2['append'](_0x33d373(0x8b),String(_0x1a8c23[_0x33d373(0x8b)]));if(_0x1a8c23?.[_0x33d373(0xaa)])_0x3f0bb2[_0x33d373(0x70)]('last_id',_0x1a8c23[_0x33d373(0xaa)]);const _0x315178=_0x3f0bb2['toString'](),_0x2b8311=_0x315178?_0x33d373(0x83)+_0x315178:_0x33d373(0xad),_0x247d9d=await this[_0x33d373(0x81)][_0x33d373(0xc1)]('GET',_0x2b8311);return{'data':_0x247d9d['attempts']||[],'lastId':_0x247d9d[_0x33d373(0x7d)]};}async[a7_0x57f096(0xb6)](_0x4c74a2){const _0xaa2260=a7_0x57f096;return await this[_0xaa2260(0x81)][_0xaa2260(0xc1)](_0xaa2260(0x97),_0xaa2260(0x76)+encodeURIComponent(_0x4c74a2));}async[a7_0x57f096(0xac)](_0x577704,_0x29c516=![]){const _0x32aef5=a7_0x57f096,_0x1a79ef=new URLSearchParams();_0x29c516&&_0x1a79ef[_0x32aef5(0x70)](_0x32aef5(0xa6),'true');const _0x42b274=_0x1a79ef[_0x32aef5(0x87)](),_0x403a86=_0x42b274?'/api/attempts/'+encodeURIComponent(_0x577704)+_0x32aef5(0x77)+_0x42b274:_0x32aef5(0x76)+encodeURIComponent(_0x577704)+_0x32aef5(0x72),_0x595343=await this['httpClient'][_0x32aef5(0xc1)](_0x32aef5(0x97),_0x403a86);return _0x595343[_0x32aef5(0x6a)]||[];}async[a7_0x57f096(0xa3)](_0xf0c2e4,_0x98bc4a,_0x4404cd){const _0x585d5b=a7_0x57f096,_0x4aa930=new URLSearchParams();_0x4404cd?.[_0x585d5b(0x6e)]!==undefined&&_0x4aa930['append'](_0x585d5b(0x6e),String(_0x4404cd[_0x585d5b(0x6e)]));_0x4404cd?.[_0x585d5b(0x8b)]!==undefined&&_0x4aa930['append'](_0x585d5b(0x8b),String(_0x4404cd[_0x585d5b(0x8b)]));const _0x56803b=_0x4aa930[_0x585d5b(0x87)](),_0xdd2930=_0x56803b?_0x585d5b(0x76)+encodeURIComponent(_0xf0c2e4)+_0x585d5b(0x7f)+encodeURIComponent(_0x98bc4a)+'/logs?'+_0x56803b:_0x585d5b(0x76)+encodeURIComponent(_0xf0c2e4)+_0x585d5b(0x7f)+encodeURIComponent(_0x98bc4a)+'/logs',_0x234b78=await this[_0x585d5b(0x81)][_0x585d5b(0xc1)](_0x585d5b(0x97),_0xdd2930);return _0x234b78[_0x585d5b(0x7e)]||[];}async[a7_0x57f096(0xbd)](_0x3854d5,_0x38fb77){const _0x24fdbe=a7_0x57f096,_0x3e2f33=new URLSearchParams();_0x38fb77&&_0x3e2f33[_0x24fdbe(0x70)](_0x24fdbe(0x91),_0x38fb77);const _0x3bb497=_0x3e2f33[_0x24fdbe(0x87)](),_0x3f2783=_0x3bb497?'/api/logs/'+encodeURIComponent(_0x3854d5)+_0x24fdbe(0xb1)+_0x3bb497:_0x24fdbe(0x88)+encodeURIComponent(_0x3854d5)+'/files',_0x555d8b=await this[_0x24fdbe(0x81)][_0x24fdbe(0xc1)](_0x24fdbe(0x97),_0x3f2783);return _0x555d8b[_0x24fdbe(0x9a)]||[];}async['killAttempt'](_0x767c24,_0x206055){const _0x1932b8=a7_0x57f096,_0x53e871={};return _0x206055&&(_0x53e871[_0x1932b8(0x6b)]=_0x206055),await this['httpClient'][_0x1932b8(0xc1)](_0x1932b8(0x7a),_0x1932b8(0x76)+encodeURIComponent(_0x767c24)+_0x1932b8(0xb2),{'body':_0x53e871});}async[a7_0x57f096(0xb3)](_0x5ba613,_0x4a680c){const _0x1d702e=a7_0x57f096,_0x387caf={};return _0x4a680c?.[_0x1d702e(0x69)]&&(_0x387caf[_0x1d702e(0x69)]=_0x4a680c[_0x1d702e(0x69)]),_0x4a680c?.[_0x1d702e(0xaf)]&&(_0x387caf[_0x1d702e(0xaf)]=_0x4a680c[_0x1d702e(0xaf)]),await this[_0x1d702e(0x81)][_0x1d702e(0xc1)]('POST',_0x1d702e(0x9e)+encodeURIComponent(_0x5ba613)+_0x1d702e(0xb0),{'body':_0x387caf});}async[a7_0x57f096(0x7b)](_0x479d4a,_0x11abb3){const _0x282506=a7_0x57f096,_0x21c597={};return _0x11abb3?.[_0x282506(0x9c)]&&(_0x21c597[_0x282506(0x9c)]=_0x11abb3[_0x282506(0x9c)]),_0x11abb3?.['retry_params']&&(_0x21c597[_0x282506(0xaf)]=_0x11abb3['retry_params']),_0x11abb3?.[_0x282506(0x89)]&&(_0x21c597[_0x282506(0x89)]=_0x11abb3[_0x282506(0x89)]),await this[_0x282506(0x81)][_0x282506(0xc1)](_0x282506(0x7a),_0x282506(0x76)+encodeURIComponent(_0x479d4a)+_0x282506(0xb0),{'body':_0x21c597});}async[a7_0x57f096(0x96)](_0x1e4682){const _0x49eb58=a7_0x57f096,_0x391371={'sessionTime':_0x1e4682[_0x49eb58(0xc6)],'params':_0x1e4682['params']};return _0x1e4682[_0x49eb58(0xa7)]&&(_0x391371['workflowId']=_0x1e4682[_0x49eb58(0xa7)]),_0x1e4682[_0x49eb58(0x93)]&&(_0x391371[_0x49eb58(0x93)]=_0x1e4682[_0x49eb58(0x93)]),_0x1e4682[_0x49eb58(0x85)]&&(_0x391371[_0x49eb58(0x85)]=_0x1e4682[_0x49eb58(0x85)]),_0x1e4682[_0x49eb58(0x94)]&&(_0x391371['retryAttemptName']=_0x1e4682[_0x49eb58(0x94)]),_0x1e4682['allowQueueing']!==undefined&&(_0x391371[_0x49eb58(0x9f)]=_0x1e4682['allowQueueing']),await this[_0x49eb58(0x81)][_0x49eb58(0xc1)]('PUT','/api/attempts',{'body':_0x391371});}async[a7_0x57f096(0xa5)](_0x10fee6,_0x2340d2,_0x139940){const _0x2644de=a7_0x57f096,{promises:_0x259653}=await import('fs'),_0x326275=new URLSearchParams();_0x139940&&_0x326275[_0x2644de(0x70)](_0x2644de(0x79),_0x139940);const _0x172031=_0x326275['toString'](),_0x185fdf=_0x172031?_0x2644de(0xc5)+encodeURIComponent(_0x10fee6)+_0x2644de(0xab)+_0x172031:_0x2644de(0xc5)+encodeURIComponent(_0x10fee6)+_0x2644de(0x8c),_0x17c2ca=await this[_0x2644de(0x81)][_0x2644de(0xc1)](_0x2644de(0x97),_0x185fdf,{'headers':{'Accept':'application/gzip'},'responseType':_0x2644de(0xb8)});return await _0x259653['writeFile'](_0x2340d2,_0x17c2ca),_0x2340d2;}async['uploadProjectArchive'](_0x118aa1,_0x179f50,_0x31f946,_0x428100){const _0x899742=a7_0x57f096,{promises:_0x15e222}=await import('fs'),_0x48a25d=new URLSearchParams();_0x48a25d[_0x899742(0x70)](_0x899742(0xbc),_0x118aa1),_0x48a25d[_0x899742(0x70)]('revision',_0x179f50);_0x428100?.[_0x899742(0x95)]&&_0x48a25d[_0x899742(0x70)](_0x899742(0x74),_0x428100['scheduleFrom']);_0x428100?.[_0x899742(0x86)]&&_0x428100[_0x899742(0x86)][_0x899742(0x68)](_0x4c445d=>{const _0x9a620d=_0x899742;_0x48a25d[_0x9a620d(0x70)](_0x9a620d(0x8f),_0x4c445d);});_0x428100?.['clearScheduleAll']&&_0x48a25d[_0x899742(0x70)]('clear_schedule_all',_0x899742(0xa9));const _0x33017d=_0x48a25d[_0x899742(0x87)](),_0x2861bf=_0x899742(0x7c)+_0x33017d,_0x527910=await _0x15e222['readFile'](_0x31f946);return await this[_0x899742(0x81)][_0x899742(0xc1)](_0x899742(0xb4),_0x2861bf,{'body':_0x527910,'headers':{'Content-Type':_0x899742(0xb7)}});}async[a7_0x57f096(0x67)](_0xf39b14){const _0x42f8b0=a7_0x57f096;return await this[_0x42f8b0(0x81)][_0x42f8b0(0xc1)]('DELETE',_0x42f8b0(0xc5)+encodeURIComponent(_0xf39b14));}}
1
+ const a7_0xbfbd4b=a7_0x4a39;function a7_0x4a39(_0x328f37,_0x27bd1e){const _0x467e82=a7_0x467e();return a7_0x4a39=function(_0x4a39cf,_0x57d663){_0x4a39cf=_0x4a39cf-0x1c0;let _0x36d987=_0x467e82[_0x4a39cf];return _0x36d987;},a7_0x4a39(_0x328f37,_0x27bd1e);}(function(_0x4d5ab0,_0x19d808){const _0x2a14a4=a7_0x4a39,_0x131b41=_0x4d5ab0();while(!![]){try{const _0x1b5445=-parseInt(_0x2a14a4(0x1d5))/0x1+parseInt(_0x2a14a4(0x1c3))/0x2+-parseInt(_0x2a14a4(0x1dc))/0x3*(-parseInt(_0x2a14a4(0x20c))/0x4)+-parseInt(_0x2a14a4(0x21f))/0x5*(-parseInt(_0x2a14a4(0x1ef))/0x6)+parseInt(_0x2a14a4(0x1e6))/0x7*(parseInt(_0x2a14a4(0x208))/0x8)+parseInt(_0x2a14a4(0x1fd))/0x9+-parseInt(_0x2a14a4(0x21d))/0xa;if(_0x1b5445===_0x19d808)break;else _0x131b41['push'](_0x131b41['shift']());}catch(_0x2e4917){_0x131b41['push'](_0x131b41['shift']());}}}(a7_0x467e,0x58dca));import{HTTPClient}from'./http-client.js';import{getEndpoint}from'../types/index.js';import{getAuthHeaders,toHeaderRecord}from'../core/auth.js';function a7_0x467e(){const _0x2bd7bc=['workflowId','8HiTCTE','startAttempt','/api/projects?','listWorkflows','13896PZuOgQ','from_task','true','authHeaders','last_id','sessionTime','/files?','name','/api/projects/','toString','attempts','clearScheduleAll','listSessions','logs','/kill','force','POST','17172620oUwZPm','status','5drUkxB','/api/projects','site','allowQueueing','1058508IDKydj','getTaskLogs','clearSchedule','/tasks','resume_from','workflow_name','clear_schedule','tasks','listAttempts','scheduleFrom','/api/sessions','schedule_from','project','/tasks?','/api/attempts?','from_time','/retry','name_pattern','112864kzqkVT','workflowName','application/gzip','/api/attempts','retryAttemptName','retryAttempt','GET','402IWBCaX','sessions','to_time','deleteProject','getAttemptTasks','apiKey','/api/attempts/','uploadProjectArchive','listProjects','filter','2225937IgXwZN','/archive?','projectName','killAttempt','/api/logs/','revision','append','retry_params','lastId','2565786hYLxWT','/tasks/','writeFile','/api/sessions/','project_id','/sessions','workflows','limit','projects','forEach','arraybuffer','include_subtasks','project_name','clear_schedule_all','4083408YzLnOV','replace','readFile','/files','PUT','include_retried','request','httpClient','/archive','task'];a7_0x467e=function(){return _0x2bd7bc;};return a7_0x467e();}import{matchGlobPattern}from'../utils/string-utils.js';export class WorkflowApiClient{[a7_0xbfbd4b(0x204)];[a7_0xbfbd4b(0x20f)];constructor(_0x55a5f5,_0x4cd131){const _0x5b133c=a7_0xbfbd4b,_0x39ee9d=getEndpoint(_0x55a5f5[_0x5b133c(0x1c1)],'workflow');this[_0x5b133c(0x20f)]=toHeaderRecord(getAuthHeaders(_0x55a5f5[_0x5b133c(0x1c1)],_0x55a5f5[_0x5b133c(0x1e1)])),this[_0x5b133c(0x204)]=new HTTPClient(_0x39ee9d,this[_0x5b133c(0x20f)],_0x4cd131);}async[a7_0xbfbd4b(0x1e4)](_0xc92880){const _0x132b7e=a7_0xbfbd4b,_0x4ed943=new URLSearchParams();if(_0xc92880?.[_0x132b7e(0x1f6)])_0x4ed943[_0x132b7e(0x1ec)](_0x132b7e(0x1f6),String(_0xc92880[_0x132b7e(0x1f6)]));if(_0xc92880?.[_0x132b7e(0x210)])_0x4ed943[_0x132b7e(0x1ec)]('last_id',_0xc92880['last_id']);if(_0xc92880?.[_0x132b7e(0x1d4)]){const _0x1423e6=_0xc92880['name_pattern']['replace'](/[*?]/g,'');_0x1423e6&&_0x4ed943['append'](_0x132b7e(0x1d4),_0x1423e6);}const _0xe23954=_0x4ed943[_0x132b7e(0x215)](),_0x6addbb=_0xe23954?'/api/projects?'+_0xe23954:_0x132b7e(0x1c0),_0x2f871e=await this[_0x132b7e(0x204)][_0x132b7e(0x203)](_0x132b7e(0x1db),_0x6addbb);let _0x50c481=_0x2f871e[_0x132b7e(0x1f7)]||[];return _0xc92880?.[_0x132b7e(0x1d4)]&&(_0x50c481=_0x50c481[_0x132b7e(0x1e5)](_0xcfaf6b=>{const _0x1ce4ae=_0x132b7e;return matchGlobPattern(_0xcfaf6b[_0x1ce4ae(0x213)],_0xc92880[_0x1ce4ae(0x1d4)]);})),{'data':_0x50c481,'lastId':_0x2f871e[_0x132b7e(0x1ee)]};}async[a7_0xbfbd4b(0x20b)](_0x440660){const _0xda5d23=a7_0xbfbd4b,_0x329dfa=new URLSearchParams();if(_0x440660?.[_0xda5d23(0x1f6)])_0x329dfa[_0xda5d23(0x1ec)]('limit',String(_0x440660[_0xda5d23(0x1f6)]));if(_0x440660?.[_0xda5d23(0x210)])_0x329dfa[_0xda5d23(0x1ec)]('last_id',_0x440660['last_id']);if(_0x440660?.[_0xda5d23(0x1fb)]){const _0x3bc8a3=_0x440660[_0xda5d23(0x1fb)][_0xda5d23(0x1fe)](/[*?]/g,'');_0x3bc8a3&&(_0x329dfa['append']('name_pattern',_0x3bc8a3),_0x329dfa['append']('search_project_name',_0xda5d23(0x20e)));}const _0x4b6d09=_0x329dfa[_0xda5d23(0x215)](),_0x179b79=_0x4b6d09?'/api/workflows?'+_0x4b6d09:'/api/workflows',_0x1cd745=await this['httpClient'][_0xda5d23(0x203)]('GET',_0x179b79);let _0x16c03a=_0x1cd745[_0xda5d23(0x1f5)]||[];return _0x440660?.[_0xda5d23(0x1fb)]&&(_0x16c03a=_0x16c03a['filter'](_0x10c1c3=>{const _0x2db5fd=_0xda5d23,_0x53e08e=_0x10c1c3[_0x2db5fd(0x1cf)]?.['name'];if(!_0x53e08e)return![];return matchGlobPattern(_0x53e08e,_0x440660[_0x2db5fd(0x1fb)]);})),{'data':_0x16c03a,'lastId':_0x1cd745[_0xda5d23(0x1ee)]};}async[a7_0xbfbd4b(0x218)](_0x7cb978){const _0x7a1591=a7_0xbfbd4b;let _0xa24d1a=_0x7a1591(0x1cd);_0x7cb978?.[_0x7a1591(0x1f3)]&&(_0xa24d1a=_0x7a1591(0x214)+encodeURIComponent(_0x7cb978['project_id'])+_0x7a1591(0x1f4));const _0xa50a6d=new URLSearchParams();if(_0x7cb978?.['workflow_name'])_0xa50a6d[_0x7a1591(0x1ec)]('workflow',_0x7cb978[_0x7a1591(0x1c8)]);if(_0x7cb978?.[_0x7a1591(0x21e)])_0xa50a6d[_0x7a1591(0x1ec)](_0x7a1591(0x21e),_0x7cb978[_0x7a1591(0x21e)]);if(_0x7cb978?.[_0x7a1591(0x1d2)])_0xa50a6d[_0x7a1591(0x1ec)](_0x7a1591(0x1d2),_0x7cb978['from_time']);if(_0x7cb978?.[_0x7a1591(0x1de)])_0xa50a6d[_0x7a1591(0x1ec)](_0x7a1591(0x1de),_0x7cb978[_0x7a1591(0x1de)]);if(_0x7cb978?.[_0x7a1591(0x1f6)])_0xa50a6d[_0x7a1591(0x1ec)]('limit',String(_0x7cb978[_0x7a1591(0x1f6)]));if(_0x7cb978?.[_0x7a1591(0x210)])_0xa50a6d[_0x7a1591(0x1ec)](_0x7a1591(0x210),_0x7cb978['last_id']);const _0xfa7cec=_0xa50a6d[_0x7a1591(0x215)]();_0xfa7cec&&(_0xa24d1a=_0xa24d1a+'?'+_0xfa7cec);const _0x8480e4=await this['httpClient'][_0x7a1591(0x203)](_0x7a1591(0x1db),_0xa24d1a);return{'data':_0x8480e4[_0x7a1591(0x1dd)]||[],'lastId':_0x8480e4[_0x7a1591(0x1ee)]};}async[a7_0xbfbd4b(0x1cb)](_0x40d0a7){const _0x573d88=a7_0xbfbd4b,_0xb78d65=new URLSearchParams();if(_0x40d0a7?.[_0x573d88(0x1fb)])_0xb78d65[_0x573d88(0x1ec)]('project',_0x40d0a7[_0x573d88(0x1fb)]);if(_0x40d0a7?.[_0x573d88(0x1c8)])_0xb78d65[_0x573d88(0x1ec)]('workflow',_0x40d0a7['workflow_name']);if(_0x40d0a7?.[_0x573d88(0x202)])_0xb78d65[_0x573d88(0x1ec)](_0x573d88(0x202),'1');if(_0x40d0a7?.[_0x573d88(0x1f6)])_0xb78d65[_0x573d88(0x1ec)]('limit',String(_0x40d0a7[_0x573d88(0x1f6)]));if(_0x40d0a7?.[_0x573d88(0x210)])_0xb78d65[_0x573d88(0x1ec)](_0x573d88(0x210),_0x40d0a7[_0x573d88(0x210)]);const _0x2f7a62=_0xb78d65[_0x573d88(0x215)](),_0x21ea5b=_0x2f7a62?_0x573d88(0x1d1)+_0x2f7a62:_0x573d88(0x1d8),_0x984482=await this[_0x573d88(0x204)][_0x573d88(0x203)]('GET',_0x21ea5b);return{'data':_0x984482[_0x573d88(0x216)]||[],'lastId':_0x984482[_0x573d88(0x1ee)]};}async['getAttempt'](_0xa78b16){const _0x592da1=a7_0xbfbd4b;return await this['httpClient'][_0x592da1(0x203)](_0x592da1(0x1db),_0x592da1(0x1e2)+encodeURIComponent(_0xa78b16));}async[a7_0xbfbd4b(0x1e0)](_0x46d952,_0x185cfa=![]){const _0x16aa70=a7_0xbfbd4b,_0x40eb6a=new URLSearchParams();_0x185cfa&&_0x40eb6a[_0x16aa70(0x1ec)](_0x16aa70(0x1fa),_0x16aa70(0x20e));const _0x7e8bf1=_0x40eb6a[_0x16aa70(0x215)](),_0x17471c=_0x7e8bf1?_0x16aa70(0x1e2)+encodeURIComponent(_0x46d952)+_0x16aa70(0x1d0)+_0x7e8bf1:_0x16aa70(0x1e2)+encodeURIComponent(_0x46d952)+_0x16aa70(0x1c6),_0x138fea=await this[_0x16aa70(0x204)][_0x16aa70(0x203)]('GET',_0x17471c);return _0x138fea[_0x16aa70(0x1ca)]||[];}async[a7_0xbfbd4b(0x1c4)](_0x591aa7,_0x552344,_0x19c1df){const _0x1e6ee7=a7_0xbfbd4b,_0x1eaaa2=new URLSearchParams();_0x19c1df?.['offset']!==undefined&&_0x1eaaa2[_0x1e6ee7(0x1ec)]('offset',String(_0x19c1df['offset']));_0x19c1df?.[_0x1e6ee7(0x1f6)]!==undefined&&_0x1eaaa2[_0x1e6ee7(0x1ec)]('limit',String(_0x19c1df['limit']));const _0xcdf33d=_0x1eaaa2['toString'](),_0x47d140=_0xcdf33d?_0x1e6ee7(0x1e2)+encodeURIComponent(_0x591aa7)+_0x1e6ee7(0x1f0)+encodeURIComponent(_0x552344)+'/logs?'+_0xcdf33d:_0x1e6ee7(0x1e2)+encodeURIComponent(_0x591aa7)+'/tasks/'+encodeURIComponent(_0x552344)+'/logs',_0x41005e=await this[_0x1e6ee7(0x204)][_0x1e6ee7(0x203)]('GET',_0x47d140);return _0x41005e[_0x1e6ee7(0x219)]||[];}async['listLogFiles'](_0x3a803c,_0x688521){const _0x18ef79=a7_0xbfbd4b,_0x5aa422=new URLSearchParams();_0x688521&&_0x5aa422[_0x18ef79(0x1ec)](_0x18ef79(0x206),_0x688521);const _0x78aee=_0x5aa422[_0x18ef79(0x215)](),_0x3435cb=_0x78aee?'/api/logs/'+encodeURIComponent(_0x3a803c)+_0x18ef79(0x212)+_0x78aee:_0x18ef79(0x1ea)+encodeURIComponent(_0x3a803c)+_0x18ef79(0x200),_0x140c35=await this[_0x18ef79(0x204)][_0x18ef79(0x203)](_0x18ef79(0x1db),_0x3435cb);return _0x140c35['files']||[];}async[a7_0xbfbd4b(0x1e9)](_0x3f0ad3,_0x114657){const _0x3302ff=a7_0xbfbd4b,_0x3d1a97={};return _0x114657&&(_0x3d1a97['reason']=_0x114657),await this[_0x3302ff(0x204)][_0x3302ff(0x203)](_0x3302ff(0x21c),'/api/attempts/'+encodeURIComponent(_0x3f0ad3)+_0x3302ff(0x21a),{'body':_0x3d1a97});}async['retrySession'](_0x66112e,_0x374aee){const _0x2a3cf4=a7_0xbfbd4b,_0x7405d1={};return _0x374aee?.[_0x2a3cf4(0x20d)]&&(_0x7405d1[_0x2a3cf4(0x20d)]=_0x374aee['from_task']),_0x374aee?.[_0x2a3cf4(0x1ed)]&&(_0x7405d1[_0x2a3cf4(0x1ed)]=_0x374aee[_0x2a3cf4(0x1ed)]),await this[_0x2a3cf4(0x204)][_0x2a3cf4(0x203)](_0x2a3cf4(0x21c),_0x2a3cf4(0x1f2)+encodeURIComponent(_0x66112e)+_0x2a3cf4(0x1d3),{'body':_0x7405d1});}async[a7_0xbfbd4b(0x1da)](_0x2577e5,_0x2a50e7){const _0x495ddb=a7_0xbfbd4b,_0xe3c507={};return _0x2a50e7?.[_0x495ddb(0x1c7)]&&(_0xe3c507[_0x495ddb(0x1c7)]=_0x2a50e7[_0x495ddb(0x1c7)]),_0x2a50e7?.[_0x495ddb(0x1ed)]&&(_0xe3c507['retry_params']=_0x2a50e7['retry_params']),_0x2a50e7?.[_0x495ddb(0x21b)]&&(_0xe3c507[_0x495ddb(0x21b)]=_0x2a50e7['force']),await this[_0x495ddb(0x204)]['request'](_0x495ddb(0x21c),'/api/attempts/'+encodeURIComponent(_0x2577e5)+_0x495ddb(0x1d3),{'body':_0xe3c507});}async[a7_0xbfbd4b(0x209)](_0x1438b7){const _0x2fa390=a7_0xbfbd4b,_0x419d7b={'sessionTime':_0x1438b7[_0x2fa390(0x211)],'params':_0x1438b7['params']};return _0x1438b7[_0x2fa390(0x207)]&&(_0x419d7b[_0x2fa390(0x207)]=_0x1438b7[_0x2fa390(0x207)]),_0x1438b7[_0x2fa390(0x1e8)]&&(_0x419d7b['projectName']=_0x1438b7[_0x2fa390(0x1e8)]),_0x1438b7[_0x2fa390(0x1d6)]&&(_0x419d7b[_0x2fa390(0x1d6)]=_0x1438b7[_0x2fa390(0x1d6)]),_0x1438b7['retryAttemptName']&&(_0x419d7b[_0x2fa390(0x1d9)]=_0x1438b7[_0x2fa390(0x1d9)]),_0x1438b7['allowQueueing']!==undefined&&(_0x419d7b[_0x2fa390(0x1c2)]=_0x1438b7[_0x2fa390(0x1c2)]),await this[_0x2fa390(0x204)][_0x2fa390(0x203)](_0x2fa390(0x201),_0x2fa390(0x1d8),{'body':_0x419d7b});}async['downloadProjectArchive'](_0x247983,_0x5d7f15,_0x6d5f9b){const _0x13269c=a7_0xbfbd4b,{promises:_0x363491}=await import('fs'),_0x291056=new URLSearchParams();_0x6d5f9b&&_0x291056[_0x13269c(0x1ec)](_0x13269c(0x1eb),_0x6d5f9b);const _0x30259d=_0x291056[_0x13269c(0x215)](),_0x21eb36=_0x30259d?_0x13269c(0x214)+encodeURIComponent(_0x247983)+_0x13269c(0x1e7)+_0x30259d:'/api/projects/'+encodeURIComponent(_0x247983)+_0x13269c(0x205),_0x41e1a8=await this[_0x13269c(0x204)][_0x13269c(0x203)]('GET',_0x21eb36,{'headers':{'Accept':_0x13269c(0x1d7)},'responseType':_0x13269c(0x1f9)});return await _0x363491[_0x13269c(0x1f1)](_0x5d7f15,_0x41e1a8),_0x5d7f15;}async[a7_0xbfbd4b(0x1e3)](_0x10331f,_0x54d88b,_0x104891,_0x34edc5){const _0x5a32b8=a7_0xbfbd4b,{promises:_0x4bb3df}=await import('fs'),_0x4b8d4f=new URLSearchParams();_0x4b8d4f[_0x5a32b8(0x1ec)]('project',_0x10331f),_0x4b8d4f[_0x5a32b8(0x1ec)]('revision',_0x54d88b);_0x34edc5?.[_0x5a32b8(0x1cc)]&&_0x4b8d4f['append'](_0x5a32b8(0x1ce),_0x34edc5[_0x5a32b8(0x1cc)]);_0x34edc5?.['clearSchedule']&&_0x34edc5[_0x5a32b8(0x1c5)][_0x5a32b8(0x1f8)](_0x4f06a6=>{const _0x4a346a=_0x5a32b8;_0x4b8d4f[_0x4a346a(0x1ec)](_0x4a346a(0x1c9),_0x4f06a6);});_0x34edc5?.[_0x5a32b8(0x217)]&&_0x4b8d4f[_0x5a32b8(0x1ec)](_0x5a32b8(0x1fc),'true');const _0x101a64=_0x4b8d4f[_0x5a32b8(0x215)](),_0x4f1bb5=_0x5a32b8(0x20a)+_0x101a64,_0x300356=await _0x4bb3df[_0x5a32b8(0x1ff)](_0x104891);return await this[_0x5a32b8(0x204)][_0x5a32b8(0x203)](_0x5a32b8(0x201),_0x4f1bb5,{'body':_0x300356,'headers':{'Content-Type':_0x5a32b8(0x1d7)}});}async[a7_0xbfbd4b(0x1df)](_0x273313){const _0x3aa473=a7_0xbfbd4b;return await this[_0x3aa473(0x204)][_0x3aa473(0x203)]('DELETE',_0x3aa473(0x214)+encodeURIComponent(_0x273313));}}
@@ -1 +1 @@
1
- const a8_0x322a55=a8_0x50e3;(function(_0x394fe0,_0x466ffd){const _0x4759bb=a8_0x50e3,_0x2fea29=_0x394fe0();while(!![]){try{const _0x3f2dad=-parseInt(_0x4759bb(0x8b))/0x1+parseInt(_0x4759bb(0x9b))/0x2+parseInt(_0x4759bb(0x8f))/0x3+-parseInt(_0x4759bb(0x8a))/0x4*(-parseInt(_0x4759bb(0x99))/0x5)+parseInt(_0x4759bb(0xa2))/0x6+parseInt(_0x4759bb(0xa5))/0x7+-parseInt(_0x4759bb(0x94))/0x8*(parseInt(_0x4759bb(0x87))/0x9);if(_0x3f2dad===_0x466ffd)break;else _0x2fea29['push'](_0x2fea29['shift']());}catch(_0x2baaf2){_0x2fea29['push'](_0x2fea29['shift']());}}}(a8_0x50fb,0xbbc3b));function a8_0x50fb(){const _0xd6c361=['Error:\x20','\x20\x20Cause:\x20','Error:\x20Segment\x20name\x20is\x20required','540117ZlFFza','cause','✔\x20Found\x20','780YbySsy','1074478bJVSIP','Child\x20name:\x20','Resolved\x20parent\x20ID:\x20','message','4153488ANmmda','List\x20activations\x20for\x20a\x20segment','segment','\x27...','Site:\x20','376vUcamb','verbose','activations','resolveParentId','length','27805kWfrng','Resolving\x20parent\x20segment\x20\x27','2543556jaUEcp','execute','\x20activation','Usage:\x20tdx\x20activations\x20<parent_name/child_name>','listActivations','error','resolveSegmentId','2505936bapDtt','Resolving\x20child\x20segment\x20\x27','data','3540929lBqqrm'];a8_0x50fb=function(){return _0xd6c361;};return a8_0x50fb();}import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';import{handleSDKOutput}from'../utils/command-output.js';function a8_0x50e3(_0x13372a,_0x47de43){const _0x50fb6b=a8_0x50fb();return a8_0x50e3=function(_0x50e363,_0x3c1f1e){_0x50e363=_0x50e363-0x86;let _0x39b9fe=_0x50fb6b[_0x50e363];return _0x39b9fe;},a8_0x50e3(_0x13372a,_0x47de43);}import{withSpinner}from'../utils/spinner.js';import{parseSegmentRef}from'../utils/segment-ref-parser.js';export class ActivationsCommand extends BaseCommand{['name']=a8_0x322a55(0x96);['description']=a8_0x322a55(0x90);async[a8_0x322a55(0x9c)](_0x34fa27){const _0x456392=a8_0x322a55,{options:_0x14352b,args:_0x401eaa,tdx:_0x2bf72a}=_0x34fa27;if(_0x401eaa[_0x456392(0x98)]===0x0)return console['error'](_0x456392(0x86)),console[_0x456392(0xa0)](_0x456392(0x9e)),0x1;try{const {parentId:_0x264a85,childId:_0x1b4733}=parseSegmentRef(_0x401eaa[0x0]);if(!_0x1b4733)return console['error']('Error:\x20Child\x20segment\x20name\x20is\x20required\x20for\x20activations'),console[_0x456392(0xa0)](_0x456392(0x9e)),0x1;_0x14352b[_0x456392(0x95)]&&(console[_0x456392(0xa0)](_0x456392(0x93)+_0x14352b['site']),console[_0x456392(0xa0)]('Parent\x20name:\x20'+_0x264a85),console[_0x456392(0xa0)](_0x456392(0x8c)+_0x1b4733));const _0x57f9c8=await withSpinner(_0x456392(0x9a)+_0x264a85+_0x456392(0x92),()=>_0x2bf72a[_0x456392(0x91)][_0x456392(0x97)](_0x264a85),{'verbose':_0x14352b[_0x456392(0x95)]}),_0x44bf20=_0x57f9c8[_0x456392(0xa4)];_0x14352b[_0x456392(0x95)]&&console[_0x456392(0xa0)](_0x456392(0x8d)+_0x44bf20);const _0x3bdb03=await withSpinner(_0x456392(0xa3)+_0x1b4733+_0x456392(0x92),()=>_0x2bf72a[_0x456392(0x91)][_0x456392(0xa1)](_0x44bf20,_0x1b4733),{'verbose':_0x14352b[_0x456392(0x95)]}),_0x1b25be=_0x3bdb03[_0x456392(0xa4)];_0x14352b[_0x456392(0x95)]&&console[_0x456392(0xa0)]('Resolved\x20child\x20ID:\x20'+_0x1b25be);const _0x1904ea=await withSpinner('Listing\x20activations\x20for\x20segment\x20\x27'+_0x1b4733+'\x27...',()=>_0x2bf72a[_0x456392(0x91)][_0x456392(0x9f)](_0x44bf20,_0x1b25be),{'verbose':_0x14352b['verbose']}),_0x4a7d7f=_0x1904ea[_0x456392(0xa4)];return console['error'](_0x456392(0x89)+_0x4a7d7f[_0x456392(0x98)]+_0x456392(0x9d)+(_0x4a7d7f['length']!==0x1?'s':'')),await handleSDKOutput(_0x4a7d7f,_0x14352b),0x0;}catch(_0x50365a){if(_0x50365a instanceof SDKError)return console[_0x456392(0xa0)](_0x456392(0xa6)+_0x50365a[_0x456392(0x8e)]),_0x50365a[_0x456392(0x88)]&&console['error'](_0x456392(0xa7)+_0x50365a[_0x456392(0x88)]),0x1;throw _0x50365a;}}}
1
+ function a8_0x27bf(){const _0x39ba11=['Resolved\x20child\x20ID:\x20','Parent\x20name:\x20','Error:\x20Child\x20segment\x20name\x20is\x20required\x20for\x20activations','Site:\x20','Usage:\x20tdx\x20activations\x20<parent_name/child_name>','data','2708YrPjSq','message','516424TwAbXO','listActivations','50UNocIO','\x27...','6FVlHVj','List\x20activations\x20for\x20a\x20segment','189647tovFtI','resolveSegmentId','error','821282TAsRyo','Error:\x20','1886832mcJfgV','67086sgdYrg','Listing\x20activations\x20for\x20segment\x20\x27','activations','segment','21WbSadb','1366824AgKcyF','Error:\x20Segment\x20name\x20is\x20required','description','verbose','Resolved\x20parent\x20ID:\x20','length','Resolving\x20child\x20segment\x20\x27','✔\x20Found\x20','Child\x20name:\x20','name','1635ofNTWp','resolveParentId','cause'];a8_0x27bf=function(){return _0x39ba11;};return a8_0x27bf();}const a8_0x2705b0=a8_0x34ad;function a8_0x34ad(_0xed4084,_0x25d359){const _0x27bf05=a8_0x27bf();return a8_0x34ad=function(_0x34adec,_0x32d015){_0x34adec=_0x34adec-0xc4;let _0x2ab136=_0x27bf05[_0x34adec];return _0x2ab136;},a8_0x34ad(_0xed4084,_0x25d359);}(function(_0x330ea2,_0x1bc32f){const _0x310d1e=a8_0x34ad,_0x2c252a=_0x330ea2();while(!![]){try{const _0x5b2b88=-parseInt(_0x310d1e(0xcf))/0x1+-parseInt(_0x310d1e(0xd5))/0x2*(parseInt(_0x310d1e(0xcd))/0x3)+parseInt(_0x310d1e(0xc7))/0x4*(parseInt(_0x310d1e(0xe4))/0x5)+-parseInt(_0x310d1e(0xda))/0x6+-parseInt(_0x310d1e(0xd9))/0x7*(parseInt(_0x310d1e(0xc9))/0x8)+parseInt(_0x310d1e(0xd4))/0x9+-parseInt(_0x310d1e(0xcb))/0xa*(-parseInt(_0x310d1e(0xd2))/0xb);if(_0x5b2b88===_0x1bc32f)break;else _0x2c252a['push'](_0x2c252a['shift']());}catch(_0xe918){_0x2c252a['push'](_0x2c252a['shift']());}}}(a8_0x27bf,0x1ecbd));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';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{[a8_0x2705b0(0xe3)]=a8_0x2705b0(0xd7);[a8_0x2705b0(0xdc)]=a8_0x2705b0(0xce);async['execute'](_0x27a29e){const _0x5e635e=a8_0x2705b0,{options:_0x5d0500,args:_0xe8c635,tdx:_0x8ee9a}=_0x27a29e;if(_0xe8c635[_0x5e635e(0xdf)]===0x0)return console[_0x5e635e(0xd1)](_0x5e635e(0xdb)),console['error'](_0x5e635e(0xc5)),0x1;try{const {parentId:_0x40bf19,childId:_0x1d5602}=parseSegmentRef(_0xe8c635[0x0]);if(!_0x1d5602)return console['error'](_0x5e635e(0xe9)),console[_0x5e635e(0xd1)](_0x5e635e(0xc5)),0x1;_0x5d0500[_0x5e635e(0xdd)]&&(console[_0x5e635e(0xd1)](_0x5e635e(0xc4)+_0x5d0500['site']),console[_0x5e635e(0xd1)](_0x5e635e(0xe8)+_0x40bf19),console[_0x5e635e(0xd1)](_0x5e635e(0xe2)+_0x1d5602));const _0x217550=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x40bf19+_0x5e635e(0xcc),()=>_0x8ee9a[_0x5e635e(0xd8)][_0x5e635e(0xe5)](_0x40bf19),{'verbose':_0x5d0500[_0x5e635e(0xdd)]}),_0x51a1eb=_0x217550[_0x5e635e(0xc6)];_0x5d0500[_0x5e635e(0xdd)]&&console[_0x5e635e(0xd1)](_0x5e635e(0xde)+_0x51a1eb);const _0x42232f=await withSpinner(_0x5e635e(0xe0)+_0x1d5602+'\x27...',()=>_0x8ee9a[_0x5e635e(0xd8)][_0x5e635e(0xd0)](_0x51a1eb,_0x1d5602),{'verbose':_0x5d0500[_0x5e635e(0xdd)]}),_0x56d0ad=_0x42232f[_0x5e635e(0xc6)];_0x5d0500[_0x5e635e(0xdd)]&&console[_0x5e635e(0xd1)](_0x5e635e(0xe7)+_0x56d0ad);const _0x5cd007=await withSpinner(_0x5e635e(0xd6)+_0x1d5602+'\x27...',()=>_0x8ee9a[_0x5e635e(0xd8)][_0x5e635e(0xca)](_0x51a1eb,_0x56d0ad),{'verbose':_0x5d0500['verbose']}),_0x529a3d=_0x5cd007[_0x5e635e(0xc6)];return console[_0x5e635e(0xd1)](_0x5e635e(0xe1)+_0x529a3d[_0x5e635e(0xdf)]+'\x20activation'+(_0x529a3d[_0x5e635e(0xdf)]!==0x1?'s':'')),await handleSDKOutput(_0x529a3d,_0x5d0500),0x0;}catch(_0xd15fce){if(_0xd15fce instanceof SDKError)return console[_0x5e635e(0xd1)](_0x5e635e(0xd3)+_0xd15fce[_0x5e635e(0xc8)]),_0xd15fce[_0x5e635e(0xe6)]&&console[_0x5e635e(0xd1)]('\x20\x20Cause:\x20'+_0xd15fce[_0x5e635e(0xe6)]),0x1;throw _0xd15fce;}}}
@@ -1 +1 @@
1
- const a9_0x2c8ddb=a9_0x172b;(function(_0x72ef09,_0x54757e){const _0x249dd9=a9_0x172b,_0x7530a3=_0x72ef09();while(!![]){try{const _0x50580b=-parseInt(_0x249dd9(0xd9))/0x1+parseInt(_0x249dd9(0xde))/0x2*(-parseInt(_0x249dd9(0xf5))/0x3)+-parseInt(_0x249dd9(0xfc))/0x4+parseInt(_0x249dd9(0xf3))/0x5*(-parseInt(_0x249dd9(0xc8))/0x6)+-parseInt(_0x249dd9(0xf9))/0x7+-parseInt(_0x249dd9(0xe6))/0x8+parseInt(_0x249dd9(0xeb))/0x9;if(_0x50580b===_0x54757e)break;else _0x7530a3['push'](_0x7530a3['shift']());}catch(_0xc1e8c3){_0x7530a3['push'](_0x7530a3['shift']());}}}(a9_0x4610,0x7ed4d));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';import{resolveSite}from'../core/config.js';import{getAuthHeaders}from'../core/auth.js';const SENSITIVE_HEADERS=new Set([a9_0x2c8ddb(0xcb),'proxy-authorization',a9_0x2c8ddb(0xff),a9_0x2c8ddb(0xee),a9_0x2c8ddb(0x103),'x-xsrf-token',a9_0x2c8ddb(0xea),a9_0x2c8ddb(0xf0)]);function a9_0x4610(){const _0x25d0dd=['Make\x20raw\x20HTTP\x20requests\x20to\x20TD\x20APIs','file','x-auth-token','22186404LxGyBI','readBodyFromFile','name','set-cookie','GET','x-trino-user','trino','keys','10TvwgPv','color','248667wSjCgX','trim','cdp','execute','611198yOFWNL','log','site','2217048qvphtz','Results\x20saved\x20to\x20','error','cookie','headers','<\x20HTTP/1.1\x20','body','set-cookie2','POST','stack','Endpoint\x20must\x20start\x20with\x20/:\x20','method','entries','180066HXWpXU','Endpoint\x20is\x20required.\x20Example:\x20tdx\x20api\x20/v3/database/list','has','authorization','verbose','\x0aStack\x20trace:\x0a','.\x20Valid\x20methods:\x20','Invalid\x20API\x20type:\x20','output','workflow','status','Cannot\x20use\x20both\x20--data\x20and\x20--file\x20options.\x20Choose\x20one.','message','type','llm','data','Header\x20key\x20cannot\x20be\x20empty:\x20\x22','126956YwGJvO','\x22.\x20','Error:\x20','toUpperCase','Expected\x20format:\x20\x22Key:\x20Value\x22\x20or\x20\x22Key:Value\x22','6pDGVsz','description','validate','Invalid\x20HTTP\x20method:\x20','isArray','length','PUT','.\x20Valid\x20types:\x20','6947472HXDyDg','substring'];a9_0x4610=function(){return _0x25d0dd;};return a9_0x4610();}function isSensitiveHeader(_0x319ffe){const _0x43dede=a9_0x2c8ddb;return SENSITIVE_HEADERS[_0x43dede(0xca)](_0x319ffe['toLowerCase']());}function a9_0x172b(_0x510e6a,_0x534aab){const _0x46101d=a9_0x4610();return a9_0x172b=function(_0x172bce,_0x2ab726){_0x172bce=_0x172bce-0xc5;let _0x25c073=_0x46101d[_0x172bce];return _0x25c073;},a9_0x172b(_0x510e6a,_0x534aab);}function parseHeader(_0xa023e3){const _0x542bd1=a9_0x2c8ddb,_0x4ac97e=_0xa023e3['indexOf'](':');if(_0x4ac97e===-0x1)throw new Error('Invalid\x20header\x20format:\x20\x22'+_0xa023e3+_0x542bd1(0xda)+_0x542bd1(0xdd));const _0x4d4bc5=_0xa023e3[_0x542bd1(0xe7)](0x0,_0x4ac97e)['trim'](),_0x4c243f=_0xa023e3['substring'](_0x4ac97e+0x1)[_0x542bd1(0xf6)]();if(!_0x4d4bc5)throw new Error(_0x542bd1(0xd8)+_0xa023e3+'\x22');return[_0x4d4bc5,_0x4c243f];}export class ApiCommand extends BaseCommand{[a9_0x2c8ddb(0xed)]='api';[a9_0x2c8ddb(0xdf)]=a9_0x2c8ddb(0xe8);[a9_0x2c8ddb(0xe0)](_0x471012){const _0xd7ecc=a9_0x2c8ddb,{args:_0x13923b,options:_0xf38944}=_0x471012,_0x17eb94=_0xf38944;if(_0x13923b[_0xd7ecc(0xe3)]===0x0)return _0xd7ecc(0xc9);const _0x17c81d=_0x13923b[0x0];if(!_0x17c81d['startsWith']('/'))return _0xd7ecc(0xc5)+_0x17c81d;const _0x59a827=_0x17eb94[_0xd7ecc(0xd7)],_0x37e8fb=_0x17eb94['file'];if(_0x59a827&&_0x37e8fb)return _0xd7ecc(0xd3);const _0x26a334=_0x17eb94['method']||_0xd7ecc(0xef),_0x215500=[_0xd7ecc(0xef),_0xd7ecc(0x104),_0xd7ecc(0xe4),'DELETE','PATCH'];if(!_0x215500['includes'](_0x26a334['toUpperCase']()))return _0xd7ecc(0xe1)+_0x26a334+_0xd7ecc(0xce)+_0x215500['join'](',\x20');const _0x3f403f=_0x17eb94[_0xd7ecc(0xd5)]||'td',_0x30848e=['td',_0xd7ecc(0xf7),_0xd7ecc(0xd1),_0xd7ecc(0xf1),_0xd7ecc(0xd6)];if(!_0x30848e['includes'](_0x3f403f))return _0xd7ecc(0xcf)+_0x3f403f+_0xd7ecc(0xe5)+_0x30848e['join'](',\x20');return undefined;}async[a9_0x2c8ddb(0xf8)](_0x1ae41b){const _0x1ff898=a9_0x2c8ddb,{options:_0x487f36,args:_0x393258,tdx:_0x200c2e}=_0x1ae41b,_0x29d440=_0x487f36,_0x12f6e5=_0x393258[0x0],_0x5269c6=(_0x29d440[_0x1ff898(0xc6)]||'GET')[_0x1ff898(0xdc)](),_0x6e3644=_0x29d440['data'],_0x4a518d=_0x29d440[_0x1ff898(0xe9)],_0x46e859=_0x29d440['header'],_0xd45024=_0x29d440[_0x1ff898(0xd5)]||'td';try{const _0x5b49b1={};if(_0x46e859){const _0x5a66ff=Array[_0x1ff898(0xe2)](_0x46e859)?_0x46e859:[_0x46e859];for(const _0x58ca97 of _0x5a66ff){const [_0x394dad,_0x555ea5]=parseHeader(_0x58ca97);_0x5b49b1[_0x394dad]=_0x555ea5;}}let _0x53a8e7;if(_0x6e3644)_0x53a8e7=_0x6e3644;else{if(_0x4a518d)try{_0x53a8e7=RawAPI[_0x1ff898(0xec)](_0x4a518d);}catch(_0x932b28){return console[_0x1ff898(0xfe)]('Error:\x20'+(_0x932b28 instanceof Error?_0x932b28[_0x1ff898(0xd4)]:String(_0x932b28))),0x1;}}const _0x3287ef={'method':_0x5269c6,'apiType':_0xd45024,'includeHeaders':_0x487f36[_0x1ff898(0xcc)]};_0x53a8e7&&(_0x3287ef[_0x1ff898(0x102)]=_0x53a8e7);Object[_0x1ff898(0xf2)](_0x5b49b1)['length']>0x0&&(_0x3287ef[_0x1ff898(0x100)]=_0x5b49b1);if(_0x487f36[_0x1ff898(0xcc)]){const _0x515ab2=resolveSite(_0x487f36[_0x1ff898(0xfb)]),_0x223619=getEndpoint(_0x515ab2,_0xd45024),_0x58e57d=''+_0x223619+_0x12f6e5;console[_0x1ff898(0xfe)]('>\x20'+_0x5269c6+'\x20'+_0x58e57d);const _0x1c4459=getAuthHeaders(_0x515ab2),_0x2d0030={..._0x1c4459,..._0x5b49b1};for(const [_0x53280c,_0x303c3c]of Object[_0x1ff898(0xc7)](_0x2d0030)){!isSensitiveHeader(_0x53280c)&&console[_0x1ff898(0xfe)]('>\x20'+_0x53280c+':\x20'+_0x303c3c);}_0x53a8e7&&console[_0x1ff898(0xfe)]('>'),console['error']('');}const _0x38ec92=await _0x200c2e['api']['request'](_0x12f6e5,_0x3287ef);if(_0x487f36[_0x1ff898(0xcc)]&&_0x38ec92[_0x1ff898(0x100)]){console[_0x1ff898(0xfe)](_0x1ff898(0x101)+_0x38ec92[_0x1ff898(0xd2)]);for(const [_0x3ba632,_0x5f25f8]of Object[_0x1ff898(0xc7)](_0x38ec92['headers'])){!isSensitiveHeader(_0x3ba632)&&console[_0x1ff898(0xfe)]('<\x20'+_0x3ba632+':\x20'+_0x5f25f8);}console['error']('');}const _0x42612f=Boolean(_0x487f36[_0x1ff898(0xd0)]),_0x32b0af={'color':_0x487f36[_0x1ff898(0xf4)],'noColor':_0x487f36['noColor']||_0x42612f&&!_0x487f36[_0x1ff898(0xf4)]},_0x123828=colorizeJSON(_0x38ec92[_0x1ff898(0xd7)],_0x32b0af);return _0x487f36[_0x1ff898(0xd0)]?(writeFileSync(_0x487f36['output'],_0x123828),console['error'](_0x1ff898(0xfd)+_0x487f36[_0x1ff898(0xd0)])):console[_0x1ff898(0xfa)](_0x123828),0x0;}catch(_0x2046a4){return _0x2046a4 instanceof Error?(console['error'](_0x1ff898(0xdb)+_0x2046a4[_0x1ff898(0xd4)]),_0x487f36[_0x1ff898(0xcc)]&&_0x2046a4[_0x1ff898(0x105)]&&console[_0x1ff898(0xfe)](_0x1ff898(0xcd)+_0x2046a4['stack'])):console[_0x1ff898(0xfe)]('Error:\x20'+String(_0x2046a4)),0x1;}}}
1
+ const a9_0x2d5da5=a9_0x1668;(function(_0x2496ef,_0x5485bc){const _0x4deec9=a9_0x1668,_0x324f06=_0x2496ef();while(!![]){try{const _0x3a90c9=parseInt(_0x4deec9(0x1d6))/0x1+-parseInt(_0x4deec9(0x1f0))/0x2*(-parseInt(_0x4deec9(0x1cf))/0x3)+-parseInt(_0x4deec9(0x1e5))/0x4+-parseInt(_0x4deec9(0x1bc))/0x5*(-parseInt(_0x4deec9(0x1c8))/0x6)+-parseInt(_0x4deec9(0x1ce))/0x7+-parseInt(_0x4deec9(0x1e1))/0x8*(parseInt(_0x4deec9(0x1b5))/0x9)+-parseInt(_0x4deec9(0x1c5))/0xa;if(_0x3a90c9===_0x5485bc)break;else _0x324f06['push'](_0x324f06['shift']());}catch(_0x9297ce){_0x324f06['push'](_0x324f06['shift']());}}}(a9_0xfe75,0x94044));function a9_0xfe75(){const _0x451936=['Error:\x20','Invalid\x20API\x20type:\x20','has','header','data','2964055LZnCHG','DELETE','headers','authorization','GET','\x22.\x20','Make\x20raw\x20HTTP\x20requests\x20to\x20TD\x20APIs','stack','trim','4100600mqpNGp','noColor','Results\x20saved\x20to\x20','6OKrPDW','description','Expected\x20format:\x20\x22Key:\x20Value\x22\x20or\x20\x22Key:Value\x22','x-xsrf-token','join','readBodyFromFile','2047108nyvyGh','6NUeRkT','Endpoint\x20is\x20required.\x20Example:\x20tdx\x20api\x20/v3/database/list','cdp','.\x20Valid\x20types:\x20','status','includes','length','1117134ADQXyF','site','Invalid\x20header\x20format:\x20\x22','request','keys','message','name','toUpperCase','Header\x20key\x20cannot\x20be\x20empty:\x20\x22','PUT','set-cookie','672136qaTjuc','isArray','Cannot\x20use\x20both\x20--data\x20and\x20--file\x20options.\x20Choose\x20one.','toLowerCase','2276652vtGHaB','error','Endpoint\x20must\x20start\x20with\x20/:\x20','x-trino-user','file','workflow','llm','substring','entries','Invalid\x20HTTP\x20method:\x20','startsWith','504066NzSDJt','.\x20Valid\x20methods:\x20','indexOf','set-cookie2','method','body','output','execute','proxy-authorization','verbose','36lIAHpl','type'];a9_0xfe75=function(){return _0x451936;};return a9_0xfe75();}import{BaseCommand}from'./command.js';function a9_0x1668(_0x43fd94,_0x316815){const _0xfe7523=a9_0xfe75();return a9_0x1668=function(_0x1668fc,_0x4f4507){_0x1668fc=_0x1668fc-0x1af;let _0x3b5e85=_0xfe7523[_0x1668fc];return _0x3b5e85;},a9_0x1668(_0x43fd94,_0x316815);}import{RawAPI}from'../sdk/api.js';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([a9_0x2d5da5(0x1bf),a9_0x2d5da5(0x1b3),'cookie',a9_0x2d5da5(0x1e0),a9_0x2d5da5(0x1f3),a9_0x2d5da5(0x1cb),'x-auth-token',a9_0x2d5da5(0x1e8)]);function isSensitiveHeader(_0x2b2c04){const _0x87ee8e=a9_0x2d5da5;return SENSITIVE_HEADERS[_0x87ee8e(0x1b9)](_0x2b2c04[_0x87ee8e(0x1e4)]());}function parseHeader(_0x38a3c3){const _0x291207=a9_0x2d5da5,_0x39b9f8=_0x38a3c3[_0x291207(0x1f2)](':');if(_0x39b9f8===-0x1)throw new Error(_0x291207(0x1d8)+_0x38a3c3+_0x291207(0x1c1)+_0x291207(0x1ca));const _0xd070c2=_0x38a3c3[_0x291207(0x1ec)](0x0,_0x39b9f8)['trim'](),_0x338c82=_0x38a3c3[_0x291207(0x1ec)](_0x39b9f8+0x1)[_0x291207(0x1c4)]();if(!_0xd070c2)throw new Error(_0x291207(0x1de)+_0x38a3c3+'\x22');return[_0xd070c2,_0x338c82];}export class ApiCommand extends BaseCommand{[a9_0x2d5da5(0x1dc)]='api';[a9_0x2d5da5(0x1c9)]=a9_0x2d5da5(0x1c2);['validate'](_0xbc7eba){const _0x12c4bd=a9_0x2d5da5,{args:_0x1d0b92,options:_0x1a6416}=_0xbc7eba,_0x20bd91=_0x1a6416;if(_0x1d0b92[_0x12c4bd(0x1d5)]===0x0)return _0x12c4bd(0x1d0);const _0x523c21=_0x1d0b92[0x0];if(!_0x523c21[_0x12c4bd(0x1ef)]('/'))return _0x12c4bd(0x1e7)+_0x523c21;const _0x19522e=_0x20bd91['data'],_0x39fa9d=_0x20bd91['file'];if(_0x19522e&&_0x39fa9d)return _0x12c4bd(0x1e3);const _0x4bb6d1=_0x20bd91[_0x12c4bd(0x1af)]||_0x12c4bd(0x1c0),_0x3408b8=['GET','POST',_0x12c4bd(0x1df),_0x12c4bd(0x1bd),'PATCH'];if(!_0x3408b8[_0x12c4bd(0x1d4)](_0x4bb6d1['toUpperCase']()))return _0x12c4bd(0x1ee)+_0x4bb6d1+_0x12c4bd(0x1f1)+_0x3408b8[_0x12c4bd(0x1cc)](',\x20');const _0x169992=_0x20bd91[_0x12c4bd(0x1b6)]||'td',_0x353e07=['td',_0x12c4bd(0x1d1),_0x12c4bd(0x1ea),'trino',_0x12c4bd(0x1eb)];if(!_0x353e07[_0x12c4bd(0x1d4)](_0x169992))return _0x12c4bd(0x1b8)+_0x169992+_0x12c4bd(0x1d2)+_0x353e07[_0x12c4bd(0x1cc)](',\x20');return undefined;}async[a9_0x2d5da5(0x1b2)](_0x37cc1f){const _0x3dcfd4=a9_0x2d5da5,{options:_0x486963,args:_0x44aac5,tdx:_0x123a4d}=_0x37cc1f,_0x14645b=_0x486963,_0x3374fb=_0x44aac5[0x0],_0x19a4d3=(_0x14645b[_0x3dcfd4(0x1af)]||_0x3dcfd4(0x1c0))[_0x3dcfd4(0x1dd)](),_0x31e500=_0x14645b[_0x3dcfd4(0x1bb)],_0x37c4d3=_0x14645b[_0x3dcfd4(0x1e9)],_0x3fc58c=_0x14645b[_0x3dcfd4(0x1ba)],_0x3a9a34=_0x14645b[_0x3dcfd4(0x1b6)]||'td';try{const _0x1b9c42={};if(_0x3fc58c){const _0x3402f7=Array[_0x3dcfd4(0x1e2)](_0x3fc58c)?_0x3fc58c:[_0x3fc58c];for(const _0x64c21e of _0x3402f7){const [_0x3bea8a,_0x4a9b0c]=parseHeader(_0x64c21e);_0x1b9c42[_0x3bea8a]=_0x4a9b0c;}}let _0x13328e;if(_0x31e500)_0x13328e=_0x31e500;else{if(_0x37c4d3)try{_0x13328e=RawAPI[_0x3dcfd4(0x1cd)](_0x37c4d3);}catch(_0x1312b0){return console[_0x3dcfd4(0x1e6)]('Error:\x20'+(_0x1312b0 instanceof Error?_0x1312b0[_0x3dcfd4(0x1db)]:String(_0x1312b0))),0x1;}}const _0x48130c={'method':_0x19a4d3,'apiType':_0x3a9a34,'includeHeaders':_0x486963[_0x3dcfd4(0x1b4)]};_0x13328e&&(_0x48130c[_0x3dcfd4(0x1b0)]=_0x13328e);Object[_0x3dcfd4(0x1da)](_0x1b9c42)['length']>0x0&&(_0x48130c[_0x3dcfd4(0x1be)]=_0x1b9c42);if(_0x486963['verbose']){const _0x1bdcb9=resolveSite(_0x486963[_0x3dcfd4(0x1d7)]),_0x104b81=getEndpoint(_0x1bdcb9,_0x3a9a34),_0x5f152c=''+_0x104b81+_0x3374fb;console[_0x3dcfd4(0x1e6)]('>\x20'+_0x19a4d3+'\x20'+_0x5f152c);const _0x5c481e=getAuthHeaders(_0x1bdcb9),_0x2ec0ad={..._0x5c481e,..._0x1b9c42};for(const [_0x4c6f5a,_0x37eebe]of Object['entries'](_0x2ec0ad)){!isSensitiveHeader(_0x4c6f5a)&&console['error']('>\x20'+_0x4c6f5a+':\x20'+_0x37eebe);}_0x13328e&&console['error']('>'),console['error']('');}const _0x1b3f8d=await _0x123a4d['api'][_0x3dcfd4(0x1d9)](_0x3374fb,_0x48130c);if(_0x486963[_0x3dcfd4(0x1b4)]&&_0x1b3f8d[_0x3dcfd4(0x1be)]){console['error']('<\x20HTTP/1.1\x20'+_0x1b3f8d[_0x3dcfd4(0x1d3)]);for(const [_0x56b24f,_0x37a5de]of Object[_0x3dcfd4(0x1ed)](_0x1b3f8d[_0x3dcfd4(0x1be)])){!isSensitiveHeader(_0x56b24f)&&console[_0x3dcfd4(0x1e6)]('<\x20'+_0x56b24f+':\x20'+_0x37a5de);}console[_0x3dcfd4(0x1e6)]('');}const _0x301311=Boolean(_0x486963[_0x3dcfd4(0x1b1)]),_0x4e175b={'color':_0x486963['color'],'noColor':_0x486963[_0x3dcfd4(0x1c6)]||_0x301311&&!_0x486963['color']},_0x402db7=colorizeJSON(_0x1b3f8d[_0x3dcfd4(0x1bb)],_0x4e175b);return _0x486963[_0x3dcfd4(0x1b1)]?(writeFileSync(_0x486963[_0x3dcfd4(0x1b1)],_0x402db7),console[_0x3dcfd4(0x1e6)](_0x3dcfd4(0x1c7)+_0x486963['output'])):console['log'](_0x402db7),0x0;}catch(_0x304e6b){return _0x304e6b instanceof Error?(console['error'](_0x3dcfd4(0x1b7)+_0x304e6b[_0x3dcfd4(0x1db)]),_0x486963[_0x3dcfd4(0x1b4)]&&_0x304e6b[_0x3dcfd4(0x1c3)]&&console[_0x3dcfd4(0x1e6)]('\x0aStack\x20trace:\x0a'+_0x304e6b[_0x3dcfd4(0x1c3)])):console[_0x3dcfd4(0x1e6)]('Error:\x20'+String(_0x304e6b)),0x1;}}}
@@ -1 +1 @@
1
- const a10_0x2c2ca0=a10_0x1a76;function a10_0x1a76(_0x15d367,_0x46889d){const _0x22d198=a10_0x22d1();return a10_0x1a76=function(_0x1a7657,_0x5342e8){_0x1a7657=_0x1a7657-0xe7;let _0x4aeaa0=_0x22d198[_0x1a7657];return _0x4aeaa0;},a10_0x1a76(_0x15d367,_0x46889d);}(function(_0x2a0b9a,_0x3af03a){const _0x574355=a10_0x1a76,_0x8a7cb7=_0x2a0b9a();while(!![]){try{const _0x27118f=-parseInt(_0x574355(0x105))/0x1+parseInt(_0x574355(0xf2))/0x2*(parseInt(_0x574355(0x109))/0x3)+parseInt(_0x574355(0x129))/0x4+-parseInt(_0x574355(0x135))/0x5*(parseInt(_0x574355(0x10b))/0x6)+-parseInt(_0x574355(0x131))/0x7*(parseInt(_0x574355(0x132))/0x8)+parseInt(_0x574355(0x124))/0x9*(parseInt(_0x574355(0xfc))/0xa)+-parseInt(_0x574355(0x108))/0xb*(-parseInt(_0x574355(0x100))/0xc);if(_0x27118f===_0x3af03a)break;else _0x8a7cb7['push'](_0x8a7cb7['shift']());}catch(_0x3c1b7b){_0x8a7cb7['push'](_0x8a7cb7['shift']());}}}(a10_0x22d1,0x7350f));import{BaseCommand,printAuthError}from'./command.js';import{saveAPIKeyAsync,resolveSite}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 a10_0x5856e6 from'prompts';import{HTTPClientError}from'../client/http-client.js';import{TDX}from'../sdk/index.js';import{LogLevel}from'../utils/tdx-logger.js';import a10_0x5977a8 from'chalk';export class AuthSetupCommand extends BaseCommand{[a10_0x2c2ca0(0x125)]=a10_0x2c2ca0(0x12d);[a10_0x2c2ca0(0x126)]=a10_0x2c2ca0(0x11c);async[a10_0x2c2ca0(0x128)](_0x59aa72){const _0xefc797=a10_0x2c2ca0,{options:_0x3fb2bb}=_0x59aa72,_0x6818f1=_0x3fb2bb['profile'];console[_0xefc797(0xee)](a10_0x5977a8['bold']('tdx:\x20auth\x20setup'));const _0x29abcb=_0x3fb2bb[_0xefc797(0x10e)]||_0xefc797(0x112),_0x211a02=[{'title':_0xefc797(0xed),'value':'us01'},{'title':_0xefc797(0x117),'value':'jp01'},{'title':'eu\x20\x20\x20-\x20Europe','value':'eu01'},{'title':'ap02\x20-\x20Korea','value':_0xefc797(0x10f)}];let _0x822b36=_0x211a02[_0xefc797(0x122)](_0x353841=>_0x353841[_0xefc797(0x12a)]===_0x29abcb);_0x822b36===-0x1&&_0x29abcb!==_0xefc797(0x112)&&(_0x211a02['push']({'title':_0x29abcb,'value':_0x29abcb}),_0x822b36=_0x211a02[_0xefc797(0x134)]-0x1);_0x211a02[_0xefc797(0x120)]({'title':_0xefc797(0xe9),'value':_0xefc797(0x102)});const _0x2e5009=_0x6818f1?_0xefc797(0xe8)+_0x6818f1+'):':'Select\x20your\x20Treasure\x20Data\x20site:',_0x5dce22=await a10_0x5856e6({'type':_0xefc797(0x119),'name':_0xefc797(0x10e),'message':_0x2e5009,'choices':_0x211a02,'initial':_0x822b36>=0x0?_0x822b36:0x0});if(!_0x5dce22[_0xefc797(0x10e)])return console[_0xefc797(0xee)]('\x0aSetup\x20cancelled'),0x1;let _0x442c05;if(_0x5dce22['site']===_0xefc797(0x102)){const _0x3cfcac=await a10_0x5856e6({'type':_0xefc797(0x11a),'name':'customSite','message':_0xefc797(0xf4),'initial':_0xefc797(0x112),'validate':_0x36eafe=>{const _0x3e5bb9=_0xefc797;if(!_0x36eafe||!_0x36eafe[_0x3e5bb9(0x12e)]())return'Site\x20name\x20cannot\x20be\x20empty';if(!/^[a-z0-9-]+$/['test'](_0x36eafe[_0x3e5bb9(0x12e)]()))return _0x3e5bb9(0x114);return!![];}});if(!_0x3cfcac[_0xefc797(0xf8)])return console['log'](_0xefc797(0x113)),0x1;_0x442c05=_0x3cfcac[_0xefc797(0xf8)];}else _0x442c05=_0x5dce22[_0xefc797(0x10e)];const _0x95adff=resolveSite(_0x442c05);console[_0xefc797(0xee)](_0xefc797(0x10a)+_0x95adff),console['log']('You\x20can\x20find\x20your\x20API\x20key\x20at:'),console[_0xefc797(0xee)]('\x20\x20'+getConsoleUrl(_0x95adff,'/app/mp/ak'));const _0x4224cb=await a10_0x5856e6({'type':_0xefc797(0xfd),'name':'apiKey','message':_0xefc797(0x130),'validate':_0x4f1f7b=>{const _0xe68fbd=_0xefc797;if(!_0x4f1f7b||!_0x4f1f7b[_0xe68fbd(0x12e)]())return _0xe68fbd(0xfa);return!![];}});if(!_0x4224cb[_0xefc797(0x116)])return console['log']('\x0aSetup\x20cancelled'),0x1;const _0xe7ea76=_0x4224cb[_0xefc797(0x116)];console[_0xefc797(0xee)]('Validating\x20API\x20key...');try{const _0x16af06=TDX[_0xefc797(0xf5)]({'site':_0x95adff,'apiKey':_0xe7ea76['trim'](),'logLevel':_0x3fb2bb[_0xefc797(0x127)]??LogLevel[_0xefc797(0xec)]}),_0x123eb=await _0x16af06['jobs'][_0xefc797(0xf0)]();console['log']('✓\x20API\x20key\x20is\x20valid\x20(User:\x20'+_0x123eb[_0xefc797(0xfb)]+')');const _0x5c459c=await isKeychainAvailable();_0x5c459c?(await saveAPIKeyAsync(_0xe7ea76[_0xefc797(0x12e)](),_0x95adff,_0x6818f1),console[_0xefc797(0xee)]('✓\x20API\x20key\x20saved\x20to\x20system\x20keychain'+(_0x6818f1?'\x20(profile:\x20'+_0x6818f1+')':''))):(console['warn'](a10_0x5977a8['yellow'](_0xefc797(0x12c))),console['warn'](a10_0x5977a8[_0xefc797(0x101)](_0xefc797(0x133))));if(_0x6818f1){const _0x46bd94={'site':_0x95adff};saveProfileToUserConfig(_0x6818f1,_0x46bd94),console[_0xefc797(0xee)](_0xefc797(0xf1)+_0x6818f1+_0xefc797(0x103));}const _0x52b32c=_0x6818f1?'\x20--profile\x20'+_0x6818f1:'';return console[_0xefc797(0xee)](),console['log'](_0xefc797(0xeb)),console[_0xefc797(0xee)](_0xefc797(0x12b)+_0x52b32c+_0xefc797(0xf6)),console[_0xefc797(0xee)](_0xefc797(0x12b)+_0x52b32c+_0xefc797(0x11b)),0x0;}catch(_0x19bc05){if(_0x19bc05 instanceof HTTPClientError&&_0x19bc05[_0xefc797(0x118)]===0x191)return printAuthError(_0x19bc05),0x1;return console[_0xefc797(0x121)](a10_0x5977a8[_0xefc797(0x107)](_0xefc797(0xe7)+(_0x19bc05 instanceof Error?_0x19bc05[_0xefc797(0xff)]:String(_0x19bc05)))),console[_0xefc797(0x121)](_0xefc797(0x10d)),0x1;}}}export class AuthStatusCommand extends BaseCommand{[a10_0x2c2ca0(0x125)]='auth';[a10_0x2c2ca0(0x126)]=a10_0x2c2ca0(0x123);async[a10_0x2c2ca0(0x128)](_0x1c04c4){const _0x35a26a=a10_0x2c2ca0,{options:_0x59f0a7,tdx:_0x2b0ac}=_0x1c04c4,_0x1867a2=_0x59f0a7[_0x35a26a(0x10e)],_0x3582a3=_0x59f0a7[_0x35a26a(0xf9)],_0x14901b=_0x3582a3?_0x3582a3:'N/A';console[_0x35a26a(0xee)]('tdx\x20profile:\x20'+_0x14901b+'\x20(site:\x20'+_0x1867a2+')');try{const _0x2e6441=await _0x2b0ac['jobs']['getUserInfo']();return console[_0x35a26a(0xee)](_0x35a26a(0xf7)),console['log'](_0x35a26a(0x110)+_0x2e6441['email']),(_0x2e6441[_0x35a26a(0x115)]||_0x2e6441[_0x35a26a(0x104)])&&console[_0x35a26a(0xee)](_0x35a26a(0xef)+[_0x2e6441[_0x35a26a(0x115)],_0x2e6441['last_name']]['filter'](Boolean)[_0x35a26a(0xf3)]('\x20')),0x0;}catch(_0x105d99){return _0x105d99 instanceof HTTPClientError&&_0x105d99[_0x35a26a(0x118)]===0x191?printAuthError(_0x105d99,!![]):console['error'](a10_0x5977a8[_0x35a26a(0x107)](_0x35a26a(0xe7)+(_0x105d99 instanceof Error?_0x105d99[_0x35a26a(0xff)]:String(_0x105d99)))),0x1;}}}export class AuthClearCommand extends BaseCommand{[a10_0x2c2ca0(0x125)]=a10_0x2c2ca0(0xea);[a10_0x2c2ca0(0x126)]=a10_0x2c2ca0(0x111);async[a10_0x2c2ca0(0x128)](_0x234127){const _0x559170=a10_0x2c2ca0,{options:_0x30be70}=_0x234127,_0x786dda=_0x30be70[_0x559170(0xf9)];console[_0x559170(0xee)](a10_0x5977a8[_0x559170(0x12f)](_0x559170(0x10c)));const _0x298696=await isKeychainAvailable();if(!_0x298696)return console[_0x559170(0x121)](a10_0x5977a8[_0x559170(0x107)](_0x559170(0x106))),0x1;const _0x1e4a12=await deleteKeychainAPIKey(_0x786dda);return _0x1e4a12?(clearCredentialCache(),console[_0x559170(0xee)](_0x559170(0x11d)+(_0x786dda?_0x559170(0x11f)+_0x786dda+')':'')),0x0):(console[_0x559170(0xee)](_0x559170(0xfe)+(_0x786dda?_0x559170(0x11e)+_0x786dda:'')),0x1);}}function a10_0x22d1(){const _0x5be49c=['Show\x20authentication\x20status\x20and\x20validate\x20API\x20key','261qUHBdD','name','description','logLevel','execute','1252556YWCXtT','value','\x20\x20tdx','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','auth:setup','trim','bold','Enter\x20your\x20TD\x20API\x20key:','7pZKoqO','7447264JwvkDr','\x20\x20Set\x20TD_API_KEY\x20environment\x20variable\x20for\x20authentication.','length','1705Oudssq','✗\x20Validation\x20failed:\x20','Select\x20your\x20Treasure\x20Data\x20site\x20(for\x20profile:\x20','Enter\x20custom\x20site','auth:clear','You\x20can\x20now\x20use\x20tdx\x20commands.\x20Try:','ERROR','us\x20\x20\x20-\x20United\x20States','log','Name:\x20','getUserInfo','✓\x20Profile\x20\x27','6QNDCGq','join','Enter\x20site\x20name:','create','\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication','✓\x20Authentication\x20successful\x0a','customSite','profile','API\x20key\x20cannot\x20be\x20empty','email','139950mQwGCr','password','No\x20API\x20key\x20found\x20in\x20keychain','message','112872QaQlJw','yellow','other','\x27\x20registered','last_name','318009gmGaVx','System\x20keychain\x20is\x20not\x20available','red','572yZwUal','780831QbQkdB','Setting\x20up\x20authentication\x20for\x20site:\x20','4710hGAuyT','tdx:\x20auth\x20clear','API\x20key\x20was\x20not\x20saved.\x20Please\x20try\x20again.','site','ap02','User:\x20','Remove\x20API\x20key\x20from\x20system\x20keychain','us01','\x0aSetup\x20cancelled','Site\x20name\x20must\x20contain\x20only\x20lowercase\x20letters,\x20numbers,\x20and\x20hyphens','first_name','apiKey','jp\x20\x20\x20-\x20Japan','status','select','text','\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases','Setup\x20API\x20key\x20authentication\x20interactively','✓\x20API\x20key\x20removed\x20from\x20keychain','\x20for\x20profile:\x20','\x20(profile:\x20','push','error','findIndex'];a10_0x22d1=function(){return _0x5be49c;};return a10_0x22d1();}
1
+ const a10_0x49cf32=a10_0x307e;(function(_0x295509,_0x37bdca){const _0x2dc935=a10_0x307e,_0x4dd8ea=_0x295509();while(!![]){try{const _0x4e28b3=parseInt(_0x2dc935(0x1b5))/0x1+-parseInt(_0x2dc935(0x1be))/0x2*(parseInt(_0x2dc935(0x1d1))/0x3)+parseInt(_0x2dc935(0x1fb))/0x4+-parseInt(_0x2dc935(0x1f8))/0x5*(parseInt(_0x2dc935(0x1ad))/0x6)+parseInt(_0x2dc935(0x1d9))/0x7*(-parseInt(_0x2dc935(0x1b2))/0x8)+parseInt(_0x2dc935(0x1b4))/0x9+-parseInt(_0x2dc935(0x1cd))/0xa*(parseInt(_0x2dc935(0x1f7))/0xb);if(_0x4e28b3===_0x37bdca)break;else _0x4dd8ea['push'](_0x4dd8ea['shift']());}catch(_0x11bd99){_0x4dd8ea['push'](_0x4dd8ea['shift']());}}}(a10_0x30a9,0xba027));import{BaseCommand,printAuthError}from'./command.js';import{saveAPIKeyAsync,resolveSite}from'../core/config.js';function a10_0x307e(_0x40a1ab,_0x1d5d18){const _0x30a905=a10_0x30a9();return a10_0x307e=function(_0x307ebe,_0x5e36bf){_0x307ebe=_0x307ebe-0x1aa;let _0x2e8819=_0x30a905[_0x307ebe];return _0x2e8819;},a10_0x307e(_0x40a1ab,_0x1d5d18);}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 a10_0x2a7989 from'prompts';import{HTTPClientError}from'../client/http-client.js';import{TDX}from'../sdk/index.js';import{LogLevel}from'../utils/tdx-logger.js';import a10_0x18af81 from'chalk';export class AuthSetupCommand extends BaseCommand{[a10_0x49cf32(0x1fa)]='auth:setup';[a10_0x49cf32(0x1bc)]=a10_0x49cf32(0x1b8);async[a10_0x49cf32(0x1d3)](_0x21db76){const _0x1ed8c3=a10_0x49cf32,{options:_0x363bd5}=_0x21db76,_0xfeb35d=_0x363bd5[_0x1ed8c3(0x1b6)];console[_0x1ed8c3(0x1bb)](a10_0x18af81[_0x1ed8c3(0x1ce)]('tdx:\x20auth\x20setup'));const _0x3699d5=_0x363bd5[_0x1ed8c3(0x1ab)]||'us01',_0x1e4b9c=[{'title':'us\x20\x20\x20-\x20United\x20States','value':_0x1ed8c3(0x1dd)},{'title':'jp\x20\x20\x20-\x20Japan','value':'jp01'},{'title':_0x1ed8c3(0x1f1),'value':_0x1ed8c3(0x1c8)},{'title':'ap02\x20-\x20Korea','value':_0x1ed8c3(0x1b1)}];let _0x4eac41=_0x1e4b9c[_0x1ed8c3(0x1b0)](_0x7f8e1f=>_0x7f8e1f[_0x1ed8c3(0x1f5)]===_0x3699d5);_0x4eac41===-0x1&&_0x3699d5!==_0x1ed8c3(0x1dd)&&(_0x1e4b9c[_0x1ed8c3(0x1c3)]({'title':_0x3699d5,'value':_0x3699d5}),_0x4eac41=_0x1e4b9c[_0x1ed8c3(0x1fd)]-0x1);_0x1e4b9c['push']({'title':_0x1ed8c3(0x1e9),'value':_0x1ed8c3(0x1ec)});const _0x522e90=_0xfeb35d?_0x1ed8c3(0x1f0)+_0xfeb35d+'):':_0x1ed8c3(0x1f3),_0xab2173=await a10_0x2a7989({'type':_0x1ed8c3(0x1df),'name':_0x1ed8c3(0x1ab),'message':_0x522e90,'choices':_0x1e4b9c,'initial':_0x4eac41>=0x0?_0x4eac41:0x0});if(!_0xab2173[_0x1ed8c3(0x1ab)])return console[_0x1ed8c3(0x1bb)](_0x1ed8c3(0x1ed)),0x1;let _0x252702;if(_0xab2173[_0x1ed8c3(0x1ab)]===_0x1ed8c3(0x1ec)){const _0xe6a64b=await a10_0x2a7989({'type':_0x1ed8c3(0x1dc),'name':_0x1ed8c3(0x1e8),'message':_0x1ed8c3(0x1d7),'initial':_0x1ed8c3(0x1dd),'validate':_0x3b5d6f=>{const _0x593aba=_0x1ed8c3;if(!_0x3b5d6f||!_0x3b5d6f[_0x593aba(0x1f6)]())return _0x593aba(0x1ae);if(!/^[a-z0-9-]+$/[_0x593aba(0x1db)](_0x3b5d6f['trim']()))return _0x593aba(0x1f9);return!![];}});if(!_0xe6a64b[_0x1ed8c3(0x1e8)])return console['log'](_0x1ed8c3(0x1ed)),0x1;_0x252702=_0xe6a64b[_0x1ed8c3(0x1e8)];}else _0x252702=_0xab2173[_0x1ed8c3(0x1ab)];const _0x32322e=resolveSite(_0x252702);console[_0x1ed8c3(0x1bb)](_0x1ed8c3(0x1d2)+_0x32322e),console['log'](_0x1ed8c3(0x1af)),console[_0x1ed8c3(0x1bb)]('\x20\x20'+getConsoleUrl(_0x32322e,_0x1ed8c3(0x1d4)));const _0x86c1b3=await a10_0x2a7989({'type':_0x1ed8c3(0x1ee),'name':'apiKey','message':'Enter\x20your\x20TD\x20API\x20key:','validate':_0x142d8d=>{const _0x13fc4c=_0x1ed8c3;if(!_0x142d8d||!_0x142d8d[_0x13fc4c(0x1f6)]())return'API\x20key\x20cannot\x20be\x20empty';return!![];}});if(!_0x86c1b3['apiKey'])return console[_0x1ed8c3(0x1bb)](_0x1ed8c3(0x1ed)),0x1;const _0x51cb0c=_0x86c1b3[_0x1ed8c3(0x1b7)];console[_0x1ed8c3(0x1bb)](_0x1ed8c3(0x1e7));try{const _0x574782=TDX[_0x1ed8c3(0x1d8)]({'site':_0x32322e,'apiKey':_0x51cb0c[_0x1ed8c3(0x1f6)](),'logLevel':_0x363bd5['logLevel']??LogLevel[_0x1ed8c3(0x1cf)]}),_0x580dc7=await _0x574782[_0x1ed8c3(0x1b9)][_0x1ed8c3(0x1e2)]();console[_0x1ed8c3(0x1bb)]('✓\x20API\x20key\x20is\x20valid\x20(User:\x20'+_0x580dc7[_0x1ed8c3(0x1f2)]+')');const _0x41ea99=await isKeychainAvailable();_0x41ea99?(await saveAPIKeyAsync(_0x51cb0c[_0x1ed8c3(0x1f6)](),_0x32322e,_0xfeb35d),console[_0x1ed8c3(0x1bb)](_0x1ed8c3(0x1c4)+(_0xfeb35d?'\x20(profile:\x20'+_0xfeb35d+')':''))):(console[_0x1ed8c3(0x1c2)](a10_0x18af81[_0x1ed8c3(0x1cb)](_0x1ed8c3(0x1aa))),console[_0x1ed8c3(0x1c2)](a10_0x18af81['yellow'](_0x1ed8c3(0x1c1))));if(_0xfeb35d){const _0x512e66={'site':_0x32322e};saveProfileToUserConfig(_0xfeb35d,_0x512e66),console[_0x1ed8c3(0x1bb)](_0x1ed8c3(0x1f4)+_0xfeb35d+_0x1ed8c3(0x1ba));}const _0x24bc52=_0xfeb35d?_0x1ed8c3(0x1fc)+_0xfeb35d:'';return console['log'](),console[_0x1ed8c3(0x1bb)](_0x1ed8c3(0x1ca)),console[_0x1ed8c3(0x1bb)]('\x20\x20tdx'+_0x24bc52+_0x1ed8c3(0x1bf)),console[_0x1ed8c3(0x1bb)](_0x1ed8c3(0x1e1)+_0x24bc52+'\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases'),0x0;}catch(_0x31f51e){if(_0x31f51e instanceof HTTPClientError&&_0x31f51e[_0x1ed8c3(0x1ea)]===0x191)return printAuthError(_0x31f51e),0x1;return console['error'](a10_0x18af81['red'](_0x1ed8c3(0x1e6)+(_0x31f51e instanceof Error?_0x31f51e[_0x1ed8c3(0x1d0)]:String(_0x31f51e)))),console[_0x1ed8c3(0x1c5)]('API\x20key\x20was\x20not\x20saved.\x20Please\x20try\x20again.'),0x1;}}}export class AuthStatusCommand extends BaseCommand{[a10_0x49cf32(0x1fa)]=a10_0x49cf32(0x1b3);[a10_0x49cf32(0x1bc)]=a10_0x49cf32(0x1eb);async[a10_0x49cf32(0x1d3)](_0x2dddd9){const _0x168ee0=a10_0x49cf32,{options:_0x4145ae,tdx:_0x4c41f9}=_0x2dddd9,_0x467ea9=_0x4145ae['site'],_0x2153be=_0x4145ae[_0x168ee0(0x1b6)],_0x15612f=_0x2153be?_0x2153be:_0x168ee0(0x1c0);console[_0x168ee0(0x1bb)]('tdx\x20profile:\x20'+_0x15612f+'\x20(site:\x20'+_0x467ea9+')');try{const _0x21136e=await _0x4c41f9[_0x168ee0(0x1b9)][_0x168ee0(0x1e2)]();return console[_0x168ee0(0x1bb)](_0x168ee0(0x1ac)),console[_0x168ee0(0x1bb)](_0x168ee0(0x1e4)+_0x21136e[_0x168ee0(0x1f2)]),(_0x21136e[_0x168ee0(0x1bd)]||_0x21136e[_0x168ee0(0x1de)])&&console[_0x168ee0(0x1bb)](_0x168ee0(0x1d5)+[_0x21136e[_0x168ee0(0x1bd)],_0x21136e[_0x168ee0(0x1de)]]['filter'](Boolean)[_0x168ee0(0x1cc)]('\x20')),0x0;}catch(_0x515d08){return _0x515d08 instanceof HTTPClientError&&_0x515d08[_0x168ee0(0x1ea)]===0x191?printAuthError(_0x515d08,!![]):console['error'](a10_0x18af81[_0x168ee0(0x1ef)](_0x168ee0(0x1e6)+(_0x515d08 instanceof Error?_0x515d08[_0x168ee0(0x1d0)]:String(_0x515d08)))),0x1;}}}function a10_0x30a9(){const _0x4c3709=['error','No\x20API\x20key\x20found\x20in\x20keychain','auth:clear','eu01','Remove\x20API\x20key\x20from\x20system\x20keychain','You\x20can\x20now\x20use\x20tdx\x20commands.\x20Try:','yellow','join','110OwboQC','bold','ERROR','message','21633JyJsDp','Setting\x20up\x20authentication\x20for\x20site:\x20','execute','/app/mp/ak','Name:\x20','\x20(profile:\x20','Enter\x20site\x20name:','create','96054YlmWxM','System\x20keychain\x20is\x20not\x20available','test','text','us01','last_name','select','\x20for\x20profile:\x20','\x20\x20tdx','getUserInfo','tdx:\x20auth\x20clear','User:\x20','✓\x20API\x20key\x20removed\x20from\x20keychain','✗\x20Validation\x20failed:\x20','Validating\x20API\x20key...','customSite','Enter\x20custom\x20site','status','Show\x20authentication\x20status\x20and\x20validate\x20API\x20key','other','\x0aSetup\x20cancelled','password','red','Select\x20your\x20Treasure\x20Data\x20site\x20(for\x20profile:\x20','eu\x20\x20\x20-\x20Europe','email','Select\x20your\x20Treasure\x20Data\x20site:','✓\x20Profile\x20\x27','value','trim','642103dyQjcV','50HLoFYQ','Site\x20name\x20must\x20contain\x20only\x20lowercase\x20letters,\x20numbers,\x20and\x20hyphens','name','4202992AeTpkS','\x20--profile\x20','length','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','site','✓\x20Authentication\x20successful\x0a','171510YcnRWf','Site\x20name\x20cannot\x20be\x20empty','You\x20can\x20find\x20your\x20API\x20key\x20at:','findIndex','ap02','104sRWECA','auth','6793182mNAgBZ','596302byWYXX','profile','apiKey','Setup\x20API\x20key\x20authentication\x20interactively','jobs','\x27\x20registered','log','description','first_name','148MZwGTv','\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication','N/A','\x20\x20Set\x20TD_API_KEY\x20environment\x20variable\x20for\x20authentication.','warn','push','✓\x20API\x20key\x20saved\x20to\x20system\x20keychain'];a10_0x30a9=function(){return _0x4c3709;};return a10_0x30a9();}export class AuthClearCommand extends BaseCommand{[a10_0x49cf32(0x1fa)]=a10_0x49cf32(0x1c7);[a10_0x49cf32(0x1bc)]=a10_0x49cf32(0x1c9);async['execute'](_0x16eef8){const _0x29f33d=a10_0x49cf32,{options:_0x359038}=_0x16eef8,_0x13530e=_0x359038[_0x29f33d(0x1b6)];console['log'](a10_0x18af81['bold'](_0x29f33d(0x1e3)));const _0x1f0383=await isKeychainAvailable();if(!_0x1f0383)return console[_0x29f33d(0x1c5)](a10_0x18af81[_0x29f33d(0x1ef)](_0x29f33d(0x1da))),0x1;const _0x428b21=await deleteKeychainAPIKey(_0x13530e);return _0x428b21?(clearCredentialCache(),console[_0x29f33d(0x1bb)](_0x29f33d(0x1e5)+(_0x13530e?_0x29f33d(0x1d6)+_0x13530e+')':'')),0x0):(console[_0x29f33d(0x1bb)](_0x29f33d(0x1c6)+(_0x13530e?_0x29f33d(0x1e0)+_0x13530e:'')),0x1);}}
@@ -1 +1 @@
1
- const a11_0x33006c=a11_0x5a22;(function(_0x1bff6a,_0x348e78){const _0x4aa5fe=a11_0x5a22,_0x5aec6d=_0x1bff6a();while(!![]){try{const _0x251019=parseInt(_0x4aa5fe(0x1bc))/0x1*(-parseInt(_0x4aa5fe(0x1bf))/0x2)+-parseInt(_0x4aa5fe(0x1ab))/0x3+parseInt(_0x4aa5fe(0x1ae))/0x4+-parseInt(_0x4aa5fe(0x1a7))/0x5+-parseInt(_0x4aa5fe(0x1c2))/0x6+-parseInt(_0x4aa5fe(0x1b9))/0x7*(parseInt(_0x4aa5fe(0x1c4))/0x8)+parseInt(_0x4aa5fe(0x1d3))/0x9*(parseInt(_0x4aa5fe(0x1cd))/0xa);if(_0x251019===_0x348e78)break;else _0x5aec6d['push'](_0x5aec6d['shift']());}catch(_0x11198d){_0x5aec6d['push'](_0x5aec6d['shift']());}}}(a11_0x3426,0x73a93));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/errors.js';import{withSpinner}from'../utils/spinner.js';import{parseAgentRef}from'../utils/agent-ref-parser.js';import{saveLastChatId,loadLastChatId}from'../utils/chat-cache.js';import{resolveModelAlias}from'../utils/model-aliases.js';function handleSDKError(_0x7deac7,_0x15c7b9){const _0x2cc048=a11_0x5a22;if(_0x7deac7 instanceof SDKError)console[_0x2cc048(0x1b8)](_0x2cc048(0x1b4)+_0x7deac7['message']),_0x15c7b9[_0x2cc048(0x1d5)]&&(_0x7deac7[_0x2cc048(0x1a4)]&&console[_0x2cc048(0x1b8)](_0x2cc048(0x1b1)+_0x7deac7['cause']),_0x7deac7[_0x2cc048(0x1da)]&&(console[_0x2cc048(0x1b8)](_0x2cc048(0x1c5)),console['error'](_0x7deac7['stack'])));else throw _0x7deac7;}function a11_0x3426(){const _0x259166=['metadata','467aaGmus','join','[Tool\x20result:\x20','2276aCnaLU','Resolving\x20project\x20\x27','output','4877040yosAKa','Resolving\x20agent\x20\x27','1037872baNmiT','\x0aStack\x20trace:','stdout','chat','Continuing\x20chat:\x20','Chat\x20session\x20not\x20found,\x20starting\x20new\x20chat...','message','content','type','35102730tySdDg','new','write','getOrCreateDefaultAgent','streamChat','temperature','9mUGShX','\x0a[Error:\x20','verbose','CHAT_NOT_FOUND','Chat\x20with\x20an\x20LLM\x20agent\x20(simplified)','tool','Getting\x20agent\x20for\x20model\x20\x27','stack','\x0a[Output:\x20','Chat\x20session:\x20','handleSSEEvent','data','description','\x0a[Tool:\x20','validate','cause','model','tool_call','4102550mcqnCC','stderr','Usage:\x20tdx\x20chat\x20\x22your\x20message\x22\x0a\x0aRun\x20\x27tdx\x20chat\x20--help\x27\x20for\x20more\x20options','resolveAgentId','1101207ulvCoq','getAgentId','\x27...','57100QmNqGj','args','log','\x20\x20Cause:\x20','haiku','functionName','Error:\x20','llm','execute','name','error','28HgKvgZ','chatId'];a11_0x3426=function(){return _0x259166;};return a11_0x3426();}function a11_0x5a22(_0x2eb60c,_0x37c5b4){const _0x3426ee=a11_0x3426();return a11_0x5a22=function(_0x5a2225,_0x11f7d0){_0x5a2225=_0x5a2225-0x1a0;let _0x121ea3=_0x3426ee[_0x5a2225];return _0x121ea3;},a11_0x5a22(_0x2eb60c,_0x37c5b4);}export class ChatCommand extends BaseCommand{[a11_0x33006c(0x1b7)]=a11_0x33006c(0x1c7);[a11_0x33006c(0x1a1)]=a11_0x33006c(0x1d7);[a11_0x33006c(0x1a3)](_0x3ad6fc){const _0x28e3a0=a11_0x33006c,_0x496ec5=_0x3ad6fc[_0x28e3a0(0x1af)][_0x28e3a0(0x1bd)]('\x20');if(!_0x496ec5)return _0x28e3a0(0x1a9);return undefined;}async[a11_0x33006c(0x1d1)](_0x4257ed,_0x1cec71,_0x4ee688,_0x48ba77,_0x2ab8b9){const _0x76b905=a11_0x33006c;for await(const _0x4980ed of _0x4257ed['llm'][_0x76b905(0x1c7)](_0x1cec71,{'agentId':_0x4ee688,'chatId':_0x48ba77})){if(_0x4980ed[_0x76b905(0x1cc)]===_0x76b905(0x1bb)){const _0x27db55=_0x4980ed['data'][_0x76b905(0x1ba)];saveLastChatId(_0x27db55),_0x2ab8b9&&console[_0x76b905(0x1b8)](_0x76b905(0x1dc)+_0x27db55);}else _0x4980ed[_0x76b905(0x1cc)]==='event'&&this['handleSSEEvent'](_0x4980ed[_0x76b905(0x1a0)]);}}async['getAgentId'](_0xcd4078,_0x4b224e,_0x530bb6,_0x344df7,_0x32654f){const _0x5acde2=a11_0x33006c;if(_0x4b224e){const {projectName:_0x190504,agentName:_0x30b727}=parseAgentRef(_0x4b224e);if(!_0x30b727)throw new Error('Agent\x20reference\x20must\x20include\x20project\x20name.\x20Usage:\x20--agent\x20\x22Project/Agent\x22');const _0x46193e=await withSpinner(_0x5acde2(0x1c0)+_0x190504+'\x27...',()=>_0xcd4078[_0x5acde2(0x1b5)]['resolveProjectId'](_0x190504),{'verbose':_0x32654f}),_0x51e620=await withSpinner(_0x5acde2(0x1c3)+_0x30b727+'\x27...',()=>_0xcd4078[_0x5acde2(0x1b5)][_0x5acde2(0x1aa)](_0x30b727,_0x46193e[_0x5acde2(0x1a0)]),{'verbose':_0x32654f});return _0x51e620[_0x5acde2(0x1a0)];}else{const _0x4a5537=_0x530bb6||_0x5acde2(0x1b2),_0x6502cd=resolveModelAlias(_0x4a5537),_0x12cf5b=await withSpinner(_0x5acde2(0x1d9)+_0x6502cd+_0x5acde2(0x1ad),()=>_0xcd4078[_0x5acde2(0x1b5)][_0x5acde2(0x1d0)](_0x6502cd,0x0,_0x344df7),{'verbose':_0x32654f});return _0x12cf5b[_0x5acde2(0x1a0)]['id'];}}async[a11_0x33006c(0x1b6)](_0x4da27d){const _0x329ef0=a11_0x33006c,{options:_0x336ff7,args:_0x48b339,tdx:_0x5d4b51}=_0x4da27d,_0x21f251=_0x48b339[_0x329ef0(0x1bd)]('\x20'),_0x3233dc=_0x336ff7,_0x4f7796=_0x3233dc['agent'],_0x445348=_0x3233dc[_0x329ef0(0x1a5)],_0x53825d=_0x3233dc['temperature']?Number(_0x3233dc[_0x329ef0(0x1d2)]):undefined,_0x483fd3=_0x3233dc[_0x329ef0(0x1ce)];try{let _0x29a43d,_0x111445;!_0x483fd3&&(_0x111445=loadLastChatId(),_0x111445&&_0x336ff7[_0x329ef0(0x1d5)]&&console['error'](_0x329ef0(0x1c8)+_0x111445));(_0x483fd3||!_0x111445)&&(_0x29a43d=await this['getAgentId'](_0x5d4b51,_0x4f7796,_0x445348,_0x53825d,_0x336ff7[_0x329ef0(0x1d5)]));try{await this[_0x329ef0(0x1d1)](_0x5d4b51,_0x21f251,_0x29a43d,_0x111445,_0x336ff7['verbose']);}catch(_0x3170a0){const _0x2bfcb0=_0x3170a0 instanceof SDKError&&_0x3170a0['code']===ErrorCode[_0x329ef0(0x1d6)]||_0x3170a0 instanceof Error&&_0x3170a0[_0x329ef0(0x1ca)]['includes']('404');if(_0x2bfcb0)_0x336ff7[_0x329ef0(0x1d5)]&&console[_0x329ef0(0x1b8)](_0x329ef0(0x1c9)),!_0x29a43d&&(_0x29a43d=await this[_0x329ef0(0x1ac)](_0x5d4b51,_0x4f7796,_0x445348,_0x53825d,_0x336ff7['verbose'])),await this[_0x329ef0(0x1d1)](_0x5d4b51,_0x21f251,_0x29a43d,undefined,_0x336ff7[_0x329ef0(0x1d5)]);else throw _0x3170a0;}return console[_0x329ef0(0x1b0)](),0x0;}catch(_0x1c400d){return console['error'](),handleSDKError(_0x1c400d,_0x336ff7),0x1;}}[a11_0x33006c(0x1dd)](_0x2e6cda){const _0x552c69=a11_0x33006c;if(_0x552c69(0x1cb)in _0x2e6cda)process[_0x552c69(0x1c6)][_0x552c69(0x1cf)](_0x2e6cda['content']);else{if(_0x552c69(0x1a6)in _0x2e6cda)process['stderr'][_0x552c69(0x1cf)](_0x552c69(0x1a2)+_0x2e6cda['tool_call'][_0x552c69(0x1b3)]+']\x0a');else{if(_0x552c69(0x1d8)in _0x2e6cda)process[_0x552c69(0x1a8)]['write'](_0x552c69(0x1be)+_0x2e6cda['tool'][_0x552c69(0x1b3)]+']\x0a');else{if('output'in _0x2e6cda)process[_0x552c69(0x1a8)][_0x552c69(0x1cf)](_0x552c69(0x1db)+_0x2e6cda[_0x552c69(0x1c1)][_0x552c69(0x1b7)]+']\x0a'),process[_0x552c69(0x1a8)][_0x552c69(0x1cf)](_0x2e6cda[_0x552c69(0x1c1)]['content']+'\x0a');else _0x552c69(0x1b8)in _0x2e6cda&&process[_0x552c69(0x1a8)][_0x552c69(0x1cf)](_0x552c69(0x1d4)+_0x2e6cda[_0x552c69(0x1b8)]+']\x0a');}}}}}
1
+ const a11_0x10d21c=a11_0x5b5b;(function(_0x3833b0,_0x4a7903){const _0x51b131=a11_0x5b5b,_0x14a453=_0x3833b0();while(!![]){try{const _0x3171cb=parseInt(_0x51b131(0xf2))/0x1+parseInt(_0x51b131(0x100))/0x2+-parseInt(_0x51b131(0x10d))/0x3*(-parseInt(_0x51b131(0x109))/0x4)+-parseInt(_0x51b131(0x124))/0x5*(-parseInt(_0x51b131(0xf9))/0x6)+parseInt(_0x51b131(0xf5))/0x7+-parseInt(_0x51b131(0x11f))/0x8+-parseInt(_0x51b131(0x122))/0x9*(parseInt(_0x51b131(0xf4))/0xa);if(_0x3171cb===_0x4a7903)break;else _0x14a453['push'](_0x14a453['shift']());}catch(_0x3f6ddd){_0x14a453['push'](_0x14a453['shift']());}}}(a11_0x2395,0x9ec7b));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/errors.js';import{withSpinner}from'../utils/spinner.js';import{parseAgentRef}from'../utils/agent-ref-parser.js';import{saveLastChatId,loadLastChatId}from'../utils/chat-cache.js';import{resolveModelAlias}from'../utils/model-aliases.js';function a11_0x2395(){const _0x4544e5=['error','new','60OsBoEu','getAgentId','streamChat','stderr','CHAT_NOT_FOUND','cause','\x27...','1446112YEJthY','handleSSEEvent','resolveProjectId','description','chat','content','Usage:\x20tdx\x20chat\x20\x22your\x20message\x22\x0a\x0aRun\x20\x27tdx\x20chat\x20--help\x27\x20for\x20more\x20options','Agent\x20reference\x20must\x20include\x20project\x20name.\x20Usage:\x20--agent\x20\x22Project/Agent\x22','code','12dEyURS','Resolving\x20agent\x20\x27','write','tool','339519qJyqQA','validate','llm','type','name','\x0a[Output:\x20','output','functionName','Chat\x20session:\x20','verbose','execute','chatId','\x0aStack\x20trace:','message','tool_call','\x0a[Tool:\x20','404','[Tool\x20result:\x20','2668664ppZQIb','metadata','data','14103gSgqql','temperature','44630gJDTvR','getOrCreateDefaultAgent','log','873430QHZjBg','join','8780LgdgPr','2341549ffXqsG','haiku'];a11_0x2395=function(){return _0x4544e5;};return a11_0x2395();}function a11_0x5b5b(_0x4c28c3,_0xef02eb){const _0x2395a9=a11_0x2395();return a11_0x5b5b=function(_0x5b5b57,_0x64e664){_0x5b5b57=_0x5b5b57-0xf1;let _0x2b9330=_0x2395a9[_0x5b5b57];return _0x2b9330;},a11_0x5b5b(_0x4c28c3,_0xef02eb);}function handleSDKError(_0x51dd40,_0x2f964c){const _0x41f0c1=a11_0x5b5b;if(_0x51dd40 instanceof SDKError)console[_0x41f0c1(0xf7)]('Error:\x20'+_0x51dd40[_0x41f0c1(0x11a)]),_0x2f964c[_0x41f0c1(0x116)]&&(_0x51dd40[_0x41f0c1(0xfe)]&&console[_0x41f0c1(0xf7)]('\x20\x20Cause:\x20'+_0x51dd40['cause']),_0x51dd40['stack']&&(console[_0x41f0c1(0xf7)](_0x41f0c1(0x119)),console[_0x41f0c1(0xf7)](_0x51dd40['stack'])));else throw _0x51dd40;}export class ChatCommand extends BaseCommand{[a11_0x10d21c(0x111)]=a11_0x10d21c(0x104);[a11_0x10d21c(0x103)]='Chat\x20with\x20an\x20LLM\x20agent\x20(simplified)';[a11_0x10d21c(0x10e)](_0x144eaf){const _0x43065f=a11_0x10d21c,_0x2b4c26=_0x144eaf['args'][_0x43065f(0xf3)]('\x20');if(!_0x2b4c26)return _0x43065f(0x106);return undefined;}async[a11_0x10d21c(0xfb)](_0x220ee9,_0x2a130b,_0x490cd8,_0x10626f,_0x44cf81){const _0x450854=a11_0x10d21c;for await(const _0x4915dd of _0x220ee9[_0x450854(0x10f)][_0x450854(0x104)](_0x2a130b,{'agentId':_0x490cd8,'chatId':_0x10626f})){if(_0x4915dd[_0x450854(0x110)]===_0x450854(0x120)){const _0x1100e3=_0x4915dd[_0x450854(0x121)][_0x450854(0x118)];saveLastChatId(_0x1100e3),_0x44cf81&&console[_0x450854(0xf7)](_0x450854(0x115)+_0x1100e3);}else _0x4915dd[_0x450854(0x110)]==='event'&&this[_0x450854(0x101)](_0x4915dd[_0x450854(0x121)]);}}async[a11_0x10d21c(0xfa)](_0x564461,_0x59301c,_0x5b9d28,_0xfe17b6,_0x44871c){const _0x5985ca=a11_0x10d21c;if(_0x59301c){const {projectName:_0x11dd6a,agentName:_0x221484}=parseAgentRef(_0x59301c);if(!_0x221484)throw new Error(_0x5985ca(0x107));const _0x3e3808=await withSpinner('Resolving\x20project\x20\x27'+_0x11dd6a+_0x5985ca(0xff),()=>_0x564461['llm'][_0x5985ca(0x102)](_0x11dd6a),{'verbose':_0x44871c}),_0x31178a=await withSpinner(_0x5985ca(0x10a)+_0x221484+_0x5985ca(0xff),()=>_0x564461['llm']['resolveAgentId'](_0x221484,_0x3e3808['data']),{'verbose':_0x44871c});return _0x31178a[_0x5985ca(0x121)];}else{const _0x2f3f56=_0x5b9d28||_0x5985ca(0xf6),_0x2b91c3=resolveModelAlias(_0x2f3f56),_0x1809bf=await withSpinner('Getting\x20agent\x20for\x20model\x20\x27'+_0x2b91c3+_0x5985ca(0xff),()=>_0x564461['llm'][_0x5985ca(0x125)](_0x2b91c3,0x0,_0xfe17b6),{'verbose':_0x44871c});return _0x1809bf['data']['id'];}}async[a11_0x10d21c(0x117)](_0x31747b){const _0x28a5e0=a11_0x10d21c,{options:_0x2005b1,args:_0x23af52,tdx:_0x917cf9}=_0x31747b,_0x3c0553=_0x23af52[_0x28a5e0(0xf3)]('\x20'),_0x10ee2f=_0x2005b1,_0xb23e18=_0x10ee2f['agent'],_0x1030d3=_0x10ee2f['model'],_0x155bc4=_0x10ee2f[_0x28a5e0(0x123)]?Number(_0x10ee2f[_0x28a5e0(0x123)]):undefined,_0x493d9f=_0x10ee2f[_0x28a5e0(0xf8)];try{let _0x397e05,_0x334ea8;!_0x493d9f&&(_0x334ea8=loadLastChatId(),_0x334ea8&&_0x2005b1[_0x28a5e0(0x116)]&&console[_0x28a5e0(0xf7)]('Continuing\x20chat:\x20'+_0x334ea8));(_0x493d9f||!_0x334ea8)&&(_0x397e05=await this[_0x28a5e0(0xfa)](_0x917cf9,_0xb23e18,_0x1030d3,_0x155bc4,_0x2005b1[_0x28a5e0(0x116)]));try{await this[_0x28a5e0(0xfb)](_0x917cf9,_0x3c0553,_0x397e05,_0x334ea8,_0x2005b1[_0x28a5e0(0x116)]);}catch(_0x977660){const _0x548917=_0x977660 instanceof SDKError&&_0x977660[_0x28a5e0(0x108)]===ErrorCode[_0x28a5e0(0xfd)]||_0x977660 instanceof Error&&_0x977660[_0x28a5e0(0x11a)]['includes'](_0x28a5e0(0x11d));if(_0x548917)_0x2005b1[_0x28a5e0(0x116)]&&console[_0x28a5e0(0xf7)]('Chat\x20session\x20not\x20found,\x20starting\x20new\x20chat...'),!_0x397e05&&(_0x397e05=await this[_0x28a5e0(0xfa)](_0x917cf9,_0xb23e18,_0x1030d3,_0x155bc4,_0x2005b1[_0x28a5e0(0x116)])),await this['streamChat'](_0x917cf9,_0x3c0553,_0x397e05,undefined,_0x2005b1[_0x28a5e0(0x116)]);else throw _0x977660;}return console[_0x28a5e0(0xf1)](),0x0;}catch(_0x411614){return console[_0x28a5e0(0xf7)](),handleSDKError(_0x411614,_0x2005b1),0x1;}}[a11_0x10d21c(0x101)](_0x4a5ee2){const _0x541768=a11_0x10d21c;if(_0x541768(0x105)in _0x4a5ee2)process['stdout']['write'](_0x4a5ee2[_0x541768(0x105)]);else{if('tool_call'in _0x4a5ee2)process[_0x541768(0xfc)][_0x541768(0x10b)](_0x541768(0x11c)+_0x4a5ee2[_0x541768(0x11b)][_0x541768(0x114)]+']\x0a');else{if('tool'in _0x4a5ee2)process[_0x541768(0xfc)][_0x541768(0x10b)](_0x541768(0x11e)+_0x4a5ee2[_0x541768(0x10c)][_0x541768(0x114)]+']\x0a');else{if(_0x541768(0x113)in _0x4a5ee2)process['stderr']['write'](_0x541768(0x112)+_0x4a5ee2[_0x541768(0x113)][_0x541768(0x111)]+']\x0a'),process[_0x541768(0xfc)]['write'](_0x4a5ee2[_0x541768(0x113)][_0x541768(0x105)]+'\x0a');else _0x541768(0xf7)in _0x4a5ee2&&process['stderr'][_0x541768(0x10b)]('\x0a[Error:\x20'+_0x4a5ee2[_0x541768(0xf7)]+']\x0a');}}}}}
@@ -1 +1 @@
1
- const a12_0x54f359=a12_0x1410;function a12_0x1410(_0x498165,_0x250ecb){const _0x860fad=a12_0x860f();return a12_0x1410=function(_0x1410d9,_0x4a362a){_0x1410d9=_0x1410d9-0x165;let _0x2daff1=_0x860fad[_0x1410d9];return _0x2daff1;},a12_0x1410(_0x498165,_0x250ecb);}(function(_0x24803c,_0x8a3aba){const _0x561e7d=a12_0x1410,_0x3afa91=_0x24803c();while(!![]){try{const _0x3bfff3=-parseInt(_0x561e7d(0x1a7))/0x1*(parseInt(_0x561e7d(0x1c5))/0x2)+parseInt(_0x561e7d(0x1cb))/0x3+-parseInt(_0x561e7d(0x186))/0x4+-parseInt(_0x561e7d(0x17a))/0x5+parseInt(_0x561e7d(0x173))/0x6*(-parseInt(_0x561e7d(0x1c4))/0x7)+-parseInt(_0x561e7d(0x19a))/0x8+parseInt(_0x561e7d(0x1c1))/0x9*(parseInt(_0x561e7d(0x1d1))/0xa);if(_0x3bfff3===_0x8a3aba)break;else _0x3afa91['push'](_0x3afa91['shift']());}catch(_0x1f2ed6){_0x3afa91['push'](_0x3afa91['shift']());}}}(a12_0x860f,0xe161b));import{spawn}from'node:child_process';import{readFile,writeFile,mkdir}from'node:fs/promises';import{existsSync}from'node:fs';import{join}from'node:path';import a12_0x4b4679 from'chalk';import{BaseCommand}from'./command.js';import{ProxyServer}from'../proxy/server.js';import{TDXLogger}from'../utils/tdx-logger.js';import{findAvailablePort}from'../utils/port.js';import{SDKError,ErrorCode,errorContains}from'../sdk/errors.js';import{createCommandSpinner}from'../utils/spinner.js';function a12_0x860f(){const _0x33765b=['Setting\x20up\x20project...','trim','pipe','parse','✓\x20Using\x20project:\x20','\x27\x20installed','red','mcp','Claude\x20Code\x20CLI\x20not\x20found','stop','4665510KLmLcZ','already\x20installed','td-skills','14nGTQJM','1498OtAkOt','hostname','already\x20configured','Configuring\x20MCP\x20server\x20\x27','Initializing\x20proxy\x20logger...','Please\x20install\x20Claude\x20Code\x20from\x20https://claude.com/claude-code','5064948mDcCMM','\x27...','tdx-skills','string','COMMAND_NOT_FOUND','install','50pzVVhO','verbose','claude','plugin','--transport','td-skills\x20Plugins','getOrCreateDefaultProject','127.0.0.1','execute','add','close','join','env','inherit','\x20configuration\x20failed','attributes','4850556sCgNBV','Failed\x20to\x20install\x20plugin\x20\x27','logLevel','http','init','Installing\x20plugin\x20\x27','http://127.0.0.1:','2669530NLpLdP','log','Configuring\x20marketplace\x20\x27','ANTHROPIC_MODEL','logger','Command\x20failed\x20(exit\x20','Updating\x20marketplace\x20\x27','warn','Executing:\x20claude\x20','✓\x20Port\x20','exit','TD\x20Docs\x20MCP\x20Server','188676YmtTTu','stdout','✓\x20Settings\x20configured:\x20.claude/settings.local.json','marketplace','name','toString','site','https://github.com/treasure-data/td-skills','error','originalEnv','td-docs','stringify','.claude','Failed\x20to\x20update\x20marketplace\x20\x27','info','utf-8','ANTHROPIC_BASE_URL','green','\x27\x20configured','debug','9027736bKuUgG','https://td-docs.redocly.app/mcp','getLogPath','\x20already\x20configured','start','cause','✓\x20Logging\x20to\x20','Command\x20output:\x20','description','sonnet','message','✓\x20MCP\x20server\x20\x27','localhost','41DBvSNl','✓\x20Logs\x20saved\x20to\x20','model','server','text','Failed\x20to\x20configure\x20MCP\x20server\x20\x27','✓\x20Marketplace\x20\x27','settings.local.json','Failed\x20to\x20configure\x20marketplace\x20\x27','findClaudePath','Failed\x20to\x20launch\x20Claude\x20Code:\x20','Launch\x20Claude\x20Code\x20with\x20integrated\x20LLM\x20proxy','which','✓\x20Settings\x20restored:\x20.claude/settings.local.json','data','Starting\x20TD\x20LLM\x20proxy\x20server...'];a12_0x860f=function(){return _0x33765b;};return a12_0x860f();}function handleInstallationError(_0x471229,_0x4dbc64,_0x2802af,_0x4d1005){const _0x1e0694=a12_0x1410;errorContains(_0x471229,'already\x20exists',_0x1e0694(0x1c2),_0x1e0694(0x1c7))?(_0x2802af[_0x1e0694(0x1ab)]='✓\x20'+_0x4dbc64+_0x1e0694(0x19d),_0x4d1005?.['info'](_0x4dbc64+_0x1e0694(0x19d)),_0x471229 instanceof SDKError&&_0x471229['cause']&&_0x4d1005?.[_0x1e0694(0x199)](_0x1e0694(0x1a1)+_0x471229[_0x1e0694(0x19f)]['message'])):(_0x2802af[_0x1e0694(0x181)]('Warning:\x20Failed\x20to\x20configure\x20'+_0x4dbc64),_0x4d1005?.[_0x1e0694(0x18e)](_0x4dbc64+_0x1e0694(0x171),_0x471229));}async function executeClaudeCommand(_0x4e1057,_0x10bf06,_0x562c8a){const _0x15f18c=a12_0x1410;return _0x562c8a?.[_0x15f18c(0x194)](_0x15f18c(0x182)+_0x4e1057['join']('\x20')),new Promise((_0x57d9fa,_0x53216c)=>{const _0x452a6a=_0x15f18c,_0x521f56=spawn(_0x452a6a(0x165),_0x4e1057,{'stdio':_0x452a6a(0x1b9)});let _0xcf0f00='',_0x4e702='';_0x521f56['stdout']['on'](_0x452a6a(0x1b5),_0x2f5ab0=>{const _0x2467fa=_0x452a6a;_0xcf0f00+=_0x2f5ab0[_0x2467fa(0x18b)]();}),_0x521f56['stderr']['on'](_0x452a6a(0x1b5),_0x6ba0be=>{const _0x53eb83=_0x452a6a;_0x4e702+=_0x6ba0be[_0x53eb83(0x18b)]();}),_0x521f56['on'](_0x452a6a(0x184),_0xcaea16=>{const _0x2be52a=_0x452a6a;if(_0xcaea16===0x0)_0x57d9fa(_0xcf0f00);else _0x10bf06?(_0x562c8a?.[_0x2be52a(0x18e)](_0x2be52a(0x17f)+_0xcaea16+'):\x20claude\x20'+_0x4e1057[_0x2be52a(0x16e)]('\x20')),_0x53216c(new SDKError(ErrorCode['INSTALLATION_FAILED'],_0x10bf06,new Error(_0x4e702)))):_0x57d9fa('');});});}async function ensureMcpServer(_0x32c194,_0x67045c,_0x541e8c,_0x1ce835,_0x5e4d3c){const _0x349b37=a12_0x1410;_0x1ce835['text']=_0x349b37(0x1c8)+_0x32c194+_0x349b37(0x1cc),await executeClaudeCommand([_0x349b37(0x1be),_0x349b37(0x16c),_0x32c194,_0x67045c,_0x349b37(0x167),_0x541e8c],_0x349b37(0x1ac)+_0x32c194+'\x27',_0x5e4d3c),_0x1ce835[_0x349b37(0x1ab)]=_0x349b37(0x1a5)+_0x32c194+_0x349b37(0x198);}async function ensureMarketplace(_0x1e67d4,_0x4defc1,_0x516fa1,_0xd3d85d){const _0x548d0b=a12_0x1410;_0x516fa1[_0x548d0b(0x1ab)]=_0x548d0b(0x17c)+_0x1e67d4+_0x548d0b(0x1cc),await executeClaudeCommand(['plugin',_0x548d0b(0x189),_0x548d0b(0x16c),_0x4defc1],_0x548d0b(0x1af)+_0x1e67d4+'\x27',_0xd3d85d),_0x516fa1[_0x548d0b(0x1ab)]=_0x548d0b(0x1ad)+_0x1e67d4+'\x27\x20configured';}async function updateMarketplace(_0x42bd0c,_0x7968cd,_0x592b79){const _0x2e5fec=a12_0x1410;_0x7968cd[_0x2e5fec(0x1ab)]=_0x2e5fec(0x180)+_0x42bd0c+'\x27...',await executeClaudeCommand([_0x2e5fec(0x166),'marketplace','update'],_0x2e5fec(0x193)+_0x42bd0c+'\x27',_0x592b79),_0x7968cd['text']='✓\x20Marketplace\x20\x27'+_0x42bd0c+'\x27\x20updated';}async function ensurePlugin(_0x45f8e5,_0x17c35b,_0x4b47d6,_0x508fd0){const _0x9c8b14=a12_0x1410;_0x4b47d6['text']=_0x9c8b14(0x178)+_0x45f8e5+'\x27...',await executeClaudeCommand([_0x9c8b14(0x166),_0x9c8b14(0x1d0),_0x45f8e5+'@'+_0x17c35b],_0x9c8b14(0x174)+_0x45f8e5+'\x27',_0x508fd0),_0x4b47d6[_0x9c8b14(0x1ab)]='✓\x20Plugin\x20\x27'+_0x45f8e5+_0x9c8b14(0x1bc);}async function createClaudeSettings(_0x3de040,_0x1c5a83=a12_0x54f359(0x1a3)){const _0x41f6a3=a12_0x54f359,_0x4f0b6a=join(process['cwd'](),'.claude'),_0x3817c2=join(_0x4f0b6a,'settings.local.json');await mkdir(_0x4f0b6a,{'recursive':!![]});let _0x2c0f07={};if(existsSync(_0x3817c2))try{const _0x33fae1=await readFile(_0x3817c2,'utf-8');_0x2c0f07=JSON[_0x41f6a3(0x1ba)](_0x33fae1);}catch{_0x2c0f07={};}const _0x443f24=_0x2c0f07[_0x41f6a3(0x16f)]||{},_0x14817c={'ANTHROPIC_BASE_URL':_0x443f24[_0x41f6a3(0x196)],'ANTHROPIC_MODEL':_0x443f24[_0x41f6a3(0x17d)]},_0x1de34b={..._0x2c0f07,'env':{..._0x443f24,'ANTHROPIC_BASE_URL':_0x41f6a3(0x179)+_0x3de040,'ANTHROPIC_MODEL':_0x1c5a83}};return await writeFile(_0x3817c2,JSON[_0x41f6a3(0x191)](_0x1de34b,null,0x2)+'\x0a'),_0x14817c;}async function restoreClaudeSettings(_0x4a8ad2){const _0xe2684b=a12_0x54f359,_0x57eced=join(process['cwd'](),_0xe2684b(0x192)),_0x5b3950=join(_0x57eced,_0xe2684b(0x1ae));if(!existsSync(_0x5b3950))return;try{const _0x5055a0=await readFile(_0x5b3950,_0xe2684b(0x195)),_0x4e5063=JSON[_0xe2684b(0x1ba)](_0x5055a0),_0x1ad550=_0x4e5063['env']||{},_0x44cb84=_0x1ad550[_0xe2684b(0x196)],_0x1a2544=((()=>{const _0x5220a3=_0xe2684b;if(typeof _0x44cb84!==_0x5220a3(0x1ce))return![];try{const _0x5683b6=new URL(_0x44cb84);return _0x5683b6[_0x5220a3(0x1c6)]===_0x5220a3(0x1a6)||_0x5683b6[_0x5220a3(0x1c6)]===_0x5220a3(0x16a);}catch{return![];}})());_0x1a2544?(delete _0x1ad550[_0xe2684b(0x196)],delete _0x1ad550['ANTHROPIC_MODEL']):(_0x4a8ad2[_0xe2684b(0x196)]!==undefined?_0x1ad550[_0xe2684b(0x196)]=_0x4a8ad2['ANTHROPIC_BASE_URL']:delete _0x1ad550[_0xe2684b(0x196)],_0x4a8ad2[_0xe2684b(0x17d)]!==undefined?_0x1ad550[_0xe2684b(0x17d)]=_0x4a8ad2[_0xe2684b(0x17d)]:delete _0x1ad550['ANTHROPIC_MODEL']),_0x4e5063[_0xe2684b(0x16f)]=_0x1ad550,await writeFile(_0x5b3950,JSON[_0xe2684b(0x191)](_0x4e5063,null,0x2)+'\x0a');}catch{}}export class ClaudeCommand extends BaseCommand{[a12_0x54f359(0x18a)]=a12_0x54f359(0x165);[a12_0x54f359(0x1a2)]=a12_0x54f359(0x1b2);[a12_0x54f359(0x1aa)];[a12_0x54f359(0x18f)];[a12_0x54f359(0x17e)];async[a12_0x54f359(0x16b)](_0x2d0af1){const _0x552be0=a12_0x54f359,{tdx:_0x3dcab5,options:_0x18ef3d,args:_0x53da6c}=_0x2d0af1;try{const _0x17f9b3=_0x18ef3d,_0x3088c3=_0x17f9b3[_0x552be0(0x1a9)]||_0x552be0(0x1a3),_0xa467ad=createCommandSpinner('Initializing...',{'verbose':_0x18ef3d[_0x552be0(0x1d2)]});_0xa467ad[_0x552be0(0x19e)]();try{_0xa467ad['text']='Finding\x20available\x20port...';const _0x32b627=await findAvailablePort(0xfa0);_0xa467ad[_0x552be0(0x1ab)]=_0x552be0(0x183)+_0x32b627,_0xa467ad[_0x552be0(0x1ab)]=_0x552be0(0x1b7);const _0x1da7fb=await _0x3dcab5['llm'][_0x552be0(0x169)](),_0x12656e=_0x1da7fb['id'];_0xa467ad[_0x552be0(0x1ab)]=_0x552be0(0x1bb)+_0x1da7fb[_0x552be0(0x172)]['name'],_0xa467ad['text']=_0x552be0(0x1c9),this[_0x552be0(0x17e)]=new TDXLogger(_0x18ef3d[_0x552be0(0x175)],!![]),await this[_0x552be0(0x17e)][_0x552be0(0x177)]();const _0x2b9105=this[_0x552be0(0x17e)][_0x552be0(0x19c)]();_0xa467ad[_0x552be0(0x1ab)]=_0x552be0(0x1a0)+_0x2b9105,_0xa467ad[_0x552be0(0x1ab)]=_0x552be0(0x1b6),this[_0x552be0(0x1aa)]=new ProxyServer({'port':_0x32b627,'projectId':_0x12656e,'tdx':_0x3dcab5,'logger':this[_0x552be0(0x17e)],'site':_0x18ef3d[_0x552be0(0x18c)]}),await this[_0x552be0(0x1aa)][_0x552be0(0x19e)](),_0xa467ad['text']='✓\x20TD\x20LLM\x20proxy\x20running\x20on\x20port\x20'+_0x32b627,_0xa467ad[_0x552be0(0x1ab)]='Creating\x20.claude/settings.local.json...',this[_0x552be0(0x18f)]=await createClaudeSettings(_0x32b627,_0x3088c3),_0xa467ad[_0x552be0(0x1ab)]=_0x552be0(0x188);try{await ensureMcpServer(_0x552be0(0x190),_0x552be0(0x19b),_0x552be0(0x176),_0xa467ad,this[_0x552be0(0x17e)]);}catch(_0x3e183d){handleInstallationError(_0x3e183d,_0x552be0(0x185),_0xa467ad,this[_0x552be0(0x17e)]);}try{await ensureMarketplace(_0x552be0(0x1c3),_0x552be0(0x18d),_0xa467ad,this[_0x552be0(0x17e)]),await updateMarketplace(_0x552be0(0x1c3),_0xa467ad,this['logger']),await ensurePlugin('sql-skills','td-skills',_0xa467ad,this[_0x552be0(0x17e)]),await ensurePlugin('workflow-skills',_0x552be0(0x1c3),_0xa467ad,this[_0x552be0(0x17e)]),await ensurePlugin(_0x552be0(0x1cd),_0x552be0(0x1c3),_0xa467ad,this[_0x552be0(0x17e)]);}catch(_0x1d87b7){handleInstallationError(_0x1d87b7,_0x552be0(0x168),_0xa467ad,this[_0x552be0(0x17e)]);}_0xa467ad[_0x552be0(0x1c0)]();}catch(_0xbcf32b){_0xa467ad['fail']('Setup\x20failed');throw _0xbcf32b;}const _0x588a33=await this[_0x552be0(0x1b0)]();if(!_0x588a33)throw new SDKError(ErrorCode[_0x552be0(0x1cf)],_0x552be0(0x1bf),undefined,{'helpText':_0x552be0(0x1ca)});const _0x4e18a7=spawn(_0x588a33,_0x53da6c,{'stdio':_0x552be0(0x170)}),_0x10d0d7=await new Promise(_0x5a738d=>{const _0x4b4c72=_0x552be0;_0x4e18a7['on']('exit',_0x4835ce=>{_0x5a738d(_0x4835ce||0x0);}),_0x4e18a7['on'](_0x4b4c72(0x18e),_0x3ef2a8=>{const _0x14e9a5=_0x4b4c72;console[_0x14e9a5(0x18e)](a12_0x4b4679[_0x14e9a5(0x1bd)](_0x14e9a5(0x1b1)+_0x3ef2a8[_0x14e9a5(0x1a4)])),_0x5a738d(0x1);});});this[_0x552be0(0x1aa)]&&(await this[_0x552be0(0x1aa)][_0x552be0(0x1c0)](),console[_0x552be0(0x17b)](a12_0x4b4679['green']('✓\x20TD\x20LLM\x20proxy\x20server\x20stopped')));if(this[_0x552be0(0x17e)]){await this[_0x552be0(0x17e)][_0x552be0(0x16d)]();const _0x2e2abe=this[_0x552be0(0x17e)]['getLogPath']();console[_0x552be0(0x17b)](a12_0x4b4679[_0x552be0(0x197)](_0x552be0(0x1a8)+_0x2e2abe));}return this['originalEnv']&&(await restoreClaudeSettings(this[_0x552be0(0x18f)]),console[_0x552be0(0x17b)](a12_0x4b4679['green'](_0x552be0(0x1b4)))),_0x10d0d7;}catch(_0x1cfdde){this[_0x552be0(0x1aa)]&&await this[_0x552be0(0x1aa)]['stop']();this['logger']&&await this['logger'][_0x552be0(0x16d)]();this[_0x552be0(0x18f)]&&await restoreClaudeSettings(this[_0x552be0(0x18f)]);throw _0x1cfdde;}}async[a12_0x54f359(0x1b0)](){return new Promise(_0x314119=>{const _0x433b54=a12_0x1410,_0x6222cc=spawn(_0x433b54(0x1b3),[_0x433b54(0x165)]);let _0x223243='';_0x6222cc[_0x433b54(0x187)]['on'](_0x433b54(0x1b5),_0x171797=>{const _0x577935=_0x433b54;_0x223243+=_0x171797[_0x577935(0x18b)]();}),_0x6222cc['on'](_0x433b54(0x184),_0xd21fa5=>{const _0x2e37bf=_0x433b54;_0xd21fa5===0x0&&_0x223243[_0x2e37bf(0x1b8)]()?_0x314119(_0x223243[_0x2e37bf(0x1b8)]()):_0x314119(_0x2e37bf(0x165));});});}}
1
+ const a12_0x4cced6=a12_0x4b25;function a12_0x4b25(_0x2b0e24,_0x5e1043){const _0x109268=a12_0x1092();return a12_0x4b25=function(_0x4b25f8,_0x516b42){_0x4b25f8=_0x4b25f8-0x1db;let _0x313f27=_0x109268[_0x4b25f8];return _0x313f27;},a12_0x4b25(_0x2b0e24,_0x5e1043);}(function(_0x4f5224,_0x429704){const _0x258aeb=a12_0x4b25,_0x585016=_0x4f5224();while(!![]){try{const _0x2e8855=parseInt(_0x258aeb(0x1e2))/0x1+-parseInt(_0x258aeb(0x23c))/0x2+parseInt(_0x258aeb(0x218))/0x3*(-parseInt(_0x258aeb(0x22a))/0x4)+parseInt(_0x258aeb(0x1ed))/0x5+parseInt(_0x258aeb(0x1ee))/0x6*(-parseInt(_0x258aeb(0x1f4))/0x7)+parseInt(_0x258aeb(0x1ff))/0x8*(parseInt(_0x258aeb(0x220))/0x9)+parseInt(_0x258aeb(0x203))/0xa;if(_0x2e8855===_0x429704)break;else _0x585016['push'](_0x585016['shift']());}catch(_0x3f6ed0){_0x585016['push'](_0x585016['shift']());}}}(a12_0x1092,0xefb2b));import{spawn}from'node:child_process';import{readFile,writeFile,mkdir}from'node:fs/promises';import{existsSync}from'node:fs';import{join}from'node:path';import a12_0x59483f from'chalk';import{BaseCommand}from'./command.js';import{ProxyServer}from'../proxy/server.js';import{TDXLogger}from'../utils/tdx-logger.js';import{findAvailablePort}from'../utils/port.js';import{SDKError,ErrorCode,errorContains}from'../sdk/errors.js';import{createCommandSpinner}from'../utils/spinner.js';function handleInstallationError(_0x1d19ae,_0x36cffe,_0x283c8c,_0x4ca564){const _0x3bbfcd=a12_0x4b25;errorContains(_0x1d19ae,_0x3bbfcd(0x1ef),'already\x20installed',_0x3bbfcd(0x1dd))?(_0x283c8c[_0x3bbfcd(0x241)]='✓\x20'+_0x36cffe+_0x3bbfcd(0x201),_0x4ca564?.[_0x3bbfcd(0x235)](_0x36cffe+_0x3bbfcd(0x201)),_0x1d19ae instanceof SDKError&&_0x1d19ae[_0x3bbfcd(0x1e0)]&&_0x4ca564?.[_0x3bbfcd(0x233)]('Command\x20output:\x20'+_0x1d19ae[_0x3bbfcd(0x1e0)]['message'])):(_0x283c8c[_0x3bbfcd(0x243)](_0x3bbfcd(0x20a)+_0x36cffe),_0x4ca564?.[_0x3bbfcd(0x207)](_0x36cffe+_0x3bbfcd(0x206),_0x1d19ae));}async function executeClaudeCommand(_0x1da912,_0x5425b2,_0x2cb2c4){const _0x386529=a12_0x4b25;return _0x2cb2c4?.[_0x386529(0x235)](_0x386529(0x232)+_0x1da912[_0x386529(0x211)]('\x20')),new Promise((_0xd66175,_0x1654b9)=>{const _0xba8f20=_0x386529,_0x91dd9c=spawn(_0xba8f20(0x22d),_0x1da912,{'stdio':_0xba8f20(0x1e4)});let _0xfb540='',_0x31d8ea='';_0x91dd9c[_0xba8f20(0x1fe)]['on'](_0xba8f20(0x1de),_0x36c52f=>{const _0x34defc=_0xba8f20;_0xfb540+=_0x36c52f[_0x34defc(0x242)]();}),_0x91dd9c[_0xba8f20(0x217)]['on'](_0xba8f20(0x1de),_0x48f3b1=>{const _0x1d5ba2=_0xba8f20;_0x31d8ea+=_0x48f3b1[_0x1d5ba2(0x242)]();}),_0x91dd9c['on'](_0xba8f20(0x20b),_0x5f2816=>{const _0x3c4da0=_0xba8f20;if(_0x5f2816===0x0)_0xd66175(_0xfb540);else _0x5425b2?(_0x2cb2c4?.[_0x3c4da0(0x207)](_0x3c4da0(0x222)+_0x5f2816+_0x3c4da0(0x1ec)+_0x1da912[_0x3c4da0(0x211)]('\x20')),_0x1654b9(new SDKError(ErrorCode[_0x3c4da0(0x236)],_0x5425b2,new Error(_0x31d8ea)))):_0xd66175('');});});}async function ensureMcpServer(_0x3aea1e,_0x3260df,_0x195bbb,_0xd9d396,_0x356248){const _0x28e701=a12_0x4b25;_0xd9d396[_0x28e701(0x241)]=_0x28e701(0x1f2)+_0x3aea1e+_0x28e701(0x224),await executeClaudeCommand([_0x28e701(0x22e),_0x28e701(0x1e3),_0x3aea1e,_0x3260df,_0x28e701(0x1ea),_0x195bbb],_0x28e701(0x234)+_0x3aea1e+'\x27',_0x356248),_0xd9d396[_0x28e701(0x241)]='✓\x20MCP\x20server\x20\x27'+_0x3aea1e+'\x27\x20configured';}async function ensureMarketplace(_0x2266e8,_0xb04bf0,_0x1ff4f4,_0x286d8b){const _0x5cdee9=a12_0x4b25;_0x1ff4f4['text']=_0x5cdee9(0x204)+_0x2266e8+_0x5cdee9(0x224),await executeClaudeCommand([_0x5cdee9(0x21d),_0x5cdee9(0x1fc),_0x5cdee9(0x1e3),_0xb04bf0],_0x5cdee9(0x205)+_0x2266e8+'\x27',_0x286d8b),_0x1ff4f4[_0x5cdee9(0x241)]=_0x5cdee9(0x216)+_0x2266e8+'\x27\x20configured';}async function updateMarketplace(_0xada8f5,_0x3e9ea8,_0x24083e){const _0x5bebe8=a12_0x4b25;_0x3e9ea8[_0x5bebe8(0x241)]=_0x5bebe8(0x225)+_0xada8f5+_0x5bebe8(0x224),await executeClaudeCommand([_0x5bebe8(0x21d),'marketplace','update'],_0x5bebe8(0x21e)+_0xada8f5+'\x27',_0x24083e),_0x3e9ea8['text']='✓\x20Marketplace\x20\x27'+_0xada8f5+'\x27\x20updated';}async function ensurePlugin(_0x1ae4fe,_0x4e8552,_0x8b9b75,_0x390623){const _0x163441=a12_0x4b25;_0x8b9b75['text']=_0x163441(0x1df)+_0x1ae4fe+_0x163441(0x224),await executeClaudeCommand(['plugin',_0x163441(0x23e),_0x1ae4fe+'@'+_0x4e8552],'Failed\x20to\x20install\x20plugin\x20\x27'+_0x1ae4fe+'\x27',_0x390623),_0x8b9b75[_0x163441(0x241)]=_0x163441(0x1e9)+_0x1ae4fe+_0x163441(0x1f7);}async function createClaudeSettings(_0x47f909,_0x410b4b='sonnet'){const _0x2fb0d3=a12_0x4b25,_0x47937c=join(process['cwd'](),_0x2fb0d3(0x23d)),_0x2ff236=join(_0x47937c,'settings.local.json');await mkdir(_0x47937c,{'recursive':!![]});let _0xc28453={};if(existsSync(_0x2ff236))try{const _0x511ba5=await readFile(_0x2ff236,_0x2fb0d3(0x240));_0xc28453=JSON[_0x2fb0d3(0x239)](_0x511ba5);}catch{_0xc28453={};}const _0x427dc2=_0xc28453[_0x2fb0d3(0x22f)]||{},_0x50004c={'ANTHROPIC_BASE_URL':_0x427dc2[_0x2fb0d3(0x231)],'ANTHROPIC_MODEL':_0x427dc2['ANTHROPIC_MODEL']},_0x1f8e20={..._0xc28453,'env':{..._0x427dc2,'ANTHROPIC_BASE_URL':'http://127.0.0.1:'+_0x47f909,'ANTHROPIC_MODEL':_0x410b4b}};return await writeFile(_0x2ff236,JSON[_0x2fb0d3(0x1f5)](_0x1f8e20,null,0x2)+'\x0a'),_0x50004c;}async function restoreClaudeSettings(_0x10d7f5){const _0x2d7f6c=a12_0x4b25,_0x425cbb=join(process[_0x2d7f6c(0x237)](),_0x2d7f6c(0x23d)),_0x161542=join(_0x425cbb,_0x2d7f6c(0x215));if(!existsSync(_0x161542))return;try{const _0x23f9e0=await readFile(_0x161542,_0x2d7f6c(0x240)),_0x481a59=JSON['parse'](_0x23f9e0),_0x4d4565=_0x481a59[_0x2d7f6c(0x22f)]||{},_0x4a2dd8=_0x4d4565[_0x2d7f6c(0x231)],_0x11324a=((()=>{const _0x2512d8=_0x2d7f6c;if(typeof _0x4a2dd8!=='string')return![];try{const _0x4a1f7b=new URL(_0x4a2dd8);return _0x4a1f7b['hostname']===_0x2512d8(0x20c)||_0x4a1f7b[_0x2512d8(0x1fb)]==='127.0.0.1';}catch{return![];}})());_0x11324a?(delete _0x4d4565[_0x2d7f6c(0x231)],delete _0x4d4565['ANTHROPIC_MODEL']):(_0x10d7f5[_0x2d7f6c(0x231)]!==undefined?_0x4d4565[_0x2d7f6c(0x231)]=_0x10d7f5[_0x2d7f6c(0x231)]:delete _0x4d4565[_0x2d7f6c(0x231)],_0x10d7f5[_0x2d7f6c(0x1e6)]!==undefined?_0x4d4565[_0x2d7f6c(0x1e6)]=_0x10d7f5[_0x2d7f6c(0x1e6)]:delete _0x4d4565[_0x2d7f6c(0x1e6)]),_0x481a59['env']=_0x4d4565,await writeFile(_0x161542,JSON['stringify'](_0x481a59,null,0x2)+'\x0a');}catch{}}function a12_0x1092(){const _0x38ce44=['site','settings.local.json','✓\x20Marketplace\x20\x27','stderr','12261dvCaou','Setting\x20up\x20project...','trim','log','✓\x20Logging\x20to\x20','plugin','Failed\x20to\x20update\x20marketplace\x20\x27','sonnet','639954jfGBEw','sql-skills','Command\x20failed\x20(exit\x20','Failed\x20to\x20launch\x20Claude\x20Code:\x20','\x27...','Updating\x20marketplace\x20\x27','fail','name','green','server','1492EzCCos','✓\x20Settings\x20configured:\x20.claude/settings.local.json','td-skills','claude','mcp','env','close','ANTHROPIC_BASE_URL','Executing:\x20claude\x20','debug','Failed\x20to\x20configure\x20MCP\x20server\x20\x27','info','INSTALLATION_FAILED','cwd','tdx-skills','parse','Setup\x20failed','originalEnv','786028EhgVTQ','.claude','install','model','utf-8','text','toString','warn','init','logLevel','already\x20configured','data','Installing\x20plugin\x20\x27','cause','verbose','532657nrYsmT','add','pipe','findClaudePath','ANTHROPIC_MODEL','getOrCreateDefaultProject','llm','✓\x20Plugin\x20\x27','--transport','workflow-skills','):\x20claude\x20','440270UjYiMw','149874BkIXqw','already\x20exists','getLogPath','logger','Configuring\x20MCP\x20server\x20\x27','inherit','140zkrCwI','stringify','Initializing\x20proxy\x20logger...','\x27\x20installed','start','✓\x20Using\x20project:\x20','message','hostname','marketplace','✓\x20Port\x20','stdout','8EuNXKi','✓\x20Logs\x20saved\x20to\x20','\x20already\x20configured','td-skills\x20Plugins','27070310uFYihy','Configuring\x20marketplace\x20\x27','Failed\x20to\x20configure\x20marketplace\x20\x27','\x20configuration\x20failed','error','http','https://td-docs.redocly.app/mcp','Warning:\x20Failed\x20to\x20configure\x20','exit','localhost','Claude\x20Code\x20CLI\x20not\x20found','execute','td-docs','red','join','attributes','stop'];a12_0x1092=function(){return _0x38ce44;};return a12_0x1092();}export class ClaudeCommand extends BaseCommand{[a12_0x4cced6(0x227)]=a12_0x4cced6(0x22d);['description']='Launch\x20Claude\x20Code\x20with\x20integrated\x20LLM\x20proxy';['server'];[a12_0x4cced6(0x23b)];[a12_0x4cced6(0x1f1)];async[a12_0x4cced6(0x20e)](_0x543e11){const _0x548b0a=a12_0x4cced6,{tdx:_0x5dbe85,options:_0x568592,args:_0x1c1132}=_0x543e11;try{const _0x4fb888=_0x568592,_0x5161b4=_0x4fb888[_0x548b0a(0x23f)]||_0x548b0a(0x21f),_0x4cf99b=createCommandSpinner('Initializing...',{'verbose':_0x568592[_0x548b0a(0x1e1)]});_0x4cf99b[_0x548b0a(0x1f8)]();try{_0x4cf99b['text']='Finding\x20available\x20port...';const _0x956fea=await findAvailablePort(0xfa0);_0x4cf99b[_0x548b0a(0x241)]=_0x548b0a(0x1fd)+_0x956fea,_0x4cf99b[_0x548b0a(0x241)]=_0x548b0a(0x219);const _0x14654a=await _0x5dbe85[_0x548b0a(0x1e8)][_0x548b0a(0x1e7)](),_0x221c7a=_0x14654a['id'];_0x4cf99b['text']=_0x548b0a(0x1f9)+_0x14654a[_0x548b0a(0x212)][_0x548b0a(0x227)],_0x4cf99b[_0x548b0a(0x241)]=_0x548b0a(0x1f6),this[_0x548b0a(0x1f1)]=new TDXLogger(_0x568592[_0x548b0a(0x1dc)],!![]),await this[_0x548b0a(0x1f1)][_0x548b0a(0x1db)]();const _0x849346=this[_0x548b0a(0x1f1)][_0x548b0a(0x1f0)]();_0x4cf99b[_0x548b0a(0x241)]=_0x548b0a(0x21c)+_0x849346,_0x4cf99b[_0x548b0a(0x241)]='Starting\x20TD\x20LLM\x20proxy\x20server...',this[_0x548b0a(0x229)]=new ProxyServer({'port':_0x956fea,'projectId':_0x221c7a,'tdx':_0x5dbe85,'logger':this[_0x548b0a(0x1f1)],'site':_0x568592[_0x548b0a(0x214)]}),await this['server'][_0x548b0a(0x1f8)](),_0x4cf99b[_0x548b0a(0x241)]='✓\x20TD\x20LLM\x20proxy\x20running\x20on\x20port\x20'+_0x956fea,_0x4cf99b[_0x548b0a(0x241)]='Creating\x20.claude/settings.local.json...',this[_0x548b0a(0x23b)]=await createClaudeSettings(_0x956fea,_0x5161b4),_0x4cf99b['text']=_0x548b0a(0x22b);try{await ensureMcpServer(_0x548b0a(0x20f),_0x548b0a(0x209),_0x548b0a(0x208),_0x4cf99b,this[_0x548b0a(0x1f1)]);}catch(_0x1d02fe){handleInstallationError(_0x1d02fe,'TD\x20Docs\x20MCP\x20Server',_0x4cf99b,this['logger']);}try{await ensureMarketplace(_0x548b0a(0x22c),'https://github.com/treasure-data/td-skills',_0x4cf99b,this[_0x548b0a(0x1f1)]),await updateMarketplace(_0x548b0a(0x22c),_0x4cf99b,this[_0x548b0a(0x1f1)]),await ensurePlugin(_0x548b0a(0x221),_0x548b0a(0x22c),_0x4cf99b,this[_0x548b0a(0x1f1)]),await ensurePlugin(_0x548b0a(0x1eb),_0x548b0a(0x22c),_0x4cf99b,this['logger']),await ensurePlugin(_0x548b0a(0x238),'td-skills',_0x4cf99b,this[_0x548b0a(0x1f1)]);}catch(_0x34914e){handleInstallationError(_0x34914e,_0x548b0a(0x202),_0x4cf99b,this[_0x548b0a(0x1f1)]);}_0x4cf99b[_0x548b0a(0x213)]();}catch(_0x495117){_0x4cf99b[_0x548b0a(0x226)](_0x548b0a(0x23a));throw _0x495117;}const _0x3701fc=await this[_0x548b0a(0x1e5)]();if(!_0x3701fc)throw new SDKError(ErrorCode['COMMAND_NOT_FOUND'],_0x548b0a(0x20d),undefined,{'helpText':'Please\x20install\x20Claude\x20Code\x20from\x20https://claude.com/claude-code'});const _0x205791=spawn(_0x3701fc,_0x1c1132,{'stdio':_0x548b0a(0x1f3)}),_0xe24297=await new Promise(_0x4df889=>{_0x205791['on']('exit',_0x500ee2=>{_0x4df889(_0x500ee2||0x0);}),_0x205791['on']('error',_0x2c11e0=>{const _0x519b2e=a12_0x4b25;console[_0x519b2e(0x207)](a12_0x59483f[_0x519b2e(0x210)](_0x519b2e(0x223)+_0x2c11e0[_0x519b2e(0x1fa)])),_0x4df889(0x1);});});this[_0x548b0a(0x229)]&&(await this[_0x548b0a(0x229)][_0x548b0a(0x213)](),console['log'](a12_0x59483f[_0x548b0a(0x228)]('✓\x20TD\x20LLM\x20proxy\x20server\x20stopped')));if(this['logger']){await this[_0x548b0a(0x1f1)][_0x548b0a(0x230)]();const _0x4edcd0=this[_0x548b0a(0x1f1)][_0x548b0a(0x1f0)]();console[_0x548b0a(0x21b)](a12_0x59483f[_0x548b0a(0x228)](_0x548b0a(0x200)+_0x4edcd0));}return this[_0x548b0a(0x23b)]&&(await restoreClaudeSettings(this[_0x548b0a(0x23b)]),console[_0x548b0a(0x21b)](a12_0x59483f[_0x548b0a(0x228)]('✓\x20Settings\x20restored:\x20.claude/settings.local.json'))),_0xe24297;}catch(_0x1f10bd){this['server']&&await this[_0x548b0a(0x229)][_0x548b0a(0x213)]();this['logger']&&await this[_0x548b0a(0x1f1)][_0x548b0a(0x230)]();this[_0x548b0a(0x23b)]&&await restoreClaudeSettings(this[_0x548b0a(0x23b)]);throw _0x1f10bd;}}async[a12_0x4cced6(0x1e5)](){return new Promise(_0xecad68=>{const _0x1d240f=a12_0x4b25,_0x14aa48=spawn('which',['claude']);let _0x5149b9='';_0x14aa48[_0x1d240f(0x1fe)]['on']('data',_0x3f472d=>{_0x5149b9+=_0x3f472d['toString']();}),_0x14aa48['on'](_0x1d240f(0x20b),_0x36b1e3=>{const _0x1df214=_0x1d240f;_0x36b1e3===0x0&&_0x5149b9[_0x1df214(0x21a)]()?_0xecad68(_0x5149b9[_0x1df214(0x21a)]()):_0xecad68(_0x1df214(0x22d));});});}}
@@ -1 +1 @@
1
- const a13_0x5bef4f=a13_0x43cd;(function(_0x382b1d,_0x113eb6){const _0xe753d5=a13_0x43cd,_0xa32d7d=_0x382b1d();while(!![]){try{const _0x87af41=parseInt(_0xe753d5(0x1c0))/0x1+-parseInt(_0xe753d5(0x1b4))/0x2*(parseInt(_0xe753d5(0x1bc))/0x3)+parseInt(_0xe753d5(0x1b3))/0x4+-parseInt(_0xe753d5(0x1a8))/0x5*(-parseInt(_0xe753d5(0x1c1))/0x6)+-parseInt(_0xe753d5(0x1cb))/0x7+parseInt(_0xe753d5(0x1be))/0x8*(-parseInt(_0xe753d5(0x1a2))/0x9)+parseInt(_0xe753d5(0x1b9))/0xa*(parseInt(_0xe753d5(0x1ce))/0xb);if(_0x87af41===_0x113eb6)break;else _0xa32d7d['push'](_0xa32d7d['shift']());}catch(_0x1ae648){_0xa32d7d['push'](_0xa32d7d['shift']());}}}(a13_0x77c2,0x4f220));import{validateLimitOption}from'../utils/option-validation.js';import{HTTPClientError}from'../client/http-client.js';import a13_0x2f3ec2 from'chalk';function a13_0x77c2(){const _0x5e7f7b=['Error:\x20','.\x20Must\x20be\x20a\x20number.','Reason:\x20','message','validateGlobalOptions','452774kUJJNr','status','validate','2178syqvvO','commands','\x0aStack\x20trace:\x0a','Authentication\x20error\x20stack\x20trace:','helpText','detail','27WauzzW','get','Authentication\x20failed','name','Command\x20\x27','value','915zPeOeh','problemDetails','isValid','red','tdx','limit','stack','debug','run','logger','\x20\x20tdx\x20auth\x20setup\x0a','1335156vNEvGo','26RMLlAE','values','\x20\x20tdx\x20auth','execute','options','18440PGDDPR','error','Invalid\x20limit\x20value:\x20','34725HDoOcm','number','1193688htnLJg','\x0aTo\x20set\x20up\x20authentication:','186086npGxdA','3342RckNyU','set','from','has','test'];a13_0x77c2=function(){return _0x5e7f7b;};return a13_0x77c2();}export function printAuthError(_0x8534fe,_0x109ca9=![]){const _0x38d7f5=a13_0x43cd,_0xa3637b=_0x8534fe[_0x38d7f5(0x1a9)]?.[_0x38d7f5(0x1a1)]||_0x8534fe[_0x38d7f5(0x1c9)];console[_0x38d7f5(0x1ba)](a13_0x2f3ec2[_0x38d7f5(0x1ab)](_0x38d7f5(0x1a4))),console[_0x38d7f5(0x1ba)](a13_0x2f3ec2[_0x38d7f5(0x1ab)](_0x38d7f5(0x1c8)+_0xa3637b)),_0x109ca9&&(console[_0x38d7f5(0x1ba)](_0x38d7f5(0x1bf)),console[_0x38d7f5(0x1ba)](_0x38d7f5(0x1b2)),console[_0x38d7f5(0x1ba)]('To\x20check\x20your\x20current\x20auth\x20status:'),console[_0x38d7f5(0x1ba)](_0x38d7f5(0x1b6)));}function a13_0x43cd(_0xa5f455,_0x491ed7){const _0x77c2ce=a13_0x77c2();return a13_0x43cd=function(_0x43cdca,_0x3dd97d){_0x43cdca=_0x43cdca-0x19f;let _0x1c96b8=_0x77c2ce[_0x43cdca];return _0x1c96b8;},a13_0x43cd(_0xa5f455,_0x491ed7);}export class BaseCommand{[a13_0x5bef4f(0x1ca)](_0x3c512b){const _0x12bf82=a13_0x5bef4f,{options:_0x112c88}=_0x3c512b,_0x3910d2=_0x112c88[_0x12bf82(0x1ad)];if(_0x3910d2!==undefined){const _0x5d7790=typeof _0x3910d2===_0x12bf82(0x1bd)?_0x3910d2:parseInt(_0x3910d2,0xa);if(isNaN(_0x5d7790))return _0x12bf82(0x1bb)+_0x3910d2+_0x12bf82(0x1c7);const _0x145d52=validateLimitOption(_0x5d7790);if(!_0x145d52[_0x12bf82(0x1aa)])return _0x145d52[_0x12bf82(0x1ba)];_0x3c512b[_0x12bf82(0x1b8)][_0x12bf82(0x1ad)]=_0x145d52[_0x12bf82(0x1a7)];}return undefined;}[a13_0x5bef4f(0x1cd)](_0x2300db){return undefined;}async[a13_0x5bef4f(0x1b0)](_0x1a2be8){const _0x8d62eb=a13_0x5bef4f;try{const _0x30a69d=this[_0x8d62eb(0x1ca)](_0x1a2be8);if(_0x30a69d)return console['error']('Error:\x20'+_0x30a69d),0x1;const _0x3384b9=this['validate'](_0x1a2be8);if(_0x3384b9){const _0x139aa4=/^\s*(Usage|Note|Warning|Error):/i[_0x8d62eb(0x1c5)](_0x3384b9);return _0x139aa4?console[_0x8d62eb(0x1ba)](_0x3384b9):console[_0x8d62eb(0x1ba)](_0x8d62eb(0x1c6)+_0x3384b9),0x1;}const _0x44abd2=await this[_0x8d62eb(0x1b7)](_0x1a2be8);return _0x44abd2??0x0;}catch(_0x4884c4){if(_0x4884c4 instanceof Error){if(_0x4884c4 instanceof HTTPClientError&&_0x4884c4[_0x8d62eb(0x1cc)]===0x191)return printAuthError(_0x4884c4,!![]),_0x4884c4[_0x8d62eb(0x1ae)]&&_0x1a2be8[_0x8d62eb(0x1ac)]&&(_0x1a2be8['tdx']['logger']['debug'](_0x8d62eb(0x19f)),_0x1a2be8[_0x8d62eb(0x1ac)][_0x8d62eb(0x1b1)][_0x8d62eb(0x1af)](_0x4884c4[_0x8d62eb(0x1ae)])),0x1;console[_0x8d62eb(0x1ba)](_0x8d62eb(0x1c6)+_0x4884c4['message']);const _0xeb1231=_0x4884c4;_0xeb1231['helpText']&&console[_0x8d62eb(0x1ba)](_0xeb1231[_0x8d62eb(0x1a0)]),_0x4884c4[_0x8d62eb(0x1ae)]&&console[_0x8d62eb(0x1ba)](_0x8d62eb(0x1d0)+_0x4884c4['stack']);}else console['error'](_0x8d62eb(0x1c6)+String(_0x4884c4));return 0x1;}}}export class CommandRegistry{[a13_0x5bef4f(0x1cf)]=new Map();['register'](_0x4f3f18){const _0x13aaf8=a13_0x5bef4f;if(this[_0x13aaf8(0x1cf)][_0x13aaf8(0x1c4)](_0x4f3f18['name']))throw new Error(_0x13aaf8(0x1a6)+_0x4f3f18['name']+'\x27\x20is\x20already\x20registered');this[_0x13aaf8(0x1cf)][_0x13aaf8(0x1c2)](_0x4f3f18[_0x13aaf8(0x1a5)],_0x4f3f18);}[a13_0x5bef4f(0x1a3)](_0x420698){const _0x311ed3=a13_0x5bef4f;return this[_0x311ed3(0x1cf)][_0x311ed3(0x1a3)](_0x420698);}['getAll'](){const _0xad5e39=a13_0x5bef4f;return Array[_0xad5e39(0x1c3)](this[_0xad5e39(0x1cf)][_0xad5e39(0x1b5)]());}['has'](_0x422202){const _0x212f52=a13_0x5bef4f;return this[_0x212f52(0x1cf)]['has'](_0x422202);}}export const registry=new CommandRegistry();
1
+ const a13_0x1e442a=a13_0x4445;(function(_0x1fbe99,_0x1e2278){const _0x41b485=a13_0x4445,_0x5790c4=_0x1fbe99();while(!![]){try{const _0x123dc3=-parseInt(_0x41b485(0x106))/0x1+parseInt(_0x41b485(0x104))/0x2+parseInt(_0x41b485(0xf2))/0x3*(parseInt(_0x41b485(0x118))/0x4)+-parseInt(_0x41b485(0xf9))/0x5*(-parseInt(_0x41b485(0x10e))/0x6)+parseInt(_0x41b485(0xfe))/0x7+-parseInt(_0x41b485(0x10b))/0x8*(-parseInt(_0x41b485(0x10d))/0x9)+-parseInt(_0x41b485(0xfa))/0xa*(parseInt(_0x41b485(0x100))/0xb);if(_0x123dc3===_0x1e2278)break;else _0x5790c4['push'](_0x5790c4['shift']());}catch(_0x2a5f6d){_0x5790c4['push'](_0x5790c4['shift']());}}}(a13_0x2b52,0x263e4));import{validateLimitOption}from'../utils/option-validation.js';import{HTTPClientError}from'../client/http-client.js';function a13_0x4445(_0x18dd02,_0x2c9ac2){const _0x2b52f5=a13_0x2b52();return a13_0x4445=function(_0x444545,_0x1e4a2b){_0x444545=_0x444545-0xef;let _0x55cfb1=_0x2b52f5[_0x444545];return _0x55cfb1;},a13_0x4445(_0x18dd02,_0x2c9ac2);}import a13_0x469626 from'chalk';export function printAuthError(_0x384ee0,_0x3acb96=![]){const _0x4a9ad=a13_0x4445,_0x5a17dd=_0x384ee0['problemDetails']?.['detail']||_0x384ee0['message'];console[_0x4a9ad(0x103)](a13_0x469626[_0x4a9ad(0xff)](_0x4a9ad(0x11c))),console[_0x4a9ad(0x103)](a13_0x469626[_0x4a9ad(0xff)](_0x4a9ad(0x113)+_0x5a17dd)),_0x3acb96&&(console[_0x4a9ad(0x103)](_0x4a9ad(0x108)),console[_0x4a9ad(0x103)]('\x20\x20tdx\x20auth\x20setup\x0a'),console[_0x4a9ad(0x103)](_0x4a9ad(0x109)),console[_0x4a9ad(0x103)](_0x4a9ad(0x116)));}export class BaseCommand{['validateGlobalOptions'](_0x17b9d1){const _0x4e63b6=a13_0x4445,{options:_0x2f6e40}=_0x17b9d1,_0x410877=_0x2f6e40['limit'];if(_0x410877!==undefined){const _0x137a78=typeof _0x410877===_0x4e63b6(0x114)?_0x410877:parseInt(_0x410877,0xa);if(isNaN(_0x137a78))return _0x4e63b6(0x110)+_0x410877+_0x4e63b6(0x10a);const _0x5eb737=validateLimitOption(_0x137a78);if(!_0x5eb737[_0x4e63b6(0xf8)])return _0x5eb737[_0x4e63b6(0x103)];_0x17b9d1[_0x4e63b6(0xf5)][_0x4e63b6(0xf7)]=_0x5eb737['value'];}return undefined;}[a13_0x1e442a(0xef)](_0x527a66){return undefined;}async[a13_0x1e442a(0x107)](_0x49ed4b){const _0x149c71=a13_0x1e442a;try{const _0x1056ca=this[_0x149c71(0xf4)](_0x49ed4b);if(_0x1056ca)return console[_0x149c71(0x103)](_0x149c71(0x11b)+_0x1056ca),0x1;const _0x602acd=this['validate'](_0x49ed4b);if(_0x602acd){const _0x46846f=/^\s*(Usage|Note|Warning|Error):/i[_0x149c71(0x102)](_0x602acd);return _0x46846f?console[_0x149c71(0x103)](_0x602acd):console[_0x149c71(0x103)](_0x149c71(0x11b)+_0x602acd),0x1;}const _0x3f3f5f=await this[_0x149c71(0x11d)](_0x49ed4b);return _0x3f3f5f??0x0;}catch(_0x5481fb){if(_0x5481fb instanceof Error){if(_0x5481fb instanceof HTTPClientError&&_0x5481fb[_0x149c71(0x11f)]===0x191)return printAuthError(_0x5481fb,!![]),_0x5481fb['stack']&&_0x49ed4b[_0x149c71(0x111)]&&(_0x49ed4b[_0x149c71(0x111)][_0x149c71(0xf1)]['debug']('Authentication\x20error\x20stack\x20trace:'),_0x49ed4b['tdx'][_0x149c71(0xf1)][_0x149c71(0x101)](_0x5481fb['stack'])),0x1;console[_0x149c71(0x103)](_0x149c71(0x11b)+_0x5481fb[_0x149c71(0xf0)]);const _0x32378a=_0x5481fb;_0x32378a[_0x149c71(0xf3)]&&console[_0x149c71(0x103)](_0x32378a[_0x149c71(0xf3)]),_0x5481fb[_0x149c71(0x11a)]&&console['error'](_0x149c71(0xfb)+_0x5481fb[_0x149c71(0x11a)]);}else console[_0x149c71(0x103)](_0x149c71(0x11b)+String(_0x5481fb));return 0x1;}}}export class CommandRegistry{[a13_0x1e442a(0x119)]=new Map();[a13_0x1e442a(0xf6)](_0x132551){const _0x42513d=a13_0x1e442a;if(this[_0x42513d(0x119)][_0x42513d(0xfc)](_0x132551[_0x42513d(0xfd)]))throw new Error(_0x42513d(0x115)+_0x132551[_0x42513d(0xfd)]+_0x42513d(0x112));this[_0x42513d(0x119)][_0x42513d(0x10f)](_0x132551[_0x42513d(0xfd)],_0x132551);}[a13_0x1e442a(0x117)](_0x2c037b){const _0x2f5579=a13_0x1e442a;return this[_0x2f5579(0x119)][_0x2f5579(0x117)](_0x2c037b);}[a13_0x1e442a(0x105)](){const _0x324adb=a13_0x1e442a;return Array[_0x324adb(0x10c)](this[_0x324adb(0x119)][_0x324adb(0x11e)]());}[a13_0x1e442a(0xfc)](_0x1d8342){const _0x5794c9=a13_0x1e442a;return this[_0x5794c9(0x119)]['has'](_0x1d8342);}}function a13_0x2b52(){const _0x12a741=['validate','message','logger','1398JTxapl','helpText','validateGlobalOptions','options','register','limit','isValid','50PxSJnN','10sSXnTW','\x0aStack\x20trace:\x0a','has','name','2116597oYCBII','red','3838318wULWHQ','debug','test','error','160240uVfEiT','getAll','181197kWHjZa','run','\x0aTo\x20set\x20up\x20authentication:','To\x20check\x20your\x20current\x20auth\x20status:','.\x20Must\x20be\x20a\x20number.','34544lDxsGL','from','171jHkBOB','258mFXUIh','set','Invalid\x20limit\x20value:\x20','tdx','\x27\x20is\x20already\x20registered','Reason:\x20','number','Command\x20\x27','\x20\x20tdx\x20auth','get','1904PgZoIg','commands','stack','Error:\x20','Authentication\x20failed','execute','values','status'];a13_0x2b52=function(){return _0x12a741;};return a13_0x2b52();}export const registry=new CommandRegistry();
@@ -1 +1 @@
1
- const a14_0x228142=a14_0x5ca0;(function(_0x506394,_0x512745){const _0x2ec18e=a14_0x5ca0,_0x3887f0=_0x506394();while(!![]){try{const _0x44f137=parseInt(_0x2ec18e(0x166))/0x1*(parseInt(_0x2ec18e(0x15b))/0x2)+parseInt(_0x2ec18e(0x15c))/0x3*(-parseInt(_0x2ec18e(0x16a))/0x4)+parseInt(_0x2ec18e(0x168))/0x5*(-parseInt(_0x2ec18e(0x15f))/0x6)+parseInt(_0x2ec18e(0x158))/0x7*(parseInt(_0x2ec18e(0x16e))/0x8)+-parseInt(_0x2ec18e(0x16b))/0x9*(parseInt(_0x2ec18e(0x16c))/0xa)+-parseInt(_0x2ec18e(0x159))/0xb+parseInt(_0x2ec18e(0x16d))/0xc;if(_0x44f137===_0x512745)break;else _0x3887f0['push'](_0x3887f0['shift']());}catch(_0x6533b2){_0x3887f0['push'](_0x3887f0['shift']());}}}(a14_0x46c8,0x9a10d));function a14_0x5ca0(_0x2566c2,_0x118731){const _0x46c847=a14_0x46c8();return a14_0x5ca0=function(_0x5ca022,_0x580097){_0x5ca022=_0x5ca022-0x157;let _0x26285f=_0x46c847[_0x5ca022];return _0x26285f;},a14_0x5ca0(_0x2566c2,_0x118731);}import{BaseCommand}from'./command.js';import{GlobalContext}from'../core/global-context.js';import{cleanExpiredSessions,clearSessionContext,getCurrentSessionPID}from'../core/session.js';export class ContextCommand extends BaseCommand{[a14_0x228142(0x167)]=a14_0x228142(0x160);[a14_0x228142(0x164)]=a14_0x228142(0x15e);async[a14_0x228142(0x165)](_0x407a12){const _0x4aebe6=a14_0x228142,{options:_0x11fd4d}=_0x407a12,_0xeedeec=_0x11fd4d['debug'],_0x5ae47d=_0x11fd4d[_0x4aebe6(0x16f)];cleanExpiredSessions();try{if(_0x5ae47d){clearSessionContext(_0x11fd4d[_0x4aebe6(0x157)]);const _0x1941b2=_0x11fd4d[_0x4aebe6(0x157)]||getCurrentSessionPID()[_0x4aebe6(0x15a)]();return console[_0x4aebe6(0x163)](_0x4aebe6(0x162)+_0x1941b2+')'),0x0;}const _0x2fa36f=new GlobalContext(_0x11fd4d);return _0xeedeec?_0x2fa36f[_0x4aebe6(0x15d)]():_0x2fa36f[_0x4aebe6(0x161)](),0x0;}catch(_0x27f52a){return _0x27f52a instanceof Error&&console[_0x4aebe6(0x169)]('Error:\x20'+_0x27f52a['message']),0x1;}}}function a14_0x46c8(){const _0x487e7b=['error','368tPTIrB','9277992biiDTh','10lNFgWt','26615916YUphHq','8ClqAQl','clear','session','4166995TQWfUm','7930032vzgtAL','toString','43726DPohBL','26067Oaepqt','displayWithSources','Show\x20current\x20resolved\x20context','108hGhYiD','context','display','Session\x20context\x20cleared\x20(session:\x20','log','description','execute','31XYHRmC','name','85775gxuqIi'];a14_0x46c8=function(){return _0x487e7b;};return a14_0x46c8();}
1
+ const a14_0x5a7d5e=a14_0x107b;function a14_0x2f68(){const _0x451bc5=['644996UjJkun','2616339fFHvIo','description','displayWithSources','12714993anSGJp','display','112XeXrqP','context','execute','Error:\x20','error','3935QUiJlG','15JSsPFc','log','416GwGFMH','session','message','8925378yzSozN','toString','288696HWnoYs','578137VsZiuX','70yrVaiF','name','clear'];a14_0x2f68=function(){return _0x451bc5;};return a14_0x2f68();}function a14_0x107b(_0x3dbab2,_0x53713a){const _0x2f6873=a14_0x2f68();return a14_0x107b=function(_0x107b11,_0x29757b){_0x107b11=_0x107b11-0x148;let _0x171631=_0x2f6873[_0x107b11];return _0x171631;},a14_0x107b(_0x3dbab2,_0x53713a);}(function(_0x2d94d2,_0x4b21dc){const _0x3a1f58=a14_0x107b,_0x26c8fa=_0x2d94d2();while(!![]){try{const _0x3dc156=parseInt(_0x3a1f58(0x15e))/0x1*(parseInt(_0x3a1f58(0x149))/0x2)+-parseInt(_0x3a1f58(0x14e))/0x3+-parseInt(_0x3a1f58(0x153))/0x4*(parseInt(_0x3a1f58(0x15f))/0x5)+parseInt(_0x3a1f58(0x14c))/0x6+-parseInt(_0x3a1f58(0x14f))/0x7*(parseInt(_0x3a1f58(0x159))/0x8)+-parseInt(_0x3a1f58(0x157))/0x9+parseInt(_0x3a1f58(0x150))/0xa*(parseInt(_0x3a1f58(0x154))/0xb);if(_0x3dc156===_0x4b21dc)break;else _0x26c8fa['push'](_0x26c8fa['shift']());}catch(_0x17a8b5){_0x26c8fa['push'](_0x26c8fa['shift']());}}}(a14_0x2f68,0xc8ac4));import{BaseCommand}from'./command.js';import{GlobalContext}from'../core/global-context.js';import{cleanExpiredSessions,clearSessionContext,getCurrentSessionPID}from'../core/session.js';export class ContextCommand extends BaseCommand{[a14_0x5a7d5e(0x151)]=a14_0x5a7d5e(0x15a);[a14_0x5a7d5e(0x155)]='Show\x20current\x20resolved\x20context';async[a14_0x5a7d5e(0x15b)](_0x1dc5f9){const _0x53d576=a14_0x5a7d5e,{options:_0xff2f68}=_0x1dc5f9,_0x18a096=_0xff2f68['debug'],_0x348506=_0xff2f68[_0x53d576(0x152)];cleanExpiredSessions();try{if(_0x348506){clearSessionContext(_0xff2f68['session']);const _0x15e72f=_0xff2f68[_0x53d576(0x14a)]||getCurrentSessionPID()[_0x53d576(0x14d)]();return console[_0x53d576(0x148)]('Session\x20context\x20cleared\x20(session:\x20'+_0x15e72f+')'),0x0;}const _0xc43622=new GlobalContext(_0xff2f68);return _0x18a096?_0xc43622[_0x53d576(0x156)]():_0xc43622[_0x53d576(0x158)](),0x0;}catch(_0x506d5e){return _0x506d5e instanceof Error&&console[_0x53d576(0x15d)](_0x53d576(0x15c)+_0x506d5e[_0x53d576(0x14b)]),0x1;}}}
@@ -1 +1 @@
1
- const a15_0x428958=a15_0x4fd4;(function(_0x1eea10,_0x1e1832){const _0x128b5a=a15_0x4fd4,_0xe18b23=_0x1eea10();while(!![]){try{const _0x51d0c5=-parseInt(_0x128b5a(0x1f0))/0x1+parseInt(_0x128b5a(0x1d7))/0x2+-parseInt(_0x128b5a(0x1e9))/0x3+parseInt(_0x128b5a(0x1ed))/0x4+-parseInt(_0x128b5a(0x1d8))/0x5*(parseInt(_0x128b5a(0x1dc))/0x6)+parseInt(_0x128b5a(0x1e1))/0x7*(-parseInt(_0x128b5a(0x1e3))/0x8)+parseInt(_0x128b5a(0x1ec))/0x9;if(_0x51d0c5===_0x1e1832)break;else _0xe18b23['push'](_0xe18b23['shift']());}catch(_0x2c6e6c){_0xe18b23['push'](_0xe18b23['shift']());}}}(a15_0x5a65,0xe36ef));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';import{handleSDKOutput}from'../utils/command-output.js';import{withSpinner}from'../utils/spinner.js';import{DEFAULT_LISTING_LIMIT,resolveLimit}from'../utils/constants.js';function a15_0x5a65(){const _0x40a3de=['cause','length','site','1676508mPideV','Site:\x20','✔\x20Found\x20','Error:\x20','execute','3086573GAwRyI','verbose','8nQkwhx','Pattern:\x20','error','Listing\x20databases...','List\x20all\x20databases','description','5348982BZAzsj','name','limit','38859336tglJAh','4754124sXLWle','message','\x20database','1454801CgZYmZ','443476snWXAE','20MlxjYD'];a15_0x5a65=function(){return _0x40a3de;};return a15_0x5a65();}function a15_0x4fd4(_0x72f967,_0x103139){const _0x5a6519=a15_0x5a65();return a15_0x4fd4=function(_0x4fd4f1,_0x3d4b8b){_0x4fd4f1=_0x4fd4f1-0x1d7;let _0x151b2d=_0x5a6519[_0x4fd4f1];return _0x151b2d;},a15_0x4fd4(_0x72f967,_0x103139);}export class DatabasesCommand extends BaseCommand{[a15_0x428958(0x1ea)]='databases';[a15_0x428958(0x1e8)]=a15_0x428958(0x1e7);async[a15_0x428958(0x1e0)](_0x5b9ad0){const _0x53aca2=a15_0x428958,{options:_0x25ba60,args:_0x486f64,tdx:_0x4280fb}=_0x5b9ad0,_0x57520e=_0x486f64[0x0];try{_0x25ba60[_0x53aca2(0x1e2)]&&(console['error'](_0x53aca2(0x1dd)+_0x25ba60[_0x53aca2(0x1db)]),_0x57520e&&console[_0x53aca2(0x1e5)](_0x53aca2(0x1e4)+_0x57520e));const _0x33c461=resolveLimit(_0x25ba60[_0x53aca2(0x1eb)],DEFAULT_LISTING_LIMIT),_0x3cfd6b=await withSpinner(_0x53aca2(0x1e6),()=>_0x4280fb['query']['listDatabases'](_0x57520e,_0x33c461),{'verbose':_0x25ba60[_0x53aca2(0x1e2)]}),_0x3f1f42=_0x3cfd6b['data'];return console[_0x53aca2(0x1e5)](_0x53aca2(0x1de)+_0x3f1f42['length']+_0x53aca2(0x1ef)+(_0x3f1f42[_0x53aca2(0x1da)]!==0x1?'s':'')),await handleSDKOutput(_0x3f1f42,{..._0x25ba60,'limit':_0x33c461}),0x0;}catch(_0x45326e){if(_0x45326e instanceof SDKError)return console[_0x53aca2(0x1e5)](_0x53aca2(0x1df)+_0x45326e[_0x53aca2(0x1ee)]),_0x45326e[_0x53aca2(0x1d9)]&&console[_0x53aca2(0x1e5)]('\x20\x20Cause:\x20'+_0x45326e[_0x53aca2(0x1d9)]),0x1;throw _0x45326e;}}}
1
+ function a15_0x366c(_0x54652e,_0x1a3c09){const _0x4a4120=a15_0x4a41();return a15_0x366c=function(_0x366c3f,_0x142601){_0x366c3f=_0x366c3f-0x10c;let _0xdc8119=_0x4a4120[_0x366c3f];return _0xdc8119;},a15_0x366c(_0x54652e,_0x1a3c09);}function a15_0x4a41(){const _0x7ff216=['\x20\x20Cause:\x20','execute','List\x20all\x20databases','1171208ikbDeb','28seNJMp','cause','519VtvRJQ','databases','1982730dMtgbG','3538aBZBcF','data','27bygedl','error','Listing\x20databases...','description','Error:\x20','query','Pattern:\x20','site','935340SKynop','Site:\x20','✔\x20Found\x20','limit','60438QmnYsf','107236ykykcb','1984920yBMqfy','length','message','\x20database','verbose'];a15_0x4a41=function(){return _0x7ff216;};return a15_0x4a41();}const a15_0x1a276f=a15_0x366c;(function(_0x42a48d,_0x4e9816){const _0x27c461=a15_0x366c,_0x245b02=_0x42a48d();while(!![]){try{const _0x2eff9b=-parseInt(_0x27c461(0x125))/0x1+-parseInt(_0x27c461(0x116))/0x2*(-parseInt(_0x27c461(0x113))/0x3)+parseInt(_0x27c461(0x120))/0x4+parseInt(_0x27c461(0x126))/0x5+parseInt(_0x27c461(0x124))/0x6*(parseInt(_0x27c461(0x111))/0x7)+-parseInt(_0x27c461(0x110))/0x8*(parseInt(_0x27c461(0x118))/0x9)+-parseInt(_0x27c461(0x115))/0xa;if(_0x2eff9b===_0x4e9816)break;else _0x245b02['push'](_0x245b02['shift']());}catch(_0x104121){_0x245b02['push'](_0x245b02['shift']());}}}(a15_0x4a41,0x38bf4));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';import{handleSDKOutput}from'../utils/command-output.js';import{withSpinner}from'../utils/spinner.js';import{DEFAULT_LISTING_LIMIT,resolveLimit}from'../utils/constants.js';export class DatabasesCommand extends BaseCommand{['name']=a15_0x1a276f(0x114);[a15_0x1a276f(0x11b)]=a15_0x1a276f(0x10f);async[a15_0x1a276f(0x10e)](_0x4aa05d){const _0x54f44d=a15_0x1a276f,{options:_0x3dc079,args:_0x34b864,tdx:_0x365351}=_0x4aa05d,_0x1df166=_0x34b864[0x0];try{_0x3dc079['verbose']&&(console[_0x54f44d(0x119)](_0x54f44d(0x121)+_0x3dc079[_0x54f44d(0x11f)]),_0x1df166&&console['error'](_0x54f44d(0x11e)+_0x1df166));const _0x324ba2=resolveLimit(_0x3dc079[_0x54f44d(0x123)],DEFAULT_LISTING_LIMIT),_0x29d896=await withSpinner(_0x54f44d(0x11a),()=>_0x365351[_0x54f44d(0x11d)]['listDatabases'](_0x1df166,_0x324ba2),{'verbose':_0x3dc079[_0x54f44d(0x10c)]}),_0x1d6014=_0x29d896[_0x54f44d(0x117)];return console['error'](_0x54f44d(0x122)+_0x1d6014[_0x54f44d(0x127)]+_0x54f44d(0x129)+(_0x1d6014[_0x54f44d(0x127)]!==0x1?'s':'')),await handleSDKOutput(_0x1d6014,{..._0x3dc079,'limit':_0x324ba2}),0x0;}catch(_0x2a69fa){if(_0x2a69fa instanceof SDKError)return console[_0x54f44d(0x119)](_0x54f44d(0x11c)+_0x2a69fa[_0x54f44d(0x128)]),_0x2a69fa[_0x54f44d(0x112)]&&console[_0x54f44d(0x119)](_0x54f44d(0x10d)+_0x2a69fa[_0x54f44d(0x112)]),0x1;throw _0x2a69fa;}}}
@@ -1 +1 @@
1
- const a16_0x32fb42=a16_0x398b;function a16_0x1555(){const _0x151d0c=['length','481594EMulMT','8110ZoXTzW','args','355hcKbdK','753624MeFFnx','describe','Usage:\x20tdx\x20describe\x20<database.table>\x0a\x20\x20\x20or:\x20tdx\x20describe\x20<table>\x20--database\x20<database>\x0a\x20\x20\x20or:\x20tdx\x20describe\x20<table>\x20--in\x20<database>\x0a\x0aRun\x20\x27tdx\x20describe\x20--help\x27\x20for\x20more\x20options','site','8044314YzxRls','3848qEPjJV','Error:\x20','6837159bYicWj','\x27\x20does\x20not\x20exist','Table:\x20','validate','Table\x20\x27','Database:\x20','Site:\x20','table','12QKqoLl','9404MpPfKu','Too\x20many\x20arguments\x0aUsage:\x20tdx\x20describe\x20<database.table>\x0a\x20\x20\x20or:\x20tdx\x20describe\x20<table>\x20--database\x20<database>\x0a\x0aRun\x20\x27tdx\x20describe\x20--help\x27\x20for\x20more\x20options','database','execute','error','Describing\x20table\x20','name','16911yvPDQA','data','\x20\x20Cause:\x20','describeTable','Describe\x20table\x20schema','32758ZasPkv','\x20column','description','message','✔\x20Found\x20','verbose'];a16_0x1555=function(){return _0x151d0c;};return a16_0x1555();}(function(_0x426a1d,_0x52ae30){const _0x4cdedf=a16_0x398b,_0x856231=_0x426a1d();while(!![]){try{const _0x3dc798=parseInt(_0x4cdedf(0xea))/0x1+-parseInt(_0x4cdedf(0xd6))/0x2*(-parseInt(_0x4cdedf(0xee))/0x3)+-parseInt(_0x4cdedf(0xd7))/0x4*(parseInt(_0x4cdedf(0xed))/0x5)+parseInt(_0x4cdedf(0xf2))/0x6+parseInt(_0x4cdedf(0xf5))/0x7+parseInt(_0x4cdedf(0xf3))/0x8*(-parseInt(_0x4cdedf(0xde))/0x9)+-parseInt(_0x4cdedf(0xeb))/0xa*(parseInt(_0x4cdedf(0xe3))/0xb);if(_0x3dc798===_0x52ae30)break;else _0x856231['push'](_0x856231['shift']());}catch(_0x4fd9b1){_0x856231['push'](_0x856231['shift']());}}}(a16_0x1555,0xc84c4));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';import{handleSDKOutput}from'../utils/command-output.js';import{parseTableReference,validateTableDescribeReference}from'../utils/table-ref-parser.js';function a16_0x398b(_0x2b4486,_0x201b35){const _0x155525=a16_0x1555();return a16_0x398b=function(_0x398b99,_0x514fca){_0x398b99=_0x398b99-0xd3;let _0x382ebe=_0x155525[_0x398b99];return _0x382ebe;},a16_0x398b(_0x2b4486,_0x201b35);}import{withSpinner}from'../utils/spinner.js';export class DescribeCommand extends BaseCommand{[a16_0x32fb42(0xdd)]=a16_0x32fb42(0xef);[a16_0x32fb42(0xe5)]=a16_0x32fb42(0xe2);async[a16_0x32fb42(0xda)](_0x5d3450){const _0x540e1e=a16_0x32fb42;return this[_0x540e1e(0xe1)](_0x5d3450);}async[a16_0x32fb42(0xe1)](_0x408aed){const _0x15d20c=a16_0x32fb42,{options:_0x71d158,args:_0x2d2d4d,tdx:_0x3e0528}=_0x408aed;let _0x53cffa;try{_0x53cffa=parseTableReference(_0x2d2d4d[0x0]);const _0x36a7f4=_0x71d158[_0x15d20c(0xd9)];!_0x53cffa[_0x15d20c(0xd9)]&&_0x36a7f4&&(_0x53cffa['database']=_0x36a7f4);const _0x2d28bf=validateTableDescribeReference(_0x53cffa);if(_0x2d28bf)return console[_0x15d20c(0xdb)](_0x15d20c(0xf4)+_0x2d28bf),0x1;}catch(_0x59efae){return console['error']('Error:\x20'+_0x59efae[_0x15d20c(0xe6)]),0x1;}const _0x224825=_0x53cffa[_0x15d20c(0xd9)],_0x4f3fea=_0x53cffa[_0x15d20c(0xd5)];try{_0x71d158[_0x15d20c(0xe8)]&&(console[_0x15d20c(0xdb)](_0x15d20c(0xd4)+_0x71d158[_0x15d20c(0xf1)]),console[_0x15d20c(0xdb)](_0x15d20c(0xd3)+_0x224825),console['error'](_0x15d20c(0xf7)+_0x4f3fea));const _0x48edee=await withSpinner(_0x15d20c(0xdc)+_0x224825+'.'+_0x4f3fea+'...',()=>_0x3e0528['query'][_0x15d20c(0xe1)](_0x224825,_0x4f3fea),{'verbose':_0x71d158[_0x15d20c(0xe8)]}),_0x5f778=_0x48edee[_0x15d20c(0xdf)];if(_0x5f778[_0x15d20c(0xe9)]===0x0)return console[_0x15d20c(0xdb)]('✖\x20Table\x20not\x20found'),console['error'](_0x15d20c(0xf9)+_0x224825+'.'+_0x4f3fea+_0x15d20c(0xf6)),0x1;return console[_0x15d20c(0xdb)](_0x15d20c(0xe7)+_0x5f778[_0x15d20c(0xe9)]+_0x15d20c(0xe4)+(_0x5f778['length']!==0x1?'s':'')+'\x20in\x20'+_0x224825+'.'+_0x4f3fea),await handleSDKOutput(_0x5f778,_0x71d158),0x0;}catch(_0x422827){if(_0x422827 instanceof SDKError)return console[_0x15d20c(0xdb)](_0x15d20c(0xf4)+_0x422827[_0x15d20c(0xe6)]),_0x422827['cause']&&console['error'](_0x15d20c(0xe0)+_0x422827['cause']),0x1;throw _0x422827;}}[a16_0x32fb42(0xf8)](_0x325d17){const _0x2a41b5=a16_0x32fb42;if(_0x325d17[_0x2a41b5(0xec)][_0x2a41b5(0xe9)]===0x0)return _0x2a41b5(0xf0);if(_0x325d17[_0x2a41b5(0xec)][_0x2a41b5(0xe9)]>0x1)return _0x2a41b5(0xd8);return undefined;}}
1
+ const a16_0x5afaf5=a16_0xcc75;function a16_0x5c71(){const _0x134d48=['2932ZxJhid','808938gYmpBj','site','870bVxtGA','18DHFxrJ','Site:\x20','query','cause','Error:\x20','960560wETCCh','length','Describing\x20table\x20','165iRCylO','Table:\x20','Describe\x20table\x20schema','data','Table\x20\x27','args','\x20column','table','648vqEFUI','✖\x20Table\x20not\x20found','Database:\x20','verbose','message','database','\x27\x20does\x20not\x20exist','error','46907MYJxjN','Too\x20many\x20arguments\x0aUsage:\x20tdx\x20describe\x20<database.table>\x0a\x20\x20\x20or:\x20tdx\x20describe\x20<table>\x20--database\x20<database>\x0a\x0aRun\x20\x27tdx\x20describe\x20--help\x27\x20for\x20more\x20options','describeTable','\x20in\x20','Usage:\x20tdx\x20describe\x20<database.table>\x0a\x20\x20\x20or:\x20tdx\x20describe\x20<table>\x20--database\x20<database>\x0a\x20\x20\x20or:\x20tdx\x20describe\x20<table>\x20--in\x20<database>\x0a\x0aRun\x20\x27tdx\x20describe\x20--help\x27\x20for\x20more\x20options','2646588SPTMbL','16884lQSsCS','18939151MtpbGh'];a16_0x5c71=function(){return _0x134d48;};return a16_0x5c71();}(function(_0x15d165,_0x2f01cb){const _0x3a16bb=a16_0xcc75,_0x222fb8=_0x15d165();while(!![]){try{const _0x1b7a1a=-parseInt(_0x3a16bb(0xd5))/0x1+-parseInt(_0x3a16bb(0xd4))/0x2*(-parseInt(_0x3a16bb(0xbc))/0x3)+-parseInt(_0x3a16bb(0xd1))/0x4+-parseInt(_0x3a16bb(0xd7))/0x5*(-parseInt(_0x3a16bb(0xd2))/0x6)+-parseInt(_0x3a16bb(0xcc))/0x7*(parseInt(_0x3a16bb(0xc4))/0x8)+-parseInt(_0x3a16bb(0xd8))/0x9*(-parseInt(_0x3a16bb(0xdd))/0xa)+parseInt(_0x3a16bb(0xd3))/0xb;if(_0x1b7a1a===_0x2f01cb)break;else _0x222fb8['push'](_0x222fb8['shift']());}catch(_0x463143){_0x222fb8['push'](_0x222fb8['shift']());}}}(a16_0x5c71,0x72ee1));function a16_0xcc75(_0x2424fb,_0x2415ed){const _0x5c715a=a16_0x5c71();return a16_0xcc75=function(_0xcc75e4,_0x4861c9){_0xcc75e4=_0xcc75e4-0xba;let _0x266a1a=_0x5c715a[_0xcc75e4];return _0x266a1a;},a16_0xcc75(_0x2424fb,_0x2415ed);}import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';import{handleSDKOutput}from'../utils/command-output.js';import{parseTableReference,validateTableDescribeReference}from'../utils/table-ref-parser.js';import{withSpinner}from'../utils/spinner.js';export class DescribeCommand extends BaseCommand{['name']='describe';['description']=a16_0x5afaf5(0xbe);async['execute'](_0x24187c){const _0x4e7ef7=a16_0x5afaf5;return this[_0x4e7ef7(0xce)](_0x24187c);}async[a16_0x5afaf5(0xce)](_0x72286b){const _0x56565c=a16_0x5afaf5,{options:_0x5c200f,args:_0x90bc25,tdx:_0x397bc4}=_0x72286b;let _0x470abb;try{_0x470abb=parseTableReference(_0x90bc25[0x0]);const _0x180570=_0x5c200f[_0x56565c(0xc9)];!_0x470abb[_0x56565c(0xc9)]&&_0x180570&&(_0x470abb[_0x56565c(0xc9)]=_0x180570);const _0x3b8b95=validateTableDescribeReference(_0x470abb);if(_0x3b8b95)return console[_0x56565c(0xcb)](_0x56565c(0xdc)+_0x3b8b95),0x1;}catch(_0x1f4f2a){return console[_0x56565c(0xcb)](_0x56565c(0xdc)+_0x1f4f2a[_0x56565c(0xc8)]),0x1;}const _0x3a36bd=_0x470abb[_0x56565c(0xc9)],_0x17f510=_0x470abb[_0x56565c(0xc3)];try{_0x5c200f[_0x56565c(0xc7)]&&(console['error'](_0x56565c(0xd9)+_0x5c200f[_0x56565c(0xd6)]),console[_0x56565c(0xcb)](_0x56565c(0xc6)+_0x3a36bd),console[_0x56565c(0xcb)](_0x56565c(0xbd)+_0x17f510));const _0x5cd78e=await withSpinner(_0x56565c(0xbb)+_0x3a36bd+'.'+_0x17f510+'...',()=>_0x397bc4[_0x56565c(0xda)][_0x56565c(0xce)](_0x3a36bd,_0x17f510),{'verbose':_0x5c200f['verbose']}),_0x533c9d=_0x5cd78e[_0x56565c(0xbf)];if(_0x533c9d['length']===0x0)return console['error'](_0x56565c(0xc5)),console[_0x56565c(0xcb)](_0x56565c(0xc0)+_0x3a36bd+'.'+_0x17f510+_0x56565c(0xca)),0x1;return console[_0x56565c(0xcb)]('✔\x20Found\x20'+_0x533c9d[_0x56565c(0xba)]+_0x56565c(0xc2)+(_0x533c9d[_0x56565c(0xba)]!==0x1?'s':'')+_0x56565c(0xcf)+_0x3a36bd+'.'+_0x17f510),await handleSDKOutput(_0x533c9d,_0x5c200f),0x0;}catch(_0x56f6d8){if(_0x56f6d8 instanceof SDKError)return console[_0x56565c(0xcb)]('Error:\x20'+_0x56f6d8[_0x56565c(0xc8)]),_0x56f6d8['cause']&&console['error']('\x20\x20Cause:\x20'+_0x56f6d8[_0x56565c(0xdb)]),0x1;throw _0x56f6d8;}}['validate'](_0x462d67){const _0xc18714=a16_0x5afaf5;if(_0x462d67[_0xc18714(0xc1)][_0xc18714(0xba)]===0x0)return _0xc18714(0xd0);if(_0x462d67[_0xc18714(0xc1)][_0xc18714(0xba)]>0x1)return _0xc18714(0xcd);return undefined;}}
@@ -1 +1 @@
1
- const a17_0x27d0be=a17_0x58bd;(function(_0x3f67cb,_0x7b2ed8){const _0x3cfa33=a17_0x58bd,_0x42a5f6=_0x3f67cb();while(!![]){try{const _0x49fff9=-parseInt(_0x3cfa33(0x1f4))/0x1*(-parseInt(_0x3cfa33(0x1fd))/0x2)+-parseInt(_0x3cfa33(0x209))/0x3*(-parseInt(_0x3cfa33(0x217))/0x4)+-parseInt(_0x3cfa33(0x205))/0x5+parseInt(_0x3cfa33(0x1fa))/0x6+parseInt(_0x3cfa33(0x227))/0x7*(-parseInt(_0x3cfa33(0x214))/0x8)+-parseInt(_0x3cfa33(0x237))/0x9*(parseInt(_0x3cfa33(0x20c))/0xa)+parseInt(_0x3cfa33(0x213))/0xb*(parseInt(_0x3cfa33(0x1f1))/0xc);if(_0x49fff9===_0x7b2ed8)break;else _0x42a5f6['push'](_0x42a5f6['shift']());}catch(_0x2a3984){_0x42a5f6['push'](_0x42a5f6['shift']());}}}(a17_0x2cb6,0x9bced));function a17_0x2cb6(){const _0x3e0520=['Database:\x20','data','\x20jobs','Usage:\x20job\x20result\x20<job-id>','✔\x20Kill\x20request\x20submitted\x20for\x20job\x20','Job\x20type:\x20','9084KdLVkX','List\x20jobs','Kill\x20a\x20job','1jBWxfg','Usage:\x20job\x20submit\x20<query>\x20or\x20job\x20submit\x20--file\x20<path>','priority','\x20\x20Job\x20ID:\x20','end_at','Error:\x20Multiple\x20SQL\x20statements\x20found\x20in\x20file.\x20Only\x20one\x20statement\x20is\x20allowed\x20for\x20job\x20submission.','1343940XRgHAY','\x20row','kill','1248172JAnosI','jobs','verbose','status','description','url','file','message','4071500zPJcSu','result','hive','type','3AHplFl','Usage:\x20job\x20show\x20<job-id>','execute','73650tUXysu','error','submit','debug','job:submit','✔\x20Retrieved\x20','Cancelled','12199qAtjdH','90488geIimH','show','Error:\x20','577844tgyJSS','✔\x20Job\x20submitted','Submit\x20a\x20job','jobType','\x20\x20Note:\x20Use\x20\x27tdx\x20job\x20show\x20','start_at','Getting\x20job\x20results...','query','Listing\x20jobs...','length','cause','Error:\x20Job\x20ID\x20is\x20required','job:show','\x20job','Error:\x20Cannot\x20specify\x20both\x20query\x20argument\x20and\x20--file\x20option','\x20\x20Cause:\x20','7mlmqop','Limit:\x20','job:kill','substring','getTime','Are\x20you\x20sure\x20you\x20want\x20to\x20kill\x20job\x20','round','name','job_id','created_at','database','user_name','Submitting\x20kill\x20request...','Getting\x20job\x20details...','Get\x20job\x20results','yes','450LYiVyb','Error:\x20--job-type\x20must\x20be\x20either\x20\x22trino\x22\x20or\x20\x22hive\x22'];a17_0x2cb6=function(){return _0x3e0520;};return a17_0x2cb6();}import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';import{handleSDKOutput,handleSingleObjectOutput}from'../utils/command-output.js';import{withSpinner}from'../utils/spinner.js';import{readSqlStatementsFromFile}from'../utils/sql-parser.js';import{confirm}from'../utils/prompt.js';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../utils/constants.js';export class JobListCommand extends BaseCommand{[a17_0x27d0be(0x22e)]='jobs';[a17_0x27d0be(0x201)]=a17_0x27d0be(0x1f2);async[a17_0x27d0be(0x20b)](_0x407f2e){const _0x46a91e=a17_0x27d0be,{options:_0x18badb,tdx:_0x37d660}=_0x407f2e;try{const _0x5b5208=resolveLimit(_0x18badb['limit'],DEFAULT_DISPLAY_LIMIT),_0x45b281=_0x18badb[_0x46a91e(0x200)];_0x18badb[_0x46a91e(0x1ff)]&&(console[_0x46a91e(0x20d)](_0x46a91e(0x228)+_0x5b5208+_0x46a91e(0x23b)),_0x45b281&&console[_0x46a91e(0x20d)]('Status\x20filter:\x20'+_0x45b281));const _0x400cf5=await withSpinner(_0x46a91e(0x21f),()=>_0x37d660[_0x46a91e(0x1fe)]['list']({'from':0x0,'to':_0x5b5208-0x1,'status':_0x45b281}),{'verbose':_0x18badb[_0x46a91e(0x1ff)]}),_0x129d1d=_0x400cf5[_0x46a91e(0x23a)];console[_0x46a91e(0x20d)]('✔\x20Found\x20'+_0x129d1d[_0x46a91e(0x220)]+_0x46a91e(0x224)+(_0x129d1d['length']!==0x1?'s':''));const _0x25bea7=_0x129d1d['map'](_0x21b0d4=>{const _0x90977e=_0x46a91e;let _0x9a811;if(_0x21b0d4[_0x90977e(0x21c)]&&_0x21b0d4[_0x90977e(0x1f8)]){const _0x5a62ac=new Date(_0x21b0d4[_0x90977e(0x21c)])[_0x90977e(0x22b)](),_0x31be0f=new Date(_0x21b0d4['end_at'])['getTime']();_0x9a811=Math['round']((_0x31be0f-_0x5a62ac)/0x3e8);}return{'job_id':_0x21b0d4[_0x90977e(0x22f)],'type':_0x21b0d4[_0x90977e(0x208)],'status':_0x21b0d4[_0x90977e(0x200)],'user_name':_0x21b0d4['user_name'],'duration_sec':_0x9a811,'created_at':_0x21b0d4['created_at'],'started_at':_0x21b0d4[_0x90977e(0x21c)],'end_at':_0x21b0d4[_0x90977e(0x1f8)]};});return await handleSDKOutput(_0x25bea7,_0x18badb),0x0;}catch(_0x45efcf){if(_0x45efcf instanceof SDKError)return console[_0x46a91e(0x20d)](_0x46a91e(0x216)+_0x45efcf[_0x46a91e(0x204)]),_0x45efcf[_0x46a91e(0x221)]&&console[_0x46a91e(0x20d)](_0x46a91e(0x226)+_0x45efcf['cause']),0x1;throw _0x45efcf;}}}export class JobShowCommand extends BaseCommand{['name']=a17_0x27d0be(0x223);[a17_0x27d0be(0x201)]='Show\x20job\x20details';async[a17_0x27d0be(0x20b)](_0x4389d7){const _0x2e5dae=a17_0x27d0be,{options:_0x58f121,args:_0x3feffd,tdx:_0x55062c}=_0x4389d7,_0x11257a=_0x3feffd[0x0];if(!_0x11257a)return console[_0x2e5dae(0x20d)](_0x2e5dae(0x222)),console['error'](_0x2e5dae(0x20a)),0x1;try{const _0xdd3bfc=await withSpinner(_0x2e5dae(0x234),()=>_0x55062c['jobs'][_0x2e5dae(0x215)](_0x11257a),{'verbose':_0x58f121[_0x2e5dae(0x1ff)]}),_0x1b690a=_0xdd3bfc['data'];let _0x328137;if(_0x1b690a[_0x2e5dae(0x21c)]&&_0x1b690a[_0x2e5dae(0x1f8)]){const _0x3307d7=new Date(_0x1b690a[_0x2e5dae(0x21c)])['getTime'](),_0xb81dd7=new Date(_0x1b690a[_0x2e5dae(0x1f8)])[_0x2e5dae(0x22b)]();_0x328137=Math[_0x2e5dae(0x22d)]((_0xb81dd7-_0x3307d7)/0x3e8);}const _0x5537c0={'job_id':_0x1b690a[_0x2e5dae(0x22f)],'type':_0x1b690a[_0x2e5dae(0x208)],'status':_0x1b690a['status'],..._0x1b690a[_0x2e5dae(0x232)]&&{'user_name':_0x1b690a[_0x2e5dae(0x232)]},..._0x328137!==undefined&&{'duration_sec':_0x328137},..._0x1b690a[_0x2e5dae(0x230)]&&{'created_at':_0x1b690a[_0x2e5dae(0x230)]},..._0x1b690a[_0x2e5dae(0x21c)]&&{'started_at':_0x1b690a[_0x2e5dae(0x21c)]},..._0x1b690a[_0x2e5dae(0x1f8)]&&{'end_at':_0x1b690a['end_at']},..._0x1b690a[_0x2e5dae(0x231)]&&{'database':_0x1b690a[_0x2e5dae(0x231)]},..._0x1b690a['priority']!==undefined&&{'priority':_0x1b690a[_0x2e5dae(0x1f6)]},..._0x1b690a[_0x2e5dae(0x202)]&&{'url':_0x1b690a[_0x2e5dae(0x202)]},..._0x1b690a['query']&&{'query':_0x1b690a[_0x2e5dae(0x21e)]},..._0x1b690a['debug']&&{'debug':_0x1b690a[_0x2e5dae(0x20f)]}};return await handleSingleObjectOutput(_0x5537c0,_0x58f121),0x0;}catch(_0x5a03b7){if(_0x5a03b7 instanceof SDKError)return console[_0x2e5dae(0x20d)](_0x2e5dae(0x216)+_0x5a03b7[_0x2e5dae(0x204)]),_0x5a03b7[_0x2e5dae(0x221)]&&console['error'](_0x2e5dae(0x226)+_0x5a03b7[_0x2e5dae(0x221)]),0x1;throw _0x5a03b7;}}}export class JobKillCommand extends BaseCommand{[a17_0x27d0be(0x22e)]=a17_0x27d0be(0x229);['description']=a17_0x27d0be(0x1f3);async[a17_0x27d0be(0x20b)](_0x274637){const _0x425b51=a17_0x27d0be,{options:_0x5d9846,args:_0x27ed52,tdx:_0x45ec6f}=_0x274637,_0x1297ec=_0x27ed52[0x0];if(!_0x1297ec)return console[_0x425b51(0x20d)](_0x425b51(0x222)),console['error']('Usage:\x20job\x20kill\x20<job-id>'),0x1;try{if(!_0x5d9846[_0x425b51(0x236)]){const _0x548e3e=await confirm(_0x425b51(0x22c)+_0x1297ec+'?');if(!_0x548e3e)return console[_0x425b51(0x20d)](_0x425b51(0x212)),0x0;}return await withSpinner(_0x425b51(0x233),()=>_0x45ec6f['jobs'][_0x425b51(0x1fc)](_0x1297ec),{'verbose':_0x5d9846[_0x425b51(0x1ff)]}),console[_0x425b51(0x20d)](_0x425b51(0x23d)+_0x1297ec),console[_0x425b51(0x20d)](_0x425b51(0x21b)+_0x1297ec+'\x27\x20to\x20verify\x20the\x20job\x20status'),0x0;}catch(_0xd17abd){if(_0xd17abd instanceof SDKError)return console[_0x425b51(0x20d)]('Error:\x20'+_0xd17abd[_0x425b51(0x204)]),_0xd17abd[_0x425b51(0x221)]&&console[_0x425b51(0x20d)]('\x20\x20Cause:\x20'+_0xd17abd[_0x425b51(0x221)]),0x1;throw _0xd17abd;}}}function a17_0x58bd(_0x2612cd,_0x55e16c){const _0x2cb6a0=a17_0x2cb6();return a17_0x58bd=function(_0x58bd3f,_0x1667c4){_0x58bd3f=_0x58bd3f-0x1f0;let _0x1018f4=_0x2cb6a0[_0x58bd3f];return _0x1018f4;},a17_0x58bd(_0x2612cd,_0x55e16c);}export class JobSubmitCommand extends BaseCommand{[a17_0x27d0be(0x22e)]=a17_0x27d0be(0x210);[a17_0x27d0be(0x201)]=a17_0x27d0be(0x219);async[a17_0x27d0be(0x20b)](_0x47eb5f){const _0x62bdee=a17_0x27d0be,{options:_0xfbd8,args:_0x37d7c7,tdx:_0x3ba51c}=_0x47eb5f;try{const _0x26350c=_0xfbd8[_0x62bdee(0x21a)]||'trino',_0x3c99cb=_0xfbd8[_0x62bdee(0x203)],_0x15305c=_0xfbd8[_0x62bdee(0x231)]||'information_schema';if(_0x26350c!=='trino'&&_0x26350c!==_0x62bdee(0x207))return console[_0x62bdee(0x20d)](_0x62bdee(0x238)),0x1;let _0x4ff9ed;if(_0x3c99cb){if(_0x37d7c7[0x0])return console[_0x62bdee(0x20d)](_0x62bdee(0x225)),0x1;const _0x413520=readSqlStatementsFromFile(_0x3c99cb);if(_0x413520[_0x62bdee(0x220)]===0x0)return console[_0x62bdee(0x20d)]('Error:\x20No\x20SQL\x20statements\x20found\x20in\x20file'),0x1;if(_0x413520[_0x62bdee(0x220)]>0x1)return console['error'](_0x62bdee(0x1f9)),0x1;_0x4ff9ed=_0x413520[0x0];}else{if(!_0x37d7c7[0x0])return console['error']('Error:\x20Query\x20is\x20required'),console[_0x62bdee(0x20d)](_0x62bdee(0x1f5)),0x1;_0x4ff9ed=_0x37d7c7[0x0];}_0xfbd8[_0x62bdee(0x1ff)]&&(console[_0x62bdee(0x20d)](_0x62bdee(0x1f0)+_0x26350c),console['error'](_0x62bdee(0x239)+_0x15305c),console[_0x62bdee(0x20d)]('Query:\x20'+_0x4ff9ed[_0x62bdee(0x22a)](0x0,0x64)+(_0x4ff9ed[_0x62bdee(0x220)]>0x64?'...':'')));const _0x2572a7=await withSpinner('Submitting\x20job...',()=>_0x3ba51c['jobs'][_0x62bdee(0x20e)](_0x15305c,_0x4ff9ed,_0x26350c),{'verbose':_0xfbd8['verbose']}),_0x10a956=_0x2572a7[_0x62bdee(0x23a)];return console[_0x62bdee(0x20d)](_0x62bdee(0x218)),console['error'](_0x62bdee(0x1f7)+_0x10a956[_0x62bdee(0x22f)]),await handleSDKOutput([_0x10a956],_0xfbd8),0x0;}catch(_0xded9b5){if(_0xded9b5 instanceof SDKError)return console[_0x62bdee(0x20d)](_0x62bdee(0x216)+_0xded9b5[_0x62bdee(0x204)]),_0xded9b5['cause']&&console[_0x62bdee(0x20d)]('\x20\x20Cause:\x20'+_0xded9b5['cause']),0x1;throw _0xded9b5;}}}export class JobResultCommand extends BaseCommand{[a17_0x27d0be(0x22e)]='job:result';[a17_0x27d0be(0x201)]=a17_0x27d0be(0x235);async[a17_0x27d0be(0x20b)](_0x46853f){const _0x17436f=a17_0x27d0be,{options:_0x586a18,args:_0x2f7017,tdx:_0x537234}=_0x46853f,_0x551d8d=_0x2f7017[0x0];if(!_0x551d8d)return console['error'](_0x17436f(0x222)),console[_0x17436f(0x20d)](_0x17436f(0x23c)),0x1;try{const _0x3a5b0b=await withSpinner(_0x17436f(0x21d),()=>_0x537234[_0x17436f(0x1fe)][_0x17436f(0x206)](_0x551d8d),{'verbose':_0x586a18[_0x17436f(0x1ff)]}),_0x1a12a3=_0x3a5b0b[_0x17436f(0x23a)];return console[_0x17436f(0x20d)](_0x17436f(0x211)+_0x1a12a3['length']+_0x17436f(0x1fb)+(_0x1a12a3[_0x17436f(0x220)]!==0x1?'s':'')),await handleSDKOutput(_0x1a12a3,_0x586a18),0x0;}catch(_0x36c993){if(_0x36c993 instanceof SDKError)return console[_0x17436f(0x20d)]('Error:\x20'+_0x36c993['message']),_0x36c993['cause']&&console[_0x17436f(0x20d)]('\x20\x20Cause:\x20'+_0x36c993[_0x17436f(0x221)]),0x1;throw _0x36c993;}}}
1
+ const a17_0x17a2c8=a17_0x3376;function a17_0x3376(_0x451a4,_0x353e7a){const _0x355de5=a17_0x355d();return a17_0x3376=function(_0x33763b,_0x43d7a){_0x33763b=_0x33763b-0xb8;let _0x1566dd=_0x355de5[_0x33763b];return _0x1566dd;},a17_0x3376(_0x451a4,_0x353e7a);}function a17_0x355d(){const _0x1dd8fc=['type','job:result','getTime','Limit:\x20','Error:\x20Job\x20ID\x20is\x20required','✔\x20Job\x20submitted','show','Get\x20job\x20results','hive','substring','✔\x20Found\x20','description','Job\x20type:\x20','execute','22867uycNEh','query','job:show','5388NRBRzc','\x20\x20Cause:\x20','✔\x20Retrieved\x20','end_at','status','Usage:\x20job\x20result\x20<job-id>','Getting\x20job\x20results...','database','submit','job:kill','✔\x20Kill\x20request\x20submitted\x20for\x20job\x20','Listing\x20jobs...','Submit\x20a\x20job','name','priority','28VlVWci','Status\x20filter:\x20','\x20jobs','50oNJtws','\x27\x20to\x20verify\x20the\x20job\x20status','trino','151708UfpGri','round','1yDWgMZ','Usage:\x20job\x20show\x20<job-id>','158616NvQxmI','Error:\x20No\x20SQL\x20statements\x20found\x20in\x20file','21pXJJew','Error:\x20--job-type\x20must\x20be\x20either\x20\x22trino\x22\x20or\x20\x22hive\x22','jobs','Show\x20job\x20details','error','5jieIDV','jobType','Usage:\x20job\x20kill\x20<job-id>','Submitting\x20job...','Error:\x20Cannot\x20specify\x20both\x20query\x20argument\x20and\x20--file\x20option','1689594tcYkzN','list','\x20row','cause','List\x20jobs','data','\x20\x20Job\x20ID:\x20','verbose','Are\x20you\x20sure\x20you\x20want\x20to\x20kill\x20job\x20','result','created_at','length','url','yes','start_at','230850tHuFTJ','Error:\x20','user_name','Query:\x20','message','job_id','200940sXKOmj','2240348ZhCuyO','Usage:\x20job\x20submit\x20<query>\x20or\x20job\x20submit\x20--file\x20<path>'];a17_0x355d=function(){return _0x1dd8fc;};return a17_0x355d();}(function(_0x39a64f,_0x3ceb67){const _0x11b0ad=a17_0x3376,_0x417d47=_0x39a64f();while(!![]){try{const _0x1c1430=-parseInt(_0x11b0ad(0xd7))/0x1*(parseInt(_0x11b0ad(0xd5))/0x2)+parseInt(_0x11b0ad(0xdb))/0x3*(parseInt(_0x11b0ad(0xfa))/0x4)+-parseInt(_0x11b0ad(0xe0))/0x5*(-parseInt(_0x11b0ad(0xe5))/0x6)+-parseInt(_0x11b0ad(0xcf))/0x7*(-parseInt(_0x11b0ad(0xd9))/0x8)+parseInt(_0x11b0ad(0xf4))/0x9*(parseInt(_0x11b0ad(0xd2))/0xa)+parseInt(_0x11b0ad(0xfb))/0xb+parseInt(_0x11b0ad(0xc0))/0xc*(-parseInt(_0x11b0ad(0xbd))/0xd);if(_0x1c1430===_0x3ceb67)break;else _0x417d47['push'](_0x417d47['shift']());}catch(_0x5a55d2){_0x417d47['push'](_0x417d47['shift']());}}}(a17_0x355d,0x2ba89));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';import{handleSDKOutput,handleSingleObjectOutput}from'../utils/command-output.js';import{withSpinner}from'../utils/spinner.js';import{readSqlStatementsFromFile}from'../utils/sql-parser.js';import{confirm}from'../utils/prompt.js';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../utils/constants.js';export class JobListCommand extends BaseCommand{[a17_0x17a2c8(0xcd)]='jobs';['description']=a17_0x17a2c8(0xe9);async[a17_0x17a2c8(0xbc)](_0x4c76fe){const _0x13fac9=a17_0x17a2c8,{options:_0xaceae5,tdx:_0x1bbd8c}=_0x4c76fe;try{const _0x3280e7=resolveLimit(_0xaceae5['limit'],DEFAULT_DISPLAY_LIMIT),_0x3b0981=_0xaceae5[_0x13fac9(0xc4)];_0xaceae5[_0x13fac9(0xec)]&&(console[_0x13fac9(0xdf)](_0x13fac9(0x100)+_0x3280e7+_0x13fac9(0xd1)),_0x3b0981&&console['error'](_0x13fac9(0xd0)+_0x3b0981));const _0x212096=await withSpinner(_0x13fac9(0xcb),()=>_0x1bbd8c[_0x13fac9(0xdd)][_0x13fac9(0xe6)]({'from':0x0,'to':_0x3280e7-0x1,'status':_0x3b0981}),{'verbose':_0xaceae5[_0x13fac9(0xec)]}),_0x249ebb=_0x212096[_0x13fac9(0xea)];console[_0x13fac9(0xdf)](_0x13fac9(0xb9)+_0x249ebb['length']+'\x20job'+(_0x249ebb[_0x13fac9(0xf0)]!==0x1?'s':''));const _0xd9617b=_0x249ebb['map'](_0x494bff=>{const _0x17718f=_0x13fac9;let _0xde0d8d;if(_0x494bff[_0x17718f(0xf3)]&&_0x494bff[_0x17718f(0xc3)]){const _0xea25e6=new Date(_0x494bff['start_at'])['getTime'](),_0x1840f7=new Date(_0x494bff[_0x17718f(0xc3)])[_0x17718f(0xff)]();_0xde0d8d=Math['round']((_0x1840f7-_0xea25e6)/0x3e8);}return{'job_id':_0x494bff[_0x17718f(0xf9)],'type':_0x494bff['type'],'status':_0x494bff[_0x17718f(0xc4)],'user_name':_0x494bff[_0x17718f(0xf6)],'duration_sec':_0xde0d8d,'created_at':_0x494bff[_0x17718f(0xef)],'started_at':_0x494bff[_0x17718f(0xf3)],'end_at':_0x494bff[_0x17718f(0xc3)]};});return await handleSDKOutput(_0xd9617b,_0xaceae5),0x0;}catch(_0x156482){if(_0x156482 instanceof SDKError)return console[_0x13fac9(0xdf)]('Error:\x20'+_0x156482['message']),_0x156482['cause']&&console[_0x13fac9(0xdf)](_0x13fac9(0xc1)+_0x156482[_0x13fac9(0xe8)]),0x1;throw _0x156482;}}}export class JobShowCommand extends BaseCommand{[a17_0x17a2c8(0xcd)]=a17_0x17a2c8(0xbf);[a17_0x17a2c8(0xba)]=a17_0x17a2c8(0xde);async[a17_0x17a2c8(0xbc)](_0x2facc5){const _0x584334=a17_0x17a2c8,{options:_0x37e803,args:_0x1ce63b,tdx:_0x34bd44}=_0x2facc5,_0x4b08d1=_0x1ce63b[0x0];if(!_0x4b08d1)return console[_0x584334(0xdf)](_0x584334(0x101)),console['error'](_0x584334(0xd8)),0x1;try{const _0x33ab7b=await withSpinner('Getting\x20job\x20details...',()=>_0x34bd44[_0x584334(0xdd)][_0x584334(0x103)](_0x4b08d1),{'verbose':_0x37e803[_0x584334(0xec)]}),_0x8f7dd5=_0x33ab7b[_0x584334(0xea)];let _0x1fa1ec;if(_0x8f7dd5[_0x584334(0xf3)]&&_0x8f7dd5[_0x584334(0xc3)]){const _0x2d98a2=new Date(_0x8f7dd5[_0x584334(0xf3)])['getTime'](),_0x17b4b8=new Date(_0x8f7dd5[_0x584334(0xc3)])[_0x584334(0xff)]();_0x1fa1ec=Math[_0x584334(0xd6)]((_0x17b4b8-_0x2d98a2)/0x3e8);}const _0x51da8c={'job_id':_0x8f7dd5[_0x584334(0xf9)],'type':_0x8f7dd5[_0x584334(0xfd)],'status':_0x8f7dd5[_0x584334(0xc4)],..._0x8f7dd5[_0x584334(0xf6)]&&{'user_name':_0x8f7dd5[_0x584334(0xf6)]},..._0x1fa1ec!==undefined&&{'duration_sec':_0x1fa1ec},..._0x8f7dd5[_0x584334(0xef)]&&{'created_at':_0x8f7dd5['created_at']},..._0x8f7dd5[_0x584334(0xf3)]&&{'started_at':_0x8f7dd5[_0x584334(0xf3)]},..._0x8f7dd5[_0x584334(0xc3)]&&{'end_at':_0x8f7dd5['end_at']},..._0x8f7dd5['database']&&{'database':_0x8f7dd5[_0x584334(0xc7)]},..._0x8f7dd5[_0x584334(0xce)]!==undefined&&{'priority':_0x8f7dd5[_0x584334(0xce)]},..._0x8f7dd5[_0x584334(0xf1)]&&{'url':_0x8f7dd5[_0x584334(0xf1)]},..._0x8f7dd5[_0x584334(0xbe)]&&{'query':_0x8f7dd5[_0x584334(0xbe)]},..._0x8f7dd5['debug']&&{'debug':_0x8f7dd5['debug']}};return await handleSingleObjectOutput(_0x51da8c,_0x37e803),0x0;}catch(_0x249dcc){if(_0x249dcc instanceof SDKError)return console[_0x584334(0xdf)](_0x584334(0xf5)+_0x249dcc[_0x584334(0xf8)]),_0x249dcc['cause']&&console[_0x584334(0xdf)]('\x20\x20Cause:\x20'+_0x249dcc[_0x584334(0xe8)]),0x1;throw _0x249dcc;}}}export class JobKillCommand extends BaseCommand{[a17_0x17a2c8(0xcd)]=a17_0x17a2c8(0xc9);[a17_0x17a2c8(0xba)]='Kill\x20a\x20job';async[a17_0x17a2c8(0xbc)](_0x199232){const _0x42edd4=a17_0x17a2c8,{options:_0x28da69,args:_0x20121f,tdx:_0x1edf6b}=_0x199232,_0x32f4c3=_0x20121f[0x0];if(!_0x32f4c3)return console[_0x42edd4(0xdf)]('Error:\x20Job\x20ID\x20is\x20required'),console[_0x42edd4(0xdf)](_0x42edd4(0xe2)),0x1;try{if(!_0x28da69[_0x42edd4(0xf2)]){const _0x24f207=await confirm(_0x42edd4(0xed)+_0x32f4c3+'?');if(!_0x24f207)return console[_0x42edd4(0xdf)]('Cancelled'),0x0;}return await withSpinner('Submitting\x20kill\x20request...',()=>_0x1edf6b['jobs']['kill'](_0x32f4c3),{'verbose':_0x28da69[_0x42edd4(0xec)]}),console[_0x42edd4(0xdf)](_0x42edd4(0xca)+_0x32f4c3),console[_0x42edd4(0xdf)]('\x20\x20Note:\x20Use\x20\x27tdx\x20job\x20show\x20'+_0x32f4c3+_0x42edd4(0xd3)),0x0;}catch(_0x24ff89){if(_0x24ff89 instanceof SDKError)return console[_0x42edd4(0xdf)](_0x42edd4(0xf5)+_0x24ff89[_0x42edd4(0xf8)]),_0x24ff89['cause']&&console[_0x42edd4(0xdf)](_0x42edd4(0xc1)+_0x24ff89[_0x42edd4(0xe8)]),0x1;throw _0x24ff89;}}}export class JobSubmitCommand extends BaseCommand{[a17_0x17a2c8(0xcd)]='job:submit';[a17_0x17a2c8(0xba)]=a17_0x17a2c8(0xcc);async[a17_0x17a2c8(0xbc)](_0x22560c){const _0x43d076=a17_0x17a2c8,{options:_0x317db0,args:_0x455409,tdx:_0x3c4725}=_0x22560c;try{const _0x19a230=_0x317db0[_0x43d076(0xe1)]||_0x43d076(0xd4),_0x2432ce=_0x317db0['file'],_0x4c7b3d=_0x317db0['database']||'information_schema';if(_0x19a230!==_0x43d076(0xd4)&&_0x19a230!==_0x43d076(0x105))return console[_0x43d076(0xdf)](_0x43d076(0xdc)),0x1;let _0x5b038a;if(_0x2432ce){if(_0x455409[0x0])return console[_0x43d076(0xdf)](_0x43d076(0xe4)),0x1;const _0x17df0c=readSqlStatementsFromFile(_0x2432ce);if(_0x17df0c['length']===0x0)return console[_0x43d076(0xdf)](_0x43d076(0xda)),0x1;if(_0x17df0c[_0x43d076(0xf0)]>0x1)return console['error']('Error:\x20Multiple\x20SQL\x20statements\x20found\x20in\x20file.\x20Only\x20one\x20statement\x20is\x20allowed\x20for\x20job\x20submission.'),0x1;_0x5b038a=_0x17df0c[0x0];}else{if(!_0x455409[0x0])return console['error']('Error:\x20Query\x20is\x20required'),console[_0x43d076(0xdf)](_0x43d076(0xfc)),0x1;_0x5b038a=_0x455409[0x0];}_0x317db0[_0x43d076(0xec)]&&(console[_0x43d076(0xdf)](_0x43d076(0xbb)+_0x19a230),console[_0x43d076(0xdf)]('Database:\x20'+_0x4c7b3d),console[_0x43d076(0xdf)](_0x43d076(0xf7)+_0x5b038a[_0x43d076(0xb8)](0x0,0x64)+(_0x5b038a['length']>0x64?'...':'')));const _0x44cb05=await withSpinner(_0x43d076(0xe3),()=>_0x3c4725[_0x43d076(0xdd)][_0x43d076(0xc8)](_0x4c7b3d,_0x5b038a,_0x19a230),{'verbose':_0x317db0[_0x43d076(0xec)]}),_0x7042cc=_0x44cb05['data'];return console['error'](_0x43d076(0x102)),console[_0x43d076(0xdf)](_0x43d076(0xeb)+_0x7042cc['job_id']),await handleSDKOutput([_0x7042cc],_0x317db0),0x0;}catch(_0x57da1a){if(_0x57da1a instanceof SDKError)return console['error'](_0x43d076(0xf5)+_0x57da1a['message']),_0x57da1a[_0x43d076(0xe8)]&&console[_0x43d076(0xdf)]('\x20\x20Cause:\x20'+_0x57da1a[_0x43d076(0xe8)]),0x1;throw _0x57da1a;}}}export class JobResultCommand extends BaseCommand{[a17_0x17a2c8(0xcd)]=a17_0x17a2c8(0xfe);['description']=a17_0x17a2c8(0x104);async['execute'](_0x285257){const _0x4acd9c=a17_0x17a2c8,{options:_0x529834,args:_0x56cb8b,tdx:_0x5d1e1b}=_0x285257,_0x166954=_0x56cb8b[0x0];if(!_0x166954)return console[_0x4acd9c(0xdf)](_0x4acd9c(0x101)),console['error'](_0x4acd9c(0xc5)),0x1;try{const _0x364b2b=await withSpinner(_0x4acd9c(0xc6),()=>_0x5d1e1b[_0x4acd9c(0xdd)][_0x4acd9c(0xee)](_0x166954),{'verbose':_0x529834['verbose']}),_0x2f9620=_0x364b2b[_0x4acd9c(0xea)];return console[_0x4acd9c(0xdf)](_0x4acd9c(0xc2)+_0x2f9620[_0x4acd9c(0xf0)]+_0x4acd9c(0xe7)+(_0x2f9620['length']!==0x1?'s':'')),await handleSDKOutput(_0x2f9620,_0x529834),0x0;}catch(_0x2792ff){if(_0x2792ff instanceof SDKError)return console[_0x4acd9c(0xdf)](_0x4acd9c(0xf5)+_0x2792ff[_0x4acd9c(0xf8)]),_0x2792ff[_0x4acd9c(0xe8)]&&console[_0x4acd9c(0xdf)]('\x20\x20Cause:\x20'+_0x2792ff[_0x4acd9c(0xe8)]),0x1;throw _0x2792ff;}}}