@treasuredata/tdx 0.26.0 → 0.26.1
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/bin.js +1 -1
- package/dist/build-info.json +3 -3
- package/dist/cli-categories.js +1 -1
- package/dist/cli.js +1 -1
- package/dist/commands/activations.js +1 -1
- package/dist/commands/agent-command.js +1 -1
- package/dist/commands/agent-test-command.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/claude-statusline-command.js +1 -1
- package/dist/commands/claude-usage-command.js +1 -1
- package/dist/commands/command.js +1 -1
- package/dist/commands/connection-command.js +1 -1
- package/dist/commands/databases.js +1 -1
- package/dist/commands/describe.js +1 -1
- package/dist/commands/engage-command.js +1 -1
- package/dist/commands/job-command.js +1 -1
- package/dist/commands/journey-command.js +1 -1
- package/dist/commands/journey-validate-command.js +1 -1
- package/dist/commands/llm-command.js +1 -1
- package/dist/commands/mcp-command.js +1 -1
- package/dist/commands/parent-segment-command.js +1 -1
- package/dist/commands/profile-command.js +1 -1
- package/dist/commands/profiles-command.js +1 -1
- package/dist/commands/query-command.js +1 -1
- package/dist/commands/schedule-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-pull-command.js +1 -1
- package/dist/commands/segment-push-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/segment-validate-command.js +1 -1
- package/dist/commands/segments.js +1 -1
- package/dist/commands/show.js +1 -1
- package/dist/commands/status-command.js +1 -1
- package/dist/commands/tables.js +1 -1
- package/dist/commands/unset-command.js +1 -1
- package/dist/commands/use-command.js +1 -1
- package/dist/commands/user-command.js +1 -1
- package/dist/commands/workflow-command.js +1 -1
- package/dist/core/auth.js +1 -1
- package/dist/core/command-output.js +1 -1
- package/dist/core/config.js +1 -1
- package/dist/core/connection-cache.js +1 -1
- package/dist/core/constants.js +1 -1
- package/dist/core/credential-cache.js +1 -1
- package/dist/core/global-context.js +1 -1
- package/dist/core/keychain.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/core/user-cache.js +1 -1
- package/dist/core/version.js +1 -1
- package/dist/index.js +1 -1
- package/dist/mcp/server.js +1 -1
- package/dist/mcp/tools/index.js +1 -1
- package/dist/mcp/tools/tdx-run.js +1 -1
- package/dist/mcp/tools/tdx-search.js +1 -1
- package/dist/mcp/utils.js +1 -1
- package/dist/proxy/claude-usage-tracker.js +1 -1
- package/dist/proxy/passthrough-server.js +1 -1
- package/dist/proxy/sse-usage-parser.js +1 -1
- package/dist/sdk/agent/agent-config.js +1 -1
- package/dist/sdk/agent/agent-ref-parser.js +1 -1
- package/dist/sdk/agent/agent-yaml.js +1 -1
- package/dist/sdk/agent/test/evaluator.js +1 -1
- package/dist/sdk/agent/test/executor.js +1 -1
- package/dist/sdk/agent/test/index.js +1 -1
- package/dist/sdk/agent/test/output.js +1 -1
- package/dist/sdk/agent/test/parser.js +1 -1
- package/dist/sdk/api.js +1 -1
- package/dist/sdk/client/cdp-api-client.js +1 -1
- package/dist/sdk/client/endpoints.js +1 -1
- package/dist/sdk/client/engage-api-client.js +1 -1
- package/dist/sdk/client/http-client.js +1 -1
- package/dist/sdk/client/llm-api-client.js +1 -1
- package/dist/sdk/client/rate-limiter.js +1 -1
- package/dist/sdk/client/td-api-client.js +1 -1
- package/dist/sdk/client/trino-api-client.js +1 -1
- package/dist/sdk/client/workflow-client.js +1 -1
- package/dist/sdk/connection-validator.js +1 -1
- package/dist/sdk/connection.js +1 -1
- package/dist/sdk/engage.js +1 -1
- package/dist/sdk/errors.js +1 -1
- package/dist/sdk/index.js +1 -1
- package/dist/sdk/io/index.js +1 -1
- package/dist/sdk/io/node-filesystem.js +1 -1
- package/dist/sdk/job.js +1 -1
- package/dist/sdk/journey.js +1 -1
- package/dist/sdk/llm/chat-cache.js +1 -1
- package/dist/sdk/llm/index.js +1 -1
- package/dist/sdk/llm/llm-backup-utils.js +1 -1
- package/dist/sdk/llm/model-factors.js +1 -1
- package/dist/sdk/personalization.js +1 -1
- package/dist/sdk/query/index.js +1 -1
- package/dist/sdk/query/sql-parser.js +1 -1
- package/dist/sdk/realtime.js +1 -1
- package/dist/sdk/schedule.js +1 -1
- package/dist/sdk/segment/child-segment-yaml.js +1 -1
- package/dist/sdk/segment/fields-display.js +1 -1
- package/dist/sdk/segment/file-discovery.js +1 -1
- package/dist/sdk/segment/journey-utils.js +1 -1
- package/dist/sdk/segment/journey-validator.js +1 -1
- package/dist/sdk/segment/journey-yaml.js +1 -1
- package/dist/sdk/segment/parent-segment-preview.js +1 -1
- package/dist/sdk/segment/parent-segment-yaml.js +1 -1
- package/dist/sdk/segment/pull-workflow.js +1 -1
- package/dist/sdk/segment/push-recovery.js +1 -1
- package/dist/sdk/segment/push-workflow.js +1 -1
- package/dist/sdk/segment/resolution-context.js +1 -1
- package/dist/sdk/segment/segment-path-parser.js +1 -1
- package/dist/sdk/segment/segment-ref-parser.js +1 -1
- package/dist/sdk/segment/target-resolution.js +1 -1
- package/dist/sdk/segment/tdx-config.js +1 -1
- package/dist/sdk/segment/validate-files.js +1 -1
- package/dist/sdk/segment/yaml-validator.js +1 -1
- package/dist/sdk/segment.js +1 -1
- package/dist/sdk/types/index.js +1 -1
- package/dist/sdk/types/progress.js +1 -1
- package/dist/sdk/user.js +1 -1
- package/dist/sdk/util/format-detector.js +1 -1
- package/dist/sdk/util/formatters.js +1 -1
- package/dist/sdk/util/index.js +1 -1
- package/dist/sdk/util/tree-formatter.js +1 -1
- package/dist/sdk/workflow/archive-validation.js +1 -1
- package/dist/sdk/workflow/clone-workflow.js +1 -1
- package/dist/sdk/workflow/index.js +1 -1
- package/dist/sdk/workflow/pull-workflow.js +1 -1
- package/dist/sdk/workflow/push-workflow.js +1 -1
- package/dist/sdk/workflow/tdx-config.js +1 -1
- package/dist/sdk/workflow/workflow-utils.js +1 -1
- package/dist/test-utils/command-runner.js +1 -1
- package/dist/test-utils/factories.js +1 -1
- package/dist/test-utils/fixtures.js +1 -1
- package/dist/test-utils/http-mock.js +1 -1
- package/dist/test-utils/index.js +1 -1
- package/dist/utils/async.js +1 -1
- package/dist/utils/colors.js +1 -1
- package/dist/utils/diff.js +1 -1
- package/dist/utils/file-permissions.js +1 -1
- package/dist/utils/global-cache.js +1 -1
- package/dist/utils/json-loader.js +1 -1
- package/dist/utils/local-cache.d.ts +2 -1
- package/dist/utils/local-cache.d.ts.map +1 -1
- package/dist/utils/local-cache.js +1 -1
- package/dist/utils/local-cache.js.map +1 -1
- package/dist/utils/logger/formatters/default-formatter.js +1 -1
- package/dist/utils/logger/formatters/index.js +1 -1
- package/dist/utils/logger/handlers/console-handler.js +1 -1
- package/dist/utils/logger/handlers/file-handler.js +1 -1
- package/dist/utils/logger/handlers/index.js +1 -1
- package/dist/utils/logger/handlers/null-handler.js +1 -1
- package/dist/utils/logger/index.js +1 -1
- package/dist/utils/logger/logger.js +1 -1
- package/dist/utils/logger/types.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/spinner.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/version-check.js +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
const a9_0x4e9dbb=a9_0x4f54;(function(_0xa3d8f7,_0x2243f3){const _0x229a3d=a9_0x4f54,_0x4b98b5=_0xa3d8f7();while(!![]){try{const _0x30f057=-parseInt(_0x229a3d(0x151))/0x1+-parseInt(_0x229a3d(0x1ae))/0x2+parseInt(_0x229a3d(0x156))/0x3*(parseInt(_0x229a3d(0x14b))/0x4)+parseInt(_0x229a3d(0x168))/0x5+parseInt(_0x229a3d(0x171))/0x6*(-parseInt(_0x229a3d(0x19c))/0x7)+-parseInt(_0x229a3d(0x1da))/0x8*(-parseInt(_0x229a3d(0x1db))/0x9)+parseInt(_0x229a3d(0x16c))/0xa;if(_0x30f057===_0x2243f3)break;else _0x4b98b5['push'](_0x4b98b5['shift']());}catch(_0x10d413){_0x4b98b5['push'](_0x4b98b5['shift']());}}}(a9_0x2349,0xddd78));function a9_0x2349(){const _0x575cbb=['https://docs.treasuredata.com/mcp','patch','Failed\x20to\x20list\x20marketplaces','✓\x20Settings\x20configured:\x20.claude/settings.local.json','continue','Checking\x20Claude\x20Code\x20version...','sql-skills','ENOENT','http','join','136YhaybZ','close','user','http://127.0.0.1:','\x20does\x20not\x20support\x20required\x20features.\x20Please\x20upgrade\x20to\x20version\x20','INSTALLATION_FAILED','985811pEDuVM','Claude\x20Code\x20version\x20check\x20failed','Creating\x20.claude/settings.local.json...','statusline','ANTHROPIC_MODEL','71673zSFdHZ','workflow-skills','Failed\x20to\x20configure\x20MCP\x20server\x20\x27','Download\x20the\x20latest\x20version\x20from\x20https://claude.com/claude-code','apiKey','error','tdx','localhost','Configuring\x20MCP\x20server\x20\x27','Claude\x20Code\x20CLI\x20not\x20found','Installing\x20plugin\x20\x27','add','parse','major','tdx-managed-proxy','context','originalSettings','✓\x20Logs\x20saved\x20to\x20','673315MRYbsR','resume','install','\x27\x20installed','35079160UnYJWY','Failed\x20to\x20configure\x20marketplace\x20\x27','object','ANTHROPIC_BASE_URL','type','6uoikoJ','Launch\x20Claude\x20Code\x20with\x20integrated\x20LLM\x20proxy','Setup\x20failed','✓\x20Logging\x20to\x20','port','account_id','start','https://github.com/treasure-data/td-skills','update','log','env','\x20is\x20too\x20old\x20(minimum:\x20','✓\x20MCP\x20server\x20\x27','✓\x20Marketplace\x20\x27','plugin','already\x20installed','exit','trim','mcp','CLAUDE_CODE_USE_BEDROCK','Command\x20output:\x20','Skipping\x20TD\x20LLM\x20proxy\x20setup\x20(--no-proxy)','false','\x20claude\x20statusline','list','site','getLogPath','Starting\x20TD\x20LLM\x20pass-through\x20proxy...','warn','td-skills','CLAUDE_CODE_UNSUPPORTED_VERSION','✓\x20Settings\x20restored:\x20.claude/settings.local.json','\x20meets\x20minimum\x20requirement','Please\x20install\x20Claude\x20Code\x20from\x20https://claude.com/claude-code','cwd','--version','2.0.20','\x27\x20not\x20found\x20in\x20list,\x20skipping\x20removal','logger','green','hostname','Checking\x20Claude\x20Code\x20version\x20(minimum\x20required:\x20','\x20already\x20configured','10949393bJzbii','fail','\x27\x20configured','match','Restored\x20default\x20td-skills\x20marketplace','already\x20exists','includes','stop','Claude\x20Code\x20version\x20','info','logLevel','Warning:\x20Failed\x20to\x20configure\x20','Marketplace\x20\x27','Failed\x20to\x20install\x20plugin\x20\x27','Could\x20not\x20parse\x20Claude\x20Code\x20version\x20from:\x20','INVALID_ARGUMENT','message','stderr','3181750iOkqie','✓\x20Plugin\x20\x27','\x27...','Initializing\x20proxy\x20logger...','\x20configuration\x20failed','red','API\x20key\x20is\x20required\x20for\x20TD\x20LLM\x20Proxy\x20mode','data','CLAUDE_CODE_NOT_FOUND','Finding\x20available\x20port...','\x27:\x20','tdx-skills','profile','✓\x20Claude\x20Code\x20version\x20OK','command','already\x20configured','127.0.0.1','.claude','claude','ANTHROPIC_AUTH_TOKEN','minor','tdx\x20--profile\x20','\x27\x20updated','remove','text','✓\x20Found\x20available\x20port:\x20','settings.local.json','Failed\x20to\x20launch\x20Claude\x20Code:\x20','stdout','marketplace','string','cause','Failed\x20to\x20spawn\x20claude\x20command:\x20','✓\x20TD\x20LLM\x20pass-through\x20proxy\x20running\x20on\x20port\x20','Initializing...','CLAUDE_CODE_USE_VERTEX','\x27\x20removed','Failed\x20to\x20remove\x20marketplace\x20\x27','toString','Failed\x20to\x20update\x20marketplace\x20\x27','td-skills\x20Plugins','--transport','td-docs','debug','1189352hVXsXL','36AhMnpQ','passThroughServer','statusLine','stringify','llm-proxy','unshift','utf-8'];a9_0x2349=function(){return _0x575cbb;};return a9_0x2349();}import{readFile,writeFile,mkdir}from'node:fs/promises';import{existsSync}from'node:fs';import{join}from'node:path';import a9_0x3a285f from'chalk';import{BaseCommand}from'./command.js';import{PassThroughProxyServer}from'../proxy/passthrough-server.js';import{TDXLogger}from'../utils/tdx-logger.js';import{getEndpoint}from'../sdk/client/endpoints.js';import{findAvailablePort}from'../utils/port.js';import{findExecutable,crossSpawn}from'../utils/process.js';import{SDKError,ErrorCode,errorContains}from'../sdk/errors.js';import{createCommandSpinner}from'../utils/spinner.js';import{writeCachedAccountInfo}from'../core/config.js';const MIN_CLAUDE_VERSION=a9_0x4e9dbb(0x195);function handleInstallationError(_0x3d1da9,_0x47119f,_0x1e1437,_0x32468a){const _0x1873c3=a9_0x4e9dbb;errorContains(_0x3d1da9,_0x1873c3(0x1a1),_0x1873c3(0x180),_0x1873c3(0x1bd))?(_0x1e1437[_0x1873c3(0x1c6)]='✓\x20'+_0x47119f+_0x1873c3(0x19b),_0x32468a?.[_0x1873c3(0x1a5)](_0x47119f+_0x1873c3(0x19b)),_0x3d1da9 instanceof SDKError&&_0x3d1da9['cause']&&_0x32468a?.[_0x1873c3(0x1d9)](_0x1873c3(0x185)+_0x3d1da9[_0x1873c3(0x1cd)][_0x1873c3(0x1ac)])):(_0x1e1437[_0x1873c3(0x18d)](_0x1873c3(0x1a7)+_0x47119f),_0x32468a?.[_0x1873c3(0x15b)](_0x47119f+_0x1873c3(0x1b2),_0x3d1da9));}export function parseVersion(_0x288d0e){const _0x27ab5e=a9_0x4e9dbb,_0x5607d4=_0x288d0e[_0x27ab5e(0x182)]()[_0x27ab5e(0x19f)](/^v?(\d+)\.(\d+)\.(\d+)/);if(!_0x5607d4)return null;return{'major':parseInt(_0x5607d4[0x1],0xa),'minor':parseInt(_0x5607d4[0x2],0xa),'patch':parseInt(_0x5607d4[0x3],0xa)};}export function compareVersions(_0x524b35,_0x584a2b){const _0x47bdc5=a9_0x4e9dbb;if(_0x524b35[_0x47bdc5(0x163)]!==_0x584a2b[_0x47bdc5(0x163)])return _0x524b35['major']-_0x584a2b[_0x47bdc5(0x163)];if(_0x524b35['minor']!==_0x584a2b[_0x47bdc5(0x1c2)])return _0x524b35['minor']-_0x584a2b[_0x47bdc5(0x1c2)];return _0x524b35['patch']-_0x584a2b['patch'];}async function checkClaudeVersion(_0x521a7a,_0x3e14ec){const _0x1d548b=a9_0x4e9dbb;_0x3e14ec?.[_0x1d548b(0x1d9)](_0x1d548b(0x19a)+_0x521a7a+')');const _0x5a15cb=await executeClaudeCommand([_0x1d548b(0x194)],undefined,_0x3e14ec),_0x5e7f65=parseVersion(_0x5a15cb);if(!_0x5e7f65){_0x3e14ec?.[_0x1d548b(0x18d)](_0x1d548b(0x1aa)+_0x5a15cb);return;}const _0x15c0ba=_0x5e7f65[_0x1d548b(0x163)]+'.'+_0x5e7f65[_0x1d548b(0x1c2)]+'.'+_0x5e7f65[_0x1d548b(0x1e3)],_0x1d2905=parseVersion(_0x521a7a);if(!_0x1d2905){_0x3e14ec?.[_0x1d548b(0x18d)]('Invalid\x20minimum\x20version\x20format:\x20'+_0x521a7a);return;}if(compareVersions(_0x5e7f65,_0x1d2905)<0x0){_0x3e14ec?.[_0x1d548b(0x15b)](_0x1d548b(0x1a4)+_0x15c0ba+_0x1d548b(0x17c)+_0x521a7a+')');throw new SDKError(ErrorCode[_0x1d548b(0x18f)],_0x1d548b(0x1a4)+_0x15c0ba+_0x1d548b(0x14f)+_0x521a7a+'\x20or\x20later.',undefined,{'helpText':_0x1d548b(0x159)});}_0x3e14ec?.[_0x1d548b(0x1d9)]('Claude\x20Code\x20version\x20'+_0x15c0ba+_0x1d548b(0x191));}async function executeClaudeCommand(_0x4150f4,_0x50ee37,_0x438db4){const _0x3a1ec2=a9_0x4e9dbb;return _0x438db4?.[_0x3a1ec2(0x1a5)]('Executing:\x20claude\x20'+_0x4150f4[_0x3a1ec2(0x14a)]('\x20')),new Promise((_0x37d0d0,_0x17964b)=>{const _0x405459=_0x3a1ec2,_0x24329b=crossSpawn('claude',_0x4150f4,{'stdio':'pipe'});let _0x5a57b9='',_0x151aa5='';_0x24329b[_0x405459(0x1ca)]?.['on'](_0x405459(0x1b5),_0x4b8f29=>{const _0x447393=_0x405459;_0x5a57b9+=_0x4b8f29[_0x447393(0x1d4)]();}),_0x24329b[_0x405459(0x1ad)]?.['on']('data',_0x5f4bca=>{const _0x4fff39=_0x405459;_0x151aa5+=_0x5f4bca[_0x4fff39(0x1d4)]();}),_0x24329b['on'](_0x405459(0x15b),_0x1863c8=>{const _0x712c37=_0x405459;_0x1863c8['code']===_0x712c37(0x1e9)?(_0x438db4?.[_0x712c37(0x15b)](_0x712c37(0x15f)),_0x17964b(new SDKError(ErrorCode[_0x712c37(0x1b6)],_0x712c37(0x15f),_0x1863c8,{'helpText':_0x712c37(0x192)}))):(_0x438db4?.['error']('Command\x20spawn\x20error:\x20'+_0x1863c8[_0x712c37(0x1ac)]),_0x17964b(new SDKError(ErrorCode['INTERNAL'],_0x712c37(0x1ce)+_0x1863c8['message'],_0x1863c8)));}),_0x24329b['on'](_0x405459(0x181),_0x5769db=>{const _0x18a71a=_0x405459;if(_0x5769db===0x0)_0x37d0d0(_0x5a57b9);else _0x50ee37?(_0x438db4?.[_0x18a71a(0x15b)]('Command\x20failed\x20(exit\x20'+_0x5769db+'):\x20claude\x20'+_0x4150f4[_0x18a71a(0x14a)]('\x20')),_0x17964b(new SDKError(ErrorCode[_0x18a71a(0x150)],_0x50ee37,new Error(_0x151aa5)))):_0x37d0d0('');});});}async function ensureMcpServer(_0x3d6dea,_0x356ad0,_0x52900b,_0x5763d7,_0x4a0d91){const _0x50846b=a9_0x4e9dbb;_0x5763d7[_0x50846b(0x1c6)]=_0x50846b(0x15e)+_0x3d6dea+_0x50846b(0x1b0),await executeClaudeCommand([_0x50846b(0x183),_0x50846b(0x161),_0x3d6dea,_0x356ad0,_0x50846b(0x1d7),_0x52900b],_0x50846b(0x158)+_0x3d6dea+'\x27',_0x4a0d91),_0x5763d7[_0x50846b(0x1c6)]=_0x50846b(0x17d)+_0x3d6dea+_0x50846b(0x19e);}export const DEFAULT_TD_SKILLS_URL=a9_0x4e9dbb(0x178);export function getTdSkillsRepoUrl(){const _0x26e12b=process.env.TDX_TD_SKILLS_REPO;if(_0x26e12b)return _0x26e12b;return DEFAULT_TD_SKILLS_URL;}async function removeMarketplace(_0x547d71,_0x3c52ef){const _0x1e4fa3=a9_0x4e9dbb;try{const _0x4d23b4=await executeClaudeCommand([_0x1e4fa3(0x17f),'marketplace',_0x1e4fa3(0x189)],_0x1e4fa3(0x1e4),_0x3c52ef);if(!_0x4d23b4[_0x1e4fa3(0x1a2)](_0x547d71)){_0x3c52ef?.[_0x1e4fa3(0x1d9)](_0x1e4fa3(0x1a8)+_0x547d71+_0x1e4fa3(0x196));return;}await executeClaudeCommand([_0x1e4fa3(0x17f),_0x1e4fa3(0x1cb),_0x1e4fa3(0x1c5),_0x547d71],_0x1e4fa3(0x1d3)+_0x547d71+'\x27',_0x3c52ef),_0x3c52ef?.[_0x1e4fa3(0x1a5)](_0x1e4fa3(0x1a8)+_0x547d71+_0x1e4fa3(0x1d2));}catch(_0x5626d7){_0x3c52ef?.[_0x1e4fa3(0x18d)]('Failed\x20to\x20remove\x20marketplace\x20\x27'+_0x547d71+_0x1e4fa3(0x1b8)+_0x5626d7);}}async function restoreDefaultTdSkillsMarketplace(_0x26f494){const _0x25efc5=a9_0x4e9dbb;try{await removeMarketplace(_0x25efc5(0x18e),_0x26f494),await executeClaudeCommand([_0x25efc5(0x17f),_0x25efc5(0x1cb),_0x25efc5(0x161),DEFAULT_TD_SKILLS_URL],undefined,_0x26f494),_0x26f494?.['info'](_0x25efc5(0x1a0));}catch{}}function a9_0x4f54(_0x5b63d4,_0xcb4515){_0x5b63d4=_0x5b63d4-0x14a;const _0x234974=a9_0x2349();let _0x4f54bb=_0x234974[_0x5b63d4];return _0x4f54bb;}async function ensureMarketplace(_0x38742d,_0x27e7b5,_0xd4691d,_0x455c9d){const _0x260ce2=a9_0x4e9dbb;_0xd4691d[_0x260ce2(0x1c6)]='Configuring\x20marketplace\x20\x27'+_0x38742d+_0x260ce2(0x1b0),await executeClaudeCommand([_0x260ce2(0x17f),'marketplace','add',_0x27e7b5],_0x260ce2(0x16d)+_0x38742d+'\x27',_0x455c9d),_0xd4691d[_0x260ce2(0x1c6)]=_0x260ce2(0x17e)+_0x38742d+_0x260ce2(0x19e);}async function updateMarketplace(_0x5f0248,_0x134ca0,_0x8f9293){const _0xc7df1f=a9_0x4e9dbb;_0x134ca0[_0xc7df1f(0x1c6)]='Updating\x20marketplace\x20\x27'+_0x5f0248+_0xc7df1f(0x1b0),await executeClaudeCommand([_0xc7df1f(0x17f),'marketplace',_0xc7df1f(0x179)],_0xc7df1f(0x1d5)+_0x5f0248+'\x27',_0x8f9293),_0x134ca0[_0xc7df1f(0x1c6)]='✓\x20Marketplace\x20\x27'+_0x5f0248+_0xc7df1f(0x1c4);}async function ensurePlugin(_0x2c9e0f,_0x3ab82e,_0x1e59ae,_0x368edf){const _0x47489c=a9_0x4e9dbb;_0x1e59ae[_0x47489c(0x1c6)]=_0x47489c(0x160)+_0x2c9e0f+'\x27...',await executeClaudeCommand([_0x47489c(0x17f),_0x47489c(0x16a),_0x2c9e0f+'@'+_0x3ab82e],_0x47489c(0x1a9)+_0x2c9e0f+'\x27',_0x368edf),_0x1e59ae[_0x47489c(0x1c6)]=_0x47489c(0x1af)+_0x2c9e0f+_0x47489c(0x16b);}async function createClaudeSettings(_0x32ab52,_0x2a5d5d,_0xf0334a){const _0x400f02=a9_0x4e9dbb,_0x27fc92=join(process[_0x400f02(0x193)](),_0x400f02(0x1bf)),_0x5bf3ba=join(_0x27fc92,_0x400f02(0x1c8));await mkdir(_0x27fc92,{'recursive':!![]});let _0x3a57cf={};if(existsSync(_0x5bf3ba))try{const _0xe6657e=await readFile(_0x5bf3ba,_0x400f02(0x1e1));_0x3a57cf=JSON[_0x400f02(0x162)](_0xe6657e);}catch{_0x3a57cf={};}const _0x4b5878=_0x3a57cf[_0x400f02(0x17b)]||{},_0x3ed9de={'ANTHROPIC_BASE_URL':_0x4b5878[_0x400f02(0x16f)],'ANTHROPIC_MODEL':_0x4b5878[_0x400f02(0x155)],'ANTHROPIC_AUTH_TOKEN':_0x4b5878[_0x400f02(0x1c1)],'CLAUDE_CODE_USE_BEDROCK':_0x4b5878[_0x400f02(0x184)],'CLAUDE_CODE_USE_VERTEX':_0x4b5878[_0x400f02(0x1d1)],'statusLine':_0x3a57cf[_0x400f02(0x1dd)]},_0x4b75e2={..._0x3a57cf,'env':{..._0x4b5878,'ANTHROPIC_BASE_URL':_0x400f02(0x14e)+_0x32ab52,..._0x2a5d5d&&{'ANTHROPIC_MODEL':_0x2a5d5d},'ANTHROPIC_AUTH_TOKEN':_0x400f02(0x164),'CLAUDE_CODE_USE_BEDROCK':_0x400f02(0x187),'CLAUDE_CODE_USE_VERTEX':_0x400f02(0x187)},'statusLine':{'type':_0x400f02(0x1bc),'command':_0xf0334a?_0x400f02(0x1c3)+_0xf0334a+_0x400f02(0x188):'tdx\x20claude\x20statusline'}};return await writeFile(_0x5bf3ba,JSON[_0x400f02(0x1de)](_0x4b75e2,null,0x2)+'\x0a'),_0x3ed9de;}async function restoreClaudeSettings(_0x4ab304){const _0x33d6b8=a9_0x4e9dbb,_0xeb408f=join(process['cwd'](),_0x33d6b8(0x1bf)),_0x1cef6a=join(_0xeb408f,_0x33d6b8(0x1c8));if(!existsSync(_0x1cef6a))return;try{const _0x33d72b=await readFile(_0x1cef6a,_0x33d6b8(0x1e1)),_0x49a0b6=JSON[_0x33d6b8(0x162)](_0x33d72b),_0x101046=_0x49a0b6[_0x33d6b8(0x17b)]||{},_0x4f6d6a=_0x101046[_0x33d6b8(0x16f)],_0x5717e1=((()=>{const _0x1cf967=_0x33d6b8;if(typeof _0x4f6d6a!==_0x1cf967(0x1cc))return![];try{const _0x1c6db7=new URL(_0x4f6d6a);return _0x1c6db7['hostname']===_0x1cf967(0x15d)||_0x1c6db7[_0x1cf967(0x199)]===_0x1cf967(0x1be);}catch{return![];}})());_0x5717e1?(delete _0x101046[_0x33d6b8(0x16f)],delete _0x101046[_0x33d6b8(0x155)],delete _0x101046[_0x33d6b8(0x1c1)],delete _0x101046[_0x33d6b8(0x184)],delete _0x101046[_0x33d6b8(0x1d1)]):(_0x4ab304[_0x33d6b8(0x16f)]!==undefined?_0x101046[_0x33d6b8(0x16f)]=_0x4ab304[_0x33d6b8(0x16f)]:delete _0x101046[_0x33d6b8(0x16f)],_0x4ab304[_0x33d6b8(0x155)]!==undefined?_0x101046['ANTHROPIC_MODEL']=_0x4ab304[_0x33d6b8(0x155)]:delete _0x101046[_0x33d6b8(0x155)],_0x4ab304[_0x33d6b8(0x1c1)]!==undefined?_0x101046['ANTHROPIC_AUTH_TOKEN']=_0x4ab304['ANTHROPIC_AUTH_TOKEN']:delete _0x101046[_0x33d6b8(0x1c1)],_0x4ab304[_0x33d6b8(0x184)]!==undefined?_0x101046[_0x33d6b8(0x184)]=_0x4ab304[_0x33d6b8(0x184)]:delete _0x101046[_0x33d6b8(0x184)],_0x4ab304[_0x33d6b8(0x1d1)]!==undefined?_0x101046['CLAUDE_CODE_USE_VERTEX']=_0x4ab304[_0x33d6b8(0x1d1)]:delete _0x101046[_0x33d6b8(0x1d1)]);const _0x167572=_0x49a0b6[_0x33d6b8(0x1dd)],_0x35b0c0=((()=>{const _0x3bd857=_0x33d6b8;if(!_0x167572||typeof _0x167572!==_0x3bd857(0x16e))return![];if(_0x167572[_0x3bd857(0x170)]!==_0x3bd857(0x1bc))return![];if(typeof _0x167572[_0x3bd857(0x1bc)]!==_0x3bd857(0x1cc))return![];return _0x167572['command'][_0x3bd857(0x1a2)](_0x3bd857(0x15c))&&_0x167572['command'][_0x3bd857(0x1a2)](_0x3bd857(0x154));})());if(_0x35b0c0)delete _0x49a0b6[_0x33d6b8(0x1dd)];else _0x4ab304[_0x33d6b8(0x1dd)]!==undefined?_0x49a0b6[_0x33d6b8(0x1dd)]=_0x4ab304['statusLine']:delete _0x49a0b6['statusLine'];_0x49a0b6[_0x33d6b8(0x17b)]=_0x101046,await writeFile(_0x1cef6a,JSON[_0x33d6b8(0x1de)](_0x49a0b6,null,0x2)+'\x0a');}catch{}}export class ClaudeCommand extends BaseCommand{['name']=a9_0x4e9dbb(0x1c0);['description']=a9_0x4e9dbb(0x172);['passThroughServer'];['originalSettings'];[a9_0x4e9dbb(0x197)];['port'];async['execute'](_0x1f4885){const _0xf24b1c=a9_0x4e9dbb,{tdx:_0x57fa00,options:_0x3d5bc6,args:_0x2b267b}=_0x1f4885;let _0x5ab6b4=![];try{const _0x542a7d=_0x3d5bc6,_0x5b697b=_0x542a7d['proxy']===![],_0x3f215b=_0x542a7d[_0xf24b1c(0x1e6)]===!![],_0x3614c7=_0x542a7d[_0xf24b1c(0x169)]===!![],_0x29285b=[..._0x2b267b];if(_0x3f215b)_0x29285b['unshift']('-c');else _0x3614c7&&_0x29285b[_0xf24b1c(0x1e0)]('-r');const _0x277399=createCommandSpinner(_0xf24b1c(0x1d0),{'verbose':_0x3d5bc6['verbose']});_0x277399[_0xf24b1c(0x177)]();try{if(!_0x5b697b){_0x277399[_0xf24b1c(0x1c6)]=_0xf24b1c(0x1b7),this['port']=await findAvailablePort(0xfa0),_0x277399[_0xf24b1c(0x1c6)]=_0xf24b1c(0x1c7)+this['port'];const _0x271db7=_0x3d5bc6[_0xf24b1c(0x1ba)];try{const _0xe5f3f3=await _0x57fa00[_0xf24b1c(0x14d)]['getCurrent']();_0xe5f3f3[_0xf24b1c(0x176)]&&writeCachedAccountInfo(_0x3d5bc6['site'],_0xe5f3f3[_0xf24b1c(0x176)],_0x271db7);}catch{}_0x277399['text']=_0xf24b1c(0x1b1),this[_0xf24b1c(0x197)]=new TDXLogger(_0x3d5bc6[_0xf24b1c(0x1a6)],!![]),await this['logger']['init']();const _0x1764ba=this[_0xf24b1c(0x197)][_0xf24b1c(0x18b)]();_0x277399[_0xf24b1c(0x1c6)]=_0xf24b1c(0x174)+_0x1764ba;const _0x877b62=getEndpoint(_0x3d5bc6[_0xf24b1c(0x18a)],_0xf24b1c(0x1df));_0x277399['text']=_0xf24b1c(0x18c);if(!_0x57fa00[_0xf24b1c(0x165)][_0xf24b1c(0x15a)])throw new SDKError(ErrorCode[_0xf24b1c(0x1ab)],_0xf24b1c(0x1b4));this['passThroughServer']=new PassThroughProxyServer({'port':this[_0xf24b1c(0x175)],'llmProxyUrl':_0x877b62,'apiKey':_0x57fa00[_0xf24b1c(0x165)]['apiKey'],'logger':this[_0xf24b1c(0x197)],'site':_0x3d5bc6[_0xf24b1c(0x18a)],'profile':_0x271db7}),await this[_0xf24b1c(0x1dc)][_0xf24b1c(0x177)](),_0x277399[_0xf24b1c(0x1c6)]=_0xf24b1c(0x1cf)+this['port']+'\x20→\x20'+_0x877b62,_0x277399[_0xf24b1c(0x1c6)]=_0xf24b1c(0x153),this[_0xf24b1c(0x166)]=await createClaudeSettings(this[_0xf24b1c(0x175)],undefined,_0x271db7),_0x277399[_0xf24b1c(0x1c6)]=_0xf24b1c(0x1e5);}else _0x277399[_0xf24b1c(0x1c6)]=_0xf24b1c(0x186);try{_0x277399['text']=_0xf24b1c(0x1e7),await checkClaudeVersion(MIN_CLAUDE_VERSION,this['logger']),_0x277399['text']=_0xf24b1c(0x1bb);}catch(_0x1fad07){_0x277399[_0xf24b1c(0x19d)](_0xf24b1c(0x152));throw _0x1fad07;}try{await ensureMcpServer(_0xf24b1c(0x1d8),_0xf24b1c(0x1e2),_0xf24b1c(0x1ea),_0x277399,this[_0xf24b1c(0x197)]);}catch(_0xafb16f){handleInstallationError(_0xafb16f,'TD\x20Docs\x20MCP\x20Server',_0x277399,this[_0xf24b1c(0x197)]);}try{const _0x49b008=getTdSkillsRepoUrl();_0x5ab6b4=_0x49b008!==DEFAULT_TD_SKILLS_URL,_0x5ab6b4&&await removeMarketplace('td-skills',this[_0xf24b1c(0x197)]),await ensureMarketplace(_0xf24b1c(0x18e),_0x49b008,_0x277399,this[_0xf24b1c(0x197)]),await updateMarketplace(_0xf24b1c(0x18e),_0x277399,this[_0xf24b1c(0x197)]),await ensurePlugin(_0xf24b1c(0x1e8),_0xf24b1c(0x18e),_0x277399,this[_0xf24b1c(0x197)]),await ensurePlugin(_0xf24b1c(0x157),'td-skills',_0x277399,this['logger']),await ensurePlugin(_0xf24b1c(0x1b9),_0xf24b1c(0x18e),_0x277399,this[_0xf24b1c(0x197)]);}catch(_0x672a42){handleInstallationError(_0x672a42,_0xf24b1c(0x1d6),_0x277399,this['logger']);}_0x277399[_0xf24b1c(0x1a3)]();}catch(_0x2b77e4){_0x277399['fail'](_0xf24b1c(0x173));throw _0x2b77e4;}const _0x362240=await findExecutable(_0xf24b1c(0x1c0));if(!_0x362240)throw new SDKError(ErrorCode[_0xf24b1c(0x1b6)],_0xf24b1c(0x15f),undefined,{'helpText':'Please\x20install\x20Claude\x20Code\x20from\x20https://claude.com/claude-code'});const _0xb7fb62={...process.env};!_0x5b697b&&(_0xb7fb62['ANTHROPIC_BASE_URL']=_0xf24b1c(0x14e)+this[_0xf24b1c(0x175)],_0xb7fb62[_0xf24b1c(0x1c1)]=_0xf24b1c(0x164),_0xb7fb62[_0xf24b1c(0x184)]=_0xf24b1c(0x187),_0xb7fb62[_0xf24b1c(0x1d1)]=_0xf24b1c(0x187));const _0xb78ebc=crossSpawn(_0x362240,_0x29285b,{'stdio':'inherit','env':_0xb7fb62}),_0x8ff1b5=await new Promise(_0x3d9d86=>{const _0xd1b133=_0xf24b1c;_0xb78ebc['on'](_0xd1b133(0x181),_0x3ed951=>{_0x3d9d86(_0x3ed951||0x0);}),_0xb78ebc['on']('error',_0x517f5c=>{const _0x12a82a=_0xd1b133;console['error'](a9_0x3a285f[_0x12a82a(0x1b3)](_0x12a82a(0x1c9)+_0x517f5c['message'])),_0x3d9d86(0x1);});});_0x5ab6b4&&await restoreDefaultTdSkillsMarketplace(this[_0xf24b1c(0x197)]);this[_0xf24b1c(0x1dc)]&&(await this[_0xf24b1c(0x1dc)][_0xf24b1c(0x1a3)](),console[_0xf24b1c(0x17a)](a9_0x3a285f['green']('✓\x20TD\x20LLM\x20pass-through\x20proxy\x20server\x20stopped')));if(this['logger']){await this[_0xf24b1c(0x197)][_0xf24b1c(0x14c)]();const _0x482930=this['logger'][_0xf24b1c(0x18b)]();console['log'](a9_0x3a285f[_0xf24b1c(0x198)](_0xf24b1c(0x167)+_0x482930));}return this[_0xf24b1c(0x166)]&&(await restoreClaudeSettings(this[_0xf24b1c(0x166)]),console['log'](a9_0x3a285f[_0xf24b1c(0x198)](_0xf24b1c(0x190)))),_0x8ff1b5;}catch(_0x32d297){_0x5ab6b4&&await restoreDefaultTdSkillsMarketplace(this[_0xf24b1c(0x197)]);this['passThroughServer']&&await this[_0xf24b1c(0x1dc)][_0xf24b1c(0x1a3)]();this['logger']&&await this[_0xf24b1c(0x197)]['close']();this['originalSettings']&&await restoreClaudeSettings(this[_0xf24b1c(0x166)]);throw _0x32d297;}}}
|
|
1
|
+
const a9_0x20c67e=a9_0x39c0;(function(_0x1b946f,_0xc5bd21){const _0x35800f=a9_0x39c0,_0x13270e=_0x1b946f();while(!![]){try{const _0x458596=-parseInt(_0x35800f(0x181))/0x1*(-parseInt(_0x35800f(0x124))/0x2)+-parseInt(_0x35800f(0x18a))/0x3+parseInt(_0x35800f(0x184))/0x4*(-parseInt(_0x35800f(0x13d))/0x5)+-parseInt(_0x35800f(0xff))/0x6*(-parseInt(_0x35800f(0x178))/0x7)+parseInt(_0x35800f(0x168))/0x8*(parseInt(_0x35800f(0x132))/0x9)+-parseInt(_0x35800f(0x16e))/0xa*(-parseInt(_0x35800f(0x164))/0xb)+parseInt(_0x35800f(0x159))/0xc;if(_0x458596===_0xc5bd21)break;else _0x13270e['push'](_0x13270e['shift']());}catch(_0x59cee1){_0x13270e['push'](_0x13270e['shift']());}}}(a9_0x15f6,0xc90a6));import{readFile,writeFile,mkdir}from'node:fs/promises';import{existsSync}from'node:fs';import{join}from'node:path';import a9_0x54a3dc from'chalk';import{BaseCommand}from'./command.js';import{PassThroughProxyServer}from'../proxy/passthrough-server.js';import{TDXLogger}from'../utils/tdx-logger.js';import{getEndpoint}from'../sdk/client/endpoints.js';import{findAvailablePort}from'../utils/port.js';import{findExecutable,crossSpawn}from'../utils/process.js';import{SDKError,ErrorCode,errorContains}from'../sdk/errors.js';import{createCommandSpinner}from'../utils/spinner.js';import{writeCachedAccountInfo}from'../core/config.js';const MIN_CLAUDE_VERSION=a9_0x20c67e(0x179);function handleInstallationError(_0x569736,_0x5303ef,_0x2ec31d,_0x4b7181){const _0x1f400d=a9_0x20c67e;errorContains(_0x569736,_0x1f400d(0x154),_0x1f400d(0x144),_0x1f400d(0x17e))?(_0x2ec31d[_0x1f400d(0xfd)]='✓\x20'+_0x5303ef+_0x1f400d(0x122),_0x4b7181?.[_0x1f400d(0x146)](_0x5303ef+'\x20already\x20configured'),_0x569736 instanceof SDKError&&_0x569736[_0x1f400d(0x163)]&&_0x4b7181?.['debug'](_0x1f400d(0x14f)+_0x569736[_0x1f400d(0x163)][_0x1f400d(0x153)])):(_0x2ec31d[_0x1f400d(0x155)](_0x1f400d(0x141)+_0x5303ef),_0x4b7181?.[_0x1f400d(0x133)](_0x5303ef+_0x1f400d(0x192),_0x569736));}function a9_0x39c0(_0x5c87e3,_0xe0f76c){_0x5c87e3=_0x5c87e3-0xfd;const _0x15f6bb=a9_0x15f6();let _0x39c000=_0x15f6bb[_0x5c87e3];return _0x39c000;}export function parseVersion(_0x3f4819){const _0x3cf0c1=a9_0x20c67e,_0x6c019b=_0x3f4819[_0x3cf0c1(0x15c)]()['match'](/^v?(\d+)\.(\d+)\.(\d+)/);if(!_0x6c019b)return null;return{'major':parseInt(_0x6c019b[0x1],0xa),'minor':parseInt(_0x6c019b[0x2],0xa),'patch':parseInt(_0x6c019b[0x3],0xa)};}export function compareVersions(_0x53580b,_0x32d682){const _0x33ee59=a9_0x20c67e;if(_0x53580b[_0x33ee59(0x109)]!==_0x32d682[_0x33ee59(0x109)])return _0x53580b[_0x33ee59(0x109)]-_0x32d682[_0x33ee59(0x109)];if(_0x53580b[_0x33ee59(0x158)]!==_0x32d682[_0x33ee59(0x158)])return _0x53580b[_0x33ee59(0x158)]-_0x32d682[_0x33ee59(0x158)];return _0x53580b[_0x33ee59(0x190)]-_0x32d682['patch'];}async function checkClaudeVersion(_0x26f2fb,_0x5a20b5){const _0x5cfece=a9_0x20c67e;_0x5a20b5?.[_0x5cfece(0x191)]('Checking\x20Claude\x20Code\x20version\x20(minimum\x20required:\x20'+_0x26f2fb+')');const _0x2181ac=await executeClaudeCommand(['--version'],undefined,_0x5a20b5),_0x31832f=parseVersion(_0x2181ac);if(!_0x31832f){_0x5a20b5?.[_0x5cfece(0x155)](_0x5cfece(0x14a)+_0x2181ac);return;}const _0x5efda3=_0x31832f[_0x5cfece(0x109)]+'.'+_0x31832f[_0x5cfece(0x158)]+'.'+_0x31832f[_0x5cfece(0x190)],_0x5135eb=parseVersion(_0x26f2fb);if(!_0x5135eb){_0x5a20b5?.[_0x5cfece(0x155)](_0x5cfece(0x10f)+_0x26f2fb);return;}if(compareVersions(_0x31832f,_0x5135eb)<0x0){_0x5a20b5?.['error'](_0x5cfece(0x10c)+_0x5efda3+_0x5cfece(0x166)+_0x26f2fb+')');throw new SDKError(ErrorCode[_0x5cfece(0x16c)],'Claude\x20Code\x20version\x20'+_0x5efda3+'\x20does\x20not\x20support\x20required\x20features.\x20Please\x20upgrade\x20to\x20version\x20'+_0x26f2fb+_0x5cfece(0x18d),undefined,{'helpText':'Download\x20the\x20latest\x20version\x20from\x20https://claude.com/claude-code'});}_0x5a20b5?.[_0x5cfece(0x191)]('Claude\x20Code\x20version\x20'+_0x5efda3+_0x5cfece(0x134));}async function executeClaudeCommand(_0x5efa39,_0x6d8319,_0x15a84b){const _0x248c7c=a9_0x20c67e;return _0x15a84b?.['info'](_0x248c7c(0x12c)+_0x5efa39['join']('\x20')),new Promise((_0x1d7be7,_0x469d1c)=>{const _0x4d4340=_0x248c7c,_0x29ae7c=crossSpawn(_0x4d4340(0x149),_0x5efa39,{'stdio':_0x4d4340(0x126)});let _0x3cb057='',_0x2a1e4a='';_0x29ae7c[_0x4d4340(0x177)]?.['on']('data',_0x403848=>{const _0x335ca4=_0x4d4340;_0x3cb057+=_0x403848[_0x335ca4(0x119)]();}),_0x29ae7c[_0x4d4340(0x142)]?.['on']('data',_0x924d05=>{_0x2a1e4a+=_0x924d05['toString']();}),_0x29ae7c['on'](_0x4d4340(0x133),_0x1b84c9=>{const _0x586975=_0x4d4340;_0x1b84c9['code']==='ENOENT'?(_0x15a84b?.[_0x586975(0x133)](_0x586975(0x17b)),_0x469d1c(new SDKError(ErrorCode[_0x586975(0x120)],_0x586975(0x17b),_0x1b84c9,{'helpText':'Please\x20install\x20Claude\x20Code\x20from\x20https://claude.com/claude-code'}))):(_0x15a84b?.['error'](_0x586975(0x11e)+_0x1b84c9[_0x586975(0x153)]),_0x469d1c(new SDKError(ErrorCode[_0x586975(0x100)],_0x586975(0x14d)+_0x1b84c9['message'],_0x1b84c9)));}),_0x29ae7c['on'](_0x4d4340(0x183),_0x278d99=>{const _0x46aebe=_0x4d4340;if(_0x278d99===0x0)_0x1d7be7(_0x3cb057);else _0x6d8319?(_0x15a84b?.[_0x46aebe(0x133)](_0x46aebe(0x12d)+_0x278d99+'):\x20claude\x20'+_0x5efa39[_0x46aebe(0x180)]('\x20')),_0x469d1c(new SDKError(ErrorCode[_0x46aebe(0x15f)],_0x6d8319,new Error(_0x2a1e4a)))):_0x1d7be7('');});});}async function ensureMcpServer(_0x4d22d6,_0x4d462f,_0x275395,_0x2daf4a,_0x4d940b){const _0x3c7004=a9_0x20c67e;_0x2daf4a[_0x3c7004(0xfd)]=_0x3c7004(0x103)+_0x4d22d6+'\x27...',await executeClaudeCommand([_0x3c7004(0x165),_0x3c7004(0x12a),_0x4d22d6,_0x4d462f,_0x3c7004(0x125),_0x275395],_0x3c7004(0x18c)+_0x4d22d6+'\x27',_0x4d940b),_0x2daf4a[_0x3c7004(0xfd)]=_0x3c7004(0x107)+_0x4d22d6+'\x27\x20configured';}export const DEFAULT_TD_SKILLS_URL=a9_0x20c67e(0x102);export function getTdSkillsRepoUrl(){const _0x535560=process.env.TDX_TD_SKILLS_REPO;if(_0x535560)return _0x535560;return DEFAULT_TD_SKILLS_URL;}async function removeMarketplace(_0xdedab2,_0x136067){const _0x51153e=a9_0x20c67e;try{const _0x439f92=await executeClaudeCommand([_0x51153e(0x105),_0x51153e(0x15d),_0x51153e(0x174)],'Failed\x20to\x20list\x20marketplaces',_0x136067);if(!_0x439f92[_0x51153e(0x18b)](_0xdedab2)){_0x136067?.['debug'](_0x51153e(0x10d)+_0xdedab2+'\x27\x20not\x20found\x20in\x20list,\x20skipping\x20removal');return;}await executeClaudeCommand(['plugin',_0x51153e(0x15d),'remove',_0xdedab2],_0x51153e(0x108)+_0xdedab2+'\x27',_0x136067),_0x136067?.['info']('Marketplace\x20\x27'+_0xdedab2+_0x51153e(0x11f));}catch(_0x3dbc78){_0x136067?.[_0x51153e(0x155)](_0x51153e(0x108)+_0xdedab2+_0x51153e(0xfe)+_0x3dbc78);}}async function restoreDefaultTdSkillsMarketplace(_0x1907b6){const _0x4eae1d=a9_0x20c67e;try{await removeMarketplace(_0x4eae1d(0x113),_0x1907b6),await executeClaudeCommand([_0x4eae1d(0x105),_0x4eae1d(0x15d),_0x4eae1d(0x12a),DEFAULT_TD_SKILLS_URL],undefined,_0x1907b6),_0x1907b6?.['info'](_0x4eae1d(0x136));}catch{}}async function ensureMarketplace(_0x530bfe,_0x209ad5,_0x37ba48,_0x518484){const _0x3abdbf=a9_0x20c67e;_0x37ba48['text']=_0x3abdbf(0x114)+_0x530bfe+_0x3abdbf(0x112),await executeClaudeCommand(['plugin',_0x3abdbf(0x15d),'add',_0x209ad5],_0x3abdbf(0x162)+_0x530bfe+'\x27',_0x518484),_0x37ba48['text']='✓\x20Marketplace\x20\x27'+_0x530bfe+_0x3abdbf(0x117);}async function updateMarketplace(_0x559e36,_0x248fd4,_0x2b8a9d){const _0x35a438=a9_0x20c67e;_0x248fd4[_0x35a438(0xfd)]='Updating\x20marketplace\x20\x27'+_0x559e36+_0x35a438(0x112),await executeClaudeCommand(['plugin',_0x35a438(0x15d),_0x35a438(0x13b)],_0x35a438(0x111)+_0x559e36+'\x27',_0x2b8a9d),_0x248fd4[_0x35a438(0xfd)]='✓\x20Marketplace\x20\x27'+_0x559e36+_0x35a438(0x185);}async function ensurePlugin(_0x3335ec,_0x5009a2,_0x45f9a1,_0x590467){const _0x19428a=a9_0x20c67e;_0x45f9a1['text']=_0x19428a(0x128)+_0x3335ec+_0x19428a(0x112),await executeClaudeCommand([_0x19428a(0x105),'install',_0x3335ec+'@'+_0x5009a2],_0x19428a(0x110)+_0x3335ec+'\x27',_0x590467),_0x45f9a1[_0x19428a(0xfd)]=_0x19428a(0x170)+_0x3335ec+_0x19428a(0x115);}function a9_0x15f6(){const _0x33cce7=['Failed\x20to\x20update\x20marketplace\x20\x27','\x27...','td-skills','Configuring\x20marketplace\x20\x27','\x27\x20installed','resume','\x27\x20configured','getCurrent','toString','description','command','TD\x20Docs\x20MCP\x20Server','tdx-managed-proxy','Command\x20spawn\x20error:\x20','\x27\x20removed','CLAUDE_CODE_NOT_FOUND','sql-skills','\x20already\x20configured','parse','14LgYMFW','--transport','pipe','INVALID_ARGUMENT','Installing\x20plugin\x20\x27','cwd','add','originalSettings','Executing:\x20claude\x20','Command\x20failed\x20(exit\x20','127.0.0.1','logger','logLevel','inherit','144819RHBNwT','error','\x20meets\x20minimum\x20requirement','http://127.0.0.1:','Restored\x20default\x20td-skills\x20marketplace','type','green','account_id','log','update','port','45SkwBlS','name','✓\x20Logging\x20to\x20','tdx\x20--profile\x20','Warning:\x20Failed\x20to\x20configure\x20','stderr','https://docs.treasuredata.com/mcp','already\x20installed','.claude','info','red','http','claude','Could\x20not\x20parse\x20Claude\x20Code\x20version\x20from:\x20','ANTHROPIC_MODEL','ANTHROPIC_AUTH_TOKEN','Failed\x20to\x20spawn\x20claude\x20command:\x20','getLogPath','Command\x20output:\x20','close','API\x20key\x20is\x20required\x20for\x20TD\x20LLM\x20Proxy\x20mode','CLAUDE_CODE_USE_VERTEX','message','already\x20exists','warn','tdx','Creating\x20.claude/settings.local.json...','minor','8387496gHpYHE','statusLine','profile','trim','marketplace','✓\x20Settings\x20restored:\x20.claude/settings.local.json','INSTALLATION_FAILED','false','Starting\x20TD\x20LLM\x20pass-through\x20proxy...','Failed\x20to\x20configure\x20marketplace\x20\x27','cause','11ZarpgI','mcp','\x20is\x20too\x20old\x20(minimum:\x20','env','144kmfTBg','ANTHROPIC_BASE_URL','utf-8','tdx-skills','CLAUDE_CODE_UNSUPPORTED_VERSION','start','6519140loELDr','proxy','✓\x20Plugin\x20\x27','unshift','llm-proxy','execute','list','settings.local.json','Claude\x20Code\x20version\x20check\x20failed','stdout','948304gYODzc','2.0.20','workflow-skills','Claude\x20Code\x20CLI\x20not\x20found','Checking\x20Claude\x20Code\x20version...','site','already\x20configured','Finding\x20available\x20port...','join','93257AmEKZZ','td-docs','exit','400336vkkmbq','\x27\x20updated','passThroughServer','hostname','stringify','Skipping\x20TD\x20LLM\x20proxy\x20setup\x20(--no-proxy)','3332937hYTPzJ','includes','Failed\x20to\x20configure\x20MCP\x20server\x20\x27','\x20or\x20later.','✓\x20Found\x20available\x20port:\x20','Setup\x20failed','patch','debug','\x20configuration\x20failed','CLAUDE_CODE_USE_BEDROCK','fail','text','\x27:\x20','24wIAsWC','INTERNAL','✓\x20TD\x20LLM\x20pass-through\x20proxy\x20running\x20on\x20port\x20','https://github.com/treasure-data/td-skills','Configuring\x20MCP\x20server\x20\x27','✓\x20Settings\x20configured:\x20.claude/settings.local.json','plugin','tdx\x20claude\x20statusline','✓\x20MCP\x20server\x20\x27','Failed\x20to\x20remove\x20marketplace\x20\x27','major','✓\x20Logs\x20saved\x20to\x20','string','Claude\x20Code\x20version\x20','Marketplace\x20\x27','stop','Invalid\x20minimum\x20version\x20format:\x20','Failed\x20to\x20install\x20plugin\x20\x27'];a9_0x15f6=function(){return _0x33cce7;};return a9_0x15f6();}async function createClaudeSettings(_0x5930b6,_0x421a2c,_0x43d739){const _0x46fd12=a9_0x20c67e,_0x4271ca=join(process[_0x46fd12(0x129)](),'.claude'),_0x564c9b=join(_0x4271ca,_0x46fd12(0x175));await mkdir(_0x4271ca,{'recursive':!![]});let _0x56f278={};if(existsSync(_0x564c9b))try{const _0x3ad198=await readFile(_0x564c9b,_0x46fd12(0x16a));_0x56f278=JSON[_0x46fd12(0x123)](_0x3ad198);}catch{_0x56f278={};}const _0x1063fa=_0x56f278['env']||{},_0x3098d3={'ANTHROPIC_BASE_URL':_0x1063fa['ANTHROPIC_BASE_URL'],'ANTHROPIC_MODEL':_0x1063fa[_0x46fd12(0x14b)],'ANTHROPIC_AUTH_TOKEN':_0x1063fa[_0x46fd12(0x14c)],'CLAUDE_CODE_USE_BEDROCK':_0x1063fa[_0x46fd12(0x193)],'CLAUDE_CODE_USE_VERTEX':_0x1063fa[_0x46fd12(0x152)],'statusLine':_0x56f278['statusLine']},_0x39d6cb={..._0x56f278,'env':{..._0x1063fa,'ANTHROPIC_BASE_URL':_0x46fd12(0x135)+_0x5930b6,..._0x421a2c&&{'ANTHROPIC_MODEL':_0x421a2c},'ANTHROPIC_AUTH_TOKEN':_0x46fd12(0x11d),'CLAUDE_CODE_USE_BEDROCK':_0x46fd12(0x160),'CLAUDE_CODE_USE_VERTEX':_0x46fd12(0x160)},'statusLine':{'type':_0x46fd12(0x11b),'command':_0x43d739?_0x46fd12(0x140)+_0x43d739+'\x20claude\x20statusline':_0x46fd12(0x106)}};return await writeFile(_0x564c9b,JSON[_0x46fd12(0x188)](_0x39d6cb,null,0x2)+'\x0a'),_0x3098d3;}async function restoreClaudeSettings(_0x23b3e4){const _0x1f0c8d=a9_0x20c67e,_0x1c2f0e=join(process[_0x1f0c8d(0x129)](),_0x1f0c8d(0x145)),_0x16de86=join(_0x1c2f0e,_0x1f0c8d(0x175));if(!existsSync(_0x16de86))return;try{const _0x10785d=await readFile(_0x16de86,_0x1f0c8d(0x16a)),_0x12ccd6=JSON['parse'](_0x10785d),_0x2070cd=_0x12ccd6['env']||{},_0x4a856a=_0x2070cd[_0x1f0c8d(0x169)],_0xd20561=((()=>{const _0x321380=_0x1f0c8d;if(typeof _0x4a856a!==_0x321380(0x10b))return![];try{const _0x259f76=new URL(_0x4a856a);return _0x259f76[_0x321380(0x187)]==='localhost'||_0x259f76['hostname']===_0x321380(0x12e);}catch{return![];}})());_0xd20561?(delete _0x2070cd[_0x1f0c8d(0x169)],delete _0x2070cd['ANTHROPIC_MODEL'],delete _0x2070cd['ANTHROPIC_AUTH_TOKEN'],delete _0x2070cd[_0x1f0c8d(0x193)],delete _0x2070cd[_0x1f0c8d(0x152)]):(_0x23b3e4['ANTHROPIC_BASE_URL']!==undefined?_0x2070cd[_0x1f0c8d(0x169)]=_0x23b3e4[_0x1f0c8d(0x169)]:delete _0x2070cd['ANTHROPIC_BASE_URL'],_0x23b3e4[_0x1f0c8d(0x14b)]!==undefined?_0x2070cd[_0x1f0c8d(0x14b)]=_0x23b3e4[_0x1f0c8d(0x14b)]:delete _0x2070cd['ANTHROPIC_MODEL'],_0x23b3e4[_0x1f0c8d(0x14c)]!==undefined?_0x2070cd[_0x1f0c8d(0x14c)]=_0x23b3e4['ANTHROPIC_AUTH_TOKEN']:delete _0x2070cd[_0x1f0c8d(0x14c)],_0x23b3e4[_0x1f0c8d(0x193)]!==undefined?_0x2070cd[_0x1f0c8d(0x193)]=_0x23b3e4[_0x1f0c8d(0x193)]:delete _0x2070cd[_0x1f0c8d(0x193)],_0x23b3e4['CLAUDE_CODE_USE_VERTEX']!==undefined?_0x2070cd[_0x1f0c8d(0x152)]=_0x23b3e4[_0x1f0c8d(0x152)]:delete _0x2070cd['CLAUDE_CODE_USE_VERTEX']);const _0x4200ee=_0x12ccd6[_0x1f0c8d(0x15a)],_0x226dcf=((()=>{const _0x449928=_0x1f0c8d;if(!_0x4200ee||typeof _0x4200ee!=='object')return![];if(_0x4200ee[_0x449928(0x137)]!==_0x449928(0x11b))return![];if(typeof _0x4200ee[_0x449928(0x11b)]!==_0x449928(0x10b))return![];return _0x4200ee[_0x449928(0x11b)][_0x449928(0x18b)](_0x449928(0x156))&&_0x4200ee['command'][_0x449928(0x18b)]('statusline');})());if(_0x226dcf)delete _0x12ccd6['statusLine'];else _0x23b3e4[_0x1f0c8d(0x15a)]!==undefined?_0x12ccd6['statusLine']=_0x23b3e4[_0x1f0c8d(0x15a)]:delete _0x12ccd6[_0x1f0c8d(0x15a)];_0x12ccd6[_0x1f0c8d(0x167)]=_0x2070cd,await writeFile(_0x16de86,JSON[_0x1f0c8d(0x188)](_0x12ccd6,null,0x2)+'\x0a');}catch{}}export class ClaudeCommand extends BaseCommand{[a9_0x20c67e(0x13e)]=a9_0x20c67e(0x149);[a9_0x20c67e(0x11a)]='Launch\x20Claude\x20Code\x20with\x20integrated\x20LLM\x20proxy';[a9_0x20c67e(0x186)];[a9_0x20c67e(0x12b)];[a9_0x20c67e(0x12f)];[a9_0x20c67e(0x13c)];async[a9_0x20c67e(0x173)](_0x102330){const _0x49d33f=a9_0x20c67e,{tdx:_0x40ba02,options:_0x1fb83b,args:_0x4de870}=_0x102330;let _0x2d8157=![];try{const _0x48e725=_0x1fb83b,_0x1e5d80=_0x48e725[_0x49d33f(0x16f)]===![],_0x174eac=_0x48e725['continue']===!![],_0x581742=_0x48e725[_0x49d33f(0x116)]===!![],_0x390098=[..._0x4de870];if(_0x174eac)_0x390098[_0x49d33f(0x171)]('-c');else _0x581742&&_0x390098[_0x49d33f(0x171)]('-r');const _0x89bd7d=createCommandSpinner('Initializing...',{'verbose':_0x1fb83b['verbose']});_0x89bd7d['start']();try{if(!_0x1e5d80){_0x89bd7d['text']=_0x49d33f(0x17f),this[_0x49d33f(0x13c)]=await findAvailablePort(0xfa0),_0x89bd7d[_0x49d33f(0xfd)]=_0x49d33f(0x18e)+this[_0x49d33f(0x13c)];const _0x3d440d=_0x1fb83b[_0x49d33f(0x15b)];try{const _0x2dc3d1=await _0x40ba02['user'][_0x49d33f(0x118)]();_0x2dc3d1[_0x49d33f(0x139)]&&writeCachedAccountInfo(_0x1fb83b['site'],_0x2dc3d1['account_id'],_0x3d440d);}catch{}_0x89bd7d[_0x49d33f(0xfd)]='Initializing\x20proxy\x20logger...',this[_0x49d33f(0x12f)]=new TDXLogger(_0x1fb83b[_0x49d33f(0x130)],!![]),await this['logger']['init']();const _0x491388=this[_0x49d33f(0x12f)][_0x49d33f(0x14e)]();_0x89bd7d[_0x49d33f(0xfd)]=_0x49d33f(0x13f)+_0x491388;const _0x40c3b5=getEndpoint(_0x1fb83b[_0x49d33f(0x17d)],_0x49d33f(0x172));_0x89bd7d[_0x49d33f(0xfd)]=_0x49d33f(0x161);if(!_0x40ba02['context']['apiKey'])throw new SDKError(ErrorCode[_0x49d33f(0x127)],_0x49d33f(0x151));this[_0x49d33f(0x186)]=new PassThroughProxyServer({'port':this['port'],'llmProxyUrl':_0x40c3b5,'apiKey':_0x40ba02['context']['apiKey'],'logger':this[_0x49d33f(0x12f)],'site':_0x1fb83b[_0x49d33f(0x17d)],'profile':_0x3d440d}),await this[_0x49d33f(0x186)][_0x49d33f(0x16d)](),_0x89bd7d[_0x49d33f(0xfd)]=_0x49d33f(0x101)+this['port']+'\x20→\x20'+_0x40c3b5,_0x89bd7d['text']=_0x49d33f(0x157),this[_0x49d33f(0x12b)]=await createClaudeSettings(this[_0x49d33f(0x13c)],undefined,_0x3d440d),_0x89bd7d['text']=_0x49d33f(0x104);}else _0x89bd7d[_0x49d33f(0xfd)]=_0x49d33f(0x189);try{_0x89bd7d[_0x49d33f(0xfd)]=_0x49d33f(0x17c),await checkClaudeVersion(MIN_CLAUDE_VERSION,this[_0x49d33f(0x12f)]),_0x89bd7d[_0x49d33f(0xfd)]='✓\x20Claude\x20Code\x20version\x20OK';}catch(_0x32e726){_0x89bd7d[_0x49d33f(0x194)](_0x49d33f(0x176));throw _0x32e726;}try{await ensureMcpServer(_0x49d33f(0x182),_0x49d33f(0x143),_0x49d33f(0x148),_0x89bd7d,this[_0x49d33f(0x12f)]);}catch(_0x264554){handleInstallationError(_0x264554,_0x49d33f(0x11c),_0x89bd7d,this[_0x49d33f(0x12f)]);}try{const _0x81abc5=getTdSkillsRepoUrl();_0x2d8157=_0x81abc5!==DEFAULT_TD_SKILLS_URL,_0x2d8157&&await removeMarketplace(_0x49d33f(0x113),this[_0x49d33f(0x12f)]),await ensureMarketplace('td-skills',_0x81abc5,_0x89bd7d,this[_0x49d33f(0x12f)]),await updateMarketplace('td-skills',_0x89bd7d,this[_0x49d33f(0x12f)]),await ensurePlugin(_0x49d33f(0x121),_0x49d33f(0x113),_0x89bd7d,this['logger']),await ensurePlugin(_0x49d33f(0x17a),_0x49d33f(0x113),_0x89bd7d,this[_0x49d33f(0x12f)]),await ensurePlugin(_0x49d33f(0x16b),_0x49d33f(0x113),_0x89bd7d,this['logger']);}catch(_0x3cc067){handleInstallationError(_0x3cc067,'td-skills\x20Plugins',_0x89bd7d,this[_0x49d33f(0x12f)]);}_0x89bd7d[_0x49d33f(0x10e)]();}catch(_0x8ec9f2){_0x89bd7d[_0x49d33f(0x194)](_0x49d33f(0x18f));throw _0x8ec9f2;}const _0x32b372=await findExecutable(_0x49d33f(0x149));if(!_0x32b372)throw new SDKError(ErrorCode[_0x49d33f(0x120)],_0x49d33f(0x17b),undefined,{'helpText':'Please\x20install\x20Claude\x20Code\x20from\x20https://claude.com/claude-code'});const _0x653f97={...process.env};!_0x1e5d80&&(_0x653f97[_0x49d33f(0x169)]=_0x49d33f(0x135)+this[_0x49d33f(0x13c)],_0x653f97[_0x49d33f(0x14c)]='tdx-managed-proxy',_0x653f97[_0x49d33f(0x193)]=_0x49d33f(0x160),_0x653f97[_0x49d33f(0x152)]=_0x49d33f(0x160));const _0x12f4b2=crossSpawn(_0x32b372,_0x390098,{'stdio':_0x49d33f(0x131),'env':_0x653f97}),_0xf16bef=await new Promise(_0x508b6c=>{const _0x4ee63b=_0x49d33f;_0x12f4b2['on'](_0x4ee63b(0x183),_0x470ba4=>{_0x508b6c(_0x470ba4||0x0);}),_0x12f4b2['on'](_0x4ee63b(0x133),_0x2a177d=>{const _0x14b456=_0x4ee63b;console[_0x14b456(0x133)](a9_0x54a3dc[_0x14b456(0x147)]('Failed\x20to\x20launch\x20Claude\x20Code:\x20'+_0x2a177d[_0x14b456(0x153)])),_0x508b6c(0x1);});});_0x2d8157&&await restoreDefaultTdSkillsMarketplace(this['logger']);this['passThroughServer']&&(await this[_0x49d33f(0x186)][_0x49d33f(0x10e)](),console[_0x49d33f(0x13a)](a9_0x54a3dc[_0x49d33f(0x138)]('✓\x20TD\x20LLM\x20pass-through\x20proxy\x20server\x20stopped')));if(this[_0x49d33f(0x12f)]){await this[_0x49d33f(0x12f)][_0x49d33f(0x150)]();const _0x681342=this[_0x49d33f(0x12f)][_0x49d33f(0x14e)]();console[_0x49d33f(0x13a)](a9_0x54a3dc[_0x49d33f(0x138)](_0x49d33f(0x10a)+_0x681342));}return this['originalSettings']&&(await restoreClaudeSettings(this[_0x49d33f(0x12b)]),console[_0x49d33f(0x13a)](a9_0x54a3dc[_0x49d33f(0x138)](_0x49d33f(0x15e)))),_0xf16bef;}catch(_0x5ca058){_0x2d8157&&await restoreDefaultTdSkillsMarketplace(this['logger']);this['passThroughServer']&&await this[_0x49d33f(0x186)][_0x49d33f(0x10e)]();this[_0x49d33f(0x12f)]&&await this['logger']['close']();this[_0x49d33f(0x12b)]&&await restoreClaudeSettings(this[_0x49d33f(0x12b)]);throw _0x5ca058;}}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a10_0x543cdb=a10_0x35bf;(function(_0x432247,_0x372e3a){const _0x5404e3=a10_0x35bf,_0x50a540=_0x432247();while(!![]){try{const _0x1f8bd8=parseInt(_0x5404e3(0x13a))/0x1+parseInt(_0x5404e3(0x13f))/0x2*(-parseInt(_0x5404e3(0x15c))/0x3)+-parseInt(_0x5404e3(0x154))/0x4+parseInt(_0x5404e3(0x152))/0x5+parseInt(_0x5404e3(0x159))/0x6*(parseInt(_0x5404e3(0x145))/0x7)+-parseInt(_0x5404e3(0x153))/0x8+parseInt(_0x5404e3(0x146))/0x9*(parseInt(_0x5404e3(0x141))/0xa);if(_0x1f8bd8===_0x372e3a)break;else _0x50a540['push'](_0x50a540['shift']());}catch(_0x274b49){_0x50a540['push'](_0x50a540['shift']());}}}(a10_0x3b8d,0x4adc5));import{createInterface}from'node:readline';function a10_0x35bf(_0x109811,_0x25e28a){_0x109811=_0x109811-0x137;const _0x3b8d26=a10_0x3b8d();let _0x35bf15=_0x3b8d26[_0x109811];return _0x35bf15;}function a10_0x3b8d(){const _0x504123=['profile','push','1371mRLBWm','latestInputTokens','\x20session\x20/\x20','💎\x20tdx\x20-\x20Claude','join','179594bYwErU','monthCredits','stdin','todayCredits','site','802HmgTzP','statusline','130QBNSNg','toFixed','sessionCredits','options','7qCtonP','721467wAUzka','🧠\x20','tdx','accountId','name','\x20-\x20','description','tdx\x20','🪙\x20credit:\x20','parse','\x20today\x20/\x20','Claude','1072260GqtoZK','4575360XlNszf','2129272rGxuxC','session_id','log','execute','💎\x20','947754EiIiFb'];a10_0x3b8d=function(){return _0x504123;};return a10_0x3b8d();}import{BaseCommand}from'./command.js';import{getUsageStats}from'../proxy/claude-usage-tracker.js';import{readCachedAccountInfo}from'../core/config.js';import{getModelDisplayName,formatTokenCount,calculateContextPercentage}from'../sdk/llm/model-factors.js';async function readStdinJson(_0x37273b=0x64){return new Promise(_0x49797b=>{const _0x9cb462=a10_0x35bf;let _0x32f6d3='',_0x3dc2cf=![];const _0x55958f=createInterface({'input':process[_0x9cb462(0x13c)],'terminal':![]}),_0x1ecf9b=_0x2e6d1b=>{if(_0x3dc2cf)return;_0x3dc2cf=!![],clearTimeout(_0x5738de),_0x55958f['close'](),_0x49797b(_0x2e6d1b);},_0x5738de=setTimeout(()=>{_0x1ecf9b(null);},_0x37273b);_0x55958f['on']('line',_0x3f11d1=>{_0x32f6d3+=_0x3f11d1;}),_0x55958f['on']('close',()=>{const _0x178e32=_0x9cb462;if(_0x3dc2cf)return;try{const _0x4cd1e9=JSON[_0x178e32(0x14f)](_0x32f6d3);_0x1ecf9b(_0x4cd1e9);}catch{_0x1ecf9b(null);}});});}function formatCredits(_0x230d9c){const _0xa6ff3b=a10_0x35bf;return _0x230d9c[_0xa6ff3b(0x142)](0x2);}export class ClaudeStatuslineCommand extends BaseCommand{[a10_0x543cdb(0x14a)]=a10_0x543cdb(0x140);[a10_0x543cdb(0x14c)]='Output\x20statusline\x20for\x20Claude\x20Code\x20(reads\x20JSON\x20from\x20stdin)';async[a10_0x543cdb(0x157)](_0x432372){const _0x13027e=a10_0x543cdb;try{const _0x55a2ce=await readStdinJson();if(!_0x55a2ce?.[_0x13027e(0x155)])return console[_0x13027e(0x156)]('💎\x20tdx\x20-\x20Claude'),0x0;const _0x3d47ba=_0x55a2ce[_0x13027e(0x155)],_0x2b58e9=_0x55a2ce['model']?.['id']||'',_0x5c5890=_0x55a2ce[_0x13027e(0x15a)]||_0x432372[_0x13027e(0x144)][_0x13027e(0x15a)],_0x364133=await getUsageStats(_0x3d47ba,_0x5c5890),_0x2c5de9=[],_0x216dc7=readCachedAccountInfo(_0x5c5890),_0x34c8d7=_0x216dc7?_0x13027e(0x14d)+_0x216dc7[_0x13027e(0x13e)]+':'+_0x216dc7[_0x13027e(0x149)]:_0x13027e(0x148),_0x4eddeb=_0x2b58e9?getModelDisplayName(_0x2b58e9):_0x13027e(0x151);_0x2c5de9[_0x13027e(0x15b)](_0x13027e(0x158)+_0x34c8d7+_0x13027e(0x14b)+_0x4eddeb);const _0x27b544=formatCredits(_0x364133[_0x13027e(0x143)]),_0x544bb7=formatCredits(_0x364133[_0x13027e(0x13d)]),_0x1fecb3=formatCredits(_0x364133[_0x13027e(0x13b)]);_0x2c5de9[_0x13027e(0x15b)](_0x13027e(0x14e)+_0x27b544+_0x13027e(0x137)+_0x544bb7+_0x13027e(0x150)+_0x1fecb3+'\x20month');if(_0x364133[_0x13027e(0x15d)]>0x0&&_0x2b58e9){const _0x1e3aa6=formatTokenCount(_0x364133[_0x13027e(0x15d)]),_0x569970=calculateContextPercentage(_0x364133[_0x13027e(0x15d)],_0x2b58e9);_0x2c5de9[_0x13027e(0x15b)](_0x13027e(0x147)+_0x1e3aa6+'\x20('+_0x569970+'%)');}return console[_0x13027e(0x156)](_0x2c5de9[_0x13027e(0x139)]('\x20|\x20')),0x0;}catch{return console['log'](_0x13027e(0x138)),0x0;}}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a11_0x5c9516=a11_0x2bfb;(function(_0x5675f4,_0x54fabf){const _0xf15460=a11_0x2bfb,_0x825fa5=_0x5675f4();while(!![]){try{const _0x5e12ba=parseInt(_0xf15460(0x159))/0x1+parseInt(_0xf15460(0x140))/0x2*(parseInt(_0xf15460(0x14c))/0x3)+parseInt(_0xf15460(0x15c))/0x4+parseInt(_0xf15460(0x130))/0x5*(-parseInt(_0xf15460(0x134))/0x6)+parseInt(_0xf15460(0x13f))/0x7*(-parseInt(_0xf15460(0x157))/0x8)+-parseInt(_0xf15460(0x125))/0x9+-parseInt(_0xf15460(0x145))/0xa;if(_0x5e12ba===_0x54fabf)break;else _0x825fa5['push'](_0x825fa5['shift']());}catch(_0x2eb41a){_0x825fa5['push'](_0x825fa5['shift']());}}}(a11_0x4916,0x95d62));import a11_0x5b46bf from'chalk';import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../core/command-output.js';function a11_0x4916(){const _0x428500=['\x20days\x20ago','bold','\x20\x20Run\x20\x22tdx\x20claude\x22\x20to\x20start\x20using\x20AI\x20Suite.\x0a','en-US','todayCredits','Month','numeric','Last\x20Used','default','execute','173790PgvjfA','getTime','dim','entryCount','toLocaleTimeString','yesterday','format','today\x20','credits','never','\x20\x20Month:\x20\x20\x20','285qXwRYZ','Show\x20AI\x20Suite\x20credit\x20usage\x20by\x20profile','padStart','message','88638CRdLYm','jsonl','Total','Source','\x20credits','Usage\x20by\x20Profile','monthCredits','source','log','outputStructured','totalCredits','14QUNOro','2RMDdap','repeat','error','cyan','(default)','4449730mSlGxj','length','toLocaleDateString','\x20\x20No\x20usage\x20data\x20recorded\x20yet.','Unknown\x20error','en-CA','all','1071249ZMtjqg','description','map','\x20\x20Total:\x20\x20\x20','2-digit','Note:\x20Credit\x20values\x20are\x20estimates\x20based\x20on\x20token\x20usage.','Today','Credits','max','usage','Profile','1373536XCEBAO','json','740690PfnugX','toFixed','padEnd','4662740jmjiPx','profile','name'];a11_0x4916=function(){return _0x428500;};return a11_0x4916();}import{getAllProfileStats,getAllSourceStats,getUsageSummary}from'../proxy/claude-usage-tracker.js';function a11_0x2bfb(_0x3fec92,_0x5098df){_0x3fec92=_0x3fec92-0x123;const _0x4916f0=a11_0x4916();let _0x2bfb8a=_0x4916f0[_0x3fec92];return _0x2bfb8a;}function formatCredits(_0x4c0a88){const _0x4bb563=a11_0x2bfb;return _0x4c0a88[_0x4bb563(0x15a)](0x2);}function formatLastUsed(_0x167c63){const _0xec10dd=a11_0x2bfb;if(!_0x167c63)return _0xec10dd(0x12e);const _0x35da5b=new Date(_0x167c63),_0x4cfa9d=new Date(),_0x91b0d7=_0x35da5b[_0xec10dd(0x147)](_0xec10dd(0x14a)),_0x5aee37=_0x4cfa9d[_0xec10dd(0x147)](_0xec10dd(0x14a));if(_0x91b0d7===_0x5aee37)return _0xec10dd(0x12c)+_0x35da5b[_0xec10dd(0x129)]('en-US',{'hour':_0xec10dd(0x150),'minute':_0xec10dd(0x150)});const _0x2a146d=new Date(_0x91b0d7),_0x449738=new Date(_0x5aee37),_0x5741a0=Math['round']((_0x449738['getTime']()-_0x2a146d[_0xec10dd(0x126)]())/(0x18*0x3c*0x3c*0x3e8));if(_0x5741a0===0x1)return _0xec10dd(0x12a);else return _0x5741a0>0x1&&_0x5741a0<0x7?_0x5741a0+_0xec10dd(0x15f):_0x35da5b[_0xec10dd(0x147)](_0xec10dd(0x162),{'month':'short','day':_0xec10dd(0x165)});}export class ClaudeUsageCommand extends BaseCommand{[a11_0x5c9516(0x15e)]=a11_0x5c9516(0x155);[a11_0x5c9516(0x14d)]=a11_0x5c9516(0x131);async[a11_0x5c9516(0x124)](_0xbb101e){const _0x1a3a2d=a11_0x5c9516,{options:_0x3ff9fe}=_0xbb101e,_0x4fdb55=_0x3ff9fe[_0x1a3a2d(0x12b)]===_0x1a3a2d(0x158)||_0x3ff9fe['format']===_0x1a3a2d(0x135)||_0x3ff9fe[_0x1a3a2d(0x158)];try{const [_0x6220cd,_0x3368ba,_0xb2ea22]=await Promise[_0x1a3a2d(0x14b)]([getAllProfileStats(),getAllSourceStats(),getUsageSummary()]);return _0x4fdb55?await this[_0x1a3a2d(0x13d)](_0x6220cd,_0x3368ba,_0xb2ea22,_0x3ff9fe):this['outputTable'](_0x6220cd,_0x3368ba,_0xb2ea22),0x0;}catch(_0x122773){const _0x4e7339=_0x122773 instanceof Error?_0x122773[_0x1a3a2d(0x133)]:_0x1a3a2d(0x149);return console[_0x1a3a2d(0x142)](a11_0x5b46bf['red']('Error:\x20'+_0x4e7339)),0x1;}}async[a11_0x5c9516(0x13d)](_0x1877da,_0x31353c,_0x3b7511,_0x32cd00){const _0x31bd39=a11_0x5c9516,_0x7f2d62={'summary':{'todayCredits':_0x3b7511['todayCredits'],'monthCredits':_0x3b7511['monthCredits'],'totalCredits':_0x3b7511[_0x31bd39(0x13e)],'profileCount':_0x3b7511['profileCount']},'profiles':_0x1877da[_0x31bd39(0x14e)](_0x411d4f=>({'profile':_0x411d4f[_0x31bd39(0x15d)],'credits':_0x411d4f[_0x31bd39(0x12d)],'requests':_0x411d4f[_0x31bd39(0x128)],'lastUsedAt':_0x411d4f['lastUsedAt']})),'sources':_0x31353c['map'](_0x3bfeec=>({'source':_0x3bfeec[_0x31bd39(0x13b)],'credits':_0x3bfeec[_0x31bd39(0x12d)],'todayCredits':_0x3bfeec[_0x31bd39(0x163)],'monthCredits':_0x3bfeec['monthCredits'],'requests':_0x3bfeec[_0x31bd39(0x128)]}))};await handleSDKOutput([_0x7f2d62],_0x32cd00);}['outputTable'](_0x25cb5a,_0x1fc9ae,_0x3c0041){const _0xfaf935=a11_0x5c9516;console[_0xfaf935(0x13c)](a11_0x5b46bf[_0xfaf935(0x160)]('\x0aAI\x20Suite\x20Credit\x20Usage\x20Summary')),console[_0xfaf935(0x13c)](a11_0x5b46bf[_0xfaf935(0x127)]('─'[_0xfaf935(0x141)](0x32))),console[_0xfaf935(0x13c)]('\x20\x20Today:\x20\x20\x20'+a11_0x5b46bf['cyan'](formatCredits(_0x3c0041[_0xfaf935(0x163)]))+_0xfaf935(0x138)),console[_0xfaf935(0x13c)](_0xfaf935(0x12f)+a11_0x5b46bf[_0xfaf935(0x143)](formatCredits(_0x3c0041['monthCredits']))+_0xfaf935(0x138)),console[_0xfaf935(0x13c)](_0xfaf935(0x14f)+a11_0x5b46bf[_0xfaf935(0x143)](formatCredits(_0x3c0041[_0xfaf935(0x13e)]))+_0xfaf935(0x138)),console[_0xfaf935(0x13c)]();if(_0x1fc9ae['length']>0x0){console[_0xfaf935(0x13c)](a11_0x5b46bf[_0xfaf935(0x160)]('Usage\x20by\x20Source')),console['log'](a11_0x5b46bf['dim']('─'[_0xfaf935(0x141)](0x3c)));const _0x3db708=0xc,_0x1947d1=0xa,_0x4dd35c=0xa,_0x4dcff3=0xa;console[_0xfaf935(0x13c)]('\x20\x20'+_0xfaf935(0x137)[_0xfaf935(0x15b)](_0x3db708)+'\x20\x20'+_0xfaf935(0x136)[_0xfaf935(0x132)](_0x1947d1)+'\x20\x20'+_0xfaf935(0x152)[_0xfaf935(0x132)](_0x4dd35c)+'\x20\x20'+_0xfaf935(0x164)['padStart'](_0x4dcff3));for(const _0x223d5d of _0x1fc9ae){console['log']('\x20\x20'+_0x223d5d[_0xfaf935(0x13b)][_0xfaf935(0x15b)](_0x3db708)+'\x20\x20'+a11_0x5b46bf['cyan'](formatCredits(_0x223d5d['credits'])[_0xfaf935(0x132)](_0x1947d1))+'\x20\x20'+formatCredits(_0x223d5d[_0xfaf935(0x163)])[_0xfaf935(0x132)](_0x4dd35c)+'\x20\x20'+formatCredits(_0x223d5d[_0xfaf935(0x13a)])[_0xfaf935(0x132)](_0x4dcff3));}console[_0xfaf935(0x13c)]();}if(_0x25cb5a[_0xfaf935(0x146)]===0x0){console[_0xfaf935(0x13c)](a11_0x5b46bf[_0xfaf935(0x127)](_0xfaf935(0x148))),console[_0xfaf935(0x13c)](a11_0x5b46bf[_0xfaf935(0x127)](_0xfaf935(0x161)));return;}console[_0xfaf935(0x13c)](a11_0x5b46bf[_0xfaf935(0x160)](_0xfaf935(0x139))),console[_0xfaf935(0x13c)](a11_0x5b46bf['dim']('─'[_0xfaf935(0x141)](0x3c)));const _0x382778=Math[_0xfaf935(0x154)](0xc,..._0x25cb5a['map'](_0x15bfb6=>_0x15bfb6['profile']===_0xfaf935(0x123)?_0xfaf935(0x144)[_0xfaf935(0x146)]:_0x15bfb6[_0xfaf935(0x15d)][_0xfaf935(0x146)])),_0x4d57f8=0xa,_0x582d35=0xa;console['log']('\x20\x20'+_0xfaf935(0x156)[_0xfaf935(0x15b)](_0x382778)+'\x20\x20'+_0xfaf935(0x153)['padStart'](_0x4d57f8)+'\x20\x20'+'Requests'['padStart'](_0x582d35)+'\x20\x20'+_0xfaf935(0x166));for(const _0x8f9943 of _0x25cb5a){const _0x5a269b=_0x8f9943[_0xfaf935(0x15d)]===_0xfaf935(0x123)?'(default)':_0x8f9943['profile'],_0x1d3aff=_0x5a269b[_0xfaf935(0x15b)](_0x382778),_0x4465e1=_0x8f9943[_0xfaf935(0x15d)]===_0xfaf935(0x123)?a11_0x5b46bf['dim'](_0x1d3aff):_0x1d3aff;console[_0xfaf935(0x13c)]('\x20\x20'+_0x4465e1+'\x20\x20'+a11_0x5b46bf[_0xfaf935(0x143)](formatCredits(_0x8f9943[_0xfaf935(0x12d)])[_0xfaf935(0x132)](_0x4d57f8))+'\x20\x20'+String(_0x8f9943[_0xfaf935(0x128)])[_0xfaf935(0x132)](_0x582d35)+'\x20\x20'+a11_0x5b46bf['dim'](formatLastUsed(_0x8f9943['lastUsedAt'])));}console[_0xfaf935(0x13c)](),console[_0xfaf935(0x13c)](a11_0x5b46bf[_0xfaf935(0x127)](_0xfaf935(0x151))),console['log']();}}
|
package/dist/commands/command.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a12_0x4dbc70=a12_0x3ede;(function(_0x52e38b,_0x55846d){const _0x2aab79=a12_0x3ede,_0x2a8452=_0x52e38b();while(!![]){try{const _0x27f628=parseInt(_0x2aab79(0x124))/0x1*(-parseInt(_0x2aab79(0x115))/0x2)+parseInt(_0x2aab79(0x117))/0x3*(parseInt(_0x2aab79(0x109))/0x4)+-parseInt(_0x2aab79(0x11c))/0x5*(-parseInt(_0x2aab79(0x12b))/0x6)+-parseInt(_0x2aab79(0x103))/0x7*(-parseInt(_0x2aab79(0x121))/0x8)+-parseInt(_0x2aab79(0x108))/0x9+parseInt(_0x2aab79(0x125))/0xa*(parseInt(_0x2aab79(0x123))/0xb)+parseInt(_0x2aab79(0x122))/0xc;if(_0x27f628===_0x55846d)break;else _0x2a8452['push'](_0x2a8452['shift']());}catch(_0x57e531){_0x2a8452['push'](_0x2a8452['shift']());}}}(a12_0x2b3d,0x85704));import{validateLimitOption}from'../utils/option-validation.js';import{HTTPClientError}from'../sdk/client/http-client.js';import{SDKError,ErrorCategory}from'../sdk/errors.js';import{Logger}from'../utils/logger/index.js';function a12_0x3ede(_0x47ac4a,_0x2d1ae8){_0x47ac4a=_0x47ac4a-0xfb;const _0x2b3d7e=a12_0x2b3d();let _0x3ede2f=_0x2b3d7e[_0x47ac4a];return _0x3ede2f;}import a12_0x13dbc9 from'chalk';export function printAuthError(_0x232c0c,_0x45be0c=![],_0x411392){const _0x5621e3=a12_0x3ede,_0x29682d=_0x232c0c[_0x5621e3(0x120)]?.['detail']||_0x232c0c[_0x5621e3(0x100)];console['error'](a12_0x13dbc9['red'](_0x5621e3(0x12a))),console[_0x5621e3(0x128)](a12_0x13dbc9['red'](_0x5621e3(0x11d)+_0x29682d));if(_0x45be0c){const _0x480741=_0x411392?'\x20--profile\x20'+_0x411392:'';console[_0x5621e3(0x128)]('\x0a'+a12_0x13dbc9['dim']('To\x20set\x20up\x20authentication:')),console[_0x5621e3(0x128)]('\x20\x20'+a12_0x13dbc9[_0x5621e3(0x10f)](_0x5621e3(0xfc)+_0x480741)+'\x0a'),console[_0x5621e3(0x128)](''+a12_0x13dbc9['dim'](_0x5621e3(0x119))),console['error']('\x20\x20'+a12_0x13dbc9['cyan'](_0x5621e3(0x11e)+_0x480741));}}export class BaseCommand{['validateGlobalOptions'](_0x2ebf97){const _0x542b19=a12_0x3ede,{options:_0x1a2f45}=_0x2ebf97,_0x50cd09=_0x1a2f45['limit'];if(_0x50cd09!==undefined){const _0x4a3c0d=typeof _0x50cd09===_0x542b19(0xff)?_0x50cd09:parseInt(_0x50cd09,0xa);if(isNaN(_0x4a3c0d))return _0x542b19(0x112)+_0x50cd09+_0x542b19(0x105);const _0x462d66=validateLimitOption(_0x4a3c0d);if(!_0x462d66['isValid'])return _0x462d66['error'];_0x2ebf97[_0x542b19(0x12d)][_0x542b19(0x116)]=_0x462d66[_0x542b19(0x113)];}return undefined;}[a12_0x4dbc70(0x11f)](_0x3b08f1){return undefined;}async[a12_0x4dbc70(0x111)](_0x4263e3){const _0x1e6ff6=a12_0x4dbc70;try{const _0x1831e3=this[_0x1e6ff6(0xfe)](_0x4263e3);if(_0x1831e3)return console[_0x1e6ff6(0x128)](_0x1e6ff6(0x10e)+_0x1831e3),0x1;const _0x58df6e=this['validate'](_0x4263e3);if(_0x58df6e){const _0x1ed5c0=/^\s*(Usage|Note|Warning|Error):/i['test'](_0x58df6e);return _0x1ed5c0?console['error'](_0x58df6e):console[_0x1e6ff6(0x128)](_0x1e6ff6(0x10e)+_0x58df6e),0x1;}const _0x57b612=await this[_0x1e6ff6(0x104)](_0x4263e3);return _0x57b612??0x0;}catch(_0x5dc361){if(_0x5dc361 instanceof Error){if(_0x5dc361 instanceof HTTPClientError&&_0x5dc361[_0x1e6ff6(0x102)]===0x191){const _0x2cec58=_0x4263e3[_0x1e6ff6(0x12d)][_0x1e6ff6(0x114)];printAuthError(_0x5dc361,!![],_0x2cec58);if(_0x5dc361[_0x1e6ff6(0x106)]){const _0x55f2f7=Logger['of'](_0x1e6ff6(0x11a));_0x55f2f7['debug'](_0x1e6ff6(0x11b)),_0x55f2f7[_0x1e6ff6(0x10b)](_0x5dc361['stack']);}return 0x1;}console[_0x1e6ff6(0x128)](a12_0x13dbc9[_0x1e6ff6(0xfd)](_0x1e6ff6(0x10e)+_0x5dc361[_0x1e6ff6(0x100)]));_0x5dc361 instanceof SDKError&&_0x5dc361['helpText']&&console[_0x1e6ff6(0x128)](a12_0x13dbc9[_0x1e6ff6(0x10c)](_0x5dc361[_0x1e6ff6(0x107)]));const _0x124442=_0x5dc361 instanceof SDKError&&_0x5dc361[_0x1e6ff6(0x110)]===ErrorCategory['USER_ERROR'];_0x5dc361[_0x1e6ff6(0x106)]&&!_0x124442&&console[_0x1e6ff6(0x128)](_0x1e6ff6(0x129)+_0x5dc361['stack']);}else console[_0x1e6ff6(0x128)](_0x1e6ff6(0x10e)+String(_0x5dc361));return 0x1;}}}export class CommandRegistry{[a12_0x4dbc70(0x126)]=new Map();[a12_0x4dbc70(0x12c)](_0x3faed3){const _0x480518=a12_0x4dbc70;if(this[_0x480518(0x126)][_0x480518(0x118)](_0x3faed3['name']))throw new Error('Command\x20\x27'+_0x3faed3['name']+_0x480518(0x127));this[_0x480518(0x126)][_0x480518(0x101)](_0x3faed3['name'],_0x3faed3);}[a12_0x4dbc70(0x10a)](_0x155fb1){return this['commands']['get'](_0x155fb1);}['getAll'](){const _0x381cdc=a12_0x4dbc70;return Array[_0x381cdc(0x10d)](this['commands'][_0x381cdc(0xfb)]());}['has'](_0x351523){const _0x456578=a12_0x4dbc70;return this[_0x456578(0x126)][_0x456578(0x118)](_0x351523);}}export const registry=new CommandRegistry();function a12_0x2b3d(){const _0xa41c3a=['debug','yellow','from','Error:\x20','cyan','category','run','Invalid\x20limit\x20value:\x20','value','profile','121916zNFkUX','limit','9123Gpklps','has','To\x20check\x20your\x20current\x20auth\x20status:','command','Authentication\x20error\x20stack\x20trace:','5ikunfc','Reason:\x20','tdx\x20auth','validate','problemDetails','8WCwAZy','16080372MKvPtc','11UNFVBN','9fpTzMp','2118860IagBXW','commands','\x27\x20is\x20already\x20registered','error','\x0aStack\x20trace:\x0a','Authentication\x20failed','2474886vYXdie','register','options','values','tdx\x20auth\x20setup','red','validateGlobalOptions','number','message','set','status','464429UaWdqH','execute','.\x20Must\x20be\x20a\x20number.','stack','helpText','8721090OBGBAH','44UkIkMG','get'];a12_0x2b3d=function(){return _0xa41c3a;};return a12_0x2b3d();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function a13_0xea10(_0x567c51,_0x570009){_0x567c51=_0x567c51-0x165;const _0x592ad1=a13_0x592a();let _0xea10be=_0x592ad1[_0x567c51];return _0xea10be;}const a13_0x1d6b2a=a13_0xea10;(function(_0x4864ab,_0x5abea0){const _0x3f719e=a13_0xea10,_0x506603=_0x4864ab();while(!![]){try{const _0x1a9746=-parseInt(_0x3f719e(0x17e))/0x1*(-parseInt(_0x3f719e(0x168))/0x2)+parseInt(_0x3f719e(0x1cc))/0x3+-parseInt(_0x3f719e(0x18c))/0x4*(-parseInt(_0x3f719e(0x1a2))/0x5)+parseInt(_0x3f719e(0x1c9))/0x6*(-parseInt(_0x3f719e(0x196))/0x7)+-parseInt(_0x3f719e(0x194))/0x8*(parseInt(_0x3f719e(0x1b3))/0x9)+-parseInt(_0x3f719e(0x1ae))/0xa*(parseInt(_0x3f719e(0x1ac))/0xb)+parseInt(_0x3f719e(0x1ad))/0xc;if(_0x1a9746===_0x5abea0)break;else _0x506603['push'](_0x506603['shift']());}catch(_0x1c8fa8){_0x506603['push'](_0x506603['shift']());}}}(a13_0x592a,0x51e64));import{BaseCommand}from'./command.js';import{handleSDKOutput,handleSingleObjectOutput,isStructuredFormat,writeOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import{DEFAULT_LISTING_LIMIT,resolveLimit}from'../core/constants.js';import a13_0x373fe0 from'chalk';function normalizeSchemaForDisplay(_0x3f064d){const _0x565e9c=a13_0xea10,_0x1bd289=_0x3f064d['properties']||[],_0x16643e=_0x1bd289[_0x565e9c(0x1b6)](_0x4498c4=>_0x4498c4[_0x565e9c(0x1b1)]==='legacy_settings'&&_0x4498c4[_0x565e9c(0x185)]===_0x565e9c(0x1c5)&&_0x4498c4[_0x565e9c(0x199)]);if(_0x16643e?.[_0x565e9c(0x199)]){const _0x140d3e=_0x1bd289[_0x565e9c(0x173)](_0x24f554=>_0x24f554[_0x565e9c(0x1b1)]!==_0x565e9c(0x1c1)&&_0x24f554[_0x565e9c(0x1b1)]!==_0x565e9c(0x180));return[..._0x140d3e,..._0x16643e[_0x565e9c(0x199)]];}return _0x1bd289[_0x565e9c(0x173)](_0x3e7020=>_0x3e7020[_0x565e9c(0x1b1)]!=='legacy');}function printSchemaFields(_0x5795c7,_0x46f9b9){const _0x3a8c00=a13_0xea10,_0x4e9bf6='\x20\x20'[_0x3a8c00(0x1bf)](_0x46f9b9+0x1),_0x1ed61e='\x20\x20'[_0x3a8c00(0x1bf)](_0x46f9b9+0x2);for(const _0x4eba6d of _0x5795c7){if(!_0x4eba6d['name'])continue;const _0x2a472e=_0x4eba6d[_0x3a8c00(0x185)]===_0x3a8c00(0x1c5)&&_0x4eba6d[_0x3a8c00(0x199)]&&_0x4eba6d[_0x3a8c00(0x199)][_0x3a8c00(0x193)]>0x0&&_0x4eba6d[_0x3a8c00(0x1b1)]!==_0x3a8c00(0x180);let _0x419fb4=''+_0x4e9bf6+a13_0x373fe0['green'](_0x4eba6d['name']);_0x4eba6d[_0x3a8c00(0x1aa)]&&(_0x419fb4+=':\x20'+_0x4eba6d[_0x3a8c00(0x1aa)]);if(_0x4eba6d[_0x3a8c00(0x1bd)])_0x419fb4+=a13_0x373fe0[_0x3a8c00(0x19d)]('\x20['+_0x4eba6d[_0x3a8c00(0x1bd)]+']');else _0x2a472e&&(_0x419fb4+=a13_0x373fe0[_0x3a8c00(0x19d)](_0x3a8c00(0x1a1)));console[_0x3a8c00(0x1c6)](_0x419fb4);_0x4eba6d['description']&&console[_0x3a8c00(0x1c6)](''+_0x1ed61e+a13_0x373fe0['dim'](_0x4eba6d[_0x3a8c00(0x1b8)]));if(_0x4eba6d[_0x3a8c00(0x174)]){const _0x3f28b5=_0x4eba6d['enumeration'][_0x3a8c00(0x1a0)](_0x2b2da2=>typeof _0x2b2da2==='object'&&'value'in _0x2b2da2?_0x2b2da2['value']:_0x2b2da2)[_0x3a8c00(0x18e)](',\x20');console[_0x3a8c00(0x1c6)](_0x1ed61e+_0x3a8c00(0x186)+a13_0x373fe0['yellow'](_0x3f28b5));}_0x4eba6d[_0x3a8c00(0x19c)]!==undefined&&console['log'](_0x1ed61e+'Default:\x20'+a13_0x373fe0[_0x3a8c00(0x19e)](String(_0x4eba6d[_0x3a8c00(0x19c)])));if(_0x4eba6d['minimum']!==undefined||_0x4eba6d[_0x3a8c00(0x16b)]!==undefined){const _0x5d9fae=_0x4eba6d[_0x3a8c00(0x16d)]!==undefined&&_0x4eba6d['maximum']!==undefined?_0x4eba6d[_0x3a8c00(0x16d)]+_0x3a8c00(0x172)+_0x4eba6d['maximum']:_0x4eba6d[_0x3a8c00(0x16d)]!==undefined?_0x3a8c00(0x19f)+_0x4eba6d[_0x3a8c00(0x16d)]:_0x3a8c00(0x1ab)+_0x4eba6d['maximum'];console['log'](_0x1ed61e+_0x3a8c00(0x198)+a13_0x373fe0[_0x3a8c00(0x19e)](_0x5d9fae));}if(_0x4eba6d[_0x3a8c00(0x1bc)]){const _0x243436=Object[_0x3a8c00(0x17d)](_0x4eba6d[_0x3a8c00(0x1bc)])[_0x3a8c00(0x1a0)](([_0xc8193e,_0x134c1a])=>_0xc8193e+'='+JSON[_0x3a8c00(0x175)](_0x134c1a))['join'](',\x20');console[_0x3a8c00(0x1c6)](''+_0x1ed61e+a13_0x373fe0['dim'](_0x3a8c00(0x1af)+_0x243436));}_0x2a472e&&_0x4eba6d['properties']&&printSchemaFields(_0x4eba6d[_0x3a8c00(0x199)],_0x46f9b9+0x1);}}export class ConnectionListCommand extends BaseCommand{[a13_0x1d6b2a(0x1b1)]=a13_0x1d6b2a(0x197);[a13_0x1d6b2a(0x1b8)]=a13_0x1d6b2a(0x1a4);async[a13_0x1d6b2a(0x176)](_0x542813){const _0x22c262=a13_0x1d6b2a,{options:_0x1df34f,tdx:_0xf013db}=_0x542813;_0x1df34f['verbose']&&console[_0x22c262(0x184)](_0x22c262(0x1c2)+_0x1df34f[_0x22c262(0x19b)]);const _0xdf0400=resolveLimit(_0x1df34f[_0x22c262(0x1cd)],DEFAULT_LISTING_LIMIT),_0x24385d=await withSpinner(_0x22c262(0x181),()=>_0xf013db[_0x22c262(0x1bb)][_0x22c262(0x18d)](),{'verbose':_0x1df34f[_0x22c262(0x1c7)]}),_0x286c4e=_0x24385d[_0x22c262(0x1a5)];console[_0x22c262(0x184)]('✔\x20Found\x20'+_0x286c4e['length']+'\x20connection'+(_0x286c4e[_0x22c262(0x193)]!==0x1?'s':''));if(isStructuredFormat(_0x1df34f)){const _0x436ea1=_0x286c4e['slice'](0x0,_0xdf0400);await handleSDKOutput(_0x436ea1,{..._0x1df34f,'limit':_0xdf0400});}else{const _0x559143=_0x286c4e['length']>0x0?Math[_0x22c262(0x1a8)](..._0x286c4e[_0x22c262(0x1a0)](_0x2796aa=>_0x2796aa[_0x22c262(0x185)][_0x22c262(0x193)])):0x0,_0x1af288=[];for(const _0xa67c31 of _0x286c4e){const _0x4a2377=a13_0x373fe0[_0x22c262(0x1c0)](_0xa67c31[_0x22c262(0x185)]['padStart'](_0x559143)),_0xeab6d1=_0xa67c31[_0x22c262(0x177)]?.[_0x22c262(0x1b1)]?_0x22c262(0x172)+a13_0x373fe0[_0x22c262(0x19d)](_0xa67c31[_0x22c262(0x177)][_0x22c262(0x1b1)]):'';_0x1af288[_0x22c262(0x19a)](_0x4a2377+'\x20\x20'+_0xa67c31[_0x22c262(0x1b1)]+_0xeab6d1);}await writeOutput(_0x1af288[_0x22c262(0x18e)]('\x0a'),_0x1df34f[_0x22c262(0x1c8)],'table');}return 0x0;}}function a13_0x592a(){const _0x2e627f=['8CCObdJ','Name:\x20','7iPxdjw','connection:list','Range:\x20','properties','push','site','default_value','dim','blue','>=\x20','map','\x20[record]','5YXhvRn','options','List\x20all\x20result\x20output\x20connections','data','✔\x20Found\x20schema\x20for\x20connector\x20type:\x20','credential','max','validate','title','<=\x20','121EthYFj','3698124uIroNx','170650KCUuLs','Show\x20when:\x20','Show\x20connection-level\x20settings\x20(credentials,\x20authentication)','name','localeCompare','5345487Gvcyde','yellow','getOutputSchema','find','bold','description','settings','connection:show','connection','criteria','input','connection:types','repeat','cyan','legacy','Site:\x20','\x0aConnector:\x20','List\x20available\x20connector\x20types','record','log','verbose','output','3191124nNtniH','table','listTypes','1363479hSYiuk','limit','\x20\x20\x20\x20','getMetadata','sort','\x20connector\x20type','202922yLrvSs','resolve','Usage:\x20tdx\x20connection\x20show\x20<name>\x0a\x0aArguments:\x0a\x20\x20<name>\x20\x20\x20\x20Connection\x20name\x0a\x0aExamples:\x0a\x20\x20tdx\x20connection\x20show\x20my-s3-connection\x0a\x20\x20tdx\x20connection\x20show\x20\x22My\x20Salesforce\x20Connection\x22','maximum','Fetching\x20connection\x20\x27','minimum','Treating\x20\x27','hint','\x20\x20\x20\x20Default:\x20','\x0aNo\x20fields\x20defined\x20in\x20schema','\x20-\x20','filter','enumeration','stringify','execute','owner','Fetching\x20settings\x20for\x20connector\x20type:\x20','\x27\x20(type:\x20','connection:schema','Usage:\x20tdx\x20connection\x20settings\x20<type>\x0a\x0aArguments:\x0a\x20\x20<type>\x20\x20\x20\x20Connector\x20type\x20(e.g.,\x20\x27salesforce\x27,\x20\x27rest\x27,\x20\x27s3\x27)\x0a\x0aExamples:\x0a\x20\x20tdx\x20connection\x20settings\x20rest\x0a\x20\x20tdx\x20connection\x20settings\x20salesforce\x0a\x20\x20tdx\x20connection\x20settings\x20s3\x0a\x0aNote:\x20This\x20shows\x20settings\x20for\x20creating/configuring\x20a\x20connection.\x0aFor\x20activation\x20output\x20settings,\x20use\x20\x27tdx\x20connection\x20schema\x20<type>\x27.\x0aUse\x20\x27tdx\x20connection\x20types\x27\x20to\x20list\x20available\x20connector\x20types.','label','entries','5CUpVpZ','\x27...','legacy_settings','Listing\x20connections...','\x27\x20as\x20connector\x20type','Fetching\x20schema\x20for\x20\x27','error','type','Options:\x20','Show\x20connector\x20output\x20schema\x20for\x20connector_config\x20validation','\x0aConnection:\x20','Type:\x20','\x0aAvailable\x20fields:','findByName','1515988RZiqnP','list','join','Resolving\x20connector\x20type\x20or\x20name:\x20','\x20\x20\x20\x20Options:\x20','No\x20available\x20fields\x20for\x20this\x20connector','✔\x20Resolved\x20\x27','length'];a13_0x592a=function(){return _0x2e627f;};return a13_0x592a();}export class ConnectionShowCommand extends BaseCommand{[a13_0x1d6b2a(0x1b1)]=a13_0x1d6b2a(0x1ba);[a13_0x1d6b2a(0x1b8)]='Show\x20connection\x20details';[a13_0x1d6b2a(0x1a9)](_0x44d6b1){const _0x9a1b1a=a13_0x1d6b2a,{args:_0x3088cc}=_0x44d6b1;if(!_0x3088cc[0x0])return _0x9a1b1a(0x16a);return undefined;}async[a13_0x1d6b2a(0x176)](_0x4d6da1){const _0x2535d5=a13_0x1d6b2a,{options:_0x323ec5,args:_0xc1d683,tdx:_0x29b722}=_0x4d6da1,_0x541ad4=_0xc1d683[0x0];_0x323ec5[_0x2535d5(0x1c7)]&&(console[_0x2535d5(0x184)](_0x2535d5(0x1c2)+_0x323ec5[_0x2535d5(0x19b)]),console[_0x2535d5(0x184)]('Looking\x20up\x20connection:\x20'+_0x541ad4));const _0x42c67f=await withSpinner(_0x2535d5(0x16c)+_0x541ad4+_0x2535d5(0x17f),()=>_0x29b722['connection'][_0x2535d5(0x169)](_0x541ad4),{'verbose':_0x323ec5[_0x2535d5(0x1c7)]}),_0x50d21e=_0x42c67f[_0x2535d5(0x1a5)];return console[_0x2535d5(0x184)]('✔\x20Found\x20connection:\x20'+_0x50d21e[_0x2535d5(0x1b1)]),await handleSingleObjectOutput(_0x50d21e,_0x323ec5),0x0;}}export class ConnectionSchemaCommand extends BaseCommand{['name']=a13_0x1d6b2a(0x17a);[a13_0x1d6b2a(0x1b8)]=a13_0x1d6b2a(0x187);['validate'](_0x5934c0){const {args:_0x599f9a}=_0x5934c0;if(!_0x599f9a[0x0])return'Usage:\x20tdx\x20connection\x20schema\x20<type-or-name>\x0a\x0aArguments:\x0a\x20\x20<type-or-name>\x20\x20\x20\x20Connector\x20type\x20(e.g.,\x20\x27salesforce\x27,\x20\x27pgsql\x27,\x20\x27s3\x27)\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20or\x20connection\x20name\x20(e.g.,\x20\x27my-salesforce-connection\x27)\x0a\x0aExamples:\x0a\x20\x20tdx\x20connection\x20schema\x20salesforce\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20By\x20connector\x20type\x0a\x20\x20tdx\x20connection\x20schema\x20my-s3-connection\x20\x20\x20\x20\x20#\x20By\x20connection\x20name\x0a\x20\x20tdx\x20connection\x20schema\x20pgsql\x0a\x0aUse\x20\x27tdx\x20connection\x20types\x27\x20to\x20list\x20available\x20connector\x20types.\x0aUse\x20\x27tdx\x20connection\x20list\x27\x20to\x20list\x20available\x20connections.';return undefined;}async['execute'](_0x2b3f4d){const _0x30d5a8=a13_0x1d6b2a,{options:_0x2068c1,args:_0x101aa9,tdx:_0x39ddfa}=_0x2b3f4d,_0x20bebf=_0x101aa9[0x0];_0x2068c1[_0x30d5a8(0x1c7)]&&(console['error'](_0x30d5a8(0x1c2)+_0x2068c1[_0x30d5a8(0x19b)]),console[_0x30d5a8(0x184)](_0x30d5a8(0x18f)+_0x20bebf));let _0x51fe0d=_0x20bebf,_0x3a0a47;try{const _0x53168d=await _0x39ddfa['connection'][_0x30d5a8(0x18b)](_0x20bebf);_0x53168d&&(_0x51fe0d=_0x53168d[_0x30d5a8(0x185)],_0x3a0a47=_0x53168d['name'],_0x2068c1[_0x30d5a8(0x1c7)]&&console[_0x30d5a8(0x184)](_0x30d5a8(0x192)+_0x20bebf+'\x27\x20as\x20connection\x20name\x20→\x20type:\x20'+_0x51fe0d));}catch{_0x2068c1[_0x30d5a8(0x1c7)]&&console[_0x30d5a8(0x184)](_0x30d5a8(0x16e)+_0x20bebf+_0x30d5a8(0x182));}const _0x22aa31=await withSpinner(_0x30d5a8(0x183)+_0x51fe0d+'\x27...',()=>_0x39ddfa[_0x30d5a8(0x1bb)]['getOutputSchema'](_0x51fe0d),{'verbose':_0x2068c1[_0x30d5a8(0x1c7)]}),_0x421c14=_0x22aa31['data'];_0x3a0a47?console[_0x30d5a8(0x184)]('✔\x20Found\x20schema\x20for\x20connection\x20\x27'+_0x3a0a47+_0x30d5a8(0x179)+_0x51fe0d+')'):console[_0x30d5a8(0x184)](_0x30d5a8(0x1a6)+_0x51fe0d);if(isStructuredFormat(_0x2068c1))await handleSingleObjectOutput(_0x421c14,_0x2068c1);else{const _0x5e39b8=normalizeSchemaForDisplay(_0x421c14);_0x3a0a47?(console[_0x30d5a8(0x1c6)](_0x30d5a8(0x188)+a13_0x373fe0[_0x30d5a8(0x1c0)](_0x3a0a47)),console[_0x30d5a8(0x1c6)](_0x30d5a8(0x189)+a13_0x373fe0[_0x30d5a8(0x19d)](_0x51fe0d))):console[_0x30d5a8(0x1c6)]('\x0aConnector:\x20'+a13_0x373fe0['cyan'](_0x51fe0d)),_0x5e39b8['length']>0x0?(console[_0x30d5a8(0x1c6)](a13_0x373fe0['bold'](_0x30d5a8(0x18a))),printSchemaFields(_0x5e39b8,0x0)):console['log'](a13_0x373fe0['dim'](_0x30d5a8(0x171)));}return 0x0;}}export class ConnectionTypesCommand extends BaseCommand{[a13_0x1d6b2a(0x1b1)]=a13_0x1d6b2a(0x1be);[a13_0x1d6b2a(0x1b8)]=a13_0x1d6b2a(0x1c4);async['execute'](_0xf59087){const _0x160e8a=a13_0x1d6b2a,{options:_0x33e2b7,tdx:_0x5bc3c8}=_0xf59087;_0x33e2b7['verbose']&&console[_0x160e8a(0x184)]('Site:\x20'+_0x33e2b7[_0x160e8a(0x19b)]);const _0x499ff1=await withSpinner('Listing\x20connector\x20types...',()=>_0x5bc3c8[_0x160e8a(0x1bb)][_0x160e8a(0x1cb)](),{'verbose':_0x33e2b7[_0x160e8a(0x1c7)]}),_0x4ddc14=_0x499ff1[_0x160e8a(0x1a5)][_0x160e8a(0x166)]((_0x5416b1,_0x1e4893)=>_0x5416b1[_0x160e8a(0x185)][_0x160e8a(0x1b2)](_0x1e4893[_0x160e8a(0x185)]));console[_0x160e8a(0x184)]('✔\x20Found\x20'+_0x4ddc14['length']+_0x160e8a(0x167)+(_0x4ddc14[_0x160e8a(0x193)]!==0x1?'s':''));if(isStructuredFormat(_0x33e2b7))await handleSDKOutput(_0x4ddc14,_0x33e2b7);else{const _0x20fb84=_0x4ddc14['length']>0x0?Math[_0x160e8a(0x1a8)](..._0x4ddc14['map'](_0x57c9cb=>_0x57c9cb[_0x160e8a(0x185)]['length'])):0x0,_0x232375=[];for(const _0x39137b of _0x4ddc14){const _0x440a65=a13_0x373fe0['cyan'](_0x39137b[_0x160e8a(0x185)]['padStart'](_0x20fb84));_0x232375['push'](_0x440a65+'\x20\x20'+_0x39137b['name']);}await writeOutput(_0x232375[_0x160e8a(0x18e)]('\x0a'),_0x33e2b7[_0x160e8a(0x1c8)],_0x160e8a(0x1ca));}return 0x0;}}export class ConnectionSettingsCommand extends BaseCommand{[a13_0x1d6b2a(0x1b1)]='connection:settings';[a13_0x1d6b2a(0x1b8)]=a13_0x1d6b2a(0x1b0);['validate'](_0x2d44c9){const _0x196a22=a13_0x1d6b2a,{args:_0x4d11b5}=_0x2d44c9;if(!_0x4d11b5[0x0])return _0x196a22(0x17b);return undefined;}async[a13_0x1d6b2a(0x176)](_0x181b09){const _0x1a51c2=a13_0x1d6b2a,{options:_0x53a923,args:_0x150adb,tdx:_0x61bc44}=_0x181b09,_0x545c20=_0x150adb[0x0];_0x53a923['verbose']&&(console[_0x1a51c2(0x184)](_0x1a51c2(0x1c2)+_0x53a923[_0x1a51c2(0x19b)]),console[_0x1a51c2(0x184)](_0x1a51c2(0x178)+_0x545c20));const _0x26e7f2=await withSpinner('Fetching\x20settings\x20for\x20\x27'+_0x545c20+_0x1a51c2(0x17f),()=>_0x61bc44['connection'][_0x1a51c2(0x165)](_0x545c20),{'verbose':_0x53a923[_0x1a51c2(0x1c7)]}),_0xd99712=_0x26e7f2[_0x1a51c2(0x1a5)];console[_0x1a51c2(0x184)]('✔\x20Found\x20settings\x20for\x20connector\x20type:\x20'+_0x545c20);if(isStructuredFormat(_0x53a923))await handleSingleObjectOutput(_0xd99712,_0x53a923);else{console[_0x1a51c2(0x1c6)](_0x1a51c2(0x1c3)+a13_0x373fe0['cyan'](_0x545c20)),console[_0x1a51c2(0x1c6)](_0x1a51c2(0x195)+_0xd99712['name']);const _0x1d3698=_0xd99712[_0x1a51c2(0x1b9)]||[],_0xd122a2=_0x1d3698[_0x1a51c2(0x173)](_0x551816=>_0x551816[_0x1a51c2(0x1a7)]);_0xd122a2[_0x1a51c2(0x193)]>0x0&&(console[_0x1a51c2(0x1c6)](a13_0x373fe0[_0x1a51c2(0x1b7)]('\x0aCredential\x20settings:')),printMetadataSettings(_0xd122a2));let _0x4a716b=![];try{const _0x4b7c9a=await _0x61bc44[_0x1a51c2(0x1bb)][_0x1a51c2(0x1b5)](_0x545c20),_0x27d487=normalizeSchemaForDisplay(_0x4b7c9a);_0x27d487['length']>0x0&&(console[_0x1a51c2(0x1c6)](a13_0x373fe0['bold']('\x0aAvailable\x20fields:')),printSchemaFields(_0x27d487,0x0),_0x4a716b=!![]);}catch{const _0x165b27=_0x1d3698[_0x1a51c2(0x173)](_0x4d69d3=>!_0x4d69d3[_0x1a51c2(0x1a7)]);_0x165b27['length']>0x0&&(console[_0x1a51c2(0x1c6)](a13_0x373fe0[_0x1a51c2(0x1b7)](_0x1a51c2(0x18a))),printMetadataSettings(_0x165b27),_0x4a716b=!![]);}!_0x4a716b&&_0x53a923['verbose']&&console[_0x1a51c2(0x184)](a13_0x373fe0['dim'](_0x1a51c2(0x191))),_0xd122a2['length']===0x0&&console[_0x1a51c2(0x1c6)](a13_0x373fe0[_0x1a51c2(0x19d)]('\x0aNo\x20credential\x20settings\x20defined'));}return 0x0;}}function printMetadataSettings(_0x17b09d){const _0x51b9a3=a13_0x1d6b2a;for(const _0x45d226 of _0x17b09d){if(!_0x45d226['name'])continue;if(_0x45d226['hidden'])continue;let _0x3a7283='\x20\x20'+a13_0x373fe0['green'](_0x45d226['name']);_0x45d226['label']&&(_0x3a7283+=':\x20'+_0x45d226[_0x51b9a3(0x17c)]);_0x45d226[_0x51b9a3(0x185)]&&(_0x3a7283+=a13_0x373fe0[_0x51b9a3(0x19d)]('\x20['+_0x45d226[_0x51b9a3(0x185)]+']'));console[_0x51b9a3(0x1c6)](_0x3a7283);_0x45d226[_0x51b9a3(0x16f)]&&console[_0x51b9a3(0x1c6)](_0x51b9a3(0x1ce)+a13_0x373fe0[_0x51b9a3(0x19d)](_0x45d226[_0x51b9a3(0x16f)]));if(_0x45d226[_0x51b9a3(0x1a3)]){const _0x3379e8=_0x45d226[_0x51b9a3(0x1a3)]['map'](_0x1a6963=>_0x1a6963['value'])[_0x51b9a3(0x18e)](',\x20');console[_0x51b9a3(0x1c6)](_0x51b9a3(0x190)+a13_0x373fe0[_0x51b9a3(0x1b4)](_0x3379e8));}_0x45d226[_0x51b9a3(0x19c)]!==undefined&&_0x45d226['default_value']!==null&&console[_0x51b9a3(0x1c6)](_0x51b9a3(0x170)+a13_0x373fe0[_0x51b9a3(0x19e)](String(_0x45d226[_0x51b9a3(0x19c)])));if(_0x45d226[_0x51b9a3(0x1bc)]){const _0x841d76=Object[_0x51b9a3(0x17d)](_0x45d226[_0x51b9a3(0x1bc)])[_0x51b9a3(0x1a0)](([_0xf2cd25,_0x1ee3c2])=>_0xf2cd25+'='+JSON['stringify'](_0x1ee3c2))[_0x51b9a3(0x18e)](',\x20');console['log']('\x20\x20\x20\x20'+a13_0x373fe0[_0x51b9a3(0x19d)](_0x51b9a3(0x1af)+_0x841d76));}}}
|
|
1
|
+
const a13_0x327349=a13_0x133a;(function(_0x395ae0,_0x3dab17){const _0x941dc=a13_0x133a,_0x1988d3=_0x395ae0();while(!![]){try{const _0x27995f=parseInt(_0x941dc(0x19b))/0x1+parseInt(_0x941dc(0x1c8))/0x2+-parseInt(_0x941dc(0x193))/0x3+parseInt(_0x941dc(0x1b7))/0x4*(parseInt(_0x941dc(0x198))/0x5)+parseInt(_0x941dc(0x1df))/0x6*(parseInt(_0x941dc(0x19c))/0x7)+parseInt(_0x941dc(0x197))/0x8*(-parseInt(_0x941dc(0x1bf))/0x9)+-parseInt(_0x941dc(0x1bb))/0xa;if(_0x27995f===_0x3dab17)break;else _0x1988d3['push'](_0x1988d3['shift']());}catch(_0x7bb201){_0x1988d3['push'](_0x1988d3['shift']());}}}(a13_0x3c0e,0x1d468));function a13_0x3c0e(){const _0x576f7a=['\x0aConnection:\x20','credential','find','verbose','✔\x20Resolved\x20\x27','\x0aConnector:\x20','Usage:\x20tdx\x20connection\x20show\x20<name>\x0a\x0aArguments:\x0a\x20\x20<name>\x20\x20\x20\x20Connection\x20name\x0a\x0aExamples:\x0a\x20\x20tdx\x20connection\x20show\x20my-s3-connection\x0a\x20\x20tdx\x20connection\x20show\x20\x22My\x20Salesforce\x20Connection\x22','\x20\x20\x20\x20Default:\x20','repeat','hidden','Fetching\x20settings\x20for\x20connector\x20type:\x20','Show\x20connection-level\x20settings\x20(credentials,\x20authentication)','Listing\x20connector\x20types...','object','findByName','join','connection:settings','criteria','Show\x20when:\x20','label','hint','entries','\x20\x20\x20\x20Options:\x20','Show\x20connection\x20details','cyan','filter','7228daNwFT','Range:\x20','\x27...','✔\x20Found\x20schema\x20for\x20connector\x20type:\x20','1576310KogYux','connection','enumeration','execute','35577FoYqyk','options','Usage:\x20tdx\x20connection\x20settings\x20<type>\x0a\x0aArguments:\x0a\x20\x20<type>\x20\x20\x20\x20Connector\x20type\x20(e.g.,\x20\x27salesforce\x27,\x20\x27rest\x27,\x20\x27s3\x27)\x0a\x0aExamples:\x0a\x20\x20tdx\x20connection\x20settings\x20rest\x0a\x20\x20tdx\x20connection\x20settings\x20salesforce\x0a\x20\x20tdx\x20connection\x20settings\x20s3\x0a\x0aNote:\x20This\x20shows\x20settings\x20for\x20creating/configuring\x20a\x20connection.\x0aFor\x20activation\x20output\x20settings,\x20use\x20\x27tdx\x20connection\x20schema\x20<type>\x27.\x0aUse\x20\x27tdx\x20connection\x20types\x27\x20to\x20list\x20available\x20connector\x20types.','validate','Default:\x20','blue','name','limit','type','225420ilTEuU','getOutputSchema','input','legacy','log','>=\x20','data','Treating\x20\x27','<=\x20','\x20[record]','max','\x0aNo\x20credential\x20settings\x20defined','length','Usage:\x20tdx\x20connection\x20schema\x20<type-or-name>\x0a\x0aArguments:\x0a\x20\x20<type-or-name>\x20\x20\x20\x20Connector\x20type\x20(e.g.,\x20\x27salesforce\x27,\x20\x27pgsql\x27,\x20\x27s3\x27)\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20or\x20connection\x20name\x20(e.g.,\x20\x27my-salesforce-connection\x27)\x0a\x0aExamples:\x0a\x20\x20tdx\x20connection\x20schema\x20salesforce\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20By\x20connector\x20type\x0a\x20\x20tdx\x20connection\x20schema\x20my-s3-connection\x20\x20\x20\x20\x20#\x20By\x20connection\x20name\x0a\x20\x20tdx\x20connection\x20schema\x20pgsql\x0a\x0aUse\x20\x27tdx\x20connection\x20types\x27\x20to\x20list\x20available\x20connector\x20types.\x0aUse\x20\x27tdx\x20connection\x20list\x27\x20to\x20list\x20available\x20connections.','connection:list','site','✔\x20Found\x20settings\x20for\x20connector\x20type:\x20','yellow','\x20-\x20','record','No\x20available\x20fields\x20for\x20this\x20connector','owner','connection:types','90ECWXzo','\x27\x20as\x20connector\x20type','Show\x20connector\x20output\x20schema\x20for\x20connector_config\x20validation','list','description','Fetching\x20schema\x20for\x20\x27','\x27\x20(type:\x20','output','\x20connection','legacy_settings','\x20\x20\x20\x20','dim','✔\x20Found\x20schema\x20for\x20connection\x20\x27','Site:\x20','Fetching\x20settings\x20for\x20\x27','minimum','error','\x20connector\x20type','push','stringify','\x0aAvailable\x20fields:','Type:\x20','slice','listTypes','title','Looking\x20up\x20connection:\x20','default_value','✔\x20Found\x20','✔\x20Found\x20connection:\x20','properties','padStart','bold','108789PIIoHz','Listing\x20connections...','Fetching\x20connection\x20\x27','value','440XaoSjC','610giEoIl','map','\x0aCredential\x20settings:','162807fMtiHt','16450BkYaDs'];a13_0x3c0e=function(){return _0x576f7a;};return a13_0x3c0e();}import{BaseCommand}from'./command.js';import{handleSDKOutput,handleSingleObjectOutput,isStructuredFormat,writeOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import{DEFAULT_LISTING_LIMIT,resolveLimit}from'../core/constants.js';import a13_0x15753f from'chalk';function normalizeSchemaForDisplay(_0x59b417){const _0x350eaa=a13_0x133a,_0x41c34b=_0x59b417[_0x350eaa(0x1fc)]||[],_0x22878c=_0x41c34b[_0x350eaa(0x19f)](_0x4506eb=>_0x4506eb[_0x350eaa(0x1c5)]===_0x350eaa(0x1e8)&&_0x4506eb['type']===_0x350eaa(0x1db)&&_0x4506eb[_0x350eaa(0x1fc)]);if(_0x22878c?.[_0x350eaa(0x1fc)]){const _0x42b146=_0x41c34b[_0x350eaa(0x1b6)](_0x1fd229=>_0x1fd229[_0x350eaa(0x1c5)]!=='legacy'&&_0x1fd229['name']!==_0x350eaa(0x1e8));return[..._0x42b146,..._0x22878c[_0x350eaa(0x1fc)]];}return _0x41c34b['filter'](_0x540f5d=>_0x540f5d[_0x350eaa(0x1c5)]!==_0x350eaa(0x1cb));}function a13_0x133a(_0xdc52ed,_0x5de44b){_0xdc52ed=_0xdc52ed-0x192;const _0x3c0e=a13_0x3c0e();let _0x133ac0=_0x3c0e[_0xdc52ed];return _0x133ac0;}function printSchemaFields(_0x5af433,_0x3c40ee){const _0x1b96a8=a13_0x133a,_0x249d52='\x20\x20'['repeat'](_0x3c40ee+0x1),_0x3b7bdb='\x20\x20'[_0x1b96a8(0x1a5)](_0x3c40ee+0x2);for(const _0x21df57 of _0x5af433){if(!_0x21df57[_0x1b96a8(0x1c5)])continue;const _0x481a63=_0x21df57[_0x1b96a8(0x1c7)]===_0x1b96a8(0x1db)&&_0x21df57[_0x1b96a8(0x1fc)]&&_0x21df57[_0x1b96a8(0x1fc)][_0x1b96a8(0x1d4)]>0x0&&_0x21df57[_0x1b96a8(0x1c5)]!==_0x1b96a8(0x1e8);let _0x560511=''+_0x249d52+a13_0x15753f['green'](_0x21df57[_0x1b96a8(0x1c5)]);_0x21df57[_0x1b96a8(0x1f7)]&&(_0x560511+=':\x20'+_0x21df57[_0x1b96a8(0x1f7)]);if(_0x21df57['input'])_0x560511+=a13_0x15753f[_0x1b96a8(0x1ea)]('\x20['+_0x21df57[_0x1b96a8(0x1ca)]+']');else _0x481a63&&(_0x560511+=a13_0x15753f[_0x1b96a8(0x1ea)](_0x1b96a8(0x1d1)));console[_0x1b96a8(0x1cc)](_0x560511);_0x21df57['description']&&console[_0x1b96a8(0x1cc)](''+_0x3b7bdb+a13_0x15753f[_0x1b96a8(0x1ea)](_0x21df57[_0x1b96a8(0x1e3)]));if(_0x21df57[_0x1b96a8(0x1bd)]){const _0x23bd5a=_0x21df57[_0x1b96a8(0x1bd)]['map'](_0x46f807=>typeof _0x46f807===_0x1b96a8(0x1aa)&&_0x1b96a8(0x196)in _0x46f807?_0x46f807[_0x1b96a8(0x196)]:_0x46f807)['join'](',\x20');console[_0x1b96a8(0x1cc)](_0x3b7bdb+'Options:\x20'+a13_0x15753f[_0x1b96a8(0x1d9)](_0x23bd5a));}_0x21df57['default_value']!==undefined&&console['log'](_0x3b7bdb+_0x1b96a8(0x1c3)+a13_0x15753f[_0x1b96a8(0x1c4)](String(_0x21df57[_0x1b96a8(0x1f9)])));if(_0x21df57[_0x1b96a8(0x1ee)]!==undefined||_0x21df57['maximum']!==undefined){const _0x4f10c0=_0x21df57[_0x1b96a8(0x1ee)]!==undefined&&_0x21df57['maximum']!==undefined?_0x21df57[_0x1b96a8(0x1ee)]+_0x1b96a8(0x1da)+_0x21df57['maximum']:_0x21df57['minimum']!==undefined?_0x1b96a8(0x1cd)+_0x21df57[_0x1b96a8(0x1ee)]:_0x1b96a8(0x1d0)+_0x21df57['maximum'];console[_0x1b96a8(0x1cc)](_0x3b7bdb+_0x1b96a8(0x1b8)+a13_0x15753f[_0x1b96a8(0x1c4)](_0x4f10c0));}if(_0x21df57['criteria']){const _0x1dca92=Object[_0x1b96a8(0x1b2)](_0x21df57[_0x1b96a8(0x1ae)])[_0x1b96a8(0x199)](([_0x5ab36a,_0x130ad4])=>_0x5ab36a+'='+JSON[_0x1b96a8(0x1f2)](_0x130ad4))[_0x1b96a8(0x1ac)](',\x20');console['log'](''+_0x3b7bdb+a13_0x15753f['dim']('Show\x20when:\x20'+_0x1dca92));}_0x481a63&&_0x21df57[_0x1b96a8(0x1fc)]&&printSchemaFields(_0x21df57[_0x1b96a8(0x1fc)],_0x3c40ee+0x1);}}export class ConnectionListCommand extends BaseCommand{[a13_0x327349(0x1c5)]=a13_0x327349(0x1d6);['description']='List\x20all\x20result\x20output\x20connections';async[a13_0x327349(0x1be)](_0x381eb){const _0x59b6b7=a13_0x327349,{options:_0x5b8bcf,tdx:_0x23a230}=_0x381eb;_0x5b8bcf['verbose']&&console[_0x59b6b7(0x1ef)](_0x59b6b7(0x1ec)+_0x5b8bcf[_0x59b6b7(0x1d7)]);const _0x1afd7e=resolveLimit(_0x5b8bcf[_0x59b6b7(0x1c6)],DEFAULT_LISTING_LIMIT),_0x42dc39=await withSpinner(_0x59b6b7(0x194),()=>_0x23a230['connection'][_0x59b6b7(0x1e2)](),{'verbose':_0x5b8bcf[_0x59b6b7(0x1a0)]}),_0x28f5e5=_0x42dc39['data'];console[_0x59b6b7(0x1ef)](_0x59b6b7(0x1fa)+_0x28f5e5['length']+_0x59b6b7(0x1e7)+(_0x28f5e5[_0x59b6b7(0x1d4)]!==0x1?'s':''));if(isStructuredFormat(_0x5b8bcf)){const _0x4f17ad=_0x28f5e5[_0x59b6b7(0x1f5)](0x0,_0x1afd7e);await handleSDKOutput(_0x4f17ad,{..._0x5b8bcf,'limit':_0x1afd7e});}else{const _0x19de88=_0x28f5e5[_0x59b6b7(0x1d4)]>0x0?Math[_0x59b6b7(0x1d2)](..._0x28f5e5[_0x59b6b7(0x199)](_0x2dbfe3=>_0x2dbfe3[_0x59b6b7(0x1c7)][_0x59b6b7(0x1d4)])):0x0,_0x34de8f=[];for(const _0x4970b8 of _0x28f5e5){const _0x407c16=a13_0x15753f[_0x59b6b7(0x1b5)](_0x4970b8[_0x59b6b7(0x1c7)][_0x59b6b7(0x1fd)](_0x19de88)),_0x3082c3=_0x4970b8[_0x59b6b7(0x1dd)]?.[_0x59b6b7(0x1c5)]?_0x59b6b7(0x1da)+a13_0x15753f[_0x59b6b7(0x1ea)](_0x4970b8[_0x59b6b7(0x1dd)][_0x59b6b7(0x1c5)]):'';_0x34de8f[_0x59b6b7(0x1f1)](_0x407c16+'\x20\x20'+_0x4970b8[_0x59b6b7(0x1c5)]+_0x3082c3);}await writeOutput(_0x34de8f[_0x59b6b7(0x1ac)]('\x0a'),_0x5b8bcf[_0x59b6b7(0x1e6)],'table');}return 0x0;}}export class ConnectionShowCommand extends BaseCommand{[a13_0x327349(0x1c5)]='connection:show';['description']=a13_0x327349(0x1b4);[a13_0x327349(0x1c2)](_0x3123db){const _0x82ac3b=a13_0x327349,{args:_0x1643da}=_0x3123db;if(!_0x1643da[0x0])return _0x82ac3b(0x1a3);return undefined;}async[a13_0x327349(0x1be)](_0xb32138){const _0x2e87ca=a13_0x327349,{options:_0x4e790c,args:_0x3579f8,tdx:_0x224ca2}=_0xb32138,_0x212ee6=_0x3579f8[0x0];_0x4e790c[_0x2e87ca(0x1a0)]&&(console['error'](_0x2e87ca(0x1ec)+_0x4e790c[_0x2e87ca(0x1d7)]),console['error'](_0x2e87ca(0x1f8)+_0x212ee6));const _0x551a7d=await withSpinner(_0x2e87ca(0x195)+_0x212ee6+_0x2e87ca(0x1b9),()=>_0x224ca2[_0x2e87ca(0x1bc)]['resolve'](_0x212ee6),{'verbose':_0x4e790c[_0x2e87ca(0x1a0)]}),_0x37e7d6=_0x551a7d[_0x2e87ca(0x1ce)];return console[_0x2e87ca(0x1ef)](_0x2e87ca(0x1fb)+_0x37e7d6[_0x2e87ca(0x1c5)]),await handleSingleObjectOutput(_0x37e7d6,_0x4e790c),0x0;}}export class ConnectionSchemaCommand extends BaseCommand{[a13_0x327349(0x1c5)]='connection:schema';['description']=a13_0x327349(0x1e1);['validate'](_0x41f3ee){const _0x5ec250=a13_0x327349,{args:_0x1bb97d}=_0x41f3ee;if(!_0x1bb97d[0x0])return _0x5ec250(0x1d5);return undefined;}async[a13_0x327349(0x1be)](_0x413ff7){const _0x51d81c=a13_0x327349,{options:_0x2827ab,args:_0x3e991f,tdx:_0x17e3b0}=_0x413ff7,_0x297f38=_0x3e991f[0x0];_0x2827ab[_0x51d81c(0x1a0)]&&(console['error'](_0x51d81c(0x1ec)+_0x2827ab['site']),console['error']('Resolving\x20connector\x20type\x20or\x20name:\x20'+_0x297f38));let _0x162a80=_0x297f38,_0x12b65c;try{const _0x42407c=await _0x17e3b0[_0x51d81c(0x1bc)][_0x51d81c(0x1ab)](_0x297f38);_0x42407c&&(_0x162a80=_0x42407c['type'],_0x12b65c=_0x42407c['name'],_0x2827ab[_0x51d81c(0x1a0)]&&console[_0x51d81c(0x1ef)](_0x51d81c(0x1a1)+_0x297f38+'\x27\x20as\x20connection\x20name\x20→\x20type:\x20'+_0x162a80));}catch{_0x2827ab['verbose']&&console[_0x51d81c(0x1ef)](_0x51d81c(0x1cf)+_0x297f38+_0x51d81c(0x1e0));}const _0xf311f7=await withSpinner(_0x51d81c(0x1e4)+_0x162a80+_0x51d81c(0x1b9),()=>_0x17e3b0['connection'][_0x51d81c(0x1c9)](_0x162a80),{'verbose':_0x2827ab['verbose']}),_0x48bb04=_0xf311f7[_0x51d81c(0x1ce)];_0x12b65c?console['error'](_0x51d81c(0x1eb)+_0x12b65c+_0x51d81c(0x1e5)+_0x162a80+')'):console[_0x51d81c(0x1ef)](_0x51d81c(0x1ba)+_0x162a80);if(isStructuredFormat(_0x2827ab))await handleSingleObjectOutput(_0x48bb04,_0x2827ab);else{const _0x12472e=normalizeSchemaForDisplay(_0x48bb04);_0x12b65c?(console[_0x51d81c(0x1cc)](_0x51d81c(0x19d)+a13_0x15753f[_0x51d81c(0x1b5)](_0x12b65c)),console[_0x51d81c(0x1cc)](_0x51d81c(0x1f4)+a13_0x15753f[_0x51d81c(0x1ea)](_0x162a80))):console[_0x51d81c(0x1cc)](_0x51d81c(0x1a2)+a13_0x15753f[_0x51d81c(0x1b5)](_0x162a80)),_0x12472e[_0x51d81c(0x1d4)]>0x0?(console[_0x51d81c(0x1cc)](a13_0x15753f[_0x51d81c(0x192)](_0x51d81c(0x1f3))),printSchemaFields(_0x12472e,0x0)):console[_0x51d81c(0x1cc)](a13_0x15753f['dim']('\x0aNo\x20fields\x20defined\x20in\x20schema'));}return 0x0;}}export class ConnectionTypesCommand extends BaseCommand{[a13_0x327349(0x1c5)]=a13_0x327349(0x1de);[a13_0x327349(0x1e3)]='List\x20available\x20connector\x20types';async[a13_0x327349(0x1be)](_0x4b8c8d){const _0x4b693d=a13_0x327349,{options:_0x228390,tdx:_0x1a7ab1}=_0x4b8c8d;_0x228390[_0x4b693d(0x1a0)]&&console[_0x4b693d(0x1ef)](_0x4b693d(0x1ec)+_0x228390['site']);const _0x45caad=await withSpinner(_0x4b693d(0x1a9),()=>_0x1a7ab1[_0x4b693d(0x1bc)][_0x4b693d(0x1f6)](),{'verbose':_0x228390[_0x4b693d(0x1a0)]}),_0x1c1b0e=_0x45caad[_0x4b693d(0x1ce)]['sort']((_0x5571f1,_0x46780b)=>_0x5571f1[_0x4b693d(0x1c7)]['localeCompare'](_0x46780b['type']));console[_0x4b693d(0x1ef)](_0x4b693d(0x1fa)+_0x1c1b0e[_0x4b693d(0x1d4)]+_0x4b693d(0x1f0)+(_0x1c1b0e[_0x4b693d(0x1d4)]!==0x1?'s':''));if(isStructuredFormat(_0x228390))await handleSDKOutput(_0x1c1b0e,_0x228390);else{const _0xf7dd06=_0x1c1b0e[_0x4b693d(0x1d4)]>0x0?Math[_0x4b693d(0x1d2)](..._0x1c1b0e[_0x4b693d(0x199)](_0x4b0b24=>_0x4b0b24[_0x4b693d(0x1c7)][_0x4b693d(0x1d4)])):0x0,_0x54362c=[];for(const _0x1f7143 of _0x1c1b0e){const _0x541283=a13_0x15753f['cyan'](_0x1f7143['type'][_0x4b693d(0x1fd)](_0xf7dd06));_0x54362c[_0x4b693d(0x1f1)](_0x541283+'\x20\x20'+_0x1f7143[_0x4b693d(0x1c5)]);}await writeOutput(_0x54362c[_0x4b693d(0x1ac)]('\x0a'),_0x228390[_0x4b693d(0x1e6)],'table');}return 0x0;}}export class ConnectionSettingsCommand extends BaseCommand{[a13_0x327349(0x1c5)]=a13_0x327349(0x1ad);[a13_0x327349(0x1e3)]=a13_0x327349(0x1a8);[a13_0x327349(0x1c2)](_0x18c3b5){const _0x4abd6d=a13_0x327349,{args:_0x579a6c}=_0x18c3b5;if(!_0x579a6c[0x0])return _0x4abd6d(0x1c1);return undefined;}async[a13_0x327349(0x1be)](_0x1d4312){const _0xb4590c=a13_0x327349,{options:_0x5f49d7,args:_0x5e4e44,tdx:_0x567854}=_0x1d4312,_0x3eb6dc=_0x5e4e44[0x0];_0x5f49d7[_0xb4590c(0x1a0)]&&(console[_0xb4590c(0x1ef)](_0xb4590c(0x1ec)+_0x5f49d7['site']),console[_0xb4590c(0x1ef)](_0xb4590c(0x1a7)+_0x3eb6dc));const _0x5dcf18=await withSpinner(_0xb4590c(0x1ed)+_0x3eb6dc+_0xb4590c(0x1b9),()=>_0x567854[_0xb4590c(0x1bc)]['getMetadata'](_0x3eb6dc),{'verbose':_0x5f49d7[_0xb4590c(0x1a0)]}),_0x4b0b46=_0x5dcf18['data'];console[_0xb4590c(0x1ef)](_0xb4590c(0x1d8)+_0x3eb6dc);if(isStructuredFormat(_0x5f49d7))await handleSingleObjectOutput(_0x4b0b46,_0x5f49d7);else{console['log'](_0xb4590c(0x1a2)+a13_0x15753f['cyan'](_0x3eb6dc)),console[_0xb4590c(0x1cc)]('Name:\x20'+_0x4b0b46[_0xb4590c(0x1c5)]);const _0x34b420=_0x4b0b46['settings']||[],_0xe418d6=_0x34b420[_0xb4590c(0x1b6)](_0x3d6668=>_0x3d6668['credential']);_0xe418d6[_0xb4590c(0x1d4)]>0x0&&(console[_0xb4590c(0x1cc)](a13_0x15753f[_0xb4590c(0x192)](_0xb4590c(0x19a))),printMetadataSettings(_0xe418d6));let _0x55ab0b=![];try{const _0x514db6=await _0x567854['connection'][_0xb4590c(0x1c9)](_0x3eb6dc),_0x17e1aa=normalizeSchemaForDisplay(_0x514db6);_0x17e1aa['length']>0x0&&(console[_0xb4590c(0x1cc)](a13_0x15753f[_0xb4590c(0x192)](_0xb4590c(0x1f3))),printSchemaFields(_0x17e1aa,0x0),_0x55ab0b=!![]);}catch{const _0x20b0d9=_0x34b420['filter'](_0x1495cc=>!_0x1495cc[_0xb4590c(0x19e)]);_0x20b0d9[_0xb4590c(0x1d4)]>0x0&&(console['log'](a13_0x15753f['bold'](_0xb4590c(0x1f3))),printMetadataSettings(_0x20b0d9),_0x55ab0b=!![]);}!_0x55ab0b&&_0x5f49d7[_0xb4590c(0x1a0)]&&console['error'](a13_0x15753f[_0xb4590c(0x1ea)](_0xb4590c(0x1dc))),_0xe418d6[_0xb4590c(0x1d4)]===0x0&&console['log'](a13_0x15753f[_0xb4590c(0x1ea)](_0xb4590c(0x1d3)));}return 0x0;}}function printMetadataSettings(_0x8c623){const _0x40ec7e=a13_0x327349;for(const _0x5388c0 of _0x8c623){if(!_0x5388c0[_0x40ec7e(0x1c5)])continue;if(_0x5388c0[_0x40ec7e(0x1a6)])continue;let _0x4c7fc6='\x20\x20'+a13_0x15753f['green'](_0x5388c0[_0x40ec7e(0x1c5)]);_0x5388c0[_0x40ec7e(0x1b0)]&&(_0x4c7fc6+=':\x20'+_0x5388c0[_0x40ec7e(0x1b0)]);_0x5388c0[_0x40ec7e(0x1c7)]&&(_0x4c7fc6+=a13_0x15753f[_0x40ec7e(0x1ea)]('\x20['+_0x5388c0[_0x40ec7e(0x1c7)]+']'));console['log'](_0x4c7fc6);_0x5388c0[_0x40ec7e(0x1b1)]&&console[_0x40ec7e(0x1cc)](_0x40ec7e(0x1e9)+a13_0x15753f[_0x40ec7e(0x1ea)](_0x5388c0[_0x40ec7e(0x1b1)]));if(_0x5388c0[_0x40ec7e(0x1c0)]){const _0x3f862c=_0x5388c0[_0x40ec7e(0x1c0)][_0x40ec7e(0x199)](_0x1be29e=>_0x1be29e[_0x40ec7e(0x196)])['join'](',\x20');console['log'](_0x40ec7e(0x1b3)+a13_0x15753f[_0x40ec7e(0x1d9)](_0x3f862c));}_0x5388c0[_0x40ec7e(0x1f9)]!==undefined&&_0x5388c0[_0x40ec7e(0x1f9)]!==null&&console[_0x40ec7e(0x1cc)](_0x40ec7e(0x1a4)+a13_0x15753f[_0x40ec7e(0x1c4)](String(_0x5388c0[_0x40ec7e(0x1f9)])));if(_0x5388c0[_0x40ec7e(0x1ae)]){const _0x51f27b=Object[_0x40ec7e(0x1b2)](_0x5388c0[_0x40ec7e(0x1ae)])[_0x40ec7e(0x199)](([_0x31bc53,_0xa2c1f1])=>_0x31bc53+'='+JSON[_0x40ec7e(0x1f2)](_0xa2c1f1))[_0x40ec7e(0x1ac)](',\x20');console['log'](_0x40ec7e(0x1e9)+a13_0x15753f[_0x40ec7e(0x1ea)](_0x40ec7e(0x1af)+_0x51f27b));}}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a14_0x41756b=a14_0x1e19;function a14_0x2a60(){const _0x18b7d5=['message','241YnHofC','verbose','3350459jdZePd','4344225lEZmDS','length','error','10612740DqWAid','List\x20all\x20databases','description','11MjrLtB','site','Pattern:\x20','data','Listing\x20databases...','execute','cause','16YeTDfp','databases','712CRcNED','listDatabases','5038njabEL','5632497kUCVVk','6157992dYdZuG','12036wmOzYY','12pKPUZU','name'];a14_0x2a60=function(){return _0x18b7d5;};return a14_0x2a60();}(function(_0x2991c6,_0x3a30f4){const _0x2d369f=a14_0x1e19,_0x15722a=_0x2991c6();while(!![]){try{const _0x5efb2e=-parseInt(_0x2d369f(0xc1))/0x1*(parseInt(_0x2d369f(0xba))/0x2)+parseInt(_0x2d369f(0xbd))/0x3*(parseInt(_0x2d369f(0xb8))/0x4)+parseInt(_0x2d369f(0xc4))/0x5+parseInt(_0x2d369f(0xbe))/0x6*(-parseInt(_0x2d369f(0xc3))/0x7)+-parseInt(_0x2d369f(0xb6))/0x8*(-parseInt(_0x2d369f(0xbb))/0x9)+parseInt(_0x2d369f(0xc7))/0xa*(-parseInt(_0x2d369f(0xca))/0xb)+parseInt(_0x2d369f(0xbc))/0xc;if(_0x5efb2e===_0x3a30f4)break;else _0x15722a['push'](_0x15722a['shift']());}catch(_0x10cb31){_0x15722a['push'](_0x15722a['shift']());}}}(a14_0x2a60,0xb050a));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';function a14_0x1e19(_0x3a5a83,_0x50efb1){_0x3a5a83=_0x3a5a83-0xb3;const _0x2a6024=a14_0x2a60();let _0x1e1906=_0x2a6024[_0x3a5a83];return _0x1e1906;}import{handleSDKOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import{DEFAULT_LISTING_LIMIT,resolveLimit}from'../core/constants.js';export class DatabasesCommand extends BaseCommand{[a14_0x41756b(0xbf)]=a14_0x41756b(0xb7);[a14_0x41756b(0xc9)]=a14_0x41756b(0xc8);async[a14_0x41756b(0xb4)](_0x349259){const _0x93318=a14_0x41756b,{options:_0x21e343,args:_0x30e83f,tdx:_0xee5791}=_0x349259,_0x1e4429=_0x30e83f[0x0];try{_0x21e343['verbose']&&(console[_0x93318(0xc6)]('Site:\x20'+_0x21e343[_0x93318(0xcb)]),_0x1e4429&&console[_0x93318(0xc6)](_0x93318(0xcc)+_0x1e4429));const _0x3c7cc7=resolveLimit(_0x21e343['limit'],DEFAULT_LISTING_LIMIT),_0x4a29eb=await withSpinner(_0x93318(0xb3),()=>_0xee5791['query'][_0x93318(0xb9)](_0x1e4429,_0x3c7cc7),{'verbose':_0x21e343[_0x93318(0xc2)]}),_0x244930=_0x4a29eb[_0x93318(0xcd)];return console['error']('✔\x20Found\x20'+_0x244930[_0x93318(0xc5)]+'\x20database'+(_0x244930[_0x93318(0xc5)]!==0x1?'s':'')),await handleSDKOutput(_0x244930,{..._0x21e343,'limit':_0x3c7cc7}),0x0;}catch(_0x3885dd){if(_0x3885dd instanceof SDKError)return console[_0x93318(0xc6)]('Error:\x20'+_0x3885dd[_0x93318(0xc0)]),_0x3885dd[_0x93318(0xb5)]&&console[_0x93318(0xc6)]('\x20\x20Cause:\x20'+_0x3885dd['cause']),0x1;throw _0x3885dd;}}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a15_0x559af0=a15_0x3398;function a15_0x3398(_0x2c9b40,_0x308665){_0x2c9b40=_0x2c9b40-0xf7;const _0x20ab0a=a15_0x20ab();let _0x339893=_0x20ab0a[_0x2c9b40];return _0x339893;}(function(_0x593ec,_0xbbed41){const _0x5e7740=a15_0x3398,_0x243292=_0x593ec();while(!![]){try{const _0x56a91d=parseInt(_0x5e7740(0x104))/0x1*(-parseInt(_0x5e7740(0xfd))/0x2)+parseInt(_0x5e7740(0xfc))/0x3*(parseInt(_0x5e7740(0x117))/0x4)+parseInt(_0x5e7740(0x110))/0x5+parseInt(_0x5e7740(0xfb))/0x6+-parseInt(_0x5e7740(0x115))/0x7+parseInt(_0x5e7740(0x113))/0x8*(-parseInt(_0x5e7740(0xfa))/0x9)+-parseInt(_0x5e7740(0xf9))/0xa*(-parseInt(_0x5e7740(0x112))/0xb);if(_0x56a91d===_0xbbed41)break;else _0x243292['push'](_0x243292['shift']());}catch(_0x3154d0){_0x243292['push'](_0x243292['shift']());}}}(a15_0x20ab,0x49853));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';import{handleSDKOutput}from'../core/command-output.js';function a15_0x20ab(){const _0x637e79=['Error:\x20','Table\x20\x27','message','Usage:\x20tdx\x20describe\x20<database.table>\x0a\x20\x20\x20or:\x20tdx\x20describe\x20<table>\x20--database\x20<database>\x0a\x20\x20\x20or:\x20tdx\x20describe\x20<table>\x20--in\x20<database>\x0a\x0aRun\x20\x27tdx\x20describe\x20--help\x27\x20for\x20more\x20options','execute','error','Site:\x20','\x20\x20Cause:\x20','Database:\x20','1894675rSwbgm','verbose','479743GApyhH','1592KvTabE','database','1818390TCgQyI','length','4NjePZz','query','\x20in\x20','\x20column','description','Too\x20many\x20arguments\x0aUsage:\x20tdx\x20describe\x20<database.table>\x0a\x20\x20\x20or:\x20tdx\x20describe\x20<table>\x20--database\x20<database>\x0a\x0aRun\x20\x27tdx\x20describe\x20--help\x27\x20for\x20more\x20options','✔\x20Found\x20','20hiCaHX','2799vuxpqd','1741650hPDtlp','771774pMoelP','17768MnCtZf','validate','name','describeTable','✖\x20Table\x20not\x20found','Describe\x20table\x20schema','cause','44TiBeFU','args','describe'];a15_0x20ab=function(){return _0x637e79;};return a15_0x20ab();}import{parseTableReference,validateTableDescribeReference}from'../utils/table-ref-parser.js';import{withSpinner}from'../utils/spinner.js';export class DescribeCommand extends BaseCommand{[a15_0x559af0(0xff)]=a15_0x559af0(0x106);[a15_0x559af0(0x11b)]=a15_0x559af0(0x102);async[a15_0x559af0(0x10b)](_0x4dcc35){const _0x357273=a15_0x559af0;return this[_0x357273(0x100)](_0x4dcc35);}async[a15_0x559af0(0x100)](_0x1194b1){const _0x4618d8=a15_0x559af0,{options:_0x5b7742,args:_0x5e8017,tdx:_0x382dd5}=_0x1194b1;let _0x14970a;try{_0x14970a=parseTableReference(_0x5e8017[0x0]);const _0x1e02c0=_0x5b7742[_0x4618d8(0x114)];!_0x14970a[_0x4618d8(0x114)]&&_0x1e02c0&&(_0x14970a['database']=_0x1e02c0);const _0x3d4787=validateTableDescribeReference(_0x14970a);if(_0x3d4787)return console[_0x4618d8(0x10c)](_0x4618d8(0x107)+_0x3d4787),0x1;}catch(_0x36d6ff){return console[_0x4618d8(0x10c)](_0x4618d8(0x107)+_0x36d6ff[_0x4618d8(0x109)]),0x1;}const _0x13b5df=_0x14970a[_0x4618d8(0x114)],_0x371cb1=_0x14970a['table'];try{_0x5b7742[_0x4618d8(0x111)]&&(console[_0x4618d8(0x10c)](_0x4618d8(0x10d)+_0x5b7742['site']),console[_0x4618d8(0x10c)](_0x4618d8(0x10f)+_0x13b5df),console[_0x4618d8(0x10c)]('Table:\x20'+_0x371cb1));const _0x50009c=await withSpinner('Describing\x20table\x20'+_0x13b5df+'.'+_0x371cb1+'...',()=>_0x382dd5[_0x4618d8(0x118)][_0x4618d8(0x100)](_0x13b5df,_0x371cb1),{'verbose':_0x5b7742['verbose']}),_0x3a9634=_0x50009c['data'];if(_0x3a9634['length']===0x0)return console[_0x4618d8(0x10c)](_0x4618d8(0x101)),console[_0x4618d8(0x10c)](_0x4618d8(0x108)+_0x13b5df+'.'+_0x371cb1+'\x27\x20does\x20not\x20exist'),0x1;return console[_0x4618d8(0x10c)](_0x4618d8(0xf8)+_0x3a9634[_0x4618d8(0x116)]+_0x4618d8(0x11a)+(_0x3a9634['length']!==0x1?'s':'')+_0x4618d8(0x119)+_0x13b5df+'.'+_0x371cb1),await handleSDKOutput(_0x3a9634,_0x5b7742),0x0;}catch(_0x13535c){if(_0x13535c instanceof SDKError)return console[_0x4618d8(0x10c)](_0x4618d8(0x107)+_0x13535c[_0x4618d8(0x109)]),_0x13535c[_0x4618d8(0x103)]&&console[_0x4618d8(0x10c)](_0x4618d8(0x10e)+_0x13535c[_0x4618d8(0x103)]),0x1;throw _0x13535c;}}[a15_0x559af0(0xfe)](_0xd571bc){const _0x295af8=a15_0x559af0;if(_0xd571bc[_0x295af8(0x105)]['length']===0x0)return _0x295af8(0x10a);if(_0xd571bc[_0x295af8(0x105)][_0x295af8(0x116)]>0x1)return _0x295af8(0xf7);return undefined;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a16_0x57fe5e=a16_0x2324;(function(_0x261517,_0x37c477){const _0x2236ba=a16_0x2324,_0x57fc54=_0x261517();while(!![]){try{const _0x5c1e2c=parseInt(_0x2236ba(0x185))/0x1*(-parseInt(_0x2236ba(0x14a))/0x2)+-parseInt(_0x2236ba(0x138))/0x3*(parseInt(_0x2236ba(0x15a))/0x4)+parseInt(_0x2236ba(0x11e))/0x5*(parseInt(_0x2236ba(0x183))/0x6)+parseInt(_0x2236ba(0x170))/0x7+parseInt(_0x2236ba(0x12a))/0x8+-parseInt(_0x2236ba(0x17f))/0x9*(-parseInt(_0x2236ba(0x146))/0xa)+parseInt(_0x2236ba(0x12b))/0xb*(-parseInt(_0x2236ba(0x199))/0xc);if(_0x5c1e2c===_0x37c477)break;else _0x57fc54['push'](_0x57fc54['shift']());}catch(_0x594140){_0x57fc54['push'](_0x57fc54['shift']());}}}(a16_0x1d1d,0xb771d));import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import{matchGlobPattern}from'../utils/string-utils.js';import{confirm}from'../utils/prompt.js';import{loadSessionContext,saveSessionContext}from'../core/session.js';import{DEFAULT_LLM_LIMIT,resolveLimit}from'../core/constants.js';import{SDKError,ErrorCode}from'../sdk/errors.js';async function resolveWorkspaceIdFromOptions(_0x573edd,_0x49b9e4,_0x41e0be=![]){const _0x287fd0=a16_0x2324;if(_0x573edd['workspace'])return await _0x49b9e4['engage'][_0x287fd0(0x18e)](_0x573edd[_0x287fd0(0x17d)]);const _0x414f54=loadSessionContext(_0x573edd[_0x287fd0(0x11f)]);if(_0x414f54?.['engage_workspace'])return await _0x49b9e4[_0x287fd0(0x16a)]['resolveWorkspaceId'](_0x414f54[_0x287fd0(0x13b)]);if(_0x41e0be)throw new SDKError(ErrorCode[_0x287fd0(0x17e)],_0x287fd0(0x186),undefined,{'helpText':_0x287fd0(0x12f)});return undefined;}async function resolveSegmentFromOptions(_0x133669,_0x470f69){const _0x307dce=a16_0x2324;if(!_0x133669[_0x307dce(0x117)])return{};const _0x171758=_0x133669[_0x307dce(0x117)],_0x1860e6=await _0x470f69['segment']['resolvePathToResource'](_0x171758);return{'audienceId':_0x1860e6['parentId'],'audienceName':_0x1860e6[_0x307dce(0x16d)],..._0x1860e6['segmentId']&&{'segmentId':_0x1860e6[_0x307dce(0x17c)],'segmentName':_0x1860e6[_0x307dce(0x18c)]}};}function buildConnectorConfig(_0x28070e){const _0x3c3347=a16_0x2324,_0x55076e=_0x28070e['emailSenderId'],_0x4a90ed=_0x28070e[_0x3c3347(0x163)];if(!_0x55076e&&!_0x4a90ed)return undefined;return{..._0x55076e&&{'emailSenderId':_0x55076e},..._0x4a90ed&&{'jsonColumns':_0x4a90ed}};}export class EngageCampaignsCommand extends BaseCommand{['name']='engage:campaigns';[a16_0x57fe5e(0x15b)]=a16_0x57fe5e(0x11c);async[a16_0x57fe5e(0x131)](_0x5ebf05){const _0x3198b6=a16_0x57fe5e,{options:_0x5408a6,args:_0x511989,tdx:_0x393f24}=_0x5ebf05,_0x5cfac5=_0x511989[0x0],_0x5acc52=resolveLimit(_0x5408a6[_0x3198b6(0x18a)],DEFAULT_LLM_LIMIT),_0x1bb1ac=_0x5408a6,_0x177ed7=_0x1bb1ac[_0x3198b6(0x125)],_0x143889=_0x1bb1ac[_0x3198b6(0x18b)],_0x3506f9=await resolveWorkspaceIdFromOptions(_0x1bb1ac,_0x393f24),_0x350c53=await withSpinner(_0x3198b6(0x168),()=>_0x393f24['engage'][_0x3198b6(0x19b)]({'type':_0x177ed7,'status':_0x143889,'workspaceId':_0x3506f9,'limit':_0x5acc52}),{'verbose':_0x5408a6[_0x3198b6(0x127)]});let _0x3bbd98=_0x350c53[_0x3198b6(0x16f)];return _0x5cfac5&&(_0x3bbd98=_0x350c53[_0x3198b6(0x16f)][_0x3198b6(0x193)](_0x36479d=>matchGlobPattern(_0x36479d['name'],_0x5cfac5))),await handleSDKOutput(_0x3bbd98,_0x5408a6),0x0;}}export class EngageCampaignShowCommand extends BaseCommand{[a16_0x57fe5e(0x169)]=a16_0x57fe5e(0x157);['description']=a16_0x57fe5e(0x178);async[a16_0x57fe5e(0x131)](_0x34d889){const _0x19c4b=a16_0x57fe5e,{options:_0x551038,args:_0x4a19d6,tdx:_0xed55da}=_0x34d889;if(_0x4a19d6[_0x19c4b(0x12c)]===0x0)return console['error'](_0x19c4b(0x120)),console[_0x19c4b(0x166)](_0x19c4b(0x189)),0x1;const _0x18cdfc=_0x4a19d6[0x0],_0x4c00c1=_0x551038,_0x5d6fa2=await resolveWorkspaceIdFromOptions(_0x4c00c1,_0xed55da),_0x1fd31d=_0x4c00c1[_0x19c4b(0x122)];if(_0x1fd31d){const _0x35bd5a=await withSpinner(_0x19c4b(0x154)+_0x18cdfc+_0x19c4b(0x14d),()=>_0xed55da[_0x19c4b(0x16a)][_0x19c4b(0x171)](_0x18cdfc,_0x5d6fa2),{'verbose':_0x551038[_0x19c4b(0x127)]});await handleSDKOutput([_0x35bd5a],_0x551038);}else{const _0x13c511=await withSpinner(_0x19c4b(0x154)+_0x18cdfc+_0x19c4b(0x14d),()=>_0xed55da[_0x19c4b(0x16a)]['getCampaign'](_0x18cdfc,_0x5d6fa2),{'verbose':_0x551038['verbose']});await handleSDKOutput([_0x13c511],_0x551038);}return 0x0;}}function a16_0x1d1d(){const _0x25d57a=['status','segmentName','keys','resolveWorkspaceId','Fetching\x20workspace\x20\x27','pauseCampaign','editorType','Deleting\x20workspace\x20\x27','filter','createCampaign','Creating\x20template\x20\x27','engage:workspaces','Fetching\x20template\x20\x27','Engage\x20workspace\x20set\x20to:\x20','7044dlEvUG','Usage:\x20tdx\x20engage\x20template\x20update\x20<name-or-id>\x20[--name\x20<new-name>]\x20...','listCampaigns','engage:template:update','engage:workspace:update','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20workspace\x20\x27','Options:\x20--name,\x20--description','Duplicate\x20a\x20campaign','Usage:\x20tdx\x20engage\x20campaign\x20create\x20--name\x20<name>\x20--type\x20<email|push>','Create\x20a\x20workspace','Operation\x20cancelled','log','Error:\x20--name\x20is\x20required','segment','Options:\x20--name,\x20--description,\x20--segment,\x20--email-sender-id,\x20--json-columns,\x20--start-at,\x20--timezone','Template\x20\x27','\x27\x20deleted\x20successfully','Show\x20email\x20template\x20details','List\x20campaigns','Usage:\x20tdx\x20engage\x20workspace\x20update\x20<name-or-id>\x20[--name\x20<new-name>]\x20...','1292105ZbHzfC','session','Error:\x20Campaign\x20name\x20or\x20ID\x20is\x20required','Campaign\x20\x27','full','updateWorkspace','engage:campaign:duplicate','type','deleteCampaign','verbose','Updating\x20template\x20\x27','startAt','8841056hOenWV','34111YUBgjO','length','engage:workspace:show','updateTemplate','Use\x20--workspace\x20<name>\x20or\x20set\x20with\x20\x22tdx\x20use\x20engage_workspace\x20<name>\x22','\x0aTip:\x20Use\x20\x27tdx\x20use\x20--clear\x27\x20to\x20clear\x20session\x20overrides','execute','Resuming\x20campaign\x20\x27','Usage:\x20tdx\x20engage\x20campaign\x20delete\x20<name-or-id>','updateCampaign','Verifying\x20workspace\x20\x27','deleteWorkspace','Deleting\x20campaign\x20\x27','3237873EOimoK','Launching\x20campaign\x20\x27','getWorkspaceFull','engage_workspace','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20campaign\x20\x27','Usage:\x20tdx\x20engage\x20workspace\x20use\x20<name>','engage:template:show','Update\x20a\x20campaign','Launch\x20a\x20campaign','plaintext','Updating\x20workspace\x20\x27','Error:\x20Template\x20name\x20or\x20ID\x20is\x20required','Error:\x20Workspace\x20name\x20or\x20ID\x20is\x20required','Usage:\x20tdx\x20engage\x20template\x20create\x20--name\x20<name>\x20--subject\x20<subject>\x20--html\x20<html>','30aUbKYg','createTemplate','deleteTemplate','Deleting\x20template\x20\x27','821746mzfhln','engage:templates','Error:\x20--html\x20is\x20required','\x27...','engage:campaign:create','Error:\x20--subject\x20is\x20required','Error:\x20--type\x20is\x20required\x20(email\x20or\x20push)','subject','engage:campaign:update','Update\x20an\x20email\x20template','Fetching\x20campaign\x20\x27','timezone','engage:campaign:delete','engage:campaign:show','Updating\x20campaign\x20\x27','Usage:\x20tdx\x20engage\x20workspace\x20delete\x20<name-or-id>','4AJNUPf','description','\x27?\x20This\x20cannot\x20be\x20undone.','Error:\x20At\x20least\x20one\x20field\x20to\x20update\x20is\x20required','Resume\x20a\x20paused\x20campaign','Delete\x20a\x20workspace','\x27\x20launched\x20successfully','Set\x20workspace\x20context\x20for\x20Engage\x20commands','Fetching\x20templates...','jsonColumns','fromEntries','entries','error','Creating\x20campaign\x20\x27','Fetching\x20campaigns...','name','engage','engage:template:delete','duplicateCampaign','parentName','Usage:\x20tdx\x20engage\x20template\x20delete\x20<name-or-id>','data','9020130GQviJZ','getCampaignFull','launchCampaign','getWorkspace','Pause\x20a\x20campaign','yes','Delete\x20a\x20campaign','Workspace\x20\x27','Show\x20campaign\x20details','createWorkspace','Create\x20an\x20email\x20template','Usage:\x20tdx\x20engage\x20workspace\x20create\x20--name\x20<name>\x20[--description\x20<desc>]','segmentId','workspace','MISSING_ARGUMENT','4229091ooNUKs','Usage:\x20tdx\x20engage\x20template\x20show\x20<name-or-id>','Update\x20a\x20workspace','engage:workspace:create','6gsTSbf','html','1QSIBHS','Workspace\x20is\x20required\x20for\x20this\x20operation','Usage:\x20tdx\x20engage\x20campaign\x20resume\x20<name-or-id>','List\x20email\x20templates','Usage:\x20tdx\x20engage\x20campaign\x20show\x20<name-or-id>','limit'];a16_0x1d1d=function(){return _0x25d57a;};return a16_0x1d1d();}export class EngageCampaignCreateCommand extends BaseCommand{['name']=a16_0x57fe5e(0x14e);[a16_0x57fe5e(0x15b)]='Create\x20a\x20new\x20campaign';async[a16_0x57fe5e(0x131)](_0x1b0652){const _0x281d5f=a16_0x57fe5e,{options:_0x270adf,tdx:_0x433c2c}=_0x1b0652,_0x508367=_0x270adf,_0x35be1e=_0x508367[_0x281d5f(0x169)],_0x1d00de=_0x508367[_0x281d5f(0x125)];if(!_0x35be1e)return console[_0x281d5f(0x166)](_0x281d5f(0x116)),console[_0x281d5f(0x166)](_0x281d5f(0x1a1)),0x1;if(!_0x1d00de)return console[_0x281d5f(0x166)](_0x281d5f(0x150)),console[_0x281d5f(0x166)](_0x281d5f(0x1a1)),0x1;const _0x17b519=await resolveWorkspaceIdFromOptions(_0x508367,_0x433c2c,!![]),_0x69627d=await resolveSegmentFromOptions(_0x508367,_0x433c2c),_0x41dea1=buildConnectorConfig(_0x508367),_0x1d29ba={'name':_0x35be1e,'campaignType':_0x1d00de,'workspaceId':_0x17b519,'description':_0x508367[_0x281d5f(0x15b)],..._0x69627d,'connectorConfig':_0x41dea1,'startAt':_0x508367[_0x281d5f(0x129)],'timezone':_0x508367[_0x281d5f(0x155)]},_0x5320c2=await withSpinner(_0x281d5f(0x167)+_0x35be1e+_0x281d5f(0x14d),()=>_0x433c2c[_0x281d5f(0x16a)][_0x281d5f(0x194)](_0x1d29ba));return await handleSDKOutput([_0x5320c2[_0x281d5f(0x16f)]],_0x270adf),0x0;}}export class EngageCampaignUpdateCommand extends BaseCommand{[a16_0x57fe5e(0x169)]=a16_0x57fe5e(0x152);[a16_0x57fe5e(0x15b)]=a16_0x57fe5e(0x13f);async[a16_0x57fe5e(0x131)](_0x4e40f3){const _0x3494fe=a16_0x57fe5e,{options:_0x51faab,args:_0x44cefc,tdx:_0x24781c}=_0x4e40f3;if(_0x44cefc[_0x3494fe(0x12c)]===0x0)return console[_0x3494fe(0x166)](_0x3494fe(0x120)),console[_0x3494fe(0x166)]('Usage:\x20tdx\x20engage\x20campaign\x20update\x20<name-or-id>\x20[--name\x20<new-name>]\x20...'),0x1;const _0x3c049a=_0x44cefc[0x0],_0x453a44=_0x51faab,_0x55c23e=await resolveWorkspaceIdFromOptions(_0x453a44,_0x24781c),_0x1efe1b=await resolveSegmentFromOptions(_0x453a44,_0x24781c),_0x3ff09e=buildConnectorConfig(_0x453a44),_0x53cb67={'name':_0x453a44['name'],'description':_0x453a44['description'],..._0x1efe1b,'connectorConfig':_0x3ff09e,'startAt':_0x453a44[_0x3494fe(0x129)],'timezone':_0x453a44[_0x3494fe(0x155)]},_0x2ed597=Object['fromEntries'](Object['entries'](_0x53cb67)[_0x3494fe(0x193)](([,_0x5cea5e])=>_0x5cea5e!==undefined));if(Object['keys'](_0x2ed597)['length']===0x0)return console['error']('Error:\x20At\x20least\x20one\x20field\x20to\x20update\x20is\x20required'),console[_0x3494fe(0x166)](_0x3494fe(0x118)),0x1;const _0x21ef77=await withSpinner(_0x3494fe(0x158)+_0x3c049a+_0x3494fe(0x14d),()=>_0x24781c[_0x3494fe(0x16a)][_0x3494fe(0x134)](_0x3c049a,_0x2ed597,_0x55c23e),{'verbose':_0x51faab[_0x3494fe(0x127)]});return await handleSDKOutput([_0x21ef77['data']],_0x51faab),0x0;}}function a16_0x2324(_0x41d793,_0x4b454e){_0x41d793=_0x41d793-0x113;const _0x1d1d18=a16_0x1d1d();let _0x23244d=_0x1d1d18[_0x41d793];return _0x23244d;}export class EngageCampaignDeleteCommand extends BaseCommand{['name']=a16_0x57fe5e(0x156);[a16_0x57fe5e(0x15b)]=a16_0x57fe5e(0x176);async[a16_0x57fe5e(0x131)](_0x48d153){const _0x806361=a16_0x57fe5e,{options:_0x526162,args:_0x254fbf,tdx:_0x128e56}=_0x48d153;if(_0x254fbf[_0x806361(0x12c)]===0x0)return console[_0x806361(0x166)](_0x806361(0x120)),console['error'](_0x806361(0x133)),0x1;const _0x25617c=_0x254fbf[0x0],_0x5e0d9c=_0x526162,_0x18d1b8=await resolveWorkspaceIdFromOptions(_0x5e0d9c,_0x128e56);if(!_0x526162[_0x806361(0x175)]){const _0xf612e7=await confirm(_0x806361(0x13c)+_0x25617c+'\x27?\x20This\x20cannot\x20be\x20undone.');if(!_0xf612e7)return console[_0x806361(0x115)](_0x806361(0x114)),0x0;}return await withSpinner(_0x806361(0x137)+_0x25617c+_0x806361(0x14d),()=>_0x128e56[_0x806361(0x16a)][_0x806361(0x126)](_0x25617c,_0x18d1b8),{'verbose':_0x526162[_0x806361(0x127)]}),console[_0x806361(0x115)](_0x806361(0x121)+_0x25617c+'\x27\x20deleted\x20successfully'),0x0;}}export class EngageCampaignLaunchCommand extends BaseCommand{['name']='engage:campaign:launch';[a16_0x57fe5e(0x15b)]=a16_0x57fe5e(0x140);async[a16_0x57fe5e(0x131)](_0x1c8b83){const _0x422f02=a16_0x57fe5e,{options:_0x547d28,args:_0xc5f5b1,tdx:_0x1da243}=_0x1c8b83;if(_0xc5f5b1[_0x422f02(0x12c)]===0x0)return console[_0x422f02(0x166)](_0x422f02(0x120)),console[_0x422f02(0x166)]('Usage:\x20tdx\x20engage\x20campaign\x20launch\x20<name-or-id>'),0x1;const _0x4fbf7d=_0xc5f5b1[0x0],_0x30bc58=_0x547d28,_0x4d94b4=await resolveWorkspaceIdFromOptions(_0x30bc58,_0x1da243);return await withSpinner(_0x422f02(0x139)+_0x4fbf7d+_0x422f02(0x14d),()=>_0x1da243[_0x422f02(0x16a)][_0x422f02(0x172)](_0x4fbf7d,_0x4d94b4),{'verbose':_0x547d28[_0x422f02(0x127)]}),console[_0x422f02(0x115)]('Campaign\x20\x27'+_0x4fbf7d+_0x422f02(0x160)),0x0;}}export class EngageCampaignPauseCommand extends BaseCommand{[a16_0x57fe5e(0x169)]='engage:campaign:pause';['description']=a16_0x57fe5e(0x174);async[a16_0x57fe5e(0x131)](_0x31ebc9){const _0x2cc3a8=a16_0x57fe5e,{options:_0x189ae0,args:_0x2d7282,tdx:_0x306e8b}=_0x31ebc9;if(_0x2d7282[_0x2cc3a8(0x12c)]===0x0)return console['error'](_0x2cc3a8(0x120)),console[_0x2cc3a8(0x166)]('Usage:\x20tdx\x20engage\x20campaign\x20pause\x20<name-or-id>'),0x1;const _0x10af59=_0x2d7282[0x0],_0x311478=_0x189ae0,_0x5797bc=await resolveWorkspaceIdFromOptions(_0x311478,_0x306e8b);return await withSpinner('Pausing\x20campaign\x20\x27'+_0x10af59+'\x27...',()=>_0x306e8b['engage'][_0x2cc3a8(0x190)](_0x10af59,_0x5797bc),{'verbose':_0x189ae0[_0x2cc3a8(0x127)]}),console[_0x2cc3a8(0x115)](_0x2cc3a8(0x121)+_0x10af59+'\x27\x20paused\x20successfully'),0x0;}}export class EngageCampaignResumeCommand extends BaseCommand{[a16_0x57fe5e(0x169)]='engage:campaign:resume';[a16_0x57fe5e(0x15b)]=a16_0x57fe5e(0x15e);async[a16_0x57fe5e(0x131)](_0x243c90){const _0x1f31a6=a16_0x57fe5e,{options:_0x3c0255,args:_0xf74851,tdx:_0x394fe6}=_0x243c90;if(_0xf74851[_0x1f31a6(0x12c)]===0x0)return console[_0x1f31a6(0x166)]('Error:\x20Campaign\x20name\x20or\x20ID\x20is\x20required'),console[_0x1f31a6(0x166)](_0x1f31a6(0x187)),0x1;const _0x25298c=_0xf74851[0x0],_0x4af92d=_0x3c0255,_0x120dc7=await resolveWorkspaceIdFromOptions(_0x4af92d,_0x394fe6);return await withSpinner(_0x1f31a6(0x132)+_0x25298c+_0x1f31a6(0x14d),()=>_0x394fe6[_0x1f31a6(0x16a)]['resumeCampaign'](_0x25298c,_0x120dc7),{'verbose':_0x3c0255[_0x1f31a6(0x127)]}),console[_0x1f31a6(0x115)]('Campaign\x20\x27'+_0x25298c+'\x27\x20resumed\x20successfully'),0x0;}}export class EngageCampaignDuplicateCommand extends BaseCommand{['name']=a16_0x57fe5e(0x124);[a16_0x57fe5e(0x15b)]=a16_0x57fe5e(0x1a0);async['execute'](_0x395d71){const _0x3cacfd=a16_0x57fe5e,{options:_0x447ce1,args:_0x3d8efc,tdx:_0x48bbc7}=_0x395d71;if(_0x3d8efc[_0x3cacfd(0x12c)]===0x0)return console[_0x3cacfd(0x166)](_0x3cacfd(0x120)),console['error']('Usage:\x20tdx\x20engage\x20campaign\x20duplicate\x20<name-or-id>'),0x1;const _0x359b97=_0x3d8efc[0x0],_0x3ae3b5=_0x447ce1,_0x5a165b=await resolveWorkspaceIdFromOptions(_0x3ae3b5,_0x48bbc7),_0x57d90b=await withSpinner('Duplicating\x20campaign\x20\x27'+_0x359b97+_0x3cacfd(0x14d),()=>_0x48bbc7[_0x3cacfd(0x16a)][_0x3cacfd(0x16c)](_0x359b97,_0x5a165b),{'verbose':_0x447ce1[_0x3cacfd(0x127)]});return await handleSDKOutput([_0x57d90b[_0x3cacfd(0x16f)]],_0x447ce1),0x0;}}export class EngageTemplatesCommand extends BaseCommand{['name']=a16_0x57fe5e(0x14b);[a16_0x57fe5e(0x15b)]=a16_0x57fe5e(0x188);async[a16_0x57fe5e(0x131)](_0x4dcd09){const _0x45f84b=a16_0x57fe5e,{options:_0x5566f6,args:_0x57a500,tdx:_0x5d594b}=_0x4dcd09,_0x1e397f=_0x57a500[0x0],_0x9711f0=resolveLimit(_0x5566f6['limit'],DEFAULT_LLM_LIMIT),_0x4dd32c=_0x5566f6,_0x25b5e3=await resolveWorkspaceIdFromOptions(_0x4dd32c,_0x5d594b),_0x454cb3=await withSpinner(_0x45f84b(0x162),()=>_0x5d594b[_0x45f84b(0x16a)]['listTemplates']({'workspaceId':_0x25b5e3,'limit':_0x9711f0}),{'verbose':_0x5566f6[_0x45f84b(0x127)]});let _0x2ec112=_0x454cb3['data'];return _0x1e397f&&(_0x2ec112=_0x454cb3[_0x45f84b(0x16f)][_0x45f84b(0x193)](_0x541d47=>matchGlobPattern(_0x541d47[_0x45f84b(0x169)],_0x1e397f))),await handleSDKOutput(_0x2ec112,_0x5566f6),0x0;}}export class EngageTemplateShowCommand extends BaseCommand{[a16_0x57fe5e(0x169)]=a16_0x57fe5e(0x13e);[a16_0x57fe5e(0x15b)]=a16_0x57fe5e(0x11b);async[a16_0x57fe5e(0x131)](_0x33f3cc){const _0x57facb=a16_0x57fe5e,{options:_0x4ff1a4,args:_0x517402,tdx:_0x2f318d}=_0x33f3cc;if(_0x517402[_0x57facb(0x12c)]===0x0)return console[_0x57facb(0x166)](_0x57facb(0x143)),console[_0x57facb(0x166)](_0x57facb(0x180)),0x1;const _0x25326c=_0x517402[0x0],_0x1311da=_0x4ff1a4,_0x5d339e=await resolveWorkspaceIdFromOptions(_0x1311da,_0x2f318d),_0x4359a7=_0x1311da[_0x57facb(0x122)];if(_0x4359a7){const _0x3da75f=await withSpinner(_0x57facb(0x197)+_0x25326c+'\x27...',()=>_0x2f318d[_0x57facb(0x16a)]['getTemplateFull'](_0x25326c,_0x5d339e),{'verbose':_0x4ff1a4['verbose']});await handleSDKOutput([_0x3da75f],_0x4ff1a4);}else{const _0x5d8df0=await withSpinner(_0x57facb(0x197)+_0x25326c+_0x57facb(0x14d),()=>_0x2f318d[_0x57facb(0x16a)]['getTemplate'](_0x25326c,_0x5d339e),{'verbose':_0x4ff1a4['verbose']});await handleSDKOutput([_0x5d8df0],_0x4ff1a4);}return 0x0;}}export class EngageTemplateCreateCommand extends BaseCommand{[a16_0x57fe5e(0x169)]='engage:template:create';[a16_0x57fe5e(0x15b)]=a16_0x57fe5e(0x17a);async[a16_0x57fe5e(0x131)](_0x138387){const _0x339e3e=a16_0x57fe5e,{options:_0x475303,tdx:_0x5f3614}=_0x138387,_0x5daf61=_0x475303,_0x313fab=_0x5daf61[_0x339e3e(0x169)],_0x28428e=_0x5daf61[_0x339e3e(0x151)],_0x3bc6a5=_0x5daf61['html'];if(!_0x313fab)return console['error'](_0x339e3e(0x116)),console[_0x339e3e(0x166)](_0x339e3e(0x145)),0x1;if(!_0x28428e)return console[_0x339e3e(0x166)](_0x339e3e(0x14f)),0x1;if(!_0x3bc6a5)return console['error'](_0x339e3e(0x14c)),0x1;const _0x4ba732=await resolveWorkspaceIdFromOptions(_0x5daf61,_0x5f3614,!![]),_0x4946f0={'name':_0x313fab,'subjectTemplate':_0x28428e,'htmlTemplate':_0x3bc6a5,'workspaceId':_0x4ba732,'plaintextTemplate':_0x5daf61[_0x339e3e(0x141)],'editorType':_0x5daf61[_0x339e3e(0x191)]},_0x4d5b32=await withSpinner(_0x339e3e(0x195)+_0x313fab+_0x339e3e(0x14d),()=>_0x5f3614[_0x339e3e(0x16a)][_0x339e3e(0x147)](_0x4946f0));return await handleSDKOutput([_0x4d5b32[_0x339e3e(0x16f)]],_0x475303),0x0;}}export class EngageTemplateUpdateCommand extends BaseCommand{[a16_0x57fe5e(0x169)]=a16_0x57fe5e(0x19c);[a16_0x57fe5e(0x15b)]=a16_0x57fe5e(0x153);async[a16_0x57fe5e(0x131)](_0x1fb512){const _0x1aee2f=a16_0x57fe5e,{options:_0x25664f,args:_0x30c51e,tdx:_0x3d11a2}=_0x1fb512;if(_0x30c51e[_0x1aee2f(0x12c)]===0x0)return console[_0x1aee2f(0x166)](_0x1aee2f(0x143)),console[_0x1aee2f(0x166)](_0x1aee2f(0x19a)),0x1;const _0x382f83=_0x30c51e[0x0],_0x55fe87=_0x25664f,_0x1c3056=await resolveWorkspaceIdFromOptions(_0x55fe87,_0x3d11a2),_0x30c038={'name':_0x55fe87[_0x1aee2f(0x169)],'subjectTemplate':_0x55fe87[_0x1aee2f(0x151)],'htmlTemplate':_0x55fe87[_0x1aee2f(0x184)],'plaintextTemplate':_0x55fe87['plaintext']},_0x498093=Object[_0x1aee2f(0x164)](Object[_0x1aee2f(0x165)](_0x30c038)[_0x1aee2f(0x193)](([,_0x4bcbe9])=>_0x4bcbe9!==undefined));if(Object[_0x1aee2f(0x18d)](_0x498093)[_0x1aee2f(0x12c)]===0x0)return console['error'](_0x1aee2f(0x15d)),console[_0x1aee2f(0x166)]('Options:\x20--name,\x20--subject,\x20--html,\x20--plaintext'),0x1;const _0x4ae617=await withSpinner(_0x1aee2f(0x128)+_0x382f83+_0x1aee2f(0x14d),()=>_0x3d11a2[_0x1aee2f(0x16a)][_0x1aee2f(0x12e)](_0x382f83,_0x498093,_0x1c3056),{'verbose':_0x25664f[_0x1aee2f(0x127)]});return await handleSDKOutput([_0x4ae617[_0x1aee2f(0x16f)]],_0x25664f),0x0;}}export class EngageTemplateDeleteCommand extends BaseCommand{['name']=a16_0x57fe5e(0x16b);[a16_0x57fe5e(0x15b)]='Delete\x20an\x20email\x20template';async[a16_0x57fe5e(0x131)](_0x163c38){const _0x1b5bc5=a16_0x57fe5e,{options:_0x37665b,args:_0x190785,tdx:_0x37c98c}=_0x163c38;if(_0x190785['length']===0x0)return console[_0x1b5bc5(0x166)](_0x1b5bc5(0x143)),console[_0x1b5bc5(0x166)](_0x1b5bc5(0x16e)),0x1;const _0x55b970=_0x190785[0x0],_0x3bbd3f=_0x37665b,_0x29a0a0=await resolveWorkspaceIdFromOptions(_0x3bbd3f,_0x37c98c);if(!_0x37665b[_0x1b5bc5(0x175)]){const _0x251663=await confirm('Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20template\x20\x27'+_0x55b970+_0x1b5bc5(0x15c));if(!_0x251663)return console['log']('Operation\x20cancelled'),0x0;}return await withSpinner(_0x1b5bc5(0x149)+_0x55b970+_0x1b5bc5(0x14d),()=>_0x37c98c['engage'][_0x1b5bc5(0x148)](_0x55b970,_0x29a0a0),{'verbose':_0x37665b[_0x1b5bc5(0x127)]}),console[_0x1b5bc5(0x115)](_0x1b5bc5(0x119)+_0x55b970+_0x1b5bc5(0x11a)),0x0;}}export class EngageWorkspacesCommand extends BaseCommand{[a16_0x57fe5e(0x169)]=a16_0x57fe5e(0x196);['description']='List\x20workspaces';async[a16_0x57fe5e(0x131)](_0x1c0775){const _0x2cfbb7=a16_0x57fe5e,{options:_0x3b3906,args:_0x3a18f2,tdx:_0x4908c2}=_0x1c0775,_0x5c0d92=_0x3a18f2[0x0],_0x174888=resolveLimit(_0x3b3906[_0x2cfbb7(0x18a)],DEFAULT_LLM_LIMIT),_0x314659=await withSpinner('Fetching\x20workspaces...',()=>_0x4908c2['engage']['listWorkspaces']({'limit':_0x174888}),{'verbose':_0x3b3906['verbose']});let _0x5a79b9=_0x314659[_0x2cfbb7(0x16f)];return _0x5c0d92&&(_0x5a79b9=_0x314659[_0x2cfbb7(0x16f)][_0x2cfbb7(0x193)](_0x30a94f=>matchGlobPattern(_0x30a94f['name'],_0x5c0d92))),await handleSDKOutput(_0x5a79b9,_0x3b3906),0x0;}}export class EngageWorkspaceShowCommand extends BaseCommand{[a16_0x57fe5e(0x169)]=a16_0x57fe5e(0x12d);['description']='Show\x20workspace\x20details';async[a16_0x57fe5e(0x131)](_0x276972){const _0x3893f9=a16_0x57fe5e,{options:_0x3a7788,args:_0x4216f7,tdx:_0x60b665}=_0x276972;if(_0x4216f7['length']===0x0)return console[_0x3893f9(0x166)](_0x3893f9(0x144)),console[_0x3893f9(0x166)]('Usage:\x20tdx\x20engage\x20workspace\x20show\x20<name-or-id>'),0x1;const _0x20a62d=_0x4216f7[0x0],_0x30852f=_0x3a7788,_0x5baa78=_0x30852f['full'];if(_0x5baa78){const _0x20444d=await withSpinner(_0x3893f9(0x18f)+_0x20a62d+_0x3893f9(0x14d),()=>_0x60b665[_0x3893f9(0x16a)][_0x3893f9(0x13a)](_0x20a62d),{'verbose':_0x3a7788[_0x3893f9(0x127)]});await handleSDKOutput([_0x20444d],_0x3a7788);}else{const _0x41a4f0=await withSpinner(_0x3893f9(0x18f)+_0x20a62d+_0x3893f9(0x14d),()=>_0x60b665[_0x3893f9(0x16a)][_0x3893f9(0x173)](_0x20a62d),{'verbose':_0x3a7788[_0x3893f9(0x127)]});await handleSDKOutput([_0x41a4f0],_0x3a7788);}return 0x0;}}export class EngageWorkspaceCreateCommand extends BaseCommand{['name']=a16_0x57fe5e(0x182);['description']=a16_0x57fe5e(0x113);async[a16_0x57fe5e(0x131)](_0x21fb22){const _0x44eef5=a16_0x57fe5e,{options:_0x3f6be4,tdx:_0x17c34f}=_0x21fb22,_0x38619c=_0x3f6be4,_0x552e14=_0x38619c[_0x44eef5(0x169)];if(!_0x552e14)return console[_0x44eef5(0x166)]('Error:\x20--name\x20is\x20required'),console[_0x44eef5(0x166)](_0x44eef5(0x17b)),0x1;const _0x43c720={'name':_0x552e14,'description':_0x38619c[_0x44eef5(0x15b)]},_0x50614a=await withSpinner('Creating\x20workspace\x20\x27'+_0x552e14+_0x44eef5(0x14d),()=>_0x17c34f[_0x44eef5(0x16a)][_0x44eef5(0x179)](_0x43c720));return await handleSDKOutput([_0x50614a[_0x44eef5(0x16f)]],_0x3f6be4),0x0;}}export class EngageWorkspaceUpdateCommand extends BaseCommand{[a16_0x57fe5e(0x169)]=a16_0x57fe5e(0x19d);[a16_0x57fe5e(0x15b)]=a16_0x57fe5e(0x181);async['execute'](_0x299dba){const _0x40488d=a16_0x57fe5e,{options:_0xbeda98,args:_0x2efb0d,tdx:_0x36f810}=_0x299dba;if(_0x2efb0d[_0x40488d(0x12c)]===0x0)return console[_0x40488d(0x166)]('Error:\x20Workspace\x20name\x20or\x20ID\x20is\x20required'),console['error'](_0x40488d(0x11d)),0x1;const _0xbf6dd=_0x2efb0d[0x0],_0x5a3c66=_0xbeda98,_0xf9d1c2={'name':_0x5a3c66['name'],'description':_0x5a3c66[_0x40488d(0x15b)]},_0x4ac8f9=Object[_0x40488d(0x164)](Object[_0x40488d(0x165)](_0xf9d1c2)['filter'](([,_0x2c624a])=>_0x2c624a!==undefined));if(Object[_0x40488d(0x18d)](_0x4ac8f9)['length']===0x0)return console[_0x40488d(0x166)]('Error:\x20At\x20least\x20one\x20field\x20to\x20update\x20is\x20required'),console[_0x40488d(0x166)](_0x40488d(0x19f)),0x1;const _0x575879=await withSpinner(_0x40488d(0x142)+_0xbf6dd+_0x40488d(0x14d),()=>_0x36f810[_0x40488d(0x16a)][_0x40488d(0x123)](_0xbf6dd,_0x4ac8f9),{'verbose':_0xbeda98[_0x40488d(0x127)]});return await handleSDKOutput([_0x575879['data']],_0xbeda98),0x0;}}export class EngageWorkspaceDeleteCommand extends BaseCommand{[a16_0x57fe5e(0x169)]='engage:workspace:delete';[a16_0x57fe5e(0x15b)]=a16_0x57fe5e(0x15f);async['execute'](_0x5d4d83){const _0x456570=a16_0x57fe5e,{options:_0x192794,args:_0x5e08b1,tdx:_0x30d724}=_0x5d4d83;if(_0x5e08b1[_0x456570(0x12c)]===0x0)return console['error']('Error:\x20Workspace\x20name\x20or\x20ID\x20is\x20required'),console[_0x456570(0x166)](_0x456570(0x159)),0x1;const _0x5fb158=_0x5e08b1[0x0];if(!_0x192794[_0x456570(0x175)]){const _0x173e32=await confirm(_0x456570(0x19e)+_0x5fb158+_0x456570(0x15c));if(!_0x173e32)return console['log']('Operation\x20cancelled'),0x0;}return await withSpinner(_0x456570(0x192)+_0x5fb158+_0x456570(0x14d),()=>_0x30d724[_0x456570(0x16a)][_0x456570(0x136)](_0x5fb158),{'verbose':_0x192794[_0x456570(0x127)]}),console[_0x456570(0x115)](_0x456570(0x177)+_0x5fb158+'\x27\x20deleted\x20successfully'),0x0;}}export class EngageWorkspaceUseCommand extends BaseCommand{[a16_0x57fe5e(0x169)]='engage:workspace:use';[a16_0x57fe5e(0x15b)]=a16_0x57fe5e(0x161);async[a16_0x57fe5e(0x131)](_0x4beece){const _0x5a7536=a16_0x57fe5e,{options:_0x37deae,args:_0xea0b97,tdx:_0x979254}=_0x4beece;if(_0xea0b97['length']===0x0)return console[_0x5a7536(0x166)]('Error:\x20Workspace\x20name\x20is\x20required'),console[_0x5a7536(0x166)](_0x5a7536(0x13d)),0x1;const _0x182cb2=_0xea0b97[0x0];await withSpinner(_0x5a7536(0x135)+_0x182cb2+_0x5a7536(0x14d),()=>_0x979254[_0x5a7536(0x16a)][_0x5a7536(0x18e)](_0x182cb2));const _0xbffd5b=_0x37deae[_0x5a7536(0x11f)]||undefined;return saveSessionContext({'engage_workspace':_0x182cb2},_0xbffd5b),console[_0x5a7536(0x115)](_0x5a7536(0x198)+_0x182cb2),console['log'](_0x5a7536(0x130)),0x0;}}
|
|
1
|
+
const a16_0x48275b=a16_0x2981;(function(_0x4324cc,_0x347115){const _0x383e08=a16_0x2981,_0x2c442d=_0x4324cc();while(!![]){try{const _0x508940=parseInt(_0x383e08(0x138))/0x1*(parseInt(_0x383e08(0x181))/0x2)+-parseInt(_0x383e08(0x17c))/0x3*(-parseInt(_0x383e08(0x123))/0x4)+parseInt(_0x383e08(0x13e))/0x5*(-parseInt(_0x383e08(0x12c))/0x6)+parseInt(_0x383e08(0x119))/0x7*(parseInt(_0x383e08(0x12b))/0x8)+-parseInt(_0x383e08(0x128))/0x9+-parseInt(_0x383e08(0x15f))/0xa*(parseInt(_0x383e08(0x193))/0xb)+parseInt(_0x383e08(0x16f))/0xc;if(_0x508940===_0x347115)break;else _0x2c442d['push'](_0x2c442d['shift']());}catch(_0x1d8dfb){_0x2c442d['push'](_0x2c442d['shift']());}}}(a16_0x219a,0x24d89));import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import{matchGlobPattern}from'../utils/string-utils.js';import{confirm}from'../utils/prompt.js';import{loadSessionContext,saveSessionContext}from'../core/session.js';import{DEFAULT_LLM_LIMIT,resolveLimit}from'../core/constants.js';import{SDKError,ErrorCode}from'../sdk/errors.js';async function resolveWorkspaceIdFromOptions(_0x2bd6d2,_0x114f7c,_0x5bf1f2=![]){const _0x4bae04=a16_0x2981;if(_0x2bd6d2[_0x4bae04(0x184)])return await _0x114f7c['engage']['resolveWorkspaceId'](_0x2bd6d2['workspace']);const _0x5b304e=loadSessionContext(_0x2bd6d2[_0x4bae04(0x140)]);if(_0x5b304e?.[_0x4bae04(0x17d)])return await _0x114f7c[_0x4bae04(0x164)][_0x4bae04(0x148)](_0x5b304e['engage_workspace']);if(_0x5bf1f2)throw new SDKError(ErrorCode['MISSING_ARGUMENT'],_0x4bae04(0x168),undefined,{'helpText':_0x4bae04(0x167)});return undefined;}async function resolveSegmentFromOptions(_0x2b4b15,_0xdb2811){const _0x185dca=a16_0x2981;if(!_0x2b4b15[_0x185dca(0x18f)])return{};const _0x3962b7=_0x2b4b15[_0x185dca(0x18f)],_0x148507=await _0xdb2811[_0x185dca(0x18f)]['resolvePathToResource'](_0x3962b7);return{'audienceId':_0x148507['parentId'],'audienceName':_0x148507[_0x185dca(0x13a)],..._0x148507[_0x185dca(0x12f)]&&{'segmentId':_0x148507[_0x185dca(0x12f)],'segmentName':_0x148507[_0x185dca(0x127)]}};}function buildConnectorConfig(_0x38b8c6){const _0x2749bd=a16_0x2981,_0x16de2b=_0x38b8c6[_0x2749bd(0x110)],_0x4af754=_0x38b8c6[_0x2749bd(0x198)];if(!_0x16de2b&&!_0x4af754)return undefined;return{..._0x16de2b&&{'emailSenderId':_0x16de2b},..._0x4af754&&{'jsonColumns':_0x4af754}};}export class EngageCampaignsCommand extends BaseCommand{['name']=a16_0x48275b(0x162);['description']=a16_0x48275b(0x178);async[a16_0x48275b(0x187)](_0x199e20){const _0x10888b=a16_0x48275b,{options:_0x59261e,args:_0x3f8033,tdx:_0x5be8d3}=_0x199e20,_0x3a34e3=_0x3f8033[0x0],_0x578369=resolveLimit(_0x59261e[_0x10888b(0x14a)],DEFAULT_LLM_LIMIT),_0x19cbef=_0x59261e,_0x55675c=_0x19cbef[_0x10888b(0x196)],_0x37a63b=_0x19cbef[_0x10888b(0x171)],_0x37c8e9=await resolveWorkspaceIdFromOptions(_0x19cbef,_0x5be8d3),_0x1b56d8=await withSpinner(_0x10888b(0x163),()=>_0x5be8d3[_0x10888b(0x164)][_0x10888b(0x14b)]({'type':_0x55675c,'status':_0x37a63b,'workspaceId':_0x37c8e9,'limit':_0x578369}),{'verbose':_0x59261e[_0x10888b(0x126)]});let _0x2c2bae=_0x1b56d8[_0x10888b(0x125)];return _0x3a34e3&&(_0x2c2bae=_0x1b56d8[_0x10888b(0x125)][_0x10888b(0x180)](_0x248b45=>matchGlobPattern(_0x248b45['name'],_0x3a34e3))),await handleSDKOutput(_0x2c2bae,_0x59261e),0x0;}}export class EngageCampaignShowCommand extends BaseCommand{[a16_0x48275b(0x116)]=a16_0x48275b(0x18a);[a16_0x48275b(0x147)]=a16_0x48275b(0x11d);async[a16_0x48275b(0x187)](_0x411608){const _0x51fa2b=a16_0x48275b,{options:_0x41eb52,args:_0x43572f,tdx:_0x230c2}=_0x411608;if(_0x43572f[_0x51fa2b(0x137)]===0x0)return console[_0x51fa2b(0x131)](_0x51fa2b(0x158)),console[_0x51fa2b(0x131)](_0x51fa2b(0x115)),0x1;const _0x513237=_0x43572f[0x0],_0x2f3a87=_0x41eb52,_0x3f3541=await resolveWorkspaceIdFromOptions(_0x2f3a87,_0x230c2),_0x23e19c=_0x2f3a87[_0x51fa2b(0x174)];if(_0x23e19c){const _0x16a984=await withSpinner(_0x51fa2b(0x159)+_0x513237+_0x51fa2b(0x135),()=>_0x230c2[_0x51fa2b(0x164)][_0x51fa2b(0x189)](_0x513237,_0x3f3541),{'verbose':_0x41eb52[_0x51fa2b(0x126)]});await handleSDKOutput([_0x16a984],_0x41eb52);}else{const _0x48e7a7=await withSpinner('Fetching\x20campaign\x20\x27'+_0x513237+_0x51fa2b(0x135),()=>_0x230c2[_0x51fa2b(0x164)]['getCampaign'](_0x513237,_0x3f3541),{'verbose':_0x41eb52[_0x51fa2b(0x126)]});await handleSDKOutput([_0x48e7a7],_0x41eb52);}return 0x0;}}export class EngageCampaignCreateCommand extends BaseCommand{[a16_0x48275b(0x116)]=a16_0x48275b(0x186);[a16_0x48275b(0x147)]='Create\x20a\x20new\x20campaign';async['execute'](_0x5b43ec){const _0xb047ad=a16_0x48275b,{options:_0x305205,tdx:_0x3b5834}=_0x5b43ec,_0x14ba4b=_0x305205,_0x27c313=_0x14ba4b[_0xb047ad(0x116)],_0x396553=_0x14ba4b[_0xb047ad(0x196)];if(!_0x27c313)return console[_0xb047ad(0x131)](_0xb047ad(0x134)),console[_0xb047ad(0x131)](_0xb047ad(0x18b)),0x1;if(!_0x396553)return console[_0xb047ad(0x131)]('Error:\x20--type\x20is\x20required\x20(email\x20or\x20push)'),console[_0xb047ad(0x131)]('Usage:\x20tdx\x20engage\x20campaign\x20create\x20--name\x20<name>\x20--type\x20<email|push>'),0x1;const _0x51101d=await resolveWorkspaceIdFromOptions(_0x14ba4b,_0x3b5834,!![]),_0x2e479f=await resolveSegmentFromOptions(_0x14ba4b,_0x3b5834),_0x54dacd=buildConnectorConfig(_0x14ba4b),_0x23feb2={'name':_0x27c313,'campaignType':_0x396553,'workspaceId':_0x51101d,'description':_0x14ba4b[_0xb047ad(0x147)],..._0x2e479f,'connectorConfig':_0x54dacd,'startAt':_0x14ba4b[_0xb047ad(0x155)],'timezone':_0x14ba4b['timezone']},_0x12e135=await withSpinner(_0xb047ad(0x16e)+_0x27c313+_0xb047ad(0x135),()=>_0x3b5834['engage']['createCampaign'](_0x23feb2));return await handleSDKOutput([_0x12e135[_0xb047ad(0x125)]],_0x305205),0x0;}}export class EngageCampaignUpdateCommand extends BaseCommand{[a16_0x48275b(0x116)]='engage:campaign:update';[a16_0x48275b(0x147)]=a16_0x48275b(0x157);async[a16_0x48275b(0x187)](_0x594e02){const _0x5298de=a16_0x48275b,{options:_0x2152d8,args:_0x1f242b,tdx:_0x1be0e6}=_0x594e02;if(_0x1f242b[_0x5298de(0x137)]===0x0)return console[_0x5298de(0x131)](_0x5298de(0x158)),console[_0x5298de(0x131)](_0x5298de(0x16a)),0x1;const _0x24b870=_0x1f242b[0x0],_0x2f255d=_0x2152d8,_0x50d8be=await resolveWorkspaceIdFromOptions(_0x2f255d,_0x1be0e6),_0x23809b=await resolveSegmentFromOptions(_0x2f255d,_0x1be0e6),_0x1aa9e2=buildConnectorConfig(_0x2f255d),_0x3c21d6={'name':_0x2f255d[_0x5298de(0x116)],'description':_0x2f255d['description'],..._0x23809b,'connectorConfig':_0x1aa9e2,'startAt':_0x2f255d[_0x5298de(0x155)],'timezone':_0x2f255d[_0x5298de(0x185)]},_0x43647c=Object['fromEntries'](Object[_0x5298de(0x114)](_0x3c21d6)[_0x5298de(0x180)](([,_0x1421a0])=>_0x1421a0!==undefined));if(Object[_0x5298de(0x18e)](_0x43647c)[_0x5298de(0x137)]===0x0)return console[_0x5298de(0x131)](_0x5298de(0x11c)),console[_0x5298de(0x131)]('Options:\x20--name,\x20--description,\x20--segment,\x20--email-sender-id,\x20--json-columns,\x20--start-at,\x20--timezone'),0x1;const _0x17cdc1=await withSpinner(_0x5298de(0x12d)+_0x24b870+_0x5298de(0x135),()=>_0x1be0e6['engage']['updateCampaign'](_0x24b870,_0x43647c,_0x50d8be),{'verbose':_0x2152d8[_0x5298de(0x126)]});return await handleSDKOutput([_0x17cdc1[_0x5298de(0x125)]],_0x2152d8),0x0;}}export class EngageCampaignDeleteCommand extends BaseCommand{[a16_0x48275b(0x116)]='engage:campaign:delete';[a16_0x48275b(0x147)]=a16_0x48275b(0x10e);async[a16_0x48275b(0x187)](_0x55d57c){const _0xb4988e=a16_0x48275b,{options:_0xc53b49,args:_0x5dcc63,tdx:_0x2c2554}=_0x55d57c;if(_0x5dcc63[_0xb4988e(0x137)]===0x0)return console[_0xb4988e(0x131)](_0xb4988e(0x158)),console[_0xb4988e(0x131)]('Usage:\x20tdx\x20engage\x20campaign\x20delete\x20<name-or-id>'),0x1;const _0x2389d5=_0x5dcc63[0x0],_0x377063=_0xc53b49,_0x5b0f86=await resolveWorkspaceIdFromOptions(_0x377063,_0x2c2554);if(!_0xc53b49[_0xb4988e(0x146)]){const _0x53a05d=await confirm(_0xb4988e(0x195)+_0x2389d5+_0xb4988e(0x191));if(!_0x53a05d)return console[_0xb4988e(0x151)](_0xb4988e(0x15d)),0x0;}return await withSpinner(_0xb4988e(0x170)+_0x2389d5+_0xb4988e(0x135),()=>_0x2c2554[_0xb4988e(0x164)][_0xb4988e(0x17f)](_0x2389d5,_0x5b0f86),{'verbose':_0xc53b49[_0xb4988e(0x126)]}),console[_0xb4988e(0x151)](_0xb4988e(0x17b)+_0x2389d5+_0xb4988e(0x14e)),0x0;}}export class EngageCampaignLaunchCommand extends BaseCommand{[a16_0x48275b(0x116)]=a16_0x48275b(0x144);[a16_0x48275b(0x147)]=a16_0x48275b(0x179);async['execute'](_0x14f25b){const _0x1f7fd6=a16_0x48275b,{options:_0x233d58,args:_0x4e1cd2,tdx:_0x36a284}=_0x14f25b;if(_0x4e1cd2['length']===0x0)return console[_0x1f7fd6(0x131)]('Error:\x20Campaign\x20name\x20or\x20ID\x20is\x20required'),console['error']('Usage:\x20tdx\x20engage\x20campaign\x20launch\x20<name-or-id>'),0x1;const _0x1f0778=_0x4e1cd2[0x0],_0x450d5b=_0x233d58,_0x1f0d2c=await resolveWorkspaceIdFromOptions(_0x450d5b,_0x36a284);return await withSpinner(_0x1f7fd6(0x117)+_0x1f0778+_0x1f7fd6(0x135),()=>_0x36a284['engage']['launchCampaign'](_0x1f0778,_0x1f0d2c),{'verbose':_0x233d58['verbose']}),console[_0x1f7fd6(0x151)](_0x1f7fd6(0x17b)+_0x1f0778+_0x1f7fd6(0x188)),0x0;}}function a16_0x219a(){const _0x435102=['Fetching\x20workspace\x20\x27','Usage:\x20tdx\x20engage\x20workspace\x20create\x20--name\x20<name>\x20[--description\x20<desc>]','28pqBCUn','Usage:\x20tdx\x20engage\x20campaign\x20duplicate\x20<name-or-id>','data','verbose','segmentName','2403693xyhNPl','Options:\x20--name,\x20--subject,\x20--html,\x20--plaintext','Resume\x20a\x20paused\x20campaign','5912BxFrif','888LjzglV','Updating\x20campaign\x20\x27','plaintext','segmentId','deleteTemplate','error','getWorkspaceFull','engage:campaign:pause','Error:\x20--name\x20is\x20required','\x27...','editorType','length','487YCUcrL','Fetching\x20templates...','parentName','Update\x20an\x20email\x20template','listWorkspaces','engage:workspace:use','3135nFFHPq','Delete\x20a\x20workspace','session','Verifying\x20workspace\x20\x27','html','createTemplate','engage:campaign:launch','Duplicating\x20campaign\x20\x27','yes','description','resolveWorkspaceId','getTemplate','limit','listCampaigns','engage:campaign:resume','Template\x20\x27','\x27\x20deleted\x20successfully','Fetching\x20workspaces...','pauseCampaign','log','duplicateCampaign','Updating\x20template\x20\x27','Resuming\x20campaign\x20\x27','startAt','Error:\x20Template\x20name\x20or\x20ID\x20is\x20required','Update\x20a\x20campaign','Error:\x20Campaign\x20name\x20or\x20ID\x20is\x20required','Fetching\x20campaign\x20\x27','Create\x20a\x20workspace','Set\x20workspace\x20context\x20for\x20Engage\x20commands','Usage:\x20tdx\x20engage\x20template\x20delete\x20<name-or-id>','Operation\x20cancelled','Creating\x20workspace\x20\x27','380Ighvbz','Pause\x20a\x20campaign','\x27\x20resumed\x20successfully','engage:campaigns','Fetching\x20campaigns...','engage','engage:workspace:update','engage:templates','Use\x20--workspace\x20<name>\x20or\x20set\x20with\x20\x22tdx\x20use\x20engage_workspace\x20<name>\x22','Workspace\x20is\x20required\x20for\x20this\x20operation','engage:workspace:show','Usage:\x20tdx\x20engage\x20campaign\x20update\x20<name-or-id>\x20[--name\x20<new-name>]\x20...','Show\x20workspace\x20details','Updating\x20workspace\x20\x27','Usage:\x20tdx\x20engage\x20workspace\x20update\x20<name-or-id>\x20[--name\x20<new-name>]\x20...','Creating\x20campaign\x20\x27','3385152aaEMbK','Deleting\x20campaign\x20\x27','status','Duplicate\x20a\x20campaign','engage:workspace:delete','full','engage:template:update','Error:\x20Workspace\x20name\x20is\x20required','Create\x20an\x20email\x20template','List\x20campaigns','Launch\x20a\x20campaign','Error:\x20--html\x20is\x20required','Campaign\x20\x27','48801yKkpXW','engage_workspace','engage:template:create','deleteCampaign','filter','328wIYSna','List\x20workspaces','Error:\x20Workspace\x20name\x20or\x20ID\x20is\x20required','workspace','timezone','engage:campaign:create','execute','\x27\x20launched\x20successfully','getCampaignFull','engage:campaign:show','Usage:\x20tdx\x20engage\x20campaign\x20create\x20--name\x20<name>\x20--type\x20<email|push>','engage:campaign:duplicate','Usage:\x20tdx\x20engage\x20workspace\x20use\x20<name>','keys','segment','Usage:\x20tdx\x20engage\x20template\x20update\x20<name-or-id>\x20[--name\x20<new-name>]\x20...','\x27?\x20This\x20cannot\x20be\x20undone.','Usage:\x20tdx\x20engage\x20campaign\x20resume\x20<name-or-id>','64966biwFOW','Deleting\x20template\x20\x27','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20campaign\x20\x27','type','List\x20email\x20templates','jsonColumns','createWorkspace','Usage:\x20tdx\x20engage\x20template\x20show\x20<name-or-id>','Delete\x20an\x20email\x20template','resumeCampaign','Delete\x20a\x20campaign','listTemplates','emailSenderId','getWorkspace','Options:\x20--name,\x20--description','Usage:\x20tdx\x20engage\x20template\x20create\x20--name\x20<name>\x20--subject\x20<subject>\x20--html\x20<html>','entries','Usage:\x20tdx\x20engage\x20campaign\x20show\x20<name-or-id>','name','Launching\x20campaign\x20\x27','Fetching\x20template\x20\x27','2457oQVKin','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20workspace\x20\x27','updateWorkspace','Error:\x20At\x20least\x20one\x20field\x20to\x20update\x20is\x20required','Show\x20campaign\x20details','engage:template:delete','subject','engage:workspace:create'];a16_0x219a=function(){return _0x435102;};return a16_0x219a();}export class EngageCampaignPauseCommand extends BaseCommand{[a16_0x48275b(0x116)]=a16_0x48275b(0x133);[a16_0x48275b(0x147)]=a16_0x48275b(0x160);async[a16_0x48275b(0x187)](_0x94b299){const _0x4b3c6b=a16_0x48275b,{options:_0x5580fb,args:_0x1268ee,tdx:_0x342fe0}=_0x94b299;if(_0x1268ee[_0x4b3c6b(0x137)]===0x0)return console[_0x4b3c6b(0x131)](_0x4b3c6b(0x158)),console[_0x4b3c6b(0x131)]('Usage:\x20tdx\x20engage\x20campaign\x20pause\x20<name-or-id>'),0x1;const _0x46af7e=_0x1268ee[0x0],_0x1bee3c=_0x5580fb,_0x41c55e=await resolveWorkspaceIdFromOptions(_0x1bee3c,_0x342fe0);return await withSpinner('Pausing\x20campaign\x20\x27'+_0x46af7e+'\x27...',()=>_0x342fe0['engage'][_0x4b3c6b(0x150)](_0x46af7e,_0x41c55e),{'verbose':_0x5580fb[_0x4b3c6b(0x126)]}),console['log'](_0x4b3c6b(0x17b)+_0x46af7e+'\x27\x20paused\x20successfully'),0x0;}}export class EngageCampaignResumeCommand extends BaseCommand{['name']=a16_0x48275b(0x14c);[a16_0x48275b(0x147)]=a16_0x48275b(0x12a);async['execute'](_0x38f157){const _0xf3f5be=a16_0x48275b,{options:_0x256c69,args:_0x5ddb1f,tdx:_0x2e3f3e}=_0x38f157;if(_0x5ddb1f[_0xf3f5be(0x137)]===0x0)return console[_0xf3f5be(0x131)](_0xf3f5be(0x158)),console[_0xf3f5be(0x131)](_0xf3f5be(0x192)),0x1;const _0x4b06d6=_0x5ddb1f[0x0],_0xe27281=_0x256c69,_0xbc7f7c=await resolveWorkspaceIdFromOptions(_0xe27281,_0x2e3f3e);return await withSpinner(_0xf3f5be(0x154)+_0x4b06d6+_0xf3f5be(0x135),()=>_0x2e3f3e['engage'][_0xf3f5be(0x10d)](_0x4b06d6,_0xbc7f7c),{'verbose':_0x256c69['verbose']}),console[_0xf3f5be(0x151)](_0xf3f5be(0x17b)+_0x4b06d6+_0xf3f5be(0x161)),0x0;}}export class EngageCampaignDuplicateCommand extends BaseCommand{[a16_0x48275b(0x116)]=a16_0x48275b(0x18c);[a16_0x48275b(0x147)]=a16_0x48275b(0x172);async[a16_0x48275b(0x187)](_0x4827d5){const _0x5b5e2e=a16_0x48275b,{options:_0x215640,args:_0x48d7c3,tdx:_0x146d35}=_0x4827d5;if(_0x48d7c3[_0x5b5e2e(0x137)]===0x0)return console[_0x5b5e2e(0x131)]('Error:\x20Campaign\x20name\x20or\x20ID\x20is\x20required'),console['error'](_0x5b5e2e(0x124)),0x1;const _0x5a56c7=_0x48d7c3[0x0],_0x56add0=_0x215640,_0x2c066f=await resolveWorkspaceIdFromOptions(_0x56add0,_0x146d35),_0x586bc3=await withSpinner(_0x5b5e2e(0x145)+_0x5a56c7+_0x5b5e2e(0x135),()=>_0x146d35[_0x5b5e2e(0x164)][_0x5b5e2e(0x152)](_0x5a56c7,_0x2c066f),{'verbose':_0x215640[_0x5b5e2e(0x126)]});return await handleSDKOutput([_0x586bc3[_0x5b5e2e(0x125)]],_0x215640),0x0;}}export class EngageTemplatesCommand extends BaseCommand{['name']=a16_0x48275b(0x166);[a16_0x48275b(0x147)]=a16_0x48275b(0x197);async[a16_0x48275b(0x187)](_0x3310c6){const _0x3f22f4=a16_0x48275b,{options:_0x2f8d8d,args:_0x3f089b,tdx:_0x82963b}=_0x3310c6,_0x376532=_0x3f089b[0x0],_0x447681=resolveLimit(_0x2f8d8d[_0x3f22f4(0x14a)],DEFAULT_LLM_LIMIT),_0x11a263=_0x2f8d8d,_0x13d151=await resolveWorkspaceIdFromOptions(_0x11a263,_0x82963b),_0x16b55c=await withSpinner(_0x3f22f4(0x139),()=>_0x82963b['engage'][_0x3f22f4(0x10f)]({'workspaceId':_0x13d151,'limit':_0x447681}),{'verbose':_0x2f8d8d['verbose']});let _0x1033a0=_0x16b55c[_0x3f22f4(0x125)];return _0x376532&&(_0x1033a0=_0x16b55c['data'][_0x3f22f4(0x180)](_0x5189ee=>matchGlobPattern(_0x5189ee[_0x3f22f4(0x116)],_0x376532))),await handleSDKOutput(_0x1033a0,_0x2f8d8d),0x0;}}export class EngageTemplateShowCommand extends BaseCommand{['name']='engage:template:show';[a16_0x48275b(0x147)]='Show\x20email\x20template\x20details';async[a16_0x48275b(0x187)](_0x5ecec6){const _0x3a4646=a16_0x48275b,{options:_0x4da69e,args:_0x4c8ef7,tdx:_0xf4cf42}=_0x5ecec6;if(_0x4c8ef7[_0x3a4646(0x137)]===0x0)return console[_0x3a4646(0x131)](_0x3a4646(0x156)),console[_0x3a4646(0x131)](_0x3a4646(0x19a)),0x1;const _0x39e046=_0x4c8ef7[0x0],_0x191d87=_0x4da69e,_0x524d2b=await resolveWorkspaceIdFromOptions(_0x191d87,_0xf4cf42),_0x38b419=_0x191d87['full'];if(_0x38b419){const _0x2f8e85=await withSpinner(_0x3a4646(0x118)+_0x39e046+'\x27...',()=>_0xf4cf42[_0x3a4646(0x164)]['getTemplateFull'](_0x39e046,_0x524d2b),{'verbose':_0x4da69e[_0x3a4646(0x126)]});await handleSDKOutput([_0x2f8e85],_0x4da69e);}else{const _0x2657e6=await withSpinner(_0x3a4646(0x118)+_0x39e046+_0x3a4646(0x135),()=>_0xf4cf42[_0x3a4646(0x164)][_0x3a4646(0x149)](_0x39e046,_0x524d2b),{'verbose':_0x4da69e['verbose']});await handleSDKOutput([_0x2657e6],_0x4da69e);}return 0x0;}}export class EngageTemplateCreateCommand extends BaseCommand{[a16_0x48275b(0x116)]=a16_0x48275b(0x17e);[a16_0x48275b(0x147)]=a16_0x48275b(0x177);async[a16_0x48275b(0x187)](_0x12f2f5){const _0x2a9255=a16_0x48275b,{options:_0x2a2fe5,tdx:_0x48f3f1}=_0x12f2f5,_0x34ede1=_0x2a2fe5,_0x1e0f18=_0x34ede1['name'],_0x396543=_0x34ede1[_0x2a9255(0x11f)],_0x5e9309=_0x34ede1[_0x2a9255(0x142)];if(!_0x1e0f18)return console[_0x2a9255(0x131)]('Error:\x20--name\x20is\x20required'),console[_0x2a9255(0x131)](_0x2a9255(0x113)),0x1;if(!_0x396543)return console[_0x2a9255(0x131)]('Error:\x20--subject\x20is\x20required'),0x1;if(!_0x5e9309)return console[_0x2a9255(0x131)](_0x2a9255(0x17a)),0x1;const _0x21ea6e=await resolveWorkspaceIdFromOptions(_0x34ede1,_0x48f3f1,!![]),_0x11395f={'name':_0x1e0f18,'subjectTemplate':_0x396543,'htmlTemplate':_0x5e9309,'workspaceId':_0x21ea6e,'plaintextTemplate':_0x34ede1['plaintext'],'editorType':_0x34ede1[_0x2a9255(0x136)]},_0x7c25e=await withSpinner('Creating\x20template\x20\x27'+_0x1e0f18+_0x2a9255(0x135),()=>_0x48f3f1['engage'][_0x2a9255(0x143)](_0x11395f));return await handleSDKOutput([_0x7c25e[_0x2a9255(0x125)]],_0x2a2fe5),0x0;}}export class EngageTemplateUpdateCommand extends BaseCommand{[a16_0x48275b(0x116)]=a16_0x48275b(0x175);[a16_0x48275b(0x147)]=a16_0x48275b(0x13b);async[a16_0x48275b(0x187)](_0x594189){const _0x48f3dd=a16_0x48275b,{options:_0x3d3665,args:_0x10f1e6,tdx:_0x36a009}=_0x594189;if(_0x10f1e6[_0x48f3dd(0x137)]===0x0)return console[_0x48f3dd(0x131)](_0x48f3dd(0x156)),console[_0x48f3dd(0x131)](_0x48f3dd(0x190)),0x1;const _0x43fcaa=_0x10f1e6[0x0],_0x1cf452=_0x3d3665,_0x405c64=await resolveWorkspaceIdFromOptions(_0x1cf452,_0x36a009),_0x183c7d={'name':_0x1cf452['name'],'subjectTemplate':_0x1cf452[_0x48f3dd(0x11f)],'htmlTemplate':_0x1cf452[_0x48f3dd(0x142)],'plaintextTemplate':_0x1cf452[_0x48f3dd(0x12e)]},_0x53d1ef=Object['fromEntries'](Object['entries'](_0x183c7d)['filter'](([,_0x1618f8])=>_0x1618f8!==undefined));if(Object['keys'](_0x53d1ef)[_0x48f3dd(0x137)]===0x0)return console['error'](_0x48f3dd(0x11c)),console['error'](_0x48f3dd(0x129)),0x1;const _0x124283=await withSpinner(_0x48f3dd(0x153)+_0x43fcaa+_0x48f3dd(0x135),()=>_0x36a009[_0x48f3dd(0x164)]['updateTemplate'](_0x43fcaa,_0x53d1ef,_0x405c64),{'verbose':_0x3d3665[_0x48f3dd(0x126)]});return await handleSDKOutput([_0x124283[_0x48f3dd(0x125)]],_0x3d3665),0x0;}}function a16_0x2981(_0x1ab191,_0x337db0){_0x1ab191=_0x1ab191-0x10d;const _0x219a59=a16_0x219a();let _0x298181=_0x219a59[_0x1ab191];return _0x298181;}export class EngageTemplateDeleteCommand extends BaseCommand{[a16_0x48275b(0x116)]=a16_0x48275b(0x11e);[a16_0x48275b(0x147)]=a16_0x48275b(0x19b);async[a16_0x48275b(0x187)](_0x1399a2){const _0x20bfae=a16_0x48275b,{options:_0x1cd276,args:_0x533201,tdx:_0x5df7a9}=_0x1399a2;if(_0x533201[_0x20bfae(0x137)]===0x0)return console[_0x20bfae(0x131)]('Error:\x20Template\x20name\x20or\x20ID\x20is\x20required'),console[_0x20bfae(0x131)](_0x20bfae(0x15c)),0x1;const _0x2457bb=_0x533201[0x0],_0x2c9c88=_0x1cd276,_0x5a78aa=await resolveWorkspaceIdFromOptions(_0x2c9c88,_0x5df7a9);if(!_0x1cd276[_0x20bfae(0x146)]){const _0x42f327=await confirm('Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20template\x20\x27'+_0x2457bb+'\x27?\x20This\x20cannot\x20be\x20undone.');if(!_0x42f327)return console[_0x20bfae(0x151)](_0x20bfae(0x15d)),0x0;}return await withSpinner(_0x20bfae(0x194)+_0x2457bb+_0x20bfae(0x135),()=>_0x5df7a9[_0x20bfae(0x164)][_0x20bfae(0x130)](_0x2457bb,_0x5a78aa),{'verbose':_0x1cd276[_0x20bfae(0x126)]}),console[_0x20bfae(0x151)](_0x20bfae(0x14d)+_0x2457bb+'\x27\x20deleted\x20successfully'),0x0;}}export class EngageWorkspacesCommand extends BaseCommand{['name']='engage:workspaces';[a16_0x48275b(0x147)]=a16_0x48275b(0x182);async['execute'](_0xff136d){const _0x26c6ee=a16_0x48275b,{options:_0x169372,args:_0x103527,tdx:_0x297f3e}=_0xff136d,_0x50ef6d=_0x103527[0x0],_0x1987a4=resolveLimit(_0x169372[_0x26c6ee(0x14a)],DEFAULT_LLM_LIMIT),_0x411a97=await withSpinner(_0x26c6ee(0x14f),()=>_0x297f3e[_0x26c6ee(0x164)][_0x26c6ee(0x13c)]({'limit':_0x1987a4}),{'verbose':_0x169372[_0x26c6ee(0x126)]});let _0x2e9286=_0x411a97[_0x26c6ee(0x125)];return _0x50ef6d&&(_0x2e9286=_0x411a97[_0x26c6ee(0x125)][_0x26c6ee(0x180)](_0xcc000f=>matchGlobPattern(_0xcc000f[_0x26c6ee(0x116)],_0x50ef6d))),await handleSDKOutput(_0x2e9286,_0x169372),0x0;}}export class EngageWorkspaceShowCommand extends BaseCommand{[a16_0x48275b(0x116)]=a16_0x48275b(0x169);[a16_0x48275b(0x147)]=a16_0x48275b(0x16b);async[a16_0x48275b(0x187)](_0x2f525c){const _0x27e96d=a16_0x48275b,{options:_0x376a27,args:_0xe723c5,tdx:_0x2d1147}=_0x2f525c;if(_0xe723c5[_0x27e96d(0x137)]===0x0)return console[_0x27e96d(0x131)](_0x27e96d(0x183)),console[_0x27e96d(0x131)]('Usage:\x20tdx\x20engage\x20workspace\x20show\x20<name-or-id>'),0x1;const _0x4c13ba=_0xe723c5[0x0],_0x33a3e0=_0x376a27,_0x49180f=_0x33a3e0[_0x27e96d(0x174)];if(_0x49180f){const _0x20011c=await withSpinner(_0x27e96d(0x121)+_0x4c13ba+'\x27...',()=>_0x2d1147['engage'][_0x27e96d(0x132)](_0x4c13ba),{'verbose':_0x376a27['verbose']});await handleSDKOutput([_0x20011c],_0x376a27);}else{const _0x37478c=await withSpinner('Fetching\x20workspace\x20\x27'+_0x4c13ba+'\x27...',()=>_0x2d1147[_0x27e96d(0x164)][_0x27e96d(0x111)](_0x4c13ba),{'verbose':_0x376a27['verbose']});await handleSDKOutput([_0x37478c],_0x376a27);}return 0x0;}}export class EngageWorkspaceCreateCommand extends BaseCommand{[a16_0x48275b(0x116)]=a16_0x48275b(0x120);['description']=a16_0x48275b(0x15a);async[a16_0x48275b(0x187)](_0x23503f){const _0x8afceb=a16_0x48275b,{options:_0x452436,tdx:_0x4a5368}=_0x23503f,_0x1777df=_0x452436,_0x598dd6=_0x1777df['name'];if(!_0x598dd6)return console[_0x8afceb(0x131)]('Error:\x20--name\x20is\x20required'),console[_0x8afceb(0x131)](_0x8afceb(0x122)),0x1;const _0x55d817={'name':_0x598dd6,'description':_0x1777df[_0x8afceb(0x147)]},_0x30673d=await withSpinner(_0x8afceb(0x15e)+_0x598dd6+_0x8afceb(0x135),()=>_0x4a5368[_0x8afceb(0x164)][_0x8afceb(0x199)](_0x55d817));return await handleSDKOutput([_0x30673d[_0x8afceb(0x125)]],_0x452436),0x0;}}export class EngageWorkspaceUpdateCommand extends BaseCommand{[a16_0x48275b(0x116)]=a16_0x48275b(0x165);[a16_0x48275b(0x147)]='Update\x20a\x20workspace';async['execute'](_0x4d6ce9){const _0x568b8b=a16_0x48275b,{options:_0x158a55,args:_0x1ef5eb,tdx:_0x9585e8}=_0x4d6ce9;if(_0x1ef5eb[_0x568b8b(0x137)]===0x0)return console['error'](_0x568b8b(0x183)),console[_0x568b8b(0x131)](_0x568b8b(0x16d)),0x1;const _0x1b875b=_0x1ef5eb[0x0],_0x2110d6=_0x158a55,_0x1dab11={'name':_0x2110d6[_0x568b8b(0x116)],'description':_0x2110d6[_0x568b8b(0x147)]},_0x18b945=Object['fromEntries'](Object['entries'](_0x1dab11)['filter'](([,_0xae1264])=>_0xae1264!==undefined));if(Object['keys'](_0x18b945)['length']===0x0)return console['error'](_0x568b8b(0x11c)),console[_0x568b8b(0x131)](_0x568b8b(0x112)),0x1;const _0x16ef75=await withSpinner(_0x568b8b(0x16c)+_0x1b875b+_0x568b8b(0x135),()=>_0x9585e8['engage'][_0x568b8b(0x11b)](_0x1b875b,_0x18b945),{'verbose':_0x158a55['verbose']});return await handleSDKOutput([_0x16ef75[_0x568b8b(0x125)]],_0x158a55),0x0;}}export class EngageWorkspaceDeleteCommand extends BaseCommand{[a16_0x48275b(0x116)]=a16_0x48275b(0x173);[a16_0x48275b(0x147)]=a16_0x48275b(0x13f);async[a16_0x48275b(0x187)](_0x16a2ab){const _0x498cd9=a16_0x48275b,{options:_0x3ae714,args:_0x1176eb,tdx:_0x396272}=_0x16a2ab;if(_0x1176eb[_0x498cd9(0x137)]===0x0)return console[_0x498cd9(0x131)](_0x498cd9(0x183)),console[_0x498cd9(0x131)]('Usage:\x20tdx\x20engage\x20workspace\x20delete\x20<name-or-id>'),0x1;const _0x30d12b=_0x1176eb[0x0];if(!_0x3ae714[_0x498cd9(0x146)]){const _0x4bb7a4=await confirm(_0x498cd9(0x11a)+_0x30d12b+'\x27?\x20This\x20cannot\x20be\x20undone.');if(!_0x4bb7a4)return console['log'](_0x498cd9(0x15d)),0x0;}return await withSpinner('Deleting\x20workspace\x20\x27'+_0x30d12b+_0x498cd9(0x135),()=>_0x396272[_0x498cd9(0x164)]['deleteWorkspace'](_0x30d12b),{'verbose':_0x3ae714[_0x498cd9(0x126)]}),console[_0x498cd9(0x151)]('Workspace\x20\x27'+_0x30d12b+'\x27\x20deleted\x20successfully'),0x0;}}export class EngageWorkspaceUseCommand extends BaseCommand{['name']=a16_0x48275b(0x13d);[a16_0x48275b(0x147)]=a16_0x48275b(0x15b);async['execute'](_0x4f5d69){const _0x14677d=a16_0x48275b,{options:_0x5f91a9,args:_0x2ea0d5,tdx:_0xbf7ef8}=_0x4f5d69;if(_0x2ea0d5['length']===0x0)return console['error'](_0x14677d(0x176)),console[_0x14677d(0x131)](_0x14677d(0x18d)),0x1;const _0x1a5cfe=_0x2ea0d5[0x0];await withSpinner(_0x14677d(0x141)+_0x1a5cfe+_0x14677d(0x135),()=>_0xbf7ef8[_0x14677d(0x164)]['resolveWorkspaceId'](_0x1a5cfe));const _0x5c4c85=_0x5f91a9[_0x14677d(0x140)]||undefined;return saveSessionContext({'engage_workspace':_0x1a5cfe},_0x5c4c85),console[_0x14677d(0x151)]('Engage\x20workspace\x20set\x20to:\x20'+_0x1a5cfe),console[_0x14677d(0x151)]('\x0aTip:\x20Use\x20\x27tdx\x20use\x20--clear\x27\x20to\x20clear\x20session\x20overrides'),0x0;}}
|