@treasuredata/tdx 0.25.2 → 0.25.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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.d.ts.map +1 -1
- package/dist/commands/use-command.js +1 -1
- package/dist/commands/use-command.js.map +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.d.ts +16 -0
- package/dist/core/config.d.ts.map +1 -1
- package/dist/core/config.js +1 -1
- package/dist/core/config.js.map +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/query/index.js +1 -1
- package/dist/sdk/query/sql-parser.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-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-workflow.js +1 -1
- package/dist/sdk/segment/resolution-context.js +1 -1
- package/dist/sdk/segment/segment-path-parser.js +1 -1
- package/dist/sdk/segment/segment-ref-parser.js +1 -1
- package/dist/sdk/segment/target-resolution.js +1 -1
- package/dist/sdk/segment/tdx-config.js +1 -1
- package/dist/sdk/segment/validate-files.js +1 -1
- package/dist/sdk/segment/yaml-validator.js +1 -1
- package/dist/sdk/segment.js +1 -1
- package/dist/sdk/types/index.js +1 -1
- package/dist/sdk/types/progress.js +1 -1
- package/dist/sdk/user.js +1 -1
- package/dist/sdk/util/format-detector.js +1 -1
- package/dist/sdk/util/formatters.js +1 -1
- package/dist/sdk/util/index.js +1 -1
- package/dist/sdk/util/tree-formatter.js +1 -1
- package/dist/sdk/workflow/archive-validation.js +1 -1
- package/dist/sdk/workflow/clone-workflow.js +1 -1
- package/dist/sdk/workflow/index.js +1 -1
- package/dist/sdk/workflow/pull-workflow.js +1 -1
- package/dist/sdk/workflow/push-workflow.js +1 -1
- package/dist/sdk/workflow/tdx-config.js +1 -1
- package/dist/sdk/workflow/workflow-utils.js +1 -1
- package/dist/test-utils/command-runner.js +1 -1
- package/dist/test-utils/factories.js +1 -1
- package/dist/test-utils/fixtures.js +1 -1
- package/dist/test-utils/http-mock.js +1 -1
- package/dist/test-utils/index.js +1 -1
- package/dist/utils/async.js +1 -1
- package/dist/utils/colors.js +1 -1
- package/dist/utils/diff.js +1 -1
- package/dist/utils/file-permissions.js +1 -1
- package/dist/utils/global-cache.js +1 -1
- package/dist/utils/json-loader.js +1 -1
- package/dist/utils/local-cache.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.d.ts +4 -1
- package/dist/utils/version-check.d.ts.map +1 -1
- package/dist/utils/version-check.js +1 -1
- package/dist/utils/version-check.js.map +1 -1
- package/package.json +2 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
const a9_0x2d13b1=a9_0x15fa;(function(_0x5c54af,_0x4deb01){const _0x2b8586=a9_0x15fa,_0x130ea2=_0x5c54af();while(!![]){try{const _0x3f81a2=-parseInt(_0x2b8586(0x215))/0x1+parseInt(_0x2b8586(0x235))/0x2+parseInt(_0x2b8586(0x1ee))/0x3+-parseInt(_0x2b8586(0x233))/0x4+parseInt(_0x2b8586(0x1cd))/0x5*(parseInt(_0x2b8586(0x230))/0x6)+parseInt(_0x2b8586(0x1ea))/0x7+parseInt(_0x2b8586(0x1d7))/0x8*(parseInt(_0x2b8586(0x217))/0x9);if(_0x3f81a2===_0x4deb01)break;else _0x130ea2['push'](_0x130ea2['shift']());}catch(_0x4d5bca){_0x130ea2['push'](_0x130ea2['shift']());}}}(a9_0x2477,0x5a443));import{readFile,writeFile,mkdir}from'node:fs/promises';import{existsSync}from'node:fs';import{join}from'node:path';import a9_0x202762 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(_0x4c7ebf,_0xee41d5,_0xa4302b,_0x1b0235){const _0x3dc1d5=a9_0x15fa;errorContains(_0x4c7ebf,_0x3dc1d5(0x1ae),_0x3dc1d5(0x1b3),_0x3dc1d5(0x1ad))?(_0xa4302b['text']='✓\x20'+_0xee41d5+_0x3dc1d5(0x1aa),_0x1b0235?.[_0x3dc1d5(0x1bf)](_0xee41d5+_0x3dc1d5(0x1aa)),_0x4c7ebf instanceof SDKError&&_0x4c7ebf[_0x3dc1d5(0x1e4)]&&_0x1b0235?.[_0x3dc1d5(0x1cf)](_0x3dc1d5(0x1ab)+_0x4c7ebf[_0x3dc1d5(0x1e4)][_0x3dc1d5(0x211)])):(_0xa4302b[_0x3dc1d5(0x1d6)](_0x3dc1d5(0x222)+_0xee41d5),_0x1b0235?.[_0x3dc1d5(0x202)](_0xee41d5+_0x3dc1d5(0x234),_0x4c7ebf));}export function parseVersion(_0x40a794){const _0x254f93=a9_0x15fa,_0x3e9da1=_0x40a794[_0x254f93(0x213)]()[_0x254f93(0x229)](/^v?(\d+)\.(\d+)\.(\d+)/);if(!_0x3e9da1)return null;return{'major':parseInt(_0x3e9da1[0x1],0xa),'minor':parseInt(_0x3e9da1[0x2],0xa),'patch':parseInt(_0x3e9da1[0x3],0xa)};}function a9_0x2477(){const _0x5eb744=['INVALID_ARGUMENT','✓\x20Found\x20available\x20port:\x20','tdx-skills','close','info','Claude\x20Code\x20version\x20','\x27\x20not\x20found\x20in\x20list,\x20skipping\x20removal','\x27\x20installed','CLAUDE_CODE_USE_VERTEX','add','):\x20claude\x20','Updating\x20marketplace\x20\x27','mcp','description','verbose','tdx','✓\x20Logging\x20to\x20','localhost','15aEwqha','inherit','debug','pipe','Claude\x20Code\x20CLI\x20not\x20found','init','utf-8','127.0.0.1','patch','warn','297072LJKfSI','install','\x27:\x20','td-skills','\x20claude\x20statusline','context','Launch\x20Claude\x20Code\x20with\x20integrated\x20LLM\x20proxy','.claude','unshift','getCurrent','Creating\x20.claude/settings.local.json...','logLevel','Starting\x20TD\x20LLM\x20pass-through\x20proxy...','cause','API\x20key\x20is\x20required\x20for\x20TD\x20LLM\x20Proxy\x20mode','llm-proxy','logger','Failed\x20to\x20configure\x20marketplace\x20\x27','code','755832Jygqih','✓\x20TD\x20LLM\x20pass-through\x20proxy\x20running\x20on\x20port\x20','\x27\x20updated','command','781692LyfRZX','✓\x20Logs\x20saved\x20to\x20','Marketplace\x20\x27','hostname','td-docs','ANTHROPIC_BASE_URL','claude','statusLine','CLAUDE_CODE_UNSUPPORTED_VERSION','CLAUDE_CODE_NOT_FOUND','passThroughServer','text','ANTHROPIC_AUTH_TOKEN','major','stderr','Could\x20not\x20parse\x20Claude\x20Code\x20version\x20from:\x20','cwd','port','http://127.0.0.1:','td-skills\x20Plugins','error','TD\x20Docs\x20MCP\x20Server','type','INTERNAL','tdx\x20--profile\x20','✓\x20Marketplace\x20\x27','\x20meets\x20minimum\x20requirement','✓\x20Settings\x20restored:\x20.claude/settings.local.json','stop','Failed\x20to\x20configure\x20MCP\x20server\x20\x27','red','settings.local.json','tdx-managed-proxy','parse','toString','message','--transport','trim','execute','620513EhVfrT','CLAUDE_CODE_USE_BEDROCK','81Hzhcwr','Failed\x20to\x20launch\x20Claude\x20Code:\x20','Command\x20spawn\x20error:\x20','✓\x20Plugin\x20\x27','remove','Restored\x20default\x20td-skills\x20marketplace','getLogPath','plugin','\x20does\x20not\x20support\x20required\x20features.\x20Please\x20upgrade\x20to\x20version\x20','join','INSTALLATION_FAILED','Warning:\x20Failed\x20to\x20configure\x20','ENOENT','https://docs.treasuredata.com/mcp','tdx\x20claude\x20statusline','list','apiKey','false','match','workflow-skills','minor','Failed\x20to\x20update\x20marketplace\x20\x27','env','log','fail','1178178UMFcnu','Failed\x20to\x20remove\x20marketplace\x20\x27','\x27\x20configured','1572180CXCMaW','\x20configuration\x20failed','182908IMfRVX','Checking\x20Claude\x20Code\x20version...','Download\x20the\x20latest\x20version\x20from\x20https://claude.com/claude-code','Setup\x20failed','\x27\x20removed','marketplace','\x20already\x20configured','Command\x20output:\x20','green','already\x20configured','already\x20exists','account_id','site','start','Finding\x20available\x20port...','already\x20installed','ANTHROPIC_MODEL','Failed\x20to\x20spawn\x20claude\x20command:\x20','string','includes','originalSettings','continue','stringify'];a9_0x2477=function(){return _0x5eb744;};return a9_0x2477();}export function compareVersions(_0x1a05b2,_0x180b4d){const _0x268d8b=a9_0x15fa;if(_0x1a05b2[_0x268d8b(0x1fb)]!==_0x180b4d[_0x268d8b(0x1fb)])return _0x1a05b2[_0x268d8b(0x1fb)]-_0x180b4d[_0x268d8b(0x1fb)];if(_0x1a05b2['minor']!==_0x180b4d[_0x268d8b(0x22b)])return _0x1a05b2['minor']-_0x180b4d['minor'];return _0x1a05b2[_0x268d8b(0x1d5)]-_0x180b4d['patch'];}async function checkClaudeVersion(_0x166a08,_0x54e853){const _0x385435=a9_0x15fa;_0x54e853?.[_0x385435(0x1cf)]('Checking\x20Claude\x20Code\x20version\x20(minimum\x20required:\x20'+_0x166a08+')');const _0x788ae4=await executeClaudeCommand(['--version'],undefined,_0x54e853),_0xca066a=parseVersion(_0x788ae4);if(!_0xca066a){_0x54e853?.[_0x385435(0x1d6)](_0x385435(0x1fd)+_0x788ae4);return;}const _0x18b08b=_0xca066a[_0x385435(0x1fb)]+'.'+_0xca066a[_0x385435(0x22b)]+'.'+_0xca066a['patch'],_0x4cae82=parseVersion(_0x166a08);if(!_0x4cae82){_0x54e853?.[_0x385435(0x1d6)]('Invalid\x20minimum\x20version\x20format:\x20'+_0x166a08);return;}if(compareVersions(_0xca066a,_0x4cae82)<0x0){_0x54e853?.['error'](_0x385435(0x1c0)+_0x18b08b+'\x20is\x20too\x20old\x20(minimum:\x20'+_0x166a08+')');throw new SDKError(ErrorCode[_0x385435(0x1f6)],'Claude\x20Code\x20version\x20'+_0x18b08b+_0x385435(0x21f)+_0x166a08+'\x20or\x20later.',undefined,{'helpText':_0x385435(0x237)});}_0x54e853?.[_0x385435(0x1cf)](_0x385435(0x1c0)+_0x18b08b+_0x385435(0x208));}function a9_0x15fa(_0x1eb8a3,_0x33cf22){_0x1eb8a3=_0x1eb8a3-0x1a7;const _0x2477da=a9_0x2477();let _0x15fa47=_0x2477da[_0x1eb8a3];return _0x15fa47;}async function executeClaudeCommand(_0x369926,_0x3a59ed,_0x201a5e){return _0x201a5e?.['info']('Executing:\x20claude\x20'+_0x369926['join']('\x20')),new Promise((_0x3fee04,_0x3c7948)=>{const _0x1c4536=a9_0x15fa,_0x33acb9=crossSpawn(_0x1c4536(0x1f4),_0x369926,{'stdio':_0x1c4536(0x1d0)});let _0x105502='',_0x2d8590='';_0x33acb9['stdout']?.['on']('data',_0xefb65=>{const _0x5f2139=_0x1c4536;_0x105502+=_0xefb65[_0x5f2139(0x210)]();}),_0x33acb9[_0x1c4536(0x1fc)]?.['on']('data',_0x20a09a=>{const _0x58efae=_0x1c4536;_0x2d8590+=_0x20a09a[_0x58efae(0x210)]();}),_0x33acb9['on'](_0x1c4536(0x202),_0x5da1aa=>{const _0x26cbce=_0x1c4536;_0x5da1aa[_0x26cbce(0x1e9)]===_0x26cbce(0x223)?(_0x201a5e?.['error'](_0x26cbce(0x1d1)),_0x3c7948(new SDKError(ErrorCode[_0x26cbce(0x1f7)],'Claude\x20Code\x20CLI\x20not\x20found',_0x5da1aa,{'helpText':'Please\x20install\x20Claude\x20Code\x20from\x20https://claude.com/claude-code'}))):(_0x201a5e?.[_0x26cbce(0x202)](_0x26cbce(0x219)+_0x5da1aa[_0x26cbce(0x211)]),_0x3c7948(new SDKError(ErrorCode[_0x26cbce(0x205)],_0x26cbce(0x1b5)+_0x5da1aa[_0x26cbce(0x211)],_0x5da1aa)));}),_0x33acb9['on']('exit',_0x392dc0=>{const _0x3a5f2d=_0x1c4536;if(_0x392dc0===0x0)_0x3fee04(_0x105502);else _0x3a59ed?(_0x201a5e?.['error']('Command\x20failed\x20(exit\x20'+_0x392dc0+_0x3a5f2d(0x1c5)+_0x369926[_0x3a5f2d(0x220)]('\x20')),_0x3c7948(new SDKError(ErrorCode[_0x3a5f2d(0x221)],_0x3a59ed,new Error(_0x2d8590)))):_0x3fee04('');});});}async function ensureMcpServer(_0x527eff,_0xbbfca5,_0x4cbfc4,_0x1fc808,_0x57ff15){const _0x190396=a9_0x15fa;_0x1fc808[_0x190396(0x1f9)]='Configuring\x20MCP\x20server\x20\x27'+_0x527eff+'\x27...',await executeClaudeCommand([_0x190396(0x1c7),_0x190396(0x1c4),_0x527eff,_0xbbfca5,_0x190396(0x212),_0x4cbfc4],_0x190396(0x20b)+_0x527eff+'\x27',_0x57ff15),_0x1fc808[_0x190396(0x1f9)]='✓\x20MCP\x20server\x20\x27'+_0x527eff+_0x190396(0x232);}export const DEFAULT_TD_SKILLS_URL='https://github.com/treasure-data/td-skills';export function getTdSkillsRepoUrl(){const _0xe95dde=process.env.TDX_TD_SKILLS_REPO;if(_0xe95dde)return _0xe95dde;return DEFAULT_TD_SKILLS_URL;}async function removeMarketplace(_0x94ee7c,_0x2c0e2a){const _0x2d5c2e=a9_0x15fa;try{const _0xb5bea=await executeClaudeCommand([_0x2d5c2e(0x21e),_0x2d5c2e(0x1a9),_0x2d5c2e(0x226)],'Failed\x20to\x20list\x20marketplaces',_0x2c0e2a);if(!_0xb5bea[_0x2d5c2e(0x1b7)](_0x94ee7c)){_0x2c0e2a?.[_0x2d5c2e(0x1cf)](_0x2d5c2e(0x1f0)+_0x94ee7c+_0x2d5c2e(0x1c1));return;}await executeClaudeCommand([_0x2d5c2e(0x21e),_0x2d5c2e(0x1a9),_0x2d5c2e(0x21b),_0x94ee7c],_0x2d5c2e(0x231)+_0x94ee7c+'\x27',_0x2c0e2a),_0x2c0e2a?.['info'](_0x2d5c2e(0x1f0)+_0x94ee7c+_0x2d5c2e(0x1a8));}catch(_0x2c0c74){_0x2c0e2a?.[_0x2d5c2e(0x1d6)](_0x2d5c2e(0x231)+_0x94ee7c+_0x2d5c2e(0x1d9)+_0x2c0c74);}}async function restoreDefaultTdSkillsMarketplace(_0x44be2c){const _0x5d426a=a9_0x15fa;try{await removeMarketplace(_0x5d426a(0x1da),_0x44be2c),await executeClaudeCommand([_0x5d426a(0x21e),_0x5d426a(0x1a9),_0x5d426a(0x1c4),DEFAULT_TD_SKILLS_URL],undefined,_0x44be2c),_0x44be2c?.[_0x5d426a(0x1bf)](_0x5d426a(0x21c));}catch{}}async function ensureMarketplace(_0x4bb955,_0x6930f6,_0x4e9756,_0x1d80b9){const _0x46212e=a9_0x15fa;_0x4e9756[_0x46212e(0x1f9)]='Configuring\x20marketplace\x20\x27'+_0x4bb955+'\x27...',await executeClaudeCommand([_0x46212e(0x21e),_0x46212e(0x1a9),_0x46212e(0x1c4),_0x6930f6],_0x46212e(0x1e8)+_0x4bb955+'\x27',_0x1d80b9),_0x4e9756[_0x46212e(0x1f9)]=_0x46212e(0x207)+_0x4bb955+_0x46212e(0x232);}async function updateMarketplace(_0x54695f,_0x41ac25,_0x175dd1){const _0x2ee4a6=a9_0x15fa;_0x41ac25[_0x2ee4a6(0x1f9)]=_0x2ee4a6(0x1c6)+_0x54695f+'\x27...',await executeClaudeCommand([_0x2ee4a6(0x21e),_0x2ee4a6(0x1a9),'update'],_0x2ee4a6(0x22c)+_0x54695f+'\x27',_0x175dd1),_0x41ac25[_0x2ee4a6(0x1f9)]='✓\x20Marketplace\x20\x27'+_0x54695f+_0x2ee4a6(0x1ec);}async function ensurePlugin(_0x1895e5,_0x363818,_0x45a69d,_0x487647){const _0x393fc9=a9_0x15fa;_0x45a69d[_0x393fc9(0x1f9)]='Installing\x20plugin\x20\x27'+_0x1895e5+'\x27...',await executeClaudeCommand([_0x393fc9(0x21e),_0x393fc9(0x1d8),_0x1895e5+'@'+_0x363818],'Failed\x20to\x20install\x20plugin\x20\x27'+_0x1895e5+'\x27',_0x487647),_0x45a69d[_0x393fc9(0x1f9)]=_0x393fc9(0x21a)+_0x1895e5+_0x393fc9(0x1c2);}async function createClaudeSettings(_0x385051,_0x13bc18,_0x30ba92){const _0x50369d=a9_0x15fa,_0x60e17b=join(process['cwd'](),_0x50369d(0x1de)),_0x4a2bfd=join(_0x60e17b,_0x50369d(0x20d));await mkdir(_0x60e17b,{'recursive':!![]});let _0x599a70={};if(existsSync(_0x4a2bfd))try{const _0x22369c=await readFile(_0x4a2bfd,_0x50369d(0x1d3));_0x599a70=JSON['parse'](_0x22369c);}catch{_0x599a70={};}const _0x22f29=_0x599a70[_0x50369d(0x22d)]||{},_0x5a62f6={'ANTHROPIC_BASE_URL':_0x22f29[_0x50369d(0x1f3)],'ANTHROPIC_MODEL':_0x22f29['ANTHROPIC_MODEL'],'ANTHROPIC_AUTH_TOKEN':_0x22f29[_0x50369d(0x1fa)],'CLAUDE_CODE_USE_BEDROCK':_0x22f29[_0x50369d(0x216)],'CLAUDE_CODE_USE_VERTEX':_0x22f29[_0x50369d(0x1c3)],'statusLine':_0x599a70[_0x50369d(0x1f5)]},_0x4bbfc9={..._0x599a70,'env':{..._0x22f29,'ANTHROPIC_BASE_URL':_0x50369d(0x200)+_0x385051,..._0x13bc18&&{'ANTHROPIC_MODEL':_0x13bc18},'ANTHROPIC_AUTH_TOKEN':'tdx-managed-proxy','CLAUDE_CODE_USE_BEDROCK':_0x50369d(0x228),'CLAUDE_CODE_USE_VERTEX':_0x50369d(0x228)},'statusLine':{'type':'command','command':_0x30ba92?_0x50369d(0x206)+_0x30ba92+_0x50369d(0x1db):_0x50369d(0x225)}};return await writeFile(_0x4a2bfd,JSON['stringify'](_0x4bbfc9,null,0x2)+'\x0a'),_0x5a62f6;}async function restoreClaudeSettings(_0x53abbd){const _0x200fc5=a9_0x15fa,_0x31e56d=join(process[_0x200fc5(0x1fe)](),'.claude'),_0x2b58bd=join(_0x31e56d,_0x200fc5(0x20d));if(!existsSync(_0x2b58bd))return;try{const _0x1cfdec=await readFile(_0x2b58bd,'utf-8'),_0x224b31=JSON[_0x200fc5(0x20f)](_0x1cfdec),_0x13c45b=_0x224b31[_0x200fc5(0x22d)]||{},_0x56d56b=_0x13c45b[_0x200fc5(0x1f3)],_0x6bf6c5=((()=>{const _0x1c4642=_0x200fc5;if(typeof _0x56d56b!==_0x1c4642(0x1b6))return![];try{const _0x4868a3=new URL(_0x56d56b);return _0x4868a3['hostname']===_0x1c4642(0x1cc)||_0x4868a3[_0x1c4642(0x1f1)]===_0x1c4642(0x1d4);}catch{return![];}})());_0x6bf6c5?(delete _0x13c45b['ANTHROPIC_BASE_URL'],delete _0x13c45b[_0x200fc5(0x1b4)],delete _0x13c45b[_0x200fc5(0x1fa)],delete _0x13c45b[_0x200fc5(0x216)],delete _0x13c45b[_0x200fc5(0x1c3)]):(_0x53abbd[_0x200fc5(0x1f3)]!==undefined?_0x13c45b[_0x200fc5(0x1f3)]=_0x53abbd[_0x200fc5(0x1f3)]:delete _0x13c45b[_0x200fc5(0x1f3)],_0x53abbd[_0x200fc5(0x1b4)]!==undefined?_0x13c45b[_0x200fc5(0x1b4)]=_0x53abbd[_0x200fc5(0x1b4)]:delete _0x13c45b['ANTHROPIC_MODEL'],_0x53abbd[_0x200fc5(0x1fa)]!==undefined?_0x13c45b[_0x200fc5(0x1fa)]=_0x53abbd[_0x200fc5(0x1fa)]:delete _0x13c45b[_0x200fc5(0x1fa)],_0x53abbd[_0x200fc5(0x216)]!==undefined?_0x13c45b[_0x200fc5(0x216)]=_0x53abbd[_0x200fc5(0x216)]:delete _0x13c45b['CLAUDE_CODE_USE_BEDROCK'],_0x53abbd[_0x200fc5(0x1c3)]!==undefined?_0x13c45b[_0x200fc5(0x1c3)]=_0x53abbd[_0x200fc5(0x1c3)]:delete _0x13c45b[_0x200fc5(0x1c3)]);const _0x272fdb=_0x224b31['statusLine'],_0x3140bf=((()=>{const _0xc6b782=_0x200fc5;if(!_0x272fdb||typeof _0x272fdb!=='object')return![];if(_0x272fdb[_0xc6b782(0x204)]!==_0xc6b782(0x1ed))return![];if(typeof _0x272fdb['command']!==_0xc6b782(0x1b6))return![];return _0x272fdb['command'][_0xc6b782(0x1b7)](_0xc6b782(0x1ca))&&_0x272fdb[_0xc6b782(0x1ed)][_0xc6b782(0x1b7)]('statusline');})());if(_0x3140bf)delete _0x224b31[_0x200fc5(0x1f5)];else _0x53abbd['statusLine']!==undefined?_0x224b31[_0x200fc5(0x1f5)]=_0x53abbd['statusLine']:delete _0x224b31[_0x200fc5(0x1f5)];_0x224b31[_0x200fc5(0x22d)]=_0x13c45b,await writeFile(_0x2b58bd,JSON[_0x200fc5(0x1ba)](_0x224b31,null,0x2)+'\x0a');}catch{}}export class ClaudeCommand extends BaseCommand{['name']='claude';[a9_0x2d13b1(0x1c8)]=a9_0x2d13b1(0x1dd);[a9_0x2d13b1(0x1f8)];[a9_0x2d13b1(0x1b8)];[a9_0x2d13b1(0x1e7)];[a9_0x2d13b1(0x1ff)];async[a9_0x2d13b1(0x214)](_0x1100c0){const _0x4bdffd=a9_0x2d13b1,{tdx:_0x61de2e,options:_0x593994,args:_0x3d88f8}=_0x1100c0;let _0x37ac89=![];try{const _0x61a6f9=_0x593994,_0x3641bd=_0x61a6f9['proxy']===![],_0x530ce3=_0x61a6f9[_0x4bdffd(0x1b9)]===!![],_0x4a2f30=_0x61a6f9['resume']===!![],_0x3c8e6c=[..._0x3d88f8];if(_0x530ce3)_0x3c8e6c[_0x4bdffd(0x1df)]('-c');else _0x4a2f30&&_0x3c8e6c[_0x4bdffd(0x1df)]('-r');const _0x459542=createCommandSpinner('Initializing...',{'verbose':_0x593994[_0x4bdffd(0x1c9)]});_0x459542[_0x4bdffd(0x1b1)]();try{if(!_0x3641bd){_0x459542[_0x4bdffd(0x1f9)]=_0x4bdffd(0x1b2),this[_0x4bdffd(0x1ff)]=await findAvailablePort(0xfa0),_0x459542[_0x4bdffd(0x1f9)]=_0x4bdffd(0x1bc)+this[_0x4bdffd(0x1ff)];const _0x4f6059=_0x593994['profile'];try{const _0x1f2f70=await _0x61de2e['user'][_0x4bdffd(0x1e0)]();_0x1f2f70[_0x4bdffd(0x1af)]&&writeCachedAccountInfo(_0x593994[_0x4bdffd(0x1b0)],_0x1f2f70['account_id'],_0x4f6059);}catch{}_0x459542['text']='Initializing\x20proxy\x20logger...',this[_0x4bdffd(0x1e7)]=new TDXLogger(_0x593994[_0x4bdffd(0x1e2)],!![]),await this['logger'][_0x4bdffd(0x1d2)]();const _0x14cf0c=this[_0x4bdffd(0x1e7)][_0x4bdffd(0x21d)]();_0x459542[_0x4bdffd(0x1f9)]=_0x4bdffd(0x1cb)+_0x14cf0c;const _0x2b817b=getEndpoint(_0x593994[_0x4bdffd(0x1b0)],_0x4bdffd(0x1e6));_0x459542[_0x4bdffd(0x1f9)]=_0x4bdffd(0x1e3);if(!_0x61de2e['context']['apiKey'])throw new SDKError(ErrorCode[_0x4bdffd(0x1bb)],_0x4bdffd(0x1e5));this[_0x4bdffd(0x1f8)]=new PassThroughProxyServer({'port':this['port'],'llmProxyUrl':_0x2b817b,'apiKey':_0x61de2e[_0x4bdffd(0x1dc)][_0x4bdffd(0x227)],'logger':this[_0x4bdffd(0x1e7)],'site':_0x593994[_0x4bdffd(0x1b0)],'profile':_0x4f6059}),await this[_0x4bdffd(0x1f8)][_0x4bdffd(0x1b1)](),_0x459542[_0x4bdffd(0x1f9)]=_0x4bdffd(0x1eb)+this[_0x4bdffd(0x1ff)]+'\x20→\x20'+_0x2b817b,_0x459542[_0x4bdffd(0x1f9)]=_0x4bdffd(0x1e1),this[_0x4bdffd(0x1b8)]=await createClaudeSettings(this[_0x4bdffd(0x1ff)],undefined,_0x4f6059),_0x459542['text']='✓\x20Settings\x20configured:\x20.claude/settings.local.json';}else _0x459542['text']='Skipping\x20TD\x20LLM\x20proxy\x20setup\x20(--no-proxy)';try{_0x459542[_0x4bdffd(0x1f9)]=_0x4bdffd(0x236),await checkClaudeVersion(MIN_CLAUDE_VERSION,this[_0x4bdffd(0x1e7)]),_0x459542[_0x4bdffd(0x1f9)]='✓\x20Claude\x20Code\x20version\x20OK';}catch(_0x118164){_0x459542[_0x4bdffd(0x22f)]('Claude\x20Code\x20version\x20check\x20failed');throw _0x118164;}try{await ensureMcpServer(_0x4bdffd(0x1f2),_0x4bdffd(0x224),'http',_0x459542,this[_0x4bdffd(0x1e7)]);}catch(_0x139c6b){handleInstallationError(_0x139c6b,_0x4bdffd(0x203),_0x459542,this[_0x4bdffd(0x1e7)]);}try{const _0x54be1a=getTdSkillsRepoUrl();_0x37ac89=_0x54be1a!==DEFAULT_TD_SKILLS_URL,_0x37ac89&&await removeMarketplace('td-skills',this[_0x4bdffd(0x1e7)]),await ensureMarketplace('td-skills',_0x54be1a,_0x459542,this['logger']),await updateMarketplace('td-skills',_0x459542,this[_0x4bdffd(0x1e7)]),await ensurePlugin('sql-skills',_0x4bdffd(0x1da),_0x459542,this[_0x4bdffd(0x1e7)]),await ensurePlugin(_0x4bdffd(0x22a),_0x4bdffd(0x1da),_0x459542,this[_0x4bdffd(0x1e7)]),await ensurePlugin(_0x4bdffd(0x1bd),'td-skills',_0x459542,this[_0x4bdffd(0x1e7)]);}catch(_0x4cba35){handleInstallationError(_0x4cba35,_0x4bdffd(0x201),_0x459542,this[_0x4bdffd(0x1e7)]);}_0x459542[_0x4bdffd(0x20a)]();}catch(_0x2b2d6a){_0x459542[_0x4bdffd(0x22f)](_0x4bdffd(0x1a7));throw _0x2b2d6a;}const _0x2e9245=await findExecutable(_0x4bdffd(0x1f4));if(!_0x2e9245)throw new SDKError(ErrorCode[_0x4bdffd(0x1f7)],'Claude\x20Code\x20CLI\x20not\x20found',undefined,{'helpText':'Please\x20install\x20Claude\x20Code\x20from\x20https://claude.com/claude-code'});const _0x2fbef5={...process.env};!_0x3641bd&&(_0x2fbef5[_0x4bdffd(0x1f3)]=_0x4bdffd(0x200)+this[_0x4bdffd(0x1ff)],_0x2fbef5['ANTHROPIC_AUTH_TOKEN']=_0x4bdffd(0x20e),_0x2fbef5[_0x4bdffd(0x216)]=_0x4bdffd(0x228),_0x2fbef5[_0x4bdffd(0x1c3)]=_0x4bdffd(0x228));const _0x627bd1=crossSpawn(_0x2e9245,_0x3c8e6c,{'stdio':_0x4bdffd(0x1ce),'env':_0x2fbef5}),_0x544ccc=await new Promise(_0x30a4ff=>{const _0x5854bd=_0x4bdffd;_0x627bd1['on']('exit',_0x205f20=>{_0x30a4ff(_0x205f20||0x0);}),_0x627bd1['on'](_0x5854bd(0x202),_0x5ba52c=>{const _0x38ed5c=_0x5854bd;console['error'](a9_0x202762[_0x38ed5c(0x20c)](_0x38ed5c(0x218)+_0x5ba52c[_0x38ed5c(0x211)])),_0x30a4ff(0x1);});});_0x37ac89&&await restoreDefaultTdSkillsMarketplace(this[_0x4bdffd(0x1e7)]);this[_0x4bdffd(0x1f8)]&&(await this[_0x4bdffd(0x1f8)][_0x4bdffd(0x20a)](),console[_0x4bdffd(0x22e)](a9_0x202762[_0x4bdffd(0x1ac)]('✓\x20TD\x20LLM\x20pass-through\x20proxy\x20server\x20stopped')));if(this['logger']){await this['logger'][_0x4bdffd(0x1be)]();const _0xb2e7da=this[_0x4bdffd(0x1e7)][_0x4bdffd(0x21d)]();console[_0x4bdffd(0x22e)](a9_0x202762['green'](_0x4bdffd(0x1ef)+_0xb2e7da));}return this[_0x4bdffd(0x1b8)]&&(await restoreClaudeSettings(this[_0x4bdffd(0x1b8)]),console[_0x4bdffd(0x22e)](a9_0x202762[_0x4bdffd(0x1ac)](_0x4bdffd(0x209)))),_0x544ccc;}catch(_0xc81c6b){_0x37ac89&&await restoreDefaultTdSkillsMarketplace(this['logger']);this[_0x4bdffd(0x1f8)]&&await this['passThroughServer'][_0x4bdffd(0x20a)]();this[_0x4bdffd(0x1e7)]&&await this['logger'][_0x4bdffd(0x1be)]();this[_0x4bdffd(0x1b8)]&&await restoreClaudeSettings(this[_0x4bdffd(0x1b8)]);throw _0xc81c6b;}}}
|
|
1
|
+
const a9_0x346c26=a9_0xf0fc;(function(_0x604554,_0x44fc78){const _0x2e328c=a9_0xf0fc,_0x3a61ca=_0x604554();while(!![]){try{const _0x10b2dc=-parseInt(_0x2e328c(0xe3))/0x1*(parseInt(_0x2e328c(0xd4))/0x2)+-parseInt(_0x2e328c(0x123))/0x3+parseInt(_0x2e328c(0x13b))/0x4+-parseInt(_0x2e328c(0xe8))/0x5+-parseInt(_0x2e328c(0x12f))/0x6*(parseInt(_0x2e328c(0xd1))/0x7)+-parseInt(_0x2e328c(0x10d))/0x8+parseInt(_0x2e328c(0xe0))/0x9;if(_0x10b2dc===_0x44fc78)break;else _0x3a61ca['push'](_0x3a61ca['shift']());}catch(_0x863cef){_0x3a61ca['push'](_0x3a61ca['shift']());}}}(a9_0xb642,0x7179d));import{readFile,writeFile,mkdir}from'node:fs/promises';import{existsSync}from'node:fs';import{join}from'node:path';import a9_0x1d62ab 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(_0x51ec1f,_0x5211e1,_0x139c7e,_0xc7ab3){const _0x39e4e3=a9_0xf0fc;errorContains(_0x51ec1f,_0x39e4e3(0x144),'already\x20installed',_0x39e4e3(0x11a))?(_0x139c7e[_0x39e4e3(0xd9)]='✓\x20'+_0x5211e1+_0x39e4e3(0x118),_0xc7ab3?.['info'](_0x5211e1+_0x39e4e3(0x118)),_0x51ec1f instanceof SDKError&&_0x51ec1f[_0x39e4e3(0xed)]&&_0xc7ab3?.[_0x39e4e3(0x138)](_0x39e4e3(0xcd)+_0x51ec1f[_0x39e4e3(0xed)][_0x39e4e3(0x15f)])):(_0x139c7e['warn'](_0x39e4e3(0xd2)+_0x5211e1),_0xc7ab3?.[_0x39e4e3(0xf8)](_0x5211e1+_0x39e4e3(0x12c),_0x51ec1f));}export function parseVersion(_0x2f84c8){const _0xdbc06c=a9_0xf0fc,_0x4f805a=_0x2f84c8[_0xdbc06c(0x154)]()[_0xdbc06c(0x13e)](/^v?(\d+)\.(\d+)\.(\d+)/);if(!_0x4f805a)return null;return{'major':parseInt(_0x4f805a[0x1],0xa),'minor':parseInt(_0x4f805a[0x2],0xa),'patch':parseInt(_0x4f805a[0x3],0xa)};}export function compareVersions(_0x1951de,_0x429121){const _0x44706c=a9_0xf0fc;if(_0x1951de['major']!==_0x429121['major'])return _0x1951de[_0x44706c(0x155)]-_0x429121[_0x44706c(0x155)];if(_0x1951de[_0x44706c(0x12a)]!==_0x429121[_0x44706c(0x12a)])return _0x1951de[_0x44706c(0x12a)]-_0x429121[_0x44706c(0x12a)];return _0x1951de['patch']-_0x429121[_0x44706c(0x14a)];}async function checkClaudeVersion(_0x5c6860,_0x2ce5cf){const _0x47a5e9=a9_0xf0fc;_0x2ce5cf?.['debug'](_0x47a5e9(0x145)+_0x5c6860+')');const _0x4a1c22=await executeClaudeCommand([_0x47a5e9(0x108)],undefined,_0x2ce5cf),_0xa8b4ed=parseVersion(_0x4a1c22);if(!_0xa8b4ed){_0x2ce5cf?.[_0x47a5e9(0x132)]('Could\x20not\x20parse\x20Claude\x20Code\x20version\x20from:\x20'+_0x4a1c22);return;}const _0x2d202b=_0xa8b4ed[_0x47a5e9(0x155)]+'.'+_0xa8b4ed[_0x47a5e9(0x12a)]+'.'+_0xa8b4ed['patch'],_0x125698=parseVersion(_0x5c6860);if(!_0x125698){_0x2ce5cf?.['warn'](_0x47a5e9(0x126)+_0x5c6860);return;}if(compareVersions(_0xa8b4ed,_0x125698)<0x0){_0x2ce5cf?.[_0x47a5e9(0xf8)](_0x47a5e9(0x143)+_0x2d202b+'\x20is\x20too\x20old\x20(minimum:\x20'+_0x5c6860+')');throw new SDKError(ErrorCode[_0x47a5e9(0x156)],_0x47a5e9(0x143)+_0x2d202b+_0x47a5e9(0xcc)+_0x5c6860+'\x20or\x20later.',undefined,{'helpText':_0x47a5e9(0x11c)});}_0x2ce5cf?.[_0x47a5e9(0x138)](_0x47a5e9(0x143)+_0x2d202b+_0x47a5e9(0xd5));}async function executeClaudeCommand(_0x181872,_0x2880fe,_0x4de8a5){const _0x171710=a9_0xf0fc;return _0x4de8a5?.['info'](_0x171710(0x14c)+_0x181872[_0x171710(0xfc)]('\x20')),new Promise((_0x57573c,_0x579c2e)=>{const _0x5633d0=_0x171710,_0x14e209=crossSpawn('claude',_0x181872,{'stdio':_0x5633d0(0x124)});let _0x5b5581='',_0x1bfc5a='';_0x14e209['stdout']?.['on'](_0x5633d0(0xe5),_0x46c0c9=>{const _0x5edca3=_0x5633d0;_0x5b5581+=_0x46c0c9[_0x5edca3(0x120)]();}),_0x14e209['stderr']?.['on']('data',_0xc9261d=>{const _0x5af88a=_0x5633d0;_0x1bfc5a+=_0xc9261d[_0x5af88a(0x120)]();}),_0x14e209['on'](_0x5633d0(0xf8),_0x464c77=>{const _0x12399f=_0x5633d0;_0x464c77[_0x12399f(0xef)]===_0x12399f(0x12d)?(_0x4de8a5?.[_0x12399f(0xf8)](_0x12399f(0x131)),_0x579c2e(new SDKError(ErrorCode[_0x12399f(0xec)],_0x12399f(0x131),_0x464c77,{'helpText':_0x12399f(0x13c)}))):(_0x4de8a5?.[_0x12399f(0xf8)](_0x12399f(0x109)+_0x464c77[_0x12399f(0x15f)]),_0x579c2e(new SDKError(ErrorCode[_0x12399f(0x116)],_0x12399f(0x150)+_0x464c77[_0x12399f(0x15f)],_0x464c77)));}),_0x14e209['on'](_0x5633d0(0x134),_0x4ab725=>{const _0xc91b46=_0x5633d0;if(_0x4ab725===0x0)_0x57573c(_0x5b5581);else _0x2880fe?(_0x4de8a5?.[_0xc91b46(0xf8)](_0xc91b46(0xd7)+_0x4ab725+_0xc91b46(0xce)+_0x181872[_0xc91b46(0xfc)]('\x20')),_0x579c2e(new SDKError(ErrorCode[_0xc91b46(0x15c)],_0x2880fe,new Error(_0x1bfc5a)))):_0x57573c('');});});}async function ensureMcpServer(_0x2e8976,_0x1c2ed0,_0x627d2,_0x36a592,_0x560e8f){const _0x1c45f7=a9_0xf0fc;_0x36a592[_0x1c45f7(0xd9)]=_0x1c45f7(0xcf)+_0x2e8976+_0x1c45f7(0xe6),await executeClaudeCommand([_0x1c45f7(0x149),_0x1c45f7(0xd3),_0x2e8976,_0x1c2ed0,_0x1c45f7(0x10c),_0x627d2],'Failed\x20to\x20configure\x20MCP\x20server\x20\x27'+_0x2e8976+'\x27',_0x560e8f),_0x36a592[_0x1c45f7(0xd9)]='✓\x20MCP\x20server\x20\x27'+_0x2e8976+'\x27\x20configured';}function a9_0xf0fc(_0x2e7a4d,_0x4278c3){_0x2e7a4d=_0x2e7a4d-0xcb;const _0xb642e=a9_0xb642();let _0xf0fc09=_0xb642e[_0x2e7a4d];return _0xf0fc09;}export const DEFAULT_TD_SKILLS_URL='https://github.com/treasure-data/td-skills';export function getTdSkillsRepoUrl(){const _0x49fdbb=process.env.TDX_TD_SKILLS_REPO;if(_0x49fdbb)return _0x49fdbb;return DEFAULT_TD_SKILLS_URL;}async function removeMarketplace(_0x376853,_0x219815){const _0x183f97=a9_0xf0fc;try{const _0x349925=await executeClaudeCommand([_0x183f97(0xe1),_0x183f97(0x14e),'list'],_0x183f97(0x141),_0x219815);if(!_0x349925[_0x183f97(0xee)](_0x376853)){_0x219815?.[_0x183f97(0x138)]('Marketplace\x20\x27'+_0x376853+'\x27\x20not\x20found\x20in\x20list,\x20skipping\x20removal');return;}await executeClaudeCommand([_0x183f97(0xe1),_0x183f97(0x14e),'remove',_0x376853],_0x183f97(0x101)+_0x376853+'\x27',_0x219815),_0x219815?.[_0x183f97(0xfa)](_0x183f97(0x117)+_0x376853+_0x183f97(0x151));}catch(_0x58f720){_0x219815?.[_0x183f97(0x132)]('Failed\x20to\x20remove\x20marketplace\x20\x27'+_0x376853+'\x27:\x20'+_0x58f720);}}async function restoreDefaultTdSkillsMarketplace(_0x3ebb18){const _0x395aeb=a9_0xf0fc;try{await removeMarketplace(_0x395aeb(0x122),_0x3ebb18),await executeClaudeCommand(['plugin',_0x395aeb(0x14e),_0x395aeb(0xd3),DEFAULT_TD_SKILLS_URL],undefined,_0x3ebb18),_0x3ebb18?.[_0x395aeb(0xfa)](_0x395aeb(0x11f));}catch{}}async function ensureMarketplace(_0x2f5c63,_0x43b4bb,_0x165f18,_0x2671d6){const _0x3a27df=a9_0xf0fc;_0x165f18[_0x3a27df(0xd9)]='Configuring\x20marketplace\x20\x27'+_0x2f5c63+_0x3a27df(0xe6),await executeClaudeCommand([_0x3a27df(0xe1),_0x3a27df(0x14e),_0x3a27df(0xd3),_0x43b4bb],_0x3a27df(0x11b)+_0x2f5c63+'\x27',_0x2671d6),_0x165f18[_0x3a27df(0xd9)]=_0x3a27df(0x125)+_0x2f5c63+_0x3a27df(0xe4);}async function updateMarketplace(_0x309676,_0x42ce09,_0x347e6b){const _0x1fc795=a9_0xf0fc;_0x42ce09[_0x1fc795(0xd9)]=_0x1fc795(0x121)+_0x309676+_0x1fc795(0xe6),await executeClaudeCommand([_0x1fc795(0xe1),_0x1fc795(0x14e),'update'],_0x1fc795(0x100)+_0x309676+'\x27',_0x347e6b),_0x42ce09[_0x1fc795(0xd9)]=_0x1fc795(0x125)+_0x309676+_0x1fc795(0xf7);}async function ensurePlugin(_0x42d646,_0x2f59a9,_0x261328,_0xd6368f){const _0x29158f=a9_0xf0fc;_0x261328['text']=_0x29158f(0x102)+_0x42d646+_0x29158f(0xe6),await executeClaudeCommand([_0x29158f(0xe1),_0x29158f(0x152),_0x42d646+'@'+_0x2f59a9],'Failed\x20to\x20install\x20plugin\x20\x27'+_0x42d646+'\x27',_0xd6368f),_0x261328[_0x29158f(0xd9)]=_0x29158f(0xf9)+_0x42d646+'\x27\x20installed';}function a9_0xb642(){const _0x3a9e5f=['--transport','5513296zDhfjZ','command','td-docs','close','profile','red','Failed\x20to\x20launch\x20Claude\x20Code:\x20','INVALID_ARGUMENT','stop','INTERNAL','Marketplace\x20\x27','\x20already\x20configured','stringify','already\x20configured','Failed\x20to\x20configure\x20marketplace\x20\x27','Download\x20the\x20latest\x20version\x20from\x20https://claude.com/claude-code','\x20claude\x20statusline','ANTHROPIC_AUTH_TOKEN','Restored\x20default\x20td-skills\x20marketplace','toString','Updating\x20marketplace\x20\x27','td-skills','969528FQoFVl','pipe','✓\x20Marketplace\x20\x27','Invalid\x20minimum\x20version\x20format:\x20','start','log','settings.local.json','minor','✓\x20Logging\x20to\x20','\x20configuration\x20failed','ENOENT','ANTHROPIC_BASE_URL','186DtfUbb','passThroughServer','Claude\x20Code\x20CLI\x20not\x20found','warn','✓\x20Logs\x20saved\x20to\x20','exit','logLevel','CLAUDE_CODE_USE_VERTEX','✓\x20Claude\x20Code\x20version\x20OK','debug','statusLine','context','154120xVWZxh','Please\x20install\x20Claude\x20Code\x20from\x20https://claude.com/claude-code','account_id','match','Starting\x20TD\x20LLM\x20pass-through\x20proxy...','env','Failed\x20to\x20list\x20marketplaces','statusline','Claude\x20Code\x20version\x20','already\x20exists','Checking\x20Claude\x20Code\x20version\x20(minimum\x20required:\x20','parse','tdx-managed-proxy','site','mcp','patch','hostname','Executing:\x20claude\x20','init','marketplace','verbose','Failed\x20to\x20spawn\x20claude\x20command:\x20','\x27\x20removed','install','API\x20key\x20is\x20required\x20for\x20TD\x20LLM\x20Proxy\x20mode','trim','major','CLAUDE_CODE_UNSUPPORTED_VERSION','fail','utf-8','sql-skills','originalSettings','green','INSTALLATION_FAILED','tdx\x20claude\x20statusline','tdx\x20--profile\x20','message','inherit','getLogPath','\x20does\x20not\x20support\x20required\x20features.\x20Please\x20upgrade\x20to\x20version\x20','Command\x20output:\x20','):\x20claude\x20','Configuring\x20MCP\x20server\x20\x27','unshift','57757BNBKow','Warning:\x20Failed\x20to\x20configure\x20','add','375790qYhMXU','\x20meets\x20minimum\x20requirement','tdx-skills','Command\x20failed\x20(exit\x20','http://127.0.0.1:','text','port','string','user','object','td-skills\x20Plugins','✓\x20Settings\x20configured:\x20.claude/settings.local.json','21066336yWqZdo','plugin','logger','3BNHZaA','\x27\x20configured','data','\x27...','apiKey','413165bMMmuX','✓\x20Found\x20available\x20port:\x20','CLAUDE_CODE_USE_BEDROCK','continue','CLAUDE_CODE_NOT_FOUND','cause','includes','code','false','workflow-skills','127.0.0.1','✓\x20TD\x20LLM\x20pass-through\x20proxy\x20running\x20on\x20port\x20','llm-proxy','Initializing...','execute','\x27\x20updated','error','✓\x20Plugin\x20\x27','info','http','join','name','resume','tdx','Failed\x20to\x20update\x20marketplace\x20\x27','Failed\x20to\x20remove\x20marketplace\x20\x27','Installing\x20plugin\x20\x27','ANTHROPIC_MODEL','Initializing\x20proxy\x20logger...','claude','Launch\x20Claude\x20Code\x20with\x20integrated\x20LLM\x20proxy','Setup\x20failed','--version','Command\x20spawn\x20error:\x20','Creating\x20.claude/settings.local.json...','.claude'];a9_0xb642=function(){return _0x3a9e5f;};return a9_0xb642();}async function createClaudeSettings(_0x5d3d2b,_0x21d630,_0x41ee0f){const _0x3fe8b5=a9_0xf0fc,_0x10800b=join(process['cwd'](),_0x3fe8b5(0x10b)),_0x48f887=join(_0x10800b,_0x3fe8b5(0x129));await mkdir(_0x10800b,{'recursive':!![]});let _0x2017e5={};if(existsSync(_0x48f887))try{const _0x5ea88f=await readFile(_0x48f887,'utf-8');_0x2017e5=JSON[_0x3fe8b5(0x146)](_0x5ea88f);}catch{_0x2017e5={};}const _0x3b8138=_0x2017e5['env']||{},_0x13308c={'ANTHROPIC_BASE_URL':_0x3b8138[_0x3fe8b5(0x12e)],'ANTHROPIC_MODEL':_0x3b8138['ANTHROPIC_MODEL'],'ANTHROPIC_AUTH_TOKEN':_0x3b8138[_0x3fe8b5(0x11e)],'CLAUDE_CODE_USE_BEDROCK':_0x3b8138[_0x3fe8b5(0xea)],'CLAUDE_CODE_USE_VERTEX':_0x3b8138[_0x3fe8b5(0x136)],'statusLine':_0x2017e5[_0x3fe8b5(0x139)]},_0x4cf2c1={..._0x2017e5,'env':{..._0x3b8138,'ANTHROPIC_BASE_URL':_0x3fe8b5(0xd8)+_0x5d3d2b,..._0x21d630&&{'ANTHROPIC_MODEL':_0x21d630},'ANTHROPIC_AUTH_TOKEN':_0x3fe8b5(0x147),'CLAUDE_CODE_USE_BEDROCK':'false','CLAUDE_CODE_USE_VERTEX':'false'},'statusLine':{'type':_0x3fe8b5(0x10e),'command':_0x41ee0f?_0x3fe8b5(0x15e)+_0x41ee0f+_0x3fe8b5(0x11d):_0x3fe8b5(0x15d)}};return await writeFile(_0x48f887,JSON[_0x3fe8b5(0x119)](_0x4cf2c1,null,0x2)+'\x0a'),_0x13308c;}async function restoreClaudeSettings(_0x588152){const _0x3d00d5=a9_0xf0fc,_0x5ba0db=join(process['cwd'](),_0x3d00d5(0x10b)),_0x576e5e=join(_0x5ba0db,'settings.local.json');if(!existsSync(_0x576e5e))return;try{const _0x2d1175=await readFile(_0x576e5e,_0x3d00d5(0x158)),_0x3c6dbe=JSON[_0x3d00d5(0x146)](_0x2d1175),_0x3ebd3c=_0x3c6dbe[_0x3d00d5(0x140)]||{},_0x2519bb=_0x3ebd3c[_0x3d00d5(0x12e)],_0x37743a=((()=>{const _0x44b489=_0x3d00d5;if(typeof _0x2519bb!=='string')return![];try{const _0x487b34=new URL(_0x2519bb);return _0x487b34[_0x44b489(0x14b)]==='localhost'||_0x487b34['hostname']===_0x44b489(0xf2);}catch{return![];}})());_0x37743a?(delete _0x3ebd3c[_0x3d00d5(0x12e)],delete _0x3ebd3c[_0x3d00d5(0x103)],delete _0x3ebd3c[_0x3d00d5(0x11e)],delete _0x3ebd3c[_0x3d00d5(0xea)],delete _0x3ebd3c[_0x3d00d5(0x136)]):(_0x588152[_0x3d00d5(0x12e)]!==undefined?_0x3ebd3c[_0x3d00d5(0x12e)]=_0x588152['ANTHROPIC_BASE_URL']:delete _0x3ebd3c['ANTHROPIC_BASE_URL'],_0x588152[_0x3d00d5(0x103)]!==undefined?_0x3ebd3c['ANTHROPIC_MODEL']=_0x588152[_0x3d00d5(0x103)]:delete _0x3ebd3c[_0x3d00d5(0x103)],_0x588152[_0x3d00d5(0x11e)]!==undefined?_0x3ebd3c['ANTHROPIC_AUTH_TOKEN']=_0x588152[_0x3d00d5(0x11e)]:delete _0x3ebd3c[_0x3d00d5(0x11e)],_0x588152[_0x3d00d5(0xea)]!==undefined?_0x3ebd3c[_0x3d00d5(0xea)]=_0x588152[_0x3d00d5(0xea)]:delete _0x3ebd3c[_0x3d00d5(0xea)],_0x588152['CLAUDE_CODE_USE_VERTEX']!==undefined?_0x3ebd3c[_0x3d00d5(0x136)]=_0x588152[_0x3d00d5(0x136)]:delete _0x3ebd3c['CLAUDE_CODE_USE_VERTEX']);const _0x2dec4d=_0x3c6dbe[_0x3d00d5(0x139)],_0x1cebdc=((()=>{const _0x47ca00=_0x3d00d5;if(!_0x2dec4d||typeof _0x2dec4d!==_0x47ca00(0xdd))return![];if(_0x2dec4d['type']!=='command')return![];if(typeof _0x2dec4d['command']!==_0x47ca00(0xdb))return![];return _0x2dec4d[_0x47ca00(0x10e)][_0x47ca00(0xee)](_0x47ca00(0xff))&&_0x2dec4d[_0x47ca00(0x10e)][_0x47ca00(0xee)](_0x47ca00(0x142));})());if(_0x1cebdc)delete _0x3c6dbe[_0x3d00d5(0x139)];else _0x588152[_0x3d00d5(0x139)]!==undefined?_0x3c6dbe[_0x3d00d5(0x139)]=_0x588152[_0x3d00d5(0x139)]:delete _0x3c6dbe[_0x3d00d5(0x139)];_0x3c6dbe['env']=_0x3ebd3c,await writeFile(_0x576e5e,JSON['stringify'](_0x3c6dbe,null,0x2)+'\x0a');}catch{}}export class ClaudeCommand extends BaseCommand{[a9_0x346c26(0xfd)]=a9_0x346c26(0x105);['description']=a9_0x346c26(0x106);[a9_0x346c26(0x130)];['originalSettings'];[a9_0x346c26(0xe2)];[a9_0x346c26(0xda)];async[a9_0x346c26(0xf6)](_0x4c4aaa){const _0x558b8b=a9_0x346c26,{tdx:_0x41f0eb,options:_0xde656c,args:_0x11fd07}=_0x4c4aaa;let _0x217e54=![];try{const _0x331e82=_0xde656c,_0x4f7b8e=_0x331e82['proxy']===![],_0x177bc3=_0x331e82[_0x558b8b(0xeb)]===!![],_0x57c5ff=_0x331e82[_0x558b8b(0xfe)]===!![],_0x1ce022=[..._0x11fd07];if(_0x177bc3)_0x1ce022[_0x558b8b(0xd0)]('-c');else _0x57c5ff&&_0x1ce022[_0x558b8b(0xd0)]('-r');const _0x2d981c=createCommandSpinner(_0x558b8b(0xf5),{'verbose':_0xde656c[_0x558b8b(0x14f)]});_0x2d981c[_0x558b8b(0x127)]();try{if(!_0x4f7b8e){_0x2d981c[_0x558b8b(0xd9)]='Finding\x20available\x20port...',this[_0x558b8b(0xda)]=await findAvailablePort(0xfa0),_0x2d981c['text']=_0x558b8b(0xe9)+this[_0x558b8b(0xda)];const _0x2b86b8=_0xde656c[_0x558b8b(0x111)];try{const _0xd8fc38=await _0x41f0eb[_0x558b8b(0xdc)]['getCurrent']();_0xd8fc38[_0x558b8b(0x13d)]&&writeCachedAccountInfo(_0xde656c[_0x558b8b(0x148)],_0xd8fc38['account_id'],_0x2b86b8);}catch{}_0x2d981c['text']=_0x558b8b(0x104),this['logger']=new TDXLogger(_0xde656c[_0x558b8b(0x135)],!![]),await this[_0x558b8b(0xe2)][_0x558b8b(0x14d)]();const _0x50d17c=this['logger'][_0x558b8b(0xcb)]();_0x2d981c['text']=_0x558b8b(0x12b)+_0x50d17c;const _0x35058d=getEndpoint(_0xde656c[_0x558b8b(0x148)],_0x558b8b(0xf4));_0x2d981c['text']=_0x558b8b(0x13f);if(!_0x41f0eb[_0x558b8b(0x13a)]['apiKey'])throw new SDKError(ErrorCode[_0x558b8b(0x114)],_0x558b8b(0x153));this['passThroughServer']=new PassThroughProxyServer({'port':this['port'],'llmProxyUrl':_0x35058d,'apiKey':_0x41f0eb[_0x558b8b(0x13a)][_0x558b8b(0xe7)],'logger':this[_0x558b8b(0xe2)],'site':_0xde656c[_0x558b8b(0x148)],'profile':_0x2b86b8}),await this[_0x558b8b(0x130)][_0x558b8b(0x127)](),_0x2d981c['text']=_0x558b8b(0xf3)+this[_0x558b8b(0xda)]+'\x20→\x20'+_0x35058d,_0x2d981c[_0x558b8b(0xd9)]=_0x558b8b(0x10a),this[_0x558b8b(0x15a)]=await createClaudeSettings(this['port'],undefined,_0x2b86b8),_0x2d981c[_0x558b8b(0xd9)]=_0x558b8b(0xdf);}else _0x2d981c[_0x558b8b(0xd9)]='Skipping\x20TD\x20LLM\x20proxy\x20setup\x20(--no-proxy)';try{_0x2d981c[_0x558b8b(0xd9)]='Checking\x20Claude\x20Code\x20version...',await checkClaudeVersion(MIN_CLAUDE_VERSION,this[_0x558b8b(0xe2)]),_0x2d981c[_0x558b8b(0xd9)]=_0x558b8b(0x137);}catch(_0x4959e2){_0x2d981c[_0x558b8b(0x157)]('Claude\x20Code\x20version\x20check\x20failed');throw _0x4959e2;}try{await ensureMcpServer(_0x558b8b(0x10f),'https://docs.treasuredata.com/mcp',_0x558b8b(0xfb),_0x2d981c,this[_0x558b8b(0xe2)]);}catch(_0xb55d53){handleInstallationError(_0xb55d53,'TD\x20Docs\x20MCP\x20Server',_0x2d981c,this[_0x558b8b(0xe2)]);}try{const _0x3f3e8a=getTdSkillsRepoUrl();_0x217e54=_0x3f3e8a!==DEFAULT_TD_SKILLS_URL,_0x217e54&&await removeMarketplace(_0x558b8b(0x122),this[_0x558b8b(0xe2)]),await ensureMarketplace(_0x558b8b(0x122),_0x3f3e8a,_0x2d981c,this[_0x558b8b(0xe2)]),await updateMarketplace(_0x558b8b(0x122),_0x2d981c,this[_0x558b8b(0xe2)]),await ensurePlugin(_0x558b8b(0x159),_0x558b8b(0x122),_0x2d981c,this[_0x558b8b(0xe2)]),await ensurePlugin(_0x558b8b(0xf1),_0x558b8b(0x122),_0x2d981c,this['logger']),await ensurePlugin(_0x558b8b(0xd6),'td-skills',_0x2d981c,this[_0x558b8b(0xe2)]);}catch(_0xe6f6ff){handleInstallationError(_0xe6f6ff,_0x558b8b(0xde),_0x2d981c,this[_0x558b8b(0xe2)]);}_0x2d981c[_0x558b8b(0x115)]();}catch(_0xb8a428){_0x2d981c[_0x558b8b(0x157)](_0x558b8b(0x107));throw _0xb8a428;}const _0x1845cc=await findExecutable(_0x558b8b(0x105));if(!_0x1845cc)throw new SDKError(ErrorCode['CLAUDE_CODE_NOT_FOUND'],'Claude\x20Code\x20CLI\x20not\x20found',undefined,{'helpText':_0x558b8b(0x13c)});const _0xaddbeb={...process.env};!_0x4f7b8e&&(_0xaddbeb[_0x558b8b(0x12e)]='http://127.0.0.1:'+this[_0x558b8b(0xda)],_0xaddbeb[_0x558b8b(0x11e)]=_0x558b8b(0x147),_0xaddbeb['CLAUDE_CODE_USE_BEDROCK']=_0x558b8b(0xf0),_0xaddbeb[_0x558b8b(0x136)]=_0x558b8b(0xf0));const _0x2ea280=crossSpawn(_0x1845cc,_0x1ce022,{'stdio':_0x558b8b(0x160),'env':_0xaddbeb}),_0x4f0fc5=await new Promise(_0x56656d=>{const _0x3e1d72=_0x558b8b;_0x2ea280['on']('exit',_0x1081d5=>{_0x56656d(_0x1081d5||0x0);}),_0x2ea280['on'](_0x3e1d72(0xf8),_0x5b1018=>{const _0x3226a3=_0x3e1d72;console['error'](a9_0x1d62ab[_0x3226a3(0x112)](_0x3226a3(0x113)+_0x5b1018['message'])),_0x56656d(0x1);});});_0x217e54&&await restoreDefaultTdSkillsMarketplace(this[_0x558b8b(0xe2)]);this['passThroughServer']&&(await this[_0x558b8b(0x130)][_0x558b8b(0x115)](),console['log'](a9_0x1d62ab[_0x558b8b(0x15b)]('✓\x20TD\x20LLM\x20pass-through\x20proxy\x20server\x20stopped')));if(this[_0x558b8b(0xe2)]){await this[_0x558b8b(0xe2)][_0x558b8b(0x110)]();const _0x90070e=this[_0x558b8b(0xe2)]['getLogPath']();console[_0x558b8b(0x128)](a9_0x1d62ab[_0x558b8b(0x15b)](_0x558b8b(0x133)+_0x90070e));}return this[_0x558b8b(0x15a)]&&(await restoreClaudeSettings(this[_0x558b8b(0x15a)]),console[_0x558b8b(0x128)](a9_0x1d62ab[_0x558b8b(0x15b)]('✓\x20Settings\x20restored:\x20.claude/settings.local.json'))),_0x4f0fc5;}catch(_0x38ddf2){_0x217e54&&await restoreDefaultTdSkillsMarketplace(this[_0x558b8b(0xe2)]);this[_0x558b8b(0x130)]&&await this[_0x558b8b(0x130)][_0x558b8b(0x115)]();this[_0x558b8b(0xe2)]&&await this[_0x558b8b(0xe2)][_0x558b8b(0x110)]();this['originalSettings']&&await restoreClaudeSettings(this[_0x558b8b(0x15a)]);throw _0x38ddf2;}}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a10_0x2c3f64=a10_0x1e61;(function(_0x500ee3,_0x3772c7){const _0x56546e=a10_0x1e61,_0x2dfa5c=_0x500ee3();while(!![]){try{const _0x16a0f9=-parseInt(_0x56546e(0x14b))/0x1+parseInt(_0x56546e(0x13c))/0x2*(-parseInt(_0x56546e(0x14a))/0x3)+parseInt(_0x56546e(0x148))/0x4+-parseInt(_0x56546e(0x139))/0x5+parseInt(_0x56546e(0x14c))/0x6*(parseInt(_0x56546e(0x15e))/0x7)+parseInt(_0x56546e(0x162))/0x8*(-parseInt(_0x56546e(0x15a))/0x9)+-parseInt(_0x56546e(0x141))/0xa*(-parseInt(_0x56546e(0x149))/0xb);if(_0x16a0f9===_0x3772c7)break;else _0x2dfa5c['push'](_0x2dfa5c['shift']());}catch(_0x13f34b){_0x2dfa5c['push'](_0x2dfa5c['shift']());}}}(a10_0xfac7,0xdbbc4));function a10_0xfac7(){const _0x775828=['290674SJREHP','270TxxLcH','profile','accountId','description','close','\x20|\x20','session_id','push','🧠\x20','\x20-\x20','\x20today\x20/\x20','tdx\x20','💎\x20','toFixed','9099kQVvKX','Claude','monthCredits','options','34503bIEULy','stdin','💎\x20tdx\x20-\x20Claude','site','7376ddalSb','\x20month','6644170FdlQGk','todayCredits','\x20session\x20/\x20','6URuLZD','model','statusline','log','Output\x20statusline\x20for\x20Claude\x20Code\x20(reads\x20JSON\x20from\x20stdin)','6145100lmwbOQ','join','sessionCredits','tdx','🪙\x20credit:\x20','latestInputTokens','execute','2003656mqaLVm','77KtJpfp','1572603YeYKci'];a10_0xfac7=function(){return _0x775828;};return a10_0xfac7();}import{createInterface}from'node:readline';function a10_0x1e61(_0xbc2315,_0x217df7){_0xbc2315=_0xbc2315-0x139;const _0xfac7b4=a10_0xfac7();let _0x1e6169=_0xfac7b4[_0xbc2315];return _0x1e6169;}import{BaseCommand}from'./command.js';import{getUsageStats}from'../proxy/claude-usage-tracker.js';import{readCachedAccountInfo}from'../core/config.js';import{getModelDisplayName,formatTokenCount,calculateContextPercentage}from'../sdk/llm/model-factors.js';async function readStdinJson(_0x2aba8a=0x64){return new Promise(_0x22232f=>{const _0x301e93=a10_0x1e61;let _0x31eabf='',_0x2e13c8=![];const _0x2dd0c2=createInterface({'input':process[_0x301e93(0x15f)],'terminal':![]}),_0x5b24f9=_0x23d7d7=>{const _0x48a4c0=_0x301e93;if(_0x2e13c8)return;_0x2e13c8=!![],clearTimeout(_0x5815f5),_0x2dd0c2[_0x48a4c0(0x150)](),_0x22232f(_0x23d7d7);},_0x5815f5=setTimeout(()=>{_0x5b24f9(null);},_0x2aba8a);_0x2dd0c2['on']('line',_0x441bc5=>{_0x31eabf+=_0x441bc5;}),_0x2dd0c2['on'](_0x301e93(0x150),()=>{if(_0x2e13c8)return;try{const _0x1d75ce=JSON['parse'](_0x31eabf);_0x5b24f9(_0x1d75ce);}catch{_0x5b24f9(null);}});});}function formatCredits(_0x7d826e){const _0x1327b1=a10_0x1e61;return _0x7d826e[_0x1327b1(0x159)](0x2);}export class ClaudeStatuslineCommand extends BaseCommand{['name']=a10_0x2c3f64(0x13e);[a10_0x2c3f64(0x14f)]=a10_0x2c3f64(0x140);async[a10_0x2c3f64(0x147)](_0x389e9e){const _0x164ddb=a10_0x2c3f64;try{const _0x15066c=await readStdinJson();if(!_0x15066c?.[_0x164ddb(0x152)])return console[_0x164ddb(0x13f)](_0x164ddb(0x160)),0x0;const _0x625462=_0x15066c['session_id'],_0x2ef1f6=_0x15066c[_0x164ddb(0x13d)]?.['id']||'',_0x4687f5=_0x15066c[_0x164ddb(0x14d)]||_0x389e9e[_0x164ddb(0x15d)]['profile'],_0x24d438=await getUsageStats(_0x625462,_0x4687f5),_0x461350=[],_0x4a3a5d=readCachedAccountInfo(_0x4687f5),_0x4d398f=_0x4a3a5d?_0x164ddb(0x157)+_0x4a3a5d[_0x164ddb(0x161)]+':'+_0x4a3a5d[_0x164ddb(0x14e)]:_0x164ddb(0x144),_0x4b31eb=_0x2ef1f6?getModelDisplayName(_0x2ef1f6):_0x164ddb(0x15b);_0x461350[_0x164ddb(0x153)](_0x164ddb(0x158)+_0x4d398f+_0x164ddb(0x155)+_0x4b31eb);const _0x4c6f86=formatCredits(_0x24d438[_0x164ddb(0x143)]),_0x4ed8d4=formatCredits(_0x24d438[_0x164ddb(0x13a)]),_0x19865d=formatCredits(_0x24d438[_0x164ddb(0x15c)]);_0x461350[_0x164ddb(0x153)](_0x164ddb(0x145)+_0x4c6f86+_0x164ddb(0x13b)+_0x4ed8d4+_0x164ddb(0x156)+_0x19865d+_0x164ddb(0x163));if(_0x24d438[_0x164ddb(0x146)]>0x0&&_0x2ef1f6){const _0x255865=formatTokenCount(_0x24d438[_0x164ddb(0x146)]),_0x41d895=calculateContextPercentage(_0x24d438[_0x164ddb(0x146)],_0x2ef1f6);_0x461350[_0x164ddb(0x153)](_0x164ddb(0x154)+_0x255865+'\x20('+_0x41d895+'%)');}return console[_0x164ddb(0x13f)](_0x461350[_0x164ddb(0x142)](_0x164ddb(0x151))),0x0;}catch{return console[_0x164ddb(0x13f)](_0x164ddb(0x160)),0x0;}}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a11_0x5bc901=a11_0x468c;(function(_0x364298,_0x13be02){const _0x5453d5=a11_0x468c,_0x438190=_0x364298();while(!![]){try{const _0x2b4b61=parseInt(_0x5453d5(0x173))/0x1+-parseInt(_0x5453d5(0x15d))/0x2+-parseInt(_0x5453d5(0x14a))/0x3*(parseInt(_0x5453d5(0x146))/0x4)+parseInt(_0x5453d5(0x149))/0x5+parseInt(_0x5453d5(0x168))/0x6+-parseInt(_0x5453d5(0x13b))/0x7+parseInt(_0x5453d5(0x17b))/0x8*(-parseInt(_0x5453d5(0x15c))/0x9);if(_0x2b4b61===_0x13be02)break;else _0x438190['push'](_0x438190['shift']());}catch(_0x548711){_0x438190['push'](_0x438190['shift']());}}}(a11_0x1cde,0xead19));function a11_0x468c(_0x316500,_0xa49c45){_0x316500=_0x316500-0x138;const _0x1cdefc=a11_0x1cde();let _0x468cf3=_0x1cdefc[_0x316500];return _0x468cf3;}import a11_0x21764b from'chalk';import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../core/command-output.js';function a11_0x1cde(){const _0x81cb51=['format','4NkIZbl','Today','outputTable','5724450CKphoc','2611473IEfrEn','\x20credits','entryCount','source','dim','cyan','execute','length','Month','log','toFixed','error','repeat','Error:\x20','name','Last\x20Used','red','json','18XuJdQz','1263368uoevuP','monthCredits','Profile','(default)','totalCredits','\x20\x20Today:\x20\x20\x20','jsonl','Source','2-digit','credits','round','8717340BvmCog','Total','\x20\x20Total:\x20\x20\x20','lastUsedAt','Requests','short','\x20days\x20ago','padEnd','default','padStart','map','1265764OTGaKI','todayCredits','bold','\x20\x20No\x20usage\x20data\x20recorded\x20yet.','Unknown\x20error','outputStructured','today\x20','profileCount','4530776EkYaWE','Usage\x20by\x20Source','getTime','Show\x20AI\x20Suite\x20credit\x20usage\x20by\x20profile','\x0aAI\x20Suite\x20Credit\x20Usage\x20Summary','1868006QAUfnJ','en-US','all','Credits','toLocaleDateString','\x20\x20Run\x20\x22tdx\x20claude\x22\x20to\x20start\x20using\x20AI\x20Suite.\x0a','profile','usage','toLocaleTimeString','Usage\x20by\x20Profile'];a11_0x1cde=function(){return _0x81cb51;};return a11_0x1cde();}import{getAllProfileStats,getAllSourceStats,getUsageSummary}from'../proxy/claude-usage-tracker.js';function formatCredits(_0x3fde00){const _0x1c49bd=a11_0x468c;return _0x3fde00[_0x1c49bd(0x154)](0x2);}function formatLastUsed(_0xa60712){const _0x689d26=a11_0x468c;if(!_0xa60712)return'never';const _0x4e9beb=new Date(_0xa60712),_0x378397=new Date(),_0x31afb6=_0x4e9beb[_0x689d26(0x13f)]('en-CA'),_0x5e28ff=_0x378397[_0x689d26(0x13f)]('en-CA');if(_0x31afb6===_0x5e28ff)return _0x689d26(0x179)+_0x4e9beb[_0x689d26(0x143)]('en-US',{'hour':_0x689d26(0x165),'minute':'2-digit'});const _0x1a7a6e=new Date(_0x31afb6),_0x2fc5e0=new Date(_0x5e28ff),_0x1ab29a=Math[_0x689d26(0x167)]((_0x2fc5e0[_0x689d26(0x138)]()-_0x1a7a6e[_0x689d26(0x138)]())/(0x18*0x3c*0x3c*0x3e8));if(_0x1ab29a===0x1)return'yesterday';else return _0x1ab29a>0x1&&_0x1ab29a<0x7?_0x1ab29a+_0x689d26(0x16e):_0x4e9beb[_0x689d26(0x13f)](_0x689d26(0x13c),{'month':_0x689d26(0x16d),'day':'numeric'});}export class ClaudeUsageCommand extends BaseCommand{[a11_0x5bc901(0x158)]=a11_0x5bc901(0x142);['description']=a11_0x5bc901(0x139);async[a11_0x5bc901(0x150)](_0x54522a){const _0x3fbbe8=a11_0x5bc901,{options:_0xffe454}=_0x54522a,_0x4ce189=_0xffe454[_0x3fbbe8(0x145)]===_0x3fbbe8(0x15b)||_0xffe454[_0x3fbbe8(0x145)]===_0x3fbbe8(0x163)||_0xffe454['json'];try{const [_0x17a0fa,_0x18e061,_0x353692]=await Promise[_0x3fbbe8(0x13d)]([getAllProfileStats(),getAllSourceStats(),getUsageSummary()]);return _0x4ce189?await this['outputStructured'](_0x17a0fa,_0x18e061,_0x353692,_0xffe454):this['outputTable'](_0x17a0fa,_0x18e061,_0x353692),0x0;}catch(_0xfb54b6){const _0x12fce5=_0xfb54b6 instanceof Error?_0xfb54b6['message']:_0x3fbbe8(0x177);return console[_0x3fbbe8(0x155)](a11_0x21764b[_0x3fbbe8(0x15a)](_0x3fbbe8(0x157)+_0x12fce5)),0x1;}}async[a11_0x5bc901(0x178)](_0x376aaf,_0x4e26e3,_0x3e7d48,_0x1b1041){const _0x42975d=a11_0x5bc901,_0x2ab1aa={'summary':{'todayCredits':_0x3e7d48[_0x42975d(0x174)],'monthCredits':_0x3e7d48[_0x42975d(0x15e)],'totalCredits':_0x3e7d48[_0x42975d(0x161)],'profileCount':_0x3e7d48[_0x42975d(0x17a)]},'profiles':_0x376aaf['map'](_0xd24482=>({'profile':_0xd24482[_0x42975d(0x141)],'credits':_0xd24482[_0x42975d(0x166)],'requests':_0xd24482['entryCount'],'lastUsedAt':_0xd24482[_0x42975d(0x16b)]})),'sources':_0x4e26e3[_0x42975d(0x172)](_0x2d42ae=>({'source':_0x2d42ae[_0x42975d(0x14d)],'credits':_0x2d42ae[_0x42975d(0x166)],'todayCredits':_0x2d42ae['todayCredits'],'monthCredits':_0x2d42ae[_0x42975d(0x15e)],'requests':_0x2d42ae[_0x42975d(0x14c)]}))};await handleSDKOutput([_0x2ab1aa],_0x1b1041);}[a11_0x5bc901(0x148)](_0x9171b2,_0x1bf115,_0x4fc61b){const _0x11bd21=a11_0x5bc901;console[_0x11bd21(0x153)](a11_0x21764b[_0x11bd21(0x175)](_0x11bd21(0x13a))),console[_0x11bd21(0x153)](a11_0x21764b[_0x11bd21(0x14e)]('─'['repeat'](0x32))),console[_0x11bd21(0x153)](_0x11bd21(0x162)+a11_0x21764b[_0x11bd21(0x14f)](formatCredits(_0x4fc61b[_0x11bd21(0x174)]))+_0x11bd21(0x14b)),console[_0x11bd21(0x153)]('\x20\x20Month:\x20\x20\x20'+a11_0x21764b[_0x11bd21(0x14f)](formatCredits(_0x4fc61b['monthCredits']))+'\x20credits'),console[_0x11bd21(0x153)](_0x11bd21(0x16a)+a11_0x21764b['cyan'](formatCredits(_0x4fc61b[_0x11bd21(0x161)]))+_0x11bd21(0x14b)),console['log']();if(_0x1bf115[_0x11bd21(0x151)]>0x0){console[_0x11bd21(0x153)](a11_0x21764b[_0x11bd21(0x175)](_0x11bd21(0x17c))),console['log'](a11_0x21764b['dim']('─'[_0x11bd21(0x156)](0x3c)));const _0x2e5d81=0xc,_0x1410d5=0xa,_0x33351b=0xa,_0x328246=0xa;console[_0x11bd21(0x153)]('\x20\x20'+_0x11bd21(0x164)[_0x11bd21(0x16f)](_0x2e5d81)+'\x20\x20'+_0x11bd21(0x169)['padStart'](_0x1410d5)+'\x20\x20'+_0x11bd21(0x147)['padStart'](_0x33351b)+'\x20\x20'+_0x11bd21(0x152)[_0x11bd21(0x171)](_0x328246));for(const _0x2bf420 of _0x1bf115){console[_0x11bd21(0x153)]('\x20\x20'+_0x2bf420[_0x11bd21(0x14d)][_0x11bd21(0x16f)](_0x2e5d81)+'\x20\x20'+a11_0x21764b['cyan'](formatCredits(_0x2bf420['credits'])[_0x11bd21(0x171)](_0x1410d5))+'\x20\x20'+formatCredits(_0x2bf420[_0x11bd21(0x174)])[_0x11bd21(0x171)](_0x33351b)+'\x20\x20'+formatCredits(_0x2bf420[_0x11bd21(0x15e)])[_0x11bd21(0x171)](_0x328246));}console['log']();}if(_0x9171b2['length']===0x0){console[_0x11bd21(0x153)](a11_0x21764b[_0x11bd21(0x14e)](_0x11bd21(0x176))),console['log'](a11_0x21764b['dim'](_0x11bd21(0x140)));return;}console[_0x11bd21(0x153)](a11_0x21764b[_0x11bd21(0x175)](_0x11bd21(0x144))),console[_0x11bd21(0x153)](a11_0x21764b[_0x11bd21(0x14e)]('─'[_0x11bd21(0x156)](0x3c)));const _0xb470f9=Math['max'](0xc,..._0x9171b2[_0x11bd21(0x172)](_0x5d0c61=>_0x5d0c61['profile']===_0x11bd21(0x170)?_0x11bd21(0x160)['length']:_0x5d0c61[_0x11bd21(0x141)]['length'])),_0x572938=0xa,_0x478807=0xa;console[_0x11bd21(0x153)]('\x20\x20'+_0x11bd21(0x15f)[_0x11bd21(0x16f)](_0xb470f9)+'\x20\x20'+_0x11bd21(0x13e)[_0x11bd21(0x171)](_0x572938)+'\x20\x20'+_0x11bd21(0x16c)['padStart'](_0x478807)+'\x20\x20'+_0x11bd21(0x159));for(const _0xe7dffc of _0x9171b2){const _0x38cf84=_0xe7dffc['profile']===_0x11bd21(0x170)?_0x11bd21(0x160):_0xe7dffc[_0x11bd21(0x141)],_0x5a5ac2=_0x38cf84['padEnd'](_0xb470f9),_0x21d393=_0xe7dffc['profile']===_0x11bd21(0x170)?a11_0x21764b['dim'](_0x5a5ac2):_0x5a5ac2;console[_0x11bd21(0x153)]('\x20\x20'+_0x21d393+'\x20\x20'+a11_0x21764b['cyan'](formatCredits(_0xe7dffc[_0x11bd21(0x166)])['padStart'](_0x572938))+'\x20\x20'+String(_0xe7dffc[_0x11bd21(0x14c)])['padStart'](_0x478807)+'\x20\x20'+a11_0x21764b[_0x11bd21(0x14e)](formatLastUsed(_0xe7dffc[_0x11bd21(0x16b)])));}console[_0x11bd21(0x153)](),console[_0x11bd21(0x153)](a11_0x21764b[_0x11bd21(0x14e)]('Note:\x20Credit\x20values\x20are\x20estimates\x20based\x20on\x20token\x20usage.')),console[_0x11bd21(0x153)]();}}
|
package/dist/commands/command.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a12_0x21a9d3=a12_0x2e04;(function(_0x13c05d,_0x92c0ce){const _0x3e99aa=a12_0x2e04,_0x5918b3=_0x13c05d();while(!![]){try{const _0x444702=-parseInt(_0x3e99aa(0xa2))/0x1*(-parseInt(_0x3e99aa(0xbc))/0x2)+parseInt(_0x3e99aa(0x9d))/0x3+-parseInt(_0x3e99aa(0xa3))/0x4+parseInt(_0x3e99aa(0xba))/0x5*(parseInt(_0x3e99aa(0xae))/0x6)+parseInt(_0x3e99aa(0xb7))/0x7*(parseInt(_0x3e99aa(0xb6))/0x8)+parseInt(_0x3e99aa(0x9e))/0x9*(parseInt(_0x3e99aa(0xc4))/0xa)+-parseInt(_0x3e99aa(0x99))/0xb*(parseInt(_0x3e99aa(0xb9))/0xc);if(_0x444702===_0x92c0ce)break;else _0x5918b3['push'](_0x5918b3['shift']());}catch(_0x27fc83){_0x5918b3['push'](_0x5918b3['shift']());}}}(a12_0x562c,0x57163));function a12_0x562c(){const _0x52c93c=['helpText','validateGlobalOptions','limit','10VUXTSo','number','has','Invalid\x20limit\x20value:\x20','.\x20Must\x20be\x20a\x20number.','values','commands','To\x20set\x20up\x20authentication:','1639fkQHwZ','\x0aStack\x20trace:\x0a','getAll','tdx\x20auth\x20setup','1993662wmoXQs','681687pILFDk','error','To\x20check\x20your\x20current\x20auth\x20status:','yellow','31031TwKZib','921456KFcNrI','set','Error:\x20','command','validate','dim','problemDetails','\x27\x20is\x20already\x20registered','Authentication\x20failed','name','run','6ysZBcq','stack','status','get','options','cyan','USER_ERROR','test','8872NWauNI','553oZKarf','Authentication\x20error\x20stack\x20trace:','32040eZImTu','9190HgAPVO','category','10BGvFWj','red','detail','debug','\x20--profile\x20'];a12_0x562c=function(){return _0x52c93c;};return a12_0x562c();}import{validateLimitOption}from'../utils/option-validation.js';function a12_0x2e04(_0x2fd554,_0x36a036){_0x2fd554=_0x2fd554-0x93;const _0x562ce=a12_0x562c();let _0x2e0481=_0x562ce[_0x2fd554];return _0x2e0481;}import{HTTPClientError}from'../sdk/client/http-client.js';import{SDKError,ErrorCategory}from'../sdk/errors.js';import{Logger}from'../utils/logger/index.js';import a12_0x4572ea from'chalk';export function printAuthError(_0x476671,_0x3b3f3b=![],_0x5e2f35){const _0x29e1f0=a12_0x2e04,_0x39244b=_0x476671[_0x29e1f0(0xa9)]?.[_0x29e1f0(0xbe)]||_0x476671['message'];console['error'](a12_0x4572ea[_0x29e1f0(0xbd)](_0x29e1f0(0xab))),console['error'](a12_0x4572ea[_0x29e1f0(0xbd)]('Reason:\x20'+_0x39244b));if(_0x3b3f3b){const _0xfd086e=_0x5e2f35?_0x29e1f0(0xc0)+_0x5e2f35:'';console[_0x29e1f0(0x9f)]('\x0a'+a12_0x4572ea[_0x29e1f0(0xa8)](_0x29e1f0(0x98))),console['error']('\x20\x20'+a12_0x4572ea[_0x29e1f0(0xb3)](_0x29e1f0(0x9c)+_0xfd086e)+'\x0a'),console[_0x29e1f0(0x9f)](''+a12_0x4572ea['dim'](_0x29e1f0(0xa0))),console['error']('\x20\x20'+a12_0x4572ea[_0x29e1f0(0xb3)]('tdx\x20auth'+_0xfd086e));}}export class BaseCommand{[a12_0x21a9d3(0xc2)](_0x36137f){const _0x372418=a12_0x21a9d3,{options:_0x165b49}=_0x36137f,_0x3f9c15=_0x165b49[_0x372418(0xc3)];if(_0x3f9c15!==undefined){const _0x1b65b6=typeof _0x3f9c15===_0x372418(0xc5)?_0x3f9c15:parseInt(_0x3f9c15,0xa);if(isNaN(_0x1b65b6))return _0x372418(0x94)+_0x3f9c15+_0x372418(0x95);const _0x20f5c6=validateLimitOption(_0x1b65b6);if(!_0x20f5c6['isValid'])return _0x20f5c6[_0x372418(0x9f)];_0x36137f[_0x372418(0xb2)][_0x372418(0xc3)]=_0x20f5c6['value'];}return undefined;}[a12_0x21a9d3(0xa7)](_0x47fa1c){return undefined;}async[a12_0x21a9d3(0xad)](_0x445a20){const _0xa42fb6=a12_0x21a9d3;try{const _0x57d720=this[_0xa42fb6(0xc2)](_0x445a20);if(_0x57d720)return console['error'](_0xa42fb6(0xa5)+_0x57d720),0x1;const _0xca5d06=this[_0xa42fb6(0xa7)](_0x445a20);if(_0xca5d06){const _0x285874=/^\s*(Usage|Note|Warning|Error):/i[_0xa42fb6(0xb5)](_0xca5d06);return _0x285874?console[_0xa42fb6(0x9f)](_0xca5d06):console[_0xa42fb6(0x9f)]('Error:\x20'+_0xca5d06),0x1;}const _0x3d002a=await this['execute'](_0x445a20);return _0x3d002a??0x0;}catch(_0x844875){if(_0x844875 instanceof Error){if(_0x844875 instanceof HTTPClientError&&_0x844875[_0xa42fb6(0xb0)]===0x191){const _0x3d32df=_0x445a20[_0xa42fb6(0xb2)]['profile'];printAuthError(_0x844875,!![],_0x3d32df);if(_0x844875[_0xa42fb6(0xaf)]){const _0xcfb8eb=Logger['of'](_0xa42fb6(0xa6));_0xcfb8eb[_0xa42fb6(0xbf)](_0xa42fb6(0xb8)),_0xcfb8eb[_0xa42fb6(0xbf)](_0x844875['stack']);}return 0x1;}console['error'](a12_0x4572ea['red'](_0xa42fb6(0xa5)+_0x844875['message']));_0x844875 instanceof SDKError&&_0x844875[_0xa42fb6(0xc1)]&&console[_0xa42fb6(0x9f)](a12_0x4572ea[_0xa42fb6(0xa1)](_0x844875[_0xa42fb6(0xc1)]));const _0x3eb9e8=_0x844875 instanceof SDKError&&_0x844875[_0xa42fb6(0xbb)]===ErrorCategory[_0xa42fb6(0xb4)];_0x844875[_0xa42fb6(0xaf)]&&!_0x3eb9e8&&console[_0xa42fb6(0x9f)](_0xa42fb6(0x9a)+_0x844875[_0xa42fb6(0xaf)]);}else console[_0xa42fb6(0x9f)](_0xa42fb6(0xa5)+String(_0x844875));return 0x1;}}}export class CommandRegistry{[a12_0x21a9d3(0x97)]=new Map();['register'](_0x474279){const _0xb355d4=a12_0x21a9d3;if(this[_0xb355d4(0x97)]['has'](_0x474279[_0xb355d4(0xac)]))throw new Error('Command\x20\x27'+_0x474279[_0xb355d4(0xac)]+_0xb355d4(0xaa));this[_0xb355d4(0x97)][_0xb355d4(0xa4)](_0x474279[_0xb355d4(0xac)],_0x474279);}[a12_0x21a9d3(0xb1)](_0x53e14b){const _0x5cf577=a12_0x21a9d3;return this[_0x5cf577(0x97)]['get'](_0x53e14b);}[a12_0x21a9d3(0x9b)](){const _0x423d3e=a12_0x21a9d3;return Array['from'](this[_0x423d3e(0x97)][_0x423d3e(0x96)]());}[a12_0x21a9d3(0x93)](_0x1302e3){const _0x711c97=a12_0x21a9d3;return this[_0x711c97(0x97)][_0x711c97(0x93)](_0x1302e3);}}export const registry=new CommandRegistry();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a13_0x168839=a13_0x53b1;(function(_0x199674,_0x4b0863){const _0x4dadf9=a13_0x53b1,_0x5e5f84=_0x199674();while(!![]){try{const _0x1dd0eb=-parseInt(_0x4dadf9(0x1bd))/0x1*(parseInt(_0x4dadf9(0x1e8))/0x2)+parseInt(_0x4dadf9(0x1cd))/0x3*(-parseInt(_0x4dadf9(0x208))/0x4)+-parseInt(_0x4dadf9(0x1c3))/0x5+-parseInt(_0x4dadf9(0x1e9))/0x6+parseInt(_0x4dadf9(0x1a3))/0x7+parseInt(_0x4dadf9(0x1f0))/0x8*(parseInt(_0x4dadf9(0x1ef))/0x9)+parseInt(_0x4dadf9(0x1be))/0xa*(parseInt(_0x4dadf9(0x209))/0xb);if(_0x1dd0eb===_0x4b0863)break;else _0x5e5f84['push'](_0x5e5f84['shift']());}catch(_0x6eb9c1){_0x5e5f84['push'](_0x5e5f84['shift']());}}}(a13_0x24dc,0x1eaa6));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_0xd54a20 from'chalk';function a13_0x24dc(){const _0x3df078=['criteria','options','\x20[record]','409668DJxLvM','table','getOutputSchema','Range:\x20','value','\x0aConnector:\x20','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.','input','filter','enumeration','green','listTypes','legacy_settings','Listing\x20connector\x20types...','legacy','yellow','\x27\x20as\x20connection\x20name\x20→\x20type:\x20','connection:settings','name','site','join','log','label','Resolving\x20connector\x20type\x20or\x20name:\x20','hint','Show\x20connection-level\x20settings\x20(credentials,\x20authentication)','52174yBmRqK','3830lqMObQ','\x20\x20\x20\x20Options:\x20','object','credential','Site:\x20','1247710Lmgeuv','No\x20available\x20fields\x20for\x20this\x20connector','execute','connection:list','Name:\x20','bold','max','Looking\x20up\x20connection:\x20','stringify','push','235266ffqegJ','hidden','\x20\x20\x20\x20Default:\x20','\x0aConnection:\x20','slice','dim','Treating\x20\x27','\x20connector\x20type','title','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','error','output','settings','✔\x20Found\x20','blue','padStart','findByName','Fetching\x20schema\x20for\x20\x27','map','Fetching\x20settings\x20for\x20connector\x20type:\x20','✔\x20Found\x20settings\x20for\x20connector\x20type:\x20','localeCompare','\x20\x20\x20\x20','✔\x20Found\x20schema\x20for\x20connection\x20\x27','type','minimum','\x0aAvailable\x20fields:','2StEFHc','1429086rJhPdA','\x0aNo\x20fields\x20defined\x20in\x20schema','verbose','validate','connection','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.','459WlYjAX','6928USBdmL','\x0aNo\x20credential\x20settings\x20defined','record','properties','\x0aCredential\x20settings:','Options:\x20','✔\x20Resolved\x20\x27','default_value','Listing\x20connections...','List\x20all\x20result\x20output\x20connections','owner','resolve','limit','description','<=\x20','maximum','\x27\x20(type:\x20','\x20-\x20','connection:types','cyan','length','Type:\x20','data','\x27...','8wtoFPa','20669tbKvsi','entries','>=\x20'];a13_0x24dc=function(){return _0x3df078;};return a13_0x24dc();}function normalizeSchemaForDisplay(_0x1491ea){const _0x271ff1=a13_0x53b1,_0x46781e=_0x1491ea[_0x271ff1(0x1f3)]||[],_0x2d8f43=_0x46781e['find'](_0x20a8c4=>_0x20a8c4[_0x271ff1(0x1b5)]==='legacy_settings'&&_0x20a8c4['type']===_0x271ff1(0x1f2)&&_0x20a8c4[_0x271ff1(0x1f3)]);if(_0x2d8f43?.[_0x271ff1(0x1f3)]){const _0x165339=_0x46781e[_0x271ff1(0x1ab)](_0x59d783=>_0x59d783[_0x271ff1(0x1b5)]!==_0x271ff1(0x1b1)&&_0x59d783[_0x271ff1(0x1b5)]!=='legacy_settings');return[..._0x165339,..._0x2d8f43['properties']];}return _0x46781e[_0x271ff1(0x1ab)](_0x2afd34=>_0x2afd34['name']!=='legacy');}function printSchemaFields(_0x2b476c,_0xc1aeff){const _0x511850=a13_0x53b1,_0xe85891='\x20\x20'['repeat'](_0xc1aeff+0x1),_0x3f3a56='\x20\x20'['repeat'](_0xc1aeff+0x2);for(const _0x214f6d of _0x2b476c){if(!_0x214f6d[_0x511850(0x1b5)])continue;const _0xd82aa5=_0x214f6d[_0x511850(0x1e5)]===_0x511850(0x1f2)&&_0x214f6d['properties']&&_0x214f6d[_0x511850(0x1f3)][_0x511850(0x204)]>0x0&&_0x214f6d[_0x511850(0x1b5)]!==_0x511850(0x1af);let _0x4105e5=''+_0xe85891+a13_0xd54a20[_0x511850(0x1ad)](_0x214f6d[_0x511850(0x1b5)]);_0x214f6d[_0x511850(0x1d5)]&&(_0x4105e5+=':\x20'+_0x214f6d[_0x511850(0x1d5)]);if(_0x214f6d[_0x511850(0x1aa)])_0x4105e5+=a13_0xd54a20[_0x511850(0x1d2)]('\x20['+_0x214f6d[_0x511850(0x1aa)]+']');else _0xd82aa5&&(_0x4105e5+=a13_0xd54a20[_0x511850(0x1d2)](_0x511850(0x1a2)));console['log'](_0x4105e5);_0x214f6d['description']&&console[_0x511850(0x1b8)](''+_0x3f3a56+a13_0xd54a20[_0x511850(0x1d2)](_0x214f6d[_0x511850(0x1fd)]));if(_0x214f6d[_0x511850(0x1ac)]){const _0x1309ef=_0x214f6d[_0x511850(0x1ac)][_0x511850(0x1df)](_0x5e84d7=>typeof _0x5e84d7===_0x511850(0x1c0)&&_0x511850(0x1a7)in _0x5e84d7?_0x5e84d7['value']:_0x5e84d7)[_0x511850(0x1b7)](',\x20');console[_0x511850(0x1b8)](_0x3f3a56+_0x511850(0x1f5)+a13_0xd54a20[_0x511850(0x1b2)](_0x1309ef));}_0x214f6d[_0x511850(0x1f7)]!==undefined&&console['log'](_0x3f3a56+'Default:\x20'+a13_0xd54a20[_0x511850(0x1db)](String(_0x214f6d[_0x511850(0x1f7)])));if(_0x214f6d['minimum']!==undefined||_0x214f6d[_0x511850(0x1ff)]!==undefined){const _0x3b219f=_0x214f6d[_0x511850(0x1e6)]!==undefined&&_0x214f6d[_0x511850(0x1ff)]!==undefined?_0x214f6d[_0x511850(0x1e6)]+_0x511850(0x201)+_0x214f6d[_0x511850(0x1ff)]:_0x214f6d[_0x511850(0x1e6)]!==undefined?_0x511850(0x20b)+_0x214f6d['minimum']:_0x511850(0x1fe)+_0x214f6d[_0x511850(0x1ff)];console['log'](_0x3f3a56+_0x511850(0x1a6)+a13_0xd54a20[_0x511850(0x1db)](_0x3b219f));}if(_0x214f6d[_0x511850(0x20c)]){const _0x4b5938=Object['entries'](_0x214f6d[_0x511850(0x20c)])['map'](([_0xeb9bab,_0x49956f])=>_0xeb9bab+'='+JSON[_0x511850(0x1cb)](_0x49956f))[_0x511850(0x1b7)](',\x20');console['log'](''+_0x3f3a56+a13_0xd54a20[_0x511850(0x1d2)]('Show\x20when:\x20'+_0x4b5938));}_0xd82aa5&&_0x214f6d['properties']&&printSchemaFields(_0x214f6d[_0x511850(0x1f3)],_0xc1aeff+0x1);}}export class ConnectionListCommand extends BaseCommand{[a13_0x168839(0x1b5)]=a13_0x168839(0x1c6);[a13_0x168839(0x1fd)]=a13_0x168839(0x1f9);async['execute'](_0x44c5f7){const _0x167a08=a13_0x168839,{options:_0x4724de,tdx:_0x233f5b}=_0x44c5f7;_0x4724de['verbose']&&console[_0x167a08(0x1d7)]('Site:\x20'+_0x4724de[_0x167a08(0x1b6)]);const _0x57acca=resolveLimit(_0x4724de[_0x167a08(0x1fc)],DEFAULT_LISTING_LIMIT),_0x1ad091=await withSpinner(_0x167a08(0x1f8),()=>_0x233f5b[_0x167a08(0x1ed)]['list'](),{'verbose':_0x4724de[_0x167a08(0x1eb)]}),_0x1ed66c=_0x1ad091[_0x167a08(0x206)];console[_0x167a08(0x1d7)](_0x167a08(0x1da)+_0x1ed66c[_0x167a08(0x204)]+'\x20connection'+(_0x1ed66c[_0x167a08(0x204)]!==0x1?'s':''));if(isStructuredFormat(_0x4724de)){const _0x1d2d14=_0x1ed66c[_0x167a08(0x1d1)](0x0,_0x57acca);await handleSDKOutput(_0x1d2d14,{..._0x4724de,'limit':_0x57acca});}else{const _0x41946b=_0x1ed66c[_0x167a08(0x204)]>0x0?Math[_0x167a08(0x1c9)](..._0x1ed66c[_0x167a08(0x1df)](_0x4ef9d6=>_0x4ef9d6[_0x167a08(0x1e5)][_0x167a08(0x204)])):0x0,_0x4154fc=[];for(const _0x5decc9 of _0x1ed66c){const _0x55caf5=a13_0xd54a20[_0x167a08(0x203)](_0x5decc9['type']['padStart'](_0x41946b)),_0x15b6e9=_0x5decc9[_0x167a08(0x1fa)]?.[_0x167a08(0x1b5)]?_0x167a08(0x201)+a13_0xd54a20[_0x167a08(0x1d2)](_0x5decc9[_0x167a08(0x1fa)][_0x167a08(0x1b5)]):'';_0x4154fc[_0x167a08(0x1cc)](_0x55caf5+'\x20\x20'+_0x5decc9[_0x167a08(0x1b5)]+_0x15b6e9);}await writeOutput(_0x4154fc[_0x167a08(0x1b7)]('\x0a'),_0x4724de['output'],_0x167a08(0x1a4));}return 0x0;}}function a13_0x53b1(_0x15fe7a,_0x403ead){_0x15fe7a=_0x15fe7a-0x1a1;const _0x24dc8f=a13_0x24dc();let _0x53b13c=_0x24dc8f[_0x15fe7a];return _0x53b13c;}export class ConnectionShowCommand extends BaseCommand{[a13_0x168839(0x1b5)]='connection:show';['description']='Show\x20connection\x20details';[a13_0x168839(0x1ec)](_0x21cb9e){const _0x261941=a13_0x168839,{args:_0x2aa5b2}=_0x21cb9e;if(!_0x2aa5b2[0x0])return _0x261941(0x1d6);return undefined;}async[a13_0x168839(0x1c5)](_0x2a5e03){const _0x281cfe=a13_0x168839,{options:_0x289d66,args:_0x5196ac,tdx:_0x41095a}=_0x2a5e03,_0x23621d=_0x5196ac[0x0];_0x289d66[_0x281cfe(0x1eb)]&&(console[_0x281cfe(0x1d7)](_0x281cfe(0x1c2)+_0x289d66['site']),console[_0x281cfe(0x1d7)](_0x281cfe(0x1ca)+_0x23621d));const _0x5af374=await withSpinner('Fetching\x20connection\x20\x27'+_0x23621d+_0x281cfe(0x207),()=>_0x41095a[_0x281cfe(0x1ed)][_0x281cfe(0x1fb)](_0x23621d),{'verbose':_0x289d66[_0x281cfe(0x1eb)]}),_0x5b4502=_0x5af374[_0x281cfe(0x206)];return console[_0x281cfe(0x1d7)]('✔\x20Found\x20connection:\x20'+_0x5b4502['name']),await handleSingleObjectOutput(_0x5b4502,_0x289d66),0x0;}}export class ConnectionSchemaCommand extends BaseCommand{[a13_0x168839(0x1b5)]='connection:schema';['description']='Show\x20connector\x20output\x20schema\x20for\x20connector_config\x20validation';['validate'](_0xac2795){const _0x209550=a13_0x168839,{args:_0x2cd574}=_0xac2795;if(!_0x2cd574[0x0])return _0x209550(0x1ee);return undefined;}async[a13_0x168839(0x1c5)](_0x11d4c2){const _0x18d476=a13_0x168839,{options:_0x2304b6,args:_0x431c06,tdx:_0x40c06d}=_0x11d4c2,_0x3c8e66=_0x431c06[0x0];_0x2304b6['verbose']&&(console[_0x18d476(0x1d7)]('Site:\x20'+_0x2304b6[_0x18d476(0x1b6)]),console[_0x18d476(0x1d7)](_0x18d476(0x1ba)+_0x3c8e66));let _0x186b2d=_0x3c8e66,_0x6ae8eb;try{const _0x1e5aa5=await _0x40c06d['connection'][_0x18d476(0x1dd)](_0x3c8e66);_0x1e5aa5&&(_0x186b2d=_0x1e5aa5[_0x18d476(0x1e5)],_0x6ae8eb=_0x1e5aa5[_0x18d476(0x1b5)],_0x2304b6['verbose']&&console[_0x18d476(0x1d7)](_0x18d476(0x1f6)+_0x3c8e66+_0x18d476(0x1b3)+_0x186b2d));}catch{_0x2304b6[_0x18d476(0x1eb)]&&console[_0x18d476(0x1d7)](_0x18d476(0x1d3)+_0x3c8e66+'\x27\x20as\x20connector\x20type');}const _0x271fc2=await withSpinner(_0x18d476(0x1de)+_0x186b2d+_0x18d476(0x207),()=>_0x40c06d[_0x18d476(0x1ed)][_0x18d476(0x1a5)](_0x186b2d),{'verbose':_0x2304b6[_0x18d476(0x1eb)]}),_0x1f1ce4=_0x271fc2[_0x18d476(0x206)];_0x6ae8eb?console[_0x18d476(0x1d7)](_0x18d476(0x1e4)+_0x6ae8eb+_0x18d476(0x200)+_0x186b2d+')'):console['error']('✔\x20Found\x20schema\x20for\x20connector\x20type:\x20'+_0x186b2d);if(isStructuredFormat(_0x2304b6))await handleSingleObjectOutput(_0x1f1ce4,_0x2304b6);else{const _0x5cdaab=normalizeSchemaForDisplay(_0x1f1ce4);_0x6ae8eb?(console['log'](_0x18d476(0x1d0)+a13_0xd54a20['cyan'](_0x6ae8eb)),console[_0x18d476(0x1b8)](_0x18d476(0x205)+a13_0xd54a20[_0x18d476(0x1d2)](_0x186b2d))):console[_0x18d476(0x1b8)]('\x0aConnector:\x20'+a13_0xd54a20[_0x18d476(0x203)](_0x186b2d)),_0x5cdaab[_0x18d476(0x204)]>0x0?(console[_0x18d476(0x1b8)](a13_0xd54a20['bold'](_0x18d476(0x1e7))),printSchemaFields(_0x5cdaab,0x0)):console[_0x18d476(0x1b8)](a13_0xd54a20[_0x18d476(0x1d2)](_0x18d476(0x1ea)));}return 0x0;}}export class ConnectionTypesCommand extends BaseCommand{[a13_0x168839(0x1b5)]=a13_0x168839(0x202);[a13_0x168839(0x1fd)]='List\x20available\x20connector\x20types';async[a13_0x168839(0x1c5)](_0x14526e){const _0x1532ce=a13_0x168839,{options:_0x107f27,tdx:_0x40daea}=_0x14526e;_0x107f27['verbose']&&console[_0x1532ce(0x1d7)](_0x1532ce(0x1c2)+_0x107f27[_0x1532ce(0x1b6)]);const _0x4cb02a=await withSpinner(_0x1532ce(0x1b0),()=>_0x40daea[_0x1532ce(0x1ed)][_0x1532ce(0x1ae)](),{'verbose':_0x107f27[_0x1532ce(0x1eb)]}),_0x41da0e=_0x4cb02a[_0x1532ce(0x206)]['sort']((_0x46cc7b,_0x42358c)=>_0x46cc7b['type'][_0x1532ce(0x1e2)](_0x42358c[_0x1532ce(0x1e5)]));console[_0x1532ce(0x1d7)](_0x1532ce(0x1da)+_0x41da0e[_0x1532ce(0x204)]+_0x1532ce(0x1d4)+(_0x41da0e[_0x1532ce(0x204)]!==0x1?'s':''));if(isStructuredFormat(_0x107f27))await handleSDKOutput(_0x41da0e,_0x107f27);else{const _0x482821=_0x41da0e['length']>0x0?Math['max'](..._0x41da0e[_0x1532ce(0x1df)](_0x292c0c=>_0x292c0c[_0x1532ce(0x1e5)][_0x1532ce(0x204)])):0x0,_0x4070ca=[];for(const _0x1dbcb5 of _0x41da0e){const _0x42cc8e=a13_0xd54a20['cyan'](_0x1dbcb5[_0x1532ce(0x1e5)][_0x1532ce(0x1dc)](_0x482821));_0x4070ca[_0x1532ce(0x1cc)](_0x42cc8e+'\x20\x20'+_0x1dbcb5[_0x1532ce(0x1b5)]);}await writeOutput(_0x4070ca['join']('\x0a'),_0x107f27[_0x1532ce(0x1d8)],_0x1532ce(0x1a4));}return 0x0;}}export class ConnectionSettingsCommand extends BaseCommand{[a13_0x168839(0x1b5)]=a13_0x168839(0x1b4);['description']=a13_0x168839(0x1bc);['validate'](_0xb25350){const _0x5a6ace=a13_0x168839,{args:_0x133c41}=_0xb25350;if(!_0x133c41[0x0])return _0x5a6ace(0x1a9);return undefined;}async[a13_0x168839(0x1c5)](_0x40fc5d){const _0x1d7273=a13_0x168839,{options:_0x31ca73,args:_0x1e1578,tdx:_0x5cdbd9}=_0x40fc5d,_0x5102d3=_0x1e1578[0x0];_0x31ca73[_0x1d7273(0x1eb)]&&(console[_0x1d7273(0x1d7)]('Site:\x20'+_0x31ca73[_0x1d7273(0x1b6)]),console[_0x1d7273(0x1d7)](_0x1d7273(0x1e0)+_0x5102d3));const _0x591053=await withSpinner('Fetching\x20settings\x20for\x20\x27'+_0x5102d3+'\x27...',()=>_0x5cdbd9[_0x1d7273(0x1ed)]['getMetadata'](_0x5102d3),{'verbose':_0x31ca73['verbose']}),_0x40fa30=_0x591053[_0x1d7273(0x206)];console[_0x1d7273(0x1d7)](_0x1d7273(0x1e1)+_0x5102d3);if(isStructuredFormat(_0x31ca73))await handleSingleObjectOutput(_0x40fa30,_0x31ca73);else{console[_0x1d7273(0x1b8)](_0x1d7273(0x1a8)+a13_0xd54a20[_0x1d7273(0x203)](_0x5102d3)),console[_0x1d7273(0x1b8)](_0x1d7273(0x1c7)+_0x40fa30[_0x1d7273(0x1b5)]);const _0x451ddc=_0x40fa30[_0x1d7273(0x1d9)]||[],_0x1778a9=_0x451ddc[_0x1d7273(0x1ab)](_0x239ed5=>_0x239ed5[_0x1d7273(0x1c1)]);_0x1778a9[_0x1d7273(0x204)]>0x0&&(console['log'](a13_0xd54a20[_0x1d7273(0x1c8)](_0x1d7273(0x1f4))),printMetadataSettings(_0x1778a9));let _0x4f661c=![];try{const _0x2917c2=await _0x5cdbd9[_0x1d7273(0x1ed)][_0x1d7273(0x1a5)](_0x5102d3),_0x33fc07=normalizeSchemaForDisplay(_0x2917c2);_0x33fc07[_0x1d7273(0x204)]>0x0&&(console[_0x1d7273(0x1b8)](a13_0xd54a20[_0x1d7273(0x1c8)](_0x1d7273(0x1e7))),printSchemaFields(_0x33fc07,0x0),_0x4f661c=!![]);}catch{const _0x1c4f03=_0x451ddc[_0x1d7273(0x1ab)](_0x3c3e64=>!_0x3c3e64[_0x1d7273(0x1c1)]);_0x1c4f03[_0x1d7273(0x204)]>0x0&&(console[_0x1d7273(0x1b8)](a13_0xd54a20[_0x1d7273(0x1c8)](_0x1d7273(0x1e7))),printMetadataSettings(_0x1c4f03),_0x4f661c=!![]);}!_0x4f661c&&_0x31ca73[_0x1d7273(0x1eb)]&&console[_0x1d7273(0x1d7)](a13_0xd54a20[_0x1d7273(0x1d2)](_0x1d7273(0x1c4))),_0x1778a9[_0x1d7273(0x204)]===0x0&&console[_0x1d7273(0x1b8)](a13_0xd54a20[_0x1d7273(0x1d2)](_0x1d7273(0x1f1)));}return 0x0;}}function printMetadataSettings(_0x22a04f){const _0x3d4029=a13_0x168839;for(const _0x2f5a0b of _0x22a04f){if(!_0x2f5a0b[_0x3d4029(0x1b5)])continue;if(_0x2f5a0b[_0x3d4029(0x1ce)])continue;let _0xab6bd0='\x20\x20'+a13_0xd54a20[_0x3d4029(0x1ad)](_0x2f5a0b['name']);_0x2f5a0b[_0x3d4029(0x1b9)]&&(_0xab6bd0+=':\x20'+_0x2f5a0b[_0x3d4029(0x1b9)]);_0x2f5a0b[_0x3d4029(0x1e5)]&&(_0xab6bd0+=a13_0xd54a20[_0x3d4029(0x1d2)]('\x20['+_0x2f5a0b[_0x3d4029(0x1e5)]+']'));console[_0x3d4029(0x1b8)](_0xab6bd0);_0x2f5a0b[_0x3d4029(0x1bb)]&&console[_0x3d4029(0x1b8)](_0x3d4029(0x1e3)+a13_0xd54a20[_0x3d4029(0x1d2)](_0x2f5a0b[_0x3d4029(0x1bb)]));if(_0x2f5a0b[_0x3d4029(0x1a1)]){const _0x1dd12f=_0x2f5a0b[_0x3d4029(0x1a1)]['map'](_0x219c5e=>_0x219c5e[_0x3d4029(0x1a7)])['join'](',\x20');console[_0x3d4029(0x1b8)](_0x3d4029(0x1bf)+a13_0xd54a20[_0x3d4029(0x1b2)](_0x1dd12f));}_0x2f5a0b[_0x3d4029(0x1f7)]!==undefined&&_0x2f5a0b[_0x3d4029(0x1f7)]!==null&&console['log'](_0x3d4029(0x1cf)+a13_0xd54a20[_0x3d4029(0x1db)](String(_0x2f5a0b[_0x3d4029(0x1f7)])));if(_0x2f5a0b[_0x3d4029(0x20c)]){const _0x124f01=Object[_0x3d4029(0x20a)](_0x2f5a0b[_0x3d4029(0x20c)])[_0x3d4029(0x1df)](([_0x527a74,_0x240f28])=>_0x527a74+'='+JSON[_0x3d4029(0x1cb)](_0x240f28))[_0x3d4029(0x1b7)](',\x20');console['log'](_0x3d4029(0x1e3)+a13_0xd54a20[_0x3d4029(0x1d2)]('Show\x20when:\x20'+_0x124f01));}}}
|
|
1
|
+
const a13_0x5ccb4d=a13_0x3224;(function(_0x7f52d9,_0x3c75e9){const _0x4d22b1=a13_0x3224,_0x5f13e7=_0x7f52d9();while(!![]){try{const _0x18b0e5=-parseInt(_0x4d22b1(0xf1))/0x1*(parseInt(_0x4d22b1(0x11d))/0x2)+parseInt(_0x4d22b1(0x143))/0x3+parseInt(_0x4d22b1(0xf3))/0x4+-parseInt(_0x4d22b1(0x13b))/0x5+parseInt(_0x4d22b1(0x100))/0x6+parseInt(_0x4d22b1(0xea))/0x7*(parseInt(_0x4d22b1(0xf6))/0x8)+-parseInt(_0x4d22b1(0xee))/0x9;if(_0x18b0e5===_0x3c75e9)break;else _0x5f13e7['push'](_0x5f13e7['shift']());}catch(_0x9e1778){_0x5f13e7['push'](_0x5f13e7['shift']());}}}(a13_0x18dc,0x41ab9));import{BaseCommand}from'./command.js';import{handleSDKOutput,handleSingleObjectOutput,isStructuredFormat,writeOutput}from'../core/command-output.js';function a13_0x3224(_0x334a18,_0x94655){_0x334a18=_0x334a18-0xdf;const _0x18dc8e=a13_0x18dc();let _0x322474=_0x18dc8e[_0x334a18];return _0x322474;}import{withSpinner}from'../utils/spinner.js';import{DEFAULT_LISTING_LIMIT,resolveLimit}from'../core/constants.js';import a13_0xc54008 from'chalk';function normalizeSchemaForDisplay(_0x3f0a01){const _0x14f181=a13_0x3224,_0xbb1551=_0x3f0a01[_0x14f181(0x104)]||[],_0xa084ec=_0xbb1551[_0x14f181(0x147)](_0x5faabb=>_0x5faabb[_0x14f181(0xf7)]===_0x14f181(0x115)&&_0x5faabb[_0x14f181(0x102)]===_0x14f181(0x105)&&_0x5faabb['properties']);if(_0xa084ec?.[_0x14f181(0x104)]){const _0x513f81=_0xbb1551[_0x14f181(0xe3)](_0x16e660=>_0x16e660[_0x14f181(0xf7)]!==_0x14f181(0xf9)&&_0x16e660[_0x14f181(0xf7)]!==_0x14f181(0x115));return[..._0x513f81,..._0xa084ec['properties']];}return _0xbb1551['filter'](_0xee4e2=>_0xee4e2[_0x14f181(0xf7)]!=='legacy');}function printSchemaFields(_0x2b002c,_0xb9d6dd){const _0x3e8792=a13_0x3224,_0x5ae243='\x20\x20'[_0x3e8792(0xf5)](_0xb9d6dd+0x1),_0x1a7ae4='\x20\x20'['repeat'](_0xb9d6dd+0x2);for(const _0x3c23bd of _0x2b002c){if(!_0x3c23bd[_0x3e8792(0xf7)])continue;const _0x3ae4fe=_0x3c23bd[_0x3e8792(0x102)]===_0x3e8792(0x105)&&_0x3c23bd[_0x3e8792(0x104)]&&_0x3c23bd['properties'][_0x3e8792(0x12e)]>0x0&&_0x3c23bd[_0x3e8792(0xf7)]!==_0x3e8792(0x115);let _0x408180=''+_0x5ae243+a13_0xc54008[_0x3e8792(0x12a)](_0x3c23bd[_0x3e8792(0xf7)]);_0x3c23bd[_0x3e8792(0x135)]&&(_0x408180+=':\x20'+_0x3c23bd['title']);if(_0x3c23bd['input'])_0x408180+=a13_0xc54008[_0x3e8792(0x103)]('\x20['+_0x3c23bd['input']+']');else _0x3ae4fe&&(_0x408180+=a13_0xc54008['dim'](_0x3e8792(0xe4)));console['log'](_0x408180);_0x3c23bd[_0x3e8792(0xfc)]&&console['log'](''+_0x1a7ae4+a13_0xc54008[_0x3e8792(0x103)](_0x3c23bd['description']));if(_0x3c23bd['enumeration']){const _0x2e15f1=_0x3c23bd[_0x3e8792(0xef)]['map'](_0x5cb5b1=>typeof _0x5cb5b1==='object'&&_0x3e8792(0x101)in _0x5cb5b1?_0x5cb5b1['value']:_0x5cb5b1)[_0x3e8792(0x145)](',\x20');console['log'](_0x1a7ae4+_0x3e8792(0xe0)+a13_0xc54008[_0x3e8792(0x139)](_0x2e15f1));}_0x3c23bd[_0x3e8792(0x120)]!==undefined&&console[_0x3e8792(0x117)](_0x1a7ae4+'Default:\x20'+a13_0xc54008[_0x3e8792(0x10d)](String(_0x3c23bd[_0x3e8792(0x120)])));if(_0x3c23bd[_0x3e8792(0x13e)]!==undefined||_0x3c23bd[_0x3e8792(0xfd)]!==undefined){const _0x2c1d95=_0x3c23bd['minimum']!==undefined&&_0x3c23bd[_0x3e8792(0xfd)]!==undefined?_0x3c23bd['minimum']+_0x3e8792(0x13d)+_0x3c23bd['maximum']:_0x3c23bd['minimum']!==undefined?_0x3e8792(0x108)+_0x3c23bd[_0x3e8792(0x13e)]:'<=\x20'+_0x3c23bd[_0x3e8792(0xfd)];console['log'](_0x1a7ae4+_0x3e8792(0x12b)+a13_0xc54008['blue'](_0x2c1d95));}if(_0x3c23bd[_0x3e8792(0xf2)]){const _0x57265b=Object[_0x3e8792(0x127)](_0x3c23bd[_0x3e8792(0xf2)])[_0x3e8792(0xeb)](([_0xf2a38a,_0x45063f])=>_0xf2a38a+'='+JSON[_0x3e8792(0x149)](_0x45063f))[_0x3e8792(0x145)](',\x20');console[_0x3e8792(0x117)](''+_0x1a7ae4+a13_0xc54008['dim'](_0x3e8792(0x10c)+_0x57265b));}_0x3ae4fe&&_0x3c23bd[_0x3e8792(0x104)]&&printSchemaFields(_0x3c23bd[_0x3e8792(0x104)],_0xb9d6dd+0x1);}}export class ConnectionListCommand extends BaseCommand{[a13_0x5ccb4d(0xf7)]=a13_0x5ccb4d(0xec);[a13_0x5ccb4d(0xfc)]=a13_0x5ccb4d(0x144);async[a13_0x5ccb4d(0x10e)](_0x3bf809){const _0x21225a=a13_0x5ccb4d,{options:_0x55eefb,tdx:_0xf6f4e9}=_0x3bf809;_0x55eefb[_0x21225a(0x111)]&&console['error']('Site:\x20'+_0x55eefb['site']);const _0x3b22e5=resolveLimit(_0x55eefb[_0x21225a(0xe5)],DEFAULT_LISTING_LIMIT),_0x1ffee3=await withSpinner('Listing\x20connections...',()=>_0xf6f4e9[_0x21225a(0x146)][_0x21225a(0x113)](),{'verbose':_0x55eefb['verbose']}),_0x12fd2a=_0x1ffee3[_0x21225a(0x11a)];console[_0x21225a(0x134)]('✔\x20Found\x20'+_0x12fd2a[_0x21225a(0x12e)]+_0x21225a(0x140)+(_0x12fd2a[_0x21225a(0x12e)]!==0x1?'s':''));if(isStructuredFormat(_0x55eefb)){const _0x12a4f0=_0x12fd2a['slice'](0x0,_0x3b22e5);await handleSDKOutput(_0x12a4f0,{..._0x55eefb,'limit':_0x3b22e5});}else{const _0x161233=_0x12fd2a[_0x21225a(0x12e)]>0x0?Math[_0x21225a(0x125)](..._0x12fd2a[_0x21225a(0xeb)](_0x46bbe4=>_0x46bbe4[_0x21225a(0x102)][_0x21225a(0x12e)])):0x0,_0x5d817e=[];for(const _0x1d091a of _0x12fd2a){const _0x30291d=a13_0xc54008[_0x21225a(0x109)](_0x1d091a['type'][_0x21225a(0x123)](_0x161233)),_0x1e385b=_0x1d091a[_0x21225a(0x13f)]?.[_0x21225a(0xf7)]?_0x21225a(0x13d)+a13_0xc54008[_0x21225a(0x103)](_0x1d091a[_0x21225a(0x13f)][_0x21225a(0xf7)]):'';_0x5d817e[_0x21225a(0x112)](_0x30291d+'\x20\x20'+_0x1d091a[_0x21225a(0xf7)]+_0x1e385b);}await writeOutput(_0x5d817e[_0x21225a(0x145)]('\x0a'),_0x55eefb[_0x21225a(0x106)],_0x21225a(0x137));}return 0x0;}}export class ConnectionShowCommand extends BaseCommand{[a13_0x5ccb4d(0xf7)]=a13_0x5ccb4d(0x110);[a13_0x5ccb4d(0xfc)]=a13_0x5ccb4d(0x130);[a13_0x5ccb4d(0x11e)](_0x5d703a){const _0x26d269=a13_0x5ccb4d,{args:_0x10c253}=_0x5d703a;if(!_0x10c253[0x0])return _0x26d269(0x12c);return undefined;}async[a13_0x5ccb4d(0x10e)](_0x1d70e6){const _0x52312b=a13_0x5ccb4d,{options:_0x9115b9,args:_0x31ca76,tdx:_0x284ac3}=_0x1d70e6,_0x2761fd=_0x31ca76[0x0];_0x9115b9[_0x52312b(0x111)]&&(console['error']('Site:\x20'+_0x9115b9[_0x52312b(0x107)]),console[_0x52312b(0x134)](_0x52312b(0xf4)+_0x2761fd));const _0x3fe2b4=await withSpinner(_0x52312b(0x114)+_0x2761fd+_0x52312b(0x119),()=>_0x284ac3[_0x52312b(0x146)]['resolve'](_0x2761fd),{'verbose':_0x9115b9['verbose']}),_0x264f52=_0x3fe2b4[_0x52312b(0x11a)];return console[_0x52312b(0x134)](_0x52312b(0xe2)+_0x264f52[_0x52312b(0xf7)]),await handleSingleObjectOutput(_0x264f52,_0x9115b9),0x0;}}export class ConnectionSchemaCommand extends BaseCommand{['name']=a13_0x5ccb4d(0x126);[a13_0x5ccb4d(0xfc)]=a13_0x5ccb4d(0x148);[a13_0x5ccb4d(0x11e)](_0x4f6539){const _0x21c8cc=a13_0x5ccb4d,{args:_0x6be9dc}=_0x4f6539;if(!_0x6be9dc[0x0])return _0x21c8cc(0xf0);return undefined;}async[a13_0x5ccb4d(0x10e)](_0x2317d5){const _0x2455f6=a13_0x5ccb4d,{options:_0xf1911b,args:_0x144222,tdx:_0x45ccae}=_0x2317d5,_0x21c4ba=_0x144222[0x0];_0xf1911b[_0x2455f6(0x111)]&&(console[_0x2455f6(0x134)](_0x2455f6(0x132)+_0xf1911b[_0x2455f6(0x107)]),console[_0x2455f6(0x134)]('Resolving\x20connector\x20type\x20or\x20name:\x20'+_0x21c4ba));let _0x1004da=_0x21c4ba,_0x17e27f;try{const _0x355236=await _0x45ccae[_0x2455f6(0x146)][_0x2455f6(0x129)](_0x21c4ba);_0x355236&&(_0x1004da=_0x355236[_0x2455f6(0x102)],_0x17e27f=_0x355236[_0x2455f6(0xf7)],_0xf1911b[_0x2455f6(0x111)]&&console['error'](_0x2455f6(0xe6)+_0x21c4ba+'\x27\x20as\x20connection\x20name\x20→\x20type:\x20'+_0x1004da));}catch{_0xf1911b[_0x2455f6(0x111)]&&console['error'](_0x2455f6(0xfa)+_0x21c4ba+_0x2455f6(0xed));}const _0x3f027c=await withSpinner('Fetching\x20schema\x20for\x20\x27'+_0x1004da+_0x2455f6(0x119),()=>_0x45ccae[_0x2455f6(0x146)]['getOutputSchema'](_0x1004da),{'verbose':_0xf1911b[_0x2455f6(0x111)]}),_0xefd5fe=_0x3f027c[_0x2455f6(0x11a)];_0x17e27f?console['error']('✔\x20Found\x20schema\x20for\x20connection\x20\x27'+_0x17e27f+_0x2455f6(0x10a)+_0x1004da+')'):console[_0x2455f6(0x134)](_0x2455f6(0xfb)+_0x1004da);if(isStructuredFormat(_0xf1911b))await handleSingleObjectOutput(_0xefd5fe,_0xf1911b);else{const _0x49d05e=normalizeSchemaForDisplay(_0xefd5fe);_0x17e27f?(console['log'](_0x2455f6(0xe1)+a13_0xc54008[_0x2455f6(0x109)](_0x17e27f)),console[_0x2455f6(0x117)](_0x2455f6(0x142)+a13_0xc54008[_0x2455f6(0x103)](_0x1004da))):console[_0x2455f6(0x117)](_0x2455f6(0x14a)+a13_0xc54008['cyan'](_0x1004da)),_0x49d05e[_0x2455f6(0x12e)]>0x0?(console[_0x2455f6(0x117)](a13_0xc54008[_0x2455f6(0x12f)](_0x2455f6(0xdf))),printSchemaFields(_0x49d05e,0x0)):console[_0x2455f6(0x117)](a13_0xc54008[_0x2455f6(0x103)](_0x2455f6(0x131)));}return 0x0;}}function a13_0x18dc(){const _0x3204ac=['map','connection:list','\x27\x20as\x20connector\x20type','719397Soiwzu','enumeration','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.','27827McOTcJ','criteria','1731568GtaPqg','Looking\x20up\x20connection:\x20','repeat','8LElUlF','name','sort','legacy','Treating\x20\x27','✔\x20Found\x20schema\x20for\x20connector\x20type:\x20','description','maximum','✔\x20Found\x20settings\x20for\x20connector\x20type:\x20','\x20\x20\x20\x20','486648AAwnsI','value','type','dim','properties','record','output','site','>=\x20','cyan','\x27\x20(type:\x20','connection:settings','Show\x20when:\x20','blue','execute','hidden','connection:show','verbose','push','list','Fetching\x20connection\x20\x27','legacy_settings','Fetching\x20settings\x20for\x20\x27','log','Show\x20connection-level\x20settings\x20(credentials,\x20authentication)','\x27...','data','\x20connector\x20type','\x20\x20\x20\x20Options:\x20','26dPrXod','validate','\x0aCredential\x20settings:','default_value','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.','options','padStart','✔\x20Found\x20','max','connection:schema','entries','\x20\x20\x20\x20Default:\x20','findByName','green','Range:\x20','Usage:\x20tdx\x20connection\x20show\x20<name>\x0a\x0aArguments:\x0a\x20\x20<name>\x20\x20\x20\x20Connection\x20name\x0a\x0aExamples:\x0a\x20\x20tdx\x20connection\x20show\x20my-s3-connection\x0a\x20\x20tdx\x20connection\x20show\x20\x22My\x20Salesforce\x20Connection\x22','label','length','bold','Show\x20connection\x20details','\x0aNo\x20fields\x20defined\x20in\x20schema','Site:\x20','Listing\x20connector\x20types...','error','title','Name:\x20','table','hint','yellow','Fetching\x20settings\x20for\x20connector\x20type:\x20','1643095nxVrZg','getOutputSchema','\x20-\x20','minimum','owner','\x20connection','List\x20available\x20connector\x20types','Type:\x20','933270PvMUCU','List\x20all\x20result\x20output\x20connections','join','connection','find','Show\x20connector\x20output\x20schema\x20for\x20connector_config\x20validation','stringify','\x0aConnector:\x20','\x0aAvailable\x20fields:','Options:\x20','\x0aConnection:\x20','✔\x20Found\x20connection:\x20','filter','\x20[record]','limit','✔\x20Resolved\x20\x27','getMetadata','No\x20available\x20fields\x20for\x20this\x20connector','listTypes','1499386YPyMgE'];a13_0x18dc=function(){return _0x3204ac;};return a13_0x18dc();}export class ConnectionTypesCommand extends BaseCommand{[a13_0x5ccb4d(0xf7)]='connection:types';['description']=a13_0x5ccb4d(0x141);async[a13_0x5ccb4d(0x10e)](_0x35dbd6){const _0x26f734=a13_0x5ccb4d,{options:_0x2cb12f,tdx:_0x369762}=_0x35dbd6;_0x2cb12f['verbose']&&console[_0x26f734(0x134)](_0x26f734(0x132)+_0x2cb12f[_0x26f734(0x107)]);const _0x1696b0=await withSpinner(_0x26f734(0x133),()=>_0x369762[_0x26f734(0x146)][_0x26f734(0xe9)](),{'verbose':_0x2cb12f['verbose']}),_0x2179f3=_0x1696b0['data'][_0x26f734(0xf8)]((_0x2b9d87,_0xa5fe99)=>_0x2b9d87[_0x26f734(0x102)]['localeCompare'](_0xa5fe99[_0x26f734(0x102)]));console[_0x26f734(0x134)](_0x26f734(0x124)+_0x2179f3[_0x26f734(0x12e)]+_0x26f734(0x11b)+(_0x2179f3[_0x26f734(0x12e)]!==0x1?'s':''));if(isStructuredFormat(_0x2cb12f))await handleSDKOutput(_0x2179f3,_0x2cb12f);else{const _0x5d6a2f=_0x2179f3[_0x26f734(0x12e)]>0x0?Math[_0x26f734(0x125)](..._0x2179f3[_0x26f734(0xeb)](_0x393174=>_0x393174[_0x26f734(0x102)][_0x26f734(0x12e)])):0x0,_0x1ffe68=[];for(const _0x161877 of _0x2179f3){const _0x570bca=a13_0xc54008[_0x26f734(0x109)](_0x161877[_0x26f734(0x102)][_0x26f734(0x123)](_0x5d6a2f));_0x1ffe68[_0x26f734(0x112)](_0x570bca+'\x20\x20'+_0x161877[_0x26f734(0xf7)]);}await writeOutput(_0x1ffe68['join']('\x0a'),_0x2cb12f[_0x26f734(0x106)],_0x26f734(0x137));}return 0x0;}}export class ConnectionSettingsCommand extends BaseCommand{[a13_0x5ccb4d(0xf7)]=a13_0x5ccb4d(0x10b);[a13_0x5ccb4d(0xfc)]=a13_0x5ccb4d(0x118);[a13_0x5ccb4d(0x11e)](_0xb48d9e){const _0x2ece40=a13_0x5ccb4d,{args:_0x1d0bb3}=_0xb48d9e;if(!_0x1d0bb3[0x0])return _0x2ece40(0x121);return undefined;}async[a13_0x5ccb4d(0x10e)](_0x224c9c){const _0x5dfcb7=a13_0x5ccb4d,{options:_0x17ec12,args:_0x694c3c,tdx:_0x4c56b7}=_0x224c9c,_0x120b60=_0x694c3c[0x0];_0x17ec12['verbose']&&(console[_0x5dfcb7(0x134)](_0x5dfcb7(0x132)+_0x17ec12[_0x5dfcb7(0x107)]),console[_0x5dfcb7(0x134)](_0x5dfcb7(0x13a)+_0x120b60));const _0x526306=await withSpinner(_0x5dfcb7(0x116)+_0x120b60+_0x5dfcb7(0x119),()=>_0x4c56b7[_0x5dfcb7(0x146)][_0x5dfcb7(0xe7)](_0x120b60),{'verbose':_0x17ec12['verbose']}),_0x39c4d4=_0x526306[_0x5dfcb7(0x11a)];console[_0x5dfcb7(0x134)](_0x5dfcb7(0xfe)+_0x120b60);if(isStructuredFormat(_0x17ec12))await handleSingleObjectOutput(_0x39c4d4,_0x17ec12);else{console[_0x5dfcb7(0x117)]('\x0aConnector:\x20'+a13_0xc54008[_0x5dfcb7(0x109)](_0x120b60)),console['log'](_0x5dfcb7(0x136)+_0x39c4d4['name']);const _0x1d5150=_0x39c4d4['settings']||[],_0x46183c=_0x1d5150[_0x5dfcb7(0xe3)](_0x56d8fa=>_0x56d8fa['credential']);_0x46183c[_0x5dfcb7(0x12e)]>0x0&&(console[_0x5dfcb7(0x117)](a13_0xc54008[_0x5dfcb7(0x12f)](_0x5dfcb7(0x11f))),printMetadataSettings(_0x46183c));let _0x5ec1a8=![];try{const _0x20f31a=await _0x4c56b7[_0x5dfcb7(0x146)][_0x5dfcb7(0x13c)](_0x120b60),_0x3717e1=normalizeSchemaForDisplay(_0x20f31a);_0x3717e1['length']>0x0&&(console[_0x5dfcb7(0x117)](a13_0xc54008[_0x5dfcb7(0x12f)](_0x5dfcb7(0xdf))),printSchemaFields(_0x3717e1,0x0),_0x5ec1a8=!![]);}catch{const _0x4dbf31=_0x1d5150[_0x5dfcb7(0xe3)](_0x554894=>!_0x554894['credential']);_0x4dbf31[_0x5dfcb7(0x12e)]>0x0&&(console[_0x5dfcb7(0x117)](a13_0xc54008[_0x5dfcb7(0x12f)](_0x5dfcb7(0xdf))),printMetadataSettings(_0x4dbf31),_0x5ec1a8=!![]);}!_0x5ec1a8&&_0x17ec12['verbose']&&console['error'](a13_0xc54008[_0x5dfcb7(0x103)](_0x5dfcb7(0xe8))),_0x46183c['length']===0x0&&console[_0x5dfcb7(0x117)](a13_0xc54008[_0x5dfcb7(0x103)]('\x0aNo\x20credential\x20settings\x20defined'));}return 0x0;}}function printMetadataSettings(_0x48cbcb){const _0x2bfdad=a13_0x5ccb4d;for(const _0x54771f of _0x48cbcb){if(!_0x54771f['name'])continue;if(_0x54771f[_0x2bfdad(0x10f)])continue;let _0x1a740c='\x20\x20'+a13_0xc54008[_0x2bfdad(0x12a)](_0x54771f[_0x2bfdad(0xf7)]);_0x54771f[_0x2bfdad(0x12d)]&&(_0x1a740c+=':\x20'+_0x54771f[_0x2bfdad(0x12d)]);_0x54771f['type']&&(_0x1a740c+=a13_0xc54008[_0x2bfdad(0x103)]('\x20['+_0x54771f[_0x2bfdad(0x102)]+']'));console[_0x2bfdad(0x117)](_0x1a740c);_0x54771f[_0x2bfdad(0x138)]&&console[_0x2bfdad(0x117)](_0x2bfdad(0xff)+a13_0xc54008[_0x2bfdad(0x103)](_0x54771f[_0x2bfdad(0x138)]));if(_0x54771f[_0x2bfdad(0x122)]){const _0x282782=_0x54771f['options'][_0x2bfdad(0xeb)](_0x99e4c8=>_0x99e4c8[_0x2bfdad(0x101)])[_0x2bfdad(0x145)](',\x20');console['log'](_0x2bfdad(0x11c)+a13_0xc54008['yellow'](_0x282782));}_0x54771f['default_value']!==undefined&&_0x54771f[_0x2bfdad(0x120)]!==null&&console[_0x2bfdad(0x117)](_0x2bfdad(0x128)+a13_0xc54008[_0x2bfdad(0x10d)](String(_0x54771f['default_value'])));if(_0x54771f['criteria']){const _0x499c40=Object[_0x2bfdad(0x127)](_0x54771f[_0x2bfdad(0xf2)])[_0x2bfdad(0xeb)](([_0x188404,_0x4ca121])=>_0x188404+'='+JSON[_0x2bfdad(0x149)](_0x4ca121))[_0x2bfdad(0x145)](',\x20');console[_0x2bfdad(0x117)](_0x2bfdad(0xff)+a13_0xc54008['dim'](_0x2bfdad(0x10c)+_0x499c40));}}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a14_0x2bda73=a14_0x1942;(function(_0x1e406a,_0xb0541b){const _0x473c36=a14_0x1942,_0x36147f=_0x1e406a();while(!![]){try{const _0x1135eb=-parseInt(_0x473c36(0x101))/0x1+-parseInt(_0x473c36(0x110))/0x2*(-parseInt(_0x473c36(0x105))/0x3)+parseInt(_0x473c36(0xff))/0x4*(-parseInt(_0x473c36(0x108))/0x5)+-parseInt(_0x473c36(0xfe))/0x6+parseInt(_0x473c36(0x10d))/0x7*(parseInt(_0x473c36(0x117))/0x8)+-parseInt(_0x473c36(0x116))/0x9+-parseInt(_0x473c36(0x10b))/0xa*(-parseInt(_0x473c36(0x107))/0xb);if(_0x1135eb===_0xb0541b)break;else _0x36147f['push'](_0x36147f['shift']());}catch(_0x4ee709){_0x36147f['push'](_0x36147f['shift']());}}}(a14_0x4d9a,0xf359e));import{BaseCommand}from'./command.js';function a14_0x1942(_0x3a7bc9,_0x54430c){_0x3a7bc9=_0x3a7bc9-0xfe;const _0x4d9aaa=a14_0x4d9a();let _0x19421c=_0x4d9aaa[_0x3a7bc9];return _0x19421c;}function a14_0x4d9a(){const _0x4909ab=['145bXzSef','listDatabases','cause','4010LiWYLY','\x20database','1150898VGfomf','\x20\x20Cause:\x20','Pattern:\x20','4atLhit','message','Listing\x20databases...','databases','site','limit','10900656yiDVUj','72TFWctN','length','error','10355364tJDGcL','187852qWeCLz','verbose','555052Edphaf','description','List\x20all\x20databases','name','2554866EHnrte','Site:\x20','73183CrBrEu'];a14_0x4d9a=function(){return _0x4909ab;};return a14_0x4d9a();}import{SDKError}from'../sdk/index.js';import{handleSDKOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import{DEFAULT_LISTING_LIMIT,resolveLimit}from'../core/constants.js';export class DatabasesCommand extends BaseCommand{[a14_0x2bda73(0x104)]=a14_0x2bda73(0x113);[a14_0x2bda73(0x102)]=a14_0x2bda73(0x103);async['execute'](_0x5d267e){const _0x2b1d7b=a14_0x2bda73,{options:_0x3645fa,args:_0x1d8242,tdx:_0x27efa1}=_0x5d267e,_0x1aed63=_0x1d8242[0x0];try{_0x3645fa[_0x2b1d7b(0x100)]&&(console[_0x2b1d7b(0x119)](_0x2b1d7b(0x106)+_0x3645fa[_0x2b1d7b(0x114)]),_0x1aed63&&console[_0x2b1d7b(0x119)](_0x2b1d7b(0x10f)+_0x1aed63));const _0x3ce3ac=resolveLimit(_0x3645fa[_0x2b1d7b(0x115)],DEFAULT_LISTING_LIMIT),_0x55491b=await withSpinner(_0x2b1d7b(0x112),()=>_0x27efa1['query'][_0x2b1d7b(0x109)](_0x1aed63,_0x3ce3ac),{'verbose':_0x3645fa[_0x2b1d7b(0x100)]}),_0x35ef00=_0x55491b['data'];return console[_0x2b1d7b(0x119)]('✔\x20Found\x20'+_0x35ef00[_0x2b1d7b(0x118)]+_0x2b1d7b(0x10c)+(_0x35ef00['length']!==0x1?'s':'')),await handleSDKOutput(_0x35ef00,{..._0x3645fa,'limit':_0x3ce3ac}),0x0;}catch(_0xaa40a6){if(_0xaa40a6 instanceof SDKError)return console['error']('Error:\x20'+_0xaa40a6[_0x2b1d7b(0x111)]),_0xaa40a6[_0x2b1d7b(0x10a)]&&console[_0x2b1d7b(0x119)](_0x2b1d7b(0x10e)+_0xaa40a6[_0x2b1d7b(0x10a)]),0x1;throw _0xaa40a6;}}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
function a15_0x4ba4(){const _0x5b7f11=['3492828LYRrpF','\x20\x20Cause:\x20','verbose','validate','args','describe','describeTable','error','24284170qenjsz','370456zHGLiw','Describing\x20table\x20','✖\x20Table\x20not\x20found','291OZKJpn','\x20in\x20','806089iXzKfh','data','70vQQZEs','Site:\x20','database','Error:\x20','8367588WjsSih','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','15338SZgxSo','Database:\x20','query','execute','length','224205vpJohA','site','76YvieVN','Table:\x20','Table\x20\x27','...','11eOGlRk','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','message','✔\x20Found\x20','cause','name'];a15_0x4ba4=function(){return _0x5b7f11;};return a15_0x4ba4();}const a15_0x44e169=a15_0x453c;(function(_0x4241d0,_0x1e8d15){const _0x4b160=a15_0x453c,_0x1569fc=_0x4241d0();while(!![]){try{const _0xd469b9=-parseInt(_0x4b160(0x18d))/0x1+-parseInt(_0x4b160(0x195))/0x2*(parseInt(_0x4b160(0x18b))/0x3)+-parseInt(_0x4b160(0x19c))/0x4*(-parseInt(_0x4b160(0x19a))/0x5)+-parseInt(_0x4b160(0x1a6))/0x6+-parseInt(_0x4b160(0x18f))/0x7*(-parseInt(_0x4b160(0x188))/0x8)+-parseInt(_0x4b160(0x193))/0x9+-parseInt(_0x4b160(0x187))/0xa*(-parseInt(_0x4b160(0x1a0))/0xb);if(_0xd469b9===_0x1e8d15)break;else _0x1569fc['push'](_0x1569fc['shift']());}catch(_0x4d2b87){_0x1569fc['push'](_0x1569fc['shift']());}}}(a15_0x4ba4,0xa668e));import{BaseCommand}from'./command.js';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';function a15_0x453c(_0x414671,_0x3e604d){_0x414671=_0x414671-0x185;const _0x4ba41e=a15_0x4ba4();let _0x453cb7=_0x4ba41e[_0x414671];return _0x453cb7;}export class DescribeCommand extends BaseCommand{[a15_0x44e169(0x1a5)]=a15_0x44e169(0x1ab);['description']='Describe\x20table\x20schema';async[a15_0x44e169(0x198)](_0x5adf7b){const _0x3253ab=a15_0x44e169;return this[_0x3253ab(0x185)](_0x5adf7b);}async[a15_0x44e169(0x185)](_0x5ae66a){const _0x2f8fa4=a15_0x44e169,{options:_0x74003c,args:_0x47619b,tdx:_0x459e03}=_0x5ae66a;let _0x31b7fb;try{_0x31b7fb=parseTableReference(_0x47619b[0x0]);const _0x49e0a6=_0x74003c[_0x2f8fa4(0x191)];!_0x31b7fb['database']&&_0x49e0a6&&(_0x31b7fb[_0x2f8fa4(0x191)]=_0x49e0a6);const _0x43b897=validateTableDescribeReference(_0x31b7fb);if(_0x43b897)return console['error'](_0x2f8fa4(0x192)+_0x43b897),0x1;}catch(_0x3efa59){return console[_0x2f8fa4(0x186)](_0x2f8fa4(0x192)+_0x3efa59[_0x2f8fa4(0x1a2)]),0x1;}const _0x56f676=_0x31b7fb[_0x2f8fa4(0x191)],_0x51fc8a=_0x31b7fb['table'];try{_0x74003c[_0x2f8fa4(0x1a8)]&&(console[_0x2f8fa4(0x186)](_0x2f8fa4(0x190)+_0x74003c[_0x2f8fa4(0x19b)]),console[_0x2f8fa4(0x186)](_0x2f8fa4(0x196)+_0x56f676),console[_0x2f8fa4(0x186)](_0x2f8fa4(0x19d)+_0x51fc8a));const _0x4791d1=await withSpinner(_0x2f8fa4(0x189)+_0x56f676+'.'+_0x51fc8a+_0x2f8fa4(0x19f),()=>_0x459e03[_0x2f8fa4(0x197)][_0x2f8fa4(0x185)](_0x56f676,_0x51fc8a),{'verbose':_0x74003c[_0x2f8fa4(0x1a8)]}),_0x1a25b0=_0x4791d1[_0x2f8fa4(0x18e)];if(_0x1a25b0[_0x2f8fa4(0x199)]===0x0)return console['error'](_0x2f8fa4(0x18a)),console[_0x2f8fa4(0x186)](_0x2f8fa4(0x19e)+_0x56f676+'.'+_0x51fc8a+'\x27\x20does\x20not\x20exist'),0x1;return console[_0x2f8fa4(0x186)](_0x2f8fa4(0x1a3)+_0x1a25b0[_0x2f8fa4(0x199)]+'\x20column'+(_0x1a25b0['length']!==0x1?'s':'')+_0x2f8fa4(0x18c)+_0x56f676+'.'+_0x51fc8a),await handleSDKOutput(_0x1a25b0,_0x74003c),0x0;}catch(_0x5caacc){if(_0x5caacc instanceof SDKError)return console[_0x2f8fa4(0x186)](_0x2f8fa4(0x192)+_0x5caacc[_0x2f8fa4(0x1a2)]),_0x5caacc['cause']&&console[_0x2f8fa4(0x186)](_0x2f8fa4(0x1a7)+_0x5caacc[_0x2f8fa4(0x1a4)]),0x1;throw _0x5caacc;}}[a15_0x44e169(0x1a9)](_0x30569d){const _0x18c847=a15_0x44e169;if(_0x30569d[_0x18c847(0x1aa)][_0x18c847(0x199)]===0x0)return _0x18c847(0x194);if(_0x30569d[_0x18c847(0x1aa)][_0x18c847(0x199)]>0x1)return _0x18c847(0x1a1);return undefined;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a16_0x294be6=a16_0x1deb;(function(_0x2ee72d,_0x5f36f0){const _0x114b81=a16_0x1deb,_0x5f4d30=_0x2ee72d();while(!![]){try{const _0x1f7fa7=parseInt(_0x114b81(0x17d))/0x1+parseInt(_0x114b81(0x148))/0x2+-parseInt(_0x114b81(0x150))/0x3*(parseInt(_0x114b81(0x158))/0x4)+parseInt(_0x114b81(0x17f))/0x5*(parseInt(_0x114b81(0x168))/0x6)+-parseInt(_0x114b81(0x125))/0x7+-parseInt(_0x114b81(0x139))/0x8+-parseInt(_0x114b81(0x181))/0x9*(parseInt(_0x114b81(0x116))/0xa);if(_0x1f7fa7===_0x5f36f0)break;else _0x5f4d30['push'](_0x5f4d30['shift']());}catch(_0x3b3e23){_0x5f4d30['push'](_0x5f4d30['shift']());}}}(a16_0x101b,0x5764e));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(_0x58cc31,_0x5ca644,_0x2c1f31=![]){const _0x53cfcd=a16_0x1deb;if(_0x58cc31[_0x53cfcd(0x12c)])return await _0x5ca644[_0x53cfcd(0xf8)][_0x53cfcd(0x161)](_0x58cc31[_0x53cfcd(0x12c)]);const _0x345592=loadSessionContext(_0x58cc31['session']);if(_0x345592?.['engage_workspace'])return await _0x5ca644[_0x53cfcd(0xf8)]['resolveWorkspaceId'](_0x345592[_0x53cfcd(0x14f)]);if(_0x2c1f31)throw new SDKError(ErrorCode[_0x53cfcd(0x123)],_0x53cfcd(0x179),undefined,{'helpText':'Use\x20--workspace\x20<name>\x20or\x20set\x20with\x20\x22tdx\x20use\x20engage_workspace\x20<name>\x22'});return undefined;}async function resolveSegmentFromOptions(_0x3f0e3b,_0x147d0){const _0x216a84=a16_0x1deb;if(!_0x3f0e3b['segment'])return{};const _0x29f468=_0x3f0e3b['segment'],_0x2920c7=await _0x147d0['segment'][_0x216a84(0xfc)](_0x29f468);return{'audienceId':_0x2920c7[_0x216a84(0x10d)],'audienceName':_0x2920c7[_0x216a84(0xf3)],..._0x2920c7[_0x216a84(0x13c)]&&{'segmentId':_0x2920c7[_0x216a84(0x13c)],'segmentName':_0x2920c7[_0x216a84(0x163)]}};}function buildConnectorConfig(_0x11dc37){const _0x12def5=a16_0x1deb,_0x454648=_0x11dc37[_0x12def5(0x15e)],_0x656439=_0x11dc37[_0x12def5(0x10c)];if(!_0x454648&&!_0x656439)return undefined;return{..._0x454648&&{'emailSenderId':_0x454648},..._0x656439&&{'jsonColumns':_0x656439}};}export class EngageCampaignsCommand extends BaseCommand{[a16_0x294be6(0x162)]=a16_0x294be6(0x136);[a16_0x294be6(0x109)]=a16_0x294be6(0x12b);async['execute'](_0x4bc652){const _0x194ef6=a16_0x294be6,{options:_0x347ae5,args:_0x3a103c,tdx:_0x5c02f8}=_0x4bc652,_0x359efb=_0x3a103c[0x0],_0x5f4355=resolveLimit(_0x347ae5[_0x194ef6(0x13d)],DEFAULT_LLM_LIMIT),_0x15f75d=_0x347ae5,_0xd1df9f=_0x15f75d[_0x194ef6(0x130)],_0x349cb1=_0x15f75d[_0x194ef6(0x156)],_0xc94d29=await resolveWorkspaceIdFromOptions(_0x15f75d,_0x5c02f8),_0x2e3f28=await withSpinner(_0x194ef6(0x105),()=>_0x5c02f8[_0x194ef6(0xf8)][_0x194ef6(0x184)]({'type':_0xd1df9f,'status':_0x349cb1,'workspaceId':_0xc94d29,'limit':_0x5f4355}),{'verbose':_0x347ae5['verbose']});let _0xb217b3=_0x2e3f28['data'];return _0x359efb&&(_0xb217b3=_0x2e3f28[_0x194ef6(0x11a)][_0x194ef6(0xfe)](_0x460857=>matchGlobPattern(_0x460857['name'],_0x359efb))),await handleSDKOutput(_0xb217b3,_0x347ae5),0x0;}}export class EngageCampaignShowCommand extends BaseCommand{['name']=a16_0x294be6(0x164);[a16_0x294be6(0x109)]=a16_0x294be6(0x113);async[a16_0x294be6(0x17e)](_0x390c07){const _0x1281e2=a16_0x294be6,{options:_0x11001d,args:_0xe7eea0,tdx:_0xb8eeba}=_0x390c07;if(_0xe7eea0[_0x1281e2(0x11c)]===0x0)return console[_0x1281e2(0x15c)](_0x1281e2(0x132)),console['error'](_0x1281e2(0x13f)),0x1;const _0x301ed1=_0xe7eea0[0x0],_0xe934f4=_0x11001d,_0x49dcd6=await resolveWorkspaceIdFromOptions(_0xe934f4,_0xb8eeba),_0x4740d1=_0xe934f4[_0x1281e2(0x160)];if(_0x4740d1){const _0x3cded5=await withSpinner(_0x1281e2(0x126)+_0x301ed1+_0x1281e2(0x14a),()=>_0xb8eeba[_0x1281e2(0xf8)]['getCampaignFull'](_0x301ed1,_0x49dcd6),{'verbose':_0x11001d['verbose']});await handleSDKOutput([_0x3cded5],_0x11001d);}else{const _0x3103dc=await withSpinner(_0x1281e2(0x126)+_0x301ed1+_0x1281e2(0x14a),()=>_0xb8eeba[_0x1281e2(0xf8)][_0x1281e2(0x120)](_0x301ed1,_0x49dcd6),{'verbose':_0x11001d[_0x1281e2(0x14e)]});await handleSDKOutput([_0x3103dc],_0x11001d);}return 0x0;}}export class EngageCampaignCreateCommand extends BaseCommand{[a16_0x294be6(0x162)]=a16_0x294be6(0xf6);[a16_0x294be6(0x109)]=a16_0x294be6(0x13a);async['execute'](_0x2843c6){const _0x5cf26e=a16_0x294be6,{options:_0x43917f,tdx:_0x3d76ca}=_0x2843c6,_0x3da1c8=_0x43917f,_0x59b3ec=_0x3da1c8[_0x5cf26e(0x162)],_0x4c6999=_0x3da1c8['type'];if(!_0x59b3ec)return console[_0x5cf26e(0x15c)](_0x5cf26e(0x14c)),console[_0x5cf26e(0x15c)]('Usage:\x20tdx\x20engage\x20campaign\x20create\x20--name\x20<name>\x20--type\x20<email|push>'),0x1;if(!_0x4c6999)return console[_0x5cf26e(0x15c)]('Error:\x20--type\x20is\x20required\x20(email\x20or\x20push)'),console[_0x5cf26e(0x15c)](_0x5cf26e(0x12a)),0x1;const _0x394f2b=await resolveWorkspaceIdFromOptions(_0x3da1c8,_0x3d76ca,!![]),_0x2fdc21=await resolveSegmentFromOptions(_0x3da1c8,_0x3d76ca),_0x3020f6=buildConnectorConfig(_0x3da1c8),_0x48c7e1={'name':_0x59b3ec,'campaignType':_0x4c6999,'workspaceId':_0x394f2b,'description':_0x3da1c8['description'],..._0x2fdc21,'connectorConfig':_0x3020f6,'startAt':_0x3da1c8[_0x5cf26e(0x117)],'timezone':_0x3da1c8['timezone']},_0x590359=await withSpinner('Creating\x20campaign\x20\x27'+_0x59b3ec+'\x27...',()=>_0x3d76ca['engage'][_0x5cf26e(0xf9)](_0x48c7e1));return await handleSDKOutput([_0x590359[_0x5cf26e(0x11a)]],_0x43917f),0x0;}}export class EngageCampaignUpdateCommand extends BaseCommand{[a16_0x294be6(0x162)]=a16_0x294be6(0x147);[a16_0x294be6(0x109)]=a16_0x294be6(0x10b);async[a16_0x294be6(0x17e)](_0x5b30e9){const _0x37bbab=a16_0x294be6,{options:_0x4f2050,args:_0xfecf6e,tdx:_0x2767ed}=_0x5b30e9;if(_0xfecf6e[_0x37bbab(0x11c)]===0x0)return console[_0x37bbab(0x15c)]('Error:\x20Campaign\x20name\x20or\x20ID\x20is\x20required'),console['error'](_0x37bbab(0x157)),0x1;const _0x12cf20=_0xfecf6e[0x0],_0x378be9=_0x4f2050,_0xa95ac1=await resolveWorkspaceIdFromOptions(_0x378be9,_0x2767ed),_0x339a93=await resolveSegmentFromOptions(_0x378be9,_0x2767ed),_0x582d05=buildConnectorConfig(_0x378be9),_0x55e121={'name':_0x378be9['name'],'description':_0x378be9[_0x37bbab(0x109)],..._0x339a93,'connectorConfig':_0x582d05,'startAt':_0x378be9[_0x37bbab(0x117)],'timezone':_0x378be9[_0x37bbab(0x11e)]},_0x584367=Object[_0x37bbab(0x17c)](Object['entries'](_0x55e121)[_0x37bbab(0xfe)](([,_0x4b7e58])=>_0x4b7e58!==undefined));if(Object[_0x37bbab(0x173)](_0x584367)['length']===0x0)return console['error']('Error:\x20At\x20least\x20one\x20field\x20to\x20update\x20is\x20required'),console[_0x37bbab(0x15c)](_0x37bbab(0x180)),0x1;const _0x2bec36=await withSpinner(_0x37bbab(0x11f)+_0x12cf20+'\x27...',()=>_0x2767ed[_0x37bbab(0xf8)][_0x37bbab(0x103)](_0x12cf20,_0x584367,_0xa95ac1),{'verbose':_0x4f2050[_0x37bbab(0x14e)]});return await handleSDKOutput([_0x2bec36[_0x37bbab(0x11a)]],_0x4f2050),0x0;}}export class EngageCampaignDeleteCommand extends BaseCommand{[a16_0x294be6(0x162)]=a16_0x294be6(0x174);[a16_0x294be6(0x109)]=a16_0x294be6(0x155);async['execute'](_0x5f07f7){const _0x4422bf=a16_0x294be6,{options:_0x312a2d,args:_0x26164e,tdx:_0x24e921}=_0x5f07f7;if(_0x26164e[_0x4422bf(0x11c)]===0x0)return console['error'](_0x4422bf(0x132)),console[_0x4422bf(0x15c)](_0x4422bf(0x170)),0x1;const _0xd2fc1=_0x26164e[0x0],_0x4cb446=_0x312a2d,_0x44e5f7=await resolveWorkspaceIdFromOptions(_0x4cb446,_0x24e921);if(!_0x312a2d[_0x4422bf(0x14d)]){const _0x55c111=await confirm('Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20campaign\x20\x27'+_0xd2fc1+_0x4422bf(0x134));if(!_0x55c111)return console[_0x4422bf(0x124)]('Operation\x20cancelled'),0x0;}return await withSpinner(_0x4422bf(0x16a)+_0xd2fc1+'\x27...',()=>_0x24e921['engage'][_0x4422bf(0x12f)](_0xd2fc1,_0x44e5f7),{'verbose':_0x312a2d[_0x4422bf(0x14e)]}),console[_0x4422bf(0x124)](_0x4422bf(0x145)+_0xd2fc1+_0x4422bf(0x100)),0x0;}}export class EngageCampaignLaunchCommand extends BaseCommand{[a16_0x294be6(0x162)]='engage:campaign:launch';['description']=a16_0x294be6(0x167);async[a16_0x294be6(0x17e)](_0x2ba542){const _0x5e22e5=a16_0x294be6,{options:_0x2fc014,args:_0x1d0a02,tdx:_0x53d2a1}=_0x2ba542;if(_0x1d0a02[_0x5e22e5(0x11c)]===0x0)return console['error'](_0x5e22e5(0x132)),console['error'](_0x5e22e5(0x151)),0x1;const _0x548987=_0x1d0a02[0x0],_0x151714=_0x2fc014,_0x318908=await resolveWorkspaceIdFromOptions(_0x151714,_0x53d2a1);return await withSpinner('Launching\x20campaign\x20\x27'+_0x548987+_0x5e22e5(0x14a),()=>_0x53d2a1[_0x5e22e5(0xf8)][_0x5e22e5(0x112)](_0x548987,_0x318908),{'verbose':_0x2fc014[_0x5e22e5(0x14e)]}),console[_0x5e22e5(0x124)](_0x5e22e5(0x145)+_0x548987+_0x5e22e5(0x137)),0x0;}}export class EngageCampaignPauseCommand extends BaseCommand{[a16_0x294be6(0x162)]=a16_0x294be6(0x175);['description']='Pause\x20a\x20campaign';async['execute'](_0x3cc3ce){const _0x4493d9=a16_0x294be6,{options:_0x158e85,args:_0x325dcf,tdx:_0xf70add}=_0x3cc3ce;if(_0x325dcf[_0x4493d9(0x11c)]===0x0)return console['error'](_0x4493d9(0x132)),console[_0x4493d9(0x15c)](_0x4493d9(0x15d)),0x1;const _0x373195=_0x325dcf[0x0],_0x14dfe1=_0x158e85,_0xa1ebf4=await resolveWorkspaceIdFromOptions(_0x14dfe1,_0xf70add);return await withSpinner('Pausing\x20campaign\x20\x27'+_0x373195+'\x27...',()=>_0xf70add[_0x4493d9(0xf8)][_0x4493d9(0x17a)](_0x373195,_0xa1ebf4),{'verbose':_0x158e85['verbose']}),console[_0x4493d9(0x124)](_0x4493d9(0x145)+_0x373195+_0x4493d9(0x108)),0x0;}}export class EngageCampaignResumeCommand extends BaseCommand{['name']=a16_0x294be6(0x118);[a16_0x294be6(0x109)]='Resume\x20a\x20paused\x20campaign';async[a16_0x294be6(0x17e)](_0x548e27){const _0x5de06e=a16_0x294be6,{options:_0x345cab,args:_0x206ab8,tdx:_0x1dc241}=_0x548e27;if(_0x206ab8[_0x5de06e(0x11c)]===0x0)return console['error'](_0x5de06e(0x132)),console[_0x5de06e(0x15c)](_0x5de06e(0x143)),0x1;const _0x360093=_0x206ab8[0x0],_0x244ae0=_0x345cab,_0x954678=await resolveWorkspaceIdFromOptions(_0x244ae0,_0x1dc241);return await withSpinner(_0x5de06e(0x178)+_0x360093+'\x27...',()=>_0x1dc241[_0x5de06e(0xf8)][_0x5de06e(0x128)](_0x360093,_0x954678),{'verbose':_0x345cab[_0x5de06e(0x14e)]}),console[_0x5de06e(0x124)]('Campaign\x20\x27'+_0x360093+_0x5de06e(0x171)),0x0;}}export class EngageCampaignDuplicateCommand extends BaseCommand{[a16_0x294be6(0x162)]=a16_0x294be6(0x154);['description']=a16_0x294be6(0xf4);async[a16_0x294be6(0x17e)](_0x5baed4){const _0x501261=a16_0x294be6,{options:_0x4310f7,args:_0x58fb54,tdx:_0x1e36fd}=_0x5baed4;if(_0x58fb54['length']===0x0)return console[_0x501261(0x15c)](_0x501261(0x132)),console[_0x501261(0x15c)]('Usage:\x20tdx\x20engage\x20campaign\x20duplicate\x20<name-or-id>'),0x1;const _0x6695a6=_0x58fb54[0x0],_0x4a2200=_0x4310f7,_0x1be7c3=await resolveWorkspaceIdFromOptions(_0x4a2200,_0x1e36fd),_0x380c2d=await withSpinner('Duplicating\x20campaign\x20\x27'+_0x6695a6+_0x501261(0x14a),()=>_0x1e36fd[_0x501261(0xf8)][_0x501261(0x13e)](_0x6695a6,_0x1be7c3),{'verbose':_0x4310f7[_0x501261(0x14e)]});return await handleSDKOutput([_0x380c2d[_0x501261(0x11a)]],_0x4310f7),0x0;}}function a16_0x1deb(_0x23d9c8,_0x53a9ac){_0x23d9c8=_0x23d9c8-0xf2;const _0x101bd2=a16_0x101b();let _0x1deb4c=_0x101bd2[_0x23d9c8];return _0x1deb4c;}export class EngageTemplatesCommand extends BaseCommand{['name']='engage:templates';['description']=a16_0x294be6(0x15f);async[a16_0x294be6(0x17e)](_0x1a8486){const _0x72342=a16_0x294be6,{options:_0x4c04e2,args:_0x2cd5cf,tdx:_0x46c0c9}=_0x1a8486,_0x27b599=_0x2cd5cf[0x0],_0x55efec=resolveLimit(_0x4c04e2[_0x72342(0x13d)],DEFAULT_LLM_LIMIT),_0xf689b2=_0x4c04e2,_0xc1c9b3=await resolveWorkspaceIdFromOptions(_0xf689b2,_0x46c0c9),_0x204377=await withSpinner('Fetching\x20templates...',()=>_0x46c0c9[_0x72342(0xf8)][_0x72342(0x129)]({'workspaceId':_0xc1c9b3,'limit':_0x55efec}),{'verbose':_0x4c04e2[_0x72342(0x14e)]});let _0xd0909e=_0x204377[_0x72342(0x11a)];return _0x27b599&&(_0xd0909e=_0x204377[_0x72342(0x11a)]['filter'](_0x3ec65a=>matchGlobPattern(_0x3ec65a[_0x72342(0x162)],_0x27b599))),await handleSDKOutput(_0xd0909e,_0x4c04e2),0x0;}}export class EngageTemplateShowCommand extends BaseCommand{[a16_0x294be6(0x162)]='engage:template:show';[a16_0x294be6(0x109)]='Show\x20email\x20template\x20details';async[a16_0x294be6(0x17e)](_0x2fca50){const _0x5e87ea=a16_0x294be6,{options:_0xb889b2,args:_0x276cbb,tdx:_0x194c02}=_0x2fca50;if(_0x276cbb[_0x5e87ea(0x11c)]===0x0)return console[_0x5e87ea(0x15c)](_0x5e87ea(0xf5)),console[_0x5e87ea(0x15c)](_0x5e87ea(0x149)),0x1;const _0x34a4ea=_0x276cbb[0x0],_0x4e0442=_0xb889b2,_0x147397=await resolveWorkspaceIdFromOptions(_0x4e0442,_0x194c02),_0xee2d8b=_0x4e0442[_0x5e87ea(0x160)];if(_0xee2d8b){const _0x38800d=await withSpinner(_0x5e87ea(0x12e)+_0x34a4ea+'\x27...',()=>_0x194c02['engage'][_0x5e87ea(0x16f)](_0x34a4ea,_0x147397),{'verbose':_0xb889b2['verbose']});await handleSDKOutput([_0x38800d],_0xb889b2);}else{const _0x357b7c=await withSpinner(_0x5e87ea(0x12e)+_0x34a4ea+'\x27...',()=>_0x194c02[_0x5e87ea(0xf8)][_0x5e87ea(0xff)](_0x34a4ea,_0x147397),{'verbose':_0xb889b2['verbose']});await handleSDKOutput([_0x357b7c],_0xb889b2);}return 0x0;}}export class EngageTemplateCreateCommand extends BaseCommand{[a16_0x294be6(0x162)]='engage:template:create';['description']=a16_0x294be6(0x121);async[a16_0x294be6(0x17e)](_0x492670){const _0x471084=a16_0x294be6,{options:_0x39fd06,tdx:_0x2017e5}=_0x492670,_0x2ec434=_0x39fd06,_0x221058=_0x2ec434[_0x471084(0x162)],_0x51ac4a=_0x2ec434['subject'],_0x208dd1=_0x2ec434[_0x471084(0x119)];if(!_0x221058)return console[_0x471084(0x15c)]('Error:\x20--name\x20is\x20required'),console['error']('Usage:\x20tdx\x20engage\x20template\x20create\x20--name\x20<name>\x20--subject\x20<subject>\x20--html\x20<html>'),0x1;if(!_0x51ac4a)return console[_0x471084(0x15c)](_0x471084(0x165)),0x1;if(!_0x208dd1)return console['error']('Error:\x20--html\x20is\x20required'),0x1;const _0x262b76=await resolveWorkspaceIdFromOptions(_0x2ec434,_0x2017e5,!![]),_0x167606={'name':_0x221058,'subjectTemplate':_0x51ac4a,'htmlTemplate':_0x208dd1,'workspaceId':_0x262b76,'plaintextTemplate':_0x2ec434[_0x471084(0x14b)],'editorType':_0x2ec434[_0x471084(0x153)]},_0x3d394c=await withSpinner(_0x471084(0xf7)+_0x221058+_0x471084(0x14a),()=>_0x2017e5['engage'][_0x471084(0x144)](_0x167606));return await handleSDKOutput([_0x3d394c[_0x471084(0x11a)]],_0x39fd06),0x0;}}export class EngageTemplateUpdateCommand extends BaseCommand{['name']=a16_0x294be6(0x10e);['description']=a16_0x294be6(0x135);async[a16_0x294be6(0x17e)](_0x2c0084){const _0x8a720c=a16_0x294be6,{options:_0x4907b2,args:_0x225735,tdx:_0x1167ee}=_0x2c0084;if(_0x225735['length']===0x0)return console[_0x8a720c(0x15c)](_0x8a720c(0xf5)),console[_0x8a720c(0x15c)](_0x8a720c(0x10a)),0x1;const _0x5c3b68=_0x225735[0x0],_0xd50945=_0x4907b2,_0x4f324b=await resolveWorkspaceIdFromOptions(_0xd50945,_0x1167ee),_0xd0da03={'name':_0xd50945[_0x8a720c(0x162)],'subjectTemplate':_0xd50945['subject'],'htmlTemplate':_0xd50945[_0x8a720c(0x119)],'plaintextTemplate':_0xd50945[_0x8a720c(0x14b)]},_0xcb4af3=Object['fromEntries'](Object[_0x8a720c(0x140)](_0xd0da03)['filter'](([,_0x50df4a])=>_0x50df4a!==undefined));if(Object[_0x8a720c(0x173)](_0xcb4af3)[_0x8a720c(0x11c)]===0x0)return console['error'](_0x8a720c(0x159)),console[_0x8a720c(0x15c)](_0x8a720c(0x183)),0x1;const _0x223c07=await withSpinner(_0x8a720c(0x10f)+_0x5c3b68+_0x8a720c(0x14a),()=>_0x1167ee[_0x8a720c(0xf8)]['updateTemplate'](_0x5c3b68,_0xcb4af3,_0x4f324b),{'verbose':_0x4907b2[_0x8a720c(0x14e)]});return await handleSDKOutput([_0x223c07[_0x8a720c(0x11a)]],_0x4907b2),0x0;}}export class EngageTemplateDeleteCommand extends BaseCommand{['name']=a16_0x294be6(0x110);[a16_0x294be6(0x109)]=a16_0x294be6(0x106);async[a16_0x294be6(0x17e)](_0x3230ea){const _0x4efc31=a16_0x294be6,{options:_0x58a480,args:_0x27dc39,tdx:_0x4f9cb1}=_0x3230ea;if(_0x27dc39[_0x4efc31(0x11c)]===0x0)return console[_0x4efc31(0x15c)](_0x4efc31(0xf5)),console['error']('Usage:\x20tdx\x20engage\x20template\x20delete\x20<name-or-id>'),0x1;const _0x39d449=_0x27dc39[0x0],_0x1c255b=_0x58a480,_0x1eaf35=await resolveWorkspaceIdFromOptions(_0x1c255b,_0x4f9cb1);if(!_0x58a480[_0x4efc31(0x14d)]){const _0x200bfb=await confirm(_0x4efc31(0x11b)+_0x39d449+'\x27?\x20This\x20cannot\x20be\x20undone.');if(!_0x200bfb)return console[_0x4efc31(0x124)](_0x4efc31(0x172)),0x0;}return await withSpinner(_0x4efc31(0x104)+_0x39d449+_0x4efc31(0x14a),()=>_0x4f9cb1[_0x4efc31(0xf8)][_0x4efc31(0x127)](_0x39d449,_0x1eaf35),{'verbose':_0x58a480[_0x4efc31(0x14e)]}),console['log'](_0x4efc31(0x17b)+_0x39d449+_0x4efc31(0x100)),0x0;}}export class EngageWorkspacesCommand extends BaseCommand{[a16_0x294be6(0x162)]=a16_0x294be6(0x15b);[a16_0x294be6(0x109)]='List\x20workspaces';async[a16_0x294be6(0x17e)](_0xffee69){const _0x1e2af4=a16_0x294be6,{options:_0xf0fdd8,args:_0x4e37e7,tdx:_0x3c59c9}=_0xffee69,_0x1cde15=_0x4e37e7[0x0],_0x46f64d=resolveLimit(_0xf0fdd8[_0x1e2af4(0x13d)],DEFAULT_LLM_LIMIT),_0x2f1a28=await withSpinner(_0x1e2af4(0x16d),()=>_0x3c59c9['engage'][_0x1e2af4(0x107)]({'limit':_0x46f64d}),{'verbose':_0xf0fdd8[_0x1e2af4(0x14e)]});let _0x4bea6c=_0x2f1a28['data'];return _0x1cde15&&(_0x4bea6c=_0x2f1a28['data'][_0x1e2af4(0xfe)](_0xf99ce5=>matchGlobPattern(_0xf99ce5[_0x1e2af4(0x162)],_0x1cde15))),await handleSDKOutput(_0x4bea6c,_0xf0fdd8),0x0;}}export class EngageWorkspaceShowCommand extends BaseCommand{[a16_0x294be6(0x162)]=a16_0x294be6(0x16e);[a16_0x294be6(0x109)]=a16_0x294be6(0x102);async[a16_0x294be6(0x17e)](_0x56a782){const _0x57d5eb=a16_0x294be6,{options:_0x44bbcb,args:_0x1bfdd5,tdx:_0x1a7a6a}=_0x56a782;if(_0x1bfdd5['length']===0x0)return console[_0x57d5eb(0x15c)](_0x57d5eb(0x133)),console['error'](_0x57d5eb(0x166)),0x1;const _0x56f5f2=_0x1bfdd5[0x0],_0x3ef461=_0x44bbcb,_0x34ba6c=_0x3ef461[_0x57d5eb(0x160)];if(_0x34ba6c){const _0x42a7e9=await withSpinner(_0x57d5eb(0x141)+_0x56f5f2+_0x57d5eb(0x14a),()=>_0x1a7a6a[_0x57d5eb(0xf8)][_0x57d5eb(0x11d)](_0x56f5f2),{'verbose':_0x44bbcb['verbose']});await handleSDKOutput([_0x42a7e9],_0x44bbcb);}else{const _0x370eff=await withSpinner(_0x57d5eb(0x141)+_0x56f5f2+_0x57d5eb(0x14a),()=>_0x1a7a6a[_0x57d5eb(0xf8)][_0x57d5eb(0x13b)](_0x56f5f2),{'verbose':_0x44bbcb['verbose']});await handleSDKOutput([_0x370eff],_0x44bbcb);}return 0x0;}}export class EngageWorkspaceCreateCommand extends BaseCommand{[a16_0x294be6(0x162)]=a16_0x294be6(0x131);[a16_0x294be6(0x109)]=a16_0x294be6(0x177);async['execute'](_0x1283fe){const _0x5ec92a=a16_0x294be6,{options:_0x32f616,tdx:_0x15b0d3}=_0x1283fe,_0x19008f=_0x32f616,_0x3b1b22=_0x19008f[_0x5ec92a(0x162)];if(!_0x3b1b22)return console[_0x5ec92a(0x15c)](_0x5ec92a(0x14c)),console[_0x5ec92a(0x15c)](_0x5ec92a(0x114)),0x1;const _0x3a5362={'name':_0x3b1b22,'description':_0x19008f['description']},_0x192f6d=await withSpinner(_0x5ec92a(0x15a)+_0x3b1b22+_0x5ec92a(0x14a),()=>_0x15b0d3[_0x5ec92a(0xf8)][_0x5ec92a(0x176)](_0x3a5362));return await handleSDKOutput([_0x192f6d[_0x5ec92a(0x11a)]],_0x32f616),0x0;}}export class EngageWorkspaceUpdateCommand extends BaseCommand{[a16_0x294be6(0x162)]='engage:workspace:update';[a16_0x294be6(0x109)]=a16_0x294be6(0x115);async[a16_0x294be6(0x17e)](_0x546ca1){const _0x1eba61=a16_0x294be6,{options:_0x292692,args:_0x374d1e,tdx:_0x528b57}=_0x546ca1;if(_0x374d1e[_0x1eba61(0x11c)]===0x0)return console[_0x1eba61(0x15c)](_0x1eba61(0x133)),console[_0x1eba61(0x15c)](_0x1eba61(0xfd)),0x1;const _0x150fe6=_0x374d1e[0x0],_0x474c86=_0x292692,_0x8dc096={'name':_0x474c86[_0x1eba61(0x162)],'description':_0x474c86[_0x1eba61(0x109)]},_0x4e56a9=Object[_0x1eba61(0x17c)](Object[_0x1eba61(0x140)](_0x8dc096)[_0x1eba61(0xfe)](([,_0x5873c3])=>_0x5873c3!==undefined));if(Object[_0x1eba61(0x173)](_0x4e56a9)['length']===0x0)return console['error'](_0x1eba61(0x159)),console[_0x1eba61(0x15c)](_0x1eba61(0x152)),0x1;const _0xc802ae=await withSpinner('Updating\x20workspace\x20\x27'+_0x150fe6+_0x1eba61(0x14a),()=>_0x528b57['engage'][_0x1eba61(0xf2)](_0x150fe6,_0x4e56a9),{'verbose':_0x292692[_0x1eba61(0x14e)]});return await handleSDKOutput([_0xc802ae[_0x1eba61(0x11a)]],_0x292692),0x0;}}function a16_0x101b(){const _0x5d6f77=['Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20template\x20\x27','length','getWorkspaceFull','timezone','Updating\x20campaign\x20\x27','getCampaign','Create\x20an\x20email\x20template','Set\x20workspace\x20context\x20for\x20Engage\x20commands','MISSING_ARGUMENT','log','35077KXbENX','Fetching\x20campaign\x20\x27','deleteTemplate','resumeCampaign','listTemplates','Usage:\x20tdx\x20engage\x20campaign\x20create\x20--name\x20<name>\x20--type\x20<email|push>','List\x20campaigns','workspace','engage:workspace:delete','Fetching\x20template\x20\x27','deleteCampaign','type','engage:workspace:create','Error:\x20Campaign\x20name\x20or\x20ID\x20is\x20required','Error:\x20Workspace\x20name\x20or\x20ID\x20is\x20required','\x27?\x20This\x20cannot\x20be\x20undone.','Update\x20an\x20email\x20template','engage:campaigns','\x27\x20launched\x20successfully','Error:\x20Workspace\x20name\x20is\x20required','3817776noHHZp','Create\x20a\x20new\x20campaign','getWorkspace','segmentId','limit','duplicateCampaign','Usage:\x20tdx\x20engage\x20campaign\x20show\x20<name-or-id>','entries','Fetching\x20workspace\x20\x27','\x0aTip:\x20Use\x20\x27tdx\x20use\x20--clear\x27\x20to\x20clear\x20session\x20overrides','Usage:\x20tdx\x20engage\x20campaign\x20resume\x20<name-or-id>','createTemplate','Campaign\x20\x27','session','engage:campaign:update','1135836vxIqQj','Usage:\x20tdx\x20engage\x20template\x20show\x20<name-or-id>','\x27...','plaintext','Error:\x20--name\x20is\x20required','yes','verbose','engage_workspace','15eKBecF','Usage:\x20tdx\x20engage\x20campaign\x20launch\x20<name-or-id>','Options:\x20--name,\x20--description','editorType','engage:campaign:duplicate','Delete\x20a\x20campaign','status','Usage:\x20tdx\x20engage\x20campaign\x20update\x20<name-or-id>\x20[--name\x20<new-name>]\x20...','260188gYGKbt','Error:\x20At\x20least\x20one\x20field\x20to\x20update\x20is\x20required','Creating\x20workspace\x20\x27','engage:workspaces','error','Usage:\x20tdx\x20engage\x20campaign\x20pause\x20<name-or-id>','emailSenderId','List\x20email\x20templates','full','resolveWorkspaceId','name','segmentName','engage:campaign:show','Error:\x20--subject\x20is\x20required','Usage:\x20tdx\x20engage\x20workspace\x20show\x20<name-or-id>','Launch\x20a\x20campaign','30EsjgAn','deleteWorkspace','Deleting\x20campaign\x20\x27','Usage:\x20tdx\x20engage\x20workspace\x20delete\x20<name-or-id>','engage:workspace:use','Fetching\x20workspaces...','engage:workspace:show','getTemplateFull','Usage:\x20tdx\x20engage\x20campaign\x20delete\x20<name-or-id>','\x27\x20resumed\x20successfully','Operation\x20cancelled','keys','engage:campaign:delete','engage:campaign:pause','createWorkspace','Create\x20a\x20workspace','Resuming\x20campaign\x20\x27','Workspace\x20is\x20required\x20for\x20this\x20operation','pauseCampaign','Template\x20\x27','fromEntries','648267ZZHHeD','execute','429215GdoMwN','Options:\x20--name,\x20--description,\x20--segment,\x20--email-sender-id,\x20--json-columns,\x20--start-at,\x20--timezone','2159847kLoyId','Deleting\x20workspace\x20\x27','Options:\x20--name,\x20--subject,\x20--html,\x20--plaintext','listCampaigns','updateWorkspace','parentName','Duplicate\x20a\x20campaign','Error:\x20Template\x20name\x20or\x20ID\x20is\x20required','engage:campaign:create','Creating\x20template\x20\x27','engage','createCampaign','Delete\x20a\x20workspace','Verifying\x20workspace\x20\x27','resolvePathToResource','Usage:\x20tdx\x20engage\x20workspace\x20update\x20<name-or-id>\x20[--name\x20<new-name>]\x20...','filter','getTemplate','\x27\x20deleted\x20successfully','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20workspace\x20\x27','Show\x20workspace\x20details','updateCampaign','Deleting\x20template\x20\x27','Fetching\x20campaigns...','Delete\x20an\x20email\x20template','listWorkspaces','\x27\x20paused\x20successfully','description','Usage:\x20tdx\x20engage\x20template\x20update\x20<name-or-id>\x20[--name\x20<new-name>]\x20...','Update\x20a\x20campaign','jsonColumns','parentId','engage:template:update','Updating\x20template\x20\x27','engage:template:delete','Workspace\x20\x27','launchCampaign','Show\x20campaign\x20details','Usage:\x20tdx\x20engage\x20workspace\x20create\x20--name\x20<name>\x20[--description\x20<desc>]','Update\x20a\x20workspace','20zNgGow','startAt','engage:campaign:resume','html','data'];a16_0x101b=function(){return _0x5d6f77;};return a16_0x101b();}export class EngageWorkspaceDeleteCommand extends BaseCommand{[a16_0x294be6(0x162)]=a16_0x294be6(0x12d);[a16_0x294be6(0x109)]=a16_0x294be6(0xfa);async[a16_0x294be6(0x17e)](_0x2aa612){const _0x21e4bb=a16_0x294be6,{options:_0x2763a9,args:_0x353652,tdx:_0x239919}=_0x2aa612;if(_0x353652['length']===0x0)return console['error'](_0x21e4bb(0x133)),console[_0x21e4bb(0x15c)](_0x21e4bb(0x16b)),0x1;const _0x55a9f6=_0x353652[0x0];if(!_0x2763a9[_0x21e4bb(0x14d)]){const _0x39afa6=await confirm(_0x21e4bb(0x101)+_0x55a9f6+_0x21e4bb(0x134));if(!_0x39afa6)return console[_0x21e4bb(0x124)](_0x21e4bb(0x172)),0x0;}return await withSpinner(_0x21e4bb(0x182)+_0x55a9f6+'\x27...',()=>_0x239919[_0x21e4bb(0xf8)][_0x21e4bb(0x169)](_0x55a9f6),{'verbose':_0x2763a9[_0x21e4bb(0x14e)]}),console[_0x21e4bb(0x124)](_0x21e4bb(0x111)+_0x55a9f6+_0x21e4bb(0x100)),0x0;}}export class EngageWorkspaceUseCommand extends BaseCommand{['name']=a16_0x294be6(0x16c);['description']=a16_0x294be6(0x122);async['execute'](_0x4118e2){const _0x4f2ba7=a16_0x294be6,{options:_0x16a05f,args:_0x4142df,tdx:_0x2e87c9}=_0x4118e2;if(_0x4142df[_0x4f2ba7(0x11c)]===0x0)return console[_0x4f2ba7(0x15c)](_0x4f2ba7(0x138)),console[_0x4f2ba7(0x15c)]('Usage:\x20tdx\x20engage\x20workspace\x20use\x20<name>'),0x1;const _0x836762=_0x4142df[0x0];await withSpinner(_0x4f2ba7(0xfb)+_0x836762+'\x27...',()=>_0x2e87c9[_0x4f2ba7(0xf8)][_0x4f2ba7(0x161)](_0x836762));const _0x3cf1a8=_0x16a05f[_0x4f2ba7(0x146)]||undefined;return saveSessionContext({'engage_workspace':_0x836762},_0x3cf1a8),console[_0x4f2ba7(0x124)]('Engage\x20workspace\x20set\x20to:\x20'+_0x836762),console[_0x4f2ba7(0x124)](_0x4f2ba7(0x142)),0x0;}}
|
|
1
|
+
const a16_0x59784c=a16_0x503b;(function(_0x46a86e,_0x1e1f41){const _0x2c7670=a16_0x503b,_0x5b7ef0=_0x46a86e();while(!![]){try{const _0x3a7025=-parseInt(_0x2c7670(0x237))/0x1*(parseInt(_0x2c7670(0x1d3))/0x2)+-parseInt(_0x2c7670(0x235))/0x3*(parseInt(_0x2c7670(0x1ff))/0x4)+-parseInt(_0x2c7670(0x20e))/0x5*(parseInt(_0x2c7670(0x239))/0x6)+-parseInt(_0x2c7670(0x1d8))/0x7*(-parseInt(_0x2c7670(0x1eb))/0x8)+parseInt(_0x2c7670(0x205))/0x9+-parseInt(_0x2c7670(0x1f9))/0xa*(parseInt(_0x2c7670(0x1db))/0xb)+-parseInt(_0x2c7670(0x213))/0xc*(-parseInt(_0x2c7670(0x222))/0xd);if(_0x3a7025===_0x1e1f41)break;else _0x5b7ef0['push'](_0x5b7ef0['shift']());}catch(_0x1be7d7){_0x5b7ef0['push'](_0x5b7ef0['shift']());}}}(a16_0x3017,0x94e12));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';function a16_0x3017(){const _0x276cf7=['Fetching\x20workspace\x20\x27','plaintext','getWorkspace','deleteCampaign','Usage:\x20tdx\x20engage\x20campaign\x20create\x20--name\x20<name>\x20--type\x20<email|push>','engage:campaign:duplicate','Pausing\x20campaign\x20\x27','Launching\x20campaign\x20\x27','7756099fqCyoL','Error:\x20Workspace\x20name\x20is\x20required','deleteTemplate','html','Fetching\x20campaign\x20\x27','launchCampaign','Resume\x20a\x20paused\x20campaign','Usage:\x20tdx\x20engage\x20workspace\x20use\x20<name>','segmentName','Usage:\x20tdx\x20engage\x20workspace\x20show\x20<name-or-id>','Usage:\x20tdx\x20engage\x20template\x20show\x20<name-or-id>','keys','Error:\x20At\x20least\x20one\x20field\x20to\x20update\x20is\x20required','engage:campaigns','Usage:\x20tdx\x20engage\x20campaign\x20launch\x20<name-or-id>','subject','Usage:\x20tdx\x20engage\x20campaign\x20delete\x20<name-or-id>','length','Error:\x20--html\x20is\x20required','240168XvnSKk','Error:\x20Template\x20name\x20or\x20ID\x20is\x20required','1vtZvEI','Resuming\x20campaign\x20\x27','7230OspAEB','Deleting\x20template\x20\x27','Update\x20a\x20campaign','Usage:\x20tdx\x20engage\x20campaign\x20resume\x20<name-or-id>','yes','Campaign\x20\x27','timezone','Usage:\x20tdx\x20engage\x20workspace\x20delete\x20<name-or-id>','List\x20workspaces','engage:workspace:show','engage_workspace','Pause\x20a\x20campaign','editorType','\x27\x20launched\x20successfully','Create\x20a\x20new\x20campaign','Operation\x20cancelled','data','engage:campaign:launch','List\x20email\x20templates','Delete\x20an\x20email\x20template','Error:\x20Workspace\x20name\x20or\x20ID\x20is\x20required','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20template\x20\x27','resolveWorkspaceId','fromEntries','Engage\x20workspace\x20set\x20to:\x20','verbose','MISSING_ARGUMENT','Creating\x20template\x20\x27','Error:\x20--name\x20is\x20required','engage:templates','engage:template:update','Workspace\x20is\x20required\x20for\x20this\x20operation','pauseCampaign','jsonColumns','\x27...','Usage:\x20tdx\x20engage\x20campaign\x20pause\x20<name-or-id>','Usage:\x20tdx\x20engage\x20workspace\x20update\x20<name-or-id>\x20[--name\x20<new-name>]\x20...','getTemplate','1938462BqSazt','getCampaignFull','Create\x20a\x20workspace','Show\x20email\x20template\x20details','session','1358259iKBawK','parentName','Usage:\x20tdx\x20engage\x20campaign\x20update\x20<name-or-id>\x20[--name\x20<new-name>]\x20...','33oHAijE','createWorkspace','createCampaign','Delete\x20a\x20workspace','\x27\x20paused\x20successfully','Error:\x20Campaign\x20name\x20or\x20ID\x20is\x20required','Usage:\x20tdx\x20engage\x20template\x20create\x20--name\x20<name>\x20--subject\x20<subject>\x20--html\x20<html>','listCampaigns','getTemplateFull','engage','\x0aTip:\x20Use\x20\x27tdx\x20use\x20--clear\x27\x20to\x20clear\x20session\x20overrides','execute','updateWorkspace','Usage:\x20tdx\x20engage\x20template\x20update\x20<name-or-id>\x20[--name\x20<new-name>]\x20...','Options:\x20--name,\x20--subject,\x20--html,\x20--plaintext','Options:\x20--name,\x20--description,\x20--segment,\x20--email-sender-id,\x20--json-columns,\x20--start-at,\x20--timezone','40yAtWVI','resolvePathToResource','log','Usage:\x20tdx\x20engage\x20campaign\x20duplicate\x20<name-or-id>','emailSenderId','workspace','limit','\x27?\x20This\x20cannot\x20be\x20undone.','name','Deleting\x20workspace\x20\x27','Template\x20\x27','getCampaign','getWorkspaceFull','engage:campaign:create','2660620aDHeNc','Set\x20workspace\x20context\x20for\x20Engage\x20commands','error','full','Usage:\x20tdx\x20engage\x20workspace\x20create\x20--name\x20<name>\x20[--description\x20<desc>]','filter','36jfJRZx','engage:workspace:create','Create\x20an\x20email\x20template','Fetching\x20template\x20\x27','Update\x20a\x20workspace','Error:\x20--type\x20is\x20required\x20(email\x20or\x20push)','3483738RJykTI','Launch\x20a\x20campaign','Duplicating\x20campaign\x20\x27','createTemplate','\x27\x20deleted\x20successfully','Updating\x20workspace\x20\x27','deleteWorkspace','description','engage:workspace:delete','205ECIAqz','Duplicate\x20a\x20campaign','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20campaign\x20\x27','engage:workspace:use','segmentId','36LrMHEc','engage:template:create','entries','segment','engage:workspace:update','engage:template:show','status'];a16_0x3017=function(){return _0x276cf7;};return a16_0x3017();}import{SDKError,ErrorCode}from'../sdk/errors.js';async function resolveWorkspaceIdFromOptions(_0x5e4e86,_0x1cc460,_0x143321=![]){const _0x23fd12=a16_0x503b;if(_0x5e4e86[_0x23fd12(0x1f0)])return await _0x1cc460[_0x23fd12(0x1e4)][_0x23fd12(0x24f)](_0x5e4e86[_0x23fd12(0x1f0)]);const _0x288954=loadSessionContext(_0x5e4e86[_0x23fd12(0x1d7)]);if(_0x288954?.[_0x23fd12(0x243)])return await _0x1cc460[_0x23fd12(0x1e4)]['resolveWorkspaceId'](_0x288954[_0x23fd12(0x243)]);if(_0x143321)throw new SDKError(ErrorCode[_0x23fd12(0x253)],_0x23fd12(0x258),undefined,{'helpText':'Use\x20--workspace\x20<name>\x20or\x20set\x20with\x20\x22tdx\x20use\x20engage_workspace\x20<name>\x22'});return undefined;}async function resolveSegmentFromOptions(_0x2bd940,_0x186802){const _0xd2a653=a16_0x503b;if(!_0x2bd940['segment'])return{};const _0x12c2be=_0x2bd940[_0xd2a653(0x216)],_0x14c501=await _0x186802['segment'][_0xd2a653(0x1ec)](_0x12c2be);return{'audienceId':_0x14c501['parentId'],'audienceName':_0x14c501[_0xd2a653(0x1d9)],..._0x14c501[_0xd2a653(0x212)]&&{'segmentId':_0x14c501[_0xd2a653(0x212)],'segmentName':_0x14c501[_0xd2a653(0x22a)]}};}function buildConnectorConfig(_0x3ed95f){const _0x41f5ee=a16_0x503b,_0x249940=_0x3ed95f[_0x41f5ee(0x1ef)],_0x24f9a1=_0x3ed95f[_0x41f5ee(0x25a)];if(!_0x249940&&!_0x24f9a1)return undefined;return{..._0x249940&&{'emailSenderId':_0x249940},..._0x24f9a1&&{'jsonColumns':_0x24f9a1}};}export class EngageCampaignsCommand extends BaseCommand{[a16_0x59784c(0x1f3)]=a16_0x59784c(0x22f);['description']='List\x20campaigns';async['execute'](_0x26d5d6){const _0x29277e=a16_0x59784c,{options:_0x8e0dd9,args:_0x2c4b01,tdx:_0xd8b54b}=_0x26d5d6,_0x213f01=_0x2c4b01[0x0],_0x5292e1=resolveLimit(_0x8e0dd9[_0x29277e(0x1f1)],DEFAULT_LLM_LIMIT),_0x92356c=_0x8e0dd9,_0x3995ff=_0x92356c['type'],_0x51e52b=_0x92356c[_0x29277e(0x219)],_0x14470c=await resolveWorkspaceIdFromOptions(_0x92356c,_0xd8b54b),_0x10e60a=await withSpinner('Fetching\x20campaigns...',()=>_0xd8b54b[_0x29277e(0x1e4)][_0x29277e(0x1e2)]({'type':_0x3995ff,'status':_0x51e52b,'workspaceId':_0x14470c,'limit':_0x5292e1}),{'verbose':_0x8e0dd9[_0x29277e(0x252)]});let _0x1f107d=_0x10e60a[_0x29277e(0x249)];return _0x213f01&&(_0x1f107d=_0x10e60a[_0x29277e(0x249)][_0x29277e(0x1fe)](_0x1db5f4=>matchGlobPattern(_0x1db5f4[_0x29277e(0x1f3)],_0x213f01))),await handleSDKOutput(_0x1f107d,_0x8e0dd9),0x0;}}export class EngageCampaignShowCommand extends BaseCommand{[a16_0x59784c(0x1f3)]='engage:campaign:show';['description']='Show\x20campaign\x20details';async['execute'](_0x2ea9c3){const _0x189336=a16_0x59784c,{options:_0xd6a480,args:_0x2a2e83,tdx:_0x5c899b}=_0x2ea9c3;if(_0x2a2e83[_0x189336(0x233)]===0x0)return console[_0x189336(0x1fb)](_0x189336(0x1e0)),console['error']('Usage:\x20tdx\x20engage\x20campaign\x20show\x20<name-or-id>'),0x1;const _0x669e25=_0x2a2e83[0x0],_0xb341d7=_0xd6a480,_0x315b82=await resolveWorkspaceIdFromOptions(_0xb341d7,_0x5c899b),_0x2a5fad=_0xb341d7[_0x189336(0x1fc)];if(_0x2a5fad){const _0x1a8f65=await withSpinner(_0x189336(0x226)+_0x669e25+_0x189336(0x1cf),()=>_0x5c899b['engage'][_0x189336(0x1d4)](_0x669e25,_0x315b82),{'verbose':_0xd6a480[_0x189336(0x252)]});await handleSDKOutput([_0x1a8f65],_0xd6a480);}else{const _0x59d049=await withSpinner(_0x189336(0x226)+_0x669e25+_0x189336(0x1cf),()=>_0x5c899b[_0x189336(0x1e4)][_0x189336(0x1f6)](_0x669e25,_0x315b82),{'verbose':_0xd6a480['verbose']});await handleSDKOutput([_0x59d049],_0xd6a480);}return 0x0;}}export class EngageCampaignCreateCommand extends BaseCommand{['name']=a16_0x59784c(0x1f8);['description']=a16_0x59784c(0x247);async['execute'](_0x5769f8){const _0x4c5cb3=a16_0x59784c,{options:_0xdc1bfa,tdx:_0x3ca10e}=_0x5769f8,_0x59b018=_0xdc1bfa,_0xd16cb9=_0x59b018[_0x4c5cb3(0x1f3)],_0x3200cf=_0x59b018['type'];if(!_0xd16cb9)return console['error'](_0x4c5cb3(0x255)),console[_0x4c5cb3(0x1fb)](_0x4c5cb3(0x21e)),0x1;if(!_0x3200cf)return console[_0x4c5cb3(0x1fb)](_0x4c5cb3(0x204)),console[_0x4c5cb3(0x1fb)](_0x4c5cb3(0x21e)),0x1;const _0x2c2dfd=await resolveWorkspaceIdFromOptions(_0x59b018,_0x3ca10e,!![]),_0x45affb=await resolveSegmentFromOptions(_0x59b018,_0x3ca10e),_0x5328a2=buildConnectorConfig(_0x59b018),_0x3a6248={'name':_0xd16cb9,'campaignType':_0x3200cf,'workspaceId':_0x2c2dfd,'description':_0x59b018[_0x4c5cb3(0x20c)],..._0x45affb,'connectorConfig':_0x5328a2,'startAt':_0x59b018['startAt'],'timezone':_0x59b018[_0x4c5cb3(0x23f)]},_0x27df12=await withSpinner('Creating\x20campaign\x20\x27'+_0xd16cb9+'\x27...',()=>_0x3ca10e[_0x4c5cb3(0x1e4)][_0x4c5cb3(0x1dd)](_0x3a6248));return await handleSDKOutput([_0x27df12[_0x4c5cb3(0x249)]],_0xdc1bfa),0x0;}}export class EngageCampaignUpdateCommand extends BaseCommand{[a16_0x59784c(0x1f3)]='engage:campaign:update';[a16_0x59784c(0x20c)]=a16_0x59784c(0x23b);async[a16_0x59784c(0x1e6)](_0x3e6d9d){const _0x11e629=a16_0x59784c,{options:_0xf7c6a9,args:_0x5ed2ce,tdx:_0x461ab5}=_0x3e6d9d;if(_0x5ed2ce[_0x11e629(0x233)]===0x0)return console[_0x11e629(0x1fb)](_0x11e629(0x1e0)),console[_0x11e629(0x1fb)](_0x11e629(0x1da)),0x1;const _0x4aae21=_0x5ed2ce[0x0],_0x4bc5c7=_0xf7c6a9,_0x5f306c=await resolveWorkspaceIdFromOptions(_0x4bc5c7,_0x461ab5),_0x54acfe=await resolveSegmentFromOptions(_0x4bc5c7,_0x461ab5),_0x4517d9=buildConnectorConfig(_0x4bc5c7),_0x1bf30c={'name':_0x4bc5c7[_0x11e629(0x1f3)],'description':_0x4bc5c7[_0x11e629(0x20c)],..._0x54acfe,'connectorConfig':_0x4517d9,'startAt':_0x4bc5c7['startAt'],'timezone':_0x4bc5c7['timezone']},_0x26a213=Object['fromEntries'](Object['entries'](_0x1bf30c)[_0x11e629(0x1fe)](([,_0x162418])=>_0x162418!==undefined));if(Object[_0x11e629(0x22d)](_0x26a213)[_0x11e629(0x233)]===0x0)return console[_0x11e629(0x1fb)](_0x11e629(0x22e)),console['error'](_0x11e629(0x1ea)),0x1;const _0x376c85=await withSpinner('Updating\x20campaign\x20\x27'+_0x4aae21+'\x27...',()=>_0x461ab5[_0x11e629(0x1e4)]['updateCampaign'](_0x4aae21,_0x26a213,_0x5f306c),{'verbose':_0xf7c6a9[_0x11e629(0x252)]});return await handleSDKOutput([_0x376c85[_0x11e629(0x249)]],_0xf7c6a9),0x0;}}export class EngageCampaignDeleteCommand extends BaseCommand{[a16_0x59784c(0x1f3)]='engage:campaign:delete';['description']='Delete\x20a\x20campaign';async['execute'](_0x5f36a9){const _0x1fb5c8=a16_0x59784c,{options:_0x12671e,args:_0x595423,tdx:_0x4eeb48}=_0x5f36a9;if(_0x595423[_0x1fb5c8(0x233)]===0x0)return console[_0x1fb5c8(0x1fb)](_0x1fb5c8(0x1e0)),console[_0x1fb5c8(0x1fb)](_0x1fb5c8(0x232)),0x1;const _0x516034=_0x595423[0x0],_0x33e385=_0x12671e,_0xfb2c5a=await resolveWorkspaceIdFromOptions(_0x33e385,_0x4eeb48);if(!_0x12671e['yes']){const _0x19b16f=await confirm(_0x1fb5c8(0x210)+_0x516034+_0x1fb5c8(0x1f2));if(!_0x19b16f)return console['log'](_0x1fb5c8(0x248)),0x0;}return await withSpinner('Deleting\x20campaign\x20\x27'+_0x516034+_0x1fb5c8(0x1cf),()=>_0x4eeb48[_0x1fb5c8(0x1e4)][_0x1fb5c8(0x21d)](_0x516034,_0xfb2c5a),{'verbose':_0x12671e[_0x1fb5c8(0x252)]}),console[_0x1fb5c8(0x1ed)](_0x1fb5c8(0x23e)+_0x516034+_0x1fb5c8(0x209)),0x0;}}export class EngageCampaignLaunchCommand extends BaseCommand{[a16_0x59784c(0x1f3)]=a16_0x59784c(0x24a);[a16_0x59784c(0x20c)]=a16_0x59784c(0x206);async[a16_0x59784c(0x1e6)](_0x45a64b){const _0x40a126=a16_0x59784c,{options:_0x405937,args:_0x1a597c,tdx:_0x11df80}=_0x45a64b;if(_0x1a597c['length']===0x0)return console[_0x40a126(0x1fb)](_0x40a126(0x1e0)),console[_0x40a126(0x1fb)](_0x40a126(0x230)),0x1;const _0x498690=_0x1a597c[0x0],_0x5bf651=_0x405937,_0x291617=await resolveWorkspaceIdFromOptions(_0x5bf651,_0x11df80);return await withSpinner(_0x40a126(0x221)+_0x498690+_0x40a126(0x1cf),()=>_0x11df80['engage'][_0x40a126(0x227)](_0x498690,_0x291617),{'verbose':_0x405937[_0x40a126(0x252)]}),console['log'](_0x40a126(0x23e)+_0x498690+_0x40a126(0x246)),0x0;}}export class EngageCampaignPauseCommand extends BaseCommand{[a16_0x59784c(0x1f3)]='engage:campaign:pause';[a16_0x59784c(0x20c)]=a16_0x59784c(0x244);async[a16_0x59784c(0x1e6)](_0x2a5d97){const _0x26a575=a16_0x59784c,{options:_0x2eae1f,args:_0x456e1f,tdx:_0x36acc2}=_0x2a5d97;if(_0x456e1f[_0x26a575(0x233)]===0x0)return console[_0x26a575(0x1fb)](_0x26a575(0x1e0)),console[_0x26a575(0x1fb)](_0x26a575(0x1d0)),0x1;const _0xeb6a3c=_0x456e1f[0x0],_0x3e8d9c=_0x2eae1f,_0x2fa70c=await resolveWorkspaceIdFromOptions(_0x3e8d9c,_0x36acc2);return await withSpinner(_0x26a575(0x220)+_0xeb6a3c+_0x26a575(0x1cf),()=>_0x36acc2['engage'][_0x26a575(0x259)](_0xeb6a3c,_0x2fa70c),{'verbose':_0x2eae1f[_0x26a575(0x252)]}),console[_0x26a575(0x1ed)](_0x26a575(0x23e)+_0xeb6a3c+_0x26a575(0x1df)),0x0;}}export class EngageCampaignResumeCommand extends BaseCommand{[a16_0x59784c(0x1f3)]='engage:campaign:resume';[a16_0x59784c(0x20c)]=a16_0x59784c(0x228);async['execute'](_0x9a0de1){const _0x8847d3=a16_0x59784c,{options:_0xfb91e8,args:_0x2dd0c5,tdx:_0x423c72}=_0x9a0de1;if(_0x2dd0c5[_0x8847d3(0x233)]===0x0)return console[_0x8847d3(0x1fb)](_0x8847d3(0x1e0)),console['error'](_0x8847d3(0x23c)),0x1;const _0x337799=_0x2dd0c5[0x0],_0xc82352=_0xfb91e8,_0x14f595=await resolveWorkspaceIdFromOptions(_0xc82352,_0x423c72);return await withSpinner(_0x8847d3(0x238)+_0x337799+_0x8847d3(0x1cf),()=>_0x423c72[_0x8847d3(0x1e4)]['resumeCampaign'](_0x337799,_0x14f595),{'verbose':_0xfb91e8['verbose']}),console[_0x8847d3(0x1ed)](_0x8847d3(0x23e)+_0x337799+'\x27\x20resumed\x20successfully'),0x0;}}export class EngageCampaignDuplicateCommand extends BaseCommand{[a16_0x59784c(0x1f3)]=a16_0x59784c(0x21f);[a16_0x59784c(0x20c)]=a16_0x59784c(0x20f);async[a16_0x59784c(0x1e6)](_0x1e15b3){const _0x1e0705=a16_0x59784c,{options:_0x5b62fb,args:_0x50e418,tdx:_0x53420a}=_0x1e15b3;if(_0x50e418[_0x1e0705(0x233)]===0x0)return console[_0x1e0705(0x1fb)](_0x1e0705(0x1e0)),console['error'](_0x1e0705(0x1ee)),0x1;const _0x202ae6=_0x50e418[0x0],_0x2293be=_0x5b62fb,_0x5d63f3=await resolveWorkspaceIdFromOptions(_0x2293be,_0x53420a),_0x91a6fb=await withSpinner(_0x1e0705(0x207)+_0x202ae6+'\x27...',()=>_0x53420a[_0x1e0705(0x1e4)]['duplicateCampaign'](_0x202ae6,_0x5d63f3),{'verbose':_0x5b62fb[_0x1e0705(0x252)]});return await handleSDKOutput([_0x91a6fb['data']],_0x5b62fb),0x0;}}export class EngageTemplatesCommand extends BaseCommand{[a16_0x59784c(0x1f3)]=a16_0x59784c(0x256);[a16_0x59784c(0x20c)]=a16_0x59784c(0x24b);async[a16_0x59784c(0x1e6)](_0x50dc7f){const _0x2e7cf4=a16_0x59784c,{options:_0x2fa012,args:_0x4699e1,tdx:_0x2622c7}=_0x50dc7f,_0x177554=_0x4699e1[0x0],_0xa0e4fa=resolveLimit(_0x2fa012[_0x2e7cf4(0x1f1)],DEFAULT_LLM_LIMIT),_0x1dfc49=_0x2fa012,_0x3a8d98=await resolveWorkspaceIdFromOptions(_0x1dfc49,_0x2622c7),_0x255382=await withSpinner('Fetching\x20templates...',()=>_0x2622c7[_0x2e7cf4(0x1e4)]['listTemplates']({'workspaceId':_0x3a8d98,'limit':_0xa0e4fa}),{'verbose':_0x2fa012[_0x2e7cf4(0x252)]});let _0x19c41c=_0x255382[_0x2e7cf4(0x249)];return _0x177554&&(_0x19c41c=_0x255382[_0x2e7cf4(0x249)][_0x2e7cf4(0x1fe)](_0x5cbe08=>matchGlobPattern(_0x5cbe08[_0x2e7cf4(0x1f3)],_0x177554))),await handleSDKOutput(_0x19c41c,_0x2fa012),0x0;}}export class EngageTemplateShowCommand extends BaseCommand{[a16_0x59784c(0x1f3)]=a16_0x59784c(0x218);[a16_0x59784c(0x20c)]=a16_0x59784c(0x1d6);async[a16_0x59784c(0x1e6)](_0xbbf185){const _0x5c690d=a16_0x59784c,{options:_0x44ddb4,args:_0x178ebe,tdx:_0x25e875}=_0xbbf185;if(_0x178ebe[_0x5c690d(0x233)]===0x0)return console[_0x5c690d(0x1fb)](_0x5c690d(0x236)),console[_0x5c690d(0x1fb)](_0x5c690d(0x22c)),0x1;const _0x420fbe=_0x178ebe[0x0],_0x29356f=_0x44ddb4,_0x4fd477=await resolveWorkspaceIdFromOptions(_0x29356f,_0x25e875),_0x3f68fb=_0x29356f[_0x5c690d(0x1fc)];if(_0x3f68fb){const _0x2285e6=await withSpinner(_0x5c690d(0x202)+_0x420fbe+'\x27...',()=>_0x25e875['engage'][_0x5c690d(0x1e3)](_0x420fbe,_0x4fd477),{'verbose':_0x44ddb4['verbose']});await handleSDKOutput([_0x2285e6],_0x44ddb4);}else{const _0x5c6b86=await withSpinner('Fetching\x20template\x20\x27'+_0x420fbe+_0x5c690d(0x1cf),()=>_0x25e875[_0x5c690d(0x1e4)][_0x5c690d(0x1d2)](_0x420fbe,_0x4fd477),{'verbose':_0x44ddb4[_0x5c690d(0x252)]});await handleSDKOutput([_0x5c6b86],_0x44ddb4);}return 0x0;}}export class EngageTemplateCreateCommand extends BaseCommand{[a16_0x59784c(0x1f3)]=a16_0x59784c(0x214);[a16_0x59784c(0x20c)]=a16_0x59784c(0x201);async[a16_0x59784c(0x1e6)](_0x503c4f){const _0x504750=a16_0x59784c,{options:_0x5780db,tdx:_0x15d1e7}=_0x503c4f,_0x4ee99d=_0x5780db,_0x4a8e26=_0x4ee99d['name'],_0x4e75ac=_0x4ee99d[_0x504750(0x231)],_0x11574c=_0x4ee99d[_0x504750(0x225)];if(!_0x4a8e26)return console[_0x504750(0x1fb)](_0x504750(0x255)),console[_0x504750(0x1fb)](_0x504750(0x1e1)),0x1;if(!_0x4e75ac)return console[_0x504750(0x1fb)]('Error:\x20--subject\x20is\x20required'),0x1;if(!_0x11574c)return console[_0x504750(0x1fb)](_0x504750(0x234)),0x1;const _0xd92013=await resolveWorkspaceIdFromOptions(_0x4ee99d,_0x15d1e7,!![]),_0x531858={'name':_0x4a8e26,'subjectTemplate':_0x4e75ac,'htmlTemplate':_0x11574c,'workspaceId':_0xd92013,'plaintextTemplate':_0x4ee99d[_0x504750(0x21b)],'editorType':_0x4ee99d[_0x504750(0x245)]},_0x1ae603=await withSpinner(_0x504750(0x254)+_0x4a8e26+_0x504750(0x1cf),()=>_0x15d1e7['engage'][_0x504750(0x208)](_0x531858));return await handleSDKOutput([_0x1ae603[_0x504750(0x249)]],_0x5780db),0x0;}}export class EngageTemplateUpdateCommand extends BaseCommand{[a16_0x59784c(0x1f3)]=a16_0x59784c(0x257);[a16_0x59784c(0x20c)]='Update\x20an\x20email\x20template';async[a16_0x59784c(0x1e6)](_0x30d34f){const _0xcb847f=a16_0x59784c,{options:_0x1b57ab,args:_0x56f9d3,tdx:_0x56e6cd}=_0x30d34f;if(_0x56f9d3['length']===0x0)return console[_0xcb847f(0x1fb)](_0xcb847f(0x236)),console[_0xcb847f(0x1fb)](_0xcb847f(0x1e8)),0x1;const _0x10054a=_0x56f9d3[0x0],_0x1cca7a=_0x1b57ab,_0xb71507=await resolveWorkspaceIdFromOptions(_0x1cca7a,_0x56e6cd),_0x832808={'name':_0x1cca7a[_0xcb847f(0x1f3)],'subjectTemplate':_0x1cca7a['subject'],'htmlTemplate':_0x1cca7a[_0xcb847f(0x225)],'plaintextTemplate':_0x1cca7a[_0xcb847f(0x21b)]},_0x1aee03=Object['fromEntries'](Object[_0xcb847f(0x215)](_0x832808)[_0xcb847f(0x1fe)](([,_0x457673])=>_0x457673!==undefined));if(Object[_0xcb847f(0x22d)](_0x1aee03)[_0xcb847f(0x233)]===0x0)return console['error'](_0xcb847f(0x22e)),console[_0xcb847f(0x1fb)](_0xcb847f(0x1e9)),0x1;const _0x2ffdf4=await withSpinner('Updating\x20template\x20\x27'+_0x10054a+_0xcb847f(0x1cf),()=>_0x56e6cd['engage']['updateTemplate'](_0x10054a,_0x1aee03,_0xb71507),{'verbose':_0x1b57ab[_0xcb847f(0x252)]});return await handleSDKOutput([_0x2ffdf4[_0xcb847f(0x249)]],_0x1b57ab),0x0;}}export class EngageTemplateDeleteCommand extends BaseCommand{['name']='engage:template:delete';['description']=a16_0x59784c(0x24c);async[a16_0x59784c(0x1e6)](_0x19a3cf){const _0x46699d=a16_0x59784c,{options:_0x2127d0,args:_0x4a92d1,tdx:_0x53af71}=_0x19a3cf;if(_0x4a92d1[_0x46699d(0x233)]===0x0)return console[_0x46699d(0x1fb)](_0x46699d(0x236)),console[_0x46699d(0x1fb)]('Usage:\x20tdx\x20engage\x20template\x20delete\x20<name-or-id>'),0x1;const _0x2d5e03=_0x4a92d1[0x0],_0x98e18f=_0x2127d0,_0x538763=await resolveWorkspaceIdFromOptions(_0x98e18f,_0x53af71);if(!_0x2127d0[_0x46699d(0x23d)]){const _0x25cd52=await confirm(_0x46699d(0x24e)+_0x2d5e03+_0x46699d(0x1f2));if(!_0x25cd52)return console[_0x46699d(0x1ed)]('Operation\x20cancelled'),0x0;}return await withSpinner(_0x46699d(0x23a)+_0x2d5e03+_0x46699d(0x1cf),()=>_0x53af71[_0x46699d(0x1e4)][_0x46699d(0x224)](_0x2d5e03,_0x538763),{'verbose':_0x2127d0[_0x46699d(0x252)]}),console[_0x46699d(0x1ed)](_0x46699d(0x1f5)+_0x2d5e03+_0x46699d(0x209)),0x0;}}export class EngageWorkspacesCommand extends BaseCommand{[a16_0x59784c(0x1f3)]='engage:workspaces';[a16_0x59784c(0x20c)]=a16_0x59784c(0x241);async[a16_0x59784c(0x1e6)](_0x570fdd){const _0x31c3ff=a16_0x59784c,{options:_0x2a6294,args:_0x55e210,tdx:_0x581c7b}=_0x570fdd,_0x51b422=_0x55e210[0x0],_0x2add1d=resolveLimit(_0x2a6294[_0x31c3ff(0x1f1)],DEFAULT_LLM_LIMIT),_0x287d30=await withSpinner('Fetching\x20workspaces...',()=>_0x581c7b['engage']['listWorkspaces']({'limit':_0x2add1d}),{'verbose':_0x2a6294['verbose']});let _0x4b7ef6=_0x287d30['data'];return _0x51b422&&(_0x4b7ef6=_0x287d30[_0x31c3ff(0x249)][_0x31c3ff(0x1fe)](_0x11ad46=>matchGlobPattern(_0x11ad46['name'],_0x51b422))),await handleSDKOutput(_0x4b7ef6,_0x2a6294),0x0;}}export class EngageWorkspaceShowCommand extends BaseCommand{[a16_0x59784c(0x1f3)]=a16_0x59784c(0x242);[a16_0x59784c(0x20c)]='Show\x20workspace\x20details';async['execute'](_0x21d8d3){const _0x58134a=a16_0x59784c,{options:_0x41c80c,args:_0x187242,tdx:_0x31b4ef}=_0x21d8d3;if(_0x187242[_0x58134a(0x233)]===0x0)return console[_0x58134a(0x1fb)](_0x58134a(0x24d)),console[_0x58134a(0x1fb)](_0x58134a(0x22b)),0x1;const _0x1696fe=_0x187242[0x0],_0x35faf1=_0x41c80c,_0x4e90ea=_0x35faf1[_0x58134a(0x1fc)];if(_0x4e90ea){const _0x7ea6e=await withSpinner(_0x58134a(0x21a)+_0x1696fe+_0x58134a(0x1cf),()=>_0x31b4ef[_0x58134a(0x1e4)][_0x58134a(0x1f7)](_0x1696fe),{'verbose':_0x41c80c[_0x58134a(0x252)]});await handleSDKOutput([_0x7ea6e],_0x41c80c);}else{const _0x56ee6e=await withSpinner(_0x58134a(0x21a)+_0x1696fe+_0x58134a(0x1cf),()=>_0x31b4ef['engage'][_0x58134a(0x21c)](_0x1696fe),{'verbose':_0x41c80c[_0x58134a(0x252)]});await handleSDKOutput([_0x56ee6e],_0x41c80c);}return 0x0;}}function a16_0x503b(_0x176a83,_0x20ee11){_0x176a83=_0x176a83-0x1cf;const _0x30173b=a16_0x3017();let _0x503b58=_0x30173b[_0x176a83];return _0x503b58;}export class EngageWorkspaceCreateCommand extends BaseCommand{[a16_0x59784c(0x1f3)]=a16_0x59784c(0x200);[a16_0x59784c(0x20c)]=a16_0x59784c(0x1d5);async[a16_0x59784c(0x1e6)](_0x5b665f){const _0x277234=a16_0x59784c,{options:_0x5f2045,tdx:_0x149321}=_0x5b665f,_0x3eec29=_0x5f2045,_0x197ec4=_0x3eec29[_0x277234(0x1f3)];if(!_0x197ec4)return console[_0x277234(0x1fb)](_0x277234(0x255)),console['error'](_0x277234(0x1fd)),0x1;const _0x6731b5={'name':_0x197ec4,'description':_0x3eec29[_0x277234(0x20c)]},_0x52146f=await withSpinner('Creating\x20workspace\x20\x27'+_0x197ec4+_0x277234(0x1cf),()=>_0x149321[_0x277234(0x1e4)][_0x277234(0x1dc)](_0x6731b5));return await handleSDKOutput([_0x52146f[_0x277234(0x249)]],_0x5f2045),0x0;}}export class EngageWorkspaceUpdateCommand extends BaseCommand{[a16_0x59784c(0x1f3)]=a16_0x59784c(0x217);[a16_0x59784c(0x20c)]=a16_0x59784c(0x203);async[a16_0x59784c(0x1e6)](_0x3c9fa7){const _0xa5af6b=a16_0x59784c,{options:_0x2af939,args:_0x2aaa4a,tdx:_0x332383}=_0x3c9fa7;if(_0x2aaa4a['length']===0x0)return console[_0xa5af6b(0x1fb)]('Error:\x20Workspace\x20name\x20or\x20ID\x20is\x20required'),console['error'](_0xa5af6b(0x1d1)),0x1;const _0x115c04=_0x2aaa4a[0x0],_0x1ad0cd=_0x2af939,_0x4191ca={'name':_0x1ad0cd[_0xa5af6b(0x1f3)],'description':_0x1ad0cd[_0xa5af6b(0x20c)]},_0x3d43a2=Object[_0xa5af6b(0x250)](Object[_0xa5af6b(0x215)](_0x4191ca)[_0xa5af6b(0x1fe)](([,_0x37eb63])=>_0x37eb63!==undefined));if(Object[_0xa5af6b(0x22d)](_0x3d43a2)[_0xa5af6b(0x233)]===0x0)return console[_0xa5af6b(0x1fb)](_0xa5af6b(0x22e)),console[_0xa5af6b(0x1fb)]('Options:\x20--name,\x20--description'),0x1;const _0x2f0181=await withSpinner(_0xa5af6b(0x20a)+_0x115c04+_0xa5af6b(0x1cf),()=>_0x332383[_0xa5af6b(0x1e4)][_0xa5af6b(0x1e7)](_0x115c04,_0x3d43a2),{'verbose':_0x2af939[_0xa5af6b(0x252)]});return await handleSDKOutput([_0x2f0181[_0xa5af6b(0x249)]],_0x2af939),0x0;}}export class EngageWorkspaceDeleteCommand extends BaseCommand{[a16_0x59784c(0x1f3)]=a16_0x59784c(0x20d);[a16_0x59784c(0x20c)]=a16_0x59784c(0x1de);async[a16_0x59784c(0x1e6)](_0x13a6b5){const _0x42d916=a16_0x59784c,{options:_0x5b40e5,args:_0x53a8f0,tdx:_0x1b4a00}=_0x13a6b5;if(_0x53a8f0[_0x42d916(0x233)]===0x0)return console[_0x42d916(0x1fb)](_0x42d916(0x24d)),console[_0x42d916(0x1fb)](_0x42d916(0x240)),0x1;const _0x2af559=_0x53a8f0[0x0];if(!_0x5b40e5[_0x42d916(0x23d)]){const _0x11ec56=await confirm('Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20workspace\x20\x27'+_0x2af559+_0x42d916(0x1f2));if(!_0x11ec56)return console[_0x42d916(0x1ed)]('Operation\x20cancelled'),0x0;}return await withSpinner(_0x42d916(0x1f4)+_0x2af559+_0x42d916(0x1cf),()=>_0x1b4a00[_0x42d916(0x1e4)][_0x42d916(0x20b)](_0x2af559),{'verbose':_0x5b40e5[_0x42d916(0x252)]}),console['log']('Workspace\x20\x27'+_0x2af559+_0x42d916(0x209)),0x0;}}export class EngageWorkspaceUseCommand extends BaseCommand{['name']=a16_0x59784c(0x211);['description']=a16_0x59784c(0x1fa);async[a16_0x59784c(0x1e6)](_0x4eb7cc){const _0x3f28c9=a16_0x59784c,{options:_0x56cf64,args:_0x45dc93,tdx:_0x362d0a}=_0x4eb7cc;if(_0x45dc93[_0x3f28c9(0x233)]===0x0)return console['error'](_0x3f28c9(0x223)),console[_0x3f28c9(0x1fb)](_0x3f28c9(0x229)),0x1;const _0x5a77af=_0x45dc93[0x0];await withSpinner('Verifying\x20workspace\x20\x27'+_0x5a77af+_0x3f28c9(0x1cf),()=>_0x362d0a[_0x3f28c9(0x1e4)]['resolveWorkspaceId'](_0x5a77af));const _0x74ff9a=_0x56cf64[_0x3f28c9(0x1d7)]||undefined;return saveSessionContext({'engage_workspace':_0x5a77af},_0x74ff9a),console[_0x3f28c9(0x1ed)](_0x3f28c9(0x251)+_0x5a77af),console[_0x3f28c9(0x1ed)](_0x3f28c9(0x1e5)),0x0;}}
|