@treasuredata/tdx 0.25.3 → 0.25.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (183) hide show
  1. package/dist/bin.js +1 -1
  2. package/dist/build-info.json +3 -3
  3. package/dist/cli-categories.js +1 -1
  4. package/dist/cli.js +1 -1
  5. package/dist/commands/activations.js +1 -1
  6. package/dist/commands/agent-command.d.ts.map +1 -1
  7. package/dist/commands/agent-command.js +1 -1
  8. package/dist/commands/agent-command.js.map +1 -1
  9. package/dist/commands/agent-test-command.js +1 -1
  10. package/dist/commands/api-command.js +1 -1
  11. package/dist/commands/auth-command.js +1 -1
  12. package/dist/commands/chat-command.js +1 -1
  13. package/dist/commands/claude-command.js +1 -1
  14. package/dist/commands/claude-statusline-command.js +1 -1
  15. package/dist/commands/claude-usage-command.js +1 -1
  16. package/dist/commands/command.js +1 -1
  17. package/dist/commands/connection-command.js +1 -1
  18. package/dist/commands/databases.js +1 -1
  19. package/dist/commands/describe.js +1 -1
  20. package/dist/commands/engage-command.js +1 -1
  21. package/dist/commands/job-command.js +1 -1
  22. package/dist/commands/journey-command.js +1 -1
  23. package/dist/commands/journey-validate-command.js +1 -1
  24. package/dist/commands/llm-command.js +1 -1
  25. package/dist/commands/mcp-command.js +1 -1
  26. package/dist/commands/parent-segment-command.js +1 -1
  27. package/dist/commands/profile-command.js +1 -1
  28. package/dist/commands/profiles-command.js +1 -1
  29. package/dist/commands/query-command.js +1 -1
  30. package/dist/commands/schedule-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-update-command.js +1 -1
  37. package/dist/commands/segment-use-command.js +1 -1
  38. package/dist/commands/segment-validate-command.js +1 -1
  39. package/dist/commands/segments.js +1 -1
  40. package/dist/commands/show.js +1 -1
  41. package/dist/commands/status-command.js +1 -1
  42. package/dist/commands/tables.js +1 -1
  43. package/dist/commands/unset-command.js +1 -1
  44. package/dist/commands/use-command.js +1 -1
  45. package/dist/commands/user-command.js +1 -1
  46. package/dist/commands/workflow-command.js +1 -1
  47. package/dist/core/auth.js +1 -1
  48. package/dist/core/command-output.js +1 -1
  49. package/dist/core/config.js +1 -1
  50. package/dist/core/connection-cache.js +1 -1
  51. package/dist/core/constants.js +1 -1
  52. package/dist/core/credential-cache.js +1 -1
  53. package/dist/core/global-context.js +1 -1
  54. package/dist/core/keychain.js +1 -1
  55. package/dist/core/profile.js +1 -1
  56. package/dist/core/project-config.js +1 -1
  57. package/dist/core/session.js +1 -1
  58. package/dist/core/user-cache.js +1 -1
  59. package/dist/core/version.js +1 -1
  60. package/dist/index.js +1 -1
  61. package/dist/mcp/server.js +1 -1
  62. package/dist/mcp/tools/index.js +1 -1
  63. package/dist/mcp/tools/tdx-run.js +1 -1
  64. package/dist/mcp/tools/tdx-search.js +1 -1
  65. package/dist/mcp/utils.js +1 -1
  66. package/dist/proxy/claude-usage-tracker.js +1 -1
  67. package/dist/proxy/passthrough-server.js +1 -1
  68. package/dist/proxy/sse-usage-parser.js +1 -1
  69. package/dist/sdk/agent/agent-config.d.ts +10 -0
  70. package/dist/sdk/agent/agent-config.d.ts.map +1 -1
  71. package/dist/sdk/agent/agent-config.js +1 -1
  72. package/dist/sdk/agent/agent-config.js.map +1 -1
  73. package/dist/sdk/agent/agent-ref-parser.js +1 -1
  74. package/dist/sdk/agent/agent-yaml.d.ts +83 -4
  75. package/dist/sdk/agent/agent-yaml.d.ts.map +1 -1
  76. package/dist/sdk/agent/agent-yaml.js +1 -1
  77. package/dist/sdk/agent/agent-yaml.js.map +1 -1
  78. package/dist/sdk/agent/test/evaluator.js +1 -1
  79. package/dist/sdk/agent/test/executor.js +1 -1
  80. package/dist/sdk/agent/test/index.js +1 -1
  81. package/dist/sdk/agent/test/output.js +1 -1
  82. package/dist/sdk/agent/test/parser.js +1 -1
  83. package/dist/sdk/agent/types/agent-def.d.ts +54 -1
  84. package/dist/sdk/agent/types/agent-def.d.ts.map +1 -1
  85. package/dist/sdk/api.js +1 -1
  86. package/dist/sdk/client/cdp-api-client.js +1 -1
  87. package/dist/sdk/client/endpoints.js +1 -1
  88. package/dist/sdk/client/engage-api-client.js +1 -1
  89. package/dist/sdk/client/http-client.js +1 -1
  90. package/dist/sdk/client/llm-api-client.d.ts +89 -1
  91. package/dist/sdk/client/llm-api-client.d.ts.map +1 -1
  92. package/dist/sdk/client/llm-api-client.js +1 -1
  93. package/dist/sdk/client/llm-api-client.js.map +1 -1
  94. package/dist/sdk/client/rate-limiter.js +1 -1
  95. package/dist/sdk/client/td-api-client.js +1 -1
  96. package/dist/sdk/client/trino-api-client.js +1 -1
  97. package/dist/sdk/client/workflow-client.js +1 -1
  98. package/dist/sdk/connection-validator.js +1 -1
  99. package/dist/sdk/connection.js +1 -1
  100. package/dist/sdk/engage.js +1 -1
  101. package/dist/sdk/errors.js +1 -1
  102. package/dist/sdk/index.js +1 -1
  103. package/dist/sdk/io/index.js +1 -1
  104. package/dist/sdk/io/node-filesystem.js +1 -1
  105. package/dist/sdk/job.js +1 -1
  106. package/dist/sdk/journey.js +1 -1
  107. package/dist/sdk/llm/chat-cache.js +1 -1
  108. package/dist/sdk/llm/index.d.ts.map +1 -1
  109. package/dist/sdk/llm/index.js +1 -1
  110. package/dist/sdk/llm/index.js.map +1 -1
  111. package/dist/sdk/llm/llm-backup-utils.js +1 -1
  112. package/dist/sdk/llm/model-factors.js +1 -1
  113. package/dist/sdk/query/index.js +1 -1
  114. package/dist/sdk/query/sql-parser.js +1 -1
  115. package/dist/sdk/schedule.js +1 -1
  116. package/dist/sdk/segment/child-segment-yaml.js +1 -1
  117. package/dist/sdk/segment/fields-display.js +1 -1
  118. package/dist/sdk/segment/file-discovery.js +1 -1
  119. package/dist/sdk/segment/journey-utils.js +1 -1
  120. package/dist/sdk/segment/journey-yaml.js +1 -1
  121. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  122. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  123. package/dist/sdk/segment/pull-workflow.js +1 -1
  124. package/dist/sdk/segment/push-workflow.js +1 -1
  125. package/dist/sdk/segment/resolution-context.js +1 -1
  126. package/dist/sdk/segment/segment-path-parser.js +1 -1
  127. package/dist/sdk/segment/segment-ref-parser.js +1 -1
  128. package/dist/sdk/segment/target-resolution.js +1 -1
  129. package/dist/sdk/segment/tdx-config.js +1 -1
  130. package/dist/sdk/segment/validate-files.js +1 -1
  131. package/dist/sdk/segment/yaml-validator.js +1 -1
  132. package/dist/sdk/segment.js +1 -1
  133. package/dist/sdk/types/index.d.ts +1 -1
  134. package/dist/sdk/types/index.d.ts.map +1 -1
  135. package/dist/sdk/types/index.js +1 -1
  136. package/dist/sdk/types/index.js.map +1 -1
  137. package/dist/sdk/types/llm.d.ts +176 -2
  138. package/dist/sdk/types/llm.d.ts.map +1 -1
  139. package/dist/sdk/types/progress.js +1 -1
  140. package/dist/sdk/user.js +1 -1
  141. package/dist/sdk/util/format-detector.js +1 -1
  142. package/dist/sdk/util/formatters.js +1 -1
  143. package/dist/sdk/util/index.js +1 -1
  144. package/dist/sdk/util/tree-formatter.js +1 -1
  145. package/dist/sdk/workflow/archive-validation.js +1 -1
  146. package/dist/sdk/workflow/clone-workflow.js +1 -1
  147. package/dist/sdk/workflow/index.js +1 -1
  148. package/dist/sdk/workflow/pull-workflow.js +1 -1
  149. package/dist/sdk/workflow/push-workflow.js +1 -1
  150. package/dist/sdk/workflow/tdx-config.js +1 -1
  151. package/dist/sdk/workflow/workflow-utils.js +1 -1
  152. package/dist/test-utils/command-runner.js +1 -1
  153. package/dist/test-utils/factories.js +1 -1
  154. package/dist/test-utils/fixtures.js +1 -1
  155. package/dist/test-utils/http-mock.js +1 -1
  156. package/dist/test-utils/index.js +1 -1
  157. package/dist/utils/async.js +1 -1
  158. package/dist/utils/colors.js +1 -1
  159. package/dist/utils/diff.js +1 -1
  160. package/dist/utils/file-permissions.js +1 -1
  161. package/dist/utils/global-cache.js +1 -1
  162. package/dist/utils/json-loader.js +1 -1
  163. package/dist/utils/local-cache.js +1 -1
  164. package/dist/utils/logger/formatters/default-formatter.js +1 -1
  165. package/dist/utils/logger/formatters/index.js +1 -1
  166. package/dist/utils/logger/handlers/console-handler.js +1 -1
  167. package/dist/utils/logger/handlers/file-handler.js +1 -1
  168. package/dist/utils/logger/handlers/index.js +1 -1
  169. package/dist/utils/logger/handlers/null-handler.js +1 -1
  170. package/dist/utils/logger/index.js +1 -1
  171. package/dist/utils/logger/logger.js +1 -1
  172. package/dist/utils/logger/types.js +1 -1
  173. package/dist/utils/option-validation.js +1 -1
  174. package/dist/utils/port.js +1 -1
  175. package/dist/utils/process.js +1 -1
  176. package/dist/utils/prompt.js +1 -1
  177. package/dist/utils/spinner.js +1 -1
  178. package/dist/utils/sse-parser.js +1 -1
  179. package/dist/utils/string-utils.js +1 -1
  180. package/dist/utils/table-ref-parser.js +1 -1
  181. package/dist/utils/tdx-logger.js +1 -1
  182. package/dist/utils/version-check.js +1 -1
  183. package/package.json +1 -1
@@ -1 +1 @@
1
- const a23_0x170e36=a23_0x5cb7;(function(_0x552478,_0x49c554){const _0x5ca5db=a23_0x5cb7,_0xfa4789=_0x552478();while(!![]){try{const _0x463624=parseInt(_0x5ca5db(0x1b1))/0x1+parseInt(_0x5ca5db(0x1b8))/0x2*(-parseInt(_0x5ca5db(0x203))/0x3)+-parseInt(_0x5ca5db(0x200))/0x4*(-parseInt(_0x5ca5db(0x201))/0x5)+parseInt(_0x5ca5db(0x1d8))/0x6*(-parseInt(_0x5ca5db(0x1c3))/0x7)+-parseInt(_0x5ca5db(0x20a))/0x8+-parseInt(_0x5ca5db(0x208))/0x9*(parseInt(_0x5ca5db(0x1c2))/0xa)+parseInt(_0x5ca5db(0x1bd))/0xb;if(_0x463624===_0x49c554)break;else _0xfa4789['push'](_0xfa4789['shift']());}catch(_0xf208f1){_0xfa4789['push'](_0xfa4789['shift']());}}}(a23_0x4617,0x5fe45));import{BaseCommand,printAuthError}from'./command.js';import{listProfiles,profileExists,saveProfileToUserConfig,removeProfileFromUserConfig,loadProfile,getActiveProfile,saveActiveProfileToUserConfig}from'../core/profile.js';import{getConfigDir}from'../core/config.js';import*as a23_0x69395c from'node:path';import{saveSessionContext,getSessionID,cleanExpiredSessions}from'../core/session.js';import{saveAPIKeyAsync,resolveSite}from'../core/config.js';import{getConsoleUrl}from'../sdk/client/endpoints.js';function a23_0x4617(){const _0x2bc693=['639sKPMuL','Select\x20Treasure\x20Data\x20site\x20for\x20profile\x20\x27','4603120vdmXTk','name','profileName','logLevel','\x0aYou\x20can\x20find\x20your\x20API\x20key\x20at:','\x20Profile\x20\x27','Enter\x20site\x20name:','create','profile:use','Profile\x20name\x20must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore','profile:remove','Enter\x20profile\x20name:','Site\x20name\x20cannot\x20be\x20empty','green','split','Key=value\x20pair\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','error','Enter\x20your\x20TD\x20API\x20key\x20for\x20the\x20new\x20site:','profile:create','us01','default','\x20API\x20key\x20saved\x20to\x20system\x20keychain','\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication','597653rChiSX','database','Failed\x20to\x20remove\x20profile:\x20','Validating\x20API\x20key...','password','log','\x27\x20does\x20not\x20exist.','712184ZkbGza','\x20API\x20key\x20removed\x20from\x20system\x20keychain','Invalid\x20format.\x20Use:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','confirm','\x0aSetting\x20up\x20authentication\x20for\x20site:\x20','15050255iEOzMa','\x20\x20(no\x20profiles\x20found)','/app/mp/ak','message','\x20\x20-\x20','17970OVsagS','7vAwiwS','(session:\x20','(cleared)','\x27\x20does\x20not\x20exist.\x20Create\x20it?','test','parent_segment','Are\x20you\x20sure\x20you\x20want\x20to\x20remove\x20profile\x20\x27','\x0aAvailable\x20profiles:','length','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','\x27\x20created','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20use\x20<name>\x20[--default]','yellow','tdx:\x20profile\x20remove','bold','Removal\x20cancelled','description','\x20API\x20key\x20is\x20valid\x20(User:\x20','profile','\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.','customSite','2486994nJkqbr','\x20--default\x27\x20to\x20save\x20permanently','status','Profile\x20name\x20cannot\x20be\x20empty','You\x20can\x20find\x20your\x20API\x20key\x20at:','Set\x20session\x20profile','red','\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases','\x20\x20tdx\x20--profile\x20','select','site','\x27.\x0a\x0aValid\x20keys:\x20','\x0aOperation\x20cancelled','\x0aSetup\x20cancelled','VALID_KEYS','tdx:\x20profile\x20set','tdx.json','session','validate','text','✗\x20Validation\x20failed:\x20','execute','llm_agent','API\x20key\x20cannot\x20be\x20empty','\x20API\x20key\x20saved\x20to\x20system\x20keychain\x20(profile:\x20','includes','dim','Unknown\x20key\x20\x27','\x0aTip:\x20Use\x20\x27tdx\x20profile\x20use\x20','tdx:\x20profile\x20create','email','apiKey','Session\x20profile\x20set\x20to:\x20','trim','\x27\x20requires\x20API\x20key\x20validation.','\x27\x20updated:\x20','Enter\x20description\x20(optional):','Changing\x20site\x20to\x20\x27','Set\x20a\x20profile\x20configuration\x20value','Profile\x20\x27','13684LhhePY','375vOhWQA','Default\x20profile\x20set\x20to:\x20','6GNGzCP','config','warn','ERROR','join'];a23_0x4617=function(){return _0x2bc693;};return a23_0x4617();}import{deleteKeychainAPIKey,isKeychainAvailable}from'../core/keychain.js';import{buildSiteChoices}from'../core/constants.js';function a23_0x5cb7(_0x2d5811,_0x167491){_0x2d5811=_0x2d5811-0x1a6;const _0x4617b6=a23_0x4617();let _0x5cb7c3=_0x4617b6[_0x2d5811];return _0x5cb7c3;}import{HTTPClientError}from'../sdk/client/http-client.js';import{TDX}from'../sdk/index.js';import{LogLevel}from'../utils/tdx-logger.js';import a23_0x6247f5 from'prompts';import a23_0x1ab027 from'chalk';function validateProfileName(_0xf545c7){const _0x2de21d=a23_0x5cb7;if(!_0xf545c7||!_0xf545c7[_0x2de21d(0x1f9)]())return _0x2de21d(0x1db);const _0x52b7c3=_0xf545c7[_0x2de21d(0x1f9)]();if(!/^[a-zA-Z0-9_-]+$/[_0x2de21d(0x1c7)](_0x52b7c3))return _0x2de21d(0x213);if(profileExists(_0x52b7c3))return _0x2de21d(0x1ff)+_0x52b7c3+'\x27\x20already\x20exists.\x20Use\x20\x27tdx\x20profile\x20set\x27\x20to\x20modify\x20it.';return!![];}export class ProfileCreateCommand extends BaseCommand{[a23_0x170e36(0x20b)]=a23_0x170e36(0x1ac);[a23_0x170e36(0x1d3)]='Create\x20a\x20new\x20profile';async[a23_0x170e36(0x1ed)](_0x2c45dd){const _0x12d4fb=a23_0x170e36,{options:_0x24873b,args:_0x2b4855}=_0x2c45dd;console[_0x12d4fb(0x1b6)](a23_0x1ab027[_0x12d4fb(0x1d1)](_0x12d4fb(0x1f5)));let _0x2e867b;if(_0x2b4855['length']>0x0&&_0x2b4855[0x0]){const _0x1c59c3=_0x2b4855[0x0][_0x12d4fb(0x1f9)](),_0x2b367f=validateProfileName(_0x1c59c3);if(_0x2b367f!==!![])return console[_0x12d4fb(0x1aa)](a23_0x1ab027[_0x12d4fb(0x1de)](_0x2b367f)),0x1;_0x2e867b=_0x1c59c3;}else{const _0x5d9a44=await a23_0x6247f5({'type':_0x12d4fb(0x1eb),'name':_0x12d4fb(0x20c),'message':_0x12d4fb(0x215),'validate':validateProfileName});if(!_0x5d9a44[_0x12d4fb(0x20c)])return console[_0x12d4fb(0x1b6)](_0x12d4fb(0x1e5)),0x1;_0x2e867b=_0x5d9a44[_0x12d4fb(0x20c)][_0x12d4fb(0x1f9)]();}const _0x4edb45=await a23_0x6247f5({'type':_0x12d4fb(0x1eb),'name':_0x12d4fb(0x1d3),'message':_0x12d4fb(0x1fc)}),_0x1804f1=_0x4edb45['description']?.[_0x12d4fb(0x1f9)]()||undefined,_0x2f440b=_0x24873b[_0x12d4fb(0x1e2)]||_0x12d4fb(0x1ad),{choices:_0x3d20d2,initialIndex:_0x3d2add}=buildSiteChoices(_0x2f440b),_0xd6e67f=await a23_0x6247f5({'type':_0x12d4fb(0x1e1),'name':_0x12d4fb(0x1e2),'message':_0x12d4fb(0x209)+_0x2e867b+'\x27:','choices':_0x3d20d2,'initial':_0x3d2add});if(!_0xd6e67f['site'])return console['log'](_0x12d4fb(0x1e5)),0x1;let _0x1ae216;if(_0xd6e67f['site']==='other'){const _0x151722=await a23_0x6247f5({'type':_0x12d4fb(0x1eb),'name':_0x12d4fb(0x1d7),'message':_0x12d4fb(0x210),'initial':'us01','validate':_0x5d9eb6=>{const _0x1a7153=_0x12d4fb;if(!_0x5d9eb6||!_0x5d9eb6[_0x1a7153(0x1f9)]())return _0x1a7153(0x1a6);if(!/^[a-z0-9-]+$/[_0x1a7153(0x1c7)](_0x5d9eb6[_0x1a7153(0x1f9)]()))return'Site\x20name\x20must\x20contain\x20only\x20lowercase\x20letters,\x20numbers,\x20and\x20hyphens';return!![];}});if(!_0x151722[_0x12d4fb(0x1d7)])return console[_0x12d4fb(0x1b6)]('\x0aSetup\x20cancelled'),0x1;_0x1ae216=_0x151722[_0x12d4fb(0x1d7)];}else _0x1ae216=_0xd6e67f[_0x12d4fb(0x1e2)];const _0x2d9116=resolveSite(_0x1ae216);console[_0x12d4fb(0x1b6)](_0x12d4fb(0x1bc)+_0x2d9116),console[_0x12d4fb(0x1b6)](_0x12d4fb(0x1dc)),console[_0x12d4fb(0x1b6)]('\x20\x20'+getConsoleUrl(_0x2d9116,_0x12d4fb(0x1bf)));const _0x2188c5=await a23_0x6247f5({'type':_0x12d4fb(0x1b5),'name':'apiKey','message':'Enter\x20your\x20TD\x20API\x20key:','validate':_0x24bbba=>{const _0x502dbe=_0x12d4fb;if(!_0x24bbba||!_0x24bbba[_0x502dbe(0x1f9)]())return'API\x20key\x20cannot\x20be\x20empty';return!![];}});if(!_0x2188c5[_0x12d4fb(0x1f7)])return console['log'](_0x12d4fb(0x1e5)),0x1;const _0x4085c9=_0x2188c5[_0x12d4fb(0x1f7)];console[_0x12d4fb(0x1b6)](_0x12d4fb(0x1b4));try{const _0x156618=TDX[_0x12d4fb(0x211)]({'site':_0x2d9116,'apiKey':_0x4085c9[_0x12d4fb(0x1f9)](),'logLevel':_0x24873b['logLevel']??LogLevel['ERROR']}),_0xd3f4f5=await _0x156618['jobs']['getUserInfo']();console['log'](a23_0x1ab027[_0x12d4fb(0x1a7)]('✓')+_0x12d4fb(0x1d4)+_0xd3f4f5[_0x12d4fb(0x1f6)]+')');const _0x1e509d=await isKeychainAvailable();_0x1e509d?(await saveAPIKeyAsync(_0x4085c9['trim'](),_0x2d9116,_0x2e867b),console[_0x12d4fb(0x1b6)](a23_0x1ab027[_0x12d4fb(0x1a7)]('✓')+_0x12d4fb(0x1f0)+_0x2e867b+')')):(console[_0x12d4fb(0x205)](a23_0x1ab027[_0x12d4fb(0x1cf)]('⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.')),console[_0x12d4fb(0x205)](a23_0x1ab027[_0x12d4fb(0x1cf)](_0x12d4fb(0x1d6))));const _0x3eefb0={'site':_0x2d9116,..._0x1804f1&&{'description':_0x1804f1}};return saveProfileToUserConfig(_0x2e867b,_0x3eefb0),console[_0x12d4fb(0x1b6)](a23_0x1ab027[_0x12d4fb(0x1a7)]('✓')+_0x12d4fb(0x20f)+_0x2e867b+_0x12d4fb(0x1cd)),console[_0x12d4fb(0x1b6)](),console[_0x12d4fb(0x1b6)]('You\x20can\x20now\x20use\x20tdx\x20commands\x20with\x20this\x20profile.\x20Try:'),console[_0x12d4fb(0x1b6)](_0x12d4fb(0x1e0)+_0x2e867b+_0x12d4fb(0x1b0)),console[_0x12d4fb(0x1b6)](_0x12d4fb(0x1e0)+_0x2e867b+_0x12d4fb(0x1df)),0x0;}catch(_0x43f07b){if(_0x43f07b instanceof HTTPClientError&&_0x43f07b[_0x12d4fb(0x1da)]===0x191)return printAuthError(_0x43f07b),0x1;return console[_0x12d4fb(0x1aa)](a23_0x1ab027[_0x12d4fb(0x1de)](_0x12d4fb(0x1ec)+(_0x43f07b instanceof Error?_0x43f07b['message']:String(_0x43f07b)))),console[_0x12d4fb(0x1aa)]('Profile\x20was\x20not\x20created.\x20Please\x20try\x20again.'),0x1;}}}export class ProfileRemoveCommand extends BaseCommand{[a23_0x170e36(0x20b)]=a23_0x170e36(0x214);[a23_0x170e36(0x1d3)]='Remove\x20a\x20profile';['validate'](_0x211f87){const _0x39023a=a23_0x170e36,{args:_0x1a7cc3}=_0x211f87;if(_0x1a7cc3[_0x39023a(0x1cb)]===0x0)return'Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20remove\x20<name>';return undefined;}async[a23_0x170e36(0x1ed)](_0x1135a6){const _0x4a3d6a=a23_0x170e36,{args:_0x392a61}=_0x1135a6,_0xf639cc=_0x392a61[0x0];console['log'](a23_0x1ab027['bold'](_0x4a3d6a(0x1d0)));if(!profileExists(_0xf639cc)){console[_0x4a3d6a(0x1aa)](a23_0x1ab027[_0x4a3d6a(0x1de)](_0x4a3d6a(0x1ff)+_0xf639cc+_0x4a3d6a(0x1b7))),console[_0x4a3d6a(0x1b6)](_0x4a3d6a(0x1ca));const _0x1dc0c0=listProfiles();if(_0x1dc0c0[_0x4a3d6a(0x1cb)]===0x0)console[_0x4a3d6a(0x1b6)]('\x20\x20(no\x20profiles\x20found)');else for(const _0x1ac28d of _0x1dc0c0){console[_0x4a3d6a(0x1b6)](_0x4a3d6a(0x1c1)+_0x1ac28d[_0x4a3d6a(0x20b)]);}return 0x1;}const _0x297ab5=await a23_0x6247f5({'type':_0x4a3d6a(0x1bb),'name':'confirm','message':_0x4a3d6a(0x1c9)+_0xf639cc+'\x27?','initial':![]});if(!_0x297ab5[_0x4a3d6a(0x1bb)])return console[_0x4a3d6a(0x1b6)](_0x4a3d6a(0x1d2)),0x0;try{removeProfileFromUserConfig(_0xf639cc),console['log'](a23_0x1ab027[_0x4a3d6a(0x1a7)]('✓')+_0x4a3d6a(0x20f)+_0xf639cc+'\x27\x20removed\x20from\x20configuration');}catch(_0x3be4a4){return console[_0x4a3d6a(0x1aa)](a23_0x1ab027[_0x4a3d6a(0x1de)](_0x4a3d6a(0x1b3)+(_0x3be4a4 instanceof Error?_0x3be4a4[_0x4a3d6a(0x1c0)]:String(_0x3be4a4)))),0x1;}const _0x7180ab=await isKeychainAvailable();if(_0x7180ab){const _0x42971a=await deleteKeychainAPIKey(_0xf639cc);_0x42971a&&console[_0x4a3d6a(0x1b6)](a23_0x1ab027[_0x4a3d6a(0x1a7)]('✓')+_0x4a3d6a(0x1b9));}return 0x0;}}export class ProfileSetCommand extends BaseCommand{[a23_0x170e36(0x20b)]='profile:set';[a23_0x170e36(0x1d3)]=a23_0x170e36(0x1fe);static [a23_0x170e36(0x1e6)]=[a23_0x170e36(0x1e2),a23_0x170e36(0x1b2),a23_0x170e36(0x1c8),'llm_project',a23_0x170e36(0x1ee),a23_0x170e36(0x1d3)];[a23_0x170e36(0x1ea)](_0x2d7ac5){const _0xead38f=a23_0x170e36,{args:_0x303173,options:_0x285a78}=_0x2d7ac5,_0x397381=_0x285a78['profile']||getActiveProfile();if(!_0x397381)return'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>';if(_0x303173['length']===0x0)return _0xead38f(0x1a9)+ProfileSetCommand[_0xead38f(0x1e6)]['join'](',\x20');const _0x2fd98d=_0x303173[0x0];if(!_0x2fd98d['includes']('='))return _0xead38f(0x1ba)+ProfileSetCommand[_0xead38f(0x1e6)][_0xead38f(0x207)](',\x20');const [_0x3a82c1]=_0x2fd98d['split']('=',0x2);if(!ProfileSetCommand[_0xead38f(0x1e6)][_0xead38f(0x1f1)](_0x3a82c1))return _0xead38f(0x1f3)+_0x3a82c1+_0xead38f(0x1e3)+ProfileSetCommand['VALID_KEYS'][_0xead38f(0x207)](',\x20');return undefined;}async[a23_0x170e36(0x1ed)](_0x29cfae){const _0x5b2659=a23_0x170e36,{args:_0x34d4dd,options:_0x53ff01}=_0x29cfae,_0x31c2e0=_0x53ff01[_0x5b2659(0x1d5)]||getActiveProfile(),[_0xc03933,..._0x1f8004]=_0x34d4dd[0x0][_0x5b2659(0x1a8)]('='),_0xe17770=_0x1f8004['join']('=');console[_0x5b2659(0x1b6)](a23_0x1ab027['bold'](_0x5b2659(0x1e7)));if(!profileExists(_0x31c2e0)){const _0xb50271=await a23_0x6247f5({'type':_0x5b2659(0x1bb),'name':_0x5b2659(0x211),'message':'Profile\x20\x27'+_0x31c2e0+_0x5b2659(0x1c6),'initial':!![]});if(!_0xb50271[_0x5b2659(0x211)])return console[_0x5b2659(0x1b6)]('Operation\x20cancelled'),0x1;}const _0x23e5d0=loadProfile(_0x31c2e0),_0x4e5d24=_0x23e5d0?.[_0x5b2659(0x204)]||{};if(_0xc03933===_0x5b2659(0x1e2)){const _0x59e590=resolveSite(_0xe17770);console[_0x5b2659(0x1b6)](_0x5b2659(0x1fd)+_0x59e590+_0x5b2659(0x1fa)),console[_0x5b2659(0x1b6)](_0x5b2659(0x20e)),console[_0x5b2659(0x1b6)]('\x20\x20'+getConsoleUrl(_0x59e590,_0x5b2659(0x1bf)));const _0xd689a2=await a23_0x6247f5({'type':_0x5b2659(0x1b5),'name':_0x5b2659(0x1f7),'message':_0x5b2659(0x1ab),'validate':_0x261939=>{const _0x1935ba=_0x5b2659;if(!_0x261939||!_0x261939[_0x1935ba(0x1f9)]())return _0x1935ba(0x1ef);return!![];}});if(!_0xd689a2[_0x5b2659(0x1f7)])return console['log'](_0x5b2659(0x1e4)),0x1;console[_0x5b2659(0x1b6)](_0x5b2659(0x1b4));try{const _0x398376=TDX['create']({'site':_0x59e590,'apiKey':_0xd689a2['apiKey'][_0x5b2659(0x1f9)](),'logLevel':_0x53ff01[_0x5b2659(0x20d)]??LogLevel[_0x5b2659(0x206)]}),_0x50e9ef=await _0x398376['jobs']['getUserInfo']();console[_0x5b2659(0x1b6)](a23_0x1ab027[_0x5b2659(0x1a7)]('✓')+'\x20API\x20key\x20is\x20valid\x20(User:\x20'+_0x50e9ef['email']+')');const _0x138718=await isKeychainAvailable();_0x138718?(await saveAPIKeyAsync(_0xd689a2[_0x5b2659(0x1f7)][_0x5b2659(0x1f9)](),_0x59e590,_0x31c2e0),console['log'](a23_0x1ab027[_0x5b2659(0x1a7)]('✓')+_0x5b2659(0x1af))):console[_0x5b2659(0x205)](a23_0x1ab027[_0x5b2659(0x1cf)](_0x5b2659(0x1cc))),_0x4e5d24[_0x5b2659(0x1e2)]=_0x59e590;}catch(_0x1ded52){if(_0x1ded52 instanceof HTTPClientError&&_0x1ded52[_0x5b2659(0x1da)]===0x191)return printAuthError(_0x1ded52),0x1;return console['error'](a23_0x1ab027[_0x5b2659(0x1de)](_0x5b2659(0x1ec)+(_0x1ded52 instanceof Error?_0x1ded52[_0x5b2659(0x1c0)]:String(_0x1ded52)))),console[_0x5b2659(0x1aa)]('Site\x20was\x20not\x20changed.'),0x1;}}else _0x4e5d24[_0xc03933]=_0xe17770||undefined;return saveProfileToUserConfig(_0x31c2e0,_0x4e5d24),console[_0x5b2659(0x1b6)](a23_0x1ab027[_0x5b2659(0x1a7)]('✓')+_0x5b2659(0x20f)+_0x31c2e0+_0x5b2659(0x1fb)+_0xc03933+'='+(_0xe17770||_0x5b2659(0x1c5))),0x0;}}export class ProfileUseCommand extends BaseCommand{[a23_0x170e36(0x20b)]=a23_0x170e36(0x212);['description']=a23_0x170e36(0x1dd);['validate'](_0x368186){const _0x1710bc=a23_0x170e36,{args:_0x2487b5}=_0x368186;if(_0x2487b5[_0x1710bc(0x1cb)]===0x0)return _0x1710bc(0x1ce);return undefined;}async[a23_0x170e36(0x1ed)](_0x1686ce){const _0x5a8d92=a23_0x170e36,{args:_0x2cf97d,options:_0x50bd37}=_0x1686ce,_0x5b95bb=_0x2cf97d[0x0],_0x5abc3a=_0x50bd37[_0x5a8d92(0x1ae)];cleanExpiredSessions();if(!profileExists(_0x5b95bb)){console['error'](a23_0x1ab027['red'](_0x5a8d92(0x1ff)+_0x5b95bb+_0x5a8d92(0x1b7))),console['log'](_0x5a8d92(0x1ca));const _0x37e6aa=listProfiles();if(_0x37e6aa[_0x5a8d92(0x1cb)]===0x0)console[_0x5a8d92(0x1b6)](_0x5a8d92(0x1be));else for(const _0x19b78c of _0x37e6aa){console[_0x5a8d92(0x1b6)](_0x5a8d92(0x1c1)+_0x19b78c['name']);}return 0x1;}if(_0x5abc3a){const _0x4b3a1c=a23_0x69395c[_0x5a8d92(0x207)](getConfigDir(),_0x5a8d92(0x1e8));return saveActiveProfileToUserConfig(_0x5b95bb),console[_0x5a8d92(0x1b6)](_0x5a8d92(0x202)+a23_0x1ab027[_0x5a8d92(0x1a7)](_0x5b95bb)),console['log'](a23_0x1ab027[_0x5a8d92(0x1f2)]('\x0aSaved\x20to:\x20'+_0x4b3a1c)),0x0;}const _0x3269b7=getSessionID(_0x50bd37[_0x5a8d92(0x1e9)]);return saveSessionContext({'profile':_0x5b95bb},_0x50bd37['session']),console['log'](_0x5a8d92(0x1f8)+a23_0x1ab027[_0x5a8d92(0x1a7)](_0x5b95bb)+'\x20'+a23_0x1ab027[_0x5a8d92(0x1f2)](_0x5a8d92(0x1c4)+_0x3269b7+')')),console['log'](a23_0x1ab027[_0x5a8d92(0x1f2)](_0x5a8d92(0x1f4)+_0x5b95bb+_0x5a8d92(0x1d9))),0x0;}}
1
+ const a23_0xc14607=a23_0x30c0;function a23_0x30c0(_0x3d857e,_0x3a70cb){_0x3d857e=_0x3d857e-0x1e9;const _0x276ddf=a23_0x276d();let _0x30c0a9=_0x276ddf[_0x3d857e];return _0x30c0a9;}function a23_0x276d(){const _0x3cde7c=['/app/mp/ak','\x0aSetting\x20up\x20authentication\x20for\x20site:\x20','\x27\x20requires\x20API\x20key\x20validation.','144XFyZKQ','Site\x20name\x20must\x20contain\x20only\x20lowercase\x20letters,\x20numbers,\x20and\x20hyphens','getUserInfo','default','database','2286430NueYPx','tdx:\x20profile\x20set','\x20API\x20key\x20is\x20valid\x20(User:\x20','Profile\x20was\x20not\x20created.\x20Please\x20try\x20again.','Profile\x20\x27','tdx:\x20profile\x20create','Are\x20you\x20sure\x20you\x20want\x20to\x20remove\x20profile\x20\x27','\x20\x20tdx\x20--profile\x20','log','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','green','Failed\x20to\x20remove\x20profile:\x20','dim','\x27\x20does\x20not\x20exist.\x20Create\x20it?','API\x20key\x20cannot\x20be\x20empty','Key=value\x20pair\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','8GMUQlZ','\x20\x20-\x20','password','status','Enter\x20your\x20TD\x20API\x20key:','Enter\x20description\x20(optional):','1404290lZJGrE','select','\x27\x20created','parent_segment','\x0aYou\x20can\x20find\x20your\x20API\x20key\x20at:','Site\x20name\x20cannot\x20be\x20empty','ERROR','\x20Profile\x20\x27','description','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20use\x20<name>\x20[--default]','Validating\x20API\x20key...','validate','\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases','Enter\x20site\x20name:','\x27\x20updated:\x20','confirm','Select\x20Treasure\x20Data\x20site\x20for\x20profile\x20\x27','\x27\x20removed\x20from\x20configuration','Profile\x20name\x20must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore','746sAzUOT','✗\x20Validation\x20failed:\x20','Site\x20was\x20not\x20changed.','Removal\x20cancelled','jobs','llm_agent','Set\x20a\x20profile\x20configuration\x20value','yellow','apiKey','profile:set','name','Profile\x20name\x20cannot\x20be\x20empty','profile','profile:create','\x27\x20already\x20exists.\x20Use\x20\x27tdx\x20profile\x20set\x27\x20to\x20modify\x20it.','customSite','\x27.\x0a\x0aValid\x20keys:\x20','\x27\x20does\x20not\x20exist.','Set\x20session\x20profile','trim','execute','16613949PIBpMp','Unknown\x20key\x20\x27','16EjTNCe','\x20API\x20key\x20removed\x20from\x20system\x20keychain','site','\x0aOperation\x20cancelled','Operation\x20cancelled','\x0aSaved\x20to:\x20','VALID_KEYS','66479xuuurz','warn','session','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>','profileName','email','\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.','Invalid\x20format.\x20Use:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication','bold','16227czdfhp','logLevel','\x20\x20(no\x20profiles\x20found)','us01','red','text','join','message','create','246MtFoWo','test','Enter\x20profile\x20name:','length','(cleared)','tdx:\x20profile\x20remove','\x0aSetup\x20cancelled','other','split','error','\x20--default\x27\x20to\x20save\x20permanently','(session:\x20','\x20API\x20key\x20saved\x20to\x20system\x20keychain','839601UCAEcn'];a23_0x276d=function(){return _0x3cde7c;};return a23_0x276d();}(function(_0x3b0410,_0x555852){const _0x32fa35=a23_0x30c0,_0x29face=_0x3b0410();while(!![]){try{const _0xb91485=parseInt(_0x32fa35(0x203))/0x1+parseInt(_0x32fa35(0x235))/0x2*(parseInt(_0x32fa35(0x207))/0x3)+-parseInt(_0x32fa35(0x21c))/0x4*(parseInt(_0x32fa35(0x20c))/0x5)+parseInt(_0x32fa35(0x1f6))/0x6*(-parseInt(_0x32fa35(0x253))/0x7)+parseInt(_0x32fa35(0x24c))/0x8*(-parseInt(_0x32fa35(0x1ed))/0x9)+-parseInt(_0x32fa35(0x222))/0xa+parseInt(_0x32fa35(0x24a))/0xb;if(_0xb91485===_0x555852)break;else _0x29face['push'](_0x29face['shift']());}catch(_0x36c4d6){_0x29face['push'](_0x29face['shift']());}}}(a23_0x276d,0xe0948));import{BaseCommand,printAuthError}from'./command.js';import{listProfiles,profileExists,saveProfileToUserConfig,removeProfileFromUserConfig,loadProfile,getActiveProfile,saveActiveProfileToUserConfig}from'../core/profile.js';import{getConfigDir}from'../core/config.js';import*as a23_0x1be22d from'node:path';import{saveSessionContext,getSessionID,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{buildSiteChoices}from'../core/constants.js';import{HTTPClientError}from'../sdk/client/http-client.js';import{TDX}from'../sdk/index.js';import{LogLevel}from'../utils/tdx-logger.js';import a23_0x1c0fa1 from'prompts';import a23_0xa07699 from'chalk';function validateProfileName(_0x24ab08){const _0x26049c=a23_0x30c0;if(!_0x24ab08||!_0x24ab08[_0x26049c(0x248)]())return _0x26049c(0x240);const _0xaacf02=_0x24ab08['trim']();if(!/^[a-zA-Z0-9_-]+$/['test'](_0xaacf02))return _0x26049c(0x234);if(profileExists(_0xaacf02))return _0x26049c(0x210)+_0xaacf02+_0x26049c(0x243);return!![];}export class ProfileCreateCommand extends BaseCommand{['name']=a23_0xc14607(0x242);[a23_0xc14607(0x22a)]='Create\x20a\x20new\x20profile';async[a23_0xc14607(0x249)](_0x358d08){const _0x3936a3=a23_0xc14607,{options:_0x5947ff,args:_0x224c7e}=_0x358d08;console[_0x3936a3(0x214)](a23_0xa07699[_0x3936a3(0x1ec)](_0x3936a3(0x211)));let _0x4c2161;if(_0x224c7e[_0x3936a3(0x1f9)]>0x0&&_0x224c7e[0x0]){const _0x4eb428=_0x224c7e[0x0]['trim'](),_0xf87db8=validateProfileName(_0x4eb428);if(_0xf87db8!==!![])return console[_0x3936a3(0x1ff)](a23_0xa07699[_0x3936a3(0x1f1)](_0xf87db8)),0x1;_0x4c2161=_0x4eb428;}else{const _0x52259c=await a23_0x1c0fa1({'type':'text','name':_0x3936a3(0x257),'message':_0x3936a3(0x1f8),'validate':validateProfileName});if(!_0x52259c[_0x3936a3(0x257)])return console[_0x3936a3(0x214)](_0x3936a3(0x1fc)),0x1;_0x4c2161=_0x52259c[_0x3936a3(0x257)][_0x3936a3(0x248)]();}const _0x390b3e=await a23_0x1c0fa1({'type':_0x3936a3(0x1f2),'name':_0x3936a3(0x22a),'message':_0x3936a3(0x221)}),_0x47d8f2=_0x390b3e[_0x3936a3(0x22a)]?.[_0x3936a3(0x248)]()||undefined,_0x5e41e6=_0x5947ff[_0x3936a3(0x24e)]||_0x3936a3(0x1f0),{choices:_0xc77140,initialIndex:_0x34062c}=buildSiteChoices(_0x5e41e6),_0x18e760=await a23_0x1c0fa1({'type':_0x3936a3(0x223),'name':_0x3936a3(0x24e),'message':_0x3936a3(0x232)+_0x4c2161+'\x27:','choices':_0xc77140,'initial':_0x34062c});if(!_0x18e760[_0x3936a3(0x24e)])return console[_0x3936a3(0x214)](_0x3936a3(0x1fc)),0x1;let _0x14600b;if(_0x18e760[_0x3936a3(0x24e)]===_0x3936a3(0x1fd)){const _0xc51b48=await a23_0x1c0fa1({'type':_0x3936a3(0x1f2),'name':_0x3936a3(0x244),'message':_0x3936a3(0x22f),'initial':_0x3936a3(0x1f0),'validate':_0x927acc=>{const _0x5a2ccf=_0x3936a3;if(!_0x927acc||!_0x927acc[_0x5a2ccf(0x248)]())return _0x5a2ccf(0x227);if(!/^[a-z0-9-]+$/[_0x5a2ccf(0x1f7)](_0x927acc[_0x5a2ccf(0x248)]()))return _0x5a2ccf(0x208);return!![];}});if(!_0xc51b48[_0x3936a3(0x244)])return console['log'](_0x3936a3(0x1fc)),0x1;_0x14600b=_0xc51b48[_0x3936a3(0x244)];}else _0x14600b=_0x18e760['site'];const _0x951806=resolveSite(_0x14600b);console[_0x3936a3(0x214)](_0x3936a3(0x205)+_0x951806),console['log']('You\x20can\x20find\x20your\x20API\x20key\x20at:'),console[_0x3936a3(0x214)]('\x20\x20'+getConsoleUrl(_0x951806,_0x3936a3(0x204)));const _0x6f1250=await a23_0x1c0fa1({'type':_0x3936a3(0x21e),'name':_0x3936a3(0x23d),'message':_0x3936a3(0x220),'validate':_0x957f2=>{const _0x3d8048=_0x3936a3;if(!_0x957f2||!_0x957f2[_0x3d8048(0x248)]())return'API\x20key\x20cannot\x20be\x20empty';return!![];}});if(!_0x6f1250[_0x3936a3(0x23d)])return console[_0x3936a3(0x214)]('\x0aSetup\x20cancelled'),0x1;const _0x1396e3=_0x6f1250[_0x3936a3(0x23d)];console[_0x3936a3(0x214)](_0x3936a3(0x22c));try{const _0x107796=TDX[_0x3936a3(0x1f5)]({'site':_0x951806,'apiKey':_0x1396e3[_0x3936a3(0x248)](),'logLevel':_0x5947ff[_0x3936a3(0x1ee)]??LogLevel[_0x3936a3(0x228)]}),_0x12b735=await _0x107796[_0x3936a3(0x239)]['getUserInfo']();console[_0x3936a3(0x214)](a23_0xa07699[_0x3936a3(0x216)]('✓')+_0x3936a3(0x20e)+_0x12b735[_0x3936a3(0x258)]+')');const _0x3e8c1a=await isKeychainAvailable();_0x3e8c1a?(await saveAPIKeyAsync(_0x1396e3[_0x3936a3(0x248)](),_0x951806,_0x4c2161),console[_0x3936a3(0x214)](a23_0xa07699[_0x3936a3(0x216)]('✓')+'\x20API\x20key\x20saved\x20to\x20system\x20keychain\x20(profile:\x20'+_0x4c2161+')')):(console[_0x3936a3(0x254)](a23_0xa07699[_0x3936a3(0x23c)](_0x3936a3(0x215))),console['warn'](a23_0xa07699[_0x3936a3(0x23c)](_0x3936a3(0x1e9))));const _0x598fbe={'site':_0x951806,..._0x47d8f2&&{'description':_0x47d8f2}};return saveProfileToUserConfig(_0x4c2161,_0x598fbe),console[_0x3936a3(0x214)](a23_0xa07699[_0x3936a3(0x216)]('✓')+_0x3936a3(0x229)+_0x4c2161+_0x3936a3(0x224)),console[_0x3936a3(0x214)](),console[_0x3936a3(0x214)]('You\x20can\x20now\x20use\x20tdx\x20commands\x20with\x20this\x20profile.\x20Try:'),console['log'](_0x3936a3(0x213)+_0x4c2161+_0x3936a3(0x1eb)),console[_0x3936a3(0x214)](_0x3936a3(0x213)+_0x4c2161+_0x3936a3(0x22e)),0x0;}catch(_0xcdbfce){if(_0xcdbfce instanceof HTTPClientError&&_0xcdbfce[_0x3936a3(0x21f)]===0x191)return printAuthError(_0xcdbfce),0x1;return console['error'](a23_0xa07699[_0x3936a3(0x1f1)](_0x3936a3(0x236)+(_0xcdbfce instanceof Error?_0xcdbfce[_0x3936a3(0x1f4)]:String(_0xcdbfce)))),console[_0x3936a3(0x1ff)](_0x3936a3(0x20f)),0x1;}}}export class ProfileRemoveCommand extends BaseCommand{[a23_0xc14607(0x23f)]='profile:remove';[a23_0xc14607(0x22a)]='Remove\x20a\x20profile';[a23_0xc14607(0x22d)](_0x3797a2){const {args:_0x33f452}=_0x3797a2;if(_0x33f452['length']===0x0)return'Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20remove\x20<name>';return undefined;}async[a23_0xc14607(0x249)](_0x35043b){const _0x55a82e=a23_0xc14607,{args:_0x4f10d8}=_0x35043b,_0x1b3142=_0x4f10d8[0x0];console['log'](a23_0xa07699['bold'](_0x55a82e(0x1fb)));if(!profileExists(_0x1b3142)){console[_0x55a82e(0x1ff)](a23_0xa07699[_0x55a82e(0x1f1)](_0x55a82e(0x210)+_0x1b3142+_0x55a82e(0x246))),console['log']('\x0aAvailable\x20profiles:');const _0x58a34c=listProfiles();if(_0x58a34c[_0x55a82e(0x1f9)]===0x0)console[_0x55a82e(0x214)](_0x55a82e(0x1ef));else for(const _0x3d01db of _0x58a34c){console[_0x55a82e(0x214)](_0x55a82e(0x21d)+_0x3d01db['name']);}return 0x1;}const _0x1d1d28=await a23_0x1c0fa1({'type':_0x55a82e(0x231),'name':_0x55a82e(0x231),'message':_0x55a82e(0x212)+_0x1b3142+'\x27?','initial':![]});if(!_0x1d1d28['confirm'])return console[_0x55a82e(0x214)](_0x55a82e(0x238)),0x0;try{removeProfileFromUserConfig(_0x1b3142),console['log'](a23_0xa07699[_0x55a82e(0x216)]('✓')+_0x55a82e(0x229)+_0x1b3142+_0x55a82e(0x233));}catch(_0x2642f5){return console[_0x55a82e(0x1ff)](a23_0xa07699['red'](_0x55a82e(0x217)+(_0x2642f5 instanceof Error?_0x2642f5['message']:String(_0x2642f5)))),0x1;}const _0x363e2d=await isKeychainAvailable();if(_0x363e2d){const _0x59abaf=await deleteKeychainAPIKey(_0x1b3142);_0x59abaf&&console[_0x55a82e(0x214)](a23_0xa07699[_0x55a82e(0x216)]('✓')+_0x55a82e(0x24d));}return 0x0;}}export class ProfileSetCommand extends BaseCommand{[a23_0xc14607(0x23f)]=a23_0xc14607(0x23e);[a23_0xc14607(0x22a)]=a23_0xc14607(0x23b);static [a23_0xc14607(0x252)]=[a23_0xc14607(0x24e),a23_0xc14607(0x20b),a23_0xc14607(0x225),'llm_project',a23_0xc14607(0x23a),a23_0xc14607(0x22a)];[a23_0xc14607(0x22d)](_0x163dcd){const _0x227fa8=a23_0xc14607,{args:_0x43c66b,options:_0x2273d2}=_0x163dcd,_0x204290=_0x2273d2[_0x227fa8(0x241)]||getActiveProfile();if(!_0x204290)return _0x227fa8(0x256);if(_0x43c66b[_0x227fa8(0x1f9)]===0x0)return _0x227fa8(0x21b)+ProfileSetCommand[_0x227fa8(0x252)][_0x227fa8(0x1f3)](',\x20');const _0x585d66=_0x43c66b[0x0];if(!_0x585d66['includes']('='))return _0x227fa8(0x1ea)+ProfileSetCommand[_0x227fa8(0x252)][_0x227fa8(0x1f3)](',\x20');const [_0x1439bf]=_0x585d66['split']('=',0x2);if(!ProfileSetCommand[_0x227fa8(0x252)]['includes'](_0x1439bf))return _0x227fa8(0x24b)+_0x1439bf+_0x227fa8(0x245)+ProfileSetCommand[_0x227fa8(0x252)][_0x227fa8(0x1f3)](',\x20');return undefined;}async['execute'](_0x1a4988){const _0x1c605d=a23_0xc14607,{args:_0x394ff5,options:_0x307806}=_0x1a4988,_0x146367=_0x307806[_0x1c605d(0x241)]||getActiveProfile(),[_0x583445,..._0x18d881]=_0x394ff5[0x0][_0x1c605d(0x1fe)]('='),_0x463022=_0x18d881['join']('=');console['log'](a23_0xa07699[_0x1c605d(0x1ec)](_0x1c605d(0x20d)));if(!profileExists(_0x146367)){const _0x59d4c7=await a23_0x1c0fa1({'type':'confirm','name':_0x1c605d(0x1f5),'message':_0x1c605d(0x210)+_0x146367+_0x1c605d(0x219),'initial':!![]});if(!_0x59d4c7[_0x1c605d(0x1f5)])return console['log'](_0x1c605d(0x250)),0x1;}const _0x25b23e=loadProfile(_0x146367),_0x32f597=_0x25b23e?.['config']||{};if(_0x583445==='site'){const _0x62e553=resolveSite(_0x463022);console[_0x1c605d(0x214)]('Changing\x20site\x20to\x20\x27'+_0x62e553+_0x1c605d(0x206)),console[_0x1c605d(0x214)](_0x1c605d(0x226)),console[_0x1c605d(0x214)]('\x20\x20'+getConsoleUrl(_0x62e553,'/app/mp/ak'));const _0x2be7a0=await a23_0x1c0fa1({'type':_0x1c605d(0x21e),'name':_0x1c605d(0x23d),'message':'Enter\x20your\x20TD\x20API\x20key\x20for\x20the\x20new\x20site:','validate':_0x4df0ba=>{const _0x13f96d=_0x1c605d;if(!_0x4df0ba||!_0x4df0ba[_0x13f96d(0x248)]())return _0x13f96d(0x21a);return!![];}});if(!_0x2be7a0[_0x1c605d(0x23d)])return console[_0x1c605d(0x214)](_0x1c605d(0x24f)),0x1;console[_0x1c605d(0x214)](_0x1c605d(0x22c));try{const _0x5dbf6f=TDX['create']({'site':_0x62e553,'apiKey':_0x2be7a0[_0x1c605d(0x23d)][_0x1c605d(0x248)](),'logLevel':_0x307806[_0x1c605d(0x1ee)]??LogLevel[_0x1c605d(0x228)]}),_0x3c9f7d=await _0x5dbf6f[_0x1c605d(0x239)][_0x1c605d(0x209)]();console[_0x1c605d(0x214)](a23_0xa07699[_0x1c605d(0x216)]('✓')+_0x1c605d(0x20e)+_0x3c9f7d['email']+')');const _0x93a710=await isKeychainAvailable();_0x93a710?(await saveAPIKeyAsync(_0x2be7a0[_0x1c605d(0x23d)][_0x1c605d(0x248)](),_0x62e553,_0x146367),console['log'](a23_0xa07699[_0x1c605d(0x216)]('✓')+_0x1c605d(0x202))):console[_0x1c605d(0x254)](a23_0xa07699['yellow'](_0x1c605d(0x215))),_0x32f597[_0x1c605d(0x24e)]=_0x62e553;}catch(_0x33b8bd){if(_0x33b8bd instanceof HTTPClientError&&_0x33b8bd[_0x1c605d(0x21f)]===0x191)return printAuthError(_0x33b8bd),0x1;return console[_0x1c605d(0x1ff)](a23_0xa07699[_0x1c605d(0x1f1)]('✗\x20Validation\x20failed:\x20'+(_0x33b8bd instanceof Error?_0x33b8bd['message']:String(_0x33b8bd)))),console[_0x1c605d(0x1ff)](_0x1c605d(0x237)),0x1;}}else _0x32f597[_0x583445]=_0x463022||undefined;return saveProfileToUserConfig(_0x146367,_0x32f597),console[_0x1c605d(0x214)](a23_0xa07699['green']('✓')+_0x1c605d(0x229)+_0x146367+_0x1c605d(0x230)+_0x583445+'='+(_0x463022||_0x1c605d(0x1fa))),0x0;}}export class ProfileUseCommand extends BaseCommand{[a23_0xc14607(0x23f)]='profile:use';[a23_0xc14607(0x22a)]=a23_0xc14607(0x247);['validate'](_0x2eeb85){const _0x300a05=a23_0xc14607,{args:_0x165972}=_0x2eeb85;if(_0x165972[_0x300a05(0x1f9)]===0x0)return _0x300a05(0x22b);return undefined;}async['execute'](_0x23b6c5){const _0x591fbb=a23_0xc14607,{args:_0x5709f1,options:_0x5be498}=_0x23b6c5,_0x333da9=_0x5709f1[0x0],_0x4820a8=_0x5be498[_0x591fbb(0x20a)];cleanExpiredSessions();if(!profileExists(_0x333da9)){console[_0x591fbb(0x1ff)](a23_0xa07699[_0x591fbb(0x1f1)](_0x591fbb(0x210)+_0x333da9+_0x591fbb(0x246))),console[_0x591fbb(0x214)]('\x0aAvailable\x20profiles:');const _0x118213=listProfiles();if(_0x118213['length']===0x0)console[_0x591fbb(0x214)]('\x20\x20(no\x20profiles\x20found)');else for(const _0x24f839 of _0x118213){console[_0x591fbb(0x214)](_0x591fbb(0x21d)+_0x24f839['name']);}return 0x1;}if(_0x4820a8){const _0x3a581e=a23_0x1be22d['join'](getConfigDir(),'tdx.json');return saveActiveProfileToUserConfig(_0x333da9),console[_0x591fbb(0x214)]('Default\x20profile\x20set\x20to:\x20'+a23_0xa07699[_0x591fbb(0x216)](_0x333da9)),console[_0x591fbb(0x214)](a23_0xa07699['dim'](_0x591fbb(0x251)+_0x3a581e)),0x0;}const _0x1963ed=getSessionID(_0x5be498['session']);return saveSessionContext({'profile':_0x333da9},_0x5be498[_0x591fbb(0x255)]),console[_0x591fbb(0x214)]('Session\x20profile\x20set\x20to:\x20'+a23_0xa07699[_0x591fbb(0x216)](_0x333da9)+'\x20'+a23_0xa07699['dim'](_0x591fbb(0x201)+_0x1963ed+')')),console['log'](a23_0xa07699[_0x591fbb(0x218)]('\x0aTip:\x20Use\x20\x27tdx\x20profile\x20use\x20'+_0x333da9+_0x591fbb(0x200))),0x0;}}
@@ -1 +1 @@
1
- const a24_0x47fb10=a24_0x2c73;function a24_0x4e87(){const _0x54347d=['1332ONbwmy','name','8552hTKMIT','2592520WKjjpr','6419DSFsrZ','config','\x20\x20Global:\x20~/.config/tdx/tdx.json','message','966762jWSUxm','120749YOliPd','error','Error:\x20','15890743GZDhKP','log','22jtRpSq','8371908eCCuLG','description','10UjXiXC','List\x20all\x20available\x20profiles','\x20\x20Local:\x20\x20(project\x20folder)/tdx.json','execute','5151gwbThM','profiles'];a24_0x4e87=function(){return _0x54347d;};return a24_0x4e87();}(function(_0x58b0df,_0x286460){const _0x3895ba=a24_0x2c73,_0x4bd220=_0x58b0df();while(!![]){try{const _0x4522c9=-parseInt(_0x3895ba(0x1ae))/0x1*(-parseInt(_0x3895ba(0x1b3))/0x2)+-parseInt(_0x3895ba(0x1a3))/0x3*(-parseInt(_0x3895ba(0x1a5))/0x4)+-parseInt(_0x3895ba(0x1a8))/0x5+-parseInt(_0x3895ba(0x1ad))/0x6+-parseInt(_0x3895ba(0x1a9))/0x7*(parseInt(_0x3895ba(0x1a7))/0x8)+-parseInt(_0x3895ba(0x1b4))/0x9+parseInt(_0x3895ba(0x1b6))/0xa*(parseInt(_0x3895ba(0x1b1))/0xb);if(_0x4522c9===_0x286460)break;else _0x4bd220['push'](_0x4bd220['shift']());}catch(_0x369406){_0x4bd220['push'](_0x4bd220['shift']());}}}(a24_0x4e87,0xb8341));import{BaseCommand}from'./command.js';import{listProfiles,getActiveProfile,getProfileParams}from'../core/profile.js';import{handleSDKOutput}from'../core/command-output.js';function a24_0x2c73(_0x2d79de,_0x101acc){_0x2d79de=_0x2d79de-0x1a3;const _0x4e87eb=a24_0x4e87();let _0x2c738c=_0x4e87eb[_0x2d79de];return _0x2c738c;}export class ProfilesCommand extends BaseCommand{['name']=a24_0x47fb10(0x1a4);[a24_0x47fb10(0x1b5)]=a24_0x47fb10(0x1b7);async[a24_0x47fb10(0x1b9)](_0x3dd673){const _0x43d04f=a24_0x47fb10,{options:_0x2c97a2}=_0x3dd673;try{const _0x3c3404=listProfiles(),_0x1588e3=getActiveProfile();if(_0x3c3404['length']===0x0)return console[_0x43d04f(0x1b2)]('No\x20profiles\x20found.\x20Define\x20profiles\x20in\x20tdx.json:\x0a'),console[_0x43d04f(0x1b2)](_0x43d04f(0x1b8)),console['log'](_0x43d04f(0x1ab)),0x0;const _0x42b3de=_0x3c3404['map'](_0x3f4f63=>{const _0x3636b5=_0x43d04f,_0x4a99be=_0x3f4f63['name']===_0x1588e3,_0x5a413f=getProfileParams(_0x3f4f63[_0x3636b5(0x1aa)]);return{'name':_0x3f4f63[_0x3636b5(0x1a6)],'active':_0x4a99be,'scope':_0x3f4f63['scope'],'description':_0x3f4f63['config'][_0x3636b5(0x1b5)]||'','params':_0x5a413f};});return await handleSDKOutput(_0x42b3de,_0x2c97a2),0x0;}catch(_0x4f01c5){return _0x4f01c5 instanceof Error&&console[_0x43d04f(0x1af)](_0x43d04f(0x1b0)+_0x4f01c5[_0x43d04f(0x1ac)]),0x1;}}}
1
+ const a24_0xf599ea=a24_0x291e;function a24_0x291e(_0x29341d,_0x3020e7){_0x29341d=_0x29341d-0xdc;const _0x56eeb3=a24_0x56ee();let _0x291e58=_0x56eeb3[_0x29341d];return _0x291e58;}(function(_0x342b71,_0x1713f4){const _0x3d1d29=a24_0x291e,_0x52b469=_0x342b71();while(!![]){try{const _0xec52f7=-parseInt(_0x3d1d29(0xe7))/0x1+-parseInt(_0x3d1d29(0xe1))/0x2+-parseInt(_0x3d1d29(0xe4))/0x3*(parseInt(_0x3d1d29(0xe8))/0x4)+-parseInt(_0x3d1d29(0xee))/0x5*(-parseInt(_0x3d1d29(0xdd))/0x6)+parseInt(_0x3d1d29(0xdf))/0x7*(-parseInt(_0x3d1d29(0xf0))/0x8)+-parseInt(_0x3d1d29(0xe9))/0x9+parseInt(_0x3d1d29(0xe3))/0xa*(parseInt(_0x3d1d29(0xed))/0xb);if(_0xec52f7===_0x1713f4)break;else _0x52b469['push'](_0x52b469['shift']());}catch(_0x59e355){_0x52b469['push'](_0x52b469['shift']());}}}(a24_0x56ee,0xb7066));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{[a24_0xf599ea(0xde)]='profiles';[a24_0xf599ea(0xe6)]=a24_0xf599ea(0xeb);async[a24_0xf599ea(0xef)](_0x575686){const _0x39cf87=a24_0xf599ea,{options:_0x4bd417}=_0x575686;try{const _0x4c949d=listProfiles(),_0x1194c4=getActiveProfile();if(_0x4c949d['length']===0x0)return console[_0x39cf87(0xdc)]('No\x20profiles\x20found.\x20Define\x20profiles\x20in\x20tdx.json:\x0a'),console['log']('\x20\x20Local:\x20\x20(project\x20folder)/tdx.json'),console[_0x39cf87(0xdc)]('\x20\x20Global:\x20~/.config/tdx/tdx.json'),0x0;const _0x42443a=_0x4c949d[_0x39cf87(0xe0)](_0x548dfb=>{const _0x4a900d=_0x39cf87,_0x5eafab=_0x548dfb[_0x4a900d(0xde)]===_0x1194c4,_0x4587b7=getProfileParams(_0x548dfb['config']);return{'name':_0x548dfb[_0x4a900d(0xde)],'active':_0x5eafab,'scope':_0x548dfb[_0x4a900d(0xec)],'description':_0x548dfb[_0x4a900d(0xe2)]['description']||'','params':_0x4587b7};});return await handleSDKOutput(_0x42443a,_0x4bd417),0x0;}catch(_0x509bc7){return _0x509bc7 instanceof Error&&console[_0x39cf87(0xea)](_0x39cf87(0xf1)+_0x509bc7[_0x39cf87(0xe5)]),0x1;}}}function a24_0x56ee(){const _0x1f8971=['5033592XvIbDN','error','List\x20all\x20available\x20profiles','scope','11OnfTHh','2311435LqVCVT','execute','1222360mbfxZa','Error:\x20','log','12tXYyzd','name','49tapweF','map','748084jgzCLK','config','35591090IVDrLr','441yoPtHl','message','description','872197eDVzfp','23372JKwIRs'];a24_0x56ee=function(){return _0x1f8971;};return a24_0x56ee();}
@@ -1 +1 @@
1
- const a25_0x2d5b3e=a25_0x3cb1;(function(_0xc8a670,_0x145f65){const _0x18fc9a=a25_0x3cb1,_0x469d02=_0xc8a670();while(!![]){try{const _0x5327a6=parseInt(_0x18fc9a(0xd8))/0x1+-parseInt(_0x18fc9a(0xf0))/0x2+-parseInt(_0x18fc9a(0xe6))/0x3+parseInt(_0x18fc9a(0xcf))/0x4+parseInt(_0x18fc9a(0xf4))/0x5+parseInt(_0x18fc9a(0xde))/0x6+-parseInt(_0x18fc9a(0xce))/0x7;if(_0x5327a6===_0x145f65)break;else _0x469d02['push'](_0x469d02['shift']());}catch(_0x3211cd){_0x469d02['push'](_0x469d02['shift']());}}}(a25_0x4885,0x76703));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';function a25_0x3cb1(_0x865c17,_0x51df67){_0x865c17=_0x865c17-0xcb;const _0x4885d3=a25_0x4885();let _0x3cb1cf=_0x4885d3[_0x865c17];return _0x3cb1cf;}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{[a25_0x2d5b3e(0xd5)]='query';['description']=a25_0x2d5b3e(0xe7);async[a25_0x2d5b3e(0xf2)](_0x4f0a74){const _0x65f190=a25_0x2d5b3e,{options:_0x9b201,args:_0x432678,tdx:_0x4424ce}=_0x4f0a74,_0x1ac08a=_0x432678[0x0],_0x11eb38=_0x9b201[_0x65f190(0xf5)];let _0x5750f9;try{if(_0x11eb38)_0x5750f9=readSqlStatementsFromFile(_0x11eb38);else{if(_0x1ac08a==='-')_0x5750f9=await readSqlStatementsFromStdin();else{if(_0x1ac08a&&isSqlFilePath(_0x1ac08a))_0x5750f9=readSqlStatementsFromFile(_0x1ac08a);else{if(_0x1ac08a)_0x5750f9=splitSqlStatements(_0x1ac08a);else throw new Error(_0x65f190(0xdc));}}}}catch(_0x2a3d15){return console[_0x65f190(0xdf)](_0x65f190(0xf9)+_0x2a3d15[_0x65f190(0xe2)]),0x1;}const _0x233258=_0x9b201[_0x65f190(0xd4)]||_0x65f190(0xf8),_0x22228f=_0x9b201['catalog'];try{const _0x529848=[],_0x546ef1=!!_0x9b201[_0x65f190(0xef)];for(let _0x3e132d=0x0;_0x3e132d<_0x5750f9[_0x65f190(0xe8)];_0x3e132d++){const _0x4b1027=_0x5750f9[_0x3e132d],_0x734420=_0x3e132d+0x1,_0x475197=_0x5750f9['length'],_0x28540f=_0x475197>0x1;_0x9b201['verbose']&&(console[_0x65f190(0xdf)]('\x0a'+(_0x28540f?_0x65f190(0xec)+_0x734420+'/'+_0x475197+':':'')),console['error'](_0x65f190(0xeb)+_0x9b201[_0x65f190(0xfa)]),console[_0x65f190(0xdf)](_0x65f190(0xe5)+(_0x22228f||'td')),console[_0x65f190(0xdf)]('Schema:\x20'+_0x233258),console[_0x65f190(0xdf)](_0x65f190(0xed)+_0x4b1027));const _0x1799d6=_0x28540f?_0x65f190(0xd3)+_0x734420+'/'+_0x475197+_0x65f190(0xe1):_0x65f190(0xe4);try{const _0xaf11bc=await withProgressSpinner(_0x1799d6,async _0x3ff71e=>{const _0x4ccd04=_0x65f190,_0x2cb239=await _0x4424ce[_0x4ccd04(0xfd)]['execute'](_0x4b1027,{'catalog':_0x22228f,'schema':_0x233258,'onJobId':_0x5cb04a=>{_0x3ff71e['setJobId'](_0x5cb04a);},'onProgress':_0x3dd166=>{const _0x36f672=_0x4ccd04;_0x3ff71e['setPhase'](_0x36f672(0xfb)+_0x3dd166[_0x36f672(0xd2)]+']'),_0x3ff71e[_0x36f672(0xcb)](formatRows(_0x3dd166[_0x36f672(0xdb)])+'\x20rows\x20'+_0x3dd166[_0x36f672(0xf1)]+'/'+_0x3dd166[_0x36f672(0xe3)]+_0x36f672(0xcd));}});return _0x2cb239;},{'verbose':_0x9b201['verbose']}),_0x106045=_0xaf11bc[_0x65f190(0xf3)],_0x46d09e=_0x106045[_0x65f190(0xea)]?_0x65f190(0xd0)+_0x106045[_0x65f190(0xea)]+']':'',_0xf9de34=_0x28540f?_0x65f190(0xec)+_0x734420+'/'+_0x475197+_0x65f190(0xcc):'';console['error']('✔\x20'+_0xf9de34+_0x65f190(0xe0)+formatRows(_0x106045[_0x65f190(0xd7)][_0x65f190(0xdb)])+_0x65f190(0xf6)+(_0x65f190(0xee)+formatElapsed(_0x106045[_0x65f190(0xd7)][_0x65f190(0xd1)])+_0x46d09e));if(_0x28540f&&_0x546ef1){const _0x54b3a4=resolveOutputOptions(_0x9b201),_0x48b395=await formatQueryOutput(_0x106045,_0x54b3a4);_0x529848['push'](_0x48b395);}else await handleQueryOutput(_0x106045,_0x9b201);}catch(_0x1378b2){const _0x27bb58=_0x28540f?'Statement\x20'+_0x734420+'/'+_0x475197+':\x0a':'',_0x44f30c=_0x1378b2 instanceof SDKError?_0x1378b2[_0x65f190(0xe9)]:_0x1378b2[_0x65f190(0xe2)];return console[_0x65f190(0xdf)](''+_0x27bb58+_0x44f30c),0x1;}}if(_0x5750f9[_0x65f190(0xe8)]>0x1&&_0x546ef1&&_0x529848[_0x65f190(0xe8)]>0x0){const _0x45444d=_0x529848['join']('\x0a');writeFileSync(_0x9b201['output'],_0x45444d),console[_0x65f190(0xdf)](_0x65f190(0xfc)+_0x9b201[_0x65f190(0xef)]);}return 0x0;}catch(_0x46e6e1){throw _0x46e6e1;}}[a25_0x2d5b3e(0xdd)](_0x537ece){const _0x6b2adf=a25_0x2d5b3e,_0x39635a=_0x537ece[_0x6b2adf(0xda)][0x0],_0x2e87e7=_0x537ece[_0x6b2adf(0xd9)][_0x6b2adf(0xf5)];if(!_0x39635a&&!_0x2e87e7)return _0x6b2adf(0xd6);if(_0x39635a&&_0x2e87e7)return _0x6b2adf(0xf7);return undefined;}}function a25_0x4885(){const _0x2b2123=['SQL:\x20','in\x20','output','835364WLlQDb','completedSplits','execute','data','3337015PvEPoz','file','\x20rows\x20','Cannot\x20specify\x20both\x20SQL\x20argument\x20and\x20--file\x20option','information_schema','Error:\x20','site','Executing\x20query\x20[','\x0aAll\x20results\x20saved\x20to\x20','query','setExtra','\x20-\x20','\x20splits','967372fMUmXA','1747412rwmbah','\x20[Job\x20ID:\x20','elapsedTimeMillis','state','Executing\x20statement\x20','database','name','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','stats','327069LpGHhN','options','args','processedRows','No\x20SQL\x20provided','validate','1843446RsxsOL','error','Query\x20completed:\x20Processed\x20','...','message','totalSplits','Executing\x20query...','Catalog:\x20','2092695unumrP','Run\x20Trino\x20queries\x20(streaming)','length','originalMessage','jobId','Site:\x20','Statement\x20'];a25_0x4885=function(){return _0x2b2123;};return a25_0x4885();}
1
+ const a25_0x5e4c83=a25_0x4aa9;function a25_0x4395(){const _0x2e22f=['11228496uTScRu','data','9940nRyXmT','Statement\x20','\x0aAll\x20results\x20saved\x20to\x20','totalSplits','setExtra','\x20splits','options','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','in\x20','18fjKwNA','file','processedRows','error','originalMessage','execute','verbose','elapsedTimeMillis','Cannot\x20specify\x20both\x20SQL\x20argument\x20and\x20--file\x20option','length','Run\x20Trino\x20queries\x20(streaming)','message','...','9228BdhFCu','1119wZEWRg','args','Error:\x20','11NSxfFc','2878885pIHdLe','completedSplits','setJobId','No\x20SQL\x20provided','output','7gVQyYp','8314330XLuKKo','Site:\x20','query','jobId','37QGcZAM','3506418RqCFVc','30011832JAsirc','Catalog:\x20','push','validate','\x20rows\x20','Query\x20completed:\x20Processed\x20','stats'];a25_0x4395=function(){return _0x2e22f;};return a25_0x4395();}(function(_0x38da18,_0x1620db){const _0x209375=a25_0x4aa9,_0x3fbc44=_0x38da18();while(!![]){try{const _0xae073c=-parseInt(_0x209375(0x1c8))/0x1*(-parseInt(_0x209375(0x1b9))/0x2)+-parseInt(_0x209375(0x1ba))/0x3*(parseInt(_0x209375(0x1d3))/0x4)+-parseInt(_0x209375(0x1be))/0x5+-parseInt(_0x209375(0x1c9))/0x6+-parseInt(_0x209375(0x1c3))/0x7*(parseInt(_0x209375(0x1d1))/0x8)+parseInt(_0x209375(0x1ac))/0x9*(parseInt(_0x209375(0x1c4))/0xa)+-parseInt(_0x209375(0x1bd))/0xb*(-parseInt(_0x209375(0x1ca))/0xc);if(_0xae073c===_0x1620db)break;else _0x3fbc44['push'](_0x3fbc44['shift']());}catch(_0x24d63f){_0x3fbc44['push'](_0x3fbc44['shift']());}}}(a25_0x4395,0xce093));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';function a25_0x4aa9(_0x3c7ef6,_0x145ef7){_0x3c7ef6=_0x3c7ef6-0x1a4;const _0x43952a=a25_0x4395();let _0x4aa9b1=_0x43952a[_0x3c7ef6];return _0x4aa9b1;}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']=a25_0x5e4c83(0x1c6);['description']=a25_0x5e4c83(0x1b6);async[a25_0x5e4c83(0x1b1)](_0x374744){const _0x4d1739=a25_0x5e4c83,{options:_0x2150a8,args:_0x40e5cf,tdx:_0x56d08d}=_0x374744,_0x48ff8f=_0x40e5cf[0x0],_0x164258=_0x2150a8[_0x4d1739(0x1ad)];let _0x45808a;try{if(_0x164258)_0x45808a=readSqlStatementsFromFile(_0x164258);else{if(_0x48ff8f==='-')_0x45808a=await readSqlStatementsFromStdin();else{if(_0x48ff8f&&isSqlFilePath(_0x48ff8f))_0x45808a=readSqlStatementsFromFile(_0x48ff8f);else{if(_0x48ff8f)_0x45808a=splitSqlStatements(_0x48ff8f);else throw new Error(_0x4d1739(0x1c1));}}}}catch(_0x459462){return console[_0x4d1739(0x1af)](_0x4d1739(0x1bc)+_0x459462[_0x4d1739(0x1b7)]),0x1;}const _0x1891c4=_0x2150a8['database']||'information_schema',_0x5e9a22=_0x2150a8['catalog'];try{const _0x58732b=[],_0x324aa4=!!_0x2150a8[_0x4d1739(0x1c2)];for(let _0x384e86=0x0;_0x384e86<_0x45808a['length'];_0x384e86++){const _0x36757a=_0x45808a[_0x384e86],_0x370adc=_0x384e86+0x1,_0x56d6f0=_0x45808a[_0x4d1739(0x1b5)],_0xd5fa33=_0x56d6f0>0x1;_0x2150a8[_0x4d1739(0x1b2)]&&(console[_0x4d1739(0x1af)]('\x0a'+(_0xd5fa33?_0x4d1739(0x1a4)+_0x370adc+'/'+_0x56d6f0+':':'')),console['error'](_0x4d1739(0x1c5)+_0x2150a8['site']),console[_0x4d1739(0x1af)](_0x4d1739(0x1cb)+(_0x5e9a22||'td')),console[_0x4d1739(0x1af)]('Schema:\x20'+_0x1891c4),console[_0x4d1739(0x1af)]('SQL:\x20'+_0x36757a));const _0xcd36e9=_0xd5fa33?'Executing\x20statement\x20'+_0x370adc+'/'+_0x56d6f0+_0x4d1739(0x1b8):'Executing\x20query...';try{const _0x32f664=await withProgressSpinner(_0xcd36e9,async _0x222dee=>{const _0x42eef6=_0x4d1739,_0x259e7e=await _0x56d08d[_0x42eef6(0x1c6)]['execute'](_0x36757a,{'catalog':_0x5e9a22,'schema':_0x1891c4,'onJobId':_0x5a08cf=>{const _0x3000a0=_0x42eef6;_0x222dee[_0x3000a0(0x1c0)](_0x5a08cf);},'onProgress':_0x3cbc22=>{const _0x1bf2b1=_0x42eef6;_0x222dee['setPhase']('Executing\x20query\x20['+_0x3cbc22['state']+']'),_0x222dee[_0x1bf2b1(0x1a7)](formatRows(_0x3cbc22[_0x1bf2b1(0x1ae)])+'\x20rows\x20'+_0x3cbc22[_0x1bf2b1(0x1bf)]+'/'+_0x3cbc22[_0x1bf2b1(0x1a6)]+_0x1bf2b1(0x1a8));}});return _0x259e7e;},{'verbose':_0x2150a8[_0x4d1739(0x1b2)]}),_0xa6113a=_0x32f664[_0x4d1739(0x1d2)],_0x3ff535=_0xa6113a[_0x4d1739(0x1c7)]?'\x20[Job\x20ID:\x20'+_0xa6113a[_0x4d1739(0x1c7)]+']':'',_0x89ff2c=_0xd5fa33?_0x4d1739(0x1a4)+_0x370adc+'/'+_0x56d6f0+'\x20-\x20':'';console[_0x4d1739(0x1af)]('✔\x20'+_0x89ff2c+_0x4d1739(0x1cf)+formatRows(_0xa6113a[_0x4d1739(0x1d0)][_0x4d1739(0x1ae)])+_0x4d1739(0x1ce)+(_0x4d1739(0x1ab)+formatElapsed(_0xa6113a[_0x4d1739(0x1d0)][_0x4d1739(0x1b3)])+_0x3ff535));if(_0xd5fa33&&_0x324aa4){const _0x53b4ae=resolveOutputOptions(_0x2150a8),_0x1721b1=await formatQueryOutput(_0xa6113a,_0x53b4ae);_0x58732b[_0x4d1739(0x1cc)](_0x1721b1);}else await handleQueryOutput(_0xa6113a,_0x2150a8);}catch(_0x515dd3){const _0x5189c0=_0xd5fa33?_0x4d1739(0x1a4)+_0x370adc+'/'+_0x56d6f0+':\x0a':'',_0x424520=_0x515dd3 instanceof SDKError?_0x515dd3[_0x4d1739(0x1b0)]:_0x515dd3[_0x4d1739(0x1b7)];return console['error'](''+_0x5189c0+_0x424520),0x1;}}if(_0x45808a['length']>0x1&&_0x324aa4&&_0x58732b['length']>0x0){const _0x21a494=_0x58732b['join']('\x0a');writeFileSync(_0x2150a8[_0x4d1739(0x1c2)],_0x21a494),console['error'](_0x4d1739(0x1a5)+_0x2150a8[_0x4d1739(0x1c2)]);}return 0x0;}catch(_0x51310d){throw _0x51310d;}}[a25_0x5e4c83(0x1cd)](_0x15de2b){const _0x366e98=a25_0x5e4c83,_0x3210af=_0x15de2b[_0x366e98(0x1bb)][0x0],_0x2d88de=_0x15de2b[_0x366e98(0x1a9)][_0x366e98(0x1ad)];if(!_0x3210af&&!_0x2d88de)return _0x366e98(0x1aa);if(_0x3210af&&_0x2d88de)return _0x366e98(0x1b4);return undefined;}}
@@ -1 +1 @@
1
- const a26_0x5f0539=a26_0x2f21;(function(_0x2a1945,_0x549cde){const _0x4c6a26=a26_0x2f21,_0x4b9923=_0x2a1945();while(!![]){try{const _0xe87706=-parseInt(_0x4c6a26(0xbe))/0x1+parseInt(_0x4c6a26(0x139))/0x2+parseInt(_0x4c6a26(0x136))/0x3*(parseInt(_0x4c6a26(0xee))/0x4)+parseInt(_0x4c6a26(0xf6))/0x5+parseInt(_0x4c6a26(0xfb))/0x6*(parseInt(_0x4c6a26(0x131))/0x7)+-parseInt(_0x4c6a26(0x109))/0x8*(-parseInt(_0x4c6a26(0xd8))/0x9)+-parseInt(_0x4c6a26(0x128))/0xa;if(_0xe87706===_0x549cde)break;else _0x4b9923['push'](_0x4b9923['shift']());}catch(_0x5739e1){_0x4b9923['push'](_0x4b9923['shift']());}}}(a26_0x1ca3,0x5c268));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,handleSingleObjectOutput,writeOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import{confirm}from'../utils/prompt.js';import{readFileSync}from'fs';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import{getConsoleUrl}from'../sdk/client/endpoints.js';import{hyperlink}from'../sdk/util/formatters.js';import a26_0x25d82c from'chalk';function a26_0x1ca3(){const _0x40e348=['Show\x20schedule\x20execution\x20history','schedule:run','Cancelled','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20delete\x20<name>','retry_limit','last_job','verbose','timezone','toLocaleDateString','length','Schedule\x20updated:\x20','nextRun','632orZNsp','round','\x20execution','ies','max','\x20scheduled\x20quer','from','keys','utf-8','jobs','created_at','start_at','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20show\x20<name>','Creating\x20schedule:\x20','queryUrl','...','description','dim','in\x20','abs','jsonl','Running\x20schedule...','Getting\x20schedule\x20history...','success','lastRun','Create\x20a\x20scheduled\x20query','yes','schedule:update','args','cron','Creating\x20schedule...','12918700kQPsSE','time_zone','Failed\x20to\x20read\x20file:\x20','priority','schedule:list','update','error','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20update\x20<name>\x20[options]','Listing\x20scheduled\x20queries...','1414FjndMC','ended_at','next_run_at','job_id','📅\x20','1182qLQche','end_at','trim','817832lFbroo','schedule:delete','map','delete','delay','soon','\x20\x20Database:\x20','create','Delete\x20a\x20scheduled\x20query','\x20\x20Job\x20ID:\x20','data','\x20\x20Time:\x20','\x20job','INVALID_ARGUMENT','At\x20least\x20one\x20option\x20must\x20be\x20provided\x20to\x20update','file','validate','Deleting\x20schedule...','Getting\x20schedule\x20details...','695775WuMuta','show','Updating\x20schedule...','Running\x20schedule:\x20','queries','padEnd','Found\x20','status','Query\x20file\x20is\x20empty','statusIcon','Schedule\x20deleted:\x20','schedule:create','result','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20run\x20<name>\x20[--time\x20<iso8601>]\x20[--num\x20<1-10>]','listQueries','num','substring','\x20schedules','updated_at','execute','Show\x20schedule\x20details','join','entries','m\x20ago','Schedule\x20run\x20submitted:\x20','/app/queries/editor?queryId=','49905fVgDzd','Searching\x20scheduled\x20queries\x20matching\x20\x22','\x20(use\x20--limit\x20to\x20see\x20more)','engineVersion','name','query','history','type','getTime','Showing\x20first\x20','Update\x20a\x20scheduled\x20query','engine_version','Schedule\x20created:\x20','json','\x20\x20Cron:\x20','schedule:show','database','h\x20ago','log','\x20created','table','\x22...','7004FDzXGb','has_next_page','executing_user_id','never','format','retryLimit','List\x20scheduled\x20queries','list','3673510OmfBzM','schedules','No\x20scheduled\x20queries\x20found','red','tsv','2778PURBWV','limit'];a26_0x1ca3=function(){return _0x40e348;};return a26_0x1ca3();}function formatRelativeTime(_0x1bcb86){const _0x2cdfc8=a26_0x2f21,_0x681e5a=new Date(_0x1bcb86),_0x4c18e9=new Date(),_0x1b802f=_0x681e5a['getTime']()-_0x4c18e9[_0x2cdfc8(0xe0)](),_0x5e2841=Math[_0x2cdfc8(0x11c)](_0x1b802f)/0x3e8,_0xd219f5=_0x1b802f<0x0;if(_0x5e2841<0x3c)return _0xd219f5?'just\x20now':_0x2cdfc8(0x13e);else{if(_0x5e2841<0xe10){const _0x588e2c=Math[_0x2cdfc8(0x10a)](_0x5e2841/0x3c);return _0xd219f5?_0x588e2c+_0x2cdfc8(0xd5):'in\x20'+_0x588e2c+'m';}else{if(_0x5e2841<0x15180){const _0x979333=Math[_0x2cdfc8(0x10a)](_0x5e2841/0xe10);return _0xd219f5?_0x979333+_0x2cdfc8(0xe9):'in\x20'+_0x979333+'h';}else{if(_0x5e2841<0x93a80){const _0x8568ba=Math['round'](_0x5e2841/0x15180);return _0xd219f5?_0x8568ba+'d\x20ago':_0x2cdfc8(0x11b)+_0x8568ba+'d';}else return _0x681e5a[_0x2cdfc8(0x105)]();}}}}function a26_0x2f21(_0xcf76d6,_0x24974d){_0xcf76d6=_0xcf76d6-0xb3;const _0x1ca35b=a26_0x1ca3();let _0x2f21c8=_0x1ca35b[_0xcf76d6];return _0x2f21c8;}export class ScheduleListCommand extends BaseCommand{[a26_0x5f0539(0xdc)]=a26_0x5f0539(0x12c);['description']=a26_0x5f0539(0xf4);async[a26_0x5f0539(0xd1)](_0x51c536){const _0x38087a=a26_0x5f0539,{options:_0x31c62a,args:_0xaa3f99,tdx:_0x24119e}=_0x51c536,_0x5deb39=resolveLimit(_0x31c62a[_0x38087a(0xfc)],DEFAULT_DISPLAY_LIMIT),_0x1e6e00=_0xaa3f99[0x0],_0x50599b=_0x1e6e00?_0x38087a(0xd9)+_0x1e6e00+_0x38087a(0xed):_0x38087a(0x130),_0x3001a2=await withSpinner(_0x50599b,()=>_0x24119e[_0x38087a(0xf7)][_0x38087a(0xcc)]({'limit':_0x5deb39,'scheduled':!![],'pattern':_0x1e6e00}),{'verbose':_0x31c62a[_0x38087a(0x103)]}),_0x1b130d=_0x3001a2['data'][_0x38087a(0xc2)],_0x1019ac=_0x3001a2[_0x38087a(0xb5)]['pagination'][_0x38087a(0xef)],_0xb344ca=_0x1e6e00?'\x20matching\x20\x22'+_0x1e6e00+'\x22':'';_0x1019ac?console[_0x38087a(0x12e)](_0x38087a(0xe1)+_0x1b130d[_0x38087a(0x106)]+_0x38087a(0xcf)+_0xb344ca+_0x38087a(0xda)):console['error'](_0x38087a(0xc4)+_0x1b130d[_0x38087a(0x106)]+_0x38087a(0x10e)+(_0x1b130d[_0x38087a(0x106)]!==0x1?_0x38087a(0x10c):'y')+_0xb344ca);if(_0x31c62a[_0x38087a(0xf2)]===_0x38087a(0xe5)||_0x31c62a[_0x38087a(0xf2)]===_0x38087a(0x11d)||_0x31c62a[_0x38087a(0xf2)]===_0x38087a(0xec)||_0x31c62a[_0x38087a(0xf2)]===_0x38087a(0xfa)){const _0x3d5214=_0x1b130d['map'](_0xba4013=>({'id':_0xba4013['id'],'name':_0xba4013[_0x38087a(0xdc)],'cron':_0xba4013['cron'],'database':_0xba4013[_0x38087a(0xe8)]?.[_0x38087a(0xdc)],'type':_0xba4013[_0x38087a(0xdf)],'timezone':_0xba4013[_0x38087a(0x129)],'user_name':_0xba4013['user']?.['name'],'updated_at':_0xba4013[_0x38087a(0xd0)],'next_run_at':_0xba4013[_0x38087a(0x133)],'last_job_status':_0xba4013[_0x38087a(0x102)]?.[_0x38087a(0xc5)]}));await handleSDKOutput(_0x3d5214,_0x31c62a);}else{if(_0x1b130d[_0x38087a(0x106)]===0x0)console[_0x38087a(0xea)](_0x38087a(0xf8));else{const _0x373166=_0x31c62a['site'],_0xa0938c=_0x1b130d[_0x38087a(0x13b)](_0x36aa76=>{const _0x321f2c=_0x38087a,_0x3ead8c=_0x36aa76[_0x321f2c(0x102)]?.[_0x321f2c(0xc5)]?_0x36aa76[_0x321f2c(0x102)][_0x321f2c(0xc5)]===_0x321f2c(0x120)?'✓':'✗':'-',_0x7e1fbb=_0x36aa76[_0x321f2c(0x102)]?.[_0x321f2c(0x132)]?formatRelativeTime(_0x36aa76['last_job'][_0x321f2c(0x132)]):_0x321f2c(0xf1),_0x18bd55=_0x36aa76[_0x321f2c(0x133)]?formatRelativeTime(_0x36aa76['next_run_at']):'-',_0x2b3e49=_0x36aa76[_0x321f2c(0x126)]||'',_0x4293a4=_0x36aa76[_0x321f2c(0xdc)]||'(unnamed)',_0x5a1f54=getConsoleUrl(_0x373166,_0x321f2c(0xd7)+_0x36aa76['id']);return{'statusIcon':_0x3ead8c,'lastRun':_0x7e1fbb,'nextRun':_0x18bd55,'cron':_0x2b3e49,'name':_0x4293a4,'queryUrl':_0x5a1f54,'status':_0x36aa76[_0x321f2c(0x102)]?.[_0x321f2c(0xc5)]};}),_0xfe731c=Math['max'](..._0xa0938c[_0x38087a(0x13b)](_0x54f55d=>_0x54f55d[_0x38087a(0x121)]['length'])),_0x340bd0=Math['max'](..._0xa0938c[_0x38087a(0x13b)](_0x3b2c48=>_0x3b2c48[_0x38087a(0x108)][_0x38087a(0x106)])),_0x5b368f=Math[_0x38087a(0x10d)](..._0xa0938c[_0x38087a(0x13b)](_0x36091b=>_0x36091b[_0x38087a(0x126)][_0x38087a(0x106)])),_0x3f7650=_0xa0938c[_0x38087a(0x13b)](_0x5f1f57=>{const _0xb9f8c7=_0x38087a,_0x14a2c=_0x5f1f57[_0xb9f8c7(0xc5)]===_0xb9f8c7(0x120)?a26_0x25d82c['green'](_0x5f1f57[_0xb9f8c7(0xc7)]):_0x5f1f57['status']==='error'?a26_0x25d82c[_0xb9f8c7(0xf9)](_0x5f1f57['statusIcon']):a26_0x25d82c[_0xb9f8c7(0x11a)](_0x5f1f57[_0xb9f8c7(0xc7)]),_0x436cb5=_0x5f1f57[_0xb9f8c7(0x121)][_0xb9f8c7(0xc3)](_0xfe731c),_0x21a296=_0x5f1f57['nextRun'][_0xb9f8c7(0xc3)](_0x340bd0),_0x5ee337=_0x5f1f57['cron']?a26_0x25d82c['cyan'](_0x5f1f57[_0xb9f8c7(0x126)]['padEnd'](_0x5b368f)):'\x20'['repeat'](_0x5b368f),_0x25fd3d=hyperlink(_0x5f1f57[_0xb9f8c7(0xdc)],_0x5f1f57[_0xb9f8c7(0x117)]);return _0xb9f8c7(0x135)+_0x14a2c+'\x20'+_0x436cb5+'\x20\x20→\x20'+_0x21a296+'\x20\x20'+_0x5ee337+'\x20\x20'+_0x25fd3d;});await writeOutput(_0x3f7650[_0x38087a(0xd3)]('\x0a'),_0x31c62a['output'],_0x38087a(0xf5));}}return 0x0;}}export class ScheduleShowCommand extends BaseCommand{[a26_0x5f0539(0xdc)]=a26_0x5f0539(0xe7);[a26_0x5f0539(0x119)]=a26_0x5f0539(0xd2);[a26_0x5f0539(0xbb)](_0x492451){const _0x203845=a26_0x5f0539,_0x1a20b6=_0x492451[_0x203845(0x125)][0x0];if(!_0x1a20b6)return _0x203845(0x115);return undefined;}async[a26_0x5f0539(0xd1)](_0x1e6821){const _0x23c231=a26_0x5f0539,{options:_0x545300,args:_0x5794e7,tdx:_0x337126}=_0x1e6821,_0xef2be4=_0x5794e7[0x0],_0x5baf90=await withSpinner(_0x23c231(0xbd),()=>_0x337126['schedules'][_0x23c231(0xbf)](_0xef2be4),{'verbose':_0x545300[_0x23c231(0x103)]}),_0x3919bd=_0x5baf90['data'],_0x44860a={'name':_0x3919bd['name'],'cron':_0x3919bd['cron'],'database':_0x3919bd[_0x23c231(0xe8)],'type':_0x3919bd[_0x23c231(0xdf)],'timezone':_0x3919bd[_0x23c231(0x104)],'user_name':_0x3919bd['user_name'],'created_at':_0x3919bd[_0x23c231(0x113)],'engine_version':_0x3919bd[_0x23c231(0xe3)],'executing_user_id':_0x3919bd[_0x23c231(0xf0)],'query':_0x3919bd[_0x23c231(0xdd)],'delay':_0x3919bd[_0x23c231(0x13d)],'priority':_0x3919bd['priority'],'retry_limit':_0x3919bd['retry_limit'],..._0x3919bd[_0x23c231(0xca)]&&{'result':_0x3919bd[_0x23c231(0xca)]}};return await handleSingleObjectOutput(_0x44860a,_0x545300),0x0;}}export class ScheduleCreateCommand extends BaseCommand{[a26_0x5f0539(0xdc)]=a26_0x5f0539(0xc9);['description']=a26_0x5f0539(0x122);[a26_0x5f0539(0xbb)](_0x102b52){const _0x519edf=a26_0x5f0539,_0x144f9f=_0x102b52[_0x519edf(0x125)][0x0];if(!_0x144f9f)return'Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]';return undefined;}async[a26_0x5f0539(0xd1)](_0x5b3341){const _0x46ba7d=a26_0x5f0539,{options:_0x5e6de1,args:_0x46a89c,tdx:_0x41cf1f}=_0x5b3341,_0x14b3c3=_0x46a89c[0x0],_0x3b5657=_0x5e6de1,_0x2f5e68=_0x3b5657['database'],_0x4ccff9=_0x3b5657[_0x46ba7d(0xba)],_0x4c15b2=_0x3b5657['type']||'trino';let _0x47fcc3;try{_0x47fcc3=readFileSync(_0x4ccff9,_0x46ba7d(0x111))[_0x46ba7d(0x138)]();}catch(_0xe43234){throw new SDKError(ErrorCode[_0x46ba7d(0xb8)],_0x46ba7d(0x12a)+_0x4ccff9,_0xe43234 instanceof Error?_0xe43234:undefined);}if(!_0x47fcc3)throw new SDKError(ErrorCode[_0x46ba7d(0xb8)],_0x46ba7d(0xc6));const _0x3fd27b={'database':_0x2f5e68,'query':_0x47fcc3,'type':_0x4c15b2};if(_0x3b5657['cron'])_0x3fd27b[_0x46ba7d(0x126)]=_0x3b5657[_0x46ba7d(0x126)];if(_0x3b5657[_0x46ba7d(0x104)])_0x3fd27b[_0x46ba7d(0x104)]=_0x3b5657['timezone'];if(_0x3b5657[_0x46ba7d(0x13d)]!==undefined)_0x3fd27b[_0x46ba7d(0x13d)]=Number(_0x3b5657[_0x46ba7d(0x13d)]);if(_0x3b5657[_0x46ba7d(0x12b)]!==undefined)_0x3fd27b['priority']=Number(_0x3b5657[_0x46ba7d(0x12b)]);if(_0x3b5657['retryLimit']!==undefined)_0x3fd27b['retry_limit']=Number(_0x3b5657[_0x46ba7d(0xf3)]);if(_0x3b5657[_0x46ba7d(0xdb)])_0x3fd27b[_0x46ba7d(0xe3)]=_0x3b5657[_0x46ba7d(0xdb)];if(_0x3b5657[_0x46ba7d(0xca)])_0x3fd27b[_0x46ba7d(0xca)]=_0x3b5657[_0x46ba7d(0xca)];if(_0x5e6de1[_0x46ba7d(0x103)]){console['error'](_0x46ba7d(0x116)+_0x14b3c3),console[_0x46ba7d(0x12e)](_0x46ba7d(0x13f)+_0x2f5e68),console[_0x46ba7d(0x12e)]('\x20\x20Type:\x20'+_0x4c15b2);if(_0x3fd27b[_0x46ba7d(0x126)])console['error'](_0x46ba7d(0xe6)+_0x3fd27b['cron']);if(_0x3fd27b['timezone'])console[_0x46ba7d(0x12e)]('\x20\x20Timezone:\x20'+_0x3fd27b[_0x46ba7d(0x104)]);}const _0x11ae85=await withSpinner(_0x46ba7d(0x127),()=>_0x41cf1f[_0x46ba7d(0xf7)][_0x46ba7d(0x140)](_0x14b3c3,_0x3fd27b),{'verbose':_0x5e6de1[_0x46ba7d(0x103)]});return console['error'](_0x46ba7d(0xe4)+_0x11ae85[_0x46ba7d(0xb5)]['name']),await handleSingleObjectOutput(_0x11ae85[_0x46ba7d(0xb5)],_0x5e6de1),0x0;}}export class ScheduleUpdateCommand extends BaseCommand{[a26_0x5f0539(0xdc)]=a26_0x5f0539(0x124);[a26_0x5f0539(0x119)]=a26_0x5f0539(0xe2);[a26_0x5f0539(0xbb)](_0x4fc67e){const _0x1be9ca=a26_0x5f0539,_0x1755fa=_0x4fc67e['args'][0x0];if(!_0x1755fa)return _0x1be9ca(0x12f);return undefined;}async[a26_0x5f0539(0xd1)](_0xc59bd8){const _0x1fe81a=a26_0x5f0539,{options:_0x50c196,args:_0x214796,tdx:_0x1cfca3}=_0xc59bd8,_0x53fbef=_0x214796[0x0],_0x18d2b0=_0x50c196,_0x4864ab={};if(_0x18d2b0[_0x1fe81a(0xe8)])_0x4864ab[_0x1fe81a(0xe8)]=_0x18d2b0[_0x1fe81a(0xe8)];if(_0x18d2b0[_0x1fe81a(0xdf)])_0x4864ab['type']=_0x18d2b0[_0x1fe81a(0xdf)];if(_0x18d2b0[_0x1fe81a(0x126)])_0x4864ab[_0x1fe81a(0x126)]=_0x18d2b0[_0x1fe81a(0x126)];if(_0x18d2b0[_0x1fe81a(0x104)])_0x4864ab[_0x1fe81a(0x104)]=_0x18d2b0['timezone'];if(_0x18d2b0[_0x1fe81a(0x13d)]!==undefined)_0x4864ab[_0x1fe81a(0x13d)]=Number(_0x18d2b0[_0x1fe81a(0x13d)]);if(_0x18d2b0['priority']!==undefined)_0x4864ab[_0x1fe81a(0x12b)]=Number(_0x18d2b0[_0x1fe81a(0x12b)]);if(_0x18d2b0['retryLimit']!==undefined)_0x4864ab[_0x1fe81a(0x101)]=Number(_0x18d2b0[_0x1fe81a(0xf3)]);if(_0x18d2b0['engineVersion'])_0x4864ab['engine_version']=_0x18d2b0[_0x1fe81a(0xdb)];if(_0x18d2b0[_0x1fe81a(0xca)])_0x4864ab[_0x1fe81a(0xca)]=_0x18d2b0[_0x1fe81a(0xca)];if(_0x18d2b0[_0x1fe81a(0xba)])try{_0x4864ab['query']=readFileSync(_0x18d2b0[_0x1fe81a(0xba)],'utf-8')[_0x1fe81a(0x138)]();}catch(_0x13dfbf){throw new SDKError(ErrorCode[_0x1fe81a(0xb8)],_0x1fe81a(0x12a)+_0x18d2b0[_0x1fe81a(0xba)],_0x13dfbf instanceof Error?_0x13dfbf:undefined);}if(Object[_0x1fe81a(0x110)](_0x4864ab)[_0x1fe81a(0x106)]===0x0)throw new SDKError(ErrorCode[_0x1fe81a(0xb8)],_0x1fe81a(0xb9));if(_0x50c196[_0x1fe81a(0x103)]){console[_0x1fe81a(0x12e)]('Updating\x20schedule:\x20'+_0x53fbef);for(const [_0x1fe59b,_0xcf57f3]of Object[_0x1fe81a(0xd4)](_0x4864ab)){_0x1fe59b==='query'?console[_0x1fe81a(0x12e)]('\x20\x20'+_0x1fe59b+':\x20'+_0xcf57f3[_0x1fe81a(0xce)](0x0,0x32)+_0x1fe81a(0x118)):console[_0x1fe81a(0x12e)]('\x20\x20'+_0x1fe59b+':\x20'+_0xcf57f3);}}const _0x57be5e=await withSpinner(_0x1fe81a(0xc0),()=>_0x1cfca3['schedules'][_0x1fe81a(0x12d)](_0x53fbef,_0x4864ab),{'verbose':_0x50c196[_0x1fe81a(0x103)]});return console['error'](_0x1fe81a(0x107)+_0x57be5e['data'][_0x1fe81a(0xdc)]),await handleSingleObjectOutput(_0x57be5e['data'],_0x50c196),0x0;}}export class ScheduleDeleteCommand extends BaseCommand{[a26_0x5f0539(0xdc)]=a26_0x5f0539(0x13a);[a26_0x5f0539(0x119)]=a26_0x5f0539(0xb3);[a26_0x5f0539(0xbb)](_0x35e6a1){const _0x4a80cb=a26_0x5f0539,_0x4328b9=_0x35e6a1[_0x4a80cb(0x125)][0x0];if(!_0x4328b9)return _0x4a80cb(0x100);return undefined;}async['execute'](_0x2e000e){const _0x1d6d42=a26_0x5f0539,{options:_0x10bb00,args:_0x1275aa,tdx:_0x34af87}=_0x2e000e,_0x5aa45e=_0x1275aa[0x0];if(!_0x10bb00[_0x1d6d42(0x123)]){const _0x12ecde=await confirm('Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20schedule\x20\x22'+_0x5aa45e+'\x22?');if(!_0x12ecde)return console['error'](_0x1d6d42(0xff)),0x0;}const _0x2e5573=await withSpinner(_0x1d6d42(0xbc),()=>_0x34af87['schedules'][_0x1d6d42(0x13c)](_0x5aa45e),{'verbose':_0x10bb00['verbose']});return console['error'](_0x1d6d42(0xc8)+_0x2e5573[_0x1d6d42(0xb5)][_0x1d6d42(0xdc)]),0x0;}}export class ScheduleRunCommand extends BaseCommand{['name']=a26_0x5f0539(0xfe);[a26_0x5f0539(0x119)]='Run\x20a\x20scheduled\x20query\x20immediately';[a26_0x5f0539(0xbb)](_0x43ff8b){const _0x3f4bab=a26_0x5f0539,_0x1a8c1f=_0x43ff8b[_0x3f4bab(0x125)][0x0];if(!_0x1a8c1f)return _0x3f4bab(0xcb);return undefined;}async[a26_0x5f0539(0xd1)](_0x3e5bce){const _0x56693f=a26_0x5f0539,{options:_0x5c24a3,args:_0x18b3d3,tdx:_0x5bdd3c}=_0x3e5bce,_0x5a6c90=_0x18b3d3[0x0],_0x4b5e58=_0x5c24a3,_0x271a9d=_0x4b5e58['time'],_0x30a6f9=_0x4b5e58[_0x56693f(0xcd)]!==undefined?Number(_0x4b5e58['num']):undefined;if(_0x5c24a3[_0x56693f(0x103)]){console[_0x56693f(0x12e)](_0x56693f(0xc1)+_0x5a6c90);if(_0x271a9d)console['error'](_0x56693f(0xb6)+_0x271a9d);if(_0x30a6f9)console[_0x56693f(0x12e)]('\x20\x20Num:\x20'+_0x30a6f9);}const _0x427874=await withSpinner(_0x56693f(0x11e),()=>_0x5bdd3c['schedules']['run'](_0x5a6c90,{'time':_0x271a9d,'num':_0x30a6f9}),{'verbose':_0x5c24a3[_0x56693f(0x103)]}),_0xa7fb20=_0x427874['data'][_0x56693f(0x112)];console[_0x56693f(0x12e)](_0x56693f(0xd6)+_0xa7fb20[_0x56693f(0x106)]+_0x56693f(0xb7)+(_0xa7fb20[_0x56693f(0x106)]!==0x1?'s':'')+_0x56693f(0xeb));for(const _0x26e713 of _0xa7fb20){console['error'](_0x56693f(0xb4)+_0x26e713[_0x56693f(0x134)]);}return await handleSDKOutput(_0xa7fb20,_0x5c24a3),0x0;}}export class ScheduleHistoryCommand extends BaseCommand{[a26_0x5f0539(0xdc)]='schedule:history';[a26_0x5f0539(0x119)]=a26_0x5f0539(0xfd);[a26_0x5f0539(0xbb)](_0x5d4572){const _0x2b65da=_0x5d4572['args'][0x0];if(!_0x2b65da)return'Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20history\x20<name>\x20[--from\x20<n>]\x20[--to\x20<n>]';return undefined;}async[a26_0x5f0539(0xd1)](_0x37062c){const _0x5c54a2=a26_0x5f0539,{options:_0x4d8da2,args:_0x51882f,tdx:_0xfa2542}=_0x37062c,_0x497e7f=_0x51882f[0x0],_0x3262b3=_0x4d8da2,_0x212626=_0x3262b3[_0x5c54a2(0x10f)]!==undefined?Number(_0x3262b3[_0x5c54a2(0x10f)]):undefined,_0x124d02=_0x3262b3['to']!==undefined?Number(_0x3262b3['to']):undefined,_0x5b452b=await withSpinner(_0x5c54a2(0x11f),()=>_0xfa2542['schedules'][_0x5c54a2(0xde)](_0x497e7f,{'from':_0x212626,'to':_0x124d02}),{'verbose':_0x4d8da2[_0x5c54a2(0x103)]}),_0x430c0a=_0x5b452b['data'];console[_0x5c54a2(0x12e)](_0x5c54a2(0xc4)+_0x430c0a['count']+_0x5c54a2(0x10b)+(_0x430c0a['count']!==0x1?'s':'')+'\x20(showing\x20'+_0x430c0a[_0x5c54a2(0x10f)]+'-'+_0x430c0a['to']+')');const _0x1dea22=_0x430c0a[_0x5c54a2(0xde)]['map'](_0x29e6bf=>({'job_id':_0x29e6bf[_0x5c54a2(0x134)],'type':_0x29e6bf[_0x5c54a2(0xdf)],'status':_0x29e6bf[_0x5c54a2(0xc5)],'scheduled_at':_0x29e6bf['scheduled_at'],'created_at':_0x29e6bf[_0x5c54a2(0x113)],'start_at':_0x29e6bf[_0x5c54a2(0x114)],'end_at':_0x29e6bf[_0x5c54a2(0x137)]}));return await handleSDKOutput(_0x1dea22,_0x4d8da2),0x0;}}
1
+ function a26_0x47f9(_0x4787a0,_0x4c59cf){_0x4787a0=_0x4787a0-0x181;const _0x5e7a86=a26_0x5e7a();let _0x47f9ae=_0x5e7a86[_0x4787a0];return _0x47f9ae;}const a26_0x4871d6=a26_0x47f9;(function(_0x390702,_0x5ec2f9){const _0x35a7f9=a26_0x47f9,_0x397a87=_0x390702();while(!![]){try{const _0x50c275=parseInt(_0x35a7f9(0x199))/0x1*(parseInt(_0x35a7f9(0x193))/0x2)+-parseInt(_0x35a7f9(0x1e9))/0x3*(-parseInt(_0x35a7f9(0x1ab))/0x4)+parseInt(_0x35a7f9(0x1d0))/0x5+parseInt(_0x35a7f9(0x1ea))/0x6+parseInt(_0x35a7f9(0x1eb))/0x7+-parseInt(_0x35a7f9(0x1e3))/0x8*(parseInt(_0x35a7f9(0x1e1))/0x9)+-parseInt(_0x35a7f9(0x1d4))/0xa*(parseInt(_0x35a7f9(0x1d3))/0xb);if(_0x50c275===_0x5ec2f9)break;else _0x397a87['push'](_0x397a87['shift']());}catch(_0x17789a){_0x397a87['push'](_0x397a87['shift']());}}}(a26_0x5e7a,0x63920));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,handleSingleObjectOutput,writeOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import{confirm}from'../utils/prompt.js';import{readFileSync}from'fs';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import{getConsoleUrl}from'../sdk/client/endpoints.js';import{hyperlink}from'../sdk/util/formatters.js';function a26_0x5e7a(){const _0x30d49b=['Run\x20a\x20scheduled\x20query\x20immediately','schedule:create','\x20\x20Type:\x20','...','start_at','1916620SJSJEp','Searching\x20scheduled\x20queries\x20matching\x20\x22','format','183271zmJuUw','1190gvbPjz','cron','execute','Query\x20file\x20is\x20empty','No\x20scheduled\x20queries\x20found','log','from','red','json','Update\x20a\x20scheduled\x20query','jobs','entries','delay','6443406cbgeGE','getTime','8eRNflU','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20run\x20<name>\x20[--time\x20<iso8601>]\x20[--num\x20<1-10>]','list','schedule:run','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20update\x20<name>\x20[options]','history','21YHJamY','3870336GoWZmT','5239479beqRlX','toLocaleDateString','padEnd','d\x20ago','database','time','Running\x20schedule...','timezone','query','h\x20ago','\x20\x20Timezone:\x20','Cancelled','jsonl','join','\x20\x20Cron:\x20','success','substring','/app/queries/editor?queryId=','args','validate','last_job','map','Delete\x20a\x20scheduled\x20query','trino','user_name','table','schedules','INVALID_ARGUMENT','Failed\x20to\x20read\x20file:\x20','pagination','ies','lastRun','has_next_page','queries','run','\x20(showing\x20','file','verbose','Deleting\x20schedule...','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20schedule\x20\x22','type','Schedule\x20updated:\x20','updated_at','retry_limit','repeat','priority','error','\x22...','cyan','time_zone','98078nICbys','\x20execution','site','\x20(use\x20--limit\x20to\x20see\x20more)','output','\x20\x20→\x20','15DadsuN','nextRun','next_run_at','in\x20','update','job_id','retryLimit','num','Getting\x20schedule\x20history...','📅\x20','length','List\x20scheduled\x20queries','result','end_at','schedule:list','utf-8','trim','count','339412UHfvJN','engineVersion','round','just\x20now','Found\x20','\x20\x20Num:\x20','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20history\x20<name>\x20[--from\x20<n>]\x20[--to\x20<n>]','executing_user_id','statusIcon','user','\x20job','Getting\x20schedule\x20details...','engine_version','\x20\x20Database:\x20','Schedule\x20created:\x20','schedule:delete','Show\x20schedule\x20details','Updating\x20schedule:\x20','\x20created','name','data','status','limit','ended_at','Creating\x20schedule:\x20','\x20\x20Job\x20ID:\x20','delete','schedule:update','Creating\x20schedule...','show','description','schedule:history'];a26_0x5e7a=function(){return _0x30d49b;};return a26_0x5e7a();}import a26_0x465e5f from'chalk';function formatRelativeTime(_0x58c752){const _0x2c24f7=a26_0x47f9,_0x19a73b=new Date(_0x58c752),_0x46c347=new Date(),_0x5651a9=_0x19a73b[_0x2c24f7(0x1e2)]()-_0x46c347['getTime'](),_0x337168=Math['abs'](_0x5651a9)/0x3e8,_0x869e9c=_0x5651a9<0x0;if(_0x337168<0x3c)return _0x869e9c?_0x2c24f7(0x1ae):'soon';else{if(_0x337168<0xe10){const _0x4f1b2d=Math['round'](_0x337168/0x3c);return _0x869e9c?_0x4f1b2d+'m\x20ago':_0x2c24f7(0x19c)+_0x4f1b2d+'m';}else{if(_0x337168<0x15180){const _0x7e7a15=Math['round'](_0x337168/0xe10);return _0x869e9c?_0x7e7a15+_0x2c24f7(0x1f4):_0x2c24f7(0x19c)+_0x7e7a15+'h';}else{if(_0x337168<0x93a80){const _0x953d3c=Math[_0x2c24f7(0x1ad)](_0x337168/0x15180);return _0x869e9c?_0x953d3c+_0x2c24f7(0x1ee):_0x2c24f7(0x19c)+_0x953d3c+'d';}else return _0x19a73b[_0x2c24f7(0x1ec)]();}}}}export class ScheduleListCommand extends BaseCommand{[a26_0x4871d6(0x1be)]=a26_0x4871d6(0x1a7);['description']=a26_0x4871d6(0x1a4);async['execute'](_0x3fd759){const _0xd79a4f=a26_0x4871d6,{options:_0x16453f,args:_0x246060,tdx:_0x291441}=_0x3fd759,_0x4c7388=resolveLimit(_0x16453f[_0xd79a4f(0x1c1)],DEFAULT_DISPLAY_LIMIT),_0x2839af=_0x246060[0x0],_0x2c8934=_0x2839af?_0xd79a4f(0x1d1)+_0x2839af+_0xd79a4f(0x190):'Listing\x20scheduled\x20queries...',_0x2c5d87=await withSpinner(_0x2c8934,()=>_0x291441['schedules']['listQueries']({'limit':_0x4c7388,'scheduled':!![],'pattern':_0x2839af}),{'verbose':_0x16453f[_0xd79a4f(0x186)]}),_0x217df1=_0x2c5d87[_0xd79a4f(0x1bf)][_0xd79a4f(0x182)],_0x50e4bf=_0x2c5d87[_0xd79a4f(0x1bf)][_0xd79a4f(0x208)][_0xd79a4f(0x181)],_0x5c4cb7=_0x2839af?'\x20matching\x20\x22'+_0x2839af+'\x22':'';_0x50e4bf?console[_0xd79a4f(0x18f)]('Showing\x20first\x20'+_0x217df1[_0xd79a4f(0x1a3)]+'\x20schedules'+_0x5c4cb7+_0xd79a4f(0x196)):console[_0xd79a4f(0x18f)](_0xd79a4f(0x1af)+_0x217df1['length']+'\x20scheduled\x20quer'+(_0x217df1[_0xd79a4f(0x1a3)]!==0x1?_0xd79a4f(0x209):'y')+_0x5c4cb7);if(_0x16453f[_0xd79a4f(0x1d2)]===_0xd79a4f(0x1dc)||_0x16453f[_0xd79a4f(0x1d2)]===_0xd79a4f(0x1f7)||_0x16453f[_0xd79a4f(0x1d2)]===_0xd79a4f(0x204)||_0x16453f['format']==='tsv'){const _0x2e099f=_0x217df1[_0xd79a4f(0x200)](_0x1bd22c=>({'id':_0x1bd22c['id'],'name':_0x1bd22c[_0xd79a4f(0x1be)],'cron':_0x1bd22c[_0xd79a4f(0x1d5)],'database':_0x1bd22c[_0xd79a4f(0x1ef)]?.[_0xd79a4f(0x1be)],'type':_0x1bd22c[_0xd79a4f(0x189)],'timezone':_0x1bd22c[_0xd79a4f(0x192)],'user_name':_0x1bd22c[_0xd79a4f(0x1b4)]?.[_0xd79a4f(0x1be)],'updated_at':_0x1bd22c[_0xd79a4f(0x18b)],'next_run_at':_0x1bd22c[_0xd79a4f(0x19b)],'last_job_status':_0x1bd22c[_0xd79a4f(0x1ff)]?.[_0xd79a4f(0x1c0)]}));await handleSDKOutput(_0x2e099f,_0x16453f);}else{if(_0x217df1[_0xd79a4f(0x1a3)]===0x0)console[_0xd79a4f(0x1d9)](_0xd79a4f(0x1d8));else{const _0x2428e9=_0x16453f[_0xd79a4f(0x195)],_0x251563=_0x217df1['map'](_0x35dfd4=>{const _0x1c1a81=_0xd79a4f,_0x594f04=_0x35dfd4[_0x1c1a81(0x1ff)]?.['status']?_0x35dfd4[_0x1c1a81(0x1ff)][_0x1c1a81(0x1c0)]===_0x1c1a81(0x1fa)?'✓':'✗':'-',_0x2b972f=_0x35dfd4[_0x1c1a81(0x1ff)]?.[_0x1c1a81(0x1c2)]?formatRelativeTime(_0x35dfd4['last_job']['ended_at']):'never',_0xc638f0=_0x35dfd4[_0x1c1a81(0x19b)]?formatRelativeTime(_0x35dfd4['next_run_at']):'-',_0x51460f=_0x35dfd4['cron']||'',_0x5a60ee=_0x35dfd4['name']||'(unnamed)',_0x46eb92=getConsoleUrl(_0x2428e9,_0x1c1a81(0x1fc)+_0x35dfd4['id']);return{'statusIcon':_0x594f04,'lastRun':_0x2b972f,'nextRun':_0xc638f0,'cron':_0x51460f,'name':_0x5a60ee,'queryUrl':_0x46eb92,'status':_0x35dfd4[_0x1c1a81(0x1ff)]?.[_0x1c1a81(0x1c0)]};}),_0x3e0807=Math['max'](..._0x251563['map'](_0x238d1f=>_0x238d1f[_0xd79a4f(0x20a)]['length'])),_0x468daf=Math['max'](..._0x251563[_0xd79a4f(0x200)](_0x23b18b=>_0x23b18b['nextRun'][_0xd79a4f(0x1a3)])),_0x32a96a=Math['max'](..._0x251563[_0xd79a4f(0x200)](_0x1962d0=>_0x1962d0[_0xd79a4f(0x1d5)]['length'])),_0x1781a8=_0x251563[_0xd79a4f(0x200)](_0x5cc45d=>{const _0x52fe40=_0xd79a4f,_0xb7f26f=_0x5cc45d[_0x52fe40(0x1c0)]==='success'?a26_0x465e5f['green'](_0x5cc45d['statusIcon']):_0x5cc45d[_0x52fe40(0x1c0)]==='error'?a26_0x465e5f[_0x52fe40(0x1db)](_0x5cc45d[_0x52fe40(0x1b3)]):a26_0x465e5f['dim'](_0x5cc45d[_0x52fe40(0x1b3)]),_0x8ee078=_0x5cc45d[_0x52fe40(0x20a)][_0x52fe40(0x1ed)](_0x3e0807),_0x1985a5=_0x5cc45d[_0x52fe40(0x19a)]['padEnd'](_0x468daf),_0xf8592d=_0x5cc45d[_0x52fe40(0x1d5)]?a26_0x465e5f[_0x52fe40(0x191)](_0x5cc45d[_0x52fe40(0x1d5)][_0x52fe40(0x1ed)](_0x32a96a)):'\x20'[_0x52fe40(0x18d)](_0x32a96a),_0x5c8b00=hyperlink(_0x5cc45d[_0x52fe40(0x1be)],_0x5cc45d['queryUrl']);return _0x52fe40(0x1a2)+_0xb7f26f+'\x20'+_0x8ee078+_0x52fe40(0x198)+_0x1985a5+'\x20\x20'+_0xf8592d+'\x20\x20'+_0x5c8b00;});await writeOutput(_0x1781a8[_0xd79a4f(0x1f8)]('\x0a'),_0x16453f[_0xd79a4f(0x197)],_0xd79a4f(0x1e5));}}return 0x0;}}export class ScheduleShowCommand extends BaseCommand{[a26_0x4871d6(0x1be)]='schedule:show';['description']=a26_0x4871d6(0x1bb);[a26_0x4871d6(0x1fe)](_0x13f9d2){const _0x308c80=a26_0x4871d6,_0x3ff157=_0x13f9d2[_0x308c80(0x1fd)][0x0];if(!_0x3ff157)return'Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20show\x20<name>';return undefined;}async['execute'](_0x114777){const _0x1ff56f=a26_0x4871d6,{options:_0x4036b7,args:_0x481ffe,tdx:_0x20d1dc}=_0x114777,_0x2eac9d=_0x481ffe[0x0],_0x2cb2f7=await withSpinner(_0x1ff56f(0x1b6),()=>_0x20d1dc[_0x1ff56f(0x205)][_0x1ff56f(0x1c8)](_0x2eac9d),{'verbose':_0x4036b7[_0x1ff56f(0x186)]}),_0x21748a=_0x2cb2f7[_0x1ff56f(0x1bf)],_0x50f981={'name':_0x21748a[_0x1ff56f(0x1be)],'cron':_0x21748a[_0x1ff56f(0x1d5)],'database':_0x21748a[_0x1ff56f(0x1ef)],'type':_0x21748a[_0x1ff56f(0x189)],'timezone':_0x21748a[_0x1ff56f(0x1f2)],'user_name':_0x21748a[_0x1ff56f(0x203)],'created_at':_0x21748a['created_at'],'engine_version':_0x21748a['engine_version'],'executing_user_id':_0x21748a[_0x1ff56f(0x1b2)],'query':_0x21748a[_0x1ff56f(0x1f3)],'delay':_0x21748a[_0x1ff56f(0x1e0)],'priority':_0x21748a[_0x1ff56f(0x18e)],'retry_limit':_0x21748a[_0x1ff56f(0x18c)],..._0x21748a[_0x1ff56f(0x1a5)]&&{'result':_0x21748a[_0x1ff56f(0x1a5)]}};return await handleSingleObjectOutput(_0x50f981,_0x4036b7),0x0;}}export class ScheduleCreateCommand extends BaseCommand{['name']=a26_0x4871d6(0x1cc);[a26_0x4871d6(0x1c9)]='Create\x20a\x20scheduled\x20query';[a26_0x4871d6(0x1fe)](_0x27df1b){const _0x59096f=a26_0x4871d6,_0x241f29=_0x27df1b[_0x59096f(0x1fd)][0x0];if(!_0x241f29)return'Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]';return undefined;}async[a26_0x4871d6(0x1d6)](_0x3da66e){const _0x142ce6=a26_0x4871d6,{options:_0x57468b,args:_0x1f6575,tdx:_0x52734e}=_0x3da66e,_0x9af416=_0x1f6575[0x0],_0x357fe1=_0x57468b,_0x19480a=_0x357fe1[_0x142ce6(0x1ef)],_0x553cb7=_0x357fe1[_0x142ce6(0x185)],_0xa846ec=_0x357fe1[_0x142ce6(0x189)]||_0x142ce6(0x202);let _0x3e3953;try{_0x3e3953=readFileSync(_0x553cb7,_0x142ce6(0x1a8))[_0x142ce6(0x1a9)]();}catch(_0x35a3ca){throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x142ce6(0x207)+_0x553cb7,_0x35a3ca instanceof Error?_0x35a3ca:undefined);}if(!_0x3e3953)throw new SDKError(ErrorCode[_0x142ce6(0x206)],_0x142ce6(0x1d7));const _0x19a3c0={'database':_0x19480a,'query':_0x3e3953,'type':_0xa846ec};if(_0x357fe1[_0x142ce6(0x1d5)])_0x19a3c0['cron']=_0x357fe1['cron'];if(_0x357fe1['timezone'])_0x19a3c0['timezone']=_0x357fe1[_0x142ce6(0x1f2)];if(_0x357fe1[_0x142ce6(0x1e0)]!==undefined)_0x19a3c0[_0x142ce6(0x1e0)]=Number(_0x357fe1[_0x142ce6(0x1e0)]);if(_0x357fe1['priority']!==undefined)_0x19a3c0['priority']=Number(_0x357fe1[_0x142ce6(0x18e)]);if(_0x357fe1[_0x142ce6(0x19f)]!==undefined)_0x19a3c0['retry_limit']=Number(_0x357fe1[_0x142ce6(0x19f)]);if(_0x357fe1[_0x142ce6(0x1ac)])_0x19a3c0[_0x142ce6(0x1b7)]=_0x357fe1[_0x142ce6(0x1ac)];if(_0x357fe1[_0x142ce6(0x1a5)])_0x19a3c0[_0x142ce6(0x1a5)]=_0x357fe1[_0x142ce6(0x1a5)];if(_0x57468b[_0x142ce6(0x186)]){console['error'](_0x142ce6(0x1c3)+_0x9af416),console[_0x142ce6(0x18f)](_0x142ce6(0x1b8)+_0x19480a),console[_0x142ce6(0x18f)](_0x142ce6(0x1cd)+_0xa846ec);if(_0x19a3c0[_0x142ce6(0x1d5)])console['error'](_0x142ce6(0x1f9)+_0x19a3c0['cron']);if(_0x19a3c0[_0x142ce6(0x1f2)])console[_0x142ce6(0x18f)](_0x142ce6(0x1f5)+_0x19a3c0['timezone']);}const _0x552ab4=await withSpinner(_0x142ce6(0x1c7),()=>_0x52734e['schedules']['create'](_0x9af416,_0x19a3c0),{'verbose':_0x57468b[_0x142ce6(0x186)]});return console['error'](_0x142ce6(0x1b9)+_0x552ab4['data'][_0x142ce6(0x1be)]),await handleSingleObjectOutput(_0x552ab4['data'],_0x57468b),0x0;}}export class ScheduleUpdateCommand extends BaseCommand{[a26_0x4871d6(0x1be)]=a26_0x4871d6(0x1c6);[a26_0x4871d6(0x1c9)]=a26_0x4871d6(0x1dd);['validate'](_0x1d3703){const _0x3071a8=a26_0x4871d6,_0x36aba2=_0x1d3703[_0x3071a8(0x1fd)][0x0];if(!_0x36aba2)return _0x3071a8(0x1e7);return undefined;}async[a26_0x4871d6(0x1d6)](_0x15dc3f){const _0x90803a=a26_0x4871d6,{options:_0x28e855,args:_0x118560,tdx:_0x4ebdea}=_0x15dc3f,_0x273ac8=_0x118560[0x0],_0x499124=_0x28e855,_0x4c41da={};if(_0x499124[_0x90803a(0x1ef)])_0x4c41da['database']=_0x499124[_0x90803a(0x1ef)];if(_0x499124[_0x90803a(0x189)])_0x4c41da[_0x90803a(0x189)]=_0x499124['type'];if(_0x499124[_0x90803a(0x1d5)])_0x4c41da['cron']=_0x499124[_0x90803a(0x1d5)];if(_0x499124[_0x90803a(0x1f2)])_0x4c41da[_0x90803a(0x1f2)]=_0x499124['timezone'];if(_0x499124['delay']!==undefined)_0x4c41da[_0x90803a(0x1e0)]=Number(_0x499124[_0x90803a(0x1e0)]);if(_0x499124['priority']!==undefined)_0x4c41da[_0x90803a(0x18e)]=Number(_0x499124[_0x90803a(0x18e)]);if(_0x499124['retryLimit']!==undefined)_0x4c41da[_0x90803a(0x18c)]=Number(_0x499124[_0x90803a(0x19f)]);if(_0x499124[_0x90803a(0x1ac)])_0x4c41da[_0x90803a(0x1b7)]=_0x499124['engineVersion'];if(_0x499124[_0x90803a(0x1a5)])_0x4c41da[_0x90803a(0x1a5)]=_0x499124[_0x90803a(0x1a5)];if(_0x499124['file'])try{_0x4c41da[_0x90803a(0x1f3)]=readFileSync(_0x499124[_0x90803a(0x185)],_0x90803a(0x1a8))[_0x90803a(0x1a9)]();}catch(_0x2bff87){throw new SDKError(ErrorCode[_0x90803a(0x206)],_0x90803a(0x207)+_0x499124[_0x90803a(0x185)],_0x2bff87 instanceof Error?_0x2bff87:undefined);}if(Object['keys'](_0x4c41da)[_0x90803a(0x1a3)]===0x0)throw new SDKError(ErrorCode[_0x90803a(0x206)],'At\x20least\x20one\x20option\x20must\x20be\x20provided\x20to\x20update');if(_0x28e855[_0x90803a(0x186)]){console['error'](_0x90803a(0x1bc)+_0x273ac8);for(const [_0x1599fa,_0x4bb8d8]of Object[_0x90803a(0x1df)](_0x4c41da)){_0x1599fa==='query'?console[_0x90803a(0x18f)]('\x20\x20'+_0x1599fa+':\x20'+_0x4bb8d8[_0x90803a(0x1fb)](0x0,0x32)+_0x90803a(0x1ce)):console[_0x90803a(0x18f)]('\x20\x20'+_0x1599fa+':\x20'+_0x4bb8d8);}}const _0x47d548=await withSpinner('Updating\x20schedule...',()=>_0x4ebdea[_0x90803a(0x205)][_0x90803a(0x19d)](_0x273ac8,_0x4c41da),{'verbose':_0x28e855['verbose']});return console['error'](_0x90803a(0x18a)+_0x47d548[_0x90803a(0x1bf)][_0x90803a(0x1be)]),await handleSingleObjectOutput(_0x47d548[_0x90803a(0x1bf)],_0x28e855),0x0;}}export class ScheduleDeleteCommand extends BaseCommand{['name']=a26_0x4871d6(0x1ba);[a26_0x4871d6(0x1c9)]=a26_0x4871d6(0x201);[a26_0x4871d6(0x1fe)](_0x1ea723){const _0x1ff551=a26_0x4871d6,_0x55f0a0=_0x1ea723[_0x1ff551(0x1fd)][0x0];if(!_0x55f0a0)return'Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20delete\x20<name>';return undefined;}async[a26_0x4871d6(0x1d6)](_0x4df79c){const _0x25b358=a26_0x4871d6,{options:_0x3610ab,args:_0x2fd3d4,tdx:_0x234e91}=_0x4df79c,_0x4eb5e4=_0x2fd3d4[0x0];if(!_0x3610ab['yes']){const _0x52568d=await confirm(_0x25b358(0x188)+_0x4eb5e4+'\x22?');if(!_0x52568d)return console[_0x25b358(0x18f)](_0x25b358(0x1f6)),0x0;}const _0x3a9a7a=await withSpinner(_0x25b358(0x187),()=>_0x234e91[_0x25b358(0x205)][_0x25b358(0x1c5)](_0x4eb5e4),{'verbose':_0x3610ab[_0x25b358(0x186)]});return console[_0x25b358(0x18f)]('Schedule\x20deleted:\x20'+_0x3a9a7a[_0x25b358(0x1bf)][_0x25b358(0x1be)]),0x0;}}export class ScheduleRunCommand extends BaseCommand{[a26_0x4871d6(0x1be)]=a26_0x4871d6(0x1e6);['description']=a26_0x4871d6(0x1cb);[a26_0x4871d6(0x1fe)](_0xc9b8ac){const _0x3b4592=a26_0x4871d6,_0x23bc0f=_0xc9b8ac[_0x3b4592(0x1fd)][0x0];if(!_0x23bc0f)return _0x3b4592(0x1e4);return undefined;}async[a26_0x4871d6(0x1d6)](_0x1025df){const _0x212a8d=a26_0x4871d6,{options:_0x50dd05,args:_0x348662,tdx:_0x4a6dee}=_0x1025df,_0x49a536=_0x348662[0x0],_0x5e950c=_0x50dd05,_0x527f80=_0x5e950c[_0x212a8d(0x1f0)],_0x5e594b=_0x5e950c[_0x212a8d(0x1a0)]!==undefined?Number(_0x5e950c[_0x212a8d(0x1a0)]):undefined;if(_0x50dd05[_0x212a8d(0x186)]){console['error']('Running\x20schedule:\x20'+_0x49a536);if(_0x527f80)console[_0x212a8d(0x18f)]('\x20\x20Time:\x20'+_0x527f80);if(_0x5e594b)console[_0x212a8d(0x18f)](_0x212a8d(0x1b0)+_0x5e594b);}const _0x34fb58=await withSpinner(_0x212a8d(0x1f1),()=>_0x4a6dee[_0x212a8d(0x205)][_0x212a8d(0x183)](_0x49a536,{'time':_0x527f80,'num':_0x5e594b}),{'verbose':_0x50dd05[_0x212a8d(0x186)]}),_0x40a854=_0x34fb58[_0x212a8d(0x1bf)][_0x212a8d(0x1de)];console[_0x212a8d(0x18f)]('Schedule\x20run\x20submitted:\x20'+_0x40a854[_0x212a8d(0x1a3)]+_0x212a8d(0x1b5)+(_0x40a854[_0x212a8d(0x1a3)]!==0x1?'s':'')+_0x212a8d(0x1bd));for(const _0x9963e of _0x40a854){console[_0x212a8d(0x18f)](_0x212a8d(0x1c4)+_0x9963e[_0x212a8d(0x19e)]);}return await handleSDKOutput(_0x40a854,_0x50dd05),0x0;}}export class ScheduleHistoryCommand extends BaseCommand{['name']=a26_0x4871d6(0x1ca);[a26_0x4871d6(0x1c9)]='Show\x20schedule\x20execution\x20history';[a26_0x4871d6(0x1fe)](_0x3599b8){const _0xc3ac0f=a26_0x4871d6,_0x13f41d=_0x3599b8[_0xc3ac0f(0x1fd)][0x0];if(!_0x13f41d)return _0xc3ac0f(0x1b1);return undefined;}async[a26_0x4871d6(0x1d6)](_0x359e40){const _0x4125c8=a26_0x4871d6,{options:_0x25093c,args:_0x1ff62e,tdx:_0x29ab7a}=_0x359e40,_0x46782c=_0x1ff62e[0x0],_0x98d5bf=_0x25093c,_0x4b11b4=_0x98d5bf['from']!==undefined?Number(_0x98d5bf[_0x4125c8(0x1da)]):undefined,_0x425de2=_0x98d5bf['to']!==undefined?Number(_0x98d5bf['to']):undefined,_0xb3d228=await withSpinner(_0x4125c8(0x1a1),()=>_0x29ab7a[_0x4125c8(0x205)][_0x4125c8(0x1e8)](_0x46782c,{'from':_0x4b11b4,'to':_0x425de2}),{'verbose':_0x25093c[_0x4125c8(0x186)]}),_0x1bf1ce=_0xb3d228[_0x4125c8(0x1bf)];console[_0x4125c8(0x18f)]('Found\x20'+_0x1bf1ce[_0x4125c8(0x1aa)]+_0x4125c8(0x194)+(_0x1bf1ce[_0x4125c8(0x1aa)]!==0x1?'s':'')+_0x4125c8(0x184)+_0x1bf1ce[_0x4125c8(0x1da)]+'-'+_0x1bf1ce['to']+')');const _0x4884d4=_0x1bf1ce[_0x4125c8(0x1e8)][_0x4125c8(0x200)](_0x41c25c=>({'job_id':_0x41c25c[_0x4125c8(0x19e)],'type':_0x41c25c['type'],'status':_0x41c25c[_0x4125c8(0x1c0)],'scheduled_at':_0x41c25c['scheduled_at'],'created_at':_0x41c25c['created_at'],'start_at':_0x41c25c[_0x4125c8(0x1cf)],'end_at':_0x41c25c[_0x4125c8(0x1a6)]}));return await handleSDKOutput(_0x4884d4,_0x25093c),0x0;}}
@@ -1 +1 @@
1
- const a27_0x3bfcdd=a27_0xfa2f;(function(_0x122438,_0x280b72){const _0xbdd52=a27_0xfa2f,_0x2fc39d=_0x122438();while(!![]){try{const _0x104755=-parseInt(_0xbdd52(0x134))/0x1+-parseInt(_0xbdd52(0x18b))/0x2*(-parseInt(_0xbdd52(0x14a))/0x3)+-parseInt(_0xbdd52(0x147))/0x4*(-parseInt(_0xbdd52(0x13d))/0x5)+parseInt(_0xbdd52(0x132))/0x6+parseInt(_0xbdd52(0x1bc))/0x7*(-parseInt(_0xbdd52(0x1c3))/0x8)+-parseInt(_0xbdd52(0x148))/0x9*(-parseInt(_0xbdd52(0x136))/0xa)+-parseInt(_0xbdd52(0x16b))/0xb*(parseInt(_0xbdd52(0x18e))/0xc);if(_0x104755===_0x280b72)break;else _0x2fc39d['push'](_0x2fc39d['shift']());}catch(_0x220a1c){_0x2fc39d['push'](_0x2fc39d['shift']());}}}(a27_0x3cf1,0xa2cb0));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';function a27_0xfa2f(_0x550aa6,_0x1d4883){_0x550aa6=_0x550aa6-0x12d;const _0x3cf191=a27_0x3cf1();let _0xfa2f24=_0x3cf191[_0x550aa6];return _0xfa2f24;}import{parseSegmentRef}from'../sdk/segment/segment-ref-parser.js';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import{executeSchemaQuery}from'../sdk/segment/fields-display.js';import{isYamlFilePath,resolveYamlFilePath}from'../sdk/segment/segment-path-parser.js';import{getConsoleNextUrl}from'../sdk/client/endpoints.js';import{openBrowser}from'../utils/process.js';import a27_0x44905d from'chalk';async function resolveSegmentTarget(_0x5358e2,_0x5bb884,_0x507422){const _0x16b09f=a27_0xfa2f;if(isYamlFilePath(_0x5358e2))try{const _0x199bbf=await resolveYamlFilePath(_0x5358e2);return _0x507422&&(console['error'](_0x16b09f(0x170)+_0x5358e2),console['error']('\x20\x20Parent\x20segment:\x20'+_0x199bbf[_0x16b09f(0x144)]),console[_0x16b09f(0x186)](_0x16b09f(0x1ae)+_0x199bbf[_0x16b09f(0x1b9)]),console[_0x16b09f(0x186)](_0x16b09f(0x18a)+(_0x199bbf[_0x16b09f(0x19d)]||_0x16b09f(0x17b))),console[_0x16b09f(0x186)](_0x16b09f(0x155)+_0x199bbf[_0x16b09f(0x1a2)])),_0x199bbf[_0x16b09f(0x1a2)];}catch(_0x71fbbf){throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x16b09f(0x171)+_0x71fbbf['message']);}if(!_0x5bb884)throw new SDKError(ErrorCode[_0x16b09f(0x169)],_0x16b09f(0x192));return _0x5bb884+'/'+_0x5358e2;}export class SegmentDescribeCommand extends BaseCommand{[a27_0x3bfcdd(0x13a)]=a27_0x3bfcdd(0x1c6);[a27_0x3bfcdd(0x187)]=a27_0x3bfcdd(0x16f);async[a27_0x3bfcdd(0x17a)](_0x294190){const _0x10b632=a27_0x3bfcdd,{options:_0x3f01a4,args:_0x2ac071,tdx:_0x1640ea}=_0x294190,_0x12a7b8=_0x2ac071[0x0],_0x1c6675=!_0x12a7b8&&!!_0x3f01a4['parentSegment'],_0x178652=_0x12a7b8||_0x3f01a4[_0x10b632(0x144)];if(!_0x178652)return console[_0x10b632(0x186)](_0x10b632(0x14c)),console['error']('Usage:\x20tdx\x20segment\x20describe\x20<path>'),console[_0x10b632(0x186)](_0x10b632(0x157)),console[_0x10b632(0x186)]('\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience\x22'),console[_0x10b632(0x186)](_0x10b632(0x1ad)),console['error'](_0x10b632(0x1b8)),console['error']('\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>'),0x1;try{const _0x4ec405=_0x3f01a4[_0x10b632(0x151)];let _0x311475=_0x178652;!_0x1c6675&&_0x4ec405&&!_0x178652[_0x10b632(0x1a5)]('/')&&(_0x311475=_0x4ec405+'/'+_0x178652,_0x3f01a4[_0x10b632(0x19f)]&&console[_0x10b632(0x186)](_0x10b632(0x1b0)+_0x311475));const _0x114b73=await withSpinner(_0x10b632(0x193)+_0x311475+_0x10b632(0x173),()=>_0x1640ea[_0x10b632(0x19e)][_0x10b632(0x17d)](_0x311475),{'verbose':_0x3f01a4[_0x10b632(0x19f)]}),_0x2fd376=_0x114b73['data'];_0x3f01a4[_0x10b632(0x19f)]&&(console[_0x10b632(0x186)](_0x10b632(0x16a)+_0x2fd376['type']),console[_0x10b632(0x186)]('Parent\x20ID:\x20'+_0x2fd376[_0x10b632(0x1b3)]),_0x2fd376[_0x10b632(0x1a8)]&&console['error'](_0x10b632(0x177)+_0x2fd376[_0x10b632(0x1a8)]),_0x2fd376[_0x10b632(0x17c)]&&console[_0x10b632(0x186)]('Segment\x20ID:\x20'+_0x2fd376[_0x10b632(0x17c)]));if(_0x2fd376['type']==='parent'){const _0x4fffca=await withSpinner(_0x10b632(0x198),()=>_0x1640ea[_0x10b632(0x19e)][_0x10b632(0x139)](_0x2fd376[_0x10b632(0x1b3)]),{'verbose':_0x3f01a4[_0x10b632(0x19f)]});await handleSingleObjectOutput(_0x4fffca['data'],_0x3f01a4);}else{if(_0x2fd376[_0x10b632(0x14e)]===_0x10b632(0x162)){if(!_0x2fd376[_0x10b632(0x1a8)])throw new SDKError(ErrorCode[_0x10b632(0x1bb)],_0x10b632(0x141));const _0x5377d9=await withSpinner(_0x10b632(0x1a1),()=>_0x1640ea[_0x10b632(0x19e)][_0x10b632(0x18d)](_0x2fd376[_0x10b632(0x1a8)]),{'verbose':_0x3f01a4[_0x10b632(0x19f)]});await handleSingleObjectOutput(_0x5377d9[_0x10b632(0x1c1)],_0x3f01a4);}else{if(_0x2fd376['type']===_0x10b632(0x19e)){if(!_0x2fd376[_0x10b632(0x17c)])throw new SDKError(ErrorCode[_0x10b632(0x1be)],_0x10b632(0x1a4));const _0x3b24ba=await withSpinner(_0x10b632(0x180),()=>_0x1640ea['segment'][_0x10b632(0x12e)](_0x2fd376[_0x10b632(0x1b3)],_0x2fd376[_0x10b632(0x17c)]),{'verbose':_0x3f01a4[_0x10b632(0x19f)]});await handleSingleObjectOutput(_0x3b24ba[_0x10b632(0x1c1)],_0x3f01a4);}}}return 0x0;}catch(_0x5718d5){if(_0x5718d5 instanceof SDKError)return console['error'](_0x10b632(0x195)+_0x5718d5[_0x10b632(0x1b5)]),_0x5718d5[_0x10b632(0x179)]&&console[_0x10b632(0x186)](_0x10b632(0x181)+_0x5718d5[_0x10b632(0x179)]),0x1;throw _0x5718d5;}}}export class SegmentShowCommand extends BaseCommand{[a27_0x3bfcdd(0x13a)]='segment:show';[a27_0x3bfcdd(0x187)]=a27_0x3bfcdd(0x17e);async[a27_0x3bfcdd(0x17a)](_0x293efb){const _0x13db1f=a27_0x3bfcdd,{options:_0x11df95,args:_0x40f457,tdx:_0x4aea41}=_0x293efb,_0x48279e=_0x40f457[0x0];if(!_0x48279e)return console[_0x13db1f(0x186)](_0x13db1f(0x131)),console[_0x13db1f(0x186)](_0x13db1f(0x176)),console[_0x13db1f(0x186)](_0x13db1f(0x14b)),console['error'](_0x13db1f(0x157)),console['error'](_0x13db1f(0x1ab)),console[_0x13db1f(0x186)]('\x20\x20tdx\x20sg\x20show\x20segments/my-audience/premium-users.yml'),0x1;try{const _0x83e112=_0x11df95[_0x13db1f(0x144)],_0x643dd=await resolveSegmentTarget(_0x48279e,_0x83e112,_0x11df95['verbose']);_0x11df95[_0x13db1f(0x19f)]&&console[_0x13db1f(0x186)](_0x13db1f(0x199)+_0x643dd);const _0x2c0df3=await withSpinner(_0x13db1f(0x133)+_0x48279e+_0x13db1f(0x173),()=>_0x4aea41[_0x13db1f(0x19e)]['resolvePathToResource'](_0x643dd),{'verbose':_0x11df95[_0x13db1f(0x19f)]}),_0x10967f=_0x2c0df3[_0x13db1f(0x1c1)];_0x11df95['verbose']&&(console[_0x13db1f(0x186)]('Resolved\x20type:\x20'+_0x10967f[_0x13db1f(0x14e)]),console[_0x13db1f(0x186)]('Parent\x20ID:\x20'+_0x10967f[_0x13db1f(0x1b3)]));if(_0x10967f[_0x13db1f(0x14e)]===_0x13db1f(0x162))return console[_0x13db1f(0x186)](_0x13db1f(0x183)),console['error']('Use:\x20tdx\x20sg\x20view\x20<name>\x20\x20#\x20To\x20show\x20folder\x20details'),0x1;if(_0x10967f[_0x13db1f(0x14e)]===_0x13db1f(0x1a6))return console[_0x13db1f(0x186)](_0x13db1f(0x1b2)),console[_0x13db1f(0x186)]('Use:\x20tdx\x20ps\x20show'),0x1;if(!_0x10967f[_0x13db1f(0x17c)])throw new SDKError(ErrorCode[_0x13db1f(0x1be)],_0x13db1f(0x1a4));const _0x1e74d6=await withSpinner('Fetching\x20SQL\x20for\x20segment...',()=>_0x4aea41[_0x13db1f(0x19e)][_0x13db1f(0x14f)](_0x10967f['parentId'],_0x10967f['segmentId']),{'verbose':_0x11df95['verbose']});let _0x4c504d=_0x1e74d6[_0x13db1f(0x1c1)];const _0x183987=resolveLimit(_0x11df95[_0x13db1f(0x196)],DEFAULT_DISPLAY_LIMIT),_0x226b36=/\bLIMIT\s+\d+/i[_0x13db1f(0x165)](_0x4c504d);!_0x226b36&&(_0x4c504d=_0x4c504d[_0x13db1f(0x1c4)]()[_0x13db1f(0x1b6)](/;+$/,''),_0x4c504d=_0x13db1f(0x166)+_0x4c504d+_0x13db1f(0x13f)+_0x183987);_0x11df95['verbose']&&console[_0x13db1f(0x186)](_0x13db1f(0x15a)+_0x4c504d);const _0x2e3028=await withProgressSpinner(_0x13db1f(0x13c),async _0x54bb08=>{const _0x26c37a=_0x13db1f,_0x535e59=await _0x4aea41[_0x26c37a(0x15e)][_0x26c37a(0x17a)](_0x4c504d,{'catalog':'td','schema':_0x26c37a(0x1ac),'onJobId':_0x4c32dd=>{const _0x5532c6=_0x26c37a;_0x54bb08[_0x5532c6(0x1a9)](_0x4c32dd);}});return _0x535e59;},{'verbose':_0x11df95[_0x13db1f(0x19f)]}),_0x558617=_0x2e3028[_0x13db1f(0x1c1)],_0x283bd6=_0x558617['jobId']?_0x13db1f(0x1c5)+_0x558617[_0x13db1f(0x191)]+']':'';return console[_0x13db1f(0x186)]('✔\x20Query\x20completed:\x20Processed\x20'+_0x558617[_0x13db1f(0x138)][_0x13db1f(0x19c)][_0x13db1f(0x16e)]()+'\x20rows\x20'+(_0x13db1f(0x145)+formatElapsed(_0x558617['stats']['elapsedTimeMillis'])+_0x283bd6)),await handleQueryOutput(_0x558617,_0x11df95),0x0;}catch(_0x5731d5){if(_0x5731d5 instanceof SDKError)return console[_0x13db1f(0x186)](_0x13db1f(0x185)+_0x5731d5['code']+']'),console[_0x13db1f(0x186)]('\x0a'+_0x5731d5[_0x13db1f(0x1b5)]),0x1;throw _0x5731d5;}}}function a27_0x3cf1(){const _0x2f3c66=['stats','getParent','name','Get\x20SQL\x20query\x20for\x20child\x20segment','Executing\x20segment\x20query...','76355IGcbHa','Options:','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','\x20Opening\x20','Folder\x20ID\x20missing\x20from\x20resolved\x20path','url','segment:sql','parentSegment','in\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20sql\x20<path/to/segment.yml>','348nboKMG','1933506UVAqDz','Site:\x20','9rFYPMw','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20show\x20<path/to/segment.yml>','Error:\x20Path\x20or\x20name\x20is\x20required','Error:\x20Cannot\x20get\x20SQL\x20for\x20parent\x20segment\x20with\x20this\x20command.','type','getSegmentSQL','Creating\x20folder\x20\x27','segmentPath','Usage:\x20tdx\x20sg\x20desc\x20<name>','Fetching\x20SQL\x20for\x20segment...','resolveFolderId','\x20\x20Full\x20path:\x20','Resolving\x20folder\x20\x27','Examples:','Error:\x20Cannot\x20view\x20parent\x20segment\x20details\x20with\x20this\x20command.','log','SQL\x20query:\x0a','\x20\x20tdx\x20sg\x20sql\x20segments/my-audience/premium-users.yml','Parent\x20segment:\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20view\x20<path/to/segment.yml>','query','site','json','Usage:\x20tdx\x20segment\x20folder\x20create\x20<parent_name>\x20<folder_name>\x20[options]','folder','\x20\x20tdx\x20sg\x20desc\x20\x22Premium\x20Users\x22','Folder\x20name:\x20','test','SELECT\x20*\x20FROM\x20(\x0a','\x20\x20tdx\x20sg\x20view\x20segments/my-audience/premium-users.yml','Resolved\x20parent\x20ID:\x20','INVALID_ARGUMENT','Resolved\x20type:\x20','6377569FwlPKA','Parent\x20name:\x20','cyan','toLocaleString','Show\x20segment\x20or\x20folder\x20details','Resolved\x20YAML\x20file:\x20','Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20','Use:\x20tdx\x20ps\x20desc','\x27...','\x20folder','Use:\x20tdx\x20ps\x20view\x20-w','Usage:\x20tdx\x20sg\x20show\x20<name>','Folder\x20ID:\x20','Error:\x20Cannot\x20get\x20SQL\x20query\x20for\x20a\x20folder.','cause','execute','(root)','segmentId','resolvePathToResource','Execute\x20child\x20segment\x20SQL\x20query\x20and\x20show\x20results','Parent\x20ID:\x20','Fetching\x20segment\x20details...','\x20\x20Cause:\x20','resolveParentId','Error:\x20Cannot\x20execute\x20SQL\x20query\x20on\x20a\x20folder.','/e/','✖\x20Query\x20failed\x20[','error','description','format','segment:desc','\x20\x20Folder\x20path:\x20','98418TFlsgc','\x20\x20tdx\x20sg\x20sql\x20\x22Premium\x20Users\x22','getFolder','36rrvXSi','green','parentFolder','jobId','No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22','Resolving\x20path\x20\x27','\x27\x20with\x20ID:\x20','Error:\x20','limit','Error:\x20Parent\x20segment\x20name\x20and\x20folder\x20name\x20are\x20required','Fetching\x20parent\x20segment\x20details...','Target\x20path:\x20','Resolving\x20parent\x20segment\x20\x27','\x20\x20tdx\x20sg\x20desc\x20segments/my-audience/premium-users.yml','processedRows','folderPath','segment','verbose','Error:\x20Cannot\x20open\x20parent\x20segment\x20with\x20this\x20command.','Fetching\x20folder\x20details...','fullPath','Resolved\x20parent\x20folder\x20ID:\x20','Segment\x20ID\x20missing\x20from\x20resolved\x20path','includes','parent','Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.','folderId','setJobId','Error:\x20Folder\x20name\x20is\x20required\x20(use\x20parent_name/folder_name\x20format)','\x20\x20tdx\x20sg\x20show\x20\x22Premium\x20Users\x22','information_schema','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience/Marketing/High\x20Value\x22','\x20\x20Segment\x20name:\x20','Error:\x20Folder\x20reference\x20is\x20required','Resolved\x20relative\x20path\x20to:\x20','Usage:\x20tdx\x20sg\x20view\x20<name>\x20[-w]','Error:\x20Cannot\x20execute\x20query\x20for\x20parent\x20segment\x20with\x20this\x20command.','parentId','Resolving\x20parent\x20folder\x20\x27','message','replace','Fetching\x20folder\x20\x27','\x20\x20tdx\x20segment\x20describe\x20\x22High\x20Value\x22\x20\x20\x20\x20#\x20Relative\x20to\x20current\x20context','segmentName','Usage:\x20tdx\x20sg\x20sql\x20<name>','SEGMENT_FOLDER_NOT_FOUND','539XLrQPp','Usage:\x20tdx\x20segment\x20folder\x20show\x20<parent_name/folder_name>','SEGMENT_NOT_FOUND','/app/ps/','Error:\x20Parent\x20segment\x20name\x20is\x20required','data','segment:folder:create','45896mtahet','trim','\x20[Job\x20ID:\x20','segment:describe','length','✔\x20Created\x20folder\x20\x27','getSegment','Show\x20folder\x20or\x20child\x20segment\x20details','Segment\x20ID:\x20','Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required','6782904GfITeB','Resolving\x20\x27','403304HtrSoL','List\x20segment\x20folders\x20under\x20a\x20parent\x20segment','30jzRwua','Resolved\x20folder\x20ID:\x20'];a27_0x3cf1=function(){return _0x2f3c66;};return a27_0x3cf1();}export class SegmentFolderListCommand extends BaseCommand{[a27_0x3bfcdd(0x13a)]='segment:folder:list';[a27_0x3bfcdd(0x187)]=a27_0x3bfcdd(0x135);async[a27_0x3bfcdd(0x17a)](_0x2b0278){const _0x50c363=a27_0x3bfcdd,{options:_0x4e7f11,args:_0x1a2d2b,tdx:_0xf9860d}=_0x2b0278;if(_0x1a2d2b[_0x50c363(0x1c7)]===0x0)return console[_0x50c363(0x186)](_0x50c363(0x1c0)),console['error']('Usage:\x20tdx\x20segment\x20folder\x20list\x20<parent_name>'),0x1;const _0x103deb=_0x1a2d2b[0x0];try{_0x4e7f11['verbose']&&(console[_0x50c363(0x186)](_0x50c363(0x149)+_0x4e7f11[_0x50c363(0x15f)]),console[_0x50c363(0x186)](_0x50c363(0x16c)+_0x103deb));const _0x555618=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x103deb+'\x27...',()=>_0xf9860d[_0x50c363(0x19e)][_0x50c363(0x182)](_0x103deb),{'verbose':_0x4e7f11[_0x50c363(0x19f)]}),_0x85090=_0x555618['data'];_0x4e7f11[_0x50c363(0x19f)]&&console[_0x50c363(0x186)](_0x50c363(0x168)+_0x85090);const _0x3fa728=await withSpinner('Listing\x20folders\x20for\x20parent\x20\x27'+_0x103deb+'\x27...',()=>_0xf9860d[_0x50c363(0x19e)]['listFolders'](_0x85090),{'verbose':_0x4e7f11[_0x50c363(0x19f)]}),_0x177786=_0x3fa728[_0x50c363(0x1c1)];return console[_0x50c363(0x186)]('✔\x20Found\x20'+_0x177786[_0x50c363(0x1c7)]+_0x50c363(0x174)+(_0x177786[_0x50c363(0x1c7)]!==0x1?'s':'')),await handleSDKOutput(_0x177786,_0x4e7f11),0x0;}catch(_0x1b7b74){if(_0x1b7b74 instanceof SDKError)return console[_0x50c363(0x186)](_0x50c363(0x195)+_0x1b7b74[_0x50c363(0x1b5)]),_0x1b7b74[_0x50c363(0x179)]&&console['error']('\x20\x20Cause:\x20'+_0x1b7b74[_0x50c363(0x179)]),0x1;throw _0x1b7b74;}}}export class SegmentFolderShowCommand extends BaseCommand{[a27_0x3bfcdd(0x13a)]='segment:folder:show';[a27_0x3bfcdd(0x187)]='Show\x20segment\x20folder\x20details';async[a27_0x3bfcdd(0x17a)](_0x45970f){const _0x3dac1e=a27_0x3bfcdd,{options:_0x332dea,args:_0x1775ca,tdx:_0xc32682}=_0x45970f;if(_0x1775ca[_0x3dac1e(0x1c7)]===0x0)return console[_0x3dac1e(0x186)](_0x3dac1e(0x1af)),console['error'](_0x3dac1e(0x1bd)),0x1;try{const {parentId:_0x3dc1c8,childId:_0x40b734}=parseSegmentRef(_0x1775ca[0x0]);_0x332dea[_0x3dac1e(0x19f)]&&(console[_0x3dac1e(0x186)](_0x3dac1e(0x149)+_0x332dea[_0x3dac1e(0x15f)]),console[_0x3dac1e(0x186)](_0x3dac1e(0x16c)+_0x3dc1c8),_0x40b734&&console[_0x3dac1e(0x186)](_0x3dac1e(0x164)+_0x40b734));if(!_0x40b734)return console[_0x3dac1e(0x186)](_0x3dac1e(0x1aa)),0x1;const _0x5495ed=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x3dc1c8+_0x3dac1e(0x173),()=>_0xc32682[_0x3dac1e(0x19e)][_0x3dac1e(0x182)](_0x3dc1c8),{'verbose':_0x332dea['verbose']}),_0x3a0f7f=_0x5495ed[_0x3dac1e(0x1c1)];_0x332dea['verbose']&&console[_0x3dac1e(0x186)](_0x3dac1e(0x168)+_0x3a0f7f);const _0x53d1c0=await withSpinner(_0x3dac1e(0x156)+_0x40b734+_0x3dac1e(0x173),()=>_0xc32682[_0x3dac1e(0x19e)][_0x3dac1e(0x154)](_0x3a0f7f,_0x40b734),{'verbose':_0x332dea[_0x3dac1e(0x19f)]}),_0x45f018=_0x53d1c0[_0x3dac1e(0x1c1)];_0x332dea[_0x3dac1e(0x19f)]&&console[_0x3dac1e(0x186)](_0x3dac1e(0x137)+_0x45f018);const _0x304310=await withSpinner(_0x3dac1e(0x1b7)+_0x40b734+'\x27...',()=>_0xc32682[_0x3dac1e(0x19e)][_0x3dac1e(0x18d)](_0x45f018),{'verbose':_0x332dea[_0x3dac1e(0x19f)]});return await handleSDKOutput([_0x304310[_0x3dac1e(0x1c1)]],_0x332dea),0x0;}catch(_0x253031){if(_0x253031 instanceof SDKError)return console['error']('Error:\x20'+_0x253031[_0x3dac1e(0x1b5)]),_0x253031[_0x3dac1e(0x179)]&&console[_0x3dac1e(0x186)](_0x3dac1e(0x181)+_0x253031[_0x3dac1e(0x179)]),0x1;throw _0x253031;}}}export class SegmentSQLCommand extends BaseCommand{[a27_0x3bfcdd(0x13a)]=a27_0x3bfcdd(0x143);[a27_0x3bfcdd(0x187)]=a27_0x3bfcdd(0x13b);async[a27_0x3bfcdd(0x17a)](_0x275a11){const _0x34e7a2=a27_0x3bfcdd,{options:_0x344a58,args:_0x312c31,tdx:_0x189631}=_0x275a11,_0x263151=_0x312c31[0x0];if(!_0x263151)return console[_0x34e7a2(0x186)](_0x34e7a2(0x131)),console[_0x34e7a2(0x186)](_0x34e7a2(0x1ba)),console['error'](_0x34e7a2(0x146)),console['error']('Examples:'),console[_0x34e7a2(0x186)](_0x34e7a2(0x18c)),console[_0x34e7a2(0x186)](_0x34e7a2(0x15b)),0x1;try{const _0x391146=_0x344a58[_0x34e7a2(0x144)],_0x424009=await resolveSegmentTarget(_0x263151,_0x391146,_0x344a58[_0x34e7a2(0x19f)]);_0x344a58[_0x34e7a2(0x19f)]&&console['error'](_0x34e7a2(0x199)+_0x424009);const _0x439a56=await withSpinner(_0x34e7a2(0x133)+_0x263151+_0x34e7a2(0x173),()=>_0x189631['segment'][_0x34e7a2(0x17d)](_0x424009),{'verbose':_0x344a58[_0x34e7a2(0x19f)]}),_0x5819e6=_0x439a56['data'];_0x344a58['verbose']&&(console['error'](_0x34e7a2(0x16a)+_0x5819e6[_0x34e7a2(0x14e)]),console[_0x34e7a2(0x186)]('Parent\x20ID:\x20'+_0x5819e6[_0x34e7a2(0x1b3)]));if(_0x5819e6[_0x34e7a2(0x14e)]==='folder')return console['error'](_0x34e7a2(0x178)),console[_0x34e7a2(0x186)](_0x34e7a2(0x1a7)),0x1;if(_0x5819e6[_0x34e7a2(0x14e)]===_0x34e7a2(0x1a6))return console['error'](_0x34e7a2(0x14d)),console[_0x34e7a2(0x186)]('Use:\x20tdx\x20ps\x20sql'),0x1;if(!_0x5819e6[_0x34e7a2(0x17c)])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x34e7a2(0x1a4));const _0x21adf6=await withSpinner('Fetching\x20SQL\x20for\x20segment...',()=>_0x189631['segment']['getSegmentSQL'](_0x5819e6['parentId'],_0x5819e6[_0x34e7a2(0x17c)]),{'verbose':_0x344a58[_0x34e7a2(0x19f)]}),_0x452dc4=_0x21adf6[_0x34e7a2(0x1c1)];return _0x344a58[_0x34e7a2(0x188)]===_0x34e7a2(0x160)||_0x344a58[_0x34e7a2(0x188)]==='jsonl'?await handleSDKOutput([{'sql':_0x452dc4}],_0x344a58):console[_0x34e7a2(0x159)](_0x452dc4),0x0;}catch(_0x713b56){if(_0x713b56 instanceof SDKError)return console['error']('Error:\x20'+_0x713b56['message']),_0x713b56[_0x34e7a2(0x179)]&&console[_0x34e7a2(0x186)](_0x34e7a2(0x181)+_0x713b56[_0x34e7a2(0x179)]),0x1;throw _0x713b56;}}}export class SegmentFolderCreateCommand extends BaseCommand{[a27_0x3bfcdd(0x13a)]=a27_0x3bfcdd(0x1c2);[a27_0x3bfcdd(0x187)]='Create\x20segment\x20folder\x20for\x20organization';async['execute'](_0x464bfd){const _0x97d60f=a27_0x3bfcdd,{options:_0x314f2c,args:_0x372787,tdx:_0x109fcd}=_0x464bfd,_0x2702ad=_0x314f2c;if(_0x372787['length']<0x2)return console[_0x97d60f(0x186)](_0x97d60f(0x197)),console['error'](_0x97d60f(0x161)),0x1;const _0x315c39=_0x372787[0x0],_0x3a6d33=_0x372787[0x1];_0x2702ad[_0x97d60f(0x19f)]&&(console[_0x97d60f(0x186)](_0x97d60f(0x149)+_0x2702ad[_0x97d60f(0x15f)]),console[_0x97d60f(0x186)](_0x97d60f(0x15c)+_0x315c39),console[_0x97d60f(0x186)](_0x97d60f(0x164)+_0x3a6d33));let _0x49eff5;if(_0x2702ad[_0x97d60f(0x190)]){const _0x34bb06=_0x2702ad[_0x97d60f(0x190)],_0x24df12=await withSpinner(_0x97d60f(0x19a)+_0x315c39+'\x27...',()=>_0x109fcd[_0x97d60f(0x19e)][_0x97d60f(0x182)](_0x315c39),{'verbose':_0x2702ad[_0x97d60f(0x19f)]}),_0x4225c=_0x24df12[_0x97d60f(0x1c1)],_0x5ca389=await withSpinner(_0x97d60f(0x1b4)+_0x34bb06+_0x97d60f(0x173),()=>_0x109fcd[_0x97d60f(0x19e)][_0x97d60f(0x154)](_0x4225c,_0x34bb06),{'verbose':_0x2702ad['verbose']});_0x49eff5=_0x5ca389[_0x97d60f(0x1c1)],_0x2702ad['verbose']&&console[_0x97d60f(0x186)](_0x97d60f(0x1a3)+_0x49eff5);}const _0x53f796={'name':_0x3a6d33,'description':_0x2702ad[_0x97d60f(0x187)],'parentFolderId':_0x49eff5},_0x2fd66b=await withSpinner(_0x97d60f(0x150)+_0x3a6d33+_0x97d60f(0x173),()=>_0x109fcd[_0x97d60f(0x19e)]['createFolder'](_0x315c39,_0x53f796),{'verbose':_0x2702ad['verbose']}),_0x2f213d=_0x2fd66b[_0x97d60f(0x1c1)];return console[_0x97d60f(0x186)](_0x97d60f(0x12d)+_0x2f213d[_0x97d60f(0x13a)]+_0x97d60f(0x194)+_0x2f213d['id']),await handleSDKOutput([_0x2f213d],_0x2702ad),0x0;}}export class SegmentViewCommand extends BaseCommand{[a27_0x3bfcdd(0x13a)]='segment:view';[a27_0x3bfcdd(0x187)]=a27_0x3bfcdd(0x12f);async[a27_0x3bfcdd(0x17a)](_0x53dab8){const _0x17ed56=a27_0x3bfcdd,{options:_0x2b1023,args:_0x23536c,tdx:_0x513302}=_0x53dab8,_0x138881=_0x23536c[0x0];if(!_0x138881)return console[_0x17ed56(0x186)]('Error:\x20Folder\x20or\x20segment\x20name,\x20or\x20YAML\x20file\x20path\x20is\x20required'),console[_0x17ed56(0x186)](_0x17ed56(0x1b1)),console[_0x17ed56(0x186)](_0x17ed56(0x15d)),console[_0x17ed56(0x186)](_0x17ed56(0x13e)),console['error']('\x20\x20-w,\x20--web\x20\x20Open\x20segment\x20in\x20web\x20browser'),console[_0x17ed56(0x186)](_0x17ed56(0x157)),console[_0x17ed56(0x186)]('\x20\x20tdx\x20sg\x20view\x20\x22Marketing\x22\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20folder\x20details'),console[_0x17ed56(0x186)]('\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20\x20\x20\x20\x20#\x20View\x20child\x20segment\x20details'),console[_0x17ed56(0x186)]('\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20-w\x20\x20#\x20Open\x20segment\x20in\x20web\x20browser'),console[_0x17ed56(0x186)](_0x17ed56(0x167)),0x1;try{const _0x22da26=_0x2b1023[_0x17ed56(0x144)],_0x44c730=await resolveSegmentTarget(_0x138881,_0x22da26,_0x2b1023[_0x17ed56(0x19f)]);_0x2b1023[_0x17ed56(0x19f)]&&console[_0x17ed56(0x186)](_0x17ed56(0x199)+_0x44c730);const _0x4bb964=await withSpinner('Resolving\x20\x27'+_0x138881+_0x17ed56(0x173),()=>_0x513302[_0x17ed56(0x19e)][_0x17ed56(0x17d)](_0x44c730),{'verbose':_0x2b1023['verbose']}),_0x659521=_0x4bb964[_0x17ed56(0x1c1)];_0x2b1023[_0x17ed56(0x19f)]&&(console['error'](_0x17ed56(0x16a)+_0x659521['type']),console[_0x17ed56(0x186)]('Parent\x20ID:\x20'+_0x659521[_0x17ed56(0x1b3)]),_0x659521[_0x17ed56(0x1a8)]&&console[_0x17ed56(0x186)](_0x17ed56(0x177)+_0x659521[_0x17ed56(0x1a8)]),_0x659521[_0x17ed56(0x17c)]&&console[_0x17ed56(0x186)](_0x17ed56(0x130)+_0x659521['segmentId']));if(_0x2b1023['web']){if(_0x659521[_0x17ed56(0x14e)]===_0x17ed56(0x162))return console[_0x17ed56(0x186)]('Error:\x20Cannot\x20open\x20folder\x20in\x20web\x20browser.\x20Use\x20a\x20segment\x20name\x20instead.'),0x1;if(_0x659521[_0x17ed56(0x14e)]==='parent')return console[_0x17ed56(0x186)](_0x17ed56(0x1a0)),console[_0x17ed56(0x186)](_0x17ed56(0x175)),0x1;if(!_0x659521['segmentId'])throw new SDKError(ErrorCode[_0x17ed56(0x1be)],_0x17ed56(0x1a4));const _0x215bd3=getConsoleNextUrl(_0x2b1023['site'],_0x17ed56(0x1bf)+_0x659521[_0x17ed56(0x1b3)]+'/e/'+_0x659521['segmentId']);return console[_0x17ed56(0x186)](a27_0x44905d[_0x17ed56(0x18f)]('✔')+_0x17ed56(0x140)+a27_0x44905d[_0x17ed56(0x16d)](_0x215bd3)),openBrowser(_0x215bd3),0x0;}if(_0x659521['type']===_0x17ed56(0x162)){if(!_0x659521[_0x17ed56(0x1a8)])throw new SDKError(ErrorCode[_0x17ed56(0x1bb)],_0x17ed56(0x141));const _0x87087d=await withSpinner('Fetching\x20folder\x20details...',()=>_0x513302[_0x17ed56(0x19e)][_0x17ed56(0x18d)](_0x659521[_0x17ed56(0x1a8)]),{'verbose':_0x2b1023[_0x17ed56(0x19f)]});await handleSingleObjectOutput(_0x87087d['data'],_0x2b1023);}else{if(_0x659521[_0x17ed56(0x14e)]===_0x17ed56(0x19e)){if(!_0x659521[_0x17ed56(0x17c)])throw new SDKError(ErrorCode[_0x17ed56(0x1be)],_0x17ed56(0x1a4));const _0x53ee91=await withSpinner(_0x17ed56(0x180),()=>_0x513302[_0x17ed56(0x19e)][_0x17ed56(0x12e)](_0x659521[_0x17ed56(0x1b3)],_0x659521[_0x17ed56(0x17c)]),{'verbose':_0x2b1023[_0x17ed56(0x19f)]}),_0x44c159=getConsoleNextUrl(_0x2b1023[_0x17ed56(0x15f)],_0x17ed56(0x1bf)+_0x659521[_0x17ed56(0x1b3)]+_0x17ed56(0x184)+_0x659521[_0x17ed56(0x17c)]),_0x3027f9=_0x53ee91[_0x17ed56(0x1c1)];_0x3027f9[_0x17ed56(0x142)]=_0x44c159,await handleSingleObjectOutput(_0x3027f9,_0x2b1023);}else return console['error'](_0x17ed56(0x158)),console['error']('Use:\x20tdx\x20ps\x20view'),0x1;}return 0x0;}catch(_0x14ae4c){if(_0x14ae4c instanceof SDKError)return console[_0x17ed56(0x186)]('Error:\x20'+_0x14ae4c['message']),_0x14ae4c['cause']&&console['error'](_0x17ed56(0x181)+_0x14ae4c[_0x17ed56(0x179)]),0x1;throw _0x14ae4c;}}}export const SegmentInfoCommand=SegmentViewCommand;export class SegmentDescCommand extends BaseCommand{[a27_0x3bfcdd(0x13a)]=a27_0x3bfcdd(0x189);['description']='Show\x20child\x20segment\x20schema\x20(column\x20types)';async[a27_0x3bfcdd(0x17a)](_0x4b1803){const _0x4563f1=a27_0x3bfcdd,{options:_0xb31746,args:_0x1e66e2,tdx:_0x36c7f1}=_0x4b1803,_0x213090=_0x1e66e2[0x0];if(!_0x213090)return console[_0x4563f1(0x186)](_0x4563f1(0x131)),console[_0x4563f1(0x186)](_0x4563f1(0x152)),console['error']('\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20desc\x20<path/to/segment.yml>'),console[_0x4563f1(0x186)]('Examples:'),console[_0x4563f1(0x186)](_0x4563f1(0x163)),console[_0x4563f1(0x186)](_0x4563f1(0x19b)),0x1;try{const _0x422cdd=_0xb31746[_0x4563f1(0x144)],_0x226481=await resolveSegmentTarget(_0x213090,_0x422cdd,_0xb31746[_0x4563f1(0x19f)]);_0xb31746['verbose']&&console[_0x4563f1(0x186)](_0x4563f1(0x199)+_0x226481);const _0x192020=await withSpinner(_0x4563f1(0x133)+_0x213090+_0x4563f1(0x173),()=>_0x36c7f1[_0x4563f1(0x19e)][_0x4563f1(0x17d)](_0x226481),{'verbose':_0xb31746[_0x4563f1(0x19f)]}),_0x5d3320=_0x192020[_0x4563f1(0x1c1)];_0xb31746[_0x4563f1(0x19f)]&&(console['error']('Resolved\x20type:\x20'+_0x5d3320[_0x4563f1(0x14e)]),console[_0x4563f1(0x186)](_0x4563f1(0x17f)+_0x5d3320[_0x4563f1(0x1b3)]));if(_0x5d3320[_0x4563f1(0x14e)]===_0x4563f1(0x162))return console[_0x4563f1(0x186)]('Error:\x20Cannot\x20show\x20schema\x20for\x20a\x20folder.'),console[_0x4563f1(0x186)](_0x4563f1(0x1a7)),0x1;if(_0x5d3320['type']==='parent')return console[_0x4563f1(0x186)]('Error:\x20Cannot\x20show\x20schema\x20for\x20parent\x20segment\x20with\x20this\x20command.'),console[_0x4563f1(0x186)](_0x4563f1(0x172)),0x1;if(!_0x5d3320[_0x4563f1(0x17c)])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x4563f1(0x1a4));const _0x19d1de=await withSpinner(_0x4563f1(0x153),()=>_0x36c7f1[_0x4563f1(0x19e)][_0x4563f1(0x14f)](_0x5d3320['parentId'],_0x5d3320[_0x4563f1(0x17c)]),{'verbose':_0xb31746[_0x4563f1(0x19f)]}),_0x9fd2cc=_0x19d1de[_0x4563f1(0x1c1)],_0x55ab39=await executeSchemaQuery(_0x9fd2cc,_0x36c7f1,_0xb31746);return await handleQueryOutput(_0x55ab39,_0xb31746),0x0;}catch(_0x92b3d1){if(_0x92b3d1 instanceof SDKError)return console[_0x4563f1(0x186)](_0x4563f1(0x195)+_0x92b3d1['message']),_0x92b3d1[_0x4563f1(0x179)]&&console['error'](_0x4563f1(0x181)+_0x92b3d1[_0x4563f1(0x179)]),0x1;throw _0x92b3d1;}}}
1
+ const a27_0x59a4f0=a27_0x4b12;(function(_0x356ff2,_0x587766){const _0x1dcd10=a27_0x4b12,_0x4d6dd0=_0x356ff2();while(!![]){try{const _0x31fd7b=parseInt(_0x1dcd10(0x146))/0x1+parseInt(_0x1dcd10(0x15c))/0x2*(-parseInt(_0x1dcd10(0x14a))/0x3)+parseInt(_0x1dcd10(0x1b3))/0x4+parseInt(_0x1dcd10(0x1a4))/0x5+-parseInt(_0x1dcd10(0x16a))/0x6*(-parseInt(_0x1dcd10(0x19d))/0x7)+-parseInt(_0x1dcd10(0x139))/0x8*(-parseInt(_0x1dcd10(0x19a))/0x9)+-parseInt(_0x1dcd10(0x128))/0xa;if(_0x31fd7b===_0x587766)break;else _0x4d6dd0['push'](_0x4d6dd0['shift']());}catch(_0x4ca776){_0x4d6dd0['push'](_0x4d6dd0['shift']());}}}(a27_0x2699,0x4a9f3));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,handleQueryOutput,handleSingleObjectOutput}from'../core/command-output.js';import{withSpinner,withProgressSpinner,formatElapsed}from'../utils/spinner.js';import{parseSegmentRef}from'../sdk/segment/segment-ref-parser.js';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import{executeSchemaQuery}from'../sdk/segment/fields-display.js';import{isYamlFilePath,resolveYamlFilePath}from'../sdk/segment/segment-path-parser.js';import{getConsoleNextUrl}from'../sdk/client/endpoints.js';import{openBrowser}from'../utils/process.js';import a27_0x4e2542 from'chalk';async function resolveSegmentTarget(_0x21e540,_0x56146d,_0x3409ea){const _0x45414f=a27_0x4b12;if(isYamlFilePath(_0x21e540))try{const _0x338cdb=await resolveYamlFilePath(_0x21e540);return _0x3409ea&&(console[_0x45414f(0x16b)](_0x45414f(0x13d)+_0x21e540),console[_0x45414f(0x16b)](_0x45414f(0x130)+_0x338cdb[_0x45414f(0x154)]),console[_0x45414f(0x16b)](_0x45414f(0x151)+_0x338cdb[_0x45414f(0x147)]),console[_0x45414f(0x16b)](_0x45414f(0x153)+(_0x338cdb[_0x45414f(0x191)]||'(root)')),console[_0x45414f(0x16b)](_0x45414f(0x161)+_0x338cdb[_0x45414f(0x165)])),_0x338cdb[_0x45414f(0x165)];}catch(_0x4e9eeb){throw new SDKError(ErrorCode['INVALID_ARGUMENT'],'Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20'+_0x4e9eeb[_0x45414f(0x194)]);}if(!_0x56146d)throw new SDKError(ErrorCode[_0x45414f(0x183)],_0x45414f(0x1ab));return _0x56146d+'/'+_0x21e540;}export class SegmentDescribeCommand extends BaseCommand{[a27_0x59a4f0(0x1ad)]=a27_0x59a4f0(0x1bc);[a27_0x59a4f0(0x12c)]='Show\x20segment\x20or\x20folder\x20details';async[a27_0x59a4f0(0x164)](_0x125d5f){const _0x2e855e=a27_0x59a4f0,{options:_0x4f5898,args:_0x24a344,tdx:_0x4c48ee}=_0x125d5f,_0x3b7e13=_0x24a344[0x0],_0xbbf71e=!_0x3b7e13&&!!_0x4f5898[_0x2e855e(0x154)],_0x195d43=_0x3b7e13||_0x4f5898[_0x2e855e(0x154)];if(!_0x195d43)return console[_0x2e855e(0x16b)](_0x2e855e(0x176)),console[_0x2e855e(0x16b)](_0x2e855e(0x162)),console[_0x2e855e(0x16b)](_0x2e855e(0x157)),console[_0x2e855e(0x16b)](_0x2e855e(0x156)),console['error'](_0x2e855e(0x17f)),console[_0x2e855e(0x16b)](_0x2e855e(0x143)),console[_0x2e855e(0x16b)]('\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>'),0x1;try{const _0x1a324d=_0x4f5898['segmentPath'];let _0x18b20e=_0x195d43;!_0xbbf71e&&_0x1a324d&&!_0x195d43[_0x2e855e(0x155)]('/')&&(_0x18b20e=_0x1a324d+'/'+_0x195d43,_0x4f5898['verbose']&&console[_0x2e855e(0x16b)](_0x2e855e(0x190)+_0x18b20e));const _0x19a76f=await withSpinner(_0x2e855e(0x16e)+_0x18b20e+'\x27...',()=>_0x4c48ee[_0x2e855e(0x16d)][_0x2e855e(0x1af)](_0x18b20e),{'verbose':_0x4f5898[_0x2e855e(0x17d)]}),_0xbaea6f=_0x19a76f[_0x2e855e(0x135)];_0x4f5898[_0x2e855e(0x17d)]&&(console[_0x2e855e(0x16b)]('Resolved\x20type:\x20'+_0xbaea6f['type']),console['error'](_0x2e855e(0x178)+_0xbaea6f[_0x2e855e(0x168)]),_0xbaea6f['folderId']&&console[_0x2e855e(0x16b)](_0x2e855e(0x171)+_0xbaea6f[_0x2e855e(0x18c)]),_0xbaea6f['segmentId']&&console[_0x2e855e(0x16b)]('Segment\x20ID:\x20'+_0xbaea6f[_0x2e855e(0x163)]));if(_0xbaea6f[_0x2e855e(0x196)]===_0x2e855e(0x17a)){const _0x40444e=await withSpinner(_0x2e855e(0x12a),()=>_0x4c48ee[_0x2e855e(0x16d)][_0x2e855e(0x167)](_0xbaea6f[_0x2e855e(0x168)]),{'verbose':_0x4f5898[_0x2e855e(0x17d)]});await handleSingleObjectOutput(_0x40444e[_0x2e855e(0x135)],_0x4f5898);}else{if(_0xbaea6f['type']===_0x2e855e(0x193)){if(!_0xbaea6f[_0x2e855e(0x18c)])throw new SDKError(ErrorCode['SEGMENT_FOLDER_NOT_FOUND'],_0x2e855e(0x149));const _0x18d384=await withSpinner(_0x2e855e(0x13c),()=>_0x4c48ee[_0x2e855e(0x16d)][_0x2e855e(0x144)](_0xbaea6f[_0x2e855e(0x18c)]),{'verbose':_0x4f5898[_0x2e855e(0x17d)]});await handleSingleObjectOutput(_0x18d384[_0x2e855e(0x135)],_0x4f5898);}else{if(_0xbaea6f['type']===_0x2e855e(0x16d)){if(!_0xbaea6f['segmentId'])throw new SDKError(ErrorCode[_0x2e855e(0x19b)],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x410dd4=await withSpinner(_0x2e855e(0x1a5),()=>_0x4c48ee[_0x2e855e(0x16d)]['getSegment'](_0xbaea6f[_0x2e855e(0x168)],_0xbaea6f[_0x2e855e(0x163)]),{'verbose':_0x4f5898['verbose']});await handleSingleObjectOutput(_0x410dd4['data'],_0x4f5898);}}}return 0x0;}catch(_0x571ed3){if(_0x571ed3 instanceof SDKError)return console[_0x2e855e(0x16b)]('Error:\x20'+_0x571ed3[_0x2e855e(0x194)]),_0x571ed3[_0x2e855e(0x160)]&&console[_0x2e855e(0x16b)](_0x2e855e(0x12e)+_0x571ed3[_0x2e855e(0x160)]),0x1;throw _0x571ed3;}}}export class SegmentShowCommand extends BaseCommand{[a27_0x59a4f0(0x1ad)]=a27_0x59a4f0(0x199);['description']='Execute\x20child\x20segment\x20SQL\x20query\x20and\x20show\x20results';async[a27_0x59a4f0(0x164)](_0x3e0868){const _0x48bf09=a27_0x59a4f0,{options:_0xcb82f8,args:_0x22626c,tdx:_0x3290ad}=_0x3e0868,_0x559e14=_0x22626c[0x0];if(!_0x559e14)return console[_0x48bf09(0x16b)]('Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required'),console[_0x48bf09(0x16b)](_0x48bf09(0x18f)),console[_0x48bf09(0x16b)]('\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20show\x20<path/to/segment.yml>'),console[_0x48bf09(0x16b)](_0x48bf09(0x157)),console['error']('\x20\x20tdx\x20sg\x20show\x20\x22Premium\x20Users\x22'),console[_0x48bf09(0x16b)]('\x20\x20tdx\x20sg\x20show\x20segments/my-audience/premium-users.yml'),0x1;try{const _0x2b9669=_0xcb82f8['parentSegment'],_0xbbe1d3=await resolveSegmentTarget(_0x559e14,_0x2b9669,_0xcb82f8[_0x48bf09(0x17d)]);_0xcb82f8[_0x48bf09(0x17d)]&&console[_0x48bf09(0x16b)](_0x48bf09(0x197)+_0xbbe1d3);const _0x374966=await withSpinner(_0x48bf09(0x1ae)+_0x559e14+_0x48bf09(0x198),()=>_0x3290ad[_0x48bf09(0x16d)][_0x48bf09(0x1af)](_0xbbe1d3),{'verbose':_0xcb82f8[_0x48bf09(0x17d)]}),_0x3187a1=_0x374966[_0x48bf09(0x135)];_0xcb82f8[_0x48bf09(0x17d)]&&(console[_0x48bf09(0x16b)](_0x48bf09(0x185)+_0x3187a1[_0x48bf09(0x196)]),console[_0x48bf09(0x16b)](_0x48bf09(0x178)+_0x3187a1[_0x48bf09(0x168)]));if(_0x3187a1[_0x48bf09(0x196)]===_0x48bf09(0x193))return console[_0x48bf09(0x16b)](_0x48bf09(0x177)),console['error'](_0x48bf09(0x169)),0x1;if(_0x3187a1[_0x48bf09(0x196)]===_0x48bf09(0x17a))return console['error'](_0x48bf09(0x150)),console['error']('Use:\x20tdx\x20ps\x20show'),0x1;if(!_0x3187a1[_0x48bf09(0x163)])throw new SDKError(ErrorCode[_0x48bf09(0x19b)],_0x48bf09(0x15b));const _0x52156d=await withSpinner(_0x48bf09(0x12f),()=>_0x3290ad[_0x48bf09(0x16d)][_0x48bf09(0x14c)](_0x3187a1['parentId'],_0x3187a1['segmentId']),{'verbose':_0xcb82f8['verbose']});let _0x4d8b2b=_0x52156d['data'];const _0x2fd217=resolveLimit(_0xcb82f8['limit'],DEFAULT_DISPLAY_LIMIT),_0x2a004e=/\bLIMIT\s+\d+/i['test'](_0x4d8b2b);!_0x2a004e&&(_0x4d8b2b=_0x4d8b2b['trim']()[_0x48bf09(0x179)](/;+$/,''),_0x4d8b2b='SELECT\x20*\x20FROM\x20(\x0a'+_0x4d8b2b+_0x48bf09(0x140)+_0x2fd217);_0xcb82f8[_0x48bf09(0x17d)]&&console[_0x48bf09(0x16b)](_0x48bf09(0x188)+_0x4d8b2b);const _0x5dea9e=await withProgressSpinner(_0x48bf09(0x18a),async _0x2c222c=>{const _0xeef90d=_0x48bf09,_0x8a5661=await _0x3290ad[_0xeef90d(0x1a9)][_0xeef90d(0x164)](_0x4d8b2b,{'catalog':'td','schema':_0xeef90d(0x1b2),'onJobId':_0x41e3ca=>{const _0x16eb88=_0xeef90d;_0x2c222c[_0x16eb88(0x17e)](_0x41e3ca);}});return _0x8a5661;},{'verbose':_0xcb82f8[_0x48bf09(0x17d)]}),_0x37ce0f=_0x5dea9e['data'],_0x5c5e85=_0x37ce0f['jobId']?_0x48bf09(0x134)+_0x37ce0f['jobId']+']':'';return console[_0x48bf09(0x16b)]('✔\x20Query\x20completed:\x20Processed\x20'+_0x37ce0f['stats'][_0x48bf09(0x1b9)][_0x48bf09(0x12d)]()+'\x20rows\x20'+('in\x20'+formatElapsed(_0x37ce0f[_0x48bf09(0x189)][_0x48bf09(0x170)])+_0x5c5e85)),await handleQueryOutput(_0x37ce0f,_0xcb82f8),0x0;}catch(_0x2b8fb1){if(_0x2b8fb1 instanceof SDKError)return console[_0x48bf09(0x16b)]('✖\x20Query\x20failed\x20['+_0x2b8fb1[_0x48bf09(0x159)]+']'),console[_0x48bf09(0x16b)]('\x0a'+_0x2b8fb1[_0x48bf09(0x194)]),0x1;throw _0x2b8fb1;}}}export class SegmentFolderListCommand extends BaseCommand{[a27_0x59a4f0(0x1ad)]='segment:folder:list';['description']=a27_0x59a4f0(0x14e);async[a27_0x59a4f0(0x164)](_0x502c89){const _0x45c285=a27_0x59a4f0,{options:_0x3b034b,args:_0x42f09a,tdx:_0x33a51b}=_0x502c89;if(_0x42f09a['length']===0x0)return console['error'](_0x45c285(0x142)),console['error'](_0x45c285(0x138)),0x1;const _0xdfa188=_0x42f09a[0x0];try{_0x3b034b['verbose']&&(console[_0x45c285(0x16b)](_0x45c285(0x1a8)+_0x3b034b[_0x45c285(0x19c)]),console[_0x45c285(0x16b)](_0x45c285(0x141)+_0xdfa188));const _0x44038e=await withSpinner(_0x45c285(0x1ba)+_0xdfa188+_0x45c285(0x198),()=>_0x33a51b[_0x45c285(0x16d)][_0x45c285(0x18b)](_0xdfa188),{'verbose':_0x3b034b[_0x45c285(0x17d)]}),_0x48a6ed=_0x44038e[_0x45c285(0x135)];_0x3b034b[_0x45c285(0x17d)]&&console[_0x45c285(0x16b)](_0x45c285(0x1b5)+_0x48a6ed);const _0x595dab=await withSpinner(_0x45c285(0x148)+_0xdfa188+_0x45c285(0x198),()=>_0x33a51b[_0x45c285(0x16d)][_0x45c285(0x184)](_0x48a6ed),{'verbose':_0x3b034b[_0x45c285(0x17d)]}),_0x1fa46c=_0x595dab[_0x45c285(0x135)];return console['error']('✔\x20Found\x20'+_0x1fa46c[_0x45c285(0x1b1)]+_0x45c285(0x145)+(_0x1fa46c['length']!==0x1?'s':'')),await handleSDKOutput(_0x1fa46c,_0x3b034b),0x0;}catch(_0x389c99){if(_0x389c99 instanceof SDKError)return console['error']('Error:\x20'+_0x389c99['message']),_0x389c99['cause']&&console['error'](_0x45c285(0x12e)+_0x389c99[_0x45c285(0x160)]),0x1;throw _0x389c99;}}}export class SegmentFolderShowCommand extends BaseCommand{[a27_0x59a4f0(0x1ad)]='segment:folder:show';[a27_0x59a4f0(0x12c)]=a27_0x59a4f0(0x1a1);async[a27_0x59a4f0(0x164)](_0x3d744b){const _0x3c6537=a27_0x59a4f0,{options:_0xb96f,args:_0x429064,tdx:_0x1da654}=_0x3d744b;if(_0x429064[_0x3c6537(0x1b1)]===0x0)return console[_0x3c6537(0x16b)](_0x3c6537(0x1aa)),console['error']('Usage:\x20tdx\x20segment\x20folder\x20show\x20<parent_name/folder_name>'),0x1;try{const {parentId:_0x32217f,childId:_0x9ae997}=parseSegmentRef(_0x429064[0x0]);_0xb96f[_0x3c6537(0x17d)]&&(console['error']('Site:\x20'+_0xb96f['site']),console['error']('Parent\x20name:\x20'+_0x32217f),_0x9ae997&&console['error'](_0x3c6537(0x19f)+_0x9ae997));if(!_0x9ae997)return console[_0x3c6537(0x16b)](_0x3c6537(0x18d)),0x1;const _0x46eb12=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x32217f+'\x27...',()=>_0x1da654[_0x3c6537(0x16d)][_0x3c6537(0x18b)](_0x32217f),{'verbose':_0xb96f[_0x3c6537(0x17d)]}),_0x1d656c=_0x46eb12['data'];_0xb96f['verbose']&&console[_0x3c6537(0x16b)](_0x3c6537(0x1b5)+_0x1d656c);const _0x24a862=await withSpinner(_0x3c6537(0x1ac)+_0x9ae997+_0x3c6537(0x198),()=>_0x1da654[_0x3c6537(0x16d)]['resolveFolderId'](_0x1d656c,_0x9ae997),{'verbose':_0xb96f[_0x3c6537(0x17d)]}),_0x106a54=_0x24a862[_0x3c6537(0x135)];_0xb96f[_0x3c6537(0x17d)]&&console[_0x3c6537(0x16b)](_0x3c6537(0x17b)+_0x106a54);const _0x503bd1=await withSpinner(_0x3c6537(0x137)+_0x9ae997+_0x3c6537(0x198),()=>_0x1da654[_0x3c6537(0x16d)]['getFolder'](_0x106a54),{'verbose':_0xb96f['verbose']});return await handleSDKOutput([_0x503bd1[_0x3c6537(0x135)]],_0xb96f),0x0;}catch(_0x571e35){if(_0x571e35 instanceof SDKError)return console[_0x3c6537(0x16b)](_0x3c6537(0x133)+_0x571e35[_0x3c6537(0x194)]),_0x571e35[_0x3c6537(0x160)]&&console['error'](_0x3c6537(0x12e)+_0x571e35[_0x3c6537(0x160)]),0x1;throw _0x571e35;}}}export class SegmentSQLCommand extends BaseCommand{['name']=a27_0x59a4f0(0x16f);[a27_0x59a4f0(0x12c)]=a27_0x59a4f0(0x1a3);async[a27_0x59a4f0(0x164)](_0x3c5908){const _0xd05ca8=a27_0x59a4f0,{options:_0x20400b,args:_0x519d62,tdx:_0x3c8b73}=_0x3c5908,_0xa8f9b4=_0x519d62[0x0];if(!_0xa8f9b4)return console['error'](_0xd05ca8(0x136)),console[_0xd05ca8(0x16b)](_0xd05ca8(0x131)),console['error'](_0xd05ca8(0x1bb)),console[_0xd05ca8(0x16b)]('Examples:'),console[_0xd05ca8(0x16b)](_0xd05ca8(0x173)),console[_0xd05ca8(0x16b)](_0xd05ca8(0x127)),0x1;try{const _0x483c0f=_0x20400b['parentSegment'],_0x274418=await resolveSegmentTarget(_0xa8f9b4,_0x483c0f,_0x20400b[_0xd05ca8(0x17d)]);_0x20400b['verbose']&&console[_0xd05ca8(0x16b)](_0xd05ca8(0x197)+_0x274418);const _0x1c365b=await withSpinner(_0xd05ca8(0x1ae)+_0xa8f9b4+'\x27...',()=>_0x3c8b73['segment'][_0xd05ca8(0x1af)](_0x274418),{'verbose':_0x20400b[_0xd05ca8(0x17d)]}),_0x307252=_0x1c365b[_0xd05ca8(0x135)];_0x20400b[_0xd05ca8(0x17d)]&&(console['error'](_0xd05ca8(0x185)+_0x307252['type']),console[_0xd05ca8(0x16b)](_0xd05ca8(0x178)+_0x307252[_0xd05ca8(0x168)]));if(_0x307252[_0xd05ca8(0x196)]===_0xd05ca8(0x193))return console['error'](_0xd05ca8(0x15a)),console['error'](_0xd05ca8(0x1b0)),0x1;if(_0x307252[_0xd05ca8(0x196)]===_0xd05ca8(0x17a))return console[_0xd05ca8(0x16b)](_0xd05ca8(0x132)),console['error'](_0xd05ca8(0x180)),0x1;if(!_0x307252[_0xd05ca8(0x163)])throw new SDKError(ErrorCode[_0xd05ca8(0x19b)],_0xd05ca8(0x15b));const _0x4c74d1=await withSpinner('Fetching\x20SQL\x20for\x20segment...',()=>_0x3c8b73['segment'][_0xd05ca8(0x14c)](_0x307252['parentId'],_0x307252[_0xd05ca8(0x163)]),{'verbose':_0x20400b[_0xd05ca8(0x17d)]}),_0x222578=_0x4c74d1[_0xd05ca8(0x135)];return _0x20400b[_0xd05ca8(0x15d)]===_0xd05ca8(0x13a)||_0x20400b[_0xd05ca8(0x15d)]===_0xd05ca8(0x14f)?await handleSDKOutput([{'sql':_0x222578}],_0x20400b):console[_0xd05ca8(0x172)](_0x222578),0x0;}catch(_0x203bca){if(_0x203bca instanceof SDKError)return console[_0xd05ca8(0x16b)]('Error:\x20'+_0x203bca[_0xd05ca8(0x194)]),_0x203bca[_0xd05ca8(0x160)]&&console['error'](_0xd05ca8(0x12e)+_0x203bca['cause']),0x1;throw _0x203bca;}}}function a27_0x4b12(_0x44752e,_0xc3c5b8){_0x44752e=_0x44752e-0x127;const _0x269995=a27_0x2699();let _0x4b1273=_0x269995[_0x44752e];return _0x4b1273;}export class SegmentFolderCreateCommand extends BaseCommand{[a27_0x59a4f0(0x1ad)]='segment:folder:create';[a27_0x59a4f0(0x12c)]=a27_0x59a4f0(0x186);async[a27_0x59a4f0(0x164)](_0x141ea1){const _0x5b5daa=a27_0x59a4f0,{options:_0xb6d1ed,args:_0xe1b1d3,tdx:_0x472119}=_0x141ea1,_0x444653=_0xb6d1ed;if(_0xe1b1d3[_0x5b5daa(0x1b1)]<0x2)return console[_0x5b5daa(0x16b)](_0x5b5daa(0x17c)),console[_0x5b5daa(0x16b)](_0x5b5daa(0x1a0)),0x1;const _0x485c2f=_0xe1b1d3[0x0],_0x4477c8=_0xe1b1d3[0x1];_0x444653[_0x5b5daa(0x17d)]&&(console['error'](_0x5b5daa(0x1a8)+_0x444653[_0x5b5daa(0x19c)]),console['error'](_0x5b5daa(0x16c)+_0x485c2f),console[_0x5b5daa(0x16b)](_0x5b5daa(0x19f)+_0x4477c8));let _0x52e3d7;if(_0x444653['parentFolder']){const _0x49fb4a=_0x444653[_0x5b5daa(0x1a7)],_0x2ff359=await withSpinner(_0x5b5daa(0x1ba)+_0x485c2f+_0x5b5daa(0x198),()=>_0x472119[_0x5b5daa(0x16d)][_0x5b5daa(0x18b)](_0x485c2f),{'verbose':_0x444653[_0x5b5daa(0x17d)]}),_0x636230=_0x2ff359['data'],_0x1dbbe3=await withSpinner('Resolving\x20parent\x20folder\x20\x27'+_0x49fb4a+_0x5b5daa(0x198),()=>_0x472119[_0x5b5daa(0x16d)]['resolveFolderId'](_0x636230,_0x49fb4a),{'verbose':_0x444653[_0x5b5daa(0x17d)]});_0x52e3d7=_0x1dbbe3['data'],_0x444653[_0x5b5daa(0x17d)]&&console[_0x5b5daa(0x16b)](_0x5b5daa(0x1b4)+_0x52e3d7);}const _0x4f83b6={'name':_0x4477c8,'description':_0x444653[_0x5b5daa(0x12c)],'parentFolderId':_0x52e3d7},_0x21d59=await withSpinner('Creating\x20folder\x20\x27'+_0x4477c8+_0x5b5daa(0x198),()=>_0x472119[_0x5b5daa(0x16d)][_0x5b5daa(0x1b6)](_0x485c2f,_0x4f83b6),{'verbose':_0x444653['verbose']}),_0x315468=_0x21d59[_0x5b5daa(0x135)];return console['error'](_0x5b5daa(0x15e)+_0x315468['name']+_0x5b5daa(0x1b8)+_0x315468['id']),await handleSDKOutput([_0x315468],_0x444653),0x0;}}function a27_0x2699(){const _0x3ce745=['listFolders','Resolved\x20type:\x20','Create\x20segment\x20folder\x20for\x20organization','segment:desc','SQL\x20query:\x0a','stats','Executing\x20segment\x20query...','resolveParentId','folderId','Error:\x20Folder\x20name\x20is\x20required\x20(use\x20parent_name/folder_name\x20format)','segment:view','Usage:\x20tdx\x20sg\x20show\x20<name>','Resolved\x20relative\x20path\x20to:\x20','folderPath','SEGMENT_FOLDER_NOT_FOUND','folder','message','Segment\x20ID:\x20','type','Target\x20path:\x20','\x27...','segment:show','9UIvHhc','SEGMENT_NOT_FOUND','site','14nhLInP','Options:','Folder\x20name:\x20','Usage:\x20tdx\x20segment\x20folder\x20create\x20<parent_name>\x20<folder_name>\x20[options]','Show\x20segment\x20folder\x20details','\x20\x20tdx\x20sg\x20desc\x20segments/my-audience/premium-users.yml','Get\x20SQL\x20query\x20for\x20child\x20segment','843110NQJMGt','Fetching\x20segment\x20details...','\x20Opening\x20','parentFolder','Site:\x20','query','Error:\x20Folder\x20reference\x20is\x20required','No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22','Resolving\x20folder\x20\x27','name','Resolving\x20\x27','resolvePathToResource','Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.','length','information_schema','849364uFsRGr','Resolved\x20parent\x20folder\x20ID:\x20','Resolved\x20parent\x20ID:\x20','createFolder','Error:\x20Cannot\x20view\x20parent\x20segment\x20details\x20with\x20this\x20command.','\x27\x20with\x20ID:\x20','processedRows','Resolving\x20parent\x20segment\x20\x27','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20sql\x20<path/to/segment.yml>','segment:describe','\x20\x20tdx\x20sg\x20sql\x20segments/my-audience/premium-users.yml','13436390ErpcFt','Use:\x20tdx\x20ps\x20desc','Fetching\x20parent\x20segment\x20details...','Use:\x20tdx\x20ps\x20view\x20-w','description','toLocaleString','\x20\x20Cause:\x20','Fetching\x20SQL\x20for\x20segment...','\x20\x20Parent\x20segment:\x20','Usage:\x20tdx\x20sg\x20sql\x20<name>','Error:\x20Cannot\x20get\x20SQL\x20for\x20parent\x20segment\x20with\x20this\x20command.','Error:\x20','\x20[Job\x20ID:\x20','data','Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required','Fetching\x20folder\x20\x27','Usage:\x20tdx\x20segment\x20folder\x20list\x20<parent_name>','1162024oRpYXA','json','Error:\x20Cannot\x20open\x20folder\x20in\x20web\x20browser.\x20Use\x20a\x20segment\x20name\x20instead.','Fetching\x20folder\x20details...','Resolved\x20YAML\x20file:\x20','Error:\x20Cannot\x20show\x20schema\x20for\x20parent\x20segment\x20with\x20this\x20command.','cyan','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','Parent\x20name:\x20','Error:\x20Parent\x20segment\x20name\x20is\x20required','\x20\x20tdx\x20segment\x20describe\x20\x22High\x20Value\x22\x20\x20\x20\x20#\x20Relative\x20to\x20current\x20context','getFolder','\x20folder','590115vKFBCI','segmentName','Listing\x20folders\x20for\x20parent\x20\x27','Folder\x20ID\x20missing\x20from\x20resolved\x20path','3CyuPId','web','getSegmentSQL','Usage:\x20tdx\x20sg\x20view\x20<name>\x20[-w]','List\x20segment\x20folders\x20under\x20a\x20parent\x20segment','jsonl','Error:\x20Cannot\x20execute\x20query\x20for\x20parent\x20segment\x20with\x20this\x20command.','\x20\x20Segment\x20name:\x20','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20\x20\x20\x20\x20#\x20View\x20child\x20segment\x20details','\x20\x20Folder\x20path:\x20','parentSegment','includes','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience\x22','Examples:','Show\x20child\x20segment\x20schema\x20(column\x20types)','code','Error:\x20Cannot\x20get\x20SQL\x20query\x20for\x20a\x20folder.','Segment\x20ID\x20missing\x20from\x20resolved\x20path','153666KrwtgY','format','✔\x20Created\x20folder\x20\x27','\x20\x20tdx\x20sg\x20view\x20\x22Marketing\x22\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20folder\x20details','cause','\x20\x20Full\x20path:\x20','Usage:\x20tdx\x20segment\x20describe\x20<path>','segmentId','execute','fullPath','/app/ps/','getParent','parentId','Use:\x20tdx\x20sg\x20view\x20<name>\x20\x20#\x20To\x20show\x20folder\x20details','1829376VeJUbr','error','Parent\x20segment:\x20','segment','Resolving\x20path\x20\x27','segment:sql','elapsedTimeMillis','Folder\x20ID:\x20','log','\x20\x20tdx\x20sg\x20sql\x20\x22Premium\x20Users\x22','/e/','Error:\x20Cannot\x20show\x20schema\x20for\x20a\x20folder.','Error:\x20Path\x20or\x20name\x20is\x20required','Error:\x20Cannot\x20execute\x20SQL\x20query\x20on\x20a\x20folder.','Parent\x20ID:\x20','replace','parent','Resolved\x20folder\x20ID:\x20','Error:\x20Parent\x20segment\x20name\x20and\x20folder\x20name\x20are\x20required','verbose','setJobId','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience/Marketing/High\x20Value\x22','Use:\x20tdx\x20ps\x20sql','\x20\x20tdx\x20sg\x20view\x20segments/my-audience/premium-users.yml','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20view\x20<path/to/segment.yml>','INVALID_ARGUMENT'];a27_0x2699=function(){return _0x3ce745;};return a27_0x2699();}export class SegmentViewCommand extends BaseCommand{[a27_0x59a4f0(0x1ad)]=a27_0x59a4f0(0x18e);[a27_0x59a4f0(0x12c)]='Show\x20folder\x20or\x20child\x20segment\x20details';async[a27_0x59a4f0(0x164)](_0x1d4a66){const _0x4e075b=a27_0x59a4f0,{options:_0x521045,args:_0x52c625,tdx:_0x1530fe}=_0x1d4a66,_0x1baedf=_0x52c625[0x0];if(!_0x1baedf)return console[_0x4e075b(0x16b)]('Error:\x20Folder\x20or\x20segment\x20name,\x20or\x20YAML\x20file\x20path\x20is\x20required'),console['error'](_0x4e075b(0x14d)),console[_0x4e075b(0x16b)](_0x4e075b(0x182)),console[_0x4e075b(0x16b)](_0x4e075b(0x19e)),console[_0x4e075b(0x16b)]('\x20\x20-w,\x20--web\x20\x20Open\x20segment\x20in\x20web\x20browser'),console['error'](_0x4e075b(0x157)),console[_0x4e075b(0x16b)](_0x4e075b(0x15f)),console[_0x4e075b(0x16b)](_0x4e075b(0x152)),console[_0x4e075b(0x16b)]('\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20-w\x20\x20#\x20Open\x20segment\x20in\x20web\x20browser'),console[_0x4e075b(0x16b)](_0x4e075b(0x181)),0x1;try{const _0x13c071=_0x521045[_0x4e075b(0x154)],_0x174007=await resolveSegmentTarget(_0x1baedf,_0x13c071,_0x521045['verbose']);_0x521045[_0x4e075b(0x17d)]&&console[_0x4e075b(0x16b)]('Target\x20path:\x20'+_0x174007);const _0x5e59c7=await withSpinner(_0x4e075b(0x1ae)+_0x1baedf+'\x27...',()=>_0x1530fe['segment'][_0x4e075b(0x1af)](_0x174007),{'verbose':_0x521045['verbose']}),_0x1c6d5f=_0x5e59c7[_0x4e075b(0x135)];_0x521045[_0x4e075b(0x17d)]&&(console['error'](_0x4e075b(0x185)+_0x1c6d5f[_0x4e075b(0x196)]),console[_0x4e075b(0x16b)]('Parent\x20ID:\x20'+_0x1c6d5f[_0x4e075b(0x168)]),_0x1c6d5f[_0x4e075b(0x18c)]&&console[_0x4e075b(0x16b)](_0x4e075b(0x171)+_0x1c6d5f[_0x4e075b(0x18c)]),_0x1c6d5f[_0x4e075b(0x163)]&&console[_0x4e075b(0x16b)](_0x4e075b(0x195)+_0x1c6d5f['segmentId']));if(_0x521045[_0x4e075b(0x14b)]){if(_0x1c6d5f[_0x4e075b(0x196)]===_0x4e075b(0x193))return console[_0x4e075b(0x16b)](_0x4e075b(0x13b)),0x1;if(_0x1c6d5f['type']===_0x4e075b(0x17a))return console[_0x4e075b(0x16b)]('Error:\x20Cannot\x20open\x20parent\x20segment\x20with\x20this\x20command.'),console[_0x4e075b(0x16b)](_0x4e075b(0x12b)),0x1;if(!_0x1c6d5f['segmentId'])throw new SDKError(ErrorCode[_0x4e075b(0x19b)],_0x4e075b(0x15b));const _0x1e8577=getConsoleNextUrl(_0x521045['site'],_0x4e075b(0x166)+_0x1c6d5f[_0x4e075b(0x168)]+_0x4e075b(0x174)+_0x1c6d5f['segmentId']);return console[_0x4e075b(0x16b)](a27_0x4e2542['green']('✔')+_0x4e075b(0x1a6)+a27_0x4e2542[_0x4e075b(0x13f)](_0x1e8577)),openBrowser(_0x1e8577),0x0;}if(_0x1c6d5f[_0x4e075b(0x196)]===_0x4e075b(0x193)){if(!_0x1c6d5f[_0x4e075b(0x18c)])throw new SDKError(ErrorCode[_0x4e075b(0x192)],_0x4e075b(0x149));const _0xe78f5d=await withSpinner(_0x4e075b(0x13c),()=>_0x1530fe[_0x4e075b(0x16d)][_0x4e075b(0x144)](_0x1c6d5f[_0x4e075b(0x18c)]),{'verbose':_0x521045[_0x4e075b(0x17d)]});await handleSingleObjectOutput(_0xe78f5d[_0x4e075b(0x135)],_0x521045);}else{if(_0x1c6d5f[_0x4e075b(0x196)]==='segment'){if(!_0x1c6d5f['segmentId'])throw new SDKError(ErrorCode[_0x4e075b(0x19b)],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x1cd190=await withSpinner(_0x4e075b(0x1a5),()=>_0x1530fe[_0x4e075b(0x16d)]['getSegment'](_0x1c6d5f[_0x4e075b(0x168)],_0x1c6d5f[_0x4e075b(0x163)]),{'verbose':_0x521045[_0x4e075b(0x17d)]}),_0x47b063=getConsoleNextUrl(_0x521045[_0x4e075b(0x19c)],_0x4e075b(0x166)+_0x1c6d5f[_0x4e075b(0x168)]+_0x4e075b(0x174)+_0x1c6d5f[_0x4e075b(0x163)]),_0x717a56=_0x1cd190['data'];_0x717a56['url']=_0x47b063,await handleSingleObjectOutput(_0x717a56,_0x521045);}else return console[_0x4e075b(0x16b)](_0x4e075b(0x1b7)),console['error']('Use:\x20tdx\x20ps\x20view'),0x1;}return 0x0;}catch(_0x20e2a9){if(_0x20e2a9 instanceof SDKError)return console[_0x4e075b(0x16b)](_0x4e075b(0x133)+_0x20e2a9['message']),_0x20e2a9[_0x4e075b(0x160)]&&console[_0x4e075b(0x16b)](_0x4e075b(0x12e)+_0x20e2a9[_0x4e075b(0x160)]),0x1;throw _0x20e2a9;}}}export const SegmentInfoCommand=SegmentViewCommand;export class SegmentDescCommand extends BaseCommand{[a27_0x59a4f0(0x1ad)]=a27_0x59a4f0(0x187);[a27_0x59a4f0(0x12c)]=a27_0x59a4f0(0x158);async['execute'](_0x18b444){const _0x53f0c5=a27_0x59a4f0,{options:_0x13d429,args:_0x45185d,tdx:_0x59b287}=_0x18b444,_0x234806=_0x45185d[0x0];if(!_0x234806)return console[_0x53f0c5(0x16b)](_0x53f0c5(0x136)),console[_0x53f0c5(0x16b)]('Usage:\x20tdx\x20sg\x20desc\x20<name>'),console[_0x53f0c5(0x16b)]('\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20desc\x20<path/to/segment.yml>'),console[_0x53f0c5(0x16b)]('Examples:'),console[_0x53f0c5(0x16b)]('\x20\x20tdx\x20sg\x20desc\x20\x22Premium\x20Users\x22'),console[_0x53f0c5(0x16b)](_0x53f0c5(0x1a2)),0x1;try{const _0x19bb3c=_0x13d429[_0x53f0c5(0x154)],_0x252691=await resolveSegmentTarget(_0x234806,_0x19bb3c,_0x13d429[_0x53f0c5(0x17d)]);_0x13d429[_0x53f0c5(0x17d)]&&console[_0x53f0c5(0x16b)](_0x53f0c5(0x197)+_0x252691);const _0x55a0e9=await withSpinner(_0x53f0c5(0x1ae)+_0x234806+'\x27...',()=>_0x59b287[_0x53f0c5(0x16d)][_0x53f0c5(0x1af)](_0x252691),{'verbose':_0x13d429['verbose']}),_0x1cbe1f=_0x55a0e9['data'];_0x13d429[_0x53f0c5(0x17d)]&&(console[_0x53f0c5(0x16b)](_0x53f0c5(0x185)+_0x1cbe1f[_0x53f0c5(0x196)]),console[_0x53f0c5(0x16b)]('Parent\x20ID:\x20'+_0x1cbe1f[_0x53f0c5(0x168)]));if(_0x1cbe1f[_0x53f0c5(0x196)]===_0x53f0c5(0x193))return console[_0x53f0c5(0x16b)](_0x53f0c5(0x175)),console['error'](_0x53f0c5(0x1b0)),0x1;if(_0x1cbe1f['type']===_0x53f0c5(0x17a))return console[_0x53f0c5(0x16b)](_0x53f0c5(0x13e)),console[_0x53f0c5(0x16b)](_0x53f0c5(0x129)),0x1;if(!_0x1cbe1f[_0x53f0c5(0x163)])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x53f0c5(0x15b));const _0x551450=await withSpinner(_0x53f0c5(0x12f),()=>_0x59b287[_0x53f0c5(0x16d)]['getSegmentSQL'](_0x1cbe1f[_0x53f0c5(0x168)],_0x1cbe1f[_0x53f0c5(0x163)]),{'verbose':_0x13d429[_0x53f0c5(0x17d)]}),_0x1cfade=_0x551450[_0x53f0c5(0x135)],_0x1b0b5c=await executeSchemaQuery(_0x1cfade,_0x59b287,_0x13d429);return await handleQueryOutput(_0x1b0b5c,_0x13d429),0x0;}catch(_0x3b3d69){if(_0x3b3d69 instanceof SDKError)return console[_0x53f0c5(0x16b)](_0x53f0c5(0x133)+_0x3b3d69['message']),_0x3b3d69[_0x53f0c5(0x160)]&&console['error'](_0x53f0c5(0x12e)+_0x3b3d69['cause']),0x1;throw _0x3b3d69;}}}
@@ -1 +1 @@
1
- const a28_0x5c33d6=a28_0x21af;(function(_0xe2a1ce,_0x10a397){const _0x1ea3dd=a28_0x21af,_0xefcace=_0xe2a1ce();while(!![]){try{const _0x5ad669=parseInt(_0x1ea3dd(0x156))/0x1+-parseInt(_0x1ea3dd(0x160))/0x2+-parseInt(_0x1ea3dd(0x178))/0x3+parseInt(_0x1ea3dd(0x168))/0x4+-parseInt(_0x1ea3dd(0x169))/0x5*(parseInt(_0x1ea3dd(0x17b))/0x6)+parseInt(_0x1ea3dd(0x162))/0x7*(parseInt(_0x1ea3dd(0x165))/0x8)+parseInt(_0x1ea3dd(0x15a))/0x9;if(_0x5ad669===_0x10a397)break;else _0xefcace['push'](_0xefcace['shift']());}catch(_0x5580e7){_0xefcace['push'](_0xefcace['shift']());}}}(a28_0x585f,0x37b61));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';function a28_0x21af(_0x51ce12,_0x2416cc){_0x51ce12=_0x51ce12-0x14a;const _0x585f97=a28_0x585f();let _0x21af78=_0x585f97[_0x51ce12];return _0x21af78;}import{parsePath,getParentPath,getBaseName}from'../sdk/segment/segment-path-parser.js';import a28_0x263b0c from'chalk';export class SegmentCreateCommand extends BaseCommand{[a28_0x5c33d6(0x17c)]='segment:create';[a28_0x5c33d6(0x15f)]=a28_0x5c33d6(0x14d);async[a28_0x5c33d6(0x170)](_0xa0306a){const _0x3a4a68=a28_0x5c33d6;console[_0x3a4a68(0x16b)](a28_0x263b0c[_0x3a4a68(0x164)](_0x3a4a68(0x159))),console[_0x3a4a68(0x16b)](a28_0x263b0c[_0x3a4a68(0x164)](_0x3a4a68(0x14e)));const {options:_0x1235a2,args:_0x5ddea2,tdx:_0x1059e7}=_0xa0306a,_0xb23c6a=_0x1235a2;if(_0x5ddea2[_0x3a4a68(0x179)]===0x0)return console[_0x3a4a68(0x16b)](_0x3a4a68(0x16f)),console[_0x3a4a68(0x16b)](_0x3a4a68(0x174)),console[_0x3a4a68(0x16b)](_0x3a4a68(0x175)),console[_0x3a4a68(0x16b)](_0x3a4a68(0x176)),console[_0x3a4a68(0x16b)](_0x3a4a68(0x153)),console[_0x3a4a68(0x16b)](_0x3a4a68(0x167)),0x1;const _0x5324e7=_0x5ddea2[0x0],_0x74e769=_0x1235a2[_0x3a4a68(0x154)];let _0x26c84c=_0x5324e7;_0x74e769&&!_0x5324e7[_0x3a4a68(0x150)]('/')&&(_0x26c84c=_0x74e769+'/'+_0x5324e7,_0xb23c6a[_0x3a4a68(0x155)]&&console['error'](_0x3a4a68(0x157)+_0x26c84c));const _0x3024ca=parsePath(_0x26c84c);if(_0x3024ca[_0x3a4a68(0x17e)]['length']<0x2)return console[_0x3a4a68(0x16b)](_0x3a4a68(0x177)),console[_0x3a4a68(0x16b)](_0x3a4a68(0x15d)),0x1;const _0x402bb8=_0x3024ca['segments'][0x0],_0x4d4d02=getBaseName(_0x26c84c),_0xb52e90=getParentPath(_0x26c84c);_0xb23c6a['verbose']&&(console[_0x3a4a68(0x16b)](_0x3a4a68(0x14a)+_0xb23c6a[_0x3a4a68(0x16c)]),console[_0x3a4a68(0x16b)](_0x3a4a68(0x172)+_0x26c84c),console['error']('Parent:\x20'+_0x402bb8),console['error'](_0x3a4a68(0x14f)+_0x4d4d02),console[_0x3a4a68(0x16b)](_0x3a4a68(0x16d)+_0xb52e90));const _0x4ed7b1=await withSpinner(_0x3a4a68(0x17d)+_0x402bb8+_0x3a4a68(0x15b),()=>_0x1059e7[_0x3a4a68(0x158)]['resolveParentId'](_0x402bb8),{'verbose':_0xb23c6a[_0x3a4a68(0x155)]}),_0x2dd00b=_0x4ed7b1['data'];let _0x580b9c;if(_0x3024ca[_0x3a4a68(0x17e)]['length']>0x2){const _0x149379=await withSpinner('Resolving\x20folder\x20path\x20\x27'+_0xb52e90+_0x3a4a68(0x15b),()=>_0x1059e7[_0x3a4a68(0x158)][_0x3a4a68(0x152)](_0xb52e90),{'verbose':_0xb23c6a[_0x3a4a68(0x155)]}),_0x570722=_0x149379[_0x3a4a68(0x15e)];if(_0x570722['type']!==_0x3a4a68(0x173)&&_0x570722['type']!==_0x3a4a68(0x14b))return console[_0x3a4a68(0x16b)](_0x3a4a68(0x17a)),0x1;_0x580b9c=_0x570722[_0x3a4a68(0x151)];}else{if(_0xb23c6a[_0x3a4a68(0x173)]){const _0x400cac=await withSpinner(_0x3a4a68(0x171)+_0xb23c6a['folder']+'\x27...',()=>_0x1059e7[_0x3a4a68(0x158)][_0x3a4a68(0x14c)](_0x2dd00b,_0xb23c6a[_0x3a4a68(0x173)]),{'verbose':_0xb23c6a[_0x3a4a68(0x155)]});_0x580b9c=_0x400cac[_0x3a4a68(0x15e)];}}_0xb23c6a[_0x3a4a68(0x155)]&&_0x580b9c&&console['error'](_0x3a4a68(0x161)+_0x580b9c);const _0x4efae4=await loadJSONFromOptions(_0xb23c6a['rule'],_0xb23c6a[_0x3a4a68(0x15c)]),_0x5c2f50={'name':_0x4d4d02,'description':_0xb23c6a['description'],'rule':_0x4efae4,'kind':_0xb23c6a[_0x3a4a68(0x16e)]!==undefined?parseInt(_0xb23c6a[_0x3a4a68(0x16e)],0xa):undefined,'isVisible':_0xb23c6a['invisible']?![]:undefined,'segmentFolderId':_0x580b9c,'countPopulation':_0xb23c6a[_0x3a4a68(0x16a)]?![]:undefined},_0x3e5330=await withSpinner('Creating\x20segment\x20\x27'+_0x4d4d02+_0x3a4a68(0x15b),()=>_0x1059e7[_0x3a4a68(0x158)][_0x3a4a68(0x166)](_0x2dd00b,_0x5c2f50),{'verbose':_0xb23c6a[_0x3a4a68(0x155)]}),_0x23898b=_0x3e5330[_0x3a4a68(0x15e)];return console[_0x3a4a68(0x16b)](_0x3a4a68(0x163)+_0x23898b[_0x3a4a68(0x17c)]+'\x27\x20with\x20ID:\x20'+_0x23898b['id']),_0x26c84c!==_0x5324e7&&console[_0x3a4a68(0x16b)]('\x20\x20\x20Path:\x20'+_0x26c84c),await handleSDKOutput([_0x23898b],_0xb23c6a),0x0;}}function a28_0x585f(){const _0x2c894b=['kind','Error:\x20Segment\x20path\x20or\x20name\x20is\x20required','execute','Resolving\x20folder\x20\x27','Target\x20path:\x20','folder','Usage:\x20tdx\x20segment\x20create\x20<path>\x20[options]','Examples:','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/High\x20Value\x22\x20--rule\x20\x27...\x27','Error:\x20Full\x20path\x20required\x20(parent/segment_name\x20or\x20parent/folder/segment_name)','739404yOTMkq','length','Error:\x20Cannot\x20create\x20segment\x20in\x20a\x20segment.\x20Parent\x20path\x20must\x20be\x20a\x20folder\x20or\x20parent.','6VCKkFO','name','Resolving\x20parent\x20segment\x20\x27','segments','Site:\x20','parent','resolveFolderId','Create\x20child\x20segment\x20with\x20filtering\x20rules','\x20\x20Use\x20`tdx\x20sg\x20push`\x20with\x20YAML\x20files\x20instead.\x0a','Segment\x20name:\x20','includes','folderId','resolvePathToResource','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/Marketing/Premium\x22\x20--rule\x20\x27...\x27','segmentPath','verbose','393859XLkYiX','Resolved\x20relative\x20path\x20to:\x20','segment','⚠\x20Deprecation\x20warning:\x20`segment\x20create`\x20is\x20deprecated.','5594544VSvuNY','\x27...','ruleFile','Usage:\x20tdx\x20segment\x20create\x20<parent/segment_name>\x20[options]','data','description','864160UnOrYX','Resolved\x20folder\x20ID:\x20','77CTEZWr','✔\x20Created\x20segment\x20\x27','yellow','13688XoTxaM','createSegment','\x20\x20tdx\x20segment\x20create\x20\x22Premium\x22\x20--rule\x20\x27...\x27\x20\x20#\x20Relative\x20to\x20context','1300012SSXAsr','2262790gyUzzD','noCountPopulation','error','site','Parent\x20path:\x20'];a28_0x585f=function(){return _0x2c894b;};return a28_0x585f();}
1
+ const a28_0x28a9eb=a28_0x236a;(function(_0x2402b4,_0x5cae3d){const _0x1ff8d0=a28_0x236a,_0x59fe98=_0x2402b4();while(!![]){try{const _0x363685=parseInt(_0x1ff8d0(0x13e))/0x1+parseInt(_0x1ff8d0(0x13f))/0x2*(parseInt(_0x1ff8d0(0x140))/0x3)+-parseInt(_0x1ff8d0(0x11d))/0x4*(parseInt(_0x1ff8d0(0x12f))/0x5)+parseInt(_0x1ff8d0(0x130))/0x6+parseInt(_0x1ff8d0(0x12c))/0x7*(parseInt(_0x1ff8d0(0x11a))/0x8)+-parseInt(_0x1ff8d0(0x132))/0x9+-parseInt(_0x1ff8d0(0x135))/0xa*(parseInt(_0x1ff8d0(0x11b))/0xb);if(_0x363685===_0x5cae3d)break;else _0x59fe98['push'](_0x59fe98['shift']());}catch(_0xb2ee94){_0x59fe98['push'](_0x59fe98['shift']());}}}(a28_0x3a64,0x89b7f));import{BaseCommand}from'./command.js';function a28_0x3a64(){const _0x1fb8f7=['segments','Parent:\x20','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/High\x20Value\x22\x20--rule\x20\x27...\x27','resolveFolderId','Error:\x20Full\x20path\x20required\x20(parent/segment_name\x20or\x20parent/folder/segment_name)','\x20\x20\x20Path:\x20','1107651NdbSvB','13080XLwFvk','444JYkNQt','Resolving\x20folder\x20path\x20\x27','Parent\x20path:\x20','Examples:','✔\x20Created\x20segment\x20\x27','includes','yellow','Target\x20path:\x20','\x20\x20tdx\x20segment\x20create\x20\x22Premium\x22\x20--rule\x20\x27...\x27\x20\x20#\x20Relative\x20to\x20context','kind','Resolved\x20relative\x20path\x20to:\x20','Site:\x20','type','resolvePathToResource','execute','112216odZYzP','11cptvcP','data','1642444DyxzHc','folder','⚠\x20Deprecation\x20warning:\x20`segment\x20create`\x20is\x20deprecated.','noCountPopulation','Create\x20child\x20segment\x20with\x20filtering\x20rules','rule','\x27\x20with\x20ID:\x20','\x27...','length','Resolved\x20folder\x20ID:\x20','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/Marketing/Premium\x22\x20--rule\x20\x27...\x27','verbose','Usage:\x20tdx\x20segment\x20create\x20<path>\x20[options]','resolveParentId','Segment\x20name:\x20','350vgpwro','createSegment','segment','5JPMxyk','2162598aFQsCB','segmentPath','934344lkKNkh','Creating\x20segment\x20\x27','error','20588320kPxpmr','description','Resolving\x20parent\x20segment\x20\x27'];a28_0x3a64=function(){return _0x1fb8f7;};return a28_0x3a64();}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';function a28_0x236a(_0x202bb1,_0x2837c1){_0x202bb1=_0x202bb1-0x116;const _0x3a645b=a28_0x3a64();let _0x236a83=_0x3a645b[_0x202bb1];return _0x236a83;}import a28_0x49ed77 from'chalk';export class SegmentCreateCommand extends BaseCommand{['name']='segment:create';[a28_0x28a9eb(0x136)]=a28_0x28a9eb(0x121);async[a28_0x28a9eb(0x119)](_0x5eedc2){const _0x13a09c=a28_0x28a9eb;console['error'](a28_0x49ed77['yellow'](_0x13a09c(0x11f))),console[_0x13a09c(0x134)](a28_0x49ed77[_0x13a09c(0x146)]('\x20\x20Use\x20`tdx\x20sg\x20push`\x20with\x20YAML\x20files\x20instead.\x0a'));const {options:_0x55988e,args:_0x49e820,tdx:_0xa525cd}=_0x5eedc2,_0x2d9ec8=_0x55988e;if(_0x49e820[_0x13a09c(0x125)]===0x0)return console[_0x13a09c(0x134)]('Error:\x20Segment\x20path\x20or\x20name\x20is\x20required'),console['error'](_0x13a09c(0x129)),console['error'](_0x13a09c(0x143)),console['error'](_0x13a09c(0x13a)),console[_0x13a09c(0x134)](_0x13a09c(0x127)),console[_0x13a09c(0x134)](_0x13a09c(0x148)),0x1;const _0x463e72=_0x49e820[0x0],_0x20e718=_0x55988e[_0x13a09c(0x131)];let _0x596c39=_0x463e72;_0x20e718&&!_0x463e72[_0x13a09c(0x145)]('/')&&(_0x596c39=_0x20e718+'/'+_0x463e72,_0x2d9ec8['verbose']&&console[_0x13a09c(0x134)](_0x13a09c(0x14a)+_0x596c39));const _0x5b1f18=parsePath(_0x596c39);if(_0x5b1f18[_0x13a09c(0x138)][_0x13a09c(0x125)]<0x2)return console[_0x13a09c(0x134)](_0x13a09c(0x13c)),console[_0x13a09c(0x134)]('Usage:\x20tdx\x20segment\x20create\x20<parent/segment_name>\x20[options]'),0x1;const _0x57ab4c=_0x5b1f18[_0x13a09c(0x138)][0x0],_0x9616cc=getBaseName(_0x596c39),_0x3febea=getParentPath(_0x596c39);_0x2d9ec8['verbose']&&(console[_0x13a09c(0x134)](_0x13a09c(0x116)+_0x2d9ec8['site']),console[_0x13a09c(0x134)](_0x13a09c(0x147)+_0x596c39),console['error'](_0x13a09c(0x139)+_0x57ab4c),console['error'](_0x13a09c(0x12b)+_0x9616cc),console[_0x13a09c(0x134)](_0x13a09c(0x142)+_0x3febea));const _0x4a00bb=await withSpinner(_0x13a09c(0x137)+_0x57ab4c+_0x13a09c(0x124),()=>_0xa525cd[_0x13a09c(0x12e)][_0x13a09c(0x12a)](_0x57ab4c),{'verbose':_0x2d9ec8[_0x13a09c(0x128)]}),_0x4309e3=_0x4a00bb['data'];let _0x5567e4;if(_0x5b1f18['segments'][_0x13a09c(0x125)]>0x2){const _0xc6bbf8=await withSpinner(_0x13a09c(0x141)+_0x3febea+'\x27...',()=>_0xa525cd['segment'][_0x13a09c(0x118)](_0x3febea),{'verbose':_0x2d9ec8['verbose']}),_0x27964b=_0xc6bbf8['data'];if(_0x27964b[_0x13a09c(0x117)]!==_0x13a09c(0x11e)&&_0x27964b['type']!=='parent')return console['error']('Error:\x20Cannot\x20create\x20segment\x20in\x20a\x20segment.\x20Parent\x20path\x20must\x20be\x20a\x20folder\x20or\x20parent.'),0x1;_0x5567e4=_0x27964b['folderId'];}else{if(_0x2d9ec8[_0x13a09c(0x11e)]){const _0x47af2a=await withSpinner('Resolving\x20folder\x20\x27'+_0x2d9ec8[_0x13a09c(0x11e)]+_0x13a09c(0x124),()=>_0xa525cd[_0x13a09c(0x12e)][_0x13a09c(0x13b)](_0x4309e3,_0x2d9ec8[_0x13a09c(0x11e)]),{'verbose':_0x2d9ec8['verbose']});_0x5567e4=_0x47af2a[_0x13a09c(0x11c)];}}_0x2d9ec8[_0x13a09c(0x128)]&&_0x5567e4&&console[_0x13a09c(0x134)](_0x13a09c(0x126)+_0x5567e4);const _0x207dca=await loadJSONFromOptions(_0x2d9ec8[_0x13a09c(0x122)],_0x2d9ec8['ruleFile']),_0x495ba0={'name':_0x9616cc,'description':_0x2d9ec8[_0x13a09c(0x136)],'rule':_0x207dca,'kind':_0x2d9ec8['kind']!==undefined?parseInt(_0x2d9ec8[_0x13a09c(0x149)],0xa):undefined,'isVisible':_0x2d9ec8['invisible']?![]:undefined,'segmentFolderId':_0x5567e4,'countPopulation':_0x2d9ec8[_0x13a09c(0x120)]?![]:undefined},_0x37a7cc=await withSpinner(_0x13a09c(0x133)+_0x9616cc+_0x13a09c(0x124),()=>_0xa525cd['segment'][_0x13a09c(0x12d)](_0x4309e3,_0x495ba0),{'verbose':_0x2d9ec8['verbose']}),_0x1515dc=_0x37a7cc[_0x13a09c(0x11c)];return console[_0x13a09c(0x134)](_0x13a09c(0x144)+_0x1515dc['name']+_0x13a09c(0x123)+_0x1515dc['id']),_0x596c39!==_0x463e72&&console[_0x13a09c(0x134)](_0x13a09c(0x13d)+_0x596c39),await handleSDKOutput([_0x1515dc],_0x2d9ec8),0x0;}}
@@ -1 +1 @@
1
- const a29_0x35828d=a29_0x2a46;(function(_0x4ee9a1,_0x251283){const _0x3bf31e=a29_0x2a46,_0x53ece5=_0x4ee9a1();while(!![]){try{const _0x47969d=-parseInt(_0x3bf31e(0xcb))/0x1*(parseInt(_0x3bf31e(0xd8))/0x2)+parseInt(_0x3bf31e(0xc9))/0x3+-parseInt(_0x3bf31e(0xd3))/0x4+parseInt(_0x3bf31e(0xdc))/0x5*(parseInt(_0x3bf31e(0xd9))/0x6)+-parseInt(_0x3bf31e(0xdd))/0x7*(parseInt(_0x3bf31e(0xd7))/0x8)+-parseInt(_0x3bf31e(0xcc))/0x9*(parseInt(_0x3bf31e(0xca))/0xa)+parseInt(_0x3bf31e(0xd1))/0xb;if(_0x47969d===_0x251283)break;else _0x53ece5['push'](_0x53ece5['shift']());}catch(_0x1c3c24){_0x53ece5['push'](_0x53ece5['shift']());}}}(a29_0x58e6,0xba47f));function a29_0x2a46(_0x3b88c6,_0x580cdc){_0x3b88c6=_0x3b88c6-0xc4;const _0x58e634=a29_0x58e6();let _0x2a46eb=_0x58e634[_0x3b88c6];return _0x2a46eb;}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 a29_0x58e6(){const _0x411061=['description','name','\x20field','segment','error','execute','1740678OdwmBV','30KQrIyp','1UMPjDr','1978821QHkMXQ','List\x20available\x20fields\x20for\x20segmentation','length','verbose','✔\x20Found\x20','38090492UXbAIS','data','4355328mzswdD','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','parentSegment','listFields','3775984bJnvzM','1808486TXIUtz','138oVbvFh','jsonl','Site:\x20','68845IMTDdu','14dOTJoM'];a29_0x58e6=function(){return _0x411061;};return a29_0x58e6();}export class SegmentFieldsCommand extends BaseCommand{[a29_0x35828d(0xc4)]='segment:fields';[a29_0x35828d(0xde)]=a29_0x35828d(0xcd);async[a29_0x35828d(0xc8)](_0x33dafa){const _0x57b3eb=a29_0x35828d,{options:_0x1bc9e8,args:_0x1bc147,tdx:_0x5a51e2}=_0x33dafa,_0x2df112=_0x1bc147[0x0]||_0x1bc9e8[_0x57b3eb(0xd5)];if(!_0x2df112)return console[_0x57b3eb(0xc7)]('Error:\x20Parent\x20segment\x20name\x20is\x20required'),console[_0x57b3eb(0xc7)]('Usage:\x20tdx\x20segment\x20fields\x20<parent_name>'),console[_0x57b3eb(0xc7)](_0x57b3eb(0xd4)),0x1;_0x1bc9e8[_0x57b3eb(0xcf)]&&(console[_0x57b3eb(0xc7)](_0x57b3eb(0xdb)+_0x1bc9e8['site']),console[_0x57b3eb(0xc7)]('Parent\x20segment:\x20'+_0x2df112));const _0x5c1780=await withSpinner('Listing\x20fields\x20for\x20\x27'+_0x2df112+'\x27...',()=>_0x5a51e2[_0x57b3eb(0xc6)][_0x57b3eb(0xd6)](_0x2df112),{'verbose':_0x1bc9e8[_0x57b3eb(0xcf)]}),_0x1d6a56=_0x5c1780[_0x57b3eb(0xd2)];console['error'](_0x57b3eb(0xd0)+_0x1d6a56[_0x57b3eb(0xce)]+_0x57b3eb(0xc5)+(_0x1d6a56[_0x57b3eb(0xce)]!==0x1?'s':''));if(_0x1bc9e8['json']||_0x1bc9e8[_0x57b3eb(0xda)])return await handleSDKOutput(_0x1d6a56,_0x1bc9e8),0x0;return displayFieldsHumanReadable(_0x1d6a56,_0x2df112),0x0;}}
1
+ const a29_0x5f0554=a29_0x37c8;(function(_0x32b536,_0x25b509){const _0x1f9de6=a29_0x37c8,_0x350471=_0x32b536();while(!![]){try{const _0x4246f0=-parseInt(_0x1f9de6(0x18f))/0x1+parseInt(_0x1f9de6(0x198))/0x2*(parseInt(_0x1f9de6(0x18b))/0x3)+parseInt(_0x1f9de6(0x190))/0x4*(parseInt(_0x1f9de6(0x18d))/0x5)+-parseInt(_0x1f9de6(0x19a))/0x6+-parseInt(_0x1f9de6(0x191))/0x7*(-parseInt(_0x1f9de6(0x18e))/0x8)+-parseInt(_0x1f9de6(0x189))/0x9*(-parseInt(_0x1f9de6(0x194))/0xa)+parseInt(_0x1f9de6(0x192))/0xb*(-parseInt(_0x1f9de6(0x19b))/0xc);if(_0x4246f0===_0x25b509)break;else _0x350471['push'](_0x350471['shift']());}catch(_0x35b308){_0x350471['push'](_0x350471['shift']());}}}(a29_0x3817,0xe8e64));import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';function a29_0x37c8(_0x400371,_0x4c288a){_0x400371=_0x400371-0x181;const _0x3817e2=a29_0x3817();let _0x37c825=_0x3817e2[_0x400371];return _0x37c825;}function a29_0x3817(){const _0x2cd653=['✔\x20Found\x20','Error:\x20Parent\x20segment\x20name\x20is\x20required','length','4126770AxsPRF','parentSegment','60891PPysgA','json','11130UgHOkV','16IzVGot','407049oHZDHJ','2572jYvyRR','5383889gBIfyK','131098JOiVwO','data','30NVhEyo','listFields','Site:\x20','verbose','102kClyfp','jsonl','3879060RdRote','3396IYVVqL','List\x20available\x20fields\x20for\x20segmentation','name','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','site','error'];a29_0x3817=function(){return _0x2cd653;};return a29_0x3817();}import{displayFieldsHumanReadable}from'../sdk/segment/fields-display.js';export class SegmentFieldsCommand extends BaseCommand{[a29_0x5f0554(0x182)]='segment:fields';['description']=a29_0x5f0554(0x181);async['execute'](_0x4032ef){const _0x28d3b=a29_0x5f0554,{options:_0x57bc83,args:_0x17f1ba,tdx:_0x2953cc}=_0x4032ef,_0x21d960=_0x17f1ba[0x0]||_0x57bc83[_0x28d3b(0x18a)];if(!_0x21d960)return console['error'](_0x28d3b(0x187)),console[_0x28d3b(0x185)]('Usage:\x20tdx\x20segment\x20fields\x20<parent_name>'),console['error'](_0x28d3b(0x183)),0x1;_0x57bc83[_0x28d3b(0x197)]&&(console[_0x28d3b(0x185)](_0x28d3b(0x196)+_0x57bc83[_0x28d3b(0x184)]),console[_0x28d3b(0x185)]('Parent\x20segment:\x20'+_0x21d960));const _0x16d30d=await withSpinner('Listing\x20fields\x20for\x20\x27'+_0x21d960+'\x27...',()=>_0x2953cc['segment'][_0x28d3b(0x195)](_0x21d960),{'verbose':_0x57bc83[_0x28d3b(0x197)]}),_0x176440=_0x16d30d[_0x28d3b(0x193)];console['error'](_0x28d3b(0x186)+_0x176440[_0x28d3b(0x188)]+'\x20field'+(_0x176440[_0x28d3b(0x188)]!==0x1?'s':''));if(_0x57bc83[_0x28d3b(0x18c)]||_0x57bc83[_0x28d3b(0x199)])return await handleSDKOutput(_0x176440,_0x57bc83),0x0;return displayFieldsHumanReadable(_0x176440,_0x21d960),0x0;}}
@@ -1 +1 @@
1
- const a30_0x5e4cff=a30_0x59a9;(function(_0x2927f3,_0x25945b){const _0x5fdd57=a30_0x59a9,_0x5d6019=_0x2927f3();while(!![]){try{const _0x4e0bff=parseInt(_0x5fdd57(0x1f7))/0x1*(parseInt(_0x5fdd57(0x21a))/0x2)+-parseInt(_0x5fdd57(0x1e9))/0x3*(-parseInt(_0x5fdd57(0x1ee))/0x4)+parseInt(_0x5fdd57(0x213))/0x5*(-parseInt(_0x5fdd57(0x1ed))/0x6)+-parseInt(_0x5fdd57(0x1f2))/0x7+parseInt(_0x5fdd57(0x20e))/0x8+-parseInt(_0x5fdd57(0x1fa))/0x9*(-parseInt(_0x5fdd57(0x1df))/0xa)+-parseInt(_0x5fdd57(0x1e7))/0xb;if(_0x4e0bff===_0x25945b)break;else _0x5d6019['push'](_0x5d6019['shift']());}catch(_0x518ff7){_0x5d6019['push'](_0x5d6019['shift']());}}}(a30_0x47e3,0xd7346));import{BaseCommand}from'./command.js';function a30_0x47e3(){const _0x4862ea=['cwd','Site:\x20','helpText','utf-8','length','journeyVersions','✔\x20Context\x20set:\x20','Pulling\x20segments\x20from\x20\x27','✔\x20All\x20files\x20are\x20up\x20to\x20date','execute','\x20changed\x20files','absolutePath','parent_segment','\x20versions)','type','red','files','12123610MNkrRt','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20pull\x20<file_path>\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20segment\x20file','yellow','\x20files?','Target\x20resource:\x20','dim','\x0a[Dry\x20run]\x20No\x20files\x20were\x20written','parentName','3531077FJQJdJ','verbose','543ZHmTRX','Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode','parentSegment','segment','10548xGKvOT','33364AHbbBR','\x20activations','counts','segments','11765229jdiFfL','data','Error:\x20','dryRun','Aborted.','8039MqxFlr','\x0aError:','file','9TbbLxx','setPhase','✔\x20Pulled\x20','activations','session','repeat','\x20journeys','description','journeys','segment:pull','filter','\x20unchanged\x20files','hasChanges','\x20new\x20files','green','isNew','\x20=\x20','diff','cyan','\x20segments','3066464ZuCTJP','Pull\x20child\x20segments\x20and\x20journeys\x20to\x20YAML\x20files','targetDir','errorCode','message','3970wnFhRg','\x20\x20🎯\x20','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a','yes','dirname','error','\x20\x20Target:\x20','292BrdSLB'];a30_0x47e3=function(){return _0x4862ea;};return a30_0x47e3();}import{withProgressSpinner}from'../utils/spinner.js';function a30_0x59a9(_0x9c5b14,_0x14fb3c){_0x9c5b14=_0x9c5b14-0x1ce;const _0x47e39f=a30_0x47e3();let _0x59a9f4=_0x47e39f[_0x9c5b14];return _0x59a9f4;}import{confirmKey,isInteractive}from'../utils/prompt.js';import{saveSessionContext}from'../core/session.js';import a30_0x3cd8a4 from'chalk';import{existsSync,mkdirSync,writeFileSync}from'fs';import a30_0x836f17 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']=a30_0x5e4cff(0x203);[a30_0x5e4cff(0x201)]=a30_0x5e4cff(0x20f);async[a30_0x5e4cff(0x1d7)](_0x2a2df7){const _0x482748=a30_0x5e4cff,{options:_0x18106c,args:_0x1ab4a4,tdx:_0x3a53ef}=_0x2a2df7,_0x3ec582=_0x18106c,_0x285a81=await resolveTarget({'arg':_0x1ab4a4[0x0],'contextParent':_0x18106c[_0x482748(0x1eb)],'cwd':process[_0x482748(0x1ce)]()});if(!isSuccessfulResolution(_0x285a81))return _0x285a81[_0x482748(0x211)]==='no_parent'?(console[_0x482748(0x218)](a30_0x3cd8a4[_0x482748(0x1e1)](_0x482748(0x215))),console[_0x482748(0x218)]('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[_0x482748(0x218)]('\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20pull\x20<parent_name>\x20\x20\x20\x20\x20\x20#\x20Pull\x20all\x20segments\x20from\x20parent'),console['error'](_0x482748(0x1e0))):(console['error'](a30_0x3cd8a4[_0x482748(0x1dd)](_0x482748(0x1f4)+_0x285a81[_0x482748(0x212)]+'\x0a')),_0x285a81[_0x482748(0x1d0)]&&console['error'](a30_0x3cd8a4[_0x482748(0x20c)](_0x285a81[_0x482748(0x1d0)]))),0x1;const _0x15d2ce=_0x285a81[_0x482748(0x1e6)],_0x5aa8b5=_0x285a81[_0x482748(0x210)],_0x1f7d76=_0x285a81[_0x482748(0x1dc)]===_0x482748(0x1f9)?_0x285a81['resourceName']:undefined;_0x3ec582[_0x482748(0x1e8)]&&(console['error'](_0x482748(0x1cf)+_0x3ec582['site']),console[_0x482748(0x218)]('Parent\x20segment:\x20'+_0x15d2ce),_0x1f7d76&&console['error'](_0x482748(0x1e3)+_0x1f7d76));const _0x275664=await withProgressSpinner(_0x482748(0x1d5)+_0x15d2ce+'\x27...',_0xfcea50=>_0x3a53ef[_0x482748(0x1ec)]['pullSegments'](_0x15d2ce,{'targetDir':_0x5aa8b5,'targetResourceName':_0x1f7d76,'verbose':_0x3ec582[_0x482748(0x1e8)],'progress':{'update':_0x221f70=>{const _0x17959a=_0x482748;_0xfcea50[_0x17959a(0x1fb)](_0x221f70),_0x3ec582[_0x17959a(0x1e8)]&&console[_0x17959a(0x218)]('\x20\x20'+_0x221f70);}}}),{'verbose':_0x3ec582[_0x482748(0x1e8)]}),_0xca7409=_0x275664[_0x482748(0x1f3)];if(_0xca7409[_0x482748(0x1f0)][_0x482748(0x1f1)]===0x0&&_0xca7409[_0x482748(0x1f0)][_0x482748(0x202)]===0x0)return console[_0x482748(0x218)](a30_0x3cd8a4['yellow']('No\x20segments\x20or\x20journeys\x20found\x20in\x20parent\x20segment\x20\x27'+_0xca7409[_0x482748(0x1e6)]+'\x27')),0x0;const _0x4e7d77=_0xca7409[_0x482748(0x1de)]['filter'](_0x268e60=>_0x268e60[_0x482748(0x209)]),_0x38c98e=_0xca7409[_0x482748(0x1de)][_0x482748(0x204)](_0x448fe3=>!_0x448fe3[_0x482748(0x209)]&&_0x448fe3['hasChanges']),_0x461b24=_0xca7409[_0x482748(0x1de)][_0x482748(0x204)](_0x4f75ba=>!_0x4f75ba[_0x482748(0x209)]&&!_0x4f75ba[_0x482748(0x206)]);console['error']('\x0aPull\x20summary\x20for\x20\x27'+_0xca7409['parentName']+'\x27:'),console[_0x482748(0x218)](_0x482748(0x214)+a30_0x3cd8a4[_0x482748(0x20c)](_0xca7409[_0x482748(0x1f0)]['segments']+_0x482748(0x20d))+'\x20with\x20'+a30_0x3cd8a4[_0x482748(0x20c)](_0xca7409['counts'][_0x482748(0x1fd)]+_0x482748(0x1ef)));if(_0xca7409[_0x482748(0x1f0)][_0x482748(0x202)]>0x0){const _0x3ab5d1=_0xca7409[_0x482748(0x1f0)][_0x482748(0x1d3)]>_0xca7409['counts'][_0x482748(0x202)]?'\x20('+_0xca7409[_0x482748(0x1f0)][_0x482748(0x1d3)]+_0x482748(0x1db):'';console[_0x482748(0x218)]('\x20\x20🗺️\x20\x20'+a30_0x3cd8a4['cyan'](_0xca7409[_0x482748(0x1f0)][_0x482748(0x202)]+_0x482748(0x200))+a30_0x3cd8a4[_0x482748(0x1e4)](_0x3ab5d1));}console[_0x482748(0x218)]('\x20\x20'+a30_0x3cd8a4[_0x482748(0x208)]('+\x20'+_0x4e7d77['length']+_0x482748(0x207))),console[_0x482748(0x218)]('\x20\x20'+a30_0x3cd8a4['yellow']('~\x20'+_0x38c98e[_0x482748(0x1d2)]+_0x482748(0x1d8))),console[_0x482748(0x218)]('\x20\x20'+a30_0x3cd8a4[_0x482748(0x1e4)]('=\x20'+_0x461b24[_0x482748(0x1d2)]+_0x482748(0x205))),console[_0x482748(0x218)](_0x482748(0x219)+a30_0x3cd8a4[_0x482748(0x20c)](_0xca7409['targetDir'])+'\x0a');if(_0x38c98e[_0x482748(0x1d2)]>0x0)for(const _0x25886f of _0x38c98e){console['error']('\x0aChanges\x20to\x20\x27'+_0x25886f['relativePath']+'\x27:'),console[_0x482748(0x218)]('─'[_0x482748(0x1ff)](0x3c)),console['error'](_0x25886f[_0x482748(0x20b)]),console[_0x482748(0x218)]('─'[_0x482748(0x1ff)](0x3c));}if(_0x3ec582[_0x482748(0x1f5)])return console['error'](a30_0x3cd8a4['yellow'](_0x482748(0x1e5))),0x0;if(_0x4e7d77[_0x482748(0x1d2)]===0x0&&_0x38c98e[_0x482748(0x1d2)]===0x0)return console[_0x482748(0x218)](a30_0x3cd8a4[_0x482748(0x208)](_0x482748(0x1d6))),saveSessionContext({'parent_segment':_0xca7409[_0x482748(0x1e6)]},_0x3ec582[_0x482748(0x1fe)]),console[_0x482748(0x218)](a30_0x3cd8a4[_0x482748(0x208)](_0x482748(0x1d4)+a30_0x3cd8a4[_0x482748(0x1e4)](_0x482748(0x1da))+_0x482748(0x20a)+a30_0x3cd8a4[_0x482748(0x20c)](_0xca7409[_0x482748(0x1e6)]))),0x0;if(!_0x3ec582[_0x482748(0x216)]){if(!isInteractive())return console['error'](a30_0x3cd8a4['red'](_0x482748(0x1f8)),_0x482748(0x1ea)),console[_0x482748(0x218)](a30_0x3cd8a4[_0x482748(0x1e4)]('Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation')),0x1;const _0x4b7dc3=await confirmKey('Write\x20'+(_0x4e7d77['length']+_0x38c98e['length'])+_0x482748(0x1e2));if(!_0x4b7dc3)return console[_0x482748(0x218)](a30_0x3cd8a4[_0x482748(0x1e1)](_0x482748(0x1f6)),'-\x20no\x20files\x20written'),0x1;}for(const _0x31ebb6 of _0xca7409['files']){if(_0x31ebb6[_0x482748(0x209)]||_0x31ebb6[_0x482748(0x206)]){const _0x5c582e=a30_0x836f17[_0x482748(0x217)](_0x31ebb6[_0x482748(0x1d9)]);!existsSync(_0x5c582e)&&mkdirSync(_0x5c582e,{'recursive':!![]}),writeFileSync(_0x31ebb6['absolutePath'],_0x31ebb6['content'],_0x482748(0x1d1));}}return console[_0x482748(0x218)](a30_0x3cd8a4[_0x482748(0x208)](_0x482748(0x1fc)+(_0x4e7d77[_0x482748(0x1d2)]+_0x38c98e[_0x482748(0x1d2)])+'\x20files\x20to\x20'+_0xca7409[_0x482748(0x210)])),saveSessionContext({'parent_segment':_0xca7409['parentName']},_0x3ec582['session']),console[_0x482748(0x218)](a30_0x3cd8a4[_0x482748(0x208)]('✔\x20Context\x20set:\x20'+a30_0x3cd8a4['dim'](_0x482748(0x1da))+_0x482748(0x20a)+a30_0x3cd8a4[_0x482748(0x20c)](_0xca7409[_0x482748(0x1e6)]))),0x0;}}
1
+ const a30_0xe1e985=a30_0x46bc;(function(_0x462cb1,_0x513318){const _0x2a9a19=a30_0x46bc,_0x3c48b6=_0x462cb1();while(!![]){try{const _0x12fc90=-parseInt(_0x2a9a19(0x18e))/0x1+-parseInt(_0x2a9a19(0x199))/0x2*(-parseInt(_0x2a9a19(0x1b2))/0x3)+-parseInt(_0x2a9a19(0x162))/0x4*(-parseInt(_0x2a9a19(0x18a))/0x5)+-parseInt(_0x2a9a19(0x1aa))/0x6*(-parseInt(_0x2a9a19(0x18d))/0x7)+-parseInt(_0x2a9a19(0x19b))/0x8+-parseInt(_0x2a9a19(0x164))/0x9*(parseInt(_0x2a9a19(0x178))/0xa)+-parseInt(_0x2a9a19(0x189))/0xb*(-parseInt(_0x2a9a19(0x1b0))/0xc);if(_0x12fc90===_0x513318)break;else _0x3c48b6['push'](_0x3c48b6['shift']());}catch(_0x2cecc7){_0x3c48b6['push'](_0x3c48b6['shift']());}}}(a30_0x3671,0xa1291));import{BaseCommand}from'./command.js';import{withProgressSpinner}from'../utils/spinner.js';function a30_0x46bc(_0x50419b,_0x3224a0){_0x50419b=_0x50419b-0x15f;const _0x367185=a30_0x3671();let _0x46bccd=_0x367185[_0x50419b];return _0x46bccd;}import{confirmKey,isInteractive}from'../utils/prompt.js';import{saveSessionContext}from'../core/session.js';import a30_0x5295ba from'chalk';function a30_0x3671(){const _0x3e1d36=['4424192ITjzNi','parent_segment','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a','isNew','red','\x20new\x20files','journeyVersions','\x20unchanged\x20files','dim','\x20with\x20','✔\x20All\x20files\x20are\x20up\x20to\x20date','parentName','✔\x20Pulled\x20','\x20\x20Target:\x20','\x20files\x20to\x20','11994ldlzVw','execute','message','\x0aError:','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)','errorCode','12504516xAMlgI','journeys','39978bfBOmi','Pull\x20child\x20segments\x20and\x20journeys\x20to\x20YAML\x20files','resourceName','Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation','no_parent','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20pull\x20<file_path>\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20segment\x20file','description','1658892ZHjDsR','name','18HjWpyT','utf-8','Pulling\x20segments\x20from\x20\x27','\x20=\x20','\x20activations','\x20\x20🗺️\x20\x20','segments','No\x20segments\x20or\x20journeys\x20found\x20in\x20parent\x20segment\x20\x27','Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode','absolutePath','Site:\x20','\x0aChanges\x20to\x20\x27','repeat','setPhase','segment:pull','Parent\x20segment:\x20','filter','site','\x20files?','Aborted.','965500DtPacv','Error:\x20','counts','\x20segments','verbose','error','type','targetDir','\x27...','activations','segment','cwd','\x20versions)','diff','length','dirname','\x20changed\x20files','11nogPGc','5CflkxZ','dryRun','session','14epNmQG','947369TXkuXG','files','green','helpText','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20pull\x20<parent_name>\x20\x20\x20\x20\x20\x20#\x20Pull\x20all\x20segments\x20from\x20parent','pullSegments','yellow','data','file','hasChanges','\x20\x20🎯\x20','134RSYrkJ','cyan'];a30_0x3671=function(){return _0x3e1d36;};return a30_0x3671();}import{existsSync,mkdirSync,writeFileSync}from'fs';import a30_0x12b756 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{[a30_0xe1e985(0x163)]=a30_0xe1e985(0x172);[a30_0xe1e985(0x161)]=a30_0xe1e985(0x1b3);async[a30_0xe1e985(0x1ab)](_0x2d7ae4){const _0x5483d9=a30_0xe1e985,{options:_0x10af4f,args:_0x34d877,tdx:_0x4bbd2d}=_0x2d7ae4,_0x22005d=_0x10af4f,_0x64c768=await resolveTarget({'arg':_0x34d877[0x0],'contextParent':_0x10af4f['parentSegment'],'cwd':process[_0x5483d9(0x183)]()});if(!isSuccessfulResolution(_0x64c768))return _0x64c768[_0x5483d9(0x1af)]===_0x5483d9(0x15f)?(console[_0x5483d9(0x17d)](a30_0x5295ba[_0x5483d9(0x194)](_0x5483d9(0x19d))),console[_0x5483d9(0x17d)](_0x5483d9(0x1ae)),console[_0x5483d9(0x17d)](_0x5483d9(0x192)),console['error'](_0x5483d9(0x160))):(console[_0x5483d9(0x17d)](a30_0x5295ba[_0x5483d9(0x19f)](_0x5483d9(0x179)+_0x64c768[_0x5483d9(0x1ac)]+'\x0a')),_0x64c768['helpText']&&console[_0x5483d9(0x17d)](a30_0x5295ba[_0x5483d9(0x19a)](_0x64c768[_0x5483d9(0x191)]))),0x1;const _0x28ff85=_0x64c768[_0x5483d9(0x1a6)],_0x17045b=_0x64c768[_0x5483d9(0x17f)],_0x250f6e=_0x64c768[_0x5483d9(0x17e)]===_0x5483d9(0x196)?_0x64c768[_0x5483d9(0x1b4)]:undefined;_0x22005d[_0x5483d9(0x17c)]&&(console[_0x5483d9(0x17d)](_0x5483d9(0x16e)+_0x22005d[_0x5483d9(0x175)]),console[_0x5483d9(0x17d)](_0x5483d9(0x173)+_0x28ff85),_0x250f6e&&console[_0x5483d9(0x17d)]('Target\x20resource:\x20'+_0x250f6e));const _0x321df5=await withProgressSpinner(_0x5483d9(0x166)+_0x28ff85+_0x5483d9(0x180),_0x546802=>_0x4bbd2d[_0x5483d9(0x182)][_0x5483d9(0x193)](_0x28ff85,{'targetDir':_0x17045b,'targetResourceName':_0x250f6e,'verbose':_0x22005d[_0x5483d9(0x17c)],'progress':{'update':_0x3683f7=>{const _0x2559d9=_0x5483d9;_0x546802[_0x2559d9(0x171)](_0x3683f7),_0x22005d['verbose']&&console[_0x2559d9(0x17d)]('\x20\x20'+_0x3683f7);}}}),{'verbose':_0x22005d['verbose']}),_0x398d92=_0x321df5[_0x5483d9(0x195)];if(_0x398d92[_0x5483d9(0x17a)][_0x5483d9(0x16a)]===0x0&&_0x398d92[_0x5483d9(0x17a)]['journeys']===0x0)return console[_0x5483d9(0x17d)](a30_0x5295ba['yellow'](_0x5483d9(0x16b)+_0x398d92[_0x5483d9(0x1a6)]+'\x27')),0x0;const _0x374e19=_0x398d92[_0x5483d9(0x18f)]['filter'](_0x3a3bcf=>_0x3a3bcf[_0x5483d9(0x19e)]),_0x2be636=_0x398d92[_0x5483d9(0x18f)][_0x5483d9(0x174)](_0x42d9cf=>!_0x42d9cf['isNew']&&_0x42d9cf[_0x5483d9(0x197)]),_0x550cc0=_0x398d92[_0x5483d9(0x18f)]['filter'](_0x1202fe=>!_0x1202fe[_0x5483d9(0x19e)]&&!_0x1202fe['hasChanges']);console[_0x5483d9(0x17d)]('\x0aPull\x20summary\x20for\x20\x27'+_0x398d92[_0x5483d9(0x1a6)]+'\x27:'),console[_0x5483d9(0x17d)](_0x5483d9(0x198)+a30_0x5295ba[_0x5483d9(0x19a)](_0x398d92['counts'][_0x5483d9(0x16a)]+_0x5483d9(0x17b))+_0x5483d9(0x1a4)+a30_0x5295ba['cyan'](_0x398d92[_0x5483d9(0x17a)][_0x5483d9(0x181)]+_0x5483d9(0x168)));if(_0x398d92['counts'][_0x5483d9(0x1b1)]>0x0){const _0x2325c5=_0x398d92['counts'][_0x5483d9(0x1a1)]>_0x398d92['counts'][_0x5483d9(0x1b1)]?'\x20('+_0x398d92[_0x5483d9(0x17a)][_0x5483d9(0x1a1)]+_0x5483d9(0x184):'';console[_0x5483d9(0x17d)](_0x5483d9(0x169)+a30_0x5295ba[_0x5483d9(0x19a)](_0x398d92[_0x5483d9(0x17a)][_0x5483d9(0x1b1)]+'\x20journeys')+a30_0x5295ba[_0x5483d9(0x1a3)](_0x2325c5));}console[_0x5483d9(0x17d)]('\x20\x20'+a30_0x5295ba['green']('+\x20'+_0x374e19[_0x5483d9(0x186)]+_0x5483d9(0x1a0))),console[_0x5483d9(0x17d)]('\x20\x20'+a30_0x5295ba[_0x5483d9(0x194)]('~\x20'+_0x2be636['length']+_0x5483d9(0x188))),console[_0x5483d9(0x17d)]('\x20\x20'+a30_0x5295ba[_0x5483d9(0x1a3)]('=\x20'+_0x550cc0[_0x5483d9(0x186)]+_0x5483d9(0x1a2))),console[_0x5483d9(0x17d)](_0x5483d9(0x1a8)+a30_0x5295ba[_0x5483d9(0x19a)](_0x398d92[_0x5483d9(0x17f)])+'\x0a');if(_0x2be636[_0x5483d9(0x186)]>0x0)for(const _0x99210f of _0x2be636){console[_0x5483d9(0x17d)](_0x5483d9(0x16f)+_0x99210f['relativePath']+'\x27:'),console[_0x5483d9(0x17d)]('─'[_0x5483d9(0x170)](0x3c)),console['error'](_0x99210f[_0x5483d9(0x185)]),console[_0x5483d9(0x17d)]('─'[_0x5483d9(0x170)](0x3c));}if(_0x22005d[_0x5483d9(0x18b)])return console[_0x5483d9(0x17d)](a30_0x5295ba['yellow']('\x0a[Dry\x20run]\x20No\x20files\x20were\x20written')),0x0;if(_0x374e19['length']===0x0&&_0x2be636[_0x5483d9(0x186)]===0x0)return console[_0x5483d9(0x17d)](a30_0x5295ba[_0x5483d9(0x190)](_0x5483d9(0x1a5))),saveSessionContext({'parent_segment':_0x398d92[_0x5483d9(0x1a6)]},_0x22005d[_0x5483d9(0x18c)]),console[_0x5483d9(0x17d)](a30_0x5295ba[_0x5483d9(0x190)]('✔\x20Context\x20set:\x20'+a30_0x5295ba[_0x5483d9(0x1a3)](_0x5483d9(0x19c))+_0x5483d9(0x167)+a30_0x5295ba[_0x5483d9(0x19a)](_0x398d92['parentName']))),0x0;if(!_0x22005d['yes']){if(!isInteractive())return console[_0x5483d9(0x17d)](a30_0x5295ba[_0x5483d9(0x19f)](_0x5483d9(0x1ad)),_0x5483d9(0x16c)),console[_0x5483d9(0x17d)](a30_0x5295ba[_0x5483d9(0x1a3)](_0x5483d9(0x1b5))),0x1;const _0x493158=await confirmKey('Write\x20'+(_0x374e19['length']+_0x2be636[_0x5483d9(0x186)])+_0x5483d9(0x176));if(!_0x493158)return console[_0x5483d9(0x17d)](a30_0x5295ba[_0x5483d9(0x194)](_0x5483d9(0x177)),'-\x20no\x20files\x20written'),0x1;}for(const _0x5cf4db of _0x398d92['files']){if(_0x5cf4db[_0x5483d9(0x19e)]||_0x5cf4db['hasChanges']){const _0x353e83=a30_0x12b756[_0x5483d9(0x187)](_0x5cf4db['absolutePath']);!existsSync(_0x353e83)&&mkdirSync(_0x353e83,{'recursive':!![]}),writeFileSync(_0x5cf4db[_0x5483d9(0x16d)],_0x5cf4db['content'],_0x5483d9(0x165));}}return console[_0x5483d9(0x17d)](a30_0x5295ba[_0x5483d9(0x190)](_0x5483d9(0x1a7)+(_0x374e19[_0x5483d9(0x186)]+_0x2be636[_0x5483d9(0x186)])+_0x5483d9(0x1a9)+_0x398d92[_0x5483d9(0x17f)])),saveSessionContext({'parent_segment':_0x398d92[_0x5483d9(0x1a6)]},_0x22005d[_0x5483d9(0x18c)]),console[_0x5483d9(0x17d)](a30_0x5295ba[_0x5483d9(0x190)]('✔\x20Context\x20set:\x20'+a30_0x5295ba['dim'](_0x5483d9(0x19c))+'\x20=\x20'+a30_0x5295ba['cyan'](_0x398d92['parentName']))),0x0;}}