@treasuredata/tdx 2026.5.0 → 2026.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (244) 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.d.ts +9 -0
  32. package/dist/commands/journey-command.d.ts.map +1 -1
  33. package/dist/commands/journey-command.js +1 -1
  34. package/dist/commands/journey-command.js.map +1 -1
  35. package/dist/commands/journey-validate-command.js +1 -1
  36. package/dist/commands/llm-command.js +1 -1
  37. package/dist/commands/mcp-command.js +1 -1
  38. package/dist/commands/parent-segment-command.js +1 -1
  39. package/dist/commands/policy-command.js +1 -1
  40. package/dist/commands/profile-command.js +1 -1
  41. package/dist/commands/profiles-command.js +1 -1
  42. package/dist/commands/query-command.js +1 -1
  43. package/dist/commands/schedule-command.js +1 -1
  44. package/dist/commands/segment-command.js +1 -1
  45. package/dist/commands/segment-create-command.js +1 -1
  46. package/dist/commands/segment-fields-command.js +1 -1
  47. package/dist/commands/segment-pull-command.js +1 -1
  48. package/dist/commands/segment-push-command.js +1 -1
  49. package/dist/commands/segment-update-command.js +1 -1
  50. package/dist/commands/segment-use-command.js +1 -1
  51. package/dist/commands/segment-validate-command.js +1 -1
  52. package/dist/commands/segments.js +1 -1
  53. package/dist/commands/show.js +1 -1
  54. package/dist/commands/status-command.js +1 -1
  55. package/dist/commands/table-deleted.js +1 -1
  56. package/dist/commands/tables.js +1 -1
  57. package/dist/commands/unset-command.js +1 -1
  58. package/dist/commands/upgrade-command.js +1 -1
  59. package/dist/commands/use-command.js +1 -1
  60. package/dist/commands/user-command.js +1 -1
  61. package/dist/commands/work-command.js +1 -1
  62. package/dist/commands/workflow-command.js +1 -1
  63. package/dist/core/auth.js +1 -1
  64. package/dist/core/command-output.js +1 -1
  65. package/dist/core/config.js +1 -1
  66. package/dist/core/connection-cache.js +1 -1
  67. package/dist/core/constants.js +1 -1
  68. package/dist/core/credential-cache.js +1 -1
  69. package/dist/core/global-context.js +1 -1
  70. package/dist/core/keychain.js +1 -1
  71. package/dist/core/oauth-keychain.js +1 -1
  72. package/dist/core/oauth.js +1 -1
  73. package/dist/core/profile.js +1 -1
  74. package/dist/core/project-config.js +1 -1
  75. package/dist/core/session.js +1 -1
  76. package/dist/core/user-cache.js +1 -1
  77. package/dist/core/version.js +1 -1
  78. package/dist/index.js +1 -1
  79. package/dist/mcp/server.js +1 -1
  80. package/dist/mcp/tools/index.js +1 -1
  81. package/dist/mcp/tools/tdx-run.js +1 -1
  82. package/dist/mcp/tools/tdx-search.js +1 -1
  83. package/dist/mcp/tools/work-create-item.js +1 -1
  84. package/dist/mcp/utils.js +1 -1
  85. package/dist/proxy/claude-usage-tracker.js +1 -1
  86. package/dist/proxy/passthrough-server.js +1 -1
  87. package/dist/proxy/sse-usage-parser.js +1 -1
  88. package/dist/sdk/agent/agent-config.js +1 -1
  89. package/dist/sdk/agent/agent-ref-parser.js +1 -1
  90. package/dist/sdk/agent/agent-yaml.js +1 -1
  91. package/dist/sdk/agent/test/evaluator.js +1 -1
  92. package/dist/sdk/agent/test/executor.js +1 -1
  93. package/dist/sdk/agent/test/index.js +1 -1
  94. package/dist/sdk/agent/test/output.js +1 -1
  95. package/dist/sdk/agent/test/parser.js +1 -1
  96. package/dist/sdk/agent/tool-target-registry.js +1 -1
  97. package/dist/sdk/api.js +1 -1
  98. package/dist/sdk/cas/cas-api-client.js +1 -1
  99. package/dist/sdk/cas/cas-audience-yaml.js +1 -1
  100. package/dist/sdk/cas/cas-segment-yaml.js +1 -1
  101. package/dist/sdk/cas/index.js +1 -1
  102. package/dist/sdk/cas/pull-workflow.js +1 -1
  103. package/dist/sdk/cas/push-workflow.js +1 -1
  104. package/dist/sdk/client/cdp-api-client.d.ts +8 -1
  105. package/dist/sdk/client/cdp-api-client.d.ts.map +1 -1
  106. package/dist/sdk/client/cdp-api-client.js +1 -1
  107. package/dist/sdk/client/cdp-api-client.js.map +1 -1
  108. package/dist/sdk/client/delivery-api-client.js +1 -1
  109. package/dist/sdk/client/endpoints.js +1 -1
  110. package/dist/sdk/client/engage-api-client.js +1 -1
  111. package/dist/sdk/client/http-client.js +1 -1
  112. package/dist/sdk/client/llm-api-client.js +1 -1
  113. package/dist/sdk/client/oauth-refresh.js +1 -1
  114. package/dist/sdk/client/rate-limiter.js +1 -1
  115. package/dist/sdk/client/td-api-client.js +1 -1
  116. package/dist/sdk/client/trino-api-client.js +1 -1
  117. package/dist/sdk/client/workflow-client.js +1 -1
  118. package/dist/sdk/connection-validator.js +1 -1
  119. package/dist/sdk/connection.js +1 -1
  120. package/dist/sdk/delivery.js +1 -1
  121. package/dist/sdk/engage/campaign-pull.js +1 -1
  122. package/dist/sdk/engage/campaign-push.js +1 -1
  123. package/dist/sdk/engage/campaign-validator.js +1 -1
  124. package/dist/sdk/engage/campaign-yaml.js +1 -1
  125. package/dist/sdk/engage/template-pull.js +1 -1
  126. package/dist/sdk/engage/template-push.js +1 -1
  127. package/dist/sdk/engage/template-validator.js +1 -1
  128. package/dist/sdk/engage/template-yaml.js +1 -1
  129. package/dist/sdk/engage/types/campaign-def.js +1 -1
  130. package/dist/sdk/engage/types/campaign-schema.js +1 -1
  131. package/dist/sdk/engage/types/template-schema.js +1 -1
  132. package/dist/sdk/engage.js +1 -1
  133. package/dist/sdk/errors.js +1 -1
  134. package/dist/sdk/index.js +1 -1
  135. package/dist/sdk/io/index.js +1 -1
  136. package/dist/sdk/io/node-filesystem.js +1 -1
  137. package/dist/sdk/job.js +1 -1
  138. package/dist/sdk/journey.d.ts +8 -1
  139. package/dist/sdk/journey.d.ts.map +1 -1
  140. package/dist/sdk/journey.js +1 -1
  141. package/dist/sdk/journey.js.map +1 -1
  142. package/dist/sdk/llm/chat-cache.js +1 -1
  143. package/dist/sdk/llm/index.js +1 -1
  144. package/dist/sdk/llm/llm-backup-utils.js +1 -1
  145. package/dist/sdk/llm/model-factors.js +1 -1
  146. package/dist/sdk/llm/user-settings.js +1 -1
  147. package/dist/sdk/personalization.js +1 -1
  148. package/dist/sdk/policy.js +1 -1
  149. package/dist/sdk/query/deleted-table-validation.js +1 -1
  150. package/dist/sdk/query/index.js +1 -1
  151. package/dist/sdk/query/sql-parser.js +1 -1
  152. package/dist/sdk/realtime.js +1 -1
  153. package/dist/sdk/schedule.js +1 -1
  154. package/dist/sdk/segment/child-segment-yaml.js +1 -1
  155. package/dist/sdk/segment/fields-display.js +1 -1
  156. package/dist/sdk/segment/file-discovery.js +1 -1
  157. package/dist/sdk/segment/journey-utils.js +1 -1
  158. package/dist/sdk/segment/journey-validator.js +1 -1
  159. package/dist/sdk/segment/journey-yaml.js +1 -1
  160. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  161. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  162. package/dist/sdk/segment/pull-workflow.js +1 -1
  163. package/dist/sdk/segment/push-recovery.js +1 -1
  164. package/dist/sdk/segment/push-workflow.js +1 -1
  165. package/dist/sdk/segment/resolution-context.js +1 -1
  166. package/dist/sdk/segment/segment-path-parser.js +1 -1
  167. package/dist/sdk/segment/segment-ref-parser.js +1 -1
  168. package/dist/sdk/segment/segment-validator.js +1 -1
  169. package/dist/sdk/segment/segment-validator.js.map +1 -1
  170. package/dist/sdk/segment/target-resolution.js +1 -1
  171. package/dist/sdk/segment/tdx-config.js +1 -1
  172. package/dist/sdk/segment/types/activation-schema.js +1 -1
  173. package/dist/sdk/segment/types/journey-def.js +1 -1
  174. package/dist/sdk/segment/types/journey-schema.js +1 -1
  175. package/dist/sdk/segment/types/segment-def.js +1 -1
  176. package/dist/sdk/segment/types/segment-schema.js +1 -1
  177. package/dist/sdk/segment/validate-files.js +1 -1
  178. package/dist/sdk/segment/yaml-validator.d.ts +1 -1
  179. package/dist/sdk/segment/yaml-validator.d.ts.map +1 -1
  180. package/dist/sdk/segment/yaml-validator.js +1 -1
  181. package/dist/sdk/segment/yaml-validator.js.map +1 -1
  182. package/dist/sdk/segment.js +1 -1
  183. package/dist/sdk/types/cdp.d.ts +19 -0
  184. package/dist/sdk/types/cdp.d.ts.map +1 -1
  185. package/dist/sdk/types/index.d.ts +1 -1
  186. package/dist/sdk/types/index.d.ts.map +1 -1
  187. package/dist/sdk/types/index.js +1 -1
  188. package/dist/sdk/types/index.js.map +1 -1
  189. package/dist/sdk/types/progress.js +1 -1
  190. package/dist/sdk/types/workspace.js +1 -1
  191. package/dist/sdk/user.js +1 -1
  192. package/dist/sdk/util/format-detector.js +1 -1
  193. package/dist/sdk/util/formatters.js +1 -1
  194. package/dist/sdk/util/index.js +1 -1
  195. package/dist/sdk/util/paginate.js +1 -1
  196. package/dist/sdk/util/tree-formatter.js +1 -1
  197. package/dist/sdk/workflow/archive-validation.js +1 -1
  198. package/dist/sdk/workflow/clone-workflow.js +1 -1
  199. package/dist/sdk/workflow/index.js +1 -1
  200. package/dist/sdk/workflow/pull-workflow.js +1 -1
  201. package/dist/sdk/workflow/push-workflow.js +1 -1
  202. package/dist/sdk/workflow/task-graph.js +1 -1
  203. package/dist/sdk/workflow/tdx-config.js +1 -1
  204. package/dist/sdk/workflow/workflow-utils.js +1 -1
  205. package/dist/sdk/workspace/access-tracker.js +1 -1
  206. package/dist/sdk/workspace/frontmatter.js +1 -1
  207. package/dist/sdk/workspace/git.js +1 -1
  208. package/dist/sdk/workspace/index.js +1 -1
  209. package/dist/sdk/workspace/templates.js +1 -1
  210. package/dist/sdk/workspace/weekly.js +1 -1
  211. package/dist/sdk/workspace/wikilinks.js +1 -1
  212. package/dist/test-utils/command-runner.js +1 -1
  213. package/dist/test-utils/factories.js +1 -1
  214. package/dist/test-utils/fixtures.js +1 -1
  215. package/dist/test-utils/http-mock.js +1 -1
  216. package/dist/test-utils/index.js +1 -1
  217. package/dist/utils/async.js +1 -1
  218. package/dist/utils/colors.js +1 -1
  219. package/dist/utils/diff.js +1 -1
  220. package/dist/utils/file-permissions.js +1 -1
  221. package/dist/utils/file-reader.js +1 -1
  222. package/dist/utils/github-releases.js +1 -1
  223. package/dist/utils/global-cache.js +1 -1
  224. package/dist/utils/json-loader.js +1 -1
  225. package/dist/utils/local-cache.js +1 -1
  226. package/dist/utils/logger/formatters/default-formatter.js +1 -1
  227. package/dist/utils/logger/formatters/index.js +1 -1
  228. package/dist/utils/logger/handlers/console-handler.js +1 -1
  229. package/dist/utils/logger/handlers/file-handler.js +1 -1
  230. package/dist/utils/logger/handlers/index.js +1 -1
  231. package/dist/utils/logger/handlers/null-handler.js +1 -1
  232. package/dist/utils/logger/index.js +1 -1
  233. package/dist/utils/logger/logger.js +1 -1
  234. package/dist/utils/logger/types.js +1 -1
  235. package/dist/utils/option-validation.js +1 -1
  236. package/dist/utils/process.js +1 -1
  237. package/dist/utils/prompt.js +1 -1
  238. package/dist/utils/spinner.js +1 -1
  239. package/dist/utils/sse-parser.js +1 -1
  240. package/dist/utils/string-utils.js +1 -1
  241. package/dist/utils/table-ref-parser.js +1 -1
  242. package/dist/utils/tdx-logger.js +1 -1
  243. package/dist/utils/version-check.js +1 -1
  244. package/package.json +1 -1
@@ -1 +1 @@
1
- const a32_0x4788cf=a32_0x238c;(function(_0x43ed26,_0x2d2228){const _0x5b0e95=a32_0x238c,_0x21eed1=_0x43ed26();while(!![]){try{const _0x32e6d3=-parseInt(_0x5b0e95(0x1b6))/0x1*(-parseInt(_0x5b0e95(0x1c4))/0x2)+-parseInt(_0x5b0e95(0x1b2))/0x3+parseInt(_0x5b0e95(0x1d5))/0x4+parseInt(_0x5b0e95(0x1a5))/0x5+parseInt(_0x5b0e95(0x1be))/0x6+-parseInt(_0x5b0e95(0x1d1))/0x7+-parseInt(_0x5b0e95(0x1ba))/0x8;if(_0x32e6d3===_0x2d2228)break;else _0x21eed1['push'](_0x21eed1['shift']());}catch(_0x33779f){_0x21eed1['push'](_0x21eed1['shift']());}}}(a32_0x148d,0x3b1ec));function a32_0x238c(_0x3389f2,_0x30891b){_0x3389f2=_0x3389f2-0x19c;const _0x148dcf=a32_0x148d();let _0x238c8c=_0x148dcf[_0x3389f2];return _0x238c8c;}import{BaseCommand}from'./command.js';import{handleSDKOutput,handleSingleObjectOutput,isStructuredFormat}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import a32_0x49dd35 from'chalk';export class PolicyCommand extends BaseCommand{[a32_0x4788cf(0x1c3)]='policy';[a32_0x4788cf(0x1c6)]=a32_0x4788cf(0x1b3);async[a32_0x4788cf(0x1a1)](_0xfa730d){const _0x2af056=a32_0x4788cf,{options:_0xa3136d,tdx:_0x56321e}=_0xfa730d,_0x2d4974=await withSpinner(_0x2af056(0x1b0),async()=>{const _0x4ce6eb=_0x2af056,[_0x2b99be,_0x219a17]=await Promise[_0x4ce6eb(0x1ac)]([_0x56321e[_0x4ce6eb(0x1ce)][_0x4ce6eb(0x19d)](),_0x56321e[_0x4ce6eb(0x1bd)][_0x4ce6eb(0x19e)]()]);return{'userInfo':_0x2b99be,'permissions':_0x219a17};},{'verbose':_0xa3136d[_0x2af056(0x1d2)]}),{userInfo:_0x5334ac,permissions:_0x550a7b}=_0x2d4974['data'];if(isStructuredFormat(_0xa3136d))return await handleSingleObjectOutput(_0x550a7b,_0xa3136d),0x0;const _0x577147=_0x5334ac[_0x2af056(0x1c2)]?_0x2af056(0x1ad):_0x5334ac[_0x2af056(0x1a3)]?'Administrator':_0x2af056(0x1bf);console['log']('\x0a'+a32_0x49dd35[_0x2af056(0x1ca)]('👤')+'\x20'+a32_0x49dd35[_0x2af056(0x1ca)](_0x5334ac[_0x2af056(0x1c3)])+'\x20'+a32_0x49dd35[_0x2af056(0x1cb)]('('+_0x5334ac[_0x2af056(0x1c1)]+')')+_0x2af056(0x19c)+_0x577147),console[_0x2af056(0x1b1)](a32_0x49dd35[_0x2af056(0x1cb)](_0x2af056(0x1c7)+_0x56321e[_0x2af056(0x1a9)][_0x2af056(0x1a6)]+':'+_0x5334ac['account_id']+_0x2af056(0x1d7)+_0x5334ac['id']));const _0x5043d6=_0x550a7b['policies'];console[_0x2af056(0x1b1)]('\x0a'+a32_0x49dd35[_0x2af056(0x1ca)](_0x2af056(0x1c5))+'\x20('+_0x5043d6[_0x2af056(0x1cc)]+'):');if(_0x5043d6[_0x2af056(0x1cc)]===0x0)console[_0x2af056(0x1b1)](a32_0x49dd35['dim'](_0x2af056(0x1d6)));else for(const _0x38cbbc of _0x5043d6){console[_0x2af056(0x1b1)](_0x2af056(0x1b5)+_0x38cbbc[_0x2af056(0x1c3)]);}return printPermissionsMap(_0x550a7b[_0x2af056(0x1cf)]),console[_0x2af056(0x1b1)](),0x0;}}export class PolicyListCommand extends BaseCommand{[a32_0x4788cf(0x1c3)]=a32_0x4788cf(0x1bc);[a32_0x4788cf(0x1c6)]=a32_0x4788cf(0x1a0);async[a32_0x4788cf(0x1a1)](_0x1997ca){const _0xf63d2a=a32_0x4788cf,{options:_0x4b3dff,tdx:_0x4591b7}=_0x1997ca,_0x4c8d2c=await withSpinner(_0xf63d2a(0x1c8),()=>_0x4591b7[_0xf63d2a(0x1bd)][_0xf63d2a(0x1a4)](),{'verbose':_0x4b3dff[_0xf63d2a(0x1d2)]}),_0x31ad45=_0x4c8d2c[_0xf63d2a(0x1d0)];console[_0xf63d2a(0x1a2)]('✔\x20Found\x20'+_0x31ad45[_0xf63d2a(0x1cc)]+_0xf63d2a(0x1bb)+(_0x31ad45['length']!==0x1?_0xf63d2a(0x1d8):'y'));if(isStructuredFormat(_0x4b3dff))return await handleSDKOutput(_0x31ad45,_0x4b3dff),0x0;if(_0x31ad45[_0xf63d2a(0x1cc)]===0x0)console[_0xf63d2a(0x1b1)](a32_0x49dd35['dim'](_0xf63d2a(0x1d3)));else for(const _0x58ee4d of _0x31ad45){const _0x4df34a=_0x58ee4d[_0xf63d2a(0x1c6)]?a32_0x49dd35[_0xf63d2a(0x1cb)](_0xf63d2a(0x19c)+_0x58ee4d[_0xf63d2a(0x1c6)]):'';console['log'](_0xf63d2a(0x1b5)+_0x58ee4d[_0xf63d2a(0x1c3)]+_0x4df34a);}return 0x0;}}export class PolicyShowCommand extends BaseCommand{[a32_0x4788cf(0x1c3)]=a32_0x4788cf(0x1c0);[a32_0x4788cf(0x1c6)]=a32_0x4788cf(0x1b9);[a32_0x4788cf(0x1c9)](_0x5b2f29){const _0x1f40af=a32_0x4788cf;if(_0x5b2f29['args'][_0x1f40af(0x1cc)]===0x0)return'Usage:\x20tdx\x20policy\x20show\x20<policy-name-or-id>';return undefined;}async['execute'](_0x31cd9f){const _0x47156b=a32_0x4788cf,{options:_0x3375d2,tdx:_0x105760}=_0x31cd9f,_0x245402=_0x31cd9f[_0x47156b(0x1d4)][0x0],_0xeca754=await withSpinner(_0x47156b(0x19f),async()=>{const _0x45a03b=_0x47156b,_0x3141b6=await _0x105760[_0x45a03b(0x1bd)][_0x45a03b(0x1b7)](_0x245402),[_0x4ff192,_0x265793]=await Promise[_0x45a03b(0x1ac)]([_0x105760[_0x45a03b(0x1bd)][_0x45a03b(0x1a8)](_0x3141b6['id']),_0x105760[_0x45a03b(0x1bd)]['getPolicyUsers'](_0x3141b6['id'])]);return{'policy':_0x3141b6,'perms':_0x4ff192,'users':_0x265793};},{'verbose':_0x3375d2[_0x47156b(0x1d2)]}),{policy:_0xe4597a,perms:_0x3bb7ec,users:_0x526184}=_0xeca754[_0x47156b(0x1d0)];if(isStructuredFormat(_0x3375d2))return await handleSingleObjectOutput({..._0xe4597a,'permissions':_0x3bb7ec[_0x47156b(0x1cf)],'users':_0x526184},_0x3375d2),0x0;console['log']('\x0a'+a32_0x49dd35['bold']('📋')+'\x20'+a32_0x49dd35['bold'](_0xe4597a['name'])+'\x20'+a32_0x49dd35[_0x47156b(0x1cb)]('(ID:\x20'+_0xe4597a['id']+')'));_0xe4597a[_0x47156b(0x1c6)]&&console[_0x47156b(0x1b1)]('\x20\x20\x20'+a32_0x49dd35[_0x47156b(0x1cb)](_0xe4597a['description']));console[_0x47156b(0x1b1)](_0x47156b(0x1c7)+_0x526184[_0x47156b(0x1cc)]+_0x47156b(0x1b8)+(_0x526184[_0x47156b(0x1cc)]!==0x1?'s':'')+'\x20assigned'),printPermissionsMap(_0x3bb7ec[_0x47156b(0x1cf)]);if(_0x526184['length']>0x0){console[_0x47156b(0x1b1)]('\x0a'+a32_0x49dd35[_0x47156b(0x1ca)](_0x47156b(0x1ae))+':');for(const _0x443230 of _0x526184){const _0x24b110=_0x443230[_0x47156b(0x1c1)]&&_0x443230[_0x47156b(0x1c1)]!==_0x443230[_0x47156b(0x1c3)]?a32_0x49dd35[_0x47156b(0x1cb)]('\x20<'+_0x443230[_0x47156b(0x1c1)]+'>'):'';console[_0x47156b(0x1b1)]('\x20\x20•\x20'+_0x443230[_0x47156b(0x1c3)]+_0x24b110);}}return console[_0x47156b(0x1b1)](),0x0;}}function printPermissionsMap(_0x4e0eff){const _0x3e0f1b=a32_0x4788cf,_0x553364=Object[_0x3e0f1b(0x1a7)](_0x4e0eff);console[_0x3e0f1b(0x1b1)]('\x0a'+a32_0x49dd35['bold'](_0x3e0f1b(0x1af))+':');if(_0x553364[_0x3e0f1b(0x1cc)]===0x0){console[_0x3e0f1b(0x1b1)](a32_0x49dd35['dim']('\x20\x20No\x20permissions'));return;}const _0x1f52f7=Math[_0x3e0f1b(0x1cd)](..._0x553364[_0x3e0f1b(0x1b4)](([_0x38bc1a])=>_0x38bc1a[_0x3e0f1b(0x1cc)]));for(const [_0x4d49ae,_0x436d1d]of _0x553364){const _0x15fd5a=formatOperations(_0x436d1d);console['log']('\x20\x20'+_0x4d49ae[_0x3e0f1b(0x1aa)](_0x1f52f7+0x2)+_0x15fd5a);}}function formatOperations(_0x19adf2){const _0x36bd2d=a32_0x4788cf,_0x5daa90=[...new Set(_0x19adf2[_0x36bd2d(0x1b4)](_0x336172=>_0x336172[_0x36bd2d(0x1ab)]))];return _0x5daa90['join'](',\x20');}function a32_0x148d(){const _0x5ac3f2=['policy','2530332FCjUNd','Member','policy\x20show','email','account_owner','name','30978fLPuvY','📋\x20Assigned\x20Policies','description','\x20\x20\x20','Listing\x20policies...','validate','bold','dim','length','max','user','permissions','data','3378858ynuCqj','verbose','No\x20policies\x20found','args','702132qIRMXs','\x20\x20No\x20policies\x20assigned',',\x20user_id:','ies','\x20—\x20','getCurrent','getMyPermissions','Fetching\x20policy...','List\x20all\x20policies\x20in\x20the\x20account\x20(admin\x20only)','execute','error','administrator','listPolicies','1383095uMCYhD','site','entries','getPolicyPermissions','context','padEnd','operation','all','Account\x20Owner','👥\x20Assigned\x20Users','🔑\x20Effective\x20Permissions','Fetching\x20permissions...','log','1202211VqeraC','Show\x20current\x20user\x20policies\x20and\x20effective\x20permissions','map','\x20\x20•\x20','31oVVABH','getPolicy','\x20user','Show\x20a\x20specific\x20policy\x20details\x20and\x20permissions\x20(admin\x20only)','1827568mYxXtG','\x20polic','policy\x20list'];a32_0x148d=function(){return _0x5ac3f2;};return a32_0x148d();}
1
+ const a32_0x99d6cb=a32_0x2d73;function a32_0x49b5(){const _0x465051=['email','\x20\x20•\x20','all','10aMLybG','858612rXcIkV','getPolicyUsers','validate','\x20user','data','👥\x20Assigned\x20Users','17757179cGtENA','28357EhwbCd','getMyPermissions','args','ies','Account\x20Owner','✔\x20Found\x20','entries','117748lLmEDn','\x20\x20No\x20permissions','1538091JbMysI','12JstdMX','bold','policies','dim','account_id','permissions','verbose','description','\x20—\x20','231188hfbkTH','padEnd','39PkSuJJ','No\x20policies\x20found','map','join','(ID:\x20','policy','policy\x20list','getCurrent','length','Fetching\x20permissions...','Show\x20a\x20specific\x20policy\x20details\x20and\x20permissions\x20(admin\x20only)','error','Member','execute','listPolicies','\x20polic','administrator','1518ZHdUTQ','getPolicyPermissions','📋\x20Assigned\x20Policies','\x20\x20\x20','user','log','name','Show\x20current\x20user\x20policies\x20and\x20effective\x20permissions','account_owner','95AagKAC','11492056TMKdFM','List\x20all\x20policies\x20in\x20the\x20account\x20(admin\x20only)','Administrator','getPolicy'];a32_0x49b5=function(){return _0x465051;};return a32_0x49b5();}(function(_0x4f7164,_0x573a58){const _0x446302=a32_0x2d73,_0x13a0ee=_0x4f7164();while(!![]){try{const _0x103d39=parseInt(_0x446302(0xb2))/0x1+parseInt(_0x446302(0x8d))/0x2*(parseInt(_0x446302(0x8f))/0x3)+-parseInt(_0x446302(0x81))/0x4*(parseInt(_0x446302(0xa9))/0x5)+-parseInt(_0x446302(0xa0))/0x6*(parseInt(_0x446302(0x7a))/0x7)+-parseInt(_0x446302(0xaa))/0x8+-parseInt(_0x446302(0x83))/0x9*(parseInt(_0x446302(0xb1))/0xa)+-parseInt(_0x446302(0x79))/0xb*(-parseInt(_0x446302(0x84))/0xc);if(_0x103d39===_0x573a58)break;else _0x13a0ee['push'](_0x13a0ee['shift']());}catch(_0x45af3f){_0x13a0ee['push'](_0x13a0ee['shift']());}}}(a32_0x49b5,0xbf68b));import{BaseCommand}from'./command.js';import{handleSDKOutput,handleSingleObjectOutput,isStructuredFormat}from'../core/command-output.js';function a32_0x2d73(_0x3a7050,_0x5ea815){_0x3a7050=_0x3a7050-0x75;const _0x49b5cf=a32_0x49b5();let _0x2d735c=_0x49b5cf[_0x3a7050];return _0x2d735c;}import{withSpinner}from'../utils/spinner.js';import a32_0x24d4c3 from'chalk';export class PolicyCommand extends BaseCommand{['name']=a32_0x99d6cb(0x94);[a32_0x99d6cb(0x8b)]=a32_0x99d6cb(0xa7);async[a32_0x99d6cb(0x9c)](_0x42bce1){const _0x2ecf6c=a32_0x99d6cb,{options:_0x2e02b6,tdx:_0x332519}=_0x42bce1,_0x118f9e=await withSpinner(_0x2ecf6c(0x98),async()=>{const _0x4e7457=_0x2ecf6c,[_0x35fd94,_0x189ceb]=await Promise[_0x4e7457(0xb0)]([_0x332519[_0x4e7457(0xa4)][_0x4e7457(0x96)](),_0x332519['policy'][_0x4e7457(0x7b)]()]);return{'userInfo':_0x35fd94,'permissions':_0x189ceb};},{'verbose':_0x2e02b6[_0x2ecf6c(0x8a)]}),{userInfo:_0x1c0f74,permissions:_0x113a78}=_0x118f9e[_0x2ecf6c(0x77)];if(isStructuredFormat(_0x2e02b6))return await handleSingleObjectOutput(_0x113a78,_0x2e02b6),0x0;const _0x1dcb26=_0x1c0f74[_0x2ecf6c(0xa8)]?_0x2ecf6c(0x7e):_0x1c0f74[_0x2ecf6c(0x9f)]?_0x2ecf6c(0xac):_0x2ecf6c(0x9b);console['log']('\x0a'+a32_0x24d4c3[_0x2ecf6c(0x85)]('👤')+'\x20'+a32_0x24d4c3['bold'](_0x1c0f74[_0x2ecf6c(0xa6)])+'\x20'+a32_0x24d4c3[_0x2ecf6c(0x87)]('('+_0x1c0f74['email']+')')+_0x2ecf6c(0x8c)+_0x1dcb26),console[_0x2ecf6c(0xa5)](a32_0x24d4c3[_0x2ecf6c(0x87)](_0x2ecf6c(0xa3)+_0x332519['context']['site']+':'+_0x1c0f74[_0x2ecf6c(0x88)]+',\x20user_id:'+_0x1c0f74['id']));const _0x43940c=_0x113a78[_0x2ecf6c(0x86)];console['log']('\x0a'+a32_0x24d4c3[_0x2ecf6c(0x85)](_0x2ecf6c(0xa2))+'\x20('+_0x43940c[_0x2ecf6c(0x97)]+'):');if(_0x43940c[_0x2ecf6c(0x97)]===0x0)console['log'](a32_0x24d4c3[_0x2ecf6c(0x87)]('\x20\x20No\x20policies\x20assigned'));else for(const _0x7f7cae of _0x43940c){console['log']('\x20\x20•\x20'+_0x7f7cae[_0x2ecf6c(0xa6)]);}return printPermissionsMap(_0x113a78[_0x2ecf6c(0x89)]),console[_0x2ecf6c(0xa5)](),0x0;}}export class PolicyListCommand extends BaseCommand{['name']=a32_0x99d6cb(0x95);['description']=a32_0x99d6cb(0xab);async['execute'](_0x25f24e){const _0xaf4f64=a32_0x99d6cb,{options:_0x33b7ff,tdx:_0x18c030}=_0x25f24e,_0x1bb496=await withSpinner('Listing\x20policies...',()=>_0x18c030[_0xaf4f64(0x94)][_0xaf4f64(0x9d)](),{'verbose':_0x33b7ff['verbose']}),_0x12867a=_0x1bb496['data'];console[_0xaf4f64(0x9a)](_0xaf4f64(0x7f)+_0x12867a[_0xaf4f64(0x97)]+_0xaf4f64(0x9e)+(_0x12867a[_0xaf4f64(0x97)]!==0x1?_0xaf4f64(0x7d):'y'));if(isStructuredFormat(_0x33b7ff))return await handleSDKOutput(_0x12867a,_0x33b7ff),0x0;if(_0x12867a[_0xaf4f64(0x97)]===0x0)console[_0xaf4f64(0xa5)](a32_0x24d4c3[_0xaf4f64(0x87)](_0xaf4f64(0x90)));else for(const _0x3b8fea of _0x12867a){const _0x1cdab3=_0x3b8fea['description']?a32_0x24d4c3[_0xaf4f64(0x87)](_0xaf4f64(0x8c)+_0x3b8fea['description']):'';console[_0xaf4f64(0xa5)]('\x20\x20•\x20'+_0x3b8fea[_0xaf4f64(0xa6)]+_0x1cdab3);}return 0x0;}}export class PolicyShowCommand extends BaseCommand{[a32_0x99d6cb(0xa6)]='policy\x20show';[a32_0x99d6cb(0x8b)]=a32_0x99d6cb(0x99);[a32_0x99d6cb(0x75)](_0x490828){const _0x3642a9=a32_0x99d6cb;if(_0x490828[_0x3642a9(0x7c)][_0x3642a9(0x97)]===0x0)return'Usage:\x20tdx\x20policy\x20show\x20<policy-name-or-id>';return undefined;}async['execute'](_0x14da51){const _0x40c894=a32_0x99d6cb,{options:_0x4dd576,tdx:_0x5eacca}=_0x14da51,_0x5a4681=_0x14da51[_0x40c894(0x7c)][0x0],_0x3555b7=await withSpinner('Fetching\x20policy...',async()=>{const _0x2de20f=_0x40c894,_0xfae755=await _0x5eacca['policy'][_0x2de20f(0xad)](_0x5a4681),[_0x1b8712,_0x352d71]=await Promise[_0x2de20f(0xb0)]([_0x5eacca['policy'][_0x2de20f(0xa1)](_0xfae755['id']),_0x5eacca['policy'][_0x2de20f(0xb3)](_0xfae755['id'])]);return{'policy':_0xfae755,'perms':_0x1b8712,'users':_0x352d71};},{'verbose':_0x4dd576['verbose']}),{policy:_0x4df196,perms:_0x16e480,users:_0x864ba7}=_0x3555b7['data'];if(isStructuredFormat(_0x4dd576))return await handleSingleObjectOutput({..._0x4df196,'permissions':_0x16e480['permissions'],'users':_0x864ba7},_0x4dd576),0x0;console[_0x40c894(0xa5)]('\x0a'+a32_0x24d4c3[_0x40c894(0x85)]('📋')+'\x20'+a32_0x24d4c3['bold'](_0x4df196[_0x40c894(0xa6)])+'\x20'+a32_0x24d4c3['dim'](_0x40c894(0x93)+_0x4df196['id']+')'));_0x4df196['description']&&console['log'](_0x40c894(0xa3)+a32_0x24d4c3[_0x40c894(0x87)](_0x4df196[_0x40c894(0x8b)]));console[_0x40c894(0xa5)]('\x20\x20\x20'+_0x864ba7[_0x40c894(0x97)]+_0x40c894(0x76)+(_0x864ba7[_0x40c894(0x97)]!==0x1?'s':'')+'\x20assigned'),printPermissionsMap(_0x16e480[_0x40c894(0x89)]);if(_0x864ba7['length']>0x0){console['log']('\x0a'+a32_0x24d4c3['bold'](_0x40c894(0x78))+':');for(const _0x44764e of _0x864ba7){const _0x536eb4=_0x44764e['email']&&_0x44764e[_0x40c894(0xae)]!==_0x44764e['name']?a32_0x24d4c3[_0x40c894(0x87)]('\x20<'+_0x44764e[_0x40c894(0xae)]+'>'):'';console[_0x40c894(0xa5)](_0x40c894(0xaf)+_0x44764e[_0x40c894(0xa6)]+_0x536eb4);}}return console[_0x40c894(0xa5)](),0x0;}}function printPermissionsMap(_0x54bd0c){const _0x2a653a=a32_0x99d6cb,_0x37f81e=Object[_0x2a653a(0x80)](_0x54bd0c);console[_0x2a653a(0xa5)]('\x0a'+a32_0x24d4c3[_0x2a653a(0x85)]('🔑\x20Effective\x20Permissions')+':');if(_0x37f81e[_0x2a653a(0x97)]===0x0){console['log'](a32_0x24d4c3[_0x2a653a(0x87)](_0x2a653a(0x82)));return;}const _0x20349f=Math['max'](..._0x37f81e[_0x2a653a(0x91)](([_0x57f7cc])=>_0x57f7cc['length']));for(const [_0x4c3c1e,_0x359369]of _0x37f81e){const _0x54b072=formatOperations(_0x359369);console[_0x2a653a(0xa5)]('\x20\x20'+_0x4c3c1e[_0x2a653a(0x8e)](_0x20349f+0x2)+_0x54b072);}}function formatOperations(_0x478d97){const _0x3ef1b6=a32_0x99d6cb,_0x58ea07=[...new Set(_0x478d97[_0x3ef1b6(0x91)](_0xd9254=>_0xd9254['operation']))];return _0x58ea07[_0x3ef1b6(0x92)](',\x20');}
@@ -1 +1 @@
1
- const a33_0x2626bd=a33_0x3d5c;(function(_0x3dc689,_0x54b136){const _0x123378=a33_0x3d5c,_0x1b7555=_0x3dc689();while(!![]){try{const _0x4366f3=-parseInt(_0x123378(0xc5))/0x1+parseInt(_0x123378(0x9f))/0x2+-parseInt(_0x123378(0x96))/0x3*(-parseInt(_0x123378(0x84))/0x4)+parseInt(_0x123378(0xa9))/0x5*(parseInt(_0x123378(0x89))/0x6)+parseInt(_0x123378(0xd1))/0x7+parseInt(_0x123378(0xc9))/0x8*(-parseInt(_0x123378(0xc6))/0x9)+-parseInt(_0x123378(0x95))/0xa;if(_0x4366f3===_0x54b136)break;else _0x1b7555['push'](_0x1b7555['shift']());}catch(_0x4850ee){_0x1b7555['push'](_0x1b7555['shift']());}}}(a33_0x150f,0x20bcf));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_0x118b09 from'node:path';import{saveSessionContext,getSessionID,cleanExpiredSessions}from'../core/session.js';import{saveAPIKeyAsync,resolveSite}from'../core/config.js';import{getConsoleUrl}from'../sdk/client/endpoints.js';import{deleteKeychainAPIKey,isKeychainAvailable}from'../core/keychain.js';function a33_0x3d5c(_0x2092e0,_0x19bd18){_0x2092e0=_0x2092e0-0x78;const _0x150fb1=a33_0x150f();let _0x3d5cdc=_0x150fb1[_0x2092e0];return _0x3d5cdc;}import{deleteOAuthTokens}from'../core/oauth-keychain.js';import{runOAuthLoginFlow,promptAuthMethod}from'./auth-command.js';function a33_0x150f(){const _0x1801d4=['Profile\x20was\x20not\x20created.\x20Please\x20try\x20again.','us01','\x0aTip:\x20Use\x20\x27tdx\x20profile\x20use\x20','length','Changing\x20site\x20to\x20\x27','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','profile:use','warn','\x0aSetting\x20up\x20authentication\x20for\x20site:\x20','getUserInfo','llm_project','red','email','165137hbNnLG','9SGYqAb','Operation\x20cancelled','profile:delete','734384XzKmgH','\x20\x20tdx\x20--profile\x20','/app/mp/ak','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>','tdx.json','test','\x0aSetup\x20cancelled','Enter\x20profile\x20name:','1836401QxJDDU','Profile\x20\x27','bold','database','yellow','\x20--default\x27\x20to\x20save\x20permanently','name','Setup\x20cancelled','log','profileName','Site\x20was\x20not\x20changed.','\x20Profile\x20\x27','message','profile','\x27\x20created','validate','status','Unknown\x20key\x20\x27','\x20API\x20key\x20saved\x20to\x20system\x20keychain\x20(profile:\x20','skipExistsCheck','error','profile:create','oauth','\x27.\x0a\x0aValid\x20keys:\x20','profile:set','\x20API\x20key\x20saved\x20to\x20system\x20keychain','\x0aOperation\x20cancelled','\x27\x20does\x20not\x20exist.\x20Create\x20it?','parent_segment','create','VALID_KEYS','Profile\x20name\x20must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore','4FxHKkA','Session\x20profile\x20set\x20to:\x20','Key=value\x20pair\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','You\x20can\x20find\x20your\x20API\x20key\x20at:','\x27\x20requires\x20API\x20key\x20validation.','19746NdFgHB','join','confirm','tdx:\x20profile\x20set','Delete\x20a\x20profile','Set\x20session\x20profile','text','password','\x27\x20deleted','llm_agent','ERROR','\x20\x20(no\x20profiles\x20found)','3898020KhVnvd','732063AKZsHg','logLevel','tdx:\x20profile\x20create','execute','API\x20key\x20cannot\x20be\x20empty','(cleared)','Profile\x20name\x20cannot\x20be\x20empty','✗\x20Validation\x20failed:\x20','Are\x20you\x20sure\x20you\x20want\x20to\x20remove\x20profile\x20\x27','529190GFGWUI','split','\x0aSaved\x20to:\x20','\x0aAvailable\x20profiles:','dim','Validating\x20API\x20key...','trim','description','all','(session:\x20','15cYdZuh','session','includes','config','apiKey','jobs','Removed\x20existing\x20profile\x20\x27','\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases','\x20API\x20key\x20is\x20valid\x20(User:\x20','\x27\x20does\x20not\x20exist.','default','\x20\x20-\x20','site','Invalid\x20format.\x20Use:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','green'];a33_0x150f=function(){return _0x1801d4;};return a33_0x150f();}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_0x1d6e1e from'prompts';import a33_0x177f83 from'chalk';function validateProfileName(_0x24edaf,_0x319e53){const _0x5268f9=a33_0x3d5c;if(!_0x24edaf||!_0x24edaf[_0x5268f9(0xa5)]())return _0x5268f9(0x9c);const _0x5a7d43=_0x24edaf[_0x5268f9(0xa5)]();if(!/^[a-zA-Z0-9_-]+$/[_0x5268f9(0xce)](_0x5a7d43))return _0x5268f9(0x83);if(!_0x319e53?.[_0x5268f9(0xe4)]&&profileExists(_0x5a7d43))return _0x5268f9(0xd2)+_0x5a7d43+'\x27\x20already\x20exists.\x20Use\x20\x27tdx\x20profile\x20delete\x20'+_0x5a7d43+'\x27\x20to\x20remove\x20it\x20first,\x20or\x20re-create\x20with\x20--force.';return!![];}async function deleteProfileAndCredentials(_0x4656d3){const _0x3a977a=a33_0x3d5c;removeProfileFromUserConfig(_0x4656d3);const _0x57489c=await isKeychainAvailable();_0x57489c&&await Promise[_0x3a977a(0xa7)]([deleteKeychainAPIKey(_0x4656d3),deleteOAuthTokens(_0x4656d3)]);}export class ProfileCreateCommand extends BaseCommand{['name']=a33_0x2626bd(0x79);['description']='Create\x20a\x20new\x20profile';async[a33_0x2626bd(0x99)](_0x59171b){const _0x4bcb59=a33_0x2626bd,{options:_0x507b94,args:_0x3394e1}=_0x59171b,_0x37bc5b=!!_0x507b94['force'];console['log'](a33_0x177f83[_0x4bcb59(0xd3)](_0x4bcb59(0x98)));let _0x2e719d;if(_0x3394e1['length']>0x0&&_0x3394e1[0x0]){const _0x4d3c0b=_0x3394e1[0x0][_0x4bcb59(0xa5)]();_0x37bc5b&&profileExists(_0x4d3c0b)&&(await deleteProfileAndCredentials(_0x4d3c0b),console[_0x4bcb59(0xd9)](_0x4bcb59(0xaf)+_0x4d3c0b+'\x27'));const _0x523ddb=validateProfileName(_0x4d3c0b);if(_0x523ddb!==!![])return console['error'](a33_0x177f83[_0x4bcb59(0xc3)](_0x523ddb)),0x1;_0x2e719d=_0x4d3c0b;}else{const _0x38bfe7=await a33_0x1d6e1e({'type':_0x4bcb59(0x8f),'name':_0x4bcb59(0xda),'message':_0x4bcb59(0xd0),'validate':_0x4a2195=>validateProfileName(_0x4a2195,{'skipExistsCheck':_0x37bc5b})});if(!_0x38bfe7[_0x4bcb59(0xda)])return console[_0x4bcb59(0xd9)]('\x0aSetup\x20cancelled'),0x1;_0x2e719d=_0x38bfe7['profileName']['trim'](),_0x37bc5b&&profileExists(_0x2e719d)&&(await deleteProfileAndCredentials(_0x2e719d),console['log'](_0x4bcb59(0xaf)+_0x2e719d+'\x27'));}const _0x3ef21c=await a33_0x1d6e1e({'type':_0x4bcb59(0x8f),'name':_0x4bcb59(0xa6),'message':'Enter\x20description\x20(optional):'}),_0x35f5fd=_0x3ef21c[_0x4bcb59(0xa6)]?.[_0x4bcb59(0xa5)]()||undefined,_0x14a863=_0x507b94[_0x4bcb59(0xb5)]||_0x4bcb59(0xb9),_0x40b0de=await promptSiteSelection(_0x14a863,_0x2e719d,_0x4bcb59(0xd8));if(!_0x40b0de)return 0x1;const _0xb60de0=resolveSite(_0x40b0de),_0x2de5dd=await promptAuthMethod();if(!_0x2de5dd)return console[_0x4bcb59(0xd9)](_0x4bcb59(0xcf)),0x1;if(_0x2de5dd===_0x4bcb59(0x7a)){if(_0x35f5fd){const _0x2e4966={'site':_0xb60de0,'description':_0x35f5fd};saveProfileToUserConfig(_0x2e719d,_0x2e4966);}const {accountName:_0x4c0248}=_0x507b94;return await runOAuthLoginFlow(_0xb60de0,_0x2e719d,_0x507b94['logLevel']??LogLevel['ERROR'],{'accountName':_0x4c0248}),0x0;}console[_0x4bcb59(0xd9)](_0x4bcb59(0xc0)+_0xb60de0),console['log'](_0x4bcb59(0x87)),console[_0x4bcb59(0xd9)]('\x20\x20'+getConsoleUrl(_0xb60de0,_0x4bcb59(0xcb)));const _0x3e584f=await a33_0x1d6e1e({'type':_0x4bcb59(0x90),'name':_0x4bcb59(0xad),'message':'Enter\x20your\x20TD\x20API\x20key:','validate':_0x53acb7=>{const _0x163fb9=_0x4bcb59;if(!_0x53acb7||!_0x53acb7[_0x163fb9(0xa5)]())return _0x163fb9(0x9a);return!![];}});if(!_0x3e584f[_0x4bcb59(0xad)])return console[_0x4bcb59(0xd9)](_0x4bcb59(0xcf)),0x1;const _0x304cc7=_0x3e584f[_0x4bcb59(0xad)];console[_0x4bcb59(0xd9)]('Validating\x20API\x20key...');try{const _0x43d98f=TDX[_0x4bcb59(0x81)]({'site':_0xb60de0,'apiKey':_0x304cc7[_0x4bcb59(0xa5)](),'logLevel':_0x507b94[_0x4bcb59(0x97)]??LogLevel['ERROR']}),_0x42d726=await _0x43d98f[_0x4bcb59(0xae)][_0x4bcb59(0xc1)]();console[_0x4bcb59(0xd9)](a33_0x177f83[_0x4bcb59(0xb7)]('✓')+_0x4bcb59(0xb1)+_0x42d726[_0x4bcb59(0xc4)]+')');const _0x3fb094=await isKeychainAvailable();_0x3fb094?(await saveAPIKeyAsync(_0x304cc7[_0x4bcb59(0xa5)](),_0xb60de0,_0x2e719d),console['log'](a33_0x177f83[_0x4bcb59(0xb7)]('✓')+_0x4bcb59(0xe3)+_0x2e719d+')')):(console[_0x4bcb59(0xbf)](a33_0x177f83[_0x4bcb59(0xd5)](_0x4bcb59(0xbd))),console[_0x4bcb59(0xbf)](a33_0x177f83[_0x4bcb59(0xd5)]('\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.')));const _0x5e8d9e={'site':_0xb60de0,..._0x35f5fd&&{'description':_0x35f5fd}};return saveProfileToUserConfig(_0x2e719d,_0x5e8d9e),console[_0x4bcb59(0xd9)](a33_0x177f83[_0x4bcb59(0xb7)]('✓')+_0x4bcb59(0xdc)+_0x2e719d+_0x4bcb59(0xdf)),console[_0x4bcb59(0xd9)](),console[_0x4bcb59(0xd9)]('You\x20can\x20now\x20use\x20tdx\x20commands\x20with\x20this\x20profile.\x20Try:'),console['log'](_0x4bcb59(0xca)+_0x2e719d+'\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication'),console[_0x4bcb59(0xd9)](_0x4bcb59(0xca)+_0x2e719d+_0x4bcb59(0xb0)),0x0;}catch(_0x3f1d60){if(_0x3f1d60 instanceof HTTPClientError&&_0x3f1d60['status']===0x191)return printAuthError(_0x3f1d60),0x1;return console['error'](a33_0x177f83['red'](_0x4bcb59(0x9d)+(_0x3f1d60 instanceof Error?_0x3f1d60[_0x4bcb59(0xdd)]:String(_0x3f1d60)))),console[_0x4bcb59(0x78)](_0x4bcb59(0xb8)),0x1;}}}export class ProfileDeleteCommand extends BaseCommand{['name']=a33_0x2626bd(0xc8);[a33_0x2626bd(0xa6)]=a33_0x2626bd(0x8d);['validate'](_0x5dd93f){const _0x4a9c5e=a33_0x2626bd,{args:_0x23c65f}=_0x5dd93f;if(_0x23c65f[_0x4a9c5e(0xbb)]===0x0)return'Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20delete\x20<name>';return undefined;}async[a33_0x2626bd(0x99)](_0x26a8be){const _0x4144f1=a33_0x2626bd,{args:_0x274ffc}=_0x26a8be,_0x1b8162=_0x274ffc[0x0];console['log'](a33_0x177f83[_0x4144f1(0xd3)]('tdx:\x20profile\x20delete'));if(!profileExists(_0x1b8162)){console['error'](a33_0x177f83[_0x4144f1(0xc3)]('Profile\x20\x27'+_0x1b8162+_0x4144f1(0xb2))),console[_0x4144f1(0xd9)](_0x4144f1(0xa2));const _0x263ca4=listProfiles();if(_0x263ca4['length']===0x0)console[_0x4144f1(0xd9)](_0x4144f1(0x94));else for(const _0x359d49 of _0x263ca4){console[_0x4144f1(0xd9)](_0x4144f1(0xb4)+_0x359d49[_0x4144f1(0xd7)]);}return 0x1;}const _0x426556=await a33_0x1d6e1e({'type':'confirm','name':_0x4144f1(0x8b),'message':_0x4144f1(0x9e)+_0x1b8162+'\x27?','initial':![]});if(!_0x426556[_0x4144f1(0x8b)])return console['log']('Removal\x20cancelled'),0x0;try{await deleteProfileAndCredentials(_0x1b8162),console[_0x4144f1(0xd9)](a33_0x177f83['green']('✓')+_0x4144f1(0xdc)+_0x1b8162+_0x4144f1(0x91));}catch(_0xf13e86){return console[_0x4144f1(0x78)](a33_0x177f83[_0x4144f1(0xc3)]('Failed\x20to\x20delete\x20profile:\x20'+(_0xf13e86 instanceof Error?_0xf13e86[_0x4144f1(0xdd)]:String(_0xf13e86)))),0x1;}return 0x0;}}export class ProfileSetCommand extends BaseCommand{[a33_0x2626bd(0xd7)]=a33_0x2626bd(0x7c);[a33_0x2626bd(0xa6)]='Set\x20a\x20profile\x20configuration\x20value';static [a33_0x2626bd(0x82)]=['site',a33_0x2626bd(0xd4),a33_0x2626bd(0x80),a33_0x2626bd(0xc2),a33_0x2626bd(0x92),a33_0x2626bd(0xa6)];[a33_0x2626bd(0xe0)](_0x50a05a){const _0x4d79a7=a33_0x2626bd,{args:_0x3ced30,options:_0x413955}=_0x50a05a,_0x2ef6b2=_0x413955['profile']||getActiveProfile();if(!_0x2ef6b2)return _0x4d79a7(0xcc);if(_0x3ced30[_0x4d79a7(0xbb)]===0x0)return _0x4d79a7(0x86)+ProfileSetCommand['VALID_KEYS'][_0x4d79a7(0x8a)](',\x20');const _0x2c27fb=_0x3ced30[0x0];if(!_0x2c27fb[_0x4d79a7(0xab)]('='))return _0x4d79a7(0xb6)+ProfileSetCommand[_0x4d79a7(0x82)][_0x4d79a7(0x8a)](',\x20');const [_0xe57de4]=_0x2c27fb[_0x4d79a7(0xa0)]('=',0x2);if(!ProfileSetCommand[_0x4d79a7(0x82)][_0x4d79a7(0xab)](_0xe57de4))return _0x4d79a7(0xe2)+_0xe57de4+_0x4d79a7(0x7b)+ProfileSetCommand[_0x4d79a7(0x82)][_0x4d79a7(0x8a)](',\x20');return undefined;}async[a33_0x2626bd(0x99)](_0x50a2fd){const _0x34cc79=a33_0x2626bd,{args:_0x3a0442,options:_0x120f86}=_0x50a2fd,_0x200459=_0x120f86[_0x34cc79(0xde)]||getActiveProfile(),[_0x5ceb8b,..._0x5466f3]=_0x3a0442[0x0][_0x34cc79(0xa0)]('='),_0x12b8d3=_0x5466f3[_0x34cc79(0x8a)]('=');console['log'](a33_0x177f83[_0x34cc79(0xd3)](_0x34cc79(0x8c)));if(!profileExists(_0x200459)){const _0x34f0c3=await a33_0x1d6e1e({'type':_0x34cc79(0x8b),'name':_0x34cc79(0x81),'message':_0x34cc79(0xd2)+_0x200459+_0x34cc79(0x7f),'initial':!![]});if(!_0x34f0c3[_0x34cc79(0x81)])return console[_0x34cc79(0xd9)](_0x34cc79(0xc7)),0x1;}const _0x19675d=loadProfile(_0x200459),_0x11dd33=_0x19675d?.[_0x34cc79(0xac)]||{};if(_0x5ceb8b===_0x34cc79(0xb5)){const _0x288d11=resolveSite(_0x12b8d3);console[_0x34cc79(0xd9)](_0x34cc79(0xbc)+_0x288d11+_0x34cc79(0x88)),console[_0x34cc79(0xd9)]('\x0aYou\x20can\x20find\x20your\x20API\x20key\x20at:'),console[_0x34cc79(0xd9)]('\x20\x20'+getConsoleUrl(_0x288d11,'/app/mp/ak'));const _0xb6eefe=await a33_0x1d6e1e({'type':'password','name':_0x34cc79(0xad),'message':'Enter\x20your\x20TD\x20API\x20key\x20for\x20the\x20new\x20site:','validate':_0x40f100=>{const _0x5bbe7b=_0x34cc79;if(!_0x40f100||!_0x40f100[_0x5bbe7b(0xa5)]())return _0x5bbe7b(0x9a);return!![];}});if(!_0xb6eefe[_0x34cc79(0xad)])return console[_0x34cc79(0xd9)](_0x34cc79(0x7e)),0x1;console['log'](_0x34cc79(0xa4));try{const _0x343627=TDX['create']({'site':_0x288d11,'apiKey':_0xb6eefe['apiKey'][_0x34cc79(0xa5)](),'logLevel':_0x120f86[_0x34cc79(0x97)]??LogLevel[_0x34cc79(0x93)]}),_0x4bffde=await _0x343627['jobs']['getUserInfo']();console[_0x34cc79(0xd9)](a33_0x177f83['green']('✓')+_0x34cc79(0xb1)+_0x4bffde['email']+')');const _0x545faf=await isKeychainAvailable();_0x545faf?(await saveAPIKeyAsync(_0xb6eefe[_0x34cc79(0xad)][_0x34cc79(0xa5)](),_0x288d11,_0x200459),console[_0x34cc79(0xd9)](a33_0x177f83[_0x34cc79(0xb7)]('✓')+_0x34cc79(0x7d))):console['warn'](a33_0x177f83[_0x34cc79(0xd5)](_0x34cc79(0xbd))),_0x11dd33[_0x34cc79(0xb5)]=_0x288d11;}catch(_0x507b97){if(_0x507b97 instanceof HTTPClientError&&_0x507b97[_0x34cc79(0xe1)]===0x191)return printAuthError(_0x507b97),0x1;return console[_0x34cc79(0x78)](a33_0x177f83['red']('✗\x20Validation\x20failed:\x20'+(_0x507b97 instanceof Error?_0x507b97['message']:String(_0x507b97)))),console[_0x34cc79(0x78)](_0x34cc79(0xdb)),0x1;}}else _0x11dd33[_0x5ceb8b]=_0x12b8d3||undefined;return saveProfileToUserConfig(_0x200459,_0x11dd33),console['log'](a33_0x177f83[_0x34cc79(0xb7)]('✓')+_0x34cc79(0xdc)+_0x200459+'\x27\x20updated:\x20'+_0x5ceb8b+'='+(_0x12b8d3||_0x34cc79(0x9b))),0x0;}}export class ProfileUseCommand extends BaseCommand{[a33_0x2626bd(0xd7)]=a33_0x2626bd(0xbe);[a33_0x2626bd(0xa6)]=a33_0x2626bd(0x8e);[a33_0x2626bd(0xe0)](_0x3af6e8){const {args:_0x334f34}=_0x3af6e8;if(_0x334f34['length']===0x0)return'Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20use\x20<name>\x20[--default]';return undefined;}async[a33_0x2626bd(0x99)](_0x57fabf){const _0x14ff6a=a33_0x2626bd,{args:_0xa261f4,options:_0x58978c}=_0x57fabf,_0x3afd79=_0xa261f4[0x0],_0x35423c=_0x58978c[_0x14ff6a(0xb3)];cleanExpiredSessions();if(!profileExists(_0x3afd79)){console['error'](a33_0x177f83[_0x14ff6a(0xc3)](_0x14ff6a(0xd2)+_0x3afd79+'\x27\x20does\x20not\x20exist.')),console[_0x14ff6a(0xd9)](_0x14ff6a(0xa2));const _0x3d28a1=listProfiles();if(_0x3d28a1[_0x14ff6a(0xbb)]===0x0)console[_0x14ff6a(0xd9)](_0x14ff6a(0x94));else for(const _0x505f4c of _0x3d28a1){console[_0x14ff6a(0xd9)](_0x14ff6a(0xb4)+_0x505f4c[_0x14ff6a(0xd7)]);}return 0x1;}if(_0x35423c){const _0x49c942=a33_0x118b09[_0x14ff6a(0x8a)](getConfigDir(),_0x14ff6a(0xcd));return saveActiveProfileToUserConfig(_0x3afd79),console[_0x14ff6a(0xd9)]('Default\x20profile\x20set\x20to:\x20'+a33_0x177f83['green'](_0x3afd79)),console['log'](a33_0x177f83['dim'](_0x14ff6a(0xa1)+_0x49c942)),0x0;}const _0x88fe4f=getSessionID(_0x58978c['session']);return saveSessionContext({'profile':_0x3afd79},_0x58978c[_0x14ff6a(0xaa)]),console[_0x14ff6a(0xd9)](_0x14ff6a(0x85)+a33_0x177f83[_0x14ff6a(0xb7)](_0x3afd79)+'\x20'+a33_0x177f83[_0x14ff6a(0xa3)](_0x14ff6a(0xa8)+_0x88fe4f+')')),console['log'](a33_0x177f83['dim'](_0x14ff6a(0xba)+_0x3afd79+_0x14ff6a(0xd6))),0x0;}}
1
+ const a33_0x202982=a33_0x25ee;(function(_0x22e431,_0x254b89){const _0x5ce549=a33_0x25ee,_0x292c8b=_0x22e431();while(!![]){try{const _0x141980=-parseInt(_0x5ce549(0xe3))/0x1*(parseInt(_0x5ce549(0xdb))/0x2)+parseInt(_0x5ce549(0xdf))/0x3*(-parseInt(_0x5ce549(0xa1))/0x4)+parseInt(_0x5ce549(0xad))/0x5+parseInt(_0x5ce549(0x94))/0x6+-parseInt(_0x5ce549(0xaa))/0x7*(-parseInt(_0x5ce549(0xaf))/0x8)+-parseInt(_0x5ce549(0xa5))/0x9+parseInt(_0x5ce549(0xc1))/0xa;if(_0x141980===_0x254b89)break;else _0x292c8b['push'](_0x292c8b['shift']());}catch(_0x4390bd){_0x292c8b['push'](_0x292c8b['shift']());}}}(a33_0x2168,0x58c44));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_0x30adf3 from'node:path';import{saveSessionContext,getSessionID,cleanExpiredSessions}from'../core/session.js';import{saveAPIKeyAsync,resolveSite}from'../core/config.js';import{getConsoleUrl}from'../sdk/client/endpoints.js';function a33_0x2168(){const _0x3eca3c=['32puFfuB','Validating\x20API\x20key...','Invalid\x20format.\x20Use:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','test','length','description','\x20--default\x27\x20to\x20save\x20permanently','Are\x20you\x20sure\x20you\x20want\x20to\x20remove\x20profile\x20\x27','validate','includes','\x20\x20tdx\x20--profile\x20','skipExistsCheck','API\x20key\x20cannot\x20be\x20empty','Profile\x20was\x20not\x20created.\x20Please\x20try\x20again.','confirm','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>','us01','error','2226430eRBdAD','Profile\x20name\x20cannot\x20be\x20empty','ERROR','database','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20use\x20<name>\x20[--default]','dim','trim','status','\x20\x20-\x20','all','Removed\x20existing\x20profile\x20\x27','red','logLevel','✗\x20Validation\x20failed:\x20','Site\x20was\x20not\x20changed.','\x27\x20deleted','yellow','Key=value\x20pair\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','split','Setup\x20cancelled','Enter\x20your\x20TD\x20API\x20key:','\x20Profile\x20\x27','Delete\x20a\x20profile','\x27\x20created','/app/mp/ak','getUserInfo','19260lUIHAI','\x27\x20does\x20not\x20exist.','execute','Set\x20session\x20profile','3MXvWpe','profile:set','\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication','profile','48BRKnAw','profile:use','\x27\x20already\x20exists.\x20Use\x20\x27tdx\x20profile\x20delete\x20','Unknown\x20key\x20\x27','Enter\x20description\x20(optional):','\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.','\x0aSetup\x20cancelled','VALID_KEYS','\x20API\x20key\x20is\x20valid\x20(User:\x20','Profile\x20name\x20must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore','\x20API\x20key\x20saved\x20to\x20system\x20keychain\x20(profile:\x20','apiKey','tdx.json','\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases','\x0aOperation\x20cancelled','name','email','bold','profile:delete','config','\x27\x20requires\x20API\x20key\x20validation.','\x20API\x20key\x20saved\x20to\x20system\x20keychain','profileName','message','log','2949648QEfxAz','Profile\x20\x27','\x0aAvailable\x20profiles:','tdx:\x20profile\x20create','\x20\x20(no\x20profiles\x20found)','\x27\x20updated:\x20','password','site','(session:\x20','\x0aTip:\x20Use\x20\x27tdx\x20profile\x20use\x20','You\x20can\x20find\x20your\x20API\x20key\x20at:','\x0aYou\x20can\x20find\x20your\x20API\x20key\x20at:','create','1647196KQhrrg','warn','default','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','2054007Aibmxg','llm_agent','session','Enter\x20your\x20TD\x20API\x20key\x20for\x20the\x20new\x20site:','join','153286uvhhXw','Removal\x20cancelled','green','3320035IXYaDh','jobs'];a33_0x2168=function(){return _0x3eca3c;};return a33_0x2168();}import{deleteKeychainAPIKey,isKeychainAvailable}from'../core/keychain.js';import{deleteOAuthTokens}from'../core/oauth-keychain.js';function a33_0x25ee(_0x30d26a,_0x3c8d46){_0x30d26a=_0x30d26a-0x89;const _0x21682b=a33_0x2168();let _0x25ee0b=_0x21682b[_0x30d26a];return _0x25ee0b;}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_0x4e0524 from'prompts';import a33_0x226709 from'chalk';function validateProfileName(_0x60b061,_0x230f4d){const _0x4c4c8b=a33_0x25ee;if(!_0x60b061||!_0x60b061[_0x4c4c8b(0xc7)]())return _0x4c4c8b(0xc2);const _0x326e57=_0x60b061['trim']();if(!/^[a-zA-Z0-9_-]+$/[_0x4c4c8b(0xb2)](_0x326e57))return _0x4c4c8b(0xec);if(!_0x230f4d?.[_0x4c4c8b(0xba)]&&profileExists(_0x326e57))return _0x4c4c8b(0x95)+_0x326e57+_0x4c4c8b(0xe5)+_0x326e57+'\x27\x20to\x20remove\x20it\x20first,\x20or\x20re-create\x20with\x20--force.';return!![];}async function deleteProfileAndCredentials(_0x29d3e7){const _0x13ea95=a33_0x25ee;removeProfileFromUserConfig(_0x29d3e7);const _0x45cf4d=await isKeychainAvailable();_0x45cf4d&&await Promise[_0x13ea95(0xca)]([deleteKeychainAPIKey(_0x29d3e7),deleteOAuthTokens(_0x29d3e7)]);}export class ProfileCreateCommand extends BaseCommand{['name']='profile:create';[a33_0x202982(0xb4)]='Create\x20a\x20new\x20profile';async[a33_0x202982(0xdd)](_0xafc7ac){const _0x14f6e3=a33_0x202982,{options:_0x50efd8,args:_0x47f063}=_0xafc7ac,_0x5a8270=!!_0x50efd8['force'];console[_0x14f6e3(0x93)](a33_0x226709[_0x14f6e3(0x8c)](_0x14f6e3(0x97)));let _0x264fe4;if(_0x47f063[_0x14f6e3(0xb3)]>0x0&&_0x47f063[0x0]){const _0x16fdc6=_0x47f063[0x0][_0x14f6e3(0xc7)]();_0x5a8270&&profileExists(_0x16fdc6)&&(await deleteProfileAndCredentials(_0x16fdc6),console[_0x14f6e3(0x93)](_0x14f6e3(0xcb)+_0x16fdc6+'\x27'));const _0x2efcdd=validateProfileName(_0x16fdc6);if(_0x2efcdd!==!![])return console['error'](a33_0x226709[_0x14f6e3(0xcc)](_0x2efcdd)),0x1;_0x264fe4=_0x16fdc6;}else{const _0xd4134a=await a33_0x4e0524({'type':'text','name':'profileName','message':'Enter\x20profile\x20name:','validate':_0x4f2fd4=>validateProfileName(_0x4f2fd4,{'skipExistsCheck':_0x5a8270})});if(!_0xd4134a[_0x14f6e3(0x91)])return console['log'](_0x14f6e3(0xe9)),0x1;_0x264fe4=_0xd4134a[_0x14f6e3(0x91)][_0x14f6e3(0xc7)](),_0x5a8270&&profileExists(_0x264fe4)&&(await deleteProfileAndCredentials(_0x264fe4),console[_0x14f6e3(0x93)](_0x14f6e3(0xcb)+_0x264fe4+'\x27'));}const _0x4fd3c0=await a33_0x4e0524({'type':'text','name':_0x14f6e3(0xb4),'message':_0x14f6e3(0xe7)}),_0x2b1ce1=_0x4fd3c0['description']?.[_0x14f6e3(0xc7)]()||undefined,_0x59d3db=_0x50efd8[_0x14f6e3(0x9b)]||_0x14f6e3(0xbf),_0x55c8a8=await promptSiteSelection(_0x59d3db,_0x264fe4,_0x14f6e3(0xd4));if(!_0x55c8a8)return 0x1;const _0x2f3f10=resolveSite(_0x55c8a8),_0xd308e1=await promptAuthMethod();if(!_0xd308e1)return console['log'](_0x14f6e3(0xe9)),0x1;if(_0xd308e1==='oauth'){if(_0x2b1ce1){const _0x300438={'site':_0x2f3f10,'description':_0x2b1ce1};saveProfileToUserConfig(_0x264fe4,_0x300438);}const {accountName:_0x181b0d}=_0x50efd8;return await runOAuthLoginFlow(_0x2f3f10,_0x264fe4,_0x50efd8['logLevel']??LogLevel[_0x14f6e3(0xc3)],{'accountName':_0x181b0d}),0x0;}console[_0x14f6e3(0x93)]('\x0aSetting\x20up\x20authentication\x20for\x20site:\x20'+_0x2f3f10),console[_0x14f6e3(0x93)](_0x14f6e3(0x9e)),console[_0x14f6e3(0x93)]('\x20\x20'+getConsoleUrl(_0x2f3f10,_0x14f6e3(0xd9)));const _0x1a4b6c=await a33_0x4e0524({'type':'password','name':_0x14f6e3(0xee),'message':_0x14f6e3(0xd5),'validate':_0x37e3cf=>{const _0x46b2b7=_0x14f6e3;if(!_0x37e3cf||!_0x37e3cf['trim']())return _0x46b2b7(0xbb);return!![];}});if(!_0x1a4b6c[_0x14f6e3(0xee)])return console[_0x14f6e3(0x93)](_0x14f6e3(0xe9)),0x1;const _0x5131b5=_0x1a4b6c[_0x14f6e3(0xee)];console['log'](_0x14f6e3(0xb0));try{const _0x47fbe8=TDX['create']({'site':_0x2f3f10,'apiKey':_0x5131b5['trim'](),'logLevel':_0x50efd8[_0x14f6e3(0xcd)]??LogLevel['ERROR']}),_0x572011=await _0x47fbe8[_0x14f6e3(0xae)][_0x14f6e3(0xda)]();console[_0x14f6e3(0x93)](a33_0x226709[_0x14f6e3(0xac)]('✓')+'\x20API\x20key\x20is\x20valid\x20(User:\x20'+_0x572011[_0x14f6e3(0x8b)]+')');const _0x2edee1=await isKeychainAvailable();_0x2edee1?(await saveAPIKeyAsync(_0x5131b5['trim'](),_0x2f3f10,_0x264fe4),console['log'](a33_0x226709['green']('✓')+_0x14f6e3(0xed)+_0x264fe4+')')):(console['warn'](a33_0x226709[_0x14f6e3(0xd1)](_0x14f6e3(0xa4))),console[_0x14f6e3(0xa2)](a33_0x226709[_0x14f6e3(0xd1)](_0x14f6e3(0xe8))));const _0x2400b5={'site':_0x2f3f10,..._0x2b1ce1&&{'description':_0x2b1ce1}};return saveProfileToUserConfig(_0x264fe4,_0x2400b5),console[_0x14f6e3(0x93)](a33_0x226709[_0x14f6e3(0xac)]('✓')+'\x20Profile\x20\x27'+_0x264fe4+_0x14f6e3(0xd8)),console['log'](),console['log']('You\x20can\x20now\x20use\x20tdx\x20commands\x20with\x20this\x20profile.\x20Try:'),console[_0x14f6e3(0x93)](_0x14f6e3(0xb9)+_0x264fe4+_0x14f6e3(0xe1)),console[_0x14f6e3(0x93)]('\x20\x20tdx\x20--profile\x20'+_0x264fe4+_0x14f6e3(0xf0)),0x0;}catch(_0x520f69){if(_0x520f69 instanceof HTTPClientError&&_0x520f69[_0x14f6e3(0xc8)]===0x191)return printAuthError(_0x520f69),0x1;return console[_0x14f6e3(0xc0)](a33_0x226709[_0x14f6e3(0xcc)](_0x14f6e3(0xce)+(_0x520f69 instanceof Error?_0x520f69[_0x14f6e3(0x92)]:String(_0x520f69)))),console[_0x14f6e3(0xc0)](_0x14f6e3(0xbc)),0x1;}}}export class ProfileDeleteCommand extends BaseCommand{[a33_0x202982(0x8a)]=a33_0x202982(0x8d);[a33_0x202982(0xb4)]=a33_0x202982(0xd7);['validate'](_0x4406ec){const _0x501cb5=a33_0x202982,{args:_0x498f44}=_0x4406ec;if(_0x498f44[_0x501cb5(0xb3)]===0x0)return'Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20delete\x20<name>';return undefined;}async[a33_0x202982(0xdd)](_0x509b20){const _0x2216d1=a33_0x202982,{args:_0x29e41a}=_0x509b20,_0x32f960=_0x29e41a[0x0];console['log'](a33_0x226709[_0x2216d1(0x8c)]('tdx:\x20profile\x20delete'));if(!profileExists(_0x32f960)){console[_0x2216d1(0xc0)](a33_0x226709[_0x2216d1(0xcc)](_0x2216d1(0x95)+_0x32f960+'\x27\x20does\x20not\x20exist.')),console['log'](_0x2216d1(0x96));const _0xdaabb6=listProfiles();if(_0xdaabb6[_0x2216d1(0xb3)]===0x0)console[_0x2216d1(0x93)](_0x2216d1(0x98));else for(const _0x473843 of _0xdaabb6){console['log'](_0x2216d1(0xc9)+_0x473843['name']);}return 0x1;}const _0x139dc2=await a33_0x4e0524({'type':_0x2216d1(0xbd),'name':_0x2216d1(0xbd),'message':_0x2216d1(0xb6)+_0x32f960+'\x27?','initial':![]});if(!_0x139dc2[_0x2216d1(0xbd)])return console['log'](_0x2216d1(0xab)),0x0;try{await deleteProfileAndCredentials(_0x32f960),console['log'](a33_0x226709['green']('✓')+_0x2216d1(0xd6)+_0x32f960+_0x2216d1(0xd0));}catch(_0x4ef795){return console[_0x2216d1(0xc0)](a33_0x226709[_0x2216d1(0xcc)]('Failed\x20to\x20delete\x20profile:\x20'+(_0x4ef795 instanceof Error?_0x4ef795[_0x2216d1(0x92)]:String(_0x4ef795)))),0x1;}return 0x0;}}export class ProfileSetCommand extends BaseCommand{[a33_0x202982(0x8a)]=a33_0x202982(0xe0);[a33_0x202982(0xb4)]='Set\x20a\x20profile\x20configuration\x20value';static [a33_0x202982(0xea)]=[a33_0x202982(0x9b),a33_0x202982(0xc4),'parent_segment','llm_project',a33_0x202982(0xa6),a33_0x202982(0xb4)];[a33_0x202982(0xb7)](_0x7ed72c){const _0x4ce011=a33_0x202982,{args:_0x39172,options:_0x485c76}=_0x7ed72c,_0x3e745e=_0x485c76[_0x4ce011(0xe2)]||getActiveProfile();if(!_0x3e745e)return _0x4ce011(0xbe);if(_0x39172['length']===0x0)return _0x4ce011(0xd2)+ProfileSetCommand['VALID_KEYS'][_0x4ce011(0xa9)](',\x20');const _0x22eaaf=_0x39172[0x0];if(!_0x22eaaf['includes']('='))return _0x4ce011(0xb1)+ProfileSetCommand[_0x4ce011(0xea)][_0x4ce011(0xa9)](',\x20');const [_0x902b24]=_0x22eaaf[_0x4ce011(0xd3)]('=',0x2);if(!ProfileSetCommand[_0x4ce011(0xea)][_0x4ce011(0xb8)](_0x902b24))return _0x4ce011(0xe6)+_0x902b24+'\x27.\x0a\x0aValid\x20keys:\x20'+ProfileSetCommand[_0x4ce011(0xea)]['join'](',\x20');return undefined;}async[a33_0x202982(0xdd)](_0x2a1605){const _0x5d476e=a33_0x202982,{args:_0x4daca1,options:_0x198a4b}=_0x2a1605,_0x44cba6=_0x198a4b[_0x5d476e(0xe2)]||getActiveProfile(),[_0xb51b24,..._0x5138b4]=_0x4daca1[0x0][_0x5d476e(0xd3)]('='),_0x4d7fe8=_0x5138b4['join']('=');console[_0x5d476e(0x93)](a33_0x226709[_0x5d476e(0x8c)]('tdx:\x20profile\x20set'));if(!profileExists(_0x44cba6)){const _0x23057d=await a33_0x4e0524({'type':'confirm','name':_0x5d476e(0xa0),'message':_0x5d476e(0x95)+_0x44cba6+'\x27\x20does\x20not\x20exist.\x20Create\x20it?','initial':!![]});if(!_0x23057d[_0x5d476e(0xa0)])return console[_0x5d476e(0x93)]('Operation\x20cancelled'),0x1;}const _0x5f34a1=loadProfile(_0x44cba6),_0x354381=_0x5f34a1?.[_0x5d476e(0x8e)]||{};if(_0xb51b24===_0x5d476e(0x9b)){const _0x1104cd=resolveSite(_0x4d7fe8);console[_0x5d476e(0x93)]('Changing\x20site\x20to\x20\x27'+_0x1104cd+_0x5d476e(0x8f)),console[_0x5d476e(0x93)](_0x5d476e(0x9f)),console[_0x5d476e(0x93)]('\x20\x20'+getConsoleUrl(_0x1104cd,_0x5d476e(0xd9)));const _0x33bd20=await a33_0x4e0524({'type':_0x5d476e(0x9a),'name':'apiKey','message':_0x5d476e(0xa8),'validate':_0x215430=>{const _0x739a7e=_0x5d476e;if(!_0x215430||!_0x215430[_0x739a7e(0xc7)]())return _0x739a7e(0xbb);return!![];}});if(!_0x33bd20[_0x5d476e(0xee)])return console['log'](_0x5d476e(0x89)),0x1;console['log']('Validating\x20API\x20key...');try{const _0x21d872=TDX[_0x5d476e(0xa0)]({'site':_0x1104cd,'apiKey':_0x33bd20[_0x5d476e(0xee)][_0x5d476e(0xc7)](),'logLevel':_0x198a4b[_0x5d476e(0xcd)]??LogLevel[_0x5d476e(0xc3)]}),_0x12d126=await _0x21d872['jobs'][_0x5d476e(0xda)]();console[_0x5d476e(0x93)](a33_0x226709['green']('✓')+_0x5d476e(0xeb)+_0x12d126[_0x5d476e(0x8b)]+')');const _0x575680=await isKeychainAvailable();_0x575680?(await saveAPIKeyAsync(_0x33bd20['apiKey'][_0x5d476e(0xc7)](),_0x1104cd,_0x44cba6),console[_0x5d476e(0x93)](a33_0x226709['green']('✓')+_0x5d476e(0x90))):console['warn'](a33_0x226709[_0x5d476e(0xd1)](_0x5d476e(0xa4))),_0x354381[_0x5d476e(0x9b)]=_0x1104cd;}catch(_0x4a6f68){if(_0x4a6f68 instanceof HTTPClientError&&_0x4a6f68[_0x5d476e(0xc8)]===0x191)return printAuthError(_0x4a6f68),0x1;return console['error'](a33_0x226709[_0x5d476e(0xcc)](_0x5d476e(0xce)+(_0x4a6f68 instanceof Error?_0x4a6f68['message']:String(_0x4a6f68)))),console['error'](_0x5d476e(0xcf)),0x1;}}else _0x354381[_0xb51b24]=_0x4d7fe8||undefined;return saveProfileToUserConfig(_0x44cba6,_0x354381),console[_0x5d476e(0x93)](a33_0x226709[_0x5d476e(0xac)]('✓')+'\x20Profile\x20\x27'+_0x44cba6+_0x5d476e(0x99)+_0xb51b24+'='+(_0x4d7fe8||'(cleared)')),0x0;}}export class ProfileUseCommand extends BaseCommand{['name']=a33_0x202982(0xe4);[a33_0x202982(0xb4)]=a33_0x202982(0xde);[a33_0x202982(0xb7)](_0x2d9919){const _0x2ae584=a33_0x202982,{args:_0xee7734}=_0x2d9919;if(_0xee7734['length']===0x0)return _0x2ae584(0xc5);return undefined;}async[a33_0x202982(0xdd)](_0x449b72){const _0x354190=a33_0x202982,{args:_0x51dd6a,options:_0x5d3464}=_0x449b72,_0xcb8905=_0x51dd6a[0x0],_0x3be44c=_0x5d3464[_0x354190(0xa3)];cleanExpiredSessions();if(!profileExists(_0xcb8905)){console[_0x354190(0xc0)](a33_0x226709[_0x354190(0xcc)](_0x354190(0x95)+_0xcb8905+_0x354190(0xdc))),console[_0x354190(0x93)](_0x354190(0x96));const _0x181fc4=listProfiles();if(_0x181fc4[_0x354190(0xb3)]===0x0)console[_0x354190(0x93)](_0x354190(0x98));else for(const _0x3e2e9a of _0x181fc4){console[_0x354190(0x93)](_0x354190(0xc9)+_0x3e2e9a[_0x354190(0x8a)]);}return 0x1;}if(_0x3be44c){const _0x6e21aa=a33_0x30adf3[_0x354190(0xa9)](getConfigDir(),_0x354190(0xef));return saveActiveProfileToUserConfig(_0xcb8905),console[_0x354190(0x93)]('Default\x20profile\x20set\x20to:\x20'+a33_0x226709[_0x354190(0xac)](_0xcb8905)),console['log'](a33_0x226709[_0x354190(0xc6)]('\x0aSaved\x20to:\x20'+_0x6e21aa)),0x0;}const _0x9bafa8=getSessionID(_0x5d3464['session']);return saveSessionContext({'profile':_0xcb8905},_0x5d3464[_0x354190(0xa7)]),console[_0x354190(0x93)]('Session\x20profile\x20set\x20to:\x20'+a33_0x226709['green'](_0xcb8905)+'\x20'+a33_0x226709[_0x354190(0xc6)](_0x354190(0x9c)+_0x9bafa8+')')),console['log'](a33_0x226709[_0x354190(0xc6)](_0x354190(0x9d)+_0xcb8905+_0x354190(0xb5))),0x0;}}
@@ -1 +1 @@
1
- const a34_0x1bb92b=a34_0x34d8;(function(_0x5d9e21,_0x5de1fd){const _0x998965=a34_0x34d8,_0x1ccaef=_0x5d9e21();while(!![]){try{const _0x251dfe=-parseInt(_0x998965(0x1c2))/0x1*(parseInt(_0x998965(0x1da))/0x2)+-parseInt(_0x998965(0x1ce))/0x3*(-parseInt(_0x998965(0x1cf))/0x4)+parseInt(_0x998965(0x1d8))/0x5*(-parseInt(_0x998965(0x1d5))/0x6)+parseInt(_0x998965(0x1d2))/0x7*(-parseInt(_0x998965(0x1c5))/0x8)+-parseInt(_0x998965(0x1d1))/0x9*(parseInt(_0x998965(0x1d0))/0xa)+-parseInt(_0x998965(0x1db))/0xb+parseInt(_0x998965(0x1d6))/0xc;if(_0x251dfe===_0x5de1fd)break;else _0x1ccaef['push'](_0x1ccaef['shift']());}catch(_0x52359d){_0x1ccaef['push'](_0x1ccaef['shift']());}}}(a34_0x4880,0x5c1c4));import{BaseCommand}from'./command.js';function a34_0x4880(){const _0x297392=['7454rckLNi','scope','execute','5621824DKrzBu','description','profiles','Error:\x20','length','config','site','👤\x20','dim','62634fNNFyy','128WqEATM','6076250kELpxd','9bfQuVd','7nQDoAr','log','map','367230qRJSss','26653452lJQKMK','\x20\x20Global:\x20~/.config/tdx/tdx.json','10PHWZNI','green','150gNhzhI','5721320tZGsYC','List\x20all\x20available\x20profiles','error','name','\x20\x20Local:\x20\x20(project\x20folder)/tdx.json','No\x20profiles\x20found.\x20Define\x20profiles\x20in\x20tdx.json:\x0a'];a34_0x4880=function(){return _0x297392;};return a34_0x4880();}import{listProfiles,getActiveProfile,getProfileParams}from'../core/profile.js';function a34_0x34d8(_0x57e7f0,_0x437ebd){_0x57e7f0=_0x57e7f0-0x1bf;const _0x488089=a34_0x4880();let _0x34d8a9=_0x488089[_0x57e7f0];return _0x34d8a9;}import{handleSDKOutput,isStructuredFormat}from'../core/command-output.js';import a34_0x319cd5 from'chalk';export class ProfilesCommand extends BaseCommand{[a34_0x1bb92b(0x1bf)]=a34_0x1bb92b(0x1c7);[a34_0x1bb92b(0x1c6)]=a34_0x1bb92b(0x1dc);async[a34_0x1bb92b(0x1c4)](_0x3c5ad3){const _0x5140db=a34_0x1bb92b,{options:_0x2d9550}=_0x3c5ad3;try{const _0x241fef=listProfiles(),_0xf908c3=getActiveProfile();if(_0x241fef[_0x5140db(0x1c9)]===0x0)return console[_0x5140db(0x1d3)](_0x5140db(0x1c1)),console[_0x5140db(0x1d3)](_0x5140db(0x1c0)),console[_0x5140db(0x1d3)](_0x5140db(0x1d7)),0x0;const _0x188325=_0x241fef[_0x5140db(0x1d4)](_0x2c06ef=>{const _0x4b1ebc=_0x5140db,_0x16da2b=_0x2c06ef[_0x4b1ebc(0x1bf)]===_0xf908c3,_0x39fb75=getProfileParams(_0x2c06ef[_0x4b1ebc(0x1ca)]);return{'name':_0x2c06ef[_0x4b1ebc(0x1bf)],'active':_0x16da2b,'scope':_0x2c06ef[_0x4b1ebc(0x1c3)],'description':_0x2c06ef['config'][_0x4b1ebc(0x1c6)]||'','params':_0x39fb75};});if(isStructuredFormat(_0x2d9550))await handleSDKOutput(_0x188325,_0x2d9550);else for(const _0x44fe82 of _0x241fef){const _0xff20ca=_0x44fe82[_0x5140db(0x1bf)]===_0xf908c3?a34_0x319cd5[_0x5140db(0x1d9)]('\x20✓'):'',_0x59a50b=_0x44fe82[_0x5140db(0x1ca)][_0x5140db(0x1cb)]?a34_0x319cd5['dim']('\x20'+_0x44fe82['config'][_0x5140db(0x1cb)]):'',_0x452cb9=_0x44fe82[_0x5140db(0x1ca)][_0x5140db(0x1c6)]?a34_0x319cd5[_0x5140db(0x1cd)]('\x20\x20'+_0x44fe82[_0x5140db(0x1ca)]['description']):'';console[_0x5140db(0x1d3)](_0x5140db(0x1cc)+_0x44fe82['name']+_0xff20ca+_0x59a50b+_0x452cb9);}return 0x0;}catch(_0x102695){return _0x102695 instanceof Error&&console[_0x5140db(0x1dd)](_0x5140db(0x1c8)+_0x102695['message']),0x1;}}}
1
+ const a34_0x548bec=a34_0x1297;(function(_0x4a645f,_0x509bec){const _0x2c5f8c=a34_0x1297,_0x4e875f=_0x4a645f();while(!![]){try{const _0x32fd71=-parseInt(_0x2c5f8c(0xf4))/0x1*(parseInt(_0x2c5f8c(0xfb))/0x2)+-parseInt(_0x2c5f8c(0xfc))/0x3+parseInt(_0x2c5f8c(0xfa))/0x4*(parseInt(_0x2c5f8c(0xeb))/0x5)+-parseInt(_0x2c5f8c(0xf8))/0x6+parseInt(_0x2c5f8c(0xf6))/0x7+parseInt(_0x2c5f8c(0xea))/0x8+parseInt(_0x2c5f8c(0xf0))/0x9;if(_0x32fd71===_0x509bec)break;else _0x4e875f['push'](_0x4e875f['shift']());}catch(_0x575a1c){_0x4e875f['push'](_0x4e875f['shift']());}}}(a34_0x1b74,0xc14fa));import{BaseCommand}from'./command.js';import{listProfiles,getActiveProfile,getProfileParams}from'../core/profile.js';import{handleSDKOutput,isStructuredFormat}from'../core/command-output.js';function a34_0x1297(_0x52b49f,_0x14f8c7){_0x52b49f=_0x52b49f-0xe6;const _0x1b744b=a34_0x1b74();let _0x12972c=_0x1b744b[_0x52b49f];return _0x12972c;}import a34_0x43a0c9 from'chalk';export class ProfilesCommand extends BaseCommand{[a34_0x548bec(0x100)]=a34_0x548bec(0xe9);[a34_0x548bec(0xf3)]=a34_0x548bec(0xee);async[a34_0x548bec(0xe6)](_0x20a8f4){const _0x395ae0=a34_0x548bec,{options:_0x303d7d}=_0x20a8f4;try{const _0x195006=listProfiles(),_0x45d248=getActiveProfile();if(_0x195006[_0x395ae0(0x101)]===0x0)return console[_0x395ae0(0xe7)](_0x395ae0(0xf7)),console['log'](_0x395ae0(0xef)),console[_0x395ae0(0xe7)](_0x395ae0(0xf9)),0x0;const _0x4776a9=_0x195006[_0x395ae0(0xed)](_0xc9c75d=>{const _0xc8d4a7=_0x395ae0,_0xa837f2=_0xc9c75d['name']===_0x45d248,_0x2e68c0=getProfileParams(_0xc9c75d[_0xc8d4a7(0xe8)]);return{'name':_0xc9c75d[_0xc8d4a7(0x100)],'active':_0xa837f2,'scope':_0xc9c75d[_0xc8d4a7(0xf5)],'description':_0xc9c75d[_0xc8d4a7(0xe8)][_0xc8d4a7(0xf3)]||'','params':_0x2e68c0};});if(isStructuredFormat(_0x303d7d))await handleSDKOutput(_0x4776a9,_0x303d7d);else for(const _0x1ab07d of _0x195006){const _0x42f108=_0x1ab07d[_0x395ae0(0x100)]===_0x45d248?a34_0x43a0c9['green']('\x20✓'):'',_0x2d97b3=_0x1ab07d[_0x395ae0(0xe8)][_0x395ae0(0xfe)]?a34_0x43a0c9[_0x395ae0(0xf1)]('\x20'+_0x1ab07d[_0x395ae0(0xe8)][_0x395ae0(0xfe)]):'',_0xc5b1fb=_0x1ab07d['config'][_0x395ae0(0xf3)]?a34_0x43a0c9['dim']('\x20\x20'+_0x1ab07d[_0x395ae0(0xe8)][_0x395ae0(0xf3)]):'';console[_0x395ae0(0xe7)](_0x395ae0(0xf2)+_0x1ab07d['name']+_0x42f108+_0x2d97b3+_0xc5b1fb);}return 0x0;}catch(_0x9f621f){return _0x9f621f instanceof Error&&console[_0x395ae0(0xec)](_0x395ae0(0xfd)+_0x9f621f[_0x395ae0(0xff)]),0x1;}}}function a34_0x1b74(){const _0x4e9982=['6980322setDPh','\x20\x20Global:\x20~/.config/tdx/tdx.json','5180DlBxVB','3117454UeTBkl','510240KEMtQL','Error:\x20','site','message','name','length','execute','log','config','profiles','6287616MgHSAO','3145mLgVpr','error','map','List\x20all\x20available\x20profiles','\x20\x20Local:\x20\x20(project\x20folder)/tdx.json','18507177LlfmdE','dim','👤\x20','description','1DCDbja','scope','189952mEfwTy','No\x20profiles\x20found.\x20Define\x20profiles\x20in\x20tdx.json:\x0a'];a34_0x1b74=function(){return _0x4e9982;};return a34_0x1b74();}
@@ -1 +1 @@
1
- const a35_0x13aa8b=a35_0xd0ba;(function(_0x30e56d,_0xab3912){const _0x49249d=a35_0xd0ba,_0x54bb31=_0x30e56d();while(!![]){try{const _0x419a5a=-parseInt(_0x49249d(0x19d))/0x1+-parseInt(_0x49249d(0x1bd))/0x2+-parseInt(_0x49249d(0x1bf))/0x3+-parseInt(_0x49249d(0x1d1))/0x4+parseInt(_0x49249d(0x1c7))/0x5*(parseInt(_0x49249d(0x1d0))/0x6)+parseInt(_0x49249d(0x1a8))/0x7*(-parseInt(_0x49249d(0x1ae))/0x8)+-parseInt(_0x49249d(0x1a5))/0x9*(-parseInt(_0x49249d(0x19f))/0xa);if(_0x419a5a===_0xab3912)break;else _0x54bb31['push'](_0x54bb31['shift']());}catch(_0x4afaae){_0x54bb31['push'](_0x54bb31['shift']());}}}(a35_0x4438,0x9c18e));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';import{handleQueryOutput,formatQueryOutput,resolveOutputOptions}from'../core/command-output.js';import{readSqlStatementsFromFile,readSqlStatementsFromStdin,splitSqlStatements,isSqlFilePath}from'../sdk/query/sql-parser.js';import{writeFileSync}from'fs';import{withProgressSpinner,formatElapsed}from'../utils/spinner.js';import{formatRows}from'../sdk/util/formatters.js';function a35_0xd0ba(_0x1699b9,_0x660f11){_0x1699b9=_0x1699b9-0x19d;const _0x443855=a35_0x4438();let _0xd0ba96=_0x443855[_0x1699b9];return _0xd0ba96;}export class QueryCommand extends BaseCommand{[a35_0x13aa8b(0x1b4)]=a35_0x13aa8b(0x1ac);['description']='Run\x20Trino\x20queries\x20(streaming)';async[a35_0x13aa8b(0x1a1)](_0x154409){const _0x1144f9=a35_0x13aa8b,{options:_0x10a15d,args:_0x1179f6,tdx:_0x51fbf8}=_0x154409,_0x46a57b={..._0x10a15d,'limitStructuredFormats':!![]},_0x47dc4f=_0x1179f6[0x0],_0x1058f1=_0x10a15d['file'];let _0x319fe9;try{if(_0x1058f1)_0x319fe9=readSqlStatementsFromFile(_0x1058f1);else{if(_0x47dc4f==='-')_0x319fe9=await readSqlStatementsFromStdin();else{if(_0x47dc4f&&isSqlFilePath(_0x47dc4f))_0x319fe9=readSqlStatementsFromFile(_0x47dc4f);else{if(_0x47dc4f)_0x319fe9=splitSqlStatements(_0x47dc4f);else throw new Error(_0x1144f9(0x1cd));}}}}catch(_0x4a3ff9){return console[_0x1144f9(0x1ba)]('Error:\x20'+_0x4a3ff9['message']),0x1;}const _0x201741=_0x10a15d[_0x1144f9(0x1b3)]||_0x1144f9(0x1a3),_0x435937=_0x10a15d[_0x1144f9(0x1c9)];try{const _0x5b6e6f=[],_0x5f58e7=!!_0x10a15d[_0x1144f9(0x1a6)];for(let _0x349950=0x0;_0x349950<_0x319fe9['length'];_0x349950++){const _0x523a9b=_0x319fe9[_0x349950],_0x5ed009=_0x349950+0x1,_0x2a7ae5=_0x319fe9[_0x1144f9(0x1a9)],_0x2e601c=_0x2a7ae5>0x1;_0x10a15d['verbose']&&(console[_0x1144f9(0x1ba)]('\x0a'+(_0x2e601c?_0x1144f9(0x1cf)+_0x5ed009+'/'+_0x2a7ae5+':':'')),console['error'](_0x1144f9(0x1bc)+_0x10a15d[_0x1144f9(0x1b7)]),console[_0x1144f9(0x1ba)](_0x1144f9(0x1a7)+(_0x435937||'td')),console[_0x1144f9(0x1ba)](_0x1144f9(0x1c4)+_0x201741),console[_0x1144f9(0x1ba)](_0x1144f9(0x1b9)+_0x523a9b));const _0x1fbbdd=_0x2e601c?_0x1144f9(0x1c1)+_0x5ed009+'/'+_0x2a7ae5+'...':_0x1144f9(0x1cb);try{const _0x51df6c=await withProgressSpinner(_0x1fbbdd,async _0x5a68fb=>{const _0x5e0b0a=_0x1144f9,_0x5346e9=await _0x51fbf8[_0x5e0b0a(0x1ac)][_0x5e0b0a(0x1a1)](_0x523a9b,{'catalog':_0x435937,'schema':_0x201741,'onJobId':_0x6e77c=>{const _0x536f7f=_0x5e0b0a;_0x5a68fb[_0x536f7f(0x1c0)](_0x6e77c);},'onProgress':_0x4d4b64=>{const _0x5c2c45=_0x5e0b0a;_0x5a68fb[_0x5c2c45(0x1cc)](_0x5c2c45(0x1bb)+_0x4d4b64[_0x5c2c45(0x1ca)]+']'),_0x5a68fb[_0x5c2c45(0x1be)](formatRows(_0x4d4b64['processedRows'])+'\x20rows\x20'+_0x4d4b64[_0x5c2c45(0x1b1)]+'/'+_0x4d4b64['totalSplits']+_0x5c2c45(0x1aa));}});return _0x5346e9;},{'verbose':_0x10a15d['verbose']}),_0x256d08=_0x51df6c[_0x1144f9(0x1a0)],_0x2ca50a=_0x256d08[_0x1144f9(0x1c5)]?'\x20[Job\x20ID:\x20'+_0x256d08['jobId']+']':'',_0x4b4345=_0x2e601c?_0x1144f9(0x1cf)+_0x5ed009+'/'+_0x2a7ae5+_0x1144f9(0x1b8):'';console[_0x1144f9(0x1ba)]('✔\x20'+_0x4b4345+_0x1144f9(0x1a4)+formatRows(_0x256d08['stats'][_0x1144f9(0x19e)])+'\x20rows\x20'+(_0x1144f9(0x1b0)+formatElapsed(_0x256d08[_0x1144f9(0x1b5)][_0x1144f9(0x1b6)])+_0x2ca50a));if(_0x2e601c&&_0x5f58e7){const _0x5605cf=resolveOutputOptions(_0x46a57b),_0x5928e7=await formatQueryOutput(_0x256d08,_0x5605cf);_0x5b6e6f[_0x1144f9(0x1ab)](_0x5928e7);}else await handleQueryOutput(_0x256d08,_0x46a57b);}catch(_0xd7aa8){const _0x458c05=_0x2e601c?'Statement\x20'+_0x5ed009+'/'+_0x2a7ae5+':\x0a':'',_0x3e2dbe=_0xd7aa8 instanceof SDKError?_0xd7aa8[_0x1144f9(0x1c3)]:_0xd7aa8[_0x1144f9(0x1b2)];return console['error'](''+_0x458c05+_0x3e2dbe),0x1;}}if(_0x319fe9[_0x1144f9(0x1a9)]>0x1&&_0x5f58e7&&_0x5b6e6f[_0x1144f9(0x1a9)]>0x0){const _0x1d345e=_0x5b6e6f[_0x1144f9(0x1ce)]('\x0a');writeFileSync(_0x10a15d['output'],_0x1d345e),console['error'](_0x1144f9(0x1c2)+_0x10a15d['output']);}return 0x0;}catch(_0x3d7827){throw _0x3d7827;}}[a35_0x13aa8b(0x1ad)](_0x31ffe7){const _0x132336=a35_0x13aa8b,_0x4fed1e=_0x31ffe7['args'][0x0],_0x3ee38a=_0x31ffe7[_0x132336(0x1af)][_0x132336(0x1c6)];if(!_0x4fed1e&&!_0x3ee38a)return _0x132336(0x1c8);if(_0x4fed1e&&_0x3ee38a)return _0x132336(0x1a2);return undefined;}}function a35_0x4438(){const _0x5aa12e=['validate','6409872naCogv','options','in\x20','completedSplits','message','database','name','stats','elapsedTimeMillis','site','\x20-\x20','SQL:\x20','error','Executing\x20query\x20[','Site:\x20','1955128UZQuPk','setExtra','2750973oGxDIf','setJobId','Executing\x20statement\x20','\x0aAll\x20results\x20saved\x20to\x20','originalMessage','Schema:\x20','jobId','file','4567895AQOPHA','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','catalog','state','Executing\x20query...','setPhase','No\x20SQL\x20provided','join','Statement\x20','6LdKZoo','1266432GjAIAQ','173812yxvCLV','processedRows','539260GqZZNW','data','execute','Cannot\x20specify\x20both\x20SQL\x20argument\x20and\x20--file\x20option','information_schema','Query\x20completed:\x20Processed\x20','486YCggfu','output','Catalog:\x20','7srhXfd','length','\x20splits','push','query'];a35_0x4438=function(){return _0x5aa12e;};return a35_0x4438();}
1
+ const a35_0x2c84a7=a35_0x1a27;(function(_0x14fc15,_0x480016){const _0x3d295e=a35_0x1a27,_0x406f54=_0x14fc15();while(!![]){try{const _0x4cd62d=parseInt(_0x3d295e(0x19a))/0x1+parseInt(_0x3d295e(0x1c7))/0x2+-parseInt(_0x3d295e(0x1c0))/0x3*(-parseInt(_0x3d295e(0x1b4))/0x4)+-parseInt(_0x3d295e(0x1bb))/0x5*(-parseInt(_0x3d295e(0x1c3))/0x6)+-parseInt(_0x3d295e(0x1a5))/0x7+-parseInt(_0x3d295e(0x1ca))/0x8*(parseInt(_0x3d295e(0x1ba))/0x9)+-parseInt(_0x3d295e(0x1a7))/0xa;if(_0x4cd62d===_0x480016)break;else _0x406f54['push'](_0x406f54['shift']());}catch(_0x27dd20){_0x406f54['push'](_0x406f54['shift']());}}}(a35_0x4e85,0x1b2fd));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';import{handleQueryOutput,formatQueryOutput,resolveOutputOptions}from'../core/command-output.js';function a35_0x4e85(){const _0x3793c0=['elapsedTimeMillis','SQL:\x20','No\x20SQL\x20provided','1128085IvYunz','setJobId','2122970qWPdcz','database','Error:\x20','Executing\x20statement\x20','in\x20','information_schema','Catalog:\x20','error','totalSplits','file','message','jobId','Schema:\x20','161872kAIMkl','execute','Executing\x20query\x20[','join','Site:\x20','Usage:\x20tdx\x20query\x20\x22SELECT\x20*\x20FROM\x20table\x22\x0a\x20\x20\x20or:\x20tdx\x20query\x20query.sql\x0a\x20\x20\x20or:\x20echo\x20\x22SELECT\x201\x22\x20|\x20tdx\x20query\x20-\x0a\x0aRun\x20\x27tdx\x20query\x20--help\x27\x20for\x20more\x20options','380178DLEiro','9750NJzSzs','name','stats','description','site','6ZToZYV','completedSplits','length','684iQNNCL','query','output','push','418488ejbqVk','Run\x20Trino\x20queries\x20(streaming)','data','40coGCcn','Query\x20completed:\x20Processed\x20','\x20[Job\x20ID:\x20','verbose','183539qfqTUw','\x20rows\x20','setExtra','catalog','validate','args','Statement\x20','\x20-\x20'];a35_0x4e85=function(){return _0x3793c0;};return a35_0x4e85();}import{readSqlStatementsFromFile,readSqlStatementsFromStdin,splitSqlStatements,isSqlFilePath}from'../sdk/query/sql-parser.js';import{writeFileSync}from'fs';function a35_0x1a27(_0x3ba253,_0x5bd6a4){_0x3ba253=_0x3ba253-0x19a;const _0x4e85b6=a35_0x4e85();let _0x1a27ec=_0x4e85b6[_0x3ba253];return _0x1a27ec;}import{withProgressSpinner,formatElapsed}from'../utils/spinner.js';import{formatRows}from'../sdk/util/formatters.js';export class QueryCommand extends BaseCommand{[a35_0x2c84a7(0x1bc)]='query';[a35_0x2c84a7(0x1be)]=a35_0x2c84a7(0x1c8);async['execute'](_0x135e09){const _0x3d6b46=a35_0x2c84a7,{options:_0x59e2e9,args:_0x3e3091,tdx:_0x4b944d}=_0x135e09,_0x910413={..._0x59e2e9,'limitStructuredFormats':!![]},_0xb7f679=_0x3e3091[0x0],_0xe184d4=_0x59e2e9[_0x3d6b46(0x1b0)];let _0x2953ee;try{if(_0xe184d4)_0x2953ee=readSqlStatementsFromFile(_0xe184d4);else{if(_0xb7f679==='-')_0x2953ee=await readSqlStatementsFromStdin();else{if(_0xb7f679&&isSqlFilePath(_0xb7f679))_0x2953ee=readSqlStatementsFromFile(_0xb7f679);else{if(_0xb7f679)_0x2953ee=splitSqlStatements(_0xb7f679);else throw new Error(_0x3d6b46(0x1a4));}}}}catch(_0x4f4e5f){return console[_0x3d6b46(0x1ae)](_0x3d6b46(0x1a9)+_0x4f4e5f[_0x3d6b46(0x1b1)]),0x1;}const _0x4abb56=_0x59e2e9[_0x3d6b46(0x1a8)]||_0x3d6b46(0x1ac),_0x48eba4=_0x59e2e9[_0x3d6b46(0x19d)];try{const _0x472717=[],_0x1ef1ae=!!_0x59e2e9['output'];for(let _0x596f5b=0x0;_0x596f5b<_0x2953ee[_0x3d6b46(0x1c2)];_0x596f5b++){const _0x567517=_0x2953ee[_0x596f5b],_0x45ba34=_0x596f5b+0x1,_0x4cf3cf=_0x2953ee[_0x3d6b46(0x1c2)],_0x1bc59f=_0x4cf3cf>0x1;_0x59e2e9[_0x3d6b46(0x1cd)]&&(console[_0x3d6b46(0x1ae)]('\x0a'+(_0x1bc59f?_0x3d6b46(0x1a0)+_0x45ba34+'/'+_0x4cf3cf+':':'')),console[_0x3d6b46(0x1ae)](_0x3d6b46(0x1b8)+_0x59e2e9[_0x3d6b46(0x1bf)]),console['error'](_0x3d6b46(0x1ad)+(_0x48eba4||'td')),console[_0x3d6b46(0x1ae)](_0x3d6b46(0x1b3)+_0x4abb56),console['error'](_0x3d6b46(0x1a3)+_0x567517));const _0x663d53=_0x1bc59f?_0x3d6b46(0x1aa)+_0x45ba34+'/'+_0x4cf3cf+'...':'Executing\x20query...';try{const _0x348783=await withProgressSpinner(_0x663d53,async _0x27c696=>{const _0x3cb79a=_0x3d6b46,_0x35ff9a=await _0x4b944d[_0x3cb79a(0x1c4)][_0x3cb79a(0x1b5)](_0x567517,{'catalog':_0x48eba4,'schema':_0x4abb56,'onJobId':_0x1d5e42=>{const _0x168754=_0x3cb79a;_0x27c696[_0x168754(0x1a6)](_0x1d5e42);},'onProgress':_0x1f442b=>{const _0x30e816=_0x3cb79a;_0x27c696['setPhase'](_0x30e816(0x1b6)+_0x1f442b['state']+']'),_0x27c696[_0x30e816(0x19c)](formatRows(_0x1f442b['processedRows'])+'\x20rows\x20'+_0x1f442b[_0x30e816(0x1c1)]+'/'+_0x1f442b[_0x30e816(0x1af)]+'\x20splits');}});return _0x35ff9a;},{'verbose':_0x59e2e9[_0x3d6b46(0x1cd)]}),_0x41777d=_0x348783[_0x3d6b46(0x1c9)],_0x599614=_0x41777d[_0x3d6b46(0x1b2)]?_0x3d6b46(0x1cc)+_0x41777d[_0x3d6b46(0x1b2)]+']':'',_0x769c3d=_0x1bc59f?_0x3d6b46(0x1a0)+_0x45ba34+'/'+_0x4cf3cf+_0x3d6b46(0x1a1):'';console[_0x3d6b46(0x1ae)]('✔\x20'+_0x769c3d+_0x3d6b46(0x1cb)+formatRows(_0x41777d['stats']['processedRows'])+_0x3d6b46(0x19b)+(_0x3d6b46(0x1ab)+formatElapsed(_0x41777d[_0x3d6b46(0x1bd)][_0x3d6b46(0x1a2)])+_0x599614));if(_0x1bc59f&&_0x1ef1ae){const _0x2644c4=resolveOutputOptions(_0x910413),_0x3b5d78=await formatQueryOutput(_0x41777d,_0x2644c4);_0x472717[_0x3d6b46(0x1c6)](_0x3b5d78);}else await handleQueryOutput(_0x41777d,_0x910413);}catch(_0x1521c3){const _0x3e51c6=_0x1bc59f?_0x3d6b46(0x1a0)+_0x45ba34+'/'+_0x4cf3cf+':\x0a':'',_0x2f98f5=_0x1521c3 instanceof SDKError?_0x1521c3['originalMessage']:_0x1521c3[_0x3d6b46(0x1b1)];return console[_0x3d6b46(0x1ae)](''+_0x3e51c6+_0x2f98f5),0x1;}}if(_0x2953ee[_0x3d6b46(0x1c2)]>0x1&&_0x1ef1ae&&_0x472717[_0x3d6b46(0x1c2)]>0x0){const _0x3a780f=_0x472717[_0x3d6b46(0x1b7)]('\x0a');writeFileSync(_0x59e2e9[_0x3d6b46(0x1c5)],_0x3a780f),console['error']('\x0aAll\x20results\x20saved\x20to\x20'+_0x59e2e9[_0x3d6b46(0x1c5)]);}return 0x0;}catch(_0x424b25){throw _0x424b25;}}[a35_0x2c84a7(0x19e)](_0x29dccf){const _0x540355=a35_0x2c84a7,_0x1c5524=_0x29dccf[_0x540355(0x19f)][0x0],_0x225094=_0x29dccf['options'][_0x540355(0x1b0)];if(!_0x1c5524&&!_0x225094)return _0x540355(0x1b9);if(_0x1c5524&&_0x225094)return'Cannot\x20specify\x20both\x20SQL\x20argument\x20and\x20--file\x20option';return undefined;}}
@@ -1 +1 @@
1
- const a36_0x2023ff=a36_0x5286;(function(_0x5e9b1b,_0x2428ae){const _0x515239=a36_0x5286,_0x3c7503=_0x5e9b1b();while(!![]){try{const _0x352259=-parseInt(_0x515239(0xdf))/0x1*(-parseInt(_0x515239(0x12c))/0x2)+parseInt(_0x515239(0xc7))/0x3+-parseInt(_0x515239(0xce))/0x4*(-parseInt(_0x515239(0xc5))/0x5)+-parseInt(_0x515239(0xf1))/0x6+parseInt(_0x515239(0x11e))/0x7+parseInt(_0x515239(0x124))/0x8+-parseInt(_0x515239(0xc4))/0x9*(parseInt(_0x515239(0x12b))/0xa);if(_0x352259===_0x2428ae)break;else _0x3c7503['push'](_0x3c7503['shift']());}catch(_0x229293){_0x3c7503['push'](_0x3c7503['shift']());}}}(a36_0x3250,0x7fbe9));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_0x3250(){const _0x5a5696=['h\x20ago','3770408JLLGhv','schedule:list','delete','engine_version','last_job','time','\x20\x20Job\x20ID:\x20','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20delete\x20<name>','has_next_page','jsonl','error','/app/queries/editor?queryId=','status','listQueries','created_at','length','\x20execution','657979rTgsZw','num','executing_user_id','database','\x20matching\x20\x22','schedule:run','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20schedule\x20\x22','show','Schedule\x20created:\x20','Creating\x20schedule:\x20','\x20(use\x20--limit\x20to\x20see\x20more)','yes','delay','\x20created','in\x20','time_zone','Creating\x20schedule...','\x20\x20Cron:\x20','3482112iXQqAe','\x20schedules','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20history\x20<name>\x20[--from\x20<n>]\x20[--to\x20<n>]','never','\x20\x20Time:\x20','getTime','Getting\x20schedule\x20history...','statusIcon','output','soon','List\x20scheduled\x20queries','Updating\x20schedule...','verbose','INVALID_ARGUMENT','priority','Show\x20schedule\x20details','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20run\x20<name>\x20[--time\x20<iso8601>]\x20[--num\x20<1-10>]','validate','nextRun','join','success','execute','red','Schedule\x20run\x20submitted:\x20','d\x20ago','cyan','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20show\x20<name>','map','engineVersion','Create\x20a\x20scheduled\x20query','Query\x20file\x20is\x20empty','\x20\x20Type:\x20','At\x20least\x20one\x20option\x20must\x20be\x20provided\x20to\x20update','timezone','schedules','padEnd','Delete\x20a\x20scheduled\x20query','Updating\x20schedule:\x20','description','name','m\x20ago','utf-8','updated_at','Show\x20schedule\x20execution\x20history','scheduled_at','5193538nhNXal','run','history','lastRun','Found\x20','entries','1722960BSNXUJ','max','cron','data','trim','abs','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20update\x20<name>\x20[options]','2639330PtEdZE','2nfPMpF','log','from','site','Schedule\x20deleted:\x20','📅\x20','Deleting\x20schedule...','...','\x20\x20Database:\x20','No\x20scheduled\x20queries\x20found','queryUrl','Searching\x20scheduled\x20queries\x20matching\x20\x22','Failed\x20to\x20read\x20file:\x20','retry_limit','job_id','result','Listing\x20scheduled\x20queries...','next_run_at','\x22...','retryLimit','args','schedule:history','ended_at','schedule:create','schedule:show','Getting\x20schedule\x20details...','jobs','create','round','file','query','repeat','format','\x20\x20→\x20','63CQUciF','5DdkLrn','user','1179717zVRQqA','json','Showing\x20first\x20','tsv','\x20job','type'];a36_0x3250=function(){return _0x5a5696;};return a36_0x3250();}import a36_0x10aed2 from'chalk';function formatRelativeTime(_0x4d57f1){const _0x1624cf=a36_0x5286,_0x263bf9=new Date(_0x4d57f1),_0x5341fa=new Date(),_0x43c95a=_0x263bf9[_0x1624cf(0xf6)]()-_0x5341fa['getTime'](),_0x2e1b12=Math[_0x1624cf(0x129)](_0x43c95a)/0x3e8,_0x555495=_0x43c95a<0x0;if(_0x2e1b12<0x3c)return _0x555495?'just\x20now':_0x1624cf(0xfa);else{if(_0x2e1b12<0xe10){const _0x5e30dc=Math[_0x1624cf(0xbe)](_0x2e1b12/0x3c);return _0x555495?_0x5e30dc+_0x1624cf(0x119):'in\x20'+_0x5e30dc+'m';}else{if(_0x2e1b12<0x15180){const _0x3fe3d9=Math[_0x1624cf(0xbe)](_0x2e1b12/0xe10);return _0x555495?_0x3fe3d9+_0x1624cf(0xcd):'in\x20'+_0x3fe3d9+'h';}else{if(_0x2e1b12<0x93a80){const _0x1cc534=Math['round'](_0x2e1b12/0x15180);return _0x555495?_0x1cc534+_0x1624cf(0x109):_0x1624cf(0xed)+_0x1cc534+'d';}else return _0x263bf9['toLocaleDateString']();}}}}export class ScheduleListCommand extends BaseCommand{[a36_0x2023ff(0x118)]=a36_0x2023ff(0xcf);[a36_0x2023ff(0x117)]=a36_0x2023ff(0xfb);async[a36_0x2023ff(0x106)](_0x51e490){const _0x24e5c1=a36_0x2023ff,{options:_0x3af347,args:_0x1c3ef8,tdx:_0x478480}=_0x51e490,_0x2a2ef2=resolveLimit(_0x3af347['limit'],DEFAULT_DISPLAY_LIMIT),_0x34f090=_0x1c3ef8[0x0],_0x5efd8d=_0x34f090?_0x24e5c1(0xad)+_0x34f090+_0x24e5c1(0xb4):_0x24e5c1(0xb2),_0x5a02b5=await withSpinner(_0x5efd8d,()=>_0x478480['schedules'][_0x24e5c1(0xdb)]({'limit':_0x2a2ef2,'scheduled':!![],'pattern':_0x34f090}),{'verbose':_0x3af347['verbose']}),_0x31bf4a=_0x5a02b5[_0x24e5c1(0x127)]['queries'],_0x1d3301=_0x5a02b5['data']['pagination'][_0x24e5c1(0xd6)],_0x4143f5=_0x34f090?_0x24e5c1(0xe3)+_0x34f090+'\x22':'';_0x1d3301?console[_0x24e5c1(0xd8)](_0x24e5c1(0xc9)+_0x31bf4a[_0x24e5c1(0xdd)]+_0x24e5c1(0xf2)+_0x4143f5+_0x24e5c1(0xe9)):console[_0x24e5c1(0xd8)](_0x24e5c1(0x122)+_0x31bf4a[_0x24e5c1(0xdd)]+'\x20scheduled\x20quer'+(_0x31bf4a[_0x24e5c1(0xdd)]!==0x1?'ies':'y')+_0x4143f5);if(_0x3af347['format']===_0x24e5c1(0xc8)||_0x3af347[_0x24e5c1(0xc2)]===_0x24e5c1(0xd7)||_0x3af347[_0x24e5c1(0xc2)]==='table'||_0x3af347['format']===_0x24e5c1(0xca)){const _0x35b28d=_0x31bf4a[_0x24e5c1(0x10c)](_0x550052=>({'id':_0x550052['id'],'name':_0x550052[_0x24e5c1(0x118)],'cron':_0x550052[_0x24e5c1(0x126)],'database':_0x550052[_0x24e5c1(0xe2)]?.[_0x24e5c1(0x118)],'type':_0x550052[_0x24e5c1(0xcc)],'timezone':_0x550052[_0x24e5c1(0xee)],'user_name':_0x550052[_0x24e5c1(0xc6)]?.[_0x24e5c1(0x118)],'updated_at':_0x550052[_0x24e5c1(0x11b)],'next_run_at':_0x550052[_0x24e5c1(0xb3)],'last_job_status':_0x550052['last_job']?.[_0x24e5c1(0xda)]}));await handleSDKOutput(_0x35b28d,_0x3af347);}else{if(_0x31bf4a[_0x24e5c1(0xdd)]===0x0)console[_0x24e5c1(0x12d)](_0x24e5c1(0xab));else{const _0x26a9e8=_0x3af347[_0x24e5c1(0x12f)],_0x426174=_0x31bf4a[_0x24e5c1(0x10c)](_0x42ce20=>{const _0x4efcc4=_0x24e5c1,_0x2a3ffc=_0x42ce20[_0x4efcc4(0xd2)]?.[_0x4efcc4(0xda)]?_0x42ce20[_0x4efcc4(0xd2)][_0x4efcc4(0xda)]===_0x4efcc4(0x105)?'✓':'✗':'-',_0x4d814f=_0x42ce20[_0x4efcc4(0xd2)]?.[_0x4efcc4(0xb8)]?formatRelativeTime(_0x42ce20[_0x4efcc4(0xd2)][_0x4efcc4(0xb8)]):_0x4efcc4(0xf4),_0x49e72b=_0x42ce20[_0x4efcc4(0xb3)]?formatRelativeTime(_0x42ce20['next_run_at']):'-',_0x414f53=_0x42ce20[_0x4efcc4(0x126)]||'',_0x582a59=_0x42ce20[_0x4efcc4(0x118)]||'(unnamed)',_0x47fe3e=getConsoleUrl(_0x26a9e8,_0x4efcc4(0xd9)+_0x42ce20['id']);return{'statusIcon':_0x2a3ffc,'lastRun':_0x4d814f,'nextRun':_0x49e72b,'cron':_0x414f53,'name':_0x582a59,'queryUrl':_0x47fe3e,'status':_0x42ce20['last_job']?.[_0x4efcc4(0xda)]};}),_0x38a6e0=Math[_0x24e5c1(0x125)](..._0x426174[_0x24e5c1(0x10c)](_0x3a9810=>_0x3a9810[_0x24e5c1(0x121)][_0x24e5c1(0xdd)])),_0x3b5dff=Math[_0x24e5c1(0x125)](..._0x426174[_0x24e5c1(0x10c)](_0x59654d=>_0x59654d[_0x24e5c1(0x103)][_0x24e5c1(0xdd)])),_0x3c0d4a=Math[_0x24e5c1(0x125)](..._0x426174[_0x24e5c1(0x10c)](_0x5cf362=>_0x5cf362[_0x24e5c1(0x126)][_0x24e5c1(0xdd)])),_0x2182df=_0x426174[_0x24e5c1(0x10c)](_0x4f5143=>{const _0x493e21=_0x24e5c1,_0x1b6946=_0x4f5143['status']===_0x493e21(0x105)?a36_0x10aed2['green'](_0x4f5143[_0x493e21(0xf8)]):_0x4f5143[_0x493e21(0xda)]===_0x493e21(0xd8)?a36_0x10aed2[_0x493e21(0x107)](_0x4f5143[_0x493e21(0xf8)]):a36_0x10aed2['dim'](_0x4f5143[_0x493e21(0xf8)]),_0x49fff6=_0x4f5143[_0x493e21(0x121)][_0x493e21(0x114)](_0x38a6e0),_0x423778=_0x4f5143['nextRun']['padEnd'](_0x3b5dff),_0x30eea9=_0x4f5143['cron']?a36_0x10aed2[_0x493e21(0x10a)](_0x4f5143['cron']['padEnd'](_0x3c0d4a)):'\x20'[_0x493e21(0xc1)](_0x3c0d4a),_0x13ca90=hyperlink(_0x4f5143['name'],_0x4f5143[_0x493e21(0xac)]);return _0x493e21(0x131)+_0x1b6946+'\x20'+_0x49fff6+_0x493e21(0xc3)+_0x423778+'\x20\x20'+_0x30eea9+'\x20\x20'+_0x13ca90;});await writeOutput(_0x2182df[_0x24e5c1(0x104)]('\x0a'),_0x3af347[_0x24e5c1(0xf9)],'list');}}return 0x0;}}export class ScheduleShowCommand extends BaseCommand{['name']=a36_0x2023ff(0xba);['description']=a36_0x2023ff(0x100);[a36_0x2023ff(0x102)](_0x45e7e9){const _0x3fbe4f=a36_0x2023ff,_0x1ab143=_0x45e7e9[_0x3fbe4f(0xb6)][0x0];if(!_0x1ab143)return _0x3fbe4f(0x10b);return undefined;}async[a36_0x2023ff(0x106)](_0x44be12){const _0x122734=a36_0x2023ff,{options:_0x4eee88,args:_0x504532,tdx:_0x259146}=_0x44be12,_0x6a42d4=_0x504532[0x0],_0x4d1a9a=await withSpinner(_0x122734(0xbb),()=>_0x259146[_0x122734(0x113)][_0x122734(0xe6)](_0x6a42d4),{'verbose':_0x4eee88['verbose']}),_0x1658de=_0x4d1a9a[_0x122734(0x127)],_0xf40da3={'name':_0x1658de['name'],'cron':_0x1658de[_0x122734(0x126)],'database':_0x1658de['database'],'type':_0x1658de[_0x122734(0xcc)],'timezone':_0x1658de[_0x122734(0x112)],'user_name':_0x1658de['user_name'],'created_at':_0x1658de[_0x122734(0xdc)],'engine_version':_0x1658de[_0x122734(0xd1)],'executing_user_id':_0x1658de[_0x122734(0xe1)],'query':_0x1658de[_0x122734(0xc0)],'delay':_0x1658de['delay'],'priority':_0x1658de[_0x122734(0xff)],'retry_limit':_0x1658de[_0x122734(0xaf)],..._0x1658de[_0x122734(0xb1)]&&{'result':_0x1658de['result']}};return await handleSingleObjectOutput(_0xf40da3,_0x4eee88),0x0;}}export class ScheduleCreateCommand extends BaseCommand{[a36_0x2023ff(0x118)]=a36_0x2023ff(0xb9);[a36_0x2023ff(0x117)]=a36_0x2023ff(0x10e);[a36_0x2023ff(0x102)](_0x1b063a){const _0x415725=a36_0x2023ff,_0x62a929=_0x1b063a['args'][0x0];if(!_0x62a929)return'Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]';const _0x147737=_0x1b063a['options'];if(!_0x147737[_0x415725(0xe2)])return'Database\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]';return undefined;}async[a36_0x2023ff(0x106)](_0x57d257){const _0x330ca9=a36_0x2023ff,{options:_0x26e7bb,args:_0x2cb04d,tdx:_0x40db94}=_0x57d257,_0x5b05a7=_0x2cb04d[0x0],_0x18564b=_0x26e7bb,_0x3bbbf4=_0x18564b[_0x330ca9(0xe2)],_0x4e7ad7=_0x18564b[_0x330ca9(0xbf)],_0x62697f=_0x18564b[_0x330ca9(0xcc)]||'trino';let _0xcab4e8;try{_0xcab4e8=readFileSync(_0x4e7ad7,_0x330ca9(0x11a))['trim']();}catch(_0x1ef795){throw new SDKError(ErrorCode[_0x330ca9(0xfe)],_0x330ca9(0xae)+_0x4e7ad7,_0x1ef795 instanceof Error?_0x1ef795:undefined);}if(!_0xcab4e8)throw new SDKError(ErrorCode[_0x330ca9(0xfe)],_0x330ca9(0x10f));const _0x44a6f4={'database':_0x3bbbf4,'query':_0xcab4e8,'type':_0x62697f};if(_0x18564b[_0x330ca9(0x126)])_0x44a6f4['cron']=_0x18564b[_0x330ca9(0x126)];if(_0x18564b[_0x330ca9(0x112)])_0x44a6f4[_0x330ca9(0x112)]=_0x18564b[_0x330ca9(0x112)];if(_0x18564b[_0x330ca9(0xeb)]!==undefined)_0x44a6f4[_0x330ca9(0xeb)]=Number(_0x18564b[_0x330ca9(0xeb)]);if(_0x18564b[_0x330ca9(0xff)]!==undefined)_0x44a6f4[_0x330ca9(0xff)]=Number(_0x18564b[_0x330ca9(0xff)]);if(_0x18564b[_0x330ca9(0xb5)]!==undefined)_0x44a6f4['retry_limit']=Number(_0x18564b[_0x330ca9(0xb5)]);if(_0x18564b[_0x330ca9(0x10d)])_0x44a6f4['engine_version']=_0x18564b[_0x330ca9(0x10d)];if(_0x18564b[_0x330ca9(0xb1)])_0x44a6f4['result']=_0x18564b['result'];if(_0x26e7bb[_0x330ca9(0xfd)]){console['error'](_0x330ca9(0xe8)+_0x5b05a7),console['error'](_0x330ca9(0xaa)+_0x3bbbf4),console[_0x330ca9(0xd8)](_0x330ca9(0x110)+_0x62697f);if(_0x44a6f4[_0x330ca9(0x126)])console[_0x330ca9(0xd8)](_0x330ca9(0xf0)+_0x44a6f4['cron']);if(_0x44a6f4[_0x330ca9(0x112)])console[_0x330ca9(0xd8)]('\x20\x20Timezone:\x20'+_0x44a6f4[_0x330ca9(0x112)]);}const _0x4f033c=await withSpinner(_0x330ca9(0xef),()=>_0x40db94[_0x330ca9(0x113)][_0x330ca9(0xbd)](_0x5b05a7,_0x44a6f4),{'verbose':_0x26e7bb[_0x330ca9(0xfd)]});return console[_0x330ca9(0xd8)](_0x330ca9(0xe7)+_0x4f033c[_0x330ca9(0x127)][_0x330ca9(0x118)]),await handleSingleObjectOutput(_0x4f033c['data'],_0x26e7bb),0x0;}}function a36_0x5286(_0x3d42dc,_0x2f8837){_0x3d42dc=_0x3d42dc-0xaa;const _0x325084=a36_0x3250();let _0x52860e=_0x325084[_0x3d42dc];return _0x52860e;}export class ScheduleUpdateCommand extends BaseCommand{[a36_0x2023ff(0x118)]='schedule:update';['description']='Update\x20a\x20scheduled\x20query';[a36_0x2023ff(0x102)](_0x3c92c7){const _0xa60d41=a36_0x2023ff,_0x2446c3=_0x3c92c7[_0xa60d41(0xb6)][0x0];if(!_0x2446c3)return _0xa60d41(0x12a);return undefined;}async[a36_0x2023ff(0x106)](_0x4b3507){const _0x248296=a36_0x2023ff,{options:_0x3fd147,args:_0x160c14,tdx:_0x5867b0}=_0x4b3507,_0x2cfb0a=_0x160c14[0x0],_0x3c95d6=_0x3fd147,_0x558103={};if(_0x3c95d6[_0x248296(0xe2)])_0x558103['database']=_0x3c95d6[_0x248296(0xe2)];if(_0x3c95d6[_0x248296(0xcc)])_0x558103['type']=_0x3c95d6[_0x248296(0xcc)];if(_0x3c95d6['cron'])_0x558103[_0x248296(0x126)]=_0x3c95d6[_0x248296(0x126)];if(_0x3c95d6[_0x248296(0x112)])_0x558103['timezone']=_0x3c95d6[_0x248296(0x112)];if(_0x3c95d6['delay']!==undefined)_0x558103[_0x248296(0xeb)]=Number(_0x3c95d6[_0x248296(0xeb)]);if(_0x3c95d6[_0x248296(0xff)]!==undefined)_0x558103[_0x248296(0xff)]=Number(_0x3c95d6[_0x248296(0xff)]);if(_0x3c95d6[_0x248296(0xb5)]!==undefined)_0x558103[_0x248296(0xaf)]=Number(_0x3c95d6['retryLimit']);if(_0x3c95d6['engineVersion'])_0x558103[_0x248296(0xd1)]=_0x3c95d6[_0x248296(0x10d)];if(_0x3c95d6[_0x248296(0xb1)])_0x558103[_0x248296(0xb1)]=_0x3c95d6[_0x248296(0xb1)];if(_0x3c95d6[_0x248296(0xbf)])try{_0x558103[_0x248296(0xc0)]=readFileSync(_0x3c95d6[_0x248296(0xbf)],_0x248296(0x11a))[_0x248296(0x128)]();}catch(_0x5f2eff){throw new SDKError(ErrorCode[_0x248296(0xfe)],'Failed\x20to\x20read\x20file:\x20'+_0x3c95d6[_0x248296(0xbf)],_0x5f2eff instanceof Error?_0x5f2eff:undefined);}if(Object['keys'](_0x558103)[_0x248296(0xdd)]===0x0)throw new SDKError(ErrorCode[_0x248296(0xfe)],_0x248296(0x111));if(_0x3fd147['verbose']){console['error'](_0x248296(0x116)+_0x2cfb0a);for(const [_0xf54d8b,_0x51943f]of Object[_0x248296(0x123)](_0x558103)){_0xf54d8b===_0x248296(0xc0)?console[_0x248296(0xd8)]('\x20\x20'+_0xf54d8b+':\x20'+_0x51943f['substring'](0x0,0x32)+_0x248296(0x133)):console[_0x248296(0xd8)]('\x20\x20'+_0xf54d8b+':\x20'+_0x51943f);}}const _0x35f8cd=await withSpinner(_0x248296(0xfc),()=>_0x5867b0[_0x248296(0x113)]['update'](_0x2cfb0a,_0x558103),{'verbose':_0x3fd147[_0x248296(0xfd)]});return console['error']('Schedule\x20updated:\x20'+_0x35f8cd[_0x248296(0x127)]['name']),await handleSingleObjectOutput(_0x35f8cd[_0x248296(0x127)],_0x3fd147),0x0;}}export class ScheduleDeleteCommand extends BaseCommand{[a36_0x2023ff(0x118)]='schedule:delete';[a36_0x2023ff(0x117)]=a36_0x2023ff(0x115);[a36_0x2023ff(0x102)](_0x1343b5){const _0x1d6538=a36_0x2023ff,_0x10f24a=_0x1343b5[_0x1d6538(0xb6)][0x0];if(!_0x10f24a)return _0x1d6538(0xd5);return undefined;}async[a36_0x2023ff(0x106)](_0x558efc){const _0xe8e44=a36_0x2023ff,{options:_0x1b28f9,args:_0x2bece9,tdx:_0x147e3b}=_0x558efc,_0x4d18b6=_0x2bece9[0x0];if(!_0x1b28f9[_0xe8e44(0xea)]){const _0x1c71ae=await confirm(_0xe8e44(0xe5)+_0x4d18b6+'\x22?');if(!_0x1c71ae)return console[_0xe8e44(0xd8)]('Cancelled'),0x0;}const _0x1863e8=await withSpinner(_0xe8e44(0x132),()=>_0x147e3b['schedules'][_0xe8e44(0xd0)](_0x4d18b6),{'verbose':_0x1b28f9[_0xe8e44(0xfd)]});return console['error'](_0xe8e44(0x130)+_0x1863e8[_0xe8e44(0x127)][_0xe8e44(0x118)]),0x0;}}export class ScheduleRunCommand extends BaseCommand{[a36_0x2023ff(0x118)]=a36_0x2023ff(0xe4);[a36_0x2023ff(0x117)]='Run\x20a\x20scheduled\x20query\x20immediately';[a36_0x2023ff(0x102)](_0x3559f5){const _0x421b6f=a36_0x2023ff,_0x568954=_0x3559f5[_0x421b6f(0xb6)][0x0];if(!_0x568954)return _0x421b6f(0x101);return undefined;}async[a36_0x2023ff(0x106)](_0x47f717){const _0x2e6b11=a36_0x2023ff,{options:_0x3f5b9f,args:_0x1e919b,tdx:_0x300266}=_0x47f717,_0x216fed=_0x1e919b[0x0],_0x5ba76a=_0x3f5b9f,_0x517f41=_0x5ba76a[_0x2e6b11(0xd3)],_0x525135=_0x5ba76a[_0x2e6b11(0xe0)]!==undefined?Number(_0x5ba76a[_0x2e6b11(0xe0)]):undefined;if(_0x3f5b9f[_0x2e6b11(0xfd)]){console[_0x2e6b11(0xd8)]('Running\x20schedule:\x20'+_0x216fed);if(_0x517f41)console[_0x2e6b11(0xd8)](_0x2e6b11(0xf5)+_0x517f41);if(_0x525135)console[_0x2e6b11(0xd8)]('\x20\x20Num:\x20'+_0x525135);}const _0x1349e5=await withSpinner('Running\x20schedule...',()=>_0x300266[_0x2e6b11(0x113)][_0x2e6b11(0x11f)](_0x216fed,{'time':_0x517f41,'num':_0x525135}),{'verbose':_0x3f5b9f[_0x2e6b11(0xfd)]}),_0x1edcc5=_0x1349e5[_0x2e6b11(0x127)][_0x2e6b11(0xbc)];console[_0x2e6b11(0xd8)](_0x2e6b11(0x108)+_0x1edcc5[_0x2e6b11(0xdd)]+_0x2e6b11(0xcb)+(_0x1edcc5[_0x2e6b11(0xdd)]!==0x1?'s':'')+_0x2e6b11(0xec));for(const _0x33c8d9 of _0x1edcc5){console[_0x2e6b11(0xd8)](_0x2e6b11(0xd4)+_0x33c8d9[_0x2e6b11(0xb0)]);}return await handleSDKOutput(_0x1edcc5,_0x3f5b9f),0x0;}}export class ScheduleHistoryCommand extends BaseCommand{['name']=a36_0x2023ff(0xb7);[a36_0x2023ff(0x117)]=a36_0x2023ff(0x11c);[a36_0x2023ff(0x102)](_0x707ed3){const _0x4deb7a=a36_0x2023ff,_0x131eb1=_0x707ed3[_0x4deb7a(0xb6)][0x0];if(!_0x131eb1)return _0x4deb7a(0xf3);return undefined;}async['execute'](_0x1a42b5){const _0x11dd6e=a36_0x2023ff,{options:_0x4aede1,args:_0x3ba0d1,tdx:_0x3c5a0a}=_0x1a42b5,_0x34bfe8=_0x3ba0d1[0x0],_0x5b342e=_0x4aede1,_0x2ad408=_0x5b342e['from']!==undefined?Number(_0x5b342e[_0x11dd6e(0x12e)]):undefined,_0x3a6e6c=_0x5b342e['to']!==undefined?Number(_0x5b342e['to']):undefined,_0x4377c1=await withSpinner(_0x11dd6e(0xf7),()=>_0x3c5a0a[_0x11dd6e(0x113)][_0x11dd6e(0x120)](_0x34bfe8,{'from':_0x2ad408,'to':_0x3a6e6c}),{'verbose':_0x4aede1[_0x11dd6e(0xfd)]}),_0x953c94=_0x4377c1[_0x11dd6e(0x127)];console[_0x11dd6e(0xd8)](_0x11dd6e(0x122)+_0x953c94['count']+_0x11dd6e(0xde)+(_0x953c94['count']!==0x1?'s':'')+'\x20(showing\x20'+_0x953c94[_0x11dd6e(0x12e)]+'-'+_0x953c94['to']+')');const _0x210620=_0x953c94[_0x11dd6e(0x120)]['map'](_0x49dc96=>({'job_id':_0x49dc96['job_id'],'type':_0x49dc96['type'],'status':_0x49dc96['status'],'scheduled_at':_0x49dc96[_0x11dd6e(0x11d)],'created_at':_0x49dc96['created_at'],'start_at':_0x49dc96['start_at'],'end_at':_0x49dc96['end_at']}));return await handleSDKOutput(_0x210620,_0x4aede1),0x0;}}
1
+ const a36_0x53c5c3=a36_0x5f28;(function(_0x1bf337,_0x12e70d){const _0x1b3366=a36_0x5f28,_0x1f673c=_0x1bf337();while(!![]){try{const _0x19ed1a=-parseInt(_0x1b3366(0x227))/0x1+-parseInt(_0x1b3366(0x267))/0x2+parseInt(_0x1b3366(0x25a))/0x3+parseInt(_0x1b3366(0x1fb))/0x4+-parseInt(_0x1b3366(0x277))/0x5*(parseInt(_0x1b3366(0x1fd))/0x6)+-parseInt(_0x1b3366(0x1f4))/0x7+-parseInt(_0x1b3366(0x268))/0x8*(-parseInt(_0x1b3366(0x22b))/0x9);if(_0x19ed1a===_0x12e70d)break;else _0x1f673c['push'](_0x1f673c['shift']());}catch(_0x45bfda){_0x1f673c['push'](_0x1f673c['shift']());}}}(a36_0x5f81,0xacc4a));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,handleSingleObjectOutput,writeOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import{confirm}from'../utils/prompt.js';import{readFileSync}from'fs';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import{getConsoleUrl}from'../sdk/client/endpoints.js';import{hyperlink}from'../sdk/util/formatters.js';import a36_0x3ff574 from'chalk';function formatRelativeTime(_0x59c38e){const _0x401105=a36_0x5f28,_0x42332c=new Date(_0x59c38e),_0x323cc0=new Date(),_0x1872da=_0x42332c[_0x401105(0x26b)]()-_0x323cc0[_0x401105(0x26b)](),_0x98e607=Math['abs'](_0x1872da)/0x3e8,_0xf34568=_0x1872da<0x0;if(_0x98e607<0x3c)return _0xf34568?'just\x20now':_0x401105(0x223);else{if(_0x98e607<0xe10){const _0x4bba9e=Math['round'](_0x98e607/0x3c);return _0xf34568?_0x4bba9e+_0x401105(0x26c):_0x401105(0x272)+_0x4bba9e+'m';}else{if(_0x98e607<0x15180){const _0xb745ff=Math[_0x401105(0x22e)](_0x98e607/0xe10);return _0xf34568?_0xb745ff+_0x401105(0x23d):'in\x20'+_0xb745ff+'h';}else{if(_0x98e607<0x93a80){const _0x193a02=Math['round'](_0x98e607/0x15180);return _0xf34568?_0x193a02+'d\x20ago':_0x401105(0x272)+_0x193a02+'d';}else return _0x42332c[_0x401105(0x256)]();}}}}export class ScheduleListCommand extends BaseCommand{[a36_0x53c5c3(0x24d)]='schedule:list';[a36_0x53c5c3(0x257)]='List\x20scheduled\x20queries';async[a36_0x53c5c3(0x23b)](_0xe6be81){const _0x13c6a4=a36_0x53c5c3,{options:_0x4ea6a3,args:_0x2bf09e,tdx:_0x5b6d0c}=_0xe6be81,_0x49f7f6=resolveLimit(_0x4ea6a3[_0x13c6a4(0x266)],DEFAULT_DISPLAY_LIMIT),_0x1ef2e0=_0x2bf09e[0x0],_0x483938=_0x1ef2e0?_0x13c6a4(0x26a)+_0x1ef2e0+'\x22...':_0x13c6a4(0x248),_0x31c15d=await withSpinner(_0x483938,()=>_0x5b6d0c[_0x13c6a4(0x228)][_0x13c6a4(0x254)]({'limit':_0x49f7f6,'scheduled':!![],'pattern':_0x1ef2e0}),{'verbose':_0x4ea6a3[_0x13c6a4(0x261)]}),_0x3cc1ee=_0x31c15d[_0x13c6a4(0x244)]['queries'],_0x5c6881=_0x31c15d[_0x13c6a4(0x244)][_0x13c6a4(0x1f1)][_0x13c6a4(0x26d)],_0x9db7d2=_0x1ef2e0?_0x13c6a4(0x25c)+_0x1ef2e0+'\x22':'';_0x5c6881?console[_0x13c6a4(0x23a)](_0x13c6a4(0x25f)+_0x3cc1ee[_0x13c6a4(0x25d)]+_0x13c6a4(0x258)+_0x9db7d2+_0x13c6a4(0x263)):console[_0x13c6a4(0x23a)](_0x13c6a4(0x249)+_0x3cc1ee[_0x13c6a4(0x25d)]+_0x13c6a4(0x213)+(_0x3cc1ee['length']!==0x1?'ies':'y')+_0x9db7d2);if(_0x4ea6a3[_0x13c6a4(0x276)]===_0x13c6a4(0x22d)||_0x4ea6a3['format']==='jsonl'||_0x4ea6a3[_0x13c6a4(0x276)]===_0x13c6a4(0x238)||_0x4ea6a3['format']==='tsv'){const _0x466fbc=_0x3cc1ee[_0x13c6a4(0x24e)](_0x15f277=>({'id':_0x15f277['id'],'name':_0x15f277['name'],'cron':_0x15f277['cron'],'database':_0x15f277[_0x13c6a4(0x201)]?.[_0x13c6a4(0x24d)],'type':_0x15f277[_0x13c6a4(0x21a)],'timezone':_0x15f277[_0x13c6a4(0x242)],'user_name':_0x15f277[_0x13c6a4(0x229)]?.[_0x13c6a4(0x24d)],'updated_at':_0x15f277[_0x13c6a4(0x1f9)],'next_run_at':_0x15f277['next_run_at'],'last_job_status':_0x15f277[_0x13c6a4(0x1f7)]?.[_0x13c6a4(0x224)]}));await handleSDKOutput(_0x466fbc,_0x4ea6a3);}else{if(_0x3cc1ee['length']===0x0)console['log']('No\x20scheduled\x20queries\x20found');else{const _0x2aad12=_0x4ea6a3['site'],_0x4ee831=_0x3cc1ee[_0x13c6a4(0x24e)](_0x178dcd=>{const _0x253bc6=_0x13c6a4,_0x5e462a=_0x178dcd[_0x253bc6(0x1f7)]?.['status']?_0x178dcd[_0x253bc6(0x1f7)][_0x253bc6(0x224)]===_0x253bc6(0x260)?'✓':'✗':'-',_0x4ddac8=_0x178dcd[_0x253bc6(0x1f7)]?.[_0x253bc6(0x1fa)]?formatRelativeTime(_0x178dcd['last_job'][_0x253bc6(0x1fa)]):'never',_0x5406d1=_0x178dcd[_0x253bc6(0x21f)]?formatRelativeTime(_0x178dcd[_0x253bc6(0x21f)]):'-',_0x24c3d6=_0x178dcd[_0x253bc6(0x222)]||'',_0x5cb670=_0x178dcd['name']||_0x253bc6(0x217),_0x2637c2=getConsoleUrl(_0x2aad12,_0x253bc6(0x221)+_0x178dcd['id']);return{'statusIcon':_0x5e462a,'lastRun':_0x4ddac8,'nextRun':_0x5406d1,'cron':_0x24c3d6,'name':_0x5cb670,'queryUrl':_0x2637c2,'status':_0x178dcd[_0x253bc6(0x1f7)]?.['status']};}),_0x153ad8=Math[_0x13c6a4(0x251)](..._0x4ee831[_0x13c6a4(0x24e)](_0x58f263=>_0x58f263[_0x13c6a4(0x1f5)][_0x13c6a4(0x25d)])),_0x56718c=Math[_0x13c6a4(0x251)](..._0x4ee831[_0x13c6a4(0x24e)](_0x33ae36=>_0x33ae36['nextRun'][_0x13c6a4(0x25d)])),_0x156add=Math['max'](..._0x4ee831['map'](_0x1e8db0=>_0x1e8db0[_0x13c6a4(0x222)][_0x13c6a4(0x25d)])),_0x100548=_0x4ee831[_0x13c6a4(0x24e)](_0xce30d8=>{const _0x4a5410=_0x13c6a4,_0x1d17f7=_0xce30d8[_0x4a5410(0x224)]===_0x4a5410(0x260)?a36_0x3ff574[_0x4a5410(0x245)](_0xce30d8[_0x4a5410(0x208)]):_0xce30d8[_0x4a5410(0x224)]===_0x4a5410(0x23a)?a36_0x3ff574[_0x4a5410(0x20a)](_0xce30d8[_0x4a5410(0x208)]):a36_0x3ff574[_0x4a5410(0x210)](_0xce30d8[_0x4a5410(0x208)]),_0x576367=_0xce30d8[_0x4a5410(0x1f5)]['padEnd'](_0x153ad8),_0xdb847d=_0xce30d8[_0x4a5410(0x204)]['padEnd'](_0x56718c),_0x5765de=_0xce30d8['cron']?a36_0x3ff574['cyan'](_0xce30d8['cron'][_0x4a5410(0x26f)](_0x156add)):'\x20'[_0x4a5410(0x255)](_0x156add),_0x3fdf1d=hyperlink(_0xce30d8[_0x4a5410(0x24d)],_0xce30d8[_0x4a5410(0x226)]);return'📅\x20'+_0x1d17f7+'\x20'+_0x576367+_0x4a5410(0x20f)+_0xdb847d+'\x20\x20'+_0x5765de+'\x20\x20'+_0x3fdf1d;});await writeOutput(_0x100548[_0x13c6a4(0x278)]('\x0a'),_0x4ea6a3[_0x13c6a4(0x218)],_0x13c6a4(0x225));}}return 0x0;}}export class ScheduleShowCommand extends BaseCommand{[a36_0x53c5c3(0x24d)]=a36_0x53c5c3(0x22c);['description']=a36_0x53c5c3(0x27c);[a36_0x53c5c3(0x247)](_0x3ef3ae){const _0x3f1674=a36_0x53c5c3,_0xf581fe=_0x3ef3ae[_0x3f1674(0x240)][0x0];if(!_0xf581fe)return _0x3f1674(0x24b);return undefined;}async['execute'](_0x94127f){const _0x4f6810=a36_0x53c5c3,{options:_0xba7e3d,args:_0x317eb8,tdx:_0x16b139}=_0x94127f,_0x20d8ed=_0x317eb8[0x0],_0x1ade6a=await withSpinner(_0x4f6810(0x27a),()=>_0x16b139[_0x4f6810(0x228)]['show'](_0x20d8ed),{'verbose':_0xba7e3d['verbose']}),_0x5444d7=_0x1ade6a[_0x4f6810(0x244)],_0xe34b39={'name':_0x5444d7['name'],'cron':_0x5444d7[_0x4f6810(0x222)],'database':_0x5444d7['database'],'type':_0x5444d7[_0x4f6810(0x21a)],'timezone':_0x5444d7[_0x4f6810(0x250)],'user_name':_0x5444d7[_0x4f6810(0x20b)],'created_at':_0x5444d7['created_at'],'engine_version':_0x5444d7[_0x4f6810(0x234)],'executing_user_id':_0x5444d7[_0x4f6810(0x1f8)],'query':_0x5444d7[_0x4f6810(0x239)],'delay':_0x5444d7[_0x4f6810(0x1f0)],'priority':_0x5444d7[_0x4f6810(0x231)],'retry_limit':_0x5444d7['retry_limit'],..._0x5444d7[_0x4f6810(0x236)]&&{'result':_0x5444d7[_0x4f6810(0x236)]}};return await handleSingleObjectOutput(_0xe34b39,_0xba7e3d),0x0;}}export class ScheduleCreateCommand extends BaseCommand{[a36_0x53c5c3(0x24d)]=a36_0x53c5c3(0x270);[a36_0x53c5c3(0x257)]=a36_0x53c5c3(0x230);[a36_0x53c5c3(0x247)](_0x3b4c38){const _0x4a52de=a36_0x53c5c3,_0x719638=_0x3b4c38[_0x4a52de(0x240)][0x0];if(!_0x719638)return _0x4a52de(0x1ff);const _0x503c86=_0x3b4c38[_0x4a52de(0x252)];if(!_0x503c86['database'])return _0x4a52de(0x21b);return undefined;}async['execute'](_0x340a4f){const _0x420b86=a36_0x53c5c3,{options:_0x2f1181,args:_0x55bc5a,tdx:_0x26dde3}=_0x340a4f,_0x4de008=_0x55bc5a[0x0],_0x3061e0=_0x2f1181,_0x5548c9=_0x3061e0[_0x420b86(0x201)],_0x504fdb=_0x3061e0['file'],_0x380e42=_0x3061e0[_0x420b86(0x21a)]||_0x420b86(0x216);let _0x1ca45a;try{_0x1ca45a=readFileSync(_0x504fdb,_0x420b86(0x215))[_0x420b86(0x23c)]();}catch(_0x26af49){throw new SDKError(ErrorCode[_0x420b86(0x23f)],_0x420b86(0x273)+_0x504fdb,_0x26af49 instanceof Error?_0x26af49:undefined);}if(!_0x1ca45a)throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x420b86(0x265));const _0x256b57={'database':_0x5548c9,'query':_0x1ca45a,'type':_0x380e42};if(_0x3061e0['cron'])_0x256b57[_0x420b86(0x222)]=_0x3061e0[_0x420b86(0x222)];if(_0x3061e0[_0x420b86(0x250)])_0x256b57[_0x420b86(0x250)]=_0x3061e0['timezone'];if(_0x3061e0[_0x420b86(0x1f0)]!==undefined)_0x256b57[_0x420b86(0x1f0)]=Number(_0x3061e0[_0x420b86(0x1f0)]);if(_0x3061e0[_0x420b86(0x231)]!==undefined)_0x256b57['priority']=Number(_0x3061e0[_0x420b86(0x231)]);if(_0x3061e0[_0x420b86(0x259)]!==undefined)_0x256b57[_0x420b86(0x235)]=Number(_0x3061e0['retryLimit']);if(_0x3061e0[_0x420b86(0x22a)])_0x256b57[_0x420b86(0x234)]=_0x3061e0[_0x420b86(0x22a)];if(_0x3061e0[_0x420b86(0x236)])_0x256b57['result']=_0x3061e0[_0x420b86(0x236)];if(_0x2f1181['verbose']){console[_0x420b86(0x23a)](_0x420b86(0x22f)+_0x4de008),console[_0x420b86(0x23a)](_0x420b86(0x1f6)+_0x5548c9),console['error'](_0x420b86(0x24f)+_0x380e42);if(_0x256b57['cron'])console[_0x420b86(0x23a)]('\x20\x20Cron:\x20'+_0x256b57[_0x420b86(0x222)]);if(_0x256b57[_0x420b86(0x250)])console[_0x420b86(0x23a)](_0x420b86(0x27b)+_0x256b57[_0x420b86(0x250)]);}const _0x4fa485=await withSpinner(_0x420b86(0x1f3),()=>_0x26dde3[_0x420b86(0x228)][_0x420b86(0x219)](_0x4de008,_0x256b57),{'verbose':_0x2f1181[_0x420b86(0x261)]});return console[_0x420b86(0x23a)](_0x420b86(0x214)+_0x4fa485[_0x420b86(0x244)][_0x420b86(0x24d)]),await handleSingleObjectOutput(_0x4fa485['data'],_0x2f1181),0x0;}}function a36_0x5f81(){const _0x4af951=['run','time_zone','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20schedule\x20\x22','data','green','schedule:history','validate','Listing\x20scheduled\x20queries...','Found\x20','num','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20show\x20<name>','\x20\x20Num:\x20','name','map','\x20\x20Type:\x20','timezone','max','options','Update\x20a\x20scheduled\x20query','listQueries','repeat','toLocaleDateString','description','\x20schedules','retryLimit','486351CEwPYU','Schedule\x20updated:\x20','\x20matching\x20\x22','length','...','Showing\x20first\x20','success','verbose','schedule:update','\x20(use\x20--limit\x20to\x20see\x20more)','file','Query\x20file\x20is\x20empty','limit','830216YvjBdB','184wSpAHW','from','Searching\x20scheduled\x20queries\x20matching\x20\x22','getTime','m\x20ago','has_next_page','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20history\x20<name>\x20[--from\x20<n>]\x20[--to\x20<n>]','padEnd','schedule:create','count','in\x20','Failed\x20to\x20read\x20file:\x20','start_at','scheduled_at','format','5IfSqBm','join','\x20execution','Getting\x20schedule\x20details...','\x20\x20Timezone:\x20','Show\x20schedule\x20details','delay','pagination','created_at','Creating\x20schedule...','7599508PJnskk','lastRun','\x20\x20Database:\x20','last_job','executing_user_id','updated_at','ended_at','3167608ZoNLBB','Schedule\x20run\x20submitted:\x20','3390402xwOBli','Updating\x20schedule...','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]','jobs','database','Getting\x20schedule\x20history...','Updating\x20schedule:\x20','nextRun','job_id','Run\x20a\x20scheduled\x20query\x20immediately','At\x20least\x20one\x20option\x20must\x20be\x20provided\x20to\x20update','statusIcon','Schedule\x20deleted:\x20','red','user_name','\x20\x20Time:\x20','history','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20delete\x20<name>','\x20\x20→\x20','dim','\x20job','Running\x20schedule:\x20','\x20scheduled\x20quer','Schedule\x20created:\x20','utf-8','trino','(unnamed)','output','create','type','Database\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]','schedule:run','Deleting\x20schedule...','delete','next_run_at','yes','/app/queries/editor?queryId=','cron','soon','status','list','queryUrl','777610ZFskKG','schedules','user','engineVersion','1016244ZVlmzK','schedule:show','json','round','Creating\x20schedule:\x20','Create\x20a\x20scheduled\x20query','priority','schedule:delete','keys','engine_version','retry_limit','result','entries','table','query','error','execute','trim','h\x20ago','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20update\x20<name>\x20[options]','INVALID_ARGUMENT','args'];a36_0x5f81=function(){return _0x4af951;};return a36_0x5f81();}export class ScheduleUpdateCommand extends BaseCommand{['name']=a36_0x53c5c3(0x262);[a36_0x53c5c3(0x257)]=a36_0x53c5c3(0x253);[a36_0x53c5c3(0x247)](_0xc4282e){const _0x31e6ed=a36_0x53c5c3,_0x3a483d=_0xc4282e[_0x31e6ed(0x240)][0x0];if(!_0x3a483d)return _0x31e6ed(0x23e);return undefined;}async['execute'](_0x346e02){const _0x5b006b=a36_0x53c5c3,{options:_0x1bb114,args:_0x1f8fe3,tdx:_0x2d5686}=_0x346e02,_0x4335a2=_0x1f8fe3[0x0],_0x635f60=_0x1bb114,_0x5532dd={};if(_0x635f60[_0x5b006b(0x201)])_0x5532dd[_0x5b006b(0x201)]=_0x635f60[_0x5b006b(0x201)];if(_0x635f60[_0x5b006b(0x21a)])_0x5532dd[_0x5b006b(0x21a)]=_0x635f60[_0x5b006b(0x21a)];if(_0x635f60[_0x5b006b(0x222)])_0x5532dd[_0x5b006b(0x222)]=_0x635f60['cron'];if(_0x635f60['timezone'])_0x5532dd[_0x5b006b(0x250)]=_0x635f60['timezone'];if(_0x635f60['delay']!==undefined)_0x5532dd[_0x5b006b(0x1f0)]=Number(_0x635f60[_0x5b006b(0x1f0)]);if(_0x635f60['priority']!==undefined)_0x5532dd[_0x5b006b(0x231)]=Number(_0x635f60[_0x5b006b(0x231)]);if(_0x635f60[_0x5b006b(0x259)]!==undefined)_0x5532dd[_0x5b006b(0x235)]=Number(_0x635f60[_0x5b006b(0x259)]);if(_0x635f60['engineVersion'])_0x5532dd[_0x5b006b(0x234)]=_0x635f60['engineVersion'];if(_0x635f60[_0x5b006b(0x236)])_0x5532dd[_0x5b006b(0x236)]=_0x635f60['result'];if(_0x635f60[_0x5b006b(0x264)])try{_0x5532dd[_0x5b006b(0x239)]=readFileSync(_0x635f60['file'],'utf-8')[_0x5b006b(0x23c)]();}catch(_0x5f3ec5){throw new SDKError(ErrorCode['INVALID_ARGUMENT'],'Failed\x20to\x20read\x20file:\x20'+_0x635f60[_0x5b006b(0x264)],_0x5f3ec5 instanceof Error?_0x5f3ec5:undefined);}if(Object[_0x5b006b(0x233)](_0x5532dd)['length']===0x0)throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x5b006b(0x207));if(_0x1bb114[_0x5b006b(0x261)]){console[_0x5b006b(0x23a)](_0x5b006b(0x203)+_0x4335a2);for(const [_0x421ab8,_0x17267b]of Object[_0x5b006b(0x237)](_0x5532dd)){_0x421ab8===_0x5b006b(0x239)?console[_0x5b006b(0x23a)]('\x20\x20'+_0x421ab8+':\x20'+_0x17267b['substring'](0x0,0x32)+_0x5b006b(0x25e)):console[_0x5b006b(0x23a)]('\x20\x20'+_0x421ab8+':\x20'+_0x17267b);}}const _0x5b1bae=await withSpinner(_0x5b006b(0x1fe),()=>_0x2d5686['schedules']['update'](_0x4335a2,_0x5532dd),{'verbose':_0x1bb114[_0x5b006b(0x261)]});return console[_0x5b006b(0x23a)](_0x5b006b(0x25b)+_0x5b1bae['data']['name']),await handleSingleObjectOutput(_0x5b1bae[_0x5b006b(0x244)],_0x1bb114),0x0;}}export class ScheduleDeleteCommand extends BaseCommand{[a36_0x53c5c3(0x24d)]=a36_0x53c5c3(0x232);[a36_0x53c5c3(0x257)]='Delete\x20a\x20scheduled\x20query';[a36_0x53c5c3(0x247)](_0x1abbba){const _0x57b757=a36_0x53c5c3,_0x52169b=_0x1abbba[_0x57b757(0x240)][0x0];if(!_0x52169b)return _0x57b757(0x20e);return undefined;}async[a36_0x53c5c3(0x23b)](_0x13d4a5){const _0x57cfc1=a36_0x53c5c3,{options:_0x5d7e3c,args:_0x222951,tdx:_0xbfcf7b}=_0x13d4a5,_0x3fdff0=_0x222951[0x0];if(!_0x5d7e3c[_0x57cfc1(0x220)]){const _0x2d8fca=await confirm(_0x57cfc1(0x243)+_0x3fdff0+'\x22?');if(!_0x2d8fca)return console[_0x57cfc1(0x23a)]('Cancelled'),0x0;}const _0x72bcd1=await withSpinner(_0x57cfc1(0x21d),()=>_0xbfcf7b[_0x57cfc1(0x228)][_0x57cfc1(0x21e)](_0x3fdff0),{'verbose':_0x5d7e3c['verbose']});return console['error'](_0x57cfc1(0x209)+_0x72bcd1[_0x57cfc1(0x244)][_0x57cfc1(0x24d)]),0x0;}}export class ScheduleRunCommand extends BaseCommand{['name']=a36_0x53c5c3(0x21c);[a36_0x53c5c3(0x257)]=a36_0x53c5c3(0x206);[a36_0x53c5c3(0x247)](_0x424252){const _0x163330=a36_0x53c5c3,_0x2e9835=_0x424252[_0x163330(0x240)][0x0];if(!_0x2e9835)return'Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20run\x20<name>\x20[--time\x20<iso8601>]\x20[--num\x20<1-10>]';return undefined;}async[a36_0x53c5c3(0x23b)](_0x545080){const _0xa59f9a=a36_0x53c5c3,{options:_0x2f8b2b,args:_0x31f498,tdx:_0x34a891}=_0x545080,_0x3b913e=_0x31f498[0x0],_0x4846f7=_0x2f8b2b,_0x56c2b2=_0x4846f7['time'],_0x150a92=_0x4846f7[_0xa59f9a(0x24a)]!==undefined?Number(_0x4846f7[_0xa59f9a(0x24a)]):undefined;if(_0x2f8b2b[_0xa59f9a(0x261)]){console[_0xa59f9a(0x23a)](_0xa59f9a(0x212)+_0x3b913e);if(_0x56c2b2)console[_0xa59f9a(0x23a)](_0xa59f9a(0x20c)+_0x56c2b2);if(_0x150a92)console[_0xa59f9a(0x23a)](_0xa59f9a(0x24c)+_0x150a92);}const _0x5a7367=await withSpinner('Running\x20schedule...',()=>_0x34a891[_0xa59f9a(0x228)][_0xa59f9a(0x241)](_0x3b913e,{'time':_0x56c2b2,'num':_0x150a92}),{'verbose':_0x2f8b2b['verbose']}),_0x31d060=_0x5a7367[_0xa59f9a(0x244)][_0xa59f9a(0x200)];console[_0xa59f9a(0x23a)](_0xa59f9a(0x1fc)+_0x31d060[_0xa59f9a(0x25d)]+_0xa59f9a(0x211)+(_0x31d060['length']!==0x1?'s':'')+'\x20created');for(const _0x1bcd0c of _0x31d060){console['error']('\x20\x20Job\x20ID:\x20'+_0x1bcd0c['job_id']);}return await handleSDKOutput(_0x31d060,_0x2f8b2b),0x0;}}function a36_0x5f28(_0x4cd87f,_0x5c584f){_0x4cd87f=_0x4cd87f-0x1f0;const _0x5f81b5=a36_0x5f81();let _0x5f280a=_0x5f81b5[_0x4cd87f];return _0x5f280a;}export class ScheduleHistoryCommand extends BaseCommand{[a36_0x53c5c3(0x24d)]=a36_0x53c5c3(0x246);[a36_0x53c5c3(0x257)]='Show\x20schedule\x20execution\x20history';['validate'](_0x95c448){const _0x4678d7=a36_0x53c5c3,_0x3ce8dc=_0x95c448['args'][0x0];if(!_0x3ce8dc)return _0x4678d7(0x26e);return undefined;}async['execute'](_0x5a3dcc){const _0x55465b=a36_0x53c5c3,{options:_0x411ad7,args:_0x1826dc,tdx:_0x47d9bc}=_0x5a3dcc,_0x1d488d=_0x1826dc[0x0],_0x2606ab=_0x411ad7,_0x4af3d0=_0x2606ab['from']!==undefined?Number(_0x2606ab[_0x55465b(0x269)]):undefined,_0x3c72eb=_0x2606ab['to']!==undefined?Number(_0x2606ab['to']):undefined,_0x18803=await withSpinner(_0x55465b(0x202),()=>_0x47d9bc['schedules'][_0x55465b(0x20d)](_0x1d488d,{'from':_0x4af3d0,'to':_0x3c72eb}),{'verbose':_0x411ad7[_0x55465b(0x261)]}),_0x2ac770=_0x18803[_0x55465b(0x244)];console[_0x55465b(0x23a)](_0x55465b(0x249)+_0x2ac770[_0x55465b(0x271)]+_0x55465b(0x279)+(_0x2ac770[_0x55465b(0x271)]!==0x1?'s':'')+'\x20(showing\x20'+_0x2ac770[_0x55465b(0x269)]+'-'+_0x2ac770['to']+')');const _0x332b84=_0x2ac770[_0x55465b(0x20d)][_0x55465b(0x24e)](_0x4473e3=>({'job_id':_0x4473e3[_0x55465b(0x205)],'type':_0x4473e3[_0x55465b(0x21a)],'status':_0x4473e3[_0x55465b(0x224)],'scheduled_at':_0x4473e3[_0x55465b(0x275)],'created_at':_0x4473e3[_0x55465b(0x1f2)],'start_at':_0x4473e3[_0x55465b(0x274)],'end_at':_0x4473e3['end_at']}));return await handleSDKOutput(_0x332b84,_0x411ad7),0x0;}}
@@ -1 +1 @@
1
- const a37_0x28f801=a37_0x7db9;(function(_0x13853e,_0x2fa2fa){const _0x3ac62d=a37_0x7db9,_0x2dad12=_0x13853e();while(!![]){try{const _0x133328=-parseInt(_0x3ac62d(0x158))/0x1+parseInt(_0x3ac62d(0x137))/0x2+-parseInt(_0x3ac62d(0x13b))/0x3+-parseInt(_0x3ac62d(0x12e))/0x4*(-parseInt(_0x3ac62d(0x109))/0x5)+parseInt(_0x3ac62d(0xe4))/0x6*(-parseInt(_0x3ac62d(0x160))/0x7)+parseInt(_0x3ac62d(0x127))/0x8*(parseInt(_0x3ac62d(0x14f))/0x9)+parseInt(_0x3ac62d(0x136))/0xa;if(_0x133328===_0x2fa2fa)break;else _0x2dad12['push'](_0x2dad12['shift']());}catch(_0xd59904){_0x2dad12['push'](_0x2dad12['shift']());}}}(a37_0x20e3,0x79084));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,handleQueryOutput,handleSingleObjectOutput}from'../core/command-output.js';import{withSpinner,withProgressSpinner,formatElapsed}from'../utils/spinner.js';import{parseSegmentRef}from'../sdk/segment/segment-ref-parser.js';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import{executeSchemaQuery}from'../sdk/segment/fields-display.js';import{isYamlFilePath,resolveYamlFilePath}from'../sdk/segment/segment-path-parser.js';import{getConsoleNextUrl}from'../sdk/client/endpoints.js';import{openBrowser}from'../utils/process.js';function a37_0x20e3(){const _0x17b531=['\x20[Job\x20ID:\x20','path','Listing\x20folders\x20for\x20parent\x20\x27','Segment\x20ID:\x20','25jkbtKQ','\x20\x20tdx\x20sg\x20view\x20segments/my-audience/premium-users.yml','getSegment','segment:desc','red','\x20folder','parentSegment','\x20\x20tdx\x20sg\x20view\x20\x22Marketing\x22\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20folder\x20details','test','Resolved:\x20','Error:\x20','\x20\x20tdx\x20segment\x20describe\x20\x22High\x20Value\x22\x20\x20\x20\x20#\x20Relative\x20to\x20current\x20context','Resolving\x20path\x20\x27','✔\x20Found\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20view\x20<path/to/segment.yml>','getSQLFromServerSegment','Use:\x20tdx\x20ps\x20view\x20-w','\x27\x20with\x20ID:\x20','Segment\x20ID\x20missing\x20from\x20resolved\x20path','error','Error:\x20Cannot\x20execute\x20query\x20for\x20parent\x20segment\x20with\x20this\x20command.','Error:\x20Cannot\x20open\x20folder\x20in\x20web\x20browser.\x20Use\x20a\x20segment\x20name\x20instead.','Resolving\x20parent\x20segment\x20\x27','Resolving\x20folder\x20\x27','cause','includes','log','segmentId','listFolders','\x20\x20tdx\x20sg\x20show\x20segments/my-audience/premium-users.yml','88GeMKQD','length','\x20\x20Parent\x20segment:\x20','segmentPath','parent','parentFolder','/e/','763132oisFAP','Usage:\x20tdx\x20segment\x20folder\x20create\x20<parent_name>\x20<folder_name>\x20[options]','Usage:\x20tdx\x20sg\x20show\x20<name>','\x20\x20-w,\x20--web\x20\x20Open\x20segment\x20in\x20web\x20browser','Resolved\x20parent\x20folder\x20ID:\x20','Parent\x20ID:\x20','Parent\x20name:\x20','resolveParentId','6452290peSoBw','83008scLGdB','in\x20','SQL\x20query:\x0a','Folder\x20ID:\x20','1060953WMOlqI','\x20rows\x20','Use:\x20tdx\x20sg\x20view\x20<name>\x20\x20#\x20To\x20show\x20folder\x20details','Cannot\x20get\x20SQL\x20for\x20parent\x20segment\x20with\x20this\x20command.\x20Use:\x20tdx\x20ps\x20sql','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20desc\x20<path/to/segment.yml>','code','description','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience/Marketing/High\x20Value\x22','getSQLFromYamlFile','\x20\x20Server-side\x20segment:\x20\x20tdx\x20sg\x20sql\x20<name>','fullPath','resolvePathToResource','SELECT\x20*\x20FROM\x20(\x0a','SEGMENT_FOLDER_NOT_FOUND','parentId','format','Error:\x20Folder\x20name\x20is\x20required\x20(use\x20parent_name/folder_name\x20format)','message','Fetching\x20segment\x20details...','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20-w\x20\x20#\x20Open\x20segment\x20in\x20web\x20browser','60048PPNuxS','Executing\x20segment\x20query...','Fetching\x20folder\x20\x27','site','\x20\x20tdx\x20sg\x20sql\x20\x22Premium\x20Users\x22','Options:','folder','jobId','name','21841jBcYiM','json','getSegmentSQLFromYaml','trim','Error:\x20Cannot\x20show\x20schema\x20for\x20a\x20folder.','\x20\x20tdx\x20sg\x20desc\x20\x22Premium\x20Users\x22','Folder\x20name:\x20','Use:\x20tdx\x20ps\x20view','112aKzolb','\x20\x20tdx\x20sg\x20show\x20\x22Premium\x20Users\x22','folderId','cyan','segmentName','Get\x20SQL\x20query\x20for\x20child\x20segment','Resolved\x20YAML\x20file:\x20','Fetching\x20SQL\x20from\x20rule...','✔\x20Created\x20folder\x20\x27','segment:folder:create','getParent','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20show\x20<path/to/segment.yml>','processedRows','green','Target\x20path:\x20','Error:\x20Path\x20or\x20name\x20is\x20required','Usage:\x20tdx\x20segment\x20folder\x20list\x20<parent_name>','Show\x20segment\x20folder\x20details','/app/ps/','Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.','Use:\x20tdx\x20ps\x20show','data','content','Error:\x20Segment\x20name\x20or\x20--path\x20is\x20required','\x20\x20tdx\x20sg\x20desc\x20segments/my-audience/premium-users.yml','Folder\x20ID\x20missing\x20from\x20resolved\x20path','Use:\x20tdx\x20ps\x20desc','verbose','\x27...','segment:view','segment:folder:show','getSegmentSQL','limit','url','SEGMENT_NOT_FOUND','Error:\x20Parent\x20segment\x20name\x20is\x20required','replace','query','type','Show\x20segment\x20or\x20folder\x20details','Site:\x20','\x20\x20Folder\x20path:\x20','jsonl','Usage:','316050jHGRgZ','Show\x20child\x20segment\x20schema\x20(column\x20types)','Examples:','Fetching\x20SQL\x20for\x20segment...','Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20','INVALID_ARGUMENT','Resolved\x20type:\x20','Execute\x20child\x20segment\x20SQL\x20query\x20and\x20show\x20results','segment:describe','No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22','✖\x20Query\x20failed\x20[','Error:\x20Cannot\x20open\x20parent\x20segment\x20with\x20this\x20command.','web','Error:\x20Specify\x20either\x20segment\x20name\x20or\x20--path,\x20not\x20both','segment:sql','Usage:\x20tdx\x20sg\x20view\x20<name>\x20[-w]','resolveFolderId','segment:folder:list','getFolder','\x20\x20Cause:\x20','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','\x20\x20tdx\x20sg\x20sql\x20--path\x20','execute','Fetching\x20folder\x20details...','segment','Resolving\x20\x27','segment:show','Cannot\x20get\x20SQL\x20query\x20for\x20a\x20folder.\x20Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.','Resolved\x20folder\x20ID:\x20','\x20\x20Local\x20YAML\x20file:\x20\x20\x20\x20\x20\x20tdx\x20sg\x20sql\x20--path\x20<file-path>','createFolder','\x20Opening\x20','Show\x20folder\x20or\x20child\x20segment\x20details'];a37_0x20e3=function(){return _0x17b531;};return a37_0x20e3();}import a37_0x43385f from'chalk';async function resolveSegmentTarget(_0x2036bc,_0x53dca0,_0x418d39){const _0x14b924=a37_0x7db9;if(isYamlFilePath(_0x2036bc))try{const _0x50cdd0=await resolveYamlFilePath(_0x2036bc);return _0x418d39&&(console['error'](_0x14b924(0x166)+_0x2036bc),console[_0x14b924(0x11c)](_0x14b924(0x129)+_0x50cdd0[_0x14b924(0x10f)]),console[_0x14b924(0x11c)]('\x20\x20Segment\x20name:\x20'+_0x50cdd0[_0x14b924(0x164)]),console[_0x14b924(0x11c)](_0x14b924(0xe1)+(_0x50cdd0['folderPath']||'(root)')),console['error']('\x20\x20Full\x20path:\x20'+_0x50cdd0['fullPath'])),_0x50cdd0[_0x14b924(0x145)];}catch(_0x259c5c){throw new SDKError(ErrorCode[_0x14b924(0xe9)],_0x14b924(0xe8)+_0x259c5c[_0x14b924(0x14c)]);}if(!_0x53dca0)throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x14b924(0xed));return _0x53dca0+'/'+_0x2036bc;}function a37_0x7db9(_0x30fcda,_0x1b9550){_0x30fcda=_0x30fcda-0xd7;const _0x20e373=a37_0x20e3();let _0x7db92d=_0x20e373[_0x30fcda];return _0x7db92d;}export class SegmentDescribeCommand extends BaseCommand{[a37_0x28f801(0x157)]=a37_0x28f801(0xec);[a37_0x28f801(0x141)]=a37_0x28f801(0xdf);async[a37_0x28f801(0xfa)](_0x2c2816){const _0x16c236=a37_0x28f801,{options:_0x27be24,args:_0x3f32b0,tdx:_0x5ba81c}=_0x2c2816,_0x21e598=_0x3f32b0[0x0],_0x43a71b=!_0x21e598&&!!_0x27be24[_0x16c236(0x10f)],_0x5e992f=_0x21e598||_0x27be24['parentSegment'];if(!_0x5e992f)return console[_0x16c236(0x11c)](_0x16c236(0x16f)),console[_0x16c236(0x11c)]('Usage:\x20tdx\x20segment\x20describe\x20<path>'),console['error'](_0x16c236(0xe6)),console[_0x16c236(0x11c)]('\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience\x22'),console[_0x16c236(0x11c)](_0x16c236(0x142)),console[_0x16c236(0x11c)](_0x16c236(0x114)),console[_0x16c236(0x11c)]('\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>'),0x1;try{const _0x2a4f85=_0x27be24[_0x16c236(0x12a)];let _0x210c46=_0x5e992f;!_0x43a71b&&_0x2a4f85&&!_0x5e992f[_0x16c236(0x122)]('/')&&(_0x210c46=_0x2a4f85+'/'+_0x5e992f,_0x27be24[_0x16c236(0x17b)]&&console[_0x16c236(0x11c)]('Resolved\x20relative\x20path\x20to:\x20'+_0x210c46));const _0x4a3f14=await withSpinner(_0x16c236(0x115)+_0x210c46+_0x16c236(0x17c),()=>_0x5ba81c[_0x16c236(0xfc)][_0x16c236(0x146)](_0x210c46),{'verbose':_0x27be24[_0x16c236(0x17b)]}),_0x224d8e=_0x4a3f14[_0x16c236(0x175)];_0x27be24[_0x16c236(0x17b)]&&(console['error'](_0x16c236(0xea)+_0x224d8e[_0x16c236(0xde)]),console['error']('Parent\x20ID:\x20'+_0x224d8e[_0x16c236(0x149)]),_0x224d8e['folderId']&&console[_0x16c236(0x11c)](_0x16c236(0x13a)+_0x224d8e[_0x16c236(0x162)]),_0x224d8e[_0x16c236(0x124)]&&console[_0x16c236(0x11c)](_0x16c236(0x108)+_0x224d8e['segmentId']));if(_0x224d8e['type']==='parent'){const _0x4795ad=await withSpinner('Fetching\x20parent\x20segment\x20details...',()=>_0x5ba81c[_0x16c236(0xfc)][_0x16c236(0x16a)](_0x224d8e[_0x16c236(0x149)]),{'verbose':_0x27be24[_0x16c236(0x17b)]});await handleSingleObjectOutput(_0x4795ad[_0x16c236(0x175)],_0x27be24);}else{if(_0x224d8e[_0x16c236(0xde)]===_0x16c236(0x155)){if(!_0x224d8e[_0x16c236(0x162)])throw new SDKError(ErrorCode[_0x16c236(0x148)],_0x16c236(0x179));const _0xe8ebed=await withSpinner(_0x16c236(0xfb),()=>_0x5ba81c[_0x16c236(0xfc)][_0x16c236(0xf6)](_0x224d8e[_0x16c236(0x162)]),{'verbose':_0x27be24[_0x16c236(0x17b)]});await handleSingleObjectOutput(_0xe8ebed['data'],_0x27be24);}else{if(_0x224d8e[_0x16c236(0xde)]===_0x16c236(0xfc)){if(!_0x224d8e[_0x16c236(0x124)])throw new SDKError(ErrorCode[_0x16c236(0xda)],_0x16c236(0x11b));const _0x210651=await withSpinner(_0x16c236(0x14d),()=>_0x5ba81c[_0x16c236(0xfc)]['getSegment'](_0x224d8e[_0x16c236(0x149)],_0x224d8e[_0x16c236(0x124)]),{'verbose':_0x27be24['verbose']});await handleSingleObjectOutput(_0x210651[_0x16c236(0x175)],_0x27be24);}}}return 0x0;}catch(_0x3c459c){if(_0x3c459c instanceof SDKError)return console['error'](_0x16c236(0x113)+_0x3c459c['message']),_0x3c459c[_0x16c236(0x121)]&&console[_0x16c236(0x11c)](_0x16c236(0xf7)+_0x3c459c[_0x16c236(0x121)]),0x1;throw _0x3c459c;}}}export class SegmentShowCommand extends BaseCommand{[a37_0x28f801(0x157)]=a37_0x28f801(0xfe);[a37_0x28f801(0x141)]=a37_0x28f801(0xeb);async[a37_0x28f801(0xfa)](_0x52666c){const _0x5e3b2f=a37_0x28f801,{options:_0x43fa65,args:_0x2fd7eb,tdx:_0x3f5c24}=_0x52666c,_0x43d12f=_0x2fd7eb[0x0];if(!_0x43d12f)return console[_0x5e3b2f(0x11c)]('Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required'),console['error'](_0x5e3b2f(0x130)),console['error'](_0x5e3b2f(0x16b)),console[_0x5e3b2f(0x11c)](_0x5e3b2f(0xe6)),console[_0x5e3b2f(0x11c)](_0x5e3b2f(0x161)),console[_0x5e3b2f(0x11c)](_0x5e3b2f(0x126)),0x1;try{const _0x1b7dbb=_0x43fa65[_0x5e3b2f(0x10f)],_0x2666f0=await resolveSegmentTarget(_0x43d12f,_0x1b7dbb,_0x43fa65[_0x5e3b2f(0x17b)]);_0x43fa65[_0x5e3b2f(0x17b)]&&console[_0x5e3b2f(0x11c)](_0x5e3b2f(0x16e)+_0x2666f0);const _0xbd18aa=await withSpinner('Resolving\x20\x27'+_0x43d12f+_0x5e3b2f(0x17c),()=>_0x3f5c24[_0x5e3b2f(0xfc)][_0x5e3b2f(0x146)](_0x2666f0),{'verbose':_0x43fa65['verbose']}),_0x157794=_0xbd18aa[_0x5e3b2f(0x175)];_0x43fa65[_0x5e3b2f(0x17b)]&&(console['error'](_0x5e3b2f(0xea)+_0x157794[_0x5e3b2f(0xde)]),console[_0x5e3b2f(0x11c)](_0x5e3b2f(0x133)+_0x157794[_0x5e3b2f(0x149)]));if(_0x157794[_0x5e3b2f(0xde)]==='folder')return console[_0x5e3b2f(0x11c)]('Error:\x20Cannot\x20execute\x20SQL\x20query\x20on\x20a\x20folder.'),console['error'](_0x5e3b2f(0x13d)),0x1;if(_0x157794['type']===_0x5e3b2f(0x12b))return console[_0x5e3b2f(0x11c)](_0x5e3b2f(0x11d)),console[_0x5e3b2f(0x11c)](_0x5e3b2f(0x174)),0x1;if(!_0x157794[_0x5e3b2f(0x124)])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x5e3b2f(0x11b));const _0x5871a0=await withSpinner(_0x5e3b2f(0xe7),()=>_0x3f5c24['segment'][_0x5e3b2f(0xd7)](_0x157794['parentId'],_0x157794[_0x5e3b2f(0x124)]),{'verbose':_0x43fa65[_0x5e3b2f(0x17b)]});let _0x244ce8=_0x5871a0[_0x5e3b2f(0x175)];const _0x32fb2f=resolveLimit(_0x43fa65[_0x5e3b2f(0xd8)],DEFAULT_DISPLAY_LIMIT),_0x3936d8=/\bLIMIT\s+\d+/i[_0x5e3b2f(0x111)](_0x244ce8);!_0x3936d8&&(_0x244ce8=_0x244ce8[_0x5e3b2f(0x15b)]()[_0x5e3b2f(0xdc)](/;+$/,''),_0x244ce8=_0x5e3b2f(0x147)+_0x244ce8+_0x5e3b2f(0xf8)+_0x32fb2f);_0x43fa65[_0x5e3b2f(0x17b)]&&console['error'](_0x5e3b2f(0x139)+_0x244ce8);const _0x240eab=await withProgressSpinner(_0x5e3b2f(0x150),async _0x297e9d=>{const _0x5c81a5=_0x5e3b2f,_0x20a19c=await _0x3f5c24[_0x5c81a5(0xdd)][_0x5c81a5(0xfa)](_0x244ce8,{'catalog':'td','schema':'information_schema','onJobId':_0x41418d=>{_0x297e9d['setJobId'](_0x41418d);}});return _0x20a19c;},{'verbose':_0x43fa65[_0x5e3b2f(0x17b)]}),_0x202934=_0x240eab['data'],_0x51b1d4=_0x202934[_0x5e3b2f(0x156)]?_0x5e3b2f(0x105)+_0x202934[_0x5e3b2f(0x156)]+']':'';return console[_0x5e3b2f(0x11c)]('✔\x20Query\x20completed:\x20Processed\x20'+_0x202934['stats'][_0x5e3b2f(0x16c)]['toLocaleString']()+_0x5e3b2f(0x13c)+(_0x5e3b2f(0x138)+formatElapsed(_0x202934['stats']['elapsedTimeMillis'])+_0x51b1d4)),await handleQueryOutput(_0x202934,_0x43fa65),0x0;}catch(_0x67f023){if(_0x67f023 instanceof SDKError)return console[_0x5e3b2f(0x11c)](_0x5e3b2f(0xee)+_0x67f023[_0x5e3b2f(0x140)]+']'),console[_0x5e3b2f(0x11c)]('\x0a'+_0x67f023[_0x5e3b2f(0x14c)]),0x1;throw _0x67f023;}}}export class SegmentFolderListCommand extends BaseCommand{[a37_0x28f801(0x157)]=a37_0x28f801(0xf5);[a37_0x28f801(0x141)]='List\x20segment\x20folders\x20under\x20a\x20parent\x20segment';async[a37_0x28f801(0xfa)](_0x2fa611){const _0x508dfa=a37_0x28f801,{options:_0x3b2023,args:_0x49510a,tdx:_0x13ea47}=_0x2fa611;if(_0x49510a[_0x508dfa(0x128)]===0x0)return console[_0x508dfa(0x11c)](_0x508dfa(0xdb)),console[_0x508dfa(0x11c)](_0x508dfa(0x170)),0x1;const _0x3f09fa=_0x49510a[0x0];try{_0x3b2023[_0x508dfa(0x17b)]&&(console[_0x508dfa(0x11c)](_0x508dfa(0xe0)+_0x3b2023[_0x508dfa(0x152)]),console['error'](_0x508dfa(0x134)+_0x3f09fa));const _0x2899ce=await withSpinner(_0x508dfa(0x11f)+_0x3f09fa+'\x27...',()=>_0x13ea47[_0x508dfa(0xfc)][_0x508dfa(0x135)](_0x3f09fa),{'verbose':_0x3b2023[_0x508dfa(0x17b)]}),_0x231f9c=_0x2899ce[_0x508dfa(0x175)];_0x3b2023[_0x508dfa(0x17b)]&&console[_0x508dfa(0x11c)]('Resolved\x20parent\x20ID:\x20'+_0x231f9c);const _0x17959c=await withSpinner(_0x508dfa(0x107)+_0x3f09fa+'\x27...',()=>_0x13ea47['segment'][_0x508dfa(0x125)](_0x231f9c),{'verbose':_0x3b2023[_0x508dfa(0x17b)]}),_0x31fd6c=_0x17959c[_0x508dfa(0x175)];return console[_0x508dfa(0x11c)](_0x508dfa(0x116)+_0x31fd6c[_0x508dfa(0x128)]+_0x508dfa(0x10e)+(_0x31fd6c[_0x508dfa(0x128)]!==0x1?'s':'')),await handleSDKOutput(_0x31fd6c,_0x3b2023),0x0;}catch(_0x5968f9){if(_0x5968f9 instanceof SDKError)return console[_0x508dfa(0x11c)](_0x508dfa(0x113)+_0x5968f9[_0x508dfa(0x14c)]),_0x5968f9['cause']&&console[_0x508dfa(0x11c)]('\x20\x20Cause:\x20'+_0x5968f9[_0x508dfa(0x121)]),0x1;throw _0x5968f9;}}}export class SegmentFolderShowCommand extends BaseCommand{[a37_0x28f801(0x157)]=a37_0x28f801(0x17e);[a37_0x28f801(0x141)]=a37_0x28f801(0x171);async['execute'](_0x14cd5c){const _0x4bcb9c=a37_0x28f801,{options:_0x4f4331,args:_0x2a248b,tdx:_0x244038}=_0x14cd5c;if(_0x2a248b[_0x4bcb9c(0x128)]===0x0)return console[_0x4bcb9c(0x11c)]('Error:\x20Folder\x20reference\x20is\x20required'),console[_0x4bcb9c(0x11c)]('Usage:\x20tdx\x20segment\x20folder\x20show\x20<parent_name/folder_name>'),0x1;try{const {parentId:_0x2a6730,childId:_0x55ec29}=parseSegmentRef(_0x2a248b[0x0]);_0x4f4331[_0x4bcb9c(0x17b)]&&(console['error'](_0x4bcb9c(0xe0)+_0x4f4331[_0x4bcb9c(0x152)]),console[_0x4bcb9c(0x11c)](_0x4bcb9c(0x134)+_0x2a6730),_0x55ec29&&console[_0x4bcb9c(0x11c)](_0x4bcb9c(0x15e)+_0x55ec29));if(!_0x55ec29)return console[_0x4bcb9c(0x11c)](_0x4bcb9c(0x14b)),0x1;const _0x16e0cb=await withSpinner(_0x4bcb9c(0x11f)+_0x2a6730+_0x4bcb9c(0x17c),()=>_0x244038[_0x4bcb9c(0xfc)][_0x4bcb9c(0x135)](_0x2a6730),{'verbose':_0x4f4331[_0x4bcb9c(0x17b)]}),_0x23d305=_0x16e0cb[_0x4bcb9c(0x175)];_0x4f4331['verbose']&&console['error']('Resolved\x20parent\x20ID:\x20'+_0x23d305);const _0xc803a5=await withSpinner(_0x4bcb9c(0x120)+_0x55ec29+_0x4bcb9c(0x17c),()=>_0x244038[_0x4bcb9c(0xfc)][_0x4bcb9c(0xf4)](_0x23d305,_0x55ec29),{'verbose':_0x4f4331[_0x4bcb9c(0x17b)]}),_0x22c35f=_0xc803a5[_0x4bcb9c(0x175)];_0x4f4331[_0x4bcb9c(0x17b)]&&console['error'](_0x4bcb9c(0x100)+_0x22c35f);const _0x5aa7ac=await withSpinner(_0x4bcb9c(0x151)+_0x55ec29+_0x4bcb9c(0x17c),()=>_0x244038[_0x4bcb9c(0xfc)][_0x4bcb9c(0xf6)](_0x22c35f),{'verbose':_0x4f4331[_0x4bcb9c(0x17b)]});return await handleSDKOutput([_0x5aa7ac['data']],_0x4f4331),0x0;}catch(_0x3cd09f){if(_0x3cd09f instanceof SDKError)return console['error'](_0x4bcb9c(0x113)+_0x3cd09f['message']),_0x3cd09f['cause']&&console['error'](_0x4bcb9c(0xf7)+_0x3cd09f[_0x4bcb9c(0x121)]),0x1;throw _0x3cd09f;}}}export class SegmentSQLCommand extends BaseCommand{[a37_0x28f801(0x157)]=a37_0x28f801(0xf2);[a37_0x28f801(0x141)]=a37_0x28f801(0x165);async[a37_0x28f801(0xfa)](_0x4ee728){const _0x189d52=a37_0x28f801,{options:_0x410ad9,args:_0x514bb8}=_0x4ee728,_0x4aca53=_0x410ad9,_0x20e67b=_0x4aca53[_0x189d52(0x106)],_0x905471=_0x514bb8[0x0];if(!_0x905471&&!_0x20e67b)return console[_0x189d52(0x11c)](a37_0x43385f[_0x189d52(0x10d)](_0x189d52(0x177))),console[_0x189d52(0x11c)](_0x189d52(0xe3)),console[_0x189d52(0x11c)](_0x189d52(0x144)),console[_0x189d52(0x11c)](_0x189d52(0x101)),console[_0x189d52(0x11c)](_0x189d52(0xe6)),console[_0x189d52(0x11c)](_0x189d52(0x153)),console['error']('\x20\x20tdx\x20sg\x20sql\x20--path\x20segments/my-audience/premium-users.yml'),0x1;if(_0x905471&&_0x20e67b)return console[_0x189d52(0x11c)](a37_0x43385f[_0x189d52(0x10d)](_0x189d52(0xf1))),0x1;try{let _0x81ee09;if(_0x20e67b)_0x81ee09=await this['getSQLFromYamlFile'](_0x20e67b,_0x4ee728);else{if(isYamlFilePath(_0x905471))return console[_0x189d52(0x11c)](a37_0x43385f[_0x189d52(0x10d)]('Error:\x20YAML\x20file\x20paths\x20must\x20be\x20specified\x20with\x20--path\x20option')),console[_0x189d52(0x11c)](_0x189d52(0xf9)+_0x905471),0x1;else _0x81ee09=await this[_0x189d52(0x118)](_0x905471,_0x4ee728);}return _0x410ad9[_0x189d52(0x14a)]===_0x189d52(0x159)||_0x410ad9[_0x189d52(0x14a)]===_0x189d52(0xe2)?await handleSDKOutput([{'sql':_0x81ee09}],_0x410ad9):console[_0x189d52(0x123)](_0x81ee09),0x0;}catch(_0x5b66c2){if(_0x5b66c2 instanceof SDKError)return console[_0x189d52(0x11c)]('Error:\x20'+_0x5b66c2[_0x189d52(0x14c)]),_0x5b66c2[_0x189d52(0x121)]&&console[_0x189d52(0x11c)](_0x189d52(0xf7)+_0x5b66c2[_0x189d52(0x121)]),0x1;throw _0x5b66c2;}}async[a37_0x28f801(0x143)](_0x4d6292,_0x16524c){const _0x1bdc89=a37_0x28f801,{options:_0x112525,tdx:_0x5b1d9f}=_0x16524c;let _0x32cc42;try{_0x32cc42=await resolveYamlFilePath(_0x4d6292);}catch(_0x53f365){throw new SDKError(ErrorCode[_0x1bdc89(0xe9)],_0x1bdc89(0xe8)+_0x53f365['message']);}_0x112525[_0x1bdc89(0x17b)]&&console[_0x1bdc89(0x11c)](_0x1bdc89(0x112)+_0x32cc42[_0x1bdc89(0x10f)]+'/'+_0x32cc42[_0x1bdc89(0x164)]);const _0x41d292=await withSpinner(_0x1bdc89(0x167),()=>_0x5b1d9f[_0x1bdc89(0xfc)][_0x1bdc89(0x15a)](_0x32cc42[_0x1bdc89(0x176)],_0x32cc42[_0x1bdc89(0x10f)],_0x32cc42[_0x1bdc89(0x164)]),{'verbose':_0x112525[_0x1bdc89(0x17b)]});return _0x41d292['data'];}async[a37_0x28f801(0x118)](_0x2490cc,_0x182e49){const _0x115422=a37_0x28f801,{options:_0xc51d75,tdx:_0x5b9d6b}=_0x182e49,_0x3adbf0=_0xc51d75[_0x115422(0x10f)],_0x28ebd2=await resolveSegmentTarget(_0x2490cc,_0x3adbf0,_0xc51d75[_0x115422(0x17b)]);_0xc51d75[_0x115422(0x17b)]&&console['error'](_0x115422(0x16e)+_0x28ebd2);const _0x26e651=await withSpinner(_0x115422(0xfd)+_0x2490cc+_0x115422(0x17c),()=>_0x5b9d6b[_0x115422(0xfc)][_0x115422(0x146)](_0x28ebd2),{'verbose':_0xc51d75[_0x115422(0x17b)]}),_0x5ece1a=_0x26e651[_0x115422(0x175)];_0xc51d75[_0x115422(0x17b)]&&(console[_0x115422(0x11c)](_0x115422(0xea)+_0x5ece1a[_0x115422(0xde)]),console['error']('Parent\x20ID:\x20'+_0x5ece1a[_0x115422(0x149)]));if(_0x5ece1a[_0x115422(0xde)]===_0x115422(0x155))throw new SDKError(ErrorCode[_0x115422(0xe9)],_0x115422(0xff));if(_0x5ece1a[_0x115422(0xde)]===_0x115422(0x12b))throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x115422(0x13e));if(!_0x5ece1a[_0x115422(0x124)])throw new SDKError(ErrorCode[_0x115422(0xda)],_0x115422(0x11b));const _0xd9728=await withSpinner('Fetching\x20SQL\x20for\x20segment...',()=>_0x5b9d6b[_0x115422(0xfc)]['getSegmentSQL'](_0x5ece1a[_0x115422(0x149)],_0x5ece1a[_0x115422(0x124)]),{'verbose':_0xc51d75[_0x115422(0x17b)]});return _0xd9728[_0x115422(0x175)];}}export class SegmentFolderCreateCommand extends BaseCommand{[a37_0x28f801(0x157)]=a37_0x28f801(0x169);[a37_0x28f801(0x141)]='Create\x20segment\x20folder\x20for\x20organization';async[a37_0x28f801(0xfa)](_0xb38ffd){const _0x52cfca=a37_0x28f801,{options:_0x125645,args:_0x5cd613,tdx:_0x33e0c6}=_0xb38ffd,_0x35b1ac=_0x125645;if(_0x5cd613[_0x52cfca(0x128)]<0x2)return console[_0x52cfca(0x11c)]('Error:\x20Parent\x20segment\x20name\x20and\x20folder\x20name\x20are\x20required'),console[_0x52cfca(0x11c)](_0x52cfca(0x12f)),0x1;const _0x4c062a=_0x5cd613[0x0],_0x322dcc=_0x5cd613[0x1];_0x35b1ac[_0x52cfca(0x17b)]&&(console[_0x52cfca(0x11c)](_0x52cfca(0xe0)+_0x35b1ac[_0x52cfca(0x152)]),console[_0x52cfca(0x11c)]('Parent\x20segment:\x20'+_0x4c062a),console['error'](_0x52cfca(0x15e)+_0x322dcc));let _0x3af4c9;if(_0x35b1ac[_0x52cfca(0x12c)]){const _0x489f18=_0x35b1ac['parentFolder'],_0x349891=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x4c062a+_0x52cfca(0x17c),()=>_0x33e0c6[_0x52cfca(0xfc)][_0x52cfca(0x135)](_0x4c062a),{'verbose':_0x35b1ac[_0x52cfca(0x17b)]}),_0x5cd01d=_0x349891[_0x52cfca(0x175)],_0x589bc7=await withSpinner('Resolving\x20parent\x20folder\x20\x27'+_0x489f18+_0x52cfca(0x17c),()=>_0x33e0c6[_0x52cfca(0xfc)]['resolveFolderId'](_0x5cd01d,_0x489f18),{'verbose':_0x35b1ac[_0x52cfca(0x17b)]});_0x3af4c9=_0x589bc7[_0x52cfca(0x175)],_0x35b1ac[_0x52cfca(0x17b)]&&console[_0x52cfca(0x11c)](_0x52cfca(0x132)+_0x3af4c9);}const _0x55ac2d={'name':_0x322dcc,'description':_0x35b1ac[_0x52cfca(0x141)],'parentFolderId':_0x3af4c9},_0x531ee0=await withSpinner('Creating\x20folder\x20\x27'+_0x322dcc+_0x52cfca(0x17c),()=>_0x33e0c6[_0x52cfca(0xfc)][_0x52cfca(0x102)](_0x4c062a,_0x55ac2d),{'verbose':_0x35b1ac['verbose']}),_0x534192=_0x531ee0['data'];return console['error'](_0x52cfca(0x168)+_0x534192[_0x52cfca(0x157)]+_0x52cfca(0x11a)+_0x534192['id']),await handleSDKOutput([_0x534192],_0x35b1ac),0x0;}}export class SegmentViewCommand extends BaseCommand{[a37_0x28f801(0x157)]=a37_0x28f801(0x17d);[a37_0x28f801(0x141)]=a37_0x28f801(0x104);async[a37_0x28f801(0xfa)](_0x1bb6df){const _0x5e933c=a37_0x28f801,{options:_0xb89931,args:_0x4c0ebc,tdx:_0x527d8c}=_0x1bb6df,_0x4a051f=_0x4c0ebc[0x0];if(!_0x4a051f)return console[_0x5e933c(0x11c)]('Error:\x20Folder\x20or\x20segment\x20name,\x20or\x20YAML\x20file\x20path\x20is\x20required'),console[_0x5e933c(0x11c)](_0x5e933c(0xf3)),console[_0x5e933c(0x11c)](_0x5e933c(0x117)),console[_0x5e933c(0x11c)](_0x5e933c(0x154)),console[_0x5e933c(0x11c)](_0x5e933c(0x131)),console[_0x5e933c(0x11c)](_0x5e933c(0xe6)),console[_0x5e933c(0x11c)](_0x5e933c(0x110)),console[_0x5e933c(0x11c)]('\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20\x20\x20\x20\x20#\x20View\x20child\x20segment\x20details'),console[_0x5e933c(0x11c)](_0x5e933c(0x14e)),console[_0x5e933c(0x11c)](_0x5e933c(0x10a)),0x1;try{const _0x2b134a=_0xb89931[_0x5e933c(0x10f)],_0x380212=await resolveSegmentTarget(_0x4a051f,_0x2b134a,_0xb89931[_0x5e933c(0x17b)]);_0xb89931[_0x5e933c(0x17b)]&&console[_0x5e933c(0x11c)](_0x5e933c(0x16e)+_0x380212);const _0xa71ad6=await withSpinner(_0x5e933c(0xfd)+_0x4a051f+_0x5e933c(0x17c),()=>_0x527d8c[_0x5e933c(0xfc)][_0x5e933c(0x146)](_0x380212),{'verbose':_0xb89931[_0x5e933c(0x17b)]}),_0x317eee=_0xa71ad6[_0x5e933c(0x175)];_0xb89931['verbose']&&(console[_0x5e933c(0x11c)]('Resolved\x20type:\x20'+_0x317eee[_0x5e933c(0xde)]),console[_0x5e933c(0x11c)]('Parent\x20ID:\x20'+_0x317eee[_0x5e933c(0x149)]),_0x317eee['folderId']&&console[_0x5e933c(0x11c)](_0x5e933c(0x13a)+_0x317eee[_0x5e933c(0x162)]),_0x317eee['segmentId']&&console[_0x5e933c(0x11c)](_0x5e933c(0x108)+_0x317eee[_0x5e933c(0x124)]));if(_0xb89931[_0x5e933c(0xf0)]){if(_0x317eee[_0x5e933c(0xde)]===_0x5e933c(0x155))return console[_0x5e933c(0x11c)](_0x5e933c(0x11e)),0x1;if(_0x317eee[_0x5e933c(0xde)]===_0x5e933c(0x12b))return console['error'](_0x5e933c(0xef)),console[_0x5e933c(0x11c)](_0x5e933c(0x119)),0x1;if(!_0x317eee['segmentId'])throw new SDKError(ErrorCode[_0x5e933c(0xda)],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x3cf671=getConsoleNextUrl(_0xb89931[_0x5e933c(0x152)],'/app/ps/'+_0x317eee['parentId']+_0x5e933c(0x12d)+_0x317eee['segmentId']);return console[_0x5e933c(0x11c)](a37_0x43385f[_0x5e933c(0x16d)]('✔')+_0x5e933c(0x103)+a37_0x43385f[_0x5e933c(0x163)](_0x3cf671)),openBrowser(_0x3cf671),0x0;}if(_0x317eee['type']===_0x5e933c(0x155)){if(!_0x317eee[_0x5e933c(0x162)])throw new SDKError(ErrorCode[_0x5e933c(0x148)],'Folder\x20ID\x20missing\x20from\x20resolved\x20path');const _0x122f0a=await withSpinner(_0x5e933c(0xfb),()=>_0x527d8c['segment'][_0x5e933c(0xf6)](_0x317eee[_0x5e933c(0x162)]),{'verbose':_0xb89931[_0x5e933c(0x17b)]});await handleSingleObjectOutput(_0x122f0a['data'],_0xb89931);}else{if(_0x317eee[_0x5e933c(0xde)]===_0x5e933c(0xfc)){if(!_0x317eee[_0x5e933c(0x124)])throw new SDKError(ErrorCode[_0x5e933c(0xda)],_0x5e933c(0x11b));const _0x3420a8=await withSpinner(_0x5e933c(0x14d),()=>_0x527d8c[_0x5e933c(0xfc)][_0x5e933c(0x10b)](_0x317eee[_0x5e933c(0x149)],_0x317eee[_0x5e933c(0x124)]),{'verbose':_0xb89931[_0x5e933c(0x17b)]}),_0x767a74=getConsoleNextUrl(_0xb89931[_0x5e933c(0x152)],_0x5e933c(0x172)+_0x317eee[_0x5e933c(0x149)]+_0x5e933c(0x12d)+_0x317eee['segmentId']),_0x471920=_0x3420a8['data'];_0x471920[_0x5e933c(0xd9)]=_0x767a74,await handleSingleObjectOutput(_0x471920,_0xb89931);}else return console[_0x5e933c(0x11c)]('Error:\x20Cannot\x20view\x20parent\x20segment\x20details\x20with\x20this\x20command.'),console[_0x5e933c(0x11c)](_0x5e933c(0x15f)),0x1;}return 0x0;}catch(_0x1f7c89){if(_0x1f7c89 instanceof SDKError)return console[_0x5e933c(0x11c)](_0x5e933c(0x113)+_0x1f7c89[_0x5e933c(0x14c)]),_0x1f7c89['cause']&&console[_0x5e933c(0x11c)](_0x5e933c(0xf7)+_0x1f7c89[_0x5e933c(0x121)]),0x1;throw _0x1f7c89;}}}export const SegmentInfoCommand=SegmentViewCommand;export class SegmentDescCommand extends BaseCommand{['name']=a37_0x28f801(0x10c);[a37_0x28f801(0x141)]=a37_0x28f801(0xe5);async[a37_0x28f801(0xfa)](_0x103580){const _0x240815=a37_0x28f801,{options:_0xaa3051,args:_0x4dae6b,tdx:_0x139b5c}=_0x103580,_0x57c7fb=_0x4dae6b[0x0];if(!_0x57c7fb)return console[_0x240815(0x11c)]('Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required'),console[_0x240815(0x11c)]('Usage:\x20tdx\x20sg\x20desc\x20<name>'),console[_0x240815(0x11c)](_0x240815(0x13f)),console[_0x240815(0x11c)]('Examples:'),console[_0x240815(0x11c)](_0x240815(0x15d)),console[_0x240815(0x11c)](_0x240815(0x178)),0x1;try{const _0xc8c37a=_0xaa3051[_0x240815(0x10f)],_0x478fa0=await resolveSegmentTarget(_0x57c7fb,_0xc8c37a,_0xaa3051['verbose']);_0xaa3051[_0x240815(0x17b)]&&console[_0x240815(0x11c)](_0x240815(0x16e)+_0x478fa0);const _0x54ded1=await withSpinner(_0x240815(0xfd)+_0x57c7fb+_0x240815(0x17c),()=>_0x139b5c[_0x240815(0xfc)]['resolvePathToResource'](_0x478fa0),{'verbose':_0xaa3051[_0x240815(0x17b)]}),_0x15e01f=_0x54ded1[_0x240815(0x175)];_0xaa3051['verbose']&&(console[_0x240815(0x11c)]('Resolved\x20type:\x20'+_0x15e01f[_0x240815(0xde)]),console['error'](_0x240815(0x133)+_0x15e01f['parentId']));if(_0x15e01f[_0x240815(0xde)]==='folder')return console[_0x240815(0x11c)](_0x240815(0x15c)),console[_0x240815(0x11c)](_0x240815(0x173)),0x1;if(_0x15e01f[_0x240815(0xde)]===_0x240815(0x12b))return console[_0x240815(0x11c)]('Error:\x20Cannot\x20show\x20schema\x20for\x20parent\x20segment\x20with\x20this\x20command.'),console[_0x240815(0x11c)](_0x240815(0x17a)),0x1;if(!_0x15e01f[_0x240815(0x124)])throw new SDKError(ErrorCode[_0x240815(0xda)],_0x240815(0x11b));const _0x186a5e=await withSpinner(_0x240815(0xe7),()=>_0x139b5c['segment'][_0x240815(0xd7)](_0x15e01f[_0x240815(0x149)],_0x15e01f[_0x240815(0x124)]),{'verbose':_0xaa3051[_0x240815(0x17b)]}),_0x461d4f=_0x186a5e['data'],_0x398718=await executeSchemaQuery(_0x461d4f,_0x139b5c,_0xaa3051);return await handleQueryOutput(_0x398718,_0xaa3051),0x0;}catch(_0x8b32ae){if(_0x8b32ae instanceof SDKError)return console[_0x240815(0x11c)](_0x240815(0x113)+_0x8b32ae[_0x240815(0x14c)]),_0x8b32ae['cause']&&console[_0x240815(0x11c)](_0x240815(0xf7)+_0x8b32ae[_0x240815(0x121)]),0x1;throw _0x8b32ae;}}}
1
+ const a37_0x24a788=a37_0x1fe9;(function(_0x2df11e,_0x325110){const _0x2f82e2=a37_0x1fe9,_0x29c81e=_0x2df11e();while(!![]){try{const _0x5c03f3=parseInt(_0x2f82e2(0x1a5))/0x1*(-parseInt(_0x2f82e2(0x137))/0x2)+parseInt(_0x2f82e2(0x120))/0x3*(parseInt(_0x2f82e2(0x18d))/0x4)+parseInt(_0x2f82e2(0x170))/0x5*(-parseInt(_0x2f82e2(0x130))/0x6)+-parseInt(_0x2f82e2(0x145))/0x7*(-parseInt(_0x2f82e2(0x18f))/0x8)+parseInt(_0x2f82e2(0x192))/0x9*(-parseInt(_0x2f82e2(0x133))/0xa)+parseInt(_0x2f82e2(0x162))/0xb+-parseInt(_0x2f82e2(0x19c))/0xc*(parseInt(_0x2f82e2(0x115))/0xd);if(_0x5c03f3===_0x325110)break;else _0x29c81e['push'](_0x29c81e['shift']());}catch(_0x63a42c){_0x29c81e['push'](_0x29c81e['shift']());}}}(a37_0x126a,0xa2cfd));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,handleQueryOutput,handleSingleObjectOutput}from'../core/command-output.js';function a37_0x1fe9(_0x2ad7d8,_0x4b28a6){_0x2ad7d8=_0x2ad7d8-0x105;const _0x126a79=a37_0x126a();let _0x1fe909=_0x126a79[_0x2ad7d8];return _0x1fe909;}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_0xc3947b from'chalk';async function resolveSegmentTarget(_0x536d2e,_0x72297,_0x4c9a4c){const _0x8a9daa=a37_0x1fe9;if(isYamlFilePath(_0x536d2e))try{const _0x53c5ba=await resolveYamlFilePath(_0x536d2e);return _0x4c9a4c&&(console[_0x8a9daa(0x106)](_0x8a9daa(0x121)+_0x536d2e),console['error'](_0x8a9daa(0x178)+_0x53c5ba[_0x8a9daa(0x190)]),console[_0x8a9daa(0x106)](_0x8a9daa(0x18c)+_0x53c5ba[_0x8a9daa(0x116)]),console['error'](_0x8a9daa(0x141)+(_0x53c5ba[_0x8a9daa(0x195)]||_0x8a9daa(0x150))),console[_0x8a9daa(0x106)]('\x20\x20Full\x20path:\x20'+_0x53c5ba[_0x8a9daa(0x16a)])),_0x53c5ba[_0x8a9daa(0x16a)];}catch(_0x5a80c8){throw new SDKError(ErrorCode[_0x8a9daa(0x10b)],'Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20'+_0x5a80c8[_0x8a9daa(0x169)]);}if(!_0x72297)throw new SDKError(ErrorCode[_0x8a9daa(0x10b)],_0x8a9daa(0x119));return _0x72297+'/'+_0x536d2e;}export class SegmentDescribeCommand extends BaseCommand{[a37_0x24a788(0x189)]=a37_0x24a788(0x165);[a37_0x24a788(0x140)]='Show\x20segment\x20or\x20folder\x20details';async[a37_0x24a788(0x1a9)](_0x7961b7){const _0x3a8825=a37_0x24a788,{options:_0x333936,args:_0x13f97a,tdx:_0x120511}=_0x7961b7,_0x2d95f3=_0x13f97a[0x0],_0x37f683=!_0x2d95f3&&!!_0x333936[_0x3a8825(0x190)],_0x1fd6eb=_0x2d95f3||_0x333936[_0x3a8825(0x190)];if(!_0x1fd6eb)return console[_0x3a8825(0x106)](_0x3a8825(0x1a4)),console['error'](_0x3a8825(0x108)),console['error']('Examples:'),console['error'](_0x3a8825(0x11f)),console[_0x3a8825(0x106)]('\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience/Marketing/High\x20Value\x22'),console[_0x3a8825(0x106)](_0x3a8825(0x15a)),console[_0x3a8825(0x106)](_0x3a8825(0x15b)),0x1;try{const _0x2eb465=_0x333936[_0x3a8825(0x1a0)];let _0x2c4874=_0x1fd6eb;!_0x37f683&&_0x2eb465&&!_0x1fd6eb['includes']('/')&&(_0x2c4874=_0x2eb465+'/'+_0x1fd6eb,_0x333936[_0x3a8825(0x187)]&&console[_0x3a8825(0x106)](_0x3a8825(0x14d)+_0x2c4874));const _0x510a23=await withSpinner(_0x3a8825(0x134)+_0x2c4874+_0x3a8825(0x167),()=>_0x120511['segment']['resolvePathToResource'](_0x2c4874),{'verbose':_0x333936[_0x3a8825(0x187)]}),_0x8dec7c=_0x510a23[_0x3a8825(0x19b)];_0x333936[_0x3a8825(0x187)]&&(console['error'](_0x3a8825(0x179)+_0x8dec7c[_0x3a8825(0x125)]),console['error'](_0x3a8825(0x12e)+_0x8dec7c['parentId']),_0x8dec7c[_0x3a8825(0x168)]&&console[_0x3a8825(0x106)](_0x3a8825(0x184)+_0x8dec7c['folderId']),_0x8dec7c[_0x3a8825(0x14e)]&&console[_0x3a8825(0x106)]('Segment\x20ID:\x20'+_0x8dec7c[_0x3a8825(0x14e)]));if(_0x8dec7c[_0x3a8825(0x125)]===_0x3a8825(0x173)){const _0x151a91=await withSpinner(_0x3a8825(0x196),()=>_0x120511[_0x3a8825(0x10f)][_0x3a8825(0x126)](_0x8dec7c[_0x3a8825(0x13d)]),{'verbose':_0x333936['verbose']});await handleSingleObjectOutput(_0x151a91['data'],_0x333936);}else{if(_0x8dec7c['type']===_0x3a8825(0x12c)){if(!_0x8dec7c[_0x3a8825(0x168)])throw new SDKError(ErrorCode['SEGMENT_FOLDER_NOT_FOUND'],_0x3a8825(0x12b));const _0x3283d0=await withSpinner(_0x3a8825(0x155),()=>_0x120511[_0x3a8825(0x10f)][_0x3a8825(0x182)](_0x8dec7c['folderId']),{'verbose':_0x333936[_0x3a8825(0x187)]});await handleSingleObjectOutput(_0x3283d0[_0x3a8825(0x19b)],_0x333936);}else{if(_0x8dec7c['type']===_0x3a8825(0x10f)){if(!_0x8dec7c[_0x3a8825(0x14e)])throw new SDKError(ErrorCode[_0x3a8825(0x11d)],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x1236f0=await withSpinner(_0x3a8825(0x15c),()=>_0x120511[_0x3a8825(0x10f)][_0x3a8825(0x157)](_0x8dec7c[_0x3a8825(0x13d)],_0x8dec7c[_0x3a8825(0x14e)]),{'verbose':_0x333936['verbose']});await handleSingleObjectOutput(_0x1236f0[_0x3a8825(0x19b)],_0x333936);}}}return 0x0;}catch(_0x39ffdd){if(_0x39ffdd instanceof SDKError)return console[_0x3a8825(0x106)]('Error:\x20'+_0x39ffdd[_0x3a8825(0x169)]),_0x39ffdd['cause']&&console[_0x3a8825(0x106)](_0x3a8825(0x11c)+_0x39ffdd[_0x3a8825(0x14a)]),0x1;throw _0x39ffdd;}}}export class SegmentShowCommand extends BaseCommand{['name']=a37_0x24a788(0x117);[a37_0x24a788(0x140)]=a37_0x24a788(0x16f);async[a37_0x24a788(0x1a9)](_0x421819){const _0x461aff=a37_0x24a788,{options:_0x18490d,args:_0x52fb61,tdx:_0x74dd8e}=_0x421819,_0x1d8a47=_0x52fb61[0x0];if(!_0x1d8a47)return console[_0x461aff(0x106)](_0x461aff(0x1ac)),console[_0x461aff(0x106)](_0x461aff(0x129)),console[_0x461aff(0x106)](_0x461aff(0x15e)),console['error'](_0x461aff(0x118)),console['error'](_0x461aff(0x1a3)),console['error'](_0x461aff(0x1a8)),0x1;try{const _0x5a7127=_0x18490d['parentSegment'],_0x265041=await resolveSegmentTarget(_0x1d8a47,_0x5a7127,_0x18490d['verbose']);_0x18490d[_0x461aff(0x187)]&&console['error'](_0x461aff(0x147)+_0x265041);const _0x29f5ed=await withSpinner(_0x461aff(0x146)+_0x1d8a47+_0x461aff(0x167),()=>_0x74dd8e['segment'][_0x461aff(0x174)](_0x265041),{'verbose':_0x18490d[_0x461aff(0x187)]}),_0x46fa41=_0x29f5ed['data'];_0x18490d[_0x461aff(0x187)]&&(console[_0x461aff(0x106)](_0x461aff(0x179)+_0x46fa41[_0x461aff(0x125)]),console[_0x461aff(0x106)](_0x461aff(0x12e)+_0x46fa41['parentId']));if(_0x46fa41[_0x461aff(0x125)]==='folder')return console[_0x461aff(0x106)]('Error:\x20Cannot\x20execute\x20SQL\x20query\x20on\x20a\x20folder.'),console['error'](_0x461aff(0x185)),0x1;if(_0x46fa41[_0x461aff(0x125)]==='parent')return console['error']('Error:\x20Cannot\x20execute\x20query\x20for\x20parent\x20segment\x20with\x20this\x20command.'),console[_0x461aff(0x106)]('Use:\x20tdx\x20ps\x20show'),0x1;if(!_0x46fa41[_0x461aff(0x14e)])throw new SDKError(ErrorCode[_0x461aff(0x11d)],_0x461aff(0x199));const _0x50ebc5=await withSpinner(_0x461aff(0x175),()=>_0x74dd8e[_0x461aff(0x10f)][_0x461aff(0x144)](_0x46fa41['parentId'],_0x46fa41[_0x461aff(0x14e)]),{'verbose':_0x18490d[_0x461aff(0x187)]});let _0x2c63d6=_0x50ebc5[_0x461aff(0x19b)];const _0x4b59c1=resolveLimit(_0x18490d['limit'],DEFAULT_DISPLAY_LIMIT),_0x3b85e4=/\bLIMIT\s+\d+/i[_0x461aff(0x181)](_0x2c63d6);!_0x3b85e4&&(_0x2c63d6=_0x2c63d6[_0x461aff(0x18a)]()['replace'](/;+$/,''),_0x2c63d6=_0x461aff(0x1a7)+_0x2c63d6+_0x461aff(0x1a1)+_0x4b59c1);_0x18490d['verbose']&&console[_0x461aff(0x106)](_0x461aff(0x154)+_0x2c63d6);const _0x1d420c=await withProgressSpinner(_0x461aff(0x148),async _0x48bf13=>{const _0x5443ad=_0x461aff,_0xaf74b5=await _0x74dd8e[_0x5443ad(0x1ab)]['execute'](_0x2c63d6,{'catalog':'td','schema':_0x5443ad(0x15f),'onJobId':_0x575ef4=>{const _0x3b102a=_0x5443ad;_0x48bf13[_0x3b102a(0x158)](_0x575ef4);}});return _0xaf74b5;},{'verbose':_0x18490d[_0x461aff(0x187)]}),_0x105cc8=_0x1d420c[_0x461aff(0x19b)],_0x30677a=_0x105cc8[_0x461aff(0x163)]?'\x20[Job\x20ID:\x20'+_0x105cc8[_0x461aff(0x163)]+']':'';return console['error'](_0x461aff(0x176)+_0x105cc8[_0x461aff(0x19a)][_0x461aff(0x11e)][_0x461aff(0x17c)]()+_0x461aff(0x13b)+(_0x461aff(0x186)+formatElapsed(_0x105cc8[_0x461aff(0x19a)][_0x461aff(0x18b)])+_0x30677a)),await handleQueryOutput(_0x105cc8,_0x18490d),0x0;}catch(_0x4387f9){if(_0x4387f9 instanceof SDKError)return console[_0x461aff(0x106)]('✖\x20Query\x20failed\x20['+_0x4387f9[_0x461aff(0x19d)]+']'),console['error']('\x0a'+_0x4387f9[_0x461aff(0x169)]),0x1;throw _0x4387f9;}}}export class SegmentFolderListCommand extends BaseCommand{[a37_0x24a788(0x189)]='segment:folder:list';['description']='List\x20segment\x20folders\x20under\x20a\x20parent\x20segment';async[a37_0x24a788(0x1a9)](_0x4c6014){const _0x1024c0=a37_0x24a788,{options:_0x7a90f9,args:_0x11f731,tdx:_0x587618}=_0x4c6014;if(_0x11f731[_0x1024c0(0x107)]===0x0)return console[_0x1024c0(0x106)](_0x1024c0(0x131)),console['error'](_0x1024c0(0x136)),0x1;const _0x24efd4=_0x11f731[0x0];try{_0x7a90f9[_0x1024c0(0x187)]&&(console['error'](_0x1024c0(0x128)+_0x7a90f9['site']),console['error'](_0x1024c0(0x12a)+_0x24efd4));const _0x4ab083=await withSpinner(_0x1024c0(0x1a2)+_0x24efd4+'\x27...',()=>_0x587618[_0x1024c0(0x10f)][_0x1024c0(0x13a)](_0x24efd4),{'verbose':_0x7a90f9['verbose']}),_0x22baa0=_0x4ab083[_0x1024c0(0x19b)];_0x7a90f9[_0x1024c0(0x187)]&&console[_0x1024c0(0x106)](_0x1024c0(0x13f)+_0x22baa0);const _0x46ad17=await withSpinner('Listing\x20folders\x20for\x20parent\x20\x27'+_0x24efd4+_0x1024c0(0x167),()=>_0x587618[_0x1024c0(0x10f)]['listFolders'](_0x22baa0),{'verbose':_0x7a90f9[_0x1024c0(0x187)]}),_0x5410a1=_0x46ad17[_0x1024c0(0x19b)];return console[_0x1024c0(0x106)](_0x1024c0(0x11b)+_0x5410a1['length']+_0x1024c0(0x16c)+(_0x5410a1['length']!==0x1?'s':'')),await handleSDKOutput(_0x5410a1,_0x7a90f9),0x0;}catch(_0x425547){if(_0x425547 instanceof SDKError)return console['error'](_0x1024c0(0x17a)+_0x425547[_0x1024c0(0x169)]),_0x425547[_0x1024c0(0x14a)]&&console['error'](_0x1024c0(0x11c)+_0x425547[_0x1024c0(0x14a)]),0x1;throw _0x425547;}}}export class SegmentFolderShowCommand extends BaseCommand{['name']=a37_0x24a788(0x191);[a37_0x24a788(0x140)]=a37_0x24a788(0x197);async[a37_0x24a788(0x1a9)](_0x1bb7ad){const _0x2a148a=a37_0x24a788,{options:_0x21c709,args:_0x21434a,tdx:_0x312d05}=_0x1bb7ad;if(_0x21434a[_0x2a148a(0x107)]===0x0)return console[_0x2a148a(0x106)](_0x2a148a(0x1a6)),console['error']('Usage:\x20tdx\x20segment\x20folder\x20show\x20<parent_name/folder_name>'),0x1;try{const {parentId:_0x17b866,childId:_0x6e36ac}=parseSegmentRef(_0x21434a[0x0]);_0x21c709['verbose']&&(console[_0x2a148a(0x106)](_0x2a148a(0x128)+_0x21c709['site']),console['error'](_0x2a148a(0x12a)+_0x17b866),_0x6e36ac&&console[_0x2a148a(0x106)](_0x2a148a(0x13c)+_0x6e36ac));if(!_0x6e36ac)return console[_0x2a148a(0x106)]('Error:\x20Folder\x20name\x20is\x20required\x20(use\x20parent_name/folder_name\x20format)'),0x1;const _0x2421b3=await withSpinner(_0x2a148a(0x1a2)+_0x17b866+'\x27...',()=>_0x312d05[_0x2a148a(0x10f)][_0x2a148a(0x13a)](_0x17b866),{'verbose':_0x21c709[_0x2a148a(0x187)]}),_0x3ee475=_0x2421b3[_0x2a148a(0x19b)];_0x21c709['verbose']&&console['error'](_0x2a148a(0x13f)+_0x3ee475);const _0x3a0182=await withSpinner(_0x2a148a(0x161)+_0x6e36ac+_0x2a148a(0x167),()=>_0x312d05[_0x2a148a(0x10f)][_0x2a148a(0x122)](_0x3ee475,_0x6e36ac),{'verbose':_0x21c709[_0x2a148a(0x187)]}),_0x4e9c37=_0x3a0182[_0x2a148a(0x19b)];_0x21c709[_0x2a148a(0x187)]&&console['error'](_0x2a148a(0x193)+_0x4e9c37);const _0x5e6b99=await withSpinner(_0x2a148a(0x17e)+_0x6e36ac+_0x2a148a(0x167),()=>_0x312d05[_0x2a148a(0x10f)]['getFolder'](_0x4e9c37),{'verbose':_0x21c709['verbose']});return await handleSDKOutput([_0x5e6b99[_0x2a148a(0x19b)]],_0x21c709),0x0;}catch(_0x11f9e4){if(_0x11f9e4 instanceof SDKError)return console[_0x2a148a(0x106)](_0x2a148a(0x17a)+_0x11f9e4[_0x2a148a(0x169)]),_0x11f9e4['cause']&&console[_0x2a148a(0x106)](_0x2a148a(0x11c)+_0x11f9e4[_0x2a148a(0x14a)]),0x1;throw _0x11f9e4;}}}export class SegmentSQLCommand extends BaseCommand{['name']='segment:sql';['description']=a37_0x24a788(0x123);async[a37_0x24a788(0x1a9)](_0x3625a5){const _0x13030c=a37_0x24a788,{options:_0x255252,args:_0x312b16}=_0x3625a5,_0x331cc0=_0x255252,_0x1a838=_0x331cc0[_0x13030c(0x10c)],_0x2872db=_0x312b16[0x0];if(!_0x2872db&&!_0x1a838)return console[_0x13030c(0x106)](a37_0xc3947b[_0x13030c(0x11a)](_0x13030c(0x135))),console[_0x13030c(0x106)]('Usage:'),console['error'](_0x13030c(0x177)),console['error'](_0x13030c(0x16d)),console[_0x13030c(0x106)]('Examples:'),console['error']('\x20\x20tdx\x20sg\x20sql\x20\x22Premium\x20Users\x22'),console[_0x13030c(0x106)]('\x20\x20tdx\x20sg\x20sql\x20--path\x20segments/my-audience/premium-users.yml'),0x1;if(_0x2872db&&_0x1a838)return console[_0x13030c(0x106)](a37_0xc3947b[_0x13030c(0x11a)](_0x13030c(0x139))),0x1;try{let _0x50fbf3;if(_0x1a838)_0x50fbf3=await this[_0x13030c(0x172)](_0x1a838,_0x3625a5);else{if(isYamlFilePath(_0x2872db))return console['error'](a37_0xc3947b[_0x13030c(0x11a)](_0x13030c(0x14f))),console['error'](_0x13030c(0x17d)+_0x2872db),0x1;else _0x50fbf3=await this[_0x13030c(0x1aa)](_0x2872db,_0x3625a5);}return _0x255252[_0x13030c(0x138)]===_0x13030c(0x183)||_0x255252[_0x13030c(0x138)]===_0x13030c(0x143)?await handleSDKOutput([{'sql':_0x50fbf3}],_0x255252):console['log'](_0x50fbf3),0x0;}catch(_0x26bc5a){if(_0x26bc5a instanceof SDKError)return console[_0x13030c(0x106)](_0x13030c(0x17a)+_0x26bc5a[_0x13030c(0x169)]),_0x26bc5a[_0x13030c(0x14a)]&&console[_0x13030c(0x106)](_0x13030c(0x11c)+_0x26bc5a[_0x13030c(0x14a)]),0x1;throw _0x26bc5a;}}async[a37_0x24a788(0x172)](_0x2fe2d6,_0x4f2683){const _0x1fdc21=a37_0x24a788,{options:_0x56579c,tdx:_0x35a7d3}=_0x4f2683;let _0x5ece15;try{_0x5ece15=await resolveYamlFilePath(_0x2fe2d6);}catch(_0x1373ca){throw new SDKError(ErrorCode[_0x1fdc21(0x10b)],'Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20'+_0x1373ca[_0x1fdc21(0x169)]);}_0x56579c['verbose']&&console['error']('Resolved:\x20'+_0x5ece15[_0x1fdc21(0x190)]+'/'+_0x5ece15[_0x1fdc21(0x116)]);const _0x22d9b5=await withSpinner(_0x1fdc21(0x180),()=>_0x35a7d3[_0x1fdc21(0x10f)][_0x1fdc21(0x166)](_0x5ece15['content'],_0x5ece15['parentSegment'],_0x5ece15[_0x1fdc21(0x116)]),{'verbose':_0x56579c[_0x1fdc21(0x187)]});return _0x22d9b5[_0x1fdc21(0x19b)];}async[a37_0x24a788(0x1aa)](_0x568e19,_0x1789ce){const _0xacc634=a37_0x24a788,{options:_0x22a8de,tdx:_0x4b5ca2}=_0x1789ce,_0x5a4761=_0x22a8de[_0xacc634(0x190)],_0x33bca8=await resolveSegmentTarget(_0x568e19,_0x5a4761,_0x22a8de['verbose']);_0x22a8de[_0xacc634(0x187)]&&console[_0xacc634(0x106)](_0xacc634(0x147)+_0x33bca8);const _0x248f7e=await withSpinner(_0xacc634(0x146)+_0x568e19+_0xacc634(0x167),()=>_0x4b5ca2[_0xacc634(0x10f)][_0xacc634(0x174)](_0x33bca8),{'verbose':_0x22a8de[_0xacc634(0x187)]}),_0xeafdb2=_0x248f7e[_0xacc634(0x19b)];_0x22a8de[_0xacc634(0x187)]&&(console[_0xacc634(0x106)](_0xacc634(0x179)+_0xeafdb2['type']),console[_0xacc634(0x106)](_0xacc634(0x12e)+_0xeafdb2[_0xacc634(0x13d)]));if(_0xeafdb2[_0xacc634(0x125)]===_0xacc634(0x12c))throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0xacc634(0x18e));if(_0xeafdb2[_0xacc634(0x125)]===_0xacc634(0x173))throw new SDKError(ErrorCode['INVALID_ARGUMENT'],'Cannot\x20get\x20SQL\x20for\x20parent\x20segment\x20with\x20this\x20command.\x20Use:\x20tdx\x20ps\x20sql');if(!_0xeafdb2[_0xacc634(0x14e)])throw new SDKError(ErrorCode[_0xacc634(0x11d)],_0xacc634(0x199));const _0x298afc=await withSpinner(_0xacc634(0x175),()=>_0x4b5ca2['segment'][_0xacc634(0x144)](_0xeafdb2[_0xacc634(0x13d)],_0xeafdb2[_0xacc634(0x14e)]),{'verbose':_0x22a8de[_0xacc634(0x187)]});return _0x298afc[_0xacc634(0x19b)];}}function a37_0x126a(){const _0x5a53bb=['Use:\x20tdx\x20ps\x20desc','segment','Resolving\x20parent\x20folder\x20\x27','Resolved\x20parent\x20folder\x20ID:\x20','\x20\x20tdx\x20sg\x20view\x20\x22Marketing\x22\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20folder\x20details','\x20\x20tdx\x20sg\x20view\x20segments/my-audience/premium-users.yml','url','26vouIyl','segmentName','segment:show','Examples:','No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22','red','✔\x20Found\x20','\x20\x20Cause:\x20','SEGMENT_NOT_FOUND','processedRows','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience\x22','42972gqQUcL','Resolved\x20YAML\x20file:\x20','resolveFolderId','Get\x20SQL\x20query\x20for\x20child\x20segment','Error:\x20Cannot\x20view\x20parent\x20segment\x20details\x20with\x20this\x20command.','type','getParent','Use:\x20tdx\x20ps\x20view','Site:\x20','Usage:\x20tdx\x20sg\x20show\x20<name>','Parent\x20name:\x20','Folder\x20ID\x20missing\x20from\x20resolved\x20path','folder','\x20Opening\x20','Parent\x20ID:\x20','parentFolder','192Jnpcof','Error:\x20Parent\x20segment\x20name\x20is\x20required','Create\x20segment\x20folder\x20for\x20organization','50birNDS','Resolving\x20path\x20\x27','Error:\x20Segment\x20name\x20or\x20--path\x20is\x20required','Usage:\x20tdx\x20segment\x20folder\x20list\x20<parent_name>','2HxGveN','format','Error:\x20Specify\x20either\x20segment\x20name\x20or\x20--path,\x20not\x20both','resolveParentId','\x20rows\x20','Folder\x20name:\x20','parentId','\x27\x20with\x20ID:\x20','Resolved\x20parent\x20ID:\x20','description','\x20\x20Folder\x20path:\x20','Error:\x20Cannot\x20open\x20folder\x20in\x20web\x20browser.\x20Use\x20a\x20segment\x20name\x20instead.','jsonl','getSegmentSQL','268947DBAkUF','Resolving\x20\x27','Target\x20path:\x20','Executing\x20segment\x20query...','\x20\x20tdx\x20sg\x20desc\x20\x22Premium\x20Users\x22','cause','SEGMENT_FOLDER_NOT_FOUND','segment:desc','Resolved\x20relative\x20path\x20to:\x20','segmentId','Error:\x20YAML\x20file\x20paths\x20must\x20be\x20specified\x20with\x20--path\x20option','(root)','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20view\x20<path/to/segment.yml>','segment:view','/e/','SQL\x20query:\x0a','Fetching\x20folder\x20details...','/app/ps/','getSegment','setJobId','Error:\x20Cannot\x20show\x20schema\x20for\x20a\x20folder.','\x20\x20tdx\x20segment\x20describe\x20\x22High\x20Value\x22\x20\x20\x20\x20#\x20Relative\x20to\x20current\x20context','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','Fetching\x20segment\x20details...','Use:\x20tdx\x20ps\x20view\x20-w','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20show\x20<path/to/segment.yml>','information_schema','Usage:\x20tdx\x20segment\x20folder\x20create\x20<parent_name>\x20<folder_name>\x20[options]','Resolving\x20folder\x20\x27','11024178RYPurP','jobId','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20\x20\x20\x20\x20#\x20View\x20child\x20segment\x20details','segment:describe','getSegmentSQLFromYaml','\x27...','folderId','message','fullPath','site','\x20folder','\x20\x20Local\x20YAML\x20file:\x20\x20\x20\x20\x20\x20tdx\x20sg\x20sql\x20--path\x20<file-path>','Show\x20child\x20segment\x20schema\x20(column\x20types)','Execute\x20child\x20segment\x20SQL\x20query\x20and\x20show\x20results','52990bqjrVU','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20desc\x20<path/to/segment.yml>','getSQLFromYamlFile','parent','resolvePathToResource','Fetching\x20SQL\x20for\x20segment...','✔\x20Query\x20completed:\x20Processed\x20','\x20\x20Server-side\x20segment:\x20\x20tdx\x20sg\x20sql\x20<name>','\x20\x20Parent\x20segment:\x20','Resolved\x20type:\x20','Error:\x20','Error:\x20Cannot\x20open\x20parent\x20segment\x20with\x20this\x20command.','toLocaleString','\x20\x20tdx\x20sg\x20sql\x20--path\x20','Fetching\x20folder\x20\x27','✔\x20Created\x20folder\x20\x27','Fetching\x20SQL\x20from\x20rule...','test','getFolder','json','Folder\x20ID:\x20','Use:\x20tdx\x20sg\x20view\x20<name>\x20\x20#\x20To\x20show\x20folder\x20details','in\x20','verbose','Segment\x20ID:\x20','name','trim','elapsedTimeMillis','\x20\x20Segment\x20name:\x20','264gkuwuN','Cannot\x20get\x20SQL\x20query\x20for\x20a\x20folder.\x20Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.','272XKMNdD','parentSegment','segment:folder:show','470358xvGZtz','Resolved\x20folder\x20ID:\x20','\x20\x20tdx\x20sg\x20desc\x20segments/my-audience/premium-users.yml','folderPath','Fetching\x20parent\x20segment\x20details...','Show\x20segment\x20folder\x20details','segment:folder:create','Segment\x20ID\x20missing\x20from\x20resolved\x20path','stats','data','6032892TIgshW','code','Options:','\x20\x20-w,\x20--web\x20\x20Open\x20segment\x20in\x20web\x20browser','segmentPath','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','Resolving\x20parent\x20segment\x20\x27','\x20\x20tdx\x20sg\x20show\x20\x22Premium\x20Users\x22','Error:\x20Path\x20or\x20name\x20is\x20required','981091GXDTQl','Error:\x20Folder\x20reference\x20is\x20required','SELECT\x20*\x20FROM\x20(\x0a','\x20\x20tdx\x20sg\x20show\x20segments/my-audience/premium-users.yml','execute','getSQLFromServerSegment','query','Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required','Usage:\x20tdx\x20sg\x20desc\x20<name>','error','length','Usage:\x20tdx\x20segment\x20describe\x20<path>','createFolder','web','INVALID_ARGUMENT','path','Error:\x20Cannot\x20show\x20schema\x20for\x20parent\x20segment\x20with\x20this\x20command.'];a37_0x126a=function(){return _0x5a53bb;};return a37_0x126a();}export class SegmentFolderCreateCommand extends BaseCommand{[a37_0x24a788(0x189)]=a37_0x24a788(0x198);[a37_0x24a788(0x140)]=a37_0x24a788(0x132);async[a37_0x24a788(0x1a9)](_0x529413){const _0x4236ba=a37_0x24a788,{options:_0x4bcc6a,args:_0x3f5670,tdx:_0x3c55d0}=_0x529413,_0xd99c44=_0x4bcc6a;if(_0x3f5670[_0x4236ba(0x107)]<0x2)return console[_0x4236ba(0x106)]('Error:\x20Parent\x20segment\x20name\x20and\x20folder\x20name\x20are\x20required'),console[_0x4236ba(0x106)](_0x4236ba(0x160)),0x1;const _0x4a7c2f=_0x3f5670[0x0],_0x55de17=_0x3f5670[0x1];_0xd99c44[_0x4236ba(0x187)]&&(console[_0x4236ba(0x106)](_0x4236ba(0x128)+_0xd99c44[_0x4236ba(0x16b)]),console[_0x4236ba(0x106)]('Parent\x20segment:\x20'+_0x4a7c2f),console[_0x4236ba(0x106)](_0x4236ba(0x13c)+_0x55de17));let _0x528caf;if(_0xd99c44[_0x4236ba(0x12f)]){const _0x25b5d6=_0xd99c44[_0x4236ba(0x12f)],_0xf8e93a=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x4a7c2f+'\x27...',()=>_0x3c55d0[_0x4236ba(0x10f)][_0x4236ba(0x13a)](_0x4a7c2f),{'verbose':_0xd99c44[_0x4236ba(0x187)]}),_0x9d29f9=_0xf8e93a[_0x4236ba(0x19b)],_0x20f4d5=await withSpinner(_0x4236ba(0x110)+_0x25b5d6+_0x4236ba(0x167),()=>_0x3c55d0[_0x4236ba(0x10f)][_0x4236ba(0x122)](_0x9d29f9,_0x25b5d6),{'verbose':_0xd99c44[_0x4236ba(0x187)]});_0x528caf=_0x20f4d5['data'],_0xd99c44[_0x4236ba(0x187)]&&console['error'](_0x4236ba(0x111)+_0x528caf);}const _0x497431={'name':_0x55de17,'description':_0xd99c44['description'],'parentFolderId':_0x528caf},_0x2d5e77=await withSpinner('Creating\x20folder\x20\x27'+_0x55de17+_0x4236ba(0x167),()=>_0x3c55d0['segment'][_0x4236ba(0x109)](_0x4a7c2f,_0x497431),{'verbose':_0xd99c44[_0x4236ba(0x187)]}),_0x48d61d=_0x2d5e77[_0x4236ba(0x19b)];return console[_0x4236ba(0x106)](_0x4236ba(0x17f)+_0x48d61d['name']+_0x4236ba(0x13e)+_0x48d61d['id']),await handleSDKOutput([_0x48d61d],_0xd99c44),0x0;}}export class SegmentViewCommand extends BaseCommand{[a37_0x24a788(0x189)]=a37_0x24a788(0x152);['description']='Show\x20folder\x20or\x20child\x20segment\x20details';async['execute'](_0x29ab9c){const _0x554f29=a37_0x24a788,{options:_0xbe3f24,args:_0x31c39b,tdx:_0x254e8e}=_0x29ab9c,_0x55bd2a=_0x31c39b[0x0];if(!_0x55bd2a)return console[_0x554f29(0x106)]('Error:\x20Folder\x20or\x20segment\x20name,\x20or\x20YAML\x20file\x20path\x20is\x20required'),console[_0x554f29(0x106)]('Usage:\x20tdx\x20sg\x20view\x20<name>\x20[-w]'),console[_0x554f29(0x106)](_0x554f29(0x151)),console[_0x554f29(0x106)](_0x554f29(0x19e)),console[_0x554f29(0x106)](_0x554f29(0x19f)),console[_0x554f29(0x106)](_0x554f29(0x118)),console[_0x554f29(0x106)](_0x554f29(0x112)),console['error'](_0x554f29(0x164)),console[_0x554f29(0x106)]('\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20-w\x20\x20#\x20Open\x20segment\x20in\x20web\x20browser'),console['error'](_0x554f29(0x113)),0x1;try{const _0x55add4=_0xbe3f24[_0x554f29(0x190)],_0x1b5a73=await resolveSegmentTarget(_0x55bd2a,_0x55add4,_0xbe3f24[_0x554f29(0x187)]);_0xbe3f24[_0x554f29(0x187)]&&console[_0x554f29(0x106)](_0x554f29(0x147)+_0x1b5a73);const _0x115d06=await withSpinner(_0x554f29(0x146)+_0x55bd2a+_0x554f29(0x167),()=>_0x254e8e[_0x554f29(0x10f)][_0x554f29(0x174)](_0x1b5a73),{'verbose':_0xbe3f24[_0x554f29(0x187)]}),_0xf5a058=_0x115d06[_0x554f29(0x19b)];_0xbe3f24[_0x554f29(0x187)]&&(console['error'](_0x554f29(0x179)+_0xf5a058[_0x554f29(0x125)]),console[_0x554f29(0x106)](_0x554f29(0x12e)+_0xf5a058[_0x554f29(0x13d)]),_0xf5a058[_0x554f29(0x168)]&&console['error'](_0x554f29(0x184)+_0xf5a058[_0x554f29(0x168)]),_0xf5a058['segmentId']&&console[_0x554f29(0x106)](_0x554f29(0x188)+_0xf5a058[_0x554f29(0x14e)]));if(_0xbe3f24[_0x554f29(0x10a)]){if(_0xf5a058[_0x554f29(0x125)]==='folder')return console[_0x554f29(0x106)](_0x554f29(0x142)),0x1;if(_0xf5a058[_0x554f29(0x125)]===_0x554f29(0x173))return console['error'](_0x554f29(0x17b)),console[_0x554f29(0x106)](_0x554f29(0x15d)),0x1;if(!_0xf5a058[_0x554f29(0x14e)])throw new SDKError(ErrorCode[_0x554f29(0x11d)],_0x554f29(0x199));const _0x2b9f7f=getConsoleNextUrl(_0xbe3f24[_0x554f29(0x16b)],'/app/ps/'+_0xf5a058[_0x554f29(0x13d)]+_0x554f29(0x153)+_0xf5a058[_0x554f29(0x14e)]);return console['error'](a37_0xc3947b['green']('✔')+_0x554f29(0x12d)+a37_0xc3947b['cyan'](_0x2b9f7f)),openBrowser(_0x2b9f7f),0x0;}if(_0xf5a058['type']==='folder'){if(!_0xf5a058['folderId'])throw new SDKError(ErrorCode[_0x554f29(0x14b)],_0x554f29(0x12b));const _0x3e63c8=await withSpinner(_0x554f29(0x155),()=>_0x254e8e[_0x554f29(0x10f)]['getFolder'](_0xf5a058[_0x554f29(0x168)]),{'verbose':_0xbe3f24[_0x554f29(0x187)]});await handleSingleObjectOutput(_0x3e63c8[_0x554f29(0x19b)],_0xbe3f24);}else{if(_0xf5a058[_0x554f29(0x125)]==='segment'){if(!_0xf5a058[_0x554f29(0x14e)])throw new SDKError(ErrorCode[_0x554f29(0x11d)],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x3930af=await withSpinner(_0x554f29(0x15c),()=>_0x254e8e['segment'][_0x554f29(0x157)](_0xf5a058[_0x554f29(0x13d)],_0xf5a058[_0x554f29(0x14e)]),{'verbose':_0xbe3f24['verbose']}),_0x12f0df=getConsoleNextUrl(_0xbe3f24[_0x554f29(0x16b)],_0x554f29(0x156)+_0xf5a058[_0x554f29(0x13d)]+_0x554f29(0x153)+_0xf5a058[_0x554f29(0x14e)]),_0x9c51a5=_0x3930af[_0x554f29(0x19b)];_0x9c51a5[_0x554f29(0x114)]=_0x12f0df,await handleSingleObjectOutput(_0x9c51a5,_0xbe3f24);}else return console[_0x554f29(0x106)](_0x554f29(0x124)),console[_0x554f29(0x106)](_0x554f29(0x127)),0x1;}return 0x0;}catch(_0x4c23a6){if(_0x4c23a6 instanceof SDKError)return console[_0x554f29(0x106)](_0x554f29(0x17a)+_0x4c23a6[_0x554f29(0x169)]),_0x4c23a6[_0x554f29(0x14a)]&&console[_0x554f29(0x106)](_0x554f29(0x11c)+_0x4c23a6[_0x554f29(0x14a)]),0x1;throw _0x4c23a6;}}}export const SegmentInfoCommand=SegmentViewCommand;export class SegmentDescCommand extends BaseCommand{[a37_0x24a788(0x189)]=a37_0x24a788(0x14c);['description']=a37_0x24a788(0x16e);async[a37_0x24a788(0x1a9)](_0x2d7fde){const _0x20710e=a37_0x24a788,{options:_0x5f3d4e,args:_0x388368,tdx:_0x501b6b}=_0x2d7fde,_0x45b216=_0x388368[0x0];if(!_0x45b216)return console[_0x20710e(0x106)](_0x20710e(0x1ac)),console['error'](_0x20710e(0x105)),console[_0x20710e(0x106)](_0x20710e(0x171)),console[_0x20710e(0x106)]('Examples:'),console['error'](_0x20710e(0x149)),console[_0x20710e(0x106)](_0x20710e(0x194)),0x1;try{const _0x33769=_0x5f3d4e['parentSegment'],_0x4d3c5c=await resolveSegmentTarget(_0x45b216,_0x33769,_0x5f3d4e[_0x20710e(0x187)]);_0x5f3d4e['verbose']&&console[_0x20710e(0x106)](_0x20710e(0x147)+_0x4d3c5c);const _0x2f5c98=await withSpinner('Resolving\x20\x27'+_0x45b216+_0x20710e(0x167),()=>_0x501b6b[_0x20710e(0x10f)][_0x20710e(0x174)](_0x4d3c5c),{'verbose':_0x5f3d4e[_0x20710e(0x187)]}),_0x1e3fb7=_0x2f5c98[_0x20710e(0x19b)];_0x5f3d4e[_0x20710e(0x187)]&&(console[_0x20710e(0x106)](_0x20710e(0x179)+_0x1e3fb7['type']),console[_0x20710e(0x106)]('Parent\x20ID:\x20'+_0x1e3fb7[_0x20710e(0x13d)]));if(_0x1e3fb7[_0x20710e(0x125)]==='folder')return console[_0x20710e(0x106)](_0x20710e(0x159)),console[_0x20710e(0x106)]('Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.'),0x1;if(_0x1e3fb7['type']===_0x20710e(0x173))return console[_0x20710e(0x106)](_0x20710e(0x10d)),console[_0x20710e(0x106)](_0x20710e(0x10e)),0x1;if(!_0x1e3fb7['segmentId'])throw new SDKError(ErrorCode[_0x20710e(0x11d)],_0x20710e(0x199));const _0x49014a=await withSpinner(_0x20710e(0x175),()=>_0x501b6b[_0x20710e(0x10f)][_0x20710e(0x144)](_0x1e3fb7['parentId'],_0x1e3fb7[_0x20710e(0x14e)]),{'verbose':_0x5f3d4e['verbose']}),_0x16f34d=_0x49014a['data'],_0xf21bc8=await executeSchemaQuery(_0x16f34d,_0x501b6b,_0x5f3d4e);return await handleQueryOutput(_0xf21bc8,_0x5f3d4e),0x0;}catch(_0x2bb9d2){if(_0x2bb9d2 instanceof SDKError)return console[_0x20710e(0x106)](_0x20710e(0x17a)+_0x2bb9d2[_0x20710e(0x169)]),_0x2bb9d2[_0x20710e(0x14a)]&&console[_0x20710e(0x106)]('\x20\x20Cause:\x20'+_0x2bb9d2[_0x20710e(0x14a)]),0x1;throw _0x2bb9d2;}}}
@@ -1 +1 @@
1
- const a38_0x146711=a38_0xbf17;(function(_0x31734d,_0x35cb54){const _0x1e4121=a38_0xbf17,_0x22f62e=_0x31734d();while(!![]){try{const _0xee6332=parseInt(_0x1e4121(0x115))/0x1*(-parseInt(_0x1e4121(0x120))/0x2)+-parseInt(_0x1e4121(0x13d))/0x3*(parseInt(_0x1e4121(0x125))/0x4)+-parseInt(_0x1e4121(0x117))/0x5+-parseInt(_0x1e4121(0x135))/0x6*(-parseInt(_0x1e4121(0x127))/0x7)+-parseInt(_0x1e4121(0x12c))/0x8*(parseInt(_0x1e4121(0x13b))/0x9)+-parseInt(_0x1e4121(0x123))/0xa*(-parseInt(_0x1e4121(0x12b))/0xb)+parseInt(_0x1e4121(0x13f))/0xc;if(_0xee6332===_0x35cb54)break;else _0x22f62e['push'](_0x22f62e['shift']());}catch(_0x2cf588){_0x22f62e['push'](_0x22f62e['shift']());}}}(a38_0xf386,0x2f0c5));import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import{loadJSONFromOptions}from'../utils/json-loader.js';function a38_0xf386(){const _0x5c2cd9=['createSegment','Examples:','Error:\x20Cannot\x20create\x20segment\x20in\x20a\x20segment.\x20Parent\x20path\x20must\x20be\x20a\x20folder\x20or\x20parent.','2wHTYPN','folder','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/Marketing/Premium\x22\x20--rule\x20\x27...\x27','23930iAuQcR','\x20\x20Use\x20`tdx\x20sg\x20push`\x20with\x20YAML\x20files\x20instead.\x0a','10356nXccGD','description','7ZaEAIy','Parent\x20path:\x20','noCountPopulation','Parent:\x20','1419aQVBQR','1090616lXitAS','error','yellow','rule','Resolving\x20folder\x20path\x20\x27','execute','type','Create\x20child\x20segment\x20with\x20filtering\x20rules','invisible','957084zYVuIm','segment','⚠\x20Deprecation\x20warning:\x20`segment\x20create`\x20is\x20deprecated.','\x27...','\x20\x20\x20Path:\x20','verbose','9dRgsYi','Error:\x20Full\x20path\x20required\x20(parent/segment_name\x20or\x20parent/folder/segment_name)','303yfnZpr','Target\x20path:\x20','4370796ELpcev','Usage:\x20tdx\x20segment\x20create\x20<path>\x20[options]','name','includes','resolveFolderId','Creating\x20segment\x20\x27','segments','Error:\x20Segment\x20path\x20or\x20name\x20is\x20required','folderId','Usage:\x20tdx\x20segment\x20create\x20<parent/segment_name>\x20[options]','segmentPath','\x27\x20with\x20ID:\x20','kind','126523qJBrgs','data','576980ZSCPRl','resolveParentId','Site:\x20','✔\x20Created\x20segment\x20\x27','length','Resolving\x20parent\x20segment\x20\x27'];a38_0xf386=function(){return _0x5c2cd9;};return a38_0xf386();}import{parsePath,getParentPath,getBaseName}from'../sdk/segment/segment-path-parser.js';import a38_0x442098 from'chalk';function a38_0xbf17(_0x8610c5,_0x56f94f){_0x8610c5=_0x8610c5-0x113;const _0xf386c3=a38_0xf386();let _0xbf1706=_0xf386c3[_0x8610c5];return _0xbf1706;}export class SegmentCreateCommand extends BaseCommand{[a38_0x146711(0x141)]='segment:create';[a38_0x146711(0x126)]=a38_0x146711(0x133);async[a38_0x146711(0x131)](_0x53e30b){const _0x3c2f74=a38_0x146711;console[_0x3c2f74(0x12d)](a38_0x442098[_0x3c2f74(0x12e)](_0x3c2f74(0x137))),console[_0x3c2f74(0x12d)](a38_0x442098[_0x3c2f74(0x12e)](_0x3c2f74(0x124)));const {options:_0x3d6780,args:_0x2c10d2,tdx:_0x20b054}=_0x53e30b,_0x4f0af9=_0x3d6780;if(_0x2c10d2[_0x3c2f74(0x11b)]===0x0)return console[_0x3c2f74(0x12d)](_0x3c2f74(0x146)),console[_0x3c2f74(0x12d)](_0x3c2f74(0x140)),console[_0x3c2f74(0x12d)](_0x3c2f74(0x11e)),console['error']('\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/High\x20Value\x22\x20--rule\x20\x27...\x27'),console[_0x3c2f74(0x12d)](_0x3c2f74(0x122)),console['error']('\x20\x20tdx\x20segment\x20create\x20\x22Premium\x22\x20--rule\x20\x27...\x27\x20\x20#\x20Relative\x20to\x20context'),0x1;const _0x327c08=_0x2c10d2[0x0],_0x7503d8=_0x3d6780[_0x3c2f74(0x149)];let _0x1c5a38=_0x327c08;_0x7503d8&&!_0x327c08[_0x3c2f74(0x142)]('/')&&(_0x1c5a38=_0x7503d8+'/'+_0x327c08,_0x4f0af9[_0x3c2f74(0x13a)]&&console[_0x3c2f74(0x12d)]('Resolved\x20relative\x20path\x20to:\x20'+_0x1c5a38));const _0x2e4347=parsePath(_0x1c5a38);if(_0x2e4347[_0x3c2f74(0x145)][_0x3c2f74(0x11b)]<0x2)return console['error'](_0x3c2f74(0x13c)),console[_0x3c2f74(0x12d)](_0x3c2f74(0x148)),0x1;const _0x133d72=_0x2e4347[_0x3c2f74(0x145)][0x0],_0x1c2959=getBaseName(_0x1c5a38),_0x552988=getParentPath(_0x1c5a38);_0x4f0af9['verbose']&&(console['error'](_0x3c2f74(0x119)+_0x4f0af9['site']),console['error'](_0x3c2f74(0x13e)+_0x1c5a38),console[_0x3c2f74(0x12d)](_0x3c2f74(0x12a)+_0x133d72),console['error']('Segment\x20name:\x20'+_0x1c2959),console['error'](_0x3c2f74(0x128)+_0x552988));const _0x1608d4=await withSpinner(_0x3c2f74(0x11c)+_0x133d72+_0x3c2f74(0x138),()=>_0x20b054[_0x3c2f74(0x136)][_0x3c2f74(0x118)](_0x133d72),{'verbose':_0x4f0af9[_0x3c2f74(0x13a)]}),_0x5eaeae=_0x1608d4[_0x3c2f74(0x116)];let _0x5d20f5;if(_0x2e4347[_0x3c2f74(0x145)][_0x3c2f74(0x11b)]>0x2){const _0x15b916=await withSpinner(_0x3c2f74(0x130)+_0x552988+_0x3c2f74(0x138),()=>_0x20b054[_0x3c2f74(0x136)]['resolvePathToResource'](_0x552988),{'verbose':_0x4f0af9[_0x3c2f74(0x13a)]}),_0x449b4d=_0x15b916[_0x3c2f74(0x116)];if(_0x449b4d[_0x3c2f74(0x132)]!==_0x3c2f74(0x121)&&_0x449b4d[_0x3c2f74(0x132)]!=='parent')return console['error'](_0x3c2f74(0x11f)),0x1;_0x5d20f5=_0x449b4d[_0x3c2f74(0x147)];}else{if(_0x4f0af9['folder']){const _0x17bc0b=await withSpinner('Resolving\x20folder\x20\x27'+_0x4f0af9['folder']+'\x27...',()=>_0x20b054[_0x3c2f74(0x136)][_0x3c2f74(0x143)](_0x5eaeae,_0x4f0af9['folder']),{'verbose':_0x4f0af9['verbose']});_0x5d20f5=_0x17bc0b['data'];}}_0x4f0af9[_0x3c2f74(0x13a)]&&_0x5d20f5&&console[_0x3c2f74(0x12d)]('Resolved\x20folder\x20ID:\x20'+_0x5d20f5);const _0x567107=await loadJSONFromOptions(_0x4f0af9[_0x3c2f74(0x12f)],_0x4f0af9['ruleFile']),_0x288182={'name':_0x1c2959,'description':_0x4f0af9[_0x3c2f74(0x126)],'rule':_0x567107,'kind':_0x4f0af9[_0x3c2f74(0x114)]!==undefined?parseInt(_0x4f0af9['kind'],0xa):undefined,'isVisible':_0x4f0af9[_0x3c2f74(0x134)]?![]:undefined,'segmentFolderId':_0x5d20f5,'countPopulation':_0x4f0af9[_0x3c2f74(0x129)]?![]:undefined},_0x2b805f=await withSpinner(_0x3c2f74(0x144)+_0x1c2959+_0x3c2f74(0x138),()=>_0x20b054[_0x3c2f74(0x136)][_0x3c2f74(0x11d)](_0x5eaeae,_0x288182),{'verbose':_0x4f0af9[_0x3c2f74(0x13a)]}),_0x376730=_0x2b805f['data'];return console[_0x3c2f74(0x12d)](_0x3c2f74(0x11a)+_0x376730['name']+_0x3c2f74(0x113)+_0x376730['id']),_0x1c5a38!==_0x327c08&&console['error'](_0x3c2f74(0x139)+_0x1c5a38),await handleSDKOutput([_0x376730],_0x4f0af9),0x0;}}
1
+ const a38_0x3e7c15=a38_0x28bd;(function(_0xf6c14b,_0x160b1d){const _0x3ad42a=a38_0x28bd,_0xef2f9b=_0xf6c14b();while(!![]){try{const _0x2a5ff1=-parseInt(_0x3ad42a(0x19c))/0x1*(parseInt(_0x3ad42a(0x1c2))/0x2)+-parseInt(_0x3ad42a(0x1a2))/0x3+parseInt(_0x3ad42a(0x1c5))/0x4*(parseInt(_0x3ad42a(0x1a1))/0x5)+-parseInt(_0x3ad42a(0x1bf))/0x6+-parseInt(_0x3ad42a(0x1a5))/0x7*(parseInt(_0x3ad42a(0x1ad))/0x8)+-parseInt(_0x3ad42a(0x1a6))/0x9*(-parseInt(_0x3ad42a(0x1aa))/0xa)+parseInt(_0x3ad42a(0x1bd))/0xb;if(_0x2a5ff1===_0x160b1d)break;else _0xef2f9b['push'](_0xef2f9b['shift']());}catch(_0xf70da0){_0xef2f9b['push'](_0xef2f9b['shift']());}}}(a38_0x1e19,0x48ccb));function a38_0x28bd(_0x8a9b49,_0x5bf9b1){_0x8a9b49=_0x8a9b49-0x196;const _0x1e1900=a38_0x1e19();let _0x28bd37=_0x1e1900[_0x8a9b49];return _0x28bd37;}import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import{loadJSONFromOptions}from'../utils/json-loader.js';import{parsePath,getParentPath,getBaseName}from'../sdk/segment/segment-path-parser.js';import a38_0xf4f6e7 from'chalk';function a38_0x1e19(){const _0x3761cf=['160xhnHbI','data','description','site','segments','kind','Resolving\x20folder\x20\x27','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/Marketing/Premium\x22\x20--rule\x20\x27...\x27','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/High\x20Value\x22\x20--rule\x20\x27...\x27','Parent\x20path:\x20','Resolved\x20relative\x20path\x20to:\x20','type','\x27...','length','ruleFile','segment','17338233ViUWAH','noCountPopulation','1407822KsmqNA','Parent:\x20','folderId','4PjivFa','includes','resolveFolderId','4HLEhoc','Creating\x20segment\x20\x27','Examples:','Site:\x20','Resolved\x20folder\x20ID:\x20','Error:\x20Cannot\x20create\x20segment\x20in\x20a\x20segment.\x20Parent\x20path\x20must\x20be\x20a\x20folder\x20or\x20parent.','createSegment','143947rXMsRN','invisible','Resolving\x20folder\x20path\x20\x27','✔\x20Created\x20segment\x20\x27','resolvePathToResource','1175215fxumCV','1586352xZgWBp','\x20\x20tdx\x20segment\x20create\x20\x22Premium\x22\x20--rule\x20\x27...\x27\x20\x20#\x20Relative\x20to\x20context','name','163590kCVwMQ','63oloKrw','yellow','folder','error','8080CMfXCT','verbose','Error:\x20Full\x20path\x20required\x20(parent/segment_name\x20or\x20parent/folder/segment_name)'];a38_0x1e19=function(){return _0x3761cf;};return a38_0x1e19();}export class SegmentCreateCommand extends BaseCommand{[a38_0x3e7c15(0x1a4)]='segment:create';[a38_0x3e7c15(0x1af)]='Create\x20child\x20segment\x20with\x20filtering\x20rules';async['execute'](_0x5418bc){const _0x5ea74b=a38_0x3e7c15;console[_0x5ea74b(0x1a9)](a38_0xf4f6e7['yellow']('⚠\x20Deprecation\x20warning:\x20`segment\x20create`\x20is\x20deprecated.')),console[_0x5ea74b(0x1a9)](a38_0xf4f6e7[_0x5ea74b(0x1a7)]('\x20\x20Use\x20`tdx\x20sg\x20push`\x20with\x20YAML\x20files\x20instead.\x0a'));const {options:_0x24bd5c,args:_0x4137ca,tdx:_0x1a3a6f}=_0x5418bc,_0x3bdeb9=_0x24bd5c;if(_0x4137ca[_0x5ea74b(0x1ba)]===0x0)return console[_0x5ea74b(0x1a9)]('Error:\x20Segment\x20path\x20or\x20name\x20is\x20required'),console[_0x5ea74b(0x1a9)]('Usage:\x20tdx\x20segment\x20create\x20<path>\x20[options]'),console[_0x5ea74b(0x1a9)](_0x5ea74b(0x197)),console[_0x5ea74b(0x1a9)](_0x5ea74b(0x1b5)),console[_0x5ea74b(0x1a9)](_0x5ea74b(0x1b4)),console[_0x5ea74b(0x1a9)](_0x5ea74b(0x1a3)),0x1;const _0x2dc8c6=_0x4137ca[0x0],_0x3aac4b=_0x24bd5c['segmentPath'];let _0x5d1922=_0x2dc8c6;_0x3aac4b&&!_0x2dc8c6[_0x5ea74b(0x1c3)]('/')&&(_0x5d1922=_0x3aac4b+'/'+_0x2dc8c6,_0x3bdeb9[_0x5ea74b(0x1ab)]&&console['error'](_0x5ea74b(0x1b7)+_0x5d1922));const _0x580f64=parsePath(_0x5d1922);if(_0x580f64[_0x5ea74b(0x1b1)][_0x5ea74b(0x1ba)]<0x2)return console[_0x5ea74b(0x1a9)](_0x5ea74b(0x1ac)),console['error']('Usage:\x20tdx\x20segment\x20create\x20<parent/segment_name>\x20[options]'),0x1;const _0x43a6a0=_0x580f64['segments'][0x0],_0xd3a371=getBaseName(_0x5d1922),_0x451702=getParentPath(_0x5d1922);_0x3bdeb9[_0x5ea74b(0x1ab)]&&(console['error'](_0x5ea74b(0x198)+_0x3bdeb9[_0x5ea74b(0x1b0)]),console[_0x5ea74b(0x1a9)]('Target\x20path:\x20'+_0x5d1922),console[_0x5ea74b(0x1a9)](_0x5ea74b(0x1c0)+_0x43a6a0),console[_0x5ea74b(0x1a9)]('Segment\x20name:\x20'+_0xd3a371),console[_0x5ea74b(0x1a9)](_0x5ea74b(0x1b6)+_0x451702));const _0x1a413d=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x43a6a0+'\x27...',()=>_0x1a3a6f[_0x5ea74b(0x1bc)]['resolveParentId'](_0x43a6a0),{'verbose':_0x3bdeb9['verbose']}),_0x114672=_0x1a413d['data'];let _0x5d3baa;if(_0x580f64[_0x5ea74b(0x1b1)][_0x5ea74b(0x1ba)]>0x2){const _0x2538f5=await withSpinner(_0x5ea74b(0x19e)+_0x451702+_0x5ea74b(0x1b9),()=>_0x1a3a6f['segment'][_0x5ea74b(0x1a0)](_0x451702),{'verbose':_0x3bdeb9[_0x5ea74b(0x1ab)]}),_0x741b48=_0x2538f5[_0x5ea74b(0x1ae)];if(_0x741b48[_0x5ea74b(0x1b8)]!==_0x5ea74b(0x1a8)&&_0x741b48[_0x5ea74b(0x1b8)]!=='parent')return console[_0x5ea74b(0x1a9)](_0x5ea74b(0x19a)),0x1;_0x5d3baa=_0x741b48[_0x5ea74b(0x1c1)];}else{if(_0x3bdeb9[_0x5ea74b(0x1a8)]){const _0x2427ee=await withSpinner(_0x5ea74b(0x1b3)+_0x3bdeb9[_0x5ea74b(0x1a8)]+'\x27...',()=>_0x1a3a6f[_0x5ea74b(0x1bc)][_0x5ea74b(0x1c4)](_0x114672,_0x3bdeb9[_0x5ea74b(0x1a8)]),{'verbose':_0x3bdeb9[_0x5ea74b(0x1ab)]});_0x5d3baa=_0x2427ee[_0x5ea74b(0x1ae)];}}_0x3bdeb9[_0x5ea74b(0x1ab)]&&_0x5d3baa&&console[_0x5ea74b(0x1a9)](_0x5ea74b(0x199)+_0x5d3baa);const _0xa34e8f=await loadJSONFromOptions(_0x3bdeb9['rule'],_0x3bdeb9[_0x5ea74b(0x1bb)]),_0x22ceee={'name':_0xd3a371,'description':_0x3bdeb9[_0x5ea74b(0x1af)],'rule':_0xa34e8f,'kind':_0x3bdeb9['kind']!==undefined?parseInt(_0x3bdeb9[_0x5ea74b(0x1b2)],0xa):undefined,'isVisible':_0x3bdeb9[_0x5ea74b(0x19d)]?![]:undefined,'segmentFolderId':_0x5d3baa,'countPopulation':_0x3bdeb9[_0x5ea74b(0x1be)]?![]:undefined},_0x4f86bf=await withSpinner(_0x5ea74b(0x196)+_0xd3a371+_0x5ea74b(0x1b9),()=>_0x1a3a6f[_0x5ea74b(0x1bc)][_0x5ea74b(0x19b)](_0x114672,_0x22ceee),{'verbose':_0x3bdeb9[_0x5ea74b(0x1ab)]}),_0x2dab2c=_0x4f86bf[_0x5ea74b(0x1ae)];return console[_0x5ea74b(0x1a9)](_0x5ea74b(0x19f)+_0x2dab2c[_0x5ea74b(0x1a4)]+'\x27\x20with\x20ID:\x20'+_0x2dab2c['id']),_0x5d1922!==_0x2dc8c6&&console[_0x5ea74b(0x1a9)]('\x20\x20\x20Path:\x20'+_0x5d1922),await handleSDKOutput([_0x2dab2c],_0x3bdeb9),0x0;}}
@@ -1 +1 @@
1
- const a39_0x4078c0=a39_0x1b21;(function(_0x492430,_0x2b203e){const _0x1853bc=a39_0x1b21,_0x430ecc=_0x492430();while(!![]){try{const _0x2c9ab4=-parseInt(_0x1853bc(0x83))/0x1*(-parseInt(_0x1853bc(0x7c))/0x2)+parseInt(_0x1853bc(0x84))/0x3*(parseInt(_0x1853bc(0x7e))/0x4)+parseInt(_0x1853bc(0x87))/0x5*(parseInt(_0x1853bc(0x8c))/0x6)+parseInt(_0x1853bc(0x89))/0x7*(-parseInt(_0x1853bc(0x7b))/0x8)+-parseInt(_0x1853bc(0x8d))/0x9+parseInt(_0x1853bc(0x7f))/0xa+-parseInt(_0x1853bc(0x75))/0xb;if(_0x2c9ab4===_0x2b203e)break;else _0x430ecc['push'](_0x430ecc['shift']());}catch(_0x9850b2){_0x430ecc['push'](_0x430ecc['shift']());}}}(a39_0x3913,0x56427));import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import{displayFieldsHumanReadable}from'../sdk/segment/fields-display.js';function a39_0x3913(){const _0x149e88=['json','3732278yjkmoe','segment','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','jsonl','✔\x20Found\x20','Parent\x20segment:\x20','8tuCNmu','356472aLckjJ','Error:\x20Parent\x20segment\x20name\x20is\x20required','1641972nfuLeM','375790JLapQJ','listFields','segment:fields','\x27...','3HEzThy','3PgDJOf','data','length','1627375hygFqW','verbose','2383549YqjgqV','List\x20available\x20fields\x20for\x20segmentation','name','6UVPyVj','2476179GeugdB','error'];a39_0x3913=function(){return _0x149e88;};return a39_0x3913();}function a39_0x1b21(_0x379b96,_0x1b1b6c){_0x379b96=_0x379b96-0x73;const _0x3913de=a39_0x3913();let _0x1b2171=_0x3913de[_0x379b96];return _0x1b2171;}export class SegmentFieldsCommand extends BaseCommand{[a39_0x4078c0(0x8b)]=a39_0x4078c0(0x81);['description']=a39_0x4078c0(0x8a);async['execute'](_0x44ef9d){const _0x5ae4ee=a39_0x4078c0,{options:_0x5eb588,args:_0x408744,tdx:_0x211a05}=_0x44ef9d,_0x5ea971=_0x408744[0x0]||_0x5eb588['parentSegment'];if(!_0x5ea971)return console[_0x5ae4ee(0x73)](_0x5ae4ee(0x7d)),console[_0x5ae4ee(0x73)]('Usage:\x20tdx\x20segment\x20fields\x20<parent_name>'),console[_0x5ae4ee(0x73)](_0x5ae4ee(0x77)),0x1;_0x5eb588[_0x5ae4ee(0x88)]&&(console['error']('Site:\x20'+_0x5eb588['site']),console['error'](_0x5ae4ee(0x7a)+_0x5ea971));const _0x5bb03c=await withSpinner('Listing\x20fields\x20for\x20\x27'+_0x5ea971+_0x5ae4ee(0x82),()=>_0x211a05[_0x5ae4ee(0x76)][_0x5ae4ee(0x80)](_0x5ea971),{'verbose':_0x5eb588[_0x5ae4ee(0x88)]}),_0x1f9fc7=_0x5bb03c[_0x5ae4ee(0x85)];console[_0x5ae4ee(0x73)](_0x5ae4ee(0x79)+_0x1f9fc7['length']+'\x20field'+(_0x1f9fc7[_0x5ae4ee(0x86)]!==0x1?'s':''));if(_0x5eb588[_0x5ae4ee(0x74)]||_0x5eb588[_0x5ae4ee(0x78)])return await handleSDKOutput(_0x1f9fc7,_0x5eb588),0x0;return displayFieldsHumanReadable(_0x1f9fc7,_0x5ea971),0x0;}}
1
+ const a39_0x27f7dc=a39_0x58ce;function a39_0x58ce(_0x3ae8f4,_0x40f939){_0x3ae8f4=_0x3ae8f4-0x185;const _0x57e743=a39_0x57e7();let _0x58ce35=_0x57e743[_0x3ae8f4];return _0x58ce35;}(function(_0x2298d1,_0x2eb4cb){const _0x5a7057=a39_0x58ce,_0x1b8c78=_0x2298d1();while(!![]){try{const _0x2d283a=-parseInt(_0x5a7057(0x199))/0x1+-parseInt(_0x5a7057(0x18f))/0x2+parseInt(_0x5a7057(0x18d))/0x3*(-parseInt(_0x5a7057(0x185))/0x4)+-parseInt(_0x5a7057(0x18c))/0x5*(parseInt(_0x5a7057(0x196))/0x6)+parseInt(_0x5a7057(0x188))/0x7*(parseInt(_0x5a7057(0x195))/0x8)+parseInt(_0x5a7057(0x19b))/0x9*(-parseInt(_0x5a7057(0x1a3))/0xa)+parseInt(_0x5a7057(0x19f))/0xb*(parseInt(_0x5a7057(0x190))/0xc);if(_0x2d283a===_0x2eb4cb)break;else _0x1b8c78['push'](_0x1b8c78['shift']());}catch(_0xcbc0a){_0x1b8c78['push'](_0x1b8c78['shift']());}}}(a39_0x57e7,0x7b5c7));import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../core/command-output.js';function a39_0x57e7(){const _0x40ea00=['1911694TXIQkG','24OfSMfR','Parent\x20segment:\x20','segment:fields','List\x20available\x20fields\x20for\x20segmentation','Site:\x20','696448ocLomT','42cEDSoj','error','name','967002PJufDn','Error:\x20Parent\x20segment\x20name\x20is\x20required','10962IMGOza','\x27...','data','verbose','21348019oimreq','length','listFields','✔\x20Found\x20','4480yaLjoP','Listing\x20fields\x20for\x20\x27','execute','38388iekuTj','segment','\x20field','7EnXCab','jsonl','json','Usage:\x20tdx\x20segment\x20fields\x20<parent_name>','333485yVSOwz','165gfzXYl','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>'];a39_0x57e7=function(){return _0x40ea00;};return a39_0x57e7();}import{withSpinner}from'../utils/spinner.js';import{displayFieldsHumanReadable}from'../sdk/segment/fields-display.js';export class SegmentFieldsCommand extends BaseCommand{[a39_0x27f7dc(0x198)]=a39_0x27f7dc(0x192);['description']=a39_0x27f7dc(0x193);async[a39_0x27f7dc(0x1a5)](_0x223b22){const _0x31a2f9=a39_0x27f7dc,{options:_0x2d52ed,args:_0x5b8422,tdx:_0x3c4379}=_0x223b22,_0x227551=_0x5b8422[0x0]||_0x2d52ed['parentSegment'];if(!_0x227551)return console[_0x31a2f9(0x197)](_0x31a2f9(0x19a)),console[_0x31a2f9(0x197)](_0x31a2f9(0x18b)),console['error'](_0x31a2f9(0x18e)),0x1;_0x2d52ed[_0x31a2f9(0x19e)]&&(console[_0x31a2f9(0x197)](_0x31a2f9(0x194)+_0x2d52ed['site']),console[_0x31a2f9(0x197)](_0x31a2f9(0x191)+_0x227551));const _0x4a7d3a=await withSpinner(_0x31a2f9(0x1a4)+_0x227551+_0x31a2f9(0x19c),()=>_0x3c4379[_0x31a2f9(0x186)][_0x31a2f9(0x1a1)](_0x227551),{'verbose':_0x2d52ed[_0x31a2f9(0x19e)]}),_0xf7b6e8=_0x4a7d3a[_0x31a2f9(0x19d)];console[_0x31a2f9(0x197)](_0x31a2f9(0x1a2)+_0xf7b6e8[_0x31a2f9(0x1a0)]+_0x31a2f9(0x187)+(_0xf7b6e8[_0x31a2f9(0x1a0)]!==0x1?'s':''));if(_0x2d52ed[_0x31a2f9(0x18a)]||_0x2d52ed[_0x31a2f9(0x189)])return await handleSDKOutput(_0xf7b6e8,_0x2d52ed),0x0;return displayFieldsHumanReadable(_0xf7b6e8,_0x227551),0x0;}}