@treasuredata/tdx 2026.6.4 → 2026.6.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (241) hide show
  1. package/dist/bin.js +1 -1
  2. package/dist/build-info.json +3 -3
  3. package/dist/cli-categories.js +1 -1
  4. package/dist/cli.d.ts.map +1 -1
  5. package/dist/cli.js +1 -1
  6. package/dist/cli.js.map +1 -1
  7. package/dist/commands/activations.js +1 -1
  8. package/dist/commands/agent-command.js +1 -1
  9. package/dist/commands/agent-test-command.js +1 -1
  10. package/dist/commands/api-command.js +1 -1
  11. package/dist/commands/auth-command.js +1 -1
  12. package/dist/commands/cas-command.js +1 -1
  13. package/dist/commands/cas-segment-command.js +1 -1
  14. package/dist/commands/chat-command.js +1 -1
  15. package/dist/commands/claude-command.js +1 -1
  16. package/dist/commands/claude-statusline-command.js +1 -1
  17. package/dist/commands/claude-usage-command.js +1 -1
  18. package/dist/commands/command.js +1 -1
  19. package/dist/commands/connection-command.js +1 -1
  20. package/dist/commands/databases.js +1 -1
  21. package/dist/commands/delivery-command.js +1 -1
  22. package/dist/commands/describe.js +1 -1
  23. package/dist/commands/engage-campaign-pull-command.js +1 -1
  24. package/dist/commands/engage-campaign-push-command.js +1 -1
  25. package/dist/commands/engage-campaign-validate-command.js +1 -1
  26. package/dist/commands/engage-command.js +1 -1
  27. package/dist/commands/engage-template-pull-command.js +1 -1
  28. package/dist/commands/engage-template-push-command.js +1 -1
  29. package/dist/commands/engage-template-validate-command.js +1 -1
  30. package/dist/commands/job-command.js +1 -1
  31. package/dist/commands/journey-command.js +1 -1
  32. package/dist/commands/journey-validate-command.js +1 -1
  33. package/dist/commands/llm-command.js +1 -1
  34. package/dist/commands/mcp-command.js +1 -1
  35. package/dist/commands/parent-segment-command.js +1 -1
  36. package/dist/commands/policy-command.js +1 -1
  37. package/dist/commands/profile-command.js +1 -1
  38. package/dist/commands/profiles-command.js +1 -1
  39. package/dist/commands/query-command.js +1 -1
  40. package/dist/commands/schedule-command.js +1 -1
  41. package/dist/commands/segment-command.js +1 -1
  42. package/dist/commands/segment-create-command.js +1 -1
  43. package/dist/commands/segment-fields-command.js +1 -1
  44. package/dist/commands/segment-move-command.d.ts +19 -0
  45. package/dist/commands/segment-move-command.d.ts.map +1 -0
  46. package/dist/commands/segment-move-command.js +1 -0
  47. package/dist/commands/segment-move-command.js.map +1 -0
  48. package/dist/commands/segment-pull-command.js +1 -1
  49. package/dist/commands/segment-push-command.js +1 -1
  50. package/dist/commands/segment-update-command.js +1 -1
  51. package/dist/commands/segment-use-command.js +1 -1
  52. package/dist/commands/segment-validate-command.js +1 -1
  53. package/dist/commands/segments.js +1 -1
  54. package/dist/commands/show.js +1 -1
  55. package/dist/commands/status-command.js +1 -1
  56. package/dist/commands/table-deleted.js +1 -1
  57. package/dist/commands/tables.js +1 -1
  58. package/dist/commands/unset-command.js +1 -1
  59. package/dist/commands/upgrade-command.js +1 -1
  60. package/dist/commands/use-command.js +1 -1
  61. package/dist/commands/user-command.js +1 -1
  62. package/dist/commands/work-command.js +1 -1
  63. package/dist/commands/workflow-command.js +1 -1
  64. package/dist/core/auth.js +1 -1
  65. package/dist/core/command-output.js +1 -1
  66. package/dist/core/config.js +1 -1
  67. package/dist/core/connection-cache.js +1 -1
  68. package/dist/core/constants.js +1 -1
  69. package/dist/core/credential-cache.js +1 -1
  70. package/dist/core/global-context.js +1 -1
  71. package/dist/core/keychain.js +1 -1
  72. package/dist/core/oauth-keychain.js +1 -1
  73. package/dist/core/oauth.js +1 -1
  74. package/dist/core/profile.js +1 -1
  75. package/dist/core/project-config.js +1 -1
  76. package/dist/core/session.js +1 -1
  77. package/dist/core/user-cache.js +1 -1
  78. package/dist/core/version.js +1 -1
  79. package/dist/index.js +1 -1
  80. package/dist/mcp/server.js +1 -1
  81. package/dist/mcp/tools/index.js +1 -1
  82. package/dist/mcp/tools/tdx-run.js +1 -1
  83. package/dist/mcp/tools/tdx-search.js +1 -1
  84. package/dist/mcp/tools/work-create-item.js +1 -1
  85. package/dist/mcp/utils.js +1 -1
  86. package/dist/proxy/claude-usage-tracker.js +1 -1
  87. package/dist/proxy/passthrough-server.js +1 -1
  88. package/dist/proxy/sse-usage-parser.js +1 -1
  89. package/dist/sdk/agent/agent-config.js +1 -1
  90. package/dist/sdk/agent/agent-ref-parser.js +1 -1
  91. package/dist/sdk/agent/agent-yaml.js +1 -1
  92. package/dist/sdk/agent/test/evaluator.js +1 -1
  93. package/dist/sdk/agent/test/executor.js +1 -1
  94. package/dist/sdk/agent/test/index.js +1 -1
  95. package/dist/sdk/agent/test/output.js +1 -1
  96. package/dist/sdk/agent/test/parser.js +1 -1
  97. package/dist/sdk/agent/tool-target-registry.js +1 -1
  98. package/dist/sdk/api.js +1 -1
  99. package/dist/sdk/cas/cas-api-client.js +1 -1
  100. package/dist/sdk/cas/cas-audience-yaml.js +1 -1
  101. package/dist/sdk/cas/cas-segment-yaml.js +1 -1
  102. package/dist/sdk/cas/index.js +1 -1
  103. package/dist/sdk/cas/pull-workflow.js +1 -1
  104. package/dist/sdk/cas/push-workflow.js +1 -1
  105. package/dist/sdk/client/cdp-api-client.d.ts +18 -0
  106. package/dist/sdk/client/cdp-api-client.d.ts.map +1 -1
  107. package/dist/sdk/client/cdp-api-client.js +1 -1
  108. package/dist/sdk/client/cdp-api-client.js.map +1 -1
  109. package/dist/sdk/client/delivery-api-client.js +1 -1
  110. package/dist/sdk/client/endpoints.js +1 -1
  111. package/dist/sdk/client/engage-api-client.js +1 -1
  112. package/dist/sdk/client/http-client.js +1 -1
  113. package/dist/sdk/client/llm-api-client.js +1 -1
  114. package/dist/sdk/client/oauth-refresh.js +1 -1
  115. package/dist/sdk/client/rate-limiter.js +1 -1
  116. package/dist/sdk/client/td-api-client.js +1 -1
  117. package/dist/sdk/client/trino-api-client.js +1 -1
  118. package/dist/sdk/client/workflow-client.js +1 -1
  119. package/dist/sdk/connection-validator.js +1 -1
  120. package/dist/sdk/connection.js +1 -1
  121. package/dist/sdk/delivery.js +1 -1
  122. package/dist/sdk/engage/campaign-pull.js +1 -1
  123. package/dist/sdk/engage/campaign-push.js +1 -1
  124. package/dist/sdk/engage/campaign-validator.js +1 -1
  125. package/dist/sdk/engage/campaign-yaml.js +1 -1
  126. package/dist/sdk/engage/template-pull.js +1 -1
  127. package/dist/sdk/engage/template-push.js +1 -1
  128. package/dist/sdk/engage/template-validator.js +1 -1
  129. package/dist/sdk/engage/template-yaml.js +1 -1
  130. package/dist/sdk/engage/types/campaign-def.js +1 -1
  131. package/dist/sdk/engage/types/campaign-schema.js +1 -1
  132. package/dist/sdk/engage/types/template-schema.js +1 -1
  133. package/dist/sdk/engage.js +1 -1
  134. package/dist/sdk/errors.js +1 -1
  135. package/dist/sdk/index.js +1 -1
  136. package/dist/sdk/io/index.js +1 -1
  137. package/dist/sdk/io/node-filesystem.js +1 -1
  138. package/dist/sdk/job.js +1 -1
  139. package/dist/sdk/journey.js +1 -1
  140. package/dist/sdk/llm/chat-cache.js +1 -1
  141. package/dist/sdk/llm/index.js +1 -1
  142. package/dist/sdk/llm/llm-backup-utils.js +1 -1
  143. package/dist/sdk/llm/model-factors.js +1 -1
  144. package/dist/sdk/llm/user-settings.js +1 -1
  145. package/dist/sdk/personalization.js +1 -1
  146. package/dist/sdk/policy.js +1 -1
  147. package/dist/sdk/query/deleted-table-validation.js +1 -1
  148. package/dist/sdk/query/index.js +1 -1
  149. package/dist/sdk/query/sql-parser.js +1 -1
  150. package/dist/sdk/realtime.js +1 -1
  151. package/dist/sdk/schedule.js +1 -1
  152. package/dist/sdk/segment/child-segment-yaml.js +1 -1
  153. package/dist/sdk/segment/fields-display.js +1 -1
  154. package/dist/sdk/segment/file-discovery.js +1 -1
  155. package/dist/sdk/segment/journey-utils.js +1 -1
  156. package/dist/sdk/segment/journey-validator.js +1 -1
  157. package/dist/sdk/segment/journey-yaml.js +1 -1
  158. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  159. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  160. package/dist/sdk/segment/pull-workflow.js +1 -1
  161. package/dist/sdk/segment/push-recovery.js +1 -1
  162. package/dist/sdk/segment/push-workflow.js +1 -1
  163. package/dist/sdk/segment/resolution-context.js +1 -1
  164. package/dist/sdk/segment/segment-path-parser.js +1 -1
  165. package/dist/sdk/segment/segment-ref-parser.js +1 -1
  166. package/dist/sdk/segment/segment-validator.js +1 -1
  167. package/dist/sdk/segment/target-resolution.js +1 -1
  168. package/dist/sdk/segment/tdx-config.js +1 -1
  169. package/dist/sdk/segment/types/activation-schema.js +1 -1
  170. package/dist/sdk/segment/types/journey-def.js +1 -1
  171. package/dist/sdk/segment/types/journey-schema.js +1 -1
  172. package/dist/sdk/segment/types/segment-def.js +1 -1
  173. package/dist/sdk/segment/types/segment-schema.js +1 -1
  174. package/dist/sdk/segment/validate-files.js +1 -1
  175. package/dist/sdk/segment/yaml-validator.js +1 -1
  176. package/dist/sdk/segment.d.ts +28 -1
  177. package/dist/sdk/segment.d.ts.map +1 -1
  178. package/dist/sdk/segment.js +1 -1
  179. package/dist/sdk/segment.js.map +1 -1
  180. package/dist/sdk/types/cdp.d.ts +15 -0
  181. package/dist/sdk/types/cdp.d.ts.map +1 -1
  182. package/dist/sdk/types/index.d.ts +1 -1
  183. package/dist/sdk/types/index.d.ts.map +1 -1
  184. package/dist/sdk/types/index.js +1 -1
  185. package/dist/sdk/types/index.js.map +1 -1
  186. package/dist/sdk/types/progress.js +1 -1
  187. package/dist/sdk/types/workspace.js +1 -1
  188. package/dist/sdk/user.js +1 -1
  189. package/dist/sdk/util/format-detector.js +1 -1
  190. package/dist/sdk/util/formatters.js +1 -1
  191. package/dist/sdk/util/index.js +1 -1
  192. package/dist/sdk/util/paginate.js +1 -1
  193. package/dist/sdk/util/tree-formatter.js +1 -1
  194. package/dist/sdk/workflow/archive-validation.js +1 -1
  195. package/dist/sdk/workflow/clone-workflow.js +1 -1
  196. package/dist/sdk/workflow/index.js +1 -1
  197. package/dist/sdk/workflow/pull-workflow.js +1 -1
  198. package/dist/sdk/workflow/push-workflow.js +1 -1
  199. package/dist/sdk/workflow/task-graph.js +1 -1
  200. package/dist/sdk/workflow/tdx-config.js +1 -1
  201. package/dist/sdk/workflow/workflow-utils.js +1 -1
  202. package/dist/sdk/workspace/access-tracker.js +1 -1
  203. package/dist/sdk/workspace/frontmatter.js +1 -1
  204. package/dist/sdk/workspace/git.js +1 -1
  205. package/dist/sdk/workspace/index.js +1 -1
  206. package/dist/sdk/workspace/templates.js +1 -1
  207. package/dist/sdk/workspace/weekly.js +1 -1
  208. package/dist/sdk/workspace/wikilinks.js +1 -1
  209. package/dist/test-utils/command-runner.js +1 -1
  210. package/dist/test-utils/factories.js +1 -1
  211. package/dist/test-utils/fixtures.js +1 -1
  212. package/dist/test-utils/http-mock.js +1 -1
  213. package/dist/test-utils/index.js +1 -1
  214. package/dist/utils/async.js +1 -1
  215. package/dist/utils/colors.js +1 -1
  216. package/dist/utils/diff.js +1 -1
  217. package/dist/utils/file-permissions.js +1 -1
  218. package/dist/utils/file-reader.js +1 -1
  219. package/dist/utils/github-releases.js +1 -1
  220. package/dist/utils/global-cache.js +1 -1
  221. package/dist/utils/json-loader.js +1 -1
  222. package/dist/utils/local-cache.js +1 -1
  223. package/dist/utils/logger/formatters/default-formatter.js +1 -1
  224. package/dist/utils/logger/formatters/index.js +1 -1
  225. package/dist/utils/logger/handlers/console-handler.js +1 -1
  226. package/dist/utils/logger/handlers/file-handler.js +1 -1
  227. package/dist/utils/logger/handlers/index.js +1 -1
  228. package/dist/utils/logger/handlers/null-handler.js +1 -1
  229. package/dist/utils/logger/index.js +1 -1
  230. package/dist/utils/logger/logger.js +1 -1
  231. package/dist/utils/logger/types.js +1 -1
  232. package/dist/utils/option-validation.js +1 -1
  233. package/dist/utils/process.js +1 -1
  234. package/dist/utils/prompt.js +1 -1
  235. package/dist/utils/spinner.js +1 -1
  236. package/dist/utils/sse-parser.js +1 -1
  237. package/dist/utils/string-utils.js +1 -1
  238. package/dist/utils/table-ref-parser.js +1 -1
  239. package/dist/utils/tdx-logger.js +1 -1
  240. package/dist/utils/version-check.js +1 -1
  241. package/package.json +1 -1
@@ -1 +1 @@
1
- const a32_0x5de0df=a32_0x15b1;(function(_0x412916,_0x30dd5e){const _0x590417=a32_0x15b1,_0x570d92=_0x412916();while(!![]){try{const _0x3fe0d5=parseInt(_0x590417(0x139))/0x1+parseInt(_0x590417(0x14b))/0x2*(-parseInt(_0x590417(0x11d))/0x3)+-parseInt(_0x590417(0x13b))/0x4+-parseInt(_0x590417(0x152))/0x5*(-parseInt(_0x590417(0x148))/0x6)+-parseInt(_0x590417(0x155))/0x7+parseInt(_0x590417(0x151))/0x8*(-parseInt(_0x590417(0x133))/0x9)+-parseInt(_0x590417(0x122))/0xa*(-parseInt(_0x590417(0x135))/0xb);if(_0x3fe0d5===_0x30dd5e)break;else _0x570d92['push'](_0x570d92['shift']());}catch(_0x1c89ed){_0x570d92['push'](_0x570d92['shift']());}}}(a32_0xc04b,0xc1532));function a32_0x15b1(_0x5ab77d,_0x52e9f5){_0x5ab77d=_0x5ab77d-0x119;const _0xc04b79=a32_0xc04b();let _0x15b12c=_0xc04b79[_0x5ab77d];return _0x15b12c;}import{BaseCommand}from'./command.js';import{handleSDKOutput,handleSingleObjectOutput,isStructuredFormat}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import a32_0x405c34 from'chalk';export class PolicyCommand extends BaseCommand{[a32_0x5de0df(0x120)]=a32_0x5de0df(0x12a);[a32_0x5de0df(0x13a)]=a32_0x5de0df(0x149);async['execute'](_0x359ef9){const _0x1d8300=a32_0x5de0df,{options:_0xbd8686,tdx:_0x483386}=_0x359ef9,_0xc3f9aa=await withSpinner(_0x1d8300(0x143),async()=>{const _0x35fbb3=_0x1d8300,[_0x2254bf,_0x5b978e]=await Promise[_0x35fbb3(0x145)]([_0x483386[_0x35fbb3(0x124)][_0x35fbb3(0x14a)](),_0x483386['policy']['getMyPermissions']()]);return{'userInfo':_0x2254bf,'permissions':_0x5b978e};},{'verbose':_0xbd8686[_0x1d8300(0x154)]}),{userInfo:_0x281f1c,permissions:_0x4ba924}=_0xc3f9aa[_0x1d8300(0x125)];if(isStructuredFormat(_0xbd8686))return await handleSingleObjectOutput(_0x4ba924,_0xbd8686),0x0;const _0x4c8c27=_0x281f1c['account_owner']?_0x1d8300(0x153):_0x281f1c['administrator']?_0x1d8300(0x14d):_0x1d8300(0x12e);console[_0x1d8300(0x119)]('\x0a'+a32_0x405c34[_0x1d8300(0x14e)]('👤')+'\x20'+a32_0x405c34[_0x1d8300(0x14e)](_0x281f1c[_0x1d8300(0x120)])+'\x20'+a32_0x405c34[_0x1d8300(0x13c)]('('+_0x281f1c[_0x1d8300(0x14f)]+')')+_0x1d8300(0x126)+_0x4c8c27),console['log'](a32_0x405c34['dim'](_0x1d8300(0x11f)+_0x483386[_0x1d8300(0x150)][_0x1d8300(0x12d)]+':'+_0x281f1c['account_id']+_0x1d8300(0x130)+_0x281f1c['id']));const _0x319796=_0x4ba924['policies'];console[_0x1d8300(0x119)]('\x0a'+a32_0x405c34[_0x1d8300(0x14e)](_0x1d8300(0x140))+'\x20('+_0x319796[_0x1d8300(0x141)]+'):');if(_0x319796['length']===0x0)console[_0x1d8300(0x119)](a32_0x405c34[_0x1d8300(0x13c)](_0x1d8300(0x147)));else for(const _0x30b136 of _0x319796){console[_0x1d8300(0x119)]('\x20\x20•\x20'+_0x30b136[_0x1d8300(0x120)]);}return printPermissionsMap(_0x4ba924[_0x1d8300(0x12c)]),console[_0x1d8300(0x119)](),0x0;}}export class PolicyListCommand extends BaseCommand{[a32_0x5de0df(0x120)]=a32_0x5de0df(0x11a);[a32_0x5de0df(0x13a)]=a32_0x5de0df(0x131);async[a32_0x5de0df(0x11e)](_0x4904f9){const _0x2fe91d=a32_0x5de0df,{options:_0x3e7465,tdx:_0x5264bf}=_0x4904f9,_0x286ef9=await withSpinner('Listing\x20policies...',()=>_0x5264bf[_0x2fe91d(0x12a)][_0x2fe91d(0x127)](),{'verbose':_0x3e7465[_0x2fe91d(0x154)]}),_0x167909=_0x286ef9[_0x2fe91d(0x125)];console[_0x2fe91d(0x123)](_0x2fe91d(0x11b)+_0x167909[_0x2fe91d(0x141)]+_0x2fe91d(0x132)+(_0x167909[_0x2fe91d(0x141)]!==0x1?'ies':'y'));if(isStructuredFormat(_0x3e7465))return await handleSDKOutput(_0x167909,_0x3e7465),0x0;if(_0x167909['length']===0x0)console['log'](a32_0x405c34[_0x2fe91d(0x13c)](_0x2fe91d(0x129)));else for(const _0x313e4d of _0x167909){const _0x3c7001=_0x313e4d[_0x2fe91d(0x13a)]?a32_0x405c34[_0x2fe91d(0x13c)]('\x20—\x20'+_0x313e4d[_0x2fe91d(0x13a)]):'';console['log']('\x20\x20•\x20'+_0x313e4d[_0x2fe91d(0x120)]+_0x3c7001);}return 0x0;}}export class PolicyShowCommand extends BaseCommand{[a32_0x5de0df(0x120)]=a32_0x5de0df(0x142);[a32_0x5de0df(0x13a)]=a32_0x5de0df(0x136);[a32_0x5de0df(0x137)](_0x5aac30){const _0x3c22e1=a32_0x5de0df;if(_0x5aac30['args'][_0x3c22e1(0x141)]===0x0)return _0x3c22e1(0x13e);return undefined;}async[a32_0x5de0df(0x11e)](_0x40adfd){const _0x518da4=a32_0x5de0df,{options:_0x29b8c7,tdx:_0x381100}=_0x40adfd,_0x3b4731=_0x40adfd[_0x518da4(0x12b)][0x0],_0x562411=await withSpinner(_0x518da4(0x121),async()=>{const _0x56b16a=_0x518da4,_0x283fc0=await _0x381100[_0x56b16a(0x12a)][_0x56b16a(0x134)](_0x3b4731),[_0xb6fc68,_0x1331de]=await Promise['all']([_0x381100[_0x56b16a(0x12a)][_0x56b16a(0x11c)](_0x283fc0['id']),_0x381100['policy']['getPolicyUsers'](_0x283fc0['id'])]);return{'policy':_0x283fc0,'perms':_0xb6fc68,'users':_0x1331de};},{'verbose':_0x29b8c7[_0x518da4(0x154)]}),{policy:_0x5d7bce,perms:_0x2fe75b,users:_0x4e6c02}=_0x562411['data'];if(isStructuredFormat(_0x29b8c7))return await handleSingleObjectOutput({..._0x5d7bce,'permissions':_0x2fe75b[_0x518da4(0x12c)],'users':_0x4e6c02},_0x29b8c7),0x0;console[_0x518da4(0x119)]('\x0a'+a32_0x405c34[_0x518da4(0x14e)]('📋')+'\x20'+a32_0x405c34[_0x518da4(0x14e)](_0x5d7bce[_0x518da4(0x120)])+'\x20'+a32_0x405c34[_0x518da4(0x13c)](_0x518da4(0x138)+_0x5d7bce['id']+')'));_0x5d7bce[_0x518da4(0x13a)]&&console[_0x518da4(0x119)]('\x20\x20\x20'+a32_0x405c34[_0x518da4(0x13c)](_0x5d7bce['description']));console[_0x518da4(0x119)](_0x518da4(0x11f)+_0x4e6c02[_0x518da4(0x141)]+'\x20user'+(_0x4e6c02[_0x518da4(0x141)]!==0x1?'s':'')+_0x518da4(0x128)),printPermissionsMap(_0x2fe75b[_0x518da4(0x12c)]);if(_0x4e6c02[_0x518da4(0x141)]>0x0){console[_0x518da4(0x119)]('\x0a'+a32_0x405c34[_0x518da4(0x14e)](_0x518da4(0x12f))+':');for(const _0x177562 of _0x4e6c02){const _0x3758c5=_0x177562[_0x518da4(0x14f)]&&_0x177562[_0x518da4(0x14f)]!==_0x177562[_0x518da4(0x120)]?a32_0x405c34[_0x518da4(0x13c)]('\x20<'+_0x177562[_0x518da4(0x14f)]+'>'):'';console[_0x518da4(0x119)](_0x518da4(0x13f)+_0x177562['name']+_0x3758c5);}}return console['log'](),0x0;}}function printPermissionsMap(_0x59c7b9){const _0x2f7c39=a32_0x5de0df,_0x5a3adf=Object['entries'](_0x59c7b9);console['log']('\x0a'+a32_0x405c34['bold'](_0x2f7c39(0x14c))+':');if(_0x5a3adf[_0x2f7c39(0x141)]===0x0){console[_0x2f7c39(0x119)](a32_0x405c34[_0x2f7c39(0x13c)](_0x2f7c39(0x146)));return;}const _0xddb357=Math[_0x2f7c39(0x13d)](..._0x5a3adf[_0x2f7c39(0x156)](([_0xf6f3c3])=>_0xf6f3c3[_0x2f7c39(0x141)]));for(const [_0x9be489,_0x7e7ce9]of _0x5a3adf){const _0x3d3243=formatOperations(_0x7e7ce9);console['log']('\x20\x20'+_0x9be489[_0x2f7c39(0x144)](_0xddb357+0x2)+_0x3d3243);}}function a32_0xc04b(){const _0x29d155=['\x20\x20\x20','name','Fetching\x20policy...','10inVTXo','error','user','data','\x20—\x20','listPolicies','\x20assigned','No\x20policies\x20found','policy','args','permissions','site','Member','👥\x20Assigned\x20Users',',\x20user_id:','List\x20all\x20policies\x20in\x20the\x20account\x20(admin\x20only)','\x20polic','7726482uxhEQT','getPolicy','15354790jMaHuP','Show\x20a\x20specific\x20policy\x20details\x20and\x20permissions\x20(admin\x20only)','validate','(ID:\x20','1212183ljkzsL','description','3961356oAenFO','dim','max','Usage:\x20tdx\x20policy\x20show\x20<policy-name-or-id>','\x20\x20•\x20','📋\x20Assigned\x20Policies','length','policy\x20show','Fetching\x20permissions...','padEnd','all','\x20\x20No\x20permissions','\x20\x20No\x20policies\x20assigned','12ECVvgZ','Show\x20current\x20user\x20policies\x20and\x20effective\x20permissions','getCurrent','7078GTtvTN','🔑\x20Effective\x20Permissions','Administrator','bold','email','context','8lFNYIv','3853340pugPGO','Account\x20Owner','verbose','8356201btehQj','map','log','policy\x20list','✔\x20Found\x20','getPolicyPermissions','267jIkIRX','execute'];a32_0xc04b=function(){return _0x29d155;};return a32_0xc04b();}function formatOperations(_0x102613){const _0x7a180=[...new Set(_0x102613['map'](_0x238de7=>_0x238de7['operation']))];return _0x7a180['join'](',\x20');}
1
+ const a32_0xfa0b09=a32_0x1397;function a32_0x1397(_0x5a3f1e,_0x596981){_0x5a3f1e=_0x5a3f1e-0x114;const _0x32ef51=a32_0x32ef();let _0x1397cc=_0x32ef51[_0x5a3f1e];return _0x1397cc;}(function(_0x1c52ef,_0x5f49cb){const _0x35dfe5=a32_0x1397,_0x3aba09=_0x1c52ef();while(!![]){try{const _0x5864f3=-parseInt(_0x35dfe5(0x11c))/0x1+-parseInt(_0x35dfe5(0x14a))/0x2+parseInt(_0x35dfe5(0x149))/0x3*(parseInt(_0x35dfe5(0x143))/0x4)+parseInt(_0x35dfe5(0x130))/0x5+-parseInt(_0x35dfe5(0x11f))/0x6*(-parseInt(_0x35dfe5(0x12f))/0x7)+parseInt(_0x35dfe5(0x131))/0x8*(parseInt(_0x35dfe5(0x135))/0x9)+-parseInt(_0x35dfe5(0x129))/0xa;if(_0x5864f3===_0x5f49cb)break;else _0x3aba09['push'](_0x3aba09['shift']());}catch(_0x5d098c){_0x3aba09['push'](_0x3aba09['shift']());}}}(a32_0x32ef,0xe261d));import{BaseCommand}from'./command.js';import{handleSDKOutput,handleSingleObjectOutput,isStructuredFormat}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import a32_0x2f4381 from'chalk';export class PolicyCommand extends BaseCommand{[a32_0xfa0b09(0x11b)]=a32_0xfa0b09(0x144);['description']=a32_0xfa0b09(0x12e);async[a32_0xfa0b09(0x14b)](_0x4f788e){const _0x5225a3=a32_0xfa0b09,{options:_0x1a0451,tdx:_0x1b2eec}=_0x4f788e,_0x290f46=await withSpinner(_0x5225a3(0x123),async()=>{const _0x206bb3=_0x5225a3,[_0x8c80e1,_0x3c22ad]=await Promise[_0x206bb3(0x142)]([_0x1b2eec['user']['getCurrent'](),_0x1b2eec[_0x206bb3(0x144)][_0x206bb3(0x118)]()]);return{'userInfo':_0x8c80e1,'permissions':_0x3c22ad};},{'verbose':_0x1a0451[_0x5225a3(0x13a)]}),{userInfo:_0x59fb84,permissions:_0x451426}=_0x290f46['data'];if(isStructuredFormat(_0x1a0451))return await handleSingleObjectOutput(_0x451426,_0x1a0451),0x0;const _0x3075b3=_0x59fb84[_0x5225a3(0x11d)]?'Account\x20Owner':_0x59fb84[_0x5225a3(0x120)]?'Administrator':'Member';console[_0x5225a3(0x116)]('\x0a'+a32_0x2f4381[_0x5225a3(0x125)]('👤')+'\x20'+a32_0x2f4381[_0x5225a3(0x125)](_0x59fb84[_0x5225a3(0x11b)])+'\x20'+a32_0x2f4381[_0x5225a3(0x12b)]('('+_0x59fb84[_0x5225a3(0x13c)]+')')+_0x5225a3(0x126)+_0x3075b3),console[_0x5225a3(0x116)](a32_0x2f4381['dim'](_0x5225a3(0x141)+_0x1b2eec[_0x5225a3(0x148)][_0x5225a3(0x145)]+':'+_0x59fb84['account_id']+',\x20user_id:'+_0x59fb84['id']));const _0x378414=_0x451426[_0x5225a3(0x114)];console[_0x5225a3(0x116)]('\x0a'+a32_0x2f4381[_0x5225a3(0x125)](_0x5225a3(0x11e))+'\x20('+_0x378414[_0x5225a3(0x14c)]+'):');if(_0x378414[_0x5225a3(0x14c)]===0x0)console[_0x5225a3(0x116)](a32_0x2f4381[_0x5225a3(0x12b)](_0x5225a3(0x14e)));else for(const _0x1420ca of _0x378414){console['log'](_0x5225a3(0x122)+_0x1420ca[_0x5225a3(0x11b)]);}return printPermissionsMap(_0x451426[_0x5225a3(0x11a)]),console[_0x5225a3(0x116)](),0x0;}}export class PolicyListCommand extends BaseCommand{[a32_0xfa0b09(0x11b)]=a32_0xfa0b09(0x13e);['description']=a32_0xfa0b09(0x140);async[a32_0xfa0b09(0x14b)](_0x28c06f){const _0x4dc1d6=a32_0xfa0b09,{options:_0x3d3136,tdx:_0x49724d}=_0x28c06f,_0x3af0a8=await withSpinner('Listing\x20policies...',()=>_0x49724d[_0x4dc1d6(0x144)][_0x4dc1d6(0x127)](),{'verbose':_0x3d3136[_0x4dc1d6(0x13a)]}),_0x5d463b=_0x3af0a8['data'];console[_0x4dc1d6(0x128)](_0x4dc1d6(0x13b)+_0x5d463b[_0x4dc1d6(0x14c)]+_0x4dc1d6(0x134)+(_0x5d463b[_0x4dc1d6(0x14c)]!==0x1?_0x4dc1d6(0x124):'y'));if(isStructuredFormat(_0x3d3136))return await handleSDKOutput(_0x5d463b,_0x3d3136),0x0;if(_0x5d463b[_0x4dc1d6(0x14c)]===0x0)console[_0x4dc1d6(0x116)](a32_0x2f4381['dim'](_0x4dc1d6(0x147)));else for(const _0x53f037 of _0x5d463b){const _0x36be4c=_0x53f037[_0x4dc1d6(0x146)]?a32_0x2f4381[_0x4dc1d6(0x12b)]('\x20—\x20'+_0x53f037[_0x4dc1d6(0x146)]):'';console[_0x4dc1d6(0x116)](_0x4dc1d6(0x122)+_0x53f037['name']+_0x36be4c);}return 0x0;}}export class PolicyShowCommand extends BaseCommand{[a32_0xfa0b09(0x11b)]=a32_0xfa0b09(0x119);['description']=a32_0xfa0b09(0x12c);['validate'](_0x360c89){const _0x2065f6=a32_0xfa0b09;if(_0x360c89[_0x2065f6(0x13f)][_0x2065f6(0x14c)]===0x0)return _0x2065f6(0x136);return undefined;}async[a32_0xfa0b09(0x14b)](_0x4c8a21){const _0x37bf24=a32_0xfa0b09,{options:_0xbc7013,tdx:_0x1390b1}=_0x4c8a21,_0x36bca8=_0x4c8a21[_0x37bf24(0x13f)][0x0],_0x4d09e6=await withSpinner('Fetching\x20policy...',async()=>{const _0x21d098=_0x37bf24,_0x9cacd0=await _0x1390b1[_0x21d098(0x144)][_0x21d098(0x117)](_0x36bca8),[_0x1bd56c,_0x278581]=await Promise[_0x21d098(0x142)]([_0x1390b1[_0x21d098(0x144)]['getPolicyPermissions'](_0x9cacd0['id']),_0x1390b1[_0x21d098(0x144)]['getPolicyUsers'](_0x9cacd0['id'])]);return{'policy':_0x9cacd0,'perms':_0x1bd56c,'users':_0x278581};},{'verbose':_0xbc7013[_0x37bf24(0x13a)]}),{policy:_0x3c95a6,perms:_0x1f1128,users:_0x14b11a}=_0x4d09e6[_0x37bf24(0x12d)];if(isStructuredFormat(_0xbc7013))return await handleSingleObjectOutput({..._0x3c95a6,'permissions':_0x1f1128['permissions'],'users':_0x14b11a},_0xbc7013),0x0;console[_0x37bf24(0x116)]('\x0a'+a32_0x2f4381[_0x37bf24(0x125)]('📋')+'\x20'+a32_0x2f4381[_0x37bf24(0x125)](_0x3c95a6[_0x37bf24(0x11b)])+'\x20'+a32_0x2f4381[_0x37bf24(0x12b)](_0x37bf24(0x115)+_0x3c95a6['id']+')'));_0x3c95a6[_0x37bf24(0x146)]&&console[_0x37bf24(0x116)](_0x37bf24(0x141)+a32_0x2f4381['dim'](_0x3c95a6['description']));console[_0x37bf24(0x116)]('\x20\x20\x20'+_0x14b11a[_0x37bf24(0x14c)]+'\x20user'+(_0x14b11a[_0x37bf24(0x14c)]!==0x1?'s':'')+_0x37bf24(0x121)),printPermissionsMap(_0x1f1128[_0x37bf24(0x11a)]);if(_0x14b11a[_0x37bf24(0x14c)]>0x0){console[_0x37bf24(0x116)]('\x0a'+a32_0x2f4381[_0x37bf24(0x125)](_0x37bf24(0x13d))+':');for(const _0x29cd89 of _0x14b11a){const _0x32a833=_0x29cd89[_0x37bf24(0x13c)]&&_0x29cd89[_0x37bf24(0x13c)]!==_0x29cd89['name']?a32_0x2f4381[_0x37bf24(0x12b)]('\x20<'+_0x29cd89['email']+'>'):'';console[_0x37bf24(0x116)](_0x37bf24(0x122)+_0x29cd89[_0x37bf24(0x11b)]+_0x32a833);}}return console[_0x37bf24(0x116)](),0x0;}}function printPermissionsMap(_0x4ef779){const _0x35189a=a32_0xfa0b09,_0x37b40f=Object[_0x35189a(0x139)](_0x4ef779);console[_0x35189a(0x116)]('\x0a'+a32_0x2f4381[_0x35189a(0x125)]('🔑\x20Effective\x20Permissions')+':');if(_0x37b40f[_0x35189a(0x14c)]===0x0){console[_0x35189a(0x116)](a32_0x2f4381['dim'](_0x35189a(0x133)));return;}const _0x306d0b=Math[_0x35189a(0x137)](..._0x37b40f[_0x35189a(0x14d)](([_0x544c20])=>_0x544c20[_0x35189a(0x14c)]));for(const [_0x4ae8b9,_0x3f1174]of _0x37b40f){const _0xbf80ec=formatOperations(_0x3f1174);console[_0x35189a(0x116)]('\x20\x20'+_0x4ae8b9[_0x35189a(0x132)](_0x306d0b+0x2)+_0xbf80ec);}}function a32_0x32ef(){const _0x414496=['Fetching\x20permissions...','ies','bold','\x20—\x20','listPolicies','error','3826030kQNKvA','operation','dim','Show\x20a\x20specific\x20policy\x20details\x20and\x20permissions\x20(admin\x20only)','data','Show\x20current\x20user\x20policies\x20and\x20effective\x20permissions','7WSmHwS','4301815PwTUkJ','16eYcKau','padEnd','\x20\x20No\x20permissions','\x20polic','2186001WkUamT','Usage:\x20tdx\x20policy\x20show\x20<policy-name-or-id>','max','join','entries','verbose','✔\x20Found\x20','email','👥\x20Assigned\x20Users','policy\x20list','args','List\x20all\x20policies\x20in\x20the\x20account\x20(admin\x20only)','\x20\x20\x20','all','4ZZqOcz','policy','site','description','No\x20policies\x20found','context','1830528lOkXhy','3299424tdSMlk','execute','length','map','\x20\x20No\x20policies\x20assigned','policies','(ID:\x20','log','getPolicy','getMyPermissions','policy\x20show','permissions','name','208658MTqjsU','account_owner','📋\x20Assigned\x20Policies','7271502XsctBf','administrator','\x20assigned','\x20\x20•\x20'];a32_0x32ef=function(){return _0x414496;};return a32_0x32ef();}function formatOperations(_0x1e0d05){const _0x3c18d5=a32_0xfa0b09,_0x45fb5e=[...new Set(_0x1e0d05[_0x3c18d5(0x14d)](_0xa8cc1b=>_0xa8cc1b[_0x3c18d5(0x12a)]))];return _0x45fb5e[_0x3c18d5(0x138)](',\x20');}
@@ -1 +1 @@
1
- const a33_0x3a7854=a33_0x1c0b;(function(_0x2571f0,_0x4eeb0c){const _0x224816=a33_0x1c0b,_0xf0db40=_0x2571f0();while(!![]){try{const _0x2f7427=parseInt(_0x224816(0x13d))/0x1+-parseInt(_0x224816(0x148))/0x2*(parseInt(_0x224816(0x127))/0x3)+parseInt(_0x224816(0x12c))/0x4*(-parseInt(_0x224816(0x138))/0x5)+-parseInt(_0x224816(0x13e))/0x6*(parseInt(_0x224816(0x14f))/0x7)+parseInt(_0x224816(0x13a))/0x8+-parseInt(_0x224816(0x124))/0x9+parseInt(_0x224816(0x115))/0xa;if(_0x2f7427===_0x4eeb0c)break;else _0xf0db40['push'](_0xf0db40['shift']());}catch(_0x4bb007){_0xf0db40['push'](_0xf0db40['shift']());}}}(a33_0xf8be,0x587d4));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_0x3549ac from'node:path';function a33_0x1c0b(_0x167213,_0x45479e){_0x167213=_0x167213-0x108;const _0xf8be05=a33_0xf8be();let _0x1c0b44=_0xf8be05[_0x167213];return _0x1c0b44;}function a33_0xf8be(){const _0x1ae825=['260838YRDPkX','3762otTRbf','\x20--default\x27\x20to\x20save\x20permanently','Set\x20session\x20profile','Changing\x20site\x20to\x20\x27','Session\x20profile\x20set\x20to:\x20','\x20\x20-\x20','Key=value\x20pair\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','log','Validating\x20API\x20key...','tdx:\x20profile\x20set','2tyFjYi','\x20Profile\x20\x27','Delete\x20a\x20profile','profile:set','profile:create','(cleared)','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','6230ffIgpv','\x0aTip:\x20Use\x20\x27tdx\x20profile\x20use\x20','force','error','\x20API\x20key\x20saved\x20to\x20system\x20keychain\x20(profile:\x20','join','\x27\x20does\x20not\x20exist.\x20Create\x20it?','llm_project','apiKey','API\x20key\x20cannot\x20be\x20empty','email','Profile\x20name\x20cannot\x20be\x20empty','password','\x0aAvailable\x20profiles:','profileName','yellow','database','oauth','tdx.json','message','bold','green','status','\x27\x20requires\x20API\x20key\x20validation.','tdx:\x20profile\x20delete','Operation\x20cancelled','all','name','/app/mp/ak','\x0aSaved\x20to:\x20','Enter\x20profile\x20name:','profile:delete','\x20\x20(no\x20profiles\x20found)','\x0aYou\x20can\x20find\x20your\x20API\x20key\x20at:','\x0aSetup\x20cancelled','text','\x20API\x20key\x20is\x20valid\x20(User:\x20','Invalid\x20format.\x20Use:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','Removed\x20existing\x20profile\x20\x27','default','create','\x0aOperation\x20cancelled','✗\x20Validation\x20failed:\x20','trim','logLevel','\x20API\x20key\x20saved\x20to\x20system\x20keychain','VALID_KEYS','validate','getUserInfo','Setup\x20cancelled','6602790PMLaqV','length','description','us01','includes','Profile\x20was\x20not\x20created.\x20Please\x20try\x20again.','dim','\x20\x20tdx\x20--profile\x20','Enter\x20your\x20TD\x20API\x20key\x20for\x20the\x20new\x20site:','skipExistsCheck','execute','session','Profile\x20name\x20must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore','llm_agent','\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication','637398EXzZiH','\x27\x20updated:\x20','Removal\x20cancelled','801327AlvhaQ','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20use\x20<name>\x20[--default]','Set\x20a\x20profile\x20configuration\x20value','red','confirm','4jyaejp','parent_segment','config','Failed\x20to\x20delete\x20profile:\x20','test','Profile\x20\x27','Create\x20a\x20new\x20profile','Unknown\x20key\x20\x27','\x0aSetting\x20up\x20authentication\x20for\x20site:\x20','ERROR','\x27\x20to\x20remove\x20it\x20first,\x20or\x20re-create\x20with\x20--force.','Enter\x20your\x20TD\x20API\x20key:','1928965XmIatE','profile','5784712PbXaNs','warn','site'];a33_0xf8be=function(){return _0x1ae825;};return a33_0xf8be();}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_0xf307d7 from'prompts';import a33_0x27208b from'chalk';function validateProfileName(_0x4c0939,_0x35a8d5){const _0x2dd9c7=a33_0x1c0b;if(!_0x4c0939||!_0x4c0939[_0x2dd9c7(0x10e)]())return _0x2dd9c7(0x15a);const _0x1a4517=_0x4c0939['trim']();if(!/^[a-zA-Z0-9_-]+$/[_0x2dd9c7(0x130)](_0x1a4517))return _0x2dd9c7(0x121);if(!_0x35a8d5?.[_0x2dd9c7(0x11e)]&&profileExists(_0x1a4517))return _0x2dd9c7(0x131)+_0x1a4517+'\x27\x20already\x20exists.\x20Use\x20\x27tdx\x20profile\x20delete\x20'+_0x1a4517+_0x2dd9c7(0x136);return!![];}async function deleteProfileAndCredentials(_0x5480f5){const _0x55a421=a33_0x1c0b;removeProfileFromUserConfig(_0x5480f5);const _0x3e8a60=await isKeychainAvailable();_0x3e8a60&&await Promise[_0x55a421(0x169)]([deleteKeychainAPIKey(_0x5480f5),deleteOAuthTokens(_0x5480f5)]);}export class ProfileCreateCommand extends BaseCommand{['name']=a33_0x3a7854(0x14c);['description']=a33_0x3a7854(0x132);async['execute'](_0x1d392a){const _0x4f1ed7=a33_0x3a7854,{options:_0x4fc61e,args:_0x9d3d78}=_0x1d392a,_0x248045=!!_0x4fc61e[_0x4f1ed7(0x151)];console['log'](a33_0x27208b[_0x4f1ed7(0x163)]('tdx:\x20profile\x20create'));let _0xde79db;if(_0x9d3d78[_0x4f1ed7(0x116)]>0x0&&_0x9d3d78[0x0]){const _0x2324a9=_0x9d3d78[0x0][_0x4f1ed7(0x10e)]();_0x248045&&profileExists(_0x2324a9)&&(await deleteProfileAndCredentials(_0x2324a9),console[_0x4f1ed7(0x145)](_0x4f1ed7(0x109)+_0x2324a9+'\x27'));const _0xa29351=validateProfileName(_0x2324a9);if(_0xa29351!==!![])return console[_0x4f1ed7(0x152)](a33_0x27208b['red'](_0xa29351)),0x1;_0xde79db=_0x2324a9;}else{const _0x3669bc=await a33_0xf307d7({'type':'text','name':_0x4f1ed7(0x15d),'message':_0x4f1ed7(0x16d),'validate':_0x2f61d1=>validateProfileName(_0x2f61d1,{'skipExistsCheck':_0x248045})});if(!_0x3669bc[_0x4f1ed7(0x15d)])return console[_0x4f1ed7(0x145)]('\x0aSetup\x20cancelled'),0x1;_0xde79db=_0x3669bc[_0x4f1ed7(0x15d)]['trim'](),_0x248045&&profileExists(_0xde79db)&&(await deleteProfileAndCredentials(_0xde79db),console[_0x4f1ed7(0x145)](_0x4f1ed7(0x109)+_0xde79db+'\x27'));}const _0x53988e=await a33_0xf307d7({'type':_0x4f1ed7(0x172),'name':_0x4f1ed7(0x117),'message':'Enter\x20description\x20(optional):'}),_0x580807=_0x53988e['description']?.[_0x4f1ed7(0x10e)]()||undefined,_0x154948=_0x4fc61e[_0x4f1ed7(0x13c)]||_0x4f1ed7(0x118),_0x415d69=await promptSiteSelection(_0x154948,_0xde79db,_0x4f1ed7(0x114));if(!_0x415d69)return 0x1;const _0x32cd46=resolveSite(_0x415d69),_0x27d8b4=await promptAuthMethod();if(!_0x27d8b4)return console[_0x4f1ed7(0x145)](_0x4f1ed7(0x171)),0x1;if(_0x27d8b4===_0x4f1ed7(0x160)){if(_0x580807){const _0x1635d9={'site':_0x32cd46,'description':_0x580807};saveProfileToUserConfig(_0xde79db,_0x1635d9);}const {accountName:_0x3ea1a8}=_0x4fc61e;return await runOAuthLoginFlow(_0x32cd46,_0xde79db,_0x4fc61e[_0x4f1ed7(0x10f)]??LogLevel[_0x4f1ed7(0x135)],{'accountName':_0x3ea1a8}),0x0;}console[_0x4f1ed7(0x145)](_0x4f1ed7(0x134)+_0x32cd46),console['log']('You\x20can\x20find\x20your\x20API\x20key\x20at:'),console[_0x4f1ed7(0x145)]('\x20\x20'+getConsoleUrl(_0x32cd46,_0x4f1ed7(0x16b)));const _0x3e800a=await a33_0xf307d7({'type':'password','name':'apiKey','message':_0x4f1ed7(0x137),'validate':_0x3e1ff5=>{const _0x24e245=_0x4f1ed7;if(!_0x3e1ff5||!_0x3e1ff5['trim']())return _0x24e245(0x158);return!![];}});if(!_0x3e800a['apiKey'])return console[_0x4f1ed7(0x145)](_0x4f1ed7(0x171)),0x1;const _0x52db2f=_0x3e800a['apiKey'];console[_0x4f1ed7(0x145)](_0x4f1ed7(0x146));try{const _0x4bcb01=TDX[_0x4f1ed7(0x10b)]({'site':_0x32cd46,'apiKey':_0x52db2f[_0x4f1ed7(0x10e)](),'logLevel':_0x4fc61e[_0x4f1ed7(0x10f)]??LogLevel['ERROR']}),_0x4b0d46=await _0x4bcb01['jobs'][_0x4f1ed7(0x113)]();console[_0x4f1ed7(0x145)](a33_0x27208b[_0x4f1ed7(0x164)]('✓')+_0x4f1ed7(0x173)+_0x4b0d46[_0x4f1ed7(0x159)]+')');const _0x42f1a4=await isKeychainAvailable();_0x42f1a4?(await saveAPIKeyAsync(_0x52db2f[_0x4f1ed7(0x10e)](),_0x32cd46,_0xde79db),console['log'](a33_0x27208b[_0x4f1ed7(0x164)]('✓')+_0x4f1ed7(0x153)+_0xde79db+')')):(console[_0x4f1ed7(0x13b)](a33_0x27208b[_0x4f1ed7(0x15e)](_0x4f1ed7(0x14e))),console[_0x4f1ed7(0x13b)](a33_0x27208b['yellow']('\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.')));const _0x34a419={'site':_0x32cd46,..._0x580807&&{'description':_0x580807}};return saveProfileToUserConfig(_0xde79db,_0x34a419),console[_0x4f1ed7(0x145)](a33_0x27208b[_0x4f1ed7(0x164)]('✓')+_0x4f1ed7(0x149)+_0xde79db+'\x27\x20created'),console[_0x4f1ed7(0x145)](),console[_0x4f1ed7(0x145)]('You\x20can\x20now\x20use\x20tdx\x20commands\x20with\x20this\x20profile.\x20Try:'),console[_0x4f1ed7(0x145)](_0x4f1ed7(0x11c)+_0xde79db+_0x4f1ed7(0x123)),console['log'](_0x4f1ed7(0x11c)+_0xde79db+'\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases'),0x0;}catch(_0x564195){if(_0x564195 instanceof HTTPClientError&&_0x564195[_0x4f1ed7(0x165)]===0x191)return printAuthError(_0x564195),0x1;return console[_0x4f1ed7(0x152)](a33_0x27208b[_0x4f1ed7(0x12a)](_0x4f1ed7(0x10d)+(_0x564195 instanceof Error?_0x564195[_0x4f1ed7(0x162)]:String(_0x564195)))),console[_0x4f1ed7(0x152)](_0x4f1ed7(0x11a)),0x1;}}}export class ProfileDeleteCommand extends BaseCommand{[a33_0x3a7854(0x16a)]=a33_0x3a7854(0x16e);['description']=a33_0x3a7854(0x14a);['validate'](_0x139dbf){const _0x34c5b8=a33_0x3a7854,{args:_0x1877e0}=_0x139dbf;if(_0x1877e0[_0x34c5b8(0x116)]===0x0)return'Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20delete\x20<name>';return undefined;}async[a33_0x3a7854(0x11f)](_0x56f369){const _0x44724e=a33_0x3a7854,{args:_0x57ab85}=_0x56f369,_0x31ae18=_0x57ab85[0x0];console['log'](a33_0x27208b[_0x44724e(0x163)](_0x44724e(0x167)));if(!profileExists(_0x31ae18)){console[_0x44724e(0x152)](a33_0x27208b[_0x44724e(0x12a)](_0x44724e(0x131)+_0x31ae18+'\x27\x20does\x20not\x20exist.')),console[_0x44724e(0x145)](_0x44724e(0x15c));const _0x5ea84c=listProfiles();if(_0x5ea84c['length']===0x0)console[_0x44724e(0x145)](_0x44724e(0x16f));else for(const _0x297d67 of _0x5ea84c){console['log']('\x20\x20-\x20'+_0x297d67['name']);}return 0x1;}const _0x50e97f=await a33_0xf307d7({'type':'confirm','name':_0x44724e(0x12b),'message':'Are\x20you\x20sure\x20you\x20want\x20to\x20remove\x20profile\x20\x27'+_0x31ae18+'\x27?','initial':![]});if(!_0x50e97f[_0x44724e(0x12b)])return console[_0x44724e(0x145)](_0x44724e(0x126)),0x0;try{await deleteProfileAndCredentials(_0x31ae18),console[_0x44724e(0x145)](a33_0x27208b[_0x44724e(0x164)]('✓')+_0x44724e(0x149)+_0x31ae18+'\x27\x20deleted');}catch(_0x357d88){return console[_0x44724e(0x152)](a33_0x27208b[_0x44724e(0x12a)](_0x44724e(0x12f)+(_0x357d88 instanceof Error?_0x357d88[_0x44724e(0x162)]:String(_0x357d88)))),0x1;}return 0x0;}}export class ProfileSetCommand extends BaseCommand{[a33_0x3a7854(0x16a)]=a33_0x3a7854(0x14b);[a33_0x3a7854(0x117)]=a33_0x3a7854(0x129);static [a33_0x3a7854(0x111)]=[a33_0x3a7854(0x13c),a33_0x3a7854(0x15f),a33_0x3a7854(0x12d),a33_0x3a7854(0x156),a33_0x3a7854(0x122),a33_0x3a7854(0x117)];[a33_0x3a7854(0x112)](_0x485d6c){const _0x3f225a=a33_0x3a7854,{args:_0x24319e,options:_0x5cde32}=_0x485d6c,_0x4577ab=_0x5cde32[_0x3f225a(0x139)]||getActiveProfile();if(!_0x4577ab)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(_0x24319e['length']===0x0)return _0x3f225a(0x144)+ProfileSetCommand[_0x3f225a(0x111)][_0x3f225a(0x154)](',\x20');const _0x34b7c9=_0x24319e[0x0];if(!_0x34b7c9['includes']('='))return _0x3f225a(0x108)+ProfileSetCommand['VALID_KEYS'][_0x3f225a(0x154)](',\x20');const [_0x876e55]=_0x34b7c9['split']('=',0x2);if(!ProfileSetCommand[_0x3f225a(0x111)][_0x3f225a(0x119)](_0x876e55))return _0x3f225a(0x133)+_0x876e55+'\x27.\x0a\x0aValid\x20keys:\x20'+ProfileSetCommand[_0x3f225a(0x111)]['join'](',\x20');return undefined;}async[a33_0x3a7854(0x11f)](_0x1b117c){const _0x2654ac=a33_0x3a7854,{args:_0xa1774d,options:_0x47bb79}=_0x1b117c,_0x4dcfa7=_0x47bb79[_0x2654ac(0x139)]||getActiveProfile(),[_0x5b578c,..._0x2689a9]=_0xa1774d[0x0]['split']('='),_0x5cf387=_0x2689a9[_0x2654ac(0x154)]('=');console[_0x2654ac(0x145)](a33_0x27208b[_0x2654ac(0x163)](_0x2654ac(0x147)));if(!profileExists(_0x4dcfa7)){const _0x35461a=await a33_0xf307d7({'type':'confirm','name':_0x2654ac(0x10b),'message':_0x2654ac(0x131)+_0x4dcfa7+_0x2654ac(0x155),'initial':!![]});if(!_0x35461a['create'])return console[_0x2654ac(0x145)](_0x2654ac(0x168)),0x1;}const _0x3eb3b4=loadProfile(_0x4dcfa7),_0x4e2ce3=_0x3eb3b4?.[_0x2654ac(0x12e)]||{};if(_0x5b578c===_0x2654ac(0x13c)){const _0x1327f2=resolveSite(_0x5cf387);console[_0x2654ac(0x145)](_0x2654ac(0x141)+_0x1327f2+_0x2654ac(0x166)),console['log'](_0x2654ac(0x170)),console[_0x2654ac(0x145)]('\x20\x20'+getConsoleUrl(_0x1327f2,_0x2654ac(0x16b)));const _0x87e6ce=await a33_0xf307d7({'type':_0x2654ac(0x15b),'name':_0x2654ac(0x157),'message':_0x2654ac(0x11d),'validate':_0x2bf8b4=>{const _0x22597f=_0x2654ac;if(!_0x2bf8b4||!_0x2bf8b4[_0x22597f(0x10e)]())return _0x22597f(0x158);return!![];}});if(!_0x87e6ce[_0x2654ac(0x157)])return console['log'](_0x2654ac(0x10c)),0x1;console[_0x2654ac(0x145)](_0x2654ac(0x146));try{const _0x37d738=TDX[_0x2654ac(0x10b)]({'site':_0x1327f2,'apiKey':_0x87e6ce[_0x2654ac(0x157)][_0x2654ac(0x10e)](),'logLevel':_0x47bb79[_0x2654ac(0x10f)]??LogLevel[_0x2654ac(0x135)]}),_0x184cb2=await _0x37d738['jobs'][_0x2654ac(0x113)]();console['log'](a33_0x27208b[_0x2654ac(0x164)]('✓')+'\x20API\x20key\x20is\x20valid\x20(User:\x20'+_0x184cb2[_0x2654ac(0x159)]+')');const _0x41fe0f=await isKeychainAvailable();_0x41fe0f?(await saveAPIKeyAsync(_0x87e6ce[_0x2654ac(0x157)][_0x2654ac(0x10e)](),_0x1327f2,_0x4dcfa7),console['log'](a33_0x27208b[_0x2654ac(0x164)]('✓')+_0x2654ac(0x110))):console[_0x2654ac(0x13b)](a33_0x27208b[_0x2654ac(0x15e)]('⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.')),_0x4e2ce3[_0x2654ac(0x13c)]=_0x1327f2;}catch(_0xe1adb4){if(_0xe1adb4 instanceof HTTPClientError&&_0xe1adb4[_0x2654ac(0x165)]===0x191)return printAuthError(_0xe1adb4),0x1;return console[_0x2654ac(0x152)](a33_0x27208b[_0x2654ac(0x12a)]('✗\x20Validation\x20failed:\x20'+(_0xe1adb4 instanceof Error?_0xe1adb4[_0x2654ac(0x162)]:String(_0xe1adb4)))),console['error']('Site\x20was\x20not\x20changed.'),0x1;}}else _0x4e2ce3[_0x5b578c]=_0x5cf387||undefined;return saveProfileToUserConfig(_0x4dcfa7,_0x4e2ce3),console[_0x2654ac(0x145)](a33_0x27208b[_0x2654ac(0x164)]('✓')+_0x2654ac(0x149)+_0x4dcfa7+_0x2654ac(0x125)+_0x5b578c+'='+(_0x5cf387||_0x2654ac(0x14d))),0x0;}}export class ProfileUseCommand extends BaseCommand{['name']='profile:use';[a33_0x3a7854(0x117)]=a33_0x3a7854(0x140);['validate'](_0x4d109c){const _0xd5ed23=a33_0x3a7854,{args:_0x52701c}=_0x4d109c;if(_0x52701c[_0xd5ed23(0x116)]===0x0)return _0xd5ed23(0x128);return undefined;}async[a33_0x3a7854(0x11f)](_0x469afb){const _0x5c8e97=a33_0x3a7854,{args:_0xfde774,options:_0x1e8f00}=_0x469afb,_0xc9432f=_0xfde774[0x0],_0x1277de=_0x1e8f00[_0x5c8e97(0x10a)];cleanExpiredSessions();if(!profileExists(_0xc9432f)){console['error'](a33_0x27208b['red'](_0x5c8e97(0x131)+_0xc9432f+'\x27\x20does\x20not\x20exist.')),console[_0x5c8e97(0x145)](_0x5c8e97(0x15c));const _0x5b54a3=listProfiles();if(_0x5b54a3[_0x5c8e97(0x116)]===0x0)console[_0x5c8e97(0x145)](_0x5c8e97(0x16f));else for(const _0x3084bb of _0x5b54a3){console['log'](_0x5c8e97(0x143)+_0x3084bb[_0x5c8e97(0x16a)]);}return 0x1;}if(_0x1277de){const _0xaaf122=a33_0x3549ac[_0x5c8e97(0x154)](getConfigDir(),_0x5c8e97(0x161));return saveActiveProfileToUserConfig(_0xc9432f),console[_0x5c8e97(0x145)]('Default\x20profile\x20set\x20to:\x20'+a33_0x27208b[_0x5c8e97(0x164)](_0xc9432f)),console[_0x5c8e97(0x145)](a33_0x27208b[_0x5c8e97(0x11b)](_0x5c8e97(0x16c)+_0xaaf122)),0x0;}const _0x5f3915=getSessionID(_0x1e8f00[_0x5c8e97(0x120)]);return saveSessionContext({'profile':_0xc9432f},_0x1e8f00[_0x5c8e97(0x120)]),console[_0x5c8e97(0x145)](_0x5c8e97(0x142)+a33_0x27208b[_0x5c8e97(0x164)](_0xc9432f)+'\x20'+a33_0x27208b['dim']('(session:\x20'+_0x5f3915+')')),console[_0x5c8e97(0x145)](a33_0x27208b[_0x5c8e97(0x11b)](_0x5c8e97(0x150)+_0xc9432f+_0x5c8e97(0x13f))),0x0;}}
1
+ const a33_0x46baad=a33_0x56b6;(function(_0x363fe7,_0x54e743){const _0x3c6f6d=a33_0x56b6,_0x3afe8c=_0x363fe7();while(!![]){try{const _0x1d6713=-parseInt(_0x3c6f6d(0x19e))/0x1+parseInt(_0x3c6f6d(0x187))/0x2*(-parseInt(_0x3c6f6d(0x1c8))/0x3)+-parseInt(_0x3c6f6d(0x180))/0x4*(-parseInt(_0x3c6f6d(0x169))/0x5)+parseInt(_0x3c6f6d(0x1ac))/0x6+parseInt(_0x3c6f6d(0x160))/0x7+parseInt(_0x3c6f6d(0x17e))/0x8+-parseInt(_0x3c6f6d(0x176))/0x9;if(_0x1d6713===_0x54e743)break;else _0x3afe8c['push'](_0x3afe8c['shift']());}catch(_0x2aab46){_0x3afe8c['push'](_0x3afe8c['shift']());}}}(a33_0x5bcc,0x88543));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_0x8848e0 from'node:path';import{saveSessionContext,getSessionID,cleanExpiredSessions}from'../core/session.js';import{saveAPIKeyAsync,resolveSite}from'../core/config.js';function a33_0x5bcc(){const _0x1456d5=['status','Profile\x20name\x20cannot\x20be\x20empty','Unknown\x20key\x20\x27','text','Changing\x20site\x20to\x20\x27','error','Default\x20profile\x20set\x20to:\x20','\x20\x20tdx\x20--profile\x20','password','Validating\x20API\x20key...','jobs','1263564kVWBWT','email','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20delete\x20<name>','profileName','\x27\x20deleted','green','/app/mp/ak','message','Removed\x20existing\x20profile\x20\x27','llm_agent','trim','confirm','✗\x20Validation\x20failed:\x20','Create\x20a\x20new\x20profile','profile','\x27\x20does\x20not\x20exist.\x20Create\x20it?','log','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>','llm_project','\x20\x20-\x20','\x27\x20requires\x20API\x20key\x20validation.','tdx.json','Profile\x20was\x20not\x20created.\x20Please\x20try\x20again.','Enter\x20description\x20(optional):','\x20--default\x27\x20to\x20save\x20permanently','execute','ERROR','Delete\x20a\x20profile','435uZXsJI','Session\x20profile\x20set\x20to:\x20','Set\x20session\x20profile','Are\x20you\x20sure\x20you\x20want\x20to\x20remove\x20profile\x20\x27','5891662lNtfvN','dim','site','profile:create','\x27.\x0a\x0aValid\x20keys:\x20','\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','\x27\x20updated:\x20','\x0aSaved\x20to:\x20','3580OYAmHg','Removal\x20cancelled','\x20\x20(no\x20profiles\x20found)','getUserInfo','Enter\x20your\x20TD\x20API\x20key:','\x0aSetting\x20up\x20authentication\x20for\x20site:\x20','\x27\x20already\x20exists.\x20Use\x20\x27tdx\x20profile\x20delete\x20','Site\x20was\x20not\x20changed.','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20use\x20<name>\x20[--default]','\x27\x20does\x20not\x20exist.','VALID_KEYS','test','us01','3047184BZafGh','description','tdx:\x20profile\x20create','(session:\x20','skipExistsCheck','parent_segment','red','Failed\x20to\x20delete\x20profile:\x20','7006528TgLVlY','yellow','2352jyVBrU','config','join','Profile\x20\x27','\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication','split','apiKey','13362mHaavk','profile:delete','\x20Profile\x20\x27','\x20API\x20key\x20is\x20valid\x20(User:\x20','name','\x0aYou\x20can\x20find\x20your\x20API\x20key\x20at:','database','session','\x0aSetup\x20cancelled','warn','\x20API\x20key\x20saved\x20to\x20system\x20keychain\x20(profile:\x20','\x0aOperation\x20cancelled','profile:use','Setup\x20cancelled','bold','default','includes','\x27\x20created','validate','Set\x20a\x20profile\x20configuration\x20value','length','create','\x27\x20to\x20remove\x20it\x20first,\x20or\x20re-create\x20with\x20--force.','483360ViOicN','API\x20key\x20cannot\x20be\x20empty','tdx:\x20profile\x20delete'];a33_0x5bcc=function(){return _0x1456d5;};return a33_0x5bcc();}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_0x2a197d from'prompts';import a33_0x24a915 from'chalk';function validateProfileName(_0x54f360,_0x3e01b1){const _0x480d25=a33_0x56b6;if(!_0x54f360||!_0x54f360[_0x480d25(0x1b6)]())return _0x480d25(0x1a2);const _0x3d8492=_0x54f360[_0x480d25(0x1b6)]();if(!/^[a-zA-Z0-9_-]+$/[_0x480d25(0x174)](_0x3d8492))return'Profile\x20name\x20must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore';if(!_0x3e01b1?.[_0x480d25(0x17a)]&&profileExists(_0x3d8492))return _0x480d25(0x183)+_0x3d8492+_0x480d25(0x16f)+_0x3d8492+_0x480d25(0x19d);return!![];}async function deleteProfileAndCredentials(_0x206e36){removeProfileFromUserConfig(_0x206e36);const _0x3d5f85=await isKeychainAvailable();_0x3d5f85&&await Promise['all']([deleteKeychainAPIKey(_0x206e36),deleteOAuthTokens(_0x206e36)]);}function a33_0x56b6(_0x597398,_0x45a5e6){_0x597398=_0x597398-0x15d;const _0x5bccc3=a33_0x5bcc();let _0x56b6fa=_0x5bccc3[_0x597398];return _0x56b6fa;}export class ProfileCreateCommand extends BaseCommand{[a33_0x46baad(0x18b)]=a33_0x46baad(0x163);[a33_0x46baad(0x177)]=a33_0x46baad(0x1b9);async[a33_0x46baad(0x1c5)](_0x305000){const _0x2aa1a1=a33_0x46baad,{options:_0x4b7dbe,args:_0x36eb89}=_0x305000,_0x3dbcce=!!_0x4b7dbe['force'];console[_0x2aa1a1(0x1bc)](a33_0x24a915['bold'](_0x2aa1a1(0x178)));let _0xa27881;if(_0x36eb89[_0x2aa1a1(0x19b)]>0x0&&_0x36eb89[0x0]){const _0x18a156=_0x36eb89[0x0][_0x2aa1a1(0x1b6)]();_0x3dbcce&&profileExists(_0x18a156)&&(await deleteProfileAndCredentials(_0x18a156),console[_0x2aa1a1(0x1bc)](_0x2aa1a1(0x1b4)+_0x18a156+'\x27'));const _0x45ff95=validateProfileName(_0x18a156);if(_0x45ff95!==!![])return console[_0x2aa1a1(0x1a6)](a33_0x24a915[_0x2aa1a1(0x17c)](_0x45ff95)),0x1;_0xa27881=_0x18a156;}else{const _0x49e891=await a33_0x2a197d({'type':_0x2aa1a1(0x1a4),'name':_0x2aa1a1(0x1af),'message':'Enter\x20profile\x20name:','validate':_0x34c5e9=>validateProfileName(_0x34c5e9,{'skipExistsCheck':_0x3dbcce})});if(!_0x49e891['profileName'])return console['log'](_0x2aa1a1(0x18f)),0x1;_0xa27881=_0x49e891[_0x2aa1a1(0x1af)][_0x2aa1a1(0x1b6)](),_0x3dbcce&&profileExists(_0xa27881)&&(await deleteProfileAndCredentials(_0xa27881),console['log'](_0x2aa1a1(0x1b4)+_0xa27881+'\x27'));}const _0x13c685=await a33_0x2a197d({'type':_0x2aa1a1(0x1a4),'name':'description','message':_0x2aa1a1(0x1c3)}),_0x3ec568=_0x13c685[_0x2aa1a1(0x177)]?.[_0x2aa1a1(0x1b6)]()||undefined,_0x5b2e2f=_0x4b7dbe[_0x2aa1a1(0x162)]||_0x2aa1a1(0x175),_0x2a3fbd=await promptSiteSelection(_0x5b2e2f,_0xa27881,_0x2aa1a1(0x194));if(!_0x2a3fbd)return 0x1;const _0x38064c=resolveSite(_0x2a3fbd),_0x24188d=await promptAuthMethod();if(!_0x24188d)return console['log'](_0x2aa1a1(0x18f)),0x1;if(_0x24188d==='oauth'){if(_0x3ec568){const _0x57d435={'site':_0x38064c,'description':_0x3ec568};saveProfileToUserConfig(_0xa27881,_0x57d435);}const {accountName:_0x2012f5}=_0x4b7dbe;return await runOAuthLoginFlow(_0x38064c,_0xa27881,_0x4b7dbe['logLevel']??LogLevel[_0x2aa1a1(0x1c6)],{'accountName':_0x2012f5}),0x0;}console[_0x2aa1a1(0x1bc)](_0x2aa1a1(0x16e)+_0x38064c),console[_0x2aa1a1(0x1bc)]('You\x20can\x20find\x20your\x20API\x20key\x20at:'),console[_0x2aa1a1(0x1bc)]('\x20\x20'+getConsoleUrl(_0x38064c,_0x2aa1a1(0x1b2)));const _0x1974cd=await a33_0x2a197d({'type':_0x2aa1a1(0x1a9),'name':_0x2aa1a1(0x186),'message':_0x2aa1a1(0x16d),'validate':_0x41ab8d=>{const _0x61db5e=_0x2aa1a1;if(!_0x41ab8d||!_0x41ab8d[_0x61db5e(0x1b6)]())return _0x61db5e(0x19f);return!![];}});if(!_0x1974cd[_0x2aa1a1(0x186)])return console['log'](_0x2aa1a1(0x18f)),0x1;const _0x1ea30b=_0x1974cd[_0x2aa1a1(0x186)];console[_0x2aa1a1(0x1bc)](_0x2aa1a1(0x1aa));try{const _0x66f7fc=TDX[_0x2aa1a1(0x19c)]({'site':_0x38064c,'apiKey':_0x1ea30b[_0x2aa1a1(0x1b6)](),'logLevel':_0x4b7dbe['logLevel']??LogLevel['ERROR']}),_0x5c991f=await _0x66f7fc[_0x2aa1a1(0x1ab)][_0x2aa1a1(0x16c)]();console[_0x2aa1a1(0x1bc)](a33_0x24a915[_0x2aa1a1(0x1b1)]('✓')+_0x2aa1a1(0x18a)+_0x5c991f[_0x2aa1a1(0x1ad)]+')');const _0xc569db=await isKeychainAvailable();_0xc569db?(await saveAPIKeyAsync(_0x1ea30b[_0x2aa1a1(0x1b6)](),_0x38064c,_0xa27881),console[_0x2aa1a1(0x1bc)](a33_0x24a915[_0x2aa1a1(0x1b1)]('✓')+_0x2aa1a1(0x191)+_0xa27881+')')):(console['warn'](a33_0x24a915[_0x2aa1a1(0x17f)](_0x2aa1a1(0x166))),console[_0x2aa1a1(0x190)](a33_0x24a915[_0x2aa1a1(0x17f)](_0x2aa1a1(0x165))));const _0x102c5d={'site':_0x38064c,..._0x3ec568&&{'description':_0x3ec568}};return saveProfileToUserConfig(_0xa27881,_0x102c5d),console[_0x2aa1a1(0x1bc)](a33_0x24a915[_0x2aa1a1(0x1b1)]('✓')+'\x20Profile\x20\x27'+_0xa27881+_0x2aa1a1(0x198)),console[_0x2aa1a1(0x1bc)](),console[_0x2aa1a1(0x1bc)]('You\x20can\x20now\x20use\x20tdx\x20commands\x20with\x20this\x20profile.\x20Try:'),console['log'](_0x2aa1a1(0x1a8)+_0xa27881+_0x2aa1a1(0x184)),console['log'](_0x2aa1a1(0x1a8)+_0xa27881+'\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases'),0x0;}catch(_0x591185){if(_0x591185 instanceof HTTPClientError&&_0x591185[_0x2aa1a1(0x1a1)]===0x191)return printAuthError(_0x591185),0x1;return console['error'](a33_0x24a915['red'](_0x2aa1a1(0x1b8)+(_0x591185 instanceof Error?_0x591185[_0x2aa1a1(0x1b3)]:String(_0x591185)))),console[_0x2aa1a1(0x1a6)](_0x2aa1a1(0x1c2)),0x1;}}}export class ProfileDeleteCommand extends BaseCommand{[a33_0x46baad(0x18b)]=a33_0x46baad(0x188);['description']=a33_0x46baad(0x1c7);['validate'](_0xbe5375){const _0x450480=a33_0x46baad,{args:_0x338d3b}=_0xbe5375;if(_0x338d3b[_0x450480(0x19b)]===0x0)return _0x450480(0x1ae);return undefined;}async[a33_0x46baad(0x1c5)](_0x336d65){const _0x97dc23=a33_0x46baad,{args:_0x390b4a}=_0x336d65,_0x499351=_0x390b4a[0x0];console[_0x97dc23(0x1bc)](a33_0x24a915[_0x97dc23(0x195)](_0x97dc23(0x1a0)));if(!profileExists(_0x499351)){console[_0x97dc23(0x1a6)](a33_0x24a915[_0x97dc23(0x17c)]('Profile\x20\x27'+_0x499351+'\x27\x20does\x20not\x20exist.')),console[_0x97dc23(0x1bc)]('\x0aAvailable\x20profiles:');const _0x22c425=listProfiles();if(_0x22c425[_0x97dc23(0x19b)]===0x0)console['log'](_0x97dc23(0x16b));else for(const _0x195bf4 of _0x22c425){console[_0x97dc23(0x1bc)](_0x97dc23(0x1bf)+_0x195bf4[_0x97dc23(0x18b)]);}return 0x1;}const _0x189f02=await a33_0x2a197d({'type':_0x97dc23(0x1b7),'name':_0x97dc23(0x1b7),'message':_0x97dc23(0x15f)+_0x499351+'\x27?','initial':![]});if(!_0x189f02['confirm'])return console[_0x97dc23(0x1bc)](_0x97dc23(0x16a)),0x0;try{await deleteProfileAndCredentials(_0x499351),console[_0x97dc23(0x1bc)](a33_0x24a915[_0x97dc23(0x1b1)]('✓')+_0x97dc23(0x189)+_0x499351+_0x97dc23(0x1b0));}catch(_0x579a9b){return console[_0x97dc23(0x1a6)](a33_0x24a915['red'](_0x97dc23(0x17d)+(_0x579a9b instanceof Error?_0x579a9b[_0x97dc23(0x1b3)]:String(_0x579a9b)))),0x1;}return 0x0;}}export class ProfileSetCommand extends BaseCommand{[a33_0x46baad(0x18b)]='profile:set';[a33_0x46baad(0x177)]=a33_0x46baad(0x19a);static [a33_0x46baad(0x173)]=[a33_0x46baad(0x162),a33_0x46baad(0x18d),a33_0x46baad(0x17b),a33_0x46baad(0x1be),a33_0x46baad(0x1b5),a33_0x46baad(0x177)];[a33_0x46baad(0x199)](_0x3151a4){const _0x3357d=a33_0x46baad,{args:_0x3b6442,options:_0x110029}=_0x3151a4,_0x1c78d8=_0x110029[_0x3357d(0x1ba)]||getActiveProfile();if(!_0x1c78d8)return _0x3357d(0x1bd);if(_0x3b6442[_0x3357d(0x19b)]===0x0)return'Key=value\x20pair\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20'+ProfileSetCommand[_0x3357d(0x173)][_0x3357d(0x182)](',\x20');const _0x377903=_0x3b6442[0x0];if(!_0x377903[_0x3357d(0x197)]('='))return'Invalid\x20format.\x20Use:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20'+ProfileSetCommand['VALID_KEYS']['join'](',\x20');const [_0x11b8fc]=_0x377903[_0x3357d(0x185)]('=',0x2);if(!ProfileSetCommand[_0x3357d(0x173)][_0x3357d(0x197)](_0x11b8fc))return _0x3357d(0x1a3)+_0x11b8fc+_0x3357d(0x164)+ProfileSetCommand[_0x3357d(0x173)][_0x3357d(0x182)](',\x20');return undefined;}async[a33_0x46baad(0x1c5)](_0x23c31b){const _0x70e88b=a33_0x46baad,{args:_0x95b05,options:_0x241831}=_0x23c31b,_0x48f8e9=_0x241831[_0x70e88b(0x1ba)]||getActiveProfile(),[_0x333b09,..._0x5bb0fe]=_0x95b05[0x0][_0x70e88b(0x185)]('='),_0x5750f5=_0x5bb0fe[_0x70e88b(0x182)]('=');console[_0x70e88b(0x1bc)](a33_0x24a915[_0x70e88b(0x195)]('tdx:\x20profile\x20set'));if(!profileExists(_0x48f8e9)){const _0x128bfe=await a33_0x2a197d({'type':_0x70e88b(0x1b7),'name':'create','message':_0x70e88b(0x183)+_0x48f8e9+_0x70e88b(0x1bb),'initial':!![]});if(!_0x128bfe[_0x70e88b(0x19c)])return console[_0x70e88b(0x1bc)]('Operation\x20cancelled'),0x1;}const _0x2ede5b=loadProfile(_0x48f8e9),_0x7a425a=_0x2ede5b?.[_0x70e88b(0x181)]||{};if(_0x333b09===_0x70e88b(0x162)){const _0x440be6=resolveSite(_0x5750f5);console[_0x70e88b(0x1bc)](_0x70e88b(0x1a5)+_0x440be6+_0x70e88b(0x1c0)),console[_0x70e88b(0x1bc)](_0x70e88b(0x18c)),console[_0x70e88b(0x1bc)]('\x20\x20'+getConsoleUrl(_0x440be6,_0x70e88b(0x1b2)));const _0x58eded=await a33_0x2a197d({'type':_0x70e88b(0x1a9),'name':_0x70e88b(0x186),'message':'Enter\x20your\x20TD\x20API\x20key\x20for\x20the\x20new\x20site:','validate':_0x29ae01=>{const _0x2d05ad=_0x70e88b;if(!_0x29ae01||!_0x29ae01[_0x2d05ad(0x1b6)]())return'API\x20key\x20cannot\x20be\x20empty';return!![];}});if(!_0x58eded[_0x70e88b(0x186)])return console[_0x70e88b(0x1bc)](_0x70e88b(0x192)),0x1;console['log'](_0x70e88b(0x1aa));try{const _0x330425=TDX[_0x70e88b(0x19c)]({'site':_0x440be6,'apiKey':_0x58eded[_0x70e88b(0x186)][_0x70e88b(0x1b6)](),'logLevel':_0x241831['logLevel']??LogLevel[_0x70e88b(0x1c6)]}),_0xcd5c62=await _0x330425[_0x70e88b(0x1ab)][_0x70e88b(0x16c)]();console[_0x70e88b(0x1bc)](a33_0x24a915[_0x70e88b(0x1b1)]('✓')+_0x70e88b(0x18a)+_0xcd5c62[_0x70e88b(0x1ad)]+')');const _0x1c9539=await isKeychainAvailable();_0x1c9539?(await saveAPIKeyAsync(_0x58eded['apiKey'][_0x70e88b(0x1b6)](),_0x440be6,_0x48f8e9),console[_0x70e88b(0x1bc)](a33_0x24a915[_0x70e88b(0x1b1)]('✓')+'\x20API\x20key\x20saved\x20to\x20system\x20keychain')):console[_0x70e88b(0x190)](a33_0x24a915[_0x70e88b(0x17f)](_0x70e88b(0x166))),_0x7a425a[_0x70e88b(0x162)]=_0x440be6;}catch(_0x190deb){if(_0x190deb instanceof HTTPClientError&&_0x190deb[_0x70e88b(0x1a1)]===0x191)return printAuthError(_0x190deb),0x1;return console['error'](a33_0x24a915[_0x70e88b(0x17c)](_0x70e88b(0x1b8)+(_0x190deb instanceof Error?_0x190deb[_0x70e88b(0x1b3)]:String(_0x190deb)))),console[_0x70e88b(0x1a6)](_0x70e88b(0x170)),0x1;}}else _0x7a425a[_0x333b09]=_0x5750f5||undefined;return saveProfileToUserConfig(_0x48f8e9,_0x7a425a),console['log'](a33_0x24a915[_0x70e88b(0x1b1)]('✓')+_0x70e88b(0x189)+_0x48f8e9+_0x70e88b(0x167)+_0x333b09+'='+(_0x5750f5||'(cleared)')),0x0;}}export class ProfileUseCommand extends BaseCommand{[a33_0x46baad(0x18b)]=a33_0x46baad(0x193);[a33_0x46baad(0x177)]=a33_0x46baad(0x15e);[a33_0x46baad(0x199)](_0x40b2c3){const _0x1eeb8f=a33_0x46baad,{args:_0xd8a76b}=_0x40b2c3;if(_0xd8a76b[_0x1eeb8f(0x19b)]===0x0)return _0x1eeb8f(0x171);return undefined;}async['execute'](_0x4814b9){const _0xf4967c=a33_0x46baad,{args:_0x1ef3b1,options:_0x1c1f96}=_0x4814b9,_0x141efc=_0x1ef3b1[0x0],_0x3e386a=_0x1c1f96[_0xf4967c(0x196)];cleanExpiredSessions();if(!profileExists(_0x141efc)){console[_0xf4967c(0x1a6)](a33_0x24a915[_0xf4967c(0x17c)](_0xf4967c(0x183)+_0x141efc+_0xf4967c(0x172))),console[_0xf4967c(0x1bc)]('\x0aAvailable\x20profiles:');const _0x5f54cf=listProfiles();if(_0x5f54cf['length']===0x0)console[_0xf4967c(0x1bc)](_0xf4967c(0x16b));else for(const _0x31bb58 of _0x5f54cf){console[_0xf4967c(0x1bc)](_0xf4967c(0x1bf)+_0x31bb58['name']);}return 0x1;}if(_0x3e386a){const _0x48dcbb=a33_0x8848e0[_0xf4967c(0x182)](getConfigDir(),_0xf4967c(0x1c1));return saveActiveProfileToUserConfig(_0x141efc),console[_0xf4967c(0x1bc)](_0xf4967c(0x1a7)+a33_0x24a915[_0xf4967c(0x1b1)](_0x141efc)),console['log'](a33_0x24a915[_0xf4967c(0x161)](_0xf4967c(0x168)+_0x48dcbb)),0x0;}const _0x338912=getSessionID(_0x1c1f96[_0xf4967c(0x18e)]);return saveSessionContext({'profile':_0x141efc},_0x1c1f96[_0xf4967c(0x18e)]),console[_0xf4967c(0x1bc)](_0xf4967c(0x15d)+a33_0x24a915[_0xf4967c(0x1b1)](_0x141efc)+'\x20'+a33_0x24a915[_0xf4967c(0x161)](_0xf4967c(0x179)+_0x338912+')')),console[_0xf4967c(0x1bc)](a33_0x24a915[_0xf4967c(0x161)]('\x0aTip:\x20Use\x20\x27tdx\x20profile\x20use\x20'+_0x141efc+_0xf4967c(0x1c4))),0x0;}}
@@ -1 +1 @@
1
- const a34_0x28a292=a34_0x41ba;(function(_0x305d81,_0x1c1aa7){const _0x103406=a34_0x41ba,_0x1dfd48=_0x305d81();while(!![]){try{const _0x506822=parseInt(_0x103406(0x1f3))/0x1+-parseInt(_0x103406(0x1f9))/0x2*(parseInt(_0x103406(0x1f1))/0x3)+parseInt(_0x103406(0x1ee))/0x4+parseInt(_0x103406(0x1f0))/0x5+-parseInt(_0x103406(0x1ed))/0x6*(parseInt(_0x103406(0x201))/0x7)+parseInt(_0x103406(0x1e8))/0x8*(parseInt(_0x103406(0x1f5))/0x9)+parseInt(_0x103406(0x1eb))/0xa*(parseInt(_0x103406(0x1f2))/0xb);if(_0x506822===_0x1c1aa7)break;else _0x1dfd48['push'](_0x1dfd48['shift']());}catch(_0xc30d73){_0x1dfd48['push'](_0x1dfd48['shift']());}}}(a34_0x584e,0x70b5e));import{BaseCommand}from'./command.js';import{listProfiles,getActiveProfile,getProfileParams}from'../core/profile.js';function a34_0x41ba(_0xe1add9,_0xec42a){_0xe1add9=_0xe1add9-0x1e6;const _0x584ee4=a34_0x584e();let _0x41ba3b=_0x584ee4[_0xe1add9];return _0x41ba3b;}function a34_0x584e(){const _0x2fcf17=['40tNWQyR','\x20\x20Global:\x20~/.config/tdx/tdx.json','6420kHopRM','2514648ZpBHrv','config','606830LMbnSU','181767HLJpmQ','1519738MncgCa','107016lVAOCW','List\x20all\x20available\x20profiles','9iQDsGi','length','map','👤\x20','28mtSSUG','name','No\x20profiles\x20found.\x20Define\x20profiles\x20in\x20tdx.json:\x0a','description','green','\x20\x20Local:\x20\x20(project\x20folder)/tdx.json','Error:\x20','site','2317sEpufp','message','log','2035216azOofd','scope','execute'];a34_0x584e=function(){return _0x2fcf17;};return a34_0x584e();}import{handleSDKOutput,isStructuredFormat}from'../core/command-output.js';import a34_0x46fe49 from'chalk';export class ProfilesCommand extends BaseCommand{[a34_0x28a292(0x1fa)]='profiles';['description']=a34_0x28a292(0x1f4);async[a34_0x28a292(0x1ea)](_0x20aedf){const _0x204a89=a34_0x28a292,{options:_0x43a3ce}=_0x20aedf;try{const _0x10ce81=listProfiles(),_0x46f5cc=getActiveProfile();if(_0x10ce81[_0x204a89(0x1f6)]===0x0)return console[_0x204a89(0x1e7)](_0x204a89(0x1fb)),console[_0x204a89(0x1e7)](_0x204a89(0x1fe)),console[_0x204a89(0x1e7)](_0x204a89(0x1ec)),0x0;const _0x4ef4fd=_0x10ce81[_0x204a89(0x1f7)](_0xb5d730=>{const _0x2568fa=_0x204a89,_0x13aaeb=_0xb5d730[_0x2568fa(0x1fa)]===_0x46f5cc,_0x557d24=getProfileParams(_0xb5d730['config']);return{'name':_0xb5d730[_0x2568fa(0x1fa)],'active':_0x13aaeb,'scope':_0xb5d730[_0x2568fa(0x1e9)],'description':_0xb5d730[_0x2568fa(0x1ef)][_0x2568fa(0x1fc)]||'','params':_0x557d24};});if(isStructuredFormat(_0x43a3ce))await handleSDKOutput(_0x4ef4fd,_0x43a3ce);else for(const _0x34fd93 of _0x10ce81){const _0x929a8d=_0x34fd93[_0x204a89(0x1fa)]===_0x46f5cc?a34_0x46fe49[_0x204a89(0x1fd)]('\x20✓'):'',_0x1ca588=_0x34fd93[_0x204a89(0x1ef)][_0x204a89(0x200)]?a34_0x46fe49['dim']('\x20'+_0x34fd93[_0x204a89(0x1ef)][_0x204a89(0x200)]):'',_0x5ac1a0=_0x34fd93[_0x204a89(0x1ef)][_0x204a89(0x1fc)]?a34_0x46fe49['dim']('\x20\x20'+_0x34fd93['config'][_0x204a89(0x1fc)]):'';console[_0x204a89(0x1e7)](_0x204a89(0x1f8)+_0x34fd93[_0x204a89(0x1fa)]+_0x929a8d+_0x1ca588+_0x5ac1a0);}return 0x0;}catch(_0x4aaaaf){return _0x4aaaaf instanceof Error&&console['error'](_0x204a89(0x1ff)+_0x4aaaaf[_0x204a89(0x1e6)]),0x1;}}}
1
+ const a34_0x59340f=a34_0x6818;(function(_0x5aa265,_0x3a212c){const _0xf6a773=a34_0x6818,_0x10c6ec=_0x5aa265();while(!![]){try{const _0x2910f6=parseInt(_0xf6a773(0x18e))/0x1+-parseInt(_0xf6a773(0x198))/0x2+parseInt(_0xf6a773(0x194))/0x3+parseInt(_0xf6a773(0x189))/0x4+-parseInt(_0xf6a773(0x197))/0x5+-parseInt(_0xf6a773(0x195))/0x6+-parseInt(_0xf6a773(0x18f))/0x7*(-parseInt(_0xf6a773(0x196))/0x8);if(_0x2910f6===_0x3a212c)break;else _0x10c6ec['push'](_0x10c6ec['shift']());}catch(_0x31d7ca){_0x10c6ec['push'](_0x10c6ec['shift']());}}}(a34_0x2765,0x86d1c));import{BaseCommand}from'./command.js';import{listProfiles,getActiveProfile,getProfileParams}from'../core/profile.js';import{handleSDKOutput,isStructuredFormat}from'../core/command-output.js';import a34_0x35c943 from'chalk';function a34_0x2765(){const _0x2dde02=['7dBHNaG','scope','👤\x20','site','message','2366664WtyiDH','5936988dchZmZ','3143128vMwThQ','4237635eNNXhB','369572MbPZsx','No\x20profiles\x20found.\x20Define\x20profiles\x20in\x20tdx.json:\x0a','dim','error','\x20\x20Local:\x20\x20(project\x20folder)/tdx.json','name','Error:\x20','execute','3514816cjWUgx','config','List\x20all\x20available\x20profiles','description','map','513548bjgqtq'];a34_0x2765=function(){return _0x2dde02;};return a34_0x2765();}function a34_0x6818(_0x3c89a9,_0x128b4a){_0x3c89a9=_0x3c89a9-0x182;const _0x276555=a34_0x2765();let _0x68184b=_0x276555[_0x3c89a9];return _0x68184b;}export class ProfilesCommand extends BaseCommand{[a34_0x59340f(0x186)]='profiles';['description']=a34_0x59340f(0x18b);async[a34_0x59340f(0x188)](_0x185a7e){const _0x4bba6e=a34_0x59340f,{options:_0x4da223}=_0x185a7e;try{const _0x504b0d=listProfiles(),_0x164234=getActiveProfile();if(_0x504b0d['length']===0x0)return console['log'](_0x4bba6e(0x182)),console['log'](_0x4bba6e(0x185)),console['log']('\x20\x20Global:\x20~/.config/tdx/tdx.json'),0x0;const _0x2032da=_0x504b0d[_0x4bba6e(0x18d)](_0x52326d=>{const _0x2cd1e2=_0x4bba6e,_0x5ce3c1=_0x52326d[_0x2cd1e2(0x186)]===_0x164234,_0x677804=getProfileParams(_0x52326d[_0x2cd1e2(0x18a)]);return{'name':_0x52326d[_0x2cd1e2(0x186)],'active':_0x5ce3c1,'scope':_0x52326d[_0x2cd1e2(0x190)],'description':_0x52326d[_0x2cd1e2(0x18a)][_0x2cd1e2(0x18c)]||'','params':_0x677804};});if(isStructuredFormat(_0x4da223))await handleSDKOutput(_0x2032da,_0x4da223);else for(const _0xdd73ec of _0x504b0d){const _0x1eb5dd=_0xdd73ec[_0x4bba6e(0x186)]===_0x164234?a34_0x35c943['green']('\x20✓'):'',_0x416223=_0xdd73ec[_0x4bba6e(0x18a)]['site']?a34_0x35c943[_0x4bba6e(0x183)]('\x20'+_0xdd73ec['config'][_0x4bba6e(0x192)]):'',_0x2afb04=_0xdd73ec[_0x4bba6e(0x18a)][_0x4bba6e(0x18c)]?a34_0x35c943[_0x4bba6e(0x183)]('\x20\x20'+_0xdd73ec[_0x4bba6e(0x18a)][_0x4bba6e(0x18c)]):'';console['log'](_0x4bba6e(0x191)+_0xdd73ec[_0x4bba6e(0x186)]+_0x1eb5dd+_0x416223+_0x2afb04);}return 0x0;}catch(_0x116118){return _0x116118 instanceof Error&&console[_0x4bba6e(0x184)](_0x4bba6e(0x187)+_0x116118[_0x4bba6e(0x193)]),0x1;}}}
@@ -1 +1 @@
1
- const a35_0x179c72=a35_0x2bd7;function a35_0x5626(){const _0x4ea3bc=['information_schema','41152uAIHmc','setPhase','5291048HYeocV','4690704FQByPx','SQL:\x20','options','\x20[Job\x20ID:\x20','3975145hHZsWz','Error:\x20','totalSplits','Executing\x20query\x20[','Cannot\x20specify\x20both\x20SQL\x20argument\x20and\x20--file\x20option','1128631Xtfysz','args','error','execute','push','jobId','site','description','catalog','33843lgRPML','elapsedTimeMillis','Executing\x20statement\x20','output','\x20splits','No\x20SQL\x20provided','in\x20','message','name','Statement\x20','\x20rows\x20','Site:\x20','stats','query','file','19233756vOVggp','Catalog:\x20','join','2CesIxL','processedRows','\x0aAll\x20results\x20saved\x20to\x20','completedSplits','Schema:\x20','originalMessage','Run\x20Trino\x20queries\x20(streaming)','setJobId','292joeaHV','verbose','\x20-\x20'];a35_0x5626=function(){return _0x4ea3bc;};return a35_0x5626();}(function(_0x5a4194,_0x50b5b8){const _0x4d1a5f=a35_0x2bd7,_0x4ff950=_0x5a4194();while(!![]){try{const _0x23b581=-parseInt(_0x4d1a5f(0x1d8))/0x1*(-parseInt(_0x4d1a5f(0x1b1))/0x2)+parseInt(_0x4d1a5f(0x1c6))/0x3*(parseInt(_0x4d1a5f(0x1ad))/0x4)+-parseInt(_0x4d1a5f(0x1b8))/0x5+-parseInt(_0x4d1a5f(0x1b4))/0x6+-parseInt(_0x4d1a5f(0x1bd))/0x7+-parseInt(_0x4d1a5f(0x1b3))/0x8+parseInt(_0x4d1a5f(0x1d5))/0x9;if(_0x23b581===_0x50b5b8)break;else _0x4ff950['push'](_0x4ff950['shift']());}catch(_0x2c5c00){_0x4ff950['push'](_0x4ff950['shift']());}}}(a35_0x5626,0x930d2));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';import{handleQueryOutput,formatQueryOutput,resolveOutputOptions}from'../core/command-output.js';function a35_0x2bd7(_0x2b0f28,_0x5007f7){_0x2b0f28=_0x2b0f28-0x1a9;const _0x56261d=a35_0x5626();let _0x2bd7ff=_0x56261d[_0x2b0f28];return _0x2bd7ff;}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_0x179c72(0x1ce)]=a35_0x179c72(0x1d3);[a35_0x179c72(0x1c4)]=a35_0x179c72(0x1ab);async[a35_0x179c72(0x1c0)](_0x128dec){const _0x34d8c0=a35_0x179c72,{options:_0x34dbd5,args:_0x1efc4c,tdx:_0x15f181}=_0x128dec,_0x19fbf4={..._0x34dbd5,'limitStructuredFormats':!![]},_0x9b6f2e=_0x1efc4c[0x0],_0x4499e5=_0x34dbd5[_0x34d8c0(0x1d4)];let _0x42edd1;try{if(_0x4499e5)_0x42edd1=readSqlStatementsFromFile(_0x4499e5);else{if(_0x9b6f2e==='-')_0x42edd1=await readSqlStatementsFromStdin();else{if(_0x9b6f2e&&isSqlFilePath(_0x9b6f2e))_0x42edd1=readSqlStatementsFromFile(_0x9b6f2e);else{if(_0x9b6f2e)_0x42edd1=splitSqlStatements(_0x9b6f2e);else throw new Error(_0x34d8c0(0x1cb));}}}}catch(_0x16c2a4){return console[_0x34d8c0(0x1bf)](_0x34d8c0(0x1b9)+_0x16c2a4[_0x34d8c0(0x1cd)]),0x1;}const _0x248f15=_0x34dbd5['database']||_0x34d8c0(0x1b0),_0x29358d=_0x34dbd5[_0x34d8c0(0x1c5)];try{const _0x5ed50b=[],_0x586723=!!_0x34dbd5[_0x34d8c0(0x1c9)];for(let _0x205b62=0x0;_0x205b62<_0x42edd1['length'];_0x205b62++){const _0x5ab269=_0x42edd1[_0x205b62],_0x56c6d1=_0x205b62+0x1,_0x147918=_0x42edd1['length'],_0x12ffcd=_0x147918>0x1;_0x34dbd5[_0x34d8c0(0x1ae)]&&(console[_0x34d8c0(0x1bf)]('\x0a'+(_0x12ffcd?_0x34d8c0(0x1cf)+_0x56c6d1+'/'+_0x147918+':':'')),console['error'](_0x34d8c0(0x1d1)+_0x34dbd5[_0x34d8c0(0x1c3)]),console[_0x34d8c0(0x1bf)](_0x34d8c0(0x1d6)+(_0x29358d||'td')),console['error'](_0x34d8c0(0x1a9)+_0x248f15),console['error'](_0x34d8c0(0x1b5)+_0x5ab269));const _0x2dee96=_0x12ffcd?_0x34d8c0(0x1c8)+_0x56c6d1+'/'+_0x147918+'...':'Executing\x20query...';try{const _0x4ee3da=await withProgressSpinner(_0x2dee96,async _0x43e33c=>{const _0x1fc662=_0x34d8c0,_0x4a7d4c=await _0x15f181[_0x1fc662(0x1d3)]['execute'](_0x5ab269,{'catalog':_0x29358d,'schema':_0x248f15,'onJobId':_0x4f08d8=>{const _0x42cd88=_0x1fc662;_0x43e33c[_0x42cd88(0x1ac)](_0x4f08d8);},'onProgress':_0x2d8d2b=>{const _0x19b2c1=_0x1fc662;_0x43e33c[_0x19b2c1(0x1b2)](_0x19b2c1(0x1bb)+_0x2d8d2b['state']+']'),_0x43e33c['setExtra'](formatRows(_0x2d8d2b[_0x19b2c1(0x1d9)])+_0x19b2c1(0x1d0)+_0x2d8d2b[_0x19b2c1(0x1db)]+'/'+_0x2d8d2b[_0x19b2c1(0x1ba)]+_0x19b2c1(0x1ca));}});return _0x4a7d4c;},{'verbose':_0x34dbd5[_0x34d8c0(0x1ae)]}),_0x508c9d=_0x4ee3da['data'],_0x4f25b3=_0x508c9d[_0x34d8c0(0x1c2)]?_0x34d8c0(0x1b7)+_0x508c9d[_0x34d8c0(0x1c2)]+']':'',_0x43c4c6=_0x12ffcd?_0x34d8c0(0x1cf)+_0x56c6d1+'/'+_0x147918+_0x34d8c0(0x1af):'';console['error']('✔\x20'+_0x43c4c6+'Query\x20completed:\x20Processed\x20'+formatRows(_0x508c9d[_0x34d8c0(0x1d2)]['processedRows'])+_0x34d8c0(0x1d0)+(_0x34d8c0(0x1cc)+formatElapsed(_0x508c9d[_0x34d8c0(0x1d2)][_0x34d8c0(0x1c7)])+_0x4f25b3));if(_0x12ffcd&&_0x586723){const _0x4dde1a=resolveOutputOptions(_0x19fbf4),_0x149efa=await formatQueryOutput(_0x508c9d,_0x4dde1a);_0x5ed50b[_0x34d8c0(0x1c1)](_0x149efa);}else await handleQueryOutput(_0x508c9d,_0x19fbf4);}catch(_0x20db7b){const _0x4e9938=_0x12ffcd?'Statement\x20'+_0x56c6d1+'/'+_0x147918+':\x0a':'',_0x7ceb8d=_0x20db7b instanceof SDKError?_0x20db7b[_0x34d8c0(0x1aa)]:_0x20db7b[_0x34d8c0(0x1cd)];return console[_0x34d8c0(0x1bf)](''+_0x4e9938+_0x7ceb8d),0x1;}}if(_0x42edd1['length']>0x1&&_0x586723&&_0x5ed50b['length']>0x0){const _0x269f58=_0x5ed50b[_0x34d8c0(0x1d7)]('\x0a');writeFileSync(_0x34dbd5[_0x34d8c0(0x1c9)],_0x269f58),console['error'](_0x34d8c0(0x1da)+_0x34dbd5[_0x34d8c0(0x1c9)]);}return 0x0;}catch(_0x5c24b8){throw _0x5c24b8;}}['validate'](_0xfcb562){const _0x5b5067=a35_0x179c72,_0x1b8a2b=_0xfcb562[_0x5b5067(0x1be)][0x0],_0x5b5b09=_0xfcb562[_0x5b5067(0x1b6)]['file'];if(!_0x1b8a2b&&!_0x5b5b09)return'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';if(_0x1b8a2b&&_0x5b5b09)return _0x5b5067(0x1bc);return undefined;}}
1
+ const a35_0x42b657=a35_0x1d99;function a35_0x1d99(_0x47bf9c,_0x9b7c8c){_0x47bf9c=_0x47bf9c-0x146;const _0x8f8c87=a35_0x8f8c();let _0x1d9901=_0x8f8c87[_0x47bf9c];return _0x1d9901;}(function(_0x264185,_0x12234b){const _0x8b537c=a35_0x1d99,_0x4ff3b2=_0x264185();while(!![]){try{const _0x2bfbfb=parseInt(_0x8b537c(0x15f))/0x1*(-parseInt(_0x8b537c(0x166))/0x2)+parseInt(_0x8b537c(0x177))/0x3+parseInt(_0x8b537c(0x172))/0x4+parseInt(_0x8b537c(0x16f))/0x5+-parseInt(_0x8b537c(0x164))/0x6+-parseInt(_0x8b537c(0x160))/0x7*(parseInt(_0x8b537c(0x175))/0x8)+-parseInt(_0x8b537c(0x147))/0x9;if(_0x2bfbfb===_0x12234b)break;else _0x4ff3b2['push'](_0x4ff3b2['shift']());}catch(_0x4a457f){_0x4ff3b2['push'](_0x4ff3b2['shift']());}}}(a35_0x8f8c,0x88206));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';function a35_0x8f8c(){const _0x44994b=['in\x20','length','2796594CLkLur','message','20422hEMtHI','Query\x20completed:\x20Processed\x20','Statement\x20','setExtra','Executing\x20query...','information_schema','data','No\x20SQL\x20provided','verbose','3576990AObUuy','originalMessage','database','2754028RkxEjL','elapsedTimeMillis','\x20[Job\x20ID:\x20','88DhuxaW','file','2463747AMwFkP','output','8418645CqBcuB','\x20rows\x20','Error:\x20','options','...','\x0aAll\x20results\x20saved\x20to\x20','site','error','join','description','\x20-\x20','Executing\x20statement\x20','processedRows','completedSplits','setPhase','Cannot\x20specify\x20both\x20SQL\x20argument\x20and\x20--file\x20option','Executing\x20query\x20[','totalSplits','SQL:\x20','query','args','stats','\x20splits','catalog','10GBRDdF','104342IWNfDt','jobId'];a35_0x8f8c=function(){return _0x44994b;};return a35_0x8f8c();}import{withProgressSpinner,formatElapsed}from'../utils/spinner.js';import{formatRows}from'../sdk/util/formatters.js';export class QueryCommand extends BaseCommand{['name']=a35_0x42b657(0x15a);[a35_0x42b657(0x150)]='Run\x20Trino\x20queries\x20(streaming)';async['execute'](_0xa83468){const _0x5d6caa=a35_0x42b657,{options:_0x18063d,args:_0x41ec19,tdx:_0x4b4e1b}=_0xa83468,_0x5bc2c3={..._0x18063d,'limitStructuredFormats':!![]},_0xec7077=_0x41ec19[0x0],_0x16438c=_0x18063d['file'];let _0x1bd3e0;try{if(_0x16438c)_0x1bd3e0=readSqlStatementsFromFile(_0x16438c);else{if(_0xec7077==='-')_0x1bd3e0=await readSqlStatementsFromStdin();else{if(_0xec7077&&isSqlFilePath(_0xec7077))_0x1bd3e0=readSqlStatementsFromFile(_0xec7077);else{if(_0xec7077)_0x1bd3e0=splitSqlStatements(_0xec7077);else throw new Error(_0x5d6caa(0x16d));}}}}catch(_0x58eabc){return console['error'](_0x5d6caa(0x149)+_0x58eabc[_0x5d6caa(0x165)]),0x1;}const _0x216378=_0x18063d[_0x5d6caa(0x171)]||_0x5d6caa(0x16b),_0x346718=_0x18063d[_0x5d6caa(0x15e)];try{const _0x43b34c=[],_0xe7e630=!!_0x18063d['output'];for(let _0x8384ad=0x0;_0x8384ad<_0x1bd3e0[_0x5d6caa(0x163)];_0x8384ad++){const _0x3316cb=_0x1bd3e0[_0x8384ad],_0x4202e0=_0x8384ad+0x1,_0x45a450=_0x1bd3e0['length'],_0x58428a=_0x45a450>0x1;_0x18063d[_0x5d6caa(0x16e)]&&(console[_0x5d6caa(0x14e)]('\x0a'+(_0x58428a?_0x5d6caa(0x168)+_0x4202e0+'/'+_0x45a450+':':'')),console[_0x5d6caa(0x14e)]('Site:\x20'+_0x18063d[_0x5d6caa(0x14d)]),console[_0x5d6caa(0x14e)]('Catalog:\x20'+(_0x346718||'td')),console[_0x5d6caa(0x14e)]('Schema:\x20'+_0x216378),console[_0x5d6caa(0x14e)](_0x5d6caa(0x159)+_0x3316cb));const _0x2d5a38=_0x58428a?_0x5d6caa(0x152)+_0x4202e0+'/'+_0x45a450+_0x5d6caa(0x14b):_0x5d6caa(0x16a);try{const _0x2eabf1=await withProgressSpinner(_0x2d5a38,async _0x1a7e74=>{const _0x520fad=await _0x4b4e1b['query']['execute'](_0x3316cb,{'catalog':_0x346718,'schema':_0x216378,'onJobId':_0x56b07c=>{_0x1a7e74['setJobId'](_0x56b07c);},'onProgress':_0x3c3129=>{const _0x5a7fd4=a35_0x1d99;_0x1a7e74[_0x5a7fd4(0x155)](_0x5a7fd4(0x157)+_0x3c3129['state']+']'),_0x1a7e74[_0x5a7fd4(0x169)](formatRows(_0x3c3129[_0x5a7fd4(0x153)])+_0x5a7fd4(0x148)+_0x3c3129[_0x5a7fd4(0x154)]+'/'+_0x3c3129[_0x5a7fd4(0x158)]+_0x5a7fd4(0x15d));}});return _0x520fad;},{'verbose':_0x18063d[_0x5d6caa(0x16e)]}),_0x4e162a=_0x2eabf1[_0x5d6caa(0x16c)],_0x267be1=_0x4e162a[_0x5d6caa(0x161)]?_0x5d6caa(0x174)+_0x4e162a['jobId']+']':'',_0x5206e6=_0x58428a?_0x5d6caa(0x168)+_0x4202e0+'/'+_0x45a450+_0x5d6caa(0x151):'';console['error']('✔\x20'+_0x5206e6+_0x5d6caa(0x167)+formatRows(_0x4e162a[_0x5d6caa(0x15c)][_0x5d6caa(0x153)])+_0x5d6caa(0x148)+(_0x5d6caa(0x162)+formatElapsed(_0x4e162a[_0x5d6caa(0x15c)][_0x5d6caa(0x173)])+_0x267be1));if(_0x58428a&&_0xe7e630){const _0x5f2998=resolveOutputOptions(_0x5bc2c3),_0x3f14b8=await formatQueryOutput(_0x4e162a,_0x5f2998);_0x43b34c['push'](_0x3f14b8);}else await handleQueryOutput(_0x4e162a,_0x5bc2c3);}catch(_0x2fcfae){const _0x3d3260=_0x58428a?'Statement\x20'+_0x4202e0+'/'+_0x45a450+':\x0a':'',_0x216704=_0x2fcfae instanceof SDKError?_0x2fcfae[_0x5d6caa(0x170)]:_0x2fcfae[_0x5d6caa(0x165)];return console[_0x5d6caa(0x14e)](''+_0x3d3260+_0x216704),0x1;}}if(_0x1bd3e0[_0x5d6caa(0x163)]>0x1&&_0xe7e630&&_0x43b34c['length']>0x0){const _0x302dd3=_0x43b34c[_0x5d6caa(0x14f)]('\x0a');writeFileSync(_0x18063d[_0x5d6caa(0x146)],_0x302dd3),console[_0x5d6caa(0x14e)](_0x5d6caa(0x14c)+_0x18063d[_0x5d6caa(0x146)]);}return 0x0;}catch(_0x47bb3f){throw _0x47bb3f;}}['validate'](_0x899ac1){const _0x3fd13b=a35_0x42b657,_0x5bcacc=_0x899ac1[_0x3fd13b(0x15b)][0x0],_0x117cbe=_0x899ac1[_0x3fd13b(0x14a)][_0x3fd13b(0x176)];if(!_0x5bcacc&&!_0x117cbe)return'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';if(_0x5bcacc&&_0x117cbe)return _0x3fd13b(0x156);return undefined;}}
@@ -1 +1 @@
1
- const a36_0x41b656=a36_0x1545;(function(_0x1488ae,_0x278613){const _0x4b1cda=a36_0x1545,_0x10ac2b=_0x1488ae();while(!![]){try{const _0x40b065=-parseInt(_0x4b1cda(0x184))/0x1*(parseInt(_0x4b1cda(0x139))/0x2)+parseInt(_0x4b1cda(0x14e))/0x3*(parseInt(_0x4b1cda(0x183))/0x4)+-parseInt(_0x4b1cda(0x186))/0x5*(parseInt(_0x4b1cda(0x199))/0x6)+parseInt(_0x4b1cda(0x1ad))/0x7+parseInt(_0x4b1cda(0x1a8))/0x8+-parseInt(_0x4b1cda(0x138))/0x9+-parseInt(_0x4b1cda(0x1aa))/0xa*(-parseInt(_0x4b1cda(0x15e))/0xb);if(_0x40b065===_0x278613)break;else _0x10ac2b['push'](_0x10ac2b['shift']());}catch(_0x28d7c5){_0x10ac2b['push'](_0x10ac2b['shift']());}}}(a36_0x7574,0x7ffe6));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,handleSingleObjectOutput,writeOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import{confirm}from'../utils/prompt.js';import{readFileSync}from'fs';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import{getConsoleUrl}from'../sdk/client/endpoints.js';import{hyperlink}from'../sdk/util/formatters.js';function a36_0x7574(){const _0x8771b4=['Show\x20schedule\x20execution\x20history','Deleting\x20schedule...','nextRun','schedule:create','utf-8','log','Run\x20a\x20scheduled\x20query\x20immediately','data','getTime','Found\x20','4798424vjIVTM','\x20\x20→\x20','3373380yxBBQy','num','schedule:history','3094385tznNim','history','Query\x20file\x20is\x20empty','\x20\x20Time:\x20','options','(unnamed)','delete','repeat','time_zone','max','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20run\x20<name>\x20[--time\x20<iso8601>]\x20[--num\x20<1-10>]','job_id','map','listQueries','\x20\x20Job\x20ID:\x20','just\x20now','Creating\x20schedule...','Getting\x20schedule\x20details...','table','delay','join','Searching\x20scheduled\x20queries\x20matching\x20\x22','updated_at','8344683YJQuHF','25318JKpAIF','query','No\x20scheduled\x20queries\x20found','Getting\x20schedule\x20history...','timezone','📅\x20','toLocaleDateString','\x20\x20Database:\x20','execute','next_run_at','file','\x20\x20Timezone:\x20','validate','...','priority','\x20(showing\x20','never','cron','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20delete\x20<name>','create','error','3eQvijg','created_at','Updating\x20schedule...','length','schedule:list','Schedule\x20deleted:\x20','type','engine_version','limit','dim','user','Show\x20schedule\x20details','site','yes','\x20scheduled\x20quer','INVALID_ARGUMENT','33YTkBWB','At\x20least\x20one\x20option\x20must\x20be\x20provided\x20to\x20update','round','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20update\x20<name>\x20[options]','engineVersion','\x20matching\x20\x22','result','in\x20','lastRun','last_job','Schedule\x20run\x20submitted:\x20','format','jsonl','Failed\x20to\x20read\x20file:\x20','args','name','\x20created','\x22...','show','keys','Updating\x20schedule:\x20','Showing\x20first\x20','database','Cancelled','status','success','description','\x20\x20Cron:\x20','trim','Delete\x20a\x20scheduled\x20query','substring','from','start_at','jobs','Listing\x20scheduled\x20queries...','Database\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]','queries','1880612xPVfoZ','34ZzzXSs','padEnd','3210850XQVfAW','red','pagination','\x20job','List\x20scheduled\x20queries','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20history\x20<name>\x20[--from\x20<n>]\x20[--to\x20<n>]','retry_limit','retryLimit','\x20\x20Type:\x20','\x20\x20Num:\x20','schedules','verbose','ies','entries','end_at','user_name','schedule:delete','green','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]','6EtITIi','tsv','statusIcon','ended_at','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20show\x20<name>'];a36_0x7574=function(){return _0x8771b4;};return a36_0x7574();}import a36_0x26b0ae from'chalk';function formatRelativeTime(_0x2d52c3){const _0x46956b=a36_0x1545,_0x54d4c5=new Date(_0x2d52c3),_0x7ab713=new Date(),_0xf7ab9b=_0x54d4c5[_0x46956b(0x1a6)]()-_0x7ab713[_0x46956b(0x1a6)](),_0x56f16a=Math['abs'](_0xf7ab9b)/0x3e8,_0x2f2419=_0xf7ab9b<0x0;if(_0x56f16a<0x3c)return _0x2f2419?_0x46956b(0x1bc):'soon';else{if(_0x56f16a<0xe10){const _0x44c78b=Math[_0x46956b(0x160)](_0x56f16a/0x3c);return _0x2f2419?_0x44c78b+'m\x20ago':_0x46956b(0x165)+_0x44c78b+'m';}else{if(_0x56f16a<0x15180){const _0x42975f=Math[_0x46956b(0x160)](_0x56f16a/0xe10);return _0x2f2419?_0x42975f+'h\x20ago':_0x46956b(0x165)+_0x42975f+'h';}else{if(_0x56f16a<0x93a80){const _0x1cce51=Math[_0x46956b(0x160)](_0x56f16a/0x15180);return _0x2f2419?_0x1cce51+'d\x20ago':_0x46956b(0x165)+_0x1cce51+'d';}else return _0x54d4c5[_0x46956b(0x13f)]();}}}}export class ScheduleListCommand extends BaseCommand{['name']=a36_0x41b656(0x152);[a36_0x41b656(0x178)]=a36_0x41b656(0x18a);async['execute'](_0x293c9d){const _0x172dad=a36_0x41b656,{options:_0x23d179,args:_0x306511,tdx:_0x14d1fd}=_0x293c9d,_0x26fbf9=resolveLimit(_0x23d179[_0x172dad(0x156)],DEFAULT_DISPLAY_LIMIT),_0x564ce6=_0x306511[0x0],_0x4d1c24=_0x564ce6?_0x172dad(0x136)+_0x564ce6+_0x172dad(0x16f):_0x172dad(0x180),_0xf4d08a=await withSpinner(_0x4d1c24,()=>_0x14d1fd[_0x172dad(0x190)][_0x172dad(0x1ba)]({'limit':_0x26fbf9,'scheduled':!![],'pattern':_0x564ce6}),{'verbose':_0x23d179[_0x172dad(0x191)]}),_0x490b26=_0xf4d08a[_0x172dad(0x1a5)][_0x172dad(0x182)],_0x35b92b=_0xf4d08a[_0x172dad(0x1a5)][_0x172dad(0x188)]['has_next_page'],_0x2acc7b=_0x564ce6?_0x172dad(0x163)+_0x564ce6+'\x22':'';_0x35b92b?console[_0x172dad(0x14d)](_0x172dad(0x173)+_0x490b26[_0x172dad(0x151)]+'\x20schedules'+_0x2acc7b+'\x20(use\x20--limit\x20to\x20see\x20more)'):console[_0x172dad(0x14d)](_0x172dad(0x1a7)+_0x490b26[_0x172dad(0x151)]+_0x172dad(0x15c)+(_0x490b26[_0x172dad(0x151)]!==0x1?_0x172dad(0x192):'y')+_0x2acc7b);if(_0x23d179['format']==='json'||_0x23d179[_0x172dad(0x169)]===_0x172dad(0x16a)||_0x23d179[_0x172dad(0x169)]===_0x172dad(0x133)||_0x23d179[_0x172dad(0x169)]===_0x172dad(0x19a)){const _0x19495f=_0x490b26[_0x172dad(0x1b9)](_0x5eb707=>({'id':_0x5eb707['id'],'name':_0x5eb707[_0x172dad(0x16d)],'cron':_0x5eb707[_0x172dad(0x14a)],'database':_0x5eb707[_0x172dad(0x174)]?.['name'],'type':_0x5eb707['type'],'timezone':_0x5eb707[_0x172dad(0x1b5)],'user_name':_0x5eb707[_0x172dad(0x158)]?.['name'],'updated_at':_0x5eb707[_0x172dad(0x137)],'next_run_at':_0x5eb707[_0x172dad(0x142)],'last_job_status':_0x5eb707[_0x172dad(0x167)]?.[_0x172dad(0x176)]}));await handleSDKOutput(_0x19495f,_0x23d179);}else{if(_0x490b26[_0x172dad(0x151)]===0x0)console[_0x172dad(0x1a3)](_0x172dad(0x13b));else{const _0x5265e1=_0x23d179[_0x172dad(0x15a)],_0x16c9e5=_0x490b26[_0x172dad(0x1b9)](_0x207439=>{const _0x1dec2e=_0x172dad,_0x5cfa92=_0x207439[_0x1dec2e(0x167)]?.[_0x1dec2e(0x176)]?_0x207439['last_job'][_0x1dec2e(0x176)]===_0x1dec2e(0x177)?'✓':'✗':'-',_0x174a33=_0x207439[_0x1dec2e(0x167)]?.[_0x1dec2e(0x19c)]?formatRelativeTime(_0x207439[_0x1dec2e(0x167)]['ended_at']):_0x1dec2e(0x149),_0x308345=_0x207439[_0x1dec2e(0x142)]?formatRelativeTime(_0x207439[_0x1dec2e(0x142)]):'-',_0x222cdc=_0x207439[_0x1dec2e(0x14a)]||'',_0x2ffd01=_0x207439[_0x1dec2e(0x16d)]||_0x1dec2e(0x1b2),_0x3bb420=getConsoleUrl(_0x5265e1,'/app/queries/editor?queryId='+_0x207439['id']);return{'statusIcon':_0x5cfa92,'lastRun':_0x174a33,'nextRun':_0x308345,'cron':_0x222cdc,'name':_0x2ffd01,'queryUrl':_0x3bb420,'status':_0x207439[_0x1dec2e(0x167)]?.[_0x1dec2e(0x176)]};}),_0x32c5da=Math['max'](..._0x16c9e5[_0x172dad(0x1b9)](_0x118207=>_0x118207[_0x172dad(0x166)][_0x172dad(0x151)])),_0x12d31c=Math[_0x172dad(0x1b6)](..._0x16c9e5[_0x172dad(0x1b9)](_0x42118f=>_0x42118f[_0x172dad(0x1a0)]['length'])),_0x5e2c6f=Math['max'](..._0x16c9e5['map'](_0x1c8931=>_0x1c8931[_0x172dad(0x14a)][_0x172dad(0x151)])),_0x13a65f=_0x16c9e5[_0x172dad(0x1b9)](_0x2d49b6=>{const _0x29ec53=_0x172dad,_0x13cce4=_0x2d49b6[_0x29ec53(0x176)]===_0x29ec53(0x177)?a36_0x26b0ae[_0x29ec53(0x197)](_0x2d49b6[_0x29ec53(0x19b)]):_0x2d49b6[_0x29ec53(0x176)]===_0x29ec53(0x14d)?a36_0x26b0ae[_0x29ec53(0x187)](_0x2d49b6[_0x29ec53(0x19b)]):a36_0x26b0ae[_0x29ec53(0x157)](_0x2d49b6[_0x29ec53(0x19b)]),_0x183b6f=_0x2d49b6[_0x29ec53(0x166)][_0x29ec53(0x185)](_0x32c5da),_0x161a37=_0x2d49b6['nextRun'][_0x29ec53(0x185)](_0x12d31c),_0x515097=_0x2d49b6[_0x29ec53(0x14a)]?a36_0x26b0ae['cyan'](_0x2d49b6['cron'][_0x29ec53(0x185)](_0x5e2c6f)):'\x20'[_0x29ec53(0x1b4)](_0x5e2c6f),_0xfc1d63=hyperlink(_0x2d49b6[_0x29ec53(0x16d)],_0x2d49b6['queryUrl']);return _0x29ec53(0x13e)+_0x13cce4+'\x20'+_0x183b6f+_0x29ec53(0x1a9)+_0x161a37+'\x20\x20'+_0x515097+'\x20\x20'+_0xfc1d63;});await writeOutput(_0x13a65f[_0x172dad(0x135)]('\x0a'),_0x23d179['output'],'list');}}return 0x0;}}export class ScheduleShowCommand extends BaseCommand{[a36_0x41b656(0x16d)]='schedule:show';[a36_0x41b656(0x178)]=a36_0x41b656(0x159);[a36_0x41b656(0x145)](_0x195733){const _0x1b1d23=a36_0x41b656,_0x232f02=_0x195733['args'][0x0];if(!_0x232f02)return _0x1b1d23(0x19d);return undefined;}async[a36_0x41b656(0x141)](_0x24c5ae){const _0x2b8c5e=a36_0x41b656,{options:_0x207992,args:_0x548ca3,tdx:_0x2ba1ca}=_0x24c5ae,_0x44ef20=_0x548ca3[0x0],_0x4f20b0=await withSpinner(_0x2b8c5e(0x132),()=>_0x2ba1ca['schedules'][_0x2b8c5e(0x170)](_0x44ef20),{'verbose':_0x207992[_0x2b8c5e(0x191)]}),_0x1ed744=_0x4f20b0[_0x2b8c5e(0x1a5)],_0x739d5c={'name':_0x1ed744[_0x2b8c5e(0x16d)],'cron':_0x1ed744[_0x2b8c5e(0x14a)],'database':_0x1ed744[_0x2b8c5e(0x174)],'type':_0x1ed744[_0x2b8c5e(0x154)],'timezone':_0x1ed744[_0x2b8c5e(0x13d)],'user_name':_0x1ed744[_0x2b8c5e(0x195)],'created_at':_0x1ed744[_0x2b8c5e(0x14f)],'engine_version':_0x1ed744['engine_version'],'executing_user_id':_0x1ed744['executing_user_id'],'query':_0x1ed744['query'],'delay':_0x1ed744['delay'],'priority':_0x1ed744['priority'],'retry_limit':_0x1ed744['retry_limit'],..._0x1ed744['result']&&{'result':_0x1ed744[_0x2b8c5e(0x164)]}};return await handleSingleObjectOutput(_0x739d5c,_0x207992),0x0;}}export class ScheduleCreateCommand extends BaseCommand{[a36_0x41b656(0x16d)]=a36_0x41b656(0x1a1);['description']='Create\x20a\x20scheduled\x20query';[a36_0x41b656(0x145)](_0x987f7f){const _0x170e1a=a36_0x41b656,_0x27d707=_0x987f7f[_0x170e1a(0x16c)][0x0];if(!_0x27d707)return _0x170e1a(0x198);const _0x4a7387=_0x987f7f[_0x170e1a(0x1b1)];if(!_0x4a7387[_0x170e1a(0x174)])return _0x170e1a(0x181);return undefined;}async[a36_0x41b656(0x141)](_0x57916e){const _0x43b3e6=a36_0x41b656,{options:_0x73751e,args:_0x93992d,tdx:_0xbbba9e}=_0x57916e,_0x46ec02=_0x93992d[0x0],_0x57f5fb=_0x73751e,_0xb8bb3a=_0x57f5fb[_0x43b3e6(0x174)],_0x5c0ddb=_0x57f5fb['file'],_0x5e8fb1=_0x57f5fb[_0x43b3e6(0x154)]||'trino';let _0x103673;try{_0x103673=readFileSync(_0x5c0ddb,'utf-8')[_0x43b3e6(0x17a)]();}catch(_0x1f08c4){throw new SDKError(ErrorCode[_0x43b3e6(0x15d)],_0x43b3e6(0x16b)+_0x5c0ddb,_0x1f08c4 instanceof Error?_0x1f08c4:undefined);}if(!_0x103673)throw new SDKError(ErrorCode[_0x43b3e6(0x15d)],_0x43b3e6(0x1af));const _0x9d0e63={'database':_0xb8bb3a,'query':_0x103673,'type':_0x5e8fb1};if(_0x57f5fb[_0x43b3e6(0x14a)])_0x9d0e63[_0x43b3e6(0x14a)]=_0x57f5fb[_0x43b3e6(0x14a)];if(_0x57f5fb[_0x43b3e6(0x13d)])_0x9d0e63[_0x43b3e6(0x13d)]=_0x57f5fb[_0x43b3e6(0x13d)];if(_0x57f5fb[_0x43b3e6(0x134)]!==undefined)_0x9d0e63[_0x43b3e6(0x134)]=Number(_0x57f5fb[_0x43b3e6(0x134)]);if(_0x57f5fb[_0x43b3e6(0x147)]!==undefined)_0x9d0e63[_0x43b3e6(0x147)]=Number(_0x57f5fb['priority']);if(_0x57f5fb[_0x43b3e6(0x18d)]!==undefined)_0x9d0e63[_0x43b3e6(0x18c)]=Number(_0x57f5fb[_0x43b3e6(0x18d)]);if(_0x57f5fb[_0x43b3e6(0x162)])_0x9d0e63['engine_version']=_0x57f5fb[_0x43b3e6(0x162)];if(_0x57f5fb['result'])_0x9d0e63[_0x43b3e6(0x164)]=_0x57f5fb[_0x43b3e6(0x164)];if(_0x73751e[_0x43b3e6(0x191)]){console[_0x43b3e6(0x14d)]('Creating\x20schedule:\x20'+_0x46ec02),console['error'](_0x43b3e6(0x140)+_0xb8bb3a),console[_0x43b3e6(0x14d)](_0x43b3e6(0x18e)+_0x5e8fb1);if(_0x9d0e63['cron'])console[_0x43b3e6(0x14d)](_0x43b3e6(0x179)+_0x9d0e63[_0x43b3e6(0x14a)]);if(_0x9d0e63[_0x43b3e6(0x13d)])console[_0x43b3e6(0x14d)](_0x43b3e6(0x144)+_0x9d0e63[_0x43b3e6(0x13d)]);}const _0x407957=await withSpinner(_0x43b3e6(0x131),()=>_0xbbba9e[_0x43b3e6(0x190)][_0x43b3e6(0x14c)](_0x46ec02,_0x9d0e63),{'verbose':_0x73751e['verbose']});return console[_0x43b3e6(0x14d)]('Schedule\x20created:\x20'+_0x407957[_0x43b3e6(0x1a5)][_0x43b3e6(0x16d)]),await handleSingleObjectOutput(_0x407957[_0x43b3e6(0x1a5)],_0x73751e),0x0;}}function a36_0x1545(_0x97b0c0,_0x55f44f){_0x97b0c0=_0x97b0c0-0x131;const _0x75744=a36_0x7574();let _0x1545c3=_0x75744[_0x97b0c0];return _0x1545c3;}export class ScheduleUpdateCommand extends BaseCommand{['name']='schedule:update';[a36_0x41b656(0x178)]='Update\x20a\x20scheduled\x20query';[a36_0x41b656(0x145)](_0x5d9461){const _0x3c7bb4=a36_0x41b656,_0x30e58e=_0x5d9461['args'][0x0];if(!_0x30e58e)return _0x3c7bb4(0x161);return undefined;}async[a36_0x41b656(0x141)](_0x593832){const _0x2544aa=a36_0x41b656,{options:_0x11c6b4,args:_0x4a58a4,tdx:_0x2be70e}=_0x593832,_0x46d600=_0x4a58a4[0x0],_0x5db37a=_0x11c6b4,_0x361598={};if(_0x5db37a['database'])_0x361598[_0x2544aa(0x174)]=_0x5db37a[_0x2544aa(0x174)];if(_0x5db37a[_0x2544aa(0x154)])_0x361598[_0x2544aa(0x154)]=_0x5db37a[_0x2544aa(0x154)];if(_0x5db37a[_0x2544aa(0x14a)])_0x361598['cron']=_0x5db37a[_0x2544aa(0x14a)];if(_0x5db37a[_0x2544aa(0x13d)])_0x361598[_0x2544aa(0x13d)]=_0x5db37a[_0x2544aa(0x13d)];if(_0x5db37a[_0x2544aa(0x134)]!==undefined)_0x361598[_0x2544aa(0x134)]=Number(_0x5db37a[_0x2544aa(0x134)]);if(_0x5db37a[_0x2544aa(0x147)]!==undefined)_0x361598[_0x2544aa(0x147)]=Number(_0x5db37a['priority']);if(_0x5db37a[_0x2544aa(0x18d)]!==undefined)_0x361598['retry_limit']=Number(_0x5db37a[_0x2544aa(0x18d)]);if(_0x5db37a[_0x2544aa(0x162)])_0x361598[_0x2544aa(0x155)]=_0x5db37a[_0x2544aa(0x162)];if(_0x5db37a[_0x2544aa(0x164)])_0x361598[_0x2544aa(0x164)]=_0x5db37a[_0x2544aa(0x164)];if(_0x5db37a['file'])try{_0x361598['query']=readFileSync(_0x5db37a[_0x2544aa(0x143)],_0x2544aa(0x1a2))[_0x2544aa(0x17a)]();}catch(_0x2c8a21){throw new SDKError(ErrorCode[_0x2544aa(0x15d)],_0x2544aa(0x16b)+_0x5db37a['file'],_0x2c8a21 instanceof Error?_0x2c8a21:undefined);}if(Object[_0x2544aa(0x171)](_0x361598)[_0x2544aa(0x151)]===0x0)throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x2544aa(0x15f));if(_0x11c6b4['verbose']){console['error'](_0x2544aa(0x172)+_0x46d600);for(const [_0x3a13c0,_0x2d9f6b]of Object[_0x2544aa(0x193)](_0x361598)){_0x3a13c0===_0x2544aa(0x13a)?console[_0x2544aa(0x14d)]('\x20\x20'+_0x3a13c0+':\x20'+_0x2d9f6b[_0x2544aa(0x17c)](0x0,0x32)+_0x2544aa(0x146)):console[_0x2544aa(0x14d)]('\x20\x20'+_0x3a13c0+':\x20'+_0x2d9f6b);}}const _0x102395=await withSpinner(_0x2544aa(0x150),()=>_0x2be70e[_0x2544aa(0x190)]['update'](_0x46d600,_0x361598),{'verbose':_0x11c6b4['verbose']});return console[_0x2544aa(0x14d)]('Schedule\x20updated:\x20'+_0x102395['data'][_0x2544aa(0x16d)]),await handleSingleObjectOutput(_0x102395[_0x2544aa(0x1a5)],_0x11c6b4),0x0;}}export class ScheduleDeleteCommand extends BaseCommand{[a36_0x41b656(0x16d)]=a36_0x41b656(0x196);[a36_0x41b656(0x178)]=a36_0x41b656(0x17b);[a36_0x41b656(0x145)](_0x415ea8){const _0x2126fe=a36_0x41b656,_0x4a2236=_0x415ea8['args'][0x0];if(!_0x4a2236)return _0x2126fe(0x14b);return undefined;}async[a36_0x41b656(0x141)](_0x242665){const _0x438f3c=a36_0x41b656,{options:_0x29ea56,args:_0x4bd852,tdx:_0x2ab924}=_0x242665,_0x256626=_0x4bd852[0x0];if(!_0x29ea56[_0x438f3c(0x15b)]){const _0x5ab92b=await confirm('Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20schedule\x20\x22'+_0x256626+'\x22?');if(!_0x5ab92b)return console['error'](_0x438f3c(0x175)),0x0;}const _0x46df7f=await withSpinner(_0x438f3c(0x19f),()=>_0x2ab924['schedules'][_0x438f3c(0x1b3)](_0x256626),{'verbose':_0x29ea56[_0x438f3c(0x191)]});return console[_0x438f3c(0x14d)](_0x438f3c(0x153)+_0x46df7f[_0x438f3c(0x1a5)][_0x438f3c(0x16d)]),0x0;}}export class ScheduleRunCommand extends BaseCommand{[a36_0x41b656(0x16d)]='schedule:run';['description']=a36_0x41b656(0x1a4);['validate'](_0x5f2f8a){const _0x1ca8cd=a36_0x41b656,_0x38f55e=_0x5f2f8a[_0x1ca8cd(0x16c)][0x0];if(!_0x38f55e)return _0x1ca8cd(0x1b7);return undefined;}async[a36_0x41b656(0x141)](_0x4e0d88){const _0x16263c=a36_0x41b656,{options:_0x52058a,args:_0x5be9cb,tdx:_0x3c9745}=_0x4e0d88,_0x102b3a=_0x5be9cb[0x0],_0x9fa477=_0x52058a,_0x55527c=_0x9fa477['time'],_0x3771bf=_0x9fa477['num']!==undefined?Number(_0x9fa477[_0x16263c(0x1ab)]):undefined;if(_0x52058a[_0x16263c(0x191)]){console['error']('Running\x20schedule:\x20'+_0x102b3a);if(_0x55527c)console[_0x16263c(0x14d)](_0x16263c(0x1b0)+_0x55527c);if(_0x3771bf)console[_0x16263c(0x14d)](_0x16263c(0x18f)+_0x3771bf);}const _0x24f83f=await withSpinner('Running\x20schedule...',()=>_0x3c9745[_0x16263c(0x190)]['run'](_0x102b3a,{'time':_0x55527c,'num':_0x3771bf}),{'verbose':_0x52058a[_0x16263c(0x191)]}),_0x4d2af3=_0x24f83f[_0x16263c(0x1a5)][_0x16263c(0x17f)];console['error'](_0x16263c(0x168)+_0x4d2af3[_0x16263c(0x151)]+_0x16263c(0x189)+(_0x4d2af3['length']!==0x1?'s':'')+_0x16263c(0x16e));for(const _0x46a980 of _0x4d2af3){console[_0x16263c(0x14d)](_0x16263c(0x1bb)+_0x46a980[_0x16263c(0x1b8)]);}return await handleSDKOutput(_0x4d2af3,_0x52058a),0x0;}}export class ScheduleHistoryCommand extends BaseCommand{[a36_0x41b656(0x16d)]=a36_0x41b656(0x1ac);[a36_0x41b656(0x178)]=a36_0x41b656(0x19e);['validate'](_0x455990){const _0x5b006d=a36_0x41b656,_0x4eb335=_0x455990[_0x5b006d(0x16c)][0x0];if(!_0x4eb335)return _0x5b006d(0x18b);return undefined;}async[a36_0x41b656(0x141)](_0x2fcb8f){const _0x1b9f5b=a36_0x41b656,{options:_0x16d00a,args:_0x26068c,tdx:_0xf59ba}=_0x2fcb8f,_0x53ad59=_0x26068c[0x0],_0xf7b36e=_0x16d00a,_0x38d48e=_0xf7b36e[_0x1b9f5b(0x17d)]!==undefined?Number(_0xf7b36e[_0x1b9f5b(0x17d)]):undefined,_0x5e3ea4=_0xf7b36e['to']!==undefined?Number(_0xf7b36e['to']):undefined,_0x188f3f=await withSpinner(_0x1b9f5b(0x13c),()=>_0xf59ba['schedules'][_0x1b9f5b(0x1ae)](_0x53ad59,{'from':_0x38d48e,'to':_0x5e3ea4}),{'verbose':_0x16d00a[_0x1b9f5b(0x191)]}),_0x24bcfa=_0x188f3f[_0x1b9f5b(0x1a5)];console[_0x1b9f5b(0x14d)](_0x1b9f5b(0x1a7)+_0x24bcfa['count']+'\x20execution'+(_0x24bcfa['count']!==0x1?'s':'')+_0x1b9f5b(0x148)+_0x24bcfa[_0x1b9f5b(0x17d)]+'-'+_0x24bcfa['to']+')');const _0x42e03b=_0x24bcfa[_0x1b9f5b(0x1ae)][_0x1b9f5b(0x1b9)](_0x43f0c5=>({'job_id':_0x43f0c5[_0x1b9f5b(0x1b8)],'type':_0x43f0c5[_0x1b9f5b(0x154)],'status':_0x43f0c5[_0x1b9f5b(0x176)],'scheduled_at':_0x43f0c5['scheduled_at'],'created_at':_0x43f0c5[_0x1b9f5b(0x14f)],'start_at':_0x43f0c5[_0x1b9f5b(0x17e)],'end_at':_0x43f0c5[_0x1b9f5b(0x194)]}));return await handleSDKOutput(_0x42e03b,_0x16d00a),0x0;}}
1
+ const a36_0x2ce4c8=a36_0x1783;(function(_0x47faf5,_0x43d0f5){const _0x3c283d=a36_0x1783,_0x1f113f=_0x47faf5();while(!![]){try{const _0xde511f=-parseInt(_0x3c283d(0xb3))/0x1+parseInt(_0x3c283d(0x8b))/0x2+parseInt(_0x3c283d(0xa4))/0x3*(-parseInt(_0x3c283d(0xa1))/0x4)+-parseInt(_0x3c283d(0xb7))/0x5+-parseInt(_0x3c283d(0xdc))/0x6+parseInt(_0x3c283d(0x85))/0x7+parseInt(_0x3c283d(0xcc))/0x8;if(_0xde511f===_0x43d0f5)break;else _0x1f113f['push'](_0x1f113f['shift']());}catch(_0x468934){_0x1f113f['push'](_0x1f113f['shift']());}}}(a36_0x3819,0x25f18));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,handleSingleObjectOutput,writeOutput}from'../core/command-output.js';function a36_0x1783(_0x52aecb,_0x5f19bf){_0x52aecb=_0x52aecb-0x67;const _0x381989=a36_0x3819();let _0x17836b=_0x381989[_0x52aecb];return _0x17836b;}import{withSpinner}from'../utils/spinner.js';import{confirm}from'../utils/prompt.js';function a36_0x3819(){const _0x41c790=['Create\x20a\x20scheduled\x20query','abs','\x20\x20Job\x20ID:\x20','Updating\x20schedule...','d\x20ago','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20update\x20<name>\x20[options]','substring','padEnd','listQueries','created_at','engineVersion','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20history\x20<name>\x20[--from\x20<n>]\x20[--to\x20<n>]','retryLimit','📅\x20','\x20\x20→\x20','INVALID_ARGUMENT','round','scheduled_at','database','retry_limit','log','1952496GAzcWD','next_run_at','length','\x20\x20Type:\x20','h\x20ago','schedule:update','210014imOTUV','args','keys','schedule:show','end_at','max','success','\x20\x20Timezone:\x20','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20run\x20<name>\x20[--time\x20<iso8601>]\x20[--num\x20<1-10>]','Delete\x20a\x20scheduled\x20query','never','schedules','history','statusIcon','Getting\x20schedule\x20details...','validate','getTime','Show\x20schedule\x20execution\x20history','pagination','\x20\x20Num:\x20','name','red','1180USiYVe','num','priority','246KuxRaA','map','At\x20least\x20one\x20option\x20must\x20be\x20provided\x20to\x20update','file','jobs','List\x20scheduled\x20queries','user_name','soon','Schedule\x20created:\x20','Database\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]','/app/queries/editor?queryId=','query','Running\x20schedule...','data','last_job','147218KrciXE','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20schedule\x20\x22','update','Cancelled','979315wstVos','trim','Query\x20file\x20is\x20empty','green','status','json','\x20execution','entries','cron','options','limit','delay','time_zone','lastRun','execute','description','job_id','\x20\x20Cron:\x20','dim','output','has_next_page','3499888FkuOfx','trino','schedule:list','Getting\x20schedule\x20history...','engine_version','\x20\x20Database:\x20','Failed\x20to\x20read\x20file:\x20','from','\x20job','site','format','\x20matching\x20\x22','Run\x20a\x20scheduled\x20query\x20immediately','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20delete\x20<name>','in\x20','Creating\x20schedule:\x20','1792404lohnQM','Searching\x20scheduled\x20queries\x20matching\x20\x22','list','result','m\x20ago','Schedule\x20updated:\x20','error','ies','tsv','timezone','utf-8','type','verbose','schedule:create','Found\x20','Schedule\x20run\x20submitted:\x20','cyan','Creating\x20schedule...'];a36_0x3819=function(){return _0x41c790;};return a36_0x3819();}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_0x4c0f93 from'chalk';function formatRelativeTime(_0x13ebf0){const _0x35f7e4=a36_0x1783,_0x242b8f=new Date(_0x13ebf0),_0x4a8933=new Date(),_0x4b20c5=_0x242b8f[_0x35f7e4(0x9b)]()-_0x4a8933['getTime'](),_0x3f5bae=Math[_0x35f7e4(0x71)](_0x4b20c5)/0x3e8,_0x3d0e27=_0x4b20c5<0x0;if(_0x3f5bae<0x3c)return _0x3d0e27?'just\x20now':_0x35f7e4(0xab);else{if(_0x3f5bae<0xe10){const _0x308e23=Math[_0x35f7e4(0x80)](_0x3f5bae/0x3c);return _0x3d0e27?_0x308e23+_0x35f7e4(0xe0):'in\x20'+_0x308e23+'m';}else{if(_0x3f5bae<0x15180){const _0x3ca42f=Math[_0x35f7e4(0x80)](_0x3f5bae/0xe10);return _0x3d0e27?_0x3ca42f+_0x35f7e4(0x89):_0x35f7e4(0xda)+_0x3ca42f+'h';}else{if(_0x3f5bae<0x93a80){const _0x3b033e=Math[_0x35f7e4(0x80)](_0x3f5bae/0x15180);return _0x3d0e27?_0x3b033e+_0x35f7e4(0x74):_0x35f7e4(0xda)+_0x3b033e+'d';}else return _0x242b8f['toLocaleDateString']();}}}}export class ScheduleListCommand extends BaseCommand{['name']=a36_0x2ce4c8(0xce);['description']=a36_0x2ce4c8(0xa9);async[a36_0x2ce4c8(0xc5)](_0x7a7020){const _0x3ab38c=a36_0x2ce4c8,{options:_0x3b2c62,args:_0x1f7b14,tdx:_0x399fd9}=_0x7a7020,_0x4c3ae9=resolveLimit(_0x3b2c62[_0x3ab38c(0xc1)],DEFAULT_DISPLAY_LIMIT),_0x5f1b0b=_0x1f7b14[0x0],_0x185b97=_0x5f1b0b?_0x3ab38c(0xdd)+_0x5f1b0b+'\x22...':'Listing\x20scheduled\x20queries...',_0x48b6c5=await withSpinner(_0x185b97,()=>_0x399fd9[_0x3ab38c(0x96)][_0x3ab38c(0x78)]({'limit':_0x4c3ae9,'scheduled':!![],'pattern':_0x5f1b0b}),{'verbose':_0x3b2c62['verbose']}),_0x54096d=_0x48b6c5[_0x3ab38c(0xb1)]['queries'],_0x20b0bc=_0x48b6c5[_0x3ab38c(0xb1)][_0x3ab38c(0x9d)][_0x3ab38c(0xcb)],_0x535eb4=_0x5f1b0b?_0x3ab38c(0xd7)+_0x5f1b0b+'\x22':'';_0x20b0bc?console[_0x3ab38c(0xe2)]('Showing\x20first\x20'+_0x54096d[_0x3ab38c(0x87)]+'\x20schedules'+_0x535eb4+'\x20(use\x20--limit\x20to\x20see\x20more)'):console[_0x3ab38c(0xe2)](_0x3ab38c(0x6c)+_0x54096d[_0x3ab38c(0x87)]+'\x20scheduled\x20quer'+(_0x54096d[_0x3ab38c(0x87)]!==0x1?_0x3ab38c(0xe3):'y')+_0x535eb4);if(_0x3b2c62[_0x3ab38c(0xd6)]===_0x3ab38c(0xbc)||_0x3b2c62[_0x3ab38c(0xd6)]==='jsonl'||_0x3b2c62[_0x3ab38c(0xd6)]==='table'||_0x3b2c62[_0x3ab38c(0xd6)]===_0x3ab38c(0xe4)){const _0x4d2114=_0x54096d[_0x3ab38c(0xa5)](_0x4a9e9a=>({'id':_0x4a9e9a['id'],'name':_0x4a9e9a[_0x3ab38c(0x9f)],'cron':_0x4a9e9a[_0x3ab38c(0xbf)],'database':_0x4a9e9a[_0x3ab38c(0x82)]?.[_0x3ab38c(0x9f)],'type':_0x4a9e9a[_0x3ab38c(0x69)],'timezone':_0x4a9e9a[_0x3ab38c(0xc3)],'user_name':_0x4a9e9a['user']?.[_0x3ab38c(0x9f)],'updated_at':_0x4a9e9a['updated_at'],'next_run_at':_0x4a9e9a[_0x3ab38c(0x86)],'last_job_status':_0x4a9e9a[_0x3ab38c(0xb2)]?.[_0x3ab38c(0xbb)]}));await handleSDKOutput(_0x4d2114,_0x3b2c62);}else{if(_0x54096d[_0x3ab38c(0x87)]===0x0)console[_0x3ab38c(0x84)]('No\x20scheduled\x20queries\x20found');else{const _0x2f36c9=_0x3b2c62[_0x3ab38c(0xd5)],_0x30b491=_0x54096d[_0x3ab38c(0xa5)](_0x4ec66c=>{const _0xa627ff=_0x3ab38c,_0x58fcb1=_0x4ec66c[_0xa627ff(0xb2)]?.[_0xa627ff(0xbb)]?_0x4ec66c[_0xa627ff(0xb2)][_0xa627ff(0xbb)]===_0xa627ff(0x91)?'✓':'✗':'-',_0x44c369=_0x4ec66c['last_job']?.['ended_at']?formatRelativeTime(_0x4ec66c[_0xa627ff(0xb2)]['ended_at']):_0xa627ff(0x95),_0x261786=_0x4ec66c['next_run_at']?formatRelativeTime(_0x4ec66c[_0xa627ff(0x86)]):'-',_0x3a9c88=_0x4ec66c[_0xa627ff(0xbf)]||'',_0x14fa92=_0x4ec66c[_0xa627ff(0x9f)]||'(unnamed)',_0x2007b1=getConsoleUrl(_0x2f36c9,_0xa627ff(0xae)+_0x4ec66c['id']);return{'statusIcon':_0x58fcb1,'lastRun':_0x44c369,'nextRun':_0x261786,'cron':_0x3a9c88,'name':_0x14fa92,'queryUrl':_0x2007b1,'status':_0x4ec66c['last_job']?.['status']};}),_0x4de23b=Math['max'](..._0x30b491[_0x3ab38c(0xa5)](_0x18c398=>_0x18c398[_0x3ab38c(0xc4)][_0x3ab38c(0x87)])),_0x59a75e=Math[_0x3ab38c(0x90)](..._0x30b491['map'](_0x3072f0=>_0x3072f0['nextRun'][_0x3ab38c(0x87)])),_0x26e4a0=Math[_0x3ab38c(0x90)](..._0x30b491[_0x3ab38c(0xa5)](_0x31e759=>_0x31e759[_0x3ab38c(0xbf)][_0x3ab38c(0x87)])),_0x7617fd=_0x30b491['map'](_0x1bb14f=>{const _0x45d457=_0x3ab38c,_0x115bd6=_0x1bb14f[_0x45d457(0xbb)]==='success'?a36_0x4c0f93[_0x45d457(0xba)](_0x1bb14f[_0x45d457(0x98)]):_0x1bb14f['status']===_0x45d457(0xe2)?a36_0x4c0f93[_0x45d457(0xa0)](_0x1bb14f[_0x45d457(0x98)]):a36_0x4c0f93[_0x45d457(0xc9)](_0x1bb14f[_0x45d457(0x98)]),_0x5d6068=_0x1bb14f[_0x45d457(0xc4)][_0x45d457(0x77)](_0x4de23b),_0x3b0ff9=_0x1bb14f['nextRun']['padEnd'](_0x59a75e),_0x3e4bf4=_0x1bb14f[_0x45d457(0xbf)]?a36_0x4c0f93[_0x45d457(0x6e)](_0x1bb14f[_0x45d457(0xbf)]['padEnd'](_0x26e4a0)):'\x20'['repeat'](_0x26e4a0),_0x31bcdb=hyperlink(_0x1bb14f['name'],_0x1bb14f['queryUrl']);return _0x45d457(0x7d)+_0x115bd6+'\x20'+_0x5d6068+_0x45d457(0x7e)+_0x3b0ff9+'\x20\x20'+_0x3e4bf4+'\x20\x20'+_0x31bcdb;});await writeOutput(_0x7617fd['join']('\x0a'),_0x3b2c62[_0x3ab38c(0xca)],_0x3ab38c(0xde));}}return 0x0;}}export class ScheduleShowCommand extends BaseCommand{[a36_0x2ce4c8(0x9f)]=a36_0x2ce4c8(0x8e);[a36_0x2ce4c8(0xc6)]='Show\x20schedule\x20details';[a36_0x2ce4c8(0x9a)](_0x1c7f30){const _0x1c2968=a36_0x2ce4c8,_0xc6ab3c=_0x1c7f30[_0x1c2968(0x8c)][0x0];if(!_0xc6ab3c)return'Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20show\x20<name>';return undefined;}async[a36_0x2ce4c8(0xc5)](_0x30b8d0){const _0x310eaa=a36_0x2ce4c8,{options:_0x5c717c,args:_0x5526ed,tdx:_0x29879c}=_0x30b8d0,_0xf9fa32=_0x5526ed[0x0],_0x7ab636=await withSpinner(_0x310eaa(0x99),()=>_0x29879c['schedules']['show'](_0xf9fa32),{'verbose':_0x5c717c[_0x310eaa(0x6a)]}),_0x2f7b0c=_0x7ab636[_0x310eaa(0xb1)],_0xe49a10={'name':_0x2f7b0c[_0x310eaa(0x9f)],'cron':_0x2f7b0c['cron'],'database':_0x2f7b0c['database'],'type':_0x2f7b0c[_0x310eaa(0x69)],'timezone':_0x2f7b0c[_0x310eaa(0x67)],'user_name':_0x2f7b0c[_0x310eaa(0xaa)],'created_at':_0x2f7b0c[_0x310eaa(0x79)],'engine_version':_0x2f7b0c['engine_version'],'executing_user_id':_0x2f7b0c['executing_user_id'],'query':_0x2f7b0c[_0x310eaa(0xaf)],'delay':_0x2f7b0c[_0x310eaa(0xc2)],'priority':_0x2f7b0c[_0x310eaa(0xa3)],'retry_limit':_0x2f7b0c[_0x310eaa(0x83)],..._0x2f7b0c[_0x310eaa(0xdf)]&&{'result':_0x2f7b0c['result']}};return await handleSingleObjectOutput(_0xe49a10,_0x5c717c),0x0;}}export class ScheduleCreateCommand extends BaseCommand{[a36_0x2ce4c8(0x9f)]=a36_0x2ce4c8(0x6b);[a36_0x2ce4c8(0xc6)]=a36_0x2ce4c8(0x70);[a36_0x2ce4c8(0x9a)](_0x121d3e){const _0x4ac300=a36_0x2ce4c8,_0x56c280=_0x121d3e[_0x4ac300(0x8c)][0x0];if(!_0x56c280)return'Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]';const _0x41dea9=_0x121d3e[_0x4ac300(0xc0)];if(!_0x41dea9[_0x4ac300(0x82)])return _0x4ac300(0xad);return undefined;}async[a36_0x2ce4c8(0xc5)](_0xfc5f9f){const _0x391cd9=a36_0x2ce4c8,{options:_0x2bf06e,args:_0x40ac40,tdx:_0x20e9a6}=_0xfc5f9f,_0x3dc3df=_0x40ac40[0x0],_0x1a0d77=_0x2bf06e,_0x3f4ef6=_0x1a0d77[_0x391cd9(0x82)],_0x3b13db=_0x1a0d77[_0x391cd9(0xa7)],_0x243f2c=_0x1a0d77[_0x391cd9(0x69)]||_0x391cd9(0xcd);let _0x59def8;try{_0x59def8=readFileSync(_0x3b13db,_0x391cd9(0x68))[_0x391cd9(0xb8)]();}catch(_0x464460){throw new SDKError(ErrorCode[_0x391cd9(0x7f)],_0x391cd9(0xd2)+_0x3b13db,_0x464460 instanceof Error?_0x464460:undefined);}if(!_0x59def8)throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x391cd9(0xb9));const _0x3ad224={'database':_0x3f4ef6,'query':_0x59def8,'type':_0x243f2c};if(_0x1a0d77[_0x391cd9(0xbf)])_0x3ad224[_0x391cd9(0xbf)]=_0x1a0d77[_0x391cd9(0xbf)];if(_0x1a0d77[_0x391cd9(0x67)])_0x3ad224[_0x391cd9(0x67)]=_0x1a0d77[_0x391cd9(0x67)];if(_0x1a0d77[_0x391cd9(0xc2)]!==undefined)_0x3ad224[_0x391cd9(0xc2)]=Number(_0x1a0d77[_0x391cd9(0xc2)]);if(_0x1a0d77[_0x391cd9(0xa3)]!==undefined)_0x3ad224[_0x391cd9(0xa3)]=Number(_0x1a0d77[_0x391cd9(0xa3)]);if(_0x1a0d77[_0x391cd9(0x7c)]!==undefined)_0x3ad224['retry_limit']=Number(_0x1a0d77[_0x391cd9(0x7c)]);if(_0x1a0d77[_0x391cd9(0x7a)])_0x3ad224[_0x391cd9(0xd0)]=_0x1a0d77[_0x391cd9(0x7a)];if(_0x1a0d77[_0x391cd9(0xdf)])_0x3ad224[_0x391cd9(0xdf)]=_0x1a0d77['result'];if(_0x2bf06e[_0x391cd9(0x6a)]){console[_0x391cd9(0xe2)](_0x391cd9(0xdb)+_0x3dc3df),console[_0x391cd9(0xe2)](_0x391cd9(0xd1)+_0x3f4ef6),console[_0x391cd9(0xe2)](_0x391cd9(0x88)+_0x243f2c);if(_0x3ad224[_0x391cd9(0xbf)])console['error'](_0x391cd9(0xc8)+_0x3ad224[_0x391cd9(0xbf)]);if(_0x3ad224[_0x391cd9(0x67)])console[_0x391cd9(0xe2)](_0x391cd9(0x92)+_0x3ad224[_0x391cd9(0x67)]);}const _0x49e0eb=await withSpinner(_0x391cd9(0x6f),()=>_0x20e9a6[_0x391cd9(0x96)]['create'](_0x3dc3df,_0x3ad224),{'verbose':_0x2bf06e['verbose']});return console[_0x391cd9(0xe2)](_0x391cd9(0xac)+_0x49e0eb[_0x391cd9(0xb1)][_0x391cd9(0x9f)]),await handleSingleObjectOutput(_0x49e0eb[_0x391cd9(0xb1)],_0x2bf06e),0x0;}}export class ScheduleUpdateCommand extends BaseCommand{['name']=a36_0x2ce4c8(0x8a);[a36_0x2ce4c8(0xc6)]='Update\x20a\x20scheduled\x20query';[a36_0x2ce4c8(0x9a)](_0xb8234b){const _0x5c7d0f=a36_0x2ce4c8,_0x58374f=_0xb8234b[_0x5c7d0f(0x8c)][0x0];if(!_0x58374f)return _0x5c7d0f(0x75);return undefined;}async[a36_0x2ce4c8(0xc5)](_0x14faed){const _0x47af3f=a36_0x2ce4c8,{options:_0x44953a,args:_0x36b40b,tdx:_0x31adb9}=_0x14faed,_0x1b0d39=_0x36b40b[0x0],_0x5bc623=_0x44953a,_0x5b52be={};if(_0x5bc623[_0x47af3f(0x82)])_0x5b52be[_0x47af3f(0x82)]=_0x5bc623[_0x47af3f(0x82)];if(_0x5bc623[_0x47af3f(0x69)])_0x5b52be['type']=_0x5bc623['type'];if(_0x5bc623[_0x47af3f(0xbf)])_0x5b52be[_0x47af3f(0xbf)]=_0x5bc623['cron'];if(_0x5bc623[_0x47af3f(0x67)])_0x5b52be[_0x47af3f(0x67)]=_0x5bc623[_0x47af3f(0x67)];if(_0x5bc623['delay']!==undefined)_0x5b52be[_0x47af3f(0xc2)]=Number(_0x5bc623[_0x47af3f(0xc2)]);if(_0x5bc623[_0x47af3f(0xa3)]!==undefined)_0x5b52be[_0x47af3f(0xa3)]=Number(_0x5bc623[_0x47af3f(0xa3)]);if(_0x5bc623['retryLimit']!==undefined)_0x5b52be['retry_limit']=Number(_0x5bc623[_0x47af3f(0x7c)]);if(_0x5bc623['engineVersion'])_0x5b52be[_0x47af3f(0xd0)]=_0x5bc623['engineVersion'];if(_0x5bc623[_0x47af3f(0xdf)])_0x5b52be[_0x47af3f(0xdf)]=_0x5bc623[_0x47af3f(0xdf)];if(_0x5bc623[_0x47af3f(0xa7)])try{_0x5b52be['query']=readFileSync(_0x5bc623[_0x47af3f(0xa7)],_0x47af3f(0x68))[_0x47af3f(0xb8)]();}catch(_0x3e5baa){throw new SDKError(ErrorCode[_0x47af3f(0x7f)],'Failed\x20to\x20read\x20file:\x20'+_0x5bc623['file'],_0x3e5baa instanceof Error?_0x3e5baa:undefined);}if(Object[_0x47af3f(0x8d)](_0x5b52be)[_0x47af3f(0x87)]===0x0)throw new SDKError(ErrorCode[_0x47af3f(0x7f)],_0x47af3f(0xa6));if(_0x44953a[_0x47af3f(0x6a)]){console[_0x47af3f(0xe2)]('Updating\x20schedule:\x20'+_0x1b0d39);for(const [_0x2cf429,_0x35f125]of Object[_0x47af3f(0xbe)](_0x5b52be)){_0x2cf429==='query'?console[_0x47af3f(0xe2)]('\x20\x20'+_0x2cf429+':\x20'+_0x35f125[_0x47af3f(0x76)](0x0,0x32)+'...'):console[_0x47af3f(0xe2)]('\x20\x20'+_0x2cf429+':\x20'+_0x35f125);}}const _0x26c1fa=await withSpinner(_0x47af3f(0x73),()=>_0x31adb9[_0x47af3f(0x96)][_0x47af3f(0xb5)](_0x1b0d39,_0x5b52be),{'verbose':_0x44953a[_0x47af3f(0x6a)]});return console[_0x47af3f(0xe2)](_0x47af3f(0xe1)+_0x26c1fa[_0x47af3f(0xb1)]['name']),await handleSingleObjectOutput(_0x26c1fa[_0x47af3f(0xb1)],_0x44953a),0x0;}}export class ScheduleDeleteCommand extends BaseCommand{[a36_0x2ce4c8(0x9f)]='schedule:delete';['description']=a36_0x2ce4c8(0x94);[a36_0x2ce4c8(0x9a)](_0x5c4763){const _0x4fc52f=a36_0x2ce4c8,_0x71f601=_0x5c4763[_0x4fc52f(0x8c)][0x0];if(!_0x71f601)return _0x4fc52f(0xd9);return undefined;}async[a36_0x2ce4c8(0xc5)](_0x3e0b97){const _0x4ee0e2=a36_0x2ce4c8,{options:_0xcabbc7,args:_0x3d4beb,tdx:_0x5dae32}=_0x3e0b97,_0x2c5baa=_0x3d4beb[0x0];if(!_0xcabbc7['yes']){const _0x34916f=await confirm(_0x4ee0e2(0xb4)+_0x2c5baa+'\x22?');if(!_0x34916f)return console['error'](_0x4ee0e2(0xb6)),0x0;}const _0x44be08=await withSpinner('Deleting\x20schedule...',()=>_0x5dae32['schedules']['delete'](_0x2c5baa),{'verbose':_0xcabbc7[_0x4ee0e2(0x6a)]});return console['error']('Schedule\x20deleted:\x20'+_0x44be08[_0x4ee0e2(0xb1)]['name']),0x0;}}export class ScheduleRunCommand extends BaseCommand{[a36_0x2ce4c8(0x9f)]='schedule:run';['description']=a36_0x2ce4c8(0xd8);[a36_0x2ce4c8(0x9a)](_0xd0b753){const _0x35fac7=a36_0x2ce4c8,_0xac1283=_0xd0b753[_0x35fac7(0x8c)][0x0];if(!_0xac1283)return _0x35fac7(0x93);return undefined;}async[a36_0x2ce4c8(0xc5)](_0x88a0aa){const _0x53ed97=a36_0x2ce4c8,{options:_0x9725b3,args:_0x1f07ec,tdx:_0x227eb4}=_0x88a0aa,_0x376de7=_0x1f07ec[0x0],_0x5f5726=_0x9725b3,_0x466347=_0x5f5726['time'],_0x4e2b7b=_0x5f5726['num']!==undefined?Number(_0x5f5726[_0x53ed97(0xa2)]):undefined;if(_0x9725b3[_0x53ed97(0x6a)]){console[_0x53ed97(0xe2)]('Running\x20schedule:\x20'+_0x376de7);if(_0x466347)console[_0x53ed97(0xe2)]('\x20\x20Time:\x20'+_0x466347);if(_0x4e2b7b)console[_0x53ed97(0xe2)](_0x53ed97(0x9e)+_0x4e2b7b);}const _0x18fe3b=await withSpinner(_0x53ed97(0xb0),()=>_0x227eb4[_0x53ed97(0x96)]['run'](_0x376de7,{'time':_0x466347,'num':_0x4e2b7b}),{'verbose':_0x9725b3[_0x53ed97(0x6a)]}),_0x1e61c0=_0x18fe3b[_0x53ed97(0xb1)][_0x53ed97(0xa8)];console[_0x53ed97(0xe2)](_0x53ed97(0x6d)+_0x1e61c0[_0x53ed97(0x87)]+_0x53ed97(0xd4)+(_0x1e61c0[_0x53ed97(0x87)]!==0x1?'s':'')+'\x20created');for(const _0x48654a of _0x1e61c0){console[_0x53ed97(0xe2)](_0x53ed97(0x72)+_0x48654a[_0x53ed97(0xc7)]);}return await handleSDKOutput(_0x1e61c0,_0x9725b3),0x0;}}export class ScheduleHistoryCommand extends BaseCommand{[a36_0x2ce4c8(0x9f)]='schedule:history';[a36_0x2ce4c8(0xc6)]=a36_0x2ce4c8(0x9c);['validate'](_0x1c57ca){const _0x1da01f=a36_0x2ce4c8,_0x4a5358=_0x1c57ca[_0x1da01f(0x8c)][0x0];if(!_0x4a5358)return _0x1da01f(0x7b);return undefined;}async[a36_0x2ce4c8(0xc5)](_0x1e329d){const _0x2718c5=a36_0x2ce4c8,{options:_0x3d4e1f,args:_0x5c9dce,tdx:_0x3fff23}=_0x1e329d,_0x2534a5=_0x5c9dce[0x0],_0x117ba6=_0x3d4e1f,_0x42486b=_0x117ba6[_0x2718c5(0xd3)]!==undefined?Number(_0x117ba6['from']):undefined,_0x269724=_0x117ba6['to']!==undefined?Number(_0x117ba6['to']):undefined,_0x171fef=await withSpinner(_0x2718c5(0xcf),()=>_0x3fff23[_0x2718c5(0x96)]['history'](_0x2534a5,{'from':_0x42486b,'to':_0x269724}),{'verbose':_0x3d4e1f['verbose']}),_0x890a57=_0x171fef[_0x2718c5(0xb1)];console[_0x2718c5(0xe2)](_0x2718c5(0x6c)+_0x890a57['count']+_0x2718c5(0xbd)+(_0x890a57['count']!==0x1?'s':'')+'\x20(showing\x20'+_0x890a57[_0x2718c5(0xd3)]+'-'+_0x890a57['to']+')');const _0x5d1fce=_0x890a57[_0x2718c5(0x97)][_0x2718c5(0xa5)](_0xc4c4ee=>({'job_id':_0xc4c4ee[_0x2718c5(0xc7)],'type':_0xc4c4ee['type'],'status':_0xc4c4ee[_0x2718c5(0xbb)],'scheduled_at':_0xc4c4ee[_0x2718c5(0x81)],'created_at':_0xc4c4ee[_0x2718c5(0x79)],'start_at':_0xc4c4ee['start_at'],'end_at':_0xc4c4ee[_0x2718c5(0x8f)]}));return await handleSDKOutput(_0x5d1fce,_0x3d4e1f),0x0;}}
@@ -1 +1 @@
1
- function a37_0x29e9(_0x512054,_0x1acac4){_0x512054=_0x512054-0x16a;const _0x269283=a37_0x2692();let _0x29e9ba=_0x269283[_0x512054];return _0x29e9ba;}const a37_0x10bb76=a37_0x29e9;(function(_0x119436,_0x4a70f8){const _0x1370cb=a37_0x29e9,_0xf8cd58=_0x119436();while(!![]){try{const _0x3d2ad7=-parseInt(_0x1370cb(0x212))/0x1+-parseInt(_0x1370cb(0x1d9))/0x2*(-parseInt(_0x1370cb(0x1c4))/0x3)+parseInt(_0x1370cb(0x196))/0x4*(-parseInt(_0x1370cb(0x197))/0x5)+-parseInt(_0x1370cb(0x172))/0x6*(-parseInt(_0x1370cb(0x1f9))/0x7)+parseInt(_0x1370cb(0x1b5))/0x8+parseInt(_0x1370cb(0x200))/0x9+parseInt(_0x1370cb(0x18f))/0xa*(-parseInt(_0x1370cb(0x19b))/0xb);if(_0x3d2ad7===_0x4a70f8)break;else _0xf8cd58['push'](_0xf8cd58['shift']());}catch(_0xf0ec9b){_0xf8cd58['push'](_0xf8cd58['shift']());}}}(a37_0x2692,0xebf11));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_0x6933f7 from'chalk';async function resolveSegmentTarget(_0x183a40,_0x294974,_0x36fe2d){const _0x1943f1=a37_0x29e9;if(isYamlFilePath(_0x183a40))try{const _0x32c7c7=await resolveYamlFilePath(_0x183a40);return _0x36fe2d&&(console[_0x1943f1(0x1a2)](_0x1943f1(0x1b1)+_0x183a40),console[_0x1943f1(0x1a2)]('\x20\x20Parent\x20segment:\x20'+_0x32c7c7[_0x1943f1(0x1a1)]),console['error'](_0x1943f1(0x19d)+_0x32c7c7[_0x1943f1(0x193)]),console[_0x1943f1(0x1a2)]('\x20\x20Folder\x20path:\x20'+(_0x32c7c7['folderPath']||_0x1943f1(0x1ab))),console[_0x1943f1(0x1a2)](_0x1943f1(0x1c6)+_0x32c7c7[_0x1943f1(0x1ce)])),_0x32c7c7[_0x1943f1(0x1ce)];}catch(_0x10dd9b){throw new SDKError(ErrorCode[_0x1943f1(0x1f6)],_0x1943f1(0x18d)+_0x10dd9b[_0x1943f1(0x204)]);}if(!_0x294974)throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x1943f1(0x1c8));return _0x294974+'/'+_0x183a40;}export class SegmentDescribeCommand extends BaseCommand{['name']=a37_0x10bb76(0x1bc);[a37_0x10bb76(0x183)]=a37_0x10bb76(0x203);async[a37_0x10bb76(0x1a6)](_0x2a56fc){const _0x1205f0=a37_0x10bb76,{options:_0x381aa4,args:_0x55835a,tdx:_0x3def01}=_0x2a56fc,_0x28fdc8=_0x55835a[0x0],_0x1ad53b=!_0x28fdc8&&!!_0x381aa4[_0x1205f0(0x1a1)],_0xecd306=_0x28fdc8||_0x381aa4['parentSegment'];if(!_0xecd306)return console[_0x1205f0(0x1a2)](_0x1205f0(0x1bf)),console[_0x1205f0(0x1a2)](_0x1205f0(0x189)),console['error'](_0x1205f0(0x1f7)),console[_0x1205f0(0x1a2)](_0x1205f0(0x1f2)),console[_0x1205f0(0x1a2)](_0x1205f0(0x19e)),console['error'](_0x1205f0(0x1d2)),console[_0x1205f0(0x1a2)]('\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>'),0x1;try{const _0x482405=_0x381aa4[_0x1205f0(0x1ad)];let _0x4fe53a=_0xecd306;!_0x1ad53b&&_0x482405&&!_0xecd306[_0x1205f0(0x206)]('/')&&(_0x4fe53a=_0x482405+'/'+_0xecd306,_0x381aa4[_0x1205f0(0x186)]&&console[_0x1205f0(0x1a2)](_0x1205f0(0x16f)+_0x4fe53a));const _0x42f48e=await withSpinner(_0x1205f0(0x1d4)+_0x4fe53a+'\x27...',()=>_0x3def01[_0x1205f0(0x1c7)][_0x1205f0(0x1b4)](_0x4fe53a),{'verbose':_0x381aa4[_0x1205f0(0x186)]}),_0x2a5bef=_0x42f48e[_0x1205f0(0x1e6)];_0x381aa4['verbose']&&(console[_0x1205f0(0x1a2)](_0x1205f0(0x176)+_0x2a5bef[_0x1205f0(0x19a)]),console[_0x1205f0(0x1a2)](_0x1205f0(0x1b9)+_0x2a5bef['parentId']),_0x2a5bef[_0x1205f0(0x1b2)]&&console[_0x1205f0(0x1a2)](_0x1205f0(0x1cf)+_0x2a5bef[_0x1205f0(0x1b2)]),_0x2a5bef['segmentId']&&console[_0x1205f0(0x1a2)](_0x1205f0(0x207)+_0x2a5bef[_0x1205f0(0x20e)]));if(_0x2a5bef[_0x1205f0(0x19a)]===_0x1205f0(0x192)){const _0x60a2f6=await withSpinner(_0x1205f0(0x1b8),()=>_0x3def01[_0x1205f0(0x1c7)][_0x1205f0(0x17d)](_0x2a5bef[_0x1205f0(0x1fa)]),{'verbose':_0x381aa4[_0x1205f0(0x186)]});await handleSingleObjectOutput(_0x60a2f6[_0x1205f0(0x1e6)],_0x381aa4);}else{if(_0x2a5bef['type']===_0x1205f0(0x1ef)){if(!_0x2a5bef['folderId'])throw new SDKError(ErrorCode[_0x1205f0(0x1ac)],_0x1205f0(0x1c3));const _0x384df3=await withSpinner('Fetching\x20folder\x20details...',()=>_0x3def01['segment'][_0x1205f0(0x1b7)](_0x2a5bef[_0x1205f0(0x1b2)]),{'verbose':_0x381aa4[_0x1205f0(0x186)]});await handleSingleObjectOutput(_0x384df3[_0x1205f0(0x1e6)],_0x381aa4);}else{if(_0x2a5bef[_0x1205f0(0x19a)]==='segment'){if(!_0x2a5bef[_0x1205f0(0x20e)])throw new SDKError(ErrorCode[_0x1205f0(0x1e4)],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x386473=await withSpinner('Fetching\x20segment\x20details...',()=>_0x3def01[_0x1205f0(0x1c7)][_0x1205f0(0x1fe)](_0x2a5bef['parentId'],_0x2a5bef[_0x1205f0(0x20e)]),{'verbose':_0x381aa4[_0x1205f0(0x186)]});await handleSingleObjectOutput(_0x386473[_0x1205f0(0x1e6)],_0x381aa4);}}}return 0x0;}catch(_0x2676cd){if(_0x2676cd instanceof SDKError)return console[_0x1205f0(0x1a2)](_0x1205f0(0x1e5)+_0x2676cd[_0x1205f0(0x204)]),_0x2676cd['cause']&&console['error']('\x20\x20Cause:\x20'+_0x2676cd[_0x1205f0(0x1b0)]),0x1;throw _0x2676cd;}}}export class SegmentShowCommand extends BaseCommand{[a37_0x10bb76(0x191)]=a37_0x10bb76(0x1c0);['description']=a37_0x10bb76(0x1ec);async[a37_0x10bb76(0x1a6)](_0x9a74ce){const _0x37b80c=a37_0x10bb76,{options:_0x2a42d0,args:_0x160f76,tdx:_0x603642}=_0x9a74ce,_0x5eccc0=_0x160f76[0x0];if(!_0x5eccc0)return console[_0x37b80c(0x1a2)](_0x37b80c(0x190)),console[_0x37b80c(0x1a2)](_0x37b80c(0x1a8)),console['error']('\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20show\x20<path/to/segment.yml>'),console[_0x37b80c(0x1a2)]('Examples:'),console[_0x37b80c(0x1a2)](_0x37b80c(0x211)),console[_0x37b80c(0x1a2)](_0x37b80c(0x1c2)),0x1;try{const _0x36af9e=_0x2a42d0[_0x37b80c(0x1a1)],_0x748497=await resolveSegmentTarget(_0x5eccc0,_0x36af9e,_0x2a42d0[_0x37b80c(0x186)]);_0x2a42d0[_0x37b80c(0x186)]&&console[_0x37b80c(0x1a2)]('Target\x20path:\x20'+_0x748497);const _0x145863=await withSpinner(_0x37b80c(0x1e3)+_0x5eccc0+_0x37b80c(0x20d),()=>_0x603642[_0x37b80c(0x1c7)][_0x37b80c(0x1b4)](_0x748497),{'verbose':_0x2a42d0[_0x37b80c(0x186)]}),_0x492294=_0x145863[_0x37b80c(0x1e6)];_0x2a42d0[_0x37b80c(0x186)]&&(console[_0x37b80c(0x1a2)](_0x37b80c(0x176)+_0x492294['type']),console[_0x37b80c(0x1a2)](_0x37b80c(0x1b9)+_0x492294[_0x37b80c(0x1fa)]));if(_0x492294[_0x37b80c(0x19a)]===_0x37b80c(0x1ef))return console[_0x37b80c(0x1a2)](_0x37b80c(0x199)),console[_0x37b80c(0x1a2)](_0x37b80c(0x17e)),0x1;if(_0x492294[_0x37b80c(0x19a)]===_0x37b80c(0x192))return console['error'](_0x37b80c(0x1a5)),console['error'](_0x37b80c(0x1db)),0x1;if(!_0x492294[_0x37b80c(0x20e)])throw new SDKError(ErrorCode[_0x37b80c(0x1e4)],_0x37b80c(0x1cb));const _0x5e8f5e=await withSpinner(_0x37b80c(0x174),()=>_0x603642[_0x37b80c(0x1c7)][_0x37b80c(0x1e2)](_0x492294[_0x37b80c(0x1fa)],_0x492294[_0x37b80c(0x20e)]),{'verbose':_0x2a42d0[_0x37b80c(0x186)]});let _0xdda8=_0x5e8f5e[_0x37b80c(0x1e6)];const _0x2fbcff=resolveLimit(_0x2a42d0[_0x37b80c(0x17c)],DEFAULT_DISPLAY_LIMIT),_0x53c4b4=/\bLIMIT\s+\d+/i['test'](_0xdda8);!_0x53c4b4&&(_0xdda8=_0xdda8['trim']()[_0x37b80c(0x19c)](/;+$/,''),_0xdda8=_0x37b80c(0x1cc)+_0xdda8+_0x37b80c(0x1df)+_0x2fbcff);_0x2a42d0[_0x37b80c(0x186)]&&console[_0x37b80c(0x1a2)](_0x37b80c(0x1f1)+_0xdda8);const _0x4a75b1=await withProgressSpinner(_0x37b80c(0x17a),async _0x141f1b=>{const _0x5ab354=_0x37b80c,_0x3433e4=await _0x603642[_0x5ab354(0x1dc)][_0x5ab354(0x1a6)](_0xdda8,{'catalog':'td','schema':_0x5ab354(0x1a4),'onJobId':_0x14c121=>{const _0x3f3389=_0x5ab354;_0x141f1b[_0x3f3389(0x1f5)](_0x14c121);}});return _0x3433e4;},{'verbose':_0x2a42d0['verbose']}),_0x5a4ffb=_0x4a75b1[_0x37b80c(0x1e6)],_0x4eb862=_0x5a4ffb[_0x37b80c(0x194)]?_0x37b80c(0x1e7)+_0x5a4ffb[_0x37b80c(0x194)]+']':'';return console[_0x37b80c(0x1a2)]('✔\x20Query\x20completed:\x20Processed\x20'+_0x5a4ffb[_0x37b80c(0x1e8)][_0x37b80c(0x1f8)][_0x37b80c(0x1fd)]()+'\x20rows\x20'+(_0x37b80c(0x1af)+formatElapsed(_0x5a4ffb[_0x37b80c(0x1e8)]['elapsedTimeMillis'])+_0x4eb862)),await handleQueryOutput(_0x5a4ffb,_0x2a42d0),0x0;}catch(_0x34df08){if(_0x34df08 instanceof SDKError)return console[_0x37b80c(0x1a2)](_0x37b80c(0x198)+_0x34df08[_0x37b80c(0x16d)]+']'),console[_0x37b80c(0x1a2)]('\x0a'+_0x34df08[_0x37b80c(0x204)]),0x1;throw _0x34df08;}}}export class SegmentFolderListCommand extends BaseCommand{[a37_0x10bb76(0x191)]=a37_0x10bb76(0x1cd);['description']='List\x20segment\x20folders\x20under\x20a\x20parent\x20segment';async[a37_0x10bb76(0x1a6)](_0x5d403c){const _0x157c67=a37_0x10bb76,{options:_0x2b77a6,args:_0x41d2f3,tdx:_0x38a294}=_0x5d403c;if(_0x41d2f3[_0x157c67(0x1d7)]===0x0)return console['error'](_0x157c67(0x1aa)),console['error']('Usage:\x20tdx\x20segment\x20folder\x20list\x20<parent_name>'),0x1;const _0x5e4cee=_0x41d2f3[0x0];try{_0x2b77a6[_0x157c67(0x186)]&&(console['error']('Site:\x20'+_0x2b77a6[_0x157c67(0x16e)]),console[_0x157c67(0x1a2)](_0x157c67(0x1fb)+_0x5e4cee));const _0xc67580=await withSpinner(_0x157c67(0x182)+_0x5e4cee+'\x27...',()=>_0x38a294[_0x157c67(0x1c7)][_0x157c67(0x209)](_0x5e4cee),{'verbose':_0x2b77a6['verbose']}),_0x2d7865=_0xc67580[_0x157c67(0x1e6)];_0x2b77a6[_0x157c67(0x186)]&&console[_0x157c67(0x1a2)](_0x157c67(0x1d5)+_0x2d7865);const _0x5ee067=await withSpinner('Listing\x20folders\x20for\x20parent\x20\x27'+_0x5e4cee+_0x157c67(0x20d),()=>_0x38a294[_0x157c67(0x1c7)][_0x157c67(0x179)](_0x2d7865),{'verbose':_0x2b77a6[_0x157c67(0x186)]}),_0x5e3948=_0x5ee067[_0x157c67(0x1e6)];return console[_0x157c67(0x1a2)](_0x157c67(0x20c)+_0x5e3948['length']+'\x20folder'+(_0x5e3948[_0x157c67(0x1d7)]!==0x1?'s':'')),await handleSDKOutput(_0x5e3948,_0x2b77a6),0x0;}catch(_0x2cdbdf){if(_0x2cdbdf instanceof SDKError)return console[_0x157c67(0x1a2)](_0x157c67(0x1e5)+_0x2cdbdf[_0x157c67(0x204)]),_0x2cdbdf[_0x157c67(0x1b0)]&&console[_0x157c67(0x1a2)](_0x157c67(0x1dd)+_0x2cdbdf[_0x157c67(0x1b0)]),0x1;throw _0x2cdbdf;}}}function a37_0x2692(){const _0x39daaf=['replace','\x20\x20Segment\x20name:\x20','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience/Marketing/High\x20Value\x22','\x20Opening\x20','Cannot\x20get\x20SQL\x20for\x20parent\x20segment\x20with\x20this\x20command.\x20Use:\x20tdx\x20ps\x20sql','parentSegment','error','✔\x20Created\x20folder\x20\x27','information_schema','Error:\x20Cannot\x20execute\x20query\x20for\x20parent\x20segment\x20with\x20this\x20command.','execute','Error:\x20Cannot\x20show\x20schema\x20for\x20parent\x20segment\x20with\x20this\x20command.','Usage:\x20tdx\x20sg\x20show\x20<name>','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20desc\x20<path/to/segment.yml>','Error:\x20Parent\x20segment\x20name\x20is\x20required','(root)','SEGMENT_FOLDER_NOT_FOUND','segmentPath','createFolder','in\x20','cause','Resolved\x20YAML\x20file:\x20','folderId','\x20\x20Local\x20YAML\x20file:\x20\x20\x20\x20\x20\x20tdx\x20sg\x20sql\x20--path\x20<file-path>','resolvePathToResource','9919544TlbYFC','jsonl','getFolder','Fetching\x20parent\x20segment\x20details...','Parent\x20ID:\x20','Usage:\x20tdx\x20segment\x20folder\x20show\x20<parent_name/folder_name>','content','segment:describe','url','segment:sql','Error:\x20Path\x20or\x20name\x20is\x20required','segment:show','Usage:\x20tdx\x20segment\x20folder\x20create\x20<parent_name>\x20<folder_name>\x20[options]','\x20\x20tdx\x20sg\x20show\x20segments/my-audience/premium-users.yml','Folder\x20ID\x20missing\x20from\x20resolved\x20path','516PrYPlU','Error:\x20Cannot\x20open\x20folder\x20in\x20web\x20browser.\x20Use\x20a\x20segment\x20name\x20instead.','\x20\x20Full\x20path:\x20','segment','No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22','getSegmentSQLFromYaml','\x20\x20tdx\x20sg\x20sql\x20\x22Premium\x20Users\x22','Segment\x20ID\x20missing\x20from\x20resolved\x20path','SELECT\x20*\x20FROM\x20(\x0a','segment:folder:list','fullPath','Folder\x20ID:\x20','Fetching\x20folder\x20details...','\x20\x20tdx\x20sg\x20view\x20segments/my-audience/premium-users.yml','\x20\x20tdx\x20segment\x20describe\x20\x22High\x20Value\x22\x20\x20\x20\x20#\x20Relative\x20to\x20current\x20context','parentFolder','Resolving\x20path\x20\x27','Resolved\x20parent\x20ID:\x20','log','length','\x27\x20with\x20ID:\x20','3766TsoPei','Error:\x20Cannot\x20open\x20parent\x20segment\x20with\x20this\x20command.','Use:\x20tdx\x20ps\x20show','query','\x20\x20Cause:\x20','\x20\x20tdx\x20sg\x20view\x20\x22Marketing\x22\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20folder\x20details','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20-w\x20\x20#\x20Open\x20segment\x20in\x20web\x20browser','Options:','getSegmentSQL','Resolving\x20\x27','SEGMENT_NOT_FOUND','Error:\x20','data','\x20[Job\x20ID:\x20','stats','resolveFolderId','/app/ps/','Use:\x20tdx\x20ps\x20view\x20-w','Execute\x20child\x20segment\x20SQL\x20query\x20and\x20show\x20results','Create\x20segment\x20folder\x20for\x20organization','json','folder','Use:\x20tdx\x20ps\x20view','SQL\x20query:\x0a','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience\x22','getSQLFromServerSegment','Creating\x20folder\x20\x27','setJobId','INVALID_ARGUMENT','Examples:','processedRows','86233bvwgoZ','parentId','Parent\x20name:\x20','Show\x20segment\x20folder\x20details','toLocaleString','getSegment','Target\x20path:\x20','12655395ENPpZW','Folder\x20name:\x20','Site:\x20','Show\x20segment\x20or\x20folder\x20details','message','Resolved\x20folder\x20ID:\x20','includes','Segment\x20ID:\x20','Usage:\x20tdx\x20sg\x20desc\x20<name>','resolveParentId','segment:view','Parent\x20segment:\x20','✔\x20Found\x20','\x27...','segmentId','Error:\x20Folder\x20name\x20is\x20required\x20(use\x20parent_name/folder_name\x20format)','Get\x20SQL\x20query\x20for\x20child\x20segment','\x20\x20tdx\x20sg\x20show\x20\x22Premium\x20Users\x22','834408OtuIWY','\x20\x20tdx\x20sg\x20sql\x20--path\x20','Error:\x20Cannot\x20view\x20parent\x20segment\x20details\x20with\x20this\x20command.','path','code','site','Resolved\x20relative\x20path\x20to:\x20','cyan','Usage:','318fjfHdU','Error:\x20Folder\x20or\x20segment\x20name,\x20or\x20YAML\x20file\x20path\x20is\x20required','Fetching\x20SQL\x20for\x20segment...','Fetching\x20SQL\x20from\x20rule...','Resolved\x20type:\x20','\x20\x20-w,\x20--web\x20\x20Open\x20segment\x20in\x20web\x20browser','getSQLFromYamlFile','listFolders','Executing\x20segment\x20query...','Error:\x20Folder\x20reference\x20is\x20required','limit','getParent','Use:\x20tdx\x20sg\x20view\x20<name>\x20\x20#\x20To\x20show\x20folder\x20details','Error:\x20Specify\x20either\x20segment\x20name\x20or\x20--path,\x20not\x20both','segment:desc','Resolved:\x20','Resolving\x20parent\x20segment\x20\x27','description','Resolving\x20parent\x20folder\x20\x27','Resolving\x20folder\x20\x27','verbose','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20\x20\x20\x20\x20#\x20View\x20child\x20segment\x20details','Error:\x20Parent\x20segment\x20name\x20and\x20folder\x20name\x20are\x20required','Usage:\x20tdx\x20segment\x20describe\x20<path>','Usage:\x20tdx\x20sg\x20view\x20<name>\x20[-w]','format','red','Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20','/e/','1840390ubWcMj','Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required','name','parent','segmentName','jobId','Show\x20child\x20segment\x20schema\x20(column\x20types)','1156DtXYKw','9235xXSNYc','✖\x20Query\x20failed\x20[','Error:\x20Cannot\x20execute\x20SQL\x20query\x20on\x20a\x20folder.','type','77xkbEup'];a37_0x2692=function(){return _0x39daaf;};return a37_0x2692();}export class SegmentFolderShowCommand extends BaseCommand{[a37_0x10bb76(0x191)]='segment:folder:show';[a37_0x10bb76(0x183)]=a37_0x10bb76(0x1fc);async['execute'](_0x33205c){const _0x58947a=a37_0x10bb76,{options:_0x283497,args:_0x4c40a1,tdx:_0x7bbae2}=_0x33205c;if(_0x4c40a1['length']===0x0)return console[_0x58947a(0x1a2)](_0x58947a(0x17b)),console[_0x58947a(0x1a2)](_0x58947a(0x1ba)),0x1;try{const {parentId:_0x3380bd,childId:_0x399011}=parseSegmentRef(_0x4c40a1[0x0]);_0x283497['verbose']&&(console[_0x58947a(0x1a2)]('Site:\x20'+_0x283497[_0x58947a(0x16e)]),console[_0x58947a(0x1a2)](_0x58947a(0x1fb)+_0x3380bd),_0x399011&&console[_0x58947a(0x1a2)](_0x58947a(0x201)+_0x399011));if(!_0x399011)return console['error'](_0x58947a(0x20f)),0x1;const _0x4a252b=await withSpinner(_0x58947a(0x182)+_0x3380bd+'\x27...',()=>_0x7bbae2['segment']['resolveParentId'](_0x3380bd),{'verbose':_0x283497['verbose']}),_0x15040e=_0x4a252b[_0x58947a(0x1e6)];_0x283497[_0x58947a(0x186)]&&console['error'](_0x58947a(0x1d5)+_0x15040e);const _0x40ca86=await withSpinner(_0x58947a(0x185)+_0x399011+_0x58947a(0x20d),()=>_0x7bbae2['segment']['resolveFolderId'](_0x15040e,_0x399011),{'verbose':_0x283497[_0x58947a(0x186)]}),_0x1627ad=_0x40ca86[_0x58947a(0x1e6)];_0x283497[_0x58947a(0x186)]&&console[_0x58947a(0x1a2)](_0x58947a(0x205)+_0x1627ad);const _0x487228=await withSpinner('Fetching\x20folder\x20\x27'+_0x399011+_0x58947a(0x20d),()=>_0x7bbae2[_0x58947a(0x1c7)][_0x58947a(0x1b7)](_0x1627ad),{'verbose':_0x283497[_0x58947a(0x186)]});return await handleSDKOutput([_0x487228[_0x58947a(0x1e6)]],_0x283497),0x0;}catch(_0x9b0229){if(_0x9b0229 instanceof SDKError)return console[_0x58947a(0x1a2)](_0x58947a(0x1e5)+_0x9b0229[_0x58947a(0x204)]),_0x9b0229['cause']&&console['error']('\x20\x20Cause:\x20'+_0x9b0229[_0x58947a(0x1b0)]),0x1;throw _0x9b0229;}}}export class SegmentSQLCommand extends BaseCommand{[a37_0x10bb76(0x191)]=a37_0x10bb76(0x1be);[a37_0x10bb76(0x183)]=a37_0x10bb76(0x210);async['execute'](_0x10f87e){const _0x54a42e=a37_0x10bb76,{options:_0x329427,args:_0x513ed8}=_0x10f87e,_0x446517=_0x329427,_0x2632d6=_0x446517[_0x54a42e(0x16c)],_0x55db7a=_0x513ed8[0x0];if(!_0x55db7a&&!_0x2632d6)return console['error'](a37_0x6933f7[_0x54a42e(0x18c)]('Error:\x20Segment\x20name\x20or\x20--path\x20is\x20required')),console[_0x54a42e(0x1a2)](_0x54a42e(0x171)),console[_0x54a42e(0x1a2)]('\x20\x20Server-side\x20segment:\x20\x20tdx\x20sg\x20sql\x20<name>'),console['error'](_0x54a42e(0x1b3)),console['error'](_0x54a42e(0x1f7)),console['error'](_0x54a42e(0x1ca)),console[_0x54a42e(0x1a2)]('\x20\x20tdx\x20sg\x20sql\x20--path\x20segments/my-audience/premium-users.yml'),0x1;if(_0x55db7a&&_0x2632d6)return console[_0x54a42e(0x1a2)](a37_0x6933f7[_0x54a42e(0x18c)](_0x54a42e(0x17f))),0x1;try{let _0x105223;if(_0x2632d6)_0x105223=await this['getSQLFromYamlFile'](_0x2632d6,_0x10f87e);else{if(isYamlFilePath(_0x55db7a))return console[_0x54a42e(0x1a2)](a37_0x6933f7[_0x54a42e(0x18c)]('Error:\x20YAML\x20file\x20paths\x20must\x20be\x20specified\x20with\x20--path\x20option')),console[_0x54a42e(0x1a2)](_0x54a42e(0x16a)+_0x55db7a),0x1;else _0x105223=await this[_0x54a42e(0x1f3)](_0x55db7a,_0x10f87e);}return _0x329427[_0x54a42e(0x18b)]===_0x54a42e(0x1ee)||_0x329427[_0x54a42e(0x18b)]===_0x54a42e(0x1b6)?await handleSDKOutput([{'sql':_0x105223}],_0x329427):console[_0x54a42e(0x1d6)](_0x105223),0x0;}catch(_0x18b172){if(_0x18b172 instanceof SDKError)return console[_0x54a42e(0x1a2)](_0x54a42e(0x1e5)+_0x18b172[_0x54a42e(0x204)]),_0x18b172['cause']&&console[_0x54a42e(0x1a2)](_0x54a42e(0x1dd)+_0x18b172['cause']),0x1;throw _0x18b172;}}async[a37_0x10bb76(0x178)](_0x5e1634,_0x420aa1){const _0x1eecd1=a37_0x10bb76,{options:_0x34a8c0,tdx:_0x64c800}=_0x420aa1;let _0x53f8a3;try{_0x53f8a3=await resolveYamlFilePath(_0x5e1634);}catch(_0x50d3ab){throw new SDKError(ErrorCode['INVALID_ARGUMENT'],'Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20'+_0x50d3ab[_0x1eecd1(0x204)]);}_0x34a8c0[_0x1eecd1(0x186)]&&console[_0x1eecd1(0x1a2)](_0x1eecd1(0x181)+_0x53f8a3[_0x1eecd1(0x1a1)]+'/'+_0x53f8a3['segmentName']);const _0x1d8865=await withSpinner(_0x1eecd1(0x175),()=>_0x64c800[_0x1eecd1(0x1c7)][_0x1eecd1(0x1c9)](_0x53f8a3[_0x1eecd1(0x1bb)],_0x53f8a3[_0x1eecd1(0x1a1)],_0x53f8a3['segmentName']),{'verbose':_0x34a8c0[_0x1eecd1(0x186)]});return _0x1d8865['data'];}async[a37_0x10bb76(0x1f3)](_0x43ae88,_0x412443){const _0x40ef95=a37_0x10bb76,{options:_0x2ec31f,tdx:_0x38214a}=_0x412443,_0x30f548=_0x2ec31f[_0x40ef95(0x1a1)],_0x141caa=await resolveSegmentTarget(_0x43ae88,_0x30f548,_0x2ec31f['verbose']);_0x2ec31f[_0x40ef95(0x186)]&&console['error'](_0x40ef95(0x1ff)+_0x141caa);const _0x5e1a25=await withSpinner('Resolving\x20\x27'+_0x43ae88+_0x40ef95(0x20d),()=>_0x38214a['segment']['resolvePathToResource'](_0x141caa),{'verbose':_0x2ec31f[_0x40ef95(0x186)]}),_0x4d2bdf=_0x5e1a25[_0x40ef95(0x1e6)];_0x2ec31f[_0x40ef95(0x186)]&&(console[_0x40ef95(0x1a2)](_0x40ef95(0x176)+_0x4d2bdf[_0x40ef95(0x19a)]),console[_0x40ef95(0x1a2)](_0x40ef95(0x1b9)+_0x4d2bdf[_0x40ef95(0x1fa)]));if(_0x4d2bdf[_0x40ef95(0x19a)]==='folder')throw new SDKError(ErrorCode[_0x40ef95(0x1f6)],'Cannot\x20get\x20SQL\x20query\x20for\x20a\x20folder.\x20Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.');if(_0x4d2bdf[_0x40ef95(0x19a)]===_0x40ef95(0x192))throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x40ef95(0x1a0));if(!_0x4d2bdf[_0x40ef95(0x20e)])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x1c33a4=await withSpinner('Fetching\x20SQL\x20for\x20segment...',()=>_0x38214a[_0x40ef95(0x1c7)][_0x40ef95(0x1e2)](_0x4d2bdf[_0x40ef95(0x1fa)],_0x4d2bdf[_0x40ef95(0x20e)]),{'verbose':_0x2ec31f[_0x40ef95(0x186)]});return _0x1c33a4[_0x40ef95(0x1e6)];}}export class SegmentFolderCreateCommand extends BaseCommand{[a37_0x10bb76(0x191)]='segment:folder:create';['description']=a37_0x10bb76(0x1ed);async['execute'](_0x37eae){const _0x561fb7=a37_0x10bb76,{options:_0x9232a8,args:_0x28199c,tdx:_0x14ff88}=_0x37eae,_0x12fe5b=_0x9232a8;if(_0x28199c[_0x561fb7(0x1d7)]<0x2)return console['error'](_0x561fb7(0x188)),console[_0x561fb7(0x1a2)](_0x561fb7(0x1c1)),0x1;const _0x46aebd=_0x28199c[0x0],_0x17d073=_0x28199c[0x1];_0x12fe5b[_0x561fb7(0x186)]&&(console[_0x561fb7(0x1a2)](_0x561fb7(0x202)+_0x12fe5b[_0x561fb7(0x16e)]),console[_0x561fb7(0x1a2)](_0x561fb7(0x20b)+_0x46aebd),console['error'](_0x561fb7(0x201)+_0x17d073));let _0x1d433f;if(_0x12fe5b[_0x561fb7(0x1d3)]){const _0x188a89=_0x12fe5b[_0x561fb7(0x1d3)],_0xcf156a=await withSpinner(_0x561fb7(0x182)+_0x46aebd+'\x27...',()=>_0x14ff88['segment'][_0x561fb7(0x209)](_0x46aebd),{'verbose':_0x12fe5b[_0x561fb7(0x186)]}),_0x17086d=_0xcf156a['data'],_0x2426f7=await withSpinner(_0x561fb7(0x184)+_0x188a89+'\x27...',()=>_0x14ff88[_0x561fb7(0x1c7)][_0x561fb7(0x1e9)](_0x17086d,_0x188a89),{'verbose':_0x12fe5b[_0x561fb7(0x186)]});_0x1d433f=_0x2426f7[_0x561fb7(0x1e6)],_0x12fe5b['verbose']&&console[_0x561fb7(0x1a2)]('Resolved\x20parent\x20folder\x20ID:\x20'+_0x1d433f);}const _0x517a72={'name':_0x17d073,'description':_0x12fe5b[_0x561fb7(0x183)],'parentFolderId':_0x1d433f},_0x104091=await withSpinner(_0x561fb7(0x1f4)+_0x17d073+_0x561fb7(0x20d),()=>_0x14ff88[_0x561fb7(0x1c7)][_0x561fb7(0x1ae)](_0x46aebd,_0x517a72),{'verbose':_0x12fe5b[_0x561fb7(0x186)]}),_0x9eb52d=_0x104091[_0x561fb7(0x1e6)];return console[_0x561fb7(0x1a2)](_0x561fb7(0x1a3)+_0x9eb52d['name']+_0x561fb7(0x1d8)+_0x9eb52d['id']),await handleSDKOutput([_0x9eb52d],_0x12fe5b),0x0;}}export class SegmentViewCommand extends BaseCommand{[a37_0x10bb76(0x191)]=a37_0x10bb76(0x20a);['description']='Show\x20folder\x20or\x20child\x20segment\x20details';async['execute'](_0x396d18){const _0x54bab6=a37_0x10bb76,{options:_0x980a15,args:_0x518f79,tdx:_0x370947}=_0x396d18,_0x2abc9a=_0x518f79[0x0];if(!_0x2abc9a)return console[_0x54bab6(0x1a2)](_0x54bab6(0x173)),console[_0x54bab6(0x1a2)](_0x54bab6(0x18a)),console['error']('\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20view\x20<path/to/segment.yml>'),console[_0x54bab6(0x1a2)](_0x54bab6(0x1e1)),console['error'](_0x54bab6(0x177)),console[_0x54bab6(0x1a2)]('Examples:'),console[_0x54bab6(0x1a2)](_0x54bab6(0x1de)),console['error'](_0x54bab6(0x187)),console[_0x54bab6(0x1a2)](_0x54bab6(0x1e0)),console[_0x54bab6(0x1a2)](_0x54bab6(0x1d1)),0x1;try{const _0xf979a6=_0x980a15[_0x54bab6(0x1a1)],_0x2a5679=await resolveSegmentTarget(_0x2abc9a,_0xf979a6,_0x980a15[_0x54bab6(0x186)]);_0x980a15['verbose']&&console[_0x54bab6(0x1a2)](_0x54bab6(0x1ff)+_0x2a5679);const _0x651c86=await withSpinner('Resolving\x20\x27'+_0x2abc9a+_0x54bab6(0x20d),()=>_0x370947['segment']['resolvePathToResource'](_0x2a5679),{'verbose':_0x980a15[_0x54bab6(0x186)]}),_0x518331=_0x651c86[_0x54bab6(0x1e6)];_0x980a15['verbose']&&(console[_0x54bab6(0x1a2)](_0x54bab6(0x176)+_0x518331[_0x54bab6(0x19a)]),console[_0x54bab6(0x1a2)](_0x54bab6(0x1b9)+_0x518331['parentId']),_0x518331[_0x54bab6(0x1b2)]&&console[_0x54bab6(0x1a2)]('Folder\x20ID:\x20'+_0x518331[_0x54bab6(0x1b2)]),_0x518331[_0x54bab6(0x20e)]&&console[_0x54bab6(0x1a2)](_0x54bab6(0x207)+_0x518331[_0x54bab6(0x20e)]));if(_0x980a15['web']){if(_0x518331['type']===_0x54bab6(0x1ef))return console['error'](_0x54bab6(0x1c5)),0x1;if(_0x518331['type']===_0x54bab6(0x192))return console[_0x54bab6(0x1a2)](_0x54bab6(0x1da)),console[_0x54bab6(0x1a2)](_0x54bab6(0x1eb)),0x1;if(!_0x518331['segmentId'])throw new SDKError(ErrorCode[_0x54bab6(0x1e4)],_0x54bab6(0x1cb));const _0x31e504=getConsoleNextUrl(_0x980a15[_0x54bab6(0x16e)],_0x54bab6(0x1ea)+_0x518331[_0x54bab6(0x1fa)]+_0x54bab6(0x18e)+_0x518331[_0x54bab6(0x20e)]);return console['error'](a37_0x6933f7['green']('✔')+_0x54bab6(0x19f)+a37_0x6933f7[_0x54bab6(0x170)](_0x31e504)),openBrowser(_0x31e504),0x0;}if(_0x518331['type']===_0x54bab6(0x1ef)){if(!_0x518331['folderId'])throw new SDKError(ErrorCode[_0x54bab6(0x1ac)],'Folder\x20ID\x20missing\x20from\x20resolved\x20path');const _0x234dbe=await withSpinner(_0x54bab6(0x1d0),()=>_0x370947['segment'][_0x54bab6(0x1b7)](_0x518331[_0x54bab6(0x1b2)]),{'verbose':_0x980a15[_0x54bab6(0x186)]});await handleSingleObjectOutput(_0x234dbe[_0x54bab6(0x1e6)],_0x980a15);}else{if(_0x518331[_0x54bab6(0x19a)]==='segment'){if(!_0x518331[_0x54bab6(0x20e)])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x54bab6(0x1cb));const _0x5da597=await withSpinner('Fetching\x20segment\x20details...',()=>_0x370947[_0x54bab6(0x1c7)]['getSegment'](_0x518331[_0x54bab6(0x1fa)],_0x518331[_0x54bab6(0x20e)]),{'verbose':_0x980a15['verbose']}),_0x2ff036=getConsoleNextUrl(_0x980a15[_0x54bab6(0x16e)],_0x54bab6(0x1ea)+_0x518331[_0x54bab6(0x1fa)]+_0x54bab6(0x18e)+_0x518331[_0x54bab6(0x20e)]),_0x3c1c42=_0x5da597[_0x54bab6(0x1e6)];_0x3c1c42[_0x54bab6(0x1bd)]=_0x2ff036,await handleSingleObjectOutput(_0x3c1c42,_0x980a15);}else return console[_0x54bab6(0x1a2)](_0x54bab6(0x16b)),console[_0x54bab6(0x1a2)](_0x54bab6(0x1f0)),0x1;}return 0x0;}catch(_0x20ca36){if(_0x20ca36 instanceof SDKError)return console['error'](_0x54bab6(0x1e5)+_0x20ca36['message']),_0x20ca36[_0x54bab6(0x1b0)]&&console[_0x54bab6(0x1a2)]('\x20\x20Cause:\x20'+_0x20ca36[_0x54bab6(0x1b0)]),0x1;throw _0x20ca36;}}}export const SegmentInfoCommand=SegmentViewCommand;export class SegmentDescCommand extends BaseCommand{[a37_0x10bb76(0x191)]=a37_0x10bb76(0x180);[a37_0x10bb76(0x183)]=a37_0x10bb76(0x195);async[a37_0x10bb76(0x1a6)](_0xa53500){const _0x107514=a37_0x10bb76,{options:_0x594eae,args:_0x150147,tdx:_0x204c9a}=_0xa53500,_0x26b496=_0x150147[0x0];if(!_0x26b496)return console[_0x107514(0x1a2)]('Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required'),console[_0x107514(0x1a2)](_0x107514(0x208)),console['error'](_0x107514(0x1a9)),console[_0x107514(0x1a2)](_0x107514(0x1f7)),console[_0x107514(0x1a2)]('\x20\x20tdx\x20sg\x20desc\x20\x22Premium\x20Users\x22'),console[_0x107514(0x1a2)]('\x20\x20tdx\x20sg\x20desc\x20segments/my-audience/premium-users.yml'),0x1;try{const _0x4e3ec2=_0x594eae[_0x107514(0x1a1)],_0x55b2af=await resolveSegmentTarget(_0x26b496,_0x4e3ec2,_0x594eae['verbose']);_0x594eae[_0x107514(0x186)]&&console[_0x107514(0x1a2)]('Target\x20path:\x20'+_0x55b2af);const _0x21884c=await withSpinner(_0x107514(0x1e3)+_0x26b496+_0x107514(0x20d),()=>_0x204c9a[_0x107514(0x1c7)][_0x107514(0x1b4)](_0x55b2af),{'verbose':_0x594eae['verbose']}),_0x19f960=_0x21884c[_0x107514(0x1e6)];_0x594eae[_0x107514(0x186)]&&(console[_0x107514(0x1a2)](_0x107514(0x176)+_0x19f960['type']),console[_0x107514(0x1a2)](_0x107514(0x1b9)+_0x19f960[_0x107514(0x1fa)]));if(_0x19f960[_0x107514(0x19a)]==='folder')return console['error']('Error:\x20Cannot\x20show\x20schema\x20for\x20a\x20folder.'),console[_0x107514(0x1a2)]('Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.'),0x1;if(_0x19f960[_0x107514(0x19a)]===_0x107514(0x192))return console[_0x107514(0x1a2)](_0x107514(0x1a7)),console[_0x107514(0x1a2)]('Use:\x20tdx\x20ps\x20desc'),0x1;if(!_0x19f960['segmentId'])throw new SDKError(ErrorCode[_0x107514(0x1e4)],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x38e990=await withSpinner(_0x107514(0x174),()=>_0x204c9a[_0x107514(0x1c7)]['getSegmentSQL'](_0x19f960[_0x107514(0x1fa)],_0x19f960[_0x107514(0x20e)]),{'verbose':_0x594eae[_0x107514(0x186)]}),_0x1578de=_0x38e990['data'],_0x4f8beb=await executeSchemaQuery(_0x1578de,_0x204c9a,_0x594eae);return await handleQueryOutput(_0x4f8beb,_0x594eae),0x0;}catch(_0x11962e){if(_0x11962e instanceof SDKError)return console[_0x107514(0x1a2)]('Error:\x20'+_0x11962e[_0x107514(0x204)]),_0x11962e['cause']&&console[_0x107514(0x1a2)]('\x20\x20Cause:\x20'+_0x11962e[_0x107514(0x1b0)]),0x1;throw _0x11962e;}}}
1
+ const a37_0x522e52=a37_0x5f4b;(function(_0x510530,_0x444207){const _0xf41a8f=a37_0x5f4b,_0x533fd6=_0x510530();while(!![]){try{const _0x1878be=-parseInt(_0xf41a8f(0xb8))/0x1*(parseInt(_0xf41a8f(0xc6))/0x2)+-parseInt(_0xf41a8f(0x117))/0x3*(parseInt(_0xf41a8f(0x9f))/0x4)+parseInt(_0xf41a8f(0x126))/0x5+parseInt(_0xf41a8f(0x121))/0x6*(parseInt(_0xf41a8f(0xeb))/0x7)+parseInt(_0xf41a8f(0xae))/0x8+-parseInt(_0xf41a8f(0xb6))/0x9+parseInt(_0xf41a8f(0x12f))/0xa*(parseInt(_0xf41a8f(0x11f))/0xb);if(_0x1878be===_0x444207)break;else _0x533fd6['push'](_0x533fd6['shift']());}catch(_0x2fd980){_0x533fd6['push'](_0x533fd6['shift']());}}}(a37_0x4d6b,0xa41ae));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,handleQueryOutput,handleSingleObjectOutput}from'../core/command-output.js';import{withSpinner,withProgressSpinner,formatElapsed}from'../utils/spinner.js';function a37_0x4d6b(){const _0x6cd760=['Error:\x20Cannot\x20view\x20parent\x20segment\x20details\x20with\x20this\x20command.','1996jVghxb','Show\x20child\x20segment\x20schema\x20(column\x20types)','Resolving\x20parent\x20folder\x20\x27','\x20\x20tdx\x20sg\x20desc\x20\x22Premium\x20Users\x22','resolveParentId','parentSegment','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20-w\x20\x20#\x20Open\x20segment\x20in\x20web\x20browser','\x20\x20tdx\x20sg\x20sql\x20--path\x20','\x20\x20Parent\x20segment:\x20','Folder\x20name:\x20','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','Create\x20segment\x20folder\x20for\x20organization','parent','\x20\x20tdx\x20sg\x20sql\x20\x22Premium\x20Users\x22','796mmYLKh','type','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience/Marketing/High\x20Value\x22','Usage:\x20tdx\x20segment\x20describe\x20<path>','Resolving\x20\x27','code','Segment\x20ID:\x20','Fetching\x20SQL\x20for\x20segment...','Error:\x20Cannot\x20show\x20schema\x20for\x20parent\x20segment\x20with\x20this\x20command.','Error:\x20Folder\x20or\x20segment\x20name,\x20or\x20YAML\x20file\x20path\x20is\x20required','stats','Folder\x20ID\x20missing\x20from\x20resolved\x20path','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience\x22','resolvePathToResource','parentFolder','SELECT\x20*\x20FROM\x20(\x0a','getSegmentSQL','Use:\x20tdx\x20ps\x20view','Target\x20path:\x20','Get\x20SQL\x20query\x20for\x20child\x20segment','/app/ps/','segmentPath','✔\x20Created\x20folder\x20\x27','INVALID_ARGUMENT','information_schema','\x20\x20tdx\x20segment\x20describe\x20\x22High\x20Value\x22\x20\x20\x20\x20#\x20Relative\x20to\x20current\x20context','Error:\x20Cannot\x20execute\x20SQL\x20query\x20on\x20a\x20folder.','\x20[Job\x20ID:\x20','\x20\x20tdx\x20sg\x20sql\x20--path\x20segments/my-audience/premium-users.yml','log','folder','Use:\x20tdx\x20ps\x20view\x20-w','segment:folder:create','\x20\x20Local\x20YAML\x20file:\x20\x20\x20\x20\x20\x20tdx\x20sg\x20sql\x20--path\x20<file-path>','Cannot\x20get\x20SQL\x20query\x20for\x20a\x20folder.\x20Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.','format','Parent\x20name:\x20','7pfAiks','resolveFolderId','path','Resolved\x20relative\x20path\x20to:\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20show\x20<path/to/segment.yml>','description','\x20\x20tdx\x20sg\x20desc\x20segments/my-audience/premium-users.yml','Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required','Error:\x20Parent\x20segment\x20name\x20is\x20required','✔\x20Found\x20','segment:view','✔\x20Query\x20completed:\x20Processed\x20','Fetching\x20segment\x20details...','segmentId','Resolved\x20parent\x20ID:\x20','length','message','(root)','data','red','green','getFolder','getParent','getSegmentSQLFromYaml','Site:\x20','Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20','Resolving\x20parent\x20segment\x20\x27','/e/','web','getSQLFromServerSegment','Examples:','jobId','cyan','error','\x20folder','name','Show\x20segment\x20or\x20folder\x20details','parentId','segment','\x20Opening\x20','\x20\x20tdx\x20sg\x20show\x20\x22Premium\x20Users\x22','segment:folder:show','site','Segment\x20ID\x20missing\x20from\x20resolved\x20path','3HwEejo','replace','Error:\x20Parent\x20segment\x20name\x20and\x20folder\x20name\x20are\x20required','content','Usage:','Show\x20folder\x20or\x20child\x20segment\x20details','Usage:\x20tdx\x20segment\x20folder\x20create\x20<parent_name>\x20<folder_name>\x20[options]','Fetching\x20folder\x20\x27','166903tCzhYW','execute','3874998LaeZmF','Executing\x20segment\x20query...','Show\x20segment\x20folder\x20details','Error:\x20Path\x20or\x20name\x20is\x20required','Usage:\x20tdx\x20segment\x20folder\x20list\x20<parent_name>','51110KBRlSX','elapsedTimeMillis','SQL\x20query:\x0a','SEGMENT_NOT_FOUND','segment:desc','Resolved\x20folder\x20ID:\x20','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20view\x20<path/to/segment.yml>','Error:\x20Folder\x20reference\x20is\x20required','1290XxwRkm','Use:\x20tdx\x20sg\x20view\x20<name>\x20\x20#\x20To\x20show\x20folder\x20details','Parent\x20ID:\x20','listFolders','folderId','Fetching\x20folder\x20details...','Usage:\x20tdx\x20segment\x20folder\x20show\x20<parent_name/folder_name>','Fetching\x20SQL\x20from\x20rule...','Resolving\x20path\x20\x27','Error:\x20Folder\x20name\x20is\x20required\x20(use\x20parent_name/folder_name\x20format)','jsonl','Error:\x20Cannot\x20show\x20schema\x20for\x20a\x20folder.','Resolved\x20parent\x20folder\x20ID:\x20','segmentName','\x20\x20Server-side\x20segment:\x20\x20tdx\x20sg\x20sql\x20<name>','trim','\x20\x20Cause:\x20','fullPath','Error:\x20YAML\x20file\x20paths\x20must\x20be\x20specified\x20with\x20--path\x20option','createFolder','3093268SxIiKU','Error:\x20','getSegment','Usage:\x20tdx\x20sg\x20show\x20<name>','SEGMENT_FOLDER_NOT_FOUND','url','Folder\x20ID:\x20','segment:sql','\x20\x20tdx\x20sg\x20view\x20segments/my-audience/premium-users.yml','\x27...','Usage:\x20tdx\x20sg\x20desc\x20<name>','Resolved\x20YAML\x20file:\x20','getSQLFromYamlFile','verbose','toLocaleString','6085904AJQqWE','cause','Fetching\x20parent\x20segment\x20details...','\x20\x20Folder\x20path:\x20','\x20\x20tdx\x20sg\x20view\x20\x22Marketing\x22\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20folder\x20details','setJobId','Resolved\x20type:\x20','Resolved:\x20','10207899ZBThuj'];a37_0x4d6b=function(){return _0x6cd760;};return a37_0x4d6b();}import{parseSegmentRef}from'../sdk/segment/segment-ref-parser.js';function a37_0x5f4b(_0x18a850,_0x5cb161){_0x18a850=_0x18a850-0x8e;const _0x4d6b0e=a37_0x4d6b();let _0x5f4b89=_0x4d6b0e[_0x18a850];return _0x5f4b89;}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_0x1c799a from'chalk';async function resolveSegmentTarget(_0x12d552,_0x5466d4,_0x360f6a){const _0x29209f=a37_0x5f4b;if(isYamlFilePath(_0x12d552))try{const _0x50fd74=await resolveYamlFilePath(_0x12d552);return _0x360f6a&&(console[_0x29209f(0x10c)](_0x29209f(0xaa)+_0x12d552),console[_0x29209f(0x10c)](_0x29209f(0xc0)+_0x50fd74[_0x29209f(0xbd)]),console[_0x29209f(0x10c)]('\x20\x20Segment\x20name:\x20'+_0x50fd74['segmentName']),console[_0x29209f(0x10c)](_0x29209f(0xb1)+(_0x50fd74['folderPath']||_0x29209f(0xfc))),console[_0x29209f(0x10c)]('\x20\x20Full\x20path:\x20'+_0x50fd74[_0x29209f(0x9c)])),_0x50fd74[_0x29209f(0x9c)];}catch(_0x4ceade){throw new SDKError(ErrorCode[_0x29209f(0xdd)],_0x29209f(0x104)+_0x4ceade[_0x29209f(0xfb)]);}if(!_0x5466d4)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 _0x5466d4+'/'+_0x12d552;}export class SegmentDescribeCommand extends BaseCommand{[a37_0x522e52(0x10e)]='segment:describe';['description']=a37_0x522e52(0x10f);async['execute'](_0x2a3041){const _0xa25dc6=a37_0x522e52,{options:_0x7597c5,args:_0x596e16,tdx:_0x5a71a8}=_0x2a3041,_0xbccf3e=_0x596e16[0x0],_0x5728ba=!_0xbccf3e&&!!_0x7597c5['parentSegment'],_0x1d5419=_0xbccf3e||_0x7597c5['parentSegment'];if(!_0x1d5419)return console[_0xa25dc6(0x10c)](_0xa25dc6(0x124)),console[_0xa25dc6(0x10c)](_0xa25dc6(0xc9)),console[_0xa25dc6(0x10c)](_0xa25dc6(0x109)),console[_0xa25dc6(0x10c)](_0xa25dc6(0xd2)),console[_0xa25dc6(0x10c)](_0xa25dc6(0xc8)),console[_0xa25dc6(0x10c)](_0xa25dc6(0xdf)),console['error'](_0xa25dc6(0xc2)),0x1;try{const _0x54c798=_0x7597c5[_0xa25dc6(0xdb)];let _0x2209e0=_0x1d5419;!_0x5728ba&&_0x54c798&&!_0x1d5419['includes']('/')&&(_0x2209e0=_0x54c798+'/'+_0x1d5419,_0x7597c5[_0xa25dc6(0xac)]&&console[_0xa25dc6(0x10c)](_0xa25dc6(0xee)+_0x2209e0));const _0x1714e9=await withSpinner(_0xa25dc6(0x93)+_0x2209e0+'\x27...',()=>_0x5a71a8[_0xa25dc6(0x111)][_0xa25dc6(0xd3)](_0x2209e0),{'verbose':_0x7597c5['verbose']}),_0x573894=_0x1714e9[_0xa25dc6(0xfd)];_0x7597c5[_0xa25dc6(0xac)]&&(console[_0xa25dc6(0x10c)]('Resolved\x20type:\x20'+_0x573894[_0xa25dc6(0xc7)]),console[_0xa25dc6(0x10c)](_0xa25dc6(0x131)+_0x573894['parentId']),_0x573894[_0xa25dc6(0x8f)]&&console[_0xa25dc6(0x10c)](_0xa25dc6(0xa5)+_0x573894['folderId']),_0x573894['segmentId']&&console[_0xa25dc6(0x10c)](_0xa25dc6(0xcc)+_0x573894[_0xa25dc6(0xf8)]));if(_0x573894[_0xa25dc6(0xc7)]===_0xa25dc6(0xc4)){const _0x291a4d=await withSpinner(_0xa25dc6(0xb0),()=>_0x5a71a8[_0xa25dc6(0x111)][_0xa25dc6(0x101)](_0x573894[_0xa25dc6(0x110)]),{'verbose':_0x7597c5[_0xa25dc6(0xac)]});await handleSingleObjectOutput(_0x291a4d[_0xa25dc6(0xfd)],_0x7597c5);}else{if(_0x573894[_0xa25dc6(0xc7)]===_0xa25dc6(0xe4)){if(!_0x573894[_0xa25dc6(0x8f)])throw new SDKError(ErrorCode[_0xa25dc6(0xa3)],_0xa25dc6(0xd1));const _0x21f17e=await withSpinner(_0xa25dc6(0x90),()=>_0x5a71a8[_0xa25dc6(0x111)]['getFolder'](_0x573894['folderId']),{'verbose':_0x7597c5[_0xa25dc6(0xac)]});await handleSingleObjectOutput(_0x21f17e[_0xa25dc6(0xfd)],_0x7597c5);}else{if(_0x573894[_0xa25dc6(0xc7)]===_0xa25dc6(0x111)){if(!_0x573894[_0xa25dc6(0xf8)])throw new SDKError(ErrorCode[_0xa25dc6(0x129)],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x308f4b=await withSpinner(_0xa25dc6(0xf7),()=>_0x5a71a8['segment'][_0xa25dc6(0xa1)](_0x573894[_0xa25dc6(0x110)],_0x573894[_0xa25dc6(0xf8)]),{'verbose':_0x7597c5['verbose']});await handleSingleObjectOutput(_0x308f4b[_0xa25dc6(0xfd)],_0x7597c5);}}}return 0x0;}catch(_0x4e18bc){if(_0x4e18bc instanceof SDKError)return console[_0xa25dc6(0x10c)](_0xa25dc6(0xa0)+_0x4e18bc[_0xa25dc6(0xfb)]),_0x4e18bc[_0xa25dc6(0xaf)]&&console['error'](_0xa25dc6(0x9b)+_0x4e18bc[_0xa25dc6(0xaf)]),0x1;throw _0x4e18bc;}}}export class SegmentShowCommand extends BaseCommand{[a37_0x522e52(0x10e)]='segment:show';[a37_0x522e52(0xf0)]='Execute\x20child\x20segment\x20SQL\x20query\x20and\x20show\x20results';async[a37_0x522e52(0x120)](_0x5d38ab){const _0x43c319=a37_0x522e52,{options:_0x8da0c7,args:_0x3705ba,tdx:_0x1c36ce}=_0x5d38ab,_0x40c021=_0x3705ba[0x0];if(!_0x40c021)return console[_0x43c319(0x10c)](_0x43c319(0xf2)),console[_0x43c319(0x10c)](_0x43c319(0xa2)),console[_0x43c319(0x10c)](_0x43c319(0xef)),console[_0x43c319(0x10c)](_0x43c319(0x109)),console[_0x43c319(0x10c)](_0x43c319(0x113)),console[_0x43c319(0x10c)]('\x20\x20tdx\x20sg\x20show\x20segments/my-audience/premium-users.yml'),0x1;try{const _0x11648b=_0x8da0c7['parentSegment'],_0x9d032c=await resolveSegmentTarget(_0x40c021,_0x11648b,_0x8da0c7[_0x43c319(0xac)]);_0x8da0c7[_0x43c319(0xac)]&&console[_0x43c319(0x10c)](_0x43c319(0xd8)+_0x9d032c);const _0xdb7295=await withSpinner(_0x43c319(0xca)+_0x40c021+'\x27...',()=>_0x1c36ce[_0x43c319(0x111)]['resolvePathToResource'](_0x9d032c),{'verbose':_0x8da0c7[_0x43c319(0xac)]}),_0x3a9226=_0xdb7295[_0x43c319(0xfd)];_0x8da0c7[_0x43c319(0xac)]&&(console[_0x43c319(0x10c)](_0x43c319(0xb4)+_0x3a9226[_0x43c319(0xc7)]),console['error'](_0x43c319(0x131)+_0x3a9226[_0x43c319(0x110)]));if(_0x3a9226['type']==='folder')return console[_0x43c319(0x10c)](_0x43c319(0xe0)),console['error'](_0x43c319(0x130)),0x1;if(_0x3a9226[_0x43c319(0xc7)]===_0x43c319(0xc4))return console['error']('Error:\x20Cannot\x20execute\x20query\x20for\x20parent\x20segment\x20with\x20this\x20command.'),console[_0x43c319(0x10c)]('Use:\x20tdx\x20ps\x20show'),0x1;if(!_0x3a9226['segmentId'])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x43c319(0x116));const _0xa07068=await withSpinner('Fetching\x20SQL\x20for\x20segment...',()=>_0x1c36ce[_0x43c319(0x111)][_0x43c319(0xd6)](_0x3a9226[_0x43c319(0x110)],_0x3a9226[_0x43c319(0xf8)]),{'verbose':_0x8da0c7[_0x43c319(0xac)]});let _0xda11d=_0xa07068[_0x43c319(0xfd)];const _0xea89da=resolveLimit(_0x8da0c7['limit'],DEFAULT_DISPLAY_LIMIT),_0x3f9385=/\bLIMIT\s+\d+/i['test'](_0xda11d);!_0x3f9385&&(_0xda11d=_0xda11d[_0x43c319(0x9a)]()[_0x43c319(0x118)](/;+$/,''),_0xda11d=_0x43c319(0xd5)+_0xda11d+_0x43c319(0x12c)+_0xea89da);_0x8da0c7[_0x43c319(0xac)]&&console['error'](_0x43c319(0x128)+_0xda11d);const _0x273dfc=await withProgressSpinner(_0x43c319(0x122),async _0x4c89fd=>{const _0x18807b=_0x43c319,_0x450b16=await _0x1c36ce['query'][_0x18807b(0x120)](_0xda11d,{'catalog':'td','schema':_0x18807b(0xde),'onJobId':_0x6cfa8c=>{const _0x5b418b=_0x18807b;_0x4c89fd[_0x5b418b(0xb3)](_0x6cfa8c);}});return _0x450b16;},{'verbose':_0x8da0c7[_0x43c319(0xac)]}),_0x175638=_0x273dfc[_0x43c319(0xfd)],_0x79f818=_0x175638['jobId']?_0x43c319(0xe1)+_0x175638[_0x43c319(0x10a)]+']':'';return console['error'](_0x43c319(0xf6)+_0x175638[_0x43c319(0xd0)]['processedRows'][_0x43c319(0xad)]()+'\x20rows\x20'+('in\x20'+formatElapsed(_0x175638[_0x43c319(0xd0)][_0x43c319(0x127)])+_0x79f818)),await handleQueryOutput(_0x175638,_0x8da0c7),0x0;}catch(_0x2003a7){if(_0x2003a7 instanceof SDKError)return console[_0x43c319(0x10c)]('✖\x20Query\x20failed\x20['+_0x2003a7[_0x43c319(0xcb)]+']'),console[_0x43c319(0x10c)]('\x0a'+_0x2003a7[_0x43c319(0xfb)]),0x1;throw _0x2003a7;}}}export class SegmentFolderListCommand extends BaseCommand{['name']='segment:folder:list';[a37_0x522e52(0xf0)]='List\x20segment\x20folders\x20under\x20a\x20parent\x20segment';async[a37_0x522e52(0x120)](_0x9825f0){const _0x5f53fb=a37_0x522e52,{options:_0x18159e,args:_0x49e795,tdx:_0x551bf8}=_0x9825f0;if(_0x49e795['length']===0x0)return console['error'](_0x5f53fb(0xf3)),console[_0x5f53fb(0x10c)](_0x5f53fb(0x125)),0x1;const _0x5c8bd0=_0x49e795[0x0];try{_0x18159e[_0x5f53fb(0xac)]&&(console['error'](_0x5f53fb(0x103)+_0x18159e['site']),console['error']('Parent\x20name:\x20'+_0x5c8bd0));const _0x5d5461=await withSpinner(_0x5f53fb(0x105)+_0x5c8bd0+_0x5f53fb(0xa8),()=>_0x551bf8[_0x5f53fb(0x111)]['resolveParentId'](_0x5c8bd0),{'verbose':_0x18159e[_0x5f53fb(0xac)]}),_0x2e0c74=_0x5d5461[_0x5f53fb(0xfd)];_0x18159e['verbose']&&console[_0x5f53fb(0x10c)](_0x5f53fb(0xf9)+_0x2e0c74);const _0x4db4ab=await withSpinner('Listing\x20folders\x20for\x20parent\x20\x27'+_0x5c8bd0+_0x5f53fb(0xa8),()=>_0x551bf8[_0x5f53fb(0x111)][_0x5f53fb(0x8e)](_0x2e0c74),{'verbose':_0x18159e['verbose']}),_0x2164c1=_0x4db4ab[_0x5f53fb(0xfd)];return console[_0x5f53fb(0x10c)](_0x5f53fb(0xf4)+_0x2164c1[_0x5f53fb(0xfa)]+_0x5f53fb(0x10d)+(_0x2164c1[_0x5f53fb(0xfa)]!==0x1?'s':'')),await handleSDKOutput(_0x2164c1,_0x18159e),0x0;}catch(_0x2013a1){if(_0x2013a1 instanceof SDKError)return console[_0x5f53fb(0x10c)]('Error:\x20'+_0x2013a1[_0x5f53fb(0xfb)]),_0x2013a1[_0x5f53fb(0xaf)]&&console['error'](_0x5f53fb(0x9b)+_0x2013a1[_0x5f53fb(0xaf)]),0x1;throw _0x2013a1;}}}export class SegmentFolderShowCommand extends BaseCommand{[a37_0x522e52(0x10e)]=a37_0x522e52(0x114);[a37_0x522e52(0xf0)]=a37_0x522e52(0x123);async[a37_0x522e52(0x120)](_0x1c95e0){const _0x3ea9bd=a37_0x522e52,{options:_0x5015ab,args:_0x3194b6,tdx:_0x1d7ba9}=_0x1c95e0;if(_0x3194b6[_0x3ea9bd(0xfa)]===0x0)return console[_0x3ea9bd(0x10c)](_0x3ea9bd(0x12e)),console[_0x3ea9bd(0x10c)](_0x3ea9bd(0x91)),0x1;try{const {parentId:_0x5ed1a8,childId:_0x5805d8}=parseSegmentRef(_0x3194b6[0x0]);_0x5015ab[_0x3ea9bd(0xac)]&&(console[_0x3ea9bd(0x10c)](_0x3ea9bd(0x103)+_0x5015ab[_0x3ea9bd(0x115)]),console['error'](_0x3ea9bd(0xea)+_0x5ed1a8),_0x5805d8&&console[_0x3ea9bd(0x10c)](_0x3ea9bd(0xc1)+_0x5805d8));if(!_0x5805d8)return console[_0x3ea9bd(0x10c)](_0x3ea9bd(0x94)),0x1;const _0x5edea1=await withSpinner(_0x3ea9bd(0x105)+_0x5ed1a8+_0x3ea9bd(0xa8),()=>_0x1d7ba9['segment'][_0x3ea9bd(0xbc)](_0x5ed1a8),{'verbose':_0x5015ab[_0x3ea9bd(0xac)]}),_0x517064=_0x5edea1[_0x3ea9bd(0xfd)];_0x5015ab[_0x3ea9bd(0xac)]&&console[_0x3ea9bd(0x10c)](_0x3ea9bd(0xf9)+_0x517064);const _0x1ab75b=await withSpinner('Resolving\x20folder\x20\x27'+_0x5805d8+_0x3ea9bd(0xa8),()=>_0x1d7ba9['segment'][_0x3ea9bd(0xec)](_0x517064,_0x5805d8),{'verbose':_0x5015ab[_0x3ea9bd(0xac)]}),_0x22ea3a=_0x1ab75b[_0x3ea9bd(0xfd)];_0x5015ab['verbose']&&console[_0x3ea9bd(0x10c)](_0x3ea9bd(0x12b)+_0x22ea3a);const _0x1a671f=await withSpinner(_0x3ea9bd(0x11e)+_0x5805d8+_0x3ea9bd(0xa8),()=>_0x1d7ba9[_0x3ea9bd(0x111)]['getFolder'](_0x22ea3a),{'verbose':_0x5015ab[_0x3ea9bd(0xac)]});return await handleSDKOutput([_0x1a671f[_0x3ea9bd(0xfd)]],_0x5015ab),0x0;}catch(_0x40a9be){if(_0x40a9be instanceof SDKError)return console[_0x3ea9bd(0x10c)](_0x3ea9bd(0xa0)+_0x40a9be['message']),_0x40a9be[_0x3ea9bd(0xaf)]&&console[_0x3ea9bd(0x10c)](_0x3ea9bd(0x9b)+_0x40a9be[_0x3ea9bd(0xaf)]),0x1;throw _0x40a9be;}}}export class SegmentSQLCommand extends BaseCommand{[a37_0x522e52(0x10e)]=a37_0x522e52(0xa6);[a37_0x522e52(0xf0)]=a37_0x522e52(0xd9);async[a37_0x522e52(0x120)](_0x3c9f8f){const _0x1aedf0=a37_0x522e52,{options:_0x4411e0,args:_0x556153}=_0x3c9f8f,_0x41c804=_0x4411e0,_0x3eee49=_0x41c804[_0x1aedf0(0xed)],_0x3b76ae=_0x556153[0x0];if(!_0x3b76ae&&!_0x3eee49)return console[_0x1aedf0(0x10c)](a37_0x1c799a[_0x1aedf0(0xfe)]('Error:\x20Segment\x20name\x20or\x20--path\x20is\x20required')),console[_0x1aedf0(0x10c)](_0x1aedf0(0x11b)),console[_0x1aedf0(0x10c)](_0x1aedf0(0x99)),console[_0x1aedf0(0x10c)](_0x1aedf0(0xe7)),console[_0x1aedf0(0x10c)](_0x1aedf0(0x109)),console[_0x1aedf0(0x10c)](_0x1aedf0(0xc5)),console[_0x1aedf0(0x10c)](_0x1aedf0(0xe2)),0x1;if(_0x3b76ae&&_0x3eee49)return console[_0x1aedf0(0x10c)](a37_0x1c799a[_0x1aedf0(0xfe)]('Error:\x20Specify\x20either\x20segment\x20name\x20or\x20--path,\x20not\x20both')),0x1;try{let _0x4933ba;if(_0x3eee49)_0x4933ba=await this['getSQLFromYamlFile'](_0x3eee49,_0x3c9f8f);else{if(isYamlFilePath(_0x3b76ae))return console[_0x1aedf0(0x10c)](a37_0x1c799a['red'](_0x1aedf0(0x9d))),console[_0x1aedf0(0x10c)](_0x1aedf0(0xbf)+_0x3b76ae),0x1;else _0x4933ba=await this['getSQLFromServerSegment'](_0x3b76ae,_0x3c9f8f);}return _0x4411e0[_0x1aedf0(0xe9)]==='json'||_0x4411e0[_0x1aedf0(0xe9)]===_0x1aedf0(0x95)?await handleSDKOutput([{'sql':_0x4933ba}],_0x4411e0):console[_0x1aedf0(0xe3)](_0x4933ba),0x0;}catch(_0x30dfea){if(_0x30dfea instanceof SDKError)return console[_0x1aedf0(0x10c)](_0x1aedf0(0xa0)+_0x30dfea[_0x1aedf0(0xfb)]),_0x30dfea[_0x1aedf0(0xaf)]&&console[_0x1aedf0(0x10c)](_0x1aedf0(0x9b)+_0x30dfea[_0x1aedf0(0xaf)]),0x1;throw _0x30dfea;}}async[a37_0x522e52(0xab)](_0x58834a,_0x5b2578){const _0x363fb7=a37_0x522e52,{options:_0x3593a4,tdx:_0x1830b3}=_0x5b2578;let _0xe57eda;try{_0xe57eda=await resolveYamlFilePath(_0x58834a);}catch(_0x29e2c1){throw new SDKError(ErrorCode[_0x363fb7(0xdd)],_0x363fb7(0x104)+_0x29e2c1[_0x363fb7(0xfb)]);}_0x3593a4['verbose']&&console[_0x363fb7(0x10c)](_0x363fb7(0xb5)+_0xe57eda[_0x363fb7(0xbd)]+'/'+_0xe57eda[_0x363fb7(0x98)]);const _0x408544=await withSpinner(_0x363fb7(0x92),()=>_0x1830b3[_0x363fb7(0x111)][_0x363fb7(0x102)](_0xe57eda[_0x363fb7(0x11a)],_0xe57eda[_0x363fb7(0xbd)],_0xe57eda[_0x363fb7(0x98)]),{'verbose':_0x3593a4[_0x363fb7(0xac)]});return _0x408544[_0x363fb7(0xfd)];}async[a37_0x522e52(0x108)](_0x1c831e,_0x4cd966){const _0x2b1a2e=a37_0x522e52,{options:_0x49160d,tdx:_0x249e04}=_0x4cd966,_0x183b87=_0x49160d[_0x2b1a2e(0xbd)],_0x9ce462=await resolveSegmentTarget(_0x1c831e,_0x183b87,_0x49160d[_0x2b1a2e(0xac)]);_0x49160d['verbose']&&console[_0x2b1a2e(0x10c)](_0x2b1a2e(0xd8)+_0x9ce462);const _0x37eb09=await withSpinner(_0x2b1a2e(0xca)+_0x1c831e+'\x27...',()=>_0x249e04[_0x2b1a2e(0x111)]['resolvePathToResource'](_0x9ce462),{'verbose':_0x49160d[_0x2b1a2e(0xac)]}),_0x1fd2ff=_0x37eb09[_0x2b1a2e(0xfd)];_0x49160d[_0x2b1a2e(0xac)]&&(console[_0x2b1a2e(0x10c)](_0x2b1a2e(0xb4)+_0x1fd2ff['type']),console[_0x2b1a2e(0x10c)](_0x2b1a2e(0x131)+_0x1fd2ff['parentId']));if(_0x1fd2ff[_0x2b1a2e(0xc7)]===_0x2b1a2e(0xe4))throw new SDKError(ErrorCode[_0x2b1a2e(0xdd)],_0x2b1a2e(0xe8));if(_0x1fd2ff[_0x2b1a2e(0xc7)]===_0x2b1a2e(0xc4))throw new SDKError(ErrorCode['INVALID_ARGUMENT'],'Cannot\x20get\x20SQL\x20for\x20parent\x20segment\x20with\x20this\x20command.\x20Use:\x20tdx\x20ps\x20sql');if(!_0x1fd2ff[_0x2b1a2e(0xf8)])throw new SDKError(ErrorCode[_0x2b1a2e(0x129)],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x4d4139=await withSpinner(_0x2b1a2e(0xcd),()=>_0x249e04[_0x2b1a2e(0x111)][_0x2b1a2e(0xd6)](_0x1fd2ff['parentId'],_0x1fd2ff[_0x2b1a2e(0xf8)]),{'verbose':_0x49160d['verbose']});return _0x4d4139[_0x2b1a2e(0xfd)];}}export class SegmentFolderCreateCommand extends BaseCommand{[a37_0x522e52(0x10e)]=a37_0x522e52(0xe6);[a37_0x522e52(0xf0)]=a37_0x522e52(0xc3);async['execute'](_0x44f07f){const _0x36ccc8=a37_0x522e52,{options:_0x30b6ec,args:_0x5dba10,tdx:_0x222c9c}=_0x44f07f,_0x3c6882=_0x30b6ec;if(_0x5dba10[_0x36ccc8(0xfa)]<0x2)return console[_0x36ccc8(0x10c)](_0x36ccc8(0x119)),console[_0x36ccc8(0x10c)](_0x36ccc8(0x11d)),0x1;const _0x3b8d97=_0x5dba10[0x0],_0x5a48c3=_0x5dba10[0x1];_0x3c6882[_0x36ccc8(0xac)]&&(console[_0x36ccc8(0x10c)](_0x36ccc8(0x103)+_0x3c6882[_0x36ccc8(0x115)]),console[_0x36ccc8(0x10c)]('Parent\x20segment:\x20'+_0x3b8d97),console['error']('Folder\x20name:\x20'+_0x5a48c3));let _0x5dc2dd;if(_0x3c6882[_0x36ccc8(0xd4)]){const _0x3c40b3=_0x3c6882[_0x36ccc8(0xd4)],_0x442b19=await withSpinner(_0x36ccc8(0x105)+_0x3b8d97+_0x36ccc8(0xa8),()=>_0x222c9c[_0x36ccc8(0x111)]['resolveParentId'](_0x3b8d97),{'verbose':_0x3c6882[_0x36ccc8(0xac)]}),_0x5325d3=_0x442b19[_0x36ccc8(0xfd)],_0x2dd73c=await withSpinner(_0x36ccc8(0xba)+_0x3c40b3+_0x36ccc8(0xa8),()=>_0x222c9c['segment'][_0x36ccc8(0xec)](_0x5325d3,_0x3c40b3),{'verbose':_0x3c6882[_0x36ccc8(0xac)]});_0x5dc2dd=_0x2dd73c['data'],_0x3c6882[_0x36ccc8(0xac)]&&console[_0x36ccc8(0x10c)](_0x36ccc8(0x97)+_0x5dc2dd);}const _0x230efa={'name':_0x5a48c3,'description':_0x3c6882[_0x36ccc8(0xf0)],'parentFolderId':_0x5dc2dd},_0x118210=await withSpinner('Creating\x20folder\x20\x27'+_0x5a48c3+_0x36ccc8(0xa8),()=>_0x222c9c[_0x36ccc8(0x111)][_0x36ccc8(0x9e)](_0x3b8d97,_0x230efa),{'verbose':_0x3c6882[_0x36ccc8(0xac)]}),_0x1e5209=_0x118210[_0x36ccc8(0xfd)];return console['error'](_0x36ccc8(0xdc)+_0x1e5209[_0x36ccc8(0x10e)]+'\x27\x20with\x20ID:\x20'+_0x1e5209['id']),await handleSDKOutput([_0x1e5209],_0x3c6882),0x0;}}export class SegmentViewCommand extends BaseCommand{[a37_0x522e52(0x10e)]=a37_0x522e52(0xf5);[a37_0x522e52(0xf0)]=a37_0x522e52(0x11c);async[a37_0x522e52(0x120)](_0x100921){const _0x2d909e=a37_0x522e52,{options:_0x4d78a7,args:_0x5df456,tdx:_0x5e6bd3}=_0x100921,_0xabf742=_0x5df456[0x0];if(!_0xabf742)return console[_0x2d909e(0x10c)](_0x2d909e(0xcf)),console[_0x2d909e(0x10c)]('Usage:\x20tdx\x20sg\x20view\x20<name>\x20[-w]'),console['error'](_0x2d909e(0x12d)),console[_0x2d909e(0x10c)]('Options:'),console[_0x2d909e(0x10c)]('\x20\x20-w,\x20--web\x20\x20Open\x20segment\x20in\x20web\x20browser'),console[_0x2d909e(0x10c)](_0x2d909e(0x109)),console[_0x2d909e(0x10c)](_0x2d909e(0xb2)),console['error']('\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20\x20\x20\x20\x20#\x20View\x20child\x20segment\x20details'),console[_0x2d909e(0x10c)](_0x2d909e(0xbe)),console[_0x2d909e(0x10c)](_0x2d909e(0xa7)),0x1;try{const _0x1b7698=_0x4d78a7[_0x2d909e(0xbd)],_0x53833d=await resolveSegmentTarget(_0xabf742,_0x1b7698,_0x4d78a7['verbose']);_0x4d78a7[_0x2d909e(0xac)]&&console[_0x2d909e(0x10c)](_0x2d909e(0xd8)+_0x53833d);const _0x1839cd=await withSpinner(_0x2d909e(0xca)+_0xabf742+_0x2d909e(0xa8),()=>_0x5e6bd3[_0x2d909e(0x111)][_0x2d909e(0xd3)](_0x53833d),{'verbose':_0x4d78a7['verbose']}),_0x3b92a2=_0x1839cd[_0x2d909e(0xfd)];_0x4d78a7[_0x2d909e(0xac)]&&(console[_0x2d909e(0x10c)](_0x2d909e(0xb4)+_0x3b92a2['type']),console['error'](_0x2d909e(0x131)+_0x3b92a2[_0x2d909e(0x110)]),_0x3b92a2[_0x2d909e(0x8f)]&&console[_0x2d909e(0x10c)](_0x2d909e(0xa5)+_0x3b92a2[_0x2d909e(0x8f)]),_0x3b92a2[_0x2d909e(0xf8)]&&console[_0x2d909e(0x10c)](_0x2d909e(0xcc)+_0x3b92a2[_0x2d909e(0xf8)]));if(_0x4d78a7[_0x2d909e(0x107)]){if(_0x3b92a2[_0x2d909e(0xc7)]===_0x2d909e(0xe4))return console[_0x2d909e(0x10c)]('Error:\x20Cannot\x20open\x20folder\x20in\x20web\x20browser.\x20Use\x20a\x20segment\x20name\x20instead.'),0x1;if(_0x3b92a2['type']===_0x2d909e(0xc4))return console[_0x2d909e(0x10c)]('Error:\x20Cannot\x20open\x20parent\x20segment\x20with\x20this\x20command.'),console['error'](_0x2d909e(0xe5)),0x1;if(!_0x3b92a2[_0x2d909e(0xf8)])throw new SDKError(ErrorCode[_0x2d909e(0x129)],_0x2d909e(0x116));const _0x241036=getConsoleNextUrl(_0x4d78a7['site'],_0x2d909e(0xda)+_0x3b92a2[_0x2d909e(0x110)]+_0x2d909e(0x106)+_0x3b92a2['segmentId']);return console['error'](a37_0x1c799a[_0x2d909e(0xff)]('✔')+_0x2d909e(0x112)+a37_0x1c799a[_0x2d909e(0x10b)](_0x241036)),openBrowser(_0x241036),0x0;}if(_0x3b92a2[_0x2d909e(0xc7)]===_0x2d909e(0xe4)){if(!_0x3b92a2[_0x2d909e(0x8f)])throw new SDKError(ErrorCode['SEGMENT_FOLDER_NOT_FOUND'],_0x2d909e(0xd1));const _0x5464cb=await withSpinner(_0x2d909e(0x90),()=>_0x5e6bd3[_0x2d909e(0x111)][_0x2d909e(0x100)](_0x3b92a2[_0x2d909e(0x8f)]),{'verbose':_0x4d78a7[_0x2d909e(0xac)]});await handleSingleObjectOutput(_0x5464cb['data'],_0x4d78a7);}else{if(_0x3b92a2[_0x2d909e(0xc7)]==='segment'){if(!_0x3b92a2[_0x2d909e(0xf8)])throw new SDKError(ErrorCode[_0x2d909e(0x129)],_0x2d909e(0x116));const _0x261a7c=await withSpinner(_0x2d909e(0xf7),()=>_0x5e6bd3[_0x2d909e(0x111)][_0x2d909e(0xa1)](_0x3b92a2['parentId'],_0x3b92a2[_0x2d909e(0xf8)]),{'verbose':_0x4d78a7[_0x2d909e(0xac)]}),_0x1314bc=getConsoleNextUrl(_0x4d78a7['site'],_0x2d909e(0xda)+_0x3b92a2['parentId']+_0x2d909e(0x106)+_0x3b92a2[_0x2d909e(0xf8)]),_0x1b8452=_0x261a7c[_0x2d909e(0xfd)];_0x1b8452[_0x2d909e(0xa4)]=_0x1314bc,await handleSingleObjectOutput(_0x1b8452,_0x4d78a7);}else return console[_0x2d909e(0x10c)](_0x2d909e(0xb7)),console[_0x2d909e(0x10c)](_0x2d909e(0xd7)),0x1;}return 0x0;}catch(_0x5648d7){if(_0x5648d7 instanceof SDKError)return console[_0x2d909e(0x10c)](_0x2d909e(0xa0)+_0x5648d7[_0x2d909e(0xfb)]),_0x5648d7['cause']&&console[_0x2d909e(0x10c)](_0x2d909e(0x9b)+_0x5648d7['cause']),0x1;throw _0x5648d7;}}}export const SegmentInfoCommand=SegmentViewCommand;export class SegmentDescCommand extends BaseCommand{[a37_0x522e52(0x10e)]=a37_0x522e52(0x12a);[a37_0x522e52(0xf0)]=a37_0x522e52(0xb9);async[a37_0x522e52(0x120)](_0x57dbcf){const _0x138dac=a37_0x522e52,{options:_0x330d9e,args:_0x4de30c,tdx:_0x17306c}=_0x57dbcf,_0x1bbbb6=_0x4de30c[0x0];if(!_0x1bbbb6)return console['error'](_0x138dac(0xf2)),console[_0x138dac(0x10c)](_0x138dac(0xa9)),console[_0x138dac(0x10c)]('\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20desc\x20<path/to/segment.yml>'),console['error'](_0x138dac(0x109)),console[_0x138dac(0x10c)](_0x138dac(0xbb)),console[_0x138dac(0x10c)](_0x138dac(0xf1)),0x1;try{const _0x115f2f=_0x330d9e[_0x138dac(0xbd)],_0x3beadf=await resolveSegmentTarget(_0x1bbbb6,_0x115f2f,_0x330d9e['verbose']);_0x330d9e['verbose']&&console['error'](_0x138dac(0xd8)+_0x3beadf);const _0x2791bd=await withSpinner(_0x138dac(0xca)+_0x1bbbb6+_0x138dac(0xa8),()=>_0x17306c[_0x138dac(0x111)][_0x138dac(0xd3)](_0x3beadf),{'verbose':_0x330d9e[_0x138dac(0xac)]}),_0x5eda64=_0x2791bd[_0x138dac(0xfd)];_0x330d9e[_0x138dac(0xac)]&&(console[_0x138dac(0x10c)]('Resolved\x20type:\x20'+_0x5eda64[_0x138dac(0xc7)]),console[_0x138dac(0x10c)]('Parent\x20ID:\x20'+_0x5eda64[_0x138dac(0x110)]));if(_0x5eda64[_0x138dac(0xc7)]===_0x138dac(0xe4))return console['error'](_0x138dac(0x96)),console[_0x138dac(0x10c)]('Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.'),0x1;if(_0x5eda64[_0x138dac(0xc7)]===_0x138dac(0xc4))return console['error'](_0x138dac(0xce)),console['error']('Use:\x20tdx\x20ps\x20desc'),0x1;if(!_0x5eda64[_0x138dac(0xf8)])throw new SDKError(ErrorCode[_0x138dac(0x129)],_0x138dac(0x116));const _0x5e24e0=await withSpinner(_0x138dac(0xcd),()=>_0x17306c[_0x138dac(0x111)][_0x138dac(0xd6)](_0x5eda64['parentId'],_0x5eda64[_0x138dac(0xf8)]),{'verbose':_0x330d9e[_0x138dac(0xac)]}),_0xfc3686=_0x5e24e0[_0x138dac(0xfd)],_0x353bd7=await executeSchemaQuery(_0xfc3686,_0x17306c,_0x330d9e);return await handleQueryOutput(_0x353bd7,_0x330d9e),0x0;}catch(_0x20fd0a){if(_0x20fd0a instanceof SDKError)return console[_0x138dac(0x10c)](_0x138dac(0xa0)+_0x20fd0a[_0x138dac(0xfb)]),_0x20fd0a['cause']&&console[_0x138dac(0x10c)](_0x138dac(0x9b)+_0x20fd0a[_0x138dac(0xaf)]),0x1;throw _0x20fd0a;}}}
@@ -1 +1 @@
1
- const a38_0x5ab55e=a38_0x10de;(function(_0x220184,_0x5865a5){const _0x277364=a38_0x10de,_0x356a01=_0x220184();while(!![]){try{const _0x2dc255=parseInt(_0x277364(0x134))/0x1+parseInt(_0x277364(0x142))/0x2*(-parseInt(_0x277364(0x127))/0x3)+-parseInt(_0x277364(0x130))/0x4*(-parseInt(_0x277364(0x152))/0x5)+-parseInt(_0x277364(0x153))/0x6+-parseInt(_0x277364(0x145))/0x7*(parseInt(_0x277364(0x147))/0x8)+parseInt(_0x277364(0x133))/0x9+-parseInt(_0x277364(0x12a))/0xa;if(_0x2dc255===_0x5865a5)break;else _0x356a01['push'](_0x356a01['shift']());}catch(_0x258a10){_0x356a01['push'](_0x356a01['shift']());}}}(a38_0x5263,0xd5fca));import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../core/command-output.js';function a38_0x10de(_0x3dbd1b,_0x5aff3d){_0x3dbd1b=_0x3dbd1b-0x121;const _0x526302=a38_0x5263();let _0x10dec2=_0x526302[_0x3dbd1b];return _0x10dec2;}import{withSpinner}from'../utils/spinner.js';function a38_0x5263(){const _0x363ad6=['82YGiAvN','rule','Usage:\x20tdx\x20segment\x20create\x20<parent/segment_name>\x20[options]','133644fTGnNE','Parent\x20path:\x20','72lAWeMn','name','folder','Usage:\x20tdx\x20segment\x20create\x20<path>\x20[options]','Site:\x20','Resolved\x20relative\x20path\x20to:\x20','Segment\x20name:\x20','Error:\x20Cannot\x20create\x20segment\x20in\x20a\x20segment.\x20Parent\x20path\x20must\x20be\x20a\x20folder\x20or\x20parent.','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/Marketing/Premium\x22\x20--rule\x20\x27...\x27','Create\x20child\x20segment\x20with\x20filtering\x20rules','error','3483885XUWCXH','2658450liWGNh','length','\x27...','Resolved\x20folder\x20ID:\x20','data','createSegment','kind','verbose','103134ZeYECL','ruleFile','yellow','2382730WfCfpI','Parent:\x20','resolveParentId','invisible','Error:\x20Full\x20path\x20required\x20(parent/segment_name\x20or\x20parent/folder/segment_name)','\x20\x20tdx\x20segment\x20create\x20\x22Premium\x22\x20--rule\x20\x27...\x27\x20\x20#\x20Relative\x20to\x20context','4dmsKrv','Creating\x20segment\x20\x27','segment','6604497qSXIuT','1708554qIeFpI','segmentPath','resolveFolderId','resolvePathToResource','\x20\x20\x20Path:\x20','segments','description','segment:create','execute','type','site','Resolving\x20folder\x20path\x20\x27','✔\x20Created\x20segment\x20\x27','parent'];a38_0x5263=function(){return _0x363ad6;};return a38_0x5263();}import{loadJSONFromOptions}from'../utils/json-loader.js';import{parsePath,getParentPath,getBaseName}from'../sdk/segment/segment-path-parser.js';import a38_0x1fab2c from'chalk';export class SegmentCreateCommand extends BaseCommand{['name']=a38_0x5ab55e(0x13b);[a38_0x5ab55e(0x13a)]=a38_0x5ab55e(0x150);async[a38_0x5ab55e(0x13c)](_0x538d94){const _0x471f75=a38_0x5ab55e;console[_0x471f75(0x151)](a38_0x1fab2c[_0x471f75(0x129)]('⚠\x20Deprecation\x20warning:\x20`segment\x20create`\x20is\x20deprecated.')),console[_0x471f75(0x151)](a38_0x1fab2c['yellow']('\x20\x20Use\x20`tdx\x20sg\x20push`\x20with\x20YAML\x20files\x20instead.\x0a'));const {options:_0x206966,args:_0x19da1f,tdx:_0x1925a4}=_0x538d94,_0x1bed9c=_0x206966;if(_0x19da1f[_0x471f75(0x154)]===0x0)return console['error']('Error:\x20Segment\x20path\x20or\x20name\x20is\x20required'),console[_0x471f75(0x151)](_0x471f75(0x14a)),console[_0x471f75(0x151)]('Examples:'),console[_0x471f75(0x151)]('\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/High\x20Value\x22\x20--rule\x20\x27...\x27'),console[_0x471f75(0x151)](_0x471f75(0x14f)),console[_0x471f75(0x151)](_0x471f75(0x12f)),0x1;const _0x25f09e=_0x19da1f[0x0],_0x291115=_0x206966[_0x471f75(0x135)];let _0x335786=_0x25f09e;_0x291115&&!_0x25f09e['includes']('/')&&(_0x335786=_0x291115+'/'+_0x25f09e,_0x1bed9c[_0x471f75(0x126)]&&console['error'](_0x471f75(0x14c)+_0x335786));const _0x392334=parsePath(_0x335786);if(_0x392334['segments'][_0x471f75(0x154)]<0x2)return console[_0x471f75(0x151)](_0x471f75(0x12e)),console[_0x471f75(0x151)](_0x471f75(0x144)),0x1;const _0x5221af=_0x392334[_0x471f75(0x139)][0x0],_0x52d996=getBaseName(_0x335786),_0xbcc63=getParentPath(_0x335786);_0x1bed9c[_0x471f75(0x126)]&&(console[_0x471f75(0x151)](_0x471f75(0x14b)+_0x1bed9c[_0x471f75(0x13e)]),console[_0x471f75(0x151)]('Target\x20path:\x20'+_0x335786),console[_0x471f75(0x151)](_0x471f75(0x12b)+_0x5221af),console[_0x471f75(0x151)](_0x471f75(0x14d)+_0x52d996),console[_0x471f75(0x151)](_0x471f75(0x146)+_0xbcc63));const _0x2a034e=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x5221af+_0x471f75(0x121),()=>_0x1925a4[_0x471f75(0x132)][_0x471f75(0x12c)](_0x5221af),{'verbose':_0x1bed9c['verbose']}),_0xa8f832=_0x2a034e[_0x471f75(0x123)];let _0x499ddf;if(_0x392334[_0x471f75(0x139)][_0x471f75(0x154)]>0x2){const _0x968ddd=await withSpinner(_0x471f75(0x13f)+_0xbcc63+_0x471f75(0x121),()=>_0x1925a4[_0x471f75(0x132)][_0x471f75(0x137)](_0xbcc63),{'verbose':_0x1bed9c['verbose']}),_0x43c24d=_0x968ddd['data'];if(_0x43c24d[_0x471f75(0x13d)]!==_0x471f75(0x149)&&_0x43c24d[_0x471f75(0x13d)]!==_0x471f75(0x141))return console[_0x471f75(0x151)](_0x471f75(0x14e)),0x1;_0x499ddf=_0x43c24d['folderId'];}else{if(_0x1bed9c[_0x471f75(0x149)]){const _0x14bd57=await withSpinner('Resolving\x20folder\x20\x27'+_0x1bed9c[_0x471f75(0x149)]+'\x27...',()=>_0x1925a4[_0x471f75(0x132)][_0x471f75(0x136)](_0xa8f832,_0x1bed9c[_0x471f75(0x149)]),{'verbose':_0x1bed9c[_0x471f75(0x126)]});_0x499ddf=_0x14bd57[_0x471f75(0x123)];}}_0x1bed9c[_0x471f75(0x126)]&&_0x499ddf&&console[_0x471f75(0x151)](_0x471f75(0x122)+_0x499ddf);const _0x11ec2e=await loadJSONFromOptions(_0x1bed9c[_0x471f75(0x143)],_0x1bed9c[_0x471f75(0x128)]),_0x2abb35={'name':_0x52d996,'description':_0x1bed9c[_0x471f75(0x13a)],'rule':_0x11ec2e,'kind':_0x1bed9c['kind']!==undefined?parseInt(_0x1bed9c[_0x471f75(0x125)],0xa):undefined,'isVisible':_0x1bed9c[_0x471f75(0x12d)]?![]:undefined,'segmentFolderId':_0x499ddf,'countPopulation':_0x1bed9c['noCountPopulation']?![]:undefined},_0x527b2b=await withSpinner(_0x471f75(0x131)+_0x52d996+_0x471f75(0x121),()=>_0x1925a4[_0x471f75(0x132)][_0x471f75(0x124)](_0xa8f832,_0x2abb35),{'verbose':_0x1bed9c[_0x471f75(0x126)]}),_0x1ed751=_0x527b2b[_0x471f75(0x123)];return console[_0x471f75(0x151)](_0x471f75(0x140)+_0x1ed751[_0x471f75(0x148)]+'\x27\x20with\x20ID:\x20'+_0x1ed751['id']),_0x335786!==_0x25f09e&&console['error'](_0x471f75(0x138)+_0x335786),await handleSDKOutput([_0x1ed751],_0x1bed9c),0x0;}}
1
+ const a38_0x52849f=a38_0x1769;(function(_0x3ea607,_0x44e12d){const _0x4df86d=a38_0x1769,_0x257e02=_0x3ea607();while(!![]){try{const _0x3dd037=-parseInt(_0x4df86d(0x14a))/0x1+parseInt(_0x4df86d(0x12e))/0x2+parseInt(_0x4df86d(0x12d))/0x3*(parseInt(_0x4df86d(0x144))/0x4)+parseInt(_0x4df86d(0x134))/0x5+parseInt(_0x4df86d(0x152))/0x6*(parseInt(_0x4df86d(0x136))/0x7)+parseInt(_0x4df86d(0x129))/0x8+-parseInt(_0x4df86d(0x14e))/0x9*(parseInt(_0x4df86d(0x140))/0xa);if(_0x3dd037===_0x44e12d)break;else _0x257e02['push'](_0x257e02['shift']());}catch(_0x471ac4){_0x257e02['push'](_0x257e02['shift']());}}}(a38_0x351a,0x6b03e));import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../core/command-output.js';function a38_0x1769(_0x53c33a,_0x514f4e){_0x53c33a=_0x53c33a-0x11e;const _0x351a5d=a38_0x351a();let _0x176907=_0x351a5d[_0x53c33a];return _0x176907;}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_0x19e22e from'chalk';export class SegmentCreateCommand extends BaseCommand{[a38_0x52849f(0x124)]=a38_0x52849f(0x147);[a38_0x52849f(0x13a)]=a38_0x52849f(0x14b);async[a38_0x52849f(0x132)](_0x24fe62){const _0x1e06b6=a38_0x52849f;console[_0x1e06b6(0x14f)](a38_0x19e22e['yellow'](_0x1e06b6(0x122))),console[_0x1e06b6(0x14f)](a38_0x19e22e[_0x1e06b6(0x131)](_0x1e06b6(0x12a)));const {options:_0x56cbb5,args:_0x34e063,tdx:_0x4ddecc}=_0x24fe62,_0x10d08e=_0x56cbb5;if(_0x34e063[_0x1e06b6(0x151)]===0x0)return console[_0x1e06b6(0x14f)]('Error:\x20Segment\x20path\x20or\x20name\x20is\x20required'),console[_0x1e06b6(0x14f)](_0x1e06b6(0x12b)),console[_0x1e06b6(0x14f)](_0x1e06b6(0x126)),console[_0x1e06b6(0x14f)](_0x1e06b6(0x11e)),console[_0x1e06b6(0x14f)](_0x1e06b6(0x13f)),console[_0x1e06b6(0x14f)](_0x1e06b6(0x141)),0x1;const _0x132e55=_0x34e063[0x0],_0x28afbb=_0x56cbb5['segmentPath'];let _0x41f295=_0x132e55;_0x28afbb&&!_0x132e55[_0x1e06b6(0x130)]('/')&&(_0x41f295=_0x28afbb+'/'+_0x132e55,_0x10d08e[_0x1e06b6(0x12f)]&&console[_0x1e06b6(0x14f)](_0x1e06b6(0x150)+_0x41f295));const _0x2e2cae=parsePath(_0x41f295);if(_0x2e2cae['segments'][_0x1e06b6(0x151)]<0x2)return console['error']('Error:\x20Full\x20path\x20required\x20(parent/segment_name\x20or\x20parent/folder/segment_name)'),console['error']('Usage:\x20tdx\x20segment\x20create\x20<parent/segment_name>\x20[options]'),0x1;const _0x569113=_0x2e2cae[_0x1e06b6(0x13d)][0x0],_0x4b3dd0=getBaseName(_0x41f295),_0x4b61fe=getParentPath(_0x41f295);_0x10d08e[_0x1e06b6(0x12f)]&&(console[_0x1e06b6(0x14f)](_0x1e06b6(0x138)+_0x10d08e[_0x1e06b6(0x127)]),console['error'](_0x1e06b6(0x142)+_0x41f295),console[_0x1e06b6(0x14f)](_0x1e06b6(0x148)+_0x569113),console[_0x1e06b6(0x14f)](_0x1e06b6(0x13e)+_0x4b3dd0),console[_0x1e06b6(0x14f)]('Parent\x20path:\x20'+_0x4b61fe));const _0x2cef77=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x569113+_0x1e06b6(0x121),()=>_0x4ddecc[_0x1e06b6(0x143)][_0x1e06b6(0x149)](_0x569113),{'verbose':_0x10d08e[_0x1e06b6(0x12f)]}),_0x155f0f=_0x2cef77[_0x1e06b6(0x123)];let _0xe2757a;if(_0x2e2cae['segments'][_0x1e06b6(0x151)]>0x2){const _0x485f54=await withSpinner(_0x1e06b6(0x12c)+_0x4b61fe+'\x27...',()=>_0x4ddecc['segment']['resolvePathToResource'](_0x4b61fe),{'verbose':_0x10d08e['verbose']}),_0x32c4c4=_0x485f54['data'];if(_0x32c4c4[_0x1e06b6(0x13c)]!==_0x1e06b6(0x128)&&_0x32c4c4[_0x1e06b6(0x13c)]!==_0x1e06b6(0x135))return console[_0x1e06b6(0x14f)]('Error:\x20Cannot\x20create\x20segment\x20in\x20a\x20segment.\x20Parent\x20path\x20must\x20be\x20a\x20folder\x20or\x20parent.'),0x1;_0xe2757a=_0x32c4c4[_0x1e06b6(0x146)];}else{if(_0x10d08e[_0x1e06b6(0x128)]){const _0x51b01c=await withSpinner(_0x1e06b6(0x145)+_0x10d08e[_0x1e06b6(0x128)]+_0x1e06b6(0x121),()=>_0x4ddecc[_0x1e06b6(0x143)][_0x1e06b6(0x14d)](_0x155f0f,_0x10d08e[_0x1e06b6(0x128)]),{'verbose':_0x10d08e['verbose']});_0xe2757a=_0x51b01c['data'];}}_0x10d08e[_0x1e06b6(0x12f)]&&_0xe2757a&&console[_0x1e06b6(0x14f)](_0x1e06b6(0x125)+_0xe2757a);const _0x3be309=await loadJSONFromOptions(_0x10d08e['rule'],_0x10d08e[_0x1e06b6(0x13b)]),_0x3228d7={'name':_0x4b3dd0,'description':_0x10d08e[_0x1e06b6(0x13a)],'rule':_0x3be309,'kind':_0x10d08e[_0x1e06b6(0x139)]!==undefined?parseInt(_0x10d08e[_0x1e06b6(0x139)],0xa):undefined,'isVisible':_0x10d08e['invisible']?![]:undefined,'segmentFolderId':_0xe2757a,'countPopulation':_0x10d08e[_0x1e06b6(0x137)]?![]:undefined},_0xadfd8b=await withSpinner('Creating\x20segment\x20\x27'+_0x4b3dd0+_0x1e06b6(0x121),()=>_0x4ddecc[_0x1e06b6(0x143)][_0x1e06b6(0x11f)](_0x155f0f,_0x3228d7),{'verbose':_0x10d08e[_0x1e06b6(0x12f)]}),_0x29f014=_0xadfd8b[_0x1e06b6(0x123)];return console[_0x1e06b6(0x14f)](_0x1e06b6(0x14c)+_0x29f014[_0x1e06b6(0x124)]+_0x1e06b6(0x120)+_0x29f014['id']),_0x41f295!==_0x132e55&&console['error'](_0x1e06b6(0x133)+_0x41f295),await handleSDKOutput([_0x29f014],_0x10d08e),0x0;}}function a38_0x351a(){const _0x322be6=['4whVHMO','Resolving\x20folder\x20\x27','folderId','segment:create','Parent:\x20','resolveParentId','356694mLjQAE','Create\x20child\x20segment\x20with\x20filtering\x20rules','✔\x20Created\x20segment\x20\x27','resolveFolderId','1422rBODau','error','Resolved\x20relative\x20path\x20to:\x20','length','77358yHUPBO','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/High\x20Value\x22\x20--rule\x20\x27...\x27','createSegment','\x27\x20with\x20ID:\x20','\x27...','⚠\x20Deprecation\x20warning:\x20`segment\x20create`\x20is\x20deprecated.','data','name','Resolved\x20folder\x20ID:\x20','Examples:','site','folder','3359816BTmnky','\x20\x20Use\x20`tdx\x20sg\x20push`\x20with\x20YAML\x20files\x20instead.\x0a','Usage:\x20tdx\x20segment\x20create\x20<path>\x20[options]','Resolving\x20folder\x20path\x20\x27','1533654pDZWWx','1270728aaxCPR','verbose','includes','yellow','execute','\x20\x20\x20Path:\x20','4139820SFeEyK','parent','77BuQXxe','noCountPopulation','Site:\x20','kind','description','ruleFile','type','segments','Segment\x20name:\x20','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/Marketing/Premium\x22\x20--rule\x20\x27...\x27','110210fJkRRk','\x20\x20tdx\x20segment\x20create\x20\x22Premium\x22\x20--rule\x20\x27...\x27\x20\x20#\x20Relative\x20to\x20context','Target\x20path:\x20','segment'];a38_0x351a=function(){return _0x322be6;};return a38_0x351a();}
@@ -1 +1 @@
1
- const a39_0x2bade0=a39_0x33f2;(function(_0x4ce14f,_0x4b58b9){const _0x59d635=a39_0x33f2,_0x3e4cd2=_0x4ce14f();while(!![]){try{const _0x3efde5=parseInt(_0x59d635(0x184))/0x1*(parseInt(_0x59d635(0x187))/0x2)+-parseInt(_0x59d635(0x172))/0x3+parseInt(_0x59d635(0x178))/0x4*(parseInt(_0x59d635(0x16e))/0x5)+-parseInt(_0x59d635(0x16c))/0x6+-parseInt(_0x59d635(0x186))/0x7*(parseInt(_0x59d635(0x185))/0x8)+-parseInt(_0x59d635(0x16d))/0x9+parseInt(_0x59d635(0x170))/0xa;if(_0x3efde5===_0x4b58b9)break;else _0x3e4cd2['push'](_0x3e4cd2['shift']());}catch(_0x15f664){_0x3e4cd2['push'](_0x3e4cd2['shift']());}}}(a39_0x41df,0x330ff));function a39_0x33f2(_0x5aa5f9,_0x26f656){_0x5aa5f9=_0x5aa5f9-0x16c;const _0x41df02=a39_0x41df();let _0x33f29a=_0x41df02[_0x5aa5f9];return _0x33f29a;}import{BaseCommand}from'./command.js';function a39_0x41df(){const _0x444b4c=['365412WvLToa','346860RNYwng','4150RazoEe','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','1431260iFgIzm','segment:fields','281223zHJJAm','List\x20available\x20fields\x20for\x20segmentation','Parent\x20segment:\x20','Site:\x20','Listing\x20fields\x20for\x20\x27','parentSegment','1496thwBHL','error','length','json','listFields','segment','\x20field','verbose','description','name','data','\x27...','67yErZmi','8sJSOlJ','2401917DaieKe','8714tbsPCI','Usage:\x20tdx\x20segment\x20fields\x20<parent_name>','Error:\x20Parent\x20segment\x20name\x20is\x20required','site','✔\x20Found\x20'];a39_0x41df=function(){return _0x444b4c;};return a39_0x41df();}import{handleSDKOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import{displayFieldsHumanReadable}from'../sdk/segment/fields-display.js';export class SegmentFieldsCommand extends BaseCommand{[a39_0x2bade0(0x181)]=a39_0x2bade0(0x171);[a39_0x2bade0(0x180)]=a39_0x2bade0(0x173);async['execute'](_0x1a3268){const _0x2e639a=a39_0x2bade0,{options:_0x5b369f,args:_0x1af08f,tdx:_0xc68279}=_0x1a3268,_0x59736c=_0x1af08f[0x0]||_0x5b369f[_0x2e639a(0x177)];if(!_0x59736c)return console['error'](_0x2e639a(0x189)),console[_0x2e639a(0x179)](_0x2e639a(0x188)),console[_0x2e639a(0x179)](_0x2e639a(0x16f)),0x1;_0x5b369f['verbose']&&(console[_0x2e639a(0x179)](_0x2e639a(0x175)+_0x5b369f[_0x2e639a(0x18a)]),console[_0x2e639a(0x179)](_0x2e639a(0x174)+_0x59736c));const _0x46351c=await withSpinner(_0x2e639a(0x176)+_0x59736c+_0x2e639a(0x183),()=>_0xc68279[_0x2e639a(0x17d)][_0x2e639a(0x17c)](_0x59736c),{'verbose':_0x5b369f[_0x2e639a(0x17f)]}),_0xeb3a6=_0x46351c[_0x2e639a(0x182)];console[_0x2e639a(0x179)](_0x2e639a(0x18b)+_0xeb3a6[_0x2e639a(0x17a)]+_0x2e639a(0x17e)+(_0xeb3a6[_0x2e639a(0x17a)]!==0x1?'s':''));if(_0x5b369f[_0x2e639a(0x17b)]||_0x5b369f['jsonl'])return await handleSDKOutput(_0xeb3a6,_0x5b369f),0x0;return displayFieldsHumanReadable(_0xeb3a6,_0x59736c),0x0;}}
1
+ const a39_0xc7461=a39_0x6615;(function(_0x23ea50,_0x34ec67){const _0x25ce8b=a39_0x6615,_0x291e8d=_0x23ea50();while(!![]){try{const _0x551e99=parseInt(_0x25ce8b(0x13f))/0x1+-parseInt(_0x25ce8b(0x140))/0x2*(parseInt(_0x25ce8b(0x135))/0x3)+parseInt(_0x25ce8b(0x14a))/0x4+-parseInt(_0x25ce8b(0x13a))/0x5+parseInt(_0x25ce8b(0x148))/0x6*(parseInt(_0x25ce8b(0x152))/0x7)+-parseInt(_0x25ce8b(0x142))/0x8*(parseInt(_0x25ce8b(0x13d))/0x9)+parseInt(_0x25ce8b(0x153))/0xa*(parseInt(_0x25ce8b(0x137))/0xb);if(_0x551e99===_0x34ec67)break;else _0x291e8d['push'](_0x291e8d['shift']());}catch(_0x44671a){_0x291e8d['push'](_0x291e8d['shift']());}}}(a39_0x1159,0x23ea6));import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';function a39_0x6615(_0x1967a9,_0x190012){_0x1967a9=_0x1967a9-0x134;const _0x115966=a39_0x1159();let _0x6615ec=_0x115966[_0x1967a9];return _0x6615ec;}import{displayFieldsHumanReadable}from'../sdk/segment/fields-display.js';function a39_0x1159(){const _0x43b825=['Site:\x20','3dfikbF','\x27...','66XHsUxY','json','execute','617655GYGYsU','Error:\x20Parent\x20segment\x20name\x20is\x20required','Listing\x20fields\x20for\x20\x27','180gAACcP','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','172112bTRlxE','431094JuDPHA','site','70192lMSlfB','✔\x20Found\x20','Parent\x20segment:\x20','verbose','length','data','36qpzbno','name','673600HFuKTg','\x20field','jsonl','segment','error','listFields','List\x20available\x20fields\x20for\x20segmentation','description','158669vgcrhW','308590NLCCVt'];a39_0x1159=function(){return _0x43b825;};return a39_0x1159();}export class SegmentFieldsCommand extends BaseCommand{[a39_0xc7461(0x149)]='segment:fields';[a39_0xc7461(0x151)]=a39_0xc7461(0x150);async[a39_0xc7461(0x139)](_0xcef418){const _0x3eb763=a39_0xc7461,{options:_0x466f46,args:_0x3c3845,tdx:_0x13a9c2}=_0xcef418,_0x4eb9af=_0x3c3845[0x0]||_0x466f46['parentSegment'];if(!_0x4eb9af)return console[_0x3eb763(0x14e)](_0x3eb763(0x13b)),console[_0x3eb763(0x14e)]('Usage:\x20tdx\x20segment\x20fields\x20<parent_name>'),console[_0x3eb763(0x14e)](_0x3eb763(0x13e)),0x1;_0x466f46['verbose']&&(console[_0x3eb763(0x14e)](_0x3eb763(0x134)+_0x466f46[_0x3eb763(0x141)]),console[_0x3eb763(0x14e)](_0x3eb763(0x144)+_0x4eb9af));const _0x359681=await withSpinner(_0x3eb763(0x13c)+_0x4eb9af+_0x3eb763(0x136),()=>_0x13a9c2[_0x3eb763(0x14d)][_0x3eb763(0x14f)](_0x4eb9af),{'verbose':_0x466f46[_0x3eb763(0x145)]}),_0x59f9e5=_0x359681[_0x3eb763(0x147)];console['error'](_0x3eb763(0x143)+_0x59f9e5[_0x3eb763(0x146)]+_0x3eb763(0x14b)+(_0x59f9e5[_0x3eb763(0x146)]!==0x1?'s':''));if(_0x466f46[_0x3eb763(0x138)]||_0x466f46[_0x3eb763(0x14c)])return await handleSDKOutput(_0x59f9e5,_0x466f46),0x0;return displayFieldsHumanReadable(_0x59f9e5,_0x4eb9af),0x0;}}