@treasuredata/tdx 2026.7.4 → 2026.7.6

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 (267) hide show
  1. package/dist/bin.js +1 -1
  2. package/dist/build-info.json +3 -3
  3. package/dist/cli-categories.js +1 -1
  4. package/dist/cli.js +1 -1
  5. package/dist/commands/activations.js +1 -1
  6. package/dist/commands/agent-command.js +1 -1
  7. package/dist/commands/agent-test-command.js +1 -1
  8. package/dist/commands/api-command.js +1 -1
  9. package/dist/commands/auth-command.js +1 -1
  10. package/dist/commands/cas-command.d.ts.map +1 -1
  11. package/dist/commands/cas-command.js +1 -1
  12. package/dist/commands/cas-command.js.map +1 -1
  13. package/dist/commands/cas-segment-command.js +1 -1
  14. package/dist/commands/chat-command.js +1 -1
  15. package/dist/commands/claude-command.js +1 -1
  16. package/dist/commands/claude-statusline-command.js +1 -1
  17. package/dist/commands/claude-usage-command.js +1 -1
  18. package/dist/commands/command.js +1 -1
  19. package/dist/commands/connection-command.js +1 -1
  20. package/dist/commands/databases.js +1 -1
  21. package/dist/commands/delivery-command.js +1 -1
  22. package/dist/commands/describe.js +1 -1
  23. package/dist/commands/engage-campaign-pull-command.js +1 -1
  24. package/dist/commands/engage-campaign-push-command.js +1 -1
  25. package/dist/commands/engage-campaign-validate-command.js +1 -1
  26. package/dist/commands/engage-command.js +1 -1
  27. package/dist/commands/engage-template-pull-command.js +1 -1
  28. package/dist/commands/engage-template-push-command.js +1 -1
  29. package/dist/commands/engage-template-validate-command.js +1 -1
  30. package/dist/commands/job-command.js +1 -1
  31. package/dist/commands/journey-command.js +1 -1
  32. package/dist/commands/journey-validate-command.js +1 -1
  33. package/dist/commands/llm-command.js +1 -1
  34. package/dist/commands/mcp-command.js +1 -1
  35. package/dist/commands/parent-segment-command.js +1 -1
  36. package/dist/commands/policy-command.js +1 -1
  37. package/dist/commands/profile-command.js +1 -1
  38. package/dist/commands/profiles-command.js +1 -1
  39. package/dist/commands/query-command.js +1 -1
  40. package/dist/commands/schedule-command.js +1 -1
  41. package/dist/commands/segment-command.js +1 -1
  42. package/dist/commands/segment-create-command.js +1 -1
  43. package/dist/commands/segment-fields-command.js +1 -1
  44. package/dist/commands/segment-move-command.js +1 -1
  45. package/dist/commands/segment-pull-command.js +1 -1
  46. package/dist/commands/segment-push-command.js +1 -1
  47. package/dist/commands/segment-update-command.js +1 -1
  48. package/dist/commands/segment-use-command.js +1 -1
  49. package/dist/commands/segment-validate-command.js +1 -1
  50. package/dist/commands/segments.js +1 -1
  51. package/dist/commands/show.js +1 -1
  52. package/dist/commands/status-command.js +1 -1
  53. package/dist/commands/table-deleted.js +1 -1
  54. package/dist/commands/tables.js +1 -1
  55. package/dist/commands/unset-command.js +1 -1
  56. package/dist/commands/upgrade-command.js +1 -1
  57. package/dist/commands/use-command.js +1 -1
  58. package/dist/commands/user-command.js +1 -1
  59. package/dist/commands/work-command.js +1 -1
  60. package/dist/commands/workflow-command.js +1 -1
  61. package/dist/core/auth.js +1 -1
  62. package/dist/core/command-output.js +1 -1
  63. package/dist/core/config.js +1 -1
  64. package/dist/core/connection-cache.js +1 -1
  65. package/dist/core/constants.js +1 -1
  66. package/dist/core/credential-cache.js +1 -1
  67. package/dist/core/global-context.js +1 -1
  68. package/dist/core/keychain.js +1 -1
  69. package/dist/core/oauth-keychain.js +1 -1
  70. package/dist/core/oauth.js +1 -1
  71. package/dist/core/profile.js +1 -1
  72. package/dist/core/project-config.js +1 -1
  73. package/dist/core/session.js +1 -1
  74. package/dist/core/user-cache.js +1 -1
  75. package/dist/core/version.js +1 -1
  76. package/dist/index.js +1 -1
  77. package/dist/mcp/server.js +1 -1
  78. package/dist/mcp/tools/index.js +1 -1
  79. package/dist/mcp/tools/tdx-run.js +1 -1
  80. package/dist/mcp/tools/tdx-search.js +1 -1
  81. package/dist/mcp/tools/work-create-item.js +1 -1
  82. package/dist/mcp/utils.js +1 -1
  83. package/dist/proxy/claude-usage-tracker.js +1 -1
  84. package/dist/proxy/passthrough-server.js +1 -1
  85. package/dist/proxy/sse-usage-parser.js +1 -1
  86. package/dist/sdk/agent/agent-config.js +1 -1
  87. package/dist/sdk/agent/agent-ref-parser.js +1 -1
  88. package/dist/sdk/agent/agent-yaml.js +1 -1
  89. package/dist/sdk/agent/test/evaluator.js +1 -1
  90. package/dist/sdk/agent/test/executor.js +1 -1
  91. package/dist/sdk/agent/test/index.js +1 -1
  92. package/dist/sdk/agent/test/output.js +1 -1
  93. package/dist/sdk/agent/test/parser.js +1 -1
  94. package/dist/sdk/agent/tool-target-registry.js +1 -1
  95. package/dist/sdk/api.js +1 -1
  96. package/dist/sdk/cas/cas-api-client.js +1 -1
  97. package/dist/sdk/cas/cas-audience-schema.d.ts +15 -3
  98. package/dist/sdk/cas/cas-audience-schema.d.ts.map +1 -1
  99. package/dist/sdk/cas/cas-audience-schema.js +1 -1
  100. package/dist/sdk/cas/cas-audience-schema.js.map +1 -1
  101. package/dist/sdk/cas/cas-audience-validator.js +1 -1
  102. package/dist/sdk/cas/cas-audience-validator.js.map +1 -1
  103. package/dist/sdk/cas/cas-audience-yaml.d.ts +8 -0
  104. package/dist/sdk/cas/cas-audience-yaml.d.ts.map +1 -1
  105. package/dist/sdk/cas/cas-audience-yaml.js +1 -1
  106. package/dist/sdk/cas/cas-audience-yaml.js.map +1 -1
  107. package/dist/sdk/cas/cas-segment-yaml.js +1 -1
  108. package/dist/sdk/cas/index.js +1 -1
  109. package/dist/sdk/cas/pull-workflow.js +1 -1
  110. package/dist/sdk/cas/push-workflow.d.ts +47 -1
  111. package/dist/sdk/cas/push-workflow.d.ts.map +1 -1
  112. package/dist/sdk/cas/push-workflow.js +1 -1
  113. package/dist/sdk/cas/push-workflow.js.map +1 -1
  114. package/dist/sdk/cas/validate-files.js +1 -1
  115. package/dist/sdk/client/cdp-api-client.d.ts +6 -6
  116. package/dist/sdk/client/cdp-api-client.d.ts.map +1 -1
  117. package/dist/sdk/client/cdp-api-client.js +1 -1
  118. package/dist/sdk/client/cdp-api-client.js.map +1 -1
  119. package/dist/sdk/client/delivery-api-client.js +1 -1
  120. package/dist/sdk/client/endpoints.js +1 -1
  121. package/dist/sdk/client/engage-api-client.d.ts +6 -6
  122. package/dist/sdk/client/engage-api-client.js +1 -1
  123. package/dist/sdk/client/engage-api-client.js.map +1 -1
  124. package/dist/sdk/client/http-client.js +1 -1
  125. package/dist/sdk/client/llm-api-client.js +1 -1
  126. package/dist/sdk/client/oauth-refresh.js +1 -1
  127. package/dist/sdk/client/rate-limiter.js +1 -1
  128. package/dist/sdk/client/td-api-client.js +1 -1
  129. package/dist/sdk/client/trino-api-client.js +1 -1
  130. package/dist/sdk/client/workflow-client.js +1 -1
  131. package/dist/sdk/connection-validator.js +1 -1
  132. package/dist/sdk/connection.js +1 -1
  133. package/dist/sdk/delivery.js +1 -1
  134. package/dist/sdk/engage/campaign-pull.js +1 -1
  135. package/dist/sdk/engage/campaign-push.js +1 -1
  136. package/dist/sdk/engage/campaign-validator.js +1 -1
  137. package/dist/sdk/engage/campaign-yaml.js +1 -1
  138. package/dist/sdk/engage/template-pull.js +1 -1
  139. package/dist/sdk/engage/template-push.js +1 -1
  140. package/dist/sdk/engage/template-validator.js +1 -1
  141. package/dist/sdk/engage/template-yaml.js +1 -1
  142. package/dist/sdk/engage/types/campaign-def.js +1 -1
  143. package/dist/sdk/engage/types/campaign-schema.js +1 -1
  144. package/dist/sdk/engage/types/template-schema.js +1 -1
  145. package/dist/sdk/engage.js +1 -1
  146. package/dist/sdk/errors.js +1 -1
  147. package/dist/sdk/index.js +1 -1
  148. package/dist/sdk/io/index.js +1 -1
  149. package/dist/sdk/io/node-filesystem.js +1 -1
  150. package/dist/sdk/job.js +1 -1
  151. package/dist/sdk/journey.js +1 -1
  152. package/dist/sdk/llm/chat-cache.js +1 -1
  153. package/dist/sdk/llm/index.js +1 -1
  154. package/dist/sdk/llm/llm-backup-utils.js +1 -1
  155. package/dist/sdk/llm/model-factors.js +1 -1
  156. package/dist/sdk/llm/user-settings.js +1 -1
  157. package/dist/sdk/personalization.js +1 -1
  158. package/dist/sdk/policy.js +1 -1
  159. package/dist/sdk/query/deleted-table-validation.js +1 -1
  160. package/dist/sdk/query/index.js +1 -1
  161. package/dist/sdk/query/sql-parser.js +1 -1
  162. package/dist/sdk/realtime.js +1 -1
  163. package/dist/sdk/schedule.js +1 -1
  164. package/dist/sdk/segment/child-segment-yaml.d.ts +0 -8
  165. package/dist/sdk/segment/child-segment-yaml.d.ts.map +1 -1
  166. package/dist/sdk/segment/child-segment-yaml.js +1 -1
  167. package/dist/sdk/segment/child-segment-yaml.js.map +1 -1
  168. package/dist/sdk/segment/fields-display.js +1 -1
  169. package/dist/sdk/segment/file-discovery.js +1 -1
  170. package/dist/sdk/segment/journey-utils.js +1 -1
  171. package/dist/sdk/segment/journey-validator.js +1 -1
  172. package/dist/sdk/segment/journey-yaml.js +1 -1
  173. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  174. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  175. package/dist/sdk/segment/pull-workflow.js +1 -1
  176. package/dist/sdk/segment/push-recovery.js +1 -1
  177. package/dist/sdk/segment/push-workflow.d.ts.map +1 -1
  178. package/dist/sdk/segment/push-workflow.js +1 -1
  179. package/dist/sdk/segment/push-workflow.js.map +1 -1
  180. package/dist/sdk/segment/resolution-context.js +1 -1
  181. package/dist/sdk/segment/segment-path-parser.js +1 -1
  182. package/dist/sdk/segment/segment-ref-parser.js +1 -1
  183. package/dist/sdk/segment/segment-validator.js +1 -1
  184. package/dist/sdk/segment/target-resolution.js +1 -1
  185. package/dist/sdk/segment/tdx-config.js +1 -1
  186. package/dist/sdk/segment/types/activation-schema.d.ts +66 -7
  187. package/dist/sdk/segment/types/activation-schema.d.ts.map +1 -1
  188. package/dist/sdk/segment/types/activation-schema.js +1 -1
  189. package/dist/sdk/segment/types/activation-schema.js.map +1 -1
  190. package/dist/sdk/segment/types/journey-def.js +1 -1
  191. package/dist/sdk/segment/types/journey-schema.js +1 -1
  192. package/dist/sdk/segment/types/segment-def.d.ts +1 -1
  193. package/dist/sdk/segment/types/segment-def.d.ts.map +1 -1
  194. package/dist/sdk/segment/types/segment-def.js +1 -1
  195. package/dist/sdk/segment/types/segment-def.js.map +1 -1
  196. package/dist/sdk/segment/types/segment-schema.d.ts +110 -1
  197. package/dist/sdk/segment/types/segment-schema.d.ts.map +1 -1
  198. package/dist/sdk/segment/types/segment-schema.js +1 -1
  199. package/dist/sdk/segment/types/segment-schema.js.map +1 -1
  200. package/dist/sdk/segment/validate-files.js +1 -1
  201. package/dist/sdk/segment/yaml-validator.js +1 -1
  202. package/dist/sdk/segment.js +1 -1
  203. package/dist/sdk/types/cas.d.ts +5 -0
  204. package/dist/sdk/types/cas.d.ts.map +1 -1
  205. package/dist/sdk/types/cdp.d.ts +7 -3
  206. package/dist/sdk/types/cdp.d.ts.map +1 -1
  207. package/dist/sdk/types/index.js +1 -1
  208. package/dist/sdk/types/progress.js +1 -1
  209. package/dist/sdk/types/workspace.js +1 -1
  210. package/dist/sdk/user.js +1 -1
  211. package/dist/sdk/util/format-detector.js +1 -1
  212. package/dist/sdk/util/formatters.js +1 -1
  213. package/dist/sdk/util/index.js +1 -1
  214. package/dist/sdk/util/paginate.js +1 -1
  215. package/dist/sdk/util/tree-formatter.js +1 -1
  216. package/dist/sdk/util/tree-search.js +1 -1
  217. package/dist/sdk/workflow/archive-validation.js +1 -1
  218. package/dist/sdk/workflow/clone-workflow.js +1 -1
  219. package/dist/sdk/workflow/index.js +1 -1
  220. package/dist/sdk/workflow/pull-workflow.js +1 -1
  221. package/dist/sdk/workflow/push-workflow.js +1 -1
  222. package/dist/sdk/workflow/task-graph.js +1 -1
  223. package/dist/sdk/workflow/tdx-config.js +1 -1
  224. package/dist/sdk/workflow/workflow-utils.js +1 -1
  225. package/dist/sdk/workspace/access-tracker.js +1 -1
  226. package/dist/sdk/workspace/frontmatter.js +1 -1
  227. package/dist/sdk/workspace/git.js +1 -1
  228. package/dist/sdk/workspace/index.js +1 -1
  229. package/dist/sdk/workspace/templates.js +1 -1
  230. package/dist/sdk/workspace/weekly.js +1 -1
  231. package/dist/sdk/workspace/wikilinks.js +1 -1
  232. package/dist/test-utils/command-runner.js +1 -1
  233. package/dist/test-utils/factories.js +1 -1
  234. package/dist/test-utils/fixtures.js +1 -1
  235. package/dist/test-utils/http-mock.js +1 -1
  236. package/dist/test-utils/index.js +1 -1
  237. package/dist/utils/async.js +1 -1
  238. package/dist/utils/claude-code-state.js +1 -1
  239. package/dist/utils/colors.js +1 -1
  240. package/dist/utils/diff.js +1 -1
  241. package/dist/utils/file-permissions.js +1 -1
  242. package/dist/utils/file-reader.js +1 -1
  243. package/dist/utils/github-releases.js +1 -1
  244. package/dist/utils/global-cache.js +1 -1
  245. package/dist/utils/json-loader.js +1 -1
  246. package/dist/utils/local-cache.js +1 -1
  247. package/dist/utils/logger/formatters/default-formatter.js +1 -1
  248. package/dist/utils/logger/formatters/index.js +1 -1
  249. package/dist/utils/logger/handlers/console-handler.js +1 -1
  250. package/dist/utils/logger/handlers/file-handler.js +1 -1
  251. package/dist/utils/logger/handlers/index.js +1 -1
  252. package/dist/utils/logger/handlers/null-handler.js +1 -1
  253. package/dist/utils/logger/index.js +1 -1
  254. package/dist/utils/logger/logger.js +1 -1
  255. package/dist/utils/logger/types.js +1 -1
  256. package/dist/utils/option-validation.js +1 -1
  257. package/dist/utils/process.js +1 -1
  258. package/dist/utils/prompt.js +1 -1
  259. package/dist/utils/proxy-fetch.js +1 -1
  260. package/dist/utils/proxy-fetch.js.map +1 -1
  261. package/dist/utils/spinner.js +1 -1
  262. package/dist/utils/sse-parser.js +1 -1
  263. package/dist/utils/string-utils.js +1 -1
  264. package/dist/utils/table-ref-parser.js +1 -1
  265. package/dist/utils/tdx-logger.js +1 -1
  266. package/dist/utils/version-check.js +1 -1
  267. package/package.json +1 -1
@@ -1 +1 @@
1
- function a32_0x1047(){const _0xb0a9ff=['👥\x20Assigned\x20Users','1437540EWhowA','email','📋\x20Assigned\x20Policies','map','\x20\x20No\x20permissions','account_id','\x20polic','verbose','343kIDQpP','36374ADxlZA','args','Usage:\x20tdx\x20policy\x20show\x20<policy-name-or-id>','944395DEnbqP','Fetching\x20permissions...','Show\x20current\x20user\x20policies\x20and\x20effective\x20permissions','52zxZTWX','\x20\x20\x20','error',',\x20user_id:','getMyPermissions','ies','Show\x20a\x20specific\x20policy\x20details\x20and\x20permissions\x20(admin\x20only)','log','No\x20policies\x20found','Account\x20Owner','max','\x20assigned','operation','\x20user','length','List\x20all\x20policies\x20in\x20the\x20account\x20(admin\x20only)','join','\x20\x20•\x20','context','permissions','getPolicyUsers','\x20—\x20','165160zvKasw','✔\x20Found\x20','getPolicy','name','dim','16885XvYuZb','getCurrent','1308620oUnswp','72kYfvMh','(ID:\x20','45nwelxQ','description','execute','14988GvKKit','entries','53920tzHPzj','validate','policies','Fetching\x20policy...','all','Administrator','policy','bold','policy\x20list','account_owner'];a32_0x1047=function(){return _0xb0a9ff;};return a32_0x1047();}const a32_0x26123f=a32_0x3f9e;(function(_0xcfa1e0,_0x477a90){const _0x43c3b5=a32_0x3f9e,_0x262179=_0xcfa1e0();while(!![]){try{const _0xe01ba=-parseInt(_0x43c3b5(0x124))/0x1+-parseInt(_0x43c3b5(0x121))/0x2*(parseInt(_0x43c3b5(0x147))/0x3)+parseInt(_0x43c3b5(0x127))/0x4*(parseInt(_0x43c3b5(0x10d))/0x5)+-parseInt(_0x43c3b5(0x118))/0x6+-parseInt(_0x43c3b5(0x120))/0x7*(parseInt(_0x43c3b5(0x13d))/0x8)+-parseInt(_0x43c3b5(0x145))/0x9*(-parseInt(_0x43c3b5(0x144))/0xa)+-parseInt(_0x43c3b5(0x142))/0xb*(-parseInt(_0x43c3b5(0x10b))/0xc);if(_0xe01ba===_0x477a90)break;else _0x262179['push'](_0x262179['shift']());}catch(_0x5d5962){_0x262179['push'](_0x262179['shift']());}}}(a32_0x1047,0x9b404));import{BaseCommand}from'./command.js';function a32_0x3f9e(_0x2ab014,_0x39c46d){_0x2ab014=_0x2ab014-0x10a;const _0x10475d=a32_0x1047();let _0x3f9e06=_0x10475d[_0x2ab014];return _0x3f9e06;}import{handleSDKOutput,handleSingleObjectOutput,isStructuredFormat}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import a32_0x34c114 from'chalk';export class PolicyCommand extends BaseCommand{['name']='policy';[a32_0x26123f(0x148)]=a32_0x26123f(0x126);async[a32_0x26123f(0x10a)](_0x305481){const _0x49b699=a32_0x26123f,{options:_0xa0c808,tdx:_0x1f5006}=_0x305481,_0x5622d1=await withSpinner(_0x49b699(0x125),async()=>{const _0x531548=_0x49b699,[_0x1065a0,_0x10da53]=await Promise[_0x531548(0x111)]([_0x1f5006['user'][_0x531548(0x143)](),_0x1f5006[_0x531548(0x113)][_0x531548(0x12b)]()]);return{'userInfo':_0x1065a0,'permissions':_0x10da53};},{'verbose':_0xa0c808[_0x49b699(0x11f)]}),{userInfo:_0x4f5c2c,permissions:_0x492d9a}=_0x5622d1['data'];if(isStructuredFormat(_0xa0c808))return await handleSingleObjectOutput(_0x492d9a,_0xa0c808),0x0;const _0x3d9a68=_0x4f5c2c[_0x49b699(0x116)]?_0x49b699(0x130):_0x4f5c2c['administrator']?_0x49b699(0x112):'Member';console[_0x49b699(0x12e)]('\x0a'+a32_0x34c114[_0x49b699(0x114)]('👤')+'\x20'+a32_0x34c114[_0x49b699(0x114)](_0x4f5c2c['name'])+'\x20'+a32_0x34c114[_0x49b699(0x141)]('('+_0x4f5c2c[_0x49b699(0x119)]+')')+_0x49b699(0x13c)+_0x3d9a68),console['log'](a32_0x34c114[_0x49b699(0x141)](_0x49b699(0x128)+_0x1f5006[_0x49b699(0x139)]['site']+':'+_0x4f5c2c[_0x49b699(0x11d)]+_0x49b699(0x12a)+_0x4f5c2c['id']));const _0x1d08ad=_0x492d9a[_0x49b699(0x10f)];console[_0x49b699(0x12e)]('\x0a'+a32_0x34c114['bold'](_0x49b699(0x11a))+'\x20('+_0x1d08ad[_0x49b699(0x135)]+'):');if(_0x1d08ad['length']===0x0)console[_0x49b699(0x12e)](a32_0x34c114[_0x49b699(0x141)]('\x20\x20No\x20policies\x20assigned'));else for(const _0x565045 of _0x1d08ad){console[_0x49b699(0x12e)](_0x49b699(0x138)+_0x565045[_0x49b699(0x140)]);}return printPermissionsMap(_0x492d9a[_0x49b699(0x13a)]),console['log'](),0x0;}}export class PolicyListCommand extends BaseCommand{[a32_0x26123f(0x140)]=a32_0x26123f(0x115);[a32_0x26123f(0x148)]=a32_0x26123f(0x136);async[a32_0x26123f(0x10a)](_0x5895a3){const _0x4b6166=a32_0x26123f,{options:_0x6bdda1,tdx:_0x5125b8}=_0x5895a3,_0x50ecd1=await withSpinner('Listing\x20policies...',()=>_0x5125b8[_0x4b6166(0x113)]['listPolicies'](),{'verbose':_0x6bdda1['verbose']}),_0x5afa93=_0x50ecd1['data'];console[_0x4b6166(0x129)](_0x4b6166(0x13e)+_0x5afa93[_0x4b6166(0x135)]+_0x4b6166(0x11e)+(_0x5afa93[_0x4b6166(0x135)]!==0x1?_0x4b6166(0x12c):'y'));if(isStructuredFormat(_0x6bdda1))return await handleSDKOutput(_0x5afa93,_0x6bdda1),0x0;if(_0x5afa93[_0x4b6166(0x135)]===0x0)console[_0x4b6166(0x12e)](a32_0x34c114['dim'](_0x4b6166(0x12f)));else for(const _0x48f04c of _0x5afa93){const _0x1a6e62=_0x48f04c[_0x4b6166(0x148)]?a32_0x34c114[_0x4b6166(0x141)](_0x4b6166(0x13c)+_0x48f04c[_0x4b6166(0x148)]):'';console[_0x4b6166(0x12e)](_0x4b6166(0x138)+_0x48f04c[_0x4b6166(0x140)]+_0x1a6e62);}return 0x0;}}export class PolicyShowCommand extends BaseCommand{[a32_0x26123f(0x140)]='policy\x20show';['description']=a32_0x26123f(0x12d);[a32_0x26123f(0x10e)](_0x1dcfe8){const _0x389f10=a32_0x26123f;if(_0x1dcfe8[_0x389f10(0x122)][_0x389f10(0x135)]===0x0)return _0x389f10(0x123);return undefined;}async[a32_0x26123f(0x10a)](_0x47b556){const _0x172f14=a32_0x26123f,{options:_0x30d452,tdx:_0x57ac54}=_0x47b556,_0x4cd3c4=_0x47b556['args'][0x0],_0x464961=await withSpinner(_0x172f14(0x110),async()=>{const _0x38da34=_0x172f14,_0x81d3ff=await _0x57ac54[_0x38da34(0x113)][_0x38da34(0x13f)](_0x4cd3c4),[_0x3ebd7e,_0x3220df]=await Promise[_0x38da34(0x111)]([_0x57ac54[_0x38da34(0x113)]['getPolicyPermissions'](_0x81d3ff['id']),_0x57ac54[_0x38da34(0x113)][_0x38da34(0x13b)](_0x81d3ff['id'])]);return{'policy':_0x81d3ff,'perms':_0x3ebd7e,'users':_0x3220df};},{'verbose':_0x30d452[_0x172f14(0x11f)]}),{policy:_0x1c9664,perms:_0xc9a606,users:_0x44f1ab}=_0x464961['data'];if(isStructuredFormat(_0x30d452))return await handleSingleObjectOutput({..._0x1c9664,'permissions':_0xc9a606[_0x172f14(0x13a)],'users':_0x44f1ab},_0x30d452),0x0;console[_0x172f14(0x12e)]('\x0a'+a32_0x34c114[_0x172f14(0x114)]('📋')+'\x20'+a32_0x34c114[_0x172f14(0x114)](_0x1c9664[_0x172f14(0x140)])+'\x20'+a32_0x34c114[_0x172f14(0x141)](_0x172f14(0x146)+_0x1c9664['id']+')'));_0x1c9664[_0x172f14(0x148)]&&console['log'](_0x172f14(0x128)+a32_0x34c114[_0x172f14(0x141)](_0x1c9664[_0x172f14(0x148)]));console[_0x172f14(0x12e)](_0x172f14(0x128)+_0x44f1ab[_0x172f14(0x135)]+_0x172f14(0x134)+(_0x44f1ab[_0x172f14(0x135)]!==0x1?'s':'')+_0x172f14(0x132)),printPermissionsMap(_0xc9a606[_0x172f14(0x13a)]);if(_0x44f1ab['length']>0x0){console[_0x172f14(0x12e)]('\x0a'+a32_0x34c114[_0x172f14(0x114)](_0x172f14(0x117))+':');for(const _0x203c56 of _0x44f1ab){const _0x1bb10f=_0x203c56[_0x172f14(0x119)]&&_0x203c56[_0x172f14(0x119)]!==_0x203c56[_0x172f14(0x140)]?a32_0x34c114[_0x172f14(0x141)]('\x20<'+_0x203c56['email']+'>'):'';console[_0x172f14(0x12e)]('\x20\x20•\x20'+_0x203c56[_0x172f14(0x140)]+_0x1bb10f);}}return console[_0x172f14(0x12e)](),0x0;}}function printPermissionsMap(_0x360443){const _0x55df3a=a32_0x26123f,_0x512934=Object[_0x55df3a(0x10c)](_0x360443);console[_0x55df3a(0x12e)]('\x0a'+a32_0x34c114['bold']('🔑\x20Effective\x20Permissions')+':');if(_0x512934[_0x55df3a(0x135)]===0x0){console[_0x55df3a(0x12e)](a32_0x34c114[_0x55df3a(0x141)](_0x55df3a(0x11c)));return;}const _0x346849=Math[_0x55df3a(0x131)](..._0x512934[_0x55df3a(0x11b)](([_0x15d9fe])=>_0x15d9fe[_0x55df3a(0x135)]));for(const [_0x2b5a10,_0x2f4d3f]of _0x512934){const _0x3feec9=formatOperations(_0x2f4d3f);console[_0x55df3a(0x12e)]('\x20\x20'+_0x2b5a10['padEnd'](_0x346849+0x2)+_0x3feec9);}}function formatOperations(_0xb10d06){const _0x280330=a32_0x26123f,_0x3e2c39=[...new Set(_0xb10d06[_0x280330(0x11b)](_0x73a65b=>_0x73a65b[_0x280330(0x133)]))];return _0x3e2c39[_0x280330(0x137)](',\x20');}
1
+ const a32_0x5e022c=a32_0x7754;(function(_0x24257f,_0x20e8ce){const _0x40a384=a32_0x7754,_0x549d50=_0x24257f();while(!![]){try{const _0xec7765=-parseInt(_0x40a384(0x1f0))/0x1+-parseInt(_0x40a384(0x20e))/0x2+parseInt(_0x40a384(0x216))/0x3+-parseInt(_0x40a384(0x212))/0x4+parseInt(_0x40a384(0x208))/0x5+parseInt(_0x40a384(0x203))/0x6+parseInt(_0x40a384(0x200))/0x7;if(_0xec7765===_0x20e8ce)break;else _0x549d50['push'](_0x549d50['shift']());}catch(_0x20673f){_0x549d50['push'](_0x549d50['shift']());}}}(a32_0x80c1,0xa6025));import{BaseCommand}from'./command.js';import{handleSDKOutput,handleSingleObjectOutput,isStructuredFormat}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import a32_0x53bd13 from'chalk';function a32_0x7754(_0x55e058,_0x313936){_0x55e058=_0x55e058-0x1e2;const _0x80c16e=a32_0x80c1();let _0x775475=_0x80c16e[_0x55e058];return _0x775475;}export class PolicyCommand extends BaseCommand{['name']='policy';[a32_0x5e022c(0x211)]=a32_0x5e022c(0x1fa);async[a32_0x5e022c(0x217)](_0x3f4615){const _0x58dc6e=a32_0x5e022c,{options:_0x50681c,tdx:_0xc155a8}=_0x3f4615,_0x39d405=await withSpinner(_0x58dc6e(0x218),async()=>{const _0x4f226d=_0x58dc6e,[_0x76e417,_0x401af4]=await Promise[_0x4f226d(0x213)]([_0xc155a8[_0x4f226d(0x1e2)][_0x4f226d(0x1e5)](),_0xc155a8[_0x4f226d(0x20a)]['getMyPermissions']()]);return{'userInfo':_0x76e417,'permissions':_0x401af4};},{'verbose':_0x50681c['verbose']}),{userInfo:_0x513b3d,permissions:_0xf571ae}=_0x39d405[_0x58dc6e(0x1eb)];if(isStructuredFormat(_0x50681c))return await handleSingleObjectOutput(_0xf571ae,_0x50681c),0x0;const _0x291745=_0x513b3d[_0x58dc6e(0x209)]?_0x58dc6e(0x20c):_0x513b3d['administrator']?_0x58dc6e(0x1e7):_0x58dc6e(0x1ff);console['log']('\x0a'+a32_0x53bd13['bold']('👤')+'\x20'+a32_0x53bd13['bold'](_0x513b3d['name'])+'\x20'+a32_0x53bd13[_0x58dc6e(0x201)]('('+_0x513b3d[_0x58dc6e(0x1ea)]+')')+_0x58dc6e(0x1f3)+_0x291745),console[_0x58dc6e(0x1e9)](a32_0x53bd13[_0x58dc6e(0x201)](_0x58dc6e(0x214)+_0xc155a8[_0x58dc6e(0x1f9)][_0x58dc6e(0x1fb)]+':'+_0x513b3d[_0x58dc6e(0x202)]+_0x58dc6e(0x21b)+_0x513b3d['id']));const _0x5b4563=_0xf571ae[_0x58dc6e(0x21a)];console[_0x58dc6e(0x1e9)]('\x0a'+a32_0x53bd13[_0x58dc6e(0x20d)](_0x58dc6e(0x1e3))+'\x20('+_0x5b4563[_0x58dc6e(0x1f4)]+'):');if(_0x5b4563[_0x58dc6e(0x1f4)]===0x0)console['log'](a32_0x53bd13[_0x58dc6e(0x201)](_0x58dc6e(0x1ec)));else for(const _0x53e7c4 of _0x5b4563){console[_0x58dc6e(0x1e9)](_0x58dc6e(0x1ed)+_0x53e7c4['name']);}return printPermissionsMap(_0xf571ae[_0x58dc6e(0x207)]),console[_0x58dc6e(0x1e9)](),0x0;}}function a32_0x80c1(){const _0x1254d2=['Show\x20current\x20user\x20policies\x20and\x20effective\x20permissions','site','padEnd','No\x20policies\x20found','join','Member','2699536vrOWRb','dim','account_id','6783804yiYMkt','👥\x20Assigned\x20Users','ies','\x20user','permissions','6679370TGampu','account_owner','policy','\x20polic','Account\x20Owner','bold','2099508NFxkzr','map','getPolicyPermissions','description','4238560fnfObm','all','\x20\x20\x20','policy\x20list','2458107DheWuL','execute','Fetching\x20permissions...','verbose','policies',',\x20user_id:','policy\x20show','\x20assigned','getPolicy','name','user','📋\x20Assigned\x20Policies','args','getCurrent','Fetching\x20policy...','Administrator','max','log','email','data','\x20\x20No\x20policies\x20assigned','\x20\x20•\x20','getPolicyUsers','\x20\x20No\x20permissions','882158wAzrni','✔\x20Found\x20','Listing\x20policies...','\x20—\x20','length','🔑\x20Effective\x20Permissions','Show\x20a\x20specific\x20policy\x20details\x20and\x20permissions\x20(admin\x20only)','(ID:\x20','List\x20all\x20policies\x20in\x20the\x20account\x20(admin\x20only)','context'];a32_0x80c1=function(){return _0x1254d2;};return a32_0x80c1();}export class PolicyListCommand extends BaseCommand{['name']=a32_0x5e022c(0x215);[a32_0x5e022c(0x211)]=a32_0x5e022c(0x1f8);async['execute'](_0x293cd2){const _0x3af6d1=a32_0x5e022c,{options:_0x1588e8,tdx:_0x1abf6b}=_0x293cd2,_0x498118=await withSpinner(_0x3af6d1(0x1f2),()=>_0x1abf6b['policy']['listPolicies'](),{'verbose':_0x1588e8['verbose']}),_0x421b48=_0x498118[_0x3af6d1(0x1eb)];console['error'](_0x3af6d1(0x1f1)+_0x421b48['length']+_0x3af6d1(0x20b)+(_0x421b48[_0x3af6d1(0x1f4)]!==0x1?_0x3af6d1(0x205):'y'));if(isStructuredFormat(_0x1588e8))return await handleSDKOutput(_0x421b48,_0x1588e8),0x0;if(_0x421b48['length']===0x0)console['log'](a32_0x53bd13[_0x3af6d1(0x201)](_0x3af6d1(0x1fd)));else for(const _0x2139ca of _0x421b48){const _0x300625=_0x2139ca['description']?a32_0x53bd13[_0x3af6d1(0x201)](_0x3af6d1(0x1f3)+_0x2139ca[_0x3af6d1(0x211)]):'';console[_0x3af6d1(0x1e9)](_0x3af6d1(0x1ed)+_0x2139ca[_0x3af6d1(0x21f)]+_0x300625);}return 0x0;}}export class PolicyShowCommand extends BaseCommand{[a32_0x5e022c(0x21f)]=a32_0x5e022c(0x21c);[a32_0x5e022c(0x211)]=a32_0x5e022c(0x1f6);['validate'](_0x1b60f0){const _0x454f2d=a32_0x5e022c;if(_0x1b60f0[_0x454f2d(0x1e4)][_0x454f2d(0x1f4)]===0x0)return'Usage:\x20tdx\x20policy\x20show\x20<policy-name-or-id>';return undefined;}async[a32_0x5e022c(0x217)](_0x55ce4e){const _0x296476=a32_0x5e022c,{options:_0x2b08b5,tdx:_0xb08ddc}=_0x55ce4e,_0x361b68=_0x55ce4e['args'][0x0],_0xa3b672=await withSpinner(_0x296476(0x1e6),async()=>{const _0x34573c=_0x296476,_0x4951da=await _0xb08ddc[_0x34573c(0x20a)][_0x34573c(0x21e)](_0x361b68),[_0xaf3d7c,_0x3f942d]=await Promise['all']([_0xb08ddc['policy'][_0x34573c(0x210)](_0x4951da['id']),_0xb08ddc['policy'][_0x34573c(0x1ee)](_0x4951da['id'])]);return{'policy':_0x4951da,'perms':_0xaf3d7c,'users':_0x3f942d};},{'verbose':_0x2b08b5[_0x296476(0x219)]}),{policy:_0x5c5bc4,perms:_0x481fa7,users:_0x46df63}=_0xa3b672[_0x296476(0x1eb)];if(isStructuredFormat(_0x2b08b5))return await handleSingleObjectOutput({..._0x5c5bc4,'permissions':_0x481fa7[_0x296476(0x207)],'users':_0x46df63},_0x2b08b5),0x0;console[_0x296476(0x1e9)]('\x0a'+a32_0x53bd13[_0x296476(0x20d)]('📋')+'\x20'+a32_0x53bd13['bold'](_0x5c5bc4[_0x296476(0x21f)])+'\x20'+a32_0x53bd13['dim'](_0x296476(0x1f7)+_0x5c5bc4['id']+')'));_0x5c5bc4[_0x296476(0x211)]&&console[_0x296476(0x1e9)](_0x296476(0x214)+a32_0x53bd13['dim'](_0x5c5bc4[_0x296476(0x211)]));console[_0x296476(0x1e9)](_0x296476(0x214)+_0x46df63[_0x296476(0x1f4)]+_0x296476(0x206)+(_0x46df63[_0x296476(0x1f4)]!==0x1?'s':'')+_0x296476(0x21d)),printPermissionsMap(_0x481fa7[_0x296476(0x207)]);if(_0x46df63['length']>0x0){console['log']('\x0a'+a32_0x53bd13['bold'](_0x296476(0x204))+':');for(const _0x58deae of _0x46df63){const _0x519040=_0x58deae[_0x296476(0x1ea)]&&_0x58deae[_0x296476(0x1ea)]!==_0x58deae['name']?a32_0x53bd13[_0x296476(0x201)]('\x20<'+_0x58deae[_0x296476(0x1ea)]+'>'):'';console[_0x296476(0x1e9)](_0x296476(0x1ed)+_0x58deae[_0x296476(0x21f)]+_0x519040);}}return console[_0x296476(0x1e9)](),0x0;}}function printPermissionsMap(_0xbf07c6){const _0x3109cb=a32_0x5e022c,_0x23b715=Object['entries'](_0xbf07c6);console[_0x3109cb(0x1e9)]('\x0a'+a32_0x53bd13[_0x3109cb(0x20d)](_0x3109cb(0x1f5))+':');if(_0x23b715[_0x3109cb(0x1f4)]===0x0){console[_0x3109cb(0x1e9)](a32_0x53bd13['dim'](_0x3109cb(0x1ef)));return;}const _0x4fff48=Math[_0x3109cb(0x1e8)](..._0x23b715[_0x3109cb(0x20f)](([_0x5490eb])=>_0x5490eb[_0x3109cb(0x1f4)]));for(const [_0x3ddd9b,_0x27d7f7]of _0x23b715){const _0x23e6d8=formatOperations(_0x27d7f7);console[_0x3109cb(0x1e9)]('\x20\x20'+_0x3ddd9b[_0x3109cb(0x1fc)](_0x4fff48+0x2)+_0x23e6d8);}}function formatOperations(_0x450587){const _0x34b9f5=a32_0x5e022c,_0x16c472=[...new Set(_0x450587[_0x34b9f5(0x20f)](_0x3a66f3=>_0x3a66f3['operation']))];return _0x16c472[_0x34b9f5(0x1fe)](',\x20');}
@@ -1 +1 @@
1
- const a33_0x48d0e6=a33_0x1e4b;(function(_0x24def9,_0x521ef0){const _0x45e1d8=a33_0x1e4b,_0x1c8d75=_0x24def9();while(!![]){try{const _0x60b086=parseInt(_0x45e1d8(0x17a))/0x1*(parseInt(_0x45e1d8(0x18f))/0x2)+parseInt(_0x45e1d8(0x18a))/0x3+parseInt(_0x45e1d8(0x179))/0x4*(-parseInt(_0x45e1d8(0x1c7))/0x5)+parseInt(_0x45e1d8(0x176))/0x6+parseInt(_0x45e1d8(0x182))/0x7+-parseInt(_0x45e1d8(0x1cc))/0x8+-parseInt(_0x45e1d8(0x1b6))/0x9*(parseInt(_0x45e1d8(0x1c1))/0xa);if(_0x60b086===_0x521ef0)break;else _0x1c8d75['push'](_0x1c8d75['shift']());}catch(_0x55c2f2){_0x1c8d75['push'](_0x1c8d75['shift']());}}}(a33_0x210c,0x32e93));import{BaseCommand,printAuthError}from'./command.js';function a33_0x1e4b(_0x2fb3ff,_0x424649){_0x2fb3ff=_0x2fb3ff-0x172;const _0x210ce7=a33_0x210c();let _0x1e4b26=_0x210ce7[_0x2fb3ff];return _0x1e4b26;}import{listProfiles,profileExists,saveProfileToUserConfig,removeProfileFromUserConfig,loadProfile,getActiveProfile,saveActiveProfileToUserConfig}from'../core/profile.js';import{getConfigDir}from'../core/config.js';import*as a33_0xa1cb98 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_0x16805b from'prompts';import a33_0x545c76 from'chalk';function validateProfileName(_0x2b1425,_0x31def9){const _0x5023ce=a33_0x1e4b;if(!_0x2b1425||!_0x2b1425[_0x5023ce(0x187)]())return _0x5023ce(0x17f);const _0x4c3470=_0x2b1425[_0x5023ce(0x187)]();if(!/^[a-zA-Z0-9_-]+$/[_0x5023ce(0x1ce)](_0x4c3470))return'Profile\x20name\x20must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore';if(!_0x31def9?.['skipExistsCheck']&&profileExists(_0x4c3470))return _0x5023ce(0x1a5)+_0x4c3470+'\x27\x20already\x20exists.\x20Use\x20\x27tdx\x20profile\x20delete\x20'+_0x4c3470+_0x5023ce(0x19a);return!![];}async function deleteProfileAndCredentials(_0x2e65ea){removeProfileFromUserConfig(_0x2e65ea);const _0x3b0598=await isKeychainAvailable();_0x3b0598&&await Promise['all']([deleteKeychainAPIKey(_0x2e65ea),deleteOAuthTokens(_0x2e65ea)]);}export class ProfileCreateCommand extends BaseCommand{[a33_0x48d0e6(0x1d0)]=a33_0x48d0e6(0x190);[a33_0x48d0e6(0x1be)]=a33_0x48d0e6(0x196);async['execute'](_0x2a374b){const _0x456ba4=a33_0x48d0e6,{options:_0x2354fe,args:_0x1f9c1d}=_0x2a374b,_0x3b1dac=!!_0x2354fe[_0x456ba4(0x175)];console[_0x456ba4(0x17e)](a33_0x545c76['bold'](_0x456ba4(0x1c5)));let _0x3ac9ab;if(_0x1f9c1d['length']>0x0&&_0x1f9c1d[0x0]){const _0x2fb078=_0x1f9c1d[0x0][_0x456ba4(0x187)]();_0x3b1dac&&profileExists(_0x2fb078)&&(await deleteProfileAndCredentials(_0x2fb078),console[_0x456ba4(0x17e)]('Removed\x20existing\x20profile\x20\x27'+_0x2fb078+'\x27'));const _0x1d37d0=validateProfileName(_0x2fb078);if(_0x1d37d0!==!![])return console[_0x456ba4(0x1ca)](a33_0x545c76[_0x456ba4(0x1dc)](_0x1d37d0)),0x1;_0x3ac9ab=_0x2fb078;}else{const _0x370133=await a33_0x16805b({'type':'text','name':'profileName','message':_0x456ba4(0x192),'validate':_0x2e049e=>validateProfileName(_0x2e049e,{'skipExistsCheck':_0x3b1dac})});if(!_0x370133['profileName'])return console['log'](_0x456ba4(0x1b2)),0x1;_0x3ac9ab=_0x370133['profileName']['trim'](),_0x3b1dac&&profileExists(_0x3ac9ab)&&(await deleteProfileAndCredentials(_0x3ac9ab),console['log']('Removed\x20existing\x20profile\x20\x27'+_0x3ac9ab+'\x27'));}const _0x38b298=await a33_0x16805b({'type':_0x456ba4(0x1c2),'name':'description','message':_0x456ba4(0x1ba)}),_0x3c6c2a=_0x38b298[_0x456ba4(0x1be)]?.['trim']()||undefined,_0x396584=_0x2354fe['site']||_0x456ba4(0x19f),_0x519e2e=await promptSiteSelection(_0x396584,_0x3ac9ab,_0x456ba4(0x1bf));if(!_0x519e2e)return 0x1;const _0x41372a=resolveSite(_0x519e2e),_0x4d3f1b=await promptAuthMethod();if(!_0x4d3f1b)return console[_0x456ba4(0x17e)]('\x0aSetup\x20cancelled'),0x1;if(_0x4d3f1b===_0x456ba4(0x1bd)){if(_0x3c6c2a){const _0x534c3c={'site':_0x41372a,'description':_0x3c6c2a};saveProfileToUserConfig(_0x3ac9ab,_0x534c3c);}const {accountName:_0x5db882}=_0x2354fe;return await runOAuthLoginFlow(_0x41372a,_0x3ac9ab,_0x2354fe['logLevel']??LogLevel[_0x456ba4(0x1aa)],{'accountName':_0x5db882}),0x0;}console['log']('\x0aSetting\x20up\x20authentication\x20for\x20site:\x20'+_0x41372a),console[_0x456ba4(0x17e)]('You\x20can\x20find\x20your\x20API\x20key\x20at:'),console[_0x456ba4(0x17e)]('\x20\x20'+getConsoleUrl(_0x41372a,_0x456ba4(0x1b0)));const _0x29719c=await a33_0x16805b({'type':_0x456ba4(0x1bc),'name':_0x456ba4(0x184),'message':_0x456ba4(0x1ae),'validate':_0x74b7b2=>{const _0x468e91=_0x456ba4;if(!_0x74b7b2||!_0x74b7b2[_0x468e91(0x187)]())return _0x468e91(0x1d7);return!![];}});if(!_0x29719c[_0x456ba4(0x184)])return console[_0x456ba4(0x17e)](_0x456ba4(0x1b2)),0x1;const _0x5b4f8e=_0x29719c[_0x456ba4(0x184)];console[_0x456ba4(0x17e)](_0x456ba4(0x181));try{const _0x463911=TDX['create']({'site':_0x41372a,'apiKey':_0x5b4f8e['trim'](),'logLevel':_0x2354fe['logLevel']??LogLevel[_0x456ba4(0x1aa)]}),_0x4e540d=await _0x463911[_0x456ba4(0x1af)][_0x456ba4(0x19b)]();console[_0x456ba4(0x17e)](a33_0x545c76[_0x456ba4(0x1d5)]('✓')+_0x456ba4(0x1a3)+_0x4e540d[_0x456ba4(0x1d8)]+')');const _0x31c5bd=await isKeychainAvailable();_0x31c5bd?(await saveAPIKeyAsync(_0x5b4f8e[_0x456ba4(0x187)](),_0x41372a,_0x3ac9ab),console[_0x456ba4(0x17e)](a33_0x545c76[_0x456ba4(0x1d5)]('✓')+_0x456ba4(0x1a4)+_0x3ac9ab+')')):(console[_0x456ba4(0x1ac)](a33_0x545c76[_0x456ba4(0x191)]('⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.')),console[_0x456ba4(0x1ac)](a33_0x545c76[_0x456ba4(0x191)](_0x456ba4(0x1a2))));const _0x1ca917={'site':_0x41372a,..._0x3c6c2a&&{'description':_0x3c6c2a}};return saveProfileToUserConfig(_0x3ac9ab,_0x1ca917),console[_0x456ba4(0x17e)](a33_0x545c76[_0x456ba4(0x1d5)]('✓')+_0x456ba4(0x1c3)+_0x3ac9ab+_0x456ba4(0x1a1)),console[_0x456ba4(0x17e)](),console['log']('You\x20can\x20now\x20use\x20tdx\x20commands\x20with\x20this\x20profile.\x20Try:'),console[_0x456ba4(0x17e)](_0x456ba4(0x19c)+_0x3ac9ab+_0x456ba4(0x198)),console[_0x456ba4(0x17e)](_0x456ba4(0x19c)+_0x3ac9ab+_0x456ba4(0x174)),0x0;}catch(_0x4e88e1){if(_0x4e88e1 instanceof HTTPClientError&&_0x4e88e1[_0x456ba4(0x18e)]===0x191)return printAuthError(_0x4e88e1),0x1;return console[_0x456ba4(0x1ca)](a33_0x545c76[_0x456ba4(0x1dc)]('✗\x20Validation\x20failed:\x20'+(_0x4e88e1 instanceof Error?_0x4e88e1[_0x456ba4(0x180)]:String(_0x4e88e1)))),console[_0x456ba4(0x1ca)]('Profile\x20was\x20not\x20created.\x20Please\x20try\x20again.'),0x1;}}}export class ProfileDeleteCommand extends BaseCommand{[a33_0x48d0e6(0x1d0)]='profile:delete';[a33_0x48d0e6(0x1be)]=a33_0x48d0e6(0x1cb);['validate'](_0x215d3d){const _0x3b32b9=a33_0x48d0e6,{args:_0x5ce95b}=_0x215d3d;if(_0x5ce95b[_0x3b32b9(0x1ab)]===0x0)return'Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20delete\x20<name>';return undefined;}async[a33_0x48d0e6(0x19e)](_0x1559d7){const _0xe17e26=a33_0x48d0e6,{args:_0x2231b8}=_0x1559d7,_0x56ea06=_0x2231b8[0x0];console[_0xe17e26(0x17e)](a33_0x545c76[_0xe17e26(0x18c)](_0xe17e26(0x1c0)));if(!profileExists(_0x56ea06)){console[_0xe17e26(0x1ca)](a33_0x545c76['red'](_0xe17e26(0x1a5)+_0x56ea06+_0xe17e26(0x1d9))),console[_0xe17e26(0x17e)]('\x0aAvailable\x20profiles:');const _0x4c1824=listProfiles();if(_0x4c1824[_0xe17e26(0x1ab)]===0x0)console[_0xe17e26(0x17e)](_0xe17e26(0x195));else for(const _0x48d9b1 of _0x4c1824){console[_0xe17e26(0x17e)](_0xe17e26(0x1d6)+_0x48d9b1[_0xe17e26(0x1d0)]);}return 0x1;}const _0x345d4a=await a33_0x16805b({'type':_0xe17e26(0x173),'name':'confirm','message':_0xe17e26(0x1b4)+_0x56ea06+'\x27?','initial':![]});if(!_0x345d4a['confirm'])return console[_0xe17e26(0x17e)]('Removal\x20cancelled'),0x0;try{await deleteProfileAndCredentials(_0x56ea06),console[_0xe17e26(0x17e)](a33_0x545c76['green']('✓')+_0xe17e26(0x1c3)+_0x56ea06+_0xe17e26(0x1a0));}catch(_0x1013b1){return console[_0xe17e26(0x1ca)](a33_0x545c76[_0xe17e26(0x1dc)](_0xe17e26(0x199)+(_0x1013b1 instanceof Error?_0x1013b1[_0xe17e26(0x180)]:String(_0x1013b1)))),0x1;}return 0x0;}}export class ProfileSetCommand extends BaseCommand{[a33_0x48d0e6(0x1d0)]='profile:set';['description']=a33_0x48d0e6(0x1c8);static [a33_0x48d0e6(0x1b5)]=[a33_0x48d0e6(0x17b),a33_0x48d0e6(0x1a7),a33_0x48d0e6(0x1cd),a33_0x48d0e6(0x172),'llm_agent',a33_0x48d0e6(0x1be)];[a33_0x48d0e6(0x1b8)](_0x30bf72){const _0x55b9ff=a33_0x48d0e6,{args:_0x38b89f,options:_0x27e103}=_0x30bf72,_0x39a3a4=_0x27e103[_0x55b9ff(0x1cf)]||getActiveProfile();if(!_0x39a3a4)return _0x55b9ff(0x178);if(_0x38b89f[_0x55b9ff(0x1ab)]===0x0)return _0x55b9ff(0x1da)+ProfileSetCommand[_0x55b9ff(0x1b5)]['join'](',\x20');const _0x33b973=_0x38b89f[0x0];if(!_0x33b973[_0x55b9ff(0x1c6)]('='))return _0x55b9ff(0x19d)+ProfileSetCommand[_0x55b9ff(0x1b5)][_0x55b9ff(0x1b7)](',\x20');const [_0x4a5872]=_0x33b973['split']('=',0x2);if(!ProfileSetCommand['VALID_KEYS'][_0x55b9ff(0x1c6)](_0x4a5872))return _0x55b9ff(0x1d2)+_0x4a5872+_0x55b9ff(0x1b1)+ProfileSetCommand['VALID_KEYS'][_0x55b9ff(0x1b7)](',\x20');return undefined;}async[a33_0x48d0e6(0x19e)](_0x2de06d){const _0x38171c=a33_0x48d0e6,{args:_0x5abd81,options:_0x2fd504}=_0x2de06d,_0xc8a703=_0x2fd504[_0x38171c(0x1cf)]||getActiveProfile(),[_0x575e64,..._0x253163]=_0x5abd81[0x0][_0x38171c(0x1a8)]('='),_0x53ad96=_0x253163[_0x38171c(0x1b7)]('=');console[_0x38171c(0x17e)](a33_0x545c76[_0x38171c(0x18c)](_0x38171c(0x189)));if(!profileExists(_0xc8a703)){const _0x2c77d3=await a33_0x16805b({'type':_0x38171c(0x173),'name':_0x38171c(0x1a9),'message':_0x38171c(0x1a5)+_0xc8a703+'\x27\x20does\x20not\x20exist.\x20Create\x20it?','initial':!![]});if(!_0x2c77d3[_0x38171c(0x1a9)])return console[_0x38171c(0x17e)](_0x38171c(0x185)),0x1;}const _0x26b209=loadProfile(_0xc8a703),_0x3d924e=_0x26b209?.[_0x38171c(0x1ad)]||{};if(_0x575e64===_0x38171c(0x17b)){const _0x393eeb=resolveSite(_0x53ad96);console[_0x38171c(0x17e)](_0x38171c(0x1bb)+_0x393eeb+_0x38171c(0x1d1)),console[_0x38171c(0x17e)](_0x38171c(0x177)),console[_0x38171c(0x17e)]('\x20\x20'+getConsoleUrl(_0x393eeb,_0x38171c(0x1b0)));const _0x29ba6a=await a33_0x16805b({'type':_0x38171c(0x1bc),'name':'apiKey','message':_0x38171c(0x17d),'validate':_0x52e472=>{const _0x2f6eed=_0x38171c;if(!_0x52e472||!_0x52e472[_0x2f6eed(0x187)]())return'API\x20key\x20cannot\x20be\x20empty';return!![];}});if(!_0x29ba6a[_0x38171c(0x184)])return console[_0x38171c(0x17e)](_0x38171c(0x18b)),0x1;console[_0x38171c(0x17e)](_0x38171c(0x181));try{const _0x25b7fa=TDX[_0x38171c(0x1a9)]({'site':_0x393eeb,'apiKey':_0x29ba6a[_0x38171c(0x184)]['trim'](),'logLevel':_0x2fd504['logLevel']??LogLevel[_0x38171c(0x1aa)]}),_0x458a5d=await _0x25b7fa[_0x38171c(0x1af)][_0x38171c(0x19b)]();console[_0x38171c(0x17e)](a33_0x545c76[_0x38171c(0x1d5)]('✓')+_0x38171c(0x1a3)+_0x458a5d['email']+')');const _0x3ea136=await isKeychainAvailable();_0x3ea136?(await saveAPIKeyAsync(_0x29ba6a[_0x38171c(0x184)][_0x38171c(0x187)](),_0x393eeb,_0xc8a703),console[_0x38171c(0x17e)](a33_0x545c76[_0x38171c(0x1d5)]('✓')+'\x20API\x20key\x20saved\x20to\x20system\x20keychain')):console[_0x38171c(0x1ac)](a33_0x545c76['yellow'](_0x38171c(0x188))),_0x3d924e['site']=_0x393eeb;}catch(_0x412916){if(_0x412916 instanceof HTTPClientError&&_0x412916['status']===0x191)return printAuthError(_0x412916),0x1;return console['error'](a33_0x545c76[_0x38171c(0x1dc)](_0x38171c(0x1d4)+(_0x412916 instanceof Error?_0x412916[_0x38171c(0x180)]:String(_0x412916)))),console[_0x38171c(0x1ca)]('Site\x20was\x20not\x20changed.'),0x1;}}else _0x3d924e[_0x575e64]=_0x53ad96||undefined;return saveProfileToUserConfig(_0xc8a703,_0x3d924e),console[_0x38171c(0x17e)](a33_0x545c76[_0x38171c(0x1d5)]('✓')+'\x20Profile\x20\x27'+_0xc8a703+_0x38171c(0x1c9)+_0x575e64+'='+(_0x53ad96||_0x38171c(0x1d3))),0x0;}}function a33_0x210c(){const _0x38591c=['\x20API\x20key\x20is\x20valid\x20(User:\x20','\x20API\x20key\x20saved\x20to\x20system\x20keychain\x20(profile:\x20','Profile\x20\x27','\x0aAvailable\x20profiles:','database','split','create','ERROR','length','warn','config','Enter\x20your\x20TD\x20API\x20key:','jobs','/app/mp/ak','\x27.\x0a\x0aValid\x20keys:\x20','\x0aSetup\x20cancelled','(session:\x20','Are\x20you\x20sure\x20you\x20want\x20to\x20remove\x20profile\x20\x27','VALID_KEYS','18AiaqFw','join','validate','tdx.json','Enter\x20description\x20(optional):','Changing\x20site\x20to\x20\x27','password','oauth','description','Setup\x20cancelled','tdx:\x20profile\x20delete','1186850NLmIPw','text','\x20Profile\x20\x27','\x20--default\x27\x20to\x20save\x20permanently','tdx:\x20profile\x20create','includes','5ScmyIX','Set\x20a\x20profile\x20configuration\x20value','\x27\x20updated:\x20','error','Delete\x20a\x20profile','2821488bMXGJA','parent_segment','test','profile','name','\x27\x20requires\x20API\x20key\x20validation.','Unknown\x20key\x20\x27','(cleared)','✗\x20Validation\x20failed:\x20','green','\x20\x20-\x20','API\x20key\x20cannot\x20be\x20empty','email','\x27\x20does\x20not\x20exist.','Key=value\x20pair\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','default','red','llm_project','confirm','\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases','force','1650096BJtQNy','\x0aYou\x20can\x20find\x20your\x20API\x20key\x20at:','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>','189020wfrjNA','9701WJcCMC','site','\x0aSaved\x20to:\x20','Enter\x20your\x20TD\x20API\x20key\x20for\x20the\x20new\x20site:','log','Profile\x20name\x20cannot\x20be\x20empty','message','Validating\x20API\x20key...','1716225PTqzKN','Default\x20profile\x20set\x20to:\x20','apiKey','Operation\x20cancelled','dim','trim','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','tdx:\x20profile\x20set','860541kJbmzg','\x0aOperation\x20cancelled','bold','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20use\x20<name>\x20[--default]','status','8dLzfiT','profile:create','yellow','Enter\x20profile\x20name:','profile:use','session','\x20\x20(no\x20profiles\x20found)','Create\x20a\x20new\x20profile','\x0aTip:\x20Use\x20\x27tdx\x20profile\x20use\x20','\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication','Failed\x20to\x20delete\x20profile:\x20','\x27\x20to\x20remove\x20it\x20first,\x20or\x20re-create\x20with\x20--force.','getUserInfo','\x20\x20tdx\x20--profile\x20','Invalid\x20format.\x20Use:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','execute','us01','\x27\x20deleted','\x27\x20created','\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.'];a33_0x210c=function(){return _0x38591c;};return a33_0x210c();}export class ProfileUseCommand extends BaseCommand{['name']=a33_0x48d0e6(0x193);[a33_0x48d0e6(0x1be)]='Set\x20session\x20profile';[a33_0x48d0e6(0x1b8)](_0x49830c){const _0x4d40e8=a33_0x48d0e6,{args:_0x2c9f74}=_0x49830c;if(_0x2c9f74['length']===0x0)return _0x4d40e8(0x18d);return undefined;}async[a33_0x48d0e6(0x19e)](_0x297887){const _0x124888=a33_0x48d0e6,{args:_0x304dca,options:_0x38289c}=_0x297887,_0x14ae22=_0x304dca[0x0],_0x31a272=_0x38289c[_0x124888(0x1db)];cleanExpiredSessions();if(!profileExists(_0x14ae22)){console['error'](a33_0x545c76[_0x124888(0x1dc)](_0x124888(0x1a5)+_0x14ae22+'\x27\x20does\x20not\x20exist.')),console[_0x124888(0x17e)](_0x124888(0x1a6));const _0x359077=listProfiles();if(_0x359077[_0x124888(0x1ab)]===0x0)console[_0x124888(0x17e)]('\x20\x20(no\x20profiles\x20found)');else for(const _0x1cd370 of _0x359077){console[_0x124888(0x17e)]('\x20\x20-\x20'+_0x1cd370[_0x124888(0x1d0)]);}return 0x1;}if(_0x31a272){const _0x59a2b5=a33_0xa1cb98[_0x124888(0x1b7)](getConfigDir(),_0x124888(0x1b9));return saveActiveProfileToUserConfig(_0x14ae22),console['log'](_0x124888(0x183)+a33_0x545c76[_0x124888(0x1d5)](_0x14ae22)),console['log'](a33_0x545c76[_0x124888(0x186)](_0x124888(0x17c)+_0x59a2b5)),0x0;}const _0x152834=getSessionID(_0x38289c[_0x124888(0x194)]);return saveSessionContext({'profile':_0x14ae22},_0x38289c['session']),console[_0x124888(0x17e)]('Session\x20profile\x20set\x20to:\x20'+a33_0x545c76['green'](_0x14ae22)+'\x20'+a33_0x545c76[_0x124888(0x186)](_0x124888(0x1b3)+_0x152834+')')),console[_0x124888(0x17e)](a33_0x545c76['dim'](_0x124888(0x197)+_0x14ae22+_0x124888(0x1c4))),0x0;}}
1
+ const a33_0xed00d9=a33_0x38dd;(function(_0x328a23,_0x2f146d){const _0x174a40=a33_0x38dd,_0x10974e=_0x328a23();while(!![]){try{const _0x59de54=-parseInt(_0x174a40(0x1ea))/0x1*(parseInt(_0x174a40(0x1ec))/0x2)+parseInt(_0x174a40(0x21e))/0x3*(parseInt(_0x174a40(0x238))/0x4)+-parseInt(_0x174a40(0x213))/0x5*(-parseInt(_0x174a40(0x20a))/0x6)+parseInt(_0x174a40(0x23f))/0x7+parseInt(_0x174a40(0x1fc))/0x8+-parseInt(_0x174a40(0x1e3))/0x9+parseInt(_0x174a40(0x236))/0xa*(-parseInt(_0x174a40(0x22b))/0xb);if(_0x59de54===_0x2f146d)break;else _0x10974e['push'](_0x10974e['shift']());}catch(_0x2f3133){_0x10974e['push'](_0x10974e['shift']());}}}(a33_0x3075,0xca084));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_0x4a0131 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';function a33_0x38dd(_0x38ea0d,_0x5a17d8){_0x38ea0d=_0x38ea0d-0x1d8;const _0x3075ee=a33_0x3075();let _0x38ddb1=_0x3075ee[_0x38ea0d];return _0x38ddb1;}import{runOAuthLoginFlow,promptAuthMethod}from'./auth-command.js';import{promptSiteSelection}from'../core/constants.js';import{HTTPClientError}from'../sdk/client/http-client.js';function a33_0x3075(){const _0x26c62e=['\x0aYou\x20can\x20find\x20your\x20API\x20key\x20at:','\x0aAvailable\x20profiles:','/app/mp/ak','bold','\x0aSetting\x20up\x20authentication\x20for\x20site:\x20','profile','apiKey','\x27\x20to\x20remove\x20it\x20first,\x20or\x20re-create\x20with\x20--force.','length','10yXOvgx','\x27\x20updated:\x20','3177964mYEnGI','Session\x20profile\x20set\x20to:\x20','execute','green','\x27\x20does\x20not\x20exist.\x20Create\x20it?','profile:set','\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication','4549853AoGUWq','You\x20can\x20now\x20use\x20tdx\x20commands\x20with\x20this\x20profile.\x20Try:','\x20Profile\x20\x27','validate','Enter\x20profile\x20name:','\x0aSaved\x20to:\x20','Delete\x20a\x20profile','\x27\x20already\x20exists.\x20Use\x20\x27tdx\x20profile\x20delete\x20','\x20\x20tdx\x20--profile\x20','config','profileName','database','Profile\x20\x27','ERROR','yellow','tdx:\x20profile\x20delete','Profile\x20was\x20not\x20created.\x20Please\x20try\x20again.','You\x20can\x20find\x20your\x20API\x20key\x20at:','password','✗\x20Validation\x20failed:\x20','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>','Validating\x20API\x20key...','3515400YhRDKW','(cleared)','confirm','session','(session:\x20','Enter\x20description\x20(optional):','\x20API\x20key\x20saved\x20to\x20system\x20keychain','106nzwCCx','profile:delete','25708lIbSle','log','message','\x20\x20-\x20','red','\x20\x20(no\x20profiles\x20found)','Removed\x20existing\x20profile\x20\x27','\x20API\x20key\x20is\x20valid\x20(User:\x20','\x0aTip:\x20Use\x20\x27tdx\x20profile\x20use\x20','default','error','parent_segment','description','Unknown\x20key\x20\x27','Invalid\x20format.\x20Use:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','trim','5867224GGCfRy','\x27.\x0a\x0aValid\x20keys:\x20','warn','email','\x27\x20deleted','includes','llm_project','Profile\x20name\x20must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore','Are\x20you\x20sure\x20you\x20want\x20to\x20remove\x20profile\x20\x27','dim','VALID_KEYS','\x20--default\x27\x20to\x20save\x20permanently','Enter\x20your\x20TD\x20API\x20key:','Operation\x20cancelled','54342DdVSaT','Key=value\x20pair\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','tdx:\x20profile\x20create','split','status','\x27\x20requires\x20API\x20key\x20validation.','us01','API\x20key\x20cannot\x20be\x20empty','all','75JAVJna','logLevel','\x27\x20does\x20not\x20exist.','name','\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases','Set\x20a\x20profile\x20configuration\x20value','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20use\x20<name>\x20[--default]','profile:use','getUserInfo','tdx:\x20profile\x20set','Setup\x20cancelled','6aTaded','site','jobs','\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.','create','Failed\x20to\x20delete\x20profile:\x20','join','Default\x20profile\x20set\x20to:\x20','\x0aOperation\x20cancelled','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','oauth','\x0aSetup\x20cancelled','tdx.json','5803281KISVxg','text'];a33_0x3075=function(){return _0x26c62e;};return a33_0x3075();}import{TDX}from'../sdk/index.js';import{LogLevel}from'../utils/tdx-logger.js';import a33_0x2bac5a from'prompts';import a33_0x323494 from'chalk';function validateProfileName(_0x1bf2f0,_0x92d3ba){const _0x5b05fe=a33_0x38dd;if(!_0x1bf2f0||!_0x1bf2f0[_0x5b05fe(0x1fb)]())return'Profile\x20name\x20cannot\x20be\x20empty';const _0x240f92=_0x1bf2f0[_0x5b05fe(0x1fb)]();if(!/^[a-zA-Z0-9_-]+$/['test'](_0x240f92))return _0x5b05fe(0x203);if(!_0x92d3ba?.['skipExistsCheck']&&profileExists(_0x240f92))return _0x5b05fe(0x1d9)+_0x240f92+_0x5b05fe(0x246)+_0x240f92+_0x5b05fe(0x234);return!![];}async function deleteProfileAndCredentials(_0x11f648){const _0x4265ac=a33_0x38dd;removeProfileFromUserConfig(_0x11f648);const _0xf76018=await isKeychainAvailable();_0xf76018&&await Promise[_0x4265ac(0x212)]([deleteKeychainAPIKey(_0x11f648),deleteOAuthTokens(_0x11f648)]);}export class ProfileCreateCommand extends BaseCommand{['name']='profile:create';[a33_0xed00d9(0x1f8)]='Create\x20a\x20new\x20profile';async[a33_0xed00d9(0x23a)](_0x15d771){const _0x5e6ba2=a33_0xed00d9,{options:_0x5365ad,args:_0x5bad6a}=_0x15d771,_0x4d6662=!!_0x5365ad['force'];console[_0x5e6ba2(0x1ed)](a33_0x323494[_0x5e6ba2(0x230)](_0x5e6ba2(0x20c)));let _0x116354;if(_0x5bad6a['length']>0x0&&_0x5bad6a[0x0]){const _0x5b8bde=_0x5bad6a[0x0]['trim']();_0x4d6662&&profileExists(_0x5b8bde)&&(await deleteProfileAndCredentials(_0x5b8bde),console['log'](_0x5e6ba2(0x1f2)+_0x5b8bde+'\x27'));const _0xaa41a3=validateProfileName(_0x5b8bde);if(_0xaa41a3!==!![])return console['error'](a33_0x323494[_0x5e6ba2(0x1f0)](_0xaa41a3)),0x1;_0x116354=_0x5b8bde;}else{const _0xe7376f=await a33_0x2bac5a({'type':_0x5e6ba2(0x22c),'name':_0x5e6ba2(0x249),'message':_0x5e6ba2(0x243),'validate':_0x503b6c=>validateProfileName(_0x503b6c,{'skipExistsCheck':_0x4d6662})});if(!_0xe7376f[_0x5e6ba2(0x249)])return console[_0x5e6ba2(0x1ed)](_0x5e6ba2(0x229)),0x1;_0x116354=_0xe7376f['profileName']['trim'](),_0x4d6662&&profileExists(_0x116354)&&(await deleteProfileAndCredentials(_0x116354),console[_0x5e6ba2(0x1ed)](_0x5e6ba2(0x1f2)+_0x116354+'\x27'));}const _0x5d7317=await a33_0x2bac5a({'type':'text','name':_0x5e6ba2(0x1f8),'message':_0x5e6ba2(0x1e8)}),_0x200d87=_0x5d7317['description']?.[_0x5e6ba2(0x1fb)]()||undefined,_0x143bec=_0x5365ad['site']||_0x5e6ba2(0x210),_0x16bb42=await promptSiteSelection(_0x143bec,_0x116354,_0x5e6ba2(0x21d));if(!_0x16bb42)return 0x1;const _0x571549=resolveSite(_0x16bb42),_0x2de012=await promptAuthMethod();if(!_0x2de012)return console[_0x5e6ba2(0x1ed)](_0x5e6ba2(0x229)),0x1;if(_0x2de012===_0x5e6ba2(0x228)){if(_0x200d87){const _0xc608d0={'site':_0x571549,'description':_0x200d87};saveProfileToUserConfig(_0x116354,_0xc608d0);}const {accountName:_0x2e0097}=_0x5365ad;return await runOAuthLoginFlow(_0x571549,_0x116354,_0x5365ad[_0x5e6ba2(0x214)]??LogLevel['ERROR'],{'accountName':_0x2e0097}),0x0;}console[_0x5e6ba2(0x1ed)](_0x5e6ba2(0x231)+_0x571549),console[_0x5e6ba2(0x1ed)](_0x5e6ba2(0x1de)),console['log']('\x20\x20'+getConsoleUrl(_0x571549,_0x5e6ba2(0x22f)));const _0x18729f=await a33_0x2bac5a({'type':'password','name':'apiKey','message':_0x5e6ba2(0x208),'validate':_0x265d36=>{const _0x59b093=_0x5e6ba2;if(!_0x265d36||!_0x265d36[_0x59b093(0x1fb)]())return _0x59b093(0x211);return!![];}});if(!_0x18729f[_0x5e6ba2(0x233)])return console[_0x5e6ba2(0x1ed)]('\x0aSetup\x20cancelled'),0x1;const _0xa4bd00=_0x18729f[_0x5e6ba2(0x233)];console['log'](_0x5e6ba2(0x1e2));try{const _0x2af366=TDX[_0x5e6ba2(0x222)]({'site':_0x571549,'apiKey':_0xa4bd00[_0x5e6ba2(0x1fb)](),'logLevel':_0x5365ad['logLevel']??LogLevel[_0x5e6ba2(0x1da)]}),_0xa9ee68=await _0x2af366[_0x5e6ba2(0x220)][_0x5e6ba2(0x21b)]();console[_0x5e6ba2(0x1ed)](a33_0x323494[_0x5e6ba2(0x23b)]('✓')+'\x20API\x20key\x20is\x20valid\x20(User:\x20'+_0xa9ee68[_0x5e6ba2(0x1ff)]+')');const _0x1b8841=await isKeychainAvailable();_0x1b8841?(await saveAPIKeyAsync(_0xa4bd00[_0x5e6ba2(0x1fb)](),_0x571549,_0x116354),console[_0x5e6ba2(0x1ed)](a33_0x323494[_0x5e6ba2(0x23b)]('✓')+'\x20API\x20key\x20saved\x20to\x20system\x20keychain\x20(profile:\x20'+_0x116354+')')):(console[_0x5e6ba2(0x1fe)](a33_0x323494[_0x5e6ba2(0x1db)]('⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.')),console[_0x5e6ba2(0x1fe)](a33_0x323494[_0x5e6ba2(0x1db)](_0x5e6ba2(0x221))));const _0x1aad62={'site':_0x571549,..._0x200d87&&{'description':_0x200d87}};return saveProfileToUserConfig(_0x116354,_0x1aad62),console[_0x5e6ba2(0x1ed)](a33_0x323494['green']('✓')+_0x5e6ba2(0x241)+_0x116354+'\x27\x20created'),console['log'](),console[_0x5e6ba2(0x1ed)](_0x5e6ba2(0x240)),console[_0x5e6ba2(0x1ed)](_0x5e6ba2(0x247)+_0x116354+_0x5e6ba2(0x23e)),console[_0x5e6ba2(0x1ed)](_0x5e6ba2(0x247)+_0x116354+_0x5e6ba2(0x217)),0x0;}catch(_0x1fc27d){if(_0x1fc27d instanceof HTTPClientError&&_0x1fc27d[_0x5e6ba2(0x20e)]===0x191)return printAuthError(_0x1fc27d),0x1;return console['error'](a33_0x323494['red']('✗\x20Validation\x20failed:\x20'+(_0x1fc27d instanceof Error?_0x1fc27d[_0x5e6ba2(0x1ee)]:String(_0x1fc27d)))),console[_0x5e6ba2(0x1f6)](_0x5e6ba2(0x1dd)),0x1;}}}export class ProfileDeleteCommand extends BaseCommand{[a33_0xed00d9(0x216)]=a33_0xed00d9(0x1eb);[a33_0xed00d9(0x1f8)]=a33_0xed00d9(0x245);[a33_0xed00d9(0x242)](_0x16dd87){const {args:_0x401be2}=_0x16dd87;if(_0x401be2['length']===0x0)return'Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20delete\x20<name>';return undefined;}async[a33_0xed00d9(0x23a)](_0x277974){const _0x499f74=a33_0xed00d9,{args:_0x21a2d4}=_0x277974,_0x4b72c6=_0x21a2d4[0x0];console['log'](a33_0x323494[_0x499f74(0x230)](_0x499f74(0x1dc)));if(!profileExists(_0x4b72c6)){console['error'](a33_0x323494[_0x499f74(0x1f0)]('Profile\x20\x27'+_0x4b72c6+_0x499f74(0x215))),console['log'](_0x499f74(0x22e));const _0x3c80b3=listProfiles();if(_0x3c80b3['length']===0x0)console[_0x499f74(0x1ed)](_0x499f74(0x1f1));else for(const _0x3ef5a3 of _0x3c80b3){console[_0x499f74(0x1ed)](_0x499f74(0x1ef)+_0x3ef5a3[_0x499f74(0x216)]);}return 0x1;}const _0x408057=await a33_0x2bac5a({'type':_0x499f74(0x1e5),'name':'confirm','message':_0x499f74(0x204)+_0x4b72c6+'\x27?','initial':![]});if(!_0x408057[_0x499f74(0x1e5)])return console[_0x499f74(0x1ed)]('Removal\x20cancelled'),0x0;try{await deleteProfileAndCredentials(_0x4b72c6),console[_0x499f74(0x1ed)](a33_0x323494[_0x499f74(0x23b)]('✓')+_0x499f74(0x241)+_0x4b72c6+_0x499f74(0x200));}catch(_0x4cf551){return console['error'](a33_0x323494[_0x499f74(0x1f0)](_0x499f74(0x223)+(_0x4cf551 instanceof Error?_0x4cf551[_0x499f74(0x1ee)]:String(_0x4cf551)))),0x1;}return 0x0;}}export class ProfileSetCommand extends BaseCommand{['name']=a33_0xed00d9(0x23d);[a33_0xed00d9(0x1f8)]=a33_0xed00d9(0x218);static [a33_0xed00d9(0x206)]=[a33_0xed00d9(0x21f),a33_0xed00d9(0x1d8),a33_0xed00d9(0x1f7),a33_0xed00d9(0x202),'llm_agent',a33_0xed00d9(0x1f8)];[a33_0xed00d9(0x242)](_0x12c396){const _0x595012=a33_0xed00d9,{args:_0x59e349,options:_0x4dcec8}=_0x12c396,_0x2fd999=_0x4dcec8[_0x595012(0x232)]||getActiveProfile();if(!_0x2fd999)return _0x595012(0x1e1);if(_0x59e349[_0x595012(0x235)]===0x0)return _0x595012(0x20b)+ProfileSetCommand[_0x595012(0x206)][_0x595012(0x224)](',\x20');const _0x16d978=_0x59e349[0x0];if(!_0x16d978['includes']('='))return _0x595012(0x1fa)+ProfileSetCommand['VALID_KEYS'][_0x595012(0x224)](',\x20');const [_0x3520d5]=_0x16d978[_0x595012(0x20d)]('=',0x2);if(!ProfileSetCommand[_0x595012(0x206)][_0x595012(0x201)](_0x3520d5))return _0x595012(0x1f9)+_0x3520d5+_0x595012(0x1fd)+ProfileSetCommand['VALID_KEYS'][_0x595012(0x224)](',\x20');return undefined;}async[a33_0xed00d9(0x23a)](_0xf65f5a){const _0x27a16e=a33_0xed00d9,{args:_0x204056,options:_0x2a9526}=_0xf65f5a,_0x39fcec=_0x2a9526[_0x27a16e(0x232)]||getActiveProfile(),[_0x35294e,..._0x506262]=_0x204056[0x0][_0x27a16e(0x20d)]('='),_0x3e52f8=_0x506262[_0x27a16e(0x224)]('=');console[_0x27a16e(0x1ed)](a33_0x323494['bold'](_0x27a16e(0x21c)));if(!profileExists(_0x39fcec)){const _0x3cb4a2=await a33_0x2bac5a({'type':_0x27a16e(0x1e5),'name':_0x27a16e(0x222),'message':_0x27a16e(0x1d9)+_0x39fcec+_0x27a16e(0x23c),'initial':!![]});if(!_0x3cb4a2[_0x27a16e(0x222)])return console[_0x27a16e(0x1ed)](_0x27a16e(0x209)),0x1;}const _0x411ccb=loadProfile(_0x39fcec),_0x51e9e7=_0x411ccb?.[_0x27a16e(0x248)]||{};if(_0x35294e===_0x27a16e(0x21f)){const _0x26b19d=resolveSite(_0x3e52f8);console['log']('Changing\x20site\x20to\x20\x27'+_0x26b19d+_0x27a16e(0x20f)),console['log'](_0x27a16e(0x22d)),console['log']('\x20\x20'+getConsoleUrl(_0x26b19d,'/app/mp/ak'));const _0x211020=await a33_0x2bac5a({'type':_0x27a16e(0x1df),'name':'apiKey','message':'Enter\x20your\x20TD\x20API\x20key\x20for\x20the\x20new\x20site:','validate':_0x1aac69=>{const _0x58767e=_0x27a16e;if(!_0x1aac69||!_0x1aac69[_0x58767e(0x1fb)]())return _0x58767e(0x211);return!![];}});if(!_0x211020[_0x27a16e(0x233)])return console[_0x27a16e(0x1ed)](_0x27a16e(0x226)),0x1;console['log'](_0x27a16e(0x1e2));try{const _0xe309c1=TDX[_0x27a16e(0x222)]({'site':_0x26b19d,'apiKey':_0x211020[_0x27a16e(0x233)][_0x27a16e(0x1fb)](),'logLevel':_0x2a9526['logLevel']??LogLevel['ERROR']}),_0x11abdb=await _0xe309c1['jobs']['getUserInfo']();console['log'](a33_0x323494[_0x27a16e(0x23b)]('✓')+_0x27a16e(0x1f3)+_0x11abdb[_0x27a16e(0x1ff)]+')');const _0x4083de=await isKeychainAvailable();_0x4083de?(await saveAPIKeyAsync(_0x211020['apiKey'][_0x27a16e(0x1fb)](),_0x26b19d,_0x39fcec),console[_0x27a16e(0x1ed)](a33_0x323494['green']('✓')+_0x27a16e(0x1e9))):console[_0x27a16e(0x1fe)](a33_0x323494['yellow'](_0x27a16e(0x227))),_0x51e9e7['site']=_0x26b19d;}catch(_0x4a10bb){if(_0x4a10bb instanceof HTTPClientError&&_0x4a10bb[_0x27a16e(0x20e)]===0x191)return printAuthError(_0x4a10bb),0x1;return console['error'](a33_0x323494['red'](_0x27a16e(0x1e0)+(_0x4a10bb instanceof Error?_0x4a10bb['message']:String(_0x4a10bb)))),console[_0x27a16e(0x1f6)]('Site\x20was\x20not\x20changed.'),0x1;}}else _0x51e9e7[_0x35294e]=_0x3e52f8||undefined;return saveProfileToUserConfig(_0x39fcec,_0x51e9e7),console[_0x27a16e(0x1ed)](a33_0x323494[_0x27a16e(0x23b)]('✓')+'\x20Profile\x20\x27'+_0x39fcec+_0x27a16e(0x237)+_0x35294e+'='+(_0x3e52f8||_0x27a16e(0x1e4))),0x0;}}export class ProfileUseCommand extends BaseCommand{['name']=a33_0xed00d9(0x21a);[a33_0xed00d9(0x1f8)]='Set\x20session\x20profile';[a33_0xed00d9(0x242)](_0x38fd21){const _0x317e64=a33_0xed00d9,{args:_0x1b577d}=_0x38fd21;if(_0x1b577d[_0x317e64(0x235)]===0x0)return _0x317e64(0x219);return undefined;}async['execute'](_0x12c5ec){const _0x1d4f6b=a33_0xed00d9,{args:_0x59afb7,options:_0x336956}=_0x12c5ec,_0x2802df=_0x59afb7[0x0],_0x543c89=_0x336956[_0x1d4f6b(0x1f5)];cleanExpiredSessions();if(!profileExists(_0x2802df)){console[_0x1d4f6b(0x1f6)](a33_0x323494[_0x1d4f6b(0x1f0)](_0x1d4f6b(0x1d9)+_0x2802df+_0x1d4f6b(0x215))),console[_0x1d4f6b(0x1ed)](_0x1d4f6b(0x22e));const _0x3b02b0=listProfiles();if(_0x3b02b0['length']===0x0)console[_0x1d4f6b(0x1ed)](_0x1d4f6b(0x1f1));else for(const _0x5e9cc4 of _0x3b02b0){console[_0x1d4f6b(0x1ed)]('\x20\x20-\x20'+_0x5e9cc4[_0x1d4f6b(0x216)]);}return 0x1;}if(_0x543c89){const _0x35a06d=a33_0x4a0131[_0x1d4f6b(0x224)](getConfigDir(),_0x1d4f6b(0x22a));return saveActiveProfileToUserConfig(_0x2802df),console['log'](_0x1d4f6b(0x225)+a33_0x323494[_0x1d4f6b(0x23b)](_0x2802df)),console[_0x1d4f6b(0x1ed)](a33_0x323494[_0x1d4f6b(0x205)](_0x1d4f6b(0x244)+_0x35a06d)),0x0;}const _0x1ec6c8=getSessionID(_0x336956[_0x1d4f6b(0x1e6)]);return saveSessionContext({'profile':_0x2802df},_0x336956['session']),console[_0x1d4f6b(0x1ed)](_0x1d4f6b(0x239)+a33_0x323494['green'](_0x2802df)+'\x20'+a33_0x323494['dim'](_0x1d4f6b(0x1e7)+_0x1ec6c8+')')),console[_0x1d4f6b(0x1ed)](a33_0x323494[_0x1d4f6b(0x205)](_0x1d4f6b(0x1f4)+_0x2802df+_0x1d4f6b(0x207))),0x0;}}
@@ -1 +1 @@
1
- const a34_0x2d135d=a34_0x4c98;(function(_0x185668,_0x395918){const _0x124eae=a34_0x4c98,_0xab3cf9=_0x185668();while(!![]){try{const _0x209856=-parseInt(_0x124eae(0x1c1))/0x1*(parseInt(_0x124eae(0x1bc))/0x2)+-parseInt(_0x124eae(0x1b3))/0x3*(parseInt(_0x124eae(0x1ad))/0x4)+parseInt(_0x124eae(0x1b8))/0x5*(parseInt(_0x124eae(0x1bd))/0x6)+-parseInt(_0x124eae(0x1ac))/0x7+-parseInt(_0x124eae(0x1b9))/0x8*(-parseInt(_0x124eae(0x1b0))/0x9)+-parseInt(_0x124eae(0x1b6))/0xa*(parseInt(_0x124eae(0x1ae))/0xb)+-parseInt(_0x124eae(0x1b5))/0xc*(-parseInt(_0x124eae(0x1a6))/0xd);if(_0x209856===_0x395918)break;else _0xab3cf9['push'](_0xab3cf9['shift']());}catch(_0x4aeec9){_0xab3cf9['push'](_0xab3cf9['shift']());}}}(a34_0x255c,0x826ad));function a34_0x4c98(_0x39df76,_0x40faf0){_0x39df76=_0x39df76-0x1a4;const _0x255c4d=a34_0x255c();let _0x4c98ef=_0x255c4d[_0x39df76];return _0x4c98ef;}import{BaseCommand}from'./command.js';import{listProfiles,getActiveProfile,getProfileParams}from'../core/profile.js';import{handleSDKOutput,isStructuredFormat}from'../core/command-output.js';import a34_0x3d87a0 from'chalk';export class ProfilesCommand extends BaseCommand{[a34_0x2d135d(0x1c0)]='profiles';[a34_0x2d135d(0x1be)]=a34_0x2d135d(0x1b4);async[a34_0x2d135d(0x1a5)](_0x31473b){const _0x22037c=a34_0x2d135d,{options:_0x46c219}=_0x31473b;try{const _0x2f4ff8=listProfiles(),_0xcdebee=getActiveProfile();if(_0x2f4ff8[_0x22037c(0x1ab)]===0x0)return console[_0x22037c(0x1ba)](_0x22037c(0x1b1)),console[_0x22037c(0x1ba)](_0x22037c(0x1aa)),console[_0x22037c(0x1ba)](_0x22037c(0x1a9)),0x0;const _0x5c613e=_0x2f4ff8[_0x22037c(0x1a4)](_0x435f00=>{const _0x2fb763=_0x22037c,_0x4f2748=_0x435f00[_0x2fb763(0x1c0)]===_0xcdebee,_0x26d9a1=getProfileParams(_0x435f00[_0x2fb763(0x1af)]);return{'name':_0x435f00[_0x2fb763(0x1c0)],'active':_0x4f2748,'scope':_0x435f00['scope'],'description':_0x435f00[_0x2fb763(0x1af)][_0x2fb763(0x1be)]||'','params':_0x26d9a1};});if(isStructuredFormat(_0x46c219))await handleSDKOutput(_0x5c613e,_0x46c219);else for(const _0xc8f9b4 of _0x2f4ff8){const _0x2bb249=_0xc8f9b4[_0x22037c(0x1c0)]===_0xcdebee?a34_0x3d87a0[_0x22037c(0x1a7)]('\x20✓'):'',_0x1ee28b=_0xc8f9b4[_0x22037c(0x1af)]['site']?a34_0x3d87a0[_0x22037c(0x1a8)]('\x20'+_0xc8f9b4[_0x22037c(0x1af)][_0x22037c(0x1bb)]):'',_0x2c228e=_0xc8f9b4[_0x22037c(0x1af)][_0x22037c(0x1be)]?a34_0x3d87a0['dim']('\x20\x20'+_0xc8f9b4[_0x22037c(0x1af)][_0x22037c(0x1be)]):'';console[_0x22037c(0x1ba)](_0x22037c(0x1bf)+_0xc8f9b4[_0x22037c(0x1c0)]+_0x2bb249+_0x1ee28b+_0x2c228e);}return 0x0;}catch(_0x3c9d1a){return _0x3c9d1a instanceof Error&&console['error'](_0x22037c(0x1b2)+_0x3c9d1a[_0x22037c(0x1b7)]),0x1;}}}function a34_0x255c(){const _0x37a2ae=['1290387mXHPXq','List\x20all\x20available\x20profiles','3528fGcDXA','10ntYMyw','message','305nuuIQj','631168QQGLqk','log','site','7986owNIZU','48486zQJoaG','description','👤\x20','name','101yiEpla','map','execute','23491RkCsoz','green','dim','\x20\x20Global:\x20~/.config/tdx/tdx.json','\x20\x20Local:\x20\x20(project\x20folder)/tdx.json','length','4220265cqHNPd','4CoTRwu','4895NkVULR','config','108ddDJGX','No\x20profiles\x20found.\x20Define\x20profiles\x20in\x20tdx.json:\x0a','Error:\x20'];a34_0x255c=function(){return _0x37a2ae;};return a34_0x255c();}
1
+ const a34_0x1d8290=a34_0x57e6;(function(_0x336f39,_0x768d45){const _0x45e8a5=a34_0x57e6,_0x1510eb=_0x336f39();while(!![]){try{const _0x5967ed=parseInt(_0x45e8a5(0x1c3))/0x1+parseInt(_0x45e8a5(0x1cf))/0x2+parseInt(_0x45e8a5(0x1cd))/0x3+-parseInt(_0x45e8a5(0x1c4))/0x4*(parseInt(_0x45e8a5(0x1ce))/0x5)+parseInt(_0x45e8a5(0x1c8))/0x6*(parseInt(_0x45e8a5(0x1bb))/0x7)+parseInt(_0x45e8a5(0x1b6))/0x8+-parseInt(_0x45e8a5(0x1ca))/0x9*(parseInt(_0x45e8a5(0x1c0))/0xa);if(_0x5967ed===_0x768d45)break;else _0x1510eb['push'](_0x1510eb['shift']());}catch(_0x44fb26){_0x1510eb['push'](_0x1510eb['shift']());}}}(a34_0x44c3,0xccd47));import{BaseCommand}from'./command.js';function a34_0x44c3(){const _0x4dd8d1=['549399jPTjOc','12zXzueH','description','👤\x20','error','487734GkdrJD','log','319833wVJrjp','length','\x20\x20Global:\x20~/.config/tdx/tdx.json','2804358dGGgwH','906025FfQjda','1390350wdilNd','profiles','map','10964512uQsHsO','name','site','dim','scope','49MnRIcJ','\x20\x20Local:\x20\x20(project\x20folder)/tdx.json','config','Error:\x20','message','770XupLCB','execute','List\x20all\x20available\x20profiles'];a34_0x44c3=function(){return _0x4dd8d1;};return a34_0x44c3();}import{listProfiles,getActiveProfile,getProfileParams}from'../core/profile.js';import{handleSDKOutput,isStructuredFormat}from'../core/command-output.js';import a34_0x295d75 from'chalk';function a34_0x57e6(_0x14ac3c,_0x2d196a){_0x14ac3c=_0x14ac3c-0x1b5;const _0x44c33b=a34_0x44c3();let _0x57e69b=_0x44c33b[_0x14ac3c];return _0x57e69b;}export class ProfilesCommand extends BaseCommand{[a34_0x1d8290(0x1b7)]=a34_0x1d8290(0x1d0);[a34_0x1d8290(0x1c5)]=a34_0x1d8290(0x1c2);async[a34_0x1d8290(0x1c1)](_0x49fa91){const _0x4ce755=a34_0x1d8290,{options:_0x3f8d8c}=_0x49fa91;try{const _0x258cd4=listProfiles(),_0x3caf15=getActiveProfile();if(_0x258cd4[_0x4ce755(0x1cb)]===0x0)return console['log']('No\x20profiles\x20found.\x20Define\x20profiles\x20in\x20tdx.json:\x0a'),console[_0x4ce755(0x1c9)](_0x4ce755(0x1bc)),console[_0x4ce755(0x1c9)](_0x4ce755(0x1cc)),0x0;const _0x499311=_0x258cd4[_0x4ce755(0x1b5)](_0x5e56c0=>{const _0x43a974=_0x4ce755,_0x5c815f=_0x5e56c0[_0x43a974(0x1b7)]===_0x3caf15,_0x22ed22=getProfileParams(_0x5e56c0[_0x43a974(0x1bd)]);return{'name':_0x5e56c0[_0x43a974(0x1b7)],'active':_0x5c815f,'scope':_0x5e56c0[_0x43a974(0x1ba)],'description':_0x5e56c0[_0x43a974(0x1bd)][_0x43a974(0x1c5)]||'','params':_0x22ed22};});if(isStructuredFormat(_0x3f8d8c))await handleSDKOutput(_0x499311,_0x3f8d8c);else for(const _0x13f3e7 of _0x258cd4){const _0xae85f5=_0x13f3e7['name']===_0x3caf15?a34_0x295d75['green']('\x20✓'):'',_0x1c4ff3=_0x13f3e7[_0x4ce755(0x1bd)]['site']?a34_0x295d75['dim']('\x20'+_0x13f3e7[_0x4ce755(0x1bd)][_0x4ce755(0x1b8)]):'',_0x1ba8c2=_0x13f3e7[_0x4ce755(0x1bd)][_0x4ce755(0x1c5)]?a34_0x295d75[_0x4ce755(0x1b9)]('\x20\x20'+_0x13f3e7[_0x4ce755(0x1bd)][_0x4ce755(0x1c5)]):'';console[_0x4ce755(0x1c9)](_0x4ce755(0x1c6)+_0x13f3e7[_0x4ce755(0x1b7)]+_0xae85f5+_0x1c4ff3+_0x1ba8c2);}return 0x0;}catch(_0x1c76ad){return _0x1c76ad instanceof Error&&console[_0x4ce755(0x1c7)](_0x4ce755(0x1be)+_0x1c76ad[_0x4ce755(0x1bf)]),0x1;}}}
@@ -1 +1 @@
1
- const a35_0x5518d1=a35_0x4776;(function(_0x4357b7,_0x465351){const _0x2cd873=a35_0x4776,_0x403e9f=_0x4357b7();while(!![]){try{const _0x28e58c=-parseInt(_0x2cd873(0x1d1))/0x1+parseInt(_0x2cd873(0x1ab))/0x2+-parseInt(_0x2cd873(0x1d0))/0x3*(parseInt(_0x2cd873(0x1b0))/0x4)+-parseInt(_0x2cd873(0x1c1))/0x5*(parseInt(_0x2cd873(0x1a9))/0x6)+parseInt(_0x2cd873(0x1b1))/0x7*(parseInt(_0x2cd873(0x1b4))/0x8)+parseInt(_0x2cd873(0x1b8))/0x9+-parseInt(_0x2cd873(0x1aa))/0xa*(-parseInt(_0x2cd873(0x1ac))/0xb);if(_0x28e58c===_0x465351)break;else _0x403e9f['push'](_0x403e9f['shift']());}catch(_0x3508d2){_0x403e9f['push'](_0x403e9f['shift']());}}}(a35_0x4def,0x76538));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';import{handleQueryOutput,formatQueryOutput,resolveOutputOptions}from'../core/command-output.js';import{readSqlStatementsFromFile,readSqlStatementsFromStdin,splitSqlStatements,isSqlFilePath}from'../sdk/query/sql-parser.js';function a35_0x4def(){const _0x4b48ac=['673690Qixrxs','1038860jNOMAI','11DrTrgn','name','Executing\x20statement\x20','No\x20SQL\x20provided','1110092hflaDv','14KRHmyt','execute','file','2704608aciveC','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','Error:\x20','\x20splits','3407535awrpbF','error','in\x20','SQL:\x20','state','message','Query\x20completed:\x20Processed\x20','Catalog:\x20','catalog','10zAgQUD','...','processedRows','output','args','site','join','Site:\x20','stats','query','elapsedTimeMillis','Executing\x20query...','setPhase','jobId','\x20-\x20','3yjRaYd','518239GOSWSx','verbose','Executing\x20query\x20[','options','originalMessage','information_schema','length','\x20[Job\x20ID:\x20','Schema:\x20','completedSplits','1083420SJuCeE'];a35_0x4def=function(){return _0x4b48ac;};return a35_0x4def();}function a35_0x4776(_0x296780,_0x490cec){_0x296780=_0x296780-0x1a6;const _0x4def65=a35_0x4def();let _0x4776fa=_0x4def65[_0x296780];return _0x4776fa;}import{writeFileSync}from'fs';import{withProgressSpinner,formatElapsed}from'../utils/spinner.js';import{formatRows}from'../sdk/util/formatters.js';export class QueryCommand extends BaseCommand{[a35_0x5518d1(0x1ad)]=a35_0x5518d1(0x1ca);['description']='Run\x20Trino\x20queries\x20(streaming)';async[a35_0x5518d1(0x1b2)](_0x24d337){const _0x3e8cf7=a35_0x5518d1,{options:_0x1e69c7,args:_0x3e5e1f,tdx:_0x1bc2f4}=_0x24d337,_0x5d5665={..._0x1e69c7,'limitStructuredFormats':!![]},_0x53b4ad=_0x3e5e1f[0x0],_0x2f0816=_0x1e69c7['file'];let _0x28ae44;try{if(_0x2f0816)_0x28ae44=readSqlStatementsFromFile(_0x2f0816);else{if(_0x53b4ad==='-')_0x28ae44=await readSqlStatementsFromStdin();else{if(_0x53b4ad&&isSqlFilePath(_0x53b4ad))_0x28ae44=readSqlStatementsFromFile(_0x53b4ad);else{if(_0x53b4ad)_0x28ae44=splitSqlStatements(_0x53b4ad);else throw new Error(_0x3e8cf7(0x1af));}}}}catch(_0x34dffe){return console['error'](_0x3e8cf7(0x1b6)+_0x34dffe['message']),0x1;}const _0x318b81=_0x1e69c7['database']||_0x3e8cf7(0x1d6),_0x362c21=_0x1e69c7[_0x3e8cf7(0x1c0)];try{const _0x199a05=[],_0x37c378=!!_0x1e69c7['output'];for(let _0x5cded0=0x0;_0x5cded0<_0x28ae44[_0x3e8cf7(0x1d7)];_0x5cded0++){const _0x1884cf=_0x28ae44[_0x5cded0],_0x2ca877=_0x5cded0+0x1,_0x53cb72=_0x28ae44[_0x3e8cf7(0x1d7)],_0x5a8662=_0x53cb72>0x1;_0x1e69c7['verbose']&&(console[_0x3e8cf7(0x1b9)]('\x0a'+(_0x5a8662?'Statement\x20'+_0x2ca877+'/'+_0x53cb72+':':'')),console[_0x3e8cf7(0x1b9)](_0x3e8cf7(0x1c8)+_0x1e69c7[_0x3e8cf7(0x1c6)]),console['error'](_0x3e8cf7(0x1bf)+(_0x362c21||'td')),console[_0x3e8cf7(0x1b9)](_0x3e8cf7(0x1a7)+_0x318b81),console[_0x3e8cf7(0x1b9)](_0x3e8cf7(0x1bb)+_0x1884cf));const _0x29d22e=_0x5a8662?_0x3e8cf7(0x1ae)+_0x2ca877+'/'+_0x53cb72+_0x3e8cf7(0x1c2):_0x3e8cf7(0x1cc);try{const _0x2aa45c=await withProgressSpinner(_0x29d22e,async _0x6ef0a7=>{const _0x5c2f72=_0x3e8cf7,_0x5c74c2=await _0x1bc2f4[_0x5c2f72(0x1ca)][_0x5c2f72(0x1b2)](_0x1884cf,{'catalog':_0x362c21,'schema':_0x318b81,'onJobId':_0x4b817c=>{_0x6ef0a7['setJobId'](_0x4b817c);},'onProgress':_0x46aa78=>{const _0x2c1e0c=_0x5c2f72;_0x6ef0a7[_0x2c1e0c(0x1cd)](_0x2c1e0c(0x1d3)+_0x46aa78[_0x2c1e0c(0x1bc)]+']'),_0x6ef0a7['setExtra'](formatRows(_0x46aa78[_0x2c1e0c(0x1c3)])+'\x20rows\x20'+_0x46aa78[_0x2c1e0c(0x1a8)]+'/'+_0x46aa78['totalSplits']+_0x2c1e0c(0x1b7));}});return _0x5c74c2;},{'verbose':_0x1e69c7[_0x3e8cf7(0x1d2)]}),_0x58adef=_0x2aa45c['data'],_0x5ee816=_0x58adef['jobId']?_0x3e8cf7(0x1a6)+_0x58adef[_0x3e8cf7(0x1ce)]+']':'',_0x829be3=_0x5a8662?'Statement\x20'+_0x2ca877+'/'+_0x53cb72+_0x3e8cf7(0x1cf):'';console[_0x3e8cf7(0x1b9)]('✔\x20'+_0x829be3+_0x3e8cf7(0x1be)+formatRows(_0x58adef[_0x3e8cf7(0x1c9)][_0x3e8cf7(0x1c3)])+'\x20rows\x20'+(_0x3e8cf7(0x1ba)+formatElapsed(_0x58adef[_0x3e8cf7(0x1c9)][_0x3e8cf7(0x1cb)])+_0x5ee816));if(_0x5a8662&&_0x37c378){const _0x1599c0=resolveOutputOptions(_0x5d5665),_0x3cba89=await formatQueryOutput(_0x58adef,_0x1599c0);_0x199a05['push'](_0x3cba89);}else await handleQueryOutput(_0x58adef,_0x5d5665);}catch(_0x4a7c29){const _0x5783cb=_0x5a8662?'Statement\x20'+_0x2ca877+'/'+_0x53cb72+':\x0a':'',_0x584809=_0x4a7c29 instanceof SDKError?_0x4a7c29[_0x3e8cf7(0x1d5)]:_0x4a7c29[_0x3e8cf7(0x1bd)];return console[_0x3e8cf7(0x1b9)](''+_0x5783cb+_0x584809),0x1;}}if(_0x28ae44[_0x3e8cf7(0x1d7)]>0x1&&_0x37c378&&_0x199a05[_0x3e8cf7(0x1d7)]>0x0){const _0x2fd9f5=_0x199a05[_0x3e8cf7(0x1c7)]('\x0a');writeFileSync(_0x1e69c7['output'],_0x2fd9f5),console[_0x3e8cf7(0x1b9)]('\x0aAll\x20results\x20saved\x20to\x20'+_0x1e69c7[_0x3e8cf7(0x1c4)]);}return 0x0;}catch(_0x3df081){throw _0x3df081;}}['validate'](_0x332c81){const _0x135629=a35_0x5518d1,_0x4b10e1=_0x332c81[_0x135629(0x1c5)][0x0],_0x3b71dd=_0x332c81[_0x135629(0x1d4)][_0x135629(0x1b3)];if(!_0x4b10e1&&!_0x3b71dd)return _0x135629(0x1b5);if(_0x4b10e1&&_0x3b71dd)return'Cannot\x20specify\x20both\x20SQL\x20argument\x20and\x20--file\x20option';return undefined;}}
1
+ const a35_0x2d92c4=a35_0x6d41;(function(_0x16783b,_0x2e2de5){const _0x5614d9=a35_0x6d41,_0x2910be=_0x16783b();while(!![]){try{const _0x41bf84=-parseInt(_0x5614d9(0xe2))/0x1+parseInt(_0x5614d9(0xf2))/0x2+parseInt(_0x5614d9(0x10e))/0x3*(parseInt(_0x5614d9(0xfe))/0x4)+parseInt(_0x5614d9(0xe7))/0x5+parseInt(_0x5614d9(0x102))/0x6*(parseInt(_0x5614d9(0xe5))/0x7)+-parseInt(_0x5614d9(0xf9))/0x8*(parseInt(_0x5614d9(0x110))/0x9)+parseInt(_0x5614d9(0xee))/0xa*(-parseInt(_0x5614d9(0xff))/0xb);if(_0x41bf84===_0x2e2de5)break;else _0x2910be['push'](_0x2910be['shift']());}catch(_0x46fdc9){_0x2910be['push'](_0x2910be['shift']());}}}(a35_0x4a57,0x1cc58));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';import{handleQueryOutput,formatQueryOutput,resolveOutputOptions}from'../core/command-output.js';import{readSqlStatementsFromFile,readSqlStatementsFromStdin,splitSqlStatements,isSqlFilePath}from'../sdk/query/sql-parser.js';import{writeFileSync}from'fs';function a35_0x6d41(_0x154452,_0x19336c){_0x154452=_0x154452-0xe2;const _0x4a57d4=a35_0x4a57();let _0x6d4156=_0x4a57d4[_0x154452];return _0x6d4156;}import{withProgressSpinner,formatElapsed}from'../utils/spinner.js';function a35_0x4a57(){const _0x317336=['database','4492sCsiTN','125642tlXtAj','push','verbose','6oAFuZa','message','SQL:\x20','\x20[Job\x20ID:\x20','information_schema','length','\x20-\x20','description','No\x20SQL\x20provided','join','file','name','171xmSjVl','setPhase','201753BLDlXT','\x20splits','output','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','\x20rows\x20','Cannot\x20specify\x20both\x20SQL\x20argument\x20and\x20--file\x20option','178014xVUqee','state','args','749028NTIJwu','Executing\x20query...','1097845lAChkY','...','validate','data','processedRows','\x0aAll\x20results\x20saved\x20to\x20','jobId','160rAhSFS','in\x20','setJobId','query','220894iXggRi','Schema:\x20','stats','Statement\x20','options','originalMessage','error','8hCcNft','Site:\x20','Executing\x20statement\x20','site'];a35_0x4a57=function(){return _0x317336;};return a35_0x4a57();}import{formatRows}from'../sdk/util/formatters.js';export class QueryCommand extends BaseCommand{[a35_0x2d92c4(0x10d)]=a35_0x2d92c4(0xf1);[a35_0x2d92c4(0x109)]='Run\x20Trino\x20queries\x20(streaming)';async['execute'](_0x450ccb){const _0x3250e3=a35_0x2d92c4,{options:_0x420d6d,args:_0x5e589f,tdx:_0x5c4c0f}=_0x450ccb,_0x4823fb={..._0x420d6d,'limitStructuredFormats':!![]},_0x1ed865=_0x5e589f[0x0],_0x2d36b4=_0x420d6d[_0x3250e3(0x10c)];let _0x5c3b93;try{if(_0x2d36b4)_0x5c3b93=readSqlStatementsFromFile(_0x2d36b4);else{if(_0x1ed865==='-')_0x5c3b93=await readSqlStatementsFromStdin();else{if(_0x1ed865&&isSqlFilePath(_0x1ed865))_0x5c3b93=readSqlStatementsFromFile(_0x1ed865);else{if(_0x1ed865)_0x5c3b93=splitSqlStatements(_0x1ed865);else throw new Error(_0x3250e3(0x10a));}}}}catch(_0x3c4b53){return console[_0x3250e3(0xf8)]('Error:\x20'+_0x3c4b53[_0x3250e3(0x103)]),0x1;}const _0x5eaa94=_0x420d6d[_0x3250e3(0xfd)]||_0x3250e3(0x106),_0x15e885=_0x420d6d['catalog'];try{const _0x100010=[],_0x50d7ec=!!_0x420d6d[_0x3250e3(0x112)];for(let _0x479d32=0x0;_0x479d32<_0x5c3b93[_0x3250e3(0x107)];_0x479d32++){const _0x1c4b0b=_0x5c3b93[_0x479d32],_0x33bed7=_0x479d32+0x1,_0x17b7be=_0x5c3b93[_0x3250e3(0x107)],_0x4dc5de=_0x17b7be>0x1;_0x420d6d[_0x3250e3(0x101)]&&(console['error']('\x0a'+(_0x4dc5de?_0x3250e3(0xf5)+_0x33bed7+'/'+_0x17b7be+':':'')),console['error'](_0x3250e3(0xfa)+_0x420d6d[_0x3250e3(0xfc)]),console[_0x3250e3(0xf8)]('Catalog:\x20'+(_0x15e885||'td')),console[_0x3250e3(0xf8)](_0x3250e3(0xf3)+_0x5eaa94),console[_0x3250e3(0xf8)](_0x3250e3(0x104)+_0x1c4b0b));const _0x2a7851=_0x4dc5de?_0x3250e3(0xfb)+_0x33bed7+'/'+_0x17b7be+_0x3250e3(0xe8):_0x3250e3(0xe6);try{const _0x789cdb=await withProgressSpinner(_0x2a7851,async _0x4ca0a1=>{const _0x503575=_0x3250e3,_0x43d84a=await _0x5c4c0f[_0x503575(0xf1)]['execute'](_0x1c4b0b,{'catalog':_0x15e885,'schema':_0x5eaa94,'onJobId':_0x4e6a39=>{const _0x4eb95c=_0x503575;_0x4ca0a1[_0x4eb95c(0xf0)](_0x4e6a39);},'onProgress':_0xeb25b0=>{const _0x545b77=_0x503575;_0x4ca0a1[_0x545b77(0x10f)]('Executing\x20query\x20['+_0xeb25b0[_0x545b77(0xe3)]+']'),_0x4ca0a1['setExtra'](formatRows(_0xeb25b0[_0x545b77(0xeb)])+_0x545b77(0x114)+_0xeb25b0['completedSplits']+'/'+_0xeb25b0['totalSplits']+_0x545b77(0x111));}});return _0x43d84a;},{'verbose':_0x420d6d['verbose']}),_0x198a2c=_0x789cdb[_0x3250e3(0xea)],_0x2fb04d=_0x198a2c[_0x3250e3(0xed)]?_0x3250e3(0x105)+_0x198a2c[_0x3250e3(0xed)]+']':'',_0x545d9a=_0x4dc5de?'Statement\x20'+_0x33bed7+'/'+_0x17b7be+_0x3250e3(0x108):'';console[_0x3250e3(0xf8)]('✔\x20'+_0x545d9a+'Query\x20completed:\x20Processed\x20'+formatRows(_0x198a2c[_0x3250e3(0xf4)][_0x3250e3(0xeb)])+_0x3250e3(0x114)+(_0x3250e3(0xef)+formatElapsed(_0x198a2c[_0x3250e3(0xf4)]['elapsedTimeMillis'])+_0x2fb04d));if(_0x4dc5de&&_0x50d7ec){const _0x40773c=resolveOutputOptions(_0x4823fb),_0x2ee584=await formatQueryOutput(_0x198a2c,_0x40773c);_0x100010[_0x3250e3(0x100)](_0x2ee584);}else await handleQueryOutput(_0x198a2c,_0x4823fb);}catch(_0x1842bc){const _0x18fe4c=_0x4dc5de?_0x3250e3(0xf5)+_0x33bed7+'/'+_0x17b7be+':\x0a':'',_0x459d5d=_0x1842bc instanceof SDKError?_0x1842bc[_0x3250e3(0xf7)]:_0x1842bc[_0x3250e3(0x103)];return console[_0x3250e3(0xf8)](''+_0x18fe4c+_0x459d5d),0x1;}}if(_0x5c3b93['length']>0x1&&_0x50d7ec&&_0x100010[_0x3250e3(0x107)]>0x0){const _0xd76cd9=_0x100010[_0x3250e3(0x10b)]('\x0a');writeFileSync(_0x420d6d[_0x3250e3(0x112)],_0xd76cd9),console['error'](_0x3250e3(0xec)+_0x420d6d['output']);}return 0x0;}catch(_0x1c84c9){throw _0x1c84c9;}}[a35_0x2d92c4(0xe9)](_0x3f42f0){const _0xfc6c00=a35_0x2d92c4,_0x33ec60=_0x3f42f0[_0xfc6c00(0xe4)][0x0],_0x1cd99e=_0x3f42f0[_0xfc6c00(0xf6)][_0xfc6c00(0x10c)];if(!_0x33ec60&&!_0x1cd99e)return _0xfc6c00(0x113);if(_0x33ec60&&_0x1cd99e)return _0xfc6c00(0x115);return undefined;}}
@@ -1 +1 @@
1
- const a36_0x3d98d4=a36_0x4f04;(function(_0xb964b7,_0x3ff650){const _0x49fa1f=a36_0x4f04,_0x430df3=_0xb964b7();while(!![]){try{const _0x13d510=parseInt(_0x49fa1f(0x191))/0x1*(-parseInt(_0x49fa1f(0x1aa))/0x2)+-parseInt(_0x49fa1f(0x186))/0x3*(parseInt(_0x49fa1f(0x1b4))/0x4)+parseInt(_0x49fa1f(0x1e7))/0x5*(-parseInt(_0x49fa1f(0x1ad))/0x6)+parseInt(_0x49fa1f(0x1c6))/0x7*(parseInt(_0x49fa1f(0x1c2))/0x8)+-parseInt(_0x49fa1f(0x1a4))/0x9+parseInt(_0x49fa1f(0x1c1))/0xa*(-parseInt(_0x49fa1f(0x1f2))/0xb)+parseInt(_0x49fa1f(0x1f8))/0xc*(parseInt(_0x49fa1f(0x206))/0xd);if(_0x13d510===_0x3ff650)break;else _0x430df3['push'](_0x430df3['shift']());}catch(_0x44ff02){_0x430df3['push'](_0x430df3['shift']());}}}(a36_0x1ab9,0xdb8be));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';function a36_0x1ab9(){const _0x166ebf=['Schedule\x20updated:\x20','options','6951WyhIkv','entries','\x20\x20→\x20','\x20execution','Deleting\x20schedule...','user_name','time','queries','(unnamed)','file','schedule:update','340241Qfyeue','cron','status','Getting\x20schedule\x20history...','getTime','execute','pagination','engineVersion','verbose','listQueries','yes','error','padEnd','schedule:history','engine_version','tsv','timezone','Listing\x20scheduled\x20queries...','toLocaleDateString','4599792tWAzDg','Creating\x20schedule...','Failed\x20to\x20read\x20file:\x20','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20show\x20<name>','success','format','10MHXTIo','description','executing_user_id','62658KXwaar','\x20job','schedules','validate','result','updated_at','schedule:list','1984VxSzve','map','\x20(use\x20--limit\x20to\x20see\x20more)','trino','nextRun','h\x20ago','Creating\x20schedule:\x20','\x20\x20Num:\x20','Running\x20schedule...','At\x20least\x20one\x20option\x20must\x20be\x20provided\x20to\x20update','INVALID_ARGUMENT','\x20schedules','retry_limit','539420KRcNfx','58040stqFnX','from','next_run_at','site','721qbcikq','user','queryUrl','never','cyan','type','delete','d\x20ago','\x20matching\x20\x22','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20schedule\x20\x22','\x20\x20Time:\x20','substring','Schedule\x20deleted:\x20','\x20created','output','\x20\x20Cron:\x20','show','just\x20now','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20update\x20<name>\x20[options]','No\x20scheduled\x20queries\x20found','has_next_page','history','Found\x20','length','/app/queries/editor?queryId=','name','database','job_id','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20history\x20<name>\x20[--from\x20<n>]\x20[--to\x20<n>]','last_job','schedule:run','run','soon','430sjCSWw','count','Updating\x20schedule...','priority','round','created_at','join','query','data','update','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20delete\x20<name>','297fasYSW','📅\x20','Delete\x20a\x20scheduled\x20query','retryLimit','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]','args','1272JEOiVQ','statusIcon','ended_at','lastRun','utf-8','limit','log','\x20\x20Database:\x20','time_zone','\x20(showing\x20','Searching\x20scheduled\x20queries\x20matching\x20\x22','delay','keys','json','719667qDeiYZ','max','Update\x20a\x20scheduled\x20query','\x20\x20Timezone:\x20','num','jsonl','Show\x20schedule\x20execution\x20history','end_at','List\x20scheduled\x20queries','in\x20','repeat','\x22...'];a36_0x1ab9=function(){return _0x166ebf;};return a36_0x1ab9();}import{hyperlink}from'../sdk/util/formatters.js';import a36_0xbf6eac from'chalk';function formatRelativeTime(_0x16ba54){const _0x21b521=a36_0x4f04,_0x3cb3cb=new Date(_0x16ba54),_0x1cf8fa=new Date(),_0x2b2ecf=_0x3cb3cb['getTime']()-_0x1cf8fa[_0x21b521(0x195)](),_0x5519e5=Math['abs'](_0x2b2ecf)/0x3e8,_0x364a91=_0x2b2ecf<0x0;if(_0x5519e5<0x3c)return _0x364a91?_0x21b521(0x1d7):_0x21b521(0x1e6);else{if(_0x5519e5<0xe10){const _0x1f9eaf=Math[_0x21b521(0x1eb)](_0x5519e5/0x3c);return _0x364a91?_0x1f9eaf+'m\x20ago':_0x21b521(0x20f)+_0x1f9eaf+'m';}else{if(_0x5519e5<0x15180){const _0x60ccae=Math[_0x21b521(0x1eb)](_0x5519e5/0xe10);return _0x364a91?_0x60ccae+_0x21b521(0x1b9):'in\x20'+_0x60ccae+'h';}else{if(_0x5519e5<0x93a80){const _0x59db73=Math[_0x21b521(0x1eb)](_0x5519e5/0x15180);return _0x364a91?_0x59db73+_0x21b521(0x1cd):_0x21b521(0x20f)+_0x59db73+'d';}else return _0x3cb3cb[_0x21b521(0x1a3)]();}}}}function a36_0x4f04(_0x2c247a,_0x3097e9){_0x2c247a=_0x2c247a-0x184;const _0x1ab944=a36_0x1ab9();let _0x4f0424=_0x1ab944[_0x2c247a];return _0x4f0424;}export class ScheduleListCommand extends BaseCommand{[a36_0x3d98d4(0x1df)]=a36_0x3d98d4(0x1b3);[a36_0x3d98d4(0x1ab)]=a36_0x3d98d4(0x20e);async[a36_0x3d98d4(0x196)](_0x3d847b){const _0x49cbfe=a36_0x3d98d4,{options:_0x287f48,args:_0x580574,tdx:_0x39d384}=_0x3d847b,_0x3a3753=resolveLimit(_0x287f48[_0x49cbfe(0x1fd)],DEFAULT_DISPLAY_LIMIT),_0x10667f=_0x580574[0x0],_0x1bfd80=_0x10667f?_0x49cbfe(0x202)+_0x10667f+_0x49cbfe(0x211):_0x49cbfe(0x1a2),_0x3d6d5d=await withSpinner(_0x1bfd80,()=>_0x39d384['schedules'][_0x49cbfe(0x19a)]({'limit':_0x3a3753,'scheduled':!![],'pattern':_0x10667f}),{'verbose':_0x287f48[_0x49cbfe(0x199)]}),_0x384008=_0x3d6d5d[_0x49cbfe(0x1ef)][_0x49cbfe(0x18d)],_0x15f9aa=_0x3d6d5d[_0x49cbfe(0x1ef)][_0x49cbfe(0x197)][_0x49cbfe(0x1da)],_0x1d21be=_0x10667f?_0x49cbfe(0x1ce)+_0x10667f+'\x22':'';_0x15f9aa?console['error']('Showing\x20first\x20'+_0x384008['length']+_0x49cbfe(0x1bf)+_0x1d21be+_0x49cbfe(0x1b6)):console[_0x49cbfe(0x19c)](_0x49cbfe(0x1dc)+_0x384008[_0x49cbfe(0x1dd)]+'\x20scheduled\x20quer'+(_0x384008['length']!==0x1?'ies':'y')+_0x1d21be);if(_0x287f48[_0x49cbfe(0x1a9)]===_0x49cbfe(0x205)||_0x287f48[_0x49cbfe(0x1a9)]===_0x49cbfe(0x20b)||_0x287f48['format']==='table'||_0x287f48['format']===_0x49cbfe(0x1a0)){const _0x2a2581=_0x384008[_0x49cbfe(0x1b5)](_0x56cadb=>({'id':_0x56cadb['id'],'name':_0x56cadb[_0x49cbfe(0x1df)],'cron':_0x56cadb[_0x49cbfe(0x192)],'database':_0x56cadb[_0x49cbfe(0x1e0)]?.[_0x49cbfe(0x1df)],'type':_0x56cadb[_0x49cbfe(0x1cb)],'timezone':_0x56cadb[_0x49cbfe(0x200)],'user_name':_0x56cadb[_0x49cbfe(0x1c7)]?.[_0x49cbfe(0x1df)],'updated_at':_0x56cadb[_0x49cbfe(0x1b2)],'next_run_at':_0x56cadb[_0x49cbfe(0x1c4)],'last_job_status':_0x56cadb[_0x49cbfe(0x1e3)]?.[_0x49cbfe(0x193)]}));await handleSDKOutput(_0x2a2581,_0x287f48);}else{if(_0x384008[_0x49cbfe(0x1dd)]===0x0)console[_0x49cbfe(0x1fe)](_0x49cbfe(0x1d9));else{const _0x2f640d=_0x287f48[_0x49cbfe(0x1c5)],_0x4302ec=_0x384008[_0x49cbfe(0x1b5)](_0x38dfb2=>{const _0x270418=_0x49cbfe,_0x1072a2=_0x38dfb2[_0x270418(0x1e3)]?.[_0x270418(0x193)]?_0x38dfb2[_0x270418(0x1e3)]['status']===_0x270418(0x1a8)?'✓':'✗':'-',_0x4cf7d6=_0x38dfb2[_0x270418(0x1e3)]?.['ended_at']?formatRelativeTime(_0x38dfb2[_0x270418(0x1e3)][_0x270418(0x1fa)]):_0x270418(0x1c9),_0x3cbf3b=_0x38dfb2['next_run_at']?formatRelativeTime(_0x38dfb2['next_run_at']):'-',_0x1a48a7=_0x38dfb2[_0x270418(0x192)]||'',_0x12f087=_0x38dfb2['name']||_0x270418(0x18e),_0x27a706=getConsoleUrl(_0x2f640d,_0x270418(0x1de)+_0x38dfb2['id']);return{'statusIcon':_0x1072a2,'lastRun':_0x4cf7d6,'nextRun':_0x3cbf3b,'cron':_0x1a48a7,'name':_0x12f087,'queryUrl':_0x27a706,'status':_0x38dfb2[_0x270418(0x1e3)]?.[_0x270418(0x193)]};}),_0x506308=Math['max'](..._0x4302ec[_0x49cbfe(0x1b5)](_0x11fb9d=>_0x11fb9d[_0x49cbfe(0x1fb)][_0x49cbfe(0x1dd)])),_0x5889e9=Math[_0x49cbfe(0x207)](..._0x4302ec[_0x49cbfe(0x1b5)](_0x3b4c8e=>_0x3b4c8e[_0x49cbfe(0x1b8)][_0x49cbfe(0x1dd)])),_0x4caa07=Math[_0x49cbfe(0x207)](..._0x4302ec['map'](_0x334d99=>_0x334d99[_0x49cbfe(0x192)][_0x49cbfe(0x1dd)])),_0x5e176a=_0x4302ec[_0x49cbfe(0x1b5)](_0x415630=>{const _0x15780e=_0x49cbfe,_0x3b6349=_0x415630[_0x15780e(0x193)]===_0x15780e(0x1a8)?a36_0xbf6eac['green'](_0x415630[_0x15780e(0x1f9)]):_0x415630['status']===_0x15780e(0x19c)?a36_0xbf6eac['red'](_0x415630['statusIcon']):a36_0xbf6eac['dim'](_0x415630[_0x15780e(0x1f9)]),_0x8edefb=_0x415630['lastRun'][_0x15780e(0x19d)](_0x506308),_0x2ffc3e=_0x415630['nextRun']['padEnd'](_0x5889e9),_0x21f17f=_0x415630[_0x15780e(0x192)]?a36_0xbf6eac[_0x15780e(0x1ca)](_0x415630[_0x15780e(0x192)][_0x15780e(0x19d)](_0x4caa07)):'\x20'[_0x15780e(0x210)](_0x4caa07),_0x539924=hyperlink(_0x415630[_0x15780e(0x1df)],_0x415630[_0x15780e(0x1c8)]);return _0x15780e(0x1f3)+_0x3b6349+'\x20'+_0x8edefb+_0x15780e(0x188)+_0x2ffc3e+'\x20\x20'+_0x21f17f+'\x20\x20'+_0x539924;});await writeOutput(_0x5e176a[_0x49cbfe(0x1ed)]('\x0a'),_0x287f48[_0x49cbfe(0x1d4)],'list');}}return 0x0;}}export class ScheduleShowCommand extends BaseCommand{[a36_0x3d98d4(0x1df)]='schedule:show';[a36_0x3d98d4(0x1ab)]='Show\x20schedule\x20details';['validate'](_0x5dd72a){const _0x1f21b4=a36_0x3d98d4,_0x44cbc0=_0x5dd72a['args'][0x0];if(!_0x44cbc0)return _0x1f21b4(0x1a7);return undefined;}async[a36_0x3d98d4(0x196)](_0x1ab42f){const _0x2d6115=a36_0x3d98d4,{options:_0x25ccbd,args:_0x5b9aa3,tdx:_0x4b7479}=_0x1ab42f,_0x1db70f=_0x5b9aa3[0x0],_0x1b67ee=await withSpinner('Getting\x20schedule\x20details...',()=>_0x4b7479['schedules'][_0x2d6115(0x1d6)](_0x1db70f),{'verbose':_0x25ccbd[_0x2d6115(0x199)]}),_0x9f99f5=_0x1b67ee['data'],_0xeaddc8={'name':_0x9f99f5[_0x2d6115(0x1df)],'cron':_0x9f99f5[_0x2d6115(0x192)],'database':_0x9f99f5[_0x2d6115(0x1e0)],'type':_0x9f99f5[_0x2d6115(0x1cb)],'timezone':_0x9f99f5[_0x2d6115(0x1a1)],'user_name':_0x9f99f5[_0x2d6115(0x18b)],'created_at':_0x9f99f5[_0x2d6115(0x1ec)],'engine_version':_0x9f99f5[_0x2d6115(0x19f)],'executing_user_id':_0x9f99f5[_0x2d6115(0x1ac)],'query':_0x9f99f5[_0x2d6115(0x1ee)],'delay':_0x9f99f5[_0x2d6115(0x203)],'priority':_0x9f99f5[_0x2d6115(0x1ea)],'retry_limit':_0x9f99f5[_0x2d6115(0x1c0)],..._0x9f99f5[_0x2d6115(0x1b1)]&&{'result':_0x9f99f5[_0x2d6115(0x1b1)]}};return await handleSingleObjectOutput(_0xeaddc8,_0x25ccbd),0x0;}}export class ScheduleCreateCommand extends BaseCommand{[a36_0x3d98d4(0x1df)]='schedule:create';[a36_0x3d98d4(0x1ab)]='Create\x20a\x20scheduled\x20query';['validate'](_0x112885){const _0xb925a6=a36_0x3d98d4,_0x589447=_0x112885['args'][0x0];if(!_0x589447)return _0xb925a6(0x1f6);const _0x4d3484=_0x112885[_0xb925a6(0x185)];if(!_0x4d3484[_0xb925a6(0x1e0)])return'Database\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]';return undefined;}async['execute'](_0x2f97e3){const _0x4a6120=a36_0x3d98d4,{options:_0x534b5a,args:_0x2a0ad4,tdx:_0x16e780}=_0x2f97e3,_0x4fd184=_0x2a0ad4[0x0],_0x497b1e=_0x534b5a,_0x2b1a39=_0x497b1e[_0x4a6120(0x1e0)],_0x2f8439=_0x497b1e[_0x4a6120(0x18f)],_0x490c7c=_0x497b1e[_0x4a6120(0x1cb)]||_0x4a6120(0x1b7);let _0x3769e5;try{_0x3769e5=readFileSync(_0x2f8439,_0x4a6120(0x1fc))['trim']();}catch(_0x217e4a){throw new SDKError(ErrorCode[_0x4a6120(0x1be)],_0x4a6120(0x1a6)+_0x2f8439,_0x217e4a instanceof Error?_0x217e4a:undefined);}if(!_0x3769e5)throw new SDKError(ErrorCode['INVALID_ARGUMENT'],'Query\x20file\x20is\x20empty');const _0x1f6cca={'database':_0x2b1a39,'query':_0x3769e5,'type':_0x490c7c};if(_0x497b1e[_0x4a6120(0x192)])_0x1f6cca[_0x4a6120(0x192)]=_0x497b1e[_0x4a6120(0x192)];if(_0x497b1e['timezone'])_0x1f6cca[_0x4a6120(0x1a1)]=_0x497b1e[_0x4a6120(0x1a1)];if(_0x497b1e['delay']!==undefined)_0x1f6cca[_0x4a6120(0x203)]=Number(_0x497b1e[_0x4a6120(0x203)]);if(_0x497b1e['priority']!==undefined)_0x1f6cca[_0x4a6120(0x1ea)]=Number(_0x497b1e[_0x4a6120(0x1ea)]);if(_0x497b1e[_0x4a6120(0x1f5)]!==undefined)_0x1f6cca[_0x4a6120(0x1c0)]=Number(_0x497b1e['retryLimit']);if(_0x497b1e[_0x4a6120(0x198)])_0x1f6cca[_0x4a6120(0x19f)]=_0x497b1e['engineVersion'];if(_0x497b1e['result'])_0x1f6cca['result']=_0x497b1e[_0x4a6120(0x1b1)];if(_0x534b5a[_0x4a6120(0x199)]){console['error'](_0x4a6120(0x1ba)+_0x4fd184),console[_0x4a6120(0x19c)](_0x4a6120(0x1ff)+_0x2b1a39),console[_0x4a6120(0x19c)]('\x20\x20Type:\x20'+_0x490c7c);if(_0x1f6cca[_0x4a6120(0x192)])console[_0x4a6120(0x19c)](_0x4a6120(0x1d5)+_0x1f6cca[_0x4a6120(0x192)]);if(_0x1f6cca[_0x4a6120(0x1a1)])console['error'](_0x4a6120(0x209)+_0x1f6cca[_0x4a6120(0x1a1)]);}const _0x36976b=await withSpinner(_0x4a6120(0x1a5),()=>_0x16e780[_0x4a6120(0x1af)]['create'](_0x4fd184,_0x1f6cca),{'verbose':_0x534b5a[_0x4a6120(0x199)]});return console[_0x4a6120(0x19c)]('Schedule\x20created:\x20'+_0x36976b[_0x4a6120(0x1ef)][_0x4a6120(0x1df)]),await handleSingleObjectOutput(_0x36976b['data'],_0x534b5a),0x0;}}export class ScheduleUpdateCommand extends BaseCommand{[a36_0x3d98d4(0x1df)]=a36_0x3d98d4(0x190);[a36_0x3d98d4(0x1ab)]=a36_0x3d98d4(0x208);[a36_0x3d98d4(0x1b0)](_0x2f776d){const _0x308f2a=a36_0x3d98d4,_0x272c07=_0x2f776d[_0x308f2a(0x1f7)][0x0];if(!_0x272c07)return _0x308f2a(0x1d8);return undefined;}async[a36_0x3d98d4(0x196)](_0x3b6b23){const _0x35d7d1=a36_0x3d98d4,{options:_0x5728b4,args:_0x16c0ed,tdx:_0x3db169}=_0x3b6b23,_0x59a225=_0x16c0ed[0x0],_0xdc82f0=_0x5728b4,_0x416cd4={};if(_0xdc82f0[_0x35d7d1(0x1e0)])_0x416cd4[_0x35d7d1(0x1e0)]=_0xdc82f0[_0x35d7d1(0x1e0)];if(_0xdc82f0[_0x35d7d1(0x1cb)])_0x416cd4[_0x35d7d1(0x1cb)]=_0xdc82f0[_0x35d7d1(0x1cb)];if(_0xdc82f0[_0x35d7d1(0x192)])_0x416cd4[_0x35d7d1(0x192)]=_0xdc82f0[_0x35d7d1(0x192)];if(_0xdc82f0[_0x35d7d1(0x1a1)])_0x416cd4[_0x35d7d1(0x1a1)]=_0xdc82f0[_0x35d7d1(0x1a1)];if(_0xdc82f0[_0x35d7d1(0x203)]!==undefined)_0x416cd4[_0x35d7d1(0x203)]=Number(_0xdc82f0[_0x35d7d1(0x203)]);if(_0xdc82f0['priority']!==undefined)_0x416cd4['priority']=Number(_0xdc82f0[_0x35d7d1(0x1ea)]);if(_0xdc82f0[_0x35d7d1(0x1f5)]!==undefined)_0x416cd4[_0x35d7d1(0x1c0)]=Number(_0xdc82f0['retryLimit']);if(_0xdc82f0[_0x35d7d1(0x198)])_0x416cd4[_0x35d7d1(0x19f)]=_0xdc82f0[_0x35d7d1(0x198)];if(_0xdc82f0['result'])_0x416cd4[_0x35d7d1(0x1b1)]=_0xdc82f0[_0x35d7d1(0x1b1)];if(_0xdc82f0[_0x35d7d1(0x18f)])try{_0x416cd4['query']=readFileSync(_0xdc82f0['file'],_0x35d7d1(0x1fc))['trim']();}catch(_0x3ef68b){throw new SDKError(ErrorCode[_0x35d7d1(0x1be)],'Failed\x20to\x20read\x20file:\x20'+_0xdc82f0[_0x35d7d1(0x18f)],_0x3ef68b instanceof Error?_0x3ef68b:undefined);}if(Object[_0x35d7d1(0x204)](_0x416cd4)['length']===0x0)throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x35d7d1(0x1bd));if(_0x5728b4['verbose']){console[_0x35d7d1(0x19c)]('Updating\x20schedule:\x20'+_0x59a225);for(const [_0x3b66b5,_0x3a93c3]of Object[_0x35d7d1(0x187)](_0x416cd4)){_0x3b66b5==='query'?console[_0x35d7d1(0x19c)]('\x20\x20'+_0x3b66b5+':\x20'+_0x3a93c3[_0x35d7d1(0x1d1)](0x0,0x32)+'...'):console[_0x35d7d1(0x19c)]('\x20\x20'+_0x3b66b5+':\x20'+_0x3a93c3);}}const _0x47bd5a=await withSpinner(_0x35d7d1(0x1e9),()=>_0x3db169[_0x35d7d1(0x1af)][_0x35d7d1(0x1f0)](_0x59a225,_0x416cd4),{'verbose':_0x5728b4['verbose']});return console[_0x35d7d1(0x19c)](_0x35d7d1(0x184)+_0x47bd5a[_0x35d7d1(0x1ef)][_0x35d7d1(0x1df)]),await handleSingleObjectOutput(_0x47bd5a[_0x35d7d1(0x1ef)],_0x5728b4),0x0;}}export class ScheduleDeleteCommand extends BaseCommand{[a36_0x3d98d4(0x1df)]='schedule:delete';[a36_0x3d98d4(0x1ab)]=a36_0x3d98d4(0x1f4);['validate'](_0xc695e0){const _0x15172b=a36_0x3d98d4,_0x1824c2=_0xc695e0[_0x15172b(0x1f7)][0x0];if(!_0x1824c2)return _0x15172b(0x1f1);return undefined;}async[a36_0x3d98d4(0x196)](_0x32db63){const _0x39d64f=a36_0x3d98d4,{options:_0x402a96,args:_0x462e5e,tdx:_0x2aec63}=_0x32db63,_0x2b56bf=_0x462e5e[0x0];if(!_0x402a96[_0x39d64f(0x19b)]){const _0x314598=await confirm(_0x39d64f(0x1cf)+_0x2b56bf+'\x22?');if(!_0x314598)return console[_0x39d64f(0x19c)]('Cancelled'),0x0;}const _0x2a0724=await withSpinner(_0x39d64f(0x18a),()=>_0x2aec63[_0x39d64f(0x1af)][_0x39d64f(0x1cc)](_0x2b56bf),{'verbose':_0x402a96[_0x39d64f(0x199)]});return console[_0x39d64f(0x19c)](_0x39d64f(0x1d2)+_0x2a0724[_0x39d64f(0x1ef)]['name']),0x0;}}export class ScheduleRunCommand extends BaseCommand{[a36_0x3d98d4(0x1df)]=a36_0x3d98d4(0x1e4);[a36_0x3d98d4(0x1ab)]='Run\x20a\x20scheduled\x20query\x20immediately';[a36_0x3d98d4(0x1b0)](_0x115237){const _0x2f9fe0=a36_0x3d98d4,_0xf6a706=_0x115237[_0x2f9fe0(0x1f7)][0x0];if(!_0xf6a706)return'Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20run\x20<name>\x20[--time\x20<iso8601>]\x20[--num\x20<1-10>]';return undefined;}async['execute'](_0x5d6fb6){const _0xce6f9a=a36_0x3d98d4,{options:_0x21b6ab,args:_0x3bccbf,tdx:_0x29bd55}=_0x5d6fb6,_0x324b68=_0x3bccbf[0x0],_0x739612=_0x21b6ab,_0x5515d2=_0x739612[_0xce6f9a(0x18c)],_0x271884=_0x739612[_0xce6f9a(0x20a)]!==undefined?Number(_0x739612[_0xce6f9a(0x20a)]):undefined;if(_0x21b6ab[_0xce6f9a(0x199)]){console[_0xce6f9a(0x19c)]('Running\x20schedule:\x20'+_0x324b68);if(_0x5515d2)console['error'](_0xce6f9a(0x1d0)+_0x5515d2);if(_0x271884)console[_0xce6f9a(0x19c)](_0xce6f9a(0x1bb)+_0x271884);}const _0x2f041d=await withSpinner(_0xce6f9a(0x1bc),()=>_0x29bd55[_0xce6f9a(0x1af)][_0xce6f9a(0x1e5)](_0x324b68,{'time':_0x5515d2,'num':_0x271884}),{'verbose':_0x21b6ab[_0xce6f9a(0x199)]}),_0x698148=_0x2f041d[_0xce6f9a(0x1ef)]['jobs'];console['error']('Schedule\x20run\x20submitted:\x20'+_0x698148[_0xce6f9a(0x1dd)]+_0xce6f9a(0x1ae)+(_0x698148[_0xce6f9a(0x1dd)]!==0x1?'s':'')+_0xce6f9a(0x1d3));for(const _0x1b5dbc of _0x698148){console[_0xce6f9a(0x19c)]('\x20\x20Job\x20ID:\x20'+_0x1b5dbc[_0xce6f9a(0x1e1)]);}return await handleSDKOutput(_0x698148,_0x21b6ab),0x0;}}export class ScheduleHistoryCommand extends BaseCommand{[a36_0x3d98d4(0x1df)]=a36_0x3d98d4(0x19e);[a36_0x3d98d4(0x1ab)]=a36_0x3d98d4(0x20c);[a36_0x3d98d4(0x1b0)](_0x3276d5){const _0x47b81e=a36_0x3d98d4,_0x682fac=_0x3276d5[_0x47b81e(0x1f7)][0x0];if(!_0x682fac)return _0x47b81e(0x1e2);return undefined;}async[a36_0x3d98d4(0x196)](_0x9ca078){const _0x47d77c=a36_0x3d98d4,{options:_0x3ed0a2,args:_0x516dd1,tdx:_0x1c2afe}=_0x9ca078,_0x5e493c=_0x516dd1[0x0],_0x49e377=_0x3ed0a2,_0x44df65=_0x49e377[_0x47d77c(0x1c3)]!==undefined?Number(_0x49e377[_0x47d77c(0x1c3)]):undefined,_0x462a5f=_0x49e377['to']!==undefined?Number(_0x49e377['to']):undefined,_0x41ea2e=await withSpinner(_0x47d77c(0x194),()=>_0x1c2afe[_0x47d77c(0x1af)][_0x47d77c(0x1db)](_0x5e493c,{'from':_0x44df65,'to':_0x462a5f}),{'verbose':_0x3ed0a2['verbose']}),_0x5c3c78=_0x41ea2e[_0x47d77c(0x1ef)];console[_0x47d77c(0x19c)]('Found\x20'+_0x5c3c78[_0x47d77c(0x1e8)]+_0x47d77c(0x189)+(_0x5c3c78[_0x47d77c(0x1e8)]!==0x1?'s':'')+_0x47d77c(0x201)+_0x5c3c78[_0x47d77c(0x1c3)]+'-'+_0x5c3c78['to']+')');const _0xbdac81=_0x5c3c78[_0x47d77c(0x1db)][_0x47d77c(0x1b5)](_0x30b413=>({'job_id':_0x30b413['job_id'],'type':_0x30b413[_0x47d77c(0x1cb)],'status':_0x30b413['status'],'scheduled_at':_0x30b413['scheduled_at'],'created_at':_0x30b413[_0x47d77c(0x1ec)],'start_at':_0x30b413['start_at'],'end_at':_0x30b413[_0x47d77c(0x20d)]}));return await handleSDKOutput(_0xbdac81,_0x3ed0a2),0x0;}}
1
+ const a36_0x68d560=a36_0x1a26;function a36_0x3f01(){const _0x28f5fc=['Show\x20schedule\x20execution\x20history','length','📅\x20','retryLimit','priority','Schedule\x20run\x20submitted:\x20','Updating\x20schedule...','error','tsv','delete','json','limit','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20show\x20<name>','2154110RZPsFX','padEnd','type','cron','statusIcon','getTime','lastRun','table','Running\x20schedule:\x20','Cancelled','timezone','Run\x20a\x20scheduled\x20query\x20immediately','pagination','output','1359743gmEXZv','name','Getting\x20schedule\x20history...','Getting\x20schedule\x20details...','engine_version','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20run\x20<name>\x20[--time\x20<iso8601>]\x20[--num\x20<1-10>]','created_at','database','repeat','toLocaleDateString','red','Deleting\x20schedule...','has_next_page','Delete\x20a\x20scheduled\x20query','queryUrl','ies','execute','executing_user_id','\x20matching\x20\x22','18ZdKczO','15cnBUgx','At\x20least\x20one\x20option\x20must\x20be\x20provided\x20to\x20update','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20delete\x20<name>','utf-8','result','map','Creating\x20schedule...','\x20schedules','site','449346IaJJni','file','next_run_at','never','engineVersion','options','count','description','Showing\x20first\x20','\x20execution','listQueries','list','success','\x20\x20Job\x20ID:\x20','\x22...','round','\x20(use\x20--limit\x20to\x20see\x20more)','1213608jAatYL','join','jsonl','Query\x20file\x20is\x20empty','status','\x20\x20Cron:\x20','log','abs','/app/queries/editor?queryId=','create','time_zone','delay','just\x20now','validate','start_at','Found\x20','in\x20','Show\x20schedule\x20details','schedule:run','\x20\x20Database:\x20','Schedule\x20created:\x20','update','entries','last_job','Schedule\x20deleted:\x20','m\x20ago','1016888tFfmyJ','history','\x20(showing\x20','\x20\x20Timezone:\x20','schedule:create','(unnamed)','\x20\x20Time:\x20','query','time','ended_at','format','schedule:update','end_at','verbose','Schedule\x20updated:\x20','args','Updating\x20schedule:\x20','updated_at','queries','\x20\x20Num:\x20','nextRun','trim','993549NtHyVI','h\x20ago','\x20job','6cGdrMo','Failed\x20to\x20read\x20file:\x20','dim','Update\x20a\x20scheduled\x20query','job_id','user','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]','Running\x20schedule...','max','schedules','data','yes','retry_limit','44378MrDnhb','INVALID_ARGUMENT','from','schedule:list','\x20\x20Type:\x20','jobs','...','Database\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]','schedule:history','\x20scheduled\x20quer','Create\x20a\x20scheduled\x20query','Searching\x20scheduled\x20queries\x20matching\x20\x22'];a36_0x3f01=function(){return _0x28f5fc;};return a36_0x3f01();}(function(_0x1639da,_0x294a63){const _0x5a43a3=a36_0x1a26,_0x2f8645=_0x1639da();while(!![]){try{const _0xd1fbb5=parseInt(_0x5a43a3(0x20a))/0x1*(parseInt(_0x5a43a3(0x217))/0x2)+parseInt(_0x5a43a3(0x207))/0x3+parseInt(_0x5a43a3(0x1d7))/0x4+-parseInt(_0x5a43a3(0x1bd))/0x5*(parseInt(_0x5a43a3(0x1c6))/0x6)+parseInt(_0x5a43a3(0x23e))/0x7+-parseInt(_0x5a43a3(0x1f1))/0x8+-parseInt(_0x5a43a3(0x1bc))/0x9*(parseInt(_0x5a43a3(0x230))/0xa);if(_0xd1fbb5===_0x294a63)break;else _0x2f8645['push'](_0x2f8645['shift']());}catch(_0x2df6e2){_0x2f8645['push'](_0x2f8645['shift']());}}}(a36_0x3f01,0x2bca2));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_0x1a26(_0x843503,_0x813970){_0x843503=_0x843503-0x1aa;const _0x3f0117=a36_0x3f01();let _0x1a26f4=_0x3f0117[_0x843503];return _0x1a26f4;}import a36_0x3ea9b8 from'chalk';function formatRelativeTime(_0x2848f5){const _0xe626fd=a36_0x1a26,_0x4209c7=new Date(_0x2848f5),_0x232aea=new Date(),_0x32eb6a=_0x4209c7['getTime']()-_0x232aea[_0xe626fd(0x235)](),_0x33c47a=Math[_0xe626fd(0x1de)](_0x32eb6a)/0x3e8,_0x10740e=_0x32eb6a<0x0;if(_0x33c47a<0x3c)return _0x10740e?_0xe626fd(0x1e3):'soon';else{if(_0x33c47a<0xe10){const _0x469f20=Math[_0xe626fd(0x1d5)](_0x33c47a/0x3c);return _0x10740e?_0x469f20+_0xe626fd(0x1f0):_0xe626fd(0x1e7)+_0x469f20+'m';}else{if(_0x33c47a<0x15180){const _0x29e5a1=Math[_0xe626fd(0x1d5)](_0x33c47a/0xe10);return _0x10740e?_0x29e5a1+_0xe626fd(0x208):_0xe626fd(0x1e7)+_0x29e5a1+'h';}else{if(_0x33c47a<0x93a80){const _0x1f67a7=Math[_0xe626fd(0x1d5)](_0x33c47a/0x15180);return _0x10740e?_0x1f67a7+'d\x20ago':_0xe626fd(0x1e7)+_0x1f67a7+'d';}else return _0x4209c7[_0xe626fd(0x1b2)]();}}}}export class ScheduleListCommand extends BaseCommand{[a36_0x68d560(0x1aa)]=a36_0x68d560(0x21a);[a36_0x68d560(0x1cd)]='List\x20scheduled\x20queries';async['execute'](_0x4b598c){const _0x30f22e=a36_0x68d560,{options:_0xaa3d21,args:_0x293302,tdx:_0x5318fd}=_0x4b598c,_0x263d07=resolveLimit(_0xaa3d21[_0x30f22e(0x22e)],DEFAULT_DISPLAY_LIMIT),_0x1c263f=_0x293302[0x0],_0x5920e0=_0x1c263f?_0x30f22e(0x222)+_0x1c263f+_0x30f22e(0x1d4):'Listing\x20scheduled\x20queries...',_0x35f36f=await withSpinner(_0x5920e0,()=>_0x5318fd[_0x30f22e(0x213)][_0x30f22e(0x1d0)]({'limit':_0x263d07,'scheduled':!![],'pattern':_0x1c263f}),{'verbose':_0xaa3d21[_0x30f22e(0x1fe)]}),_0x1f25fe=_0x35f36f[_0x30f22e(0x214)][_0x30f22e(0x203)],_0x55c783=_0x35f36f[_0x30f22e(0x214)][_0x30f22e(0x23c)][_0x30f22e(0x1b5)],_0x79f197=_0x1c263f?_0x30f22e(0x1bb)+_0x1c263f+'\x22':'';_0x55c783?console[_0x30f22e(0x22a)](_0x30f22e(0x1ce)+_0x1f25fe['length']+_0x30f22e(0x1c4)+_0x79f197+_0x30f22e(0x1d6)):console['error'](_0x30f22e(0x1e6)+_0x1f25fe[_0x30f22e(0x224)]+_0x30f22e(0x220)+(_0x1f25fe[_0x30f22e(0x224)]!==0x1?_0x30f22e(0x1b8):'y')+_0x79f197);if(_0xaa3d21[_0x30f22e(0x1fb)]===_0x30f22e(0x22d)||_0xaa3d21[_0x30f22e(0x1fb)]===_0x30f22e(0x1d9)||_0xaa3d21[_0x30f22e(0x1fb)]===_0x30f22e(0x237)||_0xaa3d21['format']===_0x30f22e(0x22b)){const _0x321a40=_0x1f25fe[_0x30f22e(0x1c2)](_0x993da2=>({'id':_0x993da2['id'],'name':_0x993da2[_0x30f22e(0x1aa)],'cron':_0x993da2['cron'],'database':_0x993da2[_0x30f22e(0x1b0)]?.[_0x30f22e(0x1aa)],'type':_0x993da2[_0x30f22e(0x232)],'timezone':_0x993da2[_0x30f22e(0x1e1)],'user_name':_0x993da2[_0x30f22e(0x20f)]?.[_0x30f22e(0x1aa)],'updated_at':_0x993da2[_0x30f22e(0x202)],'next_run_at':_0x993da2[_0x30f22e(0x1c8)],'last_job_status':_0x993da2[_0x30f22e(0x1ee)]?.['status']}));await handleSDKOutput(_0x321a40,_0xaa3d21);}else{if(_0x1f25fe['length']===0x0)console[_0x30f22e(0x1dd)]('No\x20scheduled\x20queries\x20found');else{const _0x40bf61=_0xaa3d21[_0x30f22e(0x1c5)],_0x34d70a=_0x1f25fe[_0x30f22e(0x1c2)](_0x503bbe=>{const _0x30fed4=_0x30f22e,_0xd6c851=_0x503bbe[_0x30fed4(0x1ee)]?.[_0x30fed4(0x1db)]?_0x503bbe[_0x30fed4(0x1ee)][_0x30fed4(0x1db)]===_0x30fed4(0x1d2)?'✓':'✗':'-',_0x30ae4f=_0x503bbe[_0x30fed4(0x1ee)]?.[_0x30fed4(0x1fa)]?formatRelativeTime(_0x503bbe[_0x30fed4(0x1ee)][_0x30fed4(0x1fa)]):_0x30fed4(0x1c9),_0x12847c=_0x503bbe[_0x30fed4(0x1c8)]?formatRelativeTime(_0x503bbe[_0x30fed4(0x1c8)]):'-',_0x36d13b=_0x503bbe[_0x30fed4(0x233)]||'',_0x29f785=_0x503bbe['name']||_0x30fed4(0x1f6),_0x3e282a=getConsoleUrl(_0x40bf61,_0x30fed4(0x1df)+_0x503bbe['id']);return{'statusIcon':_0xd6c851,'lastRun':_0x30ae4f,'nextRun':_0x12847c,'cron':_0x36d13b,'name':_0x29f785,'queryUrl':_0x3e282a,'status':_0x503bbe['last_job']?.[_0x30fed4(0x1db)]};}),_0x17e5ff=Math[_0x30f22e(0x212)](..._0x34d70a[_0x30f22e(0x1c2)](_0x3a00f6=>_0x3a00f6[_0x30f22e(0x236)][_0x30f22e(0x224)])),_0x1a4082=Math[_0x30f22e(0x212)](..._0x34d70a[_0x30f22e(0x1c2)](_0x3c705d=>_0x3c705d['nextRun'][_0x30f22e(0x224)])),_0x1cc7bc=Math[_0x30f22e(0x212)](..._0x34d70a[_0x30f22e(0x1c2)](_0x326e96=>_0x326e96[_0x30f22e(0x233)][_0x30f22e(0x224)])),_0x5b4076=_0x34d70a[_0x30f22e(0x1c2)](_0x1e01cb=>{const _0x2d9041=_0x30f22e,_0xd971eb=_0x1e01cb[_0x2d9041(0x1db)]==='success'?a36_0x3ea9b8['green'](_0x1e01cb['statusIcon']):_0x1e01cb[_0x2d9041(0x1db)]==='error'?a36_0x3ea9b8[_0x2d9041(0x1b3)](_0x1e01cb[_0x2d9041(0x234)]):a36_0x3ea9b8[_0x2d9041(0x20c)](_0x1e01cb[_0x2d9041(0x234)]),_0x2c2daf=_0x1e01cb['lastRun'][_0x2d9041(0x231)](_0x17e5ff),_0x24e761=_0x1e01cb[_0x2d9041(0x205)]['padEnd'](_0x1a4082),_0x13d871=_0x1e01cb[_0x2d9041(0x233)]?a36_0x3ea9b8['cyan'](_0x1e01cb[_0x2d9041(0x233)][_0x2d9041(0x231)](_0x1cc7bc)):'\x20'[_0x2d9041(0x1b1)](_0x1cc7bc),_0x43ba5b=hyperlink(_0x1e01cb[_0x2d9041(0x1aa)],_0x1e01cb[_0x2d9041(0x1b7)]);return _0x2d9041(0x225)+_0xd971eb+'\x20'+_0x2c2daf+'\x20\x20→\x20'+_0x24e761+'\x20\x20'+_0x13d871+'\x20\x20'+_0x43ba5b;});await writeOutput(_0x5b4076[_0x30f22e(0x1d8)]('\x0a'),_0xaa3d21[_0x30f22e(0x23d)],_0x30f22e(0x1d1));}}return 0x0;}}export class ScheduleShowCommand extends BaseCommand{[a36_0x68d560(0x1aa)]='schedule:show';[a36_0x68d560(0x1cd)]=a36_0x68d560(0x1e8);[a36_0x68d560(0x1e4)](_0x6babec){const _0x1170cf=a36_0x68d560,_0x47f346=_0x6babec[_0x1170cf(0x200)][0x0];if(!_0x47f346)return _0x1170cf(0x22f);return undefined;}async[a36_0x68d560(0x1b9)](_0x4ed611){const _0x108ea0=a36_0x68d560,{options:_0x4b6724,args:_0x49dcbc,tdx:_0x356ca2}=_0x4ed611,_0x3e1d52=_0x49dcbc[0x0],_0x3d301a=await withSpinner(_0x108ea0(0x1ac),()=>_0x356ca2[_0x108ea0(0x213)]['show'](_0x3e1d52),{'verbose':_0x4b6724[_0x108ea0(0x1fe)]}),_0x1c8f0e=_0x3d301a[_0x108ea0(0x214)],_0x303b61={'name':_0x1c8f0e[_0x108ea0(0x1aa)],'cron':_0x1c8f0e[_0x108ea0(0x233)],'database':_0x1c8f0e[_0x108ea0(0x1b0)],'type':_0x1c8f0e[_0x108ea0(0x232)],'timezone':_0x1c8f0e[_0x108ea0(0x23a)],'user_name':_0x1c8f0e['user_name'],'created_at':_0x1c8f0e[_0x108ea0(0x1af)],'engine_version':_0x1c8f0e['engine_version'],'executing_user_id':_0x1c8f0e[_0x108ea0(0x1ba)],'query':_0x1c8f0e['query'],'delay':_0x1c8f0e[_0x108ea0(0x1e2)],'priority':_0x1c8f0e['priority'],'retry_limit':_0x1c8f0e['retry_limit'],..._0x1c8f0e[_0x108ea0(0x1c1)]&&{'result':_0x1c8f0e[_0x108ea0(0x1c1)]}};return await handleSingleObjectOutput(_0x303b61,_0x4b6724),0x0;}}export class ScheduleCreateCommand extends BaseCommand{[a36_0x68d560(0x1aa)]=a36_0x68d560(0x1f5);[a36_0x68d560(0x1cd)]=a36_0x68d560(0x221);['validate'](_0x2bd406){const _0x40e9c3=a36_0x68d560,_0x1b52a6=_0x2bd406[_0x40e9c3(0x200)][0x0];if(!_0x1b52a6)return _0x40e9c3(0x210);const _0x1e31cb=_0x2bd406[_0x40e9c3(0x1cb)];if(!_0x1e31cb[_0x40e9c3(0x1b0)])return _0x40e9c3(0x21e);return undefined;}async[a36_0x68d560(0x1b9)](_0x3ffc5d){const _0x255a8a=a36_0x68d560,{options:_0xa361ba,args:_0x5929ab,tdx:_0x20c89a}=_0x3ffc5d,_0x39474c=_0x5929ab[0x0],_0x209fbc=_0xa361ba,_0x4efb54=_0x209fbc[_0x255a8a(0x1b0)],_0x49ffdd=_0x209fbc[_0x255a8a(0x1c7)],_0x30c171=_0x209fbc[_0x255a8a(0x232)]||'trino';let _0x213b21;try{_0x213b21=readFileSync(_0x49ffdd,'utf-8')[_0x255a8a(0x206)]();}catch(_0x5c5668){throw new SDKError(ErrorCode[_0x255a8a(0x218)],_0x255a8a(0x20b)+_0x49ffdd,_0x5c5668 instanceof Error?_0x5c5668:undefined);}if(!_0x213b21)throw new SDKError(ErrorCode[_0x255a8a(0x218)],_0x255a8a(0x1da));const _0x1f398b={'database':_0x4efb54,'query':_0x213b21,'type':_0x30c171};if(_0x209fbc[_0x255a8a(0x233)])_0x1f398b[_0x255a8a(0x233)]=_0x209fbc[_0x255a8a(0x233)];if(_0x209fbc['timezone'])_0x1f398b[_0x255a8a(0x23a)]=_0x209fbc[_0x255a8a(0x23a)];if(_0x209fbc['delay']!==undefined)_0x1f398b[_0x255a8a(0x1e2)]=Number(_0x209fbc[_0x255a8a(0x1e2)]);if(_0x209fbc['priority']!==undefined)_0x1f398b['priority']=Number(_0x209fbc['priority']);if(_0x209fbc[_0x255a8a(0x226)]!==undefined)_0x1f398b[_0x255a8a(0x216)]=Number(_0x209fbc[_0x255a8a(0x226)]);if(_0x209fbc['engineVersion'])_0x1f398b[_0x255a8a(0x1ad)]=_0x209fbc[_0x255a8a(0x1ca)];if(_0x209fbc[_0x255a8a(0x1c1)])_0x1f398b[_0x255a8a(0x1c1)]=_0x209fbc['result'];if(_0xa361ba[_0x255a8a(0x1fe)]){console[_0x255a8a(0x22a)]('Creating\x20schedule:\x20'+_0x39474c),console[_0x255a8a(0x22a)](_0x255a8a(0x1ea)+_0x4efb54),console[_0x255a8a(0x22a)](_0x255a8a(0x21b)+_0x30c171);if(_0x1f398b['cron'])console['error'](_0x255a8a(0x1dc)+_0x1f398b[_0x255a8a(0x233)]);if(_0x1f398b[_0x255a8a(0x23a)])console[_0x255a8a(0x22a)](_0x255a8a(0x1f4)+_0x1f398b[_0x255a8a(0x23a)]);}const _0x44ec53=await withSpinner(_0x255a8a(0x1c3),()=>_0x20c89a['schedules'][_0x255a8a(0x1e0)](_0x39474c,_0x1f398b),{'verbose':_0xa361ba[_0x255a8a(0x1fe)]});return console[_0x255a8a(0x22a)](_0x255a8a(0x1eb)+_0x44ec53['data'][_0x255a8a(0x1aa)]),await handleSingleObjectOutput(_0x44ec53[_0x255a8a(0x214)],_0xa361ba),0x0;}}export class ScheduleUpdateCommand extends BaseCommand{[a36_0x68d560(0x1aa)]=a36_0x68d560(0x1fc);[a36_0x68d560(0x1cd)]=a36_0x68d560(0x20d);[a36_0x68d560(0x1e4)](_0xe5d0f5){const _0x337806=a36_0x68d560,_0x334eba=_0xe5d0f5[_0x337806(0x200)][0x0];if(!_0x334eba)return'Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20update\x20<name>\x20[options]';return undefined;}async[a36_0x68d560(0x1b9)](_0x5aac03){const _0x5d7ff9=a36_0x68d560,{options:_0x510cd0,args:_0xc9645a,tdx:_0x505a13}=_0x5aac03,_0x2b9aa7=_0xc9645a[0x0],_0x15b86=_0x510cd0,_0x4d2bfb={};if(_0x15b86['database'])_0x4d2bfb[_0x5d7ff9(0x1b0)]=_0x15b86[_0x5d7ff9(0x1b0)];if(_0x15b86[_0x5d7ff9(0x232)])_0x4d2bfb[_0x5d7ff9(0x232)]=_0x15b86[_0x5d7ff9(0x232)];if(_0x15b86[_0x5d7ff9(0x233)])_0x4d2bfb[_0x5d7ff9(0x233)]=_0x15b86[_0x5d7ff9(0x233)];if(_0x15b86[_0x5d7ff9(0x23a)])_0x4d2bfb[_0x5d7ff9(0x23a)]=_0x15b86['timezone'];if(_0x15b86[_0x5d7ff9(0x1e2)]!==undefined)_0x4d2bfb['delay']=Number(_0x15b86[_0x5d7ff9(0x1e2)]);if(_0x15b86[_0x5d7ff9(0x227)]!==undefined)_0x4d2bfb[_0x5d7ff9(0x227)]=Number(_0x15b86['priority']);if(_0x15b86[_0x5d7ff9(0x226)]!==undefined)_0x4d2bfb[_0x5d7ff9(0x216)]=Number(_0x15b86[_0x5d7ff9(0x226)]);if(_0x15b86[_0x5d7ff9(0x1ca)])_0x4d2bfb['engine_version']=_0x15b86[_0x5d7ff9(0x1ca)];if(_0x15b86[_0x5d7ff9(0x1c1)])_0x4d2bfb[_0x5d7ff9(0x1c1)]=_0x15b86[_0x5d7ff9(0x1c1)];if(_0x15b86[_0x5d7ff9(0x1c7)])try{_0x4d2bfb[_0x5d7ff9(0x1f8)]=readFileSync(_0x15b86['file'],_0x5d7ff9(0x1c0))['trim']();}catch(_0x3524ee){throw new SDKError(ErrorCode[_0x5d7ff9(0x218)],_0x5d7ff9(0x20b)+_0x15b86[_0x5d7ff9(0x1c7)],_0x3524ee instanceof Error?_0x3524ee:undefined);}if(Object['keys'](_0x4d2bfb)[_0x5d7ff9(0x224)]===0x0)throw new SDKError(ErrorCode[_0x5d7ff9(0x218)],_0x5d7ff9(0x1be));if(_0x510cd0[_0x5d7ff9(0x1fe)]){console[_0x5d7ff9(0x22a)](_0x5d7ff9(0x201)+_0x2b9aa7);for(const [_0x562516,_0x4e7367]of Object[_0x5d7ff9(0x1ed)](_0x4d2bfb)){_0x562516===_0x5d7ff9(0x1f8)?console[_0x5d7ff9(0x22a)]('\x20\x20'+_0x562516+':\x20'+_0x4e7367['substring'](0x0,0x32)+_0x5d7ff9(0x21d)):console['error']('\x20\x20'+_0x562516+':\x20'+_0x4e7367);}}const _0x53fd32=await withSpinner(_0x5d7ff9(0x229),()=>_0x505a13[_0x5d7ff9(0x213)][_0x5d7ff9(0x1ec)](_0x2b9aa7,_0x4d2bfb),{'verbose':_0x510cd0[_0x5d7ff9(0x1fe)]});return console[_0x5d7ff9(0x22a)](_0x5d7ff9(0x1ff)+_0x53fd32[_0x5d7ff9(0x214)]['name']),await handleSingleObjectOutput(_0x53fd32['data'],_0x510cd0),0x0;}}export class ScheduleDeleteCommand extends BaseCommand{[a36_0x68d560(0x1aa)]='schedule:delete';['description']=a36_0x68d560(0x1b6);[a36_0x68d560(0x1e4)](_0x6043cc){const _0x231f3e=a36_0x68d560,_0x51e480=_0x6043cc[_0x231f3e(0x200)][0x0];if(!_0x51e480)return _0x231f3e(0x1bf);return undefined;}async[a36_0x68d560(0x1b9)](_0x92d221){const _0x12ae07=a36_0x68d560,{options:_0x557f7e,args:_0x1d9cb1,tdx:_0x2ce391}=_0x92d221,_0x174c05=_0x1d9cb1[0x0];if(!_0x557f7e[_0x12ae07(0x215)]){const _0x44dd14=await confirm('Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20schedule\x20\x22'+_0x174c05+'\x22?');if(!_0x44dd14)return console[_0x12ae07(0x22a)](_0x12ae07(0x239)),0x0;}const _0x25efe9=await withSpinner(_0x12ae07(0x1b4),()=>_0x2ce391['schedules'][_0x12ae07(0x22c)](_0x174c05),{'verbose':_0x557f7e['verbose']});return console[_0x12ae07(0x22a)](_0x12ae07(0x1ef)+_0x25efe9[_0x12ae07(0x214)][_0x12ae07(0x1aa)]),0x0;}}export class ScheduleRunCommand extends BaseCommand{[a36_0x68d560(0x1aa)]=a36_0x68d560(0x1e9);['description']=a36_0x68d560(0x23b);[a36_0x68d560(0x1e4)](_0x182351){const _0x2d7973=a36_0x68d560,_0xa49802=_0x182351[_0x2d7973(0x200)][0x0];if(!_0xa49802)return _0x2d7973(0x1ae);return undefined;}async[a36_0x68d560(0x1b9)](_0x169c9f){const _0x1f042b=a36_0x68d560,{options:_0x56486b,args:_0x216edd,tdx:_0xb620ac}=_0x169c9f,_0x1003a5=_0x216edd[0x0],_0x278fce=_0x56486b,_0x253df3=_0x278fce[_0x1f042b(0x1f9)],_0x5cdf22=_0x278fce['num']!==undefined?Number(_0x278fce['num']):undefined;if(_0x56486b[_0x1f042b(0x1fe)]){console[_0x1f042b(0x22a)](_0x1f042b(0x238)+_0x1003a5);if(_0x253df3)console[_0x1f042b(0x22a)](_0x1f042b(0x1f7)+_0x253df3);if(_0x5cdf22)console[_0x1f042b(0x22a)](_0x1f042b(0x204)+_0x5cdf22);}const _0xa37aa4=await withSpinner(_0x1f042b(0x211),()=>_0xb620ac[_0x1f042b(0x213)]['run'](_0x1003a5,{'time':_0x253df3,'num':_0x5cdf22}),{'verbose':_0x56486b['verbose']}),_0x40e75e=_0xa37aa4['data'][_0x1f042b(0x21c)];console[_0x1f042b(0x22a)](_0x1f042b(0x228)+_0x40e75e['length']+_0x1f042b(0x209)+(_0x40e75e[_0x1f042b(0x224)]!==0x1?'s':'')+'\x20created');for(const _0x2c505e of _0x40e75e){console[_0x1f042b(0x22a)](_0x1f042b(0x1d3)+_0x2c505e[_0x1f042b(0x20e)]);}return await handleSDKOutput(_0x40e75e,_0x56486b),0x0;}}export class ScheduleHistoryCommand extends BaseCommand{['name']=a36_0x68d560(0x21f);[a36_0x68d560(0x1cd)]=a36_0x68d560(0x223);[a36_0x68d560(0x1e4)](_0x10da44){const _0x593fdc=a36_0x68d560,_0xe9153c=_0x10da44[_0x593fdc(0x200)][0x0];if(!_0xe9153c)return'Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20history\x20<name>\x20[--from\x20<n>]\x20[--to\x20<n>]';return undefined;}async[a36_0x68d560(0x1b9)](_0x6260e1){const _0xf1ec17=a36_0x68d560,{options:_0x1ed0ee,args:_0x3f6dd6,tdx:_0xcbfc29}=_0x6260e1,_0x199a32=_0x3f6dd6[0x0],_0x2fde1a=_0x1ed0ee,_0x4be318=_0x2fde1a[_0xf1ec17(0x219)]!==undefined?Number(_0x2fde1a[_0xf1ec17(0x219)]):undefined,_0x2d892d=_0x2fde1a['to']!==undefined?Number(_0x2fde1a['to']):undefined,_0x9f5ed=await withSpinner(_0xf1ec17(0x1ab),()=>_0xcbfc29[_0xf1ec17(0x213)]['history'](_0x199a32,{'from':_0x4be318,'to':_0x2d892d}),{'verbose':_0x1ed0ee[_0xf1ec17(0x1fe)]}),_0x9c9cd=_0x9f5ed['data'];console['error'](_0xf1ec17(0x1e6)+_0x9c9cd['count']+_0xf1ec17(0x1cf)+(_0x9c9cd[_0xf1ec17(0x1cc)]!==0x1?'s':'')+_0xf1ec17(0x1f3)+_0x9c9cd['from']+'-'+_0x9c9cd['to']+')');const _0x122ac6=_0x9c9cd[_0xf1ec17(0x1f2)][_0xf1ec17(0x1c2)](_0x5133a6=>({'job_id':_0x5133a6[_0xf1ec17(0x20e)],'type':_0x5133a6[_0xf1ec17(0x232)],'status':_0x5133a6['status'],'scheduled_at':_0x5133a6['scheduled_at'],'created_at':_0x5133a6[_0xf1ec17(0x1af)],'start_at':_0x5133a6[_0xf1ec17(0x1e5)],'end_at':_0x5133a6[_0xf1ec17(0x1fd)]}));return await handleSDKOutput(_0x122ac6,_0x1ed0ee),0x0;}}
@@ -1 +1 @@
1
- const a37_0x64e536=a37_0x1650;(function(_0x53abed,_0x59e50a){const _0x24fda3=a37_0x1650,_0x2386d5=_0x53abed();while(!![]){try{const _0x28c3ad=parseInt(_0x24fda3(0x268))/0x1+parseInt(_0x24fda3(0x22f))/0x2*(parseInt(_0x24fda3(0x20f))/0x3)+parseInt(_0x24fda3(0x243))/0x4+parseInt(_0x24fda3(0x21d))/0x5+-parseInt(_0x24fda3(0x1f1))/0x6*(parseInt(_0x24fda3(0x21c))/0x7)+-parseInt(_0x24fda3(0x24c))/0x8+-parseInt(_0x24fda3(0x1f0))/0x9;if(_0x28c3ad===_0x59e50a)break;else _0x2386d5['push'](_0x2386d5['shift']());}catch(_0x5a0f8d){_0x2386d5['push'](_0x2386d5['shift']());}}}(a37_0x31c4,0xc9124));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';function a37_0x31c4(){const _0x944143=['✔\x20Created\x20folder\x20\x27','Error:\x20Cannot\x20view\x20parent\x20segment\x20details\x20with\x20this\x20command.','Usage:','segment:folder:show','Resolved\x20YAML\x20file:\x20','segment','Resolving\x20parent\x20folder\x20\x27','log','segment:folder:create','Segment\x20ID:\x20','✔\x20Found\x20','Cannot\x20get\x20SQL\x20for\x20parent\x20segment\x20with\x20this\x20command.\x20Use:\x20tdx\x20ps\x20sql','Fetching\x20SQL\x20for\x20segment...','content','query','cyan','✔\x20Query\x20completed:\x20Processed\x20','\x20folder','\x20\x20Segment\x20name:\x20','limit','11862666JWAtRs','1128108CrHooI','Show\x20segment\x20or\x20folder\x20details','Error:\x20Cannot\x20execute\x20query\x20for\x20parent\x20segment\x20with\x20this\x20command.','Site:\x20','Target\x20path:\x20','\x20\x20Folder\x20path:\x20','Segment\x20ID\x20missing\x20from\x20resolved\x20path','Fetching\x20folder\x20details...','\x20rows\x20','Examples:','Options:','\x27...','Error:\x20Specify\x20either\x20segment\x20name\x20or\x20--path,\x20not\x20both','Resolving\x20path\x20\x27','Parent\x20segment:\x20','Error:\x20Cannot\x20show\x20schema\x20for\x20a\x20folder.','getSQLFromServerSegment','Resolved\x20type:\x20','/app/ps/','resolveFolderId','Fetching\x20SQL\x20from\x20rule...','web','Usage:\x20tdx\x20segment\x20folder\x20list\x20<parent_name>','SEGMENT_FOLDER_NOT_FOUND','Error:\x20Segment\x20name\x20or\x20--path\x20is\x20required','Use:\x20tdx\x20ps\x20view\x20-w','Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required','Error:\x20Cannot\x20execute\x20SQL\x20query\x20on\x20a\x20folder.','Create\x20segment\x20folder\x20for\x20organization','Cannot\x20get\x20SQL\x20query\x20for\x20a\x20folder.\x20Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.','15RpYBnS','error','Error:\x20Parent\x20segment\x20name\x20and\x20folder\x20name\x20are\x20required','parentSegment','SELECT\x20*\x20FROM\x20(\x0a','path','getSegmentSQLFromYaml','Resolving\x20parent\x20segment\x20\x27','Parent\x20name:\x20','\x20\x20Cause:\x20','folder','fullPath','segment:folder:list','42YhqvCN','7139175RPlyRi','parentId','setJobId','Folder\x20ID\x20missing\x20from\x20resolved\x20path','Resolving\x20\x27','✖\x20Query\x20failed\x20[','\x20\x20tdx\x20sg\x20view\x20\x22Marketing\x22\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20folder\x20details','Parent\x20ID:\x20','Folder\x20name:\x20','segment:describe','red','Usage:\x20tdx\x20segment\x20folder\x20create\x20<parent_name>\x20<folder_name>\x20[options]','INVALID_ARGUMENT','getSegmentSQL','Execute\x20child\x20segment\x20SQL\x20query\x20and\x20show\x20results','Use:\x20tdx\x20ps\x20show','segment:view','Error:\x20Parent\x20segment\x20name\x20is\x20required','445838IIcOlq','\x20\x20tdx\x20sg\x20show\x20\x22Premium\x20Users\x22','Use:\x20tdx\x20sg\x20view\x20<name>\x20\x20#\x20To\x20show\x20folder\x20details','\x20\x20tdx\x20sg\x20sql\x20--path\x20segments/my-audience/premium-users.yml','Show\x20child\x20segment\x20schema\x20(column\x20types)','type','verbose','Error:\x20Path\x20or\x20name\x20is\x20required','parent','Fetching\x20parent\x20segment\x20details...','json','\x20\x20Parent\x20segment:\x20','format','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20view\x20<path/to/segment.yml>','elapsedTimeMillis','\x20\x20tdx\x20sg\x20sql\x20--path\x20','jobId','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20\x20\x20\x20\x20#\x20View\x20child\x20segment\x20details','segmentName','\x20\x20tdx\x20sg\x20show\x20segments/my-audience/premium-users.yml','5350832AFulFF','getSegment','Resolved\x20relative\x20path\x20to:\x20','execute','(root)','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20desc\x20<path/to/segment.yml>','getSQLFromYamlFile','listFolders','Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20','9506592ATgHZc','getParent','\x20\x20tdx\x20sg\x20view\x20segments/my-audience/premium-users.yml','data','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20show\x20<path/to/segment.yml>','SEGMENT_NOT_FOUND','Executing\x20segment\x20query...','Resolved\x20parent\x20ID:\x20','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','SQL\x20query:\x0a','cause','url','segment:sql','message','trim','includes','Usage:\x20tdx\x20sg\x20view\x20<name>\x20[-w]','parentFolder','Use:\x20tdx\x20ps\x20view','description','length','/e/','code','Error:\x20Cannot\x20open\x20folder\x20in\x20web\x20browser.\x20Use\x20a\x20segment\x20name\x20instead.','Error:\x20','site','stats','folderId','577956TYgHoe','Error:\x20Folder\x20reference\x20is\x20required','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','Show\x20folder\x20or\x20child\x20segment\x20details','List\x20segment\x20folders\x20under\x20a\x20parent\x20segment','Usage:\x20tdx\x20sg\x20desc\x20<name>','Resolved:\x20','getFolder','Listing\x20folders\x20for\x20parent\x20\x27','resolvePathToResource','segmentId','Resolved\x20folder\x20ID:\x20','resolveParentId','Folder\x20ID:\x20','replace','Usage:\x20tdx\x20sg\x20show\x20<name>','\x20\x20-w,\x20--web\x20\x20Open\x20segment\x20in\x20web\x20browser','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience\x22','name','test','createFolder','segmentPath','segment:desc','\x20[Job\x20ID:\x20','\x20\x20Server-side\x20segment:\x20\x20tdx\x20sg\x20sql\x20<name>','segment:show','\x20\x20tdx\x20sg\x20desc\x20segments/my-audience/premium-users.yml','\x20\x20tdx\x20segment\x20describe\x20\x22High\x20Value\x22\x20\x20\x20\x20#\x20Relative\x20to\x20current\x20context'];a37_0x31c4=function(){return _0x944143;};return a37_0x31c4();}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_0x2bf224 from'chalk';async function resolveSegmentTarget(_0x3d1b1a,_0x268746,_0x2d464a){const _0x32fcec=a37_0x1650;if(isYamlFilePath(_0x3d1b1a))try{const _0x1a4d08=await resolveYamlFilePath(_0x3d1b1a);return _0x2d464a&&(console[_0x32fcec(0x210)](_0x32fcec(0x1e0)+_0x3d1b1a),console[_0x32fcec(0x210)](_0x32fcec(0x23a)+_0x1a4d08[_0x32fcec(0x212)]),console[_0x32fcec(0x210)](_0x32fcec(0x1ee)+_0x1a4d08[_0x32fcec(0x241)]),console['error'](_0x32fcec(0x1f6)+(_0x1a4d08['folderPath']||_0x32fcec(0x247))),console[_0x32fcec(0x210)]('\x20\x20Full\x20path:\x20'+_0x1a4d08[_0x32fcec(0x21a)])),_0x1a4d08[_0x32fcec(0x21a)];}catch(_0xabccc0){throw new SDKError(ErrorCode[_0x32fcec(0x229)],_0x32fcec(0x24b)+_0xabccc0['message']);}if(!_0x268746)throw new SDKError(ErrorCode[_0x32fcec(0x229)],'No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22');return _0x268746+'/'+_0x3d1b1a;}export class SegmentDescribeCommand extends BaseCommand{[a37_0x64e536(0x1d2)]=a37_0x64e536(0x226);[a37_0x64e536(0x25f)]=a37_0x64e536(0x1f2);async['execute'](_0x37c106){const _0x3aeb8e=a37_0x64e536,{options:_0x184c62,args:_0x370707,tdx:_0x34160b}=_0x37c106,_0x3ac631=_0x370707[0x0],_0x1efcd4=!_0x3ac631&&!!_0x184c62['parentSegment'],_0x26b50a=_0x3ac631||_0x184c62[_0x3aeb8e(0x212)];if(!_0x26b50a)return console['error'](_0x3aeb8e(0x236)),console['error']('Usage:\x20tdx\x20segment\x20describe\x20<path>'),console[_0x3aeb8e(0x210)]('Examples:'),console[_0x3aeb8e(0x210)](_0x3aeb8e(0x1d1)),console[_0x3aeb8e(0x210)]('\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience/Marketing/High\x20Value\x22'),console['error'](_0x3aeb8e(0x1db)),console[_0x3aeb8e(0x210)](_0x3aeb8e(0x26a)),0x1;try{const _0x26ad89=_0x184c62[_0x3aeb8e(0x1d5)];let _0x31c5d7=_0x26b50a;!_0x1efcd4&&_0x26ad89&&!_0x26b50a[_0x3aeb8e(0x25b)]('/')&&(_0x31c5d7=_0x26ad89+'/'+_0x26b50a,_0x184c62['verbose']&&console[_0x3aeb8e(0x210)](_0x3aeb8e(0x245)+_0x31c5d7));const _0x18ea01=await withSpinner(_0x3aeb8e(0x1fe)+_0x31c5d7+'\x27...',()=>_0x34160b[_0x3aeb8e(0x1e1)][_0x3aeb8e(0x271)](_0x31c5d7),{'verbose':_0x184c62[_0x3aeb8e(0x235)]}),_0x4e4ae0=_0x18ea01[_0x3aeb8e(0x24f)];_0x184c62['verbose']&&(console[_0x3aeb8e(0x210)](_0x3aeb8e(0x202)+_0x4e4ae0['type']),console[_0x3aeb8e(0x210)](_0x3aeb8e(0x224)+_0x4e4ae0['parentId']),_0x4e4ae0['folderId']&&console['error'](_0x3aeb8e(0x275)+_0x4e4ae0['folderId']),_0x4e4ae0['segmentId']&&console[_0x3aeb8e(0x210)](_0x3aeb8e(0x1e5)+_0x4e4ae0['segmentId']));if(_0x4e4ae0[_0x3aeb8e(0x234)]===_0x3aeb8e(0x237)){const _0x121610=await withSpinner(_0x3aeb8e(0x238),()=>_0x34160b['segment'][_0x3aeb8e(0x24d)](_0x4e4ae0[_0x3aeb8e(0x21e)]),{'verbose':_0x184c62[_0x3aeb8e(0x235)]});await handleSingleObjectOutput(_0x121610['data'],_0x184c62);}else{if(_0x4e4ae0[_0x3aeb8e(0x234)]===_0x3aeb8e(0x219)){if(!_0x4e4ae0['folderId'])throw new SDKError(ErrorCode['SEGMENT_FOLDER_NOT_FOUND'],_0x3aeb8e(0x220));const _0x1d64a1=await withSpinner('Fetching\x20folder\x20details...',()=>_0x34160b[_0x3aeb8e(0x1e1)][_0x3aeb8e(0x26f)](_0x4e4ae0[_0x3aeb8e(0x267)]),{'verbose':_0x184c62[_0x3aeb8e(0x235)]});await handleSingleObjectOutput(_0x1d64a1['data'],_0x184c62);}else{if(_0x4e4ae0[_0x3aeb8e(0x234)]===_0x3aeb8e(0x1e1)){if(!_0x4e4ae0[_0x3aeb8e(0x272)])throw new SDKError(ErrorCode[_0x3aeb8e(0x251)],_0x3aeb8e(0x1f7));const _0x5840e7=await withSpinner('Fetching\x20segment\x20details...',()=>_0x34160b[_0x3aeb8e(0x1e1)][_0x3aeb8e(0x244)](_0x4e4ae0[_0x3aeb8e(0x21e)],_0x4e4ae0[_0x3aeb8e(0x272)]),{'verbose':_0x184c62[_0x3aeb8e(0x235)]});await handleSingleObjectOutput(_0x5840e7[_0x3aeb8e(0x24f)],_0x184c62);}}}return 0x0;}catch(_0x57e343){if(_0x57e343 instanceof SDKError)return console['error'](_0x3aeb8e(0x264)+_0x57e343[_0x3aeb8e(0x259)]),_0x57e343[_0x3aeb8e(0x256)]&&console[_0x3aeb8e(0x210)](_0x3aeb8e(0x218)+_0x57e343[_0x3aeb8e(0x256)]),0x1;throw _0x57e343;}}}export class SegmentShowCommand extends BaseCommand{[a37_0x64e536(0x1d2)]=a37_0x64e536(0x1d9);[a37_0x64e536(0x25f)]=a37_0x64e536(0x22b);async['execute'](_0x41a3be){const _0x5b9596=a37_0x64e536,{options:_0x209bd2,args:_0xd1690,tdx:_0x426bbe}=_0x41a3be,_0x265bc1=_0xd1690[0x0];if(!_0x265bc1)return console[_0x5b9596(0x210)](_0x5b9596(0x20b)),console[_0x5b9596(0x210)](_0x5b9596(0x1cf)),console[_0x5b9596(0x210)](_0x5b9596(0x250)),console[_0x5b9596(0x210)](_0x5b9596(0x1fa)),console[_0x5b9596(0x210)](_0x5b9596(0x230)),console['error'](_0x5b9596(0x242)),0x1;try{const _0x503b7e=_0x209bd2[_0x5b9596(0x212)],_0x111ae6=await resolveSegmentTarget(_0x265bc1,_0x503b7e,_0x209bd2[_0x5b9596(0x235)]);_0x209bd2[_0x5b9596(0x235)]&&console[_0x5b9596(0x210)]('Target\x20path:\x20'+_0x111ae6);const _0x158875=await withSpinner(_0x5b9596(0x221)+_0x265bc1+_0x5b9596(0x1fc),()=>_0x426bbe['segment']['resolvePathToResource'](_0x111ae6),{'verbose':_0x209bd2['verbose']}),_0x4028c6=_0x158875['data'];_0x209bd2[_0x5b9596(0x235)]&&(console[_0x5b9596(0x210)](_0x5b9596(0x202)+_0x4028c6[_0x5b9596(0x234)]),console[_0x5b9596(0x210)](_0x5b9596(0x224)+_0x4028c6[_0x5b9596(0x21e)]));if(_0x4028c6[_0x5b9596(0x234)]==='folder')return console[_0x5b9596(0x210)](_0x5b9596(0x20c)),console[_0x5b9596(0x210)](_0x5b9596(0x231)),0x1;if(_0x4028c6[_0x5b9596(0x234)]===_0x5b9596(0x237))return console['error'](_0x5b9596(0x1f3)),console['error'](_0x5b9596(0x22c)),0x1;if(!_0x4028c6['segmentId'])throw new SDKError(ErrorCode[_0x5b9596(0x251)],_0x5b9596(0x1f7));const _0x3396ad=await withSpinner(_0x5b9596(0x1e8),()=>_0x426bbe[_0x5b9596(0x1e1)][_0x5b9596(0x22a)](_0x4028c6[_0x5b9596(0x21e)],_0x4028c6['segmentId']),{'verbose':_0x209bd2[_0x5b9596(0x235)]});let _0x510ba0=_0x3396ad[_0x5b9596(0x24f)];const _0x22bb8b=resolveLimit(_0x209bd2[_0x5b9596(0x1ef)],DEFAULT_DISPLAY_LIMIT),_0x319f9d=/\bLIMIT\s+\d+/i[_0x5b9596(0x1d3)](_0x510ba0);!_0x319f9d&&(_0x510ba0=_0x510ba0[_0x5b9596(0x25a)]()[_0x5b9596(0x1ce)](/;+$/,''),_0x510ba0=_0x5b9596(0x213)+_0x510ba0+_0x5b9596(0x254)+_0x22bb8b);_0x209bd2['verbose']&&console[_0x5b9596(0x210)](_0x5b9596(0x255)+_0x510ba0);const _0x36a54d=await withProgressSpinner(_0x5b9596(0x252),async _0x312613=>{const _0x32d568=_0x5b9596,_0x4ee8e3=await _0x426bbe[_0x32d568(0x1ea)][_0x32d568(0x246)](_0x510ba0,{'catalog':'td','schema':'information_schema','onJobId':_0x4926be=>{const _0x1c48c1=_0x32d568;_0x312613[_0x1c48c1(0x21f)](_0x4926be);}});return _0x4ee8e3;},{'verbose':_0x209bd2[_0x5b9596(0x235)]}),_0x368930=_0x36a54d[_0x5b9596(0x24f)],_0x3fbd19=_0x368930[_0x5b9596(0x23f)]?_0x5b9596(0x1d7)+_0x368930[_0x5b9596(0x23f)]+']':'';return console[_0x5b9596(0x210)](_0x5b9596(0x1ec)+_0x368930[_0x5b9596(0x266)]['processedRows']['toLocaleString']()+_0x5b9596(0x1f9)+('in\x20'+formatElapsed(_0x368930[_0x5b9596(0x266)][_0x5b9596(0x23d)])+_0x3fbd19)),await handleQueryOutput(_0x368930,_0x209bd2),0x0;}catch(_0x4c7f67){if(_0x4c7f67 instanceof SDKError)return console[_0x5b9596(0x210)](_0x5b9596(0x222)+_0x4c7f67[_0x5b9596(0x262)]+']'),console[_0x5b9596(0x210)]('\x0a'+_0x4c7f67[_0x5b9596(0x259)]),0x1;throw _0x4c7f67;}}}export class SegmentFolderListCommand extends BaseCommand{[a37_0x64e536(0x1d2)]=a37_0x64e536(0x21b);['description']=a37_0x64e536(0x26c);async[a37_0x64e536(0x246)](_0x5e1e0c){const _0x2e40d0=a37_0x64e536,{options:_0x32091f,args:_0x4ba28a,tdx:_0x452519}=_0x5e1e0c;if(_0x4ba28a['length']===0x0)return console['error'](_0x2e40d0(0x22e)),console[_0x2e40d0(0x210)](_0x2e40d0(0x207)),0x1;const _0x25efb2=_0x4ba28a[0x0];try{_0x32091f['verbose']&&(console[_0x2e40d0(0x210)](_0x2e40d0(0x1f4)+_0x32091f[_0x2e40d0(0x265)]),console[_0x2e40d0(0x210)](_0x2e40d0(0x217)+_0x25efb2));const _0x4c263=await withSpinner(_0x2e40d0(0x216)+_0x25efb2+_0x2e40d0(0x1fc),()=>_0x452519[_0x2e40d0(0x1e1)][_0x2e40d0(0x274)](_0x25efb2),{'verbose':_0x32091f[_0x2e40d0(0x235)]}),_0x3223d0=_0x4c263[_0x2e40d0(0x24f)];_0x32091f['verbose']&&console[_0x2e40d0(0x210)](_0x2e40d0(0x253)+_0x3223d0);const _0x535df7=await withSpinner(_0x2e40d0(0x270)+_0x25efb2+_0x2e40d0(0x1fc),()=>_0x452519[_0x2e40d0(0x1e1)][_0x2e40d0(0x24a)](_0x3223d0),{'verbose':_0x32091f[_0x2e40d0(0x235)]}),_0x4b31f7=_0x535df7['data'];return console['error'](_0x2e40d0(0x1e6)+_0x4b31f7['length']+_0x2e40d0(0x1ed)+(_0x4b31f7['length']!==0x1?'s':'')),await handleSDKOutput(_0x4b31f7,_0x32091f),0x0;}catch(_0x38f23e){if(_0x38f23e instanceof SDKError)return console[_0x2e40d0(0x210)]('Error:\x20'+_0x38f23e['message']),_0x38f23e[_0x2e40d0(0x256)]&&console[_0x2e40d0(0x210)](_0x2e40d0(0x218)+_0x38f23e[_0x2e40d0(0x256)]),0x1;throw _0x38f23e;}}}export class SegmentFolderShowCommand extends BaseCommand{[a37_0x64e536(0x1d2)]=a37_0x64e536(0x1df);['description']='Show\x20segment\x20folder\x20details';async[a37_0x64e536(0x246)](_0x3532e6){const _0x4e64c5=a37_0x64e536,{options:_0x22281a,args:_0xeeb984,tdx:_0x467736}=_0x3532e6;if(_0xeeb984[_0x4e64c5(0x260)]===0x0)return console[_0x4e64c5(0x210)](_0x4e64c5(0x269)),console[_0x4e64c5(0x210)]('Usage:\x20tdx\x20segment\x20folder\x20show\x20<parent_name/folder_name>'),0x1;try{const {parentId:_0x185943,childId:_0x18cbc7}=parseSegmentRef(_0xeeb984[0x0]);_0x22281a[_0x4e64c5(0x235)]&&(console[_0x4e64c5(0x210)](_0x4e64c5(0x1f4)+_0x22281a[_0x4e64c5(0x265)]),console[_0x4e64c5(0x210)]('Parent\x20name:\x20'+_0x185943),_0x18cbc7&&console['error']('Folder\x20name:\x20'+_0x18cbc7));if(!_0x18cbc7)return console[_0x4e64c5(0x210)]('Error:\x20Folder\x20name\x20is\x20required\x20(use\x20parent_name/folder_name\x20format)'),0x1;const _0x40cbe5=await withSpinner(_0x4e64c5(0x216)+_0x185943+'\x27...',()=>_0x467736['segment']['resolveParentId'](_0x185943),{'verbose':_0x22281a['verbose']}),_0x5c112c=_0x40cbe5['data'];_0x22281a[_0x4e64c5(0x235)]&&console[_0x4e64c5(0x210)](_0x4e64c5(0x253)+_0x5c112c);const _0x447ebe=await withSpinner('Resolving\x20folder\x20\x27'+_0x18cbc7+_0x4e64c5(0x1fc),()=>_0x467736[_0x4e64c5(0x1e1)][_0x4e64c5(0x204)](_0x5c112c,_0x18cbc7),{'verbose':_0x22281a['verbose']}),_0x2fff8c=_0x447ebe[_0x4e64c5(0x24f)];_0x22281a[_0x4e64c5(0x235)]&&console[_0x4e64c5(0x210)](_0x4e64c5(0x273)+_0x2fff8c);const _0x500a8d=await withSpinner('Fetching\x20folder\x20\x27'+_0x18cbc7+'\x27...',()=>_0x467736[_0x4e64c5(0x1e1)][_0x4e64c5(0x26f)](_0x2fff8c),{'verbose':_0x22281a[_0x4e64c5(0x235)]});return await handleSDKOutput([_0x500a8d[_0x4e64c5(0x24f)]],_0x22281a),0x0;}catch(_0x55538d){if(_0x55538d instanceof SDKError)return console[_0x4e64c5(0x210)](_0x4e64c5(0x264)+_0x55538d['message']),_0x55538d[_0x4e64c5(0x256)]&&console[_0x4e64c5(0x210)](_0x4e64c5(0x218)+_0x55538d['cause']),0x1;throw _0x55538d;}}}export class SegmentSQLCommand extends BaseCommand{[a37_0x64e536(0x1d2)]=a37_0x64e536(0x258);[a37_0x64e536(0x25f)]='Get\x20SQL\x20query\x20for\x20child\x20segment';async['execute'](_0x21f3a5){const _0x11f446=a37_0x64e536,{options:_0x53851f,args:_0x220c38}=_0x21f3a5,_0x374564=_0x53851f,_0x5949dc=_0x374564[_0x11f446(0x214)],_0x3c5798=_0x220c38[0x0];if(!_0x3c5798&&!_0x5949dc)return console[_0x11f446(0x210)](a37_0x2bf224[_0x11f446(0x227)](_0x11f446(0x209))),console['error'](_0x11f446(0x1de)),console['error'](_0x11f446(0x1d8)),console[_0x11f446(0x210)]('\x20\x20Local\x20YAML\x20file:\x20\x20\x20\x20\x20\x20tdx\x20sg\x20sql\x20--path\x20<file-path>'),console[_0x11f446(0x210)](_0x11f446(0x1fa)),console[_0x11f446(0x210)]('\x20\x20tdx\x20sg\x20sql\x20\x22Premium\x20Users\x22'),console[_0x11f446(0x210)](_0x11f446(0x232)),0x1;if(_0x3c5798&&_0x5949dc)return console[_0x11f446(0x210)](a37_0x2bf224[_0x11f446(0x227)](_0x11f446(0x1fd))),0x1;try{let _0x2ba98c;if(_0x5949dc)_0x2ba98c=await this[_0x11f446(0x249)](_0x5949dc,_0x21f3a5);else{if(isYamlFilePath(_0x3c5798))return console[_0x11f446(0x210)](a37_0x2bf224[_0x11f446(0x227)]('Error:\x20YAML\x20file\x20paths\x20must\x20be\x20specified\x20with\x20--path\x20option')),console['error'](_0x11f446(0x23e)+_0x3c5798),0x1;else _0x2ba98c=await this[_0x11f446(0x201)](_0x3c5798,_0x21f3a5);}return _0x53851f[_0x11f446(0x23b)]===_0x11f446(0x239)||_0x53851f[_0x11f446(0x23b)]==='jsonl'?await handleSDKOutput([{'sql':_0x2ba98c}],_0x53851f):console[_0x11f446(0x1e3)](_0x2ba98c),0x0;}catch(_0xa6c9da){if(_0xa6c9da instanceof SDKError)return console[_0x11f446(0x210)](_0x11f446(0x264)+_0xa6c9da['message']),_0xa6c9da[_0x11f446(0x256)]&&console['error'](_0x11f446(0x218)+_0xa6c9da[_0x11f446(0x256)]),0x1;throw _0xa6c9da;}}async['getSQLFromYamlFile'](_0x493242,_0x30ecf3){const _0x4c510d=a37_0x64e536,{options:_0x38cdad,tdx:_0x1e2cc2}=_0x30ecf3;let _0x394f56;try{_0x394f56=await resolveYamlFilePath(_0x493242);}catch(_0xc60ce1){throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x4c510d(0x24b)+_0xc60ce1[_0x4c510d(0x259)]);}_0x38cdad['verbose']&&console[_0x4c510d(0x210)](_0x4c510d(0x26e)+_0x394f56[_0x4c510d(0x212)]+'/'+_0x394f56[_0x4c510d(0x241)]);const _0x12c181=await withSpinner(_0x4c510d(0x205),()=>_0x1e2cc2['segment'][_0x4c510d(0x215)](_0x394f56[_0x4c510d(0x1e9)],_0x394f56[_0x4c510d(0x212)],_0x394f56['segmentName']),{'verbose':_0x38cdad[_0x4c510d(0x235)]});return _0x12c181[_0x4c510d(0x24f)];}async[a37_0x64e536(0x201)](_0x4b179c,_0x39230c){const _0x51e31e=a37_0x64e536,{options:_0x2d9a27,tdx:_0x3d85f5}=_0x39230c,_0x148bdf=_0x2d9a27[_0x51e31e(0x212)],_0x33f650=await resolveSegmentTarget(_0x4b179c,_0x148bdf,_0x2d9a27['verbose']);_0x2d9a27[_0x51e31e(0x235)]&&console[_0x51e31e(0x210)]('Target\x20path:\x20'+_0x33f650);const _0xa9e83f=await withSpinner(_0x51e31e(0x221)+_0x4b179c+_0x51e31e(0x1fc),()=>_0x3d85f5['segment']['resolvePathToResource'](_0x33f650),{'verbose':_0x2d9a27[_0x51e31e(0x235)]}),_0x538195=_0xa9e83f['data'];_0x2d9a27['verbose']&&(console['error'](_0x51e31e(0x202)+_0x538195[_0x51e31e(0x234)]),console[_0x51e31e(0x210)](_0x51e31e(0x224)+_0x538195['parentId']));if(_0x538195['type']===_0x51e31e(0x219))throw new SDKError(ErrorCode[_0x51e31e(0x229)],_0x51e31e(0x20e));if(_0x538195[_0x51e31e(0x234)]===_0x51e31e(0x237))throw new SDKError(ErrorCode[_0x51e31e(0x229)],_0x51e31e(0x1e7));if(!_0x538195[_0x51e31e(0x272)])throw new SDKError(ErrorCode[_0x51e31e(0x251)],_0x51e31e(0x1f7));const _0xda760e=await withSpinner('Fetching\x20SQL\x20for\x20segment...',()=>_0x3d85f5[_0x51e31e(0x1e1)][_0x51e31e(0x22a)](_0x538195['parentId'],_0x538195['segmentId']),{'verbose':_0x2d9a27[_0x51e31e(0x235)]});return _0xda760e[_0x51e31e(0x24f)];}}export class SegmentFolderCreateCommand extends BaseCommand{[a37_0x64e536(0x1d2)]=a37_0x64e536(0x1e4);[a37_0x64e536(0x25f)]=a37_0x64e536(0x20d);async['execute'](_0x26b43c){const _0x4e630c=a37_0x64e536,{options:_0x4aa7e6,args:_0x45a473,tdx:_0x54e269}=_0x26b43c,_0x4dfc8d=_0x4aa7e6;if(_0x45a473['length']<0x2)return console[_0x4e630c(0x210)](_0x4e630c(0x211)),console[_0x4e630c(0x210)](_0x4e630c(0x228)),0x1;const _0x4e7de8=_0x45a473[0x0],_0x3bfe2a=_0x45a473[0x1];_0x4dfc8d[_0x4e630c(0x235)]&&(console[_0x4e630c(0x210)](_0x4e630c(0x1f4)+_0x4dfc8d[_0x4e630c(0x265)]),console[_0x4e630c(0x210)](_0x4e630c(0x1ff)+_0x4e7de8),console[_0x4e630c(0x210)](_0x4e630c(0x225)+_0x3bfe2a));let _0x342e9c;if(_0x4dfc8d[_0x4e630c(0x25d)]){const _0x3be41d=_0x4dfc8d[_0x4e630c(0x25d)],_0xd3eb6f=await withSpinner(_0x4e630c(0x216)+_0x4e7de8+_0x4e630c(0x1fc),()=>_0x54e269[_0x4e630c(0x1e1)][_0x4e630c(0x274)](_0x4e7de8),{'verbose':_0x4dfc8d[_0x4e630c(0x235)]}),_0xa53b2b=_0xd3eb6f['data'],_0x3553b1=await withSpinner(_0x4e630c(0x1e2)+_0x3be41d+_0x4e630c(0x1fc),()=>_0x54e269['segment'][_0x4e630c(0x204)](_0xa53b2b,_0x3be41d),{'verbose':_0x4dfc8d[_0x4e630c(0x235)]});_0x342e9c=_0x3553b1[_0x4e630c(0x24f)],_0x4dfc8d[_0x4e630c(0x235)]&&console[_0x4e630c(0x210)]('Resolved\x20parent\x20folder\x20ID:\x20'+_0x342e9c);}const _0x2043d4={'name':_0x3bfe2a,'description':_0x4dfc8d['description'],'parentFolderId':_0x342e9c},_0x4b607e=await withSpinner('Creating\x20folder\x20\x27'+_0x3bfe2a+_0x4e630c(0x1fc),()=>_0x54e269['segment'][_0x4e630c(0x1d4)](_0x4e7de8,_0x2043d4),{'verbose':_0x4dfc8d[_0x4e630c(0x235)]}),_0xd90d0d=_0x4b607e[_0x4e630c(0x24f)];return console[_0x4e630c(0x210)](_0x4e630c(0x1dc)+_0xd90d0d[_0x4e630c(0x1d2)]+'\x27\x20with\x20ID:\x20'+_0xd90d0d['id']),await handleSDKOutput([_0xd90d0d],_0x4dfc8d),0x0;}}export class SegmentViewCommand extends BaseCommand{[a37_0x64e536(0x1d2)]=a37_0x64e536(0x22d);[a37_0x64e536(0x25f)]=a37_0x64e536(0x26b);async[a37_0x64e536(0x246)](_0x40703a){const _0x317741=a37_0x64e536,{options:_0x122766,args:_0x229848,tdx:_0x279642}=_0x40703a,_0x16dd48=_0x229848[0x0];if(!_0x16dd48)return console[_0x317741(0x210)]('Error:\x20Folder\x20or\x20segment\x20name,\x20or\x20YAML\x20file\x20path\x20is\x20required'),console['error'](_0x317741(0x25c)),console[_0x317741(0x210)](_0x317741(0x23c)),console[_0x317741(0x210)](_0x317741(0x1fb)),console[_0x317741(0x210)](_0x317741(0x1d0)),console['error'](_0x317741(0x1fa)),console['error'](_0x317741(0x223)),console[_0x317741(0x210)](_0x317741(0x240)),console[_0x317741(0x210)]('\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20-w\x20\x20#\x20Open\x20segment\x20in\x20web\x20browser'),console[_0x317741(0x210)](_0x317741(0x24e)),0x1;try{const _0x1853df=_0x122766[_0x317741(0x212)],_0x5e1a62=await resolveSegmentTarget(_0x16dd48,_0x1853df,_0x122766[_0x317741(0x235)]);_0x122766[_0x317741(0x235)]&&console['error'](_0x317741(0x1f5)+_0x5e1a62);const _0x2ea6e1=await withSpinner('Resolving\x20\x27'+_0x16dd48+_0x317741(0x1fc),()=>_0x279642[_0x317741(0x1e1)][_0x317741(0x271)](_0x5e1a62),{'verbose':_0x122766[_0x317741(0x235)]}),_0x328585=_0x2ea6e1[_0x317741(0x24f)];_0x122766[_0x317741(0x235)]&&(console[_0x317741(0x210)]('Resolved\x20type:\x20'+_0x328585[_0x317741(0x234)]),console['error']('Parent\x20ID:\x20'+_0x328585[_0x317741(0x21e)]),_0x328585['folderId']&&console[_0x317741(0x210)](_0x317741(0x275)+_0x328585[_0x317741(0x267)]),_0x328585[_0x317741(0x272)]&&console[_0x317741(0x210)]('Segment\x20ID:\x20'+_0x328585[_0x317741(0x272)]));if(_0x122766[_0x317741(0x206)]){if(_0x328585[_0x317741(0x234)]==='folder')return console[_0x317741(0x210)](_0x317741(0x263)),0x1;if(_0x328585['type']===_0x317741(0x237))return console[_0x317741(0x210)]('Error:\x20Cannot\x20open\x20parent\x20segment\x20with\x20this\x20command.'),console[_0x317741(0x210)](_0x317741(0x20a)),0x1;if(!_0x328585[_0x317741(0x272)])throw new SDKError(ErrorCode[_0x317741(0x251)],_0x317741(0x1f7));const _0x2abf79=getConsoleNextUrl(_0x122766['site'],_0x317741(0x203)+_0x328585[_0x317741(0x21e)]+_0x317741(0x261)+_0x328585['segmentId']);return console[_0x317741(0x210)](a37_0x2bf224['green']('✔')+'\x20Opening\x20'+a37_0x2bf224[_0x317741(0x1eb)](_0x2abf79)),openBrowser(_0x2abf79),0x0;}if(_0x328585[_0x317741(0x234)]===_0x317741(0x219)){if(!_0x328585['folderId'])throw new SDKError(ErrorCode[_0x317741(0x208)],_0x317741(0x220));const _0x475914=await withSpinner(_0x317741(0x1f8),()=>_0x279642[_0x317741(0x1e1)][_0x317741(0x26f)](_0x328585['folderId']),{'verbose':_0x122766[_0x317741(0x235)]});await handleSingleObjectOutput(_0x475914[_0x317741(0x24f)],_0x122766);}else{if(_0x328585['type']==='segment'){if(!_0x328585[_0x317741(0x272)])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x317741(0x1f7));const _0x2c4eea=await withSpinner('Fetching\x20segment\x20details...',()=>_0x279642[_0x317741(0x1e1)]['getSegment'](_0x328585[_0x317741(0x21e)],_0x328585['segmentId']),{'verbose':_0x122766[_0x317741(0x235)]}),_0x5870a9=getConsoleNextUrl(_0x122766['site'],_0x317741(0x203)+_0x328585['parentId']+_0x317741(0x261)+_0x328585['segmentId']),_0x3d8e80=_0x2c4eea[_0x317741(0x24f)];_0x3d8e80[_0x317741(0x257)]=_0x5870a9,await handleSingleObjectOutput(_0x3d8e80,_0x122766);}else return console[_0x317741(0x210)](_0x317741(0x1dd)),console[_0x317741(0x210)](_0x317741(0x25e)),0x1;}return 0x0;}catch(_0x3e605f){if(_0x3e605f instanceof SDKError)return console[_0x317741(0x210)]('Error:\x20'+_0x3e605f[_0x317741(0x259)]),_0x3e605f[_0x317741(0x256)]&&console[_0x317741(0x210)]('\x20\x20Cause:\x20'+_0x3e605f[_0x317741(0x256)]),0x1;throw _0x3e605f;}}}function a37_0x1650(_0x1be7a9,_0x401cdf){_0x1be7a9=_0x1be7a9-0x1ce;const _0x31c4a4=a37_0x31c4();let _0x1650b9=_0x31c4a4[_0x1be7a9];return _0x1650b9;}export const SegmentInfoCommand=SegmentViewCommand;export class SegmentDescCommand extends BaseCommand{[a37_0x64e536(0x1d2)]=a37_0x64e536(0x1d6);[a37_0x64e536(0x25f)]=a37_0x64e536(0x233);async[a37_0x64e536(0x246)](_0xc7bdd6){const _0x1b614a=a37_0x64e536,{options:_0x128cba,args:_0x367fe3,tdx:_0x30c2d7}=_0xc7bdd6,_0x345bc4=_0x367fe3[0x0];if(!_0x345bc4)return console[_0x1b614a(0x210)](_0x1b614a(0x20b)),console[_0x1b614a(0x210)](_0x1b614a(0x26d)),console[_0x1b614a(0x210)](_0x1b614a(0x248)),console['error'](_0x1b614a(0x1fa)),console[_0x1b614a(0x210)]('\x20\x20tdx\x20sg\x20desc\x20\x22Premium\x20Users\x22'),console[_0x1b614a(0x210)](_0x1b614a(0x1da)),0x1;try{const _0x183230=_0x128cba[_0x1b614a(0x212)],_0x305d23=await resolveSegmentTarget(_0x345bc4,_0x183230,_0x128cba[_0x1b614a(0x235)]);_0x128cba[_0x1b614a(0x235)]&&console['error'](_0x1b614a(0x1f5)+_0x305d23);const _0x10ceb0=await withSpinner(_0x1b614a(0x221)+_0x345bc4+'\x27...',()=>_0x30c2d7[_0x1b614a(0x1e1)]['resolvePathToResource'](_0x305d23),{'verbose':_0x128cba[_0x1b614a(0x235)]}),_0x412195=_0x10ceb0[_0x1b614a(0x24f)];_0x128cba[_0x1b614a(0x235)]&&(console[_0x1b614a(0x210)](_0x1b614a(0x202)+_0x412195[_0x1b614a(0x234)]),console[_0x1b614a(0x210)]('Parent\x20ID:\x20'+_0x412195[_0x1b614a(0x21e)]));if(_0x412195[_0x1b614a(0x234)]===_0x1b614a(0x219))return console[_0x1b614a(0x210)](_0x1b614a(0x200)),console[_0x1b614a(0x210)]('Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.'),0x1;if(_0x412195[_0x1b614a(0x234)]===_0x1b614a(0x237))return console[_0x1b614a(0x210)]('Error:\x20Cannot\x20show\x20schema\x20for\x20parent\x20segment\x20with\x20this\x20command.'),console[_0x1b614a(0x210)]('Use:\x20tdx\x20ps\x20desc'),0x1;if(!_0x412195[_0x1b614a(0x272)])throw new SDKError(ErrorCode[_0x1b614a(0x251)],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x1a7759=await withSpinner(_0x1b614a(0x1e8),()=>_0x30c2d7['segment']['getSegmentSQL'](_0x412195['parentId'],_0x412195['segmentId']),{'verbose':_0x128cba[_0x1b614a(0x235)]}),_0x261724=_0x1a7759['data'],_0x189128=await executeSchemaQuery(_0x261724,_0x30c2d7,_0x128cba);return await handleQueryOutput(_0x189128,_0x128cba),0x0;}catch(_0xa4607b){if(_0xa4607b instanceof SDKError)return console[_0x1b614a(0x210)](_0x1b614a(0x264)+_0xa4607b[_0x1b614a(0x259)]),_0xa4607b[_0x1b614a(0x256)]&&console['error'](_0x1b614a(0x218)+_0xa4607b[_0x1b614a(0x256)]),0x1;throw _0xa4607b;}}}
1
+ const a37_0x5b4b5d=a37_0x18a8;(function(_0x1b3def,_0x3ae634){const _0x12999d=a37_0x18a8,_0x3902c1=_0x1b3def();while(!![]){try{const _0x46349b=parseInt(_0x12999d(0x20b))/0x1*(parseInt(_0x12999d(0x256))/0x2)+-parseInt(_0x12999d(0x20a))/0x3*(parseInt(_0x12999d(0x269))/0x4)+-parseInt(_0x12999d(0x21a))/0x5+-parseInt(_0x12999d(0x25b))/0x6+parseInt(_0x12999d(0x21c))/0x7+parseInt(_0x12999d(0x1e1))/0x8+-parseInt(_0x12999d(0x229))/0x9;if(_0x46349b===_0x3ae634)break;else _0x3902c1['push'](_0x3902c1['shift']());}catch(_0x52c7ea){_0x3902c1['push'](_0x3902c1['shift']());}}}(a37_0x26ba,0xc8ae9));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,handleQueryOutput,handleSingleObjectOutput}from'../core/command-output.js';function a37_0x18a8(_0x5e0cf6,_0x15965c){_0x5e0cf6=_0x5e0cf6-0x1c7;const _0x26ba81=a37_0x26ba();let _0x18a853=_0x26ba81[_0x5e0cf6];return _0x18a853;}import{withSpinner,withProgressSpinner,formatElapsed}from'../utils/spinner.js';import{parseSegmentRef}from'../sdk/segment/segment-ref-parser.js';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import{executeSchemaQuery}from'../sdk/segment/fields-display.js';import{isYamlFilePath,resolveYamlFilePath}from'../sdk/segment/segment-path-parser.js';function a37_0x26ba(){const _0x22b590=['segment:sql','Error:\x20Cannot\x20show\x20schema\x20for\x20parent\x20segment\x20with\x20this\x20command.','SELECT\x20*\x20FROM\x20(\x0a','\x20\x20tdx\x20sg\x20sql\x20\x22Premium\x20Users\x22','Use:\x20tdx\x20ps\x20desc','jobId','\x20\x20tdx\x20segment\x20describe\x20\x22High\x20Value\x22\x20\x20\x20\x20#\x20Relative\x20to\x20current\x20context','1741608yXJsdO','url','Usage:\x20tdx\x20segment\x20describe\x20<path>','green','includes','site','path','\x20\x20Cause:\x20','Usage:\x20tdx\x20segment\x20folder\x20create\x20<parent_name>\x20<folder_name>\x20[options]','segmentName','getFolder','\x20\x20Segment\x20name:\x20','\x20\x20-w,\x20--web\x20\x20Open\x20segment\x20in\x20web\x20browser','query','\x20\x20Parent\x20segment:\x20','Examples:','Fetching\x20segment\x20details...','parentFolder','segment:folder:show','Usage:\x20tdx\x20sg\x20desc\x20<name>','setJobId','resolvePathToResource','\x27\x20with\x20ID:\x20','Error:\x20Folder\x20reference\x20is\x20required','segmentId','Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.','\x20\x20tdx\x20sg\x20show\x20\x22Premium\x20Users\x22','List\x20segment\x20folders\x20under\x20a\x20parent\x20segment','\x20rows\x20','Show\x20folder\x20or\x20child\x20segment\x20details','segment','Get\x20SQL\x20query\x20for\x20child\x20segment','\x27...','replace','Site:\x20','Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required','parentId','Resolved\x20relative\x20path\x20to:\x20','Parent\x20name:\x20','Resolving\x20folder\x20\x27','\x20\x20Local\x20YAML\x20file:\x20\x20\x20\x20\x20\x20tdx\x20sg\x20sql\x20--path\x20<file-path>','listFolders','Use:\x20tdx\x20sg\x20view\x20<name>\x20\x20#\x20To\x20show\x20folder\x20details','Error:\x20Folder\x20name\x20is\x20required\x20(use\x20parent_name/folder_name\x20format)','/app/ps/','58VLrNfC','Use:\x20tdx\x20ps\x20view\x20-w','\x20\x20Full\x20path:\x20','Error:\x20Parent\x20segment\x20name\x20is\x20required','Target\x20path:\x20','3808260kGvAdq','getSegment','folder','folderId','resolveParentId','Usage:\x20tdx\x20segment\x20folder\x20list\x20<parent_name>','json','/e/','log','jsonl','Fetching\x20folder\x20details...','toLocaleString','Use:\x20tdx\x20ps\x20show','SQL\x20query:\x0a','43524ufXbwa','Error:\x20Path\x20or\x20name\x20is\x20required','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20desc\x20<path/to/segment.yml>','in\x20','Error:\x20Cannot\x20execute\x20query\x20for\x20parent\x20segment\x20with\x20this\x20command.','Resolved:\x20','Usage:\x20tdx\x20sg\x20view\x20<name>\x20[-w]','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20show\x20<path/to/segment.yml>','getSQLFromServerSegment','Usage:','Error:\x20Folder\x20or\x20segment\x20name,\x20or\x20YAML\x20file\x20path\x20is\x20required','\x20\x20tdx\x20sg\x20sql\x20--path\x20','segment:show','Resolved\x20type:\x20','Listing\x20folders\x20for\x20parent\x20\x27','Usage:\x20tdx\x20segment\x20folder\x20show\x20<parent_name/folder_name>','SEGMENT_NOT_FOUND','getParent','execute','error','Resolving\x20parent\x20segment\x20\x27','\x20Opening\x20','INVALID_ARGUMENT','Error:\x20Specify\x20either\x20segment\x20name\x20or\x20--path,\x20not\x20both','\x20\x20tdx\x20sg\x20sql\x20--path\x20segments/my-audience/premium-users.yml','✔\x20Created\x20folder\x20\x27','limit','data','Creating\x20folder\x20\x27','getSegmentSQL','elapsedTimeMillis','12384104XJBIJb','✔\x20Query\x20completed:\x20Processed\x20','parentSegment','SEGMENT_FOLDER_NOT_FOUND','\x20\x20tdx\x20sg\x20desc\x20segments/my-audience/premium-users.yml','test','getSQLFromYamlFile','Folder\x20ID\x20missing\x20from\x20resolved\x20path','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience/Marketing/High\x20Value\x22','Resolving\x20\x27','\x20\x20tdx\x20sg\x20show\x20segments/my-audience/premium-users.yml','\x20\x20Folder\x20path:\x20','Error:\x20Cannot\x20view\x20parent\x20segment\x20details\x20with\x20this\x20command.','\x20[Job\x20ID:\x20','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','Parent\x20ID:\x20','Executing\x20segment\x20query...','Show\x20segment\x20or\x20folder\x20details','Resolving\x20path\x20\x27','web','createFolder','Error:\x20Segment\x20name\x20or\x20--path\x20is\x20required','Resolved\x20parent\x20ID:\x20','folderPath','verbose','cause','Folder\x20ID:\x20','Resolved\x20folder\x20ID:\x20','fullPath','Error:\x20Cannot\x20open\x20parent\x20segment\x20with\x20this\x20command.','stats','message','Cannot\x20get\x20SQL\x20query\x20for\x20a\x20folder.\x20Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.','Show\x20child\x20segment\x20schema\x20(column\x20types)','\x20\x20tdx\x20sg\x20desc\x20\x22Premium\x20Users\x22','type','code','Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20','resolveFolderId','processedRows','description','429QxSbvP','54867MfhHlC','Error:\x20Cannot\x20show\x20schema\x20for\x20a\x20folder.','red','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','Fetching\x20SQL\x20for\x20segment...','Resolving\x20parent\x20folder\x20\x27','segment:view','Segment\x20ID\x20missing\x20from\x20resolved\x20path','Folder\x20name:\x20','Error:\x20','✔\x20Found\x20','Error:\x20Parent\x20segment\x20name\x20and\x20folder\x20name\x20are\x20required','information_schema','length','parent','7741025CakQyN','Resolved\x20YAML\x20file:\x20','11306729YbTuJG','\x20\x20tdx\x20sg\x20view\x20\x22Marketing\x22\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20folder\x20details','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience\x22','format','name','Fetching\x20SQL\x20from\x20rule...'];a37_0x26ba=function(){return _0x22b590;};return a37_0x26ba();}import{getConsoleNextUrl}from'../sdk/client/endpoints.js';import{openBrowser}from'../utils/process.js';import a37_0x4ef4cd from'chalk';async function resolveSegmentTarget(_0x423a18,_0x270f7c,_0x85c68){const _0x40de18=a37_0x18a8;if(isYamlFilePath(_0x423a18))try{const _0x4ef6ff=await resolveYamlFilePath(_0x423a18);return _0x85c68&&(console[_0x40de18(0x1d5)](_0x40de18(0x21b)+_0x423a18),console[_0x40de18(0x1d5)](_0x40de18(0x237)+_0x4ef6ff[_0x40de18(0x1e3)]),console['error'](_0x40de18(0x234)+_0x4ef6ff['segmentName']),console[_0x40de18(0x1d5)](_0x40de18(0x1ec)+(_0x4ef6ff[_0x40de18(0x1f8)]||'(root)')),console[_0x40de18(0x1d5)](_0x40de18(0x258)+_0x4ef6ff[_0x40de18(0x1fd)])),_0x4ef6ff['fullPath'];}catch(_0x21b8d8){throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x40de18(0x206)+_0x21b8d8['message']);}if(!_0x270f7c)throw new SDKError(ErrorCode[_0x40de18(0x1d8)],'No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22');return _0x270f7c+'/'+_0x423a18;}export class SegmentDescribeCommand extends BaseCommand{['name']='segment:describe';['description']=a37_0x5b4b5d(0x1f2);async[a37_0x5b4b5d(0x1d4)](_0x22bdb2){const _0x4c0ecb=a37_0x5b4b5d,{options:_0x49f8bf,args:_0x1e752f,tdx:_0x5884cb}=_0x22bdb2,_0x386dcf=_0x1e752f[0x0],_0x2f1cc8=!_0x386dcf&&!!_0x49f8bf[_0x4c0ecb(0x1e3)],_0x291846=_0x386dcf||_0x49f8bf[_0x4c0ecb(0x1e3)];if(!_0x291846)return console['error'](_0x4c0ecb(0x26a)),console[_0x4c0ecb(0x1d5)](_0x4c0ecb(0x22b)),console[_0x4c0ecb(0x1d5)](_0x4c0ecb(0x238)),console[_0x4c0ecb(0x1d5)](_0x4c0ecb(0x21e)),console[_0x4c0ecb(0x1d5)](_0x4c0ecb(0x1e9)),console[_0x4c0ecb(0x1d5)](_0x4c0ecb(0x228)),console['error'](_0x4c0ecb(0x1ef)),0x1;try{const _0x26c44d=_0x49f8bf['segmentPath'];let _0x96216b=_0x291846;!_0x2f1cc8&&_0x26c44d&&!_0x291846[_0x4c0ecb(0x22d)]('/')&&(_0x96216b=_0x26c44d+'/'+_0x291846,_0x49f8bf[_0x4c0ecb(0x1f9)]&&console['error'](_0x4c0ecb(0x24e)+_0x96216b));const _0x19f418=await withSpinner(_0x4c0ecb(0x1f3)+_0x96216b+_0x4c0ecb(0x249),()=>_0x5884cb[_0x4c0ecb(0x247)][_0x4c0ecb(0x23e)](_0x96216b),{'verbose':_0x49f8bf[_0x4c0ecb(0x1f9)]}),_0x40a364=_0x19f418[_0x4c0ecb(0x1dd)];_0x49f8bf['verbose']&&(console[_0x4c0ecb(0x1d5)]('Resolved\x20type:\x20'+_0x40a364[_0x4c0ecb(0x204)]),console[_0x4c0ecb(0x1d5)](_0x4c0ecb(0x1f0)+_0x40a364[_0x4c0ecb(0x24d)]),_0x40a364[_0x4c0ecb(0x25e)]&&console['error'](_0x4c0ecb(0x1fb)+_0x40a364[_0x4c0ecb(0x25e)]),_0x40a364[_0x4c0ecb(0x241)]&&console['error']('Segment\x20ID:\x20'+_0x40a364['segmentId']));if(_0x40a364[_0x4c0ecb(0x204)]===_0x4c0ecb(0x219)){const _0x49f3f7=await withSpinner('Fetching\x20parent\x20segment\x20details...',()=>_0x5884cb[_0x4c0ecb(0x247)][_0x4c0ecb(0x1d3)](_0x40a364['parentId']),{'verbose':_0x49f8bf[_0x4c0ecb(0x1f9)]});await handleSingleObjectOutput(_0x49f3f7[_0x4c0ecb(0x1dd)],_0x49f8bf);}else{if(_0x40a364[_0x4c0ecb(0x204)]===_0x4c0ecb(0x25d)){if(!_0x40a364[_0x4c0ecb(0x25e)])throw new SDKError(ErrorCode[_0x4c0ecb(0x1e4)],'Folder\x20ID\x20missing\x20from\x20resolved\x20path');const _0xc314ff=await withSpinner(_0x4c0ecb(0x265),()=>_0x5884cb[_0x4c0ecb(0x247)]['getFolder'](_0x40a364[_0x4c0ecb(0x25e)]),{'verbose':_0x49f8bf[_0x4c0ecb(0x1f9)]});await handleSingleObjectOutput(_0xc314ff[_0x4c0ecb(0x1dd)],_0x49f8bf);}else{if(_0x40a364[_0x4c0ecb(0x204)]===_0x4c0ecb(0x247)){if(!_0x40a364[_0x4c0ecb(0x241)])throw new SDKError(ErrorCode[_0x4c0ecb(0x1d2)],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x2ee372=await withSpinner('Fetching\x20segment\x20details...',()=>_0x5884cb[_0x4c0ecb(0x247)][_0x4c0ecb(0x25c)](_0x40a364[_0x4c0ecb(0x24d)],_0x40a364[_0x4c0ecb(0x241)]),{'verbose':_0x49f8bf[_0x4c0ecb(0x1f9)]});await handleSingleObjectOutput(_0x2ee372[_0x4c0ecb(0x1dd)],_0x49f8bf);}}}return 0x0;}catch(_0x26b3a6){if(_0x26b3a6 instanceof SDKError)return console[_0x4c0ecb(0x1d5)](_0x4c0ecb(0x214)+_0x26b3a6['message']),_0x26b3a6[_0x4c0ecb(0x1fa)]&&console[_0x4c0ecb(0x1d5)](_0x4c0ecb(0x230)+_0x26b3a6[_0x4c0ecb(0x1fa)]),0x1;throw _0x26b3a6;}}}export class SegmentShowCommand extends BaseCommand{[a37_0x5b4b5d(0x220)]=a37_0x5b4b5d(0x1ce);[a37_0x5b4b5d(0x209)]='Execute\x20child\x20segment\x20SQL\x20query\x20and\x20show\x20results';async[a37_0x5b4b5d(0x1d4)](_0xa2e650){const _0xd40ed=a37_0x5b4b5d,{options:_0x786b1,args:_0xc8a620,tdx:_0x1f9962}=_0xa2e650,_0x3fd357=_0xc8a620[0x0];if(!_0x3fd357)return console['error'](_0xd40ed(0x24c)),console['error']('Usage:\x20tdx\x20sg\x20show\x20<name>'),console[_0xd40ed(0x1d5)](_0xd40ed(0x1c9)),console[_0xd40ed(0x1d5)]('Examples:'),console[_0xd40ed(0x1d5)](_0xd40ed(0x243)),console['error'](_0xd40ed(0x1eb)),0x1;try{const _0x4d3f18=_0x786b1['parentSegment'],_0x5592e1=await resolveSegmentTarget(_0x3fd357,_0x4d3f18,_0x786b1['verbose']);_0x786b1['verbose']&&console['error'](_0xd40ed(0x25a)+_0x5592e1);const _0x3d73dc=await withSpinner(_0xd40ed(0x1ea)+_0x3fd357+_0xd40ed(0x249),()=>_0x1f9962['segment'][_0xd40ed(0x23e)](_0x5592e1),{'verbose':_0x786b1[_0xd40ed(0x1f9)]}),_0x282f66=_0x3d73dc[_0xd40ed(0x1dd)];_0x786b1['verbose']&&(console[_0xd40ed(0x1d5)]('Resolved\x20type:\x20'+_0x282f66[_0xd40ed(0x204)]),console[_0xd40ed(0x1d5)](_0xd40ed(0x1f0)+_0x282f66[_0xd40ed(0x24d)]));if(_0x282f66['type']===_0xd40ed(0x25d))return console[_0xd40ed(0x1d5)]('Error:\x20Cannot\x20execute\x20SQL\x20query\x20on\x20a\x20folder.'),console['error'](_0xd40ed(0x253)),0x1;if(_0x282f66[_0xd40ed(0x204)]===_0xd40ed(0x219))return console[_0xd40ed(0x1d5)](_0xd40ed(0x26d)),console[_0xd40ed(0x1d5)](_0xd40ed(0x267)),0x1;if(!_0x282f66[_0xd40ed(0x241)])throw new SDKError(ErrorCode[_0xd40ed(0x1d2)],_0xd40ed(0x212));const _0x2c612c=await withSpinner(_0xd40ed(0x20f),()=>_0x1f9962['segment']['getSegmentSQL'](_0x282f66['parentId'],_0x282f66[_0xd40ed(0x241)]),{'verbose':_0x786b1[_0xd40ed(0x1f9)]});let _0x1c08ab=_0x2c612c[_0xd40ed(0x1dd)];const _0xd1137f=resolveLimit(_0x786b1[_0xd40ed(0x1dc)],DEFAULT_DISPLAY_LIMIT),_0x224e3d=/\bLIMIT\s+\d+/i[_0xd40ed(0x1e6)](_0x1c08ab);!_0x224e3d&&(_0x1c08ab=_0x1c08ab['trim']()[_0xd40ed(0x24a)](/;+$/,''),_0x1c08ab=_0xd40ed(0x224)+_0x1c08ab+_0xd40ed(0x20e)+_0xd1137f);_0x786b1[_0xd40ed(0x1f9)]&&console[_0xd40ed(0x1d5)](_0xd40ed(0x268)+_0x1c08ab);const _0x22e2e2=await withProgressSpinner(_0xd40ed(0x1f1),async _0xff48f=>{const _0x5398c7=_0xd40ed,_0x248e55=await _0x1f9962[_0x5398c7(0x236)][_0x5398c7(0x1d4)](_0x1c08ab,{'catalog':'td','schema':_0x5398c7(0x217),'onJobId':_0x4710e8=>{const _0x33c887=_0x5398c7;_0xff48f[_0x33c887(0x23d)](_0x4710e8);}});return _0x248e55;},{'verbose':_0x786b1[_0xd40ed(0x1f9)]}),_0x259c3b=_0x22e2e2[_0xd40ed(0x1dd)],_0x19dd13=_0x259c3b[_0xd40ed(0x227)]?_0xd40ed(0x1ee)+_0x259c3b[_0xd40ed(0x227)]+']':'';return console['error'](_0xd40ed(0x1e2)+_0x259c3b[_0xd40ed(0x1ff)][_0xd40ed(0x208)][_0xd40ed(0x266)]()+_0xd40ed(0x245)+(_0xd40ed(0x26c)+formatElapsed(_0x259c3b[_0xd40ed(0x1ff)][_0xd40ed(0x1e0)])+_0x19dd13)),await handleQueryOutput(_0x259c3b,_0x786b1),0x0;}catch(_0x50dd8d){if(_0x50dd8d instanceof SDKError)return console[_0xd40ed(0x1d5)]('✖\x20Query\x20failed\x20['+_0x50dd8d[_0xd40ed(0x205)]+']'),console[_0xd40ed(0x1d5)]('\x0a'+_0x50dd8d[_0xd40ed(0x200)]),0x1;throw _0x50dd8d;}}}export class SegmentFolderListCommand extends BaseCommand{['name']='segment:folder:list';[a37_0x5b4b5d(0x209)]=a37_0x5b4b5d(0x244);async[a37_0x5b4b5d(0x1d4)](_0x1b794b){const _0xe4267e=a37_0x5b4b5d,{options:_0xe43b31,args:_0x3f0b32,tdx:_0x6e9a8d}=_0x1b794b;if(_0x3f0b32['length']===0x0)return console[_0xe4267e(0x1d5)](_0xe4267e(0x259)),console[_0xe4267e(0x1d5)](_0xe4267e(0x260)),0x1;const _0x1a6d3f=_0x3f0b32[0x0];try{_0xe43b31['verbose']&&(console[_0xe4267e(0x1d5)](_0xe4267e(0x24b)+_0xe43b31[_0xe4267e(0x22e)]),console[_0xe4267e(0x1d5)]('Parent\x20name:\x20'+_0x1a6d3f));const _0x542201=await withSpinner(_0xe4267e(0x1d6)+_0x1a6d3f+_0xe4267e(0x249),()=>_0x6e9a8d[_0xe4267e(0x247)][_0xe4267e(0x25f)](_0x1a6d3f),{'verbose':_0xe43b31[_0xe4267e(0x1f9)]}),_0x55420a=_0x542201[_0xe4267e(0x1dd)];_0xe43b31['verbose']&&console[_0xe4267e(0x1d5)]('Resolved\x20parent\x20ID:\x20'+_0x55420a);const _0x4a794e=await withSpinner(_0xe4267e(0x1d0)+_0x1a6d3f+_0xe4267e(0x249),()=>_0x6e9a8d[_0xe4267e(0x247)][_0xe4267e(0x252)](_0x55420a),{'verbose':_0xe43b31[_0xe4267e(0x1f9)]}),_0x23d9f7=_0x4a794e[_0xe4267e(0x1dd)];return console[_0xe4267e(0x1d5)](_0xe4267e(0x215)+_0x23d9f7[_0xe4267e(0x218)]+'\x20folder'+(_0x23d9f7[_0xe4267e(0x218)]!==0x1?'s':'')),await handleSDKOutput(_0x23d9f7,_0xe43b31),0x0;}catch(_0xf6e812){if(_0xf6e812 instanceof SDKError)return console[_0xe4267e(0x1d5)](_0xe4267e(0x214)+_0xf6e812[_0xe4267e(0x200)]),_0xf6e812['cause']&&console[_0xe4267e(0x1d5)](_0xe4267e(0x230)+_0xf6e812[_0xe4267e(0x1fa)]),0x1;throw _0xf6e812;}}}export class SegmentFolderShowCommand extends BaseCommand{['name']=a37_0x5b4b5d(0x23b);[a37_0x5b4b5d(0x209)]='Show\x20segment\x20folder\x20details';async['execute'](_0x2889ae){const _0x2bc004=a37_0x5b4b5d,{options:_0x312ac1,args:_0x1c5a4f,tdx:_0x59d72e}=_0x2889ae;if(_0x1c5a4f[_0x2bc004(0x218)]===0x0)return console['error'](_0x2bc004(0x240)),console[_0x2bc004(0x1d5)](_0x2bc004(0x1d1)),0x1;try{const {parentId:_0xc24949,childId:_0xa8d19c}=parseSegmentRef(_0x1c5a4f[0x0]);_0x312ac1[_0x2bc004(0x1f9)]&&(console['error'](_0x2bc004(0x24b)+_0x312ac1[_0x2bc004(0x22e)]),console['error'](_0x2bc004(0x24f)+_0xc24949),_0xa8d19c&&console[_0x2bc004(0x1d5)](_0x2bc004(0x213)+_0xa8d19c));if(!_0xa8d19c)return console[_0x2bc004(0x1d5)](_0x2bc004(0x254)),0x1;const _0x37da15=await withSpinner(_0x2bc004(0x1d6)+_0xc24949+'\x27...',()=>_0x59d72e[_0x2bc004(0x247)][_0x2bc004(0x25f)](_0xc24949),{'verbose':_0x312ac1['verbose']}),_0x19e2bb=_0x37da15['data'];_0x312ac1[_0x2bc004(0x1f9)]&&console[_0x2bc004(0x1d5)](_0x2bc004(0x1f7)+_0x19e2bb);const _0x235b58=await withSpinner(_0x2bc004(0x250)+_0xa8d19c+'\x27...',()=>_0x59d72e[_0x2bc004(0x247)][_0x2bc004(0x207)](_0x19e2bb,_0xa8d19c),{'verbose':_0x312ac1[_0x2bc004(0x1f9)]}),_0x273720=_0x235b58[_0x2bc004(0x1dd)];_0x312ac1[_0x2bc004(0x1f9)]&&console[_0x2bc004(0x1d5)](_0x2bc004(0x1fc)+_0x273720);const _0x283df4=await withSpinner('Fetching\x20folder\x20\x27'+_0xa8d19c+_0x2bc004(0x249),()=>_0x59d72e[_0x2bc004(0x247)][_0x2bc004(0x233)](_0x273720),{'verbose':_0x312ac1[_0x2bc004(0x1f9)]});return await handleSDKOutput([_0x283df4[_0x2bc004(0x1dd)]],_0x312ac1),0x0;}catch(_0x35dc1d){if(_0x35dc1d instanceof SDKError)return console['error'](_0x2bc004(0x214)+_0x35dc1d[_0x2bc004(0x200)]),_0x35dc1d[_0x2bc004(0x1fa)]&&console[_0x2bc004(0x1d5)]('\x20\x20Cause:\x20'+_0x35dc1d['cause']),0x1;throw _0x35dc1d;}}}export class SegmentSQLCommand extends BaseCommand{[a37_0x5b4b5d(0x220)]=a37_0x5b4b5d(0x222);['description']=a37_0x5b4b5d(0x248);async[a37_0x5b4b5d(0x1d4)](_0x5bdc65){const _0x27115b=a37_0x5b4b5d,{options:_0x2ec676,args:_0x42770d}=_0x5bdc65,_0x2a4fec=_0x2ec676,_0x3cfc23=_0x2a4fec[_0x27115b(0x22f)],_0x13f421=_0x42770d[0x0];if(!_0x13f421&&!_0x3cfc23)return console[_0x27115b(0x1d5)](a37_0x4ef4cd[_0x27115b(0x20d)](_0x27115b(0x1f6))),console['error'](_0x27115b(0x1cb)),console[_0x27115b(0x1d5)]('\x20\x20Server-side\x20segment:\x20\x20tdx\x20sg\x20sql\x20<name>'),console[_0x27115b(0x1d5)](_0x27115b(0x251)),console['error'](_0x27115b(0x238)),console[_0x27115b(0x1d5)](_0x27115b(0x225)),console['error'](_0x27115b(0x1da)),0x1;if(_0x13f421&&_0x3cfc23)return console[_0x27115b(0x1d5)](a37_0x4ef4cd['red'](_0x27115b(0x1d9))),0x1;try{let _0x21592b;if(_0x3cfc23)_0x21592b=await this['getSQLFromYamlFile'](_0x3cfc23,_0x5bdc65);else{if(isYamlFilePath(_0x13f421))return console[_0x27115b(0x1d5)](a37_0x4ef4cd[_0x27115b(0x20d)]('Error:\x20YAML\x20file\x20paths\x20must\x20be\x20specified\x20with\x20--path\x20option')),console['error'](_0x27115b(0x1cd)+_0x13f421),0x1;else _0x21592b=await this[_0x27115b(0x1ca)](_0x13f421,_0x5bdc65);}return _0x2ec676[_0x27115b(0x21f)]===_0x27115b(0x261)||_0x2ec676['format']===_0x27115b(0x264)?await handleSDKOutput([{'sql':_0x21592b}],_0x2ec676):console[_0x27115b(0x263)](_0x21592b),0x0;}catch(_0x49fa41){if(_0x49fa41 instanceof SDKError)return console[_0x27115b(0x1d5)](_0x27115b(0x214)+_0x49fa41[_0x27115b(0x200)]),_0x49fa41[_0x27115b(0x1fa)]&&console[_0x27115b(0x1d5)]('\x20\x20Cause:\x20'+_0x49fa41[_0x27115b(0x1fa)]),0x1;throw _0x49fa41;}}async[a37_0x5b4b5d(0x1e7)](_0x596b63,_0x496868){const _0x492821=a37_0x5b4b5d,{options:_0x23e4df,tdx:_0x56af3b}=_0x496868;let _0x3cdda4;try{_0x3cdda4=await resolveYamlFilePath(_0x596b63);}catch(_0x42defd){throw new SDKError(ErrorCode[_0x492821(0x1d8)],_0x492821(0x206)+_0x42defd[_0x492821(0x200)]);}_0x23e4df[_0x492821(0x1f9)]&&console[_0x492821(0x1d5)](_0x492821(0x1c7)+_0x3cdda4[_0x492821(0x1e3)]+'/'+_0x3cdda4['segmentName']);const _0x221f20=await withSpinner(_0x492821(0x221),()=>_0x56af3b[_0x492821(0x247)]['getSegmentSQLFromYaml'](_0x3cdda4['content'],_0x3cdda4['parentSegment'],_0x3cdda4[_0x492821(0x232)]),{'verbose':_0x23e4df[_0x492821(0x1f9)]});return _0x221f20[_0x492821(0x1dd)];}async[a37_0x5b4b5d(0x1ca)](_0x1ce9b4,_0x5ac984){const _0x374c99=a37_0x5b4b5d,{options:_0x44b0d9,tdx:_0x1d2fa3}=_0x5ac984,_0x135861=_0x44b0d9[_0x374c99(0x1e3)],_0x5b76ba=await resolveSegmentTarget(_0x1ce9b4,_0x135861,_0x44b0d9[_0x374c99(0x1f9)]);_0x44b0d9[_0x374c99(0x1f9)]&&console['error'](_0x374c99(0x25a)+_0x5b76ba);const _0x418e3d=await withSpinner(_0x374c99(0x1ea)+_0x1ce9b4+'\x27...',()=>_0x1d2fa3['segment'][_0x374c99(0x23e)](_0x5b76ba),{'verbose':_0x44b0d9[_0x374c99(0x1f9)]}),_0x2011b7=_0x418e3d[_0x374c99(0x1dd)];_0x44b0d9[_0x374c99(0x1f9)]&&(console['error'](_0x374c99(0x1cf)+_0x2011b7[_0x374c99(0x204)]),console[_0x374c99(0x1d5)]('Parent\x20ID:\x20'+_0x2011b7[_0x374c99(0x24d)]));if(_0x2011b7['type']===_0x374c99(0x25d))throw new SDKError(ErrorCode[_0x374c99(0x1d8)],_0x374c99(0x201));if(_0x2011b7[_0x374c99(0x204)]==='parent')throw new SDKError(ErrorCode[_0x374c99(0x1d8)],'Cannot\x20get\x20SQL\x20for\x20parent\x20segment\x20with\x20this\x20command.\x20Use:\x20tdx\x20ps\x20sql');if(!_0x2011b7['segmentId'])throw new SDKError(ErrorCode[_0x374c99(0x1d2)],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x481adf=await withSpinner(_0x374c99(0x20f),()=>_0x1d2fa3[_0x374c99(0x247)]['getSegmentSQL'](_0x2011b7['parentId'],_0x2011b7[_0x374c99(0x241)]),{'verbose':_0x44b0d9['verbose']});return _0x481adf[_0x374c99(0x1dd)];}}export class SegmentFolderCreateCommand extends BaseCommand{[a37_0x5b4b5d(0x220)]='segment:folder:create';[a37_0x5b4b5d(0x209)]='Create\x20segment\x20folder\x20for\x20organization';async[a37_0x5b4b5d(0x1d4)](_0x119ff4){const _0x3de886=a37_0x5b4b5d,{options:_0x499ac8,args:_0x10d1be,tdx:_0x16db75}=_0x119ff4,_0x4ef40d=_0x499ac8;if(_0x10d1be[_0x3de886(0x218)]<0x2)return console['error'](_0x3de886(0x216)),console[_0x3de886(0x1d5)](_0x3de886(0x231)),0x1;const _0x240692=_0x10d1be[0x0],_0x4044aa=_0x10d1be[0x1];_0x4ef40d[_0x3de886(0x1f9)]&&(console['error']('Site:\x20'+_0x4ef40d['site']),console[_0x3de886(0x1d5)]('Parent\x20segment:\x20'+_0x240692),console[_0x3de886(0x1d5)]('Folder\x20name:\x20'+_0x4044aa));let _0xf6e0b3;if(_0x4ef40d[_0x3de886(0x23a)]){const _0x2b0607=_0x4ef40d[_0x3de886(0x23a)],_0x3d900a=await withSpinner(_0x3de886(0x1d6)+_0x240692+'\x27...',()=>_0x16db75[_0x3de886(0x247)][_0x3de886(0x25f)](_0x240692),{'verbose':_0x4ef40d['verbose']}),_0x2fc34b=_0x3d900a[_0x3de886(0x1dd)],_0x3e4003=await withSpinner(_0x3de886(0x210)+_0x2b0607+_0x3de886(0x249),()=>_0x16db75['segment']['resolveFolderId'](_0x2fc34b,_0x2b0607),{'verbose':_0x4ef40d[_0x3de886(0x1f9)]});_0xf6e0b3=_0x3e4003[_0x3de886(0x1dd)],_0x4ef40d[_0x3de886(0x1f9)]&&console['error']('Resolved\x20parent\x20folder\x20ID:\x20'+_0xf6e0b3);}const _0xedeb2d={'name':_0x4044aa,'description':_0x4ef40d[_0x3de886(0x209)],'parentFolderId':_0xf6e0b3},_0x1b8a45=await withSpinner(_0x3de886(0x1de)+_0x4044aa+_0x3de886(0x249),()=>_0x16db75[_0x3de886(0x247)][_0x3de886(0x1f5)](_0x240692,_0xedeb2d),{'verbose':_0x4ef40d[_0x3de886(0x1f9)]}),_0x24a65a=_0x1b8a45[_0x3de886(0x1dd)];return console[_0x3de886(0x1d5)](_0x3de886(0x1db)+_0x24a65a[_0x3de886(0x220)]+_0x3de886(0x23f)+_0x24a65a['id']),await handleSDKOutput([_0x24a65a],_0x4ef40d),0x0;}}export class SegmentViewCommand extends BaseCommand{[a37_0x5b4b5d(0x220)]=a37_0x5b4b5d(0x211);[a37_0x5b4b5d(0x209)]=a37_0x5b4b5d(0x246);async['execute'](_0x35c229){const _0x3036e9=a37_0x5b4b5d,{options:_0x457d4a,args:_0x5a64d1,tdx:_0x4d79f7}=_0x35c229,_0x5651f9=_0x5a64d1[0x0];if(!_0x5651f9)return console['error'](_0x3036e9(0x1cc)),console[_0x3036e9(0x1d5)](_0x3036e9(0x1c8)),console[_0x3036e9(0x1d5)]('\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20view\x20<path/to/segment.yml>'),console[_0x3036e9(0x1d5)]('Options:'),console[_0x3036e9(0x1d5)](_0x3036e9(0x235)),console[_0x3036e9(0x1d5)](_0x3036e9(0x238)),console['error'](_0x3036e9(0x21d)),console[_0x3036e9(0x1d5)]('\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20\x20\x20\x20\x20#\x20View\x20child\x20segment\x20details'),console[_0x3036e9(0x1d5)]('\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20-w\x20\x20#\x20Open\x20segment\x20in\x20web\x20browser'),console[_0x3036e9(0x1d5)]('\x20\x20tdx\x20sg\x20view\x20segments/my-audience/premium-users.yml'),0x1;try{const _0x1fc4ab=_0x457d4a[_0x3036e9(0x1e3)],_0x3162fa=await resolveSegmentTarget(_0x5651f9,_0x1fc4ab,_0x457d4a[_0x3036e9(0x1f9)]);_0x457d4a[_0x3036e9(0x1f9)]&&console[_0x3036e9(0x1d5)](_0x3036e9(0x25a)+_0x3162fa);const _0x1ad57b=await withSpinner('Resolving\x20\x27'+_0x5651f9+_0x3036e9(0x249),()=>_0x4d79f7[_0x3036e9(0x247)][_0x3036e9(0x23e)](_0x3162fa),{'verbose':_0x457d4a['verbose']}),_0x1c4883=_0x1ad57b['data'];_0x457d4a[_0x3036e9(0x1f9)]&&(console['error'](_0x3036e9(0x1cf)+_0x1c4883[_0x3036e9(0x204)]),console[_0x3036e9(0x1d5)]('Parent\x20ID:\x20'+_0x1c4883['parentId']),_0x1c4883[_0x3036e9(0x25e)]&&console['error'](_0x3036e9(0x1fb)+_0x1c4883[_0x3036e9(0x25e)]),_0x1c4883[_0x3036e9(0x241)]&&console['error']('Segment\x20ID:\x20'+_0x1c4883['segmentId']));if(_0x457d4a[_0x3036e9(0x1f4)]){if(_0x1c4883[_0x3036e9(0x204)]===_0x3036e9(0x25d))return console[_0x3036e9(0x1d5)]('Error:\x20Cannot\x20open\x20folder\x20in\x20web\x20browser.\x20Use\x20a\x20segment\x20name\x20instead.'),0x1;if(_0x1c4883[_0x3036e9(0x204)]===_0x3036e9(0x219))return console[_0x3036e9(0x1d5)](_0x3036e9(0x1fe)),console[_0x3036e9(0x1d5)](_0x3036e9(0x257)),0x1;if(!_0x1c4883['segmentId'])throw new SDKError(ErrorCode[_0x3036e9(0x1d2)],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x1b8192=getConsoleNextUrl(_0x457d4a[_0x3036e9(0x22e)],_0x3036e9(0x255)+_0x1c4883[_0x3036e9(0x24d)]+'/e/'+_0x1c4883[_0x3036e9(0x241)]);return console['error'](a37_0x4ef4cd[_0x3036e9(0x22c)]('✔')+_0x3036e9(0x1d7)+a37_0x4ef4cd['cyan'](_0x1b8192)),openBrowser(_0x1b8192),0x0;}if(_0x1c4883['type']==='folder'){if(!_0x1c4883['folderId'])throw new SDKError(ErrorCode[_0x3036e9(0x1e4)],_0x3036e9(0x1e8));const _0x512632=await withSpinner(_0x3036e9(0x265),()=>_0x4d79f7['segment'][_0x3036e9(0x233)](_0x1c4883['folderId']),{'verbose':_0x457d4a[_0x3036e9(0x1f9)]});await handleSingleObjectOutput(_0x512632['data'],_0x457d4a);}else{if(_0x1c4883[_0x3036e9(0x204)]===_0x3036e9(0x247)){if(!_0x1c4883[_0x3036e9(0x241)])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x3036e9(0x212));const _0x546945=await withSpinner(_0x3036e9(0x239),()=>_0x4d79f7['segment'][_0x3036e9(0x25c)](_0x1c4883['parentId'],_0x1c4883['segmentId']),{'verbose':_0x457d4a[_0x3036e9(0x1f9)]}),_0x40d922=getConsoleNextUrl(_0x457d4a[_0x3036e9(0x22e)],_0x3036e9(0x255)+_0x1c4883[_0x3036e9(0x24d)]+_0x3036e9(0x262)+_0x1c4883['segmentId']),_0x3cad61=_0x546945[_0x3036e9(0x1dd)];_0x3cad61[_0x3036e9(0x22a)]=_0x40d922,await handleSingleObjectOutput(_0x3cad61,_0x457d4a);}else return console[_0x3036e9(0x1d5)](_0x3036e9(0x1ed)),console[_0x3036e9(0x1d5)]('Use:\x20tdx\x20ps\x20view'),0x1;}return 0x0;}catch(_0x4b4127){if(_0x4b4127 instanceof SDKError)return console[_0x3036e9(0x1d5)](_0x3036e9(0x214)+_0x4b4127['message']),_0x4b4127[_0x3036e9(0x1fa)]&&console[_0x3036e9(0x1d5)]('\x20\x20Cause:\x20'+_0x4b4127[_0x3036e9(0x1fa)]),0x1;throw _0x4b4127;}}}export const SegmentInfoCommand=SegmentViewCommand;export class SegmentDescCommand extends BaseCommand{[a37_0x5b4b5d(0x220)]='segment:desc';[a37_0x5b4b5d(0x209)]=a37_0x5b4b5d(0x202);async[a37_0x5b4b5d(0x1d4)](_0x2aaf93){const _0x3ad646=a37_0x5b4b5d,{options:_0x502f99,args:_0x20b674,tdx:_0x69eb7b}=_0x2aaf93,_0xb64a07=_0x20b674[0x0];if(!_0xb64a07)return console[_0x3ad646(0x1d5)](_0x3ad646(0x24c)),console[_0x3ad646(0x1d5)](_0x3ad646(0x23c)),console['error'](_0x3ad646(0x26b)),console[_0x3ad646(0x1d5)](_0x3ad646(0x238)),console[_0x3ad646(0x1d5)](_0x3ad646(0x203)),console[_0x3ad646(0x1d5)](_0x3ad646(0x1e5)),0x1;try{const _0x23d4f0=_0x502f99[_0x3ad646(0x1e3)],_0x545d7c=await resolveSegmentTarget(_0xb64a07,_0x23d4f0,_0x502f99[_0x3ad646(0x1f9)]);_0x502f99['verbose']&&console[_0x3ad646(0x1d5)]('Target\x20path:\x20'+_0x545d7c);const _0x2b7a55=await withSpinner(_0x3ad646(0x1ea)+_0xb64a07+_0x3ad646(0x249),()=>_0x69eb7b['segment'][_0x3ad646(0x23e)](_0x545d7c),{'verbose':_0x502f99[_0x3ad646(0x1f9)]}),_0x4c6b70=_0x2b7a55['data'];_0x502f99[_0x3ad646(0x1f9)]&&(console[_0x3ad646(0x1d5)](_0x3ad646(0x1cf)+_0x4c6b70[_0x3ad646(0x204)]),console['error'](_0x3ad646(0x1f0)+_0x4c6b70['parentId']));if(_0x4c6b70['type']==='folder')return console[_0x3ad646(0x1d5)](_0x3ad646(0x20c)),console[_0x3ad646(0x1d5)](_0x3ad646(0x242)),0x1;if(_0x4c6b70[_0x3ad646(0x204)]===_0x3ad646(0x219))return console['error'](_0x3ad646(0x223)),console[_0x3ad646(0x1d5)](_0x3ad646(0x226)),0x1;if(!_0x4c6b70[_0x3ad646(0x241)])throw new SDKError(ErrorCode[_0x3ad646(0x1d2)],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x5c2fe8=await withSpinner('Fetching\x20SQL\x20for\x20segment...',()=>_0x69eb7b[_0x3ad646(0x247)][_0x3ad646(0x1df)](_0x4c6b70[_0x3ad646(0x24d)],_0x4c6b70['segmentId']),{'verbose':_0x502f99[_0x3ad646(0x1f9)]}),_0x43cc0b=_0x5c2fe8[_0x3ad646(0x1dd)],_0x3de7a1=await executeSchemaQuery(_0x43cc0b,_0x69eb7b,_0x502f99);return await handleQueryOutput(_0x3de7a1,_0x502f99),0x0;}catch(_0x508659){if(_0x508659 instanceof SDKError)return console[_0x3ad646(0x1d5)](_0x3ad646(0x214)+_0x508659[_0x3ad646(0x200)]),_0x508659[_0x3ad646(0x1fa)]&&console[_0x3ad646(0x1d5)](_0x3ad646(0x230)+_0x508659[_0x3ad646(0x1fa)]),0x1;throw _0x508659;}}}
@@ -1 +1 @@
1
- const a38_0xb3245e=a38_0x1d60;(function(_0x7b30fc,_0x552136){const _0x5565e6=a38_0x1d60,_0x1dba3c=_0x7b30fc();while(!![]){try{const _0x3f3016=-parseInt(_0x5565e6(0x137))/0x1+parseInt(_0x5565e6(0x13d))/0x2+parseInt(_0x5565e6(0x15d))/0x3+parseInt(_0x5565e6(0x161))/0x4+parseInt(_0x5565e6(0x162))/0x5+-parseInt(_0x5565e6(0x14a))/0x6*(parseInt(_0x5565e6(0x12c))/0x7)+parseInt(_0x5565e6(0x14d))/0x8*(parseInt(_0x5565e6(0x147))/0x9);if(_0x3f3016===_0x552136)break;else _0x1dba3c['push'](_0x1dba3c['shift']());}catch(_0x360b2f){_0x1dba3c['push'](_0x1dba3c['shift']());}}}(a38_0x1823,0xf2fc2));function a38_0x1d60(_0x14410c,_0x5c3d51){_0x14410c=_0x14410c-0x12b;const _0x1823c1=a38_0x1823();let _0x1d6066=_0x1823c1[_0x14410c];return _0x1d6066;}import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import{loadJSONFromOptions}from'../utils/json-loader.js';import{parsePath,getParentPath,getBaseName}from'../sdk/segment/segment-path-parser.js';import a38_0xc89738 from'chalk';export class SegmentCreateCommand extends BaseCommand{[a38_0xb3245e(0x146)]='segment:create';[a38_0xb3245e(0x143)]=a38_0xb3245e(0x14f);async[a38_0xb3245e(0x15a)](_0x7675ff){const _0x102191=a38_0xb3245e;console[_0x102191(0x151)](a38_0xc89738[_0x102191(0x12f)]('⚠\x20Deprecation\x20warning:\x20`segment\x20create`\x20is\x20deprecated.')),console['error'](a38_0xc89738['yellow'](_0x102191(0x155)));const {options:_0x390637,args:_0xa06559,tdx:_0xf2ec81}=_0x7675ff,_0x48b8d7=_0x390637;if(_0xa06559[_0x102191(0x133)]===0x0)return console[_0x102191(0x151)]('Error:\x20Segment\x20path\x20or\x20name\x20is\x20required'),console['error'](_0x102191(0x159)),console[_0x102191(0x151)]('Examples:'),console[_0x102191(0x151)](_0x102191(0x138)),console['error'](_0x102191(0x12e)),console[_0x102191(0x151)](_0x102191(0x158)),0x1;const _0x5a8942=_0xa06559[0x0],_0x3219ba=_0x390637[_0x102191(0x130)];let _0x2258df=_0x5a8942;_0x3219ba&&!_0x5a8942['includes']('/')&&(_0x2258df=_0x3219ba+'/'+_0x5a8942,_0x48b8d7[_0x102191(0x140)]&&console[_0x102191(0x151)](_0x102191(0x144)+_0x2258df));const _0x56b3d4=parsePath(_0x2258df);if(_0x56b3d4[_0x102191(0x139)]['length']<0x2)return console[_0x102191(0x151)](_0x102191(0x152)),console[_0x102191(0x151)](_0x102191(0x157)),0x1;const _0x5dd91c=_0x56b3d4[_0x102191(0x139)][0x0],_0x5bb44a=getBaseName(_0x2258df),_0x405440=getParentPath(_0x2258df);_0x48b8d7[_0x102191(0x140)]&&(console[_0x102191(0x151)](_0x102191(0x14e)+_0x48b8d7[_0x102191(0x149)]),console[_0x102191(0x151)](_0x102191(0x148)+_0x2258df),console[_0x102191(0x151)](_0x102191(0x13b)+_0x5dd91c),console[_0x102191(0x151)](_0x102191(0x135)+_0x5bb44a),console[_0x102191(0x151)](_0x102191(0x154)+_0x405440));const _0x9fe12d=await withSpinner(_0x102191(0x15b)+_0x5dd91c+_0x102191(0x153),()=>_0xf2ec81[_0x102191(0x160)][_0x102191(0x12d)](_0x5dd91c),{'verbose':_0x48b8d7[_0x102191(0x140)]}),_0x19f346=_0x9fe12d[_0x102191(0x13f)];let _0x348f65;if(_0x56b3d4[_0x102191(0x139)][_0x102191(0x133)]>0x2){const _0x19e90f=await withSpinner(_0x102191(0x12b)+_0x405440+'\x27...',()=>_0xf2ec81[_0x102191(0x160)][_0x102191(0x142)](_0x405440),{'verbose':_0x48b8d7[_0x102191(0x140)]}),_0x267e41=_0x19e90f[_0x102191(0x13f)];if(_0x267e41[_0x102191(0x14c)]!==_0x102191(0x145)&&_0x267e41[_0x102191(0x14c)]!==_0x102191(0x15f))return console[_0x102191(0x151)](_0x102191(0x131)),0x1;_0x348f65=_0x267e41[_0x102191(0x150)];}else{if(_0x48b8d7[_0x102191(0x145)]){const _0x22f370=await withSpinner('Resolving\x20folder\x20\x27'+_0x48b8d7[_0x102191(0x145)]+_0x102191(0x153),()=>_0xf2ec81['segment'][_0x102191(0x13c)](_0x19f346,_0x48b8d7[_0x102191(0x145)]),{'verbose':_0x48b8d7[_0x102191(0x140)]});_0x348f65=_0x22f370['data'];}}_0x48b8d7[_0x102191(0x140)]&&_0x348f65&&console[_0x102191(0x151)](_0x102191(0x134)+_0x348f65);const _0x5493ad=await loadJSONFromOptions(_0x48b8d7[_0x102191(0x136)],_0x48b8d7['ruleFile']),_0x1fc154={'name':_0x5bb44a,'description':_0x48b8d7[_0x102191(0x143)],'rule':_0x5493ad,'kind':_0x48b8d7[_0x102191(0x13e)]!==undefined?parseInt(_0x48b8d7[_0x102191(0x13e)],0xa):undefined,'isVisible':_0x48b8d7[_0x102191(0x156)]?![]:undefined,'segmentFolderId':_0x348f65,'countPopulation':_0x48b8d7[_0x102191(0x13a)]?![]:undefined},_0x305655=await withSpinner(_0x102191(0x15c)+_0x5bb44a+'\x27...',()=>_0xf2ec81['segment'][_0x102191(0x14b)](_0x19f346,_0x1fc154),{'verbose':_0x48b8d7['verbose']}),_0xfd5aa7=_0x305655['data'];return console[_0x102191(0x151)](_0x102191(0x15e)+_0xfd5aa7[_0x102191(0x146)]+_0x102191(0x132)+_0xfd5aa7['id']),_0x2258df!==_0x5a8942&&console[_0x102191(0x151)](_0x102191(0x141)+_0x2258df),await handleSDKOutput([_0xfd5aa7],_0x48b8d7),0x0;}}function a38_0x1823(){const _0x42578f=['verbose','\x20\x20\x20Path:\x20','resolvePathToResource','description','Resolved\x20relative\x20path\x20to:\x20','folder','name','36fcZkcF','Target\x20path:\x20','site','24744vuksbT','createSegment','type','817976DFQERu','Site:\x20','Create\x20child\x20segment\x20with\x20filtering\x20rules','folderId','error','Error:\x20Full\x20path\x20required\x20(parent/segment_name\x20or\x20parent/folder/segment_name)','\x27...','Parent\x20path:\x20','\x20\x20Use\x20`tdx\x20sg\x20push`\x20with\x20YAML\x20files\x20instead.\x0a','invisible','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','Usage:\x20tdx\x20segment\x20create\x20<path>\x20[options]','execute','Resolving\x20parent\x20segment\x20\x27','Creating\x20segment\x20\x27','2302506WVQLzx','✔\x20Created\x20segment\x20\x27','parent','segment','4599428QYUljo','1373260URlScu','Resolving\x20folder\x20path\x20\x27','581GFizdi','resolveParentId','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/Marketing/Premium\x22\x20--rule\x20\x27...\x27','yellow','segmentPath','Error:\x20Cannot\x20create\x20segment\x20in\x20a\x20segment.\x20Parent\x20path\x20must\x20be\x20a\x20folder\x20or\x20parent.','\x27\x20with\x20ID:\x20','length','Resolved\x20folder\x20ID:\x20','Segment\x20name:\x20','rule','1500765CcnZuV','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/High\x20Value\x22\x20--rule\x20\x27...\x27','segments','noCountPopulation','Parent:\x20','resolveFolderId','474648oViopJ','kind','data'];a38_0x1823=function(){return _0x42578f;};return a38_0x1823();}
1
+ const a38_0x11657f=a38_0x16e2;(function(_0x517d3e,_0x40611a){const _0x4b9540=a38_0x16e2,_0x1e258d=_0x517d3e();while(!![]){try{const _0x408c94=-parseInt(_0x4b9540(0x172))/0x1+-parseInt(_0x4b9540(0x162))/0x2+-parseInt(_0x4b9540(0x15f))/0x3+parseInt(_0x4b9540(0x18c))/0x4*(parseInt(_0x4b9540(0x18d))/0x5)+-parseInt(_0x4b9540(0x186))/0x6*(-parseInt(_0x4b9540(0x180))/0x7)+-parseInt(_0x4b9540(0x170))/0x8*(parseInt(_0x4b9540(0x166))/0x9)+parseInt(_0x4b9540(0x175))/0xa;if(_0x408c94===_0x40611a)break;else _0x1e258d['push'](_0x1e258d['shift']());}catch(_0xa2a825){_0x1e258d['push'](_0x1e258d['shift']());}}}(a38_0x3998,0x94197));import{BaseCommand}from'./command.js';function a38_0x3998(){const _0x5a9554=['143980LjSlVg','execute','\x20\x20\x20Path:\x20','\x20\x20tdx\x20segment\x20create\x20\x22Premium\x22\x20--rule\x20\x27...\x27\x20\x20#\x20Relative\x20to\x20context','Usage:\x20tdx\x20segment\x20create\x20<parent/segment_name>\x20[options]','620595gbONlo','Resolving\x20parent\x20segment\x20\x27','Site:\x20','2411994qlSIJO','Error:\x20Segment\x20path\x20or\x20name\x20is\x20required','Create\x20child\x20segment\x20with\x20filtering\x20rules','Error:\x20Cannot\x20create\x20segment\x20in\x20a\x20segment.\x20Parent\x20path\x20must\x20be\x20a\x20folder\x20or\x20parent.','2443752HFSsAJ','Examples:','verbose','noCountPopulation','error','invisible','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/Marketing/Premium\x22\x20--rule\x20\x27...\x27','Creating\x20segment\x20\x27','createSegment','rule','24UUuFIu','segment:create','383459uPilnI','folder','Target\x20path:\x20','21272400nTLjKC','description','type','segments','Resolving\x20folder\x20\x27','\x27...','ruleFile','length','includes','segmentPath','resolvePathToResource','10507mQlCoz','Resolving\x20folder\x20path\x20\x27','segment','parent','⚠\x20Deprecation\x20warning:\x20`segment\x20create`\x20is\x20deprecated.','data','4128VicAAy','yellow','Segment\x20name:\x20','kind','name','Parent\x20path:\x20','8IQPDya'];a38_0x3998=function(){return _0x5a9554;};return a38_0x3998();}import{handleSDKOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import{loadJSONFromOptions}from'../utils/json-loader.js';import{parsePath,getParentPath,getBaseName}from'../sdk/segment/segment-path-parser.js';function a38_0x16e2(_0x5053a0,_0x1f4be9){_0x5053a0=_0x5053a0-0x15c;const _0x39988b=a38_0x3998();let _0x16e28c=_0x39988b[_0x5053a0];return _0x16e28c;}import a38_0x193bb6 from'chalk';export class SegmentCreateCommand extends BaseCommand{['name']=a38_0x11657f(0x171);[a38_0x11657f(0x176)]=a38_0x11657f(0x164);async[a38_0x11657f(0x18e)](_0xf64f96){const _0x4ca492=a38_0x11657f;console[_0x4ca492(0x16a)](a38_0x193bb6[_0x4ca492(0x187)](_0x4ca492(0x184))),console[_0x4ca492(0x16a)](a38_0x193bb6['yellow']('\x20\x20Use\x20`tdx\x20sg\x20push`\x20with\x20YAML\x20files\x20instead.\x0a'));const {options:_0x5677c9,args:_0x36e4b6,tdx:_0x25fa76}=_0xf64f96,_0x148400=_0x5677c9;if(_0x36e4b6[_0x4ca492(0x17c)]===0x0)return console[_0x4ca492(0x16a)](_0x4ca492(0x163)),console['error']('Usage:\x20tdx\x20segment\x20create\x20<path>\x20[options]'),console[_0x4ca492(0x16a)](_0x4ca492(0x167)),console[_0x4ca492(0x16a)]('\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/High\x20Value\x22\x20--rule\x20\x27...\x27'),console['error'](_0x4ca492(0x16c)),console['error'](_0x4ca492(0x15d)),0x1;const _0x143330=_0x36e4b6[0x0],_0x31f5df=_0x5677c9[_0x4ca492(0x17e)];let _0x14463b=_0x143330;_0x31f5df&&!_0x143330[_0x4ca492(0x17d)]('/')&&(_0x14463b=_0x31f5df+'/'+_0x143330,_0x148400[_0x4ca492(0x168)]&&console['error']('Resolved\x20relative\x20path\x20to:\x20'+_0x14463b));const _0x4e46ec=parsePath(_0x14463b);if(_0x4e46ec['segments']['length']<0x2)return console[_0x4ca492(0x16a)]('Error:\x20Full\x20path\x20required\x20(parent/segment_name\x20or\x20parent/folder/segment_name)'),console[_0x4ca492(0x16a)](_0x4ca492(0x15e)),0x1;const _0x840af3=_0x4e46ec[_0x4ca492(0x178)][0x0],_0x51e84a=getBaseName(_0x14463b),_0x17c8b2=getParentPath(_0x14463b);_0x148400[_0x4ca492(0x168)]&&(console['error'](_0x4ca492(0x161)+_0x148400['site']),console[_0x4ca492(0x16a)](_0x4ca492(0x174)+_0x14463b),console[_0x4ca492(0x16a)]('Parent:\x20'+_0x840af3),console['error'](_0x4ca492(0x188)+_0x51e84a),console['error'](_0x4ca492(0x18b)+_0x17c8b2));const _0x2dcebd=await withSpinner(_0x4ca492(0x160)+_0x840af3+_0x4ca492(0x17a),()=>_0x25fa76['segment']['resolveParentId'](_0x840af3),{'verbose':_0x148400[_0x4ca492(0x168)]}),_0x54f00a=_0x2dcebd[_0x4ca492(0x185)];let _0x3c0830;if(_0x4e46ec[_0x4ca492(0x178)][_0x4ca492(0x17c)]>0x2){const _0x5f555e=await withSpinner(_0x4ca492(0x181)+_0x17c8b2+'\x27...',()=>_0x25fa76['segment'][_0x4ca492(0x17f)](_0x17c8b2),{'verbose':_0x148400[_0x4ca492(0x168)]}),_0x220d92=_0x5f555e[_0x4ca492(0x185)];if(_0x220d92[_0x4ca492(0x177)]!==_0x4ca492(0x173)&&_0x220d92[_0x4ca492(0x177)]!==_0x4ca492(0x183))return console[_0x4ca492(0x16a)](_0x4ca492(0x165)),0x1;_0x3c0830=_0x220d92['folderId'];}else{if(_0x148400['folder']){const _0x552d5e=await withSpinner(_0x4ca492(0x179)+_0x148400[_0x4ca492(0x173)]+_0x4ca492(0x17a),()=>_0x25fa76[_0x4ca492(0x182)]['resolveFolderId'](_0x54f00a,_0x148400[_0x4ca492(0x173)]),{'verbose':_0x148400[_0x4ca492(0x168)]});_0x3c0830=_0x552d5e[_0x4ca492(0x185)];}}_0x148400[_0x4ca492(0x168)]&&_0x3c0830&&console[_0x4ca492(0x16a)]('Resolved\x20folder\x20ID:\x20'+_0x3c0830);const _0x2c21fb=await loadJSONFromOptions(_0x148400[_0x4ca492(0x16f)],_0x148400[_0x4ca492(0x17b)]),_0x46cbb2={'name':_0x51e84a,'description':_0x148400[_0x4ca492(0x176)],'rule':_0x2c21fb,'kind':_0x148400[_0x4ca492(0x189)]!==undefined?parseInt(_0x148400[_0x4ca492(0x189)],0xa):undefined,'isVisible':_0x148400[_0x4ca492(0x16b)]?![]:undefined,'segmentFolderId':_0x3c0830,'countPopulation':_0x148400[_0x4ca492(0x169)]?![]:undefined},_0x41fb40=await withSpinner(_0x4ca492(0x16d)+_0x51e84a+_0x4ca492(0x17a),()=>_0x25fa76[_0x4ca492(0x182)][_0x4ca492(0x16e)](_0x54f00a,_0x46cbb2),{'verbose':_0x148400[_0x4ca492(0x168)]}),_0x29d97c=_0x41fb40[_0x4ca492(0x185)];return console[_0x4ca492(0x16a)]('✔\x20Created\x20segment\x20\x27'+_0x29d97c[_0x4ca492(0x18a)]+'\x27\x20with\x20ID:\x20'+_0x29d97c['id']),_0x14463b!==_0x143330&&console['error'](_0x4ca492(0x15c)+_0x14463b),await handleSDKOutput([_0x29d97c],_0x148400),0x0;}}
@@ -1 +1 @@
1
- const a39_0x7de7a0=a39_0x3acd;function a39_0x3acd(_0x3b17e3,_0x7a8120){_0x3b17e3=_0x3b17e3-0xf3;const _0x36e3da=a39_0x36e3();let _0x3acdec=_0x36e3da[_0x3b17e3];return _0x3acdec;}(function(_0x55bb42,_0x165100){const _0x56af9d=a39_0x3acd,_0x4627dc=_0x55bb42();while(!![]){try{const _0x54a3ea=-parseInt(_0x56af9d(0xfe))/0x1+-parseInt(_0x56af9d(0xf9))/0x2*(-parseInt(_0x56af9d(0x106))/0x3)+parseInt(_0x56af9d(0x104))/0x4*(-parseInt(_0x56af9d(0x109))/0x5)+-parseInt(_0x56af9d(0x101))/0x6+-parseInt(_0x56af9d(0xf3))/0x7*(-parseInt(_0x56af9d(0x10a))/0x8)+-parseInt(_0x56af9d(0xf7))/0x9*(-parseInt(_0x56af9d(0x108))/0xa)+parseInt(_0x56af9d(0x10c))/0xb;if(_0x54a3ea===_0x165100)break;else _0x4627dc['push'](_0x4627dc['shift']());}catch(_0x5eb751){_0x4627dc['push'](_0x4627dc['shift']());}}}(a39_0x36e3,0x21271));function a39_0x36e3(){const _0xdc10eb=['Error:\x20Parent\x20segment\x20name\x20is\x20required','140070dawcAJ','933655aqBwfE','472znZJDA','\x20field','3766323xkmuiY','25942MRQGEV','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','jsonl','length','54ZPFDSS','✔\x20Found\x20','25248nrqPAJ','description','verbose','error','List\x20available\x20fields\x20for\x20segmentation','226352PPahYf','Parent\x20segment:\x20','listFields','728766LGhCfv','execute','parentSegment','4URwuGI','\x27...','6aOBNCN'];a39_0x36e3=function(){return _0xdc10eb;};return a39_0x36e3();}import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import{displayFieldsHumanReadable}from'../sdk/segment/fields-display.js';export class SegmentFieldsCommand extends BaseCommand{['name']='segment:fields';[a39_0x7de7a0(0xfa)]=a39_0x7de7a0(0xfd);async[a39_0x7de7a0(0x102)](_0x216225){const _0x41c367=a39_0x7de7a0,{options:_0x344da7,args:_0x123cdf,tdx:_0x41bf64}=_0x216225,_0x243ff7=_0x123cdf[0x0]||_0x344da7[_0x41c367(0x103)];if(!_0x243ff7)return console[_0x41c367(0xfc)](_0x41c367(0x107)),console[_0x41c367(0xfc)]('Usage:\x20tdx\x20segment\x20fields\x20<parent_name>'),console[_0x41c367(0xfc)](_0x41c367(0xf4)),0x1;_0x344da7[_0x41c367(0xfb)]&&(console[_0x41c367(0xfc)]('Site:\x20'+_0x344da7['site']),console[_0x41c367(0xfc)](_0x41c367(0xff)+_0x243ff7));const _0x27b12=await withSpinner('Listing\x20fields\x20for\x20\x27'+_0x243ff7+_0x41c367(0x105),()=>_0x41bf64['segment'][_0x41c367(0x100)](_0x243ff7),{'verbose':_0x344da7[_0x41c367(0xfb)]}),_0x4cefcd=_0x27b12['data'];console[_0x41c367(0xfc)](_0x41c367(0xf8)+_0x4cefcd[_0x41c367(0xf6)]+_0x41c367(0x10b)+(_0x4cefcd[_0x41c367(0xf6)]!==0x1?'s':''));if(_0x344da7['json']||_0x344da7[_0x41c367(0xf5)])return await handleSDKOutput(_0x4cefcd,_0x344da7),0x0;return displayFieldsHumanReadable(_0x4cefcd,_0x243ff7),0x0;}}
1
+ const a39_0x48d860=a39_0x2235;(function(_0x2d9fa4,_0x9e4683){const _0xd2d5d7=a39_0x2235,_0x2a6cf0=_0x2d9fa4();while(!![]){try{const _0x12afc4=-parseInt(_0xd2d5d7(0x7d))/0x1+parseInt(_0xd2d5d7(0x87))/0x2+parseInt(_0xd2d5d7(0x88))/0x3+parseInt(_0xd2d5d7(0x8d))/0x4*(-parseInt(_0xd2d5d7(0x77))/0x5)+-parseInt(_0xd2d5d7(0x7b))/0x6*(parseInt(_0xd2d5d7(0x76))/0x7)+-parseInt(_0xd2d5d7(0x80))/0x8*(parseInt(_0xd2d5d7(0x85))/0x9)+parseInt(_0xd2d5d7(0x8a))/0xa;if(_0x12afc4===_0x9e4683)break;else _0x2a6cf0['push'](_0x2a6cf0['shift']());}catch(_0x33c04b){_0x2a6cf0['push'](_0x2a6cf0['shift']());}}}(a39_0x4819,0x444fe));import{BaseCommand}from'./command.js';function a39_0x2235(_0x5332be,_0x19bea5){_0x5332be=_0x5332be-0x73;const _0x4819f1=a39_0x4819();let _0x223542=_0x4819f1[_0x5332be];return _0x223542;}import{handleSDKOutput}from'../core/command-output.js';function a39_0x4819(){const _0x19dd34=['632AroXIa','jsonl','✔\x20Found\x20','listFields','\x27...','5283IfIhRT','json','876996BcFnzC','1505133pxgadq','verbose','1296560tQmbay','error','name','430580rfElXH','\x20field','length','segment:fields','description','364BNWYAS','15SYQNeo','data','parentSegment','segment','34050HcNPrL','Error:\x20Parent\x20segment\x20name\x20is\x20required','125651xBQZaI','Site:\x20','site'];a39_0x4819=function(){return _0x19dd34;};return a39_0x4819();}import{withSpinner}from'../utils/spinner.js';import{displayFieldsHumanReadable}from'../sdk/segment/fields-display.js';export class SegmentFieldsCommand extends BaseCommand{[a39_0x48d860(0x8c)]=a39_0x48d860(0x74);[a39_0x48d860(0x75)]='List\x20available\x20fields\x20for\x20segmentation';async['execute'](_0x1ead9e){const _0x57abcc=a39_0x48d860,{options:_0x1c0ebb,args:_0x3d7fa5,tdx:_0x49b028}=_0x1ead9e,_0x2c28bb=_0x3d7fa5[0x0]||_0x1c0ebb[_0x57abcc(0x79)];if(!_0x2c28bb)return console['error'](_0x57abcc(0x7c)),console[_0x57abcc(0x8b)]('Usage:\x20tdx\x20segment\x20fields\x20<parent_name>'),console['error']('\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>'),0x1;_0x1c0ebb['verbose']&&(console[_0x57abcc(0x8b)](_0x57abcc(0x7e)+_0x1c0ebb[_0x57abcc(0x7f)]),console['error']('Parent\x20segment:\x20'+_0x2c28bb));const _0x3fa2db=await withSpinner('Listing\x20fields\x20for\x20\x27'+_0x2c28bb+_0x57abcc(0x84),()=>_0x49b028[_0x57abcc(0x7a)][_0x57abcc(0x83)](_0x2c28bb),{'verbose':_0x1c0ebb[_0x57abcc(0x89)]}),_0x492c28=_0x3fa2db[_0x57abcc(0x78)];console[_0x57abcc(0x8b)](_0x57abcc(0x82)+_0x492c28[_0x57abcc(0x73)]+_0x57abcc(0x8e)+(_0x492c28[_0x57abcc(0x73)]!==0x1?'s':''));if(_0x1c0ebb[_0x57abcc(0x86)]||_0x1c0ebb[_0x57abcc(0x81)])return await handleSDKOutput(_0x492c28,_0x1c0ebb),0x0;return displayFieldsHumanReadable(_0x492c28,_0x2c28bb),0x0;}}