@treasuredata/tdx 0.13.1 → 0.13.2

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.
Files changed (143) hide show
  1. package/dist/bin.js +1 -1
  2. package/dist/build-info.json +3 -3
  3. package/dist/cli-categories.js +1 -1
  4. package/dist/cli.js +1 -1
  5. package/dist/commands/activations.js +1 -1
  6. package/dist/commands/agent-command.js +1 -1
  7. package/dist/commands/api-command.js +1 -1
  8. package/dist/commands/auth-command.js +1 -1
  9. package/dist/commands/chat-command.js +1 -1
  10. package/dist/commands/claude-command.js +1 -1
  11. package/dist/commands/claude-statusline-command.js +1 -1
  12. package/dist/commands/claude-usage-command.js +1 -1
  13. package/dist/commands/command.js +1 -1
  14. package/dist/commands/connection-command.js +1 -1
  15. package/dist/commands/databases.js +1 -1
  16. package/dist/commands/describe.js +1 -1
  17. package/dist/commands/engage-command.js +1 -1
  18. package/dist/commands/job-command.js +1 -1
  19. package/dist/commands/journey-command.d.ts.map +1 -1
  20. package/dist/commands/journey-command.js +1 -1
  21. package/dist/commands/journey-command.js.map +1 -1
  22. package/dist/commands/journey-validate-command.js +1 -1
  23. package/dist/commands/llm-command.js +1 -1
  24. package/dist/commands/llm-proxy.js +1 -1
  25. package/dist/commands/parent-segment-command.js +1 -1
  26. package/dist/commands/profile-command.js +1 -1
  27. package/dist/commands/profiles-command.js +1 -1
  28. package/dist/commands/query-command.js +1 -1
  29. package/dist/commands/segment-command.js +1 -1
  30. package/dist/commands/segment-create-command.js +1 -1
  31. package/dist/commands/segment-fields-command.js +1 -1
  32. package/dist/commands/segment-pull-command.js +1 -1
  33. package/dist/commands/segment-push-command.js +1 -1
  34. package/dist/commands/segment-push-command.js.map +1 -1
  35. package/dist/commands/segment-update-command.js +1 -1
  36. package/dist/commands/segment-use-command.js +1 -1
  37. package/dist/commands/segment-validate-command.js +1 -1
  38. package/dist/commands/segments.js +1 -1
  39. package/dist/commands/show.js +1 -1
  40. package/dist/commands/tables.js +1 -1
  41. package/dist/commands/use-command.js +1 -1
  42. package/dist/commands/user-command.js +1 -1
  43. package/dist/commands/workflow-command.js +1 -1
  44. package/dist/core/auth.js +1 -1
  45. package/dist/core/command-output.js +1 -1
  46. package/dist/core/config.js +1 -1
  47. package/dist/core/connection-cache.js +1 -1
  48. package/dist/core/constants.js +1 -1
  49. package/dist/core/credential-cache.js +1 -1
  50. package/dist/core/global-context.js +1 -1
  51. package/dist/core/keychain.js +1 -1
  52. package/dist/core/profile.js +1 -1
  53. package/dist/core/project-config.js +1 -1
  54. package/dist/core/session.js +1 -1
  55. package/dist/core/user-cache.js +1 -1
  56. package/dist/core/version.js +1 -1
  57. package/dist/index.js +1 -1
  58. package/dist/proxy/anthropic-adapter.js +1 -1
  59. package/dist/proxy/claude-usage-tracker.js +1 -1
  60. package/dist/proxy/context-signature.js +1 -1
  61. package/dist/proxy/conversation-utils.js +1 -1
  62. package/dist/proxy/server.js +1 -1
  63. package/dist/proxy/session-cache.js +1 -1
  64. package/dist/sdk/agent/agent-config.js +1 -1
  65. package/dist/sdk/agent/agent-ref-parser.js +1 -1
  66. package/dist/sdk/agent/agent-yaml.js +1 -1
  67. package/dist/sdk/api.js +1 -1
  68. package/dist/sdk/client/cdp-api-client.js +1 -1
  69. package/dist/sdk/client/endpoints.js +1 -1
  70. package/dist/sdk/client/engage-api-client.js +1 -1
  71. package/dist/sdk/client/http-client.js +1 -1
  72. package/dist/sdk/client/llm-api-client.js +1 -1
  73. package/dist/sdk/client/rate-limiter.js +1 -1
  74. package/dist/sdk/client/td-api-client.js +1 -1
  75. package/dist/sdk/client/trino-api-client.js +1 -1
  76. package/dist/sdk/client/workflow-client.js +1 -1
  77. package/dist/sdk/connection-validator.js +1 -1
  78. package/dist/sdk/connection.js +1 -1
  79. package/dist/sdk/engage.js +1 -1
  80. package/dist/sdk/errors.js +1 -1
  81. package/dist/sdk/index.js +1 -1
  82. package/dist/sdk/io/index.js +1 -1
  83. package/dist/sdk/io/node-filesystem.js +1 -1
  84. package/dist/sdk/job.js +1 -1
  85. package/dist/sdk/journey.d.ts +19 -3
  86. package/dist/sdk/journey.d.ts.map +1 -1
  87. package/dist/sdk/journey.js +1 -1
  88. package/dist/sdk/journey.js.map +1 -1
  89. package/dist/sdk/llm/chat-cache.js +1 -1
  90. package/dist/sdk/llm/index.js +1 -1
  91. package/dist/sdk/llm/llm-backup-utils.js +1 -1
  92. package/dist/sdk/llm/model-aliases.js +1 -1
  93. package/dist/sdk/llm/model-factors.js +1 -1
  94. package/dist/sdk/query/index.js +1 -1
  95. package/dist/sdk/query/sql-parser.js +1 -1
  96. package/dist/sdk/segment/child-segment-yaml.js +1 -1
  97. package/dist/sdk/segment/fields-display.js +1 -1
  98. package/dist/sdk/segment/file-discovery.js +1 -1
  99. package/dist/sdk/segment/journey-utils.js +1 -1
  100. package/dist/sdk/segment/journey-yaml.js +1 -1
  101. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  102. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  103. package/dist/sdk/segment/pull-workflow.d.ts.map +1 -1
  104. package/dist/sdk/segment/pull-workflow.js +1 -1
  105. package/dist/sdk/segment/pull-workflow.js.map +1 -1
  106. package/dist/sdk/segment/push-workflow.js +1 -1
  107. package/dist/sdk/segment/resolution-context.js +1 -1
  108. package/dist/sdk/segment/segment-path-parser.js +1 -1
  109. package/dist/sdk/segment/segment-ref-parser.js +1 -1
  110. package/dist/sdk/segment/target-resolution.js +1 -1
  111. package/dist/sdk/segment/tdx-config.js +1 -1
  112. package/dist/sdk/segment/validate-files.js +1 -1
  113. package/dist/sdk/segment/yaml-validator.js +1 -1
  114. package/dist/sdk/segment.js +1 -1
  115. package/dist/sdk/types/index.js +1 -1
  116. package/dist/sdk/types/progress.js +1 -1
  117. package/dist/sdk/user.js +1 -1
  118. package/dist/sdk/util/format-detector.js +1 -1
  119. package/dist/sdk/util/formatters.js +1 -1
  120. package/dist/sdk/util/index.js +1 -1
  121. package/dist/sdk/util/tree-formatter.js +1 -1
  122. package/dist/sdk/workflow/clone-workflow.js +1 -1
  123. package/dist/sdk/workflow/index.js +1 -1
  124. package/dist/sdk/workflow/pull-workflow.js +1 -1
  125. package/dist/sdk/workflow/push-workflow.js +1 -1
  126. package/dist/sdk/workflow/tdx-config.js +1 -1
  127. package/dist/sdk/workflow/workflow-utils.js +1 -1
  128. package/dist/utils/async.js +1 -1
  129. package/dist/utils/colors.js +1 -1
  130. package/dist/utils/diff.js +1 -1
  131. package/dist/utils/file-permissions.js +1 -1
  132. package/dist/utils/json-loader.js +1 -1
  133. package/dist/utils/option-validation.js +1 -1
  134. package/dist/utils/port.js +1 -1
  135. package/dist/utils/process.js +1 -1
  136. package/dist/utils/prompt.js +1 -1
  137. package/dist/utils/spinner.js +1 -1
  138. package/dist/utils/sse-parser.js +1 -1
  139. package/dist/utils/string-utils.js +1 -1
  140. package/dist/utils/table-ref-parser.js +1 -1
  141. package/dist/utils/tdx-logger.js +1 -1
  142. package/dist/utils/version-check.js +1 -1
  143. package/package.json +1 -1
@@ -1 +1 @@
1
- const a22_0x5182e7=a22_0xf78b;(function(_0x45501a,_0x213ac6){const _0x15d33d=a22_0xf78b,_0x203992=_0x45501a();while(!![]){try{const _0x4d3112=-parseInt(_0x15d33d(0x180))/0x1*(-parseInt(_0x15d33d(0x19a))/0x2)+-parseInt(_0x15d33d(0x177))/0x3+-parseInt(_0x15d33d(0x1be))/0x4*(parseInt(_0x15d33d(0x1ac))/0x5)+parseInt(_0x15d33d(0x1ad))/0x6+-parseInt(_0x15d33d(0x1a2))/0x7*(-parseInt(_0x15d33d(0x17f))/0x8)+parseInt(_0x15d33d(0x155))/0x9*(-parseInt(_0x15d33d(0x158))/0xa)+parseInt(_0x15d33d(0x1c2))/0xb;if(_0x4d3112===_0x213ac6)break;else _0x203992['push'](_0x203992['shift']());}catch(_0x29e3d0){_0x203992['push'](_0x203992['shift']());}}}(a22_0x5c53,0xc04ee));function a22_0xf78b(_0x2bf7b0,_0x29857b){_0x2bf7b0=_0x2bf7b0-0x14c;const _0x5c5330=a22_0x5c53();let _0xf78bbb=_0x5c5330[_0x2bf7b0];return _0xf78bbb;}import{BaseCommand,printAuthError}from'./command.js';import{listProfiles,profileExists,saveProfileToUserConfig,removeProfileFromUserConfig,loadProfile,getActiveProfile}from'../core/profile.js';import{saveSessionContext,getCurrentSessionPID,cleanExpiredSessions}from'../core/session.js';import{saveAPIKeyAsync,resolveSite}from'../core/config.js';import{getConsoleUrl}from'../sdk/client/endpoints.js';import{deleteKeychainAPIKey,isKeychainAvailable}from'../core/keychain.js';import{HTTPClientError}from'../sdk/client/http-client.js';import{TDX}from'../sdk/index.js';import{LogLevel}from'../utils/tdx-logger.js';function a22_0x5c53(){const _0x4bafac=['Session\x20profile\x20set\x20to:\x20','select','Profile\x20was\x20not\x20created.\x20Please\x20try\x20again.','VALID_KEYS','text','warn','\x0aSetting\x20up\x20authentication\x20for\x20site:\x20','length','63532FAUsZK','status','Enter\x20description\x20(optional):','\x0aYou\x20can\x20find\x20your\x20API\x20key\x20at:','23900701WpxtoR','Enter\x20site\x20name:','profile:set','customSite','\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases','name','\x20\x20-\x20','(session:\x20','Validating\x20API\x20key...','Set\x20a\x20profile\x20configuration\x20value','ERROR','\x20API\x20key\x20saved\x20to\x20system\x20keychain','Enter\x20custom\x20site','database','9FYesvm','us\x20\x20\x20-\x20United\x20States','Operation\x20cancelled','12716110redFlZ','\x20API\x20key\x20saved\x20to\x20system\x20keychain\x20(profile:\x20','join','bold','/app/mp/ak','trim','logLevel','\x20API\x20key\x20is\x20valid\x20(User:\x20','toString','log','\x0aAvailable\x20profiles:','API\x20key\x20cannot\x20be\x20empty','push','value','site','\x0aSetup\x20cancelled','Profile\x20name\x20cannot\x20be\x20empty','password','jp\x20\x20\x20-\x20Japan','\x27\x20removed\x20from\x20configuration','red','tdx:\x20profile\x20remove','Enter\x20your\x20TD\x20API\x20key\x20for\x20the\x20new\x20site:','Set\x20session\x20profile','findIndex','Profile\x20\x27','validate','split','Changing\x20site\x20to\x20\x27','✗\x20Validation\x20failed:\x20','description','1012506rPByIg','jp01','ap02','dim','config','parent_segment','apiKey','llm_project','328cgblLE','70753asuAog','Key=value\x20pair\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','Are\x20you\x20sure\x20you\x20want\x20to\x20remove\x20profile\x20\x27','session','error','profile:remove','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20use\x20<name>','\x27\x20does\x20not\x20exist.','(cleared)','Profile\x20name\x20must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore','test','profile:create','Remove\x20a\x20profile','us01','Enter\x20your\x20TD\x20API\x20key:','tdx:\x20profile\x20create','llm_agent','jobs','yellow','\x0aOperation\x20cancelled','Invalid\x20format.\x20Use:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','profile','green','ap02\x20-\x20Korea','No\x20active\x20profile.\x20Use\x20--profile\x20flag\x20or\x20set\x20session\x20profile\x20with:\x20tdx\x20profile\x20use\x20<name>\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>','34SJUXXF','Site\x20name\x20must\x20contain\x20only\x20lowercase\x20letters,\x20numbers,\x20and\x20hyphens','Enter\x20profile\x20name:','\x20\x20tdx\x20--profile\x20','confirm','getUserInfo','Select\x20Treasure\x20Data\x20site\x20for\x20profile\x20\x27','email','16534EGunCu','\x20API\x20key\x20removed\x20from\x20system\x20keychain','includes','You\x20can\x20now\x20use\x20tdx\x20commands\x20with\x20this\x20profile.\x20Try:','Unknown\x20key\x20\x27','other','profile:use','\x27\x20does\x20not\x20exist.\x20Create\x20it?','tdx:\x20profile\x20set','\x20Profile\x20\x27','370YHnxUF','598290tZODuL','\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.','\x27\x20requires\x20API\x20key\x20validation.','execute','\x27\x20created','create','profileName','\x27\x20updated:\x20','message'];a22_0x5c53=function(){return _0x4bafac;};return a22_0x5c53();}import a22_0x491e2b from'prompts';import a22_0x3de91c from'chalk';export class ProfileCreateCommand extends BaseCommand{['name']=a22_0x5182e7(0x18b);[a22_0x5182e7(0x176)]='Create\x20a\x20new\x20profile\x20interactively';async[a22_0x5182e7(0x1b0)](_0x185197){const _0x454686=a22_0x5182e7,{options:_0x14dfe0}=_0x185197;console[_0x454686(0x161)](a22_0x3de91c[_0x454686(0x15b)](_0x454686(0x18f)));const _0x4050b2=await a22_0x491e2b({'type':'text','name':_0x454686(0x1b3),'message':_0x454686(0x19c),'validate':_0x4cb7e1=>{const _0x2f7bb0=_0x454686;if(!_0x4cb7e1||!_0x4cb7e1[_0x2f7bb0(0x15d)]())return _0x2f7bb0(0x168);if(!/^[a-zA-Z0-9_-]+$/[_0x2f7bb0(0x18a)](_0x4cb7e1[_0x2f7bb0(0x15d)]()))return _0x2f7bb0(0x189);if(profileExists(_0x4cb7e1['trim']()))return'Profile\x20\x27'+_0x4cb7e1[_0x2f7bb0(0x15d)]()+'\x27\x20already\x20exists.\x20Use\x20\x27tdx\x20profile\x20set\x27\x20to\x20modify\x20it.';return!![];}});if(!_0x4050b2[_0x454686(0x1b3)])return console[_0x454686(0x161)](_0x454686(0x167)),0x1;const _0x401076=_0x4050b2[_0x454686(0x1b3)][_0x454686(0x15d)](),_0xa01339=await a22_0x491e2b({'type':_0x454686(0x1ba),'name':_0x454686(0x176),'message':_0x454686(0x1c0)}),_0x42907d=_0xa01339[_0x454686(0x176)]?.[_0x454686(0x15d)]()||undefined,_0x20ea5c=_0x14dfe0[_0x454686(0x166)]||_0x454686(0x18d),_0x160d41=[{'title':_0x454686(0x156),'value':'us01'},{'title':_0x454686(0x16a),'value':_0x454686(0x178)},{'title':'eu\x20\x20\x20-\x20Europe','value':'eu01'},{'title':_0x454686(0x198),'value':_0x454686(0x179)}];let _0x31038e=_0x160d41[_0x454686(0x170)](_0x41502e=>_0x41502e[_0x454686(0x165)]===_0x20ea5c);_0x31038e===-0x1&&_0x20ea5c!==_0x454686(0x18d)&&(_0x160d41['push']({'title':_0x20ea5c,'value':_0x20ea5c}),_0x31038e=_0x160d41['length']-0x1);_0x160d41[_0x454686(0x164)]({'title':_0x454686(0x153),'value':_0x454686(0x1a7)});const _0x59251b=await a22_0x491e2b({'type':_0x454686(0x1b7),'name':_0x454686(0x166),'message':_0x454686(0x1a0)+_0x401076+'\x27:','choices':_0x160d41,'initial':_0x31038e>=0x0?_0x31038e:0x0});if(!_0x59251b['site'])return console[_0x454686(0x161)](_0x454686(0x167)),0x1;let _0x2f852f;if(_0x59251b[_0x454686(0x166)]===_0x454686(0x1a7)){const _0x180fb8=await a22_0x491e2b({'type':'text','name':'customSite','message':_0x454686(0x1c3),'initial':_0x454686(0x18d),'validate':_0x2295c9=>{const _0x4842fb=_0x454686;if(!_0x2295c9||!_0x2295c9['trim']())return'Site\x20name\x20cannot\x20be\x20empty';if(!/^[a-z0-9-]+$/[_0x4842fb(0x18a)](_0x2295c9[_0x4842fb(0x15d)]()))return _0x4842fb(0x19b);return!![];}});if(!_0x180fb8['customSite'])return console[_0x454686(0x161)](_0x454686(0x167)),0x1;_0x2f852f=_0x180fb8[_0x454686(0x1c5)];}else _0x2f852f=_0x59251b[_0x454686(0x166)];const _0x226cb7=resolveSite(_0x2f852f);console['log'](_0x454686(0x1bc)+_0x226cb7),console[_0x454686(0x161)]('You\x20can\x20find\x20your\x20API\x20key\x20at:'),console['log']('\x20\x20'+getConsoleUrl(_0x226cb7,_0x454686(0x15c)));const _0x25f272=await a22_0x491e2b({'type':_0x454686(0x169),'name':_0x454686(0x17d),'message':_0x454686(0x18e),'validate':_0x4bf01a=>{const _0x4c42eb=_0x454686;if(!_0x4bf01a||!_0x4bf01a[_0x4c42eb(0x15d)]())return _0x4c42eb(0x163);return!![];}});if(!_0x25f272[_0x454686(0x17d)])return console[_0x454686(0x161)](_0x454686(0x167)),0x1;const _0x2b68ef=_0x25f272[_0x454686(0x17d)];console[_0x454686(0x161)](_0x454686(0x14f));try{const _0x227ab6=TDX['create']({'site':_0x226cb7,'apiKey':_0x2b68ef['trim'](),'logLevel':_0x14dfe0['logLevel']??LogLevel[_0x454686(0x151)]}),_0x1be107=await _0x227ab6[_0x454686(0x191)][_0x454686(0x19f)]();console[_0x454686(0x161)](a22_0x3de91c[_0x454686(0x197)]('✓')+_0x454686(0x15f)+_0x1be107[_0x454686(0x1a1)]+')');const _0x51e526=await isKeychainAvailable();_0x51e526?(await saveAPIKeyAsync(_0x2b68ef[_0x454686(0x15d)](),_0x226cb7,_0x401076),console[_0x454686(0x161)](a22_0x3de91c[_0x454686(0x197)]('✓')+_0x454686(0x159)+_0x401076+')')):(console[_0x454686(0x1bb)](a22_0x3de91c['yellow'](_0x454686(0x195))),console[_0x454686(0x1bb)](a22_0x3de91c['yellow'](_0x454686(0x1ae))));const _0x3f2030={'site':_0x226cb7,..._0x42907d&&{'description':_0x42907d}};return saveProfileToUserConfig(_0x401076,_0x3f2030),console[_0x454686(0x161)](a22_0x3de91c[_0x454686(0x197)]('✓')+_0x454686(0x1ab)+_0x401076+_0x454686(0x1b1)),console[_0x454686(0x161)](),console[_0x454686(0x161)](_0x454686(0x1a5)),console[_0x454686(0x161)]('\x20\x20tdx\x20--profile\x20'+_0x401076+'\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication'),console[_0x454686(0x161)](_0x454686(0x19d)+_0x401076+_0x454686(0x1c6)),0x0;}catch(_0x555c74){if(_0x555c74 instanceof HTTPClientError&&_0x555c74['status']===0x191)return printAuthError(_0x555c74),0x1;return console[_0x454686(0x184)](a22_0x3de91c['red'](_0x454686(0x175)+(_0x555c74 instanceof Error?_0x555c74[_0x454686(0x1b5)]:String(_0x555c74)))),console[_0x454686(0x184)](_0x454686(0x1b8)),0x1;}}}export class ProfileRemoveCommand extends BaseCommand{[a22_0x5182e7(0x14c)]=a22_0x5182e7(0x185);[a22_0x5182e7(0x176)]=a22_0x5182e7(0x18c);[a22_0x5182e7(0x172)](_0x261b27){const _0x42feaa=a22_0x5182e7,{args:_0x1314dd}=_0x261b27;if(_0x1314dd[_0x42feaa(0x1bd)]===0x0)return'Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20remove\x20<name>';return undefined;}async[a22_0x5182e7(0x1b0)](_0x4ebb64){const _0x6657cc=a22_0x5182e7,{args:_0x4c0baa}=_0x4ebb64,_0x30f27a=_0x4c0baa[0x0];console[_0x6657cc(0x161)](a22_0x3de91c[_0x6657cc(0x15b)](_0x6657cc(0x16d)));if(!profileExists(_0x30f27a)){console['error'](a22_0x3de91c[_0x6657cc(0x16c)](_0x6657cc(0x171)+_0x30f27a+'\x27\x20does\x20not\x20exist.')),console['log']('\x0aAvailable\x20profiles:');const _0x4cd127=listProfiles();if(_0x4cd127[_0x6657cc(0x1bd)]===0x0)console[_0x6657cc(0x161)]('\x20\x20(no\x20profiles\x20found)');else for(const _0x2931fd of _0x4cd127){console[_0x6657cc(0x161)](_0x6657cc(0x14d)+_0x2931fd[_0x6657cc(0x14c)]);}return 0x1;}const _0x4e51a1=await a22_0x491e2b({'type':_0x6657cc(0x19e),'name':_0x6657cc(0x19e),'message':_0x6657cc(0x182)+_0x30f27a+'\x27?','initial':![]});if(!_0x4e51a1['confirm'])return console[_0x6657cc(0x161)]('Removal\x20cancelled'),0x0;try{removeProfileFromUserConfig(_0x30f27a),console['log'](a22_0x3de91c[_0x6657cc(0x197)]('✓')+_0x6657cc(0x1ab)+_0x30f27a+_0x6657cc(0x16b));}catch(_0x1f12d3){return console[_0x6657cc(0x184)](a22_0x3de91c[_0x6657cc(0x16c)]('Failed\x20to\x20remove\x20profile:\x20'+(_0x1f12d3 instanceof Error?_0x1f12d3['message']:String(_0x1f12d3)))),0x1;}const _0x20e114=await isKeychainAvailable();if(_0x20e114){const _0x3d2544=await deleteKeychainAPIKey(_0x30f27a);_0x3d2544&&console['log'](a22_0x3de91c[_0x6657cc(0x197)]('✓')+_0x6657cc(0x1a3));}return 0x0;}}export class ProfileSetCommand extends BaseCommand{['name']=a22_0x5182e7(0x1c4);['description']=a22_0x5182e7(0x150);static [a22_0x5182e7(0x1b9)]=['site',a22_0x5182e7(0x154),a22_0x5182e7(0x17c),a22_0x5182e7(0x17e),a22_0x5182e7(0x190),a22_0x5182e7(0x176)];['validate'](_0x5e3c5e){const _0x5c07e7=a22_0x5182e7,{args:_0x45d539,options:_0x18a65c}=_0x5e3c5e,_0x483a99=_0x18a65c['profile']||getActiveProfile();if(!_0x483a99)return _0x5c07e7(0x199);if(_0x45d539[_0x5c07e7(0x1bd)]===0x0)return _0x5c07e7(0x181)+ProfileSetCommand[_0x5c07e7(0x1b9)]['join'](',\x20');const _0x37dd1f=_0x45d539[0x0];if(!_0x37dd1f[_0x5c07e7(0x1a4)]('='))return _0x5c07e7(0x194)+ProfileSetCommand[_0x5c07e7(0x1b9)][_0x5c07e7(0x15a)](',\x20');const [_0x2f20c1]=_0x37dd1f[_0x5c07e7(0x173)]('=',0x2);if(!ProfileSetCommand[_0x5c07e7(0x1b9)][_0x5c07e7(0x1a4)](_0x2f20c1))return _0x5c07e7(0x1a6)+_0x2f20c1+'\x27.\x0a\x0aValid\x20keys:\x20'+ProfileSetCommand['VALID_KEYS']['join'](',\x20');return undefined;}async[a22_0x5182e7(0x1b0)](_0x2e9f20){const _0x2b5ed8=a22_0x5182e7,{args:_0x2395b4,options:_0x1a11d4}=_0x2e9f20,_0x20b2d6=_0x1a11d4[_0x2b5ed8(0x196)]||getActiveProfile(),[_0x113cff,..._0x5e2b7f]=_0x2395b4[0x0]['split']('='),_0x45e1ba=_0x5e2b7f['join']('=');console['log'](a22_0x3de91c[_0x2b5ed8(0x15b)](_0x2b5ed8(0x1aa)));if(!profileExists(_0x20b2d6)){const _0x236c48=await a22_0x491e2b({'type':'confirm','name':_0x2b5ed8(0x1b2),'message':_0x2b5ed8(0x171)+_0x20b2d6+_0x2b5ed8(0x1a9),'initial':!![]});if(!_0x236c48['create'])return console['log'](_0x2b5ed8(0x157)),0x1;}const _0x16ff3a=loadProfile(_0x20b2d6),_0x56eca1=_0x16ff3a?.[_0x2b5ed8(0x17b)]||{};if(_0x113cff===_0x2b5ed8(0x166)){const _0xe5f18f=resolveSite(_0x45e1ba);console[_0x2b5ed8(0x161)](_0x2b5ed8(0x174)+_0xe5f18f+_0x2b5ed8(0x1af)),console[_0x2b5ed8(0x161)](_0x2b5ed8(0x1c1)),console[_0x2b5ed8(0x161)]('\x20\x20'+getConsoleUrl(_0xe5f18f,_0x2b5ed8(0x15c)));const _0x495b5e=await a22_0x491e2b({'type':_0x2b5ed8(0x169),'name':_0x2b5ed8(0x17d),'message':_0x2b5ed8(0x16e),'validate':_0x1c912c=>{const _0x3e11bd=_0x2b5ed8;if(!_0x1c912c||!_0x1c912c['trim']())return _0x3e11bd(0x163);return!![];}});if(!_0x495b5e[_0x2b5ed8(0x17d)])return console[_0x2b5ed8(0x161)](_0x2b5ed8(0x193)),0x1;console[_0x2b5ed8(0x161)](_0x2b5ed8(0x14f));try{const _0x190c2b=TDX[_0x2b5ed8(0x1b2)]({'site':_0xe5f18f,'apiKey':_0x495b5e[_0x2b5ed8(0x17d)][_0x2b5ed8(0x15d)](),'logLevel':_0x1a11d4[_0x2b5ed8(0x15e)]??LogLevel['ERROR']}),_0x2827e6=await _0x190c2b[_0x2b5ed8(0x191)][_0x2b5ed8(0x19f)]();console[_0x2b5ed8(0x161)](a22_0x3de91c[_0x2b5ed8(0x197)]('✓')+'\x20API\x20key\x20is\x20valid\x20(User:\x20'+_0x2827e6[_0x2b5ed8(0x1a1)]+')');const _0x256f25=await isKeychainAvailable();_0x256f25?(await saveAPIKeyAsync(_0x495b5e[_0x2b5ed8(0x17d)]['trim'](),_0xe5f18f,_0x20b2d6),console[_0x2b5ed8(0x161)](a22_0x3de91c[_0x2b5ed8(0x197)]('✓')+_0x2b5ed8(0x152))):console['warn'](a22_0x3de91c[_0x2b5ed8(0x192)](_0x2b5ed8(0x195))),_0x56eca1[_0x2b5ed8(0x166)]=_0xe5f18f;}catch(_0x18b2f0){if(_0x18b2f0 instanceof HTTPClientError&&_0x18b2f0[_0x2b5ed8(0x1bf)]===0x191)return printAuthError(_0x18b2f0),0x1;return console['error'](a22_0x3de91c['red'](_0x2b5ed8(0x175)+(_0x18b2f0 instanceof Error?_0x18b2f0[_0x2b5ed8(0x1b5)]:String(_0x18b2f0)))),console[_0x2b5ed8(0x184)]('Site\x20was\x20not\x20changed.'),0x1;}}else _0x56eca1[_0x113cff]=_0x45e1ba||undefined;return saveProfileToUserConfig(_0x20b2d6,_0x56eca1),console[_0x2b5ed8(0x161)](a22_0x3de91c[_0x2b5ed8(0x197)]('✓')+_0x2b5ed8(0x1ab)+_0x20b2d6+_0x2b5ed8(0x1b4)+_0x113cff+'='+(_0x45e1ba||_0x2b5ed8(0x188))),0x0;}}export class ProfileUseCommand extends BaseCommand{[a22_0x5182e7(0x14c)]=a22_0x5182e7(0x1a8);[a22_0x5182e7(0x176)]=a22_0x5182e7(0x16f);[a22_0x5182e7(0x172)](_0x376051){const _0x39d0e7=a22_0x5182e7,{args:_0x325dd9}=_0x376051;if(_0x325dd9[_0x39d0e7(0x1bd)]===0x0)return _0x39d0e7(0x186);return undefined;}async[a22_0x5182e7(0x1b0)](_0x5d46e8){const _0x1c6493=a22_0x5182e7,{args:_0x437962,options:_0x456d0a}=_0x5d46e8,_0x3c4105=_0x437962[0x0];cleanExpiredSessions();if(!profileExists(_0x3c4105)){console[_0x1c6493(0x184)](a22_0x3de91c[_0x1c6493(0x16c)]('Profile\x20\x27'+_0x3c4105+_0x1c6493(0x187))),console[_0x1c6493(0x161)](_0x1c6493(0x162));const _0x1e85e4=listProfiles();if(_0x1e85e4['length']===0x0)console[_0x1c6493(0x161)]('\x20\x20(no\x20profiles\x20found)');else for(const _0x439feb of _0x1e85e4){console[_0x1c6493(0x161)](_0x1c6493(0x14d)+_0x439feb[_0x1c6493(0x14c)]);}return 0x1;}const _0x40160e=_0x456d0a[_0x1c6493(0x183)]||getCurrentSessionPID()[_0x1c6493(0x160)]();return saveSessionContext({'profile':_0x3c4105},_0x456d0a['session']),console[_0x1c6493(0x161)](_0x1c6493(0x1b6)+a22_0x3de91c[_0x1c6493(0x197)](_0x3c4105)+'\x20'+a22_0x3de91c[_0x1c6493(0x17a)](_0x1c6493(0x14e)+_0x40160e+')')),console[_0x1c6493(0x161)](a22_0x3de91c['dim']('\x0aTip:\x20Use\x20\x27tdx\x20use\x20--clear\x27\x20to\x20clear\x20session\x20overrides')),0x0;}}
1
+ const a22_0xe4c799=a22_0x112b;(function(_0x2b506c,_0x2d0013){const _0x8d9c6f=a22_0x112b,_0xe24089=_0x2b506c();while(!![]){try{const _0xa1a614=-parseInt(_0x8d9c6f(0x241))/0x1*(-parseInt(_0x8d9c6f(0x21b))/0x2)+-parseInt(_0x8d9c6f(0x22f))/0x3*(-parseInt(_0x8d9c6f(0x21d))/0x4)+parseInt(_0x8d9c6f(0x203))/0x5*(parseInt(_0x8d9c6f(0x246))/0x6)+parseInt(_0x8d9c6f(0x1d1))/0x7+parseInt(_0x8d9c6f(0x20e))/0x8+-parseInt(_0x8d9c6f(0x229))/0x9*(parseInt(_0x8d9c6f(0x1d0))/0xa)+parseInt(_0x8d9c6f(0x23c))/0xb*(-parseInt(_0x8d9c6f(0x204))/0xc);if(_0xa1a614===_0x2d0013)break;else _0xe24089['push'](_0xe24089['shift']());}catch(_0x1c7c88){_0xe24089['push'](_0xe24089['shift']());}}}(a22_0x28a2,0x2363d));import{BaseCommand,printAuthError}from'./command.js';import{listProfiles,profileExists,saveProfileToUserConfig,removeProfileFromUserConfig,loadProfile,getActiveProfile}from'../core/profile.js';import{saveSessionContext,getCurrentSessionPID,cleanExpiredSessions}from'../core/session.js';import{saveAPIKeyAsync,resolveSite}from'../core/config.js';import{getConsoleUrl}from'../sdk/client/endpoints.js';import{deleteKeychainAPIKey,isKeychainAvailable}from'../core/keychain.js';import{HTTPClientError}from'../sdk/client/http-client.js';function a22_0x28a2(){const _0x2ccc34=['(session:\x20','eu01','123730jxvCtD','1578563GtdEsJ','Site\x20was\x20not\x20changed.','bold','push','status','\x27\x20requires\x20API\x20key\x20validation.','ap02','Validating\x20API\x20key...','green','create','\x20API\x20key\x20saved\x20to\x20system\x20keychain\x20(profile:\x20','database','profile:set','execute','us01','Enter\x20your\x20TD\x20API\x20key:','API\x20key\x20cannot\x20be\x20empty','Remove\x20a\x20profile','\x20\x20tdx\x20--profile\x20','site','\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.','ERROR','length','test','\x27\x20already\x20exists.\x20Use\x20\x27tdx\x20profile\x20set\x27\x20to\x20modify\x20it.','Changing\x20site\x20to\x20\x27','text','Select\x20Treasure\x20Data\x20site\x20for\x20profile\x20\x27','warn','profile','tdx:\x20profile\x20set','Session\x20profile\x20set\x20to:\x20','\x20\x20-\x20','Enter\x20profile\x20name:','red','\x27\x20removed\x20from\x20configuration','Set\x20a\x20profile\x20configuration\x20value','jobs','ap02\x20-\x20Korea','llm_agent','\x20\x20(no\x20profiles\x20found)','config','Removal\x20cancelled','Profile\x20was\x20not\x20created.\x20Please\x20try\x20again.','log','VALID_KEYS','dim','apiKey','\x27\x20created','Operation\x20cancelled','515JdEXoZ','492zKkfGa','Failed\x20to\x20remove\x20profile:\x20','trim','\x0aAvailable\x20profiles:','yellow','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20use\x20<name>','/app/mp/ak','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','Profile\x20name\x20must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore','other','698040ZrDRzf','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20remove\x20<name>','Enter\x20your\x20TD\x20API\x20key\x20for\x20the\x20new\x20site:','\x27\x20updated:\x20','You\x20can\x20find\x20your\x20API\x20key\x20at:','\x27\x20does\x20not\x20exist.\x20Create\x20it?','split','getUserInfo','Enter\x20custom\x20site','Are\x20you\x20sure\x20you\x20want\x20to\x20remove\x20profile\x20\x27','name','\x20API\x20key\x20saved\x20to\x20system\x20keychain','Enter\x20site\x20name:','4226qgiZws','toString','513652JUZjWk','(cleared)','\x27\x20does\x20not\x20exist.','password','Set\x20session\x20profile','\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication','profileName','session','Profile\x20\x27','jp01','\x20API\x20key\x20is\x20valid\x20(User:\x20','Profile\x20name\x20cannot\x20be\x20empty','18zkAmgz','No\x20active\x20profile.\x20Use\x20--profile\x20flag\x20or\x20set\x20session\x20profile\x20with:\x20tdx\x20profile\x20use\x20<name>\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>','tdx:\x20profile\x20remove','Unknown\x20key\x20\x27','\x20Profile\x20\x27','email','3MxAtkh','\x0aSetting\x20up\x20authentication\x20for\x20site:\x20','value','\x27.\x0a\x0aValid\x20keys:\x20','message','confirm','\x20API\x20key\x20removed\x20from\x20system\x20keychain','✗\x20Validation\x20failed:\x20','Enter\x20description\x20(optional):','description','\x0aSetup\x20cancelled','profile:use','customSite','163361JsZhJh','error','profile:remove','join','\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases','27LKCpCP','llm_project','includes','eu\x20\x20\x20-\x20Europe','profile:create','16332OsrkrT','validate'];a22_0x28a2=function(){return _0x2ccc34;};return a22_0x28a2();}import{TDX}from'../sdk/index.js';function a22_0x112b(_0x368b28,_0x34cfbf){_0x368b28=_0x368b28-0x1ce;const _0x28a27d=a22_0x28a2();let _0x112b6f=_0x28a27d[_0x368b28];return _0x112b6f;}import{LogLevel}from'../utils/tdx-logger.js';import a22_0x42d5ce from'prompts';import a22_0x58cd07 from'chalk';export class ProfileCreateCommand extends BaseCommand{[a22_0xe4c799(0x218)]=a22_0xe4c799(0x245);['description']='Create\x20a\x20new\x20profile\x20interactively';async[a22_0xe4c799(0x1de)](_0x4c959e){const _0x544250=a22_0xe4c799,{options:_0x46fcb4}=_0x4c959e;console[_0x544250(0x1fd)](a22_0x58cd07['bold']('tdx:\x20profile\x20create'));const _0x117920=await a22_0x42d5ce({'type':_0x544250(0x1eb),'name':_0x544250(0x223),'message':_0x544250(0x1f2),'validate':_0x14bace=>{const _0x5d8d45=_0x544250;if(!_0x14bace||!_0x14bace[_0x5d8d45(0x206)]())return _0x5d8d45(0x228);if(!/^[a-zA-Z0-9_-]+$/[_0x5d8d45(0x1e8)](_0x14bace[_0x5d8d45(0x206)]()))return _0x5d8d45(0x20c);if(profileExists(_0x14bace[_0x5d8d45(0x206)]()))return _0x5d8d45(0x225)+_0x14bace[_0x5d8d45(0x206)]()+_0x5d8d45(0x1e9);return!![];}});if(!_0x117920['profileName'])return console[_0x544250(0x1fd)](_0x544250(0x239)),0x1;const _0x3916f0=_0x117920[_0x544250(0x223)][_0x544250(0x206)](),_0xa864b=await a22_0x42d5ce({'type':'text','name':'description','message':_0x544250(0x237)}),_0x372ff5=_0xa864b[_0x544250(0x238)]?.[_0x544250(0x206)]()||undefined,_0x33be68=_0x46fcb4['site']||_0x544250(0x1df),_0x8d3ef8=[{'title':'us\x20\x20\x20-\x20United\x20States','value':_0x544250(0x1df)},{'title':'jp\x20\x20\x20-\x20Japan','value':_0x544250(0x226)},{'title':_0x544250(0x244),'value':_0x544250(0x1cf)},{'title':_0x544250(0x1f7),'value':_0x544250(0x1d7)}];let _0x2d1a8b=_0x8d3ef8['findIndex'](_0x22c436=>_0x22c436[_0x544250(0x231)]===_0x33be68);_0x2d1a8b===-0x1&&_0x33be68!==_0x544250(0x1df)&&(_0x8d3ef8[_0x544250(0x1d4)]({'title':_0x33be68,'value':_0x33be68}),_0x2d1a8b=_0x8d3ef8[_0x544250(0x1e7)]-0x1);_0x8d3ef8[_0x544250(0x1d4)]({'title':_0x544250(0x216),'value':'other'});const _0x534f34=await a22_0x42d5ce({'type':'select','name':_0x544250(0x1e4),'message':_0x544250(0x1ec)+_0x3916f0+'\x27:','choices':_0x8d3ef8,'initial':_0x2d1a8b>=0x0?_0x2d1a8b:0x0});if(!_0x534f34[_0x544250(0x1e4)])return console['log'](_0x544250(0x239)),0x1;let _0x55911f;if(_0x534f34[_0x544250(0x1e4)]===_0x544250(0x20d)){const _0x43f636=await a22_0x42d5ce({'type':_0x544250(0x1eb),'name':_0x544250(0x23b),'message':_0x544250(0x21a),'initial':_0x544250(0x1df),'validate':_0x52949f=>{const _0x47b222=_0x544250;if(!_0x52949f||!_0x52949f[_0x47b222(0x206)]())return'Site\x20name\x20cannot\x20be\x20empty';if(!/^[a-z0-9-]+$/[_0x47b222(0x1e8)](_0x52949f[_0x47b222(0x206)]()))return'Site\x20name\x20must\x20contain\x20only\x20lowercase\x20letters,\x20numbers,\x20and\x20hyphens';return!![];}});if(!_0x43f636[_0x544250(0x23b)])return console[_0x544250(0x1fd)]('\x0aSetup\x20cancelled'),0x1;_0x55911f=_0x43f636[_0x544250(0x23b)];}else _0x55911f=_0x534f34[_0x544250(0x1e4)];const _0x3dfde2=resolveSite(_0x55911f);console['log'](_0x544250(0x230)+_0x3dfde2),console[_0x544250(0x1fd)](_0x544250(0x212)),console['log']('\x20\x20'+getConsoleUrl(_0x3dfde2,_0x544250(0x20a)));const _0xdb03a9=await a22_0x42d5ce({'type':'password','name':_0x544250(0x200),'message':_0x544250(0x1e0),'validate':_0x22e5ea=>{const _0x2b5bfc=_0x544250;if(!_0x22e5ea||!_0x22e5ea[_0x2b5bfc(0x206)]())return _0x2b5bfc(0x1e1);return!![];}});if(!_0xdb03a9['apiKey'])return console[_0x544250(0x1fd)]('\x0aSetup\x20cancelled'),0x1;const _0x2c4fce=_0xdb03a9[_0x544250(0x200)];console['log'](_0x544250(0x1d8));try{const _0xad1dcd=TDX[_0x544250(0x1da)]({'site':_0x3dfde2,'apiKey':_0x2c4fce[_0x544250(0x206)](),'logLevel':_0x46fcb4['logLevel']??LogLevel['ERROR']}),_0x593c1b=await _0xad1dcd['jobs'][_0x544250(0x215)]();console[_0x544250(0x1fd)](a22_0x58cd07[_0x544250(0x1d9)]('✓')+_0x544250(0x227)+_0x593c1b[_0x544250(0x22e)]+')');const _0x58038f=await isKeychainAvailable();_0x58038f?(await saveAPIKeyAsync(_0x2c4fce[_0x544250(0x206)](),_0x3dfde2,_0x3916f0),console['log'](a22_0x58cd07['green']('✓')+_0x544250(0x1db)+_0x3916f0+')')):(console[_0x544250(0x1ed)](a22_0x58cd07['yellow'](_0x544250(0x20b))),console[_0x544250(0x1ed)](a22_0x58cd07[_0x544250(0x208)](_0x544250(0x1e5))));const _0x4e16c3={'site':_0x3dfde2,..._0x372ff5&&{'description':_0x372ff5}};return saveProfileToUserConfig(_0x3916f0,_0x4e16c3),console[_0x544250(0x1fd)](a22_0x58cd07[_0x544250(0x1d9)]('✓')+_0x544250(0x22d)+_0x3916f0+_0x544250(0x201)),console[_0x544250(0x1fd)](),console[_0x544250(0x1fd)]('You\x20can\x20now\x20use\x20tdx\x20commands\x20with\x20this\x20profile.\x20Try:'),console[_0x544250(0x1fd)]('\x20\x20tdx\x20--profile\x20'+_0x3916f0+_0x544250(0x222)),console[_0x544250(0x1fd)](_0x544250(0x1e3)+_0x3916f0+_0x544250(0x240)),0x0;}catch(_0x2085a0){if(_0x2085a0 instanceof HTTPClientError&&_0x2085a0[_0x544250(0x1d5)]===0x191)return printAuthError(_0x2085a0),0x1;return console[_0x544250(0x23d)](a22_0x58cd07[_0x544250(0x1f3)](_0x544250(0x236)+(_0x2085a0 instanceof Error?_0x2085a0[_0x544250(0x233)]:String(_0x2085a0)))),console[_0x544250(0x23d)](_0x544250(0x1fc)),0x1;}}}export class ProfileRemoveCommand extends BaseCommand{[a22_0xe4c799(0x218)]=a22_0xe4c799(0x23e);[a22_0xe4c799(0x238)]=a22_0xe4c799(0x1e2);[a22_0xe4c799(0x247)](_0x3ec3cf){const _0x2cd063=a22_0xe4c799,{args:_0x449bda}=_0x3ec3cf;if(_0x449bda['length']===0x0)return _0x2cd063(0x20f);return undefined;}async['execute'](_0x3c0afc){const _0xdfc0ca=a22_0xe4c799,{args:_0x4146bc}=_0x3c0afc,_0x45122a=_0x4146bc[0x0];console[_0xdfc0ca(0x1fd)](a22_0x58cd07[_0xdfc0ca(0x1d3)](_0xdfc0ca(0x22b)));if(!profileExists(_0x45122a)){console[_0xdfc0ca(0x23d)](a22_0x58cd07[_0xdfc0ca(0x1f3)](_0xdfc0ca(0x225)+_0x45122a+_0xdfc0ca(0x21f))),console[_0xdfc0ca(0x1fd)]('\x0aAvailable\x20profiles:');const _0x58d540=listProfiles();if(_0x58d540[_0xdfc0ca(0x1e7)]===0x0)console[_0xdfc0ca(0x1fd)]('\x20\x20(no\x20profiles\x20found)');else for(const _0x2b6abb of _0x58d540){console[_0xdfc0ca(0x1fd)](_0xdfc0ca(0x1f1)+_0x2b6abb[_0xdfc0ca(0x218)]);}return 0x1;}const _0x215c2a=await a22_0x42d5ce({'type':'confirm','name':_0xdfc0ca(0x234),'message':_0xdfc0ca(0x217)+_0x45122a+'\x27?','initial':![]});if(!_0x215c2a['confirm'])return console[_0xdfc0ca(0x1fd)](_0xdfc0ca(0x1fb)),0x0;try{removeProfileFromUserConfig(_0x45122a),console[_0xdfc0ca(0x1fd)](a22_0x58cd07[_0xdfc0ca(0x1d9)]('✓')+'\x20Profile\x20\x27'+_0x45122a+_0xdfc0ca(0x1f4));}catch(_0x5cc178){return console[_0xdfc0ca(0x23d)](a22_0x58cd07[_0xdfc0ca(0x1f3)](_0xdfc0ca(0x205)+(_0x5cc178 instanceof Error?_0x5cc178['message']:String(_0x5cc178)))),0x1;}const _0x46048d=await isKeychainAvailable();if(_0x46048d){const _0x475778=await deleteKeychainAPIKey(_0x45122a);_0x475778&&console[_0xdfc0ca(0x1fd)](a22_0x58cd07[_0xdfc0ca(0x1d9)]('✓')+_0xdfc0ca(0x235));}return 0x0;}}export class ProfileSetCommand extends BaseCommand{[a22_0xe4c799(0x218)]=a22_0xe4c799(0x1dd);[a22_0xe4c799(0x238)]=a22_0xe4c799(0x1f5);static [a22_0xe4c799(0x1fe)]=[a22_0xe4c799(0x1e4),a22_0xe4c799(0x1dc),'parent_segment',a22_0xe4c799(0x242),a22_0xe4c799(0x1f8),a22_0xe4c799(0x238)];['validate'](_0x856e3d){const _0x2b8f21=a22_0xe4c799,{args:_0x415d2a,options:_0x3a0f45}=_0x856e3d,_0xeefa4=_0x3a0f45[_0x2b8f21(0x1ee)]||getActiveProfile();if(!_0xeefa4)return _0x2b8f21(0x22a);if(_0x415d2a['length']===0x0)return'Key=value\x20pair\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20'+ProfileSetCommand[_0x2b8f21(0x1fe)][_0x2b8f21(0x23f)](',\x20');const _0x3b608d=_0x415d2a[0x0];if(!_0x3b608d['includes']('='))return'Invalid\x20format.\x20Use:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20'+ProfileSetCommand[_0x2b8f21(0x1fe)][_0x2b8f21(0x23f)](',\x20');const [_0x5042fc]=_0x3b608d[_0x2b8f21(0x214)]('=',0x2);if(!ProfileSetCommand[_0x2b8f21(0x1fe)][_0x2b8f21(0x243)](_0x5042fc))return _0x2b8f21(0x22c)+_0x5042fc+_0x2b8f21(0x232)+ProfileSetCommand[_0x2b8f21(0x1fe)][_0x2b8f21(0x23f)](',\x20');return undefined;}async[a22_0xe4c799(0x1de)](_0x2a7152){const _0x3eca95=a22_0xe4c799,{args:_0x1a8a6c,options:_0x3381ab}=_0x2a7152,_0x3b6126=_0x3381ab[_0x3eca95(0x1ee)]||getActiveProfile(),[_0x22e329,..._0x1c359a]=_0x1a8a6c[0x0][_0x3eca95(0x214)]('='),_0x211829=_0x1c359a[_0x3eca95(0x23f)]('=');console['log'](a22_0x58cd07[_0x3eca95(0x1d3)](_0x3eca95(0x1ef)));if(!profileExists(_0x3b6126)){const _0x4e805b=await a22_0x42d5ce({'type':_0x3eca95(0x234),'name':'create','message':_0x3eca95(0x225)+_0x3b6126+_0x3eca95(0x213),'initial':!![]});if(!_0x4e805b[_0x3eca95(0x1da)])return console[_0x3eca95(0x1fd)](_0x3eca95(0x202)),0x1;}const _0x566930=loadProfile(_0x3b6126),_0x2f2ba4=_0x566930?.[_0x3eca95(0x1fa)]||{};if(_0x22e329===_0x3eca95(0x1e4)){const _0x52439d=resolveSite(_0x211829);console[_0x3eca95(0x1fd)](_0x3eca95(0x1ea)+_0x52439d+_0x3eca95(0x1d6)),console[_0x3eca95(0x1fd)]('\x0aYou\x20can\x20find\x20your\x20API\x20key\x20at:'),console['log']('\x20\x20'+getConsoleUrl(_0x52439d,_0x3eca95(0x20a)));const _0x36028c=await a22_0x42d5ce({'type':_0x3eca95(0x220),'name':'apiKey','message':_0x3eca95(0x210),'validate':_0x2af38d=>{const _0x455dcf=_0x3eca95;if(!_0x2af38d||!_0x2af38d['trim']())return _0x455dcf(0x1e1);return!![];}});if(!_0x36028c[_0x3eca95(0x200)])return console[_0x3eca95(0x1fd)]('\x0aOperation\x20cancelled'),0x1;console[_0x3eca95(0x1fd)](_0x3eca95(0x1d8));try{const _0x3f5811=TDX['create']({'site':_0x52439d,'apiKey':_0x36028c[_0x3eca95(0x200)]['trim'](),'logLevel':_0x3381ab['logLevel']??LogLevel[_0x3eca95(0x1e6)]}),_0x3d424c=await _0x3f5811[_0x3eca95(0x1f6)][_0x3eca95(0x215)]();console['log'](a22_0x58cd07[_0x3eca95(0x1d9)]('✓')+_0x3eca95(0x227)+_0x3d424c[_0x3eca95(0x22e)]+')');const _0x75d0f2=await isKeychainAvailable();_0x75d0f2?(await saveAPIKeyAsync(_0x36028c['apiKey']['trim'](),_0x52439d,_0x3b6126),console[_0x3eca95(0x1fd)](a22_0x58cd07[_0x3eca95(0x1d9)]('✓')+_0x3eca95(0x219))):console[_0x3eca95(0x1ed)](a22_0x58cd07[_0x3eca95(0x208)](_0x3eca95(0x20b))),_0x2f2ba4[_0x3eca95(0x1e4)]=_0x52439d;}catch(_0x230dea){if(_0x230dea instanceof HTTPClientError&&_0x230dea[_0x3eca95(0x1d5)]===0x191)return printAuthError(_0x230dea),0x1;return console[_0x3eca95(0x23d)](a22_0x58cd07[_0x3eca95(0x1f3)](_0x3eca95(0x236)+(_0x230dea instanceof Error?_0x230dea[_0x3eca95(0x233)]:String(_0x230dea)))),console[_0x3eca95(0x23d)](_0x3eca95(0x1d2)),0x1;}}else _0x2f2ba4[_0x22e329]=_0x211829||undefined;return saveProfileToUserConfig(_0x3b6126,_0x2f2ba4),console[_0x3eca95(0x1fd)](a22_0x58cd07[_0x3eca95(0x1d9)]('✓')+_0x3eca95(0x22d)+_0x3b6126+_0x3eca95(0x211)+_0x22e329+'='+(_0x211829||_0x3eca95(0x21e))),0x0;}}export class ProfileUseCommand extends BaseCommand{[a22_0xe4c799(0x218)]=a22_0xe4c799(0x23a);['description']=a22_0xe4c799(0x221);[a22_0xe4c799(0x247)](_0x156fa7){const _0x56fca9=a22_0xe4c799,{args:_0x3154f4}=_0x156fa7;if(_0x3154f4[_0x56fca9(0x1e7)]===0x0)return _0x56fca9(0x209);return undefined;}async[a22_0xe4c799(0x1de)](_0x52b4f1){const _0x502f3c=a22_0xe4c799,{args:_0xc27ae7,options:_0x41a5ef}=_0x52b4f1,_0x4532f0=_0xc27ae7[0x0];cleanExpiredSessions();if(!profileExists(_0x4532f0)){console[_0x502f3c(0x23d)](a22_0x58cd07[_0x502f3c(0x1f3)](_0x502f3c(0x225)+_0x4532f0+_0x502f3c(0x21f))),console['log'](_0x502f3c(0x207));const _0x12adea=listProfiles();if(_0x12adea['length']===0x0)console['log'](_0x502f3c(0x1f9));else for(const _0x2a5ae8 of _0x12adea){console[_0x502f3c(0x1fd)]('\x20\x20-\x20'+_0x2a5ae8['name']);}return 0x1;}const _0x517755=_0x41a5ef['session']||getCurrentSessionPID()[_0x502f3c(0x21c)]();return saveSessionContext({'profile':_0x4532f0},_0x41a5ef[_0x502f3c(0x224)]),console[_0x502f3c(0x1fd)](_0x502f3c(0x1f0)+a22_0x58cd07[_0x502f3c(0x1d9)](_0x4532f0)+'\x20'+a22_0x58cd07[_0x502f3c(0x1ff)](_0x502f3c(0x1ce)+_0x517755+')')),console[_0x502f3c(0x1fd)](a22_0x58cd07[_0x502f3c(0x1ff)]('\x0aTip:\x20Use\x20\x27tdx\x20use\x20--clear\x27\x20to\x20clear\x20session\x20overrides')),0x0;}}
@@ -1 +1 @@
1
- const a23_0x208e80=a23_0x33c8;function a23_0x33c8(_0x277638,_0x510dc3){_0x277638=_0x277638-0x12e;const _0xbe179e=a23_0xbe17();let _0x33c85c=_0xbe179e[_0x277638];return _0x33c85c;}function a23_0xbe17(){const _0x1358b4=['4IFKlZY','No\x20profiles\x20found.\x20Define\x20profiles\x20in\x20tdx.json:\x0a','execute','5902071BbMJRm','\x20\x20Global:\x20~/.config/tdx/tdx.json','5479976rlAcVE','scope','log','Error:\x20','11644312eXvPNk','3851676saQCeD','name','map','7224042ySCBHJ','message','config','error','325708Hpksnf','List\x20all\x20available\x20profiles','1617000oYDsdq','\x20\x20Local:\x20\x20(project\x20folder)/tdx.json','3gDCRHQ'];a23_0xbe17=function(){return _0x1358b4;};return a23_0xbe17();}(function(_0x3a9de0,_0x510b6b){const _0xc6ed07=a23_0x33c8,_0x4f778b=_0x3a9de0();while(!![]){try{const _0x120d1c=-parseInt(_0xc6ed07(0x131))/0x1*(parseInt(_0xc6ed07(0x136))/0x2)+-parseInt(_0xc6ed07(0x135))/0x3*(-parseInt(_0xc6ed07(0x13b))/0x4)+parseInt(_0xc6ed07(0x133))/0x5+-parseInt(_0xc6ed07(0x143))/0x6+-parseInt(_0xc6ed07(0x139))/0x7+parseInt(_0xc6ed07(0x13f))/0x8+parseInt(_0xc6ed07(0x140))/0x9;if(_0x120d1c===_0x510b6b)break;else _0x4f778b['push'](_0x4f778b['shift']());}catch(_0x433148){_0x4f778b['push'](_0x4f778b['shift']());}}}(a23_0xbe17,0xd66f1));import{BaseCommand}from'./command.js';import{listProfiles,getActiveProfile,getProfileParams}from'../core/profile.js';import{handleSDKOutput}from'../core/command-output.js';export class ProfilesCommand extends BaseCommand{[a23_0x208e80(0x141)]='profiles';['description']=a23_0x208e80(0x132);async[a23_0x208e80(0x138)](_0xe45749){const _0x4764c3=a23_0x208e80,{options:_0x8b11f6}=_0xe45749;try{const _0x5e90bd=listProfiles(),_0x626b75=getActiveProfile();if(_0x5e90bd['length']===0x0)return console[_0x4764c3(0x13d)](_0x4764c3(0x137)),console[_0x4764c3(0x13d)](_0x4764c3(0x134)),console[_0x4764c3(0x13d)](_0x4764c3(0x13a)),0x0;const _0x44b73e=_0x5e90bd[_0x4764c3(0x142)](_0x9b745=>{const _0x2af371=_0x4764c3,_0xba919e=_0x9b745['name']===_0x626b75,_0x42bec9=getProfileParams(_0x9b745[_0x2af371(0x12f)]);return{'name':_0x9b745[_0x2af371(0x141)],'active':_0xba919e,'scope':_0x9b745[_0x2af371(0x13c)],'description':_0x9b745['config']['description']||'','params':_0x42bec9};});return await handleSDKOutput(_0x44b73e,_0x8b11f6),0x0;}catch(_0x46a6dc){return _0x46a6dc instanceof Error&&console[_0x4764c3(0x130)](_0x4764c3(0x13e)+_0x46a6dc[_0x4764c3(0x12e)]),0x1;}}}
1
+ const a23_0x94739a=a23_0x5af3;function a23_0x5af3(_0x450d8a,_0x62edb2){_0x450d8a=_0x450d8a-0xe3;const _0x5482f3=a23_0x5482();let _0x5af3fd=_0x5482f3[_0x450d8a];return _0x5af3fd;}(function(_0x32d6f6,_0x4aad3c){const _0x14fa2f=a23_0x5af3,_0x70ee87=_0x32d6f6();while(!![]){try{const _0x843641=-parseInt(_0x14fa2f(0xec))/0x1+parseInt(_0x14fa2f(0xee))/0x2*(-parseInt(_0x14fa2f(0xfa))/0x3)+-parseInt(_0x14fa2f(0xf6))/0x4*(parseInt(_0x14fa2f(0xf0))/0x5)+-parseInt(_0x14fa2f(0xf2))/0x6*(parseInt(_0x14fa2f(0xe5))/0x7)+parseInt(_0x14fa2f(0xf3))/0x8*(-parseInt(_0x14fa2f(0xef))/0x9)+parseInt(_0x14fa2f(0xe6))/0xa*(-parseInt(_0x14fa2f(0xe8))/0xb)+parseInt(_0x14fa2f(0xed))/0xc*(parseInt(_0x14fa2f(0xe7))/0xd);if(_0x843641===_0x4aad3c)break;else _0x70ee87['push'](_0x70ee87['shift']());}catch(_0x4cc035){_0x70ee87['push'](_0x70ee87['shift']());}}}(a23_0x5482,0xefb97));import{BaseCommand}from'./command.js';import{listProfiles,getActiveProfile,getProfileParams}from'../core/profile.js';import{handleSDKOutput}from'../core/command-output.js';export class ProfilesCommand extends BaseCommand{['name']=a23_0x94739a(0xf9);[a23_0x94739a(0xf5)]=a23_0x94739a(0xf8);async['execute'](_0x583364){const _0x2b82cb=a23_0x94739a,{options:_0x3ba3e2}=_0x583364;try{const _0x3a7328=listProfiles(),_0x3702dc=getActiveProfile();if(_0x3a7328[_0x2b82cb(0xe4)]===0x0)return console[_0x2b82cb(0xf4)](_0x2b82cb(0xeb)),console['log'](_0x2b82cb(0xea)),console[_0x2b82cb(0xf4)](_0x2b82cb(0xe3)),0x0;const _0x5417ca=_0x3a7328['map'](_0x5028b2=>{const _0x42a223=_0x2b82cb,_0x5dc08=_0x5028b2[_0x42a223(0xe9)]===_0x3702dc,_0x3658ab=getProfileParams(_0x5028b2[_0x42a223(0xfb)]);return{'name':_0x5028b2[_0x42a223(0xe9)],'active':_0x5dc08,'scope':_0x5028b2[_0x42a223(0xf7)],'description':_0x5028b2['config'][_0x42a223(0xf5)]||'','params':_0x3658ab};});return await handleSDKOutput(_0x5417ca,_0x3ba3e2),0x0;}catch(_0x485782){return _0x485782 instanceof Error&&console['error'](_0x2b82cb(0xf1)+_0x485782['message']),0x1;}}}function a23_0x5482(){const _0x294a11=['645SACDzt','Error:\x20','2676ZtODLC','17488DfogJn','log','description','60020ZyFOam','scope','List\x20all\x20available\x20profiles','profiles','89769EaLGRq','config','\x20\x20Global:\x20~/.config/tdx/tdx.json','length','11823LVbIMx','20UYiiqP','39pRuyww','9662180niXWdO','name','\x20\x20Local:\x20\x20(project\x20folder)/tdx.json','No\x20profiles\x20found.\x20Define\x20profiles\x20in\x20tdx.json:\x0a','842677qPwcRV','32689572zrjknX','12pJuSPb','7092wzXuGW'];a23_0x5482=function(){return _0x294a11;};return a23_0x5482();}
@@ -1 +1 @@
1
- function a24_0x2914(_0x18ca9a,_0x1f2536){_0x18ca9a=_0x18ca9a-0x104;const _0x448f5d=a24_0x448f();let _0x29140d=_0x448f5d[_0x18ca9a];return _0x29140d;}function a24_0x448f(){const _0x3f1e61=['execute','processedRows','setExtra','...','elapsedTimeMillis','6AbISbH','Site:\x20','stats','options','\x20-\x20','completedSplits','catalog','information_schema','output','args','site','file','Catalog:\x20','description','Usage:\x20tdx\x20query\x20\x22SELECT\x20*\x20FROM\x20table\x22\x0a\x20\x20\x20or:\x20tdx\x20query\x20query.sql\x0a\x20\x20\x20or:\x20echo\x20\x22SELECT\x201\x22\x20|\x20tdx\x20query\x20-\x0a\x0aRun\x20\x27tdx\x20query\x20--help\x27\x20for\x20more\x20options','Executing\x20query\x20[','\x20splits','346869sEhrjf','Schema:\x20','No\x20SQL\x20provided','Error:\x20','push','totalSplits','18JmJPKN','6547912XRjDHW','Executing\x20statement\x20','error','data','Query\x20completed:\x20Processed\x20','message','length','3872250KpxDXC','44xExmQS','169405QUKHFD','246070IDPgeM','Cannot\x20specify\x20both\x20SQL\x20argument\x20and\x20--file\x20option','setPhase','\x20rows\x20','Statement\x20','\x20[Job\x20ID:\x20','17551520sdetYf','verbose','5105192GTuvqk','Run\x20Trino\x20queries\x20(streaming)','Executing\x20query...','originalMessage','jobId','join'];a24_0x448f=function(){return _0x3f1e61;};return a24_0x448f();}const a24_0x52288d=a24_0x2914;(function(_0x42b320,_0x29f4c9){const _0x353a97=a24_0x2914,_0x585335=_0x42b320();while(!![]){try{const _0x442e48=-parseInt(_0x353a97(0x119))/0x1*(-parseInt(_0x353a97(0x10f))/0x2)+-parseInt(_0x353a97(0x117))/0x3+parseInt(_0x353a97(0x118))/0x4*(parseInt(_0x353a97(0x11a))/0x5)+parseInt(_0x353a97(0x12d))/0x6*(-parseInt(_0x353a97(0x110))/0x7)+-parseInt(_0x353a97(0x122))/0x8+-parseInt(_0x353a97(0x109))/0x9+parseInt(_0x353a97(0x120))/0xa;if(_0x442e48===_0x29f4c9)break;else _0x585335['push'](_0x585335['shift']());}catch(_0x5eb2aa){_0x585335['push'](_0x585335['shift']());}}}(a24_0x448f,0xe0317));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';import{handleQueryOutput,formatQueryOutput,resolveOutputOptions}from'../core/command-output.js';import{readSqlStatementsFromFile,readSqlStatementsFromStdin,splitSqlStatements,isSqlFilePath}from'../sdk/query/sql-parser.js';import{writeFileSync}from'fs';import{withProgressSpinner,formatElapsed}from'../utils/spinner.js';import{formatRows}from'../sdk/util/formatters.js';export class QueryCommand extends BaseCommand{['name']='query';[a24_0x52288d(0x105)]=a24_0x52288d(0x123);async[a24_0x52288d(0x128)](_0x1fd85a){const _0x538b9e=a24_0x52288d,{options:_0x49e177,args:_0x42e327,tdx:_0x40fafa}=_0x1fd85a,_0x3ab029=_0x42e327[0x0],_0x201921=_0x49e177[_0x538b9e(0x138)];let _0x514d8d;try{if(_0x201921)_0x514d8d=readSqlStatementsFromFile(_0x201921);else{if(_0x3ab029==='-')_0x514d8d=await readSqlStatementsFromStdin();else{if(_0x3ab029&&isSqlFilePath(_0x3ab029))_0x514d8d=readSqlStatementsFromFile(_0x3ab029);else{if(_0x3ab029)_0x514d8d=splitSqlStatements(_0x3ab029);else throw new Error(_0x538b9e(0x10b));}}}}catch(_0x39e2b5){return console['error'](_0x538b9e(0x10c)+_0x39e2b5[_0x538b9e(0x115)]),0x1;}const _0x9ec93a=_0x49e177['database']||_0x538b9e(0x134),_0x165cad=_0x49e177[_0x538b9e(0x133)];try{const _0x3ea952=[],_0x116148=!!_0x49e177[_0x538b9e(0x135)];for(let _0x450d41=0x0;_0x450d41<_0x514d8d[_0x538b9e(0x116)];_0x450d41++){const _0x13149c=_0x514d8d[_0x450d41],_0x506430=_0x450d41+0x1,_0x1757f7=_0x514d8d[_0x538b9e(0x116)],_0x2f473b=_0x1757f7>0x1;_0x49e177['verbose']&&(console['error']('\x0a'+(_0x2f473b?_0x538b9e(0x11e)+_0x506430+'/'+_0x1757f7+':':'')),console[_0x538b9e(0x112)](_0x538b9e(0x12e)+_0x49e177[_0x538b9e(0x137)]),console['error'](_0x538b9e(0x104)+(_0x165cad||'td')),console[_0x538b9e(0x112)](_0x538b9e(0x10a)+_0x9ec93a),console['error']('SQL:\x20'+_0x13149c));const _0x3b6430=_0x2f473b?_0x538b9e(0x111)+_0x506430+'/'+_0x1757f7+_0x538b9e(0x12b):_0x538b9e(0x124);try{const _0x3d6b4e=await withProgressSpinner(_0x3b6430,async _0x536119=>{const _0x55b040=_0x538b9e,_0xa9e8d3=await _0x40fafa['query'][_0x55b040(0x128)](_0x13149c,{'catalog':_0x165cad,'schema':_0x9ec93a,'onJobId':_0x2588b0=>{_0x536119['setJobId'](_0x2588b0);},'onProgress':_0x312c18=>{const _0x4e0923=_0x55b040;_0x536119[_0x4e0923(0x11c)](_0x4e0923(0x107)+_0x312c18['state']+']'),_0x536119[_0x4e0923(0x12a)](formatRows(_0x312c18[_0x4e0923(0x129)])+'\x20rows\x20'+_0x312c18[_0x4e0923(0x132)]+'/'+_0x312c18[_0x4e0923(0x10e)]+_0x4e0923(0x108));}});return _0xa9e8d3;},{'verbose':_0x49e177[_0x538b9e(0x121)]}),_0x399ea5=_0x3d6b4e[_0x538b9e(0x113)],_0xf8521e=_0x399ea5[_0x538b9e(0x126)]?_0x538b9e(0x11f)+_0x399ea5[_0x538b9e(0x126)]+']':'',_0x5d817e=_0x2f473b?_0x538b9e(0x11e)+_0x506430+'/'+_0x1757f7+_0x538b9e(0x131):'';console[_0x538b9e(0x112)]('✔\x20'+_0x5d817e+_0x538b9e(0x114)+formatRows(_0x399ea5[_0x538b9e(0x12f)][_0x538b9e(0x129)])+_0x538b9e(0x11d)+('in\x20'+formatElapsed(_0x399ea5[_0x538b9e(0x12f)][_0x538b9e(0x12c)])+_0xf8521e));if(_0x2f473b&&_0x116148){const _0x290201=resolveOutputOptions(_0x49e177),_0x8cc183=await formatQueryOutput(_0x399ea5,_0x290201);_0x3ea952[_0x538b9e(0x10d)](_0x8cc183);}else await handleQueryOutput(_0x399ea5,_0x49e177);}catch(_0x26f11c){const _0x3556e0=_0x2f473b?_0x538b9e(0x11e)+_0x506430+'/'+_0x1757f7+':\x0a':'',_0x3bc7e8=_0x26f11c instanceof SDKError?_0x26f11c[_0x538b9e(0x125)]:_0x26f11c['message'];return console[_0x538b9e(0x112)](''+_0x3556e0+_0x3bc7e8),0x1;}}if(_0x514d8d[_0x538b9e(0x116)]>0x1&&_0x116148&&_0x3ea952[_0x538b9e(0x116)]>0x0){const _0x377ba2=_0x3ea952[_0x538b9e(0x127)]('\x0a');writeFileSync(_0x49e177['output'],_0x377ba2),console[_0x538b9e(0x112)]('\x0aAll\x20results\x20saved\x20to\x20'+_0x49e177[_0x538b9e(0x135)]);}return 0x0;}catch(_0x3d8a5c){throw _0x3d8a5c;}}['validate'](_0x6b0679){const _0x26b3a7=a24_0x52288d,_0x79eb2=_0x6b0679[_0x26b3a7(0x136)][0x0],_0x532c3=_0x6b0679[_0x26b3a7(0x130)]['file'];if(!_0x79eb2&&!_0x532c3)return _0x26b3a7(0x106);if(_0x79eb2&&_0x532c3)return _0x26b3a7(0x11b);return undefined;}}
1
+ const a24_0x333601=a24_0x51fe;(function(_0x1816e9,_0x49e4ee){const _0x354038=a24_0x51fe,_0x559855=_0x1816e9();while(!![]){try{const _0x55d43d=parseInt(_0x354038(0xd9))/0x1*(parseInt(_0x354038(0xb0))/0x2)+-parseInt(_0x354038(0xbe))/0x3*(-parseInt(_0x354038(0xc5))/0x4)+parseInt(_0x354038(0xc7))/0x5+-parseInt(_0x354038(0xc6))/0x6+parseInt(_0x354038(0xcb))/0x7+parseInt(_0x354038(0xd3))/0x8*(parseInt(_0x354038(0xb1))/0x9)+-parseInt(_0x354038(0xce))/0xa*(parseInt(_0x354038(0xd7))/0xb);if(_0x55d43d===_0x49e4ee)break;else _0x559855['push'](_0x559855['shift']());}catch(_0x208062){_0x559855['push'](_0x559855['shift']());}}}(a24_0x3d9d,0x309c5));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';import{handleQueryOutput,formatQueryOutput,resolveOutputOptions}from'../core/command-output.js';import{readSqlStatementsFromFile,readSqlStatementsFromStdin,splitSqlStatements,isSqlFilePath}from'../sdk/query/sql-parser.js';function a24_0x51fe(_0x15ac4d,_0x5325ed){_0x15ac4d=_0x15ac4d-0xa7;const _0x3d9d03=a24_0x3d9d();let _0x51fe4f=_0x3d9d03[_0x15ac4d];return _0x51fe4f;}import{writeFileSync}from'fs';function a24_0x3d9d(){const _0x23a56f=['Catalog:\x20','Executing\x20query...','elapsedTimeMillis','jobId','join','execute','Executing\x20query\x20[','...','Error:\x20','\x20rows\x20','information_schema','3iIXZog','file','Query\x20completed:\x20Processed\x20','verbose','query','Usage:\x20tdx\x20query\x20\x22SELECT\x20*\x20FROM\x20table\x22\x0a\x20\x20\x20or:\x20tdx\x20query\x20query.sql\x0a\x20\x20\x20or:\x20echo\x20\x22SELECT\x201\x22\x20|\x20tdx\x20query\x20-\x0a\x0aRun\x20\x27tdx\x20query\x20--help\x27\x20for\x20more\x20options','setExtra','670684fekbRA','1513566qQsSGO','38480OqXAqD','name','length','processedRows','2644411lFLQxM','\x20-\x20','setJobId','713530AnkKZv','message','site','completedSplits','SQL:\x20','393312wsmsjs','error','setPhase','Run\x20Trino\x20queries\x20(streaming)','33xbCZWK','totalSplits','625OxdYwe','\x0aAll\x20results\x20saved\x20to\x20','validate','Cannot\x20specify\x20both\x20SQL\x20argument\x20and\x20--file\x20option','No\x20SQL\x20provided','stats','options','state','output','database','Schema:\x20','Statement\x20','202SqcBwi','9PcRmBT','\x20splits'];a24_0x3d9d=function(){return _0x23a56f;};return a24_0x3d9d();}import{withProgressSpinner,formatElapsed}from'../utils/spinner.js';import{formatRows}from'../sdk/util/formatters.js';export class QueryCommand extends BaseCommand{[a24_0x333601(0xc8)]=a24_0x333601(0xc2);['description']=a24_0x333601(0xd6);async[a24_0x333601(0xb8)](_0x454d95){const _0x13382d=a24_0x333601,{options:_0x3c7d42,args:_0x36a18e,tdx:_0xdbead8}=_0x454d95,_0x478532=_0x36a18e[0x0],_0x1e35e1=_0x3c7d42[_0x13382d(0xbf)];let _0x5305ac;try{if(_0x1e35e1)_0x5305ac=readSqlStatementsFromFile(_0x1e35e1);else{if(_0x478532==='-')_0x5305ac=await readSqlStatementsFromStdin();else{if(_0x478532&&isSqlFilePath(_0x478532))_0x5305ac=readSqlStatementsFromFile(_0x478532);else{if(_0x478532)_0x5305ac=splitSqlStatements(_0x478532);else throw new Error(_0x13382d(0xa8));}}}}catch(_0x40e643){return console[_0x13382d(0xd4)](_0x13382d(0xbb)+_0x40e643[_0x13382d(0xcf)]),0x1;}const _0x4a7350=_0x3c7d42[_0x13382d(0xad)]||_0x13382d(0xbd),_0x2170d8=_0x3c7d42['catalog'];try{const _0x4ca2de=[],_0x4282d6=!!_0x3c7d42[_0x13382d(0xac)];for(let _0x186e73=0x0;_0x186e73<_0x5305ac['length'];_0x186e73++){const _0x2078b3=_0x5305ac[_0x186e73],_0x4a3db5=_0x186e73+0x1,_0x232b12=_0x5305ac[_0x13382d(0xc9)],_0x52c971=_0x232b12>0x1;_0x3c7d42['verbose']&&(console[_0x13382d(0xd4)]('\x0a'+(_0x52c971?'Statement\x20'+_0x4a3db5+'/'+_0x232b12+':':'')),console[_0x13382d(0xd4)]('Site:\x20'+_0x3c7d42[_0x13382d(0xd0)]),console['error'](_0x13382d(0xb3)+(_0x2170d8||'td')),console[_0x13382d(0xd4)](_0x13382d(0xae)+_0x4a7350),console[_0x13382d(0xd4)](_0x13382d(0xd2)+_0x2078b3));const _0x25cf74=_0x52c971?'Executing\x20statement\x20'+_0x4a3db5+'/'+_0x232b12+_0x13382d(0xba):_0x13382d(0xb4);try{const _0x3b873e=await withProgressSpinner(_0x25cf74,async _0x20802f=>{const _0x268b2c=_0x13382d,_0x12c3a3=await _0xdbead8[_0x268b2c(0xc2)]['execute'](_0x2078b3,{'catalog':_0x2170d8,'schema':_0x4a7350,'onJobId':_0x1e9be2=>{const _0x1ab26b=_0x268b2c;_0x20802f[_0x1ab26b(0xcd)](_0x1e9be2);},'onProgress':_0x4d2a95=>{const _0x4f8a5e=_0x268b2c;_0x20802f[_0x4f8a5e(0xd5)](_0x4f8a5e(0xb9)+_0x4d2a95[_0x4f8a5e(0xab)]+']'),_0x20802f[_0x4f8a5e(0xc4)](formatRows(_0x4d2a95[_0x4f8a5e(0xca)])+_0x4f8a5e(0xbc)+_0x4d2a95[_0x4f8a5e(0xd1)]+'/'+_0x4d2a95[_0x4f8a5e(0xd8)]+_0x4f8a5e(0xb2));}});return _0x12c3a3;},{'verbose':_0x3c7d42[_0x13382d(0xc1)]}),_0x461e29=_0x3b873e['data'],_0x425228=_0x461e29[_0x13382d(0xb6)]?'\x20[Job\x20ID:\x20'+_0x461e29['jobId']+']':'',_0x3e9932=_0x52c971?'Statement\x20'+_0x4a3db5+'/'+_0x232b12+_0x13382d(0xcc):'';console[_0x13382d(0xd4)]('✔\x20'+_0x3e9932+_0x13382d(0xc0)+formatRows(_0x461e29[_0x13382d(0xa9)][_0x13382d(0xca)])+_0x13382d(0xbc)+('in\x20'+formatElapsed(_0x461e29[_0x13382d(0xa9)][_0x13382d(0xb5)])+_0x425228));if(_0x52c971&&_0x4282d6){const _0x2cbbc1=resolveOutputOptions(_0x3c7d42),_0x14c84a=await formatQueryOutput(_0x461e29,_0x2cbbc1);_0x4ca2de['push'](_0x14c84a);}else await handleQueryOutput(_0x461e29,_0x3c7d42);}catch(_0x33cd61){const _0x558b82=_0x52c971?_0x13382d(0xaf)+_0x4a3db5+'/'+_0x232b12+':\x0a':'',_0x4d9e02=_0x33cd61 instanceof SDKError?_0x33cd61['originalMessage']:_0x33cd61[_0x13382d(0xcf)];return console[_0x13382d(0xd4)](''+_0x558b82+_0x4d9e02),0x1;}}if(_0x5305ac['length']>0x1&&_0x4282d6&&_0x4ca2de[_0x13382d(0xc9)]>0x0){const _0x22cb50=_0x4ca2de[_0x13382d(0xb7)]('\x0a');writeFileSync(_0x3c7d42[_0x13382d(0xac)],_0x22cb50),console[_0x13382d(0xd4)](_0x13382d(0xda)+_0x3c7d42['output']);}return 0x0;}catch(_0x5293ae){throw _0x5293ae;}}[a24_0x333601(0xdb)](_0x236893){const _0x201578=a24_0x333601,_0x39c73f=_0x236893['args'][0x0],_0x3912a=_0x236893[_0x201578(0xaa)][_0x201578(0xbf)];if(!_0x39c73f&&!_0x3912a)return _0x201578(0xc3);if(_0x39c73f&&_0x3912a)return _0x201578(0xa7);return undefined;}}
@@ -1 +1 @@
1
- const a25_0x4246ae=a25_0x1f50;(function(_0x63c028,_0x114f88){const _0x42b843=a25_0x1f50,_0x26620d=_0x63c028();while(!![]){try{const _0x4ab1c8=parseInt(_0x42b843(0x1e1))/0x1+-parseInt(_0x42b843(0x210))/0x2*(parseInt(_0x42b843(0x23b))/0x3)+-parseInt(_0x42b843(0x23e))/0x4+parseInt(_0x42b843(0x21f))/0x5+-parseInt(_0x42b843(0x206))/0x6+parseInt(_0x42b843(0x227))/0x7+-parseInt(_0x42b843(0x1ea))/0x8;if(_0x4ab1c8===_0x114f88)break;else _0x26620d['push'](_0x26620d['shift']());}catch(_0x39b90d){_0x26620d['push'](_0x26620d['shift']());}}}(a25_0x4c69,0x405d9));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,handleQueryOutput,handleSingleObjectOutput}from'../core/command-output.js';import{withSpinner,withProgressSpinner,formatElapsed}from'../utils/spinner.js';import{parseSegmentRef}from'../sdk/segment/segment-ref-parser.js';function a25_0x1f50(_0x183c38,_0x7c56ba){_0x183c38=_0x183c38-0x1bf;const _0x4c698e=a25_0x4c69();let _0x1f5032=_0x4c698e[_0x183c38];return _0x1f5032;}import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import{executeSchemaQuery}from'../sdk/segment/fields-display.js';import{isYamlFilePath,resolveYamlFilePath}from'../sdk/segment/segment-path-parser.js';import{getConsoleNextUrl}from'../sdk/client/endpoints.js';import{openBrowser}from'../utils/process.js';import a25_0x45d791 from'chalk';async function resolveSegmentTarget(_0x3ede79,_0x5659e1,_0x2ae4bb){const _0x361e6c=a25_0x1f50;if(isYamlFilePath(_0x3ede79))try{const _0xa7b488=await resolveYamlFilePath(_0x3ede79);return _0x2ae4bb&&(console[_0x361e6c(0x1d4)](_0x361e6c(0x1cf)+_0x3ede79),console[_0x361e6c(0x1d4)](_0x361e6c(0x1e6)+_0xa7b488[_0x361e6c(0x242)]),console[_0x361e6c(0x1d4)](_0x361e6c(0x201)+_0xa7b488[_0x361e6c(0x1d5)]),console[_0x361e6c(0x1d4)]('\x20\x20Folder\x20path:\x20'+(_0xa7b488[_0x361e6c(0x22d)]||_0x361e6c(0x1bf))),console[_0x361e6c(0x1d4)](_0x361e6c(0x23d)+_0xa7b488[_0x361e6c(0x24c)])),_0xa7b488[_0x361e6c(0x24c)];}catch(_0x43e5df){throw new SDKError(ErrorCode[_0x361e6c(0x241)],'Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20'+_0x43e5df[_0x361e6c(0x1f9)]);}if(!_0x5659e1)throw new SDKError(ErrorCode[_0x361e6c(0x241)],'No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22');return _0x5659e1+'/'+_0x3ede79;}export class SegmentDescribeCommand extends BaseCommand{[a25_0x4246ae(0x235)]=a25_0x4246ae(0x1d0);['description']='Show\x20segment\x20or\x20folder\x20details';async[a25_0x4246ae(0x23f)](_0x515232){const _0x580f08=a25_0x4246ae,{options:_0xce96d3,args:_0x59d6b2,tdx:_0x39b4fd}=_0x515232,_0x406f67=_0x59d6b2[0x0],_0x28cab7=!_0x406f67&&!!_0xce96d3[_0x580f08(0x242)],_0x454023=_0x406f67||_0xce96d3['parentSegment'];if(!_0x454023)return console['error'](_0x580f08(0x1d1)),console[_0x580f08(0x1d4)](_0x580f08(0x223)),console[_0x580f08(0x1d4)](_0x580f08(0x1eb)),console[_0x580f08(0x1d4)](_0x580f08(0x1ee)),console[_0x580f08(0x1d4)](_0x580f08(0x1e9)),console[_0x580f08(0x1d4)](_0x580f08(0x1ef)),console[_0x580f08(0x1d4)](_0x580f08(0x250)),0x1;try{const _0xd60dc8=_0xce96d3[_0x580f08(0x22b)];let _0x1b4d13=_0x454023;!_0x28cab7&&_0xd60dc8&&!_0x454023[_0x580f08(0x1ed)]('/')&&(_0x1b4d13=_0xd60dc8+'/'+_0x454023,_0xce96d3[_0x580f08(0x1c1)]&&console[_0x580f08(0x1d4)](_0x580f08(0x1d8)+_0x1b4d13));const _0x10707f=await withSpinner(_0x580f08(0x213)+_0x1b4d13+_0x580f08(0x249),()=>_0x39b4fd['segment'][_0x580f08(0x21d)](_0x1b4d13),{'verbose':_0xce96d3['verbose']}),_0x4bc907=_0x10707f[_0x580f08(0x238)];_0xce96d3[_0x580f08(0x1c1)]&&(console[_0x580f08(0x1d4)]('Resolved\x20type:\x20'+_0x4bc907['type']),console[_0x580f08(0x1d4)]('Parent\x20ID:\x20'+_0x4bc907[_0x580f08(0x20c)]),_0x4bc907[_0x580f08(0x251)]&&console['error'](_0x580f08(0x1da)+_0x4bc907[_0x580f08(0x251)]),_0x4bc907[_0x580f08(0x1e8)]&&console[_0x580f08(0x1d4)](_0x580f08(0x1d7)+_0x4bc907[_0x580f08(0x1e8)]));if(_0x4bc907['type']===_0x580f08(0x208)){const _0x263ba9=await withSpinner('Fetching\x20parent\x20segment\x20details...',()=>_0x39b4fd['segment'][_0x580f08(0x244)](_0x4bc907[_0x580f08(0x20c)]),{'verbose':_0xce96d3['verbose']});await handleSingleObjectOutput(_0x263ba9[_0x580f08(0x238)],_0xce96d3);}else{if(_0x4bc907['type']===_0x580f08(0x1e0)){if(!_0x4bc907[_0x580f08(0x251)])throw new SDKError(ErrorCode[_0x580f08(0x236)],_0x580f08(0x1f6));const _0xe2e65f=await withSpinner(_0x580f08(0x1f5),()=>_0x39b4fd[_0x580f08(0x1f1)][_0x580f08(0x248)](_0x4bc907[_0x580f08(0x251)]),{'verbose':_0xce96d3[_0x580f08(0x1c1)]});await handleSingleObjectOutput(_0xe2e65f[_0x580f08(0x238)],_0xce96d3);}else{if(_0x4bc907[_0x580f08(0x240)]===_0x580f08(0x1f1)){if(!_0x4bc907[_0x580f08(0x1e8)])throw new SDKError(ErrorCode[_0x580f08(0x24a)],_0x580f08(0x255));const _0x3d6484=await withSpinner(_0x580f08(0x257),()=>_0x39b4fd[_0x580f08(0x1f1)][_0x580f08(0x229)](_0x4bc907[_0x580f08(0x20c)],_0x4bc907[_0x580f08(0x1e8)]),{'verbose':_0xce96d3[_0x580f08(0x1c1)]});await handleSingleObjectOutput(_0x3d6484['data'],_0xce96d3);}}}return 0x0;}catch(_0x26f306){if(_0x26f306 instanceof SDKError)return console[_0x580f08(0x1d4)](_0x580f08(0x23c)+_0x26f306['message']),_0x26f306[_0x580f08(0x1d3)]&&console[_0x580f08(0x1d4)](_0x580f08(0x228)+_0x26f306['cause']),0x1;throw _0x26f306;}}}export class SegmentShowCommand extends BaseCommand{['name']=a25_0x4246ae(0x24f);[a25_0x4246ae(0x253)]=a25_0x4246ae(0x1d6);async[a25_0x4246ae(0x23f)](_0x3d3fe9){const _0x377309=a25_0x4246ae,{options:_0xbeb1a2,args:_0x46ab82,tdx:_0x233de1}=_0x3d3fe9,_0x288f20=_0x46ab82[0x0];if(!_0x288f20)return console[_0x377309(0x1d4)](_0x377309(0x1cd)),console[_0x377309(0x1d4)](_0x377309(0x246)),console['error'](_0x377309(0x20a)),console[_0x377309(0x1d4)](_0x377309(0x1eb)),console[_0x377309(0x1d4)](_0x377309(0x256)),console['error'](_0x377309(0x1f4)),0x1;try{const _0x2d6797=_0xbeb1a2['parentSegment'],_0x1faf09=await resolveSegmentTarget(_0x288f20,_0x2d6797,_0xbeb1a2[_0x377309(0x1c1)]);_0xbeb1a2[_0x377309(0x1c1)]&&console['error'](_0x377309(0x1dc)+_0x1faf09);const _0x4a3d84=await withSpinner('Resolving\x20\x27'+_0x288f20+_0x377309(0x249),()=>_0x233de1[_0x377309(0x1f1)][_0x377309(0x21d)](_0x1faf09),{'verbose':_0xbeb1a2[_0x377309(0x1c1)]}),_0x9333b7=_0x4a3d84['data'];_0xbeb1a2[_0x377309(0x1c1)]&&(console[_0x377309(0x1d4)](_0x377309(0x232)+_0x9333b7[_0x377309(0x240)]),console[_0x377309(0x1d4)]('Parent\x20ID:\x20'+_0x9333b7[_0x377309(0x20c)]));if(_0x9333b7[_0x377309(0x240)]===_0x377309(0x1e0))return console[_0x377309(0x1d4)](_0x377309(0x258)),console['error']('Use:\x20tdx\x20sg\x20view\x20<name>\x20\x20#\x20To\x20show\x20folder\x20details'),0x1;if(_0x9333b7[_0x377309(0x240)]===_0x377309(0x208))return console['error']('Error:\x20Cannot\x20execute\x20query\x20for\x20parent\x20segment\x20with\x20this\x20command.'),console['error'](_0x377309(0x224)),0x1;if(!_0x9333b7[_0x377309(0x1e8)])throw new SDKError(ErrorCode[_0x377309(0x24a)],_0x377309(0x255));const _0x33a5b0=await withSpinner(_0x377309(0x21c),()=>_0x233de1['segment'][_0x377309(0x233)](_0x9333b7[_0x377309(0x20c)],_0x9333b7[_0x377309(0x1e8)]),{'verbose':_0xbeb1a2[_0x377309(0x1c1)]});let _0x3c1e43=_0x33a5b0[_0x377309(0x238)];const _0x209ba6=resolveLimit(_0xbeb1a2[_0x377309(0x1e4)],DEFAULT_DISPLAY_LIMIT),_0xc79584=/\bLIMIT\s+\d+/i[_0x377309(0x234)](_0x3c1e43);!_0xc79584&&(_0x3c1e43=_0x3c1e43[_0x377309(0x24d)]()[_0x377309(0x21b)](/;+$/,''),_0x3c1e43='SELECT\x20*\x20FROM\x20(\x0a'+_0x3c1e43+_0x377309(0x20f)+_0x209ba6);_0xbeb1a2['verbose']&&console[_0x377309(0x1d4)](_0x377309(0x247)+_0x3c1e43);const _0x365bde=await withProgressSpinner(_0x377309(0x1fa),async _0x595621=>{const _0x1a8f03=_0x377309,_0x48eb9d=await _0x233de1['query'][_0x1a8f03(0x23f)](_0x3c1e43,{'catalog':'td','schema':_0x1a8f03(0x1f0),'onJobId':_0x8052e6=>{const _0x4e8fea=_0x1a8f03;_0x595621[_0x4e8fea(0x1c2)](_0x8052e6);}});return _0x48eb9d;},{'verbose':_0xbeb1a2[_0x377309(0x1c1)]}),_0x37b193=_0x365bde[_0x377309(0x238)],_0x3ba35b=_0x37b193[_0x377309(0x1c3)]?_0x377309(0x1fe)+_0x37b193['jobId']+']':'';return console[_0x377309(0x1d4)]('✔\x20Query\x20completed:\x20Processed\x20'+_0x37b193[_0x377309(0x23a)]['processedRows'][_0x377309(0x220)]()+'\x20rows\x20'+('in\x20'+formatElapsed(_0x37b193[_0x377309(0x23a)][_0x377309(0x1dd)])+_0x3ba35b)),await handleQueryOutput(_0x37b193,_0xbeb1a2),0x0;}catch(_0x5d0785){if(_0x5d0785 instanceof SDKError)return console[_0x377309(0x1d4)](_0x377309(0x221)+_0x5d0785[_0x377309(0x21a)]+']'),console[_0x377309(0x1d4)]('\x0a'+_0x5d0785[_0x377309(0x1f9)]),0x1;throw _0x5d0785;}}}export class SegmentFolderListCommand extends BaseCommand{[a25_0x4246ae(0x235)]='segment:folder:list';['description']=a25_0x4246ae(0x230);async[a25_0x4246ae(0x23f)](_0x39be57){const _0x41485d=a25_0x4246ae,{options:_0x30f42f,args:_0x3ecedc,tdx:_0x54c08a}=_0x39be57;if(_0x3ecedc[_0x41485d(0x1d9)]===0x0)return console[_0x41485d(0x1d4)](_0x41485d(0x1de)),console[_0x41485d(0x1d4)](_0x41485d(0x20e)),0x1;const _0x54a6f1=_0x3ecedc[0x0];try{_0x30f42f[_0x41485d(0x1c1)]&&(console['error'](_0x41485d(0x1e2)+_0x30f42f['site']),console[_0x41485d(0x1d4)](_0x41485d(0x1fc)+_0x54a6f1));const _0x22d8d0=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x54a6f1+'\x27...',()=>_0x54c08a[_0x41485d(0x1f1)][_0x41485d(0x1c7)](_0x54a6f1),{'verbose':_0x30f42f[_0x41485d(0x1c1)]}),_0x3c7e51=_0x22d8d0[_0x41485d(0x238)];_0x30f42f['verbose']&&console['error']('Resolved\x20parent\x20ID:\x20'+_0x3c7e51);const _0x1f53ef=await withSpinner(_0x41485d(0x1ff)+_0x54a6f1+_0x41485d(0x249),()=>_0x54c08a[_0x41485d(0x1f1)][_0x41485d(0x1f2)](_0x3c7e51),{'verbose':_0x30f42f[_0x41485d(0x1c1)]}),_0x5cd034=_0x1f53ef[_0x41485d(0x238)];return console[_0x41485d(0x1d4)]('✔\x20Found\x20'+_0x5cd034[_0x41485d(0x1d9)]+_0x41485d(0x237)+(_0x5cd034['length']!==0x1?'s':'')),await handleSDKOutput(_0x5cd034,_0x30f42f),0x0;}catch(_0x303e25){if(_0x303e25 instanceof SDKError)return console['error']('Error:\x20'+_0x303e25[_0x41485d(0x1f9)]),_0x303e25[_0x41485d(0x1d3)]&&console[_0x41485d(0x1d4)](_0x41485d(0x228)+_0x303e25['cause']),0x1;throw _0x303e25;}}}export class SegmentFolderShowCommand extends BaseCommand{['name']=a25_0x4246ae(0x1ce);[a25_0x4246ae(0x253)]=a25_0x4246ae(0x203);async['execute'](_0x1e4f97){const _0x1f669d=a25_0x4246ae,{options:_0x1df3cc,args:_0x1bb1c2,tdx:_0x2ae4e1}=_0x1e4f97;if(_0x1bb1c2['length']===0x0)return console['error'](_0x1f669d(0x1d2)),console['error'](_0x1f669d(0x22a)),0x1;try{const {parentId:_0x328a22,childId:_0x47855f}=parseSegmentRef(_0x1bb1c2[0x0]);_0x1df3cc[_0x1f669d(0x1c1)]&&(console[_0x1f669d(0x1d4)](_0x1f669d(0x1e2)+_0x1df3cc['site']),console[_0x1f669d(0x1d4)](_0x1f669d(0x1fc)+_0x328a22),_0x47855f&&console[_0x1f669d(0x1d4)](_0x1f669d(0x1db)+_0x47855f));if(!_0x47855f)return console['error']('Error:\x20Folder\x20name\x20is\x20required\x20(use\x20parent_name/folder_name\x20format)'),0x1;const _0x5ba873=await withSpinner(_0x1f669d(0x218)+_0x328a22+_0x1f669d(0x249),()=>_0x2ae4e1[_0x1f669d(0x1f1)][_0x1f669d(0x1c7)](_0x328a22),{'verbose':_0x1df3cc[_0x1f669d(0x1c1)]}),_0x1f55cf=_0x5ba873[_0x1f669d(0x238)];_0x1df3cc[_0x1f669d(0x1c1)]&&console[_0x1f669d(0x1d4)](_0x1f669d(0x207)+_0x1f55cf);const _0xb378db=await withSpinner(_0x1f669d(0x1e5)+_0x47855f+_0x1f669d(0x249),()=>_0x2ae4e1[_0x1f669d(0x1f1)][_0x1f669d(0x222)](_0x1f55cf,_0x47855f),{'verbose':_0x1df3cc['verbose']}),_0x467c73=_0xb378db['data'];_0x1df3cc[_0x1f669d(0x1c1)]&&console[_0x1f669d(0x1d4)](_0x1f669d(0x214)+_0x467c73);const _0x1ef682=await withSpinner(_0x1f669d(0x20d)+_0x47855f+_0x1f669d(0x249),()=>_0x2ae4e1['segment'][_0x1f669d(0x248)](_0x467c73),{'verbose':_0x1df3cc['verbose']});return await handleSDKOutput([_0x1ef682[_0x1f669d(0x238)]],_0x1df3cc),0x0;}catch(_0x3ee243){if(_0x3ee243 instanceof SDKError)return console[_0x1f669d(0x1d4)]('Error:\x20'+_0x3ee243[_0x1f669d(0x1f9)]),_0x3ee243[_0x1f669d(0x1d3)]&&console[_0x1f669d(0x1d4)](_0x1f669d(0x228)+_0x3ee243['cause']),0x1;throw _0x3ee243;}}}function a25_0x4c69(){const _0x39f498=['fullPath','trim','Use:\x20tdx\x20ps\x20view\x20-w','segment:show','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','folderId','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20sql\x20<path/to/segment.yml>','description','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20-w\x20\x20#\x20Open\x20segment\x20in\x20web\x20browser','Segment\x20ID\x20missing\x20from\x20resolved\x20path','\x20\x20tdx\x20sg\x20show\x20\x22Premium\x20Users\x22','Fetching\x20segment\x20details...','Error:\x20Cannot\x20execute\x20SQL\x20query\x20on\x20a\x20folder.','(root)','Usage:\x20tdx\x20sg\x20sql\x20<name>','verbose','setJobId','jobId','Get\x20SQL\x20query\x20for\x20child\x20segment','segment:folder:create','Parent\x20segment:\x20','resolveParentId','Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.','\x27\x20with\x20ID:\x20','jsonl','Error:\x20Cannot\x20open\x20folder\x20in\x20web\x20browser.\x20Use\x20a\x20segment\x20name\x20instead.','Error:\x20Cannot\x20show\x20schema\x20for\x20a\x20folder.','Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required','segment:folder:show','Resolved\x20YAML\x20file:\x20','segment:describe','Error:\x20Path\x20or\x20name\x20is\x20required','Error:\x20Folder\x20reference\x20is\x20required','cause','error','segmentName','Execute\x20child\x20segment\x20SQL\x20query\x20and\x20show\x20results','Segment\x20ID:\x20','Resolved\x20relative\x20path\x20to:\x20','length','Folder\x20ID:\x20','Folder\x20name:\x20','Target\x20path:\x20','elapsedTimeMillis','Error:\x20Parent\x20segment\x20name\x20is\x20required','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20view\x20<path/to/segment.yml>','folder','390540CCsfgC','Site:\x20','Error:\x20Parent\x20segment\x20name\x20and\x20folder\x20name\x20are\x20required','limit','Resolving\x20folder\x20\x27','\x20\x20Parent\x20segment:\x20','Show\x20folder\x20or\x20child\x20segment\x20details','segmentId','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience/Marketing/High\x20Value\x22','794360FqvaBv','Examples:','Error:\x20Cannot\x20view\x20parent\x20segment\x20details\x20with\x20this\x20command.','includes','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience\x22','\x20\x20tdx\x20segment\x20describe\x20\x22High\x20Value\x22\x20\x20\x20\x20#\x20Relative\x20to\x20current\x20context','information_schema','segment','listFolders','/app/ps/','\x20\x20tdx\x20sg\x20show\x20segments/my-audience/premium-users.yml','Fetching\x20folder\x20details...','Folder\x20ID\x20missing\x20from\x20resolved\x20path','\x20\x20-w,\x20--web\x20\x20Open\x20segment\x20in\x20web\x20browser','\x20\x20tdx\x20sg\x20view\x20segments/my-audience/premium-users.yml','message','Executing\x20segment\x20query...','\x20\x20tdx\x20sg\x20sql\x20segments/my-audience/premium-users.yml','Parent\x20name:\x20','Use:\x20tdx\x20ps\x20sql','\x20[Job\x20ID:\x20','Listing\x20folders\x20for\x20parent\x20\x27','Create\x20segment\x20folder\x20for\x20organization','\x20\x20Segment\x20name:\x20','\x20\x20tdx\x20sg\x20desc\x20segments/my-audience/premium-users.yml','Show\x20segment\x20folder\x20details','segment:sql','segment:desc','1052322mYGeFe','Resolved\x20parent\x20ID:\x20','parent','Error:\x20Cannot\x20get\x20SQL\x20query\x20for\x20a\x20folder.','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20show\x20<path/to/segment.yml>','format','parentId','Fetching\x20folder\x20\x27','Usage:\x20tdx\x20segment\x20folder\x20list\x20<parent_name>','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','791202ktrbgN','Show\x20child\x20segment\x20schema\x20(column\x20types)','Error:\x20Cannot\x20get\x20SQL\x20for\x20parent\x20segment\x20with\x20this\x20command.','Resolving\x20path\x20\x27','Resolved\x20folder\x20ID:\x20','Resolved\x20parent\x20folder\x20ID:\x20','log','cyan','Resolving\x20parent\x20segment\x20\x27','site','code','replace','Fetching\x20SQL\x20for\x20segment...','resolvePathToResource','parentFolder','1189400YtISoY','toLocaleString','✖\x20Query\x20failed\x20[','resolveFolderId','Usage:\x20tdx\x20segment\x20describe\x20<path>','Use:\x20tdx\x20ps\x20show','Parent\x20ID:\x20','Resolving\x20parent\x20folder\x20\x27','3065951CKDfFo','\x20\x20Cause:\x20','getSegment','Usage:\x20tdx\x20segment\x20folder\x20show\x20<parent_name/folder_name>','segmentPath','Usage:\x20tdx\x20segment\x20folder\x20create\x20<parent_name>\x20<folder_name>\x20[options]','folderPath','\x20\x20tdx\x20sg\x20view\x20\x22Marketing\x22\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20folder\x20details','✔\x20Created\x20folder\x20\x27','List\x20segment\x20folders\x20under\x20a\x20parent\x20segment','json','Resolved\x20type:\x20','getSegmentSQL','test','name','SEGMENT_FOLDER_NOT_FOUND','\x20folder','data','Usage:\x20tdx\x20sg\x20desc\x20<name>','stats','3mNpvNc','Error:\x20','\x20\x20Full\x20path:\x20','529956ChRSaj','execute','type','INVALID_ARGUMENT','parentSegment','/e/','getParent','Creating\x20folder\x20\x27','Usage:\x20tdx\x20sg\x20show\x20<name>','SQL\x20query:\x0a','getFolder','\x27...','SEGMENT_NOT_FOUND','Resolving\x20\x27'];a25_0x4c69=function(){return _0x39f498;};return a25_0x4c69();}export class SegmentSQLCommand extends BaseCommand{[a25_0x4246ae(0x235)]=a25_0x4246ae(0x204);[a25_0x4246ae(0x253)]=a25_0x4246ae(0x1c4);async[a25_0x4246ae(0x23f)](_0x19153a){const _0x202142=a25_0x4246ae,{options:_0x513a05,args:_0x2f0e5b,tdx:_0x469d0b}=_0x19153a,_0x43cf70=_0x2f0e5b[0x0];if(!_0x43cf70)return console['error'](_0x202142(0x1cd)),console[_0x202142(0x1d4)](_0x202142(0x1c0)),console['error'](_0x202142(0x252)),console[_0x202142(0x1d4)]('Examples:'),console['error']('\x20\x20tdx\x20sg\x20sql\x20\x22Premium\x20Users\x22'),console[_0x202142(0x1d4)](_0x202142(0x1fb)),0x1;try{const _0x46417b=_0x513a05[_0x202142(0x242)],_0x244447=await resolveSegmentTarget(_0x43cf70,_0x46417b,_0x513a05[_0x202142(0x1c1)]);_0x513a05[_0x202142(0x1c1)]&&console[_0x202142(0x1d4)](_0x202142(0x1dc)+_0x244447);const _0x10abc1=await withSpinner('Resolving\x20\x27'+_0x43cf70+'\x27...',()=>_0x469d0b[_0x202142(0x1f1)]['resolvePathToResource'](_0x244447),{'verbose':_0x513a05[_0x202142(0x1c1)]}),_0x48d72d=_0x10abc1[_0x202142(0x238)];_0x513a05[_0x202142(0x1c1)]&&(console['error'](_0x202142(0x232)+_0x48d72d[_0x202142(0x240)]),console['error'](_0x202142(0x225)+_0x48d72d[_0x202142(0x20c)]));if(_0x48d72d['type']===_0x202142(0x1e0))return console[_0x202142(0x1d4)](_0x202142(0x209)),console[_0x202142(0x1d4)](_0x202142(0x1c8)),0x1;if(_0x48d72d[_0x202142(0x240)]===_0x202142(0x208))return console[_0x202142(0x1d4)](_0x202142(0x212)),console['error'](_0x202142(0x1fd)),0x1;if(!_0x48d72d[_0x202142(0x1e8)])throw new SDKError(ErrorCode[_0x202142(0x24a)],_0x202142(0x255));const _0x3bc022=await withSpinner(_0x202142(0x21c),()=>_0x469d0b[_0x202142(0x1f1)]['getSegmentSQL'](_0x48d72d['parentId'],_0x48d72d['segmentId']),{'verbose':_0x513a05[_0x202142(0x1c1)]}),_0x13d6cb=_0x3bc022[_0x202142(0x238)];return _0x513a05[_0x202142(0x20b)]===_0x202142(0x231)||_0x513a05[_0x202142(0x20b)]===_0x202142(0x1ca)?await handleSDKOutput([{'sql':_0x13d6cb}],_0x513a05):console[_0x202142(0x216)](_0x13d6cb),0x0;}catch(_0x9f9a3a){if(_0x9f9a3a instanceof SDKError)return console[_0x202142(0x1d4)]('Error:\x20'+_0x9f9a3a[_0x202142(0x1f9)]),_0x9f9a3a[_0x202142(0x1d3)]&&console[_0x202142(0x1d4)](_0x202142(0x228)+_0x9f9a3a[_0x202142(0x1d3)]),0x1;throw _0x9f9a3a;}}}export class SegmentFolderCreateCommand extends BaseCommand{['name']=a25_0x4246ae(0x1c5);['description']=a25_0x4246ae(0x200);async[a25_0x4246ae(0x23f)](_0x4d92b4){const _0x591459=a25_0x4246ae,{options:_0x4860d7,args:_0x279463,tdx:_0xeefe7}=_0x4d92b4,_0x5ed111=_0x4860d7;if(_0x279463[_0x591459(0x1d9)]<0x2)return console[_0x591459(0x1d4)](_0x591459(0x1e3)),console['error'](_0x591459(0x22c)),0x1;const _0x2d9730=_0x279463[0x0],_0x1eb87f=_0x279463[0x1];_0x5ed111[_0x591459(0x1c1)]&&(console['error']('Site:\x20'+_0x5ed111[_0x591459(0x219)]),console[_0x591459(0x1d4)](_0x591459(0x1c6)+_0x2d9730),console['error']('Folder\x20name:\x20'+_0x1eb87f));let _0xa1db3f;if(_0x5ed111[_0x591459(0x21e)]){const _0x16fe3e=_0x5ed111[_0x591459(0x21e)],_0x2814bc=await withSpinner(_0x591459(0x218)+_0x2d9730+_0x591459(0x249),()=>_0xeefe7[_0x591459(0x1f1)]['resolveParentId'](_0x2d9730),{'verbose':_0x5ed111[_0x591459(0x1c1)]}),_0x4bd7a2=_0x2814bc['data'],_0x2efcfc=await withSpinner(_0x591459(0x226)+_0x16fe3e+_0x591459(0x249),()=>_0xeefe7[_0x591459(0x1f1)][_0x591459(0x222)](_0x4bd7a2,_0x16fe3e),{'verbose':_0x5ed111[_0x591459(0x1c1)]});_0xa1db3f=_0x2efcfc[_0x591459(0x238)],_0x5ed111[_0x591459(0x1c1)]&&console[_0x591459(0x1d4)](_0x591459(0x215)+_0xa1db3f);}const _0x1a0547={'name':_0x1eb87f,'description':_0x5ed111[_0x591459(0x253)],'parentFolderId':_0xa1db3f},_0x220cb8=await withSpinner(_0x591459(0x245)+_0x1eb87f+'\x27...',()=>_0xeefe7[_0x591459(0x1f1)]['createFolder'](_0x2d9730,_0x1a0547),{'verbose':_0x5ed111[_0x591459(0x1c1)]}),_0x5b26fa=_0x220cb8[_0x591459(0x238)];return console[_0x591459(0x1d4)](_0x591459(0x22f)+_0x5b26fa[_0x591459(0x235)]+_0x591459(0x1c9)+_0x5b26fa['id']),await handleSDKOutput([_0x5b26fa],_0x5ed111),0x0;}}export class SegmentViewCommand extends BaseCommand{[a25_0x4246ae(0x235)]='segment:view';[a25_0x4246ae(0x253)]=a25_0x4246ae(0x1e7);async[a25_0x4246ae(0x23f)](_0x1a2c5d){const _0x21f62f=a25_0x4246ae,{options:_0x678794,args:_0x1c02aa,tdx:_0x1738be}=_0x1a2c5d,_0x159c6d=_0x1c02aa[0x0];if(!_0x159c6d)return console[_0x21f62f(0x1d4)]('Error:\x20Folder\x20or\x20segment\x20name,\x20or\x20YAML\x20file\x20path\x20is\x20required'),console['error']('Usage:\x20tdx\x20sg\x20view\x20<name>\x20[-w]'),console[_0x21f62f(0x1d4)](_0x21f62f(0x1df)),console[_0x21f62f(0x1d4)]('Options:'),console[_0x21f62f(0x1d4)](_0x21f62f(0x1f7)),console[_0x21f62f(0x1d4)](_0x21f62f(0x1eb)),console['error'](_0x21f62f(0x22e)),console['error']('\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20\x20\x20\x20\x20#\x20View\x20child\x20segment\x20details'),console[_0x21f62f(0x1d4)](_0x21f62f(0x254)),console['error'](_0x21f62f(0x1f8)),0x1;try{const _0x3781d2=_0x678794[_0x21f62f(0x242)],_0xea61e6=await resolveSegmentTarget(_0x159c6d,_0x3781d2,_0x678794[_0x21f62f(0x1c1)]);_0x678794[_0x21f62f(0x1c1)]&&console[_0x21f62f(0x1d4)](_0x21f62f(0x1dc)+_0xea61e6);const _0x4e1137=await withSpinner(_0x21f62f(0x24b)+_0x159c6d+_0x21f62f(0x249),()=>_0x1738be[_0x21f62f(0x1f1)][_0x21f62f(0x21d)](_0xea61e6),{'verbose':_0x678794[_0x21f62f(0x1c1)]}),_0x25a559=_0x4e1137['data'];_0x678794[_0x21f62f(0x1c1)]&&(console['error'](_0x21f62f(0x232)+_0x25a559[_0x21f62f(0x240)]),console['error'](_0x21f62f(0x225)+_0x25a559[_0x21f62f(0x20c)]),_0x25a559[_0x21f62f(0x251)]&&console[_0x21f62f(0x1d4)](_0x21f62f(0x1da)+_0x25a559[_0x21f62f(0x251)]),_0x25a559[_0x21f62f(0x1e8)]&&console[_0x21f62f(0x1d4)]('Segment\x20ID:\x20'+_0x25a559[_0x21f62f(0x1e8)]));if(_0x678794['web']){if(_0x25a559['type']===_0x21f62f(0x1e0))return console[_0x21f62f(0x1d4)](_0x21f62f(0x1cb)),0x1;if(_0x25a559['type']==='parent')return console[_0x21f62f(0x1d4)]('Error:\x20Cannot\x20open\x20parent\x20segment\x20with\x20this\x20command.'),console[_0x21f62f(0x1d4)](_0x21f62f(0x24e)),0x1;if(!_0x25a559[_0x21f62f(0x1e8)])throw new SDKError(ErrorCode[_0x21f62f(0x24a)],_0x21f62f(0x255));const _0x3528b5=getConsoleNextUrl(_0x678794[_0x21f62f(0x219)],_0x21f62f(0x1f3)+_0x25a559['parentId']+_0x21f62f(0x243)+_0x25a559[_0x21f62f(0x1e8)]);return console['error'](a25_0x45d791['green']('✔')+'\x20Opening\x20'+a25_0x45d791[_0x21f62f(0x217)](_0x3528b5)),openBrowser(_0x3528b5),0x0;}if(_0x25a559['type']===_0x21f62f(0x1e0)){if(!_0x25a559['folderId'])throw new SDKError(ErrorCode['SEGMENT_FOLDER_NOT_FOUND'],_0x21f62f(0x1f6));const _0x357ba8=await withSpinner(_0x21f62f(0x1f5),()=>_0x1738be[_0x21f62f(0x1f1)][_0x21f62f(0x248)](_0x25a559[_0x21f62f(0x251)]),{'verbose':_0x678794['verbose']});await handleSingleObjectOutput(_0x357ba8[_0x21f62f(0x238)],_0x678794);}else{if(_0x25a559[_0x21f62f(0x240)]==='segment'){if(!_0x25a559[_0x21f62f(0x1e8)])throw new SDKError(ErrorCode[_0x21f62f(0x24a)],_0x21f62f(0x255));const _0x2288d9=await withSpinner(_0x21f62f(0x257),()=>_0x1738be[_0x21f62f(0x1f1)][_0x21f62f(0x229)](_0x25a559['parentId'],_0x25a559[_0x21f62f(0x1e8)]),{'verbose':_0x678794[_0x21f62f(0x1c1)]}),_0x596fb3=getConsoleNextUrl(_0x678794[_0x21f62f(0x219)],_0x21f62f(0x1f3)+_0x25a559['parentId']+_0x21f62f(0x243)+_0x25a559[_0x21f62f(0x1e8)]),_0x50a074=_0x2288d9[_0x21f62f(0x238)];_0x50a074['url']=_0x596fb3,await handleSingleObjectOutput(_0x50a074,_0x678794);}else return console[_0x21f62f(0x1d4)](_0x21f62f(0x1ec)),console[_0x21f62f(0x1d4)]('Use:\x20tdx\x20ps\x20view'),0x1;}return 0x0;}catch(_0x48fa01){if(_0x48fa01 instanceof SDKError)return console[_0x21f62f(0x1d4)](_0x21f62f(0x23c)+_0x48fa01[_0x21f62f(0x1f9)]),_0x48fa01[_0x21f62f(0x1d3)]&&console[_0x21f62f(0x1d4)](_0x21f62f(0x228)+_0x48fa01[_0x21f62f(0x1d3)]),0x1;throw _0x48fa01;}}}export const SegmentInfoCommand=SegmentViewCommand;export class SegmentDescCommand extends BaseCommand{['name']=a25_0x4246ae(0x205);['description']=a25_0x4246ae(0x211);async[a25_0x4246ae(0x23f)](_0x3b51a6){const _0x42d936=a25_0x4246ae,{options:_0x1d9a18,args:_0x419e43,tdx:_0x3fe953}=_0x3b51a6,_0x5329c9=_0x419e43[0x0];if(!_0x5329c9)return console['error'](_0x42d936(0x1cd)),console[_0x42d936(0x1d4)](_0x42d936(0x239)),console[_0x42d936(0x1d4)]('\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20desc\x20<path/to/segment.yml>'),console[_0x42d936(0x1d4)](_0x42d936(0x1eb)),console[_0x42d936(0x1d4)]('\x20\x20tdx\x20sg\x20desc\x20\x22Premium\x20Users\x22'),console[_0x42d936(0x1d4)](_0x42d936(0x202)),0x1;try{const _0x460f3f=_0x1d9a18['parentSegment'],_0x29f4b7=await resolveSegmentTarget(_0x5329c9,_0x460f3f,_0x1d9a18[_0x42d936(0x1c1)]);_0x1d9a18[_0x42d936(0x1c1)]&&console[_0x42d936(0x1d4)](_0x42d936(0x1dc)+_0x29f4b7);const _0x37da73=await withSpinner(_0x42d936(0x24b)+_0x5329c9+_0x42d936(0x249),()=>_0x3fe953[_0x42d936(0x1f1)][_0x42d936(0x21d)](_0x29f4b7),{'verbose':_0x1d9a18[_0x42d936(0x1c1)]}),_0x2872b4=_0x37da73[_0x42d936(0x238)];_0x1d9a18['verbose']&&(console['error'](_0x42d936(0x232)+_0x2872b4['type']),console[_0x42d936(0x1d4)](_0x42d936(0x225)+_0x2872b4[_0x42d936(0x20c)]));if(_0x2872b4[_0x42d936(0x240)]===_0x42d936(0x1e0))return console[_0x42d936(0x1d4)](_0x42d936(0x1cc)),console['error'](_0x42d936(0x1c8)),0x1;if(_0x2872b4['type']===_0x42d936(0x208))return console[_0x42d936(0x1d4)]('Error:\x20Cannot\x20show\x20schema\x20for\x20parent\x20segment\x20with\x20this\x20command.'),console[_0x42d936(0x1d4)]('Use:\x20tdx\x20ps\x20desc'),0x1;if(!_0x2872b4['segmentId'])throw new SDKError(ErrorCode[_0x42d936(0x24a)],_0x42d936(0x255));const _0x124fc4=await withSpinner(_0x42d936(0x21c),()=>_0x3fe953[_0x42d936(0x1f1)][_0x42d936(0x233)](_0x2872b4[_0x42d936(0x20c)],_0x2872b4[_0x42d936(0x1e8)]),{'verbose':_0x1d9a18['verbose']}),_0x52efd0=_0x124fc4[_0x42d936(0x238)],_0x16f472=await executeSchemaQuery(_0x52efd0,_0x3fe953,_0x1d9a18);return await handleQueryOutput(_0x16f472,_0x1d9a18),0x0;}catch(_0x43aed9){if(_0x43aed9 instanceof SDKError)return console['error'](_0x42d936(0x23c)+_0x43aed9[_0x42d936(0x1f9)]),_0x43aed9[_0x42d936(0x1d3)]&&console[_0x42d936(0x1d4)](_0x42d936(0x228)+_0x43aed9[_0x42d936(0x1d3)]),0x1;throw _0x43aed9;}}}
1
+ const a25_0x92b6e0=a25_0x57da;(function(_0x1e318a,_0x1e8838){const _0x15b409=a25_0x57da,_0x33a4ff=_0x1e318a();while(!![]){try{const _0x3c2305=parseInt(_0x15b409(0xd7))/0x1+parseInt(_0x15b409(0xd9))/0x2+parseInt(_0x15b409(0xf6))/0x3*(parseInt(_0x15b409(0x12e))/0x4)+parseInt(_0x15b409(0xdb))/0x5*(-parseInt(_0x15b409(0x10d))/0x6)+parseInt(_0x15b409(0x119))/0x7+-parseInt(_0x15b409(0xcd))/0x8*(-parseInt(_0x15b409(0x113))/0x9)+-parseInt(_0x15b409(0xcb))/0xa;if(_0x3c2305===_0x1e8838)break;else _0x33a4ff['push'](_0x33a4ff['shift']());}catch(_0x47f35f){_0x33a4ff['push'](_0x33a4ff['shift']());}}}(a25_0x44ae,0x4c000));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,handleQueryOutput,handleSingleObjectOutput}from'../core/command-output.js';import{withSpinner,withProgressSpinner,formatElapsed}from'../utils/spinner.js';import{parseSegmentRef}from'../sdk/segment/segment-ref-parser.js';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import{executeSchemaQuery}from'../sdk/segment/fields-display.js';import{isYamlFilePath,resolveYamlFilePath}from'../sdk/segment/segment-path-parser.js';import{getConsoleNextUrl}from'../sdk/client/endpoints.js';import{openBrowser}from'../utils/process.js';import a25_0x162192 from'chalk';async function resolveSegmentTarget(_0x5790c4,_0x4212db,_0x276d82){const _0x18151a=a25_0x57da;if(isYamlFilePath(_0x5790c4))try{const _0x2c7d8b=await resolveYamlFilePath(_0x5790c4);return _0x276d82&&(console[_0x18151a(0xec)]('Resolved\x20YAML\x20file:\x20'+_0x5790c4),console[_0x18151a(0xec)](_0x18151a(0x156)+_0x2c7d8b[_0x18151a(0xde)]),console[_0x18151a(0xec)]('\x20\x20Segment\x20name:\x20'+_0x2c7d8b[_0x18151a(0xf1)]),console[_0x18151a(0xec)](_0x18151a(0x13d)+(_0x2c7d8b[_0x18151a(0x139)]||_0x18151a(0x13b))),console[_0x18151a(0xec)](_0x18151a(0x149)+_0x2c7d8b[_0x18151a(0x12a)])),_0x2c7d8b[_0x18151a(0x12a)];}catch(_0xa1012){throw new SDKError(ErrorCode[_0x18151a(0xe0)],_0x18151a(0x13a)+_0xa1012['message']);}if(!_0x4212db)throw new SDKError(ErrorCode[_0x18151a(0xe0)],_0x18151a(0xda));return _0x4212db+'/'+_0x5790c4;}export class SegmentDescribeCommand extends BaseCommand{['name']=a25_0x92b6e0(0x153);['description']=a25_0x92b6e0(0x127);async[a25_0x92b6e0(0x12d)](_0x105d0b){const _0x4275f1=a25_0x92b6e0,{options:_0x350776,args:_0x4aa6c4,tdx:_0x29f5e7}=_0x105d0b,_0xf5d5cf=_0x4aa6c4[0x0],_0x263791=!_0xf5d5cf&&!!_0x350776[_0x4275f1(0xde)],_0x369d27=_0xf5d5cf||_0x350776['parentSegment'];if(!_0x369d27)return console['error']('Error:\x20Path\x20or\x20name\x20is\x20required'),console['error'](_0x4275f1(0xe4)),console[_0x4275f1(0xec)](_0x4275f1(0x158)),console[_0x4275f1(0xec)](_0x4275f1(0x11c)),console['error']('\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience/Marketing/High\x20Value\x22'),console[_0x4275f1(0xec)]('\x20\x20tdx\x20segment\x20describe\x20\x22High\x20Value\x22\x20\x20\x20\x20#\x20Relative\x20to\x20current\x20context'),console[_0x4275f1(0xec)]('\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>'),0x1;try{const _0x184047=_0x350776[_0x4275f1(0x13e)];let _0x4fcb45=_0x369d27;!_0x263791&&_0x184047&&!_0x369d27[_0x4275f1(0x11d)]('/')&&(_0x4fcb45=_0x184047+'/'+_0x369d27,_0x350776[_0x4275f1(0x136)]&&console[_0x4275f1(0xec)](_0x4275f1(0x152)+_0x4fcb45));const _0x2b612e=await withSpinner('Resolving\x20path\x20\x27'+_0x4fcb45+'\x27...',()=>_0x29f5e7[_0x4275f1(0xce)][_0x4275f1(0x161)](_0x4fcb45),{'verbose':_0x350776[_0x4275f1(0x136)]}),_0x34d2bd=_0x2b612e[_0x4275f1(0x142)];_0x350776['verbose']&&(console[_0x4275f1(0xec)](_0x4275f1(0xfb)+_0x34d2bd[_0x4275f1(0xdd)]),console[_0x4275f1(0xec)](_0x4275f1(0xf8)+_0x34d2bd[_0x4275f1(0xf3)]),_0x34d2bd[_0x4275f1(0xd2)]&&console[_0x4275f1(0xec)](_0x4275f1(0xf5)+_0x34d2bd['folderId']),_0x34d2bd[_0x4275f1(0xd5)]&&console[_0x4275f1(0xec)](_0x4275f1(0x11f)+_0x34d2bd[_0x4275f1(0xd5)]));if(_0x34d2bd['type']===_0x4275f1(0xe5)){const _0x165581=await withSpinner(_0x4275f1(0x128),()=>_0x29f5e7[_0x4275f1(0xce)][_0x4275f1(0x125)](_0x34d2bd[_0x4275f1(0xf3)]),{'verbose':_0x350776[_0x4275f1(0x136)]});await handleSingleObjectOutput(_0x165581[_0x4275f1(0x142)],_0x350776);}else{if(_0x34d2bd[_0x4275f1(0xdd)]==='folder'){if(!_0x34d2bd[_0x4275f1(0xd2)])throw new SDKError(ErrorCode['SEGMENT_FOLDER_NOT_FOUND'],_0x4275f1(0xf9));const _0x1f279=await withSpinner('Fetching\x20folder\x20details...',()=>_0x29f5e7[_0x4275f1(0xce)][_0x4275f1(0xed)](_0x34d2bd[_0x4275f1(0xd2)]),{'verbose':_0x350776[_0x4275f1(0x136)]});await handleSingleObjectOutput(_0x1f279[_0x4275f1(0x142)],_0x350776);}else{if(_0x34d2bd[_0x4275f1(0xdd)]===_0x4275f1(0xce)){if(!_0x34d2bd['segmentId'])throw new SDKError(ErrorCode[_0x4275f1(0x107)],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x27c37b=await withSpinner(_0x4275f1(0x11a),()=>_0x29f5e7[_0x4275f1(0xce)][_0x4275f1(0x140)](_0x34d2bd[_0x4275f1(0xf3)],_0x34d2bd[_0x4275f1(0xd5)]),{'verbose':_0x350776['verbose']});await handleSingleObjectOutput(_0x27c37b[_0x4275f1(0x142)],_0x350776);}}}return 0x0;}catch(_0x15d44c){if(_0x15d44c instanceof SDKError)return console[_0x4275f1(0xec)](_0x4275f1(0xd3)+_0x15d44c[_0x4275f1(0x133)]),_0x15d44c[_0x4275f1(0x121)]&&console['error'](_0x4275f1(0x13c)+_0x15d44c[_0x4275f1(0x121)]),0x1;throw _0x15d44c;}}}export class SegmentShowCommand extends BaseCommand{['name']=a25_0x92b6e0(0xe8);[a25_0x92b6e0(0x14a)]='Execute\x20child\x20segment\x20SQL\x20query\x20and\x20show\x20results';async[a25_0x92b6e0(0x12d)](_0x500256){const _0x401635=a25_0x92b6e0,{options:_0x32b244,args:_0x296cbc,tdx:_0x454a1b}=_0x500256,_0x3be064=_0x296cbc[0x0];if(!_0x3be064)return console[_0x401635(0xec)](_0x401635(0xe1)),console[_0x401635(0xec)](_0x401635(0x14b)),console[_0x401635(0xec)](_0x401635(0x100)),console['error']('Examples:'),console[_0x401635(0xec)](_0x401635(0x14c)),console[_0x401635(0xec)](_0x401635(0x160)),0x1;try{const _0x4fe32a=_0x32b244['parentSegment'],_0x1df9fd=await resolveSegmentTarget(_0x3be064,_0x4fe32a,_0x32b244['verbose']);_0x32b244[_0x401635(0x136)]&&console[_0x401635(0xec)]('Target\x20path:\x20'+_0x1df9fd);const _0x320cc5=await withSpinner('Resolving\x20\x27'+_0x3be064+_0x401635(0xef),()=>_0x454a1b[_0x401635(0xce)]['resolvePathToResource'](_0x1df9fd),{'verbose':_0x32b244[_0x401635(0x136)]}),_0x5ce9fc=_0x320cc5[_0x401635(0x142)];_0x32b244[_0x401635(0x136)]&&(console[_0x401635(0xec)](_0x401635(0xfb)+_0x5ce9fc[_0x401635(0xdd)]),console[_0x401635(0xec)](_0x401635(0xf8)+_0x5ce9fc[_0x401635(0xf3)]));if(_0x5ce9fc[_0x401635(0xdd)]==='folder')return console[_0x401635(0xec)](_0x401635(0x106)),console[_0x401635(0xec)](_0x401635(0x11b)),0x1;if(_0x5ce9fc['type']===_0x401635(0xe5))return console[_0x401635(0xec)](_0x401635(0x143)),console[_0x401635(0xec)](_0x401635(0x115)),0x1;if(!_0x5ce9fc['segmentId'])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x401635(0x15c));const _0x47bbca=await withSpinner(_0x401635(0xc8),()=>_0x454a1b[_0x401635(0xce)][_0x401635(0x157)](_0x5ce9fc[_0x401635(0xf3)],_0x5ce9fc['segmentId']),{'verbose':_0x32b244[_0x401635(0x136)]});let _0x43cab8=_0x47bbca['data'];const _0x1564a4=resolveLimit(_0x32b244[_0x401635(0x10f)],DEFAULT_DISPLAY_LIMIT),_0x281dcb=/\bLIMIT\s+\d+/i[_0x401635(0x132)](_0x43cab8);!_0x281dcb&&(_0x43cab8=_0x43cab8[_0x401635(0x122)]()['replace'](/;+$/,''),_0x43cab8=_0x401635(0x15b)+_0x43cab8+'\x0a)\x20AS\x20segment_query\x0aLIMIT\x20'+_0x1564a4);_0x32b244[_0x401635(0x136)]&&console['error']('SQL\x20query:\x0a'+_0x43cab8);const _0x25789a=await withProgressSpinner(_0x401635(0x126),async _0x2b8f0b=>{const _0x1b6eef=_0x401635,_0x39c181=await _0x454a1b[_0x1b6eef(0xdc)]['execute'](_0x43cab8,{'catalog':'td','schema':_0x1b6eef(0x159),'onJobId':_0x3987cf=>{const _0x16fb6c=_0x1b6eef;_0x2b8f0b[_0x16fb6c(0xc9)](_0x3987cf);}});return _0x39c181;},{'verbose':_0x32b244['verbose']}),_0x28b1ef=_0x25789a[_0x401635(0x142)],_0x29d1e0=_0x28b1ef[_0x401635(0x14f)]?_0x401635(0xf0)+_0x28b1ef[_0x401635(0x14f)]+']':'';return console[_0x401635(0xec)](_0x401635(0x10b)+_0x28b1ef[_0x401635(0xd0)][_0x401635(0x155)][_0x401635(0x15e)]()+_0x401635(0x11e)+(_0x401635(0x148)+formatElapsed(_0x28b1ef[_0x401635(0xd0)][_0x401635(0xfa)])+_0x29d1e0)),await handleQueryOutput(_0x28b1ef,_0x32b244),0x0;}catch(_0x1a4316){if(_0x1a4316 instanceof SDKError)return console[_0x401635(0xec)](_0x401635(0x14e)+_0x1a4316[_0x401635(0xcf)]+']'),console[_0x401635(0xec)]('\x0a'+_0x1a4316[_0x401635(0x133)]),0x1;throw _0x1a4316;}}}export class SegmentFolderListCommand extends BaseCommand{['name']=a25_0x92b6e0(0xd1);[a25_0x92b6e0(0x14a)]=a25_0x92b6e0(0xc7);async['execute'](_0x545c0f){const _0x150c33=a25_0x92b6e0,{options:_0x2d039d,args:_0x4014c2,tdx:_0x357751}=_0x545c0f;if(_0x4014c2[_0x150c33(0x12c)]===0x0)return console['error'](_0x150c33(0x13f)),console[_0x150c33(0xec)](_0x150c33(0x135)),0x1;const _0x1e5caa=_0x4014c2[0x0];try{_0x2d039d[_0x150c33(0x136)]&&(console['error'](_0x150c33(0xcc)+_0x2d039d[_0x150c33(0xe3)]),console[_0x150c33(0xec)](_0x150c33(0x14d)+_0x1e5caa));const _0x194c83=await withSpinner(_0x150c33(0x112)+_0x1e5caa+_0x150c33(0xef),()=>_0x357751[_0x150c33(0xce)]['resolveParentId'](_0x1e5caa),{'verbose':_0x2d039d[_0x150c33(0x136)]}),_0xddc9e1=_0x194c83[_0x150c33(0x142)];_0x2d039d[_0x150c33(0x136)]&&console[_0x150c33(0xec)](_0x150c33(0x146)+_0xddc9e1);const _0x41787b=await withSpinner(_0x150c33(0x10a)+_0x1e5caa+'\x27...',()=>_0x357751[_0x150c33(0xce)][_0x150c33(0x147)](_0xddc9e1),{'verbose':_0x2d039d['verbose']}),_0x49dfe4=_0x41787b[_0x150c33(0x142)];return console[_0x150c33(0xec)](_0x150c33(0x129)+_0x49dfe4[_0x150c33(0x12c)]+'\x20folder'+(_0x49dfe4[_0x150c33(0x12c)]!==0x1?'s':'')),await handleSDKOutput(_0x49dfe4,_0x2d039d),0x0;}catch(_0x29d1df){if(_0x29d1df instanceof SDKError)return console[_0x150c33(0xec)](_0x150c33(0xd3)+_0x29d1df[_0x150c33(0x133)]),_0x29d1df['cause']&&console[_0x150c33(0xec)](_0x150c33(0x13c)+_0x29d1df['cause']),0x1;throw _0x29d1df;}}}export class SegmentFolderShowCommand extends BaseCommand{[a25_0x92b6e0(0xf2)]=a25_0x92b6e0(0x108);[a25_0x92b6e0(0x14a)]=a25_0x92b6e0(0xf4);async['execute'](_0x263837){const _0x3e1248=a25_0x92b6e0,{options:_0x388e0c,args:_0x15fb48,tdx:_0x22a085}=_0x263837;if(_0x15fb48[_0x3e1248(0x12c)]===0x0)return console[_0x3e1248(0xec)](_0x3e1248(0xeb)),console['error']('Usage:\x20tdx\x20segment\x20folder\x20show\x20<parent_name/folder_name>'),0x1;try{const {parentId:_0x5558fd,childId:_0x113fcb}=parseSegmentRef(_0x15fb48[0x0]);_0x388e0c[_0x3e1248(0x136)]&&(console['error'](_0x3e1248(0xcc)+_0x388e0c[_0x3e1248(0xe3)]),console[_0x3e1248(0xec)](_0x3e1248(0x14d)+_0x5558fd),_0x113fcb&&console[_0x3e1248(0xec)]('Folder\x20name:\x20'+_0x113fcb));if(!_0x113fcb)return console[_0x3e1248(0xec)](_0x3e1248(0x138)),0x1;const _0x2df206=await withSpinner(_0x3e1248(0x112)+_0x5558fd+'\x27...',()=>_0x22a085[_0x3e1248(0xce)][_0x3e1248(0x15a)](_0x5558fd),{'verbose':_0x388e0c[_0x3e1248(0x136)]}),_0x24833c=_0x2df206['data'];_0x388e0c[_0x3e1248(0x136)]&&console[_0x3e1248(0xec)]('Resolved\x20parent\x20ID:\x20'+_0x24833c);const _0x1e145b=await withSpinner(_0x3e1248(0x114)+_0x113fcb+_0x3e1248(0xef),()=>_0x22a085[_0x3e1248(0xce)][_0x3e1248(0x151)](_0x24833c,_0x113fcb),{'verbose':_0x388e0c['verbose']}),_0x2eb054=_0x1e145b[_0x3e1248(0x142)];_0x388e0c[_0x3e1248(0x136)]&&console[_0x3e1248(0xec)](_0x3e1248(0xca)+_0x2eb054);const _0xd4ecfa=await withSpinner(_0x3e1248(0x103)+_0x113fcb+_0x3e1248(0xef),()=>_0x22a085[_0x3e1248(0xce)][_0x3e1248(0xed)](_0x2eb054),{'verbose':_0x388e0c['verbose']});return await handleSDKOutput([_0xd4ecfa[_0x3e1248(0x142)]],_0x388e0c),0x0;}catch(_0x5db435){if(_0x5db435 instanceof SDKError)return console['error'](_0x3e1248(0xd3)+_0x5db435[_0x3e1248(0x133)]),_0x5db435[_0x3e1248(0x121)]&&console[_0x3e1248(0xec)](_0x3e1248(0x13c)+_0x5db435[_0x3e1248(0x121)]),0x1;throw _0x5db435;}}}export class SegmentSQLCommand extends BaseCommand{[a25_0x92b6e0(0xf2)]='segment:sql';[a25_0x92b6e0(0x14a)]='Get\x20SQL\x20query\x20for\x20child\x20segment';async[a25_0x92b6e0(0x12d)](_0x4e9e78){const _0x2471e8=a25_0x92b6e0,{options:_0x5b4a88,args:_0xbd55ff,tdx:_0x4e9d44}=_0x4e9e78,_0x56505c=_0xbd55ff[0x0];if(!_0x56505c)return console['error'](_0x2471e8(0xe1)),console[_0x2471e8(0xec)]('Usage:\x20tdx\x20sg\x20sql\x20<name>'),console['error']('\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20sql\x20<path/to/segment.yml>'),console[_0x2471e8(0xec)]('Examples:'),console[_0x2471e8(0xec)](_0x2471e8(0xfe)),console[_0x2471e8(0xec)](_0x2471e8(0xfd)),0x1;try{const _0x38d3a7=_0x5b4a88[_0x2471e8(0xde)],_0x2bca37=await resolveSegmentTarget(_0x56505c,_0x38d3a7,_0x5b4a88[_0x2471e8(0x136)]);_0x5b4a88[_0x2471e8(0x136)]&&console[_0x2471e8(0xec)](_0x2471e8(0x131)+_0x2bca37);const _0x1b5af2=await withSpinner(_0x2471e8(0x141)+_0x56505c+'\x27...',()=>_0x4e9d44[_0x2471e8(0xce)][_0x2471e8(0x161)](_0x2bca37),{'verbose':_0x5b4a88[_0x2471e8(0x136)]}),_0x4c604c=_0x1b5af2['data'];_0x5b4a88[_0x2471e8(0x136)]&&(console[_0x2471e8(0xec)](_0x2471e8(0xfb)+_0x4c604c[_0x2471e8(0xdd)]),console[_0x2471e8(0xec)](_0x2471e8(0xf8)+_0x4c604c['parentId']));if(_0x4c604c[_0x2471e8(0xdd)]===_0x2471e8(0x134))return console[_0x2471e8(0xec)](_0x2471e8(0x104)),console['error']('Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.'),0x1;if(_0x4c604c[_0x2471e8(0xdd)]===_0x2471e8(0xe5))return console[_0x2471e8(0xec)](_0x2471e8(0xea)),console[_0x2471e8(0xec)]('Use:\x20tdx\x20ps\x20sql'),0x1;if(!_0x4c604c[_0x2471e8(0xd5)])throw new SDKError(ErrorCode[_0x2471e8(0x107)],_0x2471e8(0x15c));const _0x2aa413=await withSpinner(_0x2471e8(0xc8),()=>_0x4e9d44[_0x2471e8(0xce)][_0x2471e8(0x157)](_0x4c604c['parentId'],_0x4c604c[_0x2471e8(0xd5)]),{'verbose':_0x5b4a88[_0x2471e8(0x136)]}),_0x20badf=_0x2aa413[_0x2471e8(0x142)];return _0x5b4a88[_0x2471e8(0x109)]===_0x2471e8(0x130)||_0x5b4a88['format']===_0x2471e8(0xf7)?await handleSDKOutput([{'sql':_0x20badf}],_0x5b4a88):console[_0x2471e8(0x110)](_0x20badf),0x0;}catch(_0x5bc34d){if(_0x5bc34d instanceof SDKError)return console[_0x2471e8(0xec)](_0x2471e8(0xd3)+_0x5bc34d[_0x2471e8(0x133)]),_0x5bc34d[_0x2471e8(0x121)]&&console[_0x2471e8(0xec)](_0x2471e8(0x13c)+_0x5bc34d[_0x2471e8(0x121)]),0x1;throw _0x5bc34d;}}}export class SegmentFolderCreateCommand extends BaseCommand{[a25_0x92b6e0(0xf2)]='segment:folder:create';[a25_0x92b6e0(0x14a)]='Create\x20segment\x20folder\x20for\x20organization';async['execute'](_0x469d4b){const _0x1f9269=a25_0x92b6e0,{options:_0x1e83bb,args:_0x532dff,tdx:_0x5a56c9}=_0x469d4b,_0x3e0a17=_0x1e83bb;if(_0x532dff[_0x1f9269(0x12c)]<0x2)return console[_0x1f9269(0xec)]('Error:\x20Parent\x20segment\x20name\x20and\x20folder\x20name\x20are\x20required'),console['error'](_0x1f9269(0x120)),0x1;const _0x3fbe54=_0x532dff[0x0],_0x523065=_0x532dff[0x1];_0x3e0a17[_0x1f9269(0x136)]&&(console[_0x1f9269(0xec)](_0x1f9269(0xcc)+_0x3e0a17['site']),console[_0x1f9269(0xec)]('Parent\x20segment:\x20'+_0x3fbe54),console[_0x1f9269(0xec)](_0x1f9269(0x137)+_0x523065));let _0x1a34c6;if(_0x3e0a17[_0x1f9269(0x15f)]){const _0x2faa8e=_0x3e0a17[_0x1f9269(0x15f)],_0x35a256=await withSpinner(_0x1f9269(0x112)+_0x3fbe54+_0x1f9269(0xef),()=>_0x5a56c9[_0x1f9269(0xce)][_0x1f9269(0x15a)](_0x3fbe54),{'verbose':_0x3e0a17[_0x1f9269(0x136)]}),_0x4e4ce9=_0x35a256['data'],_0x123cc2=await withSpinner('Resolving\x20parent\x20folder\x20\x27'+_0x2faa8e+_0x1f9269(0xef),()=>_0x5a56c9[_0x1f9269(0xce)][_0x1f9269(0x151)](_0x4e4ce9,_0x2faa8e),{'verbose':_0x3e0a17[_0x1f9269(0x136)]});_0x1a34c6=_0x123cc2[_0x1f9269(0x142)],_0x3e0a17[_0x1f9269(0x136)]&&console[_0x1f9269(0xec)](_0x1f9269(0x117)+_0x1a34c6);}const _0x9ff41f={'name':_0x523065,'description':_0x3e0a17[_0x1f9269(0x14a)],'parentFolderId':_0x1a34c6},_0x12d042=await withSpinner(_0x1f9269(0x118)+_0x523065+_0x1f9269(0xef),()=>_0x5a56c9[_0x1f9269(0xce)]['createFolder'](_0x3fbe54,_0x9ff41f),{'verbose':_0x3e0a17[_0x1f9269(0x136)]}),_0xac43b0=_0x12d042['data'];return console[_0x1f9269(0xec)](_0x1f9269(0x105)+_0xac43b0[_0x1f9269(0xf2)]+_0x1f9269(0x116)+_0xac43b0['id']),await handleSDKOutput([_0xac43b0],_0x3e0a17),0x0;}}function a25_0x44ae(){const _0xbe4b1=['error','getFolder','Use:\x20tdx\x20ps\x20view\x20-w','\x27...','\x20[Job\x20ID:\x20','segmentName','name','parentId','Show\x20segment\x20folder\x20details','Folder\x20ID:\x20','3PZduTO','jsonl','Parent\x20ID:\x20','Folder\x20ID\x20missing\x20from\x20resolved\x20path','elapsedTimeMillis','Resolved\x20type:\x20','/app/ps/','\x20\x20tdx\x20sg\x20sql\x20segments/my-audience/premium-users.yml','\x20\x20tdx\x20sg\x20sql\x20\x22Premium\x20Users\x22','Fetching\x20folder\x20details...','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20show\x20<path/to/segment.yml>','Usage:\x20tdx\x20sg\x20desc\x20<name>','Use:\x20tdx\x20ps\x20view','Fetching\x20folder\x20\x27','Error:\x20Cannot\x20get\x20SQL\x20query\x20for\x20a\x20folder.','✔\x20Created\x20folder\x20\x27','Error:\x20Cannot\x20execute\x20SQL\x20query\x20on\x20a\x20folder.','SEGMENT_NOT_FOUND','segment:folder:show','format','Listing\x20folders\x20for\x20parent\x20\x27','✔\x20Query\x20completed:\x20Processed\x20','Options:','6AkDGMY','Error:\x20Cannot\x20open\x20parent\x20segment\x20with\x20this\x20command.','limit','log','SEGMENT_FOLDER_NOT_FOUND','Resolving\x20parent\x20segment\x20\x27','9bgRFZF','Resolving\x20folder\x20\x27','Use:\x20tdx\x20ps\x20show','\x27\x20with\x20ID:\x20','Resolved\x20parent\x20folder\x20ID:\x20','Creating\x20folder\x20\x27','679126sJWycN','Fetching\x20segment\x20details...','Use:\x20tdx\x20sg\x20view\x20<name>\x20\x20#\x20To\x20show\x20folder\x20details','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience\x22','includes','\x20rows\x20','Segment\x20ID:\x20','Usage:\x20tdx\x20segment\x20folder\x20create\x20<parent_name>\x20<folder_name>\x20[options]','cause','trim','\x20\x20tdx\x20sg\x20view\x20segments/my-audience/premium-users.yml','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20view\x20<path/to/segment.yml>','getParent','Executing\x20segment\x20query...','Show\x20segment\x20or\x20folder\x20details','Fetching\x20parent\x20segment\x20details...','✔\x20Found\x20','fullPath','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20-w\x20\x20#\x20Open\x20segment\x20in\x20web\x20browser','length','execute','2192412uVcRdK','\x20\x20tdx\x20sg\x20view\x20\x22Marketing\x22\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20folder\x20details','json','Target\x20path:\x20','test','message','folder','Usage:\x20tdx\x20segment\x20folder\x20list\x20<parent_name>','verbose','Folder\x20name:\x20','Error:\x20Folder\x20name\x20is\x20required\x20(use\x20parent_name/folder_name\x20format)','folderPath','Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20','(root)','\x20\x20Cause:\x20','\x20\x20Folder\x20path:\x20','segmentPath','Error:\x20Parent\x20segment\x20name\x20is\x20required','getSegment','Resolving\x20\x27','data','Error:\x20Cannot\x20execute\x20query\x20for\x20parent\x20segment\x20with\x20this\x20command.','cyan','Error:\x20Cannot\x20view\x20parent\x20segment\x20details\x20with\x20this\x20command.','Resolved\x20parent\x20ID:\x20','listFolders','in\x20','\x20\x20Full\x20path:\x20','description','Usage:\x20tdx\x20sg\x20show\x20<name>','\x20\x20tdx\x20sg\x20show\x20\x22Premium\x20Users\x22','Parent\x20name:\x20','✖\x20Query\x20failed\x20[','jobId','green','resolveFolderId','Resolved\x20relative\x20path\x20to:\x20','segment:describe','\x20\x20-w,\x20--web\x20\x20Open\x20segment\x20in\x20web\x20browser','processedRows','\x20\x20Parent\x20segment:\x20','getSegmentSQL','Examples:','information_schema','resolveParentId','SELECT\x20*\x20FROM\x20(\x0a','Segment\x20ID\x20missing\x20from\x20resolved\x20path','Error:\x20Cannot\x20show\x20schema\x20for\x20a\x20folder.','toLocaleString','parentFolder','\x20\x20tdx\x20sg\x20show\x20segments/my-audience/premium-users.yml','resolvePathToResource','List\x20segment\x20folders\x20under\x20a\x20parent\x20segment','Fetching\x20SQL\x20for\x20segment...','setJobId','Resolved\x20folder\x20ID:\x20','14546630qLyinm','Site:\x20','4535736oHbLUV','segment','code','stats','segment:folder:list','folderId','Error:\x20','segment:view','segmentId','Error:\x20Cannot\x20show\x20schema\x20for\x20parent\x20segment\x20with\x20this\x20command.','153216LAVpLb','\x20\x20tdx\x20sg\x20desc\x20\x22Premium\x20Users\x22','1040708ZQTDam','No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22','598495qOcZAy','query','type','parentSegment','Show\x20child\x20segment\x20schema\x20(column\x20types)','INVALID_ARGUMENT','Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required','/e/','site','Usage:\x20tdx\x20segment\x20describe\x20<path>','parent','Error:\x20Cannot\x20open\x20folder\x20in\x20web\x20browser.\x20Use\x20a\x20segment\x20name\x20instead.','web','segment:show','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20\x20\x20\x20\x20#\x20View\x20child\x20segment\x20details','Error:\x20Cannot\x20get\x20SQL\x20for\x20parent\x20segment\x20with\x20this\x20command.','Error:\x20Folder\x20reference\x20is\x20required'];a25_0x44ae=function(){return _0xbe4b1;};return a25_0x44ae();}function a25_0x57da(_0x2f8de9,_0x340ce7){_0x2f8de9=_0x2f8de9-0xc7;const _0x44ae92=a25_0x44ae();let _0x57dae3=_0x44ae92[_0x2f8de9];return _0x57dae3;}export class SegmentViewCommand extends BaseCommand{[a25_0x92b6e0(0xf2)]=a25_0x92b6e0(0xd4);[a25_0x92b6e0(0x14a)]='Show\x20folder\x20or\x20child\x20segment\x20details';async[a25_0x92b6e0(0x12d)](_0x35cf00){const _0x3f61d4=a25_0x92b6e0,{options:_0x4af666,args:_0x3456ea,tdx:_0xe7cca3}=_0x35cf00,_0x24509c=_0x3456ea[0x0];if(!_0x24509c)return console['error']('Error:\x20Folder\x20or\x20segment\x20name,\x20or\x20YAML\x20file\x20path\x20is\x20required'),console[_0x3f61d4(0xec)]('Usage:\x20tdx\x20sg\x20view\x20<name>\x20[-w]'),console['error'](_0x3f61d4(0x124)),console[_0x3f61d4(0xec)](_0x3f61d4(0x10c)),console[_0x3f61d4(0xec)](_0x3f61d4(0x154)),console[_0x3f61d4(0xec)](_0x3f61d4(0x158)),console[_0x3f61d4(0xec)](_0x3f61d4(0x12f)),console[_0x3f61d4(0xec)](_0x3f61d4(0xe9)),console['error'](_0x3f61d4(0x12b)),console[_0x3f61d4(0xec)](_0x3f61d4(0x123)),0x1;try{const _0x5c9ea1=_0x4af666['parentSegment'],_0x44a715=await resolveSegmentTarget(_0x24509c,_0x5c9ea1,_0x4af666['verbose']);_0x4af666[_0x3f61d4(0x136)]&&console['error']('Target\x20path:\x20'+_0x44a715);const _0x3e2faa=await withSpinner(_0x3f61d4(0x141)+_0x24509c+_0x3f61d4(0xef),()=>_0xe7cca3[_0x3f61d4(0xce)][_0x3f61d4(0x161)](_0x44a715),{'verbose':_0x4af666[_0x3f61d4(0x136)]}),_0x2feb8b=_0x3e2faa['data'];_0x4af666[_0x3f61d4(0x136)]&&(console['error']('Resolved\x20type:\x20'+_0x2feb8b[_0x3f61d4(0xdd)]),console[_0x3f61d4(0xec)](_0x3f61d4(0xf8)+_0x2feb8b[_0x3f61d4(0xf3)]),_0x2feb8b[_0x3f61d4(0xd2)]&&console[_0x3f61d4(0xec)]('Folder\x20ID:\x20'+_0x2feb8b[_0x3f61d4(0xd2)]),_0x2feb8b['segmentId']&&console['error'](_0x3f61d4(0x11f)+_0x2feb8b['segmentId']));if(_0x4af666[_0x3f61d4(0xe7)]){if(_0x2feb8b['type']==='folder')return console[_0x3f61d4(0xec)](_0x3f61d4(0xe6)),0x1;if(_0x2feb8b[_0x3f61d4(0xdd)]===_0x3f61d4(0xe5))return console[_0x3f61d4(0xec)](_0x3f61d4(0x10e)),console['error'](_0x3f61d4(0xee)),0x1;if(!_0x2feb8b['segmentId'])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x3f61d4(0x15c));const _0x5b073e=getConsoleNextUrl(_0x4af666[_0x3f61d4(0xe3)],'/app/ps/'+_0x2feb8b[_0x3f61d4(0xf3)]+'/e/'+_0x2feb8b[_0x3f61d4(0xd5)]);return console[_0x3f61d4(0xec)](a25_0x162192[_0x3f61d4(0x150)]('✔')+'\x20Opening\x20'+a25_0x162192[_0x3f61d4(0x144)](_0x5b073e)),openBrowser(_0x5b073e),0x0;}if(_0x2feb8b['type']===_0x3f61d4(0x134)){if(!_0x2feb8b['folderId'])throw new SDKError(ErrorCode[_0x3f61d4(0x111)],_0x3f61d4(0xf9));const _0x33beab=await withSpinner(_0x3f61d4(0xff),()=>_0xe7cca3[_0x3f61d4(0xce)]['getFolder'](_0x2feb8b[_0x3f61d4(0xd2)]),{'verbose':_0x4af666[_0x3f61d4(0x136)]});await handleSingleObjectOutput(_0x33beab[_0x3f61d4(0x142)],_0x4af666);}else{if(_0x2feb8b[_0x3f61d4(0xdd)]===_0x3f61d4(0xce)){if(!_0x2feb8b['segmentId'])throw new SDKError(ErrorCode[_0x3f61d4(0x107)],_0x3f61d4(0x15c));const _0x4e431f=await withSpinner(_0x3f61d4(0x11a),()=>_0xe7cca3[_0x3f61d4(0xce)]['getSegment'](_0x2feb8b[_0x3f61d4(0xf3)],_0x2feb8b[_0x3f61d4(0xd5)]),{'verbose':_0x4af666['verbose']}),_0x4c80f1=getConsoleNextUrl(_0x4af666[_0x3f61d4(0xe3)],_0x3f61d4(0xfc)+_0x2feb8b[_0x3f61d4(0xf3)]+_0x3f61d4(0xe2)+_0x2feb8b[_0x3f61d4(0xd5)]),_0x1af423=_0x4e431f[_0x3f61d4(0x142)];_0x1af423['url']=_0x4c80f1,await handleSingleObjectOutput(_0x1af423,_0x4af666);}else return console[_0x3f61d4(0xec)](_0x3f61d4(0x145)),console[_0x3f61d4(0xec)](_0x3f61d4(0x102)),0x1;}return 0x0;}catch(_0x3a927f){if(_0x3a927f instanceof SDKError)return console[_0x3f61d4(0xec)](_0x3f61d4(0xd3)+_0x3a927f[_0x3f61d4(0x133)]),_0x3a927f[_0x3f61d4(0x121)]&&console[_0x3f61d4(0xec)](_0x3f61d4(0x13c)+_0x3a927f[_0x3f61d4(0x121)]),0x1;throw _0x3a927f;}}}export const SegmentInfoCommand=SegmentViewCommand;export class SegmentDescCommand extends BaseCommand{[a25_0x92b6e0(0xf2)]='segment:desc';['description']=a25_0x92b6e0(0xdf);async[a25_0x92b6e0(0x12d)](_0x2363e6){const _0x5f077e=a25_0x92b6e0,{options:_0x48d88e,args:_0x42a89c,tdx:_0x166cf1}=_0x2363e6,_0x3aeded=_0x42a89c[0x0];if(!_0x3aeded)return console[_0x5f077e(0xec)]('Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required'),console[_0x5f077e(0xec)](_0x5f077e(0x101)),console[_0x5f077e(0xec)]('\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20desc\x20<path/to/segment.yml>'),console[_0x5f077e(0xec)](_0x5f077e(0x158)),console[_0x5f077e(0xec)](_0x5f077e(0xd8)),console[_0x5f077e(0xec)]('\x20\x20tdx\x20sg\x20desc\x20segments/my-audience/premium-users.yml'),0x1;try{const _0x295e54=_0x48d88e[_0x5f077e(0xde)],_0x28d027=await resolveSegmentTarget(_0x3aeded,_0x295e54,_0x48d88e[_0x5f077e(0x136)]);_0x48d88e[_0x5f077e(0x136)]&&console['error'](_0x5f077e(0x131)+_0x28d027);const _0xff8784=await withSpinner(_0x5f077e(0x141)+_0x3aeded+_0x5f077e(0xef),()=>_0x166cf1[_0x5f077e(0xce)][_0x5f077e(0x161)](_0x28d027),{'verbose':_0x48d88e[_0x5f077e(0x136)]}),_0x2d782a=_0xff8784[_0x5f077e(0x142)];_0x48d88e['verbose']&&(console[_0x5f077e(0xec)]('Resolved\x20type:\x20'+_0x2d782a[_0x5f077e(0xdd)]),console[_0x5f077e(0xec)](_0x5f077e(0xf8)+_0x2d782a[_0x5f077e(0xf3)]));if(_0x2d782a[_0x5f077e(0xdd)]===_0x5f077e(0x134))return console[_0x5f077e(0xec)](_0x5f077e(0x15d)),console[_0x5f077e(0xec)]('Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.'),0x1;if(_0x2d782a[_0x5f077e(0xdd)]===_0x5f077e(0xe5))return console['error'](_0x5f077e(0xd6)),console[_0x5f077e(0xec)]('Use:\x20tdx\x20ps\x20desc'),0x1;if(!_0x2d782a[_0x5f077e(0xd5)])throw new SDKError(ErrorCode[_0x5f077e(0x107)],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x353fac=await withSpinner(_0x5f077e(0xc8),()=>_0x166cf1[_0x5f077e(0xce)][_0x5f077e(0x157)](_0x2d782a[_0x5f077e(0xf3)],_0x2d782a['segmentId']),{'verbose':_0x48d88e[_0x5f077e(0x136)]}),_0x264500=_0x353fac[_0x5f077e(0x142)],_0x53e277=await executeSchemaQuery(_0x264500,_0x166cf1,_0x48d88e);return await handleQueryOutput(_0x53e277,_0x48d88e),0x0;}catch(_0x339ab0){if(_0x339ab0 instanceof SDKError)return console[_0x5f077e(0xec)]('Error:\x20'+_0x339ab0[_0x5f077e(0x133)]),_0x339ab0[_0x5f077e(0x121)]&&console[_0x5f077e(0xec)](_0x5f077e(0x13c)+_0x339ab0[_0x5f077e(0x121)]),0x1;throw _0x339ab0;}}}
@@ -1 +1 @@
1
- const a26_0x1b74d0=a26_0x39f7;(function(_0x1dfbde,_0x11b341){const _0x402d4c=a26_0x39f7,_0x419685=_0x1dfbde();while(!![]){try{const _0x27330c=parseInt(_0x402d4c(0x148))/0x1+-parseInt(_0x402d4c(0x155))/0x2+-parseInt(_0x402d4c(0x178))/0x3+-parseInt(_0x402d4c(0x14b))/0x4+parseInt(_0x402d4c(0x15b))/0x5+parseInt(_0x402d4c(0x162))/0x6+parseInt(_0x402d4c(0x15f))/0x7*(-parseInt(_0x402d4c(0x14d))/0x8);if(_0x27330c===_0x11b341)break;else _0x419685['push'](_0x419685['shift']());}catch(_0x3ec379){_0x419685['push'](_0x419685['shift']());}}}(a26_0xc866,0xe36d7));function a26_0x39f7(_0x3389f0,_0x55c663){_0x3389f0=_0x3389f0-0x148;const _0xc86690=a26_0xc866();let _0x39f700=_0xc86690[_0x3389f0];return _0x39f700;}import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import{loadJSONFromOptions}from'../utils/json-loader.js';import{parsePath,getParentPath,getBaseName}from'../sdk/segment/segment-path-parser.js';import a26_0x3d74ec from'chalk';function a26_0xc866(){const _0x4b36f7=['Site:\x20','1984zlKvaC','Error:\x20Segment\x20path\x20or\x20name\x20is\x20required','description','segment:create','Resolving\x20folder\x20path\x20\x27','yellow','rule','\x27\x20with\x20ID:\x20','3206492rNbbxn','resolvePathToResource','site','error','verbose','Error:\x20Cannot\x20create\x20segment\x20in\x20a\x20segment.\x20Parent\x20path\x20must\x20be\x20a\x20folder\x20or\x20parent.','8580790VfzEwT','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/Marketing/Premium\x22\x20--rule\x20\x27...\x27','ruleFile','segment','7119shzccf','Target\x20path:\x20','Parent:\x20','9401934OjdjOm','Creating\x20segment\x20\x27','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/High\x20Value\x22\x20--rule\x20\x27...\x27','folder','\x20\x20\x20Path:\x20','parent','Resolved\x20folder\x20ID:\x20','segmentPath','noCountPopulation','Usage:\x20tdx\x20segment\x20create\x20<path>\x20[options]','Resolved\x20relative\x20path\x20to:\x20','Create\x20child\x20segment\x20with\x20filtering\x20rules','⚠\x20Deprecation\x20warning:\x20`segment\x20create`\x20is\x20deprecated.','name','createSegment','length','invisible','execute','includes','\x27...','\x20\x20tdx\x20segment\x20create\x20\x22Premium\x22\x20--rule\x20\x27...\x27\x20\x20#\x20Relative\x20to\x20context','Parent\x20path:\x20','3064629XkQjjO','segments','984423TOjhGr','data','Segment\x20name:\x20','1836088PuwRuI'];a26_0xc866=function(){return _0x4b36f7;};return a26_0xc866();}export class SegmentCreateCommand extends BaseCommand{[a26_0x1b74d0(0x16f)]=a26_0x1b74d0(0x150);[a26_0x1b74d0(0x14f)]=a26_0x1b74d0(0x16d);async[a26_0x1b74d0(0x173)](_0x4a178e){const _0x1ce0ba=a26_0x1b74d0;console[_0x1ce0ba(0x158)](a26_0x3d74ec[_0x1ce0ba(0x152)](_0x1ce0ba(0x16e))),console[_0x1ce0ba(0x158)](a26_0x3d74ec[_0x1ce0ba(0x152)]('\x20\x20Use\x20`tdx\x20sg\x20push`\x20with\x20YAML\x20files\x20instead.\x0a'));const {options:_0x19cd43,args:_0x372d9a,tdx:_0x1119fc}=_0x4a178e,_0x2fcd5f=_0x19cd43;if(_0x372d9a[_0x1ce0ba(0x171)]===0x0)return console['error'](_0x1ce0ba(0x14e)),console[_0x1ce0ba(0x158)](_0x1ce0ba(0x16b)),console[_0x1ce0ba(0x158)]('Examples:'),console[_0x1ce0ba(0x158)](_0x1ce0ba(0x164)),console[_0x1ce0ba(0x158)](_0x1ce0ba(0x15c)),console[_0x1ce0ba(0x158)](_0x1ce0ba(0x176)),0x1;const _0x2daffa=_0x372d9a[0x0],_0x396f70=_0x19cd43[_0x1ce0ba(0x169)];let _0xb31d48=_0x2daffa;_0x396f70&&!_0x2daffa[_0x1ce0ba(0x174)]('/')&&(_0xb31d48=_0x396f70+'/'+_0x2daffa,_0x2fcd5f[_0x1ce0ba(0x159)]&&console[_0x1ce0ba(0x158)](_0x1ce0ba(0x16c)+_0xb31d48));const _0x112740=parsePath(_0xb31d48);if(_0x112740[_0x1ce0ba(0x179)][_0x1ce0ba(0x171)]<0x2)return console['error']('Error:\x20Full\x20path\x20required\x20(parent/segment_name\x20or\x20parent/folder/segment_name)'),console['error']('Usage:\x20tdx\x20segment\x20create\x20<parent/segment_name>\x20[options]'),0x1;const _0x7b5732=_0x112740[_0x1ce0ba(0x179)][0x0],_0xbcc646=getBaseName(_0xb31d48),_0x4c90de=getParentPath(_0xb31d48);_0x2fcd5f[_0x1ce0ba(0x159)]&&(console[_0x1ce0ba(0x158)](_0x1ce0ba(0x14c)+_0x2fcd5f[_0x1ce0ba(0x157)]),console['error'](_0x1ce0ba(0x160)+_0xb31d48),console[_0x1ce0ba(0x158)](_0x1ce0ba(0x161)+_0x7b5732),console['error'](_0x1ce0ba(0x14a)+_0xbcc646),console[_0x1ce0ba(0x158)](_0x1ce0ba(0x177)+_0x4c90de));const _0x3c6c4e=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x7b5732+_0x1ce0ba(0x175),()=>_0x1119fc[_0x1ce0ba(0x15e)]['resolveParentId'](_0x7b5732),{'verbose':_0x2fcd5f['verbose']}),_0x18e8a3=_0x3c6c4e[_0x1ce0ba(0x149)];let _0x3e0529;if(_0x112740['segments']['length']>0x2){const _0x2b4d41=await withSpinner(_0x1ce0ba(0x151)+_0x4c90de+_0x1ce0ba(0x175),()=>_0x1119fc[_0x1ce0ba(0x15e)][_0x1ce0ba(0x156)](_0x4c90de),{'verbose':_0x2fcd5f[_0x1ce0ba(0x159)]}),_0x204421=_0x2b4d41[_0x1ce0ba(0x149)];if(_0x204421['type']!=='folder'&&_0x204421['type']!==_0x1ce0ba(0x167))return console[_0x1ce0ba(0x158)](_0x1ce0ba(0x15a)),0x1;_0x3e0529=_0x204421['folderId'];}else{if(_0x2fcd5f[_0x1ce0ba(0x165)]){const _0x1a55da=await withSpinner('Resolving\x20folder\x20\x27'+_0x2fcd5f[_0x1ce0ba(0x165)]+_0x1ce0ba(0x175),()=>_0x1119fc[_0x1ce0ba(0x15e)]['resolveFolderId'](_0x18e8a3,_0x2fcd5f[_0x1ce0ba(0x165)]),{'verbose':_0x2fcd5f[_0x1ce0ba(0x159)]});_0x3e0529=_0x1a55da[_0x1ce0ba(0x149)];}}_0x2fcd5f[_0x1ce0ba(0x159)]&&_0x3e0529&&console[_0x1ce0ba(0x158)](_0x1ce0ba(0x168)+_0x3e0529);const _0x4018ad=await loadJSONFromOptions(_0x2fcd5f[_0x1ce0ba(0x153)],_0x2fcd5f[_0x1ce0ba(0x15d)]),_0x5a6647={'name':_0xbcc646,'description':_0x2fcd5f[_0x1ce0ba(0x14f)],'rule':_0x4018ad,'kind':_0x2fcd5f['kind']!==undefined?parseInt(_0x2fcd5f['kind'],0xa):undefined,'isVisible':_0x2fcd5f[_0x1ce0ba(0x172)]?![]:undefined,'segmentFolderId':_0x3e0529,'countPopulation':_0x2fcd5f[_0x1ce0ba(0x16a)]?![]:undefined},_0x1b2ea1=await withSpinner(_0x1ce0ba(0x163)+_0xbcc646+_0x1ce0ba(0x175),()=>_0x1119fc[_0x1ce0ba(0x15e)][_0x1ce0ba(0x170)](_0x18e8a3,_0x5a6647),{'verbose':_0x2fcd5f[_0x1ce0ba(0x159)]}),_0x310267=_0x1b2ea1[_0x1ce0ba(0x149)];return console[_0x1ce0ba(0x158)]('✔\x20Created\x20segment\x20\x27'+_0x310267[_0x1ce0ba(0x16f)]+_0x1ce0ba(0x154)+_0x310267['id']),_0xb31d48!==_0x2daffa&&console['error'](_0x1ce0ba(0x166)+_0xb31d48),await handleSDKOutput([_0x310267],_0x2fcd5f),0x0;}}
1
+ const a26_0x2707b3=a26_0x5aec;(function(_0x48bcf9,_0x20df06){const _0x172feb=a26_0x5aec,_0x29f3a6=_0x48bcf9();while(!![]){try{const _0xdcfbff=parseInt(_0x172feb(0xba))/0x1*(-parseInt(_0x172feb(0xa4))/0x2)+parseInt(_0x172feb(0xa1))/0x3+-parseInt(_0x172feb(0xa5))/0x4+-parseInt(_0x172feb(0x99))/0x5+parseInt(_0x172feb(0xbe))/0x6+parseInt(_0x172feb(0x8b))/0x7*(-parseInt(_0x172feb(0x90))/0x8)+parseInt(_0x172feb(0xb3))/0x9;if(_0xdcfbff===_0x20df06)break;else _0x29f3a6['push'](_0x29f3a6['shift']());}catch(_0x3706a3){_0x29f3a6['push'](_0x29f3a6['shift']());}}}(a26_0x4d47,0xb7f9d));import{BaseCommand}from'./command.js';function a26_0x5aec(_0x5d38c4,_0x5680c7){_0x5d38c4=_0x5d38c4-0x88;const _0x4d476f=a26_0x4d47();let _0x5aeced=_0x4d476f[_0x5d38c4];return _0x5aeced;}import{handleSDKOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import{loadJSONFromOptions}from'../utils/json-loader.js';function a26_0x4d47(){const _0x47a182=['\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/High\x20Value\x22\x20--rule\x20\x27...\x27','Examples:','Resolved\x20folder\x20ID:\x20','invisible','20085444BgpLfJ','Site:\x20','noCountPopulation','segment','length','\x27...','includes','74101mRQAVc','Parent\x20path:\x20','Error:\x20Cannot\x20create\x20segment\x20in\x20a\x20segment.\x20Parent\x20path\x20must\x20be\x20a\x20folder\x20or\x20parent.','Creating\x20segment\x20\x27','7042374CuLZca','segments','error','\x20\x20tdx\x20segment\x20create\x20\x22Premium\x22\x20--rule\x20\x27...\x27\x20\x20#\x20Relative\x20to\x20context','\x20\x20Use\x20`tdx\x20sg\x20push`\x20with\x20YAML\x20files\x20instead.\x0a','10509016Yqerlt','rule','\x27\x20with\x20ID:\x20','yellow','Error:\x20Full\x20path\x20required\x20(parent/segment_name\x20or\x20parent/folder/segment_name)','8NpKpzR','verbose','Usage:\x20tdx\x20segment\x20create\x20<path>\x20[options]','resolveFolderId','Target\x20path:\x20','description','segmentPath','Error:\x20Segment\x20path\x20or\x20name\x20is\x20required','type','1068815ERfePs','Resolving\x20folder\x20path\x20\x27','Usage:\x20tdx\x20segment\x20create\x20<parent/segment_name>\x20[options]','site','segment:create','Segment\x20name:\x20','parent','✔\x20Created\x20segment\x20\x27','294372rRCWEE','name','\x20\x20\x20Path:\x20','4eSJDDr','3547004fAqSAd','folder','createSegment','resolveParentId','Parent:\x20','Resolved\x20relative\x20path\x20to:\x20','⚠\x20Deprecation\x20warning:\x20`segment\x20create`\x20is\x20deprecated.','ruleFile','data','execute'];a26_0x4d47=function(){return _0x47a182;};return a26_0x4d47();}import{parsePath,getParentPath,getBaseName}from'../sdk/segment/segment-path-parser.js';import a26_0x117633 from'chalk';export class SegmentCreateCommand extends BaseCommand{[a26_0x2707b3(0xa2)]=a26_0x2707b3(0x9d);[a26_0x2707b3(0x95)]='Create\x20child\x20segment\x20with\x20filtering\x20rules';async[a26_0x2707b3(0xae)](_0x26edfa){const _0x364b57=a26_0x2707b3;console['error'](a26_0x117633[_0x364b57(0x8e)](_0x364b57(0xab))),console[_0x364b57(0x88)](a26_0x117633['yellow'](_0x364b57(0x8a)));const {options:_0x4d5fc0,args:_0x5e21b6,tdx:_0x1f1f75}=_0x26edfa,_0x3788bd=_0x4d5fc0;if(_0x5e21b6['length']===0x0)return console['error'](_0x364b57(0x97)),console[_0x364b57(0x88)](_0x364b57(0x92)),console[_0x364b57(0x88)](_0x364b57(0xb0)),console['error'](_0x364b57(0xaf)),console[_0x364b57(0x88)]('\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/Marketing/Premium\x22\x20--rule\x20\x27...\x27'),console['error'](_0x364b57(0x89)),0x1;const _0x51b6d3=_0x5e21b6[0x0],_0x49776a=_0x4d5fc0[_0x364b57(0x96)];let _0x455b7f=_0x51b6d3;_0x49776a&&!_0x51b6d3[_0x364b57(0xb9)]('/')&&(_0x455b7f=_0x49776a+'/'+_0x51b6d3,_0x3788bd[_0x364b57(0x91)]&&console[_0x364b57(0x88)](_0x364b57(0xaa)+_0x455b7f));const _0x46672f=parsePath(_0x455b7f);if(_0x46672f[_0x364b57(0xbf)][_0x364b57(0xb7)]<0x2)return console[_0x364b57(0x88)](_0x364b57(0x8f)),console[_0x364b57(0x88)](_0x364b57(0x9b)),0x1;const _0x34ae45=_0x46672f[_0x364b57(0xbf)][0x0],_0x262fd2=getBaseName(_0x455b7f),_0x320480=getParentPath(_0x455b7f);_0x3788bd[_0x364b57(0x91)]&&(console[_0x364b57(0x88)](_0x364b57(0xb4)+_0x3788bd[_0x364b57(0x9c)]),console[_0x364b57(0x88)](_0x364b57(0x94)+_0x455b7f),console[_0x364b57(0x88)](_0x364b57(0xa9)+_0x34ae45),console[_0x364b57(0x88)](_0x364b57(0x9e)+_0x262fd2),console[_0x364b57(0x88)](_0x364b57(0xbb)+_0x320480));const _0x351598=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x34ae45+'\x27...',()=>_0x1f1f75['segment'][_0x364b57(0xa8)](_0x34ae45),{'verbose':_0x3788bd[_0x364b57(0x91)]}),_0x218df1=_0x351598['data'];let _0x2f00db;if(_0x46672f[_0x364b57(0xbf)]['length']>0x2){const _0x28ecf2=await withSpinner(_0x364b57(0x9a)+_0x320480+_0x364b57(0xb8),()=>_0x1f1f75[_0x364b57(0xb6)]['resolvePathToResource'](_0x320480),{'verbose':_0x3788bd['verbose']}),_0x2b8838=_0x28ecf2['data'];if(_0x2b8838[_0x364b57(0x98)]!=='folder'&&_0x2b8838['type']!==_0x364b57(0x9f))return console['error'](_0x364b57(0xbc)),0x1;_0x2f00db=_0x2b8838['folderId'];}else{if(_0x3788bd[_0x364b57(0xa6)]){const _0x26a75f=await withSpinner('Resolving\x20folder\x20\x27'+_0x3788bd[_0x364b57(0xa6)]+_0x364b57(0xb8),()=>_0x1f1f75[_0x364b57(0xb6)][_0x364b57(0x93)](_0x218df1,_0x3788bd[_0x364b57(0xa6)]),{'verbose':_0x3788bd[_0x364b57(0x91)]});_0x2f00db=_0x26a75f['data'];}}_0x3788bd[_0x364b57(0x91)]&&_0x2f00db&&console['error'](_0x364b57(0xb1)+_0x2f00db);const _0xc6b261=await loadJSONFromOptions(_0x3788bd[_0x364b57(0x8c)],_0x3788bd[_0x364b57(0xac)]),_0x2e29cf={'name':_0x262fd2,'description':_0x3788bd[_0x364b57(0x95)],'rule':_0xc6b261,'kind':_0x3788bd['kind']!==undefined?parseInt(_0x3788bd['kind'],0xa):undefined,'isVisible':_0x3788bd[_0x364b57(0xb2)]?![]:undefined,'segmentFolderId':_0x2f00db,'countPopulation':_0x3788bd[_0x364b57(0xb5)]?![]:undefined},_0x241fdf=await withSpinner(_0x364b57(0xbd)+_0x262fd2+_0x364b57(0xb8),()=>_0x1f1f75[_0x364b57(0xb6)][_0x364b57(0xa7)](_0x218df1,_0x2e29cf),{'verbose':_0x3788bd[_0x364b57(0x91)]}),_0x3d2d44=_0x241fdf[_0x364b57(0xad)];return console[_0x364b57(0x88)](_0x364b57(0xa0)+_0x3d2d44[_0x364b57(0xa2)]+_0x364b57(0x8d)+_0x3d2d44['id']),_0x455b7f!==_0x51b6d3&&console['error'](_0x364b57(0xa3)+_0x455b7f),await handleSDKOutput([_0x3d2d44],_0x3788bd),0x0;}}
@@ -1 +1 @@
1
- const a27_0x4b35a4=a27_0x2110;(function(_0x1caef4,_0x10908e){const _0x5d3aa1=a27_0x2110,_0x4d380a=_0x1caef4();while(!![]){try{const _0x38f8d9=parseInt(_0x5d3aa1(0x102))/0x1+parseInt(_0x5d3aa1(0x101))/0x2+parseInt(_0x5d3aa1(0x10b))/0x3+-parseInt(_0x5d3aa1(0xff))/0x4*(-parseInt(_0x5d3aa1(0x113))/0x5)+-parseInt(_0x5d3aa1(0x11a))/0x6+parseInt(_0x5d3aa1(0x109))/0x7+parseInt(_0x5d3aa1(0x103))/0x8*(-parseInt(_0x5d3aa1(0x114))/0x9);if(_0x38f8d9===_0x10908e)break;else _0x4d380a['push'](_0x4d380a['shift']());}catch(_0x56d614){_0x4d380a['push'](_0x4d380a['shift']());}}}(a27_0x2906,0xc8db9));import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import{displayFieldsHumanReadable}from'../sdk/segment/fields-display.js';function a27_0x2110(_0x321228,_0x48caa5){_0x321228=_0x321228-0xff;const _0x290693=a27_0x2906();let _0x21108b=_0x290693[_0x321228];return _0x21108b;}function a27_0x2906(){const _0x18b8c0=['2957532OKeyMj','listFields','error','Usage:\x20tdx\x20segment\x20fields\x20<parent_name>','\x20field','name','data','length','10WTkEPO','3793554rrQdcx','Parent\x20segment:\x20','Error:\x20Parent\x20segment\x20name\x20is\x20required','verbose','segment','segment:fields','4181130sELsRn','105064SBeJNj','site','1070082nJrCbS','673632SHPMNs','32aPUOpT','json','description','Site:\x20','jsonl','✔\x20Found\x20','6709801lcBcQr','List\x20available\x20fields\x20for\x20segmentation'];a27_0x2906=function(){return _0x18b8c0;};return a27_0x2906();}export class SegmentFieldsCommand extends BaseCommand{[a27_0x4b35a4(0x110)]=a27_0x4b35a4(0x119);[a27_0x4b35a4(0x105)]=a27_0x4b35a4(0x10a);async['execute'](_0x3d78d9){const _0x1a8999=a27_0x4b35a4,{options:_0x2cdaf9,args:_0x1fc651,tdx:_0x2eb61c}=_0x3d78d9,_0x527c24=_0x1fc651[0x0]||_0x2cdaf9['parentSegment'];if(!_0x527c24)return console['error'](_0x1a8999(0x116)),console[_0x1a8999(0x10d)](_0x1a8999(0x10e)),console[_0x1a8999(0x10d)]('\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>'),0x1;_0x2cdaf9['verbose']&&(console['error'](_0x1a8999(0x106)+_0x2cdaf9[_0x1a8999(0x100)]),console[_0x1a8999(0x10d)](_0x1a8999(0x115)+_0x527c24));const _0x41ac94=await withSpinner('Listing\x20fields\x20for\x20\x27'+_0x527c24+'\x27...',()=>_0x2eb61c[_0x1a8999(0x118)][_0x1a8999(0x10c)](_0x527c24),{'verbose':_0x2cdaf9[_0x1a8999(0x117)]}),_0x3f016c=_0x41ac94[_0x1a8999(0x111)];console['error'](_0x1a8999(0x108)+_0x3f016c[_0x1a8999(0x112)]+_0x1a8999(0x10f)+(_0x3f016c[_0x1a8999(0x112)]!==0x1?'s':''));if(_0x2cdaf9[_0x1a8999(0x104)]||_0x2cdaf9[_0x1a8999(0x107)])return await handleSDKOutput(_0x3f016c,_0x2cdaf9),0x0;return displayFieldsHumanReadable(_0x3f016c,_0x527c24),0x0;}}
1
+ function a27_0x44ba(){const _0x2d52ed=['1664856eqfNIn','1681810pkZRpP','14aLXNCS','Error:\x20Parent\x20segment\x20name\x20is\x20required','1017eDiCVc','\x27...','parentSegment','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','error','json','248bPObdV','19470WsuRco','data','verbose','segment','Listing\x20fields\x20for\x20\x27','name','List\x20available\x20fields\x20for\x20segmentation','segment:fields','listFields','7204mzcNyj','length','Site:\x20','description','jsonl','\x20field','Parent\x20segment:\x20','3153786VDkNOz','11444JPnTUi','22852511NmshlH','1908MUrCCM'];a27_0x44ba=function(){return _0x2d52ed;};return a27_0x44ba();}const a27_0x137f86=a27_0x32c5;(function(_0x1a68d4,_0x1c7354){const _0x3ee54c=a27_0x32c5,_0x5acd69=_0x1a68d4();while(!![]){try{const _0x171e87=-parseInt(_0x3ee54c(0x140))/0x1*(-parseInt(_0x3ee54c(0x14a))/0x2)+parseInt(_0x3ee54c(0x13a))/0x3*(parseInt(_0x3ee54c(0x133))/0x4)+parseInt(_0x3ee54c(0x137))/0x5+-parseInt(_0x3ee54c(0x132))/0x6*(-parseInt(_0x3ee54c(0x138))/0x7)+-parseInt(_0x3ee54c(0x136))/0x8+-parseInt(_0x3ee54c(0x135))/0x9*(parseInt(_0x3ee54c(0x141))/0xa)+-parseInt(_0x3ee54c(0x134))/0xb;if(_0x171e87===_0x1c7354)break;else _0x5acd69['push'](_0x5acd69['shift']());}catch(_0x55a32b){_0x5acd69['push'](_0x5acd69['shift']());}}}(a27_0x44ba,0x86deb));import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';function a27_0x32c5(_0x5e4123,_0x4d1ec4){_0x5e4123=_0x5e4123-0x12c;const _0x44bae1=a27_0x44ba();let _0x32c59b=_0x44bae1[_0x5e4123];return _0x32c59b;}import{displayFieldsHumanReadable}from'../sdk/segment/fields-display.js';export class SegmentFieldsCommand extends BaseCommand{[a27_0x137f86(0x146)]=a27_0x137f86(0x148);[a27_0x137f86(0x12e)]=a27_0x137f86(0x147);async['execute'](_0x167f07){const _0x7a13e7=a27_0x137f86,{options:_0x10168d,args:_0x304f5a,tdx:_0x566fe5}=_0x167f07,_0x46d95f=_0x304f5a[0x0]||_0x10168d[_0x7a13e7(0x13c)];if(!_0x46d95f)return console[_0x7a13e7(0x13e)](_0x7a13e7(0x139)),console[_0x7a13e7(0x13e)]('Usage:\x20tdx\x20segment\x20fields\x20<parent_name>'),console[_0x7a13e7(0x13e)](_0x7a13e7(0x13d)),0x1;_0x10168d['verbose']&&(console[_0x7a13e7(0x13e)](_0x7a13e7(0x12d)+_0x10168d['site']),console[_0x7a13e7(0x13e)](_0x7a13e7(0x131)+_0x46d95f));const _0x8dee0f=await withSpinner(_0x7a13e7(0x145)+_0x46d95f+_0x7a13e7(0x13b),()=>_0x566fe5[_0x7a13e7(0x144)][_0x7a13e7(0x149)](_0x46d95f),{'verbose':_0x10168d[_0x7a13e7(0x143)]}),_0x529921=_0x8dee0f[_0x7a13e7(0x142)];console[_0x7a13e7(0x13e)]('✔\x20Found\x20'+_0x529921[_0x7a13e7(0x12c)]+_0x7a13e7(0x130)+(_0x529921['length']!==0x1?'s':''));if(_0x10168d[_0x7a13e7(0x13f)]||_0x10168d[_0x7a13e7(0x12f)])return await handleSDKOutput(_0x529921,_0x10168d),0x0;return displayFieldsHumanReadable(_0x529921,_0x46d95f),0x0;}}
@@ -1 +1 @@
1
- function a28_0x1593(){const _0x31d960=['dim','files','verbose','parent_segment','2448146ajdSjU','pullSegments','\x20files\x20to\x20','\x20changed\x20files','parentSegment','\x27...','\x0aPull\x20summary\x20for\x20\x27','diff','Parent\x20segment:\x20','\x20versions)','absolutePath','segments','parentName','journeyVersions','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20pull\x20<file_path>\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20segment\x20file','✔\x20Context\x20set:\x20','hasChanges','activations','no_parent','cyan','2005256pQUEEk','counts','red','Pulling\x20segments\x20from\x20\x27','dryRun','\x20activations','1jBuPZD','\x20new\x20files','10zLcRUj','dirname','execute','repeat','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a','264DBGZrH','Target\x20resource:\x20','6949000ehuBxv','\x20\x20🗺️\x20\x20','error','content','isNew','cwd','\x20segments','length','\x20\x20🎯\x20','setPhase','filter','\x20with\x20','31086jdjgfG','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20pull\x20<parent_name>\x20\x20\x20\x20\x20\x20#\x20Pull\x20all\x20segments\x20from\x20parent','green','resourceName','journeys','6678175vrprKl','\x0aChanges\x20to\x20\x27','data','Site:\x20','relativePath','session','\x20files?','3903864GzMeeX','6134157sKaeIa','✔\x20All\x20files\x20are\x20up\x20to\x20date','segment:pull','message','utf-8','\x0a[Dry\x20run]\x20No\x20files\x20were\x20written','helpText','targetDir','site','description','yellow'];a28_0x1593=function(){return _0x31d960;};return a28_0x1593();}const a28_0x449171=a28_0x84af;(function(_0x377c74,_0x3dd6e6){const _0x2aa7e9=a28_0x84af,_0x135f5a=_0x377c74();while(!![]){try{const _0x46d211=parseInt(_0x2aa7e9(0x11f))/0x1*(parseInt(_0x2aa7e9(0x105))/0x2)+parseInt(_0x2aa7e9(0x134))/0x3*(-parseInt(_0x2aa7e9(0x126))/0x4)+parseInt(_0x2aa7e9(0x128))/0x5+-parseInt(_0x2aa7e9(0x140))/0x6+-parseInt(_0x2aa7e9(0x139))/0x7+-parseInt(_0x2aa7e9(0x119))/0x8+-parseInt(_0x2aa7e9(0x141))/0x9*(-parseInt(_0x2aa7e9(0x121))/0xa);if(_0x46d211===_0x3dd6e6)break;else _0x135f5a['push'](_0x135f5a['shift']());}catch(_0xbf2f9a){_0x135f5a['push'](_0x135f5a['shift']());}}}(a28_0x1593,0xb8a04));import{BaseCommand}from'./command.js';function a28_0x84af(_0x9d9398,_0x376b3a){_0x9d9398=_0x9d9398-0xff;const _0x1593ed=a28_0x1593();let _0x84af10=_0x1593ed[_0x9d9398];return _0x84af10;}import{withProgressSpinner}from'../utils/spinner.js';import{confirmKey}from'../utils/prompt.js';import{saveSessionContext}from'../core/session.js';import a28_0x48335d from'chalk';import{existsSync,mkdirSync,writeFileSync}from'fs';import a28_0x4ac562 from'path';import{resolveTarget,isSuccessfulResolution}from'../sdk/segment/target-resolution.js';export{buildFolderIdToPathMap as buildFolderPathMap}from'../sdk/segment/resolution-context.js';export class SegmentPullCommand extends BaseCommand{['name']=a28_0x449171(0x143);[a28_0x449171(0xff)]='Pull\x20child\x20segments\x20and\x20journeys\x20to\x20YAML\x20files';async[a28_0x449171(0x123)](_0x162096){const _0x191871=a28_0x449171,{options:_0x1f7acb,args:_0x59bd20,tdx:_0xc1baf9}=_0x162096,_0x4430a2=_0x1f7acb,_0x5ca883=await resolveTarget({'arg':_0x59bd20[0x0],'contextParent':_0x1f7acb[_0x191871(0x109)],'cwd':process[_0x191871(0x12d)]()});if(!isSuccessfulResolution(_0x5ca883))return _0x5ca883['errorCode']===_0x191871(0x117)?(console[_0x191871(0x12a)](a28_0x48335d[_0x191871(0x100)](_0x191871(0x125))),console[_0x191871(0x12a)]('Usage:\x20tdx\x20sg\x20pull\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20all\x20segments\x20(requires\x20context\x20or\x20tdx.json)'),console[_0x191871(0x12a)](_0x191871(0x135)),console[_0x191871(0x12a)](_0x191871(0x113))):(console[_0x191871(0x12a)](a28_0x48335d[_0x191871(0x11b)]('Error:\x20'+_0x5ca883[_0x191871(0x144)]+'\x0a')),_0x5ca883[_0x191871(0x147)]&&console['error'](a28_0x48335d[_0x191871(0x118)](_0x5ca883['helpText']))),0x1;const _0x8a7b64=_0x5ca883[_0x191871(0x111)],_0x4a192c=_0x5ca883[_0x191871(0x148)],_0x36bcf2=_0x5ca883['type']==='file'?_0x5ca883[_0x191871(0x137)]:undefined;_0x4430a2[_0x191871(0x103)]&&(console[_0x191871(0x12a)](_0x191871(0x13c)+_0x4430a2[_0x191871(0x149)]),console[_0x191871(0x12a)](_0x191871(0x10d)+_0x8a7b64),_0x36bcf2&&console[_0x191871(0x12a)](_0x191871(0x127)+_0x36bcf2));const _0x2d5b73=await withProgressSpinner(_0x191871(0x11c)+_0x8a7b64+_0x191871(0x10a),_0x6ab465=>_0xc1baf9['segment'][_0x191871(0x106)](_0x8a7b64,{'targetDir':_0x4a192c,'targetResourceName':_0x36bcf2,'verbose':_0x4430a2[_0x191871(0x103)],'progress':{'update':_0x5ab349=>{const _0x1dba9f=_0x191871;_0x6ab465[_0x1dba9f(0x131)](_0x5ab349),_0x4430a2['verbose']&&console[_0x1dba9f(0x12a)]('\x20\x20'+_0x5ab349);}}}),{'verbose':_0x4430a2[_0x191871(0x103)]}),_0x23eea3=_0x2d5b73[_0x191871(0x13b)];if(_0x23eea3[_0x191871(0x11a)][_0x191871(0x110)]===0x0&&_0x23eea3[_0x191871(0x11a)][_0x191871(0x138)]===0x0)return console[_0x191871(0x12a)](a28_0x48335d[_0x191871(0x100)]('No\x20segments\x20or\x20journeys\x20found\x20in\x20parent\x20segment\x20\x27'+_0x23eea3[_0x191871(0x111)]+'\x27')),0x0;const _0x4a8555=_0x23eea3[_0x191871(0x102)][_0x191871(0x132)](_0x3bc1db=>_0x3bc1db[_0x191871(0x12c)]),_0x805841=_0x23eea3[_0x191871(0x102)]['filter'](_0x4556ac=>!_0x4556ac['isNew']&&_0x4556ac[_0x191871(0x115)]),_0x1b14f9=_0x23eea3['files'][_0x191871(0x132)](_0x4646aa=>!_0x4646aa[_0x191871(0x12c)]&&!_0x4646aa[_0x191871(0x115)]);console[_0x191871(0x12a)](_0x191871(0x10b)+_0x23eea3[_0x191871(0x111)]+'\x27:'),console['error'](_0x191871(0x130)+a28_0x48335d[_0x191871(0x118)](_0x23eea3[_0x191871(0x11a)][_0x191871(0x110)]+_0x191871(0x12e))+_0x191871(0x133)+a28_0x48335d['cyan'](_0x23eea3[_0x191871(0x11a)][_0x191871(0x116)]+_0x191871(0x11e)));if(_0x23eea3[_0x191871(0x11a)]['journeys']>0x0){const _0x73e269=_0x23eea3[_0x191871(0x11a)][_0x191871(0x112)]>_0x23eea3[_0x191871(0x11a)]['journeys']?'\x20('+_0x23eea3[_0x191871(0x11a)][_0x191871(0x112)]+_0x191871(0x10e):'';console[_0x191871(0x12a)](_0x191871(0x129)+a28_0x48335d['cyan'](_0x23eea3['counts'][_0x191871(0x138)]+'\x20journeys')+a28_0x48335d[_0x191871(0x101)](_0x73e269));}console[_0x191871(0x12a)]('\x20\x20'+a28_0x48335d[_0x191871(0x136)]('+\x20'+_0x4a8555[_0x191871(0x12f)]+_0x191871(0x120))),console[_0x191871(0x12a)]('\x20\x20'+a28_0x48335d['yellow']('~\x20'+_0x805841[_0x191871(0x12f)]+_0x191871(0x108))),console[_0x191871(0x12a)]('\x20\x20'+a28_0x48335d[_0x191871(0x101)]('=\x20'+_0x1b14f9['length']+'\x20unchanged\x20files')),console[_0x191871(0x12a)]('\x20\x20Target:\x20'+a28_0x48335d['cyan'](_0x23eea3[_0x191871(0x148)])+'\x0a');if(_0x805841[_0x191871(0x12f)]>0x0)for(const _0x50fbda of _0x805841){console[_0x191871(0x12a)](_0x191871(0x13a)+_0x50fbda[_0x191871(0x13d)]+'\x27:'),console[_0x191871(0x12a)]('─'[_0x191871(0x124)](0x3c)),console[_0x191871(0x12a)](_0x50fbda[_0x191871(0x10c)]),console['error']('─'[_0x191871(0x124)](0x3c));}if(_0x4430a2[_0x191871(0x11d)])return console['error'](a28_0x48335d['yellow'](_0x191871(0x146))),0x0;if(_0x4a8555[_0x191871(0x12f)]===0x0&&_0x805841[_0x191871(0x12f)]===0x0)return console[_0x191871(0x12a)](a28_0x48335d[_0x191871(0x136)](_0x191871(0x142))),saveSessionContext({'parent_segment':_0x23eea3[_0x191871(0x111)]},_0x4430a2['session']),console[_0x191871(0x12a)](a28_0x48335d['green'](_0x191871(0x114)+a28_0x48335d[_0x191871(0x101)](_0x191871(0x104))+'\x20=\x20'+a28_0x48335d[_0x191871(0x118)](_0x23eea3[_0x191871(0x111)]))),0x0;if(!_0x4430a2['yes']){const _0xc6de3d=await confirmKey('Write\x20'+(_0x4a8555[_0x191871(0x12f)]+_0x805841[_0x191871(0x12f)])+_0x191871(0x13f));if(!_0xc6de3d)return console[_0x191871(0x12a)]('Aborted.'),0x1;}for(const _0xee170d of _0x23eea3[_0x191871(0x102)]){if(_0xee170d[_0x191871(0x12c)]||_0xee170d[_0x191871(0x115)]){const _0x3058db=a28_0x4ac562[_0x191871(0x122)](_0xee170d[_0x191871(0x10f)]);!existsSync(_0x3058db)&&mkdirSync(_0x3058db,{'recursive':!![]}),writeFileSync(_0xee170d['absolutePath'],_0xee170d[_0x191871(0x12b)],_0x191871(0x145));}}return console[_0x191871(0x12a)](a28_0x48335d[_0x191871(0x136)]('✔\x20Pulled\x20'+(_0x4a8555[_0x191871(0x12f)]+_0x805841['length'])+_0x191871(0x107)+_0x23eea3[_0x191871(0x148)])),saveSessionContext({'parent_segment':_0x23eea3[_0x191871(0x111)]},_0x4430a2[_0x191871(0x13e)]),console[_0x191871(0x12a)](a28_0x48335d['green']('✔\x20Context\x20set:\x20'+a28_0x48335d['dim']('parent_segment')+'\x20=\x20'+a28_0x48335d['cyan'](_0x23eea3['parentName']))),0x0;}}
1
+ const a28_0xad2d9e=a28_0x10ab;function a28_0x3289(){const _0x2990e2=['33sgdoUO','file','message','✔\x20Context\x20set:\x20','setPhase','parentName','execute','yellow','\x27...','filter','targetDir','\x20journeys','✔\x20All\x20files\x20are\x20up\x20to\x20date','data','segments','3653382qyqqYz','\x20activations','3552252XGHSgY','\x0aChanges\x20to\x20\x27','parent_segment','counts','files','\x20versions)','Usage:\x20tdx\x20sg\x20pull\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20all\x20segments\x20(requires\x20context\x20or\x20tdx.json)','201870VskMyl','\x20\x20🗺️\x20\x20','resourceName','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a','parentSegment','session','4773Zilcuq','312038eWrRqi','14VAtaPY','1919296sjAiWo','helpText','Write\x20','cyan','content','\x20unchanged\x20files','relativePath','length','isNew','dim','green','\x20new\x20files','\x20files\x20to\x20','\x0a[Dry\x20run]\x20No\x20files\x20were\x20written','✔\x20Pulled\x20','segment','utf-8','journeyVersions','hasChanges','Parent\x20segment:\x20','\x20segments','journeys','10Ehtmzs','2800854TKPgjM','Pulling\x20segments\x20from\x20\x27','description','activations','cwd','red','\x20\x20🎯\x20','30vHsHBm','errorCode','absolutePath','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20pull\x20<file_path>\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20segment\x20file','\x20files?','\x20\x20Target:\x20','repeat','\x20=\x20','name','error','1084roWspr','\x20changed\x20files','site','dirname','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20pull\x20<parent_name>\x20\x20\x20\x20\x20\x20#\x20Pull\x20all\x20segments\x20from\x20parent'];a28_0x3289=function(){return _0x2990e2;};return a28_0x3289();}(function(_0x2c578b,_0x10f9f0){const _0x4825c5=a28_0x10ab,_0x502354=_0x2c578b();while(!![]){try{const _0x2964da=-parseInt(_0x4825c5(0x232))/0x1+parseInt(_0x4825c5(0x1fd))/0x2+-parseInt(_0x4825c5(0x231))/0x3*(parseInt(_0x4825c5(0x20e))/0x4)+-parseInt(_0x4825c5(0x1fc))/0x5*(parseInt(_0x4825c5(0x222))/0x6)+-parseInt(_0x4825c5(0x233))/0x7*(-parseInt(_0x4825c5(0x234))/0x8)+-parseInt(_0x4825c5(0x22b))/0x9*(-parseInt(_0x4825c5(0x204))/0xa)+parseInt(_0x4825c5(0x213))/0xb*(parseInt(_0x4825c5(0x224))/0xc);if(_0x2964da===_0x10f9f0)break;else _0x502354['push'](_0x502354['shift']());}catch(_0x48b3c9){_0x502354['push'](_0x502354['shift']());}}}(a28_0x3289,0xd5873));import{BaseCommand}from'./command.js';import{withProgressSpinner}from'../utils/spinner.js';import{confirmKey}from'../utils/prompt.js';import{saveSessionContext}from'../core/session.js';import a28_0x4e42e3 from'chalk';import{existsSync,mkdirSync,writeFileSync}from'fs';import a28_0x15af62 from'path';import{resolveTarget,isSuccessfulResolution}from'../sdk/segment/target-resolution.js';function a28_0x10ab(_0x30995c,_0x50239e){_0x30995c=_0x30995c-0x1f3;const _0x328999=a28_0x3289();let _0x10abdf=_0x328999[_0x30995c];return _0x10abdf;}export{buildFolderIdToPathMap as buildFolderPathMap}from'../sdk/segment/resolution-context.js';export class SegmentPullCommand extends BaseCommand{[a28_0xad2d9e(0x20c)]='segment:pull';[a28_0xad2d9e(0x1ff)]='Pull\x20child\x20segments\x20and\x20journeys\x20to\x20YAML\x20files';async[a28_0xad2d9e(0x219)](_0x15604e){const _0x659825=a28_0xad2d9e,{options:_0xcff0a7,args:_0x17a97b,tdx:_0x239352}=_0x15604e,_0xf64902=_0xcff0a7,_0x2341fe=await resolveTarget({'arg':_0x17a97b[0x0],'contextParent':_0xcff0a7[_0x659825(0x22f)],'cwd':process[_0x659825(0x201)]()});if(!isSuccessfulResolution(_0x2341fe))return _0x2341fe[_0x659825(0x205)]==='no_parent'?(console['error'](a28_0x4e42e3[_0x659825(0x21a)](_0x659825(0x22e))),console[_0x659825(0x20d)](_0x659825(0x22a)),console[_0x659825(0x20d)](_0x659825(0x212)),console['error'](_0x659825(0x207))):(console[_0x659825(0x20d)](a28_0x4e42e3[_0x659825(0x202)]('Error:\x20'+_0x2341fe[_0x659825(0x215)]+'\x0a')),_0x2341fe['helpText']&&console[_0x659825(0x20d)](a28_0x4e42e3[_0x659825(0x237)](_0x2341fe[_0x659825(0x235)]))),0x1;const _0x419b5a=_0x2341fe['parentName'],_0x356600=_0x2341fe['targetDir'],_0x35c8b4=_0x2341fe['type']===_0x659825(0x214)?_0x2341fe[_0x659825(0x22d)]:undefined;_0xf64902['verbose']&&(console[_0x659825(0x20d)]('Site:\x20'+_0xf64902[_0x659825(0x210)]),console[_0x659825(0x20d)](_0x659825(0x1f9)+_0x419b5a),_0x35c8b4&&console[_0x659825(0x20d)]('Target\x20resource:\x20'+_0x35c8b4));const _0x1081fa=await withProgressSpinner(_0x659825(0x1fe)+_0x419b5a+_0x659825(0x21b),_0x2b4a28=>_0x239352[_0x659825(0x1f5)]['pullSegments'](_0x419b5a,{'targetDir':_0x356600,'targetResourceName':_0x35c8b4,'verbose':_0xf64902['verbose'],'progress':{'update':_0x1f6a0d=>{const _0x529b5a=_0x659825;_0x2b4a28[_0x529b5a(0x217)](_0x1f6a0d),_0xf64902['verbose']&&console[_0x529b5a(0x20d)]('\x20\x20'+_0x1f6a0d);}}}),{'verbose':_0xf64902['verbose']}),_0xedfac8=_0x1081fa[_0x659825(0x220)];if(_0xedfac8[_0x659825(0x227)][_0x659825(0x221)]===0x0&&_0xedfac8[_0x659825(0x227)][_0x659825(0x1fb)]===0x0)return console[_0x659825(0x20d)](a28_0x4e42e3['yellow']('No\x20segments\x20or\x20journeys\x20found\x20in\x20parent\x20segment\x20\x27'+_0xedfac8[_0x659825(0x218)]+'\x27')),0x0;const _0xc9d109=_0xedfac8[_0x659825(0x228)][_0x659825(0x21c)](_0x564ca6=>_0x564ca6[_0x659825(0x23c)]),_0x36d7c5=_0xedfac8['files']['filter'](_0x1e4684=>!_0x1e4684[_0x659825(0x23c)]&&_0x1e4684[_0x659825(0x1f8)]),_0x310b0c=_0xedfac8[_0x659825(0x228)][_0x659825(0x21c)](_0x1c2112=>!_0x1c2112[_0x659825(0x23c)]&&!_0x1c2112['hasChanges']);console[_0x659825(0x20d)]('\x0aPull\x20summary\x20for\x20\x27'+_0xedfac8[_0x659825(0x218)]+'\x27:'),console[_0x659825(0x20d)](_0x659825(0x203)+a28_0x4e42e3[_0x659825(0x237)](_0xedfac8[_0x659825(0x227)][_0x659825(0x221)]+_0x659825(0x1fa))+'\x20with\x20'+a28_0x4e42e3[_0x659825(0x237)](_0xedfac8[_0x659825(0x227)][_0x659825(0x200)]+_0x659825(0x223)));if(_0xedfac8[_0x659825(0x227)]['journeys']>0x0){const _0x52760c=_0xedfac8[_0x659825(0x227)][_0x659825(0x1f7)]>_0xedfac8[_0x659825(0x227)][_0x659825(0x1fb)]?'\x20('+_0xedfac8['counts'][_0x659825(0x1f7)]+_0x659825(0x229):'';console[_0x659825(0x20d)](_0x659825(0x22c)+a28_0x4e42e3[_0x659825(0x237)](_0xedfac8[_0x659825(0x227)]['journeys']+_0x659825(0x21e))+a28_0x4e42e3['dim'](_0x52760c));}console[_0x659825(0x20d)]('\x20\x20'+a28_0x4e42e3['green']('+\x20'+_0xc9d109[_0x659825(0x23b)]+_0x659825(0x23f))),console[_0x659825(0x20d)]('\x20\x20'+a28_0x4e42e3[_0x659825(0x21a)]('~\x20'+_0x36d7c5[_0x659825(0x23b)]+_0x659825(0x20f))),console['error']('\x20\x20'+a28_0x4e42e3[_0x659825(0x23d)]('=\x20'+_0x310b0c[_0x659825(0x23b)]+_0x659825(0x239))),console[_0x659825(0x20d)](_0x659825(0x209)+a28_0x4e42e3['cyan'](_0xedfac8[_0x659825(0x21d)])+'\x0a');if(_0x36d7c5[_0x659825(0x23b)]>0x0)for(const _0x56e94b of _0x36d7c5){console[_0x659825(0x20d)](_0x659825(0x225)+_0x56e94b[_0x659825(0x23a)]+'\x27:'),console[_0x659825(0x20d)]('─'[_0x659825(0x20a)](0x3c)),console['error'](_0x56e94b['diff']),console[_0x659825(0x20d)]('─'[_0x659825(0x20a)](0x3c));}if(_0xf64902['dryRun'])return console['error'](a28_0x4e42e3[_0x659825(0x21a)](_0x659825(0x1f3))),0x0;if(_0xc9d109[_0x659825(0x23b)]===0x0&&_0x36d7c5[_0x659825(0x23b)]===0x0)return console[_0x659825(0x20d)](a28_0x4e42e3['green'](_0x659825(0x21f))),saveSessionContext({'parent_segment':_0xedfac8['parentName']},_0xf64902['session']),console['error'](a28_0x4e42e3['green']('✔\x20Context\x20set:\x20'+a28_0x4e42e3['dim'](_0x659825(0x226))+'\x20=\x20'+a28_0x4e42e3[_0x659825(0x237)](_0xedfac8[_0x659825(0x218)]))),0x0;if(!_0xf64902['yes']){const _0x52cc0d=await confirmKey(_0x659825(0x236)+(_0xc9d109[_0x659825(0x23b)]+_0x36d7c5[_0x659825(0x23b)])+_0x659825(0x208));if(!_0x52cc0d)return console[_0x659825(0x20d)]('Aborted.'),0x1;}for(const _0x1ffdb0 of _0xedfac8[_0x659825(0x228)]){if(_0x1ffdb0[_0x659825(0x23c)]||_0x1ffdb0[_0x659825(0x1f8)]){const _0x41b1fd=a28_0x15af62[_0x659825(0x211)](_0x1ffdb0[_0x659825(0x206)]);!existsSync(_0x41b1fd)&&mkdirSync(_0x41b1fd,{'recursive':!![]}),writeFileSync(_0x1ffdb0[_0x659825(0x206)],_0x1ffdb0[_0x659825(0x238)],_0x659825(0x1f6));}}return console[_0x659825(0x20d)](a28_0x4e42e3[_0x659825(0x23e)](_0x659825(0x1f4)+(_0xc9d109[_0x659825(0x23b)]+_0x36d7c5['length'])+_0x659825(0x240)+_0xedfac8[_0x659825(0x21d)])),saveSessionContext({'parent_segment':_0xedfac8['parentName']},_0xf64902[_0x659825(0x230)]),console['error'](a28_0x4e42e3['green'](_0x659825(0x216)+a28_0x4e42e3['dim'](_0x659825(0x226))+_0x659825(0x20b)+a28_0x4e42e3[_0x659825(0x237)](_0xedfac8['parentName']))),0x0;}}