@treasuredata/tdx 2026.6.2 → 2026.6.3

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 (225) hide show
  1. package/dist/bin.js +1 -1
  2. package/dist/build-info.json +3 -3
  3. package/dist/cli-categories.js +1 -1
  4. package/dist/cli.js +1 -1
  5. package/dist/commands/activations.js +1 -1
  6. package/dist/commands/agent-command.js +1 -1
  7. package/dist/commands/agent-test-command.js +1 -1
  8. package/dist/commands/api-command.js +1 -1
  9. package/dist/commands/auth-command.js +1 -1
  10. package/dist/commands/cas-command.js +1 -1
  11. package/dist/commands/cas-segment-command.js +1 -1
  12. package/dist/commands/chat-command.js +1 -1
  13. package/dist/commands/claude-command.js +1 -1
  14. package/dist/commands/claude-command.js.map +1 -1
  15. package/dist/commands/claude-statusline-command.js +1 -1
  16. package/dist/commands/claude-usage-command.js +1 -1
  17. package/dist/commands/command.js +1 -1
  18. package/dist/commands/connection-command.js +1 -1
  19. package/dist/commands/databases.js +1 -1
  20. package/dist/commands/delivery-command.js +1 -1
  21. package/dist/commands/describe.js +1 -1
  22. package/dist/commands/engage-campaign-pull-command.js +1 -1
  23. package/dist/commands/engage-campaign-push-command.js +1 -1
  24. package/dist/commands/engage-campaign-validate-command.js +1 -1
  25. package/dist/commands/engage-command.js +1 -1
  26. package/dist/commands/engage-template-pull-command.js +1 -1
  27. package/dist/commands/engage-template-push-command.js +1 -1
  28. package/dist/commands/engage-template-validate-command.js +1 -1
  29. package/dist/commands/job-command.js +1 -1
  30. package/dist/commands/journey-command.js +1 -1
  31. package/dist/commands/journey-validate-command.js +1 -1
  32. package/dist/commands/llm-command.js +1 -1
  33. package/dist/commands/mcp-command.js +1 -1
  34. package/dist/commands/parent-segment-command.js +1 -1
  35. package/dist/commands/policy-command.js +1 -1
  36. package/dist/commands/profile-command.js +1 -1
  37. package/dist/commands/profiles-command.js +1 -1
  38. package/dist/commands/query-command.js +1 -1
  39. package/dist/commands/schedule-command.js +1 -1
  40. package/dist/commands/segment-command.js +1 -1
  41. package/dist/commands/segment-create-command.js +1 -1
  42. package/dist/commands/segment-fields-command.js +1 -1
  43. package/dist/commands/segment-pull-command.js +1 -1
  44. package/dist/commands/segment-push-command.js +1 -1
  45. package/dist/commands/segment-update-command.js +1 -1
  46. package/dist/commands/segment-use-command.js +1 -1
  47. package/dist/commands/segment-validate-command.js +1 -1
  48. package/dist/commands/segments.js +1 -1
  49. package/dist/commands/show.js +1 -1
  50. package/dist/commands/status-command.js +1 -1
  51. package/dist/commands/table-deleted.js +1 -1
  52. package/dist/commands/tables.js +1 -1
  53. package/dist/commands/unset-command.js +1 -1
  54. package/dist/commands/upgrade-command.js +1 -1
  55. package/dist/commands/use-command.js +1 -1
  56. package/dist/commands/user-command.js +1 -1
  57. package/dist/commands/work-command.js +1 -1
  58. package/dist/commands/workflow-command.js +1 -1
  59. package/dist/core/auth.js +1 -1
  60. package/dist/core/command-output.js +1 -1
  61. package/dist/core/config.js +1 -1
  62. package/dist/core/connection-cache.js +1 -1
  63. package/dist/core/constants.js +1 -1
  64. package/dist/core/credential-cache.js +1 -1
  65. package/dist/core/global-context.js +1 -1
  66. package/dist/core/keychain.js +1 -1
  67. package/dist/core/oauth-keychain.js +1 -1
  68. package/dist/core/oauth.js +1 -1
  69. package/dist/core/profile.js +1 -1
  70. package/dist/core/project-config.js +1 -1
  71. package/dist/core/session.js +1 -1
  72. package/dist/core/user-cache.js +1 -1
  73. package/dist/core/version.js +1 -1
  74. package/dist/index.js +1 -1
  75. package/dist/mcp/server.js +1 -1
  76. package/dist/mcp/tools/index.js +1 -1
  77. package/dist/mcp/tools/tdx-run.js +1 -1
  78. package/dist/mcp/tools/tdx-search.js +1 -1
  79. package/dist/mcp/tools/work-create-item.js +1 -1
  80. package/dist/mcp/utils.js +1 -1
  81. package/dist/proxy/claude-usage-tracker.js +1 -1
  82. package/dist/proxy/passthrough-server.js +1 -1
  83. package/dist/proxy/sse-usage-parser.js +1 -1
  84. package/dist/sdk/agent/agent-config.js +1 -1
  85. package/dist/sdk/agent/agent-ref-parser.js +1 -1
  86. package/dist/sdk/agent/agent-yaml.js +1 -1
  87. package/dist/sdk/agent/test/evaluator.js +1 -1
  88. package/dist/sdk/agent/test/executor.js +1 -1
  89. package/dist/sdk/agent/test/index.js +1 -1
  90. package/dist/sdk/agent/test/output.js +1 -1
  91. package/dist/sdk/agent/test/parser.js +1 -1
  92. package/dist/sdk/agent/tool-target-registry.js +1 -1
  93. package/dist/sdk/api.js +1 -1
  94. package/dist/sdk/cas/cas-api-client.js +1 -1
  95. package/dist/sdk/cas/cas-audience-yaml.js +1 -1
  96. package/dist/sdk/cas/cas-segment-yaml.js +1 -1
  97. package/dist/sdk/cas/index.js +1 -1
  98. package/dist/sdk/cas/pull-workflow.js +1 -1
  99. package/dist/sdk/cas/push-workflow.js +1 -1
  100. package/dist/sdk/client/cdp-api-client.js +1 -1
  101. package/dist/sdk/client/delivery-api-client.js +1 -1
  102. package/dist/sdk/client/endpoints.js +1 -1
  103. package/dist/sdk/client/engage-api-client.js +1 -1
  104. package/dist/sdk/client/http-client.js +1 -1
  105. package/dist/sdk/client/llm-api-client.js +1 -1
  106. package/dist/sdk/client/oauth-refresh.js +1 -1
  107. package/dist/sdk/client/rate-limiter.js +1 -1
  108. package/dist/sdk/client/td-api-client.js +1 -1
  109. package/dist/sdk/client/trino-api-client.js +1 -1
  110. package/dist/sdk/client/workflow-client.js +1 -1
  111. package/dist/sdk/connection-validator.js +1 -1
  112. package/dist/sdk/connection.js +1 -1
  113. package/dist/sdk/delivery.js +1 -1
  114. package/dist/sdk/engage/campaign-pull.js +1 -1
  115. package/dist/sdk/engage/campaign-push.js +1 -1
  116. package/dist/sdk/engage/campaign-validator.js +1 -1
  117. package/dist/sdk/engage/campaign-yaml.js +1 -1
  118. package/dist/sdk/engage/template-pull.js +1 -1
  119. package/dist/sdk/engage/template-push.js +1 -1
  120. package/dist/sdk/engage/template-validator.js +1 -1
  121. package/dist/sdk/engage/template-yaml.js +1 -1
  122. package/dist/sdk/engage/types/campaign-def.js +1 -1
  123. package/dist/sdk/engage/types/campaign-schema.js +1 -1
  124. package/dist/sdk/engage/types/template-schema.js +1 -1
  125. package/dist/sdk/engage.js +1 -1
  126. package/dist/sdk/errors.js +1 -1
  127. package/dist/sdk/index.js +1 -1
  128. package/dist/sdk/io/index.js +1 -1
  129. package/dist/sdk/io/node-filesystem.js +1 -1
  130. package/dist/sdk/job.js +1 -1
  131. package/dist/sdk/journey.js +1 -1
  132. package/dist/sdk/llm/chat-cache.js +1 -1
  133. package/dist/sdk/llm/index.js +1 -1
  134. package/dist/sdk/llm/llm-backup-utils.js +1 -1
  135. package/dist/sdk/llm/model-factors.js +1 -1
  136. package/dist/sdk/llm/user-settings.js +1 -1
  137. package/dist/sdk/personalization.js +1 -1
  138. package/dist/sdk/policy.js +1 -1
  139. package/dist/sdk/query/deleted-table-validation.js +1 -1
  140. package/dist/sdk/query/index.js +1 -1
  141. package/dist/sdk/query/sql-parser.js +1 -1
  142. package/dist/sdk/realtime.js +1 -1
  143. package/dist/sdk/schedule.js +1 -1
  144. package/dist/sdk/segment/child-segment-yaml.js +1 -1
  145. package/dist/sdk/segment/fields-display.js +1 -1
  146. package/dist/sdk/segment/file-discovery.js +1 -1
  147. package/dist/sdk/segment/journey-utils.js +1 -1
  148. package/dist/sdk/segment/journey-validator.js +1 -1
  149. package/dist/sdk/segment/journey-yaml.js +1 -1
  150. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  151. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  152. package/dist/sdk/segment/pull-workflow.js +1 -1
  153. package/dist/sdk/segment/push-recovery.js +1 -1
  154. package/dist/sdk/segment/push-workflow.js +1 -1
  155. package/dist/sdk/segment/resolution-context.js +1 -1
  156. package/dist/sdk/segment/segment-path-parser.js +1 -1
  157. package/dist/sdk/segment/segment-ref-parser.js +1 -1
  158. package/dist/sdk/segment/segment-validator.js +1 -1
  159. package/dist/sdk/segment/target-resolution.js +1 -1
  160. package/dist/sdk/segment/tdx-config.js +1 -1
  161. package/dist/sdk/segment/types/activation-schema.js +1 -1
  162. package/dist/sdk/segment/types/journey-def.js +1 -1
  163. package/dist/sdk/segment/types/journey-schema.js +1 -1
  164. package/dist/sdk/segment/types/segment-def.js +1 -1
  165. package/dist/sdk/segment/types/segment-schema.js +1 -1
  166. package/dist/sdk/segment/validate-files.js +1 -1
  167. package/dist/sdk/segment/yaml-validator.js +1 -1
  168. package/dist/sdk/segment.js +1 -1
  169. package/dist/sdk/types/index.js +1 -1
  170. package/dist/sdk/types/progress.js +1 -1
  171. package/dist/sdk/types/workspace.js +1 -1
  172. package/dist/sdk/user.js +1 -1
  173. package/dist/sdk/util/format-detector.js +1 -1
  174. package/dist/sdk/util/formatters.js +1 -1
  175. package/dist/sdk/util/index.js +1 -1
  176. package/dist/sdk/util/paginate.js +1 -1
  177. package/dist/sdk/util/tree-formatter.js +1 -1
  178. package/dist/sdk/workflow/archive-validation.js +1 -1
  179. package/dist/sdk/workflow/clone-workflow.js +1 -1
  180. package/dist/sdk/workflow/index.js +1 -1
  181. package/dist/sdk/workflow/pull-workflow.js +1 -1
  182. package/dist/sdk/workflow/push-workflow.js +1 -1
  183. package/dist/sdk/workflow/task-graph.js +1 -1
  184. package/dist/sdk/workflow/tdx-config.js +1 -1
  185. package/dist/sdk/workflow/workflow-utils.js +1 -1
  186. package/dist/sdk/workspace/access-tracker.js +1 -1
  187. package/dist/sdk/workspace/frontmatter.js +1 -1
  188. package/dist/sdk/workspace/git.js +1 -1
  189. package/dist/sdk/workspace/index.js +1 -1
  190. package/dist/sdk/workspace/templates.js +1 -1
  191. package/dist/sdk/workspace/weekly.js +1 -1
  192. package/dist/sdk/workspace/wikilinks.js +1 -1
  193. package/dist/test-utils/command-runner.js +1 -1
  194. package/dist/test-utils/factories.js +1 -1
  195. package/dist/test-utils/fixtures.js +1 -1
  196. package/dist/test-utils/http-mock.js +1 -1
  197. package/dist/test-utils/index.js +1 -1
  198. package/dist/utils/async.js +1 -1
  199. package/dist/utils/colors.js +1 -1
  200. package/dist/utils/diff.js +1 -1
  201. package/dist/utils/file-permissions.js +1 -1
  202. package/dist/utils/file-reader.js +1 -1
  203. package/dist/utils/github-releases.js +1 -1
  204. package/dist/utils/global-cache.js +1 -1
  205. package/dist/utils/json-loader.js +1 -1
  206. package/dist/utils/local-cache.js +1 -1
  207. package/dist/utils/logger/formatters/default-formatter.js +1 -1
  208. package/dist/utils/logger/formatters/index.js +1 -1
  209. package/dist/utils/logger/handlers/console-handler.js +1 -1
  210. package/dist/utils/logger/handlers/file-handler.js +1 -1
  211. package/dist/utils/logger/handlers/index.js +1 -1
  212. package/dist/utils/logger/handlers/null-handler.js +1 -1
  213. package/dist/utils/logger/index.js +1 -1
  214. package/dist/utils/logger/logger.js +1 -1
  215. package/dist/utils/logger/types.js +1 -1
  216. package/dist/utils/option-validation.js +1 -1
  217. package/dist/utils/process.js +1 -1
  218. package/dist/utils/prompt.js +1 -1
  219. package/dist/utils/spinner.js +1 -1
  220. package/dist/utils/sse-parser.js +1 -1
  221. package/dist/utils/string-utils.js +1 -1
  222. package/dist/utils/table-ref-parser.js +1 -1
  223. package/dist/utils/tdx-logger.js +1 -1
  224. package/dist/utils/version-check.js +1 -1
  225. package/package.json +1 -1
@@ -1 +1 @@
1
- const a32_0x570f1e=a32_0x3cd1;(function(_0x111d94,_0x2cfc91){const _0x125aa8=a32_0x3cd1,_0x222187=_0x111d94();while(!![]){try{const _0x26eb4f=-parseInt(_0x125aa8(0x179))/0x1*(parseInt(_0x125aa8(0x18d))/0x2)+-parseInt(_0x125aa8(0x199))/0x3+-parseInt(_0x125aa8(0x170))/0x4+parseInt(_0x125aa8(0x17e))/0x5*(-parseInt(_0x125aa8(0x16d))/0x6)+-parseInt(_0x125aa8(0x17b))/0x7+parseInt(_0x125aa8(0x1a0))/0x8+parseInt(_0x125aa8(0x16e))/0x9;if(_0x26eb4f===_0x2cfc91)break;else _0x222187['push'](_0x222187['shift']());}catch(_0x34356e){_0x222187['push'](_0x222187['shift']());}}}(a32_0x2591,0xe2589));import{BaseCommand}from'./command.js';import{handleSDKOutput,handleSingleObjectOutput,isStructuredFormat}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import a32_0x593a6d from'chalk';export class PolicyCommand extends BaseCommand{[a32_0x570f1e(0x18f)]='policy';[a32_0x570f1e(0x18a)]=a32_0x570f1e(0x19c);async[a32_0x570f1e(0x193)](_0x4ee044){const _0x133c9d=a32_0x570f1e,{options:_0x4ff939,tdx:_0xdcb2b8}=_0x4ee044,_0x35fca1=await withSpinner('Fetching\x20permissions...',async()=>{const _0x432292=a32_0x3cd1,[_0x431948,_0x279cdf]=await Promise[_0x432292(0x166)]([_0xdcb2b8[_0x432292(0x190)][_0x432292(0x17c)](),_0xdcb2b8[_0x432292(0x182)][_0x432292(0x16c)]()]);return{'userInfo':_0x431948,'permissions':_0x279cdf};},{'verbose':_0x4ff939[_0x133c9d(0x177)]}),{userInfo:_0x2b8977,permissions:_0x427202}=_0x35fca1[_0x133c9d(0x19b)];if(isStructuredFormat(_0x4ff939))return await handleSingleObjectOutput(_0x427202,_0x4ff939),0x0;const _0x20ceb8=_0x2b8977[_0x133c9d(0x192)]?_0x133c9d(0x180):_0x2b8977[_0x133c9d(0x16a)]?_0x133c9d(0x195):_0x133c9d(0x187);console[_0x133c9d(0x188)]('\x0a'+a32_0x593a6d[_0x133c9d(0x181)]('👤')+'\x20'+a32_0x593a6d[_0x133c9d(0x181)](_0x2b8977[_0x133c9d(0x18f)])+'\x20'+a32_0x593a6d[_0x133c9d(0x18e)]('('+_0x2b8977[_0x133c9d(0x19d)]+')')+_0x133c9d(0x185)+_0x20ceb8),console[_0x133c9d(0x188)](a32_0x593a6d[_0x133c9d(0x18e)](_0x133c9d(0x178)+_0xdcb2b8[_0x133c9d(0x19f)][_0x133c9d(0x16f)]+':'+_0x2b8977[_0x133c9d(0x18c)]+_0x133c9d(0x16b)+_0x2b8977['id']));const _0x43e8eb=_0x427202[_0x133c9d(0x171)];console[_0x133c9d(0x188)]('\x0a'+a32_0x593a6d[_0x133c9d(0x181)](_0x133c9d(0x197))+'\x20('+_0x43e8eb[_0x133c9d(0x19a)]+'):');if(_0x43e8eb[_0x133c9d(0x19a)]===0x0)console[_0x133c9d(0x188)](a32_0x593a6d['dim'](_0x133c9d(0x173)));else for(const _0x25777c of _0x43e8eb){console[_0x133c9d(0x188)](_0x133c9d(0x165)+_0x25777c[_0x133c9d(0x18f)]);}return printPermissionsMap(_0x427202[_0x133c9d(0x172)]),console[_0x133c9d(0x188)](),0x0;}}function a32_0x3cd1(_0x3f1a81,_0x7970a){_0x3f1a81=_0x3f1a81-0x164;const _0x259133=a32_0x2591();let _0x3cd1a6=_0x259133[_0x3f1a81];return _0x3cd1a6;}export class PolicyListCommand extends BaseCommand{['name']=a32_0x570f1e(0x17f);[a32_0x570f1e(0x18a)]=a32_0x570f1e(0x168);async[a32_0x570f1e(0x193)](_0x48baba){const _0xff95ea=a32_0x570f1e,{options:_0x599131,tdx:_0x407f00}=_0x48baba,_0x25d5f1=await withSpinner('Listing\x20policies...',()=>_0x407f00[_0xff95ea(0x182)]['listPolicies'](),{'verbose':_0x599131[_0xff95ea(0x177)]}),_0x3c2274=_0x25d5f1[_0xff95ea(0x19b)];console[_0xff95ea(0x17d)]('✔\x20Found\x20'+_0x3c2274[_0xff95ea(0x19a)]+_0xff95ea(0x175)+(_0x3c2274[_0xff95ea(0x19a)]!==0x1?'ies':'y'));if(isStructuredFormat(_0x599131))return await handleSDKOutput(_0x3c2274,_0x599131),0x0;if(_0x3c2274[_0xff95ea(0x19a)]===0x0)console[_0xff95ea(0x188)](a32_0x593a6d[_0xff95ea(0x18e)](_0xff95ea(0x169)));else for(const _0x16b6d5 of _0x3c2274){const _0x3e8284=_0x16b6d5[_0xff95ea(0x18a)]?a32_0x593a6d[_0xff95ea(0x18e)]('\x20—\x20'+_0x16b6d5[_0xff95ea(0x18a)]):'';console['log']('\x20\x20•\x20'+_0x16b6d5[_0xff95ea(0x18f)]+_0x3e8284);}return 0x0;}}function a32_0x2591(){const _0x551fe8=['log','\x20user','description','args','account_id','334272IPWdMw','dim','name','user','policy\x20show','account_owner','execute','max','Administrator','(ID:\x20','📋\x20Assigned\x20Policies','map','1883778vvxlod','length','data','Show\x20current\x20user\x20policies\x20and\x20effective\x20permissions','email','validate','context','5509584HunIAh','getPolicyUsers','operation','\x20\x20•\x20','all','join','List\x20all\x20policies\x20in\x20the\x20account\x20(admin\x20only)','No\x20policies\x20found','administrator',',\x20user_id:','getMyPermissions','474YBOOfI','35992017bkkDmz','site','1160776jwQUJn','policies','permissions','\x20\x20No\x20policies\x20assigned','padEnd','\x20polic','\x20assigned','verbose','\x20\x20\x20','5uXFnGM','getPolicy','12820073dDrqJV','getCurrent','error','11105yOqrLN','policy\x20list','Account\x20Owner','bold','policy','entries','Usage:\x20tdx\x20policy\x20show\x20<policy-name-or-id>','\x20—\x20','\x20\x20No\x20permissions','Member'];a32_0x2591=function(){return _0x551fe8;};return a32_0x2591();}export class PolicyShowCommand extends BaseCommand{['name']=a32_0x570f1e(0x191);['description']='Show\x20a\x20specific\x20policy\x20details\x20and\x20permissions\x20(admin\x20only)';[a32_0x570f1e(0x19e)](_0x3dee8a){const _0x4168b9=a32_0x570f1e;if(_0x3dee8a[_0x4168b9(0x18b)][_0x4168b9(0x19a)]===0x0)return _0x4168b9(0x184);return undefined;}async[a32_0x570f1e(0x193)](_0x379fda){const _0x51e1ae=a32_0x570f1e,{options:_0x498b12,tdx:_0x1eeecd}=_0x379fda,_0x1f8da1=_0x379fda[_0x51e1ae(0x18b)][0x0],_0x46aa1c=await withSpinner('Fetching\x20policy...',async()=>{const _0x21ba82=_0x51e1ae,_0x5222ab=await _0x1eeecd[_0x21ba82(0x182)][_0x21ba82(0x17a)](_0x1f8da1),[_0x2490b0,_0x4a52cb]=await Promise[_0x21ba82(0x166)]([_0x1eeecd[_0x21ba82(0x182)]['getPolicyPermissions'](_0x5222ab['id']),_0x1eeecd['policy'][_0x21ba82(0x1a1)](_0x5222ab['id'])]);return{'policy':_0x5222ab,'perms':_0x2490b0,'users':_0x4a52cb};},{'verbose':_0x498b12['verbose']}),{policy:_0x3715ac,perms:_0x52bc4c,users:_0x4de5ec}=_0x46aa1c[_0x51e1ae(0x19b)];if(isStructuredFormat(_0x498b12))return await handleSingleObjectOutput({..._0x3715ac,'permissions':_0x52bc4c['permissions'],'users':_0x4de5ec},_0x498b12),0x0;console[_0x51e1ae(0x188)]('\x0a'+a32_0x593a6d[_0x51e1ae(0x181)]('📋')+'\x20'+a32_0x593a6d[_0x51e1ae(0x181)](_0x3715ac[_0x51e1ae(0x18f)])+'\x20'+a32_0x593a6d['dim'](_0x51e1ae(0x196)+_0x3715ac['id']+')'));_0x3715ac['description']&&console[_0x51e1ae(0x188)](_0x51e1ae(0x178)+a32_0x593a6d['dim'](_0x3715ac['description']));console[_0x51e1ae(0x188)](_0x51e1ae(0x178)+_0x4de5ec[_0x51e1ae(0x19a)]+_0x51e1ae(0x189)+(_0x4de5ec['length']!==0x1?'s':'')+_0x51e1ae(0x176)),printPermissionsMap(_0x52bc4c[_0x51e1ae(0x172)]);if(_0x4de5ec['length']>0x0){console[_0x51e1ae(0x188)]('\x0a'+a32_0x593a6d[_0x51e1ae(0x181)]('👥\x20Assigned\x20Users')+':');for(const _0x4d37a1 of _0x4de5ec){const _0x4cefb7=_0x4d37a1[_0x51e1ae(0x19d)]&&_0x4d37a1[_0x51e1ae(0x19d)]!==_0x4d37a1[_0x51e1ae(0x18f)]?a32_0x593a6d[_0x51e1ae(0x18e)]('\x20<'+_0x4d37a1[_0x51e1ae(0x19d)]+'>'):'';console[_0x51e1ae(0x188)]('\x20\x20•\x20'+_0x4d37a1[_0x51e1ae(0x18f)]+_0x4cefb7);}}return console[_0x51e1ae(0x188)](),0x0;}}function printPermissionsMap(_0x19c871){const _0x5ef7ae=a32_0x570f1e,_0x134e0d=Object[_0x5ef7ae(0x183)](_0x19c871);console[_0x5ef7ae(0x188)]('\x0a'+a32_0x593a6d[_0x5ef7ae(0x181)]('🔑\x20Effective\x20Permissions')+':');if(_0x134e0d[_0x5ef7ae(0x19a)]===0x0){console['log'](a32_0x593a6d[_0x5ef7ae(0x18e)](_0x5ef7ae(0x186)));return;}const _0x240b1a=Math[_0x5ef7ae(0x194)](..._0x134e0d[_0x5ef7ae(0x198)](([_0x419a97])=>_0x419a97[_0x5ef7ae(0x19a)]));for(const [_0x409871,_0x284da1]of _0x134e0d){const _0x37e920=formatOperations(_0x284da1);console['log']('\x20\x20'+_0x409871[_0x5ef7ae(0x174)](_0x240b1a+0x2)+_0x37e920);}}function formatOperations(_0x548f16){const _0xab44b7=a32_0x570f1e,_0x81efba=[...new Set(_0x548f16[_0xab44b7(0x198)](_0xe2e1bf=>_0xe2e1bf[_0xab44b7(0x164)]))];return _0x81efba[_0xab44b7(0x167)](',\x20');}
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 +1 @@
1
- const a33_0xc08a76=a33_0x1734;(function(_0x1d971e,_0x5988eb){const _0x31832b=a33_0x1734,_0x43ff8c=_0x1d971e();while(!![]){try{const _0x28e17a=parseInt(_0x31832b(0x22b))/0x1*(-parseInt(_0x31832b(0x210))/0x2)+parseInt(_0x31832b(0x251))/0x3+-parseInt(_0x31832b(0x225))/0x4*(parseInt(_0x31832b(0x20c))/0x5)+parseInt(_0x31832b(0x245))/0x6+parseInt(_0x31832b(0x23f))/0x7+-parseInt(_0x31832b(0x234))/0x8+-parseInt(_0x31832b(0x239))/0x9*(-parseInt(_0x31832b(0x222))/0xa);if(_0x28e17a===_0x5988eb)break;else _0x43ff8c['push'](_0x43ff8c['shift']());}catch(_0x5c9ca7){_0x43ff8c['push'](_0x43ff8c['shift']());}}}(a33_0x17a1,0xc3ec4));function a33_0x1734(_0x1502fb,_0x50ffdf){_0x1502fb=_0x1502fb-0x1ea;const _0x17a1c8=a33_0x17a1();let _0x173450=_0x17a1c8[_0x1502fb];return _0x173450;}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_0x4e89af 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_0x91a64b from'prompts';import a33_0x2ae7c0 from'chalk';function validateProfileName(_0x382002,_0x48a28f){const _0x6cee01=a33_0x1734;if(!_0x382002||!_0x382002['trim']())return _0x6cee01(0x253);const _0x28d830=_0x382002[_0x6cee01(0x1fe)]();if(!/^[a-zA-Z0-9_-]+$/[_0x6cee01(0x207)](_0x28d830))return _0x6cee01(0x20b);if(!_0x48a28f?.[_0x6cee01(0x25c)]&&profileExists(_0x28d830))return _0x6cee01(0x21d)+_0x28d830+'\x27\x20already\x20exists.\x20Use\x20\x27tdx\x20profile\x20delete\x20'+_0x28d830+_0x6cee01(0x1f7);return!![];}async function deleteProfileAndCredentials(_0x1647fc){const _0x359ada=a33_0x1734;removeProfileFromUserConfig(_0x1647fc);const _0x1783ad=await isKeychainAvailable();_0x1783ad&&await Promise[_0x359ada(0x203)]([deleteKeychainAPIKey(_0x1647fc),deleteOAuthTokens(_0x1647fc)]);}export class ProfileCreateCommand extends BaseCommand{[a33_0xc08a76(0x244)]=a33_0xc08a76(0x1ea);['description']=a33_0xc08a76(0x22c);async['execute'](_0x2f1b76){const _0x453c79=a33_0xc08a76,{options:_0x2c0382,args:_0xfb0f75}=_0x2f1b76,_0x2c9bb7=!!_0x2c0382[_0x453c79(0x1f1)];console['log'](a33_0x2ae7c0[_0x453c79(0x201)](_0x453c79(0x259)));let _0x1b05a6;if(_0xfb0f75[_0x453c79(0x20a)]>0x0&&_0xfb0f75[0x0]){const _0x533dcd=_0xfb0f75[0x0][_0x453c79(0x1fe)]();_0x2c9bb7&&profileExists(_0x533dcd)&&(await deleteProfileAndCredentials(_0x533dcd),console[_0x453c79(0x22d)](_0x453c79(0x1f0)+_0x533dcd+'\x27'));const _0x4858de=validateProfileName(_0x533dcd);if(_0x4858de!==!![])return console[_0x453c79(0x1ed)](a33_0x2ae7c0[_0x453c79(0x249)](_0x4858de)),0x1;_0x1b05a6=_0x533dcd;}else{const _0x448c0f=await a33_0x91a64b({'type':_0x453c79(0x24d),'name':_0x453c79(0x227),'message':_0x453c79(0x1fd),'validate':_0x4644a0=>validateProfileName(_0x4644a0,{'skipExistsCheck':_0x2c9bb7})});if(!_0x448c0f[_0x453c79(0x227)])return console[_0x453c79(0x22d)](_0x453c79(0x243)),0x1;_0x1b05a6=_0x448c0f[_0x453c79(0x227)]['trim'](),_0x2c9bb7&&profileExists(_0x1b05a6)&&(await deleteProfileAndCredentials(_0x1b05a6),console[_0x453c79(0x22d)](_0x453c79(0x1f0)+_0x1b05a6+'\x27'));}const _0x4bbc76=await a33_0x91a64b({'type':_0x453c79(0x24d),'name':'description','message':_0x453c79(0x236)}),_0x53ef2b=_0x4bbc76['description']?.[_0x453c79(0x1fe)]()||undefined,_0x5dc197=_0x2c0382[_0x453c79(0x1ee)]||'us01',_0x5d329a=await promptSiteSelection(_0x5dc197,_0x1b05a6,'Setup\x20cancelled');if(!_0x5d329a)return 0x1;const _0x2cb091=resolveSite(_0x5d329a),_0x315819=await promptAuthMethod();if(!_0x315819)return console['log'](_0x453c79(0x243)),0x1;if(_0x315819===_0x453c79(0x1ff)){if(_0x53ef2b){const _0x38d457={'site':_0x2cb091,'description':_0x53ef2b};saveProfileToUserConfig(_0x1b05a6,_0x38d457);}const {accountName:_0x50fea7}=_0x2c0382;return await runOAuthLoginFlow(_0x2cb091,_0x1b05a6,_0x2c0382['logLevel']??LogLevel[_0x453c79(0x256)],{'accountName':_0x50fea7}),0x0;}console[_0x453c79(0x22d)](_0x453c79(0x229)+_0x2cb091),console[_0x453c79(0x22d)](_0x453c79(0x22a)),console['log']('\x20\x20'+getConsoleUrl(_0x2cb091,_0x453c79(0x211)));const _0x55e7a0=await a33_0x91a64b({'type':_0x453c79(0x221),'name':'apiKey','message':_0x453c79(0x206),'validate':_0x2073b9=>{const _0x5c88dd=_0x453c79;if(!_0x2073b9||!_0x2073b9[_0x5c88dd(0x1fe)]())return _0x5c88dd(0x23b);return!![];}});if(!_0x55e7a0['apiKey'])return console[_0x453c79(0x22d)](_0x453c79(0x243)),0x1;const _0x343674=_0x55e7a0[_0x453c79(0x202)];console[_0x453c79(0x22d)](_0x453c79(0x252));try{const _0x2bc1ba=TDX[_0x453c79(0x242)]({'site':_0x2cb091,'apiKey':_0x343674[_0x453c79(0x1fe)](),'logLevel':_0x2c0382['logLevel']??LogLevel[_0x453c79(0x256)]}),_0x3d0521=await _0x2bc1ba['jobs'][_0x453c79(0x24c)]();console['log'](a33_0x2ae7c0[_0x453c79(0x204)]('✓')+'\x20API\x20key\x20is\x20valid\x20(User:\x20'+_0x3d0521[_0x453c79(0x1ef)]+')');const _0x4c06c8=await isKeychainAvailable();_0x4c06c8?(await saveAPIKeyAsync(_0x343674[_0x453c79(0x1fe)](),_0x2cb091,_0x1b05a6),console[_0x453c79(0x22d)](a33_0x2ae7c0[_0x453c79(0x204)]('✓')+_0x453c79(0x226)+_0x1b05a6+')')):(console[_0x453c79(0x233)](a33_0x2ae7c0[_0x453c79(0x21e)](_0x453c79(0x218))),console[_0x453c79(0x233)](a33_0x2ae7c0[_0x453c79(0x21e)](_0x453c79(0x250))));const _0x49985b={'site':_0x2cb091,..._0x53ef2b&&{'description':_0x53ef2b}};return saveProfileToUserConfig(_0x1b05a6,_0x49985b),console['log'](a33_0x2ae7c0['green']('✓')+_0x453c79(0x237)+_0x1b05a6+_0x453c79(0x254)),console['log'](),console['log'](_0x453c79(0x238)),console['log'](_0x453c79(0x248)+_0x1b05a6+'\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication'),console[_0x453c79(0x22d)]('\x20\x20tdx\x20--profile\x20'+_0x1b05a6+'\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases'),0x0;}catch(_0x2aa3c6){if(_0x2aa3c6 instanceof HTTPClientError&&_0x2aa3c6[_0x453c79(0x241)]===0x191)return printAuthError(_0x2aa3c6),0x1;return console[_0x453c79(0x1ed)](a33_0x2ae7c0[_0x453c79(0x249)](_0x453c79(0x219)+(_0x2aa3c6 instanceof Error?_0x2aa3c6[_0x453c79(0x230)]:String(_0x2aa3c6)))),console[_0x453c79(0x1ed)](_0x453c79(0x1f6)),0x1;}}}export class ProfileDeleteCommand extends BaseCommand{[a33_0xc08a76(0x244)]=a33_0xc08a76(0x23c);[a33_0xc08a76(0x22e)]=a33_0xc08a76(0x214);['validate'](_0x52c089){const {args:_0x4f8863}=_0x52c089;if(_0x4f8863['length']===0x0)return'Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20delete\x20<name>';return undefined;}async['execute'](_0x231960){const _0x15bb09=a33_0xc08a76,{args:_0x513fc5}=_0x231960,_0x37864a=_0x513fc5[0x0];console[_0x15bb09(0x22d)](a33_0x2ae7c0['bold'](_0x15bb09(0x24f)));if(!profileExists(_0x37864a)){console[_0x15bb09(0x1ed)](a33_0x2ae7c0[_0x15bb09(0x249)]('Profile\x20\x27'+_0x37864a+_0x15bb09(0x24a))),console[_0x15bb09(0x22d)](_0x15bb09(0x224));const _0x2a6179=listProfiles();if(_0x2a6179[_0x15bb09(0x20a)]===0x0)console[_0x15bb09(0x22d)](_0x15bb09(0x25b));else for(const _0x158458 of _0x2a6179){console[_0x15bb09(0x22d)](_0x15bb09(0x1fa)+_0x158458[_0x15bb09(0x244)]);}return 0x1;}const _0x364b69=await a33_0x91a64b({'type':_0x15bb09(0x21a),'name':_0x15bb09(0x21a),'message':_0x15bb09(0x213)+_0x37864a+'\x27?','initial':![]});if(!_0x364b69[_0x15bb09(0x21a)])return console['log'](_0x15bb09(0x200)),0x0;try{await deleteProfileAndCredentials(_0x37864a),console[_0x15bb09(0x22d)](a33_0x2ae7c0[_0x15bb09(0x204)]('✓')+_0x15bb09(0x237)+_0x37864a+_0x15bb09(0x223));}catch(_0x34a68c){return console[_0x15bb09(0x1ed)](a33_0x2ae7c0[_0x15bb09(0x249)](_0x15bb09(0x209)+(_0x34a68c instanceof Error?_0x34a68c[_0x15bb09(0x230)]:String(_0x34a68c)))),0x1;}return 0x0;}}export class ProfileSetCommand extends BaseCommand{[a33_0xc08a76(0x244)]='profile:set';[a33_0xc08a76(0x22e)]=a33_0xc08a76(0x228);static [a33_0xc08a76(0x1f2)]=[a33_0xc08a76(0x1ee),a33_0xc08a76(0x1f8),'parent_segment',a33_0xc08a76(0x25a),a33_0xc08a76(0x1fb),a33_0xc08a76(0x22e)];[a33_0xc08a76(0x21f)](_0x3dffc3){const _0x216956=a33_0xc08a76,{args:_0x230bd2,options:_0x350dad}=_0x3dffc3,_0x19d137=_0x350dad[_0x216956(0x220)]||getActiveProfile();if(!_0x19d137)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(_0x230bd2[_0x216956(0x20a)]===0x0)return _0x216956(0x246)+ProfileSetCommand[_0x216956(0x1f2)]['join'](',\x20');const _0x6b7109=_0x230bd2[0x0];if(!_0x6b7109[_0x216956(0x23a)]('='))return _0x216956(0x232)+ProfileSetCommand['VALID_KEYS'][_0x216956(0x23e)](',\x20');const [_0x1624fa]=_0x6b7109['split']('=',0x2);if(!ProfileSetCommand[_0x216956(0x1f2)][_0x216956(0x23a)](_0x1624fa))return _0x216956(0x205)+_0x1624fa+_0x216956(0x20d)+ProfileSetCommand[_0x216956(0x1f2)]['join'](',\x20');return undefined;}async['execute'](_0x407f2a){const _0x2275cf=a33_0xc08a76,{args:_0x468a54,options:_0x3309e0}=_0x407f2a,_0x197c57=_0x3309e0[_0x2275cf(0x220)]||getActiveProfile(),[_0x2fe5e3,..._0x35e26e]=_0x468a54[0x0]['split']('='),_0x4cee16=_0x35e26e['join']('=');console[_0x2275cf(0x22d)](a33_0x2ae7c0[_0x2275cf(0x201)](_0x2275cf(0x1f5)));if(!profileExists(_0x197c57)){const _0x596611=await a33_0x91a64b({'type':_0x2275cf(0x21a),'name':_0x2275cf(0x242),'message':_0x2275cf(0x21d)+_0x197c57+_0x2275cf(0x255),'initial':!![]});if(!_0x596611[_0x2275cf(0x242)])return console[_0x2275cf(0x22d)]('Operation\x20cancelled'),0x1;}const _0x4b9f97=loadProfile(_0x197c57),_0x306e46=_0x4b9f97?.[_0x2275cf(0x1ec)]||{};if(_0x2fe5e3==='site'){const _0x57a7be=resolveSite(_0x4cee16);console[_0x2275cf(0x22d)](_0x2275cf(0x1f4)+_0x57a7be+_0x2275cf(0x231)),console['log'](_0x2275cf(0x24e)),console['log']('\x20\x20'+getConsoleUrl(_0x57a7be,_0x2275cf(0x211)));const _0x8b4bcc=await a33_0x91a64b({'type':'password','name':_0x2275cf(0x202),'message':_0x2275cf(0x22f),'validate':_0x4f30be=>{const _0x294319=_0x2275cf;if(!_0x4f30be||!_0x4f30be[_0x294319(0x1fe)]())return _0x294319(0x23b);return!![];}});if(!_0x8b4bcc['apiKey'])return console[_0x2275cf(0x22d)](_0x2275cf(0x20f)),0x1;console[_0x2275cf(0x22d)]('Validating\x20API\x20key...');try{const _0x3c38b9=TDX[_0x2275cf(0x242)]({'site':_0x57a7be,'apiKey':_0x8b4bcc['apiKey']['trim'](),'logLevel':_0x3309e0[_0x2275cf(0x20e)]??LogLevel['ERROR']}),_0x229a3c=await _0x3c38b9[_0x2275cf(0x21b)][_0x2275cf(0x24c)]();console[_0x2275cf(0x22d)](a33_0x2ae7c0['green']('✓')+_0x2275cf(0x216)+_0x229a3c[_0x2275cf(0x1ef)]+')');const _0x184d27=await isKeychainAvailable();_0x184d27?(await saveAPIKeyAsync(_0x8b4bcc[_0x2275cf(0x202)][_0x2275cf(0x1fe)](),_0x57a7be,_0x197c57),console[_0x2275cf(0x22d)](a33_0x2ae7c0['green']('✓')+_0x2275cf(0x1fc))):console[_0x2275cf(0x233)](a33_0x2ae7c0['yellow'](_0x2275cf(0x218))),_0x306e46[_0x2275cf(0x1ee)]=_0x57a7be;}catch(_0x32662f){if(_0x32662f instanceof HTTPClientError&&_0x32662f[_0x2275cf(0x241)]===0x191)return printAuthError(_0x32662f),0x1;return console[_0x2275cf(0x1ed)](a33_0x2ae7c0[_0x2275cf(0x249)]('✗\x20Validation\x20failed:\x20'+(_0x32662f instanceof Error?_0x32662f[_0x2275cf(0x230)]:String(_0x32662f)))),console[_0x2275cf(0x1ed)](_0x2275cf(0x247)),0x1;}}else _0x306e46[_0x2fe5e3]=_0x4cee16||undefined;return saveProfileToUserConfig(_0x197c57,_0x306e46),console['log'](a33_0x2ae7c0[_0x2275cf(0x204)]('✓')+_0x2275cf(0x237)+_0x197c57+_0x2275cf(0x217)+_0x2fe5e3+'='+(_0x4cee16||_0x2275cf(0x208))),0x0;}}function a33_0x17a1(){const _0x32ffd8=['llm_agent','\x20API\x20key\x20saved\x20to\x20system\x20keychain','Enter\x20profile\x20name:','trim','oauth','Removal\x20cancelled','bold','apiKey','all','green','Unknown\x20key\x20\x27','Enter\x20your\x20TD\x20API\x20key:','test','(cleared)','Failed\x20to\x20delete\x20profile:\x20','length','Profile\x20name\x20must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore','2035kvkjVl','\x27.\x0a\x0aValid\x20keys:\x20','logLevel','\x0aOperation\x20cancelled','3764fPnInJ','/app/mp/ak','\x0aSaved\x20to:\x20','Are\x20you\x20sure\x20you\x20want\x20to\x20remove\x20profile\x20\x27','Delete\x20a\x20profile','tdx.json','\x20API\x20key\x20is\x20valid\x20(User:\x20','\x27\x20updated:\x20','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','✗\x20Validation\x20failed:\x20','confirm','jobs','\x0aTip:\x20Use\x20\x27tdx\x20profile\x20use\x20','Profile\x20\x27','yellow','validate','profile','password','559010UKpcJl','\x27\x20deleted','\x0aAvailable\x20profiles:','476wHdGcE','\x20API\x20key\x20saved\x20to\x20system\x20keychain\x20(profile:\x20','profileName','Set\x20a\x20profile\x20configuration\x20value','\x0aSetting\x20up\x20authentication\x20for\x20site:\x20','You\x20can\x20find\x20your\x20API\x20key\x20at:','761kFwDcv','Create\x20a\x20new\x20profile','log','description','Enter\x20your\x20TD\x20API\x20key\x20for\x20the\x20new\x20site:','message','\x27\x20requires\x20API\x20key\x20validation.','Invalid\x20format.\x20Use:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','warn','10747144uwIlZl','Set\x20session\x20profile','Enter\x20description\x20(optional):','\x20Profile\x20\x27','You\x20can\x20now\x20use\x20tdx\x20commands\x20with\x20this\x20profile.\x20Try:','54KZcdnH','includes','API\x20key\x20cannot\x20be\x20empty','profile:delete','default','join','7964922knLsfe','\x20--default\x27\x20to\x20save\x20permanently','status','create','\x0aSetup\x20cancelled','name','6409284LXlmCi','Key=value\x20pair\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','Site\x20was\x20not\x20changed.','\x20\x20tdx\x20--profile\x20','red','\x27\x20does\x20not\x20exist.','dim','getUserInfo','text','\x0aYou\x20can\x20find\x20your\x20API\x20key\x20at:','tdx:\x20profile\x20delete','\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.','3255186oogXvV','Validating\x20API\x20key...','Profile\x20name\x20cannot\x20be\x20empty','\x27\x20created','\x27\x20does\x20not\x20exist.\x20Create\x20it?','ERROR','(session:\x20','session','tdx:\x20profile\x20create','llm_project','\x20\x20(no\x20profiles\x20found)','skipExistsCheck','profile:create','profile:use','config','error','site','email','Removed\x20existing\x20profile\x20\x27','force','VALID_KEYS','execute','Changing\x20site\x20to\x20\x27','tdx:\x20profile\x20set','Profile\x20was\x20not\x20created.\x20Please\x20try\x20again.','\x27\x20to\x20remove\x20it\x20first,\x20or\x20re-create\x20with\x20--force.','database','Session\x20profile\x20set\x20to:\x20','\x20\x20-\x20'];a33_0x17a1=function(){return _0x32ffd8;};return a33_0x17a1();}export class ProfileUseCommand extends BaseCommand{['name']=a33_0xc08a76(0x1eb);[a33_0xc08a76(0x22e)]=a33_0xc08a76(0x235);[a33_0xc08a76(0x21f)](_0x35fd12){const _0x24ffbc=a33_0xc08a76,{args:_0x3a05ea}=_0x35fd12;if(_0x3a05ea[_0x24ffbc(0x20a)]===0x0)return'Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20use\x20<name>\x20[--default]';return undefined;}async[a33_0xc08a76(0x1f3)](_0x2a7cd6){const _0x3d9f8b=a33_0xc08a76,{args:_0x2a7259,options:_0x46d7d3}=_0x2a7cd6,_0x2fbc09=_0x2a7259[0x0],_0x2965d7=_0x46d7d3[_0x3d9f8b(0x23d)];cleanExpiredSessions();if(!profileExists(_0x2fbc09)){console['error'](a33_0x2ae7c0['red'](_0x3d9f8b(0x21d)+_0x2fbc09+_0x3d9f8b(0x24a))),console[_0x3d9f8b(0x22d)]('\x0aAvailable\x20profiles:');const _0x9c387b=listProfiles();if(_0x9c387b['length']===0x0)console[_0x3d9f8b(0x22d)](_0x3d9f8b(0x25b));else for(const _0x3fe1a7 of _0x9c387b){console[_0x3d9f8b(0x22d)](_0x3d9f8b(0x1fa)+_0x3fe1a7[_0x3d9f8b(0x244)]);}return 0x1;}if(_0x2965d7){const _0x5440b6=a33_0x4e89af[_0x3d9f8b(0x23e)](getConfigDir(),_0x3d9f8b(0x215));return saveActiveProfileToUserConfig(_0x2fbc09),console[_0x3d9f8b(0x22d)]('Default\x20profile\x20set\x20to:\x20'+a33_0x2ae7c0[_0x3d9f8b(0x204)](_0x2fbc09)),console[_0x3d9f8b(0x22d)](a33_0x2ae7c0[_0x3d9f8b(0x24b)](_0x3d9f8b(0x212)+_0x5440b6)),0x0;}const _0x4f90ee=getSessionID(_0x46d7d3['session']);return saveSessionContext({'profile':_0x2fbc09},_0x46d7d3[_0x3d9f8b(0x258)]),console[_0x3d9f8b(0x22d)](_0x3d9f8b(0x1f9)+a33_0x2ae7c0[_0x3d9f8b(0x204)](_0x2fbc09)+'\x20'+a33_0x2ae7c0[_0x3d9f8b(0x24b)](_0x3d9f8b(0x257)+_0x4f90ee+')')),console[_0x3d9f8b(0x22d)](a33_0x2ae7c0[_0x3d9f8b(0x24b)](_0x3d9f8b(0x21c)+_0x2fbc09+_0x3d9f8b(0x240))),0x0;}}
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 +1 @@
1
- function a34_0xbbbb(){const _0x54b35d=['2082848dNDdJO','description','config','84335vycADF','map','\x20\x20Local:\x20\x20(project\x20folder)/tdx.json','No\x20profiles\x20found.\x20Define\x20profiles\x20in\x20tdx.json:\x0a','639426GydEDa','name','site','error','Error:\x20','message','dim','green','profiles','2334DtbUTF','970124HXynln','1733922nHClqc','1219547GDwzel','scope','3815gCPIPZ','log'];a34_0xbbbb=function(){return _0x54b35d;};return a34_0xbbbb();}const a34_0x2589dc=a34_0x2f20;(function(_0x364d78,_0x54937f){const _0x12ec98=a34_0x2f20,_0x49ca4d=_0x364d78();while(!![]){try{const _0x15cda1=parseInt(_0x12ec98(0x15c))/0x1+parseInt(_0x12ec98(0x160))/0x2+-parseInt(_0x12ec98(0x16b))/0x3+-parseInt(_0x12ec98(0x16a))/0x4+-parseInt(_0x12ec98(0x157))/0x5*(-parseInt(_0x12ec98(0x169))/0x6)+parseInt(_0x12ec98(0x155))/0x7+parseInt(_0x12ec98(0x159))/0x8;if(_0x15cda1===_0x54937f)break;else _0x49ca4d['push'](_0x49ca4d['shift']());}catch(_0x10e366){_0x49ca4d['push'](_0x49ca4d['shift']());}}}(a34_0xbbbb,0x4ce2f));import{BaseCommand}from'./command.js';import{listProfiles,getActiveProfile,getProfileParams}from'../core/profile.js';function a34_0x2f20(_0x598d56,_0x29ef5f){_0x598d56=_0x598d56-0x155;const _0xbbbbec=a34_0xbbbb();let _0x2f20a1=_0xbbbbec[_0x598d56];return _0x2f20a1;}import{handleSDKOutput,isStructuredFormat}from'../core/command-output.js';import a34_0x2447d4 from'chalk';export class ProfilesCommand extends BaseCommand{[a34_0x2589dc(0x161)]=a34_0x2589dc(0x168);[a34_0x2589dc(0x15a)]='List\x20all\x20available\x20profiles';async['execute'](_0x134af6){const _0x124c6b=a34_0x2589dc,{options:_0x345a98}=_0x134af6;try{const _0x14c86e=listProfiles(),_0x29343c=getActiveProfile();if(_0x14c86e['length']===0x0)return console['log'](_0x124c6b(0x15f)),console[_0x124c6b(0x158)](_0x124c6b(0x15e)),console[_0x124c6b(0x158)]('\x20\x20Global:\x20~/.config/tdx/tdx.json'),0x0;const _0x16d945=_0x14c86e[_0x124c6b(0x15d)](_0x5da4ae=>{const _0x2729b7=_0x124c6b,_0x5bd2e2=_0x5da4ae[_0x2729b7(0x161)]===_0x29343c,_0xb686d3=getProfileParams(_0x5da4ae[_0x2729b7(0x15b)]);return{'name':_0x5da4ae['name'],'active':_0x5bd2e2,'scope':_0x5da4ae[_0x2729b7(0x156)],'description':_0x5da4ae[_0x2729b7(0x15b)]['description']||'','params':_0xb686d3};});if(isStructuredFormat(_0x345a98))await handleSDKOutput(_0x16d945,_0x345a98);else for(const _0x25a283 of _0x14c86e){const _0x2455b6=_0x25a283[_0x124c6b(0x161)]===_0x29343c?a34_0x2447d4[_0x124c6b(0x167)]('\x20✓'):'',_0x4c172a=_0x25a283[_0x124c6b(0x15b)][_0x124c6b(0x162)]?a34_0x2447d4['dim']('\x20'+_0x25a283[_0x124c6b(0x15b)][_0x124c6b(0x162)]):'',_0x666bbe=_0x25a283[_0x124c6b(0x15b)]['description']?a34_0x2447d4[_0x124c6b(0x166)]('\x20\x20'+_0x25a283[_0x124c6b(0x15b)][_0x124c6b(0x15a)]):'';console[_0x124c6b(0x158)]('👤\x20'+_0x25a283[_0x124c6b(0x161)]+_0x2455b6+_0x4c172a+_0x666bbe);}return 0x0;}catch(_0x250eac){return _0x250eac instanceof Error&&console[_0x124c6b(0x163)](_0x124c6b(0x164)+_0x250eac[_0x124c6b(0x165)]),0x1;}}}
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 +1 @@
1
- const a35_0x156d67=a35_0x14d7;(function(_0x540e8e,_0x36cb53){const _0x5b5685=a35_0x14d7,_0x177986=_0x540e8e();while(!![]){try{const _0x7a32e3=-parseInt(_0x5b5685(0x102))/0x1*(parseInt(_0x5b5685(0xf2))/0x2)+parseInt(_0x5b5685(0x117))/0x3*(parseInt(_0x5b5685(0x104))/0x4)+-parseInt(_0x5b5685(0x11f))/0x5+parseInt(_0x5b5685(0xee))/0x6+-parseInt(_0x5b5685(0x105))/0x7+parseInt(_0x5b5685(0xfb))/0x8*(parseInt(_0x5b5685(0x100))/0x9)+-parseInt(_0x5b5685(0x11c))/0xa*(parseInt(_0x5b5685(0xfe))/0xb);if(_0x7a32e3===_0x36cb53)break;else _0x177986['push'](_0x177986['shift']());}catch(_0x274f12){_0x177986['push'](_0x177986['shift']());}}}(a35_0x3881,0x9e5f9));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';import{handleQueryOutput,formatQueryOutput,resolveOutputOptions}from'../core/command-output.js';function a35_0x14d7(_0x194741,_0x41ca70){_0x194741=_0x194741-0xed;const _0x3881e4=a35_0x3881();let _0x14d7fe=_0x3881e4[_0x194741];return _0x14d7fe;}import{readSqlStatementsFromFile,readSqlStatementsFromStdin,splitSqlStatements,isSqlFilePath}from'../sdk/query/sql-parser.js';import{writeFileSync}from'fs';import{withProgressSpinner,formatElapsed}from'../utils/spinner.js';import{formatRows}from'../sdk/util/formatters.js';function a35_0x3881(){const _0x3a1fc8=['setExtra','length','args','SQL:\x20','Run\x20Trino\x20queries\x20(streaming)','674768yWMwWj','\x20rows\x20','Schema:\x20','11jBDPDK','execute','99kTvAtC','Executing\x20query...','1244RAQuQK','database','2540ifLcwu','787990tSwAUO','completedSplits','join','message','\x20-\x20','processedRows','output','setJobId','name','stats','Query\x20completed:\x20Processed\x20','Cannot\x20specify\x20both\x20SQL\x20argument\x20and\x20--file\x20option','\x20[Job\x20ID:\x20','description','No\x20SQL\x20provided','verbose','Executing\x20statement\x20','data','3627BZbDKL','error','site','Statement\x20','file','9971790FDfRmp','Site:\x20','query','93345zprwRU','totalSplits','3213924HFTYIH','Executing\x20query\x20[','\x0aAll\x20results\x20saved\x20to\x20','\x20splits','730zaRwEY','setPhase','validate','state'];a35_0x3881=function(){return _0x3a1fc8;};return a35_0x3881();}export class QueryCommand extends BaseCommand{[a35_0x156d67(0x10d)]='query';[a35_0x156d67(0x112)]=a35_0x156d67(0xfa);async['execute'](_0x247f2e){const _0xefaec0=a35_0x156d67,{options:_0x334d1e,args:_0x49296e,tdx:_0x4557e2}=_0x247f2e,_0xf7e342={..._0x334d1e,'limitStructuredFormats':!![]},_0x174afd=_0x49296e[0x0],_0x3c3873=_0x334d1e[_0xefaec0(0x11b)];let _0x5769db;try{if(_0x3c3873)_0x5769db=readSqlStatementsFromFile(_0x3c3873);else{if(_0x174afd==='-')_0x5769db=await readSqlStatementsFromStdin();else{if(_0x174afd&&isSqlFilePath(_0x174afd))_0x5769db=readSqlStatementsFromFile(_0x174afd);else{if(_0x174afd)_0x5769db=splitSqlStatements(_0x174afd);else throw new Error(_0xefaec0(0x113));}}}}catch(_0xc9280f){return console['error']('Error:\x20'+_0xc9280f[_0xefaec0(0x108)]),0x1;}const _0x1c870d=_0x334d1e[_0xefaec0(0x103)]||'information_schema',_0x54193b=_0x334d1e['catalog'];try{const _0x4becc2=[],_0x1fafc2=!!_0x334d1e[_0xefaec0(0x10b)];for(let _0x10f472=0x0;_0x10f472<_0x5769db[_0xefaec0(0xf7)];_0x10f472++){const _0x183fb5=_0x5769db[_0x10f472],_0x5eabd3=_0x10f472+0x1,_0x4b1665=_0x5769db[_0xefaec0(0xf7)],_0x5c2e96=_0x4b1665>0x1;_0x334d1e[_0xefaec0(0x114)]&&(console[_0xefaec0(0x118)]('\x0a'+(_0x5c2e96?_0xefaec0(0x11a)+_0x5eabd3+'/'+_0x4b1665+':':'')),console[_0xefaec0(0x118)](_0xefaec0(0x11d)+_0x334d1e[_0xefaec0(0x119)]),console['error']('Catalog:\x20'+(_0x54193b||'td')),console[_0xefaec0(0x118)](_0xefaec0(0xfd)+_0x1c870d),console[_0xefaec0(0x118)](_0xefaec0(0xf9)+_0x183fb5));const _0x2a4713=_0x5c2e96?_0xefaec0(0x115)+_0x5eabd3+'/'+_0x4b1665+'...':_0xefaec0(0x101);try{const _0x1d5154=await withProgressSpinner(_0x2a4713,async _0x545cef=>{const _0x57cdbd=_0xefaec0,_0x4dafee=await _0x4557e2[_0x57cdbd(0x11e)][_0x57cdbd(0xff)](_0x183fb5,{'catalog':_0x54193b,'schema':_0x1c870d,'onJobId':_0xa40c28=>{const _0x3871e6=_0x57cdbd;_0x545cef[_0x3871e6(0x10c)](_0xa40c28);},'onProgress':_0x244921=>{const _0x356cca=_0x57cdbd;_0x545cef[_0x356cca(0xf3)](_0x356cca(0xef)+_0x244921[_0x356cca(0xf5)]+']'),_0x545cef[_0x356cca(0xf6)](formatRows(_0x244921[_0x356cca(0x10a)])+_0x356cca(0xfc)+_0x244921[_0x356cca(0x106)]+'/'+_0x244921[_0x356cca(0xed)]+_0x356cca(0xf1));}});return _0x4dafee;},{'verbose':_0x334d1e[_0xefaec0(0x114)]}),_0x539480=_0x1d5154[_0xefaec0(0x116)],_0x2226ed=_0x539480['jobId']?_0xefaec0(0x111)+_0x539480['jobId']+']':'',_0x59a9a1=_0x5c2e96?_0xefaec0(0x11a)+_0x5eabd3+'/'+_0x4b1665+_0xefaec0(0x109):'';console['error']('✔\x20'+_0x59a9a1+_0xefaec0(0x10f)+formatRows(_0x539480['stats'][_0xefaec0(0x10a)])+_0xefaec0(0xfc)+('in\x20'+formatElapsed(_0x539480[_0xefaec0(0x10e)]['elapsedTimeMillis'])+_0x2226ed));if(_0x5c2e96&&_0x1fafc2){const _0x32a504=resolveOutputOptions(_0xf7e342),_0x1f38a3=await formatQueryOutput(_0x539480,_0x32a504);_0x4becc2['push'](_0x1f38a3);}else await handleQueryOutput(_0x539480,_0xf7e342);}catch(_0x5d691b){const _0x23f42a=_0x5c2e96?_0xefaec0(0x11a)+_0x5eabd3+'/'+_0x4b1665+':\x0a':'',_0x124e33=_0x5d691b instanceof SDKError?_0x5d691b['originalMessage']:_0x5d691b['message'];return console[_0xefaec0(0x118)](''+_0x23f42a+_0x124e33),0x1;}}if(_0x5769db['length']>0x1&&_0x1fafc2&&_0x4becc2[_0xefaec0(0xf7)]>0x0){const _0x532481=_0x4becc2[_0xefaec0(0x107)]('\x0a');writeFileSync(_0x334d1e[_0xefaec0(0x10b)],_0x532481),console[_0xefaec0(0x118)](_0xefaec0(0xf0)+_0x334d1e[_0xefaec0(0x10b)]);}return 0x0;}catch(_0x25711b){throw _0x25711b;}}[a35_0x156d67(0xf4)](_0x559d22){const _0x27d6e8=a35_0x156d67,_0x433e90=_0x559d22[_0x27d6e8(0xf8)][0x0],_0x5a3f45=_0x559d22['options'][_0x27d6e8(0x11b)];if(!_0x433e90&&!_0x5a3f45)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(_0x433e90&&_0x5a3f45)return _0x27d6e8(0x110);return undefined;}}
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 +1 @@
1
- const a36_0x204e57=a36_0x5c85;(function(_0xc42b46,_0x269c9e){const _0x125d41=a36_0x5c85,_0x3b93cc=_0xc42b46();while(!![]){try{const _0x48d008=parseInt(_0x125d41(0x13d))/0x1*(parseInt(_0x125d41(0x135))/0x2)+parseInt(_0x125d41(0x12b))/0x3+parseInt(_0x125d41(0x14a))/0x4+parseInt(_0x125d41(0x13e))/0x5*(-parseInt(_0x125d41(0xf1))/0x6)+parseInt(_0x125d41(0x10c))/0x7+-parseInt(_0x125d41(0x15d))/0x8+parseInt(_0x125d41(0xfa))/0x9*(-parseInt(_0x125d41(0x186))/0xa);if(_0x48d008===_0x269c9e)break;else _0x3b93cc['push'](_0x3b93cc['shift']());}catch(_0x122520){_0x3b93cc['push'](_0x3b93cc['shift']());}}}(a36_0x1f4b,0xaa61e));function a36_0x1f4b(){const _0x307aca=['Deleting\x20schedule...','Run\x20a\x20scheduled\x20query\x20immediately','trino','count','execute','output','2817528ejtnrS','toLocaleDateString','list','schedules','Schedule\x20updated:\x20','timezone','delay','Database\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]','listQueries','create','40134tFqksD','validate','INVALID_ARGUMENT','cyan','start_at','data','updated_at','\x20\x20→\x20','12YFpMML','2274205CYclih','yes','Delete\x20a\x20scheduled\x20query','soon','args','pagination','Schedule\x20run\x20submitted:\x20','\x20\x20Type:\x20','List\x20scheduled\x20queries','delete','schedule:list','num','2234188VFToKh','m\x20ago','\x20\x20Cron:\x20','jsonl','round','result','\x20execution','never','Create\x20a\x20scheduled\x20query','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20delete\x20<name>','\x20\x20Time:\x20','Creating\x20schedule...','keys','time_zone','dim','Updating\x20schedule:\x20','created_at','\x20scheduled\x20quer','in\x20','3703728VyeaxV','substring','Creating\x20schedule:\x20','/app/queries/editor?queryId=','limit','verbose','description','database','history','\x20schedules','Getting\x20schedule\x20details...','next_run_at','utf-8','retryLimit','Running\x20schedule:\x20','job_id','repeat','\x20\x20Num:\x20','show','schedule:show','max','green','lastRun','last_job','length','map','name','retry_limit','schedule:run','executing_user_id','log','schedule:create','...','has_next_page','\x20\x20Timezone:\x20','json','No\x20scheduled\x20queries\x20found','(unnamed)','success','red','Failed\x20to\x20read\x20file:\x20','11560kyUBVR','Running\x20schedule...','Found\x20','update','6jhyflm','format','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20history\x20<name>\x20[--from\x20<n>]\x20[--to\x20<n>]','Cancelled','join','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20update\x20<name>\x20[options]','statusIcon','queryUrl','padEnd','8559hWBgoE','Schedule\x20created:\x20','user','from','ended_at','\x20(use\x20--limit\x20to\x20see\x20more)','end_at','schedule:history','priority','type','\x20job','schedule:update','\x20(showing\x20','Show\x20schedule\x20details','ies','abs','cron','trim','6835654SHoswR','Getting\x20schedule\x20history...','\x20\x20Job\x20ID:\x20','getTime','scheduled_at','Update\x20a\x20scheduled\x20query','schedule:delete','status','d\x20ago','\x22...','engineVersion','📅\x20','error','Show\x20schedule\x20execution\x20history','queries','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]','nextRun','jobs','Query\x20file\x20is\x20empty','query','file','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20show\x20<name>','h\x20ago','run','options'];a36_0x1f4b=function(){return _0x307aca;};return a36_0x1f4b();}import{BaseCommand}from'./command.js';function a36_0x5c85(_0xf3a8ad,_0xbe2f3d){_0xf3a8ad=_0xf3a8ad-0xf0;const _0x1f4bcf=a36_0x1f4b();let _0x5c85d3=_0x1f4bcf[_0xf3a8ad];return _0x5c85d3;}import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,handleSingleObjectOutput,writeOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import{confirm}from'../utils/prompt.js';import{readFileSync}from'fs';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import{getConsoleUrl}from'../sdk/client/endpoints.js';import{hyperlink}from'../sdk/util/formatters.js';import a36_0x2b8a06 from'chalk';function formatRelativeTime(_0x34ffb6){const _0x273e11=a36_0x5c85,_0x2e278b=new Date(_0x34ffb6),_0x2cae81=new Date(),_0x1a2cca=_0x2e278b[_0x273e11(0x10f)]()-_0x2cae81[_0x273e11(0x10f)](),_0x5dd999=Math[_0x273e11(0x109)](_0x1a2cca)/0x3e8,_0x4f0116=_0x1a2cca<0x0;if(_0x5dd999<0x3c)return _0x4f0116?'just\x20now':_0x273e11(0x141);else{if(_0x5dd999<0xe10){const _0x276718=Math[_0x273e11(0x14e)](_0x5dd999/0x3c);return _0x4f0116?_0x276718+_0x273e11(0x14b):_0x273e11(0x15c)+_0x276718+'m';}else{if(_0x5dd999<0x15180){const _0xd0f931=Math['round'](_0x5dd999/0xe10);return _0x4f0116?_0xd0f931+_0x273e11(0x122):_0x273e11(0x15c)+_0xd0f931+'h';}else{if(_0x5dd999<0x93a80){const _0x8fe721=Math[_0x273e11(0x14e)](_0x5dd999/0x15180);return _0x4f0116?_0x8fe721+_0x273e11(0x114):_0x273e11(0x15c)+_0x8fe721+'d';}else return _0x2e278b[_0x273e11(0x12c)]();}}}}export class ScheduleListCommand extends BaseCommand{[a36_0x204e57(0x177)]=a36_0x204e57(0x148);[a36_0x204e57(0x163)]=a36_0x204e57(0x146);async[a36_0x204e57(0x129)](_0x59673){const _0x43cb88=a36_0x204e57,{options:_0xcaa9b0,args:_0x12735f,tdx:_0x598d56}=_0x59673,_0x12b9b3=resolveLimit(_0xcaa9b0[_0x43cb88(0x161)],DEFAULT_DISPLAY_LIMIT),_0x3243cb=_0x12735f[0x0],_0x37c595=_0x3243cb?'Searching\x20scheduled\x20queries\x20matching\x20\x22'+_0x3243cb+_0x43cb88(0x115):'Listing\x20scheduled\x20queries...',_0x277c0a=await withSpinner(_0x37c595,()=>_0x598d56[_0x43cb88(0x12e)][_0x43cb88(0x133)]({'limit':_0x12b9b3,'scheduled':!![],'pattern':_0x3243cb}),{'verbose':_0xcaa9b0['verbose']}),_0x5937e2=_0x277c0a['data'][_0x43cb88(0x11a)],_0x327655=_0x277c0a[_0x43cb88(0x13a)][_0x43cb88(0x143)][_0x43cb88(0x17e)],_0x3e1ea8=_0x3243cb?'\x20matching\x20\x22'+_0x3243cb+'\x22':'';_0x327655?console[_0x43cb88(0x118)]('Showing\x20first\x20'+_0x5937e2[_0x43cb88(0x175)]+_0x43cb88(0x166)+_0x3e1ea8+_0x43cb88(0xff)):console[_0x43cb88(0x118)](_0x43cb88(0x188)+_0x5937e2[_0x43cb88(0x175)]+_0x43cb88(0x15b)+(_0x5937e2[_0x43cb88(0x175)]!==0x1?_0x43cb88(0x108):'y')+_0x3e1ea8);if(_0xcaa9b0[_0x43cb88(0xf2)]===_0x43cb88(0x180)||_0xcaa9b0[_0x43cb88(0xf2)]===_0x43cb88(0x14d)||_0xcaa9b0[_0x43cb88(0xf2)]==='table'||_0xcaa9b0['format']==='tsv'){const _0x2cc44c=_0x5937e2[_0x43cb88(0x176)](_0x3c2bec=>({'id':_0x3c2bec['id'],'name':_0x3c2bec[_0x43cb88(0x177)],'cron':_0x3c2bec[_0x43cb88(0x10a)],'database':_0x3c2bec[_0x43cb88(0x164)]?.[_0x43cb88(0x177)],'type':_0x3c2bec['type'],'timezone':_0x3c2bec[_0x43cb88(0x157)],'user_name':_0x3c2bec[_0x43cb88(0xfc)]?.['name'],'updated_at':_0x3c2bec[_0x43cb88(0x13b)],'next_run_at':_0x3c2bec[_0x43cb88(0x168)],'last_job_status':_0x3c2bec['last_job']?.[_0x43cb88(0x113)]}));await handleSDKOutput(_0x2cc44c,_0xcaa9b0);}else{if(_0x5937e2['length']===0x0)console[_0x43cb88(0x17b)](_0x43cb88(0x181));else{const _0x4531db=_0xcaa9b0['site'],_0x35713c=_0x5937e2['map'](_0x2c6901=>{const _0x23e39b=_0x43cb88,_0x1609dc=_0x2c6901[_0x23e39b(0x174)]?.[_0x23e39b(0x113)]?_0x2c6901[_0x23e39b(0x174)]['status']===_0x23e39b(0x183)?'✓':'✗':'-',_0x126018=_0x2c6901[_0x23e39b(0x174)]?.[_0x23e39b(0xfe)]?formatRelativeTime(_0x2c6901[_0x23e39b(0x174)]['ended_at']):_0x23e39b(0x151),_0x2d31e7=_0x2c6901['next_run_at']?formatRelativeTime(_0x2c6901[_0x23e39b(0x168)]):'-',_0x5ca915=_0x2c6901['cron']||'',_0x4380ff=_0x2c6901[_0x23e39b(0x177)]||_0x23e39b(0x182),_0x247b26=getConsoleUrl(_0x4531db,_0x23e39b(0x160)+_0x2c6901['id']);return{'statusIcon':_0x1609dc,'lastRun':_0x126018,'nextRun':_0x2d31e7,'cron':_0x5ca915,'name':_0x4380ff,'queryUrl':_0x247b26,'status':_0x2c6901['last_job']?.[_0x23e39b(0x113)]};}),_0x6079b6=Math[_0x43cb88(0x171)](..._0x35713c[_0x43cb88(0x176)](_0x35b2e6=>_0x35b2e6[_0x43cb88(0x173)][_0x43cb88(0x175)])),_0x3788d4=Math[_0x43cb88(0x171)](..._0x35713c[_0x43cb88(0x176)](_0x155b03=>_0x155b03[_0x43cb88(0x11c)][_0x43cb88(0x175)])),_0x1698bb=Math[_0x43cb88(0x171)](..._0x35713c[_0x43cb88(0x176)](_0x4dc343=>_0x4dc343['cron'][_0x43cb88(0x175)])),_0x44ebd2=_0x35713c[_0x43cb88(0x176)](_0x44742b=>{const _0x222e72=_0x43cb88,_0x2f69dc=_0x44742b[_0x222e72(0x113)]==='success'?a36_0x2b8a06[_0x222e72(0x172)](_0x44742b['statusIcon']):_0x44742b['status']===_0x222e72(0x118)?a36_0x2b8a06[_0x222e72(0x184)](_0x44742b[_0x222e72(0xf7)]):a36_0x2b8a06[_0x222e72(0x158)](_0x44742b[_0x222e72(0xf7)]),_0x496a54=_0x44742b[_0x222e72(0x173)][_0x222e72(0xf9)](_0x6079b6),_0x40dadf=_0x44742b[_0x222e72(0x11c)]['padEnd'](_0x3788d4),_0x509e1f=_0x44742b[_0x222e72(0x10a)]?a36_0x2b8a06[_0x222e72(0x138)](_0x44742b['cron'][_0x222e72(0xf9)](_0x1698bb)):'\x20'[_0x222e72(0x16d)](_0x1698bb),_0x3a43f7=hyperlink(_0x44742b['name'],_0x44742b[_0x222e72(0xf8)]);return _0x222e72(0x117)+_0x2f69dc+'\x20'+_0x496a54+_0x222e72(0x13c)+_0x40dadf+'\x20\x20'+_0x509e1f+'\x20\x20'+_0x3a43f7;});await writeOutput(_0x44ebd2[_0x43cb88(0xf5)]('\x0a'),_0xcaa9b0[_0x43cb88(0x12a)],_0x43cb88(0x12d));}}return 0x0;}}export class ScheduleShowCommand extends BaseCommand{[a36_0x204e57(0x177)]=a36_0x204e57(0x170);[a36_0x204e57(0x163)]=a36_0x204e57(0x107);[a36_0x204e57(0x136)](_0x9bb6b3){const _0x290980=a36_0x204e57,_0x31c729=_0x9bb6b3[_0x290980(0x142)][0x0];if(!_0x31c729)return _0x290980(0x121);return undefined;}async['execute'](_0x3c744b){const _0x35fe66=a36_0x204e57,{options:_0x4b1fb5,args:_0x3a4c30,tdx:_0x1040a7}=_0x3c744b,_0x462e4c=_0x3a4c30[0x0],_0x4b429b=await withSpinner(_0x35fe66(0x167),()=>_0x1040a7['schedules'][_0x35fe66(0x16f)](_0x462e4c),{'verbose':_0x4b1fb5[_0x35fe66(0x162)]}),_0x170279=_0x4b429b['data'],_0x12b888={'name':_0x170279[_0x35fe66(0x177)],'cron':_0x170279['cron'],'database':_0x170279[_0x35fe66(0x164)],'type':_0x170279[_0x35fe66(0x103)],'timezone':_0x170279[_0x35fe66(0x130)],'user_name':_0x170279['user_name'],'created_at':_0x170279[_0x35fe66(0x15a)],'engine_version':_0x170279['engine_version'],'executing_user_id':_0x170279[_0x35fe66(0x17a)],'query':_0x170279['query'],'delay':_0x170279['delay'],'priority':_0x170279[_0x35fe66(0x102)],'retry_limit':_0x170279[_0x35fe66(0x178)],..._0x170279[_0x35fe66(0x14f)]&&{'result':_0x170279['result']}};return await handleSingleObjectOutput(_0x12b888,_0x4b1fb5),0x0;}}export class ScheduleCreateCommand extends BaseCommand{[a36_0x204e57(0x177)]=a36_0x204e57(0x17c);[a36_0x204e57(0x163)]=a36_0x204e57(0x152);[a36_0x204e57(0x136)](_0x2a33d7){const _0x2a5144=a36_0x204e57,_0x15726e=_0x2a33d7[_0x2a5144(0x142)][0x0];if(!_0x15726e)return _0x2a5144(0x11b);const _0x3be726=_0x2a33d7[_0x2a5144(0x124)];if(!_0x3be726['database'])return _0x2a5144(0x132);return undefined;}async['execute'](_0x107c96){const _0x1cdf98=a36_0x204e57,{options:_0x530eff,args:_0x2e756c,tdx:_0x16a0c7}=_0x107c96,_0x23a8b0=_0x2e756c[0x0],_0x15f031=_0x530eff,_0xc1ec18=_0x15f031[_0x1cdf98(0x164)],_0x582d67=_0x15f031[_0x1cdf98(0x120)],_0x37d86a=_0x15f031[_0x1cdf98(0x103)]||_0x1cdf98(0x127);let _0x436703;try{_0x436703=readFileSync(_0x582d67,_0x1cdf98(0x169))[_0x1cdf98(0x10b)]();}catch(_0x36dc13){throw new SDKError(ErrorCode[_0x1cdf98(0x137)],'Failed\x20to\x20read\x20file:\x20'+_0x582d67,_0x36dc13 instanceof Error?_0x36dc13:undefined);}if(!_0x436703)throw new SDKError(ErrorCode[_0x1cdf98(0x137)],_0x1cdf98(0x11e));const _0x2049d6={'database':_0xc1ec18,'query':_0x436703,'type':_0x37d86a};if(_0x15f031['cron'])_0x2049d6[_0x1cdf98(0x10a)]=_0x15f031[_0x1cdf98(0x10a)];if(_0x15f031[_0x1cdf98(0x130)])_0x2049d6[_0x1cdf98(0x130)]=_0x15f031[_0x1cdf98(0x130)];if(_0x15f031[_0x1cdf98(0x131)]!==undefined)_0x2049d6[_0x1cdf98(0x131)]=Number(_0x15f031[_0x1cdf98(0x131)]);if(_0x15f031['priority']!==undefined)_0x2049d6[_0x1cdf98(0x102)]=Number(_0x15f031[_0x1cdf98(0x102)]);if(_0x15f031[_0x1cdf98(0x16a)]!==undefined)_0x2049d6['retry_limit']=Number(_0x15f031[_0x1cdf98(0x16a)]);if(_0x15f031[_0x1cdf98(0x116)])_0x2049d6['engine_version']=_0x15f031[_0x1cdf98(0x116)];if(_0x15f031['result'])_0x2049d6[_0x1cdf98(0x14f)]=_0x15f031[_0x1cdf98(0x14f)];if(_0x530eff[_0x1cdf98(0x162)]){console['error'](_0x1cdf98(0x15f)+_0x23a8b0),console['error']('\x20\x20Database:\x20'+_0xc1ec18),console[_0x1cdf98(0x118)](_0x1cdf98(0x145)+_0x37d86a);if(_0x2049d6[_0x1cdf98(0x10a)])console[_0x1cdf98(0x118)](_0x1cdf98(0x14c)+_0x2049d6[_0x1cdf98(0x10a)]);if(_0x2049d6[_0x1cdf98(0x130)])console['error'](_0x1cdf98(0x17f)+_0x2049d6[_0x1cdf98(0x130)]);}const _0x128b17=await withSpinner(_0x1cdf98(0x155),()=>_0x16a0c7[_0x1cdf98(0x12e)][_0x1cdf98(0x134)](_0x23a8b0,_0x2049d6),{'verbose':_0x530eff[_0x1cdf98(0x162)]});return console[_0x1cdf98(0x118)](_0x1cdf98(0xfb)+_0x128b17[_0x1cdf98(0x13a)][_0x1cdf98(0x177)]),await handleSingleObjectOutput(_0x128b17[_0x1cdf98(0x13a)],_0x530eff),0x0;}}export class ScheduleUpdateCommand extends BaseCommand{[a36_0x204e57(0x177)]=a36_0x204e57(0x105);[a36_0x204e57(0x163)]=a36_0x204e57(0x111);[a36_0x204e57(0x136)](_0x99c95e){const _0x5920a7=a36_0x204e57,_0x255acf=_0x99c95e[_0x5920a7(0x142)][0x0];if(!_0x255acf)return _0x5920a7(0xf6);return undefined;}async[a36_0x204e57(0x129)](_0x30eb87){const _0x48ad08=a36_0x204e57,{options:_0x205cf9,args:_0x363281,tdx:_0xece36e}=_0x30eb87,_0x2904f5=_0x363281[0x0],_0x528cf3=_0x205cf9,_0x2c01e9={};if(_0x528cf3['database'])_0x2c01e9[_0x48ad08(0x164)]=_0x528cf3[_0x48ad08(0x164)];if(_0x528cf3[_0x48ad08(0x103)])_0x2c01e9[_0x48ad08(0x103)]=_0x528cf3[_0x48ad08(0x103)];if(_0x528cf3['cron'])_0x2c01e9['cron']=_0x528cf3[_0x48ad08(0x10a)];if(_0x528cf3['timezone'])_0x2c01e9[_0x48ad08(0x130)]=_0x528cf3[_0x48ad08(0x130)];if(_0x528cf3[_0x48ad08(0x131)]!==undefined)_0x2c01e9['delay']=Number(_0x528cf3[_0x48ad08(0x131)]);if(_0x528cf3[_0x48ad08(0x102)]!==undefined)_0x2c01e9['priority']=Number(_0x528cf3[_0x48ad08(0x102)]);if(_0x528cf3[_0x48ad08(0x16a)]!==undefined)_0x2c01e9[_0x48ad08(0x178)]=Number(_0x528cf3[_0x48ad08(0x16a)]);if(_0x528cf3[_0x48ad08(0x116)])_0x2c01e9['engine_version']=_0x528cf3[_0x48ad08(0x116)];if(_0x528cf3[_0x48ad08(0x14f)])_0x2c01e9[_0x48ad08(0x14f)]=_0x528cf3[_0x48ad08(0x14f)];if(_0x528cf3[_0x48ad08(0x120)])try{_0x2c01e9[_0x48ad08(0x11f)]=readFileSync(_0x528cf3[_0x48ad08(0x120)],_0x48ad08(0x169))['trim']();}catch(_0xcbd2a9){throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x48ad08(0x185)+_0x528cf3[_0x48ad08(0x120)],_0xcbd2a9 instanceof Error?_0xcbd2a9:undefined);}if(Object[_0x48ad08(0x156)](_0x2c01e9)[_0x48ad08(0x175)]===0x0)throw new SDKError(ErrorCode[_0x48ad08(0x137)],'At\x20least\x20one\x20option\x20must\x20be\x20provided\x20to\x20update');if(_0x205cf9['verbose']){console[_0x48ad08(0x118)](_0x48ad08(0x159)+_0x2904f5);for(const [_0x342f50,_0x2917dc]of Object['entries'](_0x2c01e9)){_0x342f50===_0x48ad08(0x11f)?console['error']('\x20\x20'+_0x342f50+':\x20'+_0x2917dc[_0x48ad08(0x15e)](0x0,0x32)+_0x48ad08(0x17d)):console['error']('\x20\x20'+_0x342f50+':\x20'+_0x2917dc);}}const _0x161d11=await withSpinner('Updating\x20schedule...',()=>_0xece36e[_0x48ad08(0x12e)][_0x48ad08(0xf0)](_0x2904f5,_0x2c01e9),{'verbose':_0x205cf9[_0x48ad08(0x162)]});return console[_0x48ad08(0x118)](_0x48ad08(0x12f)+_0x161d11[_0x48ad08(0x13a)][_0x48ad08(0x177)]),await handleSingleObjectOutput(_0x161d11[_0x48ad08(0x13a)],_0x205cf9),0x0;}}export class ScheduleDeleteCommand extends BaseCommand{[a36_0x204e57(0x177)]=a36_0x204e57(0x112);[a36_0x204e57(0x163)]=a36_0x204e57(0x140);[a36_0x204e57(0x136)](_0x7a57e5){const _0x31b20f=a36_0x204e57,_0x43195c=_0x7a57e5[_0x31b20f(0x142)][0x0];if(!_0x43195c)return _0x31b20f(0x153);return undefined;}async[a36_0x204e57(0x129)](_0x438844){const _0x2c80a9=a36_0x204e57,{options:_0x1cff69,args:_0x2794b1,tdx:_0x2c19c6}=_0x438844,_0x3a286a=_0x2794b1[0x0];if(!_0x1cff69[_0x2c80a9(0x13f)]){const _0x4b7345=await confirm('Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20schedule\x20\x22'+_0x3a286a+'\x22?');if(!_0x4b7345)return console[_0x2c80a9(0x118)](_0x2c80a9(0xf4)),0x0;}const _0x3717c1=await withSpinner(_0x2c80a9(0x125),()=>_0x2c19c6['schedules'][_0x2c80a9(0x147)](_0x3a286a),{'verbose':_0x1cff69[_0x2c80a9(0x162)]});return console[_0x2c80a9(0x118)]('Schedule\x20deleted:\x20'+_0x3717c1[_0x2c80a9(0x13a)]['name']),0x0;}}export class ScheduleRunCommand extends BaseCommand{[a36_0x204e57(0x177)]=a36_0x204e57(0x179);[a36_0x204e57(0x163)]=a36_0x204e57(0x126);[a36_0x204e57(0x136)](_0x401f8a){const _0x2ed1fc=a36_0x204e57,_0x2ebe7c=_0x401f8a[_0x2ed1fc(0x142)][0x0];if(!_0x2ebe7c)return'Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20run\x20<name>\x20[--time\x20<iso8601>]\x20[--num\x20<1-10>]';return undefined;}async[a36_0x204e57(0x129)](_0x3b75b0){const _0x40d60b=a36_0x204e57,{options:_0x45146c,args:_0x10576d,tdx:_0x2109d3}=_0x3b75b0,_0xec9d8c=_0x10576d[0x0],_0x44776e=_0x45146c,_0x2af9b0=_0x44776e['time'],_0x53e416=_0x44776e['num']!==undefined?Number(_0x44776e[_0x40d60b(0x149)]):undefined;if(_0x45146c[_0x40d60b(0x162)]){console[_0x40d60b(0x118)](_0x40d60b(0x16b)+_0xec9d8c);if(_0x2af9b0)console[_0x40d60b(0x118)](_0x40d60b(0x154)+_0x2af9b0);if(_0x53e416)console[_0x40d60b(0x118)](_0x40d60b(0x16e)+_0x53e416);}const _0x57c5a5=await withSpinner(_0x40d60b(0x187),()=>_0x2109d3[_0x40d60b(0x12e)][_0x40d60b(0x123)](_0xec9d8c,{'time':_0x2af9b0,'num':_0x53e416}),{'verbose':_0x45146c[_0x40d60b(0x162)]}),_0x207a44=_0x57c5a5[_0x40d60b(0x13a)][_0x40d60b(0x11d)];console[_0x40d60b(0x118)](_0x40d60b(0x144)+_0x207a44['length']+_0x40d60b(0x104)+(_0x207a44['length']!==0x1?'s':'')+'\x20created');for(const _0x3a3310 of _0x207a44){console['error'](_0x40d60b(0x10e)+_0x3a3310[_0x40d60b(0x16c)]);}return await handleSDKOutput(_0x207a44,_0x45146c),0x0;}}export class ScheduleHistoryCommand extends BaseCommand{['name']=a36_0x204e57(0x101);[a36_0x204e57(0x163)]=a36_0x204e57(0x119);[a36_0x204e57(0x136)](_0x1de85c){const _0x45ea42=a36_0x204e57,_0x1c19b3=_0x1de85c[_0x45ea42(0x142)][0x0];if(!_0x1c19b3)return _0x45ea42(0xf3);return undefined;}async['execute'](_0x365b90){const _0x1c9abf=a36_0x204e57,{options:_0x5aa314,args:_0x1d12b2,tdx:_0x2124d0}=_0x365b90,_0x33597d=_0x1d12b2[0x0],_0x1a2f9f=_0x5aa314,_0x4f5744=_0x1a2f9f[_0x1c9abf(0xfd)]!==undefined?Number(_0x1a2f9f[_0x1c9abf(0xfd)]):undefined,_0x18d6da=_0x1a2f9f['to']!==undefined?Number(_0x1a2f9f['to']):undefined,_0x349e00=await withSpinner(_0x1c9abf(0x10d),()=>_0x2124d0[_0x1c9abf(0x12e)][_0x1c9abf(0x165)](_0x33597d,{'from':_0x4f5744,'to':_0x18d6da}),{'verbose':_0x5aa314['verbose']}),_0x1f1129=_0x349e00[_0x1c9abf(0x13a)];console[_0x1c9abf(0x118)](_0x1c9abf(0x188)+_0x1f1129[_0x1c9abf(0x128)]+_0x1c9abf(0x150)+(_0x1f1129['count']!==0x1?'s':'')+_0x1c9abf(0x106)+_0x1f1129[_0x1c9abf(0xfd)]+'-'+_0x1f1129['to']+')');const _0xd8eb47=_0x1f1129['history'][_0x1c9abf(0x176)](_0x5a9a7a=>({'job_id':_0x5a9a7a[_0x1c9abf(0x16c)],'type':_0x5a9a7a[_0x1c9abf(0x103)],'status':_0x5a9a7a[_0x1c9abf(0x113)],'scheduled_at':_0x5a9a7a[_0x1c9abf(0x110)],'created_at':_0x5a9a7a['created_at'],'start_at':_0x5a9a7a[_0x1c9abf(0x139)],'end_at':_0x5a9a7a[_0x1c9abf(0x100)]}));return await handleSDKOutput(_0xd8eb47,_0x5aa314),0x0;}}
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 +1 @@
1
- const a37_0x398bb6=a37_0x4582;(function(_0x422703,_0x3a8a03){const _0xa0a86a=a37_0x4582,_0x112817=_0x422703();while(!![]){try{const _0x5e38e7=parseInt(_0xa0a86a(0x180))/0x1+parseInt(_0xa0a86a(0x152))/0x2+-parseInt(_0xa0a86a(0x160))/0x3*(-parseInt(_0xa0a86a(0x1a3))/0x4)+-parseInt(_0xa0a86a(0x158))/0x5+-parseInt(_0xa0a86a(0x168))/0x6*(-parseInt(_0xa0a86a(0x1ca))/0x7)+-parseInt(_0xa0a86a(0x1d6))/0x8*(parseInt(_0xa0a86a(0x1d9))/0x9)+-parseInt(_0xa0a86a(0x165))/0xa*(parseInt(_0xa0a86a(0x172))/0xb);if(_0x5e38e7===_0x3a8a03)break;else _0x112817['push'](_0x112817['shift']());}catch(_0x4647e6){_0x112817['push'](_0x112817['shift']());}}}(a37_0x12bc,0xc267b));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,handleQueryOutput,handleSingleObjectOutput}from'../core/command-output.js';function a37_0x4582(_0x133519,_0x440e8c){_0x133519=_0x133519-0x148;const _0x12bcce=a37_0x12bc();let _0x458216=_0x12bcce[_0x133519];return _0x458216;}import{withSpinner,withProgressSpinner,formatElapsed}from'../utils/spinner.js';import{parseSegmentRef}from'../sdk/segment/segment-ref-parser.js';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import{executeSchemaQuery}from'../sdk/segment/fields-display.js';import{isYamlFilePath,resolveYamlFilePath}from'../sdk/segment/segment-path-parser.js';import{getConsoleNextUrl}from'../sdk/client/endpoints.js';function a37_0x12bc(){const _0x2cdb5e=['SQL\x20query:\x0a','\x27\x20with\x20ID:\x20','42DwRjyc','Segment\x20ID:\x20','parentSegment','\x20\x20tdx\x20sg\x20sql\x20\x22Premium\x20Users\x22','segment:describe','Folder\x20ID:\x20','getSegment','fullPath','Error:\x20YAML\x20file\x20paths\x20must\x20be\x20specified\x20with\x20--path\x20option','Fetching\x20SQL\x20from\x20rule...','getFolder','segment','3895232AuVbek','/app/ps/','\x27...','18QYMRrl','verbose','Resolved\x20parent\x20ID:\x20','data','✔\x20Query\x20completed:\x20Processed\x20','information_schema','folderId','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20view\x20<path/to/segment.yml>','\x20\x20Cause:\x20','stats','Fetching\x20folder\x20details...','Error:\x20Specify\x20either\x20segment\x20name\x20or\x20--path,\x20not\x20both','\x20\x20Full\x20path:\x20','\x20\x20Server-side\x20segment:\x20\x20tdx\x20sg\x20sql\x20<name>','Resolved\x20YAML\x20file:\x20','message','SEGMENT_NOT_FOUND','jobId','\x20folder','path','SELECT\x20*\x20FROM\x20(\x0a','Error:\x20Parent\x20segment\x20name\x20is\x20required','execute','Resolved\x20folder\x20ID:\x20','Create\x20segment\x20folder\x20for\x20organization','processedRows','segmentPath','Usage:\x20tdx\x20segment\x20folder\x20list\x20<parent_name>','Show\x20child\x20segment\x20schema\x20(column\x20types)','\x20\x20Local\x20YAML\x20file:\x20\x20\x20\x20\x20\x20tdx\x20sg\x20sql\x20--path\x20<file-path>','2013292deFwTe','Resolving\x20folder\x20\x27','Examples:','Usage:\x20tdx\x20segment\x20folder\x20create\x20<parent_name>\x20<folder_name>\x20[options]','parentFolder','Fetching\x20segment\x20details...','5564765djUDnn','Resolving\x20path\x20\x27','\x20\x20tdx\x20sg\x20view\x20segments/my-audience/premium-users.yml','Error:\x20','\x20\x20tdx\x20sg\x20show\x20segments/my-audience/premium-users.yml','Error:\x20Folder\x20reference\x20is\x20required','Use:\x20tdx\x20ps\x20show','segment:folder:create','834AnfGNb','Execute\x20child\x20segment\x20SQL\x20query\x20and\x20show\x20results','\x20Opening\x20','\x20\x20tdx\x20sg\x20sql\x20--path\x20','format','143050dIjCnF','url','Error:\x20Parent\x20segment\x20name\x20and\x20folder\x20name\x20are\x20required','1570698ySwZvA','Options:','Usage:\x20tdx\x20sg\x20desc\x20<name>','Error:\x20Cannot\x20view\x20parent\x20segment\x20details\x20with\x20this\x20command.','Executing\x20segment\x20query...','segment:show','resolveParentId','Usage:\x20tdx\x20segment\x20folder\x20show\x20<parent_name/folder_name>','name','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20\x20\x20\x20\x20#\x20View\x20child\x20segment\x20details','583ZvlHPy','folder','site','\x20\x20Folder\x20path:\x20','Use:\x20tdx\x20sg\x20view\x20<name>\x20\x20#\x20To\x20show\x20folder\x20details','resolvePathToResource','\x20\x20tdx\x20sg\x20view\x20\x22Marketing\x22\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20folder\x20details','segment:sql','Show\x20folder\x20or\x20child\x20segment\x20details','parent','INVALID_ARGUMENT','/e/','limit','getSegmentSQLFromYaml','339397WKAnjI','Error:\x20Segment\x20name\x20or\x20--path\x20is\x20required','Site:\x20','Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required','Use:\x20tdx\x20ps\x20view\x20-w','query','segmentId','red','Resolving\x20\x27','includes','test','\x20\x20tdx\x20sg\x20sql\x20--path\x20segments/my-audience/premium-users.yml','Folder\x20ID\x20missing\x20from\x20resolved\x20path','getParent','✖\x20Query\x20failed\x20[','Parent\x20ID:\x20','web','toLocaleString','error','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','cause','Error:\x20Cannot\x20open\x20folder\x20in\x20web\x20browser.\x20Use\x20a\x20segment\x20name\x20instead.','segmentName','No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22','Resolved\x20relative\x20path\x20to:\x20','\x20\x20tdx\x20sg\x20show\x20\x22Premium\x20Users\x22','\x20\x20tdx\x20sg\x20desc\x20segments/my-audience/premium-users.yml','Resolved\x20type:\x20','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20-w\x20\x20#\x20Open\x20segment\x20in\x20web\x20browser','Folder\x20name:\x20','Segment\x20ID\x20missing\x20from\x20resolved\x20path','parentId','segment:folder:list','\x20\x20Segment\x20name:\x20','type','10424fqlGoj','length','Fetching\x20SQL\x20for\x20segment...','Resolving\x20parent\x20segment\x20\x27','log','SEGMENT_FOLDER_NOT_FOUND','Resolved:\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20show\x20<path/to/segment.yml>','description','getSQLFromYamlFile','getSegmentSQL','Target\x20path:\x20','Parent\x20name:\x20','Error:\x20Cannot\x20show\x20schema\x20for\x20parent\x20segment\x20with\x20this\x20command.','Parent\x20segment:\x20','✔\x20Found\x20','Fetching\x20parent\x20segment\x20details...','Usage:\x20tdx\x20sg\x20show\x20<name>','segment:view','Error:\x20Cannot\x20execute\x20SQL\x20query\x20on\x20a\x20folder.','trim','segment:desc','\x20[Job\x20ID:\x20','listFolders','Listing\x20folders\x20for\x20parent\x20\x27','jsonl','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','segment:folder:show','Creating\x20folder\x20\x27','Error:\x20Cannot\x20show\x20schema\x20for\x20a\x20folder.','Error:\x20Folder\x20or\x20segment\x20name,\x20or\x20YAML\x20file\x20path\x20is\x20required','code','Error:\x20Folder\x20name\x20is\x20required\x20(use\x20parent_name/folder_name\x20format)','List\x20segment\x20folders\x20under\x20a\x20parent\x20segment','Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20','setJobId','(root)'];a37_0x12bc=function(){return _0x2cdb5e;};return a37_0x12bc();}import{openBrowser}from'../utils/process.js';import a37_0x184753 from'chalk';async function resolveSegmentTarget(_0x1cf306,_0x425844,_0x318c2f){const _0x4015d8=a37_0x4582;if(isYamlFilePath(_0x1cf306))try{const _0x143f41=await resolveYamlFilePath(_0x1cf306);return _0x318c2f&&(console[_0x4015d8(0x192)](_0x4015d8(0x1e7)+_0x1cf306),console['error']('\x20\x20Parent\x20segment:\x20'+_0x143f41[_0x4015d8(0x1cc)]),console[_0x4015d8(0x192)](_0x4015d8(0x1a1)+_0x143f41[_0x4015d8(0x196)]),console[_0x4015d8(0x192)](_0x4015d8(0x175)+(_0x143f41['folderPath']||_0x4015d8(0x1c7))),console[_0x4015d8(0x192)](_0x4015d8(0x1e5)+_0x143f41[_0x4015d8(0x1d1)])),_0x143f41['fullPath'];}catch(_0x50ffdc){throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x4015d8(0x1c5)+_0x50ffdc[_0x4015d8(0x1e8)]);}if(!_0x425844)throw new SDKError(ErrorCode[_0x4015d8(0x17c)],_0x4015d8(0x197));return _0x425844+'/'+_0x1cf306;}export class SegmentDescribeCommand extends BaseCommand{[a37_0x398bb6(0x170)]=a37_0x398bb6(0x1ce);[a37_0x398bb6(0x1ab)]='Show\x20segment\x20or\x20folder\x20details';async[a37_0x398bb6(0x14a)](_0xfec8c4){const _0x5e09c0=a37_0x398bb6,{options:_0x57d8b7,args:_0x547b3b,tdx:_0x399297}=_0xfec8c4,_0x7bb6b3=_0x547b3b[0x0],_0x386be0=!_0x7bb6b3&&!!_0x57d8b7[_0x5e09c0(0x1cc)],_0x16014d=_0x7bb6b3||_0x57d8b7[_0x5e09c0(0x1cc)];if(!_0x16014d)return console[_0x5e09c0(0x192)]('Error:\x20Path\x20or\x20name\x20is\x20required'),console[_0x5e09c0(0x192)]('Usage:\x20tdx\x20segment\x20describe\x20<path>'),console['error'](_0x5e09c0(0x154)),console[_0x5e09c0(0x192)]('\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience\x22'),console['error']('\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience/Marketing/High\x20Value\x22'),console['error']('\x20\x20tdx\x20segment\x20describe\x20\x22High\x20Value\x22\x20\x20\x20\x20#\x20Relative\x20to\x20current\x20context'),console[_0x5e09c0(0x192)](_0x5e09c0(0x193)),0x1;try{const _0x1d38a2=_0x57d8b7[_0x5e09c0(0x14e)];let _0x49efa7=_0x16014d;!_0x386be0&&_0x1d38a2&&!_0x16014d[_0x5e09c0(0x189)]('/')&&(_0x49efa7=_0x1d38a2+'/'+_0x16014d,_0x57d8b7[_0x5e09c0(0x1da)]&&console[_0x5e09c0(0x192)](_0x5e09c0(0x198)+_0x49efa7));const _0xd4ca6b=await withSpinner(_0x5e09c0(0x159)+_0x49efa7+_0x5e09c0(0x1d8),()=>_0x399297['segment'][_0x5e09c0(0x177)](_0x49efa7),{'verbose':_0x57d8b7['verbose']}),_0x3f65cc=_0xd4ca6b['data'];_0x57d8b7['verbose']&&(console['error'](_0x5e09c0(0x19b)+_0x3f65cc[_0x5e09c0(0x1a2)]),console[_0x5e09c0(0x192)](_0x5e09c0(0x18f)+_0x3f65cc['parentId']),_0x3f65cc[_0x5e09c0(0x1df)]&&console[_0x5e09c0(0x192)]('Folder\x20ID:\x20'+_0x3f65cc['folderId']),_0x3f65cc[_0x5e09c0(0x186)]&&console['error'](_0x5e09c0(0x1cb)+_0x3f65cc[_0x5e09c0(0x186)]));if(_0x3f65cc[_0x5e09c0(0x1a2)]==='parent'){const _0x504802=await withSpinner(_0x5e09c0(0x1b3),()=>_0x399297[_0x5e09c0(0x1d5)][_0x5e09c0(0x18d)](_0x3f65cc[_0x5e09c0(0x19f)]),{'verbose':_0x57d8b7[_0x5e09c0(0x1da)]});await handleSingleObjectOutput(_0x504802['data'],_0x57d8b7);}else{if(_0x3f65cc[_0x5e09c0(0x1a2)]===_0x5e09c0(0x173)){if(!_0x3f65cc['folderId'])throw new SDKError(ErrorCode['SEGMENT_FOLDER_NOT_FOUND'],_0x5e09c0(0x18c));const _0x534ce5=await withSpinner(_0x5e09c0(0x1e3),()=>_0x399297['segment'][_0x5e09c0(0x1d4)](_0x3f65cc[_0x5e09c0(0x1df)]),{'verbose':_0x57d8b7[_0x5e09c0(0x1da)]});await handleSingleObjectOutput(_0x534ce5['data'],_0x57d8b7);}else{if(_0x3f65cc[_0x5e09c0(0x1a2)]===_0x5e09c0(0x1d5)){if(!_0x3f65cc[_0x5e09c0(0x186)])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x5e09c0(0x19e));const _0x3a94bb=await withSpinner(_0x5e09c0(0x157),()=>_0x399297[_0x5e09c0(0x1d5)]['getSegment'](_0x3f65cc[_0x5e09c0(0x19f)],_0x3f65cc[_0x5e09c0(0x186)]),{'verbose':_0x57d8b7[_0x5e09c0(0x1da)]});await handleSingleObjectOutput(_0x3a94bb['data'],_0x57d8b7);}}}return 0x0;}catch(_0x32d2ba){if(_0x32d2ba instanceof SDKError)return console[_0x5e09c0(0x192)]('Error:\x20'+_0x32d2ba['message']),_0x32d2ba['cause']&&console['error'](_0x5e09c0(0x1e1)+_0x32d2ba[_0x5e09c0(0x194)]),0x1;throw _0x32d2ba;}}}export class SegmentShowCommand extends BaseCommand{[a37_0x398bb6(0x170)]=a37_0x398bb6(0x16d);[a37_0x398bb6(0x1ab)]=a37_0x398bb6(0x161);async['execute'](_0x460e83){const _0x5a5c72=a37_0x398bb6,{options:_0x2dbd51,args:_0x59ff3e,tdx:_0x4b7d5a}=_0x460e83,_0x1043b0=_0x59ff3e[0x0];if(!_0x1043b0)return console[_0x5a5c72(0x192)]('Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required'),console[_0x5a5c72(0x192)](_0x5a5c72(0x1b4)),console['error'](_0x5a5c72(0x1aa)),console[_0x5a5c72(0x192)](_0x5a5c72(0x154)),console[_0x5a5c72(0x192)](_0x5a5c72(0x199)),console[_0x5a5c72(0x192)](_0x5a5c72(0x15c)),0x1;try{const _0x47ac29=_0x2dbd51[_0x5a5c72(0x1cc)],_0x237ac2=await resolveSegmentTarget(_0x1043b0,_0x47ac29,_0x2dbd51[_0x5a5c72(0x1da)]);_0x2dbd51['verbose']&&console['error'](_0x5a5c72(0x1ae)+_0x237ac2);const _0x3b9a3c=await withSpinner('Resolving\x20\x27'+_0x1043b0+_0x5a5c72(0x1d8),()=>_0x4b7d5a['segment']['resolvePathToResource'](_0x237ac2),{'verbose':_0x2dbd51[_0x5a5c72(0x1da)]}),_0x4cd0e7=_0x3b9a3c[_0x5a5c72(0x1dc)];_0x2dbd51[_0x5a5c72(0x1da)]&&(console[_0x5a5c72(0x192)](_0x5a5c72(0x19b)+_0x4cd0e7[_0x5a5c72(0x1a2)]),console[_0x5a5c72(0x192)](_0x5a5c72(0x18f)+_0x4cd0e7[_0x5a5c72(0x19f)]));if(_0x4cd0e7['type']===_0x5a5c72(0x173))return console[_0x5a5c72(0x192)](_0x5a5c72(0x1b6)),console[_0x5a5c72(0x192)](_0x5a5c72(0x176)),0x1;if(_0x4cd0e7[_0x5a5c72(0x1a2)]===_0x5a5c72(0x17b))return console[_0x5a5c72(0x192)]('Error:\x20Cannot\x20execute\x20query\x20for\x20parent\x20segment\x20with\x20this\x20command.'),console[_0x5a5c72(0x192)](_0x5a5c72(0x15e)),0x1;if(!_0x4cd0e7[_0x5a5c72(0x186)])throw new SDKError(ErrorCode[_0x5a5c72(0x1e9)],_0x5a5c72(0x19e));const _0x4b62dd=await withSpinner('Fetching\x20SQL\x20for\x20segment...',()=>_0x4b7d5a[_0x5a5c72(0x1d5)][_0x5a5c72(0x1ad)](_0x4cd0e7[_0x5a5c72(0x19f)],_0x4cd0e7[_0x5a5c72(0x186)]),{'verbose':_0x2dbd51[_0x5a5c72(0x1da)]});let _0x3e47fe=_0x4b62dd[_0x5a5c72(0x1dc)];const _0x1d0b15=resolveLimit(_0x2dbd51[_0x5a5c72(0x17e)],DEFAULT_DISPLAY_LIMIT),_0x515d00=/\bLIMIT\s+\d+/i[_0x5a5c72(0x18a)](_0x3e47fe);!_0x515d00&&(_0x3e47fe=_0x3e47fe[_0x5a5c72(0x1b7)]()['replace'](/;+$/,''),_0x3e47fe=_0x5a5c72(0x148)+_0x3e47fe+_0x5a5c72(0x1bd)+_0x1d0b15);_0x2dbd51[_0x5a5c72(0x1da)]&&console[_0x5a5c72(0x192)](_0x5a5c72(0x1c8)+_0x3e47fe);const _0x53630b=await withProgressSpinner(_0x5a5c72(0x16c),async _0x38ed12=>{const _0x3d27d9=_0x5a5c72,_0x5ea4f7=await _0x4b7d5a[_0x3d27d9(0x185)][_0x3d27d9(0x14a)](_0x3e47fe,{'catalog':'td','schema':_0x3d27d9(0x1de),'onJobId':_0x23654d=>{const _0x40b967=_0x3d27d9;_0x38ed12[_0x40b967(0x1c6)](_0x23654d);}});return _0x5ea4f7;},{'verbose':_0x2dbd51[_0x5a5c72(0x1da)]}),_0x138411=_0x53630b['data'],_0x3e11d9=_0x138411[_0x5a5c72(0x1ea)]?_0x5a5c72(0x1b9)+_0x138411['jobId']+']':'';return console[_0x5a5c72(0x192)](_0x5a5c72(0x1dd)+_0x138411[_0x5a5c72(0x1e2)][_0x5a5c72(0x14d)][_0x5a5c72(0x191)]()+'\x20rows\x20'+('in\x20'+formatElapsed(_0x138411[_0x5a5c72(0x1e2)]['elapsedTimeMillis'])+_0x3e11d9)),await handleQueryOutput(_0x138411,_0x2dbd51),0x0;}catch(_0x20aed3){if(_0x20aed3 instanceof SDKError)return console[_0x5a5c72(0x192)](_0x5a5c72(0x18e)+_0x20aed3[_0x5a5c72(0x1c2)]+']'),console[_0x5a5c72(0x192)]('\x0a'+_0x20aed3[_0x5a5c72(0x1e8)]),0x1;throw _0x20aed3;}}}export class SegmentFolderListCommand extends BaseCommand{[a37_0x398bb6(0x170)]=a37_0x398bb6(0x1a0);[a37_0x398bb6(0x1ab)]=a37_0x398bb6(0x1c4);async[a37_0x398bb6(0x14a)](_0x54e069){const _0xf7d3c8=a37_0x398bb6,{options:_0x784d9d,args:_0x3d05b9,tdx:_0x4fd86d}=_0x54e069;if(_0x3d05b9['length']===0x0)return console[_0xf7d3c8(0x192)](_0xf7d3c8(0x149)),console[_0xf7d3c8(0x192)](_0xf7d3c8(0x14f)),0x1;const _0x216624=_0x3d05b9[0x0];try{_0x784d9d[_0xf7d3c8(0x1da)]&&(console[_0xf7d3c8(0x192)](_0xf7d3c8(0x182)+_0x784d9d['site']),console['error'](_0xf7d3c8(0x1af)+_0x216624));const _0x72f8fb=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x216624+_0xf7d3c8(0x1d8),()=>_0x4fd86d['segment'][_0xf7d3c8(0x16e)](_0x216624),{'verbose':_0x784d9d[_0xf7d3c8(0x1da)]}),_0x3a9665=_0x72f8fb[_0xf7d3c8(0x1dc)];_0x784d9d[_0xf7d3c8(0x1da)]&&console['error']('Resolved\x20parent\x20ID:\x20'+_0x3a9665);const _0x10022a=await withSpinner(_0xf7d3c8(0x1bb)+_0x216624+'\x27...',()=>_0x4fd86d[_0xf7d3c8(0x1d5)][_0xf7d3c8(0x1ba)](_0x3a9665),{'verbose':_0x784d9d[_0xf7d3c8(0x1da)]}),_0x30923e=_0x10022a['data'];return console['error'](_0xf7d3c8(0x1b2)+_0x30923e['length']+_0xf7d3c8(0x1eb)+(_0x30923e[_0xf7d3c8(0x1a4)]!==0x1?'s':'')),await handleSDKOutput(_0x30923e,_0x784d9d),0x0;}catch(_0x419bad){if(_0x419bad instanceof SDKError)return console[_0xf7d3c8(0x192)](_0xf7d3c8(0x15b)+_0x419bad[_0xf7d3c8(0x1e8)]),_0x419bad[_0xf7d3c8(0x194)]&&console[_0xf7d3c8(0x192)]('\x20\x20Cause:\x20'+_0x419bad[_0xf7d3c8(0x194)]),0x1;throw _0x419bad;}}}export class SegmentFolderShowCommand extends BaseCommand{['name']=a37_0x398bb6(0x1be);[a37_0x398bb6(0x1ab)]='Show\x20segment\x20folder\x20details';async[a37_0x398bb6(0x14a)](_0x166c7a){const _0x4d97fd=a37_0x398bb6,{options:_0x51a8d9,args:_0x69efad,tdx:_0x338b26}=_0x166c7a;if(_0x69efad[_0x4d97fd(0x1a4)]===0x0)return console[_0x4d97fd(0x192)](_0x4d97fd(0x15d)),console[_0x4d97fd(0x192)](_0x4d97fd(0x16f)),0x1;try{const {parentId:_0x14ab8d,childId:_0x245ce3}=parseSegmentRef(_0x69efad[0x0]);_0x51a8d9[_0x4d97fd(0x1da)]&&(console['error']('Site:\x20'+_0x51a8d9[_0x4d97fd(0x174)]),console['error']('Parent\x20name:\x20'+_0x14ab8d),_0x245ce3&&console['error'](_0x4d97fd(0x19d)+_0x245ce3));if(!_0x245ce3)return console[_0x4d97fd(0x192)](_0x4d97fd(0x1c3)),0x1;const _0x1584cd=await withSpinner(_0x4d97fd(0x1a6)+_0x14ab8d+_0x4d97fd(0x1d8),()=>_0x338b26[_0x4d97fd(0x1d5)][_0x4d97fd(0x16e)](_0x14ab8d),{'verbose':_0x51a8d9[_0x4d97fd(0x1da)]}),_0x9610b=_0x1584cd['data'];_0x51a8d9['verbose']&&console['error'](_0x4d97fd(0x1db)+_0x9610b);const _0x4c9681=await withSpinner(_0x4d97fd(0x153)+_0x245ce3+_0x4d97fd(0x1d8),()=>_0x338b26[_0x4d97fd(0x1d5)]['resolveFolderId'](_0x9610b,_0x245ce3),{'verbose':_0x51a8d9[_0x4d97fd(0x1da)]}),_0x1ca970=_0x4c9681[_0x4d97fd(0x1dc)];_0x51a8d9[_0x4d97fd(0x1da)]&&console['error'](_0x4d97fd(0x14b)+_0x1ca970);const _0x43bd18=await withSpinner('Fetching\x20folder\x20\x27'+_0x245ce3+_0x4d97fd(0x1d8),()=>_0x338b26[_0x4d97fd(0x1d5)][_0x4d97fd(0x1d4)](_0x1ca970),{'verbose':_0x51a8d9[_0x4d97fd(0x1da)]});return await handleSDKOutput([_0x43bd18['data']],_0x51a8d9),0x0;}catch(_0x10956b){if(_0x10956b instanceof SDKError)return console[_0x4d97fd(0x192)](_0x4d97fd(0x15b)+_0x10956b[_0x4d97fd(0x1e8)]),_0x10956b[_0x4d97fd(0x194)]&&console[_0x4d97fd(0x192)]('\x20\x20Cause:\x20'+_0x10956b[_0x4d97fd(0x194)]),0x1;throw _0x10956b;}}}export class SegmentSQLCommand extends BaseCommand{[a37_0x398bb6(0x170)]=a37_0x398bb6(0x179);['description']='Get\x20SQL\x20query\x20for\x20child\x20segment';async[a37_0x398bb6(0x14a)](_0x1f389c){const _0x27f79f=a37_0x398bb6,{options:_0x1fe281,args:_0x2ac653}=_0x1f389c,_0x179090=_0x1fe281,_0x3c6c33=_0x179090[_0x27f79f(0x1ec)],_0x359bf6=_0x2ac653[0x0];if(!_0x359bf6&&!_0x3c6c33)return console[_0x27f79f(0x192)](a37_0x184753[_0x27f79f(0x187)](_0x27f79f(0x181))),console[_0x27f79f(0x192)]('Usage:'),console[_0x27f79f(0x192)](_0x27f79f(0x1e6)),console[_0x27f79f(0x192)](_0x27f79f(0x151)),console[_0x27f79f(0x192)](_0x27f79f(0x154)),console[_0x27f79f(0x192)](_0x27f79f(0x1cd)),console[_0x27f79f(0x192)](_0x27f79f(0x18b)),0x1;if(_0x359bf6&&_0x3c6c33)return console[_0x27f79f(0x192)](a37_0x184753[_0x27f79f(0x187)](_0x27f79f(0x1e4))),0x1;try{let _0x569be4;if(_0x3c6c33)_0x569be4=await this[_0x27f79f(0x1ac)](_0x3c6c33,_0x1f389c);else{if(isYamlFilePath(_0x359bf6))return console[_0x27f79f(0x192)](a37_0x184753['red'](_0x27f79f(0x1d2))),console[_0x27f79f(0x192)](_0x27f79f(0x163)+_0x359bf6),0x1;else _0x569be4=await this['getSQLFromServerSegment'](_0x359bf6,_0x1f389c);}return _0x1fe281[_0x27f79f(0x164)]==='json'||_0x1fe281['format']===_0x27f79f(0x1bc)?await handleSDKOutput([{'sql':_0x569be4}],_0x1fe281):console[_0x27f79f(0x1a7)](_0x569be4),0x0;}catch(_0x5ec35d){if(_0x5ec35d instanceof SDKError)return console[_0x27f79f(0x192)]('Error:\x20'+_0x5ec35d['message']),_0x5ec35d[_0x27f79f(0x194)]&&console[_0x27f79f(0x192)](_0x27f79f(0x1e1)+_0x5ec35d[_0x27f79f(0x194)]),0x1;throw _0x5ec35d;}}async[a37_0x398bb6(0x1ac)](_0x1dd5fb,_0x51ff8c){const _0x5e577a=a37_0x398bb6,{options:_0x51dee4,tdx:_0x4390b2}=_0x51ff8c;let _0x36ce85;try{_0x36ce85=await resolveYamlFilePath(_0x1dd5fb);}catch(_0x557a35){throw new SDKError(ErrorCode[_0x5e577a(0x17c)],_0x5e577a(0x1c5)+_0x557a35[_0x5e577a(0x1e8)]);}_0x51dee4[_0x5e577a(0x1da)]&&console[_0x5e577a(0x192)](_0x5e577a(0x1a9)+_0x36ce85[_0x5e577a(0x1cc)]+'/'+_0x36ce85[_0x5e577a(0x196)]);const _0x4b30f2=await withSpinner(_0x5e577a(0x1d3),()=>_0x4390b2[_0x5e577a(0x1d5)][_0x5e577a(0x17f)](_0x36ce85['content'],_0x36ce85[_0x5e577a(0x1cc)],_0x36ce85['segmentName']),{'verbose':_0x51dee4[_0x5e577a(0x1da)]});return _0x4b30f2[_0x5e577a(0x1dc)];}async['getSQLFromServerSegment'](_0x139725,_0x5b25e8){const _0x5c43c2=a37_0x398bb6,{options:_0x442719,tdx:_0x10d81f}=_0x5b25e8,_0x718442=_0x442719[_0x5c43c2(0x1cc)],_0xff87dc=await resolveSegmentTarget(_0x139725,_0x718442,_0x442719[_0x5c43c2(0x1da)]);_0x442719[_0x5c43c2(0x1da)]&&console[_0x5c43c2(0x192)](_0x5c43c2(0x1ae)+_0xff87dc);const _0x6dc06f=await withSpinner(_0x5c43c2(0x188)+_0x139725+_0x5c43c2(0x1d8),()=>_0x10d81f[_0x5c43c2(0x1d5)]['resolvePathToResource'](_0xff87dc),{'verbose':_0x442719['verbose']}),_0x355881=_0x6dc06f[_0x5c43c2(0x1dc)];_0x442719[_0x5c43c2(0x1da)]&&(console[_0x5c43c2(0x192)]('Resolved\x20type:\x20'+_0x355881[_0x5c43c2(0x1a2)]),console[_0x5c43c2(0x192)]('Parent\x20ID:\x20'+_0x355881[_0x5c43c2(0x19f)]));if(_0x355881[_0x5c43c2(0x1a2)]===_0x5c43c2(0x173))throw new SDKError(ErrorCode['INVALID_ARGUMENT'],'Cannot\x20get\x20SQL\x20query\x20for\x20a\x20folder.\x20Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.');if(_0x355881[_0x5c43c2(0x1a2)]==='parent')throw new SDKError(ErrorCode['INVALID_ARGUMENT'],'Cannot\x20get\x20SQL\x20for\x20parent\x20segment\x20with\x20this\x20command.\x20Use:\x20tdx\x20ps\x20sql');if(!_0x355881['segmentId'])throw new SDKError(ErrorCode[_0x5c43c2(0x1e9)],_0x5c43c2(0x19e));const _0x3285a7=await withSpinner(_0x5c43c2(0x1a5),()=>_0x10d81f[_0x5c43c2(0x1d5)]['getSegmentSQL'](_0x355881['parentId'],_0x355881[_0x5c43c2(0x186)]),{'verbose':_0x442719[_0x5c43c2(0x1da)]});return _0x3285a7[_0x5c43c2(0x1dc)];}}export class SegmentFolderCreateCommand extends BaseCommand{[a37_0x398bb6(0x170)]=a37_0x398bb6(0x15f);[a37_0x398bb6(0x1ab)]=a37_0x398bb6(0x14c);async[a37_0x398bb6(0x14a)](_0x43c664){const _0x404996=a37_0x398bb6,{options:_0xc0239f,args:_0x24310c,tdx:_0x57e28d}=_0x43c664,_0x3cd45c=_0xc0239f;if(_0x24310c[_0x404996(0x1a4)]<0x2)return console[_0x404996(0x192)](_0x404996(0x167)),console[_0x404996(0x192)](_0x404996(0x155)),0x1;const _0x269a98=_0x24310c[0x0],_0x32ffd4=_0x24310c[0x1];_0x3cd45c[_0x404996(0x1da)]&&(console[_0x404996(0x192)](_0x404996(0x182)+_0x3cd45c[_0x404996(0x174)]),console[_0x404996(0x192)](_0x404996(0x1b1)+_0x269a98),console[_0x404996(0x192)]('Folder\x20name:\x20'+_0x32ffd4));let _0x417d54;if(_0x3cd45c['parentFolder']){const _0xbc22ff=_0x3cd45c[_0x404996(0x156)],_0x478e23=await withSpinner(_0x404996(0x1a6)+_0x269a98+_0x404996(0x1d8),()=>_0x57e28d[_0x404996(0x1d5)]['resolveParentId'](_0x269a98),{'verbose':_0x3cd45c[_0x404996(0x1da)]}),_0x16309b=_0x478e23[_0x404996(0x1dc)],_0x5ea43d=await withSpinner('Resolving\x20parent\x20folder\x20\x27'+_0xbc22ff+'\x27...',()=>_0x57e28d[_0x404996(0x1d5)]['resolveFolderId'](_0x16309b,_0xbc22ff),{'verbose':_0x3cd45c[_0x404996(0x1da)]});_0x417d54=_0x5ea43d[_0x404996(0x1dc)],_0x3cd45c[_0x404996(0x1da)]&&console[_0x404996(0x192)]('Resolved\x20parent\x20folder\x20ID:\x20'+_0x417d54);}const _0xbff17f={'name':_0x32ffd4,'description':_0x3cd45c[_0x404996(0x1ab)],'parentFolderId':_0x417d54},_0x47c2a6=await withSpinner(_0x404996(0x1bf)+_0x32ffd4+'\x27...',()=>_0x57e28d[_0x404996(0x1d5)]['createFolder'](_0x269a98,_0xbff17f),{'verbose':_0x3cd45c['verbose']}),_0x29886c=_0x47c2a6[_0x404996(0x1dc)];return console['error']('✔\x20Created\x20folder\x20\x27'+_0x29886c[_0x404996(0x170)]+_0x404996(0x1c9)+_0x29886c['id']),await handleSDKOutput([_0x29886c],_0x3cd45c),0x0;}}export class SegmentViewCommand extends BaseCommand{[a37_0x398bb6(0x170)]=a37_0x398bb6(0x1b5);[a37_0x398bb6(0x1ab)]=a37_0x398bb6(0x17a);async[a37_0x398bb6(0x14a)](_0x3a699b){const _0x5369fb=a37_0x398bb6,{options:_0x3c9049,args:_0x4a5beb,tdx:_0x227793}=_0x3a699b,_0x473307=_0x4a5beb[0x0];if(!_0x473307)return console[_0x5369fb(0x192)](_0x5369fb(0x1c1)),console[_0x5369fb(0x192)]('Usage:\x20tdx\x20sg\x20view\x20<name>\x20[-w]'),console['error'](_0x5369fb(0x1e0)),console[_0x5369fb(0x192)](_0x5369fb(0x169)),console[_0x5369fb(0x192)]('\x20\x20-w,\x20--web\x20\x20Open\x20segment\x20in\x20web\x20browser'),console[_0x5369fb(0x192)](_0x5369fb(0x154)),console[_0x5369fb(0x192)](_0x5369fb(0x178)),console['error'](_0x5369fb(0x171)),console[_0x5369fb(0x192)](_0x5369fb(0x19c)),console[_0x5369fb(0x192)](_0x5369fb(0x15a)),0x1;try{const _0x26b2db=_0x3c9049['parentSegment'],_0x869f3d=await resolveSegmentTarget(_0x473307,_0x26b2db,_0x3c9049['verbose']);_0x3c9049['verbose']&&console[_0x5369fb(0x192)](_0x5369fb(0x1ae)+_0x869f3d);const _0x13b9c7=await withSpinner(_0x5369fb(0x188)+_0x473307+_0x5369fb(0x1d8),()=>_0x227793[_0x5369fb(0x1d5)][_0x5369fb(0x177)](_0x869f3d),{'verbose':_0x3c9049[_0x5369fb(0x1da)]}),_0x28bf70=_0x13b9c7['data'];_0x3c9049[_0x5369fb(0x1da)]&&(console[_0x5369fb(0x192)]('Resolved\x20type:\x20'+_0x28bf70['type']),console[_0x5369fb(0x192)](_0x5369fb(0x18f)+_0x28bf70[_0x5369fb(0x19f)]),_0x28bf70[_0x5369fb(0x1df)]&&console[_0x5369fb(0x192)](_0x5369fb(0x1cf)+_0x28bf70[_0x5369fb(0x1df)]),_0x28bf70[_0x5369fb(0x186)]&&console[_0x5369fb(0x192)]('Segment\x20ID:\x20'+_0x28bf70[_0x5369fb(0x186)]));if(_0x3c9049[_0x5369fb(0x190)]){if(_0x28bf70[_0x5369fb(0x1a2)]===_0x5369fb(0x173))return console[_0x5369fb(0x192)](_0x5369fb(0x195)),0x1;if(_0x28bf70[_0x5369fb(0x1a2)]===_0x5369fb(0x17b))return console['error']('Error:\x20Cannot\x20open\x20parent\x20segment\x20with\x20this\x20command.'),console[_0x5369fb(0x192)](_0x5369fb(0x184)),0x1;if(!_0x28bf70[_0x5369fb(0x186)])throw new SDKError(ErrorCode[_0x5369fb(0x1e9)],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x1a27a7=getConsoleNextUrl(_0x3c9049['site'],_0x5369fb(0x1d7)+_0x28bf70['parentId']+_0x5369fb(0x17d)+_0x28bf70[_0x5369fb(0x186)]);return console[_0x5369fb(0x192)](a37_0x184753['green']('✔')+_0x5369fb(0x162)+a37_0x184753['cyan'](_0x1a27a7)),openBrowser(_0x1a27a7),0x0;}if(_0x28bf70['type']===_0x5369fb(0x173)){if(!_0x28bf70[_0x5369fb(0x1df)])throw new SDKError(ErrorCode[_0x5369fb(0x1a8)],_0x5369fb(0x18c));const _0x41b7d6=await withSpinner(_0x5369fb(0x1e3),()=>_0x227793['segment'][_0x5369fb(0x1d4)](_0x28bf70['folderId']),{'verbose':_0x3c9049['verbose']});await handleSingleObjectOutput(_0x41b7d6['data'],_0x3c9049);}else{if(_0x28bf70[_0x5369fb(0x1a2)]===_0x5369fb(0x1d5)){if(!_0x28bf70[_0x5369fb(0x186)])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x5369fb(0x19e));const _0x220c0a=await withSpinner('Fetching\x20segment\x20details...',()=>_0x227793[_0x5369fb(0x1d5)][_0x5369fb(0x1d0)](_0x28bf70[_0x5369fb(0x19f)],_0x28bf70[_0x5369fb(0x186)]),{'verbose':_0x3c9049[_0x5369fb(0x1da)]}),_0x5df5ba=getConsoleNextUrl(_0x3c9049[_0x5369fb(0x174)],'/app/ps/'+_0x28bf70['parentId']+'/e/'+_0x28bf70['segmentId']),_0x4e248a=_0x220c0a[_0x5369fb(0x1dc)];_0x4e248a[_0x5369fb(0x166)]=_0x5df5ba,await handleSingleObjectOutput(_0x4e248a,_0x3c9049);}else return console[_0x5369fb(0x192)](_0x5369fb(0x16b)),console[_0x5369fb(0x192)]('Use:\x20tdx\x20ps\x20view'),0x1;}return 0x0;}catch(_0x43bebb){if(_0x43bebb instanceof SDKError)return console[_0x5369fb(0x192)]('Error:\x20'+_0x43bebb[_0x5369fb(0x1e8)]),_0x43bebb[_0x5369fb(0x194)]&&console[_0x5369fb(0x192)](_0x5369fb(0x1e1)+_0x43bebb[_0x5369fb(0x194)]),0x1;throw _0x43bebb;}}}export const SegmentInfoCommand=SegmentViewCommand;export class SegmentDescCommand extends BaseCommand{[a37_0x398bb6(0x170)]=a37_0x398bb6(0x1b8);[a37_0x398bb6(0x1ab)]=a37_0x398bb6(0x150);async[a37_0x398bb6(0x14a)](_0x1f92f0){const _0x584b92=a37_0x398bb6,{options:_0x311855,args:_0x21fc1b,tdx:_0x3486e7}=_0x1f92f0,_0x4b8c8b=_0x21fc1b[0x0];if(!_0x4b8c8b)return console[_0x584b92(0x192)](_0x584b92(0x183)),console[_0x584b92(0x192)](_0x584b92(0x16a)),console[_0x584b92(0x192)]('\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20desc\x20<path/to/segment.yml>'),console[_0x584b92(0x192)](_0x584b92(0x154)),console['error']('\x20\x20tdx\x20sg\x20desc\x20\x22Premium\x20Users\x22'),console[_0x584b92(0x192)](_0x584b92(0x19a)),0x1;try{const _0x1b2a73=_0x311855['parentSegment'],_0x38b0c3=await resolveSegmentTarget(_0x4b8c8b,_0x1b2a73,_0x311855[_0x584b92(0x1da)]);_0x311855[_0x584b92(0x1da)]&&console[_0x584b92(0x192)]('Target\x20path:\x20'+_0x38b0c3);const _0x422f58=await withSpinner(_0x584b92(0x188)+_0x4b8c8b+'\x27...',()=>_0x3486e7[_0x584b92(0x1d5)][_0x584b92(0x177)](_0x38b0c3),{'verbose':_0x311855[_0x584b92(0x1da)]}),_0x710261=_0x422f58['data'];_0x311855['verbose']&&(console['error'](_0x584b92(0x19b)+_0x710261['type']),console[_0x584b92(0x192)](_0x584b92(0x18f)+_0x710261[_0x584b92(0x19f)]));if(_0x710261['type']===_0x584b92(0x173))return console[_0x584b92(0x192)](_0x584b92(0x1c0)),console[_0x584b92(0x192)]('Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.'),0x1;if(_0x710261[_0x584b92(0x1a2)]===_0x584b92(0x17b))return console['error'](_0x584b92(0x1b0)),console[_0x584b92(0x192)]('Use:\x20tdx\x20ps\x20desc'),0x1;if(!_0x710261[_0x584b92(0x186)])throw new SDKError(ErrorCode[_0x584b92(0x1e9)],_0x584b92(0x19e));const _0x44ab84=await withSpinner('Fetching\x20SQL\x20for\x20segment...',()=>_0x3486e7[_0x584b92(0x1d5)][_0x584b92(0x1ad)](_0x710261[_0x584b92(0x19f)],_0x710261[_0x584b92(0x186)]),{'verbose':_0x311855[_0x584b92(0x1da)]}),_0x191908=_0x44ab84[_0x584b92(0x1dc)],_0x53efb4=await executeSchemaQuery(_0x191908,_0x3486e7,_0x311855);return await handleQueryOutput(_0x53efb4,_0x311855),0x0;}catch(_0x140b54){if(_0x140b54 instanceof SDKError)return console[_0x584b92(0x192)](_0x584b92(0x15b)+_0x140b54[_0x584b92(0x1e8)]),_0x140b54[_0x584b92(0x194)]&&console[_0x584b92(0x192)](_0x584b92(0x1e1)+_0x140b54[_0x584b92(0x194)]),0x1;throw _0x140b54;}}}
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 +1 @@
1
- function a38_0x6ead(_0x6f6bf1,_0x389a19){_0x6f6bf1=_0x6f6bf1-0x129;const _0x17fd1f=a38_0x17fd();let _0x6ead6e=_0x17fd1f[_0x6f6bf1];return _0x6ead6e;}const a38_0x2a35c7=a38_0x6ead;(function(_0xe7c4ae,_0x5a29f4){const _0x2d47b7=a38_0x6ead,_0x71cff9=_0xe7c4ae();while(!![]){try{const _0x1a946c=-parseInt(_0x2d47b7(0x14d))/0x1*(parseInt(_0x2d47b7(0x13f))/0x2)+-parseInt(_0x2d47b7(0x132))/0x3*(-parseInt(_0x2d47b7(0x12e))/0x4)+parseInt(_0x2d47b7(0x148))/0x5*(-parseInt(_0x2d47b7(0x140))/0x6)+parseInt(_0x2d47b7(0x12d))/0x7*(parseInt(_0x2d47b7(0x131))/0x8)+-parseInt(_0x2d47b7(0x13d))/0x9*(parseInt(_0x2d47b7(0x15a))/0xa)+parseInt(_0x2d47b7(0x14f))/0xb*(parseInt(_0x2d47b7(0x151))/0xc)+parseInt(_0x2d47b7(0x14b))/0xd;if(_0x1a946c===_0x5a29f4)break;else _0x71cff9['push'](_0x71cff9['shift']());}catch(_0x6f47d8){_0x71cff9['push'](_0x71cff9['shift']());}}}(a38_0x17fd,0xceac7));import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';function a38_0x17fd(){const _0x3eaea2=['folderId','Parent:\x20','resolveFolderId','5evWkhy','Target\x20path:\x20','Resolving\x20folder\x20\x27','22819706pLNzGC','Examples:','69sUinFd','length','6219741roJiwG','rule','12HsGtwb','segments','Site:\x20','type','resolvePathToResource','Resolved\x20relative\x20path\x20to:\x20','folder','resolveParentId','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/Marketing/Premium\x22\x20--rule\x20\x27...\x27','11179700GmjfsT','segmentPath','description','yellow','verbose','includes','\x27...','name','⚠\x20Deprecation\x20warning:\x20`segment\x20create`\x20is\x20deprecated.','\x20\x20\x20Path:\x20','35cKAmKz','1484mTmmpd','Usage:\x20tdx\x20segment\x20create\x20<path>\x20[options]','Resolving\x20folder\x20path\x20\x27','590664HuXgci','1713ZyodxO','Error:\x20Segment\x20path\x20or\x20name\x20is\x20required','parent','Parent\x20path:\x20','Resolved\x20folder\x20ID:\x20','invisible','\x20\x20Use\x20`tdx\x20sg\x20push`\x20with\x20YAML\x20files\x20instead.\x0a','site','segment','Error:\x20Cannot\x20create\x20segment\x20in\x20a\x20segment.\x20Parent\x20path\x20must\x20be\x20a\x20folder\x20or\x20parent.','✔\x20Created\x20segment\x20\x27','9lxfeSQ','data','11126fVEAzn','3320682WKEdSf','kind','error','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/High\x20Value\x22\x20--rule\x20\x27...\x27','Create\x20child\x20segment\x20with\x20filtering\x20rules'];a38_0x17fd=function(){return _0x3eaea2;};return a38_0x17fd();}import{loadJSONFromOptions}from'../utils/json-loader.js';import{parsePath,getParentPath,getBaseName}from'../sdk/segment/segment-path-parser.js';import a38_0x19f464 from'chalk';export class SegmentCreateCommand extends BaseCommand{[a38_0x2a35c7(0x12a)]='segment:create';[a38_0x2a35c7(0x15c)]=a38_0x2a35c7(0x144);async['execute'](_0x105499){const _0x58b63b=a38_0x2a35c7;console[_0x58b63b(0x142)](a38_0x19f464[_0x58b63b(0x15d)](_0x58b63b(0x12b))),console['error'](a38_0x19f464['yellow'](_0x58b63b(0x138)));const {options:_0x2d0b8e,args:_0x5522f8,tdx:_0x196c9b}=_0x105499,_0x53bd8=_0x2d0b8e;if(_0x5522f8[_0x58b63b(0x14e)]===0x0)return console[_0x58b63b(0x142)](_0x58b63b(0x133)),console[_0x58b63b(0x142)](_0x58b63b(0x12f)),console[_0x58b63b(0x142)](_0x58b63b(0x14c)),console[_0x58b63b(0x142)](_0x58b63b(0x143)),console[_0x58b63b(0x142)](_0x58b63b(0x159)),console['error']('\x20\x20tdx\x20segment\x20create\x20\x22Premium\x22\x20--rule\x20\x27...\x27\x20\x20#\x20Relative\x20to\x20context'),0x1;const _0x2f146e=_0x5522f8[0x0],_0x261445=_0x2d0b8e[_0x58b63b(0x15b)];let _0x296e97=_0x2f146e;_0x261445&&!_0x2f146e[_0x58b63b(0x15f)]('/')&&(_0x296e97=_0x261445+'/'+_0x2f146e,_0x53bd8[_0x58b63b(0x15e)]&&console[_0x58b63b(0x142)](_0x58b63b(0x156)+_0x296e97));const _0x3488ef=parsePath(_0x296e97);if(_0x3488ef['segments'][_0x58b63b(0x14e)]<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 _0x428382=_0x3488ef[_0x58b63b(0x152)][0x0],_0x4bb821=getBaseName(_0x296e97),_0x54996e=getParentPath(_0x296e97);_0x53bd8[_0x58b63b(0x15e)]&&(console['error'](_0x58b63b(0x153)+_0x53bd8[_0x58b63b(0x139)]),console[_0x58b63b(0x142)](_0x58b63b(0x149)+_0x296e97),console['error'](_0x58b63b(0x146)+_0x428382),console[_0x58b63b(0x142)]('Segment\x20name:\x20'+_0x4bb821),console[_0x58b63b(0x142)](_0x58b63b(0x135)+_0x54996e));const _0x53da6c=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x428382+_0x58b63b(0x129),()=>_0x196c9b['segment'][_0x58b63b(0x158)](_0x428382),{'verbose':_0x53bd8['verbose']}),_0x333e99=_0x53da6c[_0x58b63b(0x13e)];let _0x462da5;if(_0x3488ef[_0x58b63b(0x152)][_0x58b63b(0x14e)]>0x2){const _0x207db4=await withSpinner(_0x58b63b(0x130)+_0x54996e+_0x58b63b(0x129),()=>_0x196c9b['segment'][_0x58b63b(0x155)](_0x54996e),{'verbose':_0x53bd8[_0x58b63b(0x15e)]}),_0x5e3d34=_0x207db4['data'];if(_0x5e3d34[_0x58b63b(0x154)]!==_0x58b63b(0x157)&&_0x5e3d34[_0x58b63b(0x154)]!==_0x58b63b(0x134))return console[_0x58b63b(0x142)](_0x58b63b(0x13b)),0x1;_0x462da5=_0x5e3d34[_0x58b63b(0x145)];}else{if(_0x53bd8[_0x58b63b(0x157)]){const _0x58ff8c=await withSpinner(_0x58b63b(0x14a)+_0x53bd8['folder']+'\x27...',()=>_0x196c9b['segment'][_0x58b63b(0x147)](_0x333e99,_0x53bd8[_0x58b63b(0x157)]),{'verbose':_0x53bd8[_0x58b63b(0x15e)]});_0x462da5=_0x58ff8c['data'];}}_0x53bd8[_0x58b63b(0x15e)]&&_0x462da5&&console[_0x58b63b(0x142)](_0x58b63b(0x136)+_0x462da5);const _0x1b1392=await loadJSONFromOptions(_0x53bd8[_0x58b63b(0x150)],_0x53bd8['ruleFile']),_0x126c3f={'name':_0x4bb821,'description':_0x53bd8['description'],'rule':_0x1b1392,'kind':_0x53bd8[_0x58b63b(0x141)]!==undefined?parseInt(_0x53bd8['kind'],0xa):undefined,'isVisible':_0x53bd8[_0x58b63b(0x137)]?![]:undefined,'segmentFolderId':_0x462da5,'countPopulation':_0x53bd8['noCountPopulation']?![]:undefined},_0x321753=await withSpinner('Creating\x20segment\x20\x27'+_0x4bb821+_0x58b63b(0x129),()=>_0x196c9b[_0x58b63b(0x13a)]['createSegment'](_0x333e99,_0x126c3f),{'verbose':_0x53bd8[_0x58b63b(0x15e)]}),_0x241889=_0x321753['data'];return console['error'](_0x58b63b(0x13c)+_0x241889[_0x58b63b(0x12a)]+'\x27\x20with\x20ID:\x20'+_0x241889['id']),_0x296e97!==_0x2f146e&&console[_0x58b63b(0x142)](_0x58b63b(0x12c)+_0x296e97),await handleSDKOutput([_0x241889],_0x53bd8),0x0;}}
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 +1 @@
1
- const a39_0xbfa57=a39_0x4e5e;(function(_0x112024,_0x7c11c){const _0x9482b9=a39_0x4e5e,_0x569f8e=_0x112024();while(!![]){try{const _0x2f0d47=-parseInt(_0x9482b9(0xcf))/0x1+parseInt(_0x9482b9(0xde))/0x2+parseInt(_0x9482b9(0xce))/0x3*(parseInt(_0x9482b9(0xd3))/0x4)+parseInt(_0x9482b9(0xd9))/0x5*(parseInt(_0x9482b9(0xcb))/0x6)+parseInt(_0x9482b9(0xc7))/0x7+-parseInt(_0x9482b9(0xdb))/0x8+-parseInt(_0x9482b9(0xd0))/0x9;if(_0x2f0d47===_0x7c11c)break;else _0x569f8e['push'](_0x569f8e['shift']());}catch(_0x14ca80){_0x569f8e['push'](_0x569f8e['shift']());}}}(a39_0x4f81,0xb32eb));import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../core/command-output.js';function a39_0x4e5e(_0x4f59c3,_0x1c39f1){_0x4f59c3=_0x4f59c3-0xc4;const _0x4f8140=a39_0x4f81();let _0x4e5ec7=_0x4f8140[_0x4f59c3];return _0x4e5ec7;}function a39_0x4f81(){const _0x4318b5=['length','5722235VdSOru','Site:\x20','2810304FareNt','List\x20available\x20fields\x20for\x20segmentation','verbose','1138268hFOvuc','name','description','Error:\x20Parent\x20segment\x20name\x20is\x20required','\x27...','3469214CgnkAZ','\x20field','json','execute','6ryDtpY','✔\x20Found\x20','parentSegment','6YoczGu','1304911nxWsoA','644571kWvYQk','segment:fields','site','505132fBGkIw','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','listFields','jsonl','error'];a39_0x4f81=function(){return _0x4318b5;};return a39_0x4f81();}import{withSpinner}from'../utils/spinner.js';import{displayFieldsHumanReadable}from'../sdk/segment/fields-display.js';export class SegmentFieldsCommand extends BaseCommand{[a39_0xbfa57(0xdf)]=a39_0xbfa57(0xd1);[a39_0xbfa57(0xc4)]=a39_0xbfa57(0xdc);async[a39_0xbfa57(0xca)](_0x267b48){const _0x209515=a39_0xbfa57,{options:_0x37ae8c,args:_0x2c49e2,tdx:_0xe47094}=_0x267b48,_0x5a1cb5=_0x2c49e2[0x0]||_0x37ae8c[_0x209515(0xcd)];if(!_0x5a1cb5)return console['error'](_0x209515(0xc5)),console[_0x209515(0xd7)]('Usage:\x20tdx\x20segment\x20fields\x20<parent_name>'),console[_0x209515(0xd7)](_0x209515(0xd4)),0x1;_0x37ae8c[_0x209515(0xdd)]&&(console[_0x209515(0xd7)](_0x209515(0xda)+_0x37ae8c[_0x209515(0xd2)]),console['error']('Parent\x20segment:\x20'+_0x5a1cb5));const _0x2b9d8f=await withSpinner('Listing\x20fields\x20for\x20\x27'+_0x5a1cb5+_0x209515(0xc6),()=>_0xe47094['segment'][_0x209515(0xd5)](_0x5a1cb5),{'verbose':_0x37ae8c['verbose']}),_0x165499=_0x2b9d8f['data'];console[_0x209515(0xd7)](_0x209515(0xcc)+_0x165499[_0x209515(0xd8)]+_0x209515(0xc8)+(_0x165499[_0x209515(0xd8)]!==0x1?'s':''));if(_0x37ae8c[_0x209515(0xc9)]||_0x37ae8c[_0x209515(0xd6)])return await handleSDKOutput(_0x165499,_0x37ae8c),0x0;return displayFieldsHumanReadable(_0x165499,_0x5a1cb5),0x0;}}
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;}}