@treasuredata/tdx 2026.7.0 → 2026.7.2

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 (283) hide show
  1. package/dist/bin.js +1 -1
  2. package/dist/build-info.json +3 -3
  3. package/dist/cli-categories.js +1 -1
  4. package/dist/cli.d.ts.map +1 -1
  5. package/dist/cli.js +1 -1
  6. package/dist/cli.js.map +1 -1
  7. package/dist/commands/activations.js +1 -1
  8. package/dist/commands/agent-command.js +1 -1
  9. package/dist/commands/agent-test-command.js +1 -1
  10. package/dist/commands/api-command.js +1 -1
  11. package/dist/commands/auth-command.js +1 -1
  12. package/dist/commands/cas-command.d.ts +20 -0
  13. package/dist/commands/cas-command.d.ts.map +1 -1
  14. package/dist/commands/cas-command.js +1 -1
  15. package/dist/commands/cas-command.js.map +1 -1
  16. package/dist/commands/cas-segment-command.d.ts +24 -0
  17. package/dist/commands/cas-segment-command.d.ts.map +1 -1
  18. package/dist/commands/cas-segment-command.js +1 -1
  19. package/dist/commands/cas-segment-command.js.map +1 -1
  20. package/dist/commands/chat-command.js +1 -1
  21. package/dist/commands/claude-command.js +1 -1
  22. package/dist/commands/claude-statusline-command.js +1 -1
  23. package/dist/commands/claude-usage-command.js +1 -1
  24. package/dist/commands/command.js +1 -1
  25. package/dist/commands/connection-command.js +1 -1
  26. package/dist/commands/databases.js +1 -1
  27. package/dist/commands/delivery-command.js +1 -1
  28. package/dist/commands/describe.js +1 -1
  29. package/dist/commands/engage-campaign-pull-command.js +1 -1
  30. package/dist/commands/engage-campaign-push-command.js +1 -1
  31. package/dist/commands/engage-campaign-validate-command.js +1 -1
  32. package/dist/commands/engage-command.js +1 -1
  33. package/dist/commands/engage-template-pull-command.js +1 -1
  34. package/dist/commands/engage-template-push-command.js +1 -1
  35. package/dist/commands/engage-template-validate-command.js +1 -1
  36. package/dist/commands/job-command.js +1 -1
  37. package/dist/commands/journey-command.js +1 -1
  38. package/dist/commands/journey-validate-command.js +1 -1
  39. package/dist/commands/llm-command.js +1 -1
  40. package/dist/commands/mcp-command.js +1 -1
  41. package/dist/commands/parent-segment-command.js +1 -1
  42. package/dist/commands/policy-command.js +1 -1
  43. package/dist/commands/profile-command.js +1 -1
  44. package/dist/commands/profiles-command.js +1 -1
  45. package/dist/commands/query-command.js +1 -1
  46. package/dist/commands/schedule-command.js +1 -1
  47. package/dist/commands/segment-command.js +1 -1
  48. package/dist/commands/segment-create-command.js +1 -1
  49. package/dist/commands/segment-fields-command.js +1 -1
  50. package/dist/commands/segment-move-command.js +1 -1
  51. package/dist/commands/segment-pull-command.js +1 -1
  52. package/dist/commands/segment-push-command.js +1 -1
  53. package/dist/commands/segment-update-command.js +1 -1
  54. package/dist/commands/segment-use-command.js +1 -1
  55. package/dist/commands/segment-validate-command.js +1 -1
  56. package/dist/commands/segments.js +1 -1
  57. package/dist/commands/show.js +1 -1
  58. package/dist/commands/status-command.js +1 -1
  59. package/dist/commands/table-deleted.js +1 -1
  60. package/dist/commands/tables.js +1 -1
  61. package/dist/commands/unset-command.js +1 -1
  62. package/dist/commands/upgrade-command.js +1 -1
  63. package/dist/commands/use-command.js +1 -1
  64. package/dist/commands/user-command.js +1 -1
  65. package/dist/commands/work-command.js +1 -1
  66. package/dist/commands/workflow-command.js +1 -1
  67. package/dist/core/auth.js +1 -1
  68. package/dist/core/command-output.js +1 -1
  69. package/dist/core/config.js +1 -1
  70. package/dist/core/connection-cache.js +1 -1
  71. package/dist/core/constants.js +1 -1
  72. package/dist/core/credential-cache.js +1 -1
  73. package/dist/core/global-context.js +1 -1
  74. package/dist/core/keychain.js +1 -1
  75. package/dist/core/oauth-keychain.js +1 -1
  76. package/dist/core/oauth.js +1 -1
  77. package/dist/core/profile.js +1 -1
  78. package/dist/core/project-config.js +1 -1
  79. package/dist/core/session.js +1 -1
  80. package/dist/core/user-cache.js +1 -1
  81. package/dist/core/version.js +1 -1
  82. package/dist/index.js +1 -1
  83. package/dist/mcp/server.js +1 -1
  84. package/dist/mcp/tools/index.js +1 -1
  85. package/dist/mcp/tools/tdx-run.js +1 -1
  86. package/dist/mcp/tools/tdx-search.js +1 -1
  87. package/dist/mcp/tools/work-create-item.js +1 -1
  88. package/dist/mcp/utils.js +1 -1
  89. package/dist/proxy/claude-usage-tracker.js +1 -1
  90. package/dist/proxy/passthrough-server.js +1 -1
  91. package/dist/proxy/sse-usage-parser.js +1 -1
  92. package/dist/sdk/agent/agent-config.js +1 -1
  93. package/dist/sdk/agent/agent-ref-parser.js +1 -1
  94. package/dist/sdk/agent/agent-yaml.js +1 -1
  95. package/dist/sdk/agent/test/evaluator.js +1 -1
  96. package/dist/sdk/agent/test/executor.js +1 -1
  97. package/dist/sdk/agent/test/index.js +1 -1
  98. package/dist/sdk/agent/test/output.js +1 -1
  99. package/dist/sdk/agent/test/parser.js +1 -1
  100. package/dist/sdk/agent/tool-target-registry.js +1 -1
  101. package/dist/sdk/api.js +1 -1
  102. package/dist/sdk/cas/cas-api-client.d.ts +83 -3
  103. package/dist/sdk/cas/cas-api-client.d.ts.map +1 -1
  104. package/dist/sdk/cas/cas-api-client.js +1 -1
  105. package/dist/sdk/cas/cas-api-client.js.map +1 -1
  106. package/dist/sdk/cas/cas-audience-schema.d.ts +149 -0
  107. package/dist/sdk/cas/cas-audience-schema.d.ts.map +1 -0
  108. package/dist/sdk/cas/cas-audience-schema.js +1 -0
  109. package/dist/sdk/cas/cas-audience-schema.js.map +1 -0
  110. package/dist/sdk/cas/cas-audience-validator.d.ts +57 -0
  111. package/dist/sdk/cas/cas-audience-validator.d.ts.map +1 -0
  112. package/dist/sdk/cas/cas-audience-validator.js +1 -0
  113. package/dist/sdk/cas/cas-audience-validator.js.map +1 -0
  114. package/dist/sdk/cas/cas-audience-yaml.d.ts +32 -1
  115. package/dist/sdk/cas/cas-audience-yaml.d.ts.map +1 -1
  116. package/dist/sdk/cas/cas-audience-yaml.js +1 -1
  117. package/dist/sdk/cas/cas-audience-yaml.js.map +1 -1
  118. package/dist/sdk/cas/cas-segment-yaml.d.ts +30 -2
  119. package/dist/sdk/cas/cas-segment-yaml.d.ts.map +1 -1
  120. package/dist/sdk/cas/cas-segment-yaml.js +1 -1
  121. package/dist/sdk/cas/cas-segment-yaml.js.map +1 -1
  122. package/dist/sdk/cas/index.d.ts +21 -0
  123. package/dist/sdk/cas/index.d.ts.map +1 -1
  124. package/dist/sdk/cas/index.js +1 -1
  125. package/dist/sdk/cas/index.js.map +1 -1
  126. package/dist/sdk/cas/pull-workflow.js +1 -1
  127. package/dist/sdk/cas/push-workflow.d.ts +131 -0
  128. package/dist/sdk/cas/push-workflow.d.ts.map +1 -1
  129. package/dist/sdk/cas/push-workflow.js +1 -1
  130. package/dist/sdk/cas/push-workflow.js.map +1 -1
  131. package/dist/sdk/cas/types.d.ts +33 -4
  132. package/dist/sdk/cas/types.d.ts.map +1 -1
  133. package/dist/sdk/cas/validate-files.d.ts +64 -0
  134. package/dist/sdk/cas/validate-files.d.ts.map +1 -0
  135. package/dist/sdk/cas/validate-files.js +1 -0
  136. package/dist/sdk/cas/validate-files.js.map +1 -0
  137. package/dist/sdk/client/cdp-api-client.js +1 -1
  138. package/dist/sdk/client/delivery-api-client.js +1 -1
  139. package/dist/sdk/client/endpoints.d.ts +11 -1
  140. package/dist/sdk/client/endpoints.d.ts.map +1 -1
  141. package/dist/sdk/client/endpoints.js +1 -1
  142. package/dist/sdk/client/endpoints.js.map +1 -1
  143. package/dist/sdk/client/engage-api-client.js +1 -1
  144. package/dist/sdk/client/http-client.d.ts +1 -0
  145. package/dist/sdk/client/http-client.d.ts.map +1 -1
  146. package/dist/sdk/client/http-client.js +1 -1
  147. package/dist/sdk/client/http-client.js.map +1 -1
  148. package/dist/sdk/client/llm-api-client.js +1 -1
  149. package/dist/sdk/client/oauth-refresh.js +1 -1
  150. package/dist/sdk/client/rate-limiter.js +1 -1
  151. package/dist/sdk/client/td-api-client.js +1 -1
  152. package/dist/sdk/client/trino-api-client.js +1 -1
  153. package/dist/sdk/client/workflow-client.js +1 -1
  154. package/dist/sdk/connection-validator.js +1 -1
  155. package/dist/sdk/connection.js +1 -1
  156. package/dist/sdk/delivery.js +1 -1
  157. package/dist/sdk/engage/campaign-pull.js +1 -1
  158. package/dist/sdk/engage/campaign-push.js +1 -1
  159. package/dist/sdk/engage/campaign-validator.js +1 -1
  160. package/dist/sdk/engage/campaign-yaml.js +1 -1
  161. package/dist/sdk/engage/template-pull.js +1 -1
  162. package/dist/sdk/engage/template-push.js +1 -1
  163. package/dist/sdk/engage/template-validator.js +1 -1
  164. package/dist/sdk/engage/template-yaml.js +1 -1
  165. package/dist/sdk/engage/types/campaign-def.js +1 -1
  166. package/dist/sdk/engage/types/campaign-schema.js +1 -1
  167. package/dist/sdk/engage/types/template-schema.js +1 -1
  168. package/dist/sdk/engage.js +1 -1
  169. package/dist/sdk/errors.d.ts +20 -0
  170. package/dist/sdk/errors.d.ts.map +1 -1
  171. package/dist/sdk/errors.js +1 -1
  172. package/dist/sdk/errors.js.map +1 -1
  173. package/dist/sdk/index.js +1 -1
  174. package/dist/sdk/io/index.js +1 -1
  175. package/dist/sdk/io/node-filesystem.js +1 -1
  176. package/dist/sdk/job.js +1 -1
  177. package/dist/sdk/journey.js +1 -1
  178. package/dist/sdk/llm/chat-cache.js +1 -1
  179. package/dist/sdk/llm/index.js +1 -1
  180. package/dist/sdk/llm/llm-backup-utils.js +1 -1
  181. package/dist/sdk/llm/model-factors.js +1 -1
  182. package/dist/sdk/llm/user-settings.js +1 -1
  183. package/dist/sdk/personalization.js +1 -1
  184. package/dist/sdk/policy.js +1 -1
  185. package/dist/sdk/query/deleted-table-validation.js +1 -1
  186. package/dist/sdk/query/index.js +1 -1
  187. package/dist/sdk/query/sql-parser.js +1 -1
  188. package/dist/sdk/realtime.js +1 -1
  189. package/dist/sdk/schedule.js +1 -1
  190. package/dist/sdk/segment/child-segment-yaml.js +1 -1
  191. package/dist/sdk/segment/fields-display.js +1 -1
  192. package/dist/sdk/segment/file-discovery.js +1 -1
  193. package/dist/sdk/segment/journey-utils.js +1 -1
  194. package/dist/sdk/segment/journey-validator.js +1 -1
  195. package/dist/sdk/segment/journey-yaml.js +1 -1
  196. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  197. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  198. package/dist/sdk/segment/pull-workflow.js +1 -1
  199. package/dist/sdk/segment/push-recovery.js +1 -1
  200. package/dist/sdk/segment/push-workflow.js +1 -1
  201. package/dist/sdk/segment/resolution-context.d.ts +16 -7
  202. package/dist/sdk/segment/resolution-context.d.ts.map +1 -1
  203. package/dist/sdk/segment/resolution-context.js +1 -1
  204. package/dist/sdk/segment/resolution-context.js.map +1 -1
  205. package/dist/sdk/segment/segment-path-parser.js +1 -1
  206. package/dist/sdk/segment/segment-ref-parser.js +1 -1
  207. package/dist/sdk/segment/segment-validator.js +1 -1
  208. package/dist/sdk/segment/target-resolution.js +1 -1
  209. package/dist/sdk/segment/tdx-config.js +1 -1
  210. package/dist/sdk/segment/types/activation-schema.js +1 -1
  211. package/dist/sdk/segment/types/journey-def.js +1 -1
  212. package/dist/sdk/segment/types/journey-schema.js +1 -1
  213. package/dist/sdk/segment/types/segment-def.js +1 -1
  214. package/dist/sdk/segment/types/segment-schema.js +1 -1
  215. package/dist/sdk/segment/validate-files.js +1 -1
  216. package/dist/sdk/segment/yaml-validator.d.ts +1 -1
  217. package/dist/sdk/segment/yaml-validator.d.ts.map +1 -1
  218. package/dist/sdk/segment/yaml-validator.js +1 -1
  219. package/dist/sdk/segment/yaml-validator.js.map +1 -1
  220. package/dist/sdk/segment.js +1 -1
  221. package/dist/sdk/types/cas.d.ts +99 -26
  222. package/dist/sdk/types/cas.d.ts.map +1 -1
  223. package/dist/sdk/types/index.d.ts +1 -1
  224. package/dist/sdk/types/index.d.ts.map +1 -1
  225. package/dist/sdk/types/index.js +1 -1
  226. package/dist/sdk/types/index.js.map +1 -1
  227. package/dist/sdk/types/progress.js +1 -1
  228. package/dist/sdk/types/workspace.js +1 -1
  229. package/dist/sdk/user.js +1 -1
  230. package/dist/sdk/util/format-detector.js +1 -1
  231. package/dist/sdk/util/formatters.js +1 -1
  232. package/dist/sdk/util/index.js +1 -1
  233. package/dist/sdk/util/paginate.js +1 -1
  234. package/dist/sdk/util/tree-formatter.js +1 -1
  235. package/dist/sdk/util/tree-search.js +1 -1
  236. package/dist/sdk/workflow/archive-validation.js +1 -1
  237. package/dist/sdk/workflow/clone-workflow.js +1 -1
  238. package/dist/sdk/workflow/index.js +1 -1
  239. package/dist/sdk/workflow/pull-workflow.js +1 -1
  240. package/dist/sdk/workflow/push-workflow.js +1 -1
  241. package/dist/sdk/workflow/task-graph.js +1 -1
  242. package/dist/sdk/workflow/tdx-config.js +1 -1
  243. package/dist/sdk/workflow/workflow-utils.js +1 -1
  244. package/dist/sdk/workspace/access-tracker.js +1 -1
  245. package/dist/sdk/workspace/frontmatter.js +1 -1
  246. package/dist/sdk/workspace/git.js +1 -1
  247. package/dist/sdk/workspace/index.js +1 -1
  248. package/dist/sdk/workspace/templates.js +1 -1
  249. package/dist/sdk/workspace/weekly.js +1 -1
  250. package/dist/sdk/workspace/wikilinks.js +1 -1
  251. package/dist/test-utils/command-runner.js +1 -1
  252. package/dist/test-utils/factories.js +1 -1
  253. package/dist/test-utils/fixtures.js +1 -1
  254. package/dist/test-utils/http-mock.js +1 -1
  255. package/dist/test-utils/index.js +1 -1
  256. package/dist/utils/async.js +1 -1
  257. package/dist/utils/colors.js +1 -1
  258. package/dist/utils/diff.js +1 -1
  259. package/dist/utils/file-permissions.js +1 -1
  260. package/dist/utils/file-reader.js +1 -1
  261. package/dist/utils/github-releases.js +1 -1
  262. package/dist/utils/global-cache.js +1 -1
  263. package/dist/utils/json-loader.js +1 -1
  264. package/dist/utils/local-cache.js +1 -1
  265. package/dist/utils/logger/formatters/default-formatter.js +1 -1
  266. package/dist/utils/logger/formatters/index.js +1 -1
  267. package/dist/utils/logger/handlers/console-handler.js +1 -1
  268. package/dist/utils/logger/handlers/file-handler.js +1 -1
  269. package/dist/utils/logger/handlers/index.js +1 -1
  270. package/dist/utils/logger/handlers/null-handler.js +1 -1
  271. package/dist/utils/logger/index.js +1 -1
  272. package/dist/utils/logger/logger.js +1 -1
  273. package/dist/utils/logger/types.js +1 -1
  274. package/dist/utils/option-validation.js +1 -1
  275. package/dist/utils/process.js +1 -1
  276. package/dist/utils/prompt.js +1 -1
  277. package/dist/utils/spinner.js +1 -1
  278. package/dist/utils/sse-parser.js +1 -1
  279. package/dist/utils/string-utils.js +1 -1
  280. package/dist/utils/table-ref-parser.js +1 -1
  281. package/dist/utils/tdx-logger.js +1 -1
  282. package/dist/utils/version-check.js +1 -1
  283. package/package.json +1 -1
@@ -1 +1 @@
1
- const a32_0x18ae47=a32_0x4d67;function a32_0x184e(){const _0x568f2b=['ies','916GmrrIR','all','policy\x20list','1224705SbedpT','\x20polic','1935135iLEJNk','length','No\x20policies\x20found','📋\x20Assigned\x20Policies','dim','(ID:\x20','12PByjXk','getPolicy','\x20\x20•\x20','Show\x20a\x20specific\x20policy\x20details\x20and\x20permissions\x20(admin\x20only)','args','operation','🔑\x20Effective\x20Permissions','146722EKlcFG','List\x20all\x20policies\x20in\x20the\x20account\x20(admin\x20only)','data','listPolicies','Administrator','name','map','policy','17115770IeeucY','✔\x20Found\x20','account_owner','879fcrWDN','getPolicyPermissions','Account\x20Owner','332244LalsMU','\x20—\x20','Listing\x20policies...','Member','5312818vEltac','getCurrent','policy\x20show','👥\x20Assigned\x20Users','account_id','Fetching\x20permissions...','getPolicyUsers','bold','user','email','\x20user','16lYVCua','entries','permissions','verbose','validate','\x20\x20\x20','description','execute','log','max','site','error'];a32_0x184e=function(){return _0x568f2b;};return a32_0x184e();}(function(_0x3ea412,_0x4bf0aa){const _0x39a880=a32_0x4d67,_0x3c8cf3=_0x3ea412();while(!![]){try{const _0xd5d97d=parseInt(_0x39a880(0x152))/0x1+parseInt(_0x39a880(0x17c))/0x2*(parseInt(_0x39a880(0x15d))/0x3)+-parseInt(_0x39a880(0x14b))/0x4*(-parseInt(_0x39a880(0x17f))/0x5)+parseInt(_0x39a880(0x160))/0x6+parseInt(_0x39a880(0x164))/0x7+-parseInt(_0x39a880(0x16f))/0x8*(-parseInt(_0x39a880(0x145))/0x9)+-parseInt(_0x39a880(0x15a))/0xa;if(_0xd5d97d===_0x4bf0aa)break;else _0x3c8cf3['push'](_0x3c8cf3['shift']());}catch(_0x3ecb2e){_0x3c8cf3['push'](_0x3c8cf3['shift']());}}}(a32_0x184e,0x85ebc));import{BaseCommand}from'./command.js';import{handleSDKOutput,handleSingleObjectOutput,isStructuredFormat}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import a32_0x5c392c from'chalk';export class PolicyCommand extends BaseCommand{[a32_0x18ae47(0x157)]=a32_0x18ae47(0x159);[a32_0x18ae47(0x175)]='Show\x20current\x20user\x20policies\x20and\x20effective\x20permissions';async[a32_0x18ae47(0x176)](_0xf21848){const _0x49c3c6=a32_0x18ae47,{options:_0x3ec711,tdx:_0x136193}=_0xf21848,_0x1c3f42=await withSpinner(_0x49c3c6(0x169),async()=>{const _0x21594a=_0x49c3c6,[_0x2874df,_0x29d2da]=await Promise[_0x21594a(0x17d)]([_0x136193[_0x21594a(0x16c)][_0x21594a(0x165)](),_0x136193['policy']['getMyPermissions']()]);return{'userInfo':_0x2874df,'permissions':_0x29d2da};},{'verbose':_0x3ec711[_0x49c3c6(0x172)]}),{userInfo:_0x2c7b75,permissions:_0x49cb0e}=_0x1c3f42[_0x49c3c6(0x154)];if(isStructuredFormat(_0x3ec711))return await handleSingleObjectOutput(_0x49cb0e,_0x3ec711),0x0;const _0x170b19=_0x2c7b75[_0x49c3c6(0x15c)]?_0x49c3c6(0x15f):_0x2c7b75['administrator']?_0x49c3c6(0x156):_0x49c3c6(0x163);console[_0x49c3c6(0x177)]('\x0a'+a32_0x5c392c[_0x49c3c6(0x16b)]('👤')+'\x20'+a32_0x5c392c[_0x49c3c6(0x16b)](_0x2c7b75[_0x49c3c6(0x157)])+'\x20'+a32_0x5c392c[_0x49c3c6(0x149)]('('+_0x2c7b75[_0x49c3c6(0x16d)]+')')+_0x49c3c6(0x161)+_0x170b19),console[_0x49c3c6(0x177)](a32_0x5c392c[_0x49c3c6(0x149)](_0x49c3c6(0x174)+_0x136193['context'][_0x49c3c6(0x179)]+':'+_0x2c7b75[_0x49c3c6(0x168)]+',\x20user_id:'+_0x2c7b75['id']));const _0x389377=_0x49cb0e['policies'];console[_0x49c3c6(0x177)]('\x0a'+a32_0x5c392c[_0x49c3c6(0x16b)](_0x49c3c6(0x148))+'\x20('+_0x389377[_0x49c3c6(0x146)]+'):');if(_0x389377[_0x49c3c6(0x146)]===0x0)console['log'](a32_0x5c392c[_0x49c3c6(0x149)]('\x20\x20No\x20policies\x20assigned'));else for(const _0x498695 of _0x389377){console[_0x49c3c6(0x177)](_0x49c3c6(0x14d)+_0x498695[_0x49c3c6(0x157)]);}return printPermissionsMap(_0x49cb0e[_0x49c3c6(0x171)]),console[_0x49c3c6(0x177)](),0x0;}}export class PolicyListCommand extends BaseCommand{[a32_0x18ae47(0x157)]=a32_0x18ae47(0x17e);[a32_0x18ae47(0x175)]=a32_0x18ae47(0x153);async['execute'](_0x1644c6){const _0x3533cc=a32_0x18ae47,{options:_0x6bd8da,tdx:_0x118386}=_0x1644c6,_0x226ad3=await withSpinner(_0x3533cc(0x162),()=>_0x118386[_0x3533cc(0x159)][_0x3533cc(0x155)](),{'verbose':_0x6bd8da[_0x3533cc(0x172)]}),_0x8b89c7=_0x226ad3[_0x3533cc(0x154)];console[_0x3533cc(0x17a)](_0x3533cc(0x15b)+_0x8b89c7[_0x3533cc(0x146)]+_0x3533cc(0x180)+(_0x8b89c7[_0x3533cc(0x146)]!==0x1?_0x3533cc(0x17b):'y'));if(isStructuredFormat(_0x6bd8da))return await handleSDKOutput(_0x8b89c7,_0x6bd8da),0x0;if(_0x8b89c7['length']===0x0)console[_0x3533cc(0x177)](a32_0x5c392c[_0x3533cc(0x149)](_0x3533cc(0x147)));else for(const _0x316e54 of _0x8b89c7){const _0xea9f6a=_0x316e54['description']?a32_0x5c392c['dim'](_0x3533cc(0x161)+_0x316e54[_0x3533cc(0x175)]):'';console['log'](_0x3533cc(0x14d)+_0x316e54[_0x3533cc(0x157)]+_0xea9f6a);}return 0x0;}}export class PolicyShowCommand extends BaseCommand{[a32_0x18ae47(0x157)]=a32_0x18ae47(0x166);[a32_0x18ae47(0x175)]=a32_0x18ae47(0x14e);[a32_0x18ae47(0x173)](_0x591c00){const _0x2bcf76=a32_0x18ae47;if(_0x591c00[_0x2bcf76(0x14f)][_0x2bcf76(0x146)]===0x0)return'Usage:\x20tdx\x20policy\x20show\x20<policy-name-or-id>';return undefined;}async[a32_0x18ae47(0x176)](_0x34c181){const _0x357642=a32_0x18ae47,{options:_0x5895fc,tdx:_0x558560}=_0x34c181,_0x3b49ed=_0x34c181[_0x357642(0x14f)][0x0],_0x5acb9e=await withSpinner('Fetching\x20policy...',async()=>{const _0x5bbc20=_0x357642,_0x5c6ac5=await _0x558560[_0x5bbc20(0x159)][_0x5bbc20(0x14c)](_0x3b49ed),[_0x42e10f,_0x4ec9e0]=await Promise[_0x5bbc20(0x17d)]([_0x558560[_0x5bbc20(0x159)][_0x5bbc20(0x15e)](_0x5c6ac5['id']),_0x558560[_0x5bbc20(0x159)][_0x5bbc20(0x16a)](_0x5c6ac5['id'])]);return{'policy':_0x5c6ac5,'perms':_0x42e10f,'users':_0x4ec9e0};},{'verbose':_0x5895fc['verbose']}),{policy:_0x5d9f86,perms:_0x58c64d,users:_0x26c6c5}=_0x5acb9e[_0x357642(0x154)];if(isStructuredFormat(_0x5895fc))return await handleSingleObjectOutput({..._0x5d9f86,'permissions':_0x58c64d[_0x357642(0x171)],'users':_0x26c6c5},_0x5895fc),0x0;console[_0x357642(0x177)]('\x0a'+a32_0x5c392c[_0x357642(0x16b)]('📋')+'\x20'+a32_0x5c392c[_0x357642(0x16b)](_0x5d9f86[_0x357642(0x157)])+'\x20'+a32_0x5c392c[_0x357642(0x149)](_0x357642(0x14a)+_0x5d9f86['id']+')'));_0x5d9f86[_0x357642(0x175)]&&console[_0x357642(0x177)](_0x357642(0x174)+a32_0x5c392c['dim'](_0x5d9f86[_0x357642(0x175)]));console[_0x357642(0x177)](_0x357642(0x174)+_0x26c6c5['length']+_0x357642(0x16e)+(_0x26c6c5[_0x357642(0x146)]!==0x1?'s':'')+'\x20assigned'),printPermissionsMap(_0x58c64d[_0x357642(0x171)]);if(_0x26c6c5['length']>0x0){console[_0x357642(0x177)]('\x0a'+a32_0x5c392c[_0x357642(0x16b)](_0x357642(0x167))+':');for(const _0x2ce703 of _0x26c6c5){const _0x59c44e=_0x2ce703['email']&&_0x2ce703[_0x357642(0x16d)]!==_0x2ce703[_0x357642(0x157)]?a32_0x5c392c[_0x357642(0x149)]('\x20<'+_0x2ce703[_0x357642(0x16d)]+'>'):'';console[_0x357642(0x177)]('\x20\x20•\x20'+_0x2ce703[_0x357642(0x157)]+_0x59c44e);}}return console['log'](),0x0;}}function a32_0x4d67(_0x57bf5f,_0x3cd732){_0x57bf5f=_0x57bf5f-0x145;const _0x184e4e=a32_0x184e();let _0x4d67d5=_0x184e4e[_0x57bf5f];return _0x4d67d5;}function printPermissionsMap(_0x17559f){const _0x57c2d8=a32_0x18ae47,_0x42fc44=Object[_0x57c2d8(0x170)](_0x17559f);console['log']('\x0a'+a32_0x5c392c[_0x57c2d8(0x16b)](_0x57c2d8(0x151))+':');if(_0x42fc44[_0x57c2d8(0x146)]===0x0){console[_0x57c2d8(0x177)](a32_0x5c392c[_0x57c2d8(0x149)]('\x20\x20No\x20permissions'));return;}const _0x5cc39b=Math[_0x57c2d8(0x178)](..._0x42fc44[_0x57c2d8(0x158)](([_0x573022])=>_0x573022['length']));for(const [_0x293c15,_0x1040e4]of _0x42fc44){const _0x4ce0ac=formatOperations(_0x1040e4);console['log']('\x20\x20'+_0x293c15['padEnd'](_0x5cc39b+0x2)+_0x4ce0ac);}}function formatOperations(_0xf24977){const _0x2d6ce5=a32_0x18ae47,_0x319ae3=[...new Set(_0xf24977[_0x2d6ce5(0x158)](_0x505c6a=>_0x505c6a[_0x2d6ce5(0x150)]))];return _0x319ae3['join'](',\x20');}
1
+ const a32_0x1bd560=a32_0x469e;function a32_0x469e(_0x5034e1,_0x4f5fe3){_0x5034e1=_0x5034e1-0x166;const _0x37e4a0=a32_0x37e4();let _0x469e3a=_0x37e4a0[_0x5034e1];return _0x469e3a;}function a32_0x37e4(){const _0x436d29=['validate','\x20\x20\x20','Listing\x20policies...','args','\x20user','account_id','Usage:\x20tdx\x20policy\x20show\x20<policy-name-or-id>','9UgdwUn','24zXKmSc','name','getMyPermissions','policy\x20list','No\x20policies\x20found','🔑\x20Effective\x20Permissions','21SWpqdJ','policy','Fetching\x20permissions...','join','19138284BAGteA','Show\x20current\x20user\x20policies\x20and\x20effective\x20permissions','max','(ID:\x20','all','Member','List\x20all\x20policies\x20in\x20the\x20account\x20(admin\x20only)','379500VUyzae','3028kpEZia','533865CTliCZ','error','listPolicies','verbose','Administrator','ies','\x20\x20•\x20','email','operation','length','log','entries','getPolicyUsers','468184QVgMva','Show\x20a\x20specific\x20policy\x20details\x20and\x20permissions\x20(admin\x20only)','dim','execute','2349KgwCLN','bold','data','permissions','\x20—\x20','administrator','\x20assigned','246208xlbxDE','policies','description','getPolicyPermissions','getPolicy',',\x20user_id:','map','✔\x20Found\x20','policy\x20show','168460IgRdhu'];a32_0x37e4=function(){return _0x436d29;};return a32_0x37e4();}(function(_0x5846ee,_0x226d3f){const _0x3a0305=a32_0x469e,_0x475a4a=_0x5846ee();while(!![]){try{const _0x1953b9=parseInt(_0x3a0305(0x16a))/0x1+-parseInt(_0x3a0305(0x18d))/0x2+parseInt(_0x3a0305(0x1a0))/0x3*(-parseInt(_0x3a0305(0x18e))/0x4)+parseInt(_0x3a0305(0x18f))/0x5*(-parseInt(_0x3a0305(0x17c))/0x6)+-parseInt(_0x3a0305(0x182))/0x7*(parseInt(_0x3a0305(0x19c))/0x8)+-parseInt(_0x3a0305(0x17b))/0x9*(-parseInt(_0x3a0305(0x173))/0xa)+parseInt(_0x3a0305(0x186))/0xb;if(_0x1953b9===_0x226d3f)break;else _0x475a4a['push'](_0x475a4a['shift']());}catch(_0x34f04f){_0x475a4a['push'](_0x475a4a['shift']());}}}(a32_0x37e4,0x96d1c));import{BaseCommand}from'./command.js';import{handleSDKOutput,handleSingleObjectOutput,isStructuredFormat}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import a32_0x183ae6 from'chalk';export class PolicyCommand extends BaseCommand{[a32_0x1bd560(0x17d)]=a32_0x1bd560(0x183);['description']=a32_0x1bd560(0x187);async[a32_0x1bd560(0x19f)](_0x313dcb){const _0x287cc7=a32_0x1bd560,{options:_0x539cdc,tdx:_0x230c31}=_0x313dcb,_0x3572b4=await withSpinner(_0x287cc7(0x184),async()=>{const _0xf16912=_0x287cc7,[_0x377a20,_0x433b6e]=await Promise[_0xf16912(0x18a)]([_0x230c31['user']['getCurrent'](),_0x230c31[_0xf16912(0x183)][_0xf16912(0x17e)]()]);return{'userInfo':_0x377a20,'permissions':_0x433b6e};},{'verbose':_0x539cdc[_0x287cc7(0x192)]}),{userInfo:_0x4a0039,permissions:_0x1058c6}=_0x3572b4['data'];if(isStructuredFormat(_0x539cdc))return await handleSingleObjectOutput(_0x1058c6,_0x539cdc),0x0;const _0x1bacf8=_0x4a0039['account_owner']?'Account\x20Owner':_0x4a0039[_0x287cc7(0x168)]?_0x287cc7(0x193):_0x287cc7(0x18b);console[_0x287cc7(0x199)]('\x0a'+a32_0x183ae6[_0x287cc7(0x1a1)]('👤')+'\x20'+a32_0x183ae6[_0x287cc7(0x1a1)](_0x4a0039['name'])+'\x20'+a32_0x183ae6[_0x287cc7(0x19e)]('('+_0x4a0039['email']+')')+'\x20—\x20'+_0x1bacf8),console[_0x287cc7(0x199)](a32_0x183ae6[_0x287cc7(0x19e)](_0x287cc7(0x175)+_0x230c31['context']['site']+':'+_0x4a0039[_0x287cc7(0x179)]+_0x287cc7(0x16f)+_0x4a0039['id']));const _0x5075af=_0x1058c6[_0x287cc7(0x16b)];console[_0x287cc7(0x199)]('\x0a'+a32_0x183ae6[_0x287cc7(0x1a1)]('📋\x20Assigned\x20Policies')+'\x20('+_0x5075af[_0x287cc7(0x198)]+'):');if(_0x5075af[_0x287cc7(0x198)]===0x0)console[_0x287cc7(0x199)](a32_0x183ae6[_0x287cc7(0x19e)]('\x20\x20No\x20policies\x20assigned'));else for(const _0x4ef906 of _0x5075af){console['log']('\x20\x20•\x20'+_0x4ef906['name']);}return printPermissionsMap(_0x1058c6['permissions']),console[_0x287cc7(0x199)](),0x0;}}export class PolicyListCommand extends BaseCommand{[a32_0x1bd560(0x17d)]=a32_0x1bd560(0x17f);[a32_0x1bd560(0x16c)]=a32_0x1bd560(0x18c);async['execute'](_0x1f667c){const _0x11421d=a32_0x1bd560,{options:_0x3f055e,tdx:_0x1580dc}=_0x1f667c,_0x5cac08=await withSpinner(_0x11421d(0x176),()=>_0x1580dc[_0x11421d(0x183)][_0x11421d(0x191)](),{'verbose':_0x3f055e[_0x11421d(0x192)]}),_0x363aeb=_0x5cac08[_0x11421d(0x1a2)];console[_0x11421d(0x190)](_0x11421d(0x171)+_0x363aeb[_0x11421d(0x198)]+'\x20polic'+(_0x363aeb[_0x11421d(0x198)]!==0x1?_0x11421d(0x194):'y'));if(isStructuredFormat(_0x3f055e))return await handleSDKOutput(_0x363aeb,_0x3f055e),0x0;if(_0x363aeb[_0x11421d(0x198)]===0x0)console[_0x11421d(0x199)](a32_0x183ae6[_0x11421d(0x19e)](_0x11421d(0x180)));else for(const _0x56b098 of _0x363aeb){const _0x4545f0=_0x56b098[_0x11421d(0x16c)]?a32_0x183ae6['dim'](_0x11421d(0x167)+_0x56b098['description']):'';console[_0x11421d(0x199)](_0x11421d(0x195)+_0x56b098[_0x11421d(0x17d)]+_0x4545f0);}return 0x0;}}export class PolicyShowCommand extends BaseCommand{[a32_0x1bd560(0x17d)]=a32_0x1bd560(0x172);[a32_0x1bd560(0x16c)]=a32_0x1bd560(0x19d);[a32_0x1bd560(0x174)](_0x4e9456){const _0x10b3a6=a32_0x1bd560;if(_0x4e9456[_0x10b3a6(0x177)]['length']===0x0)return _0x10b3a6(0x17a);return undefined;}async['execute'](_0x571167){const _0x108705=a32_0x1bd560,{options:_0x54aaa4,tdx:_0x54e512}=_0x571167,_0x169313=_0x571167['args'][0x0],_0x4ef2cb=await withSpinner('Fetching\x20policy...',async()=>{const _0x593ff4=a32_0x469e,_0x57e115=await _0x54e512[_0x593ff4(0x183)][_0x593ff4(0x16e)](_0x169313),[_0x23e7d1,_0x5d79a7]=await Promise[_0x593ff4(0x18a)]([_0x54e512['policy'][_0x593ff4(0x16d)](_0x57e115['id']),_0x54e512['policy'][_0x593ff4(0x19b)](_0x57e115['id'])]);return{'policy':_0x57e115,'perms':_0x23e7d1,'users':_0x5d79a7};},{'verbose':_0x54aaa4['verbose']}),{policy:_0x5f0007,perms:_0x3798d6,users:_0x15ad5a}=_0x4ef2cb[_0x108705(0x1a2)];if(isStructuredFormat(_0x54aaa4))return await handleSingleObjectOutput({..._0x5f0007,'permissions':_0x3798d6[_0x108705(0x166)],'users':_0x15ad5a},_0x54aaa4),0x0;console['log']('\x0a'+a32_0x183ae6[_0x108705(0x1a1)]('📋')+'\x20'+a32_0x183ae6['bold'](_0x5f0007[_0x108705(0x17d)])+'\x20'+a32_0x183ae6[_0x108705(0x19e)](_0x108705(0x189)+_0x5f0007['id']+')'));_0x5f0007[_0x108705(0x16c)]&&console[_0x108705(0x199)](_0x108705(0x175)+a32_0x183ae6[_0x108705(0x19e)](_0x5f0007[_0x108705(0x16c)]));console[_0x108705(0x199)]('\x20\x20\x20'+_0x15ad5a['length']+_0x108705(0x178)+(_0x15ad5a[_0x108705(0x198)]!==0x1?'s':'')+_0x108705(0x169)),printPermissionsMap(_0x3798d6[_0x108705(0x166)]);if(_0x15ad5a[_0x108705(0x198)]>0x0){console[_0x108705(0x199)]('\x0a'+a32_0x183ae6[_0x108705(0x1a1)]('👥\x20Assigned\x20Users')+':');for(const _0x13dd90 of _0x15ad5a){const _0x371db5=_0x13dd90[_0x108705(0x196)]&&_0x13dd90[_0x108705(0x196)]!==_0x13dd90[_0x108705(0x17d)]?a32_0x183ae6[_0x108705(0x19e)]('\x20<'+_0x13dd90[_0x108705(0x196)]+'>'):'';console['log'](_0x108705(0x195)+_0x13dd90['name']+_0x371db5);}}return console[_0x108705(0x199)](),0x0;}}function printPermissionsMap(_0xd124dd){const _0x634d25=a32_0x1bd560,_0x119b88=Object[_0x634d25(0x19a)](_0xd124dd);console[_0x634d25(0x199)]('\x0a'+a32_0x183ae6[_0x634d25(0x1a1)](_0x634d25(0x181))+':');if(_0x119b88[_0x634d25(0x198)]===0x0){console[_0x634d25(0x199)](a32_0x183ae6[_0x634d25(0x19e)]('\x20\x20No\x20permissions'));return;}const _0x335728=Math[_0x634d25(0x188)](..._0x119b88[_0x634d25(0x170)](([_0x53a16a])=>_0x53a16a[_0x634d25(0x198)]));for(const [_0x517b6b,_0x26b440]of _0x119b88){const _0x9c9325=formatOperations(_0x26b440);console[_0x634d25(0x199)]('\x20\x20'+_0x517b6b['padEnd'](_0x335728+0x2)+_0x9c9325);}}function formatOperations(_0x4f863a){const _0x5175ad=a32_0x1bd560,_0x3cd37d=[...new Set(_0x4f863a[_0x5175ad(0x170)](_0x45a29f=>_0x45a29f[_0x5175ad(0x197)]))];return _0x3cd37d[_0x5175ad(0x185)](',\x20');}
@@ -1 +1 @@
1
- const a33_0x51d70e=a33_0x4c89;(function(_0x4cfcc4,_0xa35030){const _0x47e1ac=a33_0x4c89,_0x2836b4=_0x4cfcc4();while(!![]){try{const _0x2fa5f7=parseInt(_0x47e1ac(0x1d4))/0x1+parseInt(_0x47e1ac(0x1b9))/0x2*(parseInt(_0x47e1ac(0x190))/0x3)+parseInt(_0x47e1ac(0x170))/0x4*(parseInt(_0x47e1ac(0x18c))/0x5)+parseInt(_0x47e1ac(0x19f))/0x6*(parseInt(_0x47e1ac(0x180))/0x7)+-parseInt(_0x47e1ac(0x16d))/0x8*(parseInt(_0x47e1ac(0x1b0))/0x9)+parseInt(_0x47e1ac(0x1a5))/0xa*(parseInt(_0x47e1ac(0x17e))/0xb)+-parseInt(_0x47e1ac(0x168))/0xc;if(_0x2fa5f7===_0xa35030)break;else _0x2836b4['push'](_0x2836b4['shift']());}catch(_0x4cb772){_0x2836b4['push'](_0x2836b4['shift']());}}}(a33_0x24c1,0x6015d));import{BaseCommand,printAuthError}from'./command.js';import{listProfiles,profileExists,saveProfileToUserConfig,removeProfileFromUserConfig,loadProfile,getActiveProfile,saveActiveProfileToUserConfig}from'../core/profile.js';function a33_0x24c1(){const _0xa36568=['Key=value\x20pair\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','194050iFRHHP','trim','Set\x20a\x20profile\x20configuration\x20value','\x27\x20does\x20not\x20exist.','2206644WMepGK','Removed\x20existing\x20profile\x20\x27','Site\x20was\x20not\x20changed.','\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.','profile:delete','Are\x20you\x20sure\x20you\x20want\x20to\x20remove\x20profile\x20\x27','length','/app/mp/ak','Invalid\x20format.\x20Use:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','profile','session','\x27\x20deleted','Profile\x20name\x20must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore','Enter\x20description\x20(optional):','You\x20can\x20find\x20your\x20API\x20key\x20at:','78fQIxjF','site','\x27\x20to\x20remove\x20it\x20first,\x20or\x20re-create\x20with\x20--force.','apiKey','status','profileName','635920HCmbIX','\x27\x20requires\x20API\x20key\x20validation.','\x0aOperation\x20cancelled','parent_segment','confirm','error','description','all','(session:\x20','us01','execute','96066HLLqAn','config','Profile\x20name\x20cannot\x20be\x20empty','yellow','name','skipExistsCheck','validate','API\x20key\x20cannot\x20be\x20empty','\x20API\x20key\x20saved\x20to\x20system\x20keychain','2ydKknG','\x27\x20created','Default\x20profile\x20set\x20to:\x20','\x0aYou\x20can\x20find\x20your\x20API\x20key\x20at:','oauth','\x20--default\x27\x20to\x20save\x20permanently','Set\x20session\x20profile','password','red','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20use\x20<name>\x20[--default]','Changing\x20site\x20to\x20\x27','jobs','Enter\x20profile\x20name:','✗\x20Validation\x20failed:\x20','\x20\x20tdx\x20--profile\x20','Enter\x20your\x20TD\x20API\x20key:','tdx:\x20profile\x20create','logLevel','Profile\x20\x27','llm_project','\x20\x20-\x20','VALID_KEYS','\x20API\x20key\x20saved\x20to\x20system\x20keychain\x20(profile:\x20','email','bold','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','log','346380zXaKhF','\x27\x20does\x20not\x20exist.\x20Create\x20it?','18013392cYxiOj','join','test','\x0aSetup\x20cancelled','Enter\x20your\x20TD\x20API\x20key\x20for\x20the\x20new\x20site:','48LVcdsC','text','Delete\x20a\x20profile','40aRHicv','profile:create','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...','dim','llm_agent','Unknown\x20key\x20\x27','profile:set','includes','\x20API\x20key\x20is\x20valid\x20(User:\x20','ERROR','message','green','split','33PMyTOZ','tdx:\x20profile\x20delete','160419ZBMumi','tdx:\x20profile\x20set','warn','\x20Profile\x20\x27','Failed\x20to\x20delete\x20profile:\x20','\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases','create','\x27.\x0a\x0aValid\x20keys:\x20','getUserInfo','\x20\x20(no\x20profiles\x20found)','You\x20can\x20now\x20use\x20tdx\x20commands\x20with\x20this\x20profile.\x20Try:'];a33_0x24c1=function(){return _0xa36568;};return a33_0x24c1();}import{getConfigDir}from'../core/config.js';import*as a33_0x15d597 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';function a33_0x4c89(_0x4b0704,_0x3bc691){_0x4b0704=_0x4b0704-0x168;const _0x24c14a=a33_0x24c1();let _0x4c8929=_0x24c14a[_0x4b0704];return _0x4c8929;}import{LogLevel}from'../utils/tdx-logger.js';import a33_0x1f267c from'prompts';import a33_0x443779 from'chalk';function validateProfileName(_0x393d2a,_0x10a1f9){const _0x4f882e=a33_0x4c89;if(!_0x393d2a||!_0x393d2a[_0x4f882e(0x18d)]())return _0x4f882e(0x1b2);const _0x2e0620=_0x393d2a[_0x4f882e(0x18d)]();if(!/^[a-zA-Z0-9_-]+$/[_0x4f882e(0x16a)](_0x2e0620))return _0x4f882e(0x19c);if(!_0x10a1f9?.[_0x4f882e(0x1b5)]&&profileExists(_0x2e0620))return _0x4f882e(0x1cb)+_0x2e0620+'\x27\x20already\x20exists.\x20Use\x20\x27tdx\x20profile\x20delete\x20'+_0x2e0620+_0x4f882e(0x1a1);return!![];}async function deleteProfileAndCredentials(_0x428950){const _0x2db39b=a33_0x4c89;removeProfileFromUserConfig(_0x428950);const _0x1a879f=await isKeychainAvailable();_0x1a879f&&await Promise[_0x2db39b(0x1ac)]([deleteKeychainAPIKey(_0x428950),deleteOAuthTokens(_0x428950)]);}export class ProfileCreateCommand extends BaseCommand{[a33_0x51d70e(0x1b4)]=a33_0x51d70e(0x171);[a33_0x51d70e(0x1ab)]='Create\x20a\x20new\x20profile';async[a33_0x51d70e(0x1af)](_0x547ef2){const _0x3495ae=a33_0x51d70e,{options:_0x1134a8,args:_0x1e36b2}=_0x547ef2,_0x409467=!!_0x1134a8['force'];console['log'](a33_0x443779[_0x3495ae(0x1d1)](_0x3495ae(0x1c9)));let _0x45ab7c;if(_0x1e36b2[_0x3495ae(0x196)]>0x0&&_0x1e36b2[0x0]){const _0x22ac01=_0x1e36b2[0x0][_0x3495ae(0x18d)]();_0x409467&&profileExists(_0x22ac01)&&(await deleteProfileAndCredentials(_0x22ac01),console[_0x3495ae(0x1d3)]('Removed\x20existing\x20profile\x20\x27'+_0x22ac01+'\x27'));const _0x9e3a07=validateProfileName(_0x22ac01);if(_0x9e3a07!==!![])return console[_0x3495ae(0x1aa)](a33_0x443779['red'](_0x9e3a07)),0x1;_0x45ab7c=_0x22ac01;}else{const _0x21c7ee=await a33_0x1f267c({'type':_0x3495ae(0x16e),'name':_0x3495ae(0x1a4),'message':_0x3495ae(0x1c5),'validate':_0x5092fb=>validateProfileName(_0x5092fb,{'skipExistsCheck':_0x409467})});if(!_0x21c7ee['profileName'])return console[_0x3495ae(0x1d3)](_0x3495ae(0x16b)),0x1;_0x45ab7c=_0x21c7ee[_0x3495ae(0x1a4)]['trim'](),_0x409467&&profileExists(_0x45ab7c)&&(await deleteProfileAndCredentials(_0x45ab7c),console[_0x3495ae(0x1d3)](_0x3495ae(0x191)+_0x45ab7c+'\x27'));}const _0x2f3d1c=await a33_0x1f267c({'type':_0x3495ae(0x16e),'name':_0x3495ae(0x1ab),'message':_0x3495ae(0x19d)}),_0x296559=_0x2f3d1c[_0x3495ae(0x1ab)]?.[_0x3495ae(0x18d)]()||undefined,_0x31e8e7=_0x1134a8[_0x3495ae(0x1a0)]||_0x3495ae(0x1ae),_0x45e624=await promptSiteSelection(_0x31e8e7,_0x45ab7c,'Setup\x20cancelled');if(!_0x45e624)return 0x1;const _0xf4419f=resolveSite(_0x45e624),_0x446cb1=await promptAuthMethod();if(!_0x446cb1)return console[_0x3495ae(0x1d3)](_0x3495ae(0x16b)),0x1;if(_0x446cb1===_0x3495ae(0x1bd)){if(_0x296559){const _0x5ab23f={'site':_0xf4419f,'description':_0x296559};saveProfileToUserConfig(_0x45ab7c,_0x5ab23f);}const {accountName:_0x2157e1}=_0x1134a8;return await runOAuthLoginFlow(_0xf4419f,_0x45ab7c,_0x1134a8[_0x3495ae(0x1ca)]??LogLevel['ERROR'],{'accountName':_0x2157e1}),0x0;}console['log']('\x0aSetting\x20up\x20authentication\x20for\x20site:\x20'+_0xf4419f),console['log'](_0x3495ae(0x19e)),console['log']('\x20\x20'+getConsoleUrl(_0xf4419f,_0x3495ae(0x197)));const _0x30888b=await a33_0x1f267c({'type':_0x3495ae(0x1c0),'name':_0x3495ae(0x1a2),'message':_0x3495ae(0x1c8),'validate':_0x3f76c1=>{const _0x4f48bc=_0x3495ae;if(!_0x3f76c1||!_0x3f76c1['trim']())return _0x4f48bc(0x1b7);return!![];}});if(!_0x30888b['apiKey'])return console['log'](_0x3495ae(0x16b)),0x1;const _0x598876=_0x30888b[_0x3495ae(0x1a2)];console[_0x3495ae(0x1d3)]('Validating\x20API\x20key...');try{const _0x3ad801=TDX[_0x3495ae(0x186)]({'site':_0xf4419f,'apiKey':_0x598876[_0x3495ae(0x18d)](),'logLevel':_0x1134a8[_0x3495ae(0x1ca)]??LogLevel[_0x3495ae(0x17a)]}),_0x2f2ee0=await _0x3ad801[_0x3495ae(0x1c4)]['getUserInfo']();console[_0x3495ae(0x1d3)](a33_0x443779[_0x3495ae(0x17c)]('✓')+_0x3495ae(0x179)+_0x2f2ee0[_0x3495ae(0x1d0)]+')');const _0x51bde9=await isKeychainAvailable();_0x51bde9?(await saveAPIKeyAsync(_0x598876[_0x3495ae(0x18d)](),_0xf4419f,_0x45ab7c),console[_0x3495ae(0x1d3)](a33_0x443779[_0x3495ae(0x17c)]('✓')+_0x3495ae(0x1cf)+_0x45ab7c+')')):(console[_0x3495ae(0x182)](a33_0x443779[_0x3495ae(0x1b3)](_0x3495ae(0x1d2))),console[_0x3495ae(0x182)](a33_0x443779[_0x3495ae(0x1b3)](_0x3495ae(0x193))));const _0x3cfc75={'site':_0xf4419f,..._0x296559&&{'description':_0x296559}};return saveProfileToUserConfig(_0x45ab7c,_0x3cfc75),console[_0x3495ae(0x1d3)](a33_0x443779['green']('✓')+_0x3495ae(0x183)+_0x45ab7c+_0x3495ae(0x1ba)),console[_0x3495ae(0x1d3)](),console[_0x3495ae(0x1d3)](_0x3495ae(0x18a)),console[_0x3495ae(0x1d3)](_0x3495ae(0x1c7)+_0x45ab7c+'\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication'),console[_0x3495ae(0x1d3)](_0x3495ae(0x1c7)+_0x45ab7c+_0x3495ae(0x185)),0x0;}catch(_0x4c4d62){if(_0x4c4d62 instanceof HTTPClientError&&_0x4c4d62[_0x3495ae(0x1a3)]===0x191)return printAuthError(_0x4c4d62),0x1;return console[_0x3495ae(0x1aa)](a33_0x443779[_0x3495ae(0x1c1)](_0x3495ae(0x1c6)+(_0x4c4d62 instanceof Error?_0x4c4d62['message']:String(_0x4c4d62)))),console[_0x3495ae(0x1aa)]('Profile\x20was\x20not\x20created.\x20Please\x20try\x20again.'),0x1;}}}export class ProfileDeleteCommand extends BaseCommand{[a33_0x51d70e(0x1b4)]=a33_0x51d70e(0x194);[a33_0x51d70e(0x1ab)]=a33_0x51d70e(0x16f);[a33_0x51d70e(0x1b6)](_0x1a7b0f){const {args:_0x5aa1e8}=_0x1a7b0f;if(_0x5aa1e8['length']===0x0)return'Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20delete\x20<name>';return undefined;}async[a33_0x51d70e(0x1af)](_0x3926b3){const _0x5ad3a0=a33_0x51d70e,{args:_0x229ffb}=_0x3926b3,_0x1320f1=_0x229ffb[0x0];console[_0x5ad3a0(0x1d3)](a33_0x443779[_0x5ad3a0(0x1d1)](_0x5ad3a0(0x17f)));if(!profileExists(_0x1320f1)){console['error'](a33_0x443779[_0x5ad3a0(0x1c1)]('Profile\x20\x27'+_0x1320f1+_0x5ad3a0(0x18f))),console[_0x5ad3a0(0x1d3)]('\x0aAvailable\x20profiles:');const _0x50c465=listProfiles();if(_0x50c465[_0x5ad3a0(0x196)]===0x0)console[_0x5ad3a0(0x1d3)](_0x5ad3a0(0x189));else for(const _0x2e40e4 of _0x50c465){console[_0x5ad3a0(0x1d3)]('\x20\x20-\x20'+_0x2e40e4[_0x5ad3a0(0x1b4)]);}return 0x1;}const _0x105bed=await a33_0x1f267c({'type':'confirm','name':_0x5ad3a0(0x1a9),'message':_0x5ad3a0(0x195)+_0x1320f1+'\x27?','initial':![]});if(!_0x105bed['confirm'])return console[_0x5ad3a0(0x1d3)]('Removal\x20cancelled'),0x0;try{await deleteProfileAndCredentials(_0x1320f1),console[_0x5ad3a0(0x1d3)](a33_0x443779[_0x5ad3a0(0x17c)]('✓')+_0x5ad3a0(0x183)+_0x1320f1+_0x5ad3a0(0x19b));}catch(_0x502622){return console['error'](a33_0x443779[_0x5ad3a0(0x1c1)](_0x5ad3a0(0x184)+(_0x502622 instanceof Error?_0x502622[_0x5ad3a0(0x17b)]:String(_0x502622)))),0x1;}return 0x0;}}export class ProfileSetCommand extends BaseCommand{[a33_0x51d70e(0x1b4)]=a33_0x51d70e(0x177);[a33_0x51d70e(0x1ab)]=a33_0x51d70e(0x18e);static [a33_0x51d70e(0x1ce)]=['site','database',a33_0x51d70e(0x1a8),a33_0x51d70e(0x1cc),a33_0x51d70e(0x175),a33_0x51d70e(0x1ab)];[a33_0x51d70e(0x1b6)](_0x3cc22a){const _0x126519=a33_0x51d70e,{args:_0xeb7838,options:_0x10c0ef}=_0x3cc22a,_0x145936=_0x10c0ef[_0x126519(0x199)]||getActiveProfile();if(!_0x145936)return _0x126519(0x172);if(_0xeb7838[_0x126519(0x196)]===0x0)return _0x126519(0x18b)+ProfileSetCommand['VALID_KEYS'][_0x126519(0x169)](',\x20');const _0x4fdf5f=_0xeb7838[0x0];if(!_0x4fdf5f[_0x126519(0x178)]('='))return _0x126519(0x198)+ProfileSetCommand[_0x126519(0x1ce)]['join'](',\x20');const [_0x328460]=_0x4fdf5f['split']('=',0x2);if(!ProfileSetCommand['VALID_KEYS'][_0x126519(0x178)](_0x328460))return _0x126519(0x176)+_0x328460+_0x126519(0x187)+ProfileSetCommand[_0x126519(0x1ce)][_0x126519(0x169)](',\x20');return undefined;}async[a33_0x51d70e(0x1af)](_0x1d051e){const _0x20c3ff=a33_0x51d70e,{args:_0x181032,options:_0x46c35a}=_0x1d051e,_0xe5cf30=_0x46c35a['profile']||getActiveProfile(),[_0x46d54c,..._0x2052c4]=_0x181032[0x0][_0x20c3ff(0x17d)]('='),_0x30d4f4=_0x2052c4[_0x20c3ff(0x169)]('=');console['log'](a33_0x443779[_0x20c3ff(0x1d1)](_0x20c3ff(0x181)));if(!profileExists(_0xe5cf30)){const _0x13d2fc=await a33_0x1f267c({'type':_0x20c3ff(0x1a9),'name':'create','message':'Profile\x20\x27'+_0xe5cf30+_0x20c3ff(0x1d5),'initial':!![]});if(!_0x13d2fc[_0x20c3ff(0x186)])return console[_0x20c3ff(0x1d3)]('Operation\x20cancelled'),0x1;}const _0xf50bea=loadProfile(_0xe5cf30),_0x21d801=_0xf50bea?.[_0x20c3ff(0x1b1)]||{};if(_0x46d54c==='site'){const _0x1a6a6b=resolveSite(_0x30d4f4);console[_0x20c3ff(0x1d3)](_0x20c3ff(0x1c3)+_0x1a6a6b+_0x20c3ff(0x1a6)),console[_0x20c3ff(0x1d3)](_0x20c3ff(0x1bc)),console[_0x20c3ff(0x1d3)]('\x20\x20'+getConsoleUrl(_0x1a6a6b,_0x20c3ff(0x197)));const _0x55e8ec=await a33_0x1f267c({'type':_0x20c3ff(0x1c0),'name':_0x20c3ff(0x1a2),'message':_0x20c3ff(0x16c),'validate':_0x2a1f4e=>{const _0x23001b=_0x20c3ff;if(!_0x2a1f4e||!_0x2a1f4e[_0x23001b(0x18d)]())return'API\x20key\x20cannot\x20be\x20empty';return!![];}});if(!_0x55e8ec['apiKey'])return console[_0x20c3ff(0x1d3)](_0x20c3ff(0x1a7)),0x1;console[_0x20c3ff(0x1d3)](_0x20c3ff(0x173));try{const _0x301e39=TDX[_0x20c3ff(0x186)]({'site':_0x1a6a6b,'apiKey':_0x55e8ec[_0x20c3ff(0x1a2)]['trim'](),'logLevel':_0x46c35a[_0x20c3ff(0x1ca)]??LogLevel['ERROR']}),_0xd3f77f=await _0x301e39['jobs'][_0x20c3ff(0x188)]();console[_0x20c3ff(0x1d3)](a33_0x443779[_0x20c3ff(0x17c)]('✓')+_0x20c3ff(0x179)+_0xd3f77f['email']+')');const _0x15de55=await isKeychainAvailable();_0x15de55?(await saveAPIKeyAsync(_0x55e8ec['apiKey'][_0x20c3ff(0x18d)](),_0x1a6a6b,_0xe5cf30),console['log'](a33_0x443779[_0x20c3ff(0x17c)]('✓')+_0x20c3ff(0x1b8))):console[_0x20c3ff(0x182)](a33_0x443779['yellow'](_0x20c3ff(0x1d2))),_0x21d801['site']=_0x1a6a6b;}catch(_0x178290){if(_0x178290 instanceof HTTPClientError&&_0x178290[_0x20c3ff(0x1a3)]===0x191)return printAuthError(_0x178290),0x1;return console[_0x20c3ff(0x1aa)](a33_0x443779[_0x20c3ff(0x1c1)](_0x20c3ff(0x1c6)+(_0x178290 instanceof Error?_0x178290[_0x20c3ff(0x17b)]:String(_0x178290)))),console[_0x20c3ff(0x1aa)](_0x20c3ff(0x192)),0x1;}}else _0x21d801[_0x46d54c]=_0x30d4f4||undefined;return saveProfileToUserConfig(_0xe5cf30,_0x21d801),console['log'](a33_0x443779[_0x20c3ff(0x17c)]('✓')+_0x20c3ff(0x183)+_0xe5cf30+'\x27\x20updated:\x20'+_0x46d54c+'='+(_0x30d4f4||'(cleared)')),0x0;}}export class ProfileUseCommand extends BaseCommand{[a33_0x51d70e(0x1b4)]='profile:use';[a33_0x51d70e(0x1ab)]=a33_0x51d70e(0x1bf);[a33_0x51d70e(0x1b6)](_0x4e9611){const _0x22ae97=a33_0x51d70e,{args:_0xd1d0df}=_0x4e9611;if(_0xd1d0df['length']===0x0)return _0x22ae97(0x1c2);return undefined;}async['execute'](_0x105017){const _0xb73f1d=a33_0x51d70e,{args:_0x28d728,options:_0x42195a}=_0x105017,_0x2ec7a5=_0x28d728[0x0],_0x42c1b9=_0x42195a['default'];cleanExpiredSessions();if(!profileExists(_0x2ec7a5)){console[_0xb73f1d(0x1aa)](a33_0x443779[_0xb73f1d(0x1c1)](_0xb73f1d(0x1cb)+_0x2ec7a5+_0xb73f1d(0x18f))),console['log']('\x0aAvailable\x20profiles:');const _0x15db9c=listProfiles();if(_0x15db9c['length']===0x0)console[_0xb73f1d(0x1d3)](_0xb73f1d(0x189));else for(const _0x591eab of _0x15db9c){console['log'](_0xb73f1d(0x1cd)+_0x591eab['name']);}return 0x1;}if(_0x42c1b9){const _0x221fe8=a33_0x15d597['join'](getConfigDir(),'tdx.json');return saveActiveProfileToUserConfig(_0x2ec7a5),console[_0xb73f1d(0x1d3)](_0xb73f1d(0x1bb)+a33_0x443779[_0xb73f1d(0x17c)](_0x2ec7a5)),console[_0xb73f1d(0x1d3)](a33_0x443779[_0xb73f1d(0x174)]('\x0aSaved\x20to:\x20'+_0x221fe8)),0x0;}const _0x49f9d2=getSessionID(_0x42195a[_0xb73f1d(0x19a)]);return saveSessionContext({'profile':_0x2ec7a5},_0x42195a[_0xb73f1d(0x19a)]),console[_0xb73f1d(0x1d3)]('Session\x20profile\x20set\x20to:\x20'+a33_0x443779[_0xb73f1d(0x17c)](_0x2ec7a5)+'\x20'+a33_0x443779[_0xb73f1d(0x174)](_0xb73f1d(0x1ad)+_0x49f9d2+')')),console[_0xb73f1d(0x1d3)](a33_0x443779['dim']('\x0aTip:\x20Use\x20\x27tdx\x20profile\x20use\x20'+_0x2ec7a5+_0xb73f1d(0x1be))),0x0;}}
1
+ const a33_0x5dfb15=a33_0x4894;(function(_0x3daeea,_0x28f5c3){const _0x5c01ae=a33_0x4894,_0x4e647e=_0x3daeea();while(!![]){try{const _0x3e4b43=parseInt(_0x5c01ae(0x191))/0x1*(parseInt(_0x5c01ae(0x170))/0x2)+parseInt(_0x5c01ae(0x181))/0x3+parseInt(_0x5c01ae(0x1b8))/0x4*(parseInt(_0x5c01ae(0x199))/0x5)+-parseInt(_0x5c01ae(0x1a6))/0x6+parseInt(_0x5c01ae(0x19d))/0x7+parseInt(_0x5c01ae(0x19a))/0x8*(parseInt(_0x5c01ae(0x16b))/0x9)+-parseInt(_0x5c01ae(0x19b))/0xa;if(_0x3e4b43===_0x28f5c3)break;else _0x4e647e['push'](_0x4e647e['shift']());}catch(_0x55392f){_0x4e647e['push'](_0x4e647e['shift']());}}}(a33_0x4f59,0x41960));import{BaseCommand,printAuthError}from'./command.js';import{listProfiles,profileExists,saveProfileToUserConfig,removeProfileFromUserConfig,loadProfile,getActiveProfile,saveActiveProfileToUserConfig}from'../core/profile.js';import{getConfigDir}from'../core/config.js';function a33_0x4f59(){const _0x36c57f=['9927400EmYmfV','Changing\x20site\x20to\x20\x27','2637950WOZIDS','profile:use','description','\x20\x20-\x20','confirm','\x27\x20requires\x20API\x20key\x20validation.','join','site','tdx.json','2011512ZbMwVy','\x0aYou\x20can\x20find\x20your\x20API\x20key\x20at:','\x27\x20does\x20not\x20exist.\x20Create\x20it?','Profile\x20was\x20not\x20created.\x20Please\x20try\x20again.','Profile\x20\x27','Session\x20profile\x20set\x20to:\x20','\x27\x20already\x20exists.\x20Use\x20\x27tdx\x20profile\x20delete\x20','length','includes','profileName','tdx:\x20profile\x20set','VALID_KEYS','error','\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases','Are\x20you\x20sure\x20you\x20want\x20to\x20remove\x20profile\x20\x27','\x20\x20(no\x20profiles\x20found)','\x27\x20created','(cleared)','8kPoGoP','jobs','\x27\x20deleted','Enter\x20profile\x20name:','warn','\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.','\x20API\x20key\x20saved\x20to\x20system\x20keychain\x20(profile:\x20','Validating\x20API\x20key...','Enter\x20description\x20(optional):','\x0aAvailable\x20profiles:','name','\x20--default\x27\x20to\x20save\x20permanently','execute','\x20Profile\x20\x27','email','skipExistsCheck','Unknown\x20key\x20\x27','(session:\x20','status','create','red','llm_agent','trim','Profile\x20name\x20must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore','ERROR','9ouVpVr','\x0aSaved\x20to:\x20','validate','oauth','getUserInfo','4102qrvTlp','Set\x20a\x20profile\x20configuration\x20value','You\x20can\x20now\x20use\x20tdx\x20commands\x20with\x20this\x20profile.\x20Try:','tdx:\x20profile\x20create','Removed\x20existing\x20profile\x20\x27','\x0aSetup\x20cancelled','session','message','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20use\x20<name>\x20[--default]','\x0aTip:\x20Use\x20\x27tdx\x20profile\x20use\x20','\x20\x20tdx\x20--profile\x20','Enter\x20your\x20TD\x20API\x20key:','\x27\x20updated:\x20','green','text','Delete\x20a\x20profile','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>','349905iLEOQW','profile','bold','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20delete\x20<name>','logLevel','✗\x20Validation\x20failed:\x20','Profile\x20name\x20cannot\x20be\x20empty','\x20API\x20key\x20is\x20valid\x20(User:\x20','parent_segment','test','split','\x27\x20does\x20not\x20exist.','log','apiKey','API\x20key\x20cannot\x20be\x20empty','\x0aSetting\x20up\x20authentication\x20for\x20site:\x20','245niXkTX','database','Set\x20session\x20profile','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','yellow','dim','default','password','1273605MBVXhc','729680ipaikQ'];a33_0x4f59=function(){return _0x36c57f;};return a33_0x4f59();}import*as a33_0x1498fd from'node:path';import{saveSessionContext,getSessionID,cleanExpiredSessions}from'../core/session.js';function a33_0x4894(_0x44d740,_0xe0d0aa){_0x44d740=_0x44d740-0x163;const _0x4f5922=a33_0x4f59();let _0x4894ed=_0x4f5922[_0x44d740];return _0x4894ed;}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_0x53e4e0 from'prompts';import a33_0x415dc2 from'chalk';function validateProfileName(_0x23c80b,_0x5f5d8d){const _0x31bdcc=a33_0x4894;if(!_0x23c80b||!_0x23c80b[_0x31bdcc(0x168)]())return _0x31bdcc(0x187);const _0x430dab=_0x23c80b[_0x31bdcc(0x168)]();if(!/^[a-zA-Z0-9_-]+$/[_0x31bdcc(0x18a)](_0x430dab))return _0x31bdcc(0x169);if(!_0x5f5d8d?.[_0x31bdcc(0x1c7)]&&profileExists(_0x430dab))return'Profile\x20\x27'+_0x430dab+_0x31bdcc(0x1ac)+_0x430dab+'\x27\x20to\x20remove\x20it\x20first,\x20or\x20re-create\x20with\x20--force.';return!![];}async function deleteProfileAndCredentials(_0x2990ba){removeProfileFromUserConfig(_0x2990ba);const _0x176347=await isKeychainAvailable();_0x176347&&await Promise['all']([deleteKeychainAPIKey(_0x2990ba),deleteOAuthTokens(_0x2990ba)]);}export class ProfileCreateCommand extends BaseCommand{[a33_0x5dfb15(0x1c2)]='profile:create';['description']='Create\x20a\x20new\x20profile';async['execute'](_0x1020e6){const _0x1d0574=a33_0x5dfb15,{options:_0x384343,args:_0xe4196e}=_0x1020e6,_0x44c26e=!!_0x384343['force'];console[_0x1d0574(0x18d)](a33_0x415dc2['bold'](_0x1d0574(0x173)));let _0x4fbc8f;if(_0xe4196e['length']>0x0&&_0xe4196e[0x0]){const _0x377e0a=_0xe4196e[0x0][_0x1d0574(0x168)]();_0x44c26e&&profileExists(_0x377e0a)&&(await deleteProfileAndCredentials(_0x377e0a),console[_0x1d0574(0x18d)](_0x1d0574(0x174)+_0x377e0a+'\x27'));const _0x2c415f=validateProfileName(_0x377e0a);if(_0x2c415f!==!![])return console['error'](a33_0x415dc2['red'](_0x2c415f)),0x1;_0x4fbc8f=_0x377e0a;}else{const _0x4b95cb=await a33_0x53e4e0({'type':_0x1d0574(0x17e),'name':_0x1d0574(0x1af),'message':_0x1d0574(0x1bb),'validate':_0x43b652=>validateProfileName(_0x43b652,{'skipExistsCheck':_0x44c26e})});if(!_0x4b95cb[_0x1d0574(0x1af)])return console['log'](_0x1d0574(0x175)),0x1;_0x4fbc8f=_0x4b95cb[_0x1d0574(0x1af)][_0x1d0574(0x168)](),_0x44c26e&&profileExists(_0x4fbc8f)&&(await deleteProfileAndCredentials(_0x4fbc8f),console[_0x1d0574(0x18d)](_0x1d0574(0x174)+_0x4fbc8f+'\x27'));}const _0xc79fb0=await a33_0x53e4e0({'type':'text','name':_0x1d0574(0x19f),'message':_0x1d0574(0x1c0)}),_0x56f2cb=_0xc79fb0[_0x1d0574(0x19f)]?.[_0x1d0574(0x168)]()||undefined,_0xe902b1=_0x384343[_0x1d0574(0x1a4)]||'us01',_0x29a024=await promptSiteSelection(_0xe902b1,_0x4fbc8f,'Setup\x20cancelled');if(!_0x29a024)return 0x1;const _0x28d7f5=resolveSite(_0x29a024),_0x46470a=await promptAuthMethod();if(!_0x46470a)return console[_0x1d0574(0x18d)](_0x1d0574(0x175)),0x1;if(_0x46470a===_0x1d0574(0x16e)){if(_0x56f2cb){const _0x57ea0d={'site':_0x28d7f5,'description':_0x56f2cb};saveProfileToUserConfig(_0x4fbc8f,_0x57ea0d);}const {accountName:_0x5836c8}=_0x384343;return await runOAuthLoginFlow(_0x28d7f5,_0x4fbc8f,_0x384343[_0x1d0574(0x185)]??LogLevel[_0x1d0574(0x16a)],{'accountName':_0x5836c8}),0x0;}console['log'](_0x1d0574(0x190)+_0x28d7f5),console[_0x1d0574(0x18d)]('You\x20can\x20find\x20your\x20API\x20key\x20at:'),console[_0x1d0574(0x18d)]('\x20\x20'+getConsoleUrl(_0x28d7f5,'/app/mp/ak'));const _0x1090ef=await a33_0x53e4e0({'type':_0x1d0574(0x198),'name':_0x1d0574(0x18e),'message':_0x1d0574(0x17b),'validate':_0x42a90b=>{const _0x388ef2=_0x1d0574;if(!_0x42a90b||!_0x42a90b[_0x388ef2(0x168)]())return _0x388ef2(0x18f);return!![];}});if(!_0x1090ef[_0x1d0574(0x18e)])return console[_0x1d0574(0x18d)](_0x1d0574(0x175)),0x1;const _0x29debc=_0x1090ef['apiKey'];console[_0x1d0574(0x18d)](_0x1d0574(0x1bf));try{const _0x364975=TDX[_0x1d0574(0x165)]({'site':_0x28d7f5,'apiKey':_0x29debc[_0x1d0574(0x168)](),'logLevel':_0x384343[_0x1d0574(0x185)]??LogLevel[_0x1d0574(0x16a)]}),_0x3efbbc=await _0x364975[_0x1d0574(0x1b9)][_0x1d0574(0x16f)]();console[_0x1d0574(0x18d)](a33_0x415dc2[_0x1d0574(0x17d)]('✓')+_0x1d0574(0x188)+_0x3efbbc[_0x1d0574(0x1c6)]+')');const _0x5ad3a0=await isKeychainAvailable();_0x5ad3a0?(await saveAPIKeyAsync(_0x29debc[_0x1d0574(0x168)](),_0x28d7f5,_0x4fbc8f),console[_0x1d0574(0x18d)](a33_0x415dc2[_0x1d0574(0x17d)]('✓')+_0x1d0574(0x1be)+_0x4fbc8f+')')):(console[_0x1d0574(0x1bc)](a33_0x415dc2[_0x1d0574(0x195)](_0x1d0574(0x194))),console[_0x1d0574(0x1bc)](a33_0x415dc2[_0x1d0574(0x195)](_0x1d0574(0x1bd))));const _0x57f2a1={'site':_0x28d7f5,..._0x56f2cb&&{'description':_0x56f2cb}};return saveProfileToUserConfig(_0x4fbc8f,_0x57f2a1),console[_0x1d0574(0x18d)](a33_0x415dc2[_0x1d0574(0x17d)]('✓')+_0x1d0574(0x1c5)+_0x4fbc8f+_0x1d0574(0x1b6)),console[_0x1d0574(0x18d)](),console[_0x1d0574(0x18d)](_0x1d0574(0x172)),console[_0x1d0574(0x18d)]('\x20\x20tdx\x20--profile\x20'+_0x4fbc8f+'\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication'),console[_0x1d0574(0x18d)](_0x1d0574(0x17a)+_0x4fbc8f+_0x1d0574(0x1b3)),0x0;}catch(_0x4d8914){if(_0x4d8914 instanceof HTTPClientError&&_0x4d8914[_0x1d0574(0x164)]===0x191)return printAuthError(_0x4d8914),0x1;return console[_0x1d0574(0x1b2)](a33_0x415dc2[_0x1d0574(0x166)](_0x1d0574(0x186)+(_0x4d8914 instanceof Error?_0x4d8914[_0x1d0574(0x177)]:String(_0x4d8914)))),console[_0x1d0574(0x1b2)](_0x1d0574(0x1a9)),0x1;}}}export class ProfileDeleteCommand extends BaseCommand{['name']='profile:delete';[a33_0x5dfb15(0x19f)]=a33_0x5dfb15(0x17f);[a33_0x5dfb15(0x16d)](_0x5c8c5f){const _0x6c83a4=a33_0x5dfb15,{args:_0x19a8fe}=_0x5c8c5f;if(_0x19a8fe[_0x6c83a4(0x1ad)]===0x0)return _0x6c83a4(0x184);return undefined;}async[a33_0x5dfb15(0x1c4)](_0x338421){const _0x3b4c85=a33_0x5dfb15,{args:_0x2e6664}=_0x338421,_0x1ed07e=_0x2e6664[0x0];console['log'](a33_0x415dc2[_0x3b4c85(0x183)]('tdx:\x20profile\x20delete'));if(!profileExists(_0x1ed07e)){console[_0x3b4c85(0x1b2)](a33_0x415dc2['red'](_0x3b4c85(0x1aa)+_0x1ed07e+_0x3b4c85(0x18c))),console[_0x3b4c85(0x18d)](_0x3b4c85(0x1c1));const _0x203092=listProfiles();if(_0x203092[_0x3b4c85(0x1ad)]===0x0)console[_0x3b4c85(0x18d)](_0x3b4c85(0x1b5));else for(const _0x2608ac of _0x203092){console['log'](_0x3b4c85(0x1a0)+_0x2608ac[_0x3b4c85(0x1c2)]);}return 0x1;}const _0x5bb96e=await a33_0x53e4e0({'type':'confirm','name':_0x3b4c85(0x1a1),'message':_0x3b4c85(0x1b4)+_0x1ed07e+'\x27?','initial':![]});if(!_0x5bb96e[_0x3b4c85(0x1a1)])return console['log']('Removal\x20cancelled'),0x0;try{await deleteProfileAndCredentials(_0x1ed07e),console['log'](a33_0x415dc2[_0x3b4c85(0x17d)]('✓')+_0x3b4c85(0x1c5)+_0x1ed07e+_0x3b4c85(0x1ba));}catch(_0x46cb19){return console[_0x3b4c85(0x1b2)](a33_0x415dc2[_0x3b4c85(0x166)]('Failed\x20to\x20delete\x20profile:\x20'+(_0x46cb19 instanceof Error?_0x46cb19['message']:String(_0x46cb19)))),0x1;}return 0x0;}}export class ProfileSetCommand extends BaseCommand{['name']='profile:set';['description']=a33_0x5dfb15(0x171);static [a33_0x5dfb15(0x1b1)]=[a33_0x5dfb15(0x1a4),a33_0x5dfb15(0x192),a33_0x5dfb15(0x189),'llm_project',a33_0x5dfb15(0x167),a33_0x5dfb15(0x19f)];[a33_0x5dfb15(0x16d)](_0x81bb9){const _0x50abbd=a33_0x5dfb15,{args:_0x4a635c,options:_0x25e2e8}=_0x81bb9,_0x517f80=_0x25e2e8[_0x50abbd(0x182)]||getActiveProfile();if(!_0x517f80)return _0x50abbd(0x180);if(_0x4a635c[_0x50abbd(0x1ad)]===0x0)return'Key=value\x20pair\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20'+ProfileSetCommand[_0x50abbd(0x1b1)][_0x50abbd(0x1a3)](',\x20');const _0x44c267=_0x4a635c[0x0];if(!_0x44c267['includes']('='))return'Invalid\x20format.\x20Use:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20'+ProfileSetCommand[_0x50abbd(0x1b1)][_0x50abbd(0x1a3)](',\x20');const [_0x31196a]=_0x44c267[_0x50abbd(0x18b)]('=',0x2);if(!ProfileSetCommand[_0x50abbd(0x1b1)][_0x50abbd(0x1ae)](_0x31196a))return _0x50abbd(0x1c8)+_0x31196a+'\x27.\x0a\x0aValid\x20keys:\x20'+ProfileSetCommand[_0x50abbd(0x1b1)][_0x50abbd(0x1a3)](',\x20');return undefined;}async[a33_0x5dfb15(0x1c4)](_0x64d432){const _0x1c87d3=a33_0x5dfb15,{args:_0x813868,options:_0x19c173}=_0x64d432,_0x3af8dd=_0x19c173[_0x1c87d3(0x182)]||getActiveProfile(),[_0x568f99,..._0x26a87a]=_0x813868[0x0]['split']('='),_0x55faa3=_0x26a87a[_0x1c87d3(0x1a3)]('=');console[_0x1c87d3(0x18d)](a33_0x415dc2[_0x1c87d3(0x183)](_0x1c87d3(0x1b0)));if(!profileExists(_0x3af8dd)){const _0x32ff48=await a33_0x53e4e0({'type':_0x1c87d3(0x1a1),'name':_0x1c87d3(0x165),'message':_0x1c87d3(0x1aa)+_0x3af8dd+_0x1c87d3(0x1a8),'initial':!![]});if(!_0x32ff48[_0x1c87d3(0x165)])return console[_0x1c87d3(0x18d)]('Operation\x20cancelled'),0x1;}const _0xc81e5f=loadProfile(_0x3af8dd),_0x42bb1f=_0xc81e5f?.['config']||{};if(_0x568f99==='site'){const _0x49f4c2=resolveSite(_0x55faa3);console['log'](_0x1c87d3(0x19c)+_0x49f4c2+_0x1c87d3(0x1a2)),console[_0x1c87d3(0x18d)](_0x1c87d3(0x1a7)),console[_0x1c87d3(0x18d)]('\x20\x20'+getConsoleUrl(_0x49f4c2,'/app/mp/ak'));const _0x40bc7d=await a33_0x53e4e0({'type':_0x1c87d3(0x198),'name':_0x1c87d3(0x18e),'message':'Enter\x20your\x20TD\x20API\x20key\x20for\x20the\x20new\x20site:','validate':_0x3b61c6=>{const _0x29e705=_0x1c87d3;if(!_0x3b61c6||!_0x3b61c6[_0x29e705(0x168)]())return _0x29e705(0x18f);return!![];}});if(!_0x40bc7d[_0x1c87d3(0x18e)])return console['log']('\x0aOperation\x20cancelled'),0x1;console[_0x1c87d3(0x18d)]('Validating\x20API\x20key...');try{const _0x60166e=TDX[_0x1c87d3(0x165)]({'site':_0x49f4c2,'apiKey':_0x40bc7d[_0x1c87d3(0x18e)][_0x1c87d3(0x168)](),'logLevel':_0x19c173[_0x1c87d3(0x185)]??LogLevel['ERROR']}),_0x397307=await _0x60166e[_0x1c87d3(0x1b9)][_0x1c87d3(0x16f)]();console[_0x1c87d3(0x18d)](a33_0x415dc2[_0x1c87d3(0x17d)]('✓')+'\x20API\x20key\x20is\x20valid\x20(User:\x20'+_0x397307['email']+')');const _0x5eb71e=await isKeychainAvailable();_0x5eb71e?(await saveAPIKeyAsync(_0x40bc7d['apiKey'][_0x1c87d3(0x168)](),_0x49f4c2,_0x3af8dd),console[_0x1c87d3(0x18d)](a33_0x415dc2[_0x1c87d3(0x17d)]('✓')+'\x20API\x20key\x20saved\x20to\x20system\x20keychain')):console[_0x1c87d3(0x1bc)](a33_0x415dc2[_0x1c87d3(0x195)](_0x1c87d3(0x194))),_0x42bb1f[_0x1c87d3(0x1a4)]=_0x49f4c2;}catch(_0x51c94b){if(_0x51c94b instanceof HTTPClientError&&_0x51c94b[_0x1c87d3(0x164)]===0x191)return printAuthError(_0x51c94b),0x1;return console[_0x1c87d3(0x1b2)](a33_0x415dc2['red'](_0x1c87d3(0x186)+(_0x51c94b instanceof Error?_0x51c94b[_0x1c87d3(0x177)]:String(_0x51c94b)))),console[_0x1c87d3(0x1b2)]('Site\x20was\x20not\x20changed.'),0x1;}}else _0x42bb1f[_0x568f99]=_0x55faa3||undefined;return saveProfileToUserConfig(_0x3af8dd,_0x42bb1f),console['log'](a33_0x415dc2['green']('✓')+_0x1c87d3(0x1c5)+_0x3af8dd+_0x1c87d3(0x17c)+_0x568f99+'='+(_0x55faa3||_0x1c87d3(0x1b7))),0x0;}}export class ProfileUseCommand extends BaseCommand{[a33_0x5dfb15(0x1c2)]=a33_0x5dfb15(0x19e);[a33_0x5dfb15(0x19f)]=a33_0x5dfb15(0x193);[a33_0x5dfb15(0x16d)](_0x5a91ca){const _0x3f7339=a33_0x5dfb15,{args:_0x174ad2}=_0x5a91ca;if(_0x174ad2['length']===0x0)return _0x3f7339(0x178);return undefined;}async['execute'](_0x189032){const _0x3100c6=a33_0x5dfb15,{args:_0x320703,options:_0x27285c}=_0x189032,_0x2e194a=_0x320703[0x0],_0x5446b3=_0x27285c[_0x3100c6(0x197)];cleanExpiredSessions();if(!profileExists(_0x2e194a)){console[_0x3100c6(0x1b2)](a33_0x415dc2[_0x3100c6(0x166)]('Profile\x20\x27'+_0x2e194a+_0x3100c6(0x18c))),console[_0x3100c6(0x18d)](_0x3100c6(0x1c1));const _0x4114b5=listProfiles();if(_0x4114b5[_0x3100c6(0x1ad)]===0x0)console[_0x3100c6(0x18d)](_0x3100c6(0x1b5));else for(const _0x193ba1 of _0x4114b5){console[_0x3100c6(0x18d)]('\x20\x20-\x20'+_0x193ba1[_0x3100c6(0x1c2)]);}return 0x1;}if(_0x5446b3){const _0x48b880=a33_0x1498fd[_0x3100c6(0x1a3)](getConfigDir(),_0x3100c6(0x1a5));return saveActiveProfileToUserConfig(_0x2e194a),console[_0x3100c6(0x18d)]('Default\x20profile\x20set\x20to:\x20'+a33_0x415dc2[_0x3100c6(0x17d)](_0x2e194a)),console[_0x3100c6(0x18d)](a33_0x415dc2['dim'](_0x3100c6(0x16c)+_0x48b880)),0x0;}const _0x225e83=getSessionID(_0x27285c[_0x3100c6(0x176)]);return saveSessionContext({'profile':_0x2e194a},_0x27285c['session']),console[_0x3100c6(0x18d)](_0x3100c6(0x1ab)+a33_0x415dc2[_0x3100c6(0x17d)](_0x2e194a)+'\x20'+a33_0x415dc2['dim'](_0x3100c6(0x163)+_0x225e83+')')),console[_0x3100c6(0x18d)](a33_0x415dc2[_0x3100c6(0x196)](_0x3100c6(0x179)+_0x2e194a+_0x3100c6(0x1c3))),0x0;}}
@@ -1 +1 @@
1
- const a34_0x552c8e=a34_0x40e7;function a34_0x5b06(){const _0x2d984e=['4hgJHYN','profiles','config','5483370evwivE','202544gSnwko','1583844MMxBkb','green','dim','\x20\x20Global:\x20~/.config/tdx/tdx.json','👤\x20','3590840uvXlNo','site','4933334MLjqEg','log','name','length','error','execute','15WWssdA','1413408zDiEtJ','\x20\x20Local:\x20\x20(project\x20folder)/tdx.json','873dgPvJa','message','76152lAUwtL','description'];a34_0x5b06=function(){return _0x2d984e;};return a34_0x5b06();}(function(_0x563c30,_0x29d07d){const _0x49ed90=a34_0x40e7,_0x56431d=_0x563c30();while(!![]){try{const _0x493a11=parseInt(_0x49ed90(0x11f))/0x1*(-parseInt(_0x49ed90(0x123))/0x2)+-parseInt(_0x49ed90(0x132))/0x3+parseInt(_0x49ed90(0x129))/0x4+parseInt(_0x49ed90(0x131))/0x5*(parseInt(_0x49ed90(0x124))/0x6)+-parseInt(_0x49ed90(0x12b))/0x7+-parseInt(_0x49ed90(0x11d))/0x8*(-parseInt(_0x49ed90(0x11b))/0x9)+-parseInt(_0x49ed90(0x122))/0xa;if(_0x493a11===_0x29d07d)break;else _0x56431d['push'](_0x56431d['shift']());}catch(_0x1a9089){_0x56431d['push'](_0x56431d['shift']());}}}(a34_0x5b06,0x76144));function a34_0x40e7(_0x34aaf9,_0x526ffe){_0x34aaf9=_0x34aaf9-0x11a;const _0x5b06fb=a34_0x5b06();let _0x40e796=_0x5b06fb[_0x34aaf9];return _0x40e796;}import{BaseCommand}from'./command.js';import{listProfiles,getActiveProfile,getProfileParams}from'../core/profile.js';import{handleSDKOutput,isStructuredFormat}from'../core/command-output.js';import a34_0xb18f56 from'chalk';export class ProfilesCommand extends BaseCommand{['name']=a34_0x552c8e(0x120);[a34_0x552c8e(0x11e)]='List\x20all\x20available\x20profiles';async[a34_0x552c8e(0x130)](_0x109e8a){const _0x4a72e9=a34_0x552c8e,{options:_0x566075}=_0x109e8a;try{const _0x2d9073=listProfiles(),_0x45d4e9=getActiveProfile();if(_0x2d9073[_0x4a72e9(0x12e)]===0x0)return console[_0x4a72e9(0x12c)]('No\x20profiles\x20found.\x20Define\x20profiles\x20in\x20tdx.json:\x0a'),console[_0x4a72e9(0x12c)](_0x4a72e9(0x11a)),console['log'](_0x4a72e9(0x127)),0x0;const _0x3a586f=_0x2d9073['map'](_0x512136=>{const _0x191379=_0x4a72e9,_0x43bbc7=_0x512136[_0x191379(0x12d)]===_0x45d4e9,_0x1f94be=getProfileParams(_0x512136[_0x191379(0x121)]);return{'name':_0x512136[_0x191379(0x12d)],'active':_0x43bbc7,'scope':_0x512136['scope'],'description':_0x512136[_0x191379(0x121)][_0x191379(0x11e)]||'','params':_0x1f94be};});if(isStructuredFormat(_0x566075))await handleSDKOutput(_0x3a586f,_0x566075);else for(const _0x638380 of _0x2d9073){const _0x37c4b2=_0x638380[_0x4a72e9(0x12d)]===_0x45d4e9?a34_0xb18f56[_0x4a72e9(0x125)]('\x20✓'):'',_0xa0306d=_0x638380['config'][_0x4a72e9(0x12a)]?a34_0xb18f56[_0x4a72e9(0x126)]('\x20'+_0x638380['config'][_0x4a72e9(0x12a)]):'',_0x55e607=_0x638380[_0x4a72e9(0x121)][_0x4a72e9(0x11e)]?a34_0xb18f56[_0x4a72e9(0x126)]('\x20\x20'+_0x638380[_0x4a72e9(0x121)][_0x4a72e9(0x11e)]):'';console[_0x4a72e9(0x12c)](_0x4a72e9(0x128)+_0x638380[_0x4a72e9(0x12d)]+_0x37c4b2+_0xa0306d+_0x55e607);}return 0x0;}catch(_0x3bdcfd){return _0x3bdcfd instanceof Error&&console[_0x4a72e9(0x12f)]('Error:\x20'+_0x3bdcfd[_0x4a72e9(0x11c)]),0x1;}}}
1
+ const a34_0x253c1c=a34_0x17ab;(function(_0x48f1d2,_0x3f313e){const _0x2d79c0=a34_0x17ab,_0x20bd08=_0x48f1d2();while(!![]){try{const _0x180c9c=-parseInt(_0x2d79c0(0x124))/0x1*(-parseInt(_0x2d79c0(0x122))/0x2)+-parseInt(_0x2d79c0(0x11b))/0x3+-parseInt(_0x2d79c0(0x12c))/0x4+parseInt(_0x2d79c0(0x128))/0x5*(parseInt(_0x2d79c0(0x11d))/0x6)+-parseInt(_0x2d79c0(0x113))/0x7+parseInt(_0x2d79c0(0x119))/0x8*(-parseInt(_0x2d79c0(0x123))/0x9)+parseInt(_0x2d79c0(0x111))/0xa*(-parseInt(_0x2d79c0(0x120))/0xb);if(_0x180c9c===_0x3f313e)break;else _0x20bd08['push'](_0x20bd08['shift']());}catch(_0x197c6d){_0x20bd08['push'](_0x20bd08['shift']());}}}(a34_0x3a70,0x46c44));import{BaseCommand}from'./command.js';function a34_0x3a70(){const _0x48c489=['617076VGlUif','\x20\x20Local:\x20\x20(project\x20folder)/tdx.json','190fwKbbl','👤\x20','472724muBmeQ','\x20\x20Global:\x20~/.config/tdx/tdx.json','green','profiles','site','name','78768LpiYbq','log','172923IYhLJv','error','1736364UebnVt','execute','config','63107BLKYWu','scope','2VMuTha','153xbnbjA','266899SSpIMs','List\x20all\x20available\x20profiles','dim','message','10DpJkaW','description','Error:\x20','No\x20profiles\x20found.\x20Define\x20profiles\x20in\x20tdx.json:\x0a'];a34_0x3a70=function(){return _0x48c489;};return a34_0x3a70();}import{listProfiles,getActiveProfile,getProfileParams}from'../core/profile.js';function a34_0x17ab(_0x207acc,_0x4cf442){_0x207acc=_0x207acc-0x110;const _0x3a7030=a34_0x3a70();let _0x17ab52=_0x3a7030[_0x207acc];return _0x17ab52;}import{handleSDKOutput,isStructuredFormat}from'../core/command-output.js';import a34_0x3b3dcd from'chalk';export class ProfilesCommand extends BaseCommand{[a34_0x253c1c(0x118)]=a34_0x253c1c(0x116);[a34_0x253c1c(0x129)]=a34_0x253c1c(0x125);async[a34_0x253c1c(0x11e)](_0xf9a756){const _0x171193=a34_0x253c1c,{options:_0x552efd}=_0xf9a756;try{const _0x10ebd3=listProfiles(),_0x495177=getActiveProfile();if(_0x10ebd3['length']===0x0)return console[_0x171193(0x11a)](_0x171193(0x12b)),console[_0x171193(0x11a)](_0x171193(0x110)),console[_0x171193(0x11a)](_0x171193(0x114)),0x0;const _0x1b3631=_0x10ebd3['map'](_0x30ea75=>{const _0x401265=_0x171193,_0x5e9817=_0x30ea75[_0x401265(0x118)]===_0x495177,_0x34ea81=getProfileParams(_0x30ea75[_0x401265(0x11f)]);return{'name':_0x30ea75['name'],'active':_0x5e9817,'scope':_0x30ea75[_0x401265(0x121)],'description':_0x30ea75['config'][_0x401265(0x129)]||'','params':_0x34ea81};});if(isStructuredFormat(_0x552efd))await handleSDKOutput(_0x1b3631,_0x552efd);else for(const _0x529244 of _0x10ebd3){const _0x15c135=_0x529244['name']===_0x495177?a34_0x3b3dcd[_0x171193(0x115)]('\x20✓'):'',_0x46ab50=_0x529244[_0x171193(0x11f)][_0x171193(0x117)]?a34_0x3b3dcd[_0x171193(0x126)]('\x20'+_0x529244[_0x171193(0x11f)][_0x171193(0x117)]):'',_0x5bfd59=_0x529244[_0x171193(0x11f)][_0x171193(0x129)]?a34_0x3b3dcd[_0x171193(0x126)]('\x20\x20'+_0x529244[_0x171193(0x11f)][_0x171193(0x129)]):'';console['log'](_0x171193(0x112)+_0x529244['name']+_0x15c135+_0x46ab50+_0x5bfd59);}return 0x0;}catch(_0x168ddf){return _0x168ddf instanceof Error&&console[_0x171193(0x11c)](_0x171193(0x12a)+_0x168ddf[_0x171193(0x127)]),0x1;}}}
@@ -1 +1 @@
1
- const a35_0x291c62=a35_0x22be;(function(_0xc7e08c,_0x4810de){const _0x37088a=a35_0x22be,_0x1174e6=_0xc7e08c();while(!![]){try{const _0x1d2fdd=parseInt(_0x37088a(0x15e))/0x1*(parseInt(_0x37088a(0x16a))/0x2)+parseInt(_0x37088a(0x16f))/0x3+-parseInt(_0x37088a(0x171))/0x4+-parseInt(_0x37088a(0x15a))/0x5+parseInt(_0x37088a(0x167))/0x6+parseInt(_0x37088a(0x158))/0x7+parseInt(_0x37088a(0x15d))/0x8;if(_0x1d2fdd===_0x4810de)break;else _0x1174e6['push'](_0x1174e6['shift']());}catch(_0xf219f2){_0x1174e6['push'](_0x1174e6['shift']());}}}(a35_0x4650,0x1de4e));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_0x4650(){const _0x288039=['completedSplits','verbose','setJobId','Schema:\x20','validate','join','174447cuoPSq','totalSplits','1171340dbLfPt','file','setExtra','321328oFZDkq','7cZzEOs','Executing\x20query\x20[','state','stats','No\x20SQL\x20provided','SQL:\x20','name','message','error','385950gyvzta','\x20[Job\x20ID:\x20','push','15814maguTO','processedRows','description','\x20splits','execute','645048PnYeID','query','172252tfUwbP','site','\x0aAll\x20results\x20saved\x20to\x20','Usage:\x20tdx\x20query\x20\x22SELECT\x20*\x20FROM\x20table\x22\x0a\x20\x20\x20or:\x20tdx\x20query\x20query.sql\x0a\x20\x20\x20or:\x20echo\x20\x22SELECT\x201\x22\x20|\x20tdx\x20query\x20-\x0a\x0aRun\x20\x27tdx\x20query\x20--help\x27\x20for\x20more\x20options','in\x20','Query\x20completed:\x20Processed\x20','length','\x20rows\x20','output','Executing\x20statement\x20','Catalog:\x20','Site:\x20','Error:\x20','Statement\x20','jobId','originalMessage'];a35_0x4650=function(){return _0x288039;};return a35_0x4650();}function a35_0x22be(_0x3c1483,_0x3bb6d8){_0x3c1483=_0x3c1483-0x14a;const _0x465080=a35_0x4650();let _0x22be09=_0x465080[_0x3c1483];return _0x22be09;}import{withProgressSpinner,formatElapsed}from'../utils/spinner.js';import{formatRows}from'../sdk/util/formatters.js';export class QueryCommand extends BaseCommand{[a35_0x291c62(0x164)]=a35_0x291c62(0x170);[a35_0x291c62(0x16c)]='Run\x20Trino\x20queries\x20(streaming)';async[a35_0x291c62(0x16e)](_0x32e289){const _0x290c24=a35_0x291c62,{options:_0x226d49,args:_0xabae2e,tdx:_0x1a7348}=_0x32e289,_0x17e8a6={..._0x226d49,'limitStructuredFormats':!![]},_0x42cc52=_0xabae2e[0x0],_0x5f4bb6=_0x226d49[_0x290c24(0x15b)];let _0xf4ef91;try{if(_0x5f4bb6)_0xf4ef91=readSqlStatementsFromFile(_0x5f4bb6);else{if(_0x42cc52==='-')_0xf4ef91=await readSqlStatementsFromStdin();else{if(_0x42cc52&&isSqlFilePath(_0x42cc52))_0xf4ef91=readSqlStatementsFromFile(_0x42cc52);else{if(_0x42cc52)_0xf4ef91=splitSqlStatements(_0x42cc52);else throw new Error(_0x290c24(0x162));}}}}catch(_0x28527e){return console[_0x290c24(0x166)](_0x290c24(0x14e)+_0x28527e[_0x290c24(0x165)]),0x1;}const _0x4af13b=_0x226d49['database']||'information_schema',_0x5f294c=_0x226d49['catalog'];try{const _0x2c1f34=[],_0x121df8=!!_0x226d49[_0x290c24(0x14a)];for(let _0x32514b=0x0;_0x32514b<_0xf4ef91[_0x290c24(0x177)];_0x32514b++){const _0x536021=_0xf4ef91[_0x32514b],_0x5a48a2=_0x32514b+0x1,_0x359599=_0xf4ef91['length'],_0x4c40d7=_0x359599>0x1;_0x226d49[_0x290c24(0x153)]&&(console[_0x290c24(0x166)]('\x0a'+(_0x4c40d7?'Statement\x20'+_0x5a48a2+'/'+_0x359599+':':'')),console[_0x290c24(0x166)](_0x290c24(0x14d)+_0x226d49[_0x290c24(0x172)]),console[_0x290c24(0x166)](_0x290c24(0x14c)+(_0x5f294c||'td')),console[_0x290c24(0x166)](_0x290c24(0x155)+_0x4af13b),console[_0x290c24(0x166)](_0x290c24(0x163)+_0x536021));const _0x18ccfc=_0x4c40d7?_0x290c24(0x14b)+_0x5a48a2+'/'+_0x359599+'...':'Executing\x20query...';try{const _0x270a43=await withProgressSpinner(_0x18ccfc,async _0x389075=>{const _0x510372=_0x290c24,_0xee6690=await _0x1a7348[_0x510372(0x170)]['execute'](_0x536021,{'catalog':_0x5f294c,'schema':_0x4af13b,'onJobId':_0x54b892=>{const _0x5de10e=_0x510372;_0x389075[_0x5de10e(0x154)](_0x54b892);},'onProgress':_0x5e4ccd=>{const _0x35862a=_0x510372;_0x389075['setPhase'](_0x35862a(0x15f)+_0x5e4ccd[_0x35862a(0x160)]+']'),_0x389075[_0x35862a(0x15c)](formatRows(_0x5e4ccd['processedRows'])+_0x35862a(0x178)+_0x5e4ccd[_0x35862a(0x152)]+'/'+_0x5e4ccd[_0x35862a(0x159)]+_0x35862a(0x16d));}});return _0xee6690;},{'verbose':_0x226d49[_0x290c24(0x153)]}),_0x5199e0=_0x270a43['data'],_0x257063=_0x5199e0[_0x290c24(0x150)]?_0x290c24(0x168)+_0x5199e0[_0x290c24(0x150)]+']':'',_0x5f9b56=_0x4c40d7?_0x290c24(0x14f)+_0x5a48a2+'/'+_0x359599+'\x20-\x20':'';console[_0x290c24(0x166)]('✔\x20'+_0x5f9b56+_0x290c24(0x176)+formatRows(_0x5199e0[_0x290c24(0x161)][_0x290c24(0x16b)])+_0x290c24(0x178)+(_0x290c24(0x175)+formatElapsed(_0x5199e0[_0x290c24(0x161)]['elapsedTimeMillis'])+_0x257063));if(_0x4c40d7&&_0x121df8){const _0x48224c=resolveOutputOptions(_0x17e8a6),_0xf85672=await formatQueryOutput(_0x5199e0,_0x48224c);_0x2c1f34[_0x290c24(0x169)](_0xf85672);}else await handleQueryOutput(_0x5199e0,_0x17e8a6);}catch(_0x14d1e3){const _0x3ecf8e=_0x4c40d7?_0x290c24(0x14f)+_0x5a48a2+'/'+_0x359599+':\x0a':'',_0xd86c6c=_0x14d1e3 instanceof SDKError?_0x14d1e3[_0x290c24(0x151)]:_0x14d1e3[_0x290c24(0x165)];return console[_0x290c24(0x166)](''+_0x3ecf8e+_0xd86c6c),0x1;}}if(_0xf4ef91[_0x290c24(0x177)]>0x1&&_0x121df8&&_0x2c1f34[_0x290c24(0x177)]>0x0){const _0x42a610=_0x2c1f34[_0x290c24(0x157)]('\x0a');writeFileSync(_0x226d49[_0x290c24(0x14a)],_0x42a610),console[_0x290c24(0x166)](_0x290c24(0x173)+_0x226d49['output']);}return 0x0;}catch(_0x37df7e){throw _0x37df7e;}}[a35_0x291c62(0x156)](_0x5c2c09){const _0x205245=a35_0x291c62,_0x437ff9=_0x5c2c09['args'][0x0],_0x1416ac=_0x5c2c09['options'][_0x205245(0x15b)];if(!_0x437ff9&&!_0x1416ac)return _0x205245(0x174);if(_0x437ff9&&_0x1416ac)return'Cannot\x20specify\x20both\x20SQL\x20argument\x20and\x20--file\x20option';return undefined;}}
1
+ const a35_0x296dd3=a35_0x50e3;(function(_0xc84e7b,_0x11d41b){const _0x194ca8=a35_0x50e3,_0x5b5c0e=_0xc84e7b();while(!![]){try{const _0x3ddc62=parseInt(_0x194ca8(0x1aa))/0x1+-parseInt(_0x194ca8(0x1c6))/0x2*(parseInt(_0x194ca8(0x1a8))/0x3)+-parseInt(_0x194ca8(0x1b5))/0x4+-parseInt(_0x194ca8(0x1c0))/0x5+parseInt(_0x194ca8(0x1a0))/0x6+parseInt(_0x194ca8(0x1a9))/0x7+parseInt(_0x194ca8(0x199))/0x8;if(_0x3ddc62===_0x11d41b)break;else _0x5b5c0e['push'](_0x5b5c0e['shift']());}catch(_0x5d8907){_0x5b5c0e['push'](_0x5b5c0e['shift']());}}}(a35_0x153f,0xe73eb));import{BaseCommand}from'./command.js';function a35_0x153f(){const _0x465fbd=['information_schema','...','\x20rows\x20','output','error','join','6595810JJjnpf','Executing\x20query...','Executing\x20query\x20[','completedSplits','catalog','stats','12lnZKky','\x20splits','\x20[Job\x20ID:\x20','Executing\x20statement\x20','options','site','verbose','12145944QPQQyi','totalSplits','args','Error:\x20','Run\x20Trino\x20queries\x20(streaming)','file','\x20-\x20','3138072EWHLXe','No\x20SQL\x20provided','Cannot\x20specify\x20both\x20SQL\x20argument\x20and\x20--file\x20option','processedRows','query','\x0aAll\x20results\x20saved\x20to\x20','message','push','774753DZAoWS','3423714nPuKgr','1779122cLkDcE','Statement\x20','Catalog:\x20','execute','Site:\x20','database','jobId','originalMessage','elapsedTimeMillis','length','validate','1974528uxiyBg','Schema:\x20','SQL:\x20','in\x20','Query\x20completed:\x20Processed\x20'];a35_0x153f=function(){return _0x465fbd;};return a35_0x153f();}import{SDKError}from'../sdk/index.js';import{handleQueryOutput,formatQueryOutput,resolveOutputOptions}from'../core/command-output.js';import{readSqlStatementsFromFile,readSqlStatementsFromStdin,splitSqlStatements,isSqlFilePath}from'../sdk/query/sql-parser.js';import{writeFileSync}from'fs';import{withProgressSpinner,formatElapsed}from'../utils/spinner.js';function a35_0x50e3(_0x1e86d6,_0x1dd532){_0x1e86d6=_0x1e86d6-0x195;const _0x153fe1=a35_0x153f();let _0x50e370=_0x153fe1[_0x1e86d6];return _0x50e370;}import{formatRows}from'../sdk/util/formatters.js';export class QueryCommand extends BaseCommand{['name']=a35_0x296dd3(0x1a4);['description']=a35_0x296dd3(0x19d);async[a35_0x296dd3(0x1ad)](_0x1c895f){const _0x4a7ffe=a35_0x296dd3,{options:_0x28e3d7,args:_0x258087,tdx:_0x5a8665}=_0x1c895f,_0x6b2e8b={..._0x28e3d7,'limitStructuredFormats':!![]},_0x4a8c85=_0x258087[0x0],_0x15b3bf=_0x28e3d7[_0x4a7ffe(0x19e)];let _0x4b8fdc;try{if(_0x15b3bf)_0x4b8fdc=readSqlStatementsFromFile(_0x15b3bf);else{if(_0x4a8c85==='-')_0x4b8fdc=await readSqlStatementsFromStdin();else{if(_0x4a8c85&&isSqlFilePath(_0x4a8c85))_0x4b8fdc=readSqlStatementsFromFile(_0x4a8c85);else{if(_0x4a8c85)_0x4b8fdc=splitSqlStatements(_0x4a8c85);else throw new Error(_0x4a7ffe(0x1a1));}}}}catch(_0x19f032){return console[_0x4a7ffe(0x1be)](_0x4a7ffe(0x19c)+_0x19f032[_0x4a7ffe(0x1a6)]),0x1;}const _0x4e1794=_0x28e3d7[_0x4a7ffe(0x1af)]||_0x4a7ffe(0x1ba),_0x49a1f1=_0x28e3d7[_0x4a7ffe(0x1c4)];try{const _0x2f3a7d=[],_0x5c5f1f=!!_0x28e3d7[_0x4a7ffe(0x1bd)];for(let _0xb8e94b=0x0;_0xb8e94b<_0x4b8fdc['length'];_0xb8e94b++){const _0x2d6510=_0x4b8fdc[_0xb8e94b],_0x51e4a7=_0xb8e94b+0x1,_0x33cfc6=_0x4b8fdc[_0x4a7ffe(0x1b3)],_0x36cfb7=_0x33cfc6>0x1;_0x28e3d7[_0x4a7ffe(0x198)]&&(console['error']('\x0a'+(_0x36cfb7?'Statement\x20'+_0x51e4a7+'/'+_0x33cfc6+':':'')),console[_0x4a7ffe(0x1be)](_0x4a7ffe(0x1ae)+_0x28e3d7[_0x4a7ffe(0x197)]),console[_0x4a7ffe(0x1be)](_0x4a7ffe(0x1ac)+(_0x49a1f1||'td')),console[_0x4a7ffe(0x1be)](_0x4a7ffe(0x1b6)+_0x4e1794),console[_0x4a7ffe(0x1be)](_0x4a7ffe(0x1b7)+_0x2d6510));const _0x24ee5f=_0x36cfb7?_0x4a7ffe(0x195)+_0x51e4a7+'/'+_0x33cfc6+_0x4a7ffe(0x1bb):_0x4a7ffe(0x1c1);try{const _0x17eced=await withProgressSpinner(_0x24ee5f,async _0x2379c8=>{const _0xcca52d=_0x4a7ffe,_0x23fdaa=await _0x5a8665['query'][_0xcca52d(0x1ad)](_0x2d6510,{'catalog':_0x49a1f1,'schema':_0x4e1794,'onJobId':_0x7d45cc=>{_0x2379c8['setJobId'](_0x7d45cc);},'onProgress':_0x25ca97=>{const _0x5599d4=_0xcca52d;_0x2379c8['setPhase'](_0x5599d4(0x1c2)+_0x25ca97['state']+']'),_0x2379c8['setExtra'](formatRows(_0x25ca97[_0x5599d4(0x1a3)])+_0x5599d4(0x1bc)+_0x25ca97[_0x5599d4(0x1c3)]+'/'+_0x25ca97[_0x5599d4(0x19a)]+_0x5599d4(0x1c7));}});return _0x23fdaa;},{'verbose':_0x28e3d7[_0x4a7ffe(0x198)]}),_0x4a7b79=_0x17eced['data'],_0x259aa7=_0x4a7b79[_0x4a7ffe(0x1b0)]?_0x4a7ffe(0x1c8)+_0x4a7b79[_0x4a7ffe(0x1b0)]+']':'',_0x3304c6=_0x36cfb7?_0x4a7ffe(0x1ab)+_0x51e4a7+'/'+_0x33cfc6+_0x4a7ffe(0x19f):'';console['error']('✔\x20'+_0x3304c6+_0x4a7ffe(0x1b9)+formatRows(_0x4a7b79[_0x4a7ffe(0x1c5)][_0x4a7ffe(0x1a3)])+'\x20rows\x20'+(_0x4a7ffe(0x1b8)+formatElapsed(_0x4a7b79[_0x4a7ffe(0x1c5)][_0x4a7ffe(0x1b2)])+_0x259aa7));if(_0x36cfb7&&_0x5c5f1f){const _0x42ef97=resolveOutputOptions(_0x6b2e8b),_0xf23bb3=await formatQueryOutput(_0x4a7b79,_0x42ef97);_0x2f3a7d[_0x4a7ffe(0x1a7)](_0xf23bb3);}else await handleQueryOutput(_0x4a7b79,_0x6b2e8b);}catch(_0x598ccf){const _0x511d68=_0x36cfb7?_0x4a7ffe(0x1ab)+_0x51e4a7+'/'+_0x33cfc6+':\x0a':'',_0x827879=_0x598ccf instanceof SDKError?_0x598ccf[_0x4a7ffe(0x1b1)]:_0x598ccf[_0x4a7ffe(0x1a6)];return console[_0x4a7ffe(0x1be)](''+_0x511d68+_0x827879),0x1;}}if(_0x4b8fdc[_0x4a7ffe(0x1b3)]>0x1&&_0x5c5f1f&&_0x2f3a7d['length']>0x0){const _0x3734fd=_0x2f3a7d[_0x4a7ffe(0x1bf)]('\x0a');writeFileSync(_0x28e3d7['output'],_0x3734fd),console[_0x4a7ffe(0x1be)](_0x4a7ffe(0x1a5)+_0x28e3d7[_0x4a7ffe(0x1bd)]);}return 0x0;}catch(_0x30e20e){throw _0x30e20e;}}[a35_0x296dd3(0x1b4)](_0x1f59a1){const _0x4a35a8=a35_0x296dd3,_0x1c1e5d=_0x1f59a1[_0x4a35a8(0x19b)][0x0],_0x1644ae=_0x1f59a1[_0x4a35a8(0x196)][_0x4a35a8(0x19e)];if(!_0x1c1e5d&&!_0x1644ae)return'Usage:\x20tdx\x20query\x20\x22SELECT\x20*\x20FROM\x20table\x22\x0a\x20\x20\x20or:\x20tdx\x20query\x20query.sql\x0a\x20\x20\x20or:\x20echo\x20\x22SELECT\x201\x22\x20|\x20tdx\x20query\x20-\x0a\x0aRun\x20\x27tdx\x20query\x20--help\x27\x20for\x20more\x20options';if(_0x1c1e5d&&_0x1644ae)return _0x4a35a8(0x1a2);return undefined;}}
@@ -1 +1 @@
1
- const a36_0x2b2980=a36_0x2adb;(function(_0x58b59c,_0x4fe204){const _0x3a8377=a36_0x2adb,_0x225de0=_0x58b59c();while(!![]){try{const _0x3fe5b3=-parseInt(_0x3a8377(0x222))/0x1*(parseInt(_0x3a8377(0x1d1))/0x2)+parseInt(_0x3a8377(0x239))/0x3+-parseInt(_0x3a8377(0x1e4))/0x4*(-parseInt(_0x3a8377(0x1e5))/0x5)+-parseInt(_0x3a8377(0x1bd))/0x6+-parseInt(_0x3a8377(0x1d6))/0x7+parseInt(_0x3a8377(0x21a))/0x8+parseInt(_0x3a8377(0x1b9))/0x9*(parseInt(_0x3a8377(0x245))/0xa);if(_0x3fe5b3===_0x4fe204)break;else _0x225de0['push'](_0x225de0['shift']());}catch(_0x2a9a69){_0x225de0['push'](_0x225de0['shift']());}}}(a36_0x2422,0x65a8d));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';function a36_0x2422(){const _0x231205=['created_at','schedules','never','statusIcon','\x20\x20Type:\x20','success','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]','validate','Schedule\x20created:\x20','\x20matching\x20\x22','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20update\x20<name>\x20[options]','292hxZjlD','Schedule\x20run\x20submitted:\x20','yes','error','schedule:run','941969DykWNM','query','soon','round','retryLimit','jobs','listQueries','schedule:create','queryUrl','Searching\x20scheduled\x20queries\x20matching\x20\x22','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20history\x20<name>\x20[--from\x20<n>]\x20[--to\x20<n>]','execute','cyan','ies','140LXNSya','34165IGrMwg','type','num','count','history','engine_version','Getting\x20schedule\x20history...','keys','INVALID_ARGUMENT','time_zone','timezone','queries','options','limit','\x20(use\x20--limit\x20to\x20see\x20more)','tsv','retry_limit','from','update','Deleting\x20schedule...','red','repeat','schedule:delete','last_job','lastRun','map','getTime','has_next_page','dim','...','length','delete','data','📅\x20','Getting\x20schedule\x20details...','Schedule\x20updated:\x20','Running\x20schedule...','Creating\x20schedule...','Show\x20schedule\x20details','Cancelled','priority','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20schedule\x20\x22','Schedule\x20deleted:\x20','d\x20ago','padEnd','\x20job','next_run_at','jsonl','Failed\x20to\x20read\x20file:\x20','\x20\x20Database:\x20','join','\x20\x20Job\x20ID:\x20','Query\x20file\x20is\x20empty','3853208kjXWKN','run','max','format','schedule:show','Update\x20a\x20scheduled\x20query','schedule:list','Updating\x20schedule:\x20','3076yusxfl','\x20scheduled\x20quer','abs','cron','Run\x20a\x20scheduled\x20query\x20immediately','verbose','site','No\x20scheduled\x20queries\x20found','show','time','trim','Updating\x20schedule...','\x20schedules','/app/queries/editor?queryId=','\x20\x20Cron:\x20','engineVersion','scheduled_at','schedule:update','\x20\x20Num:\x20','nextRun','substring','delay','trino','662079xgYayo','entries','args','status','ended_at','database','job_id','Delete\x20a\x20scheduled\x20query','file','toLocaleDateString','\x20created','result','7376020VEYxqH','\x20\x20→\x20','in\x20','\x20execution','output','(unnamed)','Create\x20a\x20scheduled\x20query','9ImevzV','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20run\x20<name>\x20[--time\x20<iso8601>]\x20[--num\x20<1-10>]','log','Running\x20schedule:\x20','4074246yBuoyR','description','name','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20show\x20<name>','Creating\x20schedule:\x20','pagination','Found\x20','just\x20now','updated_at'];a36_0x2422=function(){return _0x231205;};return a36_0x2422();}function a36_0x2adb(_0x4c9429,_0x20a258){_0x4c9429=_0x4c9429-0x1b9;const _0x242288=a36_0x2422();let _0x2adbfb=_0x242288[_0x4c9429];return _0x2adbfb;}import{handleSDKOutput,handleSingleObjectOutput,writeOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import{confirm}from'../utils/prompt.js';import{readFileSync}from'fs';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import{getConsoleUrl}from'../sdk/client/endpoints.js';import{hyperlink}from'../sdk/util/formatters.js';import a36_0x4c2800 from'chalk';function formatRelativeTime(_0x13c54d){const _0x5e7464=a36_0x2adb,_0x441f87=new Date(_0x13c54d),_0x42e3b9=new Date(),_0x57a007=_0x441f87[_0x5e7464(0x1ff)]()-_0x42e3b9[_0x5e7464(0x1ff)](),_0x5b3f82=Math[_0x5e7464(0x224)](_0x57a007)/0x3e8,_0x253790=_0x57a007<0x0;if(_0x5b3f82<0x3c)return _0x253790?_0x5e7464(0x1c4):_0x5e7464(0x1d8);else{if(_0x5b3f82<0xe10){const _0x36c44d=Math['round'](_0x5b3f82/0x3c);return _0x253790?_0x36c44d+'m\x20ago':_0x5e7464(0x247)+_0x36c44d+'m';}else{if(_0x5b3f82<0x15180){const _0x4dfb8a=Math[_0x5e7464(0x1d9)](_0x5b3f82/0xe10);return _0x253790?_0x4dfb8a+'h\x20ago':'in\x20'+_0x4dfb8a+'h';}else{if(_0x5b3f82<0x93a80){const _0x2f8900=Math[_0x5e7464(0x1d9)](_0x5b3f82/0x15180);return _0x253790?_0x2f8900+_0x5e7464(0x210):_0x5e7464(0x247)+_0x2f8900+'d';}else return _0x441f87[_0x5e7464(0x242)]();}}}}export class ScheduleListCommand extends BaseCommand{['name']=a36_0x2b2980(0x220);['description']='List\x20scheduled\x20queries';async[a36_0x2b2980(0x1e1)](_0x4efe23){const _0x5dd2c9=a36_0x2b2980,{options:_0x1fe365,args:_0x16fb39,tdx:_0x393b64}=_0x4efe23,_0x3fa34c=resolveLimit(_0x1fe365[_0x5dd2c9(0x1f2)],DEFAULT_DISPLAY_LIMIT),_0x5be1ca=_0x16fb39[0x0],_0x1ddb21=_0x5be1ca?_0x5dd2c9(0x1df)+_0x5be1ca+'\x22...':'Listing\x20scheduled\x20queries...',_0x11cefa=await withSpinner(_0x1ddb21,()=>_0x393b64['schedules'][_0x5dd2c9(0x1dc)]({'limit':_0x3fa34c,'scheduled':!![],'pattern':_0x5be1ca}),{'verbose':_0x1fe365[_0x5dd2c9(0x227)]}),_0x5d0469=_0x11cefa[_0x5dd2c9(0x205)][_0x5dd2c9(0x1f0)],_0x327ac7=_0x11cefa[_0x5dd2c9(0x205)][_0x5dd2c9(0x1c2)][_0x5dd2c9(0x200)],_0x55d423=_0x5be1ca?_0x5dd2c9(0x1cf)+_0x5be1ca+'\x22':'';_0x327ac7?console[_0x5dd2c9(0x1d4)]('Showing\x20first\x20'+_0x5d0469['length']+_0x5dd2c9(0x22e)+_0x55d423+_0x5dd2c9(0x1f3)):console[_0x5dd2c9(0x1d4)](_0x5dd2c9(0x1c3)+_0x5d0469[_0x5dd2c9(0x203)]+_0x5dd2c9(0x223)+(_0x5d0469['length']!==0x1?_0x5dd2c9(0x1e3):'y')+_0x55d423);if(_0x1fe365['format']==='json'||_0x1fe365[_0x5dd2c9(0x21d)]===_0x5dd2c9(0x214)||_0x1fe365[_0x5dd2c9(0x21d)]==='table'||_0x1fe365[_0x5dd2c9(0x21d)]===_0x5dd2c9(0x1f4)){const _0x1f11b5=_0x5d0469[_0x5dd2c9(0x1fe)](_0x15e88c=>({'id':_0x15e88c['id'],'name':_0x15e88c[_0x5dd2c9(0x1bf)],'cron':_0x15e88c[_0x5dd2c9(0x225)],'database':_0x15e88c['database']?.[_0x5dd2c9(0x1bf)],'type':_0x15e88c[_0x5dd2c9(0x1e6)],'timezone':_0x15e88c[_0x5dd2c9(0x1ee)],'user_name':_0x15e88c['user']?.[_0x5dd2c9(0x1bf)],'updated_at':_0x15e88c[_0x5dd2c9(0x1c5)],'next_run_at':_0x15e88c['next_run_at'],'last_job_status':_0x15e88c[_0x5dd2c9(0x1fc)]?.[_0x5dd2c9(0x23c)]}));await handleSDKOutput(_0x1f11b5,_0x1fe365);}else{if(_0x5d0469[_0x5dd2c9(0x203)]===0x0)console[_0x5dd2c9(0x1bb)](_0x5dd2c9(0x229));else{const _0x318835=_0x1fe365[_0x5dd2c9(0x228)],_0x52a581=_0x5d0469[_0x5dd2c9(0x1fe)](_0x4dedb9=>{const _0xd0fe79=_0x5dd2c9,_0x311fb6=_0x4dedb9[_0xd0fe79(0x1fc)]?.[_0xd0fe79(0x23c)]?_0x4dedb9['last_job']['status']===_0xd0fe79(0x1cb)?'✓':'✗':'-',_0x138097=_0x4dedb9[_0xd0fe79(0x1fc)]?.[_0xd0fe79(0x23d)]?formatRelativeTime(_0x4dedb9[_0xd0fe79(0x1fc)][_0xd0fe79(0x23d)]):_0xd0fe79(0x1c8),_0x40f9e0=_0x4dedb9[_0xd0fe79(0x213)]?formatRelativeTime(_0x4dedb9[_0xd0fe79(0x213)]):'-',_0x67e1b7=_0x4dedb9[_0xd0fe79(0x225)]||'',_0x528a71=_0x4dedb9[_0xd0fe79(0x1bf)]||_0xd0fe79(0x24a),_0x39a6f4=getConsoleUrl(_0x318835,_0xd0fe79(0x22f)+_0x4dedb9['id']);return{'statusIcon':_0x311fb6,'lastRun':_0x138097,'nextRun':_0x40f9e0,'cron':_0x67e1b7,'name':_0x528a71,'queryUrl':_0x39a6f4,'status':_0x4dedb9['last_job']?.[_0xd0fe79(0x23c)]};}),_0xbd88b5=Math[_0x5dd2c9(0x21c)](..._0x52a581['map'](_0x545722=>_0x545722[_0x5dd2c9(0x1fd)]['length'])),_0x1066f7=Math[_0x5dd2c9(0x21c)](..._0x52a581['map'](_0x1e2374=>_0x1e2374[_0x5dd2c9(0x235)][_0x5dd2c9(0x203)])),_0x381065=Math[_0x5dd2c9(0x21c)](..._0x52a581[_0x5dd2c9(0x1fe)](_0xcc3ed=>_0xcc3ed[_0x5dd2c9(0x225)][_0x5dd2c9(0x203)])),_0x54cd20=_0x52a581[_0x5dd2c9(0x1fe)](_0x34b67=>{const _0x44e2f0=_0x5dd2c9,_0x133db5=_0x34b67[_0x44e2f0(0x23c)]===_0x44e2f0(0x1cb)?a36_0x4c2800['green'](_0x34b67['statusIcon']):_0x34b67[_0x44e2f0(0x23c)]===_0x44e2f0(0x1d4)?a36_0x4c2800[_0x44e2f0(0x1f9)](_0x34b67[_0x44e2f0(0x1c9)]):a36_0x4c2800[_0x44e2f0(0x201)](_0x34b67[_0x44e2f0(0x1c9)]),_0x3abda9=_0x34b67[_0x44e2f0(0x1fd)][_0x44e2f0(0x211)](_0xbd88b5),_0x309008=_0x34b67[_0x44e2f0(0x235)][_0x44e2f0(0x211)](_0x1066f7),_0x1f6fb8=_0x34b67[_0x44e2f0(0x225)]?a36_0x4c2800[_0x44e2f0(0x1e2)](_0x34b67[_0x44e2f0(0x225)][_0x44e2f0(0x211)](_0x381065)):'\x20'[_0x44e2f0(0x1fa)](_0x381065),_0x4193d2=hyperlink(_0x34b67[_0x44e2f0(0x1bf)],_0x34b67[_0x44e2f0(0x1de)]);return _0x44e2f0(0x206)+_0x133db5+'\x20'+_0x3abda9+_0x44e2f0(0x246)+_0x309008+'\x20\x20'+_0x1f6fb8+'\x20\x20'+_0x4193d2;});await writeOutput(_0x54cd20[_0x5dd2c9(0x217)]('\x0a'),_0x1fe365[_0x5dd2c9(0x249)],'list');}}return 0x0;}}export class ScheduleShowCommand extends BaseCommand{['name']=a36_0x2b2980(0x21e);['description']=a36_0x2b2980(0x20b);[a36_0x2b2980(0x1cd)](_0x29196c){const _0x429c61=a36_0x2b2980,_0x3bfef1=_0x29196c[_0x429c61(0x23b)][0x0];if(!_0x3bfef1)return _0x429c61(0x1c0);return undefined;}async[a36_0x2b2980(0x1e1)](_0x54c92b){const _0x1cdc95=a36_0x2b2980,{options:_0x2624b4,args:_0x1c6981,tdx:_0x29cc08}=_0x54c92b,_0x230434=_0x1c6981[0x0],_0xe0993=await withSpinner(_0x1cdc95(0x207),()=>_0x29cc08['schedules'][_0x1cdc95(0x22a)](_0x230434),{'verbose':_0x2624b4[_0x1cdc95(0x227)]}),_0x308c85=_0xe0993[_0x1cdc95(0x205)],_0x16013e={'name':_0x308c85[_0x1cdc95(0x1bf)],'cron':_0x308c85[_0x1cdc95(0x225)],'database':_0x308c85[_0x1cdc95(0x23e)],'type':_0x308c85[_0x1cdc95(0x1e6)],'timezone':_0x308c85[_0x1cdc95(0x1ef)],'user_name':_0x308c85['user_name'],'created_at':_0x308c85[_0x1cdc95(0x1c6)],'engine_version':_0x308c85['engine_version'],'executing_user_id':_0x308c85['executing_user_id'],'query':_0x308c85['query'],'delay':_0x308c85[_0x1cdc95(0x237)],'priority':_0x308c85['priority'],'retry_limit':_0x308c85['retry_limit'],..._0x308c85[_0x1cdc95(0x244)]&&{'result':_0x308c85[_0x1cdc95(0x244)]}};return await handleSingleObjectOutput(_0x16013e,_0x2624b4),0x0;}}export class ScheduleCreateCommand extends BaseCommand{[a36_0x2b2980(0x1bf)]=a36_0x2b2980(0x1dd);[a36_0x2b2980(0x1be)]=a36_0x2b2980(0x24b);[a36_0x2b2980(0x1cd)](_0x3b906b){const _0x3f846a=a36_0x2b2980,_0x34fd36=_0x3b906b[_0x3f846a(0x23b)][0x0];if(!_0x34fd36)return _0x3f846a(0x1cc);const _0x358f13=_0x3b906b[_0x3f846a(0x1f1)];if(!_0x358f13[_0x3f846a(0x23e)])return'Database\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]';return undefined;}async['execute'](_0x3f9a79){const _0x47e152=a36_0x2b2980,{options:_0x193e92,args:_0x21c840,tdx:_0x2a6b96}=_0x3f9a79,_0x5b1c4c=_0x21c840[0x0],_0x47b9e0=_0x193e92,_0x51b900=_0x47b9e0[_0x47e152(0x23e)],_0x202d64=_0x47b9e0['file'],_0x146946=_0x47b9e0['type']||_0x47e152(0x238);let _0x10c5fb;try{_0x10c5fb=readFileSync(_0x202d64,'utf-8')[_0x47e152(0x22c)]();}catch(_0x294fb0){throw new SDKError(ErrorCode[_0x47e152(0x1ed)],_0x47e152(0x215)+_0x202d64,_0x294fb0 instanceof Error?_0x294fb0:undefined);}if(!_0x10c5fb)throw new SDKError(ErrorCode[_0x47e152(0x1ed)],_0x47e152(0x219));const _0x43b3dd={'database':_0x51b900,'query':_0x10c5fb,'type':_0x146946};if(_0x47b9e0['cron'])_0x43b3dd[_0x47e152(0x225)]=_0x47b9e0['cron'];if(_0x47b9e0[_0x47e152(0x1ef)])_0x43b3dd[_0x47e152(0x1ef)]=_0x47b9e0['timezone'];if(_0x47b9e0['delay']!==undefined)_0x43b3dd[_0x47e152(0x237)]=Number(_0x47b9e0[_0x47e152(0x237)]);if(_0x47b9e0['priority']!==undefined)_0x43b3dd[_0x47e152(0x20d)]=Number(_0x47b9e0[_0x47e152(0x20d)]);if(_0x47b9e0[_0x47e152(0x1da)]!==undefined)_0x43b3dd['retry_limit']=Number(_0x47b9e0[_0x47e152(0x1da)]);if(_0x47b9e0[_0x47e152(0x231)])_0x43b3dd['engine_version']=_0x47b9e0['engineVersion'];if(_0x47b9e0[_0x47e152(0x244)])_0x43b3dd[_0x47e152(0x244)]=_0x47b9e0[_0x47e152(0x244)];if(_0x193e92['verbose']){console[_0x47e152(0x1d4)](_0x47e152(0x1c1)+_0x5b1c4c),console[_0x47e152(0x1d4)](_0x47e152(0x216)+_0x51b900),console[_0x47e152(0x1d4)](_0x47e152(0x1ca)+_0x146946);if(_0x43b3dd[_0x47e152(0x225)])console[_0x47e152(0x1d4)](_0x47e152(0x230)+_0x43b3dd[_0x47e152(0x225)]);if(_0x43b3dd[_0x47e152(0x1ef)])console[_0x47e152(0x1d4)]('\x20\x20Timezone:\x20'+_0x43b3dd[_0x47e152(0x1ef)]);}const _0x1d613c=await withSpinner(_0x47e152(0x20a),()=>_0x2a6b96[_0x47e152(0x1c7)]['create'](_0x5b1c4c,_0x43b3dd),{'verbose':_0x193e92[_0x47e152(0x227)]});return console['error'](_0x47e152(0x1ce)+_0x1d613c[_0x47e152(0x205)]['name']),await handleSingleObjectOutput(_0x1d613c['data'],_0x193e92),0x0;}}export class ScheduleUpdateCommand extends BaseCommand{['name']=a36_0x2b2980(0x233);[a36_0x2b2980(0x1be)]=a36_0x2b2980(0x21f);[a36_0x2b2980(0x1cd)](_0x3194d6){const _0x593b8b=a36_0x2b2980,_0x2a04cf=_0x3194d6[_0x593b8b(0x23b)][0x0];if(!_0x2a04cf)return _0x593b8b(0x1d0);return undefined;}async[a36_0x2b2980(0x1e1)](_0x17e085){const _0x7c839b=a36_0x2b2980,{options:_0x408342,args:_0x172d81,tdx:_0x48f356}=_0x17e085,_0x54f1a5=_0x172d81[0x0],_0x15991e=_0x408342,_0x399d43={};if(_0x15991e[_0x7c839b(0x23e)])_0x399d43[_0x7c839b(0x23e)]=_0x15991e[_0x7c839b(0x23e)];if(_0x15991e['type'])_0x399d43[_0x7c839b(0x1e6)]=_0x15991e[_0x7c839b(0x1e6)];if(_0x15991e[_0x7c839b(0x225)])_0x399d43[_0x7c839b(0x225)]=_0x15991e['cron'];if(_0x15991e['timezone'])_0x399d43[_0x7c839b(0x1ef)]=_0x15991e['timezone'];if(_0x15991e[_0x7c839b(0x237)]!==undefined)_0x399d43['delay']=Number(_0x15991e[_0x7c839b(0x237)]);if(_0x15991e[_0x7c839b(0x20d)]!==undefined)_0x399d43[_0x7c839b(0x20d)]=Number(_0x15991e['priority']);if(_0x15991e[_0x7c839b(0x1da)]!==undefined)_0x399d43[_0x7c839b(0x1f5)]=Number(_0x15991e['retryLimit']);if(_0x15991e[_0x7c839b(0x231)])_0x399d43[_0x7c839b(0x1ea)]=_0x15991e[_0x7c839b(0x231)];if(_0x15991e[_0x7c839b(0x244)])_0x399d43['result']=_0x15991e[_0x7c839b(0x244)];if(_0x15991e[_0x7c839b(0x241)])try{_0x399d43[_0x7c839b(0x1d7)]=readFileSync(_0x15991e['file'],'utf-8')['trim']();}catch(_0x5c1254){throw new SDKError(ErrorCode[_0x7c839b(0x1ed)],_0x7c839b(0x215)+_0x15991e[_0x7c839b(0x241)],_0x5c1254 instanceof Error?_0x5c1254:undefined);}if(Object[_0x7c839b(0x1ec)](_0x399d43)['length']===0x0)throw new SDKError(ErrorCode['INVALID_ARGUMENT'],'At\x20least\x20one\x20option\x20must\x20be\x20provided\x20to\x20update');if(_0x408342[_0x7c839b(0x227)]){console[_0x7c839b(0x1d4)](_0x7c839b(0x221)+_0x54f1a5);for(const [_0x28e592,_0x3c8a50]of Object[_0x7c839b(0x23a)](_0x399d43)){_0x28e592===_0x7c839b(0x1d7)?console[_0x7c839b(0x1d4)]('\x20\x20'+_0x28e592+':\x20'+_0x3c8a50[_0x7c839b(0x236)](0x0,0x32)+_0x7c839b(0x202)):console['error']('\x20\x20'+_0x28e592+':\x20'+_0x3c8a50);}}const _0x5a85b2=await withSpinner(_0x7c839b(0x22d),()=>_0x48f356[_0x7c839b(0x1c7)][_0x7c839b(0x1f7)](_0x54f1a5,_0x399d43),{'verbose':_0x408342[_0x7c839b(0x227)]});return console[_0x7c839b(0x1d4)](_0x7c839b(0x208)+_0x5a85b2[_0x7c839b(0x205)][_0x7c839b(0x1bf)]),await handleSingleObjectOutput(_0x5a85b2[_0x7c839b(0x205)],_0x408342),0x0;}}export class ScheduleDeleteCommand extends BaseCommand{[a36_0x2b2980(0x1bf)]=a36_0x2b2980(0x1fb);[a36_0x2b2980(0x1be)]=a36_0x2b2980(0x240);['validate'](_0x4933ed){const _0x401b08=a36_0x2b2980,_0x53a7b1=_0x4933ed[_0x401b08(0x23b)][0x0];if(!_0x53a7b1)return'Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20delete\x20<name>';return undefined;}async[a36_0x2b2980(0x1e1)](_0x2b2ac5){const _0x413941=a36_0x2b2980,{options:_0x127d3f,args:_0x1d2834,tdx:_0x5a789b}=_0x2b2ac5,_0x206f63=_0x1d2834[0x0];if(!_0x127d3f[_0x413941(0x1d3)]){const _0x3814d9=await confirm(_0x413941(0x20e)+_0x206f63+'\x22?');if(!_0x3814d9)return console[_0x413941(0x1d4)](_0x413941(0x20c)),0x0;}const _0x58beb3=await withSpinner(_0x413941(0x1f8),()=>_0x5a789b[_0x413941(0x1c7)][_0x413941(0x204)](_0x206f63),{'verbose':_0x127d3f[_0x413941(0x227)]});return console[_0x413941(0x1d4)](_0x413941(0x20f)+_0x58beb3['data'][_0x413941(0x1bf)]),0x0;}}export class ScheduleRunCommand extends BaseCommand{[a36_0x2b2980(0x1bf)]=a36_0x2b2980(0x1d5);[a36_0x2b2980(0x1be)]=a36_0x2b2980(0x226);['validate'](_0x4dbfd2){const _0x3157db=a36_0x2b2980,_0x1da175=_0x4dbfd2['args'][0x0];if(!_0x1da175)return _0x3157db(0x1ba);return undefined;}async[a36_0x2b2980(0x1e1)](_0x40501d){const _0x3d0133=a36_0x2b2980,{options:_0x26be5f,args:_0x41261f,tdx:_0x3f0428}=_0x40501d,_0x49a4d4=_0x41261f[0x0],_0x5474e7=_0x26be5f,_0x311601=_0x5474e7[_0x3d0133(0x22b)],_0x5f0533=_0x5474e7['num']!==undefined?Number(_0x5474e7[_0x3d0133(0x1e7)]):undefined;if(_0x26be5f[_0x3d0133(0x227)]){console[_0x3d0133(0x1d4)](_0x3d0133(0x1bc)+_0x49a4d4);if(_0x311601)console[_0x3d0133(0x1d4)]('\x20\x20Time:\x20'+_0x311601);if(_0x5f0533)console['error'](_0x3d0133(0x234)+_0x5f0533);}const _0x472bda=await withSpinner(_0x3d0133(0x209),()=>_0x3f0428[_0x3d0133(0x1c7)][_0x3d0133(0x21b)](_0x49a4d4,{'time':_0x311601,'num':_0x5f0533}),{'verbose':_0x26be5f[_0x3d0133(0x227)]}),_0x177888=_0x472bda[_0x3d0133(0x205)][_0x3d0133(0x1db)];console[_0x3d0133(0x1d4)](_0x3d0133(0x1d2)+_0x177888['length']+_0x3d0133(0x212)+(_0x177888[_0x3d0133(0x203)]!==0x1?'s':'')+_0x3d0133(0x243));for(const _0x1f08e2 of _0x177888){console['error'](_0x3d0133(0x218)+_0x1f08e2['job_id']);}return await handleSDKOutput(_0x177888,_0x26be5f),0x0;}}export class ScheduleHistoryCommand extends BaseCommand{[a36_0x2b2980(0x1bf)]='schedule:history';[a36_0x2b2980(0x1be)]='Show\x20schedule\x20execution\x20history';['validate'](_0x5316f0){const _0xf06ae2=a36_0x2b2980,_0x5541d8=_0x5316f0[_0xf06ae2(0x23b)][0x0];if(!_0x5541d8)return _0xf06ae2(0x1e0);return undefined;}async[a36_0x2b2980(0x1e1)](_0x324da0){const _0x802250=a36_0x2b2980,{options:_0x53698b,args:_0x3dbd27,tdx:_0x5e822d}=_0x324da0,_0x434856=_0x3dbd27[0x0],_0x402681=_0x53698b,_0x4e6e73=_0x402681[_0x802250(0x1f6)]!==undefined?Number(_0x402681[_0x802250(0x1f6)]):undefined,_0x5c0d76=_0x402681['to']!==undefined?Number(_0x402681['to']):undefined,_0x5ef5b9=await withSpinner(_0x802250(0x1eb),()=>_0x5e822d[_0x802250(0x1c7)][_0x802250(0x1e9)](_0x434856,{'from':_0x4e6e73,'to':_0x5c0d76}),{'verbose':_0x53698b[_0x802250(0x227)]}),_0x780d7b=_0x5ef5b9[_0x802250(0x205)];console[_0x802250(0x1d4)](_0x802250(0x1c3)+_0x780d7b[_0x802250(0x1e8)]+_0x802250(0x248)+(_0x780d7b['count']!==0x1?'s':'')+'\x20(showing\x20'+_0x780d7b['from']+'-'+_0x780d7b['to']+')');const _0x1d3872=_0x780d7b['history']['map'](_0x4a0c8c=>({'job_id':_0x4a0c8c[_0x802250(0x23f)],'type':_0x4a0c8c[_0x802250(0x1e6)],'status':_0x4a0c8c['status'],'scheduled_at':_0x4a0c8c[_0x802250(0x232)],'created_at':_0x4a0c8c[_0x802250(0x1c6)],'start_at':_0x4a0c8c['start_at'],'end_at':_0x4a0c8c['end_at']}));return await handleSDKOutput(_0x1d3872,_0x53698b),0x0;}}
1
+ const a36_0x5069d6=a36_0x3d08;(function(_0x152e16,_0x531b3a){const _0x5f430c=a36_0x3d08,_0x4c19b2=_0x152e16();while(!![]){try{const _0x57409c=parseInt(_0x5f430c(0x1c6))/0x1*(-parseInt(_0x5f430c(0x1f0))/0x2)+parseInt(_0x5f430c(0x1ae))/0x3*(-parseInt(_0x5f430c(0x1d8))/0x4)+parseInt(_0x5f430c(0x1e8))/0x5*(parseInt(_0x5f430c(0x1bf))/0x6)+parseInt(_0x5f430c(0x1e9))/0x7*(parseInt(_0x5f430c(0x1f6))/0x8)+parseInt(_0x5f430c(0x241))/0x9+parseInt(_0x5f430c(0x218))/0xa*(parseInt(_0x5f430c(0x213))/0xb)+-parseInt(_0x5f430c(0x1c8))/0xc;if(_0x57409c===_0x531b3a)break;else _0x4c19b2['push'](_0x4c19b2['shift']());}catch(_0x17fa05){_0x4c19b2['push'](_0x4c19b2['shift']());}}}(a36_0xbc4b,0xaaebf));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';function a36_0xbc4b(){const _0x25c1da=['\x20(showing\x20','10fSnLzZ','validate','red','No\x20scheduled\x20queries\x20found','listQueries','count','queryUrl','execute','scheduled_at','created_at','jobs','m\x20ago','status','lastRun','substring','Create\x20a\x20scheduled\x20query','schedule:run','description','priority','delete','dim','ended_at','Update\x20a\x20scheduled\x20query','round','user','Schedule\x20deleted:\x20','from','Delete\x20a\x20scheduled\x20query','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]','schedules','length','timezone','Query\x20file\x20is\x20empty','never','retryLimit','in\x20','json','cron','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20schedule\x20\x22','next_run_at','green','12233466QmzpaZ','\x20\x20Database:\x20','Show\x20schedule\x20execution\x20history','success','3KyUidr','delay','list','padEnd','output','keys','data','pagination','trino','history','schedule:show','cyan','trim','Running\x20schedule:\x20','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20show\x20<name>','time_zone','run','352602gNofOF','Cancelled','name','Failed\x20to\x20read\x20file:\x20','\x20\x20Cron:\x20','getTime','update','5nXYBUv','\x20\x20Timezone:\x20','32824020cTRHln','show','(unnamed)','\x20created','Searching\x20scheduled\x20queries\x20matching\x20\x22','Showing\x20first\x20','schedule:delete','nextRun','\x20matching\x20\x22','At\x20least\x20one\x20option\x20must\x20be\x20provided\x20to\x20update','end_at','database','Creating\x20schedule...','\x20\x20→\x20','d\x20ago','max','507540nFAAfF','Getting\x20schedule\x20history...','error','last_job','log','engine_version','schedule:create','engineVersion','Found\x20','limit','retry_limit','\x20\x20Num:\x20','Running\x20schedule...','join','\x20schedules','Deleting\x20schedule...','85sHIaux','7LIwxQG','updated_at','Schedule\x20updated:\x20','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20run\x20<name>\x20[--time\x20<iso8601>]\x20[--num\x20<1-10>]','user_name','type','query','8258SEjdbm','format','Run\x20a\x20scheduled\x20query\x20immediately','schedule:list','just\x20now','Schedule\x20created:\x20','1708448ftBiYr','\x20(use\x20--limit\x20to\x20see\x20more)','result','INVALID_ARGUMENT','soon','queries','Show\x20schedule\x20details','Getting\x20schedule\x20details...','args','toLocaleDateString','Schedule\x20run\x20submitted:\x20','entries','/app/queries/editor?queryId=','\x20\x20Type:\x20','ies','options','statusIcon','has_next_page','\x20\x20Time:\x20','tsv','file','yes','start_at','verbose','repeat','num','jsonl','table','\x20\x20Job\x20ID:\x20','11122001dfEpcc','Updating\x20schedule:\x20','\x20execution','map'];a36_0xbc4b=function(){return _0x25c1da;};return a36_0xbc4b();}import{confirm}from'../utils/prompt.js';function a36_0x3d08(_0xfb60fa,_0x301ea3){_0xfb60fa=_0xfb60fa-0x1ae;const _0xbc4bac=a36_0xbc4b();let _0x3d08a0=_0xbc4bac[_0xfb60fa];return _0x3d08a0;}import{readFileSync}from'fs';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import{getConsoleUrl}from'../sdk/client/endpoints.js';import{hyperlink}from'../sdk/util/formatters.js';import a36_0x540575 from'chalk';function formatRelativeTime(_0x46f502){const _0x44f6eb=a36_0x3d08,_0x3354e9=new Date(_0x46f502),_0x55a919=new Date(),_0x2eb46b=_0x3354e9[_0x44f6eb(0x1c4)]()-_0x55a919['getTime'](),_0x188a77=Math['abs'](_0x2eb46b)/0x3e8,_0x9a7fcf=_0x2eb46b<0x0;if(_0x188a77<0x3c)return _0x9a7fcf?_0x44f6eb(0x1f4):_0x44f6eb(0x1fa);else{if(_0x188a77<0xe10){const _0x4e26cc=Math['round'](_0x188a77/0x3c);return _0x9a7fcf?_0x4e26cc+_0x44f6eb(0x223):'in\x20'+_0x4e26cc+'m';}else{if(_0x188a77<0x15180){const _0x57b6b1=Math[_0x44f6eb(0x22f)](_0x188a77/0xe10);return _0x9a7fcf?_0x57b6b1+'h\x20ago':_0x44f6eb(0x23b)+_0x57b6b1+'h';}else{if(_0x188a77<0x93a80){const _0x53f6c1=Math[_0x44f6eb(0x22f)](_0x188a77/0x15180);return _0x9a7fcf?_0x53f6c1+_0x44f6eb(0x1d6):_0x44f6eb(0x23b)+_0x53f6c1+'d';}else return _0x3354e9[_0x44f6eb(0x1ff)]();}}}}export class ScheduleListCommand extends BaseCommand{['name']=a36_0x5069d6(0x1f3);['description']='List\x20scheduled\x20queries';async['execute'](_0x27e478){const _0x22ab88=a36_0x5069d6,{options:_0x235ae5,args:_0x5b5ea7,tdx:_0x1bb376}=_0x27e478,_0x32f172=resolveLimit(_0x235ae5[_0x22ab88(0x1e1)],DEFAULT_DISPLAY_LIMIT),_0x4965a9=_0x5b5ea7[0x0],_0x2aedbe=_0x4965a9?_0x22ab88(0x1cc)+_0x4965a9+'\x22...':'Listing\x20scheduled\x20queries...',_0x1dd4ec=await withSpinner(_0x2aedbe,()=>_0x1bb376[_0x22ab88(0x235)][_0x22ab88(0x21c)]({'limit':_0x32f172,'scheduled':!![],'pattern':_0x4965a9}),{'verbose':_0x235ae5[_0x22ab88(0x20d)]}),_0x5a8939=_0x1dd4ec['data'][_0x22ab88(0x1fb)],_0x120579=_0x1dd4ec[_0x22ab88(0x1b4)][_0x22ab88(0x1b5)][_0x22ab88(0x207)],_0x133a13=_0x4965a9?_0x22ab88(0x1d0)+_0x4965a9+'\x22':'';_0x120579?console['error'](_0x22ab88(0x1cd)+_0x5a8939['length']+_0x22ab88(0x1e6)+_0x133a13+_0x22ab88(0x1f7)):console[_0x22ab88(0x1da)](_0x22ab88(0x1e0)+_0x5a8939[_0x22ab88(0x236)]+'\x20scheduled\x20quer'+(_0x5a8939[_0x22ab88(0x236)]!==0x1?_0x22ab88(0x204):'y')+_0x133a13);if(_0x235ae5[_0x22ab88(0x1f1)]===_0x22ab88(0x23c)||_0x235ae5[_0x22ab88(0x1f1)]===_0x22ab88(0x210)||_0x235ae5[_0x22ab88(0x1f1)]===_0x22ab88(0x211)||_0x235ae5['format']===_0x22ab88(0x209)){const _0x409fd5=_0x5a8939['map'](_0x29576b=>({'id':_0x29576b['id'],'name':_0x29576b['name'],'cron':_0x29576b['cron'],'database':_0x29576b[_0x22ab88(0x1d3)]?.[_0x22ab88(0x1c1)],'type':_0x29576b['type'],'timezone':_0x29576b[_0x22ab88(0x1bd)],'user_name':_0x29576b[_0x22ab88(0x230)]?.[_0x22ab88(0x1c1)],'updated_at':_0x29576b[_0x22ab88(0x1ea)],'next_run_at':_0x29576b[_0x22ab88(0x23f)],'last_job_status':_0x29576b[_0x22ab88(0x1db)]?.[_0x22ab88(0x224)]}));await handleSDKOutput(_0x409fd5,_0x235ae5);}else{if(_0x5a8939[_0x22ab88(0x236)]===0x0)console[_0x22ab88(0x1dc)](_0x22ab88(0x21b));else{const _0x39c1b3=_0x235ae5['site'],_0x462734=_0x5a8939[_0x22ab88(0x216)](_0x4b785f=>{const _0x561080=_0x22ab88,_0x62de67=_0x4b785f[_0x561080(0x1db)]?.['status']?_0x4b785f['last_job'][_0x561080(0x224)]==='success'?'✓':'✗':'-',_0x5a17a1=_0x4b785f[_0x561080(0x1db)]?.[_0x561080(0x22d)]?formatRelativeTime(_0x4b785f[_0x561080(0x1db)][_0x561080(0x22d)]):_0x561080(0x239),_0x2676e0=_0x4b785f[_0x561080(0x23f)]?formatRelativeTime(_0x4b785f[_0x561080(0x23f)]):'-',_0xf51ae4=_0x4b785f[_0x561080(0x23d)]||'',_0xf280fe=_0x4b785f[_0x561080(0x1c1)]||_0x561080(0x1ca),_0x2dd8e4=getConsoleUrl(_0x39c1b3,_0x561080(0x202)+_0x4b785f['id']);return{'statusIcon':_0x62de67,'lastRun':_0x5a17a1,'nextRun':_0x2676e0,'cron':_0xf51ae4,'name':_0xf280fe,'queryUrl':_0x2dd8e4,'status':_0x4b785f[_0x561080(0x1db)]?.[_0x561080(0x224)]};}),_0x2b1bca=Math[_0x22ab88(0x1d7)](..._0x462734[_0x22ab88(0x216)](_0x20134f=>_0x20134f[_0x22ab88(0x225)][_0x22ab88(0x236)])),_0x1ccf5a=Math['max'](..._0x462734['map'](_0xfa65be=>_0xfa65be[_0x22ab88(0x1cf)]['length'])),_0x350fc6=Math[_0x22ab88(0x1d7)](..._0x462734[_0x22ab88(0x216)](_0x2287f9=>_0x2287f9[_0x22ab88(0x23d)][_0x22ab88(0x236)])),_0x3b80d4=_0x462734['map'](_0x30cf79=>{const _0x249503=_0x22ab88,_0x3b5e6c=_0x30cf79[_0x249503(0x224)]===_0x249503(0x244)?a36_0x540575[_0x249503(0x240)](_0x30cf79[_0x249503(0x206)]):_0x30cf79[_0x249503(0x224)]==='error'?a36_0x540575[_0x249503(0x21a)](_0x30cf79[_0x249503(0x206)]):a36_0x540575[_0x249503(0x22c)](_0x30cf79[_0x249503(0x206)]),_0x3d21c3=_0x30cf79[_0x249503(0x225)][_0x249503(0x1b1)](_0x2b1bca),_0x4a9b0e=_0x30cf79[_0x249503(0x1cf)]['padEnd'](_0x1ccf5a),_0x29f9a1=_0x30cf79[_0x249503(0x23d)]?a36_0x540575[_0x249503(0x1b9)](_0x30cf79[_0x249503(0x23d)][_0x249503(0x1b1)](_0x350fc6)):'\x20'[_0x249503(0x20e)](_0x350fc6),_0x383430=hyperlink(_0x30cf79[_0x249503(0x1c1)],_0x30cf79[_0x249503(0x21e)]);return'📅\x20'+_0x3b5e6c+'\x20'+_0x3d21c3+_0x249503(0x1d5)+_0x4a9b0e+'\x20\x20'+_0x29f9a1+'\x20\x20'+_0x383430;});await writeOutput(_0x3b80d4[_0x22ab88(0x1e5)]('\x0a'),_0x235ae5[_0x22ab88(0x1b2)],_0x22ab88(0x1b0));}}return 0x0;}}export class ScheduleShowCommand extends BaseCommand{[a36_0x5069d6(0x1c1)]=a36_0x5069d6(0x1b8);[a36_0x5069d6(0x229)]=a36_0x5069d6(0x1fc);[a36_0x5069d6(0x219)](_0x466167){const _0x4da909=a36_0x5069d6,_0x6aa3c6=_0x466167[_0x4da909(0x1fe)][0x0];if(!_0x6aa3c6)return _0x4da909(0x1bc);return undefined;}async['execute'](_0x491148){const _0x4d04f6=a36_0x5069d6,{options:_0x4105ad,args:_0x16061c,tdx:_0x4e1b61}=_0x491148,_0x183d33=_0x16061c[0x0],_0x4b03e2=await withSpinner(_0x4d04f6(0x1fd),()=>_0x4e1b61[_0x4d04f6(0x235)][_0x4d04f6(0x1c9)](_0x183d33),{'verbose':_0x4105ad[_0x4d04f6(0x20d)]}),_0x17ddb3=_0x4b03e2[_0x4d04f6(0x1b4)],_0x2c31fa={'name':_0x17ddb3[_0x4d04f6(0x1c1)],'cron':_0x17ddb3[_0x4d04f6(0x23d)],'database':_0x17ddb3[_0x4d04f6(0x1d3)],'type':_0x17ddb3[_0x4d04f6(0x1ee)],'timezone':_0x17ddb3[_0x4d04f6(0x237)],'user_name':_0x17ddb3[_0x4d04f6(0x1ed)],'created_at':_0x17ddb3['created_at'],'engine_version':_0x17ddb3[_0x4d04f6(0x1dd)],'executing_user_id':_0x17ddb3['executing_user_id'],'query':_0x17ddb3['query'],'delay':_0x17ddb3[_0x4d04f6(0x1af)],'priority':_0x17ddb3['priority'],'retry_limit':_0x17ddb3[_0x4d04f6(0x1e2)],..._0x17ddb3[_0x4d04f6(0x1f8)]&&{'result':_0x17ddb3[_0x4d04f6(0x1f8)]}};return await handleSingleObjectOutput(_0x2c31fa,_0x4105ad),0x0;}}export class ScheduleCreateCommand extends BaseCommand{['name']=a36_0x5069d6(0x1de);[a36_0x5069d6(0x229)]=a36_0x5069d6(0x227);[a36_0x5069d6(0x219)](_0x5de18e){const _0x29d18e=a36_0x5069d6,_0x32ecc9=_0x5de18e[_0x29d18e(0x1fe)][0x0];if(!_0x32ecc9)return _0x29d18e(0x234);const _0x4bb7e3=_0x5de18e[_0x29d18e(0x205)];if(!_0x4bb7e3[_0x29d18e(0x1d3)])return'Database\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]';return undefined;}async[a36_0x5069d6(0x21f)](_0x595c03){const _0x34824d=a36_0x5069d6,{options:_0x51e841,args:_0x45aef9,tdx:_0x2762af}=_0x595c03,_0x33134e=_0x45aef9[0x0],_0x30a5c7=_0x51e841,_0x39382c=_0x30a5c7[_0x34824d(0x1d3)],_0x82057e=_0x30a5c7['file'],_0x1e2651=_0x30a5c7[_0x34824d(0x1ee)]||_0x34824d(0x1b6);let _0x269927;try{_0x269927=readFileSync(_0x82057e,'utf-8')[_0x34824d(0x1ba)]();}catch(_0x4e5720){throw new SDKError(ErrorCode[_0x34824d(0x1f9)],_0x34824d(0x1c2)+_0x82057e,_0x4e5720 instanceof Error?_0x4e5720:undefined);}if(!_0x269927)throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x34824d(0x238));const _0x4904f2={'database':_0x39382c,'query':_0x269927,'type':_0x1e2651};if(_0x30a5c7[_0x34824d(0x23d)])_0x4904f2[_0x34824d(0x23d)]=_0x30a5c7['cron'];if(_0x30a5c7[_0x34824d(0x237)])_0x4904f2[_0x34824d(0x237)]=_0x30a5c7[_0x34824d(0x237)];if(_0x30a5c7[_0x34824d(0x1af)]!==undefined)_0x4904f2[_0x34824d(0x1af)]=Number(_0x30a5c7[_0x34824d(0x1af)]);if(_0x30a5c7[_0x34824d(0x22a)]!==undefined)_0x4904f2[_0x34824d(0x22a)]=Number(_0x30a5c7[_0x34824d(0x22a)]);if(_0x30a5c7[_0x34824d(0x23a)]!==undefined)_0x4904f2[_0x34824d(0x1e2)]=Number(_0x30a5c7['retryLimit']);if(_0x30a5c7[_0x34824d(0x1df)])_0x4904f2[_0x34824d(0x1dd)]=_0x30a5c7[_0x34824d(0x1df)];if(_0x30a5c7[_0x34824d(0x1f8)])_0x4904f2[_0x34824d(0x1f8)]=_0x30a5c7['result'];if(_0x51e841[_0x34824d(0x20d)]){console[_0x34824d(0x1da)]('Creating\x20schedule:\x20'+_0x33134e),console[_0x34824d(0x1da)](_0x34824d(0x242)+_0x39382c),console[_0x34824d(0x1da)](_0x34824d(0x203)+_0x1e2651);if(_0x4904f2[_0x34824d(0x23d)])console[_0x34824d(0x1da)](_0x34824d(0x1c3)+_0x4904f2['cron']);if(_0x4904f2[_0x34824d(0x237)])console[_0x34824d(0x1da)](_0x34824d(0x1c7)+_0x4904f2['timezone']);}const _0x348b35=await withSpinner(_0x34824d(0x1d4),()=>_0x2762af[_0x34824d(0x235)]['create'](_0x33134e,_0x4904f2),{'verbose':_0x51e841['verbose']});return console[_0x34824d(0x1da)](_0x34824d(0x1f5)+_0x348b35[_0x34824d(0x1b4)][_0x34824d(0x1c1)]),await handleSingleObjectOutput(_0x348b35[_0x34824d(0x1b4)],_0x51e841),0x0;}}export class ScheduleUpdateCommand extends BaseCommand{['name']='schedule:update';[a36_0x5069d6(0x229)]=a36_0x5069d6(0x22e);['validate'](_0x237596){const _0x3c3333=a36_0x5069d6,_0x5553bc=_0x237596[_0x3c3333(0x1fe)][0x0];if(!_0x5553bc)return'Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20update\x20<name>\x20[options]';return undefined;}async[a36_0x5069d6(0x21f)](_0x5e4886){const _0x19cb7f=a36_0x5069d6,{options:_0x1eef04,args:_0x3b3125,tdx:_0x11d011}=_0x5e4886,_0xe48fdf=_0x3b3125[0x0],_0x269b2f=_0x1eef04,_0x2efaf7={};if(_0x269b2f[_0x19cb7f(0x1d3)])_0x2efaf7['database']=_0x269b2f['database'];if(_0x269b2f[_0x19cb7f(0x1ee)])_0x2efaf7[_0x19cb7f(0x1ee)]=_0x269b2f[_0x19cb7f(0x1ee)];if(_0x269b2f[_0x19cb7f(0x23d)])_0x2efaf7[_0x19cb7f(0x23d)]=_0x269b2f[_0x19cb7f(0x23d)];if(_0x269b2f[_0x19cb7f(0x237)])_0x2efaf7[_0x19cb7f(0x237)]=_0x269b2f[_0x19cb7f(0x237)];if(_0x269b2f[_0x19cb7f(0x1af)]!==undefined)_0x2efaf7[_0x19cb7f(0x1af)]=Number(_0x269b2f[_0x19cb7f(0x1af)]);if(_0x269b2f[_0x19cb7f(0x22a)]!==undefined)_0x2efaf7[_0x19cb7f(0x22a)]=Number(_0x269b2f[_0x19cb7f(0x22a)]);if(_0x269b2f[_0x19cb7f(0x23a)]!==undefined)_0x2efaf7['retry_limit']=Number(_0x269b2f[_0x19cb7f(0x23a)]);if(_0x269b2f[_0x19cb7f(0x1df)])_0x2efaf7['engine_version']=_0x269b2f[_0x19cb7f(0x1df)];if(_0x269b2f[_0x19cb7f(0x1f8)])_0x2efaf7['result']=_0x269b2f[_0x19cb7f(0x1f8)];if(_0x269b2f[_0x19cb7f(0x20a)])try{_0x2efaf7[_0x19cb7f(0x1ef)]=readFileSync(_0x269b2f[_0x19cb7f(0x20a)],'utf-8')[_0x19cb7f(0x1ba)]();}catch(_0x5394d7){throw new SDKError(ErrorCode[_0x19cb7f(0x1f9)],_0x19cb7f(0x1c2)+_0x269b2f[_0x19cb7f(0x20a)],_0x5394d7 instanceof Error?_0x5394d7:undefined);}if(Object[_0x19cb7f(0x1b3)](_0x2efaf7)[_0x19cb7f(0x236)]===0x0)throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x19cb7f(0x1d1));if(_0x1eef04[_0x19cb7f(0x20d)]){console['error'](_0x19cb7f(0x214)+_0xe48fdf);for(const [_0x2b6669,_0x5cac8d]of Object[_0x19cb7f(0x201)](_0x2efaf7)){_0x2b6669===_0x19cb7f(0x1ef)?console['error']('\x20\x20'+_0x2b6669+':\x20'+_0x5cac8d[_0x19cb7f(0x226)](0x0,0x32)+'...'):console['error']('\x20\x20'+_0x2b6669+':\x20'+_0x5cac8d);}}const _0x62d224=await withSpinner('Updating\x20schedule...',()=>_0x11d011['schedules'][_0x19cb7f(0x1c5)](_0xe48fdf,_0x2efaf7),{'verbose':_0x1eef04['verbose']});return console['error'](_0x19cb7f(0x1eb)+_0x62d224[_0x19cb7f(0x1b4)]['name']),await handleSingleObjectOutput(_0x62d224['data'],_0x1eef04),0x0;}}export class ScheduleDeleteCommand extends BaseCommand{[a36_0x5069d6(0x1c1)]=a36_0x5069d6(0x1ce);[a36_0x5069d6(0x229)]=a36_0x5069d6(0x233);['validate'](_0x2f7dad){const _0x3c4c9f=_0x2f7dad['args'][0x0];if(!_0x3c4c9f)return'Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20delete\x20<name>';return undefined;}async['execute'](_0x4ff2dc){const _0x208a90=a36_0x5069d6,{options:_0x80d5e1,args:_0x3e517f,tdx:_0xce05f4}=_0x4ff2dc,_0x1718d3=_0x3e517f[0x0];if(!_0x80d5e1[_0x208a90(0x20b)]){const _0x296e9d=await confirm(_0x208a90(0x23e)+_0x1718d3+'\x22?');if(!_0x296e9d)return console['error'](_0x208a90(0x1c0)),0x0;}const _0x30d629=await withSpinner(_0x208a90(0x1e7),()=>_0xce05f4[_0x208a90(0x235)][_0x208a90(0x22b)](_0x1718d3),{'verbose':_0x80d5e1[_0x208a90(0x20d)]});return console['error'](_0x208a90(0x231)+_0x30d629[_0x208a90(0x1b4)]['name']),0x0;}}export class ScheduleRunCommand extends BaseCommand{[a36_0x5069d6(0x1c1)]=a36_0x5069d6(0x228);['description']=a36_0x5069d6(0x1f2);[a36_0x5069d6(0x219)](_0x39d132){const _0x5ddf75=a36_0x5069d6,_0x18ac96=_0x39d132[_0x5ddf75(0x1fe)][0x0];if(!_0x18ac96)return _0x5ddf75(0x1ec);return undefined;}async['execute'](_0x1a933b){const _0x45bd17=a36_0x5069d6,{options:_0x1e95a2,args:_0x32580d,tdx:_0x2e6f3b}=_0x1a933b,_0x1f817b=_0x32580d[0x0],_0x55071a=_0x1e95a2,_0x2cb4ba=_0x55071a['time'],_0x243aac=_0x55071a['num']!==undefined?Number(_0x55071a[_0x45bd17(0x20f)]):undefined;if(_0x1e95a2[_0x45bd17(0x20d)]){console[_0x45bd17(0x1da)](_0x45bd17(0x1bb)+_0x1f817b);if(_0x2cb4ba)console['error'](_0x45bd17(0x208)+_0x2cb4ba);if(_0x243aac)console[_0x45bd17(0x1da)](_0x45bd17(0x1e3)+_0x243aac);}const _0xb01f10=await withSpinner(_0x45bd17(0x1e4),()=>_0x2e6f3b[_0x45bd17(0x235)][_0x45bd17(0x1be)](_0x1f817b,{'time':_0x2cb4ba,'num':_0x243aac}),{'verbose':_0x1e95a2['verbose']}),_0x59f3bc=_0xb01f10[_0x45bd17(0x1b4)][_0x45bd17(0x222)];console['error'](_0x45bd17(0x200)+_0x59f3bc[_0x45bd17(0x236)]+'\x20job'+(_0x59f3bc[_0x45bd17(0x236)]!==0x1?'s':'')+_0x45bd17(0x1cb));for(const _0xf73d53 of _0x59f3bc){console[_0x45bd17(0x1da)](_0x45bd17(0x212)+_0xf73d53['job_id']);}return await handleSDKOutput(_0x59f3bc,_0x1e95a2),0x0;}}export class ScheduleHistoryCommand extends BaseCommand{[a36_0x5069d6(0x1c1)]='schedule:history';[a36_0x5069d6(0x229)]=a36_0x5069d6(0x243);[a36_0x5069d6(0x219)](_0x1fa6a3){const _0x1223c2=_0x1fa6a3['args'][0x0];if(!_0x1223c2)return'Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20history\x20<name>\x20[--from\x20<n>]\x20[--to\x20<n>]';return undefined;}async['execute'](_0x1fb854){const _0x329f87=a36_0x5069d6,{options:_0xa0d26d,args:_0x1e638d,tdx:_0x42bfd9}=_0x1fb854,_0x46dee0=_0x1e638d[0x0],_0x29cf30=_0xa0d26d,_0x34d7a5=_0x29cf30[_0x329f87(0x232)]!==undefined?Number(_0x29cf30[_0x329f87(0x232)]):undefined,_0x5300f5=_0x29cf30['to']!==undefined?Number(_0x29cf30['to']):undefined,_0x5bc2f9=await withSpinner(_0x329f87(0x1d9),()=>_0x42bfd9['schedules'][_0x329f87(0x1b7)](_0x46dee0,{'from':_0x34d7a5,'to':_0x5300f5}),{'verbose':_0xa0d26d[_0x329f87(0x20d)]}),_0x11530a=_0x5bc2f9[_0x329f87(0x1b4)];console[_0x329f87(0x1da)]('Found\x20'+_0x11530a[_0x329f87(0x21d)]+_0x329f87(0x215)+(_0x11530a['count']!==0x1?'s':'')+_0x329f87(0x217)+_0x11530a[_0x329f87(0x232)]+'-'+_0x11530a['to']+')');const _0x5b49f3=_0x11530a[_0x329f87(0x1b7)][_0x329f87(0x216)](_0x10d758=>({'job_id':_0x10d758['job_id'],'type':_0x10d758['type'],'status':_0x10d758[_0x329f87(0x224)],'scheduled_at':_0x10d758[_0x329f87(0x220)],'created_at':_0x10d758[_0x329f87(0x221)],'start_at':_0x10d758[_0x329f87(0x20c)],'end_at':_0x10d758[_0x329f87(0x1d2)]}));return await handleSDKOutput(_0x5b49f3,_0xa0d26d),0x0;}}
@@ -1 +1 @@
1
- const a37_0x9e9627=a37_0x5ae0;(function(_0x3e3a07,_0xa52453){const _0xcb4136=a37_0x5ae0,_0x4aadc3=_0x3e3a07();while(!![]){try{const _0x4ee711=-parseInt(_0xcb4136(0x25c))/0x1+-parseInt(_0xcb4136(0x241))/0x2+-parseInt(_0xcb4136(0x234))/0x3*(parseInt(_0xcb4136(0x25e))/0x4)+parseInt(_0xcb4136(0x280))/0x5*(parseInt(_0xcb4136(0x25a))/0x6)+parseInt(_0xcb4136(0x20b))/0x7*(parseInt(_0xcb4136(0x224))/0x8)+parseInt(_0xcb4136(0x278))/0x9*(-parseInt(_0xcb4136(0x236))/0xa)+parseInt(_0xcb4136(0x238))/0xb;if(_0x4ee711===_0xa52453)break;else _0x4aadc3['push'](_0x4aadc3['shift']());}catch(_0x561239){_0x4aadc3['push'](_0x4aadc3['shift']());}}}(a37_0x4953,0x8505a));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,handleQueryOutput,handleSingleObjectOutput}from'../core/command-output.js';import{withSpinner,withProgressSpinner,formatElapsed}from'../utils/spinner.js';import{parseSegmentRef}from'../sdk/segment/segment-ref-parser.js';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import{executeSchemaQuery}from'../sdk/segment/fields-display.js';import{isYamlFilePath,resolveYamlFilePath}from'../sdk/segment/segment-path-parser.js';import{getConsoleNextUrl}from'../sdk/client/endpoints.js';function a37_0x5ae0(_0x4a6db4,_0x4ae84b){_0x4a6db4=_0x4a6db4-0x1e5;const _0x495388=a37_0x4953();let _0x5ae075=_0x495388[_0x4a6db4];return _0x5ae075;}import{openBrowser}from'../utils/process.js';import a37_0x48387a from'chalk';async function resolveSegmentTarget(_0x3cd3fb,_0xcb3c7c,_0x141f07){const _0x42a6f4=a37_0x5ae0;if(isYamlFilePath(_0x3cd3fb))try{const _0x4af533=await resolveYamlFilePath(_0x3cd3fb);return _0x141f07&&(console['error'](_0x42a6f4(0x261)+_0x3cd3fb),console[_0x42a6f4(0x25f)](_0x42a6f4(0x1fc)+_0x4af533[_0x42a6f4(0x22b)]),console[_0x42a6f4(0x25f)](_0x42a6f4(0x271)+_0x4af533['segmentName']),console['error'](_0x42a6f4(0x23a)+(_0x4af533[_0x42a6f4(0x273)]||'(root)')),console[_0x42a6f4(0x25f)]('\x20\x20Full\x20path:\x20'+_0x4af533['fullPath'])),_0x4af533[_0x42a6f4(0x1f1)];}catch(_0x4cadae){throw new SDKError(ErrorCode[_0x42a6f4(0x27b)],_0x42a6f4(0x229)+_0x4cadae[_0x42a6f4(0x1ea)]);}if(!_0xcb3c7c)throw new SDKError(ErrorCode[_0x42a6f4(0x27b)],_0x42a6f4(0x20c));return _0xcb3c7c+'/'+_0x3cd3fb;}export class SegmentDescribeCommand extends BaseCommand{[a37_0x9e9627(0x266)]='segment:describe';[a37_0x9e9627(0x269)]=a37_0x9e9627(0x286);async['execute'](_0x5c5fc2){const _0x271ca6=a37_0x9e9627,{options:_0x3492c2,args:_0x3655c9,tdx:_0x3bb635}=_0x5c5fc2,_0x160c41=_0x3655c9[0x0],_0x2115bf=!_0x160c41&&!!_0x3492c2[_0x271ca6(0x22b)],_0x238a45=_0x160c41||_0x3492c2[_0x271ca6(0x22b)];if(!_0x238a45)return console[_0x271ca6(0x25f)](_0x271ca6(0x216)),console[_0x271ca6(0x25f)](_0x271ca6(0x23d)),console[_0x271ca6(0x25f)]('Examples:'),console[_0x271ca6(0x25f)]('\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience\x22'),console[_0x271ca6(0x25f)]('\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience/Marketing/High\x20Value\x22'),console[_0x271ca6(0x25f)](_0x271ca6(0x26e)),console[_0x271ca6(0x25f)](_0x271ca6(0x256)),0x1;try{const _0x453552=_0x3492c2[_0x271ca6(0x251)];let _0x4949de=_0x238a45;!_0x2115bf&&_0x453552&&!_0x238a45[_0x271ca6(0x23f)]('/')&&(_0x4949de=_0x453552+'/'+_0x238a45,_0x3492c2[_0x271ca6(0x219)]&&console[_0x271ca6(0x25f)](_0x271ca6(0x27d)+_0x4949de));const _0x28584b=await withSpinner(_0x271ca6(0x222)+_0x4949de+_0x271ca6(0x1f3),()=>_0x3bb635[_0x271ca6(0x233)][_0x271ca6(0x255)](_0x4949de),{'verbose':_0x3492c2['verbose']}),_0x4dd028=_0x28584b[_0x271ca6(0x23b)];_0x3492c2[_0x271ca6(0x219)]&&(console[_0x271ca6(0x25f)](_0x271ca6(0x254)+_0x4dd028['type']),console[_0x271ca6(0x25f)](_0x271ca6(0x265)+_0x4dd028[_0x271ca6(0x1f6)]),_0x4dd028[_0x271ca6(0x284)]&&console['error']('Folder\x20ID:\x20'+_0x4dd028[_0x271ca6(0x284)]),_0x4dd028[_0x271ca6(0x21f)]&&console['error'](_0x271ca6(0x27f)+_0x4dd028[_0x271ca6(0x21f)]));if(_0x4dd028[_0x271ca6(0x24b)]==='parent'){const _0x36ee76=await withSpinner('Fetching\x20parent\x20segment\x20details...',()=>_0x3bb635[_0x271ca6(0x233)][_0x271ca6(0x228)](_0x4dd028[_0x271ca6(0x1f6)]),{'verbose':_0x3492c2[_0x271ca6(0x219)]});await handleSingleObjectOutput(_0x36ee76[_0x271ca6(0x23b)],_0x3492c2);}else{if(_0x4dd028[_0x271ca6(0x24b)]===_0x271ca6(0x282)){if(!_0x4dd028['folderId'])throw new SDKError(ErrorCode['SEGMENT_FOLDER_NOT_FOUND'],_0x271ca6(0x23c));const _0x45b56c=await withSpinner(_0x271ca6(0x223),()=>_0x3bb635['segment'][_0x271ca6(0x1fd)](_0x4dd028[_0x271ca6(0x284)]),{'verbose':_0x3492c2['verbose']});await handleSingleObjectOutput(_0x45b56c[_0x271ca6(0x23b)],_0x3492c2);}else{if(_0x4dd028[_0x271ca6(0x24b)]===_0x271ca6(0x233)){if(!_0x4dd028[_0x271ca6(0x21f)])throw new SDKError(ErrorCode[_0x271ca6(0x267)],_0x271ca6(0x207));const _0x1f34e5=await withSpinner('Fetching\x20segment\x20details...',()=>_0x3bb635[_0x271ca6(0x233)][_0x271ca6(0x1fb)](_0x4dd028[_0x271ca6(0x1f6)],_0x4dd028[_0x271ca6(0x21f)]),{'verbose':_0x3492c2[_0x271ca6(0x219)]});await handleSingleObjectOutput(_0x1f34e5[_0x271ca6(0x23b)],_0x3492c2);}}}return 0x0;}catch(_0x35b7e3){if(_0x35b7e3 instanceof SDKError)return console['error']('Error:\x20'+_0x35b7e3[_0x271ca6(0x1ea)]),_0x35b7e3[_0x271ca6(0x239)]&&console['error']('\x20\x20Cause:\x20'+_0x35b7e3[_0x271ca6(0x239)]),0x1;throw _0x35b7e3;}}}export class SegmentShowCommand extends BaseCommand{['name']=a37_0x9e9627(0x268);[a37_0x9e9627(0x269)]='Execute\x20child\x20segment\x20SQL\x20query\x20and\x20show\x20results';async[a37_0x9e9627(0x252)](_0xb751c2){const _0x40b586=a37_0x9e9627,{options:_0x49e598,args:_0x407486,tdx:_0x357e50}=_0xb751c2,_0x5241e4=_0x407486[0x0];if(!_0x5241e4)return console[_0x40b586(0x25f)](_0x40b586(0x210)),console['error'](_0x40b586(0x260)),console['error'](_0x40b586(0x227)),console[_0x40b586(0x25f)]('Examples:'),console[_0x40b586(0x25f)](_0x40b586(0x26d)),console[_0x40b586(0x25f)](_0x40b586(0x204)),0x1;try{const _0x2b77ad=_0x49e598['parentSegment'],_0x45c43e=await resolveSegmentTarget(_0x5241e4,_0x2b77ad,_0x49e598[_0x40b586(0x219)]);_0x49e598['verbose']&&console['error']('Target\x20path:\x20'+_0x45c43e);const _0x235bbb=await withSpinner(_0x40b586(0x1e7)+_0x5241e4+_0x40b586(0x1f3),()=>_0x357e50['segment'][_0x40b586(0x255)](_0x45c43e),{'verbose':_0x49e598[_0x40b586(0x219)]}),_0x489f73=_0x235bbb[_0x40b586(0x23b)];_0x49e598[_0x40b586(0x219)]&&(console[_0x40b586(0x25f)]('Resolved\x20type:\x20'+_0x489f73['type']),console[_0x40b586(0x25f)](_0x40b586(0x265)+_0x489f73[_0x40b586(0x1f6)]));if(_0x489f73[_0x40b586(0x24b)]===_0x40b586(0x282))return console['error'](_0x40b586(0x212)),console[_0x40b586(0x25f)](_0x40b586(0x209)),0x1;if(_0x489f73[_0x40b586(0x24b)]===_0x40b586(0x24a))return console['error'](_0x40b586(0x250)),console['error']('Use:\x20tdx\x20ps\x20show'),0x1;if(!_0x489f73[_0x40b586(0x21f)])throw new SDKError(ErrorCode[_0x40b586(0x267)],_0x40b586(0x207));const _0x4f5c5b=await withSpinner(_0x40b586(0x220),()=>_0x357e50[_0x40b586(0x233)]['getSegmentSQL'](_0x489f73[_0x40b586(0x1f6)],_0x489f73[_0x40b586(0x21f)]),{'verbose':_0x49e598[_0x40b586(0x219)]});let _0xe63dd=_0x4f5c5b[_0x40b586(0x23b)];const _0x20dbe6=resolveLimit(_0x49e598[_0x40b586(0x258)],DEFAULT_DISPLAY_LIMIT),_0x11fbb1=/\bLIMIT\s+\d+/i[_0x40b586(0x22d)](_0xe63dd);!_0x11fbb1&&(_0xe63dd=_0xe63dd[_0x40b586(0x247)]()[_0x40b586(0x242)](/;+$/,''),_0xe63dd='SELECT\x20*\x20FROM\x20(\x0a'+_0xe63dd+_0x40b586(0x25d)+_0x20dbe6);_0x49e598[_0x40b586(0x219)]&&console[_0x40b586(0x25f)](_0x40b586(0x235)+_0xe63dd);const _0x197977=await withProgressSpinner(_0x40b586(0x1ff),async _0x3d6a76=>{const _0x3526e3=_0x40b586,_0x387d7d=await _0x357e50[_0x3526e3(0x20d)][_0x3526e3(0x252)](_0xe63dd,{'catalog':'td','schema':'information_schema','onJobId':_0x1dc8eb=>{const _0x2c5772=_0x3526e3;_0x3d6a76[_0x2c5772(0x22c)](_0x1dc8eb);}});return _0x387d7d;},{'verbose':_0x49e598[_0x40b586(0x219)]}),_0x18e6d4=_0x197977[_0x40b586(0x23b)],_0x3df3aa=_0x18e6d4['jobId']?_0x40b586(0x1f2)+_0x18e6d4[_0x40b586(0x1e8)]+']':'';return console['error'](_0x40b586(0x1ed)+_0x18e6d4['stats']['processedRows']['toLocaleString']()+_0x40b586(0x276)+(_0x40b586(0x21c)+formatElapsed(_0x18e6d4['stats'][_0x40b586(0x225)])+_0x3df3aa)),await handleQueryOutput(_0x18e6d4,_0x49e598),0x0;}catch(_0x5076e4){if(_0x5076e4 instanceof SDKError)return console[_0x40b586(0x25f)]('✖\x20Query\x20failed\x20['+_0x5076e4['code']+']'),console[_0x40b586(0x25f)]('\x0a'+_0x5076e4[_0x40b586(0x1ea)]),0x1;throw _0x5076e4;}}}export class SegmentFolderListCommand extends BaseCommand{[a37_0x9e9627(0x266)]=a37_0x9e9627(0x27c);[a37_0x9e9627(0x269)]=a37_0x9e9627(0x237);async['execute'](_0x570c23){const _0x580786=a37_0x9e9627,{options:_0x203261,args:_0x36e7d5,tdx:_0x4f31a}=_0x570c23;if(_0x36e7d5[_0x580786(0x1e5)]===0x0)return console['error']('Error:\x20Parent\x20segment\x20name\x20is\x20required'),console['error'](_0x580786(0x202)),0x1;const _0x110ae6=_0x36e7d5[0x0];try{_0x203261[_0x580786(0x219)]&&(console[_0x580786(0x25f)](_0x580786(0x26f)+_0x203261[_0x580786(0x211)]),console[_0x580786(0x25f)](_0x580786(0x24e)+_0x110ae6));const _0x33c83c=await withSpinner(_0x580786(0x257)+_0x110ae6+'\x27...',()=>_0x4f31a[_0x580786(0x233)][_0x580786(0x262)](_0x110ae6),{'verbose':_0x203261[_0x580786(0x219)]}),_0xc12c9=_0x33c83c[_0x580786(0x23b)];_0x203261[_0x580786(0x219)]&&console[_0x580786(0x25f)](_0x580786(0x1ef)+_0xc12c9);const _0x55501c=await withSpinner('Listing\x20folders\x20for\x20parent\x20\x27'+_0x110ae6+_0x580786(0x1f3),()=>_0x4f31a[_0x580786(0x233)][_0x580786(0x20f)](_0xc12c9),{'verbose':_0x203261[_0x580786(0x219)]}),_0x7d0ab8=_0x55501c[_0x580786(0x23b)];return console['error'](_0x580786(0x277)+_0x7d0ab8[_0x580786(0x1e5)]+_0x580786(0x1ee)+(_0x7d0ab8[_0x580786(0x1e5)]!==0x1?'s':'')),await handleSDKOutput(_0x7d0ab8,_0x203261),0x0;}catch(_0x2cb92d){if(_0x2cb92d instanceof SDKError)return console[_0x580786(0x25f)](_0x580786(0x285)+_0x2cb92d['message']),_0x2cb92d[_0x580786(0x239)]&&console['error'](_0x580786(0x279)+_0x2cb92d[_0x580786(0x239)]),0x1;throw _0x2cb92d;}}}export class SegmentFolderShowCommand extends BaseCommand{[a37_0x9e9627(0x266)]='segment:folder:show';[a37_0x9e9627(0x269)]=a37_0x9e9627(0x1ec);async[a37_0x9e9627(0x252)](_0x107591){const _0x3a38f2=a37_0x9e9627,{options:_0x153cac,args:_0x3243e7,tdx:_0xfa9430}=_0x107591;if(_0x3243e7[_0x3a38f2(0x1e5)]===0x0)return console[_0x3a38f2(0x25f)](_0x3a38f2(0x22e)),console[_0x3a38f2(0x25f)]('Usage:\x20tdx\x20segment\x20folder\x20show\x20<parent_name/folder_name>'),0x1;try{const {parentId:_0x4761b0,childId:_0x508398}=parseSegmentRef(_0x3243e7[0x0]);_0x153cac[_0x3a38f2(0x219)]&&(console[_0x3a38f2(0x25f)](_0x3a38f2(0x26f)+_0x153cac['site']),console['error']('Parent\x20name:\x20'+_0x4761b0),_0x508398&&console[_0x3a38f2(0x25f)](_0x3a38f2(0x20e)+_0x508398));if(!_0x508398)return console['error'](_0x3a38f2(0x208)),0x1;const _0x2ff12e=await withSpinner(_0x3a38f2(0x257)+_0x4761b0+_0x3a38f2(0x1f3),()=>_0xfa9430[_0x3a38f2(0x233)][_0x3a38f2(0x262)](_0x4761b0),{'verbose':_0x153cac[_0x3a38f2(0x219)]}),_0x34765e=_0x2ff12e[_0x3a38f2(0x23b)];_0x153cac[_0x3a38f2(0x219)]&&console[_0x3a38f2(0x25f)](_0x3a38f2(0x1ef)+_0x34765e);const _0x26b844=await withSpinner(_0x3a38f2(0x21d)+_0x508398+_0x3a38f2(0x1f3),()=>_0xfa9430[_0x3a38f2(0x233)][_0x3a38f2(0x21a)](_0x34765e,_0x508398),{'verbose':_0x153cac['verbose']}),_0xe300fb=_0x26b844[_0x3a38f2(0x23b)];_0x153cac[_0x3a38f2(0x219)]&&console[_0x3a38f2(0x25f)](_0x3a38f2(0x25b)+_0xe300fb);const _0xe722c1=await withSpinner(_0x3a38f2(0x226)+_0x508398+_0x3a38f2(0x1f3),()=>_0xfa9430[_0x3a38f2(0x233)][_0x3a38f2(0x1fd)](_0xe300fb),{'verbose':_0x153cac['verbose']});return await handleSDKOutput([_0xe722c1['data']],_0x153cac),0x0;}catch(_0x1fcb00){if(_0x1fcb00 instanceof SDKError)return console[_0x3a38f2(0x25f)](_0x3a38f2(0x285)+_0x1fcb00[_0x3a38f2(0x1ea)]),_0x1fcb00[_0x3a38f2(0x239)]&&console['error'](_0x3a38f2(0x279)+_0x1fcb00[_0x3a38f2(0x239)]),0x1;throw _0x1fcb00;}}}export class SegmentSQLCommand extends BaseCommand{[a37_0x9e9627(0x266)]=a37_0x9e9627(0x243);[a37_0x9e9627(0x269)]=a37_0x9e9627(0x22f);async[a37_0x9e9627(0x252)](_0x1b56a6){const _0x371b5d=a37_0x9e9627,{options:_0x1cc3e4,args:_0x2ab526}=_0x1b56a6,_0x2135e=_0x1cc3e4,_0x5f4a13=_0x2135e[_0x371b5d(0x272)],_0x10214a=_0x2ab526[0x0];if(!_0x10214a&&!_0x5f4a13)return console[_0x371b5d(0x25f)](a37_0x48387a[_0x371b5d(0x26a)](_0x371b5d(0x253))),console['error'](_0x371b5d(0x230)),console['error']('\x20\x20Server-side\x20segment:\x20\x20tdx\x20sg\x20sql\x20<name>'),console[_0x371b5d(0x25f)]('\x20\x20Local\x20YAML\x20file:\x20\x20\x20\x20\x20\x20tdx\x20sg\x20sql\x20--path\x20<file-path>'),console['error'](_0x371b5d(0x1f9)),console[_0x371b5d(0x25f)](_0x371b5d(0x1f4)),console['error'](_0x371b5d(0x217)),0x1;if(_0x10214a&&_0x5f4a13)return console[_0x371b5d(0x25f)](a37_0x48387a['red']('Error:\x20Specify\x20either\x20segment\x20name\x20or\x20--path,\x20not\x20both')),0x1;try{let _0x4a8f35;if(_0x5f4a13)_0x4a8f35=await this['getSQLFromYamlFile'](_0x5f4a13,_0x1b56a6);else{if(isYamlFilePath(_0x10214a))return console[_0x371b5d(0x25f)](a37_0x48387a[_0x371b5d(0x26a)]('Error:\x20YAML\x20file\x20paths\x20must\x20be\x20specified\x20with\x20--path\x20option')),console[_0x371b5d(0x25f)](_0x371b5d(0x1e9)+_0x10214a),0x1;else _0x4a8f35=await this[_0x371b5d(0x201)](_0x10214a,_0x1b56a6);}return _0x1cc3e4['format']==='json'||_0x1cc3e4[_0x371b5d(0x245)]===_0x371b5d(0x1e6)?await handleSDKOutput([{'sql':_0x4a8f35}],_0x1cc3e4):console[_0x371b5d(0x246)](_0x4a8f35),0x0;}catch(_0x4d7107){if(_0x4d7107 instanceof SDKError)return console[_0x371b5d(0x25f)](_0x371b5d(0x285)+_0x4d7107[_0x371b5d(0x1ea)]),_0x4d7107[_0x371b5d(0x239)]&&console[_0x371b5d(0x25f)](_0x371b5d(0x279)+_0x4d7107[_0x371b5d(0x239)]),0x1;throw _0x4d7107;}}async[a37_0x9e9627(0x283)](_0x1380e0,_0x4f5472){const _0xf9d58a=a37_0x9e9627,{options:_0x374815,tdx:_0x19ab93}=_0x4f5472;let _0x147174;try{_0x147174=await resolveYamlFilePath(_0x1380e0);}catch(_0x45d47e){throw new SDKError(ErrorCode[_0xf9d58a(0x27b)],_0xf9d58a(0x229)+_0x45d47e['message']);}_0x374815[_0xf9d58a(0x219)]&&console[_0xf9d58a(0x25f)](_0xf9d58a(0x214)+_0x147174['parentSegment']+'/'+_0x147174[_0xf9d58a(0x263)]);const _0x5c6827=await withSpinner(_0xf9d58a(0x21e),()=>_0x19ab93[_0xf9d58a(0x233)]['getSegmentSQLFromYaml'](_0x147174['content'],_0x147174[_0xf9d58a(0x22b)],_0x147174['segmentName']),{'verbose':_0x374815[_0xf9d58a(0x219)]});return _0x5c6827[_0xf9d58a(0x23b)];}async[a37_0x9e9627(0x201)](_0x24da4d,_0x817c7f){const _0x264358=a37_0x9e9627,{options:_0x210be8,tdx:_0x80fbc0}=_0x817c7f,_0x30a8c3=_0x210be8[_0x264358(0x22b)],_0x5e290d=await resolveSegmentTarget(_0x24da4d,_0x30a8c3,_0x210be8[_0x264358(0x219)]);_0x210be8[_0x264358(0x219)]&&console['error'](_0x264358(0x232)+_0x5e290d);const _0x3ca081=await withSpinner('Resolving\x20\x27'+_0x24da4d+_0x264358(0x1f3),()=>_0x80fbc0[_0x264358(0x233)][_0x264358(0x255)](_0x5e290d),{'verbose':_0x210be8[_0x264358(0x219)]}),_0x15e1ba=_0x3ca081[_0x264358(0x23b)];_0x210be8['verbose']&&(console['error'](_0x264358(0x254)+_0x15e1ba[_0x264358(0x24b)]),console[_0x264358(0x25f)]('Parent\x20ID:\x20'+_0x15e1ba[_0x264358(0x1f6)]));if(_0x15e1ba[_0x264358(0x24b)]===_0x264358(0x282))throw new SDKError(ErrorCode[_0x264358(0x27b)],_0x264358(0x231));if(_0x15e1ba[_0x264358(0x24b)]===_0x264358(0x24a))throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x264358(0x218));if(!_0x15e1ba[_0x264358(0x21f)])throw new SDKError(ErrorCode[_0x264358(0x267)],_0x264358(0x207));const _0x1df002=await withSpinner(_0x264358(0x220),()=>_0x80fbc0[_0x264358(0x233)][_0x264358(0x1fa)](_0x15e1ba[_0x264358(0x1f6)],_0x15e1ba['segmentId']),{'verbose':_0x210be8[_0x264358(0x219)]});return _0x1df002[_0x264358(0x23b)];}}export class SegmentFolderCreateCommand extends BaseCommand{[a37_0x9e9627(0x266)]=a37_0x9e9627(0x21b);[a37_0x9e9627(0x269)]=a37_0x9e9627(0x213);async[a37_0x9e9627(0x252)](_0x132a16){const _0x47f897=a37_0x9e9627,{options:_0x16d140,args:_0x216a2b,tdx:_0x14932c}=_0x132a16,_0x20ce0d=_0x16d140;if(_0x216a2b[_0x47f897(0x1e5)]<0x2)return console[_0x47f897(0x25f)](_0x47f897(0x23e)),console[_0x47f897(0x25f)](_0x47f897(0x203)),0x1;const _0x54ef0d=_0x216a2b[0x0],_0x108ac4=_0x216a2b[0x1];_0x20ce0d['verbose']&&(console['error'](_0x47f897(0x26f)+_0x20ce0d[_0x47f897(0x211)]),console['error'](_0x47f897(0x1fe)+_0x54ef0d),console[_0x47f897(0x25f)](_0x47f897(0x20e)+_0x108ac4));let _0x87a130;if(_0x20ce0d[_0x47f897(0x24d)]){const _0xfbdbae=_0x20ce0d[_0x47f897(0x24d)],_0x1b7eb6=await withSpinner(_0x47f897(0x257)+_0x54ef0d+_0x47f897(0x1f3),()=>_0x14932c[_0x47f897(0x233)][_0x47f897(0x262)](_0x54ef0d),{'verbose':_0x20ce0d[_0x47f897(0x219)]}),_0x335783=_0x1b7eb6['data'],_0x3021d7=await withSpinner(_0x47f897(0x22a)+_0xfbdbae+'\x27...',()=>_0x14932c['segment'][_0x47f897(0x21a)](_0x335783,_0xfbdbae),{'verbose':_0x20ce0d['verbose']});_0x87a130=_0x3021d7[_0x47f897(0x23b)],_0x20ce0d[_0x47f897(0x219)]&&console[_0x47f897(0x25f)]('Resolved\x20parent\x20folder\x20ID:\x20'+_0x87a130);}const _0x5abda9={'name':_0x108ac4,'description':_0x20ce0d[_0x47f897(0x269)],'parentFolderId':_0x87a130},_0x316351=await withSpinner('Creating\x20folder\x20\x27'+_0x108ac4+'\x27...',()=>_0x14932c[_0x47f897(0x233)][_0x47f897(0x1eb)](_0x54ef0d,_0x5abda9),{'verbose':_0x20ce0d[_0x47f897(0x219)]}),_0x30946d=_0x316351[_0x47f897(0x23b)];return console[_0x47f897(0x25f)](_0x47f897(0x24f)+_0x30946d[_0x47f897(0x266)]+_0x47f897(0x264)+_0x30946d['id']),await handleSDKOutput([_0x30946d],_0x20ce0d),0x0;}}export class SegmentViewCommand extends BaseCommand{[a37_0x9e9627(0x266)]=a37_0x9e9627(0x1f7);['description']=a37_0x9e9627(0x274);async['execute'](_0x5560b6){const _0x34a1d8=a37_0x9e9627,{options:_0x5cced7,args:_0x75f45c,tdx:_0x28d606}=_0x5560b6,_0x4b2d33=_0x75f45c[0x0];if(!_0x4b2d33)return console[_0x34a1d8(0x25f)](_0x34a1d8(0x200)),console[_0x34a1d8(0x25f)](_0x34a1d8(0x24c)),console[_0x34a1d8(0x25f)](_0x34a1d8(0x26b)),console['error'](_0x34a1d8(0x205)),console[_0x34a1d8(0x25f)](_0x34a1d8(0x27a)),console[_0x34a1d8(0x25f)](_0x34a1d8(0x1f9)),console[_0x34a1d8(0x25f)]('\x20\x20tdx\x20sg\x20view\x20\x22Marketing\x22\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20folder\x20details'),console[_0x34a1d8(0x25f)]('\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20\x20\x20\x20\x20#\x20View\x20child\x20segment\x20details'),console['error'](_0x34a1d8(0x206)),console[_0x34a1d8(0x25f)](_0x34a1d8(0x281)),0x1;try{const _0x3d3f60=_0x5cced7[_0x34a1d8(0x22b)],_0x39adbd=await resolveSegmentTarget(_0x4b2d33,_0x3d3f60,_0x5cced7[_0x34a1d8(0x219)]);_0x5cced7[_0x34a1d8(0x219)]&&console[_0x34a1d8(0x25f)](_0x34a1d8(0x232)+_0x39adbd);const _0x361d70=await withSpinner(_0x34a1d8(0x1e7)+_0x4b2d33+_0x34a1d8(0x1f3),()=>_0x28d606[_0x34a1d8(0x233)][_0x34a1d8(0x255)](_0x39adbd),{'verbose':_0x5cced7[_0x34a1d8(0x219)]}),_0x58ee64=_0x361d70[_0x34a1d8(0x23b)];_0x5cced7[_0x34a1d8(0x219)]&&(console[_0x34a1d8(0x25f)](_0x34a1d8(0x254)+_0x58ee64[_0x34a1d8(0x24b)]),console[_0x34a1d8(0x25f)](_0x34a1d8(0x265)+_0x58ee64[_0x34a1d8(0x1f6)]),_0x58ee64[_0x34a1d8(0x284)]&&console['error'](_0x34a1d8(0x1f5)+_0x58ee64['folderId']),_0x58ee64['segmentId']&&console['error'](_0x34a1d8(0x27f)+_0x58ee64[_0x34a1d8(0x21f)]));if(_0x5cced7['web']){if(_0x58ee64['type']===_0x34a1d8(0x282))return console[_0x34a1d8(0x25f)]('Error:\x20Cannot\x20open\x20folder\x20in\x20web\x20browser.\x20Use\x20a\x20segment\x20name\x20instead.'),0x1;if(_0x58ee64[_0x34a1d8(0x24b)]==='parent')return console[_0x34a1d8(0x25f)](_0x34a1d8(0x1f0)),console[_0x34a1d8(0x25f)](_0x34a1d8(0x240)),0x1;if(!_0x58ee64[_0x34a1d8(0x21f)])throw new SDKError(ErrorCode[_0x34a1d8(0x267)],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0xdd680e=getConsoleNextUrl(_0x5cced7[_0x34a1d8(0x211)],'/app/ps/'+_0x58ee64[_0x34a1d8(0x1f6)]+_0x34a1d8(0x20a)+_0x58ee64['segmentId']);return console[_0x34a1d8(0x25f)](a37_0x48387a[_0x34a1d8(0x259)]('✔')+'\x20Opening\x20'+a37_0x48387a[_0x34a1d8(0x221)](_0xdd680e)),openBrowser(_0xdd680e),0x0;}if(_0x58ee64[_0x34a1d8(0x24b)]===_0x34a1d8(0x282)){if(!_0x58ee64['folderId'])throw new SDKError(ErrorCode[_0x34a1d8(0x215)],_0x34a1d8(0x23c));const _0x5020eb=await withSpinner(_0x34a1d8(0x223),()=>_0x28d606[_0x34a1d8(0x233)]['getFolder'](_0x58ee64[_0x34a1d8(0x284)]),{'verbose':_0x5cced7['verbose']});await handleSingleObjectOutput(_0x5020eb['data'],_0x5cced7);}else{if(_0x58ee64['type']===_0x34a1d8(0x233)){if(!_0x58ee64[_0x34a1d8(0x21f)])throw new SDKError(ErrorCode[_0x34a1d8(0x267)],_0x34a1d8(0x207));const _0x273965=await withSpinner(_0x34a1d8(0x249),()=>_0x28d606['segment'][_0x34a1d8(0x1fb)](_0x58ee64[_0x34a1d8(0x1f6)],_0x58ee64['segmentId']),{'verbose':_0x5cced7['verbose']}),_0x2f05fc=getConsoleNextUrl(_0x5cced7[_0x34a1d8(0x211)],'/app/ps/'+_0x58ee64[_0x34a1d8(0x1f6)]+'/e/'+_0x58ee64[_0x34a1d8(0x21f)]),_0x2c183e=_0x273965[_0x34a1d8(0x23b)];_0x2c183e['url']=_0x2f05fc,await handleSingleObjectOutput(_0x2c183e,_0x5cced7);}else return console[_0x34a1d8(0x25f)]('Error:\x20Cannot\x20view\x20parent\x20segment\x20details\x20with\x20this\x20command.'),console[_0x34a1d8(0x25f)]('Use:\x20tdx\x20ps\x20view'),0x1;}return 0x0;}catch(_0x52345a){if(_0x52345a instanceof SDKError)return console[_0x34a1d8(0x25f)](_0x34a1d8(0x285)+_0x52345a[_0x34a1d8(0x1ea)]),_0x52345a[_0x34a1d8(0x239)]&&console['error']('\x20\x20Cause:\x20'+_0x52345a['cause']),0x1;throw _0x52345a;}}}function a37_0x4953(){const _0x2f5259=['verbose','resolveFolderId','segment:folder:create','in\x20','Resolving\x20folder\x20\x27','Fetching\x20SQL\x20from\x20rule...','segmentId','Fetching\x20SQL\x20for\x20segment...','cyan','Resolving\x20path\x20\x27','Fetching\x20folder\x20details...','728GXwkZU','elapsedTimeMillis','Fetching\x20folder\x20\x27','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20show\x20<path/to/segment.yml>','getParent','Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20','Resolving\x20parent\x20folder\x20\x27','parentSegment','setJobId','test','Error:\x20Folder\x20reference\x20is\x20required','Get\x20SQL\x20query\x20for\x20child\x20segment','Usage:','Cannot\x20get\x20SQL\x20query\x20for\x20a\x20folder.\x20Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.','Target\x20path:\x20','segment','539361tPUDIv','SQL\x20query:\x0a','8898170ftwCNG','List\x20segment\x20folders\x20under\x20a\x20parent\x20segment','17865023HtpmEB','cause','\x20\x20Folder\x20path:\x20','data','Folder\x20ID\x20missing\x20from\x20resolved\x20path','Usage:\x20tdx\x20segment\x20describe\x20<path>','Error:\x20Parent\x20segment\x20name\x20and\x20folder\x20name\x20are\x20required','includes','Use:\x20tdx\x20ps\x20view\x20-w','1365262aYbars','replace','segment:sql','Use:\x20tdx\x20ps\x20desc','format','log','trim','Error:\x20Cannot\x20show\x20schema\x20for\x20parent\x20segment\x20with\x20this\x20command.','Fetching\x20segment\x20details...','parent','type','Usage:\x20tdx\x20sg\x20view\x20<name>\x20[-w]','parentFolder','Parent\x20name:\x20','✔\x20Created\x20folder\x20\x27','Error:\x20Cannot\x20execute\x20query\x20for\x20parent\x20segment\x20with\x20this\x20command.','segmentPath','execute','Error:\x20Segment\x20name\x20or\x20--path\x20is\x20required','Resolved\x20type:\x20','resolvePathToResource','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','Resolving\x20parent\x20segment\x20\x27','limit','green','6QYYdId','Resolved\x20folder\x20ID:\x20','635365kzxryI','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','16xkOnmE','error','Usage:\x20tdx\x20sg\x20show\x20<name>','Resolved\x20YAML\x20file:\x20','resolveParentId','segmentName','\x27\x20with\x20ID:\x20','Parent\x20ID:\x20','name','SEGMENT_NOT_FOUND','segment:show','description','red','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20view\x20<path/to/segment.yml>','Show\x20child\x20segment\x20schema\x20(column\x20types)','\x20\x20tdx\x20sg\x20show\x20\x22Premium\x20Users\x22','\x20\x20tdx\x20segment\x20describe\x20\x22High\x20Value\x22\x20\x20\x20\x20#\x20Relative\x20to\x20current\x20context','Site:\x20','Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.','\x20\x20Segment\x20name:\x20','path','folderPath','Show\x20folder\x20or\x20child\x20segment\x20details','\x20\x20tdx\x20sg\x20desc\x20segments/my-audience/premium-users.yml','\x20rows\x20','✔\x20Found\x20','9yxWVjd','\x20\x20Cause:\x20','\x20\x20-w,\x20--web\x20\x20Open\x20segment\x20in\x20web\x20browser','INVALID_ARGUMENT','segment:folder:list','Resolved\x20relative\x20path\x20to:\x20','segment:desc','Segment\x20ID:\x20','4557135xBwUUl','\x20\x20tdx\x20sg\x20view\x20segments/my-audience/premium-users.yml','folder','getSQLFromYamlFile','folderId','Error:\x20','Show\x20segment\x20or\x20folder\x20details','length','jsonl','Resolving\x20\x27','jobId','\x20\x20tdx\x20sg\x20sql\x20--path\x20','message','createFolder','Show\x20segment\x20folder\x20details','✔\x20Query\x20completed:\x20Processed\x20','\x20folder','Resolved\x20parent\x20ID:\x20','Error:\x20Cannot\x20open\x20parent\x20segment\x20with\x20this\x20command.','fullPath','\x20[Job\x20ID:\x20','\x27...','\x20\x20tdx\x20sg\x20sql\x20\x22Premium\x20Users\x22','Folder\x20ID:\x20','parentId','segment:view','Usage:\x20tdx\x20sg\x20desc\x20<name>','Examples:','getSegmentSQL','getSegment','\x20\x20Parent\x20segment:\x20','getFolder','Parent\x20segment:\x20','Executing\x20segment\x20query...','Error:\x20Folder\x20or\x20segment\x20name,\x20or\x20YAML\x20file\x20path\x20is\x20required','getSQLFromServerSegment','Usage:\x20tdx\x20segment\x20folder\x20list\x20<parent_name>','Usage:\x20tdx\x20segment\x20folder\x20create\x20<parent_name>\x20<folder_name>\x20[options]','\x20\x20tdx\x20sg\x20show\x20segments/my-audience/premium-users.yml','Options:','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20-w\x20\x20#\x20Open\x20segment\x20in\x20web\x20browser','Segment\x20ID\x20missing\x20from\x20resolved\x20path','Error:\x20Folder\x20name\x20is\x20required\x20(use\x20parent_name/folder_name\x20format)','Use:\x20tdx\x20sg\x20view\x20<name>\x20\x20#\x20To\x20show\x20folder\x20details','/e/','72023gbUUrT','No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22','query','Folder\x20name:\x20','listFolders','Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required','site','Error:\x20Cannot\x20execute\x20SQL\x20query\x20on\x20a\x20folder.','Create\x20segment\x20folder\x20for\x20organization','Resolved:\x20','SEGMENT_FOLDER_NOT_FOUND','Error:\x20Path\x20or\x20name\x20is\x20required','\x20\x20tdx\x20sg\x20sql\x20--path\x20segments/my-audience/premium-users.yml','Cannot\x20get\x20SQL\x20for\x20parent\x20segment\x20with\x20this\x20command.\x20Use:\x20tdx\x20ps\x20sql'];a37_0x4953=function(){return _0x2f5259;};return a37_0x4953();}export const SegmentInfoCommand=SegmentViewCommand;export class SegmentDescCommand extends BaseCommand{[a37_0x9e9627(0x266)]=a37_0x9e9627(0x27e);[a37_0x9e9627(0x269)]=a37_0x9e9627(0x26c);async[a37_0x9e9627(0x252)](_0x54f184){const _0xf43258=a37_0x9e9627,{options:_0x1fbc6,args:_0x3a1a8b,tdx:_0x495760}=_0x54f184,_0x767272=_0x3a1a8b[0x0];if(!_0x767272)return console[_0xf43258(0x25f)]('Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required'),console['error'](_0xf43258(0x1f8)),console[_0xf43258(0x25f)]('\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20desc\x20<path/to/segment.yml>'),console[_0xf43258(0x25f)](_0xf43258(0x1f9)),console['error']('\x20\x20tdx\x20sg\x20desc\x20\x22Premium\x20Users\x22'),console[_0xf43258(0x25f)](_0xf43258(0x275)),0x1;try{const _0x3edcc8=_0x1fbc6[_0xf43258(0x22b)],_0x1ccc23=await resolveSegmentTarget(_0x767272,_0x3edcc8,_0x1fbc6['verbose']);_0x1fbc6['verbose']&&console['error'](_0xf43258(0x232)+_0x1ccc23);const _0x2b688d=await withSpinner('Resolving\x20\x27'+_0x767272+_0xf43258(0x1f3),()=>_0x495760[_0xf43258(0x233)][_0xf43258(0x255)](_0x1ccc23),{'verbose':_0x1fbc6[_0xf43258(0x219)]}),_0x4c7a89=_0x2b688d[_0xf43258(0x23b)];_0x1fbc6['verbose']&&(console[_0xf43258(0x25f)]('Resolved\x20type:\x20'+_0x4c7a89[_0xf43258(0x24b)]),console[_0xf43258(0x25f)](_0xf43258(0x265)+_0x4c7a89['parentId']));if(_0x4c7a89[_0xf43258(0x24b)]===_0xf43258(0x282))return console[_0xf43258(0x25f)]('Error:\x20Cannot\x20show\x20schema\x20for\x20a\x20folder.'),console[_0xf43258(0x25f)](_0xf43258(0x270)),0x1;if(_0x4c7a89[_0xf43258(0x24b)]===_0xf43258(0x24a))return console['error'](_0xf43258(0x248)),console[_0xf43258(0x25f)](_0xf43258(0x244)),0x1;if(!_0x4c7a89['segmentId'])throw new SDKError(ErrorCode[_0xf43258(0x267)],_0xf43258(0x207));const _0x1f3738=await withSpinner('Fetching\x20SQL\x20for\x20segment...',()=>_0x495760[_0xf43258(0x233)][_0xf43258(0x1fa)](_0x4c7a89[_0xf43258(0x1f6)],_0x4c7a89[_0xf43258(0x21f)]),{'verbose':_0x1fbc6['verbose']}),_0x48f83=_0x1f3738[_0xf43258(0x23b)],_0x31d3c4=await executeSchemaQuery(_0x48f83,_0x495760,_0x1fbc6);return await handleQueryOutput(_0x31d3c4,_0x1fbc6),0x0;}catch(_0x44efef){if(_0x44efef instanceof SDKError)return console['error'](_0xf43258(0x285)+_0x44efef[_0xf43258(0x1ea)]),_0x44efef[_0xf43258(0x239)]&&console[_0xf43258(0x25f)](_0xf43258(0x279)+_0x44efef[_0xf43258(0x239)]),0x1;throw _0x44efef;}}}
1
+ const a37_0x3584bc=a37_0xc9cf;(function(_0x10d3dd,_0x4bc1f5){const _0x4f5656=a37_0xc9cf,_0x39e3e8=_0x10d3dd();while(!![]){try{const _0x4e9fa3=parseInt(_0x4f5656(0x116))/0x1+-parseInt(_0x4f5656(0xfe))/0x2+-parseInt(_0x4f5656(0x189))/0x3+-parseInt(_0x4f5656(0x157))/0x4*(-parseInt(_0x4f5656(0x11c))/0x5)+-parseInt(_0x4f5656(0x12f))/0x6*(-parseInt(_0x4f5656(0x18e))/0x7)+-parseInt(_0x4f5656(0x14a))/0x8+parseInt(_0x4f5656(0x176))/0x9;if(_0x4e9fa3===_0x4bc1f5)break;else _0x39e3e8['push'](_0x39e3e8['shift']());}catch(_0x231b7f){_0x39e3e8['push'](_0x39e3e8['shift']());}}}(a37_0x7098,0xdb0a6));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,handleQueryOutput,handleSingleObjectOutput}from'../core/command-output.js';function a37_0x7098(){const _0x13b366=['✔\x20Created\x20folder\x20\x27','elapsedTimeMillis','url','Resolving\x20\x27','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','\x20\x20tdx\x20sg\x20desc\x20segments/my-audience/premium-users.yml','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20show\x20<path/to/segment.yml>','execute','getFolder','\x20\x20Folder\x20path:\x20','parent','jobId','cause','folder','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','Usage:\x20tdx\x20segment\x20folder\x20list\x20<parent_name>','segment:show','Parent\x20name:\x20','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20\x20\x20\x20\x20#\x20View\x20child\x20segment\x20details','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20-w\x20\x20#\x20Open\x20segment\x20in\x20web\x20browser','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20view\x20<path/to/segment.yml>','Segment\x20ID\x20missing\x20from\x20resolved\x20path','toLocaleString','Segment\x20ID:\x20','Resolved:\x20','Usage:\x20tdx\x20segment\x20folder\x20show\x20<parent_name/folder_name>','red','cyan','segment','16570314fYoCYE','jsonl','Resolving\x20folder\x20\x27','getParent','Error:\x20Cannot\x20show\x20schema\x20for\x20parent\x20segment\x20with\x20this\x20command.','\x20\x20Local\x20YAML\x20file:\x20\x20\x20\x20\x20\x20tdx\x20sg\x20sql\x20--path\x20<file-path>','data','resolveFolderId','path','createFolder','Target\x20path:\x20','\x20\x20Cause:\x20','parentSegment','Use:\x20tdx\x20sg\x20view\x20<name>\x20\x20#\x20To\x20show\x20folder\x20details','\x20[Job\x20ID:\x20','folderPath','✖\x20Query\x20failed\x20[','content','Show\x20segment\x20or\x20folder\x20details','2853771ubKOcI','Resolved\x20relative\x20path\x20to:\x20','/app/ps/','Folder\x20ID:\x20','includes','2127300AHYbLO','Fetching\x20SQL\x20for\x20segment...','Error:\x20Folder\x20name\x20is\x20required\x20(use\x20parent_name/folder_name\x20format)','SEGMENT_FOLDER_NOT_FOUND','\x20\x20Server-side\x20segment:\x20\x20tdx\x20sg\x20sql\x20<name>','fullPath','Use:\x20tdx\x20ps\x20view','Site:\x20','✔\x20Query\x20completed:\x20Processed\x20','SQL\x20query:\x0a','test','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20desc\x20<path/to/segment.yml>','log','Folder\x20ID\x20missing\x20from\x20resolved\x20path','Use:\x20tdx\x20ps\x20desc','Error:\x20Folder\x20or\x20segment\x20name,\x20or\x20YAML\x20file\x20path\x20is\x20required','web','parentId','SEGMENT_NOT_FOUND','SELECT\x20*\x20FROM\x20(\x0a','2815784WbGBkj','listFolders','Examples:','Resolved\x20parent\x20ID:\x20','Use:\x20tdx\x20ps\x20show','resolveParentId','getSQLFromServerSegment','type','getSegment','No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22','description','Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20','segmentId','Usage:\x20tdx\x20segment\x20folder\x20create\x20<parent_name>\x20<folder_name>\x20[options]','length','Resolved\x20type:\x20','segment:view','Resolved\x20YAML\x20file:\x20','\x20\x20Segment\x20name:\x20','replace','Parent\x20segment:\x20','getSegmentSQLFromYaml','segment:folder:show','\x20\x20tdx\x20sg\x20sql\x20--path\x20segments/my-audience/premium-users.yml','792516jCEeoC','Get\x20SQL\x20query\x20for\x20child\x20segment','Error:\x20Cannot\x20show\x20schema\x20for\x20a\x20folder.','Folder\x20name:\x20','trim','/e/','856355OimIlB','resolvePathToResource','\x20\x20tdx\x20sg\x20show\x20segments/my-audience/premium-users.yml','\x20\x20tdx\x20sg\x20view\x20segments/my-audience/premium-users.yml','Resolved\x20folder\x20ID:\x20','limit','message','\x20\x20tdx\x20sg\x20show\x20\x22Premium\x20Users\x22','format','Error:\x20Segment\x20name\x20or\x20--path\x20is\x20required','Create\x20segment\x20folder\x20for\x20organization','Show\x20segment\x20folder\x20details','in\x20','Fetching\x20segment\x20details...','Error:\x20Folder\x20reference\x20is\x20required','\x20\x20tdx\x20sg\x20desc\x20\x22Premium\x20Users\x22','\x20\x20tdx\x20sg\x20view\x20\x22Marketing\x22\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20folder\x20details','getSQLFromYamlFile','Error:\x20Cannot\x20execute\x20query\x20for\x20parent\x20segment\x20with\x20this\x20command.','6UHQXnX','Usage:\x20tdx\x20sg\x20show\x20<name>','\x20\x20tdx\x20segment\x20describe\x20\x22High\x20Value\x22\x20\x20\x20\x20#\x20Relative\x20to\x20current\x20context','Error:\x20Path\x20or\x20name\x20is\x20required','Error:\x20Specify\x20either\x20segment\x20name\x20or\x20--path,\x20not\x20both','Parent\x20ID:\x20','Resolving\x20parent\x20folder\x20\x27','\x20\x20Parent\x20segment:\x20','Error:\x20Parent\x20segment\x20name\x20and\x20folder\x20name\x20are\x20required','Creating\x20folder\x20\x27','error','\x27...','Resolved\x20parent\x20folder\x20ID:\x20','Error:\x20YAML\x20file\x20paths\x20must\x20be\x20specified\x20with\x20--path\x20option','Cannot\x20get\x20SQL\x20query\x20for\x20a\x20folder.\x20Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.','Cannot\x20get\x20SQL\x20for\x20parent\x20segment\x20with\x20this\x20command.\x20Use:\x20tdx\x20ps\x20sql','parentFolder','Resolving\x20parent\x20segment\x20\x27','Error:\x20Parent\x20segment\x20name\x20is\x20required','Resolving\x20path\x20\x27','Fetching\x20folder\x20details...','segmentName','site','Error:\x20','segment:describe','name','folderId','8411128WkOmHf','verbose','Listing\x20folders\x20for\x20parent\x20\x27','\x20\x20-w,\x20--web\x20\x20Open\x20segment\x20in\x20web\x20browser','\x20folder','INVALID_ARGUMENT','stats','segment:folder:create','\x20\x20tdx\x20sg\x20sql\x20--path\x20','green','json','getSegmentSQL','Executing\x20segment\x20query...','32mVzXNe','List\x20segment\x20folders\x20under\x20a\x20parent\x20segment'];a37_0x7098=function(){return _0x13b366;};return a37_0x7098();}import{withSpinner,withProgressSpinner,formatElapsed}from'../utils/spinner.js';import{parseSegmentRef}from'../sdk/segment/segment-ref-parser.js';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import{executeSchemaQuery}from'../sdk/segment/fields-display.js';import{isYamlFilePath,resolveYamlFilePath}from'../sdk/segment/segment-path-parser.js';import{getConsoleNextUrl}from'../sdk/client/endpoints.js';function a37_0xc9cf(_0x5617d3,_0x1821dd){_0x5617d3=_0x5617d3-0xfb;const _0x7098b6=a37_0x7098();let _0xc9cf35=_0x7098b6[_0x5617d3];return _0xc9cf35;}import{openBrowser}from'../utils/process.js';import a37_0x349ff1 from'chalk';async function resolveSegmentTarget(_0x322450,_0x3f2101,_0x4f37f6){const _0xecdae2=a37_0xc9cf;if(isYamlFilePath(_0x322450))try{const _0x3bbec5=await resolveYamlFilePath(_0x322450);return _0x4f37f6&&(console[_0xecdae2(0x139)](_0xecdae2(0x10f)+_0x322450),console[_0xecdae2(0x139)](_0xecdae2(0x136)+_0x3bbec5[_0xecdae2(0x182)]),console[_0xecdae2(0x139)](_0xecdae2(0x110)+_0x3bbec5[_0xecdae2(0x144)]),console['error'](_0xecdae2(0x162)+(_0x3bbec5[_0xecdae2(0x185)]||'(root)')),console['error']('\x20\x20Full\x20path:\x20'+_0x3bbec5['fullPath'])),_0x3bbec5[_0xecdae2(0x193)];}catch(_0x3268ab){throw new SDKError(ErrorCode[_0xecdae2(0x14f)],_0xecdae2(0x109)+_0x3268ab[_0xecdae2(0x122)]);}if(!_0x3f2101)throw new SDKError(ErrorCode[_0xecdae2(0x14f)],_0xecdae2(0x107));return _0x3f2101+'/'+_0x322450;}export class SegmentDescribeCommand extends BaseCommand{[a37_0x3584bc(0x148)]=a37_0x3584bc(0x147);[a37_0x3584bc(0x108)]=a37_0x3584bc(0x188);async['execute'](_0x340920){const _0x51dadf=a37_0x3584bc,{options:_0x5a3780,args:_0xab5117,tdx:_0x3a989c}=_0x340920,_0x849fc2=_0xab5117[0x0],_0x68a27a=!_0x849fc2&&!!_0x5a3780[_0x51dadf(0x182)],_0x2a70e8=_0x849fc2||_0x5a3780['parentSegment'];if(!_0x2a70e8)return console[_0x51dadf(0x139)](_0x51dadf(0x132)),console[_0x51dadf(0x139)]('Usage:\x20tdx\x20segment\x20describe\x20<path>'),console[_0x51dadf(0x139)](_0x51dadf(0x100)),console[_0x51dadf(0x139)]('\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience\x22'),console[_0x51dadf(0x139)]('\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience/Marketing/High\x20Value\x22'),console[_0x51dadf(0x139)](_0x51dadf(0x131)),console[_0x51dadf(0x139)](_0x51dadf(0x167)),0x1;try{const _0xb04592=_0x5a3780['segmentPath'];let _0x3a1ea6=_0x2a70e8;!_0x68a27a&&_0xb04592&&!_0x2a70e8[_0x51dadf(0x18d)]('/')&&(_0x3a1ea6=_0xb04592+'/'+_0x2a70e8,_0x5a3780[_0x51dadf(0x14b)]&&console[_0x51dadf(0x139)](_0x51dadf(0x18a)+_0x3a1ea6));const _0x2e4772=await withSpinner(_0x51dadf(0x142)+_0x3a1ea6+_0x51dadf(0x13a),()=>_0x3a989c[_0x51dadf(0x175)][_0x51dadf(0x11d)](_0x3a1ea6),{'verbose':_0x5a3780[_0x51dadf(0x14b)]}),_0x57eaa4=_0x2e4772[_0x51dadf(0x17c)];_0x5a3780[_0x51dadf(0x14b)]&&(console[_0x51dadf(0x139)](_0x51dadf(0x10d)+_0x57eaa4[_0x51dadf(0x105)]),console[_0x51dadf(0x139)](_0x51dadf(0x134)+_0x57eaa4[_0x51dadf(0xfb)]),_0x57eaa4[_0x51dadf(0x149)]&&console[_0x51dadf(0x139)](_0x51dadf(0x18c)+_0x57eaa4[_0x51dadf(0x149)]),_0x57eaa4[_0x51dadf(0x10a)]&&console[_0x51dadf(0x139)](_0x51dadf(0x170)+_0x57eaa4[_0x51dadf(0x10a)]));if(_0x57eaa4[_0x51dadf(0x105)]===_0x51dadf(0x163)){const _0x543cab=await withSpinner('Fetching\x20parent\x20segment\x20details...',()=>_0x3a989c[_0x51dadf(0x175)][_0x51dadf(0x179)](_0x57eaa4[_0x51dadf(0xfb)]),{'verbose':_0x5a3780['verbose']});await handleSingleObjectOutput(_0x543cab[_0x51dadf(0x17c)],_0x5a3780);}else{if(_0x57eaa4[_0x51dadf(0x105)]==='folder'){if(!_0x57eaa4['folderId'])throw new SDKError(ErrorCode[_0x51dadf(0x191)],_0x51dadf(0x19b));const _0x2f10d1=await withSpinner('Fetching\x20folder\x20details...',()=>_0x3a989c[_0x51dadf(0x175)][_0x51dadf(0x161)](_0x57eaa4[_0x51dadf(0x149)]),{'verbose':_0x5a3780['verbose']});await handleSingleObjectOutput(_0x2f10d1[_0x51dadf(0x17c)],_0x5a3780);}else{if(_0x57eaa4[_0x51dadf(0x105)]===_0x51dadf(0x175)){if(!_0x57eaa4['segmentId'])throw new SDKError(ErrorCode[_0x51dadf(0xfc)],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x5c546e=await withSpinner(_0x51dadf(0x129),()=>_0x3a989c[_0x51dadf(0x175)]['getSegment'](_0x57eaa4['parentId'],_0x57eaa4[_0x51dadf(0x10a)]),{'verbose':_0x5a3780[_0x51dadf(0x14b)]});await handleSingleObjectOutput(_0x5c546e[_0x51dadf(0x17c)],_0x5a3780);}}}return 0x0;}catch(_0x372d4f){if(_0x372d4f instanceof SDKError)return console[_0x51dadf(0x139)](_0x51dadf(0x146)+_0x372d4f['message']),_0x372d4f[_0x51dadf(0x165)]&&console[_0x51dadf(0x139)](_0x51dadf(0x181)+_0x372d4f[_0x51dadf(0x165)]),0x1;throw _0x372d4f;}}}export class SegmentShowCommand extends BaseCommand{[a37_0x3584bc(0x148)]=a37_0x3584bc(0x169);[a37_0x3584bc(0x108)]='Execute\x20child\x20segment\x20SQL\x20query\x20and\x20show\x20results';async[a37_0x3584bc(0x160)](_0x49a443){const _0x2f88ef=a37_0x3584bc,{options:_0x363605,args:_0x31d559,tdx:_0x4ace64}=_0x49a443,_0x3b3d15=_0x31d559[0x0];if(!_0x3b3d15)return console['error']('Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required'),console[_0x2f88ef(0x139)](_0x2f88ef(0x130)),console[_0x2f88ef(0x139)](_0x2f88ef(0x15f)),console[_0x2f88ef(0x139)](_0x2f88ef(0x100)),console[_0x2f88ef(0x139)](_0x2f88ef(0x123)),console[_0x2f88ef(0x139)](_0x2f88ef(0x11e)),0x1;try{const _0x20b9a3=_0x363605[_0x2f88ef(0x182)],_0x5a2565=await resolveSegmentTarget(_0x3b3d15,_0x20b9a3,_0x363605[_0x2f88ef(0x14b)]);_0x363605[_0x2f88ef(0x14b)]&&console[_0x2f88ef(0x139)]('Target\x20path:\x20'+_0x5a2565);const _0x29a2f9=await withSpinner('Resolving\x20\x27'+_0x3b3d15+_0x2f88ef(0x13a),()=>_0x4ace64['segment'][_0x2f88ef(0x11d)](_0x5a2565),{'verbose':_0x363605[_0x2f88ef(0x14b)]}),_0xdbf8fc=_0x29a2f9[_0x2f88ef(0x17c)];_0x363605[_0x2f88ef(0x14b)]&&(console[_0x2f88ef(0x139)](_0x2f88ef(0x10d)+_0xdbf8fc[_0x2f88ef(0x105)]),console[_0x2f88ef(0x139)](_0x2f88ef(0x134)+_0xdbf8fc[_0x2f88ef(0xfb)]));if(_0xdbf8fc[_0x2f88ef(0x105)]===_0x2f88ef(0x166))return console[_0x2f88ef(0x139)]('Error:\x20Cannot\x20execute\x20SQL\x20query\x20on\x20a\x20folder.'),console[_0x2f88ef(0x139)](_0x2f88ef(0x183)),0x1;if(_0xdbf8fc[_0x2f88ef(0x105)]===_0x2f88ef(0x163))return console[_0x2f88ef(0x139)](_0x2f88ef(0x12e)),console['error'](_0x2f88ef(0x102)),0x1;if(!_0xdbf8fc[_0x2f88ef(0x10a)])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x2f88ef(0x16e));const _0x280d0f=await withSpinner(_0x2f88ef(0x18f),()=>_0x4ace64['segment'][_0x2f88ef(0x155)](_0xdbf8fc['parentId'],_0xdbf8fc[_0x2f88ef(0x10a)]),{'verbose':_0x363605['verbose']});let _0x7b3421=_0x280d0f['data'];const _0x226e5f=resolveLimit(_0x363605[_0x2f88ef(0x121)],DEFAULT_DISPLAY_LIMIT),_0xef1546=/\bLIMIT\s+\d+/i[_0x2f88ef(0x198)](_0x7b3421);!_0xef1546&&(_0x7b3421=_0x7b3421[_0x2f88ef(0x11a)]()[_0x2f88ef(0x111)](/;+$/,''),_0x7b3421=_0x2f88ef(0xfd)+_0x7b3421+_0x2f88ef(0x15d)+_0x226e5f);_0x363605[_0x2f88ef(0x14b)]&&console[_0x2f88ef(0x139)](_0x2f88ef(0x197)+_0x7b3421);const _0x383a18=await withProgressSpinner(_0x2f88ef(0x156),async _0x4f647a=>{const _0x23c6b6=_0x2f88ef,_0x2eecc6=await _0x4ace64['query'][_0x23c6b6(0x160)](_0x7b3421,{'catalog':'td','schema':'information_schema','onJobId':_0x3b71cf=>{_0x4f647a['setJobId'](_0x3b71cf);}});return _0x2eecc6;},{'verbose':_0x363605[_0x2f88ef(0x14b)]}),_0x7bce28=_0x383a18[_0x2f88ef(0x17c)],_0x3db709=_0x7bce28[_0x2f88ef(0x164)]?_0x2f88ef(0x184)+_0x7bce28[_0x2f88ef(0x164)]+']':'';return console[_0x2f88ef(0x139)](_0x2f88ef(0x196)+_0x7bce28[_0x2f88ef(0x150)]['processedRows'][_0x2f88ef(0x16f)]()+'\x20rows\x20'+(_0x2f88ef(0x128)+formatElapsed(_0x7bce28[_0x2f88ef(0x150)][_0x2f88ef(0x15a)])+_0x3db709)),await handleQueryOutput(_0x7bce28,_0x363605),0x0;}catch(_0x3de825){if(_0x3de825 instanceof SDKError)return console[_0x2f88ef(0x139)](_0x2f88ef(0x186)+_0x3de825['code']+']'),console[_0x2f88ef(0x139)]('\x0a'+_0x3de825['message']),0x1;throw _0x3de825;}}}export class SegmentFolderListCommand extends BaseCommand{[a37_0x3584bc(0x148)]='segment:folder:list';['description']=a37_0x3584bc(0x158);async[a37_0x3584bc(0x160)](_0x29889d){const _0x18cd2a=a37_0x3584bc,{options:_0x3e58a2,args:_0x16299b,tdx:_0x4a33c8}=_0x29889d;if(_0x16299b['length']===0x0)return console['error'](_0x18cd2a(0x141)),console[_0x18cd2a(0x139)](_0x18cd2a(0x168)),0x1;const _0xe8e0d0=_0x16299b[0x0];try{_0x3e58a2[_0x18cd2a(0x14b)]&&(console[_0x18cd2a(0x139)](_0x18cd2a(0x195)+_0x3e58a2[_0x18cd2a(0x145)]),console[_0x18cd2a(0x139)](_0x18cd2a(0x16a)+_0xe8e0d0));const _0x40f47d=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0xe8e0d0+_0x18cd2a(0x13a),()=>_0x4a33c8['segment'][_0x18cd2a(0x103)](_0xe8e0d0),{'verbose':_0x3e58a2[_0x18cd2a(0x14b)]}),_0x4d78ca=_0x40f47d[_0x18cd2a(0x17c)];_0x3e58a2['verbose']&&console[_0x18cd2a(0x139)](_0x18cd2a(0x101)+_0x4d78ca);const _0x408087=await withSpinner(_0x18cd2a(0x14c)+_0xe8e0d0+'\x27...',()=>_0x4a33c8[_0x18cd2a(0x175)][_0x18cd2a(0xff)](_0x4d78ca),{'verbose':_0x3e58a2[_0x18cd2a(0x14b)]}),_0x1da1a2=_0x408087[_0x18cd2a(0x17c)];return console['error']('✔\x20Found\x20'+_0x1da1a2[_0x18cd2a(0x10c)]+_0x18cd2a(0x14e)+(_0x1da1a2['length']!==0x1?'s':'')),await handleSDKOutput(_0x1da1a2,_0x3e58a2),0x0;}catch(_0xfb4088){if(_0xfb4088 instanceof SDKError)return console['error'](_0x18cd2a(0x146)+_0xfb4088[_0x18cd2a(0x122)]),_0xfb4088[_0x18cd2a(0x165)]&&console['error'](_0x18cd2a(0x181)+_0xfb4088[_0x18cd2a(0x165)]),0x1;throw _0xfb4088;}}}export class SegmentFolderShowCommand extends BaseCommand{[a37_0x3584bc(0x148)]=a37_0x3584bc(0x114);[a37_0x3584bc(0x108)]=a37_0x3584bc(0x127);async['execute'](_0x3c7a50){const _0x280ec6=a37_0x3584bc,{options:_0x44e30f,args:_0x476dba,tdx:_0xf312da}=_0x3c7a50;if(_0x476dba[_0x280ec6(0x10c)]===0x0)return console['error'](_0x280ec6(0x12a)),console[_0x280ec6(0x139)](_0x280ec6(0x172)),0x1;try{const {parentId:_0x3400d1,childId:_0x20c501}=parseSegmentRef(_0x476dba[0x0]);_0x44e30f[_0x280ec6(0x14b)]&&(console[_0x280ec6(0x139)](_0x280ec6(0x195)+_0x44e30f[_0x280ec6(0x145)]),console['error'](_0x280ec6(0x16a)+_0x3400d1),_0x20c501&&console[_0x280ec6(0x139)](_0x280ec6(0x119)+_0x20c501));if(!_0x20c501)return console['error'](_0x280ec6(0x190)),0x1;const _0x197b19=await withSpinner(_0x280ec6(0x140)+_0x3400d1+_0x280ec6(0x13a),()=>_0xf312da[_0x280ec6(0x175)][_0x280ec6(0x103)](_0x3400d1),{'verbose':_0x44e30f[_0x280ec6(0x14b)]}),_0x3407a3=_0x197b19['data'];_0x44e30f[_0x280ec6(0x14b)]&&console[_0x280ec6(0x139)](_0x280ec6(0x101)+_0x3407a3);const _0x3c9c1f=await withSpinner(_0x280ec6(0x178)+_0x20c501+'\x27...',()=>_0xf312da[_0x280ec6(0x175)][_0x280ec6(0x17d)](_0x3407a3,_0x20c501),{'verbose':_0x44e30f[_0x280ec6(0x14b)]}),_0x4a1082=_0x3c9c1f[_0x280ec6(0x17c)];_0x44e30f[_0x280ec6(0x14b)]&&console[_0x280ec6(0x139)](_0x280ec6(0x120)+_0x4a1082);const _0x9cdbcb=await withSpinner('Fetching\x20folder\x20\x27'+_0x20c501+_0x280ec6(0x13a),()=>_0xf312da[_0x280ec6(0x175)][_0x280ec6(0x161)](_0x4a1082),{'verbose':_0x44e30f['verbose']});return await handleSDKOutput([_0x9cdbcb[_0x280ec6(0x17c)]],_0x44e30f),0x0;}catch(_0x18de4c){if(_0x18de4c instanceof SDKError)return console[_0x280ec6(0x139)](_0x280ec6(0x146)+_0x18de4c[_0x280ec6(0x122)]),_0x18de4c[_0x280ec6(0x165)]&&console[_0x280ec6(0x139)](_0x280ec6(0x181)+_0x18de4c[_0x280ec6(0x165)]),0x1;throw _0x18de4c;}}}export class SegmentSQLCommand extends BaseCommand{['name']='segment:sql';[a37_0x3584bc(0x108)]=a37_0x3584bc(0x117);async[a37_0x3584bc(0x160)](_0x54e2ad){const _0x373767=a37_0x3584bc,{options:_0x182ce7,args:_0x556a9e}=_0x54e2ad,_0x1276ce=_0x182ce7,_0x7e3cf7=_0x1276ce[_0x373767(0x17e)],_0x21163a=_0x556a9e[0x0];if(!_0x21163a&&!_0x7e3cf7)return console[_0x373767(0x139)](a37_0x349ff1[_0x373767(0x173)](_0x373767(0x125))),console[_0x373767(0x139)]('Usage:'),console[_0x373767(0x139)](_0x373767(0x192)),console[_0x373767(0x139)](_0x373767(0x17b)),console['error'](_0x373767(0x100)),console[_0x373767(0x139)]('\x20\x20tdx\x20sg\x20sql\x20\x22Premium\x20Users\x22'),console[_0x373767(0x139)](_0x373767(0x115)),0x1;if(_0x21163a&&_0x7e3cf7)return console[_0x373767(0x139)](a37_0x349ff1[_0x373767(0x173)](_0x373767(0x133))),0x1;try{let _0x17e4af;if(_0x7e3cf7)_0x17e4af=await this[_0x373767(0x12d)](_0x7e3cf7,_0x54e2ad);else{if(isYamlFilePath(_0x21163a))return console['error'](a37_0x349ff1['red'](_0x373767(0x13c))),console[_0x373767(0x139)](_0x373767(0x152)+_0x21163a),0x1;else _0x17e4af=await this['getSQLFromServerSegment'](_0x21163a,_0x54e2ad);}return _0x182ce7[_0x373767(0x124)]===_0x373767(0x154)||_0x182ce7[_0x373767(0x124)]===_0x373767(0x177)?await handleSDKOutput([{'sql':_0x17e4af}],_0x182ce7):console[_0x373767(0x19a)](_0x17e4af),0x0;}catch(_0x3b64d3){if(_0x3b64d3 instanceof SDKError)return console['error'](_0x373767(0x146)+_0x3b64d3[_0x373767(0x122)]),_0x3b64d3['cause']&&console['error'](_0x373767(0x181)+_0x3b64d3[_0x373767(0x165)]),0x1;throw _0x3b64d3;}}async[a37_0x3584bc(0x12d)](_0x39a082,_0x19b10d){const _0x5a0bbe=a37_0x3584bc,{options:_0xe326d5,tdx:_0x28b6bb}=_0x19b10d;let _0x18ca8c;try{_0x18ca8c=await resolveYamlFilePath(_0x39a082);}catch(_0x5b6064){throw new SDKError(ErrorCode[_0x5a0bbe(0x14f)],_0x5a0bbe(0x109)+_0x5b6064['message']);}_0xe326d5[_0x5a0bbe(0x14b)]&&console['error'](_0x5a0bbe(0x171)+_0x18ca8c['parentSegment']+'/'+_0x18ca8c[_0x5a0bbe(0x144)]);const _0x31aa71=await withSpinner('Fetching\x20SQL\x20from\x20rule...',()=>_0x28b6bb['segment'][_0x5a0bbe(0x113)](_0x18ca8c[_0x5a0bbe(0x187)],_0x18ca8c['parentSegment'],_0x18ca8c[_0x5a0bbe(0x144)]),{'verbose':_0xe326d5[_0x5a0bbe(0x14b)]});return _0x31aa71[_0x5a0bbe(0x17c)];}async[a37_0x3584bc(0x104)](_0x5f0086,_0x2b5095){const _0x5c6914=a37_0x3584bc,{options:_0x2e5383,tdx:_0x1a898c}=_0x2b5095,_0x5222b0=_0x2e5383[_0x5c6914(0x182)],_0xcda637=await resolveSegmentTarget(_0x5f0086,_0x5222b0,_0x2e5383[_0x5c6914(0x14b)]);_0x2e5383[_0x5c6914(0x14b)]&&console[_0x5c6914(0x139)](_0x5c6914(0x180)+_0xcda637);const _0x396d9c=await withSpinner(_0x5c6914(0x15c)+_0x5f0086+_0x5c6914(0x13a),()=>_0x1a898c[_0x5c6914(0x175)][_0x5c6914(0x11d)](_0xcda637),{'verbose':_0x2e5383[_0x5c6914(0x14b)]}),_0x14c7ca=_0x396d9c[_0x5c6914(0x17c)];_0x2e5383[_0x5c6914(0x14b)]&&(console[_0x5c6914(0x139)]('Resolved\x20type:\x20'+_0x14c7ca['type']),console[_0x5c6914(0x139)](_0x5c6914(0x134)+_0x14c7ca[_0x5c6914(0xfb)]));if(_0x14c7ca[_0x5c6914(0x105)]===_0x5c6914(0x166))throw new SDKError(ErrorCode[_0x5c6914(0x14f)],_0x5c6914(0x13d));if(_0x14c7ca[_0x5c6914(0x105)]===_0x5c6914(0x163))throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x5c6914(0x13e));if(!_0x14c7ca[_0x5c6914(0x10a)])throw new SDKError(ErrorCode[_0x5c6914(0xfc)],_0x5c6914(0x16e));const _0x3c6c4c=await withSpinner('Fetching\x20SQL\x20for\x20segment...',()=>_0x1a898c[_0x5c6914(0x175)]['getSegmentSQL'](_0x14c7ca[_0x5c6914(0xfb)],_0x14c7ca['segmentId']),{'verbose':_0x2e5383[_0x5c6914(0x14b)]});return _0x3c6c4c[_0x5c6914(0x17c)];}}export class SegmentFolderCreateCommand extends BaseCommand{['name']=a37_0x3584bc(0x151);[a37_0x3584bc(0x108)]=a37_0x3584bc(0x126);async['execute'](_0x2cb4e5){const _0x34af0d=a37_0x3584bc,{options:_0x540dc2,args:_0x4c08a5,tdx:_0x3c99c9}=_0x2cb4e5,_0x1802c4=_0x540dc2;if(_0x4c08a5[_0x34af0d(0x10c)]<0x2)return console[_0x34af0d(0x139)](_0x34af0d(0x137)),console[_0x34af0d(0x139)](_0x34af0d(0x10b)),0x1;const _0x14cdcc=_0x4c08a5[0x0],_0x46e5b3=_0x4c08a5[0x1];_0x1802c4[_0x34af0d(0x14b)]&&(console[_0x34af0d(0x139)](_0x34af0d(0x195)+_0x1802c4[_0x34af0d(0x145)]),console[_0x34af0d(0x139)](_0x34af0d(0x112)+_0x14cdcc),console[_0x34af0d(0x139)](_0x34af0d(0x119)+_0x46e5b3));let _0x33fee9;if(_0x1802c4['parentFolder']){const _0x55098f=_0x1802c4[_0x34af0d(0x13f)],_0x13deac=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x14cdcc+_0x34af0d(0x13a),()=>_0x3c99c9[_0x34af0d(0x175)]['resolveParentId'](_0x14cdcc),{'verbose':_0x1802c4[_0x34af0d(0x14b)]}),_0x18d341=_0x13deac[_0x34af0d(0x17c)],_0xf4a253=await withSpinner(_0x34af0d(0x135)+_0x55098f+_0x34af0d(0x13a),()=>_0x3c99c9[_0x34af0d(0x175)][_0x34af0d(0x17d)](_0x18d341,_0x55098f),{'verbose':_0x1802c4[_0x34af0d(0x14b)]});_0x33fee9=_0xf4a253[_0x34af0d(0x17c)],_0x1802c4['verbose']&&console['error'](_0x34af0d(0x13b)+_0x33fee9);}const _0x495253={'name':_0x46e5b3,'description':_0x1802c4[_0x34af0d(0x108)],'parentFolderId':_0x33fee9},_0x189b97=await withSpinner(_0x34af0d(0x138)+_0x46e5b3+_0x34af0d(0x13a),()=>_0x3c99c9[_0x34af0d(0x175)][_0x34af0d(0x17f)](_0x14cdcc,_0x495253),{'verbose':_0x1802c4[_0x34af0d(0x14b)]}),_0x1648ab=_0x189b97[_0x34af0d(0x17c)];return console['error'](_0x34af0d(0x159)+_0x1648ab['name']+'\x27\x20with\x20ID:\x20'+_0x1648ab['id']),await handleSDKOutput([_0x1648ab],_0x1802c4),0x0;}}export class SegmentViewCommand extends BaseCommand{[a37_0x3584bc(0x148)]=a37_0x3584bc(0x10e);[a37_0x3584bc(0x108)]='Show\x20folder\x20or\x20child\x20segment\x20details';async[a37_0x3584bc(0x160)](_0xf61763){const _0xcebfd3=a37_0x3584bc,{options:_0x590960,args:_0x53f32d,tdx:_0x26c698}=_0xf61763,_0x123405=_0x53f32d[0x0];if(!_0x123405)return console[_0xcebfd3(0x139)](_0xcebfd3(0x19d)),console['error']('Usage:\x20tdx\x20sg\x20view\x20<name>\x20[-w]'),console[_0xcebfd3(0x139)](_0xcebfd3(0x16d)),console[_0xcebfd3(0x139)]('Options:'),console['error'](_0xcebfd3(0x14d)),console[_0xcebfd3(0x139)](_0xcebfd3(0x100)),console[_0xcebfd3(0x139)](_0xcebfd3(0x12c)),console['error'](_0xcebfd3(0x16b)),console[_0xcebfd3(0x139)](_0xcebfd3(0x16c)),console[_0xcebfd3(0x139)](_0xcebfd3(0x11f)),0x1;try{const _0xeb153=_0x590960[_0xcebfd3(0x182)],_0x466549=await resolveSegmentTarget(_0x123405,_0xeb153,_0x590960[_0xcebfd3(0x14b)]);_0x590960['verbose']&&console['error']('Target\x20path:\x20'+_0x466549);const _0x42e000=await withSpinner(_0xcebfd3(0x15c)+_0x123405+_0xcebfd3(0x13a),()=>_0x26c698[_0xcebfd3(0x175)][_0xcebfd3(0x11d)](_0x466549),{'verbose':_0x590960[_0xcebfd3(0x14b)]}),_0x4ecace=_0x42e000['data'];_0x590960[_0xcebfd3(0x14b)]&&(console['error'](_0xcebfd3(0x10d)+_0x4ecace[_0xcebfd3(0x105)]),console[_0xcebfd3(0x139)](_0xcebfd3(0x134)+_0x4ecace[_0xcebfd3(0xfb)]),_0x4ecace['folderId']&&console[_0xcebfd3(0x139)](_0xcebfd3(0x18c)+_0x4ecace[_0xcebfd3(0x149)]),_0x4ecace[_0xcebfd3(0x10a)]&&console[_0xcebfd3(0x139)]('Segment\x20ID:\x20'+_0x4ecace[_0xcebfd3(0x10a)]));if(_0x590960[_0xcebfd3(0x19e)]){if(_0x4ecace[_0xcebfd3(0x105)]===_0xcebfd3(0x166))return console[_0xcebfd3(0x139)]('Error:\x20Cannot\x20open\x20folder\x20in\x20web\x20browser.\x20Use\x20a\x20segment\x20name\x20instead.'),0x1;if(_0x4ecace['type']===_0xcebfd3(0x163))return console['error']('Error:\x20Cannot\x20open\x20parent\x20segment\x20with\x20this\x20command.'),console['error']('Use:\x20tdx\x20ps\x20view\x20-w'),0x1;if(!_0x4ecace[_0xcebfd3(0x10a)])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0xcebfd3(0x16e));const _0x4ff689=getConsoleNextUrl(_0x590960[_0xcebfd3(0x145)],_0xcebfd3(0x18b)+_0x4ecace[_0xcebfd3(0xfb)]+'/e/'+_0x4ecace['segmentId']);return console[_0xcebfd3(0x139)](a37_0x349ff1[_0xcebfd3(0x153)]('✔')+'\x20Opening\x20'+a37_0x349ff1[_0xcebfd3(0x174)](_0x4ff689)),openBrowser(_0x4ff689),0x0;}if(_0x4ecace[_0xcebfd3(0x105)]===_0xcebfd3(0x166)){if(!_0x4ecace[_0xcebfd3(0x149)])throw new SDKError(ErrorCode[_0xcebfd3(0x191)],_0xcebfd3(0x19b));const _0x129f1d=await withSpinner(_0xcebfd3(0x143),()=>_0x26c698[_0xcebfd3(0x175)]['getFolder'](_0x4ecace['folderId']),{'verbose':_0x590960[_0xcebfd3(0x14b)]});await handleSingleObjectOutput(_0x129f1d[_0xcebfd3(0x17c)],_0x590960);}else{if(_0x4ecace[_0xcebfd3(0x105)]===_0xcebfd3(0x175)){if(!_0x4ecace[_0xcebfd3(0x10a)])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0xcebfd3(0x16e));const _0x581f30=await withSpinner(_0xcebfd3(0x129),()=>_0x26c698['segment'][_0xcebfd3(0x106)](_0x4ecace[_0xcebfd3(0xfb)],_0x4ecace[_0xcebfd3(0x10a)]),{'verbose':_0x590960[_0xcebfd3(0x14b)]}),_0x2733ec=getConsoleNextUrl(_0x590960[_0xcebfd3(0x145)],'/app/ps/'+_0x4ecace[_0xcebfd3(0xfb)]+_0xcebfd3(0x11b)+_0x4ecace[_0xcebfd3(0x10a)]),_0x55ef66=_0x581f30[_0xcebfd3(0x17c)];_0x55ef66[_0xcebfd3(0x15b)]=_0x2733ec,await handleSingleObjectOutput(_0x55ef66,_0x590960);}else return console[_0xcebfd3(0x139)]('Error:\x20Cannot\x20view\x20parent\x20segment\x20details\x20with\x20this\x20command.'),console[_0xcebfd3(0x139)](_0xcebfd3(0x194)),0x1;}return 0x0;}catch(_0x3ee25b){if(_0x3ee25b instanceof SDKError)return console[_0xcebfd3(0x139)](_0xcebfd3(0x146)+_0x3ee25b[_0xcebfd3(0x122)]),_0x3ee25b[_0xcebfd3(0x165)]&&console[_0xcebfd3(0x139)](_0xcebfd3(0x181)+_0x3ee25b[_0xcebfd3(0x165)]),0x1;throw _0x3ee25b;}}}export const SegmentInfoCommand=SegmentViewCommand;export class SegmentDescCommand extends BaseCommand{[a37_0x3584bc(0x148)]='segment:desc';[a37_0x3584bc(0x108)]='Show\x20child\x20segment\x20schema\x20(column\x20types)';async['execute'](_0x56fd2d){const _0x56a57b=a37_0x3584bc,{options:_0x5eec3e,args:_0x18760d,tdx:_0x4dc710}=_0x56fd2d,_0x125080=_0x18760d[0x0];if(!_0x125080)return console['error']('Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required'),console[_0x56a57b(0x139)]('Usage:\x20tdx\x20sg\x20desc\x20<name>'),console[_0x56a57b(0x139)](_0x56a57b(0x199)),console[_0x56a57b(0x139)](_0x56a57b(0x100)),console['error'](_0x56a57b(0x12b)),console[_0x56a57b(0x139)](_0x56a57b(0x15e)),0x1;try{const _0x1f0112=_0x5eec3e['parentSegment'],_0x52bfe8=await resolveSegmentTarget(_0x125080,_0x1f0112,_0x5eec3e[_0x56a57b(0x14b)]);_0x5eec3e['verbose']&&console[_0x56a57b(0x139)](_0x56a57b(0x180)+_0x52bfe8);const _0x23cd53=await withSpinner(_0x56a57b(0x15c)+_0x125080+_0x56a57b(0x13a),()=>_0x4dc710[_0x56a57b(0x175)][_0x56a57b(0x11d)](_0x52bfe8),{'verbose':_0x5eec3e[_0x56a57b(0x14b)]}),_0x58a030=_0x23cd53[_0x56a57b(0x17c)];_0x5eec3e[_0x56a57b(0x14b)]&&(console['error']('Resolved\x20type:\x20'+_0x58a030[_0x56a57b(0x105)]),console[_0x56a57b(0x139)]('Parent\x20ID:\x20'+_0x58a030[_0x56a57b(0xfb)]));if(_0x58a030[_0x56a57b(0x105)]===_0x56a57b(0x166))return console[_0x56a57b(0x139)](_0x56a57b(0x118)),console['error']('Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.'),0x1;if(_0x58a030[_0x56a57b(0x105)]===_0x56a57b(0x163))return console['error'](_0x56a57b(0x17a)),console[_0x56a57b(0x139)](_0x56a57b(0x19c)),0x1;if(!_0x58a030['segmentId'])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x56a57b(0x16e));const _0x5da231=await withSpinner(_0x56a57b(0x18f),()=>_0x4dc710['segment'][_0x56a57b(0x155)](_0x58a030[_0x56a57b(0xfb)],_0x58a030[_0x56a57b(0x10a)]),{'verbose':_0x5eec3e[_0x56a57b(0x14b)]}),_0xf51f13=_0x5da231[_0x56a57b(0x17c)],_0x421858=await executeSchemaQuery(_0xf51f13,_0x4dc710,_0x5eec3e);return await handleQueryOutput(_0x421858,_0x5eec3e),0x0;}catch(_0x3ace9f){if(_0x3ace9f instanceof SDKError)return console[_0x56a57b(0x139)](_0x56a57b(0x146)+_0x3ace9f[_0x56a57b(0x122)]),_0x3ace9f[_0x56a57b(0x165)]&&console[_0x56a57b(0x139)](_0x56a57b(0x181)+_0x3ace9f[_0x56a57b(0x165)]),0x1;throw _0x3ace9f;}}}
@@ -1 +1 @@
1
- function a38_0x9c64(_0x4f831b,_0x2b1f44){_0x4f831b=_0x4f831b-0xe1;const _0x5b4b82=a38_0x5b4b();let _0x9c644a=_0x5b4b82[_0x4f831b];return _0x9c644a;}const a38_0x8693c4=a38_0x9c64;(function(_0x38d5b4,_0x1d78f7){const _0x488b4e=a38_0x9c64,_0x258e94=_0x38d5b4();while(!![]){try{const _0x5f12b4=-parseInt(_0x488b4e(0xe7))/0x1+parseInt(_0x488b4e(0xe5))/0x2*(-parseInt(_0x488b4e(0xf8))/0x3)+-parseInt(_0x488b4e(0xe8))/0x4+-parseInt(_0x488b4e(0x115))/0x5+-parseInt(_0x488b4e(0xf1))/0x6+parseInt(_0x488b4e(0x104))/0x7*(parseInt(_0x488b4e(0x103))/0x8)+parseInt(_0x488b4e(0x105))/0x9;if(_0x5f12b4===_0x1d78f7)break;else _0x258e94['push'](_0x258e94['shift']());}catch(_0x3197bf){_0x258e94['push'](_0x258e94['shift']());}}}(a38_0x5b4b,0x8bb6e));function a38_0x5b4b(){const _0x29e0eb=['24ofKMbv','766066IlYncm','15528726vlzkCO','execute','⚠\x20Deprecation\x20warning:\x20`segment\x20create`\x20is\x20deprecated.','Resolving\x20parent\x20segment\x20\x27','kind','Error:\x20Full\x20path\x20required\x20(parent/segment_name\x20or\x20parent/folder/segment_name)','folderId','Resolving\x20folder\x20\x27','data','invisible','segment','description','\x20\x20\x20Path:\x20','Creating\x20segment\x20\x27','Parent\x20path:\x20','Segment\x20name:\x20','351340XPSNPU','resolveParentId','\x27...','\x20\x20tdx\x20segment\x20create\x20\x22Premium\x22\x20--rule\x20\x27...\x27\x20\x20#\x20Relative\x20to\x20context','\x20\x20Use\x20`tdx\x20sg\x20push`\x20with\x20YAML\x20files\x20instead.\x0a','986EgErhW','length','551117raEDPL','229688diGSbQ','Parent:\x20','createSegment','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/High\x20Value\x22\x20--rule\x20\x27...\x27','Usage:\x20tdx\x20segment\x20create\x20<parent/segment_name>\x20[options]','Site:\x20','segments','name','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/Marketing/Premium\x22\x20--rule\x20\x27...\x27','4298256ZfuOBH','ruleFile','Resolved\x20relative\x20path\x20to:\x20','yellow','error','Resolving\x20folder\x20path\x20\x27','Error:\x20Segment\x20path\x20or\x20name\x20is\x20required','525UlMKoC','folder','resolvePathToResource','verbose','segment:create','rule','Target\x20path:\x20','✔\x20Created\x20segment\x20\x27','segmentPath','includes','site'];a38_0x5b4b=function(){return _0x29e0eb;};return a38_0x5b4b();}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_0x250082 from'chalk';export class SegmentCreateCommand extends BaseCommand{['name']=a38_0x8693c4(0xfc);[a38_0x8693c4(0x110)]='Create\x20child\x20segment\x20with\x20filtering\x20rules';async[a38_0x8693c4(0x106)](_0x229c0b){const _0x5cb7b0=a38_0x8693c4;console[_0x5cb7b0(0xf5)](a38_0x250082[_0x5cb7b0(0xf4)](_0x5cb7b0(0x107))),console[_0x5cb7b0(0xf5)](a38_0x250082[_0x5cb7b0(0xf4)](_0x5cb7b0(0xe4)));const {options:_0x1ac583,args:_0x3318a2,tdx:_0xc3cfd4}=_0x229c0b,_0x3b7d7c=_0x1ac583;if(_0x3318a2[_0x5cb7b0(0xe6)]===0x0)return console[_0x5cb7b0(0xf5)](_0x5cb7b0(0xf7)),console[_0x5cb7b0(0xf5)]('Usage:\x20tdx\x20segment\x20create\x20<path>\x20[options]'),console[_0x5cb7b0(0xf5)]('Examples:'),console[_0x5cb7b0(0xf5)](_0x5cb7b0(0xeb)),console['error'](_0x5cb7b0(0xf0)),console[_0x5cb7b0(0xf5)](_0x5cb7b0(0xe3)),0x1;const _0x14f2f5=_0x3318a2[0x0],_0x34e233=_0x1ac583[_0x5cb7b0(0x100)];let _0x4cfd61=_0x14f2f5;_0x34e233&&!_0x14f2f5[_0x5cb7b0(0x101)]('/')&&(_0x4cfd61=_0x34e233+'/'+_0x14f2f5,_0x3b7d7c[_0x5cb7b0(0xfb)]&&console[_0x5cb7b0(0xf5)](_0x5cb7b0(0xf3)+_0x4cfd61));const _0x447563=parsePath(_0x4cfd61);if(_0x447563['segments'][_0x5cb7b0(0xe6)]<0x2)return console[_0x5cb7b0(0xf5)](_0x5cb7b0(0x10a)),console[_0x5cb7b0(0xf5)](_0x5cb7b0(0xec)),0x1;const _0x1de79a=_0x447563[_0x5cb7b0(0xee)][0x0],_0x14b2fd=getBaseName(_0x4cfd61),_0x4ff925=getParentPath(_0x4cfd61);_0x3b7d7c[_0x5cb7b0(0xfb)]&&(console[_0x5cb7b0(0xf5)](_0x5cb7b0(0xed)+_0x3b7d7c[_0x5cb7b0(0x102)]),console['error'](_0x5cb7b0(0xfe)+_0x4cfd61),console[_0x5cb7b0(0xf5)](_0x5cb7b0(0xe9)+_0x1de79a),console[_0x5cb7b0(0xf5)](_0x5cb7b0(0x114)+_0x14b2fd),console[_0x5cb7b0(0xf5)](_0x5cb7b0(0x113)+_0x4ff925));const _0x54d5ce=await withSpinner(_0x5cb7b0(0x108)+_0x1de79a+'\x27...',()=>_0xc3cfd4[_0x5cb7b0(0x10f)][_0x5cb7b0(0xe1)](_0x1de79a),{'verbose':_0x3b7d7c[_0x5cb7b0(0xfb)]}),_0x1574d3=_0x54d5ce[_0x5cb7b0(0x10d)];let _0x454b45;if(_0x447563[_0x5cb7b0(0xee)]['length']>0x2){const _0x22ade6=await withSpinner(_0x5cb7b0(0xf6)+_0x4ff925+_0x5cb7b0(0xe2),()=>_0xc3cfd4[_0x5cb7b0(0x10f)][_0x5cb7b0(0xfa)](_0x4ff925),{'verbose':_0x3b7d7c[_0x5cb7b0(0xfb)]}),_0x466a0=_0x22ade6[_0x5cb7b0(0x10d)];if(_0x466a0['type']!==_0x5cb7b0(0xf9)&&_0x466a0['type']!=='parent')return console[_0x5cb7b0(0xf5)]('Error:\x20Cannot\x20create\x20segment\x20in\x20a\x20segment.\x20Parent\x20path\x20must\x20be\x20a\x20folder\x20or\x20parent.'),0x1;_0x454b45=_0x466a0[_0x5cb7b0(0x10b)];}else{if(_0x3b7d7c[_0x5cb7b0(0xf9)]){const _0x65a9d7=await withSpinner(_0x5cb7b0(0x10c)+_0x3b7d7c[_0x5cb7b0(0xf9)]+_0x5cb7b0(0xe2),()=>_0xc3cfd4[_0x5cb7b0(0x10f)]['resolveFolderId'](_0x1574d3,_0x3b7d7c[_0x5cb7b0(0xf9)]),{'verbose':_0x3b7d7c['verbose']});_0x454b45=_0x65a9d7[_0x5cb7b0(0x10d)];}}_0x3b7d7c[_0x5cb7b0(0xfb)]&&_0x454b45&&console[_0x5cb7b0(0xf5)]('Resolved\x20folder\x20ID:\x20'+_0x454b45);const _0x1a32bc=await loadJSONFromOptions(_0x3b7d7c[_0x5cb7b0(0xfd)],_0x3b7d7c[_0x5cb7b0(0xf2)]),_0x54a13c={'name':_0x14b2fd,'description':_0x3b7d7c[_0x5cb7b0(0x110)],'rule':_0x1a32bc,'kind':_0x3b7d7c[_0x5cb7b0(0x109)]!==undefined?parseInt(_0x3b7d7c[_0x5cb7b0(0x109)],0xa):undefined,'isVisible':_0x3b7d7c[_0x5cb7b0(0x10e)]?![]:undefined,'segmentFolderId':_0x454b45,'countPopulation':_0x3b7d7c['noCountPopulation']?![]:undefined},_0x2fadcd=await withSpinner(_0x5cb7b0(0x112)+_0x14b2fd+'\x27...',()=>_0xc3cfd4[_0x5cb7b0(0x10f)][_0x5cb7b0(0xea)](_0x1574d3,_0x54a13c),{'verbose':_0x3b7d7c[_0x5cb7b0(0xfb)]}),_0x42d523=_0x2fadcd[_0x5cb7b0(0x10d)];return console['error'](_0x5cb7b0(0xff)+_0x42d523[_0x5cb7b0(0xef)]+'\x27\x20with\x20ID:\x20'+_0x42d523['id']),_0x4cfd61!==_0x14f2f5&&console[_0x5cb7b0(0xf5)](_0x5cb7b0(0x111)+_0x4cfd61),await handleSDKOutput([_0x42d523],_0x3b7d7c),0x0;}}
1
+ const a38_0xb7b3f4=a38_0x3ab6;(function(_0x9c6ec4,_0x1e9a14){const _0x135a28=a38_0x3ab6,_0xa33d20=_0x9c6ec4();while(!![]){try{const _0x49a981=-parseInt(_0x135a28(0x188))/0x1*(parseInt(_0x135a28(0x18e))/0x2)+parseInt(_0x135a28(0x185))/0x3+-parseInt(_0x135a28(0x177))/0x4+-parseInt(_0x135a28(0x179))/0x5*(parseInt(_0x135a28(0x189))/0x6)+parseInt(_0x135a28(0x16d))/0x7*(parseInt(_0x135a28(0x182))/0x8)+parseInt(_0x135a28(0x175))/0x9*(parseInt(_0x135a28(0x160))/0xa)+parseInt(_0x135a28(0x18c))/0xb*(parseInt(_0x135a28(0x17e))/0xc);if(_0x49a981===_0x1e9a14)break;else _0xa33d20['push'](_0xa33d20['shift']());}catch(_0x158117){_0xa33d20['push'](_0xa33d20['shift']());}}}(a38_0x621a,0x6e341));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';function a38_0x3ab6(_0x52b4a8,_0x3c4912){_0x52b4a8=_0x52b4a8-0x15f;const _0x621aca=a38_0x621a();let _0x3ab6a0=_0x621aca[_0x52b4a8];return _0x3ab6a0;}import a38_0x5896c7 from'chalk';export class SegmentCreateCommand extends BaseCommand{['name']='segment:create';['description']=a38_0xb7b3f4(0x166);async['execute'](_0x2ddc99){const _0x289749=a38_0xb7b3f4;console[_0x289749(0x173)](a38_0x5896c7['yellow']('⚠\x20Deprecation\x20warning:\x20`segment\x20create`\x20is\x20deprecated.')),console['error'](a38_0x5896c7[_0x289749(0x187)]('\x20\x20Use\x20`tdx\x20sg\x20push`\x20with\x20YAML\x20files\x20instead.\x0a'));const {options:_0x238e19,args:_0x483d80,tdx:_0x46afb4}=_0x2ddc99,_0x17f10f=_0x238e19;if(_0x483d80[_0x289749(0x165)]===0x0)return console[_0x289749(0x173)](_0x289749(0x186)),console[_0x289749(0x173)](_0x289749(0x169)),console[_0x289749(0x173)](_0x289749(0x16e)),console[_0x289749(0x173)](_0x289749(0x16c)),console[_0x289749(0x173)](_0x289749(0x167)),console[_0x289749(0x173)](_0x289749(0x180)),0x1;const _0x21b52d=_0x483d80[0x0],_0x44a196=_0x238e19[_0x289749(0x16b)];let _0x1caa08=_0x21b52d;_0x44a196&&!_0x21b52d[_0x289749(0x162)]('/')&&(_0x1caa08=_0x44a196+'/'+_0x21b52d,_0x17f10f[_0x289749(0x171)]&&console[_0x289749(0x173)](_0x289749(0x17b)+_0x1caa08));const _0x58cb2d=parsePath(_0x1caa08);if(_0x58cb2d[_0x289749(0x16a)][_0x289749(0x165)]<0x2)return console[_0x289749(0x173)]('Error:\x20Full\x20path\x20required\x20(parent/segment_name\x20or\x20parent/folder/segment_name)'),console['error']('Usage:\x20tdx\x20segment\x20create\x20<parent/segment_name>\x20[options]'),0x1;const _0x1883c9=_0x58cb2d[_0x289749(0x16a)][0x0],_0x4dae41=getBaseName(_0x1caa08),_0x2dd39e=getParentPath(_0x1caa08);_0x17f10f[_0x289749(0x171)]&&(console[_0x289749(0x173)](_0x289749(0x191)+_0x17f10f['site']),console[_0x289749(0x173)](_0x289749(0x18b)+_0x1caa08),console['error']('Parent:\x20'+_0x1883c9),console[_0x289749(0x173)](_0x289749(0x18f)+_0x4dae41),console[_0x289749(0x173)]('Parent\x20path:\x20'+_0x2dd39e));const _0xbd9b4a=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x1883c9+_0x289749(0x168),()=>_0x46afb4[_0x289749(0x181)]['resolveParentId'](_0x1883c9),{'verbose':_0x17f10f[_0x289749(0x171)]}),_0x5ec185=_0xbd9b4a['data'];let _0x5a4b6c;if(_0x58cb2d[_0x289749(0x16a)]['length']>0x2){const _0xdf52e0=await withSpinner(_0x289749(0x170)+_0x2dd39e+'\x27...',()=>_0x46afb4[_0x289749(0x181)]['resolvePathToResource'](_0x2dd39e),{'verbose':_0x17f10f['verbose']}),_0x1fc846=_0xdf52e0['data'];if(_0x1fc846[_0x289749(0x17a)]!==_0x289749(0x17d)&&_0x1fc846[_0x289749(0x17a)]!==_0x289749(0x174))return console[_0x289749(0x173)]('Error:\x20Cannot\x20create\x20segment\x20in\x20a\x20segment.\x20Parent\x20path\x20must\x20be\x20a\x20folder\x20or\x20parent.'),0x1;_0x5a4b6c=_0x1fc846[_0x289749(0x18d)];}else{if(_0x17f10f['folder']){const _0x744f8d=await withSpinner(_0x289749(0x18a)+_0x17f10f[_0x289749(0x17d)]+'\x27...',()=>_0x46afb4[_0x289749(0x181)][_0x289749(0x17f)](_0x5ec185,_0x17f10f['folder']),{'verbose':_0x17f10f[_0x289749(0x171)]});_0x5a4b6c=_0x744f8d[_0x289749(0x184)];}}_0x17f10f[_0x289749(0x171)]&&_0x5a4b6c&&console[_0x289749(0x173)](_0x289749(0x176)+_0x5a4b6c);const _0x327f0b=await loadJSONFromOptions(_0x17f10f[_0x289749(0x172)],_0x17f10f[_0x289749(0x15f)]),_0x58a667={'name':_0x4dae41,'description':_0x17f10f[_0x289749(0x17c)],'rule':_0x327f0b,'kind':_0x17f10f[_0x289749(0x16f)]!==undefined?parseInt(_0x17f10f[_0x289749(0x16f)],0xa):undefined,'isVisible':_0x17f10f[_0x289749(0x190)]?![]:undefined,'segmentFolderId':_0x5a4b6c,'countPopulation':_0x17f10f[_0x289749(0x163)]?![]:undefined},_0x5ad924=await withSpinner('Creating\x20segment\x20\x27'+_0x4dae41+_0x289749(0x168),()=>_0x46afb4[_0x289749(0x181)]['createSegment'](_0x5ec185,_0x58a667),{'verbose':_0x17f10f['verbose']}),_0x3cf9ca=_0x5ad924[_0x289749(0x184)];return console['error'](_0x289749(0x164)+_0x3cf9ca[_0x289749(0x178)]+_0x289749(0x183)+_0x3cf9ca['id']),_0x1caa08!==_0x21b52d&&console[_0x289749(0x173)](_0x289749(0x161)+_0x1caa08),await handleSDKOutput([_0x3cf9ca],_0x17f10f),0x0;}}function a38_0x621a(){const _0x331e17=['length','Create\x20child\x20segment\x20with\x20filtering\x20rules','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/Marketing/Premium\x22\x20--rule\x20\x27...\x27','\x27...','Usage:\x20tdx\x20segment\x20create\x20<path>\x20[options]','segments','segmentPath','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/High\x20Value\x22\x20--rule\x20\x27...\x27','553KNTwSN','Examples:','kind','Resolving\x20folder\x20path\x20\x27','verbose','rule','error','parent','5719320RwFCMI','Resolved\x20folder\x20ID:\x20','2215032aGcnQv','name','385370EOHmxi','type','Resolved\x20relative\x20path\x20to:\x20','description','folder','93972SIGJoO','resolveFolderId','\x20\x20tdx\x20segment\x20create\x20\x22Premium\x22\x20--rule\x20\x27...\x27\x20\x20#\x20Relative\x20to\x20context','segment','10456TuCGPS','\x27\x20with\x20ID:\x20','data','1933482GlkRQH','Error:\x20Segment\x20path\x20or\x20name\x20is\x20required','yellow','139fjoMIQ','42KPVtjS','Resolving\x20folder\x20\x27','Target\x20path:\x20','275vfHAdR','folderId','494PkxWEX','Segment\x20name:\x20','invisible','Site:\x20','ruleFile','10ZOHZxJ','\x20\x20\x20Path:\x20','includes','noCountPopulation','✔\x20Created\x20segment\x20\x27'];a38_0x621a=function(){return _0x331e17;};return a38_0x621a();}
@@ -1 +1 @@
1
- const a39_0x436909=a39_0x492d;(function(_0x5068e1,_0x419bf0){const _0x29143b=a39_0x492d,_0x3fd21b=_0x5068e1();while(!![]){try{const _0x2f850c=-parseInt(_0x29143b(0x188))/0x1+-parseInt(_0x29143b(0x18f))/0x2+-parseInt(_0x29143b(0x197))/0x3*(-parseInt(_0x29143b(0x184))/0x4)+-parseInt(_0x29143b(0x182))/0x5*(-parseInt(_0x29143b(0x18a))/0x6)+-parseInt(_0x29143b(0x195))/0x7*(-parseInt(_0x29143b(0x183))/0x8)+-parseInt(_0x29143b(0x191))/0x9+parseInt(_0x29143b(0x186))/0xa*(parseInt(_0x29143b(0x189))/0xb);if(_0x2f850c===_0x419bf0)break;else _0x3fd21b['push'](_0x3fd21b['shift']());}catch(_0xbdc96b){_0x3fd21b['push'](_0x3fd21b['shift']());}}}(a39_0x2427,0x6c44e));import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../core/command-output.js';function a39_0x492d(_0x350175,_0x482dee){_0x350175=_0x350175-0x181;const _0x242760=a39_0x2427();let _0x492d52=_0x242760[_0x350175];return _0x492d52;}function a39_0x2427(){const _0x2237d2=['\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','3792420YwOaEV','parentSegment','513302cyLgxZ','11zCjrvx','876JYybZG','data','List\x20available\x20fields\x20for\x20segmentation','segment:fields','verbose','1106792amfAIe','\x27...','5792805qpBEyo','name','Site:\x20','segment','14ECVwyL','Error:\x20Parent\x20segment\x20name\x20is\x20required','730557TLVBQN','length','error','Usage:\x20tdx\x20segment\x20fields\x20<parent_name>','Listing\x20fields\x20for\x20\x27','description','29660WMghad','2659920DssmhQ','4pVambt'];a39_0x2427=function(){return _0x2237d2;};return a39_0x2427();}import{withSpinner}from'../utils/spinner.js';import{displayFieldsHumanReadable}from'../sdk/segment/fields-display.js';export class SegmentFieldsCommand extends BaseCommand{[a39_0x436909(0x192)]=a39_0x436909(0x18d);[a39_0x436909(0x181)]=a39_0x436909(0x18c);async['execute'](_0x512a4a){const _0x24392a=a39_0x436909,{options:_0x281680,args:_0x9a9005,tdx:_0x19aacd}=_0x512a4a,_0x3a9c3f=_0x9a9005[0x0]||_0x281680[_0x24392a(0x187)];if(!_0x3a9c3f)return console[_0x24392a(0x199)](_0x24392a(0x196)),console[_0x24392a(0x199)](_0x24392a(0x19a)),console[_0x24392a(0x199)](_0x24392a(0x185)),0x1;_0x281680[_0x24392a(0x18e)]&&(console['error'](_0x24392a(0x193)+_0x281680['site']),console['error']('Parent\x20segment:\x20'+_0x3a9c3f));const _0x59c69f=await withSpinner(_0x24392a(0x19b)+_0x3a9c3f+_0x24392a(0x190),()=>_0x19aacd[_0x24392a(0x194)]['listFields'](_0x3a9c3f),{'verbose':_0x281680[_0x24392a(0x18e)]}),_0x4eb48a=_0x59c69f[_0x24392a(0x18b)];console[_0x24392a(0x199)]('✔\x20Found\x20'+_0x4eb48a['length']+'\x20field'+(_0x4eb48a[_0x24392a(0x198)]!==0x1?'s':''));if(_0x281680['json']||_0x281680['jsonl'])return await handleSDKOutput(_0x4eb48a,_0x281680),0x0;return displayFieldsHumanReadable(_0x4eb48a,_0x3a9c3f),0x0;}}
1
+ const a39_0x79fbfb=a39_0xbbb8;(function(_0x360093,_0x46d0c5){const _0x1abf51=a39_0xbbb8,_0x506206=_0x360093();while(!![]){try{const _0x5ed34d=-parseInt(_0x1abf51(0x12e))/0x1+parseInt(_0x1abf51(0x112))/0x2+-parseInt(_0x1abf51(0x119))/0x3*(parseInt(_0x1abf51(0x123))/0x4)+-parseInt(_0x1abf51(0x121))/0x5*(-parseInt(_0x1abf51(0x12b))/0x6)+-parseInt(_0x1abf51(0x12c))/0x7*(parseInt(_0x1abf51(0x111))/0x8)+parseInt(_0x1abf51(0x129))/0x9*(-parseInt(_0x1abf51(0x11b))/0xa)+-parseInt(_0x1abf51(0x126))/0xb*(-parseInt(_0x1abf51(0x117))/0xc);if(_0x5ed34d===_0x46d0c5)break;else _0x506206['push'](_0x506206['shift']());}catch(_0x2cc412){_0x506206['push'](_0x506206['shift']());}}}(a39_0x24a4,0x8a203));import{BaseCommand}from'./command.js';function a39_0xbbb8(_0x16f4e4,_0x403fb3){_0x16f4e4=_0x16f4e4-0x10f;const _0x24a457=a39_0x24a4();let _0xbbb838=_0x24a457[_0x16f4e4];return _0xbbb838;}import{handleSDKOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';function a39_0x24a4(){const _0x157d84=['6789SuVHkp','execute','10VGMUuO','site','description','parentSegment','length','error','922505KAHEkh','data','1624QCOsIw','segment','jsonl','11pvuxOS','verbose','listFields','1588473xtCzfA','✔\x20Found\x20','18czLfcT','14035oyhSeo','Usage:\x20tdx\x20segment\x20fields\x20<parent_name>','437006xlUQBH','Site:\x20','Listing\x20fields\x20for\x20\x27','Error:\x20Parent\x20segment\x20name\x20is\x20required','2176kQqEVe','1424064ULqzDm','Parent\x20segment:\x20','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','json','List\x20available\x20fields\x20for\x20segmentation','16534428OAvkmR','name'];a39_0x24a4=function(){return _0x157d84;};return a39_0x24a4();}import{displayFieldsHumanReadable}from'../sdk/segment/fields-display.js';export class SegmentFieldsCommand extends BaseCommand{[a39_0x79fbfb(0x118)]='segment:fields';[a39_0x79fbfb(0x11d)]=a39_0x79fbfb(0x116);async[a39_0x79fbfb(0x11a)](_0x5cc43f){const _0x2a35bb=a39_0x79fbfb,{options:_0x4bce5b,args:_0x473565,tdx:_0xe4757a}=_0x5cc43f,_0x5845e0=_0x473565[0x0]||_0x4bce5b[_0x2a35bb(0x11e)];if(!_0x5845e0)return console[_0x2a35bb(0x120)](_0x2a35bb(0x110)),console[_0x2a35bb(0x120)](_0x2a35bb(0x12d)),console['error'](_0x2a35bb(0x114)),0x1;_0x4bce5b[_0x2a35bb(0x127)]&&(console[_0x2a35bb(0x120)](_0x2a35bb(0x12f)+_0x4bce5b[_0x2a35bb(0x11c)]),console['error'](_0x2a35bb(0x113)+_0x5845e0));const _0x7e990e=await withSpinner(_0x2a35bb(0x10f)+_0x5845e0+'\x27...',()=>_0xe4757a[_0x2a35bb(0x124)][_0x2a35bb(0x128)](_0x5845e0),{'verbose':_0x4bce5b[_0x2a35bb(0x127)]}),_0x5b127d=_0x7e990e[_0x2a35bb(0x122)];console[_0x2a35bb(0x120)](_0x2a35bb(0x12a)+_0x5b127d[_0x2a35bb(0x11f)]+'\x20field'+(_0x5b127d[_0x2a35bb(0x11f)]!==0x1?'s':''));if(_0x4bce5b[_0x2a35bb(0x115)]||_0x4bce5b[_0x2a35bb(0x125)])return await handleSDKOutput(_0x5b127d,_0x4bce5b),0x0;return displayFieldsHumanReadable(_0x5b127d,_0x5845e0),0x0;}}