@treasuredata/tdx 0.3.2 → 0.3.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/dist/build-info.json +2 -2
- package/dist/cli.js +1 -1
- package/dist/cli.js.map +1 -1
- package/dist/client/cdp-api-client.js +1 -1
- package/dist/client/http-client.js +1 -1
- package/dist/client/llm-api-client.js +1 -1
- package/dist/client/rate-limiter.js +1 -1
- package/dist/client/td-api-client.js +1 -1
- package/dist/client/trino-api-client.js +1 -1
- package/dist/client/workflow-client.js +1 -1
- package/dist/commands/activations.js +1 -1
- package/dist/commands/api-command.js +1 -1
- package/dist/commands/auth-command.js +1 -1
- package/dist/commands/chat-command.js +1 -1
- package/dist/commands/claude-command.js +1 -1
- package/dist/commands/command.js +1 -1
- package/dist/commands/context-command.js +1 -1
- package/dist/commands/databases.js +1 -1
- package/dist/commands/describe.js +1 -1
- package/dist/commands/job-command.js +1 -1
- package/dist/commands/llm-command.js +1 -1
- package/dist/commands/llm-proxy.js +1 -1
- package/dist/commands/parent-segment-command.js +1 -1
- package/dist/commands/profiles-command.js +1 -1
- package/dist/commands/query-command.js +1 -1
- package/dist/commands/segment-command.js +1 -1
- package/dist/commands/segment-create-command.js +1 -1
- package/dist/commands/segment-fields-command.js +1 -1
- package/dist/commands/segment-pwd-command.js +1 -1
- package/dist/commands/segment-update-command.js +1 -1
- package/dist/commands/segment-use-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/use-command.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/core/global-context.js +1 -1
- package/dist/core/profile.js +1 -1
- package/dist/core/project-config.js +1 -1
- package/dist/core/session.js +1 -1
- package/dist/index.js +1 -1
- package/dist/proxy/anthropic-adapter.js +1 -1
- package/dist/proxy/server.js +1 -1
- package/dist/proxy/session-cache.js +1 -1
- package/dist/sdk/api.js +1 -1
- package/dist/sdk/errors.js +1 -1
- package/dist/sdk/index.js +1 -1
- package/dist/sdk/job.js +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/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/constants.js +1 -1
- package/dist/utils/file-permissions.js +1 -1
- package/dist/utils/format-detector.js +1 -1
- package/dist/utils/formatters.js +1 -1
- package/dist/utils/json-loader.js +1 -1
- package/dist/utils/model-aliases.js +1 -1
- package/dist/utils/option-validation.js +1 -1
- package/dist/utils/port.js +1 -1
- package/dist/utils/process.js +1 -1
- package/dist/utils/prompt.js +1 -1
- package/dist/utils/segment-path-parser.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/dist/utils/tdx-logger.js +1 -1
- package/dist/utils/tdx-logger.js.map +1 -1
- package/dist/utils/tree-formatter.js +1 -1
- package/dist/utils/version-check.js +1 -1
- package/dist/utils/workflow-utils.js +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
const a33_0x14a6de=a33_0x2cba;(function(_0x580f19,_0x2387fb){const _0x8d2e7f=a33_0x2cba,_0xeca515=_0x580f19();while(!![]){try{const _0x29fdd7=parseInt(_0x8d2e7f(0x1e1))/0x1*(parseInt(_0x8d2e7f(0x199))/0x2)+-parseInt(_0x8d2e7f(0x1c5))/0x3+parseInt(_0x8d2e7f(0x1cc))/0x4*(-parseInt(_0x8d2e7f(0x191))/0x5)+-parseInt(_0x8d2e7f(0x1d3))/0x6+-parseInt(_0x8d2e7f(0x1bb))/0x7+parseInt(_0x8d2e7f(0x194))/0x8*(-parseInt(_0x8d2e7f(0x1bd))/0x9)+-parseInt(_0x8d2e7f(0x1b8))/0xa*(-parseInt(_0x8d2e7f(0x1fa))/0xb);if(_0x29fdd7===_0x2387fb)break;else _0xeca515['push'](_0xeca515['shift']());}catch(_0x23eedc){_0xeca515['push'](_0xeca515['shift']());}}}(a33_0x1f5f,0xd5564));function a33_0x1f5f(){const _0x2409b9=['from','✔\x20Deleted\x20project\x20','Attempt\x20ID:\x20','sessionId','substring','4310140bQiFDa','\x20session','\x20project','11188478noTomK','\x20\x20Location:\x20','6594651svwRDY','fromTask','\x20log\x20entr','Show\x20tasks\x20for\x20an\x20attempt','retrySession','\x22?\x20This\x20cannot\x20be\x20undone.','tasks','delete','789750kEkOZf','filesExtracted','Project:\x20','Params:\x20','revision','Project\x20directory:\x20','error','1933376iElsrz','workflow:push','Status:\x20','offset','Listing\x20workflow\x20attempts...','\x20\x20Cause:\x20','Usage:\x20workflow\x20retry\x20session:<id>\x20or\x20workflow\x20retry\x20attempt:<id>','70656XtSMJy','status','attempt:','\x20\x20Files\x20extracted:\x20','workflow:kill','List\x20all\x20workflow\x20projects','\x20is\x20not\x20a\x20directory','Reason:\x20','Error:\x20Project\x20name\x20is\x20required','Error:\x20Attempt\x20ID\x20is\x20required','Listing\x20workflow\x20projects...','Error:\x20Project\x20name\x20or\x20ID\x20is\x20required','workflow:workflows','Usage:\x20workflow:download\x20<project-name>\x20[output-dir]','87644RnxXtT','split','workflow:attempts','Error:\x20','Kill\x20a\x20running\x20attempt','length','Error:\x20Session\x20ID\x20or\x20attempt\x20ID\x20is\x20required','Filter:\x20','Retrying\x20attempt...','Downloading\x20project\x20','\x20\x20Revision:\x20','sessions','Killing\x20attempt...','attemptId','Retry\x20a\x20session\x20or\x20attempt','Filter:\x20project=','attempts','Cancelled','session','\x20\x20Project\x20ID:\x20','download','startsWith','Getting\x20task\x20logs...','cause','List\x20workflow\x20execution\x20sessions','121SDStCL','parse','projectName','workflow:logs','Force:\x20yes','workflow','reason','Revision:\x20','\x20task','Listing\x20workflow\x20sessions...','isDirectory','workflow:tasks','List\x20workflow\x20attempts','...','limit','name','execute','\x20\x20Session\x20ID:\x20','workflow:attempt','Project\x20filter:\x20','session:','\x20\x20New\x20attempt\x20ID:\x20','workflow:download','10oXjsjV','Push\x20workflow\x20project\x20to\x20Treasure\x20Data','\x20workflow','16PLTiuW','description','Including\x20subtasks:\x20yes','resumeFrom','Retrying\x20session...','10hpvQdk','verbose','Getting\x20attempt\x20tasks...','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20project\x20\x22','yes','data','\x20attempt','Error:\x20Target\x20must\x20be\x20prefixed\x20with\x20\x22session:\x22\x20or\x20\x22attempt:\x22','message','Are\x20you\x20sure\x20you\x20want\x20to\x20kill\x20attempt\x20','force','Getting\x20attempt\x20details...','✔\x20Found\x20','skipValidation','Output\x20directory:\x20','From\x20task:\x20','Delete\x20workflow\x20project\x20from\x20Treasure\x20Data','ies','workflow:projects','Resume\x20from:\x20','✔\x20Retry\x20started','attempt','params','List\x20workflows','Include\x20retried:\x20yes','Pushing\x20workflow\x20project...'];a33_0x1f5f=function(){return _0x2409b9;};return a33_0x1f5f();}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{confirm}from'../utils/prompt.js';export class WorkflowProjectsCommand extends BaseCommand{[a33_0x14a6de(0x209)]=a33_0x14a6de(0x1ab);['description']=a33_0x14a6de(0x1d8);async[a33_0x14a6de(0x20a)](_0x214ec9){const _0x277699=a33_0x14a6de,{options:_0x66ecf5,args:_0x426dfe,tdx:_0x33e864}=_0x214ec9,_0x68d873=_0x426dfe[0x0];try{_0x66ecf5['verbose']&&_0x68d873&&console[_0x277699(0x1cb)]('Pattern:\x20'+_0x68d873);const _0x22b0db=await withSpinner(_0x277699(0x1dd),()=>_0x33e864[_0x277699(0x1ff)]['projects'](_0x68d873,{'limit':_0x66ecf5['limit']}),{'verbose':_0x66ecf5[_0x277699(0x19a)]}),_0xec0d4=_0x22b0db[_0x277699(0x19e)];return console[_0x277699(0x1cb)](_0x277699(0x1a5)+_0xec0d4[_0x277699(0x1e6)]+_0x277699(0x1ba)+(_0xec0d4['length']!==0x1?'s':'')),await handleSDKOutput(_0xec0d4,_0x66ecf5),0x0;}catch(_0x38e451){if(_0x38e451 instanceof SDKError)return console[_0x277699(0x1cb)]('Error:\x20'+_0x38e451[_0x277699(0x1a1)]),_0x38e451[_0x277699(0x1f8)]&&console[_0x277699(0x1cb)](_0x277699(0x1d1)+_0x38e451['cause']),0x1;throw _0x38e451;}}}export class WorkflowWorkflowsCommand extends BaseCommand{[a33_0x14a6de(0x209)]=a33_0x14a6de(0x1df);['description']=a33_0x14a6de(0x1b0);async[a33_0x14a6de(0x20a)](_0x5df72b){const _0x45ae76=a33_0x14a6de,{options:_0x3356a7,args:_0x54bffe,tdx:_0x2988b1}=_0x5df72b,_0x462a70=_0x54bffe[0x0];try{_0x3356a7[_0x45ae76(0x19a)]&&_0x462a70&&console[_0x45ae76(0x1cb)](_0x45ae76(0x20d)+_0x462a70);const _0x3b5ff2=await withSpinner('Listing\x20workflows...',()=>_0x2988b1[_0x45ae76(0x1ff)]['workflows'](_0x462a70,{'limit':_0x3356a7['limit']}),{'verbose':_0x3356a7[_0x45ae76(0x19a)]}),_0x4a07a5=_0x3b5ff2[_0x45ae76(0x19e)];return console[_0x45ae76(0x1cb)](_0x45ae76(0x1a5)+_0x4a07a5['length']+_0x45ae76(0x193)+(_0x4a07a5[_0x45ae76(0x1e6)]!==0x1?'s':'')),await handleSDKOutput(_0x4a07a5,_0x3356a7),0x0;}catch(_0x356235){if(_0x356235 instanceof SDKError)return console[_0x45ae76(0x1cb)](_0x45ae76(0x1e4)+_0x356235[_0x45ae76(0x1a1)]),_0x356235[_0x45ae76(0x1f8)]&&console[_0x45ae76(0x1cb)](_0x45ae76(0x1d1)+_0x356235[_0x45ae76(0x1f8)]),0x1;throw _0x356235;}}}export class WorkflowSessionsCommand extends BaseCommand{[a33_0x14a6de(0x209)]='workflow:sessions';['description']=a33_0x14a6de(0x1f9);async[a33_0x14a6de(0x20a)](_0x3dc2f0){const _0x2eda6b=a33_0x14a6de,{options:_0xb52d1,args:_0x1cecde,tdx:_0x4f49d5}=_0x3dc2f0;let _0x17fb0f,_0x472134;if(_0x1cecde[0x0]){const _0x40a544=_0x1cecde[0x0][_0x2eda6b(0x1e2)]('.');if(_0x40a544['length']===0x1)_0x17fb0f=_0x40a544[0x0];else{if(_0x40a544[_0x2eda6b(0x1e6)]===0x2)[_0x17fb0f,_0x472134]=_0x40a544;else return console[_0x2eda6b(0x1cb)]('Error:\x20Invalid\x20pattern.\x20Use\x20format:\x20project\x20or\x20project.workflow'),0x1;}}try{if(_0xb52d1['verbose']){if(_0x17fb0f&&_0x472134)console['error'](_0x2eda6b(0x1e8)+_0x17fb0f+'.'+_0x472134);else _0x17fb0f&&console['error'](_0x2eda6b(0x1f0)+_0x17fb0f);const _0x22aab9=_0xb52d1[_0x2eda6b(0x1d4)];_0x22aab9&&console[_0x2eda6b(0x1cb)](_0x2eda6b(0x1ce)+_0x22aab9);}const _0x90f85f=await withSpinner(_0x2eda6b(0x203),()=>_0x4f49d5[_0x2eda6b(0x1ff)][_0x2eda6b(0x1ec)]({'projectName':_0x17fb0f,'workflowName':_0x472134,'status':_0xb52d1['status'],'fromTime':_0xb52d1[_0x2eda6b(0x1b3)],'toTime':_0xb52d1['to'],'limit':_0xb52d1[_0x2eda6b(0x208)]}),{'verbose':_0xb52d1[_0x2eda6b(0x19a)]}),_0x5c1896=_0x90f85f[_0x2eda6b(0x19e)];return console[_0x2eda6b(0x1cb)](_0x2eda6b(0x1a5)+_0x5c1896[_0x2eda6b(0x1e6)]+_0x2eda6b(0x1b9)+(_0x5c1896[_0x2eda6b(0x1e6)]!==0x1?'s':'')),await handleSDKOutput(_0x5c1896,_0xb52d1),0x0;}catch(_0x4a2584){if(_0x4a2584 instanceof SDKError)return console['error'](_0x2eda6b(0x1e4)+_0x4a2584[_0x2eda6b(0x1a1)]),_0x4a2584[_0x2eda6b(0x1f8)]&&console[_0x2eda6b(0x1cb)](_0x2eda6b(0x1d1)+_0x4a2584[_0x2eda6b(0x1f8)]),0x1;throw _0x4a2584;}}}export class WorkflowAttemptsCommand extends BaseCommand{[a33_0x14a6de(0x209)]=a33_0x14a6de(0x1e3);[a33_0x14a6de(0x195)]=a33_0x14a6de(0x206);async['execute'](_0x4ccece){const _0x12d0fb=a33_0x14a6de,{options:_0x1e5688,args:_0x3cd2dd,tdx:_0x438d87}=_0x4ccece;let _0x386478,_0x531b49;if(_0x3cd2dd[0x0]){const _0x463275=_0x3cd2dd[0x0]['split']('.');if(_0x463275[_0x12d0fb(0x1e6)]===0x1)_0x386478=_0x463275[0x0];else{if(_0x463275[_0x12d0fb(0x1e6)]===0x2)[_0x386478,_0x531b49]=_0x463275;else return console['error']('Error:\x20Invalid\x20pattern.\x20Use\x20format:\x20project\x20or\x20project.workflow'),0x1;}}try{const _0x5bae6e=_0x1e5688['includeRetried'];if(_0x1e5688[_0x12d0fb(0x19a)]){if(_0x386478&&_0x531b49)console[_0x12d0fb(0x1cb)](_0x12d0fb(0x1e8)+_0x386478+'.'+_0x531b49);else _0x386478&&console[_0x12d0fb(0x1cb)](_0x12d0fb(0x1f0)+_0x386478);_0x5bae6e&&console['error'](_0x12d0fb(0x1b1));}const _0x30915b=await withSpinner(_0x12d0fb(0x1d0),()=>_0x438d87[_0x12d0fb(0x1ff)][_0x12d0fb(0x1f1)]({'projectName':_0x386478,'workflowName':_0x531b49,'includeRetried':_0x5bae6e,'limit':_0x1e5688['limit']}),{'verbose':_0x1e5688['verbose']}),_0x51dcc0=_0x30915b[_0x12d0fb(0x19e)];return console['error'](_0x12d0fb(0x1a5)+_0x51dcc0[_0x12d0fb(0x1e6)]+_0x12d0fb(0x19f)+(_0x51dcc0[_0x12d0fb(0x1e6)]!==0x1?'s':'')),await handleSDKOutput(_0x51dcc0,_0x1e5688),0x0;}catch(_0x2c9a0a){if(_0x2c9a0a instanceof SDKError)return console[_0x12d0fb(0x1cb)](_0x12d0fb(0x1e4)+_0x2c9a0a[_0x12d0fb(0x1a1)]),_0x2c9a0a[_0x12d0fb(0x1f8)]&&console[_0x12d0fb(0x1cb)](_0x12d0fb(0x1d1)+_0x2c9a0a[_0x12d0fb(0x1f8)]),0x1;throw _0x2c9a0a;}}}export class WorkflowAttemptCommand extends BaseCommand{['name']=a33_0x14a6de(0x20c);[a33_0x14a6de(0x195)]='Show\x20specific\x20attempt\x20details';async[a33_0x14a6de(0x20a)](_0x305cb4){const _0x1a4787=a33_0x14a6de,{options:_0x33af33,args:_0x5cb66f,tdx:_0x460b27}=_0x305cb4,_0x5838ba=_0x5cb66f[0x0];if(!_0x5838ba)return console['error'](_0x1a4787(0x1dc)),0x1;try{_0x33af33[_0x1a4787(0x19a)]&&console['error'](_0x1a4787(0x1b5)+_0x5838ba);const _0x272ff4=await withSpinner(_0x1a4787(0x1a4),()=>_0x460b27[_0x1a4787(0x1ff)][_0x1a4787(0x1ae)](_0x5838ba),{'verbose':_0x33af33[_0x1a4787(0x19a)]}),_0x1066d8=_0x272ff4['data'];return await handleSDKOutput([_0x1066d8],_0x33af33),0x0;}catch(_0x315a63){if(_0x315a63 instanceof SDKError)return console['error'](_0x1a4787(0x1e4)+_0x315a63[_0x1a4787(0x1a1)]),_0x315a63[_0x1a4787(0x1f8)]&&console[_0x1a4787(0x1cb)](_0x1a4787(0x1d1)+_0x315a63[_0x1a4787(0x1f8)]),0x1;throw _0x315a63;}}}function a33_0x2cba(_0x19f7bc,_0x5d2696){const _0x1f5fb0=a33_0x1f5f();return a33_0x2cba=function(_0x2cba13,_0x56f559){_0x2cba13=_0x2cba13-0x18e;let _0x104e8e=_0x1f5fb0[_0x2cba13];return _0x104e8e;},a33_0x2cba(_0x19f7bc,_0x5d2696);}export class WorkflowTasksCommand extends BaseCommand{['name']=a33_0x14a6de(0x205);['description']=a33_0x14a6de(0x1c0);async[a33_0x14a6de(0x20a)](_0x543978){const _0x168604=a33_0x14a6de,{options:_0x4139c0,args:_0x52244a,tdx:_0x48e9ea}=_0x543978,_0x3e3f86=_0x52244a[0x0];if(!_0x3e3f86)return console['error'](_0x168604(0x1dc)),0x1;try{const _0x2a5284=_0x4139c0['includeSubtasks'];_0x4139c0[_0x168604(0x19a)]&&(console[_0x168604(0x1cb)](_0x168604(0x1b5)+_0x3e3f86),_0x2a5284&&console[_0x168604(0x1cb)](_0x168604(0x196)));const _0x3ba006=await withSpinner(_0x168604(0x19b),()=>_0x48e9ea['workflow'][_0x168604(0x1c3)](_0x3e3f86,_0x2a5284||![]),{'verbose':_0x4139c0[_0x168604(0x19a)]}),_0x30f08a=_0x3ba006[_0x168604(0x19e)];return console[_0x168604(0x1cb)](_0x168604(0x1a5)+_0x30f08a[_0x168604(0x1e6)]+_0x168604(0x202)+(_0x30f08a[_0x168604(0x1e6)]!==0x1?'s':'')),await handleSDKOutput(_0x30f08a,_0x4139c0),0x0;}catch(_0x55faac){if(_0x55faac instanceof SDKError)return console[_0x168604(0x1cb)](_0x168604(0x1e4)+_0x55faac['message']),_0x55faac[_0x168604(0x1f8)]&&console[_0x168604(0x1cb)](_0x168604(0x1d1)+_0x55faac['cause']),0x1;throw _0x55faac;}}}export class WorkflowLogsCommand extends BaseCommand{['name']=a33_0x14a6de(0x1fd);['description']='Show\x20logs\x20for\x20a\x20specific\x20task';async[a33_0x14a6de(0x20a)](_0x3e1b23){const _0x24932e=a33_0x14a6de,{options:_0x2110c3,args:_0x1e1e3c,tdx:_0xf394ba}=_0x3e1b23,_0x40616c=_0x1e1e3c[0x0],_0x480802=_0x1e1e3c[0x1];if(!_0x40616c||!_0x480802)return console[_0x24932e(0x1cb)]('Error:\x20Attempt\x20ID\x20and\x20task\x20name\x20are\x20required'),0x1;try{_0x2110c3[_0x24932e(0x19a)]&&(console[_0x24932e(0x1cb)]('Attempt\x20ID:\x20'+_0x40616c),console[_0x24932e(0x1cb)]('Task\x20name:\x20'+_0x480802));const _0x13e8b8=_0x2110c3[_0x24932e(0x1cf)],_0x23baa4=await withSpinner(_0x24932e(0x1f7),()=>_0xf394ba[_0x24932e(0x1ff)]['logs'](_0x40616c,_0x480802,{'offset':_0x13e8b8,'limit':_0x2110c3[_0x24932e(0x208)]}),{'verbose':_0x2110c3[_0x24932e(0x19a)]}),_0x57e1fe=_0x23baa4[_0x24932e(0x19e)];return console['error'](_0x24932e(0x1a5)+_0x57e1fe[_0x24932e(0x1e6)]+_0x24932e(0x1bf)+(_0x57e1fe[_0x24932e(0x1e6)]!==0x1?_0x24932e(0x1aa):'y')),await handleSDKOutput(_0x57e1fe,_0x2110c3),0x0;}catch(_0x417287){if(_0x417287 instanceof SDKError)return console[_0x24932e(0x1cb)]('Error:\x20'+_0x417287[_0x24932e(0x1a1)]),_0x417287[_0x24932e(0x1f8)]&&console[_0x24932e(0x1cb)]('\x20\x20Cause:\x20'+_0x417287[_0x24932e(0x1f8)]),0x1;throw _0x417287;}}}export class WorkflowKillCommand extends BaseCommand{[a33_0x14a6de(0x209)]=a33_0x14a6de(0x1d7);[a33_0x14a6de(0x195)]=a33_0x14a6de(0x1e5);async[a33_0x14a6de(0x20a)](_0x427d09){const _0x2664a1=a33_0x14a6de,{options:_0x6ff129,args:_0x4a832f,tdx:_0x2c3542}=_0x427d09,_0x1f26d9=_0x4a832f[0x0];if(!_0x1f26d9)return console['error'](_0x2664a1(0x1dc)),0x1;try{const _0x316874=_0x6ff129[_0x2664a1(0x200)];_0x6ff129[_0x2664a1(0x19a)]&&(console[_0x2664a1(0x1cb)](_0x2664a1(0x1b5)+_0x1f26d9),_0x316874&&console['error'](_0x2664a1(0x1da)+_0x316874));if(!_0x6ff129[_0x2664a1(0x19d)]){const _0x4ddf04=await confirm(_0x2664a1(0x1a2)+_0x1f26d9+'?');if(!_0x4ddf04)return console[_0x2664a1(0x1cb)](_0x2664a1(0x1f2)),0x0;}const _0x5f0ad1=await withSpinner(_0x2664a1(0x1ed),()=>_0x2c3542['workflow']['kill'](_0x1f26d9,_0x316874),{'verbose':_0x6ff129[_0x2664a1(0x19a)]}),_0xd35c04=_0x5f0ad1[_0x2664a1(0x19e)];return console[_0x2664a1(0x1cb)]('✔\x20'+_0xd35c04),0x0;}catch(_0x3e7838){if(_0x3e7838 instanceof SDKError)return console[_0x2664a1(0x1cb)](_0x2664a1(0x1e4)+_0x3e7838['message']),_0x3e7838[_0x2664a1(0x1f8)]&&console[_0x2664a1(0x1cb)]('\x20\x20Cause:\x20'+_0x3e7838[_0x2664a1(0x1f8)]),0x1;throw _0x3e7838;}}}export class WorkflowRetryCommand extends BaseCommand{['name']='workflow:retry';[a33_0x14a6de(0x195)]=a33_0x14a6de(0x1ef);async[a33_0x14a6de(0x20a)](_0x31837b){const _0x3dc31e=a33_0x14a6de,{options:_0x33cc6c,args:_0x4275de,tdx:_0x3c7c98}=_0x31837b,_0x769421=_0x4275de[0x0];if(!_0x769421)return console[_0x3dc31e(0x1cb)](_0x3dc31e(0x1e7)),console[_0x3dc31e(0x1cb)]('Usage:\x20workflow\x20retry\x20session:<id>\x20or\x20workflow\x20retry\x20attempt:<id>'),0x1;let _0x1bfde4=![],_0x419812=_0x769421;if(_0x769421[_0x3dc31e(0x1f6)](_0x3dc31e(0x18e)))_0x1bfde4=!![],_0x419812=_0x769421[_0x3dc31e(0x1b7)](0x8);else{if(_0x769421[_0x3dc31e(0x1f6)](_0x3dc31e(0x1d5)))_0x1bfde4=![],_0x419812=_0x769421['substring'](0x8);else return console[_0x3dc31e(0x1cb)](_0x3dc31e(0x1a0)),console['error'](_0x3dc31e(0x1d2)),0x1;}try{const _0x914aab=_0x33cc6c[_0x3dc31e(0x1be)],_0xb2236f=_0x33cc6c[_0x3dc31e(0x197)],_0x69496e=_0x33cc6c[_0x3dc31e(0x1af)],_0x32034f=_0x33cc6c[_0x3dc31e(0x1a3)];_0x33cc6c[_0x3dc31e(0x19a)]&&(console['error']('Target:\x20'+(_0x1bfde4?_0x3dc31e(0x1f3):_0x3dc31e(0x1ae))+'\x20'+_0x419812),_0x914aab&&console[_0x3dc31e(0x1cb)](_0x3dc31e(0x1a8)+_0x914aab),_0xb2236f&&console[_0x3dc31e(0x1cb)](_0x3dc31e(0x1ac)+_0xb2236f),_0x69496e&&console[_0x3dc31e(0x1cb)](_0x3dc31e(0x1c8)+_0x69496e),_0x32034f&&console[_0x3dc31e(0x1cb)](_0x3dc31e(0x1fe)));let _0x1beeb7;if(_0x69496e)try{if(_0x69496e['startsWith']('@')){const _0x158e1d=await import('fs/promises'),_0x560ddb=_0x69496e[_0x3dc31e(0x1b7)](0x1),_0x3afd26=await _0x158e1d['readFile'](_0x560ddb,'utf-8');_0x1beeb7=JSON[_0x3dc31e(0x1fb)](_0x3afd26);}else _0x1beeb7=JSON[_0x3dc31e(0x1fb)](_0x69496e);}catch{return console['error']('Error:\x20Invalid\x20JSON\x20in\x20--params'),0x1;}if(!_0x33cc6c[_0x3dc31e(0x19d)]){const _0x5cfd95=await confirm('Are\x20you\x20sure\x20you\x20want\x20to\x20retry\x20'+(_0x1bfde4?_0x3dc31e(0x1f3):_0x3dc31e(0x1ae))+'\x20'+_0x419812+'?');if(!_0x5cfd95)return console[_0x3dc31e(0x1cb)](_0x3dc31e(0x1f2)),0x0;}let _0x525010;_0x1bfde4?_0x525010=await withSpinner(_0x3dc31e(0x198),()=>_0x3c7c98[_0x3dc31e(0x1ff)][_0x3dc31e(0x1c1)](_0x419812,{'fromTask':_0x914aab,'retryParams':_0x1beeb7}),{'verbose':_0x33cc6c['verbose']}):_0x525010=await withSpinner(_0x3dc31e(0x1e9),()=>_0x3c7c98['workflow']['retryAttempt'](_0x419812,{'resumeFrom':_0xb2236f,'retryParams':_0x1beeb7,'force':_0x32034f}),{'verbose':_0x33cc6c[_0x3dc31e(0x19a)]});const _0x1f83f6=_0x525010[_0x3dc31e(0x19e)];return console[_0x3dc31e(0x1cb)](_0x3dc31e(0x1ad)),console[_0x3dc31e(0x1cb)](_0x3dc31e(0x18f)+_0x1f83f6[_0x3dc31e(0x1ee)]),console[_0x3dc31e(0x1cb)](_0x3dc31e(0x20b)+_0x1f83f6[_0x3dc31e(0x1b6)]),0x0;}catch(_0x4a8034){if(_0x4a8034 instanceof SDKError)return console[_0x3dc31e(0x1cb)]('Error:\x20'+_0x4a8034[_0x3dc31e(0x1a1)]),_0x4a8034['cause']&&console['error'](_0x3dc31e(0x1d1)+_0x4a8034[_0x3dc31e(0x1f8)]),0x1;throw _0x4a8034;}}}export class WorkflowDownloadCommand extends BaseCommand{[a33_0x14a6de(0x209)]=a33_0x14a6de(0x190);[a33_0x14a6de(0x195)]='Download\x20workflow\x20project\x20from\x20Treasure\x20Data';async['execute'](_0x45dbf7){const _0x19d189=a33_0x14a6de,{options:_0x535b26,args:_0x1ed258,tdx:_0x26b6f5}=_0x45dbf7,_0x352b3a=_0x1ed258[0x0],_0x18b21b=_0x1ed258[0x1]||'.';if(!_0x352b3a)return console[_0x19d189(0x1cb)](_0x19d189(0x1db)),console[_0x19d189(0x1cb)](_0x19d189(0x1e0)),0x1;const _0x11fe96=_0x535b26['revision'];_0x535b26[_0x19d189(0x19a)]&&(console[_0x19d189(0x1cb)](_0x19d189(0x1c7)+_0x352b3a),console[_0x19d189(0x1cb)](_0x19d189(0x1a7)+_0x18b21b),_0x11fe96&&console[_0x19d189(0x1cb)](_0x19d189(0x201)+_0x11fe96));const _0x204652=await withSpinner(_0x19d189(0x1ea)+_0x352b3a+_0x19d189(0x207),()=>_0x26b6f5['workflow'][_0x19d189(0x1f5)](_0x352b3a,_0x18b21b,{'revision':_0x11fe96}),{'verbose':_0x535b26[_0x19d189(0x19a)]}),_0x3954a1=_0x204652[_0x19d189(0x19e)];return console[_0x19d189(0x1cb)]('✔\x20Downloaded\x20'+_0x3954a1[_0x19d189(0x1fc)]),console['error'](_0x19d189(0x1eb)+_0x3954a1[_0x19d189(0x1c9)]),console[_0x19d189(0x1cb)](_0x19d189(0x1d6)+_0x3954a1[_0x19d189(0x1c6)]),console['error'](_0x19d189(0x1bc)+_0x18b21b+'/'+_0x3954a1[_0x19d189(0x1fc)]),0x0;}}export class WorkflowPushCommand extends BaseCommand{[a33_0x14a6de(0x209)]=a33_0x14a6de(0x1cd);[a33_0x14a6de(0x195)]=a33_0x14a6de(0x192);async[a33_0x14a6de(0x20a)](_0x29581d){const _0x271b54=a33_0x14a6de,{options:_0x3e1aec,args:_0x2c6752,tdx:_0xb52983}=_0x29581d;let _0x986067='.',_0x3f1ac8=_0x3e1aec[_0x271b54(0x209)];if(_0x2c6752[0x0]){const {promises:_0x2062a7}=await import('fs');try{const _0x48567a=await _0x2062a7['stat'](_0x2c6752[0x0]);if(_0x48567a[_0x271b54(0x204)]())_0x986067=_0x2c6752[0x0];else return console['error']('Error:\x20'+_0x2c6752[0x0]+_0x271b54(0x1d9)),0x1;}catch{_0x3f1ac8=_0x2c6752[0x0],_0x986067='.';}}const _0x54be9d=_0x3e1aec[_0x271b54(0x1c9)],_0x5c74df=_0x3e1aec[_0x271b54(0x1a6)];_0x3e1aec[_0x271b54(0x19a)]&&(console[_0x271b54(0x1cb)](_0x271b54(0x1ca)+_0x986067),_0x3f1ac8&&console[_0x271b54(0x1cb)]('Project\x20name:\x20'+_0x3f1ac8),_0x54be9d&&console[_0x271b54(0x1cb)](_0x271b54(0x201)+_0x54be9d),_0x5c74df&&console['error']('Validation:\x20skipped'));const _0x3ae837=await withSpinner(_0x271b54(0x1b2),()=>_0xb52983[_0x271b54(0x1ff)]['push'](_0x986067,{'projectName':_0x3f1ac8,'revision':_0x54be9d,'skipValidation':_0x5c74df}),{'verbose':_0x3e1aec['verbose']}),_0x1e1374=_0x3ae837[_0x271b54(0x19e)];return console[_0x271b54(0x1cb)]('✔\x20Pushed\x20'+_0x1e1374[_0x271b54(0x1fc)]),console[_0x271b54(0x1cb)](_0x271b54(0x1f4)+_0x1e1374['projectId']),console[_0x271b54(0x1cb)](_0x271b54(0x1eb)+_0x1e1374[_0x271b54(0x1c9)]),0x0;}}export class WorkflowDeleteCommand extends BaseCommand{[a33_0x14a6de(0x209)]='workflow:delete';[a33_0x14a6de(0x195)]=a33_0x14a6de(0x1a9);async[a33_0x14a6de(0x20a)](_0xc47b8d){const _0xed5a1=a33_0x14a6de,{options:_0x14dac4,args:_0x4cc6f9,tdx:_0x139cce}=_0xc47b8d,_0x4d5b3c=_0x4cc6f9[0x0];if(!_0x4d5b3c)return console[_0xed5a1(0x1cb)](_0xed5a1(0x1de)),console[_0xed5a1(0x1cb)]('Usage:\x20workflow:delete\x20<project-name-or-id>'),0x1;_0x14dac4[_0xed5a1(0x19a)]&&console['error'](_0xed5a1(0x1c7)+_0x4d5b3c);if(!_0x14dac4[_0xed5a1(0x19d)]){const _0x41c333=await confirm(_0xed5a1(0x19c)+_0x4d5b3c+_0xed5a1(0x1c2));if(!_0x41c333)return console[_0xed5a1(0x1cb)]('Cancelled'),0x0;}const _0x55c609=await withSpinner('Deleting\x20project\x20'+_0x4d5b3c+_0xed5a1(0x207),()=>_0x139cce[_0xed5a1(0x1ff)][_0xed5a1(0x1c4)](_0x4d5b3c),{'verbose':_0x14dac4[_0xed5a1(0x19a)]}),_0x53b4c6=_0x55c609[_0xed5a1(0x19e)];return console[_0xed5a1(0x1cb)](_0xed5a1(0x1b4)+_0x53b4c6[_0xed5a1(0x1fc)]),console[_0xed5a1(0x1cb)](_0xed5a1(0x1f4)+_0x53b4c6['projectId']),0x0;}}
|
|
1
|
+
const a33_0x21671f=a33_0x4942;(function(_0x46fce9,_0x338ede){const _0x1b7e68=a33_0x4942,_0x221a9e=_0x46fce9();while(!![]){try{const _0x337788=-parseInt(_0x1b7e68(0x1a8))/0x1*(-parseInt(_0x1b7e68(0x217))/0x2)+-parseInt(_0x1b7e68(0x1ed))/0x3+parseInt(_0x1b7e68(0x1ea))/0x4*(parseInt(_0x1b7e68(0x1cf))/0x5)+-parseInt(_0x1b7e68(0x19f))/0x6+-parseInt(_0x1b7e68(0x1a6))/0x7+parseInt(_0x1b7e68(0x1a4))/0x8*(parseInt(_0x1b7e68(0x201))/0x9)+-parseInt(_0x1b7e68(0x1df))/0xa*(-parseInt(_0x1b7e68(0x1fa))/0xb);if(_0x337788===_0x338ede)break;else _0x221a9e['push'](_0x221a9e['shift']());}catch(_0x40487f){_0x221a9e['push'](_0x221a9e['shift']());}}}(a33_0x3af4,0xf024e));import{BaseCommand}from'./command.js';function a33_0x3af4(){const _0x720c0b=['\x20\x20Project\x20ID:\x20','\x20\x20Cause:\x20','8352858WNFEDR','workflow:sessions','sessions','attempts','\x20session','195256mEQxnH','Error:\x20Target\x20must\x20be\x20prefixed\x20with\x20\x22session:\x22\x20or\x20\x22attempt:\x22','6563249VpYLkV','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20project\x20\x22','21GfpXQl','workflow:push','...','workflow:delete','Error:\x20Project\x20name\x20or\x20ID\x20is\x20required','Filter:\x20project=','retryAttempt','params','Project\x20directory:\x20','projectId','startsWith','execute','workflow:attempts','Cancelled','Reason:\x20','yes','\x20attempt','Attempt\x20ID:\x20','Include\x20retried:\x20yes','Error:\x20Session\x20ID\x20or\x20attempt\x20ID\x20is\x20required','Including\x20subtasks:\x20yes','Retrying\x20attempt...','utf-8','parse','Error:\x20Project\x20name\x20is\x20required','status','From\x20task:\x20','\x20workflow','workflow:tasks','Push\x20workflow\x20project\x20to\x20Treasure\x20Data','Filter:\x20','Status:\x20','Error:\x20','\x20log\x20entr','limit','Resume\x20from:\x20','name','Output\x20directory:\x20','attempt','3055oLzPyj','Download\x20workflow\x20project\x20from\x20Treasure\x20Data','Revision:\x20','workflows','\x20\x20Files\x20extracted:\x20','✔\x20Found\x20','includeSubtasks','Pushing\x20workflow\x20project...','✔\x20Retry\x20started','length','workflow','\x20\x20New\x20attempt\x20ID:\x20','List\x20workflow\x20attempts','session','Getting\x20task\x20logs...','substring','22972910qNsmWg','logs','tasks','Error:\x20Invalid\x20pattern.\x20Use\x20format:\x20project\x20or\x20project.workflow','✔\x20Deleted\x20project\x20','projectName','isDirectory','session:','stat','error','resumeFrom','4484rLsxZG','workflow:retry','workflow:kill','2649768ltTpLS','\x20task','readFile','Getting\x20attempt\x20details...','verbose','✔\x20Downloaded\x20','attempt:','\x20\x20Location:\x20','Usage:\x20workflow:download\x20<project-name>\x20[output-dir]','Params:\x20','delete','Force:\x20yes','data','11xcPVFJ','retrySession','\x20\x20Session\x20ID:\x20','Are\x20you\x20sure\x20you\x20want\x20to\x20kill\x20attempt\x20','cause','split','workflow:download','9CceYsj','Usage:\x20workflow\x20retry\x20session:<id>\x20or\x20workflow\x20retry\x20attempt:<id>','Deleting\x20project\x20','Error:\x20Attempt\x20ID\x20is\x20required','Project:\x20','revision','force','Target:\x20','Are\x20you\x20sure\x20you\x20want\x20to\x20retry\x20','List\x20workflow\x20execution\x20sessions','\x20is\x20not\x20a\x20directory','from','download','message','workflow:projects','includeRetried','Usage:\x20workflow:delete\x20<project-name-or-id>','Task\x20name:\x20','description','List\x20all\x20workflow\x20projects','Delete\x20workflow\x20project\x20from\x20Treasure\x20Data','\x20\x20Revision:\x20','113334CkCkYY','offset'];a33_0x3af4=function(){return _0x720c0b;};return a33_0x3af4();}import{SDKError}from'../sdk/index.js';import{handleSDKOutput}from'../utils/command-output.js';import{withSpinner}from'../utils/spinner.js';import{confirm}from'../utils/prompt.js';export class WorkflowProjectsCommand extends BaseCommand{[a33_0x21671f(0x1cc)]=a33_0x21671f(0x20f);[a33_0x21671f(0x213)]=a33_0x21671f(0x214);async['execute'](_0x5afccd){const _0x9ed574=a33_0x21671f,{options:_0x3c1158,args:_0xe2bd20,tdx:_0x2bdac0}=_0x5afccd,_0x34ec8f=_0xe2bd20[0x0];try{_0x3c1158[_0x9ed574(0x1f1)]&&_0x34ec8f&&console['error']('Pattern:\x20'+_0x34ec8f);const _0x4059f9=await withSpinner('Listing\x20workflow\x20projects...',()=>_0x2bdac0[_0x9ed574(0x1d9)]['projects'](_0x34ec8f,{'limit':_0x3c1158[_0x9ed574(0x1ca)]}),{'verbose':_0x3c1158[_0x9ed574(0x1f1)]}),_0x9796fa=_0x4059f9[_0x9ed574(0x1f9)];return console[_0x9ed574(0x1e8)]('✔\x20Found\x20'+_0x9796fa[_0x9ed574(0x1d8)]+'\x20project'+(_0x9796fa['length']!==0x1?'s':'')),await handleSDKOutput(_0x9796fa,_0x3c1158),0x0;}catch(_0x2cf681){if(_0x2cf681 instanceof SDKError)return console['error']('Error:\x20'+_0x2cf681['message']),_0x2cf681[_0x9ed574(0x1fe)]&&console['error']('\x20\x20Cause:\x20'+_0x2cf681[_0x9ed574(0x1fe)]),0x1;throw _0x2cf681;}}}export class WorkflowWorkflowsCommand extends BaseCommand{[a33_0x21671f(0x1cc)]='workflow:workflows';[a33_0x21671f(0x213)]='List\x20workflows';async['execute'](_0x502775){const _0xea939a=a33_0x21671f,{options:_0x9495bf,args:_0x1e895d,tdx:_0x5b18fb}=_0x502775,_0x36221a=_0x1e895d[0x0];try{_0x9495bf[_0xea939a(0x1f1)]&&_0x36221a&&console['error']('Project\x20filter:\x20'+_0x36221a);const _0x40f991=await withSpinner('Listing\x20workflows...',()=>_0x5b18fb[_0xea939a(0x1d9)][_0xea939a(0x1d2)](_0x36221a,{'limit':_0x9495bf[_0xea939a(0x1ca)]}),{'verbose':_0x9495bf['verbose']}),_0x47f572=_0x40f991['data'];return console[_0xea939a(0x1e8)](_0xea939a(0x1d4)+_0x47f572['length']+_0xea939a(0x1c3)+(_0x47f572['length']!==0x1?'s':'')),await handleSDKOutput(_0x47f572,_0x9495bf),0x0;}catch(_0x3f4a98){if(_0x3f4a98 instanceof SDKError)return console[_0xea939a(0x1e8)](_0xea939a(0x1c8)+_0x3f4a98[_0xea939a(0x20e)]),_0x3f4a98[_0xea939a(0x1fe)]&&console['error'](_0xea939a(0x21a)+_0x3f4a98[_0xea939a(0x1fe)]),0x1;throw _0x3f4a98;}}}export class WorkflowSessionsCommand extends BaseCommand{[a33_0x21671f(0x1cc)]=a33_0x21671f(0x1a0);[a33_0x21671f(0x213)]=a33_0x21671f(0x20a);async[a33_0x21671f(0x1b3)](_0x20800c){const _0x596a26=a33_0x21671f,{options:_0x3bd32f,args:_0x5e722f,tdx:_0x30fb29}=_0x20800c;let _0x80181,_0x1b8510;if(_0x5e722f[0x0]){const _0x1fa543=_0x5e722f[0x0][_0x596a26(0x1ff)]('.');if(_0x1fa543['length']===0x1)_0x80181=_0x1fa543[0x0];else{if(_0x1fa543['length']===0x2)[_0x80181,_0x1b8510]=_0x1fa543;else return console[_0x596a26(0x1e8)](_0x596a26(0x1e2)),0x1;}}try{if(_0x3bd32f[_0x596a26(0x1f1)]){if(_0x80181&&_0x1b8510)console['error'](_0x596a26(0x1c6)+_0x80181+'.'+_0x1b8510);else _0x80181&&console['error'](_0x596a26(0x1ad)+_0x80181);const _0xaa8de=_0x3bd32f[_0x596a26(0x1c1)];_0xaa8de&&console[_0x596a26(0x1e8)](_0x596a26(0x1c7)+_0xaa8de);}const _0x3bfe4a=await withSpinner('Listing\x20workflow\x20sessions...',()=>_0x30fb29[_0x596a26(0x1d9)][_0x596a26(0x1a1)]({'projectName':_0x80181,'workflowName':_0x1b8510,'status':_0x3bd32f[_0x596a26(0x1c1)],'fromTime':_0x3bd32f[_0x596a26(0x20c)],'toTime':_0x3bd32f['to'],'limit':_0x3bd32f[_0x596a26(0x1ca)]}),{'verbose':_0x3bd32f['verbose']}),_0x48ba22=_0x3bfe4a[_0x596a26(0x1f9)];return console[_0x596a26(0x1e8)](_0x596a26(0x1d4)+_0x48ba22[_0x596a26(0x1d8)]+_0x596a26(0x1a3)+(_0x48ba22[_0x596a26(0x1d8)]!==0x1?'s':'')),await handleSDKOutput(_0x48ba22,_0x3bd32f),0x0;}catch(_0x4accb4){if(_0x4accb4 instanceof SDKError)return console['error'](_0x596a26(0x1c8)+_0x4accb4[_0x596a26(0x20e)]),_0x4accb4[_0x596a26(0x1fe)]&&console[_0x596a26(0x1e8)](_0x596a26(0x21a)+_0x4accb4[_0x596a26(0x1fe)]),0x1;throw _0x4accb4;}}}export class WorkflowAttemptsCommand extends BaseCommand{[a33_0x21671f(0x1cc)]=a33_0x21671f(0x1b4);[a33_0x21671f(0x213)]=a33_0x21671f(0x1db);async[a33_0x21671f(0x1b3)](_0x3d97e8){const _0x180dfd=a33_0x21671f,{options:_0x37896a,args:_0xd648b4,tdx:_0x15ebef}=_0x3d97e8;let _0x4adc72,_0x302d02;if(_0xd648b4[0x0]){const _0x4b2db0=_0xd648b4[0x0][_0x180dfd(0x1ff)]('.');if(_0x4b2db0[_0x180dfd(0x1d8)]===0x1)_0x4adc72=_0x4b2db0[0x0];else{if(_0x4b2db0[_0x180dfd(0x1d8)]===0x2)[_0x4adc72,_0x302d02]=_0x4b2db0;else return console[_0x180dfd(0x1e8)](_0x180dfd(0x1e2)),0x1;}}try{const _0x3a63c7=_0x37896a[_0x180dfd(0x210)];if(_0x37896a[_0x180dfd(0x1f1)]){if(_0x4adc72&&_0x302d02)console[_0x180dfd(0x1e8)](_0x180dfd(0x1c6)+_0x4adc72+'.'+_0x302d02);else _0x4adc72&&console[_0x180dfd(0x1e8)](_0x180dfd(0x1ad)+_0x4adc72);_0x3a63c7&&console[_0x180dfd(0x1e8)](_0x180dfd(0x1ba));}const _0x3c291c=await withSpinner('Listing\x20workflow\x20attempts...',()=>_0x15ebef[_0x180dfd(0x1d9)][_0x180dfd(0x1a2)]({'projectName':_0x4adc72,'workflowName':_0x302d02,'includeRetried':_0x3a63c7,'limit':_0x37896a[_0x180dfd(0x1ca)]}),{'verbose':_0x37896a[_0x180dfd(0x1f1)]}),_0x480932=_0x3c291c[_0x180dfd(0x1f9)];return console[_0x180dfd(0x1e8)](_0x180dfd(0x1d4)+_0x480932[_0x180dfd(0x1d8)]+_0x180dfd(0x1b8)+(_0x480932[_0x180dfd(0x1d8)]!==0x1?'s':'')),await handleSDKOutput(_0x480932,_0x37896a),0x0;}catch(_0x24807b){if(_0x24807b instanceof SDKError)return console[_0x180dfd(0x1e8)](_0x180dfd(0x1c8)+_0x24807b[_0x180dfd(0x20e)]),_0x24807b['cause']&&console[_0x180dfd(0x1e8)](_0x180dfd(0x21a)+_0x24807b[_0x180dfd(0x1fe)]),0x1;throw _0x24807b;}}}export class WorkflowAttemptCommand extends BaseCommand{['name']='workflow:attempt';[a33_0x21671f(0x213)]='Show\x20specific\x20attempt\x20details';async['execute'](_0x574bb4){const _0xd5ed73=a33_0x21671f,{options:_0x1e22a3,args:_0x3bfaed,tdx:_0xd91528}=_0x574bb4,_0x48c9ef=_0x3bfaed[0x0];if(!_0x48c9ef)return console[_0xd5ed73(0x1e8)](_0xd5ed73(0x204)),0x1;try{_0x1e22a3[_0xd5ed73(0x1f1)]&&console[_0xd5ed73(0x1e8)](_0xd5ed73(0x1b9)+_0x48c9ef);const _0x14b8ba=await withSpinner(_0xd5ed73(0x1f0),()=>_0xd91528[_0xd5ed73(0x1d9)][_0xd5ed73(0x1ce)](_0x48c9ef),{'verbose':_0x1e22a3[_0xd5ed73(0x1f1)]}),_0x3da943=_0x14b8ba[_0xd5ed73(0x1f9)];return await handleSDKOutput([_0x3da943],_0x1e22a3),0x0;}catch(_0x3bbc70){if(_0x3bbc70 instanceof SDKError)return console[_0xd5ed73(0x1e8)](_0xd5ed73(0x1c8)+_0x3bbc70['message']),_0x3bbc70[_0xd5ed73(0x1fe)]&&console[_0xd5ed73(0x1e8)](_0xd5ed73(0x21a)+_0x3bbc70[_0xd5ed73(0x1fe)]),0x1;throw _0x3bbc70;}}}export class WorkflowTasksCommand extends BaseCommand{[a33_0x21671f(0x1cc)]=a33_0x21671f(0x1c4);[a33_0x21671f(0x213)]='Show\x20tasks\x20for\x20an\x20attempt';async[a33_0x21671f(0x1b3)](_0x39b892){const _0x973ff4=a33_0x21671f,{options:_0x49fe7e,args:_0x478b72,tdx:_0x15139d}=_0x39b892,_0xf7713a=_0x478b72[0x0];if(!_0xf7713a)return console[_0x973ff4(0x1e8)](_0x973ff4(0x204)),0x1;try{const _0x2ad9b7=_0x49fe7e[_0x973ff4(0x1d5)];_0x49fe7e[_0x973ff4(0x1f1)]&&(console[_0x973ff4(0x1e8)]('Attempt\x20ID:\x20'+_0xf7713a),_0x2ad9b7&&console[_0x973ff4(0x1e8)](_0x973ff4(0x1bc)));const _0x14655d=await withSpinner('Getting\x20attempt\x20tasks...',()=>_0x15139d[_0x973ff4(0x1d9)][_0x973ff4(0x1e1)](_0xf7713a,_0x2ad9b7||![]),{'verbose':_0x49fe7e[_0x973ff4(0x1f1)]}),_0x2ff576=_0x14655d[_0x973ff4(0x1f9)];return console[_0x973ff4(0x1e8)](_0x973ff4(0x1d4)+_0x2ff576[_0x973ff4(0x1d8)]+_0x973ff4(0x1ee)+(_0x2ff576['length']!==0x1?'s':'')),await handleSDKOutput(_0x2ff576,_0x49fe7e),0x0;}catch(_0x45050f){if(_0x45050f instanceof SDKError)return console[_0x973ff4(0x1e8)](_0x973ff4(0x1c8)+_0x45050f['message']),_0x45050f[_0x973ff4(0x1fe)]&&console['error'](_0x973ff4(0x21a)+_0x45050f['cause']),0x1;throw _0x45050f;}}}export class WorkflowLogsCommand extends BaseCommand{[a33_0x21671f(0x1cc)]='workflow:logs';['description']='Show\x20logs\x20for\x20a\x20specific\x20task';async[a33_0x21671f(0x1b3)](_0x1982e9){const _0x384c62=a33_0x21671f,{options:_0x38a8e3,args:_0x44af49,tdx:_0x567b8d}=_0x1982e9,_0x1bb46b=_0x44af49[0x0],_0x5ad315=_0x44af49[0x1];if(!_0x1bb46b||!_0x5ad315)return console[_0x384c62(0x1e8)]('Error:\x20Attempt\x20ID\x20and\x20task\x20name\x20are\x20required'),0x1;try{_0x38a8e3[_0x384c62(0x1f1)]&&(console['error'](_0x384c62(0x1b9)+_0x1bb46b),console[_0x384c62(0x1e8)](_0x384c62(0x212)+_0x5ad315));const _0x3de47a=_0x38a8e3[_0x384c62(0x218)],_0x386964=await withSpinner(_0x384c62(0x1dd),()=>_0x567b8d[_0x384c62(0x1d9)][_0x384c62(0x1e0)](_0x1bb46b,_0x5ad315,{'offset':_0x3de47a,'limit':_0x38a8e3['limit']}),{'verbose':_0x38a8e3[_0x384c62(0x1f1)]}),_0x235774=_0x386964['data'];return console[_0x384c62(0x1e8)](_0x384c62(0x1d4)+_0x235774[_0x384c62(0x1d8)]+_0x384c62(0x1c9)+(_0x235774[_0x384c62(0x1d8)]!==0x1?'ies':'y')),await handleSDKOutput(_0x235774,_0x38a8e3),0x0;}catch(_0x9d1138){if(_0x9d1138 instanceof SDKError)return console['error'](_0x384c62(0x1c8)+_0x9d1138[_0x384c62(0x20e)]),_0x9d1138['cause']&&console['error'](_0x384c62(0x21a)+_0x9d1138[_0x384c62(0x1fe)]),0x1;throw _0x9d1138;}}}export class WorkflowKillCommand extends BaseCommand{[a33_0x21671f(0x1cc)]=a33_0x21671f(0x1ec);['description']='Kill\x20a\x20running\x20attempt';async[a33_0x21671f(0x1b3)](_0x135c7a){const _0x4bc309=a33_0x21671f,{options:_0x3c0928,args:_0x5a368a,tdx:_0x33b6be}=_0x135c7a,_0x12b394=_0x5a368a[0x0];if(!_0x12b394)return console[_0x4bc309(0x1e8)](_0x4bc309(0x204)),0x1;try{const _0x22d1ef=_0x3c0928['reason'];_0x3c0928[_0x4bc309(0x1f1)]&&(console[_0x4bc309(0x1e8)](_0x4bc309(0x1b9)+_0x12b394),_0x22d1ef&&console[_0x4bc309(0x1e8)](_0x4bc309(0x1b6)+_0x22d1ef));if(!_0x3c0928[_0x4bc309(0x1b7)]){const _0x29e285=await confirm(_0x4bc309(0x1fd)+_0x12b394+'?');if(!_0x29e285)return console[_0x4bc309(0x1e8)](_0x4bc309(0x1b5)),0x0;}const _0x4965f6=await withSpinner('Killing\x20attempt...',()=>_0x33b6be[_0x4bc309(0x1d9)]['kill'](_0x12b394,_0x22d1ef),{'verbose':_0x3c0928[_0x4bc309(0x1f1)]}),_0x2c59ed=_0x4965f6[_0x4bc309(0x1f9)];return console[_0x4bc309(0x1e8)]('✔\x20'+_0x2c59ed),0x0;}catch(_0x1aa578){if(_0x1aa578 instanceof SDKError)return console[_0x4bc309(0x1e8)]('Error:\x20'+_0x1aa578[_0x4bc309(0x20e)]),_0x1aa578[_0x4bc309(0x1fe)]&&console[_0x4bc309(0x1e8)](_0x4bc309(0x21a)+_0x1aa578['cause']),0x1;throw _0x1aa578;}}}export class WorkflowRetryCommand extends BaseCommand{['name']=a33_0x21671f(0x1eb);[a33_0x21671f(0x213)]='Retry\x20a\x20session\x20or\x20attempt';async[a33_0x21671f(0x1b3)](_0x3b5e18){const _0x104b75=a33_0x21671f,{options:_0x562815,args:_0x270ce8,tdx:_0x1b75c3}=_0x3b5e18,_0x11058d=_0x270ce8[0x0];if(!_0x11058d)return console[_0x104b75(0x1e8)](_0x104b75(0x1bb)),console[_0x104b75(0x1e8)]('Usage:\x20workflow\x20retry\x20session:<id>\x20or\x20workflow\x20retry\x20attempt:<id>'),0x1;let _0x42782e=![],_0x467491=_0x11058d;if(_0x11058d[_0x104b75(0x1b2)](_0x104b75(0x1e6)))_0x42782e=!![],_0x467491=_0x11058d[_0x104b75(0x1de)](0x8);else{if(_0x11058d[_0x104b75(0x1b2)](_0x104b75(0x1f3)))_0x42782e=![],_0x467491=_0x11058d[_0x104b75(0x1de)](0x8);else return console[_0x104b75(0x1e8)](_0x104b75(0x1a5)),console['error'](_0x104b75(0x202)),0x1;}try{const _0xafe06e=_0x562815['fromTask'],_0x51f1ab=_0x562815[_0x104b75(0x1e9)],_0x172583=_0x562815[_0x104b75(0x1af)],_0x180f98=_0x562815[_0x104b75(0x207)];_0x562815[_0x104b75(0x1f1)]&&(console[_0x104b75(0x1e8)](_0x104b75(0x208)+(_0x42782e?_0x104b75(0x1dc):_0x104b75(0x1ce))+'\x20'+_0x467491),_0xafe06e&&console['error'](_0x104b75(0x1c2)+_0xafe06e),_0x51f1ab&&console[_0x104b75(0x1e8)](_0x104b75(0x1cb)+_0x51f1ab),_0x172583&&console[_0x104b75(0x1e8)](_0x104b75(0x1f6)+_0x172583),_0x180f98&&console[_0x104b75(0x1e8)](_0x104b75(0x1f8)));let _0x13f98f;if(_0x172583)try{if(_0x172583[_0x104b75(0x1b2)]('@')){const _0x4e44e0=await import('fs/promises'),_0x43ddb2=_0x172583[_0x104b75(0x1de)](0x1),_0x4f7a40=await _0x4e44e0[_0x104b75(0x1ef)](_0x43ddb2,_0x104b75(0x1be));_0x13f98f=JSON[_0x104b75(0x1bf)](_0x4f7a40);}else _0x13f98f=JSON[_0x104b75(0x1bf)](_0x172583);}catch{return console[_0x104b75(0x1e8)]('Error:\x20Invalid\x20JSON\x20in\x20--params'),0x1;}if(!_0x562815[_0x104b75(0x1b7)]){const _0x557c7f=await confirm(_0x104b75(0x209)+(_0x42782e?_0x104b75(0x1dc):'attempt')+'\x20'+_0x467491+'?');if(!_0x557c7f)return console['error'](_0x104b75(0x1b5)),0x0;}let _0x299aec;_0x42782e?_0x299aec=await withSpinner('Retrying\x20session...',()=>_0x1b75c3[_0x104b75(0x1d9)][_0x104b75(0x1fb)](_0x467491,{'fromTask':_0xafe06e,'retryParams':_0x13f98f}),{'verbose':_0x562815[_0x104b75(0x1f1)]}):_0x299aec=await withSpinner(_0x104b75(0x1bd),()=>_0x1b75c3[_0x104b75(0x1d9)][_0x104b75(0x1ae)](_0x467491,{'resumeFrom':_0x51f1ab,'retryParams':_0x13f98f,'force':_0x180f98}),{'verbose':_0x562815[_0x104b75(0x1f1)]});const _0x186d3a=_0x299aec[_0x104b75(0x1f9)];return console[_0x104b75(0x1e8)](_0x104b75(0x1d7)),console[_0x104b75(0x1e8)](_0x104b75(0x1da)+_0x186d3a['attemptId']),console[_0x104b75(0x1e8)](_0x104b75(0x1fc)+_0x186d3a['sessionId']),0x0;}catch(_0x49c92f){if(_0x49c92f instanceof SDKError)return console[_0x104b75(0x1e8)](_0x104b75(0x1c8)+_0x49c92f['message']),_0x49c92f[_0x104b75(0x1fe)]&&console[_0x104b75(0x1e8)](_0x104b75(0x21a)+_0x49c92f[_0x104b75(0x1fe)]),0x1;throw _0x49c92f;}}}function a33_0x4942(_0x97ec9,_0x4fbf24){const _0x3af45b=a33_0x3af4();return a33_0x4942=function(_0x494213,_0x1395a4){_0x494213=_0x494213-0x19f;let _0x111e69=_0x3af45b[_0x494213];return _0x111e69;},a33_0x4942(_0x97ec9,_0x4fbf24);}export class WorkflowDownloadCommand extends BaseCommand{[a33_0x21671f(0x1cc)]=a33_0x21671f(0x200);[a33_0x21671f(0x213)]=a33_0x21671f(0x1d0);async[a33_0x21671f(0x1b3)](_0x4c4dd8){const _0x5d6c36=a33_0x21671f,{options:_0x2b580e,args:_0x3fe8a2,tdx:_0x532d83}=_0x4c4dd8,_0x4f5af0=_0x3fe8a2[0x0],_0x41fd61=_0x3fe8a2[0x1]||'.';if(!_0x4f5af0)return console[_0x5d6c36(0x1e8)](_0x5d6c36(0x1c0)),console[_0x5d6c36(0x1e8)](_0x5d6c36(0x1f5)),0x1;const _0x232fa9=_0x2b580e[_0x5d6c36(0x206)];_0x2b580e[_0x5d6c36(0x1f1)]&&(console[_0x5d6c36(0x1e8)](_0x5d6c36(0x205)+_0x4f5af0),console[_0x5d6c36(0x1e8)](_0x5d6c36(0x1cd)+_0x41fd61),_0x232fa9&&console[_0x5d6c36(0x1e8)](_0x5d6c36(0x1d1)+_0x232fa9));const _0x22b841=await withSpinner('Downloading\x20project\x20'+_0x4f5af0+'...',()=>_0x532d83[_0x5d6c36(0x1d9)][_0x5d6c36(0x20d)](_0x4f5af0,_0x41fd61,{'revision':_0x232fa9}),{'verbose':_0x2b580e[_0x5d6c36(0x1f1)]}),_0x4f3485=_0x22b841[_0x5d6c36(0x1f9)];return console[_0x5d6c36(0x1e8)](_0x5d6c36(0x1f2)+_0x4f3485[_0x5d6c36(0x1e4)]),console['error']('\x20\x20Revision:\x20'+_0x4f3485[_0x5d6c36(0x206)]),console[_0x5d6c36(0x1e8)](_0x5d6c36(0x1d3)+_0x4f3485['filesExtracted']),console[_0x5d6c36(0x1e8)](_0x5d6c36(0x1f4)+_0x41fd61+'/'+_0x4f3485[_0x5d6c36(0x1e4)]),0x0;}}export class WorkflowPushCommand extends BaseCommand{[a33_0x21671f(0x1cc)]=a33_0x21671f(0x1a9);['description']=a33_0x21671f(0x1c5);async['execute'](_0x4cce43){const _0x20d7a4=a33_0x21671f,{options:_0x1a2317,args:_0x3123a9,tdx:_0xe414b2}=_0x4cce43;let _0x384e03='.',_0x4e375a=_0x1a2317[_0x20d7a4(0x1cc)];if(_0x3123a9[0x0]){const {promises:_0x5184c3}=await import('fs');try{const _0x21f2c2=await _0x5184c3[_0x20d7a4(0x1e7)](_0x3123a9[0x0]);if(_0x21f2c2[_0x20d7a4(0x1e5)]())_0x384e03=_0x3123a9[0x0];else return console[_0x20d7a4(0x1e8)](_0x20d7a4(0x1c8)+_0x3123a9[0x0]+_0x20d7a4(0x20b)),0x1;}catch{_0x4e375a=_0x3123a9[0x0],_0x384e03='.';}}const _0x2fd4ad=_0x1a2317['revision'],_0x3c4c7e=_0x1a2317['skipValidation'];_0x1a2317[_0x20d7a4(0x1f1)]&&(console[_0x20d7a4(0x1e8)](_0x20d7a4(0x1b0)+_0x384e03),_0x4e375a&&console[_0x20d7a4(0x1e8)]('Project\x20name:\x20'+_0x4e375a),_0x2fd4ad&&console['error']('Revision:\x20'+_0x2fd4ad),_0x3c4c7e&&console[_0x20d7a4(0x1e8)]('Validation:\x20skipped'));const _0x3d9c23=await withSpinner(_0x20d7a4(0x1d6),()=>_0xe414b2[_0x20d7a4(0x1d9)]['push'](_0x384e03,{'projectName':_0x4e375a,'revision':_0x2fd4ad,'skipValidation':_0x3c4c7e}),{'verbose':_0x1a2317['verbose']}),_0x514b68=_0x3d9c23[_0x20d7a4(0x1f9)];return console[_0x20d7a4(0x1e8)]('✔\x20Pushed\x20'+_0x514b68['projectName']),console[_0x20d7a4(0x1e8)](_0x20d7a4(0x219)+_0x514b68[_0x20d7a4(0x1b1)]),console[_0x20d7a4(0x1e8)](_0x20d7a4(0x216)+_0x514b68['revision']),0x0;}}export class WorkflowDeleteCommand extends BaseCommand{[a33_0x21671f(0x1cc)]=a33_0x21671f(0x1ab);['description']=a33_0x21671f(0x215);async[a33_0x21671f(0x1b3)](_0x43402a){const _0xf2b8a5=a33_0x21671f,{options:_0x207485,args:_0x21d801,tdx:_0x28ac1c}=_0x43402a,_0x384888=_0x21d801[0x0];if(!_0x384888)return console[_0xf2b8a5(0x1e8)](_0xf2b8a5(0x1ac)),console['error'](_0xf2b8a5(0x211)),0x1;_0x207485[_0xf2b8a5(0x1f1)]&&console[_0xf2b8a5(0x1e8)](_0xf2b8a5(0x205)+_0x384888);if(!_0x207485[_0xf2b8a5(0x1b7)]){const _0x39ada0=await confirm(_0xf2b8a5(0x1a7)+_0x384888+'\x22?\x20This\x20cannot\x20be\x20undone.');if(!_0x39ada0)return console[_0xf2b8a5(0x1e8)](_0xf2b8a5(0x1b5)),0x0;}const _0x41d3d7=await withSpinner(_0xf2b8a5(0x203)+_0x384888+_0xf2b8a5(0x1aa),()=>_0x28ac1c[_0xf2b8a5(0x1d9)][_0xf2b8a5(0x1f7)](_0x384888),{'verbose':_0x207485[_0xf2b8a5(0x1f1)]}),_0x237a13=_0x41d3d7[_0xf2b8a5(0x1f9)];return console[_0xf2b8a5(0x1e8)](_0xf2b8a5(0x1e3)+_0x237a13['projectName']),console[_0xf2b8a5(0x1e8)](_0xf2b8a5(0x219)+_0x237a13[_0xf2b8a5(0x1b1)]),0x0;}}
|
package/dist/core/auth.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x10ac93,_0xfcbf1d){const _0x410461=a34_0xf4de,_0x39de15=_0x10ac93();while(!![]){try{const _0x544560=-parseInt(_0x410461(0x10b))/0x1*(parseInt(_0x410461(0x10f))/0x2)+-parseInt(_0x410461(0x117))/0x3+parseInt(_0x410461(0x108))/0x4*(parseInt(_0x410461(0x113))/0x5)+parseInt(_0x410461(0x10d))/0x6*(-parseInt(_0x410461(0x115))/0x7)+parseInt(_0x410461(0x106))/0x8+-parseInt(_0x410461(0x112))/0x9*(-parseInt(_0x410461(0x10c))/0xa)+-parseInt(_0x410461(0x104))/0xb*(-parseInt(_0x410461(0x114))/0xc);if(_0x544560===_0xfcbf1d)break;else _0x39de15['push'](_0x39de15['shift']());}catch(_0x169c5d){_0x39de15['push'](_0x39de15['shift']());}}}(a34_0x42c6,0x40ebb));import{platform}from'os';import{readFileSync}from'fs';import{fileURLToPath}from'url';import{dirname,join}from'path';function a34_0xf4de(_0x1b72e1,_0x4166d9){const _0x42c6f7=a34_0x42c6();return a34_0xf4de=function(_0xf4dec3,_0x5ac2b1){_0xf4dec3=_0xf4dec3-0x102;let _0x5289ce=_0x42c6f7[_0xf4dec3];return _0x5289ce;},a34_0xf4de(_0x1b72e1,_0x4166d9);}import{getAPIKey}from'./config.js';export function getVersion(){const _0x480fc2=a34_0xf4de;try{const _0x25f6c5=fileURLToPath(import.meta[_0x480fc2(0x10a)]),_0x401dd7=dirname(_0x25f6c5),_0x51dfae=join(_0x401dd7,_0x480fc2(0x107)),_0x515fad=JSON[_0x480fc2(0x109)](readFileSync(_0x51dfae,'utf-8'));return _0x515fad[_0x480fc2(0x103)];}catch{return'0.0.0';}}function a34_0x42c6(){const _0x4d564f=['5465eNyNUs','1700zugFtn','673278BgBlkH',';\x20node/','178KJCAGH','Authorization','tdx','18009TtPItp','563215qBsYuj','72OJkXhE','21WKwraN','X-Trino-User','1336155Wscjxp','entries','replace','version','1672660bBfZYl','TD1\x20','1353208wDgyxB','../../package.json','4lNzBpx','parse','url'];a34_0x42c6=function(){return _0x4d564f;};return a34_0x42c6();}export function getUserAgent(){const _0x418cf4=a34_0xf4de,_0x460a6f=getVersion(),_0x92ffac=platform(),_0x38990a=process[_0x418cf4(0x103)][_0x418cf4(0x102)]('v','');return'tdx/'+_0x460a6f+'\x20('+_0x92ffac+_0x418cf4(0x10e)+_0x38990a+')';}export function getAuthHeaders(_0x3e090a,_0x343db8){const _0x471671=a34_0xf4de,_0x2a55a4=getVersion(),_0x368d31={'User-Agent':getUserAgent(),'X-TD-Client':_0x471671(0x111),'X-TD-Client-Version':_0x2a55a4};return _0x343db8&&(_0x368d31[_0x471671(0x110)]=_0x471671(0x105)+_0x343db8),_0x368d31;}export function toHeaderRecord(_0x399e9c){const _0x4262db=a34_0xf4de,_0x3b91bd={};for(const [_0x3972a2,_0x23a7f6]of Object[_0x4262db(0x118)](_0x399e9c)){_0x23a7f6!==undefined&&(_0x3b91bd[_0x3972a2]=_0x23a7f6);}return _0x3b91bd;}export function getTrinoHeaders(_0x58c45e,_0x49d48a){const _0x8c2ce5=a34_0xf4de,_0xa7b05c=getAuthHeaders(_0x58c45e,_0x49d48a),_0x3f69c0=toHeaderRecord(_0xa7b05c);return delete _0x3f69c0[_0x8c2ce5(0x110)],_0x49d48a&&(_0x3f69c0[_0x8c2ce5(0x116)]=_0x49d48a),_0x3f69c0;}export function hasAPIKey(_0x205301){const _0x5c49e6=getAPIKey(_0x205301);return _0x5c49e6!==undefined&&_0x5c49e6['length']>0x0;}
|
package/dist/core/config.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0xcb8f99,_0x398e2b){const _0x31e815=a35_0x69e1,_0x218b96=_0xcb8f99();while(!![]){try{const _0x3c7841=parseInt(_0x31e815(0x8f))/0x1*(parseInt(_0x31e815(0x76))/0x2)+parseInt(_0x31e815(0x97))/0x3+parseInt(_0x31e815(0x77))/0x4+-parseInt(_0x31e815(0x73))/0x5+-parseInt(_0x31e815(0x7b))/0x6+-parseInt(_0x31e815(0x95))/0x7+-parseInt(_0x31e815(0x88))/0x8*(-parseInt(_0x31e815(0x6f))/0x9);if(_0x3c7841===_0x398e2b)break;else _0x218b96['push'](_0x218b96['shift']());}catch(_0x4df41c){_0x218b96['push'](_0x218b96['shift']());}}}(a35_0x4ddb,0x4822e));import{homedir}from'os';function a35_0x69e1(_0x484f90,_0x2947c5){const _0x4ddbb1=a35_0x4ddb();return a35_0x69e1=function(_0x69e134,_0x2f6999){_0x69e134=_0x69e134-0x6a;let _0x47b9be=_0x4ddbb1[_0x69e134];return _0x47b9be;},a35_0x69e1(_0x484f90,_0x2947c5);}import{join}from'path';import{existsSync,readFileSync,writeFileSync,mkdirSync}from'fs';import*as a35_0x39e11d from'node:fs';import*as a35_0x471eb0 from'node:path';import{SITE_ALIASES}from'../types/index.js';function a35_0x4ddb(){const _0x1ad96b=['stg-jp01','error','TDX_CONFIG_DIR','eu01','replace','856WDLtUe','parse','\x20(TD_API_KEY)','us01','jp01','warn','TD_API_KEY','93397yBaWKF','\x27,\x20defaulting\x20to\x20us01','match','utf-8','dev-us01','tdx.json','2655856IciEiA','dev-eu01','1107381PqVKGa','Warning:\x20Failed\x20to\x20read\x20config\x20file\x20','existsSync','split','join','global:\x20','includes','ap03','llm_default_project','trim','env','stg-us01','.cache','56664IqumVh','Warning:\x20Failed\x20to\x20read\x20','ap02','env:\x20TD_API_KEY','1695780KwFctD','TD_API_KEY_','slice','6nMvWbr','266220kRTyGn','endsWith','TDX_CACHE_DIR','profile:\x20','2253066BrcrlG','readFileSync','toUpperCase','Warning:\x20Failed\x20to\x20cache\x20LLM\x20project\x20name:','entries','.env.','startsWith','env:\x20'];a35_0x4ddb=function(){return _0x1ad96b;};return a35_0x4ddb();}import{validateSecureFilePermissions}from'../utils/file-permissions.js';export function getConfigDir(){const _0x512aee=a35_0x69e1;return process[_0x512aee(0x6c)][_0x512aee(0x85)]||join(homedir(),'.config','tdx');}export function getConfigFile(){return join(getConfigDir(),'.env');}export function getConfigFilePath(_0x4e061d){const _0x3b35d8=a35_0x69e1,_0x236d4d=getConfigDir();return _0x4e061d?a35_0x471eb0[_0x3b35d8(0x9b)](_0x236d4d,_0x3b35d8(0x80)+_0x4e061d):getConfigFile();}export function getCacheDir(){const _0x9beab0=a35_0x69e1;return process[_0x9beab0(0x6c)][_0x9beab0(0x79)]||join(homedir(),_0x9beab0(0x6e),'tdx');}export function getLLMProjectCacheFile(){const _0x26fb22=a35_0x69e1;return join(getCacheDir(),_0x26fb22(0x6a));}export function readCachedLLMProject(){const _0x1e1720=a35_0x69e1;try{const _0x1636aa=getLLMProjectCacheFile();if(!existsSync(_0x1636aa))return null;return readFileSync(_0x1636aa,_0x1e1720(0x92))['trim']();}catch{return null;}}export function writeCachedLLMProject(_0x269e1d){const _0x4b6b9e=a35_0x69e1;try{const _0x23999e=getCacheDir(),_0x24ed60=getLLMProjectCacheFile();!existsSync(_0x23999e)&&mkdirSync(_0x23999e,{'recursive':!![]}),writeFileSync(_0x24ed60,_0x269e1d,_0x4b6b9e(0x92));}catch(_0x1d5983){console[_0x4b6b9e(0x84)](_0x4b6b9e(0x7e),_0x1d5983);}}export function parseEnvFile(_0x2721d5){const _0x54c5d7=a35_0x69e1,_0x46f4d1={};for(const _0x46d2b1 of _0x2721d5[_0x54c5d7(0x9a)]('\x0a')){const _0x16a832=_0x46d2b1['trim']();if(!_0x16a832||_0x16a832['startsWith']('#'))continue;const _0x129660=_0x16a832[_0x54c5d7(0x91)](/^([^=]+)=(.*)$/);if(_0x129660){const _0x536aec=_0x129660[0x1][_0x54c5d7(0x6b)]();let _0x3423a0=_0x129660[0x2][_0x54c5d7(0x6b)]();(_0x3423a0[_0x54c5d7(0x81)]('\x22')&&_0x3423a0['endsWith']('\x22')||_0x3423a0[_0x54c5d7(0x81)]('\x27')&&_0x3423a0[_0x54c5d7(0x78)]('\x27'))&&(_0x3423a0=_0x3423a0[_0x54c5d7(0x75)](0x1,-0x1)),_0x46f4d1[_0x536aec]=_0x3423a0;}}return _0x46f4d1;}export function readUserConfig(){const _0x335655=a35_0x69e1,_0x272206=getConfigFile();if(!existsSync(_0x272206))return{};try{const _0x216219=readFileSync(_0x272206,_0x335655(0x92));return parseEnvFile(_0x216219);}catch(_0x3577f4){return console[_0x335655(0x8d)](_0x335655(0x98)+_0x272206+':',_0x3577f4),{};}}export function resolveSite(_0x21defa){const _0x3fdd05=a35_0x69e1,_0x5e78e1=[_0x3fdd05(0x8b),'jp01',_0x3fdd05(0x86),_0x3fdd05(0x71),'ap03','dev-us01','dev-eu01',_0x3fdd05(0x6d),'stg-jp01','stg-ap03'];if(_0x5e78e1[_0x3fdd05(0x9d)](_0x21defa))return _0x21defa;if(_0x21defa in SITE_ALIASES)return SITE_ALIASES[_0x21defa];return console[_0x3fdd05(0x8d)]('Warning:\x20Unknown\x20site\x20\x27'+_0x21defa+_0x3fdd05(0x90)),_0x3fdd05(0x8b);}let cachedUserConfig=null;export function loadUserConfigOnce(){return cachedUserConfig===null&&(cachedUserConfig=readUserConfig()),cachedUserConfig;}export function clearConfigCache(){cachedUserConfig=null;}export function getAPIKey(_0x2112aa,_0x355c95){const _0x3d2825=a35_0x69e1,_0xc9dfa3=_0x2112aa['toUpperCase']()['replace'](/-/g,'_'),_0x49c919=_0x3d2825(0x74)+_0xc9dfa3;if(process[_0x3d2825(0x6c)][_0x49c919])return process[_0x3d2825(0x6c)][_0x49c919];if(process[_0x3d2825(0x6c)][_0x3d2825(0x8e)])return process[_0x3d2825(0x6c)][_0x3d2825(0x8e)];const _0x28fb69=_0x355c95||getActiveProfileName();if(_0x28fb69){const _0x2f5eb6=loadProfileEnv(_0x28fb69);if(_0x2f5eb6){if(_0x2f5eb6[_0x49c919])return _0x2f5eb6[_0x49c919];if(_0x2f5eb6['TD_API_KEY'])return _0x2f5eb6[_0x3d2825(0x8e)];}}const _0x122f80=loadUserConfigOnce();if(_0x122f80[_0x49c919])return _0x122f80[_0x49c919];if(_0x122f80[_0x3d2825(0x8e)])return _0x122f80[_0x3d2825(0x8e)];return undefined;}export function getAPIKeySource(_0x52a029,_0x21ba94){const _0x35cefc=a35_0x69e1,_0x2ca210='TD_API_KEY_'+_0x52a029[_0x35cefc(0x7d)]()[_0x35cefc(0x87)](/-/g,'_');if(process[_0x35cefc(0x6c)][_0x2ca210])return _0x35cefc(0x82)+_0x2ca210;if(process[_0x35cefc(0x6c)][_0x35cefc(0x8e)])return _0x35cefc(0x72);const _0x1d372e=_0x21ba94||getActiveProfileName();if(_0x1d372e){const _0x14650d=loadProfileEnv(_0x1d372e);if(_0x14650d){if(_0x14650d[_0x2ca210])return _0x35cefc(0x7a)+_0x1d372e+'\x20('+_0x2ca210+')';if(_0x14650d[_0x35cefc(0x8e)])return'profile:\x20'+_0x1d372e+_0x35cefc(0x8a);}}const _0x423815=loadUserConfigOnce(),_0x21631a=getConfigFile();if(_0x423815[_0x2ca210])return _0x35cefc(0x9c)+_0x21631a+'\x20('+_0x2ca210+')';if(_0x423815['TD_API_KEY'])return _0x35cefc(0x9c)+_0x21631a+_0x35cefc(0x8a);return null;}function loadProfileEnv(_0x17d773){const _0x504482=a35_0x69e1,_0x571efb=a35_0x471eb0[_0x504482(0x9b)](getConfigDir(),_0x504482(0x80)+_0x17d773);if(a35_0x39e11d['existsSync'](_0x571efb)){validateSecureFilePermissions(_0x571efb);try{const _0x52c5df=a35_0x39e11d[_0x504482(0x7c)](_0x571efb,_0x504482(0x92));return parseEnvFile(_0x52c5df);}catch(_0x46ea4a){console[_0x504482(0x8d)]('Warning:\x20Failed\x20to\x20load\x20'+_0x571efb+':\x20'+_0x46ea4a);}}const _0x149618=a35_0x471eb0[_0x504482(0x9b)](getConfigDir(),'profiles',_0x17d773,'.env');if(a35_0x39e11d[_0x504482(0x99)](_0x149618)){validateSecureFilePermissions(_0x149618);try{const _0x2a7e04=a35_0x39e11d[_0x504482(0x7c)](_0x149618,_0x504482(0x92));return parseEnvFile(_0x2a7e04);}catch(_0x362709){return console[_0x504482(0x8d)]('Warning:\x20Failed\x20to\x20load\x20'+_0x149618+':\x20'+_0x362709),null;}}return null;}function getActiveProfileName(){const _0x3e74f8=a35_0x69e1,_0x5bfb98=a35_0x471eb0['join'](getConfigDir(),_0x3e74f8(0x94));if(!a35_0x39e11d['existsSync'](_0x5bfb98))return null;try{const _0x599dd3=a35_0x39e11d[_0x3e74f8(0x7c)](_0x5bfb98,_0x3e74f8(0x92)),_0x15792f=JSON[_0x3e74f8(0x89)](_0x599dd3);return _0x15792f['profile']||null;}catch{return null;}}export function saveAPIKey(_0xfb15e9,_0x4fb373,_0x432b47){const _0x421995=a35_0x69e1,_0xd31b3b=getConfigDir(),_0x38acea=getConfigFilePath(_0x432b47);!existsSync(_0xd31b3b)&&mkdirSync(_0xd31b3b,{'recursive':!![],'mode':0x1c0});let _0x5a0952={};if(existsSync(_0x38acea))try{const _0x365f5a=readFileSync(_0x38acea,_0x421995(0x92));_0x5a0952=parseEnvFile(_0x365f5a);}catch(_0x4f21ea){console[_0x421995(0x8d)](_0x421995(0x70)+_0x38acea+':',_0x4f21ea);}const _0xdf7545=_0xfb15e9[_0x421995(0x7d)]()[_0x421995(0x87)](/-/g,'_');_0x5a0952[_0x421995(0x74)+_0xdf7545]=_0x4fb373;const _0x34441b=Object[_0x421995(0x7f)](_0x5a0952)['map'](([_0x52b7ef,_0x116807])=>_0x52b7ef+'='+_0x116807);writeFileSync(_0x38acea,_0x34441b['join']('\x0a')+'\x0a',{'mode':0x180});}export function loadConfig(){const _0x461aa1=a35_0x69e1,_0x20c6f7={'apiKeys':{},'defaultSite':_0x461aa1(0x8b)},_0x526de8=['us01',_0x461aa1(0x8c),_0x461aa1(0x86),_0x461aa1(0x71),_0x461aa1(0x9e),_0x461aa1(0x93),_0x461aa1(0x96),'stg-us01',_0x461aa1(0x83),'stg-ap03'];for(const _0x561c7c of _0x526de8){const _0x57b4bd=getAPIKey(_0x561c7c);_0x57b4bd&&(_0x20c6f7['apiKeys'][_0x561c7c]=_0x57b4bd);}return _0x20c6f7;}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
function a36_0x29c3(_0x4d4438,_0x3dc25b){const _0x546b31=a36_0x546b();return a36_0x29c3=function(_0x29c3b4,_0x5399fd){_0x29c3b4=_0x29c3b4-0x13b;let _0x1feb6e=_0x546b31[_0x29c3b4];return _0x1feb6e;},a36_0x29c3(_0x4d4438,_0x3dc25b);}const a36_0x36f428=a36_0x29c3;function a36_0x546b(){const _0x3169de=['loadGlobalConfig','toString','parse','entries','10AjZtRV','layers','log','11839000BNAOlK','.env','1200382VVnwvU','us01','readFileSync','sessionId','activeProfile','getSource','default','injectIntoOptions','[context]','Global\x20Credentials','segment_path','.json','Global','utf-8','Profile','display','profiles','parent_segment','(active)','apiKey','profileCredentials','displayWithSources','llm_project','config','Profile\x20Credentials','existsSync','419203BNOODp','not\x20set','configFiles','replace','9XfKnGb','2560080dXxvPe','tdx.json','Project','database','parentSegment','project','segmentPath','global','\x0a[configuration\x20files]','logLevel','7515858QYirSH','4192434MYevgl','join','(session:\x20','verbose','CLI\x20flag:\x20--','cliFlags','llmProject','session','globalCredentials','site','Session','getParameters','profile','559704PUeBRR',':\x20none\x20(using\x20session:\x20'];a36_0x546b=function(){return _0x3169de;};return a36_0x546b();}(function(_0x1c907c,_0x256072){const _0x28ef7d=a36_0x29c3,_0x3f6d8b=_0x1c907c();while(!![]){try{const _0x15d2d4=parseInt(_0x28ef7d(0x152))/0x1+parseInt(_0x28ef7d(0x17a))/0x2+-parseInt(_0x28ef7d(0x157))/0x3+-parseInt(_0x28ef7d(0x16f))/0x4*(-parseInt(_0x28ef7d(0x175))/0x5)+parseInt(_0x28ef7d(0x162))/0x6+parseInt(_0x28ef7d(0x161))/0x7+-parseInt(_0x28ef7d(0x178))/0x8*(parseInt(_0x28ef7d(0x156))/0x9);if(_0x15d2d4===_0x256072)break;else _0x3f6d8b['push'](_0x3f6d8b['shift']());}catch(_0x400e73){_0x3f6d8b['push'](_0x3f6d8b['shift']());}}}(a36_0x546b,0xb448c));import{resolveSite,getAPIKey,getConfigDir}from'./config.js';import{loadSessionContext,getCurrentSessionPID}from'./session.js';import{loadProjectConfig,findProjectConfigPath}from'./project-config.js';import{getActiveProfile,loadProfile}from'./profile.js';import{LogLevel}from'../utils/tdx-logger.js';import*as a36_0x57f00e from'node:fs';import*as a36_0x4c06c8 from'node:path';export class GlobalContext{[a36_0x36f428(0x16b)];[a36_0x36f428(0x15a)];[a36_0x36f428(0x149)];['segment_path'];[a36_0x36f428(0x14e)];[a36_0x36f428(0x14b)];[a36_0x36f428(0x165)];['logLevel'];[a36_0x36f428(0x176)];[a36_0x36f428(0x13c)];[a36_0x36f428(0x13b)];['configFiles'];constructor(_0x1466cd){const _0x152144=a36_0x36f428;this['sessionId']=_0x1466cd[_0x152144(0x169)]||getCurrentSessionPID()[_0x152144(0x172)]();const _0x173fb0=loadSessionContext(_0x1466cd[_0x152144(0x169)]),_0x2c865c=loadProjectConfig(),_0x6c9474=this['loadGlobalConfig']();this[_0x152144(0x13c)]=_0x1466cd[_0x152144(0x16e)]||_0x173fb0?.[_0x152144(0x16e)]||_0x6c9474[_0x152144(0x16e)]||getActiveProfile();const _0x38994f=this[_0x152144(0x13c)]?loadProfile(this['activeProfile']):null,_0x43417b=_0xb6c466=>{const _0x38123f=_0x152144;if(!_0xb6c466)return{};const _0x11ae71=_0xb6c466,_0xfe0534={};for(const [_0x5af77a,_0x369a88]of Object[_0x38123f(0x174)](_0x11ae71)){typeof _0x369a88==='string'&&(_0xfe0534[_0x5af77a]=_0x369a88);}return _0xfe0534;},_0x24aad5={};if(_0x1466cd[_0x152144(0x16b)]&&_0x1466cd[_0x152144(0x16b)]!==_0x152144(0x17b))_0x24aad5[_0x152144(0x16b)]=_0x1466cd[_0x152144(0x16b)];const _0x5294c6=_0x173fb0?.[_0x152144(0x15a)],_0x2ebece=_0x2c865c?.[_0x152144(0x15a)],_0x39937c=_0x38994f?.[_0x152144(0x14f)]?.['database'],_0x28ce12=_0x6c9474['database'];_0x1466cd[_0x152144(0x15a)]&&(_0x1466cd[_0x152144(0x15a)]!==_0x5294c6&&_0x1466cd[_0x152144(0x15a)]!==_0x2ebece&&_0x1466cd[_0x152144(0x15a)]!==_0x39937c&&_0x1466cd['database']!==_0x28ce12)&&(_0x24aad5[_0x152144(0x15a)]=_0x1466cd[_0x152144(0x15a)]);if(_0x1466cd[_0x152144(0x15b)])_0x24aad5['parent_segment']=_0x1466cd['parentSegment'];if(_0x1466cd[_0x152144(0x168)])_0x24aad5[_0x152144(0x14e)]=_0x1466cd[_0x152144(0x168)];if(_0x1466cd[_0x152144(0x16e)])_0x24aad5['profile']=_0x1466cd['profile'];this[_0x152144(0x176)]={'cliFlags':_0x24aad5,'session':_0x43417b(_0x173fb0),'project':_0x43417b(_0x2c865c),'profile':_0x43417b(_0x38994f?.[_0x152144(0x14f)]),'global':_0x43417b(_0x6c9474)};const _0x181f79={...this['layers'][_0x152144(0x15e)],...this[_0x152144(0x176)][_0x152144(0x16e)],...this[_0x152144(0x176)][_0x152144(0x15c)],...this[_0x152144(0x176)]['session'],...this['layers'][_0x152144(0x167)]},_0x55db09=_0x181f79[_0x152144(0x16b)]||_0x152144(0x17b);this[_0x152144(0x16b)]=resolveSite(_0x55db09),this['database']=_0x181f79['database'],this[_0x152144(0x149)]=_0x181f79[_0x152144(0x149)],this[_0x152144(0x142)]=_0x181f79[_0x152144(0x142)],this[_0x152144(0x14e)]=_0x181f79['llm_project'],this['verbose']=_0x1466cd[_0x152144(0x165)]||![],this[_0x152144(0x160)]=_0x1466cd[_0x152144(0x160)]??LogLevel['INFO'],this[_0x152144(0x14b)]=getAPIKey(this[_0x152144(0x16b)],this[_0x152144(0x13c)]||undefined);const _0x43f2e0=getConfigDir(),_0x512bcd=a36_0x4c06c8[_0x152144(0x163)](_0x43f2e0,'sessions',this[_0x152144(0x13b)]+_0x152144(0x143)),_0x235a47=findProjectConfigPath(),_0x138790=a36_0x4c06c8[_0x152144(0x163)](_0x43f2e0,_0x152144(0x158)),_0x5d02f6=a36_0x4c06c8[_0x152144(0x163)](_0x43f2e0,_0x152144(0x179));let _0x266a9f=null,_0x43adaf=null;this['activeProfile']&&(_0x266a9f=a36_0x4c06c8[_0x152144(0x163)](_0x43f2e0,_0x152144(0x148),this['activeProfile'],_0x152144(0x158)),_0x43adaf=a36_0x4c06c8['join'](_0x43f2e0,_0x152144(0x148),this[_0x152144(0x13c)],_0x152144(0x179))),this['configFiles']={'session':a36_0x57f00e[_0x152144(0x151)](_0x512bcd)?_0x512bcd:null,'project':_0x235a47,'profile':_0x266a9f&&a36_0x57f00e[_0x152144(0x151)](_0x266a9f)?_0x266a9f:null,'profileCredentials':_0x43adaf&&a36_0x57f00e[_0x152144(0x151)](_0x43adaf)?_0x43adaf:null,'global':a36_0x57f00e[_0x152144(0x151)](_0x138790)?_0x138790:null,'globalCredentials':a36_0x57f00e[_0x152144(0x151)](_0x5d02f6)?_0x5d02f6:null};}[a36_0x36f428(0x13d)](_0x570a6e,_0x22f466){const _0x49103e=a36_0x36f428;if(!_0x22f466)return _0x49103e(0x153);const _0x35a2fc=_0x22f466;if(this[_0x49103e(0x176)]['cliFlags'][_0x570a6e]===_0x35a2fc){if(_0x570a6e===_0x49103e(0x16b)&&_0x35a2fc===_0x49103e(0x17b)&&!this['layers'][_0x49103e(0x169)][_0x49103e(0x16b)]&&!this[_0x49103e(0x176)][_0x49103e(0x15c)]['site']&&!this[_0x49103e(0x176)]['profile'][_0x49103e(0x16b)]&&!this[_0x49103e(0x176)]['global'][_0x49103e(0x16b)])return _0x49103e(0x13e);return _0x49103e(0x166)+_0x570a6e[_0x49103e(0x155)](/_/g,'-');}if(this[_0x49103e(0x176)][_0x49103e(0x169)][_0x570a6e]===_0x35a2fc)return _0x49103e(0x169);if(this[_0x49103e(0x176)][_0x49103e(0x15c)][_0x570a6e]===_0x35a2fc)return _0x49103e(0x15c);if(this[_0x49103e(0x176)]['profile'][_0x570a6e]===_0x35a2fc)return'profile:\x20'+this['activeProfile'];if(this['layers'][_0x49103e(0x15e)][_0x570a6e]===_0x35a2fc)return _0x49103e(0x15e);return'default';}[a36_0x36f428(0x171)](){const _0x392d20=a36_0x36f428,_0x5451ed=a36_0x4c06c8[_0x392d20(0x163)](getConfigDir(),_0x392d20(0x158));if(!a36_0x57f00e[_0x392d20(0x151)](_0x5451ed))return{};try{const _0x2ca69a=a36_0x57f00e[_0x392d20(0x17c)](_0x5451ed,_0x392d20(0x145));return JSON[_0x392d20(0x173)](_0x2ca69a);}catch{return{};}}[a36_0x36f428(0x13f)](_0x3f1753){const _0x2e6227=a36_0x36f428;_0x3f1753['site']=this[_0x2e6227(0x16b)],!_0x3f1753[_0x2e6227(0x15a)]&&this[_0x2e6227(0x15a)]&&(_0x3f1753[_0x2e6227(0x15a)]=this[_0x2e6227(0x15a)]),!_0x3f1753['parentSegment']&&this['parent_segment']&&(_0x3f1753[_0x2e6227(0x15b)]=this[_0x2e6227(0x149)]),!_0x3f1753[_0x2e6227(0x15d)]&&this[_0x2e6227(0x142)]&&(_0x3f1753['segmentPath']=this[_0x2e6227(0x142)]),!_0x3f1753['llmProject']&&this['llm_project']&&(_0x3f1753['llmProject']=this[_0x2e6227(0x14e)]);}[a36_0x36f428(0x16d)](){const _0x2d5720=a36_0x36f428;return[{'key':_0x2d5720(0x16b),'value':this[_0x2d5720(0x16b)]},{'key':_0x2d5720(0x15a),'value':this[_0x2d5720(0x15a)]},{'key':'parent_segment','value':this['parent_segment']},{'key':_0x2d5720(0x142),'value':this[_0x2d5720(0x142)]},{'key':'llm_project','value':this[_0x2d5720(0x14e)]},{'key':_0x2d5720(0x16e),'value':this[_0x2d5720(0x13c)]||undefined}];}[a36_0x36f428(0x147)](){const _0x543f22=a36_0x36f428;console[_0x543f22(0x177)]('[context]');for(const {key:_0x47efe1,value:_0x29d3db}of this['getParameters']()){_0x29d3db&&console[_0x543f22(0x177)](_0x47efe1+':\x20'+_0x29d3db);}}[a36_0x36f428(0x14d)](){const _0x27e5f7=a36_0x36f428;console['log'](_0x27e5f7(0x140));for(const {key:_0x49ace3,value:_0x173b9b}of this[_0x27e5f7(0x16d)]()){if(_0x173b9b){const _0x3906c6=_0x49ace3===_0x27e5f7(0x16e)?_0x27e5f7(0x14a):'('+this[_0x27e5f7(0x13d)](_0x49ace3,_0x173b9b)+')';console[_0x27e5f7(0x177)](_0x49ace3+':\x20'+_0x173b9b+'\x20'+_0x3906c6);}}console[_0x27e5f7(0x177)](_0x27e5f7(0x15f));const _0x1b3eda=[{'label':_0x27e5f7(0x16c),'path':this[_0x27e5f7(0x154)]['session'],'extra':_0x27e5f7(0x164)+this[_0x27e5f7(0x13b)]+')'},{'label':_0x27e5f7(0x159),'path':this[_0x27e5f7(0x154)]['project']},{'label':_0x27e5f7(0x146),'path':this[_0x27e5f7(0x154)]['profile']},{'label':_0x27e5f7(0x150),'path':this[_0x27e5f7(0x154)][_0x27e5f7(0x14c)]},{'label':_0x27e5f7(0x144),'path':this[_0x27e5f7(0x154)][_0x27e5f7(0x15e)]},{'label':_0x27e5f7(0x141),'path':this['configFiles'][_0x27e5f7(0x16a)]}];for(const {label:_0x29439e,path:_0x4c04fb,extra:_0xa82ee0}of _0x1b3eda){if(_0x4c04fb)console[_0x27e5f7(0x177)](_0x29439e+':\x20'+_0x4c04fb+'\x20✓'+(_0xa82ee0?'\x20'+_0xa82ee0:''));else{if(_0x29439e===_0x27e5f7(0x16c))console[_0x27e5f7(0x177)](_0x29439e+_0x27e5f7(0x170)+this[_0x27e5f7(0x13b)]+')');else(_0x29439e===_0x27e5f7(0x159)||_0x29439e===_0x27e5f7(0x144))&&console[_0x27e5f7(0x177)](_0x29439e+':\x20none');}}}}
|
package/dist/core/profile.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(_0x99e804,_0x4256b9){const _0x1d1868=a37_0x3aff,_0x5d1eac=_0x99e804();while(!![]){try{const _0x59f7bd=parseInt(_0x1d1868(0x1cf))/0x1*(parseInt(_0x1d1868(0x1ba))/0x2)+-parseInt(_0x1d1868(0x1d3))/0x3+parseInt(_0x1d1868(0x1b1))/0x4+-parseInt(_0x1d1868(0x1ad))/0x5+-parseInt(_0x1d1868(0x1ee))/0x6+parseInt(_0x1d1868(0x1e6))/0x7*(parseInt(_0x1d1868(0x1e5))/0x8)+parseInt(_0x1d1868(0x1ac))/0x9;if(_0x59f7bd===_0x4256b9)break;else _0x5d1eac['push'](_0x5d1eac['shift']());}catch(_0x4b7996){_0x5d1eac['push'](_0x5d1eac['shift']());}}}(a37_0x59af,0x61138));function a37_0x59af(){const _0xb8222f=['625444IXLWgb','has','rmSync','push','map','tdx.json','\x27:\x20unknown\x20config\x20key\x20\x27','profiles','readFileSync','toISOString','\x20\x201.\x20Edit:\x20','values','Error:\x20','user','llm_project','llm_agent','parent_segment','utf-8','stringify','\x0aWarning:\x20Using\x20deprecated\x20credential\x20location\x20for\x20profile\x20\x27','existsSync','1ncmkiP','test','Warning:\x20Profile\x20\x27','\x27:\x20\x27llm_agent\x27\x20must\x20be\x20a\x20string','490845SSrOKD','\x20\x20mv\x20\x22','readdirSync','\x22\x20\x22','warn','entries','\x27:\x20\x27description\x27\x20must\x20be\x20a\x20string','\x27:\x20\x27parent_segment\x27\x20must\x20be\x20a\x20string','Please\x20migrate\x20to\x20~/.config/tdx/tdx.json:','Invalid\x20profile\x20name:\x20','.env','parse','\x27:\x20\x27database\x27\x20must\x20be\x20a\x20string','Profile\x20\x27','string','description','message','name','24kOaaxg','1450848ALTbPA','from','filter','\x27:\x20\x27site\x27\x20must\x20be\x20a\x20string','\x0aWarning:\x20Profiles\x20in\x20directories\x20are\x20deprecated:\x20','Profile\x20','\x20does\x20not\x20exist','length','2287500HfNQqS','some','\x20\x202.\x20Add\x20profiles\x20under\x20a\x20\x22profiles\x22\x20key\x20(see\x20\x27tdx\x20profiles\x27\x20for\x20current\x20config)','keys','2209779vtgmnL','2791295ynFbDZ','sort','\x0aWarning:\x20Failed\x20to\x20parse\x20','set','1282812lCLiaD','object','.env.','database','isDirectory','.\x20Must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore.','site','join','localeCompare'];a37_0x59af=function(){return _0xb8222f;};return a37_0x59af();}import*as a37_0x1c0357 from'node:fs';import*as a37_0x4c44c0 from'node:path';import{getConfigDir}from'./config.js';import{createSecureDirectory,writeSecureFile}from'../utils/file-permissions.js';import{findProjectConfigPath}from'./project-config.js';export function getProfileParams(_0x5e3b28){const _0x1fc2d9=a37_0x3aff,_0x2f652d={};if(!_0x5e3b28)return _0x2f652d;for(const [_0x37e5fd,_0x4c486c]of Object[_0x1fc2d9(0x1d8)](_0x5e3b28)){_0x37e5fd!=='description'&&_0x4c486c!==undefined&&(_0x2f652d[_0x37e5fd]=_0x4c486c);}return _0x2f652d;}export function getProfilesDir(){const _0x24a02c=a37_0x3aff;return a37_0x4c44c0[_0x24a02c(0x1b8)](getConfigDir(),_0x24a02c(0x1c1));}function getProfileDir(_0x56f92f){return a37_0x4c44c0['join'](getProfilesDir(),_0x56f92f);}function getProfileConfigPath(_0x2ff91d){const _0x4d2a2a=a37_0x3aff;return a37_0x4c44c0[_0x4d2a2a(0x1b8)](getProfileDir(_0x2ff91d),_0x4d2a2a(0x1bf));}function getProfileEnvPath(_0x5d2dbf){const _0x447e1b=a37_0x3aff;return a37_0x4c44c0[_0x447e1b(0x1b8)](getProfileDir(_0x5d2dbf),_0x447e1b(0x1dd));}function getGlobalConfigPath(){const _0x50286e=a37_0x3aff;return a37_0x4c44c0[_0x50286e(0x1b8)](getConfigDir(),_0x50286e(0x1bf));}function validateProfileName(_0x3ce852){const _0x3e6bfd=a37_0x3aff;if(!/^[a-zA-Z0-9_-]+$/[_0x3e6bfd(0x1d0)](_0x3ce852))throw new Error(_0x3e6bfd(0x1dc)+_0x3ce852+_0x3e6bfd(0x1b6));}function validateProfileConfig(_0x85d73a,_0x148c98){const _0x243d88=a37_0x3aff;if(typeof _0x85d73a!==_0x243d88(0x1b2)||_0x85d73a===null)throw new Error(_0x243d88(0x1e0)+_0x148c98+'\x27:\x20config\x20must\x20be\x20an\x20object');const _0x4b8487=[_0x243d88(0x1e2),'site',_0x243d88(0x1b4),_0x243d88(0x1ca),_0x243d88(0x1c8),_0x243d88(0x1c9)],_0x319335=_0x85d73a;for(const _0x4766b5 of Object[_0x243d88(0x1ab)](_0x319335)){!_0x4b8487['includes'](_0x4766b5)&&console[_0x243d88(0x1d7)](_0x243d88(0x1d1)+_0x148c98+_0x243d88(0x1c0)+_0x4766b5+'\x27\x20will\x20be\x20ignored');}if(_0x319335['description']!==undefined&&typeof _0x319335['description']!==_0x243d88(0x1e1))throw new Error(_0x243d88(0x1e0)+_0x148c98+_0x243d88(0x1d9));if(_0x319335[_0x243d88(0x1b7)]!==undefined&&typeof _0x319335[_0x243d88(0x1b7)]!=='string')throw new Error(_0x243d88(0x1e0)+_0x148c98+_0x243d88(0x1e9));if(_0x319335['database']!==undefined&&typeof _0x319335[_0x243d88(0x1b4)]!==_0x243d88(0x1e1))throw new Error('Profile\x20\x27'+_0x148c98+_0x243d88(0x1df));if(_0x319335[_0x243d88(0x1ca)]!==undefined&&typeof _0x319335[_0x243d88(0x1ca)]!=='string')throw new Error(_0x243d88(0x1e0)+_0x148c98+_0x243d88(0x1da));if(_0x319335['llm_project']!==undefined&&typeof _0x319335['llm_project']!=='string')throw new Error(_0x243d88(0x1e0)+_0x148c98+'\x27:\x20\x27llm_project\x27\x20must\x20be\x20a\x20string');if(_0x319335['llm_agent']!==undefined&&typeof _0x319335[_0x243d88(0x1c9)]!==_0x243d88(0x1e1))throw new Error(_0x243d88(0x1e0)+_0x148c98+_0x243d88(0x1d2));return!![];}function loadProfilesFromTdxJson(_0x570be4,_0x15a4ac){const _0x478a1e=a37_0x3aff;if(!a37_0x1c0357[_0x478a1e(0x1ce)](_0x570be4))return[];try{const _0x4c3401=a37_0x1c0357[_0x478a1e(0x1c2)](_0x570be4,_0x478a1e(0x1cb)),_0x3c1cf6=JSON[_0x478a1e(0x1de)](_0x4c3401);if(!_0x3c1cf6['profiles']||typeof _0x3c1cf6['profiles']!==_0x478a1e(0x1b2))return[];const _0x432843=[];for(const [_0x44c5f4,_0x35eef7]of Object[_0x478a1e(0x1d8)](_0x3c1cf6[_0x478a1e(0x1c1)])){try{validateProfileConfig(_0x35eef7,_0x44c5f4);const _0x5e4dcf=getNewCredentialPath(_0x44c5f4),_0x32788c=getOldCredentialPath(_0x44c5f4),_0x30bab7=a37_0x1c0357[_0x478a1e(0x1ce)](_0x5e4dcf)||a37_0x1c0357['existsSync'](_0x32788c);_0x432843[_0x478a1e(0x1bd)]({'name':_0x44c5f4,'config':_0x35eef7,'metadata':{'name':_0x44c5f4,'createdAt':new Date()[_0x478a1e(0x1c3)]()},'hasCredentials':_0x30bab7,'scope':_0x15a4ac});}catch(_0x3c9f1d){_0x3c9f1d instanceof Error&&(console[_0x478a1e(0x1d7)]('\x0aWarning:\x20Skipping\x20invalid\x20profile\x20in\x20'+_0x570be4+':'),console['warn']('\x20\x20'+_0x3c9f1d[_0x478a1e(0x1e3)]+'\x0a'));}}return _0x432843;}catch(_0x1110e5){return _0x1110e5 instanceof SyntaxError?(console['warn'](_0x478a1e(0x1af)+_0x570be4+':\x20Invalid\x20JSON\x20syntax'),console[_0x478a1e(0x1d7)](_0x478a1e(0x1c6)+_0x1110e5[_0x478a1e(0x1e3)]+'\x0a')):console[_0x478a1e(0x1d7)]('\x0aWarning:\x20Failed\x20to\x20load\x20profiles\x20from\x20'+_0x570be4+':\x20'+_0x1110e5+'\x0a'),[];}}export function getNewCredentialPath(_0x325548){const _0x5ef572=a37_0x3aff;return a37_0x4c44c0[_0x5ef572(0x1b8)](getConfigDir(),_0x5ef572(0x1b3)+_0x325548);}function getOldCredentialPath(_0x538187){const _0x5cf887=a37_0x3aff;return a37_0x4c44c0[_0x5cf887(0x1b8)](getProfilesDir(),_0x538187,_0x5cf887(0x1dd));}function loadProfilesFromTdxJsonFiles(){const _0x2d40f1=a37_0x3aff,_0x239b03=[],_0x57f898=findProjectConfigPath();_0x57f898&&_0x239b03['push'](...loadProfilesFromTdxJson(_0x57f898,'local'));const _0x5ececc=a37_0x4c44c0[_0x2d40f1(0x1b8)](getConfigDir(),'tdx.json');return _0x239b03[_0x2d40f1(0x1bd)](...loadProfilesFromTdxJson(_0x5ececc,_0x2d40f1(0x1c7))),_0x239b03;}function loadProfilesFromDirectories(){const _0x3d3a00=a37_0x3aff,_0x46b8a6=getProfilesDir();if(!a37_0x1c0357[_0x3d3a00(0x1ce)](_0x46b8a6))return[];try{return a37_0x1c0357[_0x3d3a00(0x1d5)](_0x46b8a6,{'withFileTypes':!![]})['filter'](_0x26be3a=>_0x26be3a[_0x3d3a00(0x1b5)]())['map'](_0x363d8d=>_0x363d8d[_0x3d3a00(0x1e4)])[_0x3d3a00(0x1e8)](_0x16ce70=>{const _0x1b2bcc=_0x3d3a00,_0x3f6532=getProfileConfigPath(_0x16ce70),_0x951368=getProfileEnvPath(_0x16ce70);return a37_0x1c0357['existsSync'](_0x3f6532)||a37_0x1c0357[_0x1b2bcc(0x1ce)](_0x951368);})[_0x3d3a00(0x1be)](_0x522931=>{const _0x54b3cc=loadProfileFromDirectory(_0x522931);if(_0x54b3cc)return{..._0x54b3cc,'scope':'directory'};return null;})['filter'](_0x1536fa=>_0x1536fa!==null);}catch{return[];}}function loadProfileFromDirectory(_0x49c88f){const _0x4496ef=a37_0x3aff,_0x2a7040=getProfileConfigPath(_0x49c88f),_0x567df3=getOldCredentialPath(_0x49c88f);if(!a37_0x1c0357[_0x4496ef(0x1ce)](_0x2a7040)&&!a37_0x1c0357[_0x4496ef(0x1ce)](_0x567df3))return null;let _0x15b926={},_0xe097c={'name':_0x49c88f,'createdAt':new Date()['toISOString']()};if(a37_0x1c0357[_0x4496ef(0x1ce)](_0x2a7040))try{const _0x349037=a37_0x1c0357[_0x4496ef(0x1c2)](_0x2a7040,_0x4496ef(0x1cb)),_0x48c11c=JSON[_0x4496ef(0x1de)](_0x349037),{metadata:_0x4e4588,..._0x59a852}=_0x48c11c;_0x15b926=_0x59a852,_0x4e4588&&(_0xe097c=_0x4e4588);}catch{}return{'name':_0x49c88f,'config':_0x15b926,'metadata':_0xe097c,'hasCredentials':a37_0x1c0357[_0x4496ef(0x1ce)](_0x567df3),'scope':'directory'};}export function listProfiles(){const _0x254255=a37_0x3aff,_0x2104b9=loadProfilesFromTdxJsonFiles(),_0x2dbe3a=loadProfilesFromDirectories();if(_0x2dbe3a[_0x254255(0x1ed)]>0x0){const _0x445d44=_0x2dbe3a[_0x254255(0x1be)](_0xb87ab5=>_0xb87ab5[_0x254255(0x1e4)])['join'](',\x20'),_0x5b7281=getConfigDir();console[_0x254255(0x1d7)](_0x254255(0x1ea)+_0x445d44),console['warn'](_0x254255(0x1db)),console[_0x254255(0x1d7)](_0x254255(0x1c4)+a37_0x4c44c0[_0x254255(0x1b8)](_0x5b7281,_0x254255(0x1bf))),console[_0x254255(0x1d7)](_0x254255(0x1f0)),console[_0x254255(0x1d7)]('\x20\x203.\x20Move\x20credentials:\x20mv\x20~/.config/tdx/profiles/<name>/.env\x20~/.config/tdx/.env.<name>\x0a');}const _0x297105=[..._0x2104b9,..._0x2dbe3a],_0x224dfe=new Map();for(const _0x48cd2a of _0x297105){!_0x224dfe[_0x254255(0x1bb)](_0x48cd2a[_0x254255(0x1e4)])&&_0x224dfe[_0x254255(0x1b0)](_0x48cd2a['name'],_0x48cd2a);}return Array[_0x254255(0x1e7)](_0x224dfe[_0x254255(0x1c5)]())[_0x254255(0x1ae)]((_0x2edd99,_0x423e6e)=>_0x2edd99[_0x254255(0x1e4)][_0x254255(0x1b9)](_0x423e6e[_0x254255(0x1e4)]));}export function profileExists(_0x2de8df){const _0x62e885=a37_0x3aff,_0x190ccd=listProfiles();return _0x190ccd[_0x62e885(0x1ef)](_0x6de4e7=>_0x6de4e7[_0x62e885(0x1e4)]===_0x2de8df);}export function loadProfile(_0x22a694){const _0x583de1=a37_0x3aff;validateProfileName(_0x22a694);const _0x3b1c56=listProfiles(),_0x4248f7=_0x3b1c56['find'](_0x2ade1c=>_0x2ade1c[_0x583de1(0x1e4)]===_0x22a694);return _0x4248f7||null;}export function saveProfile(_0x251c63,_0xf7122d,_0x5e0551=![]){saveProfileToUserConfig(_0x251c63,_0xf7122d);}export function deleteProfile(_0x481193){const _0x21d426=a37_0x3aff;validateProfileName(_0x481193);const _0x4f48b8=getProfileDir(_0x481193);if(!a37_0x1c0357[_0x21d426(0x1ce)](_0x4f48b8))throw new Error(_0x21d426(0x1eb)+_0x481193+_0x21d426(0x1ec));a37_0x1c0357[_0x21d426(0x1bc)](_0x4f48b8,{'recursive':!![],'force':!![]});}function a37_0x3aff(_0x50b7b7,_0x47ffd0){const _0x59af30=a37_0x59af();return a37_0x3aff=function(_0x3affb3,_0x16a7d4){_0x3affb3=_0x3affb3-0x1ab;let _0x352151=_0x59af30[_0x3affb3];return _0x352151;},a37_0x3aff(_0x50b7b7,_0x47ffd0);}export function saveProfileToUserConfig(_0x34fe96,_0x1f0115){const _0x25bbb8=a37_0x3aff;validateProfileName(_0x34fe96);const _0x31bb5b=getGlobalConfigPath(),_0x1f3d57=getConfigDir();!a37_0x1c0357['existsSync'](_0x1f3d57)&&createSecureDirectory(_0x1f3d57);let _0x165950={};if(a37_0x1c0357['existsSync'](_0x31bb5b))try{const _0x160f2e=a37_0x1c0357[_0x25bbb8(0x1c2)](_0x31bb5b,_0x25bbb8(0x1cb));_0x165950=JSON[_0x25bbb8(0x1de)](_0x160f2e);}catch{console[_0x25bbb8(0x1d7)]('Warning:\x20Failed\x20to\x20parse\x20'+_0x31bb5b+',\x20creating\x20new\x20file');}!_0x165950[_0x25bbb8(0x1c1)]&&(_0x165950['profiles']={}),_0x165950[_0x25bbb8(0x1c1)][_0x34fe96]=_0x1f0115,writeSecureFile(_0x31bb5b,JSON[_0x25bbb8(0x1cc)](_0x165950,null,0x2));}export function getActiveProfile(){const _0x456f96=a37_0x3aff,_0x59479c=getGlobalConfigPath();if(!a37_0x1c0357[_0x456f96(0x1ce)](_0x59479c))return null;try{const _0x45cf9d=a37_0x1c0357['readFileSync'](_0x59479c,_0x456f96(0x1cb)),_0x1d55c3=JSON[_0x456f96(0x1de)](_0x45cf9d);return _0x1d55c3['profile']||null;}catch{return null;}}export function createProfile(_0x46844a,_0x26cd81){const _0x230769=a37_0x3aff;validateProfileName(_0x46844a);if(profileExists(_0x46844a))throw new Error(_0x230769(0x1eb)+_0x46844a+'\x20already\x20exists');saveProfile(_0x46844a,_0x26cd81);}export function saveProfileCredentials(_0x9a885e,_0xdbde48){const _0x114969=a37_0x3aff;validateProfileName(_0x9a885e);if(!profileExists(_0x9a885e))throw new Error(_0x114969(0x1eb)+_0x9a885e+_0x114969(0x1ec));const _0x160d17=getNewCredentialPath(_0x9a885e);writeSecureFile(_0x160d17,_0xdbde48);}export function loadProfileCredentials(_0x3dc822){const _0xfe7c2b=a37_0x3aff;validateProfileName(_0x3dc822);const _0x582e43=getNewCredentialPath(_0x3dc822);if(a37_0x1c0357[_0xfe7c2b(0x1ce)](_0x582e43))try{return a37_0x1c0357[_0xfe7c2b(0x1c2)](_0x582e43,_0xfe7c2b(0x1cb));}catch{}const _0x4a714c=getOldCredentialPath(_0x3dc822);if(a37_0x1c0357['existsSync'](_0x4a714c)){console[_0xfe7c2b(0x1d7)](_0xfe7c2b(0x1cd)+_0x3dc822+'\x27'),console[_0xfe7c2b(0x1d7)]('To\x20migrate:'),console[_0xfe7c2b(0x1d7)](_0xfe7c2b(0x1d4)+_0x4a714c+_0xfe7c2b(0x1d6)+_0x582e43+'\x22'),console[_0xfe7c2b(0x1d7)]('Then\x20define\x20profiles\x20in\x20~/.config/tdx/tdx.json\x0a');try{return a37_0x1c0357['readFileSync'](_0x4a714c,'utf-8');}catch{return null;}}return null;}
|
|
1
|
+
(function(_0x38e6cf,_0x344c34){const _0x5e3acf=a37_0x5b97,_0xed1f80=_0x38e6cf();while(!![]){try{const _0x3b19e4=-parseInt(_0x5e3acf(0x1bd))/0x1*(parseInt(_0x5e3acf(0x1aa))/0x2)+-parseInt(_0x5e3acf(0x1a8))/0x3*(-parseInt(_0x5e3acf(0x1c9))/0x4)+-parseInt(_0x5e3acf(0x1b8))/0x5*(parseInt(_0x5e3acf(0x198))/0x6)+-parseInt(_0x5e3acf(0x1ae))/0x7+parseInt(_0x5e3acf(0x19e))/0x8*(-parseInt(_0x5e3acf(0x1b2))/0x9)+-parseInt(_0x5e3acf(0x1d3))/0xa+parseInt(_0x5e3acf(0x196))/0xb;if(_0x3b19e4===_0x344c34)break;else _0xed1f80['push'](_0xed1f80['shift']());}catch(_0x3c8a72){_0xed1f80['push'](_0xed1f80['shift']());}}}(a37_0x2161,0x909fe));import*as a37_0x246589 from'node:fs';import*as a37_0x3063f9 from'node:path';import{getConfigDir}from'./config.js';import{createSecureDirectory,writeSecureFile}from'../utils/file-permissions.js';import{findProjectConfigPath}from'./project-config.js';export function getProfileParams(_0x44262d){const _0x44e78b={};if(!_0x44262d)return _0x44e78b;for(const [_0x440185,_0x348cea]of Object['entries'](_0x44262d)){_0x440185!=='description'&&_0x348cea!==undefined&&(_0x44e78b[_0x440185]=_0x348cea);}return _0x44e78b;}export function getProfilesDir(){const _0x346976=a37_0x5b97;return a37_0x3063f9[_0x346976(0x1c7)](getConfigDir(),_0x346976(0x18b));}function getProfileDir(_0x1bfd47){const _0x545aee=a37_0x5b97;return a37_0x3063f9[_0x545aee(0x1c7)](getProfilesDir(),_0x1bfd47);}function getProfileConfigPath(_0x494e71){const _0x206040=a37_0x5b97;return a37_0x3063f9['join'](getProfileDir(_0x494e71),_0x206040(0x1ab));}function getProfileEnvPath(_0x4220b7){const _0x46e13d=a37_0x5b97;return a37_0x3063f9[_0x46e13d(0x1c7)](getProfileDir(_0x4220b7),_0x46e13d(0x1a1));}function getGlobalConfigPath(){const _0x57a407=a37_0x5b97;return a37_0x3063f9[_0x57a407(0x1c7)](getConfigDir(),_0x57a407(0x1ab));}function validateProfileName(_0x28ec9c){const _0x487b23=a37_0x5b97;if(!/^[a-zA-Z0-9_-]+$/[_0x487b23(0x1c8)](_0x28ec9c))throw new Error(_0x487b23(0x1a5)+_0x28ec9c+_0x487b23(0x1b9));}function validateProfileConfig(_0x3a553c,_0x55c092){const _0x13c007=a37_0x5b97;if(typeof _0x3a553c!==_0x13c007(0x1b4)||_0x3a553c===null)throw new Error(_0x13c007(0x1d7)+_0x55c092+_0x13c007(0x18d));const _0x487ab3=[_0x13c007(0x1c4),_0x13c007(0x1d1),'database',_0x13c007(0x1ca),_0x13c007(0x1bf),_0x13c007(0x1a6)],_0xd8c465=_0x3a553c;for(const _0x23348a of Object[_0x13c007(0x199)](_0xd8c465)){!_0x487ab3[_0x13c007(0x1b7)](_0x23348a)&&console[_0x13c007(0x1d6)](_0x13c007(0x195)+_0x55c092+'\x27:\x20unknown\x20config\x20key\x20\x27'+_0x23348a+_0x13c007(0x18f));}if(_0xd8c465[_0x13c007(0x1c4)]!==undefined&&typeof _0xd8c465['description']!==_0x13c007(0x1ad))throw new Error(_0x13c007(0x1d7)+_0x55c092+_0x13c007(0x1d9));if(_0xd8c465['site']!==undefined&&typeof _0xd8c465[_0x13c007(0x1d1)]!==_0x13c007(0x1ad))throw new Error(_0x13c007(0x1d7)+_0x55c092+_0x13c007(0x1c2));if(_0xd8c465[_0x13c007(0x18e)]!==undefined&&typeof _0xd8c465[_0x13c007(0x18e)]!==_0x13c007(0x1ad))throw new Error(_0x13c007(0x1d7)+_0x55c092+_0x13c007(0x1c1));if(_0xd8c465[_0x13c007(0x1ca)]!==undefined&&typeof _0xd8c465[_0x13c007(0x1ca)]!=='string')throw new Error(_0x13c007(0x1d7)+_0x55c092+_0x13c007(0x19b));if(_0xd8c465[_0x13c007(0x1bf)]!==undefined&&typeof _0xd8c465[_0x13c007(0x1bf)]!==_0x13c007(0x1ad))throw new Error('Profile\x20\x27'+_0x55c092+_0x13c007(0x1b6));if(_0xd8c465[_0x13c007(0x1a6)]!==undefined&&typeof _0xd8c465[_0x13c007(0x1a6)]!==_0x13c007(0x1ad))throw new Error(_0x13c007(0x1d7)+_0x55c092+_0x13c007(0x192));return!![];}function loadProfilesFromTdxJson(_0x1b9ad0,_0xa26ddf){const _0x937473=a37_0x5b97;if(!a37_0x246589[_0x937473(0x19f)](_0x1b9ad0))return[];try{const _0x4e3679=a37_0x246589[_0x937473(0x193)](_0x1b9ad0,'utf-8'),_0x1c11f2=JSON[_0x937473(0x1cd)](_0x4e3679);if(!_0x1c11f2[_0x937473(0x18b)]||typeof _0x1c11f2[_0x937473(0x18b)]!==_0x937473(0x1b4))return[];const _0x31a205=[];for(const [_0x16cd57,_0x2bf36b]of Object[_0x937473(0x1be)](_0x1c11f2['profiles'])){try{validateProfileConfig(_0x2bf36b,_0x16cd57);const _0x6f64fe=getNewCredentialPath(_0x16cd57),_0x44ee51=getOldCredentialPath(_0x16cd57),_0x2b673f=a37_0x246589[_0x937473(0x19f)](_0x6f64fe)||a37_0x246589['existsSync'](_0x44ee51);_0x31a205['push']({'name':_0x16cd57,'config':_0x2bf36b,'metadata':{'name':_0x16cd57,'createdAt':new Date()['toISOString']()},'hasCredentials':_0x2b673f,'scope':_0xa26ddf});}catch(_0x161653){_0x161653 instanceof Error&&(console[_0x937473(0x1d6)](_0x937473(0x1ce)+_0x1b9ad0+':'),console[_0x937473(0x1d6)]('\x20\x20'+_0x161653[_0x937473(0x1d4)]+'\x0a'));}}return _0x31a205;}catch(_0x3cbf92){return _0x3cbf92 instanceof SyntaxError?(console[_0x937473(0x1d6)](_0x937473(0x1b3)+_0x1b9ad0+':\x20Invalid\x20JSON\x20syntax'),console[_0x937473(0x1d6)](_0x937473(0x19c)+_0x3cbf92[_0x937473(0x1d4)]+'\x0a')):console[_0x937473(0x1d6)](_0x937473(0x1b5)+_0x1b9ad0+':\x20'+_0x3cbf92+'\x0a'),[];}}export function getNewCredentialPath(_0x1237ab){const _0x4b11a4=a37_0x5b97;return a37_0x3063f9[_0x4b11a4(0x1c7)](getConfigDir(),_0x4b11a4(0x1d0)+_0x1237ab);}function getOldCredentialPath(_0x4d7c41){const _0xe2bae7=a37_0x5b97;return a37_0x3063f9[_0xe2bae7(0x1c7)](getProfilesDir(),_0x4d7c41,_0xe2bae7(0x1a1));}function loadProfilesFromTdxJsonFiles(){const _0x1b8852=a37_0x5b97,_0x206785=[],_0xdd59b7=findProjectConfigPath();_0xdd59b7&&_0x206785[_0x1b8852(0x1d5)](...loadProfilesFromTdxJson(_0xdd59b7,_0x1b8852(0x1cf)));const _0x2bffb7=a37_0x3063f9['join'](getConfigDir(),'tdx.json');return _0x206785[_0x1b8852(0x1d5)](...loadProfilesFromTdxJson(_0x2bffb7,_0x1b8852(0x19a))),_0x206785;}function loadProfilesFromDirectories(){const _0xdb3353=a37_0x5b97,_0x51adbc=getProfilesDir();if(!a37_0x246589['existsSync'](_0x51adbc))return[];try{return a37_0x246589[_0xdb3353(0x1a9)](_0x51adbc,{'withFileTypes':!![]})['filter'](_0x3f3e64=>_0x3f3e64['isDirectory']())[_0xdb3353(0x1a0)](_0x389f41=>_0x389f41[_0xdb3353(0x1ba)])[_0xdb3353(0x18c)](_0x95cbf0=>{const _0x2ff4f9=_0xdb3353,_0x2367f9=getProfileConfigPath(_0x95cbf0),_0x5585b7=getProfileEnvPath(_0x95cbf0);return a37_0x246589['existsSync'](_0x2367f9)||a37_0x246589[_0x2ff4f9(0x19f)](_0x5585b7);})[_0xdb3353(0x1a0)](_0x21819c=>{const _0x59d795=loadProfileFromDirectory(_0x21819c);if(_0x59d795)return{..._0x59d795,'scope':'directory'};return null;})['filter'](_0x1a50ef=>_0x1a50ef!==null);}catch{return[];}}function loadProfileFromDirectory(_0x22de6c){const _0x3f31c1=a37_0x5b97,_0x4dd3d3=getProfileConfigPath(_0x22de6c),_0x4434b8=getOldCredentialPath(_0x22de6c);if(!a37_0x246589[_0x3f31c1(0x19f)](_0x4dd3d3)&&!a37_0x246589['existsSync'](_0x4434b8))return null;let _0x485e55={},_0x59edcf={'name':_0x22de6c,'createdAt':new Date()[_0x3f31c1(0x19d)]()};if(a37_0x246589['existsSync'](_0x4dd3d3))try{const _0xf9fa28=a37_0x246589['readFileSync'](_0x4dd3d3,_0x3f31c1(0x1a3)),_0x2a0f83=JSON[_0x3f31c1(0x1cd)](_0xf9fa28),{metadata:_0x3cff36,..._0x4affc3}=_0x2a0f83;_0x485e55=_0x4affc3,_0x3cff36&&(_0x59edcf=_0x3cff36);}catch{}return{'name':_0x22de6c,'config':_0x485e55,'metadata':_0x59edcf,'hasCredentials':a37_0x246589['existsSync'](_0x4434b8),'scope':'directory'};}function a37_0x2161(){const _0x263509=['name','\x20\x203.\x20Move\x20credentials:\x20mv\x20~/.config/tdx/profiles/<name>/.env\x20~/.config/tdx/.env.<name>\x0a','from','71GFRGcS','entries','llm_project','length','\x27:\x20\x27database\x27\x20must\x20be\x20a\x20string','\x27:\x20\x27site\x27\x20must\x20be\x20a\x20string','\x20\x20mv\x20\x22','description','set','has','join','test','4JmPQgy','parent_segment',',\x20creating\x20new\x20file','\x20already\x20exists','parse','\x0aWarning:\x20Skipping\x20invalid\x20profile\x20in\x20','local','.env.','site','find','8593260mPoHUI','message','push','warn','Profile\x20\x27','\x0aWarning:\x20Profiles\x20in\x20directories\x20are\x20deprecated:\x20','\x27:\x20\x27description\x27\x20must\x20be\x20a\x20string','localeCompare','profiles','filter','\x27:\x20config\x20must\x20be\x20an\x20object','database','\x27\x20will\x20be\x20ignored','To\x20migrate:','\x0aWarning:\x20Using\x20deprecated\x20credential\x20location\x20for\x20profile\x20\x27','\x27:\x20\x27llm_agent\x27\x20must\x20be\x20a\x20string','readFileSync','stringify','Warning:\x20Profile\x20\x27','44430397JplTCn','\x20\x201.\x20Edit:\x20','2658sDrCdl','keys','user','\x27:\x20\x27parent_segment\x27\x20must\x20be\x20a\x20string','Error:\x20','toISOString','1249992GIMYRp','existsSync','map','.env','Profile\x20','utf-8','profile','Invalid\x20profile\x20name:\x20','llm_agent','sort','433659piAhTk','readdirSync','15082DyUoVt','tdx.json','Please\x20migrate\x20to\x20~/.config/tdx/tdx.json:','string','7725389KAAPfw','\x20does\x20not\x20exist','Then\x20define\x20profiles\x20in\x20~/.config/tdx/tdx.json\x0a','\x20\x202.\x20Add\x20profiles\x20under\x20a\x20\x22profiles\x22\x20key\x20(see\x20\x27tdx\x20profiles\x27\x20for\x20current\x20config)','27cCHxyT','\x0aWarning:\x20Failed\x20to\x20parse\x20','object','\x0aWarning:\x20Failed\x20to\x20load\x20profiles\x20from\x20','\x27:\x20\x27llm_project\x27\x20must\x20be\x20a\x20string','includes','7045ADJFMk','.\x20Must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore.'];a37_0x2161=function(){return _0x263509;};return a37_0x2161();}export function listProfiles(){const _0x37c7c6=a37_0x5b97,_0x28a88a=loadProfilesFromTdxJsonFiles(),_0x3fc37a=loadProfilesFromDirectories();if(_0x3fc37a[_0x37c7c6(0x1c0)]>0x0){const _0x2d7cbe=_0x3fc37a[_0x37c7c6(0x1a0)](_0x213efd=>_0x213efd[_0x37c7c6(0x1ba)])['join'](',\x20'),_0x16de84=getConfigDir();console[_0x37c7c6(0x1d6)](_0x37c7c6(0x1d8)+_0x2d7cbe),console[_0x37c7c6(0x1d6)](_0x37c7c6(0x1ac)),console[_0x37c7c6(0x1d6)](_0x37c7c6(0x197)+a37_0x3063f9[_0x37c7c6(0x1c7)](_0x16de84,_0x37c7c6(0x1ab))),console[_0x37c7c6(0x1d6)](_0x37c7c6(0x1b1)),console[_0x37c7c6(0x1d6)](_0x37c7c6(0x1bb));}const _0xf28cbb=[..._0x28a88a,..._0x3fc37a],_0x5ac774=new Map();for(const _0x965a7f of _0xf28cbb){!_0x5ac774[_0x37c7c6(0x1c6)](_0x965a7f[_0x37c7c6(0x1ba)])&&_0x5ac774[_0x37c7c6(0x1c5)](_0x965a7f[_0x37c7c6(0x1ba)],_0x965a7f);}return Array[_0x37c7c6(0x1bc)](_0x5ac774['values']())[_0x37c7c6(0x1a7)]((_0x1d77d6,_0xb0f2aa)=>_0x1d77d6[_0x37c7c6(0x1ba)][_0x37c7c6(0x1da)](_0xb0f2aa[_0x37c7c6(0x1ba)]));}export function profileExists(_0x25f056){const _0x1721b9=a37_0x5b97,_0x554ca0=listProfiles();return _0x554ca0['some'](_0x4e2080=>_0x4e2080[_0x1721b9(0x1ba)]===_0x25f056);}export function loadProfile(_0x2be385){const _0x5ddc9a=a37_0x5b97;validateProfileName(_0x2be385);const _0x1f9f87=listProfiles(),_0x317d85=_0x1f9f87[_0x5ddc9a(0x1d2)](_0x148a32=>_0x148a32[_0x5ddc9a(0x1ba)]===_0x2be385);return _0x317d85||null;}function a37_0x5b97(_0x582676,_0x4520bf){const _0x21613f=a37_0x2161();return a37_0x5b97=function(_0x5b9744,_0x1f35f6){_0x5b9744=_0x5b9744-0x18b;let _0xe4da36=_0x21613f[_0x5b9744];return _0xe4da36;},a37_0x5b97(_0x582676,_0x4520bf);}export function saveProfile(_0x5eeec9,_0x43da38,_0x528fd0=![]){saveProfileToUserConfig(_0x5eeec9,_0x43da38);}export function deleteProfile(_0x423ba8){const _0x5e4e41=a37_0x5b97;validateProfileName(_0x423ba8);const _0x24563c=getProfileDir(_0x423ba8);if(!a37_0x246589[_0x5e4e41(0x19f)](_0x24563c))throw new Error(_0x5e4e41(0x1a2)+_0x423ba8+_0x5e4e41(0x1af));a37_0x246589['rmSync'](_0x24563c,{'recursive':!![],'force':!![]});}export function saveProfileToUserConfig(_0x1b0aa5,_0x30946a){const _0x506b39=a37_0x5b97;validateProfileName(_0x1b0aa5);const _0x31e4fe=getGlobalConfigPath(),_0x4ae6c1=getConfigDir();!a37_0x246589[_0x506b39(0x19f)](_0x4ae6c1)&&createSecureDirectory(_0x4ae6c1);let _0x462636={};if(a37_0x246589['existsSync'](_0x31e4fe))try{const _0x4e8a3d=a37_0x246589[_0x506b39(0x193)](_0x31e4fe,'utf-8');_0x462636=JSON['parse'](_0x4e8a3d);}catch{console[_0x506b39(0x1d6)]('Warning:\x20Failed\x20to\x20parse\x20'+_0x31e4fe+_0x506b39(0x1cb));}!_0x462636[_0x506b39(0x18b)]&&(_0x462636[_0x506b39(0x18b)]={}),_0x462636[_0x506b39(0x18b)][_0x1b0aa5]=_0x30946a,writeSecureFile(_0x31e4fe,JSON[_0x506b39(0x194)](_0x462636,null,0x2));}export function getActiveProfile(){const _0x5b09c1=a37_0x5b97,_0x195d75=getGlobalConfigPath();if(!a37_0x246589['existsSync'](_0x195d75))return null;try{const _0x162df8=a37_0x246589[_0x5b09c1(0x193)](_0x195d75,'utf-8'),_0x49e2a6=JSON['parse'](_0x162df8);return _0x49e2a6[_0x5b09c1(0x1a4)]||null;}catch{return null;}}export function createProfile(_0x4528f4,_0x96681b){const _0x120528=a37_0x5b97;validateProfileName(_0x4528f4);if(profileExists(_0x4528f4))throw new Error('Profile\x20'+_0x4528f4+_0x120528(0x1cc));saveProfile(_0x4528f4,_0x96681b);}export function saveProfileCredentials(_0x50a2e7,_0x30164a){const _0x223ea8=a37_0x5b97;validateProfileName(_0x50a2e7);if(!profileExists(_0x50a2e7))throw new Error(_0x223ea8(0x1a2)+_0x50a2e7+_0x223ea8(0x1af));const _0x29ffd1=getNewCredentialPath(_0x50a2e7);writeSecureFile(_0x29ffd1,_0x30164a);}export function loadProfileCredentials(_0x3df712){const _0x4140f8=a37_0x5b97;validateProfileName(_0x3df712);const _0x39c6a6=getNewCredentialPath(_0x3df712);if(a37_0x246589[_0x4140f8(0x19f)](_0x39c6a6))try{return a37_0x246589['readFileSync'](_0x39c6a6,_0x4140f8(0x1a3));}catch{}const _0x480321=getOldCredentialPath(_0x3df712);if(a37_0x246589[_0x4140f8(0x19f)](_0x480321)){console[_0x4140f8(0x1d6)](_0x4140f8(0x191)+_0x3df712+'\x27'),console[_0x4140f8(0x1d6)](_0x4140f8(0x190)),console['warn'](_0x4140f8(0x1c3)+_0x480321+'\x22\x20\x22'+_0x39c6a6+'\x22'),console[_0x4140f8(0x1d6)](_0x4140f8(0x1b0));try{return a37_0x246589[_0x4140f8(0x193)](_0x480321,_0x4140f8(0x1a3));}catch{return null;}}return null;}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a38_0xe4134a=a38_0x193f;(function(_0x11ba86,_0x1b14b8){const _0xa53453=a38_0x193f,_0x515e30=_0x11ba86();while(!![]){try{const _0xc14df0=parseInt(_0xa53453(0x1cf))/0x1+-parseInt(_0xa53453(0x1cd))/0x2+-parseInt(_0xa53453(0x1d4))/0x3*(-parseInt(_0xa53453(0x1d0))/0x4)+parseInt(_0xa53453(0x1dd))/0x5+-parseInt(_0xa53453(0x1d1))/0x6*(parseInt(_0xa53453(0x1e3))/0x7)+-parseInt(_0xa53453(0x1cc))/0x8*(-parseInt(_0xa53453(0x1ce))/0x9)+-parseInt(_0xa53453(0x1df))/0xa;if(_0xc14df0===_0x1b14b8)break;else _0x515e30['push'](_0x515e30['shift']());}catch(_0x52ffdb){_0x515e30['push'](_0x515e30['shift']());}}}(a38_0x3173,0xb6441));import*as a38_0x324892 from'node:fs';function a38_0x193f(_0x56393b,_0x518d21){const _0x31733d=a38_0x3173();return a38_0x193f=function(_0x193f57,_0x1171a6){_0x193f57=_0x193f57-0x1cc;let _0x549f3c=_0x31733d[_0x193f57];return _0x549f3c;},a38_0x193f(_0x56393b,_0x518d21);}import*as a38_0x8744a6 from'node:path';const PROJECT_CONFIG_FILENAME=a38_0xe4134a(0x1d6);export function findProjectConfigPath(_0x1480f6){const _0x4cdb87=a38_0xe4134a;let _0x4cdca5=_0x1480f6||process[_0x4cdb87(0x1da)]();while(!![]){const _0x51795c=a38_0x8744a6[_0x4cdb87(0x1e5)](_0x4cdca5,PROJECT_CONFIG_FILENAME);if(a38_0x324892[_0x4cdb87(0x1ea)](_0x51795c))return _0x51795c;const _0x402952=a38_0x8744a6[_0x4cdb87(0x1ec)](_0x4cdca5);if(_0x402952===_0x4cdca5)return null;_0x4cdca5=_0x402952;}}export function loadProjectConfig(_0xa7dd05){const _0x5200ed=a38_0xe4134a,_0x35b21a=findProjectConfigPath(_0xa7dd05);if(!_0x35b21a)return null;try{const _0x59929e=a38_0x324892[_0x5200ed(0x1e9)](_0x35b21a,_0x5200ed(0x1d9)),_0x17184c=JSON[_0x5200ed(0x1e8)](_0x59929e),_0x3c7892=JSON[_0x5200ed(0x1d3)](_0x17184c);if(_0x3c7892[_0x5200ed(0x1e6)](_0x5200ed(0x1d2))||_0x3c7892[_0x5200ed(0x1e6)]('apiKey')||_0x3c7892[_0x5200ed(0x1e6)](_0x5200ed(0x1eb)))throw new Error(_0x5200ed(0x1de)+_0x35b21a+_0x5200ed(0x1e2)+'Use\x20~/.config/tdx/.env\x20or\x20profile\x20.env\x20files\x20instead.');const {metadata:_0x1014e8,profile:_0x186895,..._0x344f8f}=_0x17184c;return _0x186895&&console[_0x5200ed(0x1d8)](_0x5200ed(0x1d5)+_0x35b21a+'\x20is\x20ignored.\x20'+'Active\x20profile\x20is\x20set\x20in\x20~/.config/tdx/tdx.json'),_0x344f8f;}catch(_0x56684c){if(_0x56684c instanceof Error&&_0x5200ed(0x1db)in _0x56684c&&_0x56684c[_0x5200ed(0x1db)]===_0x5200ed(0x1dc))return null;throw new Error('Failed\x20to\x20load\x20project\x20config\x20from\x20'+_0x35b21a+':\x20'+_0x56684c);}}export function saveProjectConfig(_0x523f1a,_0x242d46){const _0x4bb3fe=a38_0xe4134a,_0x37bb08=_0x242d46||process[_0x4bb3fe(0x1da)](),_0x48c2d1=a38_0x8744a6[_0x4bb3fe(0x1e5)](_0x37bb08,PROJECT_CONFIG_FILENAME),_0x382d86=JSON['stringify'](_0x523f1a);if(_0x382d86['includes'](_0x4bb3fe(0x1d2))||_0x382d86[_0x4bb3fe(0x1e6)](_0x4bb3fe(0x1e4))||_0x382d86[_0x4bb3fe(0x1e6)](_0x4bb3fe(0x1eb)))throw new Error(_0x4bb3fe(0x1d7));if(_0x4bb3fe(0x1e0)in _0x523f1a)throw new Error(_0x4bb3fe(0x1e7));a38_0x324892[_0x4bb3fe(0x1e1)](_0x48c2d1,JSON[_0x4bb3fe(0x1d3)](_0x523f1a,null,0x2));}export function hasProjectConfig(_0x5f03c7){return findProjectConfigPath(_0x5f03c7)!==null;}function a38_0x3173(){const _0x507265=['tdx.json','API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20project\x20configuration.\x20Use\x20.env\x20files\x20instead.','warn','utf-8','cwd','code','ENOENT','6601250PfRTSf','Security\x20error:\x20API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20project\x20config\x20(','2433090ZMZOTp','profile','writeFileSync',').\x20','31528OWkvGr','apiKey','join','includes','\x27profile\x27\x20should\x20not\x20be\x20set\x20in\x20project\x20config.\x20Use\x20\x27tdx\x20profile\x20use\x27\x20instead.','parse','readFileSync','existsSync','api_key','dirname','11675576MbEsiz','2797660fORSfX','9sPZkAv','301121hbBdKn','5032zlfBXk','1956qYXKcE','TD_API_KEY','stringify','1851uBxtaJ','Warning:\x20\x27profile\x27\x20field\x20in\x20'];a38_0x3173=function(){return _0x507265;};return a38_0x3173();}export function getProjectRoot(_0x243647){const _0xf216df=findProjectConfigPath(_0x243647);return _0xf216df?a38_0x8744a6['dirname'](_0xf216df):null;}
|
package/dist/core/session.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x56f4ee,_0x29c1b2){const _0x28160c=a39_0x3613,_0x172634=_0x56f4ee();while(!![]){try{const _0x56200a=parseInt(_0x28160c(0x1ee))/0x1+-parseInt(_0x28160c(0x20b))/0x2*(-parseInt(_0x28160c(0x1fc))/0x3)+parseInt(_0x28160c(0x1f8))/0x4*(parseInt(_0x28160c(0x215))/0x5)+parseInt(_0x28160c(0x20a))/0x6+parseInt(_0x28160c(0x20d))/0x7+parseInt(_0x28160c(0x20f))/0x8*(-parseInt(_0x28160c(0x1ef))/0x9)+-parseInt(_0x28160c(0x1f7))/0xa;if(_0x56200a===_0x29c1b2)break;else _0x172634['push'](_0x172634['shift']());}catch(_0x285b2a){_0x172634['push'](_0x172634['shift']());}}}(a39_0x2d41,0xcab7c));import*as a39_0x3d2b05 from'node:fs';import*as a39_0xa7cdfc from'node:path';import*as a39_0x5df484 from'node:os';import{getPPID,isProcessRunning}from'../utils/process.js';function a39_0x3613(_0x4c3f64,_0x556b14){const _0x2d4120=a39_0x2d41();return a39_0x3613=function(_0x36135e,_0x58d9ad){_0x36135e=_0x36135e-0x1ed;let _0x4778d0=_0x2d4120[_0x36135e];return _0x4778d0;},a39_0x3613(_0x4c3f64,_0x556b14);}import{createSecureDirectory}from'../utils/file-permissions.js';const SESSION_EXPIRATION_MS=0x18*0x3c*0x3c*0x3e8;function getSessionsDir(){const _0x33ea73=a39_0x3613,_0x1994b2=process[_0x33ea73(0x214)][_0x33ea73(0x1f5)]||a39_0xa7cdfc['join'](a39_0x5df484[_0x33ea73(0x202)](),'.config','tdx');return a39_0xa7cdfc['join'](_0x1994b2,_0x33ea73(0x208));}function getSessionPath(_0x340e8e){const _0x39baa2=a39_0x3613;return a39_0xa7cdfc[_0x39baa2(0x210)](getSessionsDir(),_0x340e8e+_0x39baa2(0x1ed));}export function getCurrentSessionPID(){return getPPID();}export function getSessionID(_0x1c64e8){const _0x2d5d57=a39_0x3613;if(_0x1c64e8)return _0x1c64e8;return getCurrentSessionPID()[_0x2d5d57(0x1f1)]();}export function loadSessionContext(_0x17eba9){const _0x4b7a29=a39_0x3613,_0x255c74=_0x17eba9||getCurrentSessionPID()[_0x4b7a29(0x1f1)](),_0x18b371=/^\d+$/[_0x4b7a29(0x1f6)](_0x255c74)?parseInt(_0x255c74,0xa):null;return _0x18b371!==null?loadSessionContextByPID(_0x18b371):loadSessionContextByString(_0x255c74);}export function loadSessionContextByPID(_0xc0a316){const _0x5e7015=a39_0x3613,_0x3f9fe0=getSessionPath(_0xc0a316);if(!a39_0x3d2b05[_0x5e7015(0x209)](_0x3f9fe0))return null;try{const _0x47e346=a39_0x3d2b05[_0x5e7015(0x203)](_0x3f9fe0,_0x5e7015(0x204)),_0xa82749=JSON[_0x5e7015(0x200)](_0x47e346),_0x340523=new Date(_0xa82749['createdAt'])[_0x5e7015(0x1f4)](),_0x527b5d=Date[_0x5e7015(0x206)]();if(_0x527b5d-_0x340523>SESSION_EXPIRATION_MS)return a39_0x3d2b05['unlinkSync'](_0x3f9fe0),null;const _0x24926=JSON['stringify'](_0xa82749);if(_0x24926[_0x5e7015(0x20e)](_0x5e7015(0x1fd))||_0x24926['includes']('apiKey')||_0x24926[_0x5e7015(0x20e)](_0x5e7015(0x201)))return console[_0x5e7015(0x20c)](_0x5e7015(0x1f2)+_0x3f9fe0+_0x5e7015(0x1ff)),a39_0x3d2b05[_0x5e7015(0x1f3)](_0x3f9fe0),null;return _0xa82749;}catch{try{a39_0x3d2b05[_0x5e7015(0x1f3)](_0x3f9fe0);}catch{}return null;}}function loadSessionContextByString(_0x5db0a0){const _0x3561f7=a39_0x3613,_0x19a6ff=a39_0xa7cdfc[_0x3561f7(0x210)](getSessionsDir(),_0x5db0a0+_0x3561f7(0x1ed));if(!a39_0x3d2b05[_0x3561f7(0x209)](_0x19a6ff))return null;try{const _0x2cfbf6=a39_0x3d2b05[_0x3561f7(0x203)](_0x19a6ff,'utf-8'),_0x5dbdc7=JSON['parse'](_0x2cfbf6),_0x40c3a2=new Date(_0x5dbdc7[_0x3561f7(0x207)])[_0x3561f7(0x1f4)](),_0x37a144=Date[_0x3561f7(0x206)]();if(_0x37a144-_0x40c3a2>SESSION_EXPIRATION_MS)return a39_0x3d2b05[_0x3561f7(0x1f3)](_0x19a6ff),null;const _0x640ba8=JSON[_0x3561f7(0x1fe)](_0x5dbdc7);if(_0x640ba8[_0x3561f7(0x20e)](_0x3561f7(0x1fd))||_0x640ba8[_0x3561f7(0x20e)](_0x3561f7(0x205))||_0x640ba8[_0x3561f7(0x20e)](_0x3561f7(0x201)))return console['warn'](_0x3561f7(0x1f2)+_0x19a6ff+'.\x20This\x20is\x20insecure.\x20Removing\x20session.'),a39_0x3d2b05['unlinkSync'](_0x19a6ff),null;return _0x5dbdc7;}catch{try{a39_0x3d2b05['unlinkSync'](_0x19a6ff);}catch{}return null;}}export function saveSessionContext(_0x3fc894,_0x20f593){const _0x9f56f7=a39_0x3613,_0x2393f3=_0x20f593||getCurrentSessionPID()[_0x9f56f7(0x1f1)](),_0x32f05a=/^\d+$/[_0x9f56f7(0x1f6)](_0x2393f3)?parseInt(_0x2393f3,0xa):getCurrentSessionPID(),_0x1a2dfc=a39_0xa7cdfc[_0x9f56f7(0x210)](getSessionsDir(),_0x2393f3+_0x9f56f7(0x1ed)),_0x4b7556=getSessionsDir();createSecureDirectory(_0x4b7556);const _0x328a5e=JSON[_0x9f56f7(0x1fe)](_0x3fc894);if(_0x328a5e['includes'](_0x9f56f7(0x1fd))||_0x328a5e[_0x9f56f7(0x20e)](_0x9f56f7(0x205))||_0x328a5e['includes'](_0x9f56f7(0x201)))throw new Error(_0x9f56f7(0x211));let _0x125120;const _0x39dd85=/^\d+$/[_0x9f56f7(0x1f6)](_0x2393f3)?loadSessionContextByPID(parseInt(_0x2393f3,0xa)):loadSessionContextByString(_0x2393f3);_0x39dd85?_0x125120={..._0x39dd85,..._0x3fc894,'pid':_0x32f05a,'sessionId':_0x2393f3!==_0x32f05a[_0x9f56f7(0x1f1)]()?_0x2393f3:undefined,'updatedAt':new Date()[_0x9f56f7(0x213)]()}:_0x125120={'pid':_0x32f05a,'sessionId':_0x2393f3!==_0x32f05a[_0x9f56f7(0x1f1)]()?_0x2393f3:undefined,..._0x3fc894,'createdAt':new Date()['toISOString'](),'updatedAt':new Date()['toISOString']()},a39_0x3d2b05[_0x9f56f7(0x1f0)](_0x1a2dfc,JSON[_0x9f56f7(0x1fe)](_0x125120,null,0x2));}function a39_0x2d41(){const _0x357ae0=['readFileSync','utf-8','apiKey','now','createdAt','sessions','existsSync','924678AYVLPJ','1053878kihlvR','warn','2051567vbqJTt','includes','67240uehUXI','join','API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20session\x20context.\x20Use\x20.env\x20files\x20instead.','sort','toISOString','env','10cleRlm','.json','1535108SwKmPp','666aKTuGl','writeFileSync','toString','Warning:\x20API\x20keys\x20found\x20in\x20session\x20file\x20','unlinkSync','getTime','TDX_CONFIG_DIR','test','22566070dWjCaQ','291580Khvffd','replace','readdirSync','endsWith','9DVSJho','TD_API_KEY','stringify','.\x20This\x20is\x20insecure.\x20Removing\x20session.','parse','api_key','homedir'];a39_0x2d41=function(){return _0x357ae0;};return a39_0x2d41();}export function clearSessionContext(_0x457e1e){const _0xb81050=a39_0x3613,_0x28ab2a=_0x457e1e||getCurrentSessionPID()[_0xb81050(0x1f1)](),_0x5894a2=a39_0xa7cdfc[_0xb81050(0x210)](getSessionsDir(),_0x28ab2a+_0xb81050(0x1ed));a39_0x3d2b05[_0xb81050(0x209)](_0x5894a2)&&a39_0x3d2b05[_0xb81050(0x1f3)](_0x5894a2);}export function cleanExpiredSessions(){const _0x5b3599=a39_0x3613,_0x4d7cae=getSessionsDir();if(!a39_0x3d2b05[_0x5b3599(0x209)](_0x4d7cae))return 0x0;let _0x1602f1=0x0;const _0x46d6f6=Date['now']();try{const _0x1a77ba=a39_0x3d2b05[_0x5b3599(0x1fa)](_0x4d7cae);for(const _0x2eaadc of _0x1a77ba){if(!_0x2eaadc['endsWith'](_0x5b3599(0x1ed)))continue;const _0x11f711=a39_0xa7cdfc[_0x5b3599(0x210)](_0x4d7cae,_0x2eaadc),_0x10d07d=_0x2eaadc['replace'](_0x5b3599(0x1ed),''),_0x28e01a=parseInt(_0x10d07d,0xa),_0x23ad8f=!isNaN(_0x28e01a);if(_0x23ad8f){if(!isProcessRunning(_0x28e01a)){a39_0x3d2b05[_0x5b3599(0x1f3)](_0x11f711),_0x1602f1++;continue;}}try{const _0x57fb6c=a39_0x3d2b05[_0x5b3599(0x203)](_0x11f711,_0x5b3599(0x204)),_0x2414a9=JSON[_0x5b3599(0x200)](_0x57fb6c),_0x47d3ce=new Date(_0x2414a9[_0x5b3599(0x207)])['getTime']();_0x46d6f6-_0x47d3ce>SESSION_EXPIRATION_MS&&(a39_0x3d2b05[_0x5b3599(0x1f3)](_0x11f711),_0x1602f1++);}catch{a39_0x3d2b05[_0x5b3599(0x1f3)](_0x11f711),_0x1602f1++;}}}catch{}return _0x1602f1;}export function listActiveSessions(){const _0x15275e=a39_0x3613,_0x1f0d1c=getSessionsDir();if(!a39_0x3d2b05[_0x15275e(0x209)](_0x1f0d1c))return[];try{const _0x122749=a39_0x3d2b05[_0x15275e(0x1fa)](_0x1f0d1c),_0xdd01e8=[];for(const _0x18968f of _0x122749){if(!_0x18968f[_0x15275e(0x1fb)]('.json'))continue;const _0x3a110e=_0x18968f[_0x15275e(0x1f9)](_0x15275e(0x1ed),''),_0x4d78e6=parseInt(_0x3a110e,0xa);!isNaN(_0x4d78e6)&&isProcessRunning(_0x4d78e6)&&_0xdd01e8['push'](_0x4d78e6);}return _0xdd01e8[_0x15275e(0x212)]((_0x5cd989,_0x128ade)=>_0x5cd989-_0x128ade);}catch{return[];}}
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x37f39f,_0x1a5612){var _0x24bfb7=a40_0x31a0,_0x50480f=_0x37f39f();while(!![]){try{var _0xed1982=-parseInt(_0x24bfb7(0x1cb))/0x1*(parseInt(_0x24bfb7(0x1c3))/0x2)+-parseInt(_0x24bfb7(0x1c8))/0x3*(-parseInt(_0x24bfb7(0x1c9))/0x4)+-parseInt(_0x24bfb7(0x1ce))/0x5+-parseInt(_0x24bfb7(0x1cd))/0x6*(parseInt(_0x24bfb7(0x1ca))/0x7)+-parseInt(_0x24bfb7(0x1c7))/0x8*(parseInt(_0x24bfb7(0x1cc))/0x9)+parseInt(_0x24bfb7(0x1c5))/0xa+-parseInt(_0x24bfb7(0x1c6))/0xb*(-parseInt(_0x24bfb7(0x1c4))/0xc);if(_0xed1982===_0x1a5612)break;else _0x50480f['push'](_0x50480f['shift']());}catch(_0x53bf9d){_0x50480f['push'](_0x50480f['shift']());}}}(a40_0x34ac,0xe9dd3));export*from'./types/index.js';export*from'./core/config.js';export*from'./core/auth.js';export*from'./client/http-client.js';export*from'./client/td-api-client.js';function a40_0x34ac(){var _0x5e9293=['696SNRAUi','18ROsViJ','859244HtVKqH','910777Uariwh','3DYTIpO','109881rUJQGV','18siFJCs','5688975TCaVFf','283496tTMrTT','1116fKHNZN','11846920RFGvBG','177408RPWkaX'];a40_0x34ac=function(){return _0x5e9293;};return a40_0x34ac();}export{TrinoApiClient}from'./client/trino-api-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';function a40_0x31a0(_0x434165,_0xab215e){var _0x34ac1c=a40_0x34ac();return a40_0x31a0=function(_0x31a00e,_0x1b375d){_0x31a00e=_0x31a00e-0x1c3;var _0x441475=_0x34ac1c[_0x31a00e];return _0x441475;},a40_0x31a0(_0x434165,_0xab215e);}export*from'./sdk/index.js';
|