@treasuredata/tdx 0.23.0 → 0.23.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin.js +1 -1
- package/dist/build-info.json +3 -3
- package/dist/cli-categories.js +1 -1
- package/dist/cli.js +1 -1
- package/dist/commands/activations.js +1 -1
- package/dist/commands/agent-command.js +1 -1
- package/dist/commands/agent-test-command.js +1 -1
- package/dist/commands/api-command.js +1 -1
- package/dist/commands/auth-command.js +1 -1
- package/dist/commands/chat-command.js +1 -1
- package/dist/commands/claude-command.js +1 -1
- package/dist/commands/claude-statusline-command.js +1 -1
- package/dist/commands/claude-usage-command.js +1 -1
- package/dist/commands/command.js +1 -1
- package/dist/commands/connection-command.js +1 -1
- package/dist/commands/databases.js +1 -1
- package/dist/commands/describe.js +1 -1
- package/dist/commands/engage-command.js +1 -1
- package/dist/commands/job-command.js +1 -1
- package/dist/commands/journey-command.js +1 -1
- package/dist/commands/journey-validate-command.js +1 -1
- package/dist/commands/llm-command.js +1 -1
- package/dist/commands/mcp-command.js +1 -1
- package/dist/commands/parent-segment-command.js +1 -1
- package/dist/commands/profile-command.js +1 -1
- package/dist/commands/profiles-command.js +1 -1
- package/dist/commands/query-command.js +1 -1
- package/dist/commands/schedule-command.js +1 -1
- package/dist/commands/segment-command.js +1 -1
- package/dist/commands/segment-create-command.js +1 -1
- package/dist/commands/segment-fields-command.js +1 -1
- package/dist/commands/segment-pull-command.js +1 -1
- package/dist/commands/segment-push-command.js +1 -1
- package/dist/commands/segment-update-command.js +1 -1
- package/dist/commands/segment-use-command.js +1 -1
- package/dist/commands/segment-validate-command.js +1 -1
- package/dist/commands/segments.js +1 -1
- package/dist/commands/show.js +1 -1
- package/dist/commands/status-command.js +1 -1
- package/dist/commands/tables.js +1 -1
- package/dist/commands/unset-command.js +1 -1
- package/dist/commands/use-command.js +1 -1
- package/dist/commands/user-command.js +1 -1
- package/dist/commands/workflow-command.js +1 -1
- package/dist/core/auth.js +1 -1
- package/dist/core/command-output.js +1 -1
- package/dist/core/config.js +1 -1
- package/dist/core/connection-cache.js +1 -1
- package/dist/core/constants.js +1 -1
- package/dist/core/credential-cache.js +1 -1
- package/dist/core/global-context.js +1 -1
- package/dist/core/keychain.js +1 -1
- package/dist/core/profile.js +1 -1
- package/dist/core/project-config.js +1 -1
- package/dist/core/session.js +1 -1
- package/dist/core/user-cache.js +1 -1
- package/dist/core/version.js +1 -1
- package/dist/index.js +1 -1
- package/dist/mcp/server.js +1 -1
- package/dist/mcp/tools/index.js +1 -1
- package/dist/mcp/tools/tdx-run.js +1 -1
- package/dist/mcp/tools/tdx-search.js +1 -1
- package/dist/mcp/utils.js +1 -1
- package/dist/proxy/claude-usage-tracker.js +1 -1
- package/dist/proxy/passthrough-server.js +1 -1
- package/dist/proxy/sse-usage-parser.js +1 -1
- package/dist/sdk/agent/agent-config.js +1 -1
- package/dist/sdk/agent/agent-ref-parser.js +1 -1
- package/dist/sdk/agent/agent-yaml.js +1 -1
- package/dist/sdk/agent/test/evaluator.js +1 -1
- package/dist/sdk/agent/test/executor.js +1 -1
- package/dist/sdk/agent/test/index.js +1 -1
- package/dist/sdk/agent/test/output.js +1 -1
- package/dist/sdk/agent/test/parser.js +1 -1
- package/dist/sdk/api.js +1 -1
- package/dist/sdk/client/cdp-api-client.js +1 -1
- package/dist/sdk/client/endpoints.js +1 -1
- package/dist/sdk/client/engage-api-client.js +1 -1
- package/dist/sdk/client/http-client.js +1 -1
- package/dist/sdk/client/llm-api-client.js +1 -1
- package/dist/sdk/client/rate-limiter.js +1 -1
- package/dist/sdk/client/td-api-client.js +1 -1
- package/dist/sdk/client/trino-api-client.js +1 -1
- package/dist/sdk/client/workflow-client.js +1 -1
- package/dist/sdk/connection-validator.js +1 -1
- package/dist/sdk/connection.js +1 -1
- package/dist/sdk/engage.js +1 -1
- package/dist/sdk/errors.js +1 -1
- package/dist/sdk/index.js +1 -1
- package/dist/sdk/io/index.js +1 -1
- package/dist/sdk/io/node-filesystem.js +1 -1
- package/dist/sdk/job.js +1 -1
- package/dist/sdk/journey.js +1 -1
- package/dist/sdk/llm/chat-cache.js +1 -1
- package/dist/sdk/llm/index.js +1 -1
- package/dist/sdk/llm/llm-backup-utils.js +1 -1
- package/dist/sdk/llm/model-factors.js +1 -1
- package/dist/sdk/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.js +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
const a9_0x507315=a9_0x55e8;(function(_0x397231,_0x5c9b99){const _0x2e49ce=a9_0x55e8,_0x46e5e5=_0x397231();while(!![]){try{const _0x1e4571=parseInt(_0x2e49ce(0x193))/0x1+-parseInt(_0x2e49ce(0x162))/0x2+-parseInt(_0x2e49ce(0x1be))/0x3*(-parseInt(_0x2e49ce(0x17c))/0x4)+parseInt(_0x2e49ce(0x150))/0x5+parseInt(_0x2e49ce(0x18a))/0x6*(parseInt(_0x2e49ce(0x1a6))/0x7)+-parseInt(_0x2e49ce(0x1b0))/0x8+-parseInt(_0x2e49ce(0x167))/0x9;if(_0x1e4571===_0x5c9b99)break;else _0x46e5e5['push'](_0x46e5e5['shift']());}catch(_0x1788db){_0x46e5e5['push'](_0x46e5e5['shift']());}}}(a9_0x3f72,0xb758d));import{readFile,writeFile,mkdir}from'node:fs/promises';import{existsSync}from'node:fs';import{join}from'node:path';import a9_0xd3341a 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';function a9_0x55e8(_0x82897c,_0x29ff6f){_0x82897c=_0x82897c-0x13a;const _0x3f722a=a9_0x3f72();let _0x55e891=_0x3f722a[_0x82897c];return _0x55e891;}import{findExecutable,crossSpawn}from'../utils/process.js';import{SDKError,ErrorCode,errorContains}from'../sdk/errors.js';import{createCommandSpinner}from'../utils/spinner.js';import{writeCachedAccountInfo}from'../core/config.js';const MIN_CLAUDE_VERSION=a9_0x507315(0x1b9);function handleInstallationError(_0x37925f,_0x10c3e0,_0x2aa07e,_0x236ccf){const _0x38ad2a=a9_0x507315;errorContains(_0x37925f,_0x38ad2a(0x1b3),_0x38ad2a(0x16a),_0x38ad2a(0x152))?(_0x2aa07e['text']='✓\x20'+_0x10c3e0+_0x38ad2a(0x1a7),_0x236ccf?.['info'](_0x10c3e0+'\x20already\x20configured'),_0x37925f instanceof SDKError&&_0x37925f[_0x38ad2a(0x19e)]&&_0x236ccf?.[_0x38ad2a(0x15a)](_0x38ad2a(0x1b2)+_0x37925f[_0x38ad2a(0x19e)][_0x38ad2a(0x146)])):(_0x2aa07e[_0x38ad2a(0x196)](_0x38ad2a(0x156)+_0x10c3e0),_0x236ccf?.[_0x38ad2a(0x19b)](_0x10c3e0+_0x38ad2a(0x15d),_0x37925f));}export function parseVersion(_0x50b85f){const _0x2cc7fc=a9_0x507315,_0x29fd62=_0x50b85f['trim']()[_0x2cc7fc(0x153)](/^v?(\d+)\.(\d+)\.(\d+)/);if(!_0x29fd62)return null;return{'major':parseInt(_0x29fd62[0x1],0xa),'minor':parseInt(_0x29fd62[0x2],0xa),'patch':parseInt(_0x29fd62[0x3],0xa)};}export function compareVersions(_0x4ac949,_0x25ac10){const _0x4be51d=a9_0x507315;if(_0x4ac949[_0x4be51d(0x1a0)]!==_0x25ac10['major'])return _0x4ac949[_0x4be51d(0x1a0)]-_0x25ac10[_0x4be51d(0x1a0)];if(_0x4ac949['minor']!==_0x25ac10['minor'])return _0x4ac949[_0x4be51d(0x160)]-_0x25ac10[_0x4be51d(0x160)];return _0x4ac949[_0x4be51d(0x182)]-_0x25ac10[_0x4be51d(0x182)];}async function checkClaudeVersion(_0x3f121e,_0x564afe){const _0x49d76f=a9_0x507315;_0x564afe?.['debug'](_0x49d76f(0x17b)+_0x3f121e+')');const _0x2b6d7b=await executeClaudeCommand([_0x49d76f(0x16b)],undefined,_0x564afe),_0x416d14=parseVersion(_0x2b6d7b);if(!_0x416d14){_0x564afe?.[_0x49d76f(0x196)](_0x49d76f(0x1a5)+_0x2b6d7b);return;}const _0x19e538=_0x416d14[_0x49d76f(0x1a0)]+'.'+_0x416d14['minor']+'.'+_0x416d14[_0x49d76f(0x182)],_0x577c91=parseVersion(_0x3f121e);if(!_0x577c91){_0x564afe?.[_0x49d76f(0x196)](_0x49d76f(0x1a3)+_0x3f121e);return;}if(compareVersions(_0x416d14,_0x577c91)<0x0){_0x564afe?.[_0x49d76f(0x19b)]('Claude\x20Code\x20version\x20'+_0x19e538+'\x20is\x20too\x20old\x20(minimum:\x20'+_0x3f121e+')');throw new SDKError(ErrorCode[_0x49d76f(0x18f)],_0x49d76f(0x1b4)+_0x19e538+'\x20does\x20not\x20support\x20required\x20features.\x20Please\x20upgrade\x20to\x20version\x20'+_0x3f121e+_0x49d76f(0x172),undefined,{'helpText':_0x49d76f(0x13a)});}_0x564afe?.[_0x49d76f(0x15a)](_0x49d76f(0x1b4)+_0x19e538+_0x49d76f(0x1a9));}async function executeClaudeCommand(_0x1b0f9a,_0x3da321,_0x259515){const _0x512215=a9_0x507315;return _0x259515?.[_0x512215(0x195)](_0x512215(0x151)+_0x1b0f9a[_0x512215(0x175)]('\x20')),new Promise((_0x501650,_0x2509b4)=>{const _0x466891=_0x512215,_0x4eb243=crossSpawn(_0x466891(0x14f),_0x1b0f9a,{'stdio':_0x466891(0x16e)});let _0x28d50e='',_0x40c9e5='';_0x4eb243['stdout']?.['on']('data',_0x4e9342=>{const _0x242161=_0x466891;_0x28d50e+=_0x4e9342[_0x242161(0x145)]();}),_0x4eb243['stderr']?.['on']('data',_0x2f3734=>{const _0x411144=_0x466891;_0x40c9e5+=_0x2f3734[_0x411144(0x145)]();}),_0x4eb243['on'](_0x466891(0x19b),_0x5c7730=>{const _0x3504f4=_0x466891;_0x5c7730[_0x3504f4(0x191)]==='ENOENT'?(_0x259515?.[_0x3504f4(0x19b)](_0x3504f4(0x176)),_0x2509b4(new SDKError(ErrorCode['CLAUDE_CODE_NOT_FOUND'],_0x3504f4(0x176),_0x5c7730,{'helpText':_0x3504f4(0x1ac)}))):(_0x259515?.[_0x3504f4(0x19b)]('Command\x20spawn\x20error:\x20'+_0x5c7730[_0x3504f4(0x146)]),_0x2509b4(new SDKError(ErrorCode[_0x3504f4(0x1bc)],_0x3504f4(0x15c)+_0x5c7730[_0x3504f4(0x146)],_0x5c7730)));}),_0x4eb243['on'](_0x466891(0x1c2),_0x2eff08=>{const _0x63a498=_0x466891;if(_0x2eff08===0x0)_0x501650(_0x28d50e);else _0x3da321?(_0x259515?.[_0x63a498(0x19b)]('Command\x20failed\x20(exit\x20'+_0x2eff08+_0x63a498(0x13e)+_0x1b0f9a[_0x63a498(0x175)]('\x20')),_0x2509b4(new SDKError(ErrorCode[_0x63a498(0x187)],_0x3da321,new Error(_0x40c9e5)))):_0x501650('');});});}async function ensureMcpServer(_0x54ad2c,_0x4efc17,_0x158b0c,_0x3888cd,_0x3ed36f){const _0x318d10=a9_0x507315;_0x3888cd[_0x318d10(0x17f)]=_0x318d10(0x144)+_0x54ad2c+'\x27...',await executeClaudeCommand([_0x318d10(0x177),_0x318d10(0x1a8),_0x54ad2c,_0x4efc17,_0x318d10(0x14e),_0x158b0c],_0x318d10(0x15b)+_0x54ad2c+'\x27',_0x3ed36f),_0x3888cd[_0x318d10(0x17f)]=_0x318d10(0x1b5)+_0x54ad2c+'\x27\x20configured';}export const DEFAULT_TD_SKILLS_URL=a9_0x507315(0x148);export function getTdSkillsRepoUrl(){const _0x469f66=process.env.TDX_TD_SKILLS_REPO;if(_0x469f66)return _0x469f66;return DEFAULT_TD_SKILLS_URL;}async function removeMarketplace(_0x1ba1e0,_0x51ca1e){const _0x197ffb=a9_0x507315;try{const _0x52f50e=await executeClaudeCommand([_0x197ffb(0x169),_0x197ffb(0x13b),_0x197ffb(0x1c7)],_0x197ffb(0x1c3),_0x51ca1e);if(!_0x52f50e[_0x197ffb(0x178)](_0x1ba1e0)){_0x51ca1e?.[_0x197ffb(0x15a)](_0x197ffb(0x15f)+_0x1ba1e0+'\x27\x20not\x20found\x20in\x20list,\x20skipping\x20removal');return;}await executeClaudeCommand(['plugin',_0x197ffb(0x13b),_0x197ffb(0x166),_0x1ba1e0],_0x197ffb(0x1a2)+_0x1ba1e0+'\x27',_0x51ca1e),_0x51ca1e?.[_0x197ffb(0x195)]('Marketplace\x20\x27'+_0x1ba1e0+_0x197ffb(0x18c));}catch(_0x320d36){_0x51ca1e?.[_0x197ffb(0x196)](_0x197ffb(0x1a2)+_0x1ba1e0+'\x27:\x20'+_0x320d36);}}async function restoreDefaultTdSkillsMarketplace(_0x1d357e){const _0x435093=a9_0x507315;try{await removeMarketplace('td-skills',_0x1d357e),await executeClaudeCommand(['plugin','marketplace',_0x435093(0x1a8),DEFAULT_TD_SKILLS_URL],undefined,_0x1d357e),_0x1d357e?.['info'](_0x435093(0x13f));}catch{}}async function ensureMarketplace(_0x3c63a7,_0x17cab5,_0x2201d9,_0x18fcae){const _0x43b7cb=a9_0x507315;_0x2201d9[_0x43b7cb(0x17f)]=_0x43b7cb(0x140)+_0x3c63a7+_0x43b7cb(0x165),await executeClaudeCommand([_0x43b7cb(0x169),_0x43b7cb(0x13b),_0x43b7cb(0x1a8),_0x17cab5],'Failed\x20to\x20configure\x20marketplace\x20\x27'+_0x3c63a7+'\x27',_0x18fcae),_0x2201d9[_0x43b7cb(0x17f)]='✓\x20Marketplace\x20\x27'+_0x3c63a7+'\x27\x20configured';}function a9_0x3f72(){const _0x27a92e=['✓\x20Logging\x20to\x20','plugin','already\x20installed','--version','✓\x20Settings\x20configured:\x20.claude/settings.local.json','close','pipe','string','Claude\x20Code\x20version\x20check\x20failed','green','\x20or\x20later.','object','continue','join','Claude\x20Code\x20CLI\x20not\x20found','mcp','includes','install','statusLine','Checking\x20Claude\x20Code\x20version\x20(minimum\x20required:\x20','6496sTfJvJ','start','ANTHROPIC_AUTH_TOKEN','text','CLAUDE_CODE_USE_VERTEX','parse','patch','\x20→\x20','port','TD\x20Docs\x20MCP\x20Server','✓\x20Plugin\x20\x27','INSTALLATION_FAILED','type','✓\x20TD\x20LLM\x20pass-through\x20proxy\x20running\x20on\x20port\x20','3069450nPuqhL','td-skills','\x27\x20removed','Failed\x20to\x20launch\x20Claude\x20Code:\x20','resume','CLAUDE_CODE_UNSUPPORTED_VERSION','env','code','✓\x20Found\x20available\x20port:\x20','1486364zlPkKK','inherit','info','warn','td-docs','tdx','Initializing...','user','error','INVALID_ARGUMENT','Creating\x20.claude/settings.local.json...','cause','proxy','major','Updating\x20marketplace\x20\x27','Failed\x20to\x20remove\x20marketplace\x20\x27','Invalid\x20minimum\x20version\x20format:\x20','stringify','Could\x20not\x20parse\x20Claude\x20Code\x20version\x20from:\x20','14WNzORV','\x20already\x20configured','add','\x20meets\x20minimum\x20requirement','originalSettings','cwd','Please\x20install\x20Claude\x20Code\x20from\x20https://claude.com/claude-code','fail','llm-proxy','statusline','691776SxSjUK','127.0.0.1','Command\x20output:\x20','already\x20exists','Claude\x20Code\x20version\x20','✓\x20MCP\x20server\x20\x27','command','\x20claude\x20statusline','passThroughServer','2.0.20','.claude','apiKey','INTERNAL','verbose','834FwpNOv','tdx\x20--profile\x20','API\x20key\x20is\x20required\x20for\x20TD\x20LLM\x20Proxy\x20mode','stop','exit','Failed\x20to\x20list\x20marketplaces','hostname','site','Setup\x20failed','list','workflow-skills','✓\x20Claude\x20Code\x20version\x20OK','ANTHROPIC_BASE_URL','\x27\x20updated','Download\x20the\x20latest\x20version\x20from\x20https://claude.com/claude-code','marketplace','unshift','http://127.0.0.1:','):\x20claude\x20','Restored\x20default\x20td-skills\x20marketplace','Configuring\x20marketplace\x20\x27','\x27\x20installed','logLevel','Finding\x20available\x20port...','Configuring\x20MCP\x20server\x20\x27','toString','message','context','https://github.com/treasure-data/td-skills','CLAUDE_CODE_USE_BEDROCK','false','red','ANTHROPIC_MODEL','tdx-managed-proxy','--transport','claude','4861955YDDjHD','Executing:\x20claude\x20','already\x20configured','match','settings.local.json','execute','Warning:\x20Failed\x20to\x20configure\x20','logger','description','CLAUDE_CODE_NOT_FOUND','debug','Failed\x20to\x20configure\x20MCP\x20server\x20\x27','Failed\x20to\x20spawn\x20claude\x20command:\x20','\x20configuration\x20failed','✓\x20Marketplace\x20\x27','Marketplace\x20\x27','minor','utf-8','2030908DbmoRn','http','log','\x27...','remove','18724158YdyEmh'];a9_0x3f72=function(){return _0x27a92e;};return a9_0x3f72();}async function updateMarketplace(_0xdd8f36,_0x147034,_0x180882){const _0x2c638a=a9_0x507315;_0x147034[_0x2c638a(0x17f)]=_0x2c638a(0x1a1)+_0xdd8f36+'\x27...',await executeClaudeCommand([_0x2c638a(0x169),'marketplace','update'],'Failed\x20to\x20update\x20marketplace\x20\x27'+_0xdd8f36+'\x27',_0x180882),_0x147034[_0x2c638a(0x17f)]=_0x2c638a(0x15e)+_0xdd8f36+_0x2c638a(0x1cb);}async function ensurePlugin(_0x8acdc1,_0x15627b,_0x4fd759,_0x5c92c5){const _0x4def04=a9_0x507315;_0x4fd759[_0x4def04(0x17f)]='Installing\x20plugin\x20\x27'+_0x8acdc1+'\x27...',await executeClaudeCommand([_0x4def04(0x169),_0x4def04(0x179),_0x8acdc1+'@'+_0x15627b],'Failed\x20to\x20install\x20plugin\x20\x27'+_0x8acdc1+'\x27',_0x5c92c5),_0x4fd759[_0x4def04(0x17f)]=_0x4def04(0x186)+_0x8acdc1+_0x4def04(0x141);}async function createClaudeSettings(_0x4d141f,_0x2c04cf,_0xc7907c){const _0x4112b4=a9_0x507315,_0x25411f=join(process[_0x4112b4(0x1ab)](),_0x4112b4(0x1ba)),_0x28c4c7=join(_0x25411f,'settings.local.json');await mkdir(_0x25411f,{'recursive':!![]});let _0x42c04f={};if(existsSync(_0x28c4c7))try{const _0x31b1d8=await readFile(_0x28c4c7,_0x4112b4(0x161));_0x42c04f=JSON[_0x4112b4(0x181)](_0x31b1d8);}catch{_0x42c04f={};}const _0x22a634=_0x42c04f[_0x4112b4(0x190)]||{},_0x39506c={'ANTHROPIC_BASE_URL':_0x22a634[_0x4112b4(0x1ca)],'ANTHROPIC_MODEL':_0x22a634[_0x4112b4(0x14c)],'ANTHROPIC_AUTH_TOKEN':_0x22a634[_0x4112b4(0x17e)],'CLAUDE_CODE_USE_BEDROCK':_0x22a634[_0x4112b4(0x149)],'CLAUDE_CODE_USE_VERTEX':_0x22a634[_0x4112b4(0x180)],'statusLine':_0x42c04f[_0x4112b4(0x17a)]},_0x5ca17f={..._0x42c04f,'env':{..._0x22a634,'ANTHROPIC_BASE_URL':_0x4112b4(0x13d)+_0x4d141f,..._0x2c04cf&&{'ANTHROPIC_MODEL':_0x2c04cf},'ANTHROPIC_AUTH_TOKEN':_0x4112b4(0x14d),'CLAUDE_CODE_USE_BEDROCK':_0x4112b4(0x14a),'CLAUDE_CODE_USE_VERTEX':_0x4112b4(0x14a)},'statusLine':{'type':'command','command':_0xc7907c?_0x4112b4(0x1bf)+_0xc7907c+_0x4112b4(0x1b7):'tdx\x20claude\x20statusline'}};return await writeFile(_0x28c4c7,JSON['stringify'](_0x5ca17f,null,0x2)+'\x0a'),_0x39506c;}async function restoreClaudeSettings(_0x365d9f){const _0x1f21d7=a9_0x507315,_0x37d581=join(process['cwd'](),_0x1f21d7(0x1ba)),_0x1dd7e5=join(_0x37d581,_0x1f21d7(0x154));if(!existsSync(_0x1dd7e5))return;try{const _0x39c53f=await readFile(_0x1dd7e5,_0x1f21d7(0x161)),_0x5d3db0=JSON[_0x1f21d7(0x181)](_0x39c53f),_0x476aaa=_0x5d3db0[_0x1f21d7(0x190)]||{},_0x422e94=_0x476aaa[_0x1f21d7(0x1ca)],_0x20e393=((()=>{const _0x4e895e=_0x1f21d7;if(typeof _0x422e94!==_0x4e895e(0x16f))return![];try{const _0x2f49bf=new URL(_0x422e94);return _0x2f49bf[_0x4e895e(0x1c4)]==='localhost'||_0x2f49bf[_0x4e895e(0x1c4)]===_0x4e895e(0x1b1);}catch{return![];}})());_0x20e393?(delete _0x476aaa[_0x1f21d7(0x1ca)],delete _0x476aaa[_0x1f21d7(0x14c)],delete _0x476aaa[_0x1f21d7(0x17e)],delete _0x476aaa['CLAUDE_CODE_USE_BEDROCK'],delete _0x476aaa[_0x1f21d7(0x180)]):(_0x365d9f['ANTHROPIC_BASE_URL']!==undefined?_0x476aaa['ANTHROPIC_BASE_URL']=_0x365d9f[_0x1f21d7(0x1ca)]:delete _0x476aaa[_0x1f21d7(0x1ca)],_0x365d9f[_0x1f21d7(0x14c)]!==undefined?_0x476aaa['ANTHROPIC_MODEL']=_0x365d9f[_0x1f21d7(0x14c)]:delete _0x476aaa[_0x1f21d7(0x14c)],_0x365d9f[_0x1f21d7(0x17e)]!==undefined?_0x476aaa[_0x1f21d7(0x17e)]=_0x365d9f[_0x1f21d7(0x17e)]:delete _0x476aaa['ANTHROPIC_AUTH_TOKEN'],_0x365d9f[_0x1f21d7(0x149)]!==undefined?_0x476aaa[_0x1f21d7(0x149)]=_0x365d9f[_0x1f21d7(0x149)]:delete _0x476aaa[_0x1f21d7(0x149)],_0x365d9f[_0x1f21d7(0x180)]!==undefined?_0x476aaa[_0x1f21d7(0x180)]=_0x365d9f[_0x1f21d7(0x180)]:delete _0x476aaa[_0x1f21d7(0x180)]);const _0x2b268c=_0x5d3db0[_0x1f21d7(0x17a)],_0x542f47=((()=>{const _0x273ed0=_0x1f21d7;if(!_0x2b268c||typeof _0x2b268c!==_0x273ed0(0x173))return![];if(_0x2b268c[_0x273ed0(0x188)]!==_0x273ed0(0x1b6))return![];if(typeof _0x2b268c[_0x273ed0(0x1b6)]!=='string')return![];return _0x2b268c['command'][_0x273ed0(0x178)](_0x273ed0(0x198))&&_0x2b268c[_0x273ed0(0x1b6)]['includes'](_0x273ed0(0x1af));})());if(_0x542f47)delete _0x5d3db0[_0x1f21d7(0x17a)];else _0x365d9f[_0x1f21d7(0x17a)]!==undefined?_0x5d3db0[_0x1f21d7(0x17a)]=_0x365d9f[_0x1f21d7(0x17a)]:delete _0x5d3db0[_0x1f21d7(0x17a)];_0x5d3db0['env']=_0x476aaa,await writeFile(_0x1dd7e5,JSON[_0x1f21d7(0x1a4)](_0x5d3db0,null,0x2)+'\x0a');}catch{}}export class ClaudeCommand extends BaseCommand{['name']=a9_0x507315(0x14f);[a9_0x507315(0x158)]='Launch\x20Claude\x20Code\x20with\x20integrated\x20LLM\x20proxy';['passThroughServer'];[a9_0x507315(0x1aa)];['logger'];[a9_0x507315(0x184)];async[a9_0x507315(0x155)](_0x1e4b73){const _0x33e8dc=a9_0x507315,{tdx:_0x42467b,options:_0x62da1f,args:_0xcaced2}=_0x1e4b73;let _0x10f7a7=![];try{const _0x47b223=_0x62da1f,_0x6b4fad=_0x47b223[_0x33e8dc(0x19f)]===![],_0x589089=_0x47b223[_0x33e8dc(0x174)]===!![],_0x41424f=_0x47b223[_0x33e8dc(0x18e)]===!![],_0x386bce=[..._0xcaced2];if(_0x589089)_0x386bce['unshift']('-c');else _0x41424f&&_0x386bce[_0x33e8dc(0x13c)]('-r');const _0x24a3aa=createCommandSpinner(_0x33e8dc(0x199),{'verbose':_0x62da1f[_0x33e8dc(0x1bd)]});_0x24a3aa[_0x33e8dc(0x17d)]();try{if(!_0x6b4fad){_0x24a3aa[_0x33e8dc(0x17f)]=_0x33e8dc(0x143),this[_0x33e8dc(0x184)]=await findAvailablePort(0xfa0),_0x24a3aa[_0x33e8dc(0x17f)]=_0x33e8dc(0x192)+this[_0x33e8dc(0x184)];const _0x44eeee=_0x62da1f['profile'];try{const _0x223812=await _0x42467b[_0x33e8dc(0x19a)]['getCurrent']();_0x223812['account_id']&&writeCachedAccountInfo(_0x62da1f[_0x33e8dc(0x1c5)],_0x223812['account_id'],_0x44eeee);}catch{}_0x24a3aa[_0x33e8dc(0x17f)]='Initializing\x20proxy\x20logger...',this[_0x33e8dc(0x157)]=new TDXLogger(_0x62da1f[_0x33e8dc(0x142)],!![]),await this[_0x33e8dc(0x157)]['init']();const _0x15d6c7=this['logger']['getLogPath']();_0x24a3aa[_0x33e8dc(0x17f)]=_0x33e8dc(0x168)+_0x15d6c7;const _0x3187d9=getEndpoint(_0x62da1f[_0x33e8dc(0x1c5)],_0x33e8dc(0x1ae));_0x24a3aa[_0x33e8dc(0x17f)]='Starting\x20TD\x20LLM\x20pass-through\x20proxy...';if(!_0x42467b['context'][_0x33e8dc(0x1bb)])throw new SDKError(ErrorCode[_0x33e8dc(0x19c)],_0x33e8dc(0x1c0));this[_0x33e8dc(0x1b8)]=new PassThroughProxyServer({'port':this[_0x33e8dc(0x184)],'llmProxyUrl':_0x3187d9,'apiKey':_0x42467b[_0x33e8dc(0x147)]['apiKey'],'logger':this['logger'],'site':_0x62da1f['site'],'profile':_0x44eeee}),await this[_0x33e8dc(0x1b8)]['start'](),_0x24a3aa[_0x33e8dc(0x17f)]=_0x33e8dc(0x189)+this[_0x33e8dc(0x184)]+_0x33e8dc(0x183)+_0x3187d9,_0x24a3aa['text']=_0x33e8dc(0x19d),this[_0x33e8dc(0x1aa)]=await createClaudeSettings(this[_0x33e8dc(0x184)],undefined,_0x44eeee),_0x24a3aa[_0x33e8dc(0x17f)]=_0x33e8dc(0x16c);}else _0x24a3aa[_0x33e8dc(0x17f)]='Skipping\x20TD\x20LLM\x20proxy\x20setup\x20(--no-proxy)';try{_0x24a3aa[_0x33e8dc(0x17f)]='Checking\x20Claude\x20Code\x20version...',await checkClaudeVersion(MIN_CLAUDE_VERSION,this['logger']),_0x24a3aa[_0x33e8dc(0x17f)]=_0x33e8dc(0x1c9);}catch(_0x3f5a74){_0x24a3aa[_0x33e8dc(0x1ad)](_0x33e8dc(0x170));throw _0x3f5a74;}try{await ensureMcpServer(_0x33e8dc(0x197),'https://docs.treasuredata.com/mcp',_0x33e8dc(0x163),_0x24a3aa,this[_0x33e8dc(0x157)]);}catch(_0x2731f8){handleInstallationError(_0x2731f8,_0x33e8dc(0x185),_0x24a3aa,this['logger']);}try{const _0x56f193=getTdSkillsRepoUrl();_0x10f7a7=_0x56f193!==DEFAULT_TD_SKILLS_URL,_0x10f7a7&&await removeMarketplace(_0x33e8dc(0x18b),this[_0x33e8dc(0x157)]),await ensureMarketplace(_0x33e8dc(0x18b),_0x56f193,_0x24a3aa,this[_0x33e8dc(0x157)]),await updateMarketplace(_0x33e8dc(0x18b),_0x24a3aa,this[_0x33e8dc(0x157)]),await ensurePlugin('sql-skills',_0x33e8dc(0x18b),_0x24a3aa,this[_0x33e8dc(0x157)]),await ensurePlugin(_0x33e8dc(0x1c8),_0x33e8dc(0x18b),_0x24a3aa,this[_0x33e8dc(0x157)]),await ensurePlugin('tdx-skills','td-skills',_0x24a3aa,this['logger']);}catch(_0x18a05b){handleInstallationError(_0x18a05b,'td-skills\x20Plugins',_0x24a3aa,this[_0x33e8dc(0x157)]);}_0x24a3aa[_0x33e8dc(0x1c1)]();}catch(_0xa29d4c){_0x24a3aa[_0x33e8dc(0x1ad)](_0x33e8dc(0x1c6));throw _0xa29d4c;}const _0x1417fc=await findExecutable(_0x33e8dc(0x14f));if(!_0x1417fc)throw new SDKError(ErrorCode[_0x33e8dc(0x159)],_0x33e8dc(0x176),undefined,{'helpText':_0x33e8dc(0x1ac)});const _0x453be6={...process.env};!_0x6b4fad&&(_0x453be6[_0x33e8dc(0x1ca)]=_0x33e8dc(0x13d)+this[_0x33e8dc(0x184)],_0x453be6['ANTHROPIC_AUTH_TOKEN']=_0x33e8dc(0x14d),_0x453be6['CLAUDE_CODE_USE_BEDROCK']=_0x33e8dc(0x14a),_0x453be6[_0x33e8dc(0x180)]='false');const _0x562d62=crossSpawn(_0x1417fc,_0x386bce,{'stdio':_0x33e8dc(0x194),'env':_0x453be6}),_0x58fc20=await new Promise(_0xf7d982=>{_0x562d62['on']('exit',_0x55b774=>{_0xf7d982(_0x55b774||0x0);}),_0x562d62['on']('error',_0x3bc639=>{const _0x21dc07=a9_0x55e8;console[_0x21dc07(0x19b)](a9_0xd3341a[_0x21dc07(0x14b)](_0x21dc07(0x18d)+_0x3bc639[_0x21dc07(0x146)])),_0xf7d982(0x1);});});_0x10f7a7&&await restoreDefaultTdSkillsMarketplace(this[_0x33e8dc(0x157)]);this[_0x33e8dc(0x1b8)]&&(await this[_0x33e8dc(0x1b8)][_0x33e8dc(0x1c1)](),console[_0x33e8dc(0x164)](a9_0xd3341a[_0x33e8dc(0x171)]('✓\x20TD\x20LLM\x20pass-through\x20proxy\x20server\x20stopped')));if(this[_0x33e8dc(0x157)]){await this['logger'][_0x33e8dc(0x16d)]();const _0x5cc9d3=this['logger']['getLogPath']();console[_0x33e8dc(0x164)](a9_0xd3341a[_0x33e8dc(0x171)]('✓\x20Logs\x20saved\x20to\x20'+_0x5cc9d3));}return this[_0x33e8dc(0x1aa)]&&(await restoreClaudeSettings(this['originalSettings']),console[_0x33e8dc(0x164)](a9_0xd3341a['green']('✓\x20Settings\x20restored:\x20.claude/settings.local.json'))),_0x58fc20;}catch(_0x24d96c){_0x10f7a7&&await restoreDefaultTdSkillsMarketplace(this[_0x33e8dc(0x157)]);this[_0x33e8dc(0x1b8)]&&await this[_0x33e8dc(0x1b8)][_0x33e8dc(0x1c1)]();this[_0x33e8dc(0x157)]&&await this[_0x33e8dc(0x157)]['close']();this[_0x33e8dc(0x1aa)]&&await restoreClaudeSettings(this[_0x33e8dc(0x1aa)]);throw _0x24d96c;}}}
|
|
1
|
+
const a9_0x15a2b0=a9_0x3364;(function(_0x5cb3d8,_0x290aad){const _0x2e3de9=a9_0x3364,_0x5511bb=_0x5cb3d8();while(!![]){try{const _0x1688ac=-parseInt(_0x2e3de9(0x148))/0x1+parseInt(_0x2e3de9(0x142))/0x2+parseInt(_0x2e3de9(0x16c))/0x3*(parseInt(_0x2e3de9(0x117))/0x4)+parseInt(_0x2e3de9(0x116))/0x5+-parseInt(_0x2e3de9(0x17b))/0x6+-parseInt(_0x2e3de9(0x15a))/0x7+parseInt(_0x2e3de9(0xfb))/0x8;if(_0x1688ac===_0x290aad)break;else _0x5511bb['push'](_0x5511bb['shift']());}catch(_0x5286d5){_0x5511bb['push'](_0x5511bb['shift']());}}}(a9_0x23eb,0xf10da));import{readFile,writeFile,mkdir}from'node:fs/promises';import{existsSync}from'node:fs';import{join}from'node:path';import a9_0x514734 from'chalk';function a9_0x23eb(){const _0x2d4994=['\x20claude\x20statusline','ENOENT','Please\x20install\x20Claude\x20Code\x20from\x20https://claude.com/claude-code','Starting\x20TD\x20LLM\x20pass-through\x20proxy...','Checking\x20Claude\x20Code\x20version...','object','info','data','3113764SHRtxh','\x27...','profile','✓\x20TD\x20LLM\x20pass-through\x20proxy\x20server\x20stopped','\x27\x20configured','llm-proxy','1702625jkmzSS','debug','td-skills','Configuring\x20MCP\x20server\x20\x27','Updating\x20marketplace\x20\x27','Finding\x20available\x20port...','apiKey','CLAUDE_CODE_NOT_FOUND','Executing:\x20claude\x20','stdout','already\x20exists','http','Initializing\x20proxy\x20logger...','✓\x20TD\x20LLM\x20pass-through\x20proxy\x20running\x20on\x20port\x20','sql-skills','settings.local.json','marketplace','td-skills\x20Plugins','5096448nxLStL','INVALID_ARGUMENT','major','INTERNAL','✓\x20Found\x20available\x20port:\x20','Command\x20output:\x20','Warning:\x20Failed\x20to\x20configure\x20','originalSettings','hostname','--transport','--version','2.0.20','unshift','\x27\x20updated','already\x20configured','✓\x20Marketplace\x20\x27','✓\x20Logging\x20to\x20','description','2715522pXtYyi','parse','match','Failed\x20to\x20configure\x20marketplace\x20\x27','Invalid\x20minimum\x20version\x20format:\x20','tdx','Initializing...','workflow-skills','\x27\x20removed','Launch\x20Claude\x20Code\x20with\x20integrated\x20LLM\x20proxy','ANTHROPIC_MODEL','Restored\x20default\x20td-skills\x20marketplace','Marketplace\x20\x27','Failed\x20to\x20configure\x20MCP\x20server\x20\x27','site','3825576NTegZu','Command\x20failed\x20(exit\x20','account_id','join','false','getLogPath','plugin','\x20is\x20too\x20old\x20(minimum:\x20','green','Creating\x20.claude/settings.local.json...','.claude','tdx\x20claude\x20statusline','message','Failed\x20to\x20list\x20marketplaces','):\x20claude\x20','Failed\x20to\x20install\x20plugin\x20\x27','minor','127.0.0.1','\x27\x20installed','stringify','4538864nhCknn','pipe','\x27\x20not\x20found\x20in\x20list,\x20skipping\x20removal','td-docs','cwd','statusLine','ANTHROPIC_AUTH_TOKEN','context','✓\x20Claude\x20Code\x20version\x20OK','Installing\x20plugin\x20\x27','claude','resume','Skipping\x20TD\x20LLM\x20proxy\x20setup\x20(--no-proxy)','update','CLAUDE_CODE_USE_BEDROCK','command','text','warn','add','CLAUDE_CODE_USE_VERTEX','logLevel','Failed\x20to\x20update\x20marketplace\x20\x27','env','already\x20installed','init','log','Claude\x20Code\x20version\x20','5131125SmLOKy','4yzvnKX','\x20→\x20','patch','INSTALLATION_FAILED','start','stop','user','\x20does\x20not\x20support\x20required\x20features.\x20Please\x20upgrade\x20to\x20version\x20','ANTHROPIC_BASE_URL','string','continue','utf-8','port','Failed\x20to\x20remove\x20marketplace\x20\x27','tdx-skills','TD\x20Docs\x20MCP\x20Server','Download\x20the\x20latest\x20version\x20from\x20https://claude.com/claude-code','Claude\x20Code\x20version\x20check\x20failed','cause','exit','name','close','http://127.0.0.1:','Setup\x20failed','passThroughServer','Claude\x20Code\x20CLI\x20not\x20found','https://docs.treasuredata.com/mcp','\x20already\x20configured','Checking\x20Claude\x20Code\x20version\x20(minimum\x20required:\x20','✓\x20MCP\x20server\x20\x27','statusline','logger','execute','install','error'];a9_0x23eb=function(){return _0x2d4994;};return a9_0x23eb();}import{BaseCommand}from'./command.js';import{PassThroughProxyServer}from'../proxy/passthrough-server.js';import{TDXLogger}from'../utils/tdx-logger.js';import{getEndpoint}from'../sdk/client/endpoints.js';import{findAvailablePort}from'../utils/port.js';import{findExecutable,crossSpawn}from'../utils/process.js';import{SDKError,ErrorCode,errorContains}from'../sdk/errors.js';import{createCommandSpinner}from'../utils/spinner.js';import{writeCachedAccountInfo}from'../core/config.js';const MIN_CLAUDE_VERSION=a9_0x15a2b0(0x165);function handleInstallationError(_0x3bfe6a,_0x4168d5,_0x389ebe,_0x15047a){const _0x15fc07=a9_0x15a2b0;errorContains(_0x3bfe6a,_0x15fc07(0x152),_0x15fc07(0x112),_0x15fc07(0x168))?(_0x389ebe[_0x15fc07(0x10b)]='✓\x20'+_0x4168d5+'\x20already\x20configured',_0x15047a?.[_0x15fc07(0x140)](_0x4168d5+_0x15fc07(0x132)),_0x3bfe6a instanceof SDKError&&_0x3bfe6a['cause']&&_0x15047a?.[_0x15fc07(0x149)](_0x15fc07(0x15f)+_0x3bfe6a[_0x15fc07(0x129)][_0x15fc07(0xf3)])):(_0x389ebe[_0x15fc07(0x10c)](_0x15fc07(0x160)+_0x4168d5),_0x15047a?.['error'](_0x4168d5+'\x20configuration\x20failed',_0x3bfe6a));}export function parseVersion(_0x434a98){const _0x2dbd33=a9_0x15a2b0,_0x439055=_0x434a98['trim']()[_0x2dbd33(0x16e)](/^v?(\d+)\.(\d+)\.(\d+)/);if(!_0x439055)return null;return{'major':parseInt(_0x439055[0x1],0xa),'minor':parseInt(_0x439055[0x2],0xa),'patch':parseInt(_0x439055[0x3],0xa)};}export function compareVersions(_0x537515,_0x17aef2){const _0x4ccc6a=a9_0x15a2b0;if(_0x537515[_0x4ccc6a(0x15c)]!==_0x17aef2[_0x4ccc6a(0x15c)])return _0x537515[_0x4ccc6a(0x15c)]-_0x17aef2['major'];if(_0x537515[_0x4ccc6a(0xf7)]!==_0x17aef2[_0x4ccc6a(0xf7)])return _0x537515[_0x4ccc6a(0xf7)]-_0x17aef2[_0x4ccc6a(0xf7)];return _0x537515[_0x4ccc6a(0x119)]-_0x17aef2['patch'];}async function checkClaudeVersion(_0x41fe35,_0x48a65f){const _0x4f1602=a9_0x15a2b0;_0x48a65f?.[_0x4f1602(0x149)](_0x4f1602(0x133)+_0x41fe35+')');const _0x548a0e=await executeClaudeCommand([_0x4f1602(0x164)],undefined,_0x48a65f),_0x290c3f=parseVersion(_0x548a0e);if(!_0x290c3f){_0x48a65f?.[_0x4f1602(0x10c)]('Could\x20not\x20parse\x20Claude\x20Code\x20version\x20from:\x20'+_0x548a0e);return;}const _0x335eec=_0x290c3f[_0x4f1602(0x15c)]+'.'+_0x290c3f['minor']+'.'+_0x290c3f['patch'],_0x35b43b=parseVersion(_0x41fe35);if(!_0x35b43b){_0x48a65f?.[_0x4f1602(0x10c)](_0x4f1602(0x170)+_0x41fe35);return;}if(compareVersions(_0x290c3f,_0x35b43b)<0x0){_0x48a65f?.['error']('Claude\x20Code\x20version\x20'+_0x335eec+_0x4f1602(0xee)+_0x41fe35+')');throw new SDKError(ErrorCode['CLAUDE_CODE_UNSUPPORTED_VERSION'],_0x4f1602(0x115)+_0x335eec+_0x4f1602(0x11e)+_0x41fe35+'\x20or\x20later.',undefined,{'helpText':_0x4f1602(0x127)});}_0x48a65f?.[_0x4f1602(0x149)](_0x4f1602(0x115)+_0x335eec+'\x20meets\x20minimum\x20requirement');}async function executeClaudeCommand(_0x3f444f,_0x352e09,_0x5418c5){const _0x19e930=a9_0x15a2b0;return _0x5418c5?.['info'](_0x19e930(0x150)+_0x3f444f[_0x19e930(0x17e)]('\x20')),new Promise((_0x299784,_0x1743cc)=>{const _0x13c803=_0x19e930,_0x2110c4=crossSpawn(_0x13c803(0x105),_0x3f444f,{'stdio':_0x13c803(0xfc)});let _0x5a0db8='',_0x59b5e1='';_0x2110c4[_0x13c803(0x151)]?.['on']('data',_0x151b2f=>{_0x5a0db8+=_0x151b2f['toString']();}),_0x2110c4['stderr']?.['on'](_0x13c803(0x141),_0x3f2562=>{_0x59b5e1+=_0x3f2562['toString']();}),_0x2110c4['on']('error',_0x36f297=>{const _0x36f313=_0x13c803;_0x36f297['code']===_0x36f313(0x13b)?(_0x5418c5?.[_0x36f313(0x139)](_0x36f313(0x130)),_0x1743cc(new SDKError(ErrorCode['CLAUDE_CODE_NOT_FOUND'],'Claude\x20Code\x20CLI\x20not\x20found',_0x36f297,{'helpText':_0x36f313(0x13c)}))):(_0x5418c5?.[_0x36f313(0x139)]('Command\x20spawn\x20error:\x20'+_0x36f297[_0x36f313(0xf3)]),_0x1743cc(new SDKError(ErrorCode[_0x36f313(0x15d)],'Failed\x20to\x20spawn\x20claude\x20command:\x20'+_0x36f297[_0x36f313(0xf3)],_0x36f297)));}),_0x2110c4['on'](_0x13c803(0x12a),_0x22f2e7=>{const _0x34432f=_0x13c803;if(_0x22f2e7===0x0)_0x299784(_0x5a0db8);else _0x352e09?(_0x5418c5?.[_0x34432f(0x139)](_0x34432f(0x17c)+_0x22f2e7+_0x34432f(0xf5)+_0x3f444f['join']('\x20')),_0x1743cc(new SDKError(ErrorCode[_0x34432f(0x11a)],_0x352e09,new Error(_0x59b5e1)))):_0x299784('');});});}async function ensureMcpServer(_0x15c79d,_0x2949cc,_0x39ac11,_0x478766,_0x39c1ff){const _0x2549b9=a9_0x15a2b0;_0x478766['text']=_0x2549b9(0x14b)+_0x15c79d+_0x2549b9(0x143),await executeClaudeCommand(['mcp','add',_0x15c79d,_0x2949cc,_0x2549b9(0x163),_0x39ac11],_0x2549b9(0x179)+_0x15c79d+'\x27',_0x39c1ff),_0x478766[_0x2549b9(0x10b)]=_0x2549b9(0x134)+_0x15c79d+_0x2549b9(0x146);}export const DEFAULT_TD_SKILLS_URL='https://github.com/treasure-data/td-skills';export function getTdSkillsRepoUrl(){const _0x25a011=process.env.TDX_TD_SKILLS_REPO;if(_0x25a011)return _0x25a011;return DEFAULT_TD_SKILLS_URL;}async function removeMarketplace(_0x1944c4,_0x2f4a84){const _0x449c93=a9_0x15a2b0;try{const _0x1e7010=await executeClaudeCommand(['plugin','marketplace','list'],_0x449c93(0xf4),_0x2f4a84);if(!_0x1e7010['includes'](_0x1944c4)){_0x2f4a84?.['debug'](_0x449c93(0x178)+_0x1944c4+_0x449c93(0xfd));return;}await executeClaudeCommand(['plugin',_0x449c93(0x158),'remove',_0x1944c4],_0x449c93(0x124)+_0x1944c4+'\x27',_0x2f4a84),_0x2f4a84?.['info'](_0x449c93(0x178)+_0x1944c4+_0x449c93(0x174));}catch(_0x1db503){_0x2f4a84?.[_0x449c93(0x10c)](_0x449c93(0x124)+_0x1944c4+'\x27:\x20'+_0x1db503);}}async function restoreDefaultTdSkillsMarketplace(_0x1ceb1f){const _0x1a98b0=a9_0x15a2b0;try{await removeMarketplace(_0x1a98b0(0x14a),_0x1ceb1f),await executeClaudeCommand([_0x1a98b0(0x181),_0x1a98b0(0x158),'add',DEFAULT_TD_SKILLS_URL],undefined,_0x1ceb1f),_0x1ceb1f?.[_0x1a98b0(0x140)](_0x1a98b0(0x177));}catch{}}async function ensureMarketplace(_0x59c99f,_0x4b26c0,_0x2c1aa4,_0x145295){const _0x358a53=a9_0x15a2b0;_0x2c1aa4[_0x358a53(0x10b)]='Configuring\x20marketplace\x20\x27'+_0x59c99f+'\x27...',await executeClaudeCommand([_0x358a53(0x181),_0x358a53(0x158),_0x358a53(0x10d),_0x4b26c0],_0x358a53(0x16f)+_0x59c99f+'\x27',_0x145295),_0x2c1aa4[_0x358a53(0x10b)]=_0x358a53(0x169)+_0x59c99f+_0x358a53(0x146);}async function updateMarketplace(_0x13bb39,_0x2da4ad,_0x55f598){const _0x52306b=a9_0x15a2b0;_0x2da4ad[_0x52306b(0x10b)]=_0x52306b(0x14c)+_0x13bb39+_0x52306b(0x143),await executeClaudeCommand([_0x52306b(0x181),_0x52306b(0x158),_0x52306b(0x108)],_0x52306b(0x110)+_0x13bb39+'\x27',_0x55f598),_0x2da4ad['text']=_0x52306b(0x169)+_0x13bb39+_0x52306b(0x167);}function a9_0x3364(_0x54d7f5,_0x2eb683){_0x54d7f5=_0x54d7f5-0xee;const _0x23eb14=a9_0x23eb();let _0x3364d4=_0x23eb14[_0x54d7f5];return _0x3364d4;}async function ensurePlugin(_0x4a509c,_0x1f468a,_0x2afa73,_0x5ccdcd){const _0x125421=a9_0x15a2b0;_0x2afa73['text']=_0x125421(0x104)+_0x4a509c+_0x125421(0x143),await executeClaudeCommand([_0x125421(0x181),_0x125421(0x138),_0x4a509c+'@'+_0x1f468a],_0x125421(0xf6)+_0x4a509c+'\x27',_0x5ccdcd),_0x2afa73[_0x125421(0x10b)]='✓\x20Plugin\x20\x27'+_0x4a509c+_0x125421(0xf9);}async function createClaudeSettings(_0x5d42b5,_0x46010d,_0x240f7f){const _0x37628f=a9_0x15a2b0,_0x357172=join(process[_0x37628f(0xff)](),_0x37628f(0xf1)),_0x106463=join(_0x357172,_0x37628f(0x157));await mkdir(_0x357172,{'recursive':!![]});let _0x478082={};if(existsSync(_0x106463))try{const _0x427182=await readFile(_0x106463,_0x37628f(0x122));_0x478082=JSON['parse'](_0x427182);}catch{_0x478082={};}const _0x174bcc=_0x478082[_0x37628f(0x111)]||{},_0x48fee0={'ANTHROPIC_BASE_URL':_0x174bcc[_0x37628f(0x11f)],'ANTHROPIC_MODEL':_0x174bcc[_0x37628f(0x176)],'ANTHROPIC_AUTH_TOKEN':_0x174bcc[_0x37628f(0x101)],'CLAUDE_CODE_USE_BEDROCK':_0x174bcc['CLAUDE_CODE_USE_BEDROCK'],'CLAUDE_CODE_USE_VERTEX':_0x174bcc['CLAUDE_CODE_USE_VERTEX'],'statusLine':_0x478082[_0x37628f(0x100)]},_0x18e679={..._0x478082,'env':{..._0x174bcc,'ANTHROPIC_BASE_URL':_0x37628f(0x12d)+_0x5d42b5,..._0x46010d&&{'ANTHROPIC_MODEL':_0x46010d},'ANTHROPIC_AUTH_TOKEN':'tdx-managed-proxy','CLAUDE_CODE_USE_BEDROCK':'false','CLAUDE_CODE_USE_VERTEX':_0x37628f(0x17f)},'statusLine':{'type':'command','command':_0x240f7f?'tdx\x20--profile\x20'+_0x240f7f+_0x37628f(0x13a):_0x37628f(0xf2)}};return await writeFile(_0x106463,JSON[_0x37628f(0xfa)](_0x18e679,null,0x2)+'\x0a'),_0x48fee0;}async function restoreClaudeSettings(_0xde46b8){const _0x359f75=a9_0x15a2b0,_0x21632a=join(process[_0x359f75(0xff)](),'.claude'),_0x427f7b=join(_0x21632a,_0x359f75(0x157));if(!existsSync(_0x427f7b))return;try{const _0x5ed418=await readFile(_0x427f7b,_0x359f75(0x122)),_0x24f80c=JSON[_0x359f75(0x16d)](_0x5ed418),_0x1ff01a=_0x24f80c[_0x359f75(0x111)]||{},_0xd6b053=_0x1ff01a[_0x359f75(0x11f)],_0x110fad=((()=>{const _0x389e51=_0x359f75;if(typeof _0xd6b053!=='string')return![];try{const _0x499cdb=new URL(_0xd6b053);return _0x499cdb[_0x389e51(0x162)]==='localhost'||_0x499cdb[_0x389e51(0x162)]===_0x389e51(0xf8);}catch{return![];}})());_0x110fad?(delete _0x1ff01a[_0x359f75(0x11f)],delete _0x1ff01a[_0x359f75(0x176)],delete _0x1ff01a[_0x359f75(0x101)],delete _0x1ff01a[_0x359f75(0x109)],delete _0x1ff01a[_0x359f75(0x10e)]):(_0xde46b8['ANTHROPIC_BASE_URL']!==undefined?_0x1ff01a[_0x359f75(0x11f)]=_0xde46b8['ANTHROPIC_BASE_URL']:delete _0x1ff01a['ANTHROPIC_BASE_URL'],_0xde46b8[_0x359f75(0x176)]!==undefined?_0x1ff01a[_0x359f75(0x176)]=_0xde46b8[_0x359f75(0x176)]:delete _0x1ff01a[_0x359f75(0x176)],_0xde46b8[_0x359f75(0x101)]!==undefined?_0x1ff01a[_0x359f75(0x101)]=_0xde46b8[_0x359f75(0x101)]:delete _0x1ff01a['ANTHROPIC_AUTH_TOKEN'],_0xde46b8[_0x359f75(0x109)]!==undefined?_0x1ff01a[_0x359f75(0x109)]=_0xde46b8[_0x359f75(0x109)]:delete _0x1ff01a['CLAUDE_CODE_USE_BEDROCK'],_0xde46b8[_0x359f75(0x10e)]!==undefined?_0x1ff01a[_0x359f75(0x10e)]=_0xde46b8[_0x359f75(0x10e)]:delete _0x1ff01a[_0x359f75(0x10e)]);const _0x5bd29c=_0x24f80c[_0x359f75(0x100)],_0x365130=((()=>{const _0xffed4=_0x359f75;if(!_0x5bd29c||typeof _0x5bd29c!==_0xffed4(0x13f))return![];if(_0x5bd29c['type']!=='command')return![];if(typeof _0x5bd29c[_0xffed4(0x10a)]!==_0xffed4(0x120))return![];return _0x5bd29c['command']['includes'](_0xffed4(0x171))&&_0x5bd29c[_0xffed4(0x10a)]['includes'](_0xffed4(0x135));})());if(_0x365130)delete _0x24f80c['statusLine'];else _0xde46b8[_0x359f75(0x100)]!==undefined?_0x24f80c[_0x359f75(0x100)]=_0xde46b8[_0x359f75(0x100)]:delete _0x24f80c['statusLine'];_0x24f80c[_0x359f75(0x111)]=_0x1ff01a,await writeFile(_0x427f7b,JSON['stringify'](_0x24f80c,null,0x2)+'\x0a');}catch{}}export class ClaudeCommand extends BaseCommand{[a9_0x15a2b0(0x12b)]=a9_0x15a2b0(0x105);[a9_0x15a2b0(0x16b)]=a9_0x15a2b0(0x175);[a9_0x15a2b0(0x12f)];[a9_0x15a2b0(0x161)];[a9_0x15a2b0(0x136)];[a9_0x15a2b0(0x123)];async[a9_0x15a2b0(0x137)](_0x22007e){const _0x376488=a9_0x15a2b0,{tdx:_0x13a271,options:_0x232d3d,args:_0x1f90dc}=_0x22007e;let _0x41d73c=![];try{const _0x300eca=_0x232d3d,_0x390fc7=_0x300eca['proxy']===![],_0x1fa9bd=_0x300eca[_0x376488(0x121)]===!![],_0x1bdaf9=_0x300eca[_0x376488(0x106)]===!![],_0x101e0c=[..._0x1f90dc];if(_0x1fa9bd)_0x101e0c['unshift']('-c');else _0x1bdaf9&&_0x101e0c[_0x376488(0x166)]('-r');const _0x3e5417=createCommandSpinner(_0x376488(0x172),{'verbose':_0x232d3d['verbose']});_0x3e5417['start']();try{if(!_0x390fc7){_0x3e5417[_0x376488(0x10b)]=_0x376488(0x14d),this[_0x376488(0x123)]=await findAvailablePort(0xfa0),_0x3e5417[_0x376488(0x10b)]=_0x376488(0x15e)+this[_0x376488(0x123)];const _0x29635e=_0x232d3d[_0x376488(0x144)];try{const _0x5bc0b5=await _0x13a271[_0x376488(0x11d)]['getCurrent']();_0x5bc0b5[_0x376488(0x17d)]&&writeCachedAccountInfo(_0x232d3d[_0x376488(0x17a)],_0x5bc0b5[_0x376488(0x17d)],_0x29635e);}catch{}_0x3e5417['text']=_0x376488(0x154),this[_0x376488(0x136)]=new TDXLogger(_0x232d3d[_0x376488(0x10f)],!![]),await this['logger'][_0x376488(0x113)]();const _0x1def31=this[_0x376488(0x136)][_0x376488(0x180)]();_0x3e5417[_0x376488(0x10b)]=_0x376488(0x16a)+_0x1def31;const _0x38f9f7=getEndpoint(_0x232d3d[_0x376488(0x17a)],_0x376488(0x147));_0x3e5417['text']=_0x376488(0x13d);if(!_0x13a271[_0x376488(0x102)][_0x376488(0x14e)])throw new SDKError(ErrorCode[_0x376488(0x15b)],'API\x20key\x20is\x20required\x20for\x20TD\x20LLM\x20Proxy\x20mode');this[_0x376488(0x12f)]=new PassThroughProxyServer({'port':this[_0x376488(0x123)],'llmProxyUrl':_0x38f9f7,'apiKey':_0x13a271[_0x376488(0x102)]['apiKey'],'logger':this[_0x376488(0x136)],'site':_0x232d3d[_0x376488(0x17a)],'profile':_0x29635e}),await this[_0x376488(0x12f)][_0x376488(0x11b)](),_0x3e5417['text']=_0x376488(0x155)+this[_0x376488(0x123)]+_0x376488(0x118)+_0x38f9f7,_0x3e5417[_0x376488(0x10b)]=_0x376488(0xf0),this[_0x376488(0x161)]=await createClaudeSettings(this[_0x376488(0x123)],undefined,_0x29635e),_0x3e5417[_0x376488(0x10b)]='✓\x20Settings\x20configured:\x20.claude/settings.local.json';}else _0x3e5417[_0x376488(0x10b)]=_0x376488(0x107);try{_0x3e5417[_0x376488(0x10b)]=_0x376488(0x13e),await checkClaudeVersion(MIN_CLAUDE_VERSION,this[_0x376488(0x136)]),_0x3e5417[_0x376488(0x10b)]=_0x376488(0x103);}catch(_0x276be1){_0x3e5417['fail'](_0x376488(0x128));throw _0x276be1;}try{await ensureMcpServer(_0x376488(0xfe),_0x376488(0x131),_0x376488(0x153),_0x3e5417,this['logger']);}catch(_0x503249){handleInstallationError(_0x503249,_0x376488(0x126),_0x3e5417,this[_0x376488(0x136)]);}try{const _0xeccd92=getTdSkillsRepoUrl();_0x41d73c=_0xeccd92!==DEFAULT_TD_SKILLS_URL,_0x41d73c&&await removeMarketplace(_0x376488(0x14a),this['logger']),await ensureMarketplace(_0x376488(0x14a),_0xeccd92,_0x3e5417,this[_0x376488(0x136)]),await updateMarketplace(_0x376488(0x14a),_0x3e5417,this[_0x376488(0x136)]),await ensurePlugin(_0x376488(0x156),_0x376488(0x14a),_0x3e5417,this[_0x376488(0x136)]),await ensurePlugin(_0x376488(0x173),_0x376488(0x14a),_0x3e5417,this['logger']),await ensurePlugin(_0x376488(0x125),_0x376488(0x14a),_0x3e5417,this[_0x376488(0x136)]);}catch(_0x2e324e){handleInstallationError(_0x2e324e,_0x376488(0x159),_0x3e5417,this['logger']);}_0x3e5417['stop']();}catch(_0x3649f8){_0x3e5417['fail'](_0x376488(0x12e));throw _0x3649f8;}const _0x570d62=await findExecutable(_0x376488(0x105));if(!_0x570d62)throw new SDKError(ErrorCode[_0x376488(0x14f)],_0x376488(0x130),undefined,{'helpText':'Please\x20install\x20Claude\x20Code\x20from\x20https://claude.com/claude-code'});const _0x3d6685={...process.env};!_0x390fc7&&(_0x3d6685[_0x376488(0x11f)]='http://127.0.0.1:'+this[_0x376488(0x123)],_0x3d6685[_0x376488(0x101)]='tdx-managed-proxy',_0x3d6685[_0x376488(0x109)]=_0x376488(0x17f),_0x3d6685['CLAUDE_CODE_USE_VERTEX']='false');const _0x143af3=crossSpawn(_0x570d62,_0x101e0c,{'stdio':'inherit','env':_0x3d6685}),_0x29989f=await new Promise(_0x195655=>{_0x143af3['on']('exit',_0x53b6b2=>{_0x195655(_0x53b6b2||0x0);}),_0x143af3['on']('error',_0x39d98e=>{const _0x4405dc=a9_0x3364;console[_0x4405dc(0x139)](a9_0x514734['red']('Failed\x20to\x20launch\x20Claude\x20Code:\x20'+_0x39d98e['message'])),_0x195655(0x1);});});_0x41d73c&&await restoreDefaultTdSkillsMarketplace(this[_0x376488(0x136)]);this[_0x376488(0x12f)]&&(await this[_0x376488(0x12f)]['stop'](),console['log'](a9_0x514734[_0x376488(0xef)](_0x376488(0x145))));if(this[_0x376488(0x136)]){await this[_0x376488(0x136)]['close']();const _0x3491c2=this['logger']['getLogPath']();console['log'](a9_0x514734[_0x376488(0xef)]('✓\x20Logs\x20saved\x20to\x20'+_0x3491c2));}return this[_0x376488(0x161)]&&(await restoreClaudeSettings(this['originalSettings']),console[_0x376488(0x114)](a9_0x514734[_0x376488(0xef)]('✓\x20Settings\x20restored:\x20.claude/settings.local.json'))),_0x29989f;}catch(_0x10c38e){_0x41d73c&&await restoreDefaultTdSkillsMarketplace(this[_0x376488(0x136)]);this[_0x376488(0x12f)]&&await this[_0x376488(0x12f)][_0x376488(0x11c)]();this[_0x376488(0x136)]&&await this['logger'][_0x376488(0x12c)]();this[_0x376488(0x161)]&&await restoreClaudeSettings(this[_0x376488(0x161)]);throw _0x10c38e;}}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const a10_0xe5eba7=a10_0x1fb7;(function(_0x4f2639,_0x20f8c0){const _0x26169e=a10_0x1fb7,_0x4f6a36=_0x4f2639();while(!![]){try{const _0x3cae0d=-parseInt(_0x26169e(0x16d))/0x1+parseInt(_0x26169e(0x155))/0x2*(-parseInt(_0x26169e(0x158))/0x3)+parseInt(_0x26169e(0x15d))/0x4*(-parseInt(_0x26169e(0x16c))/0x5)+-parseInt(_0x26169e(0x15c))/0x6+-parseInt(_0x26169e(0x164))/0x7*(parseInt(_0x26169e(0x16a))/0x8)+parseInt(_0x26169e(0x160))/0x9*(-parseInt(_0x26169e(0x15e))/0xa)+parseInt(_0x26169e(0x172))/0xb;if(_0x3cae0d===_0x20f8c0)break;else _0x4f6a36['push'](_0x4f6a36['shift']());}catch(_0x599541){_0x4f6a36['push'](_0x4f6a36['shift']());}}}(a10_0x23d1,0x755e1));import{createInterface}from'node:readline';import{BaseCommand}from'./command.js';import{getUsageStats}from'../proxy/claude-usage-tracker.js';import{readCachedAccountInfo}from'../core/config.js';function a10_0x23d1(){const _0x5e62a0=['Output\x20statusline\x20for\x20Claude\x20Code\x20(reads\x20JSON\x20from\x20stdin)','latestInputTokens','profile','2563392uPWTpA','60xvTRBG','80ovyUlD','tdx','179298oOxWRK','💎\x20tdx\x20-\x20Claude','parse','session_id','222481vPXoDS','description','site','\x20|\x20','\x20-\x20','join','96YyQfLh','model','53950MsymOl','457406mToMiY','accountId','💎\x20','execute','line','27168823QfUnTq','monthCredits','log','\x20session\x20/\x20','push','🧠\x20','4oiJrxv','toFixed','stdin','602844RkNrYH'];a10_0x23d1=function(){return _0x5e62a0;};return a10_0x23d1();}import{getModelDisplayName,formatTokenCount,calculateContextPercentage}from'../sdk/llm/model-factors.js';async function readStdinJson(_0x4f2a5f=0x64){return new Promise(_0x88d807=>{const _0x5a19bc=a10_0x1fb7;let _0x26a9ce='',_0x536c5c=![];const _0x4db931=createInterface({'input':process[_0x5a19bc(0x157)],'terminal':![]}),_0x491256=_0x5533c8=>{if(_0x536c5c)return;_0x536c5c=!![],clearTimeout(_0x11056e),_0x4db931['close'](),_0x88d807(_0x5533c8);},_0x11056e=setTimeout(()=>{_0x491256(null);},_0x4f2a5f);_0x4db931['on'](_0x5a19bc(0x171),_0x2b347b=>{_0x26a9ce+=_0x2b347b;}),_0x4db931['on']('close',()=>{const _0x3ff870=_0x5a19bc;if(_0x536c5c)return;try{const _0x44dc8a=JSON[_0x3ff870(0x162)](_0x26a9ce);_0x491256(_0x44dc8a);}catch{_0x491256(null);}});});}function formatCredits(_0x193884){const _0xa84295=a10_0x1fb7;return _0x193884[_0xa84295(0x156)](0x2);}function a10_0x1fb7(_0x3e92e3,_0x10acf9){_0x3e92e3=_0x3e92e3-0x153;const _0x23d146=a10_0x23d1();let _0x1fb78a=_0x23d146[_0x3e92e3];return _0x1fb78a;}export class ClaudeStatuslineCommand extends BaseCommand{['name']='statusline';[a10_0xe5eba7(0x165)]=a10_0xe5eba7(0x159);async[a10_0xe5eba7(0x170)](_0x53acdb){const _0x38a16e=a10_0xe5eba7;try{const _0x50b995=await readStdinJson();if(!_0x50b995?.[_0x38a16e(0x163)])return console[_0x38a16e(0x174)](_0x38a16e(0x161)),0x0;const _0x46791e=_0x50b995[_0x38a16e(0x163)],_0x510dd6=_0x50b995[_0x38a16e(0x16b)]?.['id']||'',_0x43305b=_0x50b995[_0x38a16e(0x15b)]||_0x53acdb['options'][_0x38a16e(0x15b)],_0x5b97e8=await getUsageStats(_0x46791e,_0x43305b),_0x149b4b=[],_0x2e46a0=readCachedAccountInfo(_0x43305b),_0x28a0b7=_0x2e46a0?'tdx\x20'+_0x2e46a0[_0x38a16e(0x166)]+':'+_0x2e46a0[_0x38a16e(0x16e)]:_0x38a16e(0x15f),_0x4ee390=_0x510dd6?getModelDisplayName(_0x510dd6):'Claude';_0x149b4b[_0x38a16e(0x153)](_0x38a16e(0x16f)+_0x28a0b7+_0x38a16e(0x168)+_0x4ee390);const _0x7976cc=formatCredits(_0x5b97e8['sessionCredits']),_0x1ee145=formatCredits(_0x5b97e8['todayCredits']),_0x3af7a6=formatCredits(_0x5b97e8[_0x38a16e(0x173)]);_0x149b4b[_0x38a16e(0x153)]('🪙\x20credit:\x20'+_0x7976cc+_0x38a16e(0x175)+_0x1ee145+'\x20today\x20/\x20'+_0x3af7a6+'\x20month');if(_0x5b97e8['latestInputTokens']>0x0&&_0x510dd6){const _0x5c6608=formatTokenCount(_0x5b97e8[_0x38a16e(0x15a)]),_0x39acef=calculateContextPercentage(_0x5b97e8[_0x38a16e(0x15a)],_0x510dd6);_0x149b4b['push'](_0x38a16e(0x154)+_0x5c6608+'\x20('+_0x39acef+'%)');}return console['log'](_0x149b4b[_0x38a16e(0x169)](_0x38a16e(0x167))),0x0;}catch{return console[_0x38a16e(0x174)](_0x38a16e(0x161)),0x0;}}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function a11_0x4281(){const _0x55e839=['bold','Error:\x20','outputStructured','getTime','\x20\x20Today:\x20\x20\x20','8098734rIntzH','toFixed','Source','(default)','map','Usage\x20by\x20Source','10334984HhJidp','34HLGJrv','toLocaleDateString','\x20credits','message','error','todayCredits','Total','padStart','en-CA','never','\x20\x20Month:\x20\x20\x20','padEnd','Month','4006864GIcoEi','profile','19102fZaqir','length','yesterday','en-US','dim','\x20days\x20ago','format','4966850vfhUFJ','\x20\x20Total:\x20\x20\x20','name','usage','2-digit','description','repeat','today\x20','Usage\x20by\x20Profile','outputTable','cyan','monthCredits','Today','Credits','Requests','round','short','lastUsedAt','Last\x20Used','source','entryCount','json','default','log','toLocaleTimeString','red','2873676ciMpmn','jsonl','totalCredits','credits','3410166RFltBg','\x20\x20Run\x20\x22tdx\x20claude\x22\x20to\x20start\x20using\x20AI\x20Suite.\x0a','Profile','profileCount'];a11_0x4281=function(){return _0x55e839;};return a11_0x4281();}function a11_0x2597(_0x152e63,_0x5c727a){_0x152e63=_0x152e63-0x19c;const _0x42813f=a11_0x4281();let _0x25977b=_0x42813f[_0x152e63];return _0x25977b;}const a11_0x568a03=a11_0x2597;(function(_0x18ba96,_0x102d88){const _0x3a9fca=a11_0x2597,_0x21acaa=_0x18ba96();while(!![]){try{const _0x26b3bd=-parseInt(_0x3a9fca(0x1a3))/0x1*(-parseInt(_0x3a9fca(0x1d8))/0x2)+parseInt(_0x3a9fca(0x1c8))/0x3+parseInt(_0x3a9fca(0x1a1))/0x4+-parseInt(_0x3a9fca(0x1aa))/0x5+-parseInt(_0x3a9fca(0x1c4))/0x6+parseInt(_0x3a9fca(0x1d1))/0x7+-parseInt(_0x3a9fca(0x1d7))/0x8;if(_0x26b3bd===_0x102d88)break;else _0x21acaa['push'](_0x21acaa['shift']());}catch(_0xb96ff){_0x21acaa['push'](_0x21acaa['shift']());}}}(a11_0x4281,0xd0f89));import a11_0x2d50eb from'chalk';import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../core/command-output.js';import{getAllProfileStats,getAllSourceStats,getUsageSummary}from'../proxy/claude-usage-tracker.js';function formatCredits(_0x1f96bf){const _0x20efad=a11_0x2597;return _0x1f96bf[_0x20efad(0x1d2)](0x2);}function formatLastUsed(_0x1d793c){const _0x335d95=a11_0x2597;if(!_0x1d793c)return _0x335d95(0x19d);const _0x2bb841=new Date(_0x1d793c),_0x53d5b7=new Date(),_0x636c54=_0x2bb841[_0x335d95(0x1d9)]('en-CA'),_0x4331f4=_0x53d5b7[_0x335d95(0x1d9)](_0x335d95(0x19c));if(_0x636c54===_0x4331f4)return _0x335d95(0x1b1)+_0x2bb841[_0x335d95(0x1c2)](_0x335d95(0x1a6),{'hour':_0x335d95(0x1ae),'minute':_0x335d95(0x1ae)});const _0x1a40e6=new Date(_0x636c54),_0x49820a=new Date(_0x4331f4),_0x3708ea=Math[_0x335d95(0x1b9)]((_0x49820a['getTime']()-_0x1a40e6[_0x335d95(0x1cf)]())/(0x18*0x3c*0x3c*0x3e8));if(_0x3708ea===0x1)return _0x335d95(0x1a5);else return _0x3708ea>0x1&&_0x3708ea<0x7?_0x3708ea+_0x335d95(0x1a8):_0x2bb841[_0x335d95(0x1d9)](_0x335d95(0x1a6),{'month':_0x335d95(0x1ba),'day':'numeric'});}export class ClaudeUsageCommand extends BaseCommand{[a11_0x568a03(0x1ac)]=a11_0x568a03(0x1ad);[a11_0x568a03(0x1af)]='Show\x20AI\x20Suite\x20credit\x20usage\x20by\x20profile';async['execute'](_0x456c49){const _0x3c5a1f=a11_0x568a03,{options:_0x44ad0f}=_0x456c49,_0x2a1b29=_0x44ad0f['format']===_0x3c5a1f(0x1bf)||_0x44ad0f[_0x3c5a1f(0x1a9)]===_0x3c5a1f(0x1c5)||_0x44ad0f['json'];try{const [_0x38be8d,_0x4aa456,_0x1d6ca1]=await Promise['all']([getAllProfileStats(),getAllSourceStats(),getUsageSummary()]);return _0x2a1b29?await this[_0x3c5a1f(0x1ce)](_0x38be8d,_0x4aa456,_0x1d6ca1,_0x44ad0f):this['outputTable'](_0x38be8d,_0x4aa456,_0x1d6ca1),0x0;}catch(_0x22c3db){const _0x5494c4=_0x22c3db instanceof Error?_0x22c3db[_0x3c5a1f(0x1db)]:'Unknown\x20error';return console[_0x3c5a1f(0x1dc)](a11_0x2d50eb[_0x3c5a1f(0x1c3)](_0x3c5a1f(0x1cd)+_0x5494c4)),0x1;}}async['outputStructured'](_0x481145,_0x5f353a,_0x1d6657,_0x335024){const _0x2bb47c=a11_0x568a03,_0x462dc1={'summary':{'todayCredits':_0x1d6657[_0x2bb47c(0x1dd)],'monthCredits':_0x1d6657[_0x2bb47c(0x1b5)],'totalCredits':_0x1d6657[_0x2bb47c(0x1c6)],'profileCount':_0x1d6657[_0x2bb47c(0x1cb)]},'profiles':_0x481145[_0x2bb47c(0x1d5)](_0x566a37=>({'profile':_0x566a37[_0x2bb47c(0x1a2)],'credits':_0x566a37['credits'],'requests':_0x566a37[_0x2bb47c(0x1be)],'lastUsedAt':_0x566a37[_0x2bb47c(0x1bb)]})),'sources':_0x5f353a[_0x2bb47c(0x1d5)](_0x2a76af=>({'source':_0x2a76af[_0x2bb47c(0x1bd)],'credits':_0x2a76af[_0x2bb47c(0x1c7)],'todayCredits':_0x2a76af[_0x2bb47c(0x1dd)],'monthCredits':_0x2a76af['monthCredits'],'requests':_0x2a76af['entryCount']}))};await handleSDKOutput([_0x462dc1],_0x335024);}[a11_0x568a03(0x1b3)](_0x2bbd1e,_0x4c8226,_0x2b5b30){const _0x358990=a11_0x568a03;console[_0x358990(0x1c1)](a11_0x2d50eb['bold']('\x0aAI\x20Suite\x20Credit\x20Usage\x20Summary')),console[_0x358990(0x1c1)](a11_0x2d50eb[_0x358990(0x1a7)]('─'[_0x358990(0x1b0)](0x32))),console['log'](_0x358990(0x1d0)+a11_0x2d50eb[_0x358990(0x1b4)](formatCredits(_0x2b5b30[_0x358990(0x1dd)]))+_0x358990(0x1da)),console[_0x358990(0x1c1)](_0x358990(0x19e)+a11_0x2d50eb[_0x358990(0x1b4)](formatCredits(_0x2b5b30[_0x358990(0x1b5)]))+'\x20credits'),console[_0x358990(0x1c1)](_0x358990(0x1ab)+a11_0x2d50eb[_0x358990(0x1b4)](formatCredits(_0x2b5b30[_0x358990(0x1c6)]))+_0x358990(0x1da)),console[_0x358990(0x1c1)]();if(_0x4c8226[_0x358990(0x1a4)]>0x0){console[_0x358990(0x1c1)](a11_0x2d50eb[_0x358990(0x1cc)](_0x358990(0x1d6))),console[_0x358990(0x1c1)](a11_0x2d50eb[_0x358990(0x1a7)]('─'[_0x358990(0x1b0)](0x3c)));const _0x17e50d=0xc,_0x28fa67=0xa,_0x2c12be=0xa,_0x3571f7=0xa;console[_0x358990(0x1c1)]('\x20\x20'+_0x358990(0x1d3)[_0x358990(0x19f)](_0x17e50d)+'\x20\x20'+_0x358990(0x1de)[_0x358990(0x1df)](_0x28fa67)+'\x20\x20'+_0x358990(0x1b6)['padStart'](_0x2c12be)+'\x20\x20'+_0x358990(0x1a0)[_0x358990(0x1df)](_0x3571f7));for(const _0xbefbd3 of _0x4c8226){console[_0x358990(0x1c1)]('\x20\x20'+_0xbefbd3[_0x358990(0x1bd)][_0x358990(0x19f)](_0x17e50d)+'\x20\x20'+a11_0x2d50eb[_0x358990(0x1b4)](formatCredits(_0xbefbd3['credits'])['padStart'](_0x28fa67))+'\x20\x20'+formatCredits(_0xbefbd3[_0x358990(0x1dd)])[_0x358990(0x1df)](_0x2c12be)+'\x20\x20'+formatCredits(_0xbefbd3[_0x358990(0x1b5)])['padStart'](_0x3571f7));}console[_0x358990(0x1c1)]();}if(_0x2bbd1e[_0x358990(0x1a4)]===0x0){console['log'](a11_0x2d50eb[_0x358990(0x1a7)]('\x20\x20No\x20usage\x20data\x20recorded\x20yet.')),console['log'](a11_0x2d50eb[_0x358990(0x1a7)](_0x358990(0x1c9)));return;}console[_0x358990(0x1c1)](a11_0x2d50eb[_0x358990(0x1cc)](_0x358990(0x1b2))),console[_0x358990(0x1c1)](a11_0x2d50eb[_0x358990(0x1a7)]('─'['repeat'](0x3c)));const _0x43879d=Math['max'](0xc,..._0x2bbd1e[_0x358990(0x1d5)](_0x3e2e19=>_0x3e2e19['profile']===_0x358990(0x1c0)?'(default)'[_0x358990(0x1a4)]:_0x3e2e19[_0x358990(0x1a2)][_0x358990(0x1a4)])),_0x365938=0xa,_0x4f5900=0xa;console['log']('\x20\x20'+_0x358990(0x1ca)[_0x358990(0x19f)](_0x43879d)+'\x20\x20'+_0x358990(0x1b7)[_0x358990(0x1df)](_0x365938)+'\x20\x20'+_0x358990(0x1b8)[_0x358990(0x1df)](_0x4f5900)+'\x20\x20'+_0x358990(0x1bc));for(const _0x4dd996 of _0x2bbd1e){const _0x4e2ae3=_0x4dd996[_0x358990(0x1a2)]==='default'?_0x358990(0x1d4):_0x4dd996[_0x358990(0x1a2)],_0x587c91=_0x4e2ae3[_0x358990(0x19f)](_0x43879d),_0x5921d1=_0x4dd996[_0x358990(0x1a2)]===_0x358990(0x1c0)?a11_0x2d50eb['dim'](_0x587c91):_0x587c91;console[_0x358990(0x1c1)]('\x20\x20'+_0x5921d1+'\x20\x20'+a11_0x2d50eb['cyan'](formatCredits(_0x4dd996[_0x358990(0x1c7)])['padStart'](_0x365938))+'\x20\x20'+String(_0x4dd996[_0x358990(0x1be)])[_0x358990(0x1df)](_0x4f5900)+'\x20\x20'+a11_0x2d50eb[_0x358990(0x1a7)](formatLastUsed(_0x4dd996['lastUsedAt'])));}console[_0x358990(0x1c1)](),console[_0x358990(0x1c1)](a11_0x2d50eb['dim']('Note:\x20Credit\x20values\x20are\x20estimates\x20based\x20on\x20token\x20usage.')),console[_0x358990(0x1c1)]();}}
|
package/dist/commands/command.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const a12_0x161863=a12_0x3044;(function(_0x13e906,_0x6c705f){const _0x35ac68=a12_0x3044,_0x46f7e3=_0x13e906();while(!![]){try{const _0x3ca2e7=-parseInt(_0x35ac68(0x84))/0x1*(parseInt(_0x35ac68(0x7a))/0x2)+-parseInt(_0x35ac68(0x8c))/0x3+parseInt(_0x35ac68(0xa0))/0x4+parseInt(_0x35ac68(0x75))/0x5+-parseInt(_0x35ac68(0x83))/0x6*(parseInt(_0x35ac68(0x7e))/0x7)+parseInt(_0x35ac68(0xa6))/0x8+-parseInt(_0x35ac68(0x9a))/0x9;if(_0x3ca2e7===_0x6c705f)break;else _0x46f7e3['push'](_0x46f7e3['shift']());}catch(_0xad4825){_0x46f7e3['push'](_0x46f7e3['shift']());}}}(a12_0xa562,0xb5050));function a12_0xa562(){const _0x3bfe55=['dim','from','10454752fZfbSc','\x0aStack\x20trace:\x0a','7403200CsbWyk','set','number','stack','Reason:\x20','2FXCcWe','\x27\x20is\x20already\x20registered','red','Invalid\x20limit\x20value:\x20','134428YVUubh','Error:\x20','name','helpText','limit','144szSMCn','1436793uEddvL','.\x20Must\x20be\x20a\x20number.','problemDetails','Authentication\x20failed','has','execute','Authentication\x20error\x20stack\x20trace:','message','1816542FfYlvR','command','profile','status','values','cyan','debug','validate','register','detail','isValid','To\x20set\x20up\x20authentication:','options','commands','3311064fqMLlT','USER_ERROR','get','error','validateGlobalOptions','value','3300284kttoKd','tdx\x20auth\x20setup','tdx\x20auth','\x20--profile\x20'];a12_0xa562=function(){return _0x3bfe55;};return a12_0xa562();}import{validateLimitOption}from'../utils/option-validation.js';import{HTTPClientError}from'../sdk/client/http-client.js';import{SDKError,ErrorCategory}from'../sdk/errors.js';function a12_0x3044(_0x3001ab,_0x25c0f5){_0x3001ab=_0x3001ab-0x75;const _0xa562d9=a12_0xa562();let _0x3044f1=_0xa562d9[_0x3001ab];return _0x3044f1;}import{Logger}from'../utils/logger/index.js';import a12_0x358c03 from'chalk';export function printAuthError(_0x47a362,_0x1f9f53=![],_0x2a5607){const _0x31d076=a12_0x3044,_0x405783=_0x47a362[_0x31d076(0x86)]?.[_0x31d076(0x95)]||_0x47a362[_0x31d076(0x8b)];console[_0x31d076(0x9d)](a12_0x358c03[_0x31d076(0x7c)](_0x31d076(0x87))),console['error'](a12_0x358c03[_0x31d076(0x7c)](_0x31d076(0x79)+_0x405783));if(_0x1f9f53){const _0x2a563b=_0x2a5607?_0x31d076(0xa3)+_0x2a5607:'';console[_0x31d076(0x9d)]('\x0a'+a12_0x358c03[_0x31d076(0xa4)](_0x31d076(0x97))),console[_0x31d076(0x9d)]('\x20\x20'+a12_0x358c03['cyan'](_0x31d076(0xa1)+_0x2a563b)+'\x0a'),console['error'](''+a12_0x358c03[_0x31d076(0xa4)]('To\x20check\x20your\x20current\x20auth\x20status:')),console[_0x31d076(0x9d)]('\x20\x20'+a12_0x358c03[_0x31d076(0x91)](_0x31d076(0xa2)+_0x2a563b));}}export class BaseCommand{[a12_0x161863(0x9e)](_0x286358){const _0x41199b=a12_0x161863,{options:_0x312122}=_0x286358,_0x26f639=_0x312122[_0x41199b(0x82)];if(_0x26f639!==undefined){const _0x5b183d=typeof _0x26f639===_0x41199b(0x77)?_0x26f639:parseInt(_0x26f639,0xa);if(isNaN(_0x5b183d))return _0x41199b(0x7d)+_0x26f639+_0x41199b(0x85);const _0x1c0bca=validateLimitOption(_0x5b183d);if(!_0x1c0bca[_0x41199b(0x96)])return _0x1c0bca[_0x41199b(0x9d)];_0x286358[_0x41199b(0x98)][_0x41199b(0x82)]=_0x1c0bca[_0x41199b(0x9f)];}return undefined;}[a12_0x161863(0x93)](_0x48f863){return undefined;}async['run'](_0x343dc9){const _0x3333c5=a12_0x161863;try{const _0x135f76=this['validateGlobalOptions'](_0x343dc9);if(_0x135f76)return console[_0x3333c5(0x9d)](_0x3333c5(0x7f)+_0x135f76),0x1;const _0xd78574=this['validate'](_0x343dc9);if(_0xd78574){const _0x199ada=/^\s*(Usage|Note|Warning|Error):/i['test'](_0xd78574);return _0x199ada?console[_0x3333c5(0x9d)](_0xd78574):console[_0x3333c5(0x9d)](_0x3333c5(0x7f)+_0xd78574),0x1;}const _0x1b1247=await this[_0x3333c5(0x89)](_0x343dc9);return _0x1b1247??0x0;}catch(_0x249ad5){if(_0x249ad5 instanceof Error){if(_0x249ad5 instanceof HTTPClientError&&_0x249ad5[_0x3333c5(0x8f)]===0x191){const _0x246562=_0x343dc9[_0x3333c5(0x98)][_0x3333c5(0x8e)];printAuthError(_0x249ad5,!![],_0x246562);if(_0x249ad5[_0x3333c5(0x78)]){const _0x3e27b7=Logger['of'](_0x3333c5(0x8d));_0x3e27b7['debug'](_0x3333c5(0x8a)),_0x3e27b7[_0x3333c5(0x92)](_0x249ad5[_0x3333c5(0x78)]);}return 0x1;}console[_0x3333c5(0x9d)](a12_0x358c03[_0x3333c5(0x7c)](_0x3333c5(0x7f)+_0x249ad5[_0x3333c5(0x8b)]));_0x249ad5 instanceof SDKError&&_0x249ad5[_0x3333c5(0x81)]&&console['error'](a12_0x358c03['yellow'](_0x249ad5[_0x3333c5(0x81)]));const _0x15e090=_0x249ad5 instanceof SDKError&&_0x249ad5['category']===ErrorCategory[_0x3333c5(0x9b)];_0x249ad5['stack']&&!_0x15e090&&console[_0x3333c5(0x9d)](_0x3333c5(0xa7)+_0x249ad5[_0x3333c5(0x78)]);}else console[_0x3333c5(0x9d)](_0x3333c5(0x7f)+String(_0x249ad5));return 0x1;}}}export class CommandRegistry{[a12_0x161863(0x99)]=new Map();[a12_0x161863(0x94)](_0x34e8f7){const _0x337e05=a12_0x161863;if(this[_0x337e05(0x99)][_0x337e05(0x88)](_0x34e8f7[_0x337e05(0x80)]))throw new Error('Command\x20\x27'+_0x34e8f7[_0x337e05(0x80)]+_0x337e05(0x7b));this['commands'][_0x337e05(0x76)](_0x34e8f7[_0x337e05(0x80)],_0x34e8f7);}[a12_0x161863(0x9c)](_0x3d4641){const _0x9833db=a12_0x161863;return this[_0x9833db(0x99)][_0x9833db(0x9c)](_0x3d4641);}['getAll'](){const _0x751180=a12_0x161863;return Array[_0x751180(0xa5)](this['commands'][_0x751180(0x90)]());}[a12_0x161863(0x88)](_0x477f2e){const _0x55405a=a12_0x161863;return this[_0x55405a(0x99)][_0x55405a(0x88)](_0x477f2e);}}export const registry=new CommandRegistry();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a13_0x1aca14=a13_0x286b;function a13_0x286b(_0x40c602,_0x26a964){_0x40c602=_0x40c602-0x12c;const _0x41f9ba=a13_0x41f9();let _0x286b91=_0x41f9ba[_0x40c602];return _0x286b91;}function a13_0x41f9(){const _0x3c27f8=['List\x20all\x20result\x20output\x20connections','verbose','settings','error','default_value','\x0aAvailable\x20fields:','padStart','value','✔\x20Found\x20settings\x20for\x20connector\x20type:\x20','description','7919824YzZrLZ','cyan','credential','dim','\x0aNo\x20credential\x20settings\x20defined','push','3770770zWGpPR','connection:schema','properties','yellow','findByName','\x27...','entries','89160EylGTH','\x20connection','Listing\x20connections...','name','legacy_settings','minimum','slice','Name:\x20','label','find','✔\x20Found\x20','localeCompare','table','output','✔\x20Resolved\x20\x27','1QDqZzv','owner','819370cWzNlq','Range:\x20','connection:settings','options','\x20[record]','Usage:\x20tdx\x20connection\x20settings\x20<type>\x0a\x0aArguments:\x0a\x20\x20<type>\x20\x20\x20\x20Connector\x20type\x20(e.g.,\x20\x27salesforce\x27,\x20\x27rest\x27,\x20\x27s3\x27)\x0a\x0aExamples:\x0a\x20\x20tdx\x20connection\x20settings\x20rest\x0a\x20\x20tdx\x20connection\x20settings\x20salesforce\x0a\x20\x20tdx\x20connection\x20settings\x20s3\x0a\x0aNote:\x20This\x20shows\x20settings\x20for\x20creating/configuring\x20a\x20connection.\x0aFor\x20activation\x20output\x20settings,\x20use\x20\x27tdx\x20connection\x20schema\x20<type>\x27.\x0aUse\x20\x27tdx\x20connection\x20types\x27\x20to\x20list\x20available\x20connector\x20types.','join','\x20-\x20','Fetching\x20settings\x20for\x20connector\x20type:\x20','\x20\x20\x20\x20Options:\x20','repeat','criteria','List\x20available\x20connector\x20types','connection:types','bold','max','\x0aCredential\x20settings:','\x0aConnector:\x20','input','stringify','type','connection:list','✔\x20Found\x20schema\x20for\x20connection\x20\x27','9pmVHyb','No\x20available\x20fields\x20for\x20this\x20connector','getMetadata','listTypes','Fetching\x20connection\x20\x27','Options:\x20','log','hidden','blue','filter','Show\x20when:\x20','title','\x20\x20\x20\x20Default:\x20','map','maximum','Show\x20connection-level\x20settings\x20(credentials,\x20authentication)','connection:show','record','132QkzHjL','\x27\x20(type:\x20','execute','Listing\x20connector\x20types...','\x20connector\x20type','\x0aNo\x20fields\x20defined\x20in\x20schema','348132hCYAWE','62280EzjtCH','1604382AzKOPS','object','enumeration','✔\x20Found\x20schema\x20for\x20connector\x20type:\x20','Site:\x20','legacy','Type:\x20','data','list','site','<=\x20','✔\x20Found\x20connection:\x20','getOutputSchema','length','hint','validate','\x27\x20as\x20connection\x20name\x20→\x20type:\x20','connection','Fetching\x20settings\x20for\x20\x27','green','511nRZgbj','\x20\x20\x20\x20','\x27\x20as\x20connector\x20type'];a13_0x41f9=function(){return _0x3c27f8;};return a13_0x41f9();}(function(_0x3c083c,_0x89034){const _0x43acc7=a13_0x286b,_0x225896=_0x3c083c();while(!![]){try{const _0x3ea1d5=parseInt(_0x43acc7(0x15e))/0x1*(parseInt(_0x43acc7(0x191))/0x2)+parseInt(_0x43acc7(0x14f))/0x3*(-parseInt(_0x43acc7(0x189))/0x4)+-parseInt(_0x43acc7(0x148))/0x5+parseInt(_0x43acc7(0x18f))/0x6+parseInt(_0x43acc7(0x135))/0x7*(parseInt(_0x43acc7(0x190))/0x8)+parseInt(_0x43acc7(0x177))/0x9*(parseInt(_0x43acc7(0x160))/0xa)+parseInt(_0x43acc7(0x142))/0xb;if(_0x3ea1d5===_0x89034)break;else _0x225896['push'](_0x225896['shift']());}catch(_0x4c64af){_0x225896['push'](_0x225896['shift']());}}}(a13_0x41f9,0x78fa5));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_0x250e80 from'chalk';function normalizeSchemaForDisplay(_0x45ebd7){const _0x4facab=a13_0x286b,_0x4d04c2=_0x45ebd7[_0x4facab(0x14a)]||[],_0x4e4f3f=_0x4d04c2[_0x4facab(0x158)](_0x20e714=>_0x20e714['name']===_0x4facab(0x153)&&_0x20e714[_0x4facab(0x174)]===_0x4facab(0x188)&&_0x20e714[_0x4facab(0x14a)]);if(_0x4e4f3f?.[_0x4facab(0x14a)]){const _0x1152cf=_0x4d04c2[_0x4facab(0x180)](_0x241b53=>_0x241b53['name']!=='legacy'&&_0x241b53['name']!==_0x4facab(0x153));return[..._0x1152cf,..._0x4e4f3f[_0x4facab(0x14a)]];}return _0x4d04c2['filter'](_0x14fa33=>_0x14fa33[_0x4facab(0x152)]!==_0x4facab(0x196));}function printSchemaFields(_0x2a46f2,_0xa9a63e){const _0x22922b=a13_0x286b,_0x44adb2='\x20\x20'[_0x22922b(0x16a)](_0xa9a63e+0x1),_0xfb214='\x20\x20'[_0x22922b(0x16a)](_0xa9a63e+0x2);for(const _0x185829 of _0x2a46f2){if(!_0x185829['name'])continue;const _0x3da168=_0x185829['type']===_0x22922b(0x188)&&_0x185829['properties']&&_0x185829[_0x22922b(0x14a)][_0x22922b(0x12e)]>0x0&&_0x185829['name']!=='legacy_settings';let _0x253b61=''+_0x44adb2+a13_0x250e80[_0x22922b(0x134)](_0x185829[_0x22922b(0x152)]);_0x185829[_0x22922b(0x182)]&&(_0x253b61+=':\x20'+_0x185829['title']);if(_0x185829[_0x22922b(0x172)])_0x253b61+=a13_0x250e80[_0x22922b(0x145)]('\x20['+_0x185829['input']+']');else _0x3da168&&(_0x253b61+=a13_0x250e80['dim'](_0x22922b(0x164)));console[_0x22922b(0x17d)](_0x253b61);_0x185829['description']&&console[_0x22922b(0x17d)](''+_0xfb214+a13_0x250e80[_0x22922b(0x145)](_0x185829[_0x22922b(0x141)]));if(_0x185829[_0x22922b(0x193)]){const _0x147bb7=_0x185829[_0x22922b(0x193)][_0x22922b(0x184)](_0x102019=>typeof _0x102019===_0x22922b(0x192)&&'value'in _0x102019?_0x102019[_0x22922b(0x13f)]:_0x102019)[_0x22922b(0x166)](',\x20');console[_0x22922b(0x17d)](_0xfb214+_0x22922b(0x17c)+a13_0x250e80[_0x22922b(0x14b)](_0x147bb7));}_0x185829[_0x22922b(0x13c)]!==undefined&&console[_0x22922b(0x17d)](_0xfb214+'Default:\x20'+a13_0x250e80['blue'](String(_0x185829[_0x22922b(0x13c)])));if(_0x185829[_0x22922b(0x154)]!==undefined||_0x185829[_0x22922b(0x185)]!==undefined){const _0x34f25f=_0x185829[_0x22922b(0x154)]!==undefined&&_0x185829['maximum']!==undefined?_0x185829['minimum']+_0x22922b(0x167)+_0x185829[_0x22922b(0x185)]:_0x185829[_0x22922b(0x154)]!==undefined?'>=\x20'+_0x185829[_0x22922b(0x154)]:_0x22922b(0x19b)+_0x185829['maximum'];console[_0x22922b(0x17d)](_0xfb214+_0x22922b(0x161)+a13_0x250e80[_0x22922b(0x17f)](_0x34f25f));}if(_0x185829[_0x22922b(0x16b)]){const _0x5bfe13=Object[_0x22922b(0x14e)](_0x185829[_0x22922b(0x16b)])[_0x22922b(0x184)](([_0x205c5b,_0x4fd4d4])=>_0x205c5b+'='+JSON[_0x22922b(0x173)](_0x4fd4d4))[_0x22922b(0x166)](',\x20');console[_0x22922b(0x17d)](''+_0xfb214+a13_0x250e80[_0x22922b(0x145)](_0x22922b(0x181)+_0x5bfe13));}_0x3da168&&_0x185829[_0x22922b(0x14a)]&&printSchemaFields(_0x185829[_0x22922b(0x14a)],_0xa9a63e+0x1);}}export class ConnectionListCommand extends BaseCommand{[a13_0x1aca14(0x152)]=a13_0x1aca14(0x175);['description']=a13_0x1aca14(0x138);async[a13_0x1aca14(0x18b)](_0x35809c){const _0xa63d0a=a13_0x1aca14,{options:_0x21dbbf,tdx:_0x20298b}=_0x35809c;_0x21dbbf[_0xa63d0a(0x139)]&&console[_0xa63d0a(0x13b)](_0xa63d0a(0x195)+_0x21dbbf[_0xa63d0a(0x19a)]);const _0x3fae7e=resolveLimit(_0x21dbbf['limit'],DEFAULT_LISTING_LIMIT),_0xc00a7b=await withSpinner(_0xa63d0a(0x151),()=>_0x20298b[_0xa63d0a(0x132)][_0xa63d0a(0x199)](),{'verbose':_0x21dbbf['verbose']}),_0x13bb31=_0xc00a7b[_0xa63d0a(0x198)];console[_0xa63d0a(0x13b)](_0xa63d0a(0x159)+_0x13bb31[_0xa63d0a(0x12e)]+_0xa63d0a(0x150)+(_0x13bb31['length']!==0x1?'s':''));if(isStructuredFormat(_0x21dbbf)){const _0x2e46e2=_0x13bb31[_0xa63d0a(0x155)](0x0,_0x3fae7e);await handleSDKOutput(_0x2e46e2,{..._0x21dbbf,'limit':_0x3fae7e});}else{const _0x375aa4=_0x13bb31[_0xa63d0a(0x12e)]>0x0?Math[_0xa63d0a(0x16f)](..._0x13bb31[_0xa63d0a(0x184)](_0x1e07ed=>_0x1e07ed[_0xa63d0a(0x174)]['length'])):0x0,_0x134be8=[];for(const _0xa32ee6 of _0x13bb31){const _0x27583c=a13_0x250e80['cyan'](_0xa32ee6[_0xa63d0a(0x174)][_0xa63d0a(0x13e)](_0x375aa4)),_0x4868e4=_0xa32ee6['owner']?.[_0xa63d0a(0x152)]?_0xa63d0a(0x167)+a13_0x250e80[_0xa63d0a(0x145)](_0xa32ee6[_0xa63d0a(0x15f)][_0xa63d0a(0x152)]):'';_0x134be8['push'](_0x27583c+'\x20\x20'+_0xa32ee6[_0xa63d0a(0x152)]+_0x4868e4);}await writeOutput(_0x134be8['join']('\x0a'),_0x21dbbf[_0xa63d0a(0x15c)],_0xa63d0a(0x15b));}return 0x0;}}export class ConnectionShowCommand extends BaseCommand{[a13_0x1aca14(0x152)]=a13_0x1aca14(0x187);[a13_0x1aca14(0x141)]='Show\x20connection\x20details';[a13_0x1aca14(0x130)](_0x154984){const {args:_0x3f901d}=_0x154984;if(!_0x3f901d[0x0])return'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';return undefined;}async[a13_0x1aca14(0x18b)](_0x295208){const _0x42bb91=a13_0x1aca14,{options:_0x5dd82a,args:_0x4d89ee,tdx:_0x7d84f1}=_0x295208,_0x1eee82=_0x4d89ee[0x0];_0x5dd82a[_0x42bb91(0x139)]&&(console[_0x42bb91(0x13b)](_0x42bb91(0x195)+_0x5dd82a['site']),console[_0x42bb91(0x13b)]('Looking\x20up\x20connection:\x20'+_0x1eee82));const _0x397ba2=await withSpinner(_0x42bb91(0x17b)+_0x1eee82+_0x42bb91(0x14d),()=>_0x7d84f1['connection']['resolve'](_0x1eee82),{'verbose':_0x5dd82a[_0x42bb91(0x139)]}),_0x59225b=_0x397ba2[_0x42bb91(0x198)];return console[_0x42bb91(0x13b)](_0x42bb91(0x12c)+_0x59225b[_0x42bb91(0x152)]),await handleSingleObjectOutput(_0x59225b,_0x5dd82a),0x0;}}export class ConnectionSchemaCommand extends BaseCommand{[a13_0x1aca14(0x152)]=a13_0x1aca14(0x149);[a13_0x1aca14(0x141)]='Show\x20connector\x20output\x20schema\x20for\x20connector_config\x20validation';[a13_0x1aca14(0x130)](_0xbdc795){const {args:_0x32df58}=_0xbdc795;if(!_0x32df58[0x0])return'Usage:\x20tdx\x20connection\x20schema\x20<type-or-name>\x0a\x0aArguments:\x0a\x20\x20<type-or-name>\x20\x20\x20\x20Connector\x20type\x20(e.g.,\x20\x27salesforce\x27,\x20\x27pgsql\x27,\x20\x27s3\x27)\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20or\x20connection\x20name\x20(e.g.,\x20\x27my-salesforce-connection\x27)\x0a\x0aExamples:\x0a\x20\x20tdx\x20connection\x20schema\x20salesforce\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20By\x20connector\x20type\x0a\x20\x20tdx\x20connection\x20schema\x20my-s3-connection\x20\x20\x20\x20\x20#\x20By\x20connection\x20name\x0a\x20\x20tdx\x20connection\x20schema\x20pgsql\x0a\x0aUse\x20\x27tdx\x20connection\x20types\x27\x20to\x20list\x20available\x20connector\x20types.\x0aUse\x20\x27tdx\x20connection\x20list\x27\x20to\x20list\x20available\x20connections.';return undefined;}async['execute'](_0x42a2f6){const _0x594cae=a13_0x1aca14,{options:_0x448714,args:_0x3065cf,tdx:_0x578e69}=_0x42a2f6,_0x5d6ac6=_0x3065cf[0x0];_0x448714[_0x594cae(0x139)]&&(console['error'](_0x594cae(0x195)+_0x448714[_0x594cae(0x19a)]),console[_0x594cae(0x13b)]('Resolving\x20connector\x20type\x20or\x20name:\x20'+_0x5d6ac6));let _0x25de44=_0x5d6ac6,_0x4eebf4;try{const _0x45c574=await _0x578e69[_0x594cae(0x132)][_0x594cae(0x14c)](_0x5d6ac6);_0x45c574&&(_0x25de44=_0x45c574[_0x594cae(0x174)],_0x4eebf4=_0x45c574[_0x594cae(0x152)],_0x448714[_0x594cae(0x139)]&&console[_0x594cae(0x13b)](_0x594cae(0x15d)+_0x5d6ac6+_0x594cae(0x131)+_0x25de44));}catch{_0x448714[_0x594cae(0x139)]&&console[_0x594cae(0x13b)]('Treating\x20\x27'+_0x5d6ac6+_0x594cae(0x137));}const _0x546bce=await withSpinner('Fetching\x20schema\x20for\x20\x27'+_0x25de44+_0x594cae(0x14d),()=>_0x578e69['connection'][_0x594cae(0x12d)](_0x25de44),{'verbose':_0x448714[_0x594cae(0x139)]}),_0x608b93=_0x546bce[_0x594cae(0x198)];_0x4eebf4?console['error'](_0x594cae(0x176)+_0x4eebf4+_0x594cae(0x18a)+_0x25de44+')'):console[_0x594cae(0x13b)](_0x594cae(0x194)+_0x25de44);if(isStructuredFormat(_0x448714))await handleSingleObjectOutput(_0x608b93,_0x448714);else{const _0x8467a6=normalizeSchemaForDisplay(_0x608b93);_0x4eebf4?(console[_0x594cae(0x17d)]('\x0aConnection:\x20'+a13_0x250e80[_0x594cae(0x143)](_0x4eebf4)),console['log'](_0x594cae(0x197)+a13_0x250e80[_0x594cae(0x145)](_0x25de44))):console['log'](_0x594cae(0x171)+a13_0x250e80[_0x594cae(0x143)](_0x25de44)),_0x8467a6[_0x594cae(0x12e)]>0x0?(console[_0x594cae(0x17d)](a13_0x250e80['bold'](_0x594cae(0x13d))),printSchemaFields(_0x8467a6,0x0)):console['log'](a13_0x250e80[_0x594cae(0x145)](_0x594cae(0x18e)));}return 0x0;}}export class ConnectionTypesCommand extends BaseCommand{[a13_0x1aca14(0x152)]=a13_0x1aca14(0x16d);['description']=a13_0x1aca14(0x16c);async[a13_0x1aca14(0x18b)](_0x4a623d){const _0x595a97=a13_0x1aca14,{options:_0x2ffa63,tdx:_0x1a0389}=_0x4a623d;_0x2ffa63['verbose']&&console[_0x595a97(0x13b)]('Site:\x20'+_0x2ffa63[_0x595a97(0x19a)]);const _0x477f4f=await withSpinner(_0x595a97(0x18c),()=>_0x1a0389[_0x595a97(0x132)][_0x595a97(0x17a)](),{'verbose':_0x2ffa63[_0x595a97(0x139)]}),_0x1bdec9=_0x477f4f['data']['sort']((_0xf9f263,_0xde594e)=>_0xf9f263['type'][_0x595a97(0x15a)](_0xde594e[_0x595a97(0x174)]));console[_0x595a97(0x13b)](_0x595a97(0x159)+_0x1bdec9[_0x595a97(0x12e)]+_0x595a97(0x18d)+(_0x1bdec9[_0x595a97(0x12e)]!==0x1?'s':''));if(isStructuredFormat(_0x2ffa63))await handleSDKOutput(_0x1bdec9,_0x2ffa63);else{const _0x881c17=_0x1bdec9[_0x595a97(0x12e)]>0x0?Math[_0x595a97(0x16f)](..._0x1bdec9['map'](_0x43a0a1=>_0x43a0a1['type'][_0x595a97(0x12e)])):0x0,_0x32e274=[];for(const _0x12ddfe of _0x1bdec9){const _0x183ccb=a13_0x250e80[_0x595a97(0x143)](_0x12ddfe[_0x595a97(0x174)][_0x595a97(0x13e)](_0x881c17));_0x32e274[_0x595a97(0x147)](_0x183ccb+'\x20\x20'+_0x12ddfe['name']);}await writeOutput(_0x32e274['join']('\x0a'),_0x2ffa63[_0x595a97(0x15c)],_0x595a97(0x15b));}return 0x0;}}export class ConnectionSettingsCommand extends BaseCommand{[a13_0x1aca14(0x152)]=a13_0x1aca14(0x162);[a13_0x1aca14(0x141)]=a13_0x1aca14(0x186);[a13_0x1aca14(0x130)](_0x13913e){const _0x4eba10=a13_0x1aca14,{args:_0x5dbaf9}=_0x13913e;if(!_0x5dbaf9[0x0])return _0x4eba10(0x165);return undefined;}async[a13_0x1aca14(0x18b)](_0x3924c3){const _0x2bce6b=a13_0x1aca14,{options:_0x20aa64,args:_0x539484,tdx:_0xb45f5d}=_0x3924c3,_0x207fee=_0x539484[0x0];_0x20aa64[_0x2bce6b(0x139)]&&(console[_0x2bce6b(0x13b)](_0x2bce6b(0x195)+_0x20aa64['site']),console[_0x2bce6b(0x13b)](_0x2bce6b(0x168)+_0x207fee));const _0x126acd=await withSpinner(_0x2bce6b(0x133)+_0x207fee+_0x2bce6b(0x14d),()=>_0xb45f5d['connection'][_0x2bce6b(0x179)](_0x207fee),{'verbose':_0x20aa64[_0x2bce6b(0x139)]}),_0x5050ba=_0x126acd[_0x2bce6b(0x198)];console[_0x2bce6b(0x13b)](_0x2bce6b(0x140)+_0x207fee);if(isStructuredFormat(_0x20aa64))await handleSingleObjectOutput(_0x5050ba,_0x20aa64);else{console[_0x2bce6b(0x17d)](_0x2bce6b(0x171)+a13_0x250e80[_0x2bce6b(0x143)](_0x207fee)),console['log'](_0x2bce6b(0x156)+_0x5050ba[_0x2bce6b(0x152)]);const _0x4178a0=_0x5050ba[_0x2bce6b(0x13a)]||[],_0x28e40f=_0x4178a0[_0x2bce6b(0x180)](_0x4561d2=>_0x4561d2['credential']);_0x28e40f[_0x2bce6b(0x12e)]>0x0&&(console[_0x2bce6b(0x17d)](a13_0x250e80[_0x2bce6b(0x16e)](_0x2bce6b(0x170))),printMetadataSettings(_0x28e40f));let _0x3bdcbb=![];try{const _0x3a36dc=await _0xb45f5d[_0x2bce6b(0x132)][_0x2bce6b(0x12d)](_0x207fee),_0xfacf35=normalizeSchemaForDisplay(_0x3a36dc);_0xfacf35[_0x2bce6b(0x12e)]>0x0&&(console[_0x2bce6b(0x17d)](a13_0x250e80['bold']('\x0aAvailable\x20fields:')),printSchemaFields(_0xfacf35,0x0),_0x3bdcbb=!![]);}catch{const _0x1da1f8=_0x4178a0[_0x2bce6b(0x180)](_0x3eb6f1=>!_0x3eb6f1[_0x2bce6b(0x144)]);_0x1da1f8[_0x2bce6b(0x12e)]>0x0&&(console[_0x2bce6b(0x17d)](a13_0x250e80[_0x2bce6b(0x16e)]('\x0aAvailable\x20fields:')),printMetadataSettings(_0x1da1f8),_0x3bdcbb=!![]);}!_0x3bdcbb&&_0x20aa64[_0x2bce6b(0x139)]&&console[_0x2bce6b(0x13b)](a13_0x250e80['dim'](_0x2bce6b(0x178))),_0x28e40f[_0x2bce6b(0x12e)]===0x0&&console['log'](a13_0x250e80[_0x2bce6b(0x145)](_0x2bce6b(0x146)));}return 0x0;}}function printMetadataSettings(_0x13625c){const _0x14cb3f=a13_0x1aca14;for(const _0x6a8d of _0x13625c){if(!_0x6a8d[_0x14cb3f(0x152)])continue;if(_0x6a8d[_0x14cb3f(0x17e)])continue;let _0x2f21fa='\x20\x20'+a13_0x250e80[_0x14cb3f(0x134)](_0x6a8d['name']);_0x6a8d[_0x14cb3f(0x157)]&&(_0x2f21fa+=':\x20'+_0x6a8d[_0x14cb3f(0x157)]);_0x6a8d[_0x14cb3f(0x174)]&&(_0x2f21fa+=a13_0x250e80[_0x14cb3f(0x145)]('\x20['+_0x6a8d[_0x14cb3f(0x174)]+']'));console[_0x14cb3f(0x17d)](_0x2f21fa);_0x6a8d[_0x14cb3f(0x12f)]&&console[_0x14cb3f(0x17d)](_0x14cb3f(0x136)+a13_0x250e80[_0x14cb3f(0x145)](_0x6a8d['hint']));if(_0x6a8d[_0x14cb3f(0x163)]){const _0x5a2428=_0x6a8d['options']['map'](_0x1030b7=>_0x1030b7[_0x14cb3f(0x13f)])[_0x14cb3f(0x166)](',\x20');console['log'](_0x14cb3f(0x169)+a13_0x250e80[_0x14cb3f(0x14b)](_0x5a2428));}_0x6a8d[_0x14cb3f(0x13c)]!==undefined&&_0x6a8d[_0x14cb3f(0x13c)]!==null&&console[_0x14cb3f(0x17d)](_0x14cb3f(0x183)+a13_0x250e80[_0x14cb3f(0x17f)](String(_0x6a8d[_0x14cb3f(0x13c)])));if(_0x6a8d[_0x14cb3f(0x16b)]){const _0x158608=Object[_0x14cb3f(0x14e)](_0x6a8d[_0x14cb3f(0x16b)])[_0x14cb3f(0x184)](([_0xf3d76d,_0x1625c8])=>_0xf3d76d+'='+JSON[_0x14cb3f(0x173)](_0x1625c8))[_0x14cb3f(0x166)](',\x20');console[_0x14cb3f(0x17d)]('\x20\x20\x20\x20'+a13_0x250e80[_0x14cb3f(0x145)]('Show\x20when:\x20'+_0x158608));}}}
|
|
1
|
+
const a13_0x3e7eca=a13_0x49ab;function a13_0x1cbf(){const _0x1541b1=['Usage:\x20tdx\x20connection\x20show\x20<name>\x0a\x0aArguments:\x0a\x20\x20<name>\x20\x20\x20\x20Connection\x20name\x0a\x0aExamples:\x0a\x20\x20tdx\x20connection\x20show\x20my-s3-connection\x0a\x20\x20tdx\x20connection\x20show\x20\x22My\x20Salesforce\x20Connection\x22','legacy_settings','dim','Show\x20connection\x20details','\x20-\x20','map','\x20[record]','list','enumeration','\x27\x20as\x20connector\x20type','blue','bold','green','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.','resolve','No\x20available\x20fields\x20for\x20this\x20connector','type','✔\x20Found\x20connection:\x20','3076WljhFh','data','verbose','default_value','<=\x20','>=\x20','title','533574kekrBn','Resolving\x20connector\x20type\x20or\x20name:\x20','352365IAagah','push','legacy','List\x20all\x20result\x20output\x20connections','table','✔\x20Found\x20schema\x20for\x20connection\x20\x27','Fetching\x20settings\x20for\x20\x27','1226834MzCCiI','4sIXsXl','cyan','Treating\x20\x27','connection:list','1240728jqPOYf','execute','5pKKQVQ','label','length','\x20connector\x20type','\x20\x20\x20\x20','173vWvQGP','criteria','7958401ilxfCQ','✔\x20Found\x20settings\x20for\x20connector\x20type:\x20','stringify','minimum','options','\x0aConnector:\x20','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.','✔\x20Found\x20','Listing\x20connections...','localeCompare','maximum','object','732609TLnnlJ','✔\x20Resolved\x20\x27','\x0aNo\x20credential\x20settings\x20defined','owner','connection','description','\x27\x20(type:\x20','error','padStart','Show\x20when:\x20','find','\x0aAvailable\x20fields:','Fetching\x20connection\x20\x27','\x27...','log','hint','properties','connection:show','connection:types','entries','Looking\x20up\x20connection:\x20','getOutputSchema','value','connection:schema','connection:settings','sort','max','record','getMetadata','\x20\x20\x20\x20Default:\x20','validate','Fetching\x20settings\x20for\x20connector\x20type:\x20','repeat','\x20connection','credential','\x0aNo\x20fields\x20defined\x20in\x20schema','\x20\x20\x20\x20Options:\x20','\x0aConnection:\x20','filter','Show\x20connection-level\x20settings\x20(credentials,\x20authentication)','10UvPKyA','yellow','name','Listing\x20connector\x20types...','Site:\x20','join','site','Options:\x20','✔\x20Found\x20schema\x20for\x20connector\x20type:\x20','\x27\x20as\x20connection\x20name\x20→\x20type:\x20','output','Fetching\x20schema\x20for\x20\x27','List\x20available\x20connector\x20types','input'];a13_0x1cbf=function(){return _0x1541b1;};return a13_0x1cbf();}(function(_0x1d2474,_0x32745f){const _0x189408=a13_0x49ab,_0x428cd7=_0x1d2474();while(!![]){try{const _0x570377=-parseInt(_0x189408(0x1f5))/0x1*(parseInt(_0x189408(0x1d9))/0x2)+parseInt(_0x189408(0x1e2))/0x3*(-parseInt(_0x189408(0x1ea))/0x4)+-parseInt(_0x189408(0x1f0))/0x5*(parseInt(_0x189408(0x1e0))/0x6)+-parseInt(_0x189408(0x1e9))/0x7+parseInt(_0x189408(0x1ee))/0x8+-parseInt(_0x189408(0x203))/0x9*(parseInt(_0x189408(0x1b9))/0xa)+parseInt(_0x189408(0x1f7))/0xb;if(_0x570377===_0x32745f)break;else _0x428cd7['push'](_0x428cd7['shift']());}catch(_0x327769){_0x428cd7['push'](_0x428cd7['shift']());}}}(a13_0x1cbf,0x247d5));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_0x1921f2 from'chalk';function a13_0x49ab(_0x34f661,_0x19ac08){_0x34f661=_0x34f661-0x1b5;const _0x1cbfb3=a13_0x1cbf();let _0x49ab2d=_0x1cbfb3[_0x34f661];return _0x49ab2d;}function normalizeSchemaForDisplay(_0x56bb0b){const _0x229f22=a13_0x49ab,_0x83e210=_0x56bb0b[_0x229f22(0x213)]||[],_0x4f203a=_0x83e210[_0x229f22(0x20d)](_0x5f3cd9=>_0x5f3cd9[_0x229f22(0x1bb)]===_0x229f22(0x1c8)&&_0x5f3cd9[_0x229f22(0x1d7)]===_0x229f22(0x21e)&&_0x5f3cd9[_0x229f22(0x213)]);if(_0x4f203a?.['properties']){const _0x2859ce=_0x83e210[_0x229f22(0x1b7)](_0x335940=>_0x335940['name']!==_0x229f22(0x1e4)&&_0x335940[_0x229f22(0x1bb)]!=='legacy_settings');return[..._0x2859ce,..._0x4f203a[_0x229f22(0x213)]];}return _0x83e210['filter'](_0x25c866=>_0x25c866[_0x229f22(0x1bb)]!==_0x229f22(0x1e4));}function printSchemaFields(_0x484957,_0x37bfc5){const _0x49c37b=a13_0x49ab,_0xb2f9e='\x20\x20'[_0x49c37b(0x223)](_0x37bfc5+0x1),_0x5eeb21='\x20\x20'[_0x49c37b(0x223)](_0x37bfc5+0x2);for(const _0x3d5563 of _0x484957){if(!_0x3d5563[_0x49c37b(0x1bb)])continue;const _0x101882=_0x3d5563[_0x49c37b(0x1d7)]===_0x49c37b(0x21e)&&_0x3d5563['properties']&&_0x3d5563['properties'][_0x49c37b(0x1f2)]>0x0&&_0x3d5563[_0x49c37b(0x1bb)]!==_0x49c37b(0x1c8);let _0x573981=''+_0xb2f9e+a13_0x1921f2[_0x49c37b(0x1d3)](_0x3d5563[_0x49c37b(0x1bb)]);_0x3d5563[_0x49c37b(0x1df)]&&(_0x573981+=':\x20'+_0x3d5563[_0x49c37b(0x1df)]);if(_0x3d5563[_0x49c37b(0x1c6)])_0x573981+=a13_0x1921f2[_0x49c37b(0x1c9)]('\x20['+_0x3d5563['input']+']');else _0x101882&&(_0x573981+=a13_0x1921f2['dim'](_0x49c37b(0x1cd)));console['log'](_0x573981);_0x3d5563[_0x49c37b(0x208)]&&console[_0x49c37b(0x211)](''+_0x5eeb21+a13_0x1921f2[_0x49c37b(0x1c9)](_0x3d5563[_0x49c37b(0x208)]));if(_0x3d5563['enumeration']){const _0x2592bc=_0x3d5563[_0x49c37b(0x1cf)][_0x49c37b(0x1cc)](_0x537dcb=>typeof _0x537dcb===_0x49c37b(0x202)&&'value'in _0x537dcb?_0x537dcb[_0x49c37b(0x219)]:_0x537dcb)['join'](',\x20');console['log'](_0x5eeb21+_0x49c37b(0x1c0)+a13_0x1921f2['yellow'](_0x2592bc));}_0x3d5563[_0x49c37b(0x1dc)]!==undefined&&console[_0x49c37b(0x211)](_0x5eeb21+'Default:\x20'+a13_0x1921f2[_0x49c37b(0x1d1)](String(_0x3d5563[_0x49c37b(0x1dc)])));if(_0x3d5563[_0x49c37b(0x1fa)]!==undefined||_0x3d5563[_0x49c37b(0x201)]!==undefined){const _0x434f5c=_0x3d5563['minimum']!==undefined&&_0x3d5563[_0x49c37b(0x201)]!==undefined?_0x3d5563[_0x49c37b(0x1fa)]+'\x20-\x20'+_0x3d5563[_0x49c37b(0x201)]:_0x3d5563['minimum']!==undefined?_0x49c37b(0x1de)+_0x3d5563[_0x49c37b(0x1fa)]:_0x49c37b(0x1dd)+_0x3d5563[_0x49c37b(0x201)];console['log'](_0x5eeb21+'Range:\x20'+a13_0x1921f2[_0x49c37b(0x1d1)](_0x434f5c));}if(_0x3d5563[_0x49c37b(0x1f6)]){const _0x5d4073=Object[_0x49c37b(0x216)](_0x3d5563['criteria'])[_0x49c37b(0x1cc)](([_0x3e3809,_0x378490])=>_0x3e3809+'='+JSON[_0x49c37b(0x1f9)](_0x378490))[_0x49c37b(0x1be)](',\x20');console['log'](''+_0x5eeb21+a13_0x1921f2[_0x49c37b(0x1c9)](_0x49c37b(0x20c)+_0x5d4073));}_0x101882&&_0x3d5563[_0x49c37b(0x213)]&&printSchemaFields(_0x3d5563['properties'],_0x37bfc5+0x1);}}export class ConnectionListCommand extends BaseCommand{['name']=a13_0x3e7eca(0x1ed);['description']=a13_0x3e7eca(0x1e5);async[a13_0x3e7eca(0x1ef)](_0x138170){const _0x25e3ad=a13_0x3e7eca,{options:_0x341d69,tdx:_0x1624af}=_0x138170;_0x341d69[_0x25e3ad(0x1db)]&&console[_0x25e3ad(0x20a)](_0x25e3ad(0x1bd)+_0x341d69[_0x25e3ad(0x1bf)]);const _0x277ccd=resolveLimit(_0x341d69['limit'],DEFAULT_LISTING_LIMIT),_0x52f327=await withSpinner(_0x25e3ad(0x1ff),()=>_0x1624af['connection'][_0x25e3ad(0x1ce)](),{'verbose':_0x341d69[_0x25e3ad(0x1db)]}),_0x106f10=_0x52f327[_0x25e3ad(0x1da)];console[_0x25e3ad(0x20a)](_0x25e3ad(0x1fe)+_0x106f10[_0x25e3ad(0x1f2)]+_0x25e3ad(0x224)+(_0x106f10['length']!==0x1?'s':''));if(isStructuredFormat(_0x341d69)){const _0x401c0a=_0x106f10['slice'](0x0,_0x277ccd);await handleSDKOutput(_0x401c0a,{..._0x341d69,'limit':_0x277ccd});}else{const _0xb5626b=_0x106f10[_0x25e3ad(0x1f2)]>0x0?Math[_0x25e3ad(0x21d)](..._0x106f10[_0x25e3ad(0x1cc)](_0x44b5ca=>_0x44b5ca[_0x25e3ad(0x1d7)][_0x25e3ad(0x1f2)])):0x0,_0xf687c0=[];for(const _0x194073 of _0x106f10){const _0x3ede88=a13_0x1921f2[_0x25e3ad(0x1eb)](_0x194073['type'][_0x25e3ad(0x20b)](_0xb5626b)),_0x35d024=_0x194073[_0x25e3ad(0x206)]?.['name']?_0x25e3ad(0x1cb)+a13_0x1921f2[_0x25e3ad(0x1c9)](_0x194073[_0x25e3ad(0x206)][_0x25e3ad(0x1bb)]):'';_0xf687c0[_0x25e3ad(0x1e3)](_0x3ede88+'\x20\x20'+_0x194073['name']+_0x35d024);}await writeOutput(_0xf687c0[_0x25e3ad(0x1be)]('\x0a'),_0x341d69[_0x25e3ad(0x1c3)],'table');}return 0x0;}}export class ConnectionShowCommand extends BaseCommand{[a13_0x3e7eca(0x1bb)]=a13_0x3e7eca(0x214);[a13_0x3e7eca(0x208)]=a13_0x3e7eca(0x1ca);[a13_0x3e7eca(0x221)](_0x4d1ab0){const _0x45a766=a13_0x3e7eca,{args:_0x4408d7}=_0x4d1ab0;if(!_0x4408d7[0x0])return _0x45a766(0x1c7);return undefined;}async[a13_0x3e7eca(0x1ef)](_0x3755f8){const _0x257ce5=a13_0x3e7eca,{options:_0x149d8c,args:_0x50e249,tdx:_0x3c38ca}=_0x3755f8,_0x54d636=_0x50e249[0x0];_0x149d8c['verbose']&&(console[_0x257ce5(0x20a)](_0x257ce5(0x1bd)+_0x149d8c[_0x257ce5(0x1bf)]),console[_0x257ce5(0x20a)](_0x257ce5(0x217)+_0x54d636));const _0x52dfaf=await withSpinner(_0x257ce5(0x20f)+_0x54d636+_0x257ce5(0x210),()=>_0x3c38ca[_0x257ce5(0x207)][_0x257ce5(0x1d5)](_0x54d636),{'verbose':_0x149d8c[_0x257ce5(0x1db)]}),_0x3a14b0=_0x52dfaf[_0x257ce5(0x1da)];return console[_0x257ce5(0x20a)](_0x257ce5(0x1d8)+_0x3a14b0[_0x257ce5(0x1bb)]),await handleSingleObjectOutput(_0x3a14b0,_0x149d8c),0x0;}}export class ConnectionSchemaCommand extends BaseCommand{['name']=a13_0x3e7eca(0x21a);[a13_0x3e7eca(0x208)]='Show\x20connector\x20output\x20schema\x20for\x20connector_config\x20validation';[a13_0x3e7eca(0x221)](_0xf92582){const _0x106fb1=a13_0x3e7eca,{args:_0x247ace}=_0xf92582;if(!_0x247ace[0x0])return _0x106fb1(0x1fd);return undefined;}async[a13_0x3e7eca(0x1ef)](_0x18e2df){const _0x50985b=a13_0x3e7eca,{options:_0x557cf2,args:_0x4460d5,tdx:_0x1aae9a}=_0x18e2df,_0x2f83cf=_0x4460d5[0x0];_0x557cf2[_0x50985b(0x1db)]&&(console[_0x50985b(0x20a)](_0x50985b(0x1bd)+_0x557cf2['site']),console[_0x50985b(0x20a)](_0x50985b(0x1e1)+_0x2f83cf));let _0x38dfe1=_0x2f83cf,_0x37486c;try{const _0x3b49b0=await _0x1aae9a[_0x50985b(0x207)]['findByName'](_0x2f83cf);_0x3b49b0&&(_0x38dfe1=_0x3b49b0['type'],_0x37486c=_0x3b49b0[_0x50985b(0x1bb)],_0x557cf2[_0x50985b(0x1db)]&&console[_0x50985b(0x20a)](_0x50985b(0x204)+_0x2f83cf+_0x50985b(0x1c2)+_0x38dfe1));}catch{_0x557cf2[_0x50985b(0x1db)]&&console[_0x50985b(0x20a)](_0x50985b(0x1ec)+_0x2f83cf+_0x50985b(0x1d0));}const _0x26032d=await withSpinner(_0x50985b(0x1c4)+_0x38dfe1+'\x27...',()=>_0x1aae9a['connection'][_0x50985b(0x218)](_0x38dfe1),{'verbose':_0x557cf2[_0x50985b(0x1db)]}),_0x27442c=_0x26032d[_0x50985b(0x1da)];_0x37486c?console[_0x50985b(0x20a)](_0x50985b(0x1e7)+_0x37486c+_0x50985b(0x209)+_0x38dfe1+')'):console[_0x50985b(0x20a)](_0x50985b(0x1c1)+_0x38dfe1);if(isStructuredFormat(_0x557cf2))await handleSingleObjectOutput(_0x27442c,_0x557cf2);else{const _0x3bd33a=normalizeSchemaForDisplay(_0x27442c);_0x37486c?(console['log'](_0x50985b(0x1b6)+a13_0x1921f2[_0x50985b(0x1eb)](_0x37486c)),console[_0x50985b(0x211)]('Type:\x20'+a13_0x1921f2['dim'](_0x38dfe1))):console[_0x50985b(0x211)](_0x50985b(0x1fc)+a13_0x1921f2[_0x50985b(0x1eb)](_0x38dfe1)),_0x3bd33a[_0x50985b(0x1f2)]>0x0?(console[_0x50985b(0x211)](a13_0x1921f2['bold'](_0x50985b(0x20e))),printSchemaFields(_0x3bd33a,0x0)):console[_0x50985b(0x211)](a13_0x1921f2[_0x50985b(0x1c9)](_0x50985b(0x226)));}return 0x0;}}export class ConnectionTypesCommand extends BaseCommand{[a13_0x3e7eca(0x1bb)]=a13_0x3e7eca(0x215);[a13_0x3e7eca(0x208)]=a13_0x3e7eca(0x1c5);async['execute'](_0x2eccf0){const _0x50b58a=a13_0x3e7eca,{options:_0x2a4b97,tdx:_0x399a70}=_0x2eccf0;_0x2a4b97[_0x50b58a(0x1db)]&&console['error'](_0x50b58a(0x1bd)+_0x2a4b97[_0x50b58a(0x1bf)]);const _0x503875=await withSpinner(_0x50b58a(0x1bc),()=>_0x399a70['connection']['listTypes'](),{'verbose':_0x2a4b97[_0x50b58a(0x1db)]}),_0x4f9603=_0x503875[_0x50b58a(0x1da)][_0x50b58a(0x21c)]((_0x1a0b1f,_0x5aa43d)=>_0x1a0b1f[_0x50b58a(0x1d7)][_0x50b58a(0x200)](_0x5aa43d[_0x50b58a(0x1d7)]));console['error'](_0x50b58a(0x1fe)+_0x4f9603[_0x50b58a(0x1f2)]+_0x50b58a(0x1f3)+(_0x4f9603[_0x50b58a(0x1f2)]!==0x1?'s':''));if(isStructuredFormat(_0x2a4b97))await handleSDKOutput(_0x4f9603,_0x2a4b97);else{const _0x48bc1b=_0x4f9603['length']>0x0?Math['max'](..._0x4f9603['map'](_0x1d8f93=>_0x1d8f93[_0x50b58a(0x1d7)][_0x50b58a(0x1f2)])):0x0,_0x288ab1=[];for(const _0x61e50a of _0x4f9603){const _0x1b395b=a13_0x1921f2['cyan'](_0x61e50a['type'][_0x50b58a(0x20b)](_0x48bc1b));_0x288ab1[_0x50b58a(0x1e3)](_0x1b395b+'\x20\x20'+_0x61e50a[_0x50b58a(0x1bb)]);}await writeOutput(_0x288ab1[_0x50b58a(0x1be)]('\x0a'),_0x2a4b97[_0x50b58a(0x1c3)],_0x50b58a(0x1e6));}return 0x0;}}export class ConnectionSettingsCommand extends BaseCommand{[a13_0x3e7eca(0x1bb)]=a13_0x3e7eca(0x21b);[a13_0x3e7eca(0x208)]=a13_0x3e7eca(0x1b8);[a13_0x3e7eca(0x221)](_0x267ff9){const _0x201077=a13_0x3e7eca,{args:_0x5e5151}=_0x267ff9;if(!_0x5e5151[0x0])return _0x201077(0x1d4);return undefined;}async['execute'](_0x292b7c){const _0x1c5f74=a13_0x3e7eca,{options:_0x28a30a,args:_0x2e7daa,tdx:_0x36a7f2}=_0x292b7c,_0x5ee2c4=_0x2e7daa[0x0];_0x28a30a[_0x1c5f74(0x1db)]&&(console[_0x1c5f74(0x20a)]('Site:\x20'+_0x28a30a[_0x1c5f74(0x1bf)]),console[_0x1c5f74(0x20a)](_0x1c5f74(0x222)+_0x5ee2c4));const _0x31622f=await withSpinner(_0x1c5f74(0x1e8)+_0x5ee2c4+_0x1c5f74(0x210),()=>_0x36a7f2[_0x1c5f74(0x207)][_0x1c5f74(0x21f)](_0x5ee2c4),{'verbose':_0x28a30a['verbose']}),_0x34a177=_0x31622f[_0x1c5f74(0x1da)];console[_0x1c5f74(0x20a)](_0x1c5f74(0x1f8)+_0x5ee2c4);if(isStructuredFormat(_0x28a30a))await handleSingleObjectOutput(_0x34a177,_0x28a30a);else{console[_0x1c5f74(0x211)]('\x0aConnector:\x20'+a13_0x1921f2[_0x1c5f74(0x1eb)](_0x5ee2c4)),console[_0x1c5f74(0x211)]('Name:\x20'+_0x34a177['name']);const _0x29bf35=_0x34a177['settings']||[],_0x1f382e=_0x29bf35[_0x1c5f74(0x1b7)](_0x3846da=>_0x3846da[_0x1c5f74(0x225)]);_0x1f382e[_0x1c5f74(0x1f2)]>0x0&&(console[_0x1c5f74(0x211)](a13_0x1921f2[_0x1c5f74(0x1d2)]('\x0aCredential\x20settings:')),printMetadataSettings(_0x1f382e));let _0x7d0538=![];try{const _0x1ff497=await _0x36a7f2['connection'][_0x1c5f74(0x218)](_0x5ee2c4),_0x5723a8=normalizeSchemaForDisplay(_0x1ff497);_0x5723a8[_0x1c5f74(0x1f2)]>0x0&&(console[_0x1c5f74(0x211)](a13_0x1921f2[_0x1c5f74(0x1d2)](_0x1c5f74(0x20e))),printSchemaFields(_0x5723a8,0x0),_0x7d0538=!![]);}catch{const _0x21e600=_0x29bf35['filter'](_0x3162eb=>!_0x3162eb['credential']);_0x21e600[_0x1c5f74(0x1f2)]>0x0&&(console['log'](a13_0x1921f2['bold'](_0x1c5f74(0x20e))),printMetadataSettings(_0x21e600),_0x7d0538=!![]);}!_0x7d0538&&_0x28a30a['verbose']&&console['error'](a13_0x1921f2['dim'](_0x1c5f74(0x1d6))),_0x1f382e[_0x1c5f74(0x1f2)]===0x0&&console[_0x1c5f74(0x211)](a13_0x1921f2[_0x1c5f74(0x1c9)](_0x1c5f74(0x205)));}return 0x0;}}function printMetadataSettings(_0x1e93d9){const _0x4df11e=a13_0x3e7eca;for(const _0x27fd74 of _0x1e93d9){if(!_0x27fd74[_0x4df11e(0x1bb)])continue;if(_0x27fd74['hidden'])continue;let _0x259d8f='\x20\x20'+a13_0x1921f2[_0x4df11e(0x1d3)](_0x27fd74[_0x4df11e(0x1bb)]);_0x27fd74[_0x4df11e(0x1f1)]&&(_0x259d8f+=':\x20'+_0x27fd74[_0x4df11e(0x1f1)]);_0x27fd74[_0x4df11e(0x1d7)]&&(_0x259d8f+=a13_0x1921f2['dim']('\x20['+_0x27fd74[_0x4df11e(0x1d7)]+']'));console['log'](_0x259d8f);_0x27fd74[_0x4df11e(0x212)]&&console[_0x4df11e(0x211)](_0x4df11e(0x1f4)+a13_0x1921f2[_0x4df11e(0x1c9)](_0x27fd74['hint']));if(_0x27fd74[_0x4df11e(0x1fb)]){const _0x3ed081=_0x27fd74[_0x4df11e(0x1fb)][_0x4df11e(0x1cc)](_0x298451=>_0x298451['value'])[_0x4df11e(0x1be)](',\x20');console[_0x4df11e(0x211)](_0x4df11e(0x1b5)+a13_0x1921f2[_0x4df11e(0x1ba)](_0x3ed081));}_0x27fd74[_0x4df11e(0x1dc)]!==undefined&&_0x27fd74['default_value']!==null&&console[_0x4df11e(0x211)](_0x4df11e(0x220)+a13_0x1921f2[_0x4df11e(0x1d1)](String(_0x27fd74[_0x4df11e(0x1dc)])));if(_0x27fd74['criteria']){const _0x2457eb=Object['entries'](_0x27fd74[_0x4df11e(0x1f6)])[_0x4df11e(0x1cc)](([_0x404ecb,_0x4f8456])=>_0x404ecb+'='+JSON[_0x4df11e(0x1f9)](_0x4f8456))['join'](',\x20');console[_0x4df11e(0x211)](_0x4df11e(0x1f4)+a13_0x1921f2[_0x4df11e(0x1c9)](_0x4df11e(0x20c)+_0x2457eb));}}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a14_0x31ae(){const _0x71caa3=['listDatabases','296iXXXlD','29724GyTDGZ','4428501InEpov','execute','site','Listing\x20databases...','limit','message','78rogPUi','14634OJfaJn','verbose','\x20\x20Cause:\x20','48FXYFVK','126401OXJVpA','792zLGeGl','query','Site:\x20','8vMFFTN','1180MsjTzp','List\x20all\x20databases','41450goHhch','description','1868cdSdKx','error','✔\x20Found\x20','name','1521MlAgIJ','databases','781466lxYhuF','length','cause','Error:\x20','\x20database'];a14_0x31ae=function(){return _0x71caa3;};return a14_0x31ae();}const a14_0x523e4d=a14_0x5f92;(function(_0x206ade,_0xfc6a8c){const _0x12a342=a14_0x5f92,_0x3c0752=_0x206ade();while(!![]){try{const _0x28bbfa=parseInt(_0x12a342(0xe6))/0x1*(-parseInt(_0x12a342(0xee))/0x2)+-parseInt(_0x12a342(0xd9))/0x3*(-parseInt(_0x12a342(0xd8))/0x4)+parseInt(_0x12a342(0xea))/0x5*(-parseInt(_0x12a342(0xe1))/0x6)+-parseInt(_0x12a342(0xda))/0x7*(-parseInt(_0x12a342(0xe9))/0x8)+-parseInt(_0x12a342(0xf2))/0x9*(-parseInt(_0x12a342(0xec))/0xa)+-parseInt(_0x12a342(0xe5))/0xb*(parseInt(_0x12a342(0xe4))/0xc)+parseInt(_0x12a342(0xe0))/0xd*(-parseInt(_0x12a342(0xd2))/0xe);if(_0x28bbfa===_0xfc6a8c)break;else _0x3c0752['push'](_0x3c0752['shift']());}catch(_0x5d2788){_0x3c0752['push'](_0x3c0752['shift']());}}}(a14_0x31ae,0x5a5d2));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';import{handleSDKOutput}from'../core/command-output.js';function a14_0x5f92(_0x392997,_0x29922b){_0x392997=_0x392997-0xd2;const _0x31ae31=a14_0x31ae();let _0x5f9265=_0x31ae31[_0x392997];return _0x5f9265;}import{withSpinner}from'../utils/spinner.js';import{DEFAULT_LISTING_LIMIT,resolveLimit}from'../core/constants.js';export class DatabasesCommand extends BaseCommand{[a14_0x523e4d(0xf1)]=a14_0x523e4d(0xf3);[a14_0x523e4d(0xed)]=a14_0x523e4d(0xeb);async[a14_0x523e4d(0xdb)](_0xe88587){const _0x53b1da=a14_0x523e4d,{options:_0x8536d8,args:_0x400efc,tdx:_0x5e0f6c}=_0xe88587,_0x272a37=_0x400efc[0x0];try{_0x8536d8[_0x53b1da(0xe2)]&&(console[_0x53b1da(0xef)](_0x53b1da(0xe8)+_0x8536d8[_0x53b1da(0xdc)]),_0x272a37&&console[_0x53b1da(0xef)]('Pattern:\x20'+_0x272a37));const _0x5c41a0=resolveLimit(_0x8536d8[_0x53b1da(0xde)],DEFAULT_LISTING_LIMIT),_0x22c448=await withSpinner(_0x53b1da(0xdd),()=>_0x5e0f6c[_0x53b1da(0xe7)][_0x53b1da(0xd7)](_0x272a37,_0x5c41a0),{'verbose':_0x8536d8['verbose']}),_0x3de2c2=_0x22c448['data'];return console['error'](_0x53b1da(0xf0)+_0x3de2c2[_0x53b1da(0xd3)]+_0x53b1da(0xd6)+(_0x3de2c2['length']!==0x1?'s':'')),await handleSDKOutput(_0x3de2c2,{..._0x8536d8,'limit':_0x5c41a0}),0x0;}catch(_0xc7dd69){if(_0xc7dd69 instanceof SDKError)return console[_0x53b1da(0xef)](_0x53b1da(0xd5)+_0xc7dd69[_0x53b1da(0xdf)]),_0xc7dd69[_0x53b1da(0xd4)]&&console[_0x53b1da(0xef)](_0x53b1da(0xe3)+_0xc7dd69[_0x53b1da(0xd4)]),0x1;throw _0xc7dd69;}}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a15_0x41cb04=a15_0x2a66;(function(_0x49369d,_0x3c20ef){const _0x546cdc=a15_0x2a66,_0x22e59f=_0x49369d();while(!![]){try{const _0x5b2ff2=-parseInt(_0x546cdc(0x10c))/0x1*(-parseInt(_0x546cdc(0x10a))/0x2)+-parseInt(_0x546cdc(0xe9))/0x3*(-parseInt(_0x546cdc(0x10e))/0x4)+-parseInt(_0x546cdc(0x106))/0x5+-parseInt(_0x546cdc(0xe6))/0x6*(parseInt(_0x546cdc(0xf9))/0x7)+parseInt(_0x546cdc(0xf2))/0x8*(parseInt(_0x546cdc(0x10b))/0x9)+-parseInt(_0x546cdc(0x10d))/0xa*(parseInt(_0x546cdc(0x102))/0xb)+parseInt(_0x546cdc(0x107))/0xc*(parseInt(_0x546cdc(0xfa))/0xd);if(_0x5b2ff2===_0x3c20ef)break;else _0x22e59f['push'](_0x22e59f['shift']());}catch(_0x54f92){_0x22e59f['push'](_0x22e59f['shift']());}}}(a15_0x572f,0xc2f84));import{BaseCommand}from'./command.js';function a15_0x572f(){const _0x23d9fb=['database','query','args','verbose','cause','description','14472paILln','\x20in\x20','table','message','Database:\x20','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','validate','7zPOFxs','34385bbRVFl','✖\x20Table\x20not\x20found','Site:\x20','\x20\x20Cause:\x20','name','describe','...','error','8273122YlFFYi','length','describeTable','✔\x20Found\x20','4397710ZgSXdY','7308cJpvOZ','\x20column','Describe\x20table\x20schema','3022762QUIsNt','729iRyrxY','1qVLZyF','20WCscIh','340GDqCCx','execute','Error:\x20','1904928ZdJRZh','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','\x27\x20does\x20not\x20exist','8157geyIhX','Describing\x20table\x20','Table:\x20'];a15_0x572f=function(){return _0x23d9fb;};return a15_0x572f();}function a15_0x2a66(_0x217be3,_0x519c7f){_0x217be3=_0x217be3-0xe6;const _0x572f50=a15_0x572f();let _0x2a6617=_0x572f50[_0x217be3];return _0x2a6617;}import{SDKError}from'../sdk/index.js';import{handleSDKOutput}from'../core/command-output.js';import{parseTableReference,validateTableDescribeReference}from'../utils/table-ref-parser.js';import{withSpinner}from'../utils/spinner.js';export class DescribeCommand extends BaseCommand{[a15_0x41cb04(0xfe)]=a15_0x41cb04(0xff);[a15_0x41cb04(0xf1)]=a15_0x41cb04(0x109);async[a15_0x41cb04(0x10f)](_0xc4deba){const _0x2499e9=a15_0x41cb04;return this[_0x2499e9(0x104)](_0xc4deba);}async[a15_0x41cb04(0x104)](_0x498055){const _0x36d228=a15_0x41cb04,{options:_0x34ba59,args:_0x2d41f8,tdx:_0x2a7e64}=_0x498055;let _0xd812fc;try{_0xd812fc=parseTableReference(_0x2d41f8[0x0]);const _0xa06507=_0x34ba59[_0x36d228(0xec)];!_0xd812fc[_0x36d228(0xec)]&&_0xa06507&&(_0xd812fc[_0x36d228(0xec)]=_0xa06507);const _0x5ea651=validateTableDescribeReference(_0xd812fc);if(_0x5ea651)return console[_0x36d228(0x101)](_0x36d228(0x110)+_0x5ea651),0x1;}catch(_0x32e487){return console[_0x36d228(0x101)](_0x36d228(0x110)+_0x32e487[_0x36d228(0xf5)]),0x1;}const _0x479bac=_0xd812fc[_0x36d228(0xec)],_0x1746d3=_0xd812fc[_0x36d228(0xf4)];try{_0x34ba59[_0x36d228(0xef)]&&(console[_0x36d228(0x101)](_0x36d228(0xfc)+_0x34ba59['site']),console[_0x36d228(0x101)](_0x36d228(0xf6)+_0x479bac),console[_0x36d228(0x101)](_0x36d228(0xeb)+_0x1746d3));const _0x4985fc=await withSpinner(_0x36d228(0xea)+_0x479bac+'.'+_0x1746d3+_0x36d228(0x100),()=>_0x2a7e64[_0x36d228(0xed)][_0x36d228(0x104)](_0x479bac,_0x1746d3),{'verbose':_0x34ba59[_0x36d228(0xef)]}),_0x492411=_0x4985fc['data'];if(_0x492411[_0x36d228(0x103)]===0x0)return console[_0x36d228(0x101)](_0x36d228(0xfb)),console[_0x36d228(0x101)]('Table\x20\x27'+_0x479bac+'.'+_0x1746d3+_0x36d228(0xe8)),0x1;return console[_0x36d228(0x101)](_0x36d228(0x105)+_0x492411['length']+_0x36d228(0x108)+(_0x492411[_0x36d228(0x103)]!==0x1?'s':'')+_0x36d228(0xf3)+_0x479bac+'.'+_0x1746d3),await handleSDKOutput(_0x492411,_0x34ba59),0x0;}catch(_0x1b5812){if(_0x1b5812 instanceof SDKError)return console[_0x36d228(0x101)](_0x36d228(0x110)+_0x1b5812[_0x36d228(0xf5)]),_0x1b5812[_0x36d228(0xf0)]&&console[_0x36d228(0x101)](_0x36d228(0xfd)+_0x1b5812[_0x36d228(0xf0)]),0x1;throw _0x1b5812;}}[a15_0x41cb04(0xf8)](_0x55edd8){const _0x358641=a15_0x41cb04;if(_0x55edd8['args'][_0x358641(0x103)]===0x0)return _0x358641(0xe7);if(_0x55edd8[_0x358641(0xee)]['length']>0x1)return _0x358641(0xf7);return undefined;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a16_0x46c269=a16_0x1dc7;(function(_0x455930,_0x355376){const _0xa2df1c=a16_0x1dc7,_0x469878=_0x455930();while(!![]){try{const _0x20a103=-parseInt(_0xa2df1c(0x93))/0x1*(parseInt(_0xa2df1c(0x11b))/0x2)+parseInt(_0xa2df1c(0xd1))/0x3*(-parseInt(_0xa2df1c(0xf6))/0x4)+-parseInt(_0xa2df1c(0xbe))/0x5+-parseInt(_0xa2df1c(0xd2))/0x6+-parseInt(_0xa2df1c(0xb1))/0x7+parseInt(_0xa2df1c(0xff))/0x8*(-parseInt(_0xa2df1c(0xec))/0x9)+parseInt(_0xa2df1c(0x119))/0xa;if(_0x20a103===_0x355376)break;else _0x469878['push'](_0x469878['shift']());}catch(_0x443ffd){_0x469878['push'](_0x469878['shift']());}}}(a16_0x27d7,0x5edf0));import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';function a16_0x1dc7(_0x2cc762,_0x59f5ed){_0x2cc762=_0x2cc762-0x8f;const _0x27d7db=a16_0x27d7();let _0x1dc73a=_0x27d7db[_0x2cc762];return _0x1dc73a;}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(_0x192df3,_0x396aa3,_0x2494f3=![]){const _0x487c70=a16_0x1dc7;if(_0x192df3['workspace'])return await _0x396aa3[_0x487c70(0x113)][_0x487c70(0xf1)](_0x192df3[_0x487c70(0xf4)]);const _0x567ac0=loadSessionContext(_0x192df3[_0x487c70(0xb8)]);if(_0x567ac0?.[_0x487c70(0x96)])return await _0x396aa3[_0x487c70(0x113)]['resolveWorkspaceId'](_0x567ac0[_0x487c70(0x96)]);if(_0x2494f3)throw new SDKError(ErrorCode[_0x487c70(0xa1)],_0x487c70(0x92),undefined,{'helpText':_0x487c70(0x112)});return undefined;}async function resolveSegmentFromOptions(_0x53c5d1,_0x58e9ae){const _0x1eabca=a16_0x1dc7;if(!_0x53c5d1[_0x1eabca(0x117)])return{};const _0x4a7892=_0x53c5d1['segment'],_0x2815e7=await _0x58e9ae[_0x1eabca(0x117)][_0x1eabca(0xc3)](_0x4a7892);return{'audienceId':_0x2815e7['parentId'],'audienceName':_0x2815e7[_0x1eabca(0x95)],..._0x2815e7[_0x1eabca(0xe0)]&&{'segmentId':_0x2815e7[_0x1eabca(0xe0)],'segmentName':_0x2815e7[_0x1eabca(0xfa)]}};}function buildConnectorConfig(_0x437aa5){const _0x41e5f7=a16_0x1dc7,_0x21a14c=_0x437aa5['emailSenderId'],_0x300761=_0x437aa5[_0x41e5f7(0x11f)];if(!_0x21a14c&&!_0x300761)return undefined;return{..._0x21a14c&&{'emailSenderId':_0x21a14c},..._0x300761&&{'jsonColumns':_0x300761}};}export class EngageCampaignsCommand extends BaseCommand{[a16_0x46c269(0x11c)]=a16_0x46c269(0x90);['description']=a16_0x46c269(0xa6);async[a16_0x46c269(0xbf)](_0xddf390){const _0x375f87=a16_0x46c269,{options:_0x186ed5,args:_0x148471,tdx:_0x4f39b3}=_0xddf390,_0x2329f3=_0x148471[0x0],_0x16a5d4=resolveLimit(_0x186ed5[_0x375f87(0xb5)],DEFAULT_LLM_LIMIT),_0x33746b=_0x186ed5,_0x529cc9=_0x33746b[_0x375f87(0xa8)],_0x382ff0=_0x33746b[_0x375f87(0xe8)],_0x329486=await resolveWorkspaceIdFromOptions(_0x33746b,_0x4f39b3),_0x4ca770=await withSpinner(_0x375f87(0xc6),()=>_0x4f39b3[_0x375f87(0x113)][_0x375f87(0x101)]({'type':_0x529cc9,'status':_0x382ff0,'workspaceId':_0x329486,'limit':_0x16a5d4}),{'verbose':_0x186ed5[_0x375f87(0x10b)]});let _0x27941d=_0x4ca770[_0x375f87(0x8f)];return _0x2329f3&&(_0x27941d=_0x4ca770[_0x375f87(0x8f)]['filter'](_0x6e689e=>matchGlobPattern(_0x6e689e[_0x375f87(0x11c)],_0x2329f3))),await handleSDKOutput(_0x27941d,_0x186ed5),0x0;}}export class EngageCampaignShowCommand extends BaseCommand{[a16_0x46c269(0x11c)]='engage:campaign:show';['description']=a16_0x46c269(0xcf);async[a16_0x46c269(0xbf)](_0x51c42b){const _0x2fe8bb=a16_0x46c269,{options:_0x26f7ac,args:_0x33ecc5,tdx:_0x50ce58}=_0x51c42b;if(_0x33ecc5[_0x2fe8bb(0xaa)]===0x0)return console[_0x2fe8bb(0xab)](_0x2fe8bb(0xf3)),console['error']('Usage:\x20tdx\x20engage\x20campaign\x20show\x20<name-or-id>'),0x1;const _0xbe101b=_0x33ecc5[0x0],_0x59bba6=_0x26f7ac,_0x4b7ffa=await resolveWorkspaceIdFromOptions(_0x59bba6,_0x50ce58),_0x537de1=_0x59bba6['full'];if(_0x537de1){const _0x2def1e=await withSpinner(_0x2fe8bb(0xe4)+_0xbe101b+_0x2fe8bb(0x108),()=>_0x50ce58['engage'][_0x2fe8bb(0xdf)](_0xbe101b,_0x4b7ffa),{'verbose':_0x26f7ac[_0x2fe8bb(0x10b)]});await handleSDKOutput([_0x2def1e],_0x26f7ac);}else{const _0x56b1a3=await withSpinner(_0x2fe8bb(0xe4)+_0xbe101b+_0x2fe8bb(0x108),()=>_0x50ce58[_0x2fe8bb(0x113)]['getCampaign'](_0xbe101b,_0x4b7ffa),{'verbose':_0x26f7ac['verbose']});await handleSDKOutput([_0x56b1a3],_0x26f7ac);}return 0x0;}}export class EngageCampaignCreateCommand extends BaseCommand{['name']=a16_0x46c269(0xa0);['description']=a16_0x46c269(0xd8);async[a16_0x46c269(0xbf)](_0x280f92){const _0xf2f15e=a16_0x46c269,{options:_0x32315c,tdx:_0x483d2f}=_0x280f92,_0x2b1999=_0x32315c,_0x842029=_0x2b1999[_0xf2f15e(0x11c)],_0x1b1ad7=_0x2b1999[_0xf2f15e(0xa8)];if(!_0x842029)return console[_0xf2f15e(0xab)]('Error:\x20--name\x20is\x20required'),console[_0xf2f15e(0xab)]('Usage:\x20tdx\x20engage\x20campaign\x20create\x20--name\x20<name>\x20--type\x20<email|push>'),0x1;if(!_0x1b1ad7)return console[_0xf2f15e(0xab)](_0xf2f15e(0x109)),console['error'](_0xf2f15e(0xe3)),0x1;const _0x4d824c=await resolveWorkspaceIdFromOptions(_0x2b1999,_0x483d2f,!![]),_0x1d69c4=await resolveSegmentFromOptions(_0x2b1999,_0x483d2f),_0xad9b9c=buildConnectorConfig(_0x2b1999),_0x209a0b={'name':_0x842029,'campaignType':_0x1b1ad7,'workspaceId':_0x4d824c,'description':_0x2b1999[_0xf2f15e(0xae)],..._0x1d69c4,'connectorConfig':_0xad9b9c,'startAt':_0x2b1999[_0xf2f15e(0xea)],'timezone':_0x2b1999[_0xf2f15e(0xce)]},_0x49a7ab=await withSpinner(_0xf2f15e(0xba)+_0x842029+'\x27...',()=>_0x483d2f[_0xf2f15e(0x113)][_0xf2f15e(0xee)](_0x209a0b));return await handleSDKOutput([_0x49a7ab['data']],_0x32315c),0x0;}}export class EngageCampaignUpdateCommand extends BaseCommand{[a16_0x46c269(0x11c)]='engage:campaign:update';[a16_0x46c269(0xae)]='Update\x20a\x20campaign';async['execute'](_0x24dbb9){const _0x25c55c=a16_0x46c269,{options:_0x201a40,args:_0x37ab59,tdx:_0x20e6a0}=_0x24dbb9;if(_0x37ab59['length']===0x0)return console[_0x25c55c(0xab)]('Error:\x20Campaign\x20name\x20or\x20ID\x20is\x20required'),console[_0x25c55c(0xab)](_0x25c55c(0xc1)),0x1;const _0x3e09d9=_0x37ab59[0x0],_0x10b752=_0x201a40,_0x14af1d=await resolveWorkspaceIdFromOptions(_0x10b752,_0x20e6a0),_0x5c2352=await resolveSegmentFromOptions(_0x10b752,_0x20e6a0),_0x90ff44=buildConnectorConfig(_0x10b752),_0x16e336={'name':_0x10b752[_0x25c55c(0x11c)],'description':_0x10b752['description'],..._0x5c2352,'connectorConfig':_0x90ff44,'startAt':_0x10b752[_0x25c55c(0xea)],'timezone':_0x10b752[_0x25c55c(0xce)]},_0x19c445=Object[_0x25c55c(0xd0)](Object[_0x25c55c(0x9a)](_0x16e336)[_0x25c55c(0x114)](([,_0x4f41d1])=>_0x4f41d1!==undefined));if(Object[_0x25c55c(0xe1)](_0x19c445)['length']===0x0)return console[_0x25c55c(0xab)](_0x25c55c(0x9b)),console[_0x25c55c(0xab)](_0x25c55c(0xa5)),0x1;const _0x57df5d=await withSpinner(_0x25c55c(0x107)+_0x3e09d9+_0x25c55c(0x108),()=>_0x20e6a0[_0x25c55c(0x113)][_0x25c55c(0xb6)](_0x3e09d9,_0x19c445,_0x14af1d),{'verbose':_0x201a40[_0x25c55c(0x10b)]});return await handleSDKOutput([_0x57df5d[_0x25c55c(0x8f)]],_0x201a40),0x0;}}export class EngageCampaignDeleteCommand extends BaseCommand{['name']=a16_0x46c269(0xe2);[a16_0x46c269(0xae)]=a16_0x46c269(0xa7);async[a16_0x46c269(0xbf)](_0x3f2773){const _0x41ccd0=a16_0x46c269,{options:_0x350f2f,args:_0x4f2d2,tdx:_0x58444a}=_0x3f2773;if(_0x4f2d2[_0x41ccd0(0xaa)]===0x0)return console[_0x41ccd0(0xab)](_0x41ccd0(0xf3)),console[_0x41ccd0(0xab)]('Usage:\x20tdx\x20engage\x20campaign\x20delete\x20<name-or-id>'),0x1;const _0x55b664=_0x4f2d2[0x0],_0x27e4a6=_0x350f2f,_0x7a84fa=await resolveWorkspaceIdFromOptions(_0x27e4a6,_0x58444a);if(!_0x350f2f[_0x41ccd0(0x9e)]){const _0x1a3033=await confirm(_0x41ccd0(0x94)+_0x55b664+_0x41ccd0(0x91));if(!_0x1a3033)return console[_0x41ccd0(0xb9)]('Operation\x20cancelled'),0x0;}return await withSpinner(_0x41ccd0(0xdc)+_0x55b664+_0x41ccd0(0x108),()=>_0x58444a['engage'][_0x41ccd0(0x116)](_0x55b664,_0x7a84fa),{'verbose':_0x350f2f['verbose']}),console[_0x41ccd0(0xb9)](_0x41ccd0(0xd9)+_0x55b664+_0x41ccd0(0xfb)),0x0;}}export class EngageCampaignLaunchCommand extends BaseCommand{[a16_0x46c269(0x11c)]=a16_0x46c269(0xfe);[a16_0x46c269(0xae)]=a16_0x46c269(0xd7);async['execute'](_0x55699d){const _0x82f487=a16_0x46c269,{options:_0x4855ab,args:_0x1808c2,tdx:_0x1edb98}=_0x55699d;if(_0x1808c2['length']===0x0)return console[_0x82f487(0xab)]('Error:\x20Campaign\x20name\x20or\x20ID\x20is\x20required'),console['error'](_0x82f487(0x102)),0x1;const _0x4e2e8d=_0x1808c2[0x0],_0x17074d=_0x4855ab,_0x5e2fa4=await resolveWorkspaceIdFromOptions(_0x17074d,_0x1edb98);return await withSpinner('Launching\x20campaign\x20\x27'+_0x4e2e8d+'\x27...',()=>_0x1edb98['engage']['launchCampaign'](_0x4e2e8d,_0x5e2fa4),{'verbose':_0x4855ab[_0x82f487(0x10b)]}),console[_0x82f487(0xb9)](_0x82f487(0xd9)+_0x4e2e8d+_0x82f487(0xbb)),0x0;}}export class EngageCampaignPauseCommand extends BaseCommand{['name']=a16_0x46c269(0x110);[a16_0x46c269(0xae)]='Pause\x20a\x20campaign';async['execute'](_0xb22966){const _0x120a96=a16_0x46c269,{options:_0x8fd20e,args:_0x43b182,tdx:_0x6bb4c4}=_0xb22966;if(_0x43b182[_0x120a96(0xaa)]===0x0)return console['error'](_0x120a96(0xf3)),console[_0x120a96(0xab)](_0x120a96(0xad)),0x1;const _0xeff6a2=_0x43b182[0x0],_0x14f6be=_0x8fd20e,_0x2ea90d=await resolveWorkspaceIdFromOptions(_0x14f6be,_0x6bb4c4);return await withSpinner(_0x120a96(0xb3)+_0xeff6a2+_0x120a96(0x108),()=>_0x6bb4c4['engage']['pauseCampaign'](_0xeff6a2,_0x2ea90d),{'verbose':_0x8fd20e[_0x120a96(0x10b)]}),console['log'](_0x120a96(0xd9)+_0xeff6a2+'\x27\x20paused\x20successfully'),0x0;}}export class EngageCampaignResumeCommand extends BaseCommand{[a16_0x46c269(0x11c)]='engage:campaign:resume';[a16_0x46c269(0xae)]='Resume\x20a\x20paused\x20campaign';async[a16_0x46c269(0xbf)](_0x1a540a){const _0x3758bc=a16_0x46c269,{options:_0x4090a9,args:_0x28ab2b,tdx:_0x2470e0}=_0x1a540a;if(_0x28ab2b[_0x3758bc(0xaa)]===0x0)return console[_0x3758bc(0xab)]('Error:\x20Campaign\x20name\x20or\x20ID\x20is\x20required'),console[_0x3758bc(0xab)](_0x3758bc(0xf5)),0x1;const _0x27b724=_0x28ab2b[0x0],_0x16fa67=_0x4090a9,_0xa27922=await resolveWorkspaceIdFromOptions(_0x16fa67,_0x2470e0);return await withSpinner('Resuming\x20campaign\x20\x27'+_0x27b724+_0x3758bc(0x108),()=>_0x2470e0[_0x3758bc(0x113)][_0x3758bc(0xcd)](_0x27b724,_0xa27922),{'verbose':_0x4090a9[_0x3758bc(0x10b)]}),console['log'](_0x3758bc(0xd9)+_0x27b724+_0x3758bc(0xef)),0x0;}}export class EngageCampaignDuplicateCommand extends BaseCommand{[a16_0x46c269(0x11c)]=a16_0x46c269(0xd5);[a16_0x46c269(0xae)]=a16_0x46c269(0xb7);async[a16_0x46c269(0xbf)](_0x244f47){const _0x47abde=a16_0x46c269,{options:_0x1aaa18,args:_0x2e2df3,tdx:_0x5a8d68}=_0x244f47;if(_0x2e2df3[_0x47abde(0xaa)]===0x0)return console[_0x47abde(0xab)](_0x47abde(0xf3)),console[_0x47abde(0xab)](_0x47abde(0xe9)),0x1;const _0x27cdf9=_0x2e2df3[0x0],_0x255c34=_0x1aaa18,_0x39e11c=await resolveWorkspaceIdFromOptions(_0x255c34,_0x5a8d68),_0x505631=await withSpinner(_0x47abde(0xf7)+_0x27cdf9+_0x47abde(0x108),()=>_0x5a8d68[_0x47abde(0x113)][_0x47abde(0xb4)](_0x27cdf9,_0x39e11c),{'verbose':_0x1aaa18['verbose']});return await handleSDKOutput([_0x505631['data']],_0x1aaa18),0x0;}}export class EngageTemplatesCommand extends BaseCommand{['name']=a16_0x46c269(0xfd);['description']=a16_0x46c269(0xdb);async[a16_0x46c269(0xbf)](_0x15fe9d){const _0x47f336=a16_0x46c269,{options:_0x3554e9,args:_0x3adb58,tdx:_0x47ca49}=_0x15fe9d,_0x4bfe6a=_0x3adb58[0x0],_0xa0e4df=resolveLimit(_0x3554e9[_0x47f336(0xb5)],DEFAULT_LLM_LIMIT),_0xf47490=_0x3554e9,_0x9ad510=await resolveWorkspaceIdFromOptions(_0xf47490,_0x47ca49),_0xbe3805=await withSpinner('Fetching\x20templates...',()=>_0x47ca49[_0x47f336(0x113)]['listTemplates']({'workspaceId':_0x9ad510,'limit':_0xa0e4df}),{'verbose':_0x3554e9[_0x47f336(0x10b)]});let _0x121be9=_0xbe3805[_0x47f336(0x8f)];return _0x4bfe6a&&(_0x121be9=_0xbe3805['data'][_0x47f336(0x114)](_0x44beb0=>matchGlobPattern(_0x44beb0[_0x47f336(0x11c)],_0x4bfe6a))),await handleSDKOutput(_0x121be9,_0x3554e9),0x0;}}export class EngageTemplateShowCommand extends BaseCommand{['name']=a16_0x46c269(0xd3);[a16_0x46c269(0xae)]=a16_0x46c269(0xfc);async['execute'](_0x101036){const _0xbce19d=a16_0x46c269,{options:_0x5cdba0,args:_0x5e686f,tdx:_0x46b400}=_0x101036;if(_0x5e686f[_0xbce19d(0xaa)]===0x0)return console[_0xbce19d(0xab)](_0xbce19d(0xf8)),console[_0xbce19d(0xab)]('Usage:\x20tdx\x20engage\x20template\x20show\x20<name-or-id>'),0x1;const _0x303c8a=_0x5e686f[0x0],_0x23aa2f=_0x5cdba0,_0x152360=await resolveWorkspaceIdFromOptions(_0x23aa2f,_0x46b400),_0x341781=_0x23aa2f[_0xbce19d(0xa4)];if(_0x341781){const _0x327b16=await withSpinner(_0xbce19d(0xde)+_0x303c8a+'\x27...',()=>_0x46b400[_0xbce19d(0x113)][_0xbce19d(0xe7)](_0x303c8a,_0x152360),{'verbose':_0x5cdba0[_0xbce19d(0x10b)]});await handleSDKOutput([_0x327b16],_0x5cdba0);}else{const _0x251432=await withSpinner(_0xbce19d(0xde)+_0x303c8a+'\x27...',()=>_0x46b400[_0xbce19d(0x113)][_0xbce19d(0xac)](_0x303c8a,_0x152360),{'verbose':_0x5cdba0['verbose']});await handleSDKOutput([_0x251432],_0x5cdba0);}return 0x0;}}export class EngageTemplateCreateCommand extends BaseCommand{['name']=a16_0x46c269(0x10d);['description']='Create\x20an\x20email\x20template';async[a16_0x46c269(0xbf)](_0x11476e){const _0x571854=a16_0x46c269,{options:_0x13479c,tdx:_0x4fb881}=_0x11476e,_0x130cd1=_0x13479c,_0x3833cb=_0x130cd1[_0x571854(0x11c)],_0xf08775=_0x130cd1['subject'],_0x4ebbfc=_0x130cd1['html'];if(!_0x3833cb)return console[_0x571854(0xab)](_0x571854(0x11e)),console[_0x571854(0xab)](_0x571854(0x104)),0x1;if(!_0xf08775)return console[_0x571854(0xab)](_0x571854(0xd6)),0x1;if(!_0x4ebbfc)return console[_0x571854(0xab)]('Error:\x20--html\x20is\x20required'),0x1;const _0x511664=await resolveWorkspaceIdFromOptions(_0x130cd1,_0x4fb881,!![]),_0x5c79ed={'name':_0x3833cb,'subjectTemplate':_0xf08775,'htmlTemplate':_0x4ebbfc,'workspaceId':_0x511664,'plaintextTemplate':_0x130cd1[_0x571854(0xc5)],'editorType':_0x130cd1[_0x571854(0xf9)]},_0x3820a6=await withSpinner(_0x571854(0x10f)+_0x3833cb+_0x571854(0x108),()=>_0x4fb881[_0x571854(0x113)][_0x571854(0xc7)](_0x5c79ed));return await handleSDKOutput([_0x3820a6[_0x571854(0x8f)]],_0x13479c),0x0;}}function a16_0x27d7(){const _0x20f5f4=['keys','engage:campaign:delete','Usage:\x20tdx\x20engage\x20campaign\x20create\x20--name\x20<name>\x20--type\x20<email|push>','Fetching\x20campaign\x20\x27','Usage:\x20tdx\x20engage\x20workspace\x20create\x20--name\x20<name>\x20[--description\x20<desc>]','engage:workspace:create','getTemplateFull','status','Usage:\x20tdx\x20engage\x20campaign\x20duplicate\x20<name-or-id>','startAt','Updating\x20template\x20\x27','1782NqqPzC','Fetching\x20workspaces...','createCampaign','\x27\x20resumed\x20successfully','\x0aTip:\x20Use\x20\x27tdx\x20use\x20--clear\x27\x20to\x20clear\x20session\x20overrides','resolveWorkspaceId','engage:template:update','Error:\x20Campaign\x20name\x20or\x20ID\x20is\x20required','workspace','Usage:\x20tdx\x20engage\x20campaign\x20resume\x20<name-or-id>','13356wOjsSx','Duplicating\x20campaign\x20\x27','Error:\x20Template\x20name\x20or\x20ID\x20is\x20required','editorType','segmentName','\x27\x20deleted\x20successfully','Show\x20email\x20template\x20details','engage:templates','engage:campaign:launch','1368SmYjqM','Error:\x20Workspace\x20name\x20or\x20ID\x20is\x20required','listCampaigns','Usage:\x20tdx\x20engage\x20campaign\x20launch\x20<name-or-id>','Operation\x20cancelled','Usage:\x20tdx\x20engage\x20template\x20create\x20--name\x20<name>\x20--subject\x20<subject>\x20--html\x20<html>','subject','Options:\x20--name,\x20--description','Updating\x20campaign\x20\x27','\x27...','Error:\x20--type\x20is\x20required\x20(email\x20or\x20push)','getWorkspaceFull','verbose','html','engage:template:create','Deleting\x20workspace\x20\x27','Creating\x20template\x20\x27','engage:campaign:pause','Fetching\x20workspace\x20\x27','Use\x20--workspace\x20<name>\x20or\x20set\x20with\x20\x22tdx\x20use\x20engage_workspace\x20<name>\x22','engage','filter','Deleting\x20template\x20\x27','deleteCampaign','segment','Creating\x20workspace\x20\x27','29739970ZRBmFG','Options:\x20--name,\x20--subject,\x20--html,\x20--plaintext','7342ckzcOJ','name','List\x20workspaces','Error:\x20--name\x20is\x20required','jsonColumns','deleteTemplate','data','engage:campaigns','\x27?\x20This\x20cannot\x20be\x20undone.','Workspace\x20is\x20required\x20for\x20this\x20operation','137MpkvxE','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20campaign\x20\x27','parentName','engage_workspace','engage:workspace:show','Update\x20a\x20workspace','Engage\x20workspace\x20set\x20to:\x20','entries','Error:\x20At\x20least\x20one\x20field\x20to\x20update\x20is\x20required','Show\x20workspace\x20details','engage:workspace:update','yes','listWorkspaces','engage:campaign:create','MISSING_ARGUMENT','engage:workspace:use','createWorkspace','full','Options:\x20--name,\x20--description,\x20--segment,\x20--email-sender-id,\x20--json-columns,\x20--start-at,\x20--timezone','List\x20campaigns','Delete\x20a\x20campaign','type','Update\x20an\x20email\x20template','length','error','getTemplate','Usage:\x20tdx\x20engage\x20campaign\x20pause\x20<name-or-id>','description','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20workspace\x20\x27','Create\x20a\x20workspace','3804472eSGHai','Verifying\x20workspace\x20\x27','Pausing\x20campaign\x20\x27','duplicateCampaign','limit','updateCampaign','Duplicate\x20a\x20campaign','session','log','Creating\x20campaign\x20\x27','\x27\x20launched\x20successfully','Usage:\x20tdx\x20engage\x20workspace\x20update\x20<name-or-id>\x20[--name\x20<new-name>]\x20...','engage:template:delete','1356710fldpbl','execute','Delete\x20an\x20email\x20template','Usage:\x20tdx\x20engage\x20campaign\x20update\x20<name-or-id>\x20[--name\x20<new-name>]\x20...','Usage:\x20tdx\x20engage\x20workspace\x20delete\x20<name-or-id>','resolvePathToResource','updateWorkspace','plaintext','Fetching\x20campaigns...','createTemplate','Workspace\x20\x27','Updating\x20workspace\x20\x27','Delete\x20a\x20workspace','engage:workspace:delete','Usage:\x20tdx\x20engage\x20workspace\x20show\x20<name-or-id>','resumeCampaign','timezone','Show\x20campaign\x20details','fromEntries','687qFJMZw','2814906VqBdFa','engage:template:show','engage:workspaces','engage:campaign:duplicate','Error:\x20--subject\x20is\x20required','Launch\x20a\x20campaign','Create\x20a\x20new\x20campaign','Campaign\x20\x27','Template\x20\x27','List\x20email\x20templates','Deleting\x20campaign\x20\x27','Usage:\x20tdx\x20engage\x20workspace\x20use\x20<name>','Fetching\x20template\x20\x27','getCampaignFull','segmentId'];a16_0x27d7=function(){return _0x20f5f4;};return a16_0x27d7();}export class EngageTemplateUpdateCommand extends BaseCommand{[a16_0x46c269(0x11c)]=a16_0x46c269(0xf2);[a16_0x46c269(0xae)]=a16_0x46c269(0xa9);async[a16_0x46c269(0xbf)](_0x6ca335){const _0x795014=a16_0x46c269,{options:_0x36c776,args:_0x3c2ea4,tdx:_0x34088f}=_0x6ca335;if(_0x3c2ea4[_0x795014(0xaa)]===0x0)return console[_0x795014(0xab)](_0x795014(0xf8)),console['error']('Usage:\x20tdx\x20engage\x20template\x20update\x20<name-or-id>\x20[--name\x20<new-name>]\x20...'),0x1;const _0xdc1024=_0x3c2ea4[0x0],_0x404d9c=_0x36c776,_0x56c8e1=await resolveWorkspaceIdFromOptions(_0x404d9c,_0x34088f),_0x4706eb={'name':_0x404d9c[_0x795014(0x11c)],'subjectTemplate':_0x404d9c[_0x795014(0x105)],'htmlTemplate':_0x404d9c[_0x795014(0x10c)],'plaintextTemplate':_0x404d9c[_0x795014(0xc5)]},_0x3d98bb=Object[_0x795014(0xd0)](Object[_0x795014(0x9a)](_0x4706eb)[_0x795014(0x114)](([,_0x52eec6])=>_0x52eec6!==undefined));if(Object[_0x795014(0xe1)](_0x3d98bb)[_0x795014(0xaa)]===0x0)return console[_0x795014(0xab)]('Error:\x20At\x20least\x20one\x20field\x20to\x20update\x20is\x20required'),console[_0x795014(0xab)](_0x795014(0x11a)),0x1;const _0x6b4bd=await withSpinner(_0x795014(0xeb)+_0xdc1024+'\x27...',()=>_0x34088f[_0x795014(0x113)]['updateTemplate'](_0xdc1024,_0x3d98bb,_0x56c8e1),{'verbose':_0x36c776[_0x795014(0x10b)]});return await handleSDKOutput([_0x6b4bd[_0x795014(0x8f)]],_0x36c776),0x0;}}export class EngageTemplateDeleteCommand extends BaseCommand{['name']=a16_0x46c269(0xbd);['description']=a16_0x46c269(0xc0);async[a16_0x46c269(0xbf)](_0x556516){const _0x285e9a=a16_0x46c269,{options:_0x39b6cd,args:_0x2391ca,tdx:_0x240c97}=_0x556516;if(_0x2391ca[_0x285e9a(0xaa)]===0x0)return console['error'](_0x285e9a(0xf8)),console[_0x285e9a(0xab)]('Usage:\x20tdx\x20engage\x20template\x20delete\x20<name-or-id>'),0x1;const _0x2fa217=_0x2391ca[0x0],_0x5a9178=_0x39b6cd,_0x549851=await resolveWorkspaceIdFromOptions(_0x5a9178,_0x240c97);if(!_0x39b6cd[_0x285e9a(0x9e)]){const _0x4fdb3d=await confirm('Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20template\x20\x27'+_0x2fa217+'\x27?\x20This\x20cannot\x20be\x20undone.');if(!_0x4fdb3d)return console[_0x285e9a(0xb9)](_0x285e9a(0x103)),0x0;}return await withSpinner(_0x285e9a(0x115)+_0x2fa217+_0x285e9a(0x108),()=>_0x240c97['engage'][_0x285e9a(0x120)](_0x2fa217,_0x549851),{'verbose':_0x39b6cd[_0x285e9a(0x10b)]}),console['log'](_0x285e9a(0xda)+_0x2fa217+_0x285e9a(0xfb)),0x0;}}export class EngageWorkspacesCommand extends BaseCommand{[a16_0x46c269(0x11c)]=a16_0x46c269(0xd4);[a16_0x46c269(0xae)]=a16_0x46c269(0x11d);async[a16_0x46c269(0xbf)](_0x5ef964){const _0x3eca36=a16_0x46c269,{options:_0x112e34,args:_0x53a81f,tdx:_0x426e5b}=_0x5ef964,_0xfa4a71=_0x53a81f[0x0],_0x8c46c7=resolveLimit(_0x112e34[_0x3eca36(0xb5)],DEFAULT_LLM_LIMIT),_0x50bbad=await withSpinner(_0x3eca36(0xed),()=>_0x426e5b[_0x3eca36(0x113)][_0x3eca36(0x9f)]({'limit':_0x8c46c7}),{'verbose':_0x112e34[_0x3eca36(0x10b)]});let _0x18b746=_0x50bbad[_0x3eca36(0x8f)];return _0xfa4a71&&(_0x18b746=_0x50bbad[_0x3eca36(0x8f)][_0x3eca36(0x114)](_0x4b6209=>matchGlobPattern(_0x4b6209[_0x3eca36(0x11c)],_0xfa4a71))),await handleSDKOutput(_0x18b746,_0x112e34),0x0;}}export class EngageWorkspaceShowCommand extends BaseCommand{['name']=a16_0x46c269(0x97);['description']=a16_0x46c269(0x9c);async['execute'](_0x4710ab){const _0x27f132=a16_0x46c269,{options:_0x4d81b9,args:_0x316ea4,tdx:_0x34f744}=_0x4710ab;if(_0x316ea4[_0x27f132(0xaa)]===0x0)return console[_0x27f132(0xab)](_0x27f132(0x100)),console[_0x27f132(0xab)](_0x27f132(0xcc)),0x1;const _0x4ce810=_0x316ea4[0x0],_0xce64b6=_0x4d81b9,_0x3e556d=_0xce64b6['full'];if(_0x3e556d){const _0x1f3284=await withSpinner(_0x27f132(0x111)+_0x4ce810+_0x27f132(0x108),()=>_0x34f744[_0x27f132(0x113)][_0x27f132(0x10a)](_0x4ce810),{'verbose':_0x4d81b9[_0x27f132(0x10b)]});await handleSDKOutput([_0x1f3284],_0x4d81b9);}else{const _0x4e2093=await withSpinner(_0x27f132(0x111)+_0x4ce810+'\x27...',()=>_0x34f744[_0x27f132(0x113)]['getWorkspace'](_0x4ce810),{'verbose':_0x4d81b9[_0x27f132(0x10b)]});await handleSDKOutput([_0x4e2093],_0x4d81b9);}return 0x0;}}export class EngageWorkspaceCreateCommand extends BaseCommand{[a16_0x46c269(0x11c)]=a16_0x46c269(0xe6);[a16_0x46c269(0xae)]=a16_0x46c269(0xb0);async[a16_0x46c269(0xbf)](_0x4f2701){const _0x4db4f5=a16_0x46c269,{options:_0x28656a,tdx:_0x27ea40}=_0x4f2701,_0x3246c5=_0x28656a,_0x53c7e8=_0x3246c5[_0x4db4f5(0x11c)];if(!_0x53c7e8)return console[_0x4db4f5(0xab)](_0x4db4f5(0x11e)),console[_0x4db4f5(0xab)](_0x4db4f5(0xe5)),0x1;const _0x26a43c={'name':_0x53c7e8,'description':_0x3246c5['description']},_0x4586df=await withSpinner(_0x4db4f5(0x118)+_0x53c7e8+_0x4db4f5(0x108),()=>_0x27ea40['engage'][_0x4db4f5(0xa3)](_0x26a43c));return await handleSDKOutput([_0x4586df['data']],_0x28656a),0x0;}}export class EngageWorkspaceUpdateCommand extends BaseCommand{['name']=a16_0x46c269(0x9d);[a16_0x46c269(0xae)]=a16_0x46c269(0x98);async[a16_0x46c269(0xbf)](_0x598cd1){const _0x503d10=a16_0x46c269,{options:_0x52aef7,args:_0x28d026,tdx:_0x6ff093}=_0x598cd1;if(_0x28d026['length']===0x0)return console[_0x503d10(0xab)](_0x503d10(0x100)),console[_0x503d10(0xab)](_0x503d10(0xbc)),0x1;const _0x3c93b3=_0x28d026[0x0],_0x2420ca=_0x52aef7,_0x4b5ece={'name':_0x2420ca[_0x503d10(0x11c)],'description':_0x2420ca[_0x503d10(0xae)]},_0x5b7b09=Object[_0x503d10(0xd0)](Object['entries'](_0x4b5ece)[_0x503d10(0x114)](([,_0x13125f])=>_0x13125f!==undefined));if(Object['keys'](_0x5b7b09)[_0x503d10(0xaa)]===0x0)return console[_0x503d10(0xab)]('Error:\x20At\x20least\x20one\x20field\x20to\x20update\x20is\x20required'),console[_0x503d10(0xab)](_0x503d10(0x106)),0x1;const _0x126cb4=await withSpinner(_0x503d10(0xc9)+_0x3c93b3+_0x503d10(0x108),()=>_0x6ff093[_0x503d10(0x113)][_0x503d10(0xc4)](_0x3c93b3,_0x5b7b09),{'verbose':_0x52aef7[_0x503d10(0x10b)]});return await handleSDKOutput([_0x126cb4['data']],_0x52aef7),0x0;}}export class EngageWorkspaceDeleteCommand extends BaseCommand{['name']=a16_0x46c269(0xcb);[a16_0x46c269(0xae)]=a16_0x46c269(0xca);async[a16_0x46c269(0xbf)](_0x5f3aad){const _0x1e52db=a16_0x46c269,{options:_0x53b89e,args:_0x73f69f,tdx:_0xf5aa2c}=_0x5f3aad;if(_0x73f69f['length']===0x0)return console[_0x1e52db(0xab)]('Error:\x20Workspace\x20name\x20or\x20ID\x20is\x20required'),console['error'](_0x1e52db(0xc2)),0x1;const _0x27d73b=_0x73f69f[0x0];if(!_0x53b89e[_0x1e52db(0x9e)]){const _0x31e30e=await confirm(_0x1e52db(0xaf)+_0x27d73b+_0x1e52db(0x91));if(!_0x31e30e)return console[_0x1e52db(0xb9)](_0x1e52db(0x103)),0x0;}return await withSpinner(_0x1e52db(0x10e)+_0x27d73b+'\x27...',()=>_0xf5aa2c['engage']['deleteWorkspace'](_0x27d73b),{'verbose':_0x53b89e[_0x1e52db(0x10b)]}),console[_0x1e52db(0xb9)](_0x1e52db(0xc8)+_0x27d73b+_0x1e52db(0xfb)),0x0;}}export class EngageWorkspaceUseCommand extends BaseCommand{['name']=a16_0x46c269(0xa2);[a16_0x46c269(0xae)]='Set\x20workspace\x20context\x20for\x20Engage\x20commands';async[a16_0x46c269(0xbf)](_0x36b362){const _0x2cc91a=a16_0x46c269,{options:_0x5ea3d3,args:_0xd7ad8,tdx:_0x5895a8}=_0x36b362;if(_0xd7ad8['length']===0x0)return console[_0x2cc91a(0xab)]('Error:\x20Workspace\x20name\x20is\x20required'),console[_0x2cc91a(0xab)](_0x2cc91a(0xdd)),0x1;const _0x42e913=_0xd7ad8[0x0];await withSpinner(_0x2cc91a(0xb2)+_0x42e913+'\x27...',()=>_0x5895a8[_0x2cc91a(0x113)]['resolveWorkspaceId'](_0x42e913));const _0x4ead48=_0x5ea3d3[_0x2cc91a(0xb8)]||undefined;return saveSessionContext({'engage_workspace':_0x42e913},_0x4ead48),console['log'](_0x2cc91a(0x99)+_0x42e913),console[_0x2cc91a(0xb9)](_0x2cc91a(0xf0)),0x0;}}
|
|
1
|
+
const a16_0x34af8f=a16_0x5cfc;(function(_0x4c1567,_0x2cf65f){const _0x72397a=a16_0x5cfc,_0x545348=_0x4c1567();while(!![]){try{const _0x58816e=parseInt(_0x72397a(0x202))/0x1*(parseInt(_0x72397a(0x23d))/0x2)+parseInt(_0x72397a(0x210))/0x3+parseInt(_0x72397a(0x204))/0x4+parseInt(_0x72397a(0x222))/0x5+parseInt(_0x72397a(0x237))/0x6+-parseInt(_0x72397a(0x219))/0x7+-parseInt(_0x72397a(0x1fe))/0x8;if(_0x58816e===_0x2cf65f)break;else _0x545348['push'](_0x545348['shift']());}catch(_0x727ec4){_0x545348['push'](_0x545348['shift']());}}}(a16_0x3cde,0xc1c46));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(_0x5b5a81,_0x88ce4e,_0x2f27d3=![]){const _0x53bf72=a16_0x5cfc;if(_0x5b5a81[_0x53bf72(0x240)])return await _0x88ce4e['engage']['resolveWorkspaceId'](_0x5b5a81[_0x53bf72(0x240)]);const _0x3d3c43=loadSessionContext(_0x5b5a81[_0x53bf72(0x21d)]);if(_0x3d3c43?.['engage_workspace'])return await _0x88ce4e['engage'][_0x53bf72(0x224)](_0x3d3c43[_0x53bf72(0x1e7)]);if(_0x2f27d3)throw new SDKError(ErrorCode[_0x53bf72(0x225)],_0x53bf72(0x235),undefined,{'helpText':'Use\x20--workspace\x20<name>\x20or\x20set\x20with\x20\x22tdx\x20use\x20engage_workspace\x20<name>\x22'});return undefined;}async function resolveSegmentFromOptions(_0x2537ec,_0x5a6629){const _0x5ed4d4=a16_0x5cfc;if(!_0x2537ec[_0x5ed4d4(0x25c)])return{};const _0x909d45=_0x2537ec[_0x5ed4d4(0x25c)],_0x19f249=await _0x5a6629[_0x5ed4d4(0x25c)][_0x5ed4d4(0x1f4)](_0x909d45);return{'audienceId':_0x19f249[_0x5ed4d4(0x214)],'audienceName':_0x19f249[_0x5ed4d4(0x1ec)],..._0x19f249[_0x5ed4d4(0x200)]&&{'segmentId':_0x19f249['segmentId'],'segmentName':_0x19f249[_0x5ed4d4(0x1df)]}};}function buildConnectorConfig(_0x3e4a4c){const _0xc3edf8=a16_0x5cfc,_0x11afd9=_0x3e4a4c[_0xc3edf8(0x242)],_0x2750ac=_0x3e4a4c[_0xc3edf8(0x220)];if(!_0x11afd9&&!_0x2750ac)return undefined;return{..._0x11afd9&&{'emailSenderId':_0x11afd9},..._0x2750ac&&{'jsonColumns':_0x2750ac}};}function a16_0x5cfc(_0x4b7c0b,_0x4797a5){_0x4b7c0b=_0x4b7c0b-0x1d4;const _0x3cdef1=a16_0x3cde();let _0x5cfc37=_0x3cdef1[_0x4b7c0b];return _0x5cfc37;}export class EngageCampaignsCommand extends BaseCommand{[a16_0x34af8f(0x1d4)]=a16_0x34af8f(0x20c);[a16_0x34af8f(0x1fc)]=a16_0x34af8f(0x249);async['execute'](_0x1d80e7){const _0x2b2174=a16_0x34af8f,{options:_0x33a8f3,args:_0x1d15d4,tdx:_0x2109a2}=_0x1d80e7,_0x57c9b3=_0x1d15d4[0x0],_0x325e9a=resolveLimit(_0x33a8f3[_0x2b2174(0x1f6)],DEFAULT_LLM_LIMIT),_0x46a7cb=_0x33a8f3,_0x2921e6=_0x46a7cb[_0x2b2174(0x20b)],_0x40b47c=_0x46a7cb[_0x2b2174(0x23c)],_0x560b90=await resolveWorkspaceIdFromOptions(_0x46a7cb,_0x2109a2),_0x2ac6a7=await withSpinner(_0x2b2174(0x20d),()=>_0x2109a2['engage']['listCampaigns']({'type':_0x2921e6,'status':_0x40b47c,'workspaceId':_0x560b90,'limit':_0x325e9a}),{'verbose':_0x33a8f3['verbose']});let _0x1abb8d=_0x2ac6a7[_0x2b2174(0x24b)];return _0x57c9b3&&(_0x1abb8d=_0x2ac6a7[_0x2b2174(0x24b)][_0x2b2174(0x226)](_0x551482=>matchGlobPattern(_0x551482[_0x2b2174(0x1d4)],_0x57c9b3))),await handleSDKOutput(_0x1abb8d,_0x33a8f3),0x0;}}export class EngageCampaignShowCommand extends BaseCommand{[a16_0x34af8f(0x1d4)]=a16_0x34af8f(0x22a);[a16_0x34af8f(0x1fc)]='Show\x20campaign\x20details';async['execute'](_0x28ec62){const _0x1f0b85=a16_0x34af8f,{options:_0x5f3c30,args:_0x31f1c3,tdx:_0x3f2841}=_0x28ec62;if(_0x31f1c3[_0x1f0b85(0x221)]===0x0)return console[_0x1f0b85(0x234)](_0x1f0b85(0x1e8)),console[_0x1f0b85(0x234)](_0x1f0b85(0x1f8)),0x1;const _0xd31719=_0x31f1c3[0x0],_0xd0b32d=_0x5f3c30,_0x572d34=await resolveWorkspaceIdFromOptions(_0xd0b32d,_0x3f2841),_0x39d1fc=_0xd0b32d[_0x1f0b85(0x233)];if(_0x39d1fc){const _0x334870=await withSpinner('Fetching\x20campaign\x20\x27'+_0xd31719+_0x1f0b85(0x1da),()=>_0x3f2841[_0x1f0b85(0x211)][_0x1f0b85(0x239)](_0xd31719,_0x572d34),{'verbose':_0x5f3c30[_0x1f0b85(0x1dc)]});await handleSDKOutput([_0x334870],_0x5f3c30);}else{const _0x2329fb=await withSpinner(_0x1f0b85(0x22e)+_0xd31719+_0x1f0b85(0x1da),()=>_0x3f2841[_0x1f0b85(0x211)][_0x1f0b85(0x1e6)](_0xd31719,_0x572d34),{'verbose':_0x5f3c30['verbose']});await handleSDKOutput([_0x2329fb],_0x5f3c30);}return 0x0;}}export class EngageCampaignCreateCommand extends BaseCommand{[a16_0x34af8f(0x1d4)]=a16_0x34af8f(0x1fa);[a16_0x34af8f(0x1fc)]=a16_0x34af8f(0x258);async[a16_0x34af8f(0x1db)](_0x3ed2af){const _0x3b3272=a16_0x34af8f,{options:_0x476af6,tdx:_0x342fbc}=_0x3ed2af,_0xc7d56b=_0x476af6,_0x42e5cb=_0xc7d56b[_0x3b3272(0x1d4)],_0x23a9c9=_0xc7d56b[_0x3b3272(0x20b)];if(!_0x42e5cb)return console[_0x3b3272(0x234)](_0x3b3272(0x1d7)),console['error'](_0x3b3272(0x230)),0x1;if(!_0x23a9c9)return console[_0x3b3272(0x234)](_0x3b3272(0x1f9)),console[_0x3b3272(0x234)](_0x3b3272(0x230)),0x1;const _0x30137b=await resolveWorkspaceIdFromOptions(_0xc7d56b,_0x342fbc,!![]),_0x2d4b8f=await resolveSegmentFromOptions(_0xc7d56b,_0x342fbc),_0x1300d7=buildConnectorConfig(_0xc7d56b),_0x4001ab={'name':_0x42e5cb,'campaignType':_0x23a9c9,'workspaceId':_0x30137b,'description':_0xc7d56b['description'],..._0x2d4b8f,'connectorConfig':_0x1300d7,'startAt':_0xc7d56b[_0x3b3272(0x25f)],'timezone':_0xc7d56b['timezone']},_0x4d7edc=await withSpinner(_0x3b3272(0x23a)+_0x42e5cb+_0x3b3272(0x1da),()=>_0x342fbc['engage'][_0x3b3272(0x207)](_0x4001ab));return await handleSDKOutput([_0x4d7edc[_0x3b3272(0x24b)]],_0x476af6),0x0;}}export class EngageCampaignUpdateCommand extends BaseCommand{['name']=a16_0x34af8f(0x218);['description']=a16_0x34af8f(0x25a);async[a16_0x34af8f(0x1db)](_0x776468){const _0x3bd6a6=a16_0x34af8f,{options:_0x3762ab,args:_0x3455e4,tdx:_0x4144a8}=_0x776468;if(_0x3455e4[_0x3bd6a6(0x221)]===0x0)return console[_0x3bd6a6(0x234)](_0x3bd6a6(0x1e8)),console['error'](_0x3bd6a6(0x22d)),0x1;const _0x437301=_0x3455e4[0x0],_0x525954=_0x3762ab,_0x5e2976=await resolveWorkspaceIdFromOptions(_0x525954,_0x4144a8),_0x42af79=await resolveSegmentFromOptions(_0x525954,_0x4144a8),_0x39e849=buildConnectorConfig(_0x525954),_0x3ebb5c={'name':_0x525954[_0x3bd6a6(0x1d4)],'description':_0x525954[_0x3bd6a6(0x1fc)],..._0x42af79,'connectorConfig':_0x39e849,'startAt':_0x525954[_0x3bd6a6(0x25f)],'timezone':_0x525954[_0x3bd6a6(0x203)]},_0x59f700=Object[_0x3bd6a6(0x216)](Object[_0x3bd6a6(0x252)](_0x3ebb5c)['filter'](([,_0x5f2bd7])=>_0x5f2bd7!==undefined));if(Object[_0x3bd6a6(0x1f5)](_0x59f700)['length']===0x0)return console[_0x3bd6a6(0x234)]('Error:\x20At\x20least\x20one\x20field\x20to\x20update\x20is\x20required'),console[_0x3bd6a6(0x234)](_0x3bd6a6(0x1e4)),0x1;const _0x152f4a=await withSpinner(_0x3bd6a6(0x23e)+_0x437301+'\x27...',()=>_0x4144a8['engage'][_0x3bd6a6(0x247)](_0x437301,_0x59f700,_0x5e2976),{'verbose':_0x3762ab[_0x3bd6a6(0x1dc)]});return await handleSDKOutput([_0x152f4a['data']],_0x3762ab),0x0;}}export class EngageCampaignDeleteCommand extends BaseCommand{['name']='engage:campaign:delete';[a16_0x34af8f(0x1fc)]='Delete\x20a\x20campaign';async[a16_0x34af8f(0x1db)](_0x30a060){const _0x2a23da=a16_0x34af8f,{options:_0x273cef,args:_0x15e5b9,tdx:_0x311799}=_0x30a060;if(_0x15e5b9['length']===0x0)return console[_0x2a23da(0x234)](_0x2a23da(0x1e8)),console[_0x2a23da(0x234)](_0x2a23da(0x201)),0x1;const _0x404f02=_0x15e5b9[0x0],_0x4a69ab=_0x273cef,_0x1c9545=await resolveWorkspaceIdFromOptions(_0x4a69ab,_0x311799);if(!_0x273cef['yes']){const _0x239929=await confirm(_0x2a23da(0x1de)+_0x404f02+_0x2a23da(0x25d));if(!_0x239929)return console[_0x2a23da(0x24e)](_0x2a23da(0x20e)),0x0;}return await withSpinner(_0x2a23da(0x232)+_0x404f02+'\x27...',()=>_0x311799['engage'][_0x2a23da(0x21a)](_0x404f02,_0x1c9545),{'verbose':_0x273cef[_0x2a23da(0x1dc)]}),console[_0x2a23da(0x24e)](_0x2a23da(0x263)+_0x404f02+_0x2a23da(0x24c)),0x0;}}export class EngageCampaignLaunchCommand extends BaseCommand{[a16_0x34af8f(0x1d4)]=a16_0x34af8f(0x1e3);['description']=a16_0x34af8f(0x253);async[a16_0x34af8f(0x1db)](_0x1d8f82){const _0x57f4be=a16_0x34af8f,{options:_0x5c23f3,args:_0x11e8f3,tdx:_0xc3924}=_0x1d8f82;if(_0x11e8f3[_0x57f4be(0x221)]===0x0)return console['error'](_0x57f4be(0x1e8)),console[_0x57f4be(0x234)]('Usage:\x20tdx\x20engage\x20campaign\x20launch\x20<name-or-id>'),0x1;const _0x5af61e=_0x11e8f3[0x0],_0x58e700=_0x5c23f3,_0x46d07f=await resolveWorkspaceIdFromOptions(_0x58e700,_0xc3924);return await withSpinner('Launching\x20campaign\x20\x27'+_0x5af61e+_0x57f4be(0x1da),()=>_0xc3924[_0x57f4be(0x211)][_0x57f4be(0x20a)](_0x5af61e,_0x46d07f),{'verbose':_0x5c23f3[_0x57f4be(0x1dc)]}),console[_0x57f4be(0x24e)](_0x57f4be(0x263)+_0x5af61e+_0x57f4be(0x1fd)),0x0;}}export class EngageCampaignPauseCommand extends BaseCommand{[a16_0x34af8f(0x1d4)]=a16_0x34af8f(0x209);['description']=a16_0x34af8f(0x231);async[a16_0x34af8f(0x1db)](_0x3044a5){const _0x4cbd23=a16_0x34af8f,{options:_0x31752f,args:_0x335031,tdx:_0x3ed6f7}=_0x3044a5;if(_0x335031[_0x4cbd23(0x221)]===0x0)return console[_0x4cbd23(0x234)]('Error:\x20Campaign\x20name\x20or\x20ID\x20is\x20required'),console[_0x4cbd23(0x234)]('Usage:\x20tdx\x20engage\x20campaign\x20pause\x20<name-or-id>'),0x1;const _0x3faca8=_0x335031[0x0],_0x5d6e45=_0x31752f,_0x25ba8a=await resolveWorkspaceIdFromOptions(_0x5d6e45,_0x3ed6f7);return await withSpinner(_0x4cbd23(0x257)+_0x3faca8+'\x27...',()=>_0x3ed6f7[_0x4cbd23(0x211)][_0x4cbd23(0x262)](_0x3faca8,_0x25ba8a),{'verbose':_0x31752f[_0x4cbd23(0x1dc)]}),console[_0x4cbd23(0x24e)](_0x4cbd23(0x263)+_0x3faca8+_0x4cbd23(0x22f)),0x0;}}export class EngageCampaignResumeCommand extends BaseCommand{[a16_0x34af8f(0x1d4)]=a16_0x34af8f(0x244);[a16_0x34af8f(0x1fc)]=a16_0x34af8f(0x1d9);async[a16_0x34af8f(0x1db)](_0x430a19){const _0x2f7823=a16_0x34af8f,{options:_0x5c37c5,args:_0x476a52,tdx:_0x47b564}=_0x430a19;if(_0x476a52['length']===0x0)return console['error']('Error:\x20Campaign\x20name\x20or\x20ID\x20is\x20required'),console[_0x2f7823(0x234)](_0x2f7823(0x206)),0x1;const _0x355c0b=_0x476a52[0x0],_0x2dc379=_0x5c37c5,_0x2693f3=await resolveWorkspaceIdFromOptions(_0x2dc379,_0x47b564);return await withSpinner(_0x2f7823(0x1d5)+_0x355c0b+'\x27...',()=>_0x47b564['engage'][_0x2f7823(0x236)](_0x355c0b,_0x2693f3),{'verbose':_0x5c37c5[_0x2f7823(0x1dc)]}),console[_0x2f7823(0x24e)](_0x2f7823(0x263)+_0x355c0b+'\x27\x20resumed\x20successfully'),0x0;}}export class EngageCampaignDuplicateCommand extends BaseCommand{[a16_0x34af8f(0x1d4)]='engage:campaign:duplicate';['description']=a16_0x34af8f(0x260);async[a16_0x34af8f(0x1db)](_0xc46287){const _0x4f581a=a16_0x34af8f,{options:_0x55a884,args:_0x2fb762,tdx:_0x12c3b4}=_0xc46287;if(_0x2fb762['length']===0x0)return console[_0x4f581a(0x234)]('Error:\x20Campaign\x20name\x20or\x20ID\x20is\x20required'),console[_0x4f581a(0x234)](_0x4f581a(0x246)),0x1;const _0x50ec64=_0x2fb762[0x0],_0x102745=_0x55a884,_0xbe2bd8=await resolveWorkspaceIdFromOptions(_0x102745,_0x12c3b4),_0x4a50f9=await withSpinner(_0x4f581a(0x1f2)+_0x50ec64+_0x4f581a(0x1da),()=>_0x12c3b4['engage']['duplicateCampaign'](_0x50ec64,_0xbe2bd8),{'verbose':_0x55a884[_0x4f581a(0x1dc)]});return await handleSDKOutput([_0x4a50f9[_0x4f581a(0x24b)]],_0x55a884),0x0;}}export class EngageTemplatesCommand extends BaseCommand{[a16_0x34af8f(0x1d4)]=a16_0x34af8f(0x1ee);['description']='List\x20email\x20templates';async[a16_0x34af8f(0x1db)](_0x128352){const _0x2dbc69=a16_0x34af8f,{options:_0x4b5847,args:_0x41880d,tdx:_0x4b2d07}=_0x128352,_0x4f3bdd=_0x41880d[0x0],_0x5ca922=resolveLimit(_0x4b5847[_0x2dbc69(0x1f6)],DEFAULT_LLM_LIMIT),_0x466f3f=_0x4b5847,_0x3bccb2=await resolveWorkspaceIdFromOptions(_0x466f3f,_0x4b2d07),_0xd2cb13=await withSpinner('Fetching\x20templates...',()=>_0x4b2d07[_0x2dbc69(0x211)][_0x2dbc69(0x243)]({'workspaceId':_0x3bccb2,'limit':_0x5ca922}),{'verbose':_0x4b5847[_0x2dbc69(0x1dc)]});let _0x1ac222=_0xd2cb13['data'];return _0x4f3bdd&&(_0x1ac222=_0xd2cb13[_0x2dbc69(0x24b)][_0x2dbc69(0x226)](_0x29c2cd=>matchGlobPattern(_0x29c2cd[_0x2dbc69(0x1d4)],_0x4f3bdd))),await handleSDKOutput(_0x1ac222,_0x4b5847),0x0;}}export class EngageTemplateShowCommand extends BaseCommand{[a16_0x34af8f(0x1d4)]=a16_0x34af8f(0x228);[a16_0x34af8f(0x1fc)]=a16_0x34af8f(0x21b);async[a16_0x34af8f(0x1db)](_0x4fc5a0){const _0x558486=a16_0x34af8f,{options:_0x23ceaf,args:_0x47a945,tdx:_0x32e825}=_0x4fc5a0;if(_0x47a945[_0x558486(0x221)]===0x0)return console[_0x558486(0x234)](_0x558486(0x251)),console[_0x558486(0x234)](_0x558486(0x24d)),0x1;const _0x3addc7=_0x47a945[0x0],_0x23ce26=_0x23ceaf,_0x240382=await resolveWorkspaceIdFromOptions(_0x23ce26,_0x32e825),_0x2a3ffa=_0x23ce26['full'];if(_0x2a3ffa){const _0x160dd6=await withSpinner(_0x558486(0x21c)+_0x3addc7+_0x558486(0x1da),()=>_0x32e825['engage']['getTemplateFull'](_0x3addc7,_0x240382),{'verbose':_0x23ceaf[_0x558486(0x1dc)]});await handleSDKOutput([_0x160dd6],_0x23ceaf);}else{const _0x1ae161=await withSpinner(_0x558486(0x21c)+_0x3addc7+'\x27...',()=>_0x32e825[_0x558486(0x211)][_0x558486(0x1f7)](_0x3addc7,_0x240382),{'verbose':_0x23ceaf[_0x558486(0x1dc)]});await handleSDKOutput([_0x1ae161],_0x23ceaf);}return 0x0;}}export class EngageTemplateCreateCommand extends BaseCommand{[a16_0x34af8f(0x1d4)]=a16_0x34af8f(0x1e0);[a16_0x34af8f(0x1fc)]=a16_0x34af8f(0x1ea);async[a16_0x34af8f(0x1db)](_0x55351e){const _0x5581a2=a16_0x34af8f,{options:_0x42f8cb,tdx:_0x3b90c4}=_0x55351e,_0x5574c9=_0x42f8cb,_0x3bd2e0=_0x5574c9[_0x5581a2(0x1d4)],_0x33f4df=_0x5574c9['subject'],_0x119899=_0x5574c9['html'];if(!_0x3bd2e0)return console[_0x5581a2(0x234)]('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(!_0x33f4df)return console[_0x5581a2(0x234)](_0x5581a2(0x212)),0x1;if(!_0x119899)return console[_0x5581a2(0x234)](_0x5581a2(0x20f)),0x1;const _0x58c71b=await resolveWorkspaceIdFromOptions(_0x5574c9,_0x3b90c4,!![]),_0x5e66b9={'name':_0x3bd2e0,'subjectTemplate':_0x33f4df,'htmlTemplate':_0x119899,'workspaceId':_0x58c71b,'plaintextTemplate':_0x5574c9[_0x5581a2(0x255)],'editorType':_0x5574c9[_0x5581a2(0x23b)]},_0x21ff9a=await withSpinner(_0x5581a2(0x213)+_0x3bd2e0+'\x27...',()=>_0x3b90c4[_0x5581a2(0x211)]['createTemplate'](_0x5e66b9));return await handleSDKOutput([_0x21ff9a[_0x5581a2(0x24b)]],_0x42f8cb),0x0;}}export class EngageTemplateUpdateCommand extends BaseCommand{[a16_0x34af8f(0x1d4)]=a16_0x34af8f(0x23f);[a16_0x34af8f(0x1fc)]=a16_0x34af8f(0x1e1);async[a16_0x34af8f(0x1db)](_0xa30221){const _0x47ddbb=a16_0x34af8f,{options:_0x52142f,args:_0x2e5f89,tdx:_0x4efdc4}=_0xa30221;if(_0x2e5f89[_0x47ddbb(0x221)]===0x0)return console['error'](_0x47ddbb(0x251)),console[_0x47ddbb(0x234)](_0x47ddbb(0x245)),0x1;const _0x111bc7=_0x2e5f89[0x0],_0x1be787=_0x52142f,_0x537d0d=await resolveWorkspaceIdFromOptions(_0x1be787,_0x4efdc4),_0x2a5b42={'name':_0x1be787[_0x47ddbb(0x1d4)],'subjectTemplate':_0x1be787[_0x47ddbb(0x215)],'htmlTemplate':_0x1be787[_0x47ddbb(0x1f3)],'plaintextTemplate':_0x1be787[_0x47ddbb(0x255)]},_0x4b4b40=Object[_0x47ddbb(0x216)](Object[_0x47ddbb(0x252)](_0x2a5b42)['filter'](([,_0x190c46])=>_0x190c46!==undefined));if(Object[_0x47ddbb(0x1f5)](_0x4b4b40)[_0x47ddbb(0x221)]===0x0)return console['error'](_0x47ddbb(0x229)),console['error']('Options:\x20--name,\x20--subject,\x20--html,\x20--plaintext'),0x1;const _0x1e0946=await withSpinner('Updating\x20template\x20\x27'+_0x111bc7+_0x47ddbb(0x1da),()=>_0x4efdc4['engage'][_0x47ddbb(0x1e2)](_0x111bc7,_0x4b4b40,_0x537d0d),{'verbose':_0x52142f[_0x47ddbb(0x1dc)]});return await handleSDKOutput([_0x1e0946[_0x47ddbb(0x24b)]],_0x52142f),0x0;}}export class EngageTemplateDeleteCommand extends BaseCommand{[a16_0x34af8f(0x1d4)]=a16_0x34af8f(0x238);[a16_0x34af8f(0x1fc)]=a16_0x34af8f(0x217);async[a16_0x34af8f(0x1db)](_0x48aad7){const _0x58fb02=a16_0x34af8f,{options:_0x11c707,args:_0x1e9ade,tdx:_0x31ae22}=_0x48aad7;if(_0x1e9ade[_0x58fb02(0x221)]===0x0)return console[_0x58fb02(0x234)](_0x58fb02(0x251)),console[_0x58fb02(0x234)]('Usage:\x20tdx\x20engage\x20template\x20delete\x20<name-or-id>'),0x1;const _0x4af858=_0x1e9ade[0x0],_0x36bc88=_0x11c707,_0x4050f7=await resolveWorkspaceIdFromOptions(_0x36bc88,_0x31ae22);if(!_0x11c707['yes']){const _0x3ed809=await confirm(_0x58fb02(0x1f0)+_0x4af858+_0x58fb02(0x25d));if(!_0x3ed809)return console[_0x58fb02(0x24e)](_0x58fb02(0x20e)),0x0;}return await withSpinner(_0x58fb02(0x1ed)+_0x4af858+'\x27...',()=>_0x31ae22['engage']['deleteTemplate'](_0x4af858,_0x4050f7),{'verbose':_0x11c707[_0x58fb02(0x1dc)]}),console[_0x58fb02(0x24e)](_0x58fb02(0x1e5)+_0x4af858+'\x27\x20deleted\x20successfully'),0x0;}}export class EngageWorkspacesCommand extends BaseCommand{['name']=a16_0x34af8f(0x24a);[a16_0x34af8f(0x1fc)]='List\x20workspaces';async[a16_0x34af8f(0x1db)](_0x132f39){const _0x4691b8=a16_0x34af8f,{options:_0x656a70,args:_0x85253c,tdx:_0x5895c6}=_0x132f39,_0xe82ba4=_0x85253c[0x0],_0x340f13=resolveLimit(_0x656a70[_0x4691b8(0x1f6)],DEFAULT_LLM_LIMIT),_0xa3d7e7=await withSpinner(_0x4691b8(0x259),()=>_0x5895c6[_0x4691b8(0x211)][_0x4691b8(0x21e)]({'limit':_0x340f13}),{'verbose':_0x656a70[_0x4691b8(0x1dc)]});let _0x410afe=_0xa3d7e7[_0x4691b8(0x24b)];return _0xe82ba4&&(_0x410afe=_0xa3d7e7[_0x4691b8(0x24b)]['filter'](_0x262a96=>matchGlobPattern(_0x262a96['name'],_0xe82ba4))),await handleSDKOutput(_0x410afe,_0x656a70),0x0;}}export class EngageWorkspaceShowCommand extends BaseCommand{['name']=a16_0x34af8f(0x25e);[a16_0x34af8f(0x1fc)]='Show\x20workspace\x20details';async['execute'](_0x41db4c){const _0xffdda7=a16_0x34af8f,{options:_0x335b03,args:_0x5b3b1e,tdx:_0x43b6e9}=_0x41db4c;if(_0x5b3b1e['length']===0x0)return console['error'](_0xffdda7(0x1d8)),console[_0xffdda7(0x234)]('Usage:\x20tdx\x20engage\x20workspace\x20show\x20<name-or-id>'),0x1;const _0x2af0f6=_0x5b3b1e[0x0],_0x10eb96=_0x335b03,_0x104d10=_0x10eb96['full'];if(_0x104d10){const _0x5b5581=await withSpinner(_0xffdda7(0x205)+_0x2af0f6+_0xffdda7(0x1da),()=>_0x43b6e9['engage'][_0xffdda7(0x223)](_0x2af0f6),{'verbose':_0x335b03[_0xffdda7(0x1dc)]});await handleSDKOutput([_0x5b5581],_0x335b03);}else{const _0x30c47e=await withSpinner(_0xffdda7(0x205)+_0x2af0f6+_0xffdda7(0x1da),()=>_0x43b6e9[_0xffdda7(0x211)][_0xffdda7(0x256)](_0x2af0f6),{'verbose':_0x335b03[_0xffdda7(0x1dc)]});await handleSDKOutput([_0x30c47e],_0x335b03);}return 0x0;}}function a16_0x3cde(){const _0x34bc94=['getWorkspace','Pausing\x20campaign\x20\x27','Create\x20a\x20new\x20campaign','Fetching\x20workspaces...','Update\x20a\x20campaign','engage:workspace:use','segment','\x27?\x20This\x20cannot\x20be\x20undone.','engage:workspace:show','startAt','Duplicate\x20a\x20campaign','\x0aTip:\x20Use\x20\x27tdx\x20use\x20--clear\x27\x20to\x20clear\x20session\x20overrides','pauseCampaign','Campaign\x20\x27','name','Resuming\x20campaign\x20\x27','Usage:\x20tdx\x20engage\x20workspace\x20delete\x20<name-or-id>','Error:\x20--name\x20is\x20required','Error:\x20Workspace\x20name\x20or\x20ID\x20is\x20required','Resume\x20a\x20paused\x20campaign','\x27...','execute','verbose','Usage:\x20tdx\x20engage\x20workspace\x20create\x20--name\x20<name>\x20[--description\x20<desc>]','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20campaign\x20\x27','segmentName','engage:template:create','Update\x20an\x20email\x20template','updateTemplate','engage:campaign:launch','Options:\x20--name,\x20--description,\x20--segment,\x20--email-sender-id,\x20--json-columns,\x20--start-at,\x20--timezone','Template\x20\x27','getCampaign','engage_workspace','Error:\x20Campaign\x20name\x20or\x20ID\x20is\x20required','engage:workspace:delete','Create\x20an\x20email\x20template','updateWorkspace','parentName','Deleting\x20template\x20\x27','engage:templates','createWorkspace','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20template\x20\x27','Workspace\x20\x27','Duplicating\x20campaign\x20\x27','html','resolvePathToResource','keys','limit','getTemplate','Usage:\x20tdx\x20engage\x20campaign\x20show\x20<name-or-id>','Error:\x20--type\x20is\x20required\x20(email\x20or\x20push)','engage:campaign:create','Creating\x20workspace\x20\x27','description','\x27\x20launched\x20successfully','15476480SUkihS','Deleting\x20workspace\x20\x27','segmentId','Usage:\x20tdx\x20engage\x20campaign\x20delete\x20<name-or-id>','486GbAsHY','timezone','1960268RGlNVC','Fetching\x20workspace\x20\x27','Usage:\x20tdx\x20engage\x20campaign\x20resume\x20<name-or-id>','createCampaign','engage:workspace:update','engage:campaign:pause','launchCampaign','type','engage:campaigns','Fetching\x20campaigns...','Operation\x20cancelled','Error:\x20--html\x20is\x20required','2613261hLadVL','engage','Error:\x20--subject\x20is\x20required','Creating\x20template\x20\x27','parentId','subject','fromEntries','Delete\x20an\x20email\x20template','engage:campaign:update','2628514UDwMfI','deleteCampaign','Show\x20email\x20template\x20details','Fetching\x20template\x20\x27','session','listWorkspaces','Update\x20a\x20workspace','jsonColumns','length','6747365NFQhAC','getWorkspaceFull','resolveWorkspaceId','MISSING_ARGUMENT','filter','Usage:\x20tdx\x20engage\x20workspace\x20update\x20<name-or-id>\x20[--name\x20<new-name>]\x20...','engage:template:show','Error:\x20At\x20least\x20one\x20field\x20to\x20update\x20is\x20required','engage:campaign:show','engage:workspace:create','Delete\x20a\x20workspace','Usage:\x20tdx\x20engage\x20campaign\x20update\x20<name-or-id>\x20[--name\x20<new-name>]\x20...','Fetching\x20campaign\x20\x27','\x27\x20paused\x20successfully','Usage:\x20tdx\x20engage\x20campaign\x20create\x20--name\x20<name>\x20--type\x20<email|push>','Pause\x20a\x20campaign','Deleting\x20campaign\x20\x27','full','error','Workspace\x20is\x20required\x20for\x20this\x20operation','resumeCampaign','1090170oDiyBK','engage:template:delete','getCampaignFull','Creating\x20campaign\x20\x27','editorType','status','870QBmyKk','Updating\x20campaign\x20\x27','engage:template:update','workspace','Create\x20a\x20workspace','emailSenderId','listTemplates','engage:campaign:resume','Usage:\x20tdx\x20engage\x20template\x20update\x20<name-or-id>\x20[--name\x20<new-name>]\x20...','Usage:\x20tdx\x20engage\x20campaign\x20duplicate\x20<name-or-id>','updateCampaign','yes','List\x20campaigns','engage:workspaces','data','\x27\x20deleted\x20successfully','Usage:\x20tdx\x20engage\x20template\x20show\x20<name-or-id>','log','Verifying\x20workspace\x20\x27','Usage:\x20tdx\x20engage\x20workspace\x20use\x20<name>','Error:\x20Template\x20name\x20or\x20ID\x20is\x20required','entries','Launch\x20a\x20campaign','Error:\x20Workspace\x20name\x20is\x20required','plaintext'];a16_0x3cde=function(){return _0x34bc94;};return a16_0x3cde();}export class EngageWorkspaceCreateCommand extends BaseCommand{['name']=a16_0x34af8f(0x22b);[a16_0x34af8f(0x1fc)]=a16_0x34af8f(0x241);async['execute'](_0x15462f){const _0x275e87=a16_0x34af8f,{options:_0x17ff58,tdx:_0x39c5d0}=_0x15462f,_0x3157fb=_0x17ff58,_0x592ed0=_0x3157fb[_0x275e87(0x1d4)];if(!_0x592ed0)return console[_0x275e87(0x234)](_0x275e87(0x1d7)),console[_0x275e87(0x234)](_0x275e87(0x1dd)),0x1;const _0x39ff3a={'name':_0x592ed0,'description':_0x3157fb[_0x275e87(0x1fc)]},_0x135fa3=await withSpinner(_0x275e87(0x1fb)+_0x592ed0+_0x275e87(0x1da),()=>_0x39c5d0[_0x275e87(0x211)][_0x275e87(0x1ef)](_0x39ff3a));return await handleSDKOutput([_0x135fa3[_0x275e87(0x24b)]],_0x17ff58),0x0;}}export class EngageWorkspaceUpdateCommand extends BaseCommand{[a16_0x34af8f(0x1d4)]=a16_0x34af8f(0x208);[a16_0x34af8f(0x1fc)]=a16_0x34af8f(0x21f);async[a16_0x34af8f(0x1db)](_0x4a8e0d){const _0x30a58d=a16_0x34af8f,{options:_0x4f40f8,args:_0x436a06,tdx:_0x4b53dd}=_0x4a8e0d;if(_0x436a06['length']===0x0)return console['error'](_0x30a58d(0x1d8)),console[_0x30a58d(0x234)](_0x30a58d(0x227)),0x1;const _0x2406dd=_0x436a06[0x0],_0xd4f01=_0x4f40f8,_0x12d858={'name':_0xd4f01[_0x30a58d(0x1d4)],'description':_0xd4f01[_0x30a58d(0x1fc)]},_0x15c9a1=Object[_0x30a58d(0x216)](Object[_0x30a58d(0x252)](_0x12d858)[_0x30a58d(0x226)](([,_0x3c1611])=>_0x3c1611!==undefined));if(Object[_0x30a58d(0x1f5)](_0x15c9a1)['length']===0x0)return console[_0x30a58d(0x234)](_0x30a58d(0x229)),console[_0x30a58d(0x234)]('Options:\x20--name,\x20--description'),0x1;const _0x235972=await withSpinner('Updating\x20workspace\x20\x27'+_0x2406dd+_0x30a58d(0x1da),()=>_0x4b53dd[_0x30a58d(0x211)][_0x30a58d(0x1eb)](_0x2406dd,_0x15c9a1),{'verbose':_0x4f40f8[_0x30a58d(0x1dc)]});return await handleSDKOutput([_0x235972[_0x30a58d(0x24b)]],_0x4f40f8),0x0;}}export class EngageWorkspaceDeleteCommand extends BaseCommand{[a16_0x34af8f(0x1d4)]=a16_0x34af8f(0x1e9);['description']=a16_0x34af8f(0x22c);async[a16_0x34af8f(0x1db)](_0x462d0){const _0xf054f9=a16_0x34af8f,{options:_0x347002,args:_0x239804,tdx:_0x32c82d}=_0x462d0;if(_0x239804[_0xf054f9(0x221)]===0x0)return console[_0xf054f9(0x234)](_0xf054f9(0x1d8)),console[_0xf054f9(0x234)](_0xf054f9(0x1d6)),0x1;const _0x497793=_0x239804[0x0];if(!_0x347002[_0xf054f9(0x248)]){const _0x3d506b=await confirm('Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20workspace\x20\x27'+_0x497793+_0xf054f9(0x25d));if(!_0x3d506b)return console[_0xf054f9(0x24e)]('Operation\x20cancelled'),0x0;}return await withSpinner(_0xf054f9(0x1ff)+_0x497793+_0xf054f9(0x1da),()=>_0x32c82d[_0xf054f9(0x211)]['deleteWorkspace'](_0x497793),{'verbose':_0x347002[_0xf054f9(0x1dc)]}),console[_0xf054f9(0x24e)](_0xf054f9(0x1f1)+_0x497793+_0xf054f9(0x24c)),0x0;}}export class EngageWorkspaceUseCommand extends BaseCommand{[a16_0x34af8f(0x1d4)]=a16_0x34af8f(0x25b);[a16_0x34af8f(0x1fc)]='Set\x20workspace\x20context\x20for\x20Engage\x20commands';async[a16_0x34af8f(0x1db)](_0x4fe2a1){const _0x46e549=a16_0x34af8f,{options:_0x226dba,args:_0x508097,tdx:_0x474183}=_0x4fe2a1;if(_0x508097[_0x46e549(0x221)]===0x0)return console[_0x46e549(0x234)](_0x46e549(0x254)),console['error'](_0x46e549(0x250)),0x1;const _0x18d2e0=_0x508097[0x0];await withSpinner(_0x46e549(0x24f)+_0x18d2e0+_0x46e549(0x1da),()=>_0x474183['engage']['resolveWorkspaceId'](_0x18d2e0));const _0x1379a2=_0x226dba[_0x46e549(0x21d)]||undefined;return saveSessionContext({'engage_workspace':_0x18d2e0},_0x1379a2),console[_0x46e549(0x24e)]('Engage\x20workspace\x20set\x20to:\x20'+_0x18d2e0),console[_0x46e549(0x24e)](_0x46e549(0x261)),0x0;}}
|