@treasuredata/tdx 2026.5.0 → 2026.5.1

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 (240) 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/target-resolution.js +1 -1
  170. package/dist/sdk/segment/tdx-config.js +1 -1
  171. package/dist/sdk/segment/types/activation-schema.js +1 -1
  172. package/dist/sdk/segment/types/journey-def.js +1 -1
  173. package/dist/sdk/segment/types/journey-schema.js +1 -1
  174. package/dist/sdk/segment/types/segment-def.js +1 -1
  175. package/dist/sdk/segment/types/segment-schema.js +1 -1
  176. package/dist/sdk/segment/validate-files.js +1 -1
  177. package/dist/sdk/segment/yaml-validator.js +1 -1
  178. package/dist/sdk/segment.js +1 -1
  179. package/dist/sdk/types/cdp.d.ts +19 -0
  180. package/dist/sdk/types/cdp.d.ts.map +1 -1
  181. package/dist/sdk/types/index.d.ts +1 -1
  182. package/dist/sdk/types/index.d.ts.map +1 -1
  183. package/dist/sdk/types/index.js +1 -1
  184. package/dist/sdk/types/index.js.map +1 -1
  185. package/dist/sdk/types/progress.js +1 -1
  186. package/dist/sdk/types/workspace.js +1 -1
  187. package/dist/sdk/user.js +1 -1
  188. package/dist/sdk/util/format-detector.js +1 -1
  189. package/dist/sdk/util/formatters.js +1 -1
  190. package/dist/sdk/util/index.js +1 -1
  191. package/dist/sdk/util/paginate.js +1 -1
  192. package/dist/sdk/util/tree-formatter.js +1 -1
  193. package/dist/sdk/workflow/archive-validation.js +1 -1
  194. package/dist/sdk/workflow/clone-workflow.js +1 -1
  195. package/dist/sdk/workflow/index.js +1 -1
  196. package/dist/sdk/workflow/pull-workflow.js +1 -1
  197. package/dist/sdk/workflow/push-workflow.js +1 -1
  198. package/dist/sdk/workflow/task-graph.js +1 -1
  199. package/dist/sdk/workflow/tdx-config.js +1 -1
  200. package/dist/sdk/workflow/workflow-utils.js +1 -1
  201. package/dist/sdk/workspace/access-tracker.js +1 -1
  202. package/dist/sdk/workspace/frontmatter.js +1 -1
  203. package/dist/sdk/workspace/git.js +1 -1
  204. package/dist/sdk/workspace/index.js +1 -1
  205. package/dist/sdk/workspace/templates.js +1 -1
  206. package/dist/sdk/workspace/weekly.js +1 -1
  207. package/dist/sdk/workspace/wikilinks.js +1 -1
  208. package/dist/test-utils/command-runner.js +1 -1
  209. package/dist/test-utils/factories.js +1 -1
  210. package/dist/test-utils/fixtures.js +1 -1
  211. package/dist/test-utils/http-mock.js +1 -1
  212. package/dist/test-utils/index.js +1 -1
  213. package/dist/utils/async.js +1 -1
  214. package/dist/utils/colors.js +1 -1
  215. package/dist/utils/diff.js +1 -1
  216. package/dist/utils/file-permissions.js +1 -1
  217. package/dist/utils/file-reader.js +1 -1
  218. package/dist/utils/github-releases.js +1 -1
  219. package/dist/utils/global-cache.js +1 -1
  220. package/dist/utils/json-loader.js +1 -1
  221. package/dist/utils/local-cache.js +1 -1
  222. package/dist/utils/logger/formatters/default-formatter.js +1 -1
  223. package/dist/utils/logger/formatters/index.js +1 -1
  224. package/dist/utils/logger/handlers/console-handler.js +1 -1
  225. package/dist/utils/logger/handlers/file-handler.js +1 -1
  226. package/dist/utils/logger/handlers/index.js +1 -1
  227. package/dist/utils/logger/handlers/null-handler.js +1 -1
  228. package/dist/utils/logger/index.js +1 -1
  229. package/dist/utils/logger/logger.js +1 -1
  230. package/dist/utils/logger/types.js +1 -1
  231. package/dist/utils/option-validation.js +1 -1
  232. package/dist/utils/process.js +1 -1
  233. package/dist/utils/prompt.js +1 -1
  234. package/dist/utils/spinner.js +1 -1
  235. package/dist/utils/sse-parser.js +1 -1
  236. package/dist/utils/string-utils.js +1 -1
  237. package/dist/utils/table-ref-parser.js +1 -1
  238. package/dist/utils/tdx-logger.js +1 -1
  239. package/dist/utils/version-check.js +1 -1
  240. 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_0x3b5a2f=a32_0x31d4;(function(_0x1eb9a3,_0x17ba64){const _0x4c6e3f=a32_0x31d4,_0x505710=_0x1eb9a3();while(!![]){try{const _0x12bb3a=parseInt(_0x4c6e3f(0xb0))/0x1*(-parseInt(_0x4c6e3f(0xc2))/0x2)+-parseInt(_0x4c6e3f(0xb8))/0x3+-parseInt(_0x4c6e3f(0x95))/0x4*(parseInt(_0x4c6e3f(0x9e))/0x5)+parseInt(_0x4c6e3f(0x94))/0x6+parseInt(_0x4c6e3f(0xa1))/0x7*(-parseInt(_0x4c6e3f(0xaf))/0x8)+parseInt(_0x4c6e3f(0xa7))/0x9*(-parseInt(_0x4c6e3f(0x99))/0xa)+-parseInt(_0x4c6e3f(0xb5))/0xb*(-parseInt(_0x4c6e3f(0x96))/0xc);if(_0x12bb3a===_0x17ba64)break;else _0x505710['push'](_0x505710['shift']());}catch(_0xd3766c){_0x505710['push'](_0x505710['shift']());}}}(a32_0x2939,0x42353));import{BaseCommand}from'./command.js';import{handleSDKOutput,handleSingleObjectOutput,isStructuredFormat}from'../core/command-output.js';function a32_0x31d4(_0x1fbbc7,_0x11b20e){_0x1fbbc7=_0x1fbbc7-0x90;const _0x2939b3=a32_0x2939();let _0x31d4a9=_0x2939b3[_0x1fbbc7];return _0x31d4a9;}import{withSpinner}from'../utils/spinner.js';import a32_0x1d61d4 from'chalk';function a32_0x2939(){const _0x376769=['\x20\x20\x20','1299950edKMML','verbose','policy\x20list','686497ZrIYAc','description','\x20assigned','Listing\x20policies...','✔\x20Found\x20','(ID:\x20','1477809IKtUxl','Administrator','padEnd','getPolicy','Show\x20current\x20user\x20policies\x20and\x20effective\x20permissions','List\x20all\x20policies\x20in\x20the\x20account\x20(admin\x20only)','name','execute','40LJDsKE','473597DtvPYf','email','No\x20policies\x20found','dim','length','1584sEqKmu','Account\x20Owner','data','278976HAeNaT','join','operation','policy\x20show','site','listPolicies','👥\x20Assigned\x20Users','getPolicyUsers','\x20\x20•\x20','error','2BuoPsv','all','ies','entries','\x20—\x20','Fetching\x20policy...','account_owner','max','permissions','log','validate','policy','📋\x20Assigned\x20Policies','\x20polic','Usage:\x20tdx\x20policy\x20show\x20<policy-name-or-id>','1637244GdgiPK','8QeCkcB','172320HumxVw','Member','bold','30ahonbU','getPolicyPermissions','Show\x20a\x20specific\x20policy\x20details\x20and\x20permissions\x20(admin\x20only)','Fetching\x20permissions...'];a32_0x2939=function(){return _0x376769;};return a32_0x2939();}export class PolicyCommand extends BaseCommand{['name']=a32_0x3b5a2f(0x90);[a32_0x3b5a2f(0xa2)]=a32_0x3b5a2f(0xab);async[a32_0x3b5a2f(0xae)](_0x47e879){const _0x2956ba=a32_0x3b5a2f,{options:_0x5ad13e,tdx:_0x587b82}=_0x47e879,_0xcef3f9=await withSpinner(_0x2956ba(0x9c),async()=>{const _0x14ea89=_0x2956ba,[_0x19d853,_0x1dd78e]=await Promise[_0x14ea89(0xc3)]([_0x587b82['user']['getCurrent'](),_0x587b82['policy']['getMyPermissions']()]);return{'userInfo':_0x19d853,'permissions':_0x1dd78e};},{'verbose':_0x5ad13e[_0x2956ba(0x9f)]}),{userInfo:_0x427cba,permissions:_0x550c3c}=_0xcef3f9[_0x2956ba(0xb7)];if(isStructuredFormat(_0x5ad13e))return await handleSingleObjectOutput(_0x550c3c,_0x5ad13e),0x0;const _0x2d3627=_0x427cba[_0x2956ba(0xc8)]?_0x2956ba(0xb6):_0x427cba['administrator']?_0x2956ba(0xa8):_0x2956ba(0x97);console[_0x2956ba(0xcb)]('\x0a'+a32_0x1d61d4[_0x2956ba(0x98)]('👤')+'\x20'+a32_0x1d61d4[_0x2956ba(0x98)](_0x427cba[_0x2956ba(0xad)])+'\x20'+a32_0x1d61d4[_0x2956ba(0xb3)]('('+_0x427cba[_0x2956ba(0xb1)]+')')+'\x20—\x20'+_0x2d3627),console[_0x2956ba(0xcb)](a32_0x1d61d4[_0x2956ba(0xb3)](_0x2956ba(0x9d)+_0x587b82['context'][_0x2956ba(0xbc)]+':'+_0x427cba['account_id']+',\x20user_id:'+_0x427cba['id']));const _0x287315=_0x550c3c['policies'];console[_0x2956ba(0xcb)]('\x0a'+a32_0x1d61d4[_0x2956ba(0x98)](_0x2956ba(0x91))+'\x20('+_0x287315[_0x2956ba(0xb4)]+'):');if(_0x287315[_0x2956ba(0xb4)]===0x0)console[_0x2956ba(0xcb)](a32_0x1d61d4[_0x2956ba(0xb3)]('\x20\x20No\x20policies\x20assigned'));else for(const _0x11e222 of _0x287315){console['log'](_0x2956ba(0xc0)+_0x11e222[_0x2956ba(0xad)]);}return printPermissionsMap(_0x550c3c[_0x2956ba(0xca)]),console[_0x2956ba(0xcb)](),0x0;}}export class PolicyListCommand extends BaseCommand{[a32_0x3b5a2f(0xad)]=a32_0x3b5a2f(0xa0);[a32_0x3b5a2f(0xa2)]=a32_0x3b5a2f(0xac);async[a32_0x3b5a2f(0xae)](_0xddcca6){const _0x57f7a6=a32_0x3b5a2f,{options:_0x337077,tdx:_0x3bf1b8}=_0xddcca6,_0x236c56=await withSpinner(_0x57f7a6(0xa4),()=>_0x3bf1b8[_0x57f7a6(0x90)][_0x57f7a6(0xbd)](),{'verbose':_0x337077[_0x57f7a6(0x9f)]}),_0x1b749f=_0x236c56[_0x57f7a6(0xb7)];console[_0x57f7a6(0xc1)](_0x57f7a6(0xa5)+_0x1b749f[_0x57f7a6(0xb4)]+_0x57f7a6(0x92)+(_0x1b749f[_0x57f7a6(0xb4)]!==0x1?_0x57f7a6(0xc4):'y'));if(isStructuredFormat(_0x337077))return await handleSDKOutput(_0x1b749f,_0x337077),0x0;if(_0x1b749f['length']===0x0)console[_0x57f7a6(0xcb)](a32_0x1d61d4[_0x57f7a6(0xb3)](_0x57f7a6(0xb2)));else for(const _0x4b8487 of _0x1b749f){const _0x29318d=_0x4b8487[_0x57f7a6(0xa2)]?a32_0x1d61d4[_0x57f7a6(0xb3)](_0x57f7a6(0xc6)+_0x4b8487[_0x57f7a6(0xa2)]):'';console[_0x57f7a6(0xcb)]('\x20\x20•\x20'+_0x4b8487['name']+_0x29318d);}return 0x0;}}export class PolicyShowCommand extends BaseCommand{[a32_0x3b5a2f(0xad)]=a32_0x3b5a2f(0xbb);['description']=a32_0x3b5a2f(0x9b);[a32_0x3b5a2f(0xcc)](_0x5e5e05){const _0x52f516=a32_0x3b5a2f;if(_0x5e5e05['args'][_0x52f516(0xb4)]===0x0)return _0x52f516(0x93);return undefined;}async[a32_0x3b5a2f(0xae)](_0x5144e5){const _0x36843e=a32_0x3b5a2f,{options:_0x2bfcd8,tdx:_0x272182}=_0x5144e5,_0x2b545f=_0x5144e5['args'][0x0],_0x2fe17d=await withSpinner(_0x36843e(0xc7),async()=>{const _0x2ce88=_0x36843e,_0x44f2d6=await _0x272182[_0x2ce88(0x90)][_0x2ce88(0xaa)](_0x2b545f),[_0x4cf84a,_0x3e0626]=await Promise[_0x2ce88(0xc3)]([_0x272182[_0x2ce88(0x90)][_0x2ce88(0x9a)](_0x44f2d6['id']),_0x272182[_0x2ce88(0x90)][_0x2ce88(0xbf)](_0x44f2d6['id'])]);return{'policy':_0x44f2d6,'perms':_0x4cf84a,'users':_0x3e0626};},{'verbose':_0x2bfcd8[_0x36843e(0x9f)]}),{policy:_0x317421,perms:_0x2f42a5,users:_0x3eaed7}=_0x2fe17d[_0x36843e(0xb7)];if(isStructuredFormat(_0x2bfcd8))return await handleSingleObjectOutput({..._0x317421,'permissions':_0x2f42a5[_0x36843e(0xca)],'users':_0x3eaed7},_0x2bfcd8),0x0;console[_0x36843e(0xcb)]('\x0a'+a32_0x1d61d4[_0x36843e(0x98)]('📋')+'\x20'+a32_0x1d61d4['bold'](_0x317421[_0x36843e(0xad)])+'\x20'+a32_0x1d61d4[_0x36843e(0xb3)](_0x36843e(0xa6)+_0x317421['id']+')'));_0x317421[_0x36843e(0xa2)]&&console[_0x36843e(0xcb)](_0x36843e(0x9d)+a32_0x1d61d4[_0x36843e(0xb3)](_0x317421[_0x36843e(0xa2)]));console[_0x36843e(0xcb)](_0x36843e(0x9d)+_0x3eaed7['length']+'\x20user'+(_0x3eaed7['length']!==0x1?'s':'')+_0x36843e(0xa3)),printPermissionsMap(_0x2f42a5[_0x36843e(0xca)]);if(_0x3eaed7['length']>0x0){console[_0x36843e(0xcb)]('\x0a'+a32_0x1d61d4[_0x36843e(0x98)](_0x36843e(0xbe))+':');for(const _0x1dc838 of _0x3eaed7){const _0x54f9af=_0x1dc838[_0x36843e(0xb1)]&&_0x1dc838['email']!==_0x1dc838[_0x36843e(0xad)]?a32_0x1d61d4[_0x36843e(0xb3)]('\x20<'+_0x1dc838[_0x36843e(0xb1)]+'>'):'';console[_0x36843e(0xcb)]('\x20\x20•\x20'+_0x1dc838[_0x36843e(0xad)]+_0x54f9af);}}return console[_0x36843e(0xcb)](),0x0;}}function printPermissionsMap(_0xf41ae8){const _0x2d0a25=a32_0x3b5a2f,_0x3be9da=Object[_0x2d0a25(0xc5)](_0xf41ae8);console[_0x2d0a25(0xcb)]('\x0a'+a32_0x1d61d4[_0x2d0a25(0x98)]('🔑\x20Effective\x20Permissions')+':');if(_0x3be9da['length']===0x0){console['log'](a32_0x1d61d4[_0x2d0a25(0xb3)]('\x20\x20No\x20permissions'));return;}const _0x339888=Math[_0x2d0a25(0xc9)](..._0x3be9da['map'](([_0x54da67])=>_0x54da67[_0x2d0a25(0xb4)]));for(const [_0x3fec59,_0x291e6c]of _0x3be9da){const _0x89636=formatOperations(_0x291e6c);console['log']('\x20\x20'+_0x3fec59[_0x2d0a25(0xa9)](_0x339888+0x2)+_0x89636);}}function formatOperations(_0x50f3da){const _0x41cd53=a32_0x3b5a2f,_0x5a802c=[...new Set(_0x50f3da['map'](_0x38cdef=>_0x38cdef[_0x41cd53(0xba)]))];return _0x5a802c[_0x41cd53(0xb9)](',\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_0x225003=a33_0x4d10;(function(_0x7d77a1,_0x405add){const _0x15b094=a33_0x4d10,_0x6922be=_0x7d77a1();while(!![]){try{const _0x2c5aa5=parseInt(_0x15b094(0xca))/0x1+parseInt(_0x15b094(0xc8))/0x2+parseInt(_0x15b094(0x101))/0x3+parseInt(_0x15b094(0x10f))/0x4*(-parseInt(_0x15b094(0xc0))/0x5)+-parseInt(_0x15b094(0xbb))/0x6*(parseInt(_0x15b094(0x116))/0x7)+-parseInt(_0x15b094(0x104))/0x8*(-parseInt(_0x15b094(0xb4))/0x9)+-parseInt(_0x15b094(0xf8))/0xa;if(_0x2c5aa5===_0x405add)break;else _0x6922be['push'](_0x6922be['shift']());}catch(_0x500f34){_0x6922be['push'](_0x6922be['shift']());}}}(a33_0x1c8c,0x442ee));import{BaseCommand,printAuthError}from'./command.js';function a33_0x4d10(_0x317598,_0x2e3001){_0x317598=_0x317598-0xad;const _0x1c8c09=a33_0x1c8c();let _0x4d10d3=_0x1c8c09[_0x317598];return _0x4d10d3;}import{listProfiles,profileExists,saveProfileToUserConfig,removeProfileFromUserConfig,loadProfile,getActiveProfile,saveActiveProfileToUserConfig}from'../core/profile.js';import{getConfigDir}from'../core/config.js';function a33_0x1c8c(){const _0x2d70ef=['test','email','profile','\x0aSetting\x20up\x20authentication\x20for\x20site:\x20','1575968gPpruh','confirm','Enter\x20your\x20TD\x20API\x20key\x20for\x20the\x20new\x20site:','Invalid\x20format.\x20Use:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','\x27\x20does\x20not\x20exist.\x20Create\x20it?','name','profile:set','70UKtceP','default','log','execute','skipExistsCheck','tdx:\x20profile\x20delete','\x27\x20deleted','password','Enter\x20your\x20TD\x20API\x20key:','940446XrJZNu','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','API\x20key\x20cannot\x20be\x20empty','\x27\x20to\x20remove\x20it\x20first,\x20or\x20re-create\x20with\x20--force.','getUserInfo','jobs','llm_agent','51834EKQqgS','Enter\x20profile\x20name:','Delete\x20a\x20profile','message','\x20API\x20key\x20saved\x20to\x20system\x20keychain\x20(profile:\x20','5SdkGZW','profile:use','\x27\x20created','\x20--default\x27\x20to\x20save\x20permanently','error','Profile\x20name\x20cannot\x20be\x20empty','apiKey','profile:create','831578ebqjja','\x20API\x20key\x20is\x20valid\x20(User:\x20','73203DjFALM','bold','\x0aSetup\x20cancelled','green','force','(cleared)','\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication','\x20\x20tdx\x20--profile\x20','\x0aSaved\x20to:\x20','us01','You\x20can\x20now\x20use\x20tdx\x20commands\x20with\x20this\x20profile.\x20Try:','/app/mp/ak','\x27.\x0a\x0aValid\x20keys:\x20','length','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20delete\x20<name>','split','\x20\x20(no\x20profiles\x20found)','join','\x0aYou\x20can\x20find\x20your\x20API\x20key\x20at:','database','text','\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.','logLevel','Default\x20profile\x20set\x20to:\x20','\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases','Profile\x20name\x20must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore','\x0aOperation\x20cancelled','llm_project','tdx.json','tdx:\x20profile\x20set','\x27\x20does\x20not\x20exist.','site','Create\x20a\x20new\x20profile','create','yellow','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>','red','\x20API\x20key\x20saved\x20to\x20system\x20keychain','Validating\x20API\x20key...','Site\x20was\x20not\x20changed.','Removed\x20existing\x20profile\x20\x27','✗\x20Validation\x20failed:\x20','Profile\x20was\x20not\x20created.\x20Please\x20try\x20again.','Failed\x20to\x20delete\x20profile:\x20','\x0aAvailable\x20profiles:','\x27\x20updated:\x20','2056150dJalab','\x20Profile\x20\x27','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20use\x20<name>\x20[--default]','all','profileName','trim','description','\x27\x20already\x20exists.\x20Use\x20\x27tdx\x20profile\x20delete\x20','Profile\x20\x27','801885qwlxJr','\x20\x20-\x20','dim','16rhvRsB','VALID_KEYS','Enter\x20description\x20(optional):','warn','validate','ERROR','parent_segment'];a33_0x1c8c=function(){return _0x2d70ef;};return a33_0x1c8c();}import*as a33_0x3026be from'node:path';import{saveSessionContext,getSessionID,cleanExpiredSessions}from'../core/session.js';import{saveAPIKeyAsync,resolveSite}from'../core/config.js';import{getConsoleUrl}from'../sdk/client/endpoints.js';import{deleteKeychainAPIKey,isKeychainAvailable}from'../core/keychain.js';import{deleteOAuthTokens}from'../core/oauth-keychain.js';import{runOAuthLoginFlow,promptAuthMethod}from'./auth-command.js';import{promptSiteSelection}from'../core/constants.js';import{HTTPClientError}from'../sdk/client/http-client.js';import{TDX}from'../sdk/index.js';import{LogLevel}from'../utils/tdx-logger.js';import a33_0x23795a from'prompts';import a33_0x4be11f from'chalk';function validateProfileName(_0x4d51cb,_0x4a9572){const _0x19fab1=a33_0x4d10;if(!_0x4d51cb||!_0x4d51cb[_0x19fab1(0xfd)]())return _0x19fab1(0xc5);const _0x6f4336=_0x4d51cb['trim']();if(!/^[a-zA-Z0-9_-]+$/[_0x19fab1(0x10b)](_0x6f4336))return _0x19fab1(0xe3);if(!_0x4a9572?.[_0x19fab1(0xaf)]&&profileExists(_0x6f4336))return _0x19fab1(0x100)+_0x6f4336+_0x19fab1(0xff)+_0x6f4336+_0x19fab1(0xb7);return!![];}async function deleteProfileAndCredentials(_0x91569a){const _0x10f5bc=a33_0x4d10;removeProfileFromUserConfig(_0x91569a);const _0x1c15a5=await isKeychainAvailable();_0x1c15a5&&await Promise[_0x10f5bc(0xfb)]([deleteKeychainAPIKey(_0x91569a),deleteOAuthTokens(_0x91569a)]);}export class ProfileCreateCommand extends BaseCommand{[a33_0x225003(0x114)]=a33_0x225003(0xc7);['description']=a33_0x225003(0xea);async['execute'](_0x8fa38a){const _0x29d847=a33_0x225003,{options:_0x2d3905,args:_0x5ef3fd}=_0x8fa38a,_0xd234d8=!!_0x2d3905[_0x29d847(0xce)];console['log'](a33_0x4be11f[_0x29d847(0xcb)]('tdx:\x20profile\x20create'));let _0x2a0d48;if(_0x5ef3fd[_0x29d847(0xd7)]>0x0&&_0x5ef3fd[0x0]){const _0x536631=_0x5ef3fd[0x0][_0x29d847(0xfd)]();_0xd234d8&&profileExists(_0x536631)&&(await deleteProfileAndCredentials(_0x536631),console[_0x29d847(0xad)](_0x29d847(0xf2)+_0x536631+'\x27'));const _0x2a220c=validateProfileName(_0x536631);if(_0x2a220c!==!![])return console['error'](a33_0x4be11f[_0x29d847(0xee)](_0x2a220c)),0x1;_0x2a0d48=_0x536631;}else{const _0x28b473=await a33_0x23795a({'type':_0x29d847(0xde),'name':_0x29d847(0xfc),'message':_0x29d847(0xbc),'validate':_0x52ea87=>validateProfileName(_0x52ea87,{'skipExistsCheck':_0xd234d8})});if(!_0x28b473[_0x29d847(0xfc)])return console[_0x29d847(0xad)](_0x29d847(0xcc)),0x1;_0x2a0d48=_0x28b473[_0x29d847(0xfc)][_0x29d847(0xfd)](),_0xd234d8&&profileExists(_0x2a0d48)&&(await deleteProfileAndCredentials(_0x2a0d48),console['log']('Removed\x20existing\x20profile\x20\x27'+_0x2a0d48+'\x27'));}const _0x1cfcc3=await a33_0x23795a({'type':_0x29d847(0xde),'name':_0x29d847(0xfe),'message':_0x29d847(0x106)}),_0x65ae08=_0x1cfcc3[_0x29d847(0xfe)]?.[_0x29d847(0xfd)]()||undefined,_0x4c4727=_0x2d3905[_0x29d847(0xe9)]||_0x29d847(0xd3),_0x208dca=await promptSiteSelection(_0x4c4727,_0x2a0d48,'Setup\x20cancelled');if(!_0x208dca)return 0x1;const _0x2166b0=resolveSite(_0x208dca),_0x13629a=await promptAuthMethod();if(!_0x13629a)return console[_0x29d847(0xad)](_0x29d847(0xcc)),0x1;if(_0x13629a==='oauth'){if(_0x65ae08){const _0x1b4c42={'site':_0x2166b0,'description':_0x65ae08};saveProfileToUserConfig(_0x2a0d48,_0x1b4c42);}const {accountName:_0x7c065b}=_0x2d3905;return await runOAuthLoginFlow(_0x2166b0,_0x2a0d48,_0x2d3905[_0x29d847(0xe0)]??LogLevel[_0x29d847(0x109)],{'accountName':_0x7c065b}),0x0;}console[_0x29d847(0xad)](_0x29d847(0x10e)+_0x2166b0),console[_0x29d847(0xad)]('You\x20can\x20find\x20your\x20API\x20key\x20at:'),console[_0x29d847(0xad)]('\x20\x20'+getConsoleUrl(_0x2166b0,_0x29d847(0xd5)));const _0x431d4b=await a33_0x23795a({'type':_0x29d847(0xb2),'name':_0x29d847(0xc6),'message':_0x29d847(0xb3),'validate':_0x5ad13c=>{const _0x2ec735=_0x29d847;if(!_0x5ad13c||!_0x5ad13c['trim']())return _0x2ec735(0xb6);return!![];}});if(!_0x431d4b[_0x29d847(0xc6)])return console[_0x29d847(0xad)](_0x29d847(0xcc)),0x1;const _0x2a8aa5=_0x431d4b['apiKey'];console['log'](_0x29d847(0xf0));try{const _0x13a0d4=TDX[_0x29d847(0xeb)]({'site':_0x2166b0,'apiKey':_0x2a8aa5[_0x29d847(0xfd)](),'logLevel':_0x2d3905[_0x29d847(0xe0)]??LogLevel[_0x29d847(0x109)]}),_0xff6f50=await _0x13a0d4[_0x29d847(0xb9)][_0x29d847(0xb8)]();console['log'](a33_0x4be11f[_0x29d847(0xcd)]('✓')+_0x29d847(0xc9)+_0xff6f50[_0x29d847(0x10c)]+')');const _0x10dad3=await isKeychainAvailable();_0x10dad3?(await saveAPIKeyAsync(_0x2a8aa5[_0x29d847(0xfd)](),_0x2166b0,_0x2a0d48),console[_0x29d847(0xad)](a33_0x4be11f[_0x29d847(0xcd)]('✓')+_0x29d847(0xbf)+_0x2a0d48+')')):(console[_0x29d847(0x107)](a33_0x4be11f[_0x29d847(0xec)](_0x29d847(0xb5))),console[_0x29d847(0x107)](a33_0x4be11f[_0x29d847(0xec)](_0x29d847(0xdf))));const _0x5d2524={'site':_0x2166b0,..._0x65ae08&&{'description':_0x65ae08}};return saveProfileToUserConfig(_0x2a0d48,_0x5d2524),console['log'](a33_0x4be11f['green']('✓')+_0x29d847(0xf9)+_0x2a0d48+_0x29d847(0xc2)),console[_0x29d847(0xad)](),console['log'](_0x29d847(0xd4)),console[_0x29d847(0xad)](_0x29d847(0xd1)+_0x2a0d48+_0x29d847(0xd0)),console[_0x29d847(0xad)](_0x29d847(0xd1)+_0x2a0d48+_0x29d847(0xe2)),0x0;}catch(_0x505ffc){if(_0x505ffc instanceof HTTPClientError&&_0x505ffc['status']===0x191)return printAuthError(_0x505ffc),0x1;return console['error'](a33_0x4be11f[_0x29d847(0xee)](_0x29d847(0xf3)+(_0x505ffc instanceof Error?_0x505ffc[_0x29d847(0xbe)]:String(_0x505ffc)))),console[_0x29d847(0xc4)](_0x29d847(0xf4)),0x1;}}}export class ProfileDeleteCommand extends BaseCommand{[a33_0x225003(0x114)]='profile:delete';['description']=a33_0x225003(0xbd);[a33_0x225003(0x108)](_0x40a45a){const _0x7031a0=a33_0x225003,{args:_0xbfed05}=_0x40a45a;if(_0xbfed05['length']===0x0)return _0x7031a0(0xd8);return undefined;}async[a33_0x225003(0xae)](_0x54614a){const _0x22235c=a33_0x225003,{args:_0x2b8bb3}=_0x54614a,_0x7ad03b=_0x2b8bb3[0x0];console[_0x22235c(0xad)](a33_0x4be11f[_0x22235c(0xcb)](_0x22235c(0xb0)));if(!profileExists(_0x7ad03b)){console[_0x22235c(0xc4)](a33_0x4be11f[_0x22235c(0xee)]('Profile\x20\x27'+_0x7ad03b+_0x22235c(0xe8))),console[_0x22235c(0xad)](_0x22235c(0xf6));const _0x1d752f=listProfiles();if(_0x1d752f[_0x22235c(0xd7)]===0x0)console['log'](_0x22235c(0xda));else for(const _0x120c90 of _0x1d752f){console['log'](_0x22235c(0x102)+_0x120c90['name']);}return 0x1;}const _0x239abd=await a33_0x23795a({'type':_0x22235c(0x110),'name':'confirm','message':'Are\x20you\x20sure\x20you\x20want\x20to\x20remove\x20profile\x20\x27'+_0x7ad03b+'\x27?','initial':![]});if(!_0x239abd[_0x22235c(0x110)])return console[_0x22235c(0xad)]('Removal\x20cancelled'),0x0;try{await deleteProfileAndCredentials(_0x7ad03b),console[_0x22235c(0xad)](a33_0x4be11f[_0x22235c(0xcd)]('✓')+_0x22235c(0xf9)+_0x7ad03b+_0x22235c(0xb1));}catch(_0x576acf){return console[_0x22235c(0xc4)](a33_0x4be11f[_0x22235c(0xee)](_0x22235c(0xf5)+(_0x576acf instanceof Error?_0x576acf['message']:String(_0x576acf)))),0x1;}return 0x0;}}export class ProfileSetCommand extends BaseCommand{[a33_0x225003(0x114)]=a33_0x225003(0x115);[a33_0x225003(0xfe)]='Set\x20a\x20profile\x20configuration\x20value';static [a33_0x225003(0x105)]=[a33_0x225003(0xe9),a33_0x225003(0xdd),a33_0x225003(0x10a),a33_0x225003(0xe5),a33_0x225003(0xba),a33_0x225003(0xfe)];[a33_0x225003(0x108)](_0x52452b){const _0x3c0ed6=a33_0x225003,{args:_0x478f05,options:_0x238da5}=_0x52452b,_0xa8190f=_0x238da5[_0x3c0ed6(0x10d)]||getActiveProfile();if(!_0xa8190f)return _0x3c0ed6(0xed);if(_0x478f05[_0x3c0ed6(0xd7)]===0x0)return'Key=value\x20pair\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20'+ProfileSetCommand['VALID_KEYS'][_0x3c0ed6(0xdb)](',\x20');const _0x17825d=_0x478f05[0x0];if(!_0x17825d['includes']('='))return _0x3c0ed6(0x112)+ProfileSetCommand[_0x3c0ed6(0x105)][_0x3c0ed6(0xdb)](',\x20');const [_0x4b8e09]=_0x17825d[_0x3c0ed6(0xd9)]('=',0x2);if(!ProfileSetCommand['VALID_KEYS']['includes'](_0x4b8e09))return'Unknown\x20key\x20\x27'+_0x4b8e09+_0x3c0ed6(0xd6)+ProfileSetCommand[_0x3c0ed6(0x105)][_0x3c0ed6(0xdb)](',\x20');return undefined;}async[a33_0x225003(0xae)](_0x142533){const _0x3b1348=a33_0x225003,{args:_0x1cafb5,options:_0x37934e}=_0x142533,_0x2a49f0=_0x37934e['profile']||getActiveProfile(),[_0x290023,..._0x500369]=_0x1cafb5[0x0][_0x3b1348(0xd9)]('='),_0x5ad6ce=_0x500369[_0x3b1348(0xdb)]('=');console['log'](a33_0x4be11f[_0x3b1348(0xcb)](_0x3b1348(0xe7)));if(!profileExists(_0x2a49f0)){const _0x36e20e=await a33_0x23795a({'type':_0x3b1348(0x110),'name':_0x3b1348(0xeb),'message':_0x3b1348(0x100)+_0x2a49f0+_0x3b1348(0x113),'initial':!![]});if(!_0x36e20e[_0x3b1348(0xeb)])return console[_0x3b1348(0xad)]('Operation\x20cancelled'),0x1;}const _0x34978e=loadProfile(_0x2a49f0),_0x1f2653=_0x34978e?.['config']||{};if(_0x290023===_0x3b1348(0xe9)){const _0x4cd0d5=resolveSite(_0x5ad6ce);console[_0x3b1348(0xad)]('Changing\x20site\x20to\x20\x27'+_0x4cd0d5+'\x27\x20requires\x20API\x20key\x20validation.'),console['log'](_0x3b1348(0xdc)),console[_0x3b1348(0xad)]('\x20\x20'+getConsoleUrl(_0x4cd0d5,_0x3b1348(0xd5)));const _0x3c8a1d=await a33_0x23795a({'type':_0x3b1348(0xb2),'name':_0x3b1348(0xc6),'message':_0x3b1348(0x111),'validate':_0x152956=>{const _0x29e24f=_0x3b1348;if(!_0x152956||!_0x152956[_0x29e24f(0xfd)]())return'API\x20key\x20cannot\x20be\x20empty';return!![];}});if(!_0x3c8a1d['apiKey'])return console[_0x3b1348(0xad)](_0x3b1348(0xe4)),0x1;console[_0x3b1348(0xad)](_0x3b1348(0xf0));try{const _0x21f7f8=TDX['create']({'site':_0x4cd0d5,'apiKey':_0x3c8a1d[_0x3b1348(0xc6)]['trim'](),'logLevel':_0x37934e[_0x3b1348(0xe0)]??LogLevel[_0x3b1348(0x109)]}),_0x40e048=await _0x21f7f8['jobs'][_0x3b1348(0xb8)]();console['log'](a33_0x4be11f['green']('✓')+'\x20API\x20key\x20is\x20valid\x20(User:\x20'+_0x40e048[_0x3b1348(0x10c)]+')');const _0x30ff2b=await isKeychainAvailable();_0x30ff2b?(await saveAPIKeyAsync(_0x3c8a1d[_0x3b1348(0xc6)]['trim'](),_0x4cd0d5,_0x2a49f0),console[_0x3b1348(0xad)](a33_0x4be11f[_0x3b1348(0xcd)]('✓')+_0x3b1348(0xef))):console[_0x3b1348(0x107)](a33_0x4be11f['yellow']('⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.')),_0x1f2653['site']=_0x4cd0d5;}catch(_0xc7b5db){if(_0xc7b5db instanceof HTTPClientError&&_0xc7b5db['status']===0x191)return printAuthError(_0xc7b5db),0x1;return console[_0x3b1348(0xc4)](a33_0x4be11f['red'](_0x3b1348(0xf3)+(_0xc7b5db instanceof Error?_0xc7b5db[_0x3b1348(0xbe)]:String(_0xc7b5db)))),console[_0x3b1348(0xc4)](_0x3b1348(0xf1)),0x1;}}else _0x1f2653[_0x290023]=_0x5ad6ce||undefined;return saveProfileToUserConfig(_0x2a49f0,_0x1f2653),console['log'](a33_0x4be11f[_0x3b1348(0xcd)]('✓')+_0x3b1348(0xf9)+_0x2a49f0+_0x3b1348(0xf7)+_0x290023+'='+(_0x5ad6ce||_0x3b1348(0xcf))),0x0;}}export class ProfileUseCommand extends BaseCommand{['name']=a33_0x225003(0xc1);[a33_0x225003(0xfe)]='Set\x20session\x20profile';[a33_0x225003(0x108)](_0x2f119a){const _0x387958=a33_0x225003,{args:_0xb1c9a1}=_0x2f119a;if(_0xb1c9a1[_0x387958(0xd7)]===0x0)return _0x387958(0xfa);return undefined;}async[a33_0x225003(0xae)](_0x9c21ad){const _0x2beb0a=a33_0x225003,{args:_0x5362d9,options:_0x4b4301}=_0x9c21ad,_0x588648=_0x5362d9[0x0],_0x359d05=_0x4b4301[_0x2beb0a(0x117)];cleanExpiredSessions();if(!profileExists(_0x588648)){console[_0x2beb0a(0xc4)](a33_0x4be11f[_0x2beb0a(0xee)]('Profile\x20\x27'+_0x588648+_0x2beb0a(0xe8))),console[_0x2beb0a(0xad)]('\x0aAvailable\x20profiles:');const _0x22145=listProfiles();if(_0x22145[_0x2beb0a(0xd7)]===0x0)console[_0x2beb0a(0xad)](_0x2beb0a(0xda));else for(const _0x2091fb of _0x22145){console[_0x2beb0a(0xad)](_0x2beb0a(0x102)+_0x2091fb[_0x2beb0a(0x114)]);}return 0x1;}if(_0x359d05){const _0x11961c=a33_0x3026be[_0x2beb0a(0xdb)](getConfigDir(),_0x2beb0a(0xe6));return saveActiveProfileToUserConfig(_0x588648),console[_0x2beb0a(0xad)](_0x2beb0a(0xe1)+a33_0x4be11f[_0x2beb0a(0xcd)](_0x588648)),console[_0x2beb0a(0xad)](a33_0x4be11f[_0x2beb0a(0x103)](_0x2beb0a(0xd2)+_0x11961c)),0x0;}const _0x3e7154=getSessionID(_0x4b4301['session']);return saveSessionContext({'profile':_0x588648},_0x4b4301['session']),console[_0x2beb0a(0xad)]('Session\x20profile\x20set\x20to:\x20'+a33_0x4be11f['green'](_0x588648)+'\x20'+a33_0x4be11f[_0x2beb0a(0x103)]('(session:\x20'+_0x3e7154+')')),console[_0x2beb0a(0xad)](a33_0x4be11f[_0x2beb0a(0x103)]('\x0aTip:\x20Use\x20\x27tdx\x20profile\x20use\x20'+_0x588648+_0x2beb0a(0xc3))),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_0x500d6d=a34_0x5285;(function(_0x1b2c46,_0x44a342){const _0xbcd2a1=a34_0x5285,_0x502be5=_0x1b2c46();while(!![]){try{const _0xb0f09d=-parseInt(_0xbcd2a1(0x168))/0x1+-parseInt(_0xbcd2a1(0x165))/0x2+parseInt(_0xbcd2a1(0x15f))/0x3+parseInt(_0xbcd2a1(0x167))/0x4*(-parseInt(_0xbcd2a1(0x166))/0x5)+-parseInt(_0xbcd2a1(0x172))/0x6+parseInt(_0xbcd2a1(0x160))/0x7*(parseInt(_0xbcd2a1(0x15b))/0x8)+parseInt(_0xbcd2a1(0x163))/0x9*(parseInt(_0xbcd2a1(0x164))/0xa);if(_0xb0f09d===_0x44a342)break;else _0x502be5['push'](_0x502be5['shift']());}catch(_0x1e7648){_0x502be5['push'](_0x502be5['shift']());}}}(a34_0x3a34,0xacbae));function a34_0x5285(_0x348d04,_0x3cd3c2){_0x348d04=_0x348d04-0x159;const _0x3a3495=a34_0x3a34();let _0x528595=_0x3a3495[_0x348d04];return _0x528595;}import{BaseCommand}from'./command.js';import{listProfiles,getActiveProfile,getProfileParams}from'../core/profile.js';import{handleSDKOutput,isStructuredFormat}from'../core/command-output.js';import a34_0x15d1f1 from'chalk';function a34_0x3a34(){const _0x19ea23=['4828pURlDw','408640klNuyN','scope','profiles','No\x20profiles\x20found.\x20Define\x20profiles\x20in\x20tdx.json:\x0a','length','map','Error:\x20','List\x20all\x20available\x20profiles','site','log','69780OYrVYY','execute','green','1000zjBJaO','name','\x20\x20Local:\x20\x20(project\x20folder)/tdx.json','config','3124140ZAPrPG','17521hqSnUb','message','description','237033ZGaeYC','630aqRsLx','2306130jxGLAD','3035bhuerF'];a34_0x3a34=function(){return _0x19ea23;};return a34_0x3a34();}export class ProfilesCommand extends BaseCommand{[a34_0x500d6d(0x15c)]=a34_0x500d6d(0x16a);[a34_0x500d6d(0x162)]=a34_0x500d6d(0x16f);async[a34_0x500d6d(0x159)](_0x4fd480){const _0xd763f6=a34_0x500d6d,{options:_0x4a9f41}=_0x4fd480;try{const _0x4dd45c=listProfiles(),_0x4ab418=getActiveProfile();if(_0x4dd45c[_0xd763f6(0x16c)]===0x0)return console['log'](_0xd763f6(0x16b)),console[_0xd763f6(0x171)](_0xd763f6(0x15d)),console[_0xd763f6(0x171)]('\x20\x20Global:\x20~/.config/tdx/tdx.json'),0x0;const _0x2633ba=_0x4dd45c[_0xd763f6(0x16d)](_0x1f48d8=>{const _0xcfe61b=_0xd763f6,_0x3b48ee=_0x1f48d8[_0xcfe61b(0x15c)]===_0x4ab418,_0x38b3c7=getProfileParams(_0x1f48d8['config']);return{'name':_0x1f48d8[_0xcfe61b(0x15c)],'active':_0x3b48ee,'scope':_0x1f48d8[_0xcfe61b(0x169)],'description':_0x1f48d8[_0xcfe61b(0x15e)]['description']||'','params':_0x38b3c7};});if(isStructuredFormat(_0x4a9f41))await handleSDKOutput(_0x2633ba,_0x4a9f41);else for(const _0x1a57f3 of _0x4dd45c){const _0x4ecb89=_0x1a57f3['name']===_0x4ab418?a34_0x15d1f1[_0xd763f6(0x15a)]('\x20✓'):'',_0x50205e=_0x1a57f3[_0xd763f6(0x15e)][_0xd763f6(0x170)]?a34_0x15d1f1['dim']('\x20'+_0x1a57f3[_0xd763f6(0x15e)][_0xd763f6(0x170)]):'',_0x1cbb74=_0x1a57f3[_0xd763f6(0x15e)][_0xd763f6(0x162)]?a34_0x15d1f1['dim']('\x20\x20'+_0x1a57f3[_0xd763f6(0x15e)][_0xd763f6(0x162)]):'';console[_0xd763f6(0x171)]('👤\x20'+_0x1a57f3[_0xd763f6(0x15c)]+_0x4ecb89+_0x50205e+_0x1cbb74);}return 0x0;}catch(_0x163ca2){return _0x163ca2 instanceof Error&&console['error'](_0xd763f6(0x16e)+_0x163ca2[_0xd763f6(0x161)]),0x1;}}}
@@ -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
+ function a35_0x13fc(_0x393388,_0x5be589){_0x393388=_0x393388-0x1c8;const _0x2e37cf=a35_0x2e37();let _0x13fce2=_0x2e37cf[_0x393388];return _0x13fce2;}const a35_0x1ff66e=a35_0x13fc;(function(_0x56bf60,_0x5234e7){const _0x238e02=a35_0x13fc,_0xb1545e=_0x56bf60();while(!![]){try{const _0x5c12dc=-parseInt(_0x238e02(0x1d0))/0x1+-parseInt(_0x238e02(0x1cf))/0x2*(parseInt(_0x238e02(0x1f4))/0x3)+parseInt(_0x238e02(0x1e0))/0x4*(-parseInt(_0x238e02(0x1ed))/0x5)+-parseInt(_0x238e02(0x1db))/0x6*(-parseInt(_0x238e02(0x1e8))/0x7)+-parseInt(_0x238e02(0x1da))/0x8*(-parseInt(_0x238e02(0x1e9))/0x9)+-parseInt(_0x238e02(0x1d8))/0xa*(-parseInt(_0x238e02(0x1ce))/0xb)+parseInt(_0x238e02(0x1f1))/0xc;if(_0x5c12dc===_0x5234e7)break;else _0xb1545e['push'](_0xb1545e['shift']());}catch(_0x3a6997){_0xb1545e['push'](_0xb1545e['shift']());}}}(a35_0x2e37,0x9abac));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';function a35_0x2e37(){const _0x17c446=['1698991YEjGzV','1168749yntUFK','\x20[Job\x20ID:\x20','jobId','totalSplits','218910WRwRRB','Run\x20Trino\x20queries\x20(streaming)','description','Statement\x20','7565160tZyQZu','setJobId','stats','12687KueCGg','join','verbose','state','elapsedTimeMillis','Executing\x20statement\x20','setPhase','file','completedSplits','length','648461hRpIFN','314YABDRQ','399eUzWjC','error','setExtra','query','\x20rows\x20','name','Error:\x20','site','150SnqLQp','...','8oOjflq','12yfvWOE','originalMessage','Cannot\x20specify\x20both\x20SQL\x20argument\x20and\x20--file\x20option','database','\x20-\x20','76pjxSwx','output','options','Executing\x20query...','processedRows','message','execute','Executing\x20query\x20['];a35_0x2e37=function(){return _0x17c446;};return a35_0x2e37();}import{handleQueryOutput,formatQueryOutput,resolveOutputOptions}from'../core/command-output.js';import{readSqlStatementsFromFile,readSqlStatementsFromStdin,splitSqlStatements,isSqlFilePath}from'../sdk/query/sql-parser.js';import{writeFileSync}from'fs';import{withProgressSpinner,formatElapsed}from'../utils/spinner.js';import{formatRows}from'../sdk/util/formatters.js';export class QueryCommand extends BaseCommand{[a35_0x1ff66e(0x1d5)]='query';[a35_0x1ff66e(0x1ef)]=a35_0x1ff66e(0x1ee);async[a35_0x1ff66e(0x1e6)](_0x5df6ad){const _0x1df2fd=a35_0x1ff66e,{options:_0x31f01c,args:_0x2e9983,tdx:_0x273715}=_0x5df6ad,_0x749f93={..._0x31f01c,'limitStructuredFormats':!![]},_0x2c4ac2=_0x2e9983[0x0],_0x2a6efc=_0x31f01c[_0x1df2fd(0x1cb)];let _0x5dc3fc;try{if(_0x2a6efc)_0x5dc3fc=readSqlStatementsFromFile(_0x2a6efc);else{if(_0x2c4ac2==='-')_0x5dc3fc=await readSqlStatementsFromStdin();else{if(_0x2c4ac2&&isSqlFilePath(_0x2c4ac2))_0x5dc3fc=readSqlStatementsFromFile(_0x2c4ac2);else{if(_0x2c4ac2)_0x5dc3fc=splitSqlStatements(_0x2c4ac2);else throw new Error('No\x20SQL\x20provided');}}}}catch(_0x13e3e2){return console[_0x1df2fd(0x1d1)](_0x1df2fd(0x1d6)+_0x13e3e2[_0x1df2fd(0x1e5)]),0x1;}const _0x2a31f1=_0x31f01c[_0x1df2fd(0x1de)]||'information_schema',_0x5d7907=_0x31f01c['catalog'];try{const _0x515773=[],_0x130211=!!_0x31f01c['output'];for(let _0x6d6fe8=0x0;_0x6d6fe8<_0x5dc3fc[_0x1df2fd(0x1cd)];_0x6d6fe8++){const _0x5b4f0a=_0x5dc3fc[_0x6d6fe8],_0x1ad3e9=_0x6d6fe8+0x1,_0x4cecc3=_0x5dc3fc['length'],_0x296638=_0x4cecc3>0x1;_0x31f01c['verbose']&&(console[_0x1df2fd(0x1d1)]('\x0a'+(_0x296638?'Statement\x20'+_0x1ad3e9+'/'+_0x4cecc3+':':'')),console[_0x1df2fd(0x1d1)]('Site:\x20'+_0x31f01c[_0x1df2fd(0x1d7)]),console[_0x1df2fd(0x1d1)]('Catalog:\x20'+(_0x5d7907||'td')),console[_0x1df2fd(0x1d1)]('Schema:\x20'+_0x2a31f1),console['error']('SQL:\x20'+_0x5b4f0a));const _0x1e592a=_0x296638?_0x1df2fd(0x1c9)+_0x1ad3e9+'/'+_0x4cecc3+_0x1df2fd(0x1d9):_0x1df2fd(0x1e3);try{const _0x4edceb=await withProgressSpinner(_0x1e592a,async _0x49b839=>{const _0x11fa53=_0x1df2fd,_0x5dd02e=await _0x273715[_0x11fa53(0x1d3)][_0x11fa53(0x1e6)](_0x5b4f0a,{'catalog':_0x5d7907,'schema':_0x2a31f1,'onJobId':_0x378aca=>{const _0x217dd5=_0x11fa53;_0x49b839[_0x217dd5(0x1f2)](_0x378aca);},'onProgress':_0x236bdf=>{const _0x2cfd77=_0x11fa53;_0x49b839[_0x2cfd77(0x1ca)](_0x2cfd77(0x1e7)+_0x236bdf[_0x2cfd77(0x1f7)]+']'),_0x49b839[_0x2cfd77(0x1d2)](formatRows(_0x236bdf[_0x2cfd77(0x1e4)])+_0x2cfd77(0x1d4)+_0x236bdf[_0x2cfd77(0x1cc)]+'/'+_0x236bdf[_0x2cfd77(0x1ec)]+'\x20splits');}});return _0x5dd02e;},{'verbose':_0x31f01c[_0x1df2fd(0x1f6)]}),_0x10ff29=_0x4edceb['data'],_0x2dec17=_0x10ff29[_0x1df2fd(0x1eb)]?_0x1df2fd(0x1ea)+_0x10ff29[_0x1df2fd(0x1eb)]+']':'',_0x21ff0d=_0x296638?'Statement\x20'+_0x1ad3e9+'/'+_0x4cecc3+_0x1df2fd(0x1df):'';console[_0x1df2fd(0x1d1)]('✔\x20'+_0x21ff0d+'Query\x20completed:\x20Processed\x20'+formatRows(_0x10ff29['stats'][_0x1df2fd(0x1e4)])+_0x1df2fd(0x1d4)+('in\x20'+formatElapsed(_0x10ff29[_0x1df2fd(0x1f3)][_0x1df2fd(0x1c8)])+_0x2dec17));if(_0x296638&&_0x130211){const _0x3d4b92=resolveOutputOptions(_0x749f93),_0x99eef7=await formatQueryOutput(_0x10ff29,_0x3d4b92);_0x515773['push'](_0x99eef7);}else await handleQueryOutput(_0x10ff29,_0x749f93);}catch(_0x5174c9){const _0x3d872c=_0x296638?_0x1df2fd(0x1f0)+_0x1ad3e9+'/'+_0x4cecc3+':\x0a':'',_0x2f1684=_0x5174c9 instanceof SDKError?_0x5174c9[_0x1df2fd(0x1dc)]:_0x5174c9['message'];return console['error'](''+_0x3d872c+_0x2f1684),0x1;}}if(_0x5dc3fc[_0x1df2fd(0x1cd)]>0x1&&_0x130211&&_0x515773[_0x1df2fd(0x1cd)]>0x0){const _0x1147d0=_0x515773[_0x1df2fd(0x1f5)]('\x0a');writeFileSync(_0x31f01c['output'],_0x1147d0),console[_0x1df2fd(0x1d1)]('\x0aAll\x20results\x20saved\x20to\x20'+_0x31f01c[_0x1df2fd(0x1e1)]);}return 0x0;}catch(_0x4bf265){throw _0x4bf265;}}['validate'](_0x2dc0c6){const _0x518ee1=a35_0x1ff66e,_0x189c7=_0x2dc0c6['args'][0x0],_0x1ff3f4=_0x2dc0c6[_0x518ee1(0x1e2)]['file'];if(!_0x189c7&&!_0x1ff3f4)return'Usage:\x20tdx\x20query\x20\x22SELECT\x20*\x20FROM\x20table\x22\x0a\x20\x20\x20or:\x20tdx\x20query\x20query.sql\x0a\x20\x20\x20or:\x20echo\x20\x22SELECT\x201\x22\x20|\x20tdx\x20query\x20-\x0a\x0aRun\x20\x27tdx\x20query\x20--help\x27\x20for\x20more\x20options';if(_0x189c7&&_0x1ff3f4)return _0x518ee1(0x1dd);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_0x5507c2=a36_0x1de1;(function(_0x5d924d,_0x3572d6){const _0x3a7e41=a36_0x1de1,_0x15747a=_0x5d924d();while(!![]){try{const _0x3ee7ca=parseInt(_0x3a7e41(0x116))/0x1+-parseInt(_0x3a7e41(0xf4))/0x2*(-parseInt(_0x3a7e41(0x91))/0x3)+parseInt(_0x3a7e41(0xa0))/0x4*(parseInt(_0x3a7e41(0x95))/0x5)+parseInt(_0x3a7e41(0xe6))/0x6+-parseInt(_0x3a7e41(0xbd))/0x7+-parseInt(_0x3a7e41(0xe3))/0x8+-parseInt(_0x3a7e41(0xa6))/0x9*(parseInt(_0x3a7e41(0xc5))/0xa);if(_0x3ee7ca===_0x3572d6)break;else _0x15747a['push'](_0x15747a['shift']());}catch(_0x3c214a){_0x15747a['push'](_0x15747a['shift']());}}}(a36_0xd7e4,0x40423));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,handleSingleObjectOutput,writeOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import{confirm}from'../utils/prompt.js';function a36_0xd7e4(){const _0x4de1ec=['entries','description','num','\x20\x20Time:\x20','verbose','result','Schedule\x20created:\x20','d\x20ago','toLocaleDateString','Show\x20schedule\x20execution\x20history','lastRun','\x20schedules','site','43899KfHbiB','validate','query','3lLUUaM','\x20(use\x20--limit\x20to\x20see\x20more)','map','time_zone','232135kuAzOS','job_id','soon','INVALID_ARGUMENT','Searching\x20scheduled\x20queries\x20matching\x20\x22','file','Getting\x20schedule\x20details...','List\x20scheduled\x20queries','No\x20scheduled\x20queries\x20found','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20update\x20<name>\x20[options]','\x20\x20Num:\x20','20tuGEfm','log','padEnd','At\x20least\x20one\x20option\x20must\x20be\x20provided\x20to\x20update','max','user_name','240201NbFDUq','status','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]','Listing\x20scheduled\x20queries...','history','Deleting\x20schedule...','Creating\x20schedule...','Running\x20schedule...','getTime','round','\x20\x20Database:\x20','Schedule\x20updated:\x20','priority','format','data','Show\x20schedule\x20details','created_at','\x20execution','\x20job','error','last_job','scheduled_at','Creating\x20schedule:\x20','2009315hccGGG','\x20\x20Timezone:\x20','\x20created','tsv','name','repeat','table','in\x20','160MCAocU','length','listQueries','Cancelled','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20delete\x20<name>','delete','jobs','never','success','m\x20ago','yes','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20run\x20<name>\x20[--time\x20<iso8601>]\x20[--num\x20<1-10>]','trim','(unnamed)','timezone','Failed\x20to\x20read\x20file:\x20','schedule:delete','Create\x20a\x20scheduled\x20query','count','nextRun','list','retry_limit','schedules','\x22...','statusIcon','type','engine_version','args','just\x20now','join','943960fldrwI','abs','Delete\x20a\x20scheduled\x20query','2980884brCxoq','schedule:history','create','substring','from','ies','Found\x20','next_run_at','time','Database\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]','update','delay','execute','retryLimit','644838HknIka','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20schedule\x20\x22','database','green','trino','has_next_page','Updating\x20schedule:\x20','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20show\x20<name>','cron','Getting\x20schedule\x20history...','Update\x20a\x20scheduled\x20query','\x20matching\x20\x22','engineVersion','json','output','Updating\x20schedule...','executing_user_id','Running\x20schedule:\x20','queryUrl','h\x20ago','Schedule\x20deleted:\x20'];a36_0xd7e4=function(){return _0x4de1ec;};return a36_0xd7e4();}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_0x3031de from'chalk';function formatRelativeTime(_0x3c9072){const _0x3848cd=a36_0x1de1,_0x5c768a=new Date(_0x3c9072),_0x3114b7=new Date(),_0xf6484a=_0x5c768a[_0x3848cd(0xae)]()-_0x3114b7['getTime'](),_0x693405=Math[_0x3848cd(0xe4)](_0xf6484a)/0x3e8,_0x42ef09=_0xf6484a<0x0;if(_0x693405<0x3c)return _0x42ef09?_0x3848cd(0xe1):_0x3848cd(0x97);else{if(_0x693405<0xe10){const _0x25d8db=Math[_0x3848cd(0xaf)](_0x693405/0x3c);return _0x42ef09?_0x25d8db+_0x3848cd(0xce):_0x3848cd(0xc4)+_0x25d8db+'m';}else{if(_0x693405<0x15180){const _0x5e75bf=Math['round'](_0x693405/0xe10);return _0x42ef09?_0x5e75bf+_0x3848cd(0x107):_0x3848cd(0xc4)+_0x5e75bf+'h';}else{if(_0x693405<0x93a80){const _0x708878=Math['round'](_0x693405/0x15180);return _0x42ef09?_0x708878+_0x3848cd(0x110):_0x3848cd(0xc4)+_0x708878+'d';}else return _0x5c768a[_0x3848cd(0x111)]();}}}}export class ScheduleListCommand extends BaseCommand{[a36_0x5507c2(0xc1)]='schedule:list';['description']=a36_0x5507c2(0x9c);async['execute'](_0x55812b){const _0x2829ae=a36_0x5507c2,{options:_0x113527,args:_0x3e7d65,tdx:_0x197ff3}=_0x55812b,_0x4d2847=resolveLimit(_0x113527['limit'],DEFAULT_DISPLAY_LIMIT),_0x93adb0=_0x3e7d65[0x0],_0x5b1f2e=_0x93adb0?_0x2829ae(0x99)+_0x93adb0+_0x2829ae(0xdc):_0x2829ae(0xa9),_0x523d18=await withSpinner(_0x5b1f2e,()=>_0x197ff3['schedules'][_0x2829ae(0xc7)]({'limit':_0x4d2847,'scheduled':!![],'pattern':_0x93adb0}),{'verbose':_0x113527['verbose']}),_0x5df1af=_0x523d18[_0x2829ae(0xb4)]['queries'],_0x4c3be9=_0x523d18[_0x2829ae(0xb4)]['pagination'][_0x2829ae(0xf9)],_0x567d6b=_0x93adb0?_0x2829ae(0xff)+_0x93adb0+'\x22':'';_0x4c3be9?console[_0x2829ae(0xb9)]('Showing\x20first\x20'+_0x5df1af[_0x2829ae(0xc6)]+_0x2829ae(0x114)+_0x567d6b+_0x2829ae(0x92)):console['error'](_0x2829ae(0xec)+_0x5df1af[_0x2829ae(0xc6)]+'\x20scheduled\x20quer'+(_0x5df1af[_0x2829ae(0xc6)]!==0x1?_0x2829ae(0xeb):'y')+_0x567d6b);if(_0x113527['format']===_0x2829ae(0x101)||_0x113527['format']==='jsonl'||_0x113527[_0x2829ae(0xb3)]===_0x2829ae(0xc3)||_0x113527[_0x2829ae(0xb3)]===_0x2829ae(0xc0)){const _0x4055c7=_0x5df1af[_0x2829ae(0x93)](_0x4fb30e=>({'id':_0x4fb30e['id'],'name':_0x4fb30e[_0x2829ae(0xc1)],'cron':_0x4fb30e[_0x2829ae(0xfc)],'database':_0x4fb30e[_0x2829ae(0xf6)]?.[_0x2829ae(0xc1)],'type':_0x4fb30e[_0x2829ae(0xde)],'timezone':_0x4fb30e[_0x2829ae(0x94)],'user_name':_0x4fb30e['user']?.['name'],'updated_at':_0x4fb30e['updated_at'],'next_run_at':_0x4fb30e['next_run_at'],'last_job_status':_0x4fb30e[_0x2829ae(0xba)]?.[_0x2829ae(0xa7)]}));await handleSDKOutput(_0x4055c7,_0x113527);}else{if(_0x5df1af[_0x2829ae(0xc6)]===0x0)console[_0x2829ae(0xa1)](_0x2829ae(0x9d));else{const _0x5af28f=_0x113527[_0x2829ae(0x115)],_0x576d7d=_0x5df1af[_0x2829ae(0x93)](_0xc0e39=>{const _0x1ee2ab=_0x2829ae,_0x58e970=_0xc0e39[_0x1ee2ab(0xba)]?.[_0x1ee2ab(0xa7)]?_0xc0e39[_0x1ee2ab(0xba)][_0x1ee2ab(0xa7)]===_0x1ee2ab(0xcd)?'✓':'✗':'-',_0x1eedc9=_0xc0e39[_0x1ee2ab(0xba)]?.['ended_at']?formatRelativeTime(_0xc0e39[_0x1ee2ab(0xba)]['ended_at']):_0x1ee2ab(0xcc),_0x1f166c=_0xc0e39[_0x1ee2ab(0xed)]?formatRelativeTime(_0xc0e39['next_run_at']):'-',_0x5b8f81=_0xc0e39['cron']||'',_0x3324cd=_0xc0e39[_0x1ee2ab(0xc1)]||_0x1ee2ab(0xd2),_0x11085a=getConsoleUrl(_0x5af28f,'/app/queries/editor?queryId='+_0xc0e39['id']);return{'statusIcon':_0x58e970,'lastRun':_0x1eedc9,'nextRun':_0x1f166c,'cron':_0x5b8f81,'name':_0x3324cd,'queryUrl':_0x11085a,'status':_0xc0e39['last_job']?.['status']};}),_0x4fd9ce=Math[_0x2829ae(0xa4)](..._0x576d7d[_0x2829ae(0x93)](_0x5d5946=>_0x5d5946[_0x2829ae(0x113)][_0x2829ae(0xc6)])),_0x200f38=Math['max'](..._0x576d7d[_0x2829ae(0x93)](_0x9bc55=>_0x9bc55[_0x2829ae(0xd8)][_0x2829ae(0xc6)])),_0x3a752c=Math[_0x2829ae(0xa4)](..._0x576d7d[_0x2829ae(0x93)](_0x4105b5=>_0x4105b5[_0x2829ae(0xfc)][_0x2829ae(0xc6)])),_0x500fd4=_0x576d7d[_0x2829ae(0x93)](_0x1534b8=>{const _0x207529=_0x2829ae,_0x3836aa=_0x1534b8[_0x207529(0xa7)]===_0x207529(0xcd)?a36_0x3031de[_0x207529(0xf7)](_0x1534b8[_0x207529(0xdd)]):_0x1534b8[_0x207529(0xa7)]===_0x207529(0xb9)?a36_0x3031de['red'](_0x1534b8[_0x207529(0xdd)]):a36_0x3031de['dim'](_0x1534b8[_0x207529(0xdd)]),_0x418d84=_0x1534b8[_0x207529(0x113)][_0x207529(0xa2)](_0x4fd9ce),_0x2dea93=_0x1534b8['nextRun']['padEnd'](_0x200f38),_0x5c27ba=_0x1534b8[_0x207529(0xfc)]?a36_0x3031de['cyan'](_0x1534b8[_0x207529(0xfc)][_0x207529(0xa2)](_0x3a752c)):'\x20'[_0x207529(0xc2)](_0x3a752c),_0x571d0d=hyperlink(_0x1534b8['name'],_0x1534b8[_0x207529(0x106)]);return'📅\x20'+_0x3836aa+'\x20'+_0x418d84+'\x20\x20→\x20'+_0x2dea93+'\x20\x20'+_0x5c27ba+'\x20\x20'+_0x571d0d;});await writeOutput(_0x500fd4[_0x2829ae(0xe2)]('\x0a'),_0x113527[_0x2829ae(0x102)],_0x2829ae(0xd9));}}return 0x0;}}export class ScheduleShowCommand extends BaseCommand{[a36_0x5507c2(0xc1)]='schedule:show';[a36_0x5507c2(0x10a)]=a36_0x5507c2(0xb5);[a36_0x5507c2(0x8f)](_0x427587){const _0x5d5afd=a36_0x5507c2,_0x3b7f7a=_0x427587[_0x5d5afd(0xe0)][0x0];if(!_0x3b7f7a)return _0x5d5afd(0xfb);return undefined;}async['execute'](_0x4d6685){const _0x62b7c0=a36_0x5507c2,{options:_0x538d3d,args:_0x43368a,tdx:_0x294c5f}=_0x4d6685,_0x29c2f6=_0x43368a[0x0],_0xc6b91f=await withSpinner(_0x62b7c0(0x9b),()=>_0x294c5f[_0x62b7c0(0xdb)]['show'](_0x29c2f6),{'verbose':_0x538d3d[_0x62b7c0(0x10d)]}),_0x36dbe9=_0xc6b91f[_0x62b7c0(0xb4)],_0xc25851={'name':_0x36dbe9[_0x62b7c0(0xc1)],'cron':_0x36dbe9[_0x62b7c0(0xfc)],'database':_0x36dbe9[_0x62b7c0(0xf6)],'type':_0x36dbe9[_0x62b7c0(0xde)],'timezone':_0x36dbe9[_0x62b7c0(0xd3)],'user_name':_0x36dbe9[_0x62b7c0(0xa5)],'created_at':_0x36dbe9[_0x62b7c0(0xb6)],'engine_version':_0x36dbe9[_0x62b7c0(0xdf)],'executing_user_id':_0x36dbe9[_0x62b7c0(0x104)],'query':_0x36dbe9[_0x62b7c0(0x90)],'delay':_0x36dbe9[_0x62b7c0(0xf1)],'priority':_0x36dbe9[_0x62b7c0(0xb2)],'retry_limit':_0x36dbe9[_0x62b7c0(0xda)],..._0x36dbe9[_0x62b7c0(0x10e)]&&{'result':_0x36dbe9['result']}};return await handleSingleObjectOutput(_0xc25851,_0x538d3d),0x0;}}export class ScheduleCreateCommand extends BaseCommand{[a36_0x5507c2(0xc1)]='schedule:create';[a36_0x5507c2(0x10a)]=a36_0x5507c2(0xd6);[a36_0x5507c2(0x8f)](_0x3a4343){const _0x5d1340=a36_0x5507c2,_0x502c4c=_0x3a4343[_0x5d1340(0xe0)][0x0];if(!_0x502c4c)return _0x5d1340(0xa8);const _0x23a8f3=_0x3a4343['options'];if(!_0x23a8f3[_0x5d1340(0xf6)])return _0x5d1340(0xef);return undefined;}async[a36_0x5507c2(0xf2)](_0x3eddd4){const _0x35f1dc=a36_0x5507c2,{options:_0x223128,args:_0x321138,tdx:_0x59ffcf}=_0x3eddd4,_0x55c371=_0x321138[0x0],_0x519481=_0x223128,_0x3d8dda=_0x519481[_0x35f1dc(0xf6)],_0x2f38db=_0x519481[_0x35f1dc(0x9a)],_0x1f336f=_0x519481[_0x35f1dc(0xde)]||_0x35f1dc(0xf8);let _0x6938;try{_0x6938=readFileSync(_0x2f38db,'utf-8')[_0x35f1dc(0xd1)]();}catch(_0x51c8f9){throw new SDKError(ErrorCode[_0x35f1dc(0x98)],_0x35f1dc(0xd4)+_0x2f38db,_0x51c8f9 instanceof Error?_0x51c8f9:undefined);}if(!_0x6938)throw new SDKError(ErrorCode[_0x35f1dc(0x98)],'Query\x20file\x20is\x20empty');const _0x4c4c92={'database':_0x3d8dda,'query':_0x6938,'type':_0x1f336f};if(_0x519481[_0x35f1dc(0xfc)])_0x4c4c92['cron']=_0x519481['cron'];if(_0x519481[_0x35f1dc(0xd3)])_0x4c4c92[_0x35f1dc(0xd3)]=_0x519481[_0x35f1dc(0xd3)];if(_0x519481[_0x35f1dc(0xf1)]!==undefined)_0x4c4c92[_0x35f1dc(0xf1)]=Number(_0x519481[_0x35f1dc(0xf1)]);if(_0x519481[_0x35f1dc(0xb2)]!==undefined)_0x4c4c92[_0x35f1dc(0xb2)]=Number(_0x519481[_0x35f1dc(0xb2)]);if(_0x519481[_0x35f1dc(0xf3)]!==undefined)_0x4c4c92[_0x35f1dc(0xda)]=Number(_0x519481[_0x35f1dc(0xf3)]);if(_0x519481['engineVersion'])_0x4c4c92['engine_version']=_0x519481[_0x35f1dc(0x100)];if(_0x519481[_0x35f1dc(0x10e)])_0x4c4c92[_0x35f1dc(0x10e)]=_0x519481[_0x35f1dc(0x10e)];if(_0x223128[_0x35f1dc(0x10d)]){console[_0x35f1dc(0xb9)](_0x35f1dc(0xbc)+_0x55c371),console['error'](_0x35f1dc(0xb0)+_0x3d8dda),console[_0x35f1dc(0xb9)]('\x20\x20Type:\x20'+_0x1f336f);if(_0x4c4c92[_0x35f1dc(0xfc)])console[_0x35f1dc(0xb9)]('\x20\x20Cron:\x20'+_0x4c4c92[_0x35f1dc(0xfc)]);if(_0x4c4c92[_0x35f1dc(0xd3)])console[_0x35f1dc(0xb9)](_0x35f1dc(0xbe)+_0x4c4c92[_0x35f1dc(0xd3)]);}const _0x33b7a2=await withSpinner(_0x35f1dc(0xac),()=>_0x59ffcf[_0x35f1dc(0xdb)][_0x35f1dc(0xe8)](_0x55c371,_0x4c4c92),{'verbose':_0x223128[_0x35f1dc(0x10d)]});return console[_0x35f1dc(0xb9)](_0x35f1dc(0x10f)+_0x33b7a2[_0x35f1dc(0xb4)][_0x35f1dc(0xc1)]),await handleSingleObjectOutput(_0x33b7a2[_0x35f1dc(0xb4)],_0x223128),0x0;}}function a36_0x1de1(_0x37ab29,_0x1377fb){_0x37ab29=_0x37ab29-0x8f;const _0xd7e4f9=a36_0xd7e4();let _0x1de1de=_0xd7e4f9[_0x37ab29];return _0x1de1de;}export class ScheduleUpdateCommand extends BaseCommand{[a36_0x5507c2(0xc1)]='schedule:update';[a36_0x5507c2(0x10a)]=a36_0x5507c2(0xfe);[a36_0x5507c2(0x8f)](_0x21d20f){const _0x1b33f1=a36_0x5507c2,_0x499b61=_0x21d20f[_0x1b33f1(0xe0)][0x0];if(!_0x499b61)return _0x1b33f1(0x9e);return undefined;}async[a36_0x5507c2(0xf2)](_0xccfc09){const _0x1792b0=a36_0x5507c2,{options:_0x7c74f9,args:_0x581fb3,tdx:_0x598612}=_0xccfc09,_0x1d6b3f=_0x581fb3[0x0],_0x38b616=_0x7c74f9,_0x3b4f1d={};if(_0x38b616[_0x1792b0(0xf6)])_0x3b4f1d[_0x1792b0(0xf6)]=_0x38b616[_0x1792b0(0xf6)];if(_0x38b616[_0x1792b0(0xde)])_0x3b4f1d[_0x1792b0(0xde)]=_0x38b616[_0x1792b0(0xde)];if(_0x38b616[_0x1792b0(0xfc)])_0x3b4f1d['cron']=_0x38b616['cron'];if(_0x38b616[_0x1792b0(0xd3)])_0x3b4f1d['timezone']=_0x38b616[_0x1792b0(0xd3)];if(_0x38b616[_0x1792b0(0xf1)]!==undefined)_0x3b4f1d[_0x1792b0(0xf1)]=Number(_0x38b616[_0x1792b0(0xf1)]);if(_0x38b616[_0x1792b0(0xb2)]!==undefined)_0x3b4f1d[_0x1792b0(0xb2)]=Number(_0x38b616[_0x1792b0(0xb2)]);if(_0x38b616[_0x1792b0(0xf3)]!==undefined)_0x3b4f1d[_0x1792b0(0xda)]=Number(_0x38b616[_0x1792b0(0xf3)]);if(_0x38b616[_0x1792b0(0x100)])_0x3b4f1d[_0x1792b0(0xdf)]=_0x38b616['engineVersion'];if(_0x38b616[_0x1792b0(0x10e)])_0x3b4f1d[_0x1792b0(0x10e)]=_0x38b616[_0x1792b0(0x10e)];if(_0x38b616[_0x1792b0(0x9a)])try{_0x3b4f1d[_0x1792b0(0x90)]=readFileSync(_0x38b616[_0x1792b0(0x9a)],'utf-8')['trim']();}catch(_0x3924c4){throw new SDKError(ErrorCode[_0x1792b0(0x98)],_0x1792b0(0xd4)+_0x38b616['file'],_0x3924c4 instanceof Error?_0x3924c4:undefined);}if(Object['keys'](_0x3b4f1d)[_0x1792b0(0xc6)]===0x0)throw new SDKError(ErrorCode[_0x1792b0(0x98)],_0x1792b0(0xa3));if(_0x7c74f9['verbose']){console[_0x1792b0(0xb9)](_0x1792b0(0xfa)+_0x1d6b3f);for(const [_0x2a93a9,_0x2aeebc]of Object[_0x1792b0(0x109)](_0x3b4f1d)){_0x2a93a9===_0x1792b0(0x90)?console[_0x1792b0(0xb9)]('\x20\x20'+_0x2a93a9+':\x20'+_0x2aeebc[_0x1792b0(0xe9)](0x0,0x32)+'...'):console[_0x1792b0(0xb9)]('\x20\x20'+_0x2a93a9+':\x20'+_0x2aeebc);}}const _0x5cd9fc=await withSpinner(_0x1792b0(0x103),()=>_0x598612[_0x1792b0(0xdb)][_0x1792b0(0xf0)](_0x1d6b3f,_0x3b4f1d),{'verbose':_0x7c74f9[_0x1792b0(0x10d)]});return console[_0x1792b0(0xb9)](_0x1792b0(0xb1)+_0x5cd9fc[_0x1792b0(0xb4)][_0x1792b0(0xc1)]),await handleSingleObjectOutput(_0x5cd9fc[_0x1792b0(0xb4)],_0x7c74f9),0x0;}}export class ScheduleDeleteCommand extends BaseCommand{['name']=a36_0x5507c2(0xd5);[a36_0x5507c2(0x10a)]=a36_0x5507c2(0xe5);[a36_0x5507c2(0x8f)](_0x347c6b){const _0x24cd65=a36_0x5507c2,_0x21b66e=_0x347c6b[_0x24cd65(0xe0)][0x0];if(!_0x21b66e)return _0x24cd65(0xc9);return undefined;}async[a36_0x5507c2(0xf2)](_0x24855d){const _0x2cd95c=a36_0x5507c2,{options:_0x11f57d,args:_0x3ee332,tdx:_0x27898c}=_0x24855d,_0x2d856a=_0x3ee332[0x0];if(!_0x11f57d[_0x2cd95c(0xcf)]){const _0x5ea93e=await confirm(_0x2cd95c(0xf5)+_0x2d856a+'\x22?');if(!_0x5ea93e)return console[_0x2cd95c(0xb9)](_0x2cd95c(0xc8)),0x0;}const _0x552b39=await withSpinner(_0x2cd95c(0xab),()=>_0x27898c[_0x2cd95c(0xdb)][_0x2cd95c(0xca)](_0x2d856a),{'verbose':_0x11f57d[_0x2cd95c(0x10d)]});return console['error'](_0x2cd95c(0x108)+_0x552b39[_0x2cd95c(0xb4)][_0x2cd95c(0xc1)]),0x0;}}export class ScheduleRunCommand extends BaseCommand{[a36_0x5507c2(0xc1)]='schedule:run';[a36_0x5507c2(0x10a)]='Run\x20a\x20scheduled\x20query\x20immediately';[a36_0x5507c2(0x8f)](_0x26d97f){const _0x2f567d=a36_0x5507c2,_0xe4aca0=_0x26d97f[_0x2f567d(0xe0)][0x0];if(!_0xe4aca0)return _0x2f567d(0xd0);return undefined;}async['execute'](_0x39316a){const _0x56bd6e=a36_0x5507c2,{options:_0x1355ac,args:_0x3e0a5b,tdx:_0x407594}=_0x39316a,_0x6e8e9c=_0x3e0a5b[0x0],_0x2e3bae=_0x1355ac,_0x38bb63=_0x2e3bae[_0x56bd6e(0xee)],_0x2505bd=_0x2e3bae[_0x56bd6e(0x10b)]!==undefined?Number(_0x2e3bae[_0x56bd6e(0x10b)]):undefined;if(_0x1355ac['verbose']){console[_0x56bd6e(0xb9)](_0x56bd6e(0x105)+_0x6e8e9c);if(_0x38bb63)console[_0x56bd6e(0xb9)](_0x56bd6e(0x10c)+_0x38bb63);if(_0x2505bd)console[_0x56bd6e(0xb9)](_0x56bd6e(0x9f)+_0x2505bd);}const _0x34c740=await withSpinner(_0x56bd6e(0xad),()=>_0x407594[_0x56bd6e(0xdb)]['run'](_0x6e8e9c,{'time':_0x38bb63,'num':_0x2505bd}),{'verbose':_0x1355ac[_0x56bd6e(0x10d)]}),_0x2ad205=_0x34c740[_0x56bd6e(0xb4)][_0x56bd6e(0xcb)];console[_0x56bd6e(0xb9)]('Schedule\x20run\x20submitted:\x20'+_0x2ad205['length']+_0x56bd6e(0xb8)+(_0x2ad205[_0x56bd6e(0xc6)]!==0x1?'s':'')+_0x56bd6e(0xbf));for(const _0x4eed20 of _0x2ad205){console[_0x56bd6e(0xb9)]('\x20\x20Job\x20ID:\x20'+_0x4eed20[_0x56bd6e(0x96)]);}return await handleSDKOutput(_0x2ad205,_0x1355ac),0x0;}}export class ScheduleHistoryCommand extends BaseCommand{[a36_0x5507c2(0xc1)]=a36_0x5507c2(0xe7);[a36_0x5507c2(0x10a)]=a36_0x5507c2(0x112);[a36_0x5507c2(0x8f)](_0x297a55){const _0x19df49=a36_0x5507c2,_0x1f3e62=_0x297a55[_0x19df49(0xe0)][0x0];if(!_0x1f3e62)return'Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20history\x20<name>\x20[--from\x20<n>]\x20[--to\x20<n>]';return undefined;}async[a36_0x5507c2(0xf2)](_0x1694b0){const _0x5e4e4f=a36_0x5507c2,{options:_0x61b71a,args:_0x30e7b1,tdx:_0x1ce9c2}=_0x1694b0,_0x424faf=_0x30e7b1[0x0],_0xbd40cc=_0x61b71a,_0x1bc879=_0xbd40cc[_0x5e4e4f(0xea)]!==undefined?Number(_0xbd40cc[_0x5e4e4f(0xea)]):undefined,_0x36eac6=_0xbd40cc['to']!==undefined?Number(_0xbd40cc['to']):undefined,_0x3a1b79=await withSpinner(_0x5e4e4f(0xfd),()=>_0x1ce9c2['schedules'][_0x5e4e4f(0xaa)](_0x424faf,{'from':_0x1bc879,'to':_0x36eac6}),{'verbose':_0x61b71a[_0x5e4e4f(0x10d)]}),_0x4210a2=_0x3a1b79[_0x5e4e4f(0xb4)];console[_0x5e4e4f(0xb9)](_0x5e4e4f(0xec)+_0x4210a2[_0x5e4e4f(0xd7)]+_0x5e4e4f(0xb7)+(_0x4210a2['count']!==0x1?'s':'')+'\x20(showing\x20'+_0x4210a2['from']+'-'+_0x4210a2['to']+')');const _0x1cb0d4=_0x4210a2[_0x5e4e4f(0xaa)][_0x5e4e4f(0x93)](_0x2f85ce=>({'job_id':_0x2f85ce[_0x5e4e4f(0x96)],'type':_0x2f85ce['type'],'status':_0x2f85ce['status'],'scheduled_at':_0x2f85ce[_0x5e4e4f(0xbb)],'created_at':_0x2f85ce[_0x5e4e4f(0xb6)],'start_at':_0x2f85ce['start_at'],'end_at':_0x2f85ce['end_at']}));return await handleSDKOutput(_0x1cb0d4,_0x61b71a),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_0x4f2df1=a37_0x4823;(function(_0x2eb590,_0x2ef67b){const _0x463654=a37_0x4823,_0x39b3c7=_0x2eb590();while(!![]){try{const _0x45c98c=parseInt(_0x463654(0x168))/0x1*(parseInt(_0x463654(0x1bf))/0x2)+parseInt(_0x463654(0x1e9))/0x3*(-parseInt(_0x463654(0x1a2))/0x4)+parseInt(_0x463654(0x179))/0x5*(-parseInt(_0x463654(0x1b6))/0x6)+parseInt(_0x463654(0x1d7))/0x7+-parseInt(_0x463654(0x1bc))/0x8+parseInt(_0x463654(0x18d))/0x9*(-parseInt(_0x463654(0x1fc))/0xa)+parseInt(_0x463654(0x16c))/0xb;if(_0x45c98c===_0x2ef67b)break;else _0x39b3c7['push'](_0x39b3c7['shift']());}catch(_0x1cdf1e){_0x39b3c7['push'](_0x39b3c7['shift']());}}}(a37_0x2ad6,0x863a1));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';function a37_0x2ad6(){const _0xb311c2=['Error:\x20YAML\x20file\x20paths\x20must\x20be\x20specified\x20with\x20--path\x20option','getSegment','parent','\x20\x20tdx\x20sg\x20sql\x20--path\x20','Use:\x20tdx\x20ps\x20view','resolveFolderId','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','web','Usage:\x20tdx\x20sg\x20desc\x20<name>','4975KckRQf','segmentName','✔\x20Created\x20folder\x20\x27','length','Folder\x20name:\x20','Usage:\x20tdx\x20segment\x20folder\x20create\x20<parent_name>\x20<folder_name>\x20[options]','\x20\x20Local\x20YAML\x20file:\x20\x20\x20\x20\x20\x20tdx\x20sg\x20sql\x20--path\x20<file-path>','\x20\x20Folder\x20path:\x20','Error:\x20Cannot\x20execute\x20query\x20for\x20parent\x20segment\x20with\x20this\x20command.','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20view\x20<path/to/segment.yml>','site','message','Usage:\x20tdx\x20segment\x20folder\x20show\x20<parent_name/folder_name>','red','SEGMENT_FOLDER_NOT_FOUND','Resolved\x20folder\x20ID:\x20','\x20Opening\x20','error','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20show\x20<path/to/segment.yml>','Error:\x20','4605516BGIaRn','getSQLFromServerSegment','Show\x20segment\x20folder\x20details','type','Error:\x20Folder\x20reference\x20is\x20required','Use:\x20tdx\x20sg\x20view\x20<name>\x20\x20#\x20To\x20show\x20folder\x20details','folderPath','getFolder','json','description','Error:\x20Cannot\x20execute\x20SQL\x20query\x20on\x20a\x20folder.','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience\x22','✖\x20Query\x20failed\x20[','\x20rows\x20','Error:\x20Segment\x20name\x20or\x20--path\x20is\x20required','\x20\x20tdx\x20sg\x20sql\x20--path\x20segments/my-audience/premium-users.yml','getSegmentSQLFromYaml','Fetching\x20SQL\x20for\x20segment...','execute','verbose','Folder\x20ID\x20missing\x20from\x20resolved\x20path','4cQxAZL','Usage:\x20tdx\x20segment\x20describe\x20<path>','Error:\x20Parent\x20segment\x20name\x20is\x20required','information_schema','folderId','createFolder','parentFolder','trim','segment:describe','Listing\x20folders\x20for\x20parent\x20\x27','segment:show','parentSegment','Target\x20path:\x20','Resolved\x20type:\x20','segment:view','Error:\x20Specify\x20either\x20segment\x20name\x20or\x20--path,\x20not\x20both','content','includes','\x27...','segmentId','3426CwiEFg','List\x20segment\x20folders\x20under\x20a\x20parent\x20segment','Resolving\x20parent\x20folder\x20\x27','segment:folder:list','Site:\x20','getSQLFromYamlFile','8747184jMlmIj','Use:\x20tdx\x20ps\x20desc','Resolving\x20\x27','112972UFQFNe','\x20\x20Cause:\x20','Segment\x20ID\x20missing\x20from\x20resolved\x20path','\x20[Job\x20ID:\x20','Resolved\x20parent\x20ID:\x20','cyan','format','Resolving\x20path\x20\x27','code','\x20\x20tdx\x20sg\x20show\x20segments/my-audience/premium-users.yml','Fetching\x20folder\x20details...','Use:\x20tdx\x20ps\x20show','test','Usage:\x20tdx\x20sg\x20view\x20<name>\x20[-w]','toLocaleString','processedRows','\x27\x20with\x20ID:\x20','query','folder','Resolved:\x20','getParent','\x20\x20tdx\x20sg\x20show\x20\x22Premium\x20Users\x22','data','✔\x20Query\x20completed:\x20Processed\x20','2651019KDZIiy','Usage:','Error:\x20Folder\x20name\x20is\x20required\x20(use\x20parent_name/folder_name\x20format)','Segment\x20ID:\x20','Folder\x20ID:\x20','jobId','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20-w\x20\x20#\x20Open\x20segment\x20in\x20web\x20browser','Parent\x20name:\x20','Error:\x20Cannot\x20show\x20schema\x20for\x20parent\x20segment\x20with\x20this\x20command.','segment','log','Examples:','cause','\x20\x20Server-side\x20segment:\x20\x20tdx\x20sg\x20sql\x20<name>','Executing\x20segment\x20query...','name','\x20\x20tdx\x20sg\x20sql\x20\x22Premium\x20Users\x22','stats','2331582vOhlqz','resolveParentId','listFolders','Use:\x20tdx\x20ps\x20view\x20-w','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20desc\x20<path/to/segment.yml>','✔\x20Found\x20','/e/','resolvePathToResource','Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required','Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.','(root)','path','\x20\x20-w,\x20--web\x20\x20Open\x20segment\x20in\x20web\x20browser','Creating\x20folder\x20\x27','\x20\x20tdx\x20segment\x20describe\x20\x22High\x20Value\x22\x20\x20\x20\x20#\x20Relative\x20to\x20current\x20context','SQL\x20query:\x0a','green','Error:\x20Cannot\x20open\x20folder\x20in\x20web\x20browser.\x20Use\x20a\x20segment\x20name\x20instead.','Fetching\x20segment\x20details...','10sOLTLM','Resolving\x20parent\x20segment\x20\x27','Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20','segment:desc','\x20\x20Segment\x20name:\x20','segment:sql','INVALID_ARGUMENT','Resolved\x20relative\x20path\x20to:\x20','parentId','Get\x20SQL\x20query\x20for\x20child\x20segment','Error:\x20Cannot\x20open\x20parent\x20segment\x20with\x20this\x20command.','\x20folder','getSegmentSQL','replace','Parent\x20ID:\x20','SEGMENT_NOT_FOUND','Options:','Fetching\x20folder\x20\x27','\x20\x20tdx\x20sg\x20view\x20segments/my-audience/premium-users.yml','2QGJJwv','Execute\x20child\x20segment\x20SQL\x20query\x20and\x20show\x20results','Resolved\x20YAML\x20file:\x20','fullPath','33094215IMKnpH','Error:\x20Folder\x20or\x20segment\x20name,\x20or\x20YAML\x20file\x20path\x20is\x20required','Error:\x20Cannot\x20show\x20schema\x20for\x20a\x20folder.','SELECT\x20*\x20FROM\x20(\x0a'];a37_0x2ad6=function(){return _0xb311c2;};return a37_0x2ad6();}import{handleSDKOutput,handleQueryOutput,handleSingleObjectOutput}from'../core/command-output.js';import{withSpinner,withProgressSpinner,formatElapsed}from'../utils/spinner.js';import{parseSegmentRef}from'../sdk/segment/segment-ref-parser.js';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import{executeSchemaQuery}from'../sdk/segment/fields-display.js';import{isYamlFilePath,resolveYamlFilePath}from'../sdk/segment/segment-path-parser.js';import{getConsoleNextUrl}from'../sdk/client/endpoints.js';import{openBrowser}from'../utils/process.js';import a37_0xa4eb77 from'chalk';async function resolveSegmentTarget(_0x2f90bf,_0x10bc02,_0x3444ca){const _0x15acf3=a37_0x4823;if(isYamlFilePath(_0x2f90bf))try{const _0x236ae5=await resolveYamlFilePath(_0x2f90bf);return _0x3444ca&&(console[_0x15acf3(0x18a)](_0x15acf3(0x16a)+_0x2f90bf),console[_0x15acf3(0x18a)]('\x20\x20Parent\x20segment:\x20'+_0x236ae5[_0x15acf3(0x1ad)]),console[_0x15acf3(0x18a)](_0x15acf3(0x200)+_0x236ae5['segmentName']),console[_0x15acf3(0x18a)](_0x15acf3(0x180)+(_0x236ae5[_0x15acf3(0x193)]||_0x15acf3(0x1f3))),console[_0x15acf3(0x18a)]('\x20\x20Full\x20path:\x20'+_0x236ae5['fullPath'])),_0x236ae5[_0x15acf3(0x16b)];}catch(_0x26c43b){throw new SDKError(ErrorCode[_0x15acf3(0x202)],'Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20'+_0x26c43b[_0x15acf3(0x184)]);}if(!_0x10bc02)throw new SDKError(ErrorCode['INVALID_ARGUMENT'],'No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22');return _0x10bc02+'/'+_0x2f90bf;}export class SegmentDescribeCommand extends BaseCommand{[a37_0x4f2df1(0x1e6)]=a37_0x4f2df1(0x1aa);[a37_0x4f2df1(0x196)]='Show\x20segment\x20or\x20folder\x20details';async[a37_0x4f2df1(0x19f)](_0x24505b){const _0x2c36b2=a37_0x4f2df1,{options:_0x2f04d,args:_0x25624f,tdx:_0x295e55}=_0x24505b,_0xac228=_0x25624f[0x0],_0x39eafc=!_0xac228&&!!_0x2f04d[_0x2c36b2(0x1ad)],_0x512a5a=_0xac228||_0x2f04d[_0x2c36b2(0x1ad)];if(!_0x512a5a)return console[_0x2c36b2(0x18a)]('Error:\x20Path\x20or\x20name\x20is\x20required'),console[_0x2c36b2(0x18a)](_0x2c36b2(0x1a3)),console[_0x2c36b2(0x18a)](_0x2c36b2(0x1e2)),console[_0x2c36b2(0x18a)](_0x2c36b2(0x198)),console[_0x2c36b2(0x18a)]('\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience/Marketing/High\x20Value\x22'),console[_0x2c36b2(0x18a)](_0x2c36b2(0x1f7)),console[_0x2c36b2(0x18a)]('\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>'),0x1;try{const _0x294221=_0x2f04d['segmentPath'];let _0x2e5a33=_0x512a5a;!_0x39eafc&&_0x294221&&!_0x512a5a[_0x2c36b2(0x1b3)]('/')&&(_0x2e5a33=_0x294221+'/'+_0x512a5a,_0x2f04d[_0x2c36b2(0x1a0)]&&console['error'](_0x2c36b2(0x203)+_0x2e5a33));const _0x597348=await withSpinner(_0x2c36b2(0x1c6)+_0x2e5a33+_0x2c36b2(0x1b4),()=>_0x295e55[_0x2c36b2(0x1e0)]['resolvePathToResource'](_0x2e5a33),{'verbose':_0x2f04d[_0x2c36b2(0x1a0)]}),_0x1b8d3b=_0x597348[_0x2c36b2(0x1d5)];_0x2f04d[_0x2c36b2(0x1a0)]&&(console[_0x2c36b2(0x18a)](_0x2c36b2(0x1af)+_0x1b8d3b[_0x2c36b2(0x190)]),console[_0x2c36b2(0x18a)]('Parent\x20ID:\x20'+_0x1b8d3b[_0x2c36b2(0x204)]),_0x1b8d3b[_0x2c36b2(0x1a6)]&&console[_0x2c36b2(0x18a)]('Folder\x20ID:\x20'+_0x1b8d3b['folderId']),_0x1b8d3b[_0x2c36b2(0x1b5)]&&console['error'](_0x2c36b2(0x1da)+_0x1b8d3b[_0x2c36b2(0x1b5)]));if(_0x1b8d3b[_0x2c36b2(0x190)]===_0x2c36b2(0x172)){const _0x32c9e2=await withSpinner('Fetching\x20parent\x20segment\x20details...',()=>_0x295e55[_0x2c36b2(0x1e0)][_0x2c36b2(0x1d3)](_0x1b8d3b[_0x2c36b2(0x204)]),{'verbose':_0x2f04d['verbose']});await handleSingleObjectOutput(_0x32c9e2[_0x2c36b2(0x1d5)],_0x2f04d);}else{if(_0x1b8d3b['type']==='folder'){if(!_0x1b8d3b[_0x2c36b2(0x1a6)])throw new SDKError(ErrorCode['SEGMENT_FOLDER_NOT_FOUND'],_0x2c36b2(0x1a1));const _0xb7fdc8=await withSpinner(_0x2c36b2(0x1c9),()=>_0x295e55['segment'][_0x2c36b2(0x194)](_0x1b8d3b[_0x2c36b2(0x1a6)]),{'verbose':_0x2f04d['verbose']});await handleSingleObjectOutput(_0xb7fdc8[_0x2c36b2(0x1d5)],_0x2f04d);}else{if(_0x1b8d3b['type']===_0x2c36b2(0x1e0)){if(!_0x1b8d3b[_0x2c36b2(0x1b5)])throw new SDKError(ErrorCode[_0x2c36b2(0x20b)],_0x2c36b2(0x1c1));const _0x1192d8=await withSpinner(_0x2c36b2(0x1fb),()=>_0x295e55[_0x2c36b2(0x1e0)][_0x2c36b2(0x171)](_0x1b8d3b['parentId'],_0x1b8d3b[_0x2c36b2(0x1b5)]),{'verbose':_0x2f04d[_0x2c36b2(0x1a0)]});await handleSingleObjectOutput(_0x1192d8[_0x2c36b2(0x1d5)],_0x2f04d);}}}return 0x0;}catch(_0x4cc194){if(_0x4cc194 instanceof SDKError)return console[_0x2c36b2(0x18a)](_0x2c36b2(0x18c)+_0x4cc194[_0x2c36b2(0x184)]),_0x4cc194[_0x2c36b2(0x1e3)]&&console[_0x2c36b2(0x18a)](_0x2c36b2(0x1c0)+_0x4cc194[_0x2c36b2(0x1e3)]),0x1;throw _0x4cc194;}}}export class SegmentShowCommand extends BaseCommand{[a37_0x4f2df1(0x1e6)]=a37_0x4f2df1(0x1ac);[a37_0x4f2df1(0x196)]=a37_0x4f2df1(0x169);async[a37_0x4f2df1(0x19f)](_0x280674){const _0x5683d0=a37_0x4f2df1,{options:_0x4b9515,args:_0x462b09,tdx:_0x504cf6}=_0x280674,_0x5b4efa=_0x462b09[0x0];if(!_0x5b4efa)return console[_0x5683d0(0x18a)](_0x5683d0(0x1f1)),console[_0x5683d0(0x18a)]('Usage:\x20tdx\x20sg\x20show\x20<name>'),console[_0x5683d0(0x18a)](_0x5683d0(0x18b)),console[_0x5683d0(0x18a)](_0x5683d0(0x1e2)),console[_0x5683d0(0x18a)](_0x5683d0(0x1d4)),console[_0x5683d0(0x18a)](_0x5683d0(0x1c8)),0x1;try{const _0x3e4b2a=_0x4b9515['parentSegment'],_0x2094ae=await resolveSegmentTarget(_0x5b4efa,_0x3e4b2a,_0x4b9515[_0x5683d0(0x1a0)]);_0x4b9515[_0x5683d0(0x1a0)]&&console[_0x5683d0(0x18a)]('Target\x20path:\x20'+_0x2094ae);const _0x2697ac=await withSpinner(_0x5683d0(0x1be)+_0x5b4efa+_0x5683d0(0x1b4),()=>_0x504cf6[_0x5683d0(0x1e0)][_0x5683d0(0x1f0)](_0x2094ae),{'verbose':_0x4b9515['verbose']}),_0x127619=_0x2697ac['data'];_0x4b9515[_0x5683d0(0x1a0)]&&(console[_0x5683d0(0x18a)](_0x5683d0(0x1af)+_0x127619[_0x5683d0(0x190)]),console[_0x5683d0(0x18a)]('Parent\x20ID:\x20'+_0x127619[_0x5683d0(0x204)]));if(_0x127619['type']===_0x5683d0(0x1d1))return console[_0x5683d0(0x18a)](_0x5683d0(0x197)),console['error'](_0x5683d0(0x192)),0x1;if(_0x127619[_0x5683d0(0x190)]===_0x5683d0(0x172))return console[_0x5683d0(0x18a)](_0x5683d0(0x181)),console[_0x5683d0(0x18a)](_0x5683d0(0x1ca)),0x1;if(!_0x127619[_0x5683d0(0x1b5)])throw new SDKError(ErrorCode[_0x5683d0(0x20b)],_0x5683d0(0x1c1));const _0x5835b2=await withSpinner(_0x5683d0(0x19e),()=>_0x504cf6['segment'][_0x5683d0(0x208)](_0x127619[_0x5683d0(0x204)],_0x127619[_0x5683d0(0x1b5)]),{'verbose':_0x4b9515[_0x5683d0(0x1a0)]});let _0x223779=_0x5835b2[_0x5683d0(0x1d5)];const _0x1aacc9=resolveLimit(_0x4b9515['limit'],DEFAULT_DISPLAY_LIMIT),_0x4f8bbc=/\bLIMIT\s+\d+/i[_0x5683d0(0x1cb)](_0x223779);!_0x4f8bbc&&(_0x223779=_0x223779[_0x5683d0(0x1a9)]()[_0x5683d0(0x209)](/;+$/,''),_0x223779=_0x5683d0(0x16f)+_0x223779+_0x5683d0(0x176)+_0x1aacc9);_0x4b9515['verbose']&&console[_0x5683d0(0x18a)](_0x5683d0(0x1f8)+_0x223779);const _0x4428ca=await withProgressSpinner(_0x5683d0(0x1e5),async _0x3c373f=>{const _0x4557a5=_0x5683d0,_0x4a6945=await _0x504cf6[_0x4557a5(0x1d0)][_0x4557a5(0x19f)](_0x223779,{'catalog':'td','schema':_0x4557a5(0x1a5),'onJobId':_0x48fe42=>{_0x3c373f['setJobId'](_0x48fe42);}});return _0x4a6945;},{'verbose':_0x4b9515[_0x5683d0(0x1a0)]}),_0x587da8=_0x4428ca[_0x5683d0(0x1d5)],_0x642764=_0x587da8['jobId']?_0x5683d0(0x1c2)+_0x587da8[_0x5683d0(0x1dc)]+']':'';return console[_0x5683d0(0x18a)](_0x5683d0(0x1d6)+_0x587da8[_0x5683d0(0x1e8)][_0x5683d0(0x1ce)][_0x5683d0(0x1cd)]()+_0x5683d0(0x19a)+('in\x20'+formatElapsed(_0x587da8['stats']['elapsedTimeMillis'])+_0x642764)),await handleQueryOutput(_0x587da8,_0x4b9515),0x0;}catch(_0x21fda9){if(_0x21fda9 instanceof SDKError)return console[_0x5683d0(0x18a)](_0x5683d0(0x199)+_0x21fda9[_0x5683d0(0x1c7)]+']'),console['error']('\x0a'+_0x21fda9[_0x5683d0(0x184)]),0x1;throw _0x21fda9;}}}export class SegmentFolderListCommand extends BaseCommand{[a37_0x4f2df1(0x1e6)]=a37_0x4f2df1(0x1b9);[a37_0x4f2df1(0x196)]=a37_0x4f2df1(0x1b7);async['execute'](_0xa80269){const _0x3dad63=a37_0x4f2df1,{options:_0x8b0c75,args:_0x3eb70c,tdx:_0xbaaeae}=_0xa80269;if(_0x3eb70c[_0x3dad63(0x17c)]===0x0)return console[_0x3dad63(0x18a)](_0x3dad63(0x1a4)),console[_0x3dad63(0x18a)]('Usage:\x20tdx\x20segment\x20folder\x20list\x20<parent_name>'),0x1;const _0x52421d=_0x3eb70c[0x0];try{_0x8b0c75[_0x3dad63(0x1a0)]&&(console['error'](_0x3dad63(0x1ba)+_0x8b0c75['site']),console['error'](_0x3dad63(0x1de)+_0x52421d));const _0x4a9a17=await withSpinner(_0x3dad63(0x1fd)+_0x52421d+'\x27...',()=>_0xbaaeae[_0x3dad63(0x1e0)]['resolveParentId'](_0x52421d),{'verbose':_0x8b0c75['verbose']}),_0x281b1b=_0x4a9a17['data'];_0x8b0c75[_0x3dad63(0x1a0)]&&console['error'](_0x3dad63(0x1c3)+_0x281b1b);const _0x32f81b=await withSpinner(_0x3dad63(0x1ab)+_0x52421d+_0x3dad63(0x1b4),()=>_0xbaaeae['segment'][_0x3dad63(0x1eb)](_0x281b1b),{'verbose':_0x8b0c75[_0x3dad63(0x1a0)]}),_0x36d686=_0x32f81b[_0x3dad63(0x1d5)];return console[_0x3dad63(0x18a)](_0x3dad63(0x1ee)+_0x36d686[_0x3dad63(0x17c)]+_0x3dad63(0x207)+(_0x36d686['length']!==0x1?'s':'')),await handleSDKOutput(_0x36d686,_0x8b0c75),0x0;}catch(_0x422d05){if(_0x422d05 instanceof SDKError)return console[_0x3dad63(0x18a)](_0x3dad63(0x18c)+_0x422d05[_0x3dad63(0x184)]),_0x422d05[_0x3dad63(0x1e3)]&&console[_0x3dad63(0x18a)]('\x20\x20Cause:\x20'+_0x422d05[_0x3dad63(0x1e3)]),0x1;throw _0x422d05;}}}export class SegmentFolderShowCommand extends BaseCommand{[a37_0x4f2df1(0x1e6)]='segment:folder:show';[a37_0x4f2df1(0x196)]=a37_0x4f2df1(0x18f);async['execute'](_0x2106f5){const _0x81a094=a37_0x4f2df1,{options:_0x48d0e4,args:_0x55a818,tdx:_0x3aa108}=_0x2106f5;if(_0x55a818[_0x81a094(0x17c)]===0x0)return console['error'](_0x81a094(0x191)),console[_0x81a094(0x18a)](_0x81a094(0x185)),0x1;try{const {parentId:_0x5b3245,childId:_0xbba440}=parseSegmentRef(_0x55a818[0x0]);_0x48d0e4['verbose']&&(console['error'](_0x81a094(0x1ba)+_0x48d0e4[_0x81a094(0x183)]),console['error']('Parent\x20name:\x20'+_0x5b3245),_0xbba440&&console[_0x81a094(0x18a)](_0x81a094(0x17d)+_0xbba440));if(!_0xbba440)return console[_0x81a094(0x18a)](_0x81a094(0x1d9)),0x1;const _0x40e820=await withSpinner(_0x81a094(0x1fd)+_0x5b3245+_0x81a094(0x1b4),()=>_0x3aa108[_0x81a094(0x1e0)][_0x81a094(0x1ea)](_0x5b3245),{'verbose':_0x48d0e4[_0x81a094(0x1a0)]}),_0x5a981c=_0x40e820[_0x81a094(0x1d5)];_0x48d0e4[_0x81a094(0x1a0)]&&console[_0x81a094(0x18a)]('Resolved\x20parent\x20ID:\x20'+_0x5a981c);const _0x490fa2=await withSpinner('Resolving\x20folder\x20\x27'+_0xbba440+_0x81a094(0x1b4),()=>_0x3aa108[_0x81a094(0x1e0)][_0x81a094(0x175)](_0x5a981c,_0xbba440),{'verbose':_0x48d0e4[_0x81a094(0x1a0)]}),_0x233f40=_0x490fa2[_0x81a094(0x1d5)];_0x48d0e4[_0x81a094(0x1a0)]&&console[_0x81a094(0x18a)](_0x81a094(0x188)+_0x233f40);const _0x50d62e=await withSpinner(_0x81a094(0x20d)+_0xbba440+'\x27...',()=>_0x3aa108['segment'][_0x81a094(0x194)](_0x233f40),{'verbose':_0x48d0e4[_0x81a094(0x1a0)]});return await handleSDKOutput([_0x50d62e[_0x81a094(0x1d5)]],_0x48d0e4),0x0;}catch(_0xee914e){if(_0xee914e instanceof SDKError)return console[_0x81a094(0x18a)]('Error:\x20'+_0xee914e[_0x81a094(0x184)]),_0xee914e['cause']&&console['error'](_0x81a094(0x1c0)+_0xee914e['cause']),0x1;throw _0xee914e;}}}export class SegmentSQLCommand extends BaseCommand{['name']=a37_0x4f2df1(0x201);[a37_0x4f2df1(0x196)]=a37_0x4f2df1(0x205);async['execute'](_0x423d2a){const _0x9de21c=a37_0x4f2df1,{options:_0x425e3e,args:_0x7ad115}=_0x423d2a,_0x4423bb=_0x425e3e,_0x417614=_0x4423bb[_0x9de21c(0x1f4)],_0x3d78bb=_0x7ad115[0x0];if(!_0x3d78bb&&!_0x417614)return console['error'](a37_0xa4eb77[_0x9de21c(0x186)](_0x9de21c(0x19b))),console[_0x9de21c(0x18a)](_0x9de21c(0x1d8)),console['error'](_0x9de21c(0x1e4)),console[_0x9de21c(0x18a)](_0x9de21c(0x17f)),console[_0x9de21c(0x18a)]('Examples:'),console[_0x9de21c(0x18a)](_0x9de21c(0x1e7)),console['error'](_0x9de21c(0x19c)),0x1;if(_0x3d78bb&&_0x417614)return console[_0x9de21c(0x18a)](a37_0xa4eb77[_0x9de21c(0x186)](_0x9de21c(0x1b1))),0x1;try{let _0x46663f;if(_0x417614)_0x46663f=await this['getSQLFromYamlFile'](_0x417614,_0x423d2a);else{if(isYamlFilePath(_0x3d78bb))return console[_0x9de21c(0x18a)](a37_0xa4eb77[_0x9de21c(0x186)](_0x9de21c(0x170))),console['error'](_0x9de21c(0x173)+_0x3d78bb),0x1;else _0x46663f=await this[_0x9de21c(0x18e)](_0x3d78bb,_0x423d2a);}return _0x425e3e[_0x9de21c(0x1c5)]===_0x9de21c(0x195)||_0x425e3e[_0x9de21c(0x1c5)]==='jsonl'?await handleSDKOutput([{'sql':_0x46663f}],_0x425e3e):console[_0x9de21c(0x1e1)](_0x46663f),0x0;}catch(_0x3d4c1a){if(_0x3d4c1a instanceof SDKError)return console['error'](_0x9de21c(0x18c)+_0x3d4c1a['message']),_0x3d4c1a[_0x9de21c(0x1e3)]&&console[_0x9de21c(0x18a)]('\x20\x20Cause:\x20'+_0x3d4c1a[_0x9de21c(0x1e3)]),0x1;throw _0x3d4c1a;}}async[a37_0x4f2df1(0x1bb)](_0x481f68,_0x2afbd0){const _0x4097ad=a37_0x4f2df1,{options:_0x47f305,tdx:_0x5ead89}=_0x2afbd0;let _0x2c66ee;try{_0x2c66ee=await resolveYamlFilePath(_0x481f68);}catch(_0x478488){throw new SDKError(ErrorCode[_0x4097ad(0x202)],_0x4097ad(0x1fe)+_0x478488[_0x4097ad(0x184)]);}_0x47f305[_0x4097ad(0x1a0)]&&console[_0x4097ad(0x18a)](_0x4097ad(0x1d2)+_0x2c66ee[_0x4097ad(0x1ad)]+'/'+_0x2c66ee['segmentName']);const _0x3b63b5=await withSpinner('Fetching\x20SQL\x20from\x20rule...',()=>_0x5ead89[_0x4097ad(0x1e0)][_0x4097ad(0x19d)](_0x2c66ee[_0x4097ad(0x1b2)],_0x2c66ee[_0x4097ad(0x1ad)],_0x2c66ee[_0x4097ad(0x17a)]),{'verbose':_0x47f305['verbose']});return _0x3b63b5[_0x4097ad(0x1d5)];}async['getSQLFromServerSegment'](_0x1db7ea,_0x473292){const _0x47f985=a37_0x4f2df1,{options:_0x3b5c8c,tdx:_0x251eac}=_0x473292,_0x2b57a0=_0x3b5c8c[_0x47f985(0x1ad)],_0x145d20=await resolveSegmentTarget(_0x1db7ea,_0x2b57a0,_0x3b5c8c['verbose']);_0x3b5c8c[_0x47f985(0x1a0)]&&console[_0x47f985(0x18a)](_0x47f985(0x1ae)+_0x145d20);const _0x588b94=await withSpinner(_0x47f985(0x1be)+_0x1db7ea+_0x47f985(0x1b4),()=>_0x251eac[_0x47f985(0x1e0)][_0x47f985(0x1f0)](_0x145d20),{'verbose':_0x3b5c8c[_0x47f985(0x1a0)]}),_0x3343d2=_0x588b94[_0x47f985(0x1d5)];_0x3b5c8c[_0x47f985(0x1a0)]&&(console[_0x47f985(0x18a)]('Resolved\x20type:\x20'+_0x3343d2['type']),console[_0x47f985(0x18a)](_0x47f985(0x20a)+_0x3343d2['parentId']));if(_0x3343d2[_0x47f985(0x190)]==='folder')throw new SDKError(ErrorCode[_0x47f985(0x202)],'Cannot\x20get\x20SQL\x20query\x20for\x20a\x20folder.\x20Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.');if(_0x3343d2['type']===_0x47f985(0x172))throw new SDKError(ErrorCode[_0x47f985(0x202)],'Cannot\x20get\x20SQL\x20for\x20parent\x20segment\x20with\x20this\x20command.\x20Use:\x20tdx\x20ps\x20sql');if(!_0x3343d2['segmentId'])throw new SDKError(ErrorCode[_0x47f985(0x20b)],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x5cd9c0=await withSpinner(_0x47f985(0x19e),()=>_0x251eac[_0x47f985(0x1e0)][_0x47f985(0x208)](_0x3343d2[_0x47f985(0x204)],_0x3343d2[_0x47f985(0x1b5)]),{'verbose':_0x3b5c8c[_0x47f985(0x1a0)]});return _0x5cd9c0[_0x47f985(0x1d5)];}}export class SegmentFolderCreateCommand extends BaseCommand{[a37_0x4f2df1(0x1e6)]='segment:folder:create';[a37_0x4f2df1(0x196)]='Create\x20segment\x20folder\x20for\x20organization';async[a37_0x4f2df1(0x19f)](_0x55bc5e){const _0x46d4da=a37_0x4f2df1,{options:_0x11bc50,args:_0x2946d0,tdx:_0xf4151b}=_0x55bc5e,_0x202993=_0x11bc50;if(_0x2946d0[_0x46d4da(0x17c)]<0x2)return console[_0x46d4da(0x18a)]('Error:\x20Parent\x20segment\x20name\x20and\x20folder\x20name\x20are\x20required'),console['error'](_0x46d4da(0x17e)),0x1;const _0x2b7bc3=_0x2946d0[0x0],_0x5d9661=_0x2946d0[0x1];_0x202993['verbose']&&(console[_0x46d4da(0x18a)](_0x46d4da(0x1ba)+_0x202993[_0x46d4da(0x183)]),console['error']('Parent\x20segment:\x20'+_0x2b7bc3),console['error']('Folder\x20name:\x20'+_0x5d9661));let _0x1273c2;if(_0x202993[_0x46d4da(0x1a8)]){const _0x122613=_0x202993['parentFolder'],_0x3ae5f7=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x2b7bc3+'\x27...',()=>_0xf4151b[_0x46d4da(0x1e0)][_0x46d4da(0x1ea)](_0x2b7bc3),{'verbose':_0x202993[_0x46d4da(0x1a0)]}),_0x3f3c79=_0x3ae5f7[_0x46d4da(0x1d5)],_0x494928=await withSpinner(_0x46d4da(0x1b8)+_0x122613+_0x46d4da(0x1b4),()=>_0xf4151b['segment'][_0x46d4da(0x175)](_0x3f3c79,_0x122613),{'verbose':_0x202993[_0x46d4da(0x1a0)]});_0x1273c2=_0x494928[_0x46d4da(0x1d5)],_0x202993[_0x46d4da(0x1a0)]&&console[_0x46d4da(0x18a)]('Resolved\x20parent\x20folder\x20ID:\x20'+_0x1273c2);}const _0x33383c={'name':_0x5d9661,'description':_0x202993[_0x46d4da(0x196)],'parentFolderId':_0x1273c2},_0x1aa612=await withSpinner(_0x46d4da(0x1f6)+_0x5d9661+'\x27...',()=>_0xf4151b['segment'][_0x46d4da(0x1a7)](_0x2b7bc3,_0x33383c),{'verbose':_0x202993['verbose']}),_0xe299d1=_0x1aa612[_0x46d4da(0x1d5)];return console[_0x46d4da(0x18a)](_0x46d4da(0x17b)+_0xe299d1[_0x46d4da(0x1e6)]+_0x46d4da(0x1cf)+_0xe299d1['id']),await handleSDKOutput([_0xe299d1],_0x202993),0x0;}}export class SegmentViewCommand extends BaseCommand{[a37_0x4f2df1(0x1e6)]=a37_0x4f2df1(0x1b0);[a37_0x4f2df1(0x196)]='Show\x20folder\x20or\x20child\x20segment\x20details';async[a37_0x4f2df1(0x19f)](_0x4ead96){const _0x42d10d=a37_0x4f2df1,{options:_0x547fc0,args:_0x2c1d6d,tdx:_0x34d1e4}=_0x4ead96,_0xe725e=_0x2c1d6d[0x0];if(!_0xe725e)return console[_0x42d10d(0x18a)](_0x42d10d(0x16d)),console[_0x42d10d(0x18a)](_0x42d10d(0x1cc)),console[_0x42d10d(0x18a)](_0x42d10d(0x182)),console['error'](_0x42d10d(0x20c)),console[_0x42d10d(0x18a)](_0x42d10d(0x1f5)),console[_0x42d10d(0x18a)](_0x42d10d(0x1e2)),console[_0x42d10d(0x18a)]('\x20\x20tdx\x20sg\x20view\x20\x22Marketing\x22\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20folder\x20details'),console[_0x42d10d(0x18a)]('\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20\x20\x20\x20\x20#\x20View\x20child\x20segment\x20details'),console[_0x42d10d(0x18a)](_0x42d10d(0x1dd)),console['error'](_0x42d10d(0x20e)),0x1;try{const _0x3d83f1=_0x547fc0[_0x42d10d(0x1ad)],_0x10b551=await resolveSegmentTarget(_0xe725e,_0x3d83f1,_0x547fc0['verbose']);_0x547fc0['verbose']&&console[_0x42d10d(0x18a)](_0x42d10d(0x1ae)+_0x10b551);const _0x350822=await withSpinner('Resolving\x20\x27'+_0xe725e+_0x42d10d(0x1b4),()=>_0x34d1e4[_0x42d10d(0x1e0)][_0x42d10d(0x1f0)](_0x10b551),{'verbose':_0x547fc0['verbose']}),_0x19515d=_0x350822[_0x42d10d(0x1d5)];_0x547fc0[_0x42d10d(0x1a0)]&&(console[_0x42d10d(0x18a)](_0x42d10d(0x1af)+_0x19515d[_0x42d10d(0x190)]),console[_0x42d10d(0x18a)]('Parent\x20ID:\x20'+_0x19515d['parentId']),_0x19515d[_0x42d10d(0x1a6)]&&console['error'](_0x42d10d(0x1db)+_0x19515d[_0x42d10d(0x1a6)]),_0x19515d[_0x42d10d(0x1b5)]&&console[_0x42d10d(0x18a)](_0x42d10d(0x1da)+_0x19515d['segmentId']));if(_0x547fc0[_0x42d10d(0x177)]){if(_0x19515d[_0x42d10d(0x190)]===_0x42d10d(0x1d1))return console[_0x42d10d(0x18a)](_0x42d10d(0x1fa)),0x1;if(_0x19515d[_0x42d10d(0x190)]===_0x42d10d(0x172))return console[_0x42d10d(0x18a)](_0x42d10d(0x206)),console[_0x42d10d(0x18a)](_0x42d10d(0x1ec)),0x1;if(!_0x19515d[_0x42d10d(0x1b5)])throw new SDKError(ErrorCode[_0x42d10d(0x20b)],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x17fa79=getConsoleNextUrl(_0x547fc0[_0x42d10d(0x183)],'/app/ps/'+_0x19515d[_0x42d10d(0x204)]+_0x42d10d(0x1ef)+_0x19515d[_0x42d10d(0x1b5)]);return console[_0x42d10d(0x18a)](a37_0xa4eb77[_0x42d10d(0x1f9)]('✔')+_0x42d10d(0x189)+a37_0xa4eb77[_0x42d10d(0x1c4)](_0x17fa79)),openBrowser(_0x17fa79),0x0;}if(_0x19515d[_0x42d10d(0x190)]==='folder'){if(!_0x19515d[_0x42d10d(0x1a6)])throw new SDKError(ErrorCode[_0x42d10d(0x187)],_0x42d10d(0x1a1));const _0x3e0c56=await withSpinner('Fetching\x20folder\x20details...',()=>_0x34d1e4[_0x42d10d(0x1e0)][_0x42d10d(0x194)](_0x19515d[_0x42d10d(0x1a6)]),{'verbose':_0x547fc0['verbose']});await handleSingleObjectOutput(_0x3e0c56[_0x42d10d(0x1d5)],_0x547fc0);}else{if(_0x19515d[_0x42d10d(0x190)]===_0x42d10d(0x1e0)){if(!_0x19515d['segmentId'])throw new SDKError(ErrorCode[_0x42d10d(0x20b)],_0x42d10d(0x1c1));const _0x2bea59=await withSpinner(_0x42d10d(0x1fb),()=>_0x34d1e4[_0x42d10d(0x1e0)][_0x42d10d(0x171)](_0x19515d[_0x42d10d(0x204)],_0x19515d[_0x42d10d(0x1b5)]),{'verbose':_0x547fc0[_0x42d10d(0x1a0)]}),_0x24ae3c=getConsoleNextUrl(_0x547fc0[_0x42d10d(0x183)],'/app/ps/'+_0x19515d['parentId']+'/e/'+_0x19515d['segmentId']),_0x3417f4=_0x2bea59['data'];_0x3417f4['url']=_0x24ae3c,await handleSingleObjectOutput(_0x3417f4,_0x547fc0);}else return console[_0x42d10d(0x18a)]('Error:\x20Cannot\x20view\x20parent\x20segment\x20details\x20with\x20this\x20command.'),console[_0x42d10d(0x18a)](_0x42d10d(0x174)),0x1;}return 0x0;}catch(_0x4e4051){if(_0x4e4051 instanceof SDKError)return console['error']('Error:\x20'+_0x4e4051[_0x42d10d(0x184)]),_0x4e4051[_0x42d10d(0x1e3)]&&console[_0x42d10d(0x18a)](_0x42d10d(0x1c0)+_0x4e4051[_0x42d10d(0x1e3)]),0x1;throw _0x4e4051;}}}export const SegmentInfoCommand=SegmentViewCommand;function a37_0x4823(_0xc5bd6a,_0x331435){_0xc5bd6a=_0xc5bd6a-0x168;const _0x2ad661=a37_0x2ad6();let _0x4823e0=_0x2ad661[_0xc5bd6a];return _0x4823e0;}export class SegmentDescCommand extends BaseCommand{['name']=a37_0x4f2df1(0x1ff);[a37_0x4f2df1(0x196)]='Show\x20child\x20segment\x20schema\x20(column\x20types)';async['execute'](_0x56ac9e){const _0x1e632f=a37_0x4f2df1,{options:_0x35003b,args:_0x1406b8,tdx:_0xa901b5}=_0x56ac9e,_0x276917=_0x1406b8[0x0];if(!_0x276917)return console[_0x1e632f(0x18a)](_0x1e632f(0x1f1)),console[_0x1e632f(0x18a)](_0x1e632f(0x178)),console[_0x1e632f(0x18a)](_0x1e632f(0x1ed)),console['error']('Examples:'),console[_0x1e632f(0x18a)]('\x20\x20tdx\x20sg\x20desc\x20\x22Premium\x20Users\x22'),console[_0x1e632f(0x18a)]('\x20\x20tdx\x20sg\x20desc\x20segments/my-audience/premium-users.yml'),0x1;try{const _0x42640b=_0x35003b[_0x1e632f(0x1ad)],_0x37ede9=await resolveSegmentTarget(_0x276917,_0x42640b,_0x35003b[_0x1e632f(0x1a0)]);_0x35003b[_0x1e632f(0x1a0)]&&console[_0x1e632f(0x18a)](_0x1e632f(0x1ae)+_0x37ede9);const _0x4573f1=await withSpinner('Resolving\x20\x27'+_0x276917+_0x1e632f(0x1b4),()=>_0xa901b5['segment']['resolvePathToResource'](_0x37ede9),{'verbose':_0x35003b['verbose']}),_0x477874=_0x4573f1['data'];_0x35003b[_0x1e632f(0x1a0)]&&(console[_0x1e632f(0x18a)]('Resolved\x20type:\x20'+_0x477874[_0x1e632f(0x190)]),console[_0x1e632f(0x18a)](_0x1e632f(0x20a)+_0x477874['parentId']));if(_0x477874[_0x1e632f(0x190)]===_0x1e632f(0x1d1))return console[_0x1e632f(0x18a)](_0x1e632f(0x16e)),console[_0x1e632f(0x18a)](_0x1e632f(0x1f2)),0x1;if(_0x477874[_0x1e632f(0x190)]===_0x1e632f(0x172))return console[_0x1e632f(0x18a)](_0x1e632f(0x1df)),console['error'](_0x1e632f(0x1bd)),0x1;if(!_0x477874[_0x1e632f(0x1b5)])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x1e632f(0x1c1));const _0x369820=await withSpinner(_0x1e632f(0x19e),()=>_0xa901b5[_0x1e632f(0x1e0)][_0x1e632f(0x208)](_0x477874[_0x1e632f(0x204)],_0x477874[_0x1e632f(0x1b5)]),{'verbose':_0x35003b[_0x1e632f(0x1a0)]}),_0x28b670=_0x369820[_0x1e632f(0x1d5)],_0x43867f=await executeSchemaQuery(_0x28b670,_0xa901b5,_0x35003b);return await handleQueryOutput(_0x43867f,_0x35003b),0x0;}catch(_0x6346fe){if(_0x6346fe instanceof SDKError)return console[_0x1e632f(0x18a)](_0x1e632f(0x18c)+_0x6346fe['message']),_0x6346fe['cause']&&console[_0x1e632f(0x18a)](_0x1e632f(0x1c0)+_0x6346fe[_0x1e632f(0x1e3)]),0x1;throw _0x6346fe;}}}
@@ -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_0x1e0cab=a38_0x48aa;(function(_0x5bbb2f,_0x4a3379){const _0x226382=a38_0x48aa,_0xa15ff7=_0x5bbb2f();while(!![]){try{const _0x4db757=-parseInt(_0x226382(0x1f5))/0x1+-parseInt(_0x226382(0x1ff))/0x2*(parseInt(_0x226382(0x1f1))/0x3)+parseInt(_0x226382(0x1d9))/0x4*(parseInt(_0x226382(0x1dc))/0x5)+-parseInt(_0x226382(0x1e4))/0x6+-parseInt(_0x226382(0x1e0))/0x7+parseInt(_0x226382(0x208))/0x8+parseInt(_0x226382(0x1e2))/0x9;if(_0x4db757===_0x4a3379)break;else _0xa15ff7['push'](_0xa15ff7['shift']());}catch(_0x4b8c14){_0xa15ff7['push'](_0xa15ff7['shift']());}}}(a38_0x1a2e,0x920ce));function a38_0x1a2e(){const _0x3ecafe=['site','data','resolveFolderId','rule','segments','length','\x20\x20Use\x20`tdx\x20sg\x20push`\x20with\x20YAML\x20files\x20instead.\x0a','7287768yDnEti','resolveParentId','Resolved\x20folder\x20ID:\x20','parent','Create\x20child\x20segment\x20with\x20filtering\x20rules','ruleFile','folderId','72uqZuTY','Usage:\x20tdx\x20segment\x20create\x20<path>\x20[options]','✔\x20Created\x20segment\x20\x27','46295WnNUOV','description','error','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/High\x20Value\x22\x20--rule\x20\x27...\x27','2562231Mueiew','createSegment','10961640byJeNi','Target\x20path:\x20','410676HekkVv','yellow','Usage:\x20tdx\x20segment\x20create\x20<parent/segment_name>\x20[options]','\x20\x20tdx\x20segment\x20create\x20\x22Premium\x22\x20--rule\x20\x27...\x27\x20\x20#\x20Relative\x20to\x20context','type','Resolving\x20parent\x20segment\x20\x27','segment','Error:\x20Segment\x20path\x20or\x20name\x20is\x20required','folder','kind','name','Site:\x20','Parent:\x20','1862526PlumaL','Resolving\x20folder\x20path\x20\x27','verbose','Resolved\x20relative\x20path\x20to:\x20','642050IVnjuP','\x20\x20\x20Path:\x20','includes','Error:\x20Full\x20path\x20required\x20(parent/segment_name\x20or\x20parent/folder/segment_name)','\x27\x20with\x20ID:\x20','Examples:','segment:create','resolvePathToResource','\x27...','segmentPath','2QDKldC','Resolving\x20folder\x20\x27'];a38_0x1a2e=function(){return _0x3ecafe;};return a38_0x1a2e();}import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../core/command-output.js';function a38_0x48aa(_0x55a7f0,_0x3b4a42){_0x55a7f0=_0x55a7f0-0x1d4;const _0x1a2e19=a38_0x1a2e();let _0x48aab7=_0x1a2e19[_0x55a7f0];return _0x48aab7;}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_0x4a82ce from'chalk';export class SegmentCreateCommand extends BaseCommand{[a38_0x1e0cab(0x1ee)]=a38_0x1e0cab(0x1fb);['description']=a38_0x1e0cab(0x1d6);async['execute'](_0x3b2878){const _0x5a31c3=a38_0x1e0cab;console['error'](a38_0x4a82ce['yellow']('⚠\x20Deprecation\x20warning:\x20`segment\x20create`\x20is\x20deprecated.')),console[_0x5a31c3(0x1de)](a38_0x4a82ce[_0x5a31c3(0x1e5)](_0x5a31c3(0x207)));const {options:_0x55c4da,args:_0x56f36f,tdx:_0x38ee11}=_0x3b2878,_0x292144=_0x55c4da;if(_0x56f36f[_0x5a31c3(0x206)]===0x0)return console[_0x5a31c3(0x1de)](_0x5a31c3(0x1eb)),console[_0x5a31c3(0x1de)](_0x5a31c3(0x1da)),console['error'](_0x5a31c3(0x1fa)),console['error'](_0x5a31c3(0x1df)),console[_0x5a31c3(0x1de)]('\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/Marketing/Premium\x22\x20--rule\x20\x27...\x27'),console[_0x5a31c3(0x1de)](_0x5a31c3(0x1e7)),0x1;const _0x7f3b3f=_0x56f36f[0x0],_0x3b29d3=_0x55c4da[_0x5a31c3(0x1fe)];let _0x203772=_0x7f3b3f;_0x3b29d3&&!_0x7f3b3f[_0x5a31c3(0x1f7)]('/')&&(_0x203772=_0x3b29d3+'/'+_0x7f3b3f,_0x292144[_0x5a31c3(0x1f3)]&&console[_0x5a31c3(0x1de)](_0x5a31c3(0x1f4)+_0x203772));const _0x401a3a=parsePath(_0x203772);if(_0x401a3a[_0x5a31c3(0x205)]['length']<0x2)return console[_0x5a31c3(0x1de)](_0x5a31c3(0x1f8)),console['error'](_0x5a31c3(0x1e6)),0x1;const _0x3c3dd8=_0x401a3a['segments'][0x0],_0x4bc71c=getBaseName(_0x203772),_0x5282a7=getParentPath(_0x203772);_0x292144[_0x5a31c3(0x1f3)]&&(console[_0x5a31c3(0x1de)](_0x5a31c3(0x1ef)+_0x292144[_0x5a31c3(0x201)]),console[_0x5a31c3(0x1de)](_0x5a31c3(0x1e3)+_0x203772),console[_0x5a31c3(0x1de)](_0x5a31c3(0x1f0)+_0x3c3dd8),console[_0x5a31c3(0x1de)]('Segment\x20name:\x20'+_0x4bc71c),console[_0x5a31c3(0x1de)]('Parent\x20path:\x20'+_0x5282a7));const _0x1e0d60=await withSpinner(_0x5a31c3(0x1e9)+_0x3c3dd8+'\x27...',()=>_0x38ee11[_0x5a31c3(0x1ea)][_0x5a31c3(0x209)](_0x3c3dd8),{'verbose':_0x292144[_0x5a31c3(0x1f3)]}),_0x1972f5=_0x1e0d60[_0x5a31c3(0x202)];let _0xdb3271;if(_0x401a3a[_0x5a31c3(0x205)]['length']>0x2){const _0x532c63=await withSpinner(_0x5a31c3(0x1f2)+_0x5282a7+_0x5a31c3(0x1fd),()=>_0x38ee11['segment'][_0x5a31c3(0x1fc)](_0x5282a7),{'verbose':_0x292144[_0x5a31c3(0x1f3)]}),_0x54e5ce=_0x532c63[_0x5a31c3(0x202)];if(_0x54e5ce[_0x5a31c3(0x1e8)]!==_0x5a31c3(0x1ec)&&_0x54e5ce[_0x5a31c3(0x1e8)]!==_0x5a31c3(0x1d5))return console[_0x5a31c3(0x1de)]('Error:\x20Cannot\x20create\x20segment\x20in\x20a\x20segment.\x20Parent\x20path\x20must\x20be\x20a\x20folder\x20or\x20parent.'),0x1;_0xdb3271=_0x54e5ce[_0x5a31c3(0x1d8)];}else{if(_0x292144[_0x5a31c3(0x1ec)]){const _0x20dbec=await withSpinner(_0x5a31c3(0x200)+_0x292144[_0x5a31c3(0x1ec)]+'\x27...',()=>_0x38ee11[_0x5a31c3(0x1ea)][_0x5a31c3(0x203)](_0x1972f5,_0x292144[_0x5a31c3(0x1ec)]),{'verbose':_0x292144['verbose']});_0xdb3271=_0x20dbec['data'];}}_0x292144[_0x5a31c3(0x1f3)]&&_0xdb3271&&console['error'](_0x5a31c3(0x1d4)+_0xdb3271);const _0x4d4dfb=await loadJSONFromOptions(_0x292144[_0x5a31c3(0x204)],_0x292144[_0x5a31c3(0x1d7)]),_0x9da581={'name':_0x4bc71c,'description':_0x292144[_0x5a31c3(0x1dd)],'rule':_0x4d4dfb,'kind':_0x292144[_0x5a31c3(0x1ed)]!==undefined?parseInt(_0x292144[_0x5a31c3(0x1ed)],0xa):undefined,'isVisible':_0x292144['invisible']?![]:undefined,'segmentFolderId':_0xdb3271,'countPopulation':_0x292144['noCountPopulation']?![]:undefined},_0x3c7fad=await withSpinner('Creating\x20segment\x20\x27'+_0x4bc71c+_0x5a31c3(0x1fd),()=>_0x38ee11[_0x5a31c3(0x1ea)][_0x5a31c3(0x1e1)](_0x1972f5,_0x9da581),{'verbose':_0x292144[_0x5a31c3(0x1f3)]}),_0x2bcae4=_0x3c7fad[_0x5a31c3(0x202)];return console['error'](_0x5a31c3(0x1db)+_0x2bcae4[_0x5a31c3(0x1ee)]+_0x5a31c3(0x1f9)+_0x2bcae4['id']),_0x203772!==_0x7f3b3f&&console[_0x5a31c3(0x1de)](_0x5a31c3(0x1f6)+_0x203772),await handleSDKOutput([_0x2bcae4],_0x292144),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_0x4d410e=a39_0x488a;(function(_0x20d210,_0x52d56e){const _0x217dfc=a39_0x488a,_0x359986=_0x20d210();while(!![]){try{const _0x597382=parseInt(_0x217dfc(0x14d))/0x1*(-parseInt(_0x217dfc(0x143))/0x2)+parseInt(_0x217dfc(0x145))/0x3*(parseInt(_0x217dfc(0x153))/0x4)+-parseInt(_0x217dfc(0x13b))/0x5*(parseInt(_0x217dfc(0x13c))/0x6)+parseInt(_0x217dfc(0x152))/0x7*(parseInt(_0x217dfc(0x142))/0x8)+parseInt(_0x217dfc(0x149))/0x9*(parseInt(_0x217dfc(0x147))/0xa)+parseInt(_0x217dfc(0x13e))/0xb*(parseInt(_0x217dfc(0x146))/0xc)+-parseInt(_0x217dfc(0x139))/0xd;if(_0x597382===_0x52d56e)break;else _0x359986['push'](_0x359986['shift']());}catch(_0xfed254){_0x359986['push'](_0x359986['shift']());}}}(a39_0x1c17,0xa03e2));import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';function a39_0x1c17(){const _0x553f91=['\x20field','error','14388335SPcwob','length','4297370plfYgp','6AGZSmS','listFields','735900QLyYXF','segment:fields','site','description','5094808JdPuuA','319726InXQlb','✔\x20Found\x20','6AXyshu','204GodtNn','10kpgJSs','Usage:\x20tdx\x20segment\x20fields\x20<parent_name>','10910871rGloCS','parentSegment','jsonl','json','8CseJzn','execute','data','Listing\x20fields\x20for\x20\x27','segment','14goEqAb','556412qrwDYo','List\x20available\x20fields\x20for\x20segmentation','Parent\x20segment:\x20','Error:\x20Parent\x20segment\x20name\x20is\x20required'];a39_0x1c17=function(){return _0x553f91;};return a39_0x1c17();}import{displayFieldsHumanReadable}from'../sdk/segment/fields-display.js';function a39_0x488a(_0x126101,_0x5f3e2b){_0x126101=_0x126101-0x137;const _0x1c17b6=a39_0x1c17();let _0x488a29=_0x1c17b6[_0x126101];return _0x488a29;}export class SegmentFieldsCommand extends BaseCommand{['name']=a39_0x4d410e(0x13f);[a39_0x4d410e(0x141)]=a39_0x4d410e(0x154);async[a39_0x4d410e(0x14e)](_0x3fdacd){const _0x3998eb=a39_0x4d410e,{options:_0x27d498,args:_0x57b1f1,tdx:_0xa5c578}=_0x3fdacd,_0x5c770b=_0x57b1f1[0x0]||_0x27d498[_0x3998eb(0x14a)];if(!_0x5c770b)return console[_0x3998eb(0x138)](_0x3998eb(0x156)),console['error'](_0x3998eb(0x148)),console['error']('\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>'),0x1;_0x27d498['verbose']&&(console[_0x3998eb(0x138)]('Site:\x20'+_0x27d498[_0x3998eb(0x140)]),console[_0x3998eb(0x138)](_0x3998eb(0x155)+_0x5c770b));const _0x3d66c7=await withSpinner(_0x3998eb(0x150)+_0x5c770b+'\x27...',()=>_0xa5c578[_0x3998eb(0x151)][_0x3998eb(0x13d)](_0x5c770b),{'verbose':_0x27d498['verbose']}),_0x1f2190=_0x3d66c7[_0x3998eb(0x14f)];console['error'](_0x3998eb(0x144)+_0x1f2190[_0x3998eb(0x13a)]+_0x3998eb(0x137)+(_0x1f2190[_0x3998eb(0x13a)]!==0x1?'s':''));if(_0x27d498[_0x3998eb(0x14c)]||_0x27d498[_0x3998eb(0x14b)])return await handleSDKOutput(_0x1f2190,_0x27d498),0x0;return displayFieldsHumanReadable(_0x1f2190,_0x5c770b),0x0;}}