@treasuredata/tdx 0.26.3 → 0.26.5
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.d.ts.map +1 -1
- package/dist/cli.js +1 -1
- package/dist/cli.js.map +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.d.ts.map +1 -1
- package/dist/sdk/segment/yaml-validator.js +1 -1
- package/dist/sdk/segment/yaml-validator.js.map +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.js +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_0x27e52d=a9_0x58b9;(function(_0xc71729,_0x2793de){const _0x12669f=a9_0x58b9,_0x39537e=_0xc71729();while(!![]){try{const _0x2da9fd=parseInt(_0x12669f(0xfe))/0x1*(parseInt(_0x12669f(0xe7))/0x2)+-parseInt(_0x12669f(0x91))/0x3+-parseInt(_0x12669f(0x98))/0x4*(-parseInt(_0x12669f(0xf8))/0x5)+parseInt(_0x12669f(0xac))/0x6+parseInt(_0x12669f(0xe4))/0x7+-parseInt(_0x12669f(0xc2))/0x8+parseInt(_0x12669f(0x107))/0x9*(parseInt(_0x12669f(0xfc))/0xa);if(_0x2da9fd===_0x2793de)break;else _0x39537e['push'](_0x39537e['shift']());}catch(_0x2cb3e6){_0x39537e['push'](_0x39537e['shift']());}}}(a9_0x12ab,0x4695e));function a9_0x12ab(){const _0x4471ec=['statusLine','description','stop','originalSettings','marketplace','✓\x20Settings\x20configured:\x20.claude/settings.local.json','object','✓\x20MCP\x20server\x20\x27','hostname','Command\x20output:\x20','\x27\x20not\x20found\x20in\x20list,\x20skipping\x20removal','init','Invalid\x20minimum\x20version\x20format:\x20','parse','close','INVALID_ARGUMENT','already\x20exists','stringify','Command\x20spawn\x20error:\x20','error','settings.local.json','continue','1181373aDcUaB','pipe','text','tdx\x20--profile\x20','false','localhost','Claude\x20Code\x20version\x20check\x20failed','42668ecmBXx','log','Installing\x20plugin\x20\x27','✓\x20Logging\x20to\x20','type','toString','✓\x20Marketplace\x20\x27','Initializing\x20proxy\x20logger...','Starting\x20TD\x20LLM\x20pass-through\x20proxy...','verbose','Skipping\x20TD\x20LLM\x20proxy\x20setup\x20(--no-proxy)','add','Marketplace\x20\x27','\x20already\x20configured','Restored\x20default\x20td-skills\x20marketplace','cause','Initializing...','✓\x20Settings\x20restored:\x20.claude/settings.local.json','✓\x20TD\x20LLM\x20pass-through\x20proxy\x20running\x20on\x20port\x20','INTERNAL','239058PJOLmx','message','site','list','Claude\x20Code\x20CLI\x20not\x20found','patch','name','already\x20configured','\x27\x20configured','✓\x20Found\x20available\x20port:\x20','stderr','env','✓\x20Plugin\x20\x27','getLogPath','\x27...','inherit','Launch\x20Claude\x20Code\x20with\x20integrated\x20LLM\x20proxy','includes','tdx','ANTHROPIC_MODEL','Failed\x20to\x20configure\x20MCP\x20server\x20\x27','tdx-managed-proxy','1095056mBSLWe','data','mcp','claude','CLAUDE_CODE_UNSUPPORTED_VERSION','sql-skills','\x20is\x20too\x20old\x20(minimum:\x20','info','Failed\x20to\x20update\x20marketplace\x20\x27','proxy','exit','Warning:\x20Failed\x20to\x20configure\x20','plugin','Claude\x20Code\x20version\x20','ANTHROPIC_AUTH_TOKEN','Failed\x20to\x20remove\x20marketplace\x20\x27','ANTHROPIC_BASE_URL','resume','\x20or\x20later.','Command\x20failed\x20(exit\x20','start','\x20→\x20','CLAUDE_CODE_USE_BEDROCK','CLAUDE_CODE_NOT_FOUND','Failed\x20to\x20spawn\x20claude\x20command:\x20','minor','logger','2.0.20','account_id','user','https://github.com/treasure-data/td-skills','debug','.claude','install','800009MqKgTw','update','Finding\x20available\x20port...','14Hmchql','\x27:\x20','major','http','tdx-skills','string','context','https://docs.treasuredata.com/mcp','green','Failed\x20to\x20configure\x20marketplace\x20\x27','✓\x20Logs\x20saved\x20to\x20','command','Download\x20the\x20latest\x20version\x20from\x20https://claude.com/claude-code','):\x20claude\x20','Failed\x20to\x20install\x20plugin\x20\x27','logLevel','\x20configuration\x20failed','190LOgWlV','✓\x20Claude\x20Code\x20version\x20OK','fail','td-docs','154310gYhexb','cwd','32779ImKyFm','remove','getCurrent','statusline','passThroughServer','Executing:\x20claude\x20','llm-proxy','utf-8','Failed\x20to\x20launch\x20Claude\x20Code:\x20','18ClHWOp','td-skills','already\x20installed','\x27\x20updated','Checking\x20Claude\x20Code\x20version...','join','Configuring\x20marketplace\x20\x27','Checking\x20Claude\x20Code\x20version\x20(minimum\x20required:\x20','CLAUDE_CODE_USE_VERTEX','Configuring\x20MCP\x20server\x20\x27','profile','unshift','http://127.0.0.1:','warn','port'];a9_0x12ab=function(){return _0x4471ec;};return a9_0x12ab();}import{readFile,writeFile,mkdir}from'node:fs/promises';import{existsSync}from'node:fs';import{join}from'node:path';import a9_0x483707 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_0x27e52d(0xdd);function handleInstallationError(_0x5886e8,_0x3402c1,_0x4aa7db,_0x4d4eb5){const _0x447016=a9_0x27e52d;errorContains(_0x5886e8,_0x447016(0x8b),_0x447016(0x109),_0x447016(0xb3))?(_0x4aa7db[_0x447016(0x93)]='✓\x20'+_0x3402c1+_0x447016(0xa5),_0x4d4eb5?.[_0x447016(0xc9)](_0x3402c1+_0x447016(0xa5)),_0x5886e8 instanceof SDKError&&_0x5886e8[_0x447016(0xa7)]&&_0x4d4eb5?.[_0x447016(0xe1)](_0x447016(0x84)+_0x5886e8[_0x447016(0xa7)]['message'])):(_0x4aa7db['warn'](_0x447016(0xcd)+_0x3402c1),_0x4d4eb5?.['error'](_0x3402c1+_0x447016(0xf7),_0x5886e8));}export function parseVersion(_0x5b6492){const _0x581497=_0x5b6492['trim']()['match'](/^v?(\d+)\.(\d+)\.(\d+)/);if(!_0x581497)return null;return{'major':parseInt(_0x581497[0x1],0xa),'minor':parseInt(_0x581497[0x2],0xa),'patch':parseInt(_0x581497[0x3],0xa)};}export function compareVersions(_0x1cbd17,_0xe62c0b){const _0x2f1240=a9_0x27e52d;if(_0x1cbd17[_0x2f1240(0xe9)]!==_0xe62c0b[_0x2f1240(0xe9)])return _0x1cbd17[_0x2f1240(0xe9)]-_0xe62c0b[_0x2f1240(0xe9)];if(_0x1cbd17[_0x2f1240(0xdb)]!==_0xe62c0b[_0x2f1240(0xdb)])return _0x1cbd17[_0x2f1240(0xdb)]-_0xe62c0b[_0x2f1240(0xdb)];return _0x1cbd17['patch']-_0xe62c0b[_0x2f1240(0xb1)];}async function checkClaudeVersion(_0x2773f3,_0x452f9d){const _0x3f7d10=a9_0x27e52d;_0x452f9d?.[_0x3f7d10(0xe1)](_0x3f7d10(0x10e)+_0x2773f3+')');const _0x26a445=await executeClaudeCommand(['--version'],undefined,_0x452f9d),_0x55b61e=parseVersion(_0x26a445);if(!_0x55b61e){_0x452f9d?.[_0x3f7d10(0x114)]('Could\x20not\x20parse\x20Claude\x20Code\x20version\x20from:\x20'+_0x26a445);return;}const _0x4fb6ed=_0x55b61e[_0x3f7d10(0xe9)]+'.'+_0x55b61e[_0x3f7d10(0xdb)]+'.'+_0x55b61e[_0x3f7d10(0xb1)],_0x3fddcb=parseVersion(_0x2773f3);if(!_0x3fddcb){_0x452f9d?.[_0x3f7d10(0x114)](_0x3f7d10(0x87)+_0x2773f3);return;}if(compareVersions(_0x55b61e,_0x3fddcb)<0x0){_0x452f9d?.['error'](_0x3f7d10(0xcf)+_0x4fb6ed+_0x3f7d10(0xc8)+_0x2773f3+')');throw new SDKError(ErrorCode[_0x3f7d10(0xc6)],'Claude\x20Code\x20version\x20'+_0x4fb6ed+'\x20does\x20not\x20support\x20required\x20features.\x20Please\x20upgrade\x20to\x20version\x20'+_0x2773f3+_0x3f7d10(0xd4),undefined,{'helpText':_0x3f7d10(0xf3)});}_0x452f9d?.[_0x3f7d10(0xe1)](_0x3f7d10(0xcf)+_0x4fb6ed+'\x20meets\x20minimum\x20requirement');}function a9_0x58b9(_0x13af75,_0x4ab9cf){_0x13af75=_0x13af75-0x81;const _0x12ab79=a9_0x12ab();let _0x58b98d=_0x12ab79[_0x13af75];return _0x58b98d;}async function executeClaudeCommand(_0xc054fa,_0x598272,_0x54a6cf){const _0x1401c4=a9_0x27e52d;return _0x54a6cf?.[_0x1401c4(0xc9)](_0x1401c4(0x103)+_0xc054fa['join']('\x20')),new Promise((_0xd7ca6b,_0x1acbe5)=>{const _0x54e614=_0x1401c4,_0x1603cc=crossSpawn('claude',_0xc054fa,{'stdio':_0x54e614(0x92)});let _0x9b7c16='',_0x39944a='';_0x1603cc['stdout']?.['on'](_0x54e614(0xc3),_0x119e18=>{const _0x161e23=_0x54e614;_0x9b7c16+=_0x119e18[_0x161e23(0x9d)]();}),_0x1603cc[_0x54e614(0xb6)]?.['on'](_0x54e614(0xc3),_0x5540fc=>{const _0x313877=_0x54e614;_0x39944a+=_0x5540fc[_0x313877(0x9d)]();}),_0x1603cc['on'](_0x54e614(0x8e),_0x3f2d29=>{const _0x3d9916=_0x54e614;_0x3f2d29['code']==='ENOENT'?(_0x54a6cf?.[_0x3d9916(0x8e)](_0x3d9916(0xb0)),_0x1acbe5(new SDKError(ErrorCode[_0x3d9916(0xd9)],_0x3d9916(0xb0),_0x3f2d29,{'helpText':'Please\x20install\x20Claude\x20Code\x20from\x20https://claude.com/claude-code'}))):(_0x54a6cf?.[_0x3d9916(0x8e)](_0x3d9916(0x8d)+_0x3f2d29[_0x3d9916(0xad)]),_0x1acbe5(new SDKError(ErrorCode[_0x3d9916(0xab)],_0x3d9916(0xda)+_0x3f2d29[_0x3d9916(0xad)],_0x3f2d29)));}),_0x1603cc['on'](_0x54e614(0xcc),_0x45ad04=>{const _0x2b67c8=_0x54e614;if(_0x45ad04===0x0)_0xd7ca6b(_0x9b7c16);else _0x598272?(_0x54a6cf?.[_0x2b67c8(0x8e)](_0x2b67c8(0xd5)+_0x45ad04+_0x2b67c8(0xf4)+_0xc054fa[_0x2b67c8(0x10c)]('\x20')),_0x1acbe5(new SDKError(ErrorCode['INSTALLATION_FAILED'],_0x598272,new Error(_0x39944a)))):_0xd7ca6b('');});});}async function ensureMcpServer(_0x742b31,_0xd50e68,_0x5c0193,_0x228401,_0x35760d){const _0x19608c=a9_0x27e52d;_0x228401[_0x19608c(0x93)]=_0x19608c(0x110)+_0x742b31+_0x19608c(0xba),await executeClaudeCommand([_0x19608c(0xc4),'add',_0x742b31,_0xd50e68,'--transport',_0x5c0193],_0x19608c(0xc0)+_0x742b31+'\x27',_0x35760d),_0x228401['text']=_0x19608c(0x82)+_0x742b31+'\x27\x20configured';}export const DEFAULT_TD_SKILLS_URL=a9_0x27e52d(0xe0);export function getTdSkillsRepoUrl(){const _0x547b6c=process.env.TDX_TD_SKILLS_REPO;if(_0x547b6c)return _0x547b6c;return DEFAULT_TD_SKILLS_URL;}async function removeMarketplace(_0x9b718b,_0x484a63){const _0x4c0ee1=a9_0x27e52d;try{const _0x5d348e=await executeClaudeCommand(['plugin',_0x4c0ee1(0x11a),_0x4c0ee1(0xaf)],'Failed\x20to\x20list\x20marketplaces',_0x484a63);if(!_0x5d348e[_0x4c0ee1(0xbd)](_0x9b718b)){_0x484a63?.[_0x4c0ee1(0xe1)](_0x4c0ee1(0xa4)+_0x9b718b+_0x4c0ee1(0x85));return;}await executeClaudeCommand([_0x4c0ee1(0xce),_0x4c0ee1(0x11a),_0x4c0ee1(0xff),_0x9b718b],'Failed\x20to\x20remove\x20marketplace\x20\x27'+_0x9b718b+'\x27',_0x484a63),_0x484a63?.[_0x4c0ee1(0xc9)](_0x4c0ee1(0xa4)+_0x9b718b+'\x27\x20removed');}catch(_0x322b05){_0x484a63?.[_0x4c0ee1(0x114)](_0x4c0ee1(0xd1)+_0x9b718b+_0x4c0ee1(0xe8)+_0x322b05);}}async function restoreDefaultTdSkillsMarketplace(_0x549a53){const _0x1bbf29=a9_0x27e52d;try{await removeMarketplace(_0x1bbf29(0x108),_0x549a53),await executeClaudeCommand([_0x1bbf29(0xce),_0x1bbf29(0x11a),'add',DEFAULT_TD_SKILLS_URL],undefined,_0x549a53),_0x549a53?.[_0x1bbf29(0xc9)](_0x1bbf29(0xa6));}catch{}}async function ensureMarketplace(_0x8dd6e2,_0x3bf248,_0x502e8a,_0xce1693){const _0x110404=a9_0x27e52d;_0x502e8a[_0x110404(0x93)]=_0x110404(0x10d)+_0x8dd6e2+_0x110404(0xba),await executeClaudeCommand([_0x110404(0xce),_0x110404(0x11a),_0x110404(0xa3),_0x3bf248],_0x110404(0xf0)+_0x8dd6e2+'\x27',_0xce1693),_0x502e8a['text']=_0x110404(0x9e)+_0x8dd6e2+_0x110404(0xb4);}async function updateMarketplace(_0x4a7cf0,_0x37484b,_0xd6a1ab){const _0x226905=a9_0x27e52d;_0x37484b[_0x226905(0x93)]='Updating\x20marketplace\x20\x27'+_0x4a7cf0+_0x226905(0xba),await executeClaudeCommand([_0x226905(0xce),_0x226905(0x11a),_0x226905(0xe5)],_0x226905(0xca)+_0x4a7cf0+'\x27',_0xd6a1ab),_0x37484b[_0x226905(0x93)]=_0x226905(0x9e)+_0x4a7cf0+_0x226905(0x10a);}async function ensurePlugin(_0x3b2728,_0x39f7e7,_0x2b0ff1,_0x3af52a){const _0x57f664=a9_0x27e52d;_0x2b0ff1['text']=_0x57f664(0x9a)+_0x3b2728+_0x57f664(0xba),await executeClaudeCommand([_0x57f664(0xce),_0x57f664(0xe3),_0x3b2728+'@'+_0x39f7e7],_0x57f664(0xf5)+_0x3b2728+'\x27',_0x3af52a),_0x2b0ff1[_0x57f664(0x93)]=_0x57f664(0xb8)+_0x3b2728+'\x27\x20installed';}async function createClaudeSettings(_0x5b24ea,_0x2275d1,_0x4c5e24){const _0x249776=a9_0x27e52d,_0x49bd87=join(process[_0x249776(0xfd)](),_0x249776(0xe2)),_0x33eae5=join(_0x49bd87,_0x249776(0x8f));await mkdir(_0x49bd87,{'recursive':!![]});let _0xa88e47={};if(existsSync(_0x33eae5))try{const _0x34bd9f=await readFile(_0x33eae5,'utf-8');_0xa88e47=JSON[_0x249776(0x88)](_0x34bd9f);}catch{_0xa88e47={};}const _0x4796a2=_0xa88e47[_0x249776(0xb7)]||{},_0xc59a28={'ANTHROPIC_BASE_URL':_0x4796a2[_0x249776(0xd2)],'ANTHROPIC_MODEL':_0x4796a2[_0x249776(0xbf)],'ANTHROPIC_AUTH_TOKEN':_0x4796a2[_0x249776(0xd0)],'CLAUDE_CODE_USE_BEDROCK':_0x4796a2[_0x249776(0xd8)],'CLAUDE_CODE_USE_VERTEX':_0x4796a2[_0x249776(0x10f)],'statusLine':_0xa88e47[_0x249776(0x116)]},_0x2a4698={..._0xa88e47,'env':{..._0x4796a2,'ANTHROPIC_BASE_URL':_0x249776(0x113)+_0x5b24ea,..._0x2275d1&&{'ANTHROPIC_MODEL':_0x2275d1},'ANTHROPIC_AUTH_TOKEN':_0x249776(0xc1),'CLAUDE_CODE_USE_BEDROCK':_0x249776(0x95),'CLAUDE_CODE_USE_VERTEX':_0x249776(0x95)},'statusLine':{'type':_0x249776(0xf2),'command':_0x4c5e24?_0x249776(0x94)+_0x4c5e24+'\x20claude\x20statusline':'tdx\x20claude\x20statusline'}};return await writeFile(_0x33eae5,JSON[_0x249776(0x8c)](_0x2a4698,null,0x2)+'\x0a'),_0xc59a28;}async function restoreClaudeSettings(_0x4df124){const _0x3c8928=a9_0x27e52d,_0x16bd33=join(process[_0x3c8928(0xfd)](),'.claude'),_0x1fc669=join(_0x16bd33,_0x3c8928(0x8f));if(!existsSync(_0x1fc669))return;try{const _0x52b8b5=await readFile(_0x1fc669,_0x3c8928(0x105)),_0x5692d1=JSON[_0x3c8928(0x88)](_0x52b8b5),_0x1dc9b1=_0x5692d1[_0x3c8928(0xb7)]||{},_0x2e3deb=_0x1dc9b1[_0x3c8928(0xd2)],_0x550076=((()=>{const _0x5cefa8=_0x3c8928;if(typeof _0x2e3deb!==_0x5cefa8(0xec))return![];try{const _0x29fa6c=new URL(_0x2e3deb);return _0x29fa6c['hostname']===_0x5cefa8(0x96)||_0x29fa6c[_0x5cefa8(0x83)]==='127.0.0.1';}catch{return![];}})());_0x550076?(delete _0x1dc9b1[_0x3c8928(0xd2)],delete _0x1dc9b1[_0x3c8928(0xbf)],delete _0x1dc9b1[_0x3c8928(0xd0)],delete _0x1dc9b1[_0x3c8928(0xd8)],delete _0x1dc9b1[_0x3c8928(0x10f)]):(_0x4df124[_0x3c8928(0xd2)]!==undefined?_0x1dc9b1[_0x3c8928(0xd2)]=_0x4df124[_0x3c8928(0xd2)]:delete _0x1dc9b1['ANTHROPIC_BASE_URL'],_0x4df124[_0x3c8928(0xbf)]!==undefined?_0x1dc9b1[_0x3c8928(0xbf)]=_0x4df124[_0x3c8928(0xbf)]:delete _0x1dc9b1[_0x3c8928(0xbf)],_0x4df124['ANTHROPIC_AUTH_TOKEN']!==undefined?_0x1dc9b1[_0x3c8928(0xd0)]=_0x4df124[_0x3c8928(0xd0)]:delete _0x1dc9b1[_0x3c8928(0xd0)],_0x4df124[_0x3c8928(0xd8)]!==undefined?_0x1dc9b1[_0x3c8928(0xd8)]=_0x4df124['CLAUDE_CODE_USE_BEDROCK']:delete _0x1dc9b1[_0x3c8928(0xd8)],_0x4df124[_0x3c8928(0x10f)]!==undefined?_0x1dc9b1[_0x3c8928(0x10f)]=_0x4df124['CLAUDE_CODE_USE_VERTEX']:delete _0x1dc9b1[_0x3c8928(0x10f)]);const _0x415cbb=_0x5692d1[_0x3c8928(0x116)],_0x12f48a=((()=>{const _0x8165b2=_0x3c8928;if(!_0x415cbb||typeof _0x415cbb!==_0x8165b2(0x81))return![];if(_0x415cbb[_0x8165b2(0x9c)]!==_0x8165b2(0xf2))return![];if(typeof _0x415cbb[_0x8165b2(0xf2)]!==_0x8165b2(0xec))return![];return _0x415cbb[_0x8165b2(0xf2)][_0x8165b2(0xbd)](_0x8165b2(0xbe))&&_0x415cbb[_0x8165b2(0xf2)][_0x8165b2(0xbd)](_0x8165b2(0x101));})());if(_0x12f48a)delete _0x5692d1[_0x3c8928(0x116)];else _0x4df124['statusLine']!==undefined?_0x5692d1[_0x3c8928(0x116)]=_0x4df124[_0x3c8928(0x116)]:delete _0x5692d1['statusLine'];_0x5692d1[_0x3c8928(0xb7)]=_0x1dc9b1,await writeFile(_0x1fc669,JSON[_0x3c8928(0x8c)](_0x5692d1,null,0x2)+'\x0a');}catch{}}export class ClaudeCommand extends BaseCommand{[a9_0x27e52d(0xb2)]=a9_0x27e52d(0xc5);[a9_0x27e52d(0x117)]=a9_0x27e52d(0xbc);['passThroughServer'];['originalSettings'];[a9_0x27e52d(0xdc)];[a9_0x27e52d(0x115)];async['execute'](_0x453690){const _0x15cff9=a9_0x27e52d,{tdx:_0x2affc2,options:_0x39da9b,args:_0x5d5308}=_0x453690;let _0x4a55e5=![];try{const _0x1f8f01=_0x39da9b,_0xa907f7=_0x1f8f01[_0x15cff9(0xcb)]===![],_0x27e331=_0x1f8f01[_0x15cff9(0x90)]===!![],_0x18975b=_0x1f8f01[_0x15cff9(0xd3)]===!![],_0x433d5e=[..._0x5d5308];if(_0x27e331)_0x433d5e[_0x15cff9(0x112)]('-c');else _0x18975b&&_0x433d5e[_0x15cff9(0x112)]('-r');const _0x50a015=createCommandSpinner(_0x15cff9(0xa8),{'verbose':_0x39da9b[_0x15cff9(0xa1)]});_0x50a015[_0x15cff9(0xd6)]();try{if(!_0xa907f7){_0x50a015[_0x15cff9(0x93)]=_0x15cff9(0xe6),this[_0x15cff9(0x115)]=await findAvailablePort(0xfa0),_0x50a015[_0x15cff9(0x93)]=_0x15cff9(0xb5)+this[_0x15cff9(0x115)];const _0x522232=_0x39da9b[_0x15cff9(0x111)];try{const _0x227ecf=await _0x2affc2[_0x15cff9(0xdf)][_0x15cff9(0x100)]();_0x227ecf[_0x15cff9(0xde)]&&writeCachedAccountInfo(_0x39da9b[_0x15cff9(0xae)],_0x227ecf[_0x15cff9(0xde)],_0x522232);}catch{}_0x50a015[_0x15cff9(0x93)]=_0x15cff9(0x9f),this[_0x15cff9(0xdc)]=new TDXLogger(_0x39da9b[_0x15cff9(0xf6)],!![]),await this['logger'][_0x15cff9(0x86)]();const _0x403fc0=this[_0x15cff9(0xdc)]['getLogPath']();_0x50a015['text']=_0x15cff9(0x9b)+_0x403fc0;const _0x42271a=getEndpoint(_0x39da9b[_0x15cff9(0xae)],_0x15cff9(0x104));_0x50a015[_0x15cff9(0x93)]=_0x15cff9(0xa0);if(!_0x2affc2[_0x15cff9(0xed)]['apiKey'])throw new SDKError(ErrorCode[_0x15cff9(0x8a)],'API\x20key\x20is\x20required\x20for\x20TD\x20LLM\x20Proxy\x20mode');this[_0x15cff9(0x102)]=new PassThroughProxyServer({'port':this[_0x15cff9(0x115)],'llmProxyUrl':_0x42271a,'apiKey':_0x2affc2[_0x15cff9(0xed)]['apiKey'],'logger':this['logger'],'site':_0x39da9b[_0x15cff9(0xae)],'profile':_0x522232}),await this[_0x15cff9(0x102)][_0x15cff9(0xd6)](),_0x50a015[_0x15cff9(0x93)]=_0x15cff9(0xaa)+this[_0x15cff9(0x115)]+_0x15cff9(0xd7)+_0x42271a,_0x50a015['text']='Creating\x20.claude/settings.local.json...',this[_0x15cff9(0x119)]=await createClaudeSettings(this['port'],undefined,_0x522232),_0x50a015['text']=_0x15cff9(0x11b);}else _0x50a015[_0x15cff9(0x93)]=_0x15cff9(0xa2);try{_0x50a015[_0x15cff9(0x93)]=_0x15cff9(0x10b),await checkClaudeVersion(MIN_CLAUDE_VERSION,this[_0x15cff9(0xdc)]),_0x50a015['text']=_0x15cff9(0xf9);}catch(_0x192e45){_0x50a015['fail'](_0x15cff9(0x97));throw _0x192e45;}try{await ensureMcpServer(_0x15cff9(0xfb),_0x15cff9(0xee),_0x15cff9(0xea),_0x50a015,this[_0x15cff9(0xdc)]);}catch(_0x1e4681){handleInstallationError(_0x1e4681,'TD\x20Docs\x20MCP\x20Server',_0x50a015,this['logger']);}try{const _0x40399c=getTdSkillsRepoUrl();_0x4a55e5=_0x40399c!==DEFAULT_TD_SKILLS_URL,_0x4a55e5&&await removeMarketplace(_0x15cff9(0x108),this['logger']),await ensureMarketplace(_0x15cff9(0x108),_0x40399c,_0x50a015,this['logger']),await updateMarketplace(_0x15cff9(0x108),_0x50a015,this[_0x15cff9(0xdc)]),await ensurePlugin(_0x15cff9(0xc7),_0x15cff9(0x108),_0x50a015,this['logger']),await ensurePlugin('workflow-skills',_0x15cff9(0x108),_0x50a015,this[_0x15cff9(0xdc)]),await ensurePlugin(_0x15cff9(0xeb),'td-skills',_0x50a015,this[_0x15cff9(0xdc)]);}catch(_0x4736e4){handleInstallationError(_0x4736e4,'td-skills\x20Plugins',_0x50a015,this[_0x15cff9(0xdc)]);}_0x50a015[_0x15cff9(0x118)]();}catch(_0x32b344){_0x50a015[_0x15cff9(0xfa)]('Setup\x20failed');throw _0x32b344;}const _0x10cf03=await findExecutable('claude');if(!_0x10cf03)throw new SDKError(ErrorCode['CLAUDE_CODE_NOT_FOUND'],_0x15cff9(0xb0),undefined,{'helpText':'Please\x20install\x20Claude\x20Code\x20from\x20https://claude.com/claude-code'});const _0x2c6f1a={...process.env};!_0xa907f7&&(_0x2c6f1a[_0x15cff9(0xd2)]='http://127.0.0.1:'+this['port'],_0x2c6f1a[_0x15cff9(0xd0)]='tdx-managed-proxy',_0x2c6f1a['CLAUDE_CODE_USE_BEDROCK']=_0x15cff9(0x95),_0x2c6f1a[_0x15cff9(0x10f)]=_0x15cff9(0x95));const _0x237c5d=crossSpawn(_0x10cf03,_0x433d5e,{'stdio':_0x15cff9(0xbb),'env':_0x2c6f1a}),_0x6fea66=await new Promise(_0x25d6e3=>{const _0x4ed6d9=_0x15cff9;_0x237c5d['on'](_0x4ed6d9(0xcc),_0x1ac8ee=>{_0x25d6e3(_0x1ac8ee||0x0);}),_0x237c5d['on'](_0x4ed6d9(0x8e),_0x4377e6=>{const _0x5c3450=_0x4ed6d9;console[_0x5c3450(0x8e)](a9_0x483707['red'](_0x5c3450(0x106)+_0x4377e6[_0x5c3450(0xad)])),_0x25d6e3(0x1);});});_0x4a55e5&&await restoreDefaultTdSkillsMarketplace(this[_0x15cff9(0xdc)]);this[_0x15cff9(0x102)]&&(await this[_0x15cff9(0x102)][_0x15cff9(0x118)](),console['log'](a9_0x483707[_0x15cff9(0xef)]('✓\x20TD\x20LLM\x20pass-through\x20proxy\x20server\x20stopped')));if(this['logger']){await this[_0x15cff9(0xdc)][_0x15cff9(0x89)]();const _0x3160ea=this[_0x15cff9(0xdc)][_0x15cff9(0xb9)]();console[_0x15cff9(0x99)](a9_0x483707[_0x15cff9(0xef)](_0x15cff9(0xf1)+_0x3160ea));}return this['originalSettings']&&(await restoreClaudeSettings(this[_0x15cff9(0x119)]),console['log'](a9_0x483707[_0x15cff9(0xef)](_0x15cff9(0xa9)))),_0x6fea66;}catch(_0xb5b9f5){_0x4a55e5&&await restoreDefaultTdSkillsMarketplace(this[_0x15cff9(0xdc)]);this[_0x15cff9(0x102)]&&await this[_0x15cff9(0x102)][_0x15cff9(0x118)]();this[_0x15cff9(0xdc)]&&await this[_0x15cff9(0xdc)][_0x15cff9(0x89)]();this[_0x15cff9(0x119)]&&await restoreClaudeSettings(this[_0x15cff9(0x119)]);throw _0xb5b9f5;}}}
|
|
1
|
+
function a9_0x283c(_0xa1dc9d,_0x560c5e){_0xa1dc9d=_0xa1dc9d-0x1ab;const _0x3cb841=a9_0x3cb8();let _0x283caa=_0x3cb841[_0xa1dc9d];return _0x283caa;}const a9_0x3264b9=a9_0x283c;(function(_0x41668a,_0x3fcdd2){const _0x24b6f0=a9_0x283c,_0x1003bd=_0x41668a();while(!![]){try{const _0x5f0750=parseInt(_0x24b6f0(0x1ce))/0x1*(parseInt(_0x24b6f0(0x219))/0x2)+-parseInt(_0x24b6f0(0x244))/0x3+parseInt(_0x24b6f0(0x211))/0x4+-parseInt(_0x24b6f0(0x1d0))/0x5*(-parseInt(_0x24b6f0(0x232))/0x6)+parseInt(_0x24b6f0(0x1c5))/0x7+-parseInt(_0x24b6f0(0x224))/0x8+-parseInt(_0x24b6f0(0x204))/0x9;if(_0x5f0750===_0x3fcdd2)break;else _0x1003bd['push'](_0x1003bd['shift']());}catch(_0x89016d){_0x1003bd['push'](_0x1003bd['shift']());}}}(a9_0x3cb8,0x70837));import{readFile,writeFile,mkdir}from'node:fs/promises';import{existsSync}from'node:fs';import{join}from'node:path';import a9_0x33d86f 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='2.0.20';function handleInstallationError(_0x10cceb,_0x29ba99,_0x7d3fe1,_0x5ee7f4){const _0x3cea09=a9_0x283c;errorContains(_0x10cceb,_0x3cea09(0x225),_0x3cea09(0x1bc),_0x3cea09(0x1f9))?(_0x7d3fe1[_0x3cea09(0x217)]='✓\x20'+_0x29ba99+'\x20already\x20configured',_0x5ee7f4?.[_0x3cea09(0x1ca)](_0x29ba99+_0x3cea09(0x1e5)),_0x10cceb instanceof SDKError&&_0x10cceb['cause']&&_0x5ee7f4?.[_0x3cea09(0x1db)](_0x3cea09(0x1f0)+_0x10cceb[_0x3cea09(0x1c4)][_0x3cea09(0x1da)])):(_0x7d3fe1[_0x3cea09(0x1b2)](_0x3cea09(0x1fe)+_0x29ba99),_0x5ee7f4?.[_0x3cea09(0x1e7)](_0x29ba99+_0x3cea09(0x222),_0x10cceb));}export function parseVersion(_0x3aeef2){const _0x2f310f=a9_0x283c,_0x33302a=_0x3aeef2[_0x2f310f(0x240)]()[_0x2f310f(0x1ad)](/^v?(\d+)\.(\d+)\.(\d+)/);if(!_0x33302a)return null;return{'major':parseInt(_0x33302a[0x1],0xa),'minor':parseInt(_0x33302a[0x2],0xa),'patch':parseInt(_0x33302a[0x3],0xa)};}export function compareVersions(_0x4d904c,_0x2b9455){const _0x14ee78=a9_0x283c;if(_0x4d904c[_0x14ee78(0x20d)]!==_0x2b9455[_0x14ee78(0x20d)])return _0x4d904c[_0x14ee78(0x20d)]-_0x2b9455[_0x14ee78(0x20d)];if(_0x4d904c['minor']!==_0x2b9455[_0x14ee78(0x201)])return _0x4d904c[_0x14ee78(0x201)]-_0x2b9455[_0x14ee78(0x201)];return _0x4d904c[_0x14ee78(0x235)]-_0x2b9455['patch'];}async function checkClaudeVersion(_0x19590e,_0x26a0bd){const _0x13d03f=a9_0x283c;_0x26a0bd?.[_0x13d03f(0x1db)](_0x13d03f(0x1e3)+_0x19590e+')');const _0x3af2f7=await executeClaudeCommand([_0x13d03f(0x1b5)],undefined,_0x26a0bd),_0x1f4586=parseVersion(_0x3af2f7);if(!_0x1f4586){_0x26a0bd?.[_0x13d03f(0x1b2)]('Could\x20not\x20parse\x20Claude\x20Code\x20version\x20from:\x20'+_0x3af2f7);return;}const _0x58ffaf=_0x1f4586[_0x13d03f(0x20d)]+'.'+_0x1f4586[_0x13d03f(0x201)]+'.'+_0x1f4586['patch'],_0x1544f0=parseVersion(_0x19590e);if(!_0x1544f0){_0x26a0bd?.[_0x13d03f(0x1b2)](_0x13d03f(0x1f5)+_0x19590e);return;}if(compareVersions(_0x1f4586,_0x1544f0)<0x0){_0x26a0bd?.[_0x13d03f(0x1e7)](_0x13d03f(0x23c)+_0x58ffaf+_0x13d03f(0x20f)+_0x19590e+')');throw new SDKError(ErrorCode[_0x13d03f(0x231)],_0x13d03f(0x23c)+_0x58ffaf+_0x13d03f(0x1b0)+_0x19590e+_0x13d03f(0x1ba),undefined,{'helpText':'Download\x20the\x20latest\x20version\x20from\x20https://claude.com/claude-code'});}_0x26a0bd?.[_0x13d03f(0x1db)](_0x13d03f(0x23c)+_0x58ffaf+'\x20meets\x20minimum\x20requirement');}async function executeClaudeCommand(_0x1913ab,_0x5a1f30,_0x35a880){const _0x1f998a=a9_0x283c;return _0x35a880?.[_0x1f998a(0x1ca)](_0x1f998a(0x239)+_0x1913ab[_0x1f998a(0x1ac)]('\x20')),new Promise((_0x3fe36b,_0x17f7f2)=>{const _0x35694d=_0x1f998a,_0x14438e=crossSpawn(_0x35694d(0x1b7),_0x1913ab,{'stdio':_0x35694d(0x21d)});let _0x335504='',_0x1bd39c='';_0x14438e[_0x35694d(0x1e9)]?.['on'](_0x35694d(0x206),_0x122c09=>{const _0x570daa=_0x35694d;_0x335504+=_0x122c09[_0x570daa(0x1e8)]();}),_0x14438e['stderr']?.['on'](_0x35694d(0x206),_0x2023c7=>{const _0x1a4847=_0x35694d;_0x1bd39c+=_0x2023c7[_0x1a4847(0x1e8)]();}),_0x14438e['on'](_0x35694d(0x1e7),_0x1ea8f5=>{const _0x4b2720=_0x35694d;_0x1ea8f5['code']==='ENOENT'?(_0x35a880?.[_0x4b2720(0x1e7)](_0x4b2720(0x1c3)),_0x17f7f2(new SDKError(ErrorCode[_0x4b2720(0x237)],_0x4b2720(0x1c3),_0x1ea8f5,{'helpText':_0x4b2720(0x21c)}))):(_0x35a880?.['error']('Command\x20spawn\x20error:\x20'+_0x1ea8f5[_0x4b2720(0x1da)]),_0x17f7f2(new SDKError(ErrorCode[_0x4b2720(0x23a)],_0x4b2720(0x226)+_0x1ea8f5[_0x4b2720(0x1da)],_0x1ea8f5)));}),_0x14438e['on']('exit',_0x256ba1=>{const _0x4b19c2=_0x35694d;if(_0x256ba1===0x0)_0x3fe36b(_0x335504);else _0x5a1f30?(_0x35a880?.['error']('Command\x20failed\x20(exit\x20'+_0x256ba1+_0x4b19c2(0x234)+_0x1913ab[_0x4b19c2(0x1ac)]('\x20')),_0x17f7f2(new SDKError(ErrorCode['INSTALLATION_FAILED'],_0x5a1f30,new Error(_0x1bd39c)))):_0x3fe36b('');});});}async function ensureMcpServer(_0x26f38e,_0x345b5a,_0x9cf9f2,_0x46db8f,_0x6785db){const _0x187660=a9_0x283c;_0x46db8f[_0x187660(0x217)]=_0x187660(0x243)+_0x26f38e+_0x187660(0x21e),await executeClaudeCommand([_0x187660(0x1ea),_0x187660(0x1bb),_0x26f38e,_0x345b5a,_0x187660(0x218),_0x9cf9f2],_0x187660(0x1f2)+_0x26f38e+'\x27',_0x6785db),_0x46db8f['text']=_0x187660(0x213)+_0x26f38e+_0x187660(0x1fc);}export const DEFAULT_TD_SKILLS_URL=a9_0x3264b9(0x202);function a9_0x3cb8(){const _0x487c08=['proxy','Updating\x20marketplace\x20\x27','ANTHROPIC_AUTH_TOKEN','major','\x27:\x20','\x20is\x20too\x20old\x20(minimum:\x20','td-docs','2314412lxDLYq','\x27\x20installed','✓\x20MCP\x20server\x20\x27','Creating\x20.claude/settings.local.json...','Skipping\x20TD\x20LLM\x20proxy\x20setup\x20(--no-proxy)','✓\x20Marketplace\x20\x27','text','--transport','8vdTsDx','continue','localhost','Please\x20install\x20Claude\x20Code\x20from\x20https://claude.com/claude-code','pipe','\x27...','API\x20key\x20is\x20required\x20for\x20TD\x20LLM\x20Proxy\x20mode','command','Failed\x20to\x20install\x20plugin\x20\x27','\x20configuration\x20failed','Launch\x20Claude\x20Code\x20with\x20integrated\x20LLM\x20proxy','3760800RYvMXK','already\x20exists','Failed\x20to\x20spawn\x20claude\x20command:\x20','Installing\x20plugin\x20\x27','stop','Initializing...','name','profile','Starting\x20TD\x20LLM\x20pass-through\x20proxy...','execute','marketplace','\x27\x20updated','init','CLAUDE_CODE_UNSUPPORTED_VERSION','42870UoNHBz','originalSettings','):\x20claude\x20','patch','http','CLAUDE_CODE_NOT_FOUND','\x27\x20not\x20found\x20in\x20list,\x20skipping\x20removal','Executing:\x20claude\x20','INTERNAL','✓\x20TD\x20LLM\x20pass-through\x20proxy\x20running\x20on\x20port\x20','Claude\x20Code\x20version\x20','description','✓\x20Logging\x20to\x20','TD\x20Docs\x20MCP\x20Server','trim','Failed\x20to\x20remove\x20marketplace\x20\x27','td-skills\x20Plugins','Configuring\x20MCP\x20server\x20\x27','1896036JVrQWx','log','join','match','Checking\x20Claude\x20Code\x20version...','string','\x20does\x20not\x20support\x20required\x20features.\x20Please\x20upgrade\x20to\x20version\x20','parse','warn','passThroughServer','env','--version','Claude\x20Code\x20version\x20check\x20failed','claude','install','http://127.0.0.1:','\x20or\x20later.','add','already\x20installed','ANTHROPIC_MODEL','tdx-managed-proxy','tdx\x20--profile\x20','statusLine','remove','\x20→\x20','Claude\x20Code\x20CLI\x20not\x20found','cause','5926802EVnqYn','✓\x20Plugin\x20\x27','127.0.0.1','green','✓\x20Settings\x20restored:\x20.claude/settings.local.json','info','inherit','Configuring\x20marketplace\x20\x27','exit','159242zBQRMH','Failed\x20to\x20launch\x20Claude\x20Code:\x20','290KmiFhv','update','logger','Marketplace\x20\x27','Setup\x20failed','hostname','context','includes','CLAUDE_CODE_USE_VERTEX','CLAUDE_CODE_USE_BEDROCK','message','debug','Finding\x20available\x20port...','utf-8','✓\x20TD\x20LLM\x20pass-through\x20proxy\x20server\x20stopped','false','Failed\x20to\x20configure\x20marketplace\x20\x27','site','INVALID_ARGUMENT','Checking\x20Claude\x20Code\x20version\x20(minimum\x20required:\x20','start','\x20already\x20configured','ANTHROPIC_BASE_URL','error','toString','stdout','mcp','plugin','Failed\x20to\x20update\x20marketplace\x20\x27','close','✓\x20Settings\x20configured:\x20.claude/settings.local.json','fail','Command\x20output:\x20','unshift','Failed\x20to\x20configure\x20MCP\x20server\x20\x27','.claude','port','Invalid\x20minimum\x20version\x20format:\x20','apiKey','✓\x20Logs\x20saved\x20to\x20','cwd','already\x20configured','type','td-skills','\x27\x20configured','Failed\x20to\x20list\x20marketplaces','Warning:\x20Failed\x20to\x20configure\x20','account_id','workflow-skills','minor','https://github.com/treasure-data/td-skills','resume','8223300HuRaGC','stringify','data','tdx-skills','settings.local.json','red'];a9_0x3cb8=function(){return _0x487c08;};return a9_0x3cb8();}export function getTdSkillsRepoUrl(){const _0x9318ea=process.env.TDX_TD_SKILLS_REPO;if(_0x9318ea)return _0x9318ea;return DEFAULT_TD_SKILLS_URL;}async function removeMarketplace(_0x308e71,_0x29050a){const _0x5a1469=a9_0x3264b9;try{const _0x594da5=await executeClaudeCommand([_0x5a1469(0x1eb),_0x5a1469(0x22e),'list'],_0x5a1469(0x1fd),_0x29050a);if(!_0x594da5['includes'](_0x308e71)){_0x29050a?.[_0x5a1469(0x1db)](_0x5a1469(0x1d3)+_0x308e71+_0x5a1469(0x238));return;}await executeClaudeCommand([_0x5a1469(0x1eb),_0x5a1469(0x22e),_0x5a1469(0x1c1),_0x308e71],_0x5a1469(0x241)+_0x308e71+'\x27',_0x29050a),_0x29050a?.[_0x5a1469(0x1ca)](_0x5a1469(0x1d3)+_0x308e71+'\x27\x20removed');}catch(_0x30756b){_0x29050a?.[_0x5a1469(0x1b2)]('Failed\x20to\x20remove\x20marketplace\x20\x27'+_0x308e71+_0x5a1469(0x20e)+_0x30756b);}}async function restoreDefaultTdSkillsMarketplace(_0x44b7f5){const _0x39619c=a9_0x3264b9;try{await removeMarketplace(_0x39619c(0x1fb),_0x44b7f5),await executeClaudeCommand([_0x39619c(0x1eb),_0x39619c(0x22e),_0x39619c(0x1bb),DEFAULT_TD_SKILLS_URL],undefined,_0x44b7f5),_0x44b7f5?.[_0x39619c(0x1ca)]('Restored\x20default\x20td-skills\x20marketplace');}catch{}}async function ensureMarketplace(_0x438d80,_0xe782fa,_0x54e836,_0xb5ee6b){const _0x286dd6=a9_0x3264b9;_0x54e836['text']=_0x286dd6(0x1cc)+_0x438d80+_0x286dd6(0x21e),await executeClaudeCommand(['plugin','marketplace',_0x286dd6(0x1bb),_0xe782fa],_0x286dd6(0x1e0)+_0x438d80+'\x27',_0xb5ee6b),_0x54e836[_0x286dd6(0x217)]=_0x286dd6(0x216)+_0x438d80+_0x286dd6(0x1fc);}async function updateMarketplace(_0x137444,_0x2ffe39,_0x72a662){const _0x575bfd=a9_0x3264b9;_0x2ffe39['text']=_0x575bfd(0x20b)+_0x137444+_0x575bfd(0x21e),await executeClaudeCommand([_0x575bfd(0x1eb),'marketplace',_0x575bfd(0x1d1)],_0x575bfd(0x1ec)+_0x137444+'\x27',_0x72a662),_0x2ffe39[_0x575bfd(0x217)]='✓\x20Marketplace\x20\x27'+_0x137444+_0x575bfd(0x22f);}async function ensurePlugin(_0x8b09db,_0x4cd8f0,_0x5c4cdd,_0xd9661e){const _0x44cf2b=a9_0x3264b9;_0x5c4cdd['text']=_0x44cf2b(0x227)+_0x8b09db+_0x44cf2b(0x21e),await executeClaudeCommand(['plugin',_0x44cf2b(0x1b8),_0x8b09db+'@'+_0x4cd8f0],_0x44cf2b(0x221)+_0x8b09db+'\x27',_0xd9661e),_0x5c4cdd[_0x44cf2b(0x217)]=_0x44cf2b(0x1c6)+_0x8b09db+_0x44cf2b(0x212);}async function createClaudeSettings(_0x15dafa,_0x20a0e6,_0x52d782){const _0x5d8f45=a9_0x3264b9,_0x25e27f=join(process[_0x5d8f45(0x1f8)](),_0x5d8f45(0x1f3)),_0x54b689=join(_0x25e27f,_0x5d8f45(0x208));await mkdir(_0x25e27f,{'recursive':!![]});let _0x36bb14={};if(existsSync(_0x54b689))try{const _0x2709a6=await readFile(_0x54b689,'utf-8');_0x36bb14=JSON[_0x5d8f45(0x1b1)](_0x2709a6);}catch{_0x36bb14={};}const _0x5e85b6=_0x36bb14[_0x5d8f45(0x1b4)]||{},_0x34d867={'ANTHROPIC_BASE_URL':_0x5e85b6[_0x5d8f45(0x1e6)],'ANTHROPIC_MODEL':_0x5e85b6[_0x5d8f45(0x1bd)],'ANTHROPIC_AUTH_TOKEN':_0x5e85b6[_0x5d8f45(0x20c)],'CLAUDE_CODE_USE_BEDROCK':_0x5e85b6[_0x5d8f45(0x1d9)],'CLAUDE_CODE_USE_VERTEX':_0x5e85b6[_0x5d8f45(0x1d8)],'statusLine':_0x36bb14['statusLine']},_0x1dc9d5={..._0x36bb14,'env':{..._0x5e85b6,'ANTHROPIC_BASE_URL':'http://127.0.0.1:'+_0x15dafa,..._0x20a0e6&&{'ANTHROPIC_MODEL':_0x20a0e6},'ANTHROPIC_AUTH_TOKEN':_0x5d8f45(0x1be),'CLAUDE_CODE_USE_BEDROCK':_0x5d8f45(0x1df),'CLAUDE_CODE_USE_VERTEX':_0x5d8f45(0x1df)},'statusLine':{'type':_0x5d8f45(0x220),'command':_0x52d782?_0x5d8f45(0x1bf)+_0x52d782+'\x20claude\x20statusline':'tdx\x20claude\x20statusline'}};return await writeFile(_0x54b689,JSON[_0x5d8f45(0x205)](_0x1dc9d5,null,0x2)+'\x0a'),_0x34d867;}async function restoreClaudeSettings(_0x43f3a0){const _0x19d7a6=a9_0x3264b9,_0x7840f7=join(process[_0x19d7a6(0x1f8)](),'.claude'),_0x54a9ce=join(_0x7840f7,_0x19d7a6(0x208));if(!existsSync(_0x54a9ce))return;try{const _0x2b6286=await readFile(_0x54a9ce,_0x19d7a6(0x1dd)),_0x2c25b2=JSON[_0x19d7a6(0x1b1)](_0x2b6286),_0x1f2eb8=_0x2c25b2[_0x19d7a6(0x1b4)]||{},_0x3f7a4c=_0x1f2eb8['ANTHROPIC_BASE_URL'],_0x4b08b1=((()=>{const _0x530212=_0x19d7a6;if(typeof _0x3f7a4c!==_0x530212(0x1af))return![];try{const _0x1446eb=new URL(_0x3f7a4c);return _0x1446eb[_0x530212(0x1d5)]===_0x530212(0x21b)||_0x1446eb[_0x530212(0x1d5)]===_0x530212(0x1c7);}catch{return![];}})());_0x4b08b1?(delete _0x1f2eb8[_0x19d7a6(0x1e6)],delete _0x1f2eb8[_0x19d7a6(0x1bd)],delete _0x1f2eb8[_0x19d7a6(0x20c)],delete _0x1f2eb8['CLAUDE_CODE_USE_BEDROCK'],delete _0x1f2eb8[_0x19d7a6(0x1d8)]):(_0x43f3a0[_0x19d7a6(0x1e6)]!==undefined?_0x1f2eb8['ANTHROPIC_BASE_URL']=_0x43f3a0[_0x19d7a6(0x1e6)]:delete _0x1f2eb8[_0x19d7a6(0x1e6)],_0x43f3a0[_0x19d7a6(0x1bd)]!==undefined?_0x1f2eb8['ANTHROPIC_MODEL']=_0x43f3a0[_0x19d7a6(0x1bd)]:delete _0x1f2eb8['ANTHROPIC_MODEL'],_0x43f3a0[_0x19d7a6(0x20c)]!==undefined?_0x1f2eb8['ANTHROPIC_AUTH_TOKEN']=_0x43f3a0[_0x19d7a6(0x20c)]:delete _0x1f2eb8[_0x19d7a6(0x20c)],_0x43f3a0[_0x19d7a6(0x1d9)]!==undefined?_0x1f2eb8['CLAUDE_CODE_USE_BEDROCK']=_0x43f3a0[_0x19d7a6(0x1d9)]:delete _0x1f2eb8['CLAUDE_CODE_USE_BEDROCK'],_0x43f3a0['CLAUDE_CODE_USE_VERTEX']!==undefined?_0x1f2eb8[_0x19d7a6(0x1d8)]=_0x43f3a0[_0x19d7a6(0x1d8)]:delete _0x1f2eb8['CLAUDE_CODE_USE_VERTEX']);const _0x32aace=_0x2c25b2[_0x19d7a6(0x1c0)],_0x28c262=((()=>{const _0x1d66a7=_0x19d7a6;if(!_0x32aace||typeof _0x32aace!=='object')return![];if(_0x32aace[_0x1d66a7(0x1fa)]!==_0x1d66a7(0x220))return![];if(typeof _0x32aace['command']!=='string')return![];return _0x32aace[_0x1d66a7(0x220)][_0x1d66a7(0x1d7)]('tdx')&&_0x32aace[_0x1d66a7(0x220)][_0x1d66a7(0x1d7)]('statusline');})());if(_0x28c262)delete _0x2c25b2['statusLine'];else _0x43f3a0[_0x19d7a6(0x1c0)]!==undefined?_0x2c25b2[_0x19d7a6(0x1c0)]=_0x43f3a0['statusLine']:delete _0x2c25b2['statusLine'];_0x2c25b2[_0x19d7a6(0x1b4)]=_0x1f2eb8,await writeFile(_0x54a9ce,JSON['stringify'](_0x2c25b2,null,0x2)+'\x0a');}catch{}}export class ClaudeCommand extends BaseCommand{[a9_0x3264b9(0x22a)]=a9_0x3264b9(0x1b7);[a9_0x3264b9(0x23d)]=a9_0x3264b9(0x223);['passThroughServer'];[a9_0x3264b9(0x233)];['logger'];[a9_0x3264b9(0x1f4)];async[a9_0x3264b9(0x22d)](_0x13984a){const _0x9127bf=a9_0x3264b9,{tdx:_0x48c8a7,options:_0x3a602b,args:_0x48b910}=_0x13984a;let _0x91ea4f=![];try{const _0x3d8454=_0x3a602b,_0x230478=_0x3d8454[_0x9127bf(0x20a)]===![],_0x255f17=_0x3d8454[_0x9127bf(0x21a)]===!![],_0x29cafb=_0x3d8454[_0x9127bf(0x203)]===!![],_0x1bd24b=[..._0x48b910];if(_0x255f17)_0x1bd24b[_0x9127bf(0x1f1)]('-c');else _0x29cafb&&_0x1bd24b['unshift']('-r');const _0x32149b=createCommandSpinner(_0x9127bf(0x229),{'verbose':_0x3a602b['verbose']});_0x32149b[_0x9127bf(0x1e4)]();try{if(!_0x230478){_0x32149b[_0x9127bf(0x217)]=_0x9127bf(0x1dc),this[_0x9127bf(0x1f4)]=await findAvailablePort(0xfa0),_0x32149b[_0x9127bf(0x217)]='✓\x20Found\x20available\x20port:\x20'+this[_0x9127bf(0x1f4)];const _0x164835=_0x3a602b[_0x9127bf(0x22b)];try{const _0x46cf2c=await _0x48c8a7['user']['getCurrent']();_0x46cf2c[_0x9127bf(0x1ff)]&&writeCachedAccountInfo(_0x3a602b[_0x9127bf(0x1e1)],_0x46cf2c['account_id'],_0x164835);}catch{}_0x32149b[_0x9127bf(0x217)]='Initializing\x20proxy\x20logger...',this[_0x9127bf(0x1d2)]=new TDXLogger(_0x3a602b['logLevel'],!![]),await this[_0x9127bf(0x1d2)][_0x9127bf(0x230)]();const _0x103dc6=this[_0x9127bf(0x1d2)]['getLogPath']();_0x32149b[_0x9127bf(0x217)]=_0x9127bf(0x23e)+_0x103dc6;const _0x238065=getEndpoint(_0x3a602b[_0x9127bf(0x1e1)],'llm-proxy');_0x32149b[_0x9127bf(0x217)]=_0x9127bf(0x22c);if(!_0x48c8a7[_0x9127bf(0x1d6)][_0x9127bf(0x1f6)])throw new SDKError(ErrorCode[_0x9127bf(0x1e2)],_0x9127bf(0x21f));this[_0x9127bf(0x1b3)]=new PassThroughProxyServer({'port':this[_0x9127bf(0x1f4)],'llmProxyUrl':_0x238065,'apiKey':_0x48c8a7[_0x9127bf(0x1d6)]['apiKey'],'logger':this['logger'],'site':_0x3a602b['site'],'profile':_0x164835}),await this[_0x9127bf(0x1b3)][_0x9127bf(0x1e4)](),_0x32149b[_0x9127bf(0x217)]=_0x9127bf(0x23b)+this[_0x9127bf(0x1f4)]+_0x9127bf(0x1c2)+_0x238065,_0x32149b[_0x9127bf(0x217)]=_0x9127bf(0x214),this[_0x9127bf(0x233)]=await createClaudeSettings(this[_0x9127bf(0x1f4)],undefined,_0x164835),_0x32149b[_0x9127bf(0x217)]=_0x9127bf(0x1ee);}else _0x32149b[_0x9127bf(0x217)]=_0x9127bf(0x215);try{_0x32149b[_0x9127bf(0x217)]=_0x9127bf(0x1ae),await checkClaudeVersion(MIN_CLAUDE_VERSION,this['logger']),_0x32149b['text']='✓\x20Claude\x20Code\x20version\x20OK';}catch(_0x36d02d){_0x32149b[_0x9127bf(0x1ef)](_0x9127bf(0x1b6));throw _0x36d02d;}try{await ensureMcpServer(_0x9127bf(0x210),'https://docs.treasuredata.com/mcp',_0x9127bf(0x236),_0x32149b,this['logger']);}catch(_0x493155){handleInstallationError(_0x493155,_0x9127bf(0x23f),_0x32149b,this[_0x9127bf(0x1d2)]);}try{const _0xc534c9=getTdSkillsRepoUrl();_0x91ea4f=_0xc534c9!==DEFAULT_TD_SKILLS_URL,_0x91ea4f&&await removeMarketplace(_0x9127bf(0x1fb),this[_0x9127bf(0x1d2)]),await ensureMarketplace('td-skills',_0xc534c9,_0x32149b,this[_0x9127bf(0x1d2)]),await updateMarketplace(_0x9127bf(0x1fb),_0x32149b,this[_0x9127bf(0x1d2)]),await ensurePlugin('sql-skills','td-skills',_0x32149b,this[_0x9127bf(0x1d2)]),await ensurePlugin(_0x9127bf(0x200),'td-skills',_0x32149b,this[_0x9127bf(0x1d2)]),await ensurePlugin(_0x9127bf(0x207),_0x9127bf(0x1fb),_0x32149b,this[_0x9127bf(0x1d2)]);}catch(_0x386cef){handleInstallationError(_0x386cef,_0x9127bf(0x242),_0x32149b,this['logger']);}_0x32149b['stop']();}catch(_0x354b71){_0x32149b[_0x9127bf(0x1ef)](_0x9127bf(0x1d4));throw _0x354b71;}const _0x3596b0=await findExecutable(_0x9127bf(0x1b7));if(!_0x3596b0)throw new SDKError(ErrorCode[_0x9127bf(0x237)],_0x9127bf(0x1c3),undefined,{'helpText':'Please\x20install\x20Claude\x20Code\x20from\x20https://claude.com/claude-code'});const _0x29723e={...process.env};!_0x230478&&(_0x29723e['ANTHROPIC_BASE_URL']=_0x9127bf(0x1b9)+this[_0x9127bf(0x1f4)],_0x29723e[_0x9127bf(0x20c)]=_0x9127bf(0x1be),_0x29723e['CLAUDE_CODE_USE_BEDROCK']=_0x9127bf(0x1df),_0x29723e['CLAUDE_CODE_USE_VERTEX']=_0x9127bf(0x1df));const _0x32550e=crossSpawn(_0x3596b0,_0x1bd24b,{'stdio':_0x9127bf(0x1cb),'env':_0x29723e}),_0x5dcb39=await new Promise(_0x466322=>{const _0x41cded=_0x9127bf;_0x32550e['on'](_0x41cded(0x1cd),_0x261b29=>{_0x466322(_0x261b29||0x0);}),_0x32550e['on'](_0x41cded(0x1e7),_0x4177aa=>{const _0x25f5c3=_0x41cded;console['error'](a9_0x33d86f[_0x25f5c3(0x209)](_0x25f5c3(0x1cf)+_0x4177aa[_0x25f5c3(0x1da)])),_0x466322(0x1);});});_0x91ea4f&&await restoreDefaultTdSkillsMarketplace(this['logger']);this['passThroughServer']&&(await this[_0x9127bf(0x1b3)][_0x9127bf(0x228)](),console[_0x9127bf(0x1ab)](a9_0x33d86f['green'](_0x9127bf(0x1de))));if(this[_0x9127bf(0x1d2)]){await this[_0x9127bf(0x1d2)][_0x9127bf(0x1ed)]();const _0x4d71c8=this[_0x9127bf(0x1d2)]['getLogPath']();console['log'](a9_0x33d86f[_0x9127bf(0x1c8)](_0x9127bf(0x1f7)+_0x4d71c8));}return this[_0x9127bf(0x233)]&&(await restoreClaudeSettings(this[_0x9127bf(0x233)]),console['log'](a9_0x33d86f['green'](_0x9127bf(0x1c9)))),_0x5dcb39;}catch(_0x98b426){_0x91ea4f&&await restoreDefaultTdSkillsMarketplace(this[_0x9127bf(0x1d2)]);this[_0x9127bf(0x1b3)]&&await this['passThroughServer']['stop']();this['logger']&&await this['logger']['close']();this[_0x9127bf(0x233)]&&await restoreClaudeSettings(this['originalSettings']);throw _0x98b426;}}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a10_0x2afc17=a10_0x95d8;(function(_0x164752,_0x1c7c7e){const _0x313ac6=a10_0x95d8,_0x1ef262=_0x164752();while(!![]){try{const _0x3c3774=parseInt(_0x313ac6(0x132))/0x1*(-parseInt(_0x313ac6(0x146))/0x2)+-parseInt(_0x313ac6(0x143))/0x3+parseInt(_0x313ac6(0x142))/0x4*(parseInt(_0x313ac6(0x13e))/0x5)+-parseInt(_0x313ac6(0x138))/0x6+-parseInt(_0x313ac6(0x13b))/0x7+parseInt(_0x313ac6(0x130))/0x8*(parseInt(_0x313ac6(0x12b))/0x9)+parseInt(_0x313ac6(0x145))/0xa;if(_0x3c3774===_0x1c7c7e)break;else _0x1ef262['push'](_0x1ef262['shift']());}catch(_0x39ae48){_0x1ef262['push'](_0x1ef262['shift']());}}}(a10_0x2fe8,0x1f1ac));import{createInterface}from'node:readline';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';function a10_0x95d8(_0xf2fd46,_0x54fee1){_0xf2fd46=_0xf2fd46-0x129;const _0x2fe888=a10_0x2fe8();let _0x95d82e=_0x2fe888[_0xf2fd46];return _0x95d82e;}async function readStdinJson(_0x2a1360=0x64){return new Promise(_0x66b4a3=>{const _0x4259e6=a10_0x95d8;let _0x11f746='',_0x2973c8=![];const _0x67a4d9=createInterface({'input':process['stdin'],'terminal':![]}),_0x52b3cc=_0xaadb16=>{if(_0x2973c8)return;_0x2973c8=!![],clearTimeout(_0x26d920),_0x67a4d9['close'](),_0x66b4a3(_0xaadb16);},_0x26d920=setTimeout(()=>{_0x52b3cc(null);},_0x2a1360);_0x67a4d9['on']('line',_0x4925e8=>{_0x11f746+=_0x4925e8;}),_0x67a4d9['on'](_0x4259e6(0x149),()=>{const _0x3f77ed=_0x4259e6;if(_0x2973c8)return;try{const _0x2d350e=JSON[_0x3f77ed(0x14a)](_0x11f746);_0x52b3cc(_0x2d350e);}catch{_0x52b3cc(null);}});});}function formatCredits(_0x277d32){const _0x54dc55=a10_0x95d8;return _0x277d32[_0x54dc55(0x137)](0x2);}function a10_0x2fe8(){const _0x271dc3=['Output\x20statusline\x20for\x20Claude\x20Code\x20(reads\x20JSON\x20from\x20stdin)','options','🪙\x20credit:\x20','push','toFixed','1381782FgTVrT','\x20today\x20/\x20','profile','1445479OpXlop','model','\x20month','792095PezpsQ','session_id','\x20-\x20','🧠\x20','4ylHCXH','331566BQDbAn','tdx','6759510MsSRoA','170yWfrTS','statusline','execute','close','parse','\x20|\x20','description','23175uBPNfZ','💎\x20','latestInputTokens','join','log','184wayDaG','💎\x20tdx\x20-\x20Claude','2575moarsr'];a10_0x2fe8=function(){return _0x271dc3;};return a10_0x2fe8();}export class ClaudeStatuslineCommand extends BaseCommand{['name']=a10_0x2afc17(0x147);[a10_0x2afc17(0x12a)]=a10_0x2afc17(0x133);async[a10_0x2afc17(0x148)](_0x4afd2c){const _0x2d30a7=a10_0x2afc17;try{const _0x115b29=await readStdinJson();if(!_0x115b29?.[_0x2d30a7(0x13f)])return console['log'](_0x2d30a7(0x131)),0x0;const _0x4a7fb0=_0x115b29[_0x2d30a7(0x13f)],_0x2a57d5=_0x115b29[_0x2d30a7(0x13c)]?.['id']||'',_0x3b148e=_0x115b29[_0x2d30a7(0x13a)]||_0x4afd2c[_0x2d30a7(0x134)]['profile'],_0x169839=await getUsageStats(_0x4a7fb0,_0x3b148e),_0x658ca3=[],_0x2a6b3d=readCachedAccountInfo(_0x3b148e),_0x5c41d0=_0x2a6b3d?'tdx\x20'+_0x2a6b3d['site']+':'+_0x2a6b3d['accountId']:_0x2d30a7(0x144),_0x57c288=_0x2a57d5?getModelDisplayName(_0x2a57d5):'Claude';_0x658ca3[_0x2d30a7(0x136)](_0x2d30a7(0x12c)+_0x5c41d0+_0x2d30a7(0x140)+_0x57c288);const _0x564712=formatCredits(_0x169839['sessionCredits']),_0x50804d=formatCredits(_0x169839['todayCredits']),_0x5073bc=formatCredits(_0x169839['monthCredits']);_0x658ca3[_0x2d30a7(0x136)](_0x2d30a7(0x135)+_0x564712+'\x20session\x20/\x20'+_0x50804d+_0x2d30a7(0x139)+_0x5073bc+_0x2d30a7(0x13d));if(_0x169839[_0x2d30a7(0x12d)]>0x0&&_0x2a57d5){const _0x46340f=formatTokenCount(_0x169839[_0x2d30a7(0x12d)]),_0x935766=calculateContextPercentage(_0x169839[_0x2d30a7(0x12d)],_0x2a57d5);_0x658ca3[_0x2d30a7(0x136)](_0x2d30a7(0x141)+_0x46340f+'\x20('+_0x935766+'%)');}return console['log'](_0x658ca3[_0x2d30a7(0x12e)](_0x2d30a7(0x129))),0x0;}catch{return console[_0x2d30a7(0x12f)](_0x2d30a7(0x131)),0x0;}}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a11_0x33e547=a11_0x35d5;function a11_0x35d5(_0x6e9585,_0x52a894){_0x6e9585=_0x6e9585-0x72;const _0x12305a=a11_0x1230();let _0x35d5c4=_0x12305a[_0x6e9585];return _0x35d5c4;}(function(_0x5ab4ed,_0x527aa7){const _0x488abb=a11_0x35d5,_0x247e01=_0x5ab4ed();while(!![]){try{const _0x3b7f2b=-parseInt(_0x488abb(0x84))/0x1+-parseInt(_0x488abb(0x73))/0x2*(parseInt(_0x488abb(0x98))/0x3)+-parseInt(_0x488abb(0xb1))/0x4*(-parseInt(_0x488abb(0xb3))/0x5)+-parseInt(_0x488abb(0xac))/0x6+parseInt(_0x488abb(0xae))/0x7*(parseInt(_0x488abb(0x78))/0x8)+-parseInt(_0x488abb(0xa8))/0x9*(parseInt(_0x488abb(0xa4))/0xa)+-parseInt(_0x488abb(0xab))/0xb*(-parseInt(_0x488abb(0xa2))/0xc);if(_0x3b7f2b===_0x527aa7)break;else _0x247e01['push'](_0x247e01['shift']());}catch(_0x235946){_0x247e01['push'](_0x247e01['shift']());}}}(a11_0x1230,0xcd489));import a11_0x2ebc2c from'chalk';import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../core/command-output.js';import{getAllProfileStats,getAllSourceStats,getUsageSummary}from'../proxy/claude-usage-tracker.js';function formatCredits(_0x4e4694){const _0x7cb020=a11_0x35d5;return _0x4e4694[_0x7cb020(0x82)](0x2);}function formatLastUsed(_0x47a511){const _0x4b548c=a11_0x35d5;if(!_0x47a511)return _0x4b548c(0xb0);const _0x1b5db2=new Date(_0x47a511),_0x8045c4=new Date(),_0x2ce33c=_0x1b5db2[_0x4b548c(0x93)](_0x4b548c(0x91)),_0x267be2=_0x8045c4[_0x4b548c(0x93)](_0x4b548c(0x91));if(_0x2ce33c===_0x267be2)return _0x4b548c(0xb6)+_0x1b5db2['toLocaleTimeString']('en-US',{'hour':_0x4b548c(0x8f),'minute':_0x4b548c(0x8f)});const _0x447dde=new Date(_0x2ce33c),_0x783e00=new Date(_0x267be2),_0x259cc9=Math[_0x4b548c(0x92)]((_0x783e00[_0x4b548c(0x81)]()-_0x447dde[_0x4b548c(0x81)]())/(0x18*0x3c*0x3c*0x3e8));if(_0x259cc9===0x1)return _0x4b548c(0xa6);else return _0x259cc9>0x1&&_0x259cc9<0x7?_0x259cc9+_0x4b548c(0x8a):_0x1b5db2[_0x4b548c(0x93)](_0x4b548c(0x94),{'month':'short','day':_0x4b548c(0x8b)});}export class ClaudeUsageCommand extends BaseCommand{['name']='usage';[a11_0x33e547(0x9a)]=a11_0x33e547(0x79);async[a11_0x33e547(0x83)](_0x2344d7){const _0x46c07a=a11_0x33e547,{options:_0x6e06a7}=_0x2344d7,_0x1d40a9=_0x6e06a7[_0x46c07a(0x77)]===_0x46c07a(0xb5)||_0x6e06a7[_0x46c07a(0x77)]===_0x46c07a(0x72)||_0x6e06a7['json'];try{const [_0x2fbcec,_0x69946c,_0x2bd33b]=await Promise[_0x46c07a(0x8e)]([getAllProfileStats(),getAllSourceStats(),getUsageSummary()]);return _0x1d40a9?await this[_0x46c07a(0x7f)](_0x2fbcec,_0x69946c,_0x2bd33b,_0x6e06a7):this['outputTable'](_0x2fbcec,_0x69946c,_0x2bd33b),0x0;}catch(_0x1fba43){const _0x110667=_0x1fba43 instanceof Error?_0x1fba43[_0x46c07a(0xaa)]:'Unknown\x20error';return console[_0x46c07a(0x88)](a11_0x2ebc2c['red'](_0x46c07a(0x9f)+_0x110667)),0x1;}}async[a11_0x33e547(0x7f)](_0x31b335,_0x363283,_0x3ed2d6,_0x1735c6){const _0x3bd658=a11_0x33e547,_0x246dee={'summary':{'todayCredits':_0x3ed2d6[_0x3bd658(0xa7)],'monthCredits':_0x3ed2d6[_0x3bd658(0x7d)],'totalCredits':_0x3ed2d6[_0x3bd658(0x89)],'profileCount':_0x3ed2d6['profileCount']},'profiles':_0x31b335[_0x3bd658(0xa0)](_0x4524a1=>({'profile':_0x4524a1[_0x3bd658(0xb7)],'credits':_0x4524a1[_0x3bd658(0x7a)],'requests':_0x4524a1[_0x3bd658(0x97)],'lastUsedAt':_0x4524a1[_0x3bd658(0x99)]})),'sources':_0x363283[_0x3bd658(0xa0)](_0x42f9b4=>({'source':_0x42f9b4['source'],'credits':_0x42f9b4[_0x3bd658(0x7a)],'todayCredits':_0x42f9b4[_0x3bd658(0xa7)],'monthCredits':_0x42f9b4[_0x3bd658(0x7d)],'requests':_0x42f9b4['entryCount']}))};await handleSDKOutput([_0x246dee],_0x1735c6);}[a11_0x33e547(0xa9)](_0x32390f,_0xc6b483,_0x36b92d){const _0x323968=a11_0x33e547;console['log'](a11_0x2ebc2c['bold'](_0x323968(0x8c))),console[_0x323968(0x86)](a11_0x2ebc2c['dim']('─'[_0x323968(0x8d)](0x32))),console[_0x323968(0x86)](_0x323968(0x9d)+a11_0x2ebc2c[_0x323968(0xa1)](formatCredits(_0x36b92d['todayCredits']))+_0x323968(0x9e)),console[_0x323968(0x86)](_0x323968(0x7c)+a11_0x2ebc2c['cyan'](formatCredits(_0x36b92d[_0x323968(0x7d)]))+_0x323968(0x9e)),console[_0x323968(0x86)](_0x323968(0x74)+a11_0x2ebc2c['cyan'](formatCredits(_0x36b92d[_0x323968(0x89)]))+'\x20credits'),console[_0x323968(0x86)]();if(_0xc6b483['length']>0x0){console[_0x323968(0x86)](a11_0x2ebc2c['bold'](_0x323968(0x76))),console[_0x323968(0x86)](a11_0x2ebc2c[_0x323968(0x9c)]('─'['repeat'](0x3c)));const _0x31771e=0xc,_0x56bacb=0xa,_0x1fb165=0xa,_0x4ac62e=0xa;console[_0x323968(0x86)]('\x20\x20'+_0x323968(0x95)[_0x323968(0xa3)](_0x31771e)+'\x20\x20'+_0x323968(0xad)[_0x323968(0xaf)](_0x56bacb)+'\x20\x20'+_0x323968(0x87)['padStart'](_0x1fb165)+'\x20\x20'+_0x323968(0xb8)[_0x323968(0xaf)](_0x4ac62e));for(const _0x4e9652 of _0xc6b483){console[_0x323968(0x86)]('\x20\x20'+_0x4e9652['source']['padEnd'](_0x31771e)+'\x20\x20'+a11_0x2ebc2c['cyan'](formatCredits(_0x4e9652[_0x323968(0x7a)])['padStart'](_0x56bacb))+'\x20\x20'+formatCredits(_0x4e9652[_0x323968(0xa7)])[_0x323968(0xaf)](_0x1fb165)+'\x20\x20'+formatCredits(_0x4e9652[_0x323968(0x7d)])[_0x323968(0xaf)](_0x4ac62e));}console[_0x323968(0x86)]();}if(_0x32390f['length']===0x0){console[_0x323968(0x86)](a11_0x2ebc2c[_0x323968(0x9c)](_0x323968(0x96))),console[_0x323968(0x86)](a11_0x2ebc2c[_0x323968(0x9c)]('\x20\x20Run\x20\x22tdx\x20claude\x22\x20to\x20start\x20using\x20AI\x20Suite.\x0a'));return;}console[_0x323968(0x86)](a11_0x2ebc2c[_0x323968(0x85)]('Usage\x20by\x20Profile')),console[_0x323968(0x86)](a11_0x2ebc2c[_0x323968(0x9c)]('─'[_0x323968(0x8d)](0x3c)));const _0x304e12=Math[_0x323968(0x7e)](0xc,..._0x32390f[_0x323968(0xa0)](_0x2057f1=>_0x2057f1[_0x323968(0xb7)]===_0x323968(0x90)?_0x323968(0xa5)[_0x323968(0xb4)]:_0x2057f1['profile'][_0x323968(0xb4)])),_0x5587cf=0xa,_0xb89a94=0xa;console[_0x323968(0x86)]('\x20\x20'+_0x323968(0xb2)['padEnd'](_0x304e12)+'\x20\x20'+_0x323968(0x7b)[_0x323968(0xaf)](_0x5587cf)+'\x20\x20'+_0x323968(0x75)[_0x323968(0xaf)](_0xb89a94)+'\x20\x20'+_0x323968(0x9b));for(const _0x3baf7f of _0x32390f){const _0x3af10c=_0x3baf7f[_0x323968(0xb7)]===_0x323968(0x90)?'(default)':_0x3baf7f[_0x323968(0xb7)],_0x37d145=_0x3af10c[_0x323968(0xa3)](_0x304e12),_0x1ac5fb=_0x3baf7f['profile']==='default'?a11_0x2ebc2c['dim'](_0x37d145):_0x37d145;console[_0x323968(0x86)]('\x20\x20'+_0x1ac5fb+'\x20\x20'+a11_0x2ebc2c[_0x323968(0xa1)](formatCredits(_0x3baf7f[_0x323968(0x7a)])[_0x323968(0xaf)](_0x5587cf))+'\x20\x20'+String(_0x3baf7f[_0x323968(0x97)])[_0x323968(0xaf)](_0xb89a94)+'\x20\x20'+a11_0x2ebc2c[_0x323968(0x9c)](formatLastUsed(_0x3baf7f[_0x323968(0x99)])));}console['log'](),console[_0x323968(0x86)](a11_0x2ebc2c['dim'](_0x323968(0x80))),console[_0x323968(0x86)]();}}function a11_0x1230(){const _0x3899c3=['lastUsedAt','description','Last\x20Used','dim','\x20\x20Today:\x20\x20\x20','\x20credits','Error:\x20','map','cyan','12RRVvRM','padEnd','68520CKnVmM','(default)','yesterday','todayCredits','477BdWUAP','outputTable','message','26856357ffvewi','3830886oqIpbP','Total','7jDzxCh','padStart','never','13444idkXok','Profile','1415PsLCUy','length','json','today\x20','profile','Month','jsonl','423442bWJFYp','\x20\x20Total:\x20\x20\x20','Requests','Usage\x20by\x20Source','format','3600816KPIBLk','Show\x20AI\x20Suite\x20credit\x20usage\x20by\x20profile','credits','Credits','\x20\x20Month:\x20\x20\x20','monthCredits','max','outputStructured','Note:\x20Credit\x20values\x20are\x20estimates\x20based\x20on\x20token\x20usage.','getTime','toFixed','execute','1576832fDDrOp','bold','log','Today','error','totalCredits','\x20days\x20ago','numeric','\x0aAI\x20Suite\x20Credit\x20Usage\x20Summary','repeat','all','2-digit','default','en-CA','round','toLocaleDateString','en-US','Source','\x20\x20No\x20usage\x20data\x20recorded\x20yet.','entryCount','6fgIWGN'];a11_0x1230=function(){return _0x3899c3;};return a11_0x1230();}
|
package/dist/commands/command.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a12_0x3a6676=a12_0x3294;function a12_0x4be9(){const _0x5ab7b8=['888809SMXQUt','validate','has','1107yKfkiE','validateGlobalOptions','stack','detail','test','category','Authentication\x20error\x20stack\x20trace:','red','4139165UwuhwI','To\x20check\x20your\x20current\x20auth\x20status:','dim','91XVmfhf','Command\x20\x27','515022ZAhJpW','.\x20Must\x20be\x20a\x20number.','cyan','2239383VEInvl','4ajqSED','values','helpText','commands','from','getAll','7830996dEazZb','get','limit','42830xMFFiZ','problemDetails','profile','\x20--profile\x20','execute','name','message','Reason:\x20','\x0aStack\x20trace:\x0a','yellow','options','debug','number','Error:\x20','error','2811864zOEMEY','2pjKMyM','11olPaVR','tdx\x20auth\x20setup','isValid','value','tdx\x20auth'];a12_0x4be9=function(){return _0x5ab7b8;};return a12_0x4be9();}(function(_0x252978,_0x17c162){const _0x3ab35e=a12_0x3294,_0x3f797a=_0x252978();while(!![]){try{const _0x463342=-parseInt(_0x3ab35e(0x14c))/0x1+-parseInt(_0x3ab35e(0x146))/0x2*(parseInt(_0x3ab35e(0x15f))/0x3)+parseInt(_0x3ab35e(0x160))/0x4*(parseInt(_0x3ab35e(0x157))/0x5)+-parseInt(_0x3ab35e(0x15c))/0x6*(-parseInt(_0x3ab35e(0x15a))/0x7)+parseInt(_0x3ab35e(0x145))/0x8+parseInt(_0x3ab35e(0x14f))/0x9*(-parseInt(_0x3ab35e(0x136))/0xa)+parseInt(_0x3ab35e(0x147))/0xb*(parseInt(_0x3ab35e(0x133))/0xc);if(_0x463342===_0x17c162)break;else _0x3f797a['push'](_0x3f797a['shift']());}catch(_0x52556a){_0x3f797a['push'](_0x3f797a['shift']());}}}(a12_0x4be9,0xbfd25));import{validateLimitOption}from'../utils/option-validation.js';import{HTTPClientError}from'../sdk/client/http-client.js';import{SDKError,ErrorCategory}from'../sdk/errors.js';function a12_0x3294(_0x25c187,_0x3754b7){_0x25c187=_0x25c187-0x132;const _0x4be952=a12_0x4be9();let _0x329472=_0x4be952[_0x25c187];return _0x329472;}import{Logger}from'../utils/logger/index.js';import a12_0x117f0f from'chalk';export function printAuthError(_0x307df7,_0x1413cc=![],_0x3233b){const _0x128f6f=a12_0x3294,_0x5a6f32=_0x307df7[_0x128f6f(0x137)]?.[_0x128f6f(0x152)]||_0x307df7[_0x128f6f(0x13c)];console[_0x128f6f(0x144)](a12_0x117f0f['red']('Authentication\x20failed')),console['error'](a12_0x117f0f['red'](_0x128f6f(0x13d)+_0x5a6f32));if(_0x1413cc){const _0xd0677a=_0x3233b?_0x128f6f(0x139)+_0x3233b:'';console[_0x128f6f(0x144)]('\x0a'+a12_0x117f0f[_0x128f6f(0x159)]('To\x20set\x20up\x20authentication:')),console[_0x128f6f(0x144)]('\x20\x20'+a12_0x117f0f[_0x128f6f(0x15e)](_0x128f6f(0x148)+_0xd0677a)+'\x0a'),console['error'](''+a12_0x117f0f[_0x128f6f(0x159)](_0x128f6f(0x158))),console['error']('\x20\x20'+a12_0x117f0f['cyan'](_0x128f6f(0x14b)+_0xd0677a));}}export class BaseCommand{['validateGlobalOptions'](_0x2b5079){const _0x33ab06=a12_0x3294,{options:_0x2e137d}=_0x2b5079,_0x3ce251=_0x2e137d[_0x33ab06(0x135)];if(_0x3ce251!==undefined){const _0x368137=typeof _0x3ce251===_0x33ab06(0x142)?_0x3ce251:parseInt(_0x3ce251,0xa);if(isNaN(_0x368137))return'Invalid\x20limit\x20value:\x20'+_0x3ce251+_0x33ab06(0x15d);const _0x55ca97=validateLimitOption(_0x368137);if(!_0x55ca97[_0x33ab06(0x149)])return _0x55ca97['error'];_0x2b5079['options'][_0x33ab06(0x135)]=_0x55ca97[_0x33ab06(0x14a)];}return undefined;}[a12_0x3a6676(0x14d)](_0x1ada8a){return undefined;}async['run'](_0x1fd11f){const _0x4e66f5=a12_0x3a6676;try{const _0x19a22c=this[_0x4e66f5(0x150)](_0x1fd11f);if(_0x19a22c)return console[_0x4e66f5(0x144)](_0x4e66f5(0x143)+_0x19a22c),0x1;const _0x229707=this['validate'](_0x1fd11f);if(_0x229707){const _0x56820c=/^\s*(Usage|Note|Warning|Error):/i[_0x4e66f5(0x153)](_0x229707);return _0x56820c?console[_0x4e66f5(0x144)](_0x229707):console[_0x4e66f5(0x144)]('Error:\x20'+_0x229707),0x1;}const _0x5d0b4a=await this[_0x4e66f5(0x13a)](_0x1fd11f);return _0x5d0b4a??0x0;}catch(_0x95d3f2){if(_0x95d3f2 instanceof Error){if(_0x95d3f2 instanceof HTTPClientError&&_0x95d3f2['status']===0x191){const _0x190cff=_0x1fd11f[_0x4e66f5(0x140)][_0x4e66f5(0x138)];printAuthError(_0x95d3f2,!![],_0x190cff);if(_0x95d3f2['stack']){const _0x581808=Logger['of']('command');_0x581808['debug'](_0x4e66f5(0x155)),_0x581808[_0x4e66f5(0x141)](_0x95d3f2[_0x4e66f5(0x151)]);}return 0x1;}console['error'](a12_0x117f0f[_0x4e66f5(0x156)]('Error:\x20'+_0x95d3f2['message']));_0x95d3f2 instanceof SDKError&&_0x95d3f2['helpText']&&console['error'](a12_0x117f0f[_0x4e66f5(0x13f)](_0x95d3f2[_0x4e66f5(0x162)]));const _0x591b54=_0x95d3f2 instanceof SDKError&&_0x95d3f2[_0x4e66f5(0x154)]===ErrorCategory['USER_ERROR'];_0x95d3f2[_0x4e66f5(0x151)]&&!_0x591b54&&console[_0x4e66f5(0x144)](_0x4e66f5(0x13e)+_0x95d3f2['stack']);}else console[_0x4e66f5(0x144)](_0x4e66f5(0x143)+String(_0x95d3f2));return 0x1;}}}export class CommandRegistry{[a12_0x3a6676(0x163)]=new Map();['register'](_0x3c1cd8){const _0xc78fa6=a12_0x3a6676;if(this[_0xc78fa6(0x163)][_0xc78fa6(0x14e)](_0x3c1cd8[_0xc78fa6(0x13b)]))throw new Error(_0xc78fa6(0x15b)+_0x3c1cd8[_0xc78fa6(0x13b)]+'\x27\x20is\x20already\x20registered');this[_0xc78fa6(0x163)]['set'](_0x3c1cd8[_0xc78fa6(0x13b)],_0x3c1cd8);}[a12_0x3a6676(0x134)](_0x478fdd){const _0x3d69f8=a12_0x3a6676;return this[_0x3d69f8(0x163)][_0x3d69f8(0x134)](_0x478fdd);}[a12_0x3a6676(0x132)](){const _0x4753e3=a12_0x3a6676;return Array[_0x4753e3(0x164)](this['commands'][_0x4753e3(0x161)]());}[a12_0x3a6676(0x14e)](_0x4169cf){const _0x1fe596=a12_0x3a6676;return this[_0x1fe596(0x163)][_0x1fe596(0x14e)](_0x4169cf);}}export const registry=new CommandRegistry();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a13_0x237a33=a13_0x3827;(function(_0x210b5b,_0x1e2d8e){const _0x514740=a13_0x3827,_0x446e7b=_0x210b5b();while(!![]){try{const _0x5540cc=parseInt(_0x514740(0x118))/0x1*(parseInt(_0x514740(0xc5))/0x2)+-parseInt(_0x514740(0xf6))/0x3+-parseInt(_0x514740(0x129))/0x4*(parseInt(_0x514740(0xf8))/0x5)+parseInt(_0x514740(0xeb))/0x6+-parseInt(_0x514740(0xed))/0x7*(parseInt(_0x514740(0x116))/0x8)+-parseInt(_0x514740(0x100))/0x9+parseInt(_0x514740(0xd4))/0xa*(parseInt(_0x514740(0xd8))/0xb);if(_0x5540cc===_0x1e2d8e)break;else _0x446e7b['push'](_0x446e7b['shift']());}catch(_0x3eb8ab){_0x446e7b['push'](_0x446e7b['shift']());}}}(a13_0x3227,0x79e16));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_0x430a28 from'chalk';function normalizeSchemaForDisplay(_0x193cda){const _0x17d165=a13_0x3827,_0x34ca87=_0x193cda[_0x17d165(0x122)]||[],_0x590d1b=_0x34ca87[_0x17d165(0xc8)](_0x5e1e76=>_0x5e1e76[_0x17d165(0xda)]===_0x17d165(0xc6)&&_0x5e1e76[_0x17d165(0x114)]==='record'&&_0x5e1e76['properties']);if(_0x590d1b?.[_0x17d165(0x122)]){const _0xe57edf=_0x34ca87[_0x17d165(0xd0)](_0x23874c=>_0x23874c['name']!=='legacy'&&_0x23874c[_0x17d165(0xda)]!==_0x17d165(0xc6));return[..._0xe57edf,..._0x590d1b[_0x17d165(0x122)]];}return _0x34ca87[_0x17d165(0xd0)](_0x3dbf67=>_0x3dbf67[_0x17d165(0xda)]!==_0x17d165(0xff));}function printSchemaFields(_0x132e71,_0x337480){const _0x1b6c60=a13_0x3827,_0x4ef1ee='\x20\x20'[_0x1b6c60(0xd1)](_0x337480+0x1),_0x5706f7='\x20\x20'[_0x1b6c60(0xd1)](_0x337480+0x2);for(const _0x3ded0a of _0x132e71){if(!_0x3ded0a[_0x1b6c60(0xda)])continue;const _0x182789=_0x3ded0a[_0x1b6c60(0x114)]==='record'&&_0x3ded0a[_0x1b6c60(0x122)]&&_0x3ded0a[_0x1b6c60(0x122)][_0x1b6c60(0x10c)]>0x0&&_0x3ded0a[_0x1b6c60(0xda)]!==_0x1b6c60(0xc6);let _0x13d8c5=''+_0x4ef1ee+a13_0x430a28['green'](_0x3ded0a[_0x1b6c60(0xda)]);_0x3ded0a['title']&&(_0x13d8c5+=':\x20'+_0x3ded0a[_0x1b6c60(0xc1)]);if(_0x3ded0a['input'])_0x13d8c5+=a13_0x430a28['dim']('\x20['+_0x3ded0a['input']+']');else _0x182789&&(_0x13d8c5+=a13_0x430a28[_0x1b6c60(0xd7)](_0x1b6c60(0x101)));console[_0x1b6c60(0x11e)](_0x13d8c5);_0x3ded0a['description']&&console['log'](''+_0x5706f7+a13_0x430a28[_0x1b6c60(0xd7)](_0x3ded0a['description']));if(_0x3ded0a[_0x1b6c60(0x11c)]){const _0x239052=_0x3ded0a[_0x1b6c60(0x11c)][_0x1b6c60(0x125)](_0x2455d8=>typeof _0x2455d8===_0x1b6c60(0xf1)&&_0x1b6c60(0x12c)in _0x2455d8?_0x2455d8[_0x1b6c60(0x12c)]:_0x2455d8)[_0x1b6c60(0x11f)](',\x20');console[_0x1b6c60(0x11e)](_0x5706f7+'Options:\x20'+a13_0x430a28['yellow'](_0x239052));}_0x3ded0a[_0x1b6c60(0xe0)]!==undefined&&console[_0x1b6c60(0x11e)](_0x5706f7+_0x1b6c60(0xd3)+a13_0x430a28[_0x1b6c60(0x124)](String(_0x3ded0a['default_value'])));if(_0x3ded0a['minimum']!==undefined||_0x3ded0a[_0x1b6c60(0x119)]!==undefined){const _0x6b8f0d=_0x3ded0a[_0x1b6c60(0x12e)]!==undefined&&_0x3ded0a[_0x1b6c60(0x119)]!==undefined?_0x3ded0a[_0x1b6c60(0x12e)]+_0x1b6c60(0x11a)+_0x3ded0a[_0x1b6c60(0x119)]:_0x3ded0a['minimum']!==undefined?_0x1b6c60(0xc4)+_0x3ded0a[_0x1b6c60(0x12e)]:_0x1b6c60(0x115)+_0x3ded0a[_0x1b6c60(0x119)];console[_0x1b6c60(0x11e)](_0x5706f7+_0x1b6c60(0xf3)+a13_0x430a28[_0x1b6c60(0x124)](_0x6b8f0d));}if(_0x3ded0a[_0x1b6c60(0xe6)]){const _0x5ddef5=Object[_0x1b6c60(0xfd)](_0x3ded0a[_0x1b6c60(0xe6)])[_0x1b6c60(0x125)](([_0x30fc7f,_0x1564c3])=>_0x30fc7f+'='+JSON[_0x1b6c60(0xe4)](_0x1564c3))['join'](',\x20');console[_0x1b6c60(0x11e)](''+_0x5706f7+a13_0x430a28[_0x1b6c60(0xd7)](_0x1b6c60(0xdd)+_0x5ddef5));}_0x182789&&_0x3ded0a['properties']&&printSchemaFields(_0x3ded0a[_0x1b6c60(0x122)],_0x337480+0x1);}}export class ConnectionListCommand extends BaseCommand{[a13_0x237a33(0xda)]=a13_0x237a33(0xde);[a13_0x237a33(0x11b)]='List\x20all\x20result\x20output\x20connections';async[a13_0x237a33(0xc7)](_0x568d70){const _0x4f84e7=a13_0x237a33,{options:_0x56e970,tdx:_0xfda536}=_0x568d70;_0x56e970['verbose']&&console['error'](_0x4f84e7(0xce)+_0x56e970[_0x4f84e7(0xcd)]);const _0x16a684=resolveLimit(_0x56e970[_0x4f84e7(0xf2)],DEFAULT_LISTING_LIMIT),_0x4c80b7=await withSpinner(_0x4f84e7(0x112),()=>_0xfda536[_0x4f84e7(0x126)][_0x4f84e7(0x103)](),{'verbose':_0x56e970[_0x4f84e7(0xe3)]}),_0x429435=_0x4c80b7[_0x4f84e7(0xf9)];console[_0x4f84e7(0xd6)](_0x4f84e7(0x109)+_0x429435['length']+_0x4f84e7(0xdc)+(_0x429435[_0x4f84e7(0x10c)]!==0x1?'s':''));if(isStructuredFormat(_0x56e970)){const _0x17d4ab=_0x429435[_0x4f84e7(0xdf)](0x0,_0x16a684);await handleSDKOutput(_0x17d4ab,{..._0x56e970,'limit':_0x16a684});}else{const _0x3b8715=_0x429435[_0x4f84e7(0x10c)]>0x0?Math['max'](..._0x429435[_0x4f84e7(0x125)](_0x13d68f=>_0x13d68f[_0x4f84e7(0x114)]['length'])):0x0,_0x1d098b=[];for(const _0x1c16c6 of _0x429435){const _0x456fb3=a13_0x430a28[_0x4f84e7(0xd5)](_0x1c16c6[_0x4f84e7(0x114)][_0x4f84e7(0xee)](_0x3b8715)),_0x54f3bd=_0x1c16c6[_0x4f84e7(0x123)]?.['name']?_0x4f84e7(0x11a)+a13_0x430a28[_0x4f84e7(0xd7)](_0x1c16c6[_0x4f84e7(0x123)][_0x4f84e7(0xda)]):'';_0x1d098b[_0x4f84e7(0x12a)](_0x456fb3+'\x20\x20'+_0x1c16c6[_0x4f84e7(0xda)]+_0x54f3bd);}await writeOutput(_0x1d098b[_0x4f84e7(0x11f)]('\x0a'),_0x56e970['output'],'table');}return 0x0;}}export class ConnectionShowCommand extends BaseCommand{['name']=a13_0x237a33(0xfc);['description']=a13_0x237a33(0xe7);[a13_0x237a33(0xc2)](_0x1d0042){const _0x4ebdb5=a13_0x237a33,{args:_0x58801e}=_0x1d0042;if(!_0x58801e[0x0])return _0x4ebdb5(0xea);return undefined;}async[a13_0x237a33(0xc7)](_0x2dbb0c){const _0x18b86f=a13_0x237a33,{options:_0x188fed,args:_0x27e384,tdx:_0x50472b}=_0x2dbb0c,_0x28fe37=_0x27e384[0x0];_0x188fed['verbose']&&(console[_0x18b86f(0xd6)](_0x18b86f(0xce)+_0x188fed['site']),console[_0x18b86f(0xd6)]('Looking\x20up\x20connection:\x20'+_0x28fe37));const _0x47cc87=await withSpinner(_0x18b86f(0x120)+_0x28fe37+_0x18b86f(0xf5),()=>_0x50472b[_0x18b86f(0x126)][_0x18b86f(0xe9)](_0x28fe37),{'verbose':_0x188fed[_0x18b86f(0xe3)]}),_0xed7d57=_0x47cc87[_0x18b86f(0xf9)];return console['error'](_0x18b86f(0xf0)+_0xed7d57[_0x18b86f(0xda)]),await handleSingleObjectOutput(_0xed7d57,_0x188fed),0x0;}}export class ConnectionSchemaCommand extends BaseCommand{['name']=a13_0x237a33(0xca);[a13_0x237a33(0x11b)]=a13_0x237a33(0x111);['validate'](_0x4d50c9){const {args:_0x95c160}=_0x4d50c9;if(!_0x95c160[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[a13_0x237a33(0xc7)](_0xe8a7b4){const _0x23c5d0=a13_0x237a33,{options:_0x950ebc,args:_0x4a02a4,tdx:_0x24ac35}=_0xe8a7b4,_0x56adfb=_0x4a02a4[0x0];_0x950ebc[_0x23c5d0(0xe3)]&&(console[_0x23c5d0(0xd6)](_0x23c5d0(0xce)+_0x950ebc[_0x23c5d0(0xcd)]),console[_0x23c5d0(0xd6)](_0x23c5d0(0xfa)+_0x56adfb));let _0x54ba57=_0x56adfb,_0x540eb3;try{const _0xe0a135=await _0x24ac35[_0x23c5d0(0x126)]['findByName'](_0x56adfb);_0xe0a135&&(_0x54ba57=_0xe0a135[_0x23c5d0(0x114)],_0x540eb3=_0xe0a135[_0x23c5d0(0xda)],_0x950ebc[_0x23c5d0(0xe3)]&&console[_0x23c5d0(0xd6)](_0x23c5d0(0x12b)+_0x56adfb+_0x23c5d0(0x12d)+_0x54ba57));}catch{_0x950ebc[_0x23c5d0(0xe3)]&&console['error'](_0x23c5d0(0x10e)+_0x56adfb+_0x23c5d0(0xe8));}const _0x2b001c=await withSpinner(_0x23c5d0(0xec)+_0x54ba57+_0x23c5d0(0xf5),()=>_0x24ac35[_0x23c5d0(0x126)]['getOutputSchema'](_0x54ba57),{'verbose':_0x950ebc[_0x23c5d0(0xe3)]}),_0x424675=_0x2b001c[_0x23c5d0(0xf9)];_0x540eb3?console[_0x23c5d0(0xd6)]('✔\x20Found\x20schema\x20for\x20connection\x20\x27'+_0x540eb3+_0x23c5d0(0x107)+_0x54ba57+')'):console[_0x23c5d0(0xd6)](_0x23c5d0(0xfe)+_0x54ba57);if(isStructuredFormat(_0x950ebc))await handleSingleObjectOutput(_0x424675,_0x950ebc);else{const _0x38d883=normalizeSchemaForDisplay(_0x424675);_0x540eb3?(console[_0x23c5d0(0x11e)]('\x0aConnection:\x20'+a13_0x430a28['cyan'](_0x540eb3)),console[_0x23c5d0(0x11e)](_0x23c5d0(0x11d)+a13_0x430a28['dim'](_0x54ba57))):console[_0x23c5d0(0x11e)]('\x0aConnector:\x20'+a13_0x430a28['cyan'](_0x54ba57)),_0x38d883['length']>0x0?(console[_0x23c5d0(0x11e)](a13_0x430a28['bold'](_0x23c5d0(0x127))),printSchemaFields(_0x38d883,0x0)):console[_0x23c5d0(0x11e)](a13_0x430a28[_0x23c5d0(0xd7)](_0x23c5d0(0xc9)));}return 0x0;}}function a13_0x3827(_0x47c7fa,_0x9e437e){_0x47c7fa=_0x47c7fa-0xc1;const _0x32278b=a13_0x3227();let _0x382741=_0x32278b[_0x47c7fa];return _0x382741;}export class ConnectionTypesCommand extends BaseCommand{[a13_0x237a33(0xda)]=a13_0x237a33(0x102);[a13_0x237a33(0x11b)]=a13_0x237a33(0x117);async[a13_0x237a33(0xc7)](_0x5899d5){const _0x966b12=a13_0x237a33,{options:_0x2f8c76,tdx:_0x346bfa}=_0x5899d5;_0x2f8c76[_0x966b12(0xe3)]&&console[_0x966b12(0xd6)](_0x966b12(0xce)+_0x2f8c76['site']);const _0x5c32c9=await withSpinner('Listing\x20connector\x20types...',()=>_0x346bfa[_0x966b12(0x126)][_0x966b12(0x10a)](),{'verbose':_0x2f8c76[_0x966b12(0xe3)]}),_0x9307d4=_0x5c32c9[_0x966b12(0xf9)][_0x966b12(0xcc)]((_0x5b9189,_0x1621d6)=>_0x5b9189['type'][_0x966b12(0xf4)](_0x1621d6[_0x966b12(0x114)]));console[_0x966b12(0xd6)]('✔\x20Found\x20'+_0x9307d4[_0x966b12(0x10c)]+_0x966b12(0xef)+(_0x9307d4[_0x966b12(0x10c)]!==0x1?'s':''));if(isStructuredFormat(_0x2f8c76))await handleSDKOutput(_0x9307d4,_0x2f8c76);else{const _0x52c026=_0x9307d4[_0x966b12(0x10c)]>0x0?Math[_0x966b12(0xd9)](..._0x9307d4[_0x966b12(0x125)](_0x17afc1=>_0x17afc1['type'][_0x966b12(0x10c)])):0x0,_0x4c40bb=[];for(const _0x5e2597 of _0x9307d4){const _0x5a8ce2=a13_0x430a28[_0x966b12(0xd5)](_0x5e2597[_0x966b12(0x114)]['padStart'](_0x52c026));_0x4c40bb[_0x966b12(0x12a)](_0x5a8ce2+'\x20\x20'+_0x5e2597[_0x966b12(0xda)]);}await writeOutput(_0x4c40bb[_0x966b12(0x11f)]('\x0a'),_0x2f8c76['output'],_0x966b12(0x106));}return 0x0;}}export class ConnectionSettingsCommand extends BaseCommand{[a13_0x237a33(0xda)]='connection:settings';[a13_0x237a33(0x11b)]='Show\x20connection-level\x20settings\x20(credentials,\x20authentication)';['validate'](_0x10b6a9){const _0x482fb0=a13_0x237a33,{args:_0x5e4f21}=_0x10b6a9;if(!_0x5e4f21[0x0])return _0x482fb0(0x104);return undefined;}async[a13_0x237a33(0xc7)](_0x51f504){const _0x2a32d3=a13_0x237a33,{options:_0x2ec78f,args:_0x1dd159,tdx:_0x163751}=_0x51f504,_0x27d763=_0x1dd159[0x0];_0x2ec78f[_0x2a32d3(0xe3)]&&(console[_0x2a32d3(0xd6)](_0x2a32d3(0xce)+_0x2ec78f[_0x2a32d3(0xcd)]),console['error'](_0x2a32d3(0xfb)+_0x27d763));const _0x1a762e=await withSpinner('Fetching\x20settings\x20for\x20\x27'+_0x27d763+_0x2a32d3(0xf5),()=>_0x163751[_0x2a32d3(0x126)][_0x2a32d3(0x110)](_0x27d763),{'verbose':_0x2ec78f[_0x2a32d3(0xe3)]}),_0x4c90bc=_0x1a762e[_0x2a32d3(0xf9)];console[_0x2a32d3(0xd6)](_0x2a32d3(0xdb)+_0x27d763);if(isStructuredFormat(_0x2ec78f))await handleSingleObjectOutput(_0x4c90bc,_0x2ec78f);else{console[_0x2a32d3(0x11e)](_0x2a32d3(0x128)+a13_0x430a28['cyan'](_0x27d763)),console['log'](_0x2a32d3(0x108)+_0x4c90bc[_0x2a32d3(0xda)]);const _0x36c838=_0x4c90bc[_0x2a32d3(0xf7)]||[],_0x1b12a1=_0x36c838['filter'](_0x4c3453=>_0x4c3453[_0x2a32d3(0x105)]);_0x1b12a1[_0x2a32d3(0x10c)]>0x0&&(console['log'](a13_0x430a28[_0x2a32d3(0x10b)](_0x2a32d3(0xcb))),printMetadataSettings(_0x1b12a1));let _0x590786=![];try{const _0x112a5b=await _0x163751['connection'][_0x2a32d3(0x113)](_0x27d763),_0x1f12d5=normalizeSchemaForDisplay(_0x112a5b);_0x1f12d5['length']>0x0&&(console['log'](a13_0x430a28[_0x2a32d3(0x10b)]('\x0aAvailable\x20fields:')),printSchemaFields(_0x1f12d5,0x0),_0x590786=!![]);}catch{const _0x5f1650=_0x36c838[_0x2a32d3(0xd0)](_0x2d978d=>!_0x2d978d['credential']);_0x5f1650['length']>0x0&&(console['log'](a13_0x430a28[_0x2a32d3(0x10b)](_0x2a32d3(0x127))),printMetadataSettings(_0x5f1650),_0x590786=!![]);}!_0x590786&&_0x2ec78f[_0x2a32d3(0xe3)]&&console[_0x2a32d3(0xd6)](a13_0x430a28[_0x2a32d3(0xd7)](_0x2a32d3(0xcf))),_0x1b12a1[_0x2a32d3(0x10c)]===0x0&&console[_0x2a32d3(0x11e)](a13_0x430a28['dim'](_0x2a32d3(0xc3)));}return 0x0;}}function a13_0x3227(){const _0x33915a=['green','getMetadata','Show\x20connector\x20output\x20schema\x20for\x20connector_config\x20validation','Listing\x20connections...','getOutputSchema','type','<=\x20','8CwYwcu','List\x20available\x20connector\x20types','31DJLQla','maximum','\x20-\x20','description','enumeration','Type:\x20','log','join','Fetching\x20connection\x20\x27','\x20\x20\x20\x20Options:\x20','properties','owner','blue','map','connection','\x0aAvailable\x20fields:','\x0aConnector:\x20','28EAiMSk','push','✔\x20Resolved\x20\x27','value','\x27\x20as\x20connection\x20name\x20→\x20type:\x20','minimum','title','validate','\x0aNo\x20credential\x20settings\x20defined','>=\x20','34268DAsbdT','legacy_settings','execute','find','\x0aNo\x20fields\x20defined\x20in\x20schema','connection:schema','\x0aCredential\x20settings:','sort','site','Site:\x20','No\x20available\x20fields\x20for\x20this\x20connector','filter','repeat','\x20\x20\x20\x20','Default:\x20','40DaxAnh','cyan','error','dim','3837361djhiAY','max','name','✔\x20Found\x20settings\x20for\x20connector\x20type:\x20','\x20connection','Show\x20when:\x20','connection:list','slice','default_value','options','\x20\x20\x20\x20Default:\x20','verbose','stringify','yellow','criteria','Show\x20connection\x20details','\x27\x20as\x20connector\x20type','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','3591342xzLuRL','Fetching\x20schema\x20for\x20\x27','4843447BrgOKc','padStart','\x20connector\x20type','✔\x20Found\x20connection:\x20','object','limit','Range:\x20','localeCompare','\x27...','673512wDjvQa','settings','320695rqikPF','data','Resolving\x20connector\x20type\x20or\x20name:\x20','Fetching\x20settings\x20for\x20connector\x20type:\x20','connection:show','entries','✔\x20Found\x20schema\x20for\x20connector\x20type:\x20','legacy','5944455funVNL','\x20[record]','connection:types','list','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.','credential','table','\x27\x20(type:\x20','Name:\x20','✔\x20Found\x20','listTypes','bold','length','label','Treating\x20\x27'];a13_0x3227=function(){return _0x33915a;};return a13_0x3227();}function printMetadataSettings(_0x5de049){const _0x357e62=a13_0x237a33;for(const _0x39cd62 of _0x5de049){if(!_0x39cd62[_0x357e62(0xda)])continue;if(_0x39cd62['hidden'])continue;let _0xcee8a0='\x20\x20'+a13_0x430a28[_0x357e62(0x10f)](_0x39cd62[_0x357e62(0xda)]);_0x39cd62[_0x357e62(0x10d)]&&(_0xcee8a0+=':\x20'+_0x39cd62[_0x357e62(0x10d)]);_0x39cd62['type']&&(_0xcee8a0+=a13_0x430a28[_0x357e62(0xd7)]('\x20['+_0x39cd62[_0x357e62(0x114)]+']'));console['log'](_0xcee8a0);_0x39cd62['hint']&&console[_0x357e62(0x11e)]('\x20\x20\x20\x20'+a13_0x430a28[_0x357e62(0xd7)](_0x39cd62['hint']));if(_0x39cd62[_0x357e62(0xe1)]){const _0x5314a8=_0x39cd62[_0x357e62(0xe1)]['map'](_0x192d6d=>_0x192d6d[_0x357e62(0x12c)])[_0x357e62(0x11f)](',\x20');console['log'](_0x357e62(0x121)+a13_0x430a28[_0x357e62(0xe5)](_0x5314a8));}_0x39cd62['default_value']!==undefined&&_0x39cd62[_0x357e62(0xe0)]!==null&&console[_0x357e62(0x11e)](_0x357e62(0xe2)+a13_0x430a28[_0x357e62(0x124)](String(_0x39cd62[_0x357e62(0xe0)])));if(_0x39cd62[_0x357e62(0xe6)]){const _0x14a253=Object[_0x357e62(0xfd)](_0x39cd62['criteria'])[_0x357e62(0x125)](([_0x50cad1,_0x45f528])=>_0x50cad1+'='+JSON[_0x357e62(0xe4)](_0x45f528))['join'](',\x20');console[_0x357e62(0x11e)](_0x357e62(0xd2)+a13_0x430a28[_0x357e62(0xd7)](_0x357e62(0xdd)+_0x14a253));}}}
|
|
1
|
+
const a13_0x10c2ba=a13_0x207b;(function(_0x46cfe0,_0x4d7600){const _0x3aeae1=a13_0x207b,_0x157089=_0x46cfe0();while(!![]){try{const _0x500ff6=-parseInt(_0x3aeae1(0x20f))/0x1+-parseInt(_0x3aeae1(0x1d5))/0x2+-parseInt(_0x3aeae1(0x1cf))/0x3+-parseInt(_0x3aeae1(0x1e2))/0x4*(parseInt(_0x3aeae1(0x215))/0x5)+parseInt(_0x3aeae1(0x210))/0x6+parseInt(_0x3aeae1(0x1f6))/0x7*(parseInt(_0x3aeae1(0x1d6))/0x8)+parseInt(_0x3aeae1(0x1cc))/0x9;if(_0x500ff6===_0x4d7600)break;else _0x157089['push'](_0x157089['shift']());}catch(_0x392ba4){_0x157089['push'](_0x157089['shift']());}}}(a13_0x1719,0x614fd));import{BaseCommand}from'./command.js';function a13_0x1719(){const _0x469a74=['push','Listing\x20connector\x20types...','join','description','execute','map','padStart','input','type','hint','<=\x20','table','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.','minimum','connection:settings','blue','168CMZfeJ','limit','properties','connection:show','data','Site:\x20','legacy_settings','✔\x20Found\x20','cyan','record','hidden','listTypes','Show\x20connection\x20details','value','entries','error','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','legacy','connection','yellow','Fetching\x20settings\x20for\x20connector\x20type:\x20','Type:\x20','\x20[record]','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.','maximum','505994mGLuhy','2517342vvbcxk','getOutputSchema','default_value','No\x20available\x20fields\x20for\x20this\x20connector','repeat','25DJnQNM','Fetching\x20settings\x20for\x20\x27','stringify','credential','name','Show\x20connector\x20output\x20schema\x20for\x20connector_config\x20validation','object','green','resolve','length','\x20\x20\x20\x20Default:\x20','✔\x20Resolved\x20\x27','Looking\x20up\x20connection:\x20','\x0aAvailable\x20fields:','\x27\x20as\x20connection\x20name\x20→\x20type:\x20','site','Treating\x20\x27','Resolving\x20connector\x20type\x20or\x20name:\x20','\x0aNo\x20fields\x20defined\x20in\x20schema','filter','options','\x27...','✔\x20Found\x20schema\x20for\x20connector\x20type:\x20','log','verbose','connection:schema','criteria','Show\x20connection-level\x20settings\x20(credentials,\x20authentication)','title','\x20\x20\x20\x20Options:\x20','list','localeCompare','connection:list','7214130YfXoNQ','Show\x20when:\x20','Default:\x20','1957683OUeNNn','Fetching\x20schema\x20for\x20\x27','bold','label','Range:\x20','List\x20available\x20connector\x20types','234156ZqvcGT','176160CLxdpK','settings','Options:\x20','\x0aConnector:\x20','Listing\x20connections...','owner','\x0aCredential\x20settings:','>=\x20','dim','findByName','validate','✔\x20Found\x20connection:\x20','60308fAyNeq','\x20-\x20','\x20\x20\x20\x20','Name:\x20'];a13_0x1719=function(){return _0x469a74;};return a13_0x1719();}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_0x5408cd from'chalk';function normalizeSchemaForDisplay(_0x5b8aa5){const _0x588380=a13_0x207b,_0x4e3ed8=_0x5b8aa5[_0x588380(0x1f8)]||[],_0x2bb6a0=_0x4e3ed8['find'](_0x395f33=>_0x395f33[_0x588380(0x219)]===_0x588380(0x1fc)&&_0x395f33[_0x588380(0x1ee)]===_0x588380(0x1ff)&&_0x395f33['properties']);if(_0x2bb6a0?.[_0x588380(0x1f8)]){const _0x5a3f13=_0x4e3ed8[_0x588380(0x228)](_0x44aeaa=>_0x44aeaa[_0x588380(0x219)]!==_0x588380(0x207)&&_0x44aeaa['name']!==_0x588380(0x1fc));return[..._0x5a3f13,..._0x2bb6a0[_0x588380(0x1f8)]];}return _0x4e3ed8[_0x588380(0x228)](_0x90b2ec=>_0x90b2ec[_0x588380(0x219)]!=='legacy');}function printSchemaFields(_0x2f9c57,_0x17f9ab){const _0x348c46=a13_0x207b,_0x639545='\x20\x20'['repeat'](_0x17f9ab+0x1),_0x4515a2='\x20\x20'[_0x348c46(0x214)](_0x17f9ab+0x2);for(const _0x14be4a of _0x2f9c57){if(!_0x14be4a[_0x348c46(0x219)])continue;const _0x1c41e1=_0x14be4a[_0x348c46(0x1ee)]===_0x348c46(0x1ff)&&_0x14be4a[_0x348c46(0x1f8)]&&_0x14be4a[_0x348c46(0x1f8)]['length']>0x0&&_0x14be4a[_0x348c46(0x219)]!==_0x348c46(0x1fc);let _0x58bf63=''+_0x639545+a13_0x5408cd[_0x348c46(0x21c)](_0x14be4a[_0x348c46(0x219)]);_0x14be4a[_0x348c46(0x231)]&&(_0x58bf63+=':\x20'+_0x14be4a[_0x348c46(0x231)]);if(_0x14be4a[_0x348c46(0x1ed)])_0x58bf63+=a13_0x5408cd[_0x348c46(0x1de)]('\x20['+_0x14be4a[_0x348c46(0x1ed)]+']');else _0x1c41e1&&(_0x58bf63+=a13_0x5408cd[_0x348c46(0x1de)](_0x348c46(0x20c)));console[_0x348c46(0x22c)](_0x58bf63);_0x14be4a[_0x348c46(0x1e9)]&&console[_0x348c46(0x22c)](''+_0x4515a2+a13_0x5408cd[_0x348c46(0x1de)](_0x14be4a['description']));if(_0x14be4a['enumeration']){const _0x447531=_0x14be4a['enumeration'][_0x348c46(0x1eb)](_0x4e4113=>typeof _0x4e4113===_0x348c46(0x21b)&&_0x348c46(0x203)in _0x4e4113?_0x4e4113[_0x348c46(0x203)]:_0x4e4113)['join'](',\x20');console[_0x348c46(0x22c)](_0x4515a2+_0x348c46(0x1d8)+a13_0x5408cd[_0x348c46(0x209)](_0x447531));}_0x14be4a[_0x348c46(0x212)]!==undefined&&console[_0x348c46(0x22c)](_0x4515a2+_0x348c46(0x1ce)+a13_0x5408cd['blue'](String(_0x14be4a[_0x348c46(0x212)])));if(_0x14be4a[_0x348c46(0x1f3)]!==undefined||_0x14be4a['maximum']!==undefined){const _0x1a5794=_0x14be4a['minimum']!==undefined&&_0x14be4a[_0x348c46(0x20e)]!==undefined?_0x14be4a[_0x348c46(0x1f3)]+_0x348c46(0x1e3)+_0x14be4a[_0x348c46(0x20e)]:_0x14be4a['minimum']!==undefined?_0x348c46(0x1dd)+_0x14be4a[_0x348c46(0x1f3)]:_0x348c46(0x1f0)+_0x14be4a['maximum'];console[_0x348c46(0x22c)](_0x4515a2+_0x348c46(0x1d3)+a13_0x5408cd[_0x348c46(0x1f5)](_0x1a5794));}if(_0x14be4a[_0x348c46(0x22f)]){const _0x10022b=Object['entries'](_0x14be4a['criteria'])[_0x348c46(0x1eb)](([_0x5656fd,_0x55004c])=>_0x5656fd+'='+JSON[_0x348c46(0x217)](_0x55004c))['join'](',\x20');console[_0x348c46(0x22c)](''+_0x4515a2+a13_0x5408cd[_0x348c46(0x1de)](_0x348c46(0x1cd)+_0x10022b));}_0x1c41e1&&_0x14be4a[_0x348c46(0x1f8)]&&printSchemaFields(_0x14be4a[_0x348c46(0x1f8)],_0x17f9ab+0x1);}}export class ConnectionListCommand extends BaseCommand{[a13_0x10c2ba(0x219)]=a13_0x10c2ba(0x1cb);[a13_0x10c2ba(0x1e9)]='List\x20all\x20result\x20output\x20connections';async[a13_0x10c2ba(0x1ea)](_0x119b93){const _0x4609ba=a13_0x10c2ba,{options:_0x19bc88,tdx:_0x4fa793}=_0x119b93;_0x19bc88['verbose']&&console['error'](_0x4609ba(0x1fb)+_0x19bc88[_0x4609ba(0x224)]);const _0x4bacea=resolveLimit(_0x19bc88[_0x4609ba(0x1f7)],DEFAULT_LISTING_LIMIT),_0x373aa6=await withSpinner(_0x4609ba(0x1da),()=>_0x4fa793[_0x4609ba(0x208)][_0x4609ba(0x1c9)](),{'verbose':_0x19bc88[_0x4609ba(0x22d)]}),_0x3e360c=_0x373aa6['data'];console[_0x4609ba(0x205)](_0x4609ba(0x1fd)+_0x3e360c[_0x4609ba(0x21e)]+'\x20connection'+(_0x3e360c['length']!==0x1?'s':''));if(isStructuredFormat(_0x19bc88)){const _0x29de29=_0x3e360c['slice'](0x0,_0x4bacea);await handleSDKOutput(_0x29de29,{..._0x19bc88,'limit':_0x4bacea});}else{const _0x2e8330=_0x3e360c[_0x4609ba(0x21e)]>0x0?Math['max'](..._0x3e360c[_0x4609ba(0x1eb)](_0x21535d=>_0x21535d[_0x4609ba(0x1ee)][_0x4609ba(0x21e)])):0x0,_0x4938cc=[];for(const _0x2ad908 of _0x3e360c){const _0x3ffd7e=a13_0x5408cd[_0x4609ba(0x1fe)](_0x2ad908[_0x4609ba(0x1ee)][_0x4609ba(0x1ec)](_0x2e8330)),_0x3cd10e=_0x2ad908[_0x4609ba(0x1db)]?.[_0x4609ba(0x219)]?_0x4609ba(0x1e3)+a13_0x5408cd['dim'](_0x2ad908['owner'][_0x4609ba(0x219)]):'';_0x4938cc['push'](_0x3ffd7e+'\x20\x20'+_0x2ad908[_0x4609ba(0x219)]+_0x3cd10e);}await writeOutput(_0x4938cc[_0x4609ba(0x1e8)]('\x0a'),_0x19bc88['output'],_0x4609ba(0x1f1));}return 0x0;}}export class ConnectionShowCommand extends BaseCommand{[a13_0x10c2ba(0x219)]=a13_0x10c2ba(0x1f9);['description']=a13_0x10c2ba(0x202);['validate'](_0x3d3be4){const _0x593f63=a13_0x10c2ba,{args:_0x5a8c71}=_0x3d3be4;if(!_0x5a8c71[0x0])return _0x593f63(0x206);return undefined;}async[a13_0x10c2ba(0x1ea)](_0x39cf39){const _0xe1206c=a13_0x10c2ba,{options:_0x21cce6,args:_0x1dcdaa,tdx:_0x3325ad}=_0x39cf39,_0x201afe=_0x1dcdaa[0x0];_0x21cce6[_0xe1206c(0x22d)]&&(console[_0xe1206c(0x205)](_0xe1206c(0x1fb)+_0x21cce6[_0xe1206c(0x224)]),console[_0xe1206c(0x205)](_0xe1206c(0x221)+_0x201afe));const _0x583db4=await withSpinner('Fetching\x20connection\x20\x27'+_0x201afe+_0xe1206c(0x22a),()=>_0x3325ad[_0xe1206c(0x208)][_0xe1206c(0x21d)](_0x201afe),{'verbose':_0x21cce6[_0xe1206c(0x22d)]}),_0x108ca8=_0x583db4['data'];return console[_0xe1206c(0x205)](_0xe1206c(0x1e1)+_0x108ca8[_0xe1206c(0x219)]),await handleSingleObjectOutput(_0x108ca8,_0x21cce6),0x0;}}export class ConnectionSchemaCommand extends BaseCommand{[a13_0x10c2ba(0x219)]=a13_0x10c2ba(0x22e);['description']=a13_0x10c2ba(0x21a);[a13_0x10c2ba(0x1e0)](_0x5ae7af){const _0x5d17fd=a13_0x10c2ba,{args:_0x160c95}=_0x5ae7af;if(!_0x160c95[0x0])return _0x5d17fd(0x1f2);return undefined;}async[a13_0x10c2ba(0x1ea)](_0x4d147a){const _0x3b9ec6=a13_0x10c2ba,{options:_0x1839f1,args:_0x41d8d5,tdx:_0x41186d}=_0x4d147a,_0x5af24d=_0x41d8d5[0x0];_0x1839f1[_0x3b9ec6(0x22d)]&&(console[_0x3b9ec6(0x205)](_0x3b9ec6(0x1fb)+_0x1839f1['site']),console[_0x3b9ec6(0x205)](_0x3b9ec6(0x226)+_0x5af24d));let _0x37a8cd=_0x5af24d,_0x886bc8;try{const _0x358bb1=await _0x41186d[_0x3b9ec6(0x208)][_0x3b9ec6(0x1df)](_0x5af24d);_0x358bb1&&(_0x37a8cd=_0x358bb1[_0x3b9ec6(0x1ee)],_0x886bc8=_0x358bb1[_0x3b9ec6(0x219)],_0x1839f1[_0x3b9ec6(0x22d)]&&console[_0x3b9ec6(0x205)](_0x3b9ec6(0x220)+_0x5af24d+_0x3b9ec6(0x223)+_0x37a8cd));}catch{_0x1839f1[_0x3b9ec6(0x22d)]&&console['error'](_0x3b9ec6(0x225)+_0x5af24d+'\x27\x20as\x20connector\x20type');}const _0x4415f0=await withSpinner(_0x3b9ec6(0x1d0)+_0x37a8cd+'\x27...',()=>_0x41186d[_0x3b9ec6(0x208)][_0x3b9ec6(0x211)](_0x37a8cd),{'verbose':_0x1839f1['verbose']}),_0x545a9d=_0x4415f0['data'];_0x886bc8?console[_0x3b9ec6(0x205)]('✔\x20Found\x20schema\x20for\x20connection\x20\x27'+_0x886bc8+'\x27\x20(type:\x20'+_0x37a8cd+')'):console[_0x3b9ec6(0x205)](_0x3b9ec6(0x22b)+_0x37a8cd);if(isStructuredFormat(_0x1839f1))await handleSingleObjectOutput(_0x545a9d,_0x1839f1);else{const _0x3c870b=normalizeSchemaForDisplay(_0x545a9d);_0x886bc8?(console[_0x3b9ec6(0x22c)]('\x0aConnection:\x20'+a13_0x5408cd['cyan'](_0x886bc8)),console[_0x3b9ec6(0x22c)](_0x3b9ec6(0x20b)+a13_0x5408cd[_0x3b9ec6(0x1de)](_0x37a8cd))):console[_0x3b9ec6(0x22c)](_0x3b9ec6(0x1d9)+a13_0x5408cd[_0x3b9ec6(0x1fe)](_0x37a8cd)),_0x3c870b[_0x3b9ec6(0x21e)]>0x0?(console[_0x3b9ec6(0x22c)](a13_0x5408cd['bold'](_0x3b9ec6(0x222))),printSchemaFields(_0x3c870b,0x0)):console[_0x3b9ec6(0x22c)](a13_0x5408cd[_0x3b9ec6(0x1de)](_0x3b9ec6(0x227)));}return 0x0;}}export class ConnectionTypesCommand extends BaseCommand{[a13_0x10c2ba(0x219)]='connection:types';[a13_0x10c2ba(0x1e9)]=a13_0x10c2ba(0x1d4);async[a13_0x10c2ba(0x1ea)](_0x5b3793){const _0x336bde=a13_0x10c2ba,{options:_0x3031d9,tdx:_0x109fc9}=_0x5b3793;_0x3031d9['verbose']&&console['error'](_0x336bde(0x1fb)+_0x3031d9[_0x336bde(0x224)]);const _0x5870a8=await withSpinner(_0x336bde(0x1e7),()=>_0x109fc9[_0x336bde(0x208)][_0x336bde(0x201)](),{'verbose':_0x3031d9[_0x336bde(0x22d)]}),_0x48e219=_0x5870a8[_0x336bde(0x1fa)]['sort']((_0xc610e,_0xc8b2e)=>_0xc610e[_0x336bde(0x1ee)][_0x336bde(0x1ca)](_0xc8b2e[_0x336bde(0x1ee)]));console[_0x336bde(0x205)](_0x336bde(0x1fd)+_0x48e219['length']+'\x20connector\x20type'+(_0x48e219[_0x336bde(0x21e)]!==0x1?'s':''));if(isStructuredFormat(_0x3031d9))await handleSDKOutput(_0x48e219,_0x3031d9);else{const _0x4a3ff7=_0x48e219[_0x336bde(0x21e)]>0x0?Math['max'](..._0x48e219[_0x336bde(0x1eb)](_0x23f60f=>_0x23f60f['type'][_0x336bde(0x21e)])):0x0,_0x564512=[];for(const _0x2545fa of _0x48e219){const _0xca102d=a13_0x5408cd[_0x336bde(0x1fe)](_0x2545fa[_0x336bde(0x1ee)][_0x336bde(0x1ec)](_0x4a3ff7));_0x564512[_0x336bde(0x1e6)](_0xca102d+'\x20\x20'+_0x2545fa['name']);}await writeOutput(_0x564512['join']('\x0a'),_0x3031d9['output'],_0x336bde(0x1f1));}return 0x0;}}function a13_0x207b(_0x3d422f,_0x53afd1){_0x3d422f=_0x3d422f-0x1c9;const _0x1719a6=a13_0x1719();let _0x207b74=_0x1719a6[_0x3d422f];return _0x207b74;}export class ConnectionSettingsCommand extends BaseCommand{[a13_0x10c2ba(0x219)]=a13_0x10c2ba(0x1f4);[a13_0x10c2ba(0x1e9)]=a13_0x10c2ba(0x230);[a13_0x10c2ba(0x1e0)](_0x17754a){const _0x291dcd=a13_0x10c2ba,{args:_0x8e0e29}=_0x17754a;if(!_0x8e0e29[0x0])return _0x291dcd(0x20d);return undefined;}async[a13_0x10c2ba(0x1ea)](_0x1aa541){const _0x4acbd3=a13_0x10c2ba,{options:_0x4758d1,args:_0x24a6b5,tdx:_0x16af77}=_0x1aa541,_0x409659=_0x24a6b5[0x0];_0x4758d1[_0x4acbd3(0x22d)]&&(console[_0x4acbd3(0x205)](_0x4acbd3(0x1fb)+_0x4758d1[_0x4acbd3(0x224)]),console[_0x4acbd3(0x205)](_0x4acbd3(0x20a)+_0x409659));const _0x385472=await withSpinner(_0x4acbd3(0x216)+_0x409659+_0x4acbd3(0x22a),()=>_0x16af77['connection']['getMetadata'](_0x409659),{'verbose':_0x4758d1['verbose']}),_0x233617=_0x385472['data'];console['error']('✔\x20Found\x20settings\x20for\x20connector\x20type:\x20'+_0x409659);if(isStructuredFormat(_0x4758d1))await handleSingleObjectOutput(_0x233617,_0x4758d1);else{console[_0x4acbd3(0x22c)](_0x4acbd3(0x1d9)+a13_0x5408cd[_0x4acbd3(0x1fe)](_0x409659)),console['log'](_0x4acbd3(0x1e5)+_0x233617[_0x4acbd3(0x219)]);const _0x3c6e4d=_0x233617[_0x4acbd3(0x1d7)]||[],_0x2fd6cd=_0x3c6e4d[_0x4acbd3(0x228)](_0xe001e1=>_0xe001e1[_0x4acbd3(0x218)]);_0x2fd6cd[_0x4acbd3(0x21e)]>0x0&&(console[_0x4acbd3(0x22c)](a13_0x5408cd[_0x4acbd3(0x1d1)](_0x4acbd3(0x1dc))),printMetadataSettings(_0x2fd6cd));let _0x557b68=![];try{const _0x54e50e=await _0x16af77[_0x4acbd3(0x208)][_0x4acbd3(0x211)](_0x409659),_0x5479ad=normalizeSchemaForDisplay(_0x54e50e);_0x5479ad[_0x4acbd3(0x21e)]>0x0&&(console['log'](a13_0x5408cd['bold'](_0x4acbd3(0x222))),printSchemaFields(_0x5479ad,0x0),_0x557b68=!![]);}catch{const _0x4b84c9=_0x3c6e4d['filter'](_0x3b06ba=>!_0x3b06ba['credential']);_0x4b84c9[_0x4acbd3(0x21e)]>0x0&&(console[_0x4acbd3(0x22c)](a13_0x5408cd['bold'](_0x4acbd3(0x222))),printMetadataSettings(_0x4b84c9),_0x557b68=!![]);}!_0x557b68&&_0x4758d1[_0x4acbd3(0x22d)]&&console[_0x4acbd3(0x205)](a13_0x5408cd['dim'](_0x4acbd3(0x213))),_0x2fd6cd['length']===0x0&&console['log'](a13_0x5408cd[_0x4acbd3(0x1de)]('\x0aNo\x20credential\x20settings\x20defined'));}return 0x0;}}function printMetadataSettings(_0x30fe6b){const _0x4d4134=a13_0x10c2ba;for(const _0x541af2 of _0x30fe6b){if(!_0x541af2[_0x4d4134(0x219)])continue;if(_0x541af2[_0x4d4134(0x200)])continue;let _0x3fb3f0='\x20\x20'+a13_0x5408cd[_0x4d4134(0x21c)](_0x541af2[_0x4d4134(0x219)]);_0x541af2[_0x4d4134(0x1d2)]&&(_0x3fb3f0+=':\x20'+_0x541af2[_0x4d4134(0x1d2)]);_0x541af2[_0x4d4134(0x1ee)]&&(_0x3fb3f0+=a13_0x5408cd[_0x4d4134(0x1de)]('\x20['+_0x541af2['type']+']'));console[_0x4d4134(0x22c)](_0x3fb3f0);_0x541af2[_0x4d4134(0x1ef)]&&console['log']('\x20\x20\x20\x20'+a13_0x5408cd[_0x4d4134(0x1de)](_0x541af2[_0x4d4134(0x1ef)]));if(_0x541af2['options']){const _0x35bb4c=_0x541af2[_0x4d4134(0x229)][_0x4d4134(0x1eb)](_0x1dbda9=>_0x1dbda9[_0x4d4134(0x203)])['join'](',\x20');console[_0x4d4134(0x22c)](_0x4d4134(0x232)+a13_0x5408cd[_0x4d4134(0x209)](_0x35bb4c));}_0x541af2[_0x4d4134(0x212)]!==undefined&&_0x541af2['default_value']!==null&&console[_0x4d4134(0x22c)](_0x4d4134(0x21f)+a13_0x5408cd[_0x4d4134(0x1f5)](String(_0x541af2[_0x4d4134(0x212)])));if(_0x541af2[_0x4d4134(0x22f)]){const _0x4bb70a=Object[_0x4d4134(0x204)](_0x541af2[_0x4d4134(0x22f)])['map'](([_0x21157d,_0x2202ad])=>_0x21157d+'='+JSON[_0x4d4134(0x217)](_0x2202ad))['join'](',\x20');console[_0x4d4134(0x22c)](_0x4d4134(0x1e4)+a13_0x5408cd[_0x4d4134(0x1de)](_0x4d4134(0x1cd)+_0x4bb70a));}}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a14_0x5bf343=a14_0x435a;function a14_0x435a(_0x685128,_0x1f4b20){_0x685128=_0x685128-0x1d7;const _0x4d4aa7=a14_0x4d4a();let _0x435a86=_0x4d4aa7[_0x685128];return _0x435a86;}(function(_0xc3e09f,_0x283f9b){const _0x1bf133=a14_0x435a,_0xf55ff=_0xc3e09f();while(!![]){try{const _0x390012=-parseInt(_0x1bf133(0x1d8))/0x1*(parseInt(_0x1bf133(0x1ea))/0x2)+-parseInt(_0x1bf133(0x1e9))/0x3+-parseInt(_0x1bf133(0x1ed))/0x4*(parseInt(_0x1bf133(0x1ec))/0x5)+parseInt(_0x1bf133(0x1f1))/0x6*(parseInt(_0x1bf133(0x1d7))/0x7)+-parseInt(_0x1bf133(0x1e2))/0x8+parseInt(_0x1bf133(0x1eb))/0x9*(-parseInt(_0x1bf133(0x1e1))/0xa)+parseInt(_0x1bf133(0x1e3))/0xb;if(_0x390012===_0x283f9b)break;else _0xf55ff['push'](_0xf55ff['shift']());}catch(_0xec9062){_0xf55ff['push'](_0xf55ff['shift']());}}}(a14_0x4d4a,0x9b0ab));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';import{handleSDKOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';function a14_0x4d4a(){const _0x2d15d0=['548APhnZl','Listing\x20databases...','verbose','List\x20all\x20databases','14340aCtapS','length','\x20\x20Cause:\x20','889qThzuk','1286WvIlNO','execute','✔\x20Found\x20','Error:\x20','message','name','site','listDatabases','data','10WNIIAn','1392000npWJpw','50750194uMOrvH','Site:\x20','description','error','cause','\x20database','2887857tgDsVr','1174PLfaXc','10558017FWuxWW','44435JhMhHt'];a14_0x4d4a=function(){return _0x2d15d0;};return a14_0x4d4a();}import{DEFAULT_LISTING_LIMIT,resolveLimit}from'../core/constants.js';export class DatabasesCommand extends BaseCommand{[a14_0x5bf343(0x1dd)]='databases';[a14_0x5bf343(0x1e5)]=a14_0x5bf343(0x1f0);async[a14_0x5bf343(0x1d9)](_0x5cac80){const _0x419174=a14_0x5bf343,{options:_0x111fe5,args:_0x3c0feb,tdx:_0x773391}=_0x5cac80,_0x30acc1=_0x3c0feb[0x0];try{_0x111fe5['verbose']&&(console[_0x419174(0x1e6)](_0x419174(0x1e4)+_0x111fe5[_0x419174(0x1de)]),_0x30acc1&&console[_0x419174(0x1e6)]('Pattern:\x20'+_0x30acc1));const _0x418e6f=resolveLimit(_0x111fe5['limit'],DEFAULT_LISTING_LIMIT),_0x3186d7=await withSpinner(_0x419174(0x1ee),()=>_0x773391['query'][_0x419174(0x1df)](_0x30acc1,_0x418e6f),{'verbose':_0x111fe5[_0x419174(0x1ef)]}),_0x725454=_0x3186d7[_0x419174(0x1e0)];return console['error'](_0x419174(0x1da)+_0x725454[_0x419174(0x1f2)]+_0x419174(0x1e8)+(_0x725454['length']!==0x1?'s':'')),await handleSDKOutput(_0x725454,{..._0x111fe5,'limit':_0x418e6f}),0x0;}catch(_0x4dea7f){if(_0x4dea7f instanceof SDKError)return console[_0x419174(0x1e6)](_0x419174(0x1db)+_0x4dea7f[_0x419174(0x1dc)]),_0x4dea7f['cause']&&console['error'](_0x419174(0x1f3)+_0x4dea7f[_0x419174(0x1e7)]),0x1;throw _0x4dea7f;}}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a15_0x312b18=a15_0x68c2;function a15_0x1c67(){const _0x64723b=['name','80gOrCaK','verbose','Error:\x20','95814sMvQbs','✖\x20Table\x20not\x20found','130JTLFuj','561038ygYxbV','length','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','Table:\x20','error','validate','cause','1579920gSydTf','Describing\x20table\x20','36152mjAvyQ','execute','Describe\x20table\x20schema','table','Table\x20\x27','database','\x20in\x20','4566723DimglS','Database:\x20','describeTable','query','description','message','98005jJUmjY','1675509SAsHZg','\x27\x20does\x20not\x20exist','348gbrmnK','describe','369CcPKHV','\x20column','args'];a15_0x1c67=function(){return _0x64723b;};return a15_0x1c67();}(function(_0x43b3f0,_0x2a3ffc){const _0x1a6b8d=a15_0x68c2,_0x3f7c22=_0x43b3f0();while(!![]){try{const _0x4c2fa4=parseInt(_0x1a6b8d(0x19b))/0x1+parseInt(_0x1a6b8d(0x1a2))/0x2+-parseInt(_0x1a6b8d(0x198))/0x3*(parseInt(_0x1a6b8d(0x195))/0x4)+parseInt(_0x1a6b8d(0x1b1))/0x5*(-parseInt(_0x1a6b8d(0x1b4))/0x6)+-parseInt(_0x1a6b8d(0x1ab))/0x7+parseInt(_0x1a6b8d(0x1a4))/0x8*(-parseInt(_0x1a6b8d(0x1b6))/0x9)+parseInt(_0x1a6b8d(0x19a))/0xa*(parseInt(_0x1a6b8d(0x1b2))/0xb);if(_0x4c2fa4===_0x2a3ffc)break;else _0x3f7c22['push'](_0x3f7c22['shift']());}catch(_0x499550){_0x3f7c22['push'](_0x3f7c22['shift']());}}}(a15_0x1c67,0xaf423));import{BaseCommand}from'./command.js';function a15_0x68c2(_0xfbdd06,_0x3a26b5){_0xfbdd06=_0xfbdd06-0x195;const _0x1c67fa=a15_0x1c67();let _0x68c256=_0x1c67fa[_0xfbdd06];return _0x68c256;}import{SDKError}from'../sdk/index.js';import{handleSDKOutput}from'../core/command-output.js';import{parseTableReference,validateTableDescribeReference}from'../utils/table-ref-parser.js';import{withSpinner}from'../utils/spinner.js';export class DescribeCommand extends BaseCommand{[a15_0x312b18(0x1b9)]=a15_0x312b18(0x1b5);[a15_0x312b18(0x1af)]=a15_0x312b18(0x1a6);async[a15_0x312b18(0x1a5)](_0x382ddb){const _0x54f047=a15_0x312b18;return this[_0x54f047(0x1ad)](_0x382ddb);}async[a15_0x312b18(0x1ad)](_0x3e30dd){const _0x4b6be5=a15_0x312b18,{options:_0x132578,args:_0x339216,tdx:_0xc0a3f6}=_0x3e30dd;let _0x3846c7;try{_0x3846c7=parseTableReference(_0x339216[0x0]);const _0xbdfab6=_0x132578[_0x4b6be5(0x1a9)];!_0x3846c7['database']&&_0xbdfab6&&(_0x3846c7[_0x4b6be5(0x1a9)]=_0xbdfab6);const _0x1c48d5=validateTableDescribeReference(_0x3846c7);if(_0x1c48d5)return console[_0x4b6be5(0x19f)](_0x4b6be5(0x197)+_0x1c48d5),0x1;}catch(_0x1a9f85){return console[_0x4b6be5(0x19f)](_0x4b6be5(0x197)+_0x1a9f85['message']),0x1;}const _0x4a0dfb=_0x3846c7[_0x4b6be5(0x1a9)],_0x5f48c9=_0x3846c7[_0x4b6be5(0x1a7)];try{_0x132578[_0x4b6be5(0x196)]&&(console[_0x4b6be5(0x19f)]('Site:\x20'+_0x132578['site']),console['error'](_0x4b6be5(0x1ac)+_0x4a0dfb),console[_0x4b6be5(0x19f)](_0x4b6be5(0x19e)+_0x5f48c9));const _0x46960f=await withSpinner(_0x4b6be5(0x1a3)+_0x4a0dfb+'.'+_0x5f48c9+'...',()=>_0xc0a3f6[_0x4b6be5(0x1ae)]['describeTable'](_0x4a0dfb,_0x5f48c9),{'verbose':_0x132578[_0x4b6be5(0x196)]}),_0x4b8a81=_0x46960f['data'];if(_0x4b8a81[_0x4b6be5(0x19c)]===0x0)return console[_0x4b6be5(0x19f)](_0x4b6be5(0x199)),console['error'](_0x4b6be5(0x1a8)+_0x4a0dfb+'.'+_0x5f48c9+_0x4b6be5(0x1b3)),0x1;return console[_0x4b6be5(0x19f)]('✔\x20Found\x20'+_0x4b8a81['length']+_0x4b6be5(0x1b7)+(_0x4b8a81[_0x4b6be5(0x19c)]!==0x1?'s':'')+_0x4b6be5(0x1aa)+_0x4a0dfb+'.'+_0x5f48c9),await handleSDKOutput(_0x4b8a81,_0x132578),0x0;}catch(_0x5dfd75){if(_0x5dfd75 instanceof SDKError)return console[_0x4b6be5(0x19f)](_0x4b6be5(0x197)+_0x5dfd75[_0x4b6be5(0x1b0)]),_0x5dfd75[_0x4b6be5(0x1a1)]&&console['error']('\x20\x20Cause:\x20'+_0x5dfd75['cause']),0x1;throw _0x5dfd75;}}[a15_0x312b18(0x1a0)](_0xe56b6a){const _0x591356=a15_0x312b18;if(_0xe56b6a['args'][_0x591356(0x19c)]===0x0)return'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';if(_0xe56b6a[_0x591356(0x1b8)][_0x591356(0x19c)]>0x1)return _0x591356(0x19d);return undefined;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a16_0x4bae31=a16_0x2123;(function(_0x4441fe,_0x435532){const _0xb8441d=a16_0x2123,_0x1f447b=_0x4441fe();while(!![]){try{const _0x1baca7=parseInt(_0xb8441d(0x1de))/0x1*(-parseInt(_0xb8441d(0x1bb))/0x2)+parseInt(_0xb8441d(0x22e))/0x3*(parseInt(_0xb8441d(0x1c1))/0x4)+parseInt(_0xb8441d(0x1d7))/0x5*(parseInt(_0xb8441d(0x220))/0x6)+-parseInt(_0xb8441d(0x230))/0x7*(parseInt(_0xb8441d(0x1ef))/0x8)+-parseInt(_0xb8441d(0x224))/0x9*(-parseInt(_0xb8441d(0x20d))/0xa)+-parseInt(_0xb8441d(0x1f2))/0xb*(parseInt(_0xb8441d(0x247))/0xc)+parseInt(_0xb8441d(0x20a))/0xd;if(_0x1baca7===_0x435532)break;else _0x1f447b['push'](_0x1f447b['shift']());}catch(_0x3ebd3f){_0x1f447b['push'](_0x1f447b['shift']());}}}(a16_0x23de,0x8bc84));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(_0x598726,_0x5106d6,_0xab8155=![]){const _0x264609=a16_0x2123;if(_0x598726[_0x264609(0x21e)])return await _0x5106d6[_0x264609(0x22b)]['resolveWorkspaceId'](_0x598726[_0x264609(0x21e)]);const _0x238ceb=loadSessionContext(_0x598726[_0x264609(0x204)]);if(_0x238ceb?.['engage_workspace'])return await _0x5106d6[_0x264609(0x22b)]['resolveWorkspaceId'](_0x238ceb[_0x264609(0x21d)]);if(_0xab8155)throw new SDKError(ErrorCode[_0x264609(0x203)],_0x264609(0x1bd),undefined,{'helpText':_0x264609(0x23b)});return undefined;}async function resolveSegmentFromOptions(_0xf67bc7,_0xdaff6c){const _0x1c446f=a16_0x2123;if(!_0xf67bc7[_0x1c446f(0x1d5)])return{};const _0x10357c=_0xf67bc7[_0x1c446f(0x1d5)],_0x4471a=await _0xdaff6c[_0x1c446f(0x1d5)]['resolvePathToResource'](_0x10357c);return{'audienceId':_0x4471a[_0x1c446f(0x1f3)],'audienceName':_0x4471a[_0x1c446f(0x1fc)],..._0x4471a[_0x1c446f(0x242)]&&{'segmentId':_0x4471a['segmentId'],'segmentName':_0x4471a[_0x1c446f(0x210)]}};}function buildConnectorConfig(_0xe5151){const _0x13fab3=a16_0x2123,_0x30557e=_0xe5151['emailSenderId'],_0x8428f9=_0xe5151[_0x13fab3(0x249)];if(!_0x30557e&&!_0x8428f9)return undefined;return{..._0x30557e&&{'emailSenderId':_0x30557e},..._0x8428f9&&{'jsonColumns':_0x8428f9}};}export class EngageCampaignsCommand extends BaseCommand{['name']='engage:campaigns';[a16_0x4bae31(0x1f6)]='List\x20campaigns';async['execute'](_0xfe01a6){const _0x1969bf=a16_0x4bae31,{options:_0x41adcd,args:_0xea8bcc,tdx:_0x207a81}=_0xfe01a6,_0x4c0562=_0xea8bcc[0x0],_0x150f2f=resolveLimit(_0x41adcd[_0x1969bf(0x22a)],DEFAULT_LLM_LIMIT),_0x5e7f5b=_0x41adcd,_0x367f8b=_0x5e7f5b[_0x1969bf(0x1d2)],_0x55c4b0=_0x5e7f5b[_0x1969bf(0x21a)],_0x260135=await resolveWorkspaceIdFromOptions(_0x5e7f5b,_0x207a81),_0x42fde5=await withSpinner(_0x1969bf(0x222),()=>_0x207a81['engage'][_0x1969bf(0x1cf)]({'type':_0x367f8b,'status':_0x55c4b0,'workspaceId':_0x260135,'limit':_0x150f2f}),{'verbose':_0x41adcd[_0x1969bf(0x1ee)]});let _0x29501c=_0x42fde5['data'];return _0x4c0562&&(_0x29501c=_0x42fde5['data'][_0x1969bf(0x20c)](_0x43c31a=>matchGlobPattern(_0x43c31a[_0x1969bf(0x1e4)],_0x4c0562))),await handleSDKOutput(_0x29501c,_0x41adcd),0x0;}}export class EngageCampaignShowCommand extends BaseCommand{[a16_0x4bae31(0x1e4)]='engage:campaign:show';['description']=a16_0x4bae31(0x21f);async[a16_0x4bae31(0x1ec)](_0x23b32b){const _0x1378a6=a16_0x4bae31,{options:_0x3d1e57,args:_0x19ca67,tdx:_0x1d1d80}=_0x23b32b;if(_0x19ca67[_0x1378a6(0x1ba)]===0x0)return console[_0x1378a6(0x1dd)](_0x1378a6(0x20e)),console[_0x1378a6(0x1dd)]('Usage:\x20tdx\x20engage\x20campaign\x20show\x20<name-or-id>'),0x1;const _0x4e778c=_0x19ca67[0x0],_0xeceacd=_0x3d1e57,_0x31c16a=await resolveWorkspaceIdFromOptions(_0xeceacd,_0x1d1d80),_0x145ece=_0xeceacd[_0x1378a6(0x1e9)];if(_0x145ece){const _0x522de2=await withSpinner('Fetching\x20campaign\x20\x27'+_0x4e778c+_0x1378a6(0x24b),()=>_0x1d1d80[_0x1378a6(0x22b)][_0x1378a6(0x206)](_0x4e778c,_0x31c16a),{'verbose':_0x3d1e57[_0x1378a6(0x1ee)]});await handleSDKOutput([_0x522de2],_0x3d1e57);}else{const _0x3c2d34=await withSpinner('Fetching\x20campaign\x20\x27'+_0x4e778c+_0x1378a6(0x24b),()=>_0x1d1d80[_0x1378a6(0x22b)][_0x1378a6(0x1cc)](_0x4e778c,_0x31c16a),{'verbose':_0x3d1e57[_0x1378a6(0x1ee)]});await handleSDKOutput([_0x3c2d34],_0x3d1e57);}return 0x0;}}export class EngageCampaignCreateCommand extends BaseCommand{['name']=a16_0x4bae31(0x237);[a16_0x4bae31(0x1f6)]=a16_0x4bae31(0x1b9);async[a16_0x4bae31(0x1ec)](_0x276056){const _0x22ffa6=a16_0x4bae31,{options:_0x2be7ba,tdx:_0x45cd82}=_0x276056,_0x246c25=_0x2be7ba,_0xd83735=_0x246c25[_0x22ffa6(0x1e4)],_0x31adb8=_0x246c25[_0x22ffa6(0x1d2)];if(!_0xd83735)return console[_0x22ffa6(0x1dd)](_0x22ffa6(0x1db)),console[_0x22ffa6(0x1dd)]('Usage:\x20tdx\x20engage\x20campaign\x20create\x20--name\x20<name>\x20--type\x20<email|push>'),0x1;if(!_0x31adb8)return console['error'](_0x22ffa6(0x1fd)),console[_0x22ffa6(0x1dd)](_0x22ffa6(0x1d6)),0x1;const _0x3adea0=await resolveWorkspaceIdFromOptions(_0x246c25,_0x45cd82,!![]),_0x1e4f7f=await resolveSegmentFromOptions(_0x246c25,_0x45cd82),_0x47296b=buildConnectorConfig(_0x246c25),_0x509d12={'name':_0xd83735,'campaignType':_0x31adb8,'workspaceId':_0x3adea0,'description':_0x246c25[_0x22ffa6(0x1f6)],..._0x1e4f7f,'connectorConfig':_0x47296b,'startAt':_0x246c25[_0x22ffa6(0x1e1)],'timezone':_0x246c25[_0x22ffa6(0x1eb)]},_0x5adb6b=await withSpinner(_0x22ffa6(0x1c8)+_0xd83735+_0x22ffa6(0x24b),()=>_0x45cd82[_0x22ffa6(0x22b)]['createCampaign'](_0x509d12));return await handleSDKOutput([_0x5adb6b['data']],_0x2be7ba),0x0;}}export class EngageCampaignUpdateCommand extends BaseCommand{[a16_0x4bae31(0x1e4)]=a16_0x4bae31(0x23a);[a16_0x4bae31(0x1f6)]=a16_0x4bae31(0x1fe);async[a16_0x4bae31(0x1ec)](_0x136a45){const _0x579ce1=a16_0x4bae31,{options:_0x42e8b5,args:_0x289d09,tdx:_0x4d341b}=_0x136a45;if(_0x289d09[_0x579ce1(0x1ba)]===0x0)return console[_0x579ce1(0x1dd)](_0x579ce1(0x20e)),console['error'](_0x579ce1(0x213)),0x1;const _0x21edc5=_0x289d09[0x0],_0x54bdc6=_0x42e8b5,_0x4e7223=await resolveWorkspaceIdFromOptions(_0x54bdc6,_0x4d341b),_0x3f01b0=await resolveSegmentFromOptions(_0x54bdc6,_0x4d341b),_0xc0af1f=buildConnectorConfig(_0x54bdc6),_0x45c726={'name':_0x54bdc6[_0x579ce1(0x1e4)],'description':_0x54bdc6[_0x579ce1(0x1f6)],..._0x3f01b0,'connectorConfig':_0xc0af1f,'startAt':_0x54bdc6[_0x579ce1(0x1e1)],'timezone':_0x54bdc6['timezone']},_0x57bf26=Object[_0x579ce1(0x24d)](Object[_0x579ce1(0x1f5)](_0x45c726)[_0x579ce1(0x20c)](([,_0x2d2dec])=>_0x2d2dec!==undefined));if(Object[_0x579ce1(0x23c)](_0x57bf26)['length']===0x0)return console[_0x579ce1(0x1dd)](_0x579ce1(0x238)),console['error'](_0x579ce1(0x20f)),0x1;const _0x54f06c=await withSpinner(_0x579ce1(0x1c3)+_0x21edc5+_0x579ce1(0x24b),()=>_0x4d341b[_0x579ce1(0x22b)][_0x579ce1(0x1bf)](_0x21edc5,_0x57bf26,_0x4e7223),{'verbose':_0x42e8b5['verbose']});return await handleSDKOutput([_0x54f06c[_0x579ce1(0x1cd)]],_0x42e8b5),0x0;}}export class EngageCampaignDeleteCommand extends BaseCommand{[a16_0x4bae31(0x1e4)]=a16_0x4bae31(0x20b);[a16_0x4bae31(0x1f6)]=a16_0x4bae31(0x1d0);async['execute'](_0x30bf30){const _0x2ca3b3=a16_0x4bae31,{options:_0x4f9abc,args:_0x2701c8,tdx:_0x192367}=_0x30bf30;if(_0x2701c8['length']===0x0)return console['error'](_0x2ca3b3(0x20e)),console[_0x2ca3b3(0x1dd)]('Usage:\x20tdx\x20engage\x20campaign\x20delete\x20<name-or-id>'),0x1;const _0x2638b0=_0x2701c8[0x0],_0x11113c=_0x4f9abc,_0x29a538=await resolveWorkspaceIdFromOptions(_0x11113c,_0x192367);if(!_0x4f9abc['yes']){const _0x343479=await confirm(_0x2ca3b3(0x201)+_0x2638b0+_0x2ca3b3(0x1e7));if(!_0x343479)return console['log']('Operation\x20cancelled'),0x0;}return await withSpinner(_0x2ca3b3(0x1f7)+_0x2638b0+'\x27...',()=>_0x192367[_0x2ca3b3(0x22b)]['deleteCampaign'](_0x2638b0,_0x29a538),{'verbose':_0x4f9abc[_0x2ca3b3(0x1ee)]}),console[_0x2ca3b3(0x1c7)](_0x2ca3b3(0x227)+_0x2638b0+_0x2ca3b3(0x1e2)),0x0;}}export class EngageCampaignLaunchCommand extends BaseCommand{[a16_0x4bae31(0x1e4)]='engage:campaign:launch';['description']=a16_0x4bae31(0x235);async[a16_0x4bae31(0x1ec)](_0x67a20c){const _0x47c5d0=a16_0x4bae31,{options:_0x2b0566,args:_0x18fd57,tdx:_0x1075cc}=_0x67a20c;if(_0x18fd57[_0x47c5d0(0x1ba)]===0x0)return console[_0x47c5d0(0x1dd)](_0x47c5d0(0x20e)),console[_0x47c5d0(0x1dd)](_0x47c5d0(0x1d1)),0x1;const _0x2b88ba=_0x18fd57[0x0],_0xb48659=_0x2b0566,_0x3561f7=await resolveWorkspaceIdFromOptions(_0xb48659,_0x1075cc);return await withSpinner(_0x47c5d0(0x200)+_0x2b88ba+_0x47c5d0(0x24b),()=>_0x1075cc[_0x47c5d0(0x22b)]['launchCampaign'](_0x2b88ba,_0x3561f7),{'verbose':_0x2b0566[_0x47c5d0(0x1ee)]}),console[_0x47c5d0(0x1c7)](_0x47c5d0(0x227)+_0x2b88ba+_0x47c5d0(0x1dc)),0x0;}}export class EngageCampaignPauseCommand extends BaseCommand{['name']=a16_0x4bae31(0x1e5);[a16_0x4bae31(0x1f6)]=a16_0x4bae31(0x1d4);async['execute'](_0x3d8f1d){const _0x465faf=a16_0x4bae31,{options:_0x53850b,args:_0xcd30f0,tdx:_0x165f21}=_0x3d8f1d;if(_0xcd30f0[_0x465faf(0x1ba)]===0x0)return console['error']('Error:\x20Campaign\x20name\x20or\x20ID\x20is\x20required'),console[_0x465faf(0x1dd)](_0x465faf(0x248)),0x1;const _0x212ae5=_0xcd30f0[0x0],_0x82d74a=_0x53850b,_0x50e9e3=await resolveWorkspaceIdFromOptions(_0x82d74a,_0x165f21);return await withSpinner(_0x465faf(0x1d9)+_0x212ae5+_0x465faf(0x24b),()=>_0x165f21['engage'][_0x465faf(0x1cb)](_0x212ae5,_0x50e9e3),{'verbose':_0x53850b[_0x465faf(0x1ee)]}),console['log'](_0x465faf(0x227)+_0x212ae5+_0x465faf(0x207)),0x0;}}export class EngageCampaignResumeCommand extends BaseCommand{[a16_0x4bae31(0x1e4)]=a16_0x4bae31(0x1e0);[a16_0x4bae31(0x1f6)]='Resume\x20a\x20paused\x20campaign';async[a16_0x4bae31(0x1ec)](_0x3baa43){const _0x3390d7=a16_0x4bae31,{options:_0x173e00,args:_0x5f2b77,tdx:_0x519c5e}=_0x3baa43;if(_0x5f2b77[_0x3390d7(0x1ba)]===0x0)return console[_0x3390d7(0x1dd)](_0x3390d7(0x20e)),console[_0x3390d7(0x1dd)](_0x3390d7(0x231)),0x1;const _0xa667f3=_0x5f2b77[0x0],_0x2ad190=_0x173e00,_0x2eef52=await resolveWorkspaceIdFromOptions(_0x2ad190,_0x519c5e);return await withSpinner('Resuming\x20campaign\x20\x27'+_0xa667f3+_0x3390d7(0x24b),()=>_0x519c5e['engage']['resumeCampaign'](_0xa667f3,_0x2eef52),{'verbose':_0x173e00[_0x3390d7(0x1ee)]}),console[_0x3390d7(0x1c7)](_0x3390d7(0x227)+_0xa667f3+_0x3390d7(0x1c4)),0x0;}}export class EngageCampaignDuplicateCommand extends BaseCommand{[a16_0x4bae31(0x1e4)]=a16_0x4bae31(0x1f0);['description']=a16_0x4bae31(0x244);async['execute'](_0x1949f2){const _0x1b9370=a16_0x4bae31,{options:_0x48410b,args:_0x4e14fe,tdx:_0x5a0e64}=_0x1949f2;if(_0x4e14fe[_0x1b9370(0x1ba)]===0x0)return console['error'](_0x1b9370(0x20e)),console[_0x1b9370(0x1dd)](_0x1b9370(0x229)),0x1;const _0x2386a1=_0x4e14fe[0x0],_0x1b1278=_0x48410b,_0x19c603=await resolveWorkspaceIdFromOptions(_0x1b1278,_0x5a0e64),_0x57bea7=await withSpinner(_0x1b9370(0x215)+_0x2386a1+_0x1b9370(0x24b),()=>_0x5a0e64[_0x1b9370(0x22b)][_0x1b9370(0x219)](_0x2386a1,_0x19c603),{'verbose':_0x48410b[_0x1b9370(0x1ee)]});return await handleSDKOutput([_0x57bea7[_0x1b9370(0x1cd)]],_0x48410b),0x0;}}export class EngageTemplatesCommand extends BaseCommand{['name']=a16_0x4bae31(0x1ce);[a16_0x4bae31(0x1f6)]=a16_0x4bae31(0x1e3);async[a16_0x4bae31(0x1ec)](_0x2a030a){const _0x18ce15=a16_0x4bae31,{options:_0x549f05,args:_0x4822bb,tdx:_0x1a8e5c}=_0x2a030a,_0x194336=_0x4822bb[0x0],_0x481e83=resolveLimit(_0x549f05[_0x18ce15(0x22a)],DEFAULT_LLM_LIMIT),_0x13dad3=_0x549f05,_0x4da832=await resolveWorkspaceIdFromOptions(_0x13dad3,_0x1a8e5c),_0x1822a7=await withSpinner(_0x18ce15(0x1c9),()=>_0x1a8e5c[_0x18ce15(0x22b)][_0x18ce15(0x1e8)]({'workspaceId':_0x4da832,'limit':_0x481e83}),{'verbose':_0x549f05[_0x18ce15(0x1ee)]});let _0x4f32aa=_0x1822a7[_0x18ce15(0x1cd)];return _0x194336&&(_0x4f32aa=_0x1822a7[_0x18ce15(0x1cd)][_0x18ce15(0x20c)](_0x1aeea2=>matchGlobPattern(_0x1aeea2[_0x18ce15(0x1e4)],_0x194336))),await handleSDKOutput(_0x4f32aa,_0x549f05),0x0;}}export class EngageTemplateShowCommand extends BaseCommand{[a16_0x4bae31(0x1e4)]=a16_0x4bae31(0x1ed);[a16_0x4bae31(0x1f6)]=a16_0x4bae31(0x1ff);async['execute'](_0x399473){const _0x88c042=a16_0x4bae31,{options:_0x906ee0,args:_0x462111,tdx:_0x31d774}=_0x399473;if(_0x462111[_0x88c042(0x1ba)]===0x0)return console[_0x88c042(0x1dd)](_0x88c042(0x1f9)),console[_0x88c042(0x1dd)](_0x88c042(0x1be)),0x1;const _0x5dceb7=_0x462111[0x0],_0x4286a0=_0x906ee0,_0x1aa417=await resolveWorkspaceIdFromOptions(_0x4286a0,_0x31d774),_0x388dc6=_0x4286a0[_0x88c042(0x1e9)];if(_0x388dc6){const _0x53bb12=await withSpinner(_0x88c042(0x1c0)+_0x5dceb7+_0x88c042(0x24b),()=>_0x31d774[_0x88c042(0x22b)][_0x88c042(0x243)](_0x5dceb7,_0x1aa417),{'verbose':_0x906ee0['verbose']});await handleSDKOutput([_0x53bb12],_0x906ee0);}else{const _0x5cf8bf=await withSpinner(_0x88c042(0x1c0)+_0x5dceb7+_0x88c042(0x24b),()=>_0x31d774[_0x88c042(0x22b)][_0x88c042(0x240)](_0x5dceb7,_0x1aa417),{'verbose':_0x906ee0[_0x88c042(0x1ee)]});await handleSDKOutput([_0x5cf8bf],_0x906ee0);}return 0x0;}}export class EngageTemplateCreateCommand extends BaseCommand{['name']=a16_0x4bae31(0x245);['description']=a16_0x4bae31(0x1f1);async[a16_0x4bae31(0x1ec)](_0x555629){const _0x3aaada=a16_0x4bae31,{options:_0x33e37b,tdx:_0x3fd3f0}=_0x555629,_0x262d1a=_0x33e37b,_0x5273fe=_0x262d1a[_0x3aaada(0x1e4)],_0x2f052b=_0x262d1a[_0x3aaada(0x214)],_0x2af303=_0x262d1a['html'];if(!_0x5273fe)return console[_0x3aaada(0x1dd)](_0x3aaada(0x1db)),console['error'](_0x3aaada(0x1da)),0x1;if(!_0x2f052b)return console[_0x3aaada(0x1dd)](_0x3aaada(0x218)),0x1;if(!_0x2af303)return console[_0x3aaada(0x1dd)]('Error:\x20--html\x20is\x20required'),0x1;const _0x1d7670=await resolveWorkspaceIdFromOptions(_0x262d1a,_0x3fd3f0,!![]),_0x543851={'name':_0x5273fe,'subjectTemplate':_0x2f052b,'htmlTemplate':_0x2af303,'workspaceId':_0x1d7670,'plaintextTemplate':_0x262d1a[_0x3aaada(0x217)],'editorType':_0x262d1a[_0x3aaada(0x21b)]},_0x1ef72b=await withSpinner(_0x3aaada(0x1e6)+_0x5273fe+_0x3aaada(0x24b),()=>_0x3fd3f0[_0x3aaada(0x22b)]['createTemplate'](_0x543851));return await handleSDKOutput([_0x1ef72b[_0x3aaada(0x1cd)]],_0x33e37b),0x0;}}export class EngageTemplateUpdateCommand extends BaseCommand{['name']=a16_0x4bae31(0x1c6);['description']=a16_0x4bae31(0x208);async[a16_0x4bae31(0x1ec)](_0xfac0d1){const _0x437f84=a16_0x4bae31,{options:_0x37e870,args:_0x385b62,tdx:_0x5e1cb4}=_0xfac0d1;if(_0x385b62[_0x437f84(0x1ba)]===0x0)return console[_0x437f84(0x1dd)](_0x437f84(0x1f9)),console[_0x437f84(0x1dd)](_0x437f84(0x246)),0x1;const _0x3e47d9=_0x385b62[0x0],_0x3d88a3=_0x37e870,_0x44c044=await resolveWorkspaceIdFromOptions(_0x3d88a3,_0x5e1cb4),_0x1f81db={'name':_0x3d88a3[_0x437f84(0x1e4)],'subjectTemplate':_0x3d88a3['subject'],'htmlTemplate':_0x3d88a3[_0x437f84(0x1c2)],'plaintextTemplate':_0x3d88a3[_0x437f84(0x217)]},_0xefb353=Object[_0x437f84(0x24d)](Object[_0x437f84(0x1f5)](_0x1f81db)[_0x437f84(0x20c)](([,_0xc4b8bb])=>_0xc4b8bb!==undefined));if(Object[_0x437f84(0x23c)](_0xefb353)['length']===0x0)return console[_0x437f84(0x1dd)](_0x437f84(0x238)),console[_0x437f84(0x1dd)](_0x437f84(0x1fb)),0x1;const _0x40cc78=await withSpinner(_0x437f84(0x22d)+_0x3e47d9+_0x437f84(0x24b),()=>_0x5e1cb4[_0x437f84(0x22b)][_0x437f84(0x22c)](_0x3e47d9,_0xefb353,_0x44c044),{'verbose':_0x37e870[_0x437f84(0x1ee)]});return await handleSDKOutput([_0x40cc78[_0x437f84(0x1cd)]],_0x37e870),0x0;}}export class EngageTemplateDeleteCommand extends BaseCommand{['name']='engage:template:delete';[a16_0x4bae31(0x1f6)]='Delete\x20an\x20email\x20template';async[a16_0x4bae31(0x1ec)](_0x50bc5e){const _0x39ecdd=a16_0x4bae31,{options:_0x3cde21,args:_0x49013a,tdx:_0x1c5806}=_0x50bc5e;if(_0x49013a['length']===0x0)return console[_0x39ecdd(0x1dd)](_0x39ecdd(0x1f9)),console['error']('Usage:\x20tdx\x20engage\x20template\x20delete\x20<name-or-id>'),0x1;const _0x520f7c=_0x49013a[0x0],_0x1e4cac=_0x3cde21,_0xdcdc63=await resolveWorkspaceIdFromOptions(_0x1e4cac,_0x1c5806);if(!_0x3cde21['yes']){const _0x2b0245=await confirm('Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20template\x20\x27'+_0x520f7c+_0x39ecdd(0x1e7));if(!_0x2b0245)return console[_0x39ecdd(0x1c7)](_0x39ecdd(0x1bc)),0x0;}return await withSpinner(_0x39ecdd(0x23f)+_0x520f7c+_0x39ecdd(0x24b),()=>_0x1c5806[_0x39ecdd(0x22b)][_0x39ecdd(0x1ea)](_0x520f7c,_0xdcdc63),{'verbose':_0x3cde21[_0x39ecdd(0x1ee)]}),console[_0x39ecdd(0x1c7)]('Template\x20\x27'+_0x520f7c+'\x27\x20deleted\x20successfully'),0x0;}}export class EngageWorkspacesCommand extends BaseCommand{['name']=a16_0x4bae31(0x22f);[a16_0x4bae31(0x1f6)]=a16_0x4bae31(0x202);async[a16_0x4bae31(0x1ec)](_0x414199){const _0x245590=a16_0x4bae31,{options:_0x4a1192,args:_0x4564b3,tdx:_0x38c378}=_0x414199,_0x31154f=_0x4564b3[0x0],_0x5a4f7f=resolveLimit(_0x4a1192[_0x245590(0x22a)],DEFAULT_LLM_LIMIT),_0x1c3f55=await withSpinner(_0x245590(0x21c),()=>_0x38c378[_0x245590(0x22b)][_0x245590(0x24a)]({'limit':_0x5a4f7f}),{'verbose':_0x4a1192[_0x245590(0x1ee)]});let _0x3dba2d=_0x1c3f55[_0x245590(0x1cd)];return _0x31154f&&(_0x3dba2d=_0x1c3f55[_0x245590(0x1cd)][_0x245590(0x20c)](_0x3893f4=>matchGlobPattern(_0x3893f4[_0x245590(0x1e4)],_0x31154f))),await handleSDKOutput(_0x3dba2d,_0x4a1192),0x0;}}export class EngageWorkspaceShowCommand extends BaseCommand{[a16_0x4bae31(0x1e4)]=a16_0x4bae31(0x211);[a16_0x4bae31(0x1f6)]=a16_0x4bae31(0x212);async['execute'](_0x3f3eda){const _0x1fe2f3=a16_0x4bae31,{options:_0x121da4,args:_0x34a159,tdx:_0x385479}=_0x3f3eda;if(_0x34a159['length']===0x0)return console[_0x1fe2f3(0x1dd)](_0x1fe2f3(0x225)),console[_0x1fe2f3(0x1dd)](_0x1fe2f3(0x241)),0x1;const _0x5519c1=_0x34a159[0x0],_0x59f59e=_0x121da4,_0x44726f=_0x59f59e[_0x1fe2f3(0x1e9)];if(_0x44726f){const _0xef3b48=await withSpinner(_0x1fe2f3(0x216)+_0x5519c1+_0x1fe2f3(0x24b),()=>_0x385479['engage']['getWorkspaceFull'](_0x5519c1),{'verbose':_0x121da4[_0x1fe2f3(0x1ee)]});await handleSDKOutput([_0xef3b48],_0x121da4);}else{const _0x54b150=await withSpinner(_0x1fe2f3(0x216)+_0x5519c1+'\x27...',()=>_0x385479[_0x1fe2f3(0x22b)][_0x1fe2f3(0x24c)](_0x5519c1),{'verbose':_0x121da4[_0x1fe2f3(0x1ee)]});await handleSDKOutput([_0x54b150],_0x121da4);}return 0x0;}}export class EngageWorkspaceCreateCommand extends BaseCommand{[a16_0x4bae31(0x1e4)]=a16_0x4bae31(0x1f4);[a16_0x4bae31(0x1f6)]=a16_0x4bae31(0x1d8);async['execute'](_0x4cb867){const _0x4aa6bf=a16_0x4bae31,{options:_0x5e7c6b,tdx:_0x118859}=_0x4cb867,_0x859d33=_0x5e7c6b,_0xc8a408=_0x859d33[_0x4aa6bf(0x1e4)];if(!_0xc8a408)return console[_0x4aa6bf(0x1dd)](_0x4aa6bf(0x1db)),console[_0x4aa6bf(0x1dd)](_0x4aa6bf(0x1fa)),0x1;const _0x2710dc={'name':_0xc8a408,'description':_0x859d33[_0x4aa6bf(0x1f6)]},_0x3d2cc3=await withSpinner(_0x4aa6bf(0x23d)+_0xc8a408+_0x4aa6bf(0x24b),()=>_0x118859[_0x4aa6bf(0x22b)][_0x4aa6bf(0x239)](_0x2710dc));return await handleSDKOutput([_0x3d2cc3[_0x4aa6bf(0x1cd)]],_0x5e7c6b),0x0;}}function a16_0x2123(_0x5c27ab,_0x59f2ea){_0x5c27ab=_0x5c27ab-0x1b8;const _0x23de3f=a16_0x23de();let _0x2123dc=_0x23de3f[_0x5c27ab];return _0x2123dc;}function a16_0x23de(){const _0x3464be=['176382RXWvBG','Error:\x20Workspace\x20name\x20is\x20required','Fetching\x20campaigns...','Set\x20workspace\x20context\x20for\x20Engage\x20commands','7315821YOmsAZ','Error:\x20Workspace\x20name\x20or\x20ID\x20is\x20required','Usage:\x20tdx\x20engage\x20workspace\x20update\x20<name-or-id>\x20[--name\x20<new-name>]\x20...','Campaign\x20\x27','Workspace\x20\x27','Usage:\x20tdx\x20engage\x20campaign\x20duplicate\x20<name-or-id>','limit','engage','updateTemplate','Updating\x20template\x20\x27','581181Tslrbn','engage:workspaces','14DseoCe','Usage:\x20tdx\x20engage\x20campaign\x20resume\x20<name-or-id>','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20workspace\x20\x27','Delete\x20a\x20workspace','engage:workspace:delete','Launch\x20a\x20campaign','yes','engage:campaign:create','Error:\x20At\x20least\x20one\x20field\x20to\x20update\x20is\x20required','createWorkspace','engage:campaign:update','Use\x20--workspace\x20<name>\x20or\x20set\x20with\x20\x22tdx\x20use\x20engage_workspace\x20<name>\x22','keys','Creating\x20workspace\x20\x27','Updating\x20workspace\x20\x27','Deleting\x20template\x20\x27','getTemplate','Usage:\x20tdx\x20engage\x20workspace\x20show\x20<name-or-id>','segmentId','getTemplateFull','Duplicate\x20a\x20campaign','engage:template:create','Usage:\x20tdx\x20engage\x20template\x20update\x20<name-or-id>\x20[--name\x20<new-name>]\x20...','36sorFPQ','Usage:\x20tdx\x20engage\x20campaign\x20pause\x20<name-or-id>','jsonColumns','listWorkspaces','\x27...','getWorkspace','fromEntries','Engage\x20workspace\x20set\x20to:\x20','Create\x20a\x20new\x20campaign','length','16WgNlkw','Operation\x20cancelled','Workspace\x20is\x20required\x20for\x20this\x20operation','Usage:\x20tdx\x20engage\x20template\x20show\x20<name-or-id>','updateCampaign','Fetching\x20template\x20\x27','12zETNPO','html','Updating\x20campaign\x20\x27','\x27\x20resumed\x20successfully','Deleting\x20workspace\x20\x27','engage:template:update','log','Creating\x20campaign\x20\x27','Fetching\x20templates...','Usage:\x20tdx\x20engage\x20workspace\x20delete\x20<name-or-id>','pauseCampaign','getCampaign','data','engage:templates','listCampaigns','Delete\x20a\x20campaign','Usage:\x20tdx\x20engage\x20campaign\x20launch\x20<name-or-id>','type','Options:\x20--name,\x20--description','Pause\x20a\x20campaign','segment','Usage:\x20tdx\x20engage\x20campaign\x20create\x20--name\x20<name>\x20--type\x20<email|push>','105SHsjGF','Create\x20a\x20workspace','Pausing\x20campaign\x20\x27','Usage:\x20tdx\x20engage\x20template\x20create\x20--name\x20<name>\x20--subject\x20<subject>\x20--html\x20<html>','Error:\x20--name\x20is\x20required','\x27\x20launched\x20successfully','error','137653sFnSJX','engage:workspace:update','engage:campaign:resume','startAt','\x27\x20deleted\x20successfully','List\x20email\x20templates','name','engage:campaign:pause','Creating\x20template\x20\x27','\x27?\x20This\x20cannot\x20be\x20undone.','listTemplates','full','deleteTemplate','timezone','execute','engage:template:show','verbose','2115872UbsbnF','engage:campaign:duplicate','Create\x20an\x20email\x20template','1945702ocKOKI','parentId','engage:workspace:create','entries','description','Deleting\x20campaign\x20\x27','resolveWorkspaceId','Error:\x20Template\x20name\x20or\x20ID\x20is\x20required','Usage:\x20tdx\x20engage\x20workspace\x20create\x20--name\x20<name>\x20[--description\x20<desc>]','Options:\x20--name,\x20--subject,\x20--html,\x20--plaintext','parentName','Error:\x20--type\x20is\x20required\x20(email\x20or\x20push)','Update\x20a\x20campaign','Show\x20email\x20template\x20details','Launching\x20campaign\x20\x27','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20campaign\x20\x27','List\x20workspaces','MISSING_ARGUMENT','session','Verifying\x20workspace\x20\x27','getCampaignFull','\x27\x20paused\x20successfully','Update\x20an\x20email\x20template','engage:workspace:use','9385987kfoUvu','engage:campaign:delete','filter','10CMNtVF','Error:\x20Campaign\x20name\x20or\x20ID\x20is\x20required','Options:\x20--name,\x20--description,\x20--segment,\x20--email-sender-id,\x20--json-columns,\x20--start-at,\x20--timezone','segmentName','engage:workspace:show','Show\x20workspace\x20details','Usage:\x20tdx\x20engage\x20campaign\x20update\x20<name-or-id>\x20[--name\x20<new-name>]\x20...','subject','Duplicating\x20campaign\x20\x27','Fetching\x20workspace\x20\x27','plaintext','Error:\x20--subject\x20is\x20required','duplicateCampaign','status','editorType','Fetching\x20workspaces...','engage_workspace','workspace','Show\x20campaign\x20details'];a16_0x23de=function(){return _0x3464be;};return a16_0x23de();}export class EngageWorkspaceUpdateCommand extends BaseCommand{[a16_0x4bae31(0x1e4)]=a16_0x4bae31(0x1df);[a16_0x4bae31(0x1f6)]='Update\x20a\x20workspace';async[a16_0x4bae31(0x1ec)](_0x2766d0){const _0x289299=a16_0x4bae31,{options:_0x4cd708,args:_0x4d08bd,tdx:_0x11a020}=_0x2766d0;if(_0x4d08bd[_0x289299(0x1ba)]===0x0)return console['error']('Error:\x20Workspace\x20name\x20or\x20ID\x20is\x20required'),console[_0x289299(0x1dd)](_0x289299(0x226)),0x1;const _0x53c0b3=_0x4d08bd[0x0],_0x2e9665=_0x4cd708,_0x3b1af1={'name':_0x2e9665['name'],'description':_0x2e9665[_0x289299(0x1f6)]},_0x1278c2=Object[_0x289299(0x24d)](Object[_0x289299(0x1f5)](_0x3b1af1)[_0x289299(0x20c)](([,_0x166eca])=>_0x166eca!==undefined));if(Object[_0x289299(0x23c)](_0x1278c2)[_0x289299(0x1ba)]===0x0)return console['error'](_0x289299(0x238)),console[_0x289299(0x1dd)](_0x289299(0x1d3)),0x1;const _0x3fecac=await withSpinner(_0x289299(0x23e)+_0x53c0b3+'\x27...',()=>_0x11a020[_0x289299(0x22b)]['updateWorkspace'](_0x53c0b3,_0x1278c2),{'verbose':_0x4cd708['verbose']});return await handleSDKOutput([_0x3fecac[_0x289299(0x1cd)]],_0x4cd708),0x0;}}export class EngageWorkspaceDeleteCommand extends BaseCommand{[a16_0x4bae31(0x1e4)]=a16_0x4bae31(0x234);[a16_0x4bae31(0x1f6)]=a16_0x4bae31(0x233);async[a16_0x4bae31(0x1ec)](_0x37b4b3){const _0x5c5960=a16_0x4bae31,{options:_0x4da83f,args:_0x5ba65e,tdx:_0x4f50e0}=_0x37b4b3;if(_0x5ba65e['length']===0x0)return console[_0x5c5960(0x1dd)](_0x5c5960(0x225)),console[_0x5c5960(0x1dd)](_0x5c5960(0x1ca)),0x1;const _0x38da09=_0x5ba65e[0x0];if(!_0x4da83f[_0x5c5960(0x236)]){const _0x4af5c1=await confirm(_0x5c5960(0x232)+_0x38da09+_0x5c5960(0x1e7));if(!_0x4af5c1)return console[_0x5c5960(0x1c7)](_0x5c5960(0x1bc)),0x0;}return await withSpinner(_0x5c5960(0x1c5)+_0x38da09+'\x27...',()=>_0x4f50e0[_0x5c5960(0x22b)]['deleteWorkspace'](_0x38da09),{'verbose':_0x4da83f[_0x5c5960(0x1ee)]}),console[_0x5c5960(0x1c7)](_0x5c5960(0x228)+_0x38da09+_0x5c5960(0x1e2)),0x0;}}export class EngageWorkspaceUseCommand extends BaseCommand{['name']=a16_0x4bae31(0x209);[a16_0x4bae31(0x1f6)]=a16_0x4bae31(0x223);async[a16_0x4bae31(0x1ec)](_0x103984){const _0xb04e6e=a16_0x4bae31,{options:_0x38ad5c,args:_0x131ecd,tdx:_0x1d33f4}=_0x103984;if(_0x131ecd[_0xb04e6e(0x1ba)]===0x0)return console[_0xb04e6e(0x1dd)](_0xb04e6e(0x221)),console['error']('Usage:\x20tdx\x20engage\x20workspace\x20use\x20<name>'),0x1;const _0x3a6fa5=_0x131ecd[0x0];await withSpinner(_0xb04e6e(0x205)+_0x3a6fa5+_0xb04e6e(0x24b),()=>_0x1d33f4[_0xb04e6e(0x22b)][_0xb04e6e(0x1f8)](_0x3a6fa5));const _0x40a96d=_0x38ad5c[_0xb04e6e(0x204)]||undefined;return saveSessionContext({'engage_workspace':_0x3a6fa5},_0x40a96d),console[_0xb04e6e(0x1c7)](_0xb04e6e(0x1b8)+_0x3a6fa5),console['log']('\x0aTip:\x20Use\x20\x27tdx\x20use\x20--clear\x27\x20to\x20clear\x20session\x20overrides'),0x0;}}
|
|
1
|
+
const a16_0x4c1174=a16_0xcf84;(function(_0x3e1b63,_0x2c3720){const _0x43a7c5=a16_0xcf84,_0x459d10=_0x3e1b63();while(!![]){try{const _0x5e3766=-parseInt(_0x43a7c5(0x155))/0x1*(-parseInt(_0x43a7c5(0x191))/0x2)+parseInt(_0x43a7c5(0x181))/0x3+parseInt(_0x43a7c5(0x125))/0x4*(-parseInt(_0x43a7c5(0x132))/0x5)+parseInt(_0x43a7c5(0x11d))/0x6+-parseInt(_0x43a7c5(0x178))/0x7+-parseInt(_0x43a7c5(0x134))/0x8+parseInt(_0x43a7c5(0x137))/0x9;if(_0x5e3766===_0x2c3720)break;else _0x459d10['push'](_0x459d10['shift']());}catch(_0xfe9f9){_0x459d10['push'](_0x459d10['shift']());}}}(a16_0x5281,0xe3bb0));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';function a16_0xcf84(_0x25b7c4,_0xbb30f1){_0x25b7c4=_0x25b7c4-0x107;const _0x52816a=a16_0x5281();let _0xcf84f7=_0x52816a[_0x25b7c4];return _0xcf84f7;}function a16_0x5281(){const _0x562a4f=['pauseCampaign','engage:template:update','listCampaigns','Delete\x20an\x20email\x20template','Deleting\x20campaign\x20\x27','workspace','Error:\x20At\x20least\x20one\x20field\x20to\x20update\x20is\x20required','Usage:\x20tdx\x20engage\x20campaign\x20show\x20<name-or-id>','execute','editorType','Campaign\x20\x27','name','Error:\x20--subject\x20is\x20required','Resume\x20a\x20paused\x20campaign','Error:\x20Template\x20name\x20or\x20ID\x20is\x20required','8170608sUksyZ','Error:\x20--name\x20is\x20required','engage:template:create','resolvePathToResource','updateCampaign','Pausing\x20campaign\x20\x27','Usage:\x20tdx\x20engage\x20campaign\x20duplicate\x20<name-or-id>','\x27\x20deleted\x20successfully','2172844Gyirnk','Usage:\x20tdx\x20engage\x20campaign\x20delete\x20<name-or-id>','Usage:\x20tdx\x20engage\x20template\x20show\x20<name-or-id>','\x27\x20paused\x20successfully','html','createWorkspace','Verifying\x20workspace\x20\x27','log','engage','engage:workspaces','Options:\x20--name,\x20--description,\x20--segment,\x20--email-sender-id,\x20--json-columns,\x20--start-at,\x20--timezone','engage:campaign:resume','session','10itEnab','deleteCampaign','10855656xLdhfJ','parentName','Creating\x20template\x20\x27','3218355PRanIL','deleteTemplate','engage:campaign:delete','engage:template:show','startAt','jsonColumns','Fetching\x20workspace\x20\x27','Error:\x20Workspace\x20name\x20is\x20required','Duplicate\x20a\x20campaign','segmentId','Fetching\x20campaign\x20\x27','Updating\x20campaign\x20\x27','segmentName','Fetching\x20templates...','fromEntries','List\x20campaigns','segment','getTemplate','entries','Pause\x20a\x20campaign','yes','Usage:\x20tdx\x20engage\x20campaign\x20resume\x20<name-or-id>','type','Create\x20a\x20workspace','engage_workspace','Update\x20an\x20email\x20template','timezone','Updating\x20workspace\x20\x27','parentId','Workspace\x20is\x20required\x20for\x20this\x20operation','44KZKeeo','Usage:\x20tdx\x20engage\x20workspace\x20update\x20<name-or-id>\x20[--name\x20<new-name>]\x20...','Usage:\x20tdx\x20engage\x20campaign\x20create\x20--name\x20<name>\x20--type\x20<email|push>','getWorkspace','data','\x27?\x20This\x20cannot\x20be\x20undone.','description','keys','launchCampaign','length','resolveWorkspaceId','\x27...','engage:template:delete','duplicateCampaign','Fetching\x20template\x20\x27','emailSenderId','Error:\x20Workspace\x20name\x20or\x20ID\x20is\x20required','full','\x27\x20resumed\x20successfully','Workspace\x20\x27','Updating\x20template\x20\x27','Usage:\x20tdx\x20engage\x20workspace\x20use\x20<name>','engage:workspace:delete','List\x20email\x20templates','Template\x20\x27','engage:campaign:launch','updateTemplate','engage:workspace:use','Launch\x20a\x20campaign','Usage:\x20tdx\x20engage\x20template\x20update\x20<name-or-id>\x20[--name\x20<new-name>]\x20...','engage:campaign:create','Usage:\x20tdx\x20engage\x20campaign\x20launch\x20<name-or-id>','resumeCampaign','engage:workspace:show','Usage:\x20tdx\x20engage\x20workspace\x20create\x20--name\x20<name>\x20[--description\x20<desc>]','8358098DUNDgM','Options:\x20--name,\x20--description','Usage:\x20tdx\x20engage\x20template\x20create\x20--name\x20<name>\x20--subject\x20<subject>\x20--html\x20<html>','engage:campaign:duplicate','Operation\x20cancelled','Show\x20campaign\x20details','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20workspace\x20\x27','subject','Create\x20a\x20new\x20campaign','5385366zzTBRT','limit','getCampaign','engage:campaigns','Usage:\x20tdx\x20engage\x20campaign\x20pause\x20<name-or-id>','verbose','Update\x20a\x20workspace','Engage\x20workspace\x20set\x20to:\x20','status','error','Error:\x20Campaign\x20name\x20or\x20ID\x20is\x20required','Error:\x20--type\x20is\x20required\x20(email\x20or\x20push)','Usage:\x20tdx\x20engage\x20campaign\x20update\x20<name-or-id>\x20[--name\x20<new-name>]\x20...','Set\x20workspace\x20context\x20for\x20Engage\x20commands','Fetching\x20campaigns...','deleteWorkspace','47986CqrBFA','MISSING_ARGUMENT','engage:workspace:update','Duplicating\x20campaign\x20\x27','Use\x20--workspace\x20<name>\x20or\x20set\x20with\x20\x22tdx\x20use\x20engage_workspace\x20<name>\x22','engage:workspace:create','filter','List\x20workspaces','listWorkspaces','Deleting\x20template\x20\x27','\x27\x20launched\x20successfully'];a16_0x5281=function(){return _0x562a4f;};return a16_0x5281();}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(_0x12076b,_0x36dab3,_0x252b8b=![]){const _0x1c86ba=a16_0xcf84;if(_0x12076b['workspace'])return await _0x36dab3[_0x1c86ba(0x12d)][_0x1c86ba(0x15f)](_0x12076b[_0x1c86ba(0x113)]);const _0x3f5914=loadSessionContext(_0x12076b[_0x1c86ba(0x131)]);if(_0x3f5914?.[_0x1c86ba(0x14f)])return await _0x36dab3[_0x1c86ba(0x12d)][_0x1c86ba(0x15f)](_0x3f5914[_0x1c86ba(0x14f)]);if(_0x252b8b)throw new SDKError(ErrorCode[_0x1c86ba(0x192)],_0x1c86ba(0x154),undefined,{'helpText':_0x1c86ba(0x107)});return undefined;}async function resolveSegmentFromOptions(_0x523c47,_0x170554){const _0x36c531=a16_0xcf84;if(!_0x523c47['segment'])return{};const _0x7ff33c=_0x523c47[_0x36c531(0x147)],_0x47c3e3=await _0x170554[_0x36c531(0x147)][_0x36c531(0x120)](_0x7ff33c);return{'audienceId':_0x47c3e3[_0x36c531(0x153)],'audienceName':_0x47c3e3[_0x36c531(0x135)],..._0x47c3e3[_0x36c531(0x140)]&&{'segmentId':_0x47c3e3['segmentId'],'segmentName':_0x47c3e3[_0x36c531(0x143)]}};}function buildConnectorConfig(_0x537e78){const _0x51720d=a16_0xcf84,_0x226e75=_0x537e78[_0x51720d(0x164)],_0x5d8486=_0x537e78[_0x51720d(0x13c)];if(!_0x226e75&&!_0x5d8486)return undefined;return{..._0x226e75&&{'emailSenderId':_0x226e75},..._0x5d8486&&{'jsonColumns':_0x5d8486}};}export class EngageCampaignsCommand extends BaseCommand{['name']=a16_0x4c1174(0x184);[a16_0x4c1174(0x15b)]=a16_0x4c1174(0x146);async[a16_0x4c1174(0x116)](_0x220eb8){const _0x56e0ba=a16_0x4c1174,{options:_0x368524,args:_0x1f205a,tdx:_0xfd18c6}=_0x220eb8,_0x22753f=_0x1f205a[0x0],_0x1ff805=resolveLimit(_0x368524[_0x56e0ba(0x182)],DEFAULT_LLM_LIMIT),_0xf6ab0=_0x368524,_0x28f7eb=_0xf6ab0[_0x56e0ba(0x14d)],_0x3e4a4c=_0xf6ab0[_0x56e0ba(0x189)],_0x5f205a=await resolveWorkspaceIdFromOptions(_0xf6ab0,_0xfd18c6),_0x219bd8=await withSpinner(_0x56e0ba(0x18f),()=>_0xfd18c6[_0x56e0ba(0x12d)][_0x56e0ba(0x110)]({'type':_0x28f7eb,'status':_0x3e4a4c,'workspaceId':_0x5f205a,'limit':_0x1ff805}),{'verbose':_0x368524[_0x56e0ba(0x186)]});let _0x334820=_0x219bd8[_0x56e0ba(0x159)];return _0x22753f&&(_0x334820=_0x219bd8['data'][_0x56e0ba(0x109)](_0x3460f9=>matchGlobPattern(_0x3460f9[_0x56e0ba(0x119)],_0x22753f))),await handleSDKOutput(_0x334820,_0x368524),0x0;}}export class EngageCampaignShowCommand extends BaseCommand{[a16_0x4c1174(0x119)]='engage:campaign:show';[a16_0x4c1174(0x15b)]=a16_0x4c1174(0x17d);async[a16_0x4c1174(0x116)](_0x1703ba){const _0x569abd=a16_0x4c1174,{options:_0x453146,args:_0xacc98,tdx:_0x2ac257}=_0x1703ba;if(_0xacc98[_0x569abd(0x15e)]===0x0)return console['error'](_0x569abd(0x18b)),console[_0x569abd(0x18a)](_0x569abd(0x115)),0x1;const _0x3b3968=_0xacc98[0x0],_0xb5834d=_0x453146,_0x20ac9c=await resolveWorkspaceIdFromOptions(_0xb5834d,_0x2ac257),_0x17218d=_0xb5834d['full'];if(_0x17218d){const _0x3ac61b=await withSpinner(_0x569abd(0x141)+_0x3b3968+_0x569abd(0x160),()=>_0x2ac257[_0x569abd(0x12d)]['getCampaignFull'](_0x3b3968,_0x20ac9c),{'verbose':_0x453146[_0x569abd(0x186)]});await handleSDKOutput([_0x3ac61b],_0x453146);}else{const _0x154692=await withSpinner(_0x569abd(0x141)+_0x3b3968+_0x569abd(0x160),()=>_0x2ac257[_0x569abd(0x12d)][_0x569abd(0x183)](_0x3b3968,_0x20ac9c),{'verbose':_0x453146[_0x569abd(0x186)]});await handleSDKOutput([_0x154692],_0x453146);}return 0x0;}}export class EngageCampaignCreateCommand extends BaseCommand{['name']=a16_0x4c1174(0x173);[a16_0x4c1174(0x15b)]=a16_0x4c1174(0x180);async[a16_0x4c1174(0x116)](_0x22c6fc){const _0x5a7ea2=a16_0x4c1174,{options:_0x311c85,tdx:_0x17e35b}=_0x22c6fc,_0x672476=_0x311c85,_0x313c42=_0x672476[_0x5a7ea2(0x119)],_0x1bb877=_0x672476[_0x5a7ea2(0x14d)];if(!_0x313c42)return console[_0x5a7ea2(0x18a)](_0x5a7ea2(0x11e)),console[_0x5a7ea2(0x18a)](_0x5a7ea2(0x157)),0x1;if(!_0x1bb877)return console[_0x5a7ea2(0x18a)](_0x5a7ea2(0x18c)),console['error'](_0x5a7ea2(0x157)),0x1;const _0x2264a6=await resolveWorkspaceIdFromOptions(_0x672476,_0x17e35b,!![]),_0x182e97=await resolveSegmentFromOptions(_0x672476,_0x17e35b),_0x45f4b7=buildConnectorConfig(_0x672476),_0x2c2b2b={'name':_0x313c42,'campaignType':_0x1bb877,'workspaceId':_0x2264a6,'description':_0x672476['description'],..._0x182e97,'connectorConfig':_0x45f4b7,'startAt':_0x672476[_0x5a7ea2(0x13b)],'timezone':_0x672476[_0x5a7ea2(0x151)]},_0x433023=await withSpinner('Creating\x20campaign\x20\x27'+_0x313c42+_0x5a7ea2(0x160),()=>_0x17e35b[_0x5a7ea2(0x12d)]['createCampaign'](_0x2c2b2b));return await handleSDKOutput([_0x433023[_0x5a7ea2(0x159)]],_0x311c85),0x0;}}export class EngageCampaignUpdateCommand extends BaseCommand{[a16_0x4c1174(0x119)]='engage:campaign:update';[a16_0x4c1174(0x15b)]='Update\x20a\x20campaign';async[a16_0x4c1174(0x116)](_0x124987){const _0x1a4b53=a16_0x4c1174,{options:_0x1d9ae2,args:_0x5f251b,tdx:_0x196973}=_0x124987;if(_0x5f251b[_0x1a4b53(0x15e)]===0x0)return console['error']('Error:\x20Campaign\x20name\x20or\x20ID\x20is\x20required'),console[_0x1a4b53(0x18a)](_0x1a4b53(0x18d)),0x1;const _0x36987b=_0x5f251b[0x0],_0x5590cd=_0x1d9ae2,_0x8393fa=await resolveWorkspaceIdFromOptions(_0x5590cd,_0x196973),_0x160b78=await resolveSegmentFromOptions(_0x5590cd,_0x196973),_0x5e441=buildConnectorConfig(_0x5590cd),_0x59ae2f={'name':_0x5590cd[_0x1a4b53(0x119)],'description':_0x5590cd[_0x1a4b53(0x15b)],..._0x160b78,'connectorConfig':_0x5e441,'startAt':_0x5590cd[_0x1a4b53(0x13b)],'timezone':_0x5590cd[_0x1a4b53(0x151)]},_0x12e9c5=Object[_0x1a4b53(0x145)](Object[_0x1a4b53(0x149)](_0x59ae2f)[_0x1a4b53(0x109)](([,_0x578128])=>_0x578128!==undefined));if(Object[_0x1a4b53(0x15c)](_0x12e9c5)[_0x1a4b53(0x15e)]===0x0)return console[_0x1a4b53(0x18a)](_0x1a4b53(0x114)),console[_0x1a4b53(0x18a)](_0x1a4b53(0x12f)),0x1;const _0x473610=await withSpinner(_0x1a4b53(0x142)+_0x36987b+'\x27...',()=>_0x196973[_0x1a4b53(0x12d)][_0x1a4b53(0x121)](_0x36987b,_0x12e9c5,_0x8393fa),{'verbose':_0x1d9ae2[_0x1a4b53(0x186)]});return await handleSDKOutput([_0x473610[_0x1a4b53(0x159)]],_0x1d9ae2),0x0;}}export class EngageCampaignDeleteCommand extends BaseCommand{[a16_0x4c1174(0x119)]=a16_0x4c1174(0x139);[a16_0x4c1174(0x15b)]='Delete\x20a\x20campaign';async[a16_0x4c1174(0x116)](_0x3c540f){const _0x140dc8=a16_0x4c1174,{options:_0x480806,args:_0x249644,tdx:_0x4c39cc}=_0x3c540f;if(_0x249644[_0x140dc8(0x15e)]===0x0)return console[_0x140dc8(0x18a)]('Error:\x20Campaign\x20name\x20or\x20ID\x20is\x20required'),console[_0x140dc8(0x18a)](_0x140dc8(0x126)),0x1;const _0x4c13e7=_0x249644[0x0],_0x49ca58=_0x480806,_0x1700bb=await resolveWorkspaceIdFromOptions(_0x49ca58,_0x4c39cc);if(!_0x480806[_0x140dc8(0x14b)]){const _0x2a6034=await confirm('Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20campaign\x20\x27'+_0x4c13e7+'\x27?\x20This\x20cannot\x20be\x20undone.');if(!_0x2a6034)return console[_0x140dc8(0x12c)](_0x140dc8(0x17c)),0x0;}return await withSpinner(_0x140dc8(0x112)+_0x4c13e7+_0x140dc8(0x160),()=>_0x4c39cc[_0x140dc8(0x12d)][_0x140dc8(0x133)](_0x4c13e7,_0x1700bb),{'verbose':_0x480806['verbose']}),console[_0x140dc8(0x12c)](_0x140dc8(0x118)+_0x4c13e7+_0x140dc8(0x124)),0x0;}}export class EngageCampaignLaunchCommand extends BaseCommand{[a16_0x4c1174(0x119)]=a16_0x4c1174(0x16e);[a16_0x4c1174(0x15b)]=a16_0x4c1174(0x171);async[a16_0x4c1174(0x116)](_0xb37bae){const _0x499c70=a16_0x4c1174,{options:_0x3f0ee0,args:_0x550886,tdx:_0xbf5967}=_0xb37bae;if(_0x550886[_0x499c70(0x15e)]===0x0)return console[_0x499c70(0x18a)](_0x499c70(0x18b)),console[_0x499c70(0x18a)](_0x499c70(0x174)),0x1;const _0x1c051f=_0x550886[0x0],_0x6d108e=_0x3f0ee0,_0x42fdf5=await resolveWorkspaceIdFromOptions(_0x6d108e,_0xbf5967);return await withSpinner('Launching\x20campaign\x20\x27'+_0x1c051f+_0x499c70(0x160),()=>_0xbf5967[_0x499c70(0x12d)][_0x499c70(0x15d)](_0x1c051f,_0x42fdf5),{'verbose':_0x3f0ee0[_0x499c70(0x186)]}),console[_0x499c70(0x12c)](_0x499c70(0x118)+_0x1c051f+_0x499c70(0x10d)),0x0;}}export class EngageCampaignPauseCommand extends BaseCommand{[a16_0x4c1174(0x119)]='engage:campaign:pause';[a16_0x4c1174(0x15b)]=a16_0x4c1174(0x14a);async[a16_0x4c1174(0x116)](_0x3fa2dc){const _0x5ad1c4=a16_0x4c1174,{options:_0x45c47e,args:_0x5eba1e,tdx:_0x15a766}=_0x3fa2dc;if(_0x5eba1e[_0x5ad1c4(0x15e)]===0x0)return console[_0x5ad1c4(0x18a)](_0x5ad1c4(0x18b)),console[_0x5ad1c4(0x18a)](_0x5ad1c4(0x185)),0x1;const _0x89cb5f=_0x5eba1e[0x0],_0x2b3dd7=_0x45c47e,_0x105793=await resolveWorkspaceIdFromOptions(_0x2b3dd7,_0x15a766);return await withSpinner(_0x5ad1c4(0x122)+_0x89cb5f+_0x5ad1c4(0x160),()=>_0x15a766['engage'][_0x5ad1c4(0x10e)](_0x89cb5f,_0x105793),{'verbose':_0x45c47e[_0x5ad1c4(0x186)]}),console[_0x5ad1c4(0x12c)](_0x5ad1c4(0x118)+_0x89cb5f+_0x5ad1c4(0x128)),0x0;}}export class EngageCampaignResumeCommand extends BaseCommand{[a16_0x4c1174(0x119)]=a16_0x4c1174(0x130);[a16_0x4c1174(0x15b)]=a16_0x4c1174(0x11b);async[a16_0x4c1174(0x116)](_0x502f06){const _0xe9aa6a=a16_0x4c1174,{options:_0xe7c731,args:_0xe50141,tdx:_0x3dfc35}=_0x502f06;if(_0xe50141['length']===0x0)return console[_0xe9aa6a(0x18a)](_0xe9aa6a(0x18b)),console['error'](_0xe9aa6a(0x14c)),0x1;const _0x1f68f0=_0xe50141[0x0],_0xd5a786=_0xe7c731,_0x13602f=await resolveWorkspaceIdFromOptions(_0xd5a786,_0x3dfc35);return await withSpinner('Resuming\x20campaign\x20\x27'+_0x1f68f0+_0xe9aa6a(0x160),()=>_0x3dfc35['engage'][_0xe9aa6a(0x175)](_0x1f68f0,_0x13602f),{'verbose':_0xe7c731[_0xe9aa6a(0x186)]}),console[_0xe9aa6a(0x12c)]('Campaign\x20\x27'+_0x1f68f0+_0xe9aa6a(0x167)),0x0;}}export class EngageCampaignDuplicateCommand extends BaseCommand{[a16_0x4c1174(0x119)]=a16_0x4c1174(0x17b);[a16_0x4c1174(0x15b)]=a16_0x4c1174(0x13f);async['execute'](_0x3ed2e9){const _0x5faac9=a16_0x4c1174,{options:_0x34de76,args:_0x437a9f,tdx:_0x545424}=_0x3ed2e9;if(_0x437a9f[_0x5faac9(0x15e)]===0x0)return console[_0x5faac9(0x18a)]('Error:\x20Campaign\x20name\x20or\x20ID\x20is\x20required'),console[_0x5faac9(0x18a)](_0x5faac9(0x123)),0x1;const _0x51936c=_0x437a9f[0x0],_0x546416=_0x34de76,_0x42a8a1=await resolveWorkspaceIdFromOptions(_0x546416,_0x545424),_0x3d58dd=await withSpinner(_0x5faac9(0x194)+_0x51936c+'\x27...',()=>_0x545424['engage'][_0x5faac9(0x162)](_0x51936c,_0x42a8a1),{'verbose':_0x34de76[_0x5faac9(0x186)]});return await handleSDKOutput([_0x3d58dd[_0x5faac9(0x159)]],_0x34de76),0x0;}}export class EngageTemplatesCommand extends BaseCommand{['name']='engage:templates';[a16_0x4c1174(0x15b)]=a16_0x4c1174(0x16c);async[a16_0x4c1174(0x116)](_0x1c02c8){const _0x2e7757=a16_0x4c1174,{options:_0x25bc97,args:_0x597eb8,tdx:_0x4b459b}=_0x1c02c8,_0x7e0206=_0x597eb8[0x0],_0x1f883e=resolveLimit(_0x25bc97[_0x2e7757(0x182)],DEFAULT_LLM_LIMIT),_0x120ead=_0x25bc97,_0x329104=await resolveWorkspaceIdFromOptions(_0x120ead,_0x4b459b),_0x56b452=await withSpinner(_0x2e7757(0x144),()=>_0x4b459b[_0x2e7757(0x12d)]['listTemplates']({'workspaceId':_0x329104,'limit':_0x1f883e}),{'verbose':_0x25bc97[_0x2e7757(0x186)]});let _0x27fb78=_0x56b452[_0x2e7757(0x159)];return _0x7e0206&&(_0x27fb78=_0x56b452['data'][_0x2e7757(0x109)](_0xd87f53=>matchGlobPattern(_0xd87f53[_0x2e7757(0x119)],_0x7e0206))),await handleSDKOutput(_0x27fb78,_0x25bc97),0x0;}}export class EngageTemplateShowCommand extends BaseCommand{[a16_0x4c1174(0x119)]=a16_0x4c1174(0x13a);[a16_0x4c1174(0x15b)]='Show\x20email\x20template\x20details';async[a16_0x4c1174(0x116)](_0x211015){const _0x1f31f0=a16_0x4c1174,{options:_0x4044d3,args:_0x2cb907,tdx:_0x338319}=_0x211015;if(_0x2cb907[_0x1f31f0(0x15e)]===0x0)return console['error']('Error:\x20Template\x20name\x20or\x20ID\x20is\x20required'),console[_0x1f31f0(0x18a)](_0x1f31f0(0x127)),0x1;const _0x27adba=_0x2cb907[0x0],_0x4357d4=_0x4044d3,_0x34071d=await resolveWorkspaceIdFromOptions(_0x4357d4,_0x338319),_0xf9c8c3=_0x4357d4[_0x1f31f0(0x166)];if(_0xf9c8c3){const _0x3bdf3a=await withSpinner(_0x1f31f0(0x163)+_0x27adba+_0x1f31f0(0x160),()=>_0x338319[_0x1f31f0(0x12d)]['getTemplateFull'](_0x27adba,_0x34071d),{'verbose':_0x4044d3['verbose']});await handleSDKOutput([_0x3bdf3a],_0x4044d3);}else{const _0x434a5c=await withSpinner(_0x1f31f0(0x163)+_0x27adba+_0x1f31f0(0x160),()=>_0x338319[_0x1f31f0(0x12d)][_0x1f31f0(0x148)](_0x27adba,_0x34071d),{'verbose':_0x4044d3[_0x1f31f0(0x186)]});await handleSDKOutput([_0x434a5c],_0x4044d3);}return 0x0;}}export class EngageTemplateCreateCommand extends BaseCommand{[a16_0x4c1174(0x119)]=a16_0x4c1174(0x11f);[a16_0x4c1174(0x15b)]='Create\x20an\x20email\x20template';async['execute'](_0x1830c8){const _0x49b53c=a16_0x4c1174,{options:_0x489835,tdx:_0x4e6fba}=_0x1830c8,_0x4c8268=_0x489835,_0x3cab31=_0x4c8268['name'],_0x5e9a8c=_0x4c8268[_0x49b53c(0x17f)],_0x1aedf5=_0x4c8268['html'];if(!_0x3cab31)return console[_0x49b53c(0x18a)]('Error:\x20--name\x20is\x20required'),console[_0x49b53c(0x18a)](_0x49b53c(0x17a)),0x1;if(!_0x5e9a8c)return console[_0x49b53c(0x18a)](_0x49b53c(0x11a)),0x1;if(!_0x1aedf5)return console[_0x49b53c(0x18a)]('Error:\x20--html\x20is\x20required'),0x1;const _0x2218ea=await resolveWorkspaceIdFromOptions(_0x4c8268,_0x4e6fba,!![]),_0x4d88ad={'name':_0x3cab31,'subjectTemplate':_0x5e9a8c,'htmlTemplate':_0x1aedf5,'workspaceId':_0x2218ea,'plaintextTemplate':_0x4c8268['plaintext'],'editorType':_0x4c8268[_0x49b53c(0x117)]},_0x514a0d=await withSpinner(_0x49b53c(0x136)+_0x3cab31+_0x49b53c(0x160),()=>_0x4e6fba[_0x49b53c(0x12d)]['createTemplate'](_0x4d88ad));return await handleSDKOutput([_0x514a0d[_0x49b53c(0x159)]],_0x489835),0x0;}}export class EngageTemplateUpdateCommand extends BaseCommand{['name']=a16_0x4c1174(0x10f);[a16_0x4c1174(0x15b)]=a16_0x4c1174(0x150);async[a16_0x4c1174(0x116)](_0x45b998){const _0x515c0a=a16_0x4c1174,{options:_0x5b0b59,args:_0x54f752,tdx:_0x33f20b}=_0x45b998;if(_0x54f752['length']===0x0)return console['error'](_0x515c0a(0x11c)),console['error'](_0x515c0a(0x172)),0x1;const _0x5323b0=_0x54f752[0x0],_0x2bf5c4=_0x5b0b59,_0x4afa0e=await resolveWorkspaceIdFromOptions(_0x2bf5c4,_0x33f20b),_0x16acf9={'name':_0x2bf5c4['name'],'subjectTemplate':_0x2bf5c4[_0x515c0a(0x17f)],'htmlTemplate':_0x2bf5c4[_0x515c0a(0x129)],'plaintextTemplate':_0x2bf5c4['plaintext']},_0x28e4b3=Object[_0x515c0a(0x145)](Object[_0x515c0a(0x149)](_0x16acf9)[_0x515c0a(0x109)](([,_0x3494ae])=>_0x3494ae!==undefined));if(Object[_0x515c0a(0x15c)](_0x28e4b3)[_0x515c0a(0x15e)]===0x0)return console['error'](_0x515c0a(0x114)),console[_0x515c0a(0x18a)]('Options:\x20--name,\x20--subject,\x20--html,\x20--plaintext'),0x1;const _0x33f5d5=await withSpinner(_0x515c0a(0x169)+_0x5323b0+'\x27...',()=>_0x33f20b['engage'][_0x515c0a(0x16f)](_0x5323b0,_0x28e4b3,_0x4afa0e),{'verbose':_0x5b0b59[_0x515c0a(0x186)]});return await handleSDKOutput([_0x33f5d5[_0x515c0a(0x159)]],_0x5b0b59),0x0;}}export class EngageTemplateDeleteCommand extends BaseCommand{[a16_0x4c1174(0x119)]=a16_0x4c1174(0x161);[a16_0x4c1174(0x15b)]=a16_0x4c1174(0x111);async[a16_0x4c1174(0x116)](_0x354ba4){const _0x331553=a16_0x4c1174,{options:_0x5e8bf3,args:_0x2fdd3e,tdx:_0x43ffd2}=_0x354ba4;if(_0x2fdd3e['length']===0x0)return console['error'](_0x331553(0x11c)),console[_0x331553(0x18a)]('Usage:\x20tdx\x20engage\x20template\x20delete\x20<name-or-id>'),0x1;const _0x536873=_0x2fdd3e[0x0],_0x563c30=_0x5e8bf3,_0x4e6442=await resolveWorkspaceIdFromOptions(_0x563c30,_0x43ffd2);if(!_0x5e8bf3[_0x331553(0x14b)]){const _0x221f4a=await confirm('Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20template\x20\x27'+_0x536873+_0x331553(0x15a));if(!_0x221f4a)return console[_0x331553(0x12c)](_0x331553(0x17c)),0x0;}return await withSpinner(_0x331553(0x10c)+_0x536873+_0x331553(0x160),()=>_0x43ffd2[_0x331553(0x12d)][_0x331553(0x138)](_0x536873,_0x4e6442),{'verbose':_0x5e8bf3[_0x331553(0x186)]}),console[_0x331553(0x12c)](_0x331553(0x16d)+_0x536873+'\x27\x20deleted\x20successfully'),0x0;}}export class EngageWorkspacesCommand extends BaseCommand{['name']=a16_0x4c1174(0x12e);[a16_0x4c1174(0x15b)]=a16_0x4c1174(0x10a);async[a16_0x4c1174(0x116)](_0x2eb3e6){const _0x2f626d=a16_0x4c1174,{options:_0x103047,args:_0x3db109,tdx:_0x2bfc5e}=_0x2eb3e6,_0x4a34a8=_0x3db109[0x0],_0x41e2f5=resolveLimit(_0x103047[_0x2f626d(0x182)],DEFAULT_LLM_LIMIT),_0x29df87=await withSpinner('Fetching\x20workspaces...',()=>_0x2bfc5e[_0x2f626d(0x12d)][_0x2f626d(0x10b)]({'limit':_0x41e2f5}),{'verbose':_0x103047[_0x2f626d(0x186)]});let _0x3b3302=_0x29df87['data'];return _0x4a34a8&&(_0x3b3302=_0x29df87['data'][_0x2f626d(0x109)](_0x294b3a=>matchGlobPattern(_0x294b3a['name'],_0x4a34a8))),await handleSDKOutput(_0x3b3302,_0x103047),0x0;}}export class EngageWorkspaceShowCommand extends BaseCommand{[a16_0x4c1174(0x119)]=a16_0x4c1174(0x176);[a16_0x4c1174(0x15b)]='Show\x20workspace\x20details';async[a16_0x4c1174(0x116)](_0x7595c8){const _0x97ed6a=a16_0x4c1174,{options:_0x1c8fbf,args:_0x4db970,tdx:_0x51fd88}=_0x7595c8;if(_0x4db970['length']===0x0)return console[_0x97ed6a(0x18a)]('Error:\x20Workspace\x20name\x20or\x20ID\x20is\x20required'),console[_0x97ed6a(0x18a)]('Usage:\x20tdx\x20engage\x20workspace\x20show\x20<name-or-id>'),0x1;const _0x3c2cfc=_0x4db970[0x0],_0x2d387e=_0x1c8fbf,_0x24498a=_0x2d387e['full'];if(_0x24498a){const _0x88c537=await withSpinner('Fetching\x20workspace\x20\x27'+_0x3c2cfc+_0x97ed6a(0x160),()=>_0x51fd88[_0x97ed6a(0x12d)]['getWorkspaceFull'](_0x3c2cfc),{'verbose':_0x1c8fbf[_0x97ed6a(0x186)]});await handleSDKOutput([_0x88c537],_0x1c8fbf);}else{const _0x57bc82=await withSpinner(_0x97ed6a(0x13d)+_0x3c2cfc+_0x97ed6a(0x160),()=>_0x51fd88[_0x97ed6a(0x12d)][_0x97ed6a(0x158)](_0x3c2cfc),{'verbose':_0x1c8fbf[_0x97ed6a(0x186)]});await handleSDKOutput([_0x57bc82],_0x1c8fbf);}return 0x0;}}export class EngageWorkspaceCreateCommand extends BaseCommand{[a16_0x4c1174(0x119)]=a16_0x4c1174(0x108);[a16_0x4c1174(0x15b)]=a16_0x4c1174(0x14e);async['execute'](_0x3c36c7){const _0xf77111=a16_0x4c1174,{options:_0x5c7400,tdx:_0x906e3b}=_0x3c36c7,_0x422af9=_0x5c7400,_0x56d48c=_0x422af9[_0xf77111(0x119)];if(!_0x56d48c)return console[_0xf77111(0x18a)](_0xf77111(0x11e)),console[_0xf77111(0x18a)](_0xf77111(0x177)),0x1;const _0x1d009f={'name':_0x56d48c,'description':_0x422af9[_0xf77111(0x15b)]},_0x4e6216=await withSpinner('Creating\x20workspace\x20\x27'+_0x56d48c+_0xf77111(0x160),()=>_0x906e3b[_0xf77111(0x12d)][_0xf77111(0x12a)](_0x1d009f));return await handleSDKOutput([_0x4e6216[_0xf77111(0x159)]],_0x5c7400),0x0;}}export class EngageWorkspaceUpdateCommand extends BaseCommand{[a16_0x4c1174(0x119)]=a16_0x4c1174(0x193);[a16_0x4c1174(0x15b)]=a16_0x4c1174(0x187);async[a16_0x4c1174(0x116)](_0x43551f){const _0x3d9a66=a16_0x4c1174,{options:_0x40c7c9,args:_0x421821,tdx:_0x186b97}=_0x43551f;if(_0x421821[_0x3d9a66(0x15e)]===0x0)return console[_0x3d9a66(0x18a)](_0x3d9a66(0x165)),console[_0x3d9a66(0x18a)](_0x3d9a66(0x156)),0x1;const _0x123c75=_0x421821[0x0],_0x353600=_0x40c7c9,_0x316b2c={'name':_0x353600[_0x3d9a66(0x119)],'description':_0x353600[_0x3d9a66(0x15b)]},_0x2b19a3=Object[_0x3d9a66(0x145)](Object[_0x3d9a66(0x149)](_0x316b2c)[_0x3d9a66(0x109)](([,_0x4c9f57])=>_0x4c9f57!==undefined));if(Object[_0x3d9a66(0x15c)](_0x2b19a3)[_0x3d9a66(0x15e)]===0x0)return console[_0x3d9a66(0x18a)](_0x3d9a66(0x114)),console[_0x3d9a66(0x18a)](_0x3d9a66(0x179)),0x1;const _0x263230=await withSpinner(_0x3d9a66(0x152)+_0x123c75+_0x3d9a66(0x160),()=>_0x186b97['engage']['updateWorkspace'](_0x123c75,_0x2b19a3),{'verbose':_0x40c7c9[_0x3d9a66(0x186)]});return await handleSDKOutput([_0x263230[_0x3d9a66(0x159)]],_0x40c7c9),0x0;}}export class EngageWorkspaceDeleteCommand extends BaseCommand{[a16_0x4c1174(0x119)]=a16_0x4c1174(0x16b);[a16_0x4c1174(0x15b)]='Delete\x20a\x20workspace';async[a16_0x4c1174(0x116)](_0x312339){const _0x2d8f9a=a16_0x4c1174,{options:_0x138816,args:_0x440ea0,tdx:_0x572688}=_0x312339;if(_0x440ea0[_0x2d8f9a(0x15e)]===0x0)return console['error'](_0x2d8f9a(0x165)),console['error']('Usage:\x20tdx\x20engage\x20workspace\x20delete\x20<name-or-id>'),0x1;const _0x59d332=_0x440ea0[0x0];if(!_0x138816[_0x2d8f9a(0x14b)]){const _0x55e8ba=await confirm(_0x2d8f9a(0x17e)+_0x59d332+_0x2d8f9a(0x15a));if(!_0x55e8ba)return console[_0x2d8f9a(0x12c)](_0x2d8f9a(0x17c)),0x0;}return await withSpinner('Deleting\x20workspace\x20\x27'+_0x59d332+_0x2d8f9a(0x160),()=>_0x572688[_0x2d8f9a(0x12d)][_0x2d8f9a(0x190)](_0x59d332),{'verbose':_0x138816[_0x2d8f9a(0x186)]}),console[_0x2d8f9a(0x12c)](_0x2d8f9a(0x168)+_0x59d332+_0x2d8f9a(0x124)),0x0;}}export class EngageWorkspaceUseCommand extends BaseCommand{[a16_0x4c1174(0x119)]=a16_0x4c1174(0x170);['description']=a16_0x4c1174(0x18e);async[a16_0x4c1174(0x116)](_0x2f621c){const _0x5f3f45=a16_0x4c1174,{options:_0x13e328,args:_0x1f8390,tdx:_0x5e0df4}=_0x2f621c;if(_0x1f8390[_0x5f3f45(0x15e)]===0x0)return console['error'](_0x5f3f45(0x13e)),console[_0x5f3f45(0x18a)](_0x5f3f45(0x16a)),0x1;const _0x5630eb=_0x1f8390[0x0];await withSpinner(_0x5f3f45(0x12b)+_0x5630eb+'\x27...',()=>_0x5e0df4[_0x5f3f45(0x12d)][_0x5f3f45(0x15f)](_0x5630eb));const _0x488a78=_0x13e328[_0x5f3f45(0x131)]||undefined;return saveSessionContext({'engage_workspace':_0x5630eb},_0x488a78),console[_0x5f3f45(0x12c)](_0x5f3f45(0x188)+_0x5630eb),console['log']('\x0aTip:\x20Use\x20\x27tdx\x20use\x20--clear\x27\x20to\x20clear\x20session\x20overrides'),0x0;}}
|