@treasuredata/tdx 0.1.3 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +100 -0
- package/dist/cli.js +1 -1
- package/dist/cli.js.map +1 -1
- package/dist/client/cdp-client.js +1 -1
- package/dist/client/http-client.d.ts +2 -1
- package/dist/client/http-client.d.ts.map +1 -1
- package/dist/client/http-client.js +1 -1
- package/dist/client/http-client.js.map +1 -1
- package/dist/client/llm-client.js +1 -1
- package/dist/client/rate-limiter.js +1 -1
- package/dist/client/td-client.js +1 -1
- package/dist/client/trino-client.js +1 -1
- package/dist/client/workflow-client.js +1 -1
- package/dist/commands/activations.js +1 -1
- package/dist/commands/api-command.d.ts +26 -0
- package/dist/commands/api-command.d.ts.map +1 -0
- package/dist/commands/api-command.js +1 -0
- package/dist/commands/api-command.js.map +1 -0
- package/dist/commands/chat-command.js +1 -1
- package/dist/commands/command.js +1 -1
- package/dist/commands/databases.js +1 -1
- package/dist/commands/describe.js +1 -1
- package/dist/commands/llm-command.js +1 -1
- package/dist/commands/query-command.js +1 -1
- package/dist/commands/segment-command.js +1 -1
- package/dist/commands/segments.js +1 -1
- package/dist/commands/show.js +1 -1
- package/dist/commands/tables.js +1 -1
- package/dist/commands/workflow-command.js +1 -1
- package/dist/core/auth.js +1 -1
- package/dist/core/config.js +1 -1
- package/dist/index.js +1 -1
- package/dist/sdk/api.d.ts +110 -0
- package/dist/sdk/api.d.ts.map +1 -0
- package/dist/sdk/api.js +1 -0
- package/dist/sdk/api.js.map +1 -0
- package/dist/sdk/database.js +1 -1
- package/dist/sdk/errors.js +1 -1
- package/dist/sdk/index.d.ts +6 -0
- package/dist/sdk/index.d.ts.map +1 -1
- package/dist/sdk/index.js +1 -1
- package/dist/sdk/index.js.map +1 -1
- package/dist/sdk/llm.js +1 -1
- package/dist/sdk/query.js +1 -1
- package/dist/sdk/segment.js +1 -1
- package/dist/sdk/table.js +1 -1
- package/dist/sdk/workflow.js +1 -1
- package/dist/types/endpoints.js +1 -1
- package/dist/types/index.js +1 -1
- package/dist/utils/agent-ref-parser.js +1 -1
- package/dist/utils/chat-cache.js +1 -1
- package/dist/utils/colors.js +1 -1
- package/dist/utils/command-output.js +1 -1
- package/dist/utils/format-detector.js +1 -1
- package/dist/utils/formatters.js +1 -1
- package/dist/utils/option-validation.js +1 -1
- package/dist/utils/segment-ref-parser.js +1 -1
- package/dist/utils/spinner.js +1 -1
- package/dist/utils/sql-parser.js +1 -1
- package/dist/utils/sse-parser.js +1 -1
- package/dist/utils/string-utils.js +1 -1
- package/dist/utils/table-ref-parser.js +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function a15_0x52e6(){const _0x292fba=['Cannot\x20specify\x20both\x20SQL\x20argument\x20and\x20--file\x20option','error','121135CwJGne','elapsedTimeMillis','\x20[Job\x20ID:\x20','10SKHqzY','Run\x20Trino\x20queries\x20(streaming)','in\x20','description','\x20\x20\x20or:\x20tdx\x20query\x20--file\x20query.sql','database','SQL:\x20','10wFOSFB','34kTDKyV','Error:\x20','Statement\x20','156EqulLD','Catalog:\x20','4833675tjmIQE','299499uXTVaE','Usage:\x20tdx\x20query\x20\x22SELECT\x20*\x20FROM\x20table\x22','setJobId','SQL\x20query\x20is\x20required\x20(provide\x20SQL\x20as\x20argument\x20or\x20use\x20--file\x20option)','cause','push','output','errorName','file','verbose','options','length','\x20rows\x20','\x20-\x20','message','args','site','QUERY_ERROR','join','Query\x20failed\x20[','Error:\x20SQL\x20query\x20required','../utils/command-output.js','2208232Daophf','\x0aAll\x20results\x20saved\x20to\x20','4863636wkwaqp','query','Schema:\x20','1054484VhpprW','execute','Query\x20completed:\x20Processed\x20','information_schema','jobId','...','validate','stats','data','name','UNKNOWN_ERROR','errorType','trinoError','13084QeIQiC','Executing\x20statement\x20'];a15_0x52e6=function(){return _0x292fba;};return a15_0x52e6();}const a15_0x342cda=a15_0x1ac8;function a15_0x1ac8(_0x3a21e3,_0x5ae492){const _0x52e62f=a15_0x52e6();return a15_0x1ac8=function(_0x1ac8b7,_0x361b75){_0x1ac8b7=_0x1ac8b7-0x1c8;let _0x2d72dc=_0x52e62f[_0x1ac8b7];return _0x2d72dc;},a15_0x1ac8(_0x3a21e3,_0x5ae492);}(function(_0x49550,_0x3afe8c){const _0x8eb452=a15_0x1ac8,_0xcc7d31=_0x49550();while(!![]){try{const _0x3250a9=-parseInt(_0x8eb452(0x1d4))/0x1*(parseInt(_0x8eb452(0x202))/0x2)+parseInt(_0x8eb452(0x1da))/0x3+parseInt(_0x8eb452(0x1f5))/0x4*(parseInt(_0x8eb452(0x1d3))/0x5)+-parseInt(_0x8eb452(0x1d7))/0x6*(parseInt(_0x8eb452(0x1c9))/0x7)+parseInt(_0x8eb452(0x1f0))/0x8+-parseInt(_0x8eb452(0x1f2))/0x9*(-parseInt(_0x8eb452(0x1cc))/0xa)+-parseInt(_0x8eb452(0x1d9))/0xb;if(_0x3250a9===_0x3afe8c)break;else _0xcc7d31['push'](_0xcc7d31['shift']());}catch(_0x8e1e2c){_0xcc7d31['push'](_0xcc7d31['shift']());}}}(a15_0x52e6,0x50fcd));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';import{TrinoQueryError}from'../client/trino-client.js';import{handleQueryOutput}from'../utils/command-output.js';import{readSqlStatementsFromFile,splitSqlStatements}from'../utils/sql-parser.js';import{writeFileSync}from'fs';import{withQuerySpinner,formatElapsed}from'../utils/spinner.js';export class QueryCommand extends BaseCommand{[a15_0x342cda(0x1fe)]=a15_0x342cda(0x1f3);[a15_0x342cda(0x1cf)]=a15_0x342cda(0x1cd);async[a15_0x342cda(0x1f6)](_0x3a7aa8){const _0x1e519a=a15_0x342cda,{options:_0x291dc1,args:_0x43b1b8,tdx:_0x4d0525}=_0x3a7aa8,_0x9cb0a9=_0x43b1b8[0x0],_0x1700dc=_0x291dc1['file'];let _0x1e4ff0;if(_0x1700dc)try{_0x1e4ff0=readSqlStatementsFromFile(_0x1700dc);}catch(_0x409022){return console[_0x1e519a(0x1c8)]('Error:\x20'+_0x409022[_0x1e519a(0x1e8)]),0x1;}else{if(_0x9cb0a9)try{_0x1e4ff0=splitSqlStatements(_0x9cb0a9);}catch(_0x3c3490){return console[_0x1e519a(0x1c8)](_0x1e519a(0x1d5)+_0x3c3490['message']),0x1;}else return console[_0x1e519a(0x1c8)](_0x1e519a(0x1ee)),console['error'](_0x1e519a(0x1db)),console['error'](_0x1e519a(0x1d0)),0x1;}const _0x4529e4=_0x291dc1[_0x1e519a(0x1d1)]||_0x1e519a(0x1f8),_0x112edb=_0x291dc1['catalog'];try{const _0x52b972=[],_0x9d2227=!!_0x291dc1['output'];for(let _0x2dcd25=0x0;_0x2dcd25<_0x1e4ff0[_0x1e519a(0x1e5)];_0x2dcd25++){const _0x158cdf=_0x1e4ff0[_0x2dcd25],_0x2038b2=_0x2dcd25+0x1,_0x4754ce=_0x1e4ff0['length'],_0x1339eb=_0x4754ce>0x1;_0x291dc1[_0x1e519a(0x1e3)]&&(console[_0x1e519a(0x1c8)]('\x0a'+(_0x1339eb?_0x1e519a(0x1d6)+_0x2038b2+'/'+_0x4754ce+':':'')),console['error']('Site:\x20'+_0x291dc1[_0x1e519a(0x1ea)]),console[_0x1e519a(0x1c8)](_0x1e519a(0x1d8)+(_0x112edb||'td')),console['error'](_0x1e519a(0x1f4)+_0x4529e4),console['error'](_0x1e519a(0x1d2)+_0x158cdf));const _0xd86ab6=_0x1339eb?_0x1e519a(0x203)+_0x2038b2+'/'+_0x4754ce+_0x1e519a(0x1fa):'Executing\x20query...';try{const _0x44f78c=await withQuerySpinner(_0xd86ab6,async _0x3e00cd=>{const _0xe17ef=await _0x4d0525['query'](_0x158cdf,{'catalog':_0x112edb,'schema':_0x4529e4,'onJobId':_0x15e75a=>{const _0x1cae7d=a15_0x1ac8;_0x3e00cd[_0x1cae7d(0x1dc)](_0x15e75a);}});return _0xe17ef;},{'verbose':_0x291dc1[_0x1e519a(0x1e3)]}),_0x23a50c=_0x44f78c[_0x1e519a(0x1fd)],_0x3e805a=_0x23a50c[_0x1e519a(0x1f9)]?_0x1e519a(0x1cb)+_0x23a50c[_0x1e519a(0x1f9)]+']':'',_0x5f0ade=_0x1339eb?_0x1e519a(0x1d6)+_0x2038b2+'/'+_0x4754ce+_0x1e519a(0x1e7):'';console[_0x1e519a(0x1c8)]('✔\x20'+_0x5f0ade+_0x1e519a(0x1f7)+_0x23a50c['stats']['processedRows']['toLocaleString']()+_0x1e519a(0x1e6)+(_0x1e519a(0x1ce)+formatElapsed(_0x23a50c[_0x1e519a(0x1fc)][_0x1e519a(0x1ca)])+_0x3e805a));if(_0x1339eb&&_0x9d2227){const {formatQueryOutput:_0x2672b5,resolveOutputOptions:_0x10833f}=await import(_0x1e519a(0x1ef)),_0x550679=_0x10833f(_0x291dc1),_0x3c0e6f=await _0x2672b5(_0x23a50c,_0x550679);_0x52b972[_0x1e519a(0x1df)](_0x3c0e6f);}else await handleQueryOutput(_0x23a50c,_0x291dc1);}catch(_0x43b8db){let _0x51c91b=_0x1e519a(0x1ff);return _0x43b8db instanceof SDKError&&_0x43b8db[_0x1e519a(0x1de)]instanceof TrinoQueryError&&(_0x51c91b=_0x43b8db[_0x1e519a(0x1de)][_0x1e519a(0x201)]?.[_0x1e519a(0x1e1)]||_0x43b8db[_0x1e519a(0x1de)]['trinoError']?.[_0x1e519a(0x200)]||_0x1e519a(0x1eb)),console['error']('✖\x20'+(_0x1339eb?_0x1e519a(0x1d6)+_0x2038b2+'/'+_0x4754ce+'\x20-\x20':'')+_0x1e519a(0x1ed)+_0x51c91b+']'),console[_0x1e519a(0x1c8)]('\x0a'+_0x43b8db[_0x1e519a(0x1e8)]),0x1;}}if(_0x1e4ff0[_0x1e519a(0x1e5)]>0x1&&_0x9d2227&&_0x52b972[_0x1e519a(0x1e5)]>0x0){const _0xc9ac9=_0x52b972[_0x1e519a(0x1ec)]('\x0a');writeFileSync(_0x291dc1[_0x1e519a(0x1e0)],_0xc9ac9),console[_0x1e519a(0x1c8)](_0x1e519a(0x1f1)+_0x291dc1[_0x1e519a(0x1e0)]);}return 0x0;}catch(_0x208d66){throw _0x208d66;}}[a15_0x342cda(0x1fb)](_0x13f4d7){const _0x21b50b=a15_0x342cda,_0x486cc9=_0x13f4d7[_0x21b50b(0x1e9)][0x0],_0x302677=_0x13f4d7[_0x21b50b(0x1e4)][_0x21b50b(0x1e2)];if(!_0x486cc9&&!_0x302677)return _0x21b50b(0x1dd);if(_0x486cc9&&_0x302677)return _0x21b50b(0x204);return undefined;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a15_0x629df1=a15_0xc08f;(function(_0x22baea,_0x27d9a3){const _0x834a69=a15_0xc08f,_0x44b43e=_0x22baea();while(!![]){try{const _0x39e8fd=-parseInt(_0x834a69(0x1ce))/0x1+-parseInt(_0x834a69(0x1e9))/0x2+-parseInt(_0x834a69(0x1db))/0x3+-parseInt(_0x834a69(0x198))/0x4*(-parseInt(_0x834a69(0x1b8))/0x5)+parseInt(_0x834a69(0x1a2))/0x6+parseInt(_0x834a69(0x1c4))/0x7*(parseInt(_0x834a69(0x1aa))/0x8)+parseInt(_0x834a69(0x1c6))/0x9*(parseInt(_0x834a69(0x1cc))/0xa);if(_0x39e8fd===_0x27d9a3)break;else _0x44b43e['push'](_0x44b43e['shift']());}catch(_0x446618){_0x44b43e['push'](_0x44b43e['shift']());}}}(a15_0x427c,0x2d975));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';import{handleSDKOutput,handleQueryOutput}from'../utils/command-output.js';import{withSpinner,withQuerySpinner,formatElapsed}from'../utils/spinner.js';import{TrinoQueryError}from'../client/trino-client.js';import{parseSegmentRef}from'../utils/segment-ref-parser.js';function a15_0x427c(){const _0x5f2a08=['77288DkjVtU','Fetching\x20folder\x20\x27','\x20\x20Cause:\x20','Error:\x20','name','Folder\x20name:\x20','jobId','Listing\x20folders\x20for\x20parent\x20\x27','in\x20','Resolving\x20child\x20segment\x20\x27','Parent\x20name:\x20','getParent','trinoError','Site:\x20','10UGNjGH','\x27...','segment:describe','Fetching\x20SQL\x20for\x20segment\x20\x27','QUERY_ERROR','getParentSQL','Fetching\x20SQL\x20for\x20parent\x20\x27','query','jsonl','Resolving\x20parent\x20segment\x20\x27','setJobId','Show\x20parent\x20or\x20child\x20segment\x20details','259BnrKDX','listFolders','9CkJqlv','Error:\x20Segment\x20name\x20is\x20required','elapsedTimeMillis','SQL\x20query:\x0a','Resolving\x20folder\x20\x27','resolveParentId','512590CZdNgU','Usage:\x20tdx\x20segment\x20sql\x20<parent_name>\x20or\x20<parent_name.child_name>','170313RwItHv','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','✔\x20Query\x20completed:\x20Processed\x20','Show\x20segment\x20folder\x20details','data','✖\x20Query\x20failed\x20[','Child\x20name:\x20','execute','Resolved\x20folder\x20ID:\x20','Usage:\x20tdx\x20segment\x20folder\x20show\x20<parent_name.folder_name>','replace','Usage:\x20tdx\x20segment\x20folder\x20list\x20<parent_name>','errorType','536565qtCdda','resolveSegmentId','getSegment','error','Execute\x20segment\x20SQL\x20query\x20and\x20show\x20results','limit','segment','segment:sql','Error:\x20Folder\x20name\x20is\x20required\x20(use\x20parent_name.folder_name\x20format)','log','Executing\x20segment\x20query...','length','Error:\x20Folder\x20reference\x20is\x20required','processedRows','403036OSrKCL','resolveFolderId','message','segment:folder:list','description','174092EecGQc','Usage:\x20tdx\x20segment\x20describe\x20<parent_name>\x20or\x20<parent_name.child_name>','verbose','getSegmentSQL','Fetching\x20parent\x20segment\x20\x27','Resolved\x20child\x20ID:\x20','test','site','UNKNOWN_ERROR','Resolved\x20parent\x20ID:\x20','1449990ijXTaP','SELECT\x20*\x20FROM\x20(\x0a','Error:\x20Parent\x20segment\x20name\x20is\x20required','Usage:\x20tdx\x20segment\x20show\x20<parent_name>\x20or\x20<parent_name.child_name>','cause','segment:show','Get\x20SQL\x20query\x20for\x20parent\x20or\x20child\x20segment','✔\x20Found\x20'];a15_0x427c=function(){return _0x5f2a08;};return a15_0x427c();}export class SegmentDescribeCommand extends BaseCommand{[a15_0x629df1(0x1ae)]=a15_0x629df1(0x1ba);[a15_0x629df1(0x197)]=a15_0x629df1(0x1c3);async[a15_0x629df1(0x1d5)](_0x180ec9){const _0x1c10fd=a15_0x629df1,{options:_0x143f30,args:_0x267029,tdx:_0x503fed}=_0x180ec9;if(_0x267029[_0x1c10fd(0x1e6)]===0x0)return console[_0x1c10fd(0x1de)](_0x1c10fd(0x1c7)),console[_0x1c10fd(0x1de)](_0x1c10fd(0x199)),0x1;try{const {parentId:_0x1088f3,childId:_0x53f3c1}=parseSegmentRef(_0x267029[0x0]);_0x143f30[_0x1c10fd(0x19a)]&&(console[_0x1c10fd(0x1de)]('Site:\x20'+_0x143f30[_0x1c10fd(0x19f)]),console[_0x1c10fd(0x1de)](_0x1c10fd(0x1b4)+_0x1088f3),_0x53f3c1&&console[_0x1c10fd(0x1de)](_0x1c10fd(0x1d4)+_0x53f3c1));const _0x478b8b=await withSpinner(_0x1c10fd(0x1c1)+_0x1088f3+_0x1c10fd(0x1b9),()=>_0x503fed['segment'][_0x1c10fd(0x1cb)](_0x1088f3),{'verbose':_0x143f30[_0x1c10fd(0x19a)]}),_0x420727=_0x478b8b['data'];_0x143f30[_0x1c10fd(0x19a)]&&console[_0x1c10fd(0x1de)](_0x1c10fd(0x1a1)+_0x420727);if(!_0x53f3c1){const _0x3bdeef=await withSpinner(_0x1c10fd(0x19c)+_0x1088f3+_0x1c10fd(0x1b9),()=>_0x503fed['segment'][_0x1c10fd(0x1b5)](_0x420727),{'verbose':_0x143f30['verbose']});await handleSDKOutput([_0x3bdeef['data']],_0x143f30);}else{const _0x527007=await withSpinner(_0x1c10fd(0x1b3)+_0x53f3c1+_0x1c10fd(0x1b9),()=>_0x503fed[_0x1c10fd(0x1e1)][_0x1c10fd(0x1dc)](_0x420727,_0x53f3c1),{'verbose':_0x143f30['verbose']}),_0x20b664=_0x527007[_0x1c10fd(0x1d2)];_0x143f30[_0x1c10fd(0x19a)]&&console[_0x1c10fd(0x1de)](_0x1c10fd(0x19d)+_0x20b664);const _0x5509fb=await withSpinner('Fetching\x20segment\x20\x27'+_0x53f3c1+'\x27...',()=>_0x503fed[_0x1c10fd(0x1e1)][_0x1c10fd(0x1dd)](_0x420727,_0x20b664),{'verbose':_0x143f30['verbose']});await handleSDKOutput([_0x5509fb[_0x1c10fd(0x1d2)]],_0x143f30);}return 0x0;}catch(_0x7ad210){if(_0x7ad210 instanceof SDKError)return console['error'](_0x1c10fd(0x1ad)+_0x7ad210['message']),_0x7ad210[_0x1c10fd(0x1a6)]&&console[_0x1c10fd(0x1de)](_0x1c10fd(0x1ac)+_0x7ad210[_0x1c10fd(0x1a6)]),0x1;throw _0x7ad210;}}}export class SegmentShowCommand extends BaseCommand{['name']=a15_0x629df1(0x1a7);[a15_0x629df1(0x197)]=a15_0x629df1(0x1df);async['execute'](_0x61f1d2){const _0x180327=a15_0x629df1,{options:_0x5b2fdb,args:_0x1efb1c,tdx:_0xf824ec}=_0x61f1d2;if(_0x1efb1c['length']===0x0)return console[_0x180327(0x1de)](_0x180327(0x1c7)),console[_0x180327(0x1de)](_0x180327(0x1a5)),0x1;try{const {parentId:_0x260e26,childId:_0x211314}=parseSegmentRef(_0x1efb1c[0x0]);_0x5b2fdb[_0x180327(0x19a)]&&(console[_0x180327(0x1de)](_0x180327(0x1b7)+_0x5b2fdb[_0x180327(0x19f)]),console['error']('Parent\x20name:\x20'+_0x260e26),_0x211314&&console['error'](_0x180327(0x1d4)+_0x211314));const _0x2b36ce=await withSpinner(_0x180327(0x1c1)+_0x260e26+_0x180327(0x1b9),()=>_0xf824ec[_0x180327(0x1e1)][_0x180327(0x1cb)](_0x260e26),{'verbose':_0x5b2fdb[_0x180327(0x19a)]}),_0x2efde8=_0x2b36ce[_0x180327(0x1d2)];_0x5b2fdb[_0x180327(0x19a)]&&console[_0x180327(0x1de)](_0x180327(0x1a1)+_0x2efde8);let _0x13d0a2;if(!_0x211314){const _0x291d44=await withSpinner(_0x180327(0x1be)+_0x260e26+'\x27...',()=>_0xf824ec[_0x180327(0x1e1)][_0x180327(0x1bd)](_0x2efde8),{'verbose':_0x5b2fdb[_0x180327(0x19a)]});_0x13d0a2=_0x291d44[_0x180327(0x1d2)];}else{const _0x12356f=await withSpinner(_0x180327(0x1b3)+_0x211314+_0x180327(0x1b9),()=>_0xf824ec[_0x180327(0x1e1)][_0x180327(0x1dc)](_0x2efde8,_0x211314),{'verbose':_0x5b2fdb[_0x180327(0x19a)]}),_0x2ed2f5=_0x12356f[_0x180327(0x1d2)];_0x5b2fdb[_0x180327(0x19a)]&&console[_0x180327(0x1de)](_0x180327(0x19d)+_0x2ed2f5);const _0x3a82d4=await withSpinner(_0x180327(0x1bb)+_0x211314+_0x180327(0x1b9),()=>_0xf824ec['segment'][_0x180327(0x19b)](_0x2efde8,_0x2ed2f5),{'verbose':_0x5b2fdb[_0x180327(0x19a)]});_0x13d0a2=_0x3a82d4[_0x180327(0x1d2)];}const _0x128785=_0x5b2fdb[_0x180327(0x1e0)],_0x302ed8=/\bLIMIT\s+\d+/i[_0x180327(0x19e)](_0x13d0a2);!_0x302ed8&&(_0x13d0a2=_0x13d0a2['trim']()[_0x180327(0x1d8)](/;+$/,''),_0x13d0a2=_0x180327(0x1a3)+_0x13d0a2+_0x180327(0x1cf)+_0x128785);_0x5b2fdb['verbose']&&console[_0x180327(0x1de)](_0x180327(0x1c9)+_0x13d0a2);const _0x3509a2=await withQuerySpinner(_0x180327(0x1e5),async _0xde6ec1=>{const _0x831711=_0x180327,_0x402866=await _0xf824ec[_0x831711(0x1bf)](_0x13d0a2,{'catalog':'td','schema':'information_schema','onJobId':_0x3bc48c=>{const _0x56d3d3=_0x831711;_0xde6ec1[_0x56d3d3(0x1c2)](_0x3bc48c);}});return _0x402866;},{'verbose':_0x5b2fdb[_0x180327(0x19a)]}),_0x404cf7=_0x3509a2[_0x180327(0x1d2)],_0x5aeb2e=_0x404cf7[_0x180327(0x1b0)]?'\x20[Job\x20ID:\x20'+_0x404cf7[_0x180327(0x1b0)]+']':'';return console[_0x180327(0x1de)](_0x180327(0x1d0)+_0x404cf7['stats'][_0x180327(0x1e8)]['toLocaleString']()+'\x20rows\x20'+(_0x180327(0x1b2)+formatElapsed(_0x404cf7['stats'][_0x180327(0x1c8)])+_0x5aeb2e)),await handleQueryOutput(_0x404cf7,_0x5b2fdb),0x0;}catch(_0x1f40f6){if(_0x1f40f6 instanceof SDKError){let _0x5a0029=_0x180327(0x1a0);return _0x1f40f6['cause']instanceof TrinoQueryError&&(_0x5a0029=_0x1f40f6['cause']['trinoError']?.['errorName']||_0x1f40f6['cause'][_0x180327(0x1b6)]?.[_0x180327(0x1da)]||_0x180327(0x1bc)),console[_0x180327(0x1de)](_0x180327(0x1d3)+_0x5a0029+']'),console[_0x180327(0x1de)]('\x0a'+_0x1f40f6[_0x180327(0x1eb)]),0x1;}throw _0x1f40f6;}}}export class SegmentFolderListCommand extends BaseCommand{[a15_0x629df1(0x1ae)]=a15_0x629df1(0x196);[a15_0x629df1(0x197)]='List\x20segment\x20folders\x20under\x20a\x20parent\x20segment';async[a15_0x629df1(0x1d5)](_0x4a2aa0){const _0x1ef975=a15_0x629df1,{options:_0x2bfe97,args:_0x5cd531,tdx:_0x33b8b7}=_0x4a2aa0;if(_0x5cd531[_0x1ef975(0x1e6)]===0x0)return console[_0x1ef975(0x1de)](_0x1ef975(0x1a4)),console[_0x1ef975(0x1de)](_0x1ef975(0x1d9)),0x1;const _0x1aeb47=_0x5cd531[0x0];try{_0x2bfe97[_0x1ef975(0x19a)]&&(console['error'](_0x1ef975(0x1b7)+_0x2bfe97['site']),console[_0x1ef975(0x1de)]('Parent\x20name:\x20'+_0x1aeb47));const _0x690178=await withSpinner(_0x1ef975(0x1c1)+_0x1aeb47+_0x1ef975(0x1b9),()=>_0x33b8b7[_0x1ef975(0x1e1)]['resolveParentId'](_0x1aeb47),{'verbose':_0x2bfe97['verbose']}),_0x2a127d=_0x690178['data'];_0x2bfe97[_0x1ef975(0x19a)]&&console[_0x1ef975(0x1de)](_0x1ef975(0x1a1)+_0x2a127d);const _0xab5d7=await withSpinner(_0x1ef975(0x1b1)+_0x1aeb47+'\x27...',()=>_0x33b8b7[_0x1ef975(0x1e1)][_0x1ef975(0x1c5)](_0x2a127d),{'verbose':_0x2bfe97[_0x1ef975(0x19a)]}),_0x48b308=_0xab5d7['data'];return console[_0x1ef975(0x1de)](_0x1ef975(0x1a9)+_0x48b308[_0x1ef975(0x1e6)]+'\x20folder'+(_0x48b308[_0x1ef975(0x1e6)]!==0x1?'s':'')),await handleSDKOutput(_0x48b308,_0x2bfe97),0x0;}catch(_0x19940b){if(_0x19940b instanceof SDKError)return console[_0x1ef975(0x1de)](_0x1ef975(0x1ad)+_0x19940b['message']),_0x19940b[_0x1ef975(0x1a6)]&&console['error']('\x20\x20Cause:\x20'+_0x19940b['cause']),0x1;throw _0x19940b;}}}export class SegmentFolderShowCommand extends BaseCommand{[a15_0x629df1(0x1ae)]='segment:folder:show';[a15_0x629df1(0x197)]=a15_0x629df1(0x1d1);async['execute'](_0x4c68b8){const _0x3276eb=a15_0x629df1,{options:_0x3aa60f,args:_0x3f8c9f,tdx:_0x17f421}=_0x4c68b8;if(_0x3f8c9f['length']===0x0)return console[_0x3276eb(0x1de)](_0x3276eb(0x1e7)),console[_0x3276eb(0x1de)](_0x3276eb(0x1d7)),0x1;try{const {parentId:_0x2dfafe,childId:_0xb1e3ee}=parseSegmentRef(_0x3f8c9f[0x0]);_0x3aa60f['verbose']&&(console[_0x3276eb(0x1de)](_0x3276eb(0x1b7)+_0x3aa60f[_0x3276eb(0x19f)]),console[_0x3276eb(0x1de)]('Parent\x20name:\x20'+_0x2dfafe),_0xb1e3ee&&console[_0x3276eb(0x1de)](_0x3276eb(0x1af)+_0xb1e3ee));if(!_0xb1e3ee)return console[_0x3276eb(0x1de)](_0x3276eb(0x1e3)),0x1;const _0x29f577=await withSpinner(_0x3276eb(0x1c1)+_0x2dfafe+'\x27...',()=>_0x17f421['segment']['resolveParentId'](_0x2dfafe),{'verbose':_0x3aa60f[_0x3276eb(0x19a)]}),_0x3abd1a=_0x29f577[_0x3276eb(0x1d2)];_0x3aa60f[_0x3276eb(0x19a)]&&console[_0x3276eb(0x1de)](_0x3276eb(0x1a1)+_0x3abd1a);const _0x4bd362=await withSpinner(_0x3276eb(0x1ca)+_0xb1e3ee+_0x3276eb(0x1b9),()=>_0x17f421[_0x3276eb(0x1e1)][_0x3276eb(0x1ea)](_0x3abd1a,_0xb1e3ee),{'verbose':_0x3aa60f[_0x3276eb(0x19a)]}),_0x1c04a3=_0x4bd362[_0x3276eb(0x1d2)];_0x3aa60f[_0x3276eb(0x19a)]&&console['error'](_0x3276eb(0x1d6)+_0x1c04a3);const _0xcabe6d=await withSpinner(_0x3276eb(0x1ab)+_0xb1e3ee+_0x3276eb(0x1b9),()=>_0x17f421[_0x3276eb(0x1e1)]['getFolder'](_0x1c04a3),{'verbose':_0x3aa60f[_0x3276eb(0x19a)]});return await handleSDKOutput([_0xcabe6d[_0x3276eb(0x1d2)]],_0x3aa60f),0x0;}catch(_0x30f533){if(_0x30f533 instanceof SDKError)return console['error']('Error:\x20'+_0x30f533[_0x3276eb(0x1eb)]),_0x30f533[_0x3276eb(0x1a6)]&&console[_0x3276eb(0x1de)](_0x3276eb(0x1ac)+_0x30f533[_0x3276eb(0x1a6)]),0x1;throw _0x30f533;}}}function a15_0xc08f(_0x31f27b,_0x42e5dc){const _0x427c87=a15_0x427c();return a15_0xc08f=function(_0xc08f04,_0x5e8443){_0xc08f04=_0xc08f04-0x196;let _0x333879=_0x427c87[_0xc08f04];return _0x333879;},a15_0xc08f(_0x31f27b,_0x42e5dc);}export class SegmentSQLCommand extends BaseCommand{[a15_0x629df1(0x1ae)]=a15_0x629df1(0x1e2);[a15_0x629df1(0x197)]=a15_0x629df1(0x1a8);async[a15_0x629df1(0x1d5)](_0x286788){const _0x4bebc2=a15_0x629df1,{options:_0x2461ab,args:_0x39eba9,tdx:_0x1052ed}=_0x286788;if(_0x39eba9[_0x4bebc2(0x1e6)]===0x0)return console[_0x4bebc2(0x1de)]('Error:\x20Segment\x20name\x20is\x20required'),console[_0x4bebc2(0x1de)](_0x4bebc2(0x1cd)),0x1;try{const {parentId:_0x10c366,childId:_0x248034}=parseSegmentRef(_0x39eba9[0x0]);_0x2461ab[_0x4bebc2(0x19a)]&&(console[_0x4bebc2(0x1de)](_0x4bebc2(0x1b7)+_0x2461ab['site']),console['error'](_0x4bebc2(0x1b4)+_0x10c366),_0x248034&&console[_0x4bebc2(0x1de)](_0x4bebc2(0x1d4)+_0x248034));const _0xbaa74=await withSpinner(_0x4bebc2(0x1c1)+_0x10c366+_0x4bebc2(0x1b9),()=>_0x1052ed[_0x4bebc2(0x1e1)][_0x4bebc2(0x1cb)](_0x10c366),{'verbose':_0x2461ab[_0x4bebc2(0x19a)]}),_0x5c9076=_0xbaa74['data'];_0x2461ab[_0x4bebc2(0x19a)]&&console[_0x4bebc2(0x1de)](_0x4bebc2(0x1a1)+_0x5c9076);let _0x463eb4;if(!_0x248034){const _0x51504e=await withSpinner(_0x4bebc2(0x1be)+_0x10c366+'\x27...',()=>_0x1052ed[_0x4bebc2(0x1e1)][_0x4bebc2(0x1bd)](_0x5c9076),{'verbose':_0x2461ab[_0x4bebc2(0x19a)]});_0x463eb4=_0x51504e['data'];}else{const _0x362edf=await withSpinner(_0x4bebc2(0x1b3)+_0x248034+_0x4bebc2(0x1b9),()=>_0x1052ed['segment'][_0x4bebc2(0x1dc)](_0x5c9076,_0x248034),{'verbose':_0x2461ab[_0x4bebc2(0x19a)]}),_0x34ed07=_0x362edf[_0x4bebc2(0x1d2)];_0x2461ab[_0x4bebc2(0x19a)]&&console[_0x4bebc2(0x1de)]('Resolved\x20child\x20ID:\x20'+_0x34ed07);const _0x34b258=await withSpinner('Fetching\x20SQL\x20for\x20segment\x20\x27'+_0x248034+_0x4bebc2(0x1b9),()=>_0x1052ed[_0x4bebc2(0x1e1)][_0x4bebc2(0x19b)](_0x5c9076,_0x34ed07),{'verbose':_0x2461ab[_0x4bebc2(0x19a)]});_0x463eb4=_0x34b258[_0x4bebc2(0x1d2)];}return _0x2461ab['format']==='json'||_0x2461ab['format']===_0x4bebc2(0x1c0)?await handleSDKOutput([{'sql':_0x463eb4}],_0x2461ab):console[_0x4bebc2(0x1e4)](_0x463eb4),0x0;}catch(_0x37a046){if(_0x37a046 instanceof SDKError)return console[_0x4bebc2(0x1de)]('Error:\x20'+_0x37a046[_0x4bebc2(0x1eb)]),_0x37a046[_0x4bebc2(0x1a6)]&&console[_0x4bebc2(0x1de)](_0x4bebc2(0x1ac)+_0x37a046[_0x4bebc2(0x1a6)]),0x1;throw _0x37a046;}}}
|
|
1
|
+
const a16_0x404f4b=a16_0x4d1d;(function(_0x3a5282,_0x4bb117){const _0x33ead4=a16_0x4d1d,_0x57f89c=_0x3a5282();while(!![]){try{const _0x2864cb=parseInt(_0x33ead4(0x241))/0x1+parseInt(_0x33ead4(0x1f5))/0x2*(-parseInt(_0x33ead4(0x1f4))/0x3)+parseInt(_0x33ead4(0x239))/0x4+-parseInt(_0x33ead4(0x21f))/0x5+-parseInt(_0x33ead4(0x20d))/0x6*(-parseInt(_0x33ead4(0x213))/0x7)+-parseInt(_0x33ead4(0x20a))/0x8*(parseInt(_0x33ead4(0x237))/0x9)+parseInt(_0x33ead4(0x210))/0xa;if(_0x2864cb===_0x4bb117)break;else _0x57f89c['push'](_0x57f89c['shift']());}catch(_0xfda599){_0x57f89c['push'](_0x57f89c['shift']());}}}(a16_0x5482,0x9c27d));import{BaseCommand}from'./command.js';function a16_0x4d1d(_0x12359c,_0x188764){const _0x5482fb=a16_0x5482();return a16_0x4d1d=function(_0x4d1ddd,_0x524c84){_0x4d1ddd=_0x4d1ddd-0x1ee;let _0x2b02f1=_0x5482fb[_0x4d1ddd];return _0x2b02f1;},a16_0x4d1d(_0x12359c,_0x188764);}import{SDKError}from'../sdk/index.js';import{handleSDKOutput,handleQueryOutput}from'../utils/command-output.js';import{withSpinner,withQuerySpinner,formatElapsed}from'../utils/spinner.js';import{TrinoQueryError}from'../client/trino-client.js';import{parseSegmentRef}from'../utils/segment-ref-parser.js';export class SegmentDescribeCommand extends BaseCommand{[a16_0x404f4b(0x22c)]=a16_0x404f4b(0x20e);[a16_0x404f4b(0x220)]=a16_0x404f4b(0x1fe);async['execute'](_0x322add){const _0x4ba1d5=a16_0x404f4b,{options:_0x2c120d,args:_0xbf7fa9,tdx:_0x424aa1}=_0x322add;if(_0xbf7fa9[_0x4ba1d5(0x229)]===0x0)return console['error'](_0x4ba1d5(0x23a)),console[_0x4ba1d5(0x215)](_0x4ba1d5(0x227)),0x1;try{const {parentId:_0xf091d6,childId:_0x5626c2}=parseSegmentRef(_0xbf7fa9[0x0]);_0x2c120d[_0x4ba1d5(0x21e)]&&(console[_0x4ba1d5(0x215)](_0x4ba1d5(0x1f9)+_0x2c120d[_0x4ba1d5(0x1f7)]),console[_0x4ba1d5(0x215)](_0x4ba1d5(0x21d)+_0xf091d6),_0x5626c2&&console[_0x4ba1d5(0x215)]('Child\x20name:\x20'+_0x5626c2));const _0x27f229=await withSpinner(_0x4ba1d5(0x234)+_0xf091d6+_0x4ba1d5(0x23d),()=>_0x424aa1[_0x4ba1d5(0x209)][_0x4ba1d5(0x203)](_0xf091d6),{'verbose':_0x2c120d[_0x4ba1d5(0x21e)]}),_0x11455d=_0x27f229[_0x4ba1d5(0x208)];_0x2c120d['verbose']&&console[_0x4ba1d5(0x215)](_0x4ba1d5(0x222)+_0x11455d);if(!_0x5626c2){const _0x27e467=await withSpinner('Fetching\x20parent\x20segment\x20\x27'+_0xf091d6+'\x27...',()=>_0x424aa1['segment'][_0x4ba1d5(0x232)](_0x11455d),{'verbose':_0x2c120d['verbose']});await handleSDKOutput([_0x27e467[_0x4ba1d5(0x208)]],_0x2c120d);}else{const _0xe3e549=await withSpinner(_0x4ba1d5(0x20f)+_0x5626c2+_0x4ba1d5(0x23d),()=>_0x424aa1['segment'][_0x4ba1d5(0x1ef)](_0x11455d,_0x5626c2),{'verbose':_0x2c120d['verbose']}),_0x269f8b=_0xe3e549[_0x4ba1d5(0x208)];_0x2c120d['verbose']&&console[_0x4ba1d5(0x215)](_0x4ba1d5(0x21a)+_0x269f8b);const _0x9278d5=await withSpinner(_0x4ba1d5(0x21b)+_0x5626c2+_0x4ba1d5(0x23d),()=>_0x424aa1[_0x4ba1d5(0x209)][_0x4ba1d5(0x218)](_0x11455d,_0x269f8b),{'verbose':_0x2c120d[_0x4ba1d5(0x21e)]});await handleSDKOutput([_0x9278d5['data']],_0x2c120d);}return 0x0;}catch(_0x139858){if(_0x139858 instanceof SDKError)return console['error'](_0x4ba1d5(0x1f6)+_0x139858[_0x4ba1d5(0x235)]),_0x139858['cause']&&console[_0x4ba1d5(0x215)](_0x4ba1d5(0x1f1)+_0x139858[_0x4ba1d5(0x1fc)]),0x1;throw _0x139858;}}}export class SegmentShowCommand extends BaseCommand{['name']='segment:show';[a16_0x404f4b(0x220)]=a16_0x404f4b(0x202);async['execute'](_0x18a2eb){const _0xfd0156=a16_0x404f4b,{options:_0x5ef5d9,args:_0x1b0740,tdx:_0x40a76e}=_0x18a2eb;if(_0x1b0740[_0xfd0156(0x229)]===0x0)return console['error'](_0xfd0156(0x23a)),console[_0xfd0156(0x215)](_0xfd0156(0x230)),0x1;try{const {parentId:_0x5535fc,childId:_0xa452c2}=parseSegmentRef(_0x1b0740[0x0]);_0x5ef5d9['verbose']&&(console[_0xfd0156(0x215)](_0xfd0156(0x1f9)+_0x5ef5d9[_0xfd0156(0x1f7)]),console[_0xfd0156(0x215)]('Parent\x20name:\x20'+_0x5535fc),_0xa452c2&&console['error'](_0xfd0156(0x200)+_0xa452c2));const _0x59300d=await withSpinner(_0xfd0156(0x234)+_0x5535fc+_0xfd0156(0x23d),()=>_0x40a76e['segment'][_0xfd0156(0x203)](_0x5535fc),{'verbose':_0x5ef5d9[_0xfd0156(0x21e)]}),_0xe5e5dc=_0x59300d['data'];_0x5ef5d9[_0xfd0156(0x21e)]&&console[_0xfd0156(0x215)](_0xfd0156(0x222)+_0xe5e5dc);let _0x25803c;if(!_0xa452c2){const _0x3c0deb=await withSpinner('Fetching\x20SQL\x20for\x20parent\x20\x27'+_0x5535fc+'\x27...',()=>_0x40a76e[_0xfd0156(0x209)][_0xfd0156(0x231)](_0xe5e5dc),{'verbose':_0x5ef5d9[_0xfd0156(0x21e)]});_0x25803c=_0x3c0deb['data'];}else{const _0x37e9ba=await withSpinner(_0xfd0156(0x20f)+_0xa452c2+_0xfd0156(0x23d),()=>_0x40a76e['segment'][_0xfd0156(0x1ef)](_0xe5e5dc,_0xa452c2),{'verbose':_0x5ef5d9[_0xfd0156(0x21e)]}),_0x12c200=_0x37e9ba[_0xfd0156(0x208)];_0x5ef5d9[_0xfd0156(0x21e)]&&console['error'](_0xfd0156(0x21a)+_0x12c200);const _0x312c0d=await withSpinner(_0xfd0156(0x1f0)+_0xa452c2+'\x27...',()=>_0x40a76e[_0xfd0156(0x209)][_0xfd0156(0x224)](_0xe5e5dc,_0x12c200),{'verbose':_0x5ef5d9[_0xfd0156(0x21e)]});_0x25803c=_0x312c0d['data'];}const _0x4d4756=_0x5ef5d9[_0xfd0156(0x22d)],_0x178988=/\bLIMIT\s+\d+/i[_0xfd0156(0x1f3)](_0x25803c);!_0x178988&&(_0x25803c=_0x25803c[_0xfd0156(0x223)]()[_0xfd0156(0x233)](/;+$/,''),_0x25803c=_0xfd0156(0x23c)+_0x25803c+_0xfd0156(0x242)+_0x4d4756);_0x5ef5d9[_0xfd0156(0x21e)]&&console['error'](_0xfd0156(0x20c)+_0x25803c);const _0x3c6df9=await withQuerySpinner(_0xfd0156(0x1fd),async _0x386c3e=>{const _0x207194=_0xfd0156,_0x1db898=await _0x40a76e[_0x207194(0x206)](_0x25803c,{'catalog':'td','schema':_0x207194(0x219),'onJobId':_0x312110=>{const _0x335027=_0x207194;_0x386c3e[_0x335027(0x211)](_0x312110);}});return _0x1db898;},{'verbose':_0x5ef5d9[_0xfd0156(0x21e)]}),_0x14ba56=_0x3c6df9['data'],_0x4e239f=_0x14ba56[_0xfd0156(0x21c)]?_0xfd0156(0x23b)+_0x14ba56[_0xfd0156(0x21c)]+']':'';return console[_0xfd0156(0x215)](_0xfd0156(0x217)+_0x14ba56[_0xfd0156(0x1ee)][_0xfd0156(0x22a)][_0xfd0156(0x221)]()+_0xfd0156(0x1f2)+('in\x20'+formatElapsed(_0x14ba56[_0xfd0156(0x1ee)][_0xfd0156(0x1fa)])+_0x4e239f)),await handleQueryOutput(_0x14ba56,_0x5ef5d9),0x0;}catch(_0x48f7e8){if(_0x48f7e8 instanceof SDKError){let _0x38347c='UNKNOWN_ERROR';return _0x48f7e8[_0xfd0156(0x1fc)]instanceof TrinoQueryError&&(_0x38347c=_0x48f7e8[_0xfd0156(0x1fc)][_0xfd0156(0x201)]?.[_0xfd0156(0x240)]||_0x48f7e8[_0xfd0156(0x1fc)][_0xfd0156(0x201)]?.['errorType']||'QUERY_ERROR'),console['error'](_0xfd0156(0x20b)+_0x38347c+']'),console['error']('\x0a'+_0x48f7e8['message']),0x1;}throw _0x48f7e8;}}}export class SegmentFolderListCommand extends BaseCommand{[a16_0x404f4b(0x22c)]=a16_0x404f4b(0x205);[a16_0x404f4b(0x220)]='List\x20segment\x20folders\x20under\x20a\x20parent\x20segment';async['execute'](_0x2104d2){const _0x49df27=a16_0x404f4b,{options:_0x197106,args:_0x38467d,tdx:_0x2e1ba9}=_0x2104d2;if(_0x38467d[_0x49df27(0x229)]===0x0)return console[_0x49df27(0x215)](_0x49df27(0x228)),console['error'](_0x49df27(0x212)),0x1;const _0x296f5b=_0x38467d[0x0];try{_0x197106[_0x49df27(0x21e)]&&(console[_0x49df27(0x215)](_0x49df27(0x1f9)+_0x197106[_0x49df27(0x1f7)]),console[_0x49df27(0x215)](_0x49df27(0x21d)+_0x296f5b));const _0x60dbe3=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x296f5b+_0x49df27(0x23d),()=>_0x2e1ba9[_0x49df27(0x209)][_0x49df27(0x203)](_0x296f5b),{'verbose':_0x197106['verbose']}),_0x388a1d=_0x60dbe3[_0x49df27(0x208)];_0x197106[_0x49df27(0x21e)]&&console['error']('Resolved\x20parent\x20ID:\x20'+_0x388a1d);const _0x262c1c=await withSpinner('Listing\x20folders\x20for\x20parent\x20\x27'+_0x296f5b+'\x27...',()=>_0x2e1ba9[_0x49df27(0x209)]['listFolders'](_0x388a1d),{'verbose':_0x197106['verbose']}),_0x4db65f=_0x262c1c[_0x49df27(0x208)];return console['error'](_0x49df27(0x1f8)+_0x4db65f['length']+_0x49df27(0x23f)+(_0x4db65f[_0x49df27(0x229)]!==0x1?'s':'')),await handleSDKOutput(_0x4db65f,_0x197106),0x0;}catch(_0x3c5ddb){if(_0x3c5ddb instanceof SDKError)return console[_0x49df27(0x215)](_0x49df27(0x1f6)+_0x3c5ddb['message']),_0x3c5ddb['cause']&&console[_0x49df27(0x215)](_0x49df27(0x1f1)+_0x3c5ddb[_0x49df27(0x1fc)]),0x1;throw _0x3c5ddb;}}}export class SegmentFolderShowCommand extends BaseCommand{[a16_0x404f4b(0x22c)]=a16_0x404f4b(0x22f);[a16_0x404f4b(0x220)]=a16_0x404f4b(0x23e);async['execute'](_0x5adf2c){const _0x5e8b6d=a16_0x404f4b,{options:_0x4036d1,args:_0x5f189f,tdx:_0x1ff4cd}=_0x5adf2c;if(_0x5f189f[_0x5e8b6d(0x229)]===0x0)return console[_0x5e8b6d(0x215)](_0x5e8b6d(0x226)),console['error'](_0x5e8b6d(0x236)),0x1;try{const {parentId:_0x3e61a7,childId:_0x1bd3ef}=parseSegmentRef(_0x5f189f[0x0]);_0x4036d1[_0x5e8b6d(0x21e)]&&(console[_0x5e8b6d(0x215)](_0x5e8b6d(0x1f9)+_0x4036d1[_0x5e8b6d(0x1f7)]),console[_0x5e8b6d(0x215)]('Parent\x20name:\x20'+_0x3e61a7),_0x1bd3ef&&console[_0x5e8b6d(0x215)](_0x5e8b6d(0x1fb)+_0x1bd3ef));if(!_0x1bd3ef)return console[_0x5e8b6d(0x215)](_0x5e8b6d(0x207)),0x1;const _0x19dcba=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x3e61a7+'\x27...',()=>_0x1ff4cd[_0x5e8b6d(0x209)][_0x5e8b6d(0x203)](_0x3e61a7),{'verbose':_0x4036d1['verbose']}),_0x39987c=_0x19dcba[_0x5e8b6d(0x208)];_0x4036d1[_0x5e8b6d(0x21e)]&&console[_0x5e8b6d(0x215)](_0x5e8b6d(0x222)+_0x39987c);const _0x3dd71f=await withSpinner(_0x5e8b6d(0x22e)+_0x1bd3ef+_0x5e8b6d(0x23d),()=>_0x1ff4cd[_0x5e8b6d(0x209)][_0x5e8b6d(0x238)](_0x39987c,_0x1bd3ef),{'verbose':_0x4036d1[_0x5e8b6d(0x21e)]}),_0x98f9bd=_0x3dd71f[_0x5e8b6d(0x208)];_0x4036d1['verbose']&&console[_0x5e8b6d(0x215)]('Resolved\x20folder\x20ID:\x20'+_0x98f9bd);const _0x119465=await withSpinner(_0x5e8b6d(0x214)+_0x1bd3ef+'\x27...',()=>_0x1ff4cd[_0x5e8b6d(0x209)]['getFolder'](_0x98f9bd),{'verbose':_0x4036d1[_0x5e8b6d(0x21e)]});return await handleSDKOutput([_0x119465[_0x5e8b6d(0x208)]],_0x4036d1),0x0;}catch(_0x4deea7){if(_0x4deea7 instanceof SDKError)return console[_0x5e8b6d(0x215)](_0x5e8b6d(0x1f6)+_0x4deea7[_0x5e8b6d(0x235)]),_0x4deea7['cause']&&console['error']('\x20\x20Cause:\x20'+_0x4deea7[_0x5e8b6d(0x1fc)]),0x1;throw _0x4deea7;}}}function a16_0x5482(){const _0x1e62fc=['resolveSegmentId','Fetching\x20SQL\x20for\x20segment\x20\x27','\x20\x20Cause:\x20','\x20rows\x20','test','29043ByCpST','134AMKXfw','Error:\x20','site','✔\x20Found\x20','Site:\x20','elapsedTimeMillis','Folder\x20name:\x20','cause','Executing\x20segment\x20query...','Show\x20parent\x20or\x20child\x20segment\x20details','format','Child\x20name:\x20','trinoError','Execute\x20segment\x20SQL\x20query\x20and\x20show\x20results','resolveParentId','Get\x20SQL\x20query\x20for\x20parent\x20or\x20child\x20segment','segment:folder:list','query','Error:\x20Folder\x20name\x20is\x20required\x20(use\x20parent_name.folder_name\x20format)','data','segment','46568HAxCRJ','✖\x20Query\x20failed\x20[','SQL\x20query:\x0a','774jQRmvo','segment:describe','Resolving\x20child\x20segment\x20\x27','6095120SPHzte','setJobId','Usage:\x20tdx\x20segment\x20folder\x20list\x20<parent_name>','13734oTVJMW','Fetching\x20folder\x20\x27','error','execute','✔\x20Query\x20completed:\x20Processed\x20','getSegment','information_schema','Resolved\x20child\x20ID:\x20','Fetching\x20segment\x20\x27','jobId','Parent\x20name:\x20','verbose','1263340qFVNsW','description','toLocaleString','Resolved\x20parent\x20ID:\x20','trim','getSegmentSQL','segment:sql','Error:\x20Folder\x20reference\x20is\x20required','Usage:\x20tdx\x20segment\x20describe\x20<parent_name>\x20or\x20<parent_name.child_name>','Error:\x20Parent\x20segment\x20name\x20is\x20required','length','processedRows','Fetching\x20SQL\x20for\x20parent\x20\x27','name','limit','Resolving\x20folder\x20\x27','segment:folder:show','Usage:\x20tdx\x20segment\x20show\x20<parent_name>\x20or\x20<parent_name.child_name>','getParentSQL','getParent','replace','Resolving\x20parent\x20segment\x20\x27','message','Usage:\x20tdx\x20segment\x20folder\x20show\x20<parent_name.folder_name>','486KGszlj','resolveFolderId','1722376DvsaHH','Error:\x20Segment\x20name\x20is\x20required','\x20[Job\x20ID:\x20','SELECT\x20*\x20FROM\x20(\x0a','\x27...','Show\x20segment\x20folder\x20details','\x20folder','errorName','562038MVtFQL','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','jsonl','stats'];a16_0x5482=function(){return _0x1e62fc;};return a16_0x5482();}export class SegmentSQLCommand extends BaseCommand{[a16_0x404f4b(0x22c)]=a16_0x404f4b(0x225);[a16_0x404f4b(0x220)]=a16_0x404f4b(0x204);async[a16_0x404f4b(0x216)](_0x292088){const _0xf22cec=a16_0x404f4b,{options:_0x5aa3e1,args:_0x50f0f6,tdx:_0x39daba}=_0x292088;if(_0x50f0f6[_0xf22cec(0x229)]===0x0)return console[_0xf22cec(0x215)](_0xf22cec(0x23a)),console[_0xf22cec(0x215)]('Usage:\x20tdx\x20segment\x20sql\x20<parent_name>\x20or\x20<parent_name.child_name>'),0x1;try{const {parentId:_0x3f8a33,childId:_0x4300aa}=parseSegmentRef(_0x50f0f6[0x0]);_0x5aa3e1['verbose']&&(console[_0xf22cec(0x215)](_0xf22cec(0x1f9)+_0x5aa3e1[_0xf22cec(0x1f7)]),console[_0xf22cec(0x215)](_0xf22cec(0x21d)+_0x3f8a33),_0x4300aa&&console[_0xf22cec(0x215)](_0xf22cec(0x200)+_0x4300aa));const _0x3f0bb5=await withSpinner(_0xf22cec(0x234)+_0x3f8a33+_0xf22cec(0x23d),()=>_0x39daba[_0xf22cec(0x209)]['resolveParentId'](_0x3f8a33),{'verbose':_0x5aa3e1[_0xf22cec(0x21e)]}),_0x2d4b5b=_0x3f0bb5[_0xf22cec(0x208)];_0x5aa3e1[_0xf22cec(0x21e)]&&console[_0xf22cec(0x215)]('Resolved\x20parent\x20ID:\x20'+_0x2d4b5b);let _0x5a88d8;if(!_0x4300aa){const _0x24785=await withSpinner(_0xf22cec(0x22b)+_0x3f8a33+_0xf22cec(0x23d),()=>_0x39daba[_0xf22cec(0x209)][_0xf22cec(0x231)](_0x2d4b5b),{'verbose':_0x5aa3e1['verbose']});_0x5a88d8=_0x24785[_0xf22cec(0x208)];}else{const _0x5ae3f4=await withSpinner(_0xf22cec(0x20f)+_0x4300aa+_0xf22cec(0x23d),()=>_0x39daba[_0xf22cec(0x209)][_0xf22cec(0x1ef)](_0x2d4b5b,_0x4300aa),{'verbose':_0x5aa3e1[_0xf22cec(0x21e)]}),_0x3c94ad=_0x5ae3f4[_0xf22cec(0x208)];_0x5aa3e1[_0xf22cec(0x21e)]&&console['error']('Resolved\x20child\x20ID:\x20'+_0x3c94ad);const _0x233349=await withSpinner(_0xf22cec(0x1f0)+_0x4300aa+_0xf22cec(0x23d),()=>_0x39daba[_0xf22cec(0x209)][_0xf22cec(0x224)](_0x2d4b5b,_0x3c94ad),{'verbose':_0x5aa3e1[_0xf22cec(0x21e)]});_0x5a88d8=_0x233349[_0xf22cec(0x208)];}return _0x5aa3e1[_0xf22cec(0x1ff)]==='json'||_0x5aa3e1[_0xf22cec(0x1ff)]===_0xf22cec(0x243)?await handleSDKOutput([{'sql':_0x5a88d8}],_0x5aa3e1):console['log'](_0x5a88d8),0x0;}catch(_0x10c585){if(_0x10c585 instanceof SDKError)return console[_0xf22cec(0x215)](_0xf22cec(0x1f6)+_0x10c585[_0xf22cec(0x235)]),_0x10c585[_0xf22cec(0x1fc)]&&console[_0xf22cec(0x215)](_0xf22cec(0x1f1)+_0x10c585[_0xf22cec(0x1fc)]),0x1;throw _0x10c585;}}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const a17_0x1d930f=a17_0x5f50;function a17_0x5f50(_0xeb0bb,_0x3bd700){const _0x562165=a17_0x5621();return a17_0x5f50=function(_0x5f50e1,_0x347447){_0x5f50e1=_0x5f50e1-0x142;let _0x10a490=_0x562165[_0x5f50e1];return _0x10a490;},a17_0x5f50(_0xeb0bb,_0x3bd700);}(function(_0xe4fa5f,_0x2447ca){const _0x246143=a17_0x5f50,_0x3799f2=_0xe4fa5f();while(!![]){try{const _0x526a6b=-parseInt(_0x246143(0x14d))/0x1+parseInt(_0x246143(0x142))/0x2+-parseInt(_0x246143(0x157))/0x3+parseInt(_0x246143(0x15c))/0x4*(parseInt(_0x246143(0x151))/0x5)+-parseInt(_0x246143(0x15f))/0x6+-parseInt(_0x246143(0x14f))/0x7*(-parseInt(_0x246143(0x158))/0x8)+parseInt(_0x246143(0x164))/0x9;if(_0x526a6b===_0x2447ca)break;else _0x3799f2['push'](_0x3799f2['shift']());}catch(_0x35658d){_0x3799f2['push'](_0x3799f2['shift']());}}}(a17_0x5621,0x45dab));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';import{handleSDKOutput}from'../utils/command-output.js';import{withSpinner}from'../utils/spinner.js';export class SegmentsCommand extends BaseCommand{[a17_0x1d930f(0x148)]=a17_0x1d930f(0x153);[a17_0x1d930f(0x149)]=a17_0x1d930f(0x156);async[a17_0x1d930f(0x163)](_0xd8cebe){const _0x3b1dea=a17_0x1d930f,{options:_0x4f6b46,args:_0x2c1f64,tdx:_0x3578ee}=_0xd8cebe,_0x4d103f=_0x2c1f64[0x0];try{_0x4f6b46[_0x3b1dea(0x143)]&&(console[_0x3b1dea(0x168)](_0x3b1dea(0x152)+_0x4f6b46[_0x3b1dea(0x155)]),_0x4d103f&&console[_0x3b1dea(0x168)](_0x3b1dea(0x159)+_0x4d103f));if(!_0x4d103f){const _0xf62ec7=await withSpinner(_0x3b1dea(0x161),()=>_0x3578ee[_0x3b1dea(0x150)][_0x3b1dea(0x14c)](),{'verbose':_0x4f6b46[_0x3b1dea(0x143)]}),_0x16014b=_0xf62ec7[_0x3b1dea(0x154)];console[_0x3b1dea(0x168)](_0x3b1dea(0x15b)+_0x16014b['length']+_0x3b1dea(0x15d)+(_0x16014b[_0x3b1dea(0x162)]!==0x1?'s':''));const _0xbf8563=_0x16014b[_0x3b1dea(0x14e)](_0xd856b3=>({'id':_0xd856b3['id'],'name':_0xd856b3[_0x3b1dea(0x14b)][_0x3b1dea(0x148)],'description':_0xd856b3[_0x3b1dea(0x14b)]['description'],'population':_0xd856b3[_0x3b1dea(0x14b)][_0x3b1dea(0x146)],'createdAt':_0xd856b3[_0x3b1dea(0x14b)][_0x3b1dea(0x160)],'updatedAt':_0xd856b3[_0x3b1dea(0x14b)][_0x3b1dea(0x147)]}));await handleSDKOutput(_0xbf8563,_0x4f6b46);}else{const _0x1a93a2=await withSpinner(_0x3b1dea(0x166)+_0x4d103f+_0x3b1dea(0x15a),()=>_0x3578ee[_0x3b1dea(0x150)][_0x3b1dea(0x145)](_0x4d103f),{'verbose':_0x4f6b46[_0x3b1dea(0x143)]}),_0x12fdf6=_0x1a93a2[_0x3b1dea(0x154)];_0x4f6b46[_0x3b1dea(0x143)]&&console[_0x3b1dea(0x168)]('Resolved\x20parent\x20ID:\x20'+_0x12fdf6);const _0x6fb7e9=await withSpinner('Listing\x20segments\x20for\x20parent\x20\x27'+_0x4d103f+_0x3b1dea(0x15a),()=>_0x3578ee[_0x3b1dea(0x150)]['listSegments'](_0x12fdf6),{'verbose':_0x4f6b46[_0x3b1dea(0x143)]}),_0x5167f8=_0x6fb7e9[_0x3b1dea(0x154)];console[_0x3b1dea(0x168)](_0x3b1dea(0x15b)+_0x5167f8['length']+_0x3b1dea(0x144)+(_0x5167f8[_0x3b1dea(0x162)]!==0x1?'s':''));const _0x405357=_0x5167f8[_0x3b1dea(0x14e)](_0x328dbd=>({'id':_0x328dbd['id'],'name':_0x328dbd['name'],'description':_0x328dbd['description'],'population':_0x328dbd[_0x3b1dea(0x146)],'createdAt':_0x328dbd[_0x3b1dea(0x160)],'updatedAt':_0x328dbd[_0x3b1dea(0x147)]}));await handleSDKOutput(_0x405357,_0x4f6b46);}return 0x0;}catch(_0x47883e){if(_0x47883e instanceof SDKError)return console['error'](_0x3b1dea(0x14a)+_0x47883e[_0x3b1dea(0x15e)]),_0x47883e[_0x3b1dea(0x165)]&&console[_0x3b1dea(0x168)](_0x3b1dea(0x167)+_0x47883e['cause']),0x1;throw _0x47883e;}}}function a17_0x5621(){const _0xa5c0e6=['segments','data','site','List\x20parent\x20segments\x20or\x20child\x20segments','1370550StMXWs','8EzxeZg','Parent\x20name:\x20','\x27...','✔\x20Found\x20','195220xyMpgR','\x20parent\x20segment','message','779442wvKnPW','createdAt','Listing\x20parent\x20segments...','length','execute','3607569VFmpCI','cause','Resolving\x20parent\x20segment\x20\x27','\x20\x20Cause:\x20','error','346154mwjRLb','verbose','\x20segment','resolveParentId','population','updatedAt','name','description','Error:\x20','attributes','listParents','339280EwAbzv','map','3784424izsdWe','segment','10HQKTak','Site:\x20'];a17_0x5621=function(){return _0xa5c0e6;};return a17_0x5621();}
|
package/dist/commands/show.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const a18_0x1ef85f=a18_0x7bf3;(function(_0xa7d10f,_0x4fed2c){const _0x5584bd=a18_0x7bf3,_0x33e160=_0xa7d10f();while(!![]){try{const _0x30889d=-parseInt(_0x5584bd(0x1e4))/0x1+-parseInt(_0x5584bd(0x1de))/0x2*(-parseInt(_0x5584bd(0x1fc))/0x3)+parseInt(_0x5584bd(0x1fb))/0x4+-parseInt(_0x5584bd(0x1f7))/0x5+-parseInt(_0x5584bd(0x1df))/0x6*(parseInt(_0x5584bd(0x1e9))/0x7)+parseInt(_0x5584bd(0x1e5))/0x8+parseInt(_0x5584bd(0x1d6))/0x9*(parseInt(_0x5584bd(0x1f5))/0xa);if(_0x30889d===_0x4fed2c)break;else _0x33e160['push'](_0x33e160['shift']());}catch(_0x3aa356){_0x33e160['push'](_0x33e160['shift']());}}}(a18_0x5a80,0x61b54));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 a18_0x5a80(){const _0x580a26=['9cPwQXr','catalog','Table:\x20','Table\x20name\x20is\x20required\x20(use\x20<database.table>\x20or\x20<table>\x20with\x20--database/--in\x20option)','Error:\x20Too\x20many\x20arguments','data','Error:\x20','database','610PfdOdf','6tKkCrz','args','length','Usage:\x20tdx\x20show\x20<database.table>','show','743664yuiktp','7504Qrzedj','\x20\x20\x20or:\x20tdx\x20show\x20<catalog.database.table>','Catalog:\x20','\x20\x20\x20or:\x20tdx\x20show\x20<table>\x20--database\x20<database>','1941079VGbiga','description','...','message','name','validate','Error:\x20Table\x20name\x20is\x20required','limit','site','execute','Database:\x20','error','4614580hhGnjV','\x20\x20\x20or:\x20tdx\x20show\x20<table>\x20--in\x20<database>','1662085Fnxilx','verbose','Site:\x20','showTable','2103796XAPlPi','7527blxwfi','Querying\x20','\x20from\x20','\x20\x20Cause:\x20'];a18_0x5a80=function(){return _0x580a26;};return a18_0x5a80();}import{withSpinner}from'../utils/spinner.js';function a18_0x7bf3(_0x5f3346,_0x34900d){const _0x5a804d=a18_0x5a80();return a18_0x7bf3=function(_0x7bf3f1,_0x127c09){_0x7bf3f1=_0x7bf3f1-0x1d3;let _0x40c60d=_0x5a804d[_0x7bf3f1];return _0x40c60d;},a18_0x7bf3(_0x5f3346,_0x34900d);}export class ShowCommand extends BaseCommand{[a18_0x1ef85f(0x1ed)]=a18_0x1ef85f(0x1e3);[a18_0x1ef85f(0x1ea)]='Show\x20table\x20contents';async[a18_0x1ef85f(0x1f2)](_0x36292a){const _0x259a1f=a18_0x1ef85f,{args:_0x3b80f0}=_0x36292a;if(_0x3b80f0['length']===0x0)return console[_0x259a1f(0x1f4)](_0x259a1f(0x1ef)),console[_0x259a1f(0x1f4)](_0x259a1f(0x1e2)),console[_0x259a1f(0x1f4)](_0x259a1f(0x1e6)),console[_0x259a1f(0x1f4)]('\x20\x20\x20or:\x20tdx\x20show\x20<table>\x20--database\x20<database>'),console['error']('\x20\x20\x20or:\x20tdx\x20show\x20<table>\x20--in\x20<database>'),0x1;if(_0x3b80f0[_0x259a1f(0x1e1)]>0x1)return console[_0x259a1f(0x1f4)](_0x259a1f(0x1da)),console['error']('Usage:\x20tdx\x20show\x20<database.table>'),console[_0x259a1f(0x1f4)](_0x259a1f(0x1e6)),console[_0x259a1f(0x1f4)](_0x259a1f(0x1e8)),console[_0x259a1f(0x1f4)](_0x259a1f(0x1f6)),0x1;return this[_0x259a1f(0x1fa)](_0x36292a);}async[a18_0x1ef85f(0x1fa)](_0x4873eb){const _0x4e9e38=a18_0x1ef85f,{options:_0x394f05,args:_0x2004e7,tdx:_0x33cfc2}=_0x4873eb;let _0x1db5df;try{_0x1db5df=parseTableReference(_0x2004e7[0x0]);const _0xaa3b8c=_0x394f05[_0x4e9e38(0x1dd)];!_0x1db5df[_0x4e9e38(0x1dd)]&&_0xaa3b8c&&(_0x1db5df[_0x4e9e38(0x1dd)]=_0xaa3b8c);const _0xa1a4f5=validateTableDescribeReference(_0x1db5df);if(_0xa1a4f5)return console[_0x4e9e38(0x1f4)](_0x4e9e38(0x1dc)+_0xa1a4f5),console[_0x4e9e38(0x1f4)](_0x4e9e38(0x1e2)),console[_0x4e9e38(0x1f4)](_0x4e9e38(0x1e6)),console['error'](_0x4e9e38(0x1e8)),0x1;}catch(_0x4b409d){return console[_0x4e9e38(0x1f4)](_0x4e9e38(0x1dc)+_0x4b409d[_0x4e9e38(0x1ec)]),console[_0x4e9e38(0x1f4)](_0x4e9e38(0x1e2)),console['error']('\x20\x20\x20or:\x20tdx\x20show\x20<catalog.database.table>'),console[_0x4e9e38(0x1f4)](_0x4e9e38(0x1e8)),0x1;}const _0x160b37=_0x1db5df[_0x4e9e38(0x1d7)],_0x490c3f=_0x1db5df[_0x4e9e38(0x1dd)],_0x5f4c01=_0x1db5df['table'],_0x570599=_0x394f05[_0x4e9e38(0x1f0)];try{_0x394f05[_0x4e9e38(0x1f8)]&&(console[_0x4e9e38(0x1f4)](_0x4e9e38(0x1f9)+_0x394f05[_0x4e9e38(0x1f1)]),_0x160b37&&console[_0x4e9e38(0x1f4)](_0x4e9e38(0x1e7)+_0x160b37),console[_0x4e9e38(0x1f4)](_0x4e9e38(0x1f3)+_0x490c3f),console[_0x4e9e38(0x1f4)](_0x4e9e38(0x1d8)+_0x5f4c01),console[_0x4e9e38(0x1f4)]('Limit:\x20'+_0x570599));const _0x5cb7bc=_0x160b37?_0x160b37+'.'+_0x490c3f+'.'+_0x5f4c01:_0x490c3f+'.'+_0x5f4c01,_0x3384c3=await withSpinner(_0x4e9e38(0x1d3)+_0x5cb7bc+_0x4e9e38(0x1eb),()=>_0x33cfc2['table']['show'](_0x490c3f,_0x5f4c01,_0x570599,_0x160b37),{'verbose':_0x394f05[_0x4e9e38(0x1f8)]}),_0x27d0ce=_0x3384c3[_0x4e9e38(0x1db)],_0x2deb88=_0x27d0ce['data'];return _0x2deb88[_0x4e9e38(0x1e1)]===0x0?console[_0x4e9e38(0x1f4)]('✔\x20Query\x20successful\x20-\x200\x20rows\x20returned'):console['error']('✔\x20Retrieved\x20'+_0x2deb88[_0x4e9e38(0x1e1)]+'\x20row'+(_0x2deb88[_0x4e9e38(0x1e1)]!==0x1?'s':'')+_0x4e9e38(0x1d4)+_0x5cb7bc),await handleSDKOutput(_0x2deb88,_0x394f05),0x0;}catch(_0x28051d){if(_0x28051d instanceof SDKError)return console[_0x4e9e38(0x1f4)](_0x4e9e38(0x1dc)+_0x28051d[_0x4e9e38(0x1ec)]),_0x28051d['cause']&&console[_0x4e9e38(0x1f4)](_0x4e9e38(0x1d5)+_0x28051d['cause']),0x1;throw _0x28051d;}}[a18_0x1ef85f(0x1ee)](_0x3e9c4d){const _0x302695=a18_0x1ef85f;if(_0x3e9c4d['args'][_0x302695(0x1e1)]===0x0)return _0x302695(0x1d9);if(_0x3e9c4d[_0x302695(0x1e0)][_0x302695(0x1e1)]>0x1)return'Too\x20many\x20arguments\x20(use\x20<database.table>\x20or\x20<table>\x20with\x20--database/--in\x20option)';return undefined;}}
|
package/dist/commands/tables.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a19_0x21c551=a19_0x1ce6;(function(_0x1a29c0,_0x2a6b1e){const _0x5af239=a19_0x1ce6,_0x131ae2=_0x1a29c0();while(!![]){try{const _0x4e9c85=parseInt(_0x5af239(0x140))/0x1+-parseInt(_0x5af239(0x139))/0x2+parseInt(_0x5af239(0x12c))/0x3*(-parseInt(_0x5af239(0x12d))/0x4)+-parseInt(_0x5af239(0x12f))/0x5+parseInt(_0x5af239(0x145))/0x6+parseInt(_0x5af239(0x125))/0x7+parseInt(_0x5af239(0x127))/0x8;if(_0x4e9c85===_0x2a6b1e)break;else _0x131ae2['push'](_0x131ae2['shift']());}catch(_0x24b974){_0x131ae2['push'](_0x131ae2['shift']());}}}(a19_0x1a5d,0x92a08));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';import{handleSDKOutput}from'../utils/command-output.js';function a19_0x1a5d(){const _0x965da7=['\x27\x20without\x20wildcards\x20would\x20search\x20for\x20tables\x20named\x20\x27','440328bdnjwu','List\x20tables\x20in\x20a\x20database','\x20\x20tdx\x20tables\x20--in\x20mydb\x20\x20\x20\x20\x20\x20\x20->\x20all\x20tables\x20from\x20mydb','cause','\x20table','7116996LJdcJR','\x20\x20tdx\x20tables\x20\x22mydb.*\x22\x20\x20\x20\x20\x20\x20\x20\x20->\x20all\x20tables\x20from\x20mydb','Database\x20pattern:\x20','Database:\x20all','✖\x20No\x20tables\x20found','\x20\x20tdx\x20tables\x20users\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20->\x20table\x20\x22users\x22\x20across\x20all\x20databases','description','tables','\x20\x20Use:\x20tdx\x20tables\x20\x22','Table\x20pattern:\x20','Error:\x20Too\x20many\x20arguments.\x20Use\x20single\x20argument:','Database:\x20','table','1359757SCYymf','Database\x20\x27','8748496Drjres','database','\x20\x20Or:\x20\x20tdx\x20tables\x20--in\x20','site','validate','1950753IkIcfz','4HEuhxV','Listing\x20tables...','3528940pIibVS','\x27\x20is\x20ambiguous.','Error:\x20','name','verbose','\x27\x20across\x20all\x20databases.','\x20\x20Cause:\x20','.*\x22','\x20\x20tdx\x20tables\x20\x22*.user*\x22\x20\x20\x20\x20\x20\x20\x20->\x20tables\x20matching\x20user*\x20across\x20databases','includes','1915368Famiuu','list','error','\x20\x20tdx\x20tables\x20\x22mydb.users\x22\x20\x20\x20\x20->\x20table\x20\x22users\x22\x20in\x20database\x20mydb','Did\x20you\x20mean\x20to\x20list\x20all\x20tables\x20from\x20database\x20\x27','length'];a19_0x1a5d=function(){return _0x965da7;};return a19_0x1a5d();}import{parseTableReference}from'../utils/table-ref-parser.js';function a19_0x1ce6(_0x26daba,_0x565d15){const _0x1a5dc7=a19_0x1a5d();return a19_0x1ce6=function(_0x1ce682,_0x568e40){_0x1ce682=_0x1ce682-0x11f;let _0x3c0fe9=_0x1a5dc7[_0x1ce682];return _0x3c0fe9;},a19_0x1ce6(_0x26daba,_0x565d15);}import{withSpinner}from'../utils/spinner.js';export class TablesCommand extends BaseCommand{[a19_0x21c551(0x132)]=a19_0x21c551(0x11f);[a19_0x21c551(0x14b)]=a19_0x21c551(0x141);async['execute'](_0x3074f4){const _0x2122d7=a19_0x21c551,{options:_0x160ec9,args:_0x17e2c8,tdx:_0x5a019b}=_0x3074f4;let _0x3cd74b;if(_0x17e2c8[_0x2122d7(0x13e)]===0x0)_0x3cd74b={'database':undefined,'table':undefined,'original':''};else{if(_0x17e2c8[_0x2122d7(0x13e)]===0x1)try{_0x3cd74b=parseTableReference(_0x17e2c8[0x0]);if(_0x3cd74b[_0x2122d7(0x124)]&&!_0x3cd74b[_0x2122d7(0x128)]&&!_0x3cd74b[_0x2122d7(0x124)][_0x2122d7(0x138)]('*')&&!_0x3cd74b[_0x2122d7(0x124)][_0x2122d7(0x138)]('?'))return console[_0x2122d7(0x13b)]('Error:\x20Pattern\x20\x27'+_0x17e2c8[0x0]+_0x2122d7(0x130)),console[_0x2122d7(0x13b)](_0x2122d7(0x13d)+_0x3cd74b[_0x2122d7(0x124)]+'\x27?'),console[_0x2122d7(0x13b)](_0x2122d7(0x120)+_0x3cd74b[_0x2122d7(0x124)]+_0x2122d7(0x136)),console[_0x2122d7(0x13b)](_0x2122d7(0x129)+_0x3cd74b[_0x2122d7(0x124)]),console['error']('\x20\x20Or:\x20\x20tdx\x20tables\x20--database\x20'+_0x3cd74b[_0x2122d7(0x124)]),console[_0x2122d7(0x13b)](''),console['error']('Note:\x20\x27'+_0x17e2c8[0x0]+_0x2122d7(0x13f)+_0x3cd74b[_0x2122d7(0x124)]+_0x2122d7(0x134)),0x1;}catch(_0x3256a3){return console[_0x2122d7(0x13b)](_0x2122d7(0x131)+_0x3256a3['message']),0x1;}else return console[_0x2122d7(0x13b)](_0x2122d7(0x122)),console[_0x2122d7(0x13b)](_0x2122d7(0x14a)),console['error'](_0x2122d7(0x146)),console[_0x2122d7(0x13b)](_0x2122d7(0x13c)),console[_0x2122d7(0x13b)](_0x2122d7(0x137)),console[_0x2122d7(0x13b)]('Or\x20use\x20--in\x20flag:'),console[_0x2122d7(0x13b)](_0x2122d7(0x142)),0x1;}const _0x4b0aae=_0x160ec9[_0x2122d7(0x128)];!_0x3cd74b[_0x2122d7(0x128)]&&_0x4b0aae&&(_0x3cd74b[_0x2122d7(0x128)]=_0x4b0aae);try{const _0x24161e=_0x35eee2=>_0x35eee2&&(_0x35eee2['includes']('*')||_0x35eee2[_0x2122d7(0x138)]('?')),_0x2ec812=_0x24161e(_0x3cd74b[_0x2122d7(0x128)]);_0x160ec9[_0x2122d7(0x133)]&&(console[_0x2122d7(0x13b)]('Site:\x20'+_0x160ec9[_0x2122d7(0x12a)]),_0x3cd74b['database']?_0x2ec812?console[_0x2122d7(0x13b)](_0x2122d7(0x147)+_0x3cd74b[_0x2122d7(0x128)]):console[_0x2122d7(0x13b)](_0x2122d7(0x123)+_0x3cd74b[_0x2122d7(0x128)]):console[_0x2122d7(0x13b)](_0x2122d7(0x148)),_0x3cd74b[_0x2122d7(0x124)]&&console[_0x2122d7(0x13b)](_0x2122d7(0x121)+_0x3cd74b[_0x2122d7(0x124)]));const _0x2bf0a7=_0x3cd74b[_0x2122d7(0x128)]&&!_0x2ec812?_0x3cd74b[_0x2122d7(0x128)]:undefined,_0x5d3dbc=_0x2ec812?_0x3cd74b[_0x2122d7(0x128)]:undefined,_0xa4b91c=_0x3cd74b['table'],_0x9fea30=await withSpinner(_0x2122d7(0x12e),()=>_0x5a019b['table'][_0x2122d7(0x13a)](_0x2bf0a7,_0xa4b91c,_0x5d3dbc),{'verbose':_0x160ec9[_0x2122d7(0x133)]}),_0x2aa379=_0x9fea30['data'];if(_0x2aa379[_0x2122d7(0x13e)]===0x0&&_0x3cd74b[_0x2122d7(0x128)]&&!_0x2ec812)return console['error'](_0x2122d7(0x149)),console[_0x2122d7(0x13b)](_0x2122d7(0x126)+_0x3cd74b[_0x2122d7(0x128)]+'\x27\x20may\x20not\x20exist\x20or\x20contains\x20no\x20tables'),0x1;return console[_0x2122d7(0x13b)]('✔\x20Found\x20'+_0x2aa379['length']+_0x2122d7(0x144)+(_0x2aa379[_0x2122d7(0x13e)]!==0x1?'s':'')),await handleSDKOutput(_0x2aa379,_0x160ec9),0x0;}catch(_0x29f044){if(_0x29f044 instanceof SDKError)return console[_0x2122d7(0x13b)]('Error:\x20'+_0x29f044['message']),_0x29f044[_0x2122d7(0x143)]&&console[_0x2122d7(0x13b)](_0x2122d7(0x135)+_0x29f044[_0x2122d7(0x143)]),0x1;throw _0x29f044;}}[a19_0x21c551(0x12b)](_0x5a1563){return undefined;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function a19_0x1b0e(){const _0xf896dd=['Show\x20logs\x20for\x20a\x20specific\x20task','startsWith','Kill\x20a\x20running\x20attempt','split','Cancelled','verbose','\x20\x20New\x20attempt\x20ID:\x20','\x20log\x20entr','List\x20workflow\x20attempts','Listing\x20workflow\x20sessions...','offset','error','execute','133389xflojZ','session','Error:\x20Invalid\x20JSON\x20in\x20--params','force','Getting\x20attempt\x20tasks...','List\x20all\x20workflow\x20projects','Error:\x20','includeRetried','description','attempt','Params:\x20','11554490SDMLkz','✔\x20Found\x20','workflow:workflows','\x20\x20Session\x20ID:\x20','workflow','Listing\x20workflow\x20attempts...','4460azuENq','workflow:projects','includeSubtasks','status','sessions','question','workflow:attempt','54DaMraH','\x20(y/N):\x20','Listing\x20workflows...','Target:\x20','Show\x20tasks\x20for\x20an\x20attempt','parse','82140UMuWNv','Show\x20specific\x20attempt\x20details','workflows','Filter:\x20','✔\x20Retry\x20started','Killing\x20attempt...','limit','Are\x20you\x20sure\x20you\x20want\x20to\x20retry\x20','session:','close','182CMFUMH','message','9026312EzAaPD','length','tasks','Reason:\x20','createInterface','stdout','ies','attempts','\x20\x20Cause:\x20','\x20attempt','name','Attempt\x20ID:\x20','kill','params','Error:\x20Attempt\x20ID\x20is\x20required','Including\x20subtasks:\x20yes','workflow:kill','cause','data','sessionId','Usage:\x20workflow\x20retry\x20session:<id>\x20or\x20workflow\x20retry\x20attempt:<id>','9kgaQsg','Pattern:\x20','logs','yes','substring','readFile','Task\x20name:\x20','workflow:sessions','389514UNjIFN','Project\x20filter:\x20','Force:\x20yes','Error:\x20Session\x20ID\x20or\x20attempt\x20ID\x20is\x20required','workflow:attempts','attemptId','110TthjKo','6185oEkuyW','831240DRFjNj','utf-8','Retrying\x20attempt...','Status:\x20','\x20task','toLowerCase','projects','\x20workflow'];a19_0x1b0e=function(){return _0xf896dd;};return a19_0x1b0e();}const a19_0x421568=a19_0x1151;(function(_0x1651b8,_0x3ef509){const _0x335747=a19_0x1151,_0xa8d6d0=_0x1651b8();while(!![]){try{const _0x527c2b=parseInt(_0x335747(0x11e))/0x1+-parseInt(_0x335747(0x118))/0x2*(-parseInt(_0x335747(0x100))/0x3)+-parseInt(_0x335747(0x111))/0x4*(parseInt(_0x335747(0xea))/0x5)+parseInt(_0x335747(0xe3))/0x6*(parseInt(_0x335747(0x128))/0x7)+parseInt(_0x335747(0x12a))/0x8*(parseInt(_0x335747(0xdb))/0x9)+-parseInt(_0x335747(0x10b))/0xa+parseInt(_0x335747(0xe9))/0xb*(-parseInt(_0x335747(0xeb))/0xc);if(_0x527c2b===_0x3ef509)break;else _0xa8d6d0['push'](_0xa8d6d0['shift']());}catch(_0x593502){_0xa8d6d0['push'](_0xa8d6d0['shift']());}}}(a19_0x1b0e,0xd4bfc));function a19_0x1151(_0x2655d7,_0x3b51c0){const _0x1b0e3b=a19_0x1b0e();return a19_0x1151=function(_0x115125,_0x4ed22a){_0x115125=_0x115125-0xce;let _0x51a321=_0x1b0e3b[_0x115125];return _0x51a321;},a19_0x1151(_0x2655d7,_0x3b51c0);}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*as a19_0x3d2623 from'readline';async function confirm(_0x19b64c){const _0x397305=a19_0x1151,_0x2cab51=a19_0x3d2623[_0x397305(0x12e)]({'input':process['stdin'],'output':process[_0x397305(0x12f)]});return new Promise(_0x282896=>{const _0x103bb9=_0x397305;_0x2cab51[_0x103bb9(0x116)](_0x19b64c+_0x103bb9(0x119),_0x54a084=>{const _0x5cade9=_0x103bb9;_0x2cab51[_0x5cade9(0x127)](),_0x282896(_0x54a084[_0x5cade9(0xf0)]()==='y'||_0x54a084[_0x5cade9(0xf0)]()==='yes');});});}export class WorkflowProjectsCommand extends BaseCommand{[a19_0x421568(0xd0)]=a19_0x421568(0x112);[a19_0x421568(0x108)]=a19_0x421568(0x105);async[a19_0x421568(0xff)](_0x217bf4){const _0x17b6d4=a19_0x421568,{options:_0xea60c9,args:_0x59d65b,tdx:_0x471944}=_0x217bf4,_0x859726=_0x59d65b[0x0];try{_0xea60c9[_0x17b6d4(0xf8)]&&_0x859726&&console[_0x17b6d4(0xfe)](_0x17b6d4(0xdc)+_0x859726);const _0x18d1ca=await withSpinner('Listing\x20workflow\x20projects...',()=>_0x471944['workflow'][_0x17b6d4(0xf1)](_0x859726,{'limit':_0xea60c9[_0x17b6d4(0x124)]}),{'verbose':_0xea60c9[_0x17b6d4(0xf8)]}),_0x4a918c=_0x18d1ca[_0x17b6d4(0xd8)];return console[_0x17b6d4(0xfe)](_0x17b6d4(0x10c)+_0x4a918c['length']+'\x20project'+(_0x4a918c[_0x17b6d4(0x12b)]!==0x1?'s':'')),await handleSDKOutput(_0x4a918c,_0xea60c9),0x0;}catch(_0x20605e){if(_0x20605e instanceof SDKError)return console[_0x17b6d4(0xfe)](_0x17b6d4(0x106)+_0x20605e[_0x17b6d4(0x129)]),_0x20605e[_0x17b6d4(0xd7)]&&console[_0x17b6d4(0xfe)](_0x17b6d4(0xce)+_0x20605e[_0x17b6d4(0xd7)]),0x1;throw _0x20605e;}}}export class WorkflowWorkflowsCommand extends BaseCommand{[a19_0x421568(0xd0)]=a19_0x421568(0x10d);[a19_0x421568(0x108)]='List\x20workflows';async['execute'](_0x78ca41){const _0x4e57ca=a19_0x421568,{options:_0x206bbf,args:_0x3abb66,tdx:_0x4bb92c}=_0x78ca41,_0x9cae=_0x3abb66[0x0];try{_0x206bbf[_0x4e57ca(0xf8)]&&_0x9cae&&console['error'](_0x4e57ca(0xe4)+_0x9cae);const _0x41923c=await withSpinner(_0x4e57ca(0x11a),()=>_0x4bb92c[_0x4e57ca(0x10f)][_0x4e57ca(0x120)](_0x9cae,{'limit':_0x206bbf[_0x4e57ca(0x124)]}),{'verbose':_0x206bbf[_0x4e57ca(0xf8)]}),_0x379382=_0x41923c[_0x4e57ca(0xd8)];return console[_0x4e57ca(0xfe)]('✔\x20Found\x20'+_0x379382[_0x4e57ca(0x12b)]+_0x4e57ca(0xf2)+(_0x379382[_0x4e57ca(0x12b)]!==0x1?'s':'')),await handleSDKOutput(_0x379382,_0x206bbf),0x0;}catch(_0x39d29b){if(_0x39d29b instanceof SDKError)return console[_0x4e57ca(0xfe)](_0x4e57ca(0x106)+_0x39d29b['message']),_0x39d29b['cause']&&console[_0x4e57ca(0xfe)]('\x20\x20Cause:\x20'+_0x39d29b[_0x4e57ca(0xd7)]),0x1;throw _0x39d29b;}}}export class WorkflowSessionsCommand extends BaseCommand{['name']=a19_0x421568(0xe2);[a19_0x421568(0x108)]='List\x20workflow\x20execution\x20sessions';async[a19_0x421568(0xff)](_0x1363a1){const _0x4bb2d7=a19_0x421568,{options:_0x474aa9,args:_0x73cb7e,tdx:_0x49a247}=_0x1363a1;let _0x547d00,_0x5ed824;if(_0x73cb7e[0x0]){const _0x4fedb1=_0x73cb7e[0x0][_0x4bb2d7(0xf6)]('.');if(_0x4fedb1[_0x4bb2d7(0x12b)]===0x1)_0x547d00=_0x4fedb1[0x0];else{if(_0x4fedb1[_0x4bb2d7(0x12b)]===0x2)[_0x547d00,_0x5ed824]=_0x4fedb1;else return console[_0x4bb2d7(0xfe)]('Error:\x20Invalid\x20pattern.\x20Use\x20format:\x20project\x20or\x20project.workflow'),0x1;}}try{if(_0x474aa9[_0x4bb2d7(0xf8)]){if(_0x547d00&&_0x5ed824)console[_0x4bb2d7(0xfe)]('Filter:\x20'+_0x547d00+'.'+_0x5ed824);else _0x547d00&&console[_0x4bb2d7(0xfe)]('Filter:\x20project='+_0x547d00);const _0x84b884=_0x474aa9['status'];_0x84b884&&console['error'](_0x4bb2d7(0xee)+_0x84b884);}const _0x4119da=await withSpinner(_0x4bb2d7(0xfc),()=>_0x49a247['workflow'][_0x4bb2d7(0x115)]({'projectName':_0x547d00,'workflowName':_0x5ed824,'status':_0x474aa9[_0x4bb2d7(0x114)],'fromTime':_0x474aa9['from'],'toTime':_0x474aa9['to'],'limit':_0x474aa9[_0x4bb2d7(0x124)]}),{'verbose':_0x474aa9[_0x4bb2d7(0xf8)]}),_0x4151d9=_0x4119da[_0x4bb2d7(0xd8)];return console[_0x4bb2d7(0xfe)](_0x4bb2d7(0x10c)+_0x4151d9[_0x4bb2d7(0x12b)]+'\x20session'+(_0x4151d9[_0x4bb2d7(0x12b)]!==0x1?'s':'')),await handleSDKOutput(_0x4151d9,_0x474aa9),0x0;}catch(_0x4002b0){if(_0x4002b0 instanceof SDKError)return console['error'](_0x4bb2d7(0x106)+_0x4002b0[_0x4bb2d7(0x129)]),_0x4002b0[_0x4bb2d7(0xd7)]&&console[_0x4bb2d7(0xfe)](_0x4bb2d7(0xce)+_0x4002b0[_0x4bb2d7(0xd7)]),0x1;throw _0x4002b0;}}}export class WorkflowAttemptsCommand extends BaseCommand{[a19_0x421568(0xd0)]=a19_0x421568(0xe7);[a19_0x421568(0x108)]=a19_0x421568(0xfb);async[a19_0x421568(0xff)](_0x1d219a){const _0x27ad6f=a19_0x421568,{options:_0x1b7fb7,args:_0x23be87,tdx:_0x47ce94}=_0x1d219a;let _0x33df5f,_0x75e71d;if(_0x23be87[0x0]){const _0x1b35ce=_0x23be87[0x0][_0x27ad6f(0xf6)]('.');if(_0x1b35ce[_0x27ad6f(0x12b)]===0x1)_0x33df5f=_0x1b35ce[0x0];else{if(_0x1b35ce['length']===0x2)[_0x33df5f,_0x75e71d]=_0x1b35ce;else return console[_0x27ad6f(0xfe)]('Error:\x20Invalid\x20pattern.\x20Use\x20format:\x20project\x20or\x20project.workflow'),0x1;}}try{const _0x472239=_0x1b7fb7[_0x27ad6f(0x107)];if(_0x1b7fb7[_0x27ad6f(0xf8)]){if(_0x33df5f&&_0x75e71d)console['error'](_0x27ad6f(0x121)+_0x33df5f+'.'+_0x75e71d);else _0x33df5f&&console[_0x27ad6f(0xfe)]('Filter:\x20project='+_0x33df5f);_0x472239&&console[_0x27ad6f(0xfe)]('Include\x20retried:\x20yes');}const _0x562e73=await withSpinner(_0x27ad6f(0x110),()=>_0x47ce94[_0x27ad6f(0x10f)][_0x27ad6f(0x131)]({'projectName':_0x33df5f,'workflowName':_0x75e71d,'includeRetried':_0x472239,'limit':_0x1b7fb7[_0x27ad6f(0x124)]}),{'verbose':_0x1b7fb7[_0x27ad6f(0xf8)]}),_0x41152f=_0x562e73[_0x27ad6f(0xd8)];return console['error'](_0x27ad6f(0x10c)+_0x41152f[_0x27ad6f(0x12b)]+_0x27ad6f(0xcf)+(_0x41152f['length']!==0x1?'s':'')),await handleSDKOutput(_0x41152f,_0x1b7fb7),0x0;}catch(_0xd2cb39){if(_0xd2cb39 instanceof SDKError)return console['error']('Error:\x20'+_0xd2cb39[_0x27ad6f(0x129)]),_0xd2cb39[_0x27ad6f(0xd7)]&&console[_0x27ad6f(0xfe)](_0x27ad6f(0xce)+_0xd2cb39['cause']),0x1;throw _0xd2cb39;}}}export class WorkflowAttemptCommand extends BaseCommand{['name']=a19_0x421568(0x117);['description']=a19_0x421568(0x11f);async[a19_0x421568(0xff)](_0xd0cd95){const _0x3365cf=a19_0x421568,{options:_0x5a92b5,args:_0x5958e6,tdx:_0x2a7999}=_0xd0cd95,_0x20fcb7=_0x5958e6[0x0];if(!_0x20fcb7)return console[_0x3365cf(0xfe)](_0x3365cf(0xd4)),0x1;try{_0x5a92b5['verbose']&&console[_0x3365cf(0xfe)](_0x3365cf(0xd1)+_0x20fcb7);const _0x46425=await withSpinner('Getting\x20attempt\x20details...',()=>_0x2a7999['workflow']['attempt'](_0x20fcb7),{'verbose':_0x5a92b5[_0x3365cf(0xf8)]}),_0x33e233=_0x46425['data'];return await handleSDKOutput([_0x33e233],_0x5a92b5),0x0;}catch(_0x54839c){if(_0x54839c instanceof SDKError)return console['error'](_0x3365cf(0x106)+_0x54839c[_0x3365cf(0x129)]),_0x54839c['cause']&&console[_0x3365cf(0xfe)](_0x3365cf(0xce)+_0x54839c[_0x3365cf(0xd7)]),0x1;throw _0x54839c;}}}export class WorkflowTasksCommand extends BaseCommand{[a19_0x421568(0xd0)]='workflow:tasks';[a19_0x421568(0x108)]=a19_0x421568(0x11c);async['execute'](_0x38bd4b){const _0x30348b=a19_0x421568,{options:_0x22fa53,args:_0x237873,tdx:_0x4b11d9}=_0x38bd4b,_0x27e961=_0x237873[0x0];if(!_0x27e961)return console[_0x30348b(0xfe)]('Error:\x20Attempt\x20ID\x20is\x20required'),0x1;try{const _0x333ecd=_0x22fa53[_0x30348b(0x113)];_0x22fa53['verbose']&&(console[_0x30348b(0xfe)]('Attempt\x20ID:\x20'+_0x27e961),_0x333ecd&&console['error'](_0x30348b(0xd5)));const _0x20c67b=await withSpinner(_0x30348b(0x104),()=>_0x4b11d9[_0x30348b(0x10f)][_0x30348b(0x12c)](_0x27e961,_0x333ecd||![]),{'verbose':_0x22fa53[_0x30348b(0xf8)]}),_0x4902fa=_0x20c67b[_0x30348b(0xd8)];return console[_0x30348b(0xfe)](_0x30348b(0x10c)+_0x4902fa[_0x30348b(0x12b)]+_0x30348b(0xef)+(_0x4902fa[_0x30348b(0x12b)]!==0x1?'s':'')),await handleSDKOutput(_0x4902fa,_0x22fa53),0x0;}catch(_0x50472f){if(_0x50472f instanceof SDKError)return console[_0x30348b(0xfe)](_0x30348b(0x106)+_0x50472f['message']),_0x50472f[_0x30348b(0xd7)]&&console[_0x30348b(0xfe)](_0x30348b(0xce)+_0x50472f[_0x30348b(0xd7)]),0x1;throw _0x50472f;}}}export class WorkflowLogsCommand extends BaseCommand{[a19_0x421568(0xd0)]='workflow:logs';[a19_0x421568(0x108)]=a19_0x421568(0xf3);async[a19_0x421568(0xff)](_0x2b83fe){const _0x5258f8=a19_0x421568,{options:_0x32d6e7,args:_0xff57a8,tdx:_0x409969}=_0x2b83fe,_0x28bbb4=_0xff57a8[0x0],_0x5ce6f3=_0xff57a8[0x1];if(!_0x28bbb4||!_0x5ce6f3)return console[_0x5258f8(0xfe)]('Error:\x20Attempt\x20ID\x20and\x20task\x20name\x20are\x20required'),0x1;try{_0x32d6e7['verbose']&&(console[_0x5258f8(0xfe)](_0x5258f8(0xd1)+_0x28bbb4),console[_0x5258f8(0xfe)](_0x5258f8(0xe1)+_0x5ce6f3));const _0x4f00e3=_0x32d6e7[_0x5258f8(0xfd)],_0x27d541=await withSpinner('Getting\x20task\x20logs...',()=>_0x409969[_0x5258f8(0x10f)][_0x5258f8(0xdd)](_0x28bbb4,_0x5ce6f3,{'offset':_0x4f00e3,'limit':_0x32d6e7[_0x5258f8(0x124)]}),{'verbose':_0x32d6e7[_0x5258f8(0xf8)]}),_0x103060=_0x27d541[_0x5258f8(0xd8)];return console[_0x5258f8(0xfe)](_0x5258f8(0x10c)+_0x103060['length']+_0x5258f8(0xfa)+(_0x103060[_0x5258f8(0x12b)]!==0x1?_0x5258f8(0x130):'y')),await handleSDKOutput(_0x103060,_0x32d6e7),0x0;}catch(_0x7cafd1){if(_0x7cafd1 instanceof SDKError)return console[_0x5258f8(0xfe)]('Error:\x20'+_0x7cafd1[_0x5258f8(0x129)]),_0x7cafd1[_0x5258f8(0xd7)]&&console[_0x5258f8(0xfe)]('\x20\x20Cause:\x20'+_0x7cafd1[_0x5258f8(0xd7)]),0x1;throw _0x7cafd1;}}}export class WorkflowKillCommand extends BaseCommand{[a19_0x421568(0xd0)]=a19_0x421568(0xd6);[a19_0x421568(0x108)]=a19_0x421568(0xf5);async[a19_0x421568(0xff)](_0x3aee15){const _0x3b1735=a19_0x421568,{options:_0x5ac395,args:_0xeb2b5a,tdx:_0x5b78c8}=_0x3aee15,_0x4db7d0=_0xeb2b5a[0x0];if(!_0x4db7d0)return console[_0x3b1735(0xfe)](_0x3b1735(0xd4)),0x1;try{const _0x4dfbff=_0x5ac395['reason'];_0x5ac395[_0x3b1735(0xf8)]&&(console[_0x3b1735(0xfe)](_0x3b1735(0xd1)+_0x4db7d0),_0x4dfbff&&console[_0x3b1735(0xfe)](_0x3b1735(0x12d)+_0x4dfbff));if(!_0x5ac395[_0x3b1735(0xde)]){const _0x20dcf8=await confirm('Are\x20you\x20sure\x20you\x20want\x20to\x20kill\x20attempt\x20'+_0x4db7d0+'?');if(!_0x20dcf8)return console[_0x3b1735(0xfe)](_0x3b1735(0xf7)),0x0;}const _0x294b41=await withSpinner(_0x3b1735(0x123),()=>_0x5b78c8[_0x3b1735(0x10f)][_0x3b1735(0xd2)](_0x4db7d0,_0x4dfbff),{'verbose':_0x5ac395[_0x3b1735(0xf8)]}),_0x579d22=_0x294b41[_0x3b1735(0xd8)];return console['error']('✔\x20'+_0x579d22),0x0;}catch(_0x4fcdcf){if(_0x4fcdcf instanceof SDKError)return console[_0x3b1735(0xfe)](_0x3b1735(0x106)+_0x4fcdcf['message']),_0x4fcdcf[_0x3b1735(0xd7)]&&console[_0x3b1735(0xfe)](_0x3b1735(0xce)+_0x4fcdcf['cause']),0x1;throw _0x4fcdcf;}}}export class WorkflowRetryCommand extends BaseCommand{[a19_0x421568(0xd0)]='workflow:retry';[a19_0x421568(0x108)]='Retry\x20a\x20session\x20or\x20attempt';async[a19_0x421568(0xff)](_0x139664){const _0x3d9e74=a19_0x421568,{options:_0x32b19f,args:_0x4ad409,tdx:_0x425e6d}=_0x139664,_0x298429=_0x4ad409[0x0];if(!_0x298429)return console[_0x3d9e74(0xfe)](_0x3d9e74(0xe6)),console[_0x3d9e74(0xfe)]('Usage:\x20workflow\x20retry\x20session:<id>\x20or\x20workflow\x20retry\x20attempt:<id>'),0x1;let _0xa6993=![],_0x5581f0=_0x298429;if(_0x298429[_0x3d9e74(0xf4)](_0x3d9e74(0x126)))_0xa6993=!![],_0x5581f0=_0x298429[_0x3d9e74(0xdf)](0x8);else{if(_0x298429['startsWith']('attempt:'))_0xa6993=![],_0x5581f0=_0x298429[_0x3d9e74(0xdf)](0x8);else return console[_0x3d9e74(0xfe)]('Error:\x20Target\x20must\x20be\x20prefixed\x20with\x20\x22session:\x22\x20or\x20\x22attempt:\x22'),console[_0x3d9e74(0xfe)](_0x3d9e74(0xda)),0x1;}try{const _0x2d04b0=_0x32b19f['fromTask'],_0x28428e=_0x32b19f['resumeFrom'],_0x324672=_0x32b19f[_0x3d9e74(0xd3)],_0x563969=_0x32b19f[_0x3d9e74(0x103)];_0x32b19f[_0x3d9e74(0xf8)]&&(console[_0x3d9e74(0xfe)](_0x3d9e74(0x11b)+(_0xa6993?_0x3d9e74(0x101):_0x3d9e74(0x109))+'\x20'+_0x5581f0),_0x2d04b0&&console['error']('From\x20task:\x20'+_0x2d04b0),_0x28428e&&console['error']('Resume\x20from:\x20'+_0x28428e),_0x324672&&console[_0x3d9e74(0xfe)](_0x3d9e74(0x10a)+_0x324672),_0x563969&&console['error'](_0x3d9e74(0xe5)));let _0x1ab660;if(_0x324672)try{if(_0x324672[_0x3d9e74(0xf4)]('@')){const _0x462341=await import('fs/promises'),_0xfa6a5d=_0x324672[_0x3d9e74(0xdf)](0x1),_0xf39fd=await _0x462341[_0x3d9e74(0xe0)](_0xfa6a5d,_0x3d9e74(0xec));_0x1ab660=JSON['parse'](_0xf39fd);}else _0x1ab660=JSON[_0x3d9e74(0x11d)](_0x324672);}catch{return console['error'](_0x3d9e74(0x102)),0x1;}if(!_0x32b19f[_0x3d9e74(0xde)]){const _0x310b4d=await confirm(_0x3d9e74(0x125)+(_0xa6993?_0x3d9e74(0x101):'attempt')+'\x20'+_0x5581f0+'?');if(!_0x310b4d)return console[_0x3d9e74(0xfe)]('Cancelled'),0x0;}let _0x8762ab;_0xa6993?_0x8762ab=await withSpinner('Retrying\x20session...',()=>_0x425e6d[_0x3d9e74(0x10f)]['retrySession'](_0x5581f0,{'fromTask':_0x2d04b0,'retryParams':_0x1ab660}),{'verbose':_0x32b19f[_0x3d9e74(0xf8)]}):_0x8762ab=await withSpinner(_0x3d9e74(0xed),()=>_0x425e6d['workflow']['retryAttempt'](_0x5581f0,{'resumeFrom':_0x28428e,'retryParams':_0x1ab660,'force':_0x563969}),{'verbose':_0x32b19f[_0x3d9e74(0xf8)]});const _0x313483=_0x8762ab[_0x3d9e74(0xd8)];return console[_0x3d9e74(0xfe)](_0x3d9e74(0x122)),console[_0x3d9e74(0xfe)](_0x3d9e74(0xf9)+_0x313483[_0x3d9e74(0xe8)]),console[_0x3d9e74(0xfe)](_0x3d9e74(0x10e)+_0x313483[_0x3d9e74(0xd9)]),0x0;}catch(_0x2bdb05){if(_0x2bdb05 instanceof SDKError)return console[_0x3d9e74(0xfe)](_0x3d9e74(0x106)+_0x2bdb05[_0x3d9e74(0x129)]),_0x2bdb05[_0x3d9e74(0xd7)]&&console[_0x3d9e74(0xfe)](_0x3d9e74(0xce)+_0x2bdb05['cause']),0x1;throw _0x2bdb05;}}}
|
|
1
|
+
const a20_0x3d4b8b=a20_0x205d;(function(_0x18ae55,_0x156827){const _0x191897=a20_0x205d,_0x10db95=_0x18ae55();while(!![]){try{const _0x23f228=parseInt(_0x191897(0xab))/0x1*(-parseInt(_0x191897(0xa4))/0x2)+-parseInt(_0x191897(0xe3))/0x3*(parseInt(_0x191897(0xe5))/0x4)+parseInt(_0x191897(0x92))/0x5*(parseInt(_0x191897(0xdd))/0x6)+-parseInt(_0x191897(0xd6))/0x7+parseInt(_0x191897(0xb7))/0x8+parseInt(_0x191897(0xb6))/0x9+-parseInt(_0x191897(0xc7))/0xa;if(_0x23f228===_0x156827)break;else _0x10db95['push'](_0x10db95['shift']());}catch(_0x4e27f6){_0x10db95['push'](_0x10db95['shift']());}}}(a20_0x4d14,0x196fd));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';import{handleSDKOutput}from'../utils/command-output.js';import{withSpinner}from'../utils/spinner.js';function a20_0x205d(_0x13d203,_0x426c6d){const _0x4d1433=a20_0x4d14();return a20_0x205d=function(_0x205da5,_0x29fbe6){_0x205da5=_0x205da5-0x91;let _0x2fe396=_0x4d1433[_0x205da5];return _0x2fe396;},a20_0x205d(_0x13d203,_0x426c6d);}import*as a20_0x46e366 from'readline';async function confirm(_0x5e3530){const _0x24cb81=a20_0x205d,_0x277ab9=a20_0x46e366['createInterface']({'input':process[_0x24cb81(0xde)],'output':process[_0x24cb81(0xb2)]});return new Promise(_0x4a6f15=>{const _0x55d851=_0x24cb81;_0x277ab9[_0x55d851(0xb5)](_0x5e3530+'\x20(y/N):\x20',_0x182d42=>{const _0x35b4cd=_0x55d851;_0x277ab9['close'](),_0x4a6f15(_0x182d42[_0x35b4cd(0xb4)]()==='y'||_0x182d42[_0x35b4cd(0xb4)]()==='yes');});});}function a20_0x4d14(){const _0x1693bf=['length','18fgMlvk','stdin','workflow:projects','List\x20workflow\x20attempts','params','logs','3esBnjm','retrySession','670656UxDtsp','Params:\x20','error','sessions','List\x20workflow\x20execution\x20sessions','Cancelled','workflow:tasks','Error:\x20Invalid\x20JSON\x20in\x20--params','Usage:\x20workflow\x20retry\x20session:<id>\x20or\x20workflow\x20retry\x20attempt:<id>','utf-8','data','workflow:attempts','Task\x20name:\x20','yes','Retrying\x20session...','attemptId','Attempt\x20ID:\x20','cause','session:','Listing\x20workflow\x20attempts...','190865eJlqKZ','List\x20all\x20workflow\x20projects','Status:\x20','Killing\x20attempt...','execute','attempt','\x20task','workflow:attempt','List\x20workflows','attempt:','Error:\x20Attempt\x20ID\x20is\x20required','attempts','Error:\x20Invalid\x20pattern.\x20Use\x20format:\x20project\x20or\x20project.workflow','status','workflow:workflows','\x20\x20Session\x20ID:\x20','workflow','sessionId','8650ChQLmr','✔\x20Found\x20','Error:\x20Session\x20ID\x20or\x20attempt\x20ID\x20is\x20required','Pattern:\x20','startsWith','Error:\x20','Show\x20tasks\x20for\x20an\x20attempt','32CJSsRO','includeRetried','\x20workflow','force','message','\x20\x20Cause:\x20','Retry\x20a\x20session\x20or\x20attempt','stdout','\x20attempt','toLowerCase','question','1010592IrTzHu','1589904yKCjBS','parse','Listing\x20workflow\x20sessions...','Are\x20you\x20sure\x20you\x20want\x20to\x20retry\x20','\x20\x20New\x20attempt\x20ID:\x20','limit','Force:\x20yes','session','verbose','Getting\x20attempt\x20details...','Including\x20subtasks:\x20yes','split','substring','\x20session','workflow:retry','Getting\x20attempt\x20tasks...','15580kwDOzz','Show\x20logs\x20for\x20a\x20specific\x20task','Listing\x20workflow\x20projects...','resumeFrom','name','Filter:\x20project=','fromTask','workflow:sessions','Project\x20filter:\x20','\x20project','fs/promises','Show\x20specific\x20attempt\x20details','retryAttempt','Kill\x20a\x20running\x20attempt','offset','96138QTZSXv','Are\x20you\x20sure\x20you\x20want\x20to\x20kill\x20attempt\x20','description','Resume\x20from:\x20','Filter:\x20','Retrying\x20attempt...'];a20_0x4d14=function(){return _0x1693bf;};return a20_0x4d14();}export class WorkflowProjectsCommand extends BaseCommand{[a20_0x3d4b8b(0xcb)]=a20_0x3d4b8b(0xdf);[a20_0x3d4b8b(0xd8)]=a20_0x3d4b8b(0x93);async[a20_0x3d4b8b(0x96)](_0x3547c7){const _0x47f8f0=a20_0x3d4b8b,{options:_0x441a64,args:_0x5ecf33,tdx:_0x3fe7c6}=_0x3547c7,_0x3f53ff=_0x5ecf33[0x0];try{_0x441a64['verbose']&&_0x3f53ff&&console[_0x47f8f0(0xe7)](_0x47f8f0(0xa7)+_0x3f53ff);const _0x5897c5=await withSpinner(_0x47f8f0(0xc9),()=>_0x3fe7c6[_0x47f8f0(0xa2)]['projects'](_0x3f53ff,{'limit':_0x441a64['limit']}),{'verbose':_0x441a64['verbose']}),_0x312e99=_0x5897c5[_0x47f8f0(0xef)];return console[_0x47f8f0(0xe7)]('✔\x20Found\x20'+_0x312e99['length']+_0x47f8f0(0xd0)+(_0x312e99[_0x47f8f0(0xdc)]!==0x1?'s':'')),await handleSDKOutput(_0x312e99,_0x441a64),0x0;}catch(_0x183ba3){if(_0x183ba3 instanceof SDKError)return console[_0x47f8f0(0xe7)](_0x47f8f0(0xa9)+_0x183ba3[_0x47f8f0(0xaf)]),_0x183ba3['cause']&&console[_0x47f8f0(0xe7)](_0x47f8f0(0xb0)+_0x183ba3[_0x47f8f0(0xf6)]),0x1;throw _0x183ba3;}}}export class WorkflowWorkflowsCommand extends BaseCommand{[a20_0x3d4b8b(0xcb)]=a20_0x3d4b8b(0xa0);['description']=a20_0x3d4b8b(0x9a);async['execute'](_0x566b6c){const _0x355d33=a20_0x3d4b8b,{options:_0x144915,args:_0x5abbc6,tdx:_0x96387d}=_0x566b6c,_0x7e6a7c=_0x5abbc6[0x0];try{_0x144915[_0x355d33(0xbf)]&&_0x7e6a7c&&console[_0x355d33(0xe7)](_0x355d33(0xcf)+_0x7e6a7c);const _0x4e8e41=await withSpinner('Listing\x20workflows...',()=>_0x96387d['workflow']['workflows'](_0x7e6a7c,{'limit':_0x144915[_0x355d33(0xbc)]}),{'verbose':_0x144915['verbose']}),_0x6f9a78=_0x4e8e41['data'];return console[_0x355d33(0xe7)](_0x355d33(0xa5)+_0x6f9a78[_0x355d33(0xdc)]+_0x355d33(0xad)+(_0x6f9a78[_0x355d33(0xdc)]!==0x1?'s':'')),await handleSDKOutput(_0x6f9a78,_0x144915),0x0;}catch(_0x569757){if(_0x569757 instanceof SDKError)return console['error']('Error:\x20'+_0x569757['message']),_0x569757['cause']&&console['error'](_0x355d33(0xb0)+_0x569757[_0x355d33(0xf6)]),0x1;throw _0x569757;}}}export class WorkflowSessionsCommand extends BaseCommand{[a20_0x3d4b8b(0xcb)]=a20_0x3d4b8b(0xce);['description']=a20_0x3d4b8b(0xe9);async[a20_0x3d4b8b(0x96)](_0x290927){const _0x14633f=a20_0x3d4b8b,{options:_0x5833c1,args:_0x585ab7,tdx:_0x19073b}=_0x290927;let _0x19321e,_0x48dc79;if(_0x585ab7[0x0]){const _0x3eb742=_0x585ab7[0x0][_0x14633f(0xc2)]('.');if(_0x3eb742[_0x14633f(0xdc)]===0x1)_0x19321e=_0x3eb742[0x0];else{if(_0x3eb742[_0x14633f(0xdc)]===0x2)[_0x19321e,_0x48dc79]=_0x3eb742;else return console[_0x14633f(0xe7)](_0x14633f(0x9e)),0x1;}}try{if(_0x5833c1[_0x14633f(0xbf)]){if(_0x19321e&&_0x48dc79)console['error'](_0x14633f(0xda)+_0x19321e+'.'+_0x48dc79);else _0x19321e&&console[_0x14633f(0xe7)](_0x14633f(0xcc)+_0x19321e);const _0x94abc6=_0x5833c1[_0x14633f(0x9f)];_0x94abc6&&console[_0x14633f(0xe7)](_0x14633f(0x94)+_0x94abc6);}const _0x8d7a26=await withSpinner(_0x14633f(0xb9),()=>_0x19073b[_0x14633f(0xa2)][_0x14633f(0xe8)]({'projectName':_0x19321e,'workflowName':_0x48dc79,'status':_0x5833c1['status'],'fromTime':_0x5833c1['from'],'toTime':_0x5833c1['to'],'limit':_0x5833c1['limit']}),{'verbose':_0x5833c1[_0x14633f(0xbf)]}),_0x2211f6=_0x8d7a26[_0x14633f(0xef)];return console['error']('✔\x20Found\x20'+_0x2211f6[_0x14633f(0xdc)]+_0x14633f(0xc4)+(_0x2211f6[_0x14633f(0xdc)]!==0x1?'s':'')),await handleSDKOutput(_0x2211f6,_0x5833c1),0x0;}catch(_0x4296fb){if(_0x4296fb instanceof SDKError)return console[_0x14633f(0xe7)]('Error:\x20'+_0x4296fb[_0x14633f(0xaf)]),_0x4296fb[_0x14633f(0xf6)]&&console[_0x14633f(0xe7)](_0x14633f(0xb0)+_0x4296fb[_0x14633f(0xf6)]),0x1;throw _0x4296fb;}}}export class WorkflowAttemptsCommand extends BaseCommand{['name']=a20_0x3d4b8b(0xf0);[a20_0x3d4b8b(0xd8)]=a20_0x3d4b8b(0xe0);async['execute'](_0x3fb2ac){const _0x2b8522=a20_0x3d4b8b,{options:_0x58ac1d,args:_0x5abb3e,tdx:_0x3ec58d}=_0x3fb2ac;let _0xb042d8,_0x3fe62f;if(_0x5abb3e[0x0]){const _0x5a1940=_0x5abb3e[0x0][_0x2b8522(0xc2)]('.');if(_0x5a1940['length']===0x1)_0xb042d8=_0x5a1940[0x0];else{if(_0x5a1940[_0x2b8522(0xdc)]===0x2)[_0xb042d8,_0x3fe62f]=_0x5a1940;else return console[_0x2b8522(0xe7)]('Error:\x20Invalid\x20pattern.\x20Use\x20format:\x20project\x20or\x20project.workflow'),0x1;}}try{const _0x12cce6=_0x58ac1d[_0x2b8522(0xac)];if(_0x58ac1d[_0x2b8522(0xbf)]){if(_0xb042d8&&_0x3fe62f)console[_0x2b8522(0xe7)](_0x2b8522(0xda)+_0xb042d8+'.'+_0x3fe62f);else _0xb042d8&&console[_0x2b8522(0xe7)](_0x2b8522(0xcc)+_0xb042d8);_0x12cce6&&console[_0x2b8522(0xe7)]('Include\x20retried:\x20yes');}const _0x833eca=await withSpinner(_0x2b8522(0x91),()=>_0x3ec58d[_0x2b8522(0xa2)][_0x2b8522(0x9d)]({'projectName':_0xb042d8,'workflowName':_0x3fe62f,'includeRetried':_0x12cce6,'limit':_0x58ac1d['limit']}),{'verbose':_0x58ac1d[_0x2b8522(0xbf)]}),_0x599150=_0x833eca[_0x2b8522(0xef)];return console[_0x2b8522(0xe7)](_0x2b8522(0xa5)+_0x599150['length']+_0x2b8522(0xb3)+(_0x599150[_0x2b8522(0xdc)]!==0x1?'s':'')),await handleSDKOutput(_0x599150,_0x58ac1d),0x0;}catch(_0x127565){if(_0x127565 instanceof SDKError)return console[_0x2b8522(0xe7)](_0x2b8522(0xa9)+_0x127565[_0x2b8522(0xaf)]),_0x127565[_0x2b8522(0xf6)]&&console['error'](_0x2b8522(0xb0)+_0x127565[_0x2b8522(0xf6)]),0x1;throw _0x127565;}}}export class WorkflowAttemptCommand extends BaseCommand{['name']=a20_0x3d4b8b(0x99);['description']=a20_0x3d4b8b(0xd2);async[a20_0x3d4b8b(0x96)](_0x27965e){const _0xafe572=a20_0x3d4b8b,{options:_0x4044c0,args:_0x4a8360,tdx:_0x1dce5}=_0x27965e,_0x3e7ff5=_0x4a8360[0x0];if(!_0x3e7ff5)return console[_0xafe572(0xe7)](_0xafe572(0x9c)),0x1;try{_0x4044c0[_0xafe572(0xbf)]&&console[_0xafe572(0xe7)](_0xafe572(0xf5)+_0x3e7ff5);const _0x1d8a88=await withSpinner(_0xafe572(0xc0),()=>_0x1dce5['workflow']['attempt'](_0x3e7ff5),{'verbose':_0x4044c0[_0xafe572(0xbf)]}),_0x4739aa=_0x1d8a88['data'];return await handleSDKOutput([_0x4739aa],_0x4044c0),0x0;}catch(_0xff1f8e){if(_0xff1f8e instanceof SDKError)return console['error']('Error:\x20'+_0xff1f8e['message']),_0xff1f8e[_0xafe572(0xf6)]&&console[_0xafe572(0xe7)](_0xafe572(0xb0)+_0xff1f8e['cause']),0x1;throw _0xff1f8e;}}}export class WorkflowTasksCommand extends BaseCommand{[a20_0x3d4b8b(0xcb)]=a20_0x3d4b8b(0xeb);[a20_0x3d4b8b(0xd8)]=a20_0x3d4b8b(0xaa);async[a20_0x3d4b8b(0x96)](_0x4d78a6){const _0x14f787=a20_0x3d4b8b,{options:_0x710a8e,args:_0x3284d9,tdx:_0x3404d0}=_0x4d78a6,_0x137fed=_0x3284d9[0x0];if(!_0x137fed)return console[_0x14f787(0xe7)]('Error:\x20Attempt\x20ID\x20is\x20required'),0x1;try{const _0x1ad8d8=_0x710a8e['includeSubtasks'];_0x710a8e['verbose']&&(console[_0x14f787(0xe7)](_0x14f787(0xf5)+_0x137fed),_0x1ad8d8&&console[_0x14f787(0xe7)](_0x14f787(0xc1)));const _0x36deb1=await withSpinner(_0x14f787(0xc6),()=>_0x3404d0['workflow']['tasks'](_0x137fed,_0x1ad8d8||![]),{'verbose':_0x710a8e[_0x14f787(0xbf)]}),_0x4811b7=_0x36deb1[_0x14f787(0xef)];return console[_0x14f787(0xe7)](_0x14f787(0xa5)+_0x4811b7[_0x14f787(0xdc)]+_0x14f787(0x98)+(_0x4811b7[_0x14f787(0xdc)]!==0x1?'s':'')),await handleSDKOutput(_0x4811b7,_0x710a8e),0x0;}catch(_0x4437f5){if(_0x4437f5 instanceof SDKError)return console['error']('Error:\x20'+_0x4437f5[_0x14f787(0xaf)]),_0x4437f5['cause']&&console[_0x14f787(0xe7)](_0x14f787(0xb0)+_0x4437f5['cause']),0x1;throw _0x4437f5;}}}export class WorkflowLogsCommand extends BaseCommand{[a20_0x3d4b8b(0xcb)]='workflow:logs';['description']=a20_0x3d4b8b(0xc8);async[a20_0x3d4b8b(0x96)](_0x2732eb){const _0x358a92=a20_0x3d4b8b,{options:_0x456a41,args:_0x183fba,tdx:_0x19377d}=_0x2732eb,_0x46f127=_0x183fba[0x0],_0x2006fc=_0x183fba[0x1];if(!_0x46f127||!_0x2006fc)return console[_0x358a92(0xe7)]('Error:\x20Attempt\x20ID\x20and\x20task\x20name\x20are\x20required'),0x1;try{_0x456a41['verbose']&&(console['error'](_0x358a92(0xf5)+_0x46f127),console[_0x358a92(0xe7)](_0x358a92(0xf1)+_0x2006fc));const _0x3fee49=_0x456a41[_0x358a92(0xd5)],_0x1fb0b9=await withSpinner('Getting\x20task\x20logs...',()=>_0x19377d[_0x358a92(0xa2)][_0x358a92(0xe2)](_0x46f127,_0x2006fc,{'offset':_0x3fee49,'limit':_0x456a41[_0x358a92(0xbc)]}),{'verbose':_0x456a41[_0x358a92(0xbf)]}),_0x39c74f=_0x1fb0b9['data'];return console[_0x358a92(0xe7)](_0x358a92(0xa5)+_0x39c74f['length']+'\x20log\x20entr'+(_0x39c74f[_0x358a92(0xdc)]!==0x1?'ies':'y')),await handleSDKOutput(_0x39c74f,_0x456a41),0x0;}catch(_0x57e4bf){if(_0x57e4bf instanceof SDKError)return console['error'](_0x358a92(0xa9)+_0x57e4bf[_0x358a92(0xaf)]),_0x57e4bf[_0x358a92(0xf6)]&&console['error'](_0x358a92(0xb0)+_0x57e4bf[_0x358a92(0xf6)]),0x1;throw _0x57e4bf;}}}export class WorkflowKillCommand extends BaseCommand{[a20_0x3d4b8b(0xcb)]='workflow:kill';[a20_0x3d4b8b(0xd8)]=a20_0x3d4b8b(0xd4);async['execute'](_0x49ff5b){const _0x4a6a53=a20_0x3d4b8b,{options:_0x3d0b15,args:_0x269d13,tdx:_0x137478}=_0x49ff5b,_0x4321d9=_0x269d13[0x0];if(!_0x4321d9)return console[_0x4a6a53(0xe7)](_0x4a6a53(0x9c)),0x1;try{const _0x32b273=_0x3d0b15['reason'];_0x3d0b15[_0x4a6a53(0xbf)]&&(console[_0x4a6a53(0xe7)]('Attempt\x20ID:\x20'+_0x4321d9),_0x32b273&&console[_0x4a6a53(0xe7)]('Reason:\x20'+_0x32b273));if(!_0x3d0b15['yes']){const _0x3d3194=await confirm(_0x4a6a53(0xd7)+_0x4321d9+'?');if(!_0x3d3194)return console[_0x4a6a53(0xe7)](_0x4a6a53(0xea)),0x0;}const _0x3eadef=await withSpinner(_0x4a6a53(0x95),()=>_0x137478[_0x4a6a53(0xa2)]['kill'](_0x4321d9,_0x32b273),{'verbose':_0x3d0b15[_0x4a6a53(0xbf)]}),_0x33456f=_0x3eadef['data'];return console[_0x4a6a53(0xe7)]('✔\x20'+_0x33456f),0x0;}catch(_0x1d2f53){if(_0x1d2f53 instanceof SDKError)return console[_0x4a6a53(0xe7)](_0x4a6a53(0xa9)+_0x1d2f53[_0x4a6a53(0xaf)]),_0x1d2f53[_0x4a6a53(0xf6)]&&console[_0x4a6a53(0xe7)](_0x4a6a53(0xb0)+_0x1d2f53[_0x4a6a53(0xf6)]),0x1;throw _0x1d2f53;}}}export class WorkflowRetryCommand extends BaseCommand{[a20_0x3d4b8b(0xcb)]=a20_0x3d4b8b(0xc5);[a20_0x3d4b8b(0xd8)]=a20_0x3d4b8b(0xb1);async['execute'](_0x2ec640){const _0x2c3c77=a20_0x3d4b8b,{options:_0x5b3663,args:_0x455ec2,tdx:_0x26280a}=_0x2ec640,_0x4488b0=_0x455ec2[0x0];if(!_0x4488b0)return console['error'](_0x2c3c77(0xa6)),console['error']('Usage:\x20workflow\x20retry\x20session:<id>\x20or\x20workflow\x20retry\x20attempt:<id>'),0x1;let _0x28d47b=![],_0x5734a7=_0x4488b0;if(_0x4488b0[_0x2c3c77(0xa8)](_0x2c3c77(0xf7)))_0x28d47b=!![],_0x5734a7=_0x4488b0[_0x2c3c77(0xc3)](0x8);else{if(_0x4488b0['startsWith'](_0x2c3c77(0x9b)))_0x28d47b=![],_0x5734a7=_0x4488b0[_0x2c3c77(0xc3)](0x8);else return console['error']('Error:\x20Target\x20must\x20be\x20prefixed\x20with\x20\x22session:\x22\x20or\x20\x22attempt:\x22'),console[_0x2c3c77(0xe7)](_0x2c3c77(0xed)),0x1;}try{const _0x504632=_0x5b3663[_0x2c3c77(0xcd)],_0x9a9fc=_0x5b3663[_0x2c3c77(0xca)],_0x2dabb2=_0x5b3663[_0x2c3c77(0xe1)],_0x5c4513=_0x5b3663[_0x2c3c77(0xae)];_0x5b3663[_0x2c3c77(0xbf)]&&(console[_0x2c3c77(0xe7)]('Target:\x20'+(_0x28d47b?'session':_0x2c3c77(0x97))+'\x20'+_0x5734a7),_0x504632&&console[_0x2c3c77(0xe7)]('From\x20task:\x20'+_0x504632),_0x9a9fc&&console['error'](_0x2c3c77(0xd9)+_0x9a9fc),_0x2dabb2&&console[_0x2c3c77(0xe7)](_0x2c3c77(0xe6)+_0x2dabb2),_0x5c4513&&console['error'](_0x2c3c77(0xbd)));let _0x542077;if(_0x2dabb2)try{if(_0x2dabb2[_0x2c3c77(0xa8)]('@')){const _0x58cb3a=await import(_0x2c3c77(0xd1)),_0x4a4d69=_0x2dabb2['substring'](0x1),_0x48156e=await _0x58cb3a['readFile'](_0x4a4d69,_0x2c3c77(0xee));_0x542077=JSON['parse'](_0x48156e);}else _0x542077=JSON[_0x2c3c77(0xb8)](_0x2dabb2);}catch{return console[_0x2c3c77(0xe7)](_0x2c3c77(0xec)),0x1;}if(!_0x5b3663[_0x2c3c77(0xf2)]){const _0xd58199=await confirm(_0x2c3c77(0xba)+(_0x28d47b?_0x2c3c77(0xbe):_0x2c3c77(0x97))+'\x20'+_0x5734a7+'?');if(!_0xd58199)return console[_0x2c3c77(0xe7)](_0x2c3c77(0xea)),0x0;}let _0x44777e;_0x28d47b?_0x44777e=await withSpinner(_0x2c3c77(0xf3),()=>_0x26280a['workflow'][_0x2c3c77(0xe4)](_0x5734a7,{'fromTask':_0x504632,'retryParams':_0x542077}),{'verbose':_0x5b3663['verbose']}):_0x44777e=await withSpinner(_0x2c3c77(0xdb),()=>_0x26280a['workflow'][_0x2c3c77(0xd3)](_0x5734a7,{'resumeFrom':_0x9a9fc,'retryParams':_0x542077,'force':_0x5c4513}),{'verbose':_0x5b3663[_0x2c3c77(0xbf)]});const _0xc024e0=_0x44777e[_0x2c3c77(0xef)];return console[_0x2c3c77(0xe7)]('✔\x20Retry\x20started'),console[_0x2c3c77(0xe7)](_0x2c3c77(0xbb)+_0xc024e0[_0x2c3c77(0xf4)]),console[_0x2c3c77(0xe7)](_0x2c3c77(0xa1)+_0xc024e0[_0x2c3c77(0xa3)]),0x0;}catch(_0x1b475d){if(_0x1b475d instanceof SDKError)return console[_0x2c3c77(0xe7)](_0x2c3c77(0xa9)+_0x1b475d[_0x2c3c77(0xaf)]),_0x1b475d[_0x2c3c77(0xf6)]&&console[_0x2c3c77(0xe7)](_0x2c3c77(0xb0)+_0x1b475d['cause']),0x1;throw _0x1b475d;}}}
|
package/dist/core/auth.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
(function(_0x4c9b47,_0x1e3103){const _0x120862=a21_0x4242,_0x26c373=_0x4c9b47();while(!![]){try{const _0x1cf1ab=-parseInt(_0x120862(0xcf))/0x1+-parseInt(_0x120862(0xc9))/0x2*(parseInt(_0x120862(0xc7))/0x3)+-parseInt(_0x120862(0xd2))/0x4+-parseInt(_0x120862(0xd6))/0x5*(-parseInt(_0x120862(0xdc))/0x6)+parseInt(_0x120862(0xd7))/0x7*(parseInt(_0x120862(0xdf))/0x8)+-parseInt(_0x120862(0xca))/0x9+parseInt(_0x120862(0xd9))/0xa;if(_0x1cf1ab===_0x1e3103)break;else _0x26c373['push'](_0x26c373['shift']());}catch(_0xd2ef42){_0x26c373['push'](_0x26c373['shift']());}}}(a21_0x441a,0x4f087));import{platform}from'os';import{readFileSync}from'fs';import{fileURLToPath}from'url';import{dirname,join}from'path';function a21_0x4242(_0x12ee40,_0x198226){const _0x441ada=a21_0x441a();return a21_0x4242=function(_0x4242eb,_0x20df5e){_0x4242eb=_0x4242eb-0xc7;let _0x36c677=_0x441ada[_0x4242eb];return _0x36c677;},a21_0x4242(_0x12ee40,_0x198226);}function a21_0x441a(){const _0x622ede=['API\x20key\x20not\x20found\x20for\x20site\x20\x27','8rPerqK','includes','56913hJJYqT','Please\x20provide\x20apiKey\x20in\x20config\x20or\x20set\x20TD_API_KEY_','22DRkege','1994751yFabmG',';\x20node/','replace','TD1\x20','length','208342Ajqhcq','or\x20configure\x20it\x20in\x20~/.config/tdx/.env','0.0.0','377612gAwSiW','\x27.\x20','utf-8','tdx','10sRriTW','2838654ULhoud','url','3196640mNtNcx','parse','\x20environment\x20variable\x20','994794LflNfn','tdx/'];a21_0x441a=function(){return _0x622ede;};return a21_0x441a();}import{getAPIKey}from'./config.js';export function getVersion(){const _0x59f79e=a21_0x4242;try{const _0x110d11=fileURLToPath(import.meta[_0x59f79e(0xd8)]),_0xd67df=dirname(_0x110d11),_0x112b0d=join(_0xd67df,'../../package.json'),_0x1f6c33=JSON[_0x59f79e(0xda)](readFileSync(_0x112b0d,_0x59f79e(0xd4)));return _0x1f6c33['version'];}catch{return _0x59f79e(0xd1);}}export function getUserAgent(){const _0x5f4854=a21_0x4242,_0x599966=getVersion(),_0x474b6a=platform(),_0x16b4b0=process['version'][_0x5f4854(0xcc)]('v','');return _0x5f4854(0xdd)+_0x599966+'\x20('+_0x474b6a+_0x5f4854(0xcb)+_0x16b4b0+')';}export function getAuthHeaders(_0x4ab252,_0x35e9cf){const _0x15cee6=a21_0x4242,_0x20543a=_0x35e9cf||getAPIKey(_0x4ab252);if(!_0x20543a)throw new Error(_0x15cee6(0xde)+_0x4ab252+_0x15cee6(0xd3)+(_0x15cee6(0xc8)+_0x4ab252['toUpperCase']()+_0x15cee6(0xdb))+_0x15cee6(0xd0));const _0x33fbe8=getVersion();return{'Authorization':_0x15cee6(0xcd)+_0x20543a,'User-Agent':getUserAgent(),'X-TD-Client':_0x15cee6(0xd5),'X-TD-Client-Version':_0x33fbe8};}export function validateAPIKey(_0x5093c3){const _0x26b3a8=a21_0x4242;return _0x5093c3[_0x26b3a8(0xe0)]('/')&&_0x5093c3['split']('/')[_0x26b3a8(0xce)]===0x2;}export function hasAPIKey(_0x2fba4a){const _0x5dd66a=getAPIKey(_0x2fba4a);return _0x5dd66a!==undefined&&validateAPIKey(_0x5dd66a);}
|
package/dist/core/config.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
(function(_0x45681a,_0x5e619d){const _0x34e196=a22_0x15f6,_0x149ffd=_0x45681a();while(!![]){try{const _0x2935b9=parseInt(_0x34e196(0x1a0))/0x1+parseInt(_0x34e196(0x19b))/0x2*(-parseInt(_0x34e196(0x1a3))/0x3)+parseInt(_0x34e196(0x1bd))/0x4*(-parseInt(_0x34e196(0x1ad))/0x5)+-parseInt(_0x34e196(0x1bb))/0x6+parseInt(_0x34e196(0x1b3))/0x7+-parseInt(_0x34e196(0x1af))/0x8+parseInt(_0x34e196(0x1bc))/0x9*(parseInt(_0x34e196(0x19c))/0xa);if(_0x2935b9===_0x5e619d)break;else _0x149ffd['push'](_0x149ffd['shift']());}catch(_0x230bd3){_0x149ffd['push'](_0x149ffd['shift']());}}}(a22_0x2a04,0x6624f));function a22_0x2a04(){const _0x13e5f7=['5ltQAEP','.env','3410968cicehJ','Warning:\x20Unknown\x20site\x20\x27','match','warn','4313400ydgNlh','us01','split','.config','dev','env','join','\x27,\x20defaulting\x20to\x20us01','3584130UEltsk','4245489onIIzq','2135820StdTqX','endsWith','TD_API_KEY','apiKeys','tdx','2VAOtVB','40crJViM','ap03','startsWith','eu01','305757LfVZOS','entries','utf-8','2498331omMEqJ','Warning:\x20Failed\x20to\x20read\x20config\x20file\x20','TD_API_KEY_','trim','map','includes','jp01','slice','toUpperCase','ap02'];a22_0x2a04=function(){return _0x13e5f7;};return a22_0x2a04();}import{homedir}from'os';import{join}from'path';function a22_0x15f6(_0x49d94f,_0x31115d){const _0x2a04e3=a22_0x2a04();return a22_0x15f6=function(_0x15f6f4,_0xd77b44){_0x15f6f4=_0x15f6f4-0x19b;let _0x742d7b=_0x2a04e3[_0x15f6f4];return _0x742d7b;},a22_0x15f6(_0x49d94f,_0x31115d);}import{existsSync,readFileSync,writeFileSync,mkdirSync}from'fs';import{SITE_ALIASES}from'../types/index.js';export function getConfigDir(){const _0x5c3c42=a22_0x15f6;return join(homedir(),_0x5c3c42(0x1b6),_0x5c3c42(0x1c1));}export function getConfigFile(){const _0x503ae5=a22_0x15f6;return join(getConfigDir(),_0x503ae5(0x1ae));}export function parseEnvFile(_0x32c253){const _0x589501=a22_0x15f6,_0x4b2a24={};for(const _0x3f8ccd of _0x32c253[_0x589501(0x1b5)]('\x0a')){const _0x443748=_0x3f8ccd[_0x589501(0x1a6)]();if(!_0x443748||_0x443748[_0x589501(0x19e)]('#'))continue;const _0x13b635=_0x443748[_0x589501(0x1b1)](/^([^=]+)=(.*)$/);if(_0x13b635){const _0x5d2edb=_0x13b635[0x1]['trim']();let _0x195d4a=_0x13b635[0x2][_0x589501(0x1a6)]();(_0x195d4a['startsWith']('\x22')&&_0x195d4a[_0x589501(0x1be)]('\x22')||_0x195d4a[_0x589501(0x19e)]('\x27')&&_0x195d4a[_0x589501(0x1be)]('\x27'))&&(_0x195d4a=_0x195d4a[_0x589501(0x1aa)](0x1,-0x1)),_0x4b2a24[_0x5d2edb]=_0x195d4a;}}return _0x4b2a24;}export function readUserConfig(){const _0x2c3d16=a22_0x15f6,_0x556f2b=getConfigFile();if(!existsSync(_0x556f2b))return{};try{const _0x5be2f3=readFileSync(_0x556f2b,_0x2c3d16(0x1a2));return parseEnvFile(_0x5be2f3);}catch(_0x2cf9f1){return console[_0x2c3d16(0x1b2)](_0x2c3d16(0x1a4)+_0x556f2b+':',_0x2cf9f1),{};}}export function resolveSite(_0x546996){const _0x155055=a22_0x15f6,_0x405c2c=['us01',_0x155055(0x1a9),_0x155055(0x19f),_0x155055(0x1ac),'ap03','dev'];if(_0x405c2c[_0x155055(0x1a8)](_0x546996))return _0x546996;if(_0x546996 in SITE_ALIASES)return SITE_ALIASES[_0x546996];return console[_0x155055(0x1b2)](_0x155055(0x1b0)+_0x546996+_0x155055(0x1ba)),_0x155055(0x1b4);}let cachedUserConfig=null;export function loadUserConfigOnce(){return cachedUserConfig===null&&(cachedUserConfig=readUserConfig()),cachedUserConfig;}export function clearConfigCache(){cachedUserConfig=null;}export function getAPIKey(_0x260515){const _0x37f8e9=a22_0x15f6,_0x5c0486=_0x260515['toUpperCase'](),_0x27f6cd=_0x37f8e9(0x1a5)+_0x5c0486;if(process[_0x37f8e9(0x1b8)][_0x27f6cd])return process[_0x37f8e9(0x1b8)][_0x27f6cd];if(process[_0x37f8e9(0x1b8)]['TD_API_KEY'])return process['env'][_0x37f8e9(0x1bf)];const _0x130293=loadUserConfigOnce();if(_0x130293[_0x27f6cd])return _0x130293[_0x27f6cd];if(_0x130293[_0x37f8e9(0x1bf)])return _0x130293[_0x37f8e9(0x1bf)];return undefined;}export function saveAPIKey(_0x2ce490,_0x13de63){const _0x38efb7=a22_0x15f6,_0xdd6ea5=getConfigDir(),_0x562334=getConfigFile();!existsSync(_0xdd6ea5)&&mkdirSync(_0xdd6ea5,{'recursive':!![],'mode':0x1c0});const _0x1b32b7=readUserConfig(),_0x421f96=_0x2ce490[_0x38efb7(0x1ab)]();_0x1b32b7[_0x38efb7(0x1a5)+_0x421f96]=_0x13de63;const _0x58dbee=Object[_0x38efb7(0x1a1)](_0x1b32b7)[_0x38efb7(0x1a7)](([_0xb7da4f,_0x2a0bcf])=>_0xb7da4f+'='+_0x2a0bcf);writeFileSync(_0x562334,_0x58dbee[_0x38efb7(0x1b9)]('\x0a')+'\x0a',{'mode':0x180});}export function loadConfig(){const _0xf6119f=a22_0x15f6,_0x5b53b0={'apiKeys':{},'defaultSite':_0xf6119f(0x1b4)},_0x182765=['us01','jp01',_0xf6119f(0x19f),_0xf6119f(0x1ac),_0xf6119f(0x19d),_0xf6119f(0x1b7)];for(const _0x4f5f72 of _0x182765){const _0x49c834=getAPIKey(_0x4f5f72);_0x49c834&&(_0x5b53b0[_0xf6119f(0x1c0)][_0x4f5f72]=_0x49c834);}return _0x5b53b0;}
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x39d8a1,_0x440cf3){var _0x9958aa=a23_0x5070,_0x473066=_0x39d8a1();while(!![]){try{var _0x3b2eb6=parseInt(_0x9958aa(0x16f))/0x1*(-parseInt(_0x9958aa(0x177))/0x2)+-parseInt(_0x9958aa(0x173))/0x3+-parseInt(_0x9958aa(0x176))/0x4*(-parseInt(_0x9958aa(0x170))/0x5)+parseInt(_0x9958aa(0x171))/0x6*(-parseInt(_0x9958aa(0x179))/0x7)+parseInt(_0x9958aa(0x16d))/0x8*(-parseInt(_0x9958aa(0x16e))/0x9)+-parseInt(_0x9958aa(0x174))/0xa*(parseInt(_0x9958aa(0x175))/0xb)+parseInt(_0x9958aa(0x178))/0xc*(parseInt(_0x9958aa(0x172))/0xd);if(_0x3b2eb6===_0x440cf3)break;else _0x473066['push'](_0x473066['shift']());}catch(_0x172d67){_0x473066['push'](_0x473066['shift']());}}}(a23_0x3433,0x3372d));export*from'./types/index.js';function a23_0x5070(_0x18bdc9,_0x2968b9){var _0x343355=a23_0x3433();return a23_0x5070=function(_0x507041,_0x41b2cf){_0x507041=_0x507041-0x16d;var _0x27d218=_0x343355[_0x507041];return _0x27d218;},a23_0x5070(_0x18bdc9,_0x2968b9);}export*from'./core/config.js';function a23_0x3433(){var _0x5c7198=['5jLVWVn','799746exbHir','13227019bjoZVh','217701SdTJVG','370tjIcVf','116237JWRKPv','1201568bKXGbx','47220acjNdp','12TsoatO','7ZSRXOd','180760vKZlwX','81WBlNNG','13DAYDYK'];a23_0x3433=function(){return _0x5c7198;};return a23_0x3433();}export*from'./core/auth.js';export*from'./client/http-client.js';export*from'./client/td-client.js';export{TrinoClient,TrinoQueryError}from'./client/trino-client.js';export*from'./client/rate-limiter.js';export*from'./types/trino.js';export*from'./commands/command.js';export*from'./commands/query-command.js';export*from'./commands/databases.js';export*from'./commands/tables.js';export*from'./commands/segments.js';export*from'./commands/activations.js';export*from'./commands/show.js';export*from'./commands/describe.js';export*from'./sdk/index.js';
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Raw API SDK - Direct HTTP access to TD APIs
|
|
3
|
+
*
|
|
4
|
+
* Provides programmatic access to make authenticated HTTP requests
|
|
5
|
+
* to any Treasure Data API endpoint.
|
|
6
|
+
*/
|
|
7
|
+
import type { APIType } from '../types/index.js';
|
|
8
|
+
import type { SDKConfig } from './index.js';
|
|
9
|
+
import { type HTTPMethod } from '../client/http-client.js';
|
|
10
|
+
/**
|
|
11
|
+
* Options for raw API requests
|
|
12
|
+
*/
|
|
13
|
+
export interface RawAPIRequestOptions {
|
|
14
|
+
/**
|
|
15
|
+
* HTTP method (GET, POST, PUT, DELETE, PATCH)
|
|
16
|
+
* Default: GET
|
|
17
|
+
*/
|
|
18
|
+
method?: HTTPMethod;
|
|
19
|
+
/**
|
|
20
|
+
* Request body as string or object
|
|
21
|
+
* Will be JSON stringified if object
|
|
22
|
+
*/
|
|
23
|
+
body?: string | object;
|
|
24
|
+
/**
|
|
25
|
+
* Custom HTTP headers
|
|
26
|
+
* These will be merged with authentication headers
|
|
27
|
+
* Custom headers take precedence over default headers
|
|
28
|
+
*/
|
|
29
|
+
headers?: Record<string, string>;
|
|
30
|
+
/**
|
|
31
|
+
* API type to use (determines base URL)
|
|
32
|
+
* Default: 'td'
|
|
33
|
+
*/
|
|
34
|
+
apiType?: APIType;
|
|
35
|
+
/**
|
|
36
|
+
* Include HTTP response headers in result
|
|
37
|
+
* Default: false
|
|
38
|
+
*/
|
|
39
|
+
includeHeaders?: boolean;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Result from raw API request
|
|
43
|
+
*/
|
|
44
|
+
export interface RawAPIResult<T = unknown> {
|
|
45
|
+
/**
|
|
46
|
+
* Response data
|
|
47
|
+
*/
|
|
48
|
+
data: T;
|
|
49
|
+
/**
|
|
50
|
+
* HTTP status code
|
|
51
|
+
*/
|
|
52
|
+
status: number;
|
|
53
|
+
/**
|
|
54
|
+
* Response headers (only included if includeHeaders: true)
|
|
55
|
+
*/
|
|
56
|
+
headers?: Record<string, string>;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Raw API for making authenticated HTTP requests to any TD API endpoint
|
|
60
|
+
*
|
|
61
|
+
* @example
|
|
62
|
+
* ```typescript
|
|
63
|
+
* // GET request
|
|
64
|
+
* const result = await tdx.api.request('/v3/database/list');
|
|
65
|
+
*
|
|
66
|
+
* // POST with body
|
|
67
|
+
* const result = await tdx.api.request('/v3/database/create/mydb', {
|
|
68
|
+
* method: 'POST',
|
|
69
|
+
* body: { name: 'mydb' }
|
|
70
|
+
* });
|
|
71
|
+
*
|
|
72
|
+
* // Custom headers
|
|
73
|
+
* const result = await tdx.api.request('/v3/database/list', {
|
|
74
|
+
* headers: { 'X-Custom': 'value' }
|
|
75
|
+
* });
|
|
76
|
+
*
|
|
77
|
+
* // Different API type
|
|
78
|
+
* const result = await tdx.api.request('/audiences/v1/workspaces/123/audiences', {
|
|
79
|
+
* apiType: 'cdp'
|
|
80
|
+
* });
|
|
81
|
+
*
|
|
82
|
+
* // Include response headers
|
|
83
|
+
* const result = await tdx.api.request('/v3/database/list', {
|
|
84
|
+
* includeHeaders: true
|
|
85
|
+
* });
|
|
86
|
+
* console.log(result.headers);
|
|
87
|
+
* ```
|
|
88
|
+
*/
|
|
89
|
+
export declare class RawAPI {
|
|
90
|
+
private config;
|
|
91
|
+
constructor(config: SDKConfig);
|
|
92
|
+
/**
|
|
93
|
+
* Make a raw HTTP request to any TD API endpoint
|
|
94
|
+
*
|
|
95
|
+
* @param endpoint - API endpoint path (must start with /)
|
|
96
|
+
* @param options - Request options
|
|
97
|
+
* @returns API response wrapped with data and optional headers
|
|
98
|
+
* @throws Error if endpoint is invalid or request fails
|
|
99
|
+
*/
|
|
100
|
+
request<T = unknown>(endpoint: string, options?: RawAPIRequestOptions): Promise<RawAPIResult<T>>;
|
|
101
|
+
/**
|
|
102
|
+
* Helper method to read request body from a file
|
|
103
|
+
*
|
|
104
|
+
* @param filePath - Path to file containing request body
|
|
105
|
+
* @returns File contents as string
|
|
106
|
+
* @throws Error if file cannot be read
|
|
107
|
+
*/
|
|
108
|
+
static readBodyFromFile(filePath: string): string;
|
|
109
|
+
}
|
|
110
|
+
//# sourceMappingURL=api.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../src/sdk/api.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,EAAc,KAAK,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAKvE;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC;;;OAGG;IACH,MAAM,CAAC,EAAE,UAAU,CAAC;IAEpB;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAEvB;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAEjC;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB;;;OAGG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B;AAED;;GAEG;AACH,MAAM,WAAW,YAAY,CAAC,CAAC,GAAG,OAAO;IACvC;;OAEG;IACH,IAAI,EAAE,CAAC,CAAC;IAER;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAClC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,qBAAa,MAAM;IACjB,OAAO,CAAC,MAAM,CAAY;gBAEd,MAAM,EAAE,SAAS;IAI7B;;;;;;;OAOG;IACG,OAAO,CAAC,CAAC,GAAG,OAAO,EACvB,QAAQ,EAAE,MAAM,EAChB,OAAO,GAAE,oBAAyB,GACjC,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;IAuF3B;;;;;;OAMG;IACH,MAAM,CAAC,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM;CAUlD"}
|
package/dist/sdk/api.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const a24_0x2a9003=a24_0x2142;(function(_0x23c45e,_0x2c7616){const _0x3bdf2f=a24_0x2142,_0x2f71a4=_0x23c45e();while(!![]){try{const _0x4e62be=parseInt(_0x3bdf2f(0xb0))/0x1+-parseInt(_0x3bdf2f(0xa3))/0x2*(parseInt(_0x3bdf2f(0xc0))/0x3)+-parseInt(_0x3bdf2f(0xbe))/0x4*(parseInt(_0x3bdf2f(0xa6))/0x5)+parseInt(_0x3bdf2f(0xb8))/0x6+-parseInt(_0x3bdf2f(0xab))/0x7+parseInt(_0x3bdf2f(0xb6))/0x8*(-parseInt(_0x3bdf2f(0xa5))/0x9)+parseInt(_0x3bdf2f(0xb3))/0xa;if(_0x4e62be===_0x2c7616)break;else _0x2f71a4['push'](_0x2f71a4['shift']());}catch(_0x57c91f){_0x2f71a4['push'](_0x2f71a4['shift']());}}}(a24_0xacc4,0x5a555));function a24_0xacc4(){const _0x5d8701=['Failed\x20to\x20read\x20request\x20body\x20from\x20file:\x20','28BVUnLG','status','100773rCGFmE','700ZsIShr','trino','Invalid\x20API\x20key\x20format\x20for\x20Trino','User-Agent','application/json','3945158fewsDx','X-TD-Client-Version','stringify','string','site','427446XkcLHQ','Content-Type','Endpoint\x20must\x20start\x20with\x20/:\x20','7011760ddAMHI','startsWith','Authorization','16hwpXaG','readBodyFromFile','4002630oNjtSx','data','substring','config','utf-8','headers','15736TJPQJK','apiKey','61923sNpIwA'];a24_0xacc4=function(){return _0x5d8701;};return a24_0xacc4();}function a24_0x2142(_0x333ff2,_0x4df948){const _0xacc4c0=a24_0xacc4();return a24_0x2142=function(_0x214278,_0x77b3c9){_0x214278=_0x214278-0xa2;let _0x553647=_0xacc4c0[_0x214278];return _0x553647;},a24_0x2142(_0x333ff2,_0x4df948);}import{HTTPClient}from'../client/http-client.js';import{getEndpoint}from'../types/index.js';import{getAuthHeaders}from'../core/auth.js';import{readFileSync}from'fs';export class RawAPI{['config'];constructor(_0x1fcac0){const _0x197d74=a24_0x2142;this[_0x197d74(0xbb)]=_0x1fcac0;}async['request'](_0x178497,_0x6659e5={}){const _0xe8c253=a24_0x2142,{method:method='GET',body:_0x57a9c4,headers:_0x550402={},apiType:apiType='td',includeHeaders:includeHeaders=![]}=_0x6659e5;if(!_0x178497['startsWith']('/'))throw new Error(_0xe8c253(0xb2)+_0x178497);const _0x2278a0=getEndpoint(this[_0xe8c253(0xbb)][_0xe8c253(0xaf)],apiType),_0x30ca1a=getAuthHeaders(this[_0xe8c253(0xbb)][_0xe8c253(0xaf)],this[_0xe8c253(0xbb)][_0xe8c253(0xbf)]);let _0xf4691b;if(apiType===_0xe8c253(0xa7)){const _0x3ab1e7=_0x30ca1a[_0xe8c253(0xb5)];if(!_0x3ab1e7||!_0x3ab1e7[_0xe8c253(0xb4)]('TD1\x20'))throw new Error(_0xe8c253(0xa8));const _0x2ffdab=_0x3ab1e7[_0xe8c253(0xba)](0x4);_0xf4691b={'User-Agent':_0x30ca1a[_0xe8c253(0xa9)],'X-TD-Client':_0x30ca1a['X-TD-Client'],'X-TD-Client-Version':_0x30ca1a[_0xe8c253(0xac)],'X-Trino-User':_0x2ffdab,..._0x550402};}else _0xf4691b={..._0x30ca1a,..._0x550402};const _0x7da4c0=_0xf4691b;let _0x2acc90;_0x57a9c4!==undefined&&(_0x2acc90=typeof _0x57a9c4===_0xe8c253(0xae)?_0x57a9c4:JSON[_0xe8c253(0xad)](_0x57a9c4),!_0x7da4c0[_0xe8c253(0xb1)]&&(_0x7da4c0['Content-Type']=_0xe8c253(0xaa)));const _0x191593=new HTTPClient(_0x2278a0,_0x7da4c0),_0x383a91=await _0x191593['request'](method,_0x178497,{'body':_0x2acc90,'includeHeaders':!![]});return includeHeaders?{'data':_0x383a91['data'],'status':_0x383a91[_0xe8c253(0xa4)],'headers':_0x383a91[_0xe8c253(0xbd)]}:{'data':_0x383a91[_0xe8c253(0xb9)],'status':_0x383a91[_0xe8c253(0xa4)]};}static[a24_0x2a9003(0xb7)](_0x34f448){const _0x4dede0=a24_0x2a9003;try{return readFileSync(_0x34f448,_0x4dede0(0xbc));}catch(_0x352963){throw new Error(_0x4dede0(0xa2)+_0x34f448+'.\x20'+('Error:\x20'+(_0x352963 instanceof Error?_0x352963['message']:String(_0x352963))));}}}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api.js","sourceRoot":"","sources":["../../src/sdk/api.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,EAAE,UAAU,EAAmB,MAAM,0BAA0B,CAAC;AACvE,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,IAAI,CAAC;AA0DlC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,MAAM,OAAO,MAAM;IACT,MAAM,CAAY;IAE1B,YAAY,MAAiB;QAC3B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;IAED;;;;;;;OAOG;IACH,KAAK,CAAC,OAAO,CACX,QAAgB,EAChB,UAAgC,EAAE;QAElC,MAAM,EACJ,MAAM,GAAG,KAAK,EACd,IAAI,EACJ,OAAO,EAAE,aAAa,GAAG,EAAE,EAC3B,OAAO,GAAG,IAAI,EACd,cAAc,GAAG,KAAK,GACvB,GAAG,OAAO,CAAC;QAEZ,oBAAoB;QACpB,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;YAC9B,MAAM,IAAI,KAAK,CAAC,+BAA+B,QAAQ,EAAE,CAAC,CAAC;QAC7D,CAAC;QAED,4BAA4B;QAC5B,MAAM,OAAO,GAAG,WAAW,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QAEvD,6BAA6B;QAC7B,MAAM,WAAW,GAAG,cAAc,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;QAEzE,0CAA0C;QAC1C,0DAA0D;QAC1D,IAAI,cAAsC,CAAC;QAC3C,IAAI,OAAO,KAAK,OAAO,EAAE,CAAC;YACxB,4CAA4C;YAC5C,MAAM,UAAU,GAAG,WAAW,CAAC,aAAa,CAAC;YAC7C,IAAI,CAAC,UAAU,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE,CAAC;gBAClD,MAAM,IAAI,KAAK,CAAC,kCAAkC,CAAC,CAAC;YACtD,CAAC;YACD,MAAM,MAAM,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,uBAAuB;YAE/D,oEAAoE;YACpE,cAAc,GAAG;gBACf,YAAY,EAAE,WAAW,CAAC,YAAY,CAAC;gBACvC,aAAa,EAAE,WAAW,CAAC,aAAa,CAAC;gBACzC,qBAAqB,EAAE,WAAW,CAAC,qBAAqB,CAAC;gBACzD,cAAc,EAAE,MAAM,EAAE,uBAAuB;gBAC/C,GAAG,aAAa,EAAE,8BAA8B;aACjD,CAAC;QACJ,CAAC;aAAM,CAAC;YACN,8CAA8C;YAC9C,cAAc,GAAG;gBACf,GAAG,WAAW;gBACd,GAAG,aAAa;aACjB,CAAC;QACJ,CAAC;QAED,uBAAuB;QACvB,MAAM,aAAa,GAAG,cAAc,CAAC;QAErC,uBAAuB;QACvB,IAAI,WAA+B,CAAC;QACpC,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;YACvB,WAAW,GAAG,OAAO,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;YACrE,iEAAiE;YACjE,IAAI,CAAC,aAAa,CAAC,cAAc,CAAC,EAAE,CAAC;gBACnC,aAAa,CAAC,cAAc,CAAC,GAAG,kBAAkB,CAAC;YACrD,CAAC;QACH,CAAC;QAED,0EAA0E;QAC1E,gFAAgF;QAEhF,sCAAsC;QACtC,MAAM,UAAU,GAAG,IAAI,UAAU,CAAC,OAAO,EAAE,aAAa,CAAC,CAAC;QAE1D,qDAAqD;QACrD,MAAM,QAAQ,GAAG,MAAM,UAAU,CAAC,OAAO,CAAI,MAAM,EAAE,QAAQ,EAAE;YAC7D,IAAI,EAAE,WAAW;YACjB,cAAc,EAAE,IAAI;SACrB,CAAC,CAAC;QAEH,gEAAgE;QAChE,IAAI,cAAc,EAAE,CAAC;YACnB,OAAO;gBACL,IAAI,EAAE,QAAQ,CAAC,IAAI;gBACnB,MAAM,EAAE,QAAQ,CAAC,MAAM;gBACvB,OAAO,EAAE,QAAQ,CAAC,OAAO;aAC1B,CAAC;QACJ,CAAC;aAAM,CAAC;YACN,OAAO;gBACL,IAAI,EAAE,QAAQ,CAAC,IAAI;gBACnB,MAAM,EAAE,QAAQ,CAAC,MAAM;aACxB,CAAC;QACJ,CAAC;IACH,CAAC;IAED;;;;;;OAMG;IACH,MAAM,CAAC,gBAAgB,CAAC,QAAgB;QACtC,IAAI,CAAC;YACH,OAAO,YAAY,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;QACzC,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,IAAI,KAAK,CACb,0CAA0C,QAAQ,IAAI;gBACtD,UAAU,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CACnE,CAAC;QACJ,CAAC;IACH,CAAC;CACF"}
|