@treasuredata/tdx 0.22.0 → 0.23.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (174) hide show
  1. package/dist/bin.js +1 -1
  2. package/dist/build-info.json +3 -3
  3. package/dist/cli-categories.js +1 -1
  4. package/dist/cli.d.ts.map +1 -1
  5. package/dist/cli.js +1 -1
  6. package/dist/cli.js.map +1 -1
  7. package/dist/commands/activations.js +1 -1
  8. package/dist/commands/agent-command.js +1 -1
  9. package/dist/commands/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.d.ts +11 -2
  27. package/dist/commands/parent-segment-command.d.ts.map +1 -1
  28. package/dist/commands/parent-segment-command.js +1 -1
  29. package/dist/commands/parent-segment-command.js.map +1 -1
  30. package/dist/commands/profile-command.js +1 -1
  31. package/dist/commands/profiles-command.js +1 -1
  32. package/dist/commands/query-command.js +1 -1
  33. package/dist/commands/schedule-command.js +1 -1
  34. package/dist/commands/segment-command.js +1 -1
  35. package/dist/commands/segment-create-command.js +1 -1
  36. package/dist/commands/segment-fields-command.js +1 -1
  37. package/dist/commands/segment-pull-command.js +1 -1
  38. package/dist/commands/segment-push-command.js +1 -1
  39. package/dist/commands/segment-update-command.js +1 -1
  40. package/dist/commands/segment-use-command.js +1 -1
  41. package/dist/commands/segment-validate-command.js +1 -1
  42. package/dist/commands/segments.js +1 -1
  43. package/dist/commands/show.js +1 -1
  44. package/dist/commands/status-command.js +1 -1
  45. package/dist/commands/tables.js +1 -1
  46. package/dist/commands/unset-command.js +1 -1
  47. package/dist/commands/use-command.js +1 -1
  48. package/dist/commands/user-command.js +1 -1
  49. package/dist/commands/workflow-command.js +1 -1
  50. package/dist/core/auth.js +1 -1
  51. package/dist/core/command-output.js +1 -1
  52. package/dist/core/config.js +1 -1
  53. package/dist/core/connection-cache.js +1 -1
  54. package/dist/core/constants.js +1 -1
  55. package/dist/core/credential-cache.js +1 -1
  56. package/dist/core/global-context.js +1 -1
  57. package/dist/core/keychain.js +1 -1
  58. package/dist/core/profile.d.ts +1 -0
  59. package/dist/core/profile.d.ts.map +1 -1
  60. package/dist/core/profile.js +1 -1
  61. package/dist/core/profile.js.map +1 -1
  62. package/dist/core/project-config.js +1 -1
  63. package/dist/core/session.js +1 -1
  64. package/dist/core/user-cache.js +1 -1
  65. package/dist/core/version.js +1 -1
  66. package/dist/index.js +1 -1
  67. package/dist/mcp/server.js +1 -1
  68. package/dist/mcp/tools/index.js +1 -1
  69. package/dist/mcp/tools/tdx-run.js +1 -1
  70. package/dist/mcp/tools/tdx-search.js +1 -1
  71. package/dist/mcp/utils.js +1 -1
  72. package/dist/proxy/claude-usage-tracker.js +1 -1
  73. package/dist/proxy/passthrough-server.js +1 -1
  74. package/dist/proxy/sse-usage-parser.js +1 -1
  75. package/dist/sdk/agent/agent-config.js +1 -1
  76. package/dist/sdk/agent/agent-ref-parser.js +1 -1
  77. package/dist/sdk/agent/agent-yaml.js +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/api.js +1 -1
  84. package/dist/sdk/client/cdp-api-client.js +1 -1
  85. package/dist/sdk/client/endpoints.js +1 -1
  86. package/dist/sdk/client/engage-api-client.js +1 -1
  87. package/dist/sdk/client/http-client.js +1 -1
  88. package/dist/sdk/client/llm-api-client.js +1 -1
  89. package/dist/sdk/client/rate-limiter.js +1 -1
  90. package/dist/sdk/client/td-api-client.js +1 -1
  91. package/dist/sdk/client/trino-api-client.js +1 -1
  92. package/dist/sdk/client/workflow-client.js +1 -1
  93. package/dist/sdk/connection-validator.js +1 -1
  94. package/dist/sdk/connection.js +1 -1
  95. package/dist/sdk/engage.js +1 -1
  96. package/dist/sdk/errors.js +1 -1
  97. package/dist/sdk/index.js +1 -1
  98. package/dist/sdk/io/index.js +1 -1
  99. package/dist/sdk/io/node-filesystem.js +1 -1
  100. package/dist/sdk/job.js +1 -1
  101. package/dist/sdk/journey.js +1 -1
  102. package/dist/sdk/llm/chat-cache.js +1 -1
  103. package/dist/sdk/llm/index.js +1 -1
  104. package/dist/sdk/llm/llm-backup-utils.js +1 -1
  105. package/dist/sdk/llm/model-factors.js +1 -1
  106. package/dist/sdk/query/index.js +1 -1
  107. package/dist/sdk/query/sql-parser.js +1 -1
  108. package/dist/sdk/schedule.js +1 -1
  109. package/dist/sdk/segment/child-segment-yaml.js +1 -1
  110. package/dist/sdk/segment/fields-display.js +1 -1
  111. package/dist/sdk/segment/file-discovery.js +1 -1
  112. package/dist/sdk/segment/journey-utils.js +1 -1
  113. package/dist/sdk/segment/journey-yaml.js +1 -1
  114. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  115. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  116. package/dist/sdk/segment/pull-workflow.js +1 -1
  117. package/dist/sdk/segment/push-workflow.js +1 -1
  118. package/dist/sdk/segment/resolution-context.js +1 -1
  119. package/dist/sdk/segment/segment-path-parser.js +1 -1
  120. package/dist/sdk/segment/segment-ref-parser.js +1 -1
  121. package/dist/sdk/segment/target-resolution.js +1 -1
  122. package/dist/sdk/segment/tdx-config.js +1 -1
  123. package/dist/sdk/segment/validate-files.js +1 -1
  124. package/dist/sdk/segment/yaml-validator.js +1 -1
  125. package/dist/sdk/segment.d.ts +24 -0
  126. package/dist/sdk/segment.d.ts.map +1 -1
  127. package/dist/sdk/segment.js +1 -1
  128. package/dist/sdk/segment.js.map +1 -1
  129. package/dist/sdk/types/index.js +1 -1
  130. package/dist/sdk/types/progress.js +1 -1
  131. package/dist/sdk/user.js +1 -1
  132. package/dist/sdk/util/format-detector.js +1 -1
  133. package/dist/sdk/util/formatters.js +1 -1
  134. package/dist/sdk/util/index.js +1 -1
  135. package/dist/sdk/util/tree-formatter.js +1 -1
  136. package/dist/sdk/workflow/archive-validation.js +1 -1
  137. package/dist/sdk/workflow/clone-workflow.js +1 -1
  138. package/dist/sdk/workflow/index.js +1 -1
  139. package/dist/sdk/workflow/pull-workflow.js +1 -1
  140. package/dist/sdk/workflow/push-workflow.js +1 -1
  141. package/dist/sdk/workflow/tdx-config.js +1 -1
  142. package/dist/sdk/workflow/workflow-utils.js +1 -1
  143. package/dist/test-utils/command-runner.js +1 -1
  144. package/dist/test-utils/factories.js +1 -1
  145. package/dist/test-utils/fixtures.js +1 -1
  146. package/dist/test-utils/http-mock.js +1 -1
  147. package/dist/test-utils/index.js +1 -1
  148. package/dist/utils/async.js +1 -1
  149. package/dist/utils/colors.js +1 -1
  150. package/dist/utils/diff.js +1 -1
  151. package/dist/utils/file-permissions.js +1 -1
  152. package/dist/utils/global-cache.js +1 -1
  153. package/dist/utils/json-loader.js +1 -1
  154. package/dist/utils/local-cache.js +1 -1
  155. package/dist/utils/logger/formatters/default-formatter.js +1 -1
  156. package/dist/utils/logger/formatters/index.js +1 -1
  157. package/dist/utils/logger/handlers/console-handler.js +1 -1
  158. package/dist/utils/logger/handlers/file-handler.js +1 -1
  159. package/dist/utils/logger/handlers/index.js +1 -1
  160. package/dist/utils/logger/handlers/null-handler.js +1 -1
  161. package/dist/utils/logger/index.js +1 -1
  162. package/dist/utils/logger/logger.js +1 -1
  163. package/dist/utils/logger/types.js +1 -1
  164. package/dist/utils/option-validation.js +1 -1
  165. package/dist/utils/port.js +1 -1
  166. package/dist/utils/process.js +1 -1
  167. package/dist/utils/prompt.js +1 -1
  168. package/dist/utils/spinner.js +1 -1
  169. package/dist/utils/sse-parser.js +1 -1
  170. package/dist/utils/string-utils.js +1 -1
  171. package/dist/utils/table-ref-parser.js +1 -1
  172. package/dist/utils/tdx-logger.js +1 -1
  173. package/dist/utils/version-check.js +1 -1
  174. package/package.json +1 -1
@@ -1 +1 @@
1
- const a23_0x5adf76=a23_0xde84;(function(_0x100a79,_0x748585){const _0x1f9c2b=a23_0xde84,_0x5b9ebf=_0x100a79();while(!![]){try{const _0x304fbb=parseInt(_0x1f9c2b(0x22a))/0x1*(parseInt(_0x1f9c2b(0x1f3))/0x2)+parseInt(_0x1f9c2b(0x24f))/0x3+parseInt(_0x1f9c2b(0x242))/0x4+-parseInt(_0x1f9c2b(0x1f8))/0x5+parseInt(_0x1f9c2b(0x1fa))/0x6*(-parseInt(_0x1f9c2b(0x20a))/0x7)+-parseInt(_0x1f9c2b(0x236))/0x8*(-parseInt(_0x1f9c2b(0x1ea))/0x9)+-parseInt(_0x1f9c2b(0x1f4))/0xa*(parseInt(_0x1f9c2b(0x219))/0xb);if(_0x304fbb===_0x748585)break;else _0x5b9ebf['push'](_0x5b9ebf['shift']());}catch(_0x802411){_0x5b9ebf['push'](_0x5b9ebf['shift']());}}}(a23_0x1182,0xabdf0));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_0x46e5b2 from'node:path';function a23_0x1182(){const _0xd0dc24=['\x20API\x20key\x20is\x20valid\x20(User:\x20','email','4727304lxSZqA','ERROR','\x20\x20-\x20','Profile\x20was\x20not\x20created.\x20Please\x20try\x20again.','\x20API\x20key\x20removed\x20from\x20system\x20keychain','select','execute','green','password','Set\x20a\x20profile\x20configuration\x20value','API\x20key\x20cannot\x20be\x20empty','yellow','tdx.json','3899436vZtlOm','other','profile:create','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','tdx:\x20profile\x20create','\x27\x20does\x20not\x20exist.\x20Create\x20it?','create','Enter\x20profile\x20name:','Select\x20Treasure\x20Data\x20site\x20for\x20profile\x20\x27','llm_project','profileName','includes','\x20API\x20key\x20saved\x20to\x20system\x20keychain','513EToIOW','Session\x20profile\x20set\x20to:\x20','Enter\x20site\x20name:','Invalid\x20format.\x20Use:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','\x0aTip:\x20Use\x20\x27tdx\x20profile\x20use\x20','length','Set\x20session\x20profile','validate','trim','46bFjprX','562490tfAFLm','status','Are\x20you\x20sure\x20you\x20want\x20to\x20remove\x20profile\x20\x27','Key=value\x20pair\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','466415asXPKf','parent_segment','199614nYeEhB','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20use\x20<name>\x20[--default]','\x0aSetup\x20cancelled','apiKey','dim','split','\x20Profile\x20\x27','name','warn','\x0aYou\x20can\x20find\x20your\x20API\x20key\x20at:','Site\x20name\x20cannot\x20be\x20empty','\x27\x20requires\x20API\x20key\x20validation.','\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.','Create\x20a\x20new\x20profile','Profile\x20\x27','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>','77cnXcay','Profile\x20name\x20must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore','customSite','Remove\x20a\x20profile','(cleared)','error','\x27\x20updated:\x20','\x20--default\x27\x20to\x20save\x20permanently','\x27\x20does\x20not\x20exist.','\x0aSetting\x20up\x20authentication\x20for\x20site:\x20','profile','text','(session:\x20','profile:remove','Operation\x20cancelled','638BXtxRa','session','description','jobs','getUserInfo','llm_agent','test','Changing\x20site\x20to\x20\x27','Site\x20was\x20not\x20changed.','red','Profile\x20name\x20cannot\x20be\x20empty','\x20\x20tdx\x20--profile\x20','default','\x0aAvailable\x20profiles:','\x0aOperation\x20cancelled','bold','message','47307aqnGNz','Validating\x20API\x20key...','✗\x20Validation\x20failed:\x20','logLevel','\x0aSaved\x20to:\x20','profile:set','\x20\x20(no\x20profiles\x20found)','\x27\x20already\x20exists.\x20Use\x20\x27tdx\x20profile\x20set\x27\x20to\x20modify\x20it.','\x27\x20removed\x20from\x20configuration','\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication','join','\x20API\x20key\x20saved\x20to\x20system\x20keychain\x20(profile:\x20','120136SDJJVh','Default\x20profile\x20set\x20to:\x20','Enter\x20your\x20TD\x20API\x20key:','You\x20can\x20find\x20your\x20API\x20key\x20at:','VALID_KEYS','/app/mp/ak','site','log','confirm','us01'];a23_0x1182=function(){return _0xd0dc24;};return a23_0x1182();}function a23_0xde84(_0x1cc5f4,_0x368281){_0x1cc5f4=_0x1cc5f4-0x1e0;const _0x118275=a23_0x1182();let _0xde84fa=_0x118275[_0x1cc5f4];return _0xde84fa;}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_0x1136ce from'prompts';import a23_0x2f338c from'chalk';function validateProfileName(_0x391033){const _0x48f41e=a23_0xde84;if(!_0x391033||!_0x391033['trim']())return _0x48f41e(0x223);const _0x373e8d=_0x391033[_0x48f41e(0x1f2)]();if(!/^[a-zA-Z0-9_-]+$/[_0x48f41e(0x21f)](_0x373e8d))return _0x48f41e(0x20b);if(profileExists(_0x373e8d))return _0x48f41e(0x208)+_0x373e8d+_0x48f41e(0x231);return!![];}export class ProfileCreateCommand extends BaseCommand{[a23_0x5adf76(0x201)]=a23_0x5adf76(0x251);[a23_0x5adf76(0x21b)]=a23_0x5adf76(0x207);async[a23_0x5adf76(0x248)](_0x2c2181){const _0x961c2d=a23_0x5adf76,{options:_0x455cc5,args:_0x3b3153}=_0x2c2181;console['log'](a23_0x2f338c['bold'](_0x961c2d(0x1e1)));let _0x44bcdb;if(_0x3b3153[_0x961c2d(0x1ef)]>0x0&&_0x3b3153[0x0]){const _0x526127=_0x3b3153[0x0][_0x961c2d(0x1f2)](),_0x3f6951=validateProfileName(_0x526127);if(_0x3f6951!==!![])return console[_0x961c2d(0x20f)](a23_0x2f338c[_0x961c2d(0x222)](_0x3f6951)),0x1;_0x44bcdb=_0x526127;}else{const _0x41e986=await a23_0x1136ce({'type':'text','name':_0x961c2d(0x1e7),'message':_0x961c2d(0x1e4),'validate':validateProfileName});if(!_0x41e986[_0x961c2d(0x1e7)])return console['log']('\x0aSetup\x20cancelled'),0x1;_0x44bcdb=_0x41e986[_0x961c2d(0x1e7)][_0x961c2d(0x1f2)]();}const _0x2ebb89=await a23_0x1136ce({'type':_0x961c2d(0x215),'name':'description','message':'Enter\x20description\x20(optional):'}),_0x31c4c0=_0x2ebb89[_0x961c2d(0x21b)]?.['trim']()||undefined,_0x4ae70a=_0x455cc5[_0x961c2d(0x23c)]||_0x961c2d(0x23f),{choices:_0x1e44ec,initialIndex:_0x2631ed}=buildSiteChoices(_0x4ae70a),_0x47b417=await a23_0x1136ce({'type':_0x961c2d(0x247),'name':_0x961c2d(0x23c),'message':_0x961c2d(0x1e5)+_0x44bcdb+'\x27:','choices':_0x1e44ec,'initial':_0x2631ed});if(!_0x47b417[_0x961c2d(0x23c)])return console[_0x961c2d(0x23d)](_0x961c2d(0x1fc)),0x1;let _0x674c4b;if(_0x47b417[_0x961c2d(0x23c)]===_0x961c2d(0x250)){const _0x4eb933=await a23_0x1136ce({'type':_0x961c2d(0x215),'name':'customSite','message':_0x961c2d(0x1ec),'initial':_0x961c2d(0x23f),'validate':_0x5d62df=>{const _0x3b552c=_0x961c2d;if(!_0x5d62df||!_0x5d62df[_0x3b552c(0x1f2)]())return _0x3b552c(0x204);if(!/^[a-z0-9-]+$/['test'](_0x5d62df[_0x3b552c(0x1f2)]()))return'Site\x20name\x20must\x20contain\x20only\x20lowercase\x20letters,\x20numbers,\x20and\x20hyphens';return!![];}});if(!_0x4eb933[_0x961c2d(0x20c)])return console['log'](_0x961c2d(0x1fc)),0x1;_0x674c4b=_0x4eb933[_0x961c2d(0x20c)];}else _0x674c4b=_0x47b417[_0x961c2d(0x23c)];const _0x147efb=resolveSite(_0x674c4b);console[_0x961c2d(0x23d)](_0x961c2d(0x213)+_0x147efb),console[_0x961c2d(0x23d)](_0x961c2d(0x239)),console[_0x961c2d(0x23d)]('\x20\x20'+getConsoleUrl(_0x147efb,'/app/mp/ak'));const _0x21bf7b=await a23_0x1136ce({'type':_0x961c2d(0x24a),'name':'apiKey','message':_0x961c2d(0x238),'validate':_0x5e32c2=>{const _0x2bfd35=_0x961c2d;if(!_0x5e32c2||!_0x5e32c2[_0x2bfd35(0x1f2)]())return _0x2bfd35(0x24c);return!![];}});if(!_0x21bf7b[_0x961c2d(0x1fd)])return console['log'](_0x961c2d(0x1fc)),0x1;const _0x2f0a2e=_0x21bf7b['apiKey'];console[_0x961c2d(0x23d)](_0x961c2d(0x22b));try{const _0x1412a0=TDX[_0x961c2d(0x1e3)]({'site':_0x147efb,'apiKey':_0x2f0a2e[_0x961c2d(0x1f2)](),'logLevel':_0x455cc5[_0x961c2d(0x22d)]??LogLevel[_0x961c2d(0x243)]}),_0x3a878c=await _0x1412a0[_0x961c2d(0x21c)][_0x961c2d(0x21d)]();console[_0x961c2d(0x23d)](a23_0x2f338c[_0x961c2d(0x249)]('✓')+_0x961c2d(0x240)+_0x3a878c[_0x961c2d(0x241)]+')');const _0x23ef45=await isKeychainAvailable();_0x23ef45?(await saveAPIKeyAsync(_0x2f0a2e[_0x961c2d(0x1f2)](),_0x147efb,_0x44bcdb),console['log'](a23_0x2f338c[_0x961c2d(0x249)]('✓')+_0x961c2d(0x235)+_0x44bcdb+')')):(console['warn'](a23_0x2f338c[_0x961c2d(0x24d)](_0x961c2d(0x1e0))),console['warn'](a23_0x2f338c['yellow'](_0x961c2d(0x206))));const _0x3ea366={'site':_0x147efb,..._0x31c4c0&&{'description':_0x31c4c0}};return saveProfileToUserConfig(_0x44bcdb,_0x3ea366),console['log'](a23_0x2f338c['green']('✓')+_0x961c2d(0x200)+_0x44bcdb+'\x27\x20created'),console[_0x961c2d(0x23d)](),console[_0x961c2d(0x23d)]('You\x20can\x20now\x20use\x20tdx\x20commands\x20with\x20this\x20profile.\x20Try:'),console['log'](_0x961c2d(0x224)+_0x44bcdb+_0x961c2d(0x233)),console['log']('\x20\x20tdx\x20--profile\x20'+_0x44bcdb+'\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases'),0x0;}catch(_0x1723c3){if(_0x1723c3 instanceof HTTPClientError&&_0x1723c3[_0x961c2d(0x1f5)]===0x191)return printAuthError(_0x1723c3),0x1;return console['error'](a23_0x2f338c[_0x961c2d(0x222)](_0x961c2d(0x22c)+(_0x1723c3 instanceof Error?_0x1723c3[_0x961c2d(0x229)]:String(_0x1723c3)))),console[_0x961c2d(0x20f)](_0x961c2d(0x245)),0x1;}}}export class ProfileRemoveCommand extends BaseCommand{['name']=a23_0x5adf76(0x217);[a23_0x5adf76(0x21b)]=a23_0x5adf76(0x20d);[a23_0x5adf76(0x1f1)](_0x83cba4){const {args:_0x5eb47e}=_0x83cba4;if(_0x5eb47e['length']===0x0)return'Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20remove\x20<name>';return undefined;}async[a23_0x5adf76(0x248)](_0x428500){const _0x2f21ac=a23_0x5adf76,{args:_0x17f238}=_0x428500,_0x38f4be=_0x17f238[0x0];console['log'](a23_0x2f338c[_0x2f21ac(0x228)]('tdx:\x20profile\x20remove'));if(!profileExists(_0x38f4be)){console[_0x2f21ac(0x20f)](a23_0x2f338c[_0x2f21ac(0x222)](_0x2f21ac(0x208)+_0x38f4be+_0x2f21ac(0x212))),console[_0x2f21ac(0x23d)](_0x2f21ac(0x226));const _0x246e19=listProfiles();if(_0x246e19[_0x2f21ac(0x1ef)]===0x0)console['log'](_0x2f21ac(0x230));else for(const _0x37cf65 of _0x246e19){console[_0x2f21ac(0x23d)](_0x2f21ac(0x244)+_0x37cf65[_0x2f21ac(0x201)]);}return 0x1;}const _0x49e196=await a23_0x1136ce({'type':'confirm','name':'confirm','message':_0x2f21ac(0x1f6)+_0x38f4be+'\x27?','initial':![]});if(!_0x49e196[_0x2f21ac(0x23e)])return console[_0x2f21ac(0x23d)]('Removal\x20cancelled'),0x0;try{removeProfileFromUserConfig(_0x38f4be),console[_0x2f21ac(0x23d)](a23_0x2f338c[_0x2f21ac(0x249)]('✓')+_0x2f21ac(0x200)+_0x38f4be+_0x2f21ac(0x232));}catch(_0x28de26){return console[_0x2f21ac(0x20f)](a23_0x2f338c[_0x2f21ac(0x222)]('Failed\x20to\x20remove\x20profile:\x20'+(_0x28de26 instanceof Error?_0x28de26['message']:String(_0x28de26)))),0x1;}const _0x147745=await isKeychainAvailable();if(_0x147745){const _0x50306a=await deleteKeychainAPIKey(_0x38f4be);_0x50306a&&console[_0x2f21ac(0x23d)](a23_0x2f338c[_0x2f21ac(0x249)]('✓')+_0x2f21ac(0x246));}return 0x0;}}export class ProfileSetCommand extends BaseCommand{['name']=a23_0x5adf76(0x22f);['description']=a23_0x5adf76(0x24b);static [a23_0x5adf76(0x23a)]=[a23_0x5adf76(0x23c),'database',a23_0x5adf76(0x1f9),a23_0x5adf76(0x1e6),a23_0x5adf76(0x21e),'description'];[a23_0x5adf76(0x1f1)](_0x595c9d){const _0x484547=a23_0x5adf76,{args:_0x365c22,options:_0x556227}=_0x595c9d,_0x5864f3=_0x556227[_0x484547(0x214)]||getActiveProfile();if(!_0x5864f3)return _0x484547(0x209);if(_0x365c22[_0x484547(0x1ef)]===0x0)return _0x484547(0x1f7)+ProfileSetCommand[_0x484547(0x23a)][_0x484547(0x234)](',\x20');const _0x384e6b=_0x365c22[0x0];if(!_0x384e6b[_0x484547(0x1e8)]('='))return _0x484547(0x1ed)+ProfileSetCommand[_0x484547(0x23a)]['join'](',\x20');const [_0x59e1ea]=_0x384e6b[_0x484547(0x1ff)]('=',0x2);if(!ProfileSetCommand[_0x484547(0x23a)]['includes'](_0x59e1ea))return'Unknown\x20key\x20\x27'+_0x59e1ea+'\x27.\x0a\x0aValid\x20keys:\x20'+ProfileSetCommand['VALID_KEYS'][_0x484547(0x234)](',\x20');return undefined;}async[a23_0x5adf76(0x248)](_0x163130){const _0x4767c6=a23_0x5adf76,{args:_0x4453a4,options:_0x17ab4b}=_0x163130,_0x2455c9=_0x17ab4b[_0x4767c6(0x214)]||getActiveProfile(),[_0x3f6dc2,..._0x3d8ec7]=_0x4453a4[0x0]['split']('='),_0x677d40=_0x3d8ec7['join']('=');console[_0x4767c6(0x23d)](a23_0x2f338c['bold']('tdx:\x20profile\x20set'));if(!profileExists(_0x2455c9)){const _0x2127d2=await a23_0x1136ce({'type':_0x4767c6(0x23e),'name':_0x4767c6(0x1e3),'message':_0x4767c6(0x208)+_0x2455c9+_0x4767c6(0x1e2),'initial':!![]});if(!_0x2127d2['create'])return console['log'](_0x4767c6(0x218)),0x1;}const _0x22ad10=loadProfile(_0x2455c9),_0x2f72fc=_0x22ad10?.['config']||{};if(_0x3f6dc2==='site'){const _0x4e8ed5=resolveSite(_0x677d40);console[_0x4767c6(0x23d)](_0x4767c6(0x220)+_0x4e8ed5+_0x4767c6(0x205)),console['log'](_0x4767c6(0x203)),console[_0x4767c6(0x23d)]('\x20\x20'+getConsoleUrl(_0x4e8ed5,_0x4767c6(0x23b)));const _0x2b1d18=await a23_0x1136ce({'type':'password','name':_0x4767c6(0x1fd),'message':'Enter\x20your\x20TD\x20API\x20key\x20for\x20the\x20new\x20site:','validate':_0x3a8aa7=>{const _0x4d6156=_0x4767c6;if(!_0x3a8aa7||!_0x3a8aa7[_0x4d6156(0x1f2)]())return'API\x20key\x20cannot\x20be\x20empty';return!![];}});if(!_0x2b1d18[_0x4767c6(0x1fd)])return console[_0x4767c6(0x23d)](_0x4767c6(0x227)),0x1;console[_0x4767c6(0x23d)](_0x4767c6(0x22b));try{const _0x272e91=TDX[_0x4767c6(0x1e3)]({'site':_0x4e8ed5,'apiKey':_0x2b1d18[_0x4767c6(0x1fd)][_0x4767c6(0x1f2)](),'logLevel':_0x17ab4b[_0x4767c6(0x22d)]??LogLevel[_0x4767c6(0x243)]}),_0x27d6c5=await _0x272e91[_0x4767c6(0x21c)][_0x4767c6(0x21d)]();console[_0x4767c6(0x23d)](a23_0x2f338c['green']('✓')+_0x4767c6(0x240)+_0x27d6c5[_0x4767c6(0x241)]+')');const _0x15da94=await isKeychainAvailable();_0x15da94?(await saveAPIKeyAsync(_0x2b1d18[_0x4767c6(0x1fd)][_0x4767c6(0x1f2)](),_0x4e8ed5,_0x2455c9),console[_0x4767c6(0x23d)](a23_0x2f338c['green']('✓')+_0x4767c6(0x1e9))):console[_0x4767c6(0x202)](a23_0x2f338c[_0x4767c6(0x24d)]('⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.')),_0x2f72fc[_0x4767c6(0x23c)]=_0x4e8ed5;}catch(_0x8e13a5){if(_0x8e13a5 instanceof HTTPClientError&&_0x8e13a5[_0x4767c6(0x1f5)]===0x191)return printAuthError(_0x8e13a5),0x1;return console[_0x4767c6(0x20f)](a23_0x2f338c[_0x4767c6(0x222)](_0x4767c6(0x22c)+(_0x8e13a5 instanceof Error?_0x8e13a5[_0x4767c6(0x229)]:String(_0x8e13a5)))),console['error'](_0x4767c6(0x221)),0x1;}}else _0x2f72fc[_0x3f6dc2]=_0x677d40||undefined;return saveProfileToUserConfig(_0x2455c9,_0x2f72fc),console['log'](a23_0x2f338c[_0x4767c6(0x249)]('✓')+_0x4767c6(0x200)+_0x2455c9+_0x4767c6(0x210)+_0x3f6dc2+'='+(_0x677d40||_0x4767c6(0x20e))),0x0;}}export class ProfileUseCommand extends BaseCommand{[a23_0x5adf76(0x201)]='profile:use';[a23_0x5adf76(0x21b)]=a23_0x5adf76(0x1f0);[a23_0x5adf76(0x1f1)](_0x3b70a8){const _0x1dd859=a23_0x5adf76,{args:_0x3103a1}=_0x3b70a8;if(_0x3103a1[_0x1dd859(0x1ef)]===0x0)return _0x1dd859(0x1fb);return undefined;}async[a23_0x5adf76(0x248)](_0x3aa801){const _0x7fa51e=a23_0x5adf76,{args:_0x3cb5e8,options:_0x7ac837}=_0x3aa801,_0x441421=_0x3cb5e8[0x0],_0x210ba2=_0x7ac837[_0x7fa51e(0x225)];cleanExpiredSessions();if(!profileExists(_0x441421)){console[_0x7fa51e(0x20f)](a23_0x2f338c['red'](_0x7fa51e(0x208)+_0x441421+_0x7fa51e(0x212))),console[_0x7fa51e(0x23d)](_0x7fa51e(0x226));const _0x490f16=listProfiles();if(_0x490f16[_0x7fa51e(0x1ef)]===0x0)console['log'](_0x7fa51e(0x230));else for(const _0x3946ab of _0x490f16){console[_0x7fa51e(0x23d)](_0x7fa51e(0x244)+_0x3946ab[_0x7fa51e(0x201)]);}return 0x1;}if(_0x210ba2){const _0x46176e=a23_0x46e5b2[_0x7fa51e(0x234)](getConfigDir(),_0x7fa51e(0x24e));return saveActiveProfileToUserConfig(_0x441421),console['log'](_0x7fa51e(0x237)+a23_0x2f338c['green'](_0x441421)),console['log'](a23_0x2f338c[_0x7fa51e(0x1fe)](_0x7fa51e(0x22e)+_0x46176e)),0x0;}const _0x279d4f=getSessionID(_0x7ac837['session']);return saveSessionContext({'profile':_0x441421},_0x7ac837[_0x7fa51e(0x21a)]),console[_0x7fa51e(0x23d)](_0x7fa51e(0x1eb)+a23_0x2f338c[_0x7fa51e(0x249)](_0x441421)+'\x20'+a23_0x2f338c[_0x7fa51e(0x1fe)](_0x7fa51e(0x216)+_0x279d4f+')')),console[_0x7fa51e(0x23d)](a23_0x2f338c[_0x7fa51e(0x1fe)](_0x7fa51e(0x1ee)+_0x441421+_0x7fa51e(0x211))),0x0;}}
1
+ const a23_0x4ed49c=a23_0x5299;(function(_0x195b41,_0x186fd8){const _0x16813c=a23_0x5299,_0x122702=_0x195b41();while(!![]){try{const _0x11b727=-parseInt(_0x16813c(0x182))/0x1+-parseInt(_0x16813c(0x148))/0x2*(-parseInt(_0x16813c(0x140))/0x3)+-parseInt(_0x16813c(0x171))/0x4*(parseInt(_0x16813c(0x193))/0x5)+parseInt(_0x16813c(0x17f))/0x6+parseInt(_0x16813c(0x14f))/0x7+parseInt(_0x16813c(0x184))/0x8*(parseInt(_0x16813c(0x16f))/0x9)+-parseInt(_0x16813c(0x179))/0xa;if(_0x11b727===_0x186fd8)break;else _0x122702['push'](_0x122702['shift']());}catch(_0x5c56ba){_0x122702['push'](_0x122702['shift']());}}}(a23_0x33fb,0x87525));import{BaseCommand,printAuthError}from'./command.js';import{listProfiles,profileExists,saveProfileToUserConfig,removeProfileFromUserConfig,loadProfile,getActiveProfile,saveActiveProfileToUserConfig}from'../core/profile.js';function a23_0x33fb(){const _0xa6336=['database','9940160uBwNfX','Profile\x20was\x20not\x20created.\x20Please\x20try\x20again.','validate','Changing\x20site\x20to\x20\x27','profile:set','\x27\x20does\x20not\x20exist.','2225388aLnuxg','\x20API\x20key\x20removed\x20from\x20system\x20keychain','tdx.json','1021529HJaJZQ','error','200pDNtwq','yellow','trim','green','Enter\x20description\x20(optional):','warn','\x20API\x20key\x20saved\x20to\x20system\x20keychain\x20(profile:\x20','profile:remove','description','\x0aSetting\x20up\x20authentication\x20for\x20site:\x20','red','jobs','\x27\x20removed\x20from\x20configuration','create','Enter\x20your\x20TD\x20API\x20key:','34130zkcsCp','ERROR','getUserInfo','\x0aAvailable\x20profiles:','Select\x20Treasure\x20Data\x20site\x20for\x20profile\x20\x27','Enter\x20your\x20TD\x20API\x20key\x20for\x20the\x20new\x20site:','select','Site\x20was\x20not\x20changed.','split','Remove\x20a\x20profile','Set\x20session\x20profile','bold','\x20API\x20key\x20saved\x20to\x20system\x20keychain','You\x20can\x20find\x20your\x20API\x20key\x20at:','Profile\x20name\x20cannot\x20be\x20empty','execute','length','Enter\x20profile\x20name:','Profile\x20\x27','\x0aOperation\x20cancelled','confirm','\x27\x20does\x20not\x20exist.\x20Create\x20it?','session','Set\x20a\x20profile\x20configuration\x20value','Key=value\x20pair\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','llm_project','/app/mp/ak','customSite','3AqqCyU','Failed\x20to\x20remove\x20profile:\x20','\x20Profile\x20\x27','Enter\x20site\x20name:','profileName','llm_agent','tdx:\x20profile\x20set','log','1949050MfkxSw','\x27\x20updated:\x20','\x20\x20tdx\x20--profile\x20','\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.','API\x20key\x20cannot\x20be\x20empty','Site\x20name\x20must\x20contain\x20only\x20lowercase\x20letters,\x20numbers,\x20and\x20hyphens','join','6046670maDFKk','apiKey','test','status','\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication','name','Invalid\x20format.\x20Use:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','\x27\x20requires\x20API\x20key\x20validation.','Validating\x20API\x20key...','password','VALID_KEYS','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20use\x20<name>\x20[--default]','Site\x20name\x20cannot\x20be\x20empty','(session:\x20','site','tdx:\x20profile\x20remove','\x0aSetup\x20cancelled','\x20\x20(no\x20profiles\x20found)','\x20--default\x27\x20to\x20save\x20permanently','Removal\x20cancelled','\x20\x20-\x20','\x27\x20created','text','logLevel','us01','profile','✗\x20Validation\x20failed:\x20','default','message','\x27.\x0a\x0aValid\x20keys:\x20','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','\x27\x20already\x20exists.\x20Use\x20\x27tdx\x20profile\x20set\x27\x20to\x20modify\x20it.','279711LBVqso','profile:create','244xlPEgB','Session\x20profile\x20set\x20to:\x20','parent_segment','dim','\x20API\x20key\x20is\x20valid\x20(User:\x20','Operation\x20cancelled','You\x20can\x20now\x20use\x20tdx\x20commands\x20with\x20this\x20profile.\x20Try:'];a23_0x33fb=function(){return _0xa6336;};return a23_0x33fb();}import{getConfigDir}from'../core/config.js';import*as a23_0x40c7e7 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_0x5299(_0x4c4521,_0x391d59){_0x4c4521=_0x4c4521-0x12b;const _0x33fb17=a23_0x33fb();let _0x5299c0=_0x33fb17[_0x4c4521];return _0x5299c0;}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_0x3ecf03 from'prompts';import a23_0x3d9504 from'chalk';function validateProfileName(_0x2f6861){const _0x572d30=a23_0x5299;if(!_0x2f6861||!_0x2f6861[_0x572d30(0x186)]())return _0x572d30(0x132);const _0x1832c0=_0x2f6861['trim']();if(!/^[a-zA-Z0-9_-]+$/[_0x572d30(0x151)](_0x1832c0))return'Profile\x20name\x20must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore';if(profileExists(_0x1832c0))return _0x572d30(0x136)+_0x1832c0+_0x572d30(0x16e);return!![];}export class ProfileCreateCommand extends BaseCommand{[a23_0x4ed49c(0x154)]=a23_0x4ed49c(0x170);[a23_0x4ed49c(0x18c)]='Create\x20a\x20new\x20profile';async[a23_0x4ed49c(0x133)](_0x1bd7ac){const _0x2c9cae=a23_0x4ed49c,{options:_0x2a794c,args:_0x1cbe1b}=_0x1bd7ac;console[_0x2c9cae(0x147)](a23_0x3d9504[_0x2c9cae(0x12f)]('tdx:\x20profile\x20create'));let _0x19eea9;if(_0x1cbe1b['length']>0x0&&_0x1cbe1b[0x0]){const _0x4dee46=_0x1cbe1b[0x0][_0x2c9cae(0x186)](),_0x3c454d=validateProfileName(_0x4dee46);if(_0x3c454d!==!![])return console[_0x2c9cae(0x183)](a23_0x3d9504['red'](_0x3c454d)),0x1;_0x19eea9=_0x4dee46;}else{const _0x138f94=await a23_0x3ecf03({'type':_0x2c9cae(0x165),'name':_0x2c9cae(0x144),'message':_0x2c9cae(0x135),'validate':validateProfileName});if(!_0x138f94[_0x2c9cae(0x144)])return console[_0x2c9cae(0x147)](_0x2c9cae(0x15f)),0x1;_0x19eea9=_0x138f94['profileName'][_0x2c9cae(0x186)]();}const _0x56ac48=await a23_0x3ecf03({'type':'text','name':_0x2c9cae(0x18c),'message':_0x2c9cae(0x188)}),_0x58cd82=_0x56ac48[_0x2c9cae(0x18c)]?.[_0x2c9cae(0x186)]()||undefined,_0x561cdf=_0x2a794c[_0x2c9cae(0x15d)]||_0x2c9cae(0x167),{choices:_0x5c5b37,initialIndex:_0x2cfedb}=buildSiteChoices(_0x561cdf),_0x28fc0d=await a23_0x3ecf03({'type':_0x2c9cae(0x199),'name':_0x2c9cae(0x15d),'message':_0x2c9cae(0x197)+_0x19eea9+'\x27:','choices':_0x5c5b37,'initial':_0x2cfedb});if(!_0x28fc0d[_0x2c9cae(0x15d)])return console['log']('\x0aSetup\x20cancelled'),0x1;let _0x9b2436;if(_0x28fc0d[_0x2c9cae(0x15d)]==='other'){const _0x317986=await a23_0x3ecf03({'type':_0x2c9cae(0x165),'name':_0x2c9cae(0x13f),'message':_0x2c9cae(0x143),'initial':_0x2c9cae(0x167),'validate':_0x1f1b62=>{const _0x47ecc3=_0x2c9cae;if(!_0x1f1b62||!_0x1f1b62[_0x47ecc3(0x186)]())return _0x47ecc3(0x15b);if(!/^[a-z0-9-]+$/[_0x47ecc3(0x151)](_0x1f1b62[_0x47ecc3(0x186)]()))return _0x47ecc3(0x14d);return!![];}});if(!_0x317986['customSite'])return console['log'](_0x2c9cae(0x15f)),0x1;_0x9b2436=_0x317986[_0x2c9cae(0x13f)];}else _0x9b2436=_0x28fc0d[_0x2c9cae(0x15d)];const _0x4206eb=resolveSite(_0x9b2436);console[_0x2c9cae(0x147)](_0x2c9cae(0x18d)+_0x4206eb),console[_0x2c9cae(0x147)](_0x2c9cae(0x131)),console[_0x2c9cae(0x147)]('\x20\x20'+getConsoleUrl(_0x4206eb,_0x2c9cae(0x13e)));const _0x211020=await a23_0x3ecf03({'type':_0x2c9cae(0x158),'name':_0x2c9cae(0x150),'message':_0x2c9cae(0x192),'validate':_0x2d20ef=>{const _0x2ff56a=_0x2c9cae;if(!_0x2d20ef||!_0x2d20ef[_0x2ff56a(0x186)]())return _0x2ff56a(0x14c);return!![];}});if(!_0x211020[_0x2c9cae(0x150)])return console[_0x2c9cae(0x147)](_0x2c9cae(0x15f)),0x1;const _0x1c0a30=_0x211020[_0x2c9cae(0x150)];console[_0x2c9cae(0x147)](_0x2c9cae(0x157));try{const _0x494333=TDX[_0x2c9cae(0x191)]({'site':_0x4206eb,'apiKey':_0x1c0a30['trim'](),'logLevel':_0x2a794c[_0x2c9cae(0x166)]??LogLevel['ERROR']}),_0x15e240=await _0x494333[_0x2c9cae(0x18f)]['getUserInfo']();console['log'](a23_0x3d9504[_0x2c9cae(0x187)]('✓')+'\x20API\x20key\x20is\x20valid\x20(User:\x20'+_0x15e240['email']+')');const _0x204dfa=await isKeychainAvailable();_0x204dfa?(await saveAPIKeyAsync(_0x1c0a30[_0x2c9cae(0x186)](),_0x4206eb,_0x19eea9),console[_0x2c9cae(0x147)](a23_0x3d9504[_0x2c9cae(0x187)]('✓')+_0x2c9cae(0x18a)+_0x19eea9+')')):(console[_0x2c9cae(0x189)](a23_0x3d9504['yellow'](_0x2c9cae(0x16d))),console['warn'](a23_0x3d9504[_0x2c9cae(0x185)](_0x2c9cae(0x14b))));const _0x165174={'site':_0x4206eb,..._0x58cd82&&{'description':_0x58cd82}};return saveProfileToUserConfig(_0x19eea9,_0x165174),console[_0x2c9cae(0x147)](a23_0x3d9504['green']('✓')+'\x20Profile\x20\x27'+_0x19eea9+_0x2c9cae(0x164)),console[_0x2c9cae(0x147)](),console[_0x2c9cae(0x147)](_0x2c9cae(0x177)),console[_0x2c9cae(0x147)](_0x2c9cae(0x14a)+_0x19eea9+_0x2c9cae(0x153)),console[_0x2c9cae(0x147)](_0x2c9cae(0x14a)+_0x19eea9+'\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases'),0x0;}catch(_0x5dbbe1){if(_0x5dbbe1 instanceof HTTPClientError&&_0x5dbbe1[_0x2c9cae(0x152)]===0x191)return printAuthError(_0x5dbbe1),0x1;return console[_0x2c9cae(0x183)](a23_0x3d9504[_0x2c9cae(0x18e)](_0x2c9cae(0x169)+(_0x5dbbe1 instanceof Error?_0x5dbbe1['message']:String(_0x5dbbe1)))),console[_0x2c9cae(0x183)](_0x2c9cae(0x17a)),0x1;}}}export class ProfileRemoveCommand extends BaseCommand{[a23_0x4ed49c(0x154)]=a23_0x4ed49c(0x18b);[a23_0x4ed49c(0x18c)]=a23_0x4ed49c(0x12d);[a23_0x4ed49c(0x17b)](_0x51b83d){const _0x44e64c=a23_0x4ed49c,{args:_0x45e4eb}=_0x51b83d;if(_0x45e4eb[_0x44e64c(0x134)]===0x0)return'Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20remove\x20<name>';return undefined;}async[a23_0x4ed49c(0x133)](_0xde4176){const _0x1b9292=a23_0x4ed49c,{args:_0x25035f}=_0xde4176,_0x40a939=_0x25035f[0x0];console[_0x1b9292(0x147)](a23_0x3d9504[_0x1b9292(0x12f)](_0x1b9292(0x15e)));if(!profileExists(_0x40a939)){console[_0x1b9292(0x183)](a23_0x3d9504['red'](_0x1b9292(0x136)+_0x40a939+'\x27\x20does\x20not\x20exist.')),console[_0x1b9292(0x147)](_0x1b9292(0x196));const _0x5772c3=listProfiles();if(_0x5772c3[_0x1b9292(0x134)]===0x0)console[_0x1b9292(0x147)](_0x1b9292(0x160));else for(const _0x120b3b of _0x5772c3){console[_0x1b9292(0x147)](_0x1b9292(0x163)+_0x120b3b['name']);}return 0x1;}const _0x181f9c=await a23_0x3ecf03({'type':'confirm','name':_0x1b9292(0x138),'message':'Are\x20you\x20sure\x20you\x20want\x20to\x20remove\x20profile\x20\x27'+_0x40a939+'\x27?','initial':![]});if(!_0x181f9c['confirm'])return console[_0x1b9292(0x147)](_0x1b9292(0x162)),0x0;try{removeProfileFromUserConfig(_0x40a939),console[_0x1b9292(0x147)](a23_0x3d9504[_0x1b9292(0x187)]('✓')+_0x1b9292(0x142)+_0x40a939+_0x1b9292(0x190));}catch(_0x2777bc){return console[_0x1b9292(0x183)](a23_0x3d9504[_0x1b9292(0x18e)](_0x1b9292(0x141)+(_0x2777bc instanceof Error?_0x2777bc[_0x1b9292(0x16b)]:String(_0x2777bc)))),0x1;}const _0x3492d3=await isKeychainAvailable();if(_0x3492d3){const _0x4b1e73=await deleteKeychainAPIKey(_0x40a939);_0x4b1e73&&console['log'](a23_0x3d9504[_0x1b9292(0x187)]('✓')+_0x1b9292(0x180));}return 0x0;}}export class ProfileSetCommand extends BaseCommand{[a23_0x4ed49c(0x154)]=a23_0x4ed49c(0x17d);['description']=a23_0x4ed49c(0x13b);static ['VALID_KEYS']=[a23_0x4ed49c(0x15d),a23_0x4ed49c(0x178),a23_0x4ed49c(0x173),a23_0x4ed49c(0x13d),a23_0x4ed49c(0x145),a23_0x4ed49c(0x18c)];['validate'](_0x4f1e29){const _0x5cb006=a23_0x4ed49c,{args:_0x48839a,options:_0x489b81}=_0x4f1e29,_0x28b99c=_0x489b81[_0x5cb006(0x168)]||getActiveProfile();if(!_0x28b99c)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(_0x48839a[_0x5cb006(0x134)]===0x0)return _0x5cb006(0x13c)+ProfileSetCommand[_0x5cb006(0x159)][_0x5cb006(0x14e)](',\x20');const _0x5628c=_0x48839a[0x0];if(!_0x5628c['includes']('='))return _0x5cb006(0x155)+ProfileSetCommand[_0x5cb006(0x159)][_0x5cb006(0x14e)](',\x20');const [_0x19c6d8]=_0x5628c[_0x5cb006(0x12c)]('=',0x2);if(!ProfileSetCommand[_0x5cb006(0x159)]['includes'](_0x19c6d8))return'Unknown\x20key\x20\x27'+_0x19c6d8+_0x5cb006(0x16c)+ProfileSetCommand[_0x5cb006(0x159)][_0x5cb006(0x14e)](',\x20');return undefined;}async[a23_0x4ed49c(0x133)](_0x46a5a4){const _0x503df9=a23_0x4ed49c,{args:_0x44ee0d,options:_0x38ca95}=_0x46a5a4,_0x2f4a42=_0x38ca95[_0x503df9(0x168)]||getActiveProfile(),[_0x299a85,..._0x293295]=_0x44ee0d[0x0][_0x503df9(0x12c)]('='),_0x5314b1=_0x293295[_0x503df9(0x14e)]('=');console[_0x503df9(0x147)](a23_0x3d9504[_0x503df9(0x12f)](_0x503df9(0x146)));if(!profileExists(_0x2f4a42)){const _0x1a107b=await a23_0x3ecf03({'type':_0x503df9(0x138),'name':'create','message':_0x503df9(0x136)+_0x2f4a42+_0x503df9(0x139),'initial':!![]});if(!_0x1a107b[_0x503df9(0x191)])return console[_0x503df9(0x147)](_0x503df9(0x176)),0x1;}const _0x2638c4=loadProfile(_0x2f4a42),_0x18728d=_0x2638c4?.['config']||{};if(_0x299a85===_0x503df9(0x15d)){const _0x473a89=resolveSite(_0x5314b1);console[_0x503df9(0x147)](_0x503df9(0x17c)+_0x473a89+_0x503df9(0x156)),console['log']('\x0aYou\x20can\x20find\x20your\x20API\x20key\x20at:'),console[_0x503df9(0x147)]('\x20\x20'+getConsoleUrl(_0x473a89,_0x503df9(0x13e)));const _0x384dda=await a23_0x3ecf03({'type':_0x503df9(0x158),'name':_0x503df9(0x150),'message':_0x503df9(0x198),'validate':_0x36756f=>{const _0xc1a1a0=_0x503df9;if(!_0x36756f||!_0x36756f[_0xc1a1a0(0x186)]())return'API\x20key\x20cannot\x20be\x20empty';return!![];}});if(!_0x384dda[_0x503df9(0x150)])return console[_0x503df9(0x147)](_0x503df9(0x137)),0x1;console['log'](_0x503df9(0x157));try{const _0x45b674=TDX[_0x503df9(0x191)]({'site':_0x473a89,'apiKey':_0x384dda['apiKey']['trim'](),'logLevel':_0x38ca95['logLevel']??LogLevel[_0x503df9(0x194)]}),_0x28515a=await _0x45b674[_0x503df9(0x18f)][_0x503df9(0x195)]();console[_0x503df9(0x147)](a23_0x3d9504[_0x503df9(0x187)]('✓')+_0x503df9(0x175)+_0x28515a['email']+')');const _0x13809e=await isKeychainAvailable();_0x13809e?(await saveAPIKeyAsync(_0x384dda[_0x503df9(0x150)][_0x503df9(0x186)](),_0x473a89,_0x2f4a42),console[_0x503df9(0x147)](a23_0x3d9504['green']('✓')+_0x503df9(0x130))):console['warn'](a23_0x3d9504['yellow'](_0x503df9(0x16d))),_0x18728d[_0x503df9(0x15d)]=_0x473a89;}catch(_0x49bcc5){if(_0x49bcc5 instanceof HTTPClientError&&_0x49bcc5[_0x503df9(0x152)]===0x191)return printAuthError(_0x49bcc5),0x1;return console[_0x503df9(0x183)](a23_0x3d9504['red'](_0x503df9(0x169)+(_0x49bcc5 instanceof Error?_0x49bcc5[_0x503df9(0x16b)]:String(_0x49bcc5)))),console[_0x503df9(0x183)](_0x503df9(0x12b)),0x1;}}else _0x18728d[_0x299a85]=_0x5314b1||undefined;return saveProfileToUserConfig(_0x2f4a42,_0x18728d),console['log'](a23_0x3d9504['green']('✓')+_0x503df9(0x142)+_0x2f4a42+_0x503df9(0x149)+_0x299a85+'='+(_0x5314b1||'(cleared)')),0x0;}}export class ProfileUseCommand extends BaseCommand{[a23_0x4ed49c(0x154)]='profile:use';[a23_0x4ed49c(0x18c)]=a23_0x4ed49c(0x12e);[a23_0x4ed49c(0x17b)](_0x1d92ca){const _0x4a532d=a23_0x4ed49c,{args:_0x766c42}=_0x1d92ca;if(_0x766c42['length']===0x0)return _0x4a532d(0x15a);return undefined;}async[a23_0x4ed49c(0x133)](_0x1f5634){const _0x1d328d=a23_0x4ed49c,{args:_0x581aba,options:_0x28bdd7}=_0x1f5634,_0x18adc8=_0x581aba[0x0],_0x4d5f5f=_0x28bdd7[_0x1d328d(0x16a)];cleanExpiredSessions();if(!profileExists(_0x18adc8)){console[_0x1d328d(0x183)](a23_0x3d9504[_0x1d328d(0x18e)]('Profile\x20\x27'+_0x18adc8+_0x1d328d(0x17e))),console[_0x1d328d(0x147)](_0x1d328d(0x196));const _0x39140d=listProfiles();if(_0x39140d[_0x1d328d(0x134)]===0x0)console['log']('\x20\x20(no\x20profiles\x20found)');else for(const _0x2656ca of _0x39140d){console['log']('\x20\x20-\x20'+_0x2656ca[_0x1d328d(0x154)]);}return 0x1;}if(_0x4d5f5f){const _0x917dae=a23_0x40c7e7[_0x1d328d(0x14e)](getConfigDir(),_0x1d328d(0x181));return saveActiveProfileToUserConfig(_0x18adc8),console[_0x1d328d(0x147)]('Default\x20profile\x20set\x20to:\x20'+a23_0x3d9504['green'](_0x18adc8)),console[_0x1d328d(0x147)](a23_0x3d9504['dim']('\x0aSaved\x20to:\x20'+_0x917dae)),0x0;}const _0x4dfe99=getSessionID(_0x28bdd7[_0x1d328d(0x13a)]);return saveSessionContext({'profile':_0x18adc8},_0x28bdd7[_0x1d328d(0x13a)]),console[_0x1d328d(0x147)](_0x1d328d(0x172)+a23_0x3d9504['green'](_0x18adc8)+'\x20'+a23_0x3d9504['dim'](_0x1d328d(0x15c)+_0x4dfe99+')')),console[_0x1d328d(0x147)](a23_0x3d9504[_0x1d328d(0x174)]('\x0aTip:\x20Use\x20\x27tdx\x20profile\x20use\x20'+_0x18adc8+_0x1d328d(0x161))),0x0;}}
@@ -1 +1 @@
1
- const a24_0x13fd3c=a24_0x4e2d;function a24_0x14ee(){const _0x3b2515=['276312yPnhAG','No\x20profiles\x20found.\x20Define\x20profiles\x20in\x20tdx.json:\x0a','\x20\x20Local:\x20\x20(project\x20folder)/tdx.json','scope','238473SmrjKj','description','3893140jeRfPY','error','map','124854KBGeeC','message','496136mQLpHx','name','config','7hVfGoi','log','2181735WnkOLz','13629880awSAoW','length','List\x20all\x20available\x20profiles','4bfZZdH','\x20\x20Global:\x20~/.config/tdx/tdx.json','execute','profiles','160qxKvrA'];a24_0x14ee=function(){return _0x3b2515;};return a24_0x14ee();}(function(_0x123b77,_0xf78226){const _0x3b3515=a24_0x4e2d,_0x4e5ff7=_0x123b77();while(!![]){try{const _0x4dd283=-parseInt(_0x3b3515(0x1d0))/0x1*(-parseInt(_0x3b3515(0x1d9))/0x2)+parseInt(_0x3b3515(0x1de))/0x3+-parseInt(_0x3b3515(0x1cb))/0x4+-parseInt(_0x3b3515(0x1d5))/0x5+-parseInt(_0x3b3515(0x1ce))/0x6*(-parseInt(_0x3b3515(0x1d3))/0x7)+-parseInt(_0x3b3515(0x1dd))/0x8*(parseInt(_0x3b3515(0x1e2))/0x9)+parseInt(_0x3b3515(0x1d6))/0xa;if(_0x4dd283===_0xf78226)break;else _0x4e5ff7['push'](_0x4e5ff7['shift']());}catch(_0x3a93ff){_0x4e5ff7['push'](_0x4e5ff7['shift']());}}}(a24_0x14ee,0x810d9));import{BaseCommand}from'./command.js';import{listProfiles,getActiveProfile,getProfileParams}from'../core/profile.js';function a24_0x4e2d(_0x835b09,_0x2058b1){_0x835b09=_0x835b09-0x1ca;const _0x14ee5a=a24_0x14ee();let _0x4e2d9c=_0x14ee5a[_0x835b09];return _0x4e2d9c;}import{handleSDKOutput}from'../core/command-output.js';export class ProfilesCommand extends BaseCommand{[a24_0x13fd3c(0x1d1)]=a24_0x13fd3c(0x1dc);[a24_0x13fd3c(0x1ca)]=a24_0x13fd3c(0x1d8);async[a24_0x13fd3c(0x1db)](_0x12b1dd){const _0x52830f=a24_0x13fd3c,{options:_0x4c4429}=_0x12b1dd;try{const _0x1ffa65=listProfiles(),_0x30538c=getActiveProfile();if(_0x1ffa65[_0x52830f(0x1d7)]===0x0)return console[_0x52830f(0x1d4)](_0x52830f(0x1df)),console['log'](_0x52830f(0x1e0)),console[_0x52830f(0x1d4)](_0x52830f(0x1da)),0x0;const _0xce8b1f=_0x1ffa65[_0x52830f(0x1cd)](_0x2eecb8=>{const _0x3cfb38=_0x52830f,_0x484b80=_0x2eecb8[_0x3cfb38(0x1d1)]===_0x30538c,_0x211000=getProfileParams(_0x2eecb8[_0x3cfb38(0x1d2)]);return{'name':_0x2eecb8[_0x3cfb38(0x1d1)],'active':_0x484b80,'scope':_0x2eecb8[_0x3cfb38(0x1e1)],'description':_0x2eecb8[_0x3cfb38(0x1d2)][_0x3cfb38(0x1ca)]||'','params':_0x211000};});return await handleSDKOutput(_0xce8b1f,_0x4c4429),0x0;}catch(_0x4a489b){return _0x4a489b instanceof Error&&console[_0x52830f(0x1cc)]('Error:\x20'+_0x4a489b[_0x52830f(0x1cf)]),0x1;}}}
1
+ const a24_0x5e90f5=a24_0x2460;(function(_0x108cce,_0x168816){const _0x26d09b=a24_0x2460,_0x34a7e0=_0x108cce();while(!![]){try{const _0x1d9b0a=-parseInt(_0x26d09b(0x1ff))/0x1*(parseInt(_0x26d09b(0x1f9))/0x2)+parseInt(_0x26d09b(0x200))/0x3+-parseInt(_0x26d09b(0x1fb))/0x4*(-parseInt(_0x26d09b(0x1fa))/0x5)+parseInt(_0x26d09b(0x1ef))/0x6+parseInt(_0x26d09b(0x201))/0x7+-parseInt(_0x26d09b(0x1f8))/0x8+-parseInt(_0x26d09b(0x1fc))/0x9*(parseInt(_0x26d09b(0x1ed))/0xa);if(_0x1d9b0a===_0x168816)break;else _0x34a7e0['push'](_0x34a7e0['shift']());}catch(_0x1f6dc){_0x34a7e0['push'](_0x34a7e0['shift']());}}}(a24_0x234d,0x1ebc4));import{BaseCommand}from'./command.js';import{listProfiles,getActiveProfile,getProfileParams}from'../core/profile.js';function a24_0x2460(_0x1b435a,_0x2077c7){_0x1b435a=_0x1b435a-0x1ea;const _0x234d51=a24_0x234d();let _0x24608e=_0x234d51[_0x1b435a];return _0x24608e;}import{handleSDKOutput}from'../core/command-output.js';export class ProfilesCommand extends BaseCommand{[a24_0x5e90f5(0x1f0)]='profiles';['description']=a24_0x5e90f5(0x1fe);async[a24_0x5e90f5(0x1ec)](_0x47788b){const _0x2417e7=a24_0x5e90f5,{options:_0x2cf895}=_0x47788b;try{const _0x520217=listProfiles(),_0x318774=getActiveProfile();if(_0x520217[_0x2417e7(0x1ea)]===0x0)return console[_0x2417e7(0x1fd)](_0x2417e7(0x1f2)),console[_0x2417e7(0x1fd)](_0x2417e7(0x1f4)),console[_0x2417e7(0x1fd)](_0x2417e7(0x1ee)),0x0;const _0x1bc2a2=_0x520217[_0x2417e7(0x1f7)](_0x3278c6=>{const _0x2f0b09=_0x2417e7,_0x438227=_0x3278c6[_0x2f0b09(0x1f0)]===_0x318774,_0x4607ed=getProfileParams(_0x3278c6[_0x2f0b09(0x1f5)]);return{'name':_0x3278c6[_0x2f0b09(0x1f0)],'active':_0x438227,'scope':_0x3278c6[_0x2f0b09(0x1f3)],'description':_0x3278c6[_0x2f0b09(0x1f5)][_0x2f0b09(0x1eb)]||'','params':_0x4607ed};});return await handleSDKOutput(_0x1bc2a2,_0x2cf895),0x0;}catch(_0x2168b3){return _0x2168b3 instanceof Error&&console[_0x2417e7(0x1f1)](_0x2417e7(0x1f6)+_0x2168b3['message']),0x1;}}}function a24_0x234d(){const _0x4f489e=['Error:\x20','map','863224TEgFKs','82YWeknH','5isxUsY','708872wuiVvA','72NlSsul','log','List\x20all\x20available\x20profiles','6091mBvJhN','640836brEBfg','995946ojaWMf','length','description','execute','285920gTeMHE','\x20\x20Global:\x20~/.config/tdx/tdx.json','1074924pQAINy','name','error','No\x20profiles\x20found.\x20Define\x20profiles\x20in\x20tdx.json:\x0a','scope','\x20\x20Local:\x20\x20(project\x20folder)/tdx.json','config'];a24_0x234d=function(){return _0x4f489e;};return a24_0x234d();}
@@ -1 +1 @@
1
- function a25_0x388c(_0x187c81,_0x48628c){_0x187c81=_0x187c81-0x109;const _0x279f92=a25_0x279f();let _0x388c4c=_0x279f92[_0x187c81];return _0x388c4c;}const a25_0x3a607c=a25_0x388c;(function(_0x35d07d,_0x56d28d){const _0x8c4cc=a25_0x388c,_0xd133d9=_0x35d07d();while(!![]){try{const _0x13dc39=parseInt(_0x8c4cc(0x128))/0x1*(parseInt(_0x8c4cc(0x10a))/0x2)+parseInt(_0x8c4cc(0x13c))/0x3+-parseInt(_0x8c4cc(0x11a))/0x4+parseInt(_0x8c4cc(0x129))/0x5+-parseInt(_0x8c4cc(0x138))/0x6*(parseInt(_0x8c4cc(0x117))/0x7)+-parseInt(_0x8c4cc(0x133))/0x8+-parseInt(_0x8c4cc(0x12f))/0x9*(-parseInt(_0x8c4cc(0x12b))/0xa);if(_0x13dc39===_0x56d28d)break;else _0xd133d9['push'](_0xd133d9['shift']());}catch(_0x1d2453){_0xd133d9['push'](_0xd133d9['shift']());}}}(a25_0x279f,0x8c818));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';import{handleQueryOutput,formatQueryOutput,resolveOutputOptions}from'../core/command-output.js';import{readSqlStatementsFromFile,readSqlStatementsFromStdin,splitSqlStatements,isSqlFilePath}from'../sdk/query/sql-parser.js';function a25_0x279f(){const _0x14f69b=['in\x20','Catalog:\x20','22563lOHUve','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','query','validate','239920EjACEY','processedRows','completedSplits','setExtra','setJobId','6EbldBU','stats','data','Cannot\x20specify\x20both\x20SQL\x20argument\x20and\x20--file\x20option','2102952vSmbRs','information_schema','Run\x20Trino\x20queries\x20(streaming)','6ZEQJut','Schema:\x20','verbose','Site:\x20','elapsedTimeMillis','site','output','Executing\x20statement\x20','Statement\x20','join','options','file','setPhase','3053134BmHIsc','No\x20SQL\x20provided','args','4179940TNvEad','...','\x20[Job\x20ID:\x20','description','catalog','\x20rows\x20','originalMessage','execute','SQL:\x20','length','\x20splits','jobId','message','name','265478PvWWNv','890415kbIQrP','\x20-\x20','1640GpzeSg','error'];a25_0x279f=function(){return _0x14f69b;};return a25_0x279f();}import{writeFileSync}from'fs';import{withProgressSpinner,formatElapsed}from'../utils/spinner.js';import{formatRows}from'../sdk/util/formatters.js';export class QueryCommand extends BaseCommand{[a25_0x3a607c(0x127)]='query';[a25_0x3a607c(0x11d)]=a25_0x3a607c(0x109);async['execute'](_0x41d102){const _0x30b8b6=a25_0x3a607c,{options:_0x149153,args:_0x1118d5,tdx:_0x236ff0}=_0x41d102,_0x27a9e0=_0x1118d5[0x0],_0x171f5d=_0x149153[_0x30b8b6(0x115)];let _0x3b1bcb;try{if(_0x171f5d)_0x3b1bcb=readSqlStatementsFromFile(_0x171f5d);else{if(_0x27a9e0==='-')_0x3b1bcb=await readSqlStatementsFromStdin();else{if(_0x27a9e0&&isSqlFilePath(_0x27a9e0))_0x3b1bcb=readSqlStatementsFromFile(_0x27a9e0);else{if(_0x27a9e0)_0x3b1bcb=splitSqlStatements(_0x27a9e0);else throw new Error(_0x30b8b6(0x118));}}}}catch(_0x26582b){return console[_0x30b8b6(0x12c)]('Error:\x20'+_0x26582b[_0x30b8b6(0x126)]),0x1;}const _0x1d2028=_0x149153['database']||_0x30b8b6(0x13d),_0x45ec54=_0x149153[_0x30b8b6(0x11e)];try{const _0x2ca4c3=[],_0x29fffd=!!_0x149153[_0x30b8b6(0x110)];for(let _0x4c906a=0x0;_0x4c906a<_0x3b1bcb[_0x30b8b6(0x123)];_0x4c906a++){const _0x23acd8=_0x3b1bcb[_0x4c906a],_0x548f88=_0x4c906a+0x1,_0x5ebeca=_0x3b1bcb[_0x30b8b6(0x123)],_0x2a6025=_0x5ebeca>0x1;_0x149153[_0x30b8b6(0x10c)]&&(console['error']('\x0a'+(_0x2a6025?_0x30b8b6(0x112)+_0x548f88+'/'+_0x5ebeca+':':'')),console['error'](_0x30b8b6(0x10d)+_0x149153[_0x30b8b6(0x10f)]),console[_0x30b8b6(0x12c)](_0x30b8b6(0x12e)+(_0x45ec54||'td')),console[_0x30b8b6(0x12c)](_0x30b8b6(0x10b)+_0x1d2028),console[_0x30b8b6(0x12c)](_0x30b8b6(0x122)+_0x23acd8));const _0x3c11f6=_0x2a6025?_0x30b8b6(0x111)+_0x548f88+'/'+_0x5ebeca+_0x30b8b6(0x11b):'Executing\x20query...';try{const _0x5db920=await withProgressSpinner(_0x3c11f6,async _0x1ba240=>{const _0x1bdd6c=_0x30b8b6,_0x2c6150=await _0x236ff0[_0x1bdd6c(0x131)][_0x1bdd6c(0x121)](_0x23acd8,{'catalog':_0x45ec54,'schema':_0x1d2028,'onJobId':_0x2573fa=>{const _0x4067b0=_0x1bdd6c;_0x1ba240[_0x4067b0(0x137)](_0x2573fa);},'onProgress':_0x58d452=>{const _0xb95adf=_0x1bdd6c;_0x1ba240[_0xb95adf(0x116)]('Executing\x20query\x20['+_0x58d452['state']+']'),_0x1ba240[_0xb95adf(0x136)](formatRows(_0x58d452[_0xb95adf(0x134)])+_0xb95adf(0x11f)+_0x58d452[_0xb95adf(0x135)]+'/'+_0x58d452['totalSplits']+_0xb95adf(0x124));}});return _0x2c6150;},{'verbose':_0x149153[_0x30b8b6(0x10c)]}),_0x4be59a=_0x5db920[_0x30b8b6(0x13a)],_0x3cb4eb=_0x4be59a[_0x30b8b6(0x125)]?_0x30b8b6(0x11c)+_0x4be59a[_0x30b8b6(0x125)]+']':'',_0x556def=_0x2a6025?_0x30b8b6(0x112)+_0x548f88+'/'+_0x5ebeca+_0x30b8b6(0x12a):'';console[_0x30b8b6(0x12c)]('✔\x20'+_0x556def+'Query\x20completed:\x20Processed\x20'+formatRows(_0x4be59a[_0x30b8b6(0x139)][_0x30b8b6(0x134)])+'\x20rows\x20'+(_0x30b8b6(0x12d)+formatElapsed(_0x4be59a[_0x30b8b6(0x139)][_0x30b8b6(0x10e)])+_0x3cb4eb));if(_0x2a6025&&_0x29fffd){const _0x938f3=resolveOutputOptions(_0x149153),_0x2f7f24=await formatQueryOutput(_0x4be59a,_0x938f3);_0x2ca4c3['push'](_0x2f7f24);}else await handleQueryOutput(_0x4be59a,_0x149153);}catch(_0x406c1c){const _0x56cf06=_0x2a6025?_0x30b8b6(0x112)+_0x548f88+'/'+_0x5ebeca+':\x0a':'',_0x432375=_0x406c1c instanceof SDKError?_0x406c1c[_0x30b8b6(0x120)]:_0x406c1c[_0x30b8b6(0x126)];return console[_0x30b8b6(0x12c)](''+_0x56cf06+_0x432375),0x1;}}if(_0x3b1bcb[_0x30b8b6(0x123)]>0x1&&_0x29fffd&&_0x2ca4c3[_0x30b8b6(0x123)]>0x0){const _0x272795=_0x2ca4c3[_0x30b8b6(0x113)]('\x0a');writeFileSync(_0x149153[_0x30b8b6(0x110)],_0x272795),console[_0x30b8b6(0x12c)]('\x0aAll\x20results\x20saved\x20to\x20'+_0x149153[_0x30b8b6(0x110)]);}return 0x0;}catch(_0x5c4ff4){throw _0x5c4ff4;}}[a25_0x3a607c(0x132)](_0x341429){const _0x426ff2=a25_0x3a607c,_0x24619e=_0x341429[_0x426ff2(0x119)][0x0],_0x5aa280=_0x341429[_0x426ff2(0x114)][_0x426ff2(0x115)];if(!_0x24619e&&!_0x5aa280)return _0x426ff2(0x130);if(_0x24619e&&_0x5aa280)return _0x426ff2(0x13b);return undefined;}}
1
+ const a25_0x3458df=a25_0x1e54;(function(_0x33b547,_0x1f9603){const _0x2809d0=a25_0x1e54,_0x221d33=_0x33b547();while(!![]){try{const _0x31af59=-parseInt(_0x2809d0(0x186))/0x1+-parseInt(_0x2809d0(0x179))/0x2*(-parseInt(_0x2809d0(0x191))/0x3)+parseInt(_0x2809d0(0x196))/0x4*(-parseInt(_0x2809d0(0x189))/0x5)+-parseInt(_0x2809d0(0x18f))/0x6*(parseInt(_0x2809d0(0x1a4))/0x7)+-parseInt(_0x2809d0(0x190))/0x8*(-parseInt(_0x2809d0(0x197))/0x9)+parseInt(_0x2809d0(0x18d))/0xa+-parseInt(_0x2809d0(0x181))/0xb;if(_0x31af59===_0x1f9603)break;else _0x221d33['push'](_0x221d33['shift']());}catch(_0x227b43){_0x221d33['push'](_0x221d33['shift']());}}}(a25_0x2b9a,0x863f3));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';import{handleQueryOutput,formatQueryOutput,resolveOutputOptions}from'../core/command-output.js';import{readSqlStatementsFromFile,readSqlStatementsFromStdin,splitSqlStatements,isSqlFilePath}from'../sdk/query/sql-parser.js';function a25_0x1e54(_0xf3f8e2,_0x54c151){_0xf3f8e2=_0xf3f8e2-0x178;const _0x2b9a65=a25_0x2b9a();let _0x1e54c1=_0x2b9a65[_0xf3f8e2];return _0x1e54c1;}import{writeFileSync}from'fs';function a25_0x2b9a(){const _0x40abaa=['11356268OmnPHQ','completedSplits','error','jobId','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','96962TUpOsE','Cannot\x20specify\x20both\x20SQL\x20argument\x20and\x20--file\x20option','query','5Tvjsbx','Statement\x20','setPhase','Executing\x20statement\x20','3082760ZtVrfY','SQL:\x20','10524OgrYsZ','8VxBHAC','1049211Vfdlfu','site','\x0aAll\x20results\x20saved\x20to\x20','args','stats','968548vzaXpr','7663779jYQYtO','setJobId','output','\x20rows\x20','Site:\x20','originalMessage','processedRows','name','Catalog:\x20','message','push','database','Executing\x20query\x20[','1148AEWyST','description','execute','Schema:\x20','\x20splits','file','data','...','validate','verbose','6kAcrjb','options','setExtra','elapsedTimeMillis','length','\x20[Job\x20ID:\x20','Run\x20Trino\x20queries\x20(streaming)','totalSplits'];a25_0x2b9a=function(){return _0x40abaa;};return a25_0x2b9a();}import{withProgressSpinner,formatElapsed}from'../utils/spinner.js';import{formatRows}from'../sdk/util/formatters.js';export class QueryCommand extends BaseCommand{[a25_0x3458df(0x19e)]=a25_0x3458df(0x188);[a25_0x3458df(0x1a5)]=a25_0x3458df(0x17f);async[a25_0x3458df(0x1a6)](_0x4b0f7e){const _0x6df447=a25_0x3458df,{options:_0x59d660,args:_0x456f5d,tdx:_0xa8f739}=_0x4b0f7e,_0x553b33=_0x456f5d[0x0],_0x587911=_0x59d660['file'];let _0x23bad8;try{if(_0x587911)_0x23bad8=readSqlStatementsFromFile(_0x587911);else{if(_0x553b33==='-')_0x23bad8=await readSqlStatementsFromStdin();else{if(_0x553b33&&isSqlFilePath(_0x553b33))_0x23bad8=readSqlStatementsFromFile(_0x553b33);else{if(_0x553b33)_0x23bad8=splitSqlStatements(_0x553b33);else throw new Error('No\x20SQL\x20provided');}}}}catch(_0x3a0cbf){return console[_0x6df447(0x183)]('Error:\x20'+_0x3a0cbf[_0x6df447(0x1a0)]),0x1;}const _0x127f6f=_0x59d660[_0x6df447(0x1a2)]||'information_schema',_0x167ec2=_0x59d660['catalog'];try{const _0x268ccc=[],_0x56d9be=!!_0x59d660[_0x6df447(0x199)];for(let _0x1c0604=0x0;_0x1c0604<_0x23bad8[_0x6df447(0x17d)];_0x1c0604++){const _0x4864eb=_0x23bad8[_0x1c0604],_0x44ddec=_0x1c0604+0x1,_0x3325a4=_0x23bad8['length'],_0x1bbfcf=_0x3325a4>0x1;_0x59d660[_0x6df447(0x178)]&&(console[_0x6df447(0x183)]('\x0a'+(_0x1bbfcf?'Statement\x20'+_0x44ddec+'/'+_0x3325a4+':':'')),console[_0x6df447(0x183)](_0x6df447(0x19b)+_0x59d660[_0x6df447(0x192)]),console['error'](_0x6df447(0x19f)+(_0x167ec2||'td')),console[_0x6df447(0x183)](_0x6df447(0x1a7)+_0x127f6f),console[_0x6df447(0x183)](_0x6df447(0x18e)+_0x4864eb));const _0x302907=_0x1bbfcf?_0x6df447(0x18c)+_0x44ddec+'/'+_0x3325a4+_0x6df447(0x1ab):'Executing\x20query...';try{const _0x30eeaa=await withProgressSpinner(_0x302907,async _0x48348f=>{const _0x55b1f6=_0x6df447,_0x372312=await _0xa8f739['query'][_0x55b1f6(0x1a6)](_0x4864eb,{'catalog':_0x167ec2,'schema':_0x127f6f,'onJobId':_0x26eff7=>{const _0x3133d4=_0x55b1f6;_0x48348f[_0x3133d4(0x198)](_0x26eff7);},'onProgress':_0xb2d9a5=>{const _0x2a6de7=_0x55b1f6;_0x48348f[_0x2a6de7(0x18b)](_0x2a6de7(0x1a3)+_0xb2d9a5['state']+']'),_0x48348f[_0x2a6de7(0x17b)](formatRows(_0xb2d9a5[_0x2a6de7(0x19d)])+_0x2a6de7(0x19a)+_0xb2d9a5[_0x2a6de7(0x182)]+'/'+_0xb2d9a5[_0x2a6de7(0x180)]+_0x2a6de7(0x1a8));}});return _0x372312;},{'verbose':_0x59d660[_0x6df447(0x178)]}),_0x2edd86=_0x30eeaa[_0x6df447(0x1aa)],_0x32f982=_0x2edd86[_0x6df447(0x184)]?_0x6df447(0x17e)+_0x2edd86[_0x6df447(0x184)]+']':'',_0x93ea70=_0x1bbfcf?_0x6df447(0x18a)+_0x44ddec+'/'+_0x3325a4+'\x20-\x20':'';console['error']('✔\x20'+_0x93ea70+'Query\x20completed:\x20Processed\x20'+formatRows(_0x2edd86[_0x6df447(0x195)][_0x6df447(0x19d)])+'\x20rows\x20'+('in\x20'+formatElapsed(_0x2edd86[_0x6df447(0x195)][_0x6df447(0x17c)])+_0x32f982));if(_0x1bbfcf&&_0x56d9be){const _0x4fe72b=resolveOutputOptions(_0x59d660),_0x2a219d=await formatQueryOutput(_0x2edd86,_0x4fe72b);_0x268ccc[_0x6df447(0x1a1)](_0x2a219d);}else await handleQueryOutput(_0x2edd86,_0x59d660);}catch(_0x528f2e){const _0x3b7994=_0x1bbfcf?_0x6df447(0x18a)+_0x44ddec+'/'+_0x3325a4+':\x0a':'',_0x52d3dd=_0x528f2e instanceof SDKError?_0x528f2e[_0x6df447(0x19c)]:_0x528f2e[_0x6df447(0x1a0)];return console[_0x6df447(0x183)](''+_0x3b7994+_0x52d3dd),0x1;}}if(_0x23bad8['length']>0x1&&_0x56d9be&&_0x268ccc[_0x6df447(0x17d)]>0x0){const _0x2c3cc5=_0x268ccc['join']('\x0a');writeFileSync(_0x59d660['output'],_0x2c3cc5),console[_0x6df447(0x183)](_0x6df447(0x193)+_0x59d660['output']);}return 0x0;}catch(_0xc364e1){throw _0xc364e1;}}[a25_0x3458df(0x1ac)](_0x4e6c7a){const _0x3b564e=a25_0x3458df,_0x5dddeb=_0x4e6c7a[_0x3b564e(0x194)][0x0],_0x13007b=_0x4e6c7a[_0x3b564e(0x17a)][_0x3b564e(0x1a9)];if(!_0x5dddeb&&!_0x13007b)return _0x3b564e(0x185);if(_0x5dddeb&&_0x13007b)return _0x3b564e(0x187);return undefined;}}
@@ -1 +1 @@
1
- const a26_0x56e718=a26_0x2273;(function(_0x553828,_0x2568d9){const _0x31faee=a26_0x2273,_0x223a6a=_0x553828();while(!![]){try{const _0x2d39c4=parseInt(_0x31faee(0x118))/0x1+parseInt(_0x31faee(0x105))/0x2+parseInt(_0x31faee(0xf8))/0x3*(parseInt(_0x31faee(0x12c))/0x4)+-parseInt(_0x31faee(0xf5))/0x5*(parseInt(_0x31faee(0x13c))/0x6)+parseInt(_0x31faee(0xea))/0x7+parseInt(_0x31faee(0xe2))/0x8+parseInt(_0x31faee(0x136))/0x9*(-parseInt(_0x31faee(0x157))/0xa);if(_0x2d39c4===_0x2568d9)break;else _0x223a6a['push'](_0x223a6a['shift']());}catch(_0x5b4f57){_0x223a6a['push'](_0x223a6a['shift']());}}}(a26_0x3589,0x500cc));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';function a26_0x2273(_0x2c4abc,_0x205b1d){_0x2c4abc=_0x2c4abc-0xe2;const _0x3589e6=a26_0x3589();let _0x22734d=_0x3589e6[_0x2c4abc];return _0x22734d;}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_0x27ab04 from'chalk';function formatRelativeTime(_0x576ed0){const _0x292466=a26_0x2273,_0x4a4e79=new Date(_0x576ed0),_0x444733=new Date(),_0x505f87=_0x4a4e79[_0x292466(0x15a)]()-_0x444733[_0x292466(0x15a)](),_0x119aa3=Math['abs'](_0x505f87)/0x3e8,_0x37a9c9=_0x505f87<0x0;if(_0x119aa3<0x3c)return _0x37a9c9?_0x292466(0x16a):_0x292466(0x16e);else{if(_0x119aa3<0xe10){const _0x5621cc=Math[_0x292466(0xf7)](_0x119aa3/0x3c);return _0x37a9c9?_0x5621cc+_0x292466(0x10a):_0x292466(0x15e)+_0x5621cc+'m';}else{if(_0x119aa3<0x15180){const _0x407d27=Math[_0x292466(0xf7)](_0x119aa3/0xe10);return _0x37a9c9?_0x407d27+_0x292466(0x129):_0x292466(0x15e)+_0x407d27+'h';}else{if(_0x119aa3<0x93a80){const _0x383c5a=Math[_0x292466(0xf7)](_0x119aa3/0x15180);return _0x37a9c9?_0x383c5a+_0x292466(0x101):'in\x20'+_0x383c5a+'d';}else return _0x4a4e79[_0x292466(0x12a)]();}}}}export class ScheduleListCommand extends BaseCommand{['name']=a26_0x56e718(0x16d);['description']='List\x20scheduled\x20queries';async[a26_0x56e718(0x159)](_0xde3c53){const _0x512276=a26_0x56e718,{options:_0x1f036a,args:_0x36b9fd,tdx:_0x169282}=_0xde3c53,_0x5d85c4=resolveLimit(_0x1f036a['limit'],DEFAULT_DISPLAY_LIMIT),_0x44b376=_0x36b9fd[0x0],_0x47e986=_0x44b376?_0x512276(0x144)+_0x44b376+_0x512276(0x16c):'Listing\x20scheduled\x20queries...',_0x206802=await withSpinner(_0x47e986,()=>_0x169282['schedules'][_0x512276(0x13f)]({'limit':_0x5d85c4,'scheduled':!![],'pattern':_0x44b376}),{'verbose':_0x1f036a[_0x512276(0x163)]}),_0x2bc5e3=_0x206802[_0x512276(0x102)][_0x512276(0x130)],_0x5a8869=_0x206802[_0x512276(0x102)][_0x512276(0x15f)]['has_next_page'],_0x4195ed=_0x44b376?_0x512276(0x173)+_0x44b376+'\x22':'';_0x5a8869?console[_0x512276(0x14f)](_0x512276(0x16b)+_0x2bc5e3[_0x512276(0x110)]+'\x20schedules'+_0x4195ed+'\x20(use\x20--limit\x20to\x20see\x20more)'):console[_0x512276(0x14f)](_0x512276(0x11e)+_0x2bc5e3[_0x512276(0x110)]+_0x512276(0x11d)+(_0x2bc5e3[_0x512276(0x110)]!==0x1?'ies':'y')+_0x4195ed);if(_0x1f036a[_0x512276(0x15d)]===_0x512276(0x162)||_0x1f036a[_0x512276(0x15d)]==='jsonl'||_0x1f036a['format']===_0x512276(0xf0)||_0x1f036a[_0x512276(0x15d)]===_0x512276(0x169)){const _0x57ebfa=_0x2bc5e3[_0x512276(0x10d)](_0x113c0e=>({'id':_0x113c0e['id'],'name':_0x113c0e[_0x512276(0x158)],'cron':_0x113c0e[_0x512276(0x124)],'database':_0x113c0e[_0x512276(0xed)]?.[_0x512276(0x158)],'type':_0x113c0e['type'],'timezone':_0x113c0e[_0x512276(0xe5)],'user_name':_0x113c0e['user']?.[_0x512276(0x158)],'updated_at':_0x113c0e[_0x512276(0x109)],'next_run_at':_0x113c0e[_0x512276(0x138)],'last_job_status':_0x113c0e[_0x512276(0x154)]?.[_0x512276(0xec)]}));await handleSDKOutput(_0x57ebfa,_0x1f036a);}else{if(_0x2bc5e3[_0x512276(0x110)]===0x0)console[_0x512276(0x146)](_0x512276(0x133));else{const _0x1edab1=_0x1f036a['site'],_0x33a80d=_0x2bc5e3['map'](_0x15e59c=>{const _0x4fb135=_0x512276,_0x244a90=_0x15e59c[_0x4fb135(0x154)]?.['status']?_0x15e59c[_0x4fb135(0x154)][_0x4fb135(0xec)]==='success'?'✓':'✗':'-',_0x50abfd=_0x15e59c[_0x4fb135(0x154)]?.[_0x4fb135(0x170)]?formatRelativeTime(_0x15e59c[_0x4fb135(0x154)]['ended_at']):_0x4fb135(0x112),_0x19fff0=_0x15e59c[_0x4fb135(0x138)]?formatRelativeTime(_0x15e59c['next_run_at']):'-',_0x471f4c=_0x15e59c[_0x4fb135(0x124)]||'',_0x234188=_0x15e59c[_0x4fb135(0x158)]||_0x4fb135(0xe8),_0x56bf09=getConsoleUrl(_0x1edab1,_0x4fb135(0x152)+_0x15e59c['id']);return{'statusIcon':_0x244a90,'lastRun':_0x50abfd,'nextRun':_0x19fff0,'cron':_0x471f4c,'name':_0x234188,'queryUrl':_0x56bf09,'status':_0x15e59c[_0x4fb135(0x154)]?.[_0x4fb135(0xec)]};}),_0x4153c1=Math[_0x512276(0xfb)](..._0x33a80d['map'](_0x219ea2=>_0x219ea2[_0x512276(0xf6)][_0x512276(0x110)])),_0x77c143=Math[_0x512276(0xfb)](..._0x33a80d['map'](_0xc51794=>_0xc51794[_0x512276(0x113)][_0x512276(0x110)])),_0x3ea41d=Math[_0x512276(0xfb)](..._0x33a80d['map'](_0x167595=>_0x167595[_0x512276(0x124)]['length'])),_0x1d4b05=_0x33a80d[_0x512276(0x10d)](_0x42ace2=>{const _0x5eb276=_0x512276,_0x5056b0=_0x42ace2[_0x5eb276(0xec)]===_0x5eb276(0x142)?a26_0x27ab04[_0x5eb276(0xfc)](_0x42ace2[_0x5eb276(0xee)]):_0x42ace2['status']==='error'?a26_0x27ab04[_0x5eb276(0xf2)](_0x42ace2[_0x5eb276(0xee)]):a26_0x27ab04[_0x5eb276(0x13b)](_0x42ace2[_0x5eb276(0xee)]),_0x58acaf=_0x42ace2[_0x5eb276(0xf6)]['padEnd'](_0x4153c1),_0x31fcab=_0x42ace2[_0x5eb276(0x113)][_0x5eb276(0x155)](_0x77c143),_0x3b97b4=_0x42ace2[_0x5eb276(0x124)]?a26_0x27ab04[_0x5eb276(0x11c)](_0x42ace2[_0x5eb276(0x124)][_0x5eb276(0x155)](_0x3ea41d)):'\x20'[_0x5eb276(0x140)](_0x3ea41d),_0x4e0e6b=hyperlink(_0x42ace2[_0x5eb276(0x158)],_0x42ace2[_0x5eb276(0xf3)]);return _0x5eb276(0x14a)+_0x5056b0+'\x20'+_0x58acaf+_0x5eb276(0x14d)+_0x31fcab+'\x20\x20'+_0x3b97b4+'\x20\x20'+_0x4e0e6b;});await writeOutput(_0x1d4b05[_0x512276(0x100)]('\x0a'),_0x1f036a[_0x512276(0x115)],_0x512276(0x108));}}return 0x0;}}export class ScheduleShowCommand extends BaseCommand{[a26_0x56e718(0x158)]=a26_0x56e718(0x166);['description']='Show\x20schedule\x20details';[a26_0x56e718(0x116)](_0x4ebe5e){const _0xe5ccd1=a26_0x56e718,_0x26ad85=_0x4ebe5e[_0xe5ccd1(0x15b)][0x0];if(!_0x26ad85)return'Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20show\x20<name>';return undefined;}async[a26_0x56e718(0x159)](_0xfc3216){const _0x32b4b7=a26_0x56e718,{options:_0x4e6619,args:_0x34c57c,tdx:_0x342a0c}=_0xfc3216,_0x51dea2=_0x34c57c[0x0],_0x1aa549=await withSpinner(_0x32b4b7(0x131),()=>_0x342a0c[_0x32b4b7(0x160)][_0x32b4b7(0xfa)](_0x51dea2),{'verbose':_0x4e6619[_0x32b4b7(0x163)]}),_0x5d58b3=_0x1aa549['data'],_0x18fb55={'name':_0x5d58b3[_0x32b4b7(0x158)],'cron':_0x5d58b3[_0x32b4b7(0x124)],'database':_0x5d58b3[_0x32b4b7(0xed)],'type':_0x5d58b3[_0x32b4b7(0x127)],'timezone':_0x5d58b3[_0x32b4b7(0x117)],'user_name':_0x5d58b3[_0x32b4b7(0x150)],'created_at':_0x5d58b3[_0x32b4b7(0x106)],'engine_version':_0x5d58b3['engine_version'],'executing_user_id':_0x5d58b3[_0x32b4b7(0xeb)],'query':_0x5d58b3[_0x32b4b7(0x126)],'delay':_0x5d58b3[_0x32b4b7(0x153)],'priority':_0x5d58b3[_0x32b4b7(0x120)],'retry_limit':_0x5d58b3['retry_limit'],..._0x5d58b3[_0x32b4b7(0x107)]&&{'result':_0x5d58b3[_0x32b4b7(0x107)]}};return await handleSingleObjectOutput(_0x18fb55,_0x4e6619),0x0;}}export class ScheduleCreateCommand extends BaseCommand{[a26_0x56e718(0x158)]=a26_0x56e718(0x10f);['description']=a26_0x56e718(0x12b);['validate'](_0x1929a7){const _0x37c6bf=a26_0x56e718,_0x1bbc1c=_0x1929a7[_0x37c6bf(0x15b)][0x0];if(!_0x1bbc1c)return _0x37c6bf(0x14e);return undefined;}async[a26_0x56e718(0x159)](_0x30f72f){const _0x22ba9e=a26_0x56e718,{options:_0x14ca9c,args:_0xb3ba08,tdx:_0x1eb8f7}=_0x30f72f,_0x287606=_0xb3ba08[0x0],_0x27ecdd=_0x14ca9c,_0x2e9e4e=_0x27ecdd['database'],_0x584abb=_0x27ecdd[_0x22ba9e(0x14b)],_0xe9bee3=_0x27ecdd[_0x22ba9e(0x127)]||_0x22ba9e(0xf1);let _0xffd630;try{_0xffd630=readFileSync(_0x584abb,'utf-8')['trim']();}catch(_0x217618){throw new SDKError(ErrorCode['INVALID_ARGUMENT'],'Failed\x20to\x20read\x20file:\x20'+_0x584abb,_0x217618 instanceof Error?_0x217618:undefined);}if(!_0xffd630)throw new SDKError(ErrorCode[_0x22ba9e(0x128)],_0x22ba9e(0x12d));const _0x495817={'database':_0x2e9e4e,'query':_0xffd630,'type':_0xe9bee3};if(_0x27ecdd[_0x22ba9e(0x124)])_0x495817[_0x22ba9e(0x124)]=_0x27ecdd[_0x22ba9e(0x124)];if(_0x27ecdd[_0x22ba9e(0x117)])_0x495817[_0x22ba9e(0x117)]=_0x27ecdd[_0x22ba9e(0x117)];if(_0x27ecdd['delay']!==undefined)_0x495817[_0x22ba9e(0x153)]=Number(_0x27ecdd[_0x22ba9e(0x153)]);if(_0x27ecdd[_0x22ba9e(0x120)]!==undefined)_0x495817['priority']=Number(_0x27ecdd['priority']);if(_0x27ecdd[_0x22ba9e(0x10e)]!==undefined)_0x495817['retry_limit']=Number(_0x27ecdd[_0x22ba9e(0x10e)]);if(_0x27ecdd['engineVersion'])_0x495817[_0x22ba9e(0xff)]=_0x27ecdd[_0x22ba9e(0xf4)];if(_0x27ecdd[_0x22ba9e(0x107)])_0x495817['result']=_0x27ecdd[_0x22ba9e(0x107)];if(_0x14ca9c['verbose']){console[_0x22ba9e(0x14f)](_0x22ba9e(0x15c)+_0x287606),console[_0x22ba9e(0x14f)](_0x22ba9e(0x14c)+_0x2e9e4e),console[_0x22ba9e(0x14f)](_0x22ba9e(0x145)+_0xe9bee3);if(_0x495817[_0x22ba9e(0x124)])console['error'](_0x22ba9e(0x104)+_0x495817[_0x22ba9e(0x124)]);if(_0x495817[_0x22ba9e(0x117)])console[_0x22ba9e(0x14f)](_0x22ba9e(0x12f)+_0x495817['timezone']);}const _0xa5c884=await withSpinner(_0x22ba9e(0x156),()=>_0x1eb8f7[_0x22ba9e(0x160)][_0x22ba9e(0x149)](_0x287606,_0x495817),{'verbose':_0x14ca9c[_0x22ba9e(0x163)]});return console[_0x22ba9e(0x14f)](_0x22ba9e(0xe7)+_0xa5c884[_0x22ba9e(0x102)][_0x22ba9e(0x158)]),await handleSingleObjectOutput(_0xa5c884['data'],_0x14ca9c),0x0;}}export class ScheduleUpdateCommand extends BaseCommand{['name']=a26_0x56e718(0x10c);[a26_0x56e718(0x161)]=a26_0x56e718(0x139);[a26_0x56e718(0x116)](_0x20d0a4){const _0x2ee098=a26_0x56e718,_0x14fd9a=_0x20d0a4[_0x2ee098(0x15b)][0x0];if(!_0x14fd9a)return _0x2ee098(0xe9);return undefined;}async[a26_0x56e718(0x159)](_0x30c167){const _0x264f81=a26_0x56e718,{options:_0x2ccb08,args:_0x401979,tdx:_0x488a5c}=_0x30c167,_0x248168=_0x401979[0x0],_0x3ae50d=_0x2ccb08,_0x26b13c={};if(_0x3ae50d[_0x264f81(0xed)])_0x26b13c[_0x264f81(0xed)]=_0x3ae50d['database'];if(_0x3ae50d[_0x264f81(0x127)])_0x26b13c[_0x264f81(0x127)]=_0x3ae50d['type'];if(_0x3ae50d[_0x264f81(0x124)])_0x26b13c[_0x264f81(0x124)]=_0x3ae50d[_0x264f81(0x124)];if(_0x3ae50d[_0x264f81(0x117)])_0x26b13c[_0x264f81(0x117)]=_0x3ae50d[_0x264f81(0x117)];if(_0x3ae50d[_0x264f81(0x153)]!==undefined)_0x26b13c[_0x264f81(0x153)]=Number(_0x3ae50d[_0x264f81(0x153)]);if(_0x3ae50d['priority']!==undefined)_0x26b13c['priority']=Number(_0x3ae50d[_0x264f81(0x120)]);if(_0x3ae50d[_0x264f81(0x10e)]!==undefined)_0x26b13c[_0x264f81(0x122)]=Number(_0x3ae50d['retryLimit']);if(_0x3ae50d['engineVersion'])_0x26b13c[_0x264f81(0xff)]=_0x3ae50d[_0x264f81(0xf4)];if(_0x3ae50d[_0x264f81(0x107)])_0x26b13c['result']=_0x3ae50d[_0x264f81(0x107)];if(_0x3ae50d['file'])try{_0x26b13c['query']=readFileSync(_0x3ae50d[_0x264f81(0x14b)],_0x264f81(0xfe))[_0x264f81(0xe6)]();}catch(_0x26a7ac){throw new SDKError(ErrorCode[_0x264f81(0x128)],'Failed\x20to\x20read\x20file:\x20'+_0x3ae50d[_0x264f81(0x14b)],_0x26a7ac instanceof Error?_0x26a7ac:undefined);}if(Object[_0x264f81(0x125)](_0x26b13c)[_0x264f81(0x110)]===0x0)throw new SDKError(ErrorCode[_0x264f81(0x128)],_0x264f81(0x164));if(_0x2ccb08[_0x264f81(0x163)]){console[_0x264f81(0x14f)](_0x264f81(0xe3)+_0x248168);for(const [_0x58706e,_0x2460a1]of Object[_0x264f81(0x171)](_0x26b13c)){_0x58706e==='query'?console[_0x264f81(0x14f)]('\x20\x20'+_0x58706e+':\x20'+_0x2460a1['substring'](0x0,0x32)+_0x264f81(0x148)):console[_0x264f81(0x14f)]('\x20\x20'+_0x58706e+':\x20'+_0x2460a1);}}const _0x1190db=await withSpinner(_0x264f81(0x172),()=>_0x488a5c[_0x264f81(0x160)][_0x264f81(0x11f)](_0x248168,_0x26b13c),{'verbose':_0x2ccb08['verbose']});return console[_0x264f81(0x14f)]('Schedule\x20updated:\x20'+_0x1190db[_0x264f81(0x102)]['name']),await handleSingleObjectOutput(_0x1190db['data'],_0x2ccb08),0x0;}}export class ScheduleDeleteCommand extends BaseCommand{[a26_0x56e718(0x158)]='schedule:delete';['description']=a26_0x56e718(0x151);[a26_0x56e718(0x116)](_0x27fd7f){const _0x160676=a26_0x56e718,_0x2bc5cf=_0x27fd7f['args'][0x0];if(!_0x2bc5cf)return _0x160676(0x167);return undefined;}async['execute'](_0x48c921){const _0x147b55=a26_0x56e718,{options:_0x3d6ecd,args:_0x2ad61e,tdx:_0x5dc1f2}=_0x48c921,_0x243bac=_0x2ad61e[0x0];if(!_0x3d6ecd[_0x147b55(0xf9)]){const _0x10e200=await confirm(_0x147b55(0x137)+_0x243bac+'\x22?');if(!_0x10e200)return console[_0x147b55(0x14f)](_0x147b55(0x135)),0x0;}const _0x11ee86=await withSpinner(_0x147b55(0x114),()=>_0x5dc1f2[_0x147b55(0x160)][_0x147b55(0x134)](_0x243bac),{'verbose':_0x3d6ecd[_0x147b55(0x163)]});return console['error'](_0x147b55(0xef)+_0x11ee86[_0x147b55(0x102)][_0x147b55(0x158)]),0x0;}}function a26_0x3589(){const _0x27ef09=['schedules','description','json','verbose','At\x20least\x20one\x20option\x20must\x20be\x20provided\x20to\x20update','\x20execution','schedule:show','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20delete\x20<name>','history','tsv','just\x20now','Showing\x20first\x20','\x22...','schedule:list','soon','scheduled_at','ended_at','entries','Updating\x20schedule...','\x20matching\x20\x22','1427464PxRmVq','Updating\x20schedule:\x20','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20history\x20<name>\x20[--from\x20<n>]\x20[--to\x20<n>]','time_zone','trim','Schedule\x20created:\x20','(unnamed)','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20update\x20<name>\x20[options]','98329ypcWLA','executing_user_id','status','database','statusIcon','Schedule\x20deleted:\x20','table','trino','red','queryUrl','engineVersion','5eOQEis','lastRun','round','39YwbAhK','yes','show','max','green','\x20\x20Job\x20ID:\x20','utf-8','engine_version','join','d\x20ago','data','\x20\x20Time:\x20','\x20\x20Cron:\x20','1200596qTlxIT','created_at','result','list','updated_at','m\x20ago','start_at','schedule:update','map','retryLimit','schedule:create','length','Running\x20schedule:\x20','never','nextRun','Deleting\x20schedule...','output','validate','timezone','13845USKoAN','Schedule\x20run\x20submitted:\x20','schedule:history','from','cyan','\x20scheduled\x20quer','Found\x20','update','priority','Run\x20a\x20scheduled\x20query\x20immediately','retry_limit','\x20(showing\x20','cron','keys','query','type','INVALID_ARGUMENT','h\x20ago','toLocaleDateString','Create\x20a\x20scheduled\x20query','181420smALOq','Query\x20file\x20is\x20empty','\x20\x20Num:\x20','\x20\x20Timezone:\x20','queries','Getting\x20schedule\x20details...','job_id','No\x20scheduled\x20queries\x20found','delete','Cancelled','72aBQCQz','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20schedule\x20\x22','next_run_at','Update\x20a\x20scheduled\x20query','Getting\x20schedule\x20history...','dim','3736668kgbaFV','count','num','listQueries','repeat','end_at','success','\x20created','Searching\x20scheduled\x20queries\x20matching\x20\x22','\x20\x20Type:\x20','log','schedule:run','...','create','📅\x20','file','\x20\x20Database:\x20','\x20\x20→\x20','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]','error','user_name','Delete\x20a\x20scheduled\x20query','/app/queries/editor?queryId=','delay','last_job','padEnd','Creating\x20schedule...','556970BEvJkY','name','execute','getTime','args','Creating\x20schedule:\x20','format','in\x20','pagination'];a26_0x3589=function(){return _0x27ef09;};return a26_0x3589();}export class ScheduleRunCommand extends BaseCommand{['name']=a26_0x56e718(0x147);['description']=a26_0x56e718(0x121);[a26_0x56e718(0x116)](_0x31bb2d){const _0x5493ee=a26_0x56e718,_0x40470d=_0x31bb2d[_0x5493ee(0x15b)][0x0];if(!_0x40470d)return'Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20run\x20<name>\x20[--time\x20<iso8601>]\x20[--num\x20<1-10>]';return undefined;}async[a26_0x56e718(0x159)](_0x745116){const _0x479eb9=a26_0x56e718,{options:_0x1e99e2,args:_0x22dbe2,tdx:_0x56fc8f}=_0x745116,_0x163f2e=_0x22dbe2[0x0],_0x5a09d4=_0x1e99e2,_0x5ca856=_0x5a09d4['time'],_0x3f775e=_0x5a09d4[_0x479eb9(0x13e)]!==undefined?Number(_0x5a09d4['num']):undefined;if(_0x1e99e2['verbose']){console[_0x479eb9(0x14f)](_0x479eb9(0x111)+_0x163f2e);if(_0x5ca856)console['error'](_0x479eb9(0x103)+_0x5ca856);if(_0x3f775e)console[_0x479eb9(0x14f)](_0x479eb9(0x12e)+_0x3f775e);}const _0x2572ad=await withSpinner('Running\x20schedule...',()=>_0x56fc8f[_0x479eb9(0x160)]['run'](_0x163f2e,{'time':_0x5ca856,'num':_0x3f775e}),{'verbose':_0x1e99e2['verbose']}),_0xf6c558=_0x2572ad[_0x479eb9(0x102)]['jobs'];console[_0x479eb9(0x14f)](_0x479eb9(0x119)+_0xf6c558[_0x479eb9(0x110)]+'\x20job'+(_0xf6c558[_0x479eb9(0x110)]!==0x1?'s':'')+_0x479eb9(0x143));for(const _0x56a9bb of _0xf6c558){console[_0x479eb9(0x14f)](_0x479eb9(0xfd)+_0x56a9bb[_0x479eb9(0x132)]);}return await handleSDKOutput(_0xf6c558,_0x1e99e2),0x0;}}export class ScheduleHistoryCommand extends BaseCommand{[a26_0x56e718(0x158)]=a26_0x56e718(0x11a);[a26_0x56e718(0x161)]='Show\x20schedule\x20execution\x20history';['validate'](_0x4d1085){const _0x4325ef=a26_0x56e718,_0x5a9321=_0x4d1085['args'][0x0];if(!_0x5a9321)return _0x4325ef(0xe4);return undefined;}async[a26_0x56e718(0x159)](_0x721ac6){const _0x58c536=a26_0x56e718,{options:_0x14b76e,args:_0x2f41bb,tdx:_0x56c7f2}=_0x721ac6,_0x56b06c=_0x2f41bb[0x0],_0x13ac80=_0x14b76e,_0x5b6656=_0x13ac80[_0x58c536(0x11b)]!==undefined?Number(_0x13ac80[_0x58c536(0x11b)]):undefined,_0x367c0b=_0x13ac80['to']!==undefined?Number(_0x13ac80['to']):undefined,_0x4c0df1=await withSpinner(_0x58c536(0x13a),()=>_0x56c7f2[_0x58c536(0x160)]['history'](_0x56b06c,{'from':_0x5b6656,'to':_0x367c0b}),{'verbose':_0x14b76e[_0x58c536(0x163)]}),_0x45643a=_0x4c0df1[_0x58c536(0x102)];console[_0x58c536(0x14f)]('Found\x20'+_0x45643a[_0x58c536(0x13d)]+_0x58c536(0x165)+(_0x45643a[_0x58c536(0x13d)]!==0x1?'s':'')+_0x58c536(0x123)+_0x45643a[_0x58c536(0x11b)]+'-'+_0x45643a['to']+')');const _0x38951e=_0x45643a[_0x58c536(0x168)][_0x58c536(0x10d)](_0xba0b0a=>({'job_id':_0xba0b0a[_0x58c536(0x132)],'type':_0xba0b0a[_0x58c536(0x127)],'status':_0xba0b0a['status'],'scheduled_at':_0xba0b0a[_0x58c536(0x16f)],'created_at':_0xba0b0a[_0x58c536(0x106)],'start_at':_0xba0b0a[_0x58c536(0x10b)],'end_at':_0xba0b0a[_0x58c536(0x141)]}));return await handleSDKOutput(_0x38951e,_0x14b76e),0x0;}}
1
+ const a26_0x4c9a44=a26_0x40d8;(function(_0x1574fe,_0x3911b2){const _0x19a75b=a26_0x40d8,_0x41d55a=_0x1574fe();while(!![]){try{const _0x521b34=-parseInt(_0x19a75b(0x20f))/0x1*(parseInt(_0x19a75b(0x1d8))/0x2)+-parseInt(_0x19a75b(0x1c8))/0x3*(-parseInt(_0x19a75b(0x1e9))/0x4)+parseInt(_0x19a75b(0x1ee))/0x5*(parseInt(_0x19a75b(0x1de))/0x6)+-parseInt(_0x19a75b(0x1b1))/0x7+parseInt(_0x19a75b(0x1b6))/0x8*(parseInt(_0x19a75b(0x1c4))/0x9)+-parseInt(_0x19a75b(0x1ca))/0xa*(-parseInt(_0x19a75b(0x18f))/0xb)+parseInt(_0x19a75b(0x1bb))/0xc*(parseInt(_0x19a75b(0x1cf))/0xd);if(_0x521b34===_0x3911b2)break;else _0x41d55a['push'](_0x41d55a['shift']());}catch(_0x4acec2){_0x41d55a['push'](_0x41d55a['shift']());}}}(a26_0x2229,0x2a4e4));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';function a26_0x2229(){const _0x4d2ccc=['padEnd','created_at','Schedule\x20created:\x20','Updating\x20schedule:\x20','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20update\x20<name>\x20[options]','queryUrl','Delete\x20a\x20scheduled\x20query','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]','status','run','name','has_next_page','\x20\x20Timezone:\x20','schedule:delete','\x20\x20Job\x20ID:\x20','ended_at','utf-8','Update\x20a\x20scheduled\x20query','\x20\x20→\x20','\x20created','Schedule\x20deleted:\x20','3iUCGYq','json','updated_at','delete','scheduled_at','last_job','schedule:update','toLocaleDateString','time_zone','135201vIyIHr','history','timezone','schedule:run','next_run_at','limit','statusIcon','Running\x20schedule...','getTime','round','delay','schedule:create','\x20(use\x20--limit\x20to\x20see\x20more)','Updating\x20schedule...','time','Running\x20schedule:\x20','max','priority','Getting\x20schedule\x20history...','type','output','Failed\x20to\x20read\x20file:\x20','(unnamed)','database','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20run\x20<name>\x20[--time\x20<iso8601>]\x20[--num\x20<1-10>]','At\x20least\x20one\x20option\x20must\x20be\x20provided\x20to\x20update','📅\x20','List\x20scheduled\x20queries','count','Run\x20a\x20scheduled\x20query\x20immediately','retryLimit','success','dim','Listing\x20scheduled\x20queries...','1478351QqqDFx','length','show','Schedule\x20updated:\x20','trim','8qWlyov','nextRun','map','query','result','348woDYIB','description','Searching\x20scheduled\x20queries\x20matching\x20\x22','\x20\x20Num:\x20','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20schedule\x20\x22','execute','site','executing_user_id','in\x20','978075iHYZkl','\x20(showing\x20','\x20scheduled\x20quer','\x20matching\x20\x22','554847jpHYDD','\x20\x20Type:\x20','190rbAGOT','jobs','create','cron','keys','26533MyRgPA','end_at','Query\x20file\x20is\x20empty','No\x20scheduled\x20queries\x20found','Schedule\x20run\x20submitted:\x20','Showing\x20first\x20','pagination','engine_version','schedule:show','154144ySkkFs','file','substring','soon','from','schedules','25158eHUpfV','repeat','table','list','green','\x20execution','validate','args','lastRun','Create\x20a\x20scheduled\x20query','engineVersion','4lsuLwt','retry_limit','verbose','error','entries','35yhaDxd','INVALID_ARGUMENT','Getting\x20schedule\x20details...','data','d\x20ago','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20delete\x20<name>','format','queries','red','user_name','listQueries','Show\x20schedule\x20execution\x20history'];a26_0x2229=function(){return _0x4d2ccc;};return a26_0x2229();}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_0x32e6d2 from'chalk';function formatRelativeTime(_0x5fa76e){const _0x4f08cb=a26_0x40d8,_0x5b54e2=new Date(_0x5fa76e),_0x1630fe=new Date(),_0x179ced=_0x5b54e2[_0x4f08cb(0x197)]()-_0x1630fe[_0x4f08cb(0x197)](),_0x3abf1f=Math['abs'](_0x179ced)/0x3e8,_0x181dda=_0x179ced<0x0;if(_0x3abf1f<0x3c)return _0x181dda?'just\x20now':_0x4f08cb(0x1db);else{if(_0x3abf1f<0xe10){const _0x15632e=Math[_0x4f08cb(0x198)](_0x3abf1f/0x3c);return _0x181dda?_0x15632e+'m\x20ago':_0x4f08cb(0x1c3)+_0x15632e+'m';}else{if(_0x3abf1f<0x15180){const _0x26f0f8=Math[_0x4f08cb(0x198)](_0x3abf1f/0xe10);return _0x181dda?_0x26f0f8+'h\x20ago':_0x4f08cb(0x1c3)+_0x26f0f8+'h';}else{if(_0x3abf1f<0x93a80){const _0x304cf7=Math[_0x4f08cb(0x198)](_0x3abf1f/0x15180);return _0x181dda?_0x304cf7+_0x4f08cb(0x1f2):_0x4f08cb(0x1c3)+_0x304cf7+'d';}else return _0x5b54e2[_0x4f08cb(0x18d)]();}}}}export class ScheduleListCommand extends BaseCommand{[a26_0x4c9a44(0x204)]='schedule:list';['description']=a26_0x4c9a44(0x1aa);async[a26_0x4c9a44(0x1c0)](_0x426829){const _0x3fddc6=a26_0x4c9a44,{options:_0x33ef70,args:_0x2b4eb5,tdx:_0x512d2f}=_0x426829,_0x264f0f=resolveLimit(_0x33ef70[_0x3fddc6(0x194)],DEFAULT_DISPLAY_LIMIT),_0x49a2f9=_0x2b4eb5[0x0],_0x54cb5a=_0x49a2f9?_0x3fddc6(0x1bd)+_0x49a2f9+'\x22...':_0x3fddc6(0x1b0),_0x478bf7=await withSpinner(_0x54cb5a,()=>_0x512d2f[_0x3fddc6(0x1dd)][_0x3fddc6(0x1f8)]({'limit':_0x264f0f,'scheduled':!![],'pattern':_0x49a2f9}),{'verbose':_0x33ef70[_0x3fddc6(0x1eb)]}),_0xd147e7=_0x478bf7[_0x3fddc6(0x1f1)][_0x3fddc6(0x1f5)],_0x4fc4fb=_0x478bf7[_0x3fddc6(0x1f1)][_0x3fddc6(0x1d5)][_0x3fddc6(0x205)],_0x1ba047=_0x49a2f9?_0x3fddc6(0x1c7)+_0x49a2f9+'\x22':'';_0x4fc4fb?console['error'](_0x3fddc6(0x1d4)+_0xd147e7[_0x3fddc6(0x1b2)]+'\x20schedules'+_0x1ba047+_0x3fddc6(0x19b)):console[_0x3fddc6(0x1ec)]('Found\x20'+_0xd147e7['length']+_0x3fddc6(0x1c6)+(_0xd147e7[_0x3fddc6(0x1b2)]!==0x1?'ies':'y')+_0x1ba047);if(_0x33ef70[_0x3fddc6(0x1f4)]===_0x3fddc6(0x210)||_0x33ef70['format']==='jsonl'||_0x33ef70[_0x3fddc6(0x1f4)]===_0x3fddc6(0x1e0)||_0x33ef70[_0x3fddc6(0x1f4)]==='tsv'){const _0x5dd8c5=_0xd147e7[_0x3fddc6(0x1b8)](_0x18f411=>({'id':_0x18f411['id'],'name':_0x18f411[_0x3fddc6(0x204)],'cron':_0x18f411[_0x3fddc6(0x1cd)],'database':_0x18f411['database']?.[_0x3fddc6(0x204)],'type':_0x18f411['type'],'timezone':_0x18f411[_0x3fddc6(0x18e)],'user_name':_0x18f411['user']?.['name'],'updated_at':_0x18f411[_0x3fddc6(0x211)],'next_run_at':_0x18f411['next_run_at'],'last_job_status':_0x18f411['last_job']?.['status']}));await handleSDKOutput(_0x5dd8c5,_0x33ef70);}else{if(_0xd147e7['length']===0x0)console['log'](_0x3fddc6(0x1d2));else{const _0x44e5b0=_0x33ef70[_0x3fddc6(0x1c1)],_0x1d5c8c=_0xd147e7[_0x3fddc6(0x1b8)](_0x2d78e1=>{const _0xe6994=_0x3fddc6,_0x3a2ee6=_0x2d78e1[_0xe6994(0x18b)]?.[_0xe6994(0x202)]?_0x2d78e1[_0xe6994(0x18b)][_0xe6994(0x202)]===_0xe6994(0x1ae)?'✓':'✗':'-',_0x286e1c=_0x2d78e1[_0xe6994(0x18b)]?.[_0xe6994(0x209)]?formatRelativeTime(_0x2d78e1[_0xe6994(0x18b)][_0xe6994(0x209)]):'never',_0x184771=_0x2d78e1[_0xe6994(0x193)]?formatRelativeTime(_0x2d78e1[_0xe6994(0x193)]):'-',_0x328fdb=_0x2d78e1[_0xe6994(0x1cd)]||'',_0x2ae63e=_0x2d78e1[_0xe6994(0x204)]||_0xe6994(0x1a5),_0xcbc4a0=getConsoleUrl(_0x44e5b0,'/app/queries/editor?queryId='+_0x2d78e1['id']);return{'statusIcon':_0x3a2ee6,'lastRun':_0x286e1c,'nextRun':_0x184771,'cron':_0x328fdb,'name':_0x2ae63e,'queryUrl':_0xcbc4a0,'status':_0x2d78e1[_0xe6994(0x18b)]?.[_0xe6994(0x202)]};}),_0x12bdec=Math[_0x3fddc6(0x19f)](..._0x1d5c8c[_0x3fddc6(0x1b8)](_0x5b9064=>_0x5b9064[_0x3fddc6(0x1e6)][_0x3fddc6(0x1b2)])),_0x5dab11=Math[_0x3fddc6(0x19f)](..._0x1d5c8c[_0x3fddc6(0x1b8)](_0x14a95c=>_0x14a95c['nextRun'][_0x3fddc6(0x1b2)])),_0x5b0d3a=Math[_0x3fddc6(0x19f)](..._0x1d5c8c['map'](_0x3ed358=>_0x3ed358[_0x3fddc6(0x1cd)]['length'])),_0x537f90=_0x1d5c8c[_0x3fddc6(0x1b8)](_0x34d67c=>{const _0x1d6e15=_0x3fddc6,_0x1e5a79=_0x34d67c['status']===_0x1d6e15(0x1ae)?a26_0x32e6d2[_0x1d6e15(0x1e2)](_0x34d67c[_0x1d6e15(0x195)]):_0x34d67c['status']===_0x1d6e15(0x1ec)?a26_0x32e6d2[_0x1d6e15(0x1f6)](_0x34d67c[_0x1d6e15(0x195)]):a26_0x32e6d2[_0x1d6e15(0x1af)](_0x34d67c['statusIcon']),_0x477d04=_0x34d67c[_0x1d6e15(0x1e6)][_0x1d6e15(0x1fa)](_0x12bdec),_0x53c58b=_0x34d67c[_0x1d6e15(0x1b7)][_0x1d6e15(0x1fa)](_0x5dab11),_0x5d9b2b=_0x34d67c[_0x1d6e15(0x1cd)]?a26_0x32e6d2['cyan'](_0x34d67c[_0x1d6e15(0x1cd)][_0x1d6e15(0x1fa)](_0x5b0d3a)):'\x20'[_0x1d6e15(0x1df)](_0x5b0d3a),_0x163abf=hyperlink(_0x34d67c[_0x1d6e15(0x204)],_0x34d67c[_0x1d6e15(0x1ff)]);return _0x1d6e15(0x1a9)+_0x1e5a79+'\x20'+_0x477d04+_0x1d6e15(0x20c)+_0x53c58b+'\x20\x20'+_0x5d9b2b+'\x20\x20'+_0x163abf;});await writeOutput(_0x537f90['join']('\x0a'),_0x33ef70[_0x3fddc6(0x1a3)],_0x3fddc6(0x1e1));}}return 0x0;}}export class ScheduleShowCommand extends BaseCommand{['name']=a26_0x4c9a44(0x1d7);[a26_0x4c9a44(0x1bc)]='Show\x20schedule\x20details';[a26_0x4c9a44(0x1e4)](_0x558966){const _0x306651=a26_0x4c9a44,_0xb44af2=_0x558966[_0x306651(0x1e5)][0x0];if(!_0xb44af2)return'Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20show\x20<name>';return undefined;}async['execute'](_0x53d249){const _0x472e6d=a26_0x4c9a44,{options:_0x15d5fd,args:_0x1b95ea,tdx:_0x16acd0}=_0x53d249,_0x15ce71=_0x1b95ea[0x0],_0x2e7e27=await withSpinner(_0x472e6d(0x1f0),()=>_0x16acd0['schedules'][_0x472e6d(0x1b3)](_0x15ce71),{'verbose':_0x15d5fd['verbose']}),_0x2cb67f=_0x2e7e27['data'],_0x1d7057={'name':_0x2cb67f[_0x472e6d(0x204)],'cron':_0x2cb67f[_0x472e6d(0x1cd)],'database':_0x2cb67f['database'],'type':_0x2cb67f[_0x472e6d(0x1a2)],'timezone':_0x2cb67f[_0x472e6d(0x191)],'user_name':_0x2cb67f[_0x472e6d(0x1f7)],'created_at':_0x2cb67f['created_at'],'engine_version':_0x2cb67f['engine_version'],'executing_user_id':_0x2cb67f[_0x472e6d(0x1c2)],'query':_0x2cb67f[_0x472e6d(0x1b9)],'delay':_0x2cb67f[_0x472e6d(0x199)],'priority':_0x2cb67f['priority'],'retry_limit':_0x2cb67f[_0x472e6d(0x1ea)],..._0x2cb67f[_0x472e6d(0x1ba)]&&{'result':_0x2cb67f[_0x472e6d(0x1ba)]}};return await handleSingleObjectOutput(_0x1d7057,_0x15d5fd),0x0;}}export class ScheduleCreateCommand extends BaseCommand{[a26_0x4c9a44(0x204)]=a26_0x4c9a44(0x19a);[a26_0x4c9a44(0x1bc)]=a26_0x4c9a44(0x1e7);[a26_0x4c9a44(0x1e4)](_0x225c81){const _0x317836=a26_0x4c9a44,_0x49ad32=_0x225c81['args'][0x0];if(!_0x49ad32)return _0x317836(0x201);return undefined;}async[a26_0x4c9a44(0x1c0)](_0x3f4d45){const _0x4352ec=a26_0x4c9a44,{options:_0x54cc72,args:_0x304e5d,tdx:_0x1c3991}=_0x3f4d45,_0x59a7b3=_0x304e5d[0x0],_0x386062=_0x54cc72,_0x248877=_0x386062['database'],_0xadf1a5=_0x386062[_0x4352ec(0x1d9)],_0xf4f893=_0x386062['type']||'trino';let _0x19419f;try{_0x19419f=readFileSync(_0xadf1a5,_0x4352ec(0x20a))[_0x4352ec(0x1b5)]();}catch(_0x160881){throw new SDKError(ErrorCode[_0x4352ec(0x1ef)],_0x4352ec(0x1a4)+_0xadf1a5,_0x160881 instanceof Error?_0x160881:undefined);}if(!_0x19419f)throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x4352ec(0x1d1));const _0x2e7cea={'database':_0x248877,'query':_0x19419f,'type':_0xf4f893};if(_0x386062[_0x4352ec(0x1cd)])_0x2e7cea[_0x4352ec(0x1cd)]=_0x386062[_0x4352ec(0x1cd)];if(_0x386062[_0x4352ec(0x191)])_0x2e7cea[_0x4352ec(0x191)]=_0x386062[_0x4352ec(0x191)];if(_0x386062[_0x4352ec(0x199)]!==undefined)_0x2e7cea[_0x4352ec(0x199)]=Number(_0x386062[_0x4352ec(0x199)]);if(_0x386062[_0x4352ec(0x1a0)]!==undefined)_0x2e7cea[_0x4352ec(0x1a0)]=Number(_0x386062[_0x4352ec(0x1a0)]);if(_0x386062['retryLimit']!==undefined)_0x2e7cea['retry_limit']=Number(_0x386062['retryLimit']);if(_0x386062[_0x4352ec(0x1e8)])_0x2e7cea['engine_version']=_0x386062[_0x4352ec(0x1e8)];if(_0x386062[_0x4352ec(0x1ba)])_0x2e7cea['result']=_0x386062[_0x4352ec(0x1ba)];if(_0x54cc72[_0x4352ec(0x1eb)]){console[_0x4352ec(0x1ec)]('Creating\x20schedule:\x20'+_0x59a7b3),console[_0x4352ec(0x1ec)]('\x20\x20Database:\x20'+_0x248877),console[_0x4352ec(0x1ec)](_0x4352ec(0x1c9)+_0xf4f893);if(_0x2e7cea[_0x4352ec(0x1cd)])console[_0x4352ec(0x1ec)]('\x20\x20Cron:\x20'+_0x2e7cea[_0x4352ec(0x1cd)]);if(_0x2e7cea[_0x4352ec(0x191)])console[_0x4352ec(0x1ec)](_0x4352ec(0x206)+_0x2e7cea[_0x4352ec(0x191)]);}const _0xaa8470=await withSpinner('Creating\x20schedule...',()=>_0x1c3991[_0x4352ec(0x1dd)][_0x4352ec(0x1cc)](_0x59a7b3,_0x2e7cea),{'verbose':_0x54cc72['verbose']});return console[_0x4352ec(0x1ec)](_0x4352ec(0x1fc)+_0xaa8470['data']['name']),await handleSingleObjectOutput(_0xaa8470[_0x4352ec(0x1f1)],_0x54cc72),0x0;}}export class ScheduleUpdateCommand extends BaseCommand{['name']=a26_0x4c9a44(0x18c);[a26_0x4c9a44(0x1bc)]=a26_0x4c9a44(0x20b);[a26_0x4c9a44(0x1e4)](_0x168bef){const _0x2a1b83=a26_0x4c9a44,_0x15fa43=_0x168bef[_0x2a1b83(0x1e5)][0x0];if(!_0x15fa43)return _0x2a1b83(0x1fe);return undefined;}async[a26_0x4c9a44(0x1c0)](_0x2bd545){const _0x16da50=a26_0x4c9a44,{options:_0x4dcdb5,args:_0x85d069,tdx:_0x379c31}=_0x2bd545,_0x1b6e1c=_0x85d069[0x0],_0x690ca5=_0x4dcdb5,_0x3103de={};if(_0x690ca5[_0x16da50(0x1a6)])_0x3103de[_0x16da50(0x1a6)]=_0x690ca5[_0x16da50(0x1a6)];if(_0x690ca5[_0x16da50(0x1a2)])_0x3103de[_0x16da50(0x1a2)]=_0x690ca5[_0x16da50(0x1a2)];if(_0x690ca5[_0x16da50(0x1cd)])_0x3103de[_0x16da50(0x1cd)]=_0x690ca5[_0x16da50(0x1cd)];if(_0x690ca5[_0x16da50(0x191)])_0x3103de[_0x16da50(0x191)]=_0x690ca5[_0x16da50(0x191)];if(_0x690ca5[_0x16da50(0x199)]!==undefined)_0x3103de['delay']=Number(_0x690ca5['delay']);if(_0x690ca5[_0x16da50(0x1a0)]!==undefined)_0x3103de[_0x16da50(0x1a0)]=Number(_0x690ca5[_0x16da50(0x1a0)]);if(_0x690ca5[_0x16da50(0x1ad)]!==undefined)_0x3103de['retry_limit']=Number(_0x690ca5['retryLimit']);if(_0x690ca5['engineVersion'])_0x3103de[_0x16da50(0x1d6)]=_0x690ca5[_0x16da50(0x1e8)];if(_0x690ca5['result'])_0x3103de[_0x16da50(0x1ba)]=_0x690ca5[_0x16da50(0x1ba)];if(_0x690ca5[_0x16da50(0x1d9)])try{_0x3103de[_0x16da50(0x1b9)]=readFileSync(_0x690ca5[_0x16da50(0x1d9)],'utf-8')[_0x16da50(0x1b5)]();}catch(_0x171f9a){throw new SDKError(ErrorCode[_0x16da50(0x1ef)],_0x16da50(0x1a4)+_0x690ca5[_0x16da50(0x1d9)],_0x171f9a instanceof Error?_0x171f9a:undefined);}if(Object[_0x16da50(0x1ce)](_0x3103de)[_0x16da50(0x1b2)]===0x0)throw new SDKError(ErrorCode[_0x16da50(0x1ef)],_0x16da50(0x1a8));if(_0x4dcdb5['verbose']){console[_0x16da50(0x1ec)](_0x16da50(0x1fd)+_0x1b6e1c);for(const [_0x1af1c7,_0x1d9707]of Object[_0x16da50(0x1ed)](_0x3103de)){_0x1af1c7===_0x16da50(0x1b9)?console['error']('\x20\x20'+_0x1af1c7+':\x20'+_0x1d9707[_0x16da50(0x1da)](0x0,0x32)+'...'):console[_0x16da50(0x1ec)]('\x20\x20'+_0x1af1c7+':\x20'+_0x1d9707);}}const _0x1fcdaf=await withSpinner(_0x16da50(0x19c),()=>_0x379c31[_0x16da50(0x1dd)]['update'](_0x1b6e1c,_0x3103de),{'verbose':_0x4dcdb5[_0x16da50(0x1eb)]});return console[_0x16da50(0x1ec)](_0x16da50(0x1b4)+_0x1fcdaf[_0x16da50(0x1f1)][_0x16da50(0x204)]),await handleSingleObjectOutput(_0x1fcdaf[_0x16da50(0x1f1)],_0x4dcdb5),0x0;}}export class ScheduleDeleteCommand extends BaseCommand{[a26_0x4c9a44(0x204)]=a26_0x4c9a44(0x207);[a26_0x4c9a44(0x1bc)]=a26_0x4c9a44(0x200);['validate'](_0x220a05){const _0x410cb2=a26_0x4c9a44,_0x2d41d0=_0x220a05[_0x410cb2(0x1e5)][0x0];if(!_0x2d41d0)return _0x410cb2(0x1f3);return undefined;}async[a26_0x4c9a44(0x1c0)](_0x1207f8){const _0x5d2b95=a26_0x4c9a44,{options:_0xa1009d,args:_0x277ca8,tdx:_0x51c590}=_0x1207f8,_0x2803dc=_0x277ca8[0x0];if(!_0xa1009d['yes']){const _0x2b03e9=await confirm(_0x5d2b95(0x1bf)+_0x2803dc+'\x22?');if(!_0x2b03e9)return console[_0x5d2b95(0x1ec)]('Cancelled'),0x0;}const _0x2544ba=await withSpinner('Deleting\x20schedule...',()=>_0x51c590[_0x5d2b95(0x1dd)][_0x5d2b95(0x212)](_0x2803dc),{'verbose':_0xa1009d[_0x5d2b95(0x1eb)]});return console[_0x5d2b95(0x1ec)](_0x5d2b95(0x20e)+_0x2544ba[_0x5d2b95(0x1f1)][_0x5d2b95(0x204)]),0x0;}}function a26_0x40d8(_0x58cfb5,_0x24b4d8){_0x58cfb5=_0x58cfb5-0x18b;const _0x2229eb=a26_0x2229();let _0x40d888=_0x2229eb[_0x58cfb5];return _0x40d888;}export class ScheduleRunCommand extends BaseCommand{['name']=a26_0x4c9a44(0x192);[a26_0x4c9a44(0x1bc)]=a26_0x4c9a44(0x1ac);['validate'](_0x38a9f9){const _0x20a051=a26_0x4c9a44,_0x2c4f3d=_0x38a9f9[_0x20a051(0x1e5)][0x0];if(!_0x2c4f3d)return _0x20a051(0x1a7);return undefined;}async['execute'](_0x29acfa){const _0x120657=a26_0x4c9a44,{options:_0x594318,args:_0x20989c,tdx:_0x422363}=_0x29acfa,_0x1a9663=_0x20989c[0x0],_0x5190c5=_0x594318,_0x5ea23d=_0x5190c5[_0x120657(0x19d)],_0x29ee01=_0x5190c5['num']!==undefined?Number(_0x5190c5['num']):undefined;if(_0x594318[_0x120657(0x1eb)]){console[_0x120657(0x1ec)](_0x120657(0x19e)+_0x1a9663);if(_0x5ea23d)console[_0x120657(0x1ec)]('\x20\x20Time:\x20'+_0x5ea23d);if(_0x29ee01)console[_0x120657(0x1ec)](_0x120657(0x1be)+_0x29ee01);}const _0x275aeb=await withSpinner(_0x120657(0x196),()=>_0x422363[_0x120657(0x1dd)][_0x120657(0x203)](_0x1a9663,{'time':_0x5ea23d,'num':_0x29ee01}),{'verbose':_0x594318[_0x120657(0x1eb)]}),_0x14c97e=_0x275aeb[_0x120657(0x1f1)][_0x120657(0x1cb)];console[_0x120657(0x1ec)](_0x120657(0x1d3)+_0x14c97e[_0x120657(0x1b2)]+'\x20job'+(_0x14c97e[_0x120657(0x1b2)]!==0x1?'s':'')+_0x120657(0x20d));for(const _0x5ce5c8 of _0x14c97e){console[_0x120657(0x1ec)](_0x120657(0x208)+_0x5ce5c8['job_id']);}return await handleSDKOutput(_0x14c97e,_0x594318),0x0;}}export class ScheduleHistoryCommand extends BaseCommand{['name']='schedule:history';[a26_0x4c9a44(0x1bc)]=a26_0x4c9a44(0x1f9);['validate'](_0x5befd3){const _0x471eae=_0x5befd3['args'][0x0];if(!_0x471eae)return'Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20history\x20<name>\x20[--from\x20<n>]\x20[--to\x20<n>]';return undefined;}async[a26_0x4c9a44(0x1c0)](_0x483148){const _0x340d6d=a26_0x4c9a44,{options:_0x3998a7,args:_0x46c800,tdx:_0x2f1d91}=_0x483148,_0x231c94=_0x46c800[0x0],_0x2d7d81=_0x3998a7,_0x410090=_0x2d7d81[_0x340d6d(0x1dc)]!==undefined?Number(_0x2d7d81['from']):undefined,_0x26d27e=_0x2d7d81['to']!==undefined?Number(_0x2d7d81['to']):undefined,_0x12ba83=await withSpinner(_0x340d6d(0x1a1),()=>_0x2f1d91[_0x340d6d(0x1dd)][_0x340d6d(0x190)](_0x231c94,{'from':_0x410090,'to':_0x26d27e}),{'verbose':_0x3998a7['verbose']}),_0x1cf1bd=_0x12ba83[_0x340d6d(0x1f1)];console['error']('Found\x20'+_0x1cf1bd[_0x340d6d(0x1ab)]+_0x340d6d(0x1e3)+(_0x1cf1bd[_0x340d6d(0x1ab)]!==0x1?'s':'')+_0x340d6d(0x1c5)+_0x1cf1bd[_0x340d6d(0x1dc)]+'-'+_0x1cf1bd['to']+')');const _0x1ac792=_0x1cf1bd[_0x340d6d(0x190)]['map'](_0x1fea4a=>({'job_id':_0x1fea4a['job_id'],'type':_0x1fea4a[_0x340d6d(0x1a2)],'status':_0x1fea4a[_0x340d6d(0x202)],'scheduled_at':_0x1fea4a[_0x340d6d(0x213)],'created_at':_0x1fea4a[_0x340d6d(0x1fb)],'start_at':_0x1fea4a['start_at'],'end_at':_0x1fea4a[_0x340d6d(0x1d0)]}));return await handleSDKOutput(_0x1ac792,_0x3998a7),0x0;}}
@@ -1 +1 @@
1
- const a27_0x56960b=a27_0x28f1;(function(_0x3f91a6,_0x51285e){const _0x95e9b=a27_0x28f1,_0x2d978f=_0x3f91a6();while(!![]){try{const _0x589945=parseInt(_0x95e9b(0x19c))/0x1+-parseInt(_0x95e9b(0x1aa))/0x2+-parseInt(_0x95e9b(0x1bd))/0x3*(parseInt(_0x95e9b(0x1b7))/0x4)+parseInt(_0x95e9b(0x1ab))/0x5+parseInt(_0x95e9b(0x1f5))/0x6*(parseInt(_0x95e9b(0x19a))/0x7)+-parseInt(_0x95e9b(0x1ca))/0x8*(-parseInt(_0x95e9b(0x1ce))/0x9)+-parseInt(_0x95e9b(0x1e9))/0xa*(parseInt(_0x95e9b(0x1de))/0xb);if(_0x589945===_0x51285e)break;else _0x2d978f['push'](_0x2d978f['shift']());}catch(_0x2f38c9){_0x2d978f['push'](_0x2d978f['shift']());}}}(a27_0x4edb,0xa880b));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';function a27_0x4edb(){const _0x11a86f=['elapsedTimeMillis','395342OPKQWS','1755670pJAzzW','web','green','error','\x27\x20with\x20ID:\x20','Error:\x20Cannot\x20get\x20SQL\x20for\x20parent\x20segment\x20with\x20this\x20command.','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20desc\x20<path/to/segment.yml>','resolveParentId','Error:\x20Cannot\x20execute\x20query\x20for\x20parent\x20segment\x20with\x20this\x20command.','Usage:\x20tdx\x20segment\x20folder\x20create\x20<parent_name>\x20<folder_name>\x20[options]','Usage:\x20tdx\x20segment\x20describe\x20<path>','52EywshY','INVALID_ARGUMENT','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','\x20\x20tdx\x20sg\x20desc\x20\x22Premium\x20Users\x22','\x20\x20Folder\x20path:\x20','Use:\x20tdx\x20ps\x20desc','18201DsRVZo','Use:\x20tdx\x20sg\x20view\x20<name>\x20\x20#\x20To\x20show\x20folder\x20details','stats','replace','listFolders','segment:folder:list','information_schema','Usage:\x20tdx\x20sg\x20desc\x20<name>','\x20\x20Full\x20path:\x20','Usage:\x20tdx\x20segment\x20folder\x20show\x20<parent_name/folder_name>','Usage:\x20tdx\x20sg\x20show\x20<name>','execute','No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22','32laDNAy','Target\x20path:\x20','segment:show','Show\x20segment\x20folder\x20details','9405aujvad','Parent\x20segment:\x20','\x20\x20tdx\x20sg\x20sql\x20\x22Premium\x20Users\x22','/e/','format','Error:\x20Folder\x20name\x20is\x20required\x20(use\x20parent_name/folder_name\x20format)','\x20Opening\x20','parentId','createFolder','Usage:\x20tdx\x20sg\x20sql\x20<name>','✔\x20Found\x20','Show\x20child\x20segment\x20schema\x20(column\x20types)','Error:\x20Cannot\x20show\x20schema\x20for\x20parent\x20segment\x20with\x20this\x20command.','fullPath','segmentName','✔\x20Query\x20completed:\x20Processed\x20','3099833fHHSHp','name','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience/Marketing/High\x20Value\x22','getSegment','segment','getSegmentSQL','log','Site:\x20','trim','Error:\x20Cannot\x20get\x20SQL\x20query\x20for\x20a\x20folder.','Folder\x20ID\x20missing\x20from\x20resolved\x20path','50tEwYWg','\x20\x20tdx\x20sg\x20show\x20segments/my-audience/premium-users.yml','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience\x22','code','✔\x20Created\x20folder\x20\x27','Error:\x20Cannot\x20view\x20parent\x20segment\x20details\x20with\x20this\x20command.','Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20view\x20<path/to/segment.yml>','parent','segment:describe','Fetching\x20folder\x20details...','\x20\x20tdx\x20sg\x20view\x20\x22Marketing\x22\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20folder\x20details','12dFIaXA','getFolder','Segment\x20ID\x20missing\x20from\x20resolved\x20path','\x20\x20tdx\x20sg\x20sql\x20segments/my-audience/premium-users.yml','Resolved\x20YAML\x20file:\x20','Usage:\x20tdx\x20sg\x20view\x20<name>\x20[-w]','length','includes','segmentPath','folderPath','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20sql\x20<path/to/segment.yml>','Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required','processedRows','segment:folder:create','Use:\x20tdx\x20ps\x20sql','Get\x20SQL\x20query\x20for\x20child\x20segment','verbose','cause','Use:\x20tdx\x20ps\x20show','Resolved\x20parent\x20folder\x20ID:\x20','site','\x20\x20Segment\x20name:\x20','\x20[Job\x20ID:\x20','Fetching\x20parent\x20segment\x20details...','data','Error:\x20Cannot\x20execute\x20SQL\x20query\x20on\x20a\x20folder.','getParent','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20-w\x20\x20#\x20Open\x20segment\x20in\x20web\x20browser','Listing\x20folders\x20for\x20parent\x20\x27','\x20\x20tdx\x20sg\x20view\x20segments/my-audience/premium-users.yml','Error:\x20Path\x20or\x20name\x20is\x20required','resolveFolderId','Resolving\x20\x27','folder','setJobId','parentFolder','\x20\x20Cause:\x20','parentSegment','Show\x20segment\x20or\x20folder\x20details','Resolving\x20parent\x20segment\x20\x27','\x20\x20tdx\x20segment\x20describe\x20\x22High\x20Value\x22\x20\x20\x20\x20#\x20Relative\x20to\x20current\x20context','jobId','Resolving\x20path\x20\x27','\x20\x20tdx\x20sg\x20show\x20\x22Premium\x20Users\x22','SEGMENT_NOT_FOUND','toLocaleString','Executing\x20segment\x20query...','Fetching\x20SQL\x20for\x20segment...','Usage:\x20tdx\x20segment\x20folder\x20list\x20<parent_name>','Examples:','Parent\x20name:\x20','\x20\x20Parent\x20segment:\x20','\x27...','Fetching\x20segment\x20details...','SEGMENT_FOLDER_NOT_FOUND','Parent\x20ID:\x20','test','Error:\x20','SQL\x20query:\x0a','resolvePathToResource','segment:folder:show','message','✖\x20Query\x20failed\x20[','segmentId','Execute\x20child\x20segment\x20SQL\x20query\x20and\x20show\x20results','jsonl','Folder\x20name:\x20','Folder\x20ID:\x20','url','Resolved\x20type:\x20','2326191ALZRdL','/app/ps/','1355804UKCrGz','type','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20show\x20<path/to/segment.yml>','List\x20segment\x20folders\x20under\x20a\x20parent\x20segment','Error:\x20Cannot\x20show\x20schema\x20for\x20a\x20folder.','folderId','Error:\x20Cannot\x20open\x20folder\x20in\x20web\x20browser.\x20Use\x20a\x20segment\x20name\x20instead.','cyan','description','Error:\x20Parent\x20segment\x20name\x20is\x20required','Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.','Options:','\x20rows\x20'];a27_0x4edb=function(){return _0x11a86f;};return a27_0x4edb();}import{getConsoleNextUrl}from'../sdk/client/endpoints.js';import{openBrowser}from'../utils/process.js';import a27_0x102316 from'chalk';async function resolveSegmentTarget(_0x1a5179,_0x4ce47a,_0x5b0c11){const _0x43ae89=a27_0x28f1;if(isYamlFilePath(_0x1a5179))try{const _0x4c07af=await resolveYamlFilePath(_0x1a5179);return _0x5b0c11&&(console[_0x43ae89(0x1ae)](_0x43ae89(0x1f9)+_0x1a5179),console[_0x43ae89(0x1ae)](_0x43ae89(0x187)+_0x4c07af[_0x43ae89(0x179)]),console[_0x43ae89(0x1ae)](_0x43ae89(0x169)+_0x4c07af[_0x43ae89(0x1dc)]),console['error'](_0x43ae89(0x1bb)+(_0x4c07af[_0x43ae89(0x1fe)]||'(root)')),console[_0x43ae89(0x1ae)](_0x43ae89(0x1c5)+_0x4c07af[_0x43ae89(0x1db)])),_0x4c07af[_0x43ae89(0x1db)];}catch(_0x28edad){throw new SDKError(ErrorCode[_0x43ae89(0x1b8)],_0x43ae89(0x1ef)+_0x28edad[_0x43ae89(0x191)]);}if(!_0x4ce47a)throw new SDKError(ErrorCode[_0x43ae89(0x1b8)],_0x43ae89(0x1c9));return _0x4ce47a+'/'+_0x1a5179;}export class SegmentDescribeCommand extends BaseCommand{['name']=a27_0x56960b(0x1f2);[a27_0x56960b(0x1a4)]=a27_0x56960b(0x17a);async['execute'](_0x4b4d41){const _0x39423a=a27_0x56960b,{options:_0x1e9b4c,args:_0x142c11,tdx:_0x4981ec}=_0x4b4d41,_0x5cd7d2=_0x142c11[0x0],_0x17012f=!_0x5cd7d2&&!!_0x1e9b4c[_0x39423a(0x179)],_0x4c7bac=_0x5cd7d2||_0x1e9b4c[_0x39423a(0x179)];if(!_0x4c7bac)return console[_0x39423a(0x1ae)](_0x39423a(0x172)),console[_0x39423a(0x1ae)](_0x39423a(0x1b6)),console[_0x39423a(0x1ae)]('Examples:'),console[_0x39423a(0x1ae)](_0x39423a(0x1eb)),console[_0x39423a(0x1ae)](_0x39423a(0x1e0)),console[_0x39423a(0x1ae)](_0x39423a(0x17c)),console[_0x39423a(0x1ae)](_0x39423a(0x1b9)),0x1;try{const _0xaf140e=_0x1e9b4c[_0x39423a(0x1fd)];let _0x32ef3e=_0x4c7bac;!_0x17012f&&_0xaf140e&&!_0x4c7bac[_0x39423a(0x1fc)]('/')&&(_0x32ef3e=_0xaf140e+'/'+_0x4c7bac,_0x1e9b4c[_0x39423a(0x205)]&&console['error']('Resolved\x20relative\x20path\x20to:\x20'+_0x32ef3e));const _0xb6df3=await withSpinner(_0x39423a(0x17e)+_0x32ef3e+_0x39423a(0x188),()=>_0x4981ec[_0x39423a(0x1e2)]['resolvePathToResource'](_0x32ef3e),{'verbose':_0x1e9b4c[_0x39423a(0x205)]}),_0x5b9262=_0xb6df3[_0x39423a(0x16c)];_0x1e9b4c[_0x39423a(0x205)]&&(console[_0x39423a(0x1ae)](_0x39423a(0x199)+_0x5b9262[_0x39423a(0x19d)]),console[_0x39423a(0x1ae)](_0x39423a(0x18b)+_0x5b9262['parentId']),_0x5b9262[_0x39423a(0x1a1)]&&console['error'](_0x39423a(0x197)+_0x5b9262[_0x39423a(0x1a1)]),_0x5b9262[_0x39423a(0x193)]&&console['error']('Segment\x20ID:\x20'+_0x5b9262[_0x39423a(0x193)]));if(_0x5b9262[_0x39423a(0x19d)]===_0x39423a(0x1f1)){const _0xa59595=await withSpinner(_0x39423a(0x16b),()=>_0x4981ec[_0x39423a(0x1e2)][_0x39423a(0x16e)](_0x5b9262[_0x39423a(0x1d5)]),{'verbose':_0x1e9b4c['verbose']});await handleSingleObjectOutput(_0xa59595[_0x39423a(0x16c)],_0x1e9b4c);}else{if(_0x5b9262['type']==='folder'){if(!_0x5b9262['folderId'])throw new SDKError(ErrorCode[_0x39423a(0x18a)],_0x39423a(0x1e8));const _0x191ec7=await withSpinner(_0x39423a(0x1f3),()=>_0x4981ec[_0x39423a(0x1e2)][_0x39423a(0x1f6)](_0x5b9262[_0x39423a(0x1a1)]),{'verbose':_0x1e9b4c[_0x39423a(0x205)]});await handleSingleObjectOutput(_0x191ec7[_0x39423a(0x16c)],_0x1e9b4c);}else{if(_0x5b9262[_0x39423a(0x19d)]===_0x39423a(0x1e2)){if(!_0x5b9262[_0x39423a(0x193)])throw new SDKError(ErrorCode[_0x39423a(0x180)],_0x39423a(0x1f7));const _0x25d6f7=await withSpinner(_0x39423a(0x189),()=>_0x4981ec[_0x39423a(0x1e2)]['getSegment'](_0x5b9262['parentId'],_0x5b9262[_0x39423a(0x193)]),{'verbose':_0x1e9b4c[_0x39423a(0x205)]});await handleSingleObjectOutput(_0x25d6f7[_0x39423a(0x16c)],_0x1e9b4c);}}}return 0x0;}catch(_0x3898cf){if(_0x3898cf instanceof SDKError)return console[_0x39423a(0x1ae)](_0x39423a(0x18d)+_0x3898cf['message']),_0x3898cf['cause']&&console[_0x39423a(0x1ae)](_0x39423a(0x178)+_0x3898cf[_0x39423a(0x206)]),0x1;throw _0x3898cf;}}}export class SegmentShowCommand extends BaseCommand{[a27_0x56960b(0x1df)]=a27_0x56960b(0x1cc);[a27_0x56960b(0x1a4)]=a27_0x56960b(0x194);async[a27_0x56960b(0x1c8)](_0x126ee8){const _0x4a56ad=a27_0x56960b,{options:_0x17b7fd,args:_0x2fe417,tdx:_0xc4cf85}=_0x126ee8,_0x4c076d=_0x2fe417[0x0];if(!_0x4c076d)return console['error']('Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required'),console[_0x4a56ad(0x1ae)](_0x4a56ad(0x1c7)),console[_0x4a56ad(0x1ae)](_0x4a56ad(0x19e)),console[_0x4a56ad(0x1ae)](_0x4a56ad(0x185)),console[_0x4a56ad(0x1ae)](_0x4a56ad(0x17f)),console[_0x4a56ad(0x1ae)](_0x4a56ad(0x1ea)),0x1;try{const _0x2b5a31=_0x17b7fd['parentSegment'],_0x1170e1=await resolveSegmentTarget(_0x4c076d,_0x2b5a31,_0x17b7fd[_0x4a56ad(0x205)]);_0x17b7fd[_0x4a56ad(0x205)]&&console['error'](_0x4a56ad(0x1cb)+_0x1170e1);const _0xe0df2d=await withSpinner('Resolving\x20\x27'+_0x4c076d+'\x27...',()=>_0xc4cf85[_0x4a56ad(0x1e2)]['resolvePathToResource'](_0x1170e1),{'verbose':_0x17b7fd[_0x4a56ad(0x205)]}),_0x23e2a9=_0xe0df2d[_0x4a56ad(0x16c)];_0x17b7fd['verbose']&&(console[_0x4a56ad(0x1ae)](_0x4a56ad(0x199)+_0x23e2a9[_0x4a56ad(0x19d)]),console['error'](_0x4a56ad(0x18b)+_0x23e2a9[_0x4a56ad(0x1d5)]));if(_0x23e2a9[_0x4a56ad(0x19d)]==='folder')return console[_0x4a56ad(0x1ae)](_0x4a56ad(0x16d)),console['error'](_0x4a56ad(0x1be)),0x1;if(_0x23e2a9[_0x4a56ad(0x19d)]===_0x4a56ad(0x1f1))return console[_0x4a56ad(0x1ae)](_0x4a56ad(0x1b4)),console[_0x4a56ad(0x1ae)](_0x4a56ad(0x207)),0x1;if(!_0x23e2a9[_0x4a56ad(0x193)])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x4a56ad(0x1f7));const _0x48a0e5=await withSpinner(_0x4a56ad(0x183),()=>_0xc4cf85[_0x4a56ad(0x1e2)][_0x4a56ad(0x1e3)](_0x23e2a9[_0x4a56ad(0x1d5)],_0x23e2a9[_0x4a56ad(0x193)]),{'verbose':_0x17b7fd['verbose']});let _0x5534bc=_0x48a0e5[_0x4a56ad(0x16c)];const _0x458680=resolveLimit(_0x17b7fd['limit'],DEFAULT_DISPLAY_LIMIT),_0x2c6917=/\bLIMIT\s+\d+/i[_0x4a56ad(0x18c)](_0x5534bc);!_0x2c6917&&(_0x5534bc=_0x5534bc[_0x4a56ad(0x1e6)]()[_0x4a56ad(0x1c0)](/;+$/,''),_0x5534bc='SELECT\x20*\x20FROM\x20(\x0a'+_0x5534bc+_0x4a56ad(0x1b1)+_0x458680);_0x17b7fd[_0x4a56ad(0x205)]&&console['error'](_0x4a56ad(0x18e)+_0x5534bc);const _0x4a38b9=await withProgressSpinner(_0x4a56ad(0x182),async _0x26a84d=>{const _0x1f9d4b=_0x4a56ad,_0x571afe=await _0xc4cf85['query'][_0x1f9d4b(0x1c8)](_0x5534bc,{'catalog':'td','schema':_0x1f9d4b(0x1c3),'onJobId':_0x3dc52b=>{const _0x160c05=_0x1f9d4b;_0x26a84d[_0x160c05(0x176)](_0x3dc52b);}});return _0x571afe;},{'verbose':_0x17b7fd['verbose']}),_0x446719=_0x4a38b9[_0x4a56ad(0x16c)],_0x2fc2c9=_0x446719['jobId']?_0x4a56ad(0x16a)+_0x446719[_0x4a56ad(0x17d)]+']':'';return console[_0x4a56ad(0x1ae)](_0x4a56ad(0x1dd)+_0x446719[_0x4a56ad(0x1bf)][_0x4a56ad(0x201)][_0x4a56ad(0x181)]()+_0x4a56ad(0x1a8)+('in\x20'+formatElapsed(_0x446719[_0x4a56ad(0x1bf)][_0x4a56ad(0x1a9)])+_0x2fc2c9)),await handleQueryOutput(_0x446719,_0x17b7fd),0x0;}catch(_0x306dc9){if(_0x306dc9 instanceof SDKError)return console[_0x4a56ad(0x1ae)](_0x4a56ad(0x192)+_0x306dc9[_0x4a56ad(0x1ec)]+']'),console[_0x4a56ad(0x1ae)]('\x0a'+_0x306dc9[_0x4a56ad(0x191)]),0x1;throw _0x306dc9;}}}export class SegmentFolderListCommand extends BaseCommand{[a27_0x56960b(0x1df)]=a27_0x56960b(0x1c2);['description']=a27_0x56960b(0x19f);async[a27_0x56960b(0x1c8)](_0x18e230){const _0x574de4=a27_0x56960b,{options:_0x20a5d,args:_0x44f71b,tdx:_0x580750}=_0x18e230;if(_0x44f71b['length']===0x0)return console[_0x574de4(0x1ae)](_0x574de4(0x1a5)),console[_0x574de4(0x1ae)](_0x574de4(0x184)),0x1;const _0x61d265=_0x44f71b[0x0];try{_0x20a5d['verbose']&&(console['error']('Site:\x20'+_0x20a5d['site']),console[_0x574de4(0x1ae)](_0x574de4(0x186)+_0x61d265));const _0x13a5f7=await withSpinner(_0x574de4(0x17b)+_0x61d265+'\x27...',()=>_0x580750[_0x574de4(0x1e2)][_0x574de4(0x1b3)](_0x61d265),{'verbose':_0x20a5d[_0x574de4(0x205)]}),_0x33235d=_0x13a5f7[_0x574de4(0x16c)];_0x20a5d['verbose']&&console[_0x574de4(0x1ae)]('Resolved\x20parent\x20ID:\x20'+_0x33235d);const _0x4cfe15=await withSpinner(_0x574de4(0x170)+_0x61d265+'\x27...',()=>_0x580750[_0x574de4(0x1e2)][_0x574de4(0x1c1)](_0x33235d),{'verbose':_0x20a5d[_0x574de4(0x205)]}),_0xa361e6=_0x4cfe15[_0x574de4(0x16c)];return console['error'](_0x574de4(0x1d8)+_0xa361e6['length']+'\x20folder'+(_0xa361e6[_0x574de4(0x1fb)]!==0x1?'s':'')),await handleSDKOutput(_0xa361e6,_0x20a5d),0x0;}catch(_0x324b53){if(_0x324b53 instanceof SDKError)return console['error']('Error:\x20'+_0x324b53[_0x574de4(0x191)]),_0x324b53[_0x574de4(0x206)]&&console[_0x574de4(0x1ae)](_0x574de4(0x178)+_0x324b53[_0x574de4(0x206)]),0x1;throw _0x324b53;}}}export class SegmentFolderShowCommand extends BaseCommand{['name']=a27_0x56960b(0x190);[a27_0x56960b(0x1a4)]=a27_0x56960b(0x1cd);async[a27_0x56960b(0x1c8)](_0x1a75fd){const _0x358e3e=a27_0x56960b,{options:_0x1b6c64,args:_0x253f4a,tdx:_0xb4f898}=_0x1a75fd;if(_0x253f4a[_0x358e3e(0x1fb)]===0x0)return console[_0x358e3e(0x1ae)]('Error:\x20Folder\x20reference\x20is\x20required'),console['error'](_0x358e3e(0x1c6)),0x1;try{const {parentId:_0x293504,childId:_0x745864}=parseSegmentRef(_0x253f4a[0x0]);_0x1b6c64[_0x358e3e(0x205)]&&(console['error'](_0x358e3e(0x1e5)+_0x1b6c64[_0x358e3e(0x209)]),console[_0x358e3e(0x1ae)](_0x358e3e(0x186)+_0x293504),_0x745864&&console[_0x358e3e(0x1ae)]('Folder\x20name:\x20'+_0x745864));if(!_0x745864)return console['error'](_0x358e3e(0x1d3)),0x1;const _0x201b65=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x293504+_0x358e3e(0x188),()=>_0xb4f898[_0x358e3e(0x1e2)][_0x358e3e(0x1b3)](_0x293504),{'verbose':_0x1b6c64[_0x358e3e(0x205)]}),_0x36ad68=_0x201b65[_0x358e3e(0x16c)];_0x1b6c64[_0x358e3e(0x205)]&&console['error']('Resolved\x20parent\x20ID:\x20'+_0x36ad68);const _0x46e76e=await withSpinner('Resolving\x20folder\x20\x27'+_0x745864+_0x358e3e(0x188),()=>_0xb4f898[_0x358e3e(0x1e2)][_0x358e3e(0x173)](_0x36ad68,_0x745864),{'verbose':_0x1b6c64[_0x358e3e(0x205)]}),_0x3de688=_0x46e76e[_0x358e3e(0x16c)];_0x1b6c64[_0x358e3e(0x205)]&&console[_0x358e3e(0x1ae)]('Resolved\x20folder\x20ID:\x20'+_0x3de688);const _0x155a6c=await withSpinner('Fetching\x20folder\x20\x27'+_0x745864+_0x358e3e(0x188),()=>_0xb4f898[_0x358e3e(0x1e2)][_0x358e3e(0x1f6)](_0x3de688),{'verbose':_0x1b6c64['verbose']});return await handleSDKOutput([_0x155a6c[_0x358e3e(0x16c)]],_0x1b6c64),0x0;}catch(_0x475dc4){if(_0x475dc4 instanceof SDKError)return console[_0x358e3e(0x1ae)]('Error:\x20'+_0x475dc4[_0x358e3e(0x191)]),_0x475dc4[_0x358e3e(0x206)]&&console[_0x358e3e(0x1ae)]('\x20\x20Cause:\x20'+_0x475dc4['cause']),0x1;throw _0x475dc4;}}}export class SegmentSQLCommand extends BaseCommand{[a27_0x56960b(0x1df)]='segment:sql';[a27_0x56960b(0x1a4)]=a27_0x56960b(0x204);async[a27_0x56960b(0x1c8)](_0x32bd69){const _0x42a0b8=a27_0x56960b,{options:_0x11c3cc,args:_0x34c26f,tdx:_0x5e1a06}=_0x32bd69,_0x3b77dd=_0x34c26f[0x0];if(!_0x3b77dd)return console[_0x42a0b8(0x1ae)]('Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required'),console[_0x42a0b8(0x1ae)](_0x42a0b8(0x1d7)),console[_0x42a0b8(0x1ae)](_0x42a0b8(0x1ff)),console[_0x42a0b8(0x1ae)]('Examples:'),console['error'](_0x42a0b8(0x1d0)),console[_0x42a0b8(0x1ae)](_0x42a0b8(0x1f8)),0x1;try{const _0x49ffdb=_0x11c3cc[_0x42a0b8(0x179)],_0x176723=await resolveSegmentTarget(_0x3b77dd,_0x49ffdb,_0x11c3cc[_0x42a0b8(0x205)]);_0x11c3cc['verbose']&&console[_0x42a0b8(0x1ae)]('Target\x20path:\x20'+_0x176723);const _0x188d4b=await withSpinner(_0x42a0b8(0x174)+_0x3b77dd+_0x42a0b8(0x188),()=>_0x5e1a06[_0x42a0b8(0x1e2)]['resolvePathToResource'](_0x176723),{'verbose':_0x11c3cc[_0x42a0b8(0x205)]}),_0x2f82b5=_0x188d4b[_0x42a0b8(0x16c)];_0x11c3cc['verbose']&&(console['error']('Resolved\x20type:\x20'+_0x2f82b5['type']),console[_0x42a0b8(0x1ae)]('Parent\x20ID:\x20'+_0x2f82b5['parentId']));if(_0x2f82b5[_0x42a0b8(0x19d)]===_0x42a0b8(0x175))return console[_0x42a0b8(0x1ae)](_0x42a0b8(0x1e7)),console['error']('Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.'),0x1;if(_0x2f82b5[_0x42a0b8(0x19d)]===_0x42a0b8(0x1f1))return console[_0x42a0b8(0x1ae)](_0x42a0b8(0x1b0)),console[_0x42a0b8(0x1ae)](_0x42a0b8(0x203)),0x1;if(!_0x2f82b5[_0x42a0b8(0x193)])throw new SDKError(ErrorCode[_0x42a0b8(0x180)],_0x42a0b8(0x1f7));const _0x29999a=await withSpinner(_0x42a0b8(0x183),()=>_0x5e1a06[_0x42a0b8(0x1e2)][_0x42a0b8(0x1e3)](_0x2f82b5['parentId'],_0x2f82b5[_0x42a0b8(0x193)]),{'verbose':_0x11c3cc[_0x42a0b8(0x205)]}),_0x5031d0=_0x29999a[_0x42a0b8(0x16c)];return _0x11c3cc['format']==='json'||_0x11c3cc[_0x42a0b8(0x1d2)]===_0x42a0b8(0x195)?await handleSDKOutput([{'sql':_0x5031d0}],_0x11c3cc):console[_0x42a0b8(0x1e4)](_0x5031d0),0x0;}catch(_0xe4d536){if(_0xe4d536 instanceof SDKError)return console[_0x42a0b8(0x1ae)](_0x42a0b8(0x18d)+_0xe4d536['message']),_0xe4d536[_0x42a0b8(0x206)]&&console['error']('\x20\x20Cause:\x20'+_0xe4d536['cause']),0x1;throw _0xe4d536;}}}export class SegmentFolderCreateCommand extends BaseCommand{['name']=a27_0x56960b(0x202);[a27_0x56960b(0x1a4)]='Create\x20segment\x20folder\x20for\x20organization';async['execute'](_0x336ee5){const _0x4dc840=a27_0x56960b,{options:_0x4b179c,args:_0x198a02,tdx:_0x209308}=_0x336ee5,_0x4aa1f0=_0x4b179c;if(_0x198a02[_0x4dc840(0x1fb)]<0x2)return console[_0x4dc840(0x1ae)]('Error:\x20Parent\x20segment\x20name\x20and\x20folder\x20name\x20are\x20required'),console[_0x4dc840(0x1ae)](_0x4dc840(0x1b5)),0x1;const _0x5d2e2a=_0x198a02[0x0],_0x106a01=_0x198a02[0x1];_0x4aa1f0[_0x4dc840(0x205)]&&(console[_0x4dc840(0x1ae)]('Site:\x20'+_0x4aa1f0[_0x4dc840(0x209)]),console[_0x4dc840(0x1ae)](_0x4dc840(0x1cf)+_0x5d2e2a),console[_0x4dc840(0x1ae)](_0x4dc840(0x196)+_0x106a01));let _0x59ecc2;if(_0x4aa1f0[_0x4dc840(0x177)]){const _0x172d65=_0x4aa1f0[_0x4dc840(0x177)],_0x494254=await withSpinner(_0x4dc840(0x17b)+_0x5d2e2a+_0x4dc840(0x188),()=>_0x209308[_0x4dc840(0x1e2)]['resolveParentId'](_0x5d2e2a),{'verbose':_0x4aa1f0[_0x4dc840(0x205)]}),_0x4bf286=_0x494254['data'],_0x44aee2=await withSpinner('Resolving\x20parent\x20folder\x20\x27'+_0x172d65+_0x4dc840(0x188),()=>_0x209308[_0x4dc840(0x1e2)][_0x4dc840(0x173)](_0x4bf286,_0x172d65),{'verbose':_0x4aa1f0[_0x4dc840(0x205)]});_0x59ecc2=_0x44aee2[_0x4dc840(0x16c)],_0x4aa1f0['verbose']&&console['error'](_0x4dc840(0x208)+_0x59ecc2);}const _0x1ec3b2={'name':_0x106a01,'description':_0x4aa1f0[_0x4dc840(0x1a4)],'parentFolderId':_0x59ecc2},_0x6c1e8c=await withSpinner('Creating\x20folder\x20\x27'+_0x106a01+_0x4dc840(0x188),()=>_0x209308[_0x4dc840(0x1e2)][_0x4dc840(0x1d6)](_0x5d2e2a,_0x1ec3b2),{'verbose':_0x4aa1f0[_0x4dc840(0x205)]}),_0x133ff6=_0x6c1e8c[_0x4dc840(0x16c)];return console['error'](_0x4dc840(0x1ed)+_0x133ff6[_0x4dc840(0x1df)]+_0x4dc840(0x1af)+_0x133ff6['id']),await handleSDKOutput([_0x133ff6],_0x4aa1f0),0x0;}}function a27_0x28f1(_0x355613,_0x4e935e){_0x355613=_0x355613-0x169;const _0x4edb61=a27_0x4edb();let _0x28f190=_0x4edb61[_0x355613];return _0x28f190;}export class SegmentViewCommand extends BaseCommand{[a27_0x56960b(0x1df)]='segment:view';[a27_0x56960b(0x1a4)]='Show\x20folder\x20or\x20child\x20segment\x20details';async['execute'](_0x977209){const _0x33abb9=a27_0x56960b,{options:_0x3253c5,args:_0x29998b,tdx:_0x498ef1}=_0x977209,_0x40de7f=_0x29998b[0x0];if(!_0x40de7f)return console[_0x33abb9(0x1ae)]('Error:\x20Folder\x20or\x20segment\x20name,\x20or\x20YAML\x20file\x20path\x20is\x20required'),console[_0x33abb9(0x1ae)](_0x33abb9(0x1fa)),console[_0x33abb9(0x1ae)](_0x33abb9(0x1f0)),console[_0x33abb9(0x1ae)](_0x33abb9(0x1a7)),console[_0x33abb9(0x1ae)]('\x20\x20-w,\x20--web\x20\x20Open\x20segment\x20in\x20web\x20browser'),console[_0x33abb9(0x1ae)](_0x33abb9(0x185)),console[_0x33abb9(0x1ae)](_0x33abb9(0x1f4)),console['error']('\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20\x20\x20\x20\x20#\x20View\x20child\x20segment\x20details'),console[_0x33abb9(0x1ae)](_0x33abb9(0x16f)),console[_0x33abb9(0x1ae)](_0x33abb9(0x171)),0x1;try{const _0x2016b6=_0x3253c5[_0x33abb9(0x179)],_0x2c0bdb=await resolveSegmentTarget(_0x40de7f,_0x2016b6,_0x3253c5[_0x33abb9(0x205)]);_0x3253c5[_0x33abb9(0x205)]&&console['error']('Target\x20path:\x20'+_0x2c0bdb);const _0xc6bca8=await withSpinner('Resolving\x20\x27'+_0x40de7f+_0x33abb9(0x188),()=>_0x498ef1[_0x33abb9(0x1e2)][_0x33abb9(0x18f)](_0x2c0bdb),{'verbose':_0x3253c5[_0x33abb9(0x205)]}),_0x314be6=_0xc6bca8['data'];_0x3253c5[_0x33abb9(0x205)]&&(console[_0x33abb9(0x1ae)](_0x33abb9(0x199)+_0x314be6[_0x33abb9(0x19d)]),console[_0x33abb9(0x1ae)](_0x33abb9(0x18b)+_0x314be6[_0x33abb9(0x1d5)]),_0x314be6[_0x33abb9(0x1a1)]&&console[_0x33abb9(0x1ae)](_0x33abb9(0x197)+_0x314be6[_0x33abb9(0x1a1)]),_0x314be6['segmentId']&&console[_0x33abb9(0x1ae)]('Segment\x20ID:\x20'+_0x314be6[_0x33abb9(0x193)]));if(_0x3253c5[_0x33abb9(0x1ac)]){if(_0x314be6[_0x33abb9(0x19d)]==='folder')return console[_0x33abb9(0x1ae)](_0x33abb9(0x1a2)),0x1;if(_0x314be6[_0x33abb9(0x19d)]==='parent')return console[_0x33abb9(0x1ae)]('Error:\x20Cannot\x20open\x20parent\x20segment\x20with\x20this\x20command.'),console[_0x33abb9(0x1ae)]('Use:\x20tdx\x20ps\x20view\x20-w'),0x1;if(!_0x314be6[_0x33abb9(0x193)])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x33abb9(0x1f7));const _0x485692=getConsoleNextUrl(_0x3253c5['site'],'/app/ps/'+_0x314be6['parentId']+'/e/'+_0x314be6[_0x33abb9(0x193)]);return console['error'](a27_0x102316[_0x33abb9(0x1ad)]('✔')+_0x33abb9(0x1d4)+a27_0x102316[_0x33abb9(0x1a3)](_0x485692)),openBrowser(_0x485692),0x0;}if(_0x314be6['type']===_0x33abb9(0x175)){if(!_0x314be6['folderId'])throw new SDKError(ErrorCode[_0x33abb9(0x18a)],_0x33abb9(0x1e8));const _0x32aef7=await withSpinner(_0x33abb9(0x1f3),()=>_0x498ef1[_0x33abb9(0x1e2)][_0x33abb9(0x1f6)](_0x314be6['folderId']),{'verbose':_0x3253c5['verbose']});await handleSingleObjectOutput(_0x32aef7['data'],_0x3253c5);}else{if(_0x314be6[_0x33abb9(0x19d)]==='segment'){if(!_0x314be6[_0x33abb9(0x193)])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x5c34ba=await withSpinner(_0x33abb9(0x189),()=>_0x498ef1[_0x33abb9(0x1e2)][_0x33abb9(0x1e1)](_0x314be6['parentId'],_0x314be6[_0x33abb9(0x193)]),{'verbose':_0x3253c5['verbose']}),_0x281139=getConsoleNextUrl(_0x3253c5[_0x33abb9(0x209)],_0x33abb9(0x19b)+_0x314be6[_0x33abb9(0x1d5)]+_0x33abb9(0x1d1)+_0x314be6[_0x33abb9(0x193)]),_0x5825d1=_0x5c34ba['data'];_0x5825d1[_0x33abb9(0x198)]=_0x281139,await handleSingleObjectOutput(_0x5825d1,_0x3253c5);}else return console[_0x33abb9(0x1ae)](_0x33abb9(0x1ee)),console['error']('Use:\x20tdx\x20ps\x20view'),0x1;}return 0x0;}catch(_0x4496ac){if(_0x4496ac instanceof SDKError)return console['error'](_0x33abb9(0x18d)+_0x4496ac[_0x33abb9(0x191)]),_0x4496ac[_0x33abb9(0x206)]&&console['error'](_0x33abb9(0x178)+_0x4496ac[_0x33abb9(0x206)]),0x1;throw _0x4496ac;}}}export const SegmentInfoCommand=SegmentViewCommand;export class SegmentDescCommand extends BaseCommand{['name']='segment:desc';[a27_0x56960b(0x1a4)]=a27_0x56960b(0x1d9);async[a27_0x56960b(0x1c8)](_0xc1cdef){const _0x254493=a27_0x56960b,{options:_0x9df834,args:_0x50fb45,tdx:_0x22a33d}=_0xc1cdef,_0x413f3e=_0x50fb45[0x0];if(!_0x413f3e)return console[_0x254493(0x1ae)](_0x254493(0x200)),console[_0x254493(0x1ae)](_0x254493(0x1c4)),console[_0x254493(0x1ae)](_0x254493(0x1b2)),console[_0x254493(0x1ae)](_0x254493(0x185)),console['error'](_0x254493(0x1ba)),console[_0x254493(0x1ae)]('\x20\x20tdx\x20sg\x20desc\x20segments/my-audience/premium-users.yml'),0x1;try{const _0x187524=_0x9df834[_0x254493(0x179)],_0x37f404=await resolveSegmentTarget(_0x413f3e,_0x187524,_0x9df834[_0x254493(0x205)]);_0x9df834['verbose']&&console[_0x254493(0x1ae)]('Target\x20path:\x20'+_0x37f404);const _0x338f5d=await withSpinner('Resolving\x20\x27'+_0x413f3e+_0x254493(0x188),()=>_0x22a33d[_0x254493(0x1e2)][_0x254493(0x18f)](_0x37f404),{'verbose':_0x9df834[_0x254493(0x205)]}),_0x29531c=_0x338f5d[_0x254493(0x16c)];_0x9df834[_0x254493(0x205)]&&(console['error'](_0x254493(0x199)+_0x29531c[_0x254493(0x19d)]),console[_0x254493(0x1ae)](_0x254493(0x18b)+_0x29531c[_0x254493(0x1d5)]));if(_0x29531c[_0x254493(0x19d)]===_0x254493(0x175))return console['error'](_0x254493(0x1a0)),console['error'](_0x254493(0x1a6)),0x1;if(_0x29531c[_0x254493(0x19d)]===_0x254493(0x1f1))return console[_0x254493(0x1ae)](_0x254493(0x1da)),console[_0x254493(0x1ae)](_0x254493(0x1bc)),0x1;if(!_0x29531c[_0x254493(0x193)])throw new SDKError(ErrorCode[_0x254493(0x180)],_0x254493(0x1f7));const _0x5152b5=await withSpinner(_0x254493(0x183),()=>_0x22a33d[_0x254493(0x1e2)][_0x254493(0x1e3)](_0x29531c[_0x254493(0x1d5)],_0x29531c[_0x254493(0x193)]),{'verbose':_0x9df834['verbose']}),_0x8fc37a=_0x5152b5[_0x254493(0x16c)],_0x57e00b=await executeSchemaQuery(_0x8fc37a,_0x22a33d,_0x9df834);return await handleQueryOutput(_0x57e00b,_0x9df834),0x0;}catch(_0x477cf1){if(_0x477cf1 instanceof SDKError)return console[_0x254493(0x1ae)]('Error:\x20'+_0x477cf1[_0x254493(0x191)]),_0x477cf1['cause']&&console[_0x254493(0x1ae)]('\x20\x20Cause:\x20'+_0x477cf1[_0x254493(0x206)]),0x1;throw _0x477cf1;}}}
1
+ const a27_0x25ae30=a27_0x3fbe;(function(_0x9f9a4e,_0x1d3ee1){const _0x41cc77=a27_0x3fbe,_0x30a5d3=_0x9f9a4e();while(!![]){try{const _0x3a2f61=parseInt(_0x41cc77(0xab))/0x1*(parseInt(_0x41cc77(0x10e))/0x2)+parseInt(_0x41cc77(0xbd))/0x3*(parseInt(_0x41cc77(0xd5))/0x4)+parseInt(_0x41cc77(0xa4))/0x5+-parseInt(_0x41cc77(0x8f))/0x6*(parseInt(_0x41cc77(0xac))/0x7)+parseInt(_0x41cc77(0xa6))/0x8*(parseInt(_0x41cc77(0x95))/0x9)+parseInt(_0x41cc77(0xef))/0xa+-parseInt(_0x41cc77(0xb7))/0xb;if(_0x3a2f61===_0x1d3ee1)break;else _0x30a5d3['push'](_0x30a5d3['shift']());}catch(_0x4d6ff7){_0x30a5d3['push'](_0x30a5d3['shift']());}}}(a27_0x495b,0x345ae));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';function a27_0x495b(){const _0x4f9823=['Listing\x20folders\x20for\x20parent\x20\x27','Resolving\x20\x27','listFolders','Resolved\x20type:\x20','1842tgLPNU','Error:\x20','segment','json','Error:\x20Cannot\x20view\x20parent\x20segment\x20details\x20with\x20this\x20command.','Usage:\x20tdx\x20segment\x20folder\x20show\x20<parent_name/folder_name>','34326drPDDn','Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required','site','Usage:\x20tdx\x20segment\x20describe\x20<path>','Resolved\x20parent\x20folder\x20ID:\x20','parent','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20view\x20<path/to/segment.yml>','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20-w\x20\x20#\x20Open\x20segment\x20in\x20web\x20browser','processedRows','web','segmentId','green','Error:\x20Cannot\x20execute\x20SQL\x20query\x20on\x20a\x20folder.','Use:\x20tdx\x20ps\x20show','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience\x22','673860XzmgEY','getParent','816UsAUXC','Options:','\x20\x20tdx\x20sg\x20desc\x20\x22Premium\x20Users\x22','Fetching\x20segment\x20details...','resolveParentId','21853bkhRSw','2282xLxWKv','Resolved\x20YAML\x20file:\x20','url','\x27...','Error:\x20Cannot\x20get\x20SQL\x20for\x20parent\x20segment\x20with\x20this\x20command.','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience/Marketing/High\x20Value\x22','folderId','Error:\x20Cannot\x20get\x20SQL\x20query\x20for\x20a\x20folder.','✔\x20Query\x20completed:\x20Processed\x20','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22','4528007EQEzeV','✔\x20Created\x20folder\x20\x27','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20sql\x20<path/to/segment.yml>','Segment\x20ID\x20missing\x20from\x20resolved\x20path','length','✖\x20Query\x20failed\x20[','3euUyOW','Resolving\x20parent\x20segment\x20\x27','cause','Folder\x20ID:\x20','toLocaleString','message','Resolving\x20parent\x20folder\x20\x27','Segment\x20ID:\x20','Error:\x20Parent\x20segment\x20name\x20and\x20folder\x20name\x20are\x20required','Resolving\x20path\x20\x27','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','Target\x20path:\x20','Usage:\x20tdx\x20segment\x20folder\x20list\x20<parent_name>','\x20\x20Cause:\x20','Error:\x20Folder\x20reference\x20is\x20required','segment:folder:list','setJobId','elapsedTimeMillis','Resolved\x20folder\x20ID:\x20','data','Error:\x20Folder\x20or\x20segment\x20name,\x20or\x20YAML\x20file\x20path\x20is\x20required','folder','segment:folder:show','getSegmentSQL','449076ZHacOl','Fetching\x20SQL\x20for\x20segment...','Executing\x20segment\x20query...','Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.','Use:\x20tdx\x20ps\x20view','query','\x20\x20tdx\x20sg\x20show\x20\x22Premium\x20Users\x22','Parent\x20name:\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20desc\x20<path/to/segment.yml>','name','Create\x20segment\x20folder\x20for\x20organization','Show\x20segment\x20folder\x20details','parentFolder','Folder\x20name:\x20','Usage:\x20tdx\x20segment\x20folder\x20create\x20<parent_name>\x20<folder_name>\x20[options]','✔\x20Found\x20','\x20\x20tdx\x20sg\x20sql\x20segments/my-audience/premium-users.yml','Folder\x20ID\x20missing\x20from\x20resolved\x20path','segment:describe','segment:show','jobId','\x20\x20tdx\x20sg\x20view\x20\x22Marketing\x22\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20folder\x20details','execute','segment:folder:create','format','Error:\x20Cannot\x20open\x20parent\x20segment\x20with\x20this\x20command.','463900bEAFsi','Error:\x20Cannot\x20open\x20folder\x20in\x20web\x20browser.\x20Use\x20a\x20segment\x20name\x20instead.','\x20\x20Folder\x20path:\x20','type','error','Use:\x20tdx\x20sg\x20view\x20<name>\x20\x20#\x20To\x20show\x20folder\x20details','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20show\x20<path/to/segment.yml>','getFolder','resolvePathToResource','\x20\x20tdx\x20sg\x20view\x20segments/my-audience/premium-users.yml','verbose','Resolved\x20relative\x20path\x20to:\x20','Usage:\x20tdx\x20sg\x20sql\x20<name>','parentSegment','Error:\x20Cannot\x20execute\x20query\x20for\x20parent\x20segment\x20with\x20this\x20command.','SELECT\x20*\x20FROM\x20(\x0a','getSegment','description','Parent\x20ID:\x20','segmentPath','Usage:\x20tdx\x20sg\x20show\x20<name>','Parent\x20segment:\x20','SEGMENT_NOT_FOUND','stats','Show\x20child\x20segment\x20schema\x20(column\x20types)','\x20\x20Full\x20path:\x20','Show\x20segment\x20or\x20folder\x20details','Execute\x20child\x20segment\x20SQL\x20query\x20and\x20show\x20results','segment:desc','SEGMENT_FOLDER_NOT_FOUND','Site:\x20','4pXANIN','code','\x20folder','parentId','Use:\x20tdx\x20ps\x20sql','\x20Opening\x20','fullPath','Resolved\x20parent\x20ID:\x20','log','\x20\x20tdx\x20sg\x20sql\x20\x22Premium\x20Users\x22','Fetching\x20folder\x20details...','/e/','jsonl','limit','Examples:','segment:sql','\x20\x20tdx\x20sg\x20desc\x20segments/my-audience/premium-users.yml','replace','folderPath','INVALID_ARGUMENT','\x27\x20with\x20ID:\x20','resolveFolderId','trim','Use:\x20tdx\x20ps\x20view\x20-w','Usage:\x20tdx\x20sg\x20desc\x20<name>','Fetching\x20folder\x20\x27','/app/ps/'];a27_0x495b=function(){return _0x4f9823;};return a27_0x495b();}import a27_0x445e51 from'chalk';async function resolveSegmentTarget(_0x1c6c51,_0x52b391,_0x6a46a){const _0x2cd276=a27_0x3fbe;if(isYamlFilePath(_0x1c6c51))try{const _0x24c2d8=await resolveYamlFilePath(_0x1c6c51);return _0x6a46a&&(console[_0x2cd276(0xf3)](_0x2cd276(0xad)+_0x1c6c51),console['error']('\x20\x20Parent\x20segment:\x20'+_0x24c2d8[_0x2cd276(0xfc)]),console['error']('\x20\x20Segment\x20name:\x20'+_0x24c2d8['segmentName']),console[_0x2cd276(0xf3)](_0x2cd276(0xf1)+(_0x24c2d8[_0x2cd276(0x82)]||'(root)')),console[_0x2cd276(0xf3)](_0x2cd276(0x108)+_0x24c2d8[_0x2cd276(0x76)])),_0x24c2d8[_0x2cd276(0x76)];}catch(_0x5d6f3d){throw new SDKError(ErrorCode[_0x2cd276(0x83)],'Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20'+_0x5d6f3d[_0x2cd276(0xc2)]);}if(!_0x52b391)throw new SDKError(ErrorCode[_0x2cd276(0x83)],_0x2cd276(0xb6));return _0x52b391+'/'+_0x1c6c51;}export class SegmentDescribeCommand extends BaseCommand{['name']=a27_0x25ae30(0xe7);['description']=a27_0x25ae30(0x109);async[a27_0x25ae30(0xeb)](_0x4e7d4f){const _0x49557c=a27_0x25ae30,{options:_0x2d6850,args:_0x59909d,tdx:_0x3f47b4}=_0x4e7d4f,_0x264f04=_0x59909d[0x0],_0xf1d4e5=!_0x264f04&&!!_0x2d6850[_0x49557c(0xfc)],_0x584c10=_0x264f04||_0x2d6850[_0x49557c(0xfc)];if(!_0x584c10)return console[_0x49557c(0xf3)]('Error:\x20Path\x20or\x20name\x20is\x20required'),console[_0x49557c(0xf3)](_0x49557c(0x98)),console['error'](_0x49557c(0x7e)),console[_0x49557c(0xf3)](_0x49557c(0xa3)),console['error'](_0x49557c(0xb1)),console['error']('\x20\x20tdx\x20segment\x20describe\x20\x22High\x20Value\x22\x20\x20\x20\x20#\x20Relative\x20to\x20current\x20context'),console[_0x49557c(0xf3)](_0x49557c(0xb5)),0x1;try{const _0x39af06=_0x2d6850[_0x49557c(0x102)];let _0x32e13c=_0x584c10;!_0xf1d4e5&&_0x39af06&&!_0x584c10['includes']('/')&&(_0x32e13c=_0x39af06+'/'+_0x584c10,_0x2d6850[_0x49557c(0xf9)]&&console[_0x49557c(0xf3)](_0x49557c(0xfa)+_0x32e13c));const _0x396d2d=await withSpinner(_0x49557c(0xc6)+_0x32e13c+_0x49557c(0xaf),()=>_0x3f47b4[_0x49557c(0x91)][_0x49557c(0xf7)](_0x32e13c),{'verbose':_0x2d6850[_0x49557c(0xf9)]}),_0x2071aa=_0x396d2d['data'];_0x2d6850[_0x49557c(0xf9)]&&(console[_0x49557c(0xf3)](_0x49557c(0x8e)+_0x2071aa[_0x49557c(0xf2)]),console[_0x49557c(0xf3)](_0x49557c(0x101)+_0x2071aa[_0x49557c(0x73)]),_0x2071aa[_0x49557c(0xb2)]&&console[_0x49557c(0xf3)]('Folder\x20ID:\x20'+_0x2071aa[_0x49557c(0xb2)]),_0x2071aa[_0x49557c(0x9f)]&&console[_0x49557c(0xf3)](_0x49557c(0xc4)+_0x2071aa[_0x49557c(0x9f)]));if(_0x2071aa[_0x49557c(0xf2)]===_0x49557c(0x9a)){const _0xdf587e=await withSpinner('Fetching\x20parent\x20segment\x20details...',()=>_0x3f47b4['segment'][_0x49557c(0xa5)](_0x2071aa[_0x49557c(0x73)]),{'verbose':_0x2d6850[_0x49557c(0xf9)]});await handleSingleObjectOutput(_0xdf587e['data'],_0x2d6850);}else{if(_0x2071aa[_0x49557c(0xf2)]===_0x49557c(0xd2)){if(!_0x2071aa['folderId'])throw new SDKError(ErrorCode[_0x49557c(0x10c)],_0x49557c(0xe6));const _0x2a4cd5=await withSpinner(_0x49557c(0x7a),()=>_0x3f47b4[_0x49557c(0x91)]['getFolder'](_0x2071aa['folderId']),{'verbose':_0x2d6850['verbose']});await handleSingleObjectOutput(_0x2a4cd5[_0x49557c(0xd0)],_0x2d6850);}else{if(_0x2071aa['type']===_0x49557c(0x91)){if(!_0x2071aa['segmentId'])throw new SDKError(ErrorCode[_0x49557c(0x105)],_0x49557c(0xba));const _0x45577e=await withSpinner('Fetching\x20segment\x20details...',()=>_0x3f47b4[_0x49557c(0x91)][_0x49557c(0xff)](_0x2071aa[_0x49557c(0x73)],_0x2071aa['segmentId']),{'verbose':_0x2d6850[_0x49557c(0xf9)]});await handleSingleObjectOutput(_0x45577e[_0x49557c(0xd0)],_0x2d6850);}}}return 0x0;}catch(_0x1d3898){if(_0x1d3898 instanceof SDKError)return console[_0x49557c(0xf3)](_0x49557c(0x90)+_0x1d3898[_0x49557c(0xc2)]),_0x1d3898[_0x49557c(0xbf)]&&console[_0x49557c(0xf3)](_0x49557c(0xca)+_0x1d3898[_0x49557c(0xbf)]),0x1;throw _0x1d3898;}}}export class SegmentShowCommand extends BaseCommand{[a27_0x25ae30(0xde)]=a27_0x25ae30(0xe8);[a27_0x25ae30(0x100)]=a27_0x25ae30(0x10a);async[a27_0x25ae30(0xeb)](_0x5cc1a3){const _0xa51962=a27_0x25ae30,{options:_0x29b951,args:_0x40df9a,tdx:_0x71b755}=_0x5cc1a3,_0x94f4d3=_0x40df9a[0x0];if(!_0x94f4d3)return console['error'](_0xa51962(0x96)),console[_0xa51962(0xf3)](_0xa51962(0x103)),console[_0xa51962(0xf3)](_0xa51962(0xf5)),console[_0xa51962(0xf3)](_0xa51962(0x7e)),console[_0xa51962(0xf3)](_0xa51962(0xdb)),console[_0xa51962(0xf3)]('\x20\x20tdx\x20sg\x20show\x20segments/my-audience/premium-users.yml'),0x1;try{const _0x495f22=_0x29b951[_0xa51962(0xfc)],_0x322d3d=await resolveSegmentTarget(_0x94f4d3,_0x495f22,_0x29b951[_0xa51962(0xf9)]);_0x29b951[_0xa51962(0xf9)]&&console[_0xa51962(0xf3)](_0xa51962(0xc8)+_0x322d3d);const _0x3f1c0c=await withSpinner(_0xa51962(0x8c)+_0x94f4d3+_0xa51962(0xaf),()=>_0x71b755[_0xa51962(0x91)]['resolvePathToResource'](_0x322d3d),{'verbose':_0x29b951['verbose']}),_0x365ba9=_0x3f1c0c[_0xa51962(0xd0)];_0x29b951[_0xa51962(0xf9)]&&(console[_0xa51962(0xf3)](_0xa51962(0x8e)+_0x365ba9[_0xa51962(0xf2)]),console[_0xa51962(0xf3)](_0xa51962(0x101)+_0x365ba9[_0xa51962(0x73)]));if(_0x365ba9[_0xa51962(0xf2)]===_0xa51962(0xd2))return console['error'](_0xa51962(0xa1)),console[_0xa51962(0xf3)](_0xa51962(0xf4)),0x1;if(_0x365ba9[_0xa51962(0xf2)]===_0xa51962(0x9a))return console[_0xa51962(0xf3)](_0xa51962(0xfd)),console[_0xa51962(0xf3)](_0xa51962(0xa2)),0x1;if(!_0x365ba9[_0xa51962(0x9f)])throw new SDKError(ErrorCode[_0xa51962(0x105)],_0xa51962(0xba));const _0x153dcb=await withSpinner(_0xa51962(0xd6),()=>_0x71b755[_0xa51962(0x91)][_0xa51962(0xd4)](_0x365ba9[_0xa51962(0x73)],_0x365ba9[_0xa51962(0x9f)]),{'verbose':_0x29b951[_0xa51962(0xf9)]});let _0x3e0365=_0x153dcb[_0xa51962(0xd0)];const _0x278bf4=resolveLimit(_0x29b951[_0xa51962(0x7d)],DEFAULT_DISPLAY_LIMIT),_0x3f03ff=/\bLIMIT\s+\d+/i['test'](_0x3e0365);!_0x3f03ff&&(_0x3e0365=_0x3e0365[_0xa51962(0x86)]()[_0xa51962(0x81)](/;+$/,''),_0x3e0365=_0xa51962(0xfe)+_0x3e0365+_0xa51962(0xc7)+_0x278bf4);_0x29b951[_0xa51962(0xf9)]&&console['error']('SQL\x20query:\x0a'+_0x3e0365);const _0x11bfb1=await withProgressSpinner(_0xa51962(0xd7),async _0x2e68d9=>{const _0x24d4b3=_0xa51962,_0x451f4f=await _0x71b755[_0x24d4b3(0xda)]['execute'](_0x3e0365,{'catalog':'td','schema':'information_schema','onJobId':_0x448db3=>{const _0x5cc4fb=_0x24d4b3;_0x2e68d9[_0x5cc4fb(0xcd)](_0x448db3);}});return _0x451f4f;},{'verbose':_0x29b951['verbose']}),_0x477b49=_0x11bfb1[_0xa51962(0xd0)],_0x580e79=_0x477b49[_0xa51962(0xe9)]?'\x20[Job\x20ID:\x20'+_0x477b49['jobId']+']':'';return console[_0xa51962(0xf3)](_0xa51962(0xb4)+_0x477b49[_0xa51962(0x106)][_0xa51962(0x9d)][_0xa51962(0xc1)]()+'\x20rows\x20'+('in\x20'+formatElapsed(_0x477b49['stats'][_0xa51962(0xce)])+_0x580e79)),await handleQueryOutput(_0x477b49,_0x29b951),0x0;}catch(_0x39d214){if(_0x39d214 instanceof SDKError)return console[_0xa51962(0xf3)](_0xa51962(0xbc)+_0x39d214[_0xa51962(0x10f)]+']'),console['error']('\x0a'+_0x39d214[_0xa51962(0xc2)]),0x1;throw _0x39d214;}}}export class SegmentFolderListCommand extends BaseCommand{['name']=a27_0x25ae30(0xcc);[a27_0x25ae30(0x100)]='List\x20segment\x20folders\x20under\x20a\x20parent\x20segment';async[a27_0x25ae30(0xeb)](_0x19f3de){const _0x11d829=a27_0x25ae30,{options:_0x5af6ca,args:_0x485592,tdx:_0xc931e4}=_0x19f3de;if(_0x485592['length']===0x0)return console[_0x11d829(0xf3)]('Error:\x20Parent\x20segment\x20name\x20is\x20required'),console[_0x11d829(0xf3)](_0x11d829(0xc9)),0x1;const _0x3cc119=_0x485592[0x0];try{_0x5af6ca['verbose']&&(console[_0x11d829(0xf3)](_0x11d829(0x10d)+_0x5af6ca[_0x11d829(0x97)]),console['error']('Parent\x20name:\x20'+_0x3cc119));const _0x1d7c81=await withSpinner(_0x11d829(0xbe)+_0x3cc119+'\x27...',()=>_0xc931e4['segment'][_0x11d829(0xaa)](_0x3cc119),{'verbose':_0x5af6ca['verbose']}),_0x51daab=_0x1d7c81['data'];_0x5af6ca['verbose']&&console['error']('Resolved\x20parent\x20ID:\x20'+_0x51daab);const _0x46a989=await withSpinner(_0x11d829(0x8b)+_0x3cc119+_0x11d829(0xaf),()=>_0xc931e4[_0x11d829(0x91)][_0x11d829(0x8d)](_0x51daab),{'verbose':_0x5af6ca[_0x11d829(0xf9)]}),_0x125d6f=_0x46a989[_0x11d829(0xd0)];return console[_0x11d829(0xf3)](_0x11d829(0xe4)+_0x125d6f[_0x11d829(0xbb)]+_0x11d829(0x72)+(_0x125d6f[_0x11d829(0xbb)]!==0x1?'s':'')),await handleSDKOutput(_0x125d6f,_0x5af6ca),0x0;}catch(_0x242438){if(_0x242438 instanceof SDKError)return console[_0x11d829(0xf3)](_0x11d829(0x90)+_0x242438[_0x11d829(0xc2)]),_0x242438[_0x11d829(0xbf)]&&console[_0x11d829(0xf3)](_0x11d829(0xca)+_0x242438[_0x11d829(0xbf)]),0x1;throw _0x242438;}}}export class SegmentFolderShowCommand extends BaseCommand{[a27_0x25ae30(0xde)]=a27_0x25ae30(0xd3);[a27_0x25ae30(0x100)]=a27_0x25ae30(0xe0);async['execute'](_0x56077c){const _0x5e7368=a27_0x25ae30,{options:_0x133ba9,args:_0x5bee0f,tdx:_0x5b49db}=_0x56077c;if(_0x5bee0f[_0x5e7368(0xbb)]===0x0)return console[_0x5e7368(0xf3)](_0x5e7368(0xcb)),console[_0x5e7368(0xf3)](_0x5e7368(0x94)),0x1;try{const {parentId:_0x1c0a8a,childId:_0x37d658}=parseSegmentRef(_0x5bee0f[0x0]);_0x133ba9[_0x5e7368(0xf9)]&&(console[_0x5e7368(0xf3)](_0x5e7368(0x10d)+_0x133ba9[_0x5e7368(0x97)]),console[_0x5e7368(0xf3)](_0x5e7368(0xdc)+_0x1c0a8a),_0x37d658&&console['error'](_0x5e7368(0xe2)+_0x37d658));if(!_0x37d658)return console[_0x5e7368(0xf3)]('Error:\x20Folder\x20name\x20is\x20required\x20(use\x20parent_name/folder_name\x20format)'),0x1;const _0x4ea13b=await withSpinner(_0x5e7368(0xbe)+_0x1c0a8a+_0x5e7368(0xaf),()=>_0x5b49db[_0x5e7368(0x91)][_0x5e7368(0xaa)](_0x1c0a8a),{'verbose':_0x133ba9['verbose']}),_0x53559d=_0x4ea13b[_0x5e7368(0xd0)];_0x133ba9[_0x5e7368(0xf9)]&&console['error'](_0x5e7368(0x77)+_0x53559d);const _0x5cd94e=await withSpinner('Resolving\x20folder\x20\x27'+_0x37d658+_0x5e7368(0xaf),()=>_0x5b49db[_0x5e7368(0x91)][_0x5e7368(0x85)](_0x53559d,_0x37d658),{'verbose':_0x133ba9[_0x5e7368(0xf9)]}),_0x50b848=_0x5cd94e[_0x5e7368(0xd0)];_0x133ba9[_0x5e7368(0xf9)]&&console[_0x5e7368(0xf3)](_0x5e7368(0xcf)+_0x50b848);const _0xfc8867=await withSpinner(_0x5e7368(0x89)+_0x37d658+_0x5e7368(0xaf),()=>_0x5b49db[_0x5e7368(0x91)][_0x5e7368(0xf6)](_0x50b848),{'verbose':_0x133ba9['verbose']});return await handleSDKOutput([_0xfc8867[_0x5e7368(0xd0)]],_0x133ba9),0x0;}catch(_0x225e53){if(_0x225e53 instanceof SDKError)return console[_0x5e7368(0xf3)]('Error:\x20'+_0x225e53[_0x5e7368(0xc2)]),_0x225e53[_0x5e7368(0xbf)]&&console[_0x5e7368(0xf3)](_0x5e7368(0xca)+_0x225e53[_0x5e7368(0xbf)]),0x1;throw _0x225e53;}}}export class SegmentSQLCommand extends BaseCommand{['name']=a27_0x25ae30(0x7f);[a27_0x25ae30(0x100)]='Get\x20SQL\x20query\x20for\x20child\x20segment';async[a27_0x25ae30(0xeb)](_0x193efc){const _0x2e12ff=a27_0x25ae30,{options:_0x5eed5f,args:_0x397048,tdx:_0x20fd05}=_0x193efc,_0x55c78e=_0x397048[0x0];if(!_0x55c78e)return console[_0x2e12ff(0xf3)]('Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required'),console[_0x2e12ff(0xf3)](_0x2e12ff(0xfb)),console['error'](_0x2e12ff(0xb9)),console[_0x2e12ff(0xf3)](_0x2e12ff(0x7e)),console['error'](_0x2e12ff(0x79)),console[_0x2e12ff(0xf3)](_0x2e12ff(0xe5)),0x1;try{const _0x27b09e=_0x5eed5f[_0x2e12ff(0xfc)],_0x3b802d=await resolveSegmentTarget(_0x55c78e,_0x27b09e,_0x5eed5f[_0x2e12ff(0xf9)]);_0x5eed5f[_0x2e12ff(0xf9)]&&console[_0x2e12ff(0xf3)](_0x2e12ff(0xc8)+_0x3b802d);const _0x449a02=await withSpinner(_0x2e12ff(0x8c)+_0x55c78e+_0x2e12ff(0xaf),()=>_0x20fd05[_0x2e12ff(0x91)][_0x2e12ff(0xf7)](_0x3b802d),{'verbose':_0x5eed5f[_0x2e12ff(0xf9)]}),_0x1849b3=_0x449a02[_0x2e12ff(0xd0)];_0x5eed5f[_0x2e12ff(0xf9)]&&(console[_0x2e12ff(0xf3)]('Resolved\x20type:\x20'+_0x1849b3[_0x2e12ff(0xf2)]),console[_0x2e12ff(0xf3)]('Parent\x20ID:\x20'+_0x1849b3[_0x2e12ff(0x73)]));if(_0x1849b3[_0x2e12ff(0xf2)]===_0x2e12ff(0xd2))return console[_0x2e12ff(0xf3)](_0x2e12ff(0xb3)),console[_0x2e12ff(0xf3)](_0x2e12ff(0xd8)),0x1;if(_0x1849b3[_0x2e12ff(0xf2)]==='parent')return console[_0x2e12ff(0xf3)](_0x2e12ff(0xb0)),console[_0x2e12ff(0xf3)](_0x2e12ff(0x74)),0x1;if(!_0x1849b3[_0x2e12ff(0x9f)])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x238d0a=await withSpinner(_0x2e12ff(0xd6),()=>_0x20fd05[_0x2e12ff(0x91)][_0x2e12ff(0xd4)](_0x1849b3[_0x2e12ff(0x73)],_0x1849b3['segmentId']),{'verbose':_0x5eed5f['verbose']}),_0x520b2c=_0x238d0a[_0x2e12ff(0xd0)];return _0x5eed5f[_0x2e12ff(0xed)]===_0x2e12ff(0x92)||_0x5eed5f['format']===_0x2e12ff(0x7c)?await handleSDKOutput([{'sql':_0x520b2c}],_0x5eed5f):console[_0x2e12ff(0x78)](_0x520b2c),0x0;}catch(_0x537598){if(_0x537598 instanceof SDKError)return console[_0x2e12ff(0xf3)](_0x2e12ff(0x90)+_0x537598[_0x2e12ff(0xc2)]),_0x537598['cause']&&console['error'](_0x2e12ff(0xca)+_0x537598[_0x2e12ff(0xbf)]),0x1;throw _0x537598;}}}export class SegmentFolderCreateCommand extends BaseCommand{['name']=a27_0x25ae30(0xec);['description']=a27_0x25ae30(0xdf);async[a27_0x25ae30(0xeb)](_0x355c24){const _0x36c6f8=a27_0x25ae30,{options:_0x2517d0,args:_0x1b63ae,tdx:_0x3c8c04}=_0x355c24,_0x3fb8a7=_0x2517d0;if(_0x1b63ae[_0x36c6f8(0xbb)]<0x2)return console[_0x36c6f8(0xf3)](_0x36c6f8(0xc5)),console['error'](_0x36c6f8(0xe3)),0x1;const _0x2024a4=_0x1b63ae[0x0],_0x59fdd3=_0x1b63ae[0x1];_0x3fb8a7['verbose']&&(console['error']('Site:\x20'+_0x3fb8a7['site']),console[_0x36c6f8(0xf3)](_0x36c6f8(0x104)+_0x2024a4),console[_0x36c6f8(0xf3)](_0x36c6f8(0xe2)+_0x59fdd3));let _0x38d512;if(_0x3fb8a7['parentFolder']){const _0x397164=_0x3fb8a7[_0x36c6f8(0xe1)],_0x4ee655=await withSpinner(_0x36c6f8(0xbe)+_0x2024a4+_0x36c6f8(0xaf),()=>_0x3c8c04[_0x36c6f8(0x91)][_0x36c6f8(0xaa)](_0x2024a4),{'verbose':_0x3fb8a7[_0x36c6f8(0xf9)]}),_0x5351cb=_0x4ee655[_0x36c6f8(0xd0)],_0x2ff586=await withSpinner(_0x36c6f8(0xc3)+_0x397164+_0x36c6f8(0xaf),()=>_0x3c8c04['segment'][_0x36c6f8(0x85)](_0x5351cb,_0x397164),{'verbose':_0x3fb8a7[_0x36c6f8(0xf9)]});_0x38d512=_0x2ff586['data'],_0x3fb8a7[_0x36c6f8(0xf9)]&&console['error'](_0x36c6f8(0x99)+_0x38d512);}const _0x1d6d99={'name':_0x59fdd3,'description':_0x3fb8a7[_0x36c6f8(0x100)],'parentFolderId':_0x38d512},_0x1dbc51=await withSpinner('Creating\x20folder\x20\x27'+_0x59fdd3+_0x36c6f8(0xaf),()=>_0x3c8c04[_0x36c6f8(0x91)]['createFolder'](_0x2024a4,_0x1d6d99),{'verbose':_0x3fb8a7['verbose']}),_0x47841c=_0x1dbc51[_0x36c6f8(0xd0)];return console[_0x36c6f8(0xf3)](_0x36c6f8(0xb8)+_0x47841c[_0x36c6f8(0xde)]+_0x36c6f8(0x84)+_0x47841c['id']),await handleSDKOutput([_0x47841c],_0x3fb8a7),0x0;}}export class SegmentViewCommand extends BaseCommand{['name']='segment:view';[a27_0x25ae30(0x100)]='Show\x20folder\x20or\x20child\x20segment\x20details';async[a27_0x25ae30(0xeb)](_0x11f519){const _0x28ff9e=a27_0x25ae30,{options:_0x146f05,args:_0x98aee2,tdx:_0x157ab5}=_0x11f519,_0x25b83e=_0x98aee2[0x0];if(!_0x25b83e)return console['error'](_0x28ff9e(0xd1)),console[_0x28ff9e(0xf3)]('Usage:\x20tdx\x20sg\x20view\x20<name>\x20[-w]'),console[_0x28ff9e(0xf3)](_0x28ff9e(0x9b)),console['error'](_0x28ff9e(0xa7)),console['error']('\x20\x20-w,\x20--web\x20\x20Open\x20segment\x20in\x20web\x20browser'),console[_0x28ff9e(0xf3)]('Examples:'),console[_0x28ff9e(0xf3)](_0x28ff9e(0xea)),console[_0x28ff9e(0xf3)]('\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20\x20\x20\x20\x20#\x20View\x20child\x20segment\x20details'),console[_0x28ff9e(0xf3)](_0x28ff9e(0x9c)),console[_0x28ff9e(0xf3)](_0x28ff9e(0xf8)),0x1;try{const _0x24e1b3=_0x146f05[_0x28ff9e(0xfc)],_0x2ee817=await resolveSegmentTarget(_0x25b83e,_0x24e1b3,_0x146f05[_0x28ff9e(0xf9)]);_0x146f05[_0x28ff9e(0xf9)]&&console[_0x28ff9e(0xf3)]('Target\x20path:\x20'+_0x2ee817);const _0x306278=await withSpinner(_0x28ff9e(0x8c)+_0x25b83e+_0x28ff9e(0xaf),()=>_0x157ab5['segment'][_0x28ff9e(0xf7)](_0x2ee817),{'verbose':_0x146f05[_0x28ff9e(0xf9)]}),_0x4b84a7=_0x306278[_0x28ff9e(0xd0)];_0x146f05[_0x28ff9e(0xf9)]&&(console[_0x28ff9e(0xf3)](_0x28ff9e(0x8e)+_0x4b84a7[_0x28ff9e(0xf2)]),console[_0x28ff9e(0xf3)]('Parent\x20ID:\x20'+_0x4b84a7['parentId']),_0x4b84a7['folderId']&&console[_0x28ff9e(0xf3)](_0x28ff9e(0xc0)+_0x4b84a7[_0x28ff9e(0xb2)]),_0x4b84a7[_0x28ff9e(0x9f)]&&console[_0x28ff9e(0xf3)](_0x28ff9e(0xc4)+_0x4b84a7[_0x28ff9e(0x9f)]));if(_0x146f05[_0x28ff9e(0x9e)]){if(_0x4b84a7['type']==='folder')return console[_0x28ff9e(0xf3)](_0x28ff9e(0xf0)),0x1;if(_0x4b84a7[_0x28ff9e(0xf2)]===_0x28ff9e(0x9a))return console[_0x28ff9e(0xf3)](_0x28ff9e(0xee)),console[_0x28ff9e(0xf3)](_0x28ff9e(0x87)),0x1;if(!_0x4b84a7[_0x28ff9e(0x9f)])throw new SDKError(ErrorCode[_0x28ff9e(0x105)],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x35aa64=getConsoleNextUrl(_0x146f05[_0x28ff9e(0x97)],_0x28ff9e(0x8a)+_0x4b84a7[_0x28ff9e(0x73)]+_0x28ff9e(0x7b)+_0x4b84a7[_0x28ff9e(0x9f)]);return console[_0x28ff9e(0xf3)](a27_0x445e51[_0x28ff9e(0xa0)]('✔')+_0x28ff9e(0x75)+a27_0x445e51['cyan'](_0x35aa64)),openBrowser(_0x35aa64),0x0;}if(_0x4b84a7[_0x28ff9e(0xf2)]==='folder'){if(!_0x4b84a7[_0x28ff9e(0xb2)])throw new SDKError(ErrorCode[_0x28ff9e(0x10c)],_0x28ff9e(0xe6));const _0xcac6d7=await withSpinner(_0x28ff9e(0x7a),()=>_0x157ab5[_0x28ff9e(0x91)][_0x28ff9e(0xf6)](_0x4b84a7[_0x28ff9e(0xb2)]),{'verbose':_0x146f05[_0x28ff9e(0xf9)]});await handleSingleObjectOutput(_0xcac6d7[_0x28ff9e(0xd0)],_0x146f05);}else{if(_0x4b84a7['type']==='segment'){if(!_0x4b84a7[_0x28ff9e(0x9f)])throw new SDKError(ErrorCode[_0x28ff9e(0x105)],_0x28ff9e(0xba));const _0x4a62d8=await withSpinner(_0x28ff9e(0xa9),()=>_0x157ab5['segment'][_0x28ff9e(0xff)](_0x4b84a7['parentId'],_0x4b84a7[_0x28ff9e(0x9f)]),{'verbose':_0x146f05[_0x28ff9e(0xf9)]}),_0x103970=getConsoleNextUrl(_0x146f05[_0x28ff9e(0x97)],_0x28ff9e(0x8a)+_0x4b84a7[_0x28ff9e(0x73)]+_0x28ff9e(0x7b)+_0x4b84a7[_0x28ff9e(0x9f)]),_0x114ff0=_0x4a62d8['data'];_0x114ff0[_0x28ff9e(0xae)]=_0x103970,await handleSingleObjectOutput(_0x114ff0,_0x146f05);}else return console[_0x28ff9e(0xf3)](_0x28ff9e(0x93)),console[_0x28ff9e(0xf3)](_0x28ff9e(0xd9)),0x1;}return 0x0;}catch(_0x32e877){if(_0x32e877 instanceof SDKError)return console['error']('Error:\x20'+_0x32e877[_0x28ff9e(0xc2)]),_0x32e877[_0x28ff9e(0xbf)]&&console[_0x28ff9e(0xf3)](_0x28ff9e(0xca)+_0x32e877[_0x28ff9e(0xbf)]),0x1;throw _0x32e877;}}}function a27_0x3fbe(_0x4ad724,_0x114042){_0x4ad724=_0x4ad724-0x72;const _0x495b06=a27_0x495b();let _0x3fbe5e=_0x495b06[_0x4ad724];return _0x3fbe5e;}export const SegmentInfoCommand=SegmentViewCommand;export class SegmentDescCommand extends BaseCommand{['name']=a27_0x25ae30(0x10b);[a27_0x25ae30(0x100)]=a27_0x25ae30(0x107);async['execute'](_0x5b46da){const _0x561455=a27_0x25ae30,{options:_0x3183b9,args:_0x4a071f,tdx:_0x1cea4f}=_0x5b46da,_0x53432e=_0x4a071f[0x0];if(!_0x53432e)return console['error'](_0x561455(0x96)),console['error'](_0x561455(0x88)),console[_0x561455(0xf3)](_0x561455(0xdd)),console['error'](_0x561455(0x7e)),console[_0x561455(0xf3)](_0x561455(0xa8)),console[_0x561455(0xf3)](_0x561455(0x80)),0x1;try{const _0x1641fe=_0x3183b9[_0x561455(0xfc)],_0x1c1f71=await resolveSegmentTarget(_0x53432e,_0x1641fe,_0x3183b9[_0x561455(0xf9)]);_0x3183b9[_0x561455(0xf9)]&&console[_0x561455(0xf3)]('Target\x20path:\x20'+_0x1c1f71);const _0xd59c93=await withSpinner(_0x561455(0x8c)+_0x53432e+_0x561455(0xaf),()=>_0x1cea4f['segment']['resolvePathToResource'](_0x1c1f71),{'verbose':_0x3183b9[_0x561455(0xf9)]}),_0x3c8650=_0xd59c93[_0x561455(0xd0)];_0x3183b9[_0x561455(0xf9)]&&(console[_0x561455(0xf3)](_0x561455(0x8e)+_0x3c8650[_0x561455(0xf2)]),console['error'](_0x561455(0x101)+_0x3c8650[_0x561455(0x73)]));if(_0x3c8650[_0x561455(0xf2)]==='folder')return console[_0x561455(0xf3)]('Error:\x20Cannot\x20show\x20schema\x20for\x20a\x20folder.'),console[_0x561455(0xf3)](_0x561455(0xd8)),0x1;if(_0x3c8650[_0x561455(0xf2)]===_0x561455(0x9a))return console[_0x561455(0xf3)]('Error:\x20Cannot\x20show\x20schema\x20for\x20parent\x20segment\x20with\x20this\x20command.'),console[_0x561455(0xf3)]('Use:\x20tdx\x20ps\x20desc'),0x1;if(!_0x3c8650['segmentId'])throw new SDKError(ErrorCode[_0x561455(0x105)],_0x561455(0xba));const _0x8b2455=await withSpinner(_0x561455(0xd6),()=>_0x1cea4f[_0x561455(0x91)]['getSegmentSQL'](_0x3c8650[_0x561455(0x73)],_0x3c8650[_0x561455(0x9f)]),{'verbose':_0x3183b9[_0x561455(0xf9)]}),_0x308eb5=_0x8b2455[_0x561455(0xd0)],_0x88f158=await executeSchemaQuery(_0x308eb5,_0x1cea4f,_0x3183b9);return await handleQueryOutput(_0x88f158,_0x3183b9),0x0;}catch(_0x19db14){if(_0x19db14 instanceof SDKError)return console[_0x561455(0xf3)](_0x561455(0x90)+_0x19db14['message']),_0x19db14['cause']&&console[_0x561455(0xf3)](_0x561455(0xca)+_0x19db14['cause']),0x1;throw _0x19db14;}}}
@@ -1 +1 @@
1
- const a28_0x505b4f=a28_0x5eed;(function(_0x42f679,_0x42dc1a){const _0xa65fb3=a28_0x5eed,_0x17c68a=_0x42f679();while(!![]){try{const _0x252777=-parseInt(_0xa65fb3(0x115))/0x1+parseInt(_0xa65fb3(0xf6))/0x2*(-parseInt(_0xa65fb3(0x105))/0x3)+parseInt(_0xa65fb3(0x122))/0x4*(parseInt(_0xa65fb3(0x111))/0x5)+parseInt(_0xa65fb3(0xf8))/0x6+parseInt(_0xa65fb3(0x123))/0x7*(parseInt(_0xa65fb3(0x114))/0x8)+parseInt(_0xa65fb3(0xf5))/0x9*(parseInt(_0xa65fb3(0x10f))/0xa)+parseInt(_0xa65fb3(0xff))/0xb*(-parseInt(_0xa65fb3(0x104))/0xc);if(_0x252777===_0x42dc1a)break;else _0x17c68a['push'](_0x17c68a['shift']());}catch(_0x334dc4){_0x17c68a['push'](_0x17c68a['shift']());}}}(a28_0x2861,0x38c75));import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../core/command-output.js';function a28_0x5eed(_0x481f6a,_0x5b46ee){_0x481f6a=_0x481f6a-0xf0;const _0x28613a=a28_0x2861();let _0x5eed7a=_0x28613a[_0x481f6a];return _0x5eed7a;}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_0x2861(){const _0x1e011b=['description','10sLBwNt','segments','length','360504oKspKZ','400514iqpDLl','Error:\x20Segment\x20path\x20or\x20name\x20is\x20required','Site:\x20','verbose','Examples:','rule','\x20\x20\x20Path:\x20','segment','Parent:\x20','parent','data','error','folder','155804kldsEs','35WspjIv','resolvePathToResource','Segment\x20name:\x20','Resolved\x20relative\x20path\x20to:\x20','type','Create\x20child\x20segment\x20with\x20filtering\x20rules','kind','72QdQcCQ','2rzrDvc','site','2090520VfZSWl','Target\x20path:\x20','Usage:\x20tdx\x20segment\x20create\x20<path>\x20[options]','folderId','noCountPopulation','Error:\x20Cannot\x20create\x20segment\x20in\x20a\x20segment.\x20Parent\x20path\x20must\x20be\x20a\x20folder\x20or\x20parent.','\x27...','11IwMHJa','\x20\x20Use\x20`tdx\x20sg\x20push`\x20with\x20YAML\x20files\x20instead.\x0a','⚠\x20Deprecation\x20warning:\x20`segment\x20create`\x20is\x20deprecated.','includes','Error:\x20Full\x20path\x20required\x20(parent/segment_name\x20or\x20parent/folder/segment_name)','3492612SmovWu','510441mwAOhb','✔\x20Created\x20segment\x20\x27','yellow','segment:create','resolveFolderId','resolveParentId','Resolving\x20folder\x20path\x20\x27','name','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/High\x20Value\x22\x20--rule\x20\x27...\x27','invisible','553300htWNGj'];a28_0x2861=function(){return _0x1e011b;};return a28_0x2861();}import a28_0x41c848 from'chalk';export class SegmentCreateCommand extends BaseCommand{[a28_0x505b4f(0x10c)]=a28_0x505b4f(0x108);[a28_0x505b4f(0x110)]=a28_0x505b4f(0xf3);async['execute'](_0x2df752){const _0x3b6b0a=a28_0x505b4f;console[_0x3b6b0a(0x120)](a28_0x41c848[_0x3b6b0a(0x107)](_0x3b6b0a(0x101))),console[_0x3b6b0a(0x120)](a28_0x41c848[_0x3b6b0a(0x107)](_0x3b6b0a(0x100)));const {options:_0x3da1ad,args:_0x3674a9,tdx:_0x39aed6}=_0x2df752,_0x1c7e66=_0x3da1ad;if(_0x3674a9['length']===0x0)return console[_0x3b6b0a(0x120)](_0x3b6b0a(0x116)),console[_0x3b6b0a(0x120)](_0x3b6b0a(0xfa)),console[_0x3b6b0a(0x120)](_0x3b6b0a(0x119)),console[_0x3b6b0a(0x120)](_0x3b6b0a(0x10d)),console[_0x3b6b0a(0x120)]('\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/Marketing/Premium\x22\x20--rule\x20\x27...\x27'),console['error']('\x20\x20tdx\x20segment\x20create\x20\x22Premium\x22\x20--rule\x20\x27...\x27\x20\x20#\x20Relative\x20to\x20context'),0x1;const _0x442ba4=_0x3674a9[0x0],_0x1b6c60=_0x3da1ad['segmentPath'];let _0x4b89b0=_0x442ba4;_0x1b6c60&&!_0x442ba4[_0x3b6b0a(0x102)]('/')&&(_0x4b89b0=_0x1b6c60+'/'+_0x442ba4,_0x1c7e66['verbose']&&console[_0x3b6b0a(0x120)](_0x3b6b0a(0xf1)+_0x4b89b0));const _0x1d552d=parsePath(_0x4b89b0);if(_0x1d552d[_0x3b6b0a(0x112)][_0x3b6b0a(0x113)]<0x2)return console[_0x3b6b0a(0x120)](_0x3b6b0a(0x103)),console[_0x3b6b0a(0x120)]('Usage:\x20tdx\x20segment\x20create\x20<parent/segment_name>\x20[options]'),0x1;const _0x4e9aa3=_0x1d552d['segments'][0x0],_0x201052=getBaseName(_0x4b89b0),_0x352786=getParentPath(_0x4b89b0);_0x1c7e66[_0x3b6b0a(0x118)]&&(console[_0x3b6b0a(0x120)](_0x3b6b0a(0x117)+_0x1c7e66[_0x3b6b0a(0xf7)]),console[_0x3b6b0a(0x120)](_0x3b6b0a(0xf9)+_0x4b89b0),console['error'](_0x3b6b0a(0x11d)+_0x4e9aa3),console['error'](_0x3b6b0a(0xf0)+_0x201052),console[_0x3b6b0a(0x120)]('Parent\x20path:\x20'+_0x352786));const _0xbb60e5=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x4e9aa3+_0x3b6b0a(0xfe),()=>_0x39aed6[_0x3b6b0a(0x11c)][_0x3b6b0a(0x10a)](_0x4e9aa3),{'verbose':_0x1c7e66[_0x3b6b0a(0x118)]}),_0x36b61f=_0xbb60e5['data'];let _0xfea04b;if(_0x1d552d[_0x3b6b0a(0x112)][_0x3b6b0a(0x113)]>0x2){const _0x30404b=await withSpinner(_0x3b6b0a(0x10b)+_0x352786+_0x3b6b0a(0xfe),()=>_0x39aed6[_0x3b6b0a(0x11c)][_0x3b6b0a(0x124)](_0x352786),{'verbose':_0x1c7e66[_0x3b6b0a(0x118)]}),_0x56fb76=_0x30404b[_0x3b6b0a(0x11f)];if(_0x56fb76['type']!==_0x3b6b0a(0x121)&&_0x56fb76[_0x3b6b0a(0xf2)]!==_0x3b6b0a(0x11e))return console[_0x3b6b0a(0x120)](_0x3b6b0a(0xfd)),0x1;_0xfea04b=_0x56fb76[_0x3b6b0a(0xfb)];}else{if(_0x1c7e66[_0x3b6b0a(0x121)]){const _0x23ba79=await withSpinner('Resolving\x20folder\x20\x27'+_0x1c7e66[_0x3b6b0a(0x121)]+_0x3b6b0a(0xfe),()=>_0x39aed6[_0x3b6b0a(0x11c)][_0x3b6b0a(0x109)](_0x36b61f,_0x1c7e66[_0x3b6b0a(0x121)]),{'verbose':_0x1c7e66['verbose']});_0xfea04b=_0x23ba79['data'];}}_0x1c7e66[_0x3b6b0a(0x118)]&&_0xfea04b&&console[_0x3b6b0a(0x120)]('Resolved\x20folder\x20ID:\x20'+_0xfea04b);const _0x29d3db=await loadJSONFromOptions(_0x1c7e66[_0x3b6b0a(0x11a)],_0x1c7e66['ruleFile']),_0x4c9f72={'name':_0x201052,'description':_0x1c7e66[_0x3b6b0a(0x110)],'rule':_0x29d3db,'kind':_0x1c7e66[_0x3b6b0a(0xf4)]!==undefined?parseInt(_0x1c7e66[_0x3b6b0a(0xf4)],0xa):undefined,'isVisible':_0x1c7e66[_0x3b6b0a(0x10e)]?![]:undefined,'segmentFolderId':_0xfea04b,'countPopulation':_0x1c7e66[_0x3b6b0a(0xfc)]?![]:undefined},_0x4b6a96=await withSpinner('Creating\x20segment\x20\x27'+_0x201052+_0x3b6b0a(0xfe),()=>_0x39aed6[_0x3b6b0a(0x11c)]['createSegment'](_0x36b61f,_0x4c9f72),{'verbose':_0x1c7e66['verbose']}),_0x49eef3=_0x4b6a96[_0x3b6b0a(0x11f)];return console[_0x3b6b0a(0x120)](_0x3b6b0a(0x106)+_0x49eef3[_0x3b6b0a(0x10c)]+'\x27\x20with\x20ID:\x20'+_0x49eef3['id']),_0x4b89b0!==_0x442ba4&&console[_0x3b6b0a(0x120)](_0x3b6b0a(0x11b)+_0x4b89b0),await handleSDKOutput([_0x49eef3],_0x1c7e66),0x0;}}
1
+ const a28_0x1fd9f2=a28_0x317d;(function(_0x116b82,_0x568eab){const _0x11c538=a28_0x317d,_0x1b5e86=_0x116b82();while(!![]){try{const _0x490651=parseInt(_0x11c538(0x109))/0x1+parseInt(_0x11c538(0xe8))/0x2+-parseInt(_0x11c538(0x10f))/0x3*(-parseInt(_0x11c538(0x10e))/0x4)+-parseInt(_0x11c538(0xf8))/0x5+-parseInt(_0x11c538(0xf2))/0x6+parseInt(_0x11c538(0xf1))/0x7*(parseInt(_0x11c538(0x107))/0x8)+-parseInt(_0x11c538(0x119))/0x9*(parseInt(_0x11c538(0x108))/0xa);if(_0x490651===_0x568eab)break;else _0x1b5e86['push'](_0x1b5e86['shift']());}catch(_0x48c011){_0x1b5e86['push'](_0x1b5e86['shift']());}}}(a28_0x3a61,0x62763));import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';function a28_0x3a61(){const _0x48c515=['2439132tfVCWU','Segment\x20name:\x20','✔\x20Created\x20segment\x20\x27','Site:\x20','verbose','rule','273820Uqbuos','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/High\x20Value\x22\x20--rule\x20\x27...\x27','includes','site','description','type','\x20\x20Use\x20`tdx\x20sg\x20push`\x20with\x20YAML\x20files\x20instead.\x0a','\x20\x20tdx\x20segment\x20create\x20\x22Premium\x22\x20--rule\x20\x27...\x27\x20\x20#\x20Relative\x20to\x20context','invisible','Resolving\x20parent\x20segment\x20\x27','Parent\x20path:\x20','Error:\x20Full\x20path\x20required\x20(parent/segment_name\x20or\x20parent/folder/segment_name)','Resolved\x20folder\x20ID:\x20','segment','segments','2176Tuoacs','2150ZAJLQs','788605dPmdfi','Creating\x20segment\x20\x27','kind','Resolved\x20relative\x20path\x20to:\x20','parent','116CjFXee','28374JNGIWN','\x27...','Error:\x20Segment\x20path\x20or\x20name\x20is\x20required','Parent:\x20','segment:create','yellow','folderId','length','resolveFolderId','Error:\x20Cannot\x20create\x20segment\x20in\x20a\x20segment.\x20Parent\x20path\x20must\x20be\x20a\x20folder\x20or\x20parent.','32895wDuljQ','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/Marketing/Premium\x22\x20--rule\x20\x27...\x27','data','error','558150eDYWNY','name','Resolving\x20folder\x20path\x20\x27','folder','Examples:','Resolving\x20folder\x20\x27','\x20\x20\x20Path:\x20','Target\x20path:\x20','Usage:\x20tdx\x20segment\x20create\x20<path>\x20[options]','7938OpvcGL'];a28_0x3a61=function(){return _0x48c515;};return a28_0x3a61();}function a28_0x317d(_0x56e5bb,_0x3ec82d){_0x56e5bb=_0x56e5bb-0xe6;const _0x3a6171=a28_0x3a61();let _0x317d5a=_0x3a6171[_0x56e5bb];return _0x317d5a;}import{loadJSONFromOptions}from'../utils/json-loader.js';import{parsePath,getParentPath,getBaseName}from'../sdk/segment/segment-path-parser.js';import a28_0x379b38 from'chalk';export class SegmentCreateCommand extends BaseCommand{['name']=a28_0x1fd9f2(0x113);[a28_0x1fd9f2(0xfc)]='Create\x20child\x20segment\x20with\x20filtering\x20rules';async['execute'](_0x4e2c39){const _0x32bbbe=a28_0x1fd9f2;console[_0x32bbbe(0xe7)](a28_0x379b38['yellow']('⚠\x20Deprecation\x20warning:\x20`segment\x20create`\x20is\x20deprecated.')),console[_0x32bbbe(0xe7)](a28_0x379b38[_0x32bbbe(0x114)](_0x32bbbe(0xfe)));const {options:_0x2a4290,args:_0x5e9cef,tdx:_0x5371b1}=_0x4e2c39,_0x164af3=_0x2a4290;if(_0x5e9cef[_0x32bbbe(0x116)]===0x0)return console[_0x32bbbe(0xe7)](_0x32bbbe(0x111)),console[_0x32bbbe(0xe7)](_0x32bbbe(0xf0)),console[_0x32bbbe(0xe7)](_0x32bbbe(0xec)),console[_0x32bbbe(0xe7)](_0x32bbbe(0xf9)),console[_0x32bbbe(0xe7)](_0x32bbbe(0x11a)),console[_0x32bbbe(0xe7)](_0x32bbbe(0xff)),0x1;const _0x329609=_0x5e9cef[0x0],_0x8a4339=_0x2a4290['segmentPath'];let _0x501ce6=_0x329609;_0x8a4339&&!_0x329609[_0x32bbbe(0xfa)]('/')&&(_0x501ce6=_0x8a4339+'/'+_0x329609,_0x164af3[_0x32bbbe(0xf6)]&&console[_0x32bbbe(0xe7)](_0x32bbbe(0x10c)+_0x501ce6));const _0x3cbde4=parsePath(_0x501ce6);if(_0x3cbde4[_0x32bbbe(0x106)][_0x32bbbe(0x116)]<0x2)return console['error'](_0x32bbbe(0x103)),console[_0x32bbbe(0xe7)]('Usage:\x20tdx\x20segment\x20create\x20<parent/segment_name>\x20[options]'),0x1;const _0x37aeed=_0x3cbde4['segments'][0x0],_0x4a5a11=getBaseName(_0x501ce6),_0x1e402e=getParentPath(_0x501ce6);_0x164af3[_0x32bbbe(0xf6)]&&(console[_0x32bbbe(0xe7)](_0x32bbbe(0xf5)+_0x164af3[_0x32bbbe(0xfb)]),console['error'](_0x32bbbe(0xef)+_0x501ce6),console[_0x32bbbe(0xe7)](_0x32bbbe(0x112)+_0x37aeed),console['error'](_0x32bbbe(0xf3)+_0x4a5a11),console[_0x32bbbe(0xe7)](_0x32bbbe(0x102)+_0x1e402e));const _0x4336d8=await withSpinner(_0x32bbbe(0x101)+_0x37aeed+_0x32bbbe(0x110),()=>_0x5371b1[_0x32bbbe(0x105)]['resolveParentId'](_0x37aeed),{'verbose':_0x164af3[_0x32bbbe(0xf6)]}),_0x341d41=_0x4336d8[_0x32bbbe(0xe6)];let _0x3025d4;if(_0x3cbde4[_0x32bbbe(0x106)][_0x32bbbe(0x116)]>0x2){const _0x30a4bb=await withSpinner(_0x32bbbe(0xea)+_0x1e402e+'\x27...',()=>_0x5371b1[_0x32bbbe(0x105)]['resolvePathToResource'](_0x1e402e),{'verbose':_0x164af3['verbose']}),_0x588ee7=_0x30a4bb['data'];if(_0x588ee7[_0x32bbbe(0xfd)]!==_0x32bbbe(0xeb)&&_0x588ee7[_0x32bbbe(0xfd)]!==_0x32bbbe(0x10d))return console[_0x32bbbe(0xe7)](_0x32bbbe(0x118)),0x1;_0x3025d4=_0x588ee7[_0x32bbbe(0x115)];}else{if(_0x164af3['folder']){const _0x5253d8=await withSpinner(_0x32bbbe(0xed)+_0x164af3[_0x32bbbe(0xeb)]+_0x32bbbe(0x110),()=>_0x5371b1[_0x32bbbe(0x105)][_0x32bbbe(0x117)](_0x341d41,_0x164af3['folder']),{'verbose':_0x164af3[_0x32bbbe(0xf6)]});_0x3025d4=_0x5253d8[_0x32bbbe(0xe6)];}}_0x164af3[_0x32bbbe(0xf6)]&&_0x3025d4&&console[_0x32bbbe(0xe7)](_0x32bbbe(0x104)+_0x3025d4);const _0x4ae262=await loadJSONFromOptions(_0x164af3[_0x32bbbe(0xf7)],_0x164af3['ruleFile']),_0x390ffd={'name':_0x4a5a11,'description':_0x164af3[_0x32bbbe(0xfc)],'rule':_0x4ae262,'kind':_0x164af3['kind']!==undefined?parseInt(_0x164af3[_0x32bbbe(0x10b)],0xa):undefined,'isVisible':_0x164af3[_0x32bbbe(0x100)]?![]:undefined,'segmentFolderId':_0x3025d4,'countPopulation':_0x164af3['noCountPopulation']?![]:undefined},_0x557bc0=await withSpinner(_0x32bbbe(0x10a)+_0x4a5a11+_0x32bbbe(0x110),()=>_0x5371b1[_0x32bbbe(0x105)]['createSegment'](_0x341d41,_0x390ffd),{'verbose':_0x164af3[_0x32bbbe(0xf6)]}),_0x1fb616=_0x557bc0['data'];return console[_0x32bbbe(0xe7)](_0x32bbbe(0xf4)+_0x1fb616[_0x32bbbe(0xe9)]+'\x27\x20with\x20ID:\x20'+_0x1fb616['id']),_0x501ce6!==_0x329609&&console[_0x32bbbe(0xe7)](_0x32bbbe(0xee)+_0x501ce6),await handleSDKOutput([_0x1fb616],_0x164af3),0x0;}}
@@ -1 +1 @@
1
- function a29_0x28f2(_0x35d0b5,_0x1c546f){_0x35d0b5=_0x35d0b5-0x146;const _0x2f6201=a29_0x2f62();let _0x28f242=_0x2f6201[_0x35d0b5];return _0x28f242;}function a29_0x2f62(){const _0xa5de10=['segment','Parent\x20segment:\x20','Usage:\x20tdx\x20segment\x20fields\x20<parent_name>','json','data','✔\x20Found\x20','3549628VFWhES','site','\x20field','parentSegment','verbose','length','4yEpCai','16215768BBcNeD','Site:\x20','jsonl','description','1473708XRbjLj','listFields','7403185yrydJz','error','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','8otfPyw','910778newkOQ','Error:\x20Parent\x20segment\x20name\x20is\x20required','\x27...','5962818uEuxAL','1704535ufbUeI','Listing\x20fields\x20for\x20\x27'];a29_0x2f62=function(){return _0xa5de10;};return a29_0x2f62();}const a29_0x2bdcc3=a29_0x28f2;(function(_0xa4552b,_0x4e7eba){const _0x371996=a29_0x28f2,_0x399a33=_0xa4552b();while(!![]){try{const _0x4fcf0e=parseInt(_0x371996(0x152))/0x1*(parseInt(_0x371996(0x147))/0x2)+parseInt(_0x371996(0x14c))/0x3+-parseInt(_0x371996(0x15e))/0x4+-parseInt(_0x371996(0x14e))/0x5+-parseInt(_0x371996(0x155))/0x6+parseInt(_0x371996(0x156))/0x7+parseInt(_0x371996(0x151))/0x8*(parseInt(_0x371996(0x148))/0x9);if(_0x4fcf0e===_0x4e7eba)break;else _0x399a33['push'](_0x399a33['shift']());}catch(_0xdc6167){_0x399a33['push'](_0x399a33['shift']());}}}(a29_0x2f62,0xf336a));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';export class SegmentFieldsCommand extends BaseCommand{['name']='segment:fields';[a29_0x2bdcc3(0x14b)]='List\x20available\x20fields\x20for\x20segmentation';async['execute'](_0x2c4acc){const _0x3e79a7=a29_0x2bdcc3,{options:_0x45752c,args:_0x5afcc0,tdx:_0x472a2f}=_0x2c4acc,_0x4d02e7=_0x5afcc0[0x0]||_0x45752c[_0x3e79a7(0x161)];if(!_0x4d02e7)return console[_0x3e79a7(0x14f)](_0x3e79a7(0x153)),console[_0x3e79a7(0x14f)](_0x3e79a7(0x15a)),console[_0x3e79a7(0x14f)](_0x3e79a7(0x150)),0x1;_0x45752c[_0x3e79a7(0x162)]&&(console['error'](_0x3e79a7(0x149)+_0x45752c[_0x3e79a7(0x15f)]),console[_0x3e79a7(0x14f)](_0x3e79a7(0x159)+_0x4d02e7));const _0x12a47f=await withSpinner(_0x3e79a7(0x157)+_0x4d02e7+_0x3e79a7(0x154),()=>_0x472a2f[_0x3e79a7(0x158)][_0x3e79a7(0x14d)](_0x4d02e7),{'verbose':_0x45752c[_0x3e79a7(0x162)]}),_0x2109d4=_0x12a47f[_0x3e79a7(0x15c)];console[_0x3e79a7(0x14f)](_0x3e79a7(0x15d)+_0x2109d4[_0x3e79a7(0x146)]+_0x3e79a7(0x160)+(_0x2109d4[_0x3e79a7(0x146)]!==0x1?'s':''));if(_0x45752c[_0x3e79a7(0x15b)]||_0x45752c[_0x3e79a7(0x14a)])return await handleSDKOutput(_0x2109d4,_0x45752c),0x0;return displayFieldsHumanReadable(_0x2109d4,_0x4d02e7),0x0;}}
1
+ const a29_0x5b50d3=a29_0x1780;function a29_0x1780(_0x17aad6,_0x491eeb){_0x17aad6=_0x17aad6-0x7c;const _0x2513b7=a29_0x2513();let _0x1780b8=_0x2513b7[_0x17aad6];return _0x1780b8;}(function(_0x223fc2,_0x217923){const _0x154ac9=a29_0x1780,_0x5c0d75=_0x223fc2();while(!![]){try{const _0x28b585=parseInt(_0x154ac9(0x80))/0x1*(-parseInt(_0x154ac9(0x8f))/0x2)+parseInt(_0x154ac9(0x94))/0x3*(parseInt(_0x154ac9(0x8b))/0x4)+parseInt(_0x154ac9(0x81))/0x5+-parseInt(_0x154ac9(0x87))/0x6*(parseInt(_0x154ac9(0x85))/0x7)+-parseInt(_0x154ac9(0x82))/0x8+parseInt(_0x154ac9(0x7f))/0x9+-parseInt(_0x154ac9(0x90))/0xa*(-parseInt(_0x154ac9(0x92))/0xb);if(_0x28b585===_0x217923)break;else _0x5c0d75['push'](_0x5c0d75['shift']());}catch(_0x4115d6){_0x5c0d75['push'](_0x5c0d75['shift']());}}}(a29_0x2513,0xee1f9));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';export class SegmentFieldsCommand extends BaseCommand{[a29_0x5b50d3(0x8c)]=a29_0x5b50d3(0x89);[a29_0x5b50d3(0x83)]='List\x20available\x20fields\x20for\x20segmentation';async[a29_0x5b50d3(0x7c)](_0x35f334){const _0x2f7ad6=a29_0x5b50d3,{options:_0x32a424,args:_0x341fbd,tdx:_0x2ed090}=_0x35f334,_0x2a5b12=_0x341fbd[0x0]||_0x32a424[_0x2f7ad6(0x97)];if(!_0x2a5b12)return console[_0x2f7ad6(0x7e)](_0x2f7ad6(0x96)),console[_0x2f7ad6(0x7e)](_0x2f7ad6(0x86)),console['error']('\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>'),0x1;_0x32a424[_0x2f7ad6(0x8e)]&&(console[_0x2f7ad6(0x7e)](_0x2f7ad6(0x8d)+_0x32a424[_0x2f7ad6(0x93)]),console[_0x2f7ad6(0x7e)](_0x2f7ad6(0x95)+_0x2a5b12));const _0x4c8082=await withSpinner(_0x2f7ad6(0x88)+_0x2a5b12+'\x27...',()=>_0x2ed090['segment'][_0x2f7ad6(0x8a)](_0x2a5b12),{'verbose':_0x32a424[_0x2f7ad6(0x8e)]}),_0x55a9e4=_0x4c8082[_0x2f7ad6(0x91)];console[_0x2f7ad6(0x7e)](_0x2f7ad6(0x98)+_0x55a9e4[_0x2f7ad6(0x84)]+'\x20field'+(_0x55a9e4[_0x2f7ad6(0x84)]!==0x1?'s':''));if(_0x32a424['json']||_0x32a424[_0x2f7ad6(0x7d)])return await handleSDKOutput(_0x55a9e4,_0x32a424),0x0;return displayFieldsHumanReadable(_0x55a9e4,_0x2a5b12),0x0;}}function a29_0x2513(){const _0x1ac9c7=['segment:fields','listFields','19636PDmCEN','name','Site:\x20','verbose','694TnRktd','37350BPxqZQ','data','1749lIETGQ','site','402dLuxYJ','Parent\x20segment:\x20','Error:\x20Parent\x20segment\x20name\x20is\x20required','parentSegment','✔\x20Found\x20','execute','jsonl','error','8711415NitKFQ','1409CAzkzZ','7585805YnEkCr','11584672mblvCg','description','length','36757akSFxp','Usage:\x20tdx\x20segment\x20fields\x20<parent_name>','942viMdeI','Listing\x20fields\x20for\x20\x27'];a29_0x2513=function(){return _0x1ac9c7;};return a29_0x2513();}
@@ -1 +1 @@
1
- const a30_0x6736a8=a30_0x28fc;(function(_0x10401d,_0x2ba36e){const _0x2980f6=a30_0x28fc,_0x258af1=_0x10401d();while(!![]){try{const _0x19b3d6=-parseInt(_0x2980f6(0xdb))/0x1+-parseInt(_0x2980f6(0xbd))/0x2*(-parseInt(_0x2980f6(0xd5))/0x3)+-parseInt(_0x2980f6(0xed))/0x4+parseInt(_0x2980f6(0xd7))/0x5*(-parseInt(_0x2980f6(0xe9))/0x6)+parseInt(_0x2980f6(0xce))/0x7+-parseInt(_0x2980f6(0xcb))/0x8+parseInt(_0x2980f6(0xec))/0x9;if(_0x19b3d6===_0x2ba36e)break;else _0x258af1['push'](_0x258af1['shift']());}catch(_0x147003){_0x258af1['push'](_0x258af1['shift']());}}}(a30_0x4df3,0x37034));import{BaseCommand}from'./command.js';import{withProgressSpinner}from'../utils/spinner.js';import{confirmKey,isInteractive}from'../utils/prompt.js';import{saveSessionContext}from'../core/session.js';import a30_0x159112 from'chalk';function a30_0x28fc(_0x5cf42c,_0x270a85){_0x5cf42c=_0x5cf42c-0xb2;const _0x4df323=a30_0x4df3();let _0x28fc13=_0x4df323[_0x5cf42c];return _0x28fc13;}import{existsSync,mkdirSync,writeFileSync}from'fs';function a30_0x4df3(){const _0x18358a=['1049419jqwxLt','dryRun','yellow','\x20files\x20to\x20','\x20files?','\x20=\x20','\x0a[Dry\x20run]\x20No\x20files\x20were\x20written','3lvzjhI','isNew','210XFIiJN','no_parent','verbose','data','287844feEHFo','Pull\x20child\x20segments\x20and\x20journeys\x20to\x20YAML\x20files','pullSegments','Site:\x20','parent_segment','files','diff','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20pull\x20<file_path>\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20segment\x20file','Write\x20','errorCode','activations','dirname','type','hasChanges','14454KhqBHj','helpText','parentName','5553819pfQTnn','1381396PpsXRo','relativePath','counts','dim','green','\x20versions)','Usage:\x20tdx\x20sg\x20pull\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20all\x20segments\x20(requires\x20context\x20or\x20tdx.json)','session','Pulling\x20segments\x20from\x20\x27','✔\x20All\x20files\x20are\x20up\x20to\x20date','yes','Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation','\x20unchanged\x20files','error','utf-8','-\x20no\x20files\x20written','setPhase','\x20changed\x20files','\x0aPull\x20summary\x20for\x20\x27','\x20activations','segment:pull','absolutePath','journeyVersions','\x27...','\x20\x20Target:\x20','Error:\x20','segments','732098NxrSwy','cyan','length','cwd','\x20segments','Parent\x20segment:\x20','red','content','\x20\x20🗺️\x20\x20','targetDir','filter','\x20\x20🎯\x20','Aborted.','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a','1386832wLChzN','\x0aChanges\x20to\x20\x27','journeys'];a30_0x4df3=function(){return _0x18358a;};return a30_0x4df3();}import a30_0xe82c4f 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_0x6736a8(0xb6);['description']=a30_0x6736a8(0xdc);async['execute'](_0x1ed4c6){const _0x322e65=a30_0x6736a8,{options:_0x3217ba,args:_0x45d041,tdx:_0x5430f7}=_0x1ed4c6,_0x54464c=_0x3217ba,_0x4e6536=await resolveTarget({'arg':_0x45d041[0x0],'contextParent':_0x3217ba['parentSegment'],'cwd':process[_0x322e65(0xc0)]()});if(!isSuccessfulResolution(_0x4e6536))return _0x4e6536[_0x322e65(0xe4)]===_0x322e65(0xd8)?(console['error'](a30_0x159112[_0x322e65(0xd0)](_0x322e65(0xca))),console[_0x322e65(0xfa)](_0x322e65(0xf3)),console[_0x322e65(0xfa)]('\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'](_0x322e65(0xe2))):(console[_0x322e65(0xfa)](a30_0x159112['red'](_0x322e65(0xbb)+_0x4e6536['message']+'\x0a')),_0x4e6536[_0x322e65(0xea)]&&console[_0x322e65(0xfa)](a30_0x159112[_0x322e65(0xbe)](_0x4e6536[_0x322e65(0xea)]))),0x1;const _0x3df703=_0x4e6536[_0x322e65(0xeb)],_0x2acefb=_0x4e6536[_0x322e65(0xc6)],_0x545687=_0x4e6536[_0x322e65(0xe7)]==='file'?_0x4e6536['resourceName']:undefined;_0x54464c[_0x322e65(0xd9)]&&(console[_0x322e65(0xfa)](_0x322e65(0xde)+_0x54464c['site']),console[_0x322e65(0xfa)](_0x322e65(0xc2)+_0x3df703),_0x545687&&console[_0x322e65(0xfa)]('Target\x20resource:\x20'+_0x545687));const _0x3f1255=await withProgressSpinner(_0x322e65(0xf5)+_0x3df703+_0x322e65(0xb9),_0x3081f0=>_0x5430f7['segment'][_0x322e65(0xdd)](_0x3df703,{'targetDir':_0x2acefb,'targetResourceName':_0x545687,'verbose':_0x54464c[_0x322e65(0xd9)],'progress':{'update':_0xd10783=>{const _0x62e88b=_0x322e65;_0x3081f0[_0x62e88b(0xb2)](_0xd10783),_0x54464c[_0x62e88b(0xd9)]&&console[_0x62e88b(0xfa)]('\x20\x20'+_0xd10783);}}}),{'verbose':_0x54464c[_0x322e65(0xd9)]}),_0x4a954b=_0x3f1255[_0x322e65(0xda)];if(_0x4a954b['counts'][_0x322e65(0xbc)]===0x0&&_0x4a954b['counts'][_0x322e65(0xcd)]===0x0)return console['error'](a30_0x159112[_0x322e65(0xd0)]('No\x20segments\x20or\x20journeys\x20found\x20in\x20parent\x20segment\x20\x27'+_0x4a954b['parentName']+'\x27')),0x0;const _0x54689e=_0x4a954b['files']['filter'](_0x5ea6ab=>_0x5ea6ab[_0x322e65(0xd6)]),_0x4d79d0=_0x4a954b[_0x322e65(0xe0)][_0x322e65(0xc7)](_0x43d496=>!_0x43d496[_0x322e65(0xd6)]&&_0x43d496['hasChanges']),_0x40a6f5=_0x4a954b[_0x322e65(0xe0)][_0x322e65(0xc7)](_0x57a9f0=>!_0x57a9f0[_0x322e65(0xd6)]&&!_0x57a9f0['hasChanges']);console[_0x322e65(0xfa)](_0x322e65(0xb4)+_0x4a954b[_0x322e65(0xeb)]+'\x27:'),console[_0x322e65(0xfa)](_0x322e65(0xc8)+a30_0x159112[_0x322e65(0xbe)](_0x4a954b[_0x322e65(0xef)][_0x322e65(0xbc)]+_0x322e65(0xc1))+'\x20with\x20'+a30_0x159112[_0x322e65(0xbe)](_0x4a954b[_0x322e65(0xef)][_0x322e65(0xe5)]+_0x322e65(0xb5)));if(_0x4a954b['counts']['journeys']>0x0){const _0x51a3e4=_0x4a954b[_0x322e65(0xef)][_0x322e65(0xb8)]>_0x4a954b['counts'][_0x322e65(0xcd)]?'\x20('+_0x4a954b[_0x322e65(0xef)]['journeyVersions']+_0x322e65(0xf2):'';console[_0x322e65(0xfa)](_0x322e65(0xc5)+a30_0x159112[_0x322e65(0xbe)](_0x4a954b['counts'][_0x322e65(0xcd)]+'\x20journeys')+a30_0x159112[_0x322e65(0xf0)](_0x51a3e4));}console['error']('\x20\x20'+a30_0x159112['green']('+\x20'+_0x54689e[_0x322e65(0xbf)]+'\x20new\x20files')),console['error']('\x20\x20'+a30_0x159112[_0x322e65(0xd0)]('~\x20'+_0x4d79d0['length']+_0x322e65(0xb3))),console[_0x322e65(0xfa)]('\x20\x20'+a30_0x159112['dim']('=\x20'+_0x40a6f5['length']+_0x322e65(0xf9))),console[_0x322e65(0xfa)](_0x322e65(0xba)+a30_0x159112[_0x322e65(0xbe)](_0x4a954b['targetDir'])+'\x0a');if(_0x4d79d0['length']>0x0)for(const _0x10553b of _0x4d79d0){console['error'](_0x322e65(0xcc)+_0x10553b[_0x322e65(0xee)]+'\x27:'),console['error']('─'['repeat'](0x3c)),console['error'](_0x10553b[_0x322e65(0xe1)]),console['error']('─'['repeat'](0x3c));}if(_0x54464c[_0x322e65(0xcf)])return console[_0x322e65(0xfa)](a30_0x159112[_0x322e65(0xd0)](_0x322e65(0xd4))),0x0;if(_0x54689e[_0x322e65(0xbf)]===0x0&&_0x4d79d0[_0x322e65(0xbf)]===0x0)return console['error'](a30_0x159112[_0x322e65(0xf1)](_0x322e65(0xf6))),saveSessionContext({'parent_segment':_0x4a954b['parentName']},_0x54464c[_0x322e65(0xf4)]),console['error'](a30_0x159112[_0x322e65(0xf1)]('✔\x20Context\x20set:\x20'+a30_0x159112[_0x322e65(0xf0)](_0x322e65(0xdf))+_0x322e65(0xd3)+a30_0x159112[_0x322e65(0xbe)](_0x4a954b[_0x322e65(0xeb)]))),0x0;if(!_0x54464c[_0x322e65(0xf7)]){if(!isInteractive())return console['error'](a30_0x159112[_0x322e65(0xc3)]('\x0aError:'),'Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode'),console['error'](a30_0x159112['dim'](_0x322e65(0xf8))),0x1;const _0x322ab7=await confirmKey(_0x322e65(0xe3)+(_0x54689e['length']+_0x4d79d0['length'])+_0x322e65(0xd2));if(!_0x322ab7)return console[_0x322e65(0xfa)](a30_0x159112[_0x322e65(0xd0)](_0x322e65(0xc9)),_0x322e65(0xfc)),0x1;}for(const _0x496143 of _0x4a954b[_0x322e65(0xe0)]){if(_0x496143['isNew']||_0x496143[_0x322e65(0xe8)]){const _0x4f4a14=a30_0xe82c4f[_0x322e65(0xe6)](_0x496143['absolutePath']);!existsSync(_0x4f4a14)&&mkdirSync(_0x4f4a14,{'recursive':!![]}),writeFileSync(_0x496143[_0x322e65(0xb7)],_0x496143[_0x322e65(0xc4)],_0x322e65(0xfb));}}return console[_0x322e65(0xfa)](a30_0x159112[_0x322e65(0xf1)]('✔\x20Pulled\x20'+(_0x54689e[_0x322e65(0xbf)]+_0x4d79d0[_0x322e65(0xbf)])+_0x322e65(0xd1)+_0x4a954b[_0x322e65(0xc6)])),saveSessionContext({'parent_segment':_0x4a954b[_0x322e65(0xeb)]},_0x54464c[_0x322e65(0xf4)]),console[_0x322e65(0xfa)](a30_0x159112[_0x322e65(0xf1)]('✔\x20Context\x20set:\x20'+a30_0x159112['dim'](_0x322e65(0xdf))+'\x20=\x20'+a30_0x159112[_0x322e65(0xbe)](_0x4a954b[_0x322e65(0xeb)]))),0x0;}}
1
+ function a30_0x29bf(_0xbafe5e,_0x33f427){_0xbafe5e=_0xbafe5e-0xca;const _0x4188fb=a30_0x4188();let _0x29bfac=_0x4188fb[_0xbafe5e];return _0x29bfac;}const a30_0x1bad5b=a30_0x29bf;(function(_0xdfca22,_0x4b2023){const _0x1cbff3=a30_0x29bf,_0xc8dd1d=_0xdfca22();while(!![]){try{const _0x2bde2d=parseInt(_0x1cbff3(0xee))/0x1+parseInt(_0x1cbff3(0x111))/0x2*(parseInt(_0x1cbff3(0x10f))/0x3)+parseInt(_0x1cbff3(0xf7))/0x4*(-parseInt(_0x1cbff3(0xe8))/0x5)+parseInt(_0x1cbff3(0x106))/0x6*(parseInt(_0x1cbff3(0x107))/0x7)+-parseInt(_0x1cbff3(0x100))/0x8*(-parseInt(_0x1cbff3(0xf6))/0x9)+-parseInt(_0x1cbff3(0xd9))/0xa+parseInt(_0x1cbff3(0xf8))/0xb*(-parseInt(_0x1cbff3(0xd1))/0xc);if(_0x2bde2d===_0x4b2023)break;else _0xc8dd1d['push'](_0xc8dd1d['shift']());}catch(_0x2b1fe2){_0xc8dd1d['push'](_0xc8dd1d['shift']());}}}(a30_0x4188,0x49309));import{BaseCommand}from'./command.js';import{withProgressSpinner}from'../utils/spinner.js';import{confirmKey,isInteractive}from'../utils/prompt.js';import{saveSessionContext}from'../core/session.js';function a30_0x4188(){const _0x30f404=['no_parent','parent_segment','utf-8','\x20=\x20','Pulling\x20segments\x20from\x20\x27','Target\x20resource:\x20','9235956Dcazfs','helpText','\x20changed\x20files','name','hasChanges','yellow','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20pull\x20<file_path>\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20segment\x20file','✔\x20Pulled\x20','29870XXdunx','\x20\x20Target:\x20','\x0aError:','\x20files\x20to\x20','journeyVersions','\x20\x20🗺️\x20\x20','Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation','verbose','\x20with\x20','Aborted.','repeat','\x20segments','setPhase','dirname','diff','25XEOWwp','parentName','relativePath','isNew','filter','dim','201171yYvPRk','files','✔\x20All\x20files\x20are\x20up\x20to\x20date','data','\x20files?','cyan','\x0aChanges\x20to\x20\x27','red','525726hWUaoz','436556EUHNGB','11qPzsRZ','file','counts','✔\x20Context\x20set:\x20','yes','session','dryRun','length','80VknHID','error','pullSegments','content','cwd','segment:pull','166728GXNxaJ','77WiFdyy','absolutePath','-\x20no\x20files\x20written','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)','\x20new\x20files','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20pull\x20<parent_name>\x20\x20\x20\x20\x20\x20#\x20Pull\x20all\x20segments\x20from\x20parent','activations','green','527151sDEqgE','site','6lVXqVp','parentSegment','targetDir','\x20unchanged\x20files','journeys','\x20activations'];a30_0x4188=function(){return _0x30f404;};return a30_0x4188();}import a30_0x55c005 from'chalk';import{existsSync,mkdirSync,writeFileSync}from'fs';import a30_0x53db17 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_0x1bad5b(0xd4)]=a30_0x1bad5b(0x105);['description']='Pull\x20child\x20segments\x20and\x20journeys\x20to\x20YAML\x20files';async['execute'](_0x247391){const _0x577f7b=a30_0x1bad5b,{options:_0x208bbf,args:_0x345def,tdx:_0xc0be11}=_0x247391,_0x280aaf=_0x208bbf,_0x3b9005=await resolveTarget({'arg':_0x345def[0x0],'contextParent':_0x208bbf[_0x577f7b(0x112)],'cwd':process[_0x577f7b(0x104)]()});if(!isSuccessfulResolution(_0x3b9005))return _0x3b9005['errorCode']===_0x577f7b(0xcb)?(console[_0x577f7b(0x101)](a30_0x55c005[_0x577f7b(0xd6)]('parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a')),console[_0x577f7b(0x101)](_0x577f7b(0x10a)),console[_0x577f7b(0x101)](_0x577f7b(0x10c)),console[_0x577f7b(0x101)](_0x577f7b(0xd7))):(console[_0x577f7b(0x101)](a30_0x55c005['red']('Error:\x20'+_0x3b9005['message']+'\x0a')),_0x3b9005[_0x577f7b(0xd2)]&&console[_0x577f7b(0x101)](a30_0x55c005[_0x577f7b(0xf3)](_0x3b9005['helpText']))),0x1;const _0x439982=_0x3b9005[_0x577f7b(0xe9)],_0x4eecce=_0x3b9005['targetDir'],_0x19676f=_0x3b9005['type']===_0x577f7b(0xf9)?_0x3b9005['resourceName']:undefined;_0x280aaf[_0x577f7b(0xe0)]&&(console['error']('Site:\x20'+_0x280aaf[_0x577f7b(0x110)]),console['error']('Parent\x20segment:\x20'+_0x439982),_0x19676f&&console[_0x577f7b(0x101)](_0x577f7b(0xd0)+_0x19676f));const _0xfe0427=await withProgressSpinner(_0x577f7b(0xcf)+_0x439982+'\x27...',_0x1b25ba=>_0xc0be11['segment'][_0x577f7b(0x102)](_0x439982,{'targetDir':_0x4eecce,'targetResourceName':_0x19676f,'verbose':_0x280aaf[_0x577f7b(0xe0)],'progress':{'update':_0x100640=>{const _0x53d020=_0x577f7b;_0x1b25ba[_0x53d020(0xe5)](_0x100640),_0x280aaf[_0x53d020(0xe0)]&&console['error']('\x20\x20'+_0x100640);}}}),{'verbose':_0x280aaf[_0x577f7b(0xe0)]}),_0x54c86d=_0xfe0427[_0x577f7b(0xf1)];if(_0x54c86d[_0x577f7b(0xfa)]['segments']===0x0&&_0x54c86d['counts']['journeys']===0x0)return console[_0x577f7b(0x101)](a30_0x55c005[_0x577f7b(0xd6)]('No\x20segments\x20or\x20journeys\x20found\x20in\x20parent\x20segment\x20\x27'+_0x54c86d[_0x577f7b(0xe9)]+'\x27')),0x0;const _0x11ac4f=_0x54c86d[_0x577f7b(0xef)][_0x577f7b(0xec)](_0x5a24b3=>_0x5a24b3[_0x577f7b(0xeb)]),_0x1852f6=_0x54c86d[_0x577f7b(0xef)]['filter'](_0x1710f3=>!_0x1710f3[_0x577f7b(0xeb)]&&_0x1710f3[_0x577f7b(0xd5)]),_0x54b9eb=_0x54c86d[_0x577f7b(0xef)][_0x577f7b(0xec)](_0xd0bf8c=>!_0xd0bf8c[_0x577f7b(0xeb)]&&!_0xd0bf8c[_0x577f7b(0xd5)]);console[_0x577f7b(0x101)]('\x0aPull\x20summary\x20for\x20\x27'+_0x54c86d[_0x577f7b(0xe9)]+'\x27:'),console[_0x577f7b(0x101)]('\x20\x20🎯\x20'+a30_0x55c005[_0x577f7b(0xf3)](_0x54c86d[_0x577f7b(0xfa)]['segments']+_0x577f7b(0xe4))+_0x577f7b(0xe1)+a30_0x55c005['cyan'](_0x54c86d[_0x577f7b(0xfa)][_0x577f7b(0x10d)]+_0x577f7b(0xca)));if(_0x54c86d[_0x577f7b(0xfa)][_0x577f7b(0x115)]>0x0){const _0xc1329d=_0x54c86d[_0x577f7b(0xfa)][_0x577f7b(0xdd)]>_0x54c86d[_0x577f7b(0xfa)]['journeys']?'\x20('+_0x54c86d[_0x577f7b(0xfa)]['journeyVersions']+'\x20versions)':'';console['error'](_0x577f7b(0xde)+a30_0x55c005['cyan'](_0x54c86d['counts']['journeys']+'\x20journeys')+a30_0x55c005['dim'](_0xc1329d));}console[_0x577f7b(0x101)]('\x20\x20'+a30_0x55c005['green']('+\x20'+_0x11ac4f[_0x577f7b(0xff)]+_0x577f7b(0x10b))),console[_0x577f7b(0x101)]('\x20\x20'+a30_0x55c005[_0x577f7b(0xd6)]('~\x20'+_0x1852f6['length']+_0x577f7b(0xd3))),console['error']('\x20\x20'+a30_0x55c005['dim']('=\x20'+_0x54b9eb[_0x577f7b(0xff)]+_0x577f7b(0x114))),console[_0x577f7b(0x101)](_0x577f7b(0xda)+a30_0x55c005[_0x577f7b(0xf3)](_0x54c86d['targetDir'])+'\x0a');if(_0x1852f6[_0x577f7b(0xff)]>0x0)for(const _0x291e6e of _0x1852f6){console[_0x577f7b(0x101)](_0x577f7b(0xf4)+_0x291e6e[_0x577f7b(0xea)]+'\x27:'),console[_0x577f7b(0x101)]('─'[_0x577f7b(0xe3)](0x3c)),console[_0x577f7b(0x101)](_0x291e6e[_0x577f7b(0xe7)]),console['error']('─'['repeat'](0x3c));}if(_0x280aaf[_0x577f7b(0xfe)])return console[_0x577f7b(0x101)](a30_0x55c005[_0x577f7b(0xd6)]('\x0a[Dry\x20run]\x20No\x20files\x20were\x20written')),0x0;if(_0x11ac4f[_0x577f7b(0xff)]===0x0&&_0x1852f6[_0x577f7b(0xff)]===0x0)return console[_0x577f7b(0x101)](a30_0x55c005[_0x577f7b(0x10e)](_0x577f7b(0xf0))),saveSessionContext({'parent_segment':_0x54c86d[_0x577f7b(0xe9)]},_0x280aaf[_0x577f7b(0xfd)]),console[_0x577f7b(0x101)](a30_0x55c005[_0x577f7b(0x10e)](_0x577f7b(0xfb)+a30_0x55c005[_0x577f7b(0xed)](_0x577f7b(0xcc))+_0x577f7b(0xce)+a30_0x55c005[_0x577f7b(0xf3)](_0x54c86d[_0x577f7b(0xe9)]))),0x0;if(!_0x280aaf[_0x577f7b(0xfc)]){if(!isInteractive())return console[_0x577f7b(0x101)](a30_0x55c005[_0x577f7b(0xf5)](_0x577f7b(0xdb)),'Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode'),console[_0x577f7b(0x101)](a30_0x55c005[_0x577f7b(0xed)](_0x577f7b(0xdf))),0x1;const _0x2830a8=await confirmKey('Write\x20'+(_0x11ac4f[_0x577f7b(0xff)]+_0x1852f6[_0x577f7b(0xff)])+_0x577f7b(0xf2));if(!_0x2830a8)return console['error'](a30_0x55c005[_0x577f7b(0xd6)](_0x577f7b(0xe2)),_0x577f7b(0x109)),0x1;}for(const _0x330825 of _0x54c86d[_0x577f7b(0xef)]){if(_0x330825['isNew']||_0x330825[_0x577f7b(0xd5)]){const _0x5ab365=a30_0x53db17[_0x577f7b(0xe6)](_0x330825[_0x577f7b(0x108)]);!existsSync(_0x5ab365)&&mkdirSync(_0x5ab365,{'recursive':!![]}),writeFileSync(_0x330825['absolutePath'],_0x330825[_0x577f7b(0x103)],_0x577f7b(0xcd));}}return console[_0x577f7b(0x101)](a30_0x55c005['green'](_0x577f7b(0xd8)+(_0x11ac4f[_0x577f7b(0xff)]+_0x1852f6[_0x577f7b(0xff)])+_0x577f7b(0xdc)+_0x54c86d[_0x577f7b(0x113)])),saveSessionContext({'parent_segment':_0x54c86d[_0x577f7b(0xe9)]},_0x280aaf[_0x577f7b(0xfd)]),console[_0x577f7b(0x101)](a30_0x55c005[_0x577f7b(0x10e)](_0x577f7b(0xfb)+a30_0x55c005[_0x577f7b(0xed)](_0x577f7b(0xcc))+'\x20=\x20'+a30_0x55c005[_0x577f7b(0xf3)](_0x54c86d[_0x577f7b(0xe9)]))),0x0;}}