@treasuredata/tdx 2026.3.54 → 2026.4.55

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 (254) 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.d.ts.map +1 -1
  9. package/dist/commands/agent-command.js +1 -1
  10. package/dist/commands/agent-command.js.map +1 -1
  11. package/dist/commands/agent-test-command.js +1 -1
  12. package/dist/commands/api-command.js +1 -1
  13. package/dist/commands/auth-command.js +1 -1
  14. package/dist/commands/cas-command.js +1 -1
  15. package/dist/commands/cas-segment-command.js +1 -1
  16. package/dist/commands/chat-command.js +1 -1
  17. package/dist/commands/claude-command.js +1 -1
  18. package/dist/commands/claude-statusline-command.js +1 -1
  19. package/dist/commands/claude-usage-command.js +1 -1
  20. package/dist/commands/command.js +1 -1
  21. package/dist/commands/connection-command.js +1 -1
  22. package/dist/commands/databases.js +1 -1
  23. package/dist/commands/delivery-command.js +1 -1
  24. package/dist/commands/describe.js +1 -1
  25. package/dist/commands/engage-campaign-pull-command.js +1 -1
  26. package/dist/commands/engage-campaign-push-command.js +1 -1
  27. package/dist/commands/engage-campaign-validate-command.js +1 -1
  28. package/dist/commands/engage-command.js +1 -1
  29. package/dist/commands/engage-template-pull-command.js +1 -1
  30. package/dist/commands/engage-template-push-command.js +1 -1
  31. package/dist/commands/engage-template-validate-command.js +1 -1
  32. package/dist/commands/job-command.js +1 -1
  33. package/dist/commands/journey-command.js +1 -1
  34. package/dist/commands/journey-validate-command.js +1 -1
  35. package/dist/commands/llm-command.js +1 -1
  36. package/dist/commands/mcp-command.js +1 -1
  37. package/dist/commands/parent-segment-command.js +1 -1
  38. package/dist/commands/policy-command.js +1 -1
  39. package/dist/commands/profile-command.js +1 -1
  40. package/dist/commands/profiles-command.js +1 -1
  41. package/dist/commands/query-command.js +1 -1
  42. package/dist/commands/schedule-command.js +1 -1
  43. package/dist/commands/segment-command.js +1 -1
  44. package/dist/commands/segment-create-command.js +1 -1
  45. package/dist/commands/segment-fields-command.js +1 -1
  46. package/dist/commands/segment-pull-command.js +1 -1
  47. package/dist/commands/segment-push-command.js +1 -1
  48. package/dist/commands/segment-update-command.js +1 -1
  49. package/dist/commands/segment-use-command.js +1 -1
  50. package/dist/commands/segment-validate-command.js +1 -1
  51. package/dist/commands/segments.js +1 -1
  52. package/dist/commands/show.js +1 -1
  53. package/dist/commands/status-command.js +1 -1
  54. package/dist/commands/tables.js +1 -1
  55. package/dist/commands/unset-command.js +1 -1
  56. package/dist/commands/upgrade-command.js +1 -1
  57. package/dist/commands/use-command.js +1 -1
  58. package/dist/commands/user-command.js +1 -1
  59. package/dist/commands/work-command.js +1 -1
  60. package/dist/commands/workflow-command.d.ts +27 -0
  61. package/dist/commands/workflow-command.d.ts.map +1 -1
  62. package/dist/commands/workflow-command.js +1 -1
  63. package/dist/commands/workflow-command.js.map +1 -1
  64. package/dist/core/auth.js +1 -1
  65. package/dist/core/command-output.js +1 -1
  66. package/dist/core/config.js +1 -1
  67. package/dist/core/connection-cache.js +1 -1
  68. package/dist/core/constants.js +1 -1
  69. package/dist/core/credential-cache.js +1 -1
  70. package/dist/core/global-context.js +1 -1
  71. package/dist/core/keychain.js +1 -1
  72. package/dist/core/oauth-keychain.js +1 -1
  73. package/dist/core/oauth.js +1 -1
  74. package/dist/core/profile.js +1 -1
  75. package/dist/core/project-config.js +1 -1
  76. package/dist/core/session.js +1 -1
  77. package/dist/core/user-cache.js +1 -1
  78. package/dist/core/version.js +1 -1
  79. package/dist/index.js +1 -1
  80. package/dist/mcp/server.js +1 -1
  81. package/dist/mcp/tools/index.js +1 -1
  82. package/dist/mcp/tools/tdx-run.js +1 -1
  83. package/dist/mcp/tools/tdx-search.js +1 -1
  84. package/dist/mcp/tools/work-create-item.js +1 -1
  85. package/dist/mcp/utils.js +1 -1
  86. package/dist/proxy/claude-usage-tracker.js +1 -1
  87. package/dist/proxy/passthrough-server.js +1 -1
  88. package/dist/proxy/sse-usage-parser.js +1 -1
  89. package/dist/sdk/agent/agent-config.d.ts +10 -0
  90. package/dist/sdk/agent/agent-config.d.ts.map +1 -1
  91. package/dist/sdk/agent/agent-config.js +1 -1
  92. package/dist/sdk/agent/agent-config.js.map +1 -1
  93. package/dist/sdk/agent/agent-ref-parser.js +1 -1
  94. package/dist/sdk/agent/agent-yaml.d.ts +61 -3
  95. package/dist/sdk/agent/agent-yaml.d.ts.map +1 -1
  96. package/dist/sdk/agent/agent-yaml.js +1 -1
  97. package/dist/sdk/agent/agent-yaml.js.map +1 -1
  98. package/dist/sdk/agent/test/evaluator.js +1 -1
  99. package/dist/sdk/agent/test/executor.js +1 -1
  100. package/dist/sdk/agent/test/index.js +1 -1
  101. package/dist/sdk/agent/test/output.js +1 -1
  102. package/dist/sdk/agent/test/parser.js +1 -1
  103. package/dist/sdk/agent/tool-target-registry.js +1 -1
  104. package/dist/sdk/agent/types/agent-def.d.ts +43 -0
  105. package/dist/sdk/agent/types/agent-def.d.ts.map +1 -1
  106. package/dist/sdk/api.js +1 -1
  107. package/dist/sdk/cas/cas-api-client.js +1 -1
  108. package/dist/sdk/cas/cas-audience-yaml.js +1 -1
  109. package/dist/sdk/cas/cas-segment-yaml.js +1 -1
  110. package/dist/sdk/cas/index.js +1 -1
  111. package/dist/sdk/cas/pull-workflow.js +1 -1
  112. package/dist/sdk/cas/push-workflow.js +1 -1
  113. package/dist/sdk/client/cdp-api-client.js +1 -1
  114. package/dist/sdk/client/delivery-api-client.js +1 -1
  115. package/dist/sdk/client/endpoints.js +1 -1
  116. package/dist/sdk/client/engage-api-client.js +1 -1
  117. package/dist/sdk/client/http-client.js +1 -1
  118. package/dist/sdk/client/llm-api-client.d.ts +73 -1
  119. package/dist/sdk/client/llm-api-client.d.ts.map +1 -1
  120. package/dist/sdk/client/llm-api-client.js +1 -1
  121. package/dist/sdk/client/llm-api-client.js.map +1 -1
  122. package/dist/sdk/client/oauth-refresh.js +1 -1
  123. package/dist/sdk/client/rate-limiter.js +1 -1
  124. package/dist/sdk/client/td-api-client.js +1 -1
  125. package/dist/sdk/client/trino-api-client.js +1 -1
  126. package/dist/sdk/client/workflow-client.d.ts +28 -1
  127. package/dist/sdk/client/workflow-client.d.ts.map +1 -1
  128. package/dist/sdk/client/workflow-client.js +1 -1
  129. package/dist/sdk/client/workflow-client.js.map +1 -1
  130. package/dist/sdk/connection-validator.js +1 -1
  131. package/dist/sdk/connection.js +1 -1
  132. package/dist/sdk/delivery.js +1 -1
  133. package/dist/sdk/engage/campaign-pull.js +1 -1
  134. package/dist/sdk/engage/campaign-push.js +1 -1
  135. package/dist/sdk/engage/campaign-validator.js +1 -1
  136. package/dist/sdk/engage/campaign-yaml.js +1 -1
  137. package/dist/sdk/engage/template-pull.js +1 -1
  138. package/dist/sdk/engage/template-push.js +1 -1
  139. package/dist/sdk/engage/template-validator.js +1 -1
  140. package/dist/sdk/engage/template-yaml.js +1 -1
  141. package/dist/sdk/engage/types/campaign-def.js +1 -1
  142. package/dist/sdk/engage/types/campaign-schema.js +1 -1
  143. package/dist/sdk/engage/types/template-schema.js +1 -1
  144. package/dist/sdk/engage.js +1 -1
  145. package/dist/sdk/errors.js +1 -1
  146. package/dist/sdk/index.js +1 -1
  147. package/dist/sdk/io/index.js +1 -1
  148. package/dist/sdk/io/node-filesystem.js +1 -1
  149. package/dist/sdk/job.js +1 -1
  150. package/dist/sdk/journey.js +1 -1
  151. package/dist/sdk/llm/chat-cache.js +1 -1
  152. package/dist/sdk/llm/index.d.ts.map +1 -1
  153. package/dist/sdk/llm/index.js +1 -1
  154. package/dist/sdk/llm/index.js.map +1 -1
  155. package/dist/sdk/llm/llm-backup-utils.js +1 -1
  156. package/dist/sdk/llm/model-factors.js +1 -1
  157. package/dist/sdk/personalization.js +1 -1
  158. package/dist/sdk/policy.js +1 -1
  159. package/dist/sdk/query/index.js +1 -1
  160. package/dist/sdk/query/sql-parser.js +1 -1
  161. package/dist/sdk/realtime.js +1 -1
  162. package/dist/sdk/schedule.js +1 -1
  163. package/dist/sdk/segment/child-segment-yaml.js +1 -1
  164. package/dist/sdk/segment/fields-display.js +1 -1
  165. package/dist/sdk/segment/file-discovery.js +1 -1
  166. package/dist/sdk/segment/journey-utils.js +1 -1
  167. package/dist/sdk/segment/journey-validator.js +1 -1
  168. package/dist/sdk/segment/journey-yaml.js +1 -1
  169. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  170. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  171. package/dist/sdk/segment/pull-workflow.js +1 -1
  172. package/dist/sdk/segment/push-recovery.js +1 -1
  173. package/dist/sdk/segment/push-workflow.js +1 -1
  174. package/dist/sdk/segment/resolution-context.js +1 -1
  175. package/dist/sdk/segment/segment-path-parser.js +1 -1
  176. package/dist/sdk/segment/segment-ref-parser.js +1 -1
  177. package/dist/sdk/segment/segment-validator.js +1 -1
  178. package/dist/sdk/segment/target-resolution.js +1 -1
  179. package/dist/sdk/segment/tdx-config.js +1 -1
  180. package/dist/sdk/segment/types/activation-schema.js +1 -1
  181. package/dist/sdk/segment/types/journey-def.js +1 -1
  182. package/dist/sdk/segment/types/journey-schema.js +1 -1
  183. package/dist/sdk/segment/types/segment-def.js +1 -1
  184. package/dist/sdk/segment/types/segment-schema.js +1 -1
  185. package/dist/sdk/segment/validate-files.js +1 -1
  186. package/dist/sdk/segment/yaml-validator.js +1 -1
  187. package/dist/sdk/segment.js +1 -1
  188. package/dist/sdk/types/index.d.ts +2 -2
  189. package/dist/sdk/types/index.d.ts.map +1 -1
  190. package/dist/sdk/types/index.js +1 -1
  191. package/dist/sdk/types/index.js.map +1 -1
  192. package/dist/sdk/types/llm.d.ts +158 -0
  193. package/dist/sdk/types/llm.d.ts.map +1 -1
  194. package/dist/sdk/types/progress.js +1 -1
  195. package/dist/sdk/types/workflow.d.ts +26 -0
  196. package/dist/sdk/types/workflow.d.ts.map +1 -1
  197. package/dist/sdk/types/workspace.js +1 -1
  198. package/dist/sdk/user.js +1 -1
  199. package/dist/sdk/util/format-detector.js +1 -1
  200. package/dist/sdk/util/formatters.js +1 -1
  201. package/dist/sdk/util/index.js +1 -1
  202. package/dist/sdk/util/paginate.js +1 -1
  203. package/dist/sdk/util/tree-formatter.js +1 -1
  204. package/dist/sdk/workflow/archive-validation.js +1 -1
  205. package/dist/sdk/workflow/clone-workflow.js +1 -1
  206. package/dist/sdk/workflow/index.d.ts +22 -0
  207. package/dist/sdk/workflow/index.d.ts.map +1 -1
  208. package/dist/sdk/workflow/index.js +1 -1
  209. package/dist/sdk/workflow/index.js.map +1 -1
  210. package/dist/sdk/workflow/pull-workflow.js +1 -1
  211. package/dist/sdk/workflow/push-workflow.js +1 -1
  212. package/dist/sdk/workflow/tdx-config.js +1 -1
  213. package/dist/sdk/workflow/workflow-utils.js +1 -1
  214. package/dist/sdk/workspace/frontmatter.js +1 -1
  215. package/dist/sdk/workspace/git.js +1 -1
  216. package/dist/sdk/workspace/index.js +1 -1
  217. package/dist/sdk/workspace/templates.js +1 -1
  218. package/dist/sdk/workspace/weekly.js +1 -1
  219. package/dist/sdk/workspace/wikilinks.js +1 -1
  220. package/dist/test-utils/command-runner.js +1 -1
  221. package/dist/test-utils/factories.js +1 -1
  222. package/dist/test-utils/fixtures.js +1 -1
  223. package/dist/test-utils/http-mock.js +1 -1
  224. package/dist/test-utils/index.js +1 -1
  225. package/dist/utils/async.js +1 -1
  226. package/dist/utils/colors.js +1 -1
  227. package/dist/utils/diff.js +1 -1
  228. package/dist/utils/file-permissions.js +1 -1
  229. package/dist/utils/file-reader.js +1 -1
  230. package/dist/utils/github-releases.js +1 -1
  231. package/dist/utils/global-cache.js +1 -1
  232. package/dist/utils/json-loader.js +1 -1
  233. package/dist/utils/local-cache.js +1 -1
  234. package/dist/utils/logger/formatters/default-formatter.js +1 -1
  235. package/dist/utils/logger/formatters/index.js +1 -1
  236. package/dist/utils/logger/handlers/console-handler.js +1 -1
  237. package/dist/utils/logger/handlers/file-handler.js +1 -1
  238. package/dist/utils/logger/handlers/index.js +1 -1
  239. package/dist/utils/logger/handlers/null-handler.js +1 -1
  240. package/dist/utils/logger/index.js +1 -1
  241. package/dist/utils/logger/logger.js +1 -1
  242. package/dist/utils/logger/types.js +1 -1
  243. package/dist/utils/option-validation.js +1 -1
  244. package/dist/utils/process.d.ts.map +1 -1
  245. package/dist/utils/process.js +1 -1
  246. package/dist/utils/process.js.map +1 -1
  247. package/dist/utils/prompt.js +1 -1
  248. package/dist/utils/spinner.js +1 -1
  249. package/dist/utils/sse-parser.js +1 -1
  250. package/dist/utils/string-utils.js +1 -1
  251. package/dist/utils/table-ref-parser.js +1 -1
  252. package/dist/utils/tdx-logger.js +1 -1
  253. package/dist/utils/version-check.js +1 -1
  254. package/package.json +2 -2
@@ -1 +1 @@
1
- function a32_0x10d1(){const _0x1206f6=['423477YJTEQO','1454409JYqnBM','Fetching\x20permissions...','Show\x20a\x20specific\x20policy\x20details\x20and\x20permissions\x20(admin\x20only)','\x20\x20\x20','execute','max','\x20—\x20','name','Administrator','description','Show\x20current\x20user\x20policies\x20and\x20effective\x20permissions','join','data','dim','Member','verbose','account_owner','78klWolw','listPolicies','policy','Listing\x20policies...','getCurrent','permissions','8jbsKnv','length','getPolicyUsers','\x20polic','\x20user','context','administrator','Usage:\x20tdx\x20policy\x20show\x20<policy-name-or-id>','\x20\x20•\x20','operation','211015OulaET','email','bold','error','\x20assigned','444jIyCmK','map','📋\x20Assigned\x20Policies','entries','223270klPkoA','ies','log','policy\x20show','(ID:\x20','2653eSItFq','\x20\x20No\x20permissions','1306018iKHHar','✔\x20Found\x20','👥\x20Assigned\x20Users',',\x20user_id:','all','validate','getPolicy','policies','953504GRZiAx','args','33WrVPuu','Account\x20Owner'];a32_0x10d1=function(){return _0x1206f6;};return a32_0x10d1();}const a32_0x2a1f42=a32_0x346f;function a32_0x346f(_0x233471,_0x357291){_0x233471=_0x233471-0x6d;const _0x10d1b4=a32_0x10d1();let _0x346ff2=_0x10d1b4[_0x233471];return _0x346ff2;}(function(_0x28698c,_0x33627b){const _0x9e6c5b=a32_0x346f,_0x1d9bce=_0x28698c();while(!![]){try{const _0x42215f=parseInt(_0x9e6c5b(0xa7))/0x1*(-parseInt(_0x9e6c5b(0x9e))/0x2)+parseInt(_0x9e6c5b(0x77))/0x3+parseInt(_0x9e6c5b(0x73))/0x4+parseInt(_0x9e6c5b(0x99))/0x5*(parseInt(_0x9e6c5b(0x89))/0x6)+-parseInt(_0x9e6c5b(0xa9))/0x7*(-parseInt(_0x9e6c5b(0x8f))/0x8)+-parseInt(_0x9e6c5b(0x78))/0x9+parseInt(_0x9e6c5b(0xa2))/0xa*(-parseInt(_0x9e6c5b(0x75))/0xb);if(_0x42215f===_0x33627b)break;else _0x1d9bce['push'](_0x1d9bce['shift']());}catch(_0x17b4f5){_0x1d9bce['push'](_0x1d9bce['shift']());}}}(a32_0x10d1,0x488f0));import{BaseCommand}from'./command.js';import{handleSDKOutput,handleSingleObjectOutput,isStructuredFormat}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import a32_0x29d516 from'chalk';export class PolicyCommand extends BaseCommand{['name']=a32_0x2a1f42(0x8b);[a32_0x2a1f42(0x81)]=a32_0x2a1f42(0x82);async[a32_0x2a1f42(0x7c)](_0x3d7c07){const _0x3e2488=a32_0x2a1f42,{options:_0x57b8d4,tdx:_0x1b514c}=_0x3d7c07,_0x1f91b3=await withSpinner(_0x3e2488(0x79),async()=>{const _0xf5d964=_0x3e2488,[_0x37241c,_0x1a98f1]=await Promise[_0xf5d964(0x6f)]([_0x1b514c['user'][_0xf5d964(0x8d)](),_0x1b514c['policy']['getMyPermissions']()]);return{'userInfo':_0x37241c,'permissions':_0x1a98f1};},{'verbose':_0x57b8d4[_0x3e2488(0x87)]}),{userInfo:_0x400e48,permissions:_0xa49737}=_0x1f91b3[_0x3e2488(0x84)];if(isStructuredFormat(_0x57b8d4))return await handleSingleObjectOutput(_0xa49737,_0x57b8d4),0x0;const _0x462322=_0x400e48[_0x3e2488(0x88)]?_0x3e2488(0x76):_0x400e48[_0x3e2488(0x95)]?_0x3e2488(0x80):_0x3e2488(0x86);console[_0x3e2488(0xa4)]('\x0a'+a32_0x29d516[_0x3e2488(0x9b)]('👤')+'\x20'+a32_0x29d516['bold'](_0x400e48[_0x3e2488(0x7f)])+'\x20'+a32_0x29d516[_0x3e2488(0x85)]('('+_0x400e48[_0x3e2488(0x9a)]+')')+'\x20—\x20'+_0x462322),console[_0x3e2488(0xa4)](a32_0x29d516['dim'](_0x3e2488(0x7b)+_0x1b514c[_0x3e2488(0x94)]['site']+':'+_0x400e48['account_id']+_0x3e2488(0x6e)+_0x400e48['id']));const _0x20c2ca=_0xa49737[_0x3e2488(0x72)];console[_0x3e2488(0xa4)]('\x0a'+a32_0x29d516['bold'](_0x3e2488(0xa0))+'\x20('+_0x20c2ca[_0x3e2488(0x90)]+'):');if(_0x20c2ca['length']===0x0)console[_0x3e2488(0xa4)](a32_0x29d516[_0x3e2488(0x85)]('\x20\x20No\x20policies\x20assigned'));else for(const _0x15101e of _0x20c2ca){console[_0x3e2488(0xa4)]('\x20\x20•\x20'+_0x15101e['name']);}return printPermissionsMap(_0xa49737[_0x3e2488(0x8e)]),console[_0x3e2488(0xa4)](),0x0;}}export class PolicyListCommand extends BaseCommand{[a32_0x2a1f42(0x7f)]='policy\x20list';['description']='List\x20all\x20policies\x20in\x20the\x20account\x20(admin\x20only)';async[a32_0x2a1f42(0x7c)](_0x34cb8a){const _0x69f24a=a32_0x2a1f42,{options:_0x1fdc80,tdx:_0xa3ee40}=_0x34cb8a,_0x4dc049=await withSpinner(_0x69f24a(0x8c),()=>_0xa3ee40[_0x69f24a(0x8b)][_0x69f24a(0x8a)](),{'verbose':_0x1fdc80[_0x69f24a(0x87)]}),_0x42bb05=_0x4dc049[_0x69f24a(0x84)];console[_0x69f24a(0x9c)](_0x69f24a(0xaa)+_0x42bb05[_0x69f24a(0x90)]+_0x69f24a(0x92)+(_0x42bb05[_0x69f24a(0x90)]!==0x1?_0x69f24a(0xa3):'y'));if(isStructuredFormat(_0x1fdc80))return await handleSDKOutput(_0x42bb05,_0x1fdc80),0x0;if(_0x42bb05[_0x69f24a(0x90)]===0x0)console[_0x69f24a(0xa4)](a32_0x29d516['dim']('No\x20policies\x20found'));else for(const _0x208874 of _0x42bb05){const _0x178cc8=_0x208874[_0x69f24a(0x81)]?a32_0x29d516[_0x69f24a(0x85)](_0x69f24a(0x7e)+_0x208874[_0x69f24a(0x81)]):'';console['log'](_0x69f24a(0x97)+_0x208874[_0x69f24a(0x7f)]+_0x178cc8);}return 0x0;}}export class PolicyShowCommand extends BaseCommand{[a32_0x2a1f42(0x7f)]=a32_0x2a1f42(0xa5);['description']=a32_0x2a1f42(0x7a);[a32_0x2a1f42(0x70)](_0x285154){const _0x2edad7=a32_0x2a1f42;if(_0x285154[_0x2edad7(0x74)]['length']===0x0)return _0x2edad7(0x96);return undefined;}async['execute'](_0x1f7cf2){const _0x4eea31=a32_0x2a1f42,{options:_0x30921a,tdx:_0x151919}=_0x1f7cf2,_0x1c007e=_0x1f7cf2[_0x4eea31(0x74)][0x0],_0x4494b3=await withSpinner('Fetching\x20policy...',async()=>{const _0x1ab1dd=_0x4eea31,_0x14c14e=await _0x151919['policy'][_0x1ab1dd(0x71)](_0x1c007e),[_0x1c7979,_0x3840ec]=await Promise[_0x1ab1dd(0x6f)]([_0x151919[_0x1ab1dd(0x8b)]['getPolicyPermissions'](_0x14c14e['id']),_0x151919[_0x1ab1dd(0x8b)][_0x1ab1dd(0x91)](_0x14c14e['id'])]);return{'policy':_0x14c14e,'perms':_0x1c7979,'users':_0x3840ec};},{'verbose':_0x30921a['verbose']}),{policy:_0x348e4a,perms:_0x338ec9,users:_0xdbf816}=_0x4494b3[_0x4eea31(0x84)];if(isStructuredFormat(_0x30921a))return await handleSingleObjectOutput({..._0x348e4a,'permissions':_0x338ec9['permissions'],'users':_0xdbf816},_0x30921a),0x0;console['log']('\x0a'+a32_0x29d516[_0x4eea31(0x9b)]('📋')+'\x20'+a32_0x29d516[_0x4eea31(0x9b)](_0x348e4a['name'])+'\x20'+a32_0x29d516[_0x4eea31(0x85)](_0x4eea31(0xa6)+_0x348e4a['id']+')'));_0x348e4a[_0x4eea31(0x81)]&&console[_0x4eea31(0xa4)](_0x4eea31(0x7b)+a32_0x29d516[_0x4eea31(0x85)](_0x348e4a[_0x4eea31(0x81)]));console[_0x4eea31(0xa4)]('\x20\x20\x20'+_0xdbf816[_0x4eea31(0x90)]+_0x4eea31(0x93)+(_0xdbf816['length']!==0x1?'s':'')+_0x4eea31(0x9d)),printPermissionsMap(_0x338ec9[_0x4eea31(0x8e)]);if(_0xdbf816[_0x4eea31(0x90)]>0x0){console[_0x4eea31(0xa4)]('\x0a'+a32_0x29d516['bold'](_0x4eea31(0x6d))+':');for(const _0x39b835 of _0xdbf816){const _0x21498b=_0x39b835[_0x4eea31(0x9a)]&&_0x39b835['email']!==_0x39b835[_0x4eea31(0x7f)]?a32_0x29d516[_0x4eea31(0x85)]('\x20<'+_0x39b835[_0x4eea31(0x9a)]+'>'):'';console['log'](_0x4eea31(0x97)+_0x39b835[_0x4eea31(0x7f)]+_0x21498b);}}return console[_0x4eea31(0xa4)](),0x0;}}function printPermissionsMap(_0x2f8132){const _0x1cece1=a32_0x2a1f42,_0xdbd71e=Object[_0x1cece1(0xa1)](_0x2f8132);console[_0x1cece1(0xa4)]('\x0a'+a32_0x29d516[_0x1cece1(0x9b)]('🔑\x20Effective\x20Permissions')+':');if(_0xdbd71e['length']===0x0){console[_0x1cece1(0xa4)](a32_0x29d516['dim'](_0x1cece1(0xa8)));return;}const _0x10565d=Math[_0x1cece1(0x7d)](..._0xdbd71e[_0x1cece1(0x9f)](([_0x2e698c])=>_0x2e698c[_0x1cece1(0x90)]));for(const [_0x58601d,_0xf3af58]of _0xdbd71e){const _0x520779=formatOperations(_0xf3af58);console[_0x1cece1(0xa4)]('\x20\x20'+_0x58601d['padEnd'](_0x10565d+0x2)+_0x520779);}}function formatOperations(_0x4c6312){const _0x385050=a32_0x2a1f42,_0x39b091=[...new Set(_0x4c6312[_0x385050(0x9f)](_0x460deb=>_0x460deb[_0x385050(0x98)]))];return _0x39b091[_0x385050(0x83)](',\x20');}
1
+ const a32_0x2bae8a=a32_0x3f8a;(function(_0x4cba14,_0x4e5f6c){const _0x3b3b1b=a32_0x3f8a,_0x52f9c5=_0x4cba14();while(!![]){try{const _0x564d65=parseInt(_0x3b3b1b(0x17d))/0x1*(parseInt(_0x3b3b1b(0x16d))/0x2)+parseInt(_0x3b3b1b(0x14c))/0x3+parseInt(_0x3b3b1b(0x16f))/0x4+-parseInt(_0x3b3b1b(0x15b))/0x5*(-parseInt(_0x3b3b1b(0x171))/0x6)+-parseInt(_0x3b3b1b(0x17b))/0x7+parseInt(_0x3b3b1b(0x14b))/0x8+-parseInt(_0x3b3b1b(0x154))/0x9;if(_0x564d65===_0x4e5f6c)break;else _0x52f9c5['push'](_0x52f9c5['shift']());}catch(_0x2b734d){_0x52f9c5['push'](_0x52f9c5['shift']());}}}(a32_0x2399,0x60967));import{BaseCommand}from'./command.js';import{handleSDKOutput,handleSingleObjectOutput,isStructuredFormat}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import a32_0x27fd05 from'chalk';function a32_0x2399(){const _0x695a4b=['entries','listPolicies','getPolicyPermissions','Show\x20current\x20user\x20policies\x20and\x20effective\x20permissions','Listing\x20policies...','data','\x20\x20•\x20','email','getPolicy','2694512oyfdaC','328656IrQBWJ','Show\x20a\x20specific\x20policy\x20details\x20and\x20permissions\x20(admin\x20only)','getPolicyUsers','log','args','👥\x20Assigned\x20Users','No\x20policies\x20found','error','6419043ihanJu','policy\x20show','description','account_id','name','\x20\x20No\x20permissions',',\x20user_id:','55PRPNme','bold','📋\x20Assigned\x20Policies','Account\x20Owner','Usage:\x20tdx\x20policy\x20show\x20<policy-name-or-id>','execute','\x20—\x20','policies','\x20\x20\x20','dim','verbose','🔑\x20Effective\x20Permissions','join','validate','\x20user','permissions','all','map','26FuXzyK','\x20\x20No\x20policies\x20assigned','1184804rFIPLP','policy\x20list','4836vRXinf','getMyPermissions','Member','\x20assigned','getCurrent','Fetching\x20policy...','account_owner','(ID:\x20','List\x20all\x20policies\x20in\x20the\x20account\x20(admin\x20only)','user','2739044NYeoVe','✔\x20Found\x20','57593LYpSLY','ies','policy','context','length'];a32_0x2399=function(){return _0x695a4b;};return a32_0x2399();}export class PolicyCommand extends BaseCommand{['name']='policy';[a32_0x2bae8a(0x156)]=a32_0x2bae8a(0x185);async['execute'](_0x50d586){const _0x4f9ce7=a32_0x2bae8a,{options:_0x3f444e,tdx:_0x42fcd4}=_0x50d586,_0x39c875=await withSpinner('Fetching\x20permissions...',async()=>{const _0x2d19cb=a32_0x3f8a,[_0x137d68,_0x509ade]=await Promise['all']([_0x42fcd4[_0x2d19cb(0x17a)][_0x2d19cb(0x175)](),_0x42fcd4[_0x2d19cb(0x17f)][_0x2d19cb(0x172)]()]);return{'userInfo':_0x137d68,'permissions':_0x509ade};},{'verbose':_0x3f444e[_0x4f9ce7(0x165)]}),{userInfo:_0x3f7c09,permissions:_0x58fd81}=_0x39c875['data'];if(isStructuredFormat(_0x3f444e))return await handleSingleObjectOutput(_0x58fd81,_0x3f444e),0x0;const _0x45f988=_0x3f7c09[_0x4f9ce7(0x177)]?_0x4f9ce7(0x15e):_0x3f7c09['administrator']?'Administrator':_0x4f9ce7(0x173);console[_0x4f9ce7(0x14f)]('\x0a'+a32_0x27fd05['bold']('👤')+'\x20'+a32_0x27fd05[_0x4f9ce7(0x15c)](_0x3f7c09[_0x4f9ce7(0x158)])+'\x20'+a32_0x27fd05[_0x4f9ce7(0x164)]('('+_0x3f7c09[_0x4f9ce7(0x149)]+')')+'\x20—\x20'+_0x45f988),console['log'](a32_0x27fd05[_0x4f9ce7(0x164)](_0x4f9ce7(0x163)+_0x42fcd4[_0x4f9ce7(0x180)]['site']+':'+_0x3f7c09[_0x4f9ce7(0x157)]+_0x4f9ce7(0x15a)+_0x3f7c09['id']));const _0x3b0354=_0x58fd81[_0x4f9ce7(0x162)];console['log']('\x0a'+a32_0x27fd05['bold'](_0x4f9ce7(0x15d))+'\x20('+_0x3b0354[_0x4f9ce7(0x181)]+'):');if(_0x3b0354[_0x4f9ce7(0x181)]===0x0)console[_0x4f9ce7(0x14f)](a32_0x27fd05[_0x4f9ce7(0x164)](_0x4f9ce7(0x16e)));else for(const _0x2f8a65 of _0x3b0354){console[_0x4f9ce7(0x14f)](_0x4f9ce7(0x148)+_0x2f8a65[_0x4f9ce7(0x158)]);}return printPermissionsMap(_0x58fd81[_0x4f9ce7(0x16a)]),console[_0x4f9ce7(0x14f)](),0x0;}}export class PolicyListCommand extends BaseCommand{[a32_0x2bae8a(0x158)]=a32_0x2bae8a(0x170);[a32_0x2bae8a(0x156)]=a32_0x2bae8a(0x179);async[a32_0x2bae8a(0x160)](_0x4731bb){const _0x8913c5=a32_0x2bae8a,{options:_0x22ffe9,tdx:_0x3f3732}=_0x4731bb,_0x3fc25d=await withSpinner(_0x8913c5(0x186),()=>_0x3f3732[_0x8913c5(0x17f)][_0x8913c5(0x183)](),{'verbose':_0x22ffe9['verbose']}),_0x21f510=_0x3fc25d[_0x8913c5(0x147)];console[_0x8913c5(0x153)](_0x8913c5(0x17c)+_0x21f510[_0x8913c5(0x181)]+'\x20polic'+(_0x21f510['length']!==0x1?_0x8913c5(0x17e):'y'));if(isStructuredFormat(_0x22ffe9))return await handleSDKOutput(_0x21f510,_0x22ffe9),0x0;if(_0x21f510['length']===0x0)console[_0x8913c5(0x14f)](a32_0x27fd05[_0x8913c5(0x164)](_0x8913c5(0x152)));else for(const _0x51ded0 of _0x21f510){const _0x1146c4=_0x51ded0[_0x8913c5(0x156)]?a32_0x27fd05[_0x8913c5(0x164)](_0x8913c5(0x161)+_0x51ded0[_0x8913c5(0x156)]):'';console[_0x8913c5(0x14f)](_0x8913c5(0x148)+_0x51ded0[_0x8913c5(0x158)]+_0x1146c4);}return 0x0;}}export class PolicyShowCommand extends BaseCommand{[a32_0x2bae8a(0x158)]=a32_0x2bae8a(0x155);[a32_0x2bae8a(0x156)]=a32_0x2bae8a(0x14d);[a32_0x2bae8a(0x168)](_0x35b983){const _0x365ba6=a32_0x2bae8a;if(_0x35b983[_0x365ba6(0x150)][_0x365ba6(0x181)]===0x0)return _0x365ba6(0x15f);return undefined;}async['execute'](_0x65513f){const _0xdb98b8=a32_0x2bae8a,{options:_0x3312e4,tdx:_0x3c072b}=_0x65513f,_0xdbaf75=_0x65513f[_0xdb98b8(0x150)][0x0],_0xea0a05=await withSpinner(_0xdb98b8(0x176),async()=>{const _0x393060=_0xdb98b8,_0x3e9f12=await _0x3c072b['policy'][_0x393060(0x14a)](_0xdbaf75),[_0x576484,_0x40c4d9]=await Promise[_0x393060(0x16b)]([_0x3c072b[_0x393060(0x17f)][_0x393060(0x184)](_0x3e9f12['id']),_0x3c072b[_0x393060(0x17f)][_0x393060(0x14e)](_0x3e9f12['id'])]);return{'policy':_0x3e9f12,'perms':_0x576484,'users':_0x40c4d9};},{'verbose':_0x3312e4[_0xdb98b8(0x165)]}),{policy:_0x2c9581,perms:_0x5bf65e,users:_0x30828d}=_0xea0a05[_0xdb98b8(0x147)];if(isStructuredFormat(_0x3312e4))return await handleSingleObjectOutput({..._0x2c9581,'permissions':_0x5bf65e[_0xdb98b8(0x16a)],'users':_0x30828d},_0x3312e4),0x0;console[_0xdb98b8(0x14f)]('\x0a'+a32_0x27fd05[_0xdb98b8(0x15c)]('📋')+'\x20'+a32_0x27fd05[_0xdb98b8(0x15c)](_0x2c9581[_0xdb98b8(0x158)])+'\x20'+a32_0x27fd05[_0xdb98b8(0x164)](_0xdb98b8(0x178)+_0x2c9581['id']+')'));_0x2c9581[_0xdb98b8(0x156)]&&console[_0xdb98b8(0x14f)](_0xdb98b8(0x163)+a32_0x27fd05[_0xdb98b8(0x164)](_0x2c9581[_0xdb98b8(0x156)]));console[_0xdb98b8(0x14f)](_0xdb98b8(0x163)+_0x30828d[_0xdb98b8(0x181)]+_0xdb98b8(0x169)+(_0x30828d[_0xdb98b8(0x181)]!==0x1?'s':'')+_0xdb98b8(0x174)),printPermissionsMap(_0x5bf65e[_0xdb98b8(0x16a)]);if(_0x30828d[_0xdb98b8(0x181)]>0x0){console[_0xdb98b8(0x14f)]('\x0a'+a32_0x27fd05[_0xdb98b8(0x15c)](_0xdb98b8(0x151))+':');for(const _0x98eff1 of _0x30828d){const _0x142c82=_0x98eff1[_0xdb98b8(0x149)]&&_0x98eff1[_0xdb98b8(0x149)]!==_0x98eff1['name']?a32_0x27fd05[_0xdb98b8(0x164)]('\x20<'+_0x98eff1['email']+'>'):'';console[_0xdb98b8(0x14f)]('\x20\x20•\x20'+_0x98eff1['name']+_0x142c82);}}return console['log'](),0x0;}}function a32_0x3f8a(_0x37e3e0,_0x21e78c){_0x37e3e0=_0x37e3e0-0x147;const _0x239963=a32_0x2399();let _0x3f8aa=_0x239963[_0x37e3e0];return _0x3f8aa;}function printPermissionsMap(_0x59eb5d){const _0x5153b0=a32_0x2bae8a,_0x375a5c=Object[_0x5153b0(0x182)](_0x59eb5d);console['log']('\x0a'+a32_0x27fd05[_0x5153b0(0x15c)](_0x5153b0(0x166))+':');if(_0x375a5c[_0x5153b0(0x181)]===0x0){console['log'](a32_0x27fd05[_0x5153b0(0x164)](_0x5153b0(0x159)));return;}const _0x35338b=Math['max'](..._0x375a5c[_0x5153b0(0x16c)](([_0xee6b69])=>_0xee6b69['length']));for(const [_0x1060ce,_0x466e10]of _0x375a5c){const _0x6af1b5=formatOperations(_0x466e10);console[_0x5153b0(0x14f)]('\x20\x20'+_0x1060ce['padEnd'](_0x35338b+0x2)+_0x6af1b5);}}function formatOperations(_0x3ca988){const _0x526ac4=a32_0x2bae8a,_0x2e6a91=[...new Set(_0x3ca988[_0x526ac4(0x16c)](_0x575ac6=>_0x575ac6['operation']))];return _0x2e6a91[_0x526ac4(0x167)](',\x20');}
@@ -1 +1 @@
1
- const a33_0x9e2146=a33_0x1074;(function(_0x14238d,_0x5e9197){const _0x176e6a=a33_0x1074,_0x14b4fa=_0x14238d();while(!![]){try{const _0x1ee73a=-parseInt(_0x176e6a(0xd1))/0x1+-parseInt(_0x176e6a(0xa8))/0x2*(-parseInt(_0x176e6a(0xba))/0x3)+parseInt(_0x176e6a(0xc8))/0x4+-parseInt(_0x176e6a(0xb2))/0x5*(parseInt(_0x176e6a(0xfa))/0x6)+-parseInt(_0x176e6a(0xb1))/0x7*(-parseInt(_0x176e6a(0xb3))/0x8)+-parseInt(_0x176e6a(0xe2))/0x9+parseInt(_0x176e6a(0xc7))/0xa*(-parseInt(_0x176e6a(0xc4))/0xb);if(_0x1ee73a===_0x5e9197)break;else _0x14b4fa['push'](_0x14b4fa['shift']());}catch(_0x1a306c){_0x14b4fa['push'](_0x14b4fa['shift']());}}}(a33_0x50d9,0xe07bd));import{BaseCommand,printAuthError}from'./command.js';import{listProfiles,profileExists,saveProfileToUserConfig,removeProfileFromUserConfig,loadProfile,getActiveProfile,saveActiveProfileToUserConfig}from'../core/profile.js';import{getConfigDir}from'../core/config.js';import*as a33_0xe30f51 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';function a33_0x1074(_0x56944f,_0x218cd4){_0x56944f=_0x56944f-0x93;const _0x50d984=a33_0x50d9();let _0x107460=_0x50d984[_0x56944f];return _0x107460;}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_0x27e716 from'prompts';import a33_0x516786 from'chalk';function validateProfileName(_0xe6a0dc,_0x19241f){const _0x121eb2=a33_0x1074;if(!_0xe6a0dc||!_0xe6a0dc[_0x121eb2(0xd9)]())return _0x121eb2(0xdf);const _0x2951d1=_0xe6a0dc[_0x121eb2(0xd9)]();if(!/^[a-zA-Z0-9_-]+$/[_0x121eb2(0xff)](_0x2951d1))return _0x121eb2(0x97);if(!_0x19241f?.[_0x121eb2(0xbc)]&&profileExists(_0x2951d1))return'Profile\x20\x27'+_0x2951d1+_0x121eb2(0xda)+_0x2951d1+_0x121eb2(0xcf);return!![];}async function deleteProfileAndCredentials(_0x3ec61b){const _0x10aff9=a33_0x1074;removeProfileFromUserConfig(_0x3ec61b);const _0x5671ba=await isKeychainAvailable();_0x5671ba&&await Promise[_0x10aff9(0xc2)]([deleteKeychainAPIKey(_0x3ec61b),deleteOAuthTokens(_0x3ec61b)]);}export class ProfileCreateCommand extends BaseCommand{[a33_0x9e2146(0xb6)]=a33_0x9e2146(0xbb);[a33_0x9e2146(0xd5)]=a33_0x9e2146(0xc3);async[a33_0x9e2146(0x94)](_0x4f93dc){const _0x59b560=a33_0x9e2146,{options:_0x196ad2,args:_0x5e417d}=_0x4f93dc,_0x276f5f=!!_0x196ad2['force'];console['log'](a33_0x516786[_0x59b560(0xa6)](_0x59b560(0xd4)));let _0x2e76d1;if(_0x5e417d[_0x59b560(0xe1)]>0x0&&_0x5e417d[0x0]){const _0x444a7c=_0x5e417d[0x0][_0x59b560(0xd9)]();_0x276f5f&&profileExists(_0x444a7c)&&(await deleteProfileAndCredentials(_0x444a7c),console['log'](_0x59b560(0xe9)+_0x444a7c+'\x27'));const _0x31ffe8=validateProfileName(_0x444a7c);if(_0x31ffe8!==!![])return console[_0x59b560(0xbd)](a33_0x516786[_0x59b560(0xaa)](_0x31ffe8)),0x1;_0x2e76d1=_0x444a7c;}else{const _0x106be9=await a33_0x27e716({'type':'text','name':'profileName','message':'Enter\x20profile\x20name:','validate':_0xffda7=>validateProfileName(_0xffda7,{'skipExistsCheck':_0x276f5f})});if(!_0x106be9['profileName'])return console[_0x59b560(0xc6)](_0x59b560(0x9c)),0x1;_0x2e76d1=_0x106be9[_0x59b560(0xd6)][_0x59b560(0xd9)](),_0x276f5f&&profileExists(_0x2e76d1)&&(await deleteProfileAndCredentials(_0x2e76d1),console[_0x59b560(0xc6)](_0x59b560(0xe9)+_0x2e76d1+'\x27'));}const _0x4b457c=await a33_0x27e716({'type':_0x59b560(0xf2),'name':_0x59b560(0xd5),'message':_0x59b560(0xb8)}),_0x1ca06e=_0x4b457c[_0x59b560(0xd5)]?.['trim']()||undefined,_0x3d2d8f=_0x196ad2[_0x59b560(0xad)]||_0x59b560(0x9a),_0x469e07=await promptSiteSelection(_0x3d2d8f,_0x2e76d1,_0x59b560(0xa5));if(!_0x469e07)return 0x1;const _0x760e82=resolveSite(_0x469e07),_0x59d35b=await promptAuthMethod();if(!_0x59d35b)return console[_0x59b560(0xc6)](_0x59b560(0x9c)),0x1;if(_0x59d35b===_0x59b560(0xf5)){if(_0x1ca06e){const _0x4bea95={'site':_0x760e82,'description':_0x1ca06e};saveProfileToUserConfig(_0x2e76d1,_0x4bea95);}const {accountName:_0x378867}=_0x196ad2;return await runOAuthLoginFlow(_0x760e82,_0x2e76d1,_0x196ad2['logLevel']??LogLevel[_0x59b560(0xc5)],{'accountName':_0x378867}),0x0;}console[_0x59b560(0xc6)](_0x59b560(0xe0)+_0x760e82),console['log'](_0x59b560(0xcc)),console[_0x59b560(0xc6)]('\x20\x20'+getConsoleUrl(_0x760e82,_0x59b560(0xde)));const _0x5d130c=await a33_0x27e716({'type':_0x59b560(0xfe),'name':_0x59b560(0xa9),'message':'Enter\x20your\x20TD\x20API\x20key:','validate':_0x5749f8=>{const _0x1b7f9e=_0x59b560;if(!_0x5749f8||!_0x5749f8[_0x1b7f9e(0xd9)]())return _0x1b7f9e(0xed);return!![];}});if(!_0x5d130c[_0x59b560(0xa9)])return console[_0x59b560(0xc6)](_0x59b560(0x9c)),0x1;const _0x2dd27e=_0x5d130c[_0x59b560(0xa9)];console[_0x59b560(0xc6)](_0x59b560(0xee));try{const _0x550043=TDX['create']({'site':_0x760e82,'apiKey':_0x2dd27e[_0x59b560(0xd9)](),'logLevel':_0x196ad2[_0x59b560(0xeb)]??LogLevel['ERROR']}),_0x2c3f69=await _0x550043[_0x59b560(0xd8)][_0x59b560(0xe7)]();console[_0x59b560(0xc6)](a33_0x516786[_0x59b560(0xb4)]('✓')+_0x59b560(0x93)+_0x2c3f69[_0x59b560(0xca)]+')');const _0x747d8=await isKeychainAvailable();_0x747d8?(await saveAPIKeyAsync(_0x2dd27e[_0x59b560(0xd9)](),_0x760e82,_0x2e76d1),console['log'](a33_0x516786[_0x59b560(0xb4)]('✓')+'\x20API\x20key\x20saved\x20to\x20system\x20keychain\x20(profile:\x20'+_0x2e76d1+')')):(console['warn'](a33_0x516786[_0x59b560(0xa4)]('⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.')),console[_0x59b560(0xfd)](a33_0x516786[_0x59b560(0xa4)](_0x59b560(0xab))));const _0x58f271={'site':_0x760e82,..._0x1ca06e&&{'description':_0x1ca06e}};return saveProfileToUserConfig(_0x2e76d1,_0x58f271),console[_0x59b560(0xc6)](a33_0x516786[_0x59b560(0xb4)]('✓')+_0x59b560(0xbf)+_0x2e76d1+'\x27\x20created'),console[_0x59b560(0xc6)](),console['log']('You\x20can\x20now\x20use\x20tdx\x20commands\x20with\x20this\x20profile.\x20Try:'),console[_0x59b560(0xc6)](_0x59b560(0xf4)+_0x2e76d1+_0x59b560(0xdc)),console['log'](_0x59b560(0xf4)+_0x2e76d1+_0x59b560(0xe3)),0x0;}catch(_0x1b4b6e){if(_0x1b4b6e instanceof HTTPClientError&&_0x1b4b6e[_0x59b560(0xe8)]===0x191)return printAuthError(_0x1b4b6e),0x1;return console['error'](a33_0x516786[_0x59b560(0xaa)]('✗\x20Validation\x20failed:\x20'+(_0x1b4b6e instanceof Error?_0x1b4b6e[_0x59b560(0xf7)]:String(_0x1b4b6e)))),console[_0x59b560(0xbd)](_0x59b560(0xa3)),0x1;}}}export class ProfileDeleteCommand extends BaseCommand{['name']=a33_0x9e2146(0xcd);[a33_0x9e2146(0xd5)]='Delete\x20a\x20profile';['validate'](_0x25e736){const _0xabeba9=a33_0x9e2146,{args:_0x59b356}=_0x25e736;if(_0x59b356[_0xabeba9(0xe1)]===0x0)return _0xabeba9(0xaf);return undefined;}async[a33_0x9e2146(0x94)](_0x1c4d1a){const _0x451649=a33_0x9e2146,{args:_0x2c5f7f}=_0x1c4d1a,_0x28ee14=_0x2c5f7f[0x0];console['log'](a33_0x516786[_0x451649(0xa6)]('tdx:\x20profile\x20delete'));if(!profileExists(_0x28ee14)){console[_0x451649(0xbd)](a33_0x516786[_0x451649(0xaa)](_0x451649(0xdb)+_0x28ee14+'\x27\x20does\x20not\x20exist.')),console['log'](_0x451649(0xa0));const _0x54a50b=listProfiles();if(_0x54a50b[_0x451649(0xe1)]===0x0)console['log'](_0x451649(0xd2));else for(const _0x25bcd2 of _0x54a50b){console[_0x451649(0xc6)](_0x451649(0xec)+_0x25bcd2[_0x451649(0xb6)]);}return 0x1;}const _0x561dc5=await a33_0x27e716({'type':_0x451649(0xf0),'name':'confirm','message':_0x451649(0xa2)+_0x28ee14+'\x27?','initial':![]});if(!_0x561dc5['confirm'])return console['log'](_0x451649(0xcb)),0x0;try{await deleteProfileAndCredentials(_0x28ee14),console['log'](a33_0x516786[_0x451649(0xb4)]('✓')+'\x20Profile\x20\x27'+_0x28ee14+_0x451649(0xd7));}catch(_0x285c0e){return console[_0x451649(0xbd)](a33_0x516786[_0x451649(0xaa)](_0x451649(0xa1)+(_0x285c0e instanceof Error?_0x285c0e['message']:String(_0x285c0e)))),0x1;}return 0x0;}}function a33_0x50d9(){const _0x289d9a=['\x27\x20does\x20not\x20exist.','split','Profile\x20name\x20must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore','\x27\x20does\x20not\x20exist.\x20Create\x20it?','Set\x20a\x20profile\x20configuration\x20value','us01','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','\x0aSetup\x20cancelled','Enter\x20your\x20TD\x20API\x20key\x20for\x20the\x20new\x20site:','tdx.json','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>','\x0aAvailable\x20profiles:','Failed\x20to\x20delete\x20profile:\x20','Are\x20you\x20sure\x20you\x20want\x20to\x20remove\x20profile\x20\x27','Profile\x20was\x20not\x20created.\x20Please\x20try\x20again.','yellow','Setup\x20cancelled','bold','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20use\x20<name>\x20[--default]','2EnNuoj','apiKey','red','\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.','validate','site','Unknown\x20key\x20\x27','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20delete\x20<name>','includes','9199309PkjIer','345OVpUQn','8QxyudS','green','\x20API\x20key\x20saved\x20to\x20system\x20keychain','name','Key=value\x20pair\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','Enter\x20description\x20(optional):','llm_project','5506953gMerOF','profile:create','skipExistsCheck','error','\x27\x20requires\x20API\x20key\x20validation.','\x20Profile\x20\x27','(session:\x20','database','all','Create\x20a\x20new\x20profile','11BPMaQI','ERROR','log','2674430lYUmmj','5816864fDxuuj','\x27.\x0a\x0aValid\x20keys:\x20','email','Removal\x20cancelled','You\x20can\x20find\x20your\x20API\x20key\x20at:','profile:delete','join','\x27\x20to\x20remove\x20it\x20first,\x20or\x20re-create\x20with\x20--force.','\x0aOperation\x20cancelled','118456TMXxTk','\x20\x20(no\x20profiles\x20found)','default','tdx:\x20profile\x20create','description','profileName','\x27\x20deleted','jobs','trim','\x27\x20already\x20exists.\x20Use\x20\x27tdx\x20profile\x20delete\x20','Profile\x20\x27','\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication','profile','/app/mp/ak','Profile\x20name\x20cannot\x20be\x20empty','\x0aSetting\x20up\x20authentication\x20for\x20site:\x20','length','15711183nTmSZN','\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases','config','VALID_KEYS','\x0aTip:\x20Use\x20\x27tdx\x20profile\x20use\x20','getUserInfo','status','Removed\x20existing\x20profile\x20\x27','session','logLevel','\x20\x20-\x20','API\x20key\x20cannot\x20be\x20empty','Validating\x20API\x20key...','create','confirm','tdx:\x20profile\x20set','text','llm_agent','\x20\x20tdx\x20--profile\x20','oauth','\x0aYou\x20can\x20find\x20your\x20API\x20key\x20at:','message','Changing\x20site\x20to\x20\x27','\x0aSaved\x20to:\x20','135042hracFC','✗\x20Validation\x20failed:\x20','Invalid\x20format.\x20Use:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','warn','password','test','dim','\x27\x20updated:\x20','\x20API\x20key\x20is\x20valid\x20(User:\x20','execute'];a33_0x50d9=function(){return _0x289d9a;};return a33_0x50d9();}export class ProfileSetCommand extends BaseCommand{[a33_0x9e2146(0xb6)]='profile:set';['description']=a33_0x9e2146(0x99);static [a33_0x9e2146(0xe5)]=['site',a33_0x9e2146(0xc1),'parent_segment',a33_0x9e2146(0xb9),a33_0x9e2146(0xf3),a33_0x9e2146(0xd5)];[a33_0x9e2146(0xac)](_0x3b40fc){const _0x65c566=a33_0x9e2146,{args:_0x55c7df,options:_0x3d6c19}=_0x3b40fc,_0x5617da=_0x3d6c19[_0x65c566(0xdd)]||getActiveProfile();if(!_0x5617da)return _0x65c566(0x9f);if(_0x55c7df[_0x65c566(0xe1)]===0x0)return _0x65c566(0xb7)+ProfileSetCommand[_0x65c566(0xe5)][_0x65c566(0xce)](',\x20');const _0x4e65dd=_0x55c7df[0x0];if(!_0x4e65dd[_0x65c566(0xb0)]('='))return _0x65c566(0xfc)+ProfileSetCommand[_0x65c566(0xe5)]['join'](',\x20');const [_0x55276b]=_0x4e65dd[_0x65c566(0x96)]('=',0x2);if(!ProfileSetCommand['VALID_KEYS'][_0x65c566(0xb0)](_0x55276b))return _0x65c566(0xae)+_0x55276b+_0x65c566(0xc9)+ProfileSetCommand[_0x65c566(0xe5)][_0x65c566(0xce)](',\x20');return undefined;}async['execute'](_0x6954e2){const _0x15d604=a33_0x9e2146,{args:_0x4677a3,options:_0x58c9aa}=_0x6954e2,_0x228795=_0x58c9aa[_0x15d604(0xdd)]||getActiveProfile(),[_0x2dbdb1,..._0x278fea]=_0x4677a3[0x0][_0x15d604(0x96)]('='),_0x28340a=_0x278fea[_0x15d604(0xce)]('=');console[_0x15d604(0xc6)](a33_0x516786['bold'](_0x15d604(0xf1)));if(!profileExists(_0x228795)){const _0x377a50=await a33_0x27e716({'type':_0x15d604(0xf0),'name':_0x15d604(0xef),'message':_0x15d604(0xdb)+_0x228795+_0x15d604(0x98),'initial':!![]});if(!_0x377a50[_0x15d604(0xef)])return console['log']('Operation\x20cancelled'),0x1;}const _0x43c749=loadProfile(_0x228795),_0x566f26=_0x43c749?.[_0x15d604(0xe4)]||{};if(_0x2dbdb1===_0x15d604(0xad)){const _0x14d66d=resolveSite(_0x28340a);console[_0x15d604(0xc6)](_0x15d604(0xf8)+_0x14d66d+_0x15d604(0xbe)),console[_0x15d604(0xc6)](_0x15d604(0xf6)),console[_0x15d604(0xc6)]('\x20\x20'+getConsoleUrl(_0x14d66d,'/app/mp/ak'));const _0x106006=await a33_0x27e716({'type':_0x15d604(0xfe),'name':_0x15d604(0xa9),'message':_0x15d604(0x9d),'validate':_0x45b411=>{const _0x42b022=_0x15d604;if(!_0x45b411||!_0x45b411[_0x42b022(0xd9)]())return _0x42b022(0xed);return!![];}});if(!_0x106006['apiKey'])return console[_0x15d604(0xc6)](_0x15d604(0xd0)),0x1;console[_0x15d604(0xc6)](_0x15d604(0xee));try{const _0x2a3442=TDX[_0x15d604(0xef)]({'site':_0x14d66d,'apiKey':_0x106006[_0x15d604(0xa9)]['trim'](),'logLevel':_0x58c9aa[_0x15d604(0xeb)]??LogLevel[_0x15d604(0xc5)]}),_0x52e2ca=await _0x2a3442['jobs']['getUserInfo']();console[_0x15d604(0xc6)](a33_0x516786[_0x15d604(0xb4)]('✓')+_0x15d604(0x93)+_0x52e2ca[_0x15d604(0xca)]+')');const _0x36d40a=await isKeychainAvailable();_0x36d40a?(await saveAPIKeyAsync(_0x106006[_0x15d604(0xa9)][_0x15d604(0xd9)](),_0x14d66d,_0x228795),console[_0x15d604(0xc6)](a33_0x516786[_0x15d604(0xb4)]('✓')+_0x15d604(0xb5))):console['warn'](a33_0x516786[_0x15d604(0xa4)](_0x15d604(0x9b))),_0x566f26[_0x15d604(0xad)]=_0x14d66d;}catch(_0x264bc0){if(_0x264bc0 instanceof HTTPClientError&&_0x264bc0[_0x15d604(0xe8)]===0x191)return printAuthError(_0x264bc0),0x1;return console[_0x15d604(0xbd)](a33_0x516786[_0x15d604(0xaa)](_0x15d604(0xfb)+(_0x264bc0 instanceof Error?_0x264bc0[_0x15d604(0xf7)]:String(_0x264bc0)))),console[_0x15d604(0xbd)]('Site\x20was\x20not\x20changed.'),0x1;}}else _0x566f26[_0x2dbdb1]=_0x28340a||undefined;return saveProfileToUserConfig(_0x228795,_0x566f26),console[_0x15d604(0xc6)](a33_0x516786['green']('✓')+_0x15d604(0xbf)+_0x228795+_0x15d604(0x101)+_0x2dbdb1+'='+(_0x28340a||'(cleared)')),0x0;}}export class ProfileUseCommand extends BaseCommand{[a33_0x9e2146(0xb6)]='profile:use';[a33_0x9e2146(0xd5)]='Set\x20session\x20profile';[a33_0x9e2146(0xac)](_0x78a3e6){const _0x315b67=a33_0x9e2146,{args:_0x3e2691}=_0x78a3e6;if(_0x3e2691[_0x315b67(0xe1)]===0x0)return _0x315b67(0xa7);return undefined;}async[a33_0x9e2146(0x94)](_0x25d407){const _0x1f0a2f=a33_0x9e2146,{args:_0x3c3db0,options:_0x53a74c}=_0x25d407,_0x1d7b84=_0x3c3db0[0x0],_0x443ffa=_0x53a74c[_0x1f0a2f(0xd3)];cleanExpiredSessions();if(!profileExists(_0x1d7b84)){console[_0x1f0a2f(0xbd)](a33_0x516786[_0x1f0a2f(0xaa)](_0x1f0a2f(0xdb)+_0x1d7b84+_0x1f0a2f(0x95))),console[_0x1f0a2f(0xc6)](_0x1f0a2f(0xa0));const _0x404c62=listProfiles();if(_0x404c62[_0x1f0a2f(0xe1)]===0x0)console[_0x1f0a2f(0xc6)](_0x1f0a2f(0xd2));else for(const _0x31c961 of _0x404c62){console['log'](_0x1f0a2f(0xec)+_0x31c961[_0x1f0a2f(0xb6)]);}return 0x1;}if(_0x443ffa){const _0x40625a=a33_0xe30f51[_0x1f0a2f(0xce)](getConfigDir(),_0x1f0a2f(0x9e));return saveActiveProfileToUserConfig(_0x1d7b84),console['log']('Default\x20profile\x20set\x20to:\x20'+a33_0x516786['green'](_0x1d7b84)),console[_0x1f0a2f(0xc6)](a33_0x516786[_0x1f0a2f(0x100)](_0x1f0a2f(0xf9)+_0x40625a)),0x0;}const _0x23b43c=getSessionID(_0x53a74c[_0x1f0a2f(0xea)]);return saveSessionContext({'profile':_0x1d7b84},_0x53a74c['session']),console[_0x1f0a2f(0xc6)]('Session\x20profile\x20set\x20to:\x20'+a33_0x516786[_0x1f0a2f(0xb4)](_0x1d7b84)+'\x20'+a33_0x516786['dim'](_0x1f0a2f(0xc0)+_0x23b43c+')')),console[_0x1f0a2f(0xc6)](a33_0x516786[_0x1f0a2f(0x100)](_0x1f0a2f(0xe6)+_0x1d7b84+'\x20--default\x27\x20to\x20save\x20permanently')),0x0;}}
1
+ const a33_0x28b842=a33_0x1abc;(function(_0x2fd4fe,_0x48c4f7){const _0x14f783=a33_0x1abc,_0x40cc42=_0x2fd4fe();while(!![]){try{const _0x143e42=-parseInt(_0x14f783(0x110))/0x1+-parseInt(_0x14f783(0x123))/0x2*(-parseInt(_0x14f783(0x146))/0x3)+parseInt(_0x14f783(0x168))/0x4+-parseInt(_0x14f783(0x128))/0x5+parseInt(_0x14f783(0x15a))/0x6+parseInt(_0x14f783(0x12f))/0x7+-parseInt(_0x14f783(0x15c))/0x8;if(_0x143e42===_0x48c4f7)break;else _0x40cc42['push'](_0x40cc42['shift']());}catch(_0x2af4bd){_0x40cc42['push'](_0x40cc42['shift']());}}}(a33_0x5443,0xc34b3));import{BaseCommand,printAuthError}from'./command.js';import{listProfiles,profileExists,saveProfileToUserConfig,removeProfileFromUserConfig,loadProfile,getActiveProfile,saveActiveProfileToUserConfig}from'../core/profile.js';import{getConfigDir}from'../core/config.js';import*as a33_0x36774d from'node:path';import{saveSessionContext,getSessionID,cleanExpiredSessions}from'../core/session.js';import{saveAPIKeyAsync,resolveSite}from'../core/config.js';import{getConsoleUrl}from'../sdk/client/endpoints.js';function a33_0x5443(){const _0x451d79=['profileName','join','warn','\x27\x20already\x20exists.\x20Use\x20\x27tdx\x20profile\x20delete\x20','force','Delete\x20a\x20profile','\x27\x20updated:\x20','\x0aAvailable\x20profiles:','confirm','ERROR','password','\x20\x20tdx\x20--profile\x20','text','\x20--default\x27\x20to\x20save\x20permanently','bold','profile:set','profile:delete','Enter\x20your\x20TD\x20API\x20key\x20for\x20the\x20new\x20site:','1869YHNYYJ','logLevel','\x0aSetup\x20cancelled','Create\x20a\x20new\x20profile','oauth','description','Profile\x20was\x20not\x20created.\x20Please\x20try\x20again.','\x27\x20created','red','VALID_KEYS','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>','\x27.\x0a\x0aValid\x20keys:\x20','profile','\x0aTip:\x20Use\x20\x27tdx\x20profile\x20use\x20','\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.','Invalid\x20format.\x20Use:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','message','\x27\x20requires\x20API\x20key\x20validation.','includes','Profile\x20\x27','8509794bRGCjt','all','17478264MTkaTl','site','split','error','Session\x20profile\x20set\x20to:\x20','status','\x20API\x20key\x20saved\x20to\x20system\x20keychain\x20(profile:\x20','profile:create','\x20API\x20key\x20is\x20valid\x20(User:\x20','validate','parent_segment','tdx:\x20profile\x20create','4324696cCCXFO','API\x20key\x20cannot\x20be\x20empty','\x0aYou\x20can\x20find\x20your\x20API\x20key\x20at:','tdx:\x20profile\x20set','profile:use','Set\x20session\x20profile','\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases','email','\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication','\x27\x20to\x20remove\x20it\x20first,\x20or\x20re-create\x20with\x20--force.','\x20\x20-\x20','llm_project','name','Failed\x20to\x20delete\x20profile:\x20','358317GbXTRZ','default','Enter\x20profile\x20name:','apiKey','Profile\x20name\x20cannot\x20be\x20empty','Are\x20you\x20sure\x20you\x20want\x20to\x20remove\x20profile\x20\x27','tdx.json','(cleared)','Removal\x20cancelled','dim','getUserInfo','create','execute','Key=value\x20pair\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','config','yellow','jobs','Validating\x20API\x20key...','\x27\x20does\x20not\x20exist.','3882tzAEeI','\x0aSetting\x20up\x20authentication\x20for\x20site:\x20','\x20Profile\x20\x27','\x0aSaved\x20to:\x20','Profile\x20name\x20must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore','2668365uvmjRf','log','green','\x27\x20does\x20not\x20exist.\x20Create\x20it?','/app/mp/ak','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20use\x20<name>\x20[--default]','\x0aOperation\x20cancelled','1175860nfmgMb','Enter\x20your\x20TD\x20API\x20key:','test','length','trim'];a33_0x5443=function(){return _0x451d79;};return a33_0x5443();}import{deleteKeychainAPIKey,isKeychainAvailable}from'../core/keychain.js';function a33_0x1abc(_0x1b09d2,_0xe479dd){_0x1b09d2=_0x1b09d2-0x10c;const _0x544339=a33_0x5443();let _0x1abc7e=_0x544339[_0x1b09d2];return _0x1abc7e;}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_0x241ca3 from'prompts';import a33_0x434704 from'chalk';function validateProfileName(_0x55c7f6,_0x2f19d3){const _0xea7f99=a33_0x1abc;if(!_0x55c7f6||!_0x55c7f6[_0xea7f99(0x133)]())return _0xea7f99(0x114);const _0x452682=_0x55c7f6[_0xea7f99(0x133)]();if(!/^[a-zA-Z0-9_-]+$/[_0xea7f99(0x131)](_0x452682))return _0xea7f99(0x127);if(!_0x2f19d3?.['skipExistsCheck']&&profileExists(_0x452682))return'Profile\x20\x27'+_0x452682+_0xea7f99(0x137)+_0x452682+_0xea7f99(0x171);return!![];}async function deleteProfileAndCredentials(_0x2d107b){const _0x1e7400=a33_0x1abc;removeProfileFromUserConfig(_0x2d107b);const _0x23cd3a=await isKeychainAvailable();_0x23cd3a&&await Promise[_0x1e7400(0x15b)]([deleteKeychainAPIKey(_0x2d107b),deleteOAuthTokens(_0x2d107b)]);}export class ProfileCreateCommand extends BaseCommand{[a33_0x28b842(0x10e)]=a33_0x28b842(0x163);[a33_0x28b842(0x14b)]=a33_0x28b842(0x149);async[a33_0x28b842(0x11c)](_0x1a86b9){const _0x189e29=a33_0x28b842,{options:_0x5edb1a,args:_0x3889e0}=_0x1a86b9,_0x5d18dc=!!_0x5edb1a[_0x189e29(0x138)];console[_0x189e29(0x129)](a33_0x434704[_0x189e29(0x142)](_0x189e29(0x167)));let _0x14099b;if(_0x3889e0[_0x189e29(0x132)]>0x0&&_0x3889e0[0x0]){const _0x3f3e96=_0x3889e0[0x0]['trim']();_0x5d18dc&&profileExists(_0x3f3e96)&&(await deleteProfileAndCredentials(_0x3f3e96),console[_0x189e29(0x129)]('Removed\x20existing\x20profile\x20\x27'+_0x3f3e96+'\x27'));const _0xa85cb7=validateProfileName(_0x3f3e96);if(_0xa85cb7!==!![])return console[_0x189e29(0x15f)](a33_0x434704[_0x189e29(0x14e)](_0xa85cb7)),0x1;_0x14099b=_0x3f3e96;}else{const _0x3d9eff=await a33_0x241ca3({'type':_0x189e29(0x140),'name':_0x189e29(0x134),'message':_0x189e29(0x112),'validate':_0xb6e4b2=>validateProfileName(_0xb6e4b2,{'skipExistsCheck':_0x5d18dc})});if(!_0x3d9eff[_0x189e29(0x134)])return console[_0x189e29(0x129)](_0x189e29(0x148)),0x1;_0x14099b=_0x3d9eff[_0x189e29(0x134)][_0x189e29(0x133)](),_0x5d18dc&&profileExists(_0x14099b)&&(await deleteProfileAndCredentials(_0x14099b),console['log']('Removed\x20existing\x20profile\x20\x27'+_0x14099b+'\x27'));}const _0x32ac47=await a33_0x241ca3({'type':'text','name':'description','message':'Enter\x20description\x20(optional):'}),_0x5317cb=_0x32ac47[_0x189e29(0x14b)]?.[_0x189e29(0x133)]()||undefined,_0x31fcbb=_0x5edb1a[_0x189e29(0x15d)]||'us01',_0x278418=await promptSiteSelection(_0x31fcbb,_0x14099b,'Setup\x20cancelled');if(!_0x278418)return 0x1;const _0x5e57de=resolveSite(_0x278418),_0x1e93f8=await promptAuthMethod();if(!_0x1e93f8)return console[_0x189e29(0x129)]('\x0aSetup\x20cancelled'),0x1;if(_0x1e93f8===_0x189e29(0x14a)){if(_0x5317cb){const _0x1bb8ed={'site':_0x5e57de,'description':_0x5317cb};saveProfileToUserConfig(_0x14099b,_0x1bb8ed);}const {accountName:_0x3d0192}=_0x5edb1a;return await runOAuthLoginFlow(_0x5e57de,_0x14099b,_0x5edb1a[_0x189e29(0x147)]??LogLevel[_0x189e29(0x13d)],{'accountName':_0x3d0192}),0x0;}console[_0x189e29(0x129)](_0x189e29(0x124)+_0x5e57de),console[_0x189e29(0x129)]('You\x20can\x20find\x20your\x20API\x20key\x20at:'),console[_0x189e29(0x129)]('\x20\x20'+getConsoleUrl(_0x5e57de,_0x189e29(0x12c)));const _0x19e7f9=await a33_0x241ca3({'type':_0x189e29(0x13e),'name':_0x189e29(0x113),'message':_0x189e29(0x130),'validate':_0x304d2f=>{const _0x2deb2c=_0x189e29;if(!_0x304d2f||!_0x304d2f[_0x2deb2c(0x133)]())return _0x2deb2c(0x169);return!![];}});if(!_0x19e7f9[_0x189e29(0x113)])return console[_0x189e29(0x129)](_0x189e29(0x148)),0x1;const _0x45703f=_0x19e7f9[_0x189e29(0x113)];console[_0x189e29(0x129)](_0x189e29(0x121));try{const _0x5934bc=TDX[_0x189e29(0x11b)]({'site':_0x5e57de,'apiKey':_0x45703f[_0x189e29(0x133)](),'logLevel':_0x5edb1a['logLevel']??LogLevel[_0x189e29(0x13d)]}),_0x5c2c5e=await _0x5934bc[_0x189e29(0x120)][_0x189e29(0x11a)]();console[_0x189e29(0x129)](a33_0x434704[_0x189e29(0x12a)]('✓')+_0x189e29(0x164)+_0x5c2c5e[_0x189e29(0x16f)]+')');const _0x2e799e=await isKeychainAvailable();_0x2e799e?(await saveAPIKeyAsync(_0x45703f[_0x189e29(0x133)](),_0x5e57de,_0x14099b),console[_0x189e29(0x129)](a33_0x434704[_0x189e29(0x12a)]('✓')+_0x189e29(0x162)+_0x14099b+')')):(console[_0x189e29(0x136)](a33_0x434704[_0x189e29(0x11f)]('⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.')),console[_0x189e29(0x136)](a33_0x434704[_0x189e29(0x11f)](_0x189e29(0x154))));const _0xaf87aa={'site':_0x5e57de,..._0x5317cb&&{'description':_0x5317cb}};return saveProfileToUserConfig(_0x14099b,_0xaf87aa),console['log'](a33_0x434704[_0x189e29(0x12a)]('✓')+_0x189e29(0x125)+_0x14099b+_0x189e29(0x14d)),console['log'](),console[_0x189e29(0x129)]('You\x20can\x20now\x20use\x20tdx\x20commands\x20with\x20this\x20profile.\x20Try:'),console[_0x189e29(0x129)](_0x189e29(0x13f)+_0x14099b+_0x189e29(0x170)),console['log'](_0x189e29(0x13f)+_0x14099b+_0x189e29(0x16e)),0x0;}catch(_0x1143ae){if(_0x1143ae instanceof HTTPClientError&&_0x1143ae[_0x189e29(0x161)]===0x191)return printAuthError(_0x1143ae),0x1;return console['error'](a33_0x434704[_0x189e29(0x14e)]('✗\x20Validation\x20failed:\x20'+(_0x1143ae instanceof Error?_0x1143ae[_0x189e29(0x156)]:String(_0x1143ae)))),console[_0x189e29(0x15f)](_0x189e29(0x14c)),0x1;}}}export class ProfileDeleteCommand extends BaseCommand{[a33_0x28b842(0x10e)]=a33_0x28b842(0x144);[a33_0x28b842(0x14b)]=a33_0x28b842(0x139);[a33_0x28b842(0x165)](_0x131574){const _0x3e5cf8=a33_0x28b842,{args:_0x11523a}=_0x131574;if(_0x11523a[_0x3e5cf8(0x132)]===0x0)return'Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20delete\x20<name>';return undefined;}async[a33_0x28b842(0x11c)](_0x409956){const _0x41bb3b=a33_0x28b842,{args:_0x1aa0f7}=_0x409956,_0x25969e=_0x1aa0f7[0x0];console[_0x41bb3b(0x129)](a33_0x434704[_0x41bb3b(0x142)]('tdx:\x20profile\x20delete'));if(!profileExists(_0x25969e)){console[_0x41bb3b(0x15f)](a33_0x434704[_0x41bb3b(0x14e)](_0x41bb3b(0x159)+_0x25969e+_0x41bb3b(0x122))),console[_0x41bb3b(0x129)](_0x41bb3b(0x13b));const _0x529aef=listProfiles();if(_0x529aef[_0x41bb3b(0x132)]===0x0)console[_0x41bb3b(0x129)]('\x20\x20(no\x20profiles\x20found)');else for(const _0x508436 of _0x529aef){console[_0x41bb3b(0x129)](_0x41bb3b(0x10c)+_0x508436[_0x41bb3b(0x10e)]);}return 0x1;}const _0x48ce5e=await a33_0x241ca3({'type':'confirm','name':_0x41bb3b(0x13c),'message':_0x41bb3b(0x115)+_0x25969e+'\x27?','initial':![]});if(!_0x48ce5e[_0x41bb3b(0x13c)])return console[_0x41bb3b(0x129)](_0x41bb3b(0x118)),0x0;try{await deleteProfileAndCredentials(_0x25969e),console[_0x41bb3b(0x129)](a33_0x434704[_0x41bb3b(0x12a)]('✓')+_0x41bb3b(0x125)+_0x25969e+'\x27\x20deleted');}catch(_0x4938bf){return console[_0x41bb3b(0x15f)](a33_0x434704['red'](_0x41bb3b(0x10f)+(_0x4938bf instanceof Error?_0x4938bf[_0x41bb3b(0x156)]:String(_0x4938bf)))),0x1;}return 0x0;}}export class ProfileSetCommand extends BaseCommand{[a33_0x28b842(0x10e)]=a33_0x28b842(0x143);[a33_0x28b842(0x14b)]='Set\x20a\x20profile\x20configuration\x20value';static [a33_0x28b842(0x14f)]=['site','database',a33_0x28b842(0x166),a33_0x28b842(0x10d),'llm_agent',a33_0x28b842(0x14b)];[a33_0x28b842(0x165)](_0x22654b){const _0x98cdc3=a33_0x28b842,{args:_0x413385,options:_0x19474f}=_0x22654b,_0x2ffa79=_0x19474f[_0x98cdc3(0x152)]||getActiveProfile();if(!_0x2ffa79)return _0x98cdc3(0x150);if(_0x413385[_0x98cdc3(0x132)]===0x0)return _0x98cdc3(0x11d)+ProfileSetCommand[_0x98cdc3(0x14f)][_0x98cdc3(0x135)](',\x20');const _0x307e35=_0x413385[0x0];if(!_0x307e35[_0x98cdc3(0x158)]('='))return _0x98cdc3(0x155)+ProfileSetCommand['VALID_KEYS'][_0x98cdc3(0x135)](',\x20');const [_0x57b7d8]=_0x307e35[_0x98cdc3(0x15e)]('=',0x2);if(!ProfileSetCommand['VALID_KEYS'][_0x98cdc3(0x158)](_0x57b7d8))return'Unknown\x20key\x20\x27'+_0x57b7d8+_0x98cdc3(0x151)+ProfileSetCommand[_0x98cdc3(0x14f)]['join'](',\x20');return undefined;}async['execute'](_0x3e644d){const _0xe29bae=a33_0x28b842,{args:_0x24f85b,options:_0x4c6235}=_0x3e644d,_0x891527=_0x4c6235['profile']||getActiveProfile(),[_0xb7def1,..._0x39aacd]=_0x24f85b[0x0][_0xe29bae(0x15e)]('='),_0x278773=_0x39aacd[_0xe29bae(0x135)]('=');console['log'](a33_0x434704[_0xe29bae(0x142)](_0xe29bae(0x16b)));if(!profileExists(_0x891527)){const _0x4e5821=await a33_0x241ca3({'type':_0xe29bae(0x13c),'name':_0xe29bae(0x11b),'message':_0xe29bae(0x159)+_0x891527+_0xe29bae(0x12b),'initial':!![]});if(!_0x4e5821[_0xe29bae(0x11b)])return console[_0xe29bae(0x129)]('Operation\x20cancelled'),0x1;}const _0x21db38=loadProfile(_0x891527),_0x28f572=_0x21db38?.[_0xe29bae(0x11e)]||{};if(_0xb7def1==='site'){const _0x501fee=resolveSite(_0x278773);console[_0xe29bae(0x129)]('Changing\x20site\x20to\x20\x27'+_0x501fee+_0xe29bae(0x157)),console[_0xe29bae(0x129)](_0xe29bae(0x16a)),console[_0xe29bae(0x129)]('\x20\x20'+getConsoleUrl(_0x501fee,'/app/mp/ak'));const _0x37c03d=await a33_0x241ca3({'type':_0xe29bae(0x13e),'name':_0xe29bae(0x113),'message':_0xe29bae(0x145),'validate':_0x2134a1=>{const _0x23088e=_0xe29bae;if(!_0x2134a1||!_0x2134a1[_0x23088e(0x133)]())return _0x23088e(0x169);return!![];}});if(!_0x37c03d[_0xe29bae(0x113)])return console[_0xe29bae(0x129)](_0xe29bae(0x12e)),0x1;console['log'](_0xe29bae(0x121));try{const _0x47b6c6=TDX[_0xe29bae(0x11b)]({'site':_0x501fee,'apiKey':_0x37c03d['apiKey'][_0xe29bae(0x133)](),'logLevel':_0x4c6235[_0xe29bae(0x147)]??LogLevel['ERROR']}),_0x33f0e5=await _0x47b6c6[_0xe29bae(0x120)]['getUserInfo']();console['log'](a33_0x434704[_0xe29bae(0x12a)]('✓')+_0xe29bae(0x164)+_0x33f0e5[_0xe29bae(0x16f)]+')');const _0x341703=await isKeychainAvailable();_0x341703?(await saveAPIKeyAsync(_0x37c03d[_0xe29bae(0x113)]['trim'](),_0x501fee,_0x891527),console[_0xe29bae(0x129)](a33_0x434704[_0xe29bae(0x12a)]('✓')+'\x20API\x20key\x20saved\x20to\x20system\x20keychain')):console[_0xe29bae(0x136)](a33_0x434704[_0xe29bae(0x11f)]('⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.')),_0x28f572[_0xe29bae(0x15d)]=_0x501fee;}catch(_0x4bff1d){if(_0x4bff1d instanceof HTTPClientError&&_0x4bff1d['status']===0x191)return printAuthError(_0x4bff1d),0x1;return console[_0xe29bae(0x15f)](a33_0x434704['red']('✗\x20Validation\x20failed:\x20'+(_0x4bff1d instanceof Error?_0x4bff1d['message']:String(_0x4bff1d)))),console[_0xe29bae(0x15f)]('Site\x20was\x20not\x20changed.'),0x1;}}else _0x28f572[_0xb7def1]=_0x278773||undefined;return saveProfileToUserConfig(_0x891527,_0x28f572),console[_0xe29bae(0x129)](a33_0x434704[_0xe29bae(0x12a)]('✓')+_0xe29bae(0x125)+_0x891527+_0xe29bae(0x13a)+_0xb7def1+'='+(_0x278773||_0xe29bae(0x117))),0x0;}}export class ProfileUseCommand extends BaseCommand{[a33_0x28b842(0x10e)]=a33_0x28b842(0x16c);[a33_0x28b842(0x14b)]=a33_0x28b842(0x16d);['validate'](_0x50e12b){const _0x30fc60=a33_0x28b842,{args:_0x49b550}=_0x50e12b;if(_0x49b550[_0x30fc60(0x132)]===0x0)return _0x30fc60(0x12d);return undefined;}async['execute'](_0x900359){const _0x47ec3e=a33_0x28b842,{args:_0x987139,options:_0x29b43e}=_0x900359,_0x1687f1=_0x987139[0x0],_0xe6169f=_0x29b43e[_0x47ec3e(0x111)];cleanExpiredSessions();if(!profileExists(_0x1687f1)){console[_0x47ec3e(0x15f)](a33_0x434704['red'](_0x47ec3e(0x159)+_0x1687f1+_0x47ec3e(0x122))),console[_0x47ec3e(0x129)](_0x47ec3e(0x13b));const _0x56e7cf=listProfiles();if(_0x56e7cf[_0x47ec3e(0x132)]===0x0)console[_0x47ec3e(0x129)]('\x20\x20(no\x20profiles\x20found)');else for(const _0x152dc9 of _0x56e7cf){console[_0x47ec3e(0x129)](_0x47ec3e(0x10c)+_0x152dc9[_0x47ec3e(0x10e)]);}return 0x1;}if(_0xe6169f){const _0x3100e9=a33_0x36774d[_0x47ec3e(0x135)](getConfigDir(),_0x47ec3e(0x116));return saveActiveProfileToUserConfig(_0x1687f1),console[_0x47ec3e(0x129)]('Default\x20profile\x20set\x20to:\x20'+a33_0x434704['green'](_0x1687f1)),console[_0x47ec3e(0x129)](a33_0x434704[_0x47ec3e(0x119)](_0x47ec3e(0x126)+_0x3100e9)),0x0;}const _0x1eb9f4=getSessionID(_0x29b43e['session']);return saveSessionContext({'profile':_0x1687f1},_0x29b43e['session']),console['log'](_0x47ec3e(0x160)+a33_0x434704[_0x47ec3e(0x12a)](_0x1687f1)+'\x20'+a33_0x434704[_0x47ec3e(0x119)]('(session:\x20'+_0x1eb9f4+')')),console[_0x47ec3e(0x129)](a33_0x434704[_0x47ec3e(0x119)](_0x47ec3e(0x153)+_0x1687f1+_0x47ec3e(0x141))),0x0;}}
@@ -1 +1 @@
1
- const a34_0x353b5b=a34_0x1f7a;(function(_0x3316de,_0x26415a){const _0x24a4a4=a34_0x1f7a,_0xf3699f=_0x3316de();while(!![]){try{const _0x25e6a6=parseInt(_0x24a4a4(0x1a3))/0x1+parseInt(_0x24a4a4(0x19c))/0x2+parseInt(_0x24a4a4(0x19b))/0x3*(-parseInt(_0x24a4a4(0x19f))/0x4)+-parseInt(_0x24a4a4(0x193))/0x5*(-parseInt(_0x24a4a4(0x192))/0x6)+parseInt(_0x24a4a4(0x19e))/0x7+parseInt(_0x24a4a4(0x1aa))/0x8+-parseInt(_0x24a4a4(0x194))/0x9;if(_0x25e6a6===_0x26415a)break;else _0xf3699f['push'](_0xf3699f['shift']());}catch(_0x24e7f8){_0xf3699f['push'](_0xf3699f['shift']());}}}(a34_0x2d3a,0xe2934));import{BaseCommand}from'./command.js';import{listProfiles,getActiveProfile,getProfileParams}from'../core/profile.js';function a34_0x2d3a(){const _0x4b99bd=['11106536bYczRI','788CVszBQ','message','\x20\x20Local:\x20\x20(project\x20folder)/tdx.json','No\x20profiles\x20found.\x20Define\x20profiles\x20in\x20tdx.json:\x0a','2585gXpyRA','description','List\x20all\x20available\x20profiles','length','scope','name','profiles','12095552bPHqiV','101094CBuINv','145QDkGOc','13823739yVGZOf','👤\x20','dim','map','error','config','site','25656rqTQDf','1117938KEcAKf','log'];a34_0x2d3a=function(){return _0x4b99bd;};return a34_0x2d3a();}import{handleSDKOutput,isStructuredFormat}from'../core/command-output.js';import a34_0x4f69dc from'chalk';function a34_0x1f7a(_0x17a9f4,_0x3bf1ea){_0x17a9f4=_0x17a9f4-0x192;const _0x2d3a7d=a34_0x2d3a();let _0x1f7a26=_0x2d3a7d[_0x17a9f4];return _0x1f7a26;}export class ProfilesCommand extends BaseCommand{[a34_0x353b5b(0x1a8)]=a34_0x353b5b(0x1a9);[a34_0x353b5b(0x1a4)]=a34_0x353b5b(0x1a5);async['execute'](_0x3dc08c){const _0x361399=a34_0x353b5b,{options:_0x5918e3}=_0x3dc08c;try{const _0x2d97b7=listProfiles(),_0x24333e=getActiveProfile();if(_0x2d97b7[_0x361399(0x1a6)]===0x0)return console[_0x361399(0x19d)](_0x361399(0x1a2)),console[_0x361399(0x19d)](_0x361399(0x1a1)),console[_0x361399(0x19d)]('\x20\x20Global:\x20~/.config/tdx/tdx.json'),0x0;const _0xefd879=_0x2d97b7[_0x361399(0x197)](_0x137e95=>{const _0x597b2a=_0x361399,_0x20ed76=_0x137e95[_0x597b2a(0x1a8)]===_0x24333e,_0xd1e13b=getProfileParams(_0x137e95[_0x597b2a(0x199)]);return{'name':_0x137e95[_0x597b2a(0x1a8)],'active':_0x20ed76,'scope':_0x137e95[_0x597b2a(0x1a7)],'description':_0x137e95[_0x597b2a(0x199)][_0x597b2a(0x1a4)]||'','params':_0xd1e13b};});if(isStructuredFormat(_0x5918e3))await handleSDKOutput(_0xefd879,_0x5918e3);else for(const _0xad5db5 of _0x2d97b7){const _0x3f2c37=_0xad5db5[_0x361399(0x1a8)]===_0x24333e?a34_0x4f69dc['green']('\x20✓'):'',_0x256776=_0xad5db5[_0x361399(0x199)][_0x361399(0x19a)]?a34_0x4f69dc[_0x361399(0x196)]('\x20'+_0xad5db5['config'][_0x361399(0x19a)]):'',_0x4db832=_0xad5db5[_0x361399(0x199)]['description']?a34_0x4f69dc[_0x361399(0x196)]('\x20\x20'+_0xad5db5[_0x361399(0x199)][_0x361399(0x1a4)]):'';console['log'](_0x361399(0x195)+_0xad5db5['name']+_0x3f2c37+_0x256776+_0x4db832);}return 0x0;}catch(_0x146002){return _0x146002 instanceof Error&&console[_0x361399(0x198)]('Error:\x20'+_0x146002[_0x361399(0x1a0)]),0x1;}}}
1
+ const a34_0x911b=a34_0x632f;function a34_0x632f(_0x12b226,_0x14f305){_0x12b226=_0x12b226-0x1b7;const _0x509123=a34_0x5091();let _0x632ffb=_0x509123[_0x12b226];return _0x632ffb;}function a34_0x5091(){const _0x376260=['scope','869770jzjKwr','name','19938yROxZd','2CPKlkJ','map','\x20\x20Local:\x20\x20(project\x20folder)/tdx.json','dim','site','description','164848GZvgcW','👤\x20','No\x20profiles\x20found.\x20Define\x20profiles\x20in\x20tdx.json:\x0a','\x20\x20Global:\x20~/.config/tdx/tdx.json','574768ZTyDNX','log','Error:\x20','List\x20all\x20available\x20profiles','6VhLqrJ','2330262CAUvnM','375608vmoAjw','profiles','75dzjXaf','3094170VhQDFm','config','28FRbAvn','length','execute','green'];a34_0x5091=function(){return _0x376260;};return a34_0x5091();}(function(_0xa2032e,_0x54de13){const _0x3d635b=a34_0x632f,_0x3ab021=_0xa2032e();while(!![]){try{const _0xd5756f=-parseInt(_0x3d635b(0x1b9))/0x1*(-parseInt(_0x3d635b(0x1c9))/0x2)+-parseInt(_0x3d635b(0x1c7))/0x3*(-parseInt(_0x3d635b(0x1bf))/0x4)+-parseInt(_0x3d635b(0x1cb))/0x5*(-parseInt(_0x3d635b(0x1b8))/0x6)+-parseInt(_0x3d635b(0x1ce))/0x7*(parseInt(_0x3d635b(0x1c3))/0x8)+parseInt(_0x3d635b(0x1c8))/0x9+-parseInt(_0x3d635b(0x1cc))/0xa+parseInt(_0x3d635b(0x1d3))/0xb;if(_0xd5756f===_0x54de13)break;else _0x3ab021['push'](_0x3ab021['shift']());}catch(_0x52258f){_0x3ab021['push'](_0x3ab021['shift']());}}}(a34_0x5091,0x3cce8));import{BaseCommand}from'./command.js';import{listProfiles,getActiveProfile,getProfileParams}from'../core/profile.js';import{handleSDKOutput,isStructuredFormat}from'../core/command-output.js';import a34_0x482859 from'chalk';export class ProfilesCommand extends BaseCommand{[a34_0x911b(0x1b7)]=a34_0x911b(0x1ca);[a34_0x911b(0x1be)]=a34_0x911b(0x1c6);async[a34_0x911b(0x1d0)](_0x47ed53){const _0x469e9f=a34_0x911b,{options:_0x1185c6}=_0x47ed53;try{const _0x1f78ef=listProfiles(),_0x5d94b1=getActiveProfile();if(_0x1f78ef[_0x469e9f(0x1cf)]===0x0)return console['log'](_0x469e9f(0x1c1)),console['log'](_0x469e9f(0x1bb)),console[_0x469e9f(0x1c4)](_0x469e9f(0x1c2)),0x0;const _0x32584d=_0x1f78ef[_0x469e9f(0x1ba)](_0x1b4b96=>{const _0x4f5ca6=_0x469e9f,_0x4aed29=_0x1b4b96['name']===_0x5d94b1,_0x219932=getProfileParams(_0x1b4b96[_0x4f5ca6(0x1cd)]);return{'name':_0x1b4b96[_0x4f5ca6(0x1b7)],'active':_0x4aed29,'scope':_0x1b4b96[_0x4f5ca6(0x1d2)],'description':_0x1b4b96[_0x4f5ca6(0x1cd)][_0x4f5ca6(0x1be)]||'','params':_0x219932};});if(isStructuredFormat(_0x1185c6))await handleSDKOutput(_0x32584d,_0x1185c6);else for(const _0x4e52d4 of _0x1f78ef){const _0x5d6393=_0x4e52d4['name']===_0x5d94b1?a34_0x482859[_0x469e9f(0x1d1)]('\x20✓'):'',_0x558f9e=_0x4e52d4[_0x469e9f(0x1cd)][_0x469e9f(0x1bd)]?a34_0x482859[_0x469e9f(0x1bc)]('\x20'+_0x4e52d4[_0x469e9f(0x1cd)][_0x469e9f(0x1bd)]):'',_0x47d5f1=_0x4e52d4[_0x469e9f(0x1cd)][_0x469e9f(0x1be)]?a34_0x482859['dim']('\x20\x20'+_0x4e52d4[_0x469e9f(0x1cd)][_0x469e9f(0x1be)]):'';console[_0x469e9f(0x1c4)](_0x469e9f(0x1c0)+_0x4e52d4[_0x469e9f(0x1b7)]+_0x5d6393+_0x558f9e+_0x47d5f1);}return 0x0;}catch(_0x169db5){return _0x169db5 instanceof Error&&console['error'](_0x469e9f(0x1c5)+_0x169db5['message']),0x1;}}}
@@ -1 +1 @@
1
- const a35_0x324720=a35_0x217a;(function(_0x41c31e,_0x1f35dc){const _0x1598bc=a35_0x217a,_0x1c72d8=_0x41c31e();while(!![]){try{const _0x5d82d8=-parseInt(_0x1598bc(0x8a))/0x1+parseInt(_0x1598bc(0xba))/0x2*(-parseInt(_0x1598bc(0xa6))/0x3)+parseInt(_0x1598bc(0xa7))/0x4+parseInt(_0x1598bc(0x9e))/0x5*(-parseInt(_0x1598bc(0x91))/0x6)+parseInt(_0x1598bc(0xa1))/0x7*(-parseInt(_0x1598bc(0x90))/0x8)+parseInt(_0x1598bc(0x93))/0x9+-parseInt(_0x1598bc(0x9a))/0xa*(-parseInt(_0x1598bc(0xa3))/0xb);if(_0x5d82d8===_0x1f35dc)break;else _0x1c72d8['push'](_0x1c72d8['shift']());}catch(_0x19eb92){_0x1c72d8['push'](_0x1c72d8['shift']());}}}(a35_0x424a,0xbc15d));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';function a35_0x217a(_0x474c9e,_0x4316e3){_0x474c9e=_0x474c9e-0x88;const _0x424aa2=a35_0x424a();let _0x217ada=_0x424aa2[_0x474c9e];return _0x217ada;}import{handleQueryOutput,formatQueryOutput,resolveOutputOptions}from'../core/command-output.js';import{readSqlStatementsFromFile,readSqlStatementsFromStdin,splitSqlStatements,isSqlFilePath}from'../sdk/query/sql-parser.js';import{writeFileSync}from'fs';import{withProgressSpinner,formatElapsed}from'../utils/spinner.js';import{formatRows}from'../sdk/util/formatters.js';function a35_0x424a(){const _0x1cfe9e=['processedRows','1267SOPNQV','completedSplits','440YitWeG','in\x20','length','982911pAhLmu','3028952FWXuUj','Catalog:\x20','elapsedTimeMillis','push','Executing\x20query\x20[','setPhase','\x20splits','output','Error:\x20','\x20[Job\x20ID:\x20','...','execute','SQL:\x20','information_schema','verbose','validate','\x0aAll\x20results\x20saved\x20to\x20','Query\x20completed:\x20Processed\x20','setJobId','2OvsYxv','Statement\x20','Run\x20Trino\x20queries\x20(streaming)','data','stats','768594CsUfWY','\x20rows\x20','originalMessage','error','Site:\x20','Executing\x20statement\x20','29744QkXTvn','12zJONcp','Executing\x20query...','1396764WCfYbO','site','Cannot\x20specify\x20both\x20SQL\x20argument\x20and\x20--file\x20option','message','options','args','state','658250Fkrygt','query','join','jobId','2514620QgWhaj','\x20-\x20'];a35_0x424a=function(){return _0x1cfe9e;};return a35_0x424a();}export class QueryCommand extends BaseCommand{['name']=a35_0x324720(0x9b);['description']=a35_0x324720(0xbc);async['execute'](_0x3aaebd){const _0x317f19=a35_0x324720,{options:_0x5add05,args:_0x4ea931,tdx:_0x258d58}=_0x3aaebd,_0xc70340={..._0x5add05,'limitStructuredFormats':!![]},_0x723384=_0x4ea931[0x0],_0x40352b=_0x5add05['file'];let _0x2605ae;try{if(_0x40352b)_0x2605ae=readSqlStatementsFromFile(_0x40352b);else{if(_0x723384==='-')_0x2605ae=await readSqlStatementsFromStdin();else{if(_0x723384&&isSqlFilePath(_0x723384))_0x2605ae=readSqlStatementsFromFile(_0x723384);else{if(_0x723384)_0x2605ae=splitSqlStatements(_0x723384);else throw new Error('No\x20SQL\x20provided');}}}}catch(_0x5a5d7d){return console[_0x317f19(0x8d)](_0x317f19(0xaf)+_0x5a5d7d['message']),0x1;}const _0x50fb40=_0x5add05['database']||_0x317f19(0xb4),_0x5765ba=_0x5add05['catalog'];try{const _0x311ee7=[],_0x4bda39=!!_0x5add05[_0x317f19(0xae)];for(let _0x12df97=0x0;_0x12df97<_0x2605ae[_0x317f19(0xa5)];_0x12df97++){const _0x233952=_0x2605ae[_0x12df97],_0x35f1fe=_0x12df97+0x1,_0x1ae02e=_0x2605ae[_0x317f19(0xa5)],_0x25ccb6=_0x1ae02e>0x1;_0x5add05[_0x317f19(0xb5)]&&(console['error']('\x0a'+(_0x25ccb6?_0x317f19(0xbb)+_0x35f1fe+'/'+_0x1ae02e+':':'')),console[_0x317f19(0x8d)](_0x317f19(0x8e)+_0x5add05[_0x317f19(0x94)]),console[_0x317f19(0x8d)](_0x317f19(0xa8)+(_0x5765ba||'td')),console[_0x317f19(0x8d)]('Schema:\x20'+_0x50fb40),console[_0x317f19(0x8d)](_0x317f19(0xb3)+_0x233952));const _0x280208=_0x25ccb6?_0x317f19(0x8f)+_0x35f1fe+'/'+_0x1ae02e+_0x317f19(0xb1):_0x317f19(0x92);try{const _0x49b6a6=await withProgressSpinner(_0x280208,async _0x523d13=>{const _0x5b3599=_0x317f19,_0x564cbe=await _0x258d58[_0x5b3599(0x9b)][_0x5b3599(0xb2)](_0x233952,{'catalog':_0x5765ba,'schema':_0x50fb40,'onJobId':_0x24caf7=>{const _0x10b604=_0x5b3599;_0x523d13[_0x10b604(0xb9)](_0x24caf7);},'onProgress':_0x4edd54=>{const _0x1252a4=_0x5b3599;_0x523d13[_0x1252a4(0xac)](_0x1252a4(0xab)+_0x4edd54[_0x1252a4(0x99)]+']'),_0x523d13['setExtra'](formatRows(_0x4edd54[_0x1252a4(0xa0)])+'\x20rows\x20'+_0x4edd54[_0x1252a4(0xa2)]+'/'+_0x4edd54['totalSplits']+_0x1252a4(0xad));}});return _0x564cbe;},{'verbose':_0x5add05[_0x317f19(0xb5)]}),_0x36f266=_0x49b6a6[_0x317f19(0x88)],_0x3281d3=_0x36f266['jobId']?_0x317f19(0xb0)+_0x36f266[_0x317f19(0x9d)]+']':'',_0x5c779d=_0x25ccb6?'Statement\x20'+_0x35f1fe+'/'+_0x1ae02e+_0x317f19(0x9f):'';console[_0x317f19(0x8d)]('✔\x20'+_0x5c779d+_0x317f19(0xb8)+formatRows(_0x36f266[_0x317f19(0x89)][_0x317f19(0xa0)])+_0x317f19(0x8b)+(_0x317f19(0xa4)+formatElapsed(_0x36f266[_0x317f19(0x89)][_0x317f19(0xa9)])+_0x3281d3));if(_0x25ccb6&&_0x4bda39){const _0xcbf465=resolveOutputOptions(_0xc70340),_0x426818=await formatQueryOutput(_0x36f266,_0xcbf465);_0x311ee7[_0x317f19(0xaa)](_0x426818);}else await handleQueryOutput(_0x36f266,_0xc70340);}catch(_0x244d8e){const _0x2d1fbd=_0x25ccb6?_0x317f19(0xbb)+_0x35f1fe+'/'+_0x1ae02e+':\x0a':'',_0x4c0d9d=_0x244d8e instanceof SDKError?_0x244d8e[_0x317f19(0x8c)]:_0x244d8e[_0x317f19(0x96)];return console[_0x317f19(0x8d)](''+_0x2d1fbd+_0x4c0d9d),0x1;}}if(_0x2605ae[_0x317f19(0xa5)]>0x1&&_0x4bda39&&_0x311ee7[_0x317f19(0xa5)]>0x0){const _0x1429d3=_0x311ee7[_0x317f19(0x9c)]('\x0a');writeFileSync(_0x5add05['output'],_0x1429d3),console['error'](_0x317f19(0xb7)+_0x5add05['output']);}return 0x0;}catch(_0x25e4a1){throw _0x25e4a1;}}[a35_0x324720(0xb6)](_0x5dcfbc){const _0x50a7b6=a35_0x324720,_0x2ab2c6=_0x5dcfbc[_0x50a7b6(0x98)][0x0],_0x139f26=_0x5dcfbc[_0x50a7b6(0x97)]['file'];if(!_0x2ab2c6&&!_0x139f26)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(_0x2ab2c6&&_0x139f26)return _0x50a7b6(0x95);return undefined;}}
1
+ const a35_0x5c1d4e=a35_0x133c;(function(_0x3b2eda,_0x36ea7d){const _0x55785b=a35_0x133c,_0x31adb9=_0x3b2eda();while(!![]){try{const _0x33cb39=parseInt(_0x55785b(0x7b))/0x1+-parseInt(_0x55785b(0x96))/0x2*(parseInt(_0x55785b(0x94))/0x3)+parseInt(_0x55785b(0x9d))/0x4*(parseInt(_0x55785b(0x9a))/0x5)+parseInt(_0x55785b(0x82))/0x6+-parseInt(_0x55785b(0x8a))/0x7*(parseInt(_0x55785b(0xa9))/0x8)+parseInt(_0x55785b(0x98))/0x9*(parseInt(_0x55785b(0x7f))/0xa)+parseInt(_0x55785b(0x7e))/0xb*(parseInt(_0x55785b(0xa5))/0xc);if(_0x33cb39===_0x36ea7d)break;else _0x31adb9['push'](_0x31adb9['shift']());}catch(_0x9a89ea){_0x31adb9['push'](_0x31adb9['shift']());}}}(a35_0x30b6,0xada03));import{BaseCommand}from'./command.js';function a35_0x30b6(){const _0x2769e0=['execute','setPhase','Run\x20Trino\x20queries\x20(streaming)','jobId','9391236JwINDt','\x20[Job\x20ID:\x20','No\x20SQL\x20provided','message','6398416BaKOTd','file','query','SQL:\x20','verbose','Error:\x20','setJobId','\x0aAll\x20results\x20saved\x20to\x20','\x20rows\x20','name','...','303214ZyfpdU','stats','site','11YHleTO','210bkOvqT','output','processedRows','257322CVJyzt','in\x20','state','Query\x20completed:\x20Processed\x20','error','\x20splits','totalSplits','originalMessage','7YRJXmx','catalog','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','push','database','args','data','setExtra','Statement\x20','length','260556SnAyXk','Executing\x20query...','24wCPIyf','Cannot\x20specify\x20both\x20SQL\x20argument\x20and\x20--file\x20option','381519rzhCoD','Executing\x20statement\x20','890470tUHvKo','join','Catalog:\x20','12eMvIcK','options','Executing\x20query\x20[','validate'];a35_0x30b6=function(){return _0x2769e0;};return a35_0x30b6();}import{SDKError}from'../sdk/index.js';function a35_0x133c(_0x33fbe9,_0x458ceb){_0x33fbe9=_0x33fbe9-0x74;const _0x30b6c6=a35_0x30b6();let _0x133c79=_0x30b6c6[_0x33fbe9];return _0x133c79;}import{handleQueryOutput,formatQueryOutput,resolveOutputOptions}from'../core/command-output.js';import{readSqlStatementsFromFile,readSqlStatementsFromStdin,splitSqlStatements,isSqlFilePath}from'../sdk/query/sql-parser.js';import{writeFileSync}from'fs';import{withProgressSpinner,formatElapsed}from'../utils/spinner.js';import{formatRows}from'../sdk/util/formatters.js';export class QueryCommand extends BaseCommand{[a35_0x5c1d4e(0x79)]=a35_0x5c1d4e(0xab);['description']=a35_0x5c1d4e(0xa3);async[a35_0x5c1d4e(0xa1)](_0xac6e59){const _0x1b526d=a35_0x5c1d4e,{options:_0x333d58,args:_0x2a5c9b,tdx:_0x312596}=_0xac6e59,_0x1dfccd={..._0x333d58,'limitStructuredFormats':!![]},_0x52d38a=_0x2a5c9b[0x0],_0x783a0d=_0x333d58['file'];let _0x2d809b;try{if(_0x783a0d)_0x2d809b=readSqlStatementsFromFile(_0x783a0d);else{if(_0x52d38a==='-')_0x2d809b=await readSqlStatementsFromStdin();else{if(_0x52d38a&&isSqlFilePath(_0x52d38a))_0x2d809b=readSqlStatementsFromFile(_0x52d38a);else{if(_0x52d38a)_0x2d809b=splitSqlStatements(_0x52d38a);else throw new Error(_0x1b526d(0xa7));}}}}catch(_0x2ec06a){return console['error'](_0x1b526d(0x75)+_0x2ec06a['message']),0x1;}const _0x582b42=_0x333d58[_0x1b526d(0x8e)]||'information_schema',_0x52599e=_0x333d58[_0x1b526d(0x8b)];try{const _0x4c8a4d=[],_0x520c5f=!!_0x333d58[_0x1b526d(0x80)];for(let _0x4180a3=0x0;_0x4180a3<_0x2d809b[_0x1b526d(0x93)];_0x4180a3++){const _0x32caed=_0x2d809b[_0x4180a3],_0x457e9b=_0x4180a3+0x1,_0x350a45=_0x2d809b[_0x1b526d(0x93)],_0x505793=_0x350a45>0x1;_0x333d58[_0x1b526d(0x74)]&&(console[_0x1b526d(0x86)]('\x0a'+(_0x505793?_0x1b526d(0x92)+_0x457e9b+'/'+_0x350a45+':':'')),console[_0x1b526d(0x86)]('Site:\x20'+_0x333d58[_0x1b526d(0x7d)]),console[_0x1b526d(0x86)](_0x1b526d(0x9c)+(_0x52599e||'td')),console[_0x1b526d(0x86)]('Schema:\x20'+_0x582b42),console['error'](_0x1b526d(0xac)+_0x32caed));const _0x5a8397=_0x505793?_0x1b526d(0x99)+_0x457e9b+'/'+_0x350a45+_0x1b526d(0x7a):_0x1b526d(0x95);try{const _0x491b5b=await withProgressSpinner(_0x5a8397,async _0x884468=>{const _0x599e56=_0x1b526d,_0x5b81c4=await _0x312596[_0x599e56(0xab)]['execute'](_0x32caed,{'catalog':_0x52599e,'schema':_0x582b42,'onJobId':_0x4ef7e0=>{const _0x478535=_0x599e56;_0x884468[_0x478535(0x76)](_0x4ef7e0);},'onProgress':_0xe676fd=>{const _0x580c01=_0x599e56;_0x884468[_0x580c01(0xa2)](_0x580c01(0x9f)+_0xe676fd[_0x580c01(0x84)]+']'),_0x884468[_0x580c01(0x91)](formatRows(_0xe676fd[_0x580c01(0x81)])+_0x580c01(0x78)+_0xe676fd['completedSplits']+'/'+_0xe676fd[_0x580c01(0x88)]+_0x580c01(0x87));}});return _0x5b81c4;},{'verbose':_0x333d58[_0x1b526d(0x74)]}),_0x3ba2ec=_0x491b5b[_0x1b526d(0x90)],_0xd2fea9=_0x3ba2ec[_0x1b526d(0xa4)]?_0x1b526d(0xa6)+_0x3ba2ec[_0x1b526d(0xa4)]+']':'',_0x709038=_0x505793?_0x1b526d(0x92)+_0x457e9b+'/'+_0x350a45+'\x20-\x20':'';console[_0x1b526d(0x86)]('✔\x20'+_0x709038+_0x1b526d(0x85)+formatRows(_0x3ba2ec[_0x1b526d(0x7c)]['processedRows'])+_0x1b526d(0x78)+(_0x1b526d(0x83)+formatElapsed(_0x3ba2ec[_0x1b526d(0x7c)]['elapsedTimeMillis'])+_0xd2fea9));if(_0x505793&&_0x520c5f){const _0x37d61b=resolveOutputOptions(_0x1dfccd),_0x2ee23a=await formatQueryOutput(_0x3ba2ec,_0x37d61b);_0x4c8a4d[_0x1b526d(0x8d)](_0x2ee23a);}else await handleQueryOutput(_0x3ba2ec,_0x1dfccd);}catch(_0xe014ae){const _0x1ea0c6=_0x505793?_0x1b526d(0x92)+_0x457e9b+'/'+_0x350a45+':\x0a':'',_0x5d8cbb=_0xe014ae instanceof SDKError?_0xe014ae[_0x1b526d(0x89)]:_0xe014ae[_0x1b526d(0xa8)];return console[_0x1b526d(0x86)](''+_0x1ea0c6+_0x5d8cbb),0x1;}}if(_0x2d809b[_0x1b526d(0x93)]>0x1&&_0x520c5f&&_0x4c8a4d['length']>0x0){const _0x1f2846=_0x4c8a4d[_0x1b526d(0x9b)]('\x0a');writeFileSync(_0x333d58[_0x1b526d(0x80)],_0x1f2846),console[_0x1b526d(0x86)](_0x1b526d(0x77)+_0x333d58['output']);}return 0x0;}catch(_0xbfce8){throw _0xbfce8;}}[a35_0x5c1d4e(0xa0)](_0x5a1917){const _0x34397d=a35_0x5c1d4e,_0x3c8909=_0x5a1917[_0x34397d(0x8f)][0x0],_0x4cf1d0=_0x5a1917[_0x34397d(0x9e)][_0x34397d(0xaa)];if(!_0x3c8909&&!_0x4cf1d0)return _0x34397d(0x8c);if(_0x3c8909&&_0x4cf1d0)return _0x34397d(0x97);return undefined;}}
@@ -1 +1 @@
1
- const a36_0x476b5a=a36_0x335d;(function(_0x14c254,_0x4563ae){const _0xce6a16=a36_0x335d,_0x2d965a=_0x14c254();while(!![]){try{const _0xda38dc=-parseInt(_0xce6a16(0xf8))/0x1*(-parseInt(_0xce6a16(0x143))/0x2)+parseInt(_0xce6a16(0x124))/0x3+parseInt(_0xce6a16(0x119))/0x4+parseInt(_0xce6a16(0x137))/0x5*(-parseInt(_0xce6a16(0x122))/0x6)+parseInt(_0xce6a16(0x157))/0x7*(parseInt(_0xce6a16(0xe9))/0x8)+parseInt(_0xce6a16(0x134))/0x9*(-parseInt(_0xce6a16(0xf1))/0xa)+parseInt(_0xce6a16(0xe8))/0xb;if(_0xda38dc===_0x4563ae)break;else _0x2d965a['push'](_0x2d965a['shift']());}catch(_0x5e8efa){_0x2d965a['push'](_0x2d965a['shift']());}}}(a36_0x4c88,0xdb617));import{BaseCommand}from'./command.js';function a36_0x335d(_0x255ee5,_0x26bd34){_0x255ee5=_0x255ee5-0xe3;const _0x4c88b4=a36_0x4c88();let _0x335d0b=_0x4c88b4[_0x255ee5];return _0x335d0b;}import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,handleSingleObjectOutput,writeOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import{confirm}from'../utils/prompt.js';import{readFileSync}from'fs';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import{getConsoleUrl}from'../sdk/client/endpoints.js';import{hyperlink}from'../sdk/util/formatters.js';import a36_0x171e14 from'chalk';function formatRelativeTime(_0x1571c3){const _0x89015d=a36_0x335d,_0x577ed3=new Date(_0x1571c3),_0x3bb061=new Date(),_0x52eec2=_0x577ed3['getTime']()-_0x3bb061['getTime'](),_0x1e0af2=Math[_0x89015d(0x14c)](_0x52eec2)/0x3e8,_0x42f7d2=_0x52eec2<0x0;if(_0x1e0af2<0x3c)return _0x42f7d2?_0x89015d(0x146):_0x89015d(0x13f);else{if(_0x1e0af2<0xe10){const _0x5c7f70=Math[_0x89015d(0x111)](_0x1e0af2/0x3c);return _0x42f7d2?_0x5c7f70+_0x89015d(0xfd):'in\x20'+_0x5c7f70+'m';}else{if(_0x1e0af2<0x15180){const _0x40a2a4=Math[_0x89015d(0x111)](_0x1e0af2/0xe10);return _0x42f7d2?_0x40a2a4+_0x89015d(0x11b):_0x89015d(0x127)+_0x40a2a4+'h';}else{if(_0x1e0af2<0x93a80){const _0x51ebc6=Math[_0x89015d(0x111)](_0x1e0af2/0x15180);return _0x42f7d2?_0x51ebc6+'d\x20ago':'in\x20'+_0x51ebc6+'d';}else return _0x577ed3['toLocaleDateString']();}}}}export class ScheduleListCommand extends BaseCommand{['name']='schedule:list';[a36_0x476b5a(0x141)]=a36_0x476b5a(0x132);async[a36_0x476b5a(0xec)](_0x2226ba){const _0x51519d=a36_0x476b5a,{options:_0x5d61d9,args:_0x2994cf,tdx:_0x2fea0f}=_0x2226ba,_0x585a8e=resolveLimit(_0x5d61d9[_0x51519d(0x107)],DEFAULT_DISPLAY_LIMIT),_0x584b63=_0x2994cf[0x0],_0xa2b2ed=_0x584b63?_0x51519d(0x13a)+_0x584b63+_0x51519d(0xe4):_0x51519d(0x12b),_0x87fcc=await withSpinner(_0xa2b2ed,()=>_0x2fea0f[_0x51519d(0x115)]['listQueries']({'limit':_0x585a8e,'scheduled':!![],'pattern':_0x584b63}),{'verbose':_0x5d61d9[_0x51519d(0x104)]}),_0x5d4488=_0x87fcc[_0x51519d(0x112)][_0x51519d(0x110)],_0x4fdd21=_0x87fcc[_0x51519d(0x112)]['pagination'][_0x51519d(0x109)],_0x399527=_0x584b63?_0x51519d(0x147)+_0x584b63+'\x22':'';_0x4fdd21?console['error']('Showing\x20first\x20'+_0x5d4488[_0x51519d(0x139)]+'\x20schedules'+_0x399527+_0x51519d(0x12a)):console[_0x51519d(0x152)](_0x51519d(0x10a)+_0x5d4488[_0x51519d(0x139)]+'\x20scheduled\x20quer'+(_0x5d4488[_0x51519d(0x139)]!==0x1?_0x51519d(0x108):'y')+_0x399527);if(_0x5d61d9[_0x51519d(0x12c)]===_0x51519d(0x11e)||_0x5d61d9[_0x51519d(0x12c)]===_0x51519d(0x16c)||_0x5d61d9[_0x51519d(0x12c)]===_0x51519d(0x116)||_0x5d61d9[_0x51519d(0x12c)]===_0x51519d(0x11a)){const _0x1bab29=_0x5d4488[_0x51519d(0x173)](_0x390b3d=>({'id':_0x390b3d['id'],'name':_0x390b3d[_0x51519d(0x148)],'cron':_0x390b3d['cron'],'database':_0x390b3d[_0x51519d(0x138)]?.[_0x51519d(0x148)],'type':_0x390b3d['type'],'timezone':_0x390b3d[_0x51519d(0x16d)],'user_name':_0x390b3d[_0x51519d(0x163)]?.[_0x51519d(0x148)],'updated_at':_0x390b3d[_0x51519d(0x168)],'next_run_at':_0x390b3d[_0x51519d(0x126)],'last_job_status':_0x390b3d[_0x51519d(0x172)]?.[_0x51519d(0x105)]}));await handleSDKOutput(_0x1bab29,_0x5d61d9);}else{if(_0x5d4488[_0x51519d(0x139)]===0x0)console[_0x51519d(0x14e)](_0x51519d(0xee));else{const _0x250845=_0x5d61d9[_0x51519d(0xfe)],_0x1f43cd=_0x5d4488[_0x51519d(0x173)](_0x3e3330=>{const _0xaf6b18=_0x51519d,_0x310767=_0x3e3330[_0xaf6b18(0x172)]?.[_0xaf6b18(0x105)]?_0x3e3330[_0xaf6b18(0x172)][_0xaf6b18(0x105)]==='success'?'✓':'✗':'-',_0x5b8b32=_0x3e3330[_0xaf6b18(0x172)]?.[_0xaf6b18(0xed)]?formatRelativeTime(_0x3e3330[_0xaf6b18(0x172)][_0xaf6b18(0xed)]):_0xaf6b18(0x123),_0x4fe5a9=_0x3e3330[_0xaf6b18(0x126)]?formatRelativeTime(_0x3e3330[_0xaf6b18(0x126)]):'-',_0x2b57e5=_0x3e3330[_0xaf6b18(0x15c)]||'',_0x3ed17a=_0x3e3330[_0xaf6b18(0x148)]||_0xaf6b18(0x140),_0x2cf697=getConsoleUrl(_0x250845,_0xaf6b18(0x10b)+_0x3e3330['id']);return{'statusIcon':_0x310767,'lastRun':_0x5b8b32,'nextRun':_0x4fe5a9,'cron':_0x2b57e5,'name':_0x3ed17a,'queryUrl':_0x2cf697,'status':_0x3e3330[_0xaf6b18(0x172)]?.[_0xaf6b18(0x105)]};}),_0x3ac8c6=Math[_0x51519d(0x102)](..._0x1f43cd[_0x51519d(0x173)](_0x4ce91a=>_0x4ce91a['lastRun'][_0x51519d(0x139)])),_0x11f554=Math[_0x51519d(0x102)](..._0x1f43cd[_0x51519d(0x173)](_0x1d82c8=>_0x1d82c8['nextRun'][_0x51519d(0x139)])),_0x52dc14=Math[_0x51519d(0x102)](..._0x1f43cd[_0x51519d(0x173)](_0x258b95=>_0x258b95['cron'][_0x51519d(0x139)])),_0x4ae7f2=_0x1f43cd['map'](_0x1cf71b=>{const _0x10938c=_0x51519d,_0x50116a=_0x1cf71b[_0x10938c(0x105)]===_0x10938c(0x113)?a36_0x171e14[_0x10938c(0x14b)](_0x1cf71b[_0x10938c(0x120)]):_0x1cf71b[_0x10938c(0x105)]===_0x10938c(0x152)?a36_0x171e14['red'](_0x1cf71b['statusIcon']):a36_0x171e14['dim'](_0x1cf71b[_0x10938c(0x120)]),_0x48683=_0x1cf71b['lastRun']['padEnd'](_0x3ac8c6),_0x31c5e1=_0x1cf71b[_0x10938c(0x11f)][_0x10938c(0x151)](_0x11f554),_0xaa11af=_0x1cf71b[_0x10938c(0x15c)]?a36_0x171e14[_0x10938c(0xf6)](_0x1cf71b[_0x10938c(0x15c)]['padEnd'](_0x52dc14)):'\x20'['repeat'](_0x52dc14),_0x2fa27c=hyperlink(_0x1cf71b[_0x10938c(0x148)],_0x1cf71b[_0x10938c(0x16e)]);return _0x10938c(0x12e)+_0x50116a+'\x20'+_0x48683+_0x10938c(0x128)+_0x31c5e1+'\x20\x20'+_0xaa11af+'\x20\x20'+_0x2fa27c;});await writeOutput(_0x4ae7f2[_0x51519d(0x15a)]('\x0a'),_0x5d61d9[_0x51519d(0x165)],_0x51519d(0x136));}}return 0x0;}}export class ScheduleShowCommand extends BaseCommand{['name']=a36_0x476b5a(0x150);[a36_0x476b5a(0x141)]=a36_0x476b5a(0x15f);[a36_0x476b5a(0x129)](_0x50381d){const _0x2ed4dd=a36_0x476b5a,_0x4ff40d=_0x50381d[_0x2ed4dd(0x14f)][0x0];if(!_0x4ff40d)return _0x2ed4dd(0xf7);return undefined;}async[a36_0x476b5a(0xec)](_0x137346){const _0x29825a=a36_0x476b5a,{options:_0x3debae,args:_0x1c1d88,tdx:_0x2ab049}=_0x137346,_0x4fe5af=_0x1c1d88[0x0],_0x120f61=await withSpinner(_0x29825a(0x16f),()=>_0x2ab049[_0x29825a(0x115)]['show'](_0x4fe5af),{'verbose':_0x3debae[_0x29825a(0x104)]}),_0x308949=_0x120f61[_0x29825a(0x112)],_0x481d6c={'name':_0x308949[_0x29825a(0x148)],'cron':_0x308949['cron'],'database':_0x308949[_0x29825a(0x138)],'type':_0x308949['type'],'timezone':_0x308949[_0x29825a(0x153)],'user_name':_0x308949[_0x29825a(0x10d)],'created_at':_0x308949[_0x29825a(0xf2)],'engine_version':_0x308949[_0x29825a(0x131)],'executing_user_id':_0x308949['executing_user_id'],'query':_0x308949[_0x29825a(0xeb)],'delay':_0x308949[_0x29825a(0x135)],'priority':_0x308949[_0x29825a(0x121)],'retry_limit':_0x308949[_0x29825a(0x149)],..._0x308949['result']&&{'result':_0x308949['result']}};return await handleSingleObjectOutput(_0x481d6c,_0x3debae),0x0;}}export class ScheduleCreateCommand extends BaseCommand{[a36_0x476b5a(0x148)]=a36_0x476b5a(0x14d);['description']='Create\x20a\x20scheduled\x20query';['validate'](_0x357379){const _0x12579d=a36_0x476b5a,_0x16e785=_0x357379[_0x12579d(0x14f)][0x0];if(!_0x16e785)return _0x12579d(0x170);const _0x89432c=_0x357379[_0x12579d(0x16a)];if(!_0x89432c[_0x12579d(0x138)])return _0x12579d(0x103);return undefined;}async[a36_0x476b5a(0xec)](_0x1de887){const _0x5f0882=a36_0x476b5a,{options:_0x473ab4,args:_0x1c45e2,tdx:_0x296dd5}=_0x1de887,_0x123ba9=_0x1c45e2[0x0],_0x128a0e=_0x473ab4,_0x4ab3db=_0x128a0e[_0x5f0882(0x138)],_0x274bca=_0x128a0e[_0x5f0882(0x144)],_0x391859=_0x128a0e[_0x5f0882(0x16b)]||_0x5f0882(0x145);let _0x46917d;try{_0x46917d=readFileSync(_0x274bca,_0x5f0882(0xfc))['trim']();}catch(_0xb958e6){throw new SDKError(ErrorCode[_0x5f0882(0x13d)],_0x5f0882(0x133)+_0x274bca,_0xb958e6 instanceof Error?_0xb958e6:undefined);}if(!_0x46917d)throw new SDKError(ErrorCode[_0x5f0882(0x13d)],_0x5f0882(0x164));const _0x30cd88={'database':_0x4ab3db,'query':_0x46917d,'type':_0x391859};if(_0x128a0e[_0x5f0882(0x15c)])_0x30cd88[_0x5f0882(0x15c)]=_0x128a0e[_0x5f0882(0x15c)];if(_0x128a0e[_0x5f0882(0x153)])_0x30cd88['timezone']=_0x128a0e['timezone'];if(_0x128a0e[_0x5f0882(0x135)]!==undefined)_0x30cd88[_0x5f0882(0x135)]=Number(_0x128a0e[_0x5f0882(0x135)]);if(_0x128a0e[_0x5f0882(0x121)]!==undefined)_0x30cd88[_0x5f0882(0x121)]=Number(_0x128a0e[_0x5f0882(0x121)]);if(_0x128a0e['retryLimit']!==undefined)_0x30cd88[_0x5f0882(0x149)]=Number(_0x128a0e[_0x5f0882(0xf4)]);if(_0x128a0e['engineVersion'])_0x30cd88[_0x5f0882(0x131)]=_0x128a0e[_0x5f0882(0xf0)];if(_0x128a0e[_0x5f0882(0xe5)])_0x30cd88[_0x5f0882(0xe5)]=_0x128a0e[_0x5f0882(0xe5)];if(_0x473ab4['verbose']){console[_0x5f0882(0x152)](_0x5f0882(0xf9)+_0x123ba9),console[_0x5f0882(0x152)]('\x20\x20Database:\x20'+_0x4ab3db),console[_0x5f0882(0x152)](_0x5f0882(0x167)+_0x391859);if(_0x30cd88[_0x5f0882(0x15c)])console['error'](_0x5f0882(0x13b)+_0x30cd88[_0x5f0882(0x15c)]);if(_0x30cd88[_0x5f0882(0x153)])console['error'](_0x5f0882(0xf5)+_0x30cd88[_0x5f0882(0x153)]);}const _0x4bbc68=await withSpinner('Creating\x20schedule...',()=>_0x296dd5['schedules'][_0x5f0882(0xe7)](_0x123ba9,_0x30cd88),{'verbose':_0x473ab4[_0x5f0882(0x104)]});return console[_0x5f0882(0x152)](_0x5f0882(0x166)+_0x4bbc68[_0x5f0882(0x112)][_0x5f0882(0x148)]),await handleSingleObjectOutput(_0x4bbc68[_0x5f0882(0x112)],_0x473ab4),0x0;}}export class ScheduleUpdateCommand extends BaseCommand{[a36_0x476b5a(0x148)]='schedule:update';[a36_0x476b5a(0x141)]=a36_0x476b5a(0x14a);[a36_0x476b5a(0x129)](_0x3ecd3b){const _0x247fbe=a36_0x476b5a,_0x4387a4=_0x3ecd3b[_0x247fbe(0x14f)][0x0];if(!_0x4387a4)return _0x247fbe(0x160);return undefined;}async['execute'](_0x58c5de){const _0x4c0379=a36_0x476b5a,{options:_0x21fa3c,args:_0x2d557a,tdx:_0x3167e3}=_0x58c5de,_0xc5d98=_0x2d557a[0x0],_0x9a183f=_0x21fa3c,_0x1e6697={};if(_0x9a183f[_0x4c0379(0x138)])_0x1e6697['database']=_0x9a183f[_0x4c0379(0x138)];if(_0x9a183f[_0x4c0379(0x16b)])_0x1e6697[_0x4c0379(0x16b)]=_0x9a183f['type'];if(_0x9a183f[_0x4c0379(0x15c)])_0x1e6697[_0x4c0379(0x15c)]=_0x9a183f[_0x4c0379(0x15c)];if(_0x9a183f[_0x4c0379(0x153)])_0x1e6697[_0x4c0379(0x153)]=_0x9a183f[_0x4c0379(0x153)];if(_0x9a183f[_0x4c0379(0x135)]!==undefined)_0x1e6697[_0x4c0379(0x135)]=Number(_0x9a183f[_0x4c0379(0x135)]);if(_0x9a183f[_0x4c0379(0x121)]!==undefined)_0x1e6697['priority']=Number(_0x9a183f[_0x4c0379(0x121)]);if(_0x9a183f[_0x4c0379(0xf4)]!==undefined)_0x1e6697[_0x4c0379(0x149)]=Number(_0x9a183f[_0x4c0379(0xf4)]);if(_0x9a183f['engineVersion'])_0x1e6697[_0x4c0379(0x131)]=_0x9a183f[_0x4c0379(0xf0)];if(_0x9a183f[_0x4c0379(0xe5)])_0x1e6697[_0x4c0379(0xe5)]=_0x9a183f['result'];if(_0x9a183f[_0x4c0379(0x144)])try{_0x1e6697['query']=readFileSync(_0x9a183f[_0x4c0379(0x144)],'utf-8')[_0x4c0379(0x159)]();}catch(_0x4a701b){throw new SDKError(ErrorCode[_0x4c0379(0x13d)],_0x4c0379(0x133)+_0x9a183f[_0x4c0379(0x144)],_0x4a701b instanceof Error?_0x4a701b:undefined);}if(Object[_0x4c0379(0x154)](_0x1e6697)[_0x4c0379(0x139)]===0x0)throw new SDKError(ErrorCode[_0x4c0379(0x13d)],'At\x20least\x20one\x20option\x20must\x20be\x20provided\x20to\x20update');if(_0x21fa3c[_0x4c0379(0x104)]){console[_0x4c0379(0x152)](_0x4c0379(0x171)+_0xc5d98);for(const [_0x4416a6,_0x2afbd4]of Object[_0x4c0379(0x13c)](_0x1e6697)){_0x4416a6===_0x4c0379(0xeb)?console[_0x4c0379(0x152)]('\x20\x20'+_0x4416a6+':\x20'+_0x2afbd4[_0x4c0379(0x10e)](0x0,0x32)+_0x4c0379(0x100)):console[_0x4c0379(0x152)]('\x20\x20'+_0x4416a6+':\x20'+_0x2afbd4);}}const _0x1f5743=await withSpinner('Updating\x20schedule...',()=>_0x3167e3['schedules'][_0x4c0379(0x114)](_0xc5d98,_0x1e6697),{'verbose':_0x21fa3c['verbose']});return console[_0x4c0379(0x152)](_0x4c0379(0x155)+_0x1f5743['data'][_0x4c0379(0x148)]),await handleSingleObjectOutput(_0x1f5743['data'],_0x21fa3c),0x0;}}export class ScheduleDeleteCommand extends BaseCommand{[a36_0x476b5a(0x148)]='schedule:delete';[a36_0x476b5a(0x141)]='Delete\x20a\x20scheduled\x20query';[a36_0x476b5a(0x129)](_0x4407ef){const _0x521231=_0x4407ef['args'][0x0];if(!_0x521231)return'Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20delete\x20<name>';return undefined;}async[a36_0x476b5a(0xec)](_0x278743){const _0x4ff159=a36_0x476b5a,{options:_0x21dae5,args:_0x1d4a30,tdx:_0x5d0cba}=_0x278743,_0x71040c=_0x1d4a30[0x0];if(!_0x21dae5[_0x4ff159(0x11c)]){const _0x2d6e1c=await confirm(_0x4ff159(0x106)+_0x71040c+'\x22?');if(!_0x2d6e1c)return console[_0x4ff159(0x152)](_0x4ff159(0xe6)),0x0;}const _0x404bf6=await withSpinner(_0x4ff159(0x15d),()=>_0x5d0cba[_0x4ff159(0x115)][_0x4ff159(0xf3)](_0x71040c),{'verbose':_0x21dae5[_0x4ff159(0x104)]});return console[_0x4ff159(0x152)](_0x4ff159(0x12d)+_0x404bf6[_0x4ff159(0x112)][_0x4ff159(0x148)]),0x0;}}export class ScheduleRunCommand extends BaseCommand{[a36_0x476b5a(0x148)]=a36_0x476b5a(0x11d);[a36_0x476b5a(0x141)]='Run\x20a\x20scheduled\x20query\x20immediately';[a36_0x476b5a(0x129)](_0x2f8238){const _0x17d91d=a36_0x476b5a,_0x5d0285=_0x2f8238['args'][0x0];if(!_0x5d0285)return _0x17d91d(0xea);return undefined;}async[a36_0x476b5a(0xec)](_0x5964b8){const _0x2317bc=a36_0x476b5a,{options:_0x523ec5,args:_0x1e8bc3,tdx:_0x34a155}=_0x5964b8,_0x4bf86c=_0x1e8bc3[0x0],_0x557f1f=_0x523ec5,_0x39c811=_0x557f1f[_0x2317bc(0xfb)],_0x3543a8=_0x557f1f[_0x2317bc(0x125)]!==undefined?Number(_0x557f1f[_0x2317bc(0x125)]):undefined;if(_0x523ec5[_0x2317bc(0x104)]){console[_0x2317bc(0x152)](_0x2317bc(0x15b)+_0x4bf86c);if(_0x39c811)console['error'](_0x2317bc(0xff)+_0x39c811);if(_0x3543a8)console[_0x2317bc(0x152)]('\x20\x20Num:\x20'+_0x3543a8);}const _0x2a03ad=await withSpinner(_0x2317bc(0x12f),()=>_0x34a155[_0x2317bc(0x115)][_0x2317bc(0xef)](_0x4bf86c,{'time':_0x39c811,'num':_0x3543a8}),{'verbose':_0x523ec5[_0x2317bc(0x104)]}),_0x3a09ea=_0x2a03ad['data'][_0x2317bc(0x158)];console[_0x2317bc(0x152)](_0x2317bc(0x156)+_0x3a09ea[_0x2317bc(0x139)]+_0x2317bc(0x169)+(_0x3a09ea[_0x2317bc(0x139)]!==0x1?'s':'')+_0x2317bc(0x10f));for(const _0x211d77 of _0x3a09ea){console[_0x2317bc(0x152)](_0x2317bc(0x15e)+_0x211d77['job_id']);}return await handleSDKOutput(_0x3a09ea,_0x523ec5),0x0;}}function a36_0x4c88(){const _0x39dc38=['in\x20','\x20\x20→\x20','validate','\x20(use\x20--limit\x20to\x20see\x20more)','Listing\x20scheduled\x20queries...','format','Schedule\x20deleted:\x20','📅\x20','Running\x20schedule...','Show\x20schedule\x20execution\x20history','engine_version','List\x20scheduled\x20queries','Failed\x20to\x20read\x20file:\x20','63117fbuaEV','delay','list','1710rGPffa','database','length','Searching\x20scheduled\x20queries\x20matching\x20\x22','\x20\x20Cron:\x20','entries','INVALID_ARGUMENT','history','soon','(unnamed)','description','count','37550HkAluy','file','trino','just\x20now','\x20matching\x20\x22','name','retry_limit','Update\x20a\x20scheduled\x20query','green','abs','schedule:create','log','args','schedule:show','padEnd','error','timezone','keys','Schedule\x20updated:\x20','Schedule\x20run\x20submitted:\x20','3535gcvwYR','jobs','trim','join','Running\x20schedule:\x20','cron','Deleting\x20schedule...','\x20\x20Job\x20ID:\x20','Show\x20schedule\x20details','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20update\x20<name>\x20[options]','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20history\x20<name>\x20[--from\x20<n>]\x20[--to\x20<n>]','from','user','Query\x20file\x20is\x20empty','output','Schedule\x20created:\x20','\x20\x20Type:\x20','updated_at','\x20job','options','type','jsonl','time_zone','queryUrl','Getting\x20schedule\x20details...','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]','Updating\x20schedule:\x20','last_job','map','\x20execution','\x22...','result','Cancelled','create','626450lKlAJS','18296GJhjXN','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20run\x20<name>\x20[--time\x20<iso8601>]\x20[--num\x20<1-10>]','query','execute','ended_at','No\x20scheduled\x20queries\x20found','run','engineVersion','1910iyKcKQ','created_at','delete','retryLimit','\x20\x20Timezone:\x20','cyan','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20show\x20<name>','7WDlWYG','Creating\x20schedule:\x20','job_id','time','utf-8','m\x20ago','site','\x20\x20Time:\x20','...','scheduled_at','max','Database\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]','verbose','status','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20schedule\x20\x22','limit','ies','has_next_page','Found\x20','/app/queries/editor?queryId=','\x20(showing\x20','user_name','substring','\x20created','queries','round','data','success','update','schedules','table','end_at','Getting\x20schedule\x20history...','742288BVOuly','tsv','h\x20ago','yes','schedule:run','json','nextRun','statusIcon','priority','2622PYUSBL','never','2575914FoCHDw','num','next_run_at'];a36_0x4c88=function(){return _0x39dc38;};return a36_0x4c88();}export class ScheduleHistoryCommand extends BaseCommand{[a36_0x476b5a(0x148)]='schedule:history';[a36_0x476b5a(0x141)]=a36_0x476b5a(0x130);[a36_0x476b5a(0x129)](_0x1ab10d){const _0x480323=a36_0x476b5a,_0x4a6634=_0x1ab10d[_0x480323(0x14f)][0x0];if(!_0x4a6634)return _0x480323(0x161);return undefined;}async[a36_0x476b5a(0xec)](_0x31013f){const _0x1e8266=a36_0x476b5a,{options:_0x4cfb08,args:_0x43fced,tdx:_0x4edb7d}=_0x31013f,_0xfa112=_0x43fced[0x0],_0x20daad=_0x4cfb08,_0x51b03c=_0x20daad[_0x1e8266(0x162)]!==undefined?Number(_0x20daad[_0x1e8266(0x162)]):undefined,_0xa09504=_0x20daad['to']!==undefined?Number(_0x20daad['to']):undefined,_0x2425e2=await withSpinner(_0x1e8266(0x118),()=>_0x4edb7d[_0x1e8266(0x115)][_0x1e8266(0x13e)](_0xfa112,{'from':_0x51b03c,'to':_0xa09504}),{'verbose':_0x4cfb08[_0x1e8266(0x104)]}),_0x496fae=_0x2425e2[_0x1e8266(0x112)];console[_0x1e8266(0x152)](_0x1e8266(0x10a)+_0x496fae[_0x1e8266(0x142)]+_0x1e8266(0xe3)+(_0x496fae[_0x1e8266(0x142)]!==0x1?'s':'')+_0x1e8266(0x10c)+_0x496fae[_0x1e8266(0x162)]+'-'+_0x496fae['to']+')');const _0x3b41c7=_0x496fae[_0x1e8266(0x13e)]['map'](_0x14dc1b=>({'job_id':_0x14dc1b[_0x1e8266(0xfa)],'type':_0x14dc1b['type'],'status':_0x14dc1b[_0x1e8266(0x105)],'scheduled_at':_0x14dc1b[_0x1e8266(0x101)],'created_at':_0x14dc1b['created_at'],'start_at':_0x14dc1b['start_at'],'end_at':_0x14dc1b[_0x1e8266(0x117)]}));return await handleSDKOutput(_0x3b41c7,_0x4cfb08),0x0;}}
1
+ const a36_0x396664=a36_0x1761;function a36_0xe54b(){const _0x4ecead=['description','num','Run\x20a\x20scheduled\x20query\x20immediately','jsonl','8793480xxRgmD','9757VUfzGW','retryLimit','ended_at','getTime','Getting\x20schedule\x20history...','error','green','6383146bbUsTO','pagination','execute','count','type','Running\x20schedule...','length','user','output','dim','log','Searching\x20scheduled\x20queries\x20matching\x20\x22','success','max','yes','queryUrl','last_job','toLocaleDateString','file','in\x20','h\x20ago','entries','Failed\x20to\x20read\x20file:\x20','Schedule\x20updated:\x20','cyan','history','timezone','created_at','Update\x20a\x20scheduled\x20query','Create\x20a\x20scheduled\x20query','\x20\x20Cron:\x20','engineVersion','options','site','cron','verbose','abs','nextRun','map','\x20\x20→\x20','Showing\x20first\x20','validate','Creating\x20schedule...','time_zone','\x20execution','table','\x20\x20Time:\x20','end_at','keys','271584aZEUIc','listQueries','\x20matching\x20\x22','Schedule\x20created:\x20','374852TmsAHP','status','utf-8','\x20\x20Database:\x20','schedule:run','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20run\x20<name>\x20[--time\x20<iso8601>]\x20[--num\x20<1-10>]','retry_limit','has_next_page','Updating\x20schedule...','database','soon','INVALID_ARGUMENT','job_id','Schedule\x20deleted:\x20','schedules','data','result','Getting\x20schedule\x20details...','Deleting\x20schedule...','(unnamed)','140094DJIYqz','schedule:list','Updating\x20schedule:\x20','schedule:delete','query','\x22...','Found\x20','list','padEnd','Schedule\x20run\x20submitted:\x20','next_run_at','📅\x20','8WIfYDF','No\x20scheduled\x20queries\x20found','Delete\x20a\x20scheduled\x20query','Show\x20schedule\x20execution\x20history','format','...','time','priority','schedule:create','Cancelled','from','args','jobs','\x20created','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20delete\x20<name>','schedule:history','\x20schedules','tsv','trino','\x20scheduled\x20quer','List\x20scheduled\x20queries','lastRun','4007619TmauMu','At\x20least\x20one\x20option\x20must\x20be\x20provided\x20to\x20update','20RrTBzb','substring','statusIcon','engine_version','updated_at','\x20\x20Type:\x20','join','d\x20ago','/app/queries/editor?queryId=','name','Listing\x20scheduled\x20queries...','145hdeYBq','\x20\x20Num:\x20','Creating\x20schedule:\x20','json','47230LMqosh','delay','schedule:update','just\x20now','trim','round','Show\x20schedule\x20details','m\x20ago'];a36_0xe54b=function(){return _0x4ecead;};return a36_0xe54b();}(function(_0x25808b,_0x3fddaf){const _0x50ff41=a36_0x1761,_0x4fde9f=_0x25808b();while(!![]){try{const _0x55b51e=-parseInt(_0x50ff41(0x156))/0x1*(-parseInt(_0x50ff41(0x176))/0x2)+-parseInt(_0x50ff41(0x152))/0x3*(-parseInt(_0x50ff41(0x18e))/0x4)+parseInt(_0x50ff41(0x199))/0x5*(parseInt(_0x50ff41(0x16a))/0x6)+parseInt(_0x50ff41(0x1b1))/0x7+parseInt(_0x50ff41(0x1a9))/0x8+parseInt(_0x50ff41(0x18c))/0x9+parseInt(_0x50ff41(0x19d))/0xa*(-parseInt(_0x50ff41(0x1aa))/0xb);if(_0x55b51e===_0x3fddaf)break;else _0x4fde9f['push'](_0x4fde9f['shift']());}catch(_0x5447d1){_0x4fde9f['push'](_0x4fde9f['shift']());}}}(a36_0xe54b,0xdacde));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_0x1761(_0x5b397e,_0x39b44f){_0x5b397e=_0x5b397e-0x128;const _0xe54b42=a36_0xe54b();let _0x1761e4=_0xe54b42[_0x5b397e];return _0x1761e4;}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_0x3a158c from'chalk';function formatRelativeTime(_0x379b25){const _0x113d24=a36_0x1761,_0x5d17a4=new Date(_0x379b25),_0x35956c=new Date(),_0x2a1ebe=_0x5d17a4[_0x113d24(0x1ad)]()-_0x35956c[_0x113d24(0x1ad)](),_0x4bb8e6=Math[_0x113d24(0x145)](_0x2a1ebe)/0x3e8,_0x3aa9c5=_0x2a1ebe<0x0;if(_0x4bb8e6<0x3c)return _0x3aa9c5?_0x113d24(0x1a0):_0x113d24(0x160);else{if(_0x4bb8e6<0xe10){const _0x1e5d57=Math[_0x113d24(0x1a2)](_0x4bb8e6/0x3c);return _0x3aa9c5?_0x1e5d57+_0x113d24(0x1a4):_0x113d24(0x134)+_0x1e5d57+'m';}else{if(_0x4bb8e6<0x15180){const _0x2d3c0f=Math[_0x113d24(0x1a2)](_0x4bb8e6/0xe10);return _0x3aa9c5?_0x2d3c0f+_0x113d24(0x135):_0x113d24(0x134)+_0x2d3c0f+'h';}else{if(_0x4bb8e6<0x93a80){const _0x172198=Math[_0x113d24(0x1a2)](_0x4bb8e6/0x15180);return _0x3aa9c5?_0x172198+_0x113d24(0x195):_0x113d24(0x134)+_0x172198+'d';}else return _0x5d17a4[_0x113d24(0x132)]();}}}}export class ScheduleListCommand extends BaseCommand{[a36_0x396664(0x197)]=a36_0x396664(0x16b);[a36_0x396664(0x1a5)]=a36_0x396664(0x18a);async['execute'](_0x9d0e00){const _0x1c5de7=a36_0x396664,{options:_0x2b5029,args:_0x355997,tdx:_0x243391}=_0x9d0e00,_0x3f15ef=resolveLimit(_0x2b5029['limit'],DEFAULT_DISPLAY_LIMIT),_0x3f0fc0=_0x355997[0x0],_0xc2ea1c=_0x3f0fc0?_0x1c5de7(0x12c)+_0x3f0fc0+_0x1c5de7(0x16f):_0x1c5de7(0x198),_0x5c08d1=await withSpinner(_0xc2ea1c,()=>_0x243391[_0x1c5de7(0x164)][_0x1c5de7(0x153)]({'limit':_0x3f15ef,'scheduled':!![],'pattern':_0x3f0fc0}),{'verbose':_0x2b5029[_0x1c5de7(0x144)]}),_0x3b3320=_0x5c08d1[_0x1c5de7(0x165)]['queries'],_0x4e5b64=_0x5c08d1[_0x1c5de7(0x165)][_0x1c5de7(0x1b2)][_0x1c5de7(0x15d)],_0x2d7b71=_0x3f0fc0?_0x1c5de7(0x154)+_0x3f0fc0+'\x22':'';_0x4e5b64?console[_0x1c5de7(0x1af)](_0x1c5de7(0x149)+_0x3b3320[_0x1c5de7(0x1b7)]+_0x1c5de7(0x186)+_0x2d7b71+'\x20(use\x20--limit\x20to\x20see\x20more)'):console[_0x1c5de7(0x1af)](_0x1c5de7(0x170)+_0x3b3320[_0x1c5de7(0x1b7)]+_0x1c5de7(0x189)+(_0x3b3320[_0x1c5de7(0x1b7)]!==0x1?'ies':'y')+_0x2d7b71);if(_0x2b5029[_0x1c5de7(0x17a)]===_0x1c5de7(0x19c)||_0x2b5029[_0x1c5de7(0x17a)]===_0x1c5de7(0x1a8)||_0x2b5029[_0x1c5de7(0x17a)]===_0x1c5de7(0x14e)||_0x2b5029['format']===_0x1c5de7(0x187)){const _0x25e423=_0x3b3320[_0x1c5de7(0x147)](_0x441a1a=>({'id':_0x441a1a['id'],'name':_0x441a1a[_0x1c5de7(0x197)],'cron':_0x441a1a[_0x1c5de7(0x143)],'database':_0x441a1a[_0x1c5de7(0x15f)]?.[_0x1c5de7(0x197)],'type':_0x441a1a[_0x1c5de7(0x1b5)],'timezone':_0x441a1a[_0x1c5de7(0x14c)],'user_name':_0x441a1a[_0x1c5de7(0x128)]?.[_0x1c5de7(0x197)],'updated_at':_0x441a1a[_0x1c5de7(0x192)],'next_run_at':_0x441a1a[_0x1c5de7(0x174)],'last_job_status':_0x441a1a['last_job']?.[_0x1c5de7(0x157)]}));await handleSDKOutput(_0x25e423,_0x2b5029);}else{if(_0x3b3320[_0x1c5de7(0x1b7)]===0x0)console[_0x1c5de7(0x12b)](_0x1c5de7(0x177));else{const _0x42b129=_0x2b5029[_0x1c5de7(0x142)],_0x3b9cb0=_0x3b3320[_0x1c5de7(0x147)](_0x3b4ed7=>{const _0x6fad78=_0x1c5de7,_0x3751b1=_0x3b4ed7['last_job']?.['status']?_0x3b4ed7[_0x6fad78(0x131)]['status']==='success'?'✓':'✗':'-',_0x419344=_0x3b4ed7[_0x6fad78(0x131)]?.[_0x6fad78(0x1ac)]?formatRelativeTime(_0x3b4ed7[_0x6fad78(0x131)][_0x6fad78(0x1ac)]):'never',_0x5f4efa=_0x3b4ed7[_0x6fad78(0x174)]?formatRelativeTime(_0x3b4ed7['next_run_at']):'-',_0x3963c8=_0x3b4ed7[_0x6fad78(0x143)]||'',_0x590f80=_0x3b4ed7['name']||_0x6fad78(0x169),_0x1ca90a=getConsoleUrl(_0x42b129,_0x6fad78(0x196)+_0x3b4ed7['id']);return{'statusIcon':_0x3751b1,'lastRun':_0x419344,'nextRun':_0x5f4efa,'cron':_0x3963c8,'name':_0x590f80,'queryUrl':_0x1ca90a,'status':_0x3b4ed7['last_job']?.[_0x6fad78(0x157)]};}),_0x26a5ff=Math[_0x1c5de7(0x12e)](..._0x3b9cb0[_0x1c5de7(0x147)](_0x4c36a9=>_0x4c36a9[_0x1c5de7(0x18b)][_0x1c5de7(0x1b7)])),_0x4db5e9=Math[_0x1c5de7(0x12e)](..._0x3b9cb0[_0x1c5de7(0x147)](_0x36dadf=>_0x36dadf[_0x1c5de7(0x146)][_0x1c5de7(0x1b7)])),_0x49d413=Math['max'](..._0x3b9cb0[_0x1c5de7(0x147)](_0x53f7dd=>_0x53f7dd['cron'][_0x1c5de7(0x1b7)])),_0x32f419=_0x3b9cb0[_0x1c5de7(0x147)](_0x13254e=>{const _0xe2a94f=_0x1c5de7,_0xd3ccbe=_0x13254e[_0xe2a94f(0x157)]===_0xe2a94f(0x12d)?a36_0x3a158c[_0xe2a94f(0x1b0)](_0x13254e[_0xe2a94f(0x190)]):_0x13254e[_0xe2a94f(0x157)]===_0xe2a94f(0x1af)?a36_0x3a158c['red'](_0x13254e[_0xe2a94f(0x190)]):a36_0x3a158c[_0xe2a94f(0x12a)](_0x13254e['statusIcon']),_0xd87bba=_0x13254e[_0xe2a94f(0x18b)]['padEnd'](_0x26a5ff),_0x458498=_0x13254e['nextRun'][_0xe2a94f(0x172)](_0x4db5e9),_0x591124=_0x13254e[_0xe2a94f(0x143)]?a36_0x3a158c[_0xe2a94f(0x139)](_0x13254e[_0xe2a94f(0x143)][_0xe2a94f(0x172)](_0x49d413)):'\x20'['repeat'](_0x49d413),_0x494c04=hyperlink(_0x13254e[_0xe2a94f(0x197)],_0x13254e[_0xe2a94f(0x130)]);return _0xe2a94f(0x175)+_0xd3ccbe+'\x20'+_0xd87bba+_0xe2a94f(0x148)+_0x458498+'\x20\x20'+_0x591124+'\x20\x20'+_0x494c04;});await writeOutput(_0x32f419[_0x1c5de7(0x194)]('\x0a'),_0x2b5029[_0x1c5de7(0x129)],_0x1c5de7(0x171));}}return 0x0;}}export class ScheduleShowCommand extends BaseCommand{[a36_0x396664(0x197)]='schedule:show';[a36_0x396664(0x1a5)]=a36_0x396664(0x1a3);[a36_0x396664(0x14a)](_0x28e0c2){const _0x68f707=_0x28e0c2['args'][0x0];if(!_0x68f707)return'Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20show\x20<name>';return undefined;}async[a36_0x396664(0x1b3)](_0x56addb){const _0x26274f=a36_0x396664,{options:_0x55d5ba,args:_0x1199ae,tdx:_0x343c2a}=_0x56addb,_0x5ad84b=_0x1199ae[0x0],_0x554c3b=await withSpinner(_0x26274f(0x167),()=>_0x343c2a[_0x26274f(0x164)]['show'](_0x5ad84b),{'verbose':_0x55d5ba[_0x26274f(0x144)]}),_0x183c83=_0x554c3b[_0x26274f(0x165)],_0x1edc32={'name':_0x183c83['name'],'cron':_0x183c83['cron'],'database':_0x183c83[_0x26274f(0x15f)],'type':_0x183c83[_0x26274f(0x1b5)],'timezone':_0x183c83['timezone'],'user_name':_0x183c83['user_name'],'created_at':_0x183c83[_0x26274f(0x13c)],'engine_version':_0x183c83[_0x26274f(0x191)],'executing_user_id':_0x183c83['executing_user_id'],'query':_0x183c83['query'],'delay':_0x183c83[_0x26274f(0x19e)],'priority':_0x183c83[_0x26274f(0x17d)],'retry_limit':_0x183c83[_0x26274f(0x15c)],..._0x183c83[_0x26274f(0x166)]&&{'result':_0x183c83[_0x26274f(0x166)]}};return await handleSingleObjectOutput(_0x1edc32,_0x55d5ba),0x0;}}export class ScheduleCreateCommand extends BaseCommand{[a36_0x396664(0x197)]=a36_0x396664(0x17e);[a36_0x396664(0x1a5)]=a36_0x396664(0x13e);[a36_0x396664(0x14a)](_0x1cad8d){const _0x419fb4=a36_0x396664,_0x5286cb=_0x1cad8d[_0x419fb4(0x181)][0x0];if(!_0x5286cb)return'Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]';const _0x35506e=_0x1cad8d[_0x419fb4(0x141)];if(!_0x35506e[_0x419fb4(0x15f)])return'Database\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]';return undefined;}async[a36_0x396664(0x1b3)](_0x489e9d){const _0x666a4f=a36_0x396664,{options:_0x96dc73,args:_0x4f12ec,tdx:_0x201cdf}=_0x489e9d,_0x2144b8=_0x4f12ec[0x0],_0x419e2e=_0x96dc73,_0x569471=_0x419e2e[_0x666a4f(0x15f)],_0x5dd51b=_0x419e2e[_0x666a4f(0x133)],_0x29c145=_0x419e2e[_0x666a4f(0x1b5)]||_0x666a4f(0x188);let _0x325c43;try{_0x325c43=readFileSync(_0x5dd51b,_0x666a4f(0x158))['trim']();}catch(_0x2d80b7){throw new SDKError(ErrorCode[_0x666a4f(0x161)],_0x666a4f(0x137)+_0x5dd51b,_0x2d80b7 instanceof Error?_0x2d80b7:undefined);}if(!_0x325c43)throw new SDKError(ErrorCode['INVALID_ARGUMENT'],'Query\x20file\x20is\x20empty');const _0x3be265={'database':_0x569471,'query':_0x325c43,'type':_0x29c145};if(_0x419e2e['cron'])_0x3be265[_0x666a4f(0x143)]=_0x419e2e[_0x666a4f(0x143)];if(_0x419e2e['timezone'])_0x3be265[_0x666a4f(0x13b)]=_0x419e2e[_0x666a4f(0x13b)];if(_0x419e2e['delay']!==undefined)_0x3be265[_0x666a4f(0x19e)]=Number(_0x419e2e[_0x666a4f(0x19e)]);if(_0x419e2e['priority']!==undefined)_0x3be265['priority']=Number(_0x419e2e[_0x666a4f(0x17d)]);if(_0x419e2e[_0x666a4f(0x1ab)]!==undefined)_0x3be265[_0x666a4f(0x15c)]=Number(_0x419e2e[_0x666a4f(0x1ab)]);if(_0x419e2e[_0x666a4f(0x140)])_0x3be265[_0x666a4f(0x191)]=_0x419e2e[_0x666a4f(0x140)];if(_0x419e2e['result'])_0x3be265[_0x666a4f(0x166)]=_0x419e2e['result'];if(_0x96dc73['verbose']){console[_0x666a4f(0x1af)](_0x666a4f(0x19b)+_0x2144b8),console[_0x666a4f(0x1af)](_0x666a4f(0x159)+_0x569471),console[_0x666a4f(0x1af)](_0x666a4f(0x193)+_0x29c145);if(_0x3be265[_0x666a4f(0x143)])console[_0x666a4f(0x1af)](_0x666a4f(0x13f)+_0x3be265[_0x666a4f(0x143)]);if(_0x3be265['timezone'])console['error']('\x20\x20Timezone:\x20'+_0x3be265[_0x666a4f(0x13b)]);}const _0x3e9a87=await withSpinner(_0x666a4f(0x14b),()=>_0x201cdf[_0x666a4f(0x164)]['create'](_0x2144b8,_0x3be265),{'verbose':_0x96dc73[_0x666a4f(0x144)]});return console[_0x666a4f(0x1af)](_0x666a4f(0x155)+_0x3e9a87[_0x666a4f(0x165)]['name']),await handleSingleObjectOutput(_0x3e9a87[_0x666a4f(0x165)],_0x96dc73),0x0;}}export class ScheduleUpdateCommand extends BaseCommand{[a36_0x396664(0x197)]=a36_0x396664(0x19f);[a36_0x396664(0x1a5)]=a36_0x396664(0x13d);[a36_0x396664(0x14a)](_0x49fd83){const _0x1dc30c=a36_0x396664,_0x20ecf5=_0x49fd83[_0x1dc30c(0x181)][0x0];if(!_0x20ecf5)return'Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20update\x20<name>\x20[options]';return undefined;}async[a36_0x396664(0x1b3)](_0x43eea4){const _0x300a3c=a36_0x396664,{options:_0x11f868,args:_0x49b52c,tdx:_0x3f24f3}=_0x43eea4,_0xb76147=_0x49b52c[0x0],_0x2c202d=_0x11f868,_0x3785f9={};if(_0x2c202d[_0x300a3c(0x15f)])_0x3785f9[_0x300a3c(0x15f)]=_0x2c202d[_0x300a3c(0x15f)];if(_0x2c202d[_0x300a3c(0x1b5)])_0x3785f9[_0x300a3c(0x1b5)]=_0x2c202d['type'];if(_0x2c202d[_0x300a3c(0x143)])_0x3785f9['cron']=_0x2c202d[_0x300a3c(0x143)];if(_0x2c202d['timezone'])_0x3785f9[_0x300a3c(0x13b)]=_0x2c202d[_0x300a3c(0x13b)];if(_0x2c202d[_0x300a3c(0x19e)]!==undefined)_0x3785f9[_0x300a3c(0x19e)]=Number(_0x2c202d[_0x300a3c(0x19e)]);if(_0x2c202d[_0x300a3c(0x17d)]!==undefined)_0x3785f9[_0x300a3c(0x17d)]=Number(_0x2c202d[_0x300a3c(0x17d)]);if(_0x2c202d[_0x300a3c(0x1ab)]!==undefined)_0x3785f9[_0x300a3c(0x15c)]=Number(_0x2c202d['retryLimit']);if(_0x2c202d[_0x300a3c(0x140)])_0x3785f9[_0x300a3c(0x191)]=_0x2c202d[_0x300a3c(0x140)];if(_0x2c202d[_0x300a3c(0x166)])_0x3785f9[_0x300a3c(0x166)]=_0x2c202d['result'];if(_0x2c202d['file'])try{_0x3785f9[_0x300a3c(0x16e)]=readFileSync(_0x2c202d['file'],_0x300a3c(0x158))[_0x300a3c(0x1a1)]();}catch(_0x49eb63){throw new SDKError(ErrorCode[_0x300a3c(0x161)],'Failed\x20to\x20read\x20file:\x20'+_0x2c202d[_0x300a3c(0x133)],_0x49eb63 instanceof Error?_0x49eb63:undefined);}if(Object[_0x300a3c(0x151)](_0x3785f9)[_0x300a3c(0x1b7)]===0x0)throw new SDKError(ErrorCode[_0x300a3c(0x161)],_0x300a3c(0x18d));if(_0x11f868[_0x300a3c(0x144)]){console[_0x300a3c(0x1af)](_0x300a3c(0x16c)+_0xb76147);for(const [_0x4ea568,_0x1dabfa]of Object[_0x300a3c(0x136)](_0x3785f9)){_0x4ea568===_0x300a3c(0x16e)?console[_0x300a3c(0x1af)]('\x20\x20'+_0x4ea568+':\x20'+_0x1dabfa[_0x300a3c(0x18f)](0x0,0x32)+_0x300a3c(0x17b)):console['error']('\x20\x20'+_0x4ea568+':\x20'+_0x1dabfa);}}const _0x35caab=await withSpinner(_0x300a3c(0x15e),()=>_0x3f24f3[_0x300a3c(0x164)]['update'](_0xb76147,_0x3785f9),{'verbose':_0x11f868['verbose']});return console[_0x300a3c(0x1af)](_0x300a3c(0x138)+_0x35caab[_0x300a3c(0x165)][_0x300a3c(0x197)]),await handleSingleObjectOutput(_0x35caab[_0x300a3c(0x165)],_0x11f868),0x0;}}export class ScheduleDeleteCommand extends BaseCommand{['name']=a36_0x396664(0x16d);['description']=a36_0x396664(0x178);[a36_0x396664(0x14a)](_0x1bf00d){const _0x1964e9=a36_0x396664,_0x3888a8=_0x1bf00d['args'][0x0];if(!_0x3888a8)return _0x1964e9(0x184);return undefined;}async[a36_0x396664(0x1b3)](_0x44740a){const _0x380aff=a36_0x396664,{options:_0x52a8ef,args:_0x3e93d2,tdx:_0x26762c}=_0x44740a,_0x2fb2bc=_0x3e93d2[0x0];if(!_0x52a8ef[_0x380aff(0x12f)]){const _0x59cd96=await confirm('Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20schedule\x20\x22'+_0x2fb2bc+'\x22?');if(!_0x59cd96)return console[_0x380aff(0x1af)](_0x380aff(0x17f)),0x0;}const _0x301f4b=await withSpinner(_0x380aff(0x168),()=>_0x26762c[_0x380aff(0x164)]['delete'](_0x2fb2bc),{'verbose':_0x52a8ef[_0x380aff(0x144)]});return console[_0x380aff(0x1af)](_0x380aff(0x163)+_0x301f4b[_0x380aff(0x165)]['name']),0x0;}}export class ScheduleRunCommand extends BaseCommand{['name']=a36_0x396664(0x15a);['description']=a36_0x396664(0x1a7);[a36_0x396664(0x14a)](_0xcde3bc){const _0x304095=a36_0x396664,_0x24b036=_0xcde3bc['args'][0x0];if(!_0x24b036)return _0x304095(0x15b);return undefined;}async[a36_0x396664(0x1b3)](_0x5a979e){const _0x206b0e=a36_0x396664,{options:_0x1d99bc,args:_0x30be78,tdx:_0x3d53b2}=_0x5a979e,_0x357036=_0x30be78[0x0],_0x202272=_0x1d99bc,_0x31eed8=_0x202272[_0x206b0e(0x17c)],_0x57434e=_0x202272[_0x206b0e(0x1a6)]!==undefined?Number(_0x202272[_0x206b0e(0x1a6)]):undefined;if(_0x1d99bc['verbose']){console['error']('Running\x20schedule:\x20'+_0x357036);if(_0x31eed8)console[_0x206b0e(0x1af)](_0x206b0e(0x14f)+_0x31eed8);if(_0x57434e)console['error'](_0x206b0e(0x19a)+_0x57434e);}const _0x5210b1=await withSpinner(_0x206b0e(0x1b6),()=>_0x3d53b2[_0x206b0e(0x164)]['run'](_0x357036,{'time':_0x31eed8,'num':_0x57434e}),{'verbose':_0x1d99bc[_0x206b0e(0x144)]}),_0x237d09=_0x5210b1['data'][_0x206b0e(0x182)];console[_0x206b0e(0x1af)](_0x206b0e(0x173)+_0x237d09['length']+'\x20job'+(_0x237d09[_0x206b0e(0x1b7)]!==0x1?'s':'')+_0x206b0e(0x183));for(const _0x474402 of _0x237d09){console[_0x206b0e(0x1af)]('\x20\x20Job\x20ID:\x20'+_0x474402['job_id']);}return await handleSDKOutput(_0x237d09,_0x1d99bc),0x0;}}export class ScheduleHistoryCommand extends BaseCommand{[a36_0x396664(0x197)]=a36_0x396664(0x185);['description']=a36_0x396664(0x179);[a36_0x396664(0x14a)](_0x371794){const _0x547d04=_0x371794['args'][0x0];if(!_0x547d04)return'Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20history\x20<name>\x20[--from\x20<n>]\x20[--to\x20<n>]';return undefined;}async[a36_0x396664(0x1b3)](_0x3313ac){const _0x2c0a33=a36_0x396664,{options:_0x3319ef,args:_0x5bb23e,tdx:_0x5930b4}=_0x3313ac,_0x1d0064=_0x5bb23e[0x0],_0x25fb64=_0x3319ef,_0x2d471b=_0x25fb64[_0x2c0a33(0x180)]!==undefined?Number(_0x25fb64['from']):undefined,_0x4d2752=_0x25fb64['to']!==undefined?Number(_0x25fb64['to']):undefined,_0x4650fb=await withSpinner(_0x2c0a33(0x1ae),()=>_0x5930b4[_0x2c0a33(0x164)][_0x2c0a33(0x13a)](_0x1d0064,{'from':_0x2d471b,'to':_0x4d2752}),{'verbose':_0x3319ef[_0x2c0a33(0x144)]}),_0x28fb95=_0x4650fb[_0x2c0a33(0x165)];console[_0x2c0a33(0x1af)](_0x2c0a33(0x170)+_0x28fb95[_0x2c0a33(0x1b4)]+_0x2c0a33(0x14d)+(_0x28fb95[_0x2c0a33(0x1b4)]!==0x1?'s':'')+'\x20(showing\x20'+_0x28fb95[_0x2c0a33(0x180)]+'-'+_0x28fb95['to']+')');const _0x35121f=_0x28fb95['history']['map'](_0x2e3371=>({'job_id':_0x2e3371[_0x2c0a33(0x162)],'type':_0x2e3371[_0x2c0a33(0x1b5)],'status':_0x2e3371[_0x2c0a33(0x157)],'scheduled_at':_0x2e3371['scheduled_at'],'created_at':_0x2e3371[_0x2c0a33(0x13c)],'start_at':_0x2e3371['start_at'],'end_at':_0x2e3371[_0x2c0a33(0x150)]}));return await handleSDKOutput(_0x35121f,_0x3319ef),0x0;}}
@@ -1 +1 @@
1
- const a37_0x1e4106=a37_0x2edb;(function(_0x598719,_0x1717be){const _0xff9d05=a37_0x2edb,_0x2907cb=_0x598719();while(!![]){try{const _0x3b6ee6=parseInt(_0xff9d05(0x13f))/0x1+parseInt(_0xff9d05(0xe0))/0x2*(-parseInt(_0xff9d05(0xf0))/0x3)+-parseInt(_0xff9d05(0xfa))/0x4*(-parseInt(_0xff9d05(0x110))/0x5)+-parseInt(_0xff9d05(0xcd))/0x6+parseInt(_0xff9d05(0xfb))/0x7+-parseInt(_0xff9d05(0xb8))/0x8*(-parseInt(_0xff9d05(0x11f))/0x9)+-parseInt(_0xff9d05(0x108))/0xa*(-parseInt(_0xff9d05(0x11b))/0xb);if(_0x3b6ee6===_0x1717be)break;else _0x2907cb['push'](_0x2907cb['shift']());}catch(_0xcab3a4){_0x2907cb['push'](_0x2907cb['shift']());}}}(a37_0x4473,0x2a670));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,handleQueryOutput,handleSingleObjectOutput}from'../core/command-output.js';function a37_0x2edb(_0x39ba8a,_0x1f22a2){_0x39ba8a=_0x39ba8a-0xa8;const _0x44736a=a37_0x4473();let _0x2edbbc=_0x44736a[_0x39ba8a];return _0x2edbbc;}import{withSpinner,withProgressSpinner,formatElapsed}from'../utils/spinner.js';import{parseSegmentRef}from'../sdk/segment/segment-ref-parser.js';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import{executeSchemaQuery}from'../sdk/segment/fields-display.js';import{isYamlFilePath,resolveYamlFilePath}from'../sdk/segment/segment-path-parser.js';import{getConsoleNextUrl}from'../sdk/client/endpoints.js';import{openBrowser}from'../utils/process.js';import a37_0x592c44 from'chalk';async function resolveSegmentTarget(_0x2fb4c1,_0x80571f,_0x4e7b30){const _0x4a89f7=a37_0x2edb;if(isYamlFilePath(_0x2fb4c1))try{const _0x3d22cd=await resolveYamlFilePath(_0x2fb4c1);return _0x4e7b30&&(console[_0x4a89f7(0x12b)]('Resolved\x20YAML\x20file:\x20'+_0x2fb4c1),console[_0x4a89f7(0x12b)](_0x4a89f7(0xe4)+_0x3d22cd['parentSegment']),console[_0x4a89f7(0x12b)](_0x4a89f7(0x125)+_0x3d22cd[_0x4a89f7(0x122)]),console[_0x4a89f7(0x12b)]('\x20\x20Folder\x20path:\x20'+(_0x3d22cd['folderPath']||'(root)')),console[_0x4a89f7(0x12b)]('\x20\x20Full\x20path:\x20'+_0x3d22cd[_0x4a89f7(0x10b)])),_0x3d22cd['fullPath'];}catch(_0x153643){throw new SDKError(ErrorCode[_0x4a89f7(0x115)],_0x4a89f7(0xe5)+_0x153643[_0x4a89f7(0x134)]);}if(!_0x80571f)throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x4a89f7(0xed));return _0x80571f+'/'+_0x2fb4c1;}export class SegmentDescribeCommand extends BaseCommand{['name']=a37_0x1e4106(0xef);[a37_0x1e4106(0xd6)]=a37_0x1e4106(0xda);async[a37_0x1e4106(0xb2)](_0xf679c9){const _0x110414=a37_0x1e4106,{options:_0x4ad30e,args:_0x1b7725,tdx:_0x4a31d1}=_0xf679c9,_0x53a68c=_0x1b7725[0x0],_0xb51322=!_0x53a68c&&!!_0x4ad30e[_0x110414(0xae)],_0x59d050=_0x53a68c||_0x4ad30e[_0x110414(0xae)];if(!_0x59d050)return console['error'](_0x110414(0xba)),console[_0x110414(0x12b)]('Usage:\x20tdx\x20segment\x20describe\x20<path>'),console[_0x110414(0x12b)](_0x110414(0xc5)),console[_0x110414(0x12b)]('\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience\x22'),console['error']('\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience/Marketing/High\x20Value\x22'),console[_0x110414(0x12b)](_0x110414(0x116)),console[_0x110414(0x12b)]('\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>'),0x1;try{const _0x18bc30=_0x4ad30e[_0x110414(0x106)];let _0x1421a6=_0x59d050;!_0xb51322&&_0x18bc30&&!_0x59d050[_0x110414(0xd9)]('/')&&(_0x1421a6=_0x18bc30+'/'+_0x59d050,_0x4ad30e[_0x110414(0xe9)]&&console[_0x110414(0x12b)](_0x110414(0x13e)+_0x1421a6));const _0x5e5a71=await withSpinner(_0x110414(0x120)+_0x1421a6+_0x110414(0x133),()=>_0x4a31d1['segment'][_0x110414(0xdb)](_0x1421a6),{'verbose':_0x4ad30e[_0x110414(0xe9)]}),_0xeec37e=_0x5e5a71[_0x110414(0xb1)];_0x4ad30e['verbose']&&(console['error'](_0x110414(0x13c)+_0xeec37e[_0x110414(0x138)]),console[_0x110414(0x12b)](_0x110414(0x11a)+_0xeec37e[_0x110414(0xac)]),_0xeec37e[_0x110414(0xfc)]&&console[_0x110414(0x12b)]('Folder\x20ID:\x20'+_0xeec37e[_0x110414(0xfc)]),_0xeec37e[_0x110414(0xff)]&&console[_0x110414(0x12b)](_0x110414(0x12a)+_0xeec37e[_0x110414(0xff)]));if(_0xeec37e[_0x110414(0x138)]===_0x110414(0x130)){const _0x3113e2=await withSpinner('Fetching\x20parent\x20segment\x20details...',()=>_0x4a31d1['segment']['getParent'](_0xeec37e[_0x110414(0xac)]),{'verbose':_0x4ad30e[_0x110414(0xe9)]});await handleSingleObjectOutput(_0x3113e2['data'],_0x4ad30e);}else{if(_0xeec37e[_0x110414(0x138)]===_0x110414(0x11d)){if(!_0xeec37e['folderId'])throw new SDKError(ErrorCode[_0x110414(0xcf)],'Folder\x20ID\x20missing\x20from\x20resolved\x20path');const _0x165f99=await withSpinner('Fetching\x20folder\x20details...',()=>_0x4a31d1['segment']['getFolder'](_0xeec37e[_0x110414(0xfc)]),{'verbose':_0x4ad30e[_0x110414(0xe9)]});await handleSingleObjectOutput(_0x165f99['data'],_0x4ad30e);}else{if(_0xeec37e[_0x110414(0x138)]===_0x110414(0xf1)){if(!_0xeec37e[_0x110414(0xff)])throw new SDKError(ErrorCode[_0x110414(0xbb)],_0x110414(0xe7));const _0x41a5b2=await withSpinner(_0x110414(0xe3),()=>_0x4a31d1[_0x110414(0xf1)][_0x110414(0xaf)](_0xeec37e[_0x110414(0xac)],_0xeec37e[_0x110414(0xff)]),{'verbose':_0x4ad30e[_0x110414(0xe9)]});await handleSingleObjectOutput(_0x41a5b2['data'],_0x4ad30e);}}}return 0x0;}catch(_0x4a1e3c){if(_0x4a1e3c instanceof SDKError)return console[_0x110414(0x12b)]('Error:\x20'+_0x4a1e3c[_0x110414(0x134)]),_0x4a1e3c[_0x110414(0xee)]&&console['error'](_0x110414(0xb9)+_0x4a1e3c[_0x110414(0xee)]),0x1;throw _0x4a1e3c;}}}export class SegmentShowCommand extends BaseCommand{[a37_0x1e4106(0x117)]='segment:show';['description']='Execute\x20child\x20segment\x20SQL\x20query\x20and\x20show\x20results';async[a37_0x1e4106(0xb2)](_0x12a763){const _0x1c6b70=a37_0x1e4106,{options:_0x5c0ef3,args:_0x51fbe8,tdx:_0x3bae44}=_0x12a763,_0x174cc9=_0x51fbe8[0x0];if(!_0x174cc9)return console[_0x1c6b70(0x12b)](_0x1c6b70(0xb7)),console[_0x1c6b70(0x12b)](_0x1c6b70(0xc9)),console[_0x1c6b70(0x12b)]('\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20show\x20<path/to/segment.yml>'),console[_0x1c6b70(0x12b)](_0x1c6b70(0xc5)),console[_0x1c6b70(0x12b)](_0x1c6b70(0x11e)),console['error'](_0x1c6b70(0xbe)),0x1;try{const _0x959127=_0x5c0ef3[_0x1c6b70(0xae)],_0x5b25db=await resolveSegmentTarget(_0x174cc9,_0x959127,_0x5c0ef3[_0x1c6b70(0xe9)]);_0x5c0ef3[_0x1c6b70(0xe9)]&&console['error'](_0x1c6b70(0x113)+_0x5b25db);const _0x23f080=await withSpinner(_0x1c6b70(0xea)+_0x174cc9+_0x1c6b70(0x133),()=>_0x3bae44[_0x1c6b70(0xf1)][_0x1c6b70(0xdb)](_0x5b25db),{'verbose':_0x5c0ef3['verbose']}),_0x460b75=_0x23f080[_0x1c6b70(0xb1)];_0x5c0ef3[_0x1c6b70(0xe9)]&&(console[_0x1c6b70(0x12b)](_0x1c6b70(0x13c)+_0x460b75['type']),console['error'](_0x1c6b70(0x11a)+_0x460b75[_0x1c6b70(0xac)]));if(_0x460b75[_0x1c6b70(0x138)]===_0x1c6b70(0x11d))return console[_0x1c6b70(0x12b)]('Error:\x20Cannot\x20execute\x20SQL\x20query\x20on\x20a\x20folder.'),console['error'](_0x1c6b70(0xbd)),0x1;if(_0x460b75[_0x1c6b70(0x138)]===_0x1c6b70(0x130))return console[_0x1c6b70(0x12b)]('Error:\x20Cannot\x20execute\x20query\x20for\x20parent\x20segment\x20with\x20this\x20command.'),console[_0x1c6b70(0x12b)](_0x1c6b70(0xd8)),0x1;if(!_0x460b75[_0x1c6b70(0xff)])throw new SDKError(ErrorCode[_0x1c6b70(0xbb)],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x5c1786=await withSpinner(_0x1c6b70(0xbf),()=>_0x3bae44[_0x1c6b70(0xf1)][_0x1c6b70(0x10f)](_0x460b75[_0x1c6b70(0xac)],_0x460b75[_0x1c6b70(0xff)]),{'verbose':_0x5c0ef3['verbose']});let _0x3a0072=_0x5c1786[_0x1c6b70(0xb1)];const _0x280ea9=resolveLimit(_0x5c0ef3['limit'],DEFAULT_DISPLAY_LIMIT),_0x51145a=/\bLIMIT\s+\d+/i[_0x1c6b70(0x10e)](_0x3a0072);!_0x51145a&&(_0x3a0072=_0x3a0072[_0x1c6b70(0xf8)]()['replace'](/;+$/,''),_0x3a0072=_0x1c6b70(0x11c)+_0x3a0072+_0x1c6b70(0xf7)+_0x280ea9);_0x5c0ef3[_0x1c6b70(0xe9)]&&console[_0x1c6b70(0x12b)](_0x1c6b70(0xb4)+_0x3a0072);const _0x31eb88=await withProgressSpinner('Executing\x20segment\x20query...',async _0x225b71=>{const _0x1c439e=_0x1c6b70,_0xa0040f=await _0x3bae44[_0x1c439e(0x107)]['execute'](_0x3a0072,{'catalog':'td','schema':'information_schema','onJobId':_0x55a4d0=>{_0x225b71['setJobId'](_0x55a4d0);}});return _0xa0040f;},{'verbose':_0x5c0ef3[_0x1c6b70(0xe9)]}),_0x14caec=_0x31eb88[_0x1c6b70(0xb1)],_0x62b59c=_0x14caec['jobId']?_0x1c6b70(0xce)+_0x14caec[_0x1c6b70(0x112)]+']':'';return console[_0x1c6b70(0x12b)](_0x1c6b70(0xa8)+_0x14caec['stats'][_0x1c6b70(0xd1)][_0x1c6b70(0x10d)]()+'\x20rows\x20'+(_0x1c6b70(0xab)+formatElapsed(_0x14caec[_0x1c6b70(0x13b)]['elapsedTimeMillis'])+_0x62b59c)),await handleQueryOutput(_0x14caec,_0x5c0ef3),0x0;}catch(_0x4cab19){if(_0x4cab19 instanceof SDKError)return console['error'](_0x1c6b70(0xc8)+_0x4cab19[_0x1c6b70(0xf4)]+']'),console[_0x1c6b70(0x12b)]('\x0a'+_0x4cab19['message']),0x1;throw _0x4cab19;}}}export class SegmentFolderListCommand extends BaseCommand{[a37_0x1e4106(0x117)]=a37_0x1e4106(0x102);[a37_0x1e4106(0xd6)]='List\x20segment\x20folders\x20under\x20a\x20parent\x20segment';async['execute'](_0x573f5e){const _0xcfbf0d=a37_0x1e4106,{options:_0x2a8516,args:_0x559e8c,tdx:_0x14550d}=_0x573f5e;if(_0x559e8c[_0xcfbf0d(0xe6)]===0x0)return console[_0xcfbf0d(0x12b)](_0xcfbf0d(0x137)),console['error'](_0xcfbf0d(0xe2)),0x1;const _0x2713bc=_0x559e8c[0x0];try{_0x2a8516[_0xcfbf0d(0xe9)]&&(console[_0xcfbf0d(0x12b)]('Site:\x20'+_0x2a8516[_0xcfbf0d(0xe8)]),console[_0xcfbf0d(0x12b)](_0xcfbf0d(0xb6)+_0x2713bc));const _0x4e6930=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x2713bc+'\x27...',()=>_0x14550d[_0xcfbf0d(0xf1)][_0xcfbf0d(0xc4)](_0x2713bc),{'verbose':_0x2a8516[_0xcfbf0d(0xe9)]}),_0xc846f1=_0x4e6930['data'];_0x2a8516[_0xcfbf0d(0xe9)]&&console[_0xcfbf0d(0x12b)](_0xcfbf0d(0xdc)+_0xc846f1);const _0x3e1c64=await withSpinner(_0xcfbf0d(0x12c)+_0x2713bc+_0xcfbf0d(0x133),()=>_0x14550d[_0xcfbf0d(0xf1)][_0xcfbf0d(0xeb)](_0xc846f1),{'verbose':_0x2a8516[_0xcfbf0d(0xe9)]}),_0xc5e2c3=_0x3e1c64[_0xcfbf0d(0xb1)];return console['error'](_0xcfbf0d(0xb3)+_0xc5e2c3[_0xcfbf0d(0xe6)]+'\x20folder'+(_0xc5e2c3[_0xcfbf0d(0xe6)]!==0x1?'s':'')),await handleSDKOutput(_0xc5e2c3,_0x2a8516),0x0;}catch(_0x20e397){if(_0x20e397 instanceof SDKError)return console[_0xcfbf0d(0x12b)](_0xcfbf0d(0xc2)+_0x20e397[_0xcfbf0d(0x134)]),_0x20e397[_0xcfbf0d(0xee)]&&console[_0xcfbf0d(0x12b)](_0xcfbf0d(0xb9)+_0x20e397['cause']),0x1;throw _0x20e397;}}}export class SegmentFolderShowCommand extends BaseCommand{[a37_0x1e4106(0x117)]='segment:folder:show';['description']=a37_0x1e4106(0x118);async['execute'](_0x294b1d){const _0x5abe5a=a37_0x1e4106,{options:_0x2fa7cd,args:_0x5e0dd1,tdx:_0x46915d}=_0x294b1d;if(_0x5e0dd1[_0x5abe5a(0xe6)]===0x0)return console[_0x5abe5a(0x12b)](_0x5abe5a(0x114)),console[_0x5abe5a(0x12b)](_0x5abe5a(0xd5)),0x1;try{const {parentId:_0x554a28,childId:_0x339ed5}=parseSegmentRef(_0x5e0dd1[0x0]);_0x2fa7cd[_0x5abe5a(0xe9)]&&(console['error'](_0x5abe5a(0x13d)+_0x2fa7cd[_0x5abe5a(0xe8)]),console[_0x5abe5a(0x12b)](_0x5abe5a(0xb6)+_0x554a28),_0x339ed5&&console[_0x5abe5a(0x12b)](_0x5abe5a(0xd7)+_0x339ed5));if(!_0x339ed5)return console[_0x5abe5a(0x12b)]('Error:\x20Folder\x20name\x20is\x20required\x20(use\x20parent_name/folder_name\x20format)'),0x1;const _0x2ba5ab=await withSpinner(_0x5abe5a(0x109)+_0x554a28+_0x5abe5a(0x133),()=>_0x46915d[_0x5abe5a(0xf1)]['resolveParentId'](_0x554a28),{'verbose':_0x2fa7cd[_0x5abe5a(0xe9)]}),_0xc7c696=_0x2ba5ab[_0x5abe5a(0xb1)];_0x2fa7cd[_0x5abe5a(0xe9)]&&console[_0x5abe5a(0x12b)](_0x5abe5a(0xdc)+_0xc7c696);const _0x3f7cb4=await withSpinner(_0x5abe5a(0x12e)+_0x339ed5+_0x5abe5a(0x133),()=>_0x46915d['segment'][_0x5abe5a(0xf5)](_0xc7c696,_0x339ed5),{'verbose':_0x2fa7cd['verbose']}),_0x441509=_0x3f7cb4[_0x5abe5a(0xb1)];_0x2fa7cd[_0x5abe5a(0xe9)]&&console[_0x5abe5a(0x12b)]('Resolved\x20folder\x20ID:\x20'+_0x441509);const _0x1b8ec4=await withSpinner(_0x5abe5a(0x105)+_0x339ed5+_0x5abe5a(0x133),()=>_0x46915d['segment'][_0x5abe5a(0xdd)](_0x441509),{'verbose':_0x2fa7cd[_0x5abe5a(0xe9)]});return await handleSDKOutput([_0x1b8ec4['data']],_0x2fa7cd),0x0;}catch(_0x2fdb52){if(_0x2fdb52 instanceof SDKError)return console[_0x5abe5a(0x12b)](_0x5abe5a(0xc2)+_0x2fdb52[_0x5abe5a(0x134)]),_0x2fdb52[_0x5abe5a(0xee)]&&console['error'](_0x5abe5a(0xb9)+_0x2fdb52[_0x5abe5a(0xee)]),0x1;throw _0x2fdb52;}}}export class SegmentSQLCommand extends BaseCommand{[a37_0x1e4106(0x117)]='segment:sql';[a37_0x1e4106(0xd6)]='Get\x20SQL\x20query\x20for\x20child\x20segment';async[a37_0x1e4106(0xb2)](_0x3b04eb){const _0x132991=a37_0x1e4106,{options:_0x5ecd96,args:_0x5a5fd1}=_0x3b04eb,_0x1372a0=_0x5ecd96,_0xa88ea3=_0x1372a0[_0x132991(0xc1)],_0x31acd4=_0x5a5fd1[0x0];if(!_0x31acd4&&!_0xa88ea3)return console[_0x132991(0x12b)](a37_0x592c44[_0x132991(0xf2)](_0x132991(0x10c))),console['error'](_0x132991(0xd3)),console[_0x132991(0x12b)](_0x132991(0x131)),console[_0x132991(0x12b)]('\x20\x20Local\x20YAML\x20file:\x20\x20\x20\x20\x20\x20tdx\x20sg\x20sql\x20--path\x20<file-path>'),console['error']('Examples:'),console[_0x132991(0x12b)]('\x20\x20tdx\x20sg\x20sql\x20\x22Premium\x20Users\x22'),console['error'](_0x132991(0x139)),0x1;if(_0x31acd4&&_0xa88ea3)return console[_0x132991(0x12b)](a37_0x592c44[_0x132991(0xf2)](_0x132991(0xcb))),0x1;try{let _0x3cdd98;if(_0xa88ea3)_0x3cdd98=await this[_0x132991(0xa9)](_0xa88ea3,_0x3b04eb);else{if(isYamlFilePath(_0x31acd4))return console[_0x132991(0x12b)](a37_0x592c44[_0x132991(0xf2)]('Error:\x20YAML\x20file\x20paths\x20must\x20be\x20specified\x20with\x20--path\x20option')),console[_0x132991(0x12b)]('\x20\x20tdx\x20sg\x20sql\x20--path\x20'+_0x31acd4),0x1;else _0x3cdd98=await this[_0x132991(0x121)](_0x31acd4,_0x3b04eb);}return _0x5ecd96[_0x132991(0xd0)]==='json'||_0x5ecd96[_0x132991(0xd0)]===_0x132991(0xc0)?await handleSDKOutput([{'sql':_0x3cdd98}],_0x5ecd96):console[_0x132991(0xc3)](_0x3cdd98),0x0;}catch(_0x3ab241){if(_0x3ab241 instanceof SDKError)return console[_0x132991(0x12b)](_0x132991(0xc2)+_0x3ab241[_0x132991(0x134)]),_0x3ab241['cause']&&console['error'](_0x132991(0xb9)+_0x3ab241[_0x132991(0xee)]),0x1;throw _0x3ab241;}}async[a37_0x1e4106(0xa9)](_0x264fe8,_0x4ca051){const _0x4c5e51=a37_0x1e4106,{options:_0x177cc7,tdx:_0x2af967}=_0x4ca051;let _0x657118;try{_0x657118=await resolveYamlFilePath(_0x264fe8);}catch(_0x4e78aa){throw new SDKError(ErrorCode[_0x4c5e51(0x115)],_0x4c5e51(0xe5)+_0x4e78aa[_0x4c5e51(0x134)]);}_0x177cc7['verbose']&&console[_0x4c5e51(0x12b)](_0x4c5e51(0x129)+_0x657118[_0x4c5e51(0xae)]+'/'+_0x657118['segmentName']);const _0xe46f22=await withSpinner('Fetching\x20SQL\x20from\x20rule...',()=>_0x2af967[_0x4c5e51(0xf1)][_0x4c5e51(0x12d)](_0x657118['content'],_0x657118[_0x4c5e51(0xae)],_0x657118[_0x4c5e51(0x122)]),{'verbose':_0x177cc7[_0x4c5e51(0xe9)]});return _0xe46f22[_0x4c5e51(0xb1)];}async[a37_0x1e4106(0x121)](_0x237ef9,_0x2fe93a){const _0x36ae80=a37_0x1e4106,{options:_0x1bcf04,tdx:_0x3e7846}=_0x2fe93a,_0x2fe2ed=_0x1bcf04[_0x36ae80(0xae)],_0x50e9c0=await resolveSegmentTarget(_0x237ef9,_0x2fe2ed,_0x1bcf04[_0x36ae80(0xe9)]);_0x1bcf04[_0x36ae80(0xe9)]&&console[_0x36ae80(0x12b)]('Target\x20path:\x20'+_0x50e9c0);const _0x132472=await withSpinner(_0x36ae80(0xea)+_0x237ef9+_0x36ae80(0x133),()=>_0x3e7846[_0x36ae80(0xf1)][_0x36ae80(0xdb)](_0x50e9c0),{'verbose':_0x1bcf04[_0x36ae80(0xe9)]}),_0x32fba8=_0x132472[_0x36ae80(0xb1)];_0x1bcf04[_0x36ae80(0xe9)]&&(console[_0x36ae80(0x12b)](_0x36ae80(0x13c)+_0x32fba8[_0x36ae80(0x138)]),console['error'](_0x36ae80(0x11a)+_0x32fba8['parentId']));if(_0x32fba8[_0x36ae80(0x138)]===_0x36ae80(0x11d))throw new SDKError(ErrorCode[_0x36ae80(0x115)],_0x36ae80(0xd2));if(_0x32fba8['type']===_0x36ae80(0x130))throw new SDKError(ErrorCode[_0x36ae80(0x115)],_0x36ae80(0x10a));if(!_0x32fba8[_0x36ae80(0xff)])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x36ae80(0xe7));const _0x1276ee=await withSpinner(_0x36ae80(0xbf),()=>_0x3e7846[_0x36ae80(0xf1)][_0x36ae80(0x10f)](_0x32fba8[_0x36ae80(0xac)],_0x32fba8[_0x36ae80(0xff)]),{'verbose':_0x1bcf04['verbose']});return _0x1276ee['data'];}}export class SegmentFolderCreateCommand extends BaseCommand{[a37_0x1e4106(0x117)]=a37_0x1e4106(0xfd);[a37_0x1e4106(0xd6)]=a37_0x1e4106(0xc7);async['execute'](_0x698129){const _0x228e2b=a37_0x1e4106,{options:_0x5de197,args:_0x4e58a1,tdx:_0x26531d}=_0x698129,_0x322879=_0x5de197;if(_0x4e58a1[_0x228e2b(0xe6)]<0x2)return console[_0x228e2b(0x12b)](_0x228e2b(0x123)),console[_0x228e2b(0x12b)](_0x228e2b(0x135)),0x1;const _0xaef46f=_0x4e58a1[0x0],_0x3771e4=_0x4e58a1[0x1];_0x322879[_0x228e2b(0xe9)]&&(console[_0x228e2b(0x12b)](_0x228e2b(0x13d)+_0x322879[_0x228e2b(0xe8)]),console[_0x228e2b(0x12b)]('Parent\x20segment:\x20'+_0xaef46f),console[_0x228e2b(0x12b)]('Folder\x20name:\x20'+_0x3771e4));let _0x29bc08;if(_0x322879[_0x228e2b(0x119)]){const _0x4df6f1=_0x322879['parentFolder'],_0x55ff63=await withSpinner(_0x228e2b(0x109)+_0xaef46f+_0x228e2b(0x133),()=>_0x26531d[_0x228e2b(0xf1)][_0x228e2b(0xc4)](_0xaef46f),{'verbose':_0x322879[_0x228e2b(0xe9)]}),_0x18a441=_0x55ff63[_0x228e2b(0xb1)],_0x5a984a=await withSpinner('Resolving\x20parent\x20folder\x20\x27'+_0x4df6f1+_0x228e2b(0x133),()=>_0x26531d[_0x228e2b(0xf1)][_0x228e2b(0xf5)](_0x18a441,_0x4df6f1),{'verbose':_0x322879[_0x228e2b(0xe9)]});_0x29bc08=_0x5a984a['data'],_0x322879[_0x228e2b(0xe9)]&&console[_0x228e2b(0x12b)](_0x228e2b(0xb5)+_0x29bc08);}const _0xf009c9={'name':_0x3771e4,'description':_0x322879[_0x228e2b(0xd6)],'parentFolderId':_0x29bc08},_0x3a035a=await withSpinner(_0x228e2b(0xf9)+_0x3771e4+_0x228e2b(0x133),()=>_0x26531d[_0x228e2b(0xf1)][_0x228e2b(0xbc)](_0xaef46f,_0xf009c9),{'verbose':_0x322879[_0x228e2b(0xe9)]}),_0x6ae65a=_0x3a035a['data'];return console[_0x228e2b(0x12b)](_0x228e2b(0x128)+_0x6ae65a['name']+_0x228e2b(0xdf)+_0x6ae65a['id']),await handleSDKOutput([_0x6ae65a],_0x322879),0x0;}}export class SegmentViewCommand extends BaseCommand{[a37_0x1e4106(0x117)]=a37_0x1e4106(0xca);[a37_0x1e4106(0xd6)]=a37_0x1e4106(0x101);async[a37_0x1e4106(0xb2)](_0x59e6b6){const _0x120822=a37_0x1e4106,{options:_0x52c484,args:_0x212f52,tdx:_0x1932c3}=_0x59e6b6,_0x59c79c=_0x212f52[0x0];if(!_0x59c79c)return console[_0x120822(0x12b)]('Error:\x20Folder\x20or\x20segment\x20name,\x20or\x20YAML\x20file\x20path\x20is\x20required'),console['error']('Usage:\x20tdx\x20sg\x20view\x20<name>\x20[-w]'),console[_0x120822(0x12b)](_0x120822(0xec)),console[_0x120822(0x12b)](_0x120822(0x13a)),console['error'](_0x120822(0xaa)),console['error'](_0x120822(0xc5)),console['error'](_0x120822(0x104)),console[_0x120822(0x12b)](_0x120822(0xd4)),console[_0x120822(0x12b)](_0x120822(0xfe)),console[_0x120822(0x12b)]('\x20\x20tdx\x20sg\x20view\x20segments/my-audience/premium-users.yml'),0x1;try{const _0x98e6e2=_0x52c484['parentSegment'],_0x347135=await resolveSegmentTarget(_0x59c79c,_0x98e6e2,_0x52c484[_0x120822(0xe9)]);_0x52c484[_0x120822(0xe9)]&&console[_0x120822(0x12b)](_0x120822(0x113)+_0x347135);const _0x39026e=await withSpinner('Resolving\x20\x27'+_0x59c79c+_0x120822(0x133),()=>_0x1932c3['segment'][_0x120822(0xdb)](_0x347135),{'verbose':_0x52c484[_0x120822(0xe9)]}),_0x65a473=_0x39026e[_0x120822(0xb1)];_0x52c484['verbose']&&(console[_0x120822(0x12b)]('Resolved\x20type:\x20'+_0x65a473[_0x120822(0x138)]),console[_0x120822(0x12b)](_0x120822(0x11a)+_0x65a473[_0x120822(0xac)]),_0x65a473[_0x120822(0xfc)]&&console[_0x120822(0x12b)](_0x120822(0xe1)+_0x65a473['folderId']),_0x65a473[_0x120822(0xff)]&&console[_0x120822(0x12b)](_0x120822(0x12a)+_0x65a473['segmentId']));if(_0x52c484[_0x120822(0x103)]){if(_0x65a473[_0x120822(0x138)]===_0x120822(0x11d))return console[_0x120822(0x12b)]('Error:\x20Cannot\x20open\x20folder\x20in\x20web\x20browser.\x20Use\x20a\x20segment\x20name\x20instead.'),0x1;if(_0x65a473[_0x120822(0x138)]===_0x120822(0x130))return console[_0x120822(0x12b)](_0x120822(0x126)),console[_0x120822(0x12b)](_0x120822(0xad)),0x1;if(!_0x65a473[_0x120822(0xff)])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0xd2b75f=getConsoleNextUrl(_0x52c484[_0x120822(0xe8)],_0x120822(0x132)+_0x65a473['parentId']+_0x120822(0x111)+_0x65a473['segmentId']);return console[_0x120822(0x12b)](a37_0x592c44['green']('✔')+'\x20Opening\x20'+a37_0x592c44[_0x120822(0xb0)](_0xd2b75f)),openBrowser(_0xd2b75f),0x0;}if(_0x65a473[_0x120822(0x138)]===_0x120822(0x11d)){if(!_0x65a473[_0x120822(0xfc)])throw new SDKError(ErrorCode[_0x120822(0xcf)],_0x120822(0xf3));const _0x11c69d=await withSpinner(_0x120822(0xc6),()=>_0x1932c3[_0x120822(0xf1)][_0x120822(0xdd)](_0x65a473[_0x120822(0xfc)]),{'verbose':_0x52c484[_0x120822(0xe9)]});await handleSingleObjectOutput(_0x11c69d[_0x120822(0xb1)],_0x52c484);}else{if(_0x65a473[_0x120822(0x138)]==='segment'){if(!_0x65a473['segmentId'])throw new SDKError(ErrorCode[_0x120822(0xbb)],_0x120822(0xe7));const _0x1ba407=await withSpinner('Fetching\x20segment\x20details...',()=>_0x1932c3[_0x120822(0xf1)][_0x120822(0xaf)](_0x65a473[_0x120822(0xac)],_0x65a473[_0x120822(0xff)]),{'verbose':_0x52c484[_0x120822(0xe9)]}),_0x104499=getConsoleNextUrl(_0x52c484['site'],'/app/ps/'+_0x65a473[_0x120822(0xac)]+'/e/'+_0x65a473['segmentId']),_0x566eb8=_0x1ba407[_0x120822(0xb1)];_0x566eb8[_0x120822(0x124)]=_0x104499,await handleSingleObjectOutput(_0x566eb8,_0x52c484);}else return console[_0x120822(0x12b)]('Error:\x20Cannot\x20view\x20parent\x20segment\x20details\x20with\x20this\x20command.'),console[_0x120822(0x12b)]('Use:\x20tdx\x20ps\x20view'),0x1;}return 0x0;}catch(_0x35e0dc){if(_0x35e0dc instanceof SDKError)return console[_0x120822(0x12b)](_0x120822(0xc2)+_0x35e0dc[_0x120822(0x134)]),_0x35e0dc[_0x120822(0xee)]&&console[_0x120822(0x12b)]('\x20\x20Cause:\x20'+_0x35e0dc['cause']),0x1;throw _0x35e0dc;}}}function a37_0x4473(){const _0x301dcb=['cause','segment:describe','28311FWQDXr','segment','red','Folder\x20ID\x20missing\x20from\x20resolved\x20path','code','resolveFolderId','Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','trim','Creating\x20folder\x20\x27','1432qmcWcA','484540jeXdZO','folderId','segment:folder:create','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20-w\x20\x20#\x20Open\x20segment\x20in\x20web\x20browser','segmentId','segment:desc','Show\x20folder\x20or\x20child\x20segment\x20details','segment:folder:list','web','\x20\x20tdx\x20sg\x20view\x20\x22Marketing\x22\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20folder\x20details','Fetching\x20folder\x20\x27','segmentPath','query','10CFzXuw','Resolving\x20parent\x20segment\x20\x27','Cannot\x20get\x20SQL\x20for\x20parent\x20segment\x20with\x20this\x20command.\x20Use:\x20tdx\x20ps\x20sql','fullPath','Error:\x20Segment\x20name\x20or\x20--path\x20is\x20required','toLocaleString','test','getSegmentSQL','650QctVQq','/e/','jobId','Target\x20path:\x20','Error:\x20Folder\x20reference\x20is\x20required','INVALID_ARGUMENT','\x20\x20tdx\x20segment\x20describe\x20\x22High\x20Value\x22\x20\x20\x20\x20#\x20Relative\x20to\x20current\x20context','name','Show\x20segment\x20folder\x20details','parentFolder','Parent\x20ID:\x20','329142NFOdCp','SELECT\x20*\x20FROM\x20(\x0a','folder','\x20\x20tdx\x20sg\x20show\x20\x22Premium\x20Users\x22','66357ECiTgm','Resolving\x20path\x20\x27','getSQLFromServerSegment','segmentName','Error:\x20Parent\x20segment\x20name\x20and\x20folder\x20name\x20are\x20required','url','\x20\x20Segment\x20name:\x20','Error:\x20Cannot\x20open\x20parent\x20segment\x20with\x20this\x20command.','Error:\x20Cannot\x20show\x20schema\x20for\x20a\x20folder.','✔\x20Created\x20folder\x20\x27','Resolved:\x20','Segment\x20ID:\x20','error','Listing\x20folders\x20for\x20parent\x20\x27','getSegmentSQLFromYaml','Resolving\x20folder\x20\x27','Use:\x20tdx\x20ps\x20desc','parent','\x20\x20Server-side\x20segment:\x20\x20tdx\x20sg\x20sql\x20<name>','/app/ps/','\x27...','message','Usage:\x20tdx\x20segment\x20folder\x20create\x20<parent_name>\x20<folder_name>\x20[options]','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20desc\x20<path/to/segment.yml>','Error:\x20Parent\x20segment\x20name\x20is\x20required','type','\x20\x20tdx\x20sg\x20sql\x20--path\x20segments/my-audience/premium-users.yml','Options:','stats','Resolved\x20type:\x20','Site:\x20','Resolved\x20relative\x20path\x20to:\x20','239445mqhWuu','✔\x20Query\x20completed:\x20Processed\x20','getSQLFromYamlFile','\x20\x20-w,\x20--web\x20\x20Open\x20segment\x20in\x20web\x20browser','in\x20','parentId','Use:\x20tdx\x20ps\x20view\x20-w','parentSegment','getSegment','cyan','data','execute','✔\x20Found\x20','SQL\x20query:\x0a','Resolved\x20parent\x20folder\x20ID:\x20','Parent\x20name:\x20','Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required','8ygCCLP','\x20\x20Cause:\x20','Error:\x20Path\x20or\x20name\x20is\x20required','SEGMENT_NOT_FOUND','createFolder','Use:\x20tdx\x20sg\x20view\x20<name>\x20\x20#\x20To\x20show\x20folder\x20details','\x20\x20tdx\x20sg\x20show\x20segments/my-audience/premium-users.yml','Fetching\x20SQL\x20for\x20segment...','jsonl','path','Error:\x20','log','resolveParentId','Examples:','Fetching\x20folder\x20details...','Create\x20segment\x20folder\x20for\x20organization','✖\x20Query\x20failed\x20[','Usage:\x20tdx\x20sg\x20show\x20<name>','segment:view','Error:\x20Specify\x20either\x20segment\x20name\x20or\x20--path,\x20not\x20both','Usage:\x20tdx\x20sg\x20desc\x20<name>','746700qmxTZe','\x20[Job\x20ID:\x20','SEGMENT_FOLDER_NOT_FOUND','format','processedRows','Cannot\x20get\x20SQL\x20query\x20for\x20a\x20folder.\x20Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.','Usage:','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20\x20\x20\x20\x20#\x20View\x20child\x20segment\x20details','Usage:\x20tdx\x20segment\x20folder\x20show\x20<parent_name/folder_name>','description','Folder\x20name:\x20','Use:\x20tdx\x20ps\x20show','includes','Show\x20segment\x20or\x20folder\x20details','resolvePathToResource','Resolved\x20parent\x20ID:\x20','getFolder','Error:\x20Cannot\x20show\x20schema\x20for\x20parent\x20segment\x20with\x20this\x20command.','\x27\x20with\x20ID:\x20','20sOuxAO','Folder\x20ID:\x20','Usage:\x20tdx\x20segment\x20folder\x20list\x20<parent_name>','Fetching\x20segment\x20details...','\x20\x20Parent\x20segment:\x20','Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20','length','Segment\x20ID\x20missing\x20from\x20resolved\x20path','site','verbose','Resolving\x20\x27','listFolders','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20view\x20<path/to/segment.yml>','No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22'];a37_0x4473=function(){return _0x301dcb;};return a37_0x4473();}export const SegmentInfoCommand=SegmentViewCommand;export class SegmentDescCommand extends BaseCommand{[a37_0x1e4106(0x117)]=a37_0x1e4106(0x100);[a37_0x1e4106(0xd6)]='Show\x20child\x20segment\x20schema\x20(column\x20types)';async[a37_0x1e4106(0xb2)](_0x1ace16){const _0x1a6928=a37_0x1e4106,{options:_0x382331,args:_0x518c05,tdx:_0x3d5b3c}=_0x1ace16,_0x192bc5=_0x518c05[0x0];if(!_0x192bc5)return console[_0x1a6928(0x12b)](_0x1a6928(0xb7)),console[_0x1a6928(0x12b)](_0x1a6928(0xcc)),console[_0x1a6928(0x12b)](_0x1a6928(0x136)),console[_0x1a6928(0x12b)](_0x1a6928(0xc5)),console[_0x1a6928(0x12b)]('\x20\x20tdx\x20sg\x20desc\x20\x22Premium\x20Users\x22'),console['error']('\x20\x20tdx\x20sg\x20desc\x20segments/my-audience/premium-users.yml'),0x1;try{const _0x8a9561=_0x382331[_0x1a6928(0xae)],_0x3590b7=await resolveSegmentTarget(_0x192bc5,_0x8a9561,_0x382331['verbose']);_0x382331[_0x1a6928(0xe9)]&&console[_0x1a6928(0x12b)](_0x1a6928(0x113)+_0x3590b7);const _0x5b528e=await withSpinner(_0x1a6928(0xea)+_0x192bc5+_0x1a6928(0x133),()=>_0x3d5b3c[_0x1a6928(0xf1)][_0x1a6928(0xdb)](_0x3590b7),{'verbose':_0x382331[_0x1a6928(0xe9)]}),_0x344406=_0x5b528e[_0x1a6928(0xb1)];_0x382331[_0x1a6928(0xe9)]&&(console[_0x1a6928(0x12b)](_0x1a6928(0x13c)+_0x344406[_0x1a6928(0x138)]),console[_0x1a6928(0x12b)]('Parent\x20ID:\x20'+_0x344406[_0x1a6928(0xac)]));if(_0x344406[_0x1a6928(0x138)]===_0x1a6928(0x11d))return console[_0x1a6928(0x12b)](_0x1a6928(0x127)),console[_0x1a6928(0x12b)](_0x1a6928(0xf6)),0x1;if(_0x344406[_0x1a6928(0x138)]==='parent')return console[_0x1a6928(0x12b)](_0x1a6928(0xde)),console[_0x1a6928(0x12b)](_0x1a6928(0x12f)),0x1;if(!_0x344406[_0x1a6928(0xff)])throw new SDKError(ErrorCode[_0x1a6928(0xbb)],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x368633=await withSpinner(_0x1a6928(0xbf),()=>_0x3d5b3c[_0x1a6928(0xf1)]['getSegmentSQL'](_0x344406[_0x1a6928(0xac)],_0x344406[_0x1a6928(0xff)]),{'verbose':_0x382331['verbose']}),_0x1f4acd=_0x368633['data'],_0x5ec388=await executeSchemaQuery(_0x1f4acd,_0x3d5b3c,_0x382331);return await handleQueryOutput(_0x5ec388,_0x382331),0x0;}catch(_0x3636f2){if(_0x3636f2 instanceof SDKError)return console[_0x1a6928(0x12b)](_0x1a6928(0xc2)+_0x3636f2[_0x1a6928(0x134)]),_0x3636f2['cause']&&console[_0x1a6928(0x12b)](_0x1a6928(0xb9)+_0x3636f2[_0x1a6928(0xee)]),0x1;throw _0x3636f2;}}}
1
+ const a37_0x11568e=a37_0xfa63;function a37_0x1345(){const _0x1f46ad=['\x27...','Get\x20SQL\x20query\x20for\x20child\x20segment','\x20\x20tdx\x20sg\x20view\x20\x22Marketing\x22\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20folder\x20details','Parent\x20name:\x20','List\x20segment\x20folders\x20under\x20a\x20parent\x20segment','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20show\x20<path/to/segment.yml>','2418912lLpWwz','\x20Opening\x20','cause','Usage:\x20tdx\x20segment\x20folder\x20create\x20<parent_name>\x20<folder_name>\x20[options]','jsonl','\x20\x20tdx\x20sg\x20show\x20segments/my-audience/premium-users.yml','Usage:\x20tdx\x20segment\x20folder\x20show\x20<parent_name/folder_name>','13078280VHKjwv','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','setJobId','Segment\x20ID\x20missing\x20from\x20resolved\x20path','resolvePathToResource','Folder\x20ID:\x20','Fetching\x20SQL\x20for\x20segment...','description','data','Use:\x20tdx\x20ps\x20show','Resolved\x20parent\x20ID:\x20','verbose','Error:\x20YAML\x20file\x20paths\x20must\x20be\x20specified\x20with\x20--path\x20option','getSQLFromYamlFile','Cannot\x20get\x20SQL\x20query\x20for\x20a\x20folder.\x20Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.','path','Error:\x20Cannot\x20show\x20schema\x20for\x20parent\x20segment\x20with\x20this\x20command.','Error:\x20Path\x20or\x20name\x20is\x20required','29039346fGGPic','✔\x20Created\x20folder\x20\x27','stats','\x20\x20Folder\x20path:\x20','SELECT\x20*\x20FROM\x20(\x0a','Use:\x20tdx\x20ps\x20view','execute','✔\x20Query\x20completed:\x20Processed\x20','5188768jqjuzv','Show\x20folder\x20or\x20child\x20segment\x20details','Resolving\x20path\x20\x27','getSegment','length','Usage:\x20tdx\x20segment\x20describe\x20<path>','\x20\x20tdx\x20sg\x20sql\x20--path\x20','Error:\x20Cannot\x20show\x20schema\x20for\x20a\x20folder.','Resolved\x20YAML\x20file:\x20','segment:folder:create','site','Fetching\x20folder\x20\x27','segment:folder:list','Use:\x20tdx\x20ps\x20view\x20-w','name','\x20\x20tdx\x20sg\x20sql\x20\x22Premium\x20Users\x22','Error:\x20Cannot\x20open\x20parent\x20segment\x20with\x20this\x20command.','Parent\x20ID:\x20','Show\x20child\x20segment\x20schema\x20(column\x20types)','replace','red','\x20\x20tdx\x20sg\x20sql\x20--path\x20segments/my-audience/premium-users.yml','listFolders','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience/Marketing/High\x20Value\x22','Error:\x20Specify\x20either\x20segment\x20name\x20or\x20--path,\x20not\x20both','toLocaleString','\x20[Job\x20ID:\x20','json','segment:folder:show','segment','\x20\x20tdx\x20sg\x20desc\x20segments/my-audience/premium-users.yml','(root)','segment:show','Usage:\x20tdx\x20sg\x20view\x20<name>\x20[-w]','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience\x22','Executing\x20segment\x20query...','Options:','Site:\x20','\x20rows\x20','web','Error:\x20Folder\x20reference\x20is\x20required','getParent','Resolving\x20parent\x20segment\x20\x27','Segment\x20ID:\x20','6088292WxmhLa','Error:\x20Cannot\x20view\x20parent\x20segment\x20details\x20with\x20this\x20command.','Usage:\x20tdx\x20sg\x20show\x20<name>','✖\x20Query\x20failed\x20[','Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20','Fetching\x20SQL\x20from\x20rule...','Usage:\x20tdx\x20sg\x20desc\x20<name>','Resolved:\x20','cyan','Examples:','Target\x20path:\x20','Folder\x20name:\x20','Error:\x20Parent\x20segment\x20name\x20and\x20folder\x20name\x20are\x20required','limit','resolveParentId','\x20\x20Server-side\x20segment:\x20\x20tdx\x20sg\x20sql\x20<name>','Creating\x20folder\x20\x27','fullPath','parent','Folder\x20ID\x20missing\x20from\x20resolved\x20path','green','12nuSLRV','\x20\x20Cause:\x20','parentId','Parent\x20segment:\x20','/e/','Resolving\x20\x27','segmentPath','Execute\x20child\x20segment\x20SQL\x20query\x20and\x20show\x20results','Fetching\x20parent\x20segment\x20details...','getSQLFromServerSegment','parentSegment','\x20\x20tdx\x20sg\x20desc\x20\x22Premium\x20Users\x22','Create\x20segment\x20folder\x20for\x20organization','SQL\x20query:\x0a','SEGMENT_NOT_FOUND','jobId','segmentId','code','Resolved\x20type:\x20','information_schema','Resolved\x20folder\x20ID:\x20','✔\x20Found\x20','Error:\x20Cannot\x20open\x20folder\x20in\x20web\x20browser.\x20Use\x20a\x20segment\x20name\x20instead.','getSegmentSQL','segment:sql','Error:\x20Parent\x20segment\x20name\x20is\x20required','Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required','folderPath','Error:\x20Cannot\x20execute\x20SQL\x20query\x20on\x20a\x20folder.','message','\x20\x20tdx\x20segment\x20describe\x20\x22High\x20Value\x22\x20\x20\x20\x20#\x20Relative\x20to\x20current\x20context','trim','\x20\x20tdx\x20sg\x20view\x20segments/my-audience/premium-users.yml','parentFolder','\x20\x20Segment\x20name:\x20','folder','type','Fetching\x20folder\x20details...','\x20\x20Full\x20path:\x20','query','Listing\x20folders\x20for\x20parent\x20\x27','log','\x20\x20tdx\x20sg\x20show\x20\x22Premium\x20Users\x22','Show\x20segment\x20folder\x20details','135830DgTIen','Resolved\x20relative\x20path\x20to:\x20','Cannot\x20get\x20SQL\x20for\x20parent\x20segment\x20with\x20this\x20command.\x20Use:\x20tdx\x20ps\x20sql','INVALID_ARGUMENT','/app/ps/','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20view\x20<path/to/segment.yml>','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','folderId','resolveFolderId','3hvGcsI','error','Use:\x20tdx\x20sg\x20view\x20<name>\x20\x20#\x20To\x20show\x20folder\x20details','Error:\x20','getSegmentSQLFromYaml','elapsedTimeMillis','Error:\x20Folder\x20or\x20segment\x20name,\x20or\x20YAML\x20file\x20path\x20is\x20required','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20-w\x20\x20#\x20Open\x20segment\x20in\x20web\x20browser','format','Error:\x20Cannot\x20execute\x20query\x20for\x20parent\x20segment\x20with\x20this\x20command.','1690740lQeOCK','getFolder','segmentName','Fetching\x20segment\x20details...','includes'];a37_0x1345=function(){return _0x1f46ad;};return a37_0x1345();}(function(_0x10bf05,_0x50cd7a){const _0x4c7870=a37_0xfa63,_0x2c3146=_0x10bf05();while(!![]){try{const _0xf08ba0=parseInt(_0x4c7870(0x125))/0x1+parseInt(_0x4c7870(0x130))/0x2+-parseInt(_0x4c7870(0x11b))/0x3*(parseInt(_0x4c7870(0xa5))/0x4)+-parseInt(_0x4c7870(0x112))/0x5*(-parseInt(_0x4c7870(0xe6))/0x6)+parseInt(_0x4c7870(0xd1))/0x7+parseInt(_0x4c7870(0x137))/0x8+-parseInt(_0x4c7870(0x9d))/0x9;if(_0xf08ba0===_0x50cd7a)break;else _0x2c3146['push'](_0x2c3146['shift']());}catch(_0x1fd304){_0x2c3146['push'](_0x2c3146['shift']());}}}(a37_0x1345,0xe4573));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,handleQueryOutput,handleSingleObjectOutput}from'../core/command-output.js';function a37_0xfa63(_0xef6481,_0x52109a){_0xef6481=_0xef6481-0x9c;const _0x134562=a37_0x1345();let _0xfa63fc=_0x134562[_0xef6481];return _0xfa63fc;}import{withSpinner,withProgressSpinner,formatElapsed}from'../utils/spinner.js';import{parseSegmentRef}from'../sdk/segment/segment-ref-parser.js';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import{executeSchemaQuery}from'../sdk/segment/fields-display.js';import{isYamlFilePath,resolveYamlFilePath}from'../sdk/segment/segment-path-parser.js';import{getConsoleNextUrl}from'../sdk/client/endpoints.js';import{openBrowser}from'../utils/process.js';import a37_0x27793e from'chalk';async function resolveSegmentTarget(_0x5e2b72,_0x187356,_0x57e76e){const _0x1f2524=a37_0xfa63;if(isYamlFilePath(_0x5e2b72))try{const _0x164502=await resolveYamlFilePath(_0x5e2b72);return _0x57e76e&&(console[_0x1f2524(0x11c)](_0x1f2524(0xad)+_0x5e2b72),console[_0x1f2524(0x11c)]('\x20\x20Parent\x20segment:\x20'+_0x164502['parentSegment']),console[_0x1f2524(0x11c)](_0x1f2524(0x108)+_0x164502[_0x1f2524(0x127)]),console['error'](_0x1f2524(0xa0)+(_0x164502[_0x1f2524(0x101)]||_0x1f2524(0xc4))),console[_0x1f2524(0x11c)](_0x1f2524(0x10c)+_0x164502[_0x1f2524(0xe2)])),_0x164502[_0x1f2524(0xe2)];}catch(_0x2aaaab){throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x1f2524(0xd5)+_0x2aaaab[_0x1f2524(0x103)]);}if(!_0x187356)throw new SDKError(ErrorCode[_0x1f2524(0x115)],'No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22');return _0x187356+'/'+_0x5e2b72;}export class SegmentDescribeCommand extends BaseCommand{[a37_0x11568e(0xb3)]='segment:describe';[a37_0x11568e(0x13e)]='Show\x20segment\x20or\x20folder\x20details';async[a37_0x11568e(0xa3)](_0x143df7){const _0x5749b7=a37_0x11568e,{options:_0x1ea770,args:_0x3c88a0,tdx:_0x1ddc56}=_0x143df7,_0x39d5c6=_0x3c88a0[0x0],_0x1c6aa6=!_0x39d5c6&&!!_0x1ea770['parentSegment'],_0x120f9b=_0x39d5c6||_0x1ea770[_0x5749b7(0xf0)];if(!_0x120f9b)return console[_0x5749b7(0x11c)](_0x5749b7(0x9c)),console[_0x5749b7(0x11c)](_0x5749b7(0xaa)),console[_0x5749b7(0x11c)](_0x5749b7(0xda)),console[_0x5749b7(0x11c)](_0x5749b7(0xc7)),console['error'](_0x5749b7(0xbc)),console[_0x5749b7(0x11c)](_0x5749b7(0x104)),console['error'](_0x5749b7(0x118)),0x1;try{const _0xae545c=_0x1ea770[_0x5749b7(0xec)];let _0x5b1cc5=_0x120f9b;!_0x1c6aa6&&_0xae545c&&!_0x120f9b[_0x5749b7(0x129)]('/')&&(_0x5b1cc5=_0xae545c+'/'+_0x120f9b,_0x1ea770[_0x5749b7(0x142)]&&console[_0x5749b7(0x11c)](_0x5749b7(0x113)+_0x5b1cc5));const _0x489b5b=await withSpinner(_0x5749b7(0xa7)+_0x5b1cc5+_0x5749b7(0x12a),()=>_0x1ddc56[_0x5749b7(0xc2)][_0x5749b7(0x13b)](_0x5b1cc5),{'verbose':_0x1ea770[_0x5749b7(0x142)]}),_0x3aabe7=_0x489b5b[_0x5749b7(0x13f)];_0x1ea770['verbose']&&(console[_0x5749b7(0x11c)](_0x5749b7(0xf8)+_0x3aabe7[_0x5749b7(0x10a)]),console[_0x5749b7(0x11c)]('Parent\x20ID:\x20'+_0x3aabe7[_0x5749b7(0xe8)]),_0x3aabe7[_0x5749b7(0x119)]&&console[_0x5749b7(0x11c)](_0x5749b7(0x13c)+_0x3aabe7[_0x5749b7(0x119)]),_0x3aabe7[_0x5749b7(0xf6)]&&console[_0x5749b7(0x11c)](_0x5749b7(0xd0)+_0x3aabe7[_0x5749b7(0xf6)]));if(_0x3aabe7['type']===_0x5749b7(0xe3)){const _0x5b7d46=await withSpinner(_0x5749b7(0xee),()=>_0x1ddc56[_0x5749b7(0xc2)][_0x5749b7(0xce)](_0x3aabe7['parentId']),{'verbose':_0x1ea770[_0x5749b7(0x142)]});await handleSingleObjectOutput(_0x5b7d46[_0x5749b7(0x13f)],_0x1ea770);}else{if(_0x3aabe7[_0x5749b7(0x10a)]===_0x5749b7(0x109)){if(!_0x3aabe7[_0x5749b7(0x119)])throw new SDKError(ErrorCode['SEGMENT_FOLDER_NOT_FOUND'],_0x5749b7(0xe4));const _0x51f825=await withSpinner(_0x5749b7(0x10b),()=>_0x1ddc56[_0x5749b7(0xc2)]['getFolder'](_0x3aabe7[_0x5749b7(0x119)]),{'verbose':_0x1ea770['verbose']});await handleSingleObjectOutput(_0x51f825[_0x5749b7(0x13f)],_0x1ea770);}else{if(_0x3aabe7[_0x5749b7(0x10a)]==='segment'){if(!_0x3aabe7[_0x5749b7(0xf6)])throw new SDKError(ErrorCode[_0x5749b7(0xf4)],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x4e8cac=await withSpinner(_0x5749b7(0x128),()=>_0x1ddc56['segment'][_0x5749b7(0xa8)](_0x3aabe7['parentId'],_0x3aabe7[_0x5749b7(0xf6)]),{'verbose':_0x1ea770['verbose']});await handleSingleObjectOutput(_0x4e8cac[_0x5749b7(0x13f)],_0x1ea770);}}}return 0x0;}catch(_0x1246bf){if(_0x1246bf instanceof SDKError)return console[_0x5749b7(0x11c)](_0x5749b7(0x11e)+_0x1246bf[_0x5749b7(0x103)]),_0x1246bf['cause']&&console[_0x5749b7(0x11c)](_0x5749b7(0xe7)+_0x1246bf['cause']),0x1;throw _0x1246bf;}}}export class SegmentShowCommand extends BaseCommand{[a37_0x11568e(0xb3)]=a37_0x11568e(0xc5);[a37_0x11568e(0x13e)]=a37_0x11568e(0xed);async[a37_0x11568e(0xa3)](_0x3e30cd){const _0x1f1703=a37_0x11568e,{options:_0x3bf87f,args:_0xaac88e,tdx:_0x1800eb}=_0x3e30cd,_0x2856b2=_0xaac88e[0x0];if(!_0x2856b2)return console[_0x1f1703(0x11c)](_0x1f1703(0x100)),console[_0x1f1703(0x11c)](_0x1f1703(0xd3)),console['error'](_0x1f1703(0x12f)),console[_0x1f1703(0x11c)](_0x1f1703(0xda)),console[_0x1f1703(0x11c)](_0x1f1703(0x110)),console[_0x1f1703(0x11c)](_0x1f1703(0x135)),0x1;try{const _0x457e1f=_0x3bf87f['parentSegment'],_0x570e1b=await resolveSegmentTarget(_0x2856b2,_0x457e1f,_0x3bf87f['verbose']);_0x3bf87f[_0x1f1703(0x142)]&&console['error'](_0x1f1703(0xdb)+_0x570e1b);const _0x193f72=await withSpinner('Resolving\x20\x27'+_0x2856b2+'\x27...',()=>_0x1800eb['segment'][_0x1f1703(0x13b)](_0x570e1b),{'verbose':_0x3bf87f['verbose']}),_0x2ff982=_0x193f72['data'];_0x3bf87f[_0x1f1703(0x142)]&&(console[_0x1f1703(0x11c)]('Resolved\x20type:\x20'+_0x2ff982[_0x1f1703(0x10a)]),console[_0x1f1703(0x11c)](_0x1f1703(0xb6)+_0x2ff982[_0x1f1703(0xe8)]));if(_0x2ff982[_0x1f1703(0x10a)]===_0x1f1703(0x109))return console[_0x1f1703(0x11c)](_0x1f1703(0x102)),console[_0x1f1703(0x11c)](_0x1f1703(0x11d)),0x1;if(_0x2ff982[_0x1f1703(0x10a)]===_0x1f1703(0xe3))return console[_0x1f1703(0x11c)](_0x1f1703(0x124)),console[_0x1f1703(0x11c)](_0x1f1703(0x140)),0x1;if(!_0x2ff982[_0x1f1703(0xf6)])throw new SDKError(ErrorCode[_0x1f1703(0xf4)],_0x1f1703(0x13a));const _0x758a65=await withSpinner(_0x1f1703(0x13d),()=>_0x1800eb[_0x1f1703(0xc2)][_0x1f1703(0xfd)](_0x2ff982[_0x1f1703(0xe8)],_0x2ff982[_0x1f1703(0xf6)]),{'verbose':_0x3bf87f[_0x1f1703(0x142)]});let _0x3c3ab9=_0x758a65[_0x1f1703(0x13f)];const _0x33e3ad=resolveLimit(_0x3bf87f[_0x1f1703(0xde)],DEFAULT_DISPLAY_LIMIT),_0x4ac474=/\bLIMIT\s+\d+/i['test'](_0x3c3ab9);!_0x4ac474&&(_0x3c3ab9=_0x3c3ab9[_0x1f1703(0x105)]()[_0x1f1703(0xb8)](/;+$/,''),_0x3c3ab9=_0x1f1703(0xa1)+_0x3c3ab9+_0x1f1703(0x138)+_0x33e3ad);_0x3bf87f['verbose']&&console[_0x1f1703(0x11c)](_0x1f1703(0xf3)+_0x3c3ab9);const _0x2a3e5b=await withProgressSpinner(_0x1f1703(0xc8),async _0x25406c=>{const _0x87d86f=_0x1f1703,_0x2b88b5=await _0x1800eb[_0x87d86f(0x10d)][_0x87d86f(0xa3)](_0x3c3ab9,{'catalog':'td','schema':_0x87d86f(0xf9),'onJobId':_0x3bd748=>{const _0x3a17f9=_0x87d86f;_0x25406c[_0x3a17f9(0x139)](_0x3bd748);}});return _0x2b88b5;},{'verbose':_0x3bf87f[_0x1f1703(0x142)]}),_0x20d792=_0x2a3e5b['data'],_0x2f62c9=_0x20d792['jobId']?_0x1f1703(0xbf)+_0x20d792[_0x1f1703(0xf5)]+']':'';return console[_0x1f1703(0x11c)](_0x1f1703(0xa4)+_0x20d792[_0x1f1703(0x9f)]['processedRows'][_0x1f1703(0xbe)]()+_0x1f1703(0xcb)+('in\x20'+formatElapsed(_0x20d792['stats'][_0x1f1703(0x120)])+_0x2f62c9)),await handleQueryOutput(_0x20d792,_0x3bf87f),0x0;}catch(_0x3c9130){if(_0x3c9130 instanceof SDKError)return console[_0x1f1703(0x11c)](_0x1f1703(0xd4)+_0x3c9130[_0x1f1703(0xf7)]+']'),console[_0x1f1703(0x11c)]('\x0a'+_0x3c9130[_0x1f1703(0x103)]),0x1;throw _0x3c9130;}}}export class SegmentFolderListCommand extends BaseCommand{[a37_0x11568e(0xb3)]=a37_0x11568e(0xb1);['description']=a37_0x11568e(0x12e);async[a37_0x11568e(0xa3)](_0x17072b){const _0x5dec5c=a37_0x11568e,{options:_0x381e11,args:_0x54da6b,tdx:_0x3bc41a}=_0x17072b;if(_0x54da6b['length']===0x0)return console[_0x5dec5c(0x11c)](_0x5dec5c(0xff)),console[_0x5dec5c(0x11c)]('Usage:\x20tdx\x20segment\x20folder\x20list\x20<parent_name>'),0x1;const _0x50f578=_0x54da6b[0x0];try{_0x381e11[_0x5dec5c(0x142)]&&(console['error'](_0x5dec5c(0xca)+_0x381e11[_0x5dec5c(0xaf)]),console[_0x5dec5c(0x11c)](_0x5dec5c(0x12d)+_0x50f578));const _0x1e4a96=await withSpinner(_0x5dec5c(0xcf)+_0x50f578+_0x5dec5c(0x12a),()=>_0x3bc41a[_0x5dec5c(0xc2)][_0x5dec5c(0xdf)](_0x50f578),{'verbose':_0x381e11[_0x5dec5c(0x142)]}),_0x4bf080=_0x1e4a96[_0x5dec5c(0x13f)];_0x381e11[_0x5dec5c(0x142)]&&console['error'](_0x5dec5c(0x141)+_0x4bf080);const _0x73054b=await withSpinner(_0x5dec5c(0x10e)+_0x50f578+_0x5dec5c(0x12a),()=>_0x3bc41a['segment'][_0x5dec5c(0xbb)](_0x4bf080),{'verbose':_0x381e11['verbose']}),_0x2cb641=_0x73054b[_0x5dec5c(0x13f)];return console[_0x5dec5c(0x11c)](_0x5dec5c(0xfb)+_0x2cb641[_0x5dec5c(0xa9)]+'\x20folder'+(_0x2cb641[_0x5dec5c(0xa9)]!==0x1?'s':'')),await handleSDKOutput(_0x2cb641,_0x381e11),0x0;}catch(_0xdaaf6f){if(_0xdaaf6f instanceof SDKError)return console['error'](_0x5dec5c(0x11e)+_0xdaaf6f[_0x5dec5c(0x103)]),_0xdaaf6f[_0x5dec5c(0x132)]&&console[_0x5dec5c(0x11c)](_0x5dec5c(0xe7)+_0xdaaf6f[_0x5dec5c(0x132)]),0x1;throw _0xdaaf6f;}}}export class SegmentFolderShowCommand extends BaseCommand{['name']=a37_0x11568e(0xc1);[a37_0x11568e(0x13e)]=a37_0x11568e(0x111);async[a37_0x11568e(0xa3)](_0x23464a){const _0x1c2f22=a37_0x11568e,{options:_0x5e6c5e,args:_0xfbe9c6,tdx:_0x58197e}=_0x23464a;if(_0xfbe9c6['length']===0x0)return console[_0x1c2f22(0x11c)](_0x1c2f22(0xcd)),console[_0x1c2f22(0x11c)](_0x1c2f22(0x136)),0x1;try{const {parentId:_0x30f8aa,childId:_0x3e65ec}=parseSegmentRef(_0xfbe9c6[0x0]);_0x5e6c5e['verbose']&&(console[_0x1c2f22(0x11c)]('Site:\x20'+_0x5e6c5e[_0x1c2f22(0xaf)]),console[_0x1c2f22(0x11c)](_0x1c2f22(0x12d)+_0x30f8aa),_0x3e65ec&&console[_0x1c2f22(0x11c)](_0x1c2f22(0xdc)+_0x3e65ec));if(!_0x3e65ec)return console[_0x1c2f22(0x11c)]('Error:\x20Folder\x20name\x20is\x20required\x20(use\x20parent_name/folder_name\x20format)'),0x1;const _0x4bc736=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x30f8aa+_0x1c2f22(0x12a),()=>_0x58197e['segment'][_0x1c2f22(0xdf)](_0x30f8aa),{'verbose':_0x5e6c5e['verbose']}),_0x1b515b=_0x4bc736['data'];_0x5e6c5e[_0x1c2f22(0x142)]&&console['error'](_0x1c2f22(0x141)+_0x1b515b);const _0x5a012b=await withSpinner('Resolving\x20folder\x20\x27'+_0x3e65ec+_0x1c2f22(0x12a),()=>_0x58197e[_0x1c2f22(0xc2)][_0x1c2f22(0x11a)](_0x1b515b,_0x3e65ec),{'verbose':_0x5e6c5e[_0x1c2f22(0x142)]}),_0x46c52b=_0x5a012b['data'];_0x5e6c5e['verbose']&&console[_0x1c2f22(0x11c)](_0x1c2f22(0xfa)+_0x46c52b);const _0x3b3478=await withSpinner(_0x1c2f22(0xb0)+_0x3e65ec+'\x27...',()=>_0x58197e[_0x1c2f22(0xc2)][_0x1c2f22(0x126)](_0x46c52b),{'verbose':_0x5e6c5e['verbose']});return await handleSDKOutput([_0x3b3478['data']],_0x5e6c5e),0x0;}catch(_0x5dbe23){if(_0x5dbe23 instanceof SDKError)return console[_0x1c2f22(0x11c)](_0x1c2f22(0x11e)+_0x5dbe23['message']),_0x5dbe23['cause']&&console[_0x1c2f22(0x11c)](_0x1c2f22(0xe7)+_0x5dbe23[_0x1c2f22(0x132)]),0x1;throw _0x5dbe23;}}}export class SegmentSQLCommand extends BaseCommand{[a37_0x11568e(0xb3)]=a37_0x11568e(0xfe);['description']=a37_0x11568e(0x12b);async[a37_0x11568e(0xa3)](_0x216dcf){const _0x424088=a37_0x11568e,{options:_0x49f830,args:_0x998950}=_0x216dcf,_0xcedcb5=_0x49f830,_0x850cc2=_0xcedcb5[_0x424088(0x146)],_0x44e548=_0x998950[0x0];if(!_0x44e548&&!_0x850cc2)return console[_0x424088(0x11c)](a37_0x27793e[_0x424088(0xb9)]('Error:\x20Segment\x20name\x20or\x20--path\x20is\x20required')),console[_0x424088(0x11c)]('Usage:'),console['error'](_0x424088(0xe0)),console[_0x424088(0x11c)]('\x20\x20Local\x20YAML\x20file:\x20\x20\x20\x20\x20\x20tdx\x20sg\x20sql\x20--path\x20<file-path>'),console[_0x424088(0x11c)](_0x424088(0xda)),console[_0x424088(0x11c)](_0x424088(0xb4)),console[_0x424088(0x11c)](_0x424088(0xba)),0x1;if(_0x44e548&&_0x850cc2)return console[_0x424088(0x11c)](a37_0x27793e[_0x424088(0xb9)](_0x424088(0xbd))),0x1;try{let _0x38d793;if(_0x850cc2)_0x38d793=await this[_0x424088(0x144)](_0x850cc2,_0x216dcf);else{if(isYamlFilePath(_0x44e548))return console[_0x424088(0x11c)](a37_0x27793e[_0x424088(0xb9)](_0x424088(0x143))),console[_0x424088(0x11c)](_0x424088(0xab)+_0x44e548),0x1;else _0x38d793=await this[_0x424088(0xef)](_0x44e548,_0x216dcf);}return _0x49f830[_0x424088(0x123)]===_0x424088(0xc0)||_0x49f830['format']===_0x424088(0x134)?await handleSDKOutput([{'sql':_0x38d793}],_0x49f830):console[_0x424088(0x10f)](_0x38d793),0x0;}catch(_0x6c0431){if(_0x6c0431 instanceof SDKError)return console['error'](_0x424088(0x11e)+_0x6c0431[_0x424088(0x103)]),_0x6c0431[_0x424088(0x132)]&&console['error'](_0x424088(0xe7)+_0x6c0431[_0x424088(0x132)]),0x1;throw _0x6c0431;}}async[a37_0x11568e(0x144)](_0x29eb8d,_0x23ee71){const _0x229af4=a37_0x11568e,{options:_0x1b0944,tdx:_0x42c23c}=_0x23ee71;let _0x1885c3;try{_0x1885c3=await resolveYamlFilePath(_0x29eb8d);}catch(_0x3b28a3){throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x229af4(0xd5)+_0x3b28a3['message']);}_0x1b0944[_0x229af4(0x142)]&&console['error'](_0x229af4(0xd8)+_0x1885c3[_0x229af4(0xf0)]+'/'+_0x1885c3['segmentName']);const _0x46f445=await withSpinner(_0x229af4(0xd6),()=>_0x42c23c[_0x229af4(0xc2)][_0x229af4(0x11f)](_0x1885c3['content'],_0x1885c3[_0x229af4(0xf0)],_0x1885c3[_0x229af4(0x127)]),{'verbose':_0x1b0944[_0x229af4(0x142)]});return _0x46f445[_0x229af4(0x13f)];}async['getSQLFromServerSegment'](_0x457f64,_0x2b540d){const _0x5a7b9d=a37_0x11568e,{options:_0x1897cf,tdx:_0x41c61d}=_0x2b540d,_0xdee0de=_0x1897cf[_0x5a7b9d(0xf0)],_0x3f0d9d=await resolveSegmentTarget(_0x457f64,_0xdee0de,_0x1897cf['verbose']);_0x1897cf[_0x5a7b9d(0x142)]&&console[_0x5a7b9d(0x11c)](_0x5a7b9d(0xdb)+_0x3f0d9d);const _0x2636d1=await withSpinner('Resolving\x20\x27'+_0x457f64+_0x5a7b9d(0x12a),()=>_0x41c61d[_0x5a7b9d(0xc2)][_0x5a7b9d(0x13b)](_0x3f0d9d),{'verbose':_0x1897cf['verbose']}),_0x10323c=_0x2636d1['data'];_0x1897cf[_0x5a7b9d(0x142)]&&(console['error'](_0x5a7b9d(0xf8)+_0x10323c[_0x5a7b9d(0x10a)]),console[_0x5a7b9d(0x11c)](_0x5a7b9d(0xb6)+_0x10323c[_0x5a7b9d(0xe8)]));if(_0x10323c[_0x5a7b9d(0x10a)]===_0x5a7b9d(0x109))throw new SDKError(ErrorCode[_0x5a7b9d(0x115)],_0x5a7b9d(0x145));if(_0x10323c[_0x5a7b9d(0x10a)]===_0x5a7b9d(0xe3))throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x5a7b9d(0x114));if(!_0x10323c['segmentId'])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x5a7b9d(0x13a));const _0x434a8f=await withSpinner(_0x5a7b9d(0x13d),()=>_0x41c61d['segment'][_0x5a7b9d(0xfd)](_0x10323c['parentId'],_0x10323c[_0x5a7b9d(0xf6)]),{'verbose':_0x1897cf[_0x5a7b9d(0x142)]});return _0x434a8f[_0x5a7b9d(0x13f)];}}export class SegmentFolderCreateCommand extends BaseCommand{['name']=a37_0x11568e(0xae);['description']=a37_0x11568e(0xf2);async[a37_0x11568e(0xa3)](_0x3a6c41){const _0x224ae0=a37_0x11568e,{options:_0x5f2bda,args:_0x520651,tdx:_0x557d19}=_0x3a6c41,_0x5bab03=_0x5f2bda;if(_0x520651['length']<0x2)return console[_0x224ae0(0x11c)](_0x224ae0(0xdd)),console['error'](_0x224ae0(0x133)),0x1;const _0x3bfec8=_0x520651[0x0],_0x25d63c=_0x520651[0x1];_0x5bab03[_0x224ae0(0x142)]&&(console[_0x224ae0(0x11c)](_0x224ae0(0xca)+_0x5bab03[_0x224ae0(0xaf)]),console[_0x224ae0(0x11c)](_0x224ae0(0xe9)+_0x3bfec8),console[_0x224ae0(0x11c)](_0x224ae0(0xdc)+_0x25d63c));let _0x5018ad;if(_0x5bab03[_0x224ae0(0x107)]){const _0x4b6627=_0x5bab03[_0x224ae0(0x107)],_0x4f15a2=await withSpinner(_0x224ae0(0xcf)+_0x3bfec8+_0x224ae0(0x12a),()=>_0x557d19[_0x224ae0(0xc2)][_0x224ae0(0xdf)](_0x3bfec8),{'verbose':_0x5bab03['verbose']}),_0x8cb512=_0x4f15a2[_0x224ae0(0x13f)],_0x4cd2c0=await withSpinner('Resolving\x20parent\x20folder\x20\x27'+_0x4b6627+'\x27...',()=>_0x557d19[_0x224ae0(0xc2)][_0x224ae0(0x11a)](_0x8cb512,_0x4b6627),{'verbose':_0x5bab03[_0x224ae0(0x142)]});_0x5018ad=_0x4cd2c0['data'],_0x5bab03[_0x224ae0(0x142)]&&console[_0x224ae0(0x11c)]('Resolved\x20parent\x20folder\x20ID:\x20'+_0x5018ad);}const _0xa572cf={'name':_0x25d63c,'description':_0x5bab03[_0x224ae0(0x13e)],'parentFolderId':_0x5018ad},_0x54e40d=await withSpinner(_0x224ae0(0xe1)+_0x25d63c+_0x224ae0(0x12a),()=>_0x557d19[_0x224ae0(0xc2)]['createFolder'](_0x3bfec8,_0xa572cf),{'verbose':_0x5bab03['verbose']}),_0x11c446=_0x54e40d['data'];return console[_0x224ae0(0x11c)](_0x224ae0(0x9e)+_0x11c446[_0x224ae0(0xb3)]+'\x27\x20with\x20ID:\x20'+_0x11c446['id']),await handleSDKOutput([_0x11c446],_0x5bab03),0x0;}}export class SegmentViewCommand extends BaseCommand{[a37_0x11568e(0xb3)]='segment:view';['description']=a37_0x11568e(0xa6);async['execute'](_0x9da7db){const _0x373511=a37_0x11568e,{options:_0x3fa3c1,args:_0x15a5df,tdx:_0x32ccc8}=_0x9da7db,_0x174837=_0x15a5df[0x0];if(!_0x174837)return console[_0x373511(0x11c)](_0x373511(0x121)),console[_0x373511(0x11c)](_0x373511(0xc6)),console[_0x373511(0x11c)](_0x373511(0x117)),console[_0x373511(0x11c)](_0x373511(0xc9)),console['error']('\x20\x20-w,\x20--web\x20\x20Open\x20segment\x20in\x20web\x20browser'),console[_0x373511(0x11c)](_0x373511(0xda)),console[_0x373511(0x11c)](_0x373511(0x12c)),console[_0x373511(0x11c)]('\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20\x20\x20\x20\x20#\x20View\x20child\x20segment\x20details'),console['error'](_0x373511(0x122)),console[_0x373511(0x11c)](_0x373511(0x106)),0x1;try{const _0x371f4e=_0x3fa3c1[_0x373511(0xf0)],_0x87a0ad=await resolveSegmentTarget(_0x174837,_0x371f4e,_0x3fa3c1[_0x373511(0x142)]);_0x3fa3c1[_0x373511(0x142)]&&console[_0x373511(0x11c)](_0x373511(0xdb)+_0x87a0ad);const _0x35a098=await withSpinner(_0x373511(0xeb)+_0x174837+_0x373511(0x12a),()=>_0x32ccc8[_0x373511(0xc2)]['resolvePathToResource'](_0x87a0ad),{'verbose':_0x3fa3c1[_0x373511(0x142)]}),_0x571e19=_0x35a098[_0x373511(0x13f)];_0x3fa3c1[_0x373511(0x142)]&&(console[_0x373511(0x11c)](_0x373511(0xf8)+_0x571e19[_0x373511(0x10a)]),console['error'](_0x373511(0xb6)+_0x571e19[_0x373511(0xe8)]),_0x571e19['folderId']&&console[_0x373511(0x11c)](_0x373511(0x13c)+_0x571e19[_0x373511(0x119)]),_0x571e19[_0x373511(0xf6)]&&console[_0x373511(0x11c)](_0x373511(0xd0)+_0x571e19['segmentId']));if(_0x3fa3c1[_0x373511(0xcc)]){if(_0x571e19[_0x373511(0x10a)]===_0x373511(0x109))return console[_0x373511(0x11c)](_0x373511(0xfc)),0x1;if(_0x571e19['type']===_0x373511(0xe3))return console[_0x373511(0x11c)](_0x373511(0xb5)),console['error'](_0x373511(0xb2)),0x1;if(!_0x571e19[_0x373511(0xf6)])throw new SDKError(ErrorCode[_0x373511(0xf4)],_0x373511(0x13a));const _0x1c3a0f=getConsoleNextUrl(_0x3fa3c1[_0x373511(0xaf)],_0x373511(0x116)+_0x571e19[_0x373511(0xe8)]+'/e/'+_0x571e19['segmentId']);return console[_0x373511(0x11c)](a37_0x27793e[_0x373511(0xe5)]('✔')+_0x373511(0x131)+a37_0x27793e[_0x373511(0xd9)](_0x1c3a0f)),openBrowser(_0x1c3a0f),0x0;}if(_0x571e19[_0x373511(0x10a)]===_0x373511(0x109)){if(!_0x571e19[_0x373511(0x119)])throw new SDKError(ErrorCode['SEGMENT_FOLDER_NOT_FOUND'],_0x373511(0xe4));const _0x30728c=await withSpinner(_0x373511(0x10b),()=>_0x32ccc8[_0x373511(0xc2)][_0x373511(0x126)](_0x571e19['folderId']),{'verbose':_0x3fa3c1[_0x373511(0x142)]});await handleSingleObjectOutput(_0x30728c[_0x373511(0x13f)],_0x3fa3c1);}else{if(_0x571e19[_0x373511(0x10a)]===_0x373511(0xc2)){if(!_0x571e19[_0x373511(0xf6)])throw new SDKError(ErrorCode[_0x373511(0xf4)],_0x373511(0x13a));const _0x5f44d8=await withSpinner('Fetching\x20segment\x20details...',()=>_0x32ccc8['segment'][_0x373511(0xa8)](_0x571e19[_0x373511(0xe8)],_0x571e19[_0x373511(0xf6)]),{'verbose':_0x3fa3c1[_0x373511(0x142)]}),_0x20d21b=getConsoleNextUrl(_0x3fa3c1[_0x373511(0xaf)],_0x373511(0x116)+_0x571e19[_0x373511(0xe8)]+_0x373511(0xea)+_0x571e19[_0x373511(0xf6)]),_0x1fbdff=_0x5f44d8['data'];_0x1fbdff['url']=_0x20d21b,await handleSingleObjectOutput(_0x1fbdff,_0x3fa3c1);}else return console['error'](_0x373511(0xd2)),console[_0x373511(0x11c)](_0x373511(0xa2)),0x1;}return 0x0;}catch(_0x39fd86){if(_0x39fd86 instanceof SDKError)return console[_0x373511(0x11c)]('Error:\x20'+_0x39fd86[_0x373511(0x103)]),_0x39fd86[_0x373511(0x132)]&&console[_0x373511(0x11c)](_0x373511(0xe7)+_0x39fd86[_0x373511(0x132)]),0x1;throw _0x39fd86;}}}export const SegmentInfoCommand=SegmentViewCommand;export class SegmentDescCommand extends BaseCommand{[a37_0x11568e(0xb3)]='segment:desc';[a37_0x11568e(0x13e)]=a37_0x11568e(0xb7);async[a37_0x11568e(0xa3)](_0x59a5d4){const _0x256a21=a37_0x11568e,{options:_0x399041,args:_0x48b5f8,tdx:_0x10cc5b}=_0x59a5d4,_0x4a68cf=_0x48b5f8[0x0];if(!_0x4a68cf)return console[_0x256a21(0x11c)]('Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required'),console['error'](_0x256a21(0xd7)),console['error']('\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20desc\x20<path/to/segment.yml>'),console[_0x256a21(0x11c)](_0x256a21(0xda)),console[_0x256a21(0x11c)](_0x256a21(0xf1)),console['error'](_0x256a21(0xc3)),0x1;try{const _0x351454=_0x399041['parentSegment'],_0x60085c=await resolveSegmentTarget(_0x4a68cf,_0x351454,_0x399041['verbose']);_0x399041[_0x256a21(0x142)]&&console[_0x256a21(0x11c)](_0x256a21(0xdb)+_0x60085c);const _0xc98cf0=await withSpinner(_0x256a21(0xeb)+_0x4a68cf+'\x27...',()=>_0x10cc5b[_0x256a21(0xc2)][_0x256a21(0x13b)](_0x60085c),{'verbose':_0x399041[_0x256a21(0x142)]}),_0x151a2f=_0xc98cf0[_0x256a21(0x13f)];_0x399041[_0x256a21(0x142)]&&(console[_0x256a21(0x11c)](_0x256a21(0xf8)+_0x151a2f[_0x256a21(0x10a)]),console[_0x256a21(0x11c)](_0x256a21(0xb6)+_0x151a2f['parentId']));if(_0x151a2f['type']===_0x256a21(0x109))return console[_0x256a21(0x11c)](_0x256a21(0xac)),console[_0x256a21(0x11c)]('Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.'),0x1;if(_0x151a2f['type']===_0x256a21(0xe3))return console['error'](_0x256a21(0x147)),console[_0x256a21(0x11c)]('Use:\x20tdx\x20ps\x20desc'),0x1;if(!_0x151a2f[_0x256a21(0xf6)])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x5a605a=await withSpinner(_0x256a21(0x13d),()=>_0x10cc5b['segment'][_0x256a21(0xfd)](_0x151a2f[_0x256a21(0xe8)],_0x151a2f[_0x256a21(0xf6)]),{'verbose':_0x399041[_0x256a21(0x142)]}),_0x414203=_0x5a605a['data'],_0xed18d1=await executeSchemaQuery(_0x414203,_0x10cc5b,_0x399041);return await handleQueryOutput(_0xed18d1,_0x399041),0x0;}catch(_0x2a5ded){if(_0x2a5ded instanceof SDKError)return console[_0x256a21(0x11c)](_0x256a21(0x11e)+_0x2a5ded[_0x256a21(0x103)]),_0x2a5ded['cause']&&console[_0x256a21(0x11c)](_0x256a21(0xe7)+_0x2a5ded[_0x256a21(0x132)]),0x1;throw _0x2a5ded;}}}
@@ -1 +1 @@
1
- function a38_0x5c09(){const _0x71d2bb=['384040SEgWXp','segments','4jCViyq','12rPTahT','resolvePathToResource','Usage:\x20tdx\x20segment\x20create\x20<parent/segment_name>\x20[options]','Parent\x20path:\x20','execute','✔\x20Created\x20segment\x20\x27','rule','⚠\x20Deprecation\x20warning:\x20`segment\x20create`\x20is\x20deprecated.','error','\x27...','2504964TpjYNR','verbose','\x27\x20with\x20ID:\x20','Error:\x20Cannot\x20create\x20segment\x20in\x20a\x20segment.\x20Parent\x20path\x20must\x20be\x20a\x20folder\x20or\x20parent.','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/High\x20Value\x22\x20--rule\x20\x27...\x27','yellow','description','469485RxQcQr','type','18LzWiMv','Create\x20child\x20segment\x20with\x20filtering\x20rules','147Ssuznm','length','\x20\x20tdx\x20segment\x20create\x20\x22Premium\x22\x20--rule\x20\x27...\x27\x20\x20#\x20Relative\x20to\x20context','Resolved\x20relative\x20path\x20to:\x20','noCountPopulation','Segment\x20name:\x20','resolveFolderId','segment','includes','3917694BKXKDm','Error:\x20Full\x20path\x20required\x20(parent/segment_name\x20or\x20parent/folder/segment_name)','name','Resolving\x20folder\x20path\x20\x27','createSegment','467715WpnneV','Creating\x20segment\x20\x27','kind','Resolving\x20folder\x20\x27','774315pwcSrx','site','10fvtgDC','folder','Resolved\x20folder\x20ID:\x20','\x20\x20\x20Path:\x20','data','Resolving\x20parent\x20segment\x20\x27','Parent:\x20','13BPGcIP','1422567VVOHrk','Examples:'];a38_0x5c09=function(){return _0x71d2bb;};return a38_0x5c09();}const a38_0x5ac06b=a38_0x307a;(function(_0x4927ee,_0xfa3eb2){const _0x2fb663=a38_0x307a,_0x4d5574=_0x4927ee();while(!![]){try{const _0x4fb30a=-parseInt(_0x2fb663(0x182))/0x1*(parseInt(_0x2fb663(0x15e))/0x2)+parseInt(_0x2fb663(0x170))/0x3*(-parseInt(_0x2fb663(0x15f))/0x4)+parseInt(_0x2fb663(0x186))/0x5*(parseInt(_0x2fb663(0x172))/0x6)+parseInt(_0x2fb663(0x174))/0x7*(parseInt(_0x2fb663(0x15c))/0x8)+parseInt(_0x2fb663(0x15a))/0x9*(parseInt(_0x2fb663(0x188))/0xa)+parseInt(_0x2fb663(0x17d))/0xb+-parseInt(_0x2fb663(0x169))/0xc*(-parseInt(_0x2fb663(0x159))/0xd);if(_0x4fb30a===_0xfa3eb2)break;else _0x4d5574['push'](_0x4d5574['shift']());}catch(_0x3e34fd){_0x4d5574['push'](_0x4d5574['shift']());}}}(a38_0x5c09,0xc10d7));import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';function a38_0x307a(_0x4a763f,_0x46113b){_0x4a763f=_0x4a763f-0x156;const _0x5c093e=a38_0x5c09();let _0x307a9f=_0x5c093e[_0x4a763f];return _0x307a9f;}import{loadJSONFromOptions}from'../utils/json-loader.js';import{parsePath,getParentPath,getBaseName}from'../sdk/segment/segment-path-parser.js';import a38_0x322afe from'chalk';export class SegmentCreateCommand extends BaseCommand{[a38_0x5ac06b(0x17f)]='segment:create';[a38_0x5ac06b(0x16f)]=a38_0x5ac06b(0x173);async[a38_0x5ac06b(0x163)](_0x26167e){const _0x28bb75=a38_0x5ac06b;console[_0x28bb75(0x167)](a38_0x322afe['yellow'](_0x28bb75(0x166))),console[_0x28bb75(0x167)](a38_0x322afe[_0x28bb75(0x16e)]('\x20\x20Use\x20`tdx\x20sg\x20push`\x20with\x20YAML\x20files\x20instead.\x0a'));const {options:_0x415ba5,args:_0xc15f74,tdx:_0x339da9}=_0x26167e,_0x4c8902=_0x415ba5;if(_0xc15f74[_0x28bb75(0x175)]===0x0)return console[_0x28bb75(0x167)]('Error:\x20Segment\x20path\x20or\x20name\x20is\x20required'),console[_0x28bb75(0x167)]('Usage:\x20tdx\x20segment\x20create\x20<path>\x20[options]'),console[_0x28bb75(0x167)](_0x28bb75(0x15b)),console[_0x28bb75(0x167)](_0x28bb75(0x16d)),console[_0x28bb75(0x167)]('\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/Marketing/Premium\x22\x20--rule\x20\x27...\x27'),console[_0x28bb75(0x167)](_0x28bb75(0x176)),0x1;const _0x29509c=_0xc15f74[0x0],_0x437eae=_0x415ba5['segmentPath'];let _0x96bb6a=_0x29509c;_0x437eae&&!_0x29509c[_0x28bb75(0x17c)]('/')&&(_0x96bb6a=_0x437eae+'/'+_0x29509c,_0x4c8902[_0x28bb75(0x16a)]&&console[_0x28bb75(0x167)](_0x28bb75(0x177)+_0x96bb6a));const _0x2c4a34=parsePath(_0x96bb6a);if(_0x2c4a34[_0x28bb75(0x15d)][_0x28bb75(0x175)]<0x2)return console[_0x28bb75(0x167)](_0x28bb75(0x17e)),console[_0x28bb75(0x167)](_0x28bb75(0x161)),0x1;const _0x47d76e=_0x2c4a34['segments'][0x0],_0x38d954=getBaseName(_0x96bb6a),_0x205cf0=getParentPath(_0x96bb6a);_0x4c8902['verbose']&&(console[_0x28bb75(0x167)]('Site:\x20'+_0x4c8902[_0x28bb75(0x187)]),console[_0x28bb75(0x167)]('Target\x20path:\x20'+_0x96bb6a),console['error'](_0x28bb75(0x158)+_0x47d76e),console[_0x28bb75(0x167)](_0x28bb75(0x179)+_0x38d954),console[_0x28bb75(0x167)](_0x28bb75(0x162)+_0x205cf0));const _0x507911=await withSpinner(_0x28bb75(0x157)+_0x47d76e+_0x28bb75(0x168),()=>_0x339da9['segment']['resolveParentId'](_0x47d76e),{'verbose':_0x4c8902[_0x28bb75(0x16a)]}),_0x489b81=_0x507911[_0x28bb75(0x156)];let _0x2d2a46;if(_0x2c4a34[_0x28bb75(0x15d)][_0x28bb75(0x175)]>0x2){const _0x557495=await withSpinner(_0x28bb75(0x180)+_0x205cf0+_0x28bb75(0x168),()=>_0x339da9[_0x28bb75(0x17b)][_0x28bb75(0x160)](_0x205cf0),{'verbose':_0x4c8902['verbose']}),_0x3fd49c=_0x557495[_0x28bb75(0x156)];if(_0x3fd49c[_0x28bb75(0x171)]!==_0x28bb75(0x189)&&_0x3fd49c[_0x28bb75(0x171)]!=='parent')return console[_0x28bb75(0x167)](_0x28bb75(0x16c)),0x1;_0x2d2a46=_0x3fd49c['folderId'];}else{if(_0x4c8902[_0x28bb75(0x189)]){const _0x2ee08a=await withSpinner(_0x28bb75(0x185)+_0x4c8902[_0x28bb75(0x189)]+_0x28bb75(0x168),()=>_0x339da9['segment'][_0x28bb75(0x17a)](_0x489b81,_0x4c8902[_0x28bb75(0x189)]),{'verbose':_0x4c8902[_0x28bb75(0x16a)]});_0x2d2a46=_0x2ee08a[_0x28bb75(0x156)];}}_0x4c8902[_0x28bb75(0x16a)]&&_0x2d2a46&&console[_0x28bb75(0x167)](_0x28bb75(0x18a)+_0x2d2a46);const _0x78e676=await loadJSONFromOptions(_0x4c8902[_0x28bb75(0x165)],_0x4c8902['ruleFile']),_0x4720dd={'name':_0x38d954,'description':_0x4c8902['description'],'rule':_0x78e676,'kind':_0x4c8902[_0x28bb75(0x184)]!==undefined?parseInt(_0x4c8902[_0x28bb75(0x184)],0xa):undefined,'isVisible':_0x4c8902['invisible']?![]:undefined,'segmentFolderId':_0x2d2a46,'countPopulation':_0x4c8902[_0x28bb75(0x178)]?![]:undefined},_0x36cbd7=await withSpinner(_0x28bb75(0x183)+_0x38d954+_0x28bb75(0x168),()=>_0x339da9['segment'][_0x28bb75(0x181)](_0x489b81,_0x4720dd),{'verbose':_0x4c8902['verbose']}),_0x27eb81=_0x36cbd7[_0x28bb75(0x156)];return console[_0x28bb75(0x167)](_0x28bb75(0x164)+_0x27eb81['name']+_0x28bb75(0x16b)+_0x27eb81['id']),_0x96bb6a!==_0x29509c&&console[_0x28bb75(0x167)](_0x28bb75(0x18b)+_0x96bb6a),await handleSDKOutput([_0x27eb81],_0x4c8902),0x0;}}
1
+ const a38_0x4f41df=a38_0x5ea9;(function(_0x329875,_0x220fa6){const _0x4b0fce=a38_0x5ea9,_0x53af44=_0x329875();while(!![]){try{const _0x49f5a=-parseInt(_0x4b0fce(0x165))/0x1+parseInt(_0x4b0fce(0x15d))/0x2+parseInt(_0x4b0fce(0x185))/0x3*(-parseInt(_0x4b0fce(0x186))/0x4)+parseInt(_0x4b0fce(0x182))/0x5*(parseInt(_0x4b0fce(0x161))/0x6)+parseInt(_0x4b0fce(0x189))/0x7+-parseInt(_0x4b0fce(0x15f))/0x8+-parseInt(_0x4b0fce(0x17a))/0x9*(-parseInt(_0x4b0fce(0x177))/0xa);if(_0x49f5a===_0x220fa6)break;else _0x53af44['push'](_0x53af44['shift']());}catch(_0x4cc99a){_0x53af44['push'](_0x53af44['shift']());}}}(a38_0x3f0c,0x3b1e7));import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../core/command-output.js';function a38_0x5ea9(_0x3f41b9,_0x3e265c){_0x3f41b9=_0x3f41b9-0x159;const _0x3f0cd5=a38_0x3f0c();let _0x5ea9f9=_0x3f0cd5[_0x3f41b9];return _0x5ea9f9;}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_0x503570 from'chalk';export class SegmentCreateCommand extends BaseCommand{[a38_0x4f41df(0x18e)]='segment:create';[a38_0x4f41df(0x159)]=a38_0x4f41df(0x15b);async['execute'](_0x4b6596){const _0x8fd291=a38_0x4f41df;console[_0x8fd291(0x16e)](a38_0x503570[_0x8fd291(0x175)]('⚠\x20Deprecation\x20warning:\x20`segment\x20create`\x20is\x20deprecated.')),console[_0x8fd291(0x16e)](a38_0x503570[_0x8fd291(0x175)](_0x8fd291(0x166)));const {options:_0x5bdf2b,args:_0x35aa8a,tdx:_0x5b36cf}=_0x4b6596,_0x24f547=_0x5bdf2b;if(_0x35aa8a[_0x8fd291(0x17b)]===0x0)return console[_0x8fd291(0x16e)]('Error:\x20Segment\x20path\x20or\x20name\x20is\x20required'),console[_0x8fd291(0x16e)](_0x8fd291(0x187)),console[_0x8fd291(0x16e)](_0x8fd291(0x16d)),console['error'](_0x8fd291(0x176)),console['error'](_0x8fd291(0x160)),console['error'](_0x8fd291(0x167)),0x1;const _0x238880=_0x35aa8a[0x0],_0x5bc006=_0x5bdf2b[_0x8fd291(0x171)];let _0x5eca9c=_0x238880;_0x5bc006&&!_0x238880['includes']('/')&&(_0x5eca9c=_0x5bc006+'/'+_0x238880,_0x24f547[_0x8fd291(0x181)]&&console[_0x8fd291(0x16e)]('Resolved\x20relative\x20path\x20to:\x20'+_0x5eca9c));const _0x30d838=parsePath(_0x5eca9c);if(_0x30d838[_0x8fd291(0x15e)][_0x8fd291(0x17b)]<0x2)return console[_0x8fd291(0x16e)](_0x8fd291(0x163)),console['error'](_0x8fd291(0x172)),0x1;const _0x33a588=_0x30d838[_0x8fd291(0x15e)][0x0],_0x2903da=getBaseName(_0x5eca9c),_0x38b9ef=getParentPath(_0x5eca9c);_0x24f547[_0x8fd291(0x181)]&&(console[_0x8fd291(0x16e)]('Site:\x20'+_0x24f547[_0x8fd291(0x174)]),console[_0x8fd291(0x16e)](_0x8fd291(0x169)+_0x5eca9c),console['error'](_0x8fd291(0x17c)+_0x33a588),console['error'](_0x8fd291(0x18a)+_0x2903da),console[_0x8fd291(0x16e)]('Parent\x20path:\x20'+_0x38b9ef));const _0x26d730=await withSpinner(_0x8fd291(0x16f)+_0x33a588+'\x27...',()=>_0x5b36cf[_0x8fd291(0x164)][_0x8fd291(0x173)](_0x33a588),{'verbose':_0x24f547['verbose']}),_0x556bf9=_0x26d730[_0x8fd291(0x184)];let _0x572de2;if(_0x30d838[_0x8fd291(0x15e)][_0x8fd291(0x17b)]>0x2){const _0x235657=await withSpinner(_0x8fd291(0x18d)+_0x38b9ef+_0x8fd291(0x18c),()=>_0x5b36cf[_0x8fd291(0x164)][_0x8fd291(0x178)](_0x38b9ef),{'verbose':_0x24f547[_0x8fd291(0x181)]}),_0x4ace25=_0x235657[_0x8fd291(0x184)];if(_0x4ace25[_0x8fd291(0x16a)]!=='folder'&&_0x4ace25[_0x8fd291(0x16a)]!==_0x8fd291(0x16c))return console[_0x8fd291(0x16e)](_0x8fd291(0x179)),0x1;_0x572de2=_0x4ace25[_0x8fd291(0x15c)];}else{if(_0x24f547[_0x8fd291(0x17d)]){const _0x4986f9=await withSpinner('Resolving\x20folder\x20\x27'+_0x24f547[_0x8fd291(0x17d)]+_0x8fd291(0x18c),()=>_0x5b36cf['segment'][_0x8fd291(0x188)](_0x556bf9,_0x24f547[_0x8fd291(0x17d)]),{'verbose':_0x24f547[_0x8fd291(0x181)]});_0x572de2=_0x4986f9[_0x8fd291(0x184)];}}_0x24f547['verbose']&&_0x572de2&&console[_0x8fd291(0x16e)](_0x8fd291(0x15a)+_0x572de2);const _0x2e324f=await loadJSONFromOptions(_0x24f547[_0x8fd291(0x183)],_0x24f547['ruleFile']),_0x3433ea={'name':_0x2903da,'description':_0x24f547[_0x8fd291(0x159)],'rule':_0x2e324f,'kind':_0x24f547[_0x8fd291(0x18b)]!==undefined?parseInt(_0x24f547[_0x8fd291(0x18b)],0xa):undefined,'isVisible':_0x24f547[_0x8fd291(0x17e)]?![]:undefined,'segmentFolderId':_0x572de2,'countPopulation':_0x24f547[_0x8fd291(0x17f)]?![]:undefined},_0x5ab853=await withSpinner(_0x8fd291(0x180)+_0x2903da+_0x8fd291(0x18c),()=>_0x5b36cf[_0x8fd291(0x164)][_0x8fd291(0x16b)](_0x556bf9,_0x3433ea),{'verbose':_0x24f547[_0x8fd291(0x181)]}),_0x711c14=_0x5ab853[_0x8fd291(0x184)];return console[_0x8fd291(0x16e)](_0x8fd291(0x168)+_0x711c14[_0x8fd291(0x18e)]+_0x8fd291(0x170)+_0x711c14['id']),_0x5eca9c!==_0x238880&&console[_0x8fd291(0x16e)](_0x8fd291(0x162)+_0x5eca9c),await handleSDKOutput([_0x711c14],_0x24f547),0x0;}}function a38_0x3f0c(){const _0x38f261=['error','Resolving\x20parent\x20segment\x20\x27','\x27\x20with\x20ID:\x20','segmentPath','Usage:\x20tdx\x20segment\x20create\x20<parent/segment_name>\x20[options]','resolveParentId','site','yellow','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/High\x20Value\x22\x20--rule\x20\x27...\x27','227570SYrqCd','resolvePathToResource','Error:\x20Cannot\x20create\x20segment\x20in\x20a\x20segment.\x20Parent\x20path\x20must\x20be\x20a\x20folder\x20or\x20parent.','90tgICbV','length','Parent:\x20','folder','invisible','noCountPopulation','Creating\x20segment\x20\x27','verbose','13535UscfkP','rule','data','15zXEmlv','5164aUBLfh','Usage:\x20tdx\x20segment\x20create\x20<path>\x20[options]','resolveFolderId','1980300CwYvde','Segment\x20name:\x20','kind','\x27...','Resolving\x20folder\x20path\x20\x27','name','description','Resolved\x20folder\x20ID:\x20','Create\x20child\x20segment\x20with\x20filtering\x20rules','folderId','18608ialZpg','segments','2229696tcBgAw','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/Marketing/Premium\x22\x20--rule\x20\x27...\x27','474pfzsjc','\x20\x20\x20Path:\x20','Error:\x20Full\x20path\x20required\x20(parent/segment_name\x20or\x20parent/folder/segment_name)','segment','206309UwzGzc','\x20\x20Use\x20`tdx\x20sg\x20push`\x20with\x20YAML\x20files\x20instead.\x0a','\x20\x20tdx\x20segment\x20create\x20\x22Premium\x22\x20--rule\x20\x27...\x27\x20\x20#\x20Relative\x20to\x20context','✔\x20Created\x20segment\x20\x27','Target\x20path:\x20','type','createSegment','parent','Examples:'];a38_0x3f0c=function(){return _0x38f261;};return a38_0x3f0c();}
@@ -1 +1 @@
1
- function a39_0x68f9(_0xc19b5d,_0x378111){_0xc19b5d=_0xc19b5d-0x180;const _0x444f6b=a39_0x444f();let _0x68f91=_0x444f6b[_0xc19b5d];return _0x68f91;}function a39_0x444f(){const _0x2a771d=['verbose','\x27...','Listing\x20fields\x20for\x20\x27','4764950mIuyuz','description','parentSegment','132YsNAia','length','List\x20available\x20fields\x20for\x20segmentation','2DOEofE','execute','3129090jEodzR','6808srCKIq','site','Error:\x20Parent\x20segment\x20name\x20is\x20required','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','46115nopcBb','listFields','Parent\x20segment:\x20','Usage:\x20tdx\x20segment\x20fields\x20<parent_name>','error','152187XWIdMd','738qEjTTN','Site:\x20','676448jqSnhO','json','2100366duzaku','segment','✔\x20Found\x20'];a39_0x444f=function(){return _0x2a771d;};return a39_0x444f();}const a39_0x5d0a6e=a39_0x68f9;(function(_0x5d1d36,_0x21ab74){const _0x278de0=a39_0x68f9,_0x13e4e9=_0x5d1d36();while(!![]){try{const _0x258079=parseInt(_0x278de0(0x194))/0x1*(parseInt(_0x278de0(0x18d))/0x2)+parseInt(_0x278de0(0x181))/0x3+-parseInt(_0x278de0(0x19c))/0x4+-parseInt(_0x278de0(0x187))/0x5+parseInt(_0x278de0(0x18a))/0x6*(parseInt(_0x278de0(0x199))/0x7)+-parseInt(_0x278de0(0x190))/0x8*(-parseInt(_0x278de0(0x19a))/0x9)+parseInt(_0x278de0(0x18f))/0xa;if(_0x258079===_0x21ab74)break;else _0x13e4e9['push'](_0x13e4e9['shift']());}catch(_0x42651c){_0x13e4e9['push'](_0x13e4e9['shift']());}}}(a39_0x444f,0x76708));import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import{displayFieldsHumanReadable}from'../sdk/segment/fields-display.js';export class SegmentFieldsCommand extends BaseCommand{['name']='segment:fields';[a39_0x5d0a6e(0x188)]=a39_0x5d0a6e(0x18c);async[a39_0x5d0a6e(0x18e)](_0x33dbdc){const _0x2ac323=a39_0x5d0a6e,{options:_0x39c6fe,args:_0xf7a17f,tdx:_0x3f6169}=_0x33dbdc,_0x289ca4=_0xf7a17f[0x0]||_0x39c6fe[_0x2ac323(0x189)];if(!_0x289ca4)return console[_0x2ac323(0x198)](_0x2ac323(0x192)),console[_0x2ac323(0x198)](_0x2ac323(0x197)),console[_0x2ac323(0x198)](_0x2ac323(0x193)),0x1;_0x39c6fe[_0x2ac323(0x184)]&&(console['error'](_0x2ac323(0x19b)+_0x39c6fe[_0x2ac323(0x191)]),console['error'](_0x2ac323(0x196)+_0x289ca4));const _0xf21f1a=await withSpinner(_0x2ac323(0x186)+_0x289ca4+_0x2ac323(0x185),()=>_0x3f6169[_0x2ac323(0x182)][_0x2ac323(0x195)](_0x289ca4),{'verbose':_0x39c6fe[_0x2ac323(0x184)]}),_0x4710b4=_0xf21f1a['data'];console[_0x2ac323(0x198)](_0x2ac323(0x183)+_0x4710b4[_0x2ac323(0x18b)]+'\x20field'+(_0x4710b4[_0x2ac323(0x18b)]!==0x1?'s':''));if(_0x39c6fe[_0x2ac323(0x180)]||_0x39c6fe['jsonl'])return await handleSDKOutput(_0x4710b4,_0x39c6fe),0x0;return displayFieldsHumanReadable(_0x4710b4,_0x289ca4),0x0;}}
1
+ function a39_0x3d3f(){const _0xd59ea4=['segment:fields','3680835NDlMAi','✔\x20Found\x20','17hCgwqX','error','47294nkGnYv','Error:\x20Parent\x20segment\x20name\x20is\x20required','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','data','verbose','Usage:\x20tdx\x20segment\x20fields\x20<parent_name>','4vveDnr','Listing\x20fields\x20for\x20\x27','description','77KKOEPU','segment','site','4043210SLtoXL','80etGwbA','27020qqCShI','Parent\x20segment:\x20','length','6707470nXrMGO','3022218rYzdab','6222612rcOwNY','jsonl'];a39_0x3d3f=function(){return _0xd59ea4;};return a39_0x3d3f();}const a39_0x2b6cb7=a39_0xe279;function a39_0xe279(_0x5e995f,_0x4ca964){_0x5e995f=_0x5e995f-0x142;const _0x3d3f02=a39_0x3d3f();let _0xe2792e=_0x3d3f02[_0x5e995f];return _0xe2792e;}(function(_0x2a924b,_0x83fab9){const _0xb262a7=a39_0xe279,_0x3bb262=_0x2a924b();while(!![]){try{const _0x2bc905=-parseInt(_0xb262a7(0x143))/0x1*(-parseInt(_0xb262a7(0x145))/0x2)+parseInt(_0xb262a7(0x15b))/0x3*(parseInt(_0xb262a7(0x14b))/0x4)+parseInt(_0xb262a7(0x156))/0x5+parseInt(_0xb262a7(0x158))/0x6+-parseInt(_0xb262a7(0x153))/0x7*(-parseInt(_0xb262a7(0x152))/0x8)+-parseInt(_0xb262a7(0x157))/0x9+parseInt(_0xb262a7(0x151))/0xa*(-parseInt(_0xb262a7(0x14e))/0xb);if(_0x2bc905===_0x83fab9)break;else _0x3bb262['push'](_0x3bb262['shift']());}catch(_0x11afac){_0x3bb262['push'](_0x3bb262['shift']());}}}(a39_0x3d3f,0xd6ddb));import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import{displayFieldsHumanReadable}from'../sdk/segment/fields-display.js';export class SegmentFieldsCommand extends BaseCommand{['name']=a39_0x2b6cb7(0x15a);[a39_0x2b6cb7(0x14d)]='List\x20available\x20fields\x20for\x20segmentation';async['execute'](_0x3251f8){const _0x1c56b1=a39_0x2b6cb7,{options:_0x176e95,args:_0xe8b55e,tdx:_0x3799c0}=_0x3251f8,_0x5daa1c=_0xe8b55e[0x0]||_0x176e95['parentSegment'];if(!_0x5daa1c)return console[_0x1c56b1(0x144)](_0x1c56b1(0x146)),console[_0x1c56b1(0x144)](_0x1c56b1(0x14a)),console[_0x1c56b1(0x144)](_0x1c56b1(0x147)),0x1;_0x176e95[_0x1c56b1(0x149)]&&(console['error']('Site:\x20'+_0x176e95[_0x1c56b1(0x150)]),console[_0x1c56b1(0x144)](_0x1c56b1(0x154)+_0x5daa1c));const _0x54bb95=await withSpinner(_0x1c56b1(0x14c)+_0x5daa1c+'\x27...',()=>_0x3799c0[_0x1c56b1(0x14f)]['listFields'](_0x5daa1c),{'verbose':_0x176e95[_0x1c56b1(0x149)]}),_0x4e24d6=_0x54bb95[_0x1c56b1(0x148)];console[_0x1c56b1(0x144)](_0x1c56b1(0x142)+_0x4e24d6[_0x1c56b1(0x155)]+'\x20field'+(_0x4e24d6[_0x1c56b1(0x155)]!==0x1?'s':''));if(_0x176e95['json']||_0x176e95[_0x1c56b1(0x159)])return await handleSDKOutput(_0x4e24d6,_0x176e95),0x0;return displayFieldsHumanReadable(_0x4e24d6,_0x5daa1c),0x0;}}