@treasuredata/tdx 2026.4.22 → 2026.4.23

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 (224) hide show
  1. package/dist/bin.js +1 -1
  2. package/dist/build-info.json +3 -3
  3. package/dist/cli-categories.js +1 -1
  4. package/dist/cli.js +1 -1
  5. package/dist/commands/activations.js +1 -1
  6. package/dist/commands/agent-command.js +1 -1
  7. package/dist/commands/agent-test-command.js +1 -1
  8. package/dist/commands/api-command.js +1 -1
  9. package/dist/commands/auth-command.js +1 -1
  10. package/dist/commands/cas-command.js +1 -1
  11. package/dist/commands/cas-segment-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/delivery-command.js +1 -1
  20. package/dist/commands/describe.js +1 -1
  21. package/dist/commands/engage-campaign-pull-command.js +1 -1
  22. package/dist/commands/engage-campaign-push-command.js +1 -1
  23. package/dist/commands/engage-campaign-validate-command.js +1 -1
  24. package/dist/commands/engage-command.js +1 -1
  25. package/dist/commands/engage-template-pull-command.js +1 -1
  26. package/dist/commands/engage-template-push-command.js +1 -1
  27. package/dist/commands/engage-template-validate-command.js +1 -1
  28. package/dist/commands/job-command.js +1 -1
  29. package/dist/commands/journey-command.js +1 -1
  30. package/dist/commands/journey-validate-command.js +1 -1
  31. package/dist/commands/llm-command.js +1 -1
  32. package/dist/commands/mcp-command.js +1 -1
  33. package/dist/commands/parent-segment-command.js +1 -1
  34. package/dist/commands/policy-command.js +1 -1
  35. package/dist/commands/profile-command.js +1 -1
  36. package/dist/commands/profiles-command.js +1 -1
  37. package/dist/commands/query-command.js +1 -1
  38. package/dist/commands/schedule-command.js +1 -1
  39. package/dist/commands/segment-command.js +1 -1
  40. package/dist/commands/segment-create-command.js +1 -1
  41. package/dist/commands/segment-fields-command.js +1 -1
  42. package/dist/commands/segment-pull-command.js +1 -1
  43. package/dist/commands/segment-push-command.js +1 -1
  44. package/dist/commands/segment-update-command.js +1 -1
  45. package/dist/commands/segment-use-command.js +1 -1
  46. package/dist/commands/segment-validate-command.js +1 -1
  47. package/dist/commands/segments.js +1 -1
  48. package/dist/commands/show.js +1 -1
  49. package/dist/commands/status-command.js +1 -1
  50. package/dist/commands/tables.js +1 -1
  51. package/dist/commands/unset-command.js +1 -1
  52. package/dist/commands/upgrade-command.js +1 -1
  53. package/dist/commands/use-command.js +1 -1
  54. package/dist/commands/user-command.js +1 -1
  55. package/dist/commands/work-command.js +1 -1
  56. package/dist/commands/workflow-command.js +1 -1
  57. package/dist/core/auth.js +1 -1
  58. package/dist/core/command-output.js +1 -1
  59. package/dist/core/config.js +1 -1
  60. package/dist/core/connection-cache.js +1 -1
  61. package/dist/core/constants.js +1 -1
  62. package/dist/core/credential-cache.js +1 -1
  63. package/dist/core/global-context.js +1 -1
  64. package/dist/core/keychain.js +1 -1
  65. package/dist/core/oauth-keychain.js +1 -1
  66. package/dist/core/oauth.js +1 -1
  67. package/dist/core/profile.js +1 -1
  68. package/dist/core/project-config.js +1 -1
  69. package/dist/core/session.js +1 -1
  70. package/dist/core/user-cache.js +1 -1
  71. package/dist/core/version.js +1 -1
  72. package/dist/index.js +1 -1
  73. package/dist/mcp/server.js +1 -1
  74. package/dist/mcp/tools/index.js +1 -1
  75. package/dist/mcp/tools/tdx-run.js +1 -1
  76. package/dist/mcp/tools/tdx-search.js +1 -1
  77. package/dist/mcp/tools/work-create-item.js +1 -1
  78. package/dist/mcp/utils.js +1 -1
  79. package/dist/proxy/claude-usage-tracker.js +1 -1
  80. package/dist/proxy/passthrough-server.d.ts +7 -0
  81. package/dist/proxy/passthrough-server.d.ts.map +1 -1
  82. package/dist/proxy/passthrough-server.js +1 -1
  83. package/dist/proxy/passthrough-server.js.map +1 -1
  84. package/dist/proxy/sse-usage-parser.js +1 -1
  85. package/dist/sdk/agent/agent-config.js +1 -1
  86. package/dist/sdk/agent/agent-ref-parser.js +1 -1
  87. package/dist/sdk/agent/agent-yaml.js +1 -1
  88. package/dist/sdk/agent/test/evaluator.js +1 -1
  89. package/dist/sdk/agent/test/executor.js +1 -1
  90. package/dist/sdk/agent/test/index.js +1 -1
  91. package/dist/sdk/agent/test/output.js +1 -1
  92. package/dist/sdk/agent/test/parser.js +1 -1
  93. package/dist/sdk/agent/tool-target-registry.js +1 -1
  94. package/dist/sdk/api.js +1 -1
  95. package/dist/sdk/cas/cas-api-client.js +1 -1
  96. package/dist/sdk/cas/cas-audience-yaml.js +1 -1
  97. package/dist/sdk/cas/cas-segment-yaml.js +1 -1
  98. package/dist/sdk/cas/index.js +1 -1
  99. package/dist/sdk/cas/pull-workflow.js +1 -1
  100. package/dist/sdk/cas/push-workflow.js +1 -1
  101. package/dist/sdk/client/cdp-api-client.js +1 -1
  102. package/dist/sdk/client/delivery-api-client.js +1 -1
  103. package/dist/sdk/client/endpoints.js +1 -1
  104. package/dist/sdk/client/engage-api-client.js +1 -1
  105. package/dist/sdk/client/http-client.js +1 -1
  106. package/dist/sdk/client/llm-api-client.js +1 -1
  107. package/dist/sdk/client/oauth-refresh.js +1 -1
  108. package/dist/sdk/client/rate-limiter.js +1 -1
  109. package/dist/sdk/client/td-api-client.js +1 -1
  110. package/dist/sdk/client/trino-api-client.js +1 -1
  111. package/dist/sdk/client/workflow-client.js +1 -1
  112. package/dist/sdk/connection-validator.js +1 -1
  113. package/dist/sdk/connection.js +1 -1
  114. package/dist/sdk/delivery.js +1 -1
  115. package/dist/sdk/engage/campaign-pull.js +1 -1
  116. package/dist/sdk/engage/campaign-push.js +1 -1
  117. package/dist/sdk/engage/campaign-validator.js +1 -1
  118. package/dist/sdk/engage/campaign-yaml.js +1 -1
  119. package/dist/sdk/engage/template-pull.js +1 -1
  120. package/dist/sdk/engage/template-push.js +1 -1
  121. package/dist/sdk/engage/template-validator.js +1 -1
  122. package/dist/sdk/engage/template-yaml.js +1 -1
  123. package/dist/sdk/engage/types/campaign-def.js +1 -1
  124. package/dist/sdk/engage/types/campaign-schema.js +1 -1
  125. package/dist/sdk/engage/types/template-schema.js +1 -1
  126. package/dist/sdk/engage.js +1 -1
  127. package/dist/sdk/errors.js +1 -1
  128. package/dist/sdk/index.js +1 -1
  129. package/dist/sdk/io/index.js +1 -1
  130. package/dist/sdk/io/node-filesystem.js +1 -1
  131. package/dist/sdk/job.js +1 -1
  132. package/dist/sdk/journey.js +1 -1
  133. package/dist/sdk/llm/chat-cache.js +1 -1
  134. package/dist/sdk/llm/index.js +1 -1
  135. package/dist/sdk/llm/llm-backup-utils.js +1 -1
  136. package/dist/sdk/llm/model-factors.js +1 -1
  137. package/dist/sdk/personalization.js +1 -1
  138. package/dist/sdk/policy.js +1 -1
  139. package/dist/sdk/query/index.js +1 -1
  140. package/dist/sdk/query/sql-parser.js +1 -1
  141. package/dist/sdk/realtime.js +1 -1
  142. package/dist/sdk/schedule.js +1 -1
  143. package/dist/sdk/segment/child-segment-yaml.js +1 -1
  144. package/dist/sdk/segment/fields-display.js +1 -1
  145. package/dist/sdk/segment/file-discovery.js +1 -1
  146. package/dist/sdk/segment/journey-utils.js +1 -1
  147. package/dist/sdk/segment/journey-validator.js +1 -1
  148. package/dist/sdk/segment/journey-yaml.js +1 -1
  149. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  150. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  151. package/dist/sdk/segment/pull-workflow.js +1 -1
  152. package/dist/sdk/segment/push-recovery.js +1 -1
  153. package/dist/sdk/segment/push-workflow.js +1 -1
  154. package/dist/sdk/segment/resolution-context.js +1 -1
  155. package/dist/sdk/segment/segment-path-parser.js +1 -1
  156. package/dist/sdk/segment/segment-ref-parser.js +1 -1
  157. package/dist/sdk/segment/segment-validator.js +1 -1
  158. package/dist/sdk/segment/target-resolution.js +1 -1
  159. package/dist/sdk/segment/tdx-config.js +1 -1
  160. package/dist/sdk/segment/types/activation-schema.js +1 -1
  161. package/dist/sdk/segment/types/journey-def.js +1 -1
  162. package/dist/sdk/segment/types/journey-schema.js +1 -1
  163. package/dist/sdk/segment/types/segment-def.js +1 -1
  164. package/dist/sdk/segment/types/segment-schema.js +1 -1
  165. package/dist/sdk/segment/validate-files.js +1 -1
  166. package/dist/sdk/segment/yaml-validator.js +1 -1
  167. package/dist/sdk/segment.js +1 -1
  168. package/dist/sdk/types/index.js +1 -1
  169. package/dist/sdk/types/progress.js +1 -1
  170. package/dist/sdk/types/workspace.js +1 -1
  171. package/dist/sdk/user.js +1 -1
  172. package/dist/sdk/util/format-detector.js +1 -1
  173. package/dist/sdk/util/formatters.js +1 -1
  174. package/dist/sdk/util/index.js +1 -1
  175. package/dist/sdk/util/paginate.js +1 -1
  176. package/dist/sdk/util/tree-formatter.js +1 -1
  177. package/dist/sdk/workflow/archive-validation.js +1 -1
  178. package/dist/sdk/workflow/clone-workflow.js +1 -1
  179. package/dist/sdk/workflow/index.js +1 -1
  180. package/dist/sdk/workflow/pull-workflow.js +1 -1
  181. package/dist/sdk/workflow/push-workflow.js +1 -1
  182. package/dist/sdk/workflow/task-graph.js +1 -1
  183. package/dist/sdk/workflow/tdx-config.js +1 -1
  184. package/dist/sdk/workflow/workflow-utils.js +1 -1
  185. package/dist/sdk/workspace/access-tracker.js +1 -1
  186. package/dist/sdk/workspace/frontmatter.js +1 -1
  187. package/dist/sdk/workspace/git.js +1 -1
  188. package/dist/sdk/workspace/index.js +1 -1
  189. package/dist/sdk/workspace/templates.js +1 -1
  190. package/dist/sdk/workspace/weekly.js +1 -1
  191. package/dist/sdk/workspace/wikilinks.js +1 -1
  192. package/dist/test-utils/command-runner.js +1 -1
  193. package/dist/test-utils/factories.js +1 -1
  194. package/dist/test-utils/fixtures.js +1 -1
  195. package/dist/test-utils/http-mock.js +1 -1
  196. package/dist/test-utils/index.js +1 -1
  197. package/dist/utils/async.js +1 -1
  198. package/dist/utils/colors.js +1 -1
  199. package/dist/utils/diff.js +1 -1
  200. package/dist/utils/file-permissions.js +1 -1
  201. package/dist/utils/file-reader.js +1 -1
  202. package/dist/utils/github-releases.js +1 -1
  203. package/dist/utils/global-cache.js +1 -1
  204. package/dist/utils/json-loader.js +1 -1
  205. package/dist/utils/local-cache.js +1 -1
  206. package/dist/utils/logger/formatters/default-formatter.js +1 -1
  207. package/dist/utils/logger/formatters/index.js +1 -1
  208. package/dist/utils/logger/handlers/console-handler.js +1 -1
  209. package/dist/utils/logger/handlers/file-handler.js +1 -1
  210. package/dist/utils/logger/handlers/index.js +1 -1
  211. package/dist/utils/logger/handlers/null-handler.js +1 -1
  212. package/dist/utils/logger/index.js +1 -1
  213. package/dist/utils/logger/logger.js +1 -1
  214. package/dist/utils/logger/types.js +1 -1
  215. package/dist/utils/option-validation.js +1 -1
  216. package/dist/utils/process.js +1 -1
  217. package/dist/utils/prompt.js +1 -1
  218. package/dist/utils/spinner.js +1 -1
  219. package/dist/utils/sse-parser.js +1 -1
  220. package/dist/utils/string-utils.js +1 -1
  221. package/dist/utils/table-ref-parser.js +1 -1
  222. package/dist/utils/tdx-logger.js +1 -1
  223. package/dist/utils/version-check.js +1 -1
  224. package/package.json +1 -1
@@ -1 +1 @@
1
- const a32_0x541fd6=a32_0x4869;(function(_0x1b28eb,_0x127e39){const _0x508134=a32_0x4869,_0x70e648=_0x1b28eb();while(!![]){try{const _0x4e523b=parseInt(_0x508134(0x10e))/0x1+parseInt(_0x508134(0x122))/0x2+-parseInt(_0x508134(0x12f))/0x3*(parseInt(_0x508134(0x12b))/0x4)+-parseInt(_0x508134(0x111))/0x5*(parseInt(_0x508134(0x117))/0x6)+parseInt(_0x508134(0x101))/0x7*(-parseInt(_0x508134(0x126))/0x8)+-parseInt(_0x508134(0x112))/0x9+parseInt(_0x508134(0x138))/0xa;if(_0x4e523b===_0x127e39)break;else _0x70e648['push'](_0x70e648['shift']());}catch(_0x5cadff){_0x70e648['push'](_0x70e648['shift']());}}}(a32_0x5e31,0x4d66a));import{BaseCommand}from'./command.js';import{handleSDKOutput,handleSingleObjectOutput,isStructuredFormat}from'../core/command-output.js';function a32_0x4869(_0x1b0bcb,_0x424be8){_0x1b0bcb=_0x1b0bcb-0x100;const _0x5e31b0=a32_0x5e31();let _0x48690a=_0x5e31b0[_0x1b0bcb];return _0x48690a;}import{withSpinner}from'../utils/spinner.js';import a32_0x4c4d20 from'chalk';export class PolicyCommand extends BaseCommand{[a32_0x541fd6(0x125)]=a32_0x541fd6(0x10c);[a32_0x541fd6(0x127)]='Show\x20current\x20user\x20policies\x20and\x20effective\x20permissions';async[a32_0x541fd6(0x13b)](_0x68c601){const _0x2c646b=a32_0x541fd6,{options:_0x131af0,tdx:_0x1a6e0e}=_0x68c601,_0x5ea915=await withSpinner(_0x2c646b(0x12e),async()=>{const _0x320f4b=_0x2c646b,[_0x3a9733,_0x5b2a04]=await Promise[_0x320f4b(0x11c)]([_0x1a6e0e['user'][_0x320f4b(0x116)](),_0x1a6e0e[_0x320f4b(0x10c)][_0x320f4b(0x133)]()]);return{'userInfo':_0x3a9733,'permissions':_0x5b2a04};},{'verbose':_0x131af0[_0x2c646b(0x13a)]}),{userInfo:_0x40ec32,permissions:_0x572ab0}=_0x5ea915['data'];if(isStructuredFormat(_0x131af0))return await handleSingleObjectOutput(_0x572ab0,_0x131af0),0x0;const _0x3134f9=_0x40ec32[_0x2c646b(0x123)]?_0x2c646b(0x10f):_0x40ec32[_0x2c646b(0x120)]?_0x2c646b(0x139):_0x2c646b(0x113);console[_0x2c646b(0x115)]('\x0a'+a32_0x4c4d20['bold']('👤')+'\x20'+a32_0x4c4d20['bold'](_0x40ec32['name'])+'\x20'+a32_0x4c4d20[_0x2c646b(0x109)]('('+_0x40ec32[_0x2c646b(0x131)]+')')+_0x2c646b(0x134)+_0x3134f9),console[_0x2c646b(0x115)](a32_0x4c4d20[_0x2c646b(0x109)]('\x20\x20\x20'+_0x1a6e0e['context'][_0x2c646b(0x132)]+':'+_0x40ec32[_0x2c646b(0x128)]+_0x2c646b(0x10b)+_0x40ec32['id']));const _0x37f22f=_0x572ab0[_0x2c646b(0x12c)];console[_0x2c646b(0x115)]('\x0a'+a32_0x4c4d20[_0x2c646b(0x100)](_0x2c646b(0x110))+'\x20('+_0x37f22f[_0x2c646b(0x107)]+'):');if(_0x37f22f[_0x2c646b(0x107)]===0x0)console[_0x2c646b(0x115)](a32_0x4c4d20[_0x2c646b(0x109)](_0x2c646b(0x10d)));else for(const _0x3a339d of _0x37f22f){console[_0x2c646b(0x115)](_0x2c646b(0x106)+_0x3a339d['name']);}return printPermissionsMap(_0x572ab0[_0x2c646b(0x119)]),console[_0x2c646b(0x115)](),0x0;}}export class PolicyListCommand extends BaseCommand{[a32_0x541fd6(0x125)]=a32_0x541fd6(0x104);['description']='List\x20all\x20policies\x20in\x20the\x20account\x20(admin\x20only)';async['execute'](_0x58a2fe){const _0x526589=a32_0x541fd6,{options:_0x3ea831,tdx:_0x3b1005}=_0x58a2fe,_0x1f7e3b=await withSpinner(_0x526589(0x108),()=>_0x3b1005[_0x526589(0x10c)][_0x526589(0x136)](),{'verbose':_0x3ea831[_0x526589(0x13a)]}),_0x5460b9=_0x1f7e3b[_0x526589(0x103)];console[_0x526589(0x11d)](_0x526589(0x11f)+_0x5460b9[_0x526589(0x107)]+'\x20polic'+(_0x5460b9['length']!==0x1?_0x526589(0x135):'y'));if(isStructuredFormat(_0x3ea831))return await handleSDKOutput(_0x5460b9,_0x3ea831),0x0;if(_0x5460b9[_0x526589(0x107)]===0x0)console['log'](a32_0x4c4d20['dim']('No\x20policies\x20found'));else for(const _0x3e51df of _0x5460b9){const _0x3ee1e3=_0x3e51df[_0x526589(0x127)]?a32_0x4c4d20[_0x526589(0x109)](_0x526589(0x134)+_0x3e51df[_0x526589(0x127)]):'';console['log'](_0x526589(0x106)+_0x3e51df[_0x526589(0x125)]+_0x3ee1e3);}return 0x0;}}export class PolicyShowCommand extends BaseCommand{[a32_0x541fd6(0x125)]=a32_0x541fd6(0x121);[a32_0x541fd6(0x127)]=a32_0x541fd6(0x114);['validate'](_0x4069c7){const _0x244454=a32_0x541fd6;if(_0x4069c7[_0x244454(0x10a)]['length']===0x0)return'Usage:\x20tdx\x20policy\x20show\x20<policy-name-or-id>';return undefined;}async[a32_0x541fd6(0x13b)](_0x196860){const _0x420fbd=a32_0x541fd6,{options:_0x7948f2,tdx:_0x631139}=_0x196860,_0x21c9b0=_0x196860[_0x420fbd(0x10a)][0x0],_0x3cf898=await withSpinner(_0x420fbd(0x137),async()=>{const _0x58377c=_0x420fbd,_0x2ef598=await _0x631139['policy'][_0x58377c(0x12d)](_0x21c9b0),[_0x4fc9e7,_0x4a30a3]=await Promise[_0x58377c(0x11c)]([_0x631139[_0x58377c(0x10c)][_0x58377c(0x129)](_0x2ef598['id']),_0x631139[_0x58377c(0x10c)][_0x58377c(0x11e)](_0x2ef598['id'])]);return{'policy':_0x2ef598,'perms':_0x4fc9e7,'users':_0x4a30a3};},{'verbose':_0x7948f2[_0x420fbd(0x13a)]}),{policy:_0x4d7ac2,perms:_0x3b1a86,users:_0x3e28a9}=_0x3cf898['data'];if(isStructuredFormat(_0x7948f2))return await handleSingleObjectOutput({..._0x4d7ac2,'permissions':_0x3b1a86[_0x420fbd(0x119)],'users':_0x3e28a9},_0x7948f2),0x0;console['log']('\x0a'+a32_0x4c4d20['bold']('📋')+'\x20'+a32_0x4c4d20[_0x420fbd(0x100)](_0x4d7ac2[_0x420fbd(0x125)])+'\x20'+a32_0x4c4d20[_0x420fbd(0x109)](_0x420fbd(0x124)+_0x4d7ac2['id']+')'));_0x4d7ac2[_0x420fbd(0x127)]&&console[_0x420fbd(0x115)](_0x420fbd(0x105)+a32_0x4c4d20[_0x420fbd(0x109)](_0x4d7ac2[_0x420fbd(0x127)]));console['log'](_0x420fbd(0x105)+_0x3e28a9['length']+_0x420fbd(0x12a)+(_0x3e28a9[_0x420fbd(0x107)]!==0x1?'s':'')+'\x20assigned'),printPermissionsMap(_0x3b1a86[_0x420fbd(0x119)]);if(_0x3e28a9[_0x420fbd(0x107)]>0x0){console[_0x420fbd(0x115)]('\x0a'+a32_0x4c4d20[_0x420fbd(0x100)]('👥\x20Assigned\x20Users')+':');for(const _0x277af5 of _0x3e28a9){const _0x19ddf0=_0x277af5[_0x420fbd(0x131)]&&_0x277af5[_0x420fbd(0x131)]!==_0x277af5[_0x420fbd(0x125)]?a32_0x4c4d20[_0x420fbd(0x109)]('\x20<'+_0x277af5[_0x420fbd(0x131)]+'>'):'';console[_0x420fbd(0x115)](_0x420fbd(0x106)+_0x277af5[_0x420fbd(0x125)]+_0x19ddf0);}}return console[_0x420fbd(0x115)](),0x0;}}function printPermissionsMap(_0x48abc1){const _0x1be4c2=a32_0x541fd6,_0x1df7a0=Object[_0x1be4c2(0x118)](_0x48abc1);console['log']('\x0a'+a32_0x4c4d20['bold'](_0x1be4c2(0x11a))+':');if(_0x1df7a0[_0x1be4c2(0x107)]===0x0){console[_0x1be4c2(0x115)](a32_0x4c4d20['dim']('\x20\x20No\x20permissions'));return;}const _0x2090ff=Math[_0x1be4c2(0x11b)](..._0x1df7a0[_0x1be4c2(0x130)](([_0x2124ac])=>_0x2124ac[_0x1be4c2(0x107)]));for(const [_0x4b1612,_0x2cc211]of _0x1df7a0){const _0x2ef689=formatOperations(_0x2cc211);console[_0x1be4c2(0x115)]('\x20\x20'+_0x4b1612[_0x1be4c2(0x102)](_0x2090ff+0x2)+_0x2ef689);}}function a32_0x5e31(){const _0x501267=['data','policy\x20list','\x20\x20\x20','\x20\x20•\x20','length','Listing\x20policies...','dim','args',',\x20user_id:','policy','\x20\x20No\x20policies\x20assigned','236889NrcUmH','Account\x20Owner','📋\x20Assigned\x20Policies','2268355AJeGVo','1744047zPunDI','Member','Show\x20a\x20specific\x20policy\x20details\x20and\x20permissions\x20(admin\x20only)','log','getCurrent','6xqZQMq','entries','permissions','🔑\x20Effective\x20Permissions','max','all','error','getPolicyUsers','✔\x20Found\x20','administrator','policy\x20show','951812akOJXF','account_owner','(ID:\x20','name','1441624rbuuTJ','description','account_id','getPolicyPermissions','\x20user','794776ssiBMN','policies','getPolicy','Fetching\x20permissions...','3aGLWKZ','map','email','site','getMyPermissions','\x20—\x20','ies','listPolicies','Fetching\x20policy...','6305900viyAoA','Administrator','verbose','execute','operation','bold','7lShRcG','padEnd'];a32_0x5e31=function(){return _0x501267;};return a32_0x5e31();}function formatOperations(_0x2db6eb){const _0x37ce20=a32_0x541fd6,_0x30ca0f=[...new Set(_0x2db6eb[_0x37ce20(0x130)](_0x36ff11=>_0x36ff11[_0x37ce20(0x13c)]))];return _0x30ca0f['join'](',\x20');}
1
+ function a32_0x8852(){const _0x58dcd5=['12302163DjFXKg','verbose','\x20\x20No\x20permissions','40416300TmZBlH','policies','join','policy','Fetching\x20policy...','site','👥\x20Assigned\x20Users','account_id','Member','Usage:\x20tdx\x20policy\x20show\x20<policy-name-or-id>','Show\x20a\x20specific\x20policy\x20details\x20and\x20permissions\x20(admin\x20only)','2386811ATKiQp','execute','\x20assigned','operation','padEnd','30EEjZsx','map','email','account_owner','validate','📋\x20Assigned\x20Policies',',\x20user_id:','args','name','getPolicyUsers','3592256IeCyeU','🔑\x20Effective\x20Permissions','102764lJzTfW','Account\x20Owner','\x20\x20No\x20policies\x20assigned','Listing\x20policies...','context','Fetching\x20permissions...','24146YICIBp','\x20\x20•\x20','policy\x20show','getCurrent','user','administrator','getPolicyPermissions','bold','Administrator','listPolicies','\x20polic','length','\x20user','24ZbHCSM','getMyPermissions','No\x20policies\x20found','getPolicy','permissions','\x20—\x20','dim','\x20\x20\x20','3897408AuadHK','data','131fJdNDE','log','ies','description','✔\x20Found\x20'];a32_0x8852=function(){return _0x58dcd5;};return a32_0x8852();}const a32_0x19eee8=a32_0x523a;(function(_0x315bd5,_0x6c46b3){const _0x2839ae=a32_0x523a,_0x128ed8=_0x315bd5();while(!![]){try{const _0x5129e3=parseInt(_0x2839ae(0x11e))/0x1*(parseInt(_0x2839ae(0x107))/0x2)+parseInt(_0x2839ae(0x11c))/0x3+-parseInt(_0x2839ae(0x101))/0x4*(parseInt(_0x2839ae(0xf5))/0x5)+parseInt(_0x2839ae(0x114))/0x6*(parseInt(_0x2839ae(0xf0))/0x7)+-parseInt(_0x2839ae(0xff))/0x8+parseInt(_0x2839ae(0xe2))/0x9+-parseInt(_0x2839ae(0xe5))/0xa;if(_0x5129e3===_0x6c46b3)break;else _0x128ed8['push'](_0x128ed8['shift']());}catch(_0x56ebb1){_0x128ed8['push'](_0x128ed8['shift']());}}}(a32_0x8852,0xec022));import{BaseCommand}from'./command.js';function a32_0x523a(_0x2093a1,_0x578792){_0x2093a1=_0x2093a1-0xde;const _0x88523=a32_0x8852();let _0x523a91=_0x88523[_0x2093a1];return _0x523a91;}import{handleSDKOutput,handleSingleObjectOutput,isStructuredFormat}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import a32_0x4cbd13 from'chalk';export class PolicyCommand extends BaseCommand{[a32_0x19eee8(0xfd)]=a32_0x19eee8(0xe8);[a32_0x19eee8(0xe0)]='Show\x20current\x20user\x20policies\x20and\x20effective\x20permissions';async['execute'](_0x460b96){const _0x43484d=a32_0x19eee8,{options:_0xc0d8d8,tdx:_0x325157}=_0x460b96,_0x5a87e0=await withSpinner(_0x43484d(0x106),async()=>{const _0x3135aa=_0x43484d,[_0xa2b56c,_0x5145bf]=await Promise['all']([_0x325157[_0x3135aa(0x10b)][_0x3135aa(0x10a)](),_0x325157[_0x3135aa(0xe8)][_0x3135aa(0x115)]()]);return{'userInfo':_0xa2b56c,'permissions':_0x5145bf};},{'verbose':_0xc0d8d8['verbose']}),{userInfo:_0x2eabbb,permissions:_0xc5eb77}=_0x5a87e0[_0x43484d(0x11d)];if(isStructuredFormat(_0xc0d8d8))return await handleSingleObjectOutput(_0xc5eb77,_0xc0d8d8),0x0;const _0x39f3ec=_0x2eabbb[_0x43484d(0xf8)]?_0x43484d(0x102):_0x2eabbb[_0x43484d(0x10c)]?_0x43484d(0x10f):_0x43484d(0xed);console[_0x43484d(0xde)]('\x0a'+a32_0x4cbd13['bold']('👤')+'\x20'+a32_0x4cbd13[_0x43484d(0x10e)](_0x2eabbb[_0x43484d(0xfd)])+'\x20'+a32_0x4cbd13[_0x43484d(0x11a)]('('+_0x2eabbb[_0x43484d(0xf7)]+')')+'\x20—\x20'+_0x39f3ec),console[_0x43484d(0xde)](a32_0x4cbd13[_0x43484d(0x11a)]('\x20\x20\x20'+_0x325157[_0x43484d(0x105)][_0x43484d(0xea)]+':'+_0x2eabbb[_0x43484d(0xec)]+_0x43484d(0xfb)+_0x2eabbb['id']));const _0x5e3957=_0xc5eb77[_0x43484d(0xe6)];console[_0x43484d(0xde)]('\x0a'+a32_0x4cbd13[_0x43484d(0x10e)](_0x43484d(0xfa))+'\x20('+_0x5e3957[_0x43484d(0x112)]+'):');if(_0x5e3957[_0x43484d(0x112)]===0x0)console[_0x43484d(0xde)](a32_0x4cbd13['dim'](_0x43484d(0x103)));else for(const _0x2662ac of _0x5e3957){console[_0x43484d(0xde)](_0x43484d(0x108)+_0x2662ac['name']);}return printPermissionsMap(_0xc5eb77[_0x43484d(0x118)]),console['log'](),0x0;}}export class PolicyListCommand extends BaseCommand{[a32_0x19eee8(0xfd)]='policy\x20list';[a32_0x19eee8(0xe0)]='List\x20all\x20policies\x20in\x20the\x20account\x20(admin\x20only)';async['execute'](_0x3569e1){const _0x451030=a32_0x19eee8,{options:_0x38b211,tdx:_0x5e688d}=_0x3569e1,_0x4f9df4=await withSpinner(_0x451030(0x104),()=>_0x5e688d['policy'][_0x451030(0x110)](),{'verbose':_0x38b211[_0x451030(0xe3)]}),_0x2abc1b=_0x4f9df4[_0x451030(0x11d)];console['error'](_0x451030(0xe1)+_0x2abc1b[_0x451030(0x112)]+_0x451030(0x111)+(_0x2abc1b[_0x451030(0x112)]!==0x1?_0x451030(0xdf):'y'));if(isStructuredFormat(_0x38b211))return await handleSDKOutput(_0x2abc1b,_0x38b211),0x0;if(_0x2abc1b['length']===0x0)console[_0x451030(0xde)](a32_0x4cbd13[_0x451030(0x11a)](_0x451030(0x116)));else for(const _0x59640d of _0x2abc1b){const _0x50b2dc=_0x59640d[_0x451030(0xe0)]?a32_0x4cbd13[_0x451030(0x11a)](_0x451030(0x119)+_0x59640d[_0x451030(0xe0)]):'';console['log'](_0x451030(0x108)+_0x59640d['name']+_0x50b2dc);}return 0x0;}}export class PolicyShowCommand extends BaseCommand{['name']=a32_0x19eee8(0x109);[a32_0x19eee8(0xe0)]=a32_0x19eee8(0xef);[a32_0x19eee8(0xf9)](_0x40d76c){const _0x19bb97=a32_0x19eee8;if(_0x40d76c[_0x19bb97(0xfc)][_0x19bb97(0x112)]===0x0)return _0x19bb97(0xee);return undefined;}async[a32_0x19eee8(0xf1)](_0x29e2b7){const _0x5ae7c4=a32_0x19eee8,{options:_0x5e8ae2,tdx:_0x3edf52}=_0x29e2b7,_0x17ed17=_0x29e2b7[_0x5ae7c4(0xfc)][0x0],_0x2d0b1d=await withSpinner(_0x5ae7c4(0xe9),async()=>{const _0x4958be=_0x5ae7c4,_0x861e81=await _0x3edf52['policy'][_0x4958be(0x117)](_0x17ed17),[_0x243e80,_0x3f27e8]=await Promise['all']([_0x3edf52[_0x4958be(0xe8)][_0x4958be(0x10d)](_0x861e81['id']),_0x3edf52[_0x4958be(0xe8)][_0x4958be(0xfe)](_0x861e81['id'])]);return{'policy':_0x861e81,'perms':_0x243e80,'users':_0x3f27e8};},{'verbose':_0x5e8ae2[_0x5ae7c4(0xe3)]}),{policy:_0x5d462d,perms:_0x5df603,users:_0x2ad597}=_0x2d0b1d[_0x5ae7c4(0x11d)];if(isStructuredFormat(_0x5e8ae2))return await handleSingleObjectOutput({..._0x5d462d,'permissions':_0x5df603[_0x5ae7c4(0x118)],'users':_0x2ad597},_0x5e8ae2),0x0;console[_0x5ae7c4(0xde)]('\x0a'+a32_0x4cbd13[_0x5ae7c4(0x10e)]('📋')+'\x20'+a32_0x4cbd13[_0x5ae7c4(0x10e)](_0x5d462d[_0x5ae7c4(0xfd)])+'\x20'+a32_0x4cbd13[_0x5ae7c4(0x11a)]('(ID:\x20'+_0x5d462d['id']+')'));_0x5d462d['description']&&console[_0x5ae7c4(0xde)](_0x5ae7c4(0x11b)+a32_0x4cbd13['dim'](_0x5d462d['description']));console[_0x5ae7c4(0xde)](_0x5ae7c4(0x11b)+_0x2ad597[_0x5ae7c4(0x112)]+_0x5ae7c4(0x113)+(_0x2ad597[_0x5ae7c4(0x112)]!==0x1?'s':'')+_0x5ae7c4(0xf2)),printPermissionsMap(_0x5df603[_0x5ae7c4(0x118)]);if(_0x2ad597['length']>0x0){console[_0x5ae7c4(0xde)]('\x0a'+a32_0x4cbd13['bold'](_0x5ae7c4(0xeb))+':');for(const _0x1af884 of _0x2ad597){const _0x4e746a=_0x1af884[_0x5ae7c4(0xf7)]&&_0x1af884['email']!==_0x1af884[_0x5ae7c4(0xfd)]?a32_0x4cbd13[_0x5ae7c4(0x11a)]('\x20<'+_0x1af884[_0x5ae7c4(0xf7)]+'>'):'';console[_0x5ae7c4(0xde)](_0x5ae7c4(0x108)+_0x1af884['name']+_0x4e746a);}}return console[_0x5ae7c4(0xde)](),0x0;}}function printPermissionsMap(_0x393318){const _0x228a07=a32_0x19eee8,_0x146665=Object['entries'](_0x393318);console[_0x228a07(0xde)]('\x0a'+a32_0x4cbd13[_0x228a07(0x10e)](_0x228a07(0x100))+':');if(_0x146665['length']===0x0){console['log'](a32_0x4cbd13['dim'](_0x228a07(0xe4)));return;}const _0x5e9812=Math['max'](..._0x146665[_0x228a07(0xf6)](([_0x5e15c6])=>_0x5e15c6[_0x228a07(0x112)]));for(const [_0xfd0705,_0x3908c8]of _0x146665){const _0x5325b2=formatOperations(_0x3908c8);console[_0x228a07(0xde)]('\x20\x20'+_0xfd0705[_0x228a07(0xf4)](_0x5e9812+0x2)+_0x5325b2);}}function formatOperations(_0x4f5364){const _0x2d37cd=a32_0x19eee8,_0x29c434=[...new Set(_0x4f5364['map'](_0x4e08dd=>_0x4e08dd[_0x2d37cd(0xf3)]))];return _0x29c434[_0x2d37cd(0xe7)](',\x20');}
@@ -1 +1 @@
1
- const a33_0x1bc630=a33_0x1586;(function(_0x425893,_0x159e6e){const _0x1e7894=a33_0x1586,_0x3046b5=_0x425893();while(!![]){try{const _0x1e1a5f=-parseInt(_0x1e7894(0xaa))/0x1+-parseInt(_0x1e7894(0xca))/0x2+-parseInt(_0x1e7894(0xbb))/0x3*(-parseInt(_0x1e7894(0xcf))/0x4)+parseInt(_0x1e7894(0x6b))/0x5*(parseInt(_0x1e7894(0xd2))/0x6)+-parseInt(_0x1e7894(0xa5))/0x7*(-parseInt(_0x1e7894(0xa0))/0x8)+parseInt(_0x1e7894(0x85))/0x9*(-parseInt(_0x1e7894(0xb0))/0xa)+parseInt(_0x1e7894(0x7c))/0xb;if(_0x1e1a5f===_0x159e6e)break;else _0x3046b5['push'](_0x3046b5['shift']());}catch(_0x5b5a8c){_0x3046b5['push'](_0x3046b5['shift']());}}}(a33_0x508f,0x1df64));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 a33_0x53994c from'node:path';import{saveSessionContext,getSessionID,cleanExpiredSessions}from'../core/session.js';import{saveAPIKeyAsync,resolveSite}from'../core/config.js';import{getConsoleUrl}from'../sdk/client/endpoints.js';import{deleteKeychainAPIKey,isKeychainAvailable}from'../core/keychain.js';function a33_0x1586(_0x11a791,_0x569bb2){_0x11a791=_0x11a791-0x68;const _0x508f04=a33_0x508f();let _0x1586a4=_0x508f04[_0x11a791];return _0x1586a4;}import{deleteOAuthTokens}from'../core/oauth-keychain.js';import{runOAuthLoginFlow,promptAuthMethod}from'./auth-command.js';function a33_0x508f(){const _0x4965ca=['length','21512zCWHoE','\x0aSaved\x20to:\x20','Key=value\x20pair\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','72QxGvvL','Profile\x20was\x20not\x20created.\x20Please\x20try\x20again.','tdx:\x20profile\x20create','\x27\x20updated:\x20','\x27\x20already\x20exists.\x20Use\x20\x27tdx\x20profile\x20delete\x20','password','(cleared)','\x0aSetup\x20cancelled','Changing\x20site\x20to\x20\x27','\x27\x20created','\x0aYou\x20can\x20find\x20your\x20API\x20key\x20at:','\x0aSetting\x20up\x20authentication\x20for\x20site:\x20','profileName','create','71580fquFkN','\x20API\x20key\x20saved\x20to\x20system\x20keychain\x20(profile:\x20','\x20Profile\x20\x27','bold','Delete\x20a\x20profile','Operation\x20cancelled','Session\x20profile\x20set\x20to:\x20','default','Validating\x20API\x20key...','\x27\x20requires\x20API\x20key\x20validation.','profile:delete','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20use\x20<name>\x20[--default]','us01','\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases','Removal\x20cancelled','Profile\x20\x27','Site\x20was\x20not\x20changed.','1579303IQVMgO','/app/mp/ak','ERROR','logLevel','email','\x20\x20-\x20','\x20API\x20key\x20is\x20valid\x20(User:\x20','session','apiKey','255699BnhjJo','llm_agent','VALID_KEYS','API\x20key\x20cannot\x20be\x20empty','Create\x20a\x20new\x20profile','dim','\x27\x20does\x20not\x20exist.','Profile\x20name\x20cannot\x20be\x20empty','Removed\x20existing\x20profile\x20\x27','\x27\x20deleted','\x0aTip:\x20Use\x20\x27tdx\x20profile\x20use\x20','force','Enter\x20description\x20(optional):','\x20API\x20key\x20saved\x20to\x20system\x20keychain','llm_project','Are\x20you\x20sure\x20you\x20want\x20to\x20remove\x20profile\x20\x27','Setup\x20cancelled','execute','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20delete\x20<name>','status','\x20\x20tdx\x20--profile\x20','includes','green','profile:set','You\x20can\x20find\x20your\x20API\x20key\x20at:','name','Enter\x20profile\x20name:','91096SIrdDP','text','\x27\x20to\x20remove\x20it\x20first,\x20or\x20re-create\x20with\x20--force.','site','Invalid\x20format.\x20Use:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','49WdjvDp','warn','oauth','confirm','Default\x20profile\x20set\x20to:\x20','208272AeEoOo','test','\x20\x20(no\x20profiles\x20found)','description','config','message','10iKxltg','split','Set\x20session\x20profile','join','jobs','\x27.\x0a\x0aValid\x20keys:\x20','validate','yellow','log','trim','profile','111PTzuZH','You\x20can\x20now\x20use\x20tdx\x20commands\x20with\x20this\x20profile.\x20Try:','skipExistsCheck','red','Profile\x20name\x20must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore','database','\x27\x20does\x20not\x20exist.\x20Create\x20it?','profile:create','Enter\x20your\x20TD\x20API\x20key:','getUserInfo','✗\x20Validation\x20failed:\x20','Failed\x20to\x20delete\x20profile:\x20','Set\x20a\x20profile\x20configuration\x20value','error','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','469306UmdDlR','\x0aAvailable\x20profiles:','tdx.json','tdx:\x20profile\x20delete'];a33_0x508f=function(){return _0x4965ca;};return a33_0x508f();}import{promptSiteSelection}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 a33_0x3b2d5b from'prompts';import a33_0x4c36d0 from'chalk';function validateProfileName(_0x2fd1a6,_0x40205f){const _0x57a35c=a33_0x1586;if(!_0x2fd1a6||!_0x2fd1a6[_0x57a35c(0xb9)]())return _0x57a35c(0x8c);const _0x3c6429=_0x2fd1a6['trim']();if(!/^[a-zA-Z0-9_-]+$/[_0x57a35c(0xab)](_0x3c6429))return _0x57a35c(0xbf);if(!_0x40205f?.[_0x57a35c(0xbd)]&&profileExists(_0x3c6429))return _0x57a35c(0x7a)+_0x3c6429+_0x57a35c(0xd6)+_0x3c6429+_0x57a35c(0xa2);return!![];}async function deleteProfileAndCredentials(_0x420676){removeProfileFromUserConfig(_0x420676);const _0x3c4baf=await isKeychainAvailable();_0x3c4baf&&await Promise['all']([deleteKeychainAPIKey(_0x420676),deleteOAuthTokens(_0x420676)]);}export class ProfileCreateCommand extends BaseCommand{[a33_0x1bc630(0x9e)]=a33_0x1bc630(0xc2);[a33_0x1bc630(0xad)]=a33_0x1bc630(0x89);async[a33_0x1bc630(0x96)](_0x5000b4){const _0x4eb2a6=a33_0x1bc630,{options:_0x5c9486,args:_0x111231}=_0x5000b4,_0x15c586=!!_0x5c9486[_0x4eb2a6(0x90)];console['log'](a33_0x4c36d0['bold'](_0x4eb2a6(0xd4)));let _0x5f3fb9;if(_0x111231[_0x4eb2a6(0xce)]>0x0&&_0x111231[0x0]){const _0x209867=_0x111231[0x0][_0x4eb2a6(0xb9)]();_0x15c586&&profileExists(_0x209867)&&(await deleteProfileAndCredentials(_0x209867),console[_0x4eb2a6(0xb8)](_0x4eb2a6(0x8d)+_0x209867+'\x27'));const _0x52ba08=validateProfileName(_0x209867);if(_0x52ba08!==!![])return console[_0x4eb2a6(0xc8)](a33_0x4c36d0[_0x4eb2a6(0xbe)](_0x52ba08)),0x1;_0x5f3fb9=_0x209867;}else{const _0x279f24=await a33_0x3b2d5b({'type':'text','name':_0x4eb2a6(0x69),'message':_0x4eb2a6(0x9f),'validate':_0x595193=>validateProfileName(_0x595193,{'skipExistsCheck':_0x15c586})});if(!_0x279f24[_0x4eb2a6(0x69)])return console[_0x4eb2a6(0xb8)](_0x4eb2a6(0xd9)),0x1;_0x5f3fb9=_0x279f24[_0x4eb2a6(0x69)][_0x4eb2a6(0xb9)](),_0x15c586&&profileExists(_0x5f3fb9)&&(await deleteProfileAndCredentials(_0x5f3fb9),console[_0x4eb2a6(0xb8)](_0x4eb2a6(0x8d)+_0x5f3fb9+'\x27'));}const _0x485878=await a33_0x3b2d5b({'type':_0x4eb2a6(0xa1),'name':_0x4eb2a6(0xad),'message':_0x4eb2a6(0x91)}),_0x4a9a89=_0x485878[_0x4eb2a6(0xad)]?.[_0x4eb2a6(0xb9)]()||undefined,_0x4b110e=_0x5c9486[_0x4eb2a6(0xa3)]||_0x4eb2a6(0x77),_0x329c70=await promptSiteSelection(_0x4b110e,_0x5f3fb9,_0x4eb2a6(0x95));if(!_0x329c70)return 0x1;const _0x38e2b3=resolveSite(_0x329c70),_0x2ef27c=await promptAuthMethod();if(!_0x2ef27c)return console[_0x4eb2a6(0xb8)]('\x0aSetup\x20cancelled'),0x1;if(_0x2ef27c===_0x4eb2a6(0xa7)){if(_0x4a9a89){const _0x5e29cb={'site':_0x38e2b3,'description':_0x4a9a89};saveProfileToUserConfig(_0x5f3fb9,_0x5e29cb);}const {accountName:_0x48bfcb}=_0x5c9486;return await runOAuthLoginFlow(_0x38e2b3,_0x5f3fb9,_0x5c9486['logLevel']??LogLevel[_0x4eb2a6(0x7e)],{'accountName':_0x48bfcb}),0x0;}console[_0x4eb2a6(0xb8)](_0x4eb2a6(0x68)+_0x38e2b3),console['log'](_0x4eb2a6(0x9d)),console['log']('\x20\x20'+getConsoleUrl(_0x38e2b3,_0x4eb2a6(0x7d)));const _0x455b97=await a33_0x3b2d5b({'type':_0x4eb2a6(0xd7),'name':_0x4eb2a6(0x84),'message':_0x4eb2a6(0xc3),'validate':_0x350980=>{const _0x4aeb38=_0x4eb2a6;if(!_0x350980||!_0x350980[_0x4aeb38(0xb9)]())return _0x4aeb38(0x88);return!![];}});if(!_0x455b97[_0x4eb2a6(0x84)])return console[_0x4eb2a6(0xb8)](_0x4eb2a6(0xd9)),0x1;const _0x5417ba=_0x455b97[_0x4eb2a6(0x84)];console['log'](_0x4eb2a6(0x73));try{const _0x422ed5=TDX[_0x4eb2a6(0x6a)]({'site':_0x38e2b3,'apiKey':_0x5417ba['trim'](),'logLevel':_0x5c9486['logLevel']??LogLevel['ERROR']}),_0x2c29eb=await _0x422ed5[_0x4eb2a6(0xb4)]['getUserInfo']();console[_0x4eb2a6(0xb8)](a33_0x4c36d0[_0x4eb2a6(0x9b)]('✓')+_0x4eb2a6(0x82)+_0x2c29eb[_0x4eb2a6(0x80)]+')');const _0xfe643d=await isKeychainAvailable();_0xfe643d?(await saveAPIKeyAsync(_0x5417ba[_0x4eb2a6(0xb9)](),_0x38e2b3,_0x5f3fb9),console[_0x4eb2a6(0xb8)](a33_0x4c36d0['green']('✓')+_0x4eb2a6(0x6c)+_0x5f3fb9+')')):(console[_0x4eb2a6(0xa6)](a33_0x4c36d0[_0x4eb2a6(0xb7)]('⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.')),console[_0x4eb2a6(0xa6)](a33_0x4c36d0[_0x4eb2a6(0xb7)]('\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.')));const _0x5a47be={'site':_0x38e2b3,..._0x4a9a89&&{'description':_0x4a9a89}};return saveProfileToUserConfig(_0x5f3fb9,_0x5a47be),console['log'](a33_0x4c36d0['green']('✓')+_0x4eb2a6(0x6d)+_0x5f3fb9+_0x4eb2a6(0xdb)),console[_0x4eb2a6(0xb8)](),console[_0x4eb2a6(0xb8)](_0x4eb2a6(0xbc)),console['log'](_0x4eb2a6(0x99)+_0x5f3fb9+'\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication'),console[_0x4eb2a6(0xb8)]('\x20\x20tdx\x20--profile\x20'+_0x5f3fb9+_0x4eb2a6(0x78)),0x0;}catch(_0xcafe0d){if(_0xcafe0d instanceof HTTPClientError&&_0xcafe0d[_0x4eb2a6(0x98)]===0x191)return printAuthError(_0xcafe0d),0x1;return console[_0x4eb2a6(0xc8)](a33_0x4c36d0[_0x4eb2a6(0xbe)](_0x4eb2a6(0xc5)+(_0xcafe0d instanceof Error?_0xcafe0d[_0x4eb2a6(0xaf)]:String(_0xcafe0d)))),console['error'](_0x4eb2a6(0xd3)),0x1;}}}export class ProfileDeleteCommand extends BaseCommand{[a33_0x1bc630(0x9e)]=a33_0x1bc630(0x75);[a33_0x1bc630(0xad)]=a33_0x1bc630(0x6f);['validate'](_0x95f561){const _0x1f5682=a33_0x1bc630,{args:_0x92257f}=_0x95f561;if(_0x92257f[_0x1f5682(0xce)]===0x0)return _0x1f5682(0x97);return undefined;}async[a33_0x1bc630(0x96)](_0x2abba8){const _0x2e46e0=a33_0x1bc630,{args:_0x40913c}=_0x2abba8,_0x22d735=_0x40913c[0x0];console['log'](a33_0x4c36d0[_0x2e46e0(0x6e)](_0x2e46e0(0xcd)));if(!profileExists(_0x22d735)){console[_0x2e46e0(0xc8)](a33_0x4c36d0[_0x2e46e0(0xbe)](_0x2e46e0(0x7a)+_0x22d735+_0x2e46e0(0x8b))),console[_0x2e46e0(0xb8)](_0x2e46e0(0xcb));const _0xecfd5a=listProfiles();if(_0xecfd5a[_0x2e46e0(0xce)]===0x0)console[_0x2e46e0(0xb8)](_0x2e46e0(0xac));else for(const _0x35bec2 of _0xecfd5a){console[_0x2e46e0(0xb8)]('\x20\x20-\x20'+_0x35bec2[_0x2e46e0(0x9e)]);}return 0x1;}const _0x317c37=await a33_0x3b2d5b({'type':_0x2e46e0(0xa8),'name':'confirm','message':_0x2e46e0(0x94)+_0x22d735+'\x27?','initial':![]});if(!_0x317c37['confirm'])return console[_0x2e46e0(0xb8)](_0x2e46e0(0x79)),0x0;try{await deleteProfileAndCredentials(_0x22d735),console['log'](a33_0x4c36d0[_0x2e46e0(0x9b)]('✓')+_0x2e46e0(0x6d)+_0x22d735+_0x2e46e0(0x8e));}catch(_0x6903eb){return console[_0x2e46e0(0xc8)](a33_0x4c36d0[_0x2e46e0(0xbe)](_0x2e46e0(0xc6)+(_0x6903eb instanceof Error?_0x6903eb[_0x2e46e0(0xaf)]:String(_0x6903eb)))),0x1;}return 0x0;}}export class ProfileSetCommand extends BaseCommand{[a33_0x1bc630(0x9e)]=a33_0x1bc630(0x9c);[a33_0x1bc630(0xad)]=a33_0x1bc630(0xc7);static [a33_0x1bc630(0x87)]=[a33_0x1bc630(0xa3),a33_0x1bc630(0xc0),'parent_segment',a33_0x1bc630(0x93),a33_0x1bc630(0x86),'description'];[a33_0x1bc630(0xb6)](_0x430f6c){const _0x525f6a=a33_0x1bc630,{args:_0x2c5554,options:_0x114a3c}=_0x430f6c,_0x1db0d2=_0x114a3c[_0x525f6a(0xba)]||getActiveProfile();if(!_0x1db0d2)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(_0x2c5554['length']===0x0)return _0x525f6a(0xd1)+ProfileSetCommand[_0x525f6a(0x87)][_0x525f6a(0xb3)](',\x20');const _0x435152=_0x2c5554[0x0];if(!_0x435152[_0x525f6a(0x9a)]('='))return _0x525f6a(0xa4)+ProfileSetCommand[_0x525f6a(0x87)][_0x525f6a(0xb3)](',\x20');const [_0x731ba4]=_0x435152[_0x525f6a(0xb1)]('=',0x2);if(!ProfileSetCommand[_0x525f6a(0x87)][_0x525f6a(0x9a)](_0x731ba4))return'Unknown\x20key\x20\x27'+_0x731ba4+_0x525f6a(0xb5)+ProfileSetCommand[_0x525f6a(0x87)][_0x525f6a(0xb3)](',\x20');return undefined;}async[a33_0x1bc630(0x96)](_0x4ebb1a){const _0x46720b=a33_0x1bc630,{args:_0x322cd7,options:_0x36c4b2}=_0x4ebb1a,_0x41e404=_0x36c4b2[_0x46720b(0xba)]||getActiveProfile(),[_0x3ba449,..._0x5a7925]=_0x322cd7[0x0]['split']('='),_0x3b44bc=_0x5a7925[_0x46720b(0xb3)]('=');console['log'](a33_0x4c36d0[_0x46720b(0x6e)]('tdx:\x20profile\x20set'));if(!profileExists(_0x41e404)){const _0x42a5bb=await a33_0x3b2d5b({'type':_0x46720b(0xa8),'name':'create','message':_0x46720b(0x7a)+_0x41e404+_0x46720b(0xc1),'initial':!![]});if(!_0x42a5bb[_0x46720b(0x6a)])return console[_0x46720b(0xb8)](_0x46720b(0x70)),0x1;}const _0x8781c6=loadProfile(_0x41e404),_0x43679d=_0x8781c6?.[_0x46720b(0xae)]||{};if(_0x3ba449===_0x46720b(0xa3)){const _0x55c78d=resolveSite(_0x3b44bc);console['log'](_0x46720b(0xda)+_0x55c78d+_0x46720b(0x74)),console[_0x46720b(0xb8)](_0x46720b(0xdc)),console[_0x46720b(0xb8)]('\x20\x20'+getConsoleUrl(_0x55c78d,_0x46720b(0x7d)));const _0xede66=await a33_0x3b2d5b({'type':_0x46720b(0xd7),'name':_0x46720b(0x84),'message':'Enter\x20your\x20TD\x20API\x20key\x20for\x20the\x20new\x20site:','validate':_0x5c9265=>{const _0x1d4ce3=_0x46720b;if(!_0x5c9265||!_0x5c9265[_0x1d4ce3(0xb9)]())return _0x1d4ce3(0x88);return!![];}});if(!_0xede66['apiKey'])return console['log']('\x0aOperation\x20cancelled'),0x1;console['log'](_0x46720b(0x73));try{const _0x2dc2be=TDX['create']({'site':_0x55c78d,'apiKey':_0xede66[_0x46720b(0x84)][_0x46720b(0xb9)](),'logLevel':_0x36c4b2[_0x46720b(0x7f)]??LogLevel[_0x46720b(0x7e)]}),_0xbef1fc=await _0x2dc2be[_0x46720b(0xb4)][_0x46720b(0xc4)]();console[_0x46720b(0xb8)](a33_0x4c36d0[_0x46720b(0x9b)]('✓')+_0x46720b(0x82)+_0xbef1fc[_0x46720b(0x80)]+')');const _0x6cfd44=await isKeychainAvailable();_0x6cfd44?(await saveAPIKeyAsync(_0xede66['apiKey'][_0x46720b(0xb9)](),_0x55c78d,_0x41e404),console[_0x46720b(0xb8)](a33_0x4c36d0[_0x46720b(0x9b)]('✓')+_0x46720b(0x92))):console[_0x46720b(0xa6)](a33_0x4c36d0[_0x46720b(0xb7)](_0x46720b(0xc9))),_0x43679d['site']=_0x55c78d;}catch(_0x262af3){if(_0x262af3 instanceof HTTPClientError&&_0x262af3[_0x46720b(0x98)]===0x191)return printAuthError(_0x262af3),0x1;return console[_0x46720b(0xc8)](a33_0x4c36d0[_0x46720b(0xbe)]('✗\x20Validation\x20failed:\x20'+(_0x262af3 instanceof Error?_0x262af3['message']:String(_0x262af3)))),console[_0x46720b(0xc8)](_0x46720b(0x7b)),0x1;}}else _0x43679d[_0x3ba449]=_0x3b44bc||undefined;return saveProfileToUserConfig(_0x41e404,_0x43679d),console[_0x46720b(0xb8)](a33_0x4c36d0['green']('✓')+_0x46720b(0x6d)+_0x41e404+_0x46720b(0xd5)+_0x3ba449+'='+(_0x3b44bc||_0x46720b(0xd8))),0x0;}}export class ProfileUseCommand extends BaseCommand{[a33_0x1bc630(0x9e)]='profile:use';[a33_0x1bc630(0xad)]=a33_0x1bc630(0xb2);[a33_0x1bc630(0xb6)](_0xc9f395){const _0x21c83e=a33_0x1bc630,{args:_0x4d4c1e}=_0xc9f395;if(_0x4d4c1e[_0x21c83e(0xce)]===0x0)return _0x21c83e(0x76);return undefined;}async[a33_0x1bc630(0x96)](_0x37c73b){const _0x4ef4e5=a33_0x1bc630,{args:_0x5203ce,options:_0x1fb7ca}=_0x37c73b,_0x335fa9=_0x5203ce[0x0],_0x3794cc=_0x1fb7ca[_0x4ef4e5(0x72)];cleanExpiredSessions();if(!profileExists(_0x335fa9)){console['error'](a33_0x4c36d0[_0x4ef4e5(0xbe)]('Profile\x20\x27'+_0x335fa9+_0x4ef4e5(0x8b))),console[_0x4ef4e5(0xb8)](_0x4ef4e5(0xcb));const _0x4bf9cf=listProfiles();if(_0x4bf9cf['length']===0x0)console['log'](_0x4ef4e5(0xac));else for(const _0x6e303a of _0x4bf9cf){console[_0x4ef4e5(0xb8)](_0x4ef4e5(0x81)+_0x6e303a[_0x4ef4e5(0x9e)]);}return 0x1;}if(_0x3794cc){const _0x5baa86=a33_0x53994c[_0x4ef4e5(0xb3)](getConfigDir(),_0x4ef4e5(0xcc));return saveActiveProfileToUserConfig(_0x335fa9),console['log'](_0x4ef4e5(0xa9)+a33_0x4c36d0['green'](_0x335fa9)),console[_0x4ef4e5(0xb8)](a33_0x4c36d0[_0x4ef4e5(0x8a)](_0x4ef4e5(0xd0)+_0x5baa86)),0x0;}const _0x4ddfce=getSessionID(_0x1fb7ca[_0x4ef4e5(0x83)]);return saveSessionContext({'profile':_0x335fa9},_0x1fb7ca[_0x4ef4e5(0x83)]),console[_0x4ef4e5(0xb8)](_0x4ef4e5(0x71)+a33_0x4c36d0['green'](_0x335fa9)+'\x20'+a33_0x4c36d0[_0x4ef4e5(0x8a)]('(session:\x20'+_0x4ddfce+')')),console[_0x4ef4e5(0xb8)](a33_0x4c36d0[_0x4ef4e5(0x8a)](_0x4ef4e5(0x8f)+_0x335fa9+'\x20--default\x27\x20to\x20save\x20permanently')),0x0;}}
1
+ const a33_0x3aa092=a33_0x2d23;(function(_0x14dd6e,_0x19e96f){const _0x3c2890=a33_0x2d23,_0x5b313b=_0x14dd6e();while(!![]){try{const _0x228978=-parseInt(_0x3c2890(0x23b))/0x1+parseInt(_0x3c2890(0x236))/0x2*(-parseInt(_0x3c2890(0x1e4))/0x3)+parseInt(_0x3c2890(0x234))/0x4*(parseInt(_0x3c2890(0x220))/0x5)+-parseInt(_0x3c2890(0x231))/0x6+-parseInt(_0x3c2890(0x240))/0x7+-parseInt(_0x3c2890(0x229))/0x8*(-parseInt(_0x3c2890(0x1f3))/0x9)+parseInt(_0x3c2890(0x1e9))/0xa*(parseInt(_0x3c2890(0x225))/0xb);if(_0x228978===_0x19e96f)break;else _0x5b313b['push'](_0x5b313b['shift']());}catch(_0x1b1a4a){_0x5b313b['push'](_0x5b313b['shift']());}}}(a33_0x34d3,0x902e4));function a33_0x34d3(){const _0x59d623=['dim','bold','\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.','Enter\x20your\x20TD\x20API\x20key\x20for\x20the\x20new\x20site:','confirm','all','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>','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','Unknown\x20key\x20\x27','profile','\x27\x20requires\x20API\x20key\x20validation.','(cleared)','error','\x27\x20deleted','us01','green','tdx:\x20profile\x20create','Validating\x20API\x20key...','profile:create','log','Invalid\x20format.\x20Use:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','ERROR','site','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20delete\x20<name>','email','\x27\x20updated:\x20','\x0aYou\x20can\x20find\x20your\x20API\x20key\x20at:','split','getUserInfo','includes','420DCJbYd','description','\x20\x20-\x20','\x0aAvailable\x20profiles:','Changing\x20site\x20to\x20\x27','15323OgIrbo','profile:set','profile:delete','Enter\x20your\x20TD\x20API\x20key:','8767256CVYiaS','\x27\x20already\x20exists.\x20Use\x20\x27tdx\x20profile\x20delete\x20','trim','oauth','Set\x20session\x20profile','\x20API\x20key\x20is\x20valid\x20(User:\x20','\x0aTip:\x20Use\x20\x27tdx\x20profile\x20use\x20','length','1036698NlRMgt','\x20\x20tdx\x20--profile\x20','llm_project','24352rzCoNa','join','766918xEPjHs','status','yellow','\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases','red','338006JIjWfn','/app/mp/ak','Profile\x20\x27','validate','\x27\x20to\x20remove\x20it\x20first,\x20or\x20re-create\x20with\x20--force.','7911757eVxXZE','\x20API\x20key\x20saved\x20to\x20system\x20keychain\x20(profile:\x20','\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication','(session:\x20','\x27\x20created','\x27\x20does\x20not\x20exist.','text','session','Are\x20you\x20sure\x20you\x20want\x20to\x20remove\x20profile\x20\x27','You\x20can\x20now\x20use\x20tdx\x20commands\x20with\x20this\x20profile.\x20Try:','tdx.json','✗\x20Validation\x20failed:\x20','\x20--default\x27\x20to\x20save\x20permanently','create','message','Create\x20a\x20new\x20profile','execute','9fVrrfI','Site\x20was\x20not\x20changed.','Profile\x20name\x20must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore','apiKey','Session\x20profile\x20set\x20to:\x20','12740zmknTc','profile:use','logLevel','tdx:\x20profile\x20delete','parent_segment','VALID_KEYS','name','password','API\x20key\x20cannot\x20be\x20empty','\x0aSetup\x20cancelled','9LAJyKE','jobs','\x20\x20(no\x20profiles\x20found)','profileName','\x20Profile\x20\x27','config','\x0aOperation\x20cancelled','database','Default\x20profile\x20set\x20to:\x20','Removed\x20existing\x20profile\x20\x27','force','llm_agent','Key=value\x20pair\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','Delete\x20a\x20profile','warn'];a33_0x34d3=function(){return _0x59d623;};return a33_0x34d3();}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 a33_0x265413 from'node:path';import{saveSessionContext,getSessionID,cleanExpiredSessions}from'../core/session.js';import{saveAPIKeyAsync,resolveSite}from'../core/config.js';import{getConsoleUrl}from'../sdk/client/endpoints.js';import{deleteKeychainAPIKey,isKeychainAvailable}from'../core/keychain.js';import{deleteOAuthTokens}from'../core/oauth-keychain.js';import{runOAuthLoginFlow,promptAuthMethod}from'./auth-command.js';import{promptSiteSelection}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 a33_0x22fa34 from'prompts';function a33_0x2d23(_0x9d592c,_0x1aadfb){_0x9d592c=_0x9d592c-0x1da;const _0x34d339=a33_0x34d3();let _0x2d2327=_0x34d339[_0x9d592c];return _0x2d2327;}import a33_0x5ca82c from'chalk';function validateProfileName(_0xe2cf26,_0x5bb4e3){const _0x58fda3=a33_0x2d23;if(!_0xe2cf26||!_0xe2cf26['trim']())return'Profile\x20name\x20cannot\x20be\x20empty';const _0x351820=_0xe2cf26['trim']();if(!/^[a-zA-Z0-9_-]+$/['test'](_0x351820))return _0x58fda3(0x1e6);if(!_0x5bb4e3?.['skipExistsCheck']&&profileExists(_0x351820))return _0x58fda3(0x23d)+_0x351820+_0x58fda3(0x22a)+_0x351820+_0x58fda3(0x23f);return!![];}async function deleteProfileAndCredentials(_0x431271){const _0x318ab5=a33_0x2d23;removeProfileFromUserConfig(_0x431271);const _0x783c00=await isKeychainAvailable();_0x783c00&&await Promise[_0x318ab5(0x207)]([deleteKeychainAPIKey(_0x431271),deleteOAuthTokens(_0x431271)]);}export class ProfileCreateCommand extends BaseCommand{[a33_0x3aa092(0x1ef)]=a33_0x3aa092(0x214);[a33_0x3aa092(0x221)]=a33_0x3aa092(0x1e2);async[a33_0x3aa092(0x1e3)](_0x2531f4){const _0x235512=a33_0x3aa092,{options:_0x54da1e,args:_0xf194be}=_0x2531f4,_0x37444a=!!_0x54da1e[_0x235512(0x1fd)];console['log'](a33_0x5ca82c[_0x235512(0x203)](_0x235512(0x212)));let _0x588290;if(_0xf194be['length']>0x0&&_0xf194be[0x0]){const _0x525802=_0xf194be[0x0]['trim']();_0x37444a&&profileExists(_0x525802)&&(await deleteProfileAndCredentials(_0x525802),console['log'](_0x235512(0x1fc)+_0x525802+'\x27'));const _0x2a77ef=validateProfileName(_0x525802);if(_0x2a77ef!==!![])return console[_0x235512(0x20e)](a33_0x5ca82c[_0x235512(0x23a)](_0x2a77ef)),0x1;_0x588290=_0x525802;}else{const _0x31774d=await a33_0x22fa34({'type':_0x235512(0x246),'name':_0x235512(0x1f6),'message':'Enter\x20profile\x20name:','validate':_0x5861d5=>validateProfileName(_0x5861d5,{'skipExistsCheck':_0x37444a})});if(!_0x31774d['profileName'])return console['log'](_0x235512(0x1f2)),0x1;_0x588290=_0x31774d[_0x235512(0x1f6)]['trim'](),_0x37444a&&profileExists(_0x588290)&&(await deleteProfileAndCredentials(_0x588290),console[_0x235512(0x215)](_0x235512(0x1fc)+_0x588290+'\x27'));}const _0x5eb3d3=await a33_0x22fa34({'type':'text','name':'description','message':'Enter\x20description\x20(optional):'}),_0x32e16f=_0x5eb3d3[_0x235512(0x221)]?.['trim']()||undefined,_0x3c7efe=_0x54da1e[_0x235512(0x218)]||_0x235512(0x210),_0x340387=await promptSiteSelection(_0x3c7efe,_0x588290,'Setup\x20cancelled');if(!_0x340387)return 0x1;const _0x472fd5=resolveSite(_0x340387),_0x27e3bb=await promptAuthMethod();if(!_0x27e3bb)return console[_0x235512(0x215)](_0x235512(0x1f2)),0x1;if(_0x27e3bb===_0x235512(0x22c)){if(_0x32e16f){const _0x4b5844={'site':_0x472fd5,'description':_0x32e16f};saveProfileToUserConfig(_0x588290,_0x4b5844);}const {accountName:_0x54126c}=_0x54da1e;return await runOAuthLoginFlow(_0x472fd5,_0x588290,_0x54da1e[_0x235512(0x1eb)]??LogLevel[_0x235512(0x217)],{'accountName':_0x54126c}),0x0;}console[_0x235512(0x215)]('\x0aSetting\x20up\x20authentication\x20for\x20site:\x20'+_0x472fd5),console[_0x235512(0x215)]('You\x20can\x20find\x20your\x20API\x20key\x20at:'),console['log']('\x20\x20'+getConsoleUrl(_0x472fd5,_0x235512(0x23c)));const _0x442691=await a33_0x22fa34({'type':_0x235512(0x1f0),'name':_0x235512(0x1e7),'message':_0x235512(0x228),'validate':_0x266730=>{const _0x2d3b2b=_0x235512;if(!_0x266730||!_0x266730['trim']())return _0x2d3b2b(0x1f1);return!![];}});if(!_0x442691[_0x235512(0x1e7)])return console[_0x235512(0x215)](_0x235512(0x1f2)),0x1;const _0x4af3ee=_0x442691[_0x235512(0x1e7)];console[_0x235512(0x215)](_0x235512(0x213));try{const _0x239ddd=TDX[_0x235512(0x1e0)]({'site':_0x472fd5,'apiKey':_0x4af3ee[_0x235512(0x22b)](),'logLevel':_0x54da1e[_0x235512(0x1eb)]??LogLevel[_0x235512(0x217)]}),_0x2d145d=await _0x239ddd[_0x235512(0x1f4)]['getUserInfo']();console[_0x235512(0x215)](a33_0x5ca82c[_0x235512(0x211)]('✓')+_0x235512(0x22e)+_0x2d145d[_0x235512(0x21a)]+')');const _0x98cc3d=await isKeychainAvailable();_0x98cc3d?(await saveAPIKeyAsync(_0x4af3ee[_0x235512(0x22b)](),_0x472fd5,_0x588290),console[_0x235512(0x215)](a33_0x5ca82c[_0x235512(0x211)]('✓')+_0x235512(0x241)+_0x588290+')')):(console['warn'](a33_0x5ca82c[_0x235512(0x238)](_0x235512(0x209))),console['warn'](a33_0x5ca82c[_0x235512(0x238)](_0x235512(0x204))));const _0x561c16={'site':_0x472fd5,..._0x32e16f&&{'description':_0x32e16f}};return saveProfileToUserConfig(_0x588290,_0x561c16),console[_0x235512(0x215)](a33_0x5ca82c[_0x235512(0x211)]('✓')+_0x235512(0x1f7)+_0x588290+_0x235512(0x244)),console[_0x235512(0x215)](),console[_0x235512(0x215)](_0x235512(0x1dc)),console[_0x235512(0x215)](_0x235512(0x232)+_0x588290+_0x235512(0x242)),console[_0x235512(0x215)]('\x20\x20tdx\x20--profile\x20'+_0x588290+_0x235512(0x239)),0x0;}catch(_0x5e52a9){if(_0x5e52a9 instanceof HTTPClientError&&_0x5e52a9[_0x235512(0x237)]===0x191)return printAuthError(_0x5e52a9),0x1;return console[_0x235512(0x20e)](a33_0x5ca82c[_0x235512(0x23a)](_0x235512(0x1de)+(_0x5e52a9 instanceof Error?_0x5e52a9['message']:String(_0x5e52a9)))),console[_0x235512(0x20e)]('Profile\x20was\x20not\x20created.\x20Please\x20try\x20again.'),0x1;}}}export class ProfileDeleteCommand extends BaseCommand{[a33_0x3aa092(0x1ef)]=a33_0x3aa092(0x227);[a33_0x3aa092(0x221)]=a33_0x3aa092(0x200);[a33_0x3aa092(0x23e)](_0x3083d4){const _0x79b66d=a33_0x3aa092,{args:_0x32ab7a}=_0x3083d4;if(_0x32ab7a[_0x79b66d(0x230)]===0x0)return _0x79b66d(0x219);return undefined;}async['execute'](_0x1ce3f3){const _0x3ce9cb=a33_0x3aa092,{args:_0x27f095}=_0x1ce3f3,_0x20ba25=_0x27f095[0x0];console[_0x3ce9cb(0x215)](a33_0x5ca82c['bold'](_0x3ce9cb(0x1ec)));if(!profileExists(_0x20ba25)){console[_0x3ce9cb(0x20e)](a33_0x5ca82c[_0x3ce9cb(0x23a)](_0x3ce9cb(0x23d)+_0x20ba25+'\x27\x20does\x20not\x20exist.')),console[_0x3ce9cb(0x215)](_0x3ce9cb(0x223));const _0x4a1f36=listProfiles();if(_0x4a1f36[_0x3ce9cb(0x230)]===0x0)console[_0x3ce9cb(0x215)](_0x3ce9cb(0x1f5));else for(const _0x84d1d0 of _0x4a1f36){console[_0x3ce9cb(0x215)]('\x20\x20-\x20'+_0x84d1d0[_0x3ce9cb(0x1ef)]);}return 0x1;}const _0xdcb7c8=await a33_0x22fa34({'type':_0x3ce9cb(0x206),'name':_0x3ce9cb(0x206),'message':_0x3ce9cb(0x1db)+_0x20ba25+'\x27?','initial':![]});if(!_0xdcb7c8[_0x3ce9cb(0x206)])return console['log']('Removal\x20cancelled'),0x0;try{await deleteProfileAndCredentials(_0x20ba25),console['log'](a33_0x5ca82c[_0x3ce9cb(0x211)]('✓')+_0x3ce9cb(0x1f7)+_0x20ba25+_0x3ce9cb(0x20f));}catch(_0x52a38b){return console[_0x3ce9cb(0x20e)](a33_0x5ca82c[_0x3ce9cb(0x23a)]('Failed\x20to\x20delete\x20profile:\x20'+(_0x52a38b instanceof Error?_0x52a38b[_0x3ce9cb(0x1e1)]:String(_0x52a38b)))),0x1;}return 0x0;}}export class ProfileSetCommand extends BaseCommand{[a33_0x3aa092(0x1ef)]=a33_0x3aa092(0x226);[a33_0x3aa092(0x221)]='Set\x20a\x20profile\x20configuration\x20value';static ['VALID_KEYS']=[a33_0x3aa092(0x218),a33_0x3aa092(0x1fa),a33_0x3aa092(0x1ed),a33_0x3aa092(0x233),a33_0x3aa092(0x1fe),'description'];[a33_0x3aa092(0x23e)](_0x41e3e8){const _0x329d79=a33_0x3aa092,{args:_0x464297,options:_0x1364cc}=_0x41e3e8,_0x1656da=_0x1364cc[_0x329d79(0x20b)]||getActiveProfile();if(!_0x1656da)return _0x329d79(0x208);if(_0x464297[_0x329d79(0x230)]===0x0)return _0x329d79(0x1ff)+ProfileSetCommand[_0x329d79(0x1ee)][_0x329d79(0x235)](',\x20');const _0x254a20=_0x464297[0x0];if(!_0x254a20['includes']('='))return _0x329d79(0x216)+ProfileSetCommand['VALID_KEYS'][_0x329d79(0x235)](',\x20');const [_0x8e955d]=_0x254a20[_0x329d79(0x21d)]('=',0x2);if(!ProfileSetCommand[_0x329d79(0x1ee)][_0x329d79(0x21f)](_0x8e955d))return _0x329d79(0x20a)+_0x8e955d+'\x27.\x0a\x0aValid\x20keys:\x20'+ProfileSetCommand['VALID_KEYS'][_0x329d79(0x235)](',\x20');return undefined;}async[a33_0x3aa092(0x1e3)](_0x36d34b){const _0x23cdd5=a33_0x3aa092,{args:_0x243306,options:_0x123bd2}=_0x36d34b,_0x41d2df=_0x123bd2['profile']||getActiveProfile(),[_0x109d5f,..._0x43b657]=_0x243306[0x0][_0x23cdd5(0x21d)]('='),_0x59990b=_0x43b657[_0x23cdd5(0x235)]('=');console[_0x23cdd5(0x215)](a33_0x5ca82c[_0x23cdd5(0x203)]('tdx:\x20profile\x20set'));if(!profileExists(_0x41d2df)){const _0x575057=await a33_0x22fa34({'type':'confirm','name':_0x23cdd5(0x1e0),'message':_0x23cdd5(0x23d)+_0x41d2df+'\x27\x20does\x20not\x20exist.\x20Create\x20it?','initial':!![]});if(!_0x575057[_0x23cdd5(0x1e0)])return console['log']('Operation\x20cancelled'),0x1;}const _0x14027c=loadProfile(_0x41d2df),_0x4cb877=_0x14027c?.[_0x23cdd5(0x1f8)]||{};if(_0x109d5f===_0x23cdd5(0x218)){const _0x478e28=resolveSite(_0x59990b);console[_0x23cdd5(0x215)](_0x23cdd5(0x224)+_0x478e28+_0x23cdd5(0x20c)),console[_0x23cdd5(0x215)](_0x23cdd5(0x21c)),console[_0x23cdd5(0x215)]('\x20\x20'+getConsoleUrl(_0x478e28,'/app/mp/ak'));const _0x2e5a6b=await a33_0x22fa34({'type':'password','name':'apiKey','message':_0x23cdd5(0x205),'validate':_0xbee5e8=>{const _0xce34a8=_0x23cdd5;if(!_0xbee5e8||!_0xbee5e8[_0xce34a8(0x22b)]())return _0xce34a8(0x1f1);return!![];}});if(!_0x2e5a6b[_0x23cdd5(0x1e7)])return console[_0x23cdd5(0x215)](_0x23cdd5(0x1f9)),0x1;console['log']('Validating\x20API\x20key...');try{const _0x590e2f=TDX[_0x23cdd5(0x1e0)]({'site':_0x478e28,'apiKey':_0x2e5a6b[_0x23cdd5(0x1e7)]['trim'](),'logLevel':_0x123bd2['logLevel']??LogLevel['ERROR']}),_0x5ca761=await _0x590e2f['jobs'][_0x23cdd5(0x21e)]();console['log'](a33_0x5ca82c[_0x23cdd5(0x211)]('✓')+'\x20API\x20key\x20is\x20valid\x20(User:\x20'+_0x5ca761[_0x23cdd5(0x21a)]+')');const _0x5d25fd=await isKeychainAvailable();_0x5d25fd?(await saveAPIKeyAsync(_0x2e5a6b[_0x23cdd5(0x1e7)][_0x23cdd5(0x22b)](),_0x478e28,_0x41d2df),console['log'](a33_0x5ca82c[_0x23cdd5(0x211)]('✓')+'\x20API\x20key\x20saved\x20to\x20system\x20keychain')):console[_0x23cdd5(0x201)](a33_0x5ca82c[_0x23cdd5(0x238)](_0x23cdd5(0x209))),_0x4cb877[_0x23cdd5(0x218)]=_0x478e28;}catch(_0x3242fa){if(_0x3242fa instanceof HTTPClientError&&_0x3242fa[_0x23cdd5(0x237)]===0x191)return printAuthError(_0x3242fa),0x1;return console[_0x23cdd5(0x20e)](a33_0x5ca82c[_0x23cdd5(0x23a)](_0x23cdd5(0x1de)+(_0x3242fa instanceof Error?_0x3242fa[_0x23cdd5(0x1e1)]:String(_0x3242fa)))),console[_0x23cdd5(0x20e)](_0x23cdd5(0x1e5)),0x1;}}else _0x4cb877[_0x109d5f]=_0x59990b||undefined;return saveProfileToUserConfig(_0x41d2df,_0x4cb877),console['log'](a33_0x5ca82c[_0x23cdd5(0x211)]('✓')+_0x23cdd5(0x1f7)+_0x41d2df+_0x23cdd5(0x21b)+_0x109d5f+'='+(_0x59990b||_0x23cdd5(0x20d))),0x0;}}export class ProfileUseCommand extends BaseCommand{[a33_0x3aa092(0x1ef)]=a33_0x3aa092(0x1ea);['description']=a33_0x3aa092(0x22d);['validate'](_0x27a99e){const _0xe89501=a33_0x3aa092,{args:_0x24ba2d}=_0x27a99e;if(_0x24ba2d[_0xe89501(0x230)]===0x0)return'Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20use\x20<name>\x20[--default]';return undefined;}async[a33_0x3aa092(0x1e3)](_0x4081fd){const _0x3a9851=a33_0x3aa092,{args:_0x186a41,options:_0x3c70c0}=_0x4081fd,_0x318043=_0x186a41[0x0],_0x212170=_0x3c70c0['default'];cleanExpiredSessions();if(!profileExists(_0x318043)){console[_0x3a9851(0x20e)](a33_0x5ca82c['red'](_0x3a9851(0x23d)+_0x318043+_0x3a9851(0x245))),console['log'](_0x3a9851(0x223));const _0x3f26b8=listProfiles();if(_0x3f26b8['length']===0x0)console['log'](_0x3a9851(0x1f5));else for(const _0x2380b4 of _0x3f26b8){console[_0x3a9851(0x215)](_0x3a9851(0x222)+_0x2380b4[_0x3a9851(0x1ef)]);}return 0x1;}if(_0x212170){const _0x273629=a33_0x265413[_0x3a9851(0x235)](getConfigDir(),_0x3a9851(0x1dd));return saveActiveProfileToUserConfig(_0x318043),console[_0x3a9851(0x215)](_0x3a9851(0x1fb)+a33_0x5ca82c[_0x3a9851(0x211)](_0x318043)),console['log'](a33_0x5ca82c[_0x3a9851(0x202)]('\x0aSaved\x20to:\x20'+_0x273629)),0x0;}const _0x5f12d2=getSessionID(_0x3c70c0[_0x3a9851(0x1da)]);return saveSessionContext({'profile':_0x318043},_0x3c70c0[_0x3a9851(0x1da)]),console[_0x3a9851(0x215)](_0x3a9851(0x1e8)+a33_0x5ca82c[_0x3a9851(0x211)](_0x318043)+'\x20'+a33_0x5ca82c['dim'](_0x3a9851(0x243)+_0x5f12d2+')')),console['log'](a33_0x5ca82c[_0x3a9851(0x202)](_0x3a9851(0x22f)+_0x318043+_0x3a9851(0x1df))),0x0;}}
@@ -1 +1 @@
1
- const a34_0x347a22=a34_0x2afd;(function(_0x31941d,_0x87718c){const _0x5508cd=a34_0x2afd,_0x33fbf5=_0x31941d();while(!![]){try{const _0x50a450=parseInt(_0x5508cd(0x7d))/0x1+parseInt(_0x5508cd(0x92))/0x2*(parseInt(_0x5508cd(0x8b))/0x3)+-parseInt(_0x5508cd(0x81))/0x4+-parseInt(_0x5508cd(0x7e))/0x5+-parseInt(_0x5508cd(0x95))/0x6*(parseInt(_0x5508cd(0x94))/0x7)+parseInt(_0x5508cd(0x89))/0x8*(-parseInt(_0x5508cd(0x82))/0x9)+parseInt(_0x5508cd(0x90))/0xa;if(_0x50a450===_0x87718c)break;else _0x33fbf5['push'](_0x33fbf5['shift']());}catch(_0x1b900f){_0x33fbf5['push'](_0x33fbf5['shift']());}}}(a34_0x53e2,0xc4fa1));import{BaseCommand}from'./command.js';import{listProfiles,getActiveProfile,getProfileParams}from'../core/profile.js';function a34_0x53e2(){const _0x3c4ac7=['scope','753538SqMyiE','execute','1533Zclbrz','40548csgjiA','dim','👤\x20','description','42322JGYRkG','630695EkkhMd','\x20\x20Local:\x20\x20(project\x20folder)/tdx.json','List\x20all\x20available\x20profiles','3091356lnMlql','117WatRrE','Error:\x20','profiles','error','site','length','No\x20profiles\x20found.\x20Define\x20profiles\x20in\x20tdx.json:\x0a','871576ezwyYj','green','9plnuYs','config','log','message','name','34294790YugFBy'];a34_0x53e2=function(){return _0x3c4ac7;};return a34_0x53e2();}import{handleSDKOutput,isStructuredFormat}from'../core/command-output.js';import a34_0x38b3cd from'chalk';function a34_0x2afd(_0x365e0e,_0x17621c){_0x365e0e=_0x365e0e-0x7a;const _0x53e23b=a34_0x53e2();let _0x2afd2f=_0x53e23b[_0x365e0e];return _0x2afd2f;}export class ProfilesCommand extends BaseCommand{['name']=a34_0x347a22(0x84);['description']=a34_0x347a22(0x80);async[a34_0x347a22(0x93)](_0x220785){const _0x5da7c8=a34_0x347a22,{options:_0x1c2504}=_0x220785;try{const _0x12ccdb=listProfiles(),_0x31564f=getActiveProfile();if(_0x12ccdb[_0x5da7c8(0x87)]===0x0)return console[_0x5da7c8(0x8d)](_0x5da7c8(0x88)),console[_0x5da7c8(0x8d)](_0x5da7c8(0x7f)),console[_0x5da7c8(0x8d)]('\x20\x20Global:\x20~/.config/tdx/tdx.json'),0x0;const _0x56954f=_0x12ccdb['map'](_0x7721ac=>{const _0x4efd90=_0x5da7c8,_0x7a1644=_0x7721ac[_0x4efd90(0x8f)]===_0x31564f,_0x5b6fa1=getProfileParams(_0x7721ac[_0x4efd90(0x8c)]);return{'name':_0x7721ac[_0x4efd90(0x8f)],'active':_0x7a1644,'scope':_0x7721ac[_0x4efd90(0x91)],'description':_0x7721ac['config'][_0x4efd90(0x7c)]||'','params':_0x5b6fa1};});if(isStructuredFormat(_0x1c2504))await handleSDKOutput(_0x56954f,_0x1c2504);else for(const _0x393382 of _0x12ccdb){const _0xd4aa14=_0x393382[_0x5da7c8(0x8f)]===_0x31564f?a34_0x38b3cd[_0x5da7c8(0x8a)]('\x20✓'):'',_0x58d5c3=_0x393382['config'][_0x5da7c8(0x86)]?a34_0x38b3cd[_0x5da7c8(0x7a)]('\x20'+_0x393382[_0x5da7c8(0x8c)][_0x5da7c8(0x86)]):'',_0x5767ed=_0x393382['config']['description']?a34_0x38b3cd[_0x5da7c8(0x7a)]('\x20\x20'+_0x393382[_0x5da7c8(0x8c)]['description']):'';console[_0x5da7c8(0x8d)](_0x5da7c8(0x7b)+_0x393382['name']+_0xd4aa14+_0x58d5c3+_0x5767ed);}return 0x0;}catch(_0x4d3eb2){return _0x4d3eb2 instanceof Error&&console[_0x5da7c8(0x85)](_0x5da7c8(0x83)+_0x4d3eb2[_0x5da7c8(0x8e)]),0x1;}}}
1
+ const a34_0x3790ab=a34_0x4c5f;function a34_0x3efa(){const _0x4a1822=['length','5664596RDTCcY','190480AQbRvN','profiles','config','18525050lUPKXF','3gCxIiT','green','message','4533XgHxZz','dim','\x20\x20Global:\x20~/.config/tdx/tdx.json','Error:\x20','11224724YmodCG','log','8960760tqaKoR','2954815UpMGsd','scope','name','657XtSMlZ','map','668noTkHP','site','description','List\x20all\x20available\x20profiles','👤\x20','execute','error'];a34_0x3efa=function(){return _0x4a1822;};return a34_0x3efa();}(function(_0x1706ae,_0x29664c){const _0x21ebe1=a34_0x4c5f,_0x7c7810=_0x1706ae();while(!![]){try{const _0x57ee73=parseInt(_0x21ebe1(0x105))/0x1*(-parseInt(_0x21ebe1(0x111))/0x2)+parseInt(_0x21ebe1(0x102))/0x3*(-parseInt(_0x21ebe1(0x119))/0x4)+parseInt(_0x21ebe1(0x10c))/0x5+parseInt(_0x21ebe1(0x10b))/0x6+parseInt(_0x21ebe1(0x109))/0x7+parseInt(_0x21ebe1(0x11a))/0x8*(-parseInt(_0x21ebe1(0x10f))/0x9)+parseInt(_0x21ebe1(0x101))/0xa;if(_0x57ee73===_0x29664c)break;else _0x7c7810['push'](_0x7c7810['shift']());}catch(_0x5ac149){_0x7c7810['push'](_0x7c7810['shift']());}}}(a34_0x3efa,0xd4edf));import{BaseCommand}from'./command.js';import{listProfiles,getActiveProfile,getProfileParams}from'../core/profile.js';import{handleSDKOutput,isStructuredFormat}from'../core/command-output.js';function a34_0x4c5f(_0x2c6d72,_0xb91ba0){_0x2c6d72=_0x2c6d72-0x101;const _0x3efa6a=a34_0x3efa();let _0x4c5fba=_0x3efa6a[_0x2c6d72];return _0x4c5fba;}import a34_0x3946e7 from'chalk';export class ProfilesCommand extends BaseCommand{[a34_0x3790ab(0x10e)]=a34_0x3790ab(0x11b);[a34_0x3790ab(0x113)]=a34_0x3790ab(0x114);async[a34_0x3790ab(0x116)](_0x35ca20){const _0x1004ad=a34_0x3790ab,{options:_0x1f18c7}=_0x35ca20;try{const _0x423a6a=listProfiles(),_0x2adadc=getActiveProfile();if(_0x423a6a[_0x1004ad(0x118)]===0x0)return console[_0x1004ad(0x10a)]('No\x20profiles\x20found.\x20Define\x20profiles\x20in\x20tdx.json:\x0a'),console['log']('\x20\x20Local:\x20\x20(project\x20folder)/tdx.json'),console[_0x1004ad(0x10a)](_0x1004ad(0x107)),0x0;const _0x1a6564=_0x423a6a[_0x1004ad(0x110)](_0x18b8bb=>{const _0x28fef5=_0x1004ad,_0x534ad2=_0x18b8bb[_0x28fef5(0x10e)]===_0x2adadc,_0x5b17a9=getProfileParams(_0x18b8bb[_0x28fef5(0x11c)]);return{'name':_0x18b8bb[_0x28fef5(0x10e)],'active':_0x534ad2,'scope':_0x18b8bb[_0x28fef5(0x10d)],'description':_0x18b8bb[_0x28fef5(0x11c)]['description']||'','params':_0x5b17a9};});if(isStructuredFormat(_0x1f18c7))await handleSDKOutput(_0x1a6564,_0x1f18c7);else for(const _0x5ac969 of _0x423a6a){const _0xa3f4c=_0x5ac969[_0x1004ad(0x10e)]===_0x2adadc?a34_0x3946e7[_0x1004ad(0x103)]('\x20✓'):'',_0x1eb692=_0x5ac969[_0x1004ad(0x11c)]['site']?a34_0x3946e7['dim']('\x20'+_0x5ac969[_0x1004ad(0x11c)][_0x1004ad(0x112)]):'',_0x49b95e=_0x5ac969[_0x1004ad(0x11c)][_0x1004ad(0x113)]?a34_0x3946e7[_0x1004ad(0x106)]('\x20\x20'+_0x5ac969['config'][_0x1004ad(0x113)]):'';console['log'](_0x1004ad(0x115)+_0x5ac969[_0x1004ad(0x10e)]+_0xa3f4c+_0x1eb692+_0x49b95e);}return 0x0;}catch(_0xf2b1f9){return _0xf2b1f9 instanceof Error&&console[_0x1004ad(0x117)](_0x1004ad(0x108)+_0xf2b1f9[_0x1004ad(0x104)]),0x1;}}}
@@ -1 +1 @@
1
- function a35_0x4b49(_0x3587b9,_0x405151){_0x3587b9=_0x3587b9-0x1b0;const _0x5e2dfb=a35_0x5e2d();let _0x4b49e8=_0x5e2dfb[_0x3587b9];return _0x4b49e8;}function a35_0x5e2d(){const _0xeb388=['totalSplits','data','validate','\x20-\x20','jobId','739614pZkNhZ','completedSplits','1647UoNbSp','in\x20','information_schema','output','375040YGNBCb','elapsedTimeMillis','setPhase','execute','state','file','error','SQL:\x20','stats','args','\x20[Job\x20ID:\x20','Schema:\x20','originalMessage','60730wZlujh','processedRows','message','No\x20SQL\x20provided','Query\x20completed:\x20Processed\x20','\x0aAll\x20results\x20saved\x20to\x20','3119724vGNKWq','verbose','1JHaEvx','1042726siiZNb','setExtra','Run\x20Trino\x20queries\x20(streaming)','Cannot\x20specify\x20both\x20SQL\x20argument\x20and\x20--file\x20option','site','Statement\x20','2127900eccFIG','Site:\x20','database','918084qWpVYP','7wySyEx','setJobId','\x20rows\x20','options','join','push','catalog','query','length','Executing\x20query\x20[','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'];a35_0x5e2d=function(){return _0xeb388;};return a35_0x5e2d();}const a35_0x1b7f47=a35_0x4b49;(function(_0x13a775,_0x11eb18){const _0x436653=a35_0x4b49,_0x235656=_0x13a775();while(!![]){try{const _0x3398ae=-parseInt(_0x436653(0x1c2))/0x1*(-parseInt(_0x436653(0x1c3))/0x2)+-parseInt(_0x436653(0x1cc))/0x3+parseInt(_0x436653(0x1c0))/0x4+parseInt(_0x436653(0x1c9))/0x5+parseInt(_0x436653(0x1dd))/0x6*(parseInt(_0x436653(0x1cd))/0x7)+parseInt(_0x436653(0x1e3))/0x8+-parseInt(_0x436653(0x1df))/0x9*(parseInt(_0x436653(0x1ba))/0xa);if(_0x3398ae===_0x11eb18)break;else _0x235656['push'](_0x235656['shift']());}catch(_0x1f1c0a){_0x235656['push'](_0x235656['shift']());}}}(a35_0x5e2d,0x75194));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';import{handleQueryOutput,formatQueryOutput,resolveOutputOptions}from'../core/command-output.js';import{readSqlStatementsFromFile,readSqlStatementsFromStdin,splitSqlStatements,isSqlFilePath}from'../sdk/query/sql-parser.js';import{writeFileSync}from'fs';import{withProgressSpinner,formatElapsed}from'../utils/spinner.js';import{formatRows}from'../sdk/util/formatters.js';export class QueryCommand extends BaseCommand{['name']=a35_0x1b7f47(0x1d4);['description']=a35_0x1b7f47(0x1c5);async['execute'](_0x29f0c9){const _0x2c4a67=a35_0x1b7f47,{options:_0xd160c1,args:_0x2d901f,tdx:_0x1c6de1}=_0x29f0c9,_0x54391e={..._0xd160c1,'limitStructuredFormats':!![]},_0x40ff47=_0x2d901f[0x0],_0x5abbed=_0xd160c1[_0x2c4a67(0x1b2)];let _0x380540;try{if(_0x5abbed)_0x380540=readSqlStatementsFromFile(_0x5abbed);else{if(_0x40ff47==='-')_0x380540=await readSqlStatementsFromStdin();else{if(_0x40ff47&&isSqlFilePath(_0x40ff47))_0x380540=readSqlStatementsFromFile(_0x40ff47);else{if(_0x40ff47)_0x380540=splitSqlStatements(_0x40ff47);else throw new Error(_0x2c4a67(0x1bd));}}}}catch(_0x18eac3){return console[_0x2c4a67(0x1b3)]('Error:\x20'+_0x18eac3[_0x2c4a67(0x1bc)]),0x1;}const _0x2ca935=_0xd160c1[_0x2c4a67(0x1cb)]||_0x2c4a67(0x1e1),_0x50f08d=_0xd160c1[_0x2c4a67(0x1d3)];try{const _0xc374a6=[],_0x360647=!!_0xd160c1[_0x2c4a67(0x1e2)];for(let _0x47af98=0x0;_0x47af98<_0x380540[_0x2c4a67(0x1d5)];_0x47af98++){const _0x46af62=_0x380540[_0x47af98],_0x412f82=_0x47af98+0x1,_0x34db28=_0x380540[_0x2c4a67(0x1d5)],_0x32d819=_0x34db28>0x1;_0xd160c1[_0x2c4a67(0x1c1)]&&(console[_0x2c4a67(0x1b3)]('\x0a'+(_0x32d819?_0x2c4a67(0x1c8)+_0x412f82+'/'+_0x34db28+':':'')),console[_0x2c4a67(0x1b3)](_0x2c4a67(0x1ca)+_0xd160c1[_0x2c4a67(0x1c7)]),console[_0x2c4a67(0x1b3)]('Catalog:\x20'+(_0x50f08d||'td')),console[_0x2c4a67(0x1b3)](_0x2c4a67(0x1b8)+_0x2ca935),console['error'](_0x2c4a67(0x1b4)+_0x46af62));const _0x4c84e6=_0x32d819?'Executing\x20statement\x20'+_0x412f82+'/'+_0x34db28+'...':'Executing\x20query...';try{const _0x10ba41=await withProgressSpinner(_0x4c84e6,async _0x22b480=>{const _0x1b49c1=_0x2c4a67,_0x2db52d=await _0x1c6de1[_0x1b49c1(0x1d4)][_0x1b49c1(0x1b0)](_0x46af62,{'catalog':_0x50f08d,'schema':_0x2ca935,'onJobId':_0xd9a660=>{const _0x35f22a=_0x1b49c1;_0x22b480[_0x35f22a(0x1ce)](_0xd9a660);},'onProgress':_0x21690a=>{const _0x3f0430=_0x1b49c1;_0x22b480[_0x3f0430(0x1e5)](_0x3f0430(0x1d6)+_0x21690a[_0x3f0430(0x1b1)]+']'),_0x22b480[_0x3f0430(0x1c4)](formatRows(_0x21690a[_0x3f0430(0x1bb)])+'\x20rows\x20'+_0x21690a[_0x3f0430(0x1de)]+'/'+_0x21690a[_0x3f0430(0x1d8)]+'\x20splits');}});return _0x2db52d;},{'verbose':_0xd160c1[_0x2c4a67(0x1c1)]}),_0x4c605d=_0x10ba41[_0x2c4a67(0x1d9)],_0x4a63e3=_0x4c605d['jobId']?_0x2c4a67(0x1b7)+_0x4c605d[_0x2c4a67(0x1dc)]+']':'',_0x53e749=_0x32d819?'Statement\x20'+_0x412f82+'/'+_0x34db28+_0x2c4a67(0x1db):'';console['error']('✔\x20'+_0x53e749+_0x2c4a67(0x1be)+formatRows(_0x4c605d[_0x2c4a67(0x1b5)][_0x2c4a67(0x1bb)])+_0x2c4a67(0x1cf)+(_0x2c4a67(0x1e0)+formatElapsed(_0x4c605d[_0x2c4a67(0x1b5)][_0x2c4a67(0x1e4)])+_0x4a63e3));if(_0x32d819&&_0x360647){const _0x76e957=resolveOutputOptions(_0x54391e),_0x2310fb=await formatQueryOutput(_0x4c605d,_0x76e957);_0xc374a6[_0x2c4a67(0x1d2)](_0x2310fb);}else await handleQueryOutput(_0x4c605d,_0x54391e);}catch(_0x11e3ca){const _0x4036c5=_0x32d819?'Statement\x20'+_0x412f82+'/'+_0x34db28+':\x0a':'',_0x144264=_0x11e3ca instanceof SDKError?_0x11e3ca[_0x2c4a67(0x1b9)]:_0x11e3ca['message'];return console[_0x2c4a67(0x1b3)](''+_0x4036c5+_0x144264),0x1;}}if(_0x380540[_0x2c4a67(0x1d5)]>0x1&&_0x360647&&_0xc374a6['length']>0x0){const _0x3e376e=_0xc374a6[_0x2c4a67(0x1d1)]('\x0a');writeFileSync(_0xd160c1[_0x2c4a67(0x1e2)],_0x3e376e),console['error'](_0x2c4a67(0x1bf)+_0xd160c1[_0x2c4a67(0x1e2)]);}return 0x0;}catch(_0x1a3c15){throw _0x1a3c15;}}[a35_0x1b7f47(0x1da)](_0x33a985){const _0x5a57ef=a35_0x1b7f47,_0xcd496b=_0x33a985[_0x5a57ef(0x1b6)][0x0],_0x5aa0b6=_0x33a985[_0x5a57ef(0x1d0)]['file'];if(!_0xcd496b&&!_0x5aa0b6)return _0x5a57ef(0x1d7);if(_0xcd496b&&_0x5aa0b6)return _0x5a57ef(0x1c6);return undefined;}}
1
+ const a35_0x7a892=a35_0x238d;(function(_0x121d66,_0x56de49){const _0x39c163=a35_0x238d,_0x3c6ec0=_0x121d66();while(!![]){try{const _0x161dab=-parseInt(_0x39c163(0x150))/0x1+-parseInt(_0x39c163(0x143))/0x2+-parseInt(_0x39c163(0x15b))/0x3*(-parseInt(_0x39c163(0x133))/0x4)+-parseInt(_0x39c163(0x137))/0x5*(parseInt(_0x39c163(0x134))/0x6)+-parseInt(_0x39c163(0x145))/0x7+parseInt(_0x39c163(0x13a))/0x8+-parseInt(_0x39c163(0x161))/0x9*(-parseInt(_0x39c163(0x14a))/0xa);if(_0x161dab===_0x56de49)break;else _0x3c6ec0['push'](_0x3c6ec0['shift']());}catch(_0x485c0e){_0x3c6ec0['push'](_0x3c6ec0['shift']());}}}(a35_0x258b,0xb9ec5));import{BaseCommand}from'./command.js';function a35_0x238d(_0x2753ed,_0x5df5ed){_0x2753ed=_0x2753ed-0x12e;const _0x258b8b=a35_0x258b();let _0x238d82=_0x258b8b[_0x2753ed];return _0x238d82;}import{SDKError}from'../sdk/index.js';function a35_0x258b(){const _0x46ca05=['\x20rows\x20','query','188JRZQzx','998610yEimQf','in\x20','setJobId','15bEvfyC','originalMessage','elapsedTimeMillis','8389464uCUJjk','catalog','execute','Error:\x20','verbose','stats','validate','...','Query\x20completed:\x20Processed\x20','1598224AArAiE','\x0aAll\x20results\x20saved\x20to\x20','1754235wpDvrA','error','file','args','length','220890pchRMP','completedSplits','push','jobId','Executing\x20query...','Statement\x20','559174cnzaBB','setExtra','processedRows','name','options','Executing\x20query\x20[','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','SQL:\x20','message','database','output','38691tCaxid','Schema:\x20','Executing\x20statement\x20','\x20[Job\x20ID:\x20','site','Cannot\x20specify\x20both\x20SQL\x20argument\x20and\x20--file\x20option','495zdDWhx','data','Site:\x20','state'];a35_0x258b=function(){return _0x46ca05;};return a35_0x258b();}import{handleQueryOutput,formatQueryOutput,resolveOutputOptions}from'../core/command-output.js';import{readSqlStatementsFromFile,readSqlStatementsFromStdin,splitSqlStatements,isSqlFilePath}from'../sdk/query/sql-parser.js';import{writeFileSync}from'fs';import{withProgressSpinner,formatElapsed}from'../utils/spinner.js';import{formatRows}from'../sdk/util/formatters.js';export class QueryCommand extends BaseCommand{[a35_0x7a892(0x153)]=a35_0x7a892(0x132);['description']='Run\x20Trino\x20queries\x20(streaming)';async[a35_0x7a892(0x13c)](_0x3c2ffe){const _0x18c63b=a35_0x7a892,{options:_0x16829f,args:_0x575518,tdx:_0x1b868a}=_0x3c2ffe,_0x35e86c={..._0x16829f,'limitStructuredFormats':!![]},_0x2e9c58=_0x575518[0x0],_0x2ccfc2=_0x16829f[_0x18c63b(0x147)];let _0x4f83d2;try{if(_0x2ccfc2)_0x4f83d2=readSqlStatementsFromFile(_0x2ccfc2);else{if(_0x2e9c58==='-')_0x4f83d2=await readSqlStatementsFromStdin();else{if(_0x2e9c58&&isSqlFilePath(_0x2e9c58))_0x4f83d2=readSqlStatementsFromFile(_0x2e9c58);else{if(_0x2e9c58)_0x4f83d2=splitSqlStatements(_0x2e9c58);else throw new Error('No\x20SQL\x20provided');}}}}catch(_0x163cbb){return console[_0x18c63b(0x146)](_0x18c63b(0x13d)+_0x163cbb[_0x18c63b(0x158)]),0x1;}const _0x345532=_0x16829f[_0x18c63b(0x159)]||'information_schema',_0x641578=_0x16829f[_0x18c63b(0x13b)];try{const _0x41130c=[],_0x49ee34=!!_0x16829f['output'];for(let _0x44bc3c=0x0;_0x44bc3c<_0x4f83d2[_0x18c63b(0x149)];_0x44bc3c++){const _0x1fdaf2=_0x4f83d2[_0x44bc3c],_0x1af114=_0x44bc3c+0x1,_0x134c36=_0x4f83d2[_0x18c63b(0x149)],_0x436443=_0x134c36>0x1;_0x16829f[_0x18c63b(0x13e)]&&(console[_0x18c63b(0x146)]('\x0a'+(_0x436443?'Statement\x20'+_0x1af114+'/'+_0x134c36+':':'')),console[_0x18c63b(0x146)](_0x18c63b(0x12f)+_0x16829f[_0x18c63b(0x15f)]),console[_0x18c63b(0x146)]('Catalog:\x20'+(_0x641578||'td')),console[_0x18c63b(0x146)](_0x18c63b(0x15c)+_0x345532),console[_0x18c63b(0x146)](_0x18c63b(0x157)+_0x1fdaf2));const _0x1c1c1a=_0x436443?_0x18c63b(0x15d)+_0x1af114+'/'+_0x134c36+_0x18c63b(0x141):_0x18c63b(0x14e);try{const _0x2ce9ef=await withProgressSpinner(_0x1c1c1a,async _0x212345=>{const _0x5f0d7e=_0x18c63b,_0x5681b9=await _0x1b868a['query'][_0x5f0d7e(0x13c)](_0x1fdaf2,{'catalog':_0x641578,'schema':_0x345532,'onJobId':_0x42881e=>{const _0x702bc5=_0x5f0d7e;_0x212345[_0x702bc5(0x136)](_0x42881e);},'onProgress':_0xd8ceb2=>{const _0x507d0c=_0x5f0d7e;_0x212345['setPhase'](_0x507d0c(0x155)+_0xd8ceb2[_0x507d0c(0x130)]+']'),_0x212345[_0x507d0c(0x151)](formatRows(_0xd8ceb2['processedRows'])+_0x507d0c(0x131)+_0xd8ceb2[_0x507d0c(0x14b)]+'/'+_0xd8ceb2['totalSplits']+'\x20splits');}});return _0x5681b9;},{'verbose':_0x16829f[_0x18c63b(0x13e)]}),_0x123a49=_0x2ce9ef[_0x18c63b(0x12e)],_0x590c88=_0x123a49[_0x18c63b(0x14d)]?_0x18c63b(0x15e)+_0x123a49[_0x18c63b(0x14d)]+']':'',_0x48ea92=_0x436443?_0x18c63b(0x14f)+_0x1af114+'/'+_0x134c36+'\x20-\x20':'';console[_0x18c63b(0x146)]('✔\x20'+_0x48ea92+_0x18c63b(0x142)+formatRows(_0x123a49[_0x18c63b(0x13f)][_0x18c63b(0x152)])+_0x18c63b(0x131)+(_0x18c63b(0x135)+formatElapsed(_0x123a49['stats'][_0x18c63b(0x139)])+_0x590c88));if(_0x436443&&_0x49ee34){const _0x4e828a=resolveOutputOptions(_0x35e86c),_0x2464d6=await formatQueryOutput(_0x123a49,_0x4e828a);_0x41130c[_0x18c63b(0x14c)](_0x2464d6);}else await handleQueryOutput(_0x123a49,_0x35e86c);}catch(_0x55b808){const _0xba3d3b=_0x436443?'Statement\x20'+_0x1af114+'/'+_0x134c36+':\x0a':'',_0x35398e=_0x55b808 instanceof SDKError?_0x55b808[_0x18c63b(0x138)]:_0x55b808['message'];return console['error'](''+_0xba3d3b+_0x35398e),0x1;}}if(_0x4f83d2[_0x18c63b(0x149)]>0x1&&_0x49ee34&&_0x41130c[_0x18c63b(0x149)]>0x0){const _0x5d99eb=_0x41130c['join']('\x0a');writeFileSync(_0x16829f[_0x18c63b(0x15a)],_0x5d99eb),console[_0x18c63b(0x146)](_0x18c63b(0x144)+_0x16829f[_0x18c63b(0x15a)]);}return 0x0;}catch(_0x5c51b6){throw _0x5c51b6;}}[a35_0x7a892(0x140)](_0x4174a3){const _0x48fe06=a35_0x7a892,_0x27a24d=_0x4174a3[_0x48fe06(0x148)][0x0],_0x3f2214=_0x4174a3[_0x48fe06(0x154)][_0x48fe06(0x147)];if(!_0x27a24d&&!_0x3f2214)return _0x48fe06(0x156);if(_0x27a24d&&_0x3f2214)return _0x48fe06(0x160);return undefined;}}
@@ -1 +1 @@
1
- const a36_0x32adf0=a36_0x43b7;(function(_0x189c67,_0x5c9000){const _0x2b23d8=a36_0x43b7,_0x43486b=_0x189c67();while(!![]){try{const _0x9509b=-parseInt(_0x2b23d8(0x149))/0x1+parseInt(_0x2b23d8(0x135))/0x2+parseInt(_0x2b23d8(0x143))/0x3+parseInt(_0x2b23d8(0x114))/0x4+-parseInt(_0x2b23d8(0x144))/0x5+-parseInt(_0x2b23d8(0x16b))/0x6*(parseInt(_0x2b23d8(0x142))/0x7)+parseInt(_0x2b23d8(0x139))/0x8*(parseInt(_0x2b23d8(0x10a))/0x9);if(_0x9509b===_0x5c9000)break;else _0x43486b['push'](_0x43486b['shift']());}catch(_0x286e4a){_0x43486b['push'](_0x43486b['shift']());}}}(a36_0x3ec2,0x4580f));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,handleSingleObjectOutput,writeOutput}from'../core/command-output.js';function a36_0x3ec2(){const _0x52e2d8=['entries','\x20schedules','delay','d\x20ago','getTime','verbose','Show\x20schedule\x20details','Searching\x20scheduled\x20queries\x20matching\x20\x22','queryUrl','file','schedule:create','listQueries','name','last_job','engineVersion','abs','substring','ended_at','red','\x20\x20Job\x20ID:\x20','length','INVALID_ARGUMENT','limit','execute','retry_limit','Creating\x20schedule...','description','list','format','404526qDPJWA','Creating\x20schedule:\x20','nextRun','tsv','schedule:show','keys','\x20\x20Type:\x20','\x20matching\x20\x22','Getting\x20schedule\x20history...','json','success','\x20(showing\x20','Found\x20','next_run_at','error','type','max','No\x20scheduled\x20queries\x20found','options','schedule:update','Database\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]','padEnd','\x20\x20Cron:\x20','h\x20ago','statusIcon','show','Listing\x20scheduled\x20queries...','trim','executing_user_id','Schedule\x20run\x20submitted:\x20','Running\x20schedule...','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20schedule\x20\x22','query','Updating\x20schedule...','(unnamed)','output','Getting\x20schedule\x20details...','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]','Delete\x20a\x20scheduled\x20query','Deleting\x20schedule...','utf-8','user_name','\x20execution','Showing\x20first\x20','Schedule\x20deleted:\x20','18yQwLDQ','job_id','in\x20','queries','soon','map','cron','\x20\x20→\x20','table','dim','904164ofZNyr','delete','Query\x20file\x20is\x20empty','history','/app/queries/editor?queryId=','log','round','schedule:list','has_next_page','timezone','result','engine_version','Update\x20a\x20scheduled\x20query','join','Create\x20a\x20scheduled\x20query','time_zone','end_at','green','pagination','from','update','args','jsonl','Cancelled','updated_at','created_at','status','start_at','create','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20update\x20<name>\x20[options]','validate','database','Updating\x20schedule:\x20','137646HdhBDF','schedules','count','\x20created','1656296URHvBb','repeat','📅\x20','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20show\x20<name>','num','data','priority','site','\x20(use\x20--limit\x20to\x20see\x20more)','49hVPJYI','1003602EFSdXk','519225MjPBlI','retryLimit','schedule:delete','\x20\x20Database:\x20','\x20scheduled\x20quer','182993JzFBJI','never','scheduled_at','\x20\x20Time:\x20','Run\x20a\x20scheduled\x20query\x20immediately'];a36_0x3ec2=function(){return _0x52e2d8;};return a36_0x3ec2();}import{withSpinner}from'../utils/spinner.js';import{confirm}from'../utils/prompt.js';import{readFileSync}from'fs';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import{getConsoleUrl}from'../sdk/client/endpoints.js';import{hyperlink}from'../sdk/util/formatters.js';import a36_0x134565 from'chalk';function formatRelativeTime(_0x4c0a47){const _0x1064ea=a36_0x43b7,_0x1a935d=new Date(_0x4c0a47),_0x11f380=new Date(),_0x4c300c=_0x1a935d['getTime']()-_0x11f380[_0x1064ea(0x152)](),_0x2497e3=Math[_0x1064ea(0x15d)](_0x4c300c)/0x3e8,_0x2757e6=_0x4c300c<0x0;if(_0x2497e3<0x3c)return _0x2757e6?'just\x20now':_0x1064ea(0x10e);else{if(_0x2497e3<0xe10){const _0xadc471=Math['round'](_0x2497e3/0x3c);return _0x2757e6?_0xadc471+'m\x20ago':_0x1064ea(0x10c)+_0xadc471+'m';}else{if(_0x2497e3<0x15180){const _0x2ebf6c=Math[_0x1064ea(0x11a)](_0x2497e3/0xe10);return _0x2757e6?_0x2ebf6c+_0x1064ea(0x182):_0x1064ea(0x10c)+_0x2ebf6c+'h';}else{if(_0x2497e3<0x93a80){const _0x9aa629=Math[_0x1064ea(0x11a)](_0x2497e3/0x15180);return _0x2757e6?_0x9aa629+_0x1064ea(0x151):_0x1064ea(0x10c)+_0x9aa629+'d';}else return _0x1a935d['toLocaleDateString']();}}}}export class ScheduleListCommand extends BaseCommand{['name']=a36_0x32adf0(0x11b);[a36_0x32adf0(0x168)]='List\x20scheduled\x20queries';async[a36_0x32adf0(0x165)](_0xf39ea5){const _0x599394=a36_0x32adf0,{options:_0x54134e,args:_0x26f085,tdx:_0x510b47}=_0xf39ea5,_0x2e5278=resolveLimit(_0x54134e[_0x599394(0x164)],DEFAULT_DISPLAY_LIMIT),_0x5b456b=_0x26f085[0x0],_0x550794=_0x5b456b?_0x599394(0x155)+_0x5b456b+'\x22...':_0x599394(0x185),_0x1432c3=await withSpinner(_0x550794,()=>_0x510b47['schedules'][_0x599394(0x159)]({'limit':_0x2e5278,'scheduled':!![],'pattern':_0x5b456b}),{'verbose':_0x54134e['verbose']}),_0xd26bb3=_0x1432c3['data'][_0x599394(0x10d)],_0x232e5d=_0x1432c3[_0x599394(0x13e)][_0x599394(0x126)][_0x599394(0x11c)],_0x4897ef=_0x5b456b?_0x599394(0x172)+_0x5b456b+'\x22':'';_0x232e5d?console[_0x599394(0x179)](_0x599394(0x196)+_0xd26bb3[_0x599394(0x162)]+_0x599394(0x14f)+_0x4897ef+_0x599394(0x141)):console['error'](_0x599394(0x177)+_0xd26bb3[_0x599394(0x162)]+_0x599394(0x148)+(_0xd26bb3[_0x599394(0x162)]!==0x1?'ies':'y')+_0x4897ef);if(_0x54134e[_0x599394(0x16a)]===_0x599394(0x174)||_0x54134e['format']===_0x599394(0x12a)||_0x54134e[_0x599394(0x16a)]===_0x599394(0x112)||_0x54134e['format']===_0x599394(0x16e)){const _0x4552d6=_0xd26bb3[_0x599394(0x10f)](_0xed2380=>({'id':_0xed2380['id'],'name':_0xed2380['name'],'cron':_0xed2380[_0x599394(0x110)],'database':_0xed2380[_0x599394(0x133)]?.['name'],'type':_0xed2380[_0x599394(0x17a)],'timezone':_0xed2380[_0x599394(0x123)],'user_name':_0xed2380['user']?.['name'],'updated_at':_0xed2380[_0x599394(0x12c)],'next_run_at':_0xed2380['next_run_at'],'last_job_status':_0xed2380[_0x599394(0x15b)]?.['status']}));await handleSDKOutput(_0x4552d6,_0x54134e);}else{if(_0xd26bb3[_0x599394(0x162)]===0x0)console[_0x599394(0x119)](_0x599394(0x17c));else{const _0x2b74c7=_0x54134e[_0x599394(0x140)],_0x1b5258=_0xd26bb3[_0x599394(0x10f)](_0x23e39b=>{const _0x4d53b9=_0x599394,_0xcea8f4=_0x23e39b['last_job']?.['status']?_0x23e39b[_0x4d53b9(0x15b)][_0x4d53b9(0x12e)]===_0x4d53b9(0x175)?'✓':'✗':'-',_0x535013=_0x23e39b[_0x4d53b9(0x15b)]?.[_0x4d53b9(0x15f)]?formatRelativeTime(_0x23e39b[_0x4d53b9(0x15b)][_0x4d53b9(0x15f)]):_0x4d53b9(0x14a),_0x186e55=_0x23e39b['next_run_at']?formatRelativeTime(_0x23e39b[_0x4d53b9(0x178)]):'-',_0x4b45a1=_0x23e39b[_0x4d53b9(0x110)]||'',_0x1036e2=_0x23e39b['name']||_0x4d53b9(0x18d),_0x17ada9=getConsoleUrl(_0x2b74c7,_0x4d53b9(0x118)+_0x23e39b['id']);return{'statusIcon':_0xcea8f4,'lastRun':_0x535013,'nextRun':_0x186e55,'cron':_0x4b45a1,'name':_0x1036e2,'queryUrl':_0x17ada9,'status':_0x23e39b['last_job']?.[_0x4d53b9(0x12e)]};}),_0x28125d=Math['max'](..._0x1b5258[_0x599394(0x10f)](_0x127e2f=>_0x127e2f['lastRun']['length'])),_0x3d3774=Math[_0x599394(0x17b)](..._0x1b5258[_0x599394(0x10f)](_0x15f1dc=>_0x15f1dc[_0x599394(0x16d)][_0x599394(0x162)])),_0x396286=Math['max'](..._0x1b5258[_0x599394(0x10f)](_0x2620a2=>_0x2620a2['cron'][_0x599394(0x162)])),_0x3f6dcf=_0x1b5258['map'](_0x52c56e=>{const _0x306f4b=_0x599394,_0x159e47=_0x52c56e[_0x306f4b(0x12e)]===_0x306f4b(0x175)?a36_0x134565[_0x306f4b(0x125)](_0x52c56e[_0x306f4b(0x183)]):_0x52c56e[_0x306f4b(0x12e)]===_0x306f4b(0x179)?a36_0x134565[_0x306f4b(0x160)](_0x52c56e[_0x306f4b(0x183)]):a36_0x134565[_0x306f4b(0x113)](_0x52c56e[_0x306f4b(0x183)]),_0x5d830f=_0x52c56e['lastRun'][_0x306f4b(0x180)](_0x28125d),_0x512a26=_0x52c56e[_0x306f4b(0x16d)]['padEnd'](_0x3d3774),_0x335591=_0x52c56e[_0x306f4b(0x110)]?a36_0x134565['cyan'](_0x52c56e[_0x306f4b(0x110)][_0x306f4b(0x180)](_0x396286)):'\x20'[_0x306f4b(0x13a)](_0x396286),_0x32381f=hyperlink(_0x52c56e[_0x306f4b(0x15a)],_0x52c56e[_0x306f4b(0x156)]);return _0x306f4b(0x13b)+_0x159e47+'\x20'+_0x5d830f+_0x306f4b(0x111)+_0x512a26+'\x20\x20'+_0x335591+'\x20\x20'+_0x32381f;});await writeOutput(_0x3f6dcf[_0x599394(0x121)]('\x0a'),_0x54134e[_0x599394(0x18e)],_0x599394(0x169));}}return 0x0;}}export class ScheduleShowCommand extends BaseCommand{[a36_0x32adf0(0x15a)]=a36_0x32adf0(0x16f);['description']=a36_0x32adf0(0x154);['validate'](_0x58d41e){const _0x59b827=a36_0x32adf0,_0xe160a4=_0x58d41e[_0x59b827(0x129)][0x0];if(!_0xe160a4)return _0x59b827(0x13c);return undefined;}async['execute'](_0x1b1daa){const _0x3c7bfb=a36_0x32adf0,{options:_0x63abda,args:_0x4f3a3f,tdx:_0x17e827}=_0x1b1daa,_0x2fd404=_0x4f3a3f[0x0],_0x2a8408=await withSpinner(_0x3c7bfb(0x18f),()=>_0x17e827[_0x3c7bfb(0x136)][_0x3c7bfb(0x184)](_0x2fd404),{'verbose':_0x63abda[_0x3c7bfb(0x153)]}),_0x12eac0=_0x2a8408['data'],_0x2c7dc9={'name':_0x12eac0[_0x3c7bfb(0x15a)],'cron':_0x12eac0[_0x3c7bfb(0x110)],'database':_0x12eac0[_0x3c7bfb(0x133)],'type':_0x12eac0[_0x3c7bfb(0x17a)],'timezone':_0x12eac0[_0x3c7bfb(0x11d)],'user_name':_0x12eac0[_0x3c7bfb(0x194)],'created_at':_0x12eac0[_0x3c7bfb(0x12d)],'engine_version':_0x12eac0[_0x3c7bfb(0x11f)],'executing_user_id':_0x12eac0[_0x3c7bfb(0x187)],'query':_0x12eac0['query'],'delay':_0x12eac0[_0x3c7bfb(0x150)],'priority':_0x12eac0[_0x3c7bfb(0x13f)],'retry_limit':_0x12eac0[_0x3c7bfb(0x166)],..._0x12eac0[_0x3c7bfb(0x11e)]&&{'result':_0x12eac0[_0x3c7bfb(0x11e)]}};return await handleSingleObjectOutput(_0x2c7dc9,_0x63abda),0x0;}}export class ScheduleCreateCommand extends BaseCommand{[a36_0x32adf0(0x15a)]=a36_0x32adf0(0x158);[a36_0x32adf0(0x168)]=a36_0x32adf0(0x122);[a36_0x32adf0(0x132)](_0x1c36df){const _0x34782e=a36_0x32adf0,_0x177156=_0x1c36df[_0x34782e(0x129)][0x0];if(!_0x177156)return _0x34782e(0x190);const _0x2d5242=_0x1c36df[_0x34782e(0x17d)];if(!_0x2d5242[_0x34782e(0x133)])return _0x34782e(0x17f);return undefined;}async['execute'](_0x32373b){const _0x4193bb=a36_0x32adf0,{options:_0x5c27ed,args:_0x378f72,tdx:_0x5c2d24}=_0x32373b,_0xed009c=_0x378f72[0x0],_0x1e6c92=_0x5c27ed,_0x9325ba=_0x1e6c92[_0x4193bb(0x133)],_0x431cb5=_0x1e6c92[_0x4193bb(0x157)],_0x4db273=_0x1e6c92[_0x4193bb(0x17a)]||'trino';let _0x4c9fdb;try{_0x4c9fdb=readFileSync(_0x431cb5,_0x4193bb(0x193))[_0x4193bb(0x186)]();}catch(_0x4b9662){throw new SDKError(ErrorCode[_0x4193bb(0x163)],'Failed\x20to\x20read\x20file:\x20'+_0x431cb5,_0x4b9662 instanceof Error?_0x4b9662:undefined);}if(!_0x4c9fdb)throw new SDKError(ErrorCode[_0x4193bb(0x163)],_0x4193bb(0x116));const _0x2a1d7b={'database':_0x9325ba,'query':_0x4c9fdb,'type':_0x4db273};if(_0x1e6c92[_0x4193bb(0x110)])_0x2a1d7b[_0x4193bb(0x110)]=_0x1e6c92[_0x4193bb(0x110)];if(_0x1e6c92['timezone'])_0x2a1d7b[_0x4193bb(0x11d)]=_0x1e6c92['timezone'];if(_0x1e6c92[_0x4193bb(0x150)]!==undefined)_0x2a1d7b['delay']=Number(_0x1e6c92[_0x4193bb(0x150)]);if(_0x1e6c92['priority']!==undefined)_0x2a1d7b[_0x4193bb(0x13f)]=Number(_0x1e6c92[_0x4193bb(0x13f)]);if(_0x1e6c92['retryLimit']!==undefined)_0x2a1d7b[_0x4193bb(0x166)]=Number(_0x1e6c92[_0x4193bb(0x145)]);if(_0x1e6c92['engineVersion'])_0x2a1d7b['engine_version']=_0x1e6c92[_0x4193bb(0x15c)];if(_0x1e6c92['result'])_0x2a1d7b['result']=_0x1e6c92[_0x4193bb(0x11e)];if(_0x5c27ed[_0x4193bb(0x153)]){console['error'](_0x4193bb(0x16c)+_0xed009c),console[_0x4193bb(0x179)](_0x4193bb(0x147)+_0x9325ba),console[_0x4193bb(0x179)](_0x4193bb(0x171)+_0x4db273);if(_0x2a1d7b['cron'])console[_0x4193bb(0x179)](_0x4193bb(0x181)+_0x2a1d7b['cron']);if(_0x2a1d7b['timezone'])console[_0x4193bb(0x179)]('\x20\x20Timezone:\x20'+_0x2a1d7b['timezone']);}const _0x684e5c=await withSpinner(_0x4193bb(0x167),()=>_0x5c2d24['schedules'][_0x4193bb(0x130)](_0xed009c,_0x2a1d7b),{'verbose':_0x5c27ed[_0x4193bb(0x153)]});return console['error']('Schedule\x20created:\x20'+_0x684e5c[_0x4193bb(0x13e)][_0x4193bb(0x15a)]),await handleSingleObjectOutput(_0x684e5c[_0x4193bb(0x13e)],_0x5c27ed),0x0;}}export class ScheduleUpdateCommand extends BaseCommand{[a36_0x32adf0(0x15a)]=a36_0x32adf0(0x17e);[a36_0x32adf0(0x168)]=a36_0x32adf0(0x120);['validate'](_0x3d35f1){const _0x16ccf7=a36_0x32adf0,_0x1a9ef4=_0x3d35f1[_0x16ccf7(0x129)][0x0];if(!_0x1a9ef4)return _0x16ccf7(0x131);return undefined;}async[a36_0x32adf0(0x165)](_0x40ab5d){const _0x50b483=a36_0x32adf0,{options:_0x577b27,args:_0x2bcbde,tdx:_0x3951f2}=_0x40ab5d,_0x1f9545=_0x2bcbde[0x0],_0x2ec507=_0x577b27,_0x356ff3={};if(_0x2ec507[_0x50b483(0x133)])_0x356ff3[_0x50b483(0x133)]=_0x2ec507['database'];if(_0x2ec507['type'])_0x356ff3[_0x50b483(0x17a)]=_0x2ec507[_0x50b483(0x17a)];if(_0x2ec507[_0x50b483(0x110)])_0x356ff3[_0x50b483(0x110)]=_0x2ec507['cron'];if(_0x2ec507[_0x50b483(0x11d)])_0x356ff3[_0x50b483(0x11d)]=_0x2ec507[_0x50b483(0x11d)];if(_0x2ec507[_0x50b483(0x150)]!==undefined)_0x356ff3[_0x50b483(0x150)]=Number(_0x2ec507[_0x50b483(0x150)]);if(_0x2ec507[_0x50b483(0x13f)]!==undefined)_0x356ff3[_0x50b483(0x13f)]=Number(_0x2ec507[_0x50b483(0x13f)]);if(_0x2ec507[_0x50b483(0x145)]!==undefined)_0x356ff3[_0x50b483(0x166)]=Number(_0x2ec507['retryLimit']);if(_0x2ec507[_0x50b483(0x15c)])_0x356ff3['engine_version']=_0x2ec507[_0x50b483(0x15c)];if(_0x2ec507[_0x50b483(0x11e)])_0x356ff3['result']=_0x2ec507[_0x50b483(0x11e)];if(_0x2ec507[_0x50b483(0x157)])try{_0x356ff3['query']=readFileSync(_0x2ec507[_0x50b483(0x157)],'utf-8')['trim']();}catch(_0x29b7b8){throw new SDKError(ErrorCode[_0x50b483(0x163)],'Failed\x20to\x20read\x20file:\x20'+_0x2ec507['file'],_0x29b7b8 instanceof Error?_0x29b7b8:undefined);}if(Object[_0x50b483(0x170)](_0x356ff3)[_0x50b483(0x162)]===0x0)throw new SDKError(ErrorCode[_0x50b483(0x163)],'At\x20least\x20one\x20option\x20must\x20be\x20provided\x20to\x20update');if(_0x577b27['verbose']){console['error'](_0x50b483(0x134)+_0x1f9545);for(const [_0x3193aa,_0x41f30f]of Object[_0x50b483(0x14e)](_0x356ff3)){_0x3193aa===_0x50b483(0x18b)?console[_0x50b483(0x179)]('\x20\x20'+_0x3193aa+':\x20'+_0x41f30f[_0x50b483(0x15e)](0x0,0x32)+'...'):console[_0x50b483(0x179)]('\x20\x20'+_0x3193aa+':\x20'+_0x41f30f);}}const _0x38fabc=await withSpinner(_0x50b483(0x18c),()=>_0x3951f2[_0x50b483(0x136)][_0x50b483(0x128)](_0x1f9545,_0x356ff3),{'verbose':_0x577b27[_0x50b483(0x153)]});return console['error']('Schedule\x20updated:\x20'+_0x38fabc['data'][_0x50b483(0x15a)]),await handleSingleObjectOutput(_0x38fabc[_0x50b483(0x13e)],_0x577b27),0x0;}}function a36_0x43b7(_0xba73be,_0x553949){_0xba73be=_0xba73be-0x10a;const _0x3ec2cc=a36_0x3ec2();let _0x43b722=_0x3ec2cc[_0xba73be];return _0x43b722;}export class ScheduleDeleteCommand extends BaseCommand{[a36_0x32adf0(0x15a)]=a36_0x32adf0(0x146);[a36_0x32adf0(0x168)]=a36_0x32adf0(0x191);[a36_0x32adf0(0x132)](_0x713d4c){const _0x4bace=a36_0x32adf0,_0xbe3e96=_0x713d4c[_0x4bace(0x129)][0x0];if(!_0xbe3e96)return'Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20delete\x20<name>';return undefined;}async['execute'](_0x2def39){const _0x29a622=a36_0x32adf0,{options:_0x5fdb93,args:_0x532ef3,tdx:_0x112288}=_0x2def39,_0xb0aa38=_0x532ef3[0x0];if(!_0x5fdb93['yes']){const _0x27b58b=await confirm(_0x29a622(0x18a)+_0xb0aa38+'\x22?');if(!_0x27b58b)return console[_0x29a622(0x179)](_0x29a622(0x12b)),0x0;}const _0x11245b=await withSpinner(_0x29a622(0x192),()=>_0x112288[_0x29a622(0x136)][_0x29a622(0x115)](_0xb0aa38),{'verbose':_0x5fdb93[_0x29a622(0x153)]});return console[_0x29a622(0x179)](_0x29a622(0x197)+_0x11245b['data']['name']),0x0;}}export class ScheduleRunCommand extends BaseCommand{[a36_0x32adf0(0x15a)]='schedule:run';[a36_0x32adf0(0x168)]=a36_0x32adf0(0x14d);['validate'](_0x451cd1){const _0x4abb4f=a36_0x32adf0,_0xd1976f=_0x451cd1[_0x4abb4f(0x129)][0x0];if(!_0xd1976f)return'Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20run\x20<name>\x20[--time\x20<iso8601>]\x20[--num\x20<1-10>]';return undefined;}async['execute'](_0x796fc8){const _0x2fae99=a36_0x32adf0,{options:_0x1fba4d,args:_0x4773bb,tdx:_0x391af7}=_0x796fc8,_0x246a82=_0x4773bb[0x0],_0x5892c8=_0x1fba4d,_0x5cd840=_0x5892c8['time'],_0x124ca6=_0x5892c8['num']!==undefined?Number(_0x5892c8[_0x2fae99(0x13d)]):undefined;if(_0x1fba4d[_0x2fae99(0x153)]){console[_0x2fae99(0x179)]('Running\x20schedule:\x20'+_0x246a82);if(_0x5cd840)console[_0x2fae99(0x179)](_0x2fae99(0x14c)+_0x5cd840);if(_0x124ca6)console['error']('\x20\x20Num:\x20'+_0x124ca6);}const _0x4b3f60=await withSpinner(_0x2fae99(0x189),()=>_0x391af7[_0x2fae99(0x136)]['run'](_0x246a82,{'time':_0x5cd840,'num':_0x124ca6}),{'verbose':_0x1fba4d['verbose']}),_0x1f167a=_0x4b3f60[_0x2fae99(0x13e)]['jobs'];console['error'](_0x2fae99(0x188)+_0x1f167a[_0x2fae99(0x162)]+'\x20job'+(_0x1f167a['length']!==0x1?'s':'')+_0x2fae99(0x138));for(const _0x2644a9 of _0x1f167a){console['error'](_0x2fae99(0x161)+_0x2644a9[_0x2fae99(0x10b)]);}return await handleSDKOutput(_0x1f167a,_0x1fba4d),0x0;}}export class ScheduleHistoryCommand extends BaseCommand{['name']='schedule:history';[a36_0x32adf0(0x168)]='Show\x20schedule\x20execution\x20history';[a36_0x32adf0(0x132)](_0x5f2319){const _0x1cf919=a36_0x32adf0,_0xe3de30=_0x5f2319[_0x1cf919(0x129)][0x0];if(!_0xe3de30)return'Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20history\x20<name>\x20[--from\x20<n>]\x20[--to\x20<n>]';return undefined;}async[a36_0x32adf0(0x165)](_0x215487){const _0x3675a1=a36_0x32adf0,{options:_0x158fbc,args:_0x2b7270,tdx:_0x1643a8}=_0x215487,_0x548d9b=_0x2b7270[0x0],_0x4f1959=_0x158fbc,_0xca32c0=_0x4f1959[_0x3675a1(0x127)]!==undefined?Number(_0x4f1959[_0x3675a1(0x127)]):undefined,_0x3c3124=_0x4f1959['to']!==undefined?Number(_0x4f1959['to']):undefined,_0x245dd9=await withSpinner(_0x3675a1(0x173),()=>_0x1643a8['schedules'][_0x3675a1(0x117)](_0x548d9b,{'from':_0xca32c0,'to':_0x3c3124}),{'verbose':_0x158fbc[_0x3675a1(0x153)]}),_0x19e807=_0x245dd9['data'];console[_0x3675a1(0x179)]('Found\x20'+_0x19e807[_0x3675a1(0x137)]+_0x3675a1(0x195)+(_0x19e807[_0x3675a1(0x137)]!==0x1?'s':'')+_0x3675a1(0x176)+_0x19e807[_0x3675a1(0x127)]+'-'+_0x19e807['to']+')');const _0x4f3b3b=_0x19e807['history']['map'](_0x1858e2=>({'job_id':_0x1858e2[_0x3675a1(0x10b)],'type':_0x1858e2[_0x3675a1(0x17a)],'status':_0x1858e2[_0x3675a1(0x12e)],'scheduled_at':_0x1858e2[_0x3675a1(0x14b)],'created_at':_0x1858e2[_0x3675a1(0x12d)],'start_at':_0x1858e2[_0x3675a1(0x12f)],'end_at':_0x1858e2[_0x3675a1(0x124)]}));return await handleSDKOutput(_0x4f3b3b,_0x158fbc),0x0;}}
1
+ const a36_0x4e0274=a36_0x5812;(function(_0x5edfe5,_0x385e8d){const _0x16dcfe=a36_0x5812,_0x17362c=_0x5edfe5();while(!![]){try{const _0x123727=parseInt(_0x16dcfe(0x154))/0x1*(-parseInt(_0x16dcfe(0x118))/0x2)+parseInt(_0x16dcfe(0x16c))/0x3+parseInt(_0x16dcfe(0x136))/0x4+-parseInt(_0x16dcfe(0xff))/0x5*(-parseInt(_0x16dcfe(0x17d))/0x6)+-parseInt(_0x16dcfe(0x163))/0x7+-parseInt(_0x16dcfe(0x15c))/0x8+parseInt(_0x16dcfe(0x135))/0x9;if(_0x123727===_0x385e8d)break;else _0x17362c['push'](_0x17362c['shift']());}catch(_0x36d4f7){_0x17362c['push'](_0x17362c['shift']());}}}(a36_0x1c0c,0x51fea));function a36_0x1c0c(){const _0x2ffd55=['red','tsv','trim','Create\x20a\x20scheduled\x20query','retryLimit','count','📅\x20','\x20\x20Job\x20ID:\x20','error','data','schedules','Schedule\x20updated:\x20','time_zone','table','queryUrl','name','ies','success','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20history\x20<name>\x20[--from\x20<n>]\x20[--to\x20<n>]','retry_limit','result','format','2VkMiBq','next_run_at','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]','num','Run\x20a\x20scheduled\x20query\x20immediately','update','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20show\x20<name>','Updating\x20schedule...','scheduled_at','engine_version','job_id','INVALID_ARGUMENT','end_at','execute','substring','in\x20','query','created_at','output','Found\x20','Getting\x20schedule\x20details...','never','user_name','Cancelled','soon','\x22...','verbose','jobs','priority','3986001ElAEXX','1644136WdbHFV','d\x20ago','description','executing_user_id','\x20\x20Num:\x20','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20run\x20<name>\x20[--time\x20<iso8601>]\x20[--num\x20<1-10>]','site','delay','trino','List\x20scheduled\x20queries','cyan','from','getTime','Creating\x20schedule:\x20','\x20created','Running\x20schedule:\x20','padEnd','limit','utf-8','jsonl','json','schedule:run','Deleting\x20schedule...','length','round','h\x20ago','timezone','\x20\x20Cron:\x20','Getting\x20schedule\x20history...','user','177819VdePBH','\x20\x20→\x20','args','Delete\x20a\x20scheduled\x20query','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20update\x20<name>\x20[options]','Schedule\x20deleted:\x20','Update\x20a\x20scheduled\x20query','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20schedule\x20\x22','2943784zUgJWZ','At\x20least\x20one\x20option\x20must\x20be\x20provided\x20to\x20update','map','schedule:history','\x20\x20Database:\x20','Database\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]','toLocaleDateString','4437090ZhSRpn','lastRun','list','schedule:delete','schedule:create','type','last_job','nextRun','dim','1783524RhQQIZ','engineVersion','file','listQueries','Listing\x20scheduled\x20queries...','just\x20now','schedule:list','create','cron','validate','show','ended_at','No\x20scheduled\x20queries\x20found','database','start_at','time','(unnamed)','42IDdAoa','has_next_page','run','Searching\x20scheduled\x20queries\x20matching\x20\x22','entries','Query\x20file\x20is\x20empty','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20delete\x20<name>','\x20matching\x20\x22','Creating\x20schedule...','updated_at','yes','statusIcon','history','Showing\x20first\x20','delete','47915flFEFm','status','\x20(showing\x20'];a36_0x1c0c=function(){return _0x2ffd55;};return a36_0x1c0c();}import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,handleSingleObjectOutput,writeOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import{confirm}from'../utils/prompt.js';import{readFileSync}from'fs';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import{getConsoleUrl}from'../sdk/client/endpoints.js';import{hyperlink}from'../sdk/util/formatters.js';import a36_0x457138 from'chalk';function formatRelativeTime(_0x5dd49a){const _0x21a6ba=a36_0x5812,_0xe4bde5=new Date(_0x5dd49a),_0x3faf6b=new Date(),_0x74defc=_0xe4bde5['getTime']()-_0x3faf6b[_0x21a6ba(0x142)](),_0xfedacf=Math['abs'](_0x74defc)/0x3e8,_0x53284d=_0x74defc<0x0;if(_0xfedacf<0x3c)return _0x53284d?_0x21a6ba(0x171):_0x21a6ba(0x130);else{if(_0xfedacf<0xe10){const _0x59d033=Math['round'](_0xfedacf/0x3c);return _0x53284d?_0x59d033+'m\x20ago':_0x21a6ba(0x127)+_0x59d033+'m';}else{if(_0xfedacf<0x15180){const _0x5b92a7=Math[_0x21a6ba(0x14e)](_0xfedacf/0xe10);return _0x53284d?_0x5b92a7+_0x21a6ba(0x14f):_0x21a6ba(0x127)+_0x5b92a7+'h';}else{if(_0xfedacf<0x93a80){const _0x4025f2=Math[_0x21a6ba(0x14e)](_0xfedacf/0x15180);return _0x53284d?_0x4025f2+_0x21a6ba(0x137):'in\x20'+_0x4025f2+'d';}else return _0xe4bde5[_0x21a6ba(0x162)]();}}}}export class ScheduleListCommand extends BaseCommand{['name']=a36_0x4e0274(0x172);['description']=a36_0x4e0274(0x13f);async['execute'](_0x2f27b9){const _0x385a26=a36_0x4e0274,{options:_0x2572db,args:_0x2589f2,tdx:_0x1541b4}=_0x2f27b9,_0x502a89=resolveLimit(_0x2572db[_0x385a26(0x147)],DEFAULT_DISPLAY_LIMIT),_0xc159aa=_0x2589f2[0x0],_0x2a20c8=_0xc159aa?_0x385a26(0x180)+_0xc159aa+_0x385a26(0x131):_0x385a26(0x170),_0x4f7c18=await withSpinner(_0x2a20c8,()=>_0x1541b4[_0x385a26(0x10c)][_0x385a26(0x16f)]({'limit':_0x502a89,'scheduled':!![],'pattern':_0xc159aa}),{'verbose':_0x2572db[_0x385a26(0x132)]}),_0x28a99c=_0x4f7c18[_0x385a26(0x10b)]['queries'],_0x9e071f=_0x4f7c18[_0x385a26(0x10b)]['pagination'][_0x385a26(0x17e)],_0x3f17d0=_0xc159aa?_0x385a26(0xf7)+_0xc159aa+'\x22':'';_0x9e071f?console[_0x385a26(0x10a)](_0x385a26(0xfd)+_0x28a99c[_0x385a26(0x14d)]+'\x20schedules'+_0x3f17d0+'\x20(use\x20--limit\x20to\x20see\x20more)'):console[_0x385a26(0x10a)](_0x385a26(0x12b)+_0x28a99c[_0x385a26(0x14d)]+'\x20scheduled\x20quer'+(_0x28a99c['length']!==0x1?_0x385a26(0x112):'y')+_0x3f17d0);if(_0x2572db[_0x385a26(0x117)]===_0x385a26(0x14a)||_0x2572db['format']===_0x385a26(0x149)||_0x2572db[_0x385a26(0x117)]===_0x385a26(0x10f)||_0x2572db[_0x385a26(0x117)]===_0x385a26(0x103)){const _0x5b8ebe=_0x28a99c[_0x385a26(0x15e)](_0x3f4f5c=>({'id':_0x3f4f5c['id'],'name':_0x3f4f5c[_0x385a26(0x111)],'cron':_0x3f4f5c[_0x385a26(0x174)],'database':_0x3f4f5c[_0x385a26(0x179)]?.[_0x385a26(0x111)],'type':_0x3f4f5c[_0x385a26(0x168)],'timezone':_0x3f4f5c[_0x385a26(0x10e)],'user_name':_0x3f4f5c[_0x385a26(0x153)]?.[_0x385a26(0x111)],'updated_at':_0x3f4f5c[_0x385a26(0xf9)],'next_run_at':_0x3f4f5c[_0x385a26(0x119)],'last_job_status':_0x3f4f5c[_0x385a26(0x169)]?.[_0x385a26(0x100)]}));await handleSDKOutput(_0x5b8ebe,_0x2572db);}else{if(_0x28a99c[_0x385a26(0x14d)]===0x0)console['log'](_0x385a26(0x178));else{const _0x337b1e=_0x2572db[_0x385a26(0x13c)],_0x1f8d40=_0x28a99c[_0x385a26(0x15e)](_0x4d7369=>{const _0x48a81c=_0x385a26,_0x2c8965=_0x4d7369[_0x48a81c(0x169)]?.[_0x48a81c(0x100)]?_0x4d7369['last_job'][_0x48a81c(0x100)]===_0x48a81c(0x113)?'✓':'✗':'-',_0x3090bb=_0x4d7369[_0x48a81c(0x169)]?.['ended_at']?formatRelativeTime(_0x4d7369[_0x48a81c(0x169)][_0x48a81c(0x177)]):_0x48a81c(0x12d),_0x537160=_0x4d7369[_0x48a81c(0x119)]?formatRelativeTime(_0x4d7369[_0x48a81c(0x119)]):'-',_0x5432df=_0x4d7369['cron']||'',_0x19db92=_0x4d7369[_0x48a81c(0x111)]||_0x48a81c(0x17c),_0x2df26c=getConsoleUrl(_0x337b1e,'/app/queries/editor?queryId='+_0x4d7369['id']);return{'statusIcon':_0x2c8965,'lastRun':_0x3090bb,'nextRun':_0x537160,'cron':_0x5432df,'name':_0x19db92,'queryUrl':_0x2df26c,'status':_0x4d7369['last_job']?.[_0x48a81c(0x100)]};}),_0x2119af=Math['max'](..._0x1f8d40[_0x385a26(0x15e)](_0x2187fe=>_0x2187fe[_0x385a26(0x164)][_0x385a26(0x14d)])),_0x461a10=Math['max'](..._0x1f8d40[_0x385a26(0x15e)](_0x20f30c=>_0x20f30c[_0x385a26(0x16a)][_0x385a26(0x14d)])),_0x151196=Math['max'](..._0x1f8d40['map'](_0x41500a=>_0x41500a[_0x385a26(0x174)][_0x385a26(0x14d)])),_0x162fe0=_0x1f8d40[_0x385a26(0x15e)](_0x2672c5=>{const _0x2e3a4f=_0x385a26,_0x3625a6=_0x2672c5['status']===_0x2e3a4f(0x113)?a36_0x457138['green'](_0x2672c5[_0x2e3a4f(0xfb)]):_0x2672c5[_0x2e3a4f(0x100)]===_0x2e3a4f(0x10a)?a36_0x457138[_0x2e3a4f(0x102)](_0x2672c5['statusIcon']):a36_0x457138[_0x2e3a4f(0x16b)](_0x2672c5[_0x2e3a4f(0xfb)]),_0x7f8ffb=_0x2672c5[_0x2e3a4f(0x164)][_0x2e3a4f(0x146)](_0x2119af),_0x4a1c31=_0x2672c5[_0x2e3a4f(0x16a)][_0x2e3a4f(0x146)](_0x461a10),_0x1b8232=_0x2672c5['cron']?a36_0x457138[_0x2e3a4f(0x140)](_0x2672c5[_0x2e3a4f(0x174)][_0x2e3a4f(0x146)](_0x151196)):'\x20'['repeat'](_0x151196),_0x2e0005=hyperlink(_0x2672c5['name'],_0x2672c5[_0x2e3a4f(0x110)]);return _0x2e3a4f(0x108)+_0x3625a6+'\x20'+_0x7f8ffb+_0x2e3a4f(0x155)+_0x4a1c31+'\x20\x20'+_0x1b8232+'\x20\x20'+_0x2e0005;});await writeOutput(_0x162fe0['join']('\x0a'),_0x2572db[_0x385a26(0x12a)],_0x385a26(0x165));}}return 0x0;}}export class ScheduleShowCommand extends BaseCommand{[a36_0x4e0274(0x111)]='schedule:show';[a36_0x4e0274(0x138)]='Show\x20schedule\x20details';[a36_0x4e0274(0x175)](_0x51cfcb){const _0x2e9047=a36_0x4e0274,_0x4111db=_0x51cfcb[_0x2e9047(0x156)][0x0];if(!_0x4111db)return _0x2e9047(0x11e);return undefined;}async[a36_0x4e0274(0x125)](_0x190409){const _0x53f82d=a36_0x4e0274,{options:_0x17c22b,args:_0x2a2e87,tdx:_0x57af52}=_0x190409,_0x5656ea=_0x2a2e87[0x0],_0x3b4065=await withSpinner(_0x53f82d(0x12c),()=>_0x57af52['schedules'][_0x53f82d(0x176)](_0x5656ea),{'verbose':_0x17c22b[_0x53f82d(0x132)]}),_0x3e180f=_0x3b4065[_0x53f82d(0x10b)],_0x52bab4={'name':_0x3e180f[_0x53f82d(0x111)],'cron':_0x3e180f[_0x53f82d(0x174)],'database':_0x3e180f[_0x53f82d(0x179)],'type':_0x3e180f[_0x53f82d(0x168)],'timezone':_0x3e180f[_0x53f82d(0x150)],'user_name':_0x3e180f[_0x53f82d(0x12e)],'created_at':_0x3e180f[_0x53f82d(0x129)],'engine_version':_0x3e180f['engine_version'],'executing_user_id':_0x3e180f[_0x53f82d(0x139)],'query':_0x3e180f[_0x53f82d(0x128)],'delay':_0x3e180f[_0x53f82d(0x13d)],'priority':_0x3e180f[_0x53f82d(0x134)],'retry_limit':_0x3e180f[_0x53f82d(0x115)],..._0x3e180f[_0x53f82d(0x116)]&&{'result':_0x3e180f[_0x53f82d(0x116)]}};return await handleSingleObjectOutput(_0x52bab4,_0x17c22b),0x0;}}export class ScheduleCreateCommand extends BaseCommand{['name']=a36_0x4e0274(0x167);[a36_0x4e0274(0x138)]=a36_0x4e0274(0x105);[a36_0x4e0274(0x175)](_0x2555f6){const _0x129cec=a36_0x4e0274,_0x211894=_0x2555f6[_0x129cec(0x156)][0x0];if(!_0x211894)return _0x129cec(0x11a);const _0x183288=_0x2555f6['options'];if(!_0x183288[_0x129cec(0x179)])return _0x129cec(0x161);return undefined;}async['execute'](_0x5c7ace){const _0x3a5210=a36_0x4e0274,{options:_0x5dee8a,args:_0x49a954,tdx:_0x1dcb83}=_0x5c7ace,_0x43dc61=_0x49a954[0x0],_0x287386=_0x5dee8a,_0x1352e0=_0x287386[_0x3a5210(0x179)],_0xc5d7f7=_0x287386[_0x3a5210(0x16e)],_0x2a23c5=_0x287386['type']||_0x3a5210(0x13e);let _0x325133;try{_0x325133=readFileSync(_0xc5d7f7,_0x3a5210(0x148))['trim']();}catch(_0x5554b6){throw new SDKError(ErrorCode['INVALID_ARGUMENT'],'Failed\x20to\x20read\x20file:\x20'+_0xc5d7f7,_0x5554b6 instanceof Error?_0x5554b6:undefined);}if(!_0x325133)throw new SDKError(ErrorCode[_0x3a5210(0x123)],_0x3a5210(0xf5));const _0x9eb88a={'database':_0x1352e0,'query':_0x325133,'type':_0x2a23c5};if(_0x287386[_0x3a5210(0x174)])_0x9eb88a[_0x3a5210(0x174)]=_0x287386[_0x3a5210(0x174)];if(_0x287386[_0x3a5210(0x150)])_0x9eb88a[_0x3a5210(0x150)]=_0x287386['timezone'];if(_0x287386[_0x3a5210(0x13d)]!==undefined)_0x9eb88a['delay']=Number(_0x287386[_0x3a5210(0x13d)]);if(_0x287386['priority']!==undefined)_0x9eb88a[_0x3a5210(0x134)]=Number(_0x287386[_0x3a5210(0x134)]);if(_0x287386[_0x3a5210(0x106)]!==undefined)_0x9eb88a[_0x3a5210(0x115)]=Number(_0x287386[_0x3a5210(0x106)]);if(_0x287386[_0x3a5210(0x16d)])_0x9eb88a['engine_version']=_0x287386['engineVersion'];if(_0x287386[_0x3a5210(0x116)])_0x9eb88a[_0x3a5210(0x116)]=_0x287386['result'];if(_0x5dee8a[_0x3a5210(0x132)]){console[_0x3a5210(0x10a)](_0x3a5210(0x143)+_0x43dc61),console[_0x3a5210(0x10a)](_0x3a5210(0x160)+_0x1352e0),console[_0x3a5210(0x10a)]('\x20\x20Type:\x20'+_0x2a23c5);if(_0x9eb88a[_0x3a5210(0x174)])console[_0x3a5210(0x10a)](_0x3a5210(0x151)+_0x9eb88a[_0x3a5210(0x174)]);if(_0x9eb88a[_0x3a5210(0x150)])console[_0x3a5210(0x10a)]('\x20\x20Timezone:\x20'+_0x9eb88a['timezone']);}const _0xba326d=await withSpinner(_0x3a5210(0xf8),()=>_0x1dcb83[_0x3a5210(0x10c)][_0x3a5210(0x173)](_0x43dc61,_0x9eb88a),{'verbose':_0x5dee8a[_0x3a5210(0x132)]});return console[_0x3a5210(0x10a)]('Schedule\x20created:\x20'+_0xba326d[_0x3a5210(0x10b)][_0x3a5210(0x111)]),await handleSingleObjectOutput(_0xba326d[_0x3a5210(0x10b)],_0x5dee8a),0x0;}}export class ScheduleUpdateCommand extends BaseCommand{[a36_0x4e0274(0x111)]='schedule:update';['description']=a36_0x4e0274(0x15a);[a36_0x4e0274(0x175)](_0x42a24d){const _0x3de5ec=a36_0x4e0274,_0x7b62e6=_0x42a24d[_0x3de5ec(0x156)][0x0];if(!_0x7b62e6)return _0x3de5ec(0x158);return undefined;}async['execute'](_0x59e2d7){const _0x414bce=a36_0x4e0274,{options:_0x56798c,args:_0x1904bd,tdx:_0x27fb30}=_0x59e2d7,_0x424c0c=_0x1904bd[0x0],_0x1ab12d=_0x56798c,_0x2ef0c5={};if(_0x1ab12d[_0x414bce(0x179)])_0x2ef0c5[_0x414bce(0x179)]=_0x1ab12d[_0x414bce(0x179)];if(_0x1ab12d[_0x414bce(0x168)])_0x2ef0c5['type']=_0x1ab12d[_0x414bce(0x168)];if(_0x1ab12d[_0x414bce(0x174)])_0x2ef0c5[_0x414bce(0x174)]=_0x1ab12d['cron'];if(_0x1ab12d[_0x414bce(0x150)])_0x2ef0c5['timezone']=_0x1ab12d[_0x414bce(0x150)];if(_0x1ab12d['delay']!==undefined)_0x2ef0c5[_0x414bce(0x13d)]=Number(_0x1ab12d[_0x414bce(0x13d)]);if(_0x1ab12d[_0x414bce(0x134)]!==undefined)_0x2ef0c5['priority']=Number(_0x1ab12d[_0x414bce(0x134)]);if(_0x1ab12d[_0x414bce(0x106)]!==undefined)_0x2ef0c5['retry_limit']=Number(_0x1ab12d[_0x414bce(0x106)]);if(_0x1ab12d[_0x414bce(0x16d)])_0x2ef0c5[_0x414bce(0x121)]=_0x1ab12d[_0x414bce(0x16d)];if(_0x1ab12d[_0x414bce(0x116)])_0x2ef0c5[_0x414bce(0x116)]=_0x1ab12d[_0x414bce(0x116)];if(_0x1ab12d[_0x414bce(0x16e)])try{_0x2ef0c5['query']=readFileSync(_0x1ab12d[_0x414bce(0x16e)],_0x414bce(0x148))[_0x414bce(0x104)]();}catch(_0x5f0afd){throw new SDKError(ErrorCode['INVALID_ARGUMENT'],'Failed\x20to\x20read\x20file:\x20'+_0x1ab12d[_0x414bce(0x16e)],_0x5f0afd instanceof Error?_0x5f0afd:undefined);}if(Object['keys'](_0x2ef0c5)[_0x414bce(0x14d)]===0x0)throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x414bce(0x15d));if(_0x56798c[_0x414bce(0x132)]){console[_0x414bce(0x10a)]('Updating\x20schedule:\x20'+_0x424c0c);for(const [_0x477384,_0x204b47]of Object[_0x414bce(0xf4)](_0x2ef0c5)){_0x477384==='query'?console[_0x414bce(0x10a)]('\x20\x20'+_0x477384+':\x20'+_0x204b47[_0x414bce(0x126)](0x0,0x32)+'...'):console['error']('\x20\x20'+_0x477384+':\x20'+_0x204b47);}}const _0xd0a1e4=await withSpinner(_0x414bce(0x11f),()=>_0x27fb30[_0x414bce(0x10c)][_0x414bce(0x11d)](_0x424c0c,_0x2ef0c5),{'verbose':_0x56798c[_0x414bce(0x132)]});return console[_0x414bce(0x10a)](_0x414bce(0x10d)+_0xd0a1e4[_0x414bce(0x10b)]['name']),await handleSingleObjectOutput(_0xd0a1e4[_0x414bce(0x10b)],_0x56798c),0x0;}}export class ScheduleDeleteCommand extends BaseCommand{[a36_0x4e0274(0x111)]=a36_0x4e0274(0x166);[a36_0x4e0274(0x138)]=a36_0x4e0274(0x157);[a36_0x4e0274(0x175)](_0x432f61){const _0xa8db59=a36_0x4e0274,_0x4f32c8=_0x432f61[_0xa8db59(0x156)][0x0];if(!_0x4f32c8)return _0xa8db59(0xf6);return undefined;}async[a36_0x4e0274(0x125)](_0x3d7275){const _0xd2f2e9=a36_0x4e0274,{options:_0x1fe72c,args:_0x3f83a7,tdx:_0x355432}=_0x3d7275,_0x1bfe39=_0x3f83a7[0x0];if(!_0x1fe72c[_0xd2f2e9(0xfa)]){const _0x30ce94=await confirm(_0xd2f2e9(0x15b)+_0x1bfe39+'\x22?');if(!_0x30ce94)return console[_0xd2f2e9(0x10a)](_0xd2f2e9(0x12f)),0x0;}const _0x18e1f8=await withSpinner(_0xd2f2e9(0x14c),()=>_0x355432[_0xd2f2e9(0x10c)][_0xd2f2e9(0xfe)](_0x1bfe39),{'verbose':_0x1fe72c['verbose']});return console[_0xd2f2e9(0x10a)](_0xd2f2e9(0x159)+_0x18e1f8[_0xd2f2e9(0x10b)][_0xd2f2e9(0x111)]),0x0;}}export class ScheduleRunCommand extends BaseCommand{[a36_0x4e0274(0x111)]=a36_0x4e0274(0x14b);[a36_0x4e0274(0x138)]=a36_0x4e0274(0x11c);[a36_0x4e0274(0x175)](_0x24f181){const _0x39b1cf=a36_0x4e0274,_0x4f90be=_0x24f181[_0x39b1cf(0x156)][0x0];if(!_0x4f90be)return _0x39b1cf(0x13b);return undefined;}async[a36_0x4e0274(0x125)](_0x4817f1){const _0xf9ce2b=a36_0x4e0274,{options:_0x5f0422,args:_0x4a8cfc,tdx:_0x183063}=_0x4817f1,_0x2f91cb=_0x4a8cfc[0x0],_0x3179bd=_0x5f0422,_0x10e541=_0x3179bd[_0xf9ce2b(0x17b)],_0xeebed4=_0x3179bd[_0xf9ce2b(0x11b)]!==undefined?Number(_0x3179bd[_0xf9ce2b(0x11b)]):undefined;if(_0x5f0422['verbose']){console[_0xf9ce2b(0x10a)](_0xf9ce2b(0x145)+_0x2f91cb);if(_0x10e541)console[_0xf9ce2b(0x10a)]('\x20\x20Time:\x20'+_0x10e541);if(_0xeebed4)console[_0xf9ce2b(0x10a)](_0xf9ce2b(0x13a)+_0xeebed4);}const _0x4c28e4=await withSpinner('Running\x20schedule...',()=>_0x183063[_0xf9ce2b(0x10c)][_0xf9ce2b(0x17f)](_0x2f91cb,{'time':_0x10e541,'num':_0xeebed4}),{'verbose':_0x5f0422['verbose']}),_0x4b553e=_0x4c28e4[_0xf9ce2b(0x10b)][_0xf9ce2b(0x133)];console[_0xf9ce2b(0x10a)]('Schedule\x20run\x20submitted:\x20'+_0x4b553e[_0xf9ce2b(0x14d)]+'\x20job'+(_0x4b553e['length']!==0x1?'s':'')+_0xf9ce2b(0x144));for(const _0x15a8b2 of _0x4b553e){console['error'](_0xf9ce2b(0x109)+_0x15a8b2[_0xf9ce2b(0x122)]);}return await handleSDKOutput(_0x4b553e,_0x5f0422),0x0;}}function a36_0x5812(_0x11f5a9,_0x53cb03){_0x11f5a9=_0x11f5a9-0xf4;const _0x1c0cd4=a36_0x1c0c();let _0x5812e7=_0x1c0cd4[_0x11f5a9];return _0x5812e7;}export class ScheduleHistoryCommand extends BaseCommand{['name']=a36_0x4e0274(0x15f);[a36_0x4e0274(0x138)]='Show\x20schedule\x20execution\x20history';[a36_0x4e0274(0x175)](_0x35a130){const _0x15d1b4=a36_0x4e0274,_0x2eaf17=_0x35a130['args'][0x0];if(!_0x2eaf17)return _0x15d1b4(0x114);return undefined;}async['execute'](_0xf02f4f){const _0x42ec47=a36_0x4e0274,{options:_0x22cd1c,args:_0x2f3169,tdx:_0x14f578}=_0xf02f4f,_0x3a32e0=_0x2f3169[0x0],_0x323af3=_0x22cd1c,_0x3d36ce=_0x323af3[_0x42ec47(0x141)]!==undefined?Number(_0x323af3[_0x42ec47(0x141)]):undefined,_0x4034bb=_0x323af3['to']!==undefined?Number(_0x323af3['to']):undefined,_0x3647b4=await withSpinner(_0x42ec47(0x152),()=>_0x14f578[_0x42ec47(0x10c)]['history'](_0x3a32e0,{'from':_0x3d36ce,'to':_0x4034bb}),{'verbose':_0x22cd1c[_0x42ec47(0x132)]}),_0x19f1aa=_0x3647b4[_0x42ec47(0x10b)];console[_0x42ec47(0x10a)](_0x42ec47(0x12b)+_0x19f1aa[_0x42ec47(0x107)]+'\x20execution'+(_0x19f1aa[_0x42ec47(0x107)]!==0x1?'s':'')+_0x42ec47(0x101)+_0x19f1aa['from']+'-'+_0x19f1aa['to']+')');const _0x29f1de=_0x19f1aa[_0x42ec47(0xfc)][_0x42ec47(0x15e)](_0x49a6f8=>({'job_id':_0x49a6f8[_0x42ec47(0x122)],'type':_0x49a6f8[_0x42ec47(0x168)],'status':_0x49a6f8[_0x42ec47(0x100)],'scheduled_at':_0x49a6f8[_0x42ec47(0x120)],'created_at':_0x49a6f8[_0x42ec47(0x129)],'start_at':_0x49a6f8[_0x42ec47(0x17a)],'end_at':_0x49a6f8[_0x42ec47(0x124)]}));return await handleSDKOutput(_0x29f1de,_0x22cd1c),0x0;}}
@@ -1 +1 @@
1
- const a37_0xfb19a1=a37_0x2221;(function(_0x5390b9,_0x16f7f8){const _0x104298=a37_0x2221,_0x440e9e=_0x5390b9();while(!![]){try{const _0x485c66=parseInt(_0x104298(0x1f1))/0x1+parseInt(_0x104298(0x1b0))/0x2+-parseInt(_0x104298(0x23c))/0x3+parseInt(_0x104298(0x219))/0x4*(-parseInt(_0x104298(0x1c1))/0x5)+parseInt(_0x104298(0x1b4))/0x6*(parseInt(_0x104298(0x1db))/0x7)+-parseInt(_0x104298(0x21a))/0x8*(parseInt(_0x104298(0x1e3))/0x9)+parseInt(_0x104298(0x1ad))/0xa;if(_0x485c66===_0x16f7f8)break;else _0x440e9e['push'](_0x440e9e['shift']());}catch(_0x39e7d6){_0x440e9e['push'](_0x440e9e['shift']());}}}(a37_0x243a,0x9b606));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,handleQueryOutput,handleSingleObjectOutput}from'../core/command-output.js';import{withSpinner,withProgressSpinner,formatElapsed}from'../utils/spinner.js';import{parseSegmentRef}from'../sdk/segment/segment-ref-parser.js';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import{executeSchemaQuery}from'../sdk/segment/fields-display.js';import{isYamlFilePath,resolveYamlFilePath}from'../sdk/segment/segment-path-parser.js';import{getConsoleNextUrl}from'../sdk/client/endpoints.js';import{openBrowser}from'../utils/process.js';import a37_0x57c980 from'chalk';async function resolveSegmentTarget(_0x7d6104,_0x2504e3,_0x12721d){const _0x5ce0c5=a37_0x2221;if(isYamlFilePath(_0x7d6104))try{const _0x263e71=await resolveYamlFilePath(_0x7d6104);return _0x12721d&&(console[_0x5ce0c5(0x22f)](_0x5ce0c5(0x20a)+_0x7d6104),console[_0x5ce0c5(0x22f)](_0x5ce0c5(0x218)+_0x263e71[_0x5ce0c5(0x1ae)]),console['error'](_0x5ce0c5(0x1e7)+_0x263e71[_0x5ce0c5(0x1fc)]),console['error'](_0x5ce0c5(0x245)+(_0x263e71[_0x5ce0c5(0x21b)]||_0x5ce0c5(0x1e9))),console[_0x5ce0c5(0x22f)](_0x5ce0c5(0x1cf)+_0x263e71[_0x5ce0c5(0x1dc)])),_0x263e71[_0x5ce0c5(0x1dc)];}catch(_0x571676){throw new SDKError(ErrorCode[_0x5ce0c5(0x1ef)],'Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20'+_0x571676[_0x5ce0c5(0x251)]);}if(!_0x2504e3)throw new SDKError(ErrorCode['INVALID_ARGUMENT'],'No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22');return _0x2504e3+'/'+_0x7d6104;}export class SegmentDescribeCommand extends BaseCommand{[a37_0xfb19a1(0x209)]='segment:describe';[a37_0xfb19a1(0x1b1)]='Show\x20segment\x20or\x20folder\x20details';async[a37_0xfb19a1(0x1bf)](_0x2de510){const _0x2a3c21=a37_0xfb19a1,{options:_0x2cb654,args:_0x1f0ec7,tdx:_0x41085d}=_0x2de510,_0xf27fe=_0x1f0ec7[0x0],_0x486cd2=!_0xf27fe&&!!_0x2cb654[_0x2a3c21(0x1ae)],_0x30132d=_0xf27fe||_0x2cb654[_0x2a3c21(0x1ae)];if(!_0x30132d)return console[_0x2a3c21(0x22f)](_0x2a3c21(0x242)),console[_0x2a3c21(0x22f)](_0x2a3c21(0x208)),console[_0x2a3c21(0x22f)](_0x2a3c21(0x1b5)),console[_0x2a3c21(0x22f)](_0x2a3c21(0x223)),console[_0x2a3c21(0x22f)](_0x2a3c21(0x1fb)),console[_0x2a3c21(0x22f)](_0x2a3c21(0x1e1)),console[_0x2a3c21(0x22f)]('\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>'),0x1;try{const _0x18f354=_0x2cb654['segmentPath'];let _0x300a04=_0x30132d;!_0x486cd2&&_0x18f354&&!_0x30132d['includes']('/')&&(_0x300a04=_0x18f354+'/'+_0x30132d,_0x2cb654[_0x2a3c21(0x1d5)]&&console[_0x2a3c21(0x22f)](_0x2a3c21(0x1ce)+_0x300a04));const _0x5e2951=await withSpinner(_0x2a3c21(0x1ed)+_0x300a04+_0x2a3c21(0x205),()=>_0x41085d['segment'][_0x2a3c21(0x24f)](_0x300a04),{'verbose':_0x2cb654[_0x2a3c21(0x1d5)]}),_0x69de25=_0x5e2951[_0x2a3c21(0x257)];_0x2cb654[_0x2a3c21(0x1d5)]&&(console[_0x2a3c21(0x22f)](_0x2a3c21(0x20e)+_0x69de25[_0x2a3c21(0x1af)]),console[_0x2a3c21(0x22f)]('Parent\x20ID:\x20'+_0x69de25[_0x2a3c21(0x1c8)]),_0x69de25[_0x2a3c21(0x201)]&&console[_0x2a3c21(0x22f)](_0x2a3c21(0x256)+_0x69de25[_0x2a3c21(0x201)]),_0x69de25[_0x2a3c21(0x253)]&&console[_0x2a3c21(0x22f)](_0x2a3c21(0x1c0)+_0x69de25['segmentId']));if(_0x69de25[_0x2a3c21(0x1af)]==='parent'){const _0x32f4ed=await withSpinner(_0x2a3c21(0x247),()=>_0x41085d[_0x2a3c21(0x227)][_0x2a3c21(0x225)](_0x69de25[_0x2a3c21(0x1c8)]),{'verbose':_0x2cb654[_0x2a3c21(0x1d5)]});await handleSingleObjectOutput(_0x32f4ed[_0x2a3c21(0x257)],_0x2cb654);}else{if(_0x69de25[_0x2a3c21(0x1af)]===_0x2a3c21(0x238)){if(!_0x69de25[_0x2a3c21(0x201)])throw new SDKError(ErrorCode['SEGMENT_FOLDER_NOT_FOUND'],_0x2a3c21(0x211));const _0x55257b=await withSpinner(_0x2a3c21(0x204),()=>_0x41085d[_0x2a3c21(0x227)][_0x2a3c21(0x254)](_0x69de25[_0x2a3c21(0x201)]),{'verbose':_0x2cb654['verbose']});await handleSingleObjectOutput(_0x55257b['data'],_0x2cb654);}else{if(_0x69de25[_0x2a3c21(0x1af)]===_0x2a3c21(0x227)){if(!_0x69de25[_0x2a3c21(0x253)])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x2a3c21(0x1d6));const _0x39ad57=await withSpinner(_0x2a3c21(0x1c2),()=>_0x41085d[_0x2a3c21(0x227)][_0x2a3c21(0x1bd)](_0x69de25[_0x2a3c21(0x1c8)],_0x69de25[_0x2a3c21(0x253)]),{'verbose':_0x2cb654[_0x2a3c21(0x1d5)]});await handleSingleObjectOutput(_0x39ad57['data'],_0x2cb654);}}}return 0x0;}catch(_0x509aaa){if(_0x509aaa instanceof SDKError)return console[_0x2a3c21(0x22f)](_0x2a3c21(0x1d7)+_0x509aaa['message']),_0x509aaa['cause']&&console['error'](_0x2a3c21(0x233)+_0x509aaa[_0x2a3c21(0x22e)]),0x1;throw _0x509aaa;}}}export class SegmentShowCommand extends BaseCommand{[a37_0xfb19a1(0x209)]='segment:show';[a37_0xfb19a1(0x1b1)]=a37_0xfb19a1(0x20b);async['execute'](_0x29aad7){const _0x3ddd9d=a37_0xfb19a1,{options:_0xe8204a,args:_0x3d40ee,tdx:_0x229b62}=_0x29aad7,_0xaf202a=_0x3d40ee[0x0];if(!_0xaf202a)return console[_0x3ddd9d(0x22f)](_0x3ddd9d(0x206)),console[_0x3ddd9d(0x22f)]('Usage:\x20tdx\x20sg\x20show\x20<name>'),console['error'](_0x3ddd9d(0x224)),console[_0x3ddd9d(0x22f)](_0x3ddd9d(0x1b5)),console[_0x3ddd9d(0x22f)](_0x3ddd9d(0x1e8)),console[_0x3ddd9d(0x22f)](_0x3ddd9d(0x1ba)),0x1;try{const _0xd2f64d=_0xe8204a[_0x3ddd9d(0x1ae)],_0x43e162=await resolveSegmentTarget(_0xaf202a,_0xd2f64d,_0xe8204a[_0x3ddd9d(0x1d5)]);_0xe8204a[_0x3ddd9d(0x1d5)]&&console[_0x3ddd9d(0x22f)](_0x3ddd9d(0x20c)+_0x43e162);const _0x5e288a=await withSpinner(_0x3ddd9d(0x1c6)+_0xaf202a+_0x3ddd9d(0x205),()=>_0x229b62[_0x3ddd9d(0x227)][_0x3ddd9d(0x24f)](_0x43e162),{'verbose':_0xe8204a['verbose']}),_0x2e5195=_0x5e288a[_0x3ddd9d(0x257)];_0xe8204a['verbose']&&(console['error'](_0x3ddd9d(0x20e)+_0x2e5195[_0x3ddd9d(0x1af)]),console[_0x3ddd9d(0x22f)](_0x3ddd9d(0x1ee)+_0x2e5195[_0x3ddd9d(0x1c8)]));if(_0x2e5195['type']===_0x3ddd9d(0x238))return console[_0x3ddd9d(0x22f)](_0x3ddd9d(0x216)),console[_0x3ddd9d(0x22f)]('Use:\x20tdx\x20sg\x20view\x20<name>\x20\x20#\x20To\x20show\x20folder\x20details'),0x1;if(_0x2e5195[_0x3ddd9d(0x1af)]==='parent')return console[_0x3ddd9d(0x22f)](_0x3ddd9d(0x1fe)),console[_0x3ddd9d(0x22f)](_0x3ddd9d(0x200)),0x1;if(!_0x2e5195[_0x3ddd9d(0x253)])throw new SDKError(ErrorCode[_0x3ddd9d(0x1e5)],_0x3ddd9d(0x1d6));const _0x94b60d=await withSpinner(_0x3ddd9d(0x1f4),()=>_0x229b62[_0x3ddd9d(0x227)][_0x3ddd9d(0x207)](_0x2e5195['parentId'],_0x2e5195[_0x3ddd9d(0x253)]),{'verbose':_0xe8204a['verbose']});let _0x26aed1=_0x94b60d['data'];const _0x595d00=resolveLimit(_0xe8204a[_0x3ddd9d(0x1cc)],DEFAULT_DISPLAY_LIMIT),_0x2ba99d=/\bLIMIT\s+\d+/i['test'](_0x26aed1);!_0x2ba99d&&(_0x26aed1=_0x26aed1['trim']()[_0x3ddd9d(0x244)](/;+$/,''),_0x26aed1=_0x3ddd9d(0x21c)+_0x26aed1+_0x3ddd9d(0x246)+_0x595d00);_0xe8204a['verbose']&&console[_0x3ddd9d(0x22f)](_0x3ddd9d(0x237)+_0x26aed1);const _0x20c079=await withProgressSpinner(_0x3ddd9d(0x221),async _0xb1d487=>{const _0x43f7ad=_0x3ddd9d,_0x52f365=await _0x229b62[_0x43f7ad(0x23f)][_0x43f7ad(0x1bf)](_0x26aed1,{'catalog':'td','schema':_0x43f7ad(0x1c9),'onJobId':_0x26b4d6=>{_0xb1d487['setJobId'](_0x26b4d6);}});return _0x52f365;},{'verbose':_0xe8204a[_0x3ddd9d(0x1d5)]}),_0x587018=_0x20c079[_0x3ddd9d(0x257)],_0xf2ed08=_0x587018[_0x3ddd9d(0x1f3)]?'\x20[Job\x20ID:\x20'+_0x587018[_0x3ddd9d(0x1f3)]+']':'';return console['error'](_0x3ddd9d(0x222)+_0x587018[_0x3ddd9d(0x229)][_0x3ddd9d(0x1f5)][_0x3ddd9d(0x1c5)]()+_0x3ddd9d(0x20d)+(_0x3ddd9d(0x1ec)+formatElapsed(_0x587018[_0x3ddd9d(0x229)][_0x3ddd9d(0x202)])+_0xf2ed08)),await handleQueryOutput(_0x587018,_0xe8204a),0x0;}catch(_0x4908fb){if(_0x4908fb instanceof SDKError)return console[_0x3ddd9d(0x22f)]('✖\x20Query\x20failed\x20['+_0x4908fb['code']+']'),console[_0x3ddd9d(0x22f)]('\x0a'+_0x4908fb[_0x3ddd9d(0x251)]),0x1;throw _0x4908fb;}}}function a37_0x2221(_0x272921,_0x1d4199){_0x272921=_0x272921-0x1ad;const _0x243a7c=a37_0x243a();let _0x2221a5=_0x243a7c[_0x272921];return _0x2221a5;}export class SegmentFolderListCommand extends BaseCommand{[a37_0xfb19a1(0x209)]=a37_0xfb19a1(0x235);[a37_0xfb19a1(0x1b1)]=a37_0xfb19a1(0x1de);async[a37_0xfb19a1(0x1bf)](_0x3fab1f){const _0x4d45db=a37_0xfb19a1,{options:_0x4d8b6a,args:_0x29790d,tdx:_0x43d762}=_0x3fab1f;if(_0x29790d['length']===0x0)return console[_0x4d45db(0x22f)]('Error:\x20Parent\x20segment\x20name\x20is\x20required'),console[_0x4d45db(0x22f)]('Usage:\x20tdx\x20segment\x20folder\x20list\x20<parent_name>'),0x1;const _0x1d29cf=_0x29790d[0x0];try{_0x4d8b6a[_0x4d45db(0x1d5)]&&(console[_0x4d45db(0x22f)]('Site:\x20'+_0x4d8b6a[_0x4d45db(0x226)]),console[_0x4d45db(0x22f)]('Parent\x20name:\x20'+_0x1d29cf));const _0x465959=await withSpinner(_0x4d45db(0x1e4)+_0x1d29cf+_0x4d45db(0x205),()=>_0x43d762[_0x4d45db(0x227)][_0x4d45db(0x255)](_0x1d29cf),{'verbose':_0x4d8b6a[_0x4d45db(0x1d5)]}),_0xa2836f=_0x465959[_0x4d45db(0x257)];_0x4d8b6a[_0x4d45db(0x1d5)]&&console[_0x4d45db(0x22f)](_0x4d45db(0x1fd)+_0xa2836f);const _0x4fa309=await withSpinner(_0x4d45db(0x252)+_0x1d29cf+_0x4d45db(0x205),()=>_0x43d762['segment'][_0x4d45db(0x1e0)](_0xa2836f),{'verbose':_0x4d8b6a['verbose']}),_0x5aa488=_0x4fa309[_0x4d45db(0x257)];return console[_0x4d45db(0x22f)](_0x4d45db(0x24a)+_0x5aa488[_0x4d45db(0x1b9)]+_0x4d45db(0x213)+(_0x5aa488[_0x4d45db(0x1b9)]!==0x1?'s':'')),await handleSDKOutput(_0x5aa488,_0x4d8b6a),0x0;}catch(_0x4fff28){if(_0x4fff28 instanceof SDKError)return console[_0x4d45db(0x22f)](_0x4d45db(0x1d7)+_0x4fff28['message']),_0x4fff28[_0x4d45db(0x22e)]&&console[_0x4d45db(0x22f)](_0x4d45db(0x233)+_0x4fff28[_0x4d45db(0x22e)]),0x1;throw _0x4fff28;}}}export class SegmentFolderShowCommand extends BaseCommand{[a37_0xfb19a1(0x209)]='segment:folder:show';[a37_0xfb19a1(0x1b1)]='Show\x20segment\x20folder\x20details';async[a37_0xfb19a1(0x1bf)](_0x2fff99){const _0x1e8bea=a37_0xfb19a1,{options:_0x336c81,args:_0xc5ed19,tdx:_0x5cb48f}=_0x2fff99;if(_0xc5ed19[_0x1e8bea(0x1b9)]===0x0)return console[_0x1e8bea(0x22f)]('Error:\x20Folder\x20reference\x20is\x20required'),console['error'](_0x1e8bea(0x228)),0x1;try{const {parentId:_0x33b596,childId:_0x12cdbd}=parseSegmentRef(_0xc5ed19[0x0]);_0x336c81[_0x1e8bea(0x1d5)]&&(console['error'](_0x1e8bea(0x220)+_0x336c81[_0x1e8bea(0x226)]),console[_0x1e8bea(0x22f)](_0x1e8bea(0x1b8)+_0x33b596),_0x12cdbd&&console[_0x1e8bea(0x22f)](_0x1e8bea(0x1bc)+_0x12cdbd));if(!_0x12cdbd)return console[_0x1e8bea(0x22f)](_0x1e8bea(0x1bb)),0x1;const _0x15af19=await withSpinner(_0x1e8bea(0x1e4)+_0x33b596+_0x1e8bea(0x205),()=>_0x5cb48f[_0x1e8bea(0x227)][_0x1e8bea(0x255)](_0x33b596),{'verbose':_0x336c81[_0x1e8bea(0x1d5)]}),_0x353fc1=_0x15af19[_0x1e8bea(0x257)];_0x336c81['verbose']&&console[_0x1e8bea(0x22f)]('Resolved\x20parent\x20ID:\x20'+_0x353fc1);const _0x282c58=await withSpinner(_0x1e8bea(0x236)+_0x12cdbd+_0x1e8bea(0x205),()=>_0x5cb48f[_0x1e8bea(0x227)][_0x1e8bea(0x239)](_0x353fc1,_0x12cdbd),{'verbose':_0x336c81[_0x1e8bea(0x1d5)]}),_0x1898ca=_0x282c58[_0x1e8bea(0x257)];_0x336c81['verbose']&&console[_0x1e8bea(0x22f)](_0x1e8bea(0x1d2)+_0x1898ca);const _0x5087a7=await withSpinner(_0x1e8bea(0x1d1)+_0x12cdbd+'\x27...',()=>_0x5cb48f['segment'][_0x1e8bea(0x254)](_0x1898ca),{'verbose':_0x336c81[_0x1e8bea(0x1d5)]});return await handleSDKOutput([_0x5087a7['data']],_0x336c81),0x0;}catch(_0xa559c6){if(_0xa559c6 instanceof SDKError)return console[_0x1e8bea(0x22f)](_0x1e8bea(0x1d7)+_0xa559c6[_0x1e8bea(0x251)]),_0xa559c6['cause']&&console[_0x1e8bea(0x22f)](_0x1e8bea(0x233)+_0xa559c6['cause']),0x1;throw _0xa559c6;}}}export class SegmentSQLCommand extends BaseCommand{['name']=a37_0xfb19a1(0x1d8);[a37_0xfb19a1(0x1b1)]=a37_0xfb19a1(0x1ea);async[a37_0xfb19a1(0x1bf)](_0x5961c2){const _0x513a9f=a37_0xfb19a1,{options:_0x322b60,args:_0x5eef32}=_0x5961c2,_0x5dfb7c=_0x322b60,_0x22f854=_0x5dfb7c[_0x513a9f(0x1b6)],_0x56ad3e=_0x5eef32[0x0];if(!_0x56ad3e&&!_0x22f854)return console[_0x513a9f(0x22f)](a37_0x57c980[_0x513a9f(0x22d)](_0x513a9f(0x1fa))),console[_0x513a9f(0x22f)](_0x513a9f(0x250)),console[_0x513a9f(0x22f)](_0x513a9f(0x22c)),console[_0x513a9f(0x22f)](_0x513a9f(0x240)),console[_0x513a9f(0x22f)]('Examples:'),console['error'](_0x513a9f(0x1c7)),console[_0x513a9f(0x22f)](_0x513a9f(0x24e)),0x1;if(_0x56ad3e&&_0x22f854)return console['error'](a37_0x57c980[_0x513a9f(0x22d)](_0x513a9f(0x1b3))),0x1;try{let _0x18b4cf;if(_0x22f854)_0x18b4cf=await this[_0x513a9f(0x1f6)](_0x22f854,_0x5961c2);else{if(isYamlFilePath(_0x56ad3e))return console['error'](a37_0x57c980[_0x513a9f(0x22d)](_0x513a9f(0x1ff))),console['error'](_0x513a9f(0x23d)+_0x56ad3e),0x1;else _0x18b4cf=await this['getSQLFromServerSegment'](_0x56ad3e,_0x5961c2);}return _0x322b60['format']===_0x513a9f(0x1dd)||_0x322b60[_0x513a9f(0x1cb)]===_0x513a9f(0x1f9)?await handleSDKOutput([{'sql':_0x18b4cf}],_0x322b60):console[_0x513a9f(0x232)](_0x18b4cf),0x0;}catch(_0x480a02){if(_0x480a02 instanceof SDKError)return console[_0x513a9f(0x22f)]('Error:\x20'+_0x480a02['message']),_0x480a02['cause']&&console[_0x513a9f(0x22f)]('\x20\x20Cause:\x20'+_0x480a02[_0x513a9f(0x22e)]),0x1;throw _0x480a02;}}async[a37_0xfb19a1(0x1f6)](_0x135aae,_0x444c11){const _0x3b42f9=a37_0xfb19a1,{options:_0x23983a,tdx:_0x557062}=_0x444c11;let _0x5da537;try{_0x5da537=await resolveYamlFilePath(_0x135aae);}catch(_0x5c1210){throw new SDKError(ErrorCode[_0x3b42f9(0x1ef)],_0x3b42f9(0x231)+_0x5c1210['message']);}_0x23983a[_0x3b42f9(0x1d5)]&&console[_0x3b42f9(0x22f)]('Resolved:\x20'+_0x5da537[_0x3b42f9(0x1ae)]+'/'+_0x5da537[_0x3b42f9(0x1fc)]);const _0x3198eb=await withSpinner(_0x3b42f9(0x1d0),()=>_0x557062[_0x3b42f9(0x227)][_0x3b42f9(0x23a)](_0x5da537['content'],_0x5da537[_0x3b42f9(0x1ae)],_0x5da537[_0x3b42f9(0x1fc)]),{'verbose':_0x23983a[_0x3b42f9(0x1d5)]});return _0x3198eb[_0x3b42f9(0x257)];}async[a37_0xfb19a1(0x1b7)](_0x3dc34f,_0x643706){const _0x377ff4=a37_0xfb19a1,{options:_0x332ad6,tdx:_0x24ad60}=_0x643706,_0x286ab1=_0x332ad6['parentSegment'],_0x5be8d8=await resolveSegmentTarget(_0x3dc34f,_0x286ab1,_0x332ad6[_0x377ff4(0x1d5)]);_0x332ad6[_0x377ff4(0x1d5)]&&console[_0x377ff4(0x22f)]('Target\x20path:\x20'+_0x5be8d8);const _0x196106=await withSpinner(_0x377ff4(0x1c6)+_0x3dc34f+_0x377ff4(0x205),()=>_0x24ad60[_0x377ff4(0x227)][_0x377ff4(0x24f)](_0x5be8d8),{'verbose':_0x332ad6[_0x377ff4(0x1d5)]}),_0x1361e4=_0x196106[_0x377ff4(0x257)];_0x332ad6[_0x377ff4(0x1d5)]&&(console[_0x377ff4(0x22f)](_0x377ff4(0x20e)+_0x1361e4[_0x377ff4(0x1af)]),console[_0x377ff4(0x22f)](_0x377ff4(0x1ee)+_0x1361e4[_0x377ff4(0x1c8)]));if(_0x1361e4[_0x377ff4(0x1af)]==='folder')throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x377ff4(0x1f0));if(_0x1361e4[_0x377ff4(0x1af)]===_0x377ff4(0x1e6))throw new SDKError(ErrorCode[_0x377ff4(0x1ef)],_0x377ff4(0x23e));if(!_0x1361e4[_0x377ff4(0x253)])throw new SDKError(ErrorCode[_0x377ff4(0x1e5)],_0x377ff4(0x1d6));const _0x181c59=await withSpinner(_0x377ff4(0x1f4),()=>_0x24ad60[_0x377ff4(0x227)][_0x377ff4(0x207)](_0x1361e4[_0x377ff4(0x1c8)],_0x1361e4[_0x377ff4(0x253)]),{'verbose':_0x332ad6[_0x377ff4(0x1d5)]});return _0x181c59[_0x377ff4(0x257)];}}export class SegmentFolderCreateCommand extends BaseCommand{[a37_0xfb19a1(0x209)]=a37_0xfb19a1(0x217);['description']=a37_0xfb19a1(0x22a);async[a37_0xfb19a1(0x1bf)](_0x5c3c63){const _0x4c23b7=a37_0xfb19a1,{options:_0x50f776,args:_0x48814d,tdx:_0x42a01b}=_0x5c3c63,_0x1f041b=_0x50f776;if(_0x48814d[_0x4c23b7(0x1b9)]<0x2)return console[_0x4c23b7(0x22f)](_0x4c23b7(0x21e)),console['error'](_0x4c23b7(0x248)),0x1;const _0x5b5ef6=_0x48814d[0x0],_0x5a84f1=_0x48814d[0x1];_0x1f041b[_0x4c23b7(0x1d5)]&&(console[_0x4c23b7(0x22f)](_0x4c23b7(0x220)+_0x1f041b[_0x4c23b7(0x226)]),console[_0x4c23b7(0x22f)](_0x4c23b7(0x21f)+_0x5b5ef6),console['error'](_0x4c23b7(0x1bc)+_0x5a84f1));let _0x94e906;if(_0x1f041b[_0x4c23b7(0x22b)]){const _0x368e6a=_0x1f041b['parentFolder'],_0x159a51=await withSpinner(_0x4c23b7(0x1e4)+_0x5b5ef6+'\x27...',()=>_0x42a01b[_0x4c23b7(0x227)][_0x4c23b7(0x255)](_0x5b5ef6),{'verbose':_0x1f041b[_0x4c23b7(0x1d5)]}),_0x12b913=_0x159a51[_0x4c23b7(0x257)],_0x5e6350=await withSpinner(_0x4c23b7(0x24c)+_0x368e6a+'\x27...',()=>_0x42a01b[_0x4c23b7(0x227)][_0x4c23b7(0x239)](_0x12b913,_0x368e6a),{'verbose':_0x1f041b[_0x4c23b7(0x1d5)]});_0x94e906=_0x5e6350[_0x4c23b7(0x257)],_0x1f041b['verbose']&&console[_0x4c23b7(0x22f)](_0x4c23b7(0x21d)+_0x94e906);}const _0x3d6ce6={'name':_0x5a84f1,'description':_0x1f041b['description'],'parentFolderId':_0x94e906},_0x33104f=await withSpinner(_0x4c23b7(0x1c3)+_0x5a84f1+_0x4c23b7(0x205),()=>_0x42a01b[_0x4c23b7(0x227)][_0x4c23b7(0x23b)](_0x5b5ef6,_0x3d6ce6),{'verbose':_0x1f041b['verbose']}),_0x423ef5=_0x33104f['data'];return console['error'](_0x4c23b7(0x1d4)+_0x423ef5[_0x4c23b7(0x209)]+_0x4c23b7(0x1f2)+_0x423ef5['id']),await handleSDKOutput([_0x423ef5],_0x1f041b),0x0;}}export class SegmentViewCommand extends BaseCommand{['name']=a37_0xfb19a1(0x243);['description']=a37_0xfb19a1(0x1eb);async['execute'](_0x1692fc){const _0x1f41ef=a37_0xfb19a1,{options:_0x404d83,args:_0x201097,tdx:_0x30b4b4}=_0x1692fc,_0x115812=_0x201097[0x0];if(!_0x115812)return console[_0x1f41ef(0x22f)](_0x1f41ef(0x1d3)),console[_0x1f41ef(0x22f)](_0x1f41ef(0x1ca)),console[_0x1f41ef(0x22f)](_0x1f41ef(0x24b)),console['error'](_0x1f41ef(0x214)),console[_0x1f41ef(0x22f)]('\x20\x20-w,\x20--web\x20\x20Open\x20segment\x20in\x20web\x20browser'),console[_0x1f41ef(0x22f)](_0x1f41ef(0x1b5)),console[_0x1f41ef(0x22f)]('\x20\x20tdx\x20sg\x20view\x20\x22Marketing\x22\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20folder\x20details'),console['error'](_0x1f41ef(0x1e2)),console[_0x1f41ef(0x22f)](_0x1f41ef(0x1da)),console[_0x1f41ef(0x22f)](_0x1f41ef(0x1be)),0x1;try{const _0x3f8f54=_0x404d83[_0x1f41ef(0x1ae)],_0x5166c8=await resolveSegmentTarget(_0x115812,_0x3f8f54,_0x404d83[_0x1f41ef(0x1d5)]);_0x404d83[_0x1f41ef(0x1d5)]&&console['error'](_0x1f41ef(0x20c)+_0x5166c8);const _0x3de974=await withSpinner(_0x1f41ef(0x1c6)+_0x115812+_0x1f41ef(0x205),()=>_0x30b4b4[_0x1f41ef(0x227)][_0x1f41ef(0x24f)](_0x5166c8),{'verbose':_0x404d83[_0x1f41ef(0x1d5)]}),_0x301d1c=_0x3de974['data'];_0x404d83[_0x1f41ef(0x1d5)]&&(console[_0x1f41ef(0x22f)](_0x1f41ef(0x20e)+_0x301d1c[_0x1f41ef(0x1af)]),console[_0x1f41ef(0x22f)]('Parent\x20ID:\x20'+_0x301d1c[_0x1f41ef(0x1c8)]),_0x301d1c['folderId']&&console['error']('Folder\x20ID:\x20'+_0x301d1c[_0x1f41ef(0x201)]),_0x301d1c[_0x1f41ef(0x253)]&&console[_0x1f41ef(0x22f)](_0x1f41ef(0x1c0)+_0x301d1c[_0x1f41ef(0x253)]));if(_0x404d83[_0x1f41ef(0x1d9)]){if(_0x301d1c[_0x1f41ef(0x1af)]===_0x1f41ef(0x238))return console['error'](_0x1f41ef(0x212)),0x1;if(_0x301d1c[_0x1f41ef(0x1af)]===_0x1f41ef(0x1e6))return console[_0x1f41ef(0x22f)](_0x1f41ef(0x230)),console['error']('Use:\x20tdx\x20ps\x20view\x20-w'),0x1;if(!_0x301d1c[_0x1f41ef(0x253)])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x1f41ef(0x1d6));const _0x10ada2=getConsoleNextUrl(_0x404d83['site'],_0x1f41ef(0x20f)+_0x301d1c[_0x1f41ef(0x1c8)]+'/e/'+_0x301d1c['segmentId']);return console[_0x1f41ef(0x22f)](a37_0x57c980[_0x1f41ef(0x210)]('✔')+_0x1f41ef(0x241)+a37_0x57c980[_0x1f41ef(0x203)](_0x10ada2)),openBrowser(_0x10ada2),0x0;}if(_0x301d1c[_0x1f41ef(0x1af)]===_0x1f41ef(0x238)){if(!_0x301d1c['folderId'])throw new SDKError(ErrorCode['SEGMENT_FOLDER_NOT_FOUND'],'Folder\x20ID\x20missing\x20from\x20resolved\x20path');const _0x6c59aa=await withSpinner(_0x1f41ef(0x204),()=>_0x30b4b4[_0x1f41ef(0x227)][_0x1f41ef(0x254)](_0x301d1c[_0x1f41ef(0x201)]),{'verbose':_0x404d83[_0x1f41ef(0x1d5)]});await handleSingleObjectOutput(_0x6c59aa[_0x1f41ef(0x257)],_0x404d83);}else{if(_0x301d1c['type']===_0x1f41ef(0x227)){if(!_0x301d1c[_0x1f41ef(0x253)])throw new SDKError(ErrorCode[_0x1f41ef(0x1e5)],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x31ae6a=await withSpinner('Fetching\x20segment\x20details...',()=>_0x30b4b4[_0x1f41ef(0x227)][_0x1f41ef(0x1bd)](_0x301d1c[_0x1f41ef(0x1c8)],_0x301d1c[_0x1f41ef(0x253)]),{'verbose':_0x404d83[_0x1f41ef(0x1d5)]}),_0x360563=getConsoleNextUrl(_0x404d83['site'],_0x1f41ef(0x20f)+_0x301d1c[_0x1f41ef(0x1c8)]+_0x1f41ef(0x1cd)+_0x301d1c[_0x1f41ef(0x253)]),_0x109cc4=_0x31ae6a[_0x1f41ef(0x257)];_0x109cc4[_0x1f41ef(0x1b2)]=_0x360563,await handleSingleObjectOutput(_0x109cc4,_0x404d83);}else return console[_0x1f41ef(0x22f)](_0x1f41ef(0x234)),console[_0x1f41ef(0x22f)](_0x1f41ef(0x1df)),0x1;}return 0x0;}catch(_0x5e7407){if(_0x5e7407 instanceof SDKError)return console['error'](_0x1f41ef(0x1d7)+_0x5e7407[_0x1f41ef(0x251)]),_0x5e7407[_0x1f41ef(0x22e)]&&console[_0x1f41ef(0x22f)](_0x1f41ef(0x233)+_0x5e7407[_0x1f41ef(0x22e)]),0x1;throw _0x5e7407;}}}export const SegmentInfoCommand=SegmentViewCommand;function a37_0x243a(){const _0x3f15b2=['Options:','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20desc\x20<path/to/segment.yml>','Error:\x20Cannot\x20execute\x20SQL\x20query\x20on\x20a\x20folder.','segment:folder:create','\x20\x20Parent\x20segment:\x20','4288964mKJPNf','1859056QaAktK','folderPath','SELECT\x20*\x20FROM\x20(\x0a','Resolved\x20parent\x20folder\x20ID:\x20','Error:\x20Parent\x20segment\x20name\x20and\x20folder\x20name\x20are\x20required','Parent\x20segment:\x20','Site:\x20','Executing\x20segment\x20query...','✔\x20Query\x20completed:\x20Processed\x20','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience\x22','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20show\x20<path/to/segment.yml>','getParent','site','segment','Usage:\x20tdx\x20segment\x20folder\x20show\x20<parent_name/folder_name>','stats','Create\x20segment\x20folder\x20for\x20organization','parentFolder','\x20\x20Server-side\x20segment:\x20\x20tdx\x20sg\x20sql\x20<name>','red','cause','error','Error:\x20Cannot\x20open\x20parent\x20segment\x20with\x20this\x20command.','Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20','log','\x20\x20Cause:\x20','Error:\x20Cannot\x20view\x20parent\x20segment\x20details\x20with\x20this\x20command.','segment:folder:list','Resolving\x20folder\x20\x27','SQL\x20query:\x0a','folder','resolveFolderId','getSegmentSQLFromYaml','createFolder','3712803vHiSBT','\x20\x20tdx\x20sg\x20sql\x20--path\x20','Cannot\x20get\x20SQL\x20for\x20parent\x20segment\x20with\x20this\x20command.\x20Use:\x20tdx\x20ps\x20sql','query','\x20\x20Local\x20YAML\x20file:\x20\x20\x20\x20\x20\x20tdx\x20sg\x20sql\x20--path\x20<file-path>','\x20Opening\x20','Error:\x20Path\x20or\x20name\x20is\x20required','segment:view','replace','\x20\x20Folder\x20path:\x20','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','Fetching\x20parent\x20segment\x20details...','Usage:\x20tdx\x20segment\x20folder\x20create\x20<parent_name>\x20<folder_name>\x20[options]','Show\x20child\x20segment\x20schema\x20(column\x20types)','✔\x20Found\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20view\x20<path/to/segment.yml>','Resolving\x20parent\x20folder\x20\x27','Error:\x20Cannot\x20show\x20schema\x20for\x20parent\x20segment\x20with\x20this\x20command.','\x20\x20tdx\x20sg\x20sql\x20--path\x20segments/my-audience/premium-users.yml','resolvePathToResource','Usage:','message','Listing\x20folders\x20for\x20parent\x20\x27','segmentId','getFolder','resolveParentId','Folder\x20ID:\x20','data','13878950fopvOT','parentSegment','type','426552AEbIku','description','url','Error:\x20Specify\x20either\x20segment\x20name\x20or\x20--path,\x20not\x20both','6deGmKk','Examples:','path','getSQLFromServerSegment','Parent\x20name:\x20','length','\x20\x20tdx\x20sg\x20show\x20segments/my-audience/premium-users.yml','Error:\x20Folder\x20name\x20is\x20required\x20(use\x20parent_name/folder_name\x20format)','Folder\x20name:\x20','getSegment','\x20\x20tdx\x20sg\x20view\x20segments/my-audience/premium-users.yml','execute','Segment\x20ID:\x20','5eSmrgl','Fetching\x20segment\x20details...','Creating\x20folder\x20\x27','Error:\x20Cannot\x20show\x20schema\x20for\x20a\x20folder.','toLocaleString','Resolving\x20\x27','\x20\x20tdx\x20sg\x20sql\x20\x22Premium\x20Users\x22','parentId','information_schema','Usage:\x20tdx\x20sg\x20view\x20<name>\x20[-w]','format','limit','/e/','Resolved\x20relative\x20path\x20to:\x20','\x20\x20Full\x20path:\x20','Fetching\x20SQL\x20from\x20rule...','Fetching\x20folder\x20\x27','Resolved\x20folder\x20ID:\x20','Error:\x20Folder\x20or\x20segment\x20name,\x20or\x20YAML\x20file\x20path\x20is\x20required','✔\x20Created\x20folder\x20\x27','verbose','Segment\x20ID\x20missing\x20from\x20resolved\x20path','Error:\x20','segment:sql','web','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20-w\x20\x20#\x20Open\x20segment\x20in\x20web\x20browser','7222117bHwQON','fullPath','json','List\x20segment\x20folders\x20under\x20a\x20parent\x20segment','Use:\x20tdx\x20ps\x20view','listFolders','\x20\x20tdx\x20segment\x20describe\x20\x22High\x20Value\x22\x20\x20\x20\x20#\x20Relative\x20to\x20current\x20context','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20\x20\x20\x20\x20#\x20View\x20child\x20segment\x20details','18mKcBxx','Resolving\x20parent\x20segment\x20\x27','SEGMENT_NOT_FOUND','parent','\x20\x20Segment\x20name:\x20','\x20\x20tdx\x20sg\x20show\x20\x22Premium\x20Users\x22','(root)','Get\x20SQL\x20query\x20for\x20child\x20segment','Show\x20folder\x20or\x20child\x20segment\x20details','in\x20','Resolving\x20path\x20\x27','Parent\x20ID:\x20','INVALID_ARGUMENT','Cannot\x20get\x20SQL\x20query\x20for\x20a\x20folder.\x20Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.','778126jODmYC','\x27\x20with\x20ID:\x20','jobId','Fetching\x20SQL\x20for\x20segment...','processedRows','getSQLFromYamlFile','\x20\x20tdx\x20sg\x20desc\x20segments/my-audience/premium-users.yml','Usage:\x20tdx\x20sg\x20desc\x20<name>','jsonl','Error:\x20Segment\x20name\x20or\x20--path\x20is\x20required','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience/Marketing/High\x20Value\x22','segmentName','Resolved\x20parent\x20ID:\x20','Error:\x20Cannot\x20execute\x20query\x20for\x20parent\x20segment\x20with\x20this\x20command.','Error:\x20YAML\x20file\x20paths\x20must\x20be\x20specified\x20with\x20--path\x20option','Use:\x20tdx\x20ps\x20show','folderId','elapsedTimeMillis','cyan','Fetching\x20folder\x20details...','\x27...','Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required','getSegmentSQL','Usage:\x20tdx\x20segment\x20describe\x20<path>','name','Resolved\x20YAML\x20file:\x20','Execute\x20child\x20segment\x20SQL\x20query\x20and\x20show\x20results','Target\x20path:\x20','\x20rows\x20','Resolved\x20type:\x20','/app/ps/','green','Folder\x20ID\x20missing\x20from\x20resolved\x20path','Error:\x20Cannot\x20open\x20folder\x20in\x20web\x20browser.\x20Use\x20a\x20segment\x20name\x20instead.','\x20folder'];a37_0x243a=function(){return _0x3f15b2;};return a37_0x243a();}export class SegmentDescCommand extends BaseCommand{[a37_0xfb19a1(0x209)]='segment:desc';[a37_0xfb19a1(0x1b1)]=a37_0xfb19a1(0x249);async[a37_0xfb19a1(0x1bf)](_0xe940c0){const _0x4b7a51=a37_0xfb19a1,{options:_0x403a3e,args:_0x4ab6b7,tdx:_0x23a3a3}=_0xe940c0,_0x1ee296=_0x4ab6b7[0x0];if(!_0x1ee296)return console[_0x4b7a51(0x22f)](_0x4b7a51(0x206)),console[_0x4b7a51(0x22f)](_0x4b7a51(0x1f8)),console['error'](_0x4b7a51(0x215)),console[_0x4b7a51(0x22f)](_0x4b7a51(0x1b5)),console[_0x4b7a51(0x22f)]('\x20\x20tdx\x20sg\x20desc\x20\x22Premium\x20Users\x22'),console[_0x4b7a51(0x22f)](_0x4b7a51(0x1f7)),0x1;try{const _0x502ca5=_0x403a3e[_0x4b7a51(0x1ae)],_0xd5997c=await resolveSegmentTarget(_0x1ee296,_0x502ca5,_0x403a3e[_0x4b7a51(0x1d5)]);_0x403a3e[_0x4b7a51(0x1d5)]&&console[_0x4b7a51(0x22f)](_0x4b7a51(0x20c)+_0xd5997c);const _0x3b88ef=await withSpinner(_0x4b7a51(0x1c6)+_0x1ee296+_0x4b7a51(0x205),()=>_0x23a3a3[_0x4b7a51(0x227)][_0x4b7a51(0x24f)](_0xd5997c),{'verbose':_0x403a3e['verbose']}),_0xe1281c=_0x3b88ef[_0x4b7a51(0x257)];_0x403a3e['verbose']&&(console[_0x4b7a51(0x22f)]('Resolved\x20type:\x20'+_0xe1281c[_0x4b7a51(0x1af)]),console[_0x4b7a51(0x22f)](_0x4b7a51(0x1ee)+_0xe1281c[_0x4b7a51(0x1c8)]));if(_0xe1281c[_0x4b7a51(0x1af)]==='folder')return console[_0x4b7a51(0x22f)](_0x4b7a51(0x1c4)),console[_0x4b7a51(0x22f)]('Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.'),0x1;if(_0xe1281c[_0x4b7a51(0x1af)]===_0x4b7a51(0x1e6))return console[_0x4b7a51(0x22f)](_0x4b7a51(0x24d)),console[_0x4b7a51(0x22f)]('Use:\x20tdx\x20ps\x20desc'),0x1;if(!_0xe1281c[_0x4b7a51(0x253)])throw new SDKError(ErrorCode[_0x4b7a51(0x1e5)],_0x4b7a51(0x1d6));const _0x56621a=await withSpinner(_0x4b7a51(0x1f4),()=>_0x23a3a3[_0x4b7a51(0x227)][_0x4b7a51(0x207)](_0xe1281c[_0x4b7a51(0x1c8)],_0xe1281c['segmentId']),{'verbose':_0x403a3e[_0x4b7a51(0x1d5)]}),_0x27874e=_0x56621a[_0x4b7a51(0x257)],_0x2b0390=await executeSchemaQuery(_0x27874e,_0x23a3a3,_0x403a3e);return await handleQueryOutput(_0x2b0390,_0x403a3e),0x0;}catch(_0x51d0e4){if(_0x51d0e4 instanceof SDKError)return console[_0x4b7a51(0x22f)]('Error:\x20'+_0x51d0e4[_0x4b7a51(0x251)]),_0x51d0e4['cause']&&console['error'](_0x4b7a51(0x233)+_0x51d0e4['cause']),0x1;throw _0x51d0e4;}}}
1
+ const a37_0x494e84=a37_0x1763;(function(_0x2b5571,_0x59d93c){const _0x239073=a37_0x1763,_0x1c00fb=_0x2b5571();while(!![]){try{const _0x17dd2a=parseInt(_0x239073(0x181))/0x1+parseInt(_0x239073(0x16f))/0x2*(parseInt(_0x239073(0x15c))/0x3)+-parseInt(_0x239073(0xf4))/0x4*(parseInt(_0x239073(0xf1))/0x5)+-parseInt(_0x239073(0x180))/0x6+parseInt(_0x239073(0x175))/0x7+parseInt(_0x239073(0x167))/0x8+-parseInt(_0x239073(0x11b))/0x9*(-parseInt(_0x239073(0x14f))/0xa);if(_0x17dd2a===_0x59d93c)break;else _0x1c00fb['push'](_0x1c00fb['shift']());}catch(_0x2c2910){_0x1c00fb['push'](_0x1c00fb['shift']());}}}(a37_0xd395,0x5f04f));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,handleQueryOutput,handleSingleObjectOutput}from'../core/command-output.js';function a37_0x1763(_0x458ee2,_0xef491b){_0x458ee2=_0x458ee2-0xee;const _0xd395bb=a37_0xd395();let _0x176397=_0xd395bb[_0x458ee2];return _0x176397;}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';function a37_0xd395(){const _0x107975=['Show\x20segment\x20or\x20folder\x20details','Parent\x20name:\x20','Error:\x20Segment\x20name\x20or\x20--path\x20is\x20required','Create\x20segment\x20folder\x20for\x20organization','✔\x20Found\x20','Site:\x20','\x20rows\x20','Error:\x20Cannot\x20open\x20parent\x20segment\x20with\x20this\x20command.','jsonl','Use:\x20tdx\x20ps\x20view\x20-w','length','\x20\x20tdx\x20sg\x20sql\x20--path\x20','createFolder','test','message','INVALID_ARGUMENT','cause','Error:\x20Parent\x20segment\x20name\x20is\x20required','\x27\x20with\x20ID:\x20','segment:describe','Resolving\x20parent\x20folder\x20\x27','218390obZYkD','Get\x20SQL\x20query\x20for\x20child\x20segment','\x20\x20Local\x20YAML\x20file:\x20\x20\x20\x20\x20\x20tdx\x20sg\x20sql\x20--path\x20<file-path>','execute','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20-w\x20\x20#\x20Open\x20segment\x20in\x20web\x20browser','segment','format','segmentName','Resolved\x20parent\x20ID:\x20','error','in\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20desc\x20<path/to/segment.yml>','Usage:\x20tdx\x20segment\x20folder\x20show\x20<parent_name/folder_name>','12459uYmYAq','type','Fetching\x20parent\x20segment\x20details...','Fetching\x20folder\x20\x27','Usage:\x20tdx\x20segment\x20folder\x20create\x20<parent_name>\x20<folder_name>\x20[options]','Fetching\x20SQL\x20from\x20rule...','Resolved\x20YAML\x20file:\x20','SEGMENT_FOLDER_NOT_FOUND','resolvePathToResource','Fetching\x20folder\x20details...','Error:\x20Cannot\x20show\x20schema\x20for\x20a\x20folder.','172696dEAgRI','Usage:\x20tdx\x20sg\x20show\x20<name>','\x20\x20tdx\x20sg\x20view\x20\x22Marketing\x22\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20folder\x20details','Fetching\x20SQL\x20for\x20segment...','Use:\x20tdx\x20ps\x20show','Usage:','parentFolder','resolveFolderId','214OcitgL','web','segment:folder:list','Error:\x20Cannot\x20view\x20parent\x20segment\x20details\x20with\x20this\x20command.','✔\x20Created\x20folder\x20\x27','folderId','2804816XwOBtV','Cannot\x20get\x20SQL\x20for\x20parent\x20segment\x20with\x20this\x20command.\x20Use:\x20tdx\x20ps\x20sql','cyan','Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.','\x20\x20-w,\x20--web\x20\x20Open\x20segment\x20in\x20web\x20browser','Resolved\x20relative\x20path\x20to:\x20','processedRows','Parent\x20segment:\x20','\x27...','Error:\x20Folder\x20reference\x20is\x20required','SELECT\x20*\x20FROM\x20(\x0a','4146420eJMuqx','270065EKtdDr','\x20\x20tdx\x20sg\x20desc\x20segments/my-audience/premium-users.yml','segment:sql','setJobId','Fetching\x20segment\x20details...','/e/','Usage:\x20tdx\x20segment\x20describe\x20<path>','Resolved\x20folder\x20ID:\x20','getSQLFromYamlFile','Folder\x20ID\x20missing\x20from\x20resolved\x20path','getSegmentSQL','Executing\x20segment\x20query...','trim','Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required','log','segmentId','content','site','code','Folder\x20ID:\x20','folder','segment:folder:create','20XUjhZc','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20view\x20<path/to/segment.yml>','Folder\x20name:\x20','449544fcsdgz','includes','Examples:','Resolving\x20parent\x20segment\x20\x27','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','Error:\x20Folder\x20or\x20segment\x20name,\x20or\x20YAML\x20file\x20path\x20is\x20required','Error:\x20Cannot\x20execute\x20SQL\x20query\x20on\x20a\x20folder.','\x20\x20Cause:\x20','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience/Marketing/High\x20Value\x22','getFolder','Use:\x20tdx\x20sg\x20view\x20<name>\x20\x20#\x20To\x20show\x20folder\x20details','getParent','stats','toLocaleString','segmentPath','SEGMENT_NOT_FOUND','information_schema','Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20','Parent\x20ID:\x20','getSQLFromServerSegment','SQL\x20query:\x0a','Error:\x20Parent\x20segment\x20name\x20and\x20folder\x20name\x20are\x20required','parentId','List\x20segment\x20folders\x20under\x20a\x20parent\x20segment','\x20Opening\x20','Error:\x20Folder\x20name\x20is\x20required\x20(use\x20parent_name/folder_name\x20format)','segment:show','segment:desc','name','red','\x20folder','Target\x20path:\x20','Use:\x20tdx\x20ps\x20view','getSegmentSQLFromYaml','\x20\x20tdx\x20segment\x20describe\x20\x22High\x20Value\x22\x20\x20\x20\x20#\x20Relative\x20to\x20current\x20context','fullPath','jobId','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience\x22','parentSegment','162AOLHTH','Resolved\x20type:\x20','Usage:\x20tdx\x20sg\x20view\x20<name>\x20[-w]','\x20\x20Parent\x20segment:\x20','limit','\x20[Job\x20ID:\x20','query','Resolved\x20parent\x20folder\x20ID:\x20','Show\x20folder\x20or\x20child\x20segment\x20details','Error:\x20Cannot\x20show\x20schema\x20for\x20parent\x20segment\x20with\x20this\x20command.','parent','/app/ps/','verbose','Usage:\x20tdx\x20segment\x20folder\x20list\x20<parent_name>','resolveParentId','Error:\x20Cannot\x20open\x20folder\x20in\x20web\x20browser.\x20Use\x20a\x20segment\x20name\x20instead.','\x20\x20Server-side\x20segment:\x20\x20tdx\x20sg\x20sql\x20<name>','folderPath','Segment\x20ID\x20missing\x20from\x20resolved\x20path','Creating\x20folder\x20\x27','\x20\x20tdx\x20sg\x20show\x20segments/my-audience/premium-users.yml','description','Resolving\x20\x27','Error:\x20Specify\x20either\x20segment\x20name\x20or\x20--path,\x20not\x20both','listFolders','Error:\x20','\x20\x20tdx\x20sg\x20desc\x20\x22Premium\x20Users\x22','elapsedTimeMillis','data','Execute\x20child\x20segment\x20SQL\x20query\x20and\x20show\x20results','Listing\x20folders\x20for\x20parent\x20\x27'];a37_0xd395=function(){return _0x107975;};return a37_0xd395();}import{executeSchemaQuery}from'../sdk/segment/fields-display.js';import{isYamlFilePath,resolveYamlFilePath}from'../sdk/segment/segment-path-parser.js';import{getConsoleNextUrl}from'../sdk/client/endpoints.js';import{openBrowser}from'../utils/process.js';import a37_0x37d081 from'chalk';async function resolveSegmentTarget(_0x29d761,_0x217df5,_0x4419dd){const _0x39b5fa=a37_0x1763;if(isYamlFilePath(_0x29d761))try{const _0x176120=await resolveYamlFilePath(_0x29d761);return _0x4419dd&&(console[_0x39b5fa(0x158)](_0x39b5fa(0x162)+_0x29d761),console[_0x39b5fa(0x158)](_0x39b5fa(0x11e)+_0x176120[_0x39b5fa(0x11a)]),console['error']('\x20\x20Segment\x20name:\x20'+_0x176120[_0x39b5fa(0x156)]),console[_0x39b5fa(0x158)]('\x20\x20Folder\x20path:\x20'+(_0x176120[_0x39b5fa(0x12c)]||'(root)')),console['error']('\x20\x20Full\x20path:\x20'+_0x176120[_0x39b5fa(0x117)])),_0x176120['fullPath'];}catch(_0x51a2f1){throw new SDKError(ErrorCode[_0x39b5fa(0x149)],_0x39b5fa(0x105)+_0x51a2f1['message']);}if(!_0x217df5)throw new SDKError(ErrorCode[_0x39b5fa(0x149)],'No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22');return _0x217df5+'/'+_0x29d761;}export class SegmentDescribeCommand extends BaseCommand{[a37_0x494e84(0x110)]=a37_0x494e84(0x14d);[a37_0x494e84(0x130)]=a37_0x494e84(0x13a);async['execute'](_0x1ffcb1){const _0x29c5d1=a37_0x494e84,{options:_0x2de96c,args:_0x536132,tdx:_0x1b5f1e}=_0x1ffcb1,_0x350eac=_0x536132[0x0],_0x2b5795=!_0x350eac&&!!_0x2de96c[_0x29c5d1(0x11a)],_0x5f5d63=_0x350eac||_0x2de96c[_0x29c5d1(0x11a)];if(!_0x5f5d63)return console['error']('Error:\x20Path\x20or\x20name\x20is\x20required'),console[_0x29c5d1(0x158)](_0x29c5d1(0x187)),console[_0x29c5d1(0x158)](_0x29c5d1(0xf6)),console['error'](_0x29c5d1(0x119)),console[_0x29c5d1(0x158)](_0x29c5d1(0xfc)),console['error'](_0x29c5d1(0x116)),console[_0x29c5d1(0x158)](_0x29c5d1(0xf8)),0x1;try{const _0x34adf1=_0x2de96c[_0x29c5d1(0x102)];let _0x33e908=_0x5f5d63;!_0x2b5795&&_0x34adf1&&!_0x5f5d63[_0x29c5d1(0xf5)]('/')&&(_0x33e908=_0x34adf1+'/'+_0x5f5d63,_0x2de96c[_0x29c5d1(0x127)]&&console[_0x29c5d1(0x158)](_0x29c5d1(0x17a)+_0x33e908));const _0x1eaea4=await withSpinner('Resolving\x20path\x20\x27'+_0x33e908+_0x29c5d1(0x17d),()=>_0x1b5f1e[_0x29c5d1(0x154)][_0x29c5d1(0x164)](_0x33e908),{'verbose':_0x2de96c['verbose']}),_0x273cc2=_0x1eaea4['data'];_0x2de96c[_0x29c5d1(0x127)]&&(console[_0x29c5d1(0x158)]('Resolved\x20type:\x20'+_0x273cc2[_0x29c5d1(0x15d)]),console['error']('Parent\x20ID:\x20'+_0x273cc2[_0x29c5d1(0x10a)]),_0x273cc2[_0x29c5d1(0x174)]&&console[_0x29c5d1(0x158)](_0x29c5d1(0xee)+_0x273cc2[_0x29c5d1(0x174)]),_0x273cc2[_0x29c5d1(0x190)]&&console[_0x29c5d1(0x158)]('Segment\x20ID:\x20'+_0x273cc2[_0x29c5d1(0x190)]));if(_0x273cc2[_0x29c5d1(0x15d)]===_0x29c5d1(0x125)){const _0x3ace6a=await withSpinner(_0x29c5d1(0x15e),()=>_0x1b5f1e[_0x29c5d1(0x154)][_0x29c5d1(0xff)](_0x273cc2['parentId']),{'verbose':_0x2de96c[_0x29c5d1(0x127)]});await handleSingleObjectOutput(_0x3ace6a[_0x29c5d1(0x137)],_0x2de96c);}else{if(_0x273cc2[_0x29c5d1(0x15d)]===_0x29c5d1(0xef)){if(!_0x273cc2[_0x29c5d1(0x174)])throw new SDKError(ErrorCode[_0x29c5d1(0x163)],_0x29c5d1(0x18a));const _0x287513=await withSpinner(_0x29c5d1(0x165),()=>_0x1b5f1e['segment'][_0x29c5d1(0xfd)](_0x273cc2[_0x29c5d1(0x174)]),{'verbose':_0x2de96c[_0x29c5d1(0x127)]});await handleSingleObjectOutput(_0x287513[_0x29c5d1(0x137)],_0x2de96c);}else{if(_0x273cc2[_0x29c5d1(0x15d)]===_0x29c5d1(0x154)){if(!_0x273cc2[_0x29c5d1(0x190)])throw new SDKError(ErrorCode[_0x29c5d1(0x103)],_0x29c5d1(0x12d));const _0x561c07=await withSpinner(_0x29c5d1(0x185),()=>_0x1b5f1e[_0x29c5d1(0x154)]['getSegment'](_0x273cc2[_0x29c5d1(0x10a)],_0x273cc2['segmentId']),{'verbose':_0x2de96c[_0x29c5d1(0x127)]});await handleSingleObjectOutput(_0x561c07[_0x29c5d1(0x137)],_0x2de96c);}}}return 0x0;}catch(_0x5e1a9e){if(_0x5e1a9e instanceof SDKError)return console[_0x29c5d1(0x158)](_0x29c5d1(0x134)+_0x5e1a9e[_0x29c5d1(0x148)]),_0x5e1a9e[_0x29c5d1(0x14a)]&&console[_0x29c5d1(0x158)](_0x29c5d1(0xfb)+_0x5e1a9e[_0x29c5d1(0x14a)]),0x1;throw _0x5e1a9e;}}}export class SegmentShowCommand extends BaseCommand{[a37_0x494e84(0x110)]=a37_0x494e84(0x10e);[a37_0x494e84(0x130)]=a37_0x494e84(0x138);async[a37_0x494e84(0x152)](_0x9329f6){const _0x41b96e=a37_0x494e84,{options:_0x4b9809,args:_0x57b28e,tdx:_0x228fc8}=_0x9329f6,_0x5e2667=_0x57b28e[0x0];if(!_0x5e2667)return console[_0x41b96e(0x158)](_0x41b96e(0x18e)),console[_0x41b96e(0x158)](_0x41b96e(0x168)),console[_0x41b96e(0x158)]('\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20show\x20<path/to/segment.yml>'),console[_0x41b96e(0x158)](_0x41b96e(0xf6)),console['error']('\x20\x20tdx\x20sg\x20show\x20\x22Premium\x20Users\x22'),console['error'](_0x41b96e(0x12f)),0x1;try{const _0x496559=_0x4b9809['parentSegment'],_0x4650c6=await resolveSegmentTarget(_0x5e2667,_0x496559,_0x4b9809[_0x41b96e(0x127)]);_0x4b9809['verbose']&&console[_0x41b96e(0x158)](_0x41b96e(0x113)+_0x4650c6);const _0x14d8f6=await withSpinner(_0x41b96e(0x131)+_0x5e2667+_0x41b96e(0x17d),()=>_0x228fc8[_0x41b96e(0x154)][_0x41b96e(0x164)](_0x4650c6),{'verbose':_0x4b9809['verbose']}),_0x59b1d9=_0x14d8f6[_0x41b96e(0x137)];_0x4b9809[_0x41b96e(0x127)]&&(console[_0x41b96e(0x158)](_0x41b96e(0x11c)+_0x59b1d9[_0x41b96e(0x15d)]),console['error']('Parent\x20ID:\x20'+_0x59b1d9[_0x41b96e(0x10a)]));if(_0x59b1d9['type']===_0x41b96e(0xef))return console['error'](_0x41b96e(0xfa)),console['error'](_0x41b96e(0xfe)),0x1;if(_0x59b1d9[_0x41b96e(0x15d)]===_0x41b96e(0x125))return console['error']('Error:\x20Cannot\x20execute\x20query\x20for\x20parent\x20segment\x20with\x20this\x20command.'),console[_0x41b96e(0x158)](_0x41b96e(0x16b)),0x1;if(!_0x59b1d9[_0x41b96e(0x190)])throw new SDKError(ErrorCode[_0x41b96e(0x103)],_0x41b96e(0x12d));const _0x5ecb1a=await withSpinner(_0x41b96e(0x16a),()=>_0x228fc8[_0x41b96e(0x154)][_0x41b96e(0x18b)](_0x59b1d9['parentId'],_0x59b1d9[_0x41b96e(0x190)]),{'verbose':_0x4b9809['verbose']});let _0xd91a93=_0x5ecb1a[_0x41b96e(0x137)];const _0x546afe=resolveLimit(_0x4b9809[_0x41b96e(0x11f)],DEFAULT_DISPLAY_LIMIT),_0x37bd74=/\bLIMIT\s+\d+/i[_0x41b96e(0x147)](_0xd91a93);!_0x37bd74&&(_0xd91a93=_0xd91a93[_0x41b96e(0x18d)]()['replace'](/;+$/,''),_0xd91a93=_0x41b96e(0x17f)+_0xd91a93+'\x0a)\x20AS\x20segment_query\x0aLIMIT\x20'+_0x546afe);_0x4b9809['verbose']&&console[_0x41b96e(0x158)](_0x41b96e(0x108)+_0xd91a93);const _0x3e49fb=await withProgressSpinner(_0x41b96e(0x18c),async _0x5d84a6=>{const _0x20e25d=_0x41b96e,_0x323e70=await _0x228fc8[_0x20e25d(0x121)][_0x20e25d(0x152)](_0xd91a93,{'catalog':'td','schema':_0x20e25d(0x104),'onJobId':_0x3c8e31=>{const _0x47360d=_0x20e25d;_0x5d84a6[_0x47360d(0x184)](_0x3c8e31);}});return _0x323e70;},{'verbose':_0x4b9809['verbose']}),_0x1decb5=_0x3e49fb[_0x41b96e(0x137)],_0x161310=_0x1decb5['jobId']?_0x41b96e(0x120)+_0x1decb5[_0x41b96e(0x118)]+']':'';return console[_0x41b96e(0x158)]('✔\x20Query\x20completed:\x20Processed\x20'+_0x1decb5[_0x41b96e(0x100)][_0x41b96e(0x17b)][_0x41b96e(0x101)]()+_0x41b96e(0x140)+(_0x41b96e(0x159)+formatElapsed(_0x1decb5[_0x41b96e(0x100)][_0x41b96e(0x136)])+_0x161310)),await handleQueryOutput(_0x1decb5,_0x4b9809),0x0;}catch(_0x472fa0){if(_0x472fa0 instanceof SDKError)return console[_0x41b96e(0x158)]('✖\x20Query\x20failed\x20['+_0x472fa0[_0x41b96e(0x193)]+']'),console[_0x41b96e(0x158)]('\x0a'+_0x472fa0[_0x41b96e(0x148)]),0x1;throw _0x472fa0;}}}export class SegmentFolderListCommand extends BaseCommand{[a37_0x494e84(0x110)]=a37_0x494e84(0x171);[a37_0x494e84(0x130)]=a37_0x494e84(0x10b);async[a37_0x494e84(0x152)](_0x1b8edb){const _0x37535a=a37_0x494e84,{options:_0x1b012f,args:_0x157245,tdx:_0x105113}=_0x1b8edb;if(_0x157245[_0x37535a(0x144)]===0x0)return console[_0x37535a(0x158)](_0x37535a(0x14b)),console[_0x37535a(0x158)](_0x37535a(0x128)),0x1;const _0x351217=_0x157245[0x0];try{_0x1b012f[_0x37535a(0x127)]&&(console[_0x37535a(0x158)]('Site:\x20'+_0x1b012f['site']),console[_0x37535a(0x158)](_0x37535a(0x13b)+_0x351217));const _0xf204d1=await withSpinner(_0x37535a(0xf7)+_0x351217+_0x37535a(0x17d),()=>_0x105113[_0x37535a(0x154)][_0x37535a(0x129)](_0x351217),{'verbose':_0x1b012f['verbose']}),_0x5b1da0=_0xf204d1[_0x37535a(0x137)];_0x1b012f[_0x37535a(0x127)]&&console[_0x37535a(0x158)]('Resolved\x20parent\x20ID:\x20'+_0x5b1da0);const _0x33171c=await withSpinner(_0x37535a(0x139)+_0x351217+_0x37535a(0x17d),()=>_0x105113['segment'][_0x37535a(0x133)](_0x5b1da0),{'verbose':_0x1b012f[_0x37535a(0x127)]}),_0x5851ef=_0x33171c[_0x37535a(0x137)];return console[_0x37535a(0x158)](_0x37535a(0x13e)+_0x5851ef[_0x37535a(0x144)]+_0x37535a(0x112)+(_0x5851ef['length']!==0x1?'s':'')),await handleSDKOutput(_0x5851ef,_0x1b012f),0x0;}catch(_0x455f3f){if(_0x455f3f instanceof SDKError)return console[_0x37535a(0x158)]('Error:\x20'+_0x455f3f[_0x37535a(0x148)]),_0x455f3f[_0x37535a(0x14a)]&&console[_0x37535a(0x158)](_0x37535a(0xfb)+_0x455f3f[_0x37535a(0x14a)]),0x1;throw _0x455f3f;}}}export class SegmentFolderShowCommand extends BaseCommand{['name']='segment:folder:show';[a37_0x494e84(0x130)]='Show\x20segment\x20folder\x20details';async['execute'](_0x22dc32){const _0x3c7667=a37_0x494e84,{options:_0x5d79f0,args:_0x25b9f2,tdx:_0x3cf0d2}=_0x22dc32;if(_0x25b9f2[_0x3c7667(0x144)]===0x0)return console[_0x3c7667(0x158)](_0x3c7667(0x17e)),console[_0x3c7667(0x158)](_0x3c7667(0x15b)),0x1;try{const {parentId:_0x5b5730,childId:_0x2d8e4d}=parseSegmentRef(_0x25b9f2[0x0]);_0x5d79f0[_0x3c7667(0x127)]&&(console[_0x3c7667(0x158)](_0x3c7667(0x13f)+_0x5d79f0[_0x3c7667(0x192)]),console[_0x3c7667(0x158)](_0x3c7667(0x13b)+_0x5b5730),_0x2d8e4d&&console['error'](_0x3c7667(0xf3)+_0x2d8e4d));if(!_0x2d8e4d)return console['error'](_0x3c7667(0x10d)),0x1;const _0xab2dce=await withSpinner(_0x3c7667(0xf7)+_0x5b5730+_0x3c7667(0x17d),()=>_0x3cf0d2[_0x3c7667(0x154)][_0x3c7667(0x129)](_0x5b5730),{'verbose':_0x5d79f0[_0x3c7667(0x127)]}),_0x1abae1=_0xab2dce['data'];_0x5d79f0[_0x3c7667(0x127)]&&console['error'](_0x3c7667(0x157)+_0x1abae1);const _0x4d16b8=await withSpinner('Resolving\x20folder\x20\x27'+_0x2d8e4d+_0x3c7667(0x17d),()=>_0x3cf0d2[_0x3c7667(0x154)][_0x3c7667(0x16e)](_0x1abae1,_0x2d8e4d),{'verbose':_0x5d79f0[_0x3c7667(0x127)]}),_0x518459=_0x4d16b8[_0x3c7667(0x137)];_0x5d79f0['verbose']&&console[_0x3c7667(0x158)](_0x3c7667(0x188)+_0x518459);const _0x5824e8=await withSpinner(_0x3c7667(0x15f)+_0x2d8e4d+'\x27...',()=>_0x3cf0d2[_0x3c7667(0x154)][_0x3c7667(0xfd)](_0x518459),{'verbose':_0x5d79f0[_0x3c7667(0x127)]});return await handleSDKOutput([_0x5824e8['data']],_0x5d79f0),0x0;}catch(_0x4267e9){if(_0x4267e9 instanceof SDKError)return console[_0x3c7667(0x158)](_0x3c7667(0x134)+_0x4267e9[_0x3c7667(0x148)]),_0x4267e9[_0x3c7667(0x14a)]&&console[_0x3c7667(0x158)]('\x20\x20Cause:\x20'+_0x4267e9[_0x3c7667(0x14a)]),0x1;throw _0x4267e9;}}}export class SegmentSQLCommand extends BaseCommand{['name']=a37_0x494e84(0x183);['description']=a37_0x494e84(0x150);async['execute'](_0x518d53){const _0x133d04=a37_0x494e84,{options:_0x5a3e49,args:_0xaaff30}=_0x518d53,_0x21c5fa=_0x5a3e49,_0x16b26c=_0x21c5fa['path'],_0x360538=_0xaaff30[0x0];if(!_0x360538&&!_0x16b26c)return console[_0x133d04(0x158)](a37_0x37d081[_0x133d04(0x111)](_0x133d04(0x13c))),console[_0x133d04(0x158)](_0x133d04(0x16c)),console['error'](_0x133d04(0x12b)),console[_0x133d04(0x158)](_0x133d04(0x151)),console[_0x133d04(0x158)](_0x133d04(0xf6)),console['error']('\x20\x20tdx\x20sg\x20sql\x20\x22Premium\x20Users\x22'),console[_0x133d04(0x158)]('\x20\x20tdx\x20sg\x20sql\x20--path\x20segments/my-audience/premium-users.yml'),0x1;if(_0x360538&&_0x16b26c)return console['error'](a37_0x37d081['red'](_0x133d04(0x132))),0x1;try{let _0x33adc6;if(_0x16b26c)_0x33adc6=await this[_0x133d04(0x189)](_0x16b26c,_0x518d53);else{if(isYamlFilePath(_0x360538))return console[_0x133d04(0x158)](a37_0x37d081[_0x133d04(0x111)]('Error:\x20YAML\x20file\x20paths\x20must\x20be\x20specified\x20with\x20--path\x20option')),console['error'](_0x133d04(0x145)+_0x360538),0x1;else _0x33adc6=await this['getSQLFromServerSegment'](_0x360538,_0x518d53);}return _0x5a3e49[_0x133d04(0x155)]==='json'||_0x5a3e49[_0x133d04(0x155)]===_0x133d04(0x142)?await handleSDKOutput([{'sql':_0x33adc6}],_0x5a3e49):console[_0x133d04(0x18f)](_0x33adc6),0x0;}catch(_0x456c65){if(_0x456c65 instanceof SDKError)return console['error'](_0x133d04(0x134)+_0x456c65[_0x133d04(0x148)]),_0x456c65[_0x133d04(0x14a)]&&console[_0x133d04(0x158)]('\x20\x20Cause:\x20'+_0x456c65['cause']),0x1;throw _0x456c65;}}async['getSQLFromYamlFile'](_0x4f5b7e,_0x5aec7e){const _0x2c466d=a37_0x494e84,{options:_0x49ed0d,tdx:_0x18afdd}=_0x5aec7e;let _0x284676;try{_0x284676=await resolveYamlFilePath(_0x4f5b7e);}catch(_0x10edba){throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x2c466d(0x105)+_0x10edba[_0x2c466d(0x148)]);}_0x49ed0d[_0x2c466d(0x127)]&&console[_0x2c466d(0x158)]('Resolved:\x20'+_0x284676[_0x2c466d(0x11a)]+'/'+_0x284676[_0x2c466d(0x156)]);const _0x565474=await withSpinner(_0x2c466d(0x161),()=>_0x18afdd[_0x2c466d(0x154)][_0x2c466d(0x115)](_0x284676[_0x2c466d(0x191)],_0x284676[_0x2c466d(0x11a)],_0x284676['segmentName']),{'verbose':_0x49ed0d[_0x2c466d(0x127)]});return _0x565474[_0x2c466d(0x137)];}async[a37_0x494e84(0x107)](_0x33671c,_0x1599e4){const _0x3c0195=a37_0x494e84,{options:_0x59e37c,tdx:_0x322616}=_0x1599e4,_0x32a53d=_0x59e37c[_0x3c0195(0x11a)],_0x2fecdd=await resolveSegmentTarget(_0x33671c,_0x32a53d,_0x59e37c['verbose']);_0x59e37c[_0x3c0195(0x127)]&&console[_0x3c0195(0x158)](_0x3c0195(0x113)+_0x2fecdd);const _0x442ab2=await withSpinner(_0x3c0195(0x131)+_0x33671c+'\x27...',()=>_0x322616[_0x3c0195(0x154)]['resolvePathToResource'](_0x2fecdd),{'verbose':_0x59e37c[_0x3c0195(0x127)]}),_0x4faaac=_0x442ab2['data'];_0x59e37c[_0x3c0195(0x127)]&&(console['error']('Resolved\x20type:\x20'+_0x4faaac[_0x3c0195(0x15d)]),console[_0x3c0195(0x158)]('Parent\x20ID:\x20'+_0x4faaac[_0x3c0195(0x10a)]));if(_0x4faaac[_0x3c0195(0x15d)]===_0x3c0195(0xef))throw new SDKError(ErrorCode['INVALID_ARGUMENT'],'Cannot\x20get\x20SQL\x20query\x20for\x20a\x20folder.\x20Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.');if(_0x4faaac[_0x3c0195(0x15d)]===_0x3c0195(0x125))throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x3c0195(0x176));if(!_0x4faaac[_0x3c0195(0x190)])throw new SDKError(ErrorCode[_0x3c0195(0x103)],_0x3c0195(0x12d));const _0x4d8630=await withSpinner(_0x3c0195(0x16a),()=>_0x322616[_0x3c0195(0x154)]['getSegmentSQL'](_0x4faaac['parentId'],_0x4faaac['segmentId']),{'verbose':_0x59e37c[_0x3c0195(0x127)]});return _0x4d8630[_0x3c0195(0x137)];}}export class SegmentFolderCreateCommand extends BaseCommand{[a37_0x494e84(0x110)]=a37_0x494e84(0xf0);[a37_0x494e84(0x130)]=a37_0x494e84(0x13d);async[a37_0x494e84(0x152)](_0x2f0e99){const _0x17deda=a37_0x494e84,{options:_0x17df8b,args:_0x10432b,tdx:_0x5f3893}=_0x2f0e99,_0x3b0967=_0x17df8b;if(_0x10432b[_0x17deda(0x144)]<0x2)return console[_0x17deda(0x158)](_0x17deda(0x109)),console[_0x17deda(0x158)](_0x17deda(0x160)),0x1;const _0x5ae87f=_0x10432b[0x0],_0x1c525b=_0x10432b[0x1];_0x3b0967[_0x17deda(0x127)]&&(console[_0x17deda(0x158)](_0x17deda(0x13f)+_0x3b0967[_0x17deda(0x192)]),console[_0x17deda(0x158)](_0x17deda(0x17c)+_0x5ae87f),console[_0x17deda(0x158)](_0x17deda(0xf3)+_0x1c525b));let _0x381084;if(_0x3b0967[_0x17deda(0x16d)]){const _0x1e6810=_0x3b0967['parentFolder'],_0x313367=await withSpinner(_0x17deda(0xf7)+_0x5ae87f+_0x17deda(0x17d),()=>_0x5f3893['segment'][_0x17deda(0x129)](_0x5ae87f),{'verbose':_0x3b0967[_0x17deda(0x127)]}),_0x2dcb7e=_0x313367[_0x17deda(0x137)],_0x1b8ac3=await withSpinner(_0x17deda(0x14e)+_0x1e6810+_0x17deda(0x17d),()=>_0x5f3893[_0x17deda(0x154)][_0x17deda(0x16e)](_0x2dcb7e,_0x1e6810),{'verbose':_0x3b0967[_0x17deda(0x127)]});_0x381084=_0x1b8ac3[_0x17deda(0x137)],_0x3b0967['verbose']&&console['error'](_0x17deda(0x122)+_0x381084);}const _0xb77901={'name':_0x1c525b,'description':_0x3b0967[_0x17deda(0x130)],'parentFolderId':_0x381084},_0x1bb232=await withSpinner(_0x17deda(0x12e)+_0x1c525b+_0x17deda(0x17d),()=>_0x5f3893[_0x17deda(0x154)][_0x17deda(0x146)](_0x5ae87f,_0xb77901),{'verbose':_0x3b0967[_0x17deda(0x127)]}),_0x105354=_0x1bb232['data'];return console[_0x17deda(0x158)](_0x17deda(0x173)+_0x105354['name']+_0x17deda(0x14c)+_0x105354['id']),await handleSDKOutput([_0x105354],_0x3b0967),0x0;}}export class SegmentViewCommand extends BaseCommand{[a37_0x494e84(0x110)]='segment:view';[a37_0x494e84(0x130)]=a37_0x494e84(0x123);async[a37_0x494e84(0x152)](_0x731413){const _0x5edf27=a37_0x494e84,{options:_0x275a93,args:_0x36b42e,tdx:_0x2fa0da}=_0x731413,_0x3a8183=_0x36b42e[0x0];if(!_0x3a8183)return console[_0x5edf27(0x158)](_0x5edf27(0xf9)),console[_0x5edf27(0x158)](_0x5edf27(0x11d)),console[_0x5edf27(0x158)](_0x5edf27(0xf2)),console[_0x5edf27(0x158)]('Options:'),console[_0x5edf27(0x158)](_0x5edf27(0x179)),console[_0x5edf27(0x158)]('Examples:'),console[_0x5edf27(0x158)](_0x5edf27(0x169)),console[_0x5edf27(0x158)]('\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20\x20\x20\x20\x20#\x20View\x20child\x20segment\x20details'),console[_0x5edf27(0x158)](_0x5edf27(0x153)),console[_0x5edf27(0x158)]('\x20\x20tdx\x20sg\x20view\x20segments/my-audience/premium-users.yml'),0x1;try{const _0x36fe2a=_0x275a93[_0x5edf27(0x11a)],_0x275426=await resolveSegmentTarget(_0x3a8183,_0x36fe2a,_0x275a93['verbose']);_0x275a93['verbose']&&console[_0x5edf27(0x158)](_0x5edf27(0x113)+_0x275426);const _0x1ca721=await withSpinner(_0x5edf27(0x131)+_0x3a8183+'\x27...',()=>_0x2fa0da[_0x5edf27(0x154)][_0x5edf27(0x164)](_0x275426),{'verbose':_0x275a93[_0x5edf27(0x127)]}),_0x539e0d=_0x1ca721['data'];_0x275a93[_0x5edf27(0x127)]&&(console['error'](_0x5edf27(0x11c)+_0x539e0d['type']),console[_0x5edf27(0x158)](_0x5edf27(0x106)+_0x539e0d[_0x5edf27(0x10a)]),_0x539e0d[_0x5edf27(0x174)]&&console[_0x5edf27(0x158)](_0x5edf27(0xee)+_0x539e0d[_0x5edf27(0x174)]),_0x539e0d['segmentId']&&console['error']('Segment\x20ID:\x20'+_0x539e0d[_0x5edf27(0x190)]));if(_0x275a93[_0x5edf27(0x170)]){if(_0x539e0d['type']==='folder')return console['error'](_0x5edf27(0x12a)),0x1;if(_0x539e0d[_0x5edf27(0x15d)]===_0x5edf27(0x125))return console[_0x5edf27(0x158)](_0x5edf27(0x141)),console['error'](_0x5edf27(0x143)),0x1;if(!_0x539e0d['segmentId'])throw new SDKError(ErrorCode[_0x5edf27(0x103)],_0x5edf27(0x12d));const _0x18880a=getConsoleNextUrl(_0x275a93[_0x5edf27(0x192)],'/app/ps/'+_0x539e0d[_0x5edf27(0x10a)]+_0x5edf27(0x186)+_0x539e0d[_0x5edf27(0x190)]);return console['error'](a37_0x37d081['green']('✔')+_0x5edf27(0x10c)+a37_0x37d081[_0x5edf27(0x177)](_0x18880a)),openBrowser(_0x18880a),0x0;}if(_0x539e0d['type']===_0x5edf27(0xef)){if(!_0x539e0d[_0x5edf27(0x174)])throw new SDKError(ErrorCode[_0x5edf27(0x163)],_0x5edf27(0x18a));const _0x473104=await withSpinner('Fetching\x20folder\x20details...',()=>_0x2fa0da[_0x5edf27(0x154)][_0x5edf27(0xfd)](_0x539e0d['folderId']),{'verbose':_0x275a93[_0x5edf27(0x127)]});await handleSingleObjectOutput(_0x473104[_0x5edf27(0x137)],_0x275a93);}else{if(_0x539e0d[_0x5edf27(0x15d)]==='segment'){if(!_0x539e0d[_0x5edf27(0x190)])throw new SDKError(ErrorCode[_0x5edf27(0x103)],_0x5edf27(0x12d));const _0x242dc7=await withSpinner(_0x5edf27(0x185),()=>_0x2fa0da[_0x5edf27(0x154)]['getSegment'](_0x539e0d['parentId'],_0x539e0d[_0x5edf27(0x190)]),{'verbose':_0x275a93[_0x5edf27(0x127)]}),_0x92371c=getConsoleNextUrl(_0x275a93['site'],_0x5edf27(0x126)+_0x539e0d[_0x5edf27(0x10a)]+_0x5edf27(0x186)+_0x539e0d[_0x5edf27(0x190)]),_0x20fbf8=_0x242dc7['data'];_0x20fbf8['url']=_0x92371c,await handleSingleObjectOutput(_0x20fbf8,_0x275a93);}else return console[_0x5edf27(0x158)](_0x5edf27(0x172)),console[_0x5edf27(0x158)](_0x5edf27(0x114)),0x1;}return 0x0;}catch(_0x4f8a65){if(_0x4f8a65 instanceof SDKError)return console[_0x5edf27(0x158)](_0x5edf27(0x134)+_0x4f8a65[_0x5edf27(0x148)]),_0x4f8a65[_0x5edf27(0x14a)]&&console[_0x5edf27(0x158)](_0x5edf27(0xfb)+_0x4f8a65[_0x5edf27(0x14a)]),0x1;throw _0x4f8a65;}}}export const SegmentInfoCommand=SegmentViewCommand;export class SegmentDescCommand extends BaseCommand{[a37_0x494e84(0x110)]=a37_0x494e84(0x10f);[a37_0x494e84(0x130)]='Show\x20child\x20segment\x20schema\x20(column\x20types)';async['execute'](_0x503a9c){const _0xfc2837=a37_0x494e84,{options:_0x5f4f39,args:_0x1013e1,tdx:_0x1d9b11}=_0x503a9c,_0x160678=_0x1013e1[0x0];if(!_0x160678)return console[_0xfc2837(0x158)](_0xfc2837(0x18e)),console['error']('Usage:\x20tdx\x20sg\x20desc\x20<name>'),console[_0xfc2837(0x158)](_0xfc2837(0x15a)),console[_0xfc2837(0x158)](_0xfc2837(0xf6)),console[_0xfc2837(0x158)](_0xfc2837(0x135)),console[_0xfc2837(0x158)](_0xfc2837(0x182)),0x1;try{const _0x238bfe=_0x5f4f39[_0xfc2837(0x11a)],_0x339b57=await resolveSegmentTarget(_0x160678,_0x238bfe,_0x5f4f39[_0xfc2837(0x127)]);_0x5f4f39[_0xfc2837(0x127)]&&console['error'](_0xfc2837(0x113)+_0x339b57);const _0x5e6bf9=await withSpinner('Resolving\x20\x27'+_0x160678+_0xfc2837(0x17d),()=>_0x1d9b11[_0xfc2837(0x154)][_0xfc2837(0x164)](_0x339b57),{'verbose':_0x5f4f39[_0xfc2837(0x127)]}),_0x8c74ed=_0x5e6bf9[_0xfc2837(0x137)];_0x5f4f39['verbose']&&(console[_0xfc2837(0x158)](_0xfc2837(0x11c)+_0x8c74ed[_0xfc2837(0x15d)]),console[_0xfc2837(0x158)](_0xfc2837(0x106)+_0x8c74ed[_0xfc2837(0x10a)]));if(_0x8c74ed[_0xfc2837(0x15d)]==='folder')return console['error'](_0xfc2837(0x166)),console[_0xfc2837(0x158)](_0xfc2837(0x178)),0x1;if(_0x8c74ed[_0xfc2837(0x15d)]===_0xfc2837(0x125))return console[_0xfc2837(0x158)](_0xfc2837(0x124)),console[_0xfc2837(0x158)]('Use:\x20tdx\x20ps\x20desc'),0x1;if(!_0x8c74ed['segmentId'])throw new SDKError(ErrorCode[_0xfc2837(0x103)],_0xfc2837(0x12d));const _0x40afad=await withSpinner(_0xfc2837(0x16a),()=>_0x1d9b11[_0xfc2837(0x154)][_0xfc2837(0x18b)](_0x8c74ed[_0xfc2837(0x10a)],_0x8c74ed[_0xfc2837(0x190)]),{'verbose':_0x5f4f39[_0xfc2837(0x127)]}),_0x11e795=_0x40afad[_0xfc2837(0x137)],_0xfb98fa=await executeSchemaQuery(_0x11e795,_0x1d9b11,_0x5f4f39);return await handleQueryOutput(_0xfb98fa,_0x5f4f39),0x0;}catch(_0xab55f){if(_0xab55f instanceof SDKError)return console['error']('Error:\x20'+_0xab55f[_0xfc2837(0x148)]),_0xab55f['cause']&&console['error'](_0xfc2837(0xfb)+_0xab55f[_0xfc2837(0x14a)]),0x1;throw _0xab55f;}}}
@@ -1 +1 @@
1
- const a38_0x4ad0ff=a38_0x4b2b;(function(_0x24eb00,_0x3c5ce3){const _0xa0a6a0=a38_0x4b2b,_0x5f4bbd=_0x24eb00();while(!![]){try{const _0x384137=parseInt(_0xa0a6a0(0x153))/0x1*(parseInt(_0xa0a6a0(0x143))/0x2)+parseInt(_0xa0a6a0(0x144))/0x3*(-parseInt(_0xa0a6a0(0x135))/0x4)+parseInt(_0xa0a6a0(0x145))/0x5*(-parseInt(_0xa0a6a0(0x136))/0x6)+parseInt(_0xa0a6a0(0x134))/0x7*(-parseInt(_0xa0a6a0(0x148))/0x8)+parseInt(_0xa0a6a0(0x131))/0x9+-parseInt(_0xa0a6a0(0x155))/0xa+parseInt(_0xa0a6a0(0x12d))/0xb;if(_0x384137===_0x3c5ce3)break;else _0x5f4bbd['push'](_0x5f4bbd['shift']());}catch(_0x448213){_0x5f4bbd['push'](_0x5f4bbd['shift']());}}}(a38_0x2f7a,0xdb676));import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../core/command-output.js';function a38_0x2f7a(){const _0x3ece54=['Create\x20child\x20segment\x20with\x20filtering\x20rules','8317001zuPtTA','8XUuVOM','102fHCWyS','name','createSegment','segments','rule','Error:\x20Full\x20path\x20required\x20(parent/segment_name\x20or\x20parent/folder/segment_name)','verbose','Parent\x20path:\x20','Usage:\x20tdx\x20segment\x20create\x20<parent/segment_name>\x20[options]','Usage:\x20tdx\x20segment\x20create\x20<path>\x20[options]','\x27\x20with\x20ID:\x20','folder','type','1306pZvWew','460563CnenOp','489605HTzTNK','\x20\x20Use\x20`tdx\x20sg\x20push`\x20with\x20YAML\x20files\x20instead.\x0a','yellow','8XzdDjd','length','Resolving\x20parent\x20segment\x20\x27','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/High\x20Value\x22\x20--rule\x20\x27...\x27','✔\x20Created\x20segment\x20\x27','kind','Resolving\x20folder\x20path\x20\x27','Resolved\x20folder\x20ID:\x20','segment','ruleFile','includes','2556kVnIzP','parent','10638240EjIEma','description','folderId','error','\x27...','\x20\x20\x20Path:\x20','Creating\x20segment\x20\x27','invisible','data','segment:create','20274529birkPU','Target\x20path:\x20','site','noCountPopulation','14491233nkvsSl','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/Marketing/Premium\x22\x20--rule\x20\x27...\x27'];a38_0x2f7a=function(){return _0x3ece54;};return a38_0x2f7a();}import{withSpinner}from'../utils/spinner.js';function a38_0x4b2b(_0x3d7ca7,_0x2ea350){_0x3d7ca7=_0x3d7ca7-0x124;const _0x2f7a34=a38_0x2f7a();let _0x4b2bb9=_0x2f7a34[_0x3d7ca7];return _0x4b2bb9;}import{loadJSONFromOptions}from'../utils/json-loader.js';import{parsePath,getParentPath,getBaseName}from'../sdk/segment/segment-path-parser.js';import a38_0x2a5f8e from'chalk';export class SegmentCreateCommand extends BaseCommand{[a38_0x4ad0ff(0x137)]=a38_0x4ad0ff(0x12c);['description']=a38_0x4ad0ff(0x133);async['execute'](_0xa4cfb2){const _0x1813e6=a38_0x4ad0ff;console[_0x1813e6(0x126)](a38_0x2a5f8e[_0x1813e6(0x147)]('⚠\x20Deprecation\x20warning:\x20`segment\x20create`\x20is\x20deprecated.')),console[_0x1813e6(0x126)](a38_0x2a5f8e[_0x1813e6(0x147)](_0x1813e6(0x146)));const {options:_0x1e1bb1,args:_0x164318,tdx:_0xc841bb}=_0xa4cfb2,_0x1218d2=_0x1e1bb1;if(_0x164318[_0x1813e6(0x149)]===0x0)return console[_0x1813e6(0x126)]('Error:\x20Segment\x20path\x20or\x20name\x20is\x20required'),console['error'](_0x1813e6(0x13f)),console[_0x1813e6(0x126)]('Examples:'),console[_0x1813e6(0x126)](_0x1813e6(0x14b)),console[_0x1813e6(0x126)](_0x1813e6(0x132)),console[_0x1813e6(0x126)]('\x20\x20tdx\x20segment\x20create\x20\x22Premium\x22\x20--rule\x20\x27...\x27\x20\x20#\x20Relative\x20to\x20context'),0x1;const _0x5d6066=_0x164318[0x0],_0x2b3175=_0x1e1bb1['segmentPath'];let _0x2ea68a=_0x5d6066;_0x2b3175&&!_0x5d6066[_0x1813e6(0x152)]('/')&&(_0x2ea68a=_0x2b3175+'/'+_0x5d6066,_0x1218d2[_0x1813e6(0x13c)]&&console[_0x1813e6(0x126)]('Resolved\x20relative\x20path\x20to:\x20'+_0x2ea68a));const _0x2c4e5e=parsePath(_0x2ea68a);if(_0x2c4e5e[_0x1813e6(0x139)][_0x1813e6(0x149)]<0x2)return console[_0x1813e6(0x126)](_0x1813e6(0x13b)),console[_0x1813e6(0x126)](_0x1813e6(0x13e)),0x1;const _0x559197=_0x2c4e5e['segments'][0x0],_0x42e61d=getBaseName(_0x2ea68a),_0x368fec=getParentPath(_0x2ea68a);_0x1218d2[_0x1813e6(0x13c)]&&(console[_0x1813e6(0x126)]('Site:\x20'+_0x1218d2[_0x1813e6(0x12f)]),console[_0x1813e6(0x126)](_0x1813e6(0x12e)+_0x2ea68a),console[_0x1813e6(0x126)]('Parent:\x20'+_0x559197),console['error']('Segment\x20name:\x20'+_0x42e61d),console[_0x1813e6(0x126)](_0x1813e6(0x13d)+_0x368fec));const _0x2816ef=await withSpinner(_0x1813e6(0x14a)+_0x559197+_0x1813e6(0x127),()=>_0xc841bb[_0x1813e6(0x150)]['resolveParentId'](_0x559197),{'verbose':_0x1218d2[_0x1813e6(0x13c)]}),_0x11a71f=_0x2816ef[_0x1813e6(0x12b)];let _0xc245fe;if(_0x2c4e5e['segments'][_0x1813e6(0x149)]>0x2){const _0x409a7f=await withSpinner(_0x1813e6(0x14e)+_0x368fec+_0x1813e6(0x127),()=>_0xc841bb[_0x1813e6(0x150)]['resolvePathToResource'](_0x368fec),{'verbose':_0x1218d2['verbose']}),_0x1a8ff0=_0x409a7f[_0x1813e6(0x12b)];if(_0x1a8ff0[_0x1813e6(0x142)]!==_0x1813e6(0x141)&&_0x1a8ff0[_0x1813e6(0x142)]!==_0x1813e6(0x154))return console[_0x1813e6(0x126)]('Error:\x20Cannot\x20create\x20segment\x20in\x20a\x20segment.\x20Parent\x20path\x20must\x20be\x20a\x20folder\x20or\x20parent.'),0x1;_0xc245fe=_0x1a8ff0[_0x1813e6(0x125)];}else{if(_0x1218d2[_0x1813e6(0x141)]){const _0x5759f4=await withSpinner('Resolving\x20folder\x20\x27'+_0x1218d2['folder']+'\x27...',()=>_0xc841bb[_0x1813e6(0x150)]['resolveFolderId'](_0x11a71f,_0x1218d2['folder']),{'verbose':_0x1218d2[_0x1813e6(0x13c)]});_0xc245fe=_0x5759f4[_0x1813e6(0x12b)];}}_0x1218d2['verbose']&&_0xc245fe&&console['error'](_0x1813e6(0x14f)+_0xc245fe);const _0x34419c=await loadJSONFromOptions(_0x1218d2[_0x1813e6(0x13a)],_0x1218d2[_0x1813e6(0x151)]),_0x56ff4f={'name':_0x42e61d,'description':_0x1218d2[_0x1813e6(0x124)],'rule':_0x34419c,'kind':_0x1218d2[_0x1813e6(0x14d)]!==undefined?parseInt(_0x1218d2[_0x1813e6(0x14d)],0xa):undefined,'isVisible':_0x1218d2[_0x1813e6(0x12a)]?![]:undefined,'segmentFolderId':_0xc245fe,'countPopulation':_0x1218d2[_0x1813e6(0x130)]?![]:undefined},_0x30f1fc=await withSpinner(_0x1813e6(0x129)+_0x42e61d+'\x27...',()=>_0xc841bb[_0x1813e6(0x150)][_0x1813e6(0x138)](_0x11a71f,_0x56ff4f),{'verbose':_0x1218d2[_0x1813e6(0x13c)]}),_0x5d5c00=_0x30f1fc[_0x1813e6(0x12b)];return console['error'](_0x1813e6(0x14c)+_0x5d5c00[_0x1813e6(0x137)]+_0x1813e6(0x140)+_0x5d5c00['id']),_0x2ea68a!==_0x5d6066&&console[_0x1813e6(0x126)](_0x1813e6(0x128)+_0x2ea68a),await handleSDKOutput([_0x5d5c00],_0x1218d2),0x0;}}
1
+ function a38_0x4e07(){const _0x1d2022=['Target\x20path:\x20','6918936iaaEed','Usage:\x20tdx\x20segment\x20create\x20<path>\x20[options]','kind','Error:\x20Full\x20path\x20required\x20(parent/segment_name\x20or\x20parent/folder/segment_name)','segmentPath','resolveParentId','Segment\x20name:\x20','✔\x20Created\x20segment\x20\x27','3524886JoTBlI','Resolved\x20folder\x20ID:\x20','segment','Creating\x20segment\x20\x27','\x20\x20Use\x20`tdx\x20sg\x20push`\x20with\x20YAML\x20files\x20instead.\x0a','4975816qqSwFt','segment:create','type','segments','resolveFolderId','3030585ZegkTn','noCountPopulation','folderId','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/High\x20Value\x22\x20--rule\x20\x27...\x27','Resolving\x20folder\x20\x27','Resolved\x20relative\x20path\x20to:\x20','102fkFOcx','Error:\x20Cannot\x20create\x20segment\x20in\x20a\x20segment.\x20Parent\x20path\x20must\x20be\x20a\x20folder\x20or\x20parent.','Parent\x20path:\x20','⚠\x20Deprecation\x20warning:\x20`segment\x20create`\x20is\x20deprecated.','\x27...','invisible','verbose','rule','12548rLEIXv','\x27\x20with\x20ID:\x20','error','120348DGjGWk','description','Parent:\x20','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/Marketing/Premium\x22\x20--rule\x20\x27...\x27','yellow','Resolving\x20folder\x20path\x20\x27','98xtcbYT','8705158KNaZuZ','includes','resolvePathToResource','length','data','name','folder'];a38_0x4e07=function(){return _0x1d2022;};return a38_0x4e07();}const a38_0xdb8fe5=a38_0x4451;(function(_0x4c36ae,_0x5ca050){const _0x81cd20=a38_0x4451,_0x1ff23b=_0x4c36ae();while(!![]){try{const _0xe5d33f=-parseInt(_0x81cd20(0xd8))/0x1*(parseInt(_0x81cd20(0xe1))/0x2)+parseInt(_0x81cd20(0xd0))/0x3*(parseInt(_0x81cd20(0xdb))/0x4)+-parseInt(_0x81cd20(0xca))/0x5+parseInt(_0x81cd20(0xea))/0x6+-parseInt(_0x81cd20(0xe2))/0x7+parseInt(_0x81cd20(0xc5))/0x8+parseInt(_0x81cd20(0xf2))/0x9;if(_0xe5d33f===_0x5ca050)break;else _0x1ff23b['push'](_0x1ff23b['shift']());}catch(_0x5ade6a){_0x1ff23b['push'](_0x1ff23b['shift']());}}}(a38_0x4e07,0xb10be));import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../core/command-output.js';function a38_0x4451(_0x2daf66,_0x407359){_0x2daf66=_0x2daf66-0xc4;const _0x4e07f8=a38_0x4e07();let _0x44510f=_0x4e07f8[_0x2daf66];return _0x44510f;}import{withSpinner}from'../utils/spinner.js';import{loadJSONFromOptions}from'../utils/json-loader.js';import{parsePath,getParentPath,getBaseName}from'../sdk/segment/segment-path-parser.js';import a38_0x444577 from'chalk';export class SegmentCreateCommand extends BaseCommand{[a38_0xdb8fe5(0xe7)]=a38_0xdb8fe5(0xc6);[a38_0xdb8fe5(0xdc)]='Create\x20child\x20segment\x20with\x20filtering\x20rules';async['execute'](_0x118c44){const _0x5d4745=a38_0xdb8fe5;console[_0x5d4745(0xda)](a38_0x444577['yellow'](_0x5d4745(0xd3))),console[_0x5d4745(0xda)](a38_0x444577[_0x5d4745(0xdf)](_0x5d4745(0xc4)));const {options:_0x43f4ea,args:_0xb39291,tdx:_0x355252}=_0x118c44,_0xdc3bbb=_0x43f4ea;if(_0xb39291[_0x5d4745(0xe5)]===0x0)return console['error']('Error:\x20Segment\x20path\x20or\x20name\x20is\x20required'),console[_0x5d4745(0xda)](_0x5d4745(0xeb)),console[_0x5d4745(0xda)]('Examples:'),console[_0x5d4745(0xda)](_0x5d4745(0xcd)),console[_0x5d4745(0xda)](_0x5d4745(0xde)),console[_0x5d4745(0xda)]('\x20\x20tdx\x20segment\x20create\x20\x22Premium\x22\x20--rule\x20\x27...\x27\x20\x20#\x20Relative\x20to\x20context'),0x1;const _0x29edfe=_0xb39291[0x0],_0x4413f6=_0x43f4ea[_0x5d4745(0xee)];let _0x57fd18=_0x29edfe;_0x4413f6&&!_0x29edfe[_0x5d4745(0xe3)]('/')&&(_0x57fd18=_0x4413f6+'/'+_0x29edfe,_0xdc3bbb['verbose']&&console['error'](_0x5d4745(0xcf)+_0x57fd18));const _0x45e75a=parsePath(_0x57fd18);if(_0x45e75a[_0x5d4745(0xc8)][_0x5d4745(0xe5)]<0x2)return console[_0x5d4745(0xda)](_0x5d4745(0xed)),console[_0x5d4745(0xda)]('Usage:\x20tdx\x20segment\x20create\x20<parent/segment_name>\x20[options]'),0x1;const _0xa25e1f=_0x45e75a[_0x5d4745(0xc8)][0x0],_0x295fa3=getBaseName(_0x57fd18),_0x1585c0=getParentPath(_0x57fd18);_0xdc3bbb[_0x5d4745(0xd6)]&&(console['error']('Site:\x20'+_0xdc3bbb['site']),console['error'](_0x5d4745(0xe9)+_0x57fd18),console[_0x5d4745(0xda)](_0x5d4745(0xdd)+_0xa25e1f),console[_0x5d4745(0xda)](_0x5d4745(0xf0)+_0x295fa3),console['error'](_0x5d4745(0xd2)+_0x1585c0));const _0x400c09=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0xa25e1f+_0x5d4745(0xd4),()=>_0x355252[_0x5d4745(0xf4)][_0x5d4745(0xef)](_0xa25e1f),{'verbose':_0xdc3bbb['verbose']}),_0x5603e9=_0x400c09['data'];let _0x24f62c;if(_0x45e75a[_0x5d4745(0xc8)]['length']>0x2){const _0x35239c=await withSpinner(_0x5d4745(0xe0)+_0x1585c0+_0x5d4745(0xd4),()=>_0x355252[_0x5d4745(0xf4)][_0x5d4745(0xe4)](_0x1585c0),{'verbose':_0xdc3bbb[_0x5d4745(0xd6)]}),_0x342805=_0x35239c[_0x5d4745(0xe6)];if(_0x342805[_0x5d4745(0xc7)]!==_0x5d4745(0xe8)&&_0x342805[_0x5d4745(0xc7)]!=='parent')return console[_0x5d4745(0xda)](_0x5d4745(0xd1)),0x1;_0x24f62c=_0x342805[_0x5d4745(0xcc)];}else{if(_0xdc3bbb[_0x5d4745(0xe8)]){const _0x561939=await withSpinner(_0x5d4745(0xce)+_0xdc3bbb[_0x5d4745(0xe8)]+'\x27...',()=>_0x355252[_0x5d4745(0xf4)][_0x5d4745(0xc9)](_0x5603e9,_0xdc3bbb['folder']),{'verbose':_0xdc3bbb[_0x5d4745(0xd6)]});_0x24f62c=_0x561939[_0x5d4745(0xe6)];}}_0xdc3bbb['verbose']&&_0x24f62c&&console[_0x5d4745(0xda)](_0x5d4745(0xf3)+_0x24f62c);const _0x3555c7=await loadJSONFromOptions(_0xdc3bbb[_0x5d4745(0xd7)],_0xdc3bbb['ruleFile']),_0x3bde9d={'name':_0x295fa3,'description':_0xdc3bbb[_0x5d4745(0xdc)],'rule':_0x3555c7,'kind':_0xdc3bbb[_0x5d4745(0xec)]!==undefined?parseInt(_0xdc3bbb[_0x5d4745(0xec)],0xa):undefined,'isVisible':_0xdc3bbb[_0x5d4745(0xd5)]?![]:undefined,'segmentFolderId':_0x24f62c,'countPopulation':_0xdc3bbb[_0x5d4745(0xcb)]?![]:undefined},_0x45ee01=await withSpinner(_0x5d4745(0xf5)+_0x295fa3+'\x27...',()=>_0x355252[_0x5d4745(0xf4)]['createSegment'](_0x5603e9,_0x3bde9d),{'verbose':_0xdc3bbb[_0x5d4745(0xd6)]}),_0x442372=_0x45ee01[_0x5d4745(0xe6)];return console[_0x5d4745(0xda)](_0x5d4745(0xf1)+_0x442372['name']+_0x5d4745(0xd9)+_0x442372['id']),_0x57fd18!==_0x29edfe&&console[_0x5d4745(0xda)]('\x20\x20\x20Path:\x20'+_0x57fd18),await handleSDKOutput([_0x442372],_0xdc3bbb),0x0;}}
@@ -1 +1 @@
1
- const a39_0x4bfc92=a39_0x1afb;(function(_0x58f2b2,_0x517b81){const _0x51f70d=a39_0x1afb,_0x3c8f06=_0x58f2b2();while(!![]){try{const _0x403787=parseInt(_0x51f70d(0x1ef))/0x1+-parseInt(_0x51f70d(0x1ec))/0x2*(parseInt(_0x51f70d(0x1e1))/0x3)+-parseInt(_0x51f70d(0x1f9))/0x4+parseInt(_0x51f70d(0x1f0))/0x5*(-parseInt(_0x51f70d(0x1e3))/0x6)+parseInt(_0x51f70d(0x1ea))/0x7+-parseInt(_0x51f70d(0x1ed))/0x8*(parseInt(_0x51f70d(0x1e0))/0x9)+-parseInt(_0x51f70d(0x1eb))/0xa*(-parseInt(_0x51f70d(0x1e4))/0xb);if(_0x403787===_0x517b81)break;else _0x3c8f06['push'](_0x3c8f06['shift']());}catch(_0x2aab7a){_0x3c8f06['push'](_0x3c8f06['shift']());}}}(a39_0x41b7,0x5f5c3));import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../core/command-output.js';function a39_0x41b7(){const _0x2d837f=['segment','\x20field','segment:fields','json','4723404mOdsOK','142320EZFcKW','109420etyYFN','8ePFZpf','execute','765678GLKtqC','759685yEipxO','data','parentSegment','List\x20available\x20fields\x20for\x20segmentation','Parent\x20segment:\x20','jsonl','name','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','✔\x20Found\x20','1623124jVspDA','Site:\x20','2479635mGaJNr','15SLoqKJ','verbose','6vkQxMI','44ptEKfi','error'];a39_0x41b7=function(){return _0x2d837f;};return a39_0x41b7();}import{withSpinner}from'../utils/spinner.js';function a39_0x1afb(_0x3f3719,_0x52d08a){_0x3f3719=_0x3f3719-0x1e0;const _0x41b716=a39_0x41b7();let _0x1afb86=_0x41b716[_0x3f3719];return _0x1afb86;}import{displayFieldsHumanReadable}from'../sdk/segment/fields-display.js';export class SegmentFieldsCommand extends BaseCommand{[a39_0x4bfc92(0x1f6)]=a39_0x4bfc92(0x1e8);['description']=a39_0x4bfc92(0x1f3);async[a39_0x4bfc92(0x1ee)](_0xe72934){const _0xd92da=a39_0x4bfc92,{options:_0x18dc92,args:_0x1ba91b,tdx:_0x42976b}=_0xe72934,_0x7df27=_0x1ba91b[0x0]||_0x18dc92[_0xd92da(0x1f2)];if(!_0x7df27)return console[_0xd92da(0x1e5)]('Error:\x20Parent\x20segment\x20name\x20is\x20required'),console[_0xd92da(0x1e5)]('Usage:\x20tdx\x20segment\x20fields\x20<parent_name>'),console['error'](_0xd92da(0x1f7)),0x1;_0x18dc92[_0xd92da(0x1e2)]&&(console['error'](_0xd92da(0x1fa)+_0x18dc92['site']),console['error'](_0xd92da(0x1f4)+_0x7df27));const _0xd0034e=await withSpinner('Listing\x20fields\x20for\x20\x27'+_0x7df27+'\x27...',()=>_0x42976b[_0xd92da(0x1e6)]['listFields'](_0x7df27),{'verbose':_0x18dc92[_0xd92da(0x1e2)]}),_0x3a1d11=_0xd0034e[_0xd92da(0x1f1)];console['error'](_0xd92da(0x1f8)+_0x3a1d11['length']+_0xd92da(0x1e7)+(_0x3a1d11['length']!==0x1?'s':''));if(_0x18dc92[_0xd92da(0x1e9)]||_0x18dc92[_0xd92da(0x1f5)])return await handleSDKOutput(_0x3a1d11,_0x18dc92),0x0;return displayFieldsHumanReadable(_0x3a1d11,_0x7df27),0x0;}}
1
+ const a39_0x189d97=a39_0x2051;(function(_0x4cfba0,_0x5c07fe){const _0x407318=a39_0x2051,_0x1d1053=_0x4cfba0();while(!![]){try{const _0x3ff39c=-parseInt(_0x407318(0x12d))/0x1*(parseInt(_0x407318(0x12b))/0x2)+parseInt(_0x407318(0x127))/0x3+parseInt(_0x407318(0x137))/0x4*(-parseInt(_0x407318(0x132))/0x5)+-parseInt(_0x407318(0x138))/0x6*(parseInt(_0x407318(0x139))/0x7)+-parseInt(_0x407318(0x142))/0x8+-parseInt(_0x407318(0x128))/0x9+-parseInt(_0x407318(0x133))/0xa*(-parseInt(_0x407318(0x125))/0xb);if(_0x3ff39c===_0x5c07fe)break;else _0x1d1053['push'](_0x1d1053['shift']());}catch(_0x111dcc){_0x1d1053['push'](_0x1d1053['shift']());}}}(a39_0x5d23,0xe5560));function a39_0x5d23(){const _0x21fb94=['verbose','65sDQrCV','52284170wRqYiS','json','segment:fields','\x27...','573172QGoGVI','6albHNl','2479631dNpHJG','listFields','Site:\x20','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','length','name','\x20field','data','error','5523424IgBydv','11LSPTGM','Parent\x20segment:\x20','4073493feKJIx','8438571wvNZXR','jsonl','Error:\x20Parent\x20segment\x20name\x20is\x20required','58bmJHsf','✔\x20Found\x20','62131adExnh','Usage:\x20tdx\x20segment\x20fields\x20<parent_name>','segment','site'];a39_0x5d23=function(){return _0x21fb94;};return a39_0x5d23();}import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';function a39_0x2051(_0x26fc18,_0x417358){_0x26fc18=_0x26fc18-0x125;const _0x5d2351=a39_0x5d23();let _0x205155=_0x5d2351[_0x26fc18];return _0x205155;}import{displayFieldsHumanReadable}from'../sdk/segment/fields-display.js';export class SegmentFieldsCommand extends BaseCommand{[a39_0x189d97(0x13e)]=a39_0x189d97(0x135);['description']='List\x20available\x20fields\x20for\x20segmentation';async['execute'](_0x14b0ce){const _0x1f27b3=a39_0x189d97,{options:_0x1c9308,args:_0x16cc10,tdx:_0x3d8e0d}=_0x14b0ce,_0xd65672=_0x16cc10[0x0]||_0x1c9308['parentSegment'];if(!_0xd65672)return console[_0x1f27b3(0x141)](_0x1f27b3(0x12a)),console[_0x1f27b3(0x141)](_0x1f27b3(0x12e)),console[_0x1f27b3(0x141)](_0x1f27b3(0x13c)),0x1;_0x1c9308[_0x1f27b3(0x131)]&&(console['error'](_0x1f27b3(0x13b)+_0x1c9308[_0x1f27b3(0x130)]),console[_0x1f27b3(0x141)](_0x1f27b3(0x126)+_0xd65672));const _0x4c2db8=await withSpinner('Listing\x20fields\x20for\x20\x27'+_0xd65672+_0x1f27b3(0x136),()=>_0x3d8e0d[_0x1f27b3(0x12f)][_0x1f27b3(0x13a)](_0xd65672),{'verbose':_0x1c9308[_0x1f27b3(0x131)]}),_0x37f23d=_0x4c2db8[_0x1f27b3(0x140)];console[_0x1f27b3(0x141)](_0x1f27b3(0x12c)+_0x37f23d[_0x1f27b3(0x13d)]+_0x1f27b3(0x13f)+(_0x37f23d[_0x1f27b3(0x13d)]!==0x1?'s':''));if(_0x1c9308[_0x1f27b3(0x134)]||_0x1c9308[_0x1f27b3(0x129)])return await handleSDKOutput(_0x37f23d,_0x1c9308),0x0;return displayFieldsHumanReadable(_0x37f23d,_0xd65672),0x0;}}