@treasuredata/tdx 0.13.1 → 0.14.0

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 (151) 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.d.ts.map +1 -1
  5. package/dist/cli.js +1 -1
  6. package/dist/cli.js.map +1 -1
  7. package/dist/commands/activations.js +1 -1
  8. package/dist/commands/agent-command.js +1 -1
  9. package/dist/commands/api-command.js +1 -1
  10. package/dist/commands/auth-command.js +1 -1
  11. package/dist/commands/chat-command.js +1 -1
  12. package/dist/commands/claude-command.js +1 -1
  13. package/dist/commands/claude-statusline-command.js +1 -1
  14. package/dist/commands/claude-usage-command.js +1 -1
  15. package/dist/commands/command.js +1 -1
  16. package/dist/commands/connection-command.js +1 -1
  17. package/dist/commands/databases.js +1 -1
  18. package/dist/commands/describe.js +1 -1
  19. package/dist/commands/engage-command.js +1 -1
  20. package/dist/commands/job-command.js +1 -1
  21. package/dist/commands/journey-command.d.ts.map +1 -1
  22. package/dist/commands/journey-command.js +1 -1
  23. package/dist/commands/journey-command.js.map +1 -1
  24. package/dist/commands/journey-validate-command.js +1 -1
  25. package/dist/commands/llm-command.js +1 -1
  26. package/dist/commands/llm-proxy.js +1 -1
  27. package/dist/commands/parent-segment-command.js +1 -1
  28. package/dist/commands/profile-command.js +1 -1
  29. package/dist/commands/profiles-command.js +1 -1
  30. package/dist/commands/query-command.js +1 -1
  31. package/dist/commands/segment-command.js +1 -1
  32. package/dist/commands/segment-create-command.js +1 -1
  33. package/dist/commands/segment-fields-command.js +1 -1
  34. package/dist/commands/segment-pull-command.js +1 -1
  35. package/dist/commands/segment-push-command.js +1 -1
  36. package/dist/commands/segment-push-command.js.map +1 -1
  37. package/dist/commands/segment-update-command.js +1 -1
  38. package/dist/commands/segment-use-command.js +1 -1
  39. package/dist/commands/segment-validate-command.js +1 -1
  40. package/dist/commands/segments.js +1 -1
  41. package/dist/commands/show.js +1 -1
  42. package/dist/commands/tables.js +1 -1
  43. package/dist/commands/use-command.js +1 -1
  44. package/dist/commands/user-command.js +1 -1
  45. package/dist/commands/workflow-command.d.ts +37 -0
  46. package/dist/commands/workflow-command.d.ts.map +1 -1
  47. package/dist/commands/workflow-command.js +1 -1
  48. package/dist/commands/workflow-command.js.map +1 -1
  49. package/dist/core/auth.js +1 -1
  50. package/dist/core/command-output.js +1 -1
  51. package/dist/core/config.js +1 -1
  52. package/dist/core/connection-cache.js +1 -1
  53. package/dist/core/constants.js +1 -1
  54. package/dist/core/credential-cache.js +1 -1
  55. package/dist/core/global-context.js +1 -1
  56. package/dist/core/keychain.js +1 -1
  57. package/dist/core/profile.js +1 -1
  58. package/dist/core/project-config.js +1 -1
  59. package/dist/core/session.js +1 -1
  60. package/dist/core/user-cache.js +1 -1
  61. package/dist/core/version.js +1 -1
  62. package/dist/index.js +1 -1
  63. package/dist/proxy/anthropic-adapter.js +1 -1
  64. package/dist/proxy/claude-usage-tracker.js +1 -1
  65. package/dist/proxy/context-signature.js +1 -1
  66. package/dist/proxy/conversation-utils.js +1 -1
  67. package/dist/proxy/server.js +1 -1
  68. package/dist/proxy/session-cache.js +1 -1
  69. package/dist/sdk/agent/agent-config.js +1 -1
  70. package/dist/sdk/agent/agent-ref-parser.js +1 -1
  71. package/dist/sdk/agent/agent-yaml.js +1 -1
  72. package/dist/sdk/api.js +1 -1
  73. package/dist/sdk/client/cdp-api-client.js +1 -1
  74. package/dist/sdk/client/endpoints.js +1 -1
  75. package/dist/sdk/client/engage-api-client.js +1 -1
  76. package/dist/sdk/client/http-client.js +1 -1
  77. package/dist/sdk/client/llm-api-client.js +1 -1
  78. package/dist/sdk/client/rate-limiter.js +1 -1
  79. package/dist/sdk/client/td-api-client.js +1 -1
  80. package/dist/sdk/client/trino-api-client.js +1 -1
  81. package/dist/sdk/client/workflow-client.js +1 -1
  82. package/dist/sdk/connection-validator.js +1 -1
  83. package/dist/sdk/connection.js +1 -1
  84. package/dist/sdk/engage.js +1 -1
  85. package/dist/sdk/errors.js +1 -1
  86. package/dist/sdk/index.js +1 -1
  87. package/dist/sdk/io/index.js +1 -1
  88. package/dist/sdk/io/node-filesystem.js +1 -1
  89. package/dist/sdk/job.js +1 -1
  90. package/dist/sdk/journey.d.ts +19 -3
  91. package/dist/sdk/journey.d.ts.map +1 -1
  92. package/dist/sdk/journey.js +1 -1
  93. package/dist/sdk/journey.js.map +1 -1
  94. package/dist/sdk/llm/chat-cache.js +1 -1
  95. package/dist/sdk/llm/index.js +1 -1
  96. package/dist/sdk/llm/llm-backup-utils.js +1 -1
  97. package/dist/sdk/llm/model-aliases.js +1 -1
  98. package/dist/sdk/llm/model-factors.js +1 -1
  99. package/dist/sdk/query/index.js +1 -1
  100. package/dist/sdk/query/sql-parser.js +1 -1
  101. package/dist/sdk/segment/child-segment-yaml.js +1 -1
  102. package/dist/sdk/segment/fields-display.js +1 -1
  103. package/dist/sdk/segment/file-discovery.js +1 -1
  104. package/dist/sdk/segment/journey-utils.js +1 -1
  105. package/dist/sdk/segment/journey-yaml.js +1 -1
  106. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  107. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  108. package/dist/sdk/segment/pull-workflow.d.ts.map +1 -1
  109. package/dist/sdk/segment/pull-workflow.js +1 -1
  110. package/dist/sdk/segment/pull-workflow.js.map +1 -1
  111. package/dist/sdk/segment/push-workflow.js +1 -1
  112. package/dist/sdk/segment/resolution-context.js +1 -1
  113. package/dist/sdk/segment/segment-path-parser.js +1 -1
  114. package/dist/sdk/segment/segment-ref-parser.js +1 -1
  115. package/dist/sdk/segment/target-resolution.js +1 -1
  116. package/dist/sdk/segment/tdx-config.js +1 -1
  117. package/dist/sdk/segment/validate-files.js +1 -1
  118. package/dist/sdk/segment/yaml-validator.js +1 -1
  119. package/dist/sdk/segment.js +1 -1
  120. package/dist/sdk/types/index.js +1 -1
  121. package/dist/sdk/types/progress.js +1 -1
  122. package/dist/sdk/user.js +1 -1
  123. package/dist/sdk/util/format-detector.js +1 -1
  124. package/dist/sdk/util/formatters.js +1 -1
  125. package/dist/sdk/util/index.js +1 -1
  126. package/dist/sdk/util/tree-formatter.js +1 -1
  127. package/dist/sdk/workflow/clone-workflow.js +1 -1
  128. package/dist/sdk/workflow/index.d.ts +1 -1
  129. package/dist/sdk/workflow/index.d.ts.map +1 -1
  130. package/dist/sdk/workflow/index.js +1 -1
  131. package/dist/sdk/workflow/index.js.map +1 -1
  132. package/dist/sdk/workflow/pull-workflow.js +1 -1
  133. package/dist/sdk/workflow/push-workflow.js +1 -1
  134. package/dist/sdk/workflow/tdx-config.js +1 -1
  135. package/dist/sdk/workflow/workflow-utils.js +1 -1
  136. package/dist/utils/async.js +1 -1
  137. package/dist/utils/colors.js +1 -1
  138. package/dist/utils/diff.js +1 -1
  139. package/dist/utils/file-permissions.js +1 -1
  140. package/dist/utils/json-loader.js +1 -1
  141. package/dist/utils/option-validation.js +1 -1
  142. package/dist/utils/port.js +1 -1
  143. package/dist/utils/process.js +1 -1
  144. package/dist/utils/prompt.js +1 -1
  145. package/dist/utils/spinner.js +1 -1
  146. package/dist/utils/sse-parser.js +1 -1
  147. package/dist/utils/string-utils.js +1 -1
  148. package/dist/utils/table-ref-parser.js +1 -1
  149. package/dist/utils/tdx-logger.js +1 -1
  150. package/dist/utils/version-check.js +1 -1
  151. 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_0x2cdd56=a22_0x53db;(function(_0x114d9e,_0x261f9b){const _0x4114e8=a22_0x53db,_0xe400a9=_0x114d9e();while(!![]){try{const _0xc27b1e=parseInt(_0x4114e8(0x140))/0x1*(-parseInt(_0x4114e8(0x130))/0x2)+parseInt(_0x4114e8(0x11b))/0x3*(parseInt(_0x4114e8(0x125))/0x4)+parseInt(_0x4114e8(0xf5))/0x5*(-parseInt(_0x4114e8(0x115))/0x6)+parseInt(_0x4114e8(0xf1))/0x7+-parseInt(_0x4114e8(0x13e))/0x8*(-parseInt(_0x4114e8(0x117))/0x9)+parseInt(_0x4114e8(0x14f))/0xa+-parseInt(_0x4114e8(0x121))/0xb;if(_0xc27b1e===_0x261f9b)break;else _0xe400a9['push'](_0xe400a9['shift']());}catch(_0x2cf97c){_0xe400a9['push'](_0xe400a9['shift']());}}}(a22_0x1a78,0x5925a));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';function a22_0x1a78(){const _0x264256=['error','value','Changing\x20site\x20to\x20\x27','\x20Profile\x20\x27','Site\x20name\x20must\x20contain\x20only\x20lowercase\x20letters,\x20numbers,\x20and\x20hyphens','API\x20key\x20cannot\x20be\x20empty','\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication','Session\x20profile\x20set\x20to:\x20','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20remove\x20<name>','create','us01','\x0aTip:\x20Use\x20\x27tdx\x20use\x20--clear\x27\x20to\x20clear\x20session\x20overrides','\x0aSetup\x20cancelled','\x0aYou\x20can\x20find\x20your\x20API\x20key\x20at:','Profile\x20\x27','You\x20can\x20now\x20use\x20tdx\x20commands\x20with\x20this\x20profile.\x20Try:','\x20\x20tdx\x20--profile\x20','confirm','4832163iasVVZ','profile:create','push','eu\x20\x20\x20-\x20Europe','54445kDqnCK','✗\x20Validation\x20failed:\x20','jp\x20\x20\x20-\x20Japan','Site\x20name\x20cannot\x20be\x20empty','Select\x20Treasure\x20Data\x20site\x20for\x20profile\x20\x27','toString','Key=value\x20pair\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','description','session','Enter\x20site\x20name:','customSite','ap02','bold','validate','execute','profile','jobs','select','yellow','You\x20can\x20find\x20your\x20API\x20key\x20at:','red','Profile\x20was\x20not\x20created.\x20Please\x20try\x20again.','\x27\x20removed\x20from\x20configuration','split','Profile\x20name\x20must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore','Remove\x20a\x20profile','\x27\x20does\x20not\x20exist.\x20Create\x20it?','other','jp01','getUserInfo','text','log','108VEpJye','\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases','2477016nZLAQd','ERROR','(session:\x20','\x20API\x20key\x20saved\x20to\x20system\x20keychain','17058bucNce','llm_project','(cleared)','warn','test','site','9661707xvHNTA','status','Are\x20you\x20sure\x20you\x20want\x20to\x20remove\x20profile\x20\x27','\x0aAvailable\x20profiles:','188JfYGJJ','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>','profile:remove','includes','\x27\x20does\x20not\x20exist.','\x20\x20(no\x20profiles\x20found)','apiKey','\x20API\x20key\x20is\x20valid\x20(User:\x20','name','length','Profile\x20name\x20cannot\x20be\x20empty','10IBTFTj','Failed\x20to\x20remove\x20profile:\x20','join','\x20API\x20key\x20removed\x20from\x20system\x20keychain','password','profile:use','Site\x20was\x20not\x20changed.','trim','VALID_KEYS','profile:set','\x20\x20-\x20','/app/mp/ak','\x27.\x0a\x0aValid\x20keys:\x20','email','8nXumHF','us\x20\x20\x20-\x20United\x20States','38342gZdaso','Removal\x20cancelled','\x20API\x20key\x20saved\x20to\x20system\x20keychain\x20(profile:\x20','green','eu01','logLevel','message','config','tdx:\x20profile\x20set','dim','tdx:\x20profile\x20remove','Set\x20session\x20profile','Set\x20a\x20profile\x20configuration\x20value','Create\x20a\x20new\x20profile\x20interactively','profileName','3984200RKQnAu','Enter\x20description\x20(optional):','Validating\x20API\x20key...'];a22_0x1a78=function(){return _0x264256;};return a22_0x1a78();}import{HTTPClientError}from'../sdk/client/http-client.js';function a22_0x53db(_0x4d18bd,_0x102cab){_0x4d18bd=_0x4d18bd-0xee;const _0x1a78a2=a22_0x1a78();let _0x53dbc4=_0x1a78a2[_0x4d18bd];return _0x53dbc4;}import{TDX}from'../sdk/index.js';import{LogLevel}from'../utils/tdx-logger.js';import a22_0x3b4c16 from'prompts';import a22_0x4528d7 from'chalk';export class ProfileCreateCommand extends BaseCommand{['name']=a22_0x2cdd56(0xf2);[a22_0x2cdd56(0xfc)]=a22_0x2cdd56(0x14d);async[a22_0x2cdd56(0x103)](_0x2254b8){const _0x1fc503=a22_0x2cdd56,{options:_0x30bee4}=_0x2254b8;console[_0x1fc503(0x114)](a22_0x4528d7['bold']('tdx:\x20profile\x20create'));const _0xb65455=await a22_0x3b4c16({'type':'text','name':_0x1fc503(0x14e),'message':'Enter\x20profile\x20name:','validate':_0x20c84c=>{const _0x1d9955=_0x1fc503;if(!_0x20c84c||!_0x20c84c[_0x1d9955(0x137)]())return _0x1d9955(0x12f);if(!/^[a-zA-Z0-9_-]+$/['test'](_0x20c84c[_0x1d9955(0x137)]()))return _0x1d9955(0x10d);if(profileExists(_0x20c84c[_0x1d9955(0x137)]()))return'Profile\x20\x27'+_0x20c84c[_0x1d9955(0x137)]()+'\x27\x20already\x20exists.\x20Use\x20\x27tdx\x20profile\x20set\x27\x20to\x20modify\x20it.';return!![];}});if(!_0xb65455[_0x1fc503(0x14e)])return console['log'](_0x1fc503(0x15e)),0x1;const _0x3aefcc=_0xb65455[_0x1fc503(0x14e)][_0x1fc503(0x137)](),_0x120e28=await a22_0x3b4c16({'type':_0x1fc503(0x113),'name':'description','message':_0x1fc503(0x150)}),_0x9b4573=_0x120e28[_0x1fc503(0xfc)]?.[_0x1fc503(0x137)]()||undefined,_0x306d83=_0x30bee4['site']||_0x1fc503(0x15c),_0x210713=[{'title':_0x1fc503(0x13f),'value':_0x1fc503(0x15c)},{'title':_0x1fc503(0xf7),'value':_0x1fc503(0x111)},{'title':_0x1fc503(0xf4),'value':_0x1fc503(0x144)},{'title':'ap02\x20-\x20Korea','value':_0x1fc503(0x100)}];let _0x1c701a=_0x210713['findIndex'](_0x115b6a=>_0x115b6a[_0x1fc503(0x153)]===_0x306d83);_0x1c701a===-0x1&&_0x306d83!==_0x1fc503(0x15c)&&(_0x210713['push']({'title':_0x306d83,'value':_0x306d83}),_0x1c701a=_0x210713[_0x1fc503(0x12e)]-0x1);_0x210713[_0x1fc503(0xf3)]({'title':'Enter\x20custom\x20site','value':_0x1fc503(0x110)});const _0x207a74=await a22_0x3b4c16({'type':_0x1fc503(0x106),'name':_0x1fc503(0x120),'message':_0x1fc503(0xf9)+_0x3aefcc+'\x27:','choices':_0x210713,'initial':_0x1c701a>=0x0?_0x1c701a:0x0});if(!_0x207a74[_0x1fc503(0x120)])return console[_0x1fc503(0x114)](_0x1fc503(0x15e)),0x1;let _0x3ee8f6;if(_0x207a74[_0x1fc503(0x120)]===_0x1fc503(0x110)){const _0x41406b=await a22_0x3b4c16({'type':_0x1fc503(0x113),'name':'customSite','message':_0x1fc503(0xfe),'initial':_0x1fc503(0x15c),'validate':_0x115028=>{const _0x43bd26=_0x1fc503;if(!_0x115028||!_0x115028[_0x43bd26(0x137)]())return _0x43bd26(0xf8);if(!/^[a-z0-9-]+$/[_0x43bd26(0x11f)](_0x115028['trim']()))return _0x43bd26(0x156);return!![];}});if(!_0x41406b['customSite'])return console[_0x1fc503(0x114)]('\x0aSetup\x20cancelled'),0x1;_0x3ee8f6=_0x41406b[_0x1fc503(0xff)];}else _0x3ee8f6=_0x207a74[_0x1fc503(0x120)];const _0x2d0d94=resolveSite(_0x3ee8f6);console[_0x1fc503(0x114)]('\x0aSetting\x20up\x20authentication\x20for\x20site:\x20'+_0x2d0d94),console[_0x1fc503(0x114)](_0x1fc503(0x108)),console[_0x1fc503(0x114)]('\x20\x20'+getConsoleUrl(_0x2d0d94,_0x1fc503(0x13b)));const _0x566f07=await a22_0x3b4c16({'type':_0x1fc503(0x134),'name':_0x1fc503(0x12b),'message':'Enter\x20your\x20TD\x20API\x20key:','validate':_0x58706f=>{const _0x17b7f5=_0x1fc503;if(!_0x58706f||!_0x58706f[_0x17b7f5(0x137)]())return _0x17b7f5(0x157);return!![];}});if(!_0x566f07['apiKey'])return console['log'](_0x1fc503(0x15e)),0x1;const _0x1931a8=_0x566f07[_0x1fc503(0x12b)];console['log'](_0x1fc503(0x151));try{const _0x6bb142=TDX['create']({'site':_0x2d0d94,'apiKey':_0x1931a8[_0x1fc503(0x137)](),'logLevel':_0x30bee4[_0x1fc503(0x145)]??LogLevel[_0x1fc503(0x118)]}),_0x5bf01a=await _0x6bb142[_0x1fc503(0x105)][_0x1fc503(0x112)]();console[_0x1fc503(0x114)](a22_0x4528d7[_0x1fc503(0x143)]('✓')+'\x20API\x20key\x20is\x20valid\x20(User:\x20'+_0x5bf01a[_0x1fc503(0x13d)]+')');const _0x3b32ca=await isKeychainAvailable();_0x3b32ca?(await saveAPIKeyAsync(_0x1931a8[_0x1fc503(0x137)](),_0x2d0d94,_0x3aefcc),console[_0x1fc503(0x114)](a22_0x4528d7[_0x1fc503(0x143)]('✓')+_0x1fc503(0x142)+_0x3aefcc+')')):(console[_0x1fc503(0x11e)](a22_0x4528d7['yellow']('⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.')),console[_0x1fc503(0x11e)](a22_0x4528d7[_0x1fc503(0x107)]('\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.')));const _0x1531fe={'site':_0x2d0d94,..._0x9b4573&&{'description':_0x9b4573}};return saveProfileToUserConfig(_0x3aefcc,_0x1531fe),console['log'](a22_0x4528d7[_0x1fc503(0x143)]('✓')+_0x1fc503(0x155)+_0x3aefcc+'\x27\x20created'),console['log'](),console[_0x1fc503(0x114)](_0x1fc503(0xee)),console[_0x1fc503(0x114)](_0x1fc503(0xef)+_0x3aefcc+_0x1fc503(0x158)),console[_0x1fc503(0x114)](_0x1fc503(0xef)+_0x3aefcc+_0x1fc503(0x116)),0x0;}catch(_0x4287b9){if(_0x4287b9 instanceof HTTPClientError&&_0x4287b9[_0x1fc503(0x122)]===0x191)return printAuthError(_0x4287b9),0x1;return console[_0x1fc503(0x152)](a22_0x4528d7['red']('✗\x20Validation\x20failed:\x20'+(_0x4287b9 instanceof Error?_0x4287b9[_0x1fc503(0x146)]:String(_0x4287b9)))),console['error'](_0x1fc503(0x10a)),0x1;}}}export class ProfileRemoveCommand extends BaseCommand{['name']=a22_0x2cdd56(0x127);[a22_0x2cdd56(0xfc)]=a22_0x2cdd56(0x10e);['validate'](_0x9ab473){const _0x1cffe4=a22_0x2cdd56,{args:_0x4bb6f1}=_0x9ab473;if(_0x4bb6f1[_0x1cffe4(0x12e)]===0x0)return _0x1cffe4(0x15a);return undefined;}async[a22_0x2cdd56(0x103)](_0x3184bc){const _0x2cef55=a22_0x2cdd56,{args:_0x1cb192}=_0x3184bc,_0x118ff3=_0x1cb192[0x0];console['log'](a22_0x4528d7[_0x2cef55(0x101)](_0x2cef55(0x14a)));if(!profileExists(_0x118ff3)){console['error'](a22_0x4528d7[_0x2cef55(0x109)](_0x2cef55(0x160)+_0x118ff3+_0x2cef55(0x129))),console[_0x2cef55(0x114)]('\x0aAvailable\x20profiles:');const _0x587bbb=listProfiles();if(_0x587bbb[_0x2cef55(0x12e)]===0x0)console[_0x2cef55(0x114)](_0x2cef55(0x12a));else for(const _0x203690 of _0x587bbb){console[_0x2cef55(0x114)]('\x20\x20-\x20'+_0x203690[_0x2cef55(0x12d)]);}return 0x1;}const _0x16912e=await a22_0x3b4c16({'type':_0x2cef55(0xf0),'name':_0x2cef55(0xf0),'message':_0x2cef55(0x123)+_0x118ff3+'\x27?','initial':![]});if(!_0x16912e[_0x2cef55(0xf0)])return console[_0x2cef55(0x114)](_0x2cef55(0x141)),0x0;try{removeProfileFromUserConfig(_0x118ff3),console['log'](a22_0x4528d7[_0x2cef55(0x143)]('✓')+'\x20Profile\x20\x27'+_0x118ff3+_0x2cef55(0x10b));}catch(_0x573108){return console[_0x2cef55(0x152)](a22_0x4528d7[_0x2cef55(0x109)](_0x2cef55(0x131)+(_0x573108 instanceof Error?_0x573108[_0x2cef55(0x146)]:String(_0x573108)))),0x1;}const _0x5618e9=await isKeychainAvailable();if(_0x5618e9){const _0x2ef248=await deleteKeychainAPIKey(_0x118ff3);_0x2ef248&&console['log'](a22_0x4528d7['green']('✓')+_0x2cef55(0x133));}return 0x0;}}export class ProfileSetCommand extends BaseCommand{[a22_0x2cdd56(0x12d)]=a22_0x2cdd56(0x139);['description']=a22_0x2cdd56(0x14c);static ['VALID_KEYS']=[a22_0x2cdd56(0x120),'database','parent_segment',a22_0x2cdd56(0x11c),'llm_agent','description'];[a22_0x2cdd56(0x102)](_0x43a935){const _0x37a325=a22_0x2cdd56,{args:_0x32cef8,options:_0x1fda4f}=_0x43a935,_0x1b6b77=_0x1fda4f[_0x37a325(0x104)]||getActiveProfile();if(!_0x1b6b77)return _0x37a325(0x126);if(_0x32cef8[_0x37a325(0x12e)]===0x0)return _0x37a325(0xfb)+ProfileSetCommand[_0x37a325(0x138)][_0x37a325(0x132)](',\x20');const _0x55abc7=_0x32cef8[0x0];if(!_0x55abc7['includes']('='))return'Invalid\x20format.\x20Use:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20'+ProfileSetCommand[_0x37a325(0x138)][_0x37a325(0x132)](',\x20');const [_0x15b7c6]=_0x55abc7[_0x37a325(0x10c)]('=',0x2);if(!ProfileSetCommand[_0x37a325(0x138)][_0x37a325(0x128)](_0x15b7c6))return'Unknown\x20key\x20\x27'+_0x15b7c6+_0x37a325(0x13c)+ProfileSetCommand[_0x37a325(0x138)]['join'](',\x20');return undefined;}async[a22_0x2cdd56(0x103)](_0x5416c4){const _0x2acd09=a22_0x2cdd56,{args:_0x1b8781,options:_0x4e0a78}=_0x5416c4,_0x1208d4=_0x4e0a78[_0x2acd09(0x104)]||getActiveProfile(),[_0x16bf21,..._0x48352e]=_0x1b8781[0x0][_0x2acd09(0x10c)]('='),_0x27206e=_0x48352e[_0x2acd09(0x132)]('=');console[_0x2acd09(0x114)](a22_0x4528d7[_0x2acd09(0x101)](_0x2acd09(0x148)));if(!profileExists(_0x1208d4)){const _0x51b879=await a22_0x3b4c16({'type':_0x2acd09(0xf0),'name':_0x2acd09(0x15b),'message':_0x2acd09(0x160)+_0x1208d4+_0x2acd09(0x10f),'initial':!![]});if(!_0x51b879[_0x2acd09(0x15b)])return console['log']('Operation\x20cancelled'),0x1;}const _0x43d522=loadProfile(_0x1208d4),_0x87b63c=_0x43d522?.[_0x2acd09(0x147)]||{};if(_0x16bf21===_0x2acd09(0x120)){const _0xa4e483=resolveSite(_0x27206e);console['log'](_0x2acd09(0x154)+_0xa4e483+'\x27\x20requires\x20API\x20key\x20validation.'),console[_0x2acd09(0x114)](_0x2acd09(0x15f)),console[_0x2acd09(0x114)]('\x20\x20'+getConsoleUrl(_0xa4e483,_0x2acd09(0x13b)));const _0x1cc594=await a22_0x3b4c16({'type':_0x2acd09(0x134),'name':_0x2acd09(0x12b),'message':'Enter\x20your\x20TD\x20API\x20key\x20for\x20the\x20new\x20site:','validate':_0x56751b=>{const _0x441f3a=_0x2acd09;if(!_0x56751b||!_0x56751b[_0x441f3a(0x137)]())return'API\x20key\x20cannot\x20be\x20empty';return!![];}});if(!_0x1cc594['apiKey'])return console[_0x2acd09(0x114)]('\x0aOperation\x20cancelled'),0x1;console['log']('Validating\x20API\x20key...');try{const _0xb5e0fb=TDX[_0x2acd09(0x15b)]({'site':_0xa4e483,'apiKey':_0x1cc594[_0x2acd09(0x12b)][_0x2acd09(0x137)](),'logLevel':_0x4e0a78[_0x2acd09(0x145)]??LogLevel[_0x2acd09(0x118)]}),_0x96c118=await _0xb5e0fb[_0x2acd09(0x105)][_0x2acd09(0x112)]();console[_0x2acd09(0x114)](a22_0x4528d7['green']('✓')+_0x2acd09(0x12c)+_0x96c118[_0x2acd09(0x13d)]+')');const _0x29aa96=await isKeychainAvailable();_0x29aa96?(await saveAPIKeyAsync(_0x1cc594[_0x2acd09(0x12b)][_0x2acd09(0x137)](),_0xa4e483,_0x1208d4),console['log'](a22_0x4528d7[_0x2acd09(0x143)]('✓')+_0x2acd09(0x11a))):console[_0x2acd09(0x11e)](a22_0x4528d7[_0x2acd09(0x107)]('⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.')),_0x87b63c[_0x2acd09(0x120)]=_0xa4e483;}catch(_0x5e1ffe){if(_0x5e1ffe instanceof HTTPClientError&&_0x5e1ffe['status']===0x191)return printAuthError(_0x5e1ffe),0x1;return console[_0x2acd09(0x152)](a22_0x4528d7[_0x2acd09(0x109)](_0x2acd09(0xf6)+(_0x5e1ffe instanceof Error?_0x5e1ffe[_0x2acd09(0x146)]:String(_0x5e1ffe)))),console[_0x2acd09(0x152)](_0x2acd09(0x136)),0x1;}}else _0x87b63c[_0x16bf21]=_0x27206e||undefined;return saveProfileToUserConfig(_0x1208d4,_0x87b63c),console[_0x2acd09(0x114)](a22_0x4528d7[_0x2acd09(0x143)]('✓')+'\x20Profile\x20\x27'+_0x1208d4+'\x27\x20updated:\x20'+_0x16bf21+'='+(_0x27206e||_0x2acd09(0x11d))),0x0;}}export class ProfileUseCommand extends BaseCommand{[a22_0x2cdd56(0x12d)]=a22_0x2cdd56(0x135);['description']=a22_0x2cdd56(0x14b);[a22_0x2cdd56(0x102)](_0x32869f){const _0x4cee34=a22_0x2cdd56,{args:_0x54ac44}=_0x32869f;if(_0x54ac44[_0x4cee34(0x12e)]===0x0)return'Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20use\x20<name>';return undefined;}async[a22_0x2cdd56(0x103)](_0x401157){const _0x163ac6=a22_0x2cdd56,{args:_0x2b75a9,options:_0x5e1ed4}=_0x401157,_0x13e407=_0x2b75a9[0x0];cleanExpiredSessions();if(!profileExists(_0x13e407)){console['error'](a22_0x4528d7[_0x163ac6(0x109)](_0x163ac6(0x160)+_0x13e407+_0x163ac6(0x129))),console[_0x163ac6(0x114)](_0x163ac6(0x124));const _0x34ff7b=listProfiles();if(_0x34ff7b[_0x163ac6(0x12e)]===0x0)console[_0x163ac6(0x114)]('\x20\x20(no\x20profiles\x20found)');else for(const _0xe0d53 of _0x34ff7b){console[_0x163ac6(0x114)](_0x163ac6(0x13a)+_0xe0d53[_0x163ac6(0x12d)]);}return 0x1;}const _0xb9fdbd=_0x5e1ed4[_0x163ac6(0xfd)]||getCurrentSessionPID()[_0x163ac6(0xfa)]();return saveSessionContext({'profile':_0x13e407},_0x5e1ed4[_0x163ac6(0xfd)]),console[_0x163ac6(0x114)](_0x163ac6(0x159)+a22_0x4528d7[_0x163ac6(0x143)](_0x13e407)+'\x20'+a22_0x4528d7[_0x163ac6(0x149)](_0x163ac6(0x119)+_0xb9fdbd+')')),console[_0x163ac6(0x114)](a22_0x4528d7['dim'](_0x163ac6(0x15d))),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_0x5bb0b0=a23_0xfd71;function a23_0xfd71(_0x3995c9,_0x606d09){_0x3995c9=_0x3995c9-0x127;const _0x98e1d5=a23_0x98e1();let _0xfd715=_0x98e1d5[_0x3995c9];return _0xfd715;}function a23_0x98e1(){const _0x4d5d8e=['name','List\x20all\x20available\x20profiles','error','7DnymiN','scope','4824eUYdxI','3DxyiRF','log','19310CrcvXb','\x20\x20Global:\x20~/.config/tdx/tdx.json','2710790eBvLQJ','6586290WkmNbM','description','232477LsYsdV','execute','No\x20profiles\x20found.\x20Define\x20profiles\x20in\x20tdx.json:\x0a','5133932RlDuJM','message','8997486RQVYya','11423720vYDHeC','Error:\x20','\x20\x20Local:\x20\x20(project\x20folder)/tdx.json','config'];a23_0x98e1=function(){return _0x4d5d8e;};return a23_0x98e1();}(function(_0x4f6fd8,_0x5dcb6e){const _0x2e2868=a23_0xfd71,_0x5ba9e6=_0x4f6fd8();while(!![]){try{const _0x556a16=parseInt(_0x2e2868(0x13b))/0x1+-parseInt(_0x2e2868(0x138))/0x2*(parseInt(_0x2e2868(0x134))/0x3)+-parseInt(_0x2e2868(0x127))/0x4+parseInt(_0x2e2868(0x139))/0x5+parseInt(_0x2e2868(0x129))/0x6*(parseInt(_0x2e2868(0x131))/0x7)+parseInt(_0x2e2868(0x12a))/0x8+-parseInt(_0x2e2868(0x133))/0x9*(parseInt(_0x2e2868(0x136))/0xa);if(_0x556a16===_0x5dcb6e)break;else _0x5ba9e6['push'](_0x5ba9e6['shift']());}catch(_0x451766){_0x5ba9e6['push'](_0x5ba9e6['shift']());}}}(a23_0x98e1,0xc423b));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_0x5bb0b0(0x12e)]='profiles';[a23_0x5bb0b0(0x13a)]=a23_0x5bb0b0(0x12f);async[a23_0x5bb0b0(0x13c)](_0xcdb24f){const _0x1e547e=a23_0x5bb0b0,{options:_0x586975}=_0xcdb24f;try{const _0x5c586c=listProfiles(),_0x48be45=getActiveProfile();if(_0x5c586c['length']===0x0)return console['log'](_0x1e547e(0x13d)),console['log'](_0x1e547e(0x12c)),console[_0x1e547e(0x135)](_0x1e547e(0x137)),0x0;const _0x340312=_0x5c586c['map'](_0x67deb3=>{const _0x3a26d4=_0x1e547e,_0x392b11=_0x67deb3[_0x3a26d4(0x12e)]===_0x48be45,_0x3f99b0=getProfileParams(_0x67deb3[_0x3a26d4(0x12d)]);return{'name':_0x67deb3[_0x3a26d4(0x12e)],'active':_0x392b11,'scope':_0x67deb3[_0x3a26d4(0x132)],'description':_0x67deb3[_0x3a26d4(0x12d)]['description']||'','params':_0x3f99b0};});return await handleSDKOutput(_0x340312,_0x586975),0x0;}catch(_0x3aedb5){return _0x3aedb5 instanceof Error&&console[_0x1e547e(0x130)](_0x1e547e(0x12b)+_0x3aedb5[_0x1e547e(0x128)]),0x1;}}}
@@ -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_0x585722=a24_0x25ea;function a24_0x25ea(_0x4e734f,_0x17cebc){_0x4e734f=_0x4e734f-0x18c;const _0x3fa6dd=a24_0x3fa6();let _0x25ea1a=_0x3fa6dd[_0x4e734f];return _0x25ea1a;}(function(_0x4fdcc7,_0x107958){const _0x48f0cd=a24_0x25ea,_0x24cba3=_0x4fdcc7();while(!![]){try{const _0x2ee585=-parseInt(_0x48f0cd(0x196))/0x1+parseInt(_0x48f0cd(0x1b3))/0x2+-parseInt(_0x48f0cd(0x198))/0x3+parseInt(_0x48f0cd(0x1a7))/0x4*(-parseInt(_0x48f0cd(0x193))/0x5)+-parseInt(_0x48f0cd(0x192))/0x6+-parseInt(_0x48f0cd(0x1b0))/0x7+parseInt(_0x48f0cd(0x1a5))/0x8;if(_0x2ee585===_0x107958)break;else _0x24cba3['push'](_0x24cba3['shift']());}catch(_0x302154){_0x24cba3['push'](_0x24cba3['shift']());}}}(a24_0x3fa6,0x5c5c6));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';function a24_0x3fa6(){const _0x303fbc=['Run\x20Trino\x20queries\x20(streaming)','originalMessage','setJobId','No\x20SQL\x20provided','\x20-\x20','validate','1072169sJiSYt','in\x20','Error:\x20','998324OqaKWw','\x20[Job\x20ID:\x20','file','Executing\x20query\x20[','output','Site:\x20','completedSplits','verbose','Executing\x20query...','processedRows','SQL:\x20','jobId','join','length','args','3394872tmrQZE','2805zFvgAt','catalog','\x20splits','34742iqAJOH','Statement\x20','1025016MGHJsi','\x0aAll\x20results\x20saved\x20to\x20','totalSplits','message','stats','...','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','error','execute','\x20rows\x20','elapsedTimeMillis','Cannot\x20specify\x20both\x20SQL\x20argument\x20and\x20--file\x20option','7809792TIUYxB','database','12TQiSGS','query','Schema:\x20'];a24_0x3fa6=function(){return _0x303fbc;};return a24_0x3fa6();}import{formatRows}from'../sdk/util/formatters.js';export class QueryCommand extends BaseCommand{['name']=a24_0x585722(0x1a8);[a24_0x585722(0x19e)]=a24_0x585722(0x1aa);async[a24_0x585722(0x1a1)](_0x24da6c){const _0x580ac5=a24_0x585722,{options:_0x2a9607,args:_0x5c1572,tdx:_0x10f591}=_0x24da6c,_0x51adf5=_0x5c1572[0x0],_0x313970=_0x2a9607[_0x580ac5(0x1b5)];let _0x4e2e71;try{if(_0x313970)_0x4e2e71=readSqlStatementsFromFile(_0x313970);else{if(_0x51adf5==='-')_0x4e2e71=await readSqlStatementsFromStdin();else{if(_0x51adf5&&isSqlFilePath(_0x51adf5))_0x4e2e71=readSqlStatementsFromFile(_0x51adf5);else{if(_0x51adf5)_0x4e2e71=splitSqlStatements(_0x51adf5);else throw new Error(_0x580ac5(0x1ad));}}}}catch(_0x506d19){return console[_0x580ac5(0x1a0)](_0x580ac5(0x1b2)+_0x506d19['message']),0x1;}const _0x119a48=_0x2a9607[_0x580ac5(0x1a6)]||'information_schema',_0x33ac6e=_0x2a9607[_0x580ac5(0x194)];try{const _0x211690=[],_0x389333=!!_0x2a9607[_0x580ac5(0x1b7)];for(let _0x39972f=0x0;_0x39972f<_0x4e2e71['length'];_0x39972f++){const _0x4d1c1f=_0x4e2e71[_0x39972f],_0x36478d=_0x39972f+0x1,_0x172d65=_0x4e2e71[_0x580ac5(0x190)],_0x3c1b14=_0x172d65>0x1;_0x2a9607['verbose']&&(console['error']('\x0a'+(_0x3c1b14?_0x580ac5(0x197)+_0x36478d+'/'+_0x172d65+':':'')),console[_0x580ac5(0x1a0)](_0x580ac5(0x1b8)+_0x2a9607['site']),console[_0x580ac5(0x1a0)]('Catalog:\x20'+(_0x33ac6e||'td')),console[_0x580ac5(0x1a0)](_0x580ac5(0x1a9)+_0x119a48),console[_0x580ac5(0x1a0)](_0x580ac5(0x18d)+_0x4d1c1f));const _0x5d221f=_0x3c1b14?'Executing\x20statement\x20'+_0x36478d+'/'+_0x172d65+_0x580ac5(0x19d):_0x580ac5(0x1bb);try{const _0x49a91c=await withProgressSpinner(_0x5d221f,async _0x2aadc5=>{const _0xf7500b=_0x580ac5,_0x48c693=await _0x10f591['query'][_0xf7500b(0x1a1)](_0x4d1c1f,{'catalog':_0x33ac6e,'schema':_0x119a48,'onJobId':_0x3c237c=>{const _0x209bd1=_0xf7500b;_0x2aadc5[_0x209bd1(0x1ac)](_0x3c237c);},'onProgress':_0x2e2e6a=>{const _0xd51a3b=_0xf7500b;_0x2aadc5['setPhase'](_0xd51a3b(0x1b6)+_0x2e2e6a['state']+']'),_0x2aadc5['setExtra'](formatRows(_0x2e2e6a[_0xd51a3b(0x18c)])+_0xd51a3b(0x1a2)+_0x2e2e6a[_0xd51a3b(0x1b9)]+'/'+_0x2e2e6a[_0xd51a3b(0x19a)]+_0xd51a3b(0x195));}});return _0x48c693;},{'verbose':_0x2a9607[_0x580ac5(0x1ba)]}),_0xd2249d=_0x49a91c['data'],_0x2905bf=_0xd2249d[_0x580ac5(0x18e)]?_0x580ac5(0x1b4)+_0xd2249d[_0x580ac5(0x18e)]+']':'',_0x58ba19=_0x3c1b14?_0x580ac5(0x197)+_0x36478d+'/'+_0x172d65+_0x580ac5(0x1ae):'';console[_0x580ac5(0x1a0)]('✔\x20'+_0x58ba19+'Query\x20completed:\x20Processed\x20'+formatRows(_0xd2249d[_0x580ac5(0x19c)][_0x580ac5(0x18c)])+'\x20rows\x20'+(_0x580ac5(0x1b1)+formatElapsed(_0xd2249d[_0x580ac5(0x19c)][_0x580ac5(0x1a3)])+_0x2905bf));if(_0x3c1b14&&_0x389333){const _0x4039b9=resolveOutputOptions(_0x2a9607),_0x2d91f9=await formatQueryOutput(_0xd2249d,_0x4039b9);_0x211690['push'](_0x2d91f9);}else await handleQueryOutput(_0xd2249d,_0x2a9607);}catch(_0x3793c2){const _0x469e94=_0x3c1b14?_0x580ac5(0x197)+_0x36478d+'/'+_0x172d65+':\x0a':'',_0x41038e=_0x3793c2 instanceof SDKError?_0x3793c2[_0x580ac5(0x1ab)]:_0x3793c2[_0x580ac5(0x19b)];return console[_0x580ac5(0x1a0)](''+_0x469e94+_0x41038e),0x1;}}if(_0x4e2e71[_0x580ac5(0x190)]>0x1&&_0x389333&&_0x211690[_0x580ac5(0x190)]>0x0){const _0x5d4a1c=_0x211690[_0x580ac5(0x18f)]('\x0a');writeFileSync(_0x2a9607[_0x580ac5(0x1b7)],_0x5d4a1c),console[_0x580ac5(0x1a0)](_0x580ac5(0x199)+_0x2a9607[_0x580ac5(0x1b7)]);}return 0x0;}catch(_0x52ff6d){throw _0x52ff6d;}}[a24_0x585722(0x1af)](_0x57507e){const _0x14eb2e=a24_0x585722,_0x5069bb=_0x57507e[_0x14eb2e(0x191)][0x0],_0x594aef=_0x57507e['options']['file'];if(!_0x5069bb&&!_0x594aef)return _0x14eb2e(0x19f);if(_0x5069bb&&_0x594aef)return _0x14eb2e(0x1a4);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_0x51372c=a25_0x576d;(function(_0x5e13ef,_0x3d0335){const _0x2cebe0=a25_0x576d,_0x5d9921=_0x5e13ef();while(!![]){try{const _0x354abb=parseInt(_0x2cebe0(0x1e2))/0x1+parseInt(_0x2cebe0(0x1fa))/0x2+-parseInt(_0x2cebe0(0x1ad))/0x3*(parseInt(_0x2cebe0(0x1f8))/0x4)+parseInt(_0x2cebe0(0x18a))/0x5*(-parseInt(_0x2cebe0(0x195))/0x6)+-parseInt(_0x2cebe0(0x1ff))/0x7*(parseInt(_0x2cebe0(0x1ca))/0x8)+parseInt(_0x2cebe0(0x189))/0x9*(-parseInt(_0x2cebe0(0x17f))/0xa)+parseInt(_0x2cebe0(0x187))/0xb*(parseInt(_0x2cebe0(0x184))/0xc);if(_0x354abb===_0x3d0335)break;else _0x5d9921['push'](_0x5d9921['shift']());}catch(_0xa47837){_0x5d9921['push'](_0x5d9921['shift']());}}}(a25_0x2d9a,0x27d12));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_0x576d(_0x237b90,_0x5c1121){_0x237b90=_0x237b90-0x164;const _0x2d9a15=a25_0x2d9a();let _0x576d1e=_0x2d9a15[_0x237b90];return _0x576d1e;}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_0x4b6697 from'chalk';function a25_0x2d9a(){const _0xcc5c28=['format','/e/','416770mcOFyh','execute','Error:\x20Cannot\x20show\x20schema\x20for\x20parent\x20segment\x20with\x20this\x20command.','\x20\x20tdx\x20sg\x20show\x20\x22Premium\x20Users\x22','getParent','3926616TQCzqf','replace','Get\x20SQL\x20query\x20for\x20child\x20segment','11OlLPhb','includes','45VcCPrG','70FIjUIT','Resolved\x20type:\x20','SEGMENT_FOLDER_NOT_FOUND','segment:desc','Fetching\x20folder\x20details...','Show\x20segment\x20folder\x20details','Resolved\x20relative\x20path\x20to:\x20','Creating\x20folder\x20\x27','Show\x20segment\x20or\x20folder\x20details','folder','stats','14868TKaTQA','Resolved\x20YAML\x20file:\x20','\x20\x20tdx\x20sg\x20show\x20segments/my-audience/premium-users.yml','Error:\x20Parent\x20segment\x20name\x20is\x20required','Usage:\x20tdx\x20sg\x20sql\x20<name>','\x20\x20tdx\x20sg\x20sql\x20segments/my-audience/premium-users.yml','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20-w\x20\x20#\x20Open\x20segment\x20in\x20web\x20browser','SQL\x20query:\x0a','✖\x20Query\x20failed\x20[','Segment\x20ID:\x20','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20\x20\x20\x20\x20#\x20View\x20child\x20segment\x20details','\x20\x20tdx\x20sg\x20sql\x20\x22Premium\x20Users\x22','getFolder','resolvePathToResource','setJobId','Parent\x20ID:\x20','Usage:\x20tdx\x20segment\x20folder\x20show\x20<parent_name/folder_name>','Fetching\x20segment\x20details...','getSegmentSQL','Usage:\x20tdx\x20sg\x20desc\x20<name>','message','\x20\x20tdx\x20sg\x20view\x20\x22Marketing\x22\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20folder\x20details','Target\x20path:\x20','segment:view','686439tgNLEN','\x20\x20Folder\x20path:\x20','SEGMENT_NOT_FOUND','Segment\x20ID\x20missing\x20from\x20resolved\x20path','Show\x20folder\x20or\x20child\x20segment\x20details','Site:\x20','fullPath','Fetching\x20folder\x20\x27','Create\x20segment\x20folder\x20for\x20organization','listFolders','trim','createFolder','Examples:','segmentName','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience/Marketing/High\x20Value\x22','Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.','Error:\x20','\x27...','getSegment','type','Folder\x20ID:\x20','Error:\x20Cannot\x20open\x20parent\x20segment\x20with\x20this\x20command.','Error:\x20Cannot\x20get\x20SQL\x20query\x20for\x20a\x20folder.','✔\x20Found\x20','log','Folder\x20name:\x20','Error:\x20Cannot\x20view\x20parent\x20segment\x20details\x20with\x20this\x20command.','SELECT\x20*\x20FROM\x20(\x0a','No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22','18704PIGUuN','segment:show','(root)','\x20Opening\x20','segmentPath','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20desc\x20<path/to/segment.yml>','segment:folder:list','Error:\x20Folder\x20reference\x20is\x20required','segment:folder:show','code','Usage:\x20tdx\x20segment\x20describe\x20<path>','segment:describe','Parent\x20name:\x20','segmentId','jobId','\x20[Job\x20ID:\x20','url','\x20\x20tdx\x20sg\x20desc\x20\x22Premium\x20Users\x22','Use:\x20tdx\x20ps\x20view','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','Error:\x20Folder\x20or\x20segment\x20name,\x20or\x20YAML\x20file\x20path\x20is\x20required','limit','folderId','parent','291632xhMfzn','verbose','resolveFolderId','site','segment','parentId','Resolving\x20\x27','length','processedRows','Use:\x20tdx\x20sg\x20view\x20<name>\x20\x20#\x20To\x20show\x20folder\x20details','\x27\x20with\x20ID:\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20show\x20<path/to/segment.yml>','Fetching\x20SQL\x20for\x20segment...','Error:\x20Cannot\x20execute\x20query\x20for\x20parent\x20segment\x20with\x20this\x20command.','Error:\x20Cannot\x20get\x20SQL\x20for\x20parent\x20segment\x20with\x20this\x20command.','\x20\x20Parent\x20segment:\x20','Parent\x20segment:\x20','segment:folder:create','data','INVALID_ARGUMENT','/app/ps/','\x20\x20Full\x20path:\x20','4KGOSQh','cause','509212hnvdSj','Usage:\x20tdx\x20sg\x20view\x20<name>\x20[-w]','Usage:\x20tdx\x20segment\x20folder\x20list\x20<parent_name>','in\x20','Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required','714fftFzR','web','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20sql\x20<path/to/segment.yml>','\x20\x20Cause:\x20','\x20\x20tdx\x20sg\x20view\x20segments/my-audience/premium-users.yml','Error:\x20Cannot\x20show\x20schema\x20for\x20a\x20folder.','Resolving\x20parent\x20segment\x20\x27','jsonl','Usage:\x20tdx\x20sg\x20show\x20<name>','Folder\x20ID\x20missing\x20from\x20resolved\x20path','description','parentSegment','Execute\x20child\x20segment\x20SQL\x20query\x20and\x20show\x20results','Options:','Resolving\x20path\x20\x27','error','Resolving\x20folder\x20\x27','query','\x20\x20tdx\x20segment\x20describe\x20\x22High\x20Value\x22\x20\x20\x20\x20#\x20Relative\x20to\x20current\x20context','Resolved\x20folder\x20ID:\x20','Usage:\x20tdx\x20segment\x20folder\x20create\x20<parent_name>\x20<folder_name>\x20[options]','resolveParentId','name','toLocaleString','List\x20segment\x20folders\x20under\x20a\x20parent\x20segment','Error:\x20Parent\x20segment\x20name\x20and\x20folder\x20name\x20are\x20required','Use:\x20tdx\x20ps\x20show'];a25_0x2d9a=function(){return _0xcc5c28;};return a25_0x2d9a();}async function resolveSegmentTarget(_0x91e1ce,_0x19b93d,_0x83f668){const _0xa78e39=a25_0x576d;if(isYamlFilePath(_0x91e1ce))try{const _0x2da7cc=await resolveYamlFilePath(_0x91e1ce);return _0x83f668&&(console[_0xa78e39(0x171)](_0xa78e39(0x196)+_0x91e1ce),console['error'](_0xa78e39(0x1f1)+_0x2da7cc[_0xa78e39(0x16d)]),console[_0xa78e39(0x171)]('\x20\x20Segment\x20name:\x20'+_0x2da7cc[_0xa78e39(0x1ba)]),console[_0xa78e39(0x171)](_0xa78e39(0x1ae)+(_0x2da7cc['folderPath']||_0xa78e39(0x1cc))),console[_0xa78e39(0x171)](_0xa78e39(0x1f7)+_0x2da7cc[_0xa78e39(0x1b3)])),_0x2da7cc[_0xa78e39(0x1b3)];}catch(_0xfebbe5){throw new SDKError(ErrorCode[_0xa78e39(0x1f5)],'Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20'+_0xfebbe5[_0xa78e39(0x1a9)]);}if(!_0x19b93d)throw new SDKError(ErrorCode[_0xa78e39(0x1f5)],_0xa78e39(0x1c9));return _0x19b93d+'/'+_0x91e1ce;}export class SegmentDescribeCommand extends BaseCommand{['name']=a25_0x51372c(0x1d5);[a25_0x51372c(0x16c)]=a25_0x51372c(0x192);async[a25_0x51372c(0x180)](_0x45a417){const _0x128010=a25_0x51372c,{options:_0x2f2152,args:_0x3b8222,tdx:_0x42b344}=_0x45a417,_0x29aab5=_0x3b8222[0x0],_0x20f6ef=!_0x29aab5&&!!_0x2f2152['parentSegment'],_0x16a6d6=_0x29aab5||_0x2f2152[_0x128010(0x16d)];if(!_0x16a6d6)return console[_0x128010(0x171)]('Error:\x20Path\x20or\x20name\x20is\x20required'),console[_0x128010(0x171)](_0x128010(0x1d4)),console[_0x128010(0x171)](_0x128010(0x1b9)),console[_0x128010(0x171)]('\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience\x22'),console[_0x128010(0x171)](_0x128010(0x1bb)),console[_0x128010(0x171)](_0x128010(0x174)),console[_0x128010(0x171)](_0x128010(0x1dd)),0x1;try{const _0x3b438c=_0x2f2152[_0x128010(0x1ce)];let _0x3906ef=_0x16a6d6;!_0x20f6ef&&_0x3b438c&&!_0x16a6d6[_0x128010(0x188)]('/')&&(_0x3906ef=_0x3b438c+'/'+_0x16a6d6,_0x2f2152[_0x128010(0x1e3)]&&console[_0x128010(0x171)](_0x128010(0x190)+_0x3906ef));const _0x1d7656=await withSpinner(_0x128010(0x170)+_0x3906ef+_0x128010(0x1be),()=>_0x42b344[_0x128010(0x1e6)][_0x128010(0x1a2)](_0x3906ef),{'verbose':_0x2f2152[_0x128010(0x1e3)]}),_0x1de92f=_0x1d7656[_0x128010(0x1f4)];_0x2f2152[_0x128010(0x1e3)]&&(console['error'](_0x128010(0x18b)+_0x1de92f[_0x128010(0x1c0)]),console[_0x128010(0x171)](_0x128010(0x1a4)+_0x1de92f[_0x128010(0x1e7)]),_0x1de92f[_0x128010(0x1e0)]&&console[_0x128010(0x171)](_0x128010(0x1c1)+_0x1de92f['folderId']),_0x1de92f[_0x128010(0x1d7)]&&console['error'](_0x128010(0x19e)+_0x1de92f[_0x128010(0x1d7)]));if(_0x1de92f['type']===_0x128010(0x1e1)){const _0x5d0834=await withSpinner('Fetching\x20parent\x20segment\x20details...',()=>_0x42b344[_0x128010(0x1e6)][_0x128010(0x183)](_0x1de92f[_0x128010(0x1e7)]),{'verbose':_0x2f2152[_0x128010(0x1e3)]});await handleSingleObjectOutput(_0x5d0834[_0x128010(0x1f4)],_0x2f2152);}else{if(_0x1de92f[_0x128010(0x1c0)]===_0x128010(0x193)){if(!_0x1de92f[_0x128010(0x1e0)])throw new SDKError(ErrorCode['SEGMENT_FOLDER_NOT_FOUND'],'Folder\x20ID\x20missing\x20from\x20resolved\x20path');const _0x6b6f1=await withSpinner(_0x128010(0x18e),()=>_0x42b344[_0x128010(0x1e6)][_0x128010(0x1a1)](_0x1de92f[_0x128010(0x1e0)]),{'verbose':_0x2f2152[_0x128010(0x1e3)]});await handleSingleObjectOutput(_0x6b6f1[_0x128010(0x1f4)],_0x2f2152);}else{if(_0x1de92f[_0x128010(0x1c0)]===_0x128010(0x1e6)){if(!_0x1de92f['segmentId'])throw new SDKError(ErrorCode[_0x128010(0x1af)],_0x128010(0x1b0));const _0x58a185=await withSpinner(_0x128010(0x1a6),()=>_0x42b344['segment'][_0x128010(0x1bf)](_0x1de92f[_0x128010(0x1e7)],_0x1de92f[_0x128010(0x1d7)]),{'verbose':_0x2f2152['verbose']});await handleSingleObjectOutput(_0x58a185[_0x128010(0x1f4)],_0x2f2152);}}}return 0x0;}catch(_0x2b9e1){if(_0x2b9e1 instanceof SDKError)return console['error']('Error:\x20'+_0x2b9e1['message']),_0x2b9e1[_0x128010(0x1f9)]&&console[_0x128010(0x171)](_0x128010(0x165)+_0x2b9e1[_0x128010(0x1f9)]),0x1;throw _0x2b9e1;}}}export class SegmentShowCommand extends BaseCommand{[a25_0x51372c(0x178)]=a25_0x51372c(0x1cb);[a25_0x51372c(0x16c)]=a25_0x51372c(0x16e);async['execute'](_0x2abea1){const _0x49c208=a25_0x51372c,{options:_0xbabf09,args:_0x434686,tdx:_0x5b12ba}=_0x2abea1,_0xc7dcb0=_0x434686[0x0];if(!_0xc7dcb0)return console[_0x49c208(0x171)]('Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required'),console['error'](_0x49c208(0x16a)),console['error'](_0x49c208(0x1ed)),console[_0x49c208(0x171)](_0x49c208(0x1b9)),console[_0x49c208(0x171)](_0x49c208(0x182)),console[_0x49c208(0x171)](_0x49c208(0x197)),0x1;try{const _0x478098=_0xbabf09[_0x49c208(0x16d)],_0xfc3e4c=await resolveSegmentTarget(_0xc7dcb0,_0x478098,_0xbabf09[_0x49c208(0x1e3)]);_0xbabf09[_0x49c208(0x1e3)]&&console[_0x49c208(0x171)](_0x49c208(0x1ab)+_0xfc3e4c);const _0x2365cb=await withSpinner(_0x49c208(0x1e8)+_0xc7dcb0+_0x49c208(0x1be),()=>_0x5b12ba[_0x49c208(0x1e6)][_0x49c208(0x1a2)](_0xfc3e4c),{'verbose':_0xbabf09[_0x49c208(0x1e3)]}),_0x730793=_0x2365cb[_0x49c208(0x1f4)];_0xbabf09['verbose']&&(console['error']('Resolved\x20type:\x20'+_0x730793['type']),console['error'](_0x49c208(0x1a4)+_0x730793['parentId']));if(_0x730793['type']==='folder')return console['error']('Error:\x20Cannot\x20execute\x20SQL\x20query\x20on\x20a\x20folder.'),console[_0x49c208(0x171)](_0x49c208(0x1eb)),0x1;if(_0x730793[_0x49c208(0x1c0)]==='parent')return console[_0x49c208(0x171)](_0x49c208(0x1ef)),console['error'](_0x49c208(0x17c)),0x1;if(!_0x730793[_0x49c208(0x1d7)])throw new SDKError(ErrorCode[_0x49c208(0x1af)],_0x49c208(0x1b0));const _0x2f7bd6=await withSpinner('Fetching\x20SQL\x20for\x20segment...',()=>_0x5b12ba[_0x49c208(0x1e6)][_0x49c208(0x1a7)](_0x730793['parentId'],_0x730793[_0x49c208(0x1d7)]),{'verbose':_0xbabf09[_0x49c208(0x1e3)]});let _0xf919ab=_0x2f7bd6['data'];const _0x1cb878=resolveLimit(_0xbabf09[_0x49c208(0x1df)],DEFAULT_DISPLAY_LIMIT),_0x1916e7=/\bLIMIT\s+\d+/i['test'](_0xf919ab);!_0x1916e7&&(_0xf919ab=_0xf919ab[_0x49c208(0x1b7)]()[_0x49c208(0x185)](/;+$/,''),_0xf919ab=_0x49c208(0x1c8)+_0xf919ab+'\x0a)\x20AS\x20segment_query\x0aLIMIT\x20'+_0x1cb878);_0xbabf09[_0x49c208(0x1e3)]&&console[_0x49c208(0x171)](_0x49c208(0x19c)+_0xf919ab);const _0x5503ca=await withProgressSpinner('Executing\x20segment\x20query...',async _0x1ccb1c=>{const _0x2a47ba=_0x49c208,_0x416909=await _0x5b12ba[_0x2a47ba(0x173)][_0x2a47ba(0x180)](_0xf919ab,{'catalog':'td','schema':'information_schema','onJobId':_0x76434c=>{const _0x1456d5=_0x2a47ba;_0x1ccb1c[_0x1456d5(0x1a3)](_0x76434c);}});return _0x416909;},{'verbose':_0xbabf09[_0x49c208(0x1e3)]}),_0x461cbc=_0x5503ca[_0x49c208(0x1f4)],_0x4f8042=_0x461cbc['jobId']?_0x49c208(0x1d9)+_0x461cbc[_0x49c208(0x1d8)]+']':'';return console['error']('✔\x20Query\x20completed:\x20Processed\x20'+_0x461cbc[_0x49c208(0x194)][_0x49c208(0x1ea)][_0x49c208(0x179)]()+'\x20rows\x20'+(_0x49c208(0x1fd)+formatElapsed(_0x461cbc[_0x49c208(0x194)]['elapsedTimeMillis'])+_0x4f8042)),await handleQueryOutput(_0x461cbc,_0xbabf09),0x0;}catch(_0xfe09b1){if(_0xfe09b1 instanceof SDKError)return console[_0x49c208(0x171)](_0x49c208(0x19d)+_0xfe09b1[_0x49c208(0x1d3)]+']'),console['error']('\x0a'+_0xfe09b1[_0x49c208(0x1a9)]),0x1;throw _0xfe09b1;}}}export class SegmentFolderListCommand extends BaseCommand{['name']=a25_0x51372c(0x1d0);['description']=a25_0x51372c(0x17a);async['execute'](_0x3009e8){const _0x1809b8=a25_0x51372c,{options:_0x88bb51,args:_0x271e35,tdx:_0x169329}=_0x3009e8;if(_0x271e35[_0x1809b8(0x1e9)]===0x0)return console[_0x1809b8(0x171)](_0x1809b8(0x198)),console[_0x1809b8(0x171)](_0x1809b8(0x1fc)),0x1;const _0x5d2791=_0x271e35[0x0];try{_0x88bb51[_0x1809b8(0x1e3)]&&(console[_0x1809b8(0x171)]('Site:\x20'+_0x88bb51['site']),console[_0x1809b8(0x171)](_0x1809b8(0x1d6)+_0x5d2791));const _0xb3b14f=await withSpinner(_0x1809b8(0x168)+_0x5d2791+_0x1809b8(0x1be),()=>_0x169329[_0x1809b8(0x1e6)][_0x1809b8(0x177)](_0x5d2791),{'verbose':_0x88bb51[_0x1809b8(0x1e3)]}),_0x2415f3=_0xb3b14f['data'];_0x88bb51[_0x1809b8(0x1e3)]&&console[_0x1809b8(0x171)]('Resolved\x20parent\x20ID:\x20'+_0x2415f3);const _0x1683f6=await withSpinner('Listing\x20folders\x20for\x20parent\x20\x27'+_0x5d2791+_0x1809b8(0x1be),()=>_0x169329[_0x1809b8(0x1e6)][_0x1809b8(0x1b6)](_0x2415f3),{'verbose':_0x88bb51['verbose']}),_0x4ac7a2=_0x1683f6[_0x1809b8(0x1f4)];return console[_0x1809b8(0x171)](_0x1809b8(0x1c4)+_0x4ac7a2[_0x1809b8(0x1e9)]+'\x20folder'+(_0x4ac7a2[_0x1809b8(0x1e9)]!==0x1?'s':'')),await handleSDKOutput(_0x4ac7a2,_0x88bb51),0x0;}catch(_0x17fcf4){if(_0x17fcf4 instanceof SDKError)return console[_0x1809b8(0x171)](_0x1809b8(0x1bd)+_0x17fcf4[_0x1809b8(0x1a9)]),_0x17fcf4[_0x1809b8(0x1f9)]&&console[_0x1809b8(0x171)](_0x1809b8(0x165)+_0x17fcf4['cause']),0x1;throw _0x17fcf4;}}}export class SegmentFolderShowCommand extends BaseCommand{['name']=a25_0x51372c(0x1d2);[a25_0x51372c(0x16c)]=a25_0x51372c(0x18f);async[a25_0x51372c(0x180)](_0x235af6){const _0x223079=a25_0x51372c,{options:_0x152d6c,args:_0xb10d00,tdx:_0x97f7ed}=_0x235af6;if(_0xb10d00[_0x223079(0x1e9)]===0x0)return console[_0x223079(0x171)](_0x223079(0x1d1)),console[_0x223079(0x171)](_0x223079(0x1a5)),0x1;try{const {parentId:_0x25d5a0,childId:_0x3df6a7}=parseSegmentRef(_0xb10d00[0x0]);_0x152d6c[_0x223079(0x1e3)]&&(console[_0x223079(0x171)]('Site:\x20'+_0x152d6c[_0x223079(0x1e5)]),console['error'](_0x223079(0x1d6)+_0x25d5a0),_0x3df6a7&&console[_0x223079(0x171)](_0x223079(0x1c6)+_0x3df6a7));if(!_0x3df6a7)return console[_0x223079(0x171)]('Error:\x20Folder\x20name\x20is\x20required\x20(use\x20parent_name/folder_name\x20format)'),0x1;const _0xf6507e=await withSpinner(_0x223079(0x168)+_0x25d5a0+_0x223079(0x1be),()=>_0x97f7ed[_0x223079(0x1e6)][_0x223079(0x177)](_0x25d5a0),{'verbose':_0x152d6c['verbose']}),_0x58996f=_0xf6507e['data'];_0x152d6c[_0x223079(0x1e3)]&&console[_0x223079(0x171)]('Resolved\x20parent\x20ID:\x20'+_0x58996f);const _0x33ab5c=await withSpinner(_0x223079(0x172)+_0x3df6a7+_0x223079(0x1be),()=>_0x97f7ed[_0x223079(0x1e6)]['resolveFolderId'](_0x58996f,_0x3df6a7),{'verbose':_0x152d6c['verbose']}),_0x5175b3=_0x33ab5c['data'];_0x152d6c[_0x223079(0x1e3)]&&console['error'](_0x223079(0x175)+_0x5175b3);const _0x201fb8=await withSpinner(_0x223079(0x1b4)+_0x3df6a7+_0x223079(0x1be),()=>_0x97f7ed[_0x223079(0x1e6)][_0x223079(0x1a1)](_0x5175b3),{'verbose':_0x152d6c[_0x223079(0x1e3)]});return await handleSDKOutput([_0x201fb8[_0x223079(0x1f4)]],_0x152d6c),0x0;}catch(_0x239ccd){if(_0x239ccd instanceof SDKError)return console[_0x223079(0x171)](_0x223079(0x1bd)+_0x239ccd['message']),_0x239ccd['cause']&&console['error'](_0x223079(0x165)+_0x239ccd[_0x223079(0x1f9)]),0x1;throw _0x239ccd;}}}export class SegmentSQLCommand extends BaseCommand{['name']='segment:sql';['description']=a25_0x51372c(0x186);async['execute'](_0x280cb8){const _0x541c38=a25_0x51372c,{options:_0x2d69e9,args:_0x477149,tdx:_0x7b13d2}=_0x280cb8,_0x58ca52=_0x477149[0x0];if(!_0x58ca52)return console[_0x541c38(0x171)](_0x541c38(0x1fe)),console[_0x541c38(0x171)](_0x541c38(0x199)),console['error'](_0x541c38(0x164)),console[_0x541c38(0x171)](_0x541c38(0x1b9)),console['error'](_0x541c38(0x1a0)),console[_0x541c38(0x171)](_0x541c38(0x19a)),0x1;try{const _0x5316e4=_0x2d69e9[_0x541c38(0x16d)],_0x3abd4b=await resolveSegmentTarget(_0x58ca52,_0x5316e4,_0x2d69e9[_0x541c38(0x1e3)]);_0x2d69e9[_0x541c38(0x1e3)]&&console[_0x541c38(0x171)](_0x541c38(0x1ab)+_0x3abd4b);const _0x166eaf=await withSpinner('Resolving\x20\x27'+_0x58ca52+'\x27...',()=>_0x7b13d2[_0x541c38(0x1e6)][_0x541c38(0x1a2)](_0x3abd4b),{'verbose':_0x2d69e9[_0x541c38(0x1e3)]}),_0x592f2c=_0x166eaf[_0x541c38(0x1f4)];_0x2d69e9[_0x541c38(0x1e3)]&&(console[_0x541c38(0x171)]('Resolved\x20type:\x20'+_0x592f2c['type']),console['error']('Parent\x20ID:\x20'+_0x592f2c[_0x541c38(0x1e7)]));if(_0x592f2c[_0x541c38(0x1c0)]===_0x541c38(0x193))return console[_0x541c38(0x171)](_0x541c38(0x1c3)),console[_0x541c38(0x171)](_0x541c38(0x1bc)),0x1;if(_0x592f2c['type']===_0x541c38(0x1e1))return console[_0x541c38(0x171)](_0x541c38(0x1f0)),console[_0x541c38(0x171)]('Use:\x20tdx\x20ps\x20sql'),0x1;if(!_0x592f2c[_0x541c38(0x1d7)])throw new SDKError(ErrorCode[_0x541c38(0x1af)],_0x541c38(0x1b0));const _0x1d3ad3=await withSpinner(_0x541c38(0x1ee),()=>_0x7b13d2[_0x541c38(0x1e6)][_0x541c38(0x1a7)](_0x592f2c[_0x541c38(0x1e7)],_0x592f2c['segmentId']),{'verbose':_0x2d69e9[_0x541c38(0x1e3)]}),_0x3c295b=_0x1d3ad3['data'];return _0x2d69e9[_0x541c38(0x17d)]==='json'||_0x2d69e9[_0x541c38(0x17d)]===_0x541c38(0x169)?await handleSDKOutput([{'sql':_0x3c295b}],_0x2d69e9):console[_0x541c38(0x1c5)](_0x3c295b),0x0;}catch(_0xeadd7b){if(_0xeadd7b instanceof SDKError)return console['error'](_0x541c38(0x1bd)+_0xeadd7b[_0x541c38(0x1a9)]),_0xeadd7b[_0x541c38(0x1f9)]&&console[_0x541c38(0x171)]('\x20\x20Cause:\x20'+_0xeadd7b['cause']),0x1;throw _0xeadd7b;}}}export class SegmentFolderCreateCommand extends BaseCommand{[a25_0x51372c(0x178)]=a25_0x51372c(0x1f3);[a25_0x51372c(0x16c)]=a25_0x51372c(0x1b5);async['execute'](_0x1a7971){const _0x14b041=a25_0x51372c,{options:_0x1581c6,args:_0x18d405,tdx:_0x2c1b2c}=_0x1a7971,_0xe34fe1=_0x1581c6;if(_0x18d405[_0x14b041(0x1e9)]<0x2)return console[_0x14b041(0x171)](_0x14b041(0x17b)),console[_0x14b041(0x171)](_0x14b041(0x176)),0x1;const _0x5e4328=_0x18d405[0x0],_0x41ce2f=_0x18d405[0x1];_0xe34fe1[_0x14b041(0x1e3)]&&(console[_0x14b041(0x171)](_0x14b041(0x1b2)+_0xe34fe1['site']),console['error'](_0x14b041(0x1f2)+_0x5e4328),console['error'](_0x14b041(0x1c6)+_0x41ce2f));let _0x40ef8a;if(_0xe34fe1['parentFolder']){const _0xba671=_0xe34fe1['parentFolder'],_0x3a99e9=await withSpinner(_0x14b041(0x168)+_0x5e4328+'\x27...',()=>_0x2c1b2c['segment'][_0x14b041(0x177)](_0x5e4328),{'verbose':_0xe34fe1[_0x14b041(0x1e3)]}),_0x14f66a=_0x3a99e9[_0x14b041(0x1f4)],_0x4920ba=await withSpinner('Resolving\x20parent\x20folder\x20\x27'+_0xba671+_0x14b041(0x1be),()=>_0x2c1b2c[_0x14b041(0x1e6)][_0x14b041(0x1e4)](_0x14f66a,_0xba671),{'verbose':_0xe34fe1[_0x14b041(0x1e3)]});_0x40ef8a=_0x4920ba[_0x14b041(0x1f4)],_0xe34fe1[_0x14b041(0x1e3)]&&console[_0x14b041(0x171)]('Resolved\x20parent\x20folder\x20ID:\x20'+_0x40ef8a);}const _0x22d62f={'name':_0x41ce2f,'description':_0xe34fe1[_0x14b041(0x16c)],'parentFolderId':_0x40ef8a},_0x27264d=await withSpinner(_0x14b041(0x191)+_0x41ce2f+_0x14b041(0x1be),()=>_0x2c1b2c[_0x14b041(0x1e6)][_0x14b041(0x1b8)](_0x5e4328,_0x22d62f),{'verbose':_0xe34fe1[_0x14b041(0x1e3)]}),_0x3baaf3=_0x27264d[_0x14b041(0x1f4)];return console[_0x14b041(0x171)]('✔\x20Created\x20folder\x20\x27'+_0x3baaf3['name']+_0x14b041(0x1ec)+_0x3baaf3['id']),await handleSDKOutput([_0x3baaf3],_0xe34fe1),0x0;}}export class SegmentViewCommand extends BaseCommand{[a25_0x51372c(0x178)]=a25_0x51372c(0x1ac);[a25_0x51372c(0x16c)]=a25_0x51372c(0x1b1);async['execute'](_0xbe412e){const _0x9f26c2=a25_0x51372c,{options:_0x38af00,args:_0x40a739,tdx:_0x304b6d}=_0xbe412e,_0x31ce19=_0x40a739[0x0];if(!_0x31ce19)return console['error'](_0x9f26c2(0x1de)),console[_0x9f26c2(0x171)](_0x9f26c2(0x1fb)),console[_0x9f26c2(0x171)]('\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20view\x20<path/to/segment.yml>'),console['error'](_0x9f26c2(0x16f)),console['error']('\x20\x20-w,\x20--web\x20\x20Open\x20segment\x20in\x20web\x20browser'),console['error'](_0x9f26c2(0x1b9)),console[_0x9f26c2(0x171)](_0x9f26c2(0x1aa)),console[_0x9f26c2(0x171)](_0x9f26c2(0x19f)),console[_0x9f26c2(0x171)](_0x9f26c2(0x19b)),console[_0x9f26c2(0x171)](_0x9f26c2(0x166)),0x1;try{const _0x454ccb=_0x38af00[_0x9f26c2(0x16d)],_0x21e1bf=await resolveSegmentTarget(_0x31ce19,_0x454ccb,_0x38af00['verbose']);_0x38af00[_0x9f26c2(0x1e3)]&&console[_0x9f26c2(0x171)](_0x9f26c2(0x1ab)+_0x21e1bf);const _0x3d3307=await withSpinner(_0x9f26c2(0x1e8)+_0x31ce19+_0x9f26c2(0x1be),()=>_0x304b6d[_0x9f26c2(0x1e6)][_0x9f26c2(0x1a2)](_0x21e1bf),{'verbose':_0x38af00[_0x9f26c2(0x1e3)]}),_0x220e42=_0x3d3307[_0x9f26c2(0x1f4)];_0x38af00[_0x9f26c2(0x1e3)]&&(console[_0x9f26c2(0x171)](_0x9f26c2(0x18b)+_0x220e42[_0x9f26c2(0x1c0)]),console[_0x9f26c2(0x171)](_0x9f26c2(0x1a4)+_0x220e42[_0x9f26c2(0x1e7)]),_0x220e42[_0x9f26c2(0x1e0)]&&console[_0x9f26c2(0x171)](_0x9f26c2(0x1c1)+_0x220e42['folderId']),_0x220e42[_0x9f26c2(0x1d7)]&&console[_0x9f26c2(0x171)]('Segment\x20ID:\x20'+_0x220e42[_0x9f26c2(0x1d7)]));if(_0x38af00[_0x9f26c2(0x200)]){if(_0x220e42[_0x9f26c2(0x1c0)]===_0x9f26c2(0x193))return console[_0x9f26c2(0x171)]('Error:\x20Cannot\x20open\x20folder\x20in\x20web\x20browser.\x20Use\x20a\x20segment\x20name\x20instead.'),0x1;if(_0x220e42[_0x9f26c2(0x1c0)]==='parent')return console[_0x9f26c2(0x171)](_0x9f26c2(0x1c2)),console[_0x9f26c2(0x171)]('Use:\x20tdx\x20ps\x20view\x20-w'),0x1;if(!_0x220e42[_0x9f26c2(0x1d7)])throw new SDKError(ErrorCode[_0x9f26c2(0x1af)],_0x9f26c2(0x1b0));const _0x1978bd=getConsoleNextUrl(_0x38af00['site'],_0x9f26c2(0x1f6)+_0x220e42[_0x9f26c2(0x1e7)]+_0x9f26c2(0x17e)+_0x220e42['segmentId']);return console[_0x9f26c2(0x171)](a25_0x4b6697['green']('✔')+_0x9f26c2(0x1cd)+a25_0x4b6697['cyan'](_0x1978bd)),openBrowser(_0x1978bd),0x0;}if(_0x220e42[_0x9f26c2(0x1c0)]===_0x9f26c2(0x193)){if(!_0x220e42[_0x9f26c2(0x1e0)])throw new SDKError(ErrorCode[_0x9f26c2(0x18c)],_0x9f26c2(0x16b));const _0x47015c=await withSpinner(_0x9f26c2(0x18e),()=>_0x304b6d[_0x9f26c2(0x1e6)][_0x9f26c2(0x1a1)](_0x220e42[_0x9f26c2(0x1e0)]),{'verbose':_0x38af00['verbose']});await handleSingleObjectOutput(_0x47015c[_0x9f26c2(0x1f4)],_0x38af00);}else{if(_0x220e42[_0x9f26c2(0x1c0)]===_0x9f26c2(0x1e6)){if(!_0x220e42[_0x9f26c2(0x1d7)])throw new SDKError(ErrorCode[_0x9f26c2(0x1af)],_0x9f26c2(0x1b0));const _0x103063=await withSpinner(_0x9f26c2(0x1a6),()=>_0x304b6d['segment'][_0x9f26c2(0x1bf)](_0x220e42['parentId'],_0x220e42[_0x9f26c2(0x1d7)]),{'verbose':_0x38af00[_0x9f26c2(0x1e3)]}),_0x48f555=getConsoleNextUrl(_0x38af00['site'],'/app/ps/'+_0x220e42[_0x9f26c2(0x1e7)]+_0x9f26c2(0x17e)+_0x220e42[_0x9f26c2(0x1d7)]),_0x3422e6=_0x103063[_0x9f26c2(0x1f4)];_0x3422e6[_0x9f26c2(0x1da)]=_0x48f555,await handleSingleObjectOutput(_0x3422e6,_0x38af00);}else return console[_0x9f26c2(0x171)](_0x9f26c2(0x1c7)),console[_0x9f26c2(0x171)](_0x9f26c2(0x1dc)),0x1;}return 0x0;}catch(_0x44971a){if(_0x44971a instanceof SDKError)return console[_0x9f26c2(0x171)](_0x9f26c2(0x1bd)+_0x44971a[_0x9f26c2(0x1a9)]),_0x44971a[_0x9f26c2(0x1f9)]&&console['error'](_0x9f26c2(0x165)+_0x44971a[_0x9f26c2(0x1f9)]),0x1;throw _0x44971a;}}}export const SegmentInfoCommand=SegmentViewCommand;export class SegmentDescCommand extends BaseCommand{['name']=a25_0x51372c(0x18d);[a25_0x51372c(0x16c)]='Show\x20child\x20segment\x20schema\x20(column\x20types)';async['execute'](_0x335266){const _0x127268=a25_0x51372c,{options:_0x2a3546,args:_0x2adf5a,tdx:_0x32e3a0}=_0x335266,_0x1655a2=_0x2adf5a[0x0];if(!_0x1655a2)return console[_0x127268(0x171)]('Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required'),console[_0x127268(0x171)](_0x127268(0x1a8)),console[_0x127268(0x171)](_0x127268(0x1cf)),console[_0x127268(0x171)]('Examples:'),console[_0x127268(0x171)](_0x127268(0x1db)),console[_0x127268(0x171)]('\x20\x20tdx\x20sg\x20desc\x20segments/my-audience/premium-users.yml'),0x1;try{const _0x32fd53=_0x2a3546[_0x127268(0x16d)],_0x46a856=await resolveSegmentTarget(_0x1655a2,_0x32fd53,_0x2a3546[_0x127268(0x1e3)]);_0x2a3546[_0x127268(0x1e3)]&&console[_0x127268(0x171)]('Target\x20path:\x20'+_0x46a856);const _0x2069d0=await withSpinner(_0x127268(0x1e8)+_0x1655a2+_0x127268(0x1be),()=>_0x32e3a0[_0x127268(0x1e6)][_0x127268(0x1a2)](_0x46a856),{'verbose':_0x2a3546['verbose']}),_0x40a4b1=_0x2069d0[_0x127268(0x1f4)];_0x2a3546[_0x127268(0x1e3)]&&(console['error'](_0x127268(0x18b)+_0x40a4b1['type']),console['error']('Parent\x20ID:\x20'+_0x40a4b1[_0x127268(0x1e7)]));if(_0x40a4b1['type']==='folder')return console[_0x127268(0x171)](_0x127268(0x167)),console['error'](_0x127268(0x1bc)),0x1;if(_0x40a4b1['type']===_0x127268(0x1e1))return console[_0x127268(0x171)](_0x127268(0x181)),console[_0x127268(0x171)]('Use:\x20tdx\x20ps\x20desc'),0x1;if(!_0x40a4b1[_0x127268(0x1d7)])throw new SDKError(ErrorCode[_0x127268(0x1af)],_0x127268(0x1b0));const _0x31e51=await withSpinner('Fetching\x20SQL\x20for\x20segment...',()=>_0x32e3a0[_0x127268(0x1e6)][_0x127268(0x1a7)](_0x40a4b1[_0x127268(0x1e7)],_0x40a4b1[_0x127268(0x1d7)]),{'verbose':_0x2a3546[_0x127268(0x1e3)]}),_0x2b979b=_0x31e51[_0x127268(0x1f4)],_0x165c99=await executeSchemaQuery(_0x2b979b,_0x32e3a0,_0x2a3546);return await handleQueryOutput(_0x165c99,_0x2a3546),0x0;}catch(_0x29a757){if(_0x29a757 instanceof SDKError)return console[_0x127268(0x171)](_0x127268(0x1bd)+_0x29a757[_0x127268(0x1a9)]),_0x29a757[_0x127268(0x1f9)]&&console['error'](_0x127268(0x165)+_0x29a757[_0x127268(0x1f9)]),0x1;throw _0x29a757;}}}
@@ -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_0x4b463d=a26_0x2392;(function(_0x527860,_0x2e9c4e){const _0x4cc1b9=a26_0x2392,_0x3f9c94=_0x527860();while(!![]){try{const _0x4b0b90=-parseInt(_0x4cc1b9(0x159))/0x1*(-parseInt(_0x4cc1b9(0x16c))/0x2)+-parseInt(_0x4cc1b9(0x164))/0x3+-parseInt(_0x4cc1b9(0x14d))/0x4*(parseInt(_0x4cc1b9(0x17b))/0x5)+-parseInt(_0x4cc1b9(0x165))/0x6*(parseInt(_0x4cc1b9(0x162))/0x7)+parseInt(_0x4cc1b9(0x171))/0x8*(parseInt(_0x4cc1b9(0x17a))/0x9)+-parseInt(_0x4cc1b9(0x14c))/0xa+-parseInt(_0x4cc1b9(0x16e))/0xb*(-parseInt(_0x4cc1b9(0x16b))/0xc);if(_0x4b0b90===_0x2e9c4e)break;else _0x3f9c94['push'](_0x3f9c94['shift']());}catch(_0x27b458){_0x3f9c94['push'](_0x3f9c94['shift']());}}}(a26_0x15c2,0x40864));import{BaseCommand}from'./command.js';function a26_0x2392(_0x50c507,_0x11d16f){_0x50c507=_0x50c507-0x14c;const _0x15c268=a26_0x15c2();let _0x23927b=_0x15c268[_0x50c507];return _0x23927b;}import{handleSDKOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import{loadJSONFromOptions}from'../utils/json-loader.js';function a26_0x15c2(){const _0x500085=['includes','264QdRJwf','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/High\x20Value\x22\x20--rule\x20\x27...\x27','✔\x20Created\x20segment\x20\x27','8BlxZPC','Examples:','segmentPath','noCountPopulation','yellow','kind','Resolving\x20folder\x20\x27','\x27...','Error:\x20Segment\x20path\x20or\x20name\x20is\x20required','4094343GgiFzX','1243235SvGlCS','Creating\x20segment\x20\x27','2830810ywtUAC','8ZcUzEn','name','Parent\x20path:\x20','resolveFolderId','\x20\x20\x20Path:\x20','segments','segment:create','Usage:\x20tdx\x20segment\x20create\x20<parent/segment_name>\x20[options]','type','invisible','folderId','folder','17933emNhCV','Create\x20child\x20segment\x20with\x20filtering\x20rules','Parent:\x20','Resolved\x20relative\x20path\x20to:\x20','Error:\x20Full\x20path\x20required\x20(parent/segment_name\x20or\x20parent/folder/segment_name)','length','\x27\x20with\x20ID:\x20','Site:\x20','verbose','98IgGNhL','segment','79563OtBvvy','89202KPqeyi','\x20\x20Use\x20`tdx\x20sg\x20push`\x20with\x20YAML\x20files\x20instead.\x0a','resolvePathToResource','data','Resolved\x20folder\x20ID:\x20','error','241836QeecRz','38FDKtRa'];a26_0x15c2=function(){return _0x500085;};return a26_0x15c2();}import{parsePath,getParentPath,getBaseName}from'../sdk/segment/segment-path-parser.js';import a26_0x4cbbb8 from'chalk';export class SegmentCreateCommand extends BaseCommand{[a26_0x4b463d(0x14e)]=a26_0x4b463d(0x153);['description']=a26_0x4b463d(0x15a);async['execute'](_0x597c7e){const _0x1971b7=a26_0x4b463d;console[_0x1971b7(0x16a)](a26_0x4cbbb8[_0x1971b7(0x175)]('⚠\x20Deprecation\x20warning:\x20`segment\x20create`\x20is\x20deprecated.')),console[_0x1971b7(0x16a)](a26_0x4cbbb8[_0x1971b7(0x175)](_0x1971b7(0x166)));const {options:_0x324fac,args:_0x5ad8d2,tdx:_0x1c198e}=_0x597c7e,_0xde7798=_0x324fac;if(_0x5ad8d2[_0x1971b7(0x15e)]===0x0)return console[_0x1971b7(0x16a)](_0x1971b7(0x179)),console['error']('Usage:\x20tdx\x20segment\x20create\x20<path>\x20[options]'),console['error'](_0x1971b7(0x172)),console['error'](_0x1971b7(0x16f)),console['error']('\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/Marketing/Premium\x22\x20--rule\x20\x27...\x27'),console[_0x1971b7(0x16a)]('\x20\x20tdx\x20segment\x20create\x20\x22Premium\x22\x20--rule\x20\x27...\x27\x20\x20#\x20Relative\x20to\x20context'),0x1;const _0x38eecb=_0x5ad8d2[0x0],_0x3d1798=_0x324fac[_0x1971b7(0x173)];let _0x2aac24=_0x38eecb;_0x3d1798&&!_0x38eecb[_0x1971b7(0x16d)]('/')&&(_0x2aac24=_0x3d1798+'/'+_0x38eecb,_0xde7798['verbose']&&console[_0x1971b7(0x16a)](_0x1971b7(0x15c)+_0x2aac24));const _0xc614c3=parsePath(_0x2aac24);if(_0xc614c3[_0x1971b7(0x152)]['length']<0x2)return console[_0x1971b7(0x16a)](_0x1971b7(0x15d)),console['error'](_0x1971b7(0x154)),0x1;const _0x5f0165=_0xc614c3[_0x1971b7(0x152)][0x0],_0x43167c=getBaseName(_0x2aac24),_0x2efb7b=getParentPath(_0x2aac24);_0xde7798[_0x1971b7(0x161)]&&(console[_0x1971b7(0x16a)](_0x1971b7(0x160)+_0xde7798['site']),console[_0x1971b7(0x16a)]('Target\x20path:\x20'+_0x2aac24),console[_0x1971b7(0x16a)](_0x1971b7(0x15b)+_0x5f0165),console['error']('Segment\x20name:\x20'+_0x43167c),console[_0x1971b7(0x16a)](_0x1971b7(0x14f)+_0x2efb7b));const _0x253055=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x5f0165+_0x1971b7(0x178),()=>_0x1c198e['segment']['resolveParentId'](_0x5f0165),{'verbose':_0xde7798[_0x1971b7(0x161)]}),_0x318587=_0x253055[_0x1971b7(0x168)];let _0x583d7e;if(_0xc614c3[_0x1971b7(0x152)][_0x1971b7(0x15e)]>0x2){const _0x32d955=await withSpinner('Resolving\x20folder\x20path\x20\x27'+_0x2efb7b+_0x1971b7(0x178),()=>_0x1c198e['segment'][_0x1971b7(0x167)](_0x2efb7b),{'verbose':_0xde7798['verbose']}),_0x30eb01=_0x32d955[_0x1971b7(0x168)];if(_0x30eb01[_0x1971b7(0x155)]!==_0x1971b7(0x158)&&_0x30eb01[_0x1971b7(0x155)]!=='parent')return console['error']('Error:\x20Cannot\x20create\x20segment\x20in\x20a\x20segment.\x20Parent\x20path\x20must\x20be\x20a\x20folder\x20or\x20parent.'),0x1;_0x583d7e=_0x30eb01[_0x1971b7(0x157)];}else{if(_0xde7798[_0x1971b7(0x158)]){const _0x40d90b=await withSpinner(_0x1971b7(0x177)+_0xde7798[_0x1971b7(0x158)]+_0x1971b7(0x178),()=>_0x1c198e[_0x1971b7(0x163)][_0x1971b7(0x150)](_0x318587,_0xde7798['folder']),{'verbose':_0xde7798[_0x1971b7(0x161)]});_0x583d7e=_0x40d90b[_0x1971b7(0x168)];}}_0xde7798[_0x1971b7(0x161)]&&_0x583d7e&&console[_0x1971b7(0x16a)](_0x1971b7(0x169)+_0x583d7e);const _0x40f835=await loadJSONFromOptions(_0xde7798['rule'],_0xde7798['ruleFile']),_0xd165d6={'name':_0x43167c,'description':_0xde7798['description'],'rule':_0x40f835,'kind':_0xde7798['kind']!==undefined?parseInt(_0xde7798[_0x1971b7(0x176)],0xa):undefined,'isVisible':_0xde7798[_0x1971b7(0x156)]?![]:undefined,'segmentFolderId':_0x583d7e,'countPopulation':_0xde7798[_0x1971b7(0x174)]?![]:undefined},_0x543619=await withSpinner(_0x1971b7(0x17c)+_0x43167c+_0x1971b7(0x178),()=>_0x1c198e[_0x1971b7(0x163)]['createSegment'](_0x318587,_0xd165d6),{'verbose':_0xde7798['verbose']}),_0x1ba238=_0x543619[_0x1971b7(0x168)];return console['error'](_0x1971b7(0x170)+_0x1ba238[_0x1971b7(0x14e)]+_0x1971b7(0x15f)+_0x1ba238['id']),_0x2aac24!==_0x38eecb&&console['error'](_0x1971b7(0x151)+_0x2aac24),await handleSDKOutput([_0x1ba238],_0xde7798),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
+ const a27_0x3a9cf0=a27_0x3a44;(function(_0x57779f,_0x36d96b){const _0x53c33d=a27_0x3a44,_0x38bd45=_0x57779f();while(!![]){try{const _0x4dd21f=-parseInt(_0x53c33d(0xc2))/0x1*(parseInt(_0x53c33d(0xb5))/0x2)+-parseInt(_0x53c33d(0xb3))/0x3+-parseInt(_0x53c33d(0xc4))/0x4*(parseInt(_0x53c33d(0xbc))/0x5)+parseInt(_0x53c33d(0xb6))/0x6*(parseInt(_0x53c33d(0xc0))/0x7)+parseInt(_0x53c33d(0xb4))/0x8+parseInt(_0x53c33d(0xc1))/0x9+-parseInt(_0x53c33d(0xc7))/0xa*(-parseInt(_0x53c33d(0xc6))/0xb);if(_0x4dd21f===_0x36d96b)break;else _0x38bd45['push'](_0x38bd45['shift']());}catch(_0x258e0c){_0x38bd45['push'](_0x38bd45['shift']());}}}(a27_0x42f0,0x6fefc));import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../core/command-output.js';function a27_0x42f0(){const _0x300db1=['7195600eZSrhp','2IKbtCt','70458pRcJUb','\x27...','✔\x20Found\x20','\x20field','segment','length','10bkqEhS','data','execute','jsonl','329MBrMZn','1045242cxjFIg','417938odzcSQ','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','1372576lYoRZD','Listing\x20fields\x20for\x20\x27','174911sedxaA','380znipnY','Error:\x20Parent\x20segment\x20name\x20is\x20required','verbose','parentSegment','error','Parent\x20segment:\x20','site','Usage:\x20tdx\x20segment\x20fields\x20<parent_name>','listFields','1827087cNHGCv'];a27_0x42f0=function(){return _0x300db1;};return a27_0x42f0();}import{withSpinner}from'../utils/spinner.js';import{displayFieldsHumanReadable}from'../sdk/segment/fields-display.js';function a27_0x3a44(_0x4644c6,_0x48de83){_0x4644c6=_0x4644c6-0xb3;const _0x42f0e6=a27_0x42f0();let _0x3a443f=_0x42f0e6[_0x4644c6];return _0x3a443f;}export class SegmentFieldsCommand extends BaseCommand{['name']='segment:fields';['description']='List\x20available\x20fields\x20for\x20segmentation';async[a27_0x3a9cf0(0xbe)](_0x1ec4d1){const _0x91c8be=a27_0x3a9cf0,{options:_0x24cebb,args:_0x261bea,tdx:_0x1fde2a}=_0x1ec4d1,_0x188359=_0x261bea[0x0]||_0x24cebb[_0x91c8be(0xca)];if(!_0x188359)return console[_0x91c8be(0xcb)](_0x91c8be(0xc8)),console[_0x91c8be(0xcb)](_0x91c8be(0xce)),console[_0x91c8be(0xcb)](_0x91c8be(0xc3)),0x1;_0x24cebb[_0x91c8be(0xc9)]&&(console[_0x91c8be(0xcb)]('Site:\x20'+_0x24cebb[_0x91c8be(0xcd)]),console[_0x91c8be(0xcb)](_0x91c8be(0xcc)+_0x188359));const _0x3f5dae=await withSpinner(_0x91c8be(0xc5)+_0x188359+_0x91c8be(0xb7),()=>_0x1fde2a[_0x91c8be(0xba)][_0x91c8be(0xcf)](_0x188359),{'verbose':_0x24cebb['verbose']}),_0x24ed1d=_0x3f5dae[_0x91c8be(0xbd)];console[_0x91c8be(0xcb)](_0x91c8be(0xb8)+_0x24ed1d[_0x91c8be(0xbb)]+_0x91c8be(0xb9)+(_0x24ed1d['length']!==0x1?'s':''));if(_0x24cebb['json']||_0x24cebb[_0x91c8be(0xbf)])return await handleSDKOutput(_0x24ed1d,_0x24cebb),0x0;return displayFieldsHumanReadable(_0x24ed1d,_0x188359),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_0x186962=a28_0x3bcb;(function(_0x146014,_0x17a4c3){const _0x10c1a3=a28_0x3bcb,_0x2fafc1=_0x146014();while(!![]){try{const _0x3bdc64=-parseInt(_0x10c1a3(0x1ed))/0x1+-parseInt(_0x10c1a3(0x1d8))/0x2+parseInt(_0x10c1a3(0x1cd))/0x3*(-parseInt(_0x10c1a3(0x1d7))/0x4)+parseInt(_0x10c1a3(0x1c5))/0x5+parseInt(_0x10c1a3(0x1c0))/0x6*(parseInt(_0x10c1a3(0x1b5))/0x7)+parseInt(_0x10c1a3(0x1f5))/0x8*(-parseInt(_0x10c1a3(0x1b3))/0x9)+parseInt(_0x10c1a3(0x1e3))/0xa;if(_0x3bdc64===_0x17a4c3)break;else _0x2fafc1['push'](_0x2fafc1['shift']());}catch(_0x11681b){_0x2fafc1['push'](_0x2fafc1['shift']());}}}(a28_0x33a9,0xe7267));function a28_0x33a9(){const _0x31b33e=['green','absolutePath','\x27...','description','length','\x20new\x20files','94230DjIwwq','Error:\x20','7QPPpWK','dryRun','files','red','Pull\x20child\x20segments\x20and\x20journeys\x20to\x20YAML\x20files','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)','cwd','helpText','verbose','isNew','\x0aChanges\x20to\x20\x27','1331238VqcELX','type','No\x20segments\x20or\x20journeys\x20found\x20in\x20parent\x20segment\x20\x27','utf-8','errorCode','2292945WydFjv','\x20journeys','resourceName','hasChanges','journeys','counts','journeyVersions','parent_segment','3nSDkNm','\x20versions)','Pulling\x20segments\x20from\x20\x27','error','\x20files\x20to\x20','session','targetDir','diff','Write\x20','Target\x20resource:\x20','7457780tinIRQ','2183120dzbadV','setPhase','pullSegments','parentName','relativePath','no_parent','dim','\x0aPull\x20summary\x20for\x20\x27','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a','✔\x20Context\x20set:\x20','segment','55449830bNUObs','content','cyan','yes','repeat','segments','site','✔\x20Pulled\x20','\x20=\x20','yellow','1129069mhYwAH','\x20activations','\x20with\x20','Site:\x20','execute','\x0a[Dry\x20run]\x20No\x20files\x20were\x20written','Parent\x20segment:\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20pull\x20<file_path>\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20segment\x20file','912qSlxSN','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20pull\x20<parent_name>\x20\x20\x20\x20\x20\x20#\x20Pull\x20all\x20segments\x20from\x20parent','filter'];a28_0x33a9=function(){return _0x31b33e;};return a28_0x33a9();}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_0x38b1f5 from'chalk';import{existsSync,mkdirSync,writeFileSync}from'fs';import a28_0x16e467 from'path';import{resolveTarget,isSuccessfulResolution}from'../sdk/segment/target-resolution.js';export{buildFolderIdToPathMap as buildFolderPathMap}from'../sdk/segment/resolution-context.js';function a28_0x3bcb(_0x5395d9,_0x36b32c){_0x5395d9=_0x5395d9-0x1af;const _0x33a905=a28_0x33a9();let _0x3bcb03=_0x33a905[_0x5395d9];return _0x3bcb03;}export class SegmentPullCommand extends BaseCommand{['name']='segment:pull';[a28_0x186962(0x1b0)]=a28_0x186962(0x1b9);async[a28_0x186962(0x1f1)](_0x268d35){const _0x482428=a28_0x186962,{options:_0x54220e,args:_0x12d9c7,tdx:_0x20cf7f}=_0x268d35,_0x16893e=_0x54220e,_0x5a4467=await resolveTarget({'arg':_0x12d9c7[0x0],'contextParent':_0x54220e['parentSegment'],'cwd':process[_0x482428(0x1bb)]()});if(!isSuccessfulResolution(_0x5a4467))return _0x5a4467[_0x482428(0x1c4)]===_0x482428(0x1dd)?(console[_0x482428(0x1d0)](a28_0x38b1f5[_0x482428(0x1ec)](_0x482428(0x1e0))),console[_0x482428(0x1d0)](_0x482428(0x1ba)),console[_0x482428(0x1d0)](_0x482428(0x1f6)),console[_0x482428(0x1d0)](_0x482428(0x1f4))):(console[_0x482428(0x1d0)](a28_0x38b1f5[_0x482428(0x1b8)](_0x482428(0x1b4)+_0x5a4467['message']+'\x0a')),_0x5a4467[_0x482428(0x1bc)]&&console['error'](a28_0x38b1f5[_0x482428(0x1e5)](_0x5a4467[_0x482428(0x1bc)]))),0x1;const _0x29cb66=_0x5a4467['parentName'],_0x12de62=_0x5a4467[_0x482428(0x1d3)],_0xc3ee40=_0x5a4467[_0x482428(0x1c1)]==='file'?_0x5a4467[_0x482428(0x1c7)]:undefined;_0x16893e['verbose']&&(console[_0x482428(0x1d0)](_0x482428(0x1f0)+_0x16893e[_0x482428(0x1e9)]),console['error'](_0x482428(0x1f3)+_0x29cb66),_0xc3ee40&&console[_0x482428(0x1d0)](_0x482428(0x1d6)+_0xc3ee40));const _0x3170b0=await withProgressSpinner(_0x482428(0x1cf)+_0x29cb66+_0x482428(0x1af),_0x1c46fa=>_0x20cf7f[_0x482428(0x1e2)][_0x482428(0x1da)](_0x29cb66,{'targetDir':_0x12de62,'targetResourceName':_0xc3ee40,'verbose':_0x16893e[_0x482428(0x1bd)],'progress':{'update':_0x38c710=>{const _0x3da44c=_0x482428;_0x1c46fa[_0x3da44c(0x1d9)](_0x38c710),_0x16893e[_0x3da44c(0x1bd)]&&console[_0x3da44c(0x1d0)]('\x20\x20'+_0x38c710);}}}),{'verbose':_0x16893e[_0x482428(0x1bd)]}),_0x5bc43c=_0x3170b0['data'];if(_0x5bc43c['counts']['segments']===0x0&&_0x5bc43c[_0x482428(0x1ca)]['journeys']===0x0)return console[_0x482428(0x1d0)](a28_0x38b1f5[_0x482428(0x1ec)](_0x482428(0x1c2)+_0x5bc43c[_0x482428(0x1db)]+'\x27')),0x0;const _0x30716c=_0x5bc43c[_0x482428(0x1b7)]['filter'](_0x54f966=>_0x54f966[_0x482428(0x1be)]),_0x4a5585=_0x5bc43c[_0x482428(0x1b7)][_0x482428(0x1f7)](_0x2ba9f6=>!_0x2ba9f6['isNew']&&_0x2ba9f6[_0x482428(0x1c8)]),_0x462f94=_0x5bc43c[_0x482428(0x1b7)]['filter'](_0x1b2e19=>!_0x1b2e19[_0x482428(0x1be)]&&!_0x1b2e19[_0x482428(0x1c8)]);console[_0x482428(0x1d0)](_0x482428(0x1df)+_0x5bc43c[_0x482428(0x1db)]+'\x27:'),console[_0x482428(0x1d0)]('\x20\x20🎯\x20'+a28_0x38b1f5[_0x482428(0x1e5)](_0x5bc43c[_0x482428(0x1ca)][_0x482428(0x1e8)]+'\x20segments')+_0x482428(0x1ef)+a28_0x38b1f5[_0x482428(0x1e5)](_0x5bc43c[_0x482428(0x1ca)]['activations']+_0x482428(0x1ee)));if(_0x5bc43c[_0x482428(0x1ca)][_0x482428(0x1c9)]>0x0){const _0x22a506=_0x5bc43c[_0x482428(0x1ca)][_0x482428(0x1cb)]>_0x5bc43c[_0x482428(0x1ca)][_0x482428(0x1c9)]?'\x20('+_0x5bc43c[_0x482428(0x1ca)][_0x482428(0x1cb)]+_0x482428(0x1ce):'';console['error']('\x20\x20🗺️\x20\x20'+a28_0x38b1f5[_0x482428(0x1e5)](_0x5bc43c[_0x482428(0x1ca)][_0x482428(0x1c9)]+_0x482428(0x1c6))+a28_0x38b1f5[_0x482428(0x1de)](_0x22a506));}console[_0x482428(0x1d0)]('\x20\x20'+a28_0x38b1f5[_0x482428(0x1f8)]('+\x20'+_0x30716c[_0x482428(0x1b1)]+_0x482428(0x1b2))),console[_0x482428(0x1d0)]('\x20\x20'+a28_0x38b1f5['yellow']('~\x20'+_0x4a5585['length']+'\x20changed\x20files')),console[_0x482428(0x1d0)]('\x20\x20'+a28_0x38b1f5[_0x482428(0x1de)]('=\x20'+_0x462f94[_0x482428(0x1b1)]+'\x20unchanged\x20files')),console[_0x482428(0x1d0)]('\x20\x20Target:\x20'+a28_0x38b1f5[_0x482428(0x1e5)](_0x5bc43c['targetDir'])+'\x0a');if(_0x4a5585['length']>0x0)for(const _0x382bf5 of _0x4a5585){console['error'](_0x482428(0x1bf)+_0x382bf5[_0x482428(0x1dc)]+'\x27:'),console[_0x482428(0x1d0)]('─'[_0x482428(0x1e7)](0x3c)),console['error'](_0x382bf5[_0x482428(0x1d4)]),console[_0x482428(0x1d0)]('─'['repeat'](0x3c));}if(_0x16893e[_0x482428(0x1b6)])return console[_0x482428(0x1d0)](a28_0x38b1f5['yellow'](_0x482428(0x1f2))),0x0;if(_0x30716c[_0x482428(0x1b1)]===0x0&&_0x4a5585[_0x482428(0x1b1)]===0x0)return console['error'](a28_0x38b1f5[_0x482428(0x1f8)]('✔\x20All\x20files\x20are\x20up\x20to\x20date')),saveSessionContext({'parent_segment':_0x5bc43c['parentName']},_0x16893e[_0x482428(0x1d2)]),console[_0x482428(0x1d0)](a28_0x38b1f5[_0x482428(0x1f8)]('✔\x20Context\x20set:\x20'+a28_0x38b1f5[_0x482428(0x1de)](_0x482428(0x1cc))+_0x482428(0x1eb)+a28_0x38b1f5['cyan'](_0x5bc43c[_0x482428(0x1db)]))),0x0;if(!_0x16893e[_0x482428(0x1e6)]){const _0x59fdc8=await confirmKey(_0x482428(0x1d5)+(_0x30716c[_0x482428(0x1b1)]+_0x4a5585[_0x482428(0x1b1)])+'\x20files?');if(!_0x59fdc8)return console[_0x482428(0x1d0)]('Aborted.'),0x1;}for(const _0xcc3b87 of _0x5bc43c['files']){if(_0xcc3b87[_0x482428(0x1be)]||_0xcc3b87[_0x482428(0x1c8)]){const _0x2f9168=a28_0x16e467['dirname'](_0xcc3b87['absolutePath']);!existsSync(_0x2f9168)&&mkdirSync(_0x2f9168,{'recursive':!![]}),writeFileSync(_0xcc3b87[_0x482428(0x1f9)],_0xcc3b87[_0x482428(0x1e4)],_0x482428(0x1c3));}}return console[_0x482428(0x1d0)](a28_0x38b1f5[_0x482428(0x1f8)](_0x482428(0x1ea)+(_0x30716c[_0x482428(0x1b1)]+_0x4a5585[_0x482428(0x1b1)])+_0x482428(0x1d1)+_0x5bc43c[_0x482428(0x1d3)])),saveSessionContext({'parent_segment':_0x5bc43c[_0x482428(0x1db)]},_0x16893e[_0x482428(0x1d2)]),console['error'](a28_0x38b1f5['green'](_0x482428(0x1e1)+a28_0x38b1f5[_0x482428(0x1de)](_0x482428(0x1cc))+_0x482428(0x1eb)+a28_0x38b1f5['cyan'](_0x5bc43c[_0x482428(0x1db)]))),0x0;}}