@treasuredata/tdx 2026.6.3 → 2026.6.5

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 (249) hide show
  1. package/dist/bin.js +1 -1
  2. package/dist/build-info.json +3 -3
  3. package/dist/cli-categories.js +1 -1
  4. package/dist/cli.d.ts.map +1 -1
  5. package/dist/cli.js +1 -1
  6. package/dist/cli.js.map +1 -1
  7. package/dist/commands/activations.js +1 -1
  8. package/dist/commands/agent-command.js +1 -1
  9. package/dist/commands/agent-test-command.js +1 -1
  10. package/dist/commands/api-command.js +1 -1
  11. package/dist/commands/auth-command.js +1 -1
  12. package/dist/commands/cas-command.js +1 -1
  13. package/dist/commands/cas-segment-command.js +1 -1
  14. package/dist/commands/chat-command.js +1 -1
  15. package/dist/commands/claude-command.js +1 -1
  16. package/dist/commands/claude-statusline-command.js +1 -1
  17. package/dist/commands/claude-usage-command.js +1 -1
  18. package/dist/commands/command.js +1 -1
  19. package/dist/commands/connection-command.js +1 -1
  20. package/dist/commands/databases.js +1 -1
  21. package/dist/commands/delivery-command.js +1 -1
  22. package/dist/commands/describe.js +1 -1
  23. package/dist/commands/engage-campaign-pull-command.js +1 -1
  24. package/dist/commands/engage-campaign-push-command.js +1 -1
  25. package/dist/commands/engage-campaign-validate-command.js +1 -1
  26. package/dist/commands/engage-command.js +1 -1
  27. package/dist/commands/engage-template-pull-command.js +1 -1
  28. package/dist/commands/engage-template-push-command.js +1 -1
  29. package/dist/commands/engage-template-validate-command.js +1 -1
  30. package/dist/commands/job-command.js +1 -1
  31. package/dist/commands/journey-command.js +1 -1
  32. package/dist/commands/journey-validate-command.js +1 -1
  33. package/dist/commands/llm-command.js +1 -1
  34. package/dist/commands/mcp-command.js +1 -1
  35. package/dist/commands/parent-segment-command.js +1 -1
  36. package/dist/commands/policy-command.js +1 -1
  37. package/dist/commands/profile-command.js +1 -1
  38. package/dist/commands/profiles-command.js +1 -1
  39. package/dist/commands/query-command.js +1 -1
  40. package/dist/commands/schedule-command.js +1 -1
  41. package/dist/commands/segment-command.js +1 -1
  42. package/dist/commands/segment-create-command.js +1 -1
  43. package/dist/commands/segment-fields-command.js +1 -1
  44. package/dist/commands/segment-move-command.d.ts +19 -0
  45. package/dist/commands/segment-move-command.d.ts.map +1 -0
  46. package/dist/commands/segment-move-command.js +1 -0
  47. package/dist/commands/segment-move-command.js.map +1 -0
  48. package/dist/commands/segment-pull-command.js +1 -1
  49. package/dist/commands/segment-push-command.js +1 -1
  50. package/dist/commands/segment-update-command.js +1 -1
  51. package/dist/commands/segment-use-command.js +1 -1
  52. package/dist/commands/segment-validate-command.js +1 -1
  53. package/dist/commands/segments.js +1 -1
  54. package/dist/commands/show.js +1 -1
  55. package/dist/commands/status-command.js +1 -1
  56. package/dist/commands/table-deleted.js +1 -1
  57. package/dist/commands/tables.js +1 -1
  58. package/dist/commands/unset-command.js +1 -1
  59. package/dist/commands/upgrade-command.js +1 -1
  60. package/dist/commands/use-command.js +1 -1
  61. package/dist/commands/user-command.js +1 -1
  62. package/dist/commands/work-command.js +1 -1
  63. package/dist/commands/workflow-command.js +1 -1
  64. package/dist/core/auth.js +1 -1
  65. package/dist/core/command-output.js +1 -1
  66. package/dist/core/config.d.ts +14 -0
  67. package/dist/core/config.d.ts.map +1 -1
  68. package/dist/core/config.js +1 -1
  69. package/dist/core/config.js.map +1 -1
  70. package/dist/core/connection-cache.js +1 -1
  71. package/dist/core/constants.js +1 -1
  72. package/dist/core/credential-cache.js +1 -1
  73. package/dist/core/global-context.js +1 -1
  74. package/dist/core/keychain.js +1 -1
  75. package/dist/core/oauth-keychain.js +1 -1
  76. package/dist/core/oauth.js +1 -1
  77. package/dist/core/profile.js +1 -1
  78. package/dist/core/project-config.d.ts +1 -0
  79. package/dist/core/project-config.d.ts.map +1 -1
  80. package/dist/core/project-config.js +1 -1
  81. package/dist/core/project-config.js.map +1 -1
  82. package/dist/core/session.js +1 -1
  83. package/dist/core/user-cache.js +1 -1
  84. package/dist/core/version.js +1 -1
  85. package/dist/index.js +1 -1
  86. package/dist/mcp/server.js +1 -1
  87. package/dist/mcp/tools/index.js +1 -1
  88. package/dist/mcp/tools/tdx-run.js +1 -1
  89. package/dist/mcp/tools/tdx-search.d.ts.map +1 -1
  90. package/dist/mcp/tools/tdx-search.js +1 -1
  91. package/dist/mcp/tools/tdx-search.js.map +1 -1
  92. package/dist/mcp/tools/work-create-item.js +1 -1
  93. package/dist/mcp/utils.js +1 -1
  94. package/dist/proxy/claude-usage-tracker.js +1 -1
  95. package/dist/proxy/passthrough-server.js +1 -1
  96. package/dist/proxy/sse-usage-parser.js +1 -1
  97. package/dist/sdk/agent/agent-config.js +1 -1
  98. package/dist/sdk/agent/agent-ref-parser.js +1 -1
  99. package/dist/sdk/agent/agent-yaml.js +1 -1
  100. package/dist/sdk/agent/test/evaluator.js +1 -1
  101. package/dist/sdk/agent/test/executor.js +1 -1
  102. package/dist/sdk/agent/test/index.js +1 -1
  103. package/dist/sdk/agent/test/output.js +1 -1
  104. package/dist/sdk/agent/test/parser.js +1 -1
  105. package/dist/sdk/agent/tool-target-registry.js +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.d.ts +18 -0
  114. package/dist/sdk/client/cdp-api-client.d.ts.map +1 -1
  115. package/dist/sdk/client/cdp-api-client.js +1 -1
  116. package/dist/sdk/client/cdp-api-client.js.map +1 -1
  117. package/dist/sdk/client/delivery-api-client.js +1 -1
  118. package/dist/sdk/client/endpoints.js +1 -1
  119. package/dist/sdk/client/engage-api-client.js +1 -1
  120. package/dist/sdk/client/http-client.js +1 -1
  121. package/dist/sdk/client/llm-api-client.js +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.js +1 -1
  127. package/dist/sdk/connection-validator.js +1 -1
  128. package/dist/sdk/connection.js +1 -1
  129. package/dist/sdk/delivery.js +1 -1
  130. package/dist/sdk/engage/campaign-pull.js +1 -1
  131. package/dist/sdk/engage/campaign-push.js +1 -1
  132. package/dist/sdk/engage/campaign-validator.js +1 -1
  133. package/dist/sdk/engage/campaign-yaml.js +1 -1
  134. package/dist/sdk/engage/template-pull.js +1 -1
  135. package/dist/sdk/engage/template-push.js +1 -1
  136. package/dist/sdk/engage/template-validator.js +1 -1
  137. package/dist/sdk/engage/template-yaml.js +1 -1
  138. package/dist/sdk/engage/types/campaign-def.js +1 -1
  139. package/dist/sdk/engage/types/campaign-schema.js +1 -1
  140. package/dist/sdk/engage/types/template-schema.js +1 -1
  141. package/dist/sdk/engage.js +1 -1
  142. package/dist/sdk/errors.js +1 -1
  143. package/dist/sdk/index.js +1 -1
  144. package/dist/sdk/io/index.js +1 -1
  145. package/dist/sdk/io/node-filesystem.js +1 -1
  146. package/dist/sdk/job.js +1 -1
  147. package/dist/sdk/journey.js +1 -1
  148. package/dist/sdk/llm/chat-cache.js +1 -1
  149. package/dist/sdk/llm/index.js +1 -1
  150. package/dist/sdk/llm/llm-backup-utils.js +1 -1
  151. package/dist/sdk/llm/model-factors.js +1 -1
  152. package/dist/sdk/llm/user-settings.js +1 -1
  153. package/dist/sdk/personalization.js +1 -1
  154. package/dist/sdk/policy.js +1 -1
  155. package/dist/sdk/query/deleted-table-validation.js +1 -1
  156. package/dist/sdk/query/index.js +1 -1
  157. package/dist/sdk/query/sql-parser.js +1 -1
  158. package/dist/sdk/realtime.js +1 -1
  159. package/dist/sdk/schedule.js +1 -1
  160. package/dist/sdk/segment/child-segment-yaml.js +1 -1
  161. package/dist/sdk/segment/fields-display.js +1 -1
  162. package/dist/sdk/segment/file-discovery.js +1 -1
  163. package/dist/sdk/segment/journey-utils.js +1 -1
  164. package/dist/sdk/segment/journey-validator.js +1 -1
  165. package/dist/sdk/segment/journey-yaml.js +1 -1
  166. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  167. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  168. package/dist/sdk/segment/pull-workflow.js +1 -1
  169. package/dist/sdk/segment/push-recovery.js +1 -1
  170. package/dist/sdk/segment/push-workflow.js +1 -1
  171. package/dist/sdk/segment/resolution-context.js +1 -1
  172. package/dist/sdk/segment/segment-path-parser.js +1 -1
  173. package/dist/sdk/segment/segment-ref-parser.js +1 -1
  174. package/dist/sdk/segment/segment-validator.js +1 -1
  175. package/dist/sdk/segment/target-resolution.js +1 -1
  176. package/dist/sdk/segment/tdx-config.js +1 -1
  177. package/dist/sdk/segment/types/activation-schema.js +1 -1
  178. package/dist/sdk/segment/types/journey-def.js +1 -1
  179. package/dist/sdk/segment/types/journey-schema.js +1 -1
  180. package/dist/sdk/segment/types/segment-def.js +1 -1
  181. package/dist/sdk/segment/types/segment-schema.js +1 -1
  182. package/dist/sdk/segment/validate-files.js +1 -1
  183. package/dist/sdk/segment/yaml-validator.js +1 -1
  184. package/dist/sdk/segment.d.ts +28 -1
  185. package/dist/sdk/segment.d.ts.map +1 -1
  186. package/dist/sdk/segment.js +1 -1
  187. package/dist/sdk/segment.js.map +1 -1
  188. package/dist/sdk/types/cdp.d.ts +15 -0
  189. package/dist/sdk/types/cdp.d.ts.map +1 -1
  190. package/dist/sdk/types/index.d.ts +1 -1
  191. package/dist/sdk/types/index.d.ts.map +1 -1
  192. package/dist/sdk/types/index.js +1 -1
  193. package/dist/sdk/types/index.js.map +1 -1
  194. package/dist/sdk/types/progress.js +1 -1
  195. package/dist/sdk/types/workspace.js +1 -1
  196. package/dist/sdk/user.js +1 -1
  197. package/dist/sdk/util/format-detector.js +1 -1
  198. package/dist/sdk/util/formatters.js +1 -1
  199. package/dist/sdk/util/index.js +1 -1
  200. package/dist/sdk/util/paginate.js +1 -1
  201. package/dist/sdk/util/tree-formatter.js +1 -1
  202. package/dist/sdk/workflow/archive-validation.js +1 -1
  203. package/dist/sdk/workflow/clone-workflow.js +1 -1
  204. package/dist/sdk/workflow/index.js +1 -1
  205. package/dist/sdk/workflow/pull-workflow.js +1 -1
  206. package/dist/sdk/workflow/push-workflow.js +1 -1
  207. package/dist/sdk/workflow/task-graph.js +1 -1
  208. package/dist/sdk/workflow/tdx-config.js +1 -1
  209. package/dist/sdk/workflow/workflow-utils.js +1 -1
  210. package/dist/sdk/workspace/access-tracker.js +1 -1
  211. package/dist/sdk/workspace/frontmatter.js +1 -1
  212. package/dist/sdk/workspace/git.js +1 -1
  213. package/dist/sdk/workspace/index.js +1 -1
  214. package/dist/sdk/workspace/templates.js +1 -1
  215. package/dist/sdk/workspace/weekly.js +1 -1
  216. package/dist/sdk/workspace/wikilinks.js +1 -1
  217. package/dist/test-utils/command-runner.js +1 -1
  218. package/dist/test-utils/factories.js +1 -1
  219. package/dist/test-utils/fixtures.js +1 -1
  220. package/dist/test-utils/http-mock.js +1 -1
  221. package/dist/test-utils/index.js +1 -1
  222. package/dist/utils/async.js +1 -1
  223. package/dist/utils/colors.js +1 -1
  224. package/dist/utils/diff.js +1 -1
  225. package/dist/utils/file-permissions.js +1 -1
  226. package/dist/utils/file-reader.js +1 -1
  227. package/dist/utils/github-releases.js +1 -1
  228. package/dist/utils/global-cache.js +1 -1
  229. package/dist/utils/json-loader.js +1 -1
  230. package/dist/utils/local-cache.js +1 -1
  231. package/dist/utils/logger/formatters/default-formatter.js +1 -1
  232. package/dist/utils/logger/formatters/index.js +1 -1
  233. package/dist/utils/logger/handlers/console-handler.js +1 -1
  234. package/dist/utils/logger/handlers/file-handler.js +1 -1
  235. package/dist/utils/logger/handlers/index.js +1 -1
  236. package/dist/utils/logger/handlers/null-handler.js +1 -1
  237. package/dist/utils/logger/index.js +1 -1
  238. package/dist/utils/logger/logger.js +1 -1
  239. package/dist/utils/logger/types.js +1 -1
  240. package/dist/utils/option-validation.js +1 -1
  241. package/dist/utils/process.js +1 -1
  242. package/dist/utils/prompt.js +1 -1
  243. package/dist/utils/spinner.js +1 -1
  244. package/dist/utils/sse-parser.js +1 -1
  245. package/dist/utils/string-utils.js +1 -1
  246. package/dist/utils/table-ref-parser.js +1 -1
  247. package/dist/utils/tdx-logger.js +1 -1
  248. package/dist/utils/version-check.js +1 -1
  249. package/package.json +1 -1
@@ -1 +1 @@
1
- function a32_0x4e82(){const _0x4438f6=['getPolicy','getCurrent','Listing\x20policies...','9aSrWfG','policy','getPolicyUsers','\x20assigned','\x20user','permissions','account_owner','1463810fOiXvw','349292DQwmYk','log','🔑\x20Effective\x20Permissions','22vQFLIt','length','Administrator','List\x20all\x20policies\x20in\x20the\x20account\x20(admin\x20only)','verbose','join','max','listPolicies','\x20\x20•\x20','map','policies','operation','ies','1863395NhhLZD','administrator','policy\x20list','padEnd','Fetching\x20policy...','3144328JVbWtj','getPolicyPermissions','error','description','44036oWDUzU','✔\x20Found\x20','args','execute','\x20\x20\x20','Show\x20a\x20specific\x20policy\x20details\x20and\x20permissions\x20(admin\x20only)','dim','site','👥\x20Assigned\x20Users','email','No\x20policies\x20found',',\x20user_id:','account_id','\x20polic','bold','data','📋\x20Assigned\x20Policies','7jKdsro','all','4VJHHTb','\x20—\x20','entries','name','1825062XpttZW','63VFBHfv','12560220xoVieE','Usage:\x20tdx\x20policy\x20show\x20<policy-name-or-id>'];a32_0x4e82=function(){return _0x4438f6;};return a32_0x4e82();}function a32_0x5d37(_0x330c5b,_0x183a37){_0x330c5b=_0x330c5b-0xea;const _0x4e8228=a32_0x4e82();let _0x5d379c=_0x4e8228[_0x330c5b];return _0x5d379c;}const a32_0x38e537=a32_0x5d37;(function(_0x19e7d4,_0x4d71da){const _0x5a8712=a32_0x5d37,_0xa7885a=_0x19e7d4();while(!![]){try{const _0x5dafdc=-parseInt(_0x5a8712(0x101))/0x1+-parseInt(_0x5a8712(0x11a))/0x2*(-parseInt(_0x5a8712(0xf3))/0x3)+-parseInt(_0x5a8712(0xee))/0x4*(parseInt(_0x5a8712(0x111))/0x5)+parseInt(_0x5a8712(0xf2))/0x6*(-parseInt(_0x5a8712(0xec))/0x7)+parseInt(_0x5a8712(0x116))/0x8*(-parseInt(_0x5a8712(0xf9))/0x9)+-parseInt(_0x5a8712(0x100))/0xa*(-parseInt(_0x5a8712(0x104))/0xb)+parseInt(_0x5a8712(0xf4))/0xc;if(_0x5dafdc===_0x4d71da)break;else _0xa7885a['push'](_0xa7885a['shift']());}catch(_0x37c2e3){_0xa7885a['push'](_0xa7885a['shift']());}}}(a32_0x4e82,0x5d6ac));import{BaseCommand}from'./command.js';import{handleSDKOutput,handleSingleObjectOutput,isStructuredFormat}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import a32_0x5ef113 from'chalk';export class PolicyCommand extends BaseCommand{['name']='policy';[a32_0x38e537(0x119)]='Show\x20current\x20user\x20policies\x20and\x20effective\x20permissions';async[a32_0x38e537(0x11d)](_0x49356a){const _0x35de0d=a32_0x38e537,{options:_0x17ed7e,tdx:_0x394bcf}=_0x49356a,_0x2df577=await withSpinner('Fetching\x20permissions...',async()=>{const _0xd6a903=a32_0x5d37,[_0x3a491e,_0x22d4f0]=await Promise[_0xd6a903(0xed)]([_0x394bcf['user'][_0xd6a903(0xf7)](),_0x394bcf['policy']['getMyPermissions']()]);return{'userInfo':_0x3a491e,'permissions':_0x22d4f0};},{'verbose':_0x17ed7e[_0x35de0d(0x108)]}),{userInfo:_0x40e0bf,permissions:_0x2f6fdb}=_0x2df577['data'];if(isStructuredFormat(_0x17ed7e))return await handleSingleObjectOutput(_0x2f6fdb,_0x17ed7e),0x0;const _0xb1bc7d=_0x40e0bf[_0x35de0d(0xff)]?'Account\x20Owner':_0x40e0bf[_0x35de0d(0x112)]?_0x35de0d(0x106):'Member';console[_0x35de0d(0x102)]('\x0a'+a32_0x5ef113[_0x35de0d(0x128)]('👤')+'\x20'+a32_0x5ef113['bold'](_0x40e0bf[_0x35de0d(0xf1)])+'\x20'+a32_0x5ef113[_0x35de0d(0x120)]('('+_0x40e0bf[_0x35de0d(0x123)]+')')+_0x35de0d(0xef)+_0xb1bc7d),console[_0x35de0d(0x102)](a32_0x5ef113[_0x35de0d(0x120)](_0x35de0d(0x11e)+_0x394bcf['context'][_0x35de0d(0x121)]+':'+_0x40e0bf[_0x35de0d(0x126)]+_0x35de0d(0x125)+_0x40e0bf['id']));const _0x1b6c53=_0x2f6fdb[_0x35de0d(0x10e)];console['log']('\x0a'+a32_0x5ef113[_0x35de0d(0x128)](_0x35de0d(0xeb))+'\x20('+_0x1b6c53['length']+'):');if(_0x1b6c53[_0x35de0d(0x105)]===0x0)console[_0x35de0d(0x102)](a32_0x5ef113[_0x35de0d(0x120)]('\x20\x20No\x20policies\x20assigned'));else for(const _0x4532d5 of _0x1b6c53){console[_0x35de0d(0x102)](_0x35de0d(0x10c)+_0x4532d5[_0x35de0d(0xf1)]);}return printPermissionsMap(_0x2f6fdb[_0x35de0d(0xfe)]),console[_0x35de0d(0x102)](),0x0;}}export class PolicyListCommand extends BaseCommand{['name']=a32_0x38e537(0x113);[a32_0x38e537(0x119)]=a32_0x38e537(0x107);async['execute'](_0x2893c4){const _0x5d1892=a32_0x38e537,{options:_0x118c90,tdx:_0x155bcb}=_0x2893c4,_0x833b95=await withSpinner(_0x5d1892(0xf8),()=>_0x155bcb[_0x5d1892(0xfa)][_0x5d1892(0x10b)](),{'verbose':_0x118c90[_0x5d1892(0x108)]}),_0x5bd4e9=_0x833b95[_0x5d1892(0xea)];console[_0x5d1892(0x118)](_0x5d1892(0x11b)+_0x5bd4e9[_0x5d1892(0x105)]+_0x5d1892(0x127)+(_0x5bd4e9[_0x5d1892(0x105)]!==0x1?_0x5d1892(0x110):'y'));if(isStructuredFormat(_0x118c90))return await handleSDKOutput(_0x5bd4e9,_0x118c90),0x0;if(_0x5bd4e9['length']===0x0)console[_0x5d1892(0x102)](a32_0x5ef113[_0x5d1892(0x120)](_0x5d1892(0x124)));else for(const _0xb973b2 of _0x5bd4e9){const _0x10598a=_0xb973b2[_0x5d1892(0x119)]?a32_0x5ef113[_0x5d1892(0x120)]('\x20—\x20'+_0xb973b2[_0x5d1892(0x119)]):'';console[_0x5d1892(0x102)](_0x5d1892(0x10c)+_0xb973b2[_0x5d1892(0xf1)]+_0x10598a);}return 0x0;}}export class PolicyShowCommand extends BaseCommand{[a32_0x38e537(0xf1)]='policy\x20show';[a32_0x38e537(0x119)]=a32_0x38e537(0x11f);['validate'](_0x5e6379){const _0x1ed0c3=a32_0x38e537;if(_0x5e6379['args'][_0x1ed0c3(0x105)]===0x0)return _0x1ed0c3(0xf5);return undefined;}async[a32_0x38e537(0x11d)](_0x51e645){const _0x52f1b5=a32_0x38e537,{options:_0x19d216,tdx:_0x22517e}=_0x51e645,_0x5d3656=_0x51e645[_0x52f1b5(0x11c)][0x0],_0xabcbc4=await withSpinner(_0x52f1b5(0x115),async()=>{const _0x45d693=_0x52f1b5,_0x1f0784=await _0x22517e['policy'][_0x45d693(0xf6)](_0x5d3656),[_0x535a7c,_0xdda56f]=await Promise[_0x45d693(0xed)]([_0x22517e[_0x45d693(0xfa)][_0x45d693(0x117)](_0x1f0784['id']),_0x22517e[_0x45d693(0xfa)][_0x45d693(0xfb)](_0x1f0784['id'])]);return{'policy':_0x1f0784,'perms':_0x535a7c,'users':_0xdda56f};},{'verbose':_0x19d216[_0x52f1b5(0x108)]}),{policy:_0x33cbac,perms:_0x380dc0,users:_0x28d9f9}=_0xabcbc4[_0x52f1b5(0xea)];if(isStructuredFormat(_0x19d216))return await handleSingleObjectOutput({..._0x33cbac,'permissions':_0x380dc0[_0x52f1b5(0xfe)],'users':_0x28d9f9},_0x19d216),0x0;console[_0x52f1b5(0x102)]('\x0a'+a32_0x5ef113[_0x52f1b5(0x128)]('📋')+'\x20'+a32_0x5ef113[_0x52f1b5(0x128)](_0x33cbac[_0x52f1b5(0xf1)])+'\x20'+a32_0x5ef113[_0x52f1b5(0x120)]('(ID:\x20'+_0x33cbac['id']+')'));_0x33cbac[_0x52f1b5(0x119)]&&console[_0x52f1b5(0x102)]('\x20\x20\x20'+a32_0x5ef113[_0x52f1b5(0x120)](_0x33cbac[_0x52f1b5(0x119)]));console['log'](_0x52f1b5(0x11e)+_0x28d9f9[_0x52f1b5(0x105)]+_0x52f1b5(0xfd)+(_0x28d9f9['length']!==0x1?'s':'')+_0x52f1b5(0xfc)),printPermissionsMap(_0x380dc0[_0x52f1b5(0xfe)]);if(_0x28d9f9[_0x52f1b5(0x105)]>0x0){console['log']('\x0a'+a32_0x5ef113['bold'](_0x52f1b5(0x122))+':');for(const _0x36a63c of _0x28d9f9){const _0x2a388b=_0x36a63c[_0x52f1b5(0x123)]&&_0x36a63c[_0x52f1b5(0x123)]!==_0x36a63c[_0x52f1b5(0xf1)]?a32_0x5ef113[_0x52f1b5(0x120)]('\x20<'+_0x36a63c[_0x52f1b5(0x123)]+'>'):'';console[_0x52f1b5(0x102)]('\x20\x20•\x20'+_0x36a63c[_0x52f1b5(0xf1)]+_0x2a388b);}}return console[_0x52f1b5(0x102)](),0x0;}}function printPermissionsMap(_0x15f7e7){const _0xd6b0be=a32_0x38e537,_0x30b8c5=Object[_0xd6b0be(0xf0)](_0x15f7e7);console[_0xd6b0be(0x102)]('\x0a'+a32_0x5ef113[_0xd6b0be(0x128)](_0xd6b0be(0x103))+':');if(_0x30b8c5['length']===0x0){console[_0xd6b0be(0x102)](a32_0x5ef113[_0xd6b0be(0x120)]('\x20\x20No\x20permissions'));return;}const _0x3b22fe=Math[_0xd6b0be(0x10a)](..._0x30b8c5['map'](([_0x41a43f])=>_0x41a43f['length']));for(const [_0xdf5a5e,_0xcbd1a8]of _0x30b8c5){const _0x2375a6=formatOperations(_0xcbd1a8);console['log']('\x20\x20'+_0xdf5a5e[_0xd6b0be(0x114)](_0x3b22fe+0x2)+_0x2375a6);}}function formatOperations(_0x5a22ff){const _0x165402=a32_0x38e537,_0x2cf608=[...new Set(_0x5a22ff[_0x165402(0x10d)](_0x4a6793=>_0x4a6793[_0x165402(0x10f)]))];return _0x2cf608[_0x165402(0x109)](',\x20');}
1
+ const a32_0xfa0b09=a32_0x1397;function a32_0x1397(_0x5a3f1e,_0x596981){_0x5a3f1e=_0x5a3f1e-0x114;const _0x32ef51=a32_0x32ef();let _0x1397cc=_0x32ef51[_0x5a3f1e];return _0x1397cc;}(function(_0x1c52ef,_0x5f49cb){const _0x35dfe5=a32_0x1397,_0x3aba09=_0x1c52ef();while(!![]){try{const _0x5864f3=-parseInt(_0x35dfe5(0x11c))/0x1+-parseInt(_0x35dfe5(0x14a))/0x2+parseInt(_0x35dfe5(0x149))/0x3*(parseInt(_0x35dfe5(0x143))/0x4)+parseInt(_0x35dfe5(0x130))/0x5+-parseInt(_0x35dfe5(0x11f))/0x6*(-parseInt(_0x35dfe5(0x12f))/0x7)+parseInt(_0x35dfe5(0x131))/0x8*(parseInt(_0x35dfe5(0x135))/0x9)+-parseInt(_0x35dfe5(0x129))/0xa;if(_0x5864f3===_0x5f49cb)break;else _0x3aba09['push'](_0x3aba09['shift']());}catch(_0x5d098c){_0x3aba09['push'](_0x3aba09['shift']());}}}(a32_0x32ef,0xe261d));import{BaseCommand}from'./command.js';import{handleSDKOutput,handleSingleObjectOutput,isStructuredFormat}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import a32_0x2f4381 from'chalk';export class PolicyCommand extends BaseCommand{[a32_0xfa0b09(0x11b)]=a32_0xfa0b09(0x144);['description']=a32_0xfa0b09(0x12e);async[a32_0xfa0b09(0x14b)](_0x4f788e){const _0x5225a3=a32_0xfa0b09,{options:_0x1a0451,tdx:_0x1b2eec}=_0x4f788e,_0x290f46=await withSpinner(_0x5225a3(0x123),async()=>{const _0x206bb3=_0x5225a3,[_0x8c80e1,_0x3c22ad]=await Promise[_0x206bb3(0x142)]([_0x1b2eec['user']['getCurrent'](),_0x1b2eec[_0x206bb3(0x144)][_0x206bb3(0x118)]()]);return{'userInfo':_0x8c80e1,'permissions':_0x3c22ad};},{'verbose':_0x1a0451[_0x5225a3(0x13a)]}),{userInfo:_0x59fb84,permissions:_0x451426}=_0x290f46['data'];if(isStructuredFormat(_0x1a0451))return await handleSingleObjectOutput(_0x451426,_0x1a0451),0x0;const _0x3075b3=_0x59fb84[_0x5225a3(0x11d)]?'Account\x20Owner':_0x59fb84[_0x5225a3(0x120)]?'Administrator':'Member';console[_0x5225a3(0x116)]('\x0a'+a32_0x2f4381[_0x5225a3(0x125)]('👤')+'\x20'+a32_0x2f4381[_0x5225a3(0x125)](_0x59fb84[_0x5225a3(0x11b)])+'\x20'+a32_0x2f4381[_0x5225a3(0x12b)]('('+_0x59fb84[_0x5225a3(0x13c)]+')')+_0x5225a3(0x126)+_0x3075b3),console[_0x5225a3(0x116)](a32_0x2f4381['dim'](_0x5225a3(0x141)+_0x1b2eec[_0x5225a3(0x148)][_0x5225a3(0x145)]+':'+_0x59fb84['account_id']+',\x20user_id:'+_0x59fb84['id']));const _0x378414=_0x451426[_0x5225a3(0x114)];console[_0x5225a3(0x116)]('\x0a'+a32_0x2f4381[_0x5225a3(0x125)](_0x5225a3(0x11e))+'\x20('+_0x378414[_0x5225a3(0x14c)]+'):');if(_0x378414[_0x5225a3(0x14c)]===0x0)console[_0x5225a3(0x116)](a32_0x2f4381[_0x5225a3(0x12b)](_0x5225a3(0x14e)));else for(const _0x1420ca of _0x378414){console['log'](_0x5225a3(0x122)+_0x1420ca[_0x5225a3(0x11b)]);}return printPermissionsMap(_0x451426[_0x5225a3(0x11a)]),console[_0x5225a3(0x116)](),0x0;}}export class PolicyListCommand extends BaseCommand{[a32_0xfa0b09(0x11b)]=a32_0xfa0b09(0x13e);['description']=a32_0xfa0b09(0x140);async[a32_0xfa0b09(0x14b)](_0x28c06f){const _0x4dc1d6=a32_0xfa0b09,{options:_0x3d3136,tdx:_0x49724d}=_0x28c06f,_0x3af0a8=await withSpinner('Listing\x20policies...',()=>_0x49724d[_0x4dc1d6(0x144)][_0x4dc1d6(0x127)](),{'verbose':_0x3d3136[_0x4dc1d6(0x13a)]}),_0x5d463b=_0x3af0a8['data'];console[_0x4dc1d6(0x128)](_0x4dc1d6(0x13b)+_0x5d463b[_0x4dc1d6(0x14c)]+_0x4dc1d6(0x134)+(_0x5d463b[_0x4dc1d6(0x14c)]!==0x1?_0x4dc1d6(0x124):'y'));if(isStructuredFormat(_0x3d3136))return await handleSDKOutput(_0x5d463b,_0x3d3136),0x0;if(_0x5d463b[_0x4dc1d6(0x14c)]===0x0)console[_0x4dc1d6(0x116)](a32_0x2f4381['dim'](_0x4dc1d6(0x147)));else for(const _0x53f037 of _0x5d463b){const _0x36be4c=_0x53f037[_0x4dc1d6(0x146)]?a32_0x2f4381[_0x4dc1d6(0x12b)]('\x20—\x20'+_0x53f037[_0x4dc1d6(0x146)]):'';console[_0x4dc1d6(0x116)](_0x4dc1d6(0x122)+_0x53f037['name']+_0x36be4c);}return 0x0;}}export class PolicyShowCommand extends BaseCommand{[a32_0xfa0b09(0x11b)]=a32_0xfa0b09(0x119);['description']=a32_0xfa0b09(0x12c);['validate'](_0x360c89){const _0x2065f6=a32_0xfa0b09;if(_0x360c89[_0x2065f6(0x13f)][_0x2065f6(0x14c)]===0x0)return _0x2065f6(0x136);return undefined;}async[a32_0xfa0b09(0x14b)](_0x4c8a21){const _0x37bf24=a32_0xfa0b09,{options:_0xbc7013,tdx:_0x1390b1}=_0x4c8a21,_0x36bca8=_0x4c8a21[_0x37bf24(0x13f)][0x0],_0x4d09e6=await withSpinner('Fetching\x20policy...',async()=>{const _0x21d098=_0x37bf24,_0x9cacd0=await _0x1390b1[_0x21d098(0x144)][_0x21d098(0x117)](_0x36bca8),[_0x1bd56c,_0x278581]=await Promise[_0x21d098(0x142)]([_0x1390b1[_0x21d098(0x144)]['getPolicyPermissions'](_0x9cacd0['id']),_0x1390b1[_0x21d098(0x144)]['getPolicyUsers'](_0x9cacd0['id'])]);return{'policy':_0x9cacd0,'perms':_0x1bd56c,'users':_0x278581};},{'verbose':_0xbc7013[_0x37bf24(0x13a)]}),{policy:_0x3c95a6,perms:_0x1f1128,users:_0x14b11a}=_0x4d09e6[_0x37bf24(0x12d)];if(isStructuredFormat(_0xbc7013))return await handleSingleObjectOutput({..._0x3c95a6,'permissions':_0x1f1128['permissions'],'users':_0x14b11a},_0xbc7013),0x0;console[_0x37bf24(0x116)]('\x0a'+a32_0x2f4381[_0x37bf24(0x125)]('📋')+'\x20'+a32_0x2f4381[_0x37bf24(0x125)](_0x3c95a6[_0x37bf24(0x11b)])+'\x20'+a32_0x2f4381[_0x37bf24(0x12b)](_0x37bf24(0x115)+_0x3c95a6['id']+')'));_0x3c95a6[_0x37bf24(0x146)]&&console[_0x37bf24(0x116)](_0x37bf24(0x141)+a32_0x2f4381['dim'](_0x3c95a6['description']));console[_0x37bf24(0x116)]('\x20\x20\x20'+_0x14b11a[_0x37bf24(0x14c)]+'\x20user'+(_0x14b11a[_0x37bf24(0x14c)]!==0x1?'s':'')+_0x37bf24(0x121)),printPermissionsMap(_0x1f1128[_0x37bf24(0x11a)]);if(_0x14b11a[_0x37bf24(0x14c)]>0x0){console[_0x37bf24(0x116)]('\x0a'+a32_0x2f4381[_0x37bf24(0x125)](_0x37bf24(0x13d))+':');for(const _0x29cd89 of _0x14b11a){const _0x32a833=_0x29cd89[_0x37bf24(0x13c)]&&_0x29cd89[_0x37bf24(0x13c)]!==_0x29cd89['name']?a32_0x2f4381[_0x37bf24(0x12b)]('\x20<'+_0x29cd89['email']+'>'):'';console[_0x37bf24(0x116)](_0x37bf24(0x122)+_0x29cd89[_0x37bf24(0x11b)]+_0x32a833);}}return console[_0x37bf24(0x116)](),0x0;}}function printPermissionsMap(_0x4ef779){const _0x35189a=a32_0xfa0b09,_0x37b40f=Object[_0x35189a(0x139)](_0x4ef779);console[_0x35189a(0x116)]('\x0a'+a32_0x2f4381[_0x35189a(0x125)]('🔑\x20Effective\x20Permissions')+':');if(_0x37b40f[_0x35189a(0x14c)]===0x0){console[_0x35189a(0x116)](a32_0x2f4381['dim'](_0x35189a(0x133)));return;}const _0x306d0b=Math[_0x35189a(0x137)](..._0x37b40f[_0x35189a(0x14d)](([_0x544c20])=>_0x544c20[_0x35189a(0x14c)]));for(const [_0x4ae8b9,_0x3f1174]of _0x37b40f){const _0xbf80ec=formatOperations(_0x3f1174);console[_0x35189a(0x116)]('\x20\x20'+_0x4ae8b9[_0x35189a(0x132)](_0x306d0b+0x2)+_0xbf80ec);}}function a32_0x32ef(){const _0x414496=['Fetching\x20permissions...','ies','bold','\x20—\x20','listPolicies','error','3826030kQNKvA','operation','dim','Show\x20a\x20specific\x20policy\x20details\x20and\x20permissions\x20(admin\x20only)','data','Show\x20current\x20user\x20policies\x20and\x20effective\x20permissions','7WSmHwS','4301815PwTUkJ','16eYcKau','padEnd','\x20\x20No\x20permissions','\x20polic','2186001WkUamT','Usage:\x20tdx\x20policy\x20show\x20<policy-name-or-id>','max','join','entries','verbose','✔\x20Found\x20','email','👥\x20Assigned\x20Users','policy\x20list','args','List\x20all\x20policies\x20in\x20the\x20account\x20(admin\x20only)','\x20\x20\x20','all','4ZZqOcz','policy','site','description','No\x20policies\x20found','context','1830528lOkXhy','3299424tdSMlk','execute','length','map','\x20\x20No\x20policies\x20assigned','policies','(ID:\x20','log','getPolicy','getMyPermissions','policy\x20show','permissions','name','208658MTqjsU','account_owner','📋\x20Assigned\x20Policies','7271502XsctBf','administrator','\x20assigned','\x20\x20•\x20'];a32_0x32ef=function(){return _0x414496;};return a32_0x32ef();}function formatOperations(_0x1e0d05){const _0x3c18d5=a32_0xfa0b09,_0x45fb5e=[...new Set(_0x1e0d05[_0x3c18d5(0x14d)](_0xa8cc1b=>_0xa8cc1b[_0x3c18d5(0x12a)]))];return _0x45fb5e[_0x3c18d5(0x138)](',\x20');}
@@ -1 +1 @@
1
- const a33_0x494643=a33_0x356d;(function(_0x363a79,_0x5c8a62){const _0x129542=a33_0x356d,_0x12b8f8=_0x363a79();while(!![]){try{const _0x5122e5=parseInt(_0x129542(0x1fb))/0x1+parseInt(_0x129542(0x252))/0x2*(-parseInt(_0x129542(0x21c))/0x3)+parseInt(_0x129542(0x22f))/0x4+-parseInt(_0x129542(0x232))/0x5+parseInt(_0x129542(0x21f))/0x6+parseInt(_0x129542(0x20d))/0x7+-parseInt(_0x129542(0x259))/0x8*(parseInt(_0x129542(0x241))/0x9);if(_0x5122e5===_0x5c8a62)break;else _0x12b8f8['push'](_0x12b8f8['shift']());}catch(_0x234632){_0x12b8f8['push'](_0x12b8f8['shift']());}}}(a33_0x334a,0x63228));import{BaseCommand,printAuthError}from'./command.js';import{listProfiles,profileExists,saveProfileToUserConfig,removeProfileFromUserConfig,loadProfile,getActiveProfile,saveActiveProfileToUserConfig}from'../core/profile.js';import{getConfigDir}from'../core/config.js';function a33_0x356d(_0x4bc55a,_0x419fca){_0x4bc55a=_0x4bc55a-0x1f2;const _0x334a60=a33_0x334a();let _0x356d2a=_0x334a60[_0x4bc55a];return _0x356d2a;}import*as a33_0x475065 from'node:path';import{saveSessionContext,getSessionID,cleanExpiredSessions}from'../core/session.js';import{saveAPIKeyAsync,resolveSite}from'../core/config.js';import{getConsoleUrl}from'../sdk/client/endpoints.js';import{deleteKeychainAPIKey,isKeychainAvailable}from'../core/keychain.js';import{deleteOAuthTokens}from'../core/oauth-keychain.js';import{runOAuthLoginFlow,promptAuthMethod}from'./auth-command.js';import{promptSiteSelection}from'../core/constants.js';import{HTTPClientError}from'../sdk/client/http-client.js';import{TDX}from'../sdk/index.js';import{LogLevel}from'../utils/tdx-logger.js';import a33_0x5a5bd0 from'prompts';import a33_0x90dc09 from'chalk';function validateProfileName(_0xbb9802,_0xbc52a2){const _0xf7f764=a33_0x356d;if(!_0xbb9802||!_0xbb9802[_0xf7f764(0x200)]())return'Profile\x20name\x20cannot\x20be\x20empty';const _0x3ff689=_0xbb9802[_0xf7f764(0x200)]();if(!/^[a-zA-Z0-9_-]+$/[_0xf7f764(0x22d)](_0x3ff689))return'Profile\x20name\x20must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore';if(!_0xbc52a2?.['skipExistsCheck']&&profileExists(_0x3ff689))return _0xf7f764(0x22c)+_0x3ff689+'\x27\x20already\x20exists.\x20Use\x20\x27tdx\x20profile\x20delete\x20'+_0x3ff689+_0xf7f764(0x222);return!![];}async function deleteProfileAndCredentials(_0x270d0f){const _0x2f9b19=a33_0x356d;removeProfileFromUserConfig(_0x270d0f);const _0x28a5f7=await isKeychainAvailable();_0x28a5f7&&await Promise[_0x2f9b19(0x21b)]([deleteKeychainAPIKey(_0x270d0f),deleteOAuthTokens(_0x270d0f)]);}export class ProfileCreateCommand extends BaseCommand{['name']=a33_0x494643(0x240);[a33_0x494643(0x234)]=a33_0x494643(0x246);async['execute'](_0x1c48a0){const _0x1a33b0=a33_0x494643,{options:_0x24eb05,args:_0xec6139}=_0x1c48a0,_0x27818b=!!_0x24eb05['force'];console[_0x1a33b0(0x248)](a33_0x90dc09[_0x1a33b0(0x217)](_0x1a33b0(0x25b)));let _0x2661b5;if(_0xec6139['length']>0x0&&_0xec6139[0x0]){const _0x5b869b=_0xec6139[0x0][_0x1a33b0(0x200)]();_0x27818b&&profileExists(_0x5b869b)&&(await deleteProfileAndCredentials(_0x5b869b),console['log'](_0x1a33b0(0x213)+_0x5b869b+'\x27'));const _0x22eafe=validateProfileName(_0x5b869b);if(_0x22eafe!==!![])return console[_0x1a33b0(0x24f)](a33_0x90dc09[_0x1a33b0(0x22b)](_0x22eafe)),0x1;_0x2661b5=_0x5b869b;}else{const _0x282a58=await a33_0x5a5bd0({'type':_0x1a33b0(0x236),'name':_0x1a33b0(0x224),'message':_0x1a33b0(0x226),'validate':_0x14a21a=>validateProfileName(_0x14a21a,{'skipExistsCheck':_0x27818b})});if(!_0x282a58['profileName'])return console[_0x1a33b0(0x248)](_0x1a33b0(0x203)),0x1;_0x2661b5=_0x282a58['profileName'][_0x1a33b0(0x200)](),_0x27818b&&profileExists(_0x2661b5)&&(await deleteProfileAndCredentials(_0x2661b5),console[_0x1a33b0(0x248)](_0x1a33b0(0x213)+_0x2661b5+'\x27'));}const _0x2789e0=await a33_0x5a5bd0({'type':'text','name':_0x1a33b0(0x234),'message':_0x1a33b0(0x258)}),_0x3f575c=_0x2789e0['description']?.[_0x1a33b0(0x200)]()||undefined,_0x56a59e=_0x24eb05[_0x1a33b0(0x23c)]||_0x1a33b0(0x212),_0x440f94=await promptSiteSelection(_0x56a59e,_0x2661b5,'Setup\x20cancelled');if(!_0x440f94)return 0x1;const _0x4b3bc4=resolveSite(_0x440f94),_0x49426b=await promptAuthMethod();if(!_0x49426b)return console[_0x1a33b0(0x248)](_0x1a33b0(0x203)),0x1;if(_0x49426b===_0x1a33b0(0x255)){if(_0x3f575c){const _0x31b030={'site':_0x4b3bc4,'description':_0x3f575c};saveProfileToUserConfig(_0x2661b5,_0x31b030);}const {accountName:_0x5d7626}=_0x24eb05;return await runOAuthLoginFlow(_0x4b3bc4,_0x2661b5,_0x24eb05[_0x1a33b0(0x207)]??LogLevel[_0x1a33b0(0x24c)],{'accountName':_0x5d7626}),0x0;}console['log']('\x0aSetting\x20up\x20authentication\x20for\x20site:\x20'+_0x4b3bc4),console[_0x1a33b0(0x248)](_0x1a33b0(0x238)),console[_0x1a33b0(0x248)]('\x20\x20'+getConsoleUrl(_0x4b3bc4,'/app/mp/ak'));const _0x383c9e=await a33_0x5a5bd0({'type':_0x1a33b0(0x20a),'name':_0x1a33b0(0x244),'message':'Enter\x20your\x20TD\x20API\x20key:','validate':_0x15dca7=>{const _0x290ea8=_0x1a33b0;if(!_0x15dca7||!_0x15dca7[_0x290ea8(0x200)]())return'API\x20key\x20cannot\x20be\x20empty';return!![];}});if(!_0x383c9e['apiKey'])return console[_0x1a33b0(0x248)](_0x1a33b0(0x203)),0x1;const _0xd4c66a=_0x383c9e[_0x1a33b0(0x244)];console[_0x1a33b0(0x248)](_0x1a33b0(0x1fd));try{const _0x589a72=TDX[_0x1a33b0(0x1f2)]({'site':_0x4b3bc4,'apiKey':_0xd4c66a[_0x1a33b0(0x200)](),'logLevel':_0x24eb05['logLevel']??LogLevel[_0x1a33b0(0x24c)]}),_0x4b105c=await _0x589a72[_0x1a33b0(0x1f3)]['getUserInfo']();console[_0x1a33b0(0x248)](a33_0x90dc09['green']('✓')+'\x20API\x20key\x20is\x20valid\x20(User:\x20'+_0x4b105c[_0x1a33b0(0x219)]+')');const _0x1b19ee=await isKeychainAvailable();_0x1b19ee?(await saveAPIKeyAsync(_0xd4c66a[_0x1a33b0(0x200)](),_0x4b3bc4,_0x2661b5),console[_0x1a33b0(0x248)](a33_0x90dc09[_0x1a33b0(0x23a)]('✓')+_0x1a33b0(0x20b)+_0x2661b5+')')):(console['warn'](a33_0x90dc09[_0x1a33b0(0x225)](_0x1a33b0(0x208))),console[_0x1a33b0(0x1fc)](a33_0x90dc09['yellow'](_0x1a33b0(0x218))));const _0x1d4099={'site':_0x4b3bc4,..._0x3f575c&&{'description':_0x3f575c}};return saveProfileToUserConfig(_0x2661b5,_0x1d4099),console[_0x1a33b0(0x248)](a33_0x90dc09[_0x1a33b0(0x23a)]('✓')+_0x1a33b0(0x243)+_0x2661b5+_0x1a33b0(0x1f8)),console['log'](),console[_0x1a33b0(0x248)](_0x1a33b0(0x229)),console['log'](_0x1a33b0(0x23f)+_0x2661b5+_0x1a33b0(0x206)),console[_0x1a33b0(0x248)](_0x1a33b0(0x23f)+_0x2661b5+_0x1a33b0(0x205)),0x0;}catch(_0x490ca3){if(_0x490ca3 instanceof HTTPClientError&&_0x490ca3[_0x1a33b0(0x22a)]===0x191)return printAuthError(_0x490ca3),0x1;return console[_0x1a33b0(0x24f)](a33_0x90dc09[_0x1a33b0(0x22b)](_0x1a33b0(0x233)+(_0x490ca3 instanceof Error?_0x490ca3[_0x1a33b0(0x22e)]:String(_0x490ca3)))),console[_0x1a33b0(0x24f)](_0x1a33b0(0x23e)),0x1;}}}export class ProfileDeleteCommand extends BaseCommand{[a33_0x494643(0x204)]=a33_0x494643(0x257);[a33_0x494643(0x234)]='Delete\x20a\x20profile';[a33_0x494643(0x256)](_0x3365c6){const _0x467bba=a33_0x494643,{args:_0x2abc79}=_0x3365c6;if(_0x2abc79[_0x467bba(0x221)]===0x0)return _0x467bba(0x21a);return undefined;}async[a33_0x494643(0x210)](_0x5f04a1){const _0x1eb76f=a33_0x494643,{args:_0x850b70}=_0x5f04a1,_0x11c2ab=_0x850b70[0x0];console[_0x1eb76f(0x248)](a33_0x90dc09[_0x1eb76f(0x217)](_0x1eb76f(0x1f5)));if(!profileExists(_0x11c2ab)){console['error'](a33_0x90dc09[_0x1eb76f(0x22b)](_0x1eb76f(0x22c)+_0x11c2ab+'\x27\x20does\x20not\x20exist.')),console[_0x1eb76f(0x248)](_0x1eb76f(0x214));const _0x148ed9=listProfiles();if(_0x148ed9[_0x1eb76f(0x221)]===0x0)console['log'](_0x1eb76f(0x21e));else for(const _0x54f965 of _0x148ed9){console[_0x1eb76f(0x248)](_0x1eb76f(0x24e)+_0x54f965[_0x1eb76f(0x204)]);}return 0x1;}const _0x1007f0=await a33_0x5a5bd0({'type':'confirm','name':_0x1eb76f(0x247),'message':_0x1eb76f(0x24d)+_0x11c2ab+'\x27?','initial':![]});if(!_0x1007f0[_0x1eb76f(0x247)])return console[_0x1eb76f(0x248)]('Removal\x20cancelled'),0x0;try{await deleteProfileAndCredentials(_0x11c2ab),console[_0x1eb76f(0x248)](a33_0x90dc09[_0x1eb76f(0x23a)]('✓')+_0x1eb76f(0x243)+_0x11c2ab+'\x27\x20deleted');}catch(_0x49e9d4){return console[_0x1eb76f(0x24f)](a33_0x90dc09['red'](_0x1eb76f(0x242)+(_0x49e9d4 instanceof Error?_0x49e9d4[_0x1eb76f(0x22e)]:String(_0x49e9d4)))),0x1;}return 0x0;}}export class ProfileSetCommand extends BaseCommand{['name']=a33_0x494643(0x245);[a33_0x494643(0x234)]='Set\x20a\x20profile\x20configuration\x20value';static ['VALID_KEYS']=[a33_0x494643(0x23c),a33_0x494643(0x250),a33_0x494643(0x254),a33_0x494643(0x20e),a33_0x494643(0x23b),a33_0x494643(0x234)];['validate'](_0x5c9719){const _0x1c61b7=a33_0x494643,{args:_0x56a1f1,options:_0x517159}=_0x5c9719,_0x3aa758=_0x517159[_0x1c61b7(0x1fe)]||getActiveProfile();if(!_0x3aa758)return'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>';if(_0x56a1f1[_0x1c61b7(0x221)]===0x0)return'Key=value\x20pair\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20'+ProfileSetCommand[_0x1c61b7(0x209)]['join'](',\x20');const _0x237eac=_0x56a1f1[0x0];if(!_0x237eac[_0x1c61b7(0x235)]('='))return'Invalid\x20format.\x20Use:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20'+ProfileSetCommand[_0x1c61b7(0x209)]['join'](',\x20');const [_0x3d510a]=_0x237eac[_0x1c61b7(0x1f6)]('=',0x2);if(!ProfileSetCommand[_0x1c61b7(0x209)][_0x1c61b7(0x235)](_0x3d510a))return _0x1c61b7(0x23d)+_0x3d510a+'\x27.\x0a\x0aValid\x20keys:\x20'+ProfileSetCommand['VALID_KEYS'][_0x1c61b7(0x251)](',\x20');return undefined;}async[a33_0x494643(0x210)](_0xe41dba){const _0x56f03d=a33_0x494643,{args:_0x576456,options:_0x3ea515}=_0xe41dba,_0xa9b479=_0x3ea515[_0x56f03d(0x1fe)]||getActiveProfile(),[_0x3e9cff,..._0x394afd]=_0x576456[0x0]['split']('='),_0x4b8cf7=_0x394afd[_0x56f03d(0x251)]('=');console[_0x56f03d(0x248)](a33_0x90dc09[_0x56f03d(0x217)](_0x56f03d(0x230)));if(!profileExists(_0xa9b479)){const _0x3fdedf=await a33_0x5a5bd0({'type':_0x56f03d(0x247),'name':_0x56f03d(0x1f2),'message':_0x56f03d(0x22c)+_0xa9b479+_0x56f03d(0x1fa),'initial':!![]});if(!_0x3fdedf['create'])return console['log'](_0x56f03d(0x1f4)),0x1;}const _0x17df78=loadProfile(_0xa9b479),_0x39d786=_0x17df78?.[_0x56f03d(0x239)]||{};if(_0x3e9cff===_0x56f03d(0x23c)){const _0x4da30a=resolveSite(_0x4b8cf7);console['log'](_0x56f03d(0x211)+_0x4da30a+_0x56f03d(0x223)),console['log'](_0x56f03d(0x249)),console[_0x56f03d(0x248)]('\x20\x20'+getConsoleUrl(_0x4da30a,_0x56f03d(0x24b)));const _0x198494=await a33_0x5a5bd0({'type':_0x56f03d(0x20a),'name':_0x56f03d(0x244),'message':_0x56f03d(0x216),'validate':_0x116b17=>{const _0x540301=_0x56f03d;if(!_0x116b17||!_0x116b17[_0x540301(0x200)]())return _0x540301(0x1ff);return!![];}});if(!_0x198494['apiKey'])return console[_0x56f03d(0x248)](_0x56f03d(0x201)),0x1;console[_0x56f03d(0x248)](_0x56f03d(0x1fd));try{const _0x4f96a8=TDX[_0x56f03d(0x1f2)]({'site':_0x4da30a,'apiKey':_0x198494[_0x56f03d(0x244)]['trim'](),'logLevel':_0x3ea515[_0x56f03d(0x207)]??LogLevel['ERROR']}),_0x37584b=await _0x4f96a8[_0x56f03d(0x1f3)][_0x56f03d(0x237)]();console[_0x56f03d(0x248)](a33_0x90dc09[_0x56f03d(0x23a)]('✓')+_0x56f03d(0x21d)+_0x37584b[_0x56f03d(0x219)]+')');const _0xe89f1d=await isKeychainAvailable();_0xe89f1d?(await saveAPIKeyAsync(_0x198494['apiKey']['trim'](),_0x4da30a,_0xa9b479),console[_0x56f03d(0x248)](a33_0x90dc09[_0x56f03d(0x23a)]('✓')+_0x56f03d(0x20f))):console[_0x56f03d(0x1fc)](a33_0x90dc09[_0x56f03d(0x225)](_0x56f03d(0x208))),_0x39d786[_0x56f03d(0x23c)]=_0x4da30a;}catch(_0x35643f){if(_0x35643f instanceof HTTPClientError&&_0x35643f['status']===0x191)return printAuthError(_0x35643f),0x1;return console[_0x56f03d(0x24f)](a33_0x90dc09[_0x56f03d(0x22b)](_0x56f03d(0x233)+(_0x35643f instanceof Error?_0x35643f['message']:String(_0x35643f)))),console[_0x56f03d(0x24f)](_0x56f03d(0x228)),0x1;}}else _0x39d786[_0x3e9cff]=_0x4b8cf7||undefined;return saveProfileToUserConfig(_0xa9b479,_0x39d786),console[_0x56f03d(0x248)](a33_0x90dc09['green']('✓')+'\x20Profile\x20\x27'+_0xa9b479+_0x56f03d(0x227)+_0x3e9cff+'='+(_0x4b8cf7||'(cleared)')),0x0;}}function a33_0x334a(){const _0x21a353=['name','\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases','\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication','logLevel','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','VALID_KEYS','password','\x20API\x20key\x20saved\x20to\x20system\x20keychain\x20(profile:\x20','Set\x20session\x20profile','2473163xPHUFd','llm_project','\x20API\x20key\x20saved\x20to\x20system\x20keychain','execute','Changing\x20site\x20to\x20\x27','us01','Removed\x20existing\x20profile\x20\x27','\x0aAvailable\x20profiles:','\x27\x20does\x20not\x20exist.','Enter\x20your\x20TD\x20API\x20key\x20for\x20the\x20new\x20site:','bold','\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.','email','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20delete\x20<name>','all','2796AbAfQM','\x20API\x20key\x20is\x20valid\x20(User:\x20','\x20\x20(no\x20profiles\x20found)','1901880VeUUhy','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20use\x20<name>\x20[--default]','length','\x27\x20to\x20remove\x20it\x20first,\x20or\x20re-create\x20with\x20--force.','\x27\x20requires\x20API\x20key\x20validation.','profileName','yellow','Enter\x20profile\x20name:','\x27\x20updated:\x20','Site\x20was\x20not\x20changed.','You\x20can\x20now\x20use\x20tdx\x20commands\x20with\x20this\x20profile.\x20Try:','status','red','Profile\x20\x27','test','message','2812716mxTlag','tdx:\x20profile\x20set','\x0aTip:\x20Use\x20\x27tdx\x20profile\x20use\x20','123130TCaqlK','✗\x20Validation\x20failed:\x20','description','includes','text','getUserInfo','You\x20can\x20find\x20your\x20API\x20key\x20at:','config','green','llm_agent','site','Unknown\x20key\x20\x27','Profile\x20was\x20not\x20created.\x20Please\x20try\x20again.','\x20\x20tdx\x20--profile\x20','profile:create','1953tblsLr','Failed\x20to\x20delete\x20profile:\x20','\x20Profile\x20\x27','apiKey','profile:set','Create\x20a\x20new\x20profile','confirm','log','\x0aYou\x20can\x20find\x20your\x20API\x20key\x20at:','(session:\x20','/app/mp/ak','ERROR','Are\x20you\x20sure\x20you\x20want\x20to\x20remove\x20profile\x20\x27','\x20\x20-\x20','error','database','join','144UnDhAy','\x20--default\x27\x20to\x20save\x20permanently','parent_segment','oauth','validate','profile:delete','Enter\x20description\x20(optional):','35944bIjVKD','Default\x20profile\x20set\x20to:\x20','tdx:\x20profile\x20create','create','jobs','Operation\x20cancelled','tdx:\x20profile\x20delete','split','profile:use','\x27\x20created','dim','\x27\x20does\x20not\x20exist.\x20Create\x20it?','99299JFuafm','warn','Validating\x20API\x20key...','profile','API\x20key\x20cannot\x20be\x20empty','trim','\x0aOperation\x20cancelled','session','\x0aSetup\x20cancelled'];a33_0x334a=function(){return _0x21a353;};return a33_0x334a();}export class ProfileUseCommand extends BaseCommand{[a33_0x494643(0x204)]=a33_0x494643(0x1f7);[a33_0x494643(0x234)]=a33_0x494643(0x20c);[a33_0x494643(0x256)](_0x187676){const _0x12c2a9=a33_0x494643,{args:_0x412053}=_0x187676;if(_0x412053[_0x12c2a9(0x221)]===0x0)return _0x12c2a9(0x220);return undefined;}async[a33_0x494643(0x210)](_0x3ba7ce){const _0x37b13e=a33_0x494643,{args:_0x4e90e7,options:_0x30cbf3}=_0x3ba7ce,_0x331643=_0x4e90e7[0x0],_0x1b4838=_0x30cbf3['default'];cleanExpiredSessions();if(!profileExists(_0x331643)){console[_0x37b13e(0x24f)](a33_0x90dc09['red']('Profile\x20\x27'+_0x331643+_0x37b13e(0x215))),console['log'](_0x37b13e(0x214));const _0x3c3ae5=listProfiles();if(_0x3c3ae5[_0x37b13e(0x221)]===0x0)console['log'](_0x37b13e(0x21e));else for(const _0x2d7120 of _0x3c3ae5){console[_0x37b13e(0x248)](_0x37b13e(0x24e)+_0x2d7120[_0x37b13e(0x204)]);}return 0x1;}if(_0x1b4838){const _0x81b229=a33_0x475065[_0x37b13e(0x251)](getConfigDir(),'tdx.json');return saveActiveProfileToUserConfig(_0x331643),console[_0x37b13e(0x248)](_0x37b13e(0x25a)+a33_0x90dc09[_0x37b13e(0x23a)](_0x331643)),console[_0x37b13e(0x248)](a33_0x90dc09['dim']('\x0aSaved\x20to:\x20'+_0x81b229)),0x0;}const _0x212d68=getSessionID(_0x30cbf3['session']);return saveSessionContext({'profile':_0x331643},_0x30cbf3[_0x37b13e(0x202)]),console[_0x37b13e(0x248)]('Session\x20profile\x20set\x20to:\x20'+a33_0x90dc09[_0x37b13e(0x23a)](_0x331643)+'\x20'+a33_0x90dc09[_0x37b13e(0x1f9)](_0x37b13e(0x24a)+_0x212d68+')')),console[_0x37b13e(0x248)](a33_0x90dc09[_0x37b13e(0x1f9)](_0x37b13e(0x231)+_0x331643+_0x37b13e(0x253))),0x0;}}
1
+ const a33_0x46baad=a33_0x56b6;(function(_0x363fe7,_0x54e743){const _0x3c6f6d=a33_0x56b6,_0x3afe8c=_0x363fe7();while(!![]){try{const _0x1d6713=-parseInt(_0x3c6f6d(0x19e))/0x1+parseInt(_0x3c6f6d(0x187))/0x2*(-parseInt(_0x3c6f6d(0x1c8))/0x3)+-parseInt(_0x3c6f6d(0x180))/0x4*(-parseInt(_0x3c6f6d(0x169))/0x5)+parseInt(_0x3c6f6d(0x1ac))/0x6+parseInt(_0x3c6f6d(0x160))/0x7+parseInt(_0x3c6f6d(0x17e))/0x8+-parseInt(_0x3c6f6d(0x176))/0x9;if(_0x1d6713===_0x54e743)break;else _0x3afe8c['push'](_0x3afe8c['shift']());}catch(_0x2aab46){_0x3afe8c['push'](_0x3afe8c['shift']());}}}(a33_0x5bcc,0x88543));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_0x8848e0 from'node:path';import{saveSessionContext,getSessionID,cleanExpiredSessions}from'../core/session.js';import{saveAPIKeyAsync,resolveSite}from'../core/config.js';function a33_0x5bcc(){const _0x1456d5=['status','Profile\x20name\x20cannot\x20be\x20empty','Unknown\x20key\x20\x27','text','Changing\x20site\x20to\x20\x27','error','Default\x20profile\x20set\x20to:\x20','\x20\x20tdx\x20--profile\x20','password','Validating\x20API\x20key...','jobs','1263564kVWBWT','email','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20delete\x20<name>','profileName','\x27\x20deleted','green','/app/mp/ak','message','Removed\x20existing\x20profile\x20\x27','llm_agent','trim','confirm','✗\x20Validation\x20failed:\x20','Create\x20a\x20new\x20profile','profile','\x27\x20does\x20not\x20exist.\x20Create\x20it?','log','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>','llm_project','\x20\x20-\x20','\x27\x20requires\x20API\x20key\x20validation.','tdx.json','Profile\x20was\x20not\x20created.\x20Please\x20try\x20again.','Enter\x20description\x20(optional):','\x20--default\x27\x20to\x20save\x20permanently','execute','ERROR','Delete\x20a\x20profile','435uZXsJI','Session\x20profile\x20set\x20to:\x20','Set\x20session\x20profile','Are\x20you\x20sure\x20you\x20want\x20to\x20remove\x20profile\x20\x27','5891662lNtfvN','dim','site','profile:create','\x27.\x0a\x0aValid\x20keys:\x20','\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','\x27\x20updated:\x20','\x0aSaved\x20to:\x20','3580OYAmHg','Removal\x20cancelled','\x20\x20(no\x20profiles\x20found)','getUserInfo','Enter\x20your\x20TD\x20API\x20key:','\x0aSetting\x20up\x20authentication\x20for\x20site:\x20','\x27\x20already\x20exists.\x20Use\x20\x27tdx\x20profile\x20delete\x20','Site\x20was\x20not\x20changed.','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20use\x20<name>\x20[--default]','\x27\x20does\x20not\x20exist.','VALID_KEYS','test','us01','3047184BZafGh','description','tdx:\x20profile\x20create','(session:\x20','skipExistsCheck','parent_segment','red','Failed\x20to\x20delete\x20profile:\x20','7006528TgLVlY','yellow','2352jyVBrU','config','join','Profile\x20\x27','\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication','split','apiKey','13362mHaavk','profile:delete','\x20Profile\x20\x27','\x20API\x20key\x20is\x20valid\x20(User:\x20','name','\x0aYou\x20can\x20find\x20your\x20API\x20key\x20at:','database','session','\x0aSetup\x20cancelled','warn','\x20API\x20key\x20saved\x20to\x20system\x20keychain\x20(profile:\x20','\x0aOperation\x20cancelled','profile:use','Setup\x20cancelled','bold','default','includes','\x27\x20created','validate','Set\x20a\x20profile\x20configuration\x20value','length','create','\x27\x20to\x20remove\x20it\x20first,\x20or\x20re-create\x20with\x20--force.','483360ViOicN','API\x20key\x20cannot\x20be\x20empty','tdx:\x20profile\x20delete'];a33_0x5bcc=function(){return _0x1456d5;};return a33_0x5bcc();}import{getConsoleUrl}from'../sdk/client/endpoints.js';import{deleteKeychainAPIKey,isKeychainAvailable}from'../core/keychain.js';import{deleteOAuthTokens}from'../core/oauth-keychain.js';import{runOAuthLoginFlow,promptAuthMethod}from'./auth-command.js';import{promptSiteSelection}from'../core/constants.js';import{HTTPClientError}from'../sdk/client/http-client.js';import{TDX}from'../sdk/index.js';import{LogLevel}from'../utils/tdx-logger.js';import a33_0x2a197d from'prompts';import a33_0x24a915 from'chalk';function validateProfileName(_0x54f360,_0x3e01b1){const _0x480d25=a33_0x56b6;if(!_0x54f360||!_0x54f360[_0x480d25(0x1b6)]())return _0x480d25(0x1a2);const _0x3d8492=_0x54f360[_0x480d25(0x1b6)]();if(!/^[a-zA-Z0-9_-]+$/[_0x480d25(0x174)](_0x3d8492))return'Profile\x20name\x20must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore';if(!_0x3e01b1?.[_0x480d25(0x17a)]&&profileExists(_0x3d8492))return _0x480d25(0x183)+_0x3d8492+_0x480d25(0x16f)+_0x3d8492+_0x480d25(0x19d);return!![];}async function deleteProfileAndCredentials(_0x206e36){removeProfileFromUserConfig(_0x206e36);const _0x3d5f85=await isKeychainAvailable();_0x3d5f85&&await Promise['all']([deleteKeychainAPIKey(_0x206e36),deleteOAuthTokens(_0x206e36)]);}function a33_0x56b6(_0x597398,_0x45a5e6){_0x597398=_0x597398-0x15d;const _0x5bccc3=a33_0x5bcc();let _0x56b6fa=_0x5bccc3[_0x597398];return _0x56b6fa;}export class ProfileCreateCommand extends BaseCommand{[a33_0x46baad(0x18b)]=a33_0x46baad(0x163);[a33_0x46baad(0x177)]=a33_0x46baad(0x1b9);async[a33_0x46baad(0x1c5)](_0x305000){const _0x2aa1a1=a33_0x46baad,{options:_0x4b7dbe,args:_0x36eb89}=_0x305000,_0x3dbcce=!!_0x4b7dbe['force'];console[_0x2aa1a1(0x1bc)](a33_0x24a915['bold'](_0x2aa1a1(0x178)));let _0xa27881;if(_0x36eb89[_0x2aa1a1(0x19b)]>0x0&&_0x36eb89[0x0]){const _0x18a156=_0x36eb89[0x0][_0x2aa1a1(0x1b6)]();_0x3dbcce&&profileExists(_0x18a156)&&(await deleteProfileAndCredentials(_0x18a156),console[_0x2aa1a1(0x1bc)](_0x2aa1a1(0x1b4)+_0x18a156+'\x27'));const _0x45ff95=validateProfileName(_0x18a156);if(_0x45ff95!==!![])return console[_0x2aa1a1(0x1a6)](a33_0x24a915[_0x2aa1a1(0x17c)](_0x45ff95)),0x1;_0xa27881=_0x18a156;}else{const _0x49e891=await a33_0x2a197d({'type':_0x2aa1a1(0x1a4),'name':_0x2aa1a1(0x1af),'message':'Enter\x20profile\x20name:','validate':_0x34c5e9=>validateProfileName(_0x34c5e9,{'skipExistsCheck':_0x3dbcce})});if(!_0x49e891['profileName'])return console['log'](_0x2aa1a1(0x18f)),0x1;_0xa27881=_0x49e891[_0x2aa1a1(0x1af)][_0x2aa1a1(0x1b6)](),_0x3dbcce&&profileExists(_0xa27881)&&(await deleteProfileAndCredentials(_0xa27881),console['log'](_0x2aa1a1(0x1b4)+_0xa27881+'\x27'));}const _0x13c685=await a33_0x2a197d({'type':_0x2aa1a1(0x1a4),'name':'description','message':_0x2aa1a1(0x1c3)}),_0x3ec568=_0x13c685[_0x2aa1a1(0x177)]?.[_0x2aa1a1(0x1b6)]()||undefined,_0x5b2e2f=_0x4b7dbe[_0x2aa1a1(0x162)]||_0x2aa1a1(0x175),_0x2a3fbd=await promptSiteSelection(_0x5b2e2f,_0xa27881,_0x2aa1a1(0x194));if(!_0x2a3fbd)return 0x1;const _0x38064c=resolveSite(_0x2a3fbd),_0x24188d=await promptAuthMethod();if(!_0x24188d)return console['log'](_0x2aa1a1(0x18f)),0x1;if(_0x24188d==='oauth'){if(_0x3ec568){const _0x57d435={'site':_0x38064c,'description':_0x3ec568};saveProfileToUserConfig(_0xa27881,_0x57d435);}const {accountName:_0x2012f5}=_0x4b7dbe;return await runOAuthLoginFlow(_0x38064c,_0xa27881,_0x4b7dbe['logLevel']??LogLevel[_0x2aa1a1(0x1c6)],{'accountName':_0x2012f5}),0x0;}console[_0x2aa1a1(0x1bc)](_0x2aa1a1(0x16e)+_0x38064c),console[_0x2aa1a1(0x1bc)]('You\x20can\x20find\x20your\x20API\x20key\x20at:'),console[_0x2aa1a1(0x1bc)]('\x20\x20'+getConsoleUrl(_0x38064c,_0x2aa1a1(0x1b2)));const _0x1974cd=await a33_0x2a197d({'type':_0x2aa1a1(0x1a9),'name':_0x2aa1a1(0x186),'message':_0x2aa1a1(0x16d),'validate':_0x41ab8d=>{const _0x61db5e=_0x2aa1a1;if(!_0x41ab8d||!_0x41ab8d[_0x61db5e(0x1b6)]())return _0x61db5e(0x19f);return!![];}});if(!_0x1974cd[_0x2aa1a1(0x186)])return console['log'](_0x2aa1a1(0x18f)),0x1;const _0x1ea30b=_0x1974cd[_0x2aa1a1(0x186)];console[_0x2aa1a1(0x1bc)](_0x2aa1a1(0x1aa));try{const _0x66f7fc=TDX[_0x2aa1a1(0x19c)]({'site':_0x38064c,'apiKey':_0x1ea30b[_0x2aa1a1(0x1b6)](),'logLevel':_0x4b7dbe['logLevel']??LogLevel['ERROR']}),_0x5c991f=await _0x66f7fc[_0x2aa1a1(0x1ab)][_0x2aa1a1(0x16c)]();console[_0x2aa1a1(0x1bc)](a33_0x24a915[_0x2aa1a1(0x1b1)]('✓')+_0x2aa1a1(0x18a)+_0x5c991f[_0x2aa1a1(0x1ad)]+')');const _0xc569db=await isKeychainAvailable();_0xc569db?(await saveAPIKeyAsync(_0x1ea30b[_0x2aa1a1(0x1b6)](),_0x38064c,_0xa27881),console[_0x2aa1a1(0x1bc)](a33_0x24a915[_0x2aa1a1(0x1b1)]('✓')+_0x2aa1a1(0x191)+_0xa27881+')')):(console['warn'](a33_0x24a915[_0x2aa1a1(0x17f)](_0x2aa1a1(0x166))),console[_0x2aa1a1(0x190)](a33_0x24a915[_0x2aa1a1(0x17f)](_0x2aa1a1(0x165))));const _0x102c5d={'site':_0x38064c,..._0x3ec568&&{'description':_0x3ec568}};return saveProfileToUserConfig(_0xa27881,_0x102c5d),console[_0x2aa1a1(0x1bc)](a33_0x24a915[_0x2aa1a1(0x1b1)]('✓')+'\x20Profile\x20\x27'+_0xa27881+_0x2aa1a1(0x198)),console[_0x2aa1a1(0x1bc)](),console[_0x2aa1a1(0x1bc)]('You\x20can\x20now\x20use\x20tdx\x20commands\x20with\x20this\x20profile.\x20Try:'),console['log'](_0x2aa1a1(0x1a8)+_0xa27881+_0x2aa1a1(0x184)),console['log'](_0x2aa1a1(0x1a8)+_0xa27881+'\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases'),0x0;}catch(_0x591185){if(_0x591185 instanceof HTTPClientError&&_0x591185[_0x2aa1a1(0x1a1)]===0x191)return printAuthError(_0x591185),0x1;return console['error'](a33_0x24a915['red'](_0x2aa1a1(0x1b8)+(_0x591185 instanceof Error?_0x591185[_0x2aa1a1(0x1b3)]:String(_0x591185)))),console[_0x2aa1a1(0x1a6)](_0x2aa1a1(0x1c2)),0x1;}}}export class ProfileDeleteCommand extends BaseCommand{[a33_0x46baad(0x18b)]=a33_0x46baad(0x188);['description']=a33_0x46baad(0x1c7);['validate'](_0xbe5375){const _0x450480=a33_0x46baad,{args:_0x338d3b}=_0xbe5375;if(_0x338d3b[_0x450480(0x19b)]===0x0)return _0x450480(0x1ae);return undefined;}async[a33_0x46baad(0x1c5)](_0x336d65){const _0x97dc23=a33_0x46baad,{args:_0x390b4a}=_0x336d65,_0x499351=_0x390b4a[0x0];console[_0x97dc23(0x1bc)](a33_0x24a915[_0x97dc23(0x195)](_0x97dc23(0x1a0)));if(!profileExists(_0x499351)){console[_0x97dc23(0x1a6)](a33_0x24a915[_0x97dc23(0x17c)]('Profile\x20\x27'+_0x499351+'\x27\x20does\x20not\x20exist.')),console[_0x97dc23(0x1bc)]('\x0aAvailable\x20profiles:');const _0x22c425=listProfiles();if(_0x22c425[_0x97dc23(0x19b)]===0x0)console['log'](_0x97dc23(0x16b));else for(const _0x195bf4 of _0x22c425){console[_0x97dc23(0x1bc)](_0x97dc23(0x1bf)+_0x195bf4[_0x97dc23(0x18b)]);}return 0x1;}const _0x189f02=await a33_0x2a197d({'type':_0x97dc23(0x1b7),'name':_0x97dc23(0x1b7),'message':_0x97dc23(0x15f)+_0x499351+'\x27?','initial':![]});if(!_0x189f02['confirm'])return console[_0x97dc23(0x1bc)](_0x97dc23(0x16a)),0x0;try{await deleteProfileAndCredentials(_0x499351),console[_0x97dc23(0x1bc)](a33_0x24a915[_0x97dc23(0x1b1)]('✓')+_0x97dc23(0x189)+_0x499351+_0x97dc23(0x1b0));}catch(_0x579a9b){return console[_0x97dc23(0x1a6)](a33_0x24a915['red'](_0x97dc23(0x17d)+(_0x579a9b instanceof Error?_0x579a9b[_0x97dc23(0x1b3)]:String(_0x579a9b)))),0x1;}return 0x0;}}export class ProfileSetCommand extends BaseCommand{[a33_0x46baad(0x18b)]='profile:set';[a33_0x46baad(0x177)]=a33_0x46baad(0x19a);static [a33_0x46baad(0x173)]=[a33_0x46baad(0x162),a33_0x46baad(0x18d),a33_0x46baad(0x17b),a33_0x46baad(0x1be),a33_0x46baad(0x1b5),a33_0x46baad(0x177)];[a33_0x46baad(0x199)](_0x3151a4){const _0x3357d=a33_0x46baad,{args:_0x3b6442,options:_0x110029}=_0x3151a4,_0x1c78d8=_0x110029[_0x3357d(0x1ba)]||getActiveProfile();if(!_0x1c78d8)return _0x3357d(0x1bd);if(_0x3b6442[_0x3357d(0x19b)]===0x0)return'Key=value\x20pair\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20'+ProfileSetCommand[_0x3357d(0x173)][_0x3357d(0x182)](',\x20');const _0x377903=_0x3b6442[0x0];if(!_0x377903[_0x3357d(0x197)]('='))return'Invalid\x20format.\x20Use:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20'+ProfileSetCommand['VALID_KEYS']['join'](',\x20');const [_0x11b8fc]=_0x377903[_0x3357d(0x185)]('=',0x2);if(!ProfileSetCommand[_0x3357d(0x173)][_0x3357d(0x197)](_0x11b8fc))return _0x3357d(0x1a3)+_0x11b8fc+_0x3357d(0x164)+ProfileSetCommand[_0x3357d(0x173)][_0x3357d(0x182)](',\x20');return undefined;}async[a33_0x46baad(0x1c5)](_0x23c31b){const _0x70e88b=a33_0x46baad,{args:_0x95b05,options:_0x241831}=_0x23c31b,_0x48f8e9=_0x241831[_0x70e88b(0x1ba)]||getActiveProfile(),[_0x333b09,..._0x5bb0fe]=_0x95b05[0x0][_0x70e88b(0x185)]('='),_0x5750f5=_0x5bb0fe[_0x70e88b(0x182)]('=');console[_0x70e88b(0x1bc)](a33_0x24a915[_0x70e88b(0x195)]('tdx:\x20profile\x20set'));if(!profileExists(_0x48f8e9)){const _0x128bfe=await a33_0x2a197d({'type':_0x70e88b(0x1b7),'name':'create','message':_0x70e88b(0x183)+_0x48f8e9+_0x70e88b(0x1bb),'initial':!![]});if(!_0x128bfe[_0x70e88b(0x19c)])return console[_0x70e88b(0x1bc)]('Operation\x20cancelled'),0x1;}const _0x2ede5b=loadProfile(_0x48f8e9),_0x7a425a=_0x2ede5b?.[_0x70e88b(0x181)]||{};if(_0x333b09===_0x70e88b(0x162)){const _0x440be6=resolveSite(_0x5750f5);console[_0x70e88b(0x1bc)](_0x70e88b(0x1a5)+_0x440be6+_0x70e88b(0x1c0)),console[_0x70e88b(0x1bc)](_0x70e88b(0x18c)),console[_0x70e88b(0x1bc)]('\x20\x20'+getConsoleUrl(_0x440be6,_0x70e88b(0x1b2)));const _0x58eded=await a33_0x2a197d({'type':_0x70e88b(0x1a9),'name':_0x70e88b(0x186),'message':'Enter\x20your\x20TD\x20API\x20key\x20for\x20the\x20new\x20site:','validate':_0x29ae01=>{const _0x2d05ad=_0x70e88b;if(!_0x29ae01||!_0x29ae01[_0x2d05ad(0x1b6)]())return'API\x20key\x20cannot\x20be\x20empty';return!![];}});if(!_0x58eded[_0x70e88b(0x186)])return console[_0x70e88b(0x1bc)](_0x70e88b(0x192)),0x1;console['log'](_0x70e88b(0x1aa));try{const _0x330425=TDX[_0x70e88b(0x19c)]({'site':_0x440be6,'apiKey':_0x58eded[_0x70e88b(0x186)][_0x70e88b(0x1b6)](),'logLevel':_0x241831['logLevel']??LogLevel[_0x70e88b(0x1c6)]}),_0xcd5c62=await _0x330425[_0x70e88b(0x1ab)][_0x70e88b(0x16c)]();console[_0x70e88b(0x1bc)](a33_0x24a915[_0x70e88b(0x1b1)]('✓')+_0x70e88b(0x18a)+_0xcd5c62[_0x70e88b(0x1ad)]+')');const _0x1c9539=await isKeychainAvailable();_0x1c9539?(await saveAPIKeyAsync(_0x58eded['apiKey'][_0x70e88b(0x1b6)](),_0x440be6,_0x48f8e9),console[_0x70e88b(0x1bc)](a33_0x24a915[_0x70e88b(0x1b1)]('✓')+'\x20API\x20key\x20saved\x20to\x20system\x20keychain')):console[_0x70e88b(0x190)](a33_0x24a915[_0x70e88b(0x17f)](_0x70e88b(0x166))),_0x7a425a[_0x70e88b(0x162)]=_0x440be6;}catch(_0x190deb){if(_0x190deb instanceof HTTPClientError&&_0x190deb[_0x70e88b(0x1a1)]===0x191)return printAuthError(_0x190deb),0x1;return console['error'](a33_0x24a915[_0x70e88b(0x17c)](_0x70e88b(0x1b8)+(_0x190deb instanceof Error?_0x190deb[_0x70e88b(0x1b3)]:String(_0x190deb)))),console[_0x70e88b(0x1a6)](_0x70e88b(0x170)),0x1;}}else _0x7a425a[_0x333b09]=_0x5750f5||undefined;return saveProfileToUserConfig(_0x48f8e9,_0x7a425a),console['log'](a33_0x24a915[_0x70e88b(0x1b1)]('✓')+_0x70e88b(0x189)+_0x48f8e9+_0x70e88b(0x167)+_0x333b09+'='+(_0x5750f5||'(cleared)')),0x0;}}export class ProfileUseCommand extends BaseCommand{[a33_0x46baad(0x18b)]=a33_0x46baad(0x193);[a33_0x46baad(0x177)]=a33_0x46baad(0x15e);[a33_0x46baad(0x199)](_0x40b2c3){const _0x1eeb8f=a33_0x46baad,{args:_0xd8a76b}=_0x40b2c3;if(_0xd8a76b[_0x1eeb8f(0x19b)]===0x0)return _0x1eeb8f(0x171);return undefined;}async['execute'](_0x4814b9){const _0xf4967c=a33_0x46baad,{args:_0x1ef3b1,options:_0x1c1f96}=_0x4814b9,_0x141efc=_0x1ef3b1[0x0],_0x3e386a=_0x1c1f96[_0xf4967c(0x196)];cleanExpiredSessions();if(!profileExists(_0x141efc)){console[_0xf4967c(0x1a6)](a33_0x24a915[_0xf4967c(0x17c)](_0xf4967c(0x183)+_0x141efc+_0xf4967c(0x172))),console[_0xf4967c(0x1bc)]('\x0aAvailable\x20profiles:');const _0x5f54cf=listProfiles();if(_0x5f54cf['length']===0x0)console[_0xf4967c(0x1bc)](_0xf4967c(0x16b));else for(const _0x31bb58 of _0x5f54cf){console[_0xf4967c(0x1bc)](_0xf4967c(0x1bf)+_0x31bb58['name']);}return 0x1;}if(_0x3e386a){const _0x48dcbb=a33_0x8848e0[_0xf4967c(0x182)](getConfigDir(),_0xf4967c(0x1c1));return saveActiveProfileToUserConfig(_0x141efc),console[_0xf4967c(0x1bc)](_0xf4967c(0x1a7)+a33_0x24a915[_0xf4967c(0x1b1)](_0x141efc)),console['log'](a33_0x24a915[_0xf4967c(0x161)](_0xf4967c(0x168)+_0x48dcbb)),0x0;}const _0x338912=getSessionID(_0x1c1f96[_0xf4967c(0x18e)]);return saveSessionContext({'profile':_0x141efc},_0x1c1f96[_0xf4967c(0x18e)]),console[_0xf4967c(0x1bc)](_0xf4967c(0x15d)+a33_0x24a915[_0xf4967c(0x1b1)](_0x141efc)+'\x20'+a33_0x24a915[_0xf4967c(0x161)](_0xf4967c(0x179)+_0x338912+')')),console[_0xf4967c(0x1bc)](a33_0x24a915[_0xf4967c(0x161)]('\x0aTip:\x20Use\x20\x27tdx\x20profile\x20use\x20'+_0x141efc+_0xf4967c(0x1c4))),0x0;}}
@@ -1 +1 @@
1
- const a34_0x1df6fe=a34_0x4996;(function(_0x3df292,_0x5c5553){const _0x3e48da=a34_0x4996,_0x4a95d9=_0x3df292();while(!![]){try{const _0x34fca0=parseInt(_0x3e48da(0x150))/0x1*(-parseInt(_0x3e48da(0x152))/0x2)+parseInt(_0x3e48da(0x154))/0x3*(parseInt(_0x3e48da(0x155))/0x4)+parseInt(_0x3e48da(0x141))/0x5*(-parseInt(_0x3e48da(0x146))/0x6)+-parseInt(_0x3e48da(0x14b))/0x7*(-parseInt(_0x3e48da(0x14f))/0x8)+parseInt(_0x3e48da(0x149))/0x9*(-parseInt(_0x3e48da(0x15c))/0xa)+-parseInt(_0x3e48da(0x157))/0xb*(parseInt(_0x3e48da(0x14d))/0xc)+parseInt(_0x3e48da(0x151))/0xd;if(_0x34fca0===_0x5c5553)break;else _0x4a95d9['push'](_0x4a95d9['shift']());}catch(_0x47823c){_0x4a95d9['push'](_0x4a95d9['shift']());}}}(a34_0x3848,0xdd2ba));import{BaseCommand}from'./command.js';import{listProfiles,getActiveProfile,getProfileParams}from'../core/profile.js';import{handleSDKOutput,isStructuredFormat}from'../core/command-output.js';function a34_0x3848(){const _0x2c51e2=['24aadgIp','error','64tmusUA','1828ilIwzv','22536631QFNryB','766YipWxS','\x20\x20Global:\x20~/.config/tdx/tdx.json','27858VasgGf','216kRStsu','message','5032841kRwRjp','List\x20all\x20available\x20profiles','dim','name','Error:\x20','930220rdnYjl','profiles','5FBsBKR','log','\x20\x20Local:\x20\x20(project\x20folder)/tdx.json','config','No\x20profiles\x20found.\x20Define\x20profiles\x20in\x20tdx.json:\x0a','5447646OHLgRp','map','description','9qMOJgH','site','1126153HlgEKM','green'];a34_0x3848=function(){return _0x2c51e2;};return a34_0x3848();}import a34_0x398dfe from'chalk';function a34_0x4996(_0x24d597,_0x36a401){_0x24d597=_0x24d597-0x141;const _0x384816=a34_0x3848();let _0x4996da=_0x384816[_0x24d597];return _0x4996da;}export class ProfilesCommand extends BaseCommand{[a34_0x1df6fe(0x15a)]=a34_0x1df6fe(0x15d);[a34_0x1df6fe(0x148)]=a34_0x1df6fe(0x158);async['execute'](_0x2756e9){const _0x4bca0a=a34_0x1df6fe,{options:_0x445d2d}=_0x2756e9;try{const _0x46e1ec=listProfiles(),_0x21d43e=getActiveProfile();if(_0x46e1ec['length']===0x0)return console[_0x4bca0a(0x142)](_0x4bca0a(0x145)),console[_0x4bca0a(0x142)](_0x4bca0a(0x143)),console['log'](_0x4bca0a(0x153)),0x0;const _0x345f71=_0x46e1ec[_0x4bca0a(0x147)](_0x1264e9=>{const _0x38ea7f=_0x4bca0a,_0x82b024=_0x1264e9[_0x38ea7f(0x15a)]===_0x21d43e,_0x560ef9=getProfileParams(_0x1264e9[_0x38ea7f(0x144)]);return{'name':_0x1264e9[_0x38ea7f(0x15a)],'active':_0x82b024,'scope':_0x1264e9['scope'],'description':_0x1264e9[_0x38ea7f(0x144)][_0x38ea7f(0x148)]||'','params':_0x560ef9};});if(isStructuredFormat(_0x445d2d))await handleSDKOutput(_0x345f71,_0x445d2d);else for(const _0x53a226 of _0x46e1ec){const _0x1193d5=_0x53a226['name']===_0x21d43e?a34_0x398dfe[_0x4bca0a(0x14c)]('\x20✓'):'',_0x4232e4=_0x53a226[_0x4bca0a(0x144)][_0x4bca0a(0x14a)]?a34_0x398dfe[_0x4bca0a(0x159)]('\x20'+_0x53a226['config'][_0x4bca0a(0x14a)]):'',_0x2e51c5=_0x53a226[_0x4bca0a(0x144)][_0x4bca0a(0x148)]?a34_0x398dfe[_0x4bca0a(0x159)]('\x20\x20'+_0x53a226[_0x4bca0a(0x144)]['description']):'';console[_0x4bca0a(0x142)]('👤\x20'+_0x53a226[_0x4bca0a(0x15a)]+_0x1193d5+_0x4232e4+_0x2e51c5);}return 0x0;}catch(_0x5081a6){return _0x5081a6 instanceof Error&&console[_0x4bca0a(0x14e)](_0x4bca0a(0x15b)+_0x5081a6[_0x4bca0a(0x156)]),0x1;}}}
1
+ const a34_0x59340f=a34_0x6818;(function(_0x5aa265,_0x3a212c){const _0xf6a773=a34_0x6818,_0x10c6ec=_0x5aa265();while(!![]){try{const _0x2910f6=parseInt(_0xf6a773(0x18e))/0x1+-parseInt(_0xf6a773(0x198))/0x2+parseInt(_0xf6a773(0x194))/0x3+parseInt(_0xf6a773(0x189))/0x4+-parseInt(_0xf6a773(0x197))/0x5+-parseInt(_0xf6a773(0x195))/0x6+-parseInt(_0xf6a773(0x18f))/0x7*(-parseInt(_0xf6a773(0x196))/0x8);if(_0x2910f6===_0x3a212c)break;else _0x10c6ec['push'](_0x10c6ec['shift']());}catch(_0x31d7ca){_0x10c6ec['push'](_0x10c6ec['shift']());}}}(a34_0x2765,0x86d1c));import{BaseCommand}from'./command.js';import{listProfiles,getActiveProfile,getProfileParams}from'../core/profile.js';import{handleSDKOutput,isStructuredFormat}from'../core/command-output.js';import a34_0x35c943 from'chalk';function a34_0x2765(){const _0x2dde02=['7dBHNaG','scope','👤\x20','site','message','2366664WtyiDH','5936988dchZmZ','3143128vMwThQ','4237635eNNXhB','369572MbPZsx','No\x20profiles\x20found.\x20Define\x20profiles\x20in\x20tdx.json:\x0a','dim','error','\x20\x20Local:\x20\x20(project\x20folder)/tdx.json','name','Error:\x20','execute','3514816cjWUgx','config','List\x20all\x20available\x20profiles','description','map','513548bjgqtq'];a34_0x2765=function(){return _0x2dde02;};return a34_0x2765();}function a34_0x6818(_0x3c89a9,_0x128b4a){_0x3c89a9=_0x3c89a9-0x182;const _0x276555=a34_0x2765();let _0x68184b=_0x276555[_0x3c89a9];return _0x68184b;}export class ProfilesCommand extends BaseCommand{[a34_0x59340f(0x186)]='profiles';['description']=a34_0x59340f(0x18b);async[a34_0x59340f(0x188)](_0x185a7e){const _0x4bba6e=a34_0x59340f,{options:_0x4da223}=_0x185a7e;try{const _0x504b0d=listProfiles(),_0x164234=getActiveProfile();if(_0x504b0d['length']===0x0)return console['log'](_0x4bba6e(0x182)),console['log'](_0x4bba6e(0x185)),console['log']('\x20\x20Global:\x20~/.config/tdx/tdx.json'),0x0;const _0x2032da=_0x504b0d[_0x4bba6e(0x18d)](_0x52326d=>{const _0x2cd1e2=_0x4bba6e,_0x5ce3c1=_0x52326d[_0x2cd1e2(0x186)]===_0x164234,_0x677804=getProfileParams(_0x52326d[_0x2cd1e2(0x18a)]);return{'name':_0x52326d[_0x2cd1e2(0x186)],'active':_0x5ce3c1,'scope':_0x52326d[_0x2cd1e2(0x190)],'description':_0x52326d[_0x2cd1e2(0x18a)][_0x2cd1e2(0x18c)]||'','params':_0x677804};});if(isStructuredFormat(_0x4da223))await handleSDKOutput(_0x2032da,_0x4da223);else for(const _0xdd73ec of _0x504b0d){const _0x1eb5dd=_0xdd73ec[_0x4bba6e(0x186)]===_0x164234?a34_0x35c943['green']('\x20✓'):'',_0x416223=_0xdd73ec[_0x4bba6e(0x18a)]['site']?a34_0x35c943[_0x4bba6e(0x183)]('\x20'+_0xdd73ec['config'][_0x4bba6e(0x192)]):'',_0x2afb04=_0xdd73ec[_0x4bba6e(0x18a)][_0x4bba6e(0x18c)]?a34_0x35c943[_0x4bba6e(0x183)]('\x20\x20'+_0xdd73ec[_0x4bba6e(0x18a)][_0x4bba6e(0x18c)]):'';console['log'](_0x4bba6e(0x191)+_0xdd73ec[_0x4bba6e(0x186)]+_0x1eb5dd+_0x416223+_0x2afb04);}return 0x0;}catch(_0x116118){return _0x116118 instanceof Error&&console[_0x4bba6e(0x184)](_0x4bba6e(0x187)+_0x116118[_0x4bba6e(0x193)]),0x1;}}}
@@ -1 +1 @@
1
- const a35_0xf937c7=a35_0x526d;function a35_0x526d(_0x355c7f,_0x4af851){_0x355c7f=_0x355c7f-0x78;const _0xbc2fe5=a35_0xbc2f();let _0x526da3=_0xbc2fe5[_0x355c7f];return _0x526da3;}(function(_0x136e96,_0x24e227){const _0x1867f2=a35_0x526d,_0x55379d=_0x136e96();while(!![]){try{const _0x505c0c=parseInt(_0x1867f2(0x92))/0x1+-parseInt(_0x1867f2(0x7e))/0x2*(-parseInt(_0x1867f2(0x7b))/0x3)+-parseInt(_0x1867f2(0x80))/0x4+parseInt(_0x1867f2(0x8d))/0x5*(parseInt(_0x1867f2(0x9b))/0x6)+-parseInt(_0x1867f2(0x82))/0x7+-parseInt(_0x1867f2(0x8b))/0x8*(-parseInt(_0x1867f2(0x8c))/0x9)+parseInt(_0x1867f2(0x99))/0xa*(-parseInt(_0x1867f2(0x8a))/0xb);if(_0x505c0c===_0x24e227)break;else _0x55379d['push'](_0x55379d['shift']());}catch(_0x659aec){_0x55379d['push'](_0x55379d['shift']());}}}(a35_0xbc2f,0xdaa5e));import{BaseCommand}from'./command.js';function a35_0xbc2f(){const _0x813bb1=['options','Schema:\x20','894486uAVTwg','description','2754516jmwQtz','data','10181416raajqz','push','catalog','Query\x20completed:\x20Processed\x20','setJobId','output','...','originalMessage','528dOWKnu','3656KWgtBf','21330iSzgfq','2732910dfFbLe','setPhase','SQL:\x20','Cannot\x20specify\x20both\x20SQL\x20argument\x20and\x20--file\x20option','Statement\x20','134513esuQts','join','state','length','stats','totalSplits','query','221050dkrNSr','\x0aAll\x20results\x20saved\x20to\x20','12hQHfXA','No\x20SQL\x20provided','Error:\x20','verbose','Usage:\x20tdx\x20query\x20\x22SELECT\x20*\x20FROM\x20table\x22\x0a\x20\x20\x20or:\x20tdx\x20query\x20query.sql\x0a\x20\x20\x20or:\x20echo\x20\x22SELECT\x201\x22\x20|\x20tdx\x20query\x20-\x0a\x0aRun\x20\x27tdx\x20query\x20--help\x27\x20for\x20more\x20options','error','in\x20','message','elapsedTimeMillis','file','\x20-\x20','Run\x20Trino\x20queries\x20(streaming)','name','information_schema','\x20rows\x20','setExtra','processedRows','12zqxmpk'];a35_0xbc2f=function(){return _0x813bb1;};return a35_0xbc2f();}import{SDKError}from'../sdk/index.js';import{handleQueryOutput,formatQueryOutput,resolveOutputOptions}from'../core/command-output.js';import{readSqlStatementsFromFile,readSqlStatementsFromStdin,splitSqlStatements,isSqlFilePath}from'../sdk/query/sql-parser.js';import{writeFileSync}from'fs';import{withProgressSpinner,formatElapsed}from'../utils/spinner.js';import{formatRows}from'../sdk/util/formatters.js';export class QueryCommand extends BaseCommand{[a35_0xf937c7(0xa7)]=a35_0xf937c7(0x98);[a35_0xf937c7(0x7f)]=a35_0xf937c7(0xa6);async['execute'](_0x375610){const _0x4d2077=a35_0xf937c7,{options:_0x11a2e6,args:_0x4846cc,tdx:_0x26cd59}=_0x375610,_0x36bffe={..._0x11a2e6,'limitStructuredFormats':!![]},_0x8c849=_0x4846cc[0x0],_0x38e71f=_0x11a2e6[_0x4d2077(0xa4)];let _0x251ec8;try{if(_0x38e71f)_0x251ec8=readSqlStatementsFromFile(_0x38e71f);else{if(_0x8c849==='-')_0x251ec8=await readSqlStatementsFromStdin();else{if(_0x8c849&&isSqlFilePath(_0x8c849))_0x251ec8=readSqlStatementsFromFile(_0x8c849);else{if(_0x8c849)_0x251ec8=splitSqlStatements(_0x8c849);else throw new Error(_0x4d2077(0x9c));}}}}catch(_0x2dbe8d){return console[_0x4d2077(0xa0)](_0x4d2077(0x9d)+_0x2dbe8d['message']),0x1;}const _0xa4726c=_0x11a2e6['database']||_0x4d2077(0xa8),_0x596244=_0x11a2e6[_0x4d2077(0x84)];try{const _0x2287b4=[],_0x34387a=!!_0x11a2e6[_0x4d2077(0x87)];for(let _0x3761dc=0x0;_0x3761dc<_0x251ec8[_0x4d2077(0x95)];_0x3761dc++){const _0x430372=_0x251ec8[_0x3761dc],_0x500d1f=_0x3761dc+0x1,_0x3f6194=_0x251ec8[_0x4d2077(0x95)],_0x2c03fe=_0x3f6194>0x1;_0x11a2e6['verbose']&&(console[_0x4d2077(0xa0)]('\x0a'+(_0x2c03fe?_0x4d2077(0x91)+_0x500d1f+'/'+_0x3f6194+':':'')),console[_0x4d2077(0xa0)]('Site:\x20'+_0x11a2e6['site']),console[_0x4d2077(0xa0)]('Catalog:\x20'+(_0x596244||'td')),console[_0x4d2077(0xa0)](_0x4d2077(0x7d)+_0xa4726c),console[_0x4d2077(0xa0)](_0x4d2077(0x8f)+_0x430372));const _0x508e07=_0x2c03fe?'Executing\x20statement\x20'+_0x500d1f+'/'+_0x3f6194+_0x4d2077(0x88):'Executing\x20query...';try{const _0x5caa44=await withProgressSpinner(_0x508e07,async _0x2e6659=>{const _0x38645e=await _0x26cd59['query']['execute'](_0x430372,{'catalog':_0x596244,'schema':_0xa4726c,'onJobId':_0x3f9bc8=>{const _0x171a82=a35_0x526d;_0x2e6659[_0x171a82(0x86)](_0x3f9bc8);},'onProgress':_0x3aa09d=>{const _0x49e73b=a35_0x526d;_0x2e6659[_0x49e73b(0x8e)]('Executing\x20query\x20['+_0x3aa09d[_0x49e73b(0x94)]+']'),_0x2e6659[_0x49e73b(0x79)](formatRows(_0x3aa09d[_0x49e73b(0x7a)])+_0x49e73b(0x78)+_0x3aa09d['completedSplits']+'/'+_0x3aa09d[_0x49e73b(0x97)]+'\x20splits');}});return _0x38645e;},{'verbose':_0x11a2e6[_0x4d2077(0x9e)]}),_0x40443d=_0x5caa44[_0x4d2077(0x81)],_0x528a17=_0x40443d['jobId']?'\x20[Job\x20ID:\x20'+_0x40443d['jobId']+']':'',_0x50648d=_0x2c03fe?'Statement\x20'+_0x500d1f+'/'+_0x3f6194+_0x4d2077(0xa5):'';console[_0x4d2077(0xa0)]('✔\x20'+_0x50648d+_0x4d2077(0x85)+formatRows(_0x40443d[_0x4d2077(0x96)][_0x4d2077(0x7a)])+'\x20rows\x20'+(_0x4d2077(0xa1)+formatElapsed(_0x40443d[_0x4d2077(0x96)][_0x4d2077(0xa3)])+_0x528a17));if(_0x2c03fe&&_0x34387a){const _0x4247db=resolveOutputOptions(_0x36bffe),_0xab848a=await formatQueryOutput(_0x40443d,_0x4247db);_0x2287b4[_0x4d2077(0x83)](_0xab848a);}else await handleQueryOutput(_0x40443d,_0x36bffe);}catch(_0x3609d1){const _0x812b3d=_0x2c03fe?'Statement\x20'+_0x500d1f+'/'+_0x3f6194+':\x0a':'',_0x117333=_0x3609d1 instanceof SDKError?_0x3609d1[_0x4d2077(0x89)]:_0x3609d1[_0x4d2077(0xa2)];return console['error'](''+_0x812b3d+_0x117333),0x1;}}if(_0x251ec8[_0x4d2077(0x95)]>0x1&&_0x34387a&&_0x2287b4[_0x4d2077(0x95)]>0x0){const _0x5d0074=_0x2287b4[_0x4d2077(0x93)]('\x0a');writeFileSync(_0x11a2e6['output'],_0x5d0074),console['error'](_0x4d2077(0x9a)+_0x11a2e6['output']);}return 0x0;}catch(_0x1953d7){throw _0x1953d7;}}['validate'](_0xae2fb4){const _0x25c908=a35_0xf937c7,_0x226471=_0xae2fb4['args'][0x0],_0x5c97ef=_0xae2fb4[_0x25c908(0x7c)][_0x25c908(0xa4)];if(!_0x226471&&!_0x5c97ef)return _0x25c908(0x9f);if(_0x226471&&_0x5c97ef)return _0x25c908(0x90);return undefined;}}
1
+ const a35_0x42b657=a35_0x1d99;function a35_0x1d99(_0x47bf9c,_0x9b7c8c){_0x47bf9c=_0x47bf9c-0x146;const _0x8f8c87=a35_0x8f8c();let _0x1d9901=_0x8f8c87[_0x47bf9c];return _0x1d9901;}(function(_0x264185,_0x12234b){const _0x8b537c=a35_0x1d99,_0x4ff3b2=_0x264185();while(!![]){try{const _0x2bfbfb=parseInt(_0x8b537c(0x15f))/0x1*(-parseInt(_0x8b537c(0x166))/0x2)+parseInt(_0x8b537c(0x177))/0x3+parseInt(_0x8b537c(0x172))/0x4+parseInt(_0x8b537c(0x16f))/0x5+-parseInt(_0x8b537c(0x164))/0x6+-parseInt(_0x8b537c(0x160))/0x7*(parseInt(_0x8b537c(0x175))/0x8)+-parseInt(_0x8b537c(0x147))/0x9;if(_0x2bfbfb===_0x12234b)break;else _0x4ff3b2['push'](_0x4ff3b2['shift']());}catch(_0x4a457f){_0x4ff3b2['push'](_0x4ff3b2['shift']());}}}(a35_0x8f8c,0x88206));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';import{handleQueryOutput,formatQueryOutput,resolveOutputOptions}from'../core/command-output.js';import{readSqlStatementsFromFile,readSqlStatementsFromStdin,splitSqlStatements,isSqlFilePath}from'../sdk/query/sql-parser.js';import{writeFileSync}from'fs';function a35_0x8f8c(){const _0x44994b=['in\x20','length','2796594CLkLur','message','20422hEMtHI','Query\x20completed:\x20Processed\x20','Statement\x20','setExtra','Executing\x20query...','information_schema','data','No\x20SQL\x20provided','verbose','3576990AObUuy','originalMessage','database','2754028RkxEjL','elapsedTimeMillis','\x20[Job\x20ID:\x20','88DhuxaW','file','2463747AMwFkP','output','8418645CqBcuB','\x20rows\x20','Error:\x20','options','...','\x0aAll\x20results\x20saved\x20to\x20','site','error','join','description','\x20-\x20','Executing\x20statement\x20','processedRows','completedSplits','setPhase','Cannot\x20specify\x20both\x20SQL\x20argument\x20and\x20--file\x20option','Executing\x20query\x20[','totalSplits','SQL:\x20','query','args','stats','\x20splits','catalog','10GBRDdF','104342IWNfDt','jobId'];a35_0x8f8c=function(){return _0x44994b;};return a35_0x8f8c();}import{withProgressSpinner,formatElapsed}from'../utils/spinner.js';import{formatRows}from'../sdk/util/formatters.js';export class QueryCommand extends BaseCommand{['name']=a35_0x42b657(0x15a);[a35_0x42b657(0x150)]='Run\x20Trino\x20queries\x20(streaming)';async['execute'](_0xa83468){const _0x5d6caa=a35_0x42b657,{options:_0x18063d,args:_0x41ec19,tdx:_0x4b4e1b}=_0xa83468,_0x5bc2c3={..._0x18063d,'limitStructuredFormats':!![]},_0xec7077=_0x41ec19[0x0],_0x16438c=_0x18063d['file'];let _0x1bd3e0;try{if(_0x16438c)_0x1bd3e0=readSqlStatementsFromFile(_0x16438c);else{if(_0xec7077==='-')_0x1bd3e0=await readSqlStatementsFromStdin();else{if(_0xec7077&&isSqlFilePath(_0xec7077))_0x1bd3e0=readSqlStatementsFromFile(_0xec7077);else{if(_0xec7077)_0x1bd3e0=splitSqlStatements(_0xec7077);else throw new Error(_0x5d6caa(0x16d));}}}}catch(_0x58eabc){return console['error'](_0x5d6caa(0x149)+_0x58eabc[_0x5d6caa(0x165)]),0x1;}const _0x216378=_0x18063d[_0x5d6caa(0x171)]||_0x5d6caa(0x16b),_0x346718=_0x18063d[_0x5d6caa(0x15e)];try{const _0x43b34c=[],_0xe7e630=!!_0x18063d['output'];for(let _0x8384ad=0x0;_0x8384ad<_0x1bd3e0[_0x5d6caa(0x163)];_0x8384ad++){const _0x3316cb=_0x1bd3e0[_0x8384ad],_0x4202e0=_0x8384ad+0x1,_0x45a450=_0x1bd3e0['length'],_0x58428a=_0x45a450>0x1;_0x18063d[_0x5d6caa(0x16e)]&&(console[_0x5d6caa(0x14e)]('\x0a'+(_0x58428a?_0x5d6caa(0x168)+_0x4202e0+'/'+_0x45a450+':':'')),console[_0x5d6caa(0x14e)]('Site:\x20'+_0x18063d[_0x5d6caa(0x14d)]),console[_0x5d6caa(0x14e)]('Catalog:\x20'+(_0x346718||'td')),console[_0x5d6caa(0x14e)]('Schema:\x20'+_0x216378),console[_0x5d6caa(0x14e)](_0x5d6caa(0x159)+_0x3316cb));const _0x2d5a38=_0x58428a?_0x5d6caa(0x152)+_0x4202e0+'/'+_0x45a450+_0x5d6caa(0x14b):_0x5d6caa(0x16a);try{const _0x2eabf1=await withProgressSpinner(_0x2d5a38,async _0x1a7e74=>{const _0x520fad=await _0x4b4e1b['query']['execute'](_0x3316cb,{'catalog':_0x346718,'schema':_0x216378,'onJobId':_0x56b07c=>{_0x1a7e74['setJobId'](_0x56b07c);},'onProgress':_0x3c3129=>{const _0x5a7fd4=a35_0x1d99;_0x1a7e74[_0x5a7fd4(0x155)](_0x5a7fd4(0x157)+_0x3c3129['state']+']'),_0x1a7e74[_0x5a7fd4(0x169)](formatRows(_0x3c3129[_0x5a7fd4(0x153)])+_0x5a7fd4(0x148)+_0x3c3129[_0x5a7fd4(0x154)]+'/'+_0x3c3129[_0x5a7fd4(0x158)]+_0x5a7fd4(0x15d));}});return _0x520fad;},{'verbose':_0x18063d[_0x5d6caa(0x16e)]}),_0x4e162a=_0x2eabf1[_0x5d6caa(0x16c)],_0x267be1=_0x4e162a[_0x5d6caa(0x161)]?_0x5d6caa(0x174)+_0x4e162a['jobId']+']':'',_0x5206e6=_0x58428a?_0x5d6caa(0x168)+_0x4202e0+'/'+_0x45a450+_0x5d6caa(0x151):'';console['error']('✔\x20'+_0x5206e6+_0x5d6caa(0x167)+formatRows(_0x4e162a[_0x5d6caa(0x15c)][_0x5d6caa(0x153)])+_0x5d6caa(0x148)+(_0x5d6caa(0x162)+formatElapsed(_0x4e162a[_0x5d6caa(0x15c)][_0x5d6caa(0x173)])+_0x267be1));if(_0x58428a&&_0xe7e630){const _0x5f2998=resolveOutputOptions(_0x5bc2c3),_0x3f14b8=await formatQueryOutput(_0x4e162a,_0x5f2998);_0x43b34c['push'](_0x3f14b8);}else await handleQueryOutput(_0x4e162a,_0x5bc2c3);}catch(_0x2fcfae){const _0x3d3260=_0x58428a?'Statement\x20'+_0x4202e0+'/'+_0x45a450+':\x0a':'',_0x216704=_0x2fcfae instanceof SDKError?_0x2fcfae[_0x5d6caa(0x170)]:_0x2fcfae[_0x5d6caa(0x165)];return console[_0x5d6caa(0x14e)](''+_0x3d3260+_0x216704),0x1;}}if(_0x1bd3e0[_0x5d6caa(0x163)]>0x1&&_0xe7e630&&_0x43b34c['length']>0x0){const _0x302dd3=_0x43b34c[_0x5d6caa(0x14f)]('\x0a');writeFileSync(_0x18063d[_0x5d6caa(0x146)],_0x302dd3),console[_0x5d6caa(0x14e)](_0x5d6caa(0x14c)+_0x18063d[_0x5d6caa(0x146)]);}return 0x0;}catch(_0x47bb3f){throw _0x47bb3f;}}['validate'](_0x899ac1){const _0x3fd13b=a35_0x42b657,_0x5bcacc=_0x899ac1[_0x3fd13b(0x15b)][0x0],_0x117cbe=_0x899ac1[_0x3fd13b(0x14a)][_0x3fd13b(0x176)];if(!_0x5bcacc&&!_0x117cbe)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(_0x5bcacc&&_0x117cbe)return _0x3fd13b(0x156);return undefined;}}
@@ -1 +1 @@
1
- const a36_0xf796c6=a36_0x3fc7;(function(_0x5e199d,_0x3ffcfe){const _0x522f1e=a36_0x3fc7,_0x33d022=_0x5e199d();while(!![]){try{const _0x2c78b6=parseInt(_0x522f1e(0x12e))/0x1*(-parseInt(_0x522f1e(0x13f))/0x2)+parseInt(_0x522f1e(0x130))/0x3+parseInt(_0x522f1e(0x178))/0x4*(-parseInt(_0x522f1e(0x188))/0x5)+parseInt(_0x522f1e(0x108))/0x6*(-parseInt(_0x522f1e(0x113))/0x7)+parseInt(_0x522f1e(0x10f))/0x8+-parseInt(_0x522f1e(0x135))/0x9*(-parseInt(_0x522f1e(0x126))/0xa)+-parseInt(_0x522f1e(0x12f))/0xb*(-parseInt(_0x522f1e(0x161))/0xc);if(_0x2c78b6===_0x3ffcfe)break;else _0x33d022['push'](_0x33d022['shift']());}catch(_0x4193e7){_0x33d022['push'](_0x33d022['shift']());}}}(a36_0x28d7,0x7188c));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,handleSingleObjectOutput,writeOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import{confirm}from'../utils/prompt.js';function a36_0x3fc7(_0x13d629,_0x1a6e7a){_0x13d629=_0x13d629-0x105;const _0x28d79c=a36_0x28d7();let _0x3fc7d8=_0x28d79c[_0x13d629];return _0x3fc7d8;}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_0x16220f from'chalk';function formatRelativeTime(_0x4ea1f2){const _0x513214=a36_0x3fc7,_0x230171=new Date(_0x4ea1f2),_0x35517a=new Date(),_0xf2e572=_0x230171[_0x513214(0x18f)]()-_0x35517a['getTime'](),_0x1afa43=Math['abs'](_0xf2e572)/0x3e8,_0x2840c2=_0xf2e572<0x0;if(_0x1afa43<0x3c)return _0x2840c2?_0x513214(0x12d):'soon';else{if(_0x1afa43<0xe10){const _0x138767=Math[_0x513214(0x16b)](_0x1afa43/0x3c);return _0x2840c2?_0x138767+_0x513214(0x116):'in\x20'+_0x138767+'m';}else{if(_0x1afa43<0x15180){const _0x1fd650=Math[_0x513214(0x16b)](_0x1afa43/0xe10);return _0x2840c2?_0x1fd650+_0x513214(0x183):_0x513214(0x14b)+_0x1fd650+'h';}else{if(_0x1afa43<0x93a80){const _0x31a1dc=Math[_0x513214(0x16b)](_0x1afa43/0x15180);return _0x2840c2?_0x31a1dc+_0x513214(0x139):'in\x20'+_0x31a1dc+'d';}else return _0x230171[_0x513214(0x110)]();}}}}function a36_0x28d7(){const _0x226c32=['167772dgEoTa','schedule:show','length','created_at','Schedule\x20created:\x20','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]','executing_user_id','\x20created','count','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20history\x20<name>\x20[--from\x20<n>]\x20[--to\x20<n>]','round','/app/queries/editor?queryId=','\x20execution','queryUrl','Updating\x20schedule...','end_at','\x20\x20Database:\x20','Failed\x20to\x20read\x20file:\x20','At\x20least\x20one\x20option\x20must\x20be\x20provided\x20to\x20update','args','join','num','Delete\x20a\x20scheduled\x20query','679676JATgUO','delete','retryLimit','\x20(showing\x20','priority','engineVersion','keys','\x20job','run','entries','Found\x20','h\x20ago','nextRun','\x20\x20Time:\x20','schedules','max','15alstPU','site','Show\x20schedule\x20details','INVALID_ARGUMENT','verbose','Getting\x20schedule\x20history...','schedule:delete','getTime','table','next_run_at','\x20matching\x20\x22','Schedule\x20updated:\x20','type','status','repeat','1234290txjdJL','show','Database\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]','queries','schedule:run','start_at','yes','2420984tXDYbO','toLocaleDateString','Schedule\x20run\x20submitted:\x20','trim','21LkkZSu','statusIcon','schedule:list','m\x20ago','padEnd','Listing\x20scheduled\x20queries...','history','Schedule\x20deleted:\x20','success','List\x20scheduled\x20queries','format','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20show\x20<name>','utf-8','json','schedule:update','from','update','cyan','timezone','250sYLTTE','time','ended_at','\x20\x20Type:\x20','create','trino','map','just\x20now','2JYFbzS','737alOJOK','632892wiEmQN','jsonl','Showing\x20first\x20','log','error','244710ZmBqCv','last_job','query','scheduled_at','d\x20ago','\x22...','result','tsv','data','retry_limit','538126ZpZqLH','Creating\x20schedule...','never','📅\x20','jobs','Creating\x20schedule:\x20','delay','database','Getting\x20schedule\x20details...','Searching\x20scheduled\x20queries\x20matching\x20\x22','limit','cron','in\x20','dim','\x20schedules','schedule:create','time_zone','red','pagination','...','name','engine_version','ies','Cancelled','(unnamed)','file','description','lastRun','validate','\x20\x20Timezone:\x20','list','execute','output','No\x20scheduled\x20queries\x20found'];a36_0x28d7=function(){return _0x226c32;};return a36_0x28d7();}export class ScheduleListCommand extends BaseCommand{[a36_0xf796c6(0x153)]=a36_0xf796c6(0x115);[a36_0xf796c6(0x159)]=a36_0xf796c6(0x11c);async['execute'](_0x54e0a1){const _0x4f7cd9=a36_0xf796c6,{options:_0x534d30,args:_0x2943a5,tdx:_0x34094e}=_0x54e0a1,_0x16aec8=resolveLimit(_0x534d30[_0x4f7cd9(0x149)],DEFAULT_DISPLAY_LIMIT),_0x4355d1=_0x2943a5[0x0],_0x81072=_0x4355d1?_0x4f7cd9(0x148)+_0x4355d1+_0x4f7cd9(0x13a):_0x4f7cd9(0x118),_0x477576=await withSpinner(_0x81072,()=>_0x34094e[_0x4f7cd9(0x186)]['listQueries']({'limit':_0x16aec8,'scheduled':!![],'pattern':_0x4355d1}),{'verbose':_0x534d30['verbose']}),_0x3ffd04=_0x477576[_0x4f7cd9(0x13d)][_0x4f7cd9(0x10b)],_0x2d9bb5=_0x477576[_0x4f7cd9(0x13d)][_0x4f7cd9(0x151)]['has_next_page'],_0x39224f=_0x4355d1?_0x4f7cd9(0x192)+_0x4355d1+'\x22':'';_0x2d9bb5?console[_0x4f7cd9(0x134)](_0x4f7cd9(0x132)+_0x3ffd04[_0x4f7cd9(0x163)]+_0x4f7cd9(0x14d)+_0x39224f+'\x20(use\x20--limit\x20to\x20see\x20more)'):console['error'](_0x4f7cd9(0x182)+_0x3ffd04['length']+'\x20scheduled\x20quer'+(_0x3ffd04[_0x4f7cd9(0x163)]!==0x1?_0x4f7cd9(0x155):'y')+_0x39224f);if(_0x534d30[_0x4f7cd9(0x11d)]===_0x4f7cd9(0x120)||_0x534d30['format']===_0x4f7cd9(0x131)||_0x534d30[_0x4f7cd9(0x11d)]===_0x4f7cd9(0x190)||_0x534d30[_0x4f7cd9(0x11d)]===_0x4f7cd9(0x13c)){const _0x478915=_0x3ffd04['map'](_0x2c6294=>({'id':_0x2c6294['id'],'name':_0x2c6294['name'],'cron':_0x2c6294[_0x4f7cd9(0x14a)],'database':_0x2c6294[_0x4f7cd9(0x146)]?.['name'],'type':_0x2c6294['type'],'timezone':_0x2c6294[_0x4f7cd9(0x14f)],'user_name':_0x2c6294['user']?.['name'],'updated_at':_0x2c6294['updated_at'],'next_run_at':_0x2c6294[_0x4f7cd9(0x191)],'last_job_status':_0x2c6294[_0x4f7cd9(0x136)]?.[_0x4f7cd9(0x106)]}));await handleSDKOutput(_0x478915,_0x534d30);}else{if(_0x3ffd04['length']===0x0)console[_0x4f7cd9(0x133)](_0x4f7cd9(0x160));else{const _0xeda69d=_0x534d30[_0x4f7cd9(0x189)],_0x2eb55f=_0x3ffd04[_0x4f7cd9(0x12c)](_0x362150=>{const _0x1480ab=_0x4f7cd9,_0x1439e6=_0x362150['last_job']?.[_0x1480ab(0x106)]?_0x362150[_0x1480ab(0x136)][_0x1480ab(0x106)]===_0x1480ab(0x11b)?'✓':'✗':'-',_0x3e37a3=_0x362150[_0x1480ab(0x136)]?.[_0x1480ab(0x128)]?formatRelativeTime(_0x362150[_0x1480ab(0x136)]['ended_at']):_0x1480ab(0x141),_0x344251=_0x362150[_0x1480ab(0x191)]?formatRelativeTime(_0x362150[_0x1480ab(0x191)]):'-',_0x28b02d=_0x362150[_0x1480ab(0x14a)]||'',_0x1f1fed=_0x362150['name']||_0x1480ab(0x157),_0x3cb59e=getConsoleUrl(_0xeda69d,_0x1480ab(0x16c)+_0x362150['id']);return{'statusIcon':_0x1439e6,'lastRun':_0x3e37a3,'nextRun':_0x344251,'cron':_0x28b02d,'name':_0x1f1fed,'queryUrl':_0x3cb59e,'status':_0x362150[_0x1480ab(0x136)]?.[_0x1480ab(0x106)]};}),_0x35a62d=Math['max'](..._0x2eb55f[_0x4f7cd9(0x12c)](_0x4da587=>_0x4da587[_0x4f7cd9(0x15a)][_0x4f7cd9(0x163)])),_0x2e9737=Math['max'](..._0x2eb55f['map'](_0x1b3a4a=>_0x1b3a4a[_0x4f7cd9(0x184)]['length'])),_0x50050d=Math[_0x4f7cd9(0x187)](..._0x2eb55f[_0x4f7cd9(0x12c)](_0x2e2fa4=>_0x2e2fa4[_0x4f7cd9(0x14a)][_0x4f7cd9(0x163)])),_0x2ef0d6=_0x2eb55f[_0x4f7cd9(0x12c)](_0x245728=>{const _0x5dc964=_0x4f7cd9,_0x67600=_0x245728['status']==='success'?a36_0x16220f['green'](_0x245728[_0x5dc964(0x114)]):_0x245728[_0x5dc964(0x106)]===_0x5dc964(0x134)?a36_0x16220f[_0x5dc964(0x150)](_0x245728[_0x5dc964(0x114)]):a36_0x16220f[_0x5dc964(0x14c)](_0x245728[_0x5dc964(0x114)]),_0xe346a5=_0x245728[_0x5dc964(0x15a)]['padEnd'](_0x35a62d),_0xda4aac=_0x245728[_0x5dc964(0x184)][_0x5dc964(0x117)](_0x2e9737),_0x35f7d1=_0x245728[_0x5dc964(0x14a)]?a36_0x16220f[_0x5dc964(0x124)](_0x245728['cron'][_0x5dc964(0x117)](_0x50050d)):'\x20'[_0x5dc964(0x107)](_0x50050d),_0x1d8cfc=hyperlink(_0x245728[_0x5dc964(0x153)],_0x245728[_0x5dc964(0x16e)]);return _0x5dc964(0x142)+_0x67600+'\x20'+_0xe346a5+'\x20\x20→\x20'+_0xda4aac+'\x20\x20'+_0x35f7d1+'\x20\x20'+_0x1d8cfc;});await writeOutput(_0x2ef0d6[_0x4f7cd9(0x175)]('\x0a'),_0x534d30[_0x4f7cd9(0x15f)],_0x4f7cd9(0x15d));}}return 0x0;}}export class ScheduleShowCommand extends BaseCommand{[a36_0xf796c6(0x153)]=a36_0xf796c6(0x162);[a36_0xf796c6(0x159)]=a36_0xf796c6(0x18a);['validate'](_0xc89306){const _0x596031=a36_0xf796c6,_0x49f084=_0xc89306[_0x596031(0x174)][0x0];if(!_0x49f084)return _0x596031(0x11e);return undefined;}async[a36_0xf796c6(0x15e)](_0x2e644d){const _0x223461=a36_0xf796c6,{options:_0x34c59d,args:_0xc2c27f,tdx:_0x29618b}=_0x2e644d,_0x3d5f37=_0xc2c27f[0x0],_0x4450b8=await withSpinner(_0x223461(0x147),()=>_0x29618b[_0x223461(0x186)][_0x223461(0x109)](_0x3d5f37),{'verbose':_0x34c59d['verbose']}),_0x558aef=_0x4450b8[_0x223461(0x13d)],_0x156671={'name':_0x558aef[_0x223461(0x153)],'cron':_0x558aef[_0x223461(0x14a)],'database':_0x558aef['database'],'type':_0x558aef['type'],'timezone':_0x558aef[_0x223461(0x125)],'user_name':_0x558aef['user_name'],'created_at':_0x558aef['created_at'],'engine_version':_0x558aef[_0x223461(0x154)],'executing_user_id':_0x558aef[_0x223461(0x167)],'query':_0x558aef[_0x223461(0x137)],'delay':_0x558aef[_0x223461(0x145)],'priority':_0x558aef[_0x223461(0x17c)],'retry_limit':_0x558aef[_0x223461(0x13e)],..._0x558aef[_0x223461(0x13b)]&&{'result':_0x558aef['result']}};return await handleSingleObjectOutput(_0x156671,_0x34c59d),0x0;}}export class ScheduleCreateCommand extends BaseCommand{[a36_0xf796c6(0x153)]=a36_0xf796c6(0x14e);[a36_0xf796c6(0x159)]='Create\x20a\x20scheduled\x20query';[a36_0xf796c6(0x15b)](_0x1ca46b){const _0x2056bf=a36_0xf796c6,_0x1f02ea=_0x1ca46b[_0x2056bf(0x174)][0x0];if(!_0x1f02ea)return _0x2056bf(0x166);const _0x5f236b=_0x1ca46b['options'];if(!_0x5f236b['database'])return _0x2056bf(0x10a);return undefined;}async['execute'](_0x37a41b){const _0x1d383e=a36_0xf796c6,{options:_0x113ad2,args:_0x6b89ef,tdx:_0x1e601a}=_0x37a41b,_0x4b34e3=_0x6b89ef[0x0],_0x3240f2=_0x113ad2,_0x19b5c6=_0x3240f2[_0x1d383e(0x146)],_0x12da21=_0x3240f2[_0x1d383e(0x158)],_0x4d806b=_0x3240f2[_0x1d383e(0x105)]||_0x1d383e(0x12b);let _0x26be53;try{_0x26be53=readFileSync(_0x12da21,_0x1d383e(0x11f))[_0x1d383e(0x112)]();}catch(_0x580312){throw new SDKError(ErrorCode[_0x1d383e(0x18b)],_0x1d383e(0x172)+_0x12da21,_0x580312 instanceof Error?_0x580312:undefined);}if(!_0x26be53)throw new SDKError(ErrorCode[_0x1d383e(0x18b)],'Query\x20file\x20is\x20empty');const _0x57de54={'database':_0x19b5c6,'query':_0x26be53,'type':_0x4d806b};if(_0x3240f2[_0x1d383e(0x14a)])_0x57de54['cron']=_0x3240f2['cron'];if(_0x3240f2[_0x1d383e(0x125)])_0x57de54[_0x1d383e(0x125)]=_0x3240f2['timezone'];if(_0x3240f2[_0x1d383e(0x145)]!==undefined)_0x57de54['delay']=Number(_0x3240f2[_0x1d383e(0x145)]);if(_0x3240f2[_0x1d383e(0x17c)]!==undefined)_0x57de54['priority']=Number(_0x3240f2[_0x1d383e(0x17c)]);if(_0x3240f2['retryLimit']!==undefined)_0x57de54[_0x1d383e(0x13e)]=Number(_0x3240f2[_0x1d383e(0x17a)]);if(_0x3240f2[_0x1d383e(0x17d)])_0x57de54['engine_version']=_0x3240f2[_0x1d383e(0x17d)];if(_0x3240f2[_0x1d383e(0x13b)])_0x57de54['result']=_0x3240f2[_0x1d383e(0x13b)];if(_0x113ad2[_0x1d383e(0x18c)]){console[_0x1d383e(0x134)](_0x1d383e(0x144)+_0x4b34e3),console[_0x1d383e(0x134)](_0x1d383e(0x171)+_0x19b5c6),console[_0x1d383e(0x134)](_0x1d383e(0x129)+_0x4d806b);if(_0x57de54[_0x1d383e(0x14a)])console[_0x1d383e(0x134)]('\x20\x20Cron:\x20'+_0x57de54[_0x1d383e(0x14a)]);if(_0x57de54['timezone'])console[_0x1d383e(0x134)](_0x1d383e(0x15c)+_0x57de54[_0x1d383e(0x125)]);}const _0x2f4c82=await withSpinner(_0x1d383e(0x140),()=>_0x1e601a[_0x1d383e(0x186)][_0x1d383e(0x12a)](_0x4b34e3,_0x57de54),{'verbose':_0x113ad2[_0x1d383e(0x18c)]});return console[_0x1d383e(0x134)](_0x1d383e(0x165)+_0x2f4c82[_0x1d383e(0x13d)][_0x1d383e(0x153)]),await handleSingleObjectOutput(_0x2f4c82['data'],_0x113ad2),0x0;}}export class ScheduleUpdateCommand extends BaseCommand{[a36_0xf796c6(0x153)]=a36_0xf796c6(0x121);[a36_0xf796c6(0x159)]='Update\x20a\x20scheduled\x20query';[a36_0xf796c6(0x15b)](_0x5c4d71){const _0x1655e9=a36_0xf796c6,_0x6f409d=_0x5c4d71[_0x1655e9(0x174)][0x0];if(!_0x6f409d)return'Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20update\x20<name>\x20[options]';return undefined;}async[a36_0xf796c6(0x15e)](_0xca6666){const _0x3a2d8e=a36_0xf796c6,{options:_0x4953bb,args:_0x2ecb1e,tdx:_0x56eddb}=_0xca6666,_0x2bfefa=_0x2ecb1e[0x0],_0x3af9d1=_0x4953bb,_0x4d2d15={};if(_0x3af9d1['database'])_0x4d2d15['database']=_0x3af9d1[_0x3a2d8e(0x146)];if(_0x3af9d1[_0x3a2d8e(0x105)])_0x4d2d15[_0x3a2d8e(0x105)]=_0x3af9d1['type'];if(_0x3af9d1[_0x3a2d8e(0x14a)])_0x4d2d15['cron']=_0x3af9d1['cron'];if(_0x3af9d1[_0x3a2d8e(0x125)])_0x4d2d15[_0x3a2d8e(0x125)]=_0x3af9d1['timezone'];if(_0x3af9d1[_0x3a2d8e(0x145)]!==undefined)_0x4d2d15[_0x3a2d8e(0x145)]=Number(_0x3af9d1['delay']);if(_0x3af9d1['priority']!==undefined)_0x4d2d15[_0x3a2d8e(0x17c)]=Number(_0x3af9d1['priority']);if(_0x3af9d1['retryLimit']!==undefined)_0x4d2d15[_0x3a2d8e(0x13e)]=Number(_0x3af9d1[_0x3a2d8e(0x17a)]);if(_0x3af9d1['engineVersion'])_0x4d2d15[_0x3a2d8e(0x154)]=_0x3af9d1[_0x3a2d8e(0x17d)];if(_0x3af9d1[_0x3a2d8e(0x13b)])_0x4d2d15[_0x3a2d8e(0x13b)]=_0x3af9d1[_0x3a2d8e(0x13b)];if(_0x3af9d1['file'])try{_0x4d2d15[_0x3a2d8e(0x137)]=readFileSync(_0x3af9d1[_0x3a2d8e(0x158)],'utf-8')[_0x3a2d8e(0x112)]();}catch(_0x35e9ef){throw new SDKError(ErrorCode[_0x3a2d8e(0x18b)],_0x3a2d8e(0x172)+_0x3af9d1[_0x3a2d8e(0x158)],_0x35e9ef instanceof Error?_0x35e9ef:undefined);}if(Object[_0x3a2d8e(0x17e)](_0x4d2d15)[_0x3a2d8e(0x163)]===0x0)throw new SDKError(ErrorCode[_0x3a2d8e(0x18b)],_0x3a2d8e(0x173));if(_0x4953bb[_0x3a2d8e(0x18c)]){console[_0x3a2d8e(0x134)]('Updating\x20schedule:\x20'+_0x2bfefa);for(const [_0x19dcae,_0x1d906e]of Object[_0x3a2d8e(0x181)](_0x4d2d15)){_0x19dcae==='query'?console[_0x3a2d8e(0x134)]('\x20\x20'+_0x19dcae+':\x20'+_0x1d906e['substring'](0x0,0x32)+_0x3a2d8e(0x152)):console[_0x3a2d8e(0x134)]('\x20\x20'+_0x19dcae+':\x20'+_0x1d906e);}}const _0xc4eb71=await withSpinner(_0x3a2d8e(0x16f),()=>_0x56eddb[_0x3a2d8e(0x186)][_0x3a2d8e(0x123)](_0x2bfefa,_0x4d2d15),{'verbose':_0x4953bb[_0x3a2d8e(0x18c)]});return console['error'](_0x3a2d8e(0x193)+_0xc4eb71['data'][_0x3a2d8e(0x153)]),await handleSingleObjectOutput(_0xc4eb71[_0x3a2d8e(0x13d)],_0x4953bb),0x0;}}export class ScheduleDeleteCommand extends BaseCommand{['name']=a36_0xf796c6(0x18e);[a36_0xf796c6(0x159)]=a36_0xf796c6(0x177);['validate'](_0x31b30b){const _0x501cb0=a36_0xf796c6,_0x2a0066=_0x31b30b[_0x501cb0(0x174)][0x0];if(!_0x2a0066)return'Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20delete\x20<name>';return undefined;}async[a36_0xf796c6(0x15e)](_0x2532a6){const _0x3dd5b7=a36_0xf796c6,{options:_0xcc28a4,args:_0x13b2aa,tdx:_0xb94c86}=_0x2532a6,_0x1f9a98=_0x13b2aa[0x0];if(!_0xcc28a4[_0x3dd5b7(0x10e)]){const _0x4ef997=await confirm('Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20schedule\x20\x22'+_0x1f9a98+'\x22?');if(!_0x4ef997)return console[_0x3dd5b7(0x134)](_0x3dd5b7(0x156)),0x0;}const _0x5e7366=await withSpinner('Deleting\x20schedule...',()=>_0xb94c86[_0x3dd5b7(0x186)][_0x3dd5b7(0x179)](_0x1f9a98),{'verbose':_0xcc28a4[_0x3dd5b7(0x18c)]});return console[_0x3dd5b7(0x134)](_0x3dd5b7(0x11a)+_0x5e7366[_0x3dd5b7(0x13d)][_0x3dd5b7(0x153)]),0x0;}}export class ScheduleRunCommand extends BaseCommand{[a36_0xf796c6(0x153)]=a36_0xf796c6(0x10c);[a36_0xf796c6(0x159)]='Run\x20a\x20scheduled\x20query\x20immediately';[a36_0xf796c6(0x15b)](_0x3bd325){const _0x39d2f6=a36_0xf796c6,_0x1ebf1d=_0x3bd325[_0x39d2f6(0x174)][0x0];if(!_0x1ebf1d)return'Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20run\x20<name>\x20[--time\x20<iso8601>]\x20[--num\x20<1-10>]';return undefined;}async[a36_0xf796c6(0x15e)](_0x47f313){const _0xc20933=a36_0xf796c6,{options:_0x5e2906,args:_0x3f8893,tdx:_0x2d79a2}=_0x47f313,_0x2ab848=_0x3f8893[0x0],_0x95cd64=_0x5e2906,_0x516f25=_0x95cd64[_0xc20933(0x127)],_0xf4f5fc=_0x95cd64[_0xc20933(0x176)]!==undefined?Number(_0x95cd64['num']):undefined;if(_0x5e2906[_0xc20933(0x18c)]){console[_0xc20933(0x134)]('Running\x20schedule:\x20'+_0x2ab848);if(_0x516f25)console[_0xc20933(0x134)](_0xc20933(0x185)+_0x516f25);if(_0xf4f5fc)console[_0xc20933(0x134)]('\x20\x20Num:\x20'+_0xf4f5fc);}const _0x4b6fc1=await withSpinner('Running\x20schedule...',()=>_0x2d79a2[_0xc20933(0x186)][_0xc20933(0x180)](_0x2ab848,{'time':_0x516f25,'num':_0xf4f5fc}),{'verbose':_0x5e2906[_0xc20933(0x18c)]}),_0x2bd09c=_0x4b6fc1[_0xc20933(0x13d)][_0xc20933(0x143)];console['error'](_0xc20933(0x111)+_0x2bd09c['length']+_0xc20933(0x17f)+(_0x2bd09c[_0xc20933(0x163)]!==0x1?'s':'')+_0xc20933(0x168));for(const _0x433b5b of _0x2bd09c){console[_0xc20933(0x134)]('\x20\x20Job\x20ID:\x20'+_0x433b5b['job_id']);}return await handleSDKOutput(_0x2bd09c,_0x5e2906),0x0;}}export class ScheduleHistoryCommand extends BaseCommand{['name']='schedule:history';[a36_0xf796c6(0x159)]='Show\x20schedule\x20execution\x20history';[a36_0xf796c6(0x15b)](_0x5d55e6){const _0x405e76=a36_0xf796c6,_0x145e6b=_0x5d55e6[_0x405e76(0x174)][0x0];if(!_0x145e6b)return _0x405e76(0x16a);return undefined;}async['execute'](_0x554c78){const _0x5d7065=a36_0xf796c6,{options:_0x3e23e2,args:_0x2787d9,tdx:_0x2b4529}=_0x554c78,_0x183812=_0x2787d9[0x0],_0x4a5d61=_0x3e23e2,_0x1ae1c2=_0x4a5d61[_0x5d7065(0x122)]!==undefined?Number(_0x4a5d61[_0x5d7065(0x122)]):undefined,_0xc89593=_0x4a5d61['to']!==undefined?Number(_0x4a5d61['to']):undefined,_0x169469=await withSpinner(_0x5d7065(0x18d),()=>_0x2b4529[_0x5d7065(0x186)][_0x5d7065(0x119)](_0x183812,{'from':_0x1ae1c2,'to':_0xc89593}),{'verbose':_0x3e23e2['verbose']}),_0x494834=_0x169469[_0x5d7065(0x13d)];console[_0x5d7065(0x134)](_0x5d7065(0x182)+_0x494834[_0x5d7065(0x169)]+_0x5d7065(0x16d)+(_0x494834['count']!==0x1?'s':'')+_0x5d7065(0x17b)+_0x494834[_0x5d7065(0x122)]+'-'+_0x494834['to']+')');const _0x47eddc=_0x494834[_0x5d7065(0x119)][_0x5d7065(0x12c)](_0x387e32=>({'job_id':_0x387e32['job_id'],'type':_0x387e32[_0x5d7065(0x105)],'status':_0x387e32['status'],'scheduled_at':_0x387e32[_0x5d7065(0x138)],'created_at':_0x387e32[_0x5d7065(0x164)],'start_at':_0x387e32[_0x5d7065(0x10d)],'end_at':_0x387e32[_0x5d7065(0x170)]}));return await handleSDKOutput(_0x47eddc,_0x3e23e2),0x0;}}
1
+ const a36_0x2ce4c8=a36_0x1783;(function(_0x47faf5,_0x43d0f5){const _0x3c283d=a36_0x1783,_0x1f113f=_0x47faf5();while(!![]){try{const _0xde511f=-parseInt(_0x3c283d(0xb3))/0x1+parseInt(_0x3c283d(0x8b))/0x2+parseInt(_0x3c283d(0xa4))/0x3*(-parseInt(_0x3c283d(0xa1))/0x4)+-parseInt(_0x3c283d(0xb7))/0x5+-parseInt(_0x3c283d(0xdc))/0x6+parseInt(_0x3c283d(0x85))/0x7+parseInt(_0x3c283d(0xcc))/0x8;if(_0xde511f===_0x43d0f5)break;else _0x1f113f['push'](_0x1f113f['shift']());}catch(_0x468934){_0x1f113f['push'](_0x1f113f['shift']());}}}(a36_0x3819,0x25f18));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,handleSingleObjectOutput,writeOutput}from'../core/command-output.js';function a36_0x1783(_0x52aecb,_0x5f19bf){_0x52aecb=_0x52aecb-0x67;const _0x381989=a36_0x3819();let _0x17836b=_0x381989[_0x52aecb];return _0x17836b;}import{withSpinner}from'../utils/spinner.js';import{confirm}from'../utils/prompt.js';function a36_0x3819(){const _0x41c790=['Create\x20a\x20scheduled\x20query','abs','\x20\x20Job\x20ID:\x20','Updating\x20schedule...','d\x20ago','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20update\x20<name>\x20[options]','substring','padEnd','listQueries','created_at','engineVersion','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20history\x20<name>\x20[--from\x20<n>]\x20[--to\x20<n>]','retryLimit','📅\x20','\x20\x20→\x20','INVALID_ARGUMENT','round','scheduled_at','database','retry_limit','log','1952496GAzcWD','next_run_at','length','\x20\x20Type:\x20','h\x20ago','schedule:update','210014imOTUV','args','keys','schedule:show','end_at','max','success','\x20\x20Timezone:\x20','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20run\x20<name>\x20[--time\x20<iso8601>]\x20[--num\x20<1-10>]','Delete\x20a\x20scheduled\x20query','never','schedules','history','statusIcon','Getting\x20schedule\x20details...','validate','getTime','Show\x20schedule\x20execution\x20history','pagination','\x20\x20Num:\x20','name','red','1180USiYVe','num','priority','246KuxRaA','map','At\x20least\x20one\x20option\x20must\x20be\x20provided\x20to\x20update','file','jobs','List\x20scheduled\x20queries','user_name','soon','Schedule\x20created:\x20','Database\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]','/app/queries/editor?queryId=','query','Running\x20schedule...','data','last_job','147218KrciXE','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20schedule\x20\x22','update','Cancelled','979315wstVos','trim','Query\x20file\x20is\x20empty','green','status','json','\x20execution','entries','cron','options','limit','delay','time_zone','lastRun','execute','description','job_id','\x20\x20Cron:\x20','dim','output','has_next_page','3499888FkuOfx','trino','schedule:list','Getting\x20schedule\x20history...','engine_version','\x20\x20Database:\x20','Failed\x20to\x20read\x20file:\x20','from','\x20job','site','format','\x20matching\x20\x22','Run\x20a\x20scheduled\x20query\x20immediately','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20delete\x20<name>','in\x20','Creating\x20schedule:\x20','1792404lohnQM','Searching\x20scheduled\x20queries\x20matching\x20\x22','list','result','m\x20ago','Schedule\x20updated:\x20','error','ies','tsv','timezone','utf-8','type','verbose','schedule:create','Found\x20','Schedule\x20run\x20submitted:\x20','cyan','Creating\x20schedule...'];a36_0x3819=function(){return _0x41c790;};return a36_0x3819();}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_0x4c0f93 from'chalk';function formatRelativeTime(_0x13ebf0){const _0x35f7e4=a36_0x1783,_0x242b8f=new Date(_0x13ebf0),_0x4a8933=new Date(),_0x4b20c5=_0x242b8f[_0x35f7e4(0x9b)]()-_0x4a8933['getTime'](),_0x3f5bae=Math[_0x35f7e4(0x71)](_0x4b20c5)/0x3e8,_0x3d0e27=_0x4b20c5<0x0;if(_0x3f5bae<0x3c)return _0x3d0e27?'just\x20now':_0x35f7e4(0xab);else{if(_0x3f5bae<0xe10){const _0x308e23=Math[_0x35f7e4(0x80)](_0x3f5bae/0x3c);return _0x3d0e27?_0x308e23+_0x35f7e4(0xe0):'in\x20'+_0x308e23+'m';}else{if(_0x3f5bae<0x15180){const _0x3ca42f=Math[_0x35f7e4(0x80)](_0x3f5bae/0xe10);return _0x3d0e27?_0x3ca42f+_0x35f7e4(0x89):_0x35f7e4(0xda)+_0x3ca42f+'h';}else{if(_0x3f5bae<0x93a80){const _0x3b033e=Math[_0x35f7e4(0x80)](_0x3f5bae/0x15180);return _0x3d0e27?_0x3b033e+_0x35f7e4(0x74):_0x35f7e4(0xda)+_0x3b033e+'d';}else return _0x242b8f['toLocaleDateString']();}}}}export class ScheduleListCommand extends BaseCommand{['name']=a36_0x2ce4c8(0xce);['description']=a36_0x2ce4c8(0xa9);async[a36_0x2ce4c8(0xc5)](_0x7a7020){const _0x3ab38c=a36_0x2ce4c8,{options:_0x3b2c62,args:_0x1f7b14,tdx:_0x399fd9}=_0x7a7020,_0x4c3ae9=resolveLimit(_0x3b2c62[_0x3ab38c(0xc1)],DEFAULT_DISPLAY_LIMIT),_0x5f1b0b=_0x1f7b14[0x0],_0x185b97=_0x5f1b0b?_0x3ab38c(0xdd)+_0x5f1b0b+'\x22...':'Listing\x20scheduled\x20queries...',_0x48b6c5=await withSpinner(_0x185b97,()=>_0x399fd9[_0x3ab38c(0x96)][_0x3ab38c(0x78)]({'limit':_0x4c3ae9,'scheduled':!![],'pattern':_0x5f1b0b}),{'verbose':_0x3b2c62['verbose']}),_0x54096d=_0x48b6c5[_0x3ab38c(0xb1)]['queries'],_0x20b0bc=_0x48b6c5[_0x3ab38c(0xb1)][_0x3ab38c(0x9d)][_0x3ab38c(0xcb)],_0x535eb4=_0x5f1b0b?_0x3ab38c(0xd7)+_0x5f1b0b+'\x22':'';_0x20b0bc?console[_0x3ab38c(0xe2)]('Showing\x20first\x20'+_0x54096d[_0x3ab38c(0x87)]+'\x20schedules'+_0x535eb4+'\x20(use\x20--limit\x20to\x20see\x20more)'):console[_0x3ab38c(0xe2)](_0x3ab38c(0x6c)+_0x54096d[_0x3ab38c(0x87)]+'\x20scheduled\x20quer'+(_0x54096d[_0x3ab38c(0x87)]!==0x1?_0x3ab38c(0xe3):'y')+_0x535eb4);if(_0x3b2c62[_0x3ab38c(0xd6)]===_0x3ab38c(0xbc)||_0x3b2c62[_0x3ab38c(0xd6)]==='jsonl'||_0x3b2c62[_0x3ab38c(0xd6)]==='table'||_0x3b2c62[_0x3ab38c(0xd6)]===_0x3ab38c(0xe4)){const _0x4d2114=_0x54096d[_0x3ab38c(0xa5)](_0x4a9e9a=>({'id':_0x4a9e9a['id'],'name':_0x4a9e9a[_0x3ab38c(0x9f)],'cron':_0x4a9e9a[_0x3ab38c(0xbf)],'database':_0x4a9e9a[_0x3ab38c(0x82)]?.[_0x3ab38c(0x9f)],'type':_0x4a9e9a[_0x3ab38c(0x69)],'timezone':_0x4a9e9a[_0x3ab38c(0xc3)],'user_name':_0x4a9e9a['user']?.[_0x3ab38c(0x9f)],'updated_at':_0x4a9e9a['updated_at'],'next_run_at':_0x4a9e9a[_0x3ab38c(0x86)],'last_job_status':_0x4a9e9a[_0x3ab38c(0xb2)]?.[_0x3ab38c(0xbb)]}));await handleSDKOutput(_0x4d2114,_0x3b2c62);}else{if(_0x54096d[_0x3ab38c(0x87)]===0x0)console[_0x3ab38c(0x84)]('No\x20scheduled\x20queries\x20found');else{const _0x2f36c9=_0x3b2c62[_0x3ab38c(0xd5)],_0x30b491=_0x54096d[_0x3ab38c(0xa5)](_0x4ec66c=>{const _0xa627ff=_0x3ab38c,_0x58fcb1=_0x4ec66c[_0xa627ff(0xb2)]?.[_0xa627ff(0xbb)]?_0x4ec66c[_0xa627ff(0xb2)][_0xa627ff(0xbb)]===_0xa627ff(0x91)?'✓':'✗':'-',_0x44c369=_0x4ec66c['last_job']?.['ended_at']?formatRelativeTime(_0x4ec66c[_0xa627ff(0xb2)]['ended_at']):_0xa627ff(0x95),_0x261786=_0x4ec66c['next_run_at']?formatRelativeTime(_0x4ec66c[_0xa627ff(0x86)]):'-',_0x3a9c88=_0x4ec66c[_0xa627ff(0xbf)]||'',_0x14fa92=_0x4ec66c[_0xa627ff(0x9f)]||'(unnamed)',_0x2007b1=getConsoleUrl(_0x2f36c9,_0xa627ff(0xae)+_0x4ec66c['id']);return{'statusIcon':_0x58fcb1,'lastRun':_0x44c369,'nextRun':_0x261786,'cron':_0x3a9c88,'name':_0x14fa92,'queryUrl':_0x2007b1,'status':_0x4ec66c['last_job']?.['status']};}),_0x4de23b=Math['max'](..._0x30b491[_0x3ab38c(0xa5)](_0x18c398=>_0x18c398[_0x3ab38c(0xc4)][_0x3ab38c(0x87)])),_0x59a75e=Math[_0x3ab38c(0x90)](..._0x30b491['map'](_0x3072f0=>_0x3072f0['nextRun'][_0x3ab38c(0x87)])),_0x26e4a0=Math[_0x3ab38c(0x90)](..._0x30b491[_0x3ab38c(0xa5)](_0x31e759=>_0x31e759[_0x3ab38c(0xbf)][_0x3ab38c(0x87)])),_0x7617fd=_0x30b491['map'](_0x1bb14f=>{const _0x45d457=_0x3ab38c,_0x115bd6=_0x1bb14f[_0x45d457(0xbb)]==='success'?a36_0x4c0f93[_0x45d457(0xba)](_0x1bb14f[_0x45d457(0x98)]):_0x1bb14f['status']===_0x45d457(0xe2)?a36_0x4c0f93[_0x45d457(0xa0)](_0x1bb14f[_0x45d457(0x98)]):a36_0x4c0f93[_0x45d457(0xc9)](_0x1bb14f[_0x45d457(0x98)]),_0x5d6068=_0x1bb14f[_0x45d457(0xc4)][_0x45d457(0x77)](_0x4de23b),_0x3b0ff9=_0x1bb14f['nextRun']['padEnd'](_0x59a75e),_0x3e4bf4=_0x1bb14f[_0x45d457(0xbf)]?a36_0x4c0f93[_0x45d457(0x6e)](_0x1bb14f[_0x45d457(0xbf)]['padEnd'](_0x26e4a0)):'\x20'['repeat'](_0x26e4a0),_0x31bcdb=hyperlink(_0x1bb14f['name'],_0x1bb14f['queryUrl']);return _0x45d457(0x7d)+_0x115bd6+'\x20'+_0x5d6068+_0x45d457(0x7e)+_0x3b0ff9+'\x20\x20'+_0x3e4bf4+'\x20\x20'+_0x31bcdb;});await writeOutput(_0x7617fd['join']('\x0a'),_0x3b2c62[_0x3ab38c(0xca)],_0x3ab38c(0xde));}}return 0x0;}}export class ScheduleShowCommand extends BaseCommand{[a36_0x2ce4c8(0x9f)]=a36_0x2ce4c8(0x8e);[a36_0x2ce4c8(0xc6)]='Show\x20schedule\x20details';[a36_0x2ce4c8(0x9a)](_0x1c7f30){const _0x1c2968=a36_0x2ce4c8,_0xc6ab3c=_0x1c7f30[_0x1c2968(0x8c)][0x0];if(!_0xc6ab3c)return'Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20show\x20<name>';return undefined;}async[a36_0x2ce4c8(0xc5)](_0x30b8d0){const _0x310eaa=a36_0x2ce4c8,{options:_0x5c717c,args:_0x5526ed,tdx:_0x29879c}=_0x30b8d0,_0xf9fa32=_0x5526ed[0x0],_0x7ab636=await withSpinner(_0x310eaa(0x99),()=>_0x29879c['schedules']['show'](_0xf9fa32),{'verbose':_0x5c717c[_0x310eaa(0x6a)]}),_0x2f7b0c=_0x7ab636[_0x310eaa(0xb1)],_0xe49a10={'name':_0x2f7b0c[_0x310eaa(0x9f)],'cron':_0x2f7b0c['cron'],'database':_0x2f7b0c['database'],'type':_0x2f7b0c[_0x310eaa(0x69)],'timezone':_0x2f7b0c[_0x310eaa(0x67)],'user_name':_0x2f7b0c[_0x310eaa(0xaa)],'created_at':_0x2f7b0c[_0x310eaa(0x79)],'engine_version':_0x2f7b0c['engine_version'],'executing_user_id':_0x2f7b0c['executing_user_id'],'query':_0x2f7b0c[_0x310eaa(0xaf)],'delay':_0x2f7b0c[_0x310eaa(0xc2)],'priority':_0x2f7b0c[_0x310eaa(0xa3)],'retry_limit':_0x2f7b0c[_0x310eaa(0x83)],..._0x2f7b0c[_0x310eaa(0xdf)]&&{'result':_0x2f7b0c['result']}};return await handleSingleObjectOutput(_0xe49a10,_0x5c717c),0x0;}}export class ScheduleCreateCommand extends BaseCommand{[a36_0x2ce4c8(0x9f)]=a36_0x2ce4c8(0x6b);[a36_0x2ce4c8(0xc6)]=a36_0x2ce4c8(0x70);[a36_0x2ce4c8(0x9a)](_0x121d3e){const _0x4ac300=a36_0x2ce4c8,_0x56c280=_0x121d3e[_0x4ac300(0x8c)][0x0];if(!_0x56c280)return'Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]';const _0x41dea9=_0x121d3e[_0x4ac300(0xc0)];if(!_0x41dea9[_0x4ac300(0x82)])return _0x4ac300(0xad);return undefined;}async[a36_0x2ce4c8(0xc5)](_0xfc5f9f){const _0x391cd9=a36_0x2ce4c8,{options:_0x2bf06e,args:_0x40ac40,tdx:_0x20e9a6}=_0xfc5f9f,_0x3dc3df=_0x40ac40[0x0],_0x1a0d77=_0x2bf06e,_0x3f4ef6=_0x1a0d77[_0x391cd9(0x82)],_0x3b13db=_0x1a0d77[_0x391cd9(0xa7)],_0x243f2c=_0x1a0d77[_0x391cd9(0x69)]||_0x391cd9(0xcd);let _0x59def8;try{_0x59def8=readFileSync(_0x3b13db,_0x391cd9(0x68))[_0x391cd9(0xb8)]();}catch(_0x464460){throw new SDKError(ErrorCode[_0x391cd9(0x7f)],_0x391cd9(0xd2)+_0x3b13db,_0x464460 instanceof Error?_0x464460:undefined);}if(!_0x59def8)throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x391cd9(0xb9));const _0x3ad224={'database':_0x3f4ef6,'query':_0x59def8,'type':_0x243f2c};if(_0x1a0d77[_0x391cd9(0xbf)])_0x3ad224[_0x391cd9(0xbf)]=_0x1a0d77[_0x391cd9(0xbf)];if(_0x1a0d77[_0x391cd9(0x67)])_0x3ad224[_0x391cd9(0x67)]=_0x1a0d77[_0x391cd9(0x67)];if(_0x1a0d77[_0x391cd9(0xc2)]!==undefined)_0x3ad224[_0x391cd9(0xc2)]=Number(_0x1a0d77[_0x391cd9(0xc2)]);if(_0x1a0d77[_0x391cd9(0xa3)]!==undefined)_0x3ad224[_0x391cd9(0xa3)]=Number(_0x1a0d77[_0x391cd9(0xa3)]);if(_0x1a0d77[_0x391cd9(0x7c)]!==undefined)_0x3ad224['retry_limit']=Number(_0x1a0d77[_0x391cd9(0x7c)]);if(_0x1a0d77[_0x391cd9(0x7a)])_0x3ad224[_0x391cd9(0xd0)]=_0x1a0d77[_0x391cd9(0x7a)];if(_0x1a0d77[_0x391cd9(0xdf)])_0x3ad224[_0x391cd9(0xdf)]=_0x1a0d77['result'];if(_0x2bf06e[_0x391cd9(0x6a)]){console[_0x391cd9(0xe2)](_0x391cd9(0xdb)+_0x3dc3df),console[_0x391cd9(0xe2)](_0x391cd9(0xd1)+_0x3f4ef6),console[_0x391cd9(0xe2)](_0x391cd9(0x88)+_0x243f2c);if(_0x3ad224[_0x391cd9(0xbf)])console['error'](_0x391cd9(0xc8)+_0x3ad224[_0x391cd9(0xbf)]);if(_0x3ad224[_0x391cd9(0x67)])console[_0x391cd9(0xe2)](_0x391cd9(0x92)+_0x3ad224[_0x391cd9(0x67)]);}const _0x49e0eb=await withSpinner(_0x391cd9(0x6f),()=>_0x20e9a6[_0x391cd9(0x96)]['create'](_0x3dc3df,_0x3ad224),{'verbose':_0x2bf06e['verbose']});return console[_0x391cd9(0xe2)](_0x391cd9(0xac)+_0x49e0eb[_0x391cd9(0xb1)][_0x391cd9(0x9f)]),await handleSingleObjectOutput(_0x49e0eb[_0x391cd9(0xb1)],_0x2bf06e),0x0;}}export class ScheduleUpdateCommand extends BaseCommand{['name']=a36_0x2ce4c8(0x8a);[a36_0x2ce4c8(0xc6)]='Update\x20a\x20scheduled\x20query';[a36_0x2ce4c8(0x9a)](_0xb8234b){const _0x5c7d0f=a36_0x2ce4c8,_0x58374f=_0xb8234b[_0x5c7d0f(0x8c)][0x0];if(!_0x58374f)return _0x5c7d0f(0x75);return undefined;}async[a36_0x2ce4c8(0xc5)](_0x14faed){const _0x47af3f=a36_0x2ce4c8,{options:_0x44953a,args:_0x36b40b,tdx:_0x31adb9}=_0x14faed,_0x1b0d39=_0x36b40b[0x0],_0x5bc623=_0x44953a,_0x5b52be={};if(_0x5bc623[_0x47af3f(0x82)])_0x5b52be[_0x47af3f(0x82)]=_0x5bc623[_0x47af3f(0x82)];if(_0x5bc623[_0x47af3f(0x69)])_0x5b52be['type']=_0x5bc623['type'];if(_0x5bc623[_0x47af3f(0xbf)])_0x5b52be[_0x47af3f(0xbf)]=_0x5bc623['cron'];if(_0x5bc623[_0x47af3f(0x67)])_0x5b52be[_0x47af3f(0x67)]=_0x5bc623[_0x47af3f(0x67)];if(_0x5bc623['delay']!==undefined)_0x5b52be[_0x47af3f(0xc2)]=Number(_0x5bc623[_0x47af3f(0xc2)]);if(_0x5bc623[_0x47af3f(0xa3)]!==undefined)_0x5b52be[_0x47af3f(0xa3)]=Number(_0x5bc623[_0x47af3f(0xa3)]);if(_0x5bc623['retryLimit']!==undefined)_0x5b52be['retry_limit']=Number(_0x5bc623[_0x47af3f(0x7c)]);if(_0x5bc623['engineVersion'])_0x5b52be[_0x47af3f(0xd0)]=_0x5bc623['engineVersion'];if(_0x5bc623[_0x47af3f(0xdf)])_0x5b52be[_0x47af3f(0xdf)]=_0x5bc623[_0x47af3f(0xdf)];if(_0x5bc623[_0x47af3f(0xa7)])try{_0x5b52be['query']=readFileSync(_0x5bc623[_0x47af3f(0xa7)],_0x47af3f(0x68))[_0x47af3f(0xb8)]();}catch(_0x3e5baa){throw new SDKError(ErrorCode[_0x47af3f(0x7f)],'Failed\x20to\x20read\x20file:\x20'+_0x5bc623['file'],_0x3e5baa instanceof Error?_0x3e5baa:undefined);}if(Object[_0x47af3f(0x8d)](_0x5b52be)[_0x47af3f(0x87)]===0x0)throw new SDKError(ErrorCode[_0x47af3f(0x7f)],_0x47af3f(0xa6));if(_0x44953a[_0x47af3f(0x6a)]){console[_0x47af3f(0xe2)]('Updating\x20schedule:\x20'+_0x1b0d39);for(const [_0x2cf429,_0x35f125]of Object[_0x47af3f(0xbe)](_0x5b52be)){_0x2cf429==='query'?console[_0x47af3f(0xe2)]('\x20\x20'+_0x2cf429+':\x20'+_0x35f125[_0x47af3f(0x76)](0x0,0x32)+'...'):console[_0x47af3f(0xe2)]('\x20\x20'+_0x2cf429+':\x20'+_0x35f125);}}const _0x26c1fa=await withSpinner(_0x47af3f(0x73),()=>_0x31adb9[_0x47af3f(0x96)][_0x47af3f(0xb5)](_0x1b0d39,_0x5b52be),{'verbose':_0x44953a[_0x47af3f(0x6a)]});return console[_0x47af3f(0xe2)](_0x47af3f(0xe1)+_0x26c1fa[_0x47af3f(0xb1)]['name']),await handleSingleObjectOutput(_0x26c1fa[_0x47af3f(0xb1)],_0x44953a),0x0;}}export class ScheduleDeleteCommand extends BaseCommand{[a36_0x2ce4c8(0x9f)]='schedule:delete';['description']=a36_0x2ce4c8(0x94);[a36_0x2ce4c8(0x9a)](_0x5c4763){const _0x4fc52f=a36_0x2ce4c8,_0x71f601=_0x5c4763[_0x4fc52f(0x8c)][0x0];if(!_0x71f601)return _0x4fc52f(0xd9);return undefined;}async[a36_0x2ce4c8(0xc5)](_0x3e0b97){const _0x4ee0e2=a36_0x2ce4c8,{options:_0xcabbc7,args:_0x3d4beb,tdx:_0x5dae32}=_0x3e0b97,_0x2c5baa=_0x3d4beb[0x0];if(!_0xcabbc7['yes']){const _0x34916f=await confirm(_0x4ee0e2(0xb4)+_0x2c5baa+'\x22?');if(!_0x34916f)return console['error'](_0x4ee0e2(0xb6)),0x0;}const _0x44be08=await withSpinner('Deleting\x20schedule...',()=>_0x5dae32['schedules']['delete'](_0x2c5baa),{'verbose':_0xcabbc7[_0x4ee0e2(0x6a)]});return console['error']('Schedule\x20deleted:\x20'+_0x44be08[_0x4ee0e2(0xb1)]['name']),0x0;}}export class ScheduleRunCommand extends BaseCommand{[a36_0x2ce4c8(0x9f)]='schedule:run';['description']=a36_0x2ce4c8(0xd8);[a36_0x2ce4c8(0x9a)](_0xd0b753){const _0x35fac7=a36_0x2ce4c8,_0xac1283=_0xd0b753[_0x35fac7(0x8c)][0x0];if(!_0xac1283)return _0x35fac7(0x93);return undefined;}async[a36_0x2ce4c8(0xc5)](_0x88a0aa){const _0x53ed97=a36_0x2ce4c8,{options:_0x9725b3,args:_0x1f07ec,tdx:_0x227eb4}=_0x88a0aa,_0x376de7=_0x1f07ec[0x0],_0x5f5726=_0x9725b3,_0x466347=_0x5f5726['time'],_0x4e2b7b=_0x5f5726['num']!==undefined?Number(_0x5f5726[_0x53ed97(0xa2)]):undefined;if(_0x9725b3[_0x53ed97(0x6a)]){console[_0x53ed97(0xe2)]('Running\x20schedule:\x20'+_0x376de7);if(_0x466347)console[_0x53ed97(0xe2)]('\x20\x20Time:\x20'+_0x466347);if(_0x4e2b7b)console[_0x53ed97(0xe2)](_0x53ed97(0x9e)+_0x4e2b7b);}const _0x18fe3b=await withSpinner(_0x53ed97(0xb0),()=>_0x227eb4[_0x53ed97(0x96)]['run'](_0x376de7,{'time':_0x466347,'num':_0x4e2b7b}),{'verbose':_0x9725b3[_0x53ed97(0x6a)]}),_0x1e61c0=_0x18fe3b[_0x53ed97(0xb1)][_0x53ed97(0xa8)];console[_0x53ed97(0xe2)](_0x53ed97(0x6d)+_0x1e61c0[_0x53ed97(0x87)]+_0x53ed97(0xd4)+(_0x1e61c0[_0x53ed97(0x87)]!==0x1?'s':'')+'\x20created');for(const _0x48654a of _0x1e61c0){console[_0x53ed97(0xe2)](_0x53ed97(0x72)+_0x48654a[_0x53ed97(0xc7)]);}return await handleSDKOutput(_0x1e61c0,_0x9725b3),0x0;}}export class ScheduleHistoryCommand extends BaseCommand{[a36_0x2ce4c8(0x9f)]='schedule:history';[a36_0x2ce4c8(0xc6)]=a36_0x2ce4c8(0x9c);['validate'](_0x1c57ca){const _0x1da01f=a36_0x2ce4c8,_0x4a5358=_0x1c57ca[_0x1da01f(0x8c)][0x0];if(!_0x4a5358)return _0x1da01f(0x7b);return undefined;}async[a36_0x2ce4c8(0xc5)](_0x1e329d){const _0x2718c5=a36_0x2ce4c8,{options:_0x3d4e1f,args:_0x5c9dce,tdx:_0x3fff23}=_0x1e329d,_0x2534a5=_0x5c9dce[0x0],_0x117ba6=_0x3d4e1f,_0x42486b=_0x117ba6[_0x2718c5(0xd3)]!==undefined?Number(_0x117ba6['from']):undefined,_0x269724=_0x117ba6['to']!==undefined?Number(_0x117ba6['to']):undefined,_0x171fef=await withSpinner(_0x2718c5(0xcf),()=>_0x3fff23[_0x2718c5(0x96)]['history'](_0x2534a5,{'from':_0x42486b,'to':_0x269724}),{'verbose':_0x3d4e1f['verbose']}),_0x890a57=_0x171fef[_0x2718c5(0xb1)];console[_0x2718c5(0xe2)](_0x2718c5(0x6c)+_0x890a57['count']+_0x2718c5(0xbd)+(_0x890a57['count']!==0x1?'s':'')+'\x20(showing\x20'+_0x890a57[_0x2718c5(0xd3)]+'-'+_0x890a57['to']+')');const _0x5d1fce=_0x890a57[_0x2718c5(0x97)][_0x2718c5(0xa5)](_0xc4c4ee=>({'job_id':_0xc4c4ee[_0x2718c5(0xc7)],'type':_0xc4c4ee['type'],'status':_0xc4c4ee[_0x2718c5(0xbb)],'scheduled_at':_0xc4c4ee[_0x2718c5(0x81)],'created_at':_0xc4c4ee[_0x2718c5(0x79)],'start_at':_0xc4c4ee['start_at'],'end_at':_0xc4c4ee[_0x2718c5(0x8f)]}));return await handleSDKOutput(_0x5d1fce,_0x3d4e1f),0x0;}}
@@ -1 +1 @@
1
- const a37_0x28b26d=a37_0x1f15;function a37_0x4f65(){const _0x5c3707=['86phQzJG','Create\x20segment\x20folder\x20for\x20organization','7806UUgnbN','Resolved\x20folder\x20ID:\x20','format','in\x20','Resolved\x20type:\x20','getSegmentSQL','Error:\x20Cannot\x20open\x20folder\x20in\x20web\x20browser.\x20Use\x20a\x20segment\x20name\x20instead.','segment:show','Resolved\x20parent\x20ID:\x20','json','length','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20view\x20<path/to/segment.yml>','toLocaleString','parent','\x20\x20tdx\x20sg\x20sql\x20--path\x20','SEGMENT_FOLDER_NOT_FOUND','resolveParentId','Resolved\x20relative\x20path\x20to:\x20','includes','No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22','2598323aIJUlY','Resolving\x20folder\x20\x27','site','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','getSQLFromYamlFile','1137bGDjce','Parent\x20segment:\x20','segment:describe','type','content','Error:\x20Cannot\x20execute\x20query\x20for\x20parent\x20segment\x20with\x20this\x20command.','Error:\x20Cannot\x20view\x20parent\x20segment\x20details\x20with\x20this\x20command.','listFolders','resolveFolderId','40oReOMX','execute','parentFolder','Error:\x20Folder\x20reference\x20is\x20required','log','verbose','jsonl','folderId','red','Error:\x20Folder\x20or\x20segment\x20name,\x20or\x20YAML\x20file\x20path\x20is\x20required','\x20\x20tdx\x20sg\x20sql\x20\x22Premium\x20Users\x22','Parent\x20name:\x20','Parent\x20ID:\x20','Cannot\x20get\x20SQL\x20query\x20for\x20a\x20folder.\x20Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.','Fetching\x20SQL\x20for\x20segment...','Usage:\x20tdx\x20segment\x20folder\x20show\x20<parent_name/folder_name>','Show\x20child\x20segment\x20schema\x20(column\x20types)','INVALID_ARGUMENT','data','Error:\x20YAML\x20file\x20paths\x20must\x20be\x20specified\x20with\x20--path\x20option','\x20\x20Server-side\x20segment:\x20\x20tdx\x20sg\x20sql\x20<name>','✖\x20Query\x20failed\x20[','Site:\x20','test','code','getFolder','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','Error:\x20Path\x20or\x20name\x20is\x20required','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20\x20\x20\x20\x20#\x20View\x20child\x20segment\x20details','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20show\x20<path/to/segment.yml>','/app/ps/','Error:\x20Cannot\x20open\x20parent\x20segment\x20with\x20this\x20command.','Cannot\x20get\x20SQL\x20for\x20parent\x20segment\x20with\x20this\x20command.\x20Use:\x20tdx\x20ps\x20sql','Fetching\x20folder\x20details...','segment','✔\x20Found\x20','stats','\x20folder','Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20','description','\x27...','\x20[Job\x20ID:\x20','\x20\x20-w,\x20--web\x20\x20Open\x20segment\x20in\x20web\x20browser','message','segment:folder:create','\x20\x20tdx\x20sg\x20show\x20\x22Premium\x20Users\x22','Options:','segment:desc','Error:\x20Specify\x20either\x20segment\x20name\x20or\x20--path,\x20not\x20both','Usage:\x20tdx\x20sg\x20view\x20<name>\x20[-w]','Execute\x20child\x20segment\x20SQL\x20query\x20and\x20show\x20results','\x20\x20Full\x20path:\x20','Segment\x20ID\x20missing\x20from\x20resolved\x20path','fullPath','Resolving\x20path\x20\x27','✔\x20Created\x20folder\x20\x27','url','SQL\x20query:\x0a','Usage:\x20tdx\x20segment\x20describe\x20<path>','List\x20segment\x20folders\x20under\x20a\x20parent\x20segment','Folder\x20name:\x20','cause','Use:\x20tdx\x20ps\x20view','773064xmoRUr','Segment\x20ID:\x20','segmentName','Usage:\x20tdx\x20segment\x20folder\x20create\x20<parent_name>\x20<folder_name>\x20[options]','segmentId','Show\x20segment\x20or\x20folder\x20details','\x27\x20with\x20ID:\x20','getSegment','cyan','Resolving\x20parent\x20folder\x20\x27','Folder\x20ID\x20missing\x20from\x20resolved\x20path','Error:\x20','SEGMENT_NOT_FOUND','Show\x20segment\x20folder\x20details','Examples:','Resolving\x20\x27','Error:\x20Cannot\x20execute\x20SQL\x20query\x20on\x20a\x20folder.','Fetching\x20SQL\x20from\x20rule...','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience/Marketing/High\x20Value\x22','path','Usage:\x20tdx\x20sg\x20show\x20<name>','Error:\x20Cannot\x20show\x20schema\x20for\x20parent\x20segment\x20with\x20this\x20command.','getSQLFromServerSegment','Error:\x20Cannot\x20show\x20schema\x20for\x20a\x20folder.','\x20\x20tdx\x20sg\x20show\x20segments/my-audience/premium-users.yml','error','Usage:\x20tdx\x20segment\x20folder\x20list\x20<parent_name>','limit','SELECT\x20*\x20FROM\x20(\x0a','green','elapsedTimeMillis','Resolving\x20parent\x20segment\x20\x27','parentId','segment:folder:show','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20-w\x20\x20#\x20Open\x20segment\x20in\x20web\x20browser','segment:folder:list','Error:\x20Segment\x20name\x20or\x20--path\x20is\x20required','403635LCRSpi','2840uHfQQM','✔\x20Query\x20completed:\x20Processed\x20','name','replace','1894824ThtUjy','Resolved\x20parent\x20folder\x20ID:\x20','parentSegment','Fetching\x20segment\x20details...','Use:\x20tdx\x20sg\x20view\x20<name>\x20\x20#\x20To\x20show\x20folder\x20details','folderPath','Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.','Usage:\x20tdx\x20sg\x20desc\x20<name>','segmentPath','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience\x22','processedRows','folder','Use:\x20tdx\x20ps\x20desc','Use:\x20tdx\x20ps\x20show','\x20\x20Cause:\x20','query','Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required','Listing\x20folders\x20for\x20parent\x20\x27','resolvePathToResource','Get\x20SQL\x20query\x20for\x20child\x20segment','\x20rows\x20','/e/','\x20\x20tdx\x20sg\x20view\x20segments/my-audience/premium-users.yml','Target\x20path:\x20','\x20\x20tdx\x20sg\x20view\x20\x22Marketing\x22\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20folder\x20details','434331hmuEKo','Executing\x20segment\x20query...'];a37_0x4f65=function(){return _0x5c3707;};return a37_0x4f65();}(function(_0x5e31ab,_0x3553e0){const _0x2aae36=a37_0x1f15,_0x911bd3=_0x5e31ab();while(!![]){try{const _0x23e082=-parseInt(_0x2aae36(0x1e5))/0x1*(parseInt(_0x2aae36(0x1e3))/0x2)+-parseInt(_0x2aae36(0x1fe))/0x3*(-parseInt(_0x2aae36(0x1c4))/0x4)+parseInt(_0x2aae36(0x1c3))/0x5+-parseInt(_0x2aae36(0x19e))/0x6+parseInt(_0x2aae36(0x1f9))/0x7+-parseInt(_0x2aae36(0x1c8))/0x8+parseInt(_0x2aae36(0x1e1))/0x9*(parseInt(_0x2aae36(0x207))/0xa);if(_0x23e082===_0x3553e0)break;else _0x911bd3['push'](_0x911bd3['shift']());}catch(_0x6359c7){_0x911bd3['push'](_0x911bd3['shift']());}}}(a37_0x4f65,0x33ecf));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,handleQueryOutput,handleSingleObjectOutput}from'../core/command-output.js';import{withSpinner,withProgressSpinner,formatElapsed}from'../utils/spinner.js';import{parseSegmentRef}from'../sdk/segment/segment-ref-parser.js';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import{executeSchemaQuery}from'../sdk/segment/fields-display.js';import{isYamlFilePath,resolveYamlFilePath}from'../sdk/segment/segment-path-parser.js';import{getConsoleNextUrl}from'../sdk/client/endpoints.js';import{openBrowser}from'../utils/process.js';import a37_0x522589 from'chalk';async function resolveSegmentTarget(_0x28e00f,_0xc17b00,_0x350091){const _0x1ff849=a37_0x1f15;if(isYamlFilePath(_0x28e00f))try{const _0x172ea9=await resolveYamlFilePath(_0x28e00f);return _0x350091&&(console['error']('Resolved\x20YAML\x20file:\x20'+_0x28e00f),console['error']('\x20\x20Parent\x20segment:\x20'+_0x172ea9[_0x1ff849(0x1ca)]),console[_0x1ff849(0x1b7)]('\x20\x20Segment\x20name:\x20'+_0x172ea9[_0x1ff849(0x1a0)]),console[_0x1ff849(0x1b7)]('\x20\x20Folder\x20path:\x20'+(_0x172ea9[_0x1ff849(0x1cd)]||'(root)')),console[_0x1ff849(0x1b7)](_0x1ff849(0x192)+_0x172ea9[_0x1ff849(0x194)])),_0x172ea9[_0x1ff849(0x194)];}catch(_0x3ec960){throw new SDKError(ErrorCode[_0x1ff849(0x218)],'Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20'+_0x3ec960['message']);}if(!_0xc17b00)throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x1ff849(0x1f8));return _0xc17b00+'/'+_0x28e00f;}function a37_0x1f15(_0x29c37e,_0x83be6d){_0x29c37e=_0x29c37e-0x18e;const _0x4f65fe=a37_0x4f65();let _0x1f1590=_0x4f65fe[_0x29c37e];return _0x1f1590;}export class SegmentDescribeCommand extends BaseCommand{[a37_0x28b26d(0x1c6)]=a37_0x28b26d(0x200);[a37_0x28b26d(0x22e)]=a37_0x28b26d(0x1a3);async[a37_0x28b26d(0x208)](_0x255a9b){const _0x5d438a=a37_0x28b26d,{options:_0x52dafd,args:_0x29e316,tdx:_0xf09ceb}=_0x255a9b,_0x5adaf4=_0x29e316[0x0],_0x4dd94e=!_0x5adaf4&&!!_0x52dafd['parentSegment'],_0x3a5b0c=_0x5adaf4||_0x52dafd[_0x5d438a(0x1ca)];if(!_0x3a5b0c)return console['error'](_0x5d438a(0x222)),console['error'](_0x5d438a(0x199)),console[_0x5d438a(0x1b7)]('Examples:'),console[_0x5d438a(0x1b7)](_0x5d438a(0x1d1)),console['error'](_0x5d438a(0x1b0)),console[_0x5d438a(0x1b7)]('\x20\x20tdx\x20segment\x20describe\x20\x22High\x20Value\x22\x20\x20\x20\x20#\x20Relative\x20to\x20current\x20context'),console['error'](_0x5d438a(0x221)),0x1;try{const _0x3cedb8=_0x52dafd[_0x5d438a(0x1d0)];let _0x1b90ff=_0x3a5b0c;!_0x4dd94e&&_0x3cedb8&&!_0x3a5b0c[_0x5d438a(0x1f7)]('/')&&(_0x1b90ff=_0x3cedb8+'/'+_0x3a5b0c,_0x52dafd['verbose']&&console[_0x5d438a(0x1b7)](_0x5d438a(0x1f6)+_0x1b90ff));const _0x55a241=await withSpinner(_0x5d438a(0x195)+_0x1b90ff+_0x5d438a(0x22f),()=>_0xf09ceb[_0x5d438a(0x229)][_0x5d438a(0x1da)](_0x1b90ff),{'verbose':_0x52dafd[_0x5d438a(0x20c)]}),_0x4a123c=_0x55a241[_0x5d438a(0x219)];_0x52dafd[_0x5d438a(0x20c)]&&(console[_0x5d438a(0x1b7)](_0x5d438a(0x1e9)+_0x4a123c[_0x5d438a(0x201)]),console[_0x5d438a(0x1b7)](_0x5d438a(0x213)+_0x4a123c[_0x5d438a(0x1be)]),_0x4a123c['folderId']&&console[_0x5d438a(0x1b7)]('Folder\x20ID:\x20'+_0x4a123c[_0x5d438a(0x20e)]),_0x4a123c['segmentId']&&console[_0x5d438a(0x1b7)](_0x5d438a(0x19f)+_0x4a123c[_0x5d438a(0x1a2)]));if(_0x4a123c[_0x5d438a(0x201)]===_0x5d438a(0x1f2)){const _0x2d4c09=await withSpinner('Fetching\x20parent\x20segment\x20details...',()=>_0xf09ceb[_0x5d438a(0x229)]['getParent'](_0x4a123c[_0x5d438a(0x1be)]),{'verbose':_0x52dafd['verbose']});await handleSingleObjectOutput(_0x2d4c09[_0x5d438a(0x219)],_0x52dafd);}else{if(_0x4a123c[_0x5d438a(0x201)]===_0x5d438a(0x1d3)){if(!_0x4a123c[_0x5d438a(0x20e)])throw new SDKError(ErrorCode[_0x5d438a(0x1f4)],_0x5d438a(0x1a8));const _0x2020da=await withSpinner(_0x5d438a(0x228),()=>_0xf09ceb[_0x5d438a(0x229)]['getFolder'](_0x4a123c['folderId']),{'verbose':_0x52dafd[_0x5d438a(0x20c)]});await handleSingleObjectOutput(_0x2020da['data'],_0x52dafd);}else{if(_0x4a123c[_0x5d438a(0x201)]==='segment'){if(!_0x4a123c[_0x5d438a(0x1a2)])throw new SDKError(ErrorCode[_0x5d438a(0x1aa)],_0x5d438a(0x193));const _0x4e225f=await withSpinner(_0x5d438a(0x1cb),()=>_0xf09ceb[_0x5d438a(0x229)]['getSegment'](_0x4a123c['parentId'],_0x4a123c[_0x5d438a(0x1a2)]),{'verbose':_0x52dafd['verbose']});await handleSingleObjectOutput(_0x4e225f['data'],_0x52dafd);}}}return 0x0;}catch(_0x14428d){if(_0x14428d instanceof SDKError)return console['error']('Error:\x20'+_0x14428d['message']),_0x14428d[_0x5d438a(0x19c)]&&console[_0x5d438a(0x1b7)](_0x5d438a(0x1d6)+_0x14428d[_0x5d438a(0x19c)]),0x1;throw _0x14428d;}}}export class SegmentShowCommand extends BaseCommand{[a37_0x28b26d(0x1c6)]=a37_0x28b26d(0x1ec);[a37_0x28b26d(0x22e)]=a37_0x28b26d(0x191);async[a37_0x28b26d(0x208)](_0x1d7cc9){const _0x1921e9=a37_0x28b26d,{options:_0x127d0a,args:_0xb31082,tdx:_0x52e955}=_0x1d7cc9,_0x40e85b=_0xb31082[0x0];if(!_0x40e85b)return console[_0x1921e9(0x1b7)](_0x1921e9(0x1d8)),console[_0x1921e9(0x1b7)](_0x1921e9(0x1b2)),console[_0x1921e9(0x1b7)](_0x1921e9(0x224)),console[_0x1921e9(0x1b7)](_0x1921e9(0x1ac)),console['error'](_0x1921e9(0x234)),console[_0x1921e9(0x1b7)](_0x1921e9(0x1b6)),0x1;try{const _0x5854b5=_0x127d0a[_0x1921e9(0x1ca)],_0x2bdb6a=await resolveSegmentTarget(_0x40e85b,_0x5854b5,_0x127d0a[_0x1921e9(0x20c)]);_0x127d0a[_0x1921e9(0x20c)]&&console[_0x1921e9(0x1b7)](_0x1921e9(0x1df)+_0x2bdb6a);const _0x3b6b0a=await withSpinner(_0x1921e9(0x1ad)+_0x40e85b+_0x1921e9(0x22f),()=>_0x52e955[_0x1921e9(0x229)][_0x1921e9(0x1da)](_0x2bdb6a),{'verbose':_0x127d0a[_0x1921e9(0x20c)]}),_0x2d29ef=_0x3b6b0a['data'];_0x127d0a[_0x1921e9(0x20c)]&&(console[_0x1921e9(0x1b7)](_0x1921e9(0x1e9)+_0x2d29ef[_0x1921e9(0x201)]),console[_0x1921e9(0x1b7)](_0x1921e9(0x213)+_0x2d29ef['parentId']));if(_0x2d29ef['type']===_0x1921e9(0x1d3))return console[_0x1921e9(0x1b7)](_0x1921e9(0x1ae)),console['error'](_0x1921e9(0x1cc)),0x1;if(_0x2d29ef['type']===_0x1921e9(0x1f2))return console['error'](_0x1921e9(0x203)),console[_0x1921e9(0x1b7)](_0x1921e9(0x1d5)),0x1;if(!_0x2d29ef[_0x1921e9(0x1a2)])throw new SDKError(ErrorCode[_0x1921e9(0x1aa)],_0x1921e9(0x193));const _0x2027d7=await withSpinner(_0x1921e9(0x215),()=>_0x52e955['segment'][_0x1921e9(0x1ea)](_0x2d29ef[_0x1921e9(0x1be)],_0x2d29ef[_0x1921e9(0x1a2)]),{'verbose':_0x127d0a[_0x1921e9(0x20c)]});let _0x3b7478=_0x2027d7[_0x1921e9(0x219)];const _0x32fc1e=resolveLimit(_0x127d0a[_0x1921e9(0x1b9)],DEFAULT_DISPLAY_LIMIT),_0x1de698=/\bLIMIT\s+\d+/i[_0x1921e9(0x21e)](_0x3b7478);!_0x1de698&&(_0x3b7478=_0x3b7478['trim']()[_0x1921e9(0x1c7)](/;+$/,''),_0x3b7478=_0x1921e9(0x1ba)+_0x3b7478+_0x1921e9(0x1fc)+_0x32fc1e);_0x127d0a['verbose']&&console['error'](_0x1921e9(0x198)+_0x3b7478);const _0x48ac12=await withProgressSpinner(_0x1921e9(0x1e2),async _0x54b8ad=>{const _0x142a3f=_0x1921e9,_0x35f28f=await _0x52e955[_0x142a3f(0x1d7)][_0x142a3f(0x208)](_0x3b7478,{'catalog':'td','schema':'information_schema','onJobId':_0x2fbdc8=>{_0x54b8ad['setJobId'](_0x2fbdc8);}});return _0x35f28f;},{'verbose':_0x127d0a['verbose']}),_0x5cd5dd=_0x48ac12[_0x1921e9(0x219)],_0x12b14=_0x5cd5dd['jobId']?_0x1921e9(0x230)+_0x5cd5dd['jobId']+']':'';return console[_0x1921e9(0x1b7)](_0x1921e9(0x1c5)+_0x5cd5dd[_0x1921e9(0x22b)][_0x1921e9(0x1d2)][_0x1921e9(0x1f1)]()+_0x1921e9(0x1dc)+(_0x1921e9(0x1e8)+formatElapsed(_0x5cd5dd[_0x1921e9(0x22b)][_0x1921e9(0x1bc)])+_0x12b14)),await handleQueryOutput(_0x5cd5dd,_0x127d0a),0x0;}catch(_0x3d0218){if(_0x3d0218 instanceof SDKError)return console[_0x1921e9(0x1b7)](_0x1921e9(0x21c)+_0x3d0218[_0x1921e9(0x21f)]+']'),console[_0x1921e9(0x1b7)]('\x0a'+_0x3d0218[_0x1921e9(0x232)]),0x1;throw _0x3d0218;}}}export class SegmentFolderListCommand extends BaseCommand{[a37_0x28b26d(0x1c6)]=a37_0x28b26d(0x1c1);['description']=a37_0x28b26d(0x19a);async['execute'](_0x495b64){const _0x150109=a37_0x28b26d,{options:_0x47eedd,args:_0x1ade86,tdx:_0x107c1a}=_0x495b64;if(_0x1ade86[_0x150109(0x1ef)]===0x0)return console[_0x150109(0x1b7)]('Error:\x20Parent\x20segment\x20name\x20is\x20required'),console[_0x150109(0x1b7)](_0x150109(0x1b8)),0x1;const _0x1ff5b2=_0x1ade86[0x0];try{_0x47eedd['verbose']&&(console[_0x150109(0x1b7)](_0x150109(0x21d)+_0x47eedd['site']),console[_0x150109(0x1b7)](_0x150109(0x212)+_0x1ff5b2));const _0x4ccdc0=await withSpinner(_0x150109(0x1bd)+_0x1ff5b2+_0x150109(0x22f),()=>_0x107c1a[_0x150109(0x229)][_0x150109(0x1f5)](_0x1ff5b2),{'verbose':_0x47eedd[_0x150109(0x20c)]}),_0x3ca77=_0x4ccdc0[_0x150109(0x219)];_0x47eedd['verbose']&&console[_0x150109(0x1b7)](_0x150109(0x1ed)+_0x3ca77);const _0x5f3f5e=await withSpinner(_0x150109(0x1d9)+_0x1ff5b2+'\x27...',()=>_0x107c1a[_0x150109(0x229)][_0x150109(0x205)](_0x3ca77),{'verbose':_0x47eedd[_0x150109(0x20c)]}),_0x2ed49b=_0x5f3f5e[_0x150109(0x219)];return console[_0x150109(0x1b7)](_0x150109(0x22a)+_0x2ed49b[_0x150109(0x1ef)]+_0x150109(0x22c)+(_0x2ed49b[_0x150109(0x1ef)]!==0x1?'s':'')),await handleSDKOutput(_0x2ed49b,_0x47eedd),0x0;}catch(_0x2896f2){if(_0x2896f2 instanceof SDKError)return console[_0x150109(0x1b7)]('Error:\x20'+_0x2896f2[_0x150109(0x232)]),_0x2896f2['cause']&&console['error'](_0x150109(0x1d6)+_0x2896f2[_0x150109(0x19c)]),0x1;throw _0x2896f2;}}}export class SegmentFolderShowCommand extends BaseCommand{['name']=a37_0x28b26d(0x1bf);[a37_0x28b26d(0x22e)]=a37_0x28b26d(0x1ab);async[a37_0x28b26d(0x208)](_0x2874e5){const _0x37a9db=a37_0x28b26d,{options:_0x34e434,args:_0x13a418,tdx:_0x997f28}=_0x2874e5;if(_0x13a418[_0x37a9db(0x1ef)]===0x0)return console[_0x37a9db(0x1b7)](_0x37a9db(0x20a)),console[_0x37a9db(0x1b7)](_0x37a9db(0x216)),0x1;try{const {parentId:_0x8b035d,childId:_0xf7670a}=parseSegmentRef(_0x13a418[0x0]);_0x34e434['verbose']&&(console[_0x37a9db(0x1b7)](_0x37a9db(0x21d)+_0x34e434[_0x37a9db(0x1fb)]),console[_0x37a9db(0x1b7)](_0x37a9db(0x212)+_0x8b035d),_0xf7670a&&console[_0x37a9db(0x1b7)](_0x37a9db(0x19b)+_0xf7670a));if(!_0xf7670a)return console[_0x37a9db(0x1b7)]('Error:\x20Folder\x20name\x20is\x20required\x20(use\x20parent_name/folder_name\x20format)'),0x1;const _0x2599bb=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x8b035d+_0x37a9db(0x22f),()=>_0x997f28[_0x37a9db(0x229)][_0x37a9db(0x1f5)](_0x8b035d),{'verbose':_0x34e434[_0x37a9db(0x20c)]}),_0x4d0488=_0x2599bb[_0x37a9db(0x219)];_0x34e434[_0x37a9db(0x20c)]&&console[_0x37a9db(0x1b7)](_0x37a9db(0x1ed)+_0x4d0488);const _0x1c994a=await withSpinner(_0x37a9db(0x1fa)+_0xf7670a+_0x37a9db(0x22f),()=>_0x997f28[_0x37a9db(0x229)]['resolveFolderId'](_0x4d0488,_0xf7670a),{'verbose':_0x34e434[_0x37a9db(0x20c)]}),_0x3eac96=_0x1c994a[_0x37a9db(0x219)];_0x34e434[_0x37a9db(0x20c)]&&console[_0x37a9db(0x1b7)](_0x37a9db(0x1e6)+_0x3eac96);const _0x297bb0=await withSpinner('Fetching\x20folder\x20\x27'+_0xf7670a+_0x37a9db(0x22f),()=>_0x997f28[_0x37a9db(0x229)][_0x37a9db(0x220)](_0x3eac96),{'verbose':_0x34e434[_0x37a9db(0x20c)]});return await handleSDKOutput([_0x297bb0[_0x37a9db(0x219)]],_0x34e434),0x0;}catch(_0x3a1836){if(_0x3a1836 instanceof SDKError)return console['error'](_0x37a9db(0x1a9)+_0x3a1836[_0x37a9db(0x232)]),_0x3a1836[_0x37a9db(0x19c)]&&console[_0x37a9db(0x1b7)](_0x37a9db(0x1d6)+_0x3a1836['cause']),0x1;throw _0x3a1836;}}}export class SegmentSQLCommand extends BaseCommand{[a37_0x28b26d(0x1c6)]='segment:sql';['description']=a37_0x28b26d(0x1db);async['execute'](_0x21529b){const _0x4fdf77=a37_0x28b26d,{options:_0x4dd0dc,args:_0x2e5e63}=_0x21529b,_0x719af1=_0x4dd0dc,_0x2342e4=_0x719af1[_0x4fdf77(0x1b1)],_0x58fe97=_0x2e5e63[0x0];if(!_0x58fe97&&!_0x2342e4)return console[_0x4fdf77(0x1b7)](a37_0x522589[_0x4fdf77(0x20f)](_0x4fdf77(0x1c2))),console[_0x4fdf77(0x1b7)]('Usage:'),console[_0x4fdf77(0x1b7)](_0x4fdf77(0x21b)),console['error']('\x20\x20Local\x20YAML\x20file:\x20\x20\x20\x20\x20\x20tdx\x20sg\x20sql\x20--path\x20<file-path>'),console[_0x4fdf77(0x1b7)](_0x4fdf77(0x1ac)),console[_0x4fdf77(0x1b7)](_0x4fdf77(0x211)),console[_0x4fdf77(0x1b7)]('\x20\x20tdx\x20sg\x20sql\x20--path\x20segments/my-audience/premium-users.yml'),0x1;if(_0x58fe97&&_0x2342e4)return console[_0x4fdf77(0x1b7)](a37_0x522589[_0x4fdf77(0x20f)](_0x4fdf77(0x18f))),0x1;try{let _0x23fe1;if(_0x2342e4)_0x23fe1=await this[_0x4fdf77(0x1fd)](_0x2342e4,_0x21529b);else{if(isYamlFilePath(_0x58fe97))return console['error'](a37_0x522589[_0x4fdf77(0x20f)](_0x4fdf77(0x21a))),console[_0x4fdf77(0x1b7)](_0x4fdf77(0x1f3)+_0x58fe97),0x1;else _0x23fe1=await this[_0x4fdf77(0x1b4)](_0x58fe97,_0x21529b);}return _0x4dd0dc[_0x4fdf77(0x1e7)]===_0x4fdf77(0x1ee)||_0x4dd0dc[_0x4fdf77(0x1e7)]===_0x4fdf77(0x20d)?await handleSDKOutput([{'sql':_0x23fe1}],_0x4dd0dc):console[_0x4fdf77(0x20b)](_0x23fe1),0x0;}catch(_0x24bf88){if(_0x24bf88 instanceof SDKError)return console[_0x4fdf77(0x1b7)]('Error:\x20'+_0x24bf88[_0x4fdf77(0x232)]),_0x24bf88[_0x4fdf77(0x19c)]&&console[_0x4fdf77(0x1b7)](_0x4fdf77(0x1d6)+_0x24bf88['cause']),0x1;throw _0x24bf88;}}async[a37_0x28b26d(0x1fd)](_0x584c15,_0x486b7e){const _0x1d2fff=a37_0x28b26d,{options:_0x174479,tdx:_0x44bfa6}=_0x486b7e;let _0x1eaffc;try{_0x1eaffc=await resolveYamlFilePath(_0x584c15);}catch(_0x350414){throw new SDKError(ErrorCode[_0x1d2fff(0x218)],_0x1d2fff(0x22d)+_0x350414[_0x1d2fff(0x232)]);}_0x174479[_0x1d2fff(0x20c)]&&console[_0x1d2fff(0x1b7)]('Resolved:\x20'+_0x1eaffc[_0x1d2fff(0x1ca)]+'/'+_0x1eaffc[_0x1d2fff(0x1a0)]);const _0x4894d0=await withSpinner(_0x1d2fff(0x1af),()=>_0x44bfa6[_0x1d2fff(0x229)]['getSegmentSQLFromYaml'](_0x1eaffc[_0x1d2fff(0x202)],_0x1eaffc['parentSegment'],_0x1eaffc[_0x1d2fff(0x1a0)]),{'verbose':_0x174479[_0x1d2fff(0x20c)]});return _0x4894d0[_0x1d2fff(0x219)];}async['getSQLFromServerSegment'](_0x57acbf,_0x1c2c94){const _0x20b892=a37_0x28b26d,{options:_0x5686d5,tdx:_0x521bd8}=_0x1c2c94,_0x1cfa46=_0x5686d5[_0x20b892(0x1ca)],_0x3d28f5=await resolveSegmentTarget(_0x57acbf,_0x1cfa46,_0x5686d5[_0x20b892(0x20c)]);_0x5686d5[_0x20b892(0x20c)]&&console[_0x20b892(0x1b7)](_0x20b892(0x1df)+_0x3d28f5);const _0x3752c4=await withSpinner(_0x20b892(0x1ad)+_0x57acbf+'\x27...',()=>_0x521bd8[_0x20b892(0x229)][_0x20b892(0x1da)](_0x3d28f5),{'verbose':_0x5686d5[_0x20b892(0x20c)]}),_0x9dcb1f=_0x3752c4[_0x20b892(0x219)];_0x5686d5[_0x20b892(0x20c)]&&(console[_0x20b892(0x1b7)](_0x20b892(0x1e9)+_0x9dcb1f['type']),console['error'](_0x20b892(0x213)+_0x9dcb1f[_0x20b892(0x1be)]));if(_0x9dcb1f[_0x20b892(0x201)]===_0x20b892(0x1d3))throw new SDKError(ErrorCode[_0x20b892(0x218)],_0x20b892(0x214));if(_0x9dcb1f[_0x20b892(0x201)]==='parent')throw new SDKError(ErrorCode[_0x20b892(0x218)],_0x20b892(0x227));if(!_0x9dcb1f[_0x20b892(0x1a2)])throw new SDKError(ErrorCode[_0x20b892(0x1aa)],_0x20b892(0x193));const _0x1f5d43=await withSpinner(_0x20b892(0x215),()=>_0x521bd8[_0x20b892(0x229)][_0x20b892(0x1ea)](_0x9dcb1f[_0x20b892(0x1be)],_0x9dcb1f[_0x20b892(0x1a2)]),{'verbose':_0x5686d5['verbose']});return _0x1f5d43['data'];}}export class SegmentFolderCreateCommand extends BaseCommand{[a37_0x28b26d(0x1c6)]=a37_0x28b26d(0x233);[a37_0x28b26d(0x22e)]=a37_0x28b26d(0x1e4);async['execute'](_0x65fae6){const _0x3c7dd2=a37_0x28b26d,{options:_0x1f8cd1,args:_0xccf4fa,tdx:_0x51038f}=_0x65fae6,_0x9f40ef=_0x1f8cd1;if(_0xccf4fa[_0x3c7dd2(0x1ef)]<0x2)return console[_0x3c7dd2(0x1b7)]('Error:\x20Parent\x20segment\x20name\x20and\x20folder\x20name\x20are\x20required'),console[_0x3c7dd2(0x1b7)](_0x3c7dd2(0x1a1)),0x1;const _0x12dc6b=_0xccf4fa[0x0],_0x58788c=_0xccf4fa[0x1];_0x9f40ef[_0x3c7dd2(0x20c)]&&(console[_0x3c7dd2(0x1b7)](_0x3c7dd2(0x21d)+_0x9f40ef[_0x3c7dd2(0x1fb)]),console[_0x3c7dd2(0x1b7)](_0x3c7dd2(0x1ff)+_0x12dc6b),console[_0x3c7dd2(0x1b7)](_0x3c7dd2(0x19b)+_0x58788c));let _0x18e96d;if(_0x9f40ef[_0x3c7dd2(0x209)]){const _0x2bd4c1=_0x9f40ef[_0x3c7dd2(0x209)],_0x93aa0c=await withSpinner(_0x3c7dd2(0x1bd)+_0x12dc6b+_0x3c7dd2(0x22f),()=>_0x51038f[_0x3c7dd2(0x229)][_0x3c7dd2(0x1f5)](_0x12dc6b),{'verbose':_0x9f40ef[_0x3c7dd2(0x20c)]}),_0x456048=_0x93aa0c[_0x3c7dd2(0x219)],_0x34cc6b=await withSpinner(_0x3c7dd2(0x1a7)+_0x2bd4c1+_0x3c7dd2(0x22f),()=>_0x51038f['segment'][_0x3c7dd2(0x206)](_0x456048,_0x2bd4c1),{'verbose':_0x9f40ef[_0x3c7dd2(0x20c)]});_0x18e96d=_0x34cc6b[_0x3c7dd2(0x219)],_0x9f40ef[_0x3c7dd2(0x20c)]&&console[_0x3c7dd2(0x1b7)](_0x3c7dd2(0x1c9)+_0x18e96d);}const _0x477d4c={'name':_0x58788c,'description':_0x9f40ef['description'],'parentFolderId':_0x18e96d},_0x2c5fe7=await withSpinner('Creating\x20folder\x20\x27'+_0x58788c+'\x27...',()=>_0x51038f[_0x3c7dd2(0x229)]['createFolder'](_0x12dc6b,_0x477d4c),{'verbose':_0x9f40ef[_0x3c7dd2(0x20c)]}),_0x5500c9=_0x2c5fe7[_0x3c7dd2(0x219)];return console[_0x3c7dd2(0x1b7)](_0x3c7dd2(0x196)+_0x5500c9[_0x3c7dd2(0x1c6)]+_0x3c7dd2(0x1a4)+_0x5500c9['id']),await handleSDKOutput([_0x5500c9],_0x9f40ef),0x0;}}export class SegmentViewCommand extends BaseCommand{[a37_0x28b26d(0x1c6)]='segment:view';[a37_0x28b26d(0x22e)]='Show\x20folder\x20or\x20child\x20segment\x20details';async[a37_0x28b26d(0x208)](_0x825e7e){const _0x326803=a37_0x28b26d,{options:_0x5b057a,args:_0x4c2cde,tdx:_0x248efe}=_0x825e7e,_0x186ea7=_0x4c2cde[0x0];if(!_0x186ea7)return console[_0x326803(0x1b7)](_0x326803(0x210)),console[_0x326803(0x1b7)](_0x326803(0x190)),console[_0x326803(0x1b7)](_0x326803(0x1f0)),console[_0x326803(0x1b7)](_0x326803(0x235)),console[_0x326803(0x1b7)](_0x326803(0x231)),console[_0x326803(0x1b7)]('Examples:'),console[_0x326803(0x1b7)](_0x326803(0x1e0)),console[_0x326803(0x1b7)](_0x326803(0x223)),console[_0x326803(0x1b7)](_0x326803(0x1c0)),console[_0x326803(0x1b7)](_0x326803(0x1de)),0x1;try{const _0x37dc30=_0x5b057a[_0x326803(0x1ca)],_0x13fe42=await resolveSegmentTarget(_0x186ea7,_0x37dc30,_0x5b057a[_0x326803(0x20c)]);_0x5b057a['verbose']&&console[_0x326803(0x1b7)]('Target\x20path:\x20'+_0x13fe42);const _0x2ca620=await withSpinner('Resolving\x20\x27'+_0x186ea7+_0x326803(0x22f),()=>_0x248efe[_0x326803(0x229)][_0x326803(0x1da)](_0x13fe42),{'verbose':_0x5b057a[_0x326803(0x20c)]}),_0x4b4f69=_0x2ca620[_0x326803(0x219)];_0x5b057a[_0x326803(0x20c)]&&(console['error'](_0x326803(0x1e9)+_0x4b4f69[_0x326803(0x201)]),console[_0x326803(0x1b7)](_0x326803(0x213)+_0x4b4f69[_0x326803(0x1be)]),_0x4b4f69[_0x326803(0x20e)]&&console[_0x326803(0x1b7)]('Folder\x20ID:\x20'+_0x4b4f69[_0x326803(0x20e)]),_0x4b4f69[_0x326803(0x1a2)]&&console[_0x326803(0x1b7)]('Segment\x20ID:\x20'+_0x4b4f69[_0x326803(0x1a2)]));if(_0x5b057a['web']){if(_0x4b4f69['type']===_0x326803(0x1d3))return console[_0x326803(0x1b7)](_0x326803(0x1eb)),0x1;if(_0x4b4f69[_0x326803(0x201)]===_0x326803(0x1f2))return console[_0x326803(0x1b7)](_0x326803(0x226)),console[_0x326803(0x1b7)]('Use:\x20tdx\x20ps\x20view\x20-w'),0x1;if(!_0x4b4f69[_0x326803(0x1a2)])throw new SDKError(ErrorCode[_0x326803(0x1aa)],_0x326803(0x193));const _0xab1516=getConsoleNextUrl(_0x5b057a['site'],_0x326803(0x225)+_0x4b4f69[_0x326803(0x1be)]+_0x326803(0x1dd)+_0x4b4f69['segmentId']);return console['error'](a37_0x522589[_0x326803(0x1bb)]('✔')+'\x20Opening\x20'+a37_0x522589[_0x326803(0x1a6)](_0xab1516)),openBrowser(_0xab1516),0x0;}if(_0x4b4f69['type']===_0x326803(0x1d3)){if(!_0x4b4f69['folderId'])throw new SDKError(ErrorCode[_0x326803(0x1f4)],_0x326803(0x1a8));const _0x10d401=await withSpinner(_0x326803(0x228),()=>_0x248efe['segment'][_0x326803(0x220)](_0x4b4f69[_0x326803(0x20e)]),{'verbose':_0x5b057a[_0x326803(0x20c)]});await handleSingleObjectOutput(_0x10d401['data'],_0x5b057a);}else{if(_0x4b4f69[_0x326803(0x201)]==='segment'){if(!_0x4b4f69[_0x326803(0x1a2)])throw new SDKError(ErrorCode[_0x326803(0x1aa)],_0x326803(0x193));const _0x19b3bd=await withSpinner(_0x326803(0x1cb),()=>_0x248efe[_0x326803(0x229)][_0x326803(0x1a5)](_0x4b4f69[_0x326803(0x1be)],_0x4b4f69[_0x326803(0x1a2)]),{'verbose':_0x5b057a['verbose']}),_0x52dc2c=getConsoleNextUrl(_0x5b057a[_0x326803(0x1fb)],_0x326803(0x225)+_0x4b4f69[_0x326803(0x1be)]+_0x326803(0x1dd)+_0x4b4f69[_0x326803(0x1a2)]),_0x2d59a5=_0x19b3bd[_0x326803(0x219)];_0x2d59a5[_0x326803(0x197)]=_0x52dc2c,await handleSingleObjectOutput(_0x2d59a5,_0x5b057a);}else return console[_0x326803(0x1b7)](_0x326803(0x204)),console[_0x326803(0x1b7)](_0x326803(0x19d)),0x1;}return 0x0;}catch(_0x3e5b75){if(_0x3e5b75 instanceof SDKError)return console[_0x326803(0x1b7)](_0x326803(0x1a9)+_0x3e5b75[_0x326803(0x232)]),_0x3e5b75['cause']&&console['error'](_0x326803(0x1d6)+_0x3e5b75[_0x326803(0x19c)]),0x1;throw _0x3e5b75;}}}export const SegmentInfoCommand=SegmentViewCommand;export class SegmentDescCommand extends BaseCommand{[a37_0x28b26d(0x1c6)]=a37_0x28b26d(0x18e);[a37_0x28b26d(0x22e)]=a37_0x28b26d(0x217);async['execute'](_0x2b259c){const _0x43fdbd=a37_0x28b26d,{options:_0x4efdc6,args:_0xce3873,tdx:_0x447f61}=_0x2b259c,_0x3c0b5d=_0xce3873[0x0];if(!_0x3c0b5d)return console[_0x43fdbd(0x1b7)](_0x43fdbd(0x1d8)),console[_0x43fdbd(0x1b7)](_0x43fdbd(0x1cf)),console[_0x43fdbd(0x1b7)]('\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20desc\x20<path/to/segment.yml>'),console[_0x43fdbd(0x1b7)]('Examples:'),console[_0x43fdbd(0x1b7)]('\x20\x20tdx\x20sg\x20desc\x20\x22Premium\x20Users\x22'),console[_0x43fdbd(0x1b7)]('\x20\x20tdx\x20sg\x20desc\x20segments/my-audience/premium-users.yml'),0x1;try{const _0x387d60=_0x4efdc6[_0x43fdbd(0x1ca)],_0x27b5ab=await resolveSegmentTarget(_0x3c0b5d,_0x387d60,_0x4efdc6['verbose']);_0x4efdc6['verbose']&&console[_0x43fdbd(0x1b7)](_0x43fdbd(0x1df)+_0x27b5ab);const _0x733b0b=await withSpinner(_0x43fdbd(0x1ad)+_0x3c0b5d+_0x43fdbd(0x22f),()=>_0x447f61[_0x43fdbd(0x229)][_0x43fdbd(0x1da)](_0x27b5ab),{'verbose':_0x4efdc6[_0x43fdbd(0x20c)]}),_0x14502e=_0x733b0b[_0x43fdbd(0x219)];_0x4efdc6['verbose']&&(console[_0x43fdbd(0x1b7)](_0x43fdbd(0x1e9)+_0x14502e[_0x43fdbd(0x201)]),console[_0x43fdbd(0x1b7)]('Parent\x20ID:\x20'+_0x14502e[_0x43fdbd(0x1be)]));if(_0x14502e[_0x43fdbd(0x201)]===_0x43fdbd(0x1d3))return console['error'](_0x43fdbd(0x1b5)),console[_0x43fdbd(0x1b7)](_0x43fdbd(0x1ce)),0x1;if(_0x14502e['type']===_0x43fdbd(0x1f2))return console[_0x43fdbd(0x1b7)](_0x43fdbd(0x1b3)),console[_0x43fdbd(0x1b7)](_0x43fdbd(0x1d4)),0x1;if(!_0x14502e['segmentId'])throw new SDKError(ErrorCode[_0x43fdbd(0x1aa)],_0x43fdbd(0x193));const _0x3c075d=await withSpinner(_0x43fdbd(0x215),()=>_0x447f61[_0x43fdbd(0x229)][_0x43fdbd(0x1ea)](_0x14502e[_0x43fdbd(0x1be)],_0x14502e[_0x43fdbd(0x1a2)]),{'verbose':_0x4efdc6[_0x43fdbd(0x20c)]}),_0x1e847e=_0x3c075d[_0x43fdbd(0x219)],_0x6af300=await executeSchemaQuery(_0x1e847e,_0x447f61,_0x4efdc6);return await handleQueryOutput(_0x6af300,_0x4efdc6),0x0;}catch(_0x5b4227){if(_0x5b4227 instanceof SDKError)return console[_0x43fdbd(0x1b7)]('Error:\x20'+_0x5b4227[_0x43fdbd(0x232)]),_0x5b4227[_0x43fdbd(0x19c)]&&console[_0x43fdbd(0x1b7)]('\x20\x20Cause:\x20'+_0x5b4227[_0x43fdbd(0x19c)]),0x1;throw _0x5b4227;}}}
1
+ const a37_0x522e52=a37_0x5f4b;(function(_0x510530,_0x444207){const _0xf41a8f=a37_0x5f4b,_0x533fd6=_0x510530();while(!![]){try{const _0x1878be=-parseInt(_0xf41a8f(0xb8))/0x1*(parseInt(_0xf41a8f(0xc6))/0x2)+-parseInt(_0xf41a8f(0x117))/0x3*(parseInt(_0xf41a8f(0x9f))/0x4)+parseInt(_0xf41a8f(0x126))/0x5+parseInt(_0xf41a8f(0x121))/0x6*(parseInt(_0xf41a8f(0xeb))/0x7)+parseInt(_0xf41a8f(0xae))/0x8+-parseInt(_0xf41a8f(0xb6))/0x9+parseInt(_0xf41a8f(0x12f))/0xa*(parseInt(_0xf41a8f(0x11f))/0xb);if(_0x1878be===_0x444207)break;else _0x533fd6['push'](_0x533fd6['shift']());}catch(_0x2fd980){_0x533fd6['push'](_0x533fd6['shift']());}}}(a37_0x4d6b,0xa41ae));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,handleQueryOutput,handleSingleObjectOutput}from'../core/command-output.js';import{withSpinner,withProgressSpinner,formatElapsed}from'../utils/spinner.js';function a37_0x4d6b(){const _0x6cd760=['Error:\x20Cannot\x20view\x20parent\x20segment\x20details\x20with\x20this\x20command.','1996jVghxb','Show\x20child\x20segment\x20schema\x20(column\x20types)','Resolving\x20parent\x20folder\x20\x27','\x20\x20tdx\x20sg\x20desc\x20\x22Premium\x20Users\x22','resolveParentId','parentSegment','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20-w\x20\x20#\x20Open\x20segment\x20in\x20web\x20browser','\x20\x20tdx\x20sg\x20sql\x20--path\x20','\x20\x20Parent\x20segment:\x20','Folder\x20name:\x20','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','Create\x20segment\x20folder\x20for\x20organization','parent','\x20\x20tdx\x20sg\x20sql\x20\x22Premium\x20Users\x22','796mmYLKh','type','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience/Marketing/High\x20Value\x22','Usage:\x20tdx\x20segment\x20describe\x20<path>','Resolving\x20\x27','code','Segment\x20ID:\x20','Fetching\x20SQL\x20for\x20segment...','Error:\x20Cannot\x20show\x20schema\x20for\x20parent\x20segment\x20with\x20this\x20command.','Error:\x20Folder\x20or\x20segment\x20name,\x20or\x20YAML\x20file\x20path\x20is\x20required','stats','Folder\x20ID\x20missing\x20from\x20resolved\x20path','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience\x22','resolvePathToResource','parentFolder','SELECT\x20*\x20FROM\x20(\x0a','getSegmentSQL','Use:\x20tdx\x20ps\x20view','Target\x20path:\x20','Get\x20SQL\x20query\x20for\x20child\x20segment','/app/ps/','segmentPath','✔\x20Created\x20folder\x20\x27','INVALID_ARGUMENT','information_schema','\x20\x20tdx\x20segment\x20describe\x20\x22High\x20Value\x22\x20\x20\x20\x20#\x20Relative\x20to\x20current\x20context','Error:\x20Cannot\x20execute\x20SQL\x20query\x20on\x20a\x20folder.','\x20[Job\x20ID:\x20','\x20\x20tdx\x20sg\x20sql\x20--path\x20segments/my-audience/premium-users.yml','log','folder','Use:\x20tdx\x20ps\x20view\x20-w','segment:folder:create','\x20\x20Local\x20YAML\x20file:\x20\x20\x20\x20\x20\x20tdx\x20sg\x20sql\x20--path\x20<file-path>','Cannot\x20get\x20SQL\x20query\x20for\x20a\x20folder.\x20Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.','format','Parent\x20name:\x20','7pfAiks','resolveFolderId','path','Resolved\x20relative\x20path\x20to:\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20show\x20<path/to/segment.yml>','description','\x20\x20tdx\x20sg\x20desc\x20segments/my-audience/premium-users.yml','Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required','Error:\x20Parent\x20segment\x20name\x20is\x20required','✔\x20Found\x20','segment:view','✔\x20Query\x20completed:\x20Processed\x20','Fetching\x20segment\x20details...','segmentId','Resolved\x20parent\x20ID:\x20','length','message','(root)','data','red','green','getFolder','getParent','getSegmentSQLFromYaml','Site:\x20','Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20','Resolving\x20parent\x20segment\x20\x27','/e/','web','getSQLFromServerSegment','Examples:','jobId','cyan','error','\x20folder','name','Show\x20segment\x20or\x20folder\x20details','parentId','segment','\x20Opening\x20','\x20\x20tdx\x20sg\x20show\x20\x22Premium\x20Users\x22','segment:folder:show','site','Segment\x20ID\x20missing\x20from\x20resolved\x20path','3HwEejo','replace','Error:\x20Parent\x20segment\x20name\x20and\x20folder\x20name\x20are\x20required','content','Usage:','Show\x20folder\x20or\x20child\x20segment\x20details','Usage:\x20tdx\x20segment\x20folder\x20create\x20<parent_name>\x20<folder_name>\x20[options]','Fetching\x20folder\x20\x27','166903tCzhYW','execute','3874998LaeZmF','Executing\x20segment\x20query...','Show\x20segment\x20folder\x20details','Error:\x20Path\x20or\x20name\x20is\x20required','Usage:\x20tdx\x20segment\x20folder\x20list\x20<parent_name>','51110KBRlSX','elapsedTimeMillis','SQL\x20query:\x0a','SEGMENT_NOT_FOUND','segment:desc','Resolved\x20folder\x20ID:\x20','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20view\x20<path/to/segment.yml>','Error:\x20Folder\x20reference\x20is\x20required','1290XxwRkm','Use:\x20tdx\x20sg\x20view\x20<name>\x20\x20#\x20To\x20show\x20folder\x20details','Parent\x20ID:\x20','listFolders','folderId','Fetching\x20folder\x20details...','Usage:\x20tdx\x20segment\x20folder\x20show\x20<parent_name/folder_name>','Fetching\x20SQL\x20from\x20rule...','Resolving\x20path\x20\x27','Error:\x20Folder\x20name\x20is\x20required\x20(use\x20parent_name/folder_name\x20format)','jsonl','Error:\x20Cannot\x20show\x20schema\x20for\x20a\x20folder.','Resolved\x20parent\x20folder\x20ID:\x20','segmentName','\x20\x20Server-side\x20segment:\x20\x20tdx\x20sg\x20sql\x20<name>','trim','\x20\x20Cause:\x20','fullPath','Error:\x20YAML\x20file\x20paths\x20must\x20be\x20specified\x20with\x20--path\x20option','createFolder','3093268SxIiKU','Error:\x20','getSegment','Usage:\x20tdx\x20sg\x20show\x20<name>','SEGMENT_FOLDER_NOT_FOUND','url','Folder\x20ID:\x20','segment:sql','\x20\x20tdx\x20sg\x20view\x20segments/my-audience/premium-users.yml','\x27...','Usage:\x20tdx\x20sg\x20desc\x20<name>','Resolved\x20YAML\x20file:\x20','getSQLFromYamlFile','verbose','toLocaleString','6085904AJQqWE','cause','Fetching\x20parent\x20segment\x20details...','\x20\x20Folder\x20path:\x20','\x20\x20tdx\x20sg\x20view\x20\x22Marketing\x22\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20folder\x20details','setJobId','Resolved\x20type:\x20','Resolved:\x20','10207899ZBThuj'];a37_0x4d6b=function(){return _0x6cd760;};return a37_0x4d6b();}import{parseSegmentRef}from'../sdk/segment/segment-ref-parser.js';function a37_0x5f4b(_0x18a850,_0x5cb161){_0x18a850=_0x18a850-0x8e;const _0x4d6b0e=a37_0x4d6b();let _0x5f4b89=_0x4d6b0e[_0x18a850];return _0x5f4b89;}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_0x1c799a from'chalk';async function resolveSegmentTarget(_0x12d552,_0x5466d4,_0x360f6a){const _0x29209f=a37_0x5f4b;if(isYamlFilePath(_0x12d552))try{const _0x50fd74=await resolveYamlFilePath(_0x12d552);return _0x360f6a&&(console[_0x29209f(0x10c)](_0x29209f(0xaa)+_0x12d552),console[_0x29209f(0x10c)](_0x29209f(0xc0)+_0x50fd74[_0x29209f(0xbd)]),console[_0x29209f(0x10c)]('\x20\x20Segment\x20name:\x20'+_0x50fd74['segmentName']),console[_0x29209f(0x10c)](_0x29209f(0xb1)+(_0x50fd74['folderPath']||_0x29209f(0xfc))),console[_0x29209f(0x10c)]('\x20\x20Full\x20path:\x20'+_0x50fd74[_0x29209f(0x9c)])),_0x50fd74[_0x29209f(0x9c)];}catch(_0x4ceade){throw new SDKError(ErrorCode[_0x29209f(0xdd)],_0x29209f(0x104)+_0x4ceade[_0x29209f(0xfb)]);}if(!_0x5466d4)throw new SDKError(ErrorCode['INVALID_ARGUMENT'],'No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22');return _0x5466d4+'/'+_0x12d552;}export class SegmentDescribeCommand extends BaseCommand{[a37_0x522e52(0x10e)]='segment:describe';['description']=a37_0x522e52(0x10f);async['execute'](_0x2a3041){const _0xa25dc6=a37_0x522e52,{options:_0x7597c5,args:_0x596e16,tdx:_0x5a71a8}=_0x2a3041,_0xbccf3e=_0x596e16[0x0],_0x5728ba=!_0xbccf3e&&!!_0x7597c5['parentSegment'],_0x1d5419=_0xbccf3e||_0x7597c5['parentSegment'];if(!_0x1d5419)return console[_0xa25dc6(0x10c)](_0xa25dc6(0x124)),console[_0xa25dc6(0x10c)](_0xa25dc6(0xc9)),console[_0xa25dc6(0x10c)](_0xa25dc6(0x109)),console[_0xa25dc6(0x10c)](_0xa25dc6(0xd2)),console[_0xa25dc6(0x10c)](_0xa25dc6(0xc8)),console[_0xa25dc6(0x10c)](_0xa25dc6(0xdf)),console['error'](_0xa25dc6(0xc2)),0x1;try{const _0x54c798=_0x7597c5[_0xa25dc6(0xdb)];let _0x2209e0=_0x1d5419;!_0x5728ba&&_0x54c798&&!_0x1d5419['includes']('/')&&(_0x2209e0=_0x54c798+'/'+_0x1d5419,_0x7597c5[_0xa25dc6(0xac)]&&console[_0xa25dc6(0x10c)](_0xa25dc6(0xee)+_0x2209e0));const _0x1714e9=await withSpinner(_0xa25dc6(0x93)+_0x2209e0+'\x27...',()=>_0x5a71a8[_0xa25dc6(0x111)][_0xa25dc6(0xd3)](_0x2209e0),{'verbose':_0x7597c5['verbose']}),_0x573894=_0x1714e9[_0xa25dc6(0xfd)];_0x7597c5[_0xa25dc6(0xac)]&&(console[_0xa25dc6(0x10c)]('Resolved\x20type:\x20'+_0x573894[_0xa25dc6(0xc7)]),console[_0xa25dc6(0x10c)](_0xa25dc6(0x131)+_0x573894['parentId']),_0x573894[_0xa25dc6(0x8f)]&&console[_0xa25dc6(0x10c)](_0xa25dc6(0xa5)+_0x573894['folderId']),_0x573894['segmentId']&&console[_0xa25dc6(0x10c)](_0xa25dc6(0xcc)+_0x573894[_0xa25dc6(0xf8)]));if(_0x573894[_0xa25dc6(0xc7)]===_0xa25dc6(0xc4)){const _0x291a4d=await withSpinner(_0xa25dc6(0xb0),()=>_0x5a71a8[_0xa25dc6(0x111)][_0xa25dc6(0x101)](_0x573894[_0xa25dc6(0x110)]),{'verbose':_0x7597c5[_0xa25dc6(0xac)]});await handleSingleObjectOutput(_0x291a4d[_0xa25dc6(0xfd)],_0x7597c5);}else{if(_0x573894[_0xa25dc6(0xc7)]===_0xa25dc6(0xe4)){if(!_0x573894[_0xa25dc6(0x8f)])throw new SDKError(ErrorCode[_0xa25dc6(0xa3)],_0xa25dc6(0xd1));const _0x21f17e=await withSpinner(_0xa25dc6(0x90),()=>_0x5a71a8[_0xa25dc6(0x111)]['getFolder'](_0x573894['folderId']),{'verbose':_0x7597c5[_0xa25dc6(0xac)]});await handleSingleObjectOutput(_0x21f17e[_0xa25dc6(0xfd)],_0x7597c5);}else{if(_0x573894[_0xa25dc6(0xc7)]===_0xa25dc6(0x111)){if(!_0x573894[_0xa25dc6(0xf8)])throw new SDKError(ErrorCode[_0xa25dc6(0x129)],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x308f4b=await withSpinner(_0xa25dc6(0xf7),()=>_0x5a71a8['segment'][_0xa25dc6(0xa1)](_0x573894[_0xa25dc6(0x110)],_0x573894[_0xa25dc6(0xf8)]),{'verbose':_0x7597c5['verbose']});await handleSingleObjectOutput(_0x308f4b[_0xa25dc6(0xfd)],_0x7597c5);}}}return 0x0;}catch(_0x4e18bc){if(_0x4e18bc instanceof SDKError)return console[_0xa25dc6(0x10c)](_0xa25dc6(0xa0)+_0x4e18bc[_0xa25dc6(0xfb)]),_0x4e18bc[_0xa25dc6(0xaf)]&&console['error'](_0xa25dc6(0x9b)+_0x4e18bc[_0xa25dc6(0xaf)]),0x1;throw _0x4e18bc;}}}export class SegmentShowCommand extends BaseCommand{[a37_0x522e52(0x10e)]='segment:show';[a37_0x522e52(0xf0)]='Execute\x20child\x20segment\x20SQL\x20query\x20and\x20show\x20results';async[a37_0x522e52(0x120)](_0x5d38ab){const _0x43c319=a37_0x522e52,{options:_0x8da0c7,args:_0x3705ba,tdx:_0x1c36ce}=_0x5d38ab,_0x40c021=_0x3705ba[0x0];if(!_0x40c021)return console[_0x43c319(0x10c)](_0x43c319(0xf2)),console[_0x43c319(0x10c)](_0x43c319(0xa2)),console[_0x43c319(0x10c)](_0x43c319(0xef)),console[_0x43c319(0x10c)](_0x43c319(0x109)),console[_0x43c319(0x10c)](_0x43c319(0x113)),console[_0x43c319(0x10c)]('\x20\x20tdx\x20sg\x20show\x20segments/my-audience/premium-users.yml'),0x1;try{const _0x11648b=_0x8da0c7['parentSegment'],_0x9d032c=await resolveSegmentTarget(_0x40c021,_0x11648b,_0x8da0c7[_0x43c319(0xac)]);_0x8da0c7[_0x43c319(0xac)]&&console[_0x43c319(0x10c)](_0x43c319(0xd8)+_0x9d032c);const _0xdb7295=await withSpinner(_0x43c319(0xca)+_0x40c021+'\x27...',()=>_0x1c36ce[_0x43c319(0x111)]['resolvePathToResource'](_0x9d032c),{'verbose':_0x8da0c7[_0x43c319(0xac)]}),_0x3a9226=_0xdb7295[_0x43c319(0xfd)];_0x8da0c7[_0x43c319(0xac)]&&(console[_0x43c319(0x10c)](_0x43c319(0xb4)+_0x3a9226[_0x43c319(0xc7)]),console['error'](_0x43c319(0x131)+_0x3a9226[_0x43c319(0x110)]));if(_0x3a9226['type']==='folder')return console[_0x43c319(0x10c)](_0x43c319(0xe0)),console['error'](_0x43c319(0x130)),0x1;if(_0x3a9226[_0x43c319(0xc7)]===_0x43c319(0xc4))return console['error']('Error:\x20Cannot\x20execute\x20query\x20for\x20parent\x20segment\x20with\x20this\x20command.'),console[_0x43c319(0x10c)]('Use:\x20tdx\x20ps\x20show'),0x1;if(!_0x3a9226['segmentId'])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x43c319(0x116));const _0xa07068=await withSpinner('Fetching\x20SQL\x20for\x20segment...',()=>_0x1c36ce[_0x43c319(0x111)][_0x43c319(0xd6)](_0x3a9226[_0x43c319(0x110)],_0x3a9226[_0x43c319(0xf8)]),{'verbose':_0x8da0c7[_0x43c319(0xac)]});let _0xda11d=_0xa07068[_0x43c319(0xfd)];const _0xea89da=resolveLimit(_0x8da0c7['limit'],DEFAULT_DISPLAY_LIMIT),_0x3f9385=/\bLIMIT\s+\d+/i['test'](_0xda11d);!_0x3f9385&&(_0xda11d=_0xda11d[_0x43c319(0x9a)]()[_0x43c319(0x118)](/;+$/,''),_0xda11d=_0x43c319(0xd5)+_0xda11d+_0x43c319(0x12c)+_0xea89da);_0x8da0c7[_0x43c319(0xac)]&&console['error'](_0x43c319(0x128)+_0xda11d);const _0x273dfc=await withProgressSpinner(_0x43c319(0x122),async _0x4c89fd=>{const _0x18807b=_0x43c319,_0x450b16=await _0x1c36ce['query'][_0x18807b(0x120)](_0xda11d,{'catalog':'td','schema':_0x18807b(0xde),'onJobId':_0x6cfa8c=>{const _0x5b418b=_0x18807b;_0x4c89fd[_0x5b418b(0xb3)](_0x6cfa8c);}});return _0x450b16;},{'verbose':_0x8da0c7[_0x43c319(0xac)]}),_0x175638=_0x273dfc[_0x43c319(0xfd)],_0x79f818=_0x175638['jobId']?_0x43c319(0xe1)+_0x175638[_0x43c319(0x10a)]+']':'';return console['error'](_0x43c319(0xf6)+_0x175638[_0x43c319(0xd0)]['processedRows'][_0x43c319(0xad)]()+'\x20rows\x20'+('in\x20'+formatElapsed(_0x175638[_0x43c319(0xd0)][_0x43c319(0x127)])+_0x79f818)),await handleQueryOutput(_0x175638,_0x8da0c7),0x0;}catch(_0x2003a7){if(_0x2003a7 instanceof SDKError)return console[_0x43c319(0x10c)]('✖\x20Query\x20failed\x20['+_0x2003a7[_0x43c319(0xcb)]+']'),console[_0x43c319(0x10c)]('\x0a'+_0x2003a7[_0x43c319(0xfb)]),0x1;throw _0x2003a7;}}}export class SegmentFolderListCommand extends BaseCommand{['name']='segment:folder:list';[a37_0x522e52(0xf0)]='List\x20segment\x20folders\x20under\x20a\x20parent\x20segment';async[a37_0x522e52(0x120)](_0x9825f0){const _0x5f53fb=a37_0x522e52,{options:_0x18159e,args:_0x49e795,tdx:_0x551bf8}=_0x9825f0;if(_0x49e795['length']===0x0)return console['error'](_0x5f53fb(0xf3)),console[_0x5f53fb(0x10c)](_0x5f53fb(0x125)),0x1;const _0x5c8bd0=_0x49e795[0x0];try{_0x18159e[_0x5f53fb(0xac)]&&(console['error'](_0x5f53fb(0x103)+_0x18159e['site']),console['error']('Parent\x20name:\x20'+_0x5c8bd0));const _0x5d5461=await withSpinner(_0x5f53fb(0x105)+_0x5c8bd0+_0x5f53fb(0xa8),()=>_0x551bf8[_0x5f53fb(0x111)]['resolveParentId'](_0x5c8bd0),{'verbose':_0x18159e[_0x5f53fb(0xac)]}),_0x2e0c74=_0x5d5461[_0x5f53fb(0xfd)];_0x18159e['verbose']&&console[_0x5f53fb(0x10c)](_0x5f53fb(0xf9)+_0x2e0c74);const _0x4db4ab=await withSpinner('Listing\x20folders\x20for\x20parent\x20\x27'+_0x5c8bd0+_0x5f53fb(0xa8),()=>_0x551bf8[_0x5f53fb(0x111)][_0x5f53fb(0x8e)](_0x2e0c74),{'verbose':_0x18159e['verbose']}),_0x2164c1=_0x4db4ab[_0x5f53fb(0xfd)];return console[_0x5f53fb(0x10c)](_0x5f53fb(0xf4)+_0x2164c1[_0x5f53fb(0xfa)]+_0x5f53fb(0x10d)+(_0x2164c1[_0x5f53fb(0xfa)]!==0x1?'s':'')),await handleSDKOutput(_0x2164c1,_0x18159e),0x0;}catch(_0x2013a1){if(_0x2013a1 instanceof SDKError)return console[_0x5f53fb(0x10c)]('Error:\x20'+_0x2013a1[_0x5f53fb(0xfb)]),_0x2013a1[_0x5f53fb(0xaf)]&&console['error'](_0x5f53fb(0x9b)+_0x2013a1[_0x5f53fb(0xaf)]),0x1;throw _0x2013a1;}}}export class SegmentFolderShowCommand extends BaseCommand{[a37_0x522e52(0x10e)]=a37_0x522e52(0x114);[a37_0x522e52(0xf0)]=a37_0x522e52(0x123);async[a37_0x522e52(0x120)](_0x1c95e0){const _0x3ea9bd=a37_0x522e52,{options:_0x5015ab,args:_0x3194b6,tdx:_0x1d7ba9}=_0x1c95e0;if(_0x3194b6[_0x3ea9bd(0xfa)]===0x0)return console[_0x3ea9bd(0x10c)](_0x3ea9bd(0x12e)),console[_0x3ea9bd(0x10c)](_0x3ea9bd(0x91)),0x1;try{const {parentId:_0x5ed1a8,childId:_0x5805d8}=parseSegmentRef(_0x3194b6[0x0]);_0x5015ab[_0x3ea9bd(0xac)]&&(console[_0x3ea9bd(0x10c)](_0x3ea9bd(0x103)+_0x5015ab[_0x3ea9bd(0x115)]),console['error'](_0x3ea9bd(0xea)+_0x5ed1a8),_0x5805d8&&console[_0x3ea9bd(0x10c)](_0x3ea9bd(0xc1)+_0x5805d8));if(!_0x5805d8)return console[_0x3ea9bd(0x10c)](_0x3ea9bd(0x94)),0x1;const _0x5edea1=await withSpinner(_0x3ea9bd(0x105)+_0x5ed1a8+_0x3ea9bd(0xa8),()=>_0x1d7ba9['segment'][_0x3ea9bd(0xbc)](_0x5ed1a8),{'verbose':_0x5015ab[_0x3ea9bd(0xac)]}),_0x517064=_0x5edea1[_0x3ea9bd(0xfd)];_0x5015ab[_0x3ea9bd(0xac)]&&console[_0x3ea9bd(0x10c)](_0x3ea9bd(0xf9)+_0x517064);const _0x1ab75b=await withSpinner('Resolving\x20folder\x20\x27'+_0x5805d8+_0x3ea9bd(0xa8),()=>_0x1d7ba9['segment'][_0x3ea9bd(0xec)](_0x517064,_0x5805d8),{'verbose':_0x5015ab[_0x3ea9bd(0xac)]}),_0x22ea3a=_0x1ab75b[_0x3ea9bd(0xfd)];_0x5015ab['verbose']&&console[_0x3ea9bd(0x10c)](_0x3ea9bd(0x12b)+_0x22ea3a);const _0x1a671f=await withSpinner(_0x3ea9bd(0x11e)+_0x5805d8+_0x3ea9bd(0xa8),()=>_0x1d7ba9[_0x3ea9bd(0x111)]['getFolder'](_0x22ea3a),{'verbose':_0x5015ab[_0x3ea9bd(0xac)]});return await handleSDKOutput([_0x1a671f[_0x3ea9bd(0xfd)]],_0x5015ab),0x0;}catch(_0x40a9be){if(_0x40a9be instanceof SDKError)return console[_0x3ea9bd(0x10c)](_0x3ea9bd(0xa0)+_0x40a9be['message']),_0x40a9be[_0x3ea9bd(0xaf)]&&console[_0x3ea9bd(0x10c)](_0x3ea9bd(0x9b)+_0x40a9be[_0x3ea9bd(0xaf)]),0x1;throw _0x40a9be;}}}export class SegmentSQLCommand extends BaseCommand{[a37_0x522e52(0x10e)]=a37_0x522e52(0xa6);[a37_0x522e52(0xf0)]=a37_0x522e52(0xd9);async[a37_0x522e52(0x120)](_0x3c9f8f){const _0x1aedf0=a37_0x522e52,{options:_0x4411e0,args:_0x556153}=_0x3c9f8f,_0x41c804=_0x4411e0,_0x3eee49=_0x41c804[_0x1aedf0(0xed)],_0x3b76ae=_0x556153[0x0];if(!_0x3b76ae&&!_0x3eee49)return console[_0x1aedf0(0x10c)](a37_0x1c799a[_0x1aedf0(0xfe)]('Error:\x20Segment\x20name\x20or\x20--path\x20is\x20required')),console[_0x1aedf0(0x10c)](_0x1aedf0(0x11b)),console[_0x1aedf0(0x10c)](_0x1aedf0(0x99)),console[_0x1aedf0(0x10c)](_0x1aedf0(0xe7)),console[_0x1aedf0(0x10c)](_0x1aedf0(0x109)),console[_0x1aedf0(0x10c)](_0x1aedf0(0xc5)),console[_0x1aedf0(0x10c)](_0x1aedf0(0xe2)),0x1;if(_0x3b76ae&&_0x3eee49)return console[_0x1aedf0(0x10c)](a37_0x1c799a[_0x1aedf0(0xfe)]('Error:\x20Specify\x20either\x20segment\x20name\x20or\x20--path,\x20not\x20both')),0x1;try{let _0x4933ba;if(_0x3eee49)_0x4933ba=await this['getSQLFromYamlFile'](_0x3eee49,_0x3c9f8f);else{if(isYamlFilePath(_0x3b76ae))return console[_0x1aedf0(0x10c)](a37_0x1c799a['red'](_0x1aedf0(0x9d))),console[_0x1aedf0(0x10c)](_0x1aedf0(0xbf)+_0x3b76ae),0x1;else _0x4933ba=await this['getSQLFromServerSegment'](_0x3b76ae,_0x3c9f8f);}return _0x4411e0[_0x1aedf0(0xe9)]==='json'||_0x4411e0[_0x1aedf0(0xe9)]===_0x1aedf0(0x95)?await handleSDKOutput([{'sql':_0x4933ba}],_0x4411e0):console[_0x1aedf0(0xe3)](_0x4933ba),0x0;}catch(_0x30dfea){if(_0x30dfea instanceof SDKError)return console[_0x1aedf0(0x10c)](_0x1aedf0(0xa0)+_0x30dfea[_0x1aedf0(0xfb)]),_0x30dfea[_0x1aedf0(0xaf)]&&console[_0x1aedf0(0x10c)](_0x1aedf0(0x9b)+_0x30dfea[_0x1aedf0(0xaf)]),0x1;throw _0x30dfea;}}async[a37_0x522e52(0xab)](_0x58834a,_0x5b2578){const _0x363fb7=a37_0x522e52,{options:_0x3593a4,tdx:_0x1830b3}=_0x5b2578;let _0xe57eda;try{_0xe57eda=await resolveYamlFilePath(_0x58834a);}catch(_0x29e2c1){throw new SDKError(ErrorCode[_0x363fb7(0xdd)],_0x363fb7(0x104)+_0x29e2c1[_0x363fb7(0xfb)]);}_0x3593a4['verbose']&&console[_0x363fb7(0x10c)](_0x363fb7(0xb5)+_0xe57eda[_0x363fb7(0xbd)]+'/'+_0xe57eda[_0x363fb7(0x98)]);const _0x408544=await withSpinner(_0x363fb7(0x92),()=>_0x1830b3[_0x363fb7(0x111)][_0x363fb7(0x102)](_0xe57eda[_0x363fb7(0x11a)],_0xe57eda[_0x363fb7(0xbd)],_0xe57eda[_0x363fb7(0x98)]),{'verbose':_0x3593a4[_0x363fb7(0xac)]});return _0x408544[_0x363fb7(0xfd)];}async[a37_0x522e52(0x108)](_0x1c831e,_0x4cd966){const _0x2b1a2e=a37_0x522e52,{options:_0x49160d,tdx:_0x249e04}=_0x4cd966,_0x183b87=_0x49160d[_0x2b1a2e(0xbd)],_0x9ce462=await resolveSegmentTarget(_0x1c831e,_0x183b87,_0x49160d[_0x2b1a2e(0xac)]);_0x49160d['verbose']&&console[_0x2b1a2e(0x10c)](_0x2b1a2e(0xd8)+_0x9ce462);const _0x37eb09=await withSpinner(_0x2b1a2e(0xca)+_0x1c831e+'\x27...',()=>_0x249e04[_0x2b1a2e(0x111)]['resolvePathToResource'](_0x9ce462),{'verbose':_0x49160d[_0x2b1a2e(0xac)]}),_0x1fd2ff=_0x37eb09[_0x2b1a2e(0xfd)];_0x49160d[_0x2b1a2e(0xac)]&&(console[_0x2b1a2e(0x10c)](_0x2b1a2e(0xb4)+_0x1fd2ff['type']),console[_0x2b1a2e(0x10c)](_0x2b1a2e(0x131)+_0x1fd2ff['parentId']));if(_0x1fd2ff[_0x2b1a2e(0xc7)]===_0x2b1a2e(0xe4))throw new SDKError(ErrorCode[_0x2b1a2e(0xdd)],_0x2b1a2e(0xe8));if(_0x1fd2ff[_0x2b1a2e(0xc7)]===_0x2b1a2e(0xc4))throw new SDKError(ErrorCode['INVALID_ARGUMENT'],'Cannot\x20get\x20SQL\x20for\x20parent\x20segment\x20with\x20this\x20command.\x20Use:\x20tdx\x20ps\x20sql');if(!_0x1fd2ff[_0x2b1a2e(0xf8)])throw new SDKError(ErrorCode[_0x2b1a2e(0x129)],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x4d4139=await withSpinner(_0x2b1a2e(0xcd),()=>_0x249e04[_0x2b1a2e(0x111)][_0x2b1a2e(0xd6)](_0x1fd2ff['parentId'],_0x1fd2ff[_0x2b1a2e(0xf8)]),{'verbose':_0x49160d['verbose']});return _0x4d4139[_0x2b1a2e(0xfd)];}}export class SegmentFolderCreateCommand extends BaseCommand{[a37_0x522e52(0x10e)]=a37_0x522e52(0xe6);[a37_0x522e52(0xf0)]=a37_0x522e52(0xc3);async['execute'](_0x44f07f){const _0x36ccc8=a37_0x522e52,{options:_0x30b6ec,args:_0x5dba10,tdx:_0x222c9c}=_0x44f07f,_0x3c6882=_0x30b6ec;if(_0x5dba10[_0x36ccc8(0xfa)]<0x2)return console[_0x36ccc8(0x10c)](_0x36ccc8(0x119)),console[_0x36ccc8(0x10c)](_0x36ccc8(0x11d)),0x1;const _0x3b8d97=_0x5dba10[0x0],_0x5a48c3=_0x5dba10[0x1];_0x3c6882[_0x36ccc8(0xac)]&&(console[_0x36ccc8(0x10c)](_0x36ccc8(0x103)+_0x3c6882[_0x36ccc8(0x115)]),console[_0x36ccc8(0x10c)]('Parent\x20segment:\x20'+_0x3b8d97),console['error']('Folder\x20name:\x20'+_0x5a48c3));let _0x5dc2dd;if(_0x3c6882[_0x36ccc8(0xd4)]){const _0x3c40b3=_0x3c6882[_0x36ccc8(0xd4)],_0x442b19=await withSpinner(_0x36ccc8(0x105)+_0x3b8d97+_0x36ccc8(0xa8),()=>_0x222c9c[_0x36ccc8(0x111)]['resolveParentId'](_0x3b8d97),{'verbose':_0x3c6882[_0x36ccc8(0xac)]}),_0x5325d3=_0x442b19[_0x36ccc8(0xfd)],_0x2dd73c=await withSpinner(_0x36ccc8(0xba)+_0x3c40b3+_0x36ccc8(0xa8),()=>_0x222c9c['segment'][_0x36ccc8(0xec)](_0x5325d3,_0x3c40b3),{'verbose':_0x3c6882[_0x36ccc8(0xac)]});_0x5dc2dd=_0x2dd73c['data'],_0x3c6882[_0x36ccc8(0xac)]&&console[_0x36ccc8(0x10c)](_0x36ccc8(0x97)+_0x5dc2dd);}const _0x230efa={'name':_0x5a48c3,'description':_0x3c6882[_0x36ccc8(0xf0)],'parentFolderId':_0x5dc2dd},_0x118210=await withSpinner('Creating\x20folder\x20\x27'+_0x5a48c3+_0x36ccc8(0xa8),()=>_0x222c9c[_0x36ccc8(0x111)][_0x36ccc8(0x9e)](_0x3b8d97,_0x230efa),{'verbose':_0x3c6882[_0x36ccc8(0xac)]}),_0x1e5209=_0x118210[_0x36ccc8(0xfd)];return console['error'](_0x36ccc8(0xdc)+_0x1e5209[_0x36ccc8(0x10e)]+'\x27\x20with\x20ID:\x20'+_0x1e5209['id']),await handleSDKOutput([_0x1e5209],_0x3c6882),0x0;}}export class SegmentViewCommand extends BaseCommand{[a37_0x522e52(0x10e)]=a37_0x522e52(0xf5);[a37_0x522e52(0xf0)]=a37_0x522e52(0x11c);async[a37_0x522e52(0x120)](_0x100921){const _0x2d909e=a37_0x522e52,{options:_0x4d78a7,args:_0x5df456,tdx:_0x5e6bd3}=_0x100921,_0xabf742=_0x5df456[0x0];if(!_0xabf742)return console[_0x2d909e(0x10c)](_0x2d909e(0xcf)),console[_0x2d909e(0x10c)]('Usage:\x20tdx\x20sg\x20view\x20<name>\x20[-w]'),console['error'](_0x2d909e(0x12d)),console[_0x2d909e(0x10c)]('Options:'),console[_0x2d909e(0x10c)]('\x20\x20-w,\x20--web\x20\x20Open\x20segment\x20in\x20web\x20browser'),console[_0x2d909e(0x10c)](_0x2d909e(0x109)),console[_0x2d909e(0x10c)](_0x2d909e(0xb2)),console['error']('\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20\x20\x20\x20\x20#\x20View\x20child\x20segment\x20details'),console[_0x2d909e(0x10c)](_0x2d909e(0xbe)),console[_0x2d909e(0x10c)](_0x2d909e(0xa7)),0x1;try{const _0x1b7698=_0x4d78a7[_0x2d909e(0xbd)],_0x53833d=await resolveSegmentTarget(_0xabf742,_0x1b7698,_0x4d78a7['verbose']);_0x4d78a7[_0x2d909e(0xac)]&&console[_0x2d909e(0x10c)](_0x2d909e(0xd8)+_0x53833d);const _0x1839cd=await withSpinner(_0x2d909e(0xca)+_0xabf742+_0x2d909e(0xa8),()=>_0x5e6bd3[_0x2d909e(0x111)][_0x2d909e(0xd3)](_0x53833d),{'verbose':_0x4d78a7['verbose']}),_0x3b92a2=_0x1839cd[_0x2d909e(0xfd)];_0x4d78a7[_0x2d909e(0xac)]&&(console[_0x2d909e(0x10c)](_0x2d909e(0xb4)+_0x3b92a2['type']),console['error'](_0x2d909e(0x131)+_0x3b92a2[_0x2d909e(0x110)]),_0x3b92a2[_0x2d909e(0x8f)]&&console[_0x2d909e(0x10c)](_0x2d909e(0xa5)+_0x3b92a2[_0x2d909e(0x8f)]),_0x3b92a2[_0x2d909e(0xf8)]&&console[_0x2d909e(0x10c)](_0x2d909e(0xcc)+_0x3b92a2[_0x2d909e(0xf8)]));if(_0x4d78a7[_0x2d909e(0x107)]){if(_0x3b92a2[_0x2d909e(0xc7)]===_0x2d909e(0xe4))return console[_0x2d909e(0x10c)]('Error:\x20Cannot\x20open\x20folder\x20in\x20web\x20browser.\x20Use\x20a\x20segment\x20name\x20instead.'),0x1;if(_0x3b92a2['type']===_0x2d909e(0xc4))return console[_0x2d909e(0x10c)]('Error:\x20Cannot\x20open\x20parent\x20segment\x20with\x20this\x20command.'),console['error'](_0x2d909e(0xe5)),0x1;if(!_0x3b92a2[_0x2d909e(0xf8)])throw new SDKError(ErrorCode[_0x2d909e(0x129)],_0x2d909e(0x116));const _0x241036=getConsoleNextUrl(_0x4d78a7['site'],_0x2d909e(0xda)+_0x3b92a2[_0x2d909e(0x110)]+_0x2d909e(0x106)+_0x3b92a2['segmentId']);return console['error'](a37_0x1c799a[_0x2d909e(0xff)]('✔')+_0x2d909e(0x112)+a37_0x1c799a[_0x2d909e(0x10b)](_0x241036)),openBrowser(_0x241036),0x0;}if(_0x3b92a2[_0x2d909e(0xc7)]===_0x2d909e(0xe4)){if(!_0x3b92a2[_0x2d909e(0x8f)])throw new SDKError(ErrorCode['SEGMENT_FOLDER_NOT_FOUND'],_0x2d909e(0xd1));const _0x5464cb=await withSpinner(_0x2d909e(0x90),()=>_0x5e6bd3[_0x2d909e(0x111)][_0x2d909e(0x100)](_0x3b92a2[_0x2d909e(0x8f)]),{'verbose':_0x4d78a7[_0x2d909e(0xac)]});await handleSingleObjectOutput(_0x5464cb['data'],_0x4d78a7);}else{if(_0x3b92a2[_0x2d909e(0xc7)]==='segment'){if(!_0x3b92a2[_0x2d909e(0xf8)])throw new SDKError(ErrorCode[_0x2d909e(0x129)],_0x2d909e(0x116));const _0x261a7c=await withSpinner(_0x2d909e(0xf7),()=>_0x5e6bd3[_0x2d909e(0x111)][_0x2d909e(0xa1)](_0x3b92a2['parentId'],_0x3b92a2[_0x2d909e(0xf8)]),{'verbose':_0x4d78a7[_0x2d909e(0xac)]}),_0x1314bc=getConsoleNextUrl(_0x4d78a7['site'],_0x2d909e(0xda)+_0x3b92a2['parentId']+_0x2d909e(0x106)+_0x3b92a2[_0x2d909e(0xf8)]),_0x1b8452=_0x261a7c[_0x2d909e(0xfd)];_0x1b8452[_0x2d909e(0xa4)]=_0x1314bc,await handleSingleObjectOutput(_0x1b8452,_0x4d78a7);}else return console[_0x2d909e(0x10c)](_0x2d909e(0xb7)),console[_0x2d909e(0x10c)](_0x2d909e(0xd7)),0x1;}return 0x0;}catch(_0x5648d7){if(_0x5648d7 instanceof SDKError)return console[_0x2d909e(0x10c)](_0x2d909e(0xa0)+_0x5648d7[_0x2d909e(0xfb)]),_0x5648d7['cause']&&console[_0x2d909e(0x10c)](_0x2d909e(0x9b)+_0x5648d7['cause']),0x1;throw _0x5648d7;}}}export const SegmentInfoCommand=SegmentViewCommand;export class SegmentDescCommand extends BaseCommand{[a37_0x522e52(0x10e)]=a37_0x522e52(0x12a);[a37_0x522e52(0xf0)]=a37_0x522e52(0xb9);async[a37_0x522e52(0x120)](_0x57dbcf){const _0x138dac=a37_0x522e52,{options:_0x330d9e,args:_0x4de30c,tdx:_0x17306c}=_0x57dbcf,_0x1bbbb6=_0x4de30c[0x0];if(!_0x1bbbb6)return console['error'](_0x138dac(0xf2)),console[_0x138dac(0x10c)](_0x138dac(0xa9)),console[_0x138dac(0x10c)]('\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20desc\x20<path/to/segment.yml>'),console['error'](_0x138dac(0x109)),console[_0x138dac(0x10c)](_0x138dac(0xbb)),console[_0x138dac(0x10c)](_0x138dac(0xf1)),0x1;try{const _0x115f2f=_0x330d9e[_0x138dac(0xbd)],_0x3beadf=await resolveSegmentTarget(_0x1bbbb6,_0x115f2f,_0x330d9e['verbose']);_0x330d9e['verbose']&&console['error'](_0x138dac(0xd8)+_0x3beadf);const _0x2791bd=await withSpinner(_0x138dac(0xca)+_0x1bbbb6+_0x138dac(0xa8),()=>_0x17306c[_0x138dac(0x111)][_0x138dac(0xd3)](_0x3beadf),{'verbose':_0x330d9e[_0x138dac(0xac)]}),_0x5eda64=_0x2791bd[_0x138dac(0xfd)];_0x330d9e[_0x138dac(0xac)]&&(console[_0x138dac(0x10c)]('Resolved\x20type:\x20'+_0x5eda64[_0x138dac(0xc7)]),console[_0x138dac(0x10c)]('Parent\x20ID:\x20'+_0x5eda64[_0x138dac(0x110)]));if(_0x5eda64[_0x138dac(0xc7)]===_0x138dac(0xe4))return console['error'](_0x138dac(0x96)),console[_0x138dac(0x10c)]('Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.'),0x1;if(_0x5eda64[_0x138dac(0xc7)]===_0x138dac(0xc4))return console['error'](_0x138dac(0xce)),console['error']('Use:\x20tdx\x20ps\x20desc'),0x1;if(!_0x5eda64[_0x138dac(0xf8)])throw new SDKError(ErrorCode[_0x138dac(0x129)],_0x138dac(0x116));const _0x5e24e0=await withSpinner(_0x138dac(0xcd),()=>_0x17306c[_0x138dac(0x111)][_0x138dac(0xd6)](_0x5eda64['parentId'],_0x5eda64[_0x138dac(0xf8)]),{'verbose':_0x330d9e[_0x138dac(0xac)]}),_0xfc3686=_0x5e24e0[_0x138dac(0xfd)],_0x353bd7=await executeSchemaQuery(_0xfc3686,_0x17306c,_0x330d9e);return await handleQueryOutput(_0x353bd7,_0x330d9e),0x0;}catch(_0x20fd0a){if(_0x20fd0a instanceof SDKError)return console[_0x138dac(0x10c)](_0x138dac(0xa0)+_0x20fd0a[_0x138dac(0xfb)]),_0x20fd0a['cause']&&console[_0x138dac(0x10c)](_0x138dac(0x9b)+_0x20fd0a[_0x138dac(0xaf)]),0x1;throw _0x20fd0a;}}}
@@ -1 +1 @@
1
- const a38_0x2336ae=a38_0xe1dc;(function(_0xc834b6,_0x24730a){const _0x402b14=a38_0xe1dc,_0xef83b2=_0xc834b6();while(!![]){try{const _0x4dd1cd=parseInt(_0x402b14(0xff))/0x1+parseInt(_0x402b14(0x10e))/0x2*(-parseInt(_0x402b14(0x11a))/0x3)+-parseInt(_0x402b14(0x106))/0x4*(-parseInt(_0x402b14(0x10d))/0x5)+-parseInt(_0x402b14(0x107))/0x6+parseInt(_0x402b14(0x114))/0x7*(-parseInt(_0x402b14(0x118))/0x8)+parseInt(_0x402b14(0x10b))/0x9+-parseInt(_0x402b14(0x112))/0xa*(-parseInt(_0x402b14(0xf3))/0xb);if(_0x4dd1cd===_0x24730a)break;else _0xef83b2['push'](_0xef83b2['shift']());}catch(_0x7c269b){_0xef83b2['push'](_0xef83b2['shift']());}}}(a38_0x3231,0xec970));import{BaseCommand}from'./command.js';function a38_0x3231(){const _0x587d4f=['segment:create','\x27\x20with\x20ID:\x20','Parent\x20path:\x20','error','segment','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/High\x20Value\x22\x20--rule\x20\x27...\x27','11vmsDdg','folderId','Usage:\x20tdx\x20segment\x20create\x20<parent/segment_name>\x20[options]','ruleFile','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/Marketing/Premium\x22\x20--rule\x20\x27...\x27','verbose','Usage:\x20tdx\x20segment\x20create\x20<path>\x20[options]','type','folder','Parent:\x20','Resolving\x20folder\x20path\x20\x27','segmentPath','906246haYOEJ','Resolving\x20folder\x20\x27','Resolved\x20folder\x20ID:\x20','\x20\x20Use\x20`tdx\x20sg\x20push`\x20with\x20YAML\x20files\x20instead.\x0a','length','\x27...','yellow','4FkcgdB','11416128gPKDLY','data','Error:\x20Cannot\x20create\x20segment\x20in\x20a\x20segment.\x20Parent\x20path\x20must\x20be\x20a\x20folder\x20or\x20parent.','Target\x20path:\x20','8500068jKEgif','Creating\x20segment\x20\x27','49930nnWteT','2stfqGZ','Segment\x20name:\x20','parent','⚠\x20Deprecation\x20warning:\x20`segment\x20create`\x20is\x20deprecated.','30332150cZiVAA','Resolved\x20relative\x20path\x20to:\x20','7vJgbMr','\x20\x20tdx\x20segment\x20create\x20\x22Premium\x22\x20--rule\x20\x27...\x27\x20\x20#\x20Relative\x20to\x20context','site','description','3474568vlQGzS','segments','4763454Toqvjh','invisible','Examples:','Site:\x20','resolveFolderId','includes','Error:\x20Full\x20path\x20required\x20(parent/segment_name\x20or\x20parent/folder/segment_name)','Create\x20child\x20segment\x20with\x20filtering\x20rules','resolveParentId','✔\x20Created\x20segment\x20\x27','rule','name'];a38_0x3231=function(){return _0x587d4f;};return a38_0x3231();}import{handleSDKOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import{loadJSONFromOptions}from'../utils/json-loader.js';import{parsePath,getParentPath,getBaseName}from'../sdk/segment/segment-path-parser.js';function a38_0xe1dc(_0x54f71a,_0x2d854f){_0x54f71a=_0x54f71a-0xf0;const _0x3231f7=a38_0x3231();let _0xe1dc0b=_0x3231f7[_0x54f71a];return _0xe1dc0b;}import a38_0xb2e06b from'chalk';export class SegmentCreateCommand extends BaseCommand{[a38_0x2336ae(0x125)]=a38_0x2336ae(0x126);[a38_0x2336ae(0x117)]=a38_0x2336ae(0x121);async['execute'](_0xecc3d7){const _0x24b432=a38_0x2336ae;console[_0x24b432(0xf0)](a38_0xb2e06b[_0x24b432(0x105)](_0x24b432(0x111))),console[_0x24b432(0xf0)](a38_0xb2e06b[_0x24b432(0x105)](_0x24b432(0x102)));const {options:_0x5f190d,args:_0xedb032,tdx:_0x320014}=_0xecc3d7,_0x436d1f=_0x5f190d;if(_0xedb032[_0x24b432(0x103)]===0x0)return console[_0x24b432(0xf0)]('Error:\x20Segment\x20path\x20or\x20name\x20is\x20required'),console[_0x24b432(0xf0)](_0x24b432(0xf9)),console[_0x24b432(0xf0)](_0x24b432(0x11c)),console['error'](_0x24b432(0xf2)),console['error'](_0x24b432(0xf7)),console[_0x24b432(0xf0)](_0x24b432(0x115)),0x1;const _0xbf1a7a=_0xedb032[0x0],_0xa6518f=_0x5f190d[_0x24b432(0xfe)];let _0x1c4c81=_0xbf1a7a;_0xa6518f&&!_0xbf1a7a[_0x24b432(0x11f)]('/')&&(_0x1c4c81=_0xa6518f+'/'+_0xbf1a7a,_0x436d1f[_0x24b432(0xf8)]&&console[_0x24b432(0xf0)](_0x24b432(0x113)+_0x1c4c81));const _0x32153e=parsePath(_0x1c4c81);if(_0x32153e[_0x24b432(0x119)][_0x24b432(0x103)]<0x2)return console[_0x24b432(0xf0)](_0x24b432(0x120)),console[_0x24b432(0xf0)](_0x24b432(0xf5)),0x1;const _0x2a5bc3=_0x32153e[_0x24b432(0x119)][0x0],_0x57e0dd=getBaseName(_0x1c4c81),_0xeaaff7=getParentPath(_0x1c4c81);_0x436d1f[_0x24b432(0xf8)]&&(console[_0x24b432(0xf0)](_0x24b432(0x11d)+_0x436d1f[_0x24b432(0x116)]),console[_0x24b432(0xf0)](_0x24b432(0x10a)+_0x1c4c81),console[_0x24b432(0xf0)](_0x24b432(0xfc)+_0x2a5bc3),console[_0x24b432(0xf0)](_0x24b432(0x10f)+_0x57e0dd),console[_0x24b432(0xf0)](_0x24b432(0x128)+_0xeaaff7));const _0x5ddbdf=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x2a5bc3+_0x24b432(0x104),()=>_0x320014[_0x24b432(0xf1)][_0x24b432(0x122)](_0x2a5bc3),{'verbose':_0x436d1f[_0x24b432(0xf8)]}),_0x15f77e=_0x5ddbdf[_0x24b432(0x108)];let _0x110fd0;if(_0x32153e['segments']['length']>0x2){const _0x1d2496=await withSpinner(_0x24b432(0xfd)+_0xeaaff7+_0x24b432(0x104),()=>_0x320014[_0x24b432(0xf1)]['resolvePathToResource'](_0xeaaff7),{'verbose':_0x436d1f[_0x24b432(0xf8)]}),_0x230d5d=_0x1d2496[_0x24b432(0x108)];if(_0x230d5d[_0x24b432(0xfa)]!=='folder'&&_0x230d5d[_0x24b432(0xfa)]!==_0x24b432(0x110))return console['error'](_0x24b432(0x109)),0x1;_0x110fd0=_0x230d5d[_0x24b432(0xf4)];}else{if(_0x436d1f[_0x24b432(0xfb)]){const _0x42c3ee=await withSpinner(_0x24b432(0x100)+_0x436d1f[_0x24b432(0xfb)]+_0x24b432(0x104),()=>_0x320014['segment'][_0x24b432(0x11e)](_0x15f77e,_0x436d1f[_0x24b432(0xfb)]),{'verbose':_0x436d1f[_0x24b432(0xf8)]});_0x110fd0=_0x42c3ee['data'];}}_0x436d1f['verbose']&&_0x110fd0&&console[_0x24b432(0xf0)](_0x24b432(0x101)+_0x110fd0);const _0x58dfdf=await loadJSONFromOptions(_0x436d1f[_0x24b432(0x124)],_0x436d1f[_0x24b432(0xf6)]),_0x13f3a1={'name':_0x57e0dd,'description':_0x436d1f[_0x24b432(0x117)],'rule':_0x58dfdf,'kind':_0x436d1f['kind']!==undefined?parseInt(_0x436d1f['kind'],0xa):undefined,'isVisible':_0x436d1f[_0x24b432(0x11b)]?![]:undefined,'segmentFolderId':_0x110fd0,'countPopulation':_0x436d1f['noCountPopulation']?![]:undefined},_0x13c2e8=await withSpinner(_0x24b432(0x10c)+_0x57e0dd+'\x27...',()=>_0x320014[_0x24b432(0xf1)]['createSegment'](_0x15f77e,_0x13f3a1),{'verbose':_0x436d1f[_0x24b432(0xf8)]}),_0x26f53e=_0x13c2e8[_0x24b432(0x108)];return console[_0x24b432(0xf0)](_0x24b432(0x123)+_0x26f53e['name']+_0x24b432(0x127)+_0x26f53e['id']),_0x1c4c81!==_0xbf1a7a&&console[_0x24b432(0xf0)]('\x20\x20\x20Path:\x20'+_0x1c4c81),await handleSDKOutput([_0x26f53e],_0x436d1f),0x0;}}
1
+ const a38_0x52849f=a38_0x1769;(function(_0x3ea607,_0x44e12d){const _0x4df86d=a38_0x1769,_0x257e02=_0x3ea607();while(!![]){try{const _0x3dd037=-parseInt(_0x4df86d(0x14a))/0x1+parseInt(_0x4df86d(0x12e))/0x2+parseInt(_0x4df86d(0x12d))/0x3*(parseInt(_0x4df86d(0x144))/0x4)+parseInt(_0x4df86d(0x134))/0x5+parseInt(_0x4df86d(0x152))/0x6*(parseInt(_0x4df86d(0x136))/0x7)+parseInt(_0x4df86d(0x129))/0x8+-parseInt(_0x4df86d(0x14e))/0x9*(parseInt(_0x4df86d(0x140))/0xa);if(_0x3dd037===_0x44e12d)break;else _0x257e02['push'](_0x257e02['shift']());}catch(_0x471ac4){_0x257e02['push'](_0x257e02['shift']());}}}(a38_0x351a,0x6b03e));import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../core/command-output.js';function a38_0x1769(_0x53c33a,_0x514f4e){_0x53c33a=_0x53c33a-0x11e;const _0x351a5d=a38_0x351a();let _0x176907=_0x351a5d[_0x53c33a];return _0x176907;}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_0x19e22e from'chalk';export class SegmentCreateCommand extends BaseCommand{[a38_0x52849f(0x124)]=a38_0x52849f(0x147);[a38_0x52849f(0x13a)]=a38_0x52849f(0x14b);async[a38_0x52849f(0x132)](_0x24fe62){const _0x1e06b6=a38_0x52849f;console[_0x1e06b6(0x14f)](a38_0x19e22e['yellow'](_0x1e06b6(0x122))),console[_0x1e06b6(0x14f)](a38_0x19e22e[_0x1e06b6(0x131)](_0x1e06b6(0x12a)));const {options:_0x56cbb5,args:_0x34e063,tdx:_0x4ddecc}=_0x24fe62,_0x10d08e=_0x56cbb5;if(_0x34e063[_0x1e06b6(0x151)]===0x0)return console[_0x1e06b6(0x14f)]('Error:\x20Segment\x20path\x20or\x20name\x20is\x20required'),console[_0x1e06b6(0x14f)](_0x1e06b6(0x12b)),console[_0x1e06b6(0x14f)](_0x1e06b6(0x126)),console[_0x1e06b6(0x14f)](_0x1e06b6(0x11e)),console[_0x1e06b6(0x14f)](_0x1e06b6(0x13f)),console[_0x1e06b6(0x14f)](_0x1e06b6(0x141)),0x1;const _0x132e55=_0x34e063[0x0],_0x28afbb=_0x56cbb5['segmentPath'];let _0x41f295=_0x132e55;_0x28afbb&&!_0x132e55[_0x1e06b6(0x130)]('/')&&(_0x41f295=_0x28afbb+'/'+_0x132e55,_0x10d08e[_0x1e06b6(0x12f)]&&console[_0x1e06b6(0x14f)](_0x1e06b6(0x150)+_0x41f295));const _0x2e2cae=parsePath(_0x41f295);if(_0x2e2cae['segments'][_0x1e06b6(0x151)]<0x2)return console['error']('Error:\x20Full\x20path\x20required\x20(parent/segment_name\x20or\x20parent/folder/segment_name)'),console['error']('Usage:\x20tdx\x20segment\x20create\x20<parent/segment_name>\x20[options]'),0x1;const _0x569113=_0x2e2cae[_0x1e06b6(0x13d)][0x0],_0x4b3dd0=getBaseName(_0x41f295),_0x4b61fe=getParentPath(_0x41f295);_0x10d08e[_0x1e06b6(0x12f)]&&(console[_0x1e06b6(0x14f)](_0x1e06b6(0x138)+_0x10d08e[_0x1e06b6(0x127)]),console['error'](_0x1e06b6(0x142)+_0x41f295),console[_0x1e06b6(0x14f)](_0x1e06b6(0x148)+_0x569113),console[_0x1e06b6(0x14f)](_0x1e06b6(0x13e)+_0x4b3dd0),console[_0x1e06b6(0x14f)]('Parent\x20path:\x20'+_0x4b61fe));const _0x2cef77=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x569113+_0x1e06b6(0x121),()=>_0x4ddecc[_0x1e06b6(0x143)][_0x1e06b6(0x149)](_0x569113),{'verbose':_0x10d08e[_0x1e06b6(0x12f)]}),_0x155f0f=_0x2cef77[_0x1e06b6(0x123)];let _0xe2757a;if(_0x2e2cae['segments'][_0x1e06b6(0x151)]>0x2){const _0x485f54=await withSpinner(_0x1e06b6(0x12c)+_0x4b61fe+'\x27...',()=>_0x4ddecc['segment']['resolvePathToResource'](_0x4b61fe),{'verbose':_0x10d08e['verbose']}),_0x32c4c4=_0x485f54['data'];if(_0x32c4c4[_0x1e06b6(0x13c)]!==_0x1e06b6(0x128)&&_0x32c4c4[_0x1e06b6(0x13c)]!==_0x1e06b6(0x135))return console[_0x1e06b6(0x14f)]('Error:\x20Cannot\x20create\x20segment\x20in\x20a\x20segment.\x20Parent\x20path\x20must\x20be\x20a\x20folder\x20or\x20parent.'),0x1;_0xe2757a=_0x32c4c4[_0x1e06b6(0x146)];}else{if(_0x10d08e[_0x1e06b6(0x128)]){const _0x51b01c=await withSpinner(_0x1e06b6(0x145)+_0x10d08e[_0x1e06b6(0x128)]+_0x1e06b6(0x121),()=>_0x4ddecc[_0x1e06b6(0x143)][_0x1e06b6(0x14d)](_0x155f0f,_0x10d08e[_0x1e06b6(0x128)]),{'verbose':_0x10d08e['verbose']});_0xe2757a=_0x51b01c['data'];}}_0x10d08e[_0x1e06b6(0x12f)]&&_0xe2757a&&console[_0x1e06b6(0x14f)](_0x1e06b6(0x125)+_0xe2757a);const _0x3be309=await loadJSONFromOptions(_0x10d08e['rule'],_0x10d08e[_0x1e06b6(0x13b)]),_0x3228d7={'name':_0x4b3dd0,'description':_0x10d08e[_0x1e06b6(0x13a)],'rule':_0x3be309,'kind':_0x10d08e[_0x1e06b6(0x139)]!==undefined?parseInt(_0x10d08e[_0x1e06b6(0x139)],0xa):undefined,'isVisible':_0x10d08e['invisible']?![]:undefined,'segmentFolderId':_0xe2757a,'countPopulation':_0x10d08e[_0x1e06b6(0x137)]?![]:undefined},_0xadfd8b=await withSpinner('Creating\x20segment\x20\x27'+_0x4b3dd0+_0x1e06b6(0x121),()=>_0x4ddecc[_0x1e06b6(0x143)][_0x1e06b6(0x11f)](_0x155f0f,_0x3228d7),{'verbose':_0x10d08e[_0x1e06b6(0x12f)]}),_0x29f014=_0xadfd8b[_0x1e06b6(0x123)];return console[_0x1e06b6(0x14f)](_0x1e06b6(0x14c)+_0x29f014[_0x1e06b6(0x124)]+_0x1e06b6(0x120)+_0x29f014['id']),_0x41f295!==_0x132e55&&console['error'](_0x1e06b6(0x133)+_0x41f295),await handleSDKOutput([_0x29f014],_0x10d08e),0x0;}}function a38_0x351a(){const _0x322be6=['4whVHMO','Resolving\x20folder\x20\x27','folderId','segment:create','Parent:\x20','resolveParentId','356694mLjQAE','Create\x20child\x20segment\x20with\x20filtering\x20rules','✔\x20Created\x20segment\x20\x27','resolveFolderId','1422rBODau','error','Resolved\x20relative\x20path\x20to:\x20','length','77358yHUPBO','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/High\x20Value\x22\x20--rule\x20\x27...\x27','createSegment','\x27\x20with\x20ID:\x20','\x27...','⚠\x20Deprecation\x20warning:\x20`segment\x20create`\x20is\x20deprecated.','data','name','Resolved\x20folder\x20ID:\x20','Examples:','site','folder','3359816BTmnky','\x20\x20Use\x20`tdx\x20sg\x20push`\x20with\x20YAML\x20files\x20instead.\x0a','Usage:\x20tdx\x20segment\x20create\x20<path>\x20[options]','Resolving\x20folder\x20path\x20\x27','1533654pDZWWx','1270728aaxCPR','verbose','includes','yellow','execute','\x20\x20\x20Path:\x20','4139820SFeEyK','parent','77BuQXxe','noCountPopulation','Site:\x20','kind','description','ruleFile','type','segments','Segment\x20name:\x20','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/Marketing/Premium\x22\x20--rule\x20\x27...\x27','110210fJkRRk','\x20\x20tdx\x20segment\x20create\x20\x22Premium\x22\x20--rule\x20\x27...\x27\x20\x20#\x20Relative\x20to\x20context','Target\x20path:\x20','segment'];a38_0x351a=function(){return _0x322be6;};return a38_0x351a();}
@@ -1 +1 @@
1
- const a39_0x1aab3f=a39_0x58ef;(function(_0x7dee2d,_0x1bd2ee){const _0x1f9672=a39_0x58ef,_0x3c233d=_0x7dee2d();while(!![]){try{const _0x468dcd=parseInt(_0x1f9672(0x10b))/0x1+-parseInt(_0x1f9672(0x116))/0x2*(parseInt(_0x1f9672(0x105))/0x3)+-parseInt(_0x1f9672(0x11e))/0x4*(parseInt(_0x1f9672(0x120))/0x5)+-parseInt(_0x1f9672(0x107))/0x6+-parseInt(_0x1f9672(0x104))/0x7*(-parseInt(_0x1f9672(0x114))/0x8)+parseInt(_0x1f9672(0x10e))/0x9*(parseInt(_0x1f9672(0x106))/0xa)+parseInt(_0x1f9672(0x10c))/0xb;if(_0x468dcd===_0x1bd2ee)break;else _0x3c233d['push'](_0x3c233d['shift']());}catch(_0x27b189){_0x3c233d['push'](_0x3c233d['shift']());}}}(a39_0x9361,0x3c40f));import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';function a39_0x58ef(_0x40252a,_0x42825e){_0x40252a=_0x40252a-0x103;const _0x93616e=a39_0x9361();let _0x58ef6b=_0x93616e[_0x40252a];return _0x58ef6b;}function a39_0x9361(){const _0x23a24a=['Listing\x20fields\x20for\x20\x27','324UJIrBO','Parent\x20segment:\x20','error','name','execute','verbose','312ilNSNu','Error:\x20Parent\x20segment\x20name\x20is\x20required','18wEihns','length','parentSegment','listFields','segment','Usage:\x20tdx\x20segment\x20fields\x20<parent_name>','\x20field','data','20ndTJCm','description','460100yGyDen','jsonl','26621KbHzja','101259HXSIiZ','61060ErnQCe','2860026azNnHI','site','Site:\x20','\x27...','64936aFgOcu','11597058birIBE'];a39_0x9361=function(){return _0x23a24a;};return a39_0x9361();}import{displayFieldsHumanReadable}from'../sdk/segment/fields-display.js';export class SegmentFieldsCommand extends BaseCommand{[a39_0x1aab3f(0x111)]='segment:fields';[a39_0x1aab3f(0x11f)]='List\x20available\x20fields\x20for\x20segmentation';async[a39_0x1aab3f(0x112)](_0x14573e){const _0x1cb83f=a39_0x1aab3f,{options:_0x79707c,args:_0x55d8c9,tdx:_0x474a66}=_0x14573e,_0x1c387a=_0x55d8c9[0x0]||_0x79707c[_0x1cb83f(0x118)];if(!_0x1c387a)return console[_0x1cb83f(0x110)](_0x1cb83f(0x115)),console[_0x1cb83f(0x110)](_0x1cb83f(0x11b)),console['error']('\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>'),0x1;_0x79707c[_0x1cb83f(0x113)]&&(console[_0x1cb83f(0x110)](_0x1cb83f(0x109)+_0x79707c[_0x1cb83f(0x108)]),console['error'](_0x1cb83f(0x10f)+_0x1c387a));const _0x19a078=await withSpinner(_0x1cb83f(0x10d)+_0x1c387a+_0x1cb83f(0x10a),()=>_0x474a66[_0x1cb83f(0x11a)][_0x1cb83f(0x119)](_0x1c387a),{'verbose':_0x79707c[_0x1cb83f(0x113)]}),_0x13fa11=_0x19a078[_0x1cb83f(0x11d)];console[_0x1cb83f(0x110)]('✔\x20Found\x20'+_0x13fa11['length']+_0x1cb83f(0x11c)+(_0x13fa11[_0x1cb83f(0x117)]!==0x1?'s':''));if(_0x79707c['json']||_0x79707c[_0x1cb83f(0x103)])return await handleSDKOutput(_0x13fa11,_0x79707c),0x0;return displayFieldsHumanReadable(_0x13fa11,_0x1c387a),0x0;}}
1
+ const a39_0xc7461=a39_0x6615;(function(_0x23ea50,_0x34ec67){const _0x25ce8b=a39_0x6615,_0x291e8d=_0x23ea50();while(!![]){try{const _0x551e99=parseInt(_0x25ce8b(0x13f))/0x1+-parseInt(_0x25ce8b(0x140))/0x2*(parseInt(_0x25ce8b(0x135))/0x3)+parseInt(_0x25ce8b(0x14a))/0x4+-parseInt(_0x25ce8b(0x13a))/0x5+parseInt(_0x25ce8b(0x148))/0x6*(parseInt(_0x25ce8b(0x152))/0x7)+-parseInt(_0x25ce8b(0x142))/0x8*(parseInt(_0x25ce8b(0x13d))/0x9)+parseInt(_0x25ce8b(0x153))/0xa*(parseInt(_0x25ce8b(0x137))/0xb);if(_0x551e99===_0x34ec67)break;else _0x291e8d['push'](_0x291e8d['shift']());}catch(_0x44671a){_0x291e8d['push'](_0x291e8d['shift']());}}}(a39_0x1159,0x23ea6));import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';function a39_0x6615(_0x1967a9,_0x190012){_0x1967a9=_0x1967a9-0x134;const _0x115966=a39_0x1159();let _0x6615ec=_0x115966[_0x1967a9];return _0x6615ec;}import{displayFieldsHumanReadable}from'../sdk/segment/fields-display.js';function a39_0x1159(){const _0x43b825=['Site:\x20','3dfikbF','\x27...','66XHsUxY','json','execute','617655GYGYsU','Error:\x20Parent\x20segment\x20name\x20is\x20required','Listing\x20fields\x20for\x20\x27','180gAACcP','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','172112bTRlxE','431094JuDPHA','site','70192lMSlfB','✔\x20Found\x20','Parent\x20segment:\x20','verbose','length','data','36qpzbno','name','673600HFuKTg','\x20field','jsonl','segment','error','listFields','List\x20available\x20fields\x20for\x20segmentation','description','158669vgcrhW','308590NLCCVt'];a39_0x1159=function(){return _0x43b825;};return a39_0x1159();}export class SegmentFieldsCommand extends BaseCommand{[a39_0xc7461(0x149)]='segment:fields';[a39_0xc7461(0x151)]=a39_0xc7461(0x150);async[a39_0xc7461(0x139)](_0xcef418){const _0x3eb763=a39_0xc7461,{options:_0x466f46,args:_0x3c3845,tdx:_0x13a9c2}=_0xcef418,_0x4eb9af=_0x3c3845[0x0]||_0x466f46['parentSegment'];if(!_0x4eb9af)return console[_0x3eb763(0x14e)](_0x3eb763(0x13b)),console[_0x3eb763(0x14e)]('Usage:\x20tdx\x20segment\x20fields\x20<parent_name>'),console[_0x3eb763(0x14e)](_0x3eb763(0x13e)),0x1;_0x466f46['verbose']&&(console[_0x3eb763(0x14e)](_0x3eb763(0x134)+_0x466f46[_0x3eb763(0x141)]),console[_0x3eb763(0x14e)](_0x3eb763(0x144)+_0x4eb9af));const _0x359681=await withSpinner(_0x3eb763(0x13c)+_0x4eb9af+_0x3eb763(0x136),()=>_0x13a9c2[_0x3eb763(0x14d)][_0x3eb763(0x14f)](_0x4eb9af),{'verbose':_0x466f46[_0x3eb763(0x145)]}),_0x59f9e5=_0x359681[_0x3eb763(0x147)];console['error'](_0x3eb763(0x143)+_0x59f9e5[_0x3eb763(0x146)]+_0x3eb763(0x14b)+(_0x59f9e5[_0x3eb763(0x146)]!==0x1?'s':''));if(_0x466f46[_0x3eb763(0x138)]||_0x466f46[_0x3eb763(0x14c)])return await handleSDKOutput(_0x59f9e5,_0x466f46),0x0;return displayFieldsHumanReadable(_0x59f9e5,_0x4eb9af),0x0;}}