@treasuredata/tdx 2026.6.3 → 2026.6.4

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 (234) hide show
  1. package/dist/bin.js +1 -1
  2. package/dist/build-info.json +3 -3
  3. package/dist/cli-categories.js +1 -1
  4. package/dist/cli.d.ts.map +1 -1
  5. package/dist/cli.js +1 -1
  6. package/dist/cli.js.map +1 -1
  7. package/dist/commands/activations.js +1 -1
  8. package/dist/commands/agent-command.js +1 -1
  9. package/dist/commands/agent-test-command.js +1 -1
  10. package/dist/commands/api-command.js +1 -1
  11. package/dist/commands/auth-command.js +1 -1
  12. package/dist/commands/cas-command.js +1 -1
  13. package/dist/commands/cas-segment-command.js +1 -1
  14. package/dist/commands/chat-command.js +1 -1
  15. package/dist/commands/claude-command.js +1 -1
  16. package/dist/commands/claude-statusline-command.js +1 -1
  17. package/dist/commands/claude-usage-command.js +1 -1
  18. package/dist/commands/command.js +1 -1
  19. package/dist/commands/connection-command.js +1 -1
  20. package/dist/commands/databases.js +1 -1
  21. package/dist/commands/delivery-command.js +1 -1
  22. package/dist/commands/describe.js +1 -1
  23. package/dist/commands/engage-campaign-pull-command.js +1 -1
  24. package/dist/commands/engage-campaign-push-command.js +1 -1
  25. package/dist/commands/engage-campaign-validate-command.js +1 -1
  26. package/dist/commands/engage-command.js +1 -1
  27. package/dist/commands/engage-template-pull-command.js +1 -1
  28. package/dist/commands/engage-template-push-command.js +1 -1
  29. package/dist/commands/engage-template-validate-command.js +1 -1
  30. package/dist/commands/job-command.js +1 -1
  31. package/dist/commands/journey-command.js +1 -1
  32. package/dist/commands/journey-validate-command.js +1 -1
  33. package/dist/commands/llm-command.js +1 -1
  34. package/dist/commands/mcp-command.js +1 -1
  35. package/dist/commands/parent-segment-command.js +1 -1
  36. package/dist/commands/policy-command.js +1 -1
  37. package/dist/commands/profile-command.js +1 -1
  38. package/dist/commands/profiles-command.js +1 -1
  39. package/dist/commands/query-command.js +1 -1
  40. package/dist/commands/schedule-command.js +1 -1
  41. package/dist/commands/segment-command.js +1 -1
  42. package/dist/commands/segment-create-command.js +1 -1
  43. package/dist/commands/segment-fields-command.js +1 -1
  44. package/dist/commands/segment-pull-command.js +1 -1
  45. package/dist/commands/segment-push-command.js +1 -1
  46. package/dist/commands/segment-update-command.js +1 -1
  47. package/dist/commands/segment-use-command.js +1 -1
  48. package/dist/commands/segment-validate-command.js +1 -1
  49. package/dist/commands/segments.js +1 -1
  50. package/dist/commands/show.js +1 -1
  51. package/dist/commands/status-command.js +1 -1
  52. package/dist/commands/table-deleted.js +1 -1
  53. package/dist/commands/tables.js +1 -1
  54. package/dist/commands/unset-command.js +1 -1
  55. package/dist/commands/upgrade-command.js +1 -1
  56. package/dist/commands/use-command.js +1 -1
  57. package/dist/commands/user-command.js +1 -1
  58. package/dist/commands/work-command.js +1 -1
  59. package/dist/commands/workflow-command.js +1 -1
  60. package/dist/core/auth.js +1 -1
  61. package/dist/core/command-output.js +1 -1
  62. package/dist/core/config.d.ts +14 -0
  63. package/dist/core/config.d.ts.map +1 -1
  64. package/dist/core/config.js +1 -1
  65. package/dist/core/config.js.map +1 -1
  66. package/dist/core/connection-cache.js +1 -1
  67. package/dist/core/constants.js +1 -1
  68. package/dist/core/credential-cache.js +1 -1
  69. package/dist/core/global-context.js +1 -1
  70. package/dist/core/keychain.js +1 -1
  71. package/dist/core/oauth-keychain.js +1 -1
  72. package/dist/core/oauth.js +1 -1
  73. package/dist/core/profile.js +1 -1
  74. package/dist/core/project-config.d.ts +1 -0
  75. package/dist/core/project-config.d.ts.map +1 -1
  76. package/dist/core/project-config.js +1 -1
  77. package/dist/core/project-config.js.map +1 -1
  78. package/dist/core/session.js +1 -1
  79. package/dist/core/user-cache.js +1 -1
  80. package/dist/core/version.js +1 -1
  81. package/dist/index.js +1 -1
  82. package/dist/mcp/server.js +1 -1
  83. package/dist/mcp/tools/index.js +1 -1
  84. package/dist/mcp/tools/tdx-run.js +1 -1
  85. package/dist/mcp/tools/tdx-search.d.ts.map +1 -1
  86. package/dist/mcp/tools/tdx-search.js +1 -1
  87. package/dist/mcp/tools/tdx-search.js.map +1 -1
  88. package/dist/mcp/tools/work-create-item.js +1 -1
  89. package/dist/mcp/utils.js +1 -1
  90. package/dist/proxy/claude-usage-tracker.js +1 -1
  91. package/dist/proxy/passthrough-server.js +1 -1
  92. package/dist/proxy/sse-usage-parser.js +1 -1
  93. package/dist/sdk/agent/agent-config.js +1 -1
  94. package/dist/sdk/agent/agent-ref-parser.js +1 -1
  95. package/dist/sdk/agent/agent-yaml.js +1 -1
  96. package/dist/sdk/agent/test/evaluator.js +1 -1
  97. package/dist/sdk/agent/test/executor.js +1 -1
  98. package/dist/sdk/agent/test/index.js +1 -1
  99. package/dist/sdk/agent/test/output.js +1 -1
  100. package/dist/sdk/agent/test/parser.js +1 -1
  101. package/dist/sdk/agent/tool-target-registry.js +1 -1
  102. package/dist/sdk/api.js +1 -1
  103. package/dist/sdk/cas/cas-api-client.js +1 -1
  104. package/dist/sdk/cas/cas-audience-yaml.js +1 -1
  105. package/dist/sdk/cas/cas-segment-yaml.js +1 -1
  106. package/dist/sdk/cas/index.js +1 -1
  107. package/dist/sdk/cas/pull-workflow.js +1 -1
  108. package/dist/sdk/cas/push-workflow.js +1 -1
  109. package/dist/sdk/client/cdp-api-client.js +1 -1
  110. package/dist/sdk/client/delivery-api-client.js +1 -1
  111. package/dist/sdk/client/endpoints.js +1 -1
  112. package/dist/sdk/client/engage-api-client.js +1 -1
  113. package/dist/sdk/client/http-client.js +1 -1
  114. package/dist/sdk/client/llm-api-client.js +1 -1
  115. package/dist/sdk/client/oauth-refresh.js +1 -1
  116. package/dist/sdk/client/rate-limiter.js +1 -1
  117. package/dist/sdk/client/td-api-client.js +1 -1
  118. package/dist/sdk/client/trino-api-client.js +1 -1
  119. package/dist/sdk/client/workflow-client.js +1 -1
  120. package/dist/sdk/connection-validator.js +1 -1
  121. package/dist/sdk/connection.js +1 -1
  122. package/dist/sdk/delivery.js +1 -1
  123. package/dist/sdk/engage/campaign-pull.js +1 -1
  124. package/dist/sdk/engage/campaign-push.js +1 -1
  125. package/dist/sdk/engage/campaign-validator.js +1 -1
  126. package/dist/sdk/engage/campaign-yaml.js +1 -1
  127. package/dist/sdk/engage/template-pull.js +1 -1
  128. package/dist/sdk/engage/template-push.js +1 -1
  129. package/dist/sdk/engage/template-validator.js +1 -1
  130. package/dist/sdk/engage/template-yaml.js +1 -1
  131. package/dist/sdk/engage/types/campaign-def.js +1 -1
  132. package/dist/sdk/engage/types/campaign-schema.js +1 -1
  133. package/dist/sdk/engage/types/template-schema.js +1 -1
  134. package/dist/sdk/engage.js +1 -1
  135. package/dist/sdk/errors.js +1 -1
  136. package/dist/sdk/index.js +1 -1
  137. package/dist/sdk/io/index.js +1 -1
  138. package/dist/sdk/io/node-filesystem.js +1 -1
  139. package/dist/sdk/job.js +1 -1
  140. package/dist/sdk/journey.js +1 -1
  141. package/dist/sdk/llm/chat-cache.js +1 -1
  142. package/dist/sdk/llm/index.js +1 -1
  143. package/dist/sdk/llm/llm-backup-utils.js +1 -1
  144. package/dist/sdk/llm/model-factors.js +1 -1
  145. package/dist/sdk/llm/user-settings.js +1 -1
  146. package/dist/sdk/personalization.js +1 -1
  147. package/dist/sdk/policy.js +1 -1
  148. package/dist/sdk/query/deleted-table-validation.js +1 -1
  149. package/dist/sdk/query/index.js +1 -1
  150. package/dist/sdk/query/sql-parser.js +1 -1
  151. package/dist/sdk/realtime.js +1 -1
  152. package/dist/sdk/schedule.js +1 -1
  153. package/dist/sdk/segment/child-segment-yaml.js +1 -1
  154. package/dist/sdk/segment/fields-display.js +1 -1
  155. package/dist/sdk/segment/file-discovery.js +1 -1
  156. package/dist/sdk/segment/journey-utils.js +1 -1
  157. package/dist/sdk/segment/journey-validator.js +1 -1
  158. package/dist/sdk/segment/journey-yaml.js +1 -1
  159. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  160. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  161. package/dist/sdk/segment/pull-workflow.js +1 -1
  162. package/dist/sdk/segment/push-recovery.js +1 -1
  163. package/dist/sdk/segment/push-workflow.js +1 -1
  164. package/dist/sdk/segment/resolution-context.js +1 -1
  165. package/dist/sdk/segment/segment-path-parser.js +1 -1
  166. package/dist/sdk/segment/segment-ref-parser.js +1 -1
  167. package/dist/sdk/segment/segment-validator.js +1 -1
  168. package/dist/sdk/segment/target-resolution.js +1 -1
  169. package/dist/sdk/segment/tdx-config.js +1 -1
  170. package/dist/sdk/segment/types/activation-schema.js +1 -1
  171. package/dist/sdk/segment/types/journey-def.js +1 -1
  172. package/dist/sdk/segment/types/journey-schema.js +1 -1
  173. package/dist/sdk/segment/types/segment-def.js +1 -1
  174. package/dist/sdk/segment/types/segment-schema.js +1 -1
  175. package/dist/sdk/segment/validate-files.js +1 -1
  176. package/dist/sdk/segment/yaml-validator.js +1 -1
  177. package/dist/sdk/segment.js +1 -1
  178. package/dist/sdk/types/index.js +1 -1
  179. package/dist/sdk/types/progress.js +1 -1
  180. package/dist/sdk/types/workspace.js +1 -1
  181. package/dist/sdk/user.js +1 -1
  182. package/dist/sdk/util/format-detector.js +1 -1
  183. package/dist/sdk/util/formatters.js +1 -1
  184. package/dist/sdk/util/index.js +1 -1
  185. package/dist/sdk/util/paginate.js +1 -1
  186. package/dist/sdk/util/tree-formatter.js +1 -1
  187. package/dist/sdk/workflow/archive-validation.js +1 -1
  188. package/dist/sdk/workflow/clone-workflow.js +1 -1
  189. package/dist/sdk/workflow/index.js +1 -1
  190. package/dist/sdk/workflow/pull-workflow.js +1 -1
  191. package/dist/sdk/workflow/push-workflow.js +1 -1
  192. package/dist/sdk/workflow/task-graph.js +1 -1
  193. package/dist/sdk/workflow/tdx-config.js +1 -1
  194. package/dist/sdk/workflow/workflow-utils.js +1 -1
  195. package/dist/sdk/workspace/access-tracker.js +1 -1
  196. package/dist/sdk/workspace/frontmatter.js +1 -1
  197. package/dist/sdk/workspace/git.js +1 -1
  198. package/dist/sdk/workspace/index.js +1 -1
  199. package/dist/sdk/workspace/templates.js +1 -1
  200. package/dist/sdk/workspace/weekly.js +1 -1
  201. package/dist/sdk/workspace/wikilinks.js +1 -1
  202. package/dist/test-utils/command-runner.js +1 -1
  203. package/dist/test-utils/factories.js +1 -1
  204. package/dist/test-utils/fixtures.js +1 -1
  205. package/dist/test-utils/http-mock.js +1 -1
  206. package/dist/test-utils/index.js +1 -1
  207. package/dist/utils/async.js +1 -1
  208. package/dist/utils/colors.js +1 -1
  209. package/dist/utils/diff.js +1 -1
  210. package/dist/utils/file-permissions.js +1 -1
  211. package/dist/utils/file-reader.js +1 -1
  212. package/dist/utils/github-releases.js +1 -1
  213. package/dist/utils/global-cache.js +1 -1
  214. package/dist/utils/json-loader.js +1 -1
  215. package/dist/utils/local-cache.js +1 -1
  216. package/dist/utils/logger/formatters/default-formatter.js +1 -1
  217. package/dist/utils/logger/formatters/index.js +1 -1
  218. package/dist/utils/logger/handlers/console-handler.js +1 -1
  219. package/dist/utils/logger/handlers/file-handler.js +1 -1
  220. package/dist/utils/logger/handlers/index.js +1 -1
  221. package/dist/utils/logger/handlers/null-handler.js +1 -1
  222. package/dist/utils/logger/index.js +1 -1
  223. package/dist/utils/logger/logger.js +1 -1
  224. package/dist/utils/logger/types.js +1 -1
  225. package/dist/utils/option-validation.js +1 -1
  226. package/dist/utils/process.js +1 -1
  227. package/dist/utils/prompt.js +1 -1
  228. package/dist/utils/spinner.js +1 -1
  229. package/dist/utils/sse-parser.js +1 -1
  230. package/dist/utils/string-utils.js +1 -1
  231. package/dist/utils/table-ref-parser.js +1 -1
  232. package/dist/utils/tdx-logger.js +1 -1
  233. package/dist/utils/version-check.js +1 -1
  234. package/package.json +1 -1
@@ -1 +1 @@
1
- function a32_0x4e82(){const _0x4438f6=['getPolicy','getCurrent','Listing\x20policies...','9aSrWfG','policy','getPolicyUsers','\x20assigned','\x20user','permissions','account_owner','1463810fOiXvw','349292DQwmYk','log','🔑\x20Effective\x20Permissions','22vQFLIt','length','Administrator','List\x20all\x20policies\x20in\x20the\x20account\x20(admin\x20only)','verbose','join','max','listPolicies','\x20\x20•\x20','map','policies','operation','ies','1863395NhhLZD','administrator','policy\x20list','padEnd','Fetching\x20policy...','3144328JVbWtj','getPolicyPermissions','error','description','44036oWDUzU','✔\x20Found\x20','args','execute','\x20\x20\x20','Show\x20a\x20specific\x20policy\x20details\x20and\x20permissions\x20(admin\x20only)','dim','site','👥\x20Assigned\x20Users','email','No\x20policies\x20found',',\x20user_id:','account_id','\x20polic','bold','data','📋\x20Assigned\x20Policies','7jKdsro','all','4VJHHTb','\x20—\x20','entries','name','1825062XpttZW','63VFBHfv','12560220xoVieE','Usage:\x20tdx\x20policy\x20show\x20<policy-name-or-id>'];a32_0x4e82=function(){return _0x4438f6;};return a32_0x4e82();}function a32_0x5d37(_0x330c5b,_0x183a37){_0x330c5b=_0x330c5b-0xea;const _0x4e8228=a32_0x4e82();let _0x5d379c=_0x4e8228[_0x330c5b];return _0x5d379c;}const a32_0x38e537=a32_0x5d37;(function(_0x19e7d4,_0x4d71da){const _0x5a8712=a32_0x5d37,_0xa7885a=_0x19e7d4();while(!![]){try{const _0x5dafdc=-parseInt(_0x5a8712(0x101))/0x1+-parseInt(_0x5a8712(0x11a))/0x2*(-parseInt(_0x5a8712(0xf3))/0x3)+-parseInt(_0x5a8712(0xee))/0x4*(parseInt(_0x5a8712(0x111))/0x5)+parseInt(_0x5a8712(0xf2))/0x6*(-parseInt(_0x5a8712(0xec))/0x7)+parseInt(_0x5a8712(0x116))/0x8*(-parseInt(_0x5a8712(0xf9))/0x9)+-parseInt(_0x5a8712(0x100))/0xa*(-parseInt(_0x5a8712(0x104))/0xb)+parseInt(_0x5a8712(0xf4))/0xc;if(_0x5dafdc===_0x4d71da)break;else _0xa7885a['push'](_0xa7885a['shift']());}catch(_0x37c2e3){_0xa7885a['push'](_0xa7885a['shift']());}}}(a32_0x4e82,0x5d6ac));import{BaseCommand}from'./command.js';import{handleSDKOutput,handleSingleObjectOutput,isStructuredFormat}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import a32_0x5ef113 from'chalk';export class PolicyCommand extends BaseCommand{['name']='policy';[a32_0x38e537(0x119)]='Show\x20current\x20user\x20policies\x20and\x20effective\x20permissions';async[a32_0x38e537(0x11d)](_0x49356a){const _0x35de0d=a32_0x38e537,{options:_0x17ed7e,tdx:_0x394bcf}=_0x49356a,_0x2df577=await withSpinner('Fetching\x20permissions...',async()=>{const _0xd6a903=a32_0x5d37,[_0x3a491e,_0x22d4f0]=await Promise[_0xd6a903(0xed)]([_0x394bcf['user'][_0xd6a903(0xf7)](),_0x394bcf['policy']['getMyPermissions']()]);return{'userInfo':_0x3a491e,'permissions':_0x22d4f0};},{'verbose':_0x17ed7e[_0x35de0d(0x108)]}),{userInfo:_0x40e0bf,permissions:_0x2f6fdb}=_0x2df577['data'];if(isStructuredFormat(_0x17ed7e))return await handleSingleObjectOutput(_0x2f6fdb,_0x17ed7e),0x0;const _0xb1bc7d=_0x40e0bf[_0x35de0d(0xff)]?'Account\x20Owner':_0x40e0bf[_0x35de0d(0x112)]?_0x35de0d(0x106):'Member';console[_0x35de0d(0x102)]('\x0a'+a32_0x5ef113[_0x35de0d(0x128)]('👤')+'\x20'+a32_0x5ef113['bold'](_0x40e0bf[_0x35de0d(0xf1)])+'\x20'+a32_0x5ef113[_0x35de0d(0x120)]('('+_0x40e0bf[_0x35de0d(0x123)]+')')+_0x35de0d(0xef)+_0xb1bc7d),console[_0x35de0d(0x102)](a32_0x5ef113[_0x35de0d(0x120)](_0x35de0d(0x11e)+_0x394bcf['context'][_0x35de0d(0x121)]+':'+_0x40e0bf[_0x35de0d(0x126)]+_0x35de0d(0x125)+_0x40e0bf['id']));const _0x1b6c53=_0x2f6fdb[_0x35de0d(0x10e)];console['log']('\x0a'+a32_0x5ef113[_0x35de0d(0x128)](_0x35de0d(0xeb))+'\x20('+_0x1b6c53['length']+'):');if(_0x1b6c53[_0x35de0d(0x105)]===0x0)console[_0x35de0d(0x102)](a32_0x5ef113[_0x35de0d(0x120)]('\x20\x20No\x20policies\x20assigned'));else for(const _0x4532d5 of _0x1b6c53){console[_0x35de0d(0x102)](_0x35de0d(0x10c)+_0x4532d5[_0x35de0d(0xf1)]);}return printPermissionsMap(_0x2f6fdb[_0x35de0d(0xfe)]),console[_0x35de0d(0x102)](),0x0;}}export class PolicyListCommand extends BaseCommand{['name']=a32_0x38e537(0x113);[a32_0x38e537(0x119)]=a32_0x38e537(0x107);async['execute'](_0x2893c4){const _0x5d1892=a32_0x38e537,{options:_0x118c90,tdx:_0x155bcb}=_0x2893c4,_0x833b95=await withSpinner(_0x5d1892(0xf8),()=>_0x155bcb[_0x5d1892(0xfa)][_0x5d1892(0x10b)](),{'verbose':_0x118c90[_0x5d1892(0x108)]}),_0x5bd4e9=_0x833b95[_0x5d1892(0xea)];console[_0x5d1892(0x118)](_0x5d1892(0x11b)+_0x5bd4e9[_0x5d1892(0x105)]+_0x5d1892(0x127)+(_0x5bd4e9[_0x5d1892(0x105)]!==0x1?_0x5d1892(0x110):'y'));if(isStructuredFormat(_0x118c90))return await handleSDKOutput(_0x5bd4e9,_0x118c90),0x0;if(_0x5bd4e9['length']===0x0)console[_0x5d1892(0x102)](a32_0x5ef113[_0x5d1892(0x120)](_0x5d1892(0x124)));else for(const _0xb973b2 of _0x5bd4e9){const _0x10598a=_0xb973b2[_0x5d1892(0x119)]?a32_0x5ef113[_0x5d1892(0x120)]('\x20—\x20'+_0xb973b2[_0x5d1892(0x119)]):'';console[_0x5d1892(0x102)](_0x5d1892(0x10c)+_0xb973b2[_0x5d1892(0xf1)]+_0x10598a);}return 0x0;}}export class PolicyShowCommand extends BaseCommand{[a32_0x38e537(0xf1)]='policy\x20show';[a32_0x38e537(0x119)]=a32_0x38e537(0x11f);['validate'](_0x5e6379){const _0x1ed0c3=a32_0x38e537;if(_0x5e6379['args'][_0x1ed0c3(0x105)]===0x0)return _0x1ed0c3(0xf5);return undefined;}async[a32_0x38e537(0x11d)](_0x51e645){const _0x52f1b5=a32_0x38e537,{options:_0x19d216,tdx:_0x22517e}=_0x51e645,_0x5d3656=_0x51e645[_0x52f1b5(0x11c)][0x0],_0xabcbc4=await withSpinner(_0x52f1b5(0x115),async()=>{const _0x45d693=_0x52f1b5,_0x1f0784=await _0x22517e['policy'][_0x45d693(0xf6)](_0x5d3656),[_0x535a7c,_0xdda56f]=await Promise[_0x45d693(0xed)]([_0x22517e[_0x45d693(0xfa)][_0x45d693(0x117)](_0x1f0784['id']),_0x22517e[_0x45d693(0xfa)][_0x45d693(0xfb)](_0x1f0784['id'])]);return{'policy':_0x1f0784,'perms':_0x535a7c,'users':_0xdda56f};},{'verbose':_0x19d216[_0x52f1b5(0x108)]}),{policy:_0x33cbac,perms:_0x380dc0,users:_0x28d9f9}=_0xabcbc4[_0x52f1b5(0xea)];if(isStructuredFormat(_0x19d216))return await handleSingleObjectOutput({..._0x33cbac,'permissions':_0x380dc0[_0x52f1b5(0xfe)],'users':_0x28d9f9},_0x19d216),0x0;console[_0x52f1b5(0x102)]('\x0a'+a32_0x5ef113[_0x52f1b5(0x128)]('📋')+'\x20'+a32_0x5ef113[_0x52f1b5(0x128)](_0x33cbac[_0x52f1b5(0xf1)])+'\x20'+a32_0x5ef113[_0x52f1b5(0x120)]('(ID:\x20'+_0x33cbac['id']+')'));_0x33cbac[_0x52f1b5(0x119)]&&console[_0x52f1b5(0x102)]('\x20\x20\x20'+a32_0x5ef113[_0x52f1b5(0x120)](_0x33cbac[_0x52f1b5(0x119)]));console['log'](_0x52f1b5(0x11e)+_0x28d9f9[_0x52f1b5(0x105)]+_0x52f1b5(0xfd)+(_0x28d9f9['length']!==0x1?'s':'')+_0x52f1b5(0xfc)),printPermissionsMap(_0x380dc0[_0x52f1b5(0xfe)]);if(_0x28d9f9[_0x52f1b5(0x105)]>0x0){console['log']('\x0a'+a32_0x5ef113['bold'](_0x52f1b5(0x122))+':');for(const _0x36a63c of _0x28d9f9){const _0x2a388b=_0x36a63c[_0x52f1b5(0x123)]&&_0x36a63c[_0x52f1b5(0x123)]!==_0x36a63c[_0x52f1b5(0xf1)]?a32_0x5ef113[_0x52f1b5(0x120)]('\x20<'+_0x36a63c[_0x52f1b5(0x123)]+'>'):'';console[_0x52f1b5(0x102)]('\x20\x20•\x20'+_0x36a63c[_0x52f1b5(0xf1)]+_0x2a388b);}}return console[_0x52f1b5(0x102)](),0x0;}}function printPermissionsMap(_0x15f7e7){const _0xd6b0be=a32_0x38e537,_0x30b8c5=Object[_0xd6b0be(0xf0)](_0x15f7e7);console[_0xd6b0be(0x102)]('\x0a'+a32_0x5ef113[_0xd6b0be(0x128)](_0xd6b0be(0x103))+':');if(_0x30b8c5['length']===0x0){console[_0xd6b0be(0x102)](a32_0x5ef113[_0xd6b0be(0x120)]('\x20\x20No\x20permissions'));return;}const _0x3b22fe=Math[_0xd6b0be(0x10a)](..._0x30b8c5['map'](([_0x41a43f])=>_0x41a43f['length']));for(const [_0xdf5a5e,_0xcbd1a8]of _0x30b8c5){const _0x2375a6=formatOperations(_0xcbd1a8);console['log']('\x20\x20'+_0xdf5a5e[_0xd6b0be(0x114)](_0x3b22fe+0x2)+_0x2375a6);}}function formatOperations(_0x5a22ff){const _0x165402=a32_0x38e537,_0x2cf608=[...new Set(_0x5a22ff[_0x165402(0x10d)](_0x4a6793=>_0x4a6793[_0x165402(0x10f)]))];return _0x2cf608[_0x165402(0x109)](',\x20');}
1
+ const a32_0x5de0df=a32_0x15b1;(function(_0x412916,_0x30dd5e){const _0x590417=a32_0x15b1,_0x570d92=_0x412916();while(!![]){try{const _0x3fe0d5=parseInt(_0x590417(0x139))/0x1+parseInt(_0x590417(0x14b))/0x2*(-parseInt(_0x590417(0x11d))/0x3)+-parseInt(_0x590417(0x13b))/0x4+-parseInt(_0x590417(0x152))/0x5*(-parseInt(_0x590417(0x148))/0x6)+-parseInt(_0x590417(0x155))/0x7+parseInt(_0x590417(0x151))/0x8*(-parseInt(_0x590417(0x133))/0x9)+-parseInt(_0x590417(0x122))/0xa*(-parseInt(_0x590417(0x135))/0xb);if(_0x3fe0d5===_0x30dd5e)break;else _0x570d92['push'](_0x570d92['shift']());}catch(_0x1c89ed){_0x570d92['push'](_0x570d92['shift']());}}}(a32_0xc04b,0xc1532));function a32_0x15b1(_0x5ab77d,_0x52e9f5){_0x5ab77d=_0x5ab77d-0x119;const _0xc04b79=a32_0xc04b();let _0x15b12c=_0xc04b79[_0x5ab77d];return _0x15b12c;}import{BaseCommand}from'./command.js';import{handleSDKOutput,handleSingleObjectOutput,isStructuredFormat}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import a32_0x405c34 from'chalk';export class PolicyCommand extends BaseCommand{[a32_0x5de0df(0x120)]=a32_0x5de0df(0x12a);[a32_0x5de0df(0x13a)]=a32_0x5de0df(0x149);async['execute'](_0x359ef9){const _0x1d8300=a32_0x5de0df,{options:_0xbd8686,tdx:_0x483386}=_0x359ef9,_0xc3f9aa=await withSpinner(_0x1d8300(0x143),async()=>{const _0x35fbb3=_0x1d8300,[_0x2254bf,_0x5b978e]=await Promise[_0x35fbb3(0x145)]([_0x483386[_0x35fbb3(0x124)][_0x35fbb3(0x14a)](),_0x483386['policy']['getMyPermissions']()]);return{'userInfo':_0x2254bf,'permissions':_0x5b978e};},{'verbose':_0xbd8686[_0x1d8300(0x154)]}),{userInfo:_0x281f1c,permissions:_0x4ba924}=_0xc3f9aa[_0x1d8300(0x125)];if(isStructuredFormat(_0xbd8686))return await handleSingleObjectOutput(_0x4ba924,_0xbd8686),0x0;const _0x4c8c27=_0x281f1c['account_owner']?_0x1d8300(0x153):_0x281f1c['administrator']?_0x1d8300(0x14d):_0x1d8300(0x12e);console[_0x1d8300(0x119)]('\x0a'+a32_0x405c34[_0x1d8300(0x14e)]('👤')+'\x20'+a32_0x405c34[_0x1d8300(0x14e)](_0x281f1c[_0x1d8300(0x120)])+'\x20'+a32_0x405c34[_0x1d8300(0x13c)]('('+_0x281f1c[_0x1d8300(0x14f)]+')')+_0x1d8300(0x126)+_0x4c8c27),console['log'](a32_0x405c34['dim'](_0x1d8300(0x11f)+_0x483386[_0x1d8300(0x150)][_0x1d8300(0x12d)]+':'+_0x281f1c['account_id']+_0x1d8300(0x130)+_0x281f1c['id']));const _0x319796=_0x4ba924['policies'];console[_0x1d8300(0x119)]('\x0a'+a32_0x405c34[_0x1d8300(0x14e)](_0x1d8300(0x140))+'\x20('+_0x319796[_0x1d8300(0x141)]+'):');if(_0x319796['length']===0x0)console[_0x1d8300(0x119)](a32_0x405c34[_0x1d8300(0x13c)](_0x1d8300(0x147)));else for(const _0x30b136 of _0x319796){console[_0x1d8300(0x119)]('\x20\x20•\x20'+_0x30b136[_0x1d8300(0x120)]);}return printPermissionsMap(_0x4ba924[_0x1d8300(0x12c)]),console[_0x1d8300(0x119)](),0x0;}}export class PolicyListCommand extends BaseCommand{[a32_0x5de0df(0x120)]=a32_0x5de0df(0x11a);[a32_0x5de0df(0x13a)]=a32_0x5de0df(0x131);async[a32_0x5de0df(0x11e)](_0x4904f9){const _0x2fe91d=a32_0x5de0df,{options:_0x3e7465,tdx:_0x5264bf}=_0x4904f9,_0x286ef9=await withSpinner('Listing\x20policies...',()=>_0x5264bf[_0x2fe91d(0x12a)][_0x2fe91d(0x127)](),{'verbose':_0x3e7465[_0x2fe91d(0x154)]}),_0x167909=_0x286ef9[_0x2fe91d(0x125)];console[_0x2fe91d(0x123)](_0x2fe91d(0x11b)+_0x167909[_0x2fe91d(0x141)]+_0x2fe91d(0x132)+(_0x167909[_0x2fe91d(0x141)]!==0x1?'ies':'y'));if(isStructuredFormat(_0x3e7465))return await handleSDKOutput(_0x167909,_0x3e7465),0x0;if(_0x167909['length']===0x0)console['log'](a32_0x405c34[_0x2fe91d(0x13c)](_0x2fe91d(0x129)));else for(const _0x313e4d of _0x167909){const _0x3c7001=_0x313e4d[_0x2fe91d(0x13a)]?a32_0x405c34[_0x2fe91d(0x13c)]('\x20—\x20'+_0x313e4d[_0x2fe91d(0x13a)]):'';console['log']('\x20\x20•\x20'+_0x313e4d[_0x2fe91d(0x120)]+_0x3c7001);}return 0x0;}}export class PolicyShowCommand extends BaseCommand{[a32_0x5de0df(0x120)]=a32_0x5de0df(0x142);[a32_0x5de0df(0x13a)]=a32_0x5de0df(0x136);[a32_0x5de0df(0x137)](_0x5aac30){const _0x3c22e1=a32_0x5de0df;if(_0x5aac30['args'][_0x3c22e1(0x141)]===0x0)return _0x3c22e1(0x13e);return undefined;}async[a32_0x5de0df(0x11e)](_0x40adfd){const _0x518da4=a32_0x5de0df,{options:_0x29b8c7,tdx:_0x381100}=_0x40adfd,_0x3b4731=_0x40adfd[_0x518da4(0x12b)][0x0],_0x562411=await withSpinner(_0x518da4(0x121),async()=>{const _0x56b16a=_0x518da4,_0x283fc0=await _0x381100[_0x56b16a(0x12a)][_0x56b16a(0x134)](_0x3b4731),[_0xb6fc68,_0x1331de]=await Promise['all']([_0x381100[_0x56b16a(0x12a)][_0x56b16a(0x11c)](_0x283fc0['id']),_0x381100['policy']['getPolicyUsers'](_0x283fc0['id'])]);return{'policy':_0x283fc0,'perms':_0xb6fc68,'users':_0x1331de};},{'verbose':_0x29b8c7[_0x518da4(0x154)]}),{policy:_0x5d7bce,perms:_0x2fe75b,users:_0x4e6c02}=_0x562411['data'];if(isStructuredFormat(_0x29b8c7))return await handleSingleObjectOutput({..._0x5d7bce,'permissions':_0x2fe75b[_0x518da4(0x12c)],'users':_0x4e6c02},_0x29b8c7),0x0;console[_0x518da4(0x119)]('\x0a'+a32_0x405c34[_0x518da4(0x14e)]('📋')+'\x20'+a32_0x405c34[_0x518da4(0x14e)](_0x5d7bce[_0x518da4(0x120)])+'\x20'+a32_0x405c34[_0x518da4(0x13c)](_0x518da4(0x138)+_0x5d7bce['id']+')'));_0x5d7bce[_0x518da4(0x13a)]&&console[_0x518da4(0x119)]('\x20\x20\x20'+a32_0x405c34[_0x518da4(0x13c)](_0x5d7bce['description']));console[_0x518da4(0x119)](_0x518da4(0x11f)+_0x4e6c02[_0x518da4(0x141)]+'\x20user'+(_0x4e6c02[_0x518da4(0x141)]!==0x1?'s':'')+_0x518da4(0x128)),printPermissionsMap(_0x2fe75b[_0x518da4(0x12c)]);if(_0x4e6c02[_0x518da4(0x141)]>0x0){console[_0x518da4(0x119)]('\x0a'+a32_0x405c34[_0x518da4(0x14e)](_0x518da4(0x12f))+':');for(const _0x177562 of _0x4e6c02){const _0x3758c5=_0x177562[_0x518da4(0x14f)]&&_0x177562[_0x518da4(0x14f)]!==_0x177562[_0x518da4(0x120)]?a32_0x405c34[_0x518da4(0x13c)]('\x20<'+_0x177562[_0x518da4(0x14f)]+'>'):'';console[_0x518da4(0x119)](_0x518da4(0x13f)+_0x177562['name']+_0x3758c5);}}return console['log'](),0x0;}}function printPermissionsMap(_0x59c7b9){const _0x2f7c39=a32_0x5de0df,_0x5a3adf=Object['entries'](_0x59c7b9);console['log']('\x0a'+a32_0x405c34['bold'](_0x2f7c39(0x14c))+':');if(_0x5a3adf[_0x2f7c39(0x141)]===0x0){console[_0x2f7c39(0x119)](a32_0x405c34[_0x2f7c39(0x13c)](_0x2f7c39(0x146)));return;}const _0xddb357=Math[_0x2f7c39(0x13d)](..._0x5a3adf[_0x2f7c39(0x156)](([_0xf6f3c3])=>_0xf6f3c3[_0x2f7c39(0x141)]));for(const [_0x9be489,_0x7e7ce9]of _0x5a3adf){const _0x3d3243=formatOperations(_0x7e7ce9);console['log']('\x20\x20'+_0x9be489[_0x2f7c39(0x144)](_0xddb357+0x2)+_0x3d3243);}}function a32_0xc04b(){const _0x29d155=['\x20\x20\x20','name','Fetching\x20policy...','10inVTXo','error','user','data','\x20—\x20','listPolicies','\x20assigned','No\x20policies\x20found','policy','args','permissions','site','Member','👥\x20Assigned\x20Users',',\x20user_id:','List\x20all\x20policies\x20in\x20the\x20account\x20(admin\x20only)','\x20polic','7726482uxhEQT','getPolicy','15354790jMaHuP','Show\x20a\x20specific\x20policy\x20details\x20and\x20permissions\x20(admin\x20only)','validate','(ID:\x20','1212183ljkzsL','description','3961356oAenFO','dim','max','Usage:\x20tdx\x20policy\x20show\x20<policy-name-or-id>','\x20\x20•\x20','📋\x20Assigned\x20Policies','length','policy\x20show','Fetching\x20permissions...','padEnd','all','\x20\x20No\x20permissions','\x20\x20No\x20policies\x20assigned','12ECVvgZ','Show\x20current\x20user\x20policies\x20and\x20effective\x20permissions','getCurrent','7078GTtvTN','🔑\x20Effective\x20Permissions','Administrator','bold','email','context','8lFNYIv','3853340pugPGO','Account\x20Owner','verbose','8356201btehQj','map','log','policy\x20list','✔\x20Found\x20','getPolicyPermissions','267jIkIRX','execute'];a32_0xc04b=function(){return _0x29d155;};return a32_0xc04b();}function formatOperations(_0x102613){const _0x7a180=[...new Set(_0x102613['map'](_0x238de7=>_0x238de7['operation']))];return _0x7a180['join'](',\x20');}
@@ -1 +1 @@
1
- const a33_0x494643=a33_0x356d;(function(_0x363a79,_0x5c8a62){const _0x129542=a33_0x356d,_0x12b8f8=_0x363a79();while(!![]){try{const _0x5122e5=parseInt(_0x129542(0x1fb))/0x1+parseInt(_0x129542(0x252))/0x2*(-parseInt(_0x129542(0x21c))/0x3)+parseInt(_0x129542(0x22f))/0x4+-parseInt(_0x129542(0x232))/0x5+parseInt(_0x129542(0x21f))/0x6+parseInt(_0x129542(0x20d))/0x7+-parseInt(_0x129542(0x259))/0x8*(parseInt(_0x129542(0x241))/0x9);if(_0x5122e5===_0x5c8a62)break;else _0x12b8f8['push'](_0x12b8f8['shift']());}catch(_0x234632){_0x12b8f8['push'](_0x12b8f8['shift']());}}}(a33_0x334a,0x63228));import{BaseCommand,printAuthError}from'./command.js';import{listProfiles,profileExists,saveProfileToUserConfig,removeProfileFromUserConfig,loadProfile,getActiveProfile,saveActiveProfileToUserConfig}from'../core/profile.js';import{getConfigDir}from'../core/config.js';function a33_0x356d(_0x4bc55a,_0x419fca){_0x4bc55a=_0x4bc55a-0x1f2;const _0x334a60=a33_0x334a();let _0x356d2a=_0x334a60[_0x4bc55a];return _0x356d2a;}import*as a33_0x475065 from'node:path';import{saveSessionContext,getSessionID,cleanExpiredSessions}from'../core/session.js';import{saveAPIKeyAsync,resolveSite}from'../core/config.js';import{getConsoleUrl}from'../sdk/client/endpoints.js';import{deleteKeychainAPIKey,isKeychainAvailable}from'../core/keychain.js';import{deleteOAuthTokens}from'../core/oauth-keychain.js';import{runOAuthLoginFlow,promptAuthMethod}from'./auth-command.js';import{promptSiteSelection}from'../core/constants.js';import{HTTPClientError}from'../sdk/client/http-client.js';import{TDX}from'../sdk/index.js';import{LogLevel}from'../utils/tdx-logger.js';import a33_0x5a5bd0 from'prompts';import a33_0x90dc09 from'chalk';function validateProfileName(_0xbb9802,_0xbc52a2){const _0xf7f764=a33_0x356d;if(!_0xbb9802||!_0xbb9802[_0xf7f764(0x200)]())return'Profile\x20name\x20cannot\x20be\x20empty';const _0x3ff689=_0xbb9802[_0xf7f764(0x200)]();if(!/^[a-zA-Z0-9_-]+$/[_0xf7f764(0x22d)](_0x3ff689))return'Profile\x20name\x20must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore';if(!_0xbc52a2?.['skipExistsCheck']&&profileExists(_0x3ff689))return _0xf7f764(0x22c)+_0x3ff689+'\x27\x20already\x20exists.\x20Use\x20\x27tdx\x20profile\x20delete\x20'+_0x3ff689+_0xf7f764(0x222);return!![];}async function deleteProfileAndCredentials(_0x270d0f){const _0x2f9b19=a33_0x356d;removeProfileFromUserConfig(_0x270d0f);const _0x28a5f7=await isKeychainAvailable();_0x28a5f7&&await Promise[_0x2f9b19(0x21b)]([deleteKeychainAPIKey(_0x270d0f),deleteOAuthTokens(_0x270d0f)]);}export class ProfileCreateCommand extends BaseCommand{['name']=a33_0x494643(0x240);[a33_0x494643(0x234)]=a33_0x494643(0x246);async['execute'](_0x1c48a0){const _0x1a33b0=a33_0x494643,{options:_0x24eb05,args:_0xec6139}=_0x1c48a0,_0x27818b=!!_0x24eb05['force'];console[_0x1a33b0(0x248)](a33_0x90dc09[_0x1a33b0(0x217)](_0x1a33b0(0x25b)));let _0x2661b5;if(_0xec6139['length']>0x0&&_0xec6139[0x0]){const _0x5b869b=_0xec6139[0x0][_0x1a33b0(0x200)]();_0x27818b&&profileExists(_0x5b869b)&&(await deleteProfileAndCredentials(_0x5b869b),console['log'](_0x1a33b0(0x213)+_0x5b869b+'\x27'));const _0x22eafe=validateProfileName(_0x5b869b);if(_0x22eafe!==!![])return console[_0x1a33b0(0x24f)](a33_0x90dc09[_0x1a33b0(0x22b)](_0x22eafe)),0x1;_0x2661b5=_0x5b869b;}else{const _0x282a58=await a33_0x5a5bd0({'type':_0x1a33b0(0x236),'name':_0x1a33b0(0x224),'message':_0x1a33b0(0x226),'validate':_0x14a21a=>validateProfileName(_0x14a21a,{'skipExistsCheck':_0x27818b})});if(!_0x282a58['profileName'])return console[_0x1a33b0(0x248)](_0x1a33b0(0x203)),0x1;_0x2661b5=_0x282a58['profileName'][_0x1a33b0(0x200)](),_0x27818b&&profileExists(_0x2661b5)&&(await deleteProfileAndCredentials(_0x2661b5),console[_0x1a33b0(0x248)](_0x1a33b0(0x213)+_0x2661b5+'\x27'));}const _0x2789e0=await a33_0x5a5bd0({'type':'text','name':_0x1a33b0(0x234),'message':_0x1a33b0(0x258)}),_0x3f575c=_0x2789e0['description']?.[_0x1a33b0(0x200)]()||undefined,_0x56a59e=_0x24eb05[_0x1a33b0(0x23c)]||_0x1a33b0(0x212),_0x440f94=await promptSiteSelection(_0x56a59e,_0x2661b5,'Setup\x20cancelled');if(!_0x440f94)return 0x1;const _0x4b3bc4=resolveSite(_0x440f94),_0x49426b=await promptAuthMethod();if(!_0x49426b)return console[_0x1a33b0(0x248)](_0x1a33b0(0x203)),0x1;if(_0x49426b===_0x1a33b0(0x255)){if(_0x3f575c){const _0x31b030={'site':_0x4b3bc4,'description':_0x3f575c};saveProfileToUserConfig(_0x2661b5,_0x31b030);}const {accountName:_0x5d7626}=_0x24eb05;return await runOAuthLoginFlow(_0x4b3bc4,_0x2661b5,_0x24eb05[_0x1a33b0(0x207)]??LogLevel[_0x1a33b0(0x24c)],{'accountName':_0x5d7626}),0x0;}console['log']('\x0aSetting\x20up\x20authentication\x20for\x20site:\x20'+_0x4b3bc4),console[_0x1a33b0(0x248)](_0x1a33b0(0x238)),console[_0x1a33b0(0x248)]('\x20\x20'+getConsoleUrl(_0x4b3bc4,'/app/mp/ak'));const _0x383c9e=await a33_0x5a5bd0({'type':_0x1a33b0(0x20a),'name':_0x1a33b0(0x244),'message':'Enter\x20your\x20TD\x20API\x20key:','validate':_0x15dca7=>{const _0x290ea8=_0x1a33b0;if(!_0x15dca7||!_0x15dca7[_0x290ea8(0x200)]())return'API\x20key\x20cannot\x20be\x20empty';return!![];}});if(!_0x383c9e['apiKey'])return console[_0x1a33b0(0x248)](_0x1a33b0(0x203)),0x1;const _0xd4c66a=_0x383c9e[_0x1a33b0(0x244)];console[_0x1a33b0(0x248)](_0x1a33b0(0x1fd));try{const _0x589a72=TDX[_0x1a33b0(0x1f2)]({'site':_0x4b3bc4,'apiKey':_0xd4c66a[_0x1a33b0(0x200)](),'logLevel':_0x24eb05['logLevel']??LogLevel[_0x1a33b0(0x24c)]}),_0x4b105c=await _0x589a72[_0x1a33b0(0x1f3)]['getUserInfo']();console[_0x1a33b0(0x248)](a33_0x90dc09['green']('✓')+'\x20API\x20key\x20is\x20valid\x20(User:\x20'+_0x4b105c[_0x1a33b0(0x219)]+')');const _0x1b19ee=await isKeychainAvailable();_0x1b19ee?(await saveAPIKeyAsync(_0xd4c66a[_0x1a33b0(0x200)](),_0x4b3bc4,_0x2661b5),console[_0x1a33b0(0x248)](a33_0x90dc09[_0x1a33b0(0x23a)]('✓')+_0x1a33b0(0x20b)+_0x2661b5+')')):(console['warn'](a33_0x90dc09[_0x1a33b0(0x225)](_0x1a33b0(0x208))),console[_0x1a33b0(0x1fc)](a33_0x90dc09['yellow'](_0x1a33b0(0x218))));const _0x1d4099={'site':_0x4b3bc4,..._0x3f575c&&{'description':_0x3f575c}};return saveProfileToUserConfig(_0x2661b5,_0x1d4099),console[_0x1a33b0(0x248)](a33_0x90dc09[_0x1a33b0(0x23a)]('✓')+_0x1a33b0(0x243)+_0x2661b5+_0x1a33b0(0x1f8)),console['log'](),console[_0x1a33b0(0x248)](_0x1a33b0(0x229)),console['log'](_0x1a33b0(0x23f)+_0x2661b5+_0x1a33b0(0x206)),console[_0x1a33b0(0x248)](_0x1a33b0(0x23f)+_0x2661b5+_0x1a33b0(0x205)),0x0;}catch(_0x490ca3){if(_0x490ca3 instanceof HTTPClientError&&_0x490ca3[_0x1a33b0(0x22a)]===0x191)return printAuthError(_0x490ca3),0x1;return console[_0x1a33b0(0x24f)](a33_0x90dc09[_0x1a33b0(0x22b)](_0x1a33b0(0x233)+(_0x490ca3 instanceof Error?_0x490ca3[_0x1a33b0(0x22e)]:String(_0x490ca3)))),console[_0x1a33b0(0x24f)](_0x1a33b0(0x23e)),0x1;}}}export class ProfileDeleteCommand extends BaseCommand{[a33_0x494643(0x204)]=a33_0x494643(0x257);[a33_0x494643(0x234)]='Delete\x20a\x20profile';[a33_0x494643(0x256)](_0x3365c6){const _0x467bba=a33_0x494643,{args:_0x2abc79}=_0x3365c6;if(_0x2abc79[_0x467bba(0x221)]===0x0)return _0x467bba(0x21a);return undefined;}async[a33_0x494643(0x210)](_0x5f04a1){const _0x1eb76f=a33_0x494643,{args:_0x850b70}=_0x5f04a1,_0x11c2ab=_0x850b70[0x0];console[_0x1eb76f(0x248)](a33_0x90dc09[_0x1eb76f(0x217)](_0x1eb76f(0x1f5)));if(!profileExists(_0x11c2ab)){console['error'](a33_0x90dc09[_0x1eb76f(0x22b)](_0x1eb76f(0x22c)+_0x11c2ab+'\x27\x20does\x20not\x20exist.')),console[_0x1eb76f(0x248)](_0x1eb76f(0x214));const _0x148ed9=listProfiles();if(_0x148ed9[_0x1eb76f(0x221)]===0x0)console['log'](_0x1eb76f(0x21e));else for(const _0x54f965 of _0x148ed9){console[_0x1eb76f(0x248)](_0x1eb76f(0x24e)+_0x54f965[_0x1eb76f(0x204)]);}return 0x1;}const _0x1007f0=await a33_0x5a5bd0({'type':'confirm','name':_0x1eb76f(0x247),'message':_0x1eb76f(0x24d)+_0x11c2ab+'\x27?','initial':![]});if(!_0x1007f0[_0x1eb76f(0x247)])return console[_0x1eb76f(0x248)]('Removal\x20cancelled'),0x0;try{await deleteProfileAndCredentials(_0x11c2ab),console[_0x1eb76f(0x248)](a33_0x90dc09[_0x1eb76f(0x23a)]('✓')+_0x1eb76f(0x243)+_0x11c2ab+'\x27\x20deleted');}catch(_0x49e9d4){return console[_0x1eb76f(0x24f)](a33_0x90dc09['red'](_0x1eb76f(0x242)+(_0x49e9d4 instanceof Error?_0x49e9d4[_0x1eb76f(0x22e)]:String(_0x49e9d4)))),0x1;}return 0x0;}}export class ProfileSetCommand extends BaseCommand{['name']=a33_0x494643(0x245);[a33_0x494643(0x234)]='Set\x20a\x20profile\x20configuration\x20value';static ['VALID_KEYS']=[a33_0x494643(0x23c),a33_0x494643(0x250),a33_0x494643(0x254),a33_0x494643(0x20e),a33_0x494643(0x23b),a33_0x494643(0x234)];['validate'](_0x5c9719){const _0x1c61b7=a33_0x494643,{args:_0x56a1f1,options:_0x517159}=_0x5c9719,_0x3aa758=_0x517159[_0x1c61b7(0x1fe)]||getActiveProfile();if(!_0x3aa758)return'No\x20active\x20profile.\x20Use\x20--profile\x20flag\x20or\x20set\x20session\x20profile\x20with:\x20tdx\x20profile\x20use\x20<name>\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>';if(_0x56a1f1[_0x1c61b7(0x221)]===0x0)return'Key=value\x20pair\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20'+ProfileSetCommand[_0x1c61b7(0x209)]['join'](',\x20');const _0x237eac=_0x56a1f1[0x0];if(!_0x237eac[_0x1c61b7(0x235)]('='))return'Invalid\x20format.\x20Use:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20'+ProfileSetCommand[_0x1c61b7(0x209)]['join'](',\x20');const [_0x3d510a]=_0x237eac[_0x1c61b7(0x1f6)]('=',0x2);if(!ProfileSetCommand[_0x1c61b7(0x209)][_0x1c61b7(0x235)](_0x3d510a))return _0x1c61b7(0x23d)+_0x3d510a+'\x27.\x0a\x0aValid\x20keys:\x20'+ProfileSetCommand['VALID_KEYS'][_0x1c61b7(0x251)](',\x20');return undefined;}async[a33_0x494643(0x210)](_0xe41dba){const _0x56f03d=a33_0x494643,{args:_0x576456,options:_0x3ea515}=_0xe41dba,_0xa9b479=_0x3ea515[_0x56f03d(0x1fe)]||getActiveProfile(),[_0x3e9cff,..._0x394afd]=_0x576456[0x0]['split']('='),_0x4b8cf7=_0x394afd[_0x56f03d(0x251)]('=');console[_0x56f03d(0x248)](a33_0x90dc09[_0x56f03d(0x217)](_0x56f03d(0x230)));if(!profileExists(_0xa9b479)){const _0x3fdedf=await a33_0x5a5bd0({'type':_0x56f03d(0x247),'name':_0x56f03d(0x1f2),'message':_0x56f03d(0x22c)+_0xa9b479+_0x56f03d(0x1fa),'initial':!![]});if(!_0x3fdedf['create'])return console['log'](_0x56f03d(0x1f4)),0x1;}const _0x17df78=loadProfile(_0xa9b479),_0x39d786=_0x17df78?.[_0x56f03d(0x239)]||{};if(_0x3e9cff===_0x56f03d(0x23c)){const _0x4da30a=resolveSite(_0x4b8cf7);console['log'](_0x56f03d(0x211)+_0x4da30a+_0x56f03d(0x223)),console['log'](_0x56f03d(0x249)),console[_0x56f03d(0x248)]('\x20\x20'+getConsoleUrl(_0x4da30a,_0x56f03d(0x24b)));const _0x198494=await a33_0x5a5bd0({'type':_0x56f03d(0x20a),'name':_0x56f03d(0x244),'message':_0x56f03d(0x216),'validate':_0x116b17=>{const _0x540301=_0x56f03d;if(!_0x116b17||!_0x116b17[_0x540301(0x200)]())return _0x540301(0x1ff);return!![];}});if(!_0x198494['apiKey'])return console[_0x56f03d(0x248)](_0x56f03d(0x201)),0x1;console[_0x56f03d(0x248)](_0x56f03d(0x1fd));try{const _0x4f96a8=TDX[_0x56f03d(0x1f2)]({'site':_0x4da30a,'apiKey':_0x198494[_0x56f03d(0x244)]['trim'](),'logLevel':_0x3ea515[_0x56f03d(0x207)]??LogLevel['ERROR']}),_0x37584b=await _0x4f96a8[_0x56f03d(0x1f3)][_0x56f03d(0x237)]();console[_0x56f03d(0x248)](a33_0x90dc09[_0x56f03d(0x23a)]('✓')+_0x56f03d(0x21d)+_0x37584b[_0x56f03d(0x219)]+')');const _0xe89f1d=await isKeychainAvailable();_0xe89f1d?(await saveAPIKeyAsync(_0x198494['apiKey']['trim'](),_0x4da30a,_0xa9b479),console[_0x56f03d(0x248)](a33_0x90dc09[_0x56f03d(0x23a)]('✓')+_0x56f03d(0x20f))):console[_0x56f03d(0x1fc)](a33_0x90dc09[_0x56f03d(0x225)](_0x56f03d(0x208))),_0x39d786[_0x56f03d(0x23c)]=_0x4da30a;}catch(_0x35643f){if(_0x35643f instanceof HTTPClientError&&_0x35643f['status']===0x191)return printAuthError(_0x35643f),0x1;return console[_0x56f03d(0x24f)](a33_0x90dc09[_0x56f03d(0x22b)](_0x56f03d(0x233)+(_0x35643f instanceof Error?_0x35643f['message']:String(_0x35643f)))),console[_0x56f03d(0x24f)](_0x56f03d(0x228)),0x1;}}else _0x39d786[_0x3e9cff]=_0x4b8cf7||undefined;return saveProfileToUserConfig(_0xa9b479,_0x39d786),console[_0x56f03d(0x248)](a33_0x90dc09['green']('✓')+'\x20Profile\x20\x27'+_0xa9b479+_0x56f03d(0x227)+_0x3e9cff+'='+(_0x4b8cf7||'(cleared)')),0x0;}}function a33_0x334a(){const _0x21a353=['name','\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases','\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication','logLevel','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','VALID_KEYS','password','\x20API\x20key\x20saved\x20to\x20system\x20keychain\x20(profile:\x20','Set\x20session\x20profile','2473163xPHUFd','llm_project','\x20API\x20key\x20saved\x20to\x20system\x20keychain','execute','Changing\x20site\x20to\x20\x27','us01','Removed\x20existing\x20profile\x20\x27','\x0aAvailable\x20profiles:','\x27\x20does\x20not\x20exist.','Enter\x20your\x20TD\x20API\x20key\x20for\x20the\x20new\x20site:','bold','\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.','email','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20delete\x20<name>','all','2796AbAfQM','\x20API\x20key\x20is\x20valid\x20(User:\x20','\x20\x20(no\x20profiles\x20found)','1901880VeUUhy','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20use\x20<name>\x20[--default]','length','\x27\x20to\x20remove\x20it\x20first,\x20or\x20re-create\x20with\x20--force.','\x27\x20requires\x20API\x20key\x20validation.','profileName','yellow','Enter\x20profile\x20name:','\x27\x20updated:\x20','Site\x20was\x20not\x20changed.','You\x20can\x20now\x20use\x20tdx\x20commands\x20with\x20this\x20profile.\x20Try:','status','red','Profile\x20\x27','test','message','2812716mxTlag','tdx:\x20profile\x20set','\x0aTip:\x20Use\x20\x27tdx\x20profile\x20use\x20','123130TCaqlK','✗\x20Validation\x20failed:\x20','description','includes','text','getUserInfo','You\x20can\x20find\x20your\x20API\x20key\x20at:','config','green','llm_agent','site','Unknown\x20key\x20\x27','Profile\x20was\x20not\x20created.\x20Please\x20try\x20again.','\x20\x20tdx\x20--profile\x20','profile:create','1953tblsLr','Failed\x20to\x20delete\x20profile:\x20','\x20Profile\x20\x27','apiKey','profile:set','Create\x20a\x20new\x20profile','confirm','log','\x0aYou\x20can\x20find\x20your\x20API\x20key\x20at:','(session:\x20','/app/mp/ak','ERROR','Are\x20you\x20sure\x20you\x20want\x20to\x20remove\x20profile\x20\x27','\x20\x20-\x20','error','database','join','144UnDhAy','\x20--default\x27\x20to\x20save\x20permanently','parent_segment','oauth','validate','profile:delete','Enter\x20description\x20(optional):','35944bIjVKD','Default\x20profile\x20set\x20to:\x20','tdx:\x20profile\x20create','create','jobs','Operation\x20cancelled','tdx:\x20profile\x20delete','split','profile:use','\x27\x20created','dim','\x27\x20does\x20not\x20exist.\x20Create\x20it?','99299JFuafm','warn','Validating\x20API\x20key...','profile','API\x20key\x20cannot\x20be\x20empty','trim','\x0aOperation\x20cancelled','session','\x0aSetup\x20cancelled'];a33_0x334a=function(){return _0x21a353;};return a33_0x334a();}export class ProfileUseCommand extends BaseCommand{[a33_0x494643(0x204)]=a33_0x494643(0x1f7);[a33_0x494643(0x234)]=a33_0x494643(0x20c);[a33_0x494643(0x256)](_0x187676){const _0x12c2a9=a33_0x494643,{args:_0x412053}=_0x187676;if(_0x412053[_0x12c2a9(0x221)]===0x0)return _0x12c2a9(0x220);return undefined;}async[a33_0x494643(0x210)](_0x3ba7ce){const _0x37b13e=a33_0x494643,{args:_0x4e90e7,options:_0x30cbf3}=_0x3ba7ce,_0x331643=_0x4e90e7[0x0],_0x1b4838=_0x30cbf3['default'];cleanExpiredSessions();if(!profileExists(_0x331643)){console[_0x37b13e(0x24f)](a33_0x90dc09['red']('Profile\x20\x27'+_0x331643+_0x37b13e(0x215))),console['log'](_0x37b13e(0x214));const _0x3c3ae5=listProfiles();if(_0x3c3ae5[_0x37b13e(0x221)]===0x0)console['log'](_0x37b13e(0x21e));else for(const _0x2d7120 of _0x3c3ae5){console[_0x37b13e(0x248)](_0x37b13e(0x24e)+_0x2d7120[_0x37b13e(0x204)]);}return 0x1;}if(_0x1b4838){const _0x81b229=a33_0x475065[_0x37b13e(0x251)](getConfigDir(),'tdx.json');return saveActiveProfileToUserConfig(_0x331643),console[_0x37b13e(0x248)](_0x37b13e(0x25a)+a33_0x90dc09[_0x37b13e(0x23a)](_0x331643)),console[_0x37b13e(0x248)](a33_0x90dc09['dim']('\x0aSaved\x20to:\x20'+_0x81b229)),0x0;}const _0x212d68=getSessionID(_0x30cbf3['session']);return saveSessionContext({'profile':_0x331643},_0x30cbf3[_0x37b13e(0x202)]),console[_0x37b13e(0x248)]('Session\x20profile\x20set\x20to:\x20'+a33_0x90dc09[_0x37b13e(0x23a)](_0x331643)+'\x20'+a33_0x90dc09[_0x37b13e(0x1f9)](_0x37b13e(0x24a)+_0x212d68+')')),console[_0x37b13e(0x248)](a33_0x90dc09[_0x37b13e(0x1f9)](_0x37b13e(0x231)+_0x331643+_0x37b13e(0x253))),0x0;}}
1
+ const a33_0x3a7854=a33_0x1c0b;(function(_0x2571f0,_0x4eeb0c){const _0x224816=a33_0x1c0b,_0xf0db40=_0x2571f0();while(!![]){try{const _0x2f7427=parseInt(_0x224816(0x13d))/0x1+-parseInt(_0x224816(0x148))/0x2*(parseInt(_0x224816(0x127))/0x3)+parseInt(_0x224816(0x12c))/0x4*(-parseInt(_0x224816(0x138))/0x5)+-parseInt(_0x224816(0x13e))/0x6*(parseInt(_0x224816(0x14f))/0x7)+parseInt(_0x224816(0x13a))/0x8+-parseInt(_0x224816(0x124))/0x9+parseInt(_0x224816(0x115))/0xa;if(_0x2f7427===_0x4eeb0c)break;else _0xf0db40['push'](_0xf0db40['shift']());}catch(_0x4bb007){_0xf0db40['push'](_0xf0db40['shift']());}}}(a33_0xf8be,0x587d4));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_0x3549ac from'node:path';function a33_0x1c0b(_0x167213,_0x45479e){_0x167213=_0x167213-0x108;const _0xf8be05=a33_0xf8be();let _0x1c0b44=_0xf8be05[_0x167213];return _0x1c0b44;}function a33_0xf8be(){const _0x1ae825=['260838YRDPkX','3762otTRbf','\x20--default\x27\x20to\x20save\x20permanently','Set\x20session\x20profile','Changing\x20site\x20to\x20\x27','Session\x20profile\x20set\x20to:\x20','\x20\x20-\x20','Key=value\x20pair\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','log','Validating\x20API\x20key...','tdx:\x20profile\x20set','2tyFjYi','\x20Profile\x20\x27','Delete\x20a\x20profile','profile:set','profile:create','(cleared)','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','6230ffIgpv','\x0aTip:\x20Use\x20\x27tdx\x20profile\x20use\x20','force','error','\x20API\x20key\x20saved\x20to\x20system\x20keychain\x20(profile:\x20','join','\x27\x20does\x20not\x20exist.\x20Create\x20it?','llm_project','apiKey','API\x20key\x20cannot\x20be\x20empty','email','Profile\x20name\x20cannot\x20be\x20empty','password','\x0aAvailable\x20profiles:','profileName','yellow','database','oauth','tdx.json','message','bold','green','status','\x27\x20requires\x20API\x20key\x20validation.','tdx:\x20profile\x20delete','Operation\x20cancelled','all','name','/app/mp/ak','\x0aSaved\x20to:\x20','Enter\x20profile\x20name:','profile:delete','\x20\x20(no\x20profiles\x20found)','\x0aYou\x20can\x20find\x20your\x20API\x20key\x20at:','\x0aSetup\x20cancelled','text','\x20API\x20key\x20is\x20valid\x20(User:\x20','Invalid\x20format.\x20Use:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','Removed\x20existing\x20profile\x20\x27','default','create','\x0aOperation\x20cancelled','✗\x20Validation\x20failed:\x20','trim','logLevel','\x20API\x20key\x20saved\x20to\x20system\x20keychain','VALID_KEYS','validate','getUserInfo','Setup\x20cancelled','6602790PMLaqV','length','description','us01','includes','Profile\x20was\x20not\x20created.\x20Please\x20try\x20again.','dim','\x20\x20tdx\x20--profile\x20','Enter\x20your\x20TD\x20API\x20key\x20for\x20the\x20new\x20site:','skipExistsCheck','execute','session','Profile\x20name\x20must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore','llm_agent','\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication','637398EXzZiH','\x27\x20updated:\x20','Removal\x20cancelled','801327AlvhaQ','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20use\x20<name>\x20[--default]','Set\x20a\x20profile\x20configuration\x20value','red','confirm','4jyaejp','parent_segment','config','Failed\x20to\x20delete\x20profile:\x20','test','Profile\x20\x27','Create\x20a\x20new\x20profile','Unknown\x20key\x20\x27','\x0aSetting\x20up\x20authentication\x20for\x20site:\x20','ERROR','\x27\x20to\x20remove\x20it\x20first,\x20or\x20re-create\x20with\x20--force.','Enter\x20your\x20TD\x20API\x20key:','1928965XmIatE','profile','5784712PbXaNs','warn','site'];a33_0xf8be=function(){return _0x1ae825;};return a33_0xf8be();}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_0xf307d7 from'prompts';import a33_0x27208b from'chalk';function validateProfileName(_0x4c0939,_0x35a8d5){const _0x2dd9c7=a33_0x1c0b;if(!_0x4c0939||!_0x4c0939[_0x2dd9c7(0x10e)]())return _0x2dd9c7(0x15a);const _0x1a4517=_0x4c0939['trim']();if(!/^[a-zA-Z0-9_-]+$/[_0x2dd9c7(0x130)](_0x1a4517))return _0x2dd9c7(0x121);if(!_0x35a8d5?.[_0x2dd9c7(0x11e)]&&profileExists(_0x1a4517))return _0x2dd9c7(0x131)+_0x1a4517+'\x27\x20already\x20exists.\x20Use\x20\x27tdx\x20profile\x20delete\x20'+_0x1a4517+_0x2dd9c7(0x136);return!![];}async function deleteProfileAndCredentials(_0x5480f5){const _0x55a421=a33_0x1c0b;removeProfileFromUserConfig(_0x5480f5);const _0x3e8a60=await isKeychainAvailable();_0x3e8a60&&await Promise[_0x55a421(0x169)]([deleteKeychainAPIKey(_0x5480f5),deleteOAuthTokens(_0x5480f5)]);}export class ProfileCreateCommand extends BaseCommand{['name']=a33_0x3a7854(0x14c);['description']=a33_0x3a7854(0x132);async['execute'](_0x1d392a){const _0x4f1ed7=a33_0x3a7854,{options:_0x4fc61e,args:_0x9d3d78}=_0x1d392a,_0x248045=!!_0x4fc61e[_0x4f1ed7(0x151)];console['log'](a33_0x27208b[_0x4f1ed7(0x163)]('tdx:\x20profile\x20create'));let _0xde79db;if(_0x9d3d78[_0x4f1ed7(0x116)]>0x0&&_0x9d3d78[0x0]){const _0x2324a9=_0x9d3d78[0x0][_0x4f1ed7(0x10e)]();_0x248045&&profileExists(_0x2324a9)&&(await deleteProfileAndCredentials(_0x2324a9),console[_0x4f1ed7(0x145)](_0x4f1ed7(0x109)+_0x2324a9+'\x27'));const _0xa29351=validateProfileName(_0x2324a9);if(_0xa29351!==!![])return console[_0x4f1ed7(0x152)](a33_0x27208b['red'](_0xa29351)),0x1;_0xde79db=_0x2324a9;}else{const _0x3669bc=await a33_0xf307d7({'type':'text','name':_0x4f1ed7(0x15d),'message':_0x4f1ed7(0x16d),'validate':_0x2f61d1=>validateProfileName(_0x2f61d1,{'skipExistsCheck':_0x248045})});if(!_0x3669bc[_0x4f1ed7(0x15d)])return console[_0x4f1ed7(0x145)]('\x0aSetup\x20cancelled'),0x1;_0xde79db=_0x3669bc[_0x4f1ed7(0x15d)]['trim'](),_0x248045&&profileExists(_0xde79db)&&(await deleteProfileAndCredentials(_0xde79db),console[_0x4f1ed7(0x145)](_0x4f1ed7(0x109)+_0xde79db+'\x27'));}const _0x53988e=await a33_0xf307d7({'type':_0x4f1ed7(0x172),'name':_0x4f1ed7(0x117),'message':'Enter\x20description\x20(optional):'}),_0x580807=_0x53988e['description']?.[_0x4f1ed7(0x10e)]()||undefined,_0x154948=_0x4fc61e[_0x4f1ed7(0x13c)]||_0x4f1ed7(0x118),_0x415d69=await promptSiteSelection(_0x154948,_0xde79db,_0x4f1ed7(0x114));if(!_0x415d69)return 0x1;const _0x32cd46=resolveSite(_0x415d69),_0x27d8b4=await promptAuthMethod();if(!_0x27d8b4)return console[_0x4f1ed7(0x145)](_0x4f1ed7(0x171)),0x1;if(_0x27d8b4===_0x4f1ed7(0x160)){if(_0x580807){const _0x1635d9={'site':_0x32cd46,'description':_0x580807};saveProfileToUserConfig(_0xde79db,_0x1635d9);}const {accountName:_0x3ea1a8}=_0x4fc61e;return await runOAuthLoginFlow(_0x32cd46,_0xde79db,_0x4fc61e[_0x4f1ed7(0x10f)]??LogLevel[_0x4f1ed7(0x135)],{'accountName':_0x3ea1a8}),0x0;}console[_0x4f1ed7(0x145)](_0x4f1ed7(0x134)+_0x32cd46),console['log']('You\x20can\x20find\x20your\x20API\x20key\x20at:'),console[_0x4f1ed7(0x145)]('\x20\x20'+getConsoleUrl(_0x32cd46,_0x4f1ed7(0x16b)));const _0x3e800a=await a33_0xf307d7({'type':'password','name':'apiKey','message':_0x4f1ed7(0x137),'validate':_0x3e1ff5=>{const _0x24e245=_0x4f1ed7;if(!_0x3e1ff5||!_0x3e1ff5['trim']())return _0x24e245(0x158);return!![];}});if(!_0x3e800a['apiKey'])return console[_0x4f1ed7(0x145)](_0x4f1ed7(0x171)),0x1;const _0x52db2f=_0x3e800a['apiKey'];console[_0x4f1ed7(0x145)](_0x4f1ed7(0x146));try{const _0x4bcb01=TDX[_0x4f1ed7(0x10b)]({'site':_0x32cd46,'apiKey':_0x52db2f[_0x4f1ed7(0x10e)](),'logLevel':_0x4fc61e[_0x4f1ed7(0x10f)]??LogLevel['ERROR']}),_0x4b0d46=await _0x4bcb01['jobs'][_0x4f1ed7(0x113)]();console[_0x4f1ed7(0x145)](a33_0x27208b[_0x4f1ed7(0x164)]('✓')+_0x4f1ed7(0x173)+_0x4b0d46[_0x4f1ed7(0x159)]+')');const _0x42f1a4=await isKeychainAvailable();_0x42f1a4?(await saveAPIKeyAsync(_0x52db2f[_0x4f1ed7(0x10e)](),_0x32cd46,_0xde79db),console['log'](a33_0x27208b[_0x4f1ed7(0x164)]('✓')+_0x4f1ed7(0x153)+_0xde79db+')')):(console[_0x4f1ed7(0x13b)](a33_0x27208b[_0x4f1ed7(0x15e)](_0x4f1ed7(0x14e))),console[_0x4f1ed7(0x13b)](a33_0x27208b['yellow']('\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.')));const _0x34a419={'site':_0x32cd46,..._0x580807&&{'description':_0x580807}};return saveProfileToUserConfig(_0xde79db,_0x34a419),console[_0x4f1ed7(0x145)](a33_0x27208b[_0x4f1ed7(0x164)]('✓')+_0x4f1ed7(0x149)+_0xde79db+'\x27\x20created'),console[_0x4f1ed7(0x145)](),console[_0x4f1ed7(0x145)]('You\x20can\x20now\x20use\x20tdx\x20commands\x20with\x20this\x20profile.\x20Try:'),console[_0x4f1ed7(0x145)](_0x4f1ed7(0x11c)+_0xde79db+_0x4f1ed7(0x123)),console['log'](_0x4f1ed7(0x11c)+_0xde79db+'\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases'),0x0;}catch(_0x564195){if(_0x564195 instanceof HTTPClientError&&_0x564195[_0x4f1ed7(0x165)]===0x191)return printAuthError(_0x564195),0x1;return console[_0x4f1ed7(0x152)](a33_0x27208b[_0x4f1ed7(0x12a)](_0x4f1ed7(0x10d)+(_0x564195 instanceof Error?_0x564195[_0x4f1ed7(0x162)]:String(_0x564195)))),console[_0x4f1ed7(0x152)](_0x4f1ed7(0x11a)),0x1;}}}export class ProfileDeleteCommand extends BaseCommand{[a33_0x3a7854(0x16a)]=a33_0x3a7854(0x16e);['description']=a33_0x3a7854(0x14a);['validate'](_0x139dbf){const _0x34c5b8=a33_0x3a7854,{args:_0x1877e0}=_0x139dbf;if(_0x1877e0[_0x34c5b8(0x116)]===0x0)return'Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20delete\x20<name>';return undefined;}async[a33_0x3a7854(0x11f)](_0x56f369){const _0x44724e=a33_0x3a7854,{args:_0x57ab85}=_0x56f369,_0x31ae18=_0x57ab85[0x0];console['log'](a33_0x27208b[_0x44724e(0x163)](_0x44724e(0x167)));if(!profileExists(_0x31ae18)){console[_0x44724e(0x152)](a33_0x27208b[_0x44724e(0x12a)](_0x44724e(0x131)+_0x31ae18+'\x27\x20does\x20not\x20exist.')),console[_0x44724e(0x145)](_0x44724e(0x15c));const _0x5ea84c=listProfiles();if(_0x5ea84c['length']===0x0)console[_0x44724e(0x145)](_0x44724e(0x16f));else for(const _0x297d67 of _0x5ea84c){console['log']('\x20\x20-\x20'+_0x297d67['name']);}return 0x1;}const _0x50e97f=await a33_0xf307d7({'type':'confirm','name':_0x44724e(0x12b),'message':'Are\x20you\x20sure\x20you\x20want\x20to\x20remove\x20profile\x20\x27'+_0x31ae18+'\x27?','initial':![]});if(!_0x50e97f[_0x44724e(0x12b)])return console[_0x44724e(0x145)](_0x44724e(0x126)),0x0;try{await deleteProfileAndCredentials(_0x31ae18),console[_0x44724e(0x145)](a33_0x27208b[_0x44724e(0x164)]('✓')+_0x44724e(0x149)+_0x31ae18+'\x27\x20deleted');}catch(_0x357d88){return console[_0x44724e(0x152)](a33_0x27208b[_0x44724e(0x12a)](_0x44724e(0x12f)+(_0x357d88 instanceof Error?_0x357d88[_0x44724e(0x162)]:String(_0x357d88)))),0x1;}return 0x0;}}export class ProfileSetCommand extends BaseCommand{[a33_0x3a7854(0x16a)]=a33_0x3a7854(0x14b);[a33_0x3a7854(0x117)]=a33_0x3a7854(0x129);static [a33_0x3a7854(0x111)]=[a33_0x3a7854(0x13c),a33_0x3a7854(0x15f),a33_0x3a7854(0x12d),a33_0x3a7854(0x156),a33_0x3a7854(0x122),a33_0x3a7854(0x117)];[a33_0x3a7854(0x112)](_0x485d6c){const _0x3f225a=a33_0x3a7854,{args:_0x24319e,options:_0x5cde32}=_0x485d6c,_0x4577ab=_0x5cde32[_0x3f225a(0x139)]||getActiveProfile();if(!_0x4577ab)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(_0x24319e['length']===0x0)return _0x3f225a(0x144)+ProfileSetCommand[_0x3f225a(0x111)][_0x3f225a(0x154)](',\x20');const _0x34b7c9=_0x24319e[0x0];if(!_0x34b7c9['includes']('='))return _0x3f225a(0x108)+ProfileSetCommand['VALID_KEYS'][_0x3f225a(0x154)](',\x20');const [_0x876e55]=_0x34b7c9['split']('=',0x2);if(!ProfileSetCommand[_0x3f225a(0x111)][_0x3f225a(0x119)](_0x876e55))return _0x3f225a(0x133)+_0x876e55+'\x27.\x0a\x0aValid\x20keys:\x20'+ProfileSetCommand[_0x3f225a(0x111)]['join'](',\x20');return undefined;}async[a33_0x3a7854(0x11f)](_0x1b117c){const _0x2654ac=a33_0x3a7854,{args:_0xa1774d,options:_0x47bb79}=_0x1b117c,_0x4dcfa7=_0x47bb79[_0x2654ac(0x139)]||getActiveProfile(),[_0x5b578c,..._0x2689a9]=_0xa1774d[0x0]['split']('='),_0x5cf387=_0x2689a9[_0x2654ac(0x154)]('=');console[_0x2654ac(0x145)](a33_0x27208b[_0x2654ac(0x163)](_0x2654ac(0x147)));if(!profileExists(_0x4dcfa7)){const _0x35461a=await a33_0xf307d7({'type':'confirm','name':_0x2654ac(0x10b),'message':_0x2654ac(0x131)+_0x4dcfa7+_0x2654ac(0x155),'initial':!![]});if(!_0x35461a['create'])return console[_0x2654ac(0x145)](_0x2654ac(0x168)),0x1;}const _0x3eb3b4=loadProfile(_0x4dcfa7),_0x4e2ce3=_0x3eb3b4?.[_0x2654ac(0x12e)]||{};if(_0x5b578c===_0x2654ac(0x13c)){const _0x1327f2=resolveSite(_0x5cf387);console[_0x2654ac(0x145)](_0x2654ac(0x141)+_0x1327f2+_0x2654ac(0x166)),console['log'](_0x2654ac(0x170)),console[_0x2654ac(0x145)]('\x20\x20'+getConsoleUrl(_0x1327f2,_0x2654ac(0x16b)));const _0x87e6ce=await a33_0xf307d7({'type':_0x2654ac(0x15b),'name':_0x2654ac(0x157),'message':_0x2654ac(0x11d),'validate':_0x2bf8b4=>{const _0x22597f=_0x2654ac;if(!_0x2bf8b4||!_0x2bf8b4[_0x22597f(0x10e)]())return _0x22597f(0x158);return!![];}});if(!_0x87e6ce[_0x2654ac(0x157)])return console['log'](_0x2654ac(0x10c)),0x1;console[_0x2654ac(0x145)](_0x2654ac(0x146));try{const _0x37d738=TDX[_0x2654ac(0x10b)]({'site':_0x1327f2,'apiKey':_0x87e6ce[_0x2654ac(0x157)][_0x2654ac(0x10e)](),'logLevel':_0x47bb79[_0x2654ac(0x10f)]??LogLevel[_0x2654ac(0x135)]}),_0x184cb2=await _0x37d738['jobs'][_0x2654ac(0x113)]();console['log'](a33_0x27208b[_0x2654ac(0x164)]('✓')+'\x20API\x20key\x20is\x20valid\x20(User:\x20'+_0x184cb2[_0x2654ac(0x159)]+')');const _0x41fe0f=await isKeychainAvailable();_0x41fe0f?(await saveAPIKeyAsync(_0x87e6ce[_0x2654ac(0x157)][_0x2654ac(0x10e)](),_0x1327f2,_0x4dcfa7),console['log'](a33_0x27208b[_0x2654ac(0x164)]('✓')+_0x2654ac(0x110))):console[_0x2654ac(0x13b)](a33_0x27208b[_0x2654ac(0x15e)]('⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.')),_0x4e2ce3[_0x2654ac(0x13c)]=_0x1327f2;}catch(_0xe1adb4){if(_0xe1adb4 instanceof HTTPClientError&&_0xe1adb4[_0x2654ac(0x165)]===0x191)return printAuthError(_0xe1adb4),0x1;return console[_0x2654ac(0x152)](a33_0x27208b[_0x2654ac(0x12a)]('✗\x20Validation\x20failed:\x20'+(_0xe1adb4 instanceof Error?_0xe1adb4[_0x2654ac(0x162)]:String(_0xe1adb4)))),console['error']('Site\x20was\x20not\x20changed.'),0x1;}}else _0x4e2ce3[_0x5b578c]=_0x5cf387||undefined;return saveProfileToUserConfig(_0x4dcfa7,_0x4e2ce3),console[_0x2654ac(0x145)](a33_0x27208b[_0x2654ac(0x164)]('✓')+_0x2654ac(0x149)+_0x4dcfa7+_0x2654ac(0x125)+_0x5b578c+'='+(_0x5cf387||_0x2654ac(0x14d))),0x0;}}export class ProfileUseCommand extends BaseCommand{['name']='profile:use';[a33_0x3a7854(0x117)]=a33_0x3a7854(0x140);['validate'](_0x4d109c){const _0xd5ed23=a33_0x3a7854,{args:_0x52701c}=_0x4d109c;if(_0x52701c[_0xd5ed23(0x116)]===0x0)return _0xd5ed23(0x128);return undefined;}async[a33_0x3a7854(0x11f)](_0x469afb){const _0x5c8e97=a33_0x3a7854,{args:_0xfde774,options:_0x1e8f00}=_0x469afb,_0xc9432f=_0xfde774[0x0],_0x1277de=_0x1e8f00[_0x5c8e97(0x10a)];cleanExpiredSessions();if(!profileExists(_0xc9432f)){console['error'](a33_0x27208b['red'](_0x5c8e97(0x131)+_0xc9432f+'\x27\x20does\x20not\x20exist.')),console[_0x5c8e97(0x145)](_0x5c8e97(0x15c));const _0x5b54a3=listProfiles();if(_0x5b54a3[_0x5c8e97(0x116)]===0x0)console[_0x5c8e97(0x145)](_0x5c8e97(0x16f));else for(const _0x3084bb of _0x5b54a3){console['log'](_0x5c8e97(0x143)+_0x3084bb[_0x5c8e97(0x16a)]);}return 0x1;}if(_0x1277de){const _0xaaf122=a33_0x3549ac[_0x5c8e97(0x154)](getConfigDir(),_0x5c8e97(0x161));return saveActiveProfileToUserConfig(_0xc9432f),console[_0x5c8e97(0x145)]('Default\x20profile\x20set\x20to:\x20'+a33_0x27208b[_0x5c8e97(0x164)](_0xc9432f)),console[_0x5c8e97(0x145)](a33_0x27208b[_0x5c8e97(0x11b)](_0x5c8e97(0x16c)+_0xaaf122)),0x0;}const _0x5f3915=getSessionID(_0x1e8f00[_0x5c8e97(0x120)]);return saveSessionContext({'profile':_0xc9432f},_0x1e8f00[_0x5c8e97(0x120)]),console[_0x5c8e97(0x145)](_0x5c8e97(0x142)+a33_0x27208b[_0x5c8e97(0x164)](_0xc9432f)+'\x20'+a33_0x27208b['dim']('(session:\x20'+_0x5f3915+')')),console[_0x5c8e97(0x145)](a33_0x27208b[_0x5c8e97(0x11b)](_0x5c8e97(0x150)+_0xc9432f+_0x5c8e97(0x13f))),0x0;}}
@@ -1 +1 @@
1
- const a34_0x1df6fe=a34_0x4996;(function(_0x3df292,_0x5c5553){const _0x3e48da=a34_0x4996,_0x4a95d9=_0x3df292();while(!![]){try{const _0x34fca0=parseInt(_0x3e48da(0x150))/0x1*(-parseInt(_0x3e48da(0x152))/0x2)+parseInt(_0x3e48da(0x154))/0x3*(parseInt(_0x3e48da(0x155))/0x4)+parseInt(_0x3e48da(0x141))/0x5*(-parseInt(_0x3e48da(0x146))/0x6)+-parseInt(_0x3e48da(0x14b))/0x7*(-parseInt(_0x3e48da(0x14f))/0x8)+parseInt(_0x3e48da(0x149))/0x9*(-parseInt(_0x3e48da(0x15c))/0xa)+-parseInt(_0x3e48da(0x157))/0xb*(parseInt(_0x3e48da(0x14d))/0xc)+parseInt(_0x3e48da(0x151))/0xd;if(_0x34fca0===_0x5c5553)break;else _0x4a95d9['push'](_0x4a95d9['shift']());}catch(_0x47823c){_0x4a95d9['push'](_0x4a95d9['shift']());}}}(a34_0x3848,0xdd2ba));import{BaseCommand}from'./command.js';import{listProfiles,getActiveProfile,getProfileParams}from'../core/profile.js';import{handleSDKOutput,isStructuredFormat}from'../core/command-output.js';function a34_0x3848(){const _0x2c51e2=['24aadgIp','error','64tmusUA','1828ilIwzv','22536631QFNryB','766YipWxS','\x20\x20Global:\x20~/.config/tdx/tdx.json','27858VasgGf','216kRStsu','message','5032841kRwRjp','List\x20all\x20available\x20profiles','dim','name','Error:\x20','930220rdnYjl','profiles','5FBsBKR','log','\x20\x20Local:\x20\x20(project\x20folder)/tdx.json','config','No\x20profiles\x20found.\x20Define\x20profiles\x20in\x20tdx.json:\x0a','5447646OHLgRp','map','description','9qMOJgH','site','1126153HlgEKM','green'];a34_0x3848=function(){return _0x2c51e2;};return a34_0x3848();}import a34_0x398dfe from'chalk';function a34_0x4996(_0x24d597,_0x36a401){_0x24d597=_0x24d597-0x141;const _0x384816=a34_0x3848();let _0x4996da=_0x384816[_0x24d597];return _0x4996da;}export class ProfilesCommand extends BaseCommand{[a34_0x1df6fe(0x15a)]=a34_0x1df6fe(0x15d);[a34_0x1df6fe(0x148)]=a34_0x1df6fe(0x158);async['execute'](_0x2756e9){const _0x4bca0a=a34_0x1df6fe,{options:_0x445d2d}=_0x2756e9;try{const _0x46e1ec=listProfiles(),_0x21d43e=getActiveProfile();if(_0x46e1ec['length']===0x0)return console[_0x4bca0a(0x142)](_0x4bca0a(0x145)),console[_0x4bca0a(0x142)](_0x4bca0a(0x143)),console['log'](_0x4bca0a(0x153)),0x0;const _0x345f71=_0x46e1ec[_0x4bca0a(0x147)](_0x1264e9=>{const _0x38ea7f=_0x4bca0a,_0x82b024=_0x1264e9[_0x38ea7f(0x15a)]===_0x21d43e,_0x560ef9=getProfileParams(_0x1264e9[_0x38ea7f(0x144)]);return{'name':_0x1264e9[_0x38ea7f(0x15a)],'active':_0x82b024,'scope':_0x1264e9['scope'],'description':_0x1264e9[_0x38ea7f(0x144)][_0x38ea7f(0x148)]||'','params':_0x560ef9};});if(isStructuredFormat(_0x445d2d))await handleSDKOutput(_0x345f71,_0x445d2d);else for(const _0x53a226 of _0x46e1ec){const _0x1193d5=_0x53a226['name']===_0x21d43e?a34_0x398dfe[_0x4bca0a(0x14c)]('\x20✓'):'',_0x4232e4=_0x53a226[_0x4bca0a(0x144)][_0x4bca0a(0x14a)]?a34_0x398dfe[_0x4bca0a(0x159)]('\x20'+_0x53a226['config'][_0x4bca0a(0x14a)]):'',_0x2e51c5=_0x53a226[_0x4bca0a(0x144)][_0x4bca0a(0x148)]?a34_0x398dfe[_0x4bca0a(0x159)]('\x20\x20'+_0x53a226[_0x4bca0a(0x144)]['description']):'';console[_0x4bca0a(0x142)]('👤\x20'+_0x53a226[_0x4bca0a(0x15a)]+_0x1193d5+_0x4232e4+_0x2e51c5);}return 0x0;}catch(_0x5081a6){return _0x5081a6 instanceof Error&&console[_0x4bca0a(0x14e)](_0x4bca0a(0x15b)+_0x5081a6[_0x4bca0a(0x156)]),0x1;}}}
1
+ const a34_0x28a292=a34_0x41ba;(function(_0x305d81,_0x1c1aa7){const _0x103406=a34_0x41ba,_0x1dfd48=_0x305d81();while(!![]){try{const _0x506822=parseInt(_0x103406(0x1f3))/0x1+-parseInt(_0x103406(0x1f9))/0x2*(parseInt(_0x103406(0x1f1))/0x3)+parseInt(_0x103406(0x1ee))/0x4+parseInt(_0x103406(0x1f0))/0x5+-parseInt(_0x103406(0x1ed))/0x6*(parseInt(_0x103406(0x201))/0x7)+parseInt(_0x103406(0x1e8))/0x8*(parseInt(_0x103406(0x1f5))/0x9)+parseInt(_0x103406(0x1eb))/0xa*(parseInt(_0x103406(0x1f2))/0xb);if(_0x506822===_0x1c1aa7)break;else _0x1dfd48['push'](_0x1dfd48['shift']());}catch(_0xc30d73){_0x1dfd48['push'](_0x1dfd48['shift']());}}}(a34_0x584e,0x70b5e));import{BaseCommand}from'./command.js';import{listProfiles,getActiveProfile,getProfileParams}from'../core/profile.js';function a34_0x41ba(_0xe1add9,_0xec42a){_0xe1add9=_0xe1add9-0x1e6;const _0x584ee4=a34_0x584e();let _0x41ba3b=_0x584ee4[_0xe1add9];return _0x41ba3b;}function a34_0x584e(){const _0x2fcf17=['40tNWQyR','\x20\x20Global:\x20~/.config/tdx/tdx.json','6420kHopRM','2514648ZpBHrv','config','606830LMbnSU','181767HLJpmQ','1519738MncgCa','107016lVAOCW','List\x20all\x20available\x20profiles','9iQDsGi','length','map','👤\x20','28mtSSUG','name','No\x20profiles\x20found.\x20Define\x20profiles\x20in\x20tdx.json:\x0a','description','green','\x20\x20Local:\x20\x20(project\x20folder)/tdx.json','Error:\x20','site','2317sEpufp','message','log','2035216azOofd','scope','execute'];a34_0x584e=function(){return _0x2fcf17;};return a34_0x584e();}import{handleSDKOutput,isStructuredFormat}from'../core/command-output.js';import a34_0x46fe49 from'chalk';export class ProfilesCommand extends BaseCommand{[a34_0x28a292(0x1fa)]='profiles';['description']=a34_0x28a292(0x1f4);async[a34_0x28a292(0x1ea)](_0x20aedf){const _0x204a89=a34_0x28a292,{options:_0x43a3ce}=_0x20aedf;try{const _0x10ce81=listProfiles(),_0x46f5cc=getActiveProfile();if(_0x10ce81[_0x204a89(0x1f6)]===0x0)return console[_0x204a89(0x1e7)](_0x204a89(0x1fb)),console[_0x204a89(0x1e7)](_0x204a89(0x1fe)),console[_0x204a89(0x1e7)](_0x204a89(0x1ec)),0x0;const _0x4ef4fd=_0x10ce81[_0x204a89(0x1f7)](_0xb5d730=>{const _0x2568fa=_0x204a89,_0x13aaeb=_0xb5d730[_0x2568fa(0x1fa)]===_0x46f5cc,_0x557d24=getProfileParams(_0xb5d730['config']);return{'name':_0xb5d730[_0x2568fa(0x1fa)],'active':_0x13aaeb,'scope':_0xb5d730[_0x2568fa(0x1e9)],'description':_0xb5d730[_0x2568fa(0x1ef)][_0x2568fa(0x1fc)]||'','params':_0x557d24};});if(isStructuredFormat(_0x43a3ce))await handleSDKOutput(_0x4ef4fd,_0x43a3ce);else for(const _0x34fd93 of _0x10ce81){const _0x929a8d=_0x34fd93[_0x204a89(0x1fa)]===_0x46f5cc?a34_0x46fe49[_0x204a89(0x1fd)]('\x20✓'):'',_0x1ca588=_0x34fd93[_0x204a89(0x1ef)][_0x204a89(0x200)]?a34_0x46fe49['dim']('\x20'+_0x34fd93[_0x204a89(0x1ef)][_0x204a89(0x200)]):'',_0x5ac1a0=_0x34fd93[_0x204a89(0x1ef)][_0x204a89(0x1fc)]?a34_0x46fe49['dim']('\x20\x20'+_0x34fd93['config'][_0x204a89(0x1fc)]):'';console[_0x204a89(0x1e7)](_0x204a89(0x1f8)+_0x34fd93[_0x204a89(0x1fa)]+_0x929a8d+_0x1ca588+_0x5ac1a0);}return 0x0;}catch(_0x4aaaaf){return _0x4aaaaf instanceof Error&&console['error'](_0x204a89(0x1ff)+_0x4aaaaf[_0x204a89(0x1e6)]),0x1;}}}
@@ -1 +1 @@
1
- const a35_0xf937c7=a35_0x526d;function a35_0x526d(_0x355c7f,_0x4af851){_0x355c7f=_0x355c7f-0x78;const _0xbc2fe5=a35_0xbc2f();let _0x526da3=_0xbc2fe5[_0x355c7f];return _0x526da3;}(function(_0x136e96,_0x24e227){const _0x1867f2=a35_0x526d,_0x55379d=_0x136e96();while(!![]){try{const _0x505c0c=parseInt(_0x1867f2(0x92))/0x1+-parseInt(_0x1867f2(0x7e))/0x2*(-parseInt(_0x1867f2(0x7b))/0x3)+-parseInt(_0x1867f2(0x80))/0x4+parseInt(_0x1867f2(0x8d))/0x5*(parseInt(_0x1867f2(0x9b))/0x6)+-parseInt(_0x1867f2(0x82))/0x7+-parseInt(_0x1867f2(0x8b))/0x8*(-parseInt(_0x1867f2(0x8c))/0x9)+parseInt(_0x1867f2(0x99))/0xa*(-parseInt(_0x1867f2(0x8a))/0xb);if(_0x505c0c===_0x24e227)break;else _0x55379d['push'](_0x55379d['shift']());}catch(_0x659aec){_0x55379d['push'](_0x55379d['shift']());}}}(a35_0xbc2f,0xdaa5e));import{BaseCommand}from'./command.js';function a35_0xbc2f(){const _0x813bb1=['options','Schema:\x20','894486uAVTwg','description','2754516jmwQtz','data','10181416raajqz','push','catalog','Query\x20completed:\x20Processed\x20','setJobId','output','...','originalMessage','528dOWKnu','3656KWgtBf','21330iSzgfq','2732910dfFbLe','setPhase','SQL:\x20','Cannot\x20specify\x20both\x20SQL\x20argument\x20and\x20--file\x20option','Statement\x20','134513esuQts','join','state','length','stats','totalSplits','query','221050dkrNSr','\x0aAll\x20results\x20saved\x20to\x20','12hQHfXA','No\x20SQL\x20provided','Error:\x20','verbose','Usage:\x20tdx\x20query\x20\x22SELECT\x20*\x20FROM\x20table\x22\x0a\x20\x20\x20or:\x20tdx\x20query\x20query.sql\x0a\x20\x20\x20or:\x20echo\x20\x22SELECT\x201\x22\x20|\x20tdx\x20query\x20-\x0a\x0aRun\x20\x27tdx\x20query\x20--help\x27\x20for\x20more\x20options','error','in\x20','message','elapsedTimeMillis','file','\x20-\x20','Run\x20Trino\x20queries\x20(streaming)','name','information_schema','\x20rows\x20','setExtra','processedRows','12zqxmpk'];a35_0xbc2f=function(){return _0x813bb1;};return a35_0xbc2f();}import{SDKError}from'../sdk/index.js';import{handleQueryOutput,formatQueryOutput,resolveOutputOptions}from'../core/command-output.js';import{readSqlStatementsFromFile,readSqlStatementsFromStdin,splitSqlStatements,isSqlFilePath}from'../sdk/query/sql-parser.js';import{writeFileSync}from'fs';import{withProgressSpinner,formatElapsed}from'../utils/spinner.js';import{formatRows}from'../sdk/util/formatters.js';export class QueryCommand extends BaseCommand{[a35_0xf937c7(0xa7)]=a35_0xf937c7(0x98);[a35_0xf937c7(0x7f)]=a35_0xf937c7(0xa6);async['execute'](_0x375610){const _0x4d2077=a35_0xf937c7,{options:_0x11a2e6,args:_0x4846cc,tdx:_0x26cd59}=_0x375610,_0x36bffe={..._0x11a2e6,'limitStructuredFormats':!![]},_0x8c849=_0x4846cc[0x0],_0x38e71f=_0x11a2e6[_0x4d2077(0xa4)];let _0x251ec8;try{if(_0x38e71f)_0x251ec8=readSqlStatementsFromFile(_0x38e71f);else{if(_0x8c849==='-')_0x251ec8=await readSqlStatementsFromStdin();else{if(_0x8c849&&isSqlFilePath(_0x8c849))_0x251ec8=readSqlStatementsFromFile(_0x8c849);else{if(_0x8c849)_0x251ec8=splitSqlStatements(_0x8c849);else throw new Error(_0x4d2077(0x9c));}}}}catch(_0x2dbe8d){return console[_0x4d2077(0xa0)](_0x4d2077(0x9d)+_0x2dbe8d['message']),0x1;}const _0xa4726c=_0x11a2e6['database']||_0x4d2077(0xa8),_0x596244=_0x11a2e6[_0x4d2077(0x84)];try{const _0x2287b4=[],_0x34387a=!!_0x11a2e6[_0x4d2077(0x87)];for(let _0x3761dc=0x0;_0x3761dc<_0x251ec8[_0x4d2077(0x95)];_0x3761dc++){const _0x430372=_0x251ec8[_0x3761dc],_0x500d1f=_0x3761dc+0x1,_0x3f6194=_0x251ec8[_0x4d2077(0x95)],_0x2c03fe=_0x3f6194>0x1;_0x11a2e6['verbose']&&(console[_0x4d2077(0xa0)]('\x0a'+(_0x2c03fe?_0x4d2077(0x91)+_0x500d1f+'/'+_0x3f6194+':':'')),console[_0x4d2077(0xa0)]('Site:\x20'+_0x11a2e6['site']),console[_0x4d2077(0xa0)]('Catalog:\x20'+(_0x596244||'td')),console[_0x4d2077(0xa0)](_0x4d2077(0x7d)+_0xa4726c),console[_0x4d2077(0xa0)](_0x4d2077(0x8f)+_0x430372));const _0x508e07=_0x2c03fe?'Executing\x20statement\x20'+_0x500d1f+'/'+_0x3f6194+_0x4d2077(0x88):'Executing\x20query...';try{const _0x5caa44=await withProgressSpinner(_0x508e07,async _0x2e6659=>{const _0x38645e=await _0x26cd59['query']['execute'](_0x430372,{'catalog':_0x596244,'schema':_0xa4726c,'onJobId':_0x3f9bc8=>{const _0x171a82=a35_0x526d;_0x2e6659[_0x171a82(0x86)](_0x3f9bc8);},'onProgress':_0x3aa09d=>{const _0x49e73b=a35_0x526d;_0x2e6659[_0x49e73b(0x8e)]('Executing\x20query\x20['+_0x3aa09d[_0x49e73b(0x94)]+']'),_0x2e6659[_0x49e73b(0x79)](formatRows(_0x3aa09d[_0x49e73b(0x7a)])+_0x49e73b(0x78)+_0x3aa09d['completedSplits']+'/'+_0x3aa09d[_0x49e73b(0x97)]+'\x20splits');}});return _0x38645e;},{'verbose':_0x11a2e6[_0x4d2077(0x9e)]}),_0x40443d=_0x5caa44[_0x4d2077(0x81)],_0x528a17=_0x40443d['jobId']?'\x20[Job\x20ID:\x20'+_0x40443d['jobId']+']':'',_0x50648d=_0x2c03fe?'Statement\x20'+_0x500d1f+'/'+_0x3f6194+_0x4d2077(0xa5):'';console[_0x4d2077(0xa0)]('✔\x20'+_0x50648d+_0x4d2077(0x85)+formatRows(_0x40443d[_0x4d2077(0x96)][_0x4d2077(0x7a)])+'\x20rows\x20'+(_0x4d2077(0xa1)+formatElapsed(_0x40443d[_0x4d2077(0x96)][_0x4d2077(0xa3)])+_0x528a17));if(_0x2c03fe&&_0x34387a){const _0x4247db=resolveOutputOptions(_0x36bffe),_0xab848a=await formatQueryOutput(_0x40443d,_0x4247db);_0x2287b4[_0x4d2077(0x83)](_0xab848a);}else await handleQueryOutput(_0x40443d,_0x36bffe);}catch(_0x3609d1){const _0x812b3d=_0x2c03fe?'Statement\x20'+_0x500d1f+'/'+_0x3f6194+':\x0a':'',_0x117333=_0x3609d1 instanceof SDKError?_0x3609d1[_0x4d2077(0x89)]:_0x3609d1[_0x4d2077(0xa2)];return console['error'](''+_0x812b3d+_0x117333),0x1;}}if(_0x251ec8[_0x4d2077(0x95)]>0x1&&_0x34387a&&_0x2287b4[_0x4d2077(0x95)]>0x0){const _0x5d0074=_0x2287b4[_0x4d2077(0x93)]('\x0a');writeFileSync(_0x11a2e6['output'],_0x5d0074),console['error'](_0x4d2077(0x9a)+_0x11a2e6['output']);}return 0x0;}catch(_0x1953d7){throw _0x1953d7;}}['validate'](_0xae2fb4){const _0x25c908=a35_0xf937c7,_0x226471=_0xae2fb4['args'][0x0],_0x5c97ef=_0xae2fb4[_0x25c908(0x7c)][_0x25c908(0xa4)];if(!_0x226471&&!_0x5c97ef)return _0x25c908(0x9f);if(_0x226471&&_0x5c97ef)return _0x25c908(0x90);return undefined;}}
1
+ const a35_0x179c72=a35_0x2bd7;function a35_0x5626(){const _0x4ea3bc=['information_schema','41152uAIHmc','setPhase','5291048HYeocV','4690704FQByPx','SQL:\x20','options','\x20[Job\x20ID:\x20','3975145hHZsWz','Error:\x20','totalSplits','Executing\x20query\x20[','Cannot\x20specify\x20both\x20SQL\x20argument\x20and\x20--file\x20option','1128631Xtfysz','args','error','execute','push','jobId','site','description','catalog','33843lgRPML','elapsedTimeMillis','Executing\x20statement\x20','output','\x20splits','No\x20SQL\x20provided','in\x20','message','name','Statement\x20','\x20rows\x20','Site:\x20','stats','query','file','19233756vOVggp','Catalog:\x20','join','2CesIxL','processedRows','\x0aAll\x20results\x20saved\x20to\x20','completedSplits','Schema:\x20','originalMessage','Run\x20Trino\x20queries\x20(streaming)','setJobId','292joeaHV','verbose','\x20-\x20'];a35_0x5626=function(){return _0x4ea3bc;};return a35_0x5626();}(function(_0x5a4194,_0x50b5b8){const _0x4d1a5f=a35_0x2bd7,_0x4ff950=_0x5a4194();while(!![]){try{const _0x23b581=-parseInt(_0x4d1a5f(0x1d8))/0x1*(-parseInt(_0x4d1a5f(0x1b1))/0x2)+parseInt(_0x4d1a5f(0x1c6))/0x3*(parseInt(_0x4d1a5f(0x1ad))/0x4)+-parseInt(_0x4d1a5f(0x1b8))/0x5+-parseInt(_0x4d1a5f(0x1b4))/0x6+-parseInt(_0x4d1a5f(0x1bd))/0x7+-parseInt(_0x4d1a5f(0x1b3))/0x8+parseInt(_0x4d1a5f(0x1d5))/0x9;if(_0x23b581===_0x50b5b8)break;else _0x4ff950['push'](_0x4ff950['shift']());}catch(_0x2c5c00){_0x4ff950['push'](_0x4ff950['shift']());}}}(a35_0x5626,0x930d2));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';import{handleQueryOutput,formatQueryOutput,resolveOutputOptions}from'../core/command-output.js';function a35_0x2bd7(_0x2b0f28,_0x5007f7){_0x2b0f28=_0x2b0f28-0x1a9;const _0x56261d=a35_0x5626();let _0x2bd7ff=_0x56261d[_0x2b0f28];return _0x2bd7ff;}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_0x179c72(0x1ce)]=a35_0x179c72(0x1d3);[a35_0x179c72(0x1c4)]=a35_0x179c72(0x1ab);async[a35_0x179c72(0x1c0)](_0x128dec){const _0x34d8c0=a35_0x179c72,{options:_0x34dbd5,args:_0x1efc4c,tdx:_0x15f181}=_0x128dec,_0x19fbf4={..._0x34dbd5,'limitStructuredFormats':!![]},_0x9b6f2e=_0x1efc4c[0x0],_0x4499e5=_0x34dbd5[_0x34d8c0(0x1d4)];let _0x42edd1;try{if(_0x4499e5)_0x42edd1=readSqlStatementsFromFile(_0x4499e5);else{if(_0x9b6f2e==='-')_0x42edd1=await readSqlStatementsFromStdin();else{if(_0x9b6f2e&&isSqlFilePath(_0x9b6f2e))_0x42edd1=readSqlStatementsFromFile(_0x9b6f2e);else{if(_0x9b6f2e)_0x42edd1=splitSqlStatements(_0x9b6f2e);else throw new Error(_0x34d8c0(0x1cb));}}}}catch(_0x16c2a4){return console[_0x34d8c0(0x1bf)](_0x34d8c0(0x1b9)+_0x16c2a4[_0x34d8c0(0x1cd)]),0x1;}const _0x248f15=_0x34dbd5['database']||_0x34d8c0(0x1b0),_0x29358d=_0x34dbd5[_0x34d8c0(0x1c5)];try{const _0x5ed50b=[],_0x586723=!!_0x34dbd5[_0x34d8c0(0x1c9)];for(let _0x205b62=0x0;_0x205b62<_0x42edd1['length'];_0x205b62++){const _0x5ab269=_0x42edd1[_0x205b62],_0x56c6d1=_0x205b62+0x1,_0x147918=_0x42edd1['length'],_0x12ffcd=_0x147918>0x1;_0x34dbd5[_0x34d8c0(0x1ae)]&&(console[_0x34d8c0(0x1bf)]('\x0a'+(_0x12ffcd?_0x34d8c0(0x1cf)+_0x56c6d1+'/'+_0x147918+':':'')),console['error'](_0x34d8c0(0x1d1)+_0x34dbd5[_0x34d8c0(0x1c3)]),console[_0x34d8c0(0x1bf)](_0x34d8c0(0x1d6)+(_0x29358d||'td')),console['error'](_0x34d8c0(0x1a9)+_0x248f15),console['error'](_0x34d8c0(0x1b5)+_0x5ab269));const _0x2dee96=_0x12ffcd?_0x34d8c0(0x1c8)+_0x56c6d1+'/'+_0x147918+'...':'Executing\x20query...';try{const _0x4ee3da=await withProgressSpinner(_0x2dee96,async _0x43e33c=>{const _0x1fc662=_0x34d8c0,_0x4a7d4c=await _0x15f181[_0x1fc662(0x1d3)]['execute'](_0x5ab269,{'catalog':_0x29358d,'schema':_0x248f15,'onJobId':_0x4f08d8=>{const _0x42cd88=_0x1fc662;_0x43e33c[_0x42cd88(0x1ac)](_0x4f08d8);},'onProgress':_0x2d8d2b=>{const _0x19b2c1=_0x1fc662;_0x43e33c[_0x19b2c1(0x1b2)](_0x19b2c1(0x1bb)+_0x2d8d2b['state']+']'),_0x43e33c['setExtra'](formatRows(_0x2d8d2b[_0x19b2c1(0x1d9)])+_0x19b2c1(0x1d0)+_0x2d8d2b[_0x19b2c1(0x1db)]+'/'+_0x2d8d2b[_0x19b2c1(0x1ba)]+_0x19b2c1(0x1ca));}});return _0x4a7d4c;},{'verbose':_0x34dbd5[_0x34d8c0(0x1ae)]}),_0x508c9d=_0x4ee3da['data'],_0x4f25b3=_0x508c9d[_0x34d8c0(0x1c2)]?_0x34d8c0(0x1b7)+_0x508c9d[_0x34d8c0(0x1c2)]+']':'',_0x43c4c6=_0x12ffcd?_0x34d8c0(0x1cf)+_0x56c6d1+'/'+_0x147918+_0x34d8c0(0x1af):'';console['error']('✔\x20'+_0x43c4c6+'Query\x20completed:\x20Processed\x20'+formatRows(_0x508c9d[_0x34d8c0(0x1d2)]['processedRows'])+_0x34d8c0(0x1d0)+(_0x34d8c0(0x1cc)+formatElapsed(_0x508c9d[_0x34d8c0(0x1d2)][_0x34d8c0(0x1c7)])+_0x4f25b3));if(_0x12ffcd&&_0x586723){const _0x4dde1a=resolveOutputOptions(_0x19fbf4),_0x149efa=await formatQueryOutput(_0x508c9d,_0x4dde1a);_0x5ed50b[_0x34d8c0(0x1c1)](_0x149efa);}else await handleQueryOutput(_0x508c9d,_0x19fbf4);}catch(_0x20db7b){const _0x4e9938=_0x12ffcd?'Statement\x20'+_0x56c6d1+'/'+_0x147918+':\x0a':'',_0x7ceb8d=_0x20db7b instanceof SDKError?_0x20db7b[_0x34d8c0(0x1aa)]:_0x20db7b[_0x34d8c0(0x1cd)];return console[_0x34d8c0(0x1bf)](''+_0x4e9938+_0x7ceb8d),0x1;}}if(_0x42edd1['length']>0x1&&_0x586723&&_0x5ed50b['length']>0x0){const _0x269f58=_0x5ed50b[_0x34d8c0(0x1d7)]('\x0a');writeFileSync(_0x34dbd5[_0x34d8c0(0x1c9)],_0x269f58),console['error'](_0x34d8c0(0x1da)+_0x34dbd5[_0x34d8c0(0x1c9)]);}return 0x0;}catch(_0x5c24b8){throw _0x5c24b8;}}['validate'](_0xfcb562){const _0x5b5067=a35_0x179c72,_0x1b8a2b=_0xfcb562[_0x5b5067(0x1be)][0x0],_0x5b5b09=_0xfcb562[_0x5b5067(0x1b6)]['file'];if(!_0x1b8a2b&&!_0x5b5b09)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(_0x1b8a2b&&_0x5b5b09)return _0x5b5067(0x1bc);return undefined;}}
@@ -1 +1 @@
1
- const a36_0xf796c6=a36_0x3fc7;(function(_0x5e199d,_0x3ffcfe){const _0x522f1e=a36_0x3fc7,_0x33d022=_0x5e199d();while(!![]){try{const _0x2c78b6=parseInt(_0x522f1e(0x12e))/0x1*(-parseInt(_0x522f1e(0x13f))/0x2)+parseInt(_0x522f1e(0x130))/0x3+parseInt(_0x522f1e(0x178))/0x4*(-parseInt(_0x522f1e(0x188))/0x5)+parseInt(_0x522f1e(0x108))/0x6*(-parseInt(_0x522f1e(0x113))/0x7)+parseInt(_0x522f1e(0x10f))/0x8+-parseInt(_0x522f1e(0x135))/0x9*(-parseInt(_0x522f1e(0x126))/0xa)+-parseInt(_0x522f1e(0x12f))/0xb*(-parseInt(_0x522f1e(0x161))/0xc);if(_0x2c78b6===_0x3ffcfe)break;else _0x33d022['push'](_0x33d022['shift']());}catch(_0x4193e7){_0x33d022['push'](_0x33d022['shift']());}}}(a36_0x28d7,0x7188c));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,handleSingleObjectOutput,writeOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import{confirm}from'../utils/prompt.js';function a36_0x3fc7(_0x13d629,_0x1a6e7a){_0x13d629=_0x13d629-0x105;const _0x28d79c=a36_0x28d7();let _0x3fc7d8=_0x28d79c[_0x13d629];return _0x3fc7d8;}import{readFileSync}from'fs';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import{getConsoleUrl}from'../sdk/client/endpoints.js';import{hyperlink}from'../sdk/util/formatters.js';import a36_0x16220f from'chalk';function formatRelativeTime(_0x4ea1f2){const _0x513214=a36_0x3fc7,_0x230171=new Date(_0x4ea1f2),_0x35517a=new Date(),_0xf2e572=_0x230171[_0x513214(0x18f)]()-_0x35517a['getTime'](),_0x1afa43=Math['abs'](_0xf2e572)/0x3e8,_0x2840c2=_0xf2e572<0x0;if(_0x1afa43<0x3c)return _0x2840c2?_0x513214(0x12d):'soon';else{if(_0x1afa43<0xe10){const _0x138767=Math[_0x513214(0x16b)](_0x1afa43/0x3c);return _0x2840c2?_0x138767+_0x513214(0x116):'in\x20'+_0x138767+'m';}else{if(_0x1afa43<0x15180){const _0x1fd650=Math[_0x513214(0x16b)](_0x1afa43/0xe10);return _0x2840c2?_0x1fd650+_0x513214(0x183):_0x513214(0x14b)+_0x1fd650+'h';}else{if(_0x1afa43<0x93a80){const _0x31a1dc=Math[_0x513214(0x16b)](_0x1afa43/0x15180);return _0x2840c2?_0x31a1dc+_0x513214(0x139):'in\x20'+_0x31a1dc+'d';}else return _0x230171[_0x513214(0x110)]();}}}}function a36_0x28d7(){const _0x226c32=['167772dgEoTa','schedule:show','length','created_at','Schedule\x20created:\x20','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]','executing_user_id','\x20created','count','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20history\x20<name>\x20[--from\x20<n>]\x20[--to\x20<n>]','round','/app/queries/editor?queryId=','\x20execution','queryUrl','Updating\x20schedule...','end_at','\x20\x20Database:\x20','Failed\x20to\x20read\x20file:\x20','At\x20least\x20one\x20option\x20must\x20be\x20provided\x20to\x20update','args','join','num','Delete\x20a\x20scheduled\x20query','679676JATgUO','delete','retryLimit','\x20(showing\x20','priority','engineVersion','keys','\x20job','run','entries','Found\x20','h\x20ago','nextRun','\x20\x20Time:\x20','schedules','max','15alstPU','site','Show\x20schedule\x20details','INVALID_ARGUMENT','verbose','Getting\x20schedule\x20history...','schedule:delete','getTime','table','next_run_at','\x20matching\x20\x22','Schedule\x20updated:\x20','type','status','repeat','1234290txjdJL','show','Database\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]','queries','schedule:run','start_at','yes','2420984tXDYbO','toLocaleDateString','Schedule\x20run\x20submitted:\x20','trim','21LkkZSu','statusIcon','schedule:list','m\x20ago','padEnd','Listing\x20scheduled\x20queries...','history','Schedule\x20deleted:\x20','success','List\x20scheduled\x20queries','format','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20show\x20<name>','utf-8','json','schedule:update','from','update','cyan','timezone','250sYLTTE','time','ended_at','\x20\x20Type:\x20','create','trino','map','just\x20now','2JYFbzS','737alOJOK','632892wiEmQN','jsonl','Showing\x20first\x20','log','error','244710ZmBqCv','last_job','query','scheduled_at','d\x20ago','\x22...','result','tsv','data','retry_limit','538126ZpZqLH','Creating\x20schedule...','never','📅\x20','jobs','Creating\x20schedule:\x20','delay','database','Getting\x20schedule\x20details...','Searching\x20scheduled\x20queries\x20matching\x20\x22','limit','cron','in\x20','dim','\x20schedules','schedule:create','time_zone','red','pagination','...','name','engine_version','ies','Cancelled','(unnamed)','file','description','lastRun','validate','\x20\x20Timezone:\x20','list','execute','output','No\x20scheduled\x20queries\x20found'];a36_0x28d7=function(){return _0x226c32;};return a36_0x28d7();}export class ScheduleListCommand extends BaseCommand{[a36_0xf796c6(0x153)]=a36_0xf796c6(0x115);[a36_0xf796c6(0x159)]=a36_0xf796c6(0x11c);async['execute'](_0x54e0a1){const _0x4f7cd9=a36_0xf796c6,{options:_0x534d30,args:_0x2943a5,tdx:_0x34094e}=_0x54e0a1,_0x16aec8=resolveLimit(_0x534d30[_0x4f7cd9(0x149)],DEFAULT_DISPLAY_LIMIT),_0x4355d1=_0x2943a5[0x0],_0x81072=_0x4355d1?_0x4f7cd9(0x148)+_0x4355d1+_0x4f7cd9(0x13a):_0x4f7cd9(0x118),_0x477576=await withSpinner(_0x81072,()=>_0x34094e[_0x4f7cd9(0x186)]['listQueries']({'limit':_0x16aec8,'scheduled':!![],'pattern':_0x4355d1}),{'verbose':_0x534d30['verbose']}),_0x3ffd04=_0x477576[_0x4f7cd9(0x13d)][_0x4f7cd9(0x10b)],_0x2d9bb5=_0x477576[_0x4f7cd9(0x13d)][_0x4f7cd9(0x151)]['has_next_page'],_0x39224f=_0x4355d1?_0x4f7cd9(0x192)+_0x4355d1+'\x22':'';_0x2d9bb5?console[_0x4f7cd9(0x134)](_0x4f7cd9(0x132)+_0x3ffd04[_0x4f7cd9(0x163)]+_0x4f7cd9(0x14d)+_0x39224f+'\x20(use\x20--limit\x20to\x20see\x20more)'):console['error'](_0x4f7cd9(0x182)+_0x3ffd04['length']+'\x20scheduled\x20quer'+(_0x3ffd04[_0x4f7cd9(0x163)]!==0x1?_0x4f7cd9(0x155):'y')+_0x39224f);if(_0x534d30[_0x4f7cd9(0x11d)]===_0x4f7cd9(0x120)||_0x534d30['format']===_0x4f7cd9(0x131)||_0x534d30[_0x4f7cd9(0x11d)]===_0x4f7cd9(0x190)||_0x534d30[_0x4f7cd9(0x11d)]===_0x4f7cd9(0x13c)){const _0x478915=_0x3ffd04['map'](_0x2c6294=>({'id':_0x2c6294['id'],'name':_0x2c6294['name'],'cron':_0x2c6294[_0x4f7cd9(0x14a)],'database':_0x2c6294[_0x4f7cd9(0x146)]?.['name'],'type':_0x2c6294['type'],'timezone':_0x2c6294[_0x4f7cd9(0x14f)],'user_name':_0x2c6294['user']?.['name'],'updated_at':_0x2c6294['updated_at'],'next_run_at':_0x2c6294[_0x4f7cd9(0x191)],'last_job_status':_0x2c6294[_0x4f7cd9(0x136)]?.[_0x4f7cd9(0x106)]}));await handleSDKOutput(_0x478915,_0x534d30);}else{if(_0x3ffd04['length']===0x0)console[_0x4f7cd9(0x133)](_0x4f7cd9(0x160));else{const _0xeda69d=_0x534d30[_0x4f7cd9(0x189)],_0x2eb55f=_0x3ffd04[_0x4f7cd9(0x12c)](_0x362150=>{const _0x1480ab=_0x4f7cd9,_0x1439e6=_0x362150['last_job']?.[_0x1480ab(0x106)]?_0x362150[_0x1480ab(0x136)][_0x1480ab(0x106)]===_0x1480ab(0x11b)?'✓':'✗':'-',_0x3e37a3=_0x362150[_0x1480ab(0x136)]?.[_0x1480ab(0x128)]?formatRelativeTime(_0x362150[_0x1480ab(0x136)]['ended_at']):_0x1480ab(0x141),_0x344251=_0x362150[_0x1480ab(0x191)]?formatRelativeTime(_0x362150[_0x1480ab(0x191)]):'-',_0x28b02d=_0x362150[_0x1480ab(0x14a)]||'',_0x1f1fed=_0x362150['name']||_0x1480ab(0x157),_0x3cb59e=getConsoleUrl(_0xeda69d,_0x1480ab(0x16c)+_0x362150['id']);return{'statusIcon':_0x1439e6,'lastRun':_0x3e37a3,'nextRun':_0x344251,'cron':_0x28b02d,'name':_0x1f1fed,'queryUrl':_0x3cb59e,'status':_0x362150[_0x1480ab(0x136)]?.[_0x1480ab(0x106)]};}),_0x35a62d=Math['max'](..._0x2eb55f[_0x4f7cd9(0x12c)](_0x4da587=>_0x4da587[_0x4f7cd9(0x15a)][_0x4f7cd9(0x163)])),_0x2e9737=Math['max'](..._0x2eb55f['map'](_0x1b3a4a=>_0x1b3a4a[_0x4f7cd9(0x184)]['length'])),_0x50050d=Math[_0x4f7cd9(0x187)](..._0x2eb55f[_0x4f7cd9(0x12c)](_0x2e2fa4=>_0x2e2fa4[_0x4f7cd9(0x14a)][_0x4f7cd9(0x163)])),_0x2ef0d6=_0x2eb55f[_0x4f7cd9(0x12c)](_0x245728=>{const _0x5dc964=_0x4f7cd9,_0x67600=_0x245728['status']==='success'?a36_0x16220f['green'](_0x245728[_0x5dc964(0x114)]):_0x245728[_0x5dc964(0x106)]===_0x5dc964(0x134)?a36_0x16220f[_0x5dc964(0x150)](_0x245728[_0x5dc964(0x114)]):a36_0x16220f[_0x5dc964(0x14c)](_0x245728[_0x5dc964(0x114)]),_0xe346a5=_0x245728[_0x5dc964(0x15a)]['padEnd'](_0x35a62d),_0xda4aac=_0x245728[_0x5dc964(0x184)][_0x5dc964(0x117)](_0x2e9737),_0x35f7d1=_0x245728[_0x5dc964(0x14a)]?a36_0x16220f[_0x5dc964(0x124)](_0x245728['cron'][_0x5dc964(0x117)](_0x50050d)):'\x20'[_0x5dc964(0x107)](_0x50050d),_0x1d8cfc=hyperlink(_0x245728[_0x5dc964(0x153)],_0x245728[_0x5dc964(0x16e)]);return _0x5dc964(0x142)+_0x67600+'\x20'+_0xe346a5+'\x20\x20→\x20'+_0xda4aac+'\x20\x20'+_0x35f7d1+'\x20\x20'+_0x1d8cfc;});await writeOutput(_0x2ef0d6[_0x4f7cd9(0x175)]('\x0a'),_0x534d30[_0x4f7cd9(0x15f)],_0x4f7cd9(0x15d));}}return 0x0;}}export class ScheduleShowCommand extends BaseCommand{[a36_0xf796c6(0x153)]=a36_0xf796c6(0x162);[a36_0xf796c6(0x159)]=a36_0xf796c6(0x18a);['validate'](_0xc89306){const _0x596031=a36_0xf796c6,_0x49f084=_0xc89306[_0x596031(0x174)][0x0];if(!_0x49f084)return _0x596031(0x11e);return undefined;}async[a36_0xf796c6(0x15e)](_0x2e644d){const _0x223461=a36_0xf796c6,{options:_0x34c59d,args:_0xc2c27f,tdx:_0x29618b}=_0x2e644d,_0x3d5f37=_0xc2c27f[0x0],_0x4450b8=await withSpinner(_0x223461(0x147),()=>_0x29618b[_0x223461(0x186)][_0x223461(0x109)](_0x3d5f37),{'verbose':_0x34c59d['verbose']}),_0x558aef=_0x4450b8[_0x223461(0x13d)],_0x156671={'name':_0x558aef[_0x223461(0x153)],'cron':_0x558aef[_0x223461(0x14a)],'database':_0x558aef['database'],'type':_0x558aef['type'],'timezone':_0x558aef[_0x223461(0x125)],'user_name':_0x558aef['user_name'],'created_at':_0x558aef['created_at'],'engine_version':_0x558aef[_0x223461(0x154)],'executing_user_id':_0x558aef[_0x223461(0x167)],'query':_0x558aef[_0x223461(0x137)],'delay':_0x558aef[_0x223461(0x145)],'priority':_0x558aef[_0x223461(0x17c)],'retry_limit':_0x558aef[_0x223461(0x13e)],..._0x558aef[_0x223461(0x13b)]&&{'result':_0x558aef['result']}};return await handleSingleObjectOutput(_0x156671,_0x34c59d),0x0;}}export class ScheduleCreateCommand extends BaseCommand{[a36_0xf796c6(0x153)]=a36_0xf796c6(0x14e);[a36_0xf796c6(0x159)]='Create\x20a\x20scheduled\x20query';[a36_0xf796c6(0x15b)](_0x1ca46b){const _0x2056bf=a36_0xf796c6,_0x1f02ea=_0x1ca46b[_0x2056bf(0x174)][0x0];if(!_0x1f02ea)return _0x2056bf(0x166);const _0x5f236b=_0x1ca46b['options'];if(!_0x5f236b['database'])return _0x2056bf(0x10a);return undefined;}async['execute'](_0x37a41b){const _0x1d383e=a36_0xf796c6,{options:_0x113ad2,args:_0x6b89ef,tdx:_0x1e601a}=_0x37a41b,_0x4b34e3=_0x6b89ef[0x0],_0x3240f2=_0x113ad2,_0x19b5c6=_0x3240f2[_0x1d383e(0x146)],_0x12da21=_0x3240f2[_0x1d383e(0x158)],_0x4d806b=_0x3240f2[_0x1d383e(0x105)]||_0x1d383e(0x12b);let _0x26be53;try{_0x26be53=readFileSync(_0x12da21,_0x1d383e(0x11f))[_0x1d383e(0x112)]();}catch(_0x580312){throw new SDKError(ErrorCode[_0x1d383e(0x18b)],_0x1d383e(0x172)+_0x12da21,_0x580312 instanceof Error?_0x580312:undefined);}if(!_0x26be53)throw new SDKError(ErrorCode[_0x1d383e(0x18b)],'Query\x20file\x20is\x20empty');const _0x57de54={'database':_0x19b5c6,'query':_0x26be53,'type':_0x4d806b};if(_0x3240f2[_0x1d383e(0x14a)])_0x57de54['cron']=_0x3240f2['cron'];if(_0x3240f2[_0x1d383e(0x125)])_0x57de54[_0x1d383e(0x125)]=_0x3240f2['timezone'];if(_0x3240f2[_0x1d383e(0x145)]!==undefined)_0x57de54['delay']=Number(_0x3240f2[_0x1d383e(0x145)]);if(_0x3240f2[_0x1d383e(0x17c)]!==undefined)_0x57de54['priority']=Number(_0x3240f2[_0x1d383e(0x17c)]);if(_0x3240f2['retryLimit']!==undefined)_0x57de54[_0x1d383e(0x13e)]=Number(_0x3240f2[_0x1d383e(0x17a)]);if(_0x3240f2[_0x1d383e(0x17d)])_0x57de54['engine_version']=_0x3240f2[_0x1d383e(0x17d)];if(_0x3240f2[_0x1d383e(0x13b)])_0x57de54['result']=_0x3240f2[_0x1d383e(0x13b)];if(_0x113ad2[_0x1d383e(0x18c)]){console[_0x1d383e(0x134)](_0x1d383e(0x144)+_0x4b34e3),console[_0x1d383e(0x134)](_0x1d383e(0x171)+_0x19b5c6),console[_0x1d383e(0x134)](_0x1d383e(0x129)+_0x4d806b);if(_0x57de54[_0x1d383e(0x14a)])console[_0x1d383e(0x134)]('\x20\x20Cron:\x20'+_0x57de54[_0x1d383e(0x14a)]);if(_0x57de54['timezone'])console[_0x1d383e(0x134)](_0x1d383e(0x15c)+_0x57de54[_0x1d383e(0x125)]);}const _0x2f4c82=await withSpinner(_0x1d383e(0x140),()=>_0x1e601a[_0x1d383e(0x186)][_0x1d383e(0x12a)](_0x4b34e3,_0x57de54),{'verbose':_0x113ad2[_0x1d383e(0x18c)]});return console[_0x1d383e(0x134)](_0x1d383e(0x165)+_0x2f4c82[_0x1d383e(0x13d)][_0x1d383e(0x153)]),await handleSingleObjectOutput(_0x2f4c82['data'],_0x113ad2),0x0;}}export class ScheduleUpdateCommand extends BaseCommand{[a36_0xf796c6(0x153)]=a36_0xf796c6(0x121);[a36_0xf796c6(0x159)]='Update\x20a\x20scheduled\x20query';[a36_0xf796c6(0x15b)](_0x5c4d71){const _0x1655e9=a36_0xf796c6,_0x6f409d=_0x5c4d71[_0x1655e9(0x174)][0x0];if(!_0x6f409d)return'Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20update\x20<name>\x20[options]';return undefined;}async[a36_0xf796c6(0x15e)](_0xca6666){const _0x3a2d8e=a36_0xf796c6,{options:_0x4953bb,args:_0x2ecb1e,tdx:_0x56eddb}=_0xca6666,_0x2bfefa=_0x2ecb1e[0x0],_0x3af9d1=_0x4953bb,_0x4d2d15={};if(_0x3af9d1['database'])_0x4d2d15['database']=_0x3af9d1[_0x3a2d8e(0x146)];if(_0x3af9d1[_0x3a2d8e(0x105)])_0x4d2d15[_0x3a2d8e(0x105)]=_0x3af9d1['type'];if(_0x3af9d1[_0x3a2d8e(0x14a)])_0x4d2d15['cron']=_0x3af9d1['cron'];if(_0x3af9d1[_0x3a2d8e(0x125)])_0x4d2d15[_0x3a2d8e(0x125)]=_0x3af9d1['timezone'];if(_0x3af9d1[_0x3a2d8e(0x145)]!==undefined)_0x4d2d15[_0x3a2d8e(0x145)]=Number(_0x3af9d1['delay']);if(_0x3af9d1['priority']!==undefined)_0x4d2d15[_0x3a2d8e(0x17c)]=Number(_0x3af9d1['priority']);if(_0x3af9d1['retryLimit']!==undefined)_0x4d2d15[_0x3a2d8e(0x13e)]=Number(_0x3af9d1[_0x3a2d8e(0x17a)]);if(_0x3af9d1['engineVersion'])_0x4d2d15[_0x3a2d8e(0x154)]=_0x3af9d1[_0x3a2d8e(0x17d)];if(_0x3af9d1[_0x3a2d8e(0x13b)])_0x4d2d15[_0x3a2d8e(0x13b)]=_0x3af9d1[_0x3a2d8e(0x13b)];if(_0x3af9d1['file'])try{_0x4d2d15[_0x3a2d8e(0x137)]=readFileSync(_0x3af9d1[_0x3a2d8e(0x158)],'utf-8')[_0x3a2d8e(0x112)]();}catch(_0x35e9ef){throw new SDKError(ErrorCode[_0x3a2d8e(0x18b)],_0x3a2d8e(0x172)+_0x3af9d1[_0x3a2d8e(0x158)],_0x35e9ef instanceof Error?_0x35e9ef:undefined);}if(Object[_0x3a2d8e(0x17e)](_0x4d2d15)[_0x3a2d8e(0x163)]===0x0)throw new SDKError(ErrorCode[_0x3a2d8e(0x18b)],_0x3a2d8e(0x173));if(_0x4953bb[_0x3a2d8e(0x18c)]){console[_0x3a2d8e(0x134)]('Updating\x20schedule:\x20'+_0x2bfefa);for(const [_0x19dcae,_0x1d906e]of Object[_0x3a2d8e(0x181)](_0x4d2d15)){_0x19dcae==='query'?console[_0x3a2d8e(0x134)]('\x20\x20'+_0x19dcae+':\x20'+_0x1d906e['substring'](0x0,0x32)+_0x3a2d8e(0x152)):console[_0x3a2d8e(0x134)]('\x20\x20'+_0x19dcae+':\x20'+_0x1d906e);}}const _0xc4eb71=await withSpinner(_0x3a2d8e(0x16f),()=>_0x56eddb[_0x3a2d8e(0x186)][_0x3a2d8e(0x123)](_0x2bfefa,_0x4d2d15),{'verbose':_0x4953bb[_0x3a2d8e(0x18c)]});return console['error'](_0x3a2d8e(0x193)+_0xc4eb71['data'][_0x3a2d8e(0x153)]),await handleSingleObjectOutput(_0xc4eb71[_0x3a2d8e(0x13d)],_0x4953bb),0x0;}}export class ScheduleDeleteCommand extends BaseCommand{['name']=a36_0xf796c6(0x18e);[a36_0xf796c6(0x159)]=a36_0xf796c6(0x177);['validate'](_0x31b30b){const _0x501cb0=a36_0xf796c6,_0x2a0066=_0x31b30b[_0x501cb0(0x174)][0x0];if(!_0x2a0066)return'Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20delete\x20<name>';return undefined;}async[a36_0xf796c6(0x15e)](_0x2532a6){const _0x3dd5b7=a36_0xf796c6,{options:_0xcc28a4,args:_0x13b2aa,tdx:_0xb94c86}=_0x2532a6,_0x1f9a98=_0x13b2aa[0x0];if(!_0xcc28a4[_0x3dd5b7(0x10e)]){const _0x4ef997=await confirm('Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20schedule\x20\x22'+_0x1f9a98+'\x22?');if(!_0x4ef997)return console[_0x3dd5b7(0x134)](_0x3dd5b7(0x156)),0x0;}const _0x5e7366=await withSpinner('Deleting\x20schedule...',()=>_0xb94c86[_0x3dd5b7(0x186)][_0x3dd5b7(0x179)](_0x1f9a98),{'verbose':_0xcc28a4[_0x3dd5b7(0x18c)]});return console[_0x3dd5b7(0x134)](_0x3dd5b7(0x11a)+_0x5e7366[_0x3dd5b7(0x13d)][_0x3dd5b7(0x153)]),0x0;}}export class ScheduleRunCommand extends BaseCommand{[a36_0xf796c6(0x153)]=a36_0xf796c6(0x10c);[a36_0xf796c6(0x159)]='Run\x20a\x20scheduled\x20query\x20immediately';[a36_0xf796c6(0x15b)](_0x3bd325){const _0x39d2f6=a36_0xf796c6,_0x1ebf1d=_0x3bd325[_0x39d2f6(0x174)][0x0];if(!_0x1ebf1d)return'Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20run\x20<name>\x20[--time\x20<iso8601>]\x20[--num\x20<1-10>]';return undefined;}async[a36_0xf796c6(0x15e)](_0x47f313){const _0xc20933=a36_0xf796c6,{options:_0x5e2906,args:_0x3f8893,tdx:_0x2d79a2}=_0x47f313,_0x2ab848=_0x3f8893[0x0],_0x95cd64=_0x5e2906,_0x516f25=_0x95cd64[_0xc20933(0x127)],_0xf4f5fc=_0x95cd64[_0xc20933(0x176)]!==undefined?Number(_0x95cd64['num']):undefined;if(_0x5e2906[_0xc20933(0x18c)]){console[_0xc20933(0x134)]('Running\x20schedule:\x20'+_0x2ab848);if(_0x516f25)console[_0xc20933(0x134)](_0xc20933(0x185)+_0x516f25);if(_0xf4f5fc)console[_0xc20933(0x134)]('\x20\x20Num:\x20'+_0xf4f5fc);}const _0x4b6fc1=await withSpinner('Running\x20schedule...',()=>_0x2d79a2[_0xc20933(0x186)][_0xc20933(0x180)](_0x2ab848,{'time':_0x516f25,'num':_0xf4f5fc}),{'verbose':_0x5e2906[_0xc20933(0x18c)]}),_0x2bd09c=_0x4b6fc1[_0xc20933(0x13d)][_0xc20933(0x143)];console['error'](_0xc20933(0x111)+_0x2bd09c['length']+_0xc20933(0x17f)+(_0x2bd09c[_0xc20933(0x163)]!==0x1?'s':'')+_0xc20933(0x168));for(const _0x433b5b of _0x2bd09c){console[_0xc20933(0x134)]('\x20\x20Job\x20ID:\x20'+_0x433b5b['job_id']);}return await handleSDKOutput(_0x2bd09c,_0x5e2906),0x0;}}export class ScheduleHistoryCommand extends BaseCommand{['name']='schedule:history';[a36_0xf796c6(0x159)]='Show\x20schedule\x20execution\x20history';[a36_0xf796c6(0x15b)](_0x5d55e6){const _0x405e76=a36_0xf796c6,_0x145e6b=_0x5d55e6[_0x405e76(0x174)][0x0];if(!_0x145e6b)return _0x405e76(0x16a);return undefined;}async['execute'](_0x554c78){const _0x5d7065=a36_0xf796c6,{options:_0x3e23e2,args:_0x2787d9,tdx:_0x2b4529}=_0x554c78,_0x183812=_0x2787d9[0x0],_0x4a5d61=_0x3e23e2,_0x1ae1c2=_0x4a5d61[_0x5d7065(0x122)]!==undefined?Number(_0x4a5d61[_0x5d7065(0x122)]):undefined,_0xc89593=_0x4a5d61['to']!==undefined?Number(_0x4a5d61['to']):undefined,_0x169469=await withSpinner(_0x5d7065(0x18d),()=>_0x2b4529[_0x5d7065(0x186)][_0x5d7065(0x119)](_0x183812,{'from':_0x1ae1c2,'to':_0xc89593}),{'verbose':_0x3e23e2['verbose']}),_0x494834=_0x169469[_0x5d7065(0x13d)];console[_0x5d7065(0x134)](_0x5d7065(0x182)+_0x494834[_0x5d7065(0x169)]+_0x5d7065(0x16d)+(_0x494834['count']!==0x1?'s':'')+_0x5d7065(0x17b)+_0x494834[_0x5d7065(0x122)]+'-'+_0x494834['to']+')');const _0x47eddc=_0x494834[_0x5d7065(0x119)][_0x5d7065(0x12c)](_0x387e32=>({'job_id':_0x387e32['job_id'],'type':_0x387e32[_0x5d7065(0x105)],'status':_0x387e32['status'],'scheduled_at':_0x387e32[_0x5d7065(0x138)],'created_at':_0x387e32[_0x5d7065(0x164)],'start_at':_0x387e32[_0x5d7065(0x10d)],'end_at':_0x387e32[_0x5d7065(0x170)]}));return await handleSDKOutput(_0x47eddc,_0x3e23e2),0x0;}}
1
+ const a36_0x41b656=a36_0x1545;(function(_0x1488ae,_0x278613){const _0x4b1cda=a36_0x1545,_0x10ac2b=_0x1488ae();while(!![]){try{const _0x40b065=-parseInt(_0x4b1cda(0x184))/0x1*(parseInt(_0x4b1cda(0x139))/0x2)+parseInt(_0x4b1cda(0x14e))/0x3*(parseInt(_0x4b1cda(0x183))/0x4)+-parseInt(_0x4b1cda(0x186))/0x5*(parseInt(_0x4b1cda(0x199))/0x6)+parseInt(_0x4b1cda(0x1ad))/0x7+parseInt(_0x4b1cda(0x1a8))/0x8+-parseInt(_0x4b1cda(0x138))/0x9+-parseInt(_0x4b1cda(0x1aa))/0xa*(-parseInt(_0x4b1cda(0x15e))/0xb);if(_0x40b065===_0x278613)break;else _0x10ac2b['push'](_0x10ac2b['shift']());}catch(_0x28d7c5){_0x10ac2b['push'](_0x10ac2b['shift']());}}}(a36_0x7574,0x7ffe6));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,handleSingleObjectOutput,writeOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import{confirm}from'../utils/prompt.js';import{readFileSync}from'fs';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import{getConsoleUrl}from'../sdk/client/endpoints.js';import{hyperlink}from'../sdk/util/formatters.js';function a36_0x7574(){const _0x8771b4=['Show\x20schedule\x20execution\x20history','Deleting\x20schedule...','nextRun','schedule:create','utf-8','log','Run\x20a\x20scheduled\x20query\x20immediately','data','getTime','Found\x20','4798424vjIVTM','\x20\x20→\x20','3373380yxBBQy','num','schedule:history','3094385tznNim','history','Query\x20file\x20is\x20empty','\x20\x20Time:\x20','options','(unnamed)','delete','repeat','time_zone','max','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20run\x20<name>\x20[--time\x20<iso8601>]\x20[--num\x20<1-10>]','job_id','map','listQueries','\x20\x20Job\x20ID:\x20','just\x20now','Creating\x20schedule...','Getting\x20schedule\x20details...','table','delay','join','Searching\x20scheduled\x20queries\x20matching\x20\x22','updated_at','8344683YJQuHF','25318JKpAIF','query','No\x20scheduled\x20queries\x20found','Getting\x20schedule\x20history...','timezone','📅\x20','toLocaleDateString','\x20\x20Database:\x20','execute','next_run_at','file','\x20\x20Timezone:\x20','validate','...','priority','\x20(showing\x20','never','cron','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20delete\x20<name>','create','error','3eQvijg','created_at','Updating\x20schedule...','length','schedule:list','Schedule\x20deleted:\x20','type','engine_version','limit','dim','user','Show\x20schedule\x20details','site','yes','\x20scheduled\x20quer','INVALID_ARGUMENT','33YTkBWB','At\x20least\x20one\x20option\x20must\x20be\x20provided\x20to\x20update','round','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20update\x20<name>\x20[options]','engineVersion','\x20matching\x20\x22','result','in\x20','lastRun','last_job','Schedule\x20run\x20submitted:\x20','format','jsonl','Failed\x20to\x20read\x20file:\x20','args','name','\x20created','\x22...','show','keys','Updating\x20schedule:\x20','Showing\x20first\x20','database','Cancelled','status','success','description','\x20\x20Cron:\x20','trim','Delete\x20a\x20scheduled\x20query','substring','from','start_at','jobs','Listing\x20scheduled\x20queries...','Database\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]','queries','1880612xPVfoZ','34ZzzXSs','padEnd','3210850XQVfAW','red','pagination','\x20job','List\x20scheduled\x20queries','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20history\x20<name>\x20[--from\x20<n>]\x20[--to\x20<n>]','retry_limit','retryLimit','\x20\x20Type:\x20','\x20\x20Num:\x20','schedules','verbose','ies','entries','end_at','user_name','schedule:delete','green','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]','6EtITIi','tsv','statusIcon','ended_at','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20show\x20<name>'];a36_0x7574=function(){return _0x8771b4;};return a36_0x7574();}import a36_0x26b0ae from'chalk';function formatRelativeTime(_0x2d52c3){const _0x46956b=a36_0x1545,_0x54d4c5=new Date(_0x2d52c3),_0x7ab713=new Date(),_0xf7ab9b=_0x54d4c5[_0x46956b(0x1a6)]()-_0x7ab713[_0x46956b(0x1a6)](),_0x56f16a=Math['abs'](_0xf7ab9b)/0x3e8,_0x2f2419=_0xf7ab9b<0x0;if(_0x56f16a<0x3c)return _0x2f2419?_0x46956b(0x1bc):'soon';else{if(_0x56f16a<0xe10){const _0x44c78b=Math[_0x46956b(0x160)](_0x56f16a/0x3c);return _0x2f2419?_0x44c78b+'m\x20ago':_0x46956b(0x165)+_0x44c78b+'m';}else{if(_0x56f16a<0x15180){const _0x42975f=Math[_0x46956b(0x160)](_0x56f16a/0xe10);return _0x2f2419?_0x42975f+'h\x20ago':_0x46956b(0x165)+_0x42975f+'h';}else{if(_0x56f16a<0x93a80){const _0x1cce51=Math[_0x46956b(0x160)](_0x56f16a/0x15180);return _0x2f2419?_0x1cce51+'d\x20ago':_0x46956b(0x165)+_0x1cce51+'d';}else return _0x54d4c5[_0x46956b(0x13f)]();}}}}export class ScheduleListCommand extends BaseCommand{['name']=a36_0x41b656(0x152);[a36_0x41b656(0x178)]=a36_0x41b656(0x18a);async['execute'](_0x293c9d){const _0x172dad=a36_0x41b656,{options:_0x23d179,args:_0x306511,tdx:_0x14d1fd}=_0x293c9d,_0x26fbf9=resolveLimit(_0x23d179[_0x172dad(0x156)],DEFAULT_DISPLAY_LIMIT),_0x564ce6=_0x306511[0x0],_0x4d1c24=_0x564ce6?_0x172dad(0x136)+_0x564ce6+_0x172dad(0x16f):_0x172dad(0x180),_0xf4d08a=await withSpinner(_0x4d1c24,()=>_0x14d1fd[_0x172dad(0x190)][_0x172dad(0x1ba)]({'limit':_0x26fbf9,'scheduled':!![],'pattern':_0x564ce6}),{'verbose':_0x23d179[_0x172dad(0x191)]}),_0x490b26=_0xf4d08a[_0x172dad(0x1a5)][_0x172dad(0x182)],_0x35b92b=_0xf4d08a[_0x172dad(0x1a5)][_0x172dad(0x188)]['has_next_page'],_0x2acc7b=_0x564ce6?_0x172dad(0x163)+_0x564ce6+'\x22':'';_0x35b92b?console[_0x172dad(0x14d)](_0x172dad(0x173)+_0x490b26[_0x172dad(0x151)]+'\x20schedules'+_0x2acc7b+'\x20(use\x20--limit\x20to\x20see\x20more)'):console[_0x172dad(0x14d)](_0x172dad(0x1a7)+_0x490b26[_0x172dad(0x151)]+_0x172dad(0x15c)+(_0x490b26[_0x172dad(0x151)]!==0x1?_0x172dad(0x192):'y')+_0x2acc7b);if(_0x23d179['format']==='json'||_0x23d179[_0x172dad(0x169)]===_0x172dad(0x16a)||_0x23d179[_0x172dad(0x169)]===_0x172dad(0x133)||_0x23d179[_0x172dad(0x169)]===_0x172dad(0x19a)){const _0x19495f=_0x490b26[_0x172dad(0x1b9)](_0x5eb707=>({'id':_0x5eb707['id'],'name':_0x5eb707[_0x172dad(0x16d)],'cron':_0x5eb707[_0x172dad(0x14a)],'database':_0x5eb707[_0x172dad(0x174)]?.['name'],'type':_0x5eb707['type'],'timezone':_0x5eb707[_0x172dad(0x1b5)],'user_name':_0x5eb707[_0x172dad(0x158)]?.['name'],'updated_at':_0x5eb707[_0x172dad(0x137)],'next_run_at':_0x5eb707[_0x172dad(0x142)],'last_job_status':_0x5eb707[_0x172dad(0x167)]?.[_0x172dad(0x176)]}));await handleSDKOutput(_0x19495f,_0x23d179);}else{if(_0x490b26[_0x172dad(0x151)]===0x0)console[_0x172dad(0x1a3)](_0x172dad(0x13b));else{const _0x5265e1=_0x23d179[_0x172dad(0x15a)],_0x16c9e5=_0x490b26[_0x172dad(0x1b9)](_0x207439=>{const _0x1dec2e=_0x172dad,_0x5cfa92=_0x207439[_0x1dec2e(0x167)]?.[_0x1dec2e(0x176)]?_0x207439['last_job'][_0x1dec2e(0x176)]===_0x1dec2e(0x177)?'✓':'✗':'-',_0x174a33=_0x207439[_0x1dec2e(0x167)]?.[_0x1dec2e(0x19c)]?formatRelativeTime(_0x207439[_0x1dec2e(0x167)]['ended_at']):_0x1dec2e(0x149),_0x308345=_0x207439[_0x1dec2e(0x142)]?formatRelativeTime(_0x207439[_0x1dec2e(0x142)]):'-',_0x222cdc=_0x207439[_0x1dec2e(0x14a)]||'',_0x2ffd01=_0x207439[_0x1dec2e(0x16d)]||_0x1dec2e(0x1b2),_0x3bb420=getConsoleUrl(_0x5265e1,'/app/queries/editor?queryId='+_0x207439['id']);return{'statusIcon':_0x5cfa92,'lastRun':_0x174a33,'nextRun':_0x308345,'cron':_0x222cdc,'name':_0x2ffd01,'queryUrl':_0x3bb420,'status':_0x207439[_0x1dec2e(0x167)]?.[_0x1dec2e(0x176)]};}),_0x32c5da=Math['max'](..._0x16c9e5[_0x172dad(0x1b9)](_0x118207=>_0x118207[_0x172dad(0x166)][_0x172dad(0x151)])),_0x12d31c=Math[_0x172dad(0x1b6)](..._0x16c9e5[_0x172dad(0x1b9)](_0x42118f=>_0x42118f[_0x172dad(0x1a0)]['length'])),_0x5e2c6f=Math['max'](..._0x16c9e5['map'](_0x1c8931=>_0x1c8931[_0x172dad(0x14a)][_0x172dad(0x151)])),_0x13a65f=_0x16c9e5[_0x172dad(0x1b9)](_0x2d49b6=>{const _0x29ec53=_0x172dad,_0x13cce4=_0x2d49b6[_0x29ec53(0x176)]===_0x29ec53(0x177)?a36_0x26b0ae[_0x29ec53(0x197)](_0x2d49b6[_0x29ec53(0x19b)]):_0x2d49b6[_0x29ec53(0x176)]===_0x29ec53(0x14d)?a36_0x26b0ae[_0x29ec53(0x187)](_0x2d49b6[_0x29ec53(0x19b)]):a36_0x26b0ae[_0x29ec53(0x157)](_0x2d49b6[_0x29ec53(0x19b)]),_0x183b6f=_0x2d49b6[_0x29ec53(0x166)][_0x29ec53(0x185)](_0x32c5da),_0x161a37=_0x2d49b6['nextRun'][_0x29ec53(0x185)](_0x12d31c),_0x515097=_0x2d49b6[_0x29ec53(0x14a)]?a36_0x26b0ae['cyan'](_0x2d49b6['cron'][_0x29ec53(0x185)](_0x5e2c6f)):'\x20'[_0x29ec53(0x1b4)](_0x5e2c6f),_0xfc1d63=hyperlink(_0x2d49b6[_0x29ec53(0x16d)],_0x2d49b6['queryUrl']);return _0x29ec53(0x13e)+_0x13cce4+'\x20'+_0x183b6f+_0x29ec53(0x1a9)+_0x161a37+'\x20\x20'+_0x515097+'\x20\x20'+_0xfc1d63;});await writeOutput(_0x13a65f[_0x172dad(0x135)]('\x0a'),_0x23d179['output'],'list');}}return 0x0;}}export class ScheduleShowCommand extends BaseCommand{[a36_0x41b656(0x16d)]='schedule:show';[a36_0x41b656(0x178)]=a36_0x41b656(0x159);[a36_0x41b656(0x145)](_0x195733){const _0x1b1d23=a36_0x41b656,_0x232f02=_0x195733['args'][0x0];if(!_0x232f02)return _0x1b1d23(0x19d);return undefined;}async[a36_0x41b656(0x141)](_0x24c5ae){const _0x2b8c5e=a36_0x41b656,{options:_0x207992,args:_0x548ca3,tdx:_0x2ba1ca}=_0x24c5ae,_0x44ef20=_0x548ca3[0x0],_0x4f20b0=await withSpinner(_0x2b8c5e(0x132),()=>_0x2ba1ca['schedules'][_0x2b8c5e(0x170)](_0x44ef20),{'verbose':_0x207992[_0x2b8c5e(0x191)]}),_0x1ed744=_0x4f20b0[_0x2b8c5e(0x1a5)],_0x739d5c={'name':_0x1ed744[_0x2b8c5e(0x16d)],'cron':_0x1ed744[_0x2b8c5e(0x14a)],'database':_0x1ed744[_0x2b8c5e(0x174)],'type':_0x1ed744[_0x2b8c5e(0x154)],'timezone':_0x1ed744[_0x2b8c5e(0x13d)],'user_name':_0x1ed744[_0x2b8c5e(0x195)],'created_at':_0x1ed744[_0x2b8c5e(0x14f)],'engine_version':_0x1ed744['engine_version'],'executing_user_id':_0x1ed744['executing_user_id'],'query':_0x1ed744['query'],'delay':_0x1ed744['delay'],'priority':_0x1ed744['priority'],'retry_limit':_0x1ed744['retry_limit'],..._0x1ed744['result']&&{'result':_0x1ed744[_0x2b8c5e(0x164)]}};return await handleSingleObjectOutput(_0x739d5c,_0x207992),0x0;}}export class ScheduleCreateCommand extends BaseCommand{[a36_0x41b656(0x16d)]=a36_0x41b656(0x1a1);['description']='Create\x20a\x20scheduled\x20query';[a36_0x41b656(0x145)](_0x987f7f){const _0x170e1a=a36_0x41b656,_0x27d707=_0x987f7f[_0x170e1a(0x16c)][0x0];if(!_0x27d707)return _0x170e1a(0x198);const _0x4a7387=_0x987f7f[_0x170e1a(0x1b1)];if(!_0x4a7387[_0x170e1a(0x174)])return _0x170e1a(0x181);return undefined;}async[a36_0x41b656(0x141)](_0x57916e){const _0x43b3e6=a36_0x41b656,{options:_0x73751e,args:_0x93992d,tdx:_0xbbba9e}=_0x57916e,_0x46ec02=_0x93992d[0x0],_0x57f5fb=_0x73751e,_0xb8bb3a=_0x57f5fb[_0x43b3e6(0x174)],_0x5c0ddb=_0x57f5fb['file'],_0x5e8fb1=_0x57f5fb[_0x43b3e6(0x154)]||'trino';let _0x103673;try{_0x103673=readFileSync(_0x5c0ddb,'utf-8')[_0x43b3e6(0x17a)]();}catch(_0x1f08c4){throw new SDKError(ErrorCode[_0x43b3e6(0x15d)],_0x43b3e6(0x16b)+_0x5c0ddb,_0x1f08c4 instanceof Error?_0x1f08c4:undefined);}if(!_0x103673)throw new SDKError(ErrorCode[_0x43b3e6(0x15d)],_0x43b3e6(0x1af));const _0x9d0e63={'database':_0xb8bb3a,'query':_0x103673,'type':_0x5e8fb1};if(_0x57f5fb[_0x43b3e6(0x14a)])_0x9d0e63[_0x43b3e6(0x14a)]=_0x57f5fb[_0x43b3e6(0x14a)];if(_0x57f5fb[_0x43b3e6(0x13d)])_0x9d0e63[_0x43b3e6(0x13d)]=_0x57f5fb[_0x43b3e6(0x13d)];if(_0x57f5fb[_0x43b3e6(0x134)]!==undefined)_0x9d0e63[_0x43b3e6(0x134)]=Number(_0x57f5fb[_0x43b3e6(0x134)]);if(_0x57f5fb[_0x43b3e6(0x147)]!==undefined)_0x9d0e63[_0x43b3e6(0x147)]=Number(_0x57f5fb['priority']);if(_0x57f5fb[_0x43b3e6(0x18d)]!==undefined)_0x9d0e63[_0x43b3e6(0x18c)]=Number(_0x57f5fb[_0x43b3e6(0x18d)]);if(_0x57f5fb[_0x43b3e6(0x162)])_0x9d0e63['engine_version']=_0x57f5fb[_0x43b3e6(0x162)];if(_0x57f5fb['result'])_0x9d0e63[_0x43b3e6(0x164)]=_0x57f5fb[_0x43b3e6(0x164)];if(_0x73751e[_0x43b3e6(0x191)]){console[_0x43b3e6(0x14d)]('Creating\x20schedule:\x20'+_0x46ec02),console['error'](_0x43b3e6(0x140)+_0xb8bb3a),console[_0x43b3e6(0x14d)](_0x43b3e6(0x18e)+_0x5e8fb1);if(_0x9d0e63['cron'])console[_0x43b3e6(0x14d)](_0x43b3e6(0x179)+_0x9d0e63[_0x43b3e6(0x14a)]);if(_0x9d0e63[_0x43b3e6(0x13d)])console[_0x43b3e6(0x14d)](_0x43b3e6(0x144)+_0x9d0e63[_0x43b3e6(0x13d)]);}const _0x407957=await withSpinner(_0x43b3e6(0x131),()=>_0xbbba9e[_0x43b3e6(0x190)][_0x43b3e6(0x14c)](_0x46ec02,_0x9d0e63),{'verbose':_0x73751e['verbose']});return console[_0x43b3e6(0x14d)]('Schedule\x20created:\x20'+_0x407957[_0x43b3e6(0x1a5)][_0x43b3e6(0x16d)]),await handleSingleObjectOutput(_0x407957[_0x43b3e6(0x1a5)],_0x73751e),0x0;}}function a36_0x1545(_0x97b0c0,_0x55f44f){_0x97b0c0=_0x97b0c0-0x131;const _0x75744=a36_0x7574();let _0x1545c3=_0x75744[_0x97b0c0];return _0x1545c3;}export class ScheduleUpdateCommand extends BaseCommand{['name']='schedule:update';[a36_0x41b656(0x178)]='Update\x20a\x20scheduled\x20query';[a36_0x41b656(0x145)](_0x5d9461){const _0x3c7bb4=a36_0x41b656,_0x30e58e=_0x5d9461['args'][0x0];if(!_0x30e58e)return _0x3c7bb4(0x161);return undefined;}async[a36_0x41b656(0x141)](_0x593832){const _0x2544aa=a36_0x41b656,{options:_0x11c6b4,args:_0x4a58a4,tdx:_0x2be70e}=_0x593832,_0x46d600=_0x4a58a4[0x0],_0x5db37a=_0x11c6b4,_0x361598={};if(_0x5db37a['database'])_0x361598[_0x2544aa(0x174)]=_0x5db37a[_0x2544aa(0x174)];if(_0x5db37a[_0x2544aa(0x154)])_0x361598[_0x2544aa(0x154)]=_0x5db37a[_0x2544aa(0x154)];if(_0x5db37a[_0x2544aa(0x14a)])_0x361598['cron']=_0x5db37a[_0x2544aa(0x14a)];if(_0x5db37a[_0x2544aa(0x13d)])_0x361598[_0x2544aa(0x13d)]=_0x5db37a[_0x2544aa(0x13d)];if(_0x5db37a[_0x2544aa(0x134)]!==undefined)_0x361598[_0x2544aa(0x134)]=Number(_0x5db37a[_0x2544aa(0x134)]);if(_0x5db37a[_0x2544aa(0x147)]!==undefined)_0x361598[_0x2544aa(0x147)]=Number(_0x5db37a['priority']);if(_0x5db37a[_0x2544aa(0x18d)]!==undefined)_0x361598['retry_limit']=Number(_0x5db37a[_0x2544aa(0x18d)]);if(_0x5db37a[_0x2544aa(0x162)])_0x361598[_0x2544aa(0x155)]=_0x5db37a[_0x2544aa(0x162)];if(_0x5db37a[_0x2544aa(0x164)])_0x361598[_0x2544aa(0x164)]=_0x5db37a[_0x2544aa(0x164)];if(_0x5db37a['file'])try{_0x361598['query']=readFileSync(_0x5db37a[_0x2544aa(0x143)],_0x2544aa(0x1a2))[_0x2544aa(0x17a)]();}catch(_0x2c8a21){throw new SDKError(ErrorCode[_0x2544aa(0x15d)],_0x2544aa(0x16b)+_0x5db37a['file'],_0x2c8a21 instanceof Error?_0x2c8a21:undefined);}if(Object[_0x2544aa(0x171)](_0x361598)[_0x2544aa(0x151)]===0x0)throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x2544aa(0x15f));if(_0x11c6b4['verbose']){console['error'](_0x2544aa(0x172)+_0x46d600);for(const [_0x3a13c0,_0x2d9f6b]of Object[_0x2544aa(0x193)](_0x361598)){_0x3a13c0===_0x2544aa(0x13a)?console[_0x2544aa(0x14d)]('\x20\x20'+_0x3a13c0+':\x20'+_0x2d9f6b[_0x2544aa(0x17c)](0x0,0x32)+_0x2544aa(0x146)):console[_0x2544aa(0x14d)]('\x20\x20'+_0x3a13c0+':\x20'+_0x2d9f6b);}}const _0x102395=await withSpinner(_0x2544aa(0x150),()=>_0x2be70e[_0x2544aa(0x190)]['update'](_0x46d600,_0x361598),{'verbose':_0x11c6b4['verbose']});return console[_0x2544aa(0x14d)]('Schedule\x20updated:\x20'+_0x102395['data'][_0x2544aa(0x16d)]),await handleSingleObjectOutput(_0x102395[_0x2544aa(0x1a5)],_0x11c6b4),0x0;}}export class ScheduleDeleteCommand extends BaseCommand{[a36_0x41b656(0x16d)]=a36_0x41b656(0x196);[a36_0x41b656(0x178)]=a36_0x41b656(0x17b);[a36_0x41b656(0x145)](_0x415ea8){const _0x2126fe=a36_0x41b656,_0x4a2236=_0x415ea8['args'][0x0];if(!_0x4a2236)return _0x2126fe(0x14b);return undefined;}async[a36_0x41b656(0x141)](_0x242665){const _0x438f3c=a36_0x41b656,{options:_0x29ea56,args:_0x4bd852,tdx:_0x2ab924}=_0x242665,_0x256626=_0x4bd852[0x0];if(!_0x29ea56[_0x438f3c(0x15b)]){const _0x5ab92b=await confirm('Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20schedule\x20\x22'+_0x256626+'\x22?');if(!_0x5ab92b)return console['error'](_0x438f3c(0x175)),0x0;}const _0x46df7f=await withSpinner(_0x438f3c(0x19f),()=>_0x2ab924['schedules'][_0x438f3c(0x1b3)](_0x256626),{'verbose':_0x29ea56[_0x438f3c(0x191)]});return console[_0x438f3c(0x14d)](_0x438f3c(0x153)+_0x46df7f[_0x438f3c(0x1a5)][_0x438f3c(0x16d)]),0x0;}}export class ScheduleRunCommand extends BaseCommand{[a36_0x41b656(0x16d)]='schedule:run';['description']=a36_0x41b656(0x1a4);['validate'](_0x5f2f8a){const _0x1ca8cd=a36_0x41b656,_0x38f55e=_0x5f2f8a[_0x1ca8cd(0x16c)][0x0];if(!_0x38f55e)return _0x1ca8cd(0x1b7);return undefined;}async[a36_0x41b656(0x141)](_0x4e0d88){const _0x16263c=a36_0x41b656,{options:_0x52058a,args:_0x5be9cb,tdx:_0x3c9745}=_0x4e0d88,_0x102b3a=_0x5be9cb[0x0],_0x9fa477=_0x52058a,_0x55527c=_0x9fa477['time'],_0x3771bf=_0x9fa477['num']!==undefined?Number(_0x9fa477[_0x16263c(0x1ab)]):undefined;if(_0x52058a[_0x16263c(0x191)]){console['error']('Running\x20schedule:\x20'+_0x102b3a);if(_0x55527c)console[_0x16263c(0x14d)](_0x16263c(0x1b0)+_0x55527c);if(_0x3771bf)console[_0x16263c(0x14d)](_0x16263c(0x18f)+_0x3771bf);}const _0x24f83f=await withSpinner('Running\x20schedule...',()=>_0x3c9745[_0x16263c(0x190)]['run'](_0x102b3a,{'time':_0x55527c,'num':_0x3771bf}),{'verbose':_0x52058a[_0x16263c(0x191)]}),_0x4d2af3=_0x24f83f[_0x16263c(0x1a5)][_0x16263c(0x17f)];console['error'](_0x16263c(0x168)+_0x4d2af3[_0x16263c(0x151)]+_0x16263c(0x189)+(_0x4d2af3['length']!==0x1?'s':'')+_0x16263c(0x16e));for(const _0x46a980 of _0x4d2af3){console[_0x16263c(0x14d)](_0x16263c(0x1bb)+_0x46a980[_0x16263c(0x1b8)]);}return await handleSDKOutput(_0x4d2af3,_0x52058a),0x0;}}export class ScheduleHistoryCommand extends BaseCommand{[a36_0x41b656(0x16d)]=a36_0x41b656(0x1ac);[a36_0x41b656(0x178)]=a36_0x41b656(0x19e);['validate'](_0x455990){const _0x5b006d=a36_0x41b656,_0x4eb335=_0x455990[_0x5b006d(0x16c)][0x0];if(!_0x4eb335)return _0x5b006d(0x18b);return undefined;}async[a36_0x41b656(0x141)](_0x2fcb8f){const _0x1b9f5b=a36_0x41b656,{options:_0x16d00a,args:_0x26068c,tdx:_0xf59ba}=_0x2fcb8f,_0x53ad59=_0x26068c[0x0],_0xf7b36e=_0x16d00a,_0x38d48e=_0xf7b36e[_0x1b9f5b(0x17d)]!==undefined?Number(_0xf7b36e[_0x1b9f5b(0x17d)]):undefined,_0x5e3ea4=_0xf7b36e['to']!==undefined?Number(_0xf7b36e['to']):undefined,_0x188f3f=await withSpinner(_0x1b9f5b(0x13c),()=>_0xf59ba['schedules'][_0x1b9f5b(0x1ae)](_0x53ad59,{'from':_0x38d48e,'to':_0x5e3ea4}),{'verbose':_0x16d00a[_0x1b9f5b(0x191)]}),_0x24bcfa=_0x188f3f[_0x1b9f5b(0x1a5)];console[_0x1b9f5b(0x14d)](_0x1b9f5b(0x1a7)+_0x24bcfa['count']+'\x20execution'+(_0x24bcfa['count']!==0x1?'s':'')+_0x1b9f5b(0x148)+_0x24bcfa[_0x1b9f5b(0x17d)]+'-'+_0x24bcfa['to']+')');const _0x42e03b=_0x24bcfa[_0x1b9f5b(0x1ae)][_0x1b9f5b(0x1b9)](_0x43f0c5=>({'job_id':_0x43f0c5[_0x1b9f5b(0x1b8)],'type':_0x43f0c5[_0x1b9f5b(0x154)],'status':_0x43f0c5[_0x1b9f5b(0x176)],'scheduled_at':_0x43f0c5['scheduled_at'],'created_at':_0x43f0c5[_0x1b9f5b(0x14f)],'start_at':_0x43f0c5[_0x1b9f5b(0x17e)],'end_at':_0x43f0c5[_0x1b9f5b(0x194)]}));return await handleSDKOutput(_0x42e03b,_0x16d00a),0x0;}}
@@ -1 +1 @@
1
- const a37_0x28b26d=a37_0x1f15;function a37_0x4f65(){const _0x5c3707=['86phQzJG','Create\x20segment\x20folder\x20for\x20organization','7806UUgnbN','Resolved\x20folder\x20ID:\x20','format','in\x20','Resolved\x20type:\x20','getSegmentSQL','Error:\x20Cannot\x20open\x20folder\x20in\x20web\x20browser.\x20Use\x20a\x20segment\x20name\x20instead.','segment:show','Resolved\x20parent\x20ID:\x20','json','length','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20view\x20<path/to/segment.yml>','toLocaleString','parent','\x20\x20tdx\x20sg\x20sql\x20--path\x20','SEGMENT_FOLDER_NOT_FOUND','resolveParentId','Resolved\x20relative\x20path\x20to:\x20','includes','No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22','2598323aIJUlY','Resolving\x20folder\x20\x27','site','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','getSQLFromYamlFile','1137bGDjce','Parent\x20segment:\x20','segment:describe','type','content','Error:\x20Cannot\x20execute\x20query\x20for\x20parent\x20segment\x20with\x20this\x20command.','Error:\x20Cannot\x20view\x20parent\x20segment\x20details\x20with\x20this\x20command.','listFolders','resolveFolderId','40oReOMX','execute','parentFolder','Error:\x20Folder\x20reference\x20is\x20required','log','verbose','jsonl','folderId','red','Error:\x20Folder\x20or\x20segment\x20name,\x20or\x20YAML\x20file\x20path\x20is\x20required','\x20\x20tdx\x20sg\x20sql\x20\x22Premium\x20Users\x22','Parent\x20name:\x20','Parent\x20ID:\x20','Cannot\x20get\x20SQL\x20query\x20for\x20a\x20folder.\x20Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.','Fetching\x20SQL\x20for\x20segment...','Usage:\x20tdx\x20segment\x20folder\x20show\x20<parent_name/folder_name>','Show\x20child\x20segment\x20schema\x20(column\x20types)','INVALID_ARGUMENT','data','Error:\x20YAML\x20file\x20paths\x20must\x20be\x20specified\x20with\x20--path\x20option','\x20\x20Server-side\x20segment:\x20\x20tdx\x20sg\x20sql\x20<name>','✖\x20Query\x20failed\x20[','Site:\x20','test','code','getFolder','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','Error:\x20Path\x20or\x20name\x20is\x20required','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20\x20\x20\x20\x20#\x20View\x20child\x20segment\x20details','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20show\x20<path/to/segment.yml>','/app/ps/','Error:\x20Cannot\x20open\x20parent\x20segment\x20with\x20this\x20command.','Cannot\x20get\x20SQL\x20for\x20parent\x20segment\x20with\x20this\x20command.\x20Use:\x20tdx\x20ps\x20sql','Fetching\x20folder\x20details...','segment','✔\x20Found\x20','stats','\x20folder','Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20','description','\x27...','\x20[Job\x20ID:\x20','\x20\x20-w,\x20--web\x20\x20Open\x20segment\x20in\x20web\x20browser','message','segment:folder:create','\x20\x20tdx\x20sg\x20show\x20\x22Premium\x20Users\x22','Options:','segment:desc','Error:\x20Specify\x20either\x20segment\x20name\x20or\x20--path,\x20not\x20both','Usage:\x20tdx\x20sg\x20view\x20<name>\x20[-w]','Execute\x20child\x20segment\x20SQL\x20query\x20and\x20show\x20results','\x20\x20Full\x20path:\x20','Segment\x20ID\x20missing\x20from\x20resolved\x20path','fullPath','Resolving\x20path\x20\x27','✔\x20Created\x20folder\x20\x27','url','SQL\x20query:\x0a','Usage:\x20tdx\x20segment\x20describe\x20<path>','List\x20segment\x20folders\x20under\x20a\x20parent\x20segment','Folder\x20name:\x20','cause','Use:\x20tdx\x20ps\x20view','773064xmoRUr','Segment\x20ID:\x20','segmentName','Usage:\x20tdx\x20segment\x20folder\x20create\x20<parent_name>\x20<folder_name>\x20[options]','segmentId','Show\x20segment\x20or\x20folder\x20details','\x27\x20with\x20ID:\x20','getSegment','cyan','Resolving\x20parent\x20folder\x20\x27','Folder\x20ID\x20missing\x20from\x20resolved\x20path','Error:\x20','SEGMENT_NOT_FOUND','Show\x20segment\x20folder\x20details','Examples:','Resolving\x20\x27','Error:\x20Cannot\x20execute\x20SQL\x20query\x20on\x20a\x20folder.','Fetching\x20SQL\x20from\x20rule...','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience/Marketing/High\x20Value\x22','path','Usage:\x20tdx\x20sg\x20show\x20<name>','Error:\x20Cannot\x20show\x20schema\x20for\x20parent\x20segment\x20with\x20this\x20command.','getSQLFromServerSegment','Error:\x20Cannot\x20show\x20schema\x20for\x20a\x20folder.','\x20\x20tdx\x20sg\x20show\x20segments/my-audience/premium-users.yml','error','Usage:\x20tdx\x20segment\x20folder\x20list\x20<parent_name>','limit','SELECT\x20*\x20FROM\x20(\x0a','green','elapsedTimeMillis','Resolving\x20parent\x20segment\x20\x27','parentId','segment:folder:show','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20-w\x20\x20#\x20Open\x20segment\x20in\x20web\x20browser','segment:folder:list','Error:\x20Segment\x20name\x20or\x20--path\x20is\x20required','403635LCRSpi','2840uHfQQM','✔\x20Query\x20completed:\x20Processed\x20','name','replace','1894824ThtUjy','Resolved\x20parent\x20folder\x20ID:\x20','parentSegment','Fetching\x20segment\x20details...','Use:\x20tdx\x20sg\x20view\x20<name>\x20\x20#\x20To\x20show\x20folder\x20details','folderPath','Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.','Usage:\x20tdx\x20sg\x20desc\x20<name>','segmentPath','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience\x22','processedRows','folder','Use:\x20tdx\x20ps\x20desc','Use:\x20tdx\x20ps\x20show','\x20\x20Cause:\x20','query','Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required','Listing\x20folders\x20for\x20parent\x20\x27','resolvePathToResource','Get\x20SQL\x20query\x20for\x20child\x20segment','\x20rows\x20','/e/','\x20\x20tdx\x20sg\x20view\x20segments/my-audience/premium-users.yml','Target\x20path:\x20','\x20\x20tdx\x20sg\x20view\x20\x22Marketing\x22\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20folder\x20details','434331hmuEKo','Executing\x20segment\x20query...'];a37_0x4f65=function(){return _0x5c3707;};return a37_0x4f65();}(function(_0x5e31ab,_0x3553e0){const _0x2aae36=a37_0x1f15,_0x911bd3=_0x5e31ab();while(!![]){try{const _0x23e082=-parseInt(_0x2aae36(0x1e5))/0x1*(parseInt(_0x2aae36(0x1e3))/0x2)+-parseInt(_0x2aae36(0x1fe))/0x3*(-parseInt(_0x2aae36(0x1c4))/0x4)+parseInt(_0x2aae36(0x1c3))/0x5+-parseInt(_0x2aae36(0x19e))/0x6+parseInt(_0x2aae36(0x1f9))/0x7+-parseInt(_0x2aae36(0x1c8))/0x8+parseInt(_0x2aae36(0x1e1))/0x9*(parseInt(_0x2aae36(0x207))/0xa);if(_0x23e082===_0x3553e0)break;else _0x911bd3['push'](_0x911bd3['shift']());}catch(_0x6359c7){_0x911bd3['push'](_0x911bd3['shift']());}}}(a37_0x4f65,0x33ecf));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,handleQueryOutput,handleSingleObjectOutput}from'../core/command-output.js';import{withSpinner,withProgressSpinner,formatElapsed}from'../utils/spinner.js';import{parseSegmentRef}from'../sdk/segment/segment-ref-parser.js';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import{executeSchemaQuery}from'../sdk/segment/fields-display.js';import{isYamlFilePath,resolveYamlFilePath}from'../sdk/segment/segment-path-parser.js';import{getConsoleNextUrl}from'../sdk/client/endpoints.js';import{openBrowser}from'../utils/process.js';import a37_0x522589 from'chalk';async function resolveSegmentTarget(_0x28e00f,_0xc17b00,_0x350091){const _0x1ff849=a37_0x1f15;if(isYamlFilePath(_0x28e00f))try{const _0x172ea9=await resolveYamlFilePath(_0x28e00f);return _0x350091&&(console['error']('Resolved\x20YAML\x20file:\x20'+_0x28e00f),console['error']('\x20\x20Parent\x20segment:\x20'+_0x172ea9[_0x1ff849(0x1ca)]),console[_0x1ff849(0x1b7)]('\x20\x20Segment\x20name:\x20'+_0x172ea9[_0x1ff849(0x1a0)]),console[_0x1ff849(0x1b7)]('\x20\x20Folder\x20path:\x20'+(_0x172ea9[_0x1ff849(0x1cd)]||'(root)')),console[_0x1ff849(0x1b7)](_0x1ff849(0x192)+_0x172ea9[_0x1ff849(0x194)])),_0x172ea9[_0x1ff849(0x194)];}catch(_0x3ec960){throw new SDKError(ErrorCode[_0x1ff849(0x218)],'Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20'+_0x3ec960['message']);}if(!_0xc17b00)throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x1ff849(0x1f8));return _0xc17b00+'/'+_0x28e00f;}function a37_0x1f15(_0x29c37e,_0x83be6d){_0x29c37e=_0x29c37e-0x18e;const _0x4f65fe=a37_0x4f65();let _0x1f1590=_0x4f65fe[_0x29c37e];return _0x1f1590;}export class SegmentDescribeCommand extends BaseCommand{[a37_0x28b26d(0x1c6)]=a37_0x28b26d(0x200);[a37_0x28b26d(0x22e)]=a37_0x28b26d(0x1a3);async[a37_0x28b26d(0x208)](_0x255a9b){const _0x5d438a=a37_0x28b26d,{options:_0x52dafd,args:_0x29e316,tdx:_0xf09ceb}=_0x255a9b,_0x5adaf4=_0x29e316[0x0],_0x4dd94e=!_0x5adaf4&&!!_0x52dafd['parentSegment'],_0x3a5b0c=_0x5adaf4||_0x52dafd[_0x5d438a(0x1ca)];if(!_0x3a5b0c)return console['error'](_0x5d438a(0x222)),console['error'](_0x5d438a(0x199)),console[_0x5d438a(0x1b7)]('Examples:'),console[_0x5d438a(0x1b7)](_0x5d438a(0x1d1)),console['error'](_0x5d438a(0x1b0)),console[_0x5d438a(0x1b7)]('\x20\x20tdx\x20segment\x20describe\x20\x22High\x20Value\x22\x20\x20\x20\x20#\x20Relative\x20to\x20current\x20context'),console['error'](_0x5d438a(0x221)),0x1;try{const _0x3cedb8=_0x52dafd[_0x5d438a(0x1d0)];let _0x1b90ff=_0x3a5b0c;!_0x4dd94e&&_0x3cedb8&&!_0x3a5b0c[_0x5d438a(0x1f7)]('/')&&(_0x1b90ff=_0x3cedb8+'/'+_0x3a5b0c,_0x52dafd['verbose']&&console[_0x5d438a(0x1b7)](_0x5d438a(0x1f6)+_0x1b90ff));const _0x55a241=await withSpinner(_0x5d438a(0x195)+_0x1b90ff+_0x5d438a(0x22f),()=>_0xf09ceb[_0x5d438a(0x229)][_0x5d438a(0x1da)](_0x1b90ff),{'verbose':_0x52dafd[_0x5d438a(0x20c)]}),_0x4a123c=_0x55a241[_0x5d438a(0x219)];_0x52dafd[_0x5d438a(0x20c)]&&(console[_0x5d438a(0x1b7)](_0x5d438a(0x1e9)+_0x4a123c[_0x5d438a(0x201)]),console[_0x5d438a(0x1b7)](_0x5d438a(0x213)+_0x4a123c[_0x5d438a(0x1be)]),_0x4a123c['folderId']&&console[_0x5d438a(0x1b7)]('Folder\x20ID:\x20'+_0x4a123c[_0x5d438a(0x20e)]),_0x4a123c['segmentId']&&console[_0x5d438a(0x1b7)](_0x5d438a(0x19f)+_0x4a123c[_0x5d438a(0x1a2)]));if(_0x4a123c[_0x5d438a(0x201)]===_0x5d438a(0x1f2)){const _0x2d4c09=await withSpinner('Fetching\x20parent\x20segment\x20details...',()=>_0xf09ceb[_0x5d438a(0x229)]['getParent'](_0x4a123c[_0x5d438a(0x1be)]),{'verbose':_0x52dafd['verbose']});await handleSingleObjectOutput(_0x2d4c09[_0x5d438a(0x219)],_0x52dafd);}else{if(_0x4a123c[_0x5d438a(0x201)]===_0x5d438a(0x1d3)){if(!_0x4a123c[_0x5d438a(0x20e)])throw new SDKError(ErrorCode[_0x5d438a(0x1f4)],_0x5d438a(0x1a8));const _0x2020da=await withSpinner(_0x5d438a(0x228),()=>_0xf09ceb[_0x5d438a(0x229)]['getFolder'](_0x4a123c['folderId']),{'verbose':_0x52dafd[_0x5d438a(0x20c)]});await handleSingleObjectOutput(_0x2020da['data'],_0x52dafd);}else{if(_0x4a123c[_0x5d438a(0x201)]==='segment'){if(!_0x4a123c[_0x5d438a(0x1a2)])throw new SDKError(ErrorCode[_0x5d438a(0x1aa)],_0x5d438a(0x193));const _0x4e225f=await withSpinner(_0x5d438a(0x1cb),()=>_0xf09ceb[_0x5d438a(0x229)]['getSegment'](_0x4a123c['parentId'],_0x4a123c[_0x5d438a(0x1a2)]),{'verbose':_0x52dafd['verbose']});await handleSingleObjectOutput(_0x4e225f['data'],_0x52dafd);}}}return 0x0;}catch(_0x14428d){if(_0x14428d instanceof SDKError)return console['error']('Error:\x20'+_0x14428d['message']),_0x14428d[_0x5d438a(0x19c)]&&console[_0x5d438a(0x1b7)](_0x5d438a(0x1d6)+_0x14428d[_0x5d438a(0x19c)]),0x1;throw _0x14428d;}}}export class SegmentShowCommand extends BaseCommand{[a37_0x28b26d(0x1c6)]=a37_0x28b26d(0x1ec);[a37_0x28b26d(0x22e)]=a37_0x28b26d(0x191);async[a37_0x28b26d(0x208)](_0x1d7cc9){const _0x1921e9=a37_0x28b26d,{options:_0x127d0a,args:_0xb31082,tdx:_0x52e955}=_0x1d7cc9,_0x40e85b=_0xb31082[0x0];if(!_0x40e85b)return console[_0x1921e9(0x1b7)](_0x1921e9(0x1d8)),console[_0x1921e9(0x1b7)](_0x1921e9(0x1b2)),console[_0x1921e9(0x1b7)](_0x1921e9(0x224)),console[_0x1921e9(0x1b7)](_0x1921e9(0x1ac)),console['error'](_0x1921e9(0x234)),console[_0x1921e9(0x1b7)](_0x1921e9(0x1b6)),0x1;try{const _0x5854b5=_0x127d0a[_0x1921e9(0x1ca)],_0x2bdb6a=await resolveSegmentTarget(_0x40e85b,_0x5854b5,_0x127d0a[_0x1921e9(0x20c)]);_0x127d0a[_0x1921e9(0x20c)]&&console[_0x1921e9(0x1b7)](_0x1921e9(0x1df)+_0x2bdb6a);const _0x3b6b0a=await withSpinner(_0x1921e9(0x1ad)+_0x40e85b+_0x1921e9(0x22f),()=>_0x52e955[_0x1921e9(0x229)][_0x1921e9(0x1da)](_0x2bdb6a),{'verbose':_0x127d0a[_0x1921e9(0x20c)]}),_0x2d29ef=_0x3b6b0a['data'];_0x127d0a[_0x1921e9(0x20c)]&&(console[_0x1921e9(0x1b7)](_0x1921e9(0x1e9)+_0x2d29ef[_0x1921e9(0x201)]),console[_0x1921e9(0x1b7)](_0x1921e9(0x213)+_0x2d29ef['parentId']));if(_0x2d29ef['type']===_0x1921e9(0x1d3))return console[_0x1921e9(0x1b7)](_0x1921e9(0x1ae)),console['error'](_0x1921e9(0x1cc)),0x1;if(_0x2d29ef['type']===_0x1921e9(0x1f2))return console['error'](_0x1921e9(0x203)),console[_0x1921e9(0x1b7)](_0x1921e9(0x1d5)),0x1;if(!_0x2d29ef[_0x1921e9(0x1a2)])throw new SDKError(ErrorCode[_0x1921e9(0x1aa)],_0x1921e9(0x193));const _0x2027d7=await withSpinner(_0x1921e9(0x215),()=>_0x52e955['segment'][_0x1921e9(0x1ea)](_0x2d29ef[_0x1921e9(0x1be)],_0x2d29ef[_0x1921e9(0x1a2)]),{'verbose':_0x127d0a[_0x1921e9(0x20c)]});let _0x3b7478=_0x2027d7[_0x1921e9(0x219)];const _0x32fc1e=resolveLimit(_0x127d0a[_0x1921e9(0x1b9)],DEFAULT_DISPLAY_LIMIT),_0x1de698=/\bLIMIT\s+\d+/i[_0x1921e9(0x21e)](_0x3b7478);!_0x1de698&&(_0x3b7478=_0x3b7478['trim']()[_0x1921e9(0x1c7)](/;+$/,''),_0x3b7478=_0x1921e9(0x1ba)+_0x3b7478+_0x1921e9(0x1fc)+_0x32fc1e);_0x127d0a['verbose']&&console['error'](_0x1921e9(0x198)+_0x3b7478);const _0x48ac12=await withProgressSpinner(_0x1921e9(0x1e2),async _0x54b8ad=>{const _0x142a3f=_0x1921e9,_0x35f28f=await _0x52e955[_0x142a3f(0x1d7)][_0x142a3f(0x208)](_0x3b7478,{'catalog':'td','schema':'information_schema','onJobId':_0x2fbdc8=>{_0x54b8ad['setJobId'](_0x2fbdc8);}});return _0x35f28f;},{'verbose':_0x127d0a['verbose']}),_0x5cd5dd=_0x48ac12[_0x1921e9(0x219)],_0x12b14=_0x5cd5dd['jobId']?_0x1921e9(0x230)+_0x5cd5dd['jobId']+']':'';return console[_0x1921e9(0x1b7)](_0x1921e9(0x1c5)+_0x5cd5dd[_0x1921e9(0x22b)][_0x1921e9(0x1d2)][_0x1921e9(0x1f1)]()+_0x1921e9(0x1dc)+(_0x1921e9(0x1e8)+formatElapsed(_0x5cd5dd[_0x1921e9(0x22b)][_0x1921e9(0x1bc)])+_0x12b14)),await handleQueryOutput(_0x5cd5dd,_0x127d0a),0x0;}catch(_0x3d0218){if(_0x3d0218 instanceof SDKError)return console[_0x1921e9(0x1b7)](_0x1921e9(0x21c)+_0x3d0218[_0x1921e9(0x21f)]+']'),console[_0x1921e9(0x1b7)]('\x0a'+_0x3d0218[_0x1921e9(0x232)]),0x1;throw _0x3d0218;}}}export class SegmentFolderListCommand extends BaseCommand{[a37_0x28b26d(0x1c6)]=a37_0x28b26d(0x1c1);['description']=a37_0x28b26d(0x19a);async['execute'](_0x495b64){const _0x150109=a37_0x28b26d,{options:_0x47eedd,args:_0x1ade86,tdx:_0x107c1a}=_0x495b64;if(_0x1ade86[_0x150109(0x1ef)]===0x0)return console[_0x150109(0x1b7)]('Error:\x20Parent\x20segment\x20name\x20is\x20required'),console[_0x150109(0x1b7)](_0x150109(0x1b8)),0x1;const _0x1ff5b2=_0x1ade86[0x0];try{_0x47eedd['verbose']&&(console[_0x150109(0x1b7)](_0x150109(0x21d)+_0x47eedd['site']),console[_0x150109(0x1b7)](_0x150109(0x212)+_0x1ff5b2));const _0x4ccdc0=await withSpinner(_0x150109(0x1bd)+_0x1ff5b2+_0x150109(0x22f),()=>_0x107c1a[_0x150109(0x229)][_0x150109(0x1f5)](_0x1ff5b2),{'verbose':_0x47eedd[_0x150109(0x20c)]}),_0x3ca77=_0x4ccdc0[_0x150109(0x219)];_0x47eedd['verbose']&&console[_0x150109(0x1b7)](_0x150109(0x1ed)+_0x3ca77);const _0x5f3f5e=await withSpinner(_0x150109(0x1d9)+_0x1ff5b2+'\x27...',()=>_0x107c1a[_0x150109(0x229)][_0x150109(0x205)](_0x3ca77),{'verbose':_0x47eedd[_0x150109(0x20c)]}),_0x2ed49b=_0x5f3f5e[_0x150109(0x219)];return console[_0x150109(0x1b7)](_0x150109(0x22a)+_0x2ed49b[_0x150109(0x1ef)]+_0x150109(0x22c)+(_0x2ed49b[_0x150109(0x1ef)]!==0x1?'s':'')),await handleSDKOutput(_0x2ed49b,_0x47eedd),0x0;}catch(_0x2896f2){if(_0x2896f2 instanceof SDKError)return console[_0x150109(0x1b7)]('Error:\x20'+_0x2896f2[_0x150109(0x232)]),_0x2896f2['cause']&&console['error'](_0x150109(0x1d6)+_0x2896f2[_0x150109(0x19c)]),0x1;throw _0x2896f2;}}}export class SegmentFolderShowCommand extends BaseCommand{['name']=a37_0x28b26d(0x1bf);[a37_0x28b26d(0x22e)]=a37_0x28b26d(0x1ab);async[a37_0x28b26d(0x208)](_0x2874e5){const _0x37a9db=a37_0x28b26d,{options:_0x34e434,args:_0x13a418,tdx:_0x997f28}=_0x2874e5;if(_0x13a418[_0x37a9db(0x1ef)]===0x0)return console[_0x37a9db(0x1b7)](_0x37a9db(0x20a)),console[_0x37a9db(0x1b7)](_0x37a9db(0x216)),0x1;try{const {parentId:_0x8b035d,childId:_0xf7670a}=parseSegmentRef(_0x13a418[0x0]);_0x34e434['verbose']&&(console[_0x37a9db(0x1b7)](_0x37a9db(0x21d)+_0x34e434[_0x37a9db(0x1fb)]),console[_0x37a9db(0x1b7)](_0x37a9db(0x212)+_0x8b035d),_0xf7670a&&console[_0x37a9db(0x1b7)](_0x37a9db(0x19b)+_0xf7670a));if(!_0xf7670a)return console[_0x37a9db(0x1b7)]('Error:\x20Folder\x20name\x20is\x20required\x20(use\x20parent_name/folder_name\x20format)'),0x1;const _0x2599bb=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x8b035d+_0x37a9db(0x22f),()=>_0x997f28[_0x37a9db(0x229)][_0x37a9db(0x1f5)](_0x8b035d),{'verbose':_0x34e434[_0x37a9db(0x20c)]}),_0x4d0488=_0x2599bb[_0x37a9db(0x219)];_0x34e434[_0x37a9db(0x20c)]&&console[_0x37a9db(0x1b7)](_0x37a9db(0x1ed)+_0x4d0488);const _0x1c994a=await withSpinner(_0x37a9db(0x1fa)+_0xf7670a+_0x37a9db(0x22f),()=>_0x997f28[_0x37a9db(0x229)]['resolveFolderId'](_0x4d0488,_0xf7670a),{'verbose':_0x34e434[_0x37a9db(0x20c)]}),_0x3eac96=_0x1c994a[_0x37a9db(0x219)];_0x34e434[_0x37a9db(0x20c)]&&console[_0x37a9db(0x1b7)](_0x37a9db(0x1e6)+_0x3eac96);const _0x297bb0=await withSpinner('Fetching\x20folder\x20\x27'+_0xf7670a+_0x37a9db(0x22f),()=>_0x997f28[_0x37a9db(0x229)][_0x37a9db(0x220)](_0x3eac96),{'verbose':_0x34e434[_0x37a9db(0x20c)]});return await handleSDKOutput([_0x297bb0[_0x37a9db(0x219)]],_0x34e434),0x0;}catch(_0x3a1836){if(_0x3a1836 instanceof SDKError)return console['error'](_0x37a9db(0x1a9)+_0x3a1836[_0x37a9db(0x232)]),_0x3a1836[_0x37a9db(0x19c)]&&console[_0x37a9db(0x1b7)](_0x37a9db(0x1d6)+_0x3a1836['cause']),0x1;throw _0x3a1836;}}}export class SegmentSQLCommand extends BaseCommand{[a37_0x28b26d(0x1c6)]='segment:sql';['description']=a37_0x28b26d(0x1db);async['execute'](_0x21529b){const _0x4fdf77=a37_0x28b26d,{options:_0x4dd0dc,args:_0x2e5e63}=_0x21529b,_0x719af1=_0x4dd0dc,_0x2342e4=_0x719af1[_0x4fdf77(0x1b1)],_0x58fe97=_0x2e5e63[0x0];if(!_0x58fe97&&!_0x2342e4)return console[_0x4fdf77(0x1b7)](a37_0x522589[_0x4fdf77(0x20f)](_0x4fdf77(0x1c2))),console[_0x4fdf77(0x1b7)]('Usage:'),console[_0x4fdf77(0x1b7)](_0x4fdf77(0x21b)),console['error']('\x20\x20Local\x20YAML\x20file:\x20\x20\x20\x20\x20\x20tdx\x20sg\x20sql\x20--path\x20<file-path>'),console[_0x4fdf77(0x1b7)](_0x4fdf77(0x1ac)),console[_0x4fdf77(0x1b7)](_0x4fdf77(0x211)),console[_0x4fdf77(0x1b7)]('\x20\x20tdx\x20sg\x20sql\x20--path\x20segments/my-audience/premium-users.yml'),0x1;if(_0x58fe97&&_0x2342e4)return console[_0x4fdf77(0x1b7)](a37_0x522589[_0x4fdf77(0x20f)](_0x4fdf77(0x18f))),0x1;try{let _0x23fe1;if(_0x2342e4)_0x23fe1=await this[_0x4fdf77(0x1fd)](_0x2342e4,_0x21529b);else{if(isYamlFilePath(_0x58fe97))return console['error'](a37_0x522589[_0x4fdf77(0x20f)](_0x4fdf77(0x21a))),console[_0x4fdf77(0x1b7)](_0x4fdf77(0x1f3)+_0x58fe97),0x1;else _0x23fe1=await this[_0x4fdf77(0x1b4)](_0x58fe97,_0x21529b);}return _0x4dd0dc[_0x4fdf77(0x1e7)]===_0x4fdf77(0x1ee)||_0x4dd0dc[_0x4fdf77(0x1e7)]===_0x4fdf77(0x20d)?await handleSDKOutput([{'sql':_0x23fe1}],_0x4dd0dc):console[_0x4fdf77(0x20b)](_0x23fe1),0x0;}catch(_0x24bf88){if(_0x24bf88 instanceof SDKError)return console[_0x4fdf77(0x1b7)]('Error:\x20'+_0x24bf88[_0x4fdf77(0x232)]),_0x24bf88[_0x4fdf77(0x19c)]&&console[_0x4fdf77(0x1b7)](_0x4fdf77(0x1d6)+_0x24bf88['cause']),0x1;throw _0x24bf88;}}async[a37_0x28b26d(0x1fd)](_0x584c15,_0x486b7e){const _0x1d2fff=a37_0x28b26d,{options:_0x174479,tdx:_0x44bfa6}=_0x486b7e;let _0x1eaffc;try{_0x1eaffc=await resolveYamlFilePath(_0x584c15);}catch(_0x350414){throw new SDKError(ErrorCode[_0x1d2fff(0x218)],_0x1d2fff(0x22d)+_0x350414[_0x1d2fff(0x232)]);}_0x174479[_0x1d2fff(0x20c)]&&console[_0x1d2fff(0x1b7)]('Resolved:\x20'+_0x1eaffc[_0x1d2fff(0x1ca)]+'/'+_0x1eaffc[_0x1d2fff(0x1a0)]);const _0x4894d0=await withSpinner(_0x1d2fff(0x1af),()=>_0x44bfa6[_0x1d2fff(0x229)]['getSegmentSQLFromYaml'](_0x1eaffc[_0x1d2fff(0x202)],_0x1eaffc['parentSegment'],_0x1eaffc[_0x1d2fff(0x1a0)]),{'verbose':_0x174479[_0x1d2fff(0x20c)]});return _0x4894d0[_0x1d2fff(0x219)];}async['getSQLFromServerSegment'](_0x57acbf,_0x1c2c94){const _0x20b892=a37_0x28b26d,{options:_0x5686d5,tdx:_0x521bd8}=_0x1c2c94,_0x1cfa46=_0x5686d5[_0x20b892(0x1ca)],_0x3d28f5=await resolveSegmentTarget(_0x57acbf,_0x1cfa46,_0x5686d5[_0x20b892(0x20c)]);_0x5686d5[_0x20b892(0x20c)]&&console[_0x20b892(0x1b7)](_0x20b892(0x1df)+_0x3d28f5);const _0x3752c4=await withSpinner(_0x20b892(0x1ad)+_0x57acbf+'\x27...',()=>_0x521bd8[_0x20b892(0x229)][_0x20b892(0x1da)](_0x3d28f5),{'verbose':_0x5686d5[_0x20b892(0x20c)]}),_0x9dcb1f=_0x3752c4[_0x20b892(0x219)];_0x5686d5[_0x20b892(0x20c)]&&(console[_0x20b892(0x1b7)](_0x20b892(0x1e9)+_0x9dcb1f['type']),console['error'](_0x20b892(0x213)+_0x9dcb1f[_0x20b892(0x1be)]));if(_0x9dcb1f[_0x20b892(0x201)]===_0x20b892(0x1d3))throw new SDKError(ErrorCode[_0x20b892(0x218)],_0x20b892(0x214));if(_0x9dcb1f[_0x20b892(0x201)]==='parent')throw new SDKError(ErrorCode[_0x20b892(0x218)],_0x20b892(0x227));if(!_0x9dcb1f[_0x20b892(0x1a2)])throw new SDKError(ErrorCode[_0x20b892(0x1aa)],_0x20b892(0x193));const _0x1f5d43=await withSpinner(_0x20b892(0x215),()=>_0x521bd8[_0x20b892(0x229)][_0x20b892(0x1ea)](_0x9dcb1f[_0x20b892(0x1be)],_0x9dcb1f[_0x20b892(0x1a2)]),{'verbose':_0x5686d5['verbose']});return _0x1f5d43['data'];}}export class SegmentFolderCreateCommand extends BaseCommand{[a37_0x28b26d(0x1c6)]=a37_0x28b26d(0x233);[a37_0x28b26d(0x22e)]=a37_0x28b26d(0x1e4);async['execute'](_0x65fae6){const _0x3c7dd2=a37_0x28b26d,{options:_0x1f8cd1,args:_0xccf4fa,tdx:_0x51038f}=_0x65fae6,_0x9f40ef=_0x1f8cd1;if(_0xccf4fa[_0x3c7dd2(0x1ef)]<0x2)return console[_0x3c7dd2(0x1b7)]('Error:\x20Parent\x20segment\x20name\x20and\x20folder\x20name\x20are\x20required'),console[_0x3c7dd2(0x1b7)](_0x3c7dd2(0x1a1)),0x1;const _0x12dc6b=_0xccf4fa[0x0],_0x58788c=_0xccf4fa[0x1];_0x9f40ef[_0x3c7dd2(0x20c)]&&(console[_0x3c7dd2(0x1b7)](_0x3c7dd2(0x21d)+_0x9f40ef[_0x3c7dd2(0x1fb)]),console[_0x3c7dd2(0x1b7)](_0x3c7dd2(0x1ff)+_0x12dc6b),console[_0x3c7dd2(0x1b7)](_0x3c7dd2(0x19b)+_0x58788c));let _0x18e96d;if(_0x9f40ef[_0x3c7dd2(0x209)]){const _0x2bd4c1=_0x9f40ef[_0x3c7dd2(0x209)],_0x93aa0c=await withSpinner(_0x3c7dd2(0x1bd)+_0x12dc6b+_0x3c7dd2(0x22f),()=>_0x51038f[_0x3c7dd2(0x229)][_0x3c7dd2(0x1f5)](_0x12dc6b),{'verbose':_0x9f40ef[_0x3c7dd2(0x20c)]}),_0x456048=_0x93aa0c[_0x3c7dd2(0x219)],_0x34cc6b=await withSpinner(_0x3c7dd2(0x1a7)+_0x2bd4c1+_0x3c7dd2(0x22f),()=>_0x51038f['segment'][_0x3c7dd2(0x206)](_0x456048,_0x2bd4c1),{'verbose':_0x9f40ef[_0x3c7dd2(0x20c)]});_0x18e96d=_0x34cc6b[_0x3c7dd2(0x219)],_0x9f40ef[_0x3c7dd2(0x20c)]&&console[_0x3c7dd2(0x1b7)](_0x3c7dd2(0x1c9)+_0x18e96d);}const _0x477d4c={'name':_0x58788c,'description':_0x9f40ef['description'],'parentFolderId':_0x18e96d},_0x2c5fe7=await withSpinner('Creating\x20folder\x20\x27'+_0x58788c+'\x27...',()=>_0x51038f[_0x3c7dd2(0x229)]['createFolder'](_0x12dc6b,_0x477d4c),{'verbose':_0x9f40ef[_0x3c7dd2(0x20c)]}),_0x5500c9=_0x2c5fe7[_0x3c7dd2(0x219)];return console[_0x3c7dd2(0x1b7)](_0x3c7dd2(0x196)+_0x5500c9[_0x3c7dd2(0x1c6)]+_0x3c7dd2(0x1a4)+_0x5500c9['id']),await handleSDKOutput([_0x5500c9],_0x9f40ef),0x0;}}export class SegmentViewCommand extends BaseCommand{[a37_0x28b26d(0x1c6)]='segment:view';[a37_0x28b26d(0x22e)]='Show\x20folder\x20or\x20child\x20segment\x20details';async[a37_0x28b26d(0x208)](_0x825e7e){const _0x326803=a37_0x28b26d,{options:_0x5b057a,args:_0x4c2cde,tdx:_0x248efe}=_0x825e7e,_0x186ea7=_0x4c2cde[0x0];if(!_0x186ea7)return console[_0x326803(0x1b7)](_0x326803(0x210)),console[_0x326803(0x1b7)](_0x326803(0x190)),console[_0x326803(0x1b7)](_0x326803(0x1f0)),console[_0x326803(0x1b7)](_0x326803(0x235)),console[_0x326803(0x1b7)](_0x326803(0x231)),console[_0x326803(0x1b7)]('Examples:'),console[_0x326803(0x1b7)](_0x326803(0x1e0)),console[_0x326803(0x1b7)](_0x326803(0x223)),console[_0x326803(0x1b7)](_0x326803(0x1c0)),console[_0x326803(0x1b7)](_0x326803(0x1de)),0x1;try{const _0x37dc30=_0x5b057a[_0x326803(0x1ca)],_0x13fe42=await resolveSegmentTarget(_0x186ea7,_0x37dc30,_0x5b057a[_0x326803(0x20c)]);_0x5b057a['verbose']&&console[_0x326803(0x1b7)]('Target\x20path:\x20'+_0x13fe42);const _0x2ca620=await withSpinner('Resolving\x20\x27'+_0x186ea7+_0x326803(0x22f),()=>_0x248efe[_0x326803(0x229)][_0x326803(0x1da)](_0x13fe42),{'verbose':_0x5b057a[_0x326803(0x20c)]}),_0x4b4f69=_0x2ca620[_0x326803(0x219)];_0x5b057a[_0x326803(0x20c)]&&(console['error'](_0x326803(0x1e9)+_0x4b4f69[_0x326803(0x201)]),console[_0x326803(0x1b7)](_0x326803(0x213)+_0x4b4f69[_0x326803(0x1be)]),_0x4b4f69[_0x326803(0x20e)]&&console[_0x326803(0x1b7)]('Folder\x20ID:\x20'+_0x4b4f69[_0x326803(0x20e)]),_0x4b4f69[_0x326803(0x1a2)]&&console[_0x326803(0x1b7)]('Segment\x20ID:\x20'+_0x4b4f69[_0x326803(0x1a2)]));if(_0x5b057a['web']){if(_0x4b4f69['type']===_0x326803(0x1d3))return console[_0x326803(0x1b7)](_0x326803(0x1eb)),0x1;if(_0x4b4f69[_0x326803(0x201)]===_0x326803(0x1f2))return console[_0x326803(0x1b7)](_0x326803(0x226)),console[_0x326803(0x1b7)]('Use:\x20tdx\x20ps\x20view\x20-w'),0x1;if(!_0x4b4f69[_0x326803(0x1a2)])throw new SDKError(ErrorCode[_0x326803(0x1aa)],_0x326803(0x193));const _0xab1516=getConsoleNextUrl(_0x5b057a['site'],_0x326803(0x225)+_0x4b4f69[_0x326803(0x1be)]+_0x326803(0x1dd)+_0x4b4f69['segmentId']);return console['error'](a37_0x522589[_0x326803(0x1bb)]('✔')+'\x20Opening\x20'+a37_0x522589[_0x326803(0x1a6)](_0xab1516)),openBrowser(_0xab1516),0x0;}if(_0x4b4f69['type']===_0x326803(0x1d3)){if(!_0x4b4f69['folderId'])throw new SDKError(ErrorCode[_0x326803(0x1f4)],_0x326803(0x1a8));const _0x10d401=await withSpinner(_0x326803(0x228),()=>_0x248efe['segment'][_0x326803(0x220)](_0x4b4f69[_0x326803(0x20e)]),{'verbose':_0x5b057a[_0x326803(0x20c)]});await handleSingleObjectOutput(_0x10d401['data'],_0x5b057a);}else{if(_0x4b4f69[_0x326803(0x201)]==='segment'){if(!_0x4b4f69[_0x326803(0x1a2)])throw new SDKError(ErrorCode[_0x326803(0x1aa)],_0x326803(0x193));const _0x19b3bd=await withSpinner(_0x326803(0x1cb),()=>_0x248efe[_0x326803(0x229)][_0x326803(0x1a5)](_0x4b4f69[_0x326803(0x1be)],_0x4b4f69[_0x326803(0x1a2)]),{'verbose':_0x5b057a['verbose']}),_0x52dc2c=getConsoleNextUrl(_0x5b057a[_0x326803(0x1fb)],_0x326803(0x225)+_0x4b4f69[_0x326803(0x1be)]+_0x326803(0x1dd)+_0x4b4f69[_0x326803(0x1a2)]),_0x2d59a5=_0x19b3bd[_0x326803(0x219)];_0x2d59a5[_0x326803(0x197)]=_0x52dc2c,await handleSingleObjectOutput(_0x2d59a5,_0x5b057a);}else return console[_0x326803(0x1b7)](_0x326803(0x204)),console[_0x326803(0x1b7)](_0x326803(0x19d)),0x1;}return 0x0;}catch(_0x3e5b75){if(_0x3e5b75 instanceof SDKError)return console[_0x326803(0x1b7)](_0x326803(0x1a9)+_0x3e5b75[_0x326803(0x232)]),_0x3e5b75['cause']&&console['error'](_0x326803(0x1d6)+_0x3e5b75[_0x326803(0x19c)]),0x1;throw _0x3e5b75;}}}export const SegmentInfoCommand=SegmentViewCommand;export class SegmentDescCommand extends BaseCommand{[a37_0x28b26d(0x1c6)]=a37_0x28b26d(0x18e);[a37_0x28b26d(0x22e)]=a37_0x28b26d(0x217);async['execute'](_0x2b259c){const _0x43fdbd=a37_0x28b26d,{options:_0x4efdc6,args:_0xce3873,tdx:_0x447f61}=_0x2b259c,_0x3c0b5d=_0xce3873[0x0];if(!_0x3c0b5d)return console[_0x43fdbd(0x1b7)](_0x43fdbd(0x1d8)),console[_0x43fdbd(0x1b7)](_0x43fdbd(0x1cf)),console[_0x43fdbd(0x1b7)]('\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20desc\x20<path/to/segment.yml>'),console[_0x43fdbd(0x1b7)]('Examples:'),console[_0x43fdbd(0x1b7)]('\x20\x20tdx\x20sg\x20desc\x20\x22Premium\x20Users\x22'),console[_0x43fdbd(0x1b7)]('\x20\x20tdx\x20sg\x20desc\x20segments/my-audience/premium-users.yml'),0x1;try{const _0x387d60=_0x4efdc6[_0x43fdbd(0x1ca)],_0x27b5ab=await resolveSegmentTarget(_0x3c0b5d,_0x387d60,_0x4efdc6['verbose']);_0x4efdc6['verbose']&&console[_0x43fdbd(0x1b7)](_0x43fdbd(0x1df)+_0x27b5ab);const _0x733b0b=await withSpinner(_0x43fdbd(0x1ad)+_0x3c0b5d+_0x43fdbd(0x22f),()=>_0x447f61[_0x43fdbd(0x229)][_0x43fdbd(0x1da)](_0x27b5ab),{'verbose':_0x4efdc6[_0x43fdbd(0x20c)]}),_0x14502e=_0x733b0b[_0x43fdbd(0x219)];_0x4efdc6['verbose']&&(console[_0x43fdbd(0x1b7)](_0x43fdbd(0x1e9)+_0x14502e[_0x43fdbd(0x201)]),console[_0x43fdbd(0x1b7)]('Parent\x20ID:\x20'+_0x14502e[_0x43fdbd(0x1be)]));if(_0x14502e[_0x43fdbd(0x201)]===_0x43fdbd(0x1d3))return console['error'](_0x43fdbd(0x1b5)),console[_0x43fdbd(0x1b7)](_0x43fdbd(0x1ce)),0x1;if(_0x14502e['type']===_0x43fdbd(0x1f2))return console[_0x43fdbd(0x1b7)](_0x43fdbd(0x1b3)),console[_0x43fdbd(0x1b7)](_0x43fdbd(0x1d4)),0x1;if(!_0x14502e['segmentId'])throw new SDKError(ErrorCode[_0x43fdbd(0x1aa)],_0x43fdbd(0x193));const _0x3c075d=await withSpinner(_0x43fdbd(0x215),()=>_0x447f61[_0x43fdbd(0x229)][_0x43fdbd(0x1ea)](_0x14502e[_0x43fdbd(0x1be)],_0x14502e[_0x43fdbd(0x1a2)]),{'verbose':_0x4efdc6[_0x43fdbd(0x20c)]}),_0x1e847e=_0x3c075d[_0x43fdbd(0x219)],_0x6af300=await executeSchemaQuery(_0x1e847e,_0x447f61,_0x4efdc6);return await handleQueryOutput(_0x6af300,_0x4efdc6),0x0;}catch(_0x5b4227){if(_0x5b4227 instanceof SDKError)return console[_0x43fdbd(0x1b7)]('Error:\x20'+_0x5b4227[_0x43fdbd(0x232)]),_0x5b4227[_0x43fdbd(0x19c)]&&console[_0x43fdbd(0x1b7)]('\x20\x20Cause:\x20'+_0x5b4227[_0x43fdbd(0x19c)]),0x1;throw _0x5b4227;}}}
1
+ function a37_0x29e9(_0x512054,_0x1acac4){_0x512054=_0x512054-0x16a;const _0x269283=a37_0x2692();let _0x29e9ba=_0x269283[_0x512054];return _0x29e9ba;}const a37_0x10bb76=a37_0x29e9;(function(_0x119436,_0x4a70f8){const _0x1370cb=a37_0x29e9,_0xf8cd58=_0x119436();while(!![]){try{const _0x3d2ad7=-parseInt(_0x1370cb(0x212))/0x1+-parseInt(_0x1370cb(0x1d9))/0x2*(-parseInt(_0x1370cb(0x1c4))/0x3)+parseInt(_0x1370cb(0x196))/0x4*(-parseInt(_0x1370cb(0x197))/0x5)+-parseInt(_0x1370cb(0x172))/0x6*(-parseInt(_0x1370cb(0x1f9))/0x7)+parseInt(_0x1370cb(0x1b5))/0x8+parseInt(_0x1370cb(0x200))/0x9+parseInt(_0x1370cb(0x18f))/0xa*(-parseInt(_0x1370cb(0x19b))/0xb);if(_0x3d2ad7===_0x4a70f8)break;else _0xf8cd58['push'](_0xf8cd58['shift']());}catch(_0xf0ec9b){_0xf8cd58['push'](_0xf8cd58['shift']());}}}(a37_0x2692,0xebf11));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_0x6933f7 from'chalk';async function resolveSegmentTarget(_0x183a40,_0x294974,_0x36fe2d){const _0x1943f1=a37_0x29e9;if(isYamlFilePath(_0x183a40))try{const _0x32c7c7=await resolveYamlFilePath(_0x183a40);return _0x36fe2d&&(console[_0x1943f1(0x1a2)](_0x1943f1(0x1b1)+_0x183a40),console[_0x1943f1(0x1a2)]('\x20\x20Parent\x20segment:\x20'+_0x32c7c7[_0x1943f1(0x1a1)]),console['error'](_0x1943f1(0x19d)+_0x32c7c7[_0x1943f1(0x193)]),console[_0x1943f1(0x1a2)]('\x20\x20Folder\x20path:\x20'+(_0x32c7c7['folderPath']||_0x1943f1(0x1ab))),console[_0x1943f1(0x1a2)](_0x1943f1(0x1c6)+_0x32c7c7[_0x1943f1(0x1ce)])),_0x32c7c7[_0x1943f1(0x1ce)];}catch(_0x10dd9b){throw new SDKError(ErrorCode[_0x1943f1(0x1f6)],_0x1943f1(0x18d)+_0x10dd9b[_0x1943f1(0x204)]);}if(!_0x294974)throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x1943f1(0x1c8));return _0x294974+'/'+_0x183a40;}export class SegmentDescribeCommand extends BaseCommand{['name']=a37_0x10bb76(0x1bc);[a37_0x10bb76(0x183)]=a37_0x10bb76(0x203);async[a37_0x10bb76(0x1a6)](_0x2a56fc){const _0x1205f0=a37_0x10bb76,{options:_0x381aa4,args:_0x55835a,tdx:_0x3def01}=_0x2a56fc,_0x28fdc8=_0x55835a[0x0],_0x1ad53b=!_0x28fdc8&&!!_0x381aa4[_0x1205f0(0x1a1)],_0xecd306=_0x28fdc8||_0x381aa4['parentSegment'];if(!_0xecd306)return console[_0x1205f0(0x1a2)](_0x1205f0(0x1bf)),console[_0x1205f0(0x1a2)](_0x1205f0(0x189)),console['error'](_0x1205f0(0x1f7)),console[_0x1205f0(0x1a2)](_0x1205f0(0x1f2)),console[_0x1205f0(0x1a2)](_0x1205f0(0x19e)),console['error'](_0x1205f0(0x1d2)),console[_0x1205f0(0x1a2)]('\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>'),0x1;try{const _0x482405=_0x381aa4[_0x1205f0(0x1ad)];let _0x4fe53a=_0xecd306;!_0x1ad53b&&_0x482405&&!_0xecd306[_0x1205f0(0x206)]('/')&&(_0x4fe53a=_0x482405+'/'+_0xecd306,_0x381aa4[_0x1205f0(0x186)]&&console[_0x1205f0(0x1a2)](_0x1205f0(0x16f)+_0x4fe53a));const _0x42f48e=await withSpinner(_0x1205f0(0x1d4)+_0x4fe53a+'\x27...',()=>_0x3def01[_0x1205f0(0x1c7)][_0x1205f0(0x1b4)](_0x4fe53a),{'verbose':_0x381aa4[_0x1205f0(0x186)]}),_0x2a5bef=_0x42f48e[_0x1205f0(0x1e6)];_0x381aa4['verbose']&&(console[_0x1205f0(0x1a2)](_0x1205f0(0x176)+_0x2a5bef[_0x1205f0(0x19a)]),console[_0x1205f0(0x1a2)](_0x1205f0(0x1b9)+_0x2a5bef['parentId']),_0x2a5bef[_0x1205f0(0x1b2)]&&console[_0x1205f0(0x1a2)](_0x1205f0(0x1cf)+_0x2a5bef[_0x1205f0(0x1b2)]),_0x2a5bef['segmentId']&&console[_0x1205f0(0x1a2)](_0x1205f0(0x207)+_0x2a5bef[_0x1205f0(0x20e)]));if(_0x2a5bef[_0x1205f0(0x19a)]===_0x1205f0(0x192)){const _0x60a2f6=await withSpinner(_0x1205f0(0x1b8),()=>_0x3def01[_0x1205f0(0x1c7)][_0x1205f0(0x17d)](_0x2a5bef[_0x1205f0(0x1fa)]),{'verbose':_0x381aa4[_0x1205f0(0x186)]});await handleSingleObjectOutput(_0x60a2f6[_0x1205f0(0x1e6)],_0x381aa4);}else{if(_0x2a5bef['type']===_0x1205f0(0x1ef)){if(!_0x2a5bef['folderId'])throw new SDKError(ErrorCode[_0x1205f0(0x1ac)],_0x1205f0(0x1c3));const _0x384df3=await withSpinner('Fetching\x20folder\x20details...',()=>_0x3def01['segment'][_0x1205f0(0x1b7)](_0x2a5bef[_0x1205f0(0x1b2)]),{'verbose':_0x381aa4[_0x1205f0(0x186)]});await handleSingleObjectOutput(_0x384df3[_0x1205f0(0x1e6)],_0x381aa4);}else{if(_0x2a5bef[_0x1205f0(0x19a)]==='segment'){if(!_0x2a5bef[_0x1205f0(0x20e)])throw new SDKError(ErrorCode[_0x1205f0(0x1e4)],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x386473=await withSpinner('Fetching\x20segment\x20details...',()=>_0x3def01[_0x1205f0(0x1c7)][_0x1205f0(0x1fe)](_0x2a5bef['parentId'],_0x2a5bef[_0x1205f0(0x20e)]),{'verbose':_0x381aa4[_0x1205f0(0x186)]});await handleSingleObjectOutput(_0x386473[_0x1205f0(0x1e6)],_0x381aa4);}}}return 0x0;}catch(_0x2676cd){if(_0x2676cd instanceof SDKError)return console[_0x1205f0(0x1a2)](_0x1205f0(0x1e5)+_0x2676cd[_0x1205f0(0x204)]),_0x2676cd['cause']&&console['error']('\x20\x20Cause:\x20'+_0x2676cd[_0x1205f0(0x1b0)]),0x1;throw _0x2676cd;}}}export class SegmentShowCommand extends BaseCommand{[a37_0x10bb76(0x191)]=a37_0x10bb76(0x1c0);['description']=a37_0x10bb76(0x1ec);async[a37_0x10bb76(0x1a6)](_0x9a74ce){const _0x37b80c=a37_0x10bb76,{options:_0x2a42d0,args:_0x160f76,tdx:_0x603642}=_0x9a74ce,_0x5eccc0=_0x160f76[0x0];if(!_0x5eccc0)return console[_0x37b80c(0x1a2)](_0x37b80c(0x190)),console[_0x37b80c(0x1a2)](_0x37b80c(0x1a8)),console['error']('\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20show\x20<path/to/segment.yml>'),console[_0x37b80c(0x1a2)]('Examples:'),console[_0x37b80c(0x1a2)](_0x37b80c(0x211)),console[_0x37b80c(0x1a2)](_0x37b80c(0x1c2)),0x1;try{const _0x36af9e=_0x2a42d0[_0x37b80c(0x1a1)],_0x748497=await resolveSegmentTarget(_0x5eccc0,_0x36af9e,_0x2a42d0[_0x37b80c(0x186)]);_0x2a42d0[_0x37b80c(0x186)]&&console[_0x37b80c(0x1a2)]('Target\x20path:\x20'+_0x748497);const _0x145863=await withSpinner(_0x37b80c(0x1e3)+_0x5eccc0+_0x37b80c(0x20d),()=>_0x603642[_0x37b80c(0x1c7)][_0x37b80c(0x1b4)](_0x748497),{'verbose':_0x2a42d0[_0x37b80c(0x186)]}),_0x492294=_0x145863[_0x37b80c(0x1e6)];_0x2a42d0[_0x37b80c(0x186)]&&(console[_0x37b80c(0x1a2)](_0x37b80c(0x176)+_0x492294['type']),console[_0x37b80c(0x1a2)](_0x37b80c(0x1b9)+_0x492294[_0x37b80c(0x1fa)]));if(_0x492294[_0x37b80c(0x19a)]===_0x37b80c(0x1ef))return console[_0x37b80c(0x1a2)](_0x37b80c(0x199)),console[_0x37b80c(0x1a2)](_0x37b80c(0x17e)),0x1;if(_0x492294[_0x37b80c(0x19a)]===_0x37b80c(0x192))return console['error'](_0x37b80c(0x1a5)),console['error'](_0x37b80c(0x1db)),0x1;if(!_0x492294[_0x37b80c(0x20e)])throw new SDKError(ErrorCode[_0x37b80c(0x1e4)],_0x37b80c(0x1cb));const _0x5e8f5e=await withSpinner(_0x37b80c(0x174),()=>_0x603642[_0x37b80c(0x1c7)][_0x37b80c(0x1e2)](_0x492294[_0x37b80c(0x1fa)],_0x492294[_0x37b80c(0x20e)]),{'verbose':_0x2a42d0[_0x37b80c(0x186)]});let _0xdda8=_0x5e8f5e[_0x37b80c(0x1e6)];const _0x2fbcff=resolveLimit(_0x2a42d0[_0x37b80c(0x17c)],DEFAULT_DISPLAY_LIMIT),_0x53c4b4=/\bLIMIT\s+\d+/i['test'](_0xdda8);!_0x53c4b4&&(_0xdda8=_0xdda8['trim']()[_0x37b80c(0x19c)](/;+$/,''),_0xdda8=_0x37b80c(0x1cc)+_0xdda8+_0x37b80c(0x1df)+_0x2fbcff);_0x2a42d0[_0x37b80c(0x186)]&&console[_0x37b80c(0x1a2)](_0x37b80c(0x1f1)+_0xdda8);const _0x4a75b1=await withProgressSpinner(_0x37b80c(0x17a),async _0x141f1b=>{const _0x5ab354=_0x37b80c,_0x3433e4=await _0x603642[_0x5ab354(0x1dc)][_0x5ab354(0x1a6)](_0xdda8,{'catalog':'td','schema':_0x5ab354(0x1a4),'onJobId':_0x14c121=>{const _0x3f3389=_0x5ab354;_0x141f1b[_0x3f3389(0x1f5)](_0x14c121);}});return _0x3433e4;},{'verbose':_0x2a42d0['verbose']}),_0x5a4ffb=_0x4a75b1[_0x37b80c(0x1e6)],_0x4eb862=_0x5a4ffb[_0x37b80c(0x194)]?_0x37b80c(0x1e7)+_0x5a4ffb[_0x37b80c(0x194)]+']':'';return console[_0x37b80c(0x1a2)]('✔\x20Query\x20completed:\x20Processed\x20'+_0x5a4ffb[_0x37b80c(0x1e8)][_0x37b80c(0x1f8)][_0x37b80c(0x1fd)]()+'\x20rows\x20'+(_0x37b80c(0x1af)+formatElapsed(_0x5a4ffb[_0x37b80c(0x1e8)]['elapsedTimeMillis'])+_0x4eb862)),await handleQueryOutput(_0x5a4ffb,_0x2a42d0),0x0;}catch(_0x34df08){if(_0x34df08 instanceof SDKError)return console[_0x37b80c(0x1a2)](_0x37b80c(0x198)+_0x34df08[_0x37b80c(0x16d)]+']'),console[_0x37b80c(0x1a2)]('\x0a'+_0x34df08[_0x37b80c(0x204)]),0x1;throw _0x34df08;}}}export class SegmentFolderListCommand extends BaseCommand{[a37_0x10bb76(0x191)]=a37_0x10bb76(0x1cd);['description']='List\x20segment\x20folders\x20under\x20a\x20parent\x20segment';async[a37_0x10bb76(0x1a6)](_0x5d403c){const _0x157c67=a37_0x10bb76,{options:_0x2b77a6,args:_0x41d2f3,tdx:_0x38a294}=_0x5d403c;if(_0x41d2f3[_0x157c67(0x1d7)]===0x0)return console['error'](_0x157c67(0x1aa)),console['error']('Usage:\x20tdx\x20segment\x20folder\x20list\x20<parent_name>'),0x1;const _0x5e4cee=_0x41d2f3[0x0];try{_0x2b77a6[_0x157c67(0x186)]&&(console['error']('Site:\x20'+_0x2b77a6[_0x157c67(0x16e)]),console[_0x157c67(0x1a2)](_0x157c67(0x1fb)+_0x5e4cee));const _0xc67580=await withSpinner(_0x157c67(0x182)+_0x5e4cee+'\x27...',()=>_0x38a294[_0x157c67(0x1c7)][_0x157c67(0x209)](_0x5e4cee),{'verbose':_0x2b77a6['verbose']}),_0x2d7865=_0xc67580[_0x157c67(0x1e6)];_0x2b77a6[_0x157c67(0x186)]&&console[_0x157c67(0x1a2)](_0x157c67(0x1d5)+_0x2d7865);const _0x5ee067=await withSpinner('Listing\x20folders\x20for\x20parent\x20\x27'+_0x5e4cee+_0x157c67(0x20d),()=>_0x38a294[_0x157c67(0x1c7)][_0x157c67(0x179)](_0x2d7865),{'verbose':_0x2b77a6[_0x157c67(0x186)]}),_0x5e3948=_0x5ee067[_0x157c67(0x1e6)];return console[_0x157c67(0x1a2)](_0x157c67(0x20c)+_0x5e3948['length']+'\x20folder'+(_0x5e3948[_0x157c67(0x1d7)]!==0x1?'s':'')),await handleSDKOutput(_0x5e3948,_0x2b77a6),0x0;}catch(_0x2cdbdf){if(_0x2cdbdf instanceof SDKError)return console[_0x157c67(0x1a2)](_0x157c67(0x1e5)+_0x2cdbdf[_0x157c67(0x204)]),_0x2cdbdf[_0x157c67(0x1b0)]&&console[_0x157c67(0x1a2)](_0x157c67(0x1dd)+_0x2cdbdf[_0x157c67(0x1b0)]),0x1;throw _0x2cdbdf;}}}function a37_0x2692(){const _0x39daaf=['replace','\x20\x20Segment\x20name:\x20','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience/Marketing/High\x20Value\x22','\x20Opening\x20','Cannot\x20get\x20SQL\x20for\x20parent\x20segment\x20with\x20this\x20command.\x20Use:\x20tdx\x20ps\x20sql','parentSegment','error','✔\x20Created\x20folder\x20\x27','information_schema','Error:\x20Cannot\x20execute\x20query\x20for\x20parent\x20segment\x20with\x20this\x20command.','execute','Error:\x20Cannot\x20show\x20schema\x20for\x20parent\x20segment\x20with\x20this\x20command.','Usage:\x20tdx\x20sg\x20show\x20<name>','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20desc\x20<path/to/segment.yml>','Error:\x20Parent\x20segment\x20name\x20is\x20required','(root)','SEGMENT_FOLDER_NOT_FOUND','segmentPath','createFolder','in\x20','cause','Resolved\x20YAML\x20file:\x20','folderId','\x20\x20Local\x20YAML\x20file:\x20\x20\x20\x20\x20\x20tdx\x20sg\x20sql\x20--path\x20<file-path>','resolvePathToResource','9919544TlbYFC','jsonl','getFolder','Fetching\x20parent\x20segment\x20details...','Parent\x20ID:\x20','Usage:\x20tdx\x20segment\x20folder\x20show\x20<parent_name/folder_name>','content','segment:describe','url','segment:sql','Error:\x20Path\x20or\x20name\x20is\x20required','segment:show','Usage:\x20tdx\x20segment\x20folder\x20create\x20<parent_name>\x20<folder_name>\x20[options]','\x20\x20tdx\x20sg\x20show\x20segments/my-audience/premium-users.yml','Folder\x20ID\x20missing\x20from\x20resolved\x20path','516PrYPlU','Error:\x20Cannot\x20open\x20folder\x20in\x20web\x20browser.\x20Use\x20a\x20segment\x20name\x20instead.','\x20\x20Full\x20path:\x20','segment','No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22','getSegmentSQLFromYaml','\x20\x20tdx\x20sg\x20sql\x20\x22Premium\x20Users\x22','Segment\x20ID\x20missing\x20from\x20resolved\x20path','SELECT\x20*\x20FROM\x20(\x0a','segment:folder:list','fullPath','Folder\x20ID:\x20','Fetching\x20folder\x20details...','\x20\x20tdx\x20sg\x20view\x20segments/my-audience/premium-users.yml','\x20\x20tdx\x20segment\x20describe\x20\x22High\x20Value\x22\x20\x20\x20\x20#\x20Relative\x20to\x20current\x20context','parentFolder','Resolving\x20path\x20\x27','Resolved\x20parent\x20ID:\x20','log','length','\x27\x20with\x20ID:\x20','3766TsoPei','Error:\x20Cannot\x20open\x20parent\x20segment\x20with\x20this\x20command.','Use:\x20tdx\x20ps\x20show','query','\x20\x20Cause:\x20','\x20\x20tdx\x20sg\x20view\x20\x22Marketing\x22\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20folder\x20details','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20-w\x20\x20#\x20Open\x20segment\x20in\x20web\x20browser','Options:','getSegmentSQL','Resolving\x20\x27','SEGMENT_NOT_FOUND','Error:\x20','data','\x20[Job\x20ID:\x20','stats','resolveFolderId','/app/ps/','Use:\x20tdx\x20ps\x20view\x20-w','Execute\x20child\x20segment\x20SQL\x20query\x20and\x20show\x20results','Create\x20segment\x20folder\x20for\x20organization','json','folder','Use:\x20tdx\x20ps\x20view','SQL\x20query:\x0a','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience\x22','getSQLFromServerSegment','Creating\x20folder\x20\x27','setJobId','INVALID_ARGUMENT','Examples:','processedRows','86233bvwgoZ','parentId','Parent\x20name:\x20','Show\x20segment\x20folder\x20details','toLocaleString','getSegment','Target\x20path:\x20','12655395ENPpZW','Folder\x20name:\x20','Site:\x20','Show\x20segment\x20or\x20folder\x20details','message','Resolved\x20folder\x20ID:\x20','includes','Segment\x20ID:\x20','Usage:\x20tdx\x20sg\x20desc\x20<name>','resolveParentId','segment:view','Parent\x20segment:\x20','✔\x20Found\x20','\x27...','segmentId','Error:\x20Folder\x20name\x20is\x20required\x20(use\x20parent_name/folder_name\x20format)','Get\x20SQL\x20query\x20for\x20child\x20segment','\x20\x20tdx\x20sg\x20show\x20\x22Premium\x20Users\x22','834408OtuIWY','\x20\x20tdx\x20sg\x20sql\x20--path\x20','Error:\x20Cannot\x20view\x20parent\x20segment\x20details\x20with\x20this\x20command.','path','code','site','Resolved\x20relative\x20path\x20to:\x20','cyan','Usage:','318fjfHdU','Error:\x20Folder\x20or\x20segment\x20name,\x20or\x20YAML\x20file\x20path\x20is\x20required','Fetching\x20SQL\x20for\x20segment...','Fetching\x20SQL\x20from\x20rule...','Resolved\x20type:\x20','\x20\x20-w,\x20--web\x20\x20Open\x20segment\x20in\x20web\x20browser','getSQLFromYamlFile','listFolders','Executing\x20segment\x20query...','Error:\x20Folder\x20reference\x20is\x20required','limit','getParent','Use:\x20tdx\x20sg\x20view\x20<name>\x20\x20#\x20To\x20show\x20folder\x20details','Error:\x20Specify\x20either\x20segment\x20name\x20or\x20--path,\x20not\x20both','segment:desc','Resolved:\x20','Resolving\x20parent\x20segment\x20\x27','description','Resolving\x20parent\x20folder\x20\x27','Resolving\x20folder\x20\x27','verbose','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20\x20\x20\x20\x20#\x20View\x20child\x20segment\x20details','Error:\x20Parent\x20segment\x20name\x20and\x20folder\x20name\x20are\x20required','Usage:\x20tdx\x20segment\x20describe\x20<path>','Usage:\x20tdx\x20sg\x20view\x20<name>\x20[-w]','format','red','Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20','/e/','1840390ubWcMj','Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required','name','parent','segmentName','jobId','Show\x20child\x20segment\x20schema\x20(column\x20types)','1156DtXYKw','9235xXSNYc','✖\x20Query\x20failed\x20[','Error:\x20Cannot\x20execute\x20SQL\x20query\x20on\x20a\x20folder.','type','77xkbEup'];a37_0x2692=function(){return _0x39daaf;};return a37_0x2692();}export class SegmentFolderShowCommand extends BaseCommand{[a37_0x10bb76(0x191)]='segment:folder:show';[a37_0x10bb76(0x183)]=a37_0x10bb76(0x1fc);async['execute'](_0x33205c){const _0x58947a=a37_0x10bb76,{options:_0x283497,args:_0x4c40a1,tdx:_0x7bbae2}=_0x33205c;if(_0x4c40a1['length']===0x0)return console[_0x58947a(0x1a2)](_0x58947a(0x17b)),console[_0x58947a(0x1a2)](_0x58947a(0x1ba)),0x1;try{const {parentId:_0x3380bd,childId:_0x399011}=parseSegmentRef(_0x4c40a1[0x0]);_0x283497['verbose']&&(console[_0x58947a(0x1a2)]('Site:\x20'+_0x283497[_0x58947a(0x16e)]),console[_0x58947a(0x1a2)](_0x58947a(0x1fb)+_0x3380bd),_0x399011&&console[_0x58947a(0x1a2)](_0x58947a(0x201)+_0x399011));if(!_0x399011)return console['error'](_0x58947a(0x20f)),0x1;const _0x4a252b=await withSpinner(_0x58947a(0x182)+_0x3380bd+'\x27...',()=>_0x7bbae2['segment']['resolveParentId'](_0x3380bd),{'verbose':_0x283497['verbose']}),_0x15040e=_0x4a252b[_0x58947a(0x1e6)];_0x283497[_0x58947a(0x186)]&&console['error'](_0x58947a(0x1d5)+_0x15040e);const _0x40ca86=await withSpinner(_0x58947a(0x185)+_0x399011+_0x58947a(0x20d),()=>_0x7bbae2['segment']['resolveFolderId'](_0x15040e,_0x399011),{'verbose':_0x283497[_0x58947a(0x186)]}),_0x1627ad=_0x40ca86[_0x58947a(0x1e6)];_0x283497[_0x58947a(0x186)]&&console[_0x58947a(0x1a2)](_0x58947a(0x205)+_0x1627ad);const _0x487228=await withSpinner('Fetching\x20folder\x20\x27'+_0x399011+_0x58947a(0x20d),()=>_0x7bbae2[_0x58947a(0x1c7)][_0x58947a(0x1b7)](_0x1627ad),{'verbose':_0x283497[_0x58947a(0x186)]});return await handleSDKOutput([_0x487228[_0x58947a(0x1e6)]],_0x283497),0x0;}catch(_0x9b0229){if(_0x9b0229 instanceof SDKError)return console[_0x58947a(0x1a2)](_0x58947a(0x1e5)+_0x9b0229[_0x58947a(0x204)]),_0x9b0229['cause']&&console['error']('\x20\x20Cause:\x20'+_0x9b0229[_0x58947a(0x1b0)]),0x1;throw _0x9b0229;}}}export class SegmentSQLCommand extends BaseCommand{[a37_0x10bb76(0x191)]=a37_0x10bb76(0x1be);[a37_0x10bb76(0x183)]=a37_0x10bb76(0x210);async['execute'](_0x10f87e){const _0x54a42e=a37_0x10bb76,{options:_0x329427,args:_0x513ed8}=_0x10f87e,_0x446517=_0x329427,_0x2632d6=_0x446517[_0x54a42e(0x16c)],_0x55db7a=_0x513ed8[0x0];if(!_0x55db7a&&!_0x2632d6)return console['error'](a37_0x6933f7[_0x54a42e(0x18c)]('Error:\x20Segment\x20name\x20or\x20--path\x20is\x20required')),console[_0x54a42e(0x1a2)](_0x54a42e(0x171)),console[_0x54a42e(0x1a2)]('\x20\x20Server-side\x20segment:\x20\x20tdx\x20sg\x20sql\x20<name>'),console['error'](_0x54a42e(0x1b3)),console['error'](_0x54a42e(0x1f7)),console['error'](_0x54a42e(0x1ca)),console[_0x54a42e(0x1a2)]('\x20\x20tdx\x20sg\x20sql\x20--path\x20segments/my-audience/premium-users.yml'),0x1;if(_0x55db7a&&_0x2632d6)return console[_0x54a42e(0x1a2)](a37_0x6933f7[_0x54a42e(0x18c)](_0x54a42e(0x17f))),0x1;try{let _0x105223;if(_0x2632d6)_0x105223=await this['getSQLFromYamlFile'](_0x2632d6,_0x10f87e);else{if(isYamlFilePath(_0x55db7a))return console[_0x54a42e(0x1a2)](a37_0x6933f7[_0x54a42e(0x18c)]('Error:\x20YAML\x20file\x20paths\x20must\x20be\x20specified\x20with\x20--path\x20option')),console[_0x54a42e(0x1a2)](_0x54a42e(0x16a)+_0x55db7a),0x1;else _0x105223=await this[_0x54a42e(0x1f3)](_0x55db7a,_0x10f87e);}return _0x329427[_0x54a42e(0x18b)]===_0x54a42e(0x1ee)||_0x329427[_0x54a42e(0x18b)]===_0x54a42e(0x1b6)?await handleSDKOutput([{'sql':_0x105223}],_0x329427):console[_0x54a42e(0x1d6)](_0x105223),0x0;}catch(_0x18b172){if(_0x18b172 instanceof SDKError)return console[_0x54a42e(0x1a2)](_0x54a42e(0x1e5)+_0x18b172[_0x54a42e(0x204)]),_0x18b172['cause']&&console[_0x54a42e(0x1a2)](_0x54a42e(0x1dd)+_0x18b172['cause']),0x1;throw _0x18b172;}}async[a37_0x10bb76(0x178)](_0x5e1634,_0x420aa1){const _0x1eecd1=a37_0x10bb76,{options:_0x34a8c0,tdx:_0x64c800}=_0x420aa1;let _0x53f8a3;try{_0x53f8a3=await resolveYamlFilePath(_0x5e1634);}catch(_0x50d3ab){throw new SDKError(ErrorCode['INVALID_ARGUMENT'],'Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20'+_0x50d3ab[_0x1eecd1(0x204)]);}_0x34a8c0[_0x1eecd1(0x186)]&&console[_0x1eecd1(0x1a2)](_0x1eecd1(0x181)+_0x53f8a3[_0x1eecd1(0x1a1)]+'/'+_0x53f8a3['segmentName']);const _0x1d8865=await withSpinner(_0x1eecd1(0x175),()=>_0x64c800[_0x1eecd1(0x1c7)][_0x1eecd1(0x1c9)](_0x53f8a3[_0x1eecd1(0x1bb)],_0x53f8a3[_0x1eecd1(0x1a1)],_0x53f8a3['segmentName']),{'verbose':_0x34a8c0[_0x1eecd1(0x186)]});return _0x1d8865['data'];}async[a37_0x10bb76(0x1f3)](_0x43ae88,_0x412443){const _0x40ef95=a37_0x10bb76,{options:_0x2ec31f,tdx:_0x38214a}=_0x412443,_0x30f548=_0x2ec31f[_0x40ef95(0x1a1)],_0x141caa=await resolveSegmentTarget(_0x43ae88,_0x30f548,_0x2ec31f['verbose']);_0x2ec31f[_0x40ef95(0x186)]&&console['error'](_0x40ef95(0x1ff)+_0x141caa);const _0x5e1a25=await withSpinner('Resolving\x20\x27'+_0x43ae88+_0x40ef95(0x20d),()=>_0x38214a['segment']['resolvePathToResource'](_0x141caa),{'verbose':_0x2ec31f[_0x40ef95(0x186)]}),_0x4d2bdf=_0x5e1a25[_0x40ef95(0x1e6)];_0x2ec31f[_0x40ef95(0x186)]&&(console[_0x40ef95(0x1a2)](_0x40ef95(0x176)+_0x4d2bdf[_0x40ef95(0x19a)]),console[_0x40ef95(0x1a2)](_0x40ef95(0x1b9)+_0x4d2bdf[_0x40ef95(0x1fa)]));if(_0x4d2bdf[_0x40ef95(0x19a)]==='folder')throw new SDKError(ErrorCode[_0x40ef95(0x1f6)],'Cannot\x20get\x20SQL\x20query\x20for\x20a\x20folder.\x20Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.');if(_0x4d2bdf[_0x40ef95(0x19a)]===_0x40ef95(0x192))throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x40ef95(0x1a0));if(!_0x4d2bdf[_0x40ef95(0x20e)])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x1c33a4=await withSpinner('Fetching\x20SQL\x20for\x20segment...',()=>_0x38214a[_0x40ef95(0x1c7)][_0x40ef95(0x1e2)](_0x4d2bdf[_0x40ef95(0x1fa)],_0x4d2bdf[_0x40ef95(0x20e)]),{'verbose':_0x2ec31f[_0x40ef95(0x186)]});return _0x1c33a4[_0x40ef95(0x1e6)];}}export class SegmentFolderCreateCommand extends BaseCommand{[a37_0x10bb76(0x191)]='segment:folder:create';['description']=a37_0x10bb76(0x1ed);async['execute'](_0x37eae){const _0x561fb7=a37_0x10bb76,{options:_0x9232a8,args:_0x28199c,tdx:_0x14ff88}=_0x37eae,_0x12fe5b=_0x9232a8;if(_0x28199c[_0x561fb7(0x1d7)]<0x2)return console['error'](_0x561fb7(0x188)),console[_0x561fb7(0x1a2)](_0x561fb7(0x1c1)),0x1;const _0x46aebd=_0x28199c[0x0],_0x17d073=_0x28199c[0x1];_0x12fe5b[_0x561fb7(0x186)]&&(console[_0x561fb7(0x1a2)](_0x561fb7(0x202)+_0x12fe5b[_0x561fb7(0x16e)]),console[_0x561fb7(0x1a2)](_0x561fb7(0x20b)+_0x46aebd),console['error'](_0x561fb7(0x201)+_0x17d073));let _0x1d433f;if(_0x12fe5b[_0x561fb7(0x1d3)]){const _0x188a89=_0x12fe5b[_0x561fb7(0x1d3)],_0xcf156a=await withSpinner(_0x561fb7(0x182)+_0x46aebd+'\x27...',()=>_0x14ff88['segment'][_0x561fb7(0x209)](_0x46aebd),{'verbose':_0x12fe5b[_0x561fb7(0x186)]}),_0x17086d=_0xcf156a['data'],_0x2426f7=await withSpinner(_0x561fb7(0x184)+_0x188a89+'\x27...',()=>_0x14ff88[_0x561fb7(0x1c7)][_0x561fb7(0x1e9)](_0x17086d,_0x188a89),{'verbose':_0x12fe5b[_0x561fb7(0x186)]});_0x1d433f=_0x2426f7[_0x561fb7(0x1e6)],_0x12fe5b['verbose']&&console[_0x561fb7(0x1a2)]('Resolved\x20parent\x20folder\x20ID:\x20'+_0x1d433f);}const _0x517a72={'name':_0x17d073,'description':_0x12fe5b[_0x561fb7(0x183)],'parentFolderId':_0x1d433f},_0x104091=await withSpinner(_0x561fb7(0x1f4)+_0x17d073+_0x561fb7(0x20d),()=>_0x14ff88[_0x561fb7(0x1c7)][_0x561fb7(0x1ae)](_0x46aebd,_0x517a72),{'verbose':_0x12fe5b[_0x561fb7(0x186)]}),_0x9eb52d=_0x104091[_0x561fb7(0x1e6)];return console[_0x561fb7(0x1a2)](_0x561fb7(0x1a3)+_0x9eb52d['name']+_0x561fb7(0x1d8)+_0x9eb52d['id']),await handleSDKOutput([_0x9eb52d],_0x12fe5b),0x0;}}export class SegmentViewCommand extends BaseCommand{[a37_0x10bb76(0x191)]=a37_0x10bb76(0x20a);['description']='Show\x20folder\x20or\x20child\x20segment\x20details';async['execute'](_0x396d18){const _0x54bab6=a37_0x10bb76,{options:_0x980a15,args:_0x518f79,tdx:_0x370947}=_0x396d18,_0x2abc9a=_0x518f79[0x0];if(!_0x2abc9a)return console[_0x54bab6(0x1a2)](_0x54bab6(0x173)),console[_0x54bab6(0x1a2)](_0x54bab6(0x18a)),console['error']('\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20view\x20<path/to/segment.yml>'),console[_0x54bab6(0x1a2)](_0x54bab6(0x1e1)),console['error'](_0x54bab6(0x177)),console[_0x54bab6(0x1a2)]('Examples:'),console[_0x54bab6(0x1a2)](_0x54bab6(0x1de)),console['error'](_0x54bab6(0x187)),console[_0x54bab6(0x1a2)](_0x54bab6(0x1e0)),console[_0x54bab6(0x1a2)](_0x54bab6(0x1d1)),0x1;try{const _0xf979a6=_0x980a15[_0x54bab6(0x1a1)],_0x2a5679=await resolveSegmentTarget(_0x2abc9a,_0xf979a6,_0x980a15[_0x54bab6(0x186)]);_0x980a15['verbose']&&console[_0x54bab6(0x1a2)](_0x54bab6(0x1ff)+_0x2a5679);const _0x651c86=await withSpinner('Resolving\x20\x27'+_0x2abc9a+_0x54bab6(0x20d),()=>_0x370947['segment']['resolvePathToResource'](_0x2a5679),{'verbose':_0x980a15[_0x54bab6(0x186)]}),_0x518331=_0x651c86[_0x54bab6(0x1e6)];_0x980a15['verbose']&&(console[_0x54bab6(0x1a2)](_0x54bab6(0x176)+_0x518331[_0x54bab6(0x19a)]),console[_0x54bab6(0x1a2)](_0x54bab6(0x1b9)+_0x518331['parentId']),_0x518331[_0x54bab6(0x1b2)]&&console[_0x54bab6(0x1a2)]('Folder\x20ID:\x20'+_0x518331[_0x54bab6(0x1b2)]),_0x518331[_0x54bab6(0x20e)]&&console[_0x54bab6(0x1a2)](_0x54bab6(0x207)+_0x518331[_0x54bab6(0x20e)]));if(_0x980a15['web']){if(_0x518331['type']===_0x54bab6(0x1ef))return console['error'](_0x54bab6(0x1c5)),0x1;if(_0x518331['type']===_0x54bab6(0x192))return console[_0x54bab6(0x1a2)](_0x54bab6(0x1da)),console[_0x54bab6(0x1a2)](_0x54bab6(0x1eb)),0x1;if(!_0x518331['segmentId'])throw new SDKError(ErrorCode[_0x54bab6(0x1e4)],_0x54bab6(0x1cb));const _0x31e504=getConsoleNextUrl(_0x980a15[_0x54bab6(0x16e)],_0x54bab6(0x1ea)+_0x518331[_0x54bab6(0x1fa)]+_0x54bab6(0x18e)+_0x518331[_0x54bab6(0x20e)]);return console['error'](a37_0x6933f7['green']('✔')+_0x54bab6(0x19f)+a37_0x6933f7[_0x54bab6(0x170)](_0x31e504)),openBrowser(_0x31e504),0x0;}if(_0x518331['type']===_0x54bab6(0x1ef)){if(!_0x518331['folderId'])throw new SDKError(ErrorCode[_0x54bab6(0x1ac)],'Folder\x20ID\x20missing\x20from\x20resolved\x20path');const _0x234dbe=await withSpinner(_0x54bab6(0x1d0),()=>_0x370947['segment'][_0x54bab6(0x1b7)](_0x518331[_0x54bab6(0x1b2)]),{'verbose':_0x980a15[_0x54bab6(0x186)]});await handleSingleObjectOutput(_0x234dbe[_0x54bab6(0x1e6)],_0x980a15);}else{if(_0x518331[_0x54bab6(0x19a)]==='segment'){if(!_0x518331[_0x54bab6(0x20e)])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x54bab6(0x1cb));const _0x5da597=await withSpinner('Fetching\x20segment\x20details...',()=>_0x370947[_0x54bab6(0x1c7)]['getSegment'](_0x518331[_0x54bab6(0x1fa)],_0x518331[_0x54bab6(0x20e)]),{'verbose':_0x980a15['verbose']}),_0x2ff036=getConsoleNextUrl(_0x980a15[_0x54bab6(0x16e)],_0x54bab6(0x1ea)+_0x518331[_0x54bab6(0x1fa)]+_0x54bab6(0x18e)+_0x518331[_0x54bab6(0x20e)]),_0x3c1c42=_0x5da597[_0x54bab6(0x1e6)];_0x3c1c42[_0x54bab6(0x1bd)]=_0x2ff036,await handleSingleObjectOutput(_0x3c1c42,_0x980a15);}else return console[_0x54bab6(0x1a2)](_0x54bab6(0x16b)),console[_0x54bab6(0x1a2)](_0x54bab6(0x1f0)),0x1;}return 0x0;}catch(_0x20ca36){if(_0x20ca36 instanceof SDKError)return console['error'](_0x54bab6(0x1e5)+_0x20ca36['message']),_0x20ca36[_0x54bab6(0x1b0)]&&console[_0x54bab6(0x1a2)]('\x20\x20Cause:\x20'+_0x20ca36[_0x54bab6(0x1b0)]),0x1;throw _0x20ca36;}}}export const SegmentInfoCommand=SegmentViewCommand;export class SegmentDescCommand extends BaseCommand{[a37_0x10bb76(0x191)]=a37_0x10bb76(0x180);[a37_0x10bb76(0x183)]=a37_0x10bb76(0x195);async[a37_0x10bb76(0x1a6)](_0xa53500){const _0x107514=a37_0x10bb76,{options:_0x594eae,args:_0x150147,tdx:_0x204c9a}=_0xa53500,_0x26b496=_0x150147[0x0];if(!_0x26b496)return console[_0x107514(0x1a2)]('Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required'),console[_0x107514(0x1a2)](_0x107514(0x208)),console['error'](_0x107514(0x1a9)),console[_0x107514(0x1a2)](_0x107514(0x1f7)),console[_0x107514(0x1a2)]('\x20\x20tdx\x20sg\x20desc\x20\x22Premium\x20Users\x22'),console[_0x107514(0x1a2)]('\x20\x20tdx\x20sg\x20desc\x20segments/my-audience/premium-users.yml'),0x1;try{const _0x4e3ec2=_0x594eae[_0x107514(0x1a1)],_0x55b2af=await resolveSegmentTarget(_0x26b496,_0x4e3ec2,_0x594eae['verbose']);_0x594eae[_0x107514(0x186)]&&console[_0x107514(0x1a2)]('Target\x20path:\x20'+_0x55b2af);const _0x21884c=await withSpinner(_0x107514(0x1e3)+_0x26b496+_0x107514(0x20d),()=>_0x204c9a[_0x107514(0x1c7)][_0x107514(0x1b4)](_0x55b2af),{'verbose':_0x594eae['verbose']}),_0x19f960=_0x21884c[_0x107514(0x1e6)];_0x594eae[_0x107514(0x186)]&&(console[_0x107514(0x1a2)](_0x107514(0x176)+_0x19f960['type']),console[_0x107514(0x1a2)](_0x107514(0x1b9)+_0x19f960[_0x107514(0x1fa)]));if(_0x19f960[_0x107514(0x19a)]==='folder')return console['error']('Error:\x20Cannot\x20show\x20schema\x20for\x20a\x20folder.'),console[_0x107514(0x1a2)]('Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.'),0x1;if(_0x19f960[_0x107514(0x19a)]===_0x107514(0x192))return console[_0x107514(0x1a2)](_0x107514(0x1a7)),console[_0x107514(0x1a2)]('Use:\x20tdx\x20ps\x20desc'),0x1;if(!_0x19f960['segmentId'])throw new SDKError(ErrorCode[_0x107514(0x1e4)],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x38e990=await withSpinner(_0x107514(0x174),()=>_0x204c9a[_0x107514(0x1c7)]['getSegmentSQL'](_0x19f960[_0x107514(0x1fa)],_0x19f960[_0x107514(0x20e)]),{'verbose':_0x594eae[_0x107514(0x186)]}),_0x1578de=_0x38e990['data'],_0x4f8beb=await executeSchemaQuery(_0x1578de,_0x204c9a,_0x594eae);return await handleQueryOutput(_0x4f8beb,_0x594eae),0x0;}catch(_0x11962e){if(_0x11962e instanceof SDKError)return console[_0x107514(0x1a2)]('Error:\x20'+_0x11962e[_0x107514(0x204)]),_0x11962e['cause']&&console[_0x107514(0x1a2)]('\x20\x20Cause:\x20'+_0x11962e[_0x107514(0x1b0)]),0x1;throw _0x11962e;}}}
@@ -1 +1 @@
1
- const a38_0x2336ae=a38_0xe1dc;(function(_0xc834b6,_0x24730a){const _0x402b14=a38_0xe1dc,_0xef83b2=_0xc834b6();while(!![]){try{const _0x4dd1cd=parseInt(_0x402b14(0xff))/0x1+parseInt(_0x402b14(0x10e))/0x2*(-parseInt(_0x402b14(0x11a))/0x3)+-parseInt(_0x402b14(0x106))/0x4*(-parseInt(_0x402b14(0x10d))/0x5)+-parseInt(_0x402b14(0x107))/0x6+parseInt(_0x402b14(0x114))/0x7*(-parseInt(_0x402b14(0x118))/0x8)+parseInt(_0x402b14(0x10b))/0x9+-parseInt(_0x402b14(0x112))/0xa*(-parseInt(_0x402b14(0xf3))/0xb);if(_0x4dd1cd===_0x24730a)break;else _0xef83b2['push'](_0xef83b2['shift']());}catch(_0x7c269b){_0xef83b2['push'](_0xef83b2['shift']());}}}(a38_0x3231,0xec970));import{BaseCommand}from'./command.js';function a38_0x3231(){const _0x587d4f=['segment:create','\x27\x20with\x20ID:\x20','Parent\x20path:\x20','error','segment','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/High\x20Value\x22\x20--rule\x20\x27...\x27','11vmsDdg','folderId','Usage:\x20tdx\x20segment\x20create\x20<parent/segment_name>\x20[options]','ruleFile','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/Marketing/Premium\x22\x20--rule\x20\x27...\x27','verbose','Usage:\x20tdx\x20segment\x20create\x20<path>\x20[options]','type','folder','Parent:\x20','Resolving\x20folder\x20path\x20\x27','segmentPath','906246haYOEJ','Resolving\x20folder\x20\x27','Resolved\x20folder\x20ID:\x20','\x20\x20Use\x20`tdx\x20sg\x20push`\x20with\x20YAML\x20files\x20instead.\x0a','length','\x27...','yellow','4FkcgdB','11416128gPKDLY','data','Error:\x20Cannot\x20create\x20segment\x20in\x20a\x20segment.\x20Parent\x20path\x20must\x20be\x20a\x20folder\x20or\x20parent.','Target\x20path:\x20','8500068jKEgif','Creating\x20segment\x20\x27','49930nnWteT','2stfqGZ','Segment\x20name:\x20','parent','⚠\x20Deprecation\x20warning:\x20`segment\x20create`\x20is\x20deprecated.','30332150cZiVAA','Resolved\x20relative\x20path\x20to:\x20','7vJgbMr','\x20\x20tdx\x20segment\x20create\x20\x22Premium\x22\x20--rule\x20\x27...\x27\x20\x20#\x20Relative\x20to\x20context','site','description','3474568vlQGzS','segments','4763454Toqvjh','invisible','Examples:','Site:\x20','resolveFolderId','includes','Error:\x20Full\x20path\x20required\x20(parent/segment_name\x20or\x20parent/folder/segment_name)','Create\x20child\x20segment\x20with\x20filtering\x20rules','resolveParentId','✔\x20Created\x20segment\x20\x27','rule','name'];a38_0x3231=function(){return _0x587d4f;};return a38_0x3231();}import{handleSDKOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import{loadJSONFromOptions}from'../utils/json-loader.js';import{parsePath,getParentPath,getBaseName}from'../sdk/segment/segment-path-parser.js';function a38_0xe1dc(_0x54f71a,_0x2d854f){_0x54f71a=_0x54f71a-0xf0;const _0x3231f7=a38_0x3231();let _0xe1dc0b=_0x3231f7[_0x54f71a];return _0xe1dc0b;}import a38_0xb2e06b from'chalk';export class SegmentCreateCommand extends BaseCommand{[a38_0x2336ae(0x125)]=a38_0x2336ae(0x126);[a38_0x2336ae(0x117)]=a38_0x2336ae(0x121);async['execute'](_0xecc3d7){const _0x24b432=a38_0x2336ae;console[_0x24b432(0xf0)](a38_0xb2e06b[_0x24b432(0x105)](_0x24b432(0x111))),console[_0x24b432(0xf0)](a38_0xb2e06b[_0x24b432(0x105)](_0x24b432(0x102)));const {options:_0x5f190d,args:_0xedb032,tdx:_0x320014}=_0xecc3d7,_0x436d1f=_0x5f190d;if(_0xedb032[_0x24b432(0x103)]===0x0)return console[_0x24b432(0xf0)]('Error:\x20Segment\x20path\x20or\x20name\x20is\x20required'),console[_0x24b432(0xf0)](_0x24b432(0xf9)),console[_0x24b432(0xf0)](_0x24b432(0x11c)),console['error'](_0x24b432(0xf2)),console['error'](_0x24b432(0xf7)),console[_0x24b432(0xf0)](_0x24b432(0x115)),0x1;const _0xbf1a7a=_0xedb032[0x0],_0xa6518f=_0x5f190d[_0x24b432(0xfe)];let _0x1c4c81=_0xbf1a7a;_0xa6518f&&!_0xbf1a7a[_0x24b432(0x11f)]('/')&&(_0x1c4c81=_0xa6518f+'/'+_0xbf1a7a,_0x436d1f[_0x24b432(0xf8)]&&console[_0x24b432(0xf0)](_0x24b432(0x113)+_0x1c4c81));const _0x32153e=parsePath(_0x1c4c81);if(_0x32153e[_0x24b432(0x119)][_0x24b432(0x103)]<0x2)return console[_0x24b432(0xf0)](_0x24b432(0x120)),console[_0x24b432(0xf0)](_0x24b432(0xf5)),0x1;const _0x2a5bc3=_0x32153e[_0x24b432(0x119)][0x0],_0x57e0dd=getBaseName(_0x1c4c81),_0xeaaff7=getParentPath(_0x1c4c81);_0x436d1f[_0x24b432(0xf8)]&&(console[_0x24b432(0xf0)](_0x24b432(0x11d)+_0x436d1f[_0x24b432(0x116)]),console[_0x24b432(0xf0)](_0x24b432(0x10a)+_0x1c4c81),console[_0x24b432(0xf0)](_0x24b432(0xfc)+_0x2a5bc3),console[_0x24b432(0xf0)](_0x24b432(0x10f)+_0x57e0dd),console[_0x24b432(0xf0)](_0x24b432(0x128)+_0xeaaff7));const _0x5ddbdf=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x2a5bc3+_0x24b432(0x104),()=>_0x320014[_0x24b432(0xf1)][_0x24b432(0x122)](_0x2a5bc3),{'verbose':_0x436d1f[_0x24b432(0xf8)]}),_0x15f77e=_0x5ddbdf[_0x24b432(0x108)];let _0x110fd0;if(_0x32153e['segments']['length']>0x2){const _0x1d2496=await withSpinner(_0x24b432(0xfd)+_0xeaaff7+_0x24b432(0x104),()=>_0x320014[_0x24b432(0xf1)]['resolvePathToResource'](_0xeaaff7),{'verbose':_0x436d1f[_0x24b432(0xf8)]}),_0x230d5d=_0x1d2496[_0x24b432(0x108)];if(_0x230d5d[_0x24b432(0xfa)]!=='folder'&&_0x230d5d[_0x24b432(0xfa)]!==_0x24b432(0x110))return console['error'](_0x24b432(0x109)),0x1;_0x110fd0=_0x230d5d[_0x24b432(0xf4)];}else{if(_0x436d1f[_0x24b432(0xfb)]){const _0x42c3ee=await withSpinner(_0x24b432(0x100)+_0x436d1f[_0x24b432(0xfb)]+_0x24b432(0x104),()=>_0x320014['segment'][_0x24b432(0x11e)](_0x15f77e,_0x436d1f[_0x24b432(0xfb)]),{'verbose':_0x436d1f[_0x24b432(0xf8)]});_0x110fd0=_0x42c3ee['data'];}}_0x436d1f['verbose']&&_0x110fd0&&console[_0x24b432(0xf0)](_0x24b432(0x101)+_0x110fd0);const _0x58dfdf=await loadJSONFromOptions(_0x436d1f[_0x24b432(0x124)],_0x436d1f[_0x24b432(0xf6)]),_0x13f3a1={'name':_0x57e0dd,'description':_0x436d1f[_0x24b432(0x117)],'rule':_0x58dfdf,'kind':_0x436d1f['kind']!==undefined?parseInt(_0x436d1f['kind'],0xa):undefined,'isVisible':_0x436d1f[_0x24b432(0x11b)]?![]:undefined,'segmentFolderId':_0x110fd0,'countPopulation':_0x436d1f['noCountPopulation']?![]:undefined},_0x13c2e8=await withSpinner(_0x24b432(0x10c)+_0x57e0dd+'\x27...',()=>_0x320014[_0x24b432(0xf1)]['createSegment'](_0x15f77e,_0x13f3a1),{'verbose':_0x436d1f[_0x24b432(0xf8)]}),_0x26f53e=_0x13c2e8[_0x24b432(0x108)];return console[_0x24b432(0xf0)](_0x24b432(0x123)+_0x26f53e['name']+_0x24b432(0x127)+_0x26f53e['id']),_0x1c4c81!==_0xbf1a7a&&console[_0x24b432(0xf0)]('\x20\x20\x20Path:\x20'+_0x1c4c81),await handleSDKOutput([_0x26f53e],_0x436d1f),0x0;}}
1
+ const a38_0x5ab55e=a38_0x10de;(function(_0x220184,_0x5865a5){const _0x277364=a38_0x10de,_0x356a01=_0x220184();while(!![]){try{const _0x2dc255=parseInt(_0x277364(0x134))/0x1+parseInt(_0x277364(0x142))/0x2*(-parseInt(_0x277364(0x127))/0x3)+-parseInt(_0x277364(0x130))/0x4*(-parseInt(_0x277364(0x152))/0x5)+-parseInt(_0x277364(0x153))/0x6+-parseInt(_0x277364(0x145))/0x7*(parseInt(_0x277364(0x147))/0x8)+parseInt(_0x277364(0x133))/0x9+-parseInt(_0x277364(0x12a))/0xa;if(_0x2dc255===_0x5865a5)break;else _0x356a01['push'](_0x356a01['shift']());}catch(_0x258a10){_0x356a01['push'](_0x356a01['shift']());}}}(a38_0x5263,0xd5fca));import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../core/command-output.js';function a38_0x10de(_0x3dbd1b,_0x5aff3d){_0x3dbd1b=_0x3dbd1b-0x121;const _0x526302=a38_0x5263();let _0x10dec2=_0x526302[_0x3dbd1b];return _0x10dec2;}import{withSpinner}from'../utils/spinner.js';function a38_0x5263(){const _0x363ad6=['82YGiAvN','rule','Usage:\x20tdx\x20segment\x20create\x20<parent/segment_name>\x20[options]','133644fTGnNE','Parent\x20path:\x20','72lAWeMn','name','folder','Usage:\x20tdx\x20segment\x20create\x20<path>\x20[options]','Site:\x20','Resolved\x20relative\x20path\x20to:\x20','Segment\x20name:\x20','Error:\x20Cannot\x20create\x20segment\x20in\x20a\x20segment.\x20Parent\x20path\x20must\x20be\x20a\x20folder\x20or\x20parent.','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/Marketing/Premium\x22\x20--rule\x20\x27...\x27','Create\x20child\x20segment\x20with\x20filtering\x20rules','error','3483885XUWCXH','2658450liWGNh','length','\x27...','Resolved\x20folder\x20ID:\x20','data','createSegment','kind','verbose','103134ZeYECL','ruleFile','yellow','2382730WfCfpI','Parent:\x20','resolveParentId','invisible','Error:\x20Full\x20path\x20required\x20(parent/segment_name\x20or\x20parent/folder/segment_name)','\x20\x20tdx\x20segment\x20create\x20\x22Premium\x22\x20--rule\x20\x27...\x27\x20\x20#\x20Relative\x20to\x20context','4dmsKrv','Creating\x20segment\x20\x27','segment','6604497qSXIuT','1708554qIeFpI','segmentPath','resolveFolderId','resolvePathToResource','\x20\x20\x20Path:\x20','segments','description','segment:create','execute','type','site','Resolving\x20folder\x20path\x20\x27','✔\x20Created\x20segment\x20\x27','parent'];a38_0x5263=function(){return _0x363ad6;};return a38_0x5263();}import{loadJSONFromOptions}from'../utils/json-loader.js';import{parsePath,getParentPath,getBaseName}from'../sdk/segment/segment-path-parser.js';import a38_0x1fab2c from'chalk';export class SegmentCreateCommand extends BaseCommand{['name']=a38_0x5ab55e(0x13b);[a38_0x5ab55e(0x13a)]=a38_0x5ab55e(0x150);async[a38_0x5ab55e(0x13c)](_0x538d94){const _0x471f75=a38_0x5ab55e;console[_0x471f75(0x151)](a38_0x1fab2c[_0x471f75(0x129)]('⚠\x20Deprecation\x20warning:\x20`segment\x20create`\x20is\x20deprecated.')),console[_0x471f75(0x151)](a38_0x1fab2c['yellow']('\x20\x20Use\x20`tdx\x20sg\x20push`\x20with\x20YAML\x20files\x20instead.\x0a'));const {options:_0x206966,args:_0x19da1f,tdx:_0x1925a4}=_0x538d94,_0x1bed9c=_0x206966;if(_0x19da1f[_0x471f75(0x154)]===0x0)return console['error']('Error:\x20Segment\x20path\x20or\x20name\x20is\x20required'),console[_0x471f75(0x151)](_0x471f75(0x14a)),console[_0x471f75(0x151)]('Examples:'),console[_0x471f75(0x151)]('\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/High\x20Value\x22\x20--rule\x20\x27...\x27'),console[_0x471f75(0x151)](_0x471f75(0x14f)),console[_0x471f75(0x151)](_0x471f75(0x12f)),0x1;const _0x25f09e=_0x19da1f[0x0],_0x291115=_0x206966[_0x471f75(0x135)];let _0x335786=_0x25f09e;_0x291115&&!_0x25f09e['includes']('/')&&(_0x335786=_0x291115+'/'+_0x25f09e,_0x1bed9c[_0x471f75(0x126)]&&console['error'](_0x471f75(0x14c)+_0x335786));const _0x392334=parsePath(_0x335786);if(_0x392334['segments'][_0x471f75(0x154)]<0x2)return console[_0x471f75(0x151)](_0x471f75(0x12e)),console[_0x471f75(0x151)](_0x471f75(0x144)),0x1;const _0x5221af=_0x392334[_0x471f75(0x139)][0x0],_0x52d996=getBaseName(_0x335786),_0xbcc63=getParentPath(_0x335786);_0x1bed9c[_0x471f75(0x126)]&&(console[_0x471f75(0x151)](_0x471f75(0x14b)+_0x1bed9c[_0x471f75(0x13e)]),console[_0x471f75(0x151)]('Target\x20path:\x20'+_0x335786),console[_0x471f75(0x151)](_0x471f75(0x12b)+_0x5221af),console[_0x471f75(0x151)](_0x471f75(0x14d)+_0x52d996),console[_0x471f75(0x151)](_0x471f75(0x146)+_0xbcc63));const _0x2a034e=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x5221af+_0x471f75(0x121),()=>_0x1925a4[_0x471f75(0x132)][_0x471f75(0x12c)](_0x5221af),{'verbose':_0x1bed9c['verbose']}),_0xa8f832=_0x2a034e[_0x471f75(0x123)];let _0x499ddf;if(_0x392334[_0x471f75(0x139)][_0x471f75(0x154)]>0x2){const _0x968ddd=await withSpinner(_0x471f75(0x13f)+_0xbcc63+_0x471f75(0x121),()=>_0x1925a4[_0x471f75(0x132)][_0x471f75(0x137)](_0xbcc63),{'verbose':_0x1bed9c['verbose']}),_0x43c24d=_0x968ddd['data'];if(_0x43c24d[_0x471f75(0x13d)]!==_0x471f75(0x149)&&_0x43c24d[_0x471f75(0x13d)]!==_0x471f75(0x141))return console[_0x471f75(0x151)](_0x471f75(0x14e)),0x1;_0x499ddf=_0x43c24d['folderId'];}else{if(_0x1bed9c[_0x471f75(0x149)]){const _0x14bd57=await withSpinner('Resolving\x20folder\x20\x27'+_0x1bed9c[_0x471f75(0x149)]+'\x27...',()=>_0x1925a4[_0x471f75(0x132)][_0x471f75(0x136)](_0xa8f832,_0x1bed9c[_0x471f75(0x149)]),{'verbose':_0x1bed9c[_0x471f75(0x126)]});_0x499ddf=_0x14bd57[_0x471f75(0x123)];}}_0x1bed9c[_0x471f75(0x126)]&&_0x499ddf&&console[_0x471f75(0x151)](_0x471f75(0x122)+_0x499ddf);const _0x11ec2e=await loadJSONFromOptions(_0x1bed9c[_0x471f75(0x143)],_0x1bed9c[_0x471f75(0x128)]),_0x2abb35={'name':_0x52d996,'description':_0x1bed9c[_0x471f75(0x13a)],'rule':_0x11ec2e,'kind':_0x1bed9c['kind']!==undefined?parseInt(_0x1bed9c[_0x471f75(0x125)],0xa):undefined,'isVisible':_0x1bed9c[_0x471f75(0x12d)]?![]:undefined,'segmentFolderId':_0x499ddf,'countPopulation':_0x1bed9c['noCountPopulation']?![]:undefined},_0x527b2b=await withSpinner(_0x471f75(0x131)+_0x52d996+_0x471f75(0x121),()=>_0x1925a4[_0x471f75(0x132)][_0x471f75(0x124)](_0xa8f832,_0x2abb35),{'verbose':_0x1bed9c[_0x471f75(0x126)]}),_0x1ed751=_0x527b2b[_0x471f75(0x123)];return console[_0x471f75(0x151)](_0x471f75(0x140)+_0x1ed751[_0x471f75(0x148)]+'\x27\x20with\x20ID:\x20'+_0x1ed751['id']),_0x335786!==_0x25f09e&&console['error'](_0x471f75(0x138)+_0x335786),await handleSDKOutput([_0x1ed751],_0x1bed9c),0x0;}}