@treasuredata/tdx 2026.3.50 → 2026.3.52

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 (228) hide show
  1. package/dist/bin.js +1 -1
  2. package/dist/build-info.json +3 -3
  3. package/dist/cli-categories.js +1 -1
  4. package/dist/cli.js +1 -1
  5. package/dist/commands/activations.js +1 -1
  6. package/dist/commands/agent-command.js +1 -1
  7. package/dist/commands/agent-test-command.js +1 -1
  8. package/dist/commands/api-command.js +1 -1
  9. package/dist/commands/auth-command.js +1 -1
  10. package/dist/commands/cas-command.js +1 -1
  11. package/dist/commands/cas-segment-command.js +1 -1
  12. package/dist/commands/chat-command.js +1 -1
  13. package/dist/commands/claude-command.d.ts.map +1 -1
  14. package/dist/commands/claude-command.js +1 -1
  15. package/dist/commands/claude-command.js.map +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/tables.js +1 -1
  53. package/dist/commands/unset-command.js +1 -1
  54. package/dist/commands/upgrade-command.js +1 -1
  55. package/dist/commands/use-command.js +1 -1
  56. package/dist/commands/user-command.js +1 -1
  57. package/dist/commands/work-command.js +1 -1
  58. package/dist/commands/workflow-command.js +1 -1
  59. package/dist/core/auth.js +1 -1
  60. package/dist/core/command-output.js +1 -1
  61. package/dist/core/config.js +1 -1
  62. package/dist/core/connection-cache.js +1 -1
  63. package/dist/core/constants.js +1 -1
  64. package/dist/core/credential-cache.js +1 -1
  65. package/dist/core/global-context.d.ts.map +1 -1
  66. package/dist/core/global-context.js +1 -1
  67. package/dist/core/global-context.js.map +1 -1
  68. package/dist/core/keychain.js +1 -1
  69. package/dist/core/oauth-keychain.js +1 -1
  70. package/dist/core/oauth.d.ts +1 -0
  71. package/dist/core/oauth.d.ts.map +1 -1
  72. package/dist/core/oauth.js +1 -1
  73. package/dist/core/oauth.js.map +1 -1
  74. package/dist/core/profile.js +1 -1
  75. package/dist/core/project-config.js +1 -1
  76. package/dist/core/session.js +1 -1
  77. package/dist/core/user-cache.js +1 -1
  78. package/dist/core/version.js +1 -1
  79. package/dist/index.js +1 -1
  80. package/dist/mcp/server.js +1 -1
  81. package/dist/mcp/tools/index.js +1 -1
  82. package/dist/mcp/tools/tdx-run.js +1 -1
  83. package/dist/mcp/tools/tdx-search.js +1 -1
  84. package/dist/mcp/utils.js +1 -1
  85. package/dist/proxy/claude-usage-tracker.js +1 -1
  86. package/dist/proxy/passthrough-server.d.ts +21 -4
  87. package/dist/proxy/passthrough-server.d.ts.map +1 -1
  88. package/dist/proxy/passthrough-server.js +1 -1
  89. package/dist/proxy/passthrough-server.js.map +1 -1
  90. package/dist/proxy/sse-usage-parser.js +1 -1
  91. package/dist/sdk/agent/agent-config.js +1 -1
  92. package/dist/sdk/agent/agent-ref-parser.js +1 -1
  93. package/dist/sdk/agent/agent-yaml.js +1 -1
  94. package/dist/sdk/agent/test/evaluator.js +1 -1
  95. package/dist/sdk/agent/test/executor.js +1 -1
  96. package/dist/sdk/agent/test/index.js +1 -1
  97. package/dist/sdk/agent/test/output.js +1 -1
  98. package/dist/sdk/agent/test/parser.js +1 -1
  99. package/dist/sdk/agent/tool-target-registry.js +1 -1
  100. package/dist/sdk/api.js +1 -1
  101. package/dist/sdk/cas/cas-api-client.js +1 -1
  102. package/dist/sdk/cas/cas-audience-yaml.js +1 -1
  103. package/dist/sdk/cas/cas-segment-yaml.js +1 -1
  104. package/dist/sdk/cas/index.js +1 -1
  105. package/dist/sdk/cas/pull-workflow.js +1 -1
  106. package/dist/sdk/cas/push-workflow.js +1 -1
  107. package/dist/sdk/client/cdp-api-client.js +1 -1
  108. package/dist/sdk/client/delivery-api-client.js +1 -1
  109. package/dist/sdk/client/endpoints.js +1 -1
  110. package/dist/sdk/client/engage-api-client.js +1 -1
  111. package/dist/sdk/client/http-client.js +1 -1
  112. package/dist/sdk/client/llm-api-client.js +1 -1
  113. package/dist/sdk/client/oauth-refresh.js +1 -1
  114. package/dist/sdk/client/rate-limiter.js +1 -1
  115. package/dist/sdk/client/td-api-client.js +1 -1
  116. package/dist/sdk/client/trino-api-client.js +1 -1
  117. package/dist/sdk/client/workflow-client.js +1 -1
  118. package/dist/sdk/connection-validator.js +1 -1
  119. package/dist/sdk/connection.js +1 -1
  120. package/dist/sdk/delivery.js +1 -1
  121. package/dist/sdk/engage/campaign-pull.js +1 -1
  122. package/dist/sdk/engage/campaign-push.js +1 -1
  123. package/dist/sdk/engage/campaign-validator.js +1 -1
  124. package/dist/sdk/engage/campaign-yaml.js +1 -1
  125. package/dist/sdk/engage/template-pull.js +1 -1
  126. package/dist/sdk/engage/template-push.js +1 -1
  127. package/dist/sdk/engage/template-validator.js +1 -1
  128. package/dist/sdk/engage/template-yaml.js +1 -1
  129. package/dist/sdk/engage/types/campaign-def.js +1 -1
  130. package/dist/sdk/engage/types/campaign-schema.js +1 -1
  131. package/dist/sdk/engage/types/template-schema.js +1 -1
  132. package/dist/sdk/engage.js +1 -1
  133. package/dist/sdk/errors.js +1 -1
  134. package/dist/sdk/index.js +1 -1
  135. package/dist/sdk/io/index.js +1 -1
  136. package/dist/sdk/io/node-filesystem.js +1 -1
  137. package/dist/sdk/job.js +1 -1
  138. package/dist/sdk/journey.js +1 -1
  139. package/dist/sdk/llm/chat-cache.js +1 -1
  140. package/dist/sdk/llm/index.js +1 -1
  141. package/dist/sdk/llm/llm-backup-utils.js +1 -1
  142. package/dist/sdk/llm/model-factors.js +1 -1
  143. package/dist/sdk/personalization.js +1 -1
  144. package/dist/sdk/policy.js +1 -1
  145. package/dist/sdk/query/index.js +1 -1
  146. package/dist/sdk/query/sql-parser.js +1 -1
  147. package/dist/sdk/realtime.js +1 -1
  148. package/dist/sdk/schedule.js +1 -1
  149. package/dist/sdk/segment/child-segment-yaml.js +1 -1
  150. package/dist/sdk/segment/fields-display.js +1 -1
  151. package/dist/sdk/segment/file-discovery.js +1 -1
  152. package/dist/sdk/segment/journey-utils.js +1 -1
  153. package/dist/sdk/segment/journey-validator.js +1 -1
  154. package/dist/sdk/segment/journey-yaml.js +1 -1
  155. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  156. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  157. package/dist/sdk/segment/pull-workflow.js +1 -1
  158. package/dist/sdk/segment/push-recovery.js +1 -1
  159. package/dist/sdk/segment/push-workflow.js +1 -1
  160. package/dist/sdk/segment/resolution-context.js +1 -1
  161. package/dist/sdk/segment/segment-path-parser.js +1 -1
  162. package/dist/sdk/segment/segment-ref-parser.js +1 -1
  163. package/dist/sdk/segment/segment-validator.js +1 -1
  164. package/dist/sdk/segment/target-resolution.js +1 -1
  165. package/dist/sdk/segment/tdx-config.js +1 -1
  166. package/dist/sdk/segment/types/activation-schema.js +1 -1
  167. package/dist/sdk/segment/types/journey-def.js +1 -1
  168. package/dist/sdk/segment/types/journey-schema.js +1 -1
  169. package/dist/sdk/segment/types/segment-def.js +1 -1
  170. package/dist/sdk/segment/types/segment-schema.js +1 -1
  171. package/dist/sdk/segment/validate-files.js +1 -1
  172. package/dist/sdk/segment/yaml-validator.js +1 -1
  173. package/dist/sdk/segment.js +1 -1
  174. package/dist/sdk/types/index.js +1 -1
  175. package/dist/sdk/types/progress.js +1 -1
  176. package/dist/sdk/types/workspace.js +1 -1
  177. package/dist/sdk/user.js +1 -1
  178. package/dist/sdk/util/format-detector.js +1 -1
  179. package/dist/sdk/util/formatters.js +1 -1
  180. package/dist/sdk/util/index.js +1 -1
  181. package/dist/sdk/util/paginate.js +1 -1
  182. package/dist/sdk/util/tree-formatter.js +1 -1
  183. package/dist/sdk/workflow/archive-validation.js +1 -1
  184. package/dist/sdk/workflow/clone-workflow.js +1 -1
  185. package/dist/sdk/workflow/index.js +1 -1
  186. package/dist/sdk/workflow/pull-workflow.js +1 -1
  187. package/dist/sdk/workflow/push-workflow.js +1 -1
  188. package/dist/sdk/workflow/tdx-config.js +1 -1
  189. package/dist/sdk/workflow/workflow-utils.js +1 -1
  190. package/dist/sdk/workspace/frontmatter.js +1 -1
  191. package/dist/sdk/workspace/git.js +1 -1
  192. package/dist/sdk/workspace/index.js +1 -1
  193. package/dist/sdk/workspace/templates.js +1 -1
  194. package/dist/sdk/workspace/weekly.js +1 -1
  195. package/dist/sdk/workspace/wikilinks.js +1 -1
  196. package/dist/test-utils/command-runner.js +1 -1
  197. package/dist/test-utils/factories.js +1 -1
  198. package/dist/test-utils/fixtures.js +1 -1
  199. package/dist/test-utils/http-mock.js +1 -1
  200. package/dist/test-utils/index.js +1 -1
  201. package/dist/utils/async.js +1 -1
  202. package/dist/utils/colors.js +1 -1
  203. package/dist/utils/diff.js +1 -1
  204. package/dist/utils/file-permissions.js +1 -1
  205. package/dist/utils/file-reader.js +1 -1
  206. package/dist/utils/github-releases.js +1 -1
  207. package/dist/utils/global-cache.js +1 -1
  208. package/dist/utils/json-loader.js +1 -1
  209. package/dist/utils/local-cache.js +1 -1
  210. package/dist/utils/logger/formatters/default-formatter.js +1 -1
  211. package/dist/utils/logger/formatters/index.js +1 -1
  212. package/dist/utils/logger/handlers/console-handler.js +1 -1
  213. package/dist/utils/logger/handlers/file-handler.js +1 -1
  214. package/dist/utils/logger/handlers/index.js +1 -1
  215. package/dist/utils/logger/handlers/null-handler.js +1 -1
  216. package/dist/utils/logger/index.js +1 -1
  217. package/dist/utils/logger/logger.js +1 -1
  218. package/dist/utils/logger/types.js +1 -1
  219. package/dist/utils/option-validation.js +1 -1
  220. package/dist/utils/process.js +1 -1
  221. package/dist/utils/prompt.js +1 -1
  222. package/dist/utils/spinner.js +1 -1
  223. package/dist/utils/sse-parser.js +1 -1
  224. package/dist/utils/string-utils.js +1 -1
  225. package/dist/utils/table-ref-parser.js +1 -1
  226. package/dist/utils/tdx-logger.js +1 -1
  227. package/dist/utils/version-check.js +1 -1
  228. package/package.json +1 -1
@@ -1 +1 @@
1
- const a32_0x2e6fef=a32_0x575f;(function(_0xdc4859,_0x57dc8d){const _0x2493a8=a32_0x575f,_0x1357dc=_0xdc4859();while(!![]){try{const _0x5e2910=parseInt(_0x2493a8(0x1fb))/0x1+parseInt(_0x2493a8(0x1e1))/0x2+-parseInt(_0x2493a8(0x1da))/0x3*(parseInt(_0x2493a8(0x1f0))/0x4)+-parseInt(_0x2493a8(0x1e9))/0x5*(-parseInt(_0x2493a8(0x1d7))/0x6)+parseInt(_0x2493a8(0x1df))/0x7*(-parseInt(_0x2493a8(0x1f6))/0x8)+-parseInt(_0x2493a8(0x1ce))/0x9+parseInt(_0x2493a8(0x1cd))/0xa;if(_0x5e2910===_0x57dc8d)break;else _0x1357dc['push'](_0x1357dc['shift']());}catch(_0x5ce152){_0x1357dc['push'](_0x1357dc['shift']());}}}(a32_0x1404,0x28817));import{BaseCommand}from'./command.js';import{handleSDKOutput,handleSingleObjectOutput,isStructuredFormat}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import a32_0xade8ad from'chalk';export class PolicyCommand extends BaseCommand{[a32_0x2e6fef(0x1d4)]=a32_0x2e6fef(0x1eb);[a32_0x2e6fef(0x1e7)]=a32_0x2e6fef(0x1d5);async[a32_0x2e6fef(0x1ed)](_0x1a6caa){const _0x325b35=a32_0x2e6fef,{options:_0x5753f4,tdx:_0x263d01}=_0x1a6caa,_0x1ef1d9=await withSpinner(_0x325b35(0x1fe),async()=>{const _0x1091bb=_0x325b35,[_0x227e13,_0x47b503]=await Promise['all']([_0x263d01[_0x1091bb(0x1fc)][_0x1091bb(0x209)](),_0x263d01['policy']['getMyPermissions']()]);return{'userInfo':_0x227e13,'permissions':_0x47b503};},{'verbose':_0x5753f4['verbose']}),{userInfo:_0x21a01f,permissions:_0x2efc3f}=_0x1ef1d9[_0x325b35(0x1ea)];if(isStructuredFormat(_0x5753f4))return await handleSingleObjectOutput(_0x2efc3f,_0x5753f4),0x0;const _0x415221=_0x21a01f[_0x325b35(0x1ca)]?_0x325b35(0x1f5):_0x21a01f[_0x325b35(0x1e3)]?'Administrator':_0x325b35(0x1d1);console[_0x325b35(0x1d6)]('\x0a'+a32_0xade8ad['bold']('👤')+'\x20'+a32_0xade8ad[_0x325b35(0x1f9)](_0x21a01f[_0x325b35(0x1d4)])+'\x20'+a32_0xade8ad[_0x325b35(0x1d8)]('('+_0x21a01f[_0x325b35(0x1f1)]+')')+_0x325b35(0x205)+_0x415221),console[_0x325b35(0x1d6)](a32_0xade8ad[_0x325b35(0x1d8)](_0x325b35(0x200)+_0x263d01['context'][_0x325b35(0x1e0)]+':'+_0x21a01f[_0x325b35(0x202)]+',\x20user_id:'+_0x21a01f['id']));const _0x3ff39c=_0x2efc3f[_0x325b35(0x1e4)];console[_0x325b35(0x1d6)]('\x0a'+a32_0xade8ad[_0x325b35(0x1f9)](_0x325b35(0x1fa))+'\x20('+_0x3ff39c[_0x325b35(0x1d3)]+'):');if(_0x3ff39c['length']===0x0)console[_0x325b35(0x1d6)](a32_0xade8ad[_0x325b35(0x1d8)](_0x325b35(0x206)));else for(const _0x1f27a3 of _0x3ff39c){console[_0x325b35(0x1d6)]('\x20\x20•\x20'+_0x1f27a3[_0x325b35(0x1d4)]);}return printPermissionsMap(_0x2efc3f[_0x325b35(0x1ef)]),console[_0x325b35(0x1d6)](),0x0;}}function a32_0x1404(){const _0x519de8=['user','ies','Fetching\x20permissions...','validate','\x20\x20\x20','getPolicy','account_id','\x20\x20•\x20','Show\x20a\x20specific\x20policy\x20details\x20and\x20permissions\x20(admin\x20only)','\x20—\x20','\x20\x20No\x20policies\x20assigned','max','(ID:\x20','getCurrent','account_owner','Listing\x20policies...','padEnd','657230LLLZzD','267840qIIxHT','Fetching\x20policy...','verbose','Member','error','length','name','Show\x20current\x20user\x20policies\x20and\x20effective\x20permissions','log','106530fxCqVc','dim','join','4029XPbLwh','No\x20policies\x20found','listPolicies','policy\x20show','\x20assigned','2562Wvafiq','site','104038jQknMz','entries','administrator','policies','policy\x20list','\x20polic','description','\x20user','20oOWCce','data','policy','🔑\x20Effective\x20Permissions','execute','map','permissions','436zfCOme','email','\x20\x20No\x20permissions','Usage:\x20tdx\x20policy\x20show\x20<policy-name-or-id>','args','Account\x20Owner','32XAFtHj','List\x20all\x20policies\x20in\x20the\x20account\x20(admin\x20only)','✔\x20Found\x20','bold','📋\x20Assigned\x20Policies','154760hvsXaA'];a32_0x1404=function(){return _0x519de8;};return a32_0x1404();}function a32_0x575f(_0x3b289e,_0x75532a){_0x3b289e=_0x3b289e-0x1ca;const _0x140443=a32_0x1404();let _0x575f42=_0x140443[_0x3b289e];return _0x575f42;}export class PolicyListCommand extends BaseCommand{['name']=a32_0x2e6fef(0x1e5);[a32_0x2e6fef(0x1e7)]=a32_0x2e6fef(0x1f7);async['execute'](_0x2cf0ad){const _0x35bcb9=a32_0x2e6fef,{options:_0x507fd8,tdx:_0x2fa653}=_0x2cf0ad,_0x396380=await withSpinner(_0x35bcb9(0x1cb),()=>_0x2fa653[_0x35bcb9(0x1eb)][_0x35bcb9(0x1dc)](),{'verbose':_0x507fd8[_0x35bcb9(0x1d0)]}),_0x5f10fe=_0x396380[_0x35bcb9(0x1ea)];console[_0x35bcb9(0x1d2)](_0x35bcb9(0x1f8)+_0x5f10fe['length']+_0x35bcb9(0x1e6)+(_0x5f10fe[_0x35bcb9(0x1d3)]!==0x1?_0x35bcb9(0x1fd):'y'));if(isStructuredFormat(_0x507fd8))return await handleSDKOutput(_0x5f10fe,_0x507fd8),0x0;if(_0x5f10fe[_0x35bcb9(0x1d3)]===0x0)console[_0x35bcb9(0x1d6)](a32_0xade8ad[_0x35bcb9(0x1d8)](_0x35bcb9(0x1db)));else for(const _0x221de6 of _0x5f10fe){const _0x894802=_0x221de6[_0x35bcb9(0x1e7)]?a32_0xade8ad[_0x35bcb9(0x1d8)](_0x35bcb9(0x205)+_0x221de6['description']):'';console[_0x35bcb9(0x1d6)](_0x35bcb9(0x203)+_0x221de6[_0x35bcb9(0x1d4)]+_0x894802);}return 0x0;}}export class PolicyShowCommand extends BaseCommand{['name']=a32_0x2e6fef(0x1dd);['description']=a32_0x2e6fef(0x204);[a32_0x2e6fef(0x1ff)](_0x228c2c){const _0x526f3b=a32_0x2e6fef;if(_0x228c2c['args'][_0x526f3b(0x1d3)]===0x0)return _0x526f3b(0x1f3);return undefined;}async[a32_0x2e6fef(0x1ed)](_0x15d3f5){const _0x86256a=a32_0x2e6fef,{options:_0x251ebf,tdx:_0x318463}=_0x15d3f5,_0x13c1c6=_0x15d3f5[_0x86256a(0x1f4)][0x0],_0x281391=await withSpinner(_0x86256a(0x1cf),async()=>{const _0xfe7e6d=_0x86256a,_0x4a3486=await _0x318463[_0xfe7e6d(0x1eb)][_0xfe7e6d(0x201)](_0x13c1c6),[_0x399bd1,_0x25de42]=await Promise['all']([_0x318463[_0xfe7e6d(0x1eb)]['getPolicyPermissions'](_0x4a3486['id']),_0x318463['policy']['getPolicyUsers'](_0x4a3486['id'])]);return{'policy':_0x4a3486,'perms':_0x399bd1,'users':_0x25de42};},{'verbose':_0x251ebf[_0x86256a(0x1d0)]}),{policy:_0x17011e,perms:_0x31db71,users:_0x4f4e0e}=_0x281391[_0x86256a(0x1ea)];if(isStructuredFormat(_0x251ebf))return await handleSingleObjectOutput({..._0x17011e,'permissions':_0x31db71[_0x86256a(0x1ef)],'users':_0x4f4e0e},_0x251ebf),0x0;console[_0x86256a(0x1d6)]('\x0a'+a32_0xade8ad['bold']('📋')+'\x20'+a32_0xade8ad[_0x86256a(0x1f9)](_0x17011e['name'])+'\x20'+a32_0xade8ad['dim'](_0x86256a(0x208)+_0x17011e['id']+')'));_0x17011e[_0x86256a(0x1e7)]&&console['log'](_0x86256a(0x200)+a32_0xade8ad[_0x86256a(0x1d8)](_0x17011e[_0x86256a(0x1e7)]));console[_0x86256a(0x1d6)](_0x86256a(0x200)+_0x4f4e0e[_0x86256a(0x1d3)]+_0x86256a(0x1e8)+(_0x4f4e0e['length']!==0x1?'s':'')+_0x86256a(0x1de)),printPermissionsMap(_0x31db71[_0x86256a(0x1ef)]);if(_0x4f4e0e[_0x86256a(0x1d3)]>0x0){console[_0x86256a(0x1d6)]('\x0a'+a32_0xade8ad[_0x86256a(0x1f9)]('👥\x20Assigned\x20Users')+':');for(const _0x1e1b6f of _0x4f4e0e){const _0xf772d=_0x1e1b6f[_0x86256a(0x1f1)]&&_0x1e1b6f[_0x86256a(0x1f1)]!==_0x1e1b6f[_0x86256a(0x1d4)]?a32_0xade8ad[_0x86256a(0x1d8)]('\x20<'+_0x1e1b6f[_0x86256a(0x1f1)]+'>'):'';console[_0x86256a(0x1d6)](_0x86256a(0x203)+_0x1e1b6f[_0x86256a(0x1d4)]+_0xf772d);}}return console['log'](),0x0;}}function printPermissionsMap(_0x24439b){const _0x1edeaa=a32_0x2e6fef,_0x328e94=Object[_0x1edeaa(0x1e2)](_0x24439b);console[_0x1edeaa(0x1d6)]('\x0a'+a32_0xade8ad['bold'](_0x1edeaa(0x1ec))+':');if(_0x328e94['length']===0x0){console[_0x1edeaa(0x1d6)](a32_0xade8ad[_0x1edeaa(0x1d8)](_0x1edeaa(0x1f2)));return;}const _0x1e6d24=Math[_0x1edeaa(0x207)](..._0x328e94[_0x1edeaa(0x1ee)](([_0x17214b])=>_0x17214b[_0x1edeaa(0x1d3)]));for(const [_0x3acbcc,_0x903f7e]of _0x328e94){const _0xcdf78d=formatOperations(_0x903f7e);console['log']('\x20\x20'+_0x3acbcc[_0x1edeaa(0x1cc)](_0x1e6d24+0x2)+_0xcdf78d);}}function formatOperations(_0x20190a){const _0x1ba0de=a32_0x2e6fef,_0x4020a8=[...new Set(_0x20190a[_0x1ba0de(0x1ee)](_0x20faed=>_0x20faed['operation']))];return _0x4020a8[_0x1ba0de(0x1d9)](',\x20');}
1
+ const a32_0x3b5513=a32_0x311b;(function(_0xc9a86b,_0x1d6dc7){const _0x2db1f9=a32_0x311b,_0x345c14=_0xc9a86b();while(!![]){try{const _0x3119c0=parseInt(_0x2db1f9(0x160))/0x1*(parseInt(_0x2db1f9(0x161))/0x2)+parseInt(_0x2db1f9(0x128))/0x3*(-parseInt(_0x2db1f9(0x13d))/0x4)+-parseInt(_0x2db1f9(0x12c))/0x5*(-parseInt(_0x2db1f9(0x144))/0x6)+parseInt(_0x2db1f9(0x14f))/0x7+-parseInt(_0x2db1f9(0x134))/0x8*(-parseInt(_0x2db1f9(0x135))/0x9)+-parseInt(_0x2db1f9(0x12b))/0xa*(parseInt(_0x2db1f9(0x145))/0xb)+-parseInt(_0x2db1f9(0x148))/0xc;if(_0x3119c0===_0x1d6dc7)break;else _0x345c14['push'](_0x345c14['shift']());}catch(_0x3d69f0){_0x345c14['push'](_0x345c14['shift']());}}}(a32_0x504e,0x85b6c));import{BaseCommand}from'./command.js';import{handleSDKOutput,handleSingleObjectOutput,isStructuredFormat}from'../core/command-output.js';function a32_0x311b(_0x4d6e4c,_0x59a0d9){_0x4d6e4c=_0x4d6e4c-0x125;const _0x504ef7=a32_0x504e();let _0x311b13=_0x504ef7[_0x4d6e4c];return _0x311b13;}import{withSpinner}from'../utils/spinner.js';import a32_0x38394a from'chalk';export class PolicyCommand extends BaseCommand{[a32_0x3b5513(0x136)]=a32_0x3b5513(0x162);[a32_0x3b5513(0x159)]='Show\x20current\x20user\x20policies\x20and\x20effective\x20permissions';async[a32_0x3b5513(0x15d)](_0x36a9e5){const _0x93f57d=a32_0x3b5513,{options:_0xbac907,tdx:_0x25752f}=_0x36a9e5,_0x36795a=await withSpinner(_0x93f57d(0x147),async()=>{const _0xd8c14a=_0x93f57d,[_0x100e1b,_0x27a60a]=await Promise[_0xd8c14a(0x150)]([_0x25752f[_0xd8c14a(0x14d)][_0xd8c14a(0x146)](),_0x25752f[_0xd8c14a(0x162)]['getMyPermissions']()]);return{'userInfo':_0x100e1b,'permissions':_0x27a60a};},{'verbose':_0xbac907[_0x93f57d(0x14b)]}),{userInfo:_0x660402,permissions:_0x5f08dc}=_0x36795a['data'];if(isStructuredFormat(_0xbac907))return await handleSingleObjectOutput(_0x5f08dc,_0xbac907),0x0;const _0x1e6e89=_0x660402[_0x93f57d(0x155)]?_0x93f57d(0x137):_0x660402[_0x93f57d(0x13b)]?'Administrator':_0x93f57d(0x15f);console['log']('\x0a'+a32_0x38394a[_0x93f57d(0x151)]('👤')+'\x20'+a32_0x38394a[_0x93f57d(0x151)](_0x660402[_0x93f57d(0x136)])+'\x20'+a32_0x38394a[_0x93f57d(0x15e)]('('+_0x660402[_0x93f57d(0x15b)]+')')+_0x93f57d(0x143)+_0x1e6e89),console[_0x93f57d(0x138)](a32_0x38394a['dim'](_0x93f57d(0x133)+_0x25752f['context'][_0x93f57d(0x14e)]+':'+_0x660402[_0x93f57d(0x149)]+_0x93f57d(0x129)+_0x660402['id']));const _0x3c1f42=_0x5f08dc['policies'];console['log']('\x0a'+a32_0x38394a[_0x93f57d(0x151)]('📋\x20Assigned\x20Policies')+'\x20('+_0x3c1f42[_0x93f57d(0x132)]+'):');if(_0x3c1f42['length']===0x0)console[_0x93f57d(0x138)](a32_0x38394a['dim']('\x20\x20No\x20policies\x20assigned'));else for(const _0x345994 of _0x3c1f42){console['log']('\x20\x20•\x20'+_0x345994[_0x93f57d(0x136)]);}return printPermissionsMap(_0x5f08dc['permissions']),console[_0x93f57d(0x138)](),0x0;}}export class PolicyListCommand extends BaseCommand{[a32_0x3b5513(0x136)]=a32_0x3b5513(0x12d);[a32_0x3b5513(0x159)]=a32_0x3b5513(0x156);async[a32_0x3b5513(0x15d)](_0x37107f){const _0x1ebbd3=a32_0x3b5513,{options:_0xc6973e,tdx:_0x54042f}=_0x37107f,_0x475495=await withSpinner(_0x1ebbd3(0x153),()=>_0x54042f[_0x1ebbd3(0x162)][_0x1ebbd3(0x154)](),{'verbose':_0xc6973e['verbose']}),_0x42595b=_0x475495[_0x1ebbd3(0x13a)];console[_0x1ebbd3(0x130)](_0x1ebbd3(0x140)+_0x42595b[_0x1ebbd3(0x132)]+_0x1ebbd3(0x13c)+(_0x42595b[_0x1ebbd3(0x132)]!==0x1?_0x1ebbd3(0x14a):'y'));if(isStructuredFormat(_0xc6973e))return await handleSDKOutput(_0x42595b,_0xc6973e),0x0;if(_0x42595b[_0x1ebbd3(0x132)]===0x0)console[_0x1ebbd3(0x138)](a32_0x38394a[_0x1ebbd3(0x15e)](_0x1ebbd3(0x15c)));else for(const _0x31abfa of _0x42595b){const _0x18b470=_0x31abfa[_0x1ebbd3(0x159)]?a32_0x38394a['dim'](_0x1ebbd3(0x143)+_0x31abfa['description']):'';console[_0x1ebbd3(0x138)](_0x1ebbd3(0x12e)+_0x31abfa['name']+_0x18b470);}return 0x0;}}export class PolicyShowCommand extends BaseCommand{[a32_0x3b5513(0x136)]=a32_0x3b5513(0x141);[a32_0x3b5513(0x159)]=a32_0x3b5513(0x126);[a32_0x3b5513(0x15a)](_0x10e5a2){const _0x213248=a32_0x3b5513;if(_0x10e5a2[_0x213248(0x13e)]['length']===0x0)return'Usage:\x20tdx\x20policy\x20show\x20<policy-name-or-id>';return undefined;}async[a32_0x3b5513(0x15d)](_0x2f08b1){const _0x4ca253=a32_0x3b5513,{options:_0x47923f,tdx:_0x4d3497}=_0x2f08b1,_0x10b1d5=_0x2f08b1['args'][0x0],_0x57cd7c=await withSpinner(_0x4ca253(0x139),async()=>{const _0x7549b3=_0x4ca253,_0x3b8648=await _0x4d3497[_0x7549b3(0x162)][_0x7549b3(0x152)](_0x10b1d5),[_0x354ae5,_0x34b4d4]=await Promise[_0x7549b3(0x150)]([_0x4d3497[_0x7549b3(0x162)][_0x7549b3(0x14c)](_0x3b8648['id']),_0x4d3497[_0x7549b3(0x162)][_0x7549b3(0x127)](_0x3b8648['id'])]);return{'policy':_0x3b8648,'perms':_0x354ae5,'users':_0x34b4d4};},{'verbose':_0x47923f[_0x4ca253(0x14b)]}),{policy:_0x14957f,perms:_0x5bd5f6,users:_0x384dc2}=_0x57cd7c[_0x4ca253(0x13a)];if(isStructuredFormat(_0x47923f))return await handleSingleObjectOutput({..._0x14957f,'permissions':_0x5bd5f6[_0x4ca253(0x13f)],'users':_0x384dc2},_0x47923f),0x0;console[_0x4ca253(0x138)]('\x0a'+a32_0x38394a[_0x4ca253(0x151)]('📋')+'\x20'+a32_0x38394a['bold'](_0x14957f[_0x4ca253(0x136)])+'\x20'+a32_0x38394a['dim'](_0x4ca253(0x158)+_0x14957f['id']+')'));_0x14957f[_0x4ca253(0x159)]&&console[_0x4ca253(0x138)]('\x20\x20\x20'+a32_0x38394a[_0x4ca253(0x15e)](_0x14957f[_0x4ca253(0x159)]));console[_0x4ca253(0x138)](_0x4ca253(0x133)+_0x384dc2[_0x4ca253(0x132)]+_0x4ca253(0x12f)+(_0x384dc2[_0x4ca253(0x132)]!==0x1?'s':'')+'\x20assigned'),printPermissionsMap(_0x5bd5f6['permissions']);if(_0x384dc2['length']>0x0){console[_0x4ca253(0x138)]('\x0a'+a32_0x38394a[_0x4ca253(0x151)]('👥\x20Assigned\x20Users')+':');for(const _0x11e710 of _0x384dc2){const _0x58edfa=_0x11e710['email']&&_0x11e710[_0x4ca253(0x15b)]!==_0x11e710[_0x4ca253(0x136)]?a32_0x38394a[_0x4ca253(0x15e)]('\x20<'+_0x11e710[_0x4ca253(0x15b)]+'>'):'';console[_0x4ca253(0x138)](_0x4ca253(0x12e)+_0x11e710[_0x4ca253(0x136)]+_0x58edfa);}}return console[_0x4ca253(0x138)](),0x0;}}function a32_0x504e(){const _0x4685f8=['args','permissions','✔\x20Found\x20','policy\x20show','padEnd','\x20—\x20','115944WzBHgP','19063YkASbt','getCurrent','Fetching\x20permissions...','7841304xFXMbl','account_id','ies','verbose','getPolicyPermissions','user','site','5421199HJidPr','all','bold','getPolicy','Listing\x20policies...','listPolicies','account_owner','List\x20all\x20policies\x20in\x20the\x20account\x20(admin\x20only)','entries','(ID:\x20','description','validate','email','No\x20policies\x20found','execute','dim','Member','9224LRNMtZ','26kEgcvM','policy','max','Show\x20a\x20specific\x20policy\x20details\x20and\x20permissions\x20(admin\x20only)','getPolicyUsers','252dWvFUJ',',\x20user_id:','map','1490DVLXmE','100zvMfst','policy\x20list','\x20\x20•\x20','\x20user','error','\x20\x20No\x20permissions','length','\x20\x20\x20','457432bvMOlY','90KmWiED','name','Account\x20Owner','log','Fetching\x20policy...','data','administrator','\x20polic','18728rsBgdz'];a32_0x504e=function(){return _0x4685f8;};return a32_0x504e();}function printPermissionsMap(_0x5d1f0e){const _0x32edf9=a32_0x3b5513,_0x4e2a24=Object[_0x32edf9(0x157)](_0x5d1f0e);console['log']('\x0a'+a32_0x38394a[_0x32edf9(0x151)]('🔑\x20Effective\x20Permissions')+':');if(_0x4e2a24[_0x32edf9(0x132)]===0x0){console['log'](a32_0x38394a[_0x32edf9(0x15e)](_0x32edf9(0x131)));return;}const _0x397206=Math[_0x32edf9(0x125)](..._0x4e2a24['map'](([_0x12d49a])=>_0x12d49a[_0x32edf9(0x132)]));for(const [_0x53657f,_0x55dc13]of _0x4e2a24){const _0x5a8ddf=formatOperations(_0x55dc13);console[_0x32edf9(0x138)]('\x20\x20'+_0x53657f[_0x32edf9(0x142)](_0x397206+0x2)+_0x5a8ddf);}}function formatOperations(_0x43bc1a){const _0x452f4c=a32_0x3b5513,_0x7a74af=[...new Set(_0x43bc1a[_0x452f4c(0x12a)](_0x14e88e=>_0x14e88e['operation']))];return _0x7a74af['join'](',\x20');}
@@ -1 +1 @@
1
- const a33_0x3ca79c=a33_0x407e;(function(_0x263fea,_0x5af226){const _0x3800a0=a33_0x407e,_0x4d487b=_0x263fea();while(!![]){try{const _0x377048=parseInt(_0x3800a0(0x1d8))/0x1*(-parseInt(_0x3800a0(0x194))/0x2)+-parseInt(_0x3800a0(0x1d2))/0x3*(-parseInt(_0x3800a0(0x1b6))/0x4)+-parseInt(_0x3800a0(0x190))/0x5*(-parseInt(_0x3800a0(0x1c2))/0x6)+-parseInt(_0x3800a0(0x1c5))/0x7+parseInt(_0x3800a0(0x1c3))/0x8*(-parseInt(_0x3800a0(0x186))/0x9)+-parseInt(_0x3800a0(0x1a3))/0xa*(parseInt(_0x3800a0(0x16d))/0xb)+-parseInt(_0x3800a0(0x16f))/0xc*(-parseInt(_0x3800a0(0x18b))/0xd);if(_0x377048===_0x5af226)break;else _0x4d487b['push'](_0x4d487b['shift']());}catch(_0x30275b){_0x4d487b['push'](_0x4d487b['shift']());}}}(a33_0x5057,0xad309));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_0x5399d3 from'node:path';import{saveSessionContext,getSessionID,cleanExpiredSessions}from'../core/session.js';import{saveAPIKeyAsync,resolveSite}from'../core/config.js';import{getConsoleUrl}from'../sdk/client/endpoints.js';import{deleteKeychainAPIKey,isKeychainAvailable}from'../core/keychain.js';import{deleteOAuthTokens}from'../core/oauth-keychain.js';import{runOAuthLoginFlow,promptAuthMethod}from'./auth-command.js';import{promptSiteSelection}from'../core/constants.js';import{HTTPClientError}from'../sdk/client/http-client.js';import{TDX}from'../sdk/index.js';function a33_0x5057(){const _0x4d31cd=['Delete\x20a\x20profile','\x0aYou\x20can\x20find\x20your\x20API\x20key\x20at:','\x20\x20(no\x20profiles\x20found)','name','7190QLSNor','trim','create','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20delete\x20<name>','11014OIDWKn','green','execute','test','Removal\x20cancelled','red','validate','confirm','profile:create','\x20\x20-\x20','\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.','\x27\x20already\x20exists.\x20Use\x20\x27tdx\x20profile\x20delete\x20','profile:use','length','yellow','90NJrcCJ','\x0aOperation\x20cancelled','dim','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>','text','\x27\x20deleted','Failed\x20to\x20delete\x20profile:\x20','includes','Create\x20a\x20new\x20profile','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','API\x20key\x20cannot\x20be\x20empty','parent_segment','\x20Profile\x20\x27','\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases','VALID_KEYS','password','Setup\x20cancelled','tdx.json','Enter\x20your\x20TD\x20API\x20key\x20for\x20the\x20new\x20site:','4JgUDCC','\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication','Changing\x20site\x20to\x20\x27','\x20API\x20key\x20saved\x20to\x20system\x20keychain\x20(profile:\x20','\x27\x20does\x20not\x20exist.','apiKey','\x0aSetup\x20cancelled','message','jobs','description','Operation\x20cancelled','Are\x20you\x20sure\x20you\x20want\x20to\x20remove\x20profile\x20\x27','3780AMKxpA','65984SxKyjH','tdx:\x20profile\x20delete','8903482bQXDVr','profile:set','session','\x27\x20created','getUserInfo','error','split','(session:\x20','status','profile:delete','\x20API\x20key\x20saved\x20to\x20system\x20keychain','Site\x20was\x20not\x20changed.','log','400647IVSXlH','Removed\x20existing\x20profile\x20\x27','/app/mp/ak','profile','site','\x20\x20tdx\x20--profile\x20','113KJHWHI','\x27\x20requires\x20API\x20key\x20validation.','Set\x20a\x20profile\x20configuration\x20value','\x0aAvailable\x20profiles:','\x0aSaved\x20to:\x20','457336AVoelS','Validating\x20API\x20key...','132660xCDUhh','✗\x20Validation\x20failed:\x20','force','ERROR','logLevel','Session\x20profile\x20set\x20to:\x20','\x20API\x20key\x20is\x20valid\x20(User:\x20','database','Profile\x20\x27','llm_project','us01','profileName','config','Profile\x20was\x20not\x20created.\x20Please\x20try\x20again.','warn','Profile\x20name\x20cannot\x20be\x20empty','email','bold','join','oauth','Enter\x20your\x20TD\x20API\x20key:','\x27.\x0a\x0aValid\x20keys:\x20','skipExistsCheck','189mUMvYV','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20use\x20<name>\x20[--default]','\x0aSetting\x20up\x20authentication\x20for\x20site:\x20','(cleared)','You\x20can\x20now\x20use\x20tdx\x20commands\x20with\x20this\x20profile.\x20Try:','2483LpZvdd'];a33_0x5057=function(){return _0x4d31cd;};return a33_0x5057();}import{LogLevel}from'../utils/tdx-logger.js';import a33_0x49fba3 from'prompts';import a33_0xe36052 from'chalk';function validateProfileName(_0x23ded0,_0x160432){const _0x382296=a33_0x407e;if(!_0x23ded0||!_0x23ded0[_0x382296(0x191)]())return _0x382296(0x17e);const _0xf2cff9=_0x23ded0[_0x382296(0x191)]();if(!/^[a-zA-Z0-9_-]+$/[_0x382296(0x197)](_0xf2cff9))return'Profile\x20name\x20must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore';if(!_0x160432?.[_0x382296(0x185)]&&profileExists(_0xf2cff9))return'Profile\x20\x27'+_0xf2cff9+_0x382296(0x19f)+_0xf2cff9+'\x27\x20to\x20remove\x20it\x20first,\x20or\x20re-create\x20with\x20--force.';return!![];}async function deleteProfileAndCredentials(_0x311865){removeProfileFromUserConfig(_0x311865);const _0xf24f8e=await isKeychainAvailable();_0xf24f8e&&await Promise['all']([deleteKeychainAPIKey(_0x311865),deleteOAuthTokens(_0x311865)]);}export class ProfileCreateCommand extends BaseCommand{[a33_0x3ca79c(0x18f)]=a33_0x3ca79c(0x19c);['description']=a33_0x3ca79c(0x1ab);async[a33_0x3ca79c(0x196)](_0x271664){const _0x36e484=a33_0x3ca79c,{options:_0xf931b3,args:_0x37732d}=_0x271664,_0x246ae4=!!_0xf931b3[_0x36e484(0x171)];console[_0x36e484(0x1d1)](a33_0xe36052[_0x36e484(0x180)]('tdx:\x20profile\x20create'));let _0x5c64b9;if(_0x37732d[_0x36e484(0x1a1)]>0x0&&_0x37732d[0x0]){const _0x51e4c9=_0x37732d[0x0][_0x36e484(0x191)]();_0x246ae4&&profileExists(_0x51e4c9)&&(await deleteProfileAndCredentials(_0x51e4c9),console[_0x36e484(0x1d1)](_0x36e484(0x1d3)+_0x51e4c9+'\x27'));const _0x1bb2fd=validateProfileName(_0x51e4c9);if(_0x1bb2fd!==!![])return console['error'](a33_0xe36052[_0x36e484(0x199)](_0x1bb2fd)),0x1;_0x5c64b9=_0x51e4c9;}else{const _0x2a0857=await a33_0x49fba3({'type':_0x36e484(0x1a7),'name':_0x36e484(0x17a),'message':'Enter\x20profile\x20name:','validate':_0x1ad5f3=>validateProfileName(_0x1ad5f3,{'skipExistsCheck':_0x246ae4})});if(!_0x2a0857[_0x36e484(0x17a)])return console[_0x36e484(0x1d1)]('\x0aSetup\x20cancelled'),0x1;_0x5c64b9=_0x2a0857['profileName'][_0x36e484(0x191)](),_0x246ae4&&profileExists(_0x5c64b9)&&(await deleteProfileAndCredentials(_0x5c64b9),console[_0x36e484(0x1d1)](_0x36e484(0x1d3)+_0x5c64b9+'\x27'));}const _0x40e3e5=await a33_0x49fba3({'type':_0x36e484(0x1a7),'name':'description','message':'Enter\x20description\x20(optional):'}),_0x3443ae=_0x40e3e5['description']?.[_0x36e484(0x191)]()||undefined,_0x441ce7=_0xf931b3[_0x36e484(0x1d6)]||_0x36e484(0x179),_0x4cab47=await promptSiteSelection(_0x441ce7,_0x5c64b9,_0x36e484(0x1b3));if(!_0x4cab47)return 0x1;const _0x39b057=resolveSite(_0x4cab47),_0x45622a=await promptAuthMethod();if(!_0x45622a)return console[_0x36e484(0x1d1)](_0x36e484(0x1bc)),0x1;if(_0x45622a===_0x36e484(0x182)){if(_0x3443ae){const _0x4fcc3a={'site':_0x39b057,'description':_0x3443ae};saveProfileToUserConfig(_0x5c64b9,_0x4fcc3a);}const {accountName:_0x37056c}=_0xf931b3;return await runOAuthLoginFlow(_0x39b057,_0x5c64b9,_0xf931b3[_0x36e484(0x173)]??LogLevel[_0x36e484(0x172)],{'accountName':_0x37056c}),0x0;}console['log'](_0x36e484(0x188)+_0x39b057),console[_0x36e484(0x1d1)]('You\x20can\x20find\x20your\x20API\x20key\x20at:'),console[_0x36e484(0x1d1)]('\x20\x20'+getConsoleUrl(_0x39b057,_0x36e484(0x1d4)));const _0x1a0d74=await a33_0x49fba3({'type':_0x36e484(0x1b2),'name':'apiKey','message':_0x36e484(0x183),'validate':_0x9662c3=>{const _0x590a5b=_0x36e484;if(!_0x9662c3||!_0x9662c3[_0x590a5b(0x191)]())return _0x590a5b(0x1ad);return!![];}});if(!_0x1a0d74['apiKey'])return console[_0x36e484(0x1d1)](_0x36e484(0x1bc)),0x1;const _0x3a342d=_0x1a0d74[_0x36e484(0x1bb)];console[_0x36e484(0x1d1)](_0x36e484(0x16e));try{const _0x14d538=TDX[_0x36e484(0x192)]({'site':_0x39b057,'apiKey':_0x3a342d[_0x36e484(0x191)](),'logLevel':_0xf931b3['logLevel']??LogLevel[_0x36e484(0x172)]}),_0xbfdd1e=await _0x14d538['jobs'][_0x36e484(0x1c9)]();console[_0x36e484(0x1d1)](a33_0xe36052[_0x36e484(0x195)]('✓')+_0x36e484(0x175)+_0xbfdd1e[_0x36e484(0x17f)]+')');const _0x21f6bf=await isKeychainAvailable();_0x21f6bf?(await saveAPIKeyAsync(_0x3a342d[_0x36e484(0x191)](),_0x39b057,_0x5c64b9),console[_0x36e484(0x1d1)](a33_0xe36052[_0x36e484(0x195)]('✓')+_0x36e484(0x1b9)+_0x5c64b9+')')):(console[_0x36e484(0x17d)](a33_0xe36052[_0x36e484(0x1a2)](_0x36e484(0x1ac))),console[_0x36e484(0x17d)](a33_0xe36052[_0x36e484(0x1a2)](_0x36e484(0x19e))));const _0x58918a={'site':_0x39b057,..._0x3443ae&&{'description':_0x3443ae}};return saveProfileToUserConfig(_0x5c64b9,_0x58918a),console[_0x36e484(0x1d1)](a33_0xe36052[_0x36e484(0x195)]('✓')+'\x20Profile\x20\x27'+_0x5c64b9+_0x36e484(0x1c8)),console['log'](),console[_0x36e484(0x1d1)](_0x36e484(0x18a)),console[_0x36e484(0x1d1)](_0x36e484(0x1d7)+_0x5c64b9+_0x36e484(0x1b7)),console['log'](_0x36e484(0x1d7)+_0x5c64b9+_0x36e484(0x1b0)),0x0;}catch(_0x51d34c){if(_0x51d34c instanceof HTTPClientError&&_0x51d34c[_0x36e484(0x1cd)]===0x191)return printAuthError(_0x51d34c),0x1;return console['error'](a33_0xe36052['red'](_0x36e484(0x170)+(_0x51d34c instanceof Error?_0x51d34c[_0x36e484(0x1bd)]:String(_0x51d34c)))),console['error'](_0x36e484(0x17c)),0x1;}}}export class ProfileDeleteCommand extends BaseCommand{[a33_0x3ca79c(0x18f)]=a33_0x3ca79c(0x1ce);[a33_0x3ca79c(0x1bf)]=a33_0x3ca79c(0x18c);[a33_0x3ca79c(0x19a)](_0xfae954){const _0x4c6d7e=a33_0x3ca79c,{args:_0x5207a4}=_0xfae954;if(_0x5207a4[_0x4c6d7e(0x1a1)]===0x0)return _0x4c6d7e(0x193);return undefined;}async[a33_0x3ca79c(0x196)](_0x2f097b){const _0x4474f3=a33_0x3ca79c,{args:_0x434efe}=_0x2f097b,_0x14702b=_0x434efe[0x0];console[_0x4474f3(0x1d1)](a33_0xe36052[_0x4474f3(0x180)](_0x4474f3(0x1c4)));if(!profileExists(_0x14702b)){console[_0x4474f3(0x1ca)](a33_0xe36052['red']('Profile\x20\x27'+_0x14702b+_0x4474f3(0x1ba))),console[_0x4474f3(0x1d1)](_0x4474f3(0x16b));const _0x3ffbd9=listProfiles();if(_0x3ffbd9[_0x4474f3(0x1a1)]===0x0)console[_0x4474f3(0x1d1)](_0x4474f3(0x18e));else for(const _0x167170 of _0x3ffbd9){console[_0x4474f3(0x1d1)](_0x4474f3(0x19d)+_0x167170['name']);}return 0x1;}const _0x1bafa0=await a33_0x49fba3({'type':_0x4474f3(0x19b),'name':_0x4474f3(0x19b),'message':_0x4474f3(0x1c1)+_0x14702b+'\x27?','initial':![]});if(!_0x1bafa0[_0x4474f3(0x19b)])return console['log'](_0x4474f3(0x198)),0x0;try{await deleteProfileAndCredentials(_0x14702b),console[_0x4474f3(0x1d1)](a33_0xe36052[_0x4474f3(0x195)]('✓')+'\x20Profile\x20\x27'+_0x14702b+_0x4474f3(0x1a8));}catch(_0x280a34){return console[_0x4474f3(0x1ca)](a33_0xe36052['red'](_0x4474f3(0x1a9)+(_0x280a34 instanceof Error?_0x280a34[_0x4474f3(0x1bd)]:String(_0x280a34)))),0x1;}return 0x0;}}function a33_0x407e(_0x195acb,_0x37e22e){_0x195acb=_0x195acb-0x16a;const _0x505765=a33_0x5057();let _0x407e6e=_0x505765[_0x195acb];return _0x407e6e;}export class ProfileSetCommand extends BaseCommand{[a33_0x3ca79c(0x18f)]=a33_0x3ca79c(0x1c6);['description']=a33_0x3ca79c(0x16a);static ['VALID_KEYS']=['site',a33_0x3ca79c(0x176),a33_0x3ca79c(0x1ae),a33_0x3ca79c(0x178),'llm_agent',a33_0x3ca79c(0x1bf)];['validate'](_0x513462){const _0x1f4ee3=a33_0x3ca79c,{args:_0x2e2384,options:_0x416011}=_0x513462,_0x15c79a=_0x416011[_0x1f4ee3(0x1d5)]||getActiveProfile();if(!_0x15c79a)return _0x1f4ee3(0x1a6);if(_0x2e2384[_0x1f4ee3(0x1a1)]===0x0)return'Key=value\x20pair\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20'+ProfileSetCommand[_0x1f4ee3(0x1b1)][_0x1f4ee3(0x181)](',\x20');const _0x5c79a3=_0x2e2384[0x0];if(!_0x5c79a3[_0x1f4ee3(0x1aa)]('='))return'Invalid\x20format.\x20Use:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20'+ProfileSetCommand['VALID_KEYS'][_0x1f4ee3(0x181)](',\x20');const [_0x3d58ec]=_0x5c79a3[_0x1f4ee3(0x1cb)]('=',0x2);if(!ProfileSetCommand[_0x1f4ee3(0x1b1)][_0x1f4ee3(0x1aa)](_0x3d58ec))return'Unknown\x20key\x20\x27'+_0x3d58ec+_0x1f4ee3(0x184)+ProfileSetCommand['VALID_KEYS']['join'](',\x20');return undefined;}async['execute'](_0x321ea0){const _0x251bb5=a33_0x3ca79c,{args:_0x1c8227,options:_0x511ca8}=_0x321ea0,_0x55b491=_0x511ca8[_0x251bb5(0x1d5)]||getActiveProfile(),[_0x503ba5,..._0x57019f]=_0x1c8227[0x0]['split']('='),_0x155dc8=_0x57019f[_0x251bb5(0x181)]('=');console[_0x251bb5(0x1d1)](a33_0xe36052['bold']('tdx:\x20profile\x20set'));if(!profileExists(_0x55b491)){const _0x271e39=await a33_0x49fba3({'type':_0x251bb5(0x19b),'name':'create','message':_0x251bb5(0x177)+_0x55b491+'\x27\x20does\x20not\x20exist.\x20Create\x20it?','initial':!![]});if(!_0x271e39[_0x251bb5(0x192)])return console[_0x251bb5(0x1d1)](_0x251bb5(0x1c0)),0x1;}const _0x2542a6=loadProfile(_0x55b491),_0x39a661=_0x2542a6?.[_0x251bb5(0x17b)]||{};if(_0x503ba5==='site'){const _0x357c7d=resolveSite(_0x155dc8);console[_0x251bb5(0x1d1)](_0x251bb5(0x1b8)+_0x357c7d+_0x251bb5(0x1d9)),console[_0x251bb5(0x1d1)](_0x251bb5(0x18d)),console[_0x251bb5(0x1d1)]('\x20\x20'+getConsoleUrl(_0x357c7d,_0x251bb5(0x1d4)));const _0x13a35a=await a33_0x49fba3({'type':_0x251bb5(0x1b2),'name':_0x251bb5(0x1bb),'message':_0x251bb5(0x1b5),'validate':_0x384134=>{const _0x59837f=_0x251bb5;if(!_0x384134||!_0x384134[_0x59837f(0x191)]())return'API\x20key\x20cannot\x20be\x20empty';return!![];}});if(!_0x13a35a['apiKey'])return console[_0x251bb5(0x1d1)](_0x251bb5(0x1a4)),0x1;console['log'](_0x251bb5(0x16e));try{const _0x2530b2=TDX[_0x251bb5(0x192)]({'site':_0x357c7d,'apiKey':_0x13a35a[_0x251bb5(0x1bb)][_0x251bb5(0x191)](),'logLevel':_0x511ca8[_0x251bb5(0x173)]??LogLevel[_0x251bb5(0x172)]}),_0x18e5fe=await _0x2530b2[_0x251bb5(0x1be)][_0x251bb5(0x1c9)]();console[_0x251bb5(0x1d1)](a33_0xe36052[_0x251bb5(0x195)]('✓')+_0x251bb5(0x175)+_0x18e5fe[_0x251bb5(0x17f)]+')');const _0x3118f2=await isKeychainAvailable();_0x3118f2?(await saveAPIKeyAsync(_0x13a35a[_0x251bb5(0x1bb)][_0x251bb5(0x191)](),_0x357c7d,_0x55b491),console[_0x251bb5(0x1d1)](a33_0xe36052[_0x251bb5(0x195)]('✓')+_0x251bb5(0x1cf))):console[_0x251bb5(0x17d)](a33_0xe36052[_0x251bb5(0x1a2)](_0x251bb5(0x1ac))),_0x39a661['site']=_0x357c7d;}catch(_0x2d2c72){if(_0x2d2c72 instanceof HTTPClientError&&_0x2d2c72[_0x251bb5(0x1cd)]===0x191)return printAuthError(_0x2d2c72),0x1;return console['error'](a33_0xe36052[_0x251bb5(0x199)](_0x251bb5(0x170)+(_0x2d2c72 instanceof Error?_0x2d2c72[_0x251bb5(0x1bd)]:String(_0x2d2c72)))),console[_0x251bb5(0x1ca)](_0x251bb5(0x1d0)),0x1;}}else _0x39a661[_0x503ba5]=_0x155dc8||undefined;return saveProfileToUserConfig(_0x55b491,_0x39a661),console['log'](a33_0xe36052['green']('✓')+_0x251bb5(0x1af)+_0x55b491+'\x27\x20updated:\x20'+_0x503ba5+'='+(_0x155dc8||_0x251bb5(0x189))),0x0;}}export class ProfileUseCommand extends BaseCommand{[a33_0x3ca79c(0x18f)]=a33_0x3ca79c(0x1a0);[a33_0x3ca79c(0x1bf)]='Set\x20session\x20profile';['validate'](_0x8dcaf){const _0x1e6291=a33_0x3ca79c,{args:_0x36d5f1}=_0x8dcaf;if(_0x36d5f1[_0x1e6291(0x1a1)]===0x0)return _0x1e6291(0x187);return undefined;}async[a33_0x3ca79c(0x196)](_0x273f2c){const _0x23fcb1=a33_0x3ca79c,{args:_0x223a51,options:_0x164621}=_0x273f2c,_0x52c40d=_0x223a51[0x0],_0x33c071=_0x164621['default'];cleanExpiredSessions();if(!profileExists(_0x52c40d)){console[_0x23fcb1(0x1ca)](a33_0xe36052[_0x23fcb1(0x199)](_0x23fcb1(0x177)+_0x52c40d+_0x23fcb1(0x1ba))),console['log']('\x0aAvailable\x20profiles:');const _0x253eba=listProfiles();if(_0x253eba[_0x23fcb1(0x1a1)]===0x0)console[_0x23fcb1(0x1d1)](_0x23fcb1(0x18e));else for(const _0x14ebdb of _0x253eba){console[_0x23fcb1(0x1d1)](_0x23fcb1(0x19d)+_0x14ebdb[_0x23fcb1(0x18f)]);}return 0x1;}if(_0x33c071){const _0x548703=a33_0x5399d3[_0x23fcb1(0x181)](getConfigDir(),_0x23fcb1(0x1b4));return saveActiveProfileToUserConfig(_0x52c40d),console[_0x23fcb1(0x1d1)]('Default\x20profile\x20set\x20to:\x20'+a33_0xe36052[_0x23fcb1(0x195)](_0x52c40d)),console[_0x23fcb1(0x1d1)](a33_0xe36052['dim'](_0x23fcb1(0x16c)+_0x548703)),0x0;}const _0x3f5d62=getSessionID(_0x164621[_0x23fcb1(0x1c7)]);return saveSessionContext({'profile':_0x52c40d},_0x164621[_0x23fcb1(0x1c7)]),console[_0x23fcb1(0x1d1)](_0x23fcb1(0x174)+a33_0xe36052[_0x23fcb1(0x195)](_0x52c40d)+'\x20'+a33_0xe36052[_0x23fcb1(0x1a5)](_0x23fcb1(0x1cc)+_0x3f5d62+')')),console[_0x23fcb1(0x1d1)](a33_0xe36052['dim']('\x0aTip:\x20Use\x20\x27tdx\x20profile\x20use\x20'+_0x52c40d+'\x20--default\x27\x20to\x20save\x20permanently')),0x0;}}
1
+ const a33_0x301160=a33_0x42be;(function(_0x128c8f,_0x471bb6){const _0x46bf9f=a33_0x42be,_0x51ec53=_0x128c8f();while(!![]){try{const _0x50b6ac=parseInt(_0x46bf9f(0x1db))/0x1+parseInt(_0x46bf9f(0x197))/0x2+parseInt(_0x46bf9f(0x1f6))/0x3+-parseInt(_0x46bf9f(0x1e8))/0x4*(-parseInt(_0x46bf9f(0x198))/0x5)+parseInt(_0x46bf9f(0x205))/0x6*(parseInt(_0x46bf9f(0x195))/0x7)+parseInt(_0x46bf9f(0x1c0))/0x8*(parseInt(_0x46bf9f(0x1d6))/0x9)+parseInt(_0x46bf9f(0x1a5))/0xa*(-parseInt(_0x46bf9f(0x1e4))/0xb);if(_0x50b6ac===_0x471bb6)break;else _0x51ec53['push'](_0x51ec53['shift']());}catch(_0x23f098){_0x51ec53['push'](_0x51ec53['shift']());}}}(a33_0xe687,0xc91e8));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_0x42be(_0x3d2456,_0x5c06dc){_0x3d2456=_0x3d2456-0x195;const _0xe68783=a33_0xe687();let _0x42bed3=_0xe68783[_0x3d2456];return _0x42bed3;}import*as a33_0x4cf3ae 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';function a33_0xe687(){const _0x276508=['\x20--default\x27\x20to\x20save\x20permanently','oauth','profile:delete','Site\x20was\x20not\x20changed.','\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases','config','4445127DBzvxx','create','\x27\x20to\x20remove\x20it\x20first,\x20or\x20re-create\x20with\x20--force.','llm_agent','tdx:\x20profile\x20create','338395hzkMYj','database','API\x20key\x20cannot\x20be\x20empty','Create\x20a\x20new\x20profile','Set\x20session\x20profile','getUserInfo','test','Removed\x20existing\x20profile\x20\x27','Enter\x20your\x20TD\x20API\x20key\x20for\x20the\x20new\x20site:','1045DIhdTO','yellow','\x27\x20deleted','trim','2356jKNiMS','join','(session:\x20','Default\x20profile\x20set\x20to:\x20','\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.','execute','Profile\x20was\x20not\x20created.\x20Please\x20try\x20again.','status','\x20API\x20key\x20saved\x20to\x20system\x20keychain','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>','logLevel','profile:use','password','Setup\x20cancelled','4433796DIhELf','tdx:\x20profile\x20delete','\x20\x20-\x20','default','\x0aAvailable\x20profiles:','\x27\x20updated:\x20','(cleared)','length','description','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','warn','email','profile','includes','✗\x20Validation\x20failed:\x20','1419366MHeSyw','14KSwayK','validate','1617426eBLJAL','12755pfxUun','Profile\x20\x27','\x0aSetting\x20up\x20authentication\x20for\x20site:\x20','green','ERROR','red','\x20\x20tdx\x20--profile\x20','VALID_KEYS','log','\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication','session','Profile\x20name\x20cannot\x20be\x20empty','\x27\x20does\x20not\x20exist.\x20Create\x20it?','449560vAtCcE','text','llm_project','profile:set','\x20API\x20key\x20is\x20valid\x20(User:\x20','/app/mp/ak','message','\x27.\x0a\x0aValid\x20keys:\x20','\x0aSaved\x20to:\x20','bold','all','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20delete\x20<name>','Are\x20you\x20sure\x20you\x20want\x20to\x20remove\x20profile\x20\x27','Unknown\x20key\x20\x27','Enter\x20profile\x20name:','site','tdx:\x20profile\x20set','\x20API\x20key\x20saved\x20to\x20system\x20keychain\x20(profile:\x20','profile:create','jobs','confirm','\x20Profile\x20\x27','Key=value\x20pair\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','\x27\x20requires\x20API\x20key\x20validation.','\x0aOperation\x20cancelled','\x0aTip:\x20Use\x20\x27tdx\x20profile\x20use\x20','\x0aSetup\x20cancelled','8nnyYtQ','error','You\x20can\x20now\x20use\x20tdx\x20commands\x20with\x20this\x20profile.\x20Try:','apiKey','Changing\x20site\x20to\x20\x27','You\x20can\x20find\x20your\x20API\x20key\x20at:','dim','\x27\x20does\x20not\x20exist.','Invalid\x20format.\x20Use:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','split','Set\x20a\x20profile\x20configuration\x20value','profileName','Validating\x20API\x20key...','name','\x27\x20created','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20use\x20<name>\x20[--default]'];a33_0xe687=function(){return _0x276508;};return a33_0xe687();}import{TDX}from'../sdk/index.js';import{LogLevel}from'../utils/tdx-logger.js';import a33_0x21c6c5 from'prompts';import a33_0x58fcc0 from'chalk';function validateProfileName(_0x4e1c4b,_0x19e69c){const _0xb2475d=a33_0x42be;if(!_0x4e1c4b||!_0x4e1c4b[_0xb2475d(0x1e7)]())return _0xb2475d(0x1a3);const _0x1050ea=_0x4e1c4b[_0xb2475d(0x1e7)]();if(!/^[a-zA-Z0-9_-]+$/[_0xb2475d(0x1e1)](_0x1050ea))return'Profile\x20name\x20must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore';if(!_0x19e69c?.['skipExistsCheck']&&profileExists(_0x1050ea))return _0xb2475d(0x199)+_0x1050ea+'\x27\x20already\x20exists.\x20Use\x20\x27tdx\x20profile\x20delete\x20'+_0x1050ea+_0xb2475d(0x1d8);return!![];}async function deleteProfileAndCredentials(_0x342bce){const _0x17427a=a33_0x42be;removeProfileFromUserConfig(_0x342bce);const _0x2a2148=await isKeychainAvailable();_0x2a2148&&await Promise[_0x17427a(0x1af)]([deleteKeychainAPIKey(_0x342bce),deleteOAuthTokens(_0x342bce)]);}export class ProfileCreateCommand extends BaseCommand{[a33_0x301160(0x1cd)]=a33_0x301160(0x1b7);[a33_0x301160(0x1fe)]=a33_0x301160(0x1de);async[a33_0x301160(0x1ed)](_0x43873e){const _0x333528=a33_0x301160,{options:_0x5260e7,args:_0x6d7971}=_0x43873e,_0x659892=!!_0x5260e7['force'];console[_0x333528(0x1a0)](a33_0x58fcc0[_0x333528(0x1ae)](_0x333528(0x1da)));let _0x4a3d8a;if(_0x6d7971[_0x333528(0x1fd)]>0x0&&_0x6d7971[0x0]){const _0x312714=_0x6d7971[0x0][_0x333528(0x1e7)]();_0x659892&&profileExists(_0x312714)&&(await deleteProfileAndCredentials(_0x312714),console[_0x333528(0x1a0)](_0x333528(0x1e2)+_0x312714+'\x27'));const _0x130186=validateProfileName(_0x312714);if(_0x130186!==!![])return console['error'](a33_0x58fcc0[_0x333528(0x19d)](_0x130186)),0x1;_0x4a3d8a=_0x312714;}else{const _0x16e1bb=await a33_0x21c6c5({'type':_0x333528(0x1a6),'name':_0x333528(0x1cb),'message':_0x333528(0x1b3),'validate':_0x53d8e2=>validateProfileName(_0x53d8e2,{'skipExistsCheck':_0x659892})});if(!_0x16e1bb[_0x333528(0x1cb)])return console[_0x333528(0x1a0)](_0x333528(0x1bf)),0x1;_0x4a3d8a=_0x16e1bb['profileName'][_0x333528(0x1e7)](),_0x659892&&profileExists(_0x4a3d8a)&&(await deleteProfileAndCredentials(_0x4a3d8a),console[_0x333528(0x1a0)](_0x333528(0x1e2)+_0x4a3d8a+'\x27'));}const _0x3e66c3=await a33_0x21c6c5({'type':_0x333528(0x1a6),'name':_0x333528(0x1fe),'message':'Enter\x20description\x20(optional):'}),_0x2f8edd=_0x3e66c3[_0x333528(0x1fe)]?.[_0x333528(0x1e7)]()||undefined,_0xc9c7d9=_0x5260e7[_0x333528(0x1b4)]||'us01',_0x2a7f91=await promptSiteSelection(_0xc9c7d9,_0x4a3d8a,_0x333528(0x1f5));if(!_0x2a7f91)return 0x1;const _0x55f193=resolveSite(_0x2a7f91),_0x462bbb=await promptAuthMethod();if(!_0x462bbb)return console[_0x333528(0x1a0)](_0x333528(0x1bf)),0x1;if(_0x462bbb===_0x333528(0x1d1)){if(_0x2f8edd){const _0x337f2d={'site':_0x55f193,'description':_0x2f8edd};saveProfileToUserConfig(_0x4a3d8a,_0x337f2d);}const {accountName:_0x378859}=_0x5260e7;return await runOAuthLoginFlow(_0x55f193,_0x4a3d8a,_0x5260e7[_0x333528(0x1f2)]??LogLevel[_0x333528(0x19c)],{'accountName':_0x378859}),0x0;}console[_0x333528(0x1a0)](_0x333528(0x19a)+_0x55f193),console['log'](_0x333528(0x1c5)),console[_0x333528(0x1a0)]('\x20\x20'+getConsoleUrl(_0x55f193,_0x333528(0x1aa)));const _0x1c7d60=await a33_0x21c6c5({'type':_0x333528(0x1f4),'name':_0x333528(0x1c3),'message':'Enter\x20your\x20TD\x20API\x20key:','validate':_0xaea545=>{const _0x3ffa73=_0x333528;if(!_0xaea545||!_0xaea545[_0x3ffa73(0x1e7)]())return _0x3ffa73(0x1dd);return!![];}});if(!_0x1c7d60[_0x333528(0x1c3)])return console['log'](_0x333528(0x1bf)),0x1;const _0x1c6010=_0x1c7d60['apiKey'];console[_0x333528(0x1a0)](_0x333528(0x1cc));try{const _0x57663a=TDX['create']({'site':_0x55f193,'apiKey':_0x1c6010[_0x333528(0x1e7)](),'logLevel':_0x5260e7[_0x333528(0x1f2)]??LogLevel[_0x333528(0x19c)]}),_0x4f26bd=await _0x57663a[_0x333528(0x1b8)][_0x333528(0x1e0)]();console[_0x333528(0x1a0)](a33_0x58fcc0[_0x333528(0x19b)]('✓')+'\x20API\x20key\x20is\x20valid\x20(User:\x20'+_0x4f26bd[_0x333528(0x201)]+')');const _0x375e9d=await isKeychainAvailable();_0x375e9d?(await saveAPIKeyAsync(_0x1c6010[_0x333528(0x1e7)](),_0x55f193,_0x4a3d8a),console[_0x333528(0x1a0)](a33_0x58fcc0['green']('✓')+_0x333528(0x1b6)+_0x4a3d8a+')')):(console[_0x333528(0x200)](a33_0x58fcc0[_0x333528(0x1e5)](_0x333528(0x1ff))),console[_0x333528(0x200)](a33_0x58fcc0['yellow'](_0x333528(0x1ec))));const _0x233d91={'site':_0x55f193,..._0x2f8edd&&{'description':_0x2f8edd}};return saveProfileToUserConfig(_0x4a3d8a,_0x233d91),console['log'](a33_0x58fcc0[_0x333528(0x19b)]('✓')+'\x20Profile\x20\x27'+_0x4a3d8a+_0x333528(0x1ce)),console[_0x333528(0x1a0)](),console['log'](_0x333528(0x1c2)),console['log'](_0x333528(0x19e)+_0x4a3d8a+_0x333528(0x1a1)),console[_0x333528(0x1a0)]('\x20\x20tdx\x20--profile\x20'+_0x4a3d8a+_0x333528(0x1d4)),0x0;}catch(_0x26b69e){if(_0x26b69e instanceof HTTPClientError&&_0x26b69e[_0x333528(0x1ef)]===0x191)return printAuthError(_0x26b69e),0x1;return console['error'](a33_0x58fcc0[_0x333528(0x19d)](_0x333528(0x204)+(_0x26b69e instanceof Error?_0x26b69e[_0x333528(0x1ab)]:String(_0x26b69e)))),console[_0x333528(0x1c1)](_0x333528(0x1ee)),0x1;}}}export class ProfileDeleteCommand extends BaseCommand{[a33_0x301160(0x1cd)]=a33_0x301160(0x1d2);[a33_0x301160(0x1fe)]='Delete\x20a\x20profile';[a33_0x301160(0x196)](_0x3638a9){const _0x944620=a33_0x301160,{args:_0x4ec25c}=_0x3638a9;if(_0x4ec25c[_0x944620(0x1fd)]===0x0)return _0x944620(0x1b0);return undefined;}async[a33_0x301160(0x1ed)](_0x1f9c28){const _0x2e2b1d=a33_0x301160,{args:_0x36ac7c}=_0x1f9c28,_0x28d7a2=_0x36ac7c[0x0];console[_0x2e2b1d(0x1a0)](a33_0x58fcc0[_0x2e2b1d(0x1ae)](_0x2e2b1d(0x1f7)));if(!profileExists(_0x28d7a2)){console[_0x2e2b1d(0x1c1)](a33_0x58fcc0[_0x2e2b1d(0x19d)](_0x2e2b1d(0x199)+_0x28d7a2+_0x2e2b1d(0x1c7))),console[_0x2e2b1d(0x1a0)](_0x2e2b1d(0x1fa));const _0x12357f=listProfiles();if(_0x12357f[_0x2e2b1d(0x1fd)]===0x0)console[_0x2e2b1d(0x1a0)]('\x20\x20(no\x20profiles\x20found)');else for(const _0x58a66f of _0x12357f){console[_0x2e2b1d(0x1a0)]('\x20\x20-\x20'+_0x58a66f[_0x2e2b1d(0x1cd)]);}return 0x1;}const _0x2f8b51=await a33_0x21c6c5({'type':_0x2e2b1d(0x1b9),'name':'confirm','message':_0x2e2b1d(0x1b1)+_0x28d7a2+'\x27?','initial':![]});if(!_0x2f8b51[_0x2e2b1d(0x1b9)])return console[_0x2e2b1d(0x1a0)]('Removal\x20cancelled'),0x0;try{await deleteProfileAndCredentials(_0x28d7a2),console[_0x2e2b1d(0x1a0)](a33_0x58fcc0[_0x2e2b1d(0x19b)]('✓')+_0x2e2b1d(0x1ba)+_0x28d7a2+_0x2e2b1d(0x1e6));}catch(_0x51ea14){return console[_0x2e2b1d(0x1c1)](a33_0x58fcc0[_0x2e2b1d(0x19d)]('Failed\x20to\x20delete\x20profile:\x20'+(_0x51ea14 instanceof Error?_0x51ea14[_0x2e2b1d(0x1ab)]:String(_0x51ea14)))),0x1;}return 0x0;}}export class ProfileSetCommand extends BaseCommand{['name']=a33_0x301160(0x1a8);[a33_0x301160(0x1fe)]=a33_0x301160(0x1ca);static ['VALID_KEYS']=[a33_0x301160(0x1b4),a33_0x301160(0x1dc),'parent_segment',a33_0x301160(0x1a7),a33_0x301160(0x1d9),a33_0x301160(0x1fe)];[a33_0x301160(0x196)](_0x446fa2){const _0x246c0c=a33_0x301160,{args:_0x49cace,options:_0x3b9c72}=_0x446fa2,_0x5ecbfb=_0x3b9c72[_0x246c0c(0x202)]||getActiveProfile();if(!_0x5ecbfb)return _0x246c0c(0x1f1);if(_0x49cace[_0x246c0c(0x1fd)]===0x0)return _0x246c0c(0x1bb)+ProfileSetCommand[_0x246c0c(0x19f)][_0x246c0c(0x1e9)](',\x20');const _0x2b42f9=_0x49cace[0x0];if(!_0x2b42f9['includes']('='))return _0x246c0c(0x1c8)+ProfileSetCommand[_0x246c0c(0x19f)][_0x246c0c(0x1e9)](',\x20');const [_0x3af7b9]=_0x2b42f9[_0x246c0c(0x1c9)]('=',0x2);if(!ProfileSetCommand[_0x246c0c(0x19f)][_0x246c0c(0x203)](_0x3af7b9))return _0x246c0c(0x1b2)+_0x3af7b9+_0x246c0c(0x1ac)+ProfileSetCommand[_0x246c0c(0x19f)][_0x246c0c(0x1e9)](',\x20');return undefined;}async[a33_0x301160(0x1ed)](_0x4f8143){const _0x2687a6=a33_0x301160,{args:_0x36ea3b,options:_0x396141}=_0x4f8143,_0x36ccc0=_0x396141[_0x2687a6(0x202)]||getActiveProfile(),[_0x165080,..._0x3a1649]=_0x36ea3b[0x0][_0x2687a6(0x1c9)]('='),_0x44ee08=_0x3a1649[_0x2687a6(0x1e9)]('=');console[_0x2687a6(0x1a0)](a33_0x58fcc0['bold'](_0x2687a6(0x1b5)));if(!profileExists(_0x36ccc0)){const _0x22d9ac=await a33_0x21c6c5({'type':_0x2687a6(0x1b9),'name':_0x2687a6(0x1d7),'message':_0x2687a6(0x199)+_0x36ccc0+_0x2687a6(0x1a4),'initial':!![]});if(!_0x22d9ac[_0x2687a6(0x1d7)])return console[_0x2687a6(0x1a0)]('Operation\x20cancelled'),0x1;}const _0x2b9797=loadProfile(_0x36ccc0),_0x1ec176=_0x2b9797?.[_0x2687a6(0x1d5)]||{};if(_0x165080==='site'){const _0x36abba=resolveSite(_0x44ee08);console[_0x2687a6(0x1a0)](_0x2687a6(0x1c4)+_0x36abba+_0x2687a6(0x1bc)),console[_0x2687a6(0x1a0)]('\x0aYou\x20can\x20find\x20your\x20API\x20key\x20at:'),console[_0x2687a6(0x1a0)]('\x20\x20'+getConsoleUrl(_0x36abba,_0x2687a6(0x1aa)));const _0x9832b7=await a33_0x21c6c5({'type':_0x2687a6(0x1f4),'name':_0x2687a6(0x1c3),'message':_0x2687a6(0x1e3),'validate':_0x13cfac=>{const _0x514f36=_0x2687a6;if(!_0x13cfac||!_0x13cfac[_0x514f36(0x1e7)]())return'API\x20key\x20cannot\x20be\x20empty';return!![];}});if(!_0x9832b7[_0x2687a6(0x1c3)])return console[_0x2687a6(0x1a0)](_0x2687a6(0x1bd)),0x1;console[_0x2687a6(0x1a0)](_0x2687a6(0x1cc));try{const _0x3d409f=TDX[_0x2687a6(0x1d7)]({'site':_0x36abba,'apiKey':_0x9832b7[_0x2687a6(0x1c3)][_0x2687a6(0x1e7)](),'logLevel':_0x396141['logLevel']??LogLevel[_0x2687a6(0x19c)]}),_0x16cb06=await _0x3d409f[_0x2687a6(0x1b8)]['getUserInfo']();console[_0x2687a6(0x1a0)](a33_0x58fcc0['green']('✓')+_0x2687a6(0x1a9)+_0x16cb06[_0x2687a6(0x201)]+')');const _0x218e7d=await isKeychainAvailable();_0x218e7d?(await saveAPIKeyAsync(_0x9832b7['apiKey'][_0x2687a6(0x1e7)](),_0x36abba,_0x36ccc0),console['log'](a33_0x58fcc0['green']('✓')+_0x2687a6(0x1f0))):console['warn'](a33_0x58fcc0['yellow'](_0x2687a6(0x1ff))),_0x1ec176[_0x2687a6(0x1b4)]=_0x36abba;}catch(_0x176cc6){if(_0x176cc6 instanceof HTTPClientError&&_0x176cc6[_0x2687a6(0x1ef)]===0x191)return printAuthError(_0x176cc6),0x1;return console[_0x2687a6(0x1c1)](a33_0x58fcc0['red'](_0x2687a6(0x204)+(_0x176cc6 instanceof Error?_0x176cc6['message']:String(_0x176cc6)))),console[_0x2687a6(0x1c1)](_0x2687a6(0x1d3)),0x1;}}else _0x1ec176[_0x165080]=_0x44ee08||undefined;return saveProfileToUserConfig(_0x36ccc0,_0x1ec176),console[_0x2687a6(0x1a0)](a33_0x58fcc0[_0x2687a6(0x19b)]('✓')+'\x20Profile\x20\x27'+_0x36ccc0+_0x2687a6(0x1fb)+_0x165080+'='+(_0x44ee08||_0x2687a6(0x1fc))),0x0;}}export class ProfileUseCommand extends BaseCommand{[a33_0x301160(0x1cd)]=a33_0x301160(0x1f3);['description']=a33_0x301160(0x1df);[a33_0x301160(0x196)](_0x3af32f){const _0x59e2c9=a33_0x301160,{args:_0x221681}=_0x3af32f;if(_0x221681[_0x59e2c9(0x1fd)]===0x0)return _0x59e2c9(0x1cf);return undefined;}async[a33_0x301160(0x1ed)](_0x2fad7f){const _0x28de07=a33_0x301160,{args:_0x4cc8f6,options:_0x4b36a1}=_0x2fad7f,_0x354ae5=_0x4cc8f6[0x0],_0x539cd0=_0x4b36a1[_0x28de07(0x1f9)];cleanExpiredSessions();if(!profileExists(_0x354ae5)){console[_0x28de07(0x1c1)](a33_0x58fcc0[_0x28de07(0x19d)](_0x28de07(0x199)+_0x354ae5+_0x28de07(0x1c7))),console[_0x28de07(0x1a0)](_0x28de07(0x1fa));const _0x4c68cc=listProfiles();if(_0x4c68cc[_0x28de07(0x1fd)]===0x0)console[_0x28de07(0x1a0)]('\x20\x20(no\x20profiles\x20found)');else for(const _0x3ffe79 of _0x4c68cc){console['log'](_0x28de07(0x1f8)+_0x3ffe79[_0x28de07(0x1cd)]);}return 0x1;}if(_0x539cd0){const _0x2b8509=a33_0x4cf3ae[_0x28de07(0x1e9)](getConfigDir(),'tdx.json');return saveActiveProfileToUserConfig(_0x354ae5),console['log'](_0x28de07(0x1eb)+a33_0x58fcc0['green'](_0x354ae5)),console['log'](a33_0x58fcc0[_0x28de07(0x1c6)](_0x28de07(0x1ad)+_0x2b8509)),0x0;}const _0x46f21b=getSessionID(_0x4b36a1[_0x28de07(0x1a2)]);return saveSessionContext({'profile':_0x354ae5},_0x4b36a1['session']),console['log']('Session\x20profile\x20set\x20to:\x20'+a33_0x58fcc0[_0x28de07(0x19b)](_0x354ae5)+'\x20'+a33_0x58fcc0[_0x28de07(0x1c6)](_0x28de07(0x1ea)+_0x46f21b+')')),console[_0x28de07(0x1a0)](a33_0x58fcc0[_0x28de07(0x1c6)](_0x28de07(0x1be)+_0x354ae5+_0x28de07(0x1d0))),0x0;}}
@@ -1 +1 @@
1
- function a34_0x5515(){const _0x346c08=['196198ZApowb','site','dim','green','profiles','error','length','log','No\x20profiles\x20found.\x20Define\x20profiles\x20in\x20tdx.json:\x0a','12zCCZmE','492Srbhxx','message','Error:\x20','map','3234011eyShTw','5545848yfrUPY','description','4490ebkvmE','4yWThBI','1873640XpXJZd','89568iiAtiH','4480gHCaof','config','name','\x20\x20Local:\x20\x20(project\x20folder)/tdx.json','execute','855waTSiq'];a34_0x5515=function(){return _0x346c08;};return a34_0x5515();}function a34_0x20a7(_0x15530e,_0x38c403){_0x15530e=_0x15530e-0x127;const _0x551518=a34_0x5515();let _0x20a71f=_0x551518[_0x15530e];return _0x20a71f;}const a34_0x2886a5=a34_0x20a7;(function(_0x5bfb9f,_0x31e5db){const _0x57528b=a34_0x20a7,_0x434a50=_0x5bfb9f();while(!![]){try{const _0x596e08=parseInt(_0x57528b(0x13b))/0x1*(-parseInt(_0x57528b(0x129))/0x2)+parseInt(_0x57528b(0x132))/0x3*(-parseInt(_0x57528b(0x13d))/0x4)+parseInt(_0x57528b(0x13c))/0x5+parseInt(_0x57528b(0x133))/0x6*(parseInt(_0x57528b(0x13e))/0x7)+parseInt(_0x57528b(0x138))/0x8+parseInt(_0x57528b(0x128))/0x9*(parseInt(_0x57528b(0x13a))/0xa)+-parseInt(_0x57528b(0x137))/0xb;if(_0x596e08===_0x31e5db)break;else _0x434a50['push'](_0x434a50['shift']());}catch(_0x326c96){_0x434a50['push'](_0x434a50['shift']());}}}(a34_0x5515,0x5e839));import{BaseCommand}from'./command.js';import{listProfiles,getActiveProfile,getProfileParams}from'../core/profile.js';import{handleSDKOutput,isStructuredFormat}from'../core/command-output.js';import a34_0x93b6e3 from'chalk';export class ProfilesCommand extends BaseCommand{['name']=a34_0x2886a5(0x12d);['description']='List\x20all\x20available\x20profiles';async[a34_0x2886a5(0x127)](_0x4fdb20){const _0x4e53f6=a34_0x2886a5,{options:_0xd9fc63}=_0x4fdb20;try{const _0x4f84ee=listProfiles(),_0x266519=getActiveProfile();if(_0x4f84ee[_0x4e53f6(0x12f)]===0x0)return console[_0x4e53f6(0x130)](_0x4e53f6(0x131)),console[_0x4e53f6(0x130)](_0x4e53f6(0x141)),console[_0x4e53f6(0x130)]('\x20\x20Global:\x20~/.config/tdx/tdx.json'),0x0;const _0x4390c7=_0x4f84ee[_0x4e53f6(0x136)](_0x583b46=>{const _0x3f3534=_0x4e53f6,_0x50d549=_0x583b46[_0x3f3534(0x140)]===_0x266519,_0x855bcf=getProfileParams(_0x583b46['config']);return{'name':_0x583b46['name'],'active':_0x50d549,'scope':_0x583b46['scope'],'description':_0x583b46['config']['description']||'','params':_0x855bcf};});if(isStructuredFormat(_0xd9fc63))await handleSDKOutput(_0x4390c7,_0xd9fc63);else for(const _0x5981ce of _0x4f84ee){const _0x375a2e=_0x5981ce[_0x4e53f6(0x140)]===_0x266519?a34_0x93b6e3[_0x4e53f6(0x12c)]('\x20✓'):'',_0x914f8b=_0x5981ce[_0x4e53f6(0x13f)][_0x4e53f6(0x12a)]?a34_0x93b6e3[_0x4e53f6(0x12b)]('\x20'+_0x5981ce['config'][_0x4e53f6(0x12a)]):'',_0x551c39=_0x5981ce[_0x4e53f6(0x13f)]['description']?a34_0x93b6e3[_0x4e53f6(0x12b)]('\x20\x20'+_0x5981ce[_0x4e53f6(0x13f)][_0x4e53f6(0x139)]):'';console['log']('👤\x20'+_0x5981ce[_0x4e53f6(0x140)]+_0x375a2e+_0x914f8b+_0x551c39);}return 0x0;}catch(_0x434de0){return _0x434de0 instanceof Error&&console[_0x4e53f6(0x12e)](_0x4e53f6(0x135)+_0x434de0[_0x4e53f6(0x134)]),0x1;}}}
1
+ const a34_0x398238=a34_0x2a6b;(function(_0xfc805b,_0x47a1be){const _0x47162e=a34_0x2a6b,_0x108823=_0xfc805b();while(!![]){try{const _0x259a7c=parseInt(_0x47162e(0x7a))/0x1*(-parseInt(_0x47162e(0x85))/0x2)+-parseInt(_0x47162e(0x82))/0x3+parseInt(_0x47162e(0x7e))/0x4*(parseInt(_0x47162e(0x6e))/0x5)+-parseInt(_0x47162e(0x79))/0x6*(parseInt(_0x47162e(0x7b))/0x7)+parseInt(_0x47162e(0x71))/0x8*(-parseInt(_0x47162e(0x7c))/0x9)+-parseInt(_0x47162e(0x7f))/0xa*(-parseInt(_0x47162e(0x74))/0xb)+parseInt(_0x47162e(0x70))/0xc;if(_0x259a7c===_0x47a1be)break;else _0x108823['push'](_0x108823['shift']());}catch(_0x268136){_0x108823['push'](_0x108823['shift']());}}}(a34_0x3831,0x6261c));function a34_0x3831(){const _0x1c0f41=['message','17646060LwTKLb','16EQLDkx','No\x20profiles\x20found.\x20Define\x20profiles\x20in\x20tdx.json:\x0a','name','384263efKRSf','execute','map','\x20\x20Global:\x20~/.config/tdx/tdx.json','config','6BYYilT','1LKORof','4131806WYpuhz','2200743UeZxIQ','👤\x20','4yfnjll','20kTAerv','dim','length','203082ZZqSYH','List\x20all\x20available\x20profiles','log','929078YCcpjZ','description','green','Error:\x20','site','2370730samxGq'];a34_0x3831=function(){return _0x1c0f41;};return a34_0x3831();}function a34_0x2a6b(_0xb03de6,_0x3a1266){_0xb03de6=_0xb03de6-0x6a;const _0x38314c=a34_0x3831();let _0x2a6b86=_0x38314c[_0xb03de6];return _0x2a6b86;}import{BaseCommand}from'./command.js';import{listProfiles,getActiveProfile,getProfileParams}from'../core/profile.js';import{handleSDKOutput,isStructuredFormat}from'../core/command-output.js';import a34_0x296370 from'chalk';export class ProfilesCommand extends BaseCommand{[a34_0x398238(0x73)]='profiles';[a34_0x398238(0x6a)]=a34_0x398238(0x83);async[a34_0x398238(0x75)](_0x303103){const _0x1468cb=a34_0x398238,{options:_0x285c20}=_0x303103;try{const _0x50beaa=listProfiles(),_0x410c1d=getActiveProfile();if(_0x50beaa[_0x1468cb(0x81)]===0x0)return console[_0x1468cb(0x84)](_0x1468cb(0x72)),console['log']('\x20\x20Local:\x20\x20(project\x20folder)/tdx.json'),console[_0x1468cb(0x84)](_0x1468cb(0x77)),0x0;const _0x4a401e=_0x50beaa[_0x1468cb(0x76)](_0x5ab53a=>{const _0x36617f=_0x1468cb,_0x346dc1=_0x5ab53a[_0x36617f(0x73)]===_0x410c1d,_0x25b59d=getProfileParams(_0x5ab53a['config']);return{'name':_0x5ab53a['name'],'active':_0x346dc1,'scope':_0x5ab53a['scope'],'description':_0x5ab53a[_0x36617f(0x78)][_0x36617f(0x6a)]||'','params':_0x25b59d};});if(isStructuredFormat(_0x285c20))await handleSDKOutput(_0x4a401e,_0x285c20);else for(const _0x5da3f8 of _0x50beaa){const _0x2d8beb=_0x5da3f8['name']===_0x410c1d?a34_0x296370[_0x1468cb(0x6b)]('\x20✓'):'',_0x517ae3=_0x5da3f8[_0x1468cb(0x78)][_0x1468cb(0x6d)]?a34_0x296370[_0x1468cb(0x80)]('\x20'+_0x5da3f8[_0x1468cb(0x78)][_0x1468cb(0x6d)]):'',_0x55106f=_0x5da3f8[_0x1468cb(0x78)][_0x1468cb(0x6a)]?a34_0x296370[_0x1468cb(0x80)]('\x20\x20'+_0x5da3f8[_0x1468cb(0x78)]['description']):'';console[_0x1468cb(0x84)](_0x1468cb(0x7d)+_0x5da3f8[_0x1468cb(0x73)]+_0x2d8beb+_0x517ae3+_0x55106f);}return 0x0;}catch(_0x4ae48e){return _0x4ae48e instanceof Error&&console['error'](_0x1468cb(0x6c)+_0x4ae48e[_0x1468cb(0x6f)]),0x1;}}}
@@ -1 +1 @@
1
- const a35_0x13a7eb=a35_0x37d9;(function(_0xb24b36,_0x1aa2d9){const _0x880e12=a35_0x37d9,_0x15e4bd=_0xb24b36();while(!![]){try{const _0x5be22e=parseInt(_0x880e12(0xc2))/0x1+-parseInt(_0x880e12(0xb3))/0x2*(parseInt(_0x880e12(0xd4))/0x3)+-parseInt(_0x880e12(0xd1))/0x4*(parseInt(_0x880e12(0xe5))/0x5)+parseInt(_0x880e12(0xe1))/0x6+-parseInt(_0x880e12(0xbc))/0x7*(parseInt(_0x880e12(0xc6))/0x8)+-parseInt(_0x880e12(0xdb))/0x9*(parseInt(_0x880e12(0xc8))/0xa)+parseInt(_0x880e12(0xd2))/0xb;if(_0x5be22e===_0x1aa2d9)break;else _0x15e4bd['push'](_0x15e4bd['shift']());}catch(_0x54d47e){_0x15e4bd['push'](_0x15e4bd['shift']());}}}(a35_0x464f,0xb124a));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';function a35_0x464f(){const _0x30f2cb=['Executing\x20query...','2132104TUAwFh','setJobId','500AnuEau','error','Catalog:\x20','totalSplits','data','push','in\x20','Usage:\x20tdx\x20query\x20\x22SELECT\x20*\x20FROM\x20table\x22\x0a\x20\x20\x20or:\x20tdx\x20query\x20query.sql\x0a\x20\x20\x20or:\x20echo\x20\x22SELECT\x201\x22\x20|\x20tdx\x20query\x20-\x0a\x0aRun\x20\x27tdx\x20query\x20--help\x27\x20for\x20more\x20options','message','933004OnLPWr','10994467FhybCf','stats','3mMmnId','Site:\x20','length','Executing\x20query\x20[','Executing\x20statement\x20','Schema:\x20','query','62838NgzEYK','information_schema','database','options','setExtra','elapsedTimeMillis','6714870CcsEXy','catalog','site','\x20rows\x20','10hCPJuR','args','processedRows','\x20splits','verbose','Statement\x20','779554WMtPhn','output','file','execute','description','setPhase','SQL:\x20','No\x20SQL\x20provided','Error:\x20','7sJkaqZ','jobId','\x20-\x20','name','state','\x0aAll\x20results\x20saved\x20to\x20','78828npHeGq','\x20[Job\x20ID:\x20','Cannot\x20specify\x20both\x20SQL\x20argument\x20and\x20--file\x20option'];a35_0x464f=function(){return _0x30f2cb;};return a35_0x464f();}import{handleQueryOutput,formatQueryOutput,resolveOutputOptions}from'../core/command-output.js';import{readSqlStatementsFromFile,readSqlStatementsFromStdin,splitSqlStatements,isSqlFilePath}from'../sdk/query/sql-parser.js';import{writeFileSync}from'fs';function a35_0x37d9(_0x4edb85,_0x24ef0f){_0x4edb85=_0x4edb85-0xae;const _0x464ff9=a35_0x464f();let _0x37d927=_0x464ff9[_0x4edb85];return _0x37d927;}import{withProgressSpinner,formatElapsed}from'../utils/spinner.js';import{formatRows}from'../sdk/util/formatters.js';export class QueryCommand extends BaseCommand{[a35_0x13a7eb(0xbf)]=a35_0x13a7eb(0xda);[a35_0x13a7eb(0xb7)]='Run\x20Trino\x20queries\x20(streaming)';async[a35_0x13a7eb(0xb6)](_0x588844){const _0x49d797=a35_0x13a7eb,{options:_0x536fe8,args:_0x3a6bc9,tdx:_0x4a00b4}=_0x588844,_0x523762={..._0x536fe8,'limitStructuredFormats':!![]},_0x45e174=_0x3a6bc9[0x0],_0x28a664=_0x536fe8[_0x49d797(0xb5)];let _0x4de295;try{if(_0x28a664)_0x4de295=readSqlStatementsFromFile(_0x28a664);else{if(_0x45e174==='-')_0x4de295=await readSqlStatementsFromStdin();else{if(_0x45e174&&isSqlFilePath(_0x45e174))_0x4de295=readSqlStatementsFromFile(_0x45e174);else{if(_0x45e174)_0x4de295=splitSqlStatements(_0x45e174);else throw new Error(_0x49d797(0xba));}}}}catch(_0x17d0db){return console['error'](_0x49d797(0xbb)+_0x17d0db[_0x49d797(0xd0)]),0x1;}const _0x3e5a79=_0x536fe8[_0x49d797(0xdd)]||_0x49d797(0xdc),_0x1bc369=_0x536fe8[_0x49d797(0xe2)];try{const _0x5422d0=[],_0x5e19ee=!!_0x536fe8[_0x49d797(0xb4)];for(let _0x14992e=0x0;_0x14992e<_0x4de295['length'];_0x14992e++){const _0x52a6ac=_0x4de295[_0x14992e],_0x1f477d=_0x14992e+0x1,_0x4f2b50=_0x4de295[_0x49d797(0xd6)],_0x572eaa=_0x4f2b50>0x1;_0x536fe8[_0x49d797(0xb1)]&&(console[_0x49d797(0xc9)]('\x0a'+(_0x572eaa?_0x49d797(0xb2)+_0x1f477d+'/'+_0x4f2b50+':':'')),console[_0x49d797(0xc9)](_0x49d797(0xd5)+_0x536fe8[_0x49d797(0xe3)]),console[_0x49d797(0xc9)](_0x49d797(0xca)+(_0x1bc369||'td')),console[_0x49d797(0xc9)](_0x49d797(0xd9)+_0x3e5a79),console[_0x49d797(0xc9)](_0x49d797(0xb9)+_0x52a6ac));const _0x3a428e=_0x572eaa?_0x49d797(0xd8)+_0x1f477d+'/'+_0x4f2b50+'...':_0x49d797(0xc5);try{const _0x1fb637=await withProgressSpinner(_0x3a428e,async _0xee2427=>{const _0x39279c=_0x49d797,_0x3224d7=await _0x4a00b4[_0x39279c(0xda)][_0x39279c(0xb6)](_0x52a6ac,{'catalog':_0x1bc369,'schema':_0x3e5a79,'onJobId':_0x2c93d2=>{const _0x2be109=_0x39279c;_0xee2427[_0x2be109(0xc7)](_0x2c93d2);},'onProgress':_0x19172f=>{const _0x574101=_0x39279c;_0xee2427[_0x574101(0xb8)](_0x574101(0xd7)+_0x19172f[_0x574101(0xc0)]+']'),_0xee2427[_0x574101(0xdf)](formatRows(_0x19172f[_0x574101(0xaf)])+_0x574101(0xe4)+_0x19172f['completedSplits']+'/'+_0x19172f[_0x574101(0xcb)]+_0x574101(0xb0));}});return _0x3224d7;},{'verbose':_0x536fe8[_0x49d797(0xb1)]}),_0x225d33=_0x1fb637[_0x49d797(0xcc)],_0xdcd5bf=_0x225d33[_0x49d797(0xbd)]?_0x49d797(0xc3)+_0x225d33[_0x49d797(0xbd)]+']':'',_0x1cbaeb=_0x572eaa?_0x49d797(0xb2)+_0x1f477d+'/'+_0x4f2b50+_0x49d797(0xbe):'';console[_0x49d797(0xc9)]('✔\x20'+_0x1cbaeb+'Query\x20completed:\x20Processed\x20'+formatRows(_0x225d33[_0x49d797(0xd3)][_0x49d797(0xaf)])+_0x49d797(0xe4)+(_0x49d797(0xce)+formatElapsed(_0x225d33['stats'][_0x49d797(0xe0)])+_0xdcd5bf));if(_0x572eaa&&_0x5e19ee){const _0xdf1d36=resolveOutputOptions(_0x523762),_0x32b690=await formatQueryOutput(_0x225d33,_0xdf1d36);_0x5422d0[_0x49d797(0xcd)](_0x32b690);}else await handleQueryOutput(_0x225d33,_0x523762);}catch(_0x4fb11f){const _0x472c2b=_0x572eaa?'Statement\x20'+_0x1f477d+'/'+_0x4f2b50+':\x0a':'',_0x52809e=_0x4fb11f instanceof SDKError?_0x4fb11f['originalMessage']:_0x4fb11f['message'];return console['error'](''+_0x472c2b+_0x52809e),0x1;}}if(_0x4de295[_0x49d797(0xd6)]>0x1&&_0x5e19ee&&_0x5422d0[_0x49d797(0xd6)]>0x0){const _0x3a7cc9=_0x5422d0['join']('\x0a');writeFileSync(_0x536fe8[_0x49d797(0xb4)],_0x3a7cc9),console[_0x49d797(0xc9)](_0x49d797(0xc1)+_0x536fe8[_0x49d797(0xb4)]);}return 0x0;}catch(_0x3ef9e5){throw _0x3ef9e5;}}['validate'](_0x1d0970){const _0x522703=a35_0x13a7eb,_0x129bee=_0x1d0970[_0x522703(0xae)][0x0],_0x394d72=_0x1d0970[_0x522703(0xde)]['file'];if(!_0x129bee&&!_0x394d72)return _0x522703(0xcf);if(_0x129bee&&_0x394d72)return _0x522703(0xc4);return undefined;}}
1
+ const a35_0x3d9ef7=a35_0x5453;(function(_0x1cb8a0,_0x126fdd){const _0x5cfd84=a35_0x5453,_0xe96c76=_0x1cb8a0();while(!![]){try{const _0x247c2d=-parseInt(_0x5cfd84(0x116))/0x1+parseInt(_0x5cfd84(0x12c))/0x2+parseInt(_0x5cfd84(0x11f))/0x3*(parseInt(_0x5cfd84(0x124))/0x4)+-parseInt(_0x5cfd84(0x135))/0x5*(-parseInt(_0x5cfd84(0x137))/0x6)+-parseInt(_0x5cfd84(0x123))/0x7+-parseInt(_0x5cfd84(0x132))/0x8*(-parseInt(_0x5cfd84(0x11c))/0x9)+-parseInt(_0x5cfd84(0x122))/0xa*(parseInt(_0x5cfd84(0x12e))/0xb);if(_0x247c2d===_0x126fdd)break;else _0xe96c76['push'](_0xe96c76['shift']());}catch(_0x206e04){_0xe96c76['push'](_0xe96c76['shift']());}}}(a35_0x495a,0x35ccd));import{BaseCommand}from'./command.js';function a35_0x495a(){const _0x210afa=['database','join','199461dDvEzn','Catalog:\x20','Usage:\x20tdx\x20query\x20\x22SELECT\x20*\x20FROM\x20table\x22\x0a\x20\x20\x20or:\x20tdx\x20query\x20query.sql\x0a\x20\x20\x20or:\x20echo\x20\x22SELECT\x201\x22\x20|\x20tdx\x20query\x20-\x0a\x0aRun\x20\x27tdx\x20query\x20--help\x27\x20for\x20more\x20options','10loKTnM','2072168qiOLlp','20Qcupsr','setJobId','Schema:\x20','Error:\x20','elapsedTimeMillis','data','file','output','786494RUmJXJ','message','5678299QpWFFw','validate','Executing\x20query...','processedRows','3192072osjaCx','stats','information_schema','5090uVuaSL','Site:\x20','1242rKqqjx','execute','error','Statement\x20','Executing\x20statement\x20','originalMessage','args','jobId','length','totalSplits','\x20rows\x20','Query\x20completed:\x20Processed\x20','verbose','\x20[Job\x20ID:\x20','\x20-\x20','Executing\x20query\x20[','query','Cannot\x20specify\x20both\x20SQL\x20argument\x20and\x20--file\x20option','state','in\x20','Run\x20Trino\x20queries\x20(streaming)','302819lpKMgA','name','catalog','No\x20SQL\x20provided','...','completedSplits','9wCRYjI'];a35_0x495a=function(){return _0x210afa;};return a35_0x495a();}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';function a35_0x5453(_0x3f4464,_0x270660){_0x3f4464=_0x3f4464-0x107;const _0x495a95=a35_0x495a();let _0x5453d9=_0x495a95[_0x3f4464];return _0x5453d9;}export class QueryCommand extends BaseCommand{[a35_0x3d9ef7(0x117)]=a35_0x3d9ef7(0x111);['description']=a35_0x3d9ef7(0x115);async[a35_0x3d9ef7(0x138)](_0x351746){const _0x36167e=a35_0x3d9ef7,{options:_0x44fca3,args:_0x48a3f5,tdx:_0x1ffffb}=_0x351746,_0x23ebbe={..._0x44fca3,'limitStructuredFormats':!![]},_0x189104=_0x48a3f5[0x0],_0x569a90=_0x44fca3[_0x36167e(0x12a)];let _0x3fb488;try{if(_0x569a90)_0x3fb488=readSqlStatementsFromFile(_0x569a90);else{if(_0x189104==='-')_0x3fb488=await readSqlStatementsFromStdin();else{if(_0x189104&&isSqlFilePath(_0x189104))_0x3fb488=readSqlStatementsFromFile(_0x189104);else{if(_0x189104)_0x3fb488=splitSqlStatements(_0x189104);else throw new Error(_0x36167e(0x119));}}}}catch(_0x7a8c6c){return console[_0x36167e(0x139)](_0x36167e(0x127)+_0x7a8c6c[_0x36167e(0x12d)]),0x1;}const _0x1aceea=_0x44fca3[_0x36167e(0x11d)]||_0x36167e(0x134),_0x435247=_0x44fca3[_0x36167e(0x118)];try{const _0x13d626=[],_0x593c4e=!!_0x44fca3[_0x36167e(0x12b)];for(let _0x253c00=0x0;_0x253c00<_0x3fb488[_0x36167e(0x109)];_0x253c00++){const _0x34feee=_0x3fb488[_0x253c00],_0x23fe3c=_0x253c00+0x1,_0x403fe5=_0x3fb488[_0x36167e(0x109)],_0x4588ac=_0x403fe5>0x1;_0x44fca3['verbose']&&(console['error']('\x0a'+(_0x4588ac?'Statement\x20'+_0x23fe3c+'/'+_0x403fe5+':':'')),console[_0x36167e(0x139)](_0x36167e(0x136)+_0x44fca3['site']),console[_0x36167e(0x139)](_0x36167e(0x120)+(_0x435247||'td')),console[_0x36167e(0x139)](_0x36167e(0x126)+_0x1aceea),console[_0x36167e(0x139)]('SQL:\x20'+_0x34feee));const _0x59f367=_0x4588ac?_0x36167e(0x13b)+_0x23fe3c+'/'+_0x403fe5+_0x36167e(0x11a):_0x36167e(0x130);try{const _0x491bae=await withProgressSpinner(_0x59f367,async _0x1ea9b5=>{const _0x1b1179=_0x36167e,_0xaa4e84=await _0x1ffffb['query'][_0x1b1179(0x138)](_0x34feee,{'catalog':_0x435247,'schema':_0x1aceea,'onJobId':_0x1bee42=>{const _0x5a9636=_0x1b1179;_0x1ea9b5[_0x5a9636(0x125)](_0x1bee42);},'onProgress':_0x10112c=>{const _0x107503=_0x1b1179;_0x1ea9b5['setPhase'](_0x107503(0x110)+_0x10112c[_0x107503(0x113)]+']'),_0x1ea9b5['setExtra'](formatRows(_0x10112c[_0x107503(0x131)])+_0x107503(0x10b)+_0x10112c[_0x107503(0x11b)]+'/'+_0x10112c[_0x107503(0x10a)]+'\x20splits');}});return _0xaa4e84;},{'verbose':_0x44fca3[_0x36167e(0x10d)]}),_0x29f2fa=_0x491bae[_0x36167e(0x129)],_0x516410=_0x29f2fa[_0x36167e(0x108)]?_0x36167e(0x10e)+_0x29f2fa[_0x36167e(0x108)]+']':'',_0x440082=_0x4588ac?_0x36167e(0x13a)+_0x23fe3c+'/'+_0x403fe5+_0x36167e(0x10f):'';console[_0x36167e(0x139)]('✔\x20'+_0x440082+_0x36167e(0x10c)+formatRows(_0x29f2fa[_0x36167e(0x133)]['processedRows'])+'\x20rows\x20'+(_0x36167e(0x114)+formatElapsed(_0x29f2fa[_0x36167e(0x133)][_0x36167e(0x128)])+_0x516410));if(_0x4588ac&&_0x593c4e){const _0x30e351=resolveOutputOptions(_0x23ebbe),_0x4e2ee2=await formatQueryOutput(_0x29f2fa,_0x30e351);_0x13d626['push'](_0x4e2ee2);}else await handleQueryOutput(_0x29f2fa,_0x23ebbe);}catch(_0x56f02e){const _0x5934b9=_0x4588ac?'Statement\x20'+_0x23fe3c+'/'+_0x403fe5+':\x0a':'',_0x32e203=_0x56f02e instanceof SDKError?_0x56f02e[_0x36167e(0x13c)]:_0x56f02e['message'];return console[_0x36167e(0x139)](''+_0x5934b9+_0x32e203),0x1;}}if(_0x3fb488[_0x36167e(0x109)]>0x1&&_0x593c4e&&_0x13d626['length']>0x0){const _0x313671=_0x13d626[_0x36167e(0x11e)]('\x0a');writeFileSync(_0x44fca3[_0x36167e(0x12b)],_0x313671),console[_0x36167e(0x139)]('\x0aAll\x20results\x20saved\x20to\x20'+_0x44fca3[_0x36167e(0x12b)]);}return 0x0;}catch(_0x486dc5){throw _0x486dc5;}}[a35_0x3d9ef7(0x12f)](_0x103fcd){const _0x9a21e5=a35_0x3d9ef7,_0x5d6f2c=_0x103fcd[_0x9a21e5(0x107)][0x0],_0x39ef8d=_0x103fcd['options'][_0x9a21e5(0x12a)];if(!_0x5d6f2c&&!_0x39ef8d)return _0x9a21e5(0x121);if(_0x5d6f2c&&_0x39ef8d)return _0x9a21e5(0x112);return undefined;}}
@@ -1 +1 @@
1
- const a36_0x448907=a36_0x3e96;(function(_0x5e6f03,_0x2fd85e){const _0x111f80=a36_0x3e96,_0x32c646=_0x5e6f03();while(!![]){try{const _0x5459e6=parseInt(_0x111f80(0x182))/0x1*(-parseInt(_0x111f80(0x18e))/0x2)+-parseInt(_0x111f80(0x1c2))/0x3*(parseInt(_0x111f80(0x180))/0x4)+parseInt(_0x111f80(0x1b5))/0x5+parseInt(_0x111f80(0x175))/0x6+parseInt(_0x111f80(0x1f9))/0x7+-parseInt(_0x111f80(0x1d6))/0x8*(parseInt(_0x111f80(0x1db))/0x9)+parseInt(_0x111f80(0x1a9))/0xa;if(_0x5459e6===_0x2fd85e)break;else _0x32c646['push'](_0x32c646['shift']());}catch(_0xc4a96a){_0x32c646['push'](_0x32c646['shift']());}}}(a36_0x57c7,0x9d2ea));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,handleSingleObjectOutput,writeOutput}from'../core/command-output.js';function a36_0x57c7(){const _0x364c87=['Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20history\x20<name>\x20[--from\x20<n>]\x20[--to\x20<n>]','/app/queries/editor?queryId=','max','end_at','soon','count','Failed\x20to\x20read\x20file:\x20','Getting\x20schedule\x20details...','round','data','entries','success','in\x20','delete','scheduled_at','delay','updated_at','Listing\x20scheduled\x20queries...','dim','description','15810570jnIbKH','time','list','substring','name','Database\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]','Schedule\x20created:\x20','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]','schedule:run','\x20\x20Cron:\x20','\x20\x20Num:\x20','m\x20ago','1386755dNkfZV','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20update\x20<name>\x20[options]','retry_limit','toLocaleDateString','Cancelled','schedule:show','(unnamed)','INVALID_ARGUMENT','📅\x20','padEnd','cyan','Searching\x20scheduled\x20queries\x20matching\x20\x22','ended_at','69ednChv','history','Updating\x20schedule:\x20','\x20\x20Timezone:\x20','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20show\x20<name>','start_at','verbose','green','log','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20schedule\x20\x22','type','Running\x20schedule:\x20','repeat','queryUrl','engine_version','Delete\x20a\x20scheduled\x20query','last_job','next_run_at','execute','database','7426256sesTAu','has_next_page','validate','status','executing_user_id','9afEKnX','\x20created','queries','\x20execution','abs','No\x20scheduled\x20queries\x20found','\x20\x20Job\x20ID:\x20','lastRun','priority','time_zone','schedule:delete','from','Update\x20a\x20scheduled\x20query','Running\x20schedule...','just\x20now','...','red','trim','Schedule\x20run\x20submitted:\x20','engineVersion','Updating\x20schedule...','map','show','user','listQueries','user_name','\x20matching\x20\x22','result','statusIcon','jsonl','1469762QURIOO','num','nextRun','format','created_at','getTime','Found\x20','options','cron','2222412KdgLTz','Show\x20schedule\x20execution\x20history','Showing\x20first\x20','Create\x20a\x20scheduled\x20query','table','timezone','args','query','schedule:create','run','json','142860lbxyaU','At\x20least\x20one\x20option\x20must\x20be\x20provided\x20to\x20update','3TMmSes','schedule:update','\x20\x20Type:\x20','jobs','tsv','Schedule\x20deleted:\x20','utf-8','limit','Getting\x20schedule\x20history...','length','join','retryLimit','30154aqaORI','\x20schedules','error','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20delete\x20<name>','schedules','file','Deleting\x20schedule...'];a36_0x57c7=function(){return _0x364c87;};return a36_0x57c7();}function a36_0x3e96(_0x35d951,_0x4d9d6c){_0x35d951=_0x35d951-0x174;const _0x57c7bf=a36_0x57c7();let _0x3e966f=_0x57c7bf[_0x35d951];return _0x3e966f;}import{withSpinner}from'../utils/spinner.js';import{confirm}from'../utils/prompt.js';import{readFileSync}from'fs';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import{getConsoleUrl}from'../sdk/client/endpoints.js';import{hyperlink}from'../sdk/util/formatters.js';import a36_0x248afb from'chalk';function formatRelativeTime(_0x4748f8){const _0x2e5e4f=a36_0x3e96,_0x2a7f45=new Date(_0x4748f8),_0x416805=new Date(),_0x1f27a6=_0x2a7f45[_0x2e5e4f(0x1fe)]()-_0x416805['getTime'](),_0x3cdb25=Math[_0x2e5e4f(0x1df)](_0x1f27a6)/0x3e8,_0x361a48=_0x1f27a6<0x0;if(_0x3cdb25<0x3c)return _0x361a48?_0x2e5e4f(0x1e9):_0x2e5e4f(0x199);else{if(_0x3cdb25<0xe10){const _0x54b57b=Math[_0x2e5e4f(0x19d)](_0x3cdb25/0x3c);return _0x361a48?_0x54b57b+_0x2e5e4f(0x1b4):'in\x20'+_0x54b57b+'m';}else{if(_0x3cdb25<0x15180){const _0x15d0a9=Math[_0x2e5e4f(0x19d)](_0x3cdb25/0xe10);return _0x361a48?_0x15d0a9+'h\x20ago':'in\x20'+_0x15d0a9+'h';}else{if(_0x3cdb25<0x93a80){const _0x251d30=Math[_0x2e5e4f(0x19d)](_0x3cdb25/0x15180);return _0x361a48?_0x251d30+'d\x20ago':_0x2e5e4f(0x1a1)+_0x251d30+'d';}else return _0x2a7f45[_0x2e5e4f(0x1b8)]();}}}}export class ScheduleListCommand extends BaseCommand{[a36_0x448907(0x1ad)]='schedule:list';[a36_0x448907(0x1a8)]='List\x20scheduled\x20queries';async[a36_0x448907(0x1d4)](_0x1893e2){const _0x1b0e90=a36_0x448907,{options:_0x2709c7,args:_0x12efb9,tdx:_0x1f17d2}=_0x1893e2,_0x46f5b1=resolveLimit(_0x2709c7[_0x1b0e90(0x189)],DEFAULT_DISPLAY_LIMIT),_0x5e0579=_0x12efb9[0x0],_0x2ebbc9=_0x5e0579?_0x1b0e90(0x1c0)+_0x5e0579+'\x22...':_0x1b0e90(0x1a6),_0xc191b1=await withSpinner(_0x2ebbc9,()=>_0x1f17d2[_0x1b0e90(0x192)][_0x1b0e90(0x1f3)]({'limit':_0x46f5b1,'scheduled':!![],'pattern':_0x5e0579}),{'verbose':_0x2709c7[_0x1b0e90(0x1c8)]}),_0x1ea89f=_0xc191b1['data'][_0x1b0e90(0x1dd)],_0x345520=_0xc191b1[_0x1b0e90(0x19e)]['pagination'][_0x1b0e90(0x1d7)],_0x34a3ab=_0x5e0579?_0x1b0e90(0x1f5)+_0x5e0579+'\x22':'';_0x345520?console[_0x1b0e90(0x190)](_0x1b0e90(0x177)+_0x1ea89f[_0x1b0e90(0x18b)]+_0x1b0e90(0x18f)+_0x34a3ab+'\x20(use\x20--limit\x20to\x20see\x20more)'):console[_0x1b0e90(0x190)](_0x1b0e90(0x1ff)+_0x1ea89f[_0x1b0e90(0x18b)]+'\x20scheduled\x20quer'+(_0x1ea89f[_0x1b0e90(0x18b)]!==0x1?'ies':'y')+_0x34a3ab);if(_0x2709c7[_0x1b0e90(0x1fc)]===_0x1b0e90(0x17f)||_0x2709c7['format']===_0x1b0e90(0x1f8)||_0x2709c7['format']===_0x1b0e90(0x179)||_0x2709c7[_0x1b0e90(0x1fc)]===_0x1b0e90(0x186)){const _0x475eda=_0x1ea89f[_0x1b0e90(0x1f0)](_0xb2d4de=>({'id':_0xb2d4de['id'],'name':_0xb2d4de[_0x1b0e90(0x1ad)],'cron':_0xb2d4de[_0x1b0e90(0x174)],'database':_0xb2d4de[_0x1b0e90(0x1d5)]?.[_0x1b0e90(0x1ad)],'type':_0xb2d4de['type'],'timezone':_0xb2d4de[_0x1b0e90(0x1e4)],'user_name':_0xb2d4de[_0x1b0e90(0x1f2)]?.[_0x1b0e90(0x1ad)],'updated_at':_0xb2d4de[_0x1b0e90(0x1a5)],'next_run_at':_0xb2d4de[_0x1b0e90(0x1d3)],'last_job_status':_0xb2d4de[_0x1b0e90(0x1d2)]?.['status']}));await handleSDKOutput(_0x475eda,_0x2709c7);}else{if(_0x1ea89f[_0x1b0e90(0x18b)]===0x0)console[_0x1b0e90(0x1ca)](_0x1b0e90(0x1e0));else{const _0x3cfd63=_0x2709c7['site'],_0x2ab94b=_0x1ea89f[_0x1b0e90(0x1f0)](_0x569415=>{const _0x1255e0=_0x1b0e90,_0x494af3=_0x569415[_0x1255e0(0x1d2)]?.[_0x1255e0(0x1d9)]?_0x569415[_0x1255e0(0x1d2)][_0x1255e0(0x1d9)]==='success'?'✓':'✗':'-',_0x126e13=_0x569415['last_job']?.[_0x1255e0(0x1c1)]?formatRelativeTime(_0x569415[_0x1255e0(0x1d2)][_0x1255e0(0x1c1)]):'never',_0x1269c6=_0x569415['next_run_at']?formatRelativeTime(_0x569415[_0x1255e0(0x1d3)]):'-',_0x366336=_0x569415[_0x1255e0(0x174)]||'',_0x4d49bc=_0x569415['name']||_0x1255e0(0x1bb),_0x510be5=getConsoleUrl(_0x3cfd63,_0x1255e0(0x196)+_0x569415['id']);return{'statusIcon':_0x494af3,'lastRun':_0x126e13,'nextRun':_0x1269c6,'cron':_0x366336,'name':_0x4d49bc,'queryUrl':_0x510be5,'status':_0x569415[_0x1255e0(0x1d2)]?.[_0x1255e0(0x1d9)]};}),_0x4f9439=Math[_0x1b0e90(0x197)](..._0x2ab94b[_0x1b0e90(0x1f0)](_0x319f80=>_0x319f80['lastRun'][_0x1b0e90(0x18b)])),_0xa6b077=Math['max'](..._0x2ab94b[_0x1b0e90(0x1f0)](_0x485037=>_0x485037[_0x1b0e90(0x1fb)]['length'])),_0xacfcc8=Math[_0x1b0e90(0x197)](..._0x2ab94b[_0x1b0e90(0x1f0)](_0x5b503=>_0x5b503[_0x1b0e90(0x174)][_0x1b0e90(0x18b)])),_0x1d2587=_0x2ab94b[_0x1b0e90(0x1f0)](_0x2bd835=>{const _0x127d88=_0x1b0e90,_0x2009c9=_0x2bd835['status']===_0x127d88(0x1a0)?a36_0x248afb[_0x127d88(0x1c9)](_0x2bd835[_0x127d88(0x1f7)]):_0x2bd835[_0x127d88(0x1d9)]==='error'?a36_0x248afb[_0x127d88(0x1eb)](_0x2bd835[_0x127d88(0x1f7)]):a36_0x248afb[_0x127d88(0x1a7)](_0x2bd835[_0x127d88(0x1f7)]),_0x585d9f=_0x2bd835[_0x127d88(0x1e2)]['padEnd'](_0x4f9439),_0x53e369=_0x2bd835[_0x127d88(0x1fb)][_0x127d88(0x1be)](_0xa6b077),_0x2575b1=_0x2bd835[_0x127d88(0x174)]?a36_0x248afb[_0x127d88(0x1bf)](_0x2bd835['cron']['padEnd'](_0xacfcc8)):'\x20'[_0x127d88(0x1ce)](_0xacfcc8),_0xcf10f3=hyperlink(_0x2bd835[_0x127d88(0x1ad)],_0x2bd835[_0x127d88(0x1cf)]);return _0x127d88(0x1bd)+_0x2009c9+'\x20'+_0x585d9f+'\x20\x20→\x20'+_0x53e369+'\x20\x20'+_0x2575b1+'\x20\x20'+_0xcf10f3;});await writeOutput(_0x1d2587[_0x1b0e90(0x18c)]('\x0a'),_0x2709c7['output'],_0x1b0e90(0x1ab));}}return 0x0;}}export class ScheduleShowCommand extends BaseCommand{['name']=a36_0x448907(0x1ba);[a36_0x448907(0x1a8)]='Show\x20schedule\x20details';[a36_0x448907(0x1d8)](_0x21f39d){const _0x23906a=a36_0x448907,_0x440566=_0x21f39d[_0x23906a(0x17b)][0x0];if(!_0x440566)return _0x23906a(0x1c6);return undefined;}async[a36_0x448907(0x1d4)](_0x547148){const _0xe1ec5d=a36_0x448907,{options:_0x515aff,args:_0x336f0f,tdx:_0xdea53c}=_0x547148,_0x103582=_0x336f0f[0x0],_0x149cbe=await withSpinner(_0xe1ec5d(0x19c),()=>_0xdea53c['schedules'][_0xe1ec5d(0x1f1)](_0x103582),{'verbose':_0x515aff[_0xe1ec5d(0x1c8)]}),_0xe2d237=_0x149cbe[_0xe1ec5d(0x19e)],_0x13f9e0={'name':_0xe2d237[_0xe1ec5d(0x1ad)],'cron':_0xe2d237[_0xe1ec5d(0x174)],'database':_0xe2d237[_0xe1ec5d(0x1d5)],'type':_0xe2d237[_0xe1ec5d(0x1cc)],'timezone':_0xe2d237[_0xe1ec5d(0x17a)],'user_name':_0xe2d237[_0xe1ec5d(0x1f4)],'created_at':_0xe2d237[_0xe1ec5d(0x1fd)],'engine_version':_0xe2d237[_0xe1ec5d(0x1d0)],'executing_user_id':_0xe2d237[_0xe1ec5d(0x1da)],'query':_0xe2d237[_0xe1ec5d(0x17c)],'delay':_0xe2d237[_0xe1ec5d(0x1a4)],'priority':_0xe2d237['priority'],'retry_limit':_0xe2d237['retry_limit'],..._0xe2d237[_0xe1ec5d(0x1f6)]&&{'result':_0xe2d237['result']}};return await handleSingleObjectOutput(_0x13f9e0,_0x515aff),0x0;}}export class ScheduleCreateCommand extends BaseCommand{[a36_0x448907(0x1ad)]=a36_0x448907(0x17d);[a36_0x448907(0x1a8)]=a36_0x448907(0x178);['validate'](_0x1f49f7){const _0x38c1e5=a36_0x448907,_0x22f5da=_0x1f49f7[_0x38c1e5(0x17b)][0x0];if(!_0x22f5da)return _0x38c1e5(0x1b0);const _0x17e891=_0x1f49f7[_0x38c1e5(0x200)];if(!_0x17e891[_0x38c1e5(0x1d5)])return _0x38c1e5(0x1ae);return undefined;}async[a36_0x448907(0x1d4)](_0x4b6de2){const _0x14489c=a36_0x448907,{options:_0x4f17e9,args:_0x420680,tdx:_0x3e7d97}=_0x4b6de2,_0x2e85b1=_0x420680[0x0],_0x5bdd12=_0x4f17e9,_0x4851ee=_0x5bdd12[_0x14489c(0x1d5)],_0x4ecf2b=_0x5bdd12['file'],_0x2ecd91=_0x5bdd12[_0x14489c(0x1cc)]||'trino';let _0x922d8a;try{_0x922d8a=readFileSync(_0x4ecf2b,_0x14489c(0x188))[_0x14489c(0x1ec)]();}catch(_0x3fa4e5){throw new SDKError(ErrorCode[_0x14489c(0x1bc)],'Failed\x20to\x20read\x20file:\x20'+_0x4ecf2b,_0x3fa4e5 instanceof Error?_0x3fa4e5:undefined);}if(!_0x922d8a)throw new SDKError(ErrorCode['INVALID_ARGUMENT'],'Query\x20file\x20is\x20empty');const _0x14cd67={'database':_0x4851ee,'query':_0x922d8a,'type':_0x2ecd91};if(_0x5bdd12[_0x14489c(0x174)])_0x14cd67[_0x14489c(0x174)]=_0x5bdd12['cron'];if(_0x5bdd12[_0x14489c(0x17a)])_0x14cd67['timezone']=_0x5bdd12['timezone'];if(_0x5bdd12[_0x14489c(0x1a4)]!==undefined)_0x14cd67['delay']=Number(_0x5bdd12[_0x14489c(0x1a4)]);if(_0x5bdd12[_0x14489c(0x1e3)]!==undefined)_0x14cd67[_0x14489c(0x1e3)]=Number(_0x5bdd12['priority']);if(_0x5bdd12[_0x14489c(0x18d)]!==undefined)_0x14cd67[_0x14489c(0x1b7)]=Number(_0x5bdd12[_0x14489c(0x18d)]);if(_0x5bdd12[_0x14489c(0x1ee)])_0x14cd67[_0x14489c(0x1d0)]=_0x5bdd12[_0x14489c(0x1ee)];if(_0x5bdd12['result'])_0x14cd67[_0x14489c(0x1f6)]=_0x5bdd12[_0x14489c(0x1f6)];if(_0x4f17e9[_0x14489c(0x1c8)]){console[_0x14489c(0x190)]('Creating\x20schedule:\x20'+_0x2e85b1),console['error']('\x20\x20Database:\x20'+_0x4851ee),console[_0x14489c(0x190)](_0x14489c(0x184)+_0x2ecd91);if(_0x14cd67[_0x14489c(0x174)])console[_0x14489c(0x190)](_0x14489c(0x1b2)+_0x14cd67[_0x14489c(0x174)]);if(_0x14cd67['timezone'])console['error'](_0x14489c(0x1c5)+_0x14cd67[_0x14489c(0x17a)]);}const _0x52fce4=await withSpinner('Creating\x20schedule...',()=>_0x3e7d97['schedules']['create'](_0x2e85b1,_0x14cd67),{'verbose':_0x4f17e9[_0x14489c(0x1c8)]});return console[_0x14489c(0x190)](_0x14489c(0x1af)+_0x52fce4['data'][_0x14489c(0x1ad)]),await handleSingleObjectOutput(_0x52fce4[_0x14489c(0x19e)],_0x4f17e9),0x0;}}export class ScheduleUpdateCommand extends BaseCommand{[a36_0x448907(0x1ad)]=a36_0x448907(0x183);[a36_0x448907(0x1a8)]=a36_0x448907(0x1e7);[a36_0x448907(0x1d8)](_0x3d482e){const _0x3f2c87=a36_0x448907,_0x2a9dcf=_0x3d482e[_0x3f2c87(0x17b)][0x0];if(!_0x2a9dcf)return _0x3f2c87(0x1b6);return undefined;}async[a36_0x448907(0x1d4)](_0x406e6f){const _0x27f8ff=a36_0x448907,{options:_0x5b7386,args:_0x4c7a0f,tdx:_0x143c6d}=_0x406e6f,_0xe423ba=_0x4c7a0f[0x0],_0x2300cb=_0x5b7386,_0x36cdf9={};if(_0x2300cb['database'])_0x36cdf9[_0x27f8ff(0x1d5)]=_0x2300cb[_0x27f8ff(0x1d5)];if(_0x2300cb['type'])_0x36cdf9[_0x27f8ff(0x1cc)]=_0x2300cb[_0x27f8ff(0x1cc)];if(_0x2300cb['cron'])_0x36cdf9[_0x27f8ff(0x174)]=_0x2300cb[_0x27f8ff(0x174)];if(_0x2300cb[_0x27f8ff(0x17a)])_0x36cdf9['timezone']=_0x2300cb[_0x27f8ff(0x17a)];if(_0x2300cb['delay']!==undefined)_0x36cdf9['delay']=Number(_0x2300cb[_0x27f8ff(0x1a4)]);if(_0x2300cb['priority']!==undefined)_0x36cdf9[_0x27f8ff(0x1e3)]=Number(_0x2300cb['priority']);if(_0x2300cb[_0x27f8ff(0x18d)]!==undefined)_0x36cdf9[_0x27f8ff(0x1b7)]=Number(_0x2300cb['retryLimit']);if(_0x2300cb['engineVersion'])_0x36cdf9[_0x27f8ff(0x1d0)]=_0x2300cb[_0x27f8ff(0x1ee)];if(_0x2300cb['result'])_0x36cdf9[_0x27f8ff(0x1f6)]=_0x2300cb['result'];if(_0x2300cb[_0x27f8ff(0x193)])try{_0x36cdf9[_0x27f8ff(0x17c)]=readFileSync(_0x2300cb[_0x27f8ff(0x193)],'utf-8')[_0x27f8ff(0x1ec)]();}catch(_0x65a920){throw new SDKError(ErrorCode[_0x27f8ff(0x1bc)],_0x27f8ff(0x19b)+_0x2300cb[_0x27f8ff(0x193)],_0x65a920 instanceof Error?_0x65a920:undefined);}if(Object['keys'](_0x36cdf9)[_0x27f8ff(0x18b)]===0x0)throw new SDKError(ErrorCode[_0x27f8ff(0x1bc)],_0x27f8ff(0x181));if(_0x5b7386[_0x27f8ff(0x1c8)]){console['error'](_0x27f8ff(0x1c4)+_0xe423ba);for(const [_0x5da440,_0x9a032c]of Object[_0x27f8ff(0x19f)](_0x36cdf9)){_0x5da440===_0x27f8ff(0x17c)?console[_0x27f8ff(0x190)]('\x20\x20'+_0x5da440+':\x20'+_0x9a032c[_0x27f8ff(0x1ac)](0x0,0x32)+_0x27f8ff(0x1ea)):console[_0x27f8ff(0x190)]('\x20\x20'+_0x5da440+':\x20'+_0x9a032c);}}const _0x364645=await withSpinner(_0x27f8ff(0x1ef),()=>_0x143c6d['schedules']['update'](_0xe423ba,_0x36cdf9),{'verbose':_0x5b7386['verbose']});return console[_0x27f8ff(0x190)]('Schedule\x20updated:\x20'+_0x364645[_0x27f8ff(0x19e)][_0x27f8ff(0x1ad)]),await handleSingleObjectOutput(_0x364645[_0x27f8ff(0x19e)],_0x5b7386),0x0;}}export class ScheduleDeleteCommand extends BaseCommand{['name']=a36_0x448907(0x1e5);['description']=a36_0x448907(0x1d1);[a36_0x448907(0x1d8)](_0x2038e9){const _0x4b7b66=a36_0x448907,_0xfef3a6=_0x2038e9[_0x4b7b66(0x17b)][0x0];if(!_0xfef3a6)return _0x4b7b66(0x191);return undefined;}async['execute'](_0x487edb){const _0x5e98c3=a36_0x448907,{options:_0x1f8403,args:_0x2a6712,tdx:_0x4a0c6c}=_0x487edb,_0x548c7d=_0x2a6712[0x0];if(!_0x1f8403['yes']){const _0xa6375b=await confirm(_0x5e98c3(0x1cb)+_0x548c7d+'\x22?');if(!_0xa6375b)return console[_0x5e98c3(0x190)](_0x5e98c3(0x1b9)),0x0;}const _0x413d47=await withSpinner(_0x5e98c3(0x194),()=>_0x4a0c6c[_0x5e98c3(0x192)][_0x5e98c3(0x1a2)](_0x548c7d),{'verbose':_0x1f8403['verbose']});return console[_0x5e98c3(0x190)](_0x5e98c3(0x187)+_0x413d47[_0x5e98c3(0x19e)][_0x5e98c3(0x1ad)]),0x0;}}export class ScheduleRunCommand extends BaseCommand{[a36_0x448907(0x1ad)]=a36_0x448907(0x1b1);[a36_0x448907(0x1a8)]='Run\x20a\x20scheduled\x20query\x20immediately';['validate'](_0xe91074){const _0x298fef=_0xe91074['args'][0x0];if(!_0x298fef)return'Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20run\x20<name>\x20[--time\x20<iso8601>]\x20[--num\x20<1-10>]';return undefined;}async['execute'](_0xd14748){const _0x5eb592=a36_0x448907,{options:_0x18a958,args:_0x4aa750,tdx:_0x249f50}=_0xd14748,_0x36f319=_0x4aa750[0x0],_0xc1b882=_0x18a958,_0x2faeaf=_0xc1b882[_0x5eb592(0x1aa)],_0x19deb7=_0xc1b882[_0x5eb592(0x1fa)]!==undefined?Number(_0xc1b882[_0x5eb592(0x1fa)]):undefined;if(_0x18a958['verbose']){console[_0x5eb592(0x190)](_0x5eb592(0x1cd)+_0x36f319);if(_0x2faeaf)console['error']('\x20\x20Time:\x20'+_0x2faeaf);if(_0x19deb7)console[_0x5eb592(0x190)](_0x5eb592(0x1b3)+_0x19deb7);}const _0x2a8f8c=await withSpinner(_0x5eb592(0x1e8),()=>_0x249f50[_0x5eb592(0x192)][_0x5eb592(0x17e)](_0x36f319,{'time':_0x2faeaf,'num':_0x19deb7}),{'verbose':_0x18a958[_0x5eb592(0x1c8)]}),_0x52f4ee=_0x2a8f8c[_0x5eb592(0x19e)][_0x5eb592(0x185)];console[_0x5eb592(0x190)](_0x5eb592(0x1ed)+_0x52f4ee['length']+'\x20job'+(_0x52f4ee[_0x5eb592(0x18b)]!==0x1?'s':'')+_0x5eb592(0x1dc));for(const _0x499704 of _0x52f4ee){console[_0x5eb592(0x190)](_0x5eb592(0x1e1)+_0x499704['job_id']);}return await handleSDKOutput(_0x52f4ee,_0x18a958),0x0;}}export class ScheduleHistoryCommand extends BaseCommand{[a36_0x448907(0x1ad)]='schedule:history';[a36_0x448907(0x1a8)]=a36_0x448907(0x176);['validate'](_0x469388){const _0x1dda28=a36_0x448907,_0x1b8325=_0x469388[_0x1dda28(0x17b)][0x0];if(!_0x1b8325)return _0x1dda28(0x195);return undefined;}async[a36_0x448907(0x1d4)](_0x341cb1){const _0x53bd81=a36_0x448907,{options:_0x20275a,args:_0x52fbdf,tdx:_0x5cdf32}=_0x341cb1,_0x20366c=_0x52fbdf[0x0],_0x2dbf7a=_0x20275a,_0x585451=_0x2dbf7a[_0x53bd81(0x1e6)]!==undefined?Number(_0x2dbf7a['from']):undefined,_0x2f4064=_0x2dbf7a['to']!==undefined?Number(_0x2dbf7a['to']):undefined,_0x358791=await withSpinner(_0x53bd81(0x18a),()=>_0x5cdf32['schedules'][_0x53bd81(0x1c3)](_0x20366c,{'from':_0x585451,'to':_0x2f4064}),{'verbose':_0x20275a['verbose']}),_0x456b72=_0x358791[_0x53bd81(0x19e)];console[_0x53bd81(0x190)](_0x53bd81(0x1ff)+_0x456b72[_0x53bd81(0x19a)]+_0x53bd81(0x1de)+(_0x456b72[_0x53bd81(0x19a)]!==0x1?'s':'')+'\x20(showing\x20'+_0x456b72['from']+'-'+_0x456b72['to']+')');const _0xca252a=_0x456b72['history'][_0x53bd81(0x1f0)](_0x510416=>({'job_id':_0x510416['job_id'],'type':_0x510416[_0x53bd81(0x1cc)],'status':_0x510416['status'],'scheduled_at':_0x510416[_0x53bd81(0x1a3)],'created_at':_0x510416['created_at'],'start_at':_0x510416[_0x53bd81(0x1c7)],'end_at':_0x510416[_0x53bd81(0x198)]}));return await handleSDKOutput(_0xca252a,_0x20275a),0x0;}}
1
+ function a36_0x5199(){const _0x4f20b9=['statusIcon','created_at','No\x20scheduled\x20queries\x20found','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20history\x20<name>\x20[--from\x20<n>]\x20[--to\x20<n>]','yes','Show\x20schedule\x20details','10061145ctcOZZ','\x20created','\x20job','toLocaleDateString','end_at','round','site','d\x20ago','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20delete\x20<name>','trim','Failed\x20to\x20read\x20file:\x20','job_id','Creating\x20schedule:\x20','options','red','\x20matching\x20\x22','schedule:update','execute','query','engineVersion','file','\x20scheduled\x20quer','551609QcwRNv','63736ucdcph','List\x20scheduled\x20queries','482450fLrOrE','ended_at','timezone','result','name','\x20\x20Job\x20ID:\x20','type','num','listQueries','json','has_next_page','scheduled_at','keys','format','table','10474446lsdjsi','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20schedule\x20\x22','Run\x20a\x20scheduled\x20query\x20immediately','padEnd','substring','schedule:show','INVALID_ARGUMENT','from','delay','Schedule\x20created:\x20','run','\x20\x20Database:\x20','\x20execution','lastRun','cyan','getTime','Updating\x20schedule:\x20','tsv','map','(unnamed)','abs','📅\x20','schedules','/app/queries/editor?queryId=','30201390KqteGQ','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20update\x20<name>\x20[options]','cron','soon','h\x20ago','9yxPZZa','schedule:history','11JypwkD','\x20(use\x20--limit\x20to\x20see\x20more)','m\x20ago','updated_at','Running\x20schedule...','length','350IZLDfp','queries','...','log','\x20\x20Type:\x20','start_at','args','entries','time','status','retry_limit','8ABjYTS','pagination','Update\x20a\x20scheduled\x20query','success','show','\x20schedules','\x20\x20Cron:\x20','Schedule\x20run\x20submitted:\x20','Found\x20','delete','output','verbose','jsonl','At\x20least\x20one\x20option\x20must\x20be\x20provided\x20to\x20update','description','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]','priority','schedule:create','retryLimit','last_job','create','682904gBvnhL','history','database','next_run_at','in\x20','join','\x22...','Deleting\x20schedule...','\x20\x20Num:\x20','data','nextRun','Schedule\x20deleted:\x20','green','trino','queryUrl','Getting\x20schedule\x20details...','validate','time_zone','utf-8','user','update','\x20\x20Time:\x20','limit','count','Cancelled','engine_version','Database\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]','Showing\x20first\x20','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20show\x20<name>','max','user_name','\x20\x20Timezone:\x20','error','Query\x20file\x20is\x20empty','\x20\x20→\x20'];a36_0x5199=function(){return _0x4f20b9;};return a36_0x5199();}const a36_0x24e2e5=a36_0x33ff;(function(_0x379990,_0x2d2148){const _0x19599e=a36_0x33ff,_0x208329=_0x379990();while(!![]){try{const _0x3320e7=-parseInt(_0x19599e(0x1a4))/0x1+-parseInt(_0x19599e(0x1fb))/0x2*(-parseInt(_0x19599e(0x1d3))/0x3)+-parseInt(_0x19599e(0x1e6))/0x4*(-parseInt(_0x19599e(0x1a7))/0x5)+parseInt(_0x19599e(0x1b6))/0x6+-parseInt(_0x19599e(0x1db))/0x7*(-parseInt(_0x19599e(0x1a5))/0x8)+parseInt(_0x19599e(0x18e))/0x9+parseInt(_0x19599e(0x1ce))/0xa*(-parseInt(_0x19599e(0x1d5))/0xb);if(_0x3320e7===_0x2d2148)break;else _0x208329['push'](_0x208329['shift']());}catch(_0x5deaf0){_0x208329['push'](_0x208329['shift']());}}}(a36_0x5199,0xdd940));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,handleSingleObjectOutput,writeOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';function a36_0x33ff(_0x53cdf3,_0x291854){_0x53cdf3=_0x53cdf3-0x184;const _0x51996f=a36_0x5199();let _0x33ffe3=_0x51996f[_0x53cdf3];return _0x33ffe3;}import{confirm}from'../utils/prompt.js';import{readFileSync}from'fs';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import{getConsoleUrl}from'../sdk/client/endpoints.js';import{hyperlink}from'../sdk/util/formatters.js';import a36_0x3d8b05 from'chalk';function formatRelativeTime(_0x34000f){const _0x5913c1=a36_0x33ff,_0x5553fd=new Date(_0x34000f),_0x46540a=new Date(),_0x14aad7=_0x5553fd[_0x5913c1(0x1c5)]()-_0x46540a[_0x5913c1(0x1c5)](),_0x2726d7=Math[_0x5913c1(0x1ca)](_0x14aad7)/0x3e8,_0x3b96ae=_0x14aad7<0x0;if(_0x2726d7<0x3c)return _0x3b96ae?'just\x20now':_0x5913c1(0x1d1);else{if(_0x2726d7<0xe10){const _0x2b8b9e=Math[_0x5913c1(0x193)](_0x2726d7/0x3c);return _0x3b96ae?_0x2b8b9e+_0x5913c1(0x1d7):_0x5913c1(0x1ff)+_0x2b8b9e+'m';}else{if(_0x2726d7<0x15180){const _0x4a16e6=Math['round'](_0x2726d7/0xe10);return _0x3b96ae?_0x4a16e6+_0x5913c1(0x1d2):_0x5913c1(0x1ff)+_0x4a16e6+'h';}else{if(_0x2726d7<0x93a80){const _0x1a51a9=Math[_0x5913c1(0x193)](_0x2726d7/0x15180);return _0x3b96ae?_0x1a51a9+_0x5913c1(0x195):'in\x20'+_0x1a51a9+'d';}else return _0x5553fd[_0x5913c1(0x191)]();}}}}export class ScheduleListCommand extends BaseCommand{['name']='schedule:list';[a36_0x24e2e5(0x1f4)]=a36_0x24e2e5(0x1a6);async[a36_0x24e2e5(0x19f)](_0xcee677){const _0x354500=a36_0x24e2e5,{options:_0xa6d0a8,args:_0x5a9b53,tdx:_0x4912c3}=_0xcee677,_0x1751ac=resolveLimit(_0xa6d0a8[_0x354500(0x211)],DEFAULT_DISPLAY_LIMIT),_0x109121=_0x5a9b53[0x0],_0x5c4fc6=_0x109121?'Searching\x20scheduled\x20queries\x20matching\x20\x22'+_0x109121+_0x354500(0x201):'Listing\x20scheduled\x20queries...',_0x2b64fd=await withSpinner(_0x5c4fc6,()=>_0x4912c3[_0x354500(0x1cc)][_0x354500(0x1af)]({'limit':_0x1751ac,'scheduled':!![],'pattern':_0x109121}),{'verbose':_0xa6d0a8[_0x354500(0x1f1)]}),_0x32ee04=_0x2b64fd[_0x354500(0x204)][_0x354500(0x1dc)],_0x55b68a=_0x2b64fd[_0x354500(0x204)][_0x354500(0x1e7)][_0x354500(0x1b1)],_0x23f9fa=_0x109121?_0x354500(0x19d)+_0x109121+'\x22':'';_0x55b68a?console[_0x354500(0x185)](_0x354500(0x216)+_0x32ee04[_0x354500(0x1da)]+_0x354500(0x1eb)+_0x23f9fa+_0x354500(0x1d6)):console[_0x354500(0x185)](_0x354500(0x1ee)+_0x32ee04[_0x354500(0x1da)]+_0x354500(0x1a3)+(_0x32ee04[_0x354500(0x1da)]!==0x1?'ies':'y')+_0x23f9fa);if(_0xa6d0a8[_0x354500(0x1b4)]===_0x354500(0x1b0)||_0xa6d0a8[_0x354500(0x1b4)]===_0x354500(0x1f2)||_0xa6d0a8[_0x354500(0x1b4)]===_0x354500(0x1b5)||_0xa6d0a8[_0x354500(0x1b4)]===_0x354500(0x1c7)){const _0x2ba69e=_0x32ee04[_0x354500(0x1c8)](_0x57bad1=>({'id':_0x57bad1['id'],'name':_0x57bad1[_0x354500(0x1ab)],'cron':_0x57bad1['cron'],'database':_0x57bad1[_0x354500(0x1fd)]?.['name'],'type':_0x57bad1[_0x354500(0x1ad)],'timezone':_0x57bad1[_0x354500(0x20c)],'user_name':_0x57bad1[_0x354500(0x20e)]?.[_0x354500(0x1ab)],'updated_at':_0x57bad1[_0x354500(0x1d8)],'next_run_at':_0x57bad1[_0x354500(0x1fe)],'last_job_status':_0x57bad1[_0x354500(0x1f9)]?.[_0x354500(0x1e4)]}));await handleSDKOutput(_0x2ba69e,_0xa6d0a8);}else{if(_0x32ee04[_0x354500(0x1da)]===0x0)console[_0x354500(0x1de)](_0x354500(0x18a));else{const _0x1aeb2f=_0xa6d0a8[_0x354500(0x194)],_0x75b62a=_0x32ee04[_0x354500(0x1c8)](_0x51ae00=>{const _0x5618b8=_0x354500,_0x1c4bd6=_0x51ae00[_0x5618b8(0x1f9)]?.[_0x5618b8(0x1e4)]?_0x51ae00['last_job']['status']==='success'?'✓':'✗':'-',_0xfedb3c=_0x51ae00['last_job']?.[_0x5618b8(0x1a8)]?formatRelativeTime(_0x51ae00[_0x5618b8(0x1f9)][_0x5618b8(0x1a8)]):'never',_0x501aaa=_0x51ae00[_0x5618b8(0x1fe)]?formatRelativeTime(_0x51ae00[_0x5618b8(0x1fe)]):'-',_0x1c1e70=_0x51ae00['cron']||'',_0x2207bf=_0x51ae00[_0x5618b8(0x1ab)]||_0x5618b8(0x1c9),_0x4d7b86=getConsoleUrl(_0x1aeb2f,_0x5618b8(0x1cd)+_0x51ae00['id']);return{'statusIcon':_0x1c4bd6,'lastRun':_0xfedb3c,'nextRun':_0x501aaa,'cron':_0x1c1e70,'name':_0x2207bf,'queryUrl':_0x4d7b86,'status':_0x51ae00[_0x5618b8(0x1f9)]?.[_0x5618b8(0x1e4)]};}),_0x988043=Math[_0x354500(0x218)](..._0x75b62a[_0x354500(0x1c8)](_0x40f934=>_0x40f934['lastRun'][_0x354500(0x1da)])),_0x2a41ac=Math[_0x354500(0x218)](..._0x75b62a['map'](_0x2dca32=>_0x2dca32['nextRun'][_0x354500(0x1da)])),_0x4d47a3=Math[_0x354500(0x218)](..._0x75b62a[_0x354500(0x1c8)](_0x56efa1=>_0x56efa1[_0x354500(0x1d0)][_0x354500(0x1da)])),_0x7336e7=_0x75b62a[_0x354500(0x1c8)](_0x52250a=>{const _0x1048e0=_0x354500,_0x4b3216=_0x52250a[_0x1048e0(0x1e4)]===_0x1048e0(0x1e9)?a36_0x3d8b05[_0x1048e0(0x207)](_0x52250a['statusIcon']):_0x52250a['status']==='error'?a36_0x3d8b05[_0x1048e0(0x19c)](_0x52250a[_0x1048e0(0x188)]):a36_0x3d8b05['dim'](_0x52250a['statusIcon']),_0x1015c2=_0x52250a[_0x1048e0(0x1c3)][_0x1048e0(0x1b9)](_0x988043),_0xd346cc=_0x52250a[_0x1048e0(0x205)][_0x1048e0(0x1b9)](_0x2a41ac),_0x445015=_0x52250a[_0x1048e0(0x1d0)]?a36_0x3d8b05[_0x1048e0(0x1c4)](_0x52250a[_0x1048e0(0x1d0)][_0x1048e0(0x1b9)](_0x4d47a3)):'\x20'['repeat'](_0x4d47a3),_0x214009=hyperlink(_0x52250a['name'],_0x52250a[_0x1048e0(0x209)]);return _0x1048e0(0x1cb)+_0x4b3216+'\x20'+_0x1015c2+_0x1048e0(0x187)+_0xd346cc+'\x20\x20'+_0x445015+'\x20\x20'+_0x214009;});await writeOutput(_0x7336e7[_0x354500(0x200)]('\x0a'),_0xa6d0a8[_0x354500(0x1f0)],'list');}}return 0x0;}}export class ScheduleShowCommand extends BaseCommand{['name']=a36_0x24e2e5(0x1bb);[a36_0x24e2e5(0x1f4)]=a36_0x24e2e5(0x18d);[a36_0x24e2e5(0x20b)](_0x48d456){const _0x2590ad=a36_0x24e2e5,_0x3041f4=_0x48d456[_0x2590ad(0x1e1)][0x0];if(!_0x3041f4)return _0x2590ad(0x217);return undefined;}async[a36_0x24e2e5(0x19f)](_0x53b794){const _0x88928e=a36_0x24e2e5,{options:_0x55c5ff,args:_0x3cf70a,tdx:_0x19100c}=_0x53b794,_0xeb7203=_0x3cf70a[0x0],_0x4d9875=await withSpinner(_0x88928e(0x20a),()=>_0x19100c[_0x88928e(0x1cc)][_0x88928e(0x1ea)](_0xeb7203),{'verbose':_0x55c5ff[_0x88928e(0x1f1)]}),_0x7b3dc4=_0x4d9875[_0x88928e(0x204)],_0x163c8e={'name':_0x7b3dc4[_0x88928e(0x1ab)],'cron':_0x7b3dc4[_0x88928e(0x1d0)],'database':_0x7b3dc4['database'],'type':_0x7b3dc4[_0x88928e(0x1ad)],'timezone':_0x7b3dc4[_0x88928e(0x1a9)],'user_name':_0x7b3dc4[_0x88928e(0x219)],'created_at':_0x7b3dc4[_0x88928e(0x189)],'engine_version':_0x7b3dc4[_0x88928e(0x214)],'executing_user_id':_0x7b3dc4['executing_user_id'],'query':_0x7b3dc4[_0x88928e(0x1a0)],'delay':_0x7b3dc4['delay'],'priority':_0x7b3dc4['priority'],'retry_limit':_0x7b3dc4[_0x88928e(0x1e5)],..._0x7b3dc4[_0x88928e(0x1aa)]&&{'result':_0x7b3dc4['result']}};return await handleSingleObjectOutput(_0x163c8e,_0x55c5ff),0x0;}}export class ScheduleCreateCommand extends BaseCommand{[a36_0x24e2e5(0x1ab)]=a36_0x24e2e5(0x1f7);[a36_0x24e2e5(0x1f4)]='Create\x20a\x20scheduled\x20query';['validate'](_0x4d3a49){const _0x35f4a3=a36_0x24e2e5,_0x3c322b=_0x4d3a49[_0x35f4a3(0x1e1)][0x0];if(!_0x3c322b)return _0x35f4a3(0x1f5);const _0x366a49=_0x4d3a49[_0x35f4a3(0x19b)];if(!_0x366a49[_0x35f4a3(0x1fd)])return _0x35f4a3(0x215);return undefined;}async[a36_0x24e2e5(0x19f)](_0x4a9549){const _0x5e1c86=a36_0x24e2e5,{options:_0x3d85d1,args:_0x4a77ae,tdx:_0x52f938}=_0x4a9549,_0x9b2e8f=_0x4a77ae[0x0],_0x2d900f=_0x3d85d1,_0x488cd3=_0x2d900f[_0x5e1c86(0x1fd)],_0x9da481=_0x2d900f[_0x5e1c86(0x1a2)],_0x1e58ae=_0x2d900f[_0x5e1c86(0x1ad)]||_0x5e1c86(0x208);let _0xf3266b;try{_0xf3266b=readFileSync(_0x9da481,_0x5e1c86(0x20d))[_0x5e1c86(0x197)]();}catch(_0x6adec4){throw new SDKError(ErrorCode[_0x5e1c86(0x1bc)],_0x5e1c86(0x198)+_0x9da481,_0x6adec4 instanceof Error?_0x6adec4:undefined);}if(!_0xf3266b)throw new SDKError(ErrorCode[_0x5e1c86(0x1bc)],_0x5e1c86(0x186));const _0x4d1a04={'database':_0x488cd3,'query':_0xf3266b,'type':_0x1e58ae};if(_0x2d900f[_0x5e1c86(0x1d0)])_0x4d1a04[_0x5e1c86(0x1d0)]=_0x2d900f[_0x5e1c86(0x1d0)];if(_0x2d900f[_0x5e1c86(0x1a9)])_0x4d1a04['timezone']=_0x2d900f['timezone'];if(_0x2d900f['delay']!==undefined)_0x4d1a04[_0x5e1c86(0x1be)]=Number(_0x2d900f[_0x5e1c86(0x1be)]);if(_0x2d900f[_0x5e1c86(0x1f6)]!==undefined)_0x4d1a04[_0x5e1c86(0x1f6)]=Number(_0x2d900f['priority']);if(_0x2d900f[_0x5e1c86(0x1f8)]!==undefined)_0x4d1a04[_0x5e1c86(0x1e5)]=Number(_0x2d900f['retryLimit']);if(_0x2d900f[_0x5e1c86(0x1a1)])_0x4d1a04[_0x5e1c86(0x214)]=_0x2d900f[_0x5e1c86(0x1a1)];if(_0x2d900f[_0x5e1c86(0x1aa)])_0x4d1a04['result']=_0x2d900f[_0x5e1c86(0x1aa)];if(_0x3d85d1[_0x5e1c86(0x1f1)]){console[_0x5e1c86(0x185)](_0x5e1c86(0x19a)+_0x9b2e8f),console[_0x5e1c86(0x185)](_0x5e1c86(0x1c1)+_0x488cd3),console[_0x5e1c86(0x185)](_0x5e1c86(0x1df)+_0x1e58ae);if(_0x4d1a04[_0x5e1c86(0x1d0)])console[_0x5e1c86(0x185)](_0x5e1c86(0x1ec)+_0x4d1a04['cron']);if(_0x4d1a04['timezone'])console['error'](_0x5e1c86(0x184)+_0x4d1a04[_0x5e1c86(0x1a9)]);}const _0x336b41=await withSpinner('Creating\x20schedule...',()=>_0x52f938['schedules'][_0x5e1c86(0x1fa)](_0x9b2e8f,_0x4d1a04),{'verbose':_0x3d85d1[_0x5e1c86(0x1f1)]});return console[_0x5e1c86(0x185)](_0x5e1c86(0x1bf)+_0x336b41['data'][_0x5e1c86(0x1ab)]),await handleSingleObjectOutput(_0x336b41['data'],_0x3d85d1),0x0;}}export class ScheduleUpdateCommand extends BaseCommand{[a36_0x24e2e5(0x1ab)]=a36_0x24e2e5(0x19e);[a36_0x24e2e5(0x1f4)]=a36_0x24e2e5(0x1e8);[a36_0x24e2e5(0x20b)](_0x577dd1){const _0x247b2a=a36_0x24e2e5,_0xd610c8=_0x577dd1[_0x247b2a(0x1e1)][0x0];if(!_0xd610c8)return _0x247b2a(0x1cf);return undefined;}async['execute'](_0x45cfb2){const _0x4a65d7=a36_0x24e2e5,{options:_0x24d7a1,args:_0x1b1f29,tdx:_0x144be6}=_0x45cfb2,_0x53816c=_0x1b1f29[0x0],_0x3761b8=_0x24d7a1,_0x4c9140={};if(_0x3761b8[_0x4a65d7(0x1fd)])_0x4c9140['database']=_0x3761b8[_0x4a65d7(0x1fd)];if(_0x3761b8[_0x4a65d7(0x1ad)])_0x4c9140[_0x4a65d7(0x1ad)]=_0x3761b8[_0x4a65d7(0x1ad)];if(_0x3761b8['cron'])_0x4c9140[_0x4a65d7(0x1d0)]=_0x3761b8['cron'];if(_0x3761b8[_0x4a65d7(0x1a9)])_0x4c9140[_0x4a65d7(0x1a9)]=_0x3761b8[_0x4a65d7(0x1a9)];if(_0x3761b8[_0x4a65d7(0x1be)]!==undefined)_0x4c9140[_0x4a65d7(0x1be)]=Number(_0x3761b8[_0x4a65d7(0x1be)]);if(_0x3761b8[_0x4a65d7(0x1f6)]!==undefined)_0x4c9140[_0x4a65d7(0x1f6)]=Number(_0x3761b8[_0x4a65d7(0x1f6)]);if(_0x3761b8[_0x4a65d7(0x1f8)]!==undefined)_0x4c9140[_0x4a65d7(0x1e5)]=Number(_0x3761b8['retryLimit']);if(_0x3761b8[_0x4a65d7(0x1a1)])_0x4c9140[_0x4a65d7(0x214)]=_0x3761b8[_0x4a65d7(0x1a1)];if(_0x3761b8['result'])_0x4c9140['result']=_0x3761b8['result'];if(_0x3761b8[_0x4a65d7(0x1a2)])try{_0x4c9140[_0x4a65d7(0x1a0)]=readFileSync(_0x3761b8['file'],_0x4a65d7(0x20d))[_0x4a65d7(0x197)]();}catch(_0x516cbe){throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x4a65d7(0x198)+_0x3761b8[_0x4a65d7(0x1a2)],_0x516cbe instanceof Error?_0x516cbe:undefined);}if(Object[_0x4a65d7(0x1b3)](_0x4c9140)[_0x4a65d7(0x1da)]===0x0)throw new SDKError(ErrorCode[_0x4a65d7(0x1bc)],_0x4a65d7(0x1f3));if(_0x24d7a1['verbose']){console[_0x4a65d7(0x185)](_0x4a65d7(0x1c6)+_0x53816c);for(const [_0x4fb54b,_0x5a1cc4]of Object[_0x4a65d7(0x1e2)](_0x4c9140)){_0x4fb54b===_0x4a65d7(0x1a0)?console[_0x4a65d7(0x185)]('\x20\x20'+_0x4fb54b+':\x20'+_0x5a1cc4[_0x4a65d7(0x1ba)](0x0,0x32)+_0x4a65d7(0x1dd)):console['error']('\x20\x20'+_0x4fb54b+':\x20'+_0x5a1cc4);}}const _0x110cff=await withSpinner('Updating\x20schedule...',()=>_0x144be6[_0x4a65d7(0x1cc)][_0x4a65d7(0x20f)](_0x53816c,_0x4c9140),{'verbose':_0x24d7a1[_0x4a65d7(0x1f1)]});return console[_0x4a65d7(0x185)]('Schedule\x20updated:\x20'+_0x110cff[_0x4a65d7(0x204)][_0x4a65d7(0x1ab)]),await handleSingleObjectOutput(_0x110cff[_0x4a65d7(0x204)],_0x24d7a1),0x0;}}export class ScheduleDeleteCommand extends BaseCommand{[a36_0x24e2e5(0x1ab)]='schedule:delete';['description']='Delete\x20a\x20scheduled\x20query';['validate'](_0x3148ac){const _0x73b379=a36_0x24e2e5,_0x58fbfd=_0x3148ac[_0x73b379(0x1e1)][0x0];if(!_0x58fbfd)return _0x73b379(0x196);return undefined;}async[a36_0x24e2e5(0x19f)](_0x43b8d5){const _0x21db02=a36_0x24e2e5,{options:_0x4173c9,args:_0x6d5b3f,tdx:_0x13c68d}=_0x43b8d5,_0x415e3a=_0x6d5b3f[0x0];if(!_0x4173c9[_0x21db02(0x18c)]){const _0x38fafb=await confirm(_0x21db02(0x1b7)+_0x415e3a+'\x22?');if(!_0x38fafb)return console[_0x21db02(0x185)](_0x21db02(0x213)),0x0;}const _0x23b74d=await withSpinner(_0x21db02(0x202),()=>_0x13c68d[_0x21db02(0x1cc)][_0x21db02(0x1ef)](_0x415e3a),{'verbose':_0x4173c9[_0x21db02(0x1f1)]});return console[_0x21db02(0x185)](_0x21db02(0x206)+_0x23b74d[_0x21db02(0x204)][_0x21db02(0x1ab)]),0x0;}}export class ScheduleRunCommand extends BaseCommand{[a36_0x24e2e5(0x1ab)]='schedule:run';['description']=a36_0x24e2e5(0x1b8);[a36_0x24e2e5(0x20b)](_0xe17f42){const _0x25a4eb=a36_0x24e2e5,_0x3d5c77=_0xe17f42[_0x25a4eb(0x1e1)][0x0];if(!_0x3d5c77)return'Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20run\x20<name>\x20[--time\x20<iso8601>]\x20[--num\x20<1-10>]';return undefined;}async[a36_0x24e2e5(0x19f)](_0x2c05ba){const _0x576288=a36_0x24e2e5,{options:_0x6f170,args:_0x45784e,tdx:_0x1ebc9a}=_0x2c05ba,_0x2621f1=_0x45784e[0x0],_0x39dbc7=_0x6f170,_0x54d459=_0x39dbc7[_0x576288(0x1e3)],_0x414acf=_0x39dbc7[_0x576288(0x1ae)]!==undefined?Number(_0x39dbc7['num']):undefined;if(_0x6f170['verbose']){console[_0x576288(0x185)]('Running\x20schedule:\x20'+_0x2621f1);if(_0x54d459)console[_0x576288(0x185)](_0x576288(0x210)+_0x54d459);if(_0x414acf)console[_0x576288(0x185)](_0x576288(0x203)+_0x414acf);}const _0x25bba1=await withSpinner(_0x576288(0x1d9),()=>_0x1ebc9a['schedules'][_0x576288(0x1c0)](_0x2621f1,{'time':_0x54d459,'num':_0x414acf}),{'verbose':_0x6f170[_0x576288(0x1f1)]}),_0x35a06c=_0x25bba1[_0x576288(0x204)]['jobs'];console[_0x576288(0x185)](_0x576288(0x1ed)+_0x35a06c[_0x576288(0x1da)]+_0x576288(0x190)+(_0x35a06c['length']!==0x1?'s':'')+_0x576288(0x18f));for(const _0xd8fad7 of _0x35a06c){console[_0x576288(0x185)](_0x576288(0x1ac)+_0xd8fad7[_0x576288(0x199)]);}return await handleSDKOutput(_0x35a06c,_0x6f170),0x0;}}export class ScheduleHistoryCommand extends BaseCommand{[a36_0x24e2e5(0x1ab)]=a36_0x24e2e5(0x1d4);['description']='Show\x20schedule\x20execution\x20history';[a36_0x24e2e5(0x20b)](_0x17d469){const _0x5dfd77=a36_0x24e2e5,_0x4e5d90=_0x17d469['args'][0x0];if(!_0x4e5d90)return _0x5dfd77(0x18b);return undefined;}async[a36_0x24e2e5(0x19f)](_0x1a4eff){const _0x322c90=a36_0x24e2e5,{options:_0x26fcbd,args:_0x3f99c4,tdx:_0x2f8f51}=_0x1a4eff,_0x3625e0=_0x3f99c4[0x0],_0x549cbb=_0x26fcbd,_0x7dd568=_0x549cbb[_0x322c90(0x1bd)]!==undefined?Number(_0x549cbb[_0x322c90(0x1bd)]):undefined,_0x13145c=_0x549cbb['to']!==undefined?Number(_0x549cbb['to']):undefined,_0x19af0f=await withSpinner('Getting\x20schedule\x20history...',()=>_0x2f8f51[_0x322c90(0x1cc)][_0x322c90(0x1fc)](_0x3625e0,{'from':_0x7dd568,'to':_0x13145c}),{'verbose':_0x26fcbd[_0x322c90(0x1f1)]}),_0x27981f=_0x19af0f[_0x322c90(0x204)];console[_0x322c90(0x185)](_0x322c90(0x1ee)+_0x27981f[_0x322c90(0x212)]+_0x322c90(0x1c2)+(_0x27981f['count']!==0x1?'s':'')+'\x20(showing\x20'+_0x27981f[_0x322c90(0x1bd)]+'-'+_0x27981f['to']+')');const _0x13e78b=_0x27981f[_0x322c90(0x1fc)]['map'](_0x395637=>({'job_id':_0x395637[_0x322c90(0x199)],'type':_0x395637[_0x322c90(0x1ad)],'status':_0x395637['status'],'scheduled_at':_0x395637[_0x322c90(0x1b2)],'created_at':_0x395637[_0x322c90(0x189)],'start_at':_0x395637[_0x322c90(0x1e0)],'end_at':_0x395637[_0x322c90(0x192)]}));return await handleSDKOutput(_0x13e78b,_0x26fcbd),0x0;}}
@@ -1 +1 @@
1
- const a37_0x21b2dc=a37_0x3e70;(function(_0x403a4a,_0x2e1e54){const _0x326db8=a37_0x3e70,_0x210127=_0x403a4a();while(!![]){try{const _0x52f280=-parseInt(_0x326db8(0x18c))/0x1*(-parseInt(_0x326db8(0x1e7))/0x2)+-parseInt(_0x326db8(0x1e2))/0x3+parseInt(_0x326db8(0x174))/0x4+parseInt(_0x326db8(0x184))/0x5+parseInt(_0x326db8(0x199))/0x6+-parseInt(_0x326db8(0x172))/0x7+-parseInt(_0x326db8(0x16a))/0x8*(parseInt(_0x326db8(0x1ce))/0x9);if(_0x52f280===_0x2e1e54)break;else _0x210127['push'](_0x210127['shift']());}catch(_0x19d2b9){_0x210127['push'](_0x210127['shift']());}}}(a37_0x153a,0xc604b));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_0x5e0d32 from'chalk';async function resolveSegmentTarget(_0x1088fd,_0x12da83,_0x4b68bf){const _0x4aa283=a37_0x3e70;if(isYamlFilePath(_0x1088fd))try{const _0x4c29fd=await resolveYamlFilePath(_0x1088fd);return _0x4b68bf&&(console[_0x4aa283(0x19a)](_0x4aa283(0x1c3)+_0x1088fd),console['error'](_0x4aa283(0x1ea)+_0x4c29fd['parentSegment']),console[_0x4aa283(0x19a)](_0x4aa283(0x15f)+_0x4c29fd['segmentName']),console['error'](_0x4aa283(0x1e6)+(_0x4c29fd[_0x4aa283(0x17d)]||_0x4aa283(0x159))),console[_0x4aa283(0x19a)](_0x4aa283(0x19f)+_0x4c29fd[_0x4aa283(0x188)])),_0x4c29fd[_0x4aa283(0x188)];}catch(_0x173915){throw new SDKError(ErrorCode[_0x4aa283(0x1fb)],'Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20'+_0x173915['message']);}if(!_0x12da83)throw new SDKError(ErrorCode[_0x4aa283(0x1fb)],'No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22');return _0x12da83+'/'+_0x1088fd;}export class SegmentDescribeCommand extends BaseCommand{[a37_0x21b2dc(0x173)]=a37_0x21b2dc(0x1b3);[a37_0x21b2dc(0x185)]='Show\x20segment\x20or\x20folder\x20details';async[a37_0x21b2dc(0x176)](_0x230cb0){const _0x2ed816=a37_0x21b2dc,{options:_0x2f319a,args:_0x364e1d,tdx:_0x1a23fb}=_0x230cb0,_0x4b905e=_0x364e1d[0x0],_0x3d8f22=!_0x4b905e&&!!_0x2f319a[_0x2ed816(0x196)],_0x333504=_0x4b905e||_0x2f319a[_0x2ed816(0x196)];if(!_0x333504)return console[_0x2ed816(0x19a)]('Error:\x20Path\x20or\x20name\x20is\x20required'),console[_0x2ed816(0x19a)](_0x2ed816(0x161)),console['error'](_0x2ed816(0x17b)),console[_0x2ed816(0x19a)](_0x2ed816(0x1c0)),console[_0x2ed816(0x19a)](_0x2ed816(0x1bb)),console[_0x2ed816(0x19a)](_0x2ed816(0x1e4)),console[_0x2ed816(0x19a)](_0x2ed816(0x1a7)),0x1;try{const _0x15e6fa=_0x2f319a[_0x2ed816(0x200)];let _0x417bc7=_0x333504;!_0x3d8f22&&_0x15e6fa&&!_0x333504[_0x2ed816(0x1b6)]('/')&&(_0x417bc7=_0x15e6fa+'/'+_0x333504,_0x2f319a['verbose']&&console[_0x2ed816(0x19a)](_0x2ed816(0x16b)+_0x417bc7));const _0x1367a2=await withSpinner(_0x2ed816(0x1f0)+_0x417bc7+_0x2ed816(0x1f5),()=>_0x1a23fb[_0x2ed816(0x1ef)][_0x2ed816(0x1eb)](_0x417bc7),{'verbose':_0x2f319a[_0x2ed816(0x1bd)]}),_0x11fdf8=_0x1367a2['data'];_0x2f319a[_0x2ed816(0x1bd)]&&(console[_0x2ed816(0x19a)](_0x2ed816(0x1d0)+_0x11fdf8['type']),console[_0x2ed816(0x19a)](_0x2ed816(0x1b2)+_0x11fdf8['parentId']),_0x11fdf8[_0x2ed816(0x15c)]&&console['error'](_0x2ed816(0x1ed)+_0x11fdf8[_0x2ed816(0x15c)]),_0x11fdf8['segmentId']&&console[_0x2ed816(0x19a)](_0x2ed816(0x1d1)+_0x11fdf8[_0x2ed816(0x183)]));if(_0x11fdf8[_0x2ed816(0x163)]==='parent'){const _0x3306cf=await withSpinner('Fetching\x20parent\x20segment\x20details...',()=>_0x1a23fb['segment'][_0x2ed816(0x1ae)](_0x11fdf8[_0x2ed816(0x1ab)]),{'verbose':_0x2f319a['verbose']});await handleSingleObjectOutput(_0x3306cf[_0x2ed816(0x16c)],_0x2f319a);}else{if(_0x11fdf8[_0x2ed816(0x163)]===_0x2ed816(0x1c2)){if(!_0x11fdf8[_0x2ed816(0x15c)])throw new SDKError(ErrorCode[_0x2ed816(0x1ff)],'Folder\x20ID\x20missing\x20from\x20resolved\x20path');const _0x5ac3ab=await withSpinner(_0x2ed816(0x17f),()=>_0x1a23fb[_0x2ed816(0x1ef)][_0x2ed816(0x1a8)](_0x11fdf8[_0x2ed816(0x15c)]),{'verbose':_0x2f319a[_0x2ed816(0x1bd)]});await handleSingleObjectOutput(_0x5ac3ab[_0x2ed816(0x16c)],_0x2f319a);}else{if(_0x11fdf8[_0x2ed816(0x163)]===_0x2ed816(0x1ef)){if(!_0x11fdf8[_0x2ed816(0x183)])throw new SDKError(ErrorCode[_0x2ed816(0x1de)],_0x2ed816(0x1fa));const _0x31d373=await withSpinner(_0x2ed816(0x16f),()=>_0x1a23fb[_0x2ed816(0x1ef)]['getSegment'](_0x11fdf8[_0x2ed816(0x1ab)],_0x11fdf8[_0x2ed816(0x183)]),{'verbose':_0x2f319a[_0x2ed816(0x1bd)]});await handleSingleObjectOutput(_0x31d373['data'],_0x2f319a);}}}return 0x0;}catch(_0x4dde9c){if(_0x4dde9c instanceof SDKError)return console[_0x2ed816(0x19a)](_0x2ed816(0x1e8)+_0x4dde9c[_0x2ed816(0x164)]),_0x4dde9c[_0x2ed816(0x168)]&&console[_0x2ed816(0x19a)](_0x2ed816(0x1ca)+_0x4dde9c[_0x2ed816(0x168)]),0x1;throw _0x4dde9c;}}}function a37_0x3e70(_0x4c4a68,_0x1fca3e){_0x4c4a68=_0x4c4a68-0x159;const _0x153a0c=a37_0x153a();let _0x3e701d=_0x153a0c[_0x4c4a68];return _0x3e701d;}export class SegmentShowCommand extends BaseCommand{[a37_0x21b2dc(0x173)]=a37_0x21b2dc(0x1db);[a37_0x21b2dc(0x185)]='Execute\x20child\x20segment\x20SQL\x20query\x20and\x20show\x20results';async['execute'](_0x5b67b5){const _0x4a5763=a37_0x21b2dc,{options:_0xc15026,args:_0x3390ff,tdx:_0x51dfa6}=_0x5b67b5,_0x5d14aa=_0x3390ff[0x0];if(!_0x5d14aa)return console[_0x4a5763(0x19a)]('Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required'),console[_0x4a5763(0x19a)](_0x4a5763(0x169)),console['error']('\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20show\x20<path/to/segment.yml>'),console[_0x4a5763(0x19a)]('Examples:'),console[_0x4a5763(0x19a)]('\x20\x20tdx\x20sg\x20show\x20\x22Premium\x20Users\x22'),console[_0x4a5763(0x19a)](_0x4a5763(0x1fd)),0x1;try{const _0x48a993=_0xc15026[_0x4a5763(0x196)],_0x5b9b50=await resolveSegmentTarget(_0x5d14aa,_0x48a993,_0xc15026['verbose']);_0xc15026[_0x4a5763(0x1bd)]&&console[_0x4a5763(0x19a)](_0x4a5763(0x1f7)+_0x5b9b50);const _0x53111f=await withSpinner('Resolving\x20\x27'+_0x5d14aa+'\x27...',()=>_0x51dfa6[_0x4a5763(0x1ef)]['resolvePathToResource'](_0x5b9b50),{'verbose':_0xc15026['verbose']}),_0x382b1c=_0x53111f[_0x4a5763(0x16c)];_0xc15026[_0x4a5763(0x1bd)]&&(console[_0x4a5763(0x19a)](_0x4a5763(0x1d0)+_0x382b1c[_0x4a5763(0x163)]),console['error']('Parent\x20ID:\x20'+_0x382b1c[_0x4a5763(0x1ab)]));if(_0x382b1c['type']===_0x4a5763(0x1c2))return console[_0x4a5763(0x19a)]('Error:\x20Cannot\x20execute\x20SQL\x20query\x20on\x20a\x20folder.'),console[_0x4a5763(0x19a)](_0x4a5763(0x1f8)),0x1;if(_0x382b1c[_0x4a5763(0x163)]===_0x4a5763(0x197))return console[_0x4a5763(0x19a)](_0x4a5763(0x171)),console['error'](_0x4a5763(0x189)),0x1;if(!_0x382b1c[_0x4a5763(0x183)])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x4d563a=await withSpinner(_0x4a5763(0x170),()=>_0x51dfa6[_0x4a5763(0x1ef)]['getSegmentSQL'](_0x382b1c[_0x4a5763(0x1ab)],_0x382b1c[_0x4a5763(0x183)]),{'verbose':_0xc15026['verbose']});let _0x4aeb92=_0x4d563a['data'];const _0x3b3661=resolveLimit(_0xc15026[_0x4a5763(0x1d9)],DEFAULT_DISPLAY_LIMIT),_0x154655=/\bLIMIT\s+\d+/i[_0x4a5763(0x1cc)](_0x4aeb92);!_0x154655&&(_0x4aeb92=_0x4aeb92[_0x4a5763(0x19e)]()[_0x4a5763(0x182)](/;+$/,''),_0x4aeb92=_0x4a5763(0x1d4)+_0x4aeb92+_0x4a5763(0x19c)+_0x3b3661);_0xc15026[_0x4a5763(0x1bd)]&&console['error'](_0x4a5763(0x15a)+_0x4aeb92);const _0x129ca5=await withProgressSpinner(_0x4a5763(0x1e3),async _0x20b646=>{const _0x6e2d4e=_0x4a5763,_0x28727f=await _0x51dfa6[_0x6e2d4e(0x1bc)]['execute'](_0x4aeb92,{'catalog':'td','schema':_0x6e2d4e(0x162),'onJobId':_0x6cb1c7=>{const _0x364821=_0x6e2d4e;_0x20b646[_0x364821(0x1fe)](_0x6cb1c7);}});return _0x28727f;},{'verbose':_0xc15026[_0x4a5763(0x1bd)]}),_0x5a8740=_0x129ca5[_0x4a5763(0x16c)],_0x1e67bf=_0x5a8740[_0x4a5763(0x1df)]?_0x4a5763(0x1f2)+_0x5a8740['jobId']+']':'';return console[_0x4a5763(0x19a)](_0x4a5763(0x191)+_0x5a8740[_0x4a5763(0x15b)]['processedRows'][_0x4a5763(0x18f)]()+_0x4a5763(0x1e0)+(_0x4a5763(0x1c1)+formatElapsed(_0x5a8740[_0x4a5763(0x15b)][_0x4a5763(0x201)])+_0x1e67bf)),await handleQueryOutput(_0x5a8740,_0xc15026),0x0;}catch(_0x4b14ab){if(_0x4b14ab instanceof SDKError)return console['error'](_0x4a5763(0x1b0)+_0x4b14ab[_0x4a5763(0x180)]+']'),console[_0x4a5763(0x19a)]('\x0a'+_0x4b14ab[_0x4a5763(0x164)]),0x1;throw _0x4b14ab;}}}export class SegmentFolderListCommand extends BaseCommand{[a37_0x21b2dc(0x173)]=a37_0x21b2dc(0x1d2);[a37_0x21b2dc(0x185)]='List\x20segment\x20folders\x20under\x20a\x20parent\x20segment';async[a37_0x21b2dc(0x176)](_0x5c0398){const _0x2d5468=a37_0x21b2dc,{options:_0x450b26,args:_0x62f1b2,tdx:_0x204abc}=_0x5c0398;if(_0x62f1b2[_0x2d5468(0x1c9)]===0x0)return console['error']('Error:\x20Parent\x20segment\x20name\x20is\x20required'),console['error']('Usage:\x20tdx\x20segment\x20folder\x20list\x20<parent_name>'),0x1;const _0x56d8e8=_0x62f1b2[0x0];try{_0x450b26[_0x2d5468(0x1bd)]&&(console[_0x2d5468(0x19a)](_0x2d5468(0x1a2)+_0x450b26[_0x2d5468(0x192)]),console['error'](_0x2d5468(0x19d)+_0x56d8e8));const _0x51551e=await withSpinner(_0x2d5468(0x1aa)+_0x56d8e8+_0x2d5468(0x1f5),()=>_0x204abc[_0x2d5468(0x1ef)][_0x2d5468(0x186)](_0x56d8e8),{'verbose':_0x450b26[_0x2d5468(0x1bd)]}),_0x5b18ad=_0x51551e[_0x2d5468(0x16c)];_0x450b26['verbose']&&console[_0x2d5468(0x19a)](_0x2d5468(0x190)+_0x5b18ad);const _0x5d83ed=await withSpinner(_0x2d5468(0x165)+_0x56d8e8+_0x2d5468(0x1f5),()=>_0x204abc[_0x2d5468(0x1ef)][_0x2d5468(0x1c5)](_0x5b18ad),{'verbose':_0x450b26[_0x2d5468(0x1bd)]}),_0x3e63ab=_0x5d83ed['data'];return console['error'](_0x2d5468(0x16e)+_0x3e63ab[_0x2d5468(0x1c9)]+_0x2d5468(0x1b9)+(_0x3e63ab[_0x2d5468(0x1c9)]!==0x1?'s':'')),await handleSDKOutput(_0x3e63ab,_0x450b26),0x0;}catch(_0x1b49fb){if(_0x1b49fb instanceof SDKError)return console[_0x2d5468(0x19a)](_0x2d5468(0x1e8)+_0x1b49fb[_0x2d5468(0x164)]),_0x1b49fb[_0x2d5468(0x168)]&&console[_0x2d5468(0x19a)]('\x20\x20Cause:\x20'+_0x1b49fb[_0x2d5468(0x168)]),0x1;throw _0x1b49fb;}}}export class SegmentFolderShowCommand extends BaseCommand{[a37_0x21b2dc(0x173)]=a37_0x21b2dc(0x1f9);[a37_0x21b2dc(0x185)]=a37_0x21b2dc(0x193);async[a37_0x21b2dc(0x176)](_0x33f3e1){const _0x2add3e=a37_0x21b2dc,{options:_0x5a13fb,args:_0x257edc,tdx:_0x164438}=_0x33f3e1;if(_0x257edc['length']===0x0)return console[_0x2add3e(0x19a)](_0x2add3e(0x1f4)),console['error'](_0x2add3e(0x1cd)),0x1;try{const {parentId:_0x2657ea,childId:_0x2a21de}=parseSegmentRef(_0x257edc[0x0]);_0x5a13fb[_0x2add3e(0x1bd)]&&(console[_0x2add3e(0x19a)](_0x2add3e(0x1a2)+_0x5a13fb['site']),console[_0x2add3e(0x19a)](_0x2add3e(0x19d)+_0x2657ea),_0x2a21de&&console['error']('Folder\x20name:\x20'+_0x2a21de));if(!_0x2a21de)return console['error'](_0x2add3e(0x1c6)),0x1;const _0x121e6e=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x2657ea+_0x2add3e(0x1f5),()=>_0x164438[_0x2add3e(0x1ef)][_0x2add3e(0x186)](_0x2657ea),{'verbose':_0x5a13fb[_0x2add3e(0x1bd)]}),_0x440811=_0x121e6e['data'];_0x5a13fb['verbose']&&console[_0x2add3e(0x19a)](_0x2add3e(0x190)+_0x440811);const _0x163984=await withSpinner(_0x2add3e(0x179)+_0x2a21de+_0x2add3e(0x1f5),()=>_0x164438['segment'][_0x2add3e(0x1a1)](_0x440811,_0x2a21de),{'verbose':_0x5a13fb[_0x2add3e(0x1bd)]}),_0x5195f8=_0x163984[_0x2add3e(0x16c)];_0x5a13fb[_0x2add3e(0x1bd)]&&console[_0x2add3e(0x19a)]('Resolved\x20folder\x20ID:\x20'+_0x5195f8);const _0x5caae9=await withSpinner(_0x2add3e(0x1d7)+_0x2a21de+_0x2add3e(0x1f5),()=>_0x164438[_0x2add3e(0x1ef)]['getFolder'](_0x5195f8),{'verbose':_0x5a13fb[_0x2add3e(0x1bd)]});return await handleSDKOutput([_0x5caae9[_0x2add3e(0x16c)]],_0x5a13fb),0x0;}catch(_0x1533f6){if(_0x1533f6 instanceof SDKError)return console[_0x2add3e(0x19a)](_0x2add3e(0x1e8)+_0x1533f6[_0x2add3e(0x164)]),_0x1533f6[_0x2add3e(0x168)]&&console[_0x2add3e(0x19a)](_0x2add3e(0x1ca)+_0x1533f6[_0x2add3e(0x168)]),0x1;throw _0x1533f6;}}}export class SegmentSQLCommand extends BaseCommand{['name']=a37_0x21b2dc(0x187);['description']=a37_0x21b2dc(0x1ba);async[a37_0x21b2dc(0x176)](_0x3eb250){const _0x3cfe40=a37_0x21b2dc,{options:_0x50af30,args:_0x53eb6d}=_0x3eb250,_0x530cf6=_0x50af30,_0x2f7cec=_0x530cf6['path'],_0x23917b=_0x53eb6d[0x0];if(!_0x23917b&&!_0x2f7cec)return console[_0x3cfe40(0x19a)](a37_0x5e0d32[_0x3cfe40(0x1a5)](_0x3cfe40(0x1da))),console[_0x3cfe40(0x19a)](_0x3cfe40(0x181)),console[_0x3cfe40(0x19a)](_0x3cfe40(0x167)),console['error']('\x20\x20Local\x20YAML\x20file:\x20\x20\x20\x20\x20\x20tdx\x20sg\x20sql\x20--path\x20<file-path>'),console[_0x3cfe40(0x19a)](_0x3cfe40(0x17b)),console[_0x3cfe40(0x19a)](_0x3cfe40(0x15d)),console[_0x3cfe40(0x19a)](_0x3cfe40(0x17e)),0x1;if(_0x23917b&&_0x2f7cec)return console[_0x3cfe40(0x19a)](a37_0x5e0d32['red'](_0x3cfe40(0x160))),0x1;try{let _0x2f4ac2;if(_0x2f7cec)_0x2f4ac2=await this[_0x3cfe40(0x1fc)](_0x2f7cec,_0x3eb250);else{if(isYamlFilePath(_0x23917b))return console[_0x3cfe40(0x19a)](a37_0x5e0d32[_0x3cfe40(0x1a5)](_0x3cfe40(0x1f6))),console['error'](_0x3cfe40(0x177)+_0x23917b),0x1;else _0x2f4ac2=await this[_0x3cfe40(0x1a3)](_0x23917b,_0x3eb250);}return _0x50af30[_0x3cfe40(0x1af)]===_0x3cfe40(0x1cf)||_0x50af30[_0x3cfe40(0x1af)]==='jsonl'?await handleSDKOutput([{'sql':_0x2f4ac2}],_0x50af30):console[_0x3cfe40(0x18a)](_0x2f4ac2),0x0;}catch(_0x1661a3){if(_0x1661a3 instanceof SDKError)return console['error'](_0x3cfe40(0x1e8)+_0x1661a3[_0x3cfe40(0x164)]),_0x1661a3['cause']&&console[_0x3cfe40(0x19a)]('\x20\x20Cause:\x20'+_0x1661a3[_0x3cfe40(0x168)]),0x1;throw _0x1661a3;}}async[a37_0x21b2dc(0x1fc)](_0x48ffe1,_0x827fbe){const _0x12af37=a37_0x21b2dc,{options:_0x170931,tdx:_0x52be96}=_0x827fbe;let _0x172091;try{_0x172091=await resolveYamlFilePath(_0x48ffe1);}catch(_0x5cedd3){throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x12af37(0x18d)+_0x5cedd3[_0x12af37(0x164)]);}_0x170931[_0x12af37(0x1bd)]&&console[_0x12af37(0x19a)](_0x12af37(0x1cb)+_0x172091['parentSegment']+'/'+_0x172091[_0x12af37(0x1a6)]);const _0x5e70a2=await withSpinner('Fetching\x20SQL\x20from\x20rule...',()=>_0x52be96[_0x12af37(0x1ef)][_0x12af37(0x1ad)](_0x172091['content'],_0x172091[_0x12af37(0x196)],_0x172091[_0x12af37(0x1a6)]),{'verbose':_0x170931[_0x12af37(0x1bd)]});return _0x5e70a2[_0x12af37(0x16c)];}async['getSQLFromServerSegment'](_0x2a4c51,_0x56a2b9){const _0x424212=a37_0x21b2dc,{options:_0x1e48b3,tdx:_0xd3371b}=_0x56a2b9,_0x5f84a=_0x1e48b3['parentSegment'],_0x45d5cd=await resolveSegmentTarget(_0x2a4c51,_0x5f84a,_0x1e48b3[_0x424212(0x1bd)]);_0x1e48b3['verbose']&&console['error'](_0x424212(0x1f7)+_0x45d5cd);const _0x45447c=await withSpinner(_0x424212(0x16d)+_0x2a4c51+_0x424212(0x1f5),()=>_0xd3371b[_0x424212(0x1ef)][_0x424212(0x1eb)](_0x45d5cd),{'verbose':_0x1e48b3[_0x424212(0x1bd)]}),_0x525067=_0x45447c[_0x424212(0x16c)];_0x1e48b3[_0x424212(0x1bd)]&&(console[_0x424212(0x19a)](_0x424212(0x1d0)+_0x525067['type']),console[_0x424212(0x19a)](_0x424212(0x1b2)+_0x525067['parentId']));if(_0x525067[_0x424212(0x163)]===_0x424212(0x1c2))throw new SDKError(ErrorCode[_0x424212(0x1fb)],_0x424212(0x1c7));if(_0x525067[_0x424212(0x163)]===_0x424212(0x197))throw new SDKError(ErrorCode[_0x424212(0x1fb)],'Cannot\x20get\x20SQL\x20for\x20parent\x20segment\x20with\x20this\x20command.\x20Use:\x20tdx\x20ps\x20sql');if(!_0x525067['segmentId'])throw new SDKError(ErrorCode[_0x424212(0x1de)],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x39f246=await withSpinner(_0x424212(0x170),()=>_0xd3371b[_0x424212(0x1ef)][_0x424212(0x1a4)](_0x525067[_0x424212(0x1ab)],_0x525067['segmentId']),{'verbose':_0x1e48b3[_0x424212(0x1bd)]});return _0x39f246['data'];}}export class SegmentFolderCreateCommand extends BaseCommand{[a37_0x21b2dc(0x173)]=a37_0x21b2dc(0x195);['description']=a37_0x21b2dc(0x1d6);async[a37_0x21b2dc(0x176)](_0x4ede91){const _0x348bf8=a37_0x21b2dc,{options:_0x52562a,args:_0x3db5c3,tdx:_0x45cf4e}=_0x4ede91,_0x155d5f=_0x52562a;if(_0x3db5c3[_0x348bf8(0x1c9)]<0x2)return console[_0x348bf8(0x19a)](_0x348bf8(0x17a)),console['error']('Usage:\x20tdx\x20segment\x20folder\x20create\x20<parent_name>\x20<folder_name>\x20[options]'),0x1;const _0x179fff=_0x3db5c3[0x0],_0xdec9b=_0x3db5c3[0x1];_0x155d5f[_0x348bf8(0x1bd)]&&(console['error'](_0x348bf8(0x1a2)+_0x155d5f['site']),console['error'](_0x348bf8(0x19b)+_0x179fff),console[_0x348bf8(0x19a)](_0x348bf8(0x175)+_0xdec9b));let _0x288a86;if(_0x155d5f['parentFolder']){const _0x30650a=_0x155d5f[_0x348bf8(0x1a0)],_0x20fb4f=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x179fff+_0x348bf8(0x1f5),()=>_0x45cf4e['segment']['resolveParentId'](_0x179fff),{'verbose':_0x155d5f[_0x348bf8(0x1bd)]}),_0xb3383=_0x20fb4f[_0x348bf8(0x16c)],_0x172d8a=await withSpinner(_0x348bf8(0x1a9)+_0x30650a+_0x348bf8(0x1f5),()=>_0x45cf4e[_0x348bf8(0x1ef)]['resolveFolderId'](_0xb3383,_0x30650a),{'verbose':_0x155d5f[_0x348bf8(0x1bd)]});_0x288a86=_0x172d8a[_0x348bf8(0x16c)],_0x155d5f[_0x348bf8(0x1bd)]&&console[_0x348bf8(0x19a)](_0x348bf8(0x1dd)+_0x288a86);}const _0x2a77a0={'name':_0xdec9b,'description':_0x155d5f[_0x348bf8(0x185)],'parentFolderId':_0x288a86},_0x208748=await withSpinner(_0x348bf8(0x15e)+_0xdec9b+_0x348bf8(0x1f5),()=>_0x45cf4e[_0x348bf8(0x1ef)]['createFolder'](_0x179fff,_0x2a77a0),{'verbose':_0x155d5f[_0x348bf8(0x1bd)]}),_0x5828ea=_0x208748[_0x348bf8(0x16c)];return console[_0x348bf8(0x19a)]('✔\x20Created\x20folder\x20\x27'+_0x5828ea[_0x348bf8(0x173)]+_0x348bf8(0x1e9)+_0x5828ea['id']),await handleSDKOutput([_0x5828ea],_0x155d5f),0x0;}}export class SegmentViewCommand extends BaseCommand{[a37_0x21b2dc(0x173)]=a37_0x21b2dc(0x1f1);[a37_0x21b2dc(0x185)]='Show\x20folder\x20or\x20child\x20segment\x20details';async['execute'](_0x143f77){const _0x1a1f22=a37_0x21b2dc,{options:_0xaa8aa5,args:_0xd757b3,tdx:_0x1801a5}=_0x143f77,_0x22757a=_0xd757b3[0x0];if(!_0x22757a)return console[_0x1a1f22(0x19a)](_0x1a1f22(0x17c)),console[_0x1a1f22(0x19a)](_0x1a1f22(0x1ee)),console[_0x1a1f22(0x19a)](_0x1a1f22(0x1dc)),console['error'](_0x1a1f22(0x194)),console[_0x1a1f22(0x19a)](_0x1a1f22(0x1b8)),console[_0x1a1f22(0x19a)](_0x1a1f22(0x17b)),console[_0x1a1f22(0x19a)]('\x20\x20tdx\x20sg\x20view\x20\x22Marketing\x22\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20folder\x20details'),console[_0x1a1f22(0x19a)](_0x1a1f22(0x1bf)),console['error'](_0x1a1f22(0x18b)),console[_0x1a1f22(0x19a)]('\x20\x20tdx\x20sg\x20view\x20segments/my-audience/premium-users.yml'),0x1;try{const _0x2509e2=_0xaa8aa5[_0x1a1f22(0x196)],_0x1dda1f=await resolveSegmentTarget(_0x22757a,_0x2509e2,_0xaa8aa5[_0x1a1f22(0x1bd)]);_0xaa8aa5[_0x1a1f22(0x1bd)]&&console[_0x1a1f22(0x19a)](_0x1a1f22(0x1f7)+_0x1dda1f);const _0x15c031=await withSpinner(_0x1a1f22(0x16d)+_0x22757a+_0x1a1f22(0x1f5),()=>_0x1801a5['segment'][_0x1a1f22(0x1eb)](_0x1dda1f),{'verbose':_0xaa8aa5[_0x1a1f22(0x1bd)]}),_0x2ecb9e=_0x15c031[_0x1a1f22(0x16c)];_0xaa8aa5[_0x1a1f22(0x1bd)]&&(console['error']('Resolved\x20type:\x20'+_0x2ecb9e[_0x1a1f22(0x163)]),console[_0x1a1f22(0x19a)](_0x1a1f22(0x1b2)+_0x2ecb9e['parentId']),_0x2ecb9e['folderId']&&console[_0x1a1f22(0x19a)](_0x1a1f22(0x1ed)+_0x2ecb9e[_0x1a1f22(0x15c)]),_0x2ecb9e[_0x1a1f22(0x183)]&&console[_0x1a1f22(0x19a)]('Segment\x20ID:\x20'+_0x2ecb9e[_0x1a1f22(0x183)]));if(_0xaa8aa5[_0x1a1f22(0x1b7)]){if(_0x2ecb9e[_0x1a1f22(0x163)]==='folder')return console['error'](_0x1a1f22(0x1c4)),0x1;if(_0x2ecb9e[_0x1a1f22(0x163)]===_0x1a1f22(0x197))return console[_0x1a1f22(0x19a)](_0x1a1f22(0x1f3)),console['error'](_0x1a1f22(0x1d5)),0x1;if(!_0x2ecb9e['segmentId'])throw new SDKError(ErrorCode[_0x1a1f22(0x1de)],_0x1a1f22(0x1fa));const _0x5ecc7c=getConsoleNextUrl(_0xaa8aa5[_0x1a1f22(0x192)],_0x1a1f22(0x1ac)+_0x2ecb9e[_0x1a1f22(0x1ab)]+_0x1a1f22(0x1d3)+_0x2ecb9e[_0x1a1f22(0x183)]);return console[_0x1a1f22(0x19a)](a37_0x5e0d32['green']('✔')+_0x1a1f22(0x18e)+a37_0x5e0d32['cyan'](_0x5ecc7c)),openBrowser(_0x5ecc7c),0x0;}if(_0x2ecb9e[_0x1a1f22(0x163)]===_0x1a1f22(0x1c2)){if(!_0x2ecb9e[_0x1a1f22(0x15c)])throw new SDKError(ErrorCode[_0x1a1f22(0x1ff)],_0x1a1f22(0x1d8));const _0xa0dac2=await withSpinner('Fetching\x20folder\x20details...',()=>_0x1801a5['segment'][_0x1a1f22(0x1a8)](_0x2ecb9e[_0x1a1f22(0x15c)]),{'verbose':_0xaa8aa5['verbose']});await handleSingleObjectOutput(_0xa0dac2[_0x1a1f22(0x16c)],_0xaa8aa5);}else{if(_0x2ecb9e[_0x1a1f22(0x163)]===_0x1a1f22(0x1ef)){if(!_0x2ecb9e[_0x1a1f22(0x183)])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x1a1f22(0x1fa));const _0x407ef5=await withSpinner('Fetching\x20segment\x20details...',()=>_0x1801a5[_0x1a1f22(0x1ef)][_0x1a1f22(0x1b1)](_0x2ecb9e[_0x1a1f22(0x1ab)],_0x2ecb9e['segmentId']),{'verbose':_0xaa8aa5[_0x1a1f22(0x1bd)]}),_0x451630=getConsoleNextUrl(_0xaa8aa5[_0x1a1f22(0x192)],_0x1a1f22(0x1ac)+_0x2ecb9e[_0x1a1f22(0x1ab)]+'/e/'+_0x2ecb9e[_0x1a1f22(0x183)]),_0x2098bb=_0x407ef5[_0x1a1f22(0x16c)];_0x2098bb[_0x1a1f22(0x178)]=_0x451630,await handleSingleObjectOutput(_0x2098bb,_0xaa8aa5);}else return console[_0x1a1f22(0x19a)](_0x1a1f22(0x198)),console[_0x1a1f22(0x19a)](_0x1a1f22(0x166)),0x1;}return 0x0;}catch(_0xf2cb20){if(_0xf2cb20 instanceof SDKError)return console['error']('Error:\x20'+_0xf2cb20[_0x1a1f22(0x164)]),_0xf2cb20['cause']&&console[_0x1a1f22(0x19a)](_0x1a1f22(0x1ca)+_0xf2cb20['cause']),0x1;throw _0xf2cb20;}}}export const SegmentInfoCommand=SegmentViewCommand;export class SegmentDescCommand extends BaseCommand{[a37_0x21b2dc(0x173)]=a37_0x21b2dc(0x1be);['description']=a37_0x21b2dc(0x1ec);async[a37_0x21b2dc(0x176)](_0x1f773e){const _0x589686=a37_0x21b2dc,{options:_0x138f9f,args:_0x4af93d,tdx:_0x2ff124}=_0x1f773e,_0x582488=_0x4af93d[0x0];if(!_0x582488)return console['error'](_0x589686(0x1b4)),console[_0x589686(0x19a)]('Usage:\x20tdx\x20sg\x20desc\x20<name>'),console['error'](_0x589686(0x1e1)),console['error']('Examples:'),console[_0x589686(0x19a)]('\x20\x20tdx\x20sg\x20desc\x20\x22Premium\x20Users\x22'),console[_0x589686(0x19a)]('\x20\x20tdx\x20sg\x20desc\x20segments/my-audience/premium-users.yml'),0x1;try{const _0x5d7aa8=_0x138f9f['parentSegment'],_0x57507a=await resolveSegmentTarget(_0x582488,_0x5d7aa8,_0x138f9f[_0x589686(0x1bd)]);_0x138f9f['verbose']&&console['error'](_0x589686(0x1f7)+_0x57507a);const _0x5b59b0=await withSpinner(_0x589686(0x16d)+_0x582488+'\x27...',()=>_0x2ff124[_0x589686(0x1ef)][_0x589686(0x1eb)](_0x57507a),{'verbose':_0x138f9f[_0x589686(0x1bd)]}),_0x4c2230=_0x5b59b0['data'];_0x138f9f[_0x589686(0x1bd)]&&(console[_0x589686(0x19a)](_0x589686(0x1d0)+_0x4c2230['type']),console[_0x589686(0x19a)]('Parent\x20ID:\x20'+_0x4c2230[_0x589686(0x1ab)]));if(_0x4c2230['type']===_0x589686(0x1c2))return console['error'](_0x589686(0x1c8)),console[_0x589686(0x19a)](_0x589686(0x1b5)),0x1;if(_0x4c2230[_0x589686(0x163)]===_0x589686(0x197))return console[_0x589686(0x19a)]('Error:\x20Cannot\x20show\x20schema\x20for\x20parent\x20segment\x20with\x20this\x20command.'),console[_0x589686(0x19a)](_0x589686(0x1e5)),0x1;if(!_0x4c2230[_0x589686(0x183)])throw new SDKError(ErrorCode[_0x589686(0x1de)],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x1a8015=await withSpinner(_0x589686(0x170),()=>_0x2ff124[_0x589686(0x1ef)]['getSegmentSQL'](_0x4c2230['parentId'],_0x4c2230['segmentId']),{'verbose':_0x138f9f['verbose']}),_0x53e96b=_0x1a8015[_0x589686(0x16c)],_0x39bfe5=await executeSchemaQuery(_0x53e96b,_0x2ff124,_0x138f9f);return await handleQueryOutput(_0x39bfe5,_0x138f9f),0x0;}catch(_0x1a0c70){if(_0x1a0c70 instanceof SDKError)return console[_0x589686(0x19a)](_0x589686(0x1e8)+_0x1a0c70[_0x589686(0x164)]),_0x1a0c70['cause']&&console[_0x589686(0x19a)](_0x589686(0x1ca)+_0x1a0c70[_0x589686(0x168)]),0x1;throw _0x1a0c70;}}}function a37_0x153a(){const _0x214fe9=['/e/','SELECT\x20*\x20FROM\x20(\x0a','Use:\x20tdx\x20ps\x20view\x20-w','Create\x20segment\x20folder\x20for\x20organization','Fetching\x20folder\x20\x27','Folder\x20ID\x20missing\x20from\x20resolved\x20path','limit','Error:\x20Segment\x20name\x20or\x20--path\x20is\x20required','segment:show','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20view\x20<path/to/segment.yml>','Resolved\x20parent\x20folder\x20ID:\x20','SEGMENT_NOT_FOUND','jobId','\x20rows\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20desc\x20<path/to/segment.yml>','2180757aSCbQP','Executing\x20segment\x20query...','\x20\x20tdx\x20segment\x20describe\x20\x22High\x20Value\x22\x20\x20\x20\x20#\x20Relative\x20to\x20current\x20context','Use:\x20tdx\x20ps\x20desc','\x20\x20Folder\x20path:\x20','12968NKdCTa','Error:\x20','\x27\x20with\x20ID:\x20','\x20\x20Parent\x20segment:\x20','resolvePathToResource','Show\x20child\x20segment\x20schema\x20(column\x20types)','Folder\x20ID:\x20','Usage:\x20tdx\x20sg\x20view\x20<name>\x20[-w]','segment','Resolving\x20path\x20\x27','segment:view','\x20[Job\x20ID:\x20','Error:\x20Cannot\x20open\x20parent\x20segment\x20with\x20this\x20command.','Error:\x20Folder\x20reference\x20is\x20required','\x27...','Error:\x20YAML\x20file\x20paths\x20must\x20be\x20specified\x20with\x20--path\x20option','Target\x20path:\x20','Use:\x20tdx\x20sg\x20view\x20<name>\x20\x20#\x20To\x20show\x20folder\x20details','segment:folder:show','Segment\x20ID\x20missing\x20from\x20resolved\x20path','INVALID_ARGUMENT','getSQLFromYamlFile','\x20\x20tdx\x20sg\x20show\x20segments/my-audience/premium-users.yml','setJobId','SEGMENT_FOLDER_NOT_FOUND','segmentPath','elapsedTimeMillis','(root)','SQL\x20query:\x0a','stats','folderId','\x20\x20tdx\x20sg\x20sql\x20\x22Premium\x20Users\x22','Creating\x20folder\x20\x27','\x20\x20Segment\x20name:\x20','Error:\x20Specify\x20either\x20segment\x20name\x20or\x20--path,\x20not\x20both','Usage:\x20tdx\x20segment\x20describe\x20<path>','information_schema','type','message','Listing\x20folders\x20for\x20parent\x20\x27','Use:\x20tdx\x20ps\x20view','\x20\x20Server-side\x20segment:\x20\x20tdx\x20sg\x20sql\x20<name>','cause','Usage:\x20tdx\x20sg\x20show\x20<name>','8lVjQXj','Resolved\x20relative\x20path\x20to:\x20','data','Resolving\x20\x27','✔\x20Found\x20','Fetching\x20segment\x20details...','Fetching\x20SQL\x20for\x20segment...','Error:\x20Cannot\x20execute\x20query\x20for\x20parent\x20segment\x20with\x20this\x20command.','4058488wiZCpv','name','3507504Okzams','Folder\x20name:\x20','execute','\x20\x20tdx\x20sg\x20sql\x20--path\x20','url','Resolving\x20folder\x20\x27','Error:\x20Parent\x20segment\x20name\x20and\x20folder\x20name\x20are\x20required','Examples:','Error:\x20Folder\x20or\x20segment\x20name,\x20or\x20YAML\x20file\x20path\x20is\x20required','folderPath','\x20\x20tdx\x20sg\x20sql\x20--path\x20segments/my-audience/premium-users.yml','Fetching\x20folder\x20details...','code','Usage:','replace','segmentId','4508755nTGBKu','description','resolveParentId','segment:sql','fullPath','Use:\x20tdx\x20ps\x20show','log','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20-w\x20\x20#\x20Open\x20segment\x20in\x20web\x20browser','226sdvSqF','Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20','\x20Opening\x20','toLocaleString','Resolved\x20parent\x20ID:\x20','✔\x20Query\x20completed:\x20Processed\x20','site','Show\x20segment\x20folder\x20details','Options:','segment:folder:create','parentSegment','parent','Error:\x20Cannot\x20view\x20parent\x20segment\x20details\x20with\x20this\x20command.','8339868vPJIyv','error','Parent\x20segment:\x20','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','Parent\x20name:\x20','trim','\x20\x20Full\x20path:\x20','parentFolder','resolveFolderId','Site:\x20','getSQLFromServerSegment','getSegmentSQL','red','segmentName','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','getFolder','Resolving\x20parent\x20folder\x20\x27','Resolving\x20parent\x20segment\x20\x27','parentId','/app/ps/','getSegmentSQLFromYaml','getParent','format','✖\x20Query\x20failed\x20[','getSegment','Parent\x20ID:\x20','segment:describe','Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required','Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.','includes','web','\x20\x20-w,\x20--web\x20\x20Open\x20segment\x20in\x20web\x20browser','\x20folder','Get\x20SQL\x20query\x20for\x20child\x20segment','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience/Marketing/High\x20Value\x22','query','verbose','segment:desc','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20\x20\x20\x20\x20#\x20View\x20child\x20segment\x20details','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience\x22','in\x20','folder','Resolved\x20YAML\x20file:\x20','Error:\x20Cannot\x20open\x20folder\x20in\x20web\x20browser.\x20Use\x20a\x20segment\x20name\x20instead.','listFolders','Error:\x20Folder\x20name\x20is\x20required\x20(use\x20parent_name/folder_name\x20format)','Cannot\x20get\x20SQL\x20query\x20for\x20a\x20folder.\x20Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.','Error:\x20Cannot\x20show\x20schema\x20for\x20a\x20folder.','length','\x20\x20Cause:\x20','Resolved:\x20','test','Usage:\x20tdx\x20segment\x20folder\x20show\x20<parent_name/folder_name>','22645827tCqNMY','json','Resolved\x20type:\x20','Segment\x20ID:\x20','segment:folder:list'];a37_0x153a=function(){return _0x214fe9;};return a37_0x153a();}
1
+ const a37_0x135c14=a37_0x3c28;(function(_0x512901,_0x247101){const _0x331bc7=a37_0x3c28,_0x10bae8=_0x512901();while(!![]){try{const _0x162a0d=-parseInt(_0x331bc7(0xa7))/0x1*(parseInt(_0x331bc7(0xdb))/0x2)+parseInt(_0x331bc7(0x133))/0x3+parseInt(_0x331bc7(0xff))/0x4+parseInt(_0x331bc7(0xe2))/0x5+parseInt(_0x331bc7(0xc9))/0x6*(parseInt(_0x331bc7(0xb8))/0x7)+-parseInt(_0x331bc7(0xe5))/0x8+parseInt(_0x331bc7(0xc4))/0x9;if(_0x162a0d===_0x247101)break;else _0x10bae8['push'](_0x10bae8['shift']());}catch(_0x58a4ce){_0x10bae8['push'](_0x10bae8['shift']());}}}(a37_0x4cbb,0xd31be));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,handleQueryOutput,handleSingleObjectOutput}from'../core/command-output.js';import{withSpinner,withProgressSpinner,formatElapsed}from'../utils/spinner.js';function a37_0x3c28(_0x3d19f4,_0x16fc2d){_0x3d19f4=_0x3d19f4-0x93;const _0x4cbb19=a37_0x4cbb();let _0x3c28fd=_0x4cbb19[_0x3d19f4];return _0x3c28fd;}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_0x451b3d from'chalk';async function resolveSegmentTarget(_0x26b5b1,_0x58564c,_0x52cb01){const _0x3952e1=a37_0x3c28;if(isYamlFilePath(_0x26b5b1))try{const _0x378a21=await resolveYamlFilePath(_0x26b5b1);return _0x52cb01&&(console[_0x3952e1(0x95)]('Resolved\x20YAML\x20file:\x20'+_0x26b5b1),console[_0x3952e1(0x95)](_0x3952e1(0x125)+_0x378a21['parentSegment']),console[_0x3952e1(0x95)]('\x20\x20Segment\x20name:\x20'+_0x378a21['segmentName']),console[_0x3952e1(0x95)](_0x3952e1(0xb5)+(_0x378a21[_0x3952e1(0xf5)]||_0x3952e1(0xa0))),console[_0x3952e1(0x95)](_0x3952e1(0x120)+_0x378a21[_0x3952e1(0xdd)])),_0x378a21[_0x3952e1(0xdd)];}catch(_0x40859f){throw new SDKError(ErrorCode[_0x3952e1(0xcc)],_0x3952e1(0xb4)+_0x40859f[_0x3952e1(0xf7)]);}if(!_0x58564c)throw new SDKError(ErrorCode[_0x3952e1(0xcc)],_0x3952e1(0x10b));return _0x58564c+'/'+_0x26b5b1;}export class SegmentDescribeCommand extends BaseCommand{[a37_0x135c14(0x9e)]='segment:describe';[a37_0x135c14(0x122)]=a37_0x135c14(0x12b);async[a37_0x135c14(0xa4)](_0xdd7331){const _0x19e609=a37_0x135c14,{options:_0x5b5bc4,args:_0x3f95a3,tdx:_0x527fe2}=_0xdd7331,_0x3f42e2=_0x3f95a3[0x0],_0x17177c=!_0x3f42e2&&!!_0x5b5bc4[_0x19e609(0x108)],_0x12b1a2=_0x3f42e2||_0x5b5bc4[_0x19e609(0x108)];if(!_0x12b1a2)return console[_0x19e609(0x95)](_0x19e609(0xbf)),console[_0x19e609(0x95)]('Usage:\x20tdx\x20segment\x20describe\x20<path>'),console[_0x19e609(0x95)](_0x19e609(0xf0)),console['error'](_0x19e609(0xca)),console[_0x19e609(0x95)](_0x19e609(0xa2)),console[_0x19e609(0x95)](_0x19e609(0xd6)),console[_0x19e609(0x95)](_0x19e609(0xe9)),0x1;try{const _0xdf9a4=_0x5b5bc4[_0x19e609(0xba)];let _0x2e02d8=_0x12b1a2;!_0x17177c&&_0xdf9a4&&!_0x12b1a2['includes']('/')&&(_0x2e02d8=_0xdf9a4+'/'+_0x12b1a2,_0x5b5bc4['verbose']&&console[_0x19e609(0x95)]('Resolved\x20relative\x20path\x20to:\x20'+_0x2e02d8));const _0x7e35e2=await withSpinner(_0x19e609(0xa8)+_0x2e02d8+_0x19e609(0xf4),()=>_0x527fe2[_0x19e609(0xde)]['resolvePathToResource'](_0x2e02d8),{'verbose':_0x5b5bc4[_0x19e609(0xab)]}),_0x5a6819=_0x7e35e2[_0x19e609(0x10c)];_0x5b5bc4['verbose']&&(console['error'](_0x19e609(0xc8)+_0x5a6819[_0x19e609(0xc5)]),console[_0x19e609(0x95)](_0x19e609(0xad)+_0x5a6819[_0x19e609(0xb2)]),_0x5a6819[_0x19e609(0xed)]&&console['error'](_0x19e609(0x9b)+_0x5a6819[_0x19e609(0xed)]),_0x5a6819[_0x19e609(0xeb)]&&console['error'](_0x19e609(0xcf)+_0x5a6819[_0x19e609(0xeb)]));if(_0x5a6819['type']==='parent'){const _0xd7bc8b=await withSpinner(_0x19e609(0x111),()=>_0x527fe2[_0x19e609(0xde)][_0x19e609(0x101)](_0x5a6819[_0x19e609(0xb2)]),{'verbose':_0x5b5bc4['verbose']});await handleSingleObjectOutput(_0xd7bc8b[_0x19e609(0x10c)],_0x5b5bc4);}else{if(_0x5a6819[_0x19e609(0xc5)]===_0x19e609(0xbb)){if(!_0x5a6819[_0x19e609(0xed)])throw new SDKError(ErrorCode[_0x19e609(0xb9)],_0x19e609(0x103));const _0x194064=await withSpinner(_0x19e609(0x10e),()=>_0x527fe2[_0x19e609(0xde)]['getFolder'](_0x5a6819[_0x19e609(0xed)]),{'verbose':_0x5b5bc4[_0x19e609(0xab)]});await handleSingleObjectOutput(_0x194064[_0x19e609(0x10c)],_0x5b5bc4);}else{if(_0x5a6819[_0x19e609(0xc5)]===_0x19e609(0xde)){if(!_0x5a6819[_0x19e609(0xeb)])throw new SDKError(ErrorCode[_0x19e609(0xd9)],_0x19e609(0xc6));const _0x1e0652=await withSpinner(_0x19e609(0x11d),()=>_0x527fe2['segment'][_0x19e609(0xa1)](_0x5a6819['parentId'],_0x5a6819[_0x19e609(0xeb)]),{'verbose':_0x5b5bc4['verbose']});await handleSingleObjectOutput(_0x1e0652['data'],_0x5b5bc4);}}}return 0x0;}catch(_0x246621){if(_0x246621 instanceof SDKError)return console[_0x19e609(0x95)]('Error:\x20'+_0x246621[_0x19e609(0xf7)]),_0x246621[_0x19e609(0x110)]&&console[_0x19e609(0x95)](_0x19e609(0x127)+_0x246621[_0x19e609(0x110)]),0x1;throw _0x246621;}}}export class SegmentShowCommand extends BaseCommand{[a37_0x135c14(0x9e)]=a37_0x135c14(0xd3);[a37_0x135c14(0x122)]=a37_0x135c14(0xd1);async[a37_0x135c14(0xa4)](_0x347585){const _0x3ccce9=a37_0x135c14,{options:_0x3e2994,args:_0x5b3f53,tdx:_0x4625eb}=_0x347585,_0x92fbc3=_0x5b3f53[0x0];if(!_0x92fbc3)return console['error'](_0x3ccce9(0x102)),console['error'](_0x3ccce9(0xd0)),console[_0x3ccce9(0x95)]('\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20show\x20<path/to/segment.yml>'),console[_0x3ccce9(0x95)](_0x3ccce9(0xf0)),console[_0x3ccce9(0x95)](_0x3ccce9(0xef)),console[_0x3ccce9(0x95)]('\x20\x20tdx\x20sg\x20show\x20segments/my-audience/premium-users.yml'),0x1;try{const _0x2e92d2=_0x3e2994[_0x3ccce9(0x108)],_0x5befcb=await resolveSegmentTarget(_0x92fbc3,_0x2e92d2,_0x3e2994[_0x3ccce9(0xab)]);_0x3e2994['verbose']&&console[_0x3ccce9(0x95)]('Target\x20path:\x20'+_0x5befcb);const _0x45282b=await withSpinner('Resolving\x20\x27'+_0x92fbc3+_0x3ccce9(0xf4),()=>_0x4625eb['segment'][_0x3ccce9(0xc2)](_0x5befcb),{'verbose':_0x3e2994[_0x3ccce9(0xab)]}),_0xce14e3=_0x45282b[_0x3ccce9(0x10c)];_0x3e2994[_0x3ccce9(0xab)]&&(console[_0x3ccce9(0x95)](_0x3ccce9(0xc8)+_0xce14e3[_0x3ccce9(0xc5)]),console[_0x3ccce9(0x95)](_0x3ccce9(0xad)+_0xce14e3['parentId']));if(_0xce14e3[_0x3ccce9(0xc5)]==='folder')return console['error'](_0x3ccce9(0x126)),console['error'](_0x3ccce9(0xda)),0x1;if(_0xce14e3['type']===_0x3ccce9(0x104))return console['error'](_0x3ccce9(0x107)),console[_0x3ccce9(0x95)](_0x3ccce9(0x116)),0x1;if(!_0xce14e3[_0x3ccce9(0xeb)])throw new SDKError(ErrorCode[_0x3ccce9(0xd9)],_0x3ccce9(0xc6));const _0x413bc7=await withSpinner('Fetching\x20SQL\x20for\x20segment...',()=>_0x4625eb[_0x3ccce9(0xde)][_0x3ccce9(0x106)](_0xce14e3[_0x3ccce9(0xb2)],_0xce14e3[_0x3ccce9(0xeb)]),{'verbose':_0x3e2994[_0x3ccce9(0xab)]});let _0x2c5244=_0x413bc7[_0x3ccce9(0x10c)];const _0xf9ff34=resolveLimit(_0x3e2994[_0x3ccce9(0xfa)],DEFAULT_DISPLAY_LIMIT),_0x4e0a0e=/\bLIMIT\s+\d+/i[_0x3ccce9(0xc3)](_0x2c5244);!_0x4e0a0e&&(_0x2c5244=_0x2c5244['trim']()[_0x3ccce9(0x129)](/;+$/,''),_0x2c5244='SELECT\x20*\x20FROM\x20(\x0a'+_0x2c5244+_0x3ccce9(0x12d)+_0xf9ff34);_0x3e2994[_0x3ccce9(0xab)]&&console[_0x3ccce9(0x95)](_0x3ccce9(0xbc)+_0x2c5244);const _0x3b1bfa=await withProgressSpinner('Executing\x20segment\x20query...',async _0xae1626=>{const _0x5d4f30=_0x3ccce9,_0x4482bc=await _0x4625eb[_0x5d4f30(0xb3)]['execute'](_0x2c5244,{'catalog':'td','schema':_0x5d4f30(0x114),'onJobId':_0x510e5f=>{_0xae1626['setJobId'](_0x510e5f);}});return _0x4482bc;},{'verbose':_0x3e2994[_0x3ccce9(0xab)]}),_0x1cdcf7=_0x3b1bfa[_0x3ccce9(0x10c)],_0x26e949=_0x1cdcf7[_0x3ccce9(0x12a)]?_0x3ccce9(0xd2)+_0x1cdcf7[_0x3ccce9(0x12a)]+']':'';return console['error'](_0x3ccce9(0xb6)+_0x1cdcf7[_0x3ccce9(0x100)][_0x3ccce9(0x131)][_0x3ccce9(0x94)]()+_0x3ccce9(0xa3)+(_0x3ccce9(0xe0)+formatElapsed(_0x1cdcf7['stats'][_0x3ccce9(0xe6)])+_0x26e949)),await handleQueryOutput(_0x1cdcf7,_0x3e2994),0x0;}catch(_0x6f545b){if(_0x6f545b instanceof SDKError)return console[_0x3ccce9(0x95)]('✖\x20Query\x20failed\x20['+_0x6f545b[_0x3ccce9(0xdf)]+']'),console[_0x3ccce9(0x95)]('\x0a'+_0x6f545b[_0x3ccce9(0xf7)]),0x1;throw _0x6f545b;}}}export class SegmentFolderListCommand extends BaseCommand{['name']=a37_0x135c14(0xbd);[a37_0x135c14(0x122)]=a37_0x135c14(0x112);async['execute'](_0x5060a0){const _0x4830bc=a37_0x135c14,{options:_0x2e1217,args:_0x2555fa,tdx:_0x363a23}=_0x5060a0;if(_0x2555fa[_0x4830bc(0x119)]===0x0)return console[_0x4830bc(0x95)](_0x4830bc(0xa9)),console[_0x4830bc(0x95)](_0x4830bc(0xfb)),0x1;const _0x5bc2cd=_0x2555fa[0x0];try{_0x2e1217[_0x4830bc(0xab)]&&(console[_0x4830bc(0x95)](_0x4830bc(0xb0)+_0x2e1217['site']),console[_0x4830bc(0x95)]('Parent\x20name:\x20'+_0x5bc2cd));const _0x520085=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x5bc2cd+_0x4830bc(0xf4),()=>_0x363a23[_0x4830bc(0xde)][_0x4830bc(0x12c)](_0x5bc2cd),{'verbose':_0x2e1217[_0x4830bc(0xab)]}),_0x82e30f=_0x520085['data'];_0x2e1217[_0x4830bc(0xab)]&&console[_0x4830bc(0x95)](_0x4830bc(0x123)+_0x82e30f);const _0x167f2f=await withSpinner(_0x4830bc(0xb1)+_0x5bc2cd+'\x27...',()=>_0x363a23[_0x4830bc(0xde)][_0x4830bc(0x11b)](_0x82e30f),{'verbose':_0x2e1217[_0x4830bc(0xab)]}),_0xfba079=_0x167f2f[_0x4830bc(0x10c)];return console[_0x4830bc(0x95)]('✔\x20Found\x20'+_0xfba079['length']+_0x4830bc(0x113)+(_0xfba079['length']!==0x1?'s':'')),await handleSDKOutput(_0xfba079,_0x2e1217),0x0;}catch(_0x43fb11){if(_0x43fb11 instanceof SDKError)return console[_0x4830bc(0x95)](_0x4830bc(0x109)+_0x43fb11[_0x4830bc(0xf7)]),_0x43fb11[_0x4830bc(0x110)]&&console[_0x4830bc(0x95)](_0x4830bc(0x127)+_0x43fb11[_0x4830bc(0x110)]),0x1;throw _0x43fb11;}}}export class SegmentFolderShowCommand extends BaseCommand{[a37_0x135c14(0x9e)]='segment:folder:show';[a37_0x135c14(0x122)]=a37_0x135c14(0xd5);async['execute'](_0x34db96){const _0x154608=a37_0x135c14,{options:_0x43908b,args:_0x326d87,tdx:_0x57f3f6}=_0x34db96;if(_0x326d87[_0x154608(0x119)]===0x0)return console[_0x154608(0x95)](_0x154608(0xea)),console[_0x154608(0x95)](_0x154608(0xc0)),0x1;try{const {parentId:_0xaacb3d,childId:_0x2fe575}=parseSegmentRef(_0x326d87[0x0]);_0x43908b['verbose']&&(console['error'](_0x154608(0xb0)+_0x43908b[_0x154608(0xe4)]),console['error'](_0x154608(0x128)+_0xaacb3d),_0x2fe575&&console[_0x154608(0x95)](_0x154608(0x11c)+_0x2fe575));if(!_0x2fe575)return console['error']('Error:\x20Folder\x20name\x20is\x20required\x20(use\x20parent_name/folder_name\x20format)'),0x1;const _0x584b87=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0xaacb3d+'\x27...',()=>_0x57f3f6[_0x154608(0xde)][_0x154608(0x12c)](_0xaacb3d),{'verbose':_0x43908b[_0x154608(0xab)]}),_0x3432fd=_0x584b87[_0x154608(0x10c)];_0x43908b[_0x154608(0xab)]&&console['error'](_0x154608(0x123)+_0x3432fd);const _0x545553=await withSpinner(_0x154608(0xcb)+_0x2fe575+'\x27...',()=>_0x57f3f6[_0x154608(0xde)][_0x154608(0xd8)](_0x3432fd,_0x2fe575),{'verbose':_0x43908b[_0x154608(0xab)]}),_0xf8804b=_0x545553[_0x154608(0x10c)];_0x43908b[_0x154608(0xab)]&&console[_0x154608(0x95)](_0x154608(0xae)+_0xf8804b);const _0x21ed24=await withSpinner('Fetching\x20folder\x20\x27'+_0x2fe575+_0x154608(0xf4),()=>_0x57f3f6[_0x154608(0xde)][_0x154608(0x105)](_0xf8804b),{'verbose':_0x43908b['verbose']});return await handleSDKOutput([_0x21ed24[_0x154608(0x10c)]],_0x43908b),0x0;}catch(_0x593171){if(_0x593171 instanceof SDKError)return console[_0x154608(0x95)](_0x154608(0x109)+_0x593171['message']),_0x593171[_0x154608(0x110)]&&console[_0x154608(0x95)](_0x154608(0x127)+_0x593171[_0x154608(0x110)]),0x1;throw _0x593171;}}}export class SegmentSQLCommand extends BaseCommand{['name']=a37_0x135c14(0xcd);[a37_0x135c14(0x122)]=a37_0x135c14(0xf9);async['execute'](_0x4c8e91){const _0x594cee=a37_0x135c14,{options:_0x1619f2,args:_0x36bd84}=_0x4c8e91,_0x262e19=_0x1619f2,_0x42932f=_0x262e19[_0x594cee(0x117)],_0x29aaf4=_0x36bd84[0x0];if(!_0x29aaf4&&!_0x42932f)return console[_0x594cee(0x95)](a37_0x451b3d[_0x594cee(0xdc)](_0x594cee(0xaa))),console['error'](_0x594cee(0x93)),console[_0x594cee(0x95)](_0x594cee(0x10d)),console[_0x594cee(0x95)](_0x594cee(0xb7)),console[_0x594cee(0x95)](_0x594cee(0xf0)),console[_0x594cee(0x95)](_0x594cee(0x130)),console[_0x594cee(0x95)](_0x594cee(0xf1)),0x1;if(_0x29aaf4&&_0x42932f)return console[_0x594cee(0x95)](a37_0x451b3d[_0x594cee(0xdc)](_0x594cee(0x12e))),0x1;try{let _0x34ff1a;if(_0x42932f)_0x34ff1a=await this[_0x594cee(0xac)](_0x42932f,_0x4c8e91);else{if(isYamlFilePath(_0x29aaf4))return console[_0x594cee(0x95)](a37_0x451b3d[_0x594cee(0xdc)]('Error:\x20YAML\x20file\x20paths\x20must\x20be\x20specified\x20with\x20--path\x20option')),console[_0x594cee(0x95)](_0x594cee(0x121)+_0x29aaf4),0x1;else _0x34ff1a=await this['getSQLFromServerSegment'](_0x29aaf4,_0x4c8e91);}return _0x1619f2[_0x594cee(0x9c)]===_0x594cee(0x99)||_0x1619f2[_0x594cee(0x9c)]==='jsonl'?await handleSDKOutput([{'sql':_0x34ff1a}],_0x1619f2):console['log'](_0x34ff1a),0x0;}catch(_0x42c366){if(_0x42c366 instanceof SDKError)return console[_0x594cee(0x95)](_0x594cee(0x109)+_0x42c366[_0x594cee(0xf7)]),_0x42c366[_0x594cee(0x110)]&&console[_0x594cee(0x95)](_0x594cee(0x127)+_0x42c366[_0x594cee(0x110)]),0x1;throw _0x42c366;}}async[a37_0x135c14(0xac)](_0x3bf8ed,_0x4d7fd0){const _0x2d8bb9=a37_0x135c14,{options:_0x3a5153,tdx:_0x33b3fc}=_0x4d7fd0;let _0x4d6862;try{_0x4d6862=await resolveYamlFilePath(_0x3bf8ed);}catch(_0x130331){throw new SDKError(ErrorCode[_0x2d8bb9(0xcc)],_0x2d8bb9(0xb4)+_0x130331['message']);}_0x3a5153[_0x2d8bb9(0xab)]&&console[_0x2d8bb9(0x95)]('Resolved:\x20'+_0x4d6862['parentSegment']+'/'+_0x4d6862[_0x2d8bb9(0x9a)]);const _0x4b1657=await withSpinner('Fetching\x20SQL\x20from\x20rule...',()=>_0x33b3fc[_0x2d8bb9(0xde)][_0x2d8bb9(0xc1)](_0x4d6862[_0x2d8bb9(0xec)],_0x4d6862[_0x2d8bb9(0x108)],_0x4d6862[_0x2d8bb9(0x9a)]),{'verbose':_0x3a5153['verbose']});return _0x4b1657[_0x2d8bb9(0x10c)];}async[a37_0x135c14(0xfd)](_0x40a957,_0x5428e0){const _0x3dfb15=a37_0x135c14,{options:_0x24146e,tdx:_0x1b1a55}=_0x5428e0,_0x531169=_0x24146e['parentSegment'],_0x1d944e=await resolveSegmentTarget(_0x40a957,_0x531169,_0x24146e[_0x3dfb15(0xab)]);_0x24146e['verbose']&&console[_0x3dfb15(0x95)](_0x3dfb15(0x10a)+_0x1d944e);const _0x26135b=await withSpinner(_0x3dfb15(0x124)+_0x40a957+_0x3dfb15(0xf4),()=>_0x1b1a55[_0x3dfb15(0xde)][_0x3dfb15(0xc2)](_0x1d944e),{'verbose':_0x24146e['verbose']}),_0x5f135f=_0x26135b['data'];_0x24146e['verbose']&&(console['error'](_0x3dfb15(0xc8)+_0x5f135f[_0x3dfb15(0xc5)]),console[_0x3dfb15(0x95)]('Parent\x20ID:\x20'+_0x5f135f[_0x3dfb15(0xb2)]));if(_0x5f135f[_0x3dfb15(0xc5)]===_0x3dfb15(0xbb))throw new SDKError(ErrorCode[_0x3dfb15(0xcc)],_0x3dfb15(0x9d));if(_0x5f135f[_0x3dfb15(0xc5)]==='parent')throw new SDKError(ErrorCode['INVALID_ARGUMENT'],'Cannot\x20get\x20SQL\x20for\x20parent\x20segment\x20with\x20this\x20command.\x20Use:\x20tdx\x20ps\x20sql');if(!_0x5f135f[_0x3dfb15(0xeb)])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x3d232e=await withSpinner('Fetching\x20SQL\x20for\x20segment...',()=>_0x1b1a55[_0x3dfb15(0xde)][_0x3dfb15(0x106)](_0x5f135f['parentId'],_0x5f135f[_0x3dfb15(0xeb)]),{'verbose':_0x24146e[_0x3dfb15(0xab)]});return _0x3d232e[_0x3dfb15(0x10c)];}}function a37_0x4cbb(){const _0x3373bd=['Error:\x20Cannot\x20execute\x20SQL\x20query\x20on\x20a\x20folder.','\x20\x20Cause:\x20','Parent\x20name:\x20','replace','jobId','Show\x20segment\x20or\x20folder\x20details','resolveParentId','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','Error:\x20Specify\x20either\x20segment\x20name\x20or\x20--path,\x20not\x20both','Parent\x20segment:\x20','\x20\x20tdx\x20sg\x20sql\x20\x22Premium\x20Users\x22','processedRows','Usage:\x20tdx\x20sg\x20view\x20<name>\x20[-w]','652392DbYtbh','Usage:','toLocaleString','error','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20view\x20<path/to/segment.yml>','Usage:\x20tdx\x20segment\x20folder\x20create\x20<parent_name>\x20<folder_name>\x20[options]','\x20\x20tdx\x20sg\x20view\x20\x22Marketing\x22\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20folder\x20details','json','segmentName','Folder\x20ID:\x20','format','Cannot\x20get\x20SQL\x20query\x20for\x20a\x20folder.\x20Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.','name','Error:\x20Folder\x20or\x20segment\x20name,\x20or\x20YAML\x20file\x20path\x20is\x20required','(root)','getSegment','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience/Marketing/High\x20Value\x22','\x20rows\x20','execute','Resolving\x20parent\x20segment\x20\x27','url','8HXtPum','Resolving\x20path\x20\x27','Error:\x20Parent\x20segment\x20name\x20is\x20required','Error:\x20Segment\x20name\x20or\x20--path\x20is\x20required','verbose','getSQLFromYamlFile','Parent\x20ID:\x20','Resolved\x20folder\x20ID:\x20','Creating\x20folder\x20\x27','Site:\x20','Listing\x20folders\x20for\x20parent\x20\x27','parentId','query','Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20','\x20\x20Folder\x20path:\x20','✔\x20Query\x20completed:\x20Processed\x20','\x20\x20Local\x20YAML\x20file:\x20\x20\x20\x20\x20\x20tdx\x20sg\x20sql\x20--path\x20<file-path>','14CDwLUx','SEGMENT_FOLDER_NOT_FOUND','segmentPath','folder','SQL\x20query:\x0a','segment:folder:list','\x27\x20with\x20ID:\x20','Error:\x20Path\x20or\x20name\x20is\x20required','Usage:\x20tdx\x20segment\x20folder\x20show\x20<parent_name/folder_name>','getSegmentSQLFromYaml','resolvePathToResource','test','8942589EPXXpw','type','Segment\x20ID\x20missing\x20from\x20resolved\x20path','Error:\x20Cannot\x20show\x20schema\x20for\x20a\x20folder.','Resolved\x20type:\x20','551802sbtYwm','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience\x22','Resolving\x20folder\x20\x27','INVALID_ARGUMENT','segment:sql','/app/ps/','Segment\x20ID:\x20','Usage:\x20tdx\x20sg\x20show\x20<name>','Execute\x20child\x20segment\x20SQL\x20query\x20and\x20show\x20results','\x20[Job\x20ID:\x20','segment:show','Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.','Show\x20segment\x20folder\x20details','\x20\x20tdx\x20segment\x20describe\x20\x22High\x20Value\x22\x20\x20\x20\x20#\x20Relative\x20to\x20current\x20context','createFolder','resolveFolderId','SEGMENT_NOT_FOUND','Use:\x20tdx\x20sg\x20view\x20<name>\x20\x20#\x20To\x20show\x20folder\x20details','8902zgPILN','red','fullPath','segment','code','in\x20','cyan','318330sCkmLT','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20-w\x20\x20#\x20Open\x20segment\x20in\x20web\x20browser','site','4467568hWTPcO','elapsedTimeMillis','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20desc\x20<path/to/segment.yml>','parentFolder','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','Error:\x20Folder\x20reference\x20is\x20required','segmentId','content','folderId','green','\x20\x20tdx\x20sg\x20show\x20\x22Premium\x20Users\x22','Examples:','\x20\x20tdx\x20sg\x20sql\x20--path\x20segments/my-audience/premium-users.yml','Error:\x20Cannot\x20open\x20parent\x20segment\x20with\x20this\x20command.','Fetching\x20SQL\x20for\x20segment...','\x27...','folderPath','Resolving\x20parent\x20folder\x20\x27','message','/e/','Get\x20SQL\x20query\x20for\x20child\x20segment','limit','Usage:\x20tdx\x20segment\x20folder\x20list\x20<parent_name>','segment:desc','getSQLFromServerSegment','\x20\x20tdx\x20sg\x20desc\x20\x22Premium\x20Users\x22','284ODEqWh','stats','getParent','Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required','Folder\x20ID\x20missing\x20from\x20resolved\x20path','parent','getFolder','getSegmentSQL','Error:\x20Cannot\x20execute\x20query\x20for\x20parent\x20segment\x20with\x20this\x20command.','parentSegment','Error:\x20','Target\x20path:\x20','No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22','data','\x20\x20Server-side\x20segment:\x20\x20tdx\x20sg\x20sql\x20<name>','Fetching\x20folder\x20details...','\x20\x20-w,\x20--web\x20\x20Open\x20segment\x20in\x20web\x20browser','cause','Fetching\x20parent\x20segment\x20details...','List\x20segment\x20folders\x20under\x20a\x20parent\x20segment','\x20folder','information_schema','Show\x20folder\x20or\x20child\x20segment\x20details','Use:\x20tdx\x20ps\x20show','path','Use:\x20tdx\x20ps\x20desc','length','segment:view','listFolders','Folder\x20name:\x20','Fetching\x20segment\x20details...','Error:\x20Cannot\x20open\x20folder\x20in\x20web\x20browser.\x20Use\x20a\x20segment\x20name\x20instead.','Error:\x20Parent\x20segment\x20name\x20and\x20folder\x20name\x20are\x20required','\x20\x20Full\x20path:\x20','\x20\x20tdx\x20sg\x20sql\x20--path\x20','description','Resolved\x20parent\x20ID:\x20','Resolving\x20\x27','\x20\x20Parent\x20segment:\x20'];a37_0x4cbb=function(){return _0x3373bd;};return a37_0x4cbb();}export class SegmentFolderCreateCommand extends BaseCommand{[a37_0x135c14(0x9e)]='segment:folder:create';[a37_0x135c14(0x122)]='Create\x20segment\x20folder\x20for\x20organization';async[a37_0x135c14(0xa4)](_0x15fc5c){const _0x1e146b=a37_0x135c14,{options:_0x1e87a6,args:_0x5ad6e2,tdx:_0x5e290b}=_0x15fc5c,_0x3cb669=_0x1e87a6;if(_0x5ad6e2[_0x1e146b(0x119)]<0x2)return console['error'](_0x1e146b(0x11f)),console['error'](_0x1e146b(0x97)),0x1;const _0x44cdb6=_0x5ad6e2[0x0],_0xd9dc6c=_0x5ad6e2[0x1];_0x3cb669[_0x1e146b(0xab)]&&(console[_0x1e146b(0x95)](_0x1e146b(0xb0)+_0x3cb669['site']),console[_0x1e146b(0x95)](_0x1e146b(0x12f)+_0x44cdb6),console[_0x1e146b(0x95)]('Folder\x20name:\x20'+_0xd9dc6c));let _0x4554ee;if(_0x3cb669[_0x1e146b(0xe8)]){const _0x42fbef=_0x3cb669[_0x1e146b(0xe8)],_0x4a6319=await withSpinner(_0x1e146b(0xa5)+_0x44cdb6+_0x1e146b(0xf4),()=>_0x5e290b[_0x1e146b(0xde)][_0x1e146b(0x12c)](_0x44cdb6),{'verbose':_0x3cb669['verbose']}),_0x1119b5=_0x4a6319[_0x1e146b(0x10c)],_0x142cfb=await withSpinner(_0x1e146b(0xf6)+_0x42fbef+_0x1e146b(0xf4),()=>_0x5e290b['segment'][_0x1e146b(0xd8)](_0x1119b5,_0x42fbef),{'verbose':_0x3cb669[_0x1e146b(0xab)]});_0x4554ee=_0x142cfb['data'],_0x3cb669['verbose']&&console[_0x1e146b(0x95)]('Resolved\x20parent\x20folder\x20ID:\x20'+_0x4554ee);}const _0xf1f2d0={'name':_0xd9dc6c,'description':_0x3cb669[_0x1e146b(0x122)],'parentFolderId':_0x4554ee},_0xbd8c86=await withSpinner(_0x1e146b(0xaf)+_0xd9dc6c+_0x1e146b(0xf4),()=>_0x5e290b[_0x1e146b(0xde)][_0x1e146b(0xd7)](_0x44cdb6,_0xf1f2d0),{'verbose':_0x3cb669[_0x1e146b(0xab)]}),_0x39ce70=_0xbd8c86[_0x1e146b(0x10c)];return console[_0x1e146b(0x95)]('✔\x20Created\x20folder\x20\x27'+_0x39ce70['name']+_0x1e146b(0xbe)+_0x39ce70['id']),await handleSDKOutput([_0x39ce70],_0x3cb669),0x0;}}export class SegmentViewCommand extends BaseCommand{['name']=a37_0x135c14(0x11a);[a37_0x135c14(0x122)]=a37_0x135c14(0x115);async[a37_0x135c14(0xa4)](_0x1b6047){const _0x34091e=a37_0x135c14,{options:_0x2f4724,args:_0x32d6a3,tdx:_0x2a9a78}=_0x1b6047,_0x2f50d2=_0x32d6a3[0x0];if(!_0x2f50d2)return console['error'](_0x34091e(0x9f)),console[_0x34091e(0x95)](_0x34091e(0x132)),console[_0x34091e(0x95)](_0x34091e(0x96)),console[_0x34091e(0x95)]('Options:'),console[_0x34091e(0x95)](_0x34091e(0x10f)),console[_0x34091e(0x95)](_0x34091e(0xf0)),console[_0x34091e(0x95)](_0x34091e(0x98)),console[_0x34091e(0x95)]('\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20\x20\x20\x20\x20#\x20View\x20child\x20segment\x20details'),console[_0x34091e(0x95)](_0x34091e(0xe3)),console[_0x34091e(0x95)]('\x20\x20tdx\x20sg\x20view\x20segments/my-audience/premium-users.yml'),0x1;try{const _0x2dd449=_0x2f4724[_0x34091e(0x108)],_0x4d2a0a=await resolveSegmentTarget(_0x2f50d2,_0x2dd449,_0x2f4724[_0x34091e(0xab)]);_0x2f4724[_0x34091e(0xab)]&&console['error'](_0x34091e(0x10a)+_0x4d2a0a);const _0x367076=await withSpinner(_0x34091e(0x124)+_0x2f50d2+_0x34091e(0xf4),()=>_0x2a9a78['segment'][_0x34091e(0xc2)](_0x4d2a0a),{'verbose':_0x2f4724[_0x34091e(0xab)]}),_0x1f341b=_0x367076[_0x34091e(0x10c)];_0x2f4724[_0x34091e(0xab)]&&(console[_0x34091e(0x95)](_0x34091e(0xc8)+_0x1f341b[_0x34091e(0xc5)]),console['error'](_0x34091e(0xad)+_0x1f341b['parentId']),_0x1f341b[_0x34091e(0xed)]&&console['error'](_0x34091e(0x9b)+_0x1f341b[_0x34091e(0xed)]),_0x1f341b[_0x34091e(0xeb)]&&console[_0x34091e(0x95)](_0x34091e(0xcf)+_0x1f341b[_0x34091e(0xeb)]));if(_0x2f4724['web']){if(_0x1f341b[_0x34091e(0xc5)]===_0x34091e(0xbb))return console[_0x34091e(0x95)](_0x34091e(0x11e)),0x1;if(_0x1f341b[_0x34091e(0xc5)]===_0x34091e(0x104))return console[_0x34091e(0x95)](_0x34091e(0xf2)),console['error']('Use:\x20tdx\x20ps\x20view\x20-w'),0x1;if(!_0x1f341b[_0x34091e(0xeb)])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x1ed6cb=getConsoleNextUrl(_0x2f4724[_0x34091e(0xe4)],_0x34091e(0xce)+_0x1f341b[_0x34091e(0xb2)]+_0x34091e(0xf8)+_0x1f341b[_0x34091e(0xeb)]);return console['error'](a37_0x451b3d[_0x34091e(0xee)]('✔')+'\x20Opening\x20'+a37_0x451b3d[_0x34091e(0xe1)](_0x1ed6cb)),openBrowser(_0x1ed6cb),0x0;}if(_0x1f341b[_0x34091e(0xc5)]===_0x34091e(0xbb)){if(!_0x1f341b[_0x34091e(0xed)])throw new SDKError(ErrorCode[_0x34091e(0xb9)],_0x34091e(0x103));const _0x2c25a6=await withSpinner('Fetching\x20folder\x20details...',()=>_0x2a9a78[_0x34091e(0xde)][_0x34091e(0x105)](_0x1f341b[_0x34091e(0xed)]),{'verbose':_0x2f4724[_0x34091e(0xab)]});await handleSingleObjectOutput(_0x2c25a6[_0x34091e(0x10c)],_0x2f4724);}else{if(_0x1f341b['type']===_0x34091e(0xde)){if(!_0x1f341b['segmentId'])throw new SDKError(ErrorCode[_0x34091e(0xd9)],_0x34091e(0xc6));const _0x20f614=await withSpinner(_0x34091e(0x11d),()=>_0x2a9a78[_0x34091e(0xde)]['getSegment'](_0x1f341b['parentId'],_0x1f341b[_0x34091e(0xeb)]),{'verbose':_0x2f4724['verbose']}),_0x10a6ba=getConsoleNextUrl(_0x2f4724[_0x34091e(0xe4)],_0x34091e(0xce)+_0x1f341b[_0x34091e(0xb2)]+_0x34091e(0xf8)+_0x1f341b[_0x34091e(0xeb)]),_0x1517d0=_0x20f614[_0x34091e(0x10c)];_0x1517d0[_0x34091e(0xa6)]=_0x10a6ba,await handleSingleObjectOutput(_0x1517d0,_0x2f4724);}else return console[_0x34091e(0x95)]('Error:\x20Cannot\x20view\x20parent\x20segment\x20details\x20with\x20this\x20command.'),console[_0x34091e(0x95)]('Use:\x20tdx\x20ps\x20view'),0x1;}return 0x0;}catch(_0x3da509){if(_0x3da509 instanceof SDKError)return console['error'](_0x34091e(0x109)+_0x3da509['message']),_0x3da509[_0x34091e(0x110)]&&console[_0x34091e(0x95)](_0x34091e(0x127)+_0x3da509[_0x34091e(0x110)]),0x1;throw _0x3da509;}}}export const SegmentInfoCommand=SegmentViewCommand;export class SegmentDescCommand extends BaseCommand{[a37_0x135c14(0x9e)]=a37_0x135c14(0xfc);['description']='Show\x20child\x20segment\x20schema\x20(column\x20types)';async[a37_0x135c14(0xa4)](_0x430754){const _0x59a29b=a37_0x135c14,{options:_0x4d2ecf,args:_0x2cdaa0,tdx:_0x4f48e2}=_0x430754,_0x23850c=_0x2cdaa0[0x0];if(!_0x23850c)return console[_0x59a29b(0x95)](_0x59a29b(0x102)),console[_0x59a29b(0x95)]('Usage:\x20tdx\x20sg\x20desc\x20<name>'),console[_0x59a29b(0x95)](_0x59a29b(0xe7)),console['error']('Examples:'),console[_0x59a29b(0x95)](_0x59a29b(0xfe)),console[_0x59a29b(0x95)]('\x20\x20tdx\x20sg\x20desc\x20segments/my-audience/premium-users.yml'),0x1;try{const _0x1ec146=_0x4d2ecf['parentSegment'],_0x10019c=await resolveSegmentTarget(_0x23850c,_0x1ec146,_0x4d2ecf[_0x59a29b(0xab)]);_0x4d2ecf['verbose']&&console[_0x59a29b(0x95)](_0x59a29b(0x10a)+_0x10019c);const _0x21f150=await withSpinner('Resolving\x20\x27'+_0x23850c+'\x27...',()=>_0x4f48e2[_0x59a29b(0xde)][_0x59a29b(0xc2)](_0x10019c),{'verbose':_0x4d2ecf[_0x59a29b(0xab)]}),_0x595335=_0x21f150['data'];_0x4d2ecf[_0x59a29b(0xab)]&&(console['error'](_0x59a29b(0xc8)+_0x595335[_0x59a29b(0xc5)]),console['error']('Parent\x20ID:\x20'+_0x595335['parentId']));if(_0x595335[_0x59a29b(0xc5)]==='folder')return console[_0x59a29b(0x95)](_0x59a29b(0xc7)),console[_0x59a29b(0x95)](_0x59a29b(0xd4)),0x1;if(_0x595335[_0x59a29b(0xc5)]==='parent')return console[_0x59a29b(0x95)]('Error:\x20Cannot\x20show\x20schema\x20for\x20parent\x20segment\x20with\x20this\x20command.'),console[_0x59a29b(0x95)](_0x59a29b(0x118)),0x1;if(!_0x595335[_0x59a29b(0xeb)])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x59a29b(0xc6));const _0xaeba9d=await withSpinner(_0x59a29b(0xf3),()=>_0x4f48e2[_0x59a29b(0xde)][_0x59a29b(0x106)](_0x595335[_0x59a29b(0xb2)],_0x595335[_0x59a29b(0xeb)]),{'verbose':_0x4d2ecf[_0x59a29b(0xab)]}),_0x3b014d=_0xaeba9d[_0x59a29b(0x10c)],_0x5d1a79=await executeSchemaQuery(_0x3b014d,_0x4f48e2,_0x4d2ecf);return await handleQueryOutput(_0x5d1a79,_0x4d2ecf),0x0;}catch(_0x5f2929){if(_0x5f2929 instanceof SDKError)return console[_0x59a29b(0x95)](_0x59a29b(0x109)+_0x5f2929[_0x59a29b(0xf7)]),_0x5f2929[_0x59a29b(0x110)]&&console['error'](_0x59a29b(0x127)+_0x5f2929[_0x59a29b(0x110)]),0x1;throw _0x5f2929;}}}
@@ -1 +1 @@
1
- const a38_0x68a3f4=a38_0x419e;(function(_0x24566f,_0xdf87eb){const _0x43c2c5=a38_0x419e,_0xd03cc0=_0x24566f();while(!![]){try{const _0x28d8c1=-parseInt(_0x43c2c5(0x106))/0x1+-parseInt(_0x43c2c5(0xfb))/0x2*(parseInt(_0x43c2c5(0xfe))/0x3)+-parseInt(_0x43c2c5(0x119))/0x4+parseInt(_0x43c2c5(0x110))/0x5+parseInt(_0x43c2c5(0x123))/0x6+-parseInt(_0x43c2c5(0x10a))/0x7*(-parseInt(_0x43c2c5(0x115))/0x8)+parseInt(_0x43c2c5(0x121))/0x9;if(_0x28d8c1===_0xdf87eb)break;else _0xd03cc0['push'](_0xd03cc0['shift']());}catch(_0x1abdf8){_0xd03cc0['push'](_0xd03cc0['shift']());}}}(a38_0x49a9,0x8b553));import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import{loadJSONFromOptions}from'../utils/json-loader.js';function a38_0x419e(_0x4a6a63,_0x3aa1e0){_0x4a6a63=_0x4a6a63-0xfb;const _0x49a9e0=a38_0x49a9();let _0x419ea1=_0x49a9e0[_0x4a6a63];return _0x419ea1;}function a38_0x49a9(){const _0x36308c=['3571390eDjFmV','length','type','data','yellow','2808xTlMWa','Target\x20path:\x20','Parent\x20path:\x20','Site:\x20','3718208azIIRB','Error:\x20Segment\x20path\x20or\x20name\x20is\x20required','\x20\x20Use\x20`tdx\x20sg\x20push`\x20with\x20YAML\x20files\x20instead.\x0a','Error:\x20Cannot\x20create\x20segment\x20in\x20a\x20segment.\x20Parent\x20path\x20must\x20be\x20a\x20folder\x20or\x20parent.','segment','Usage:\x20tdx\x20segment\x20create\x20<parent/segment_name>\x20[options]','ruleFile','error','14584302CodGAL','invisible','3395070WQtHhF','execute','parent','segmentPath','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/Marketing/Premium\x22\x20--rule\x20\x27...\x27','site','description','34EVKYbO','\x27...','Creating\x20segment\x20\x27','74859IKJBti','Examples:','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/High\x20Value\x22\x20--rule\x20\x27...\x27','Create\x20child\x20segment\x20with\x20filtering\x20rules','Parent:\x20','verbose','name','kind','1003870ipkRyh','folder','resolveFolderId','includes','553LdbLJR','Usage:\x20tdx\x20segment\x20create\x20<path>\x20[options]','segments','Error:\x20Full\x20path\x20required\x20(parent/segment_name\x20or\x20parent/folder/segment_name)','Resolving\x20folder\x20path\x20\x27','folderId'];a38_0x49a9=function(){return _0x36308c;};return a38_0x49a9();}import{parsePath,getParentPath,getBaseName}from'../sdk/segment/segment-path-parser.js';import a38_0x252d7b from'chalk';export class SegmentCreateCommand extends BaseCommand{[a38_0x68a3f4(0x104)]='segment:create';[a38_0x68a3f4(0x129)]=a38_0x68a3f4(0x101);async[a38_0x68a3f4(0x124)](_0x20fe00){const _0x494446=a38_0x68a3f4;console[_0x494446(0x120)](a38_0x252d7b[_0x494446(0x114)]('⚠\x20Deprecation\x20warning:\x20`segment\x20create`\x20is\x20deprecated.')),console[_0x494446(0x120)](a38_0x252d7b[_0x494446(0x114)](_0x494446(0x11b)));const {options:_0x575a63,args:_0x4e782d,tdx:_0x476732}=_0x20fe00,_0x53c736=_0x575a63;if(_0x4e782d[_0x494446(0x111)]===0x0)return console[_0x494446(0x120)](_0x494446(0x11a)),console[_0x494446(0x120)](_0x494446(0x10b)),console[_0x494446(0x120)](_0x494446(0xff)),console[_0x494446(0x120)](_0x494446(0x100)),console[_0x494446(0x120)](_0x494446(0x127)),console[_0x494446(0x120)]('\x20\x20tdx\x20segment\x20create\x20\x22Premium\x22\x20--rule\x20\x27...\x27\x20\x20#\x20Relative\x20to\x20context'),0x1;const _0x32cde6=_0x4e782d[0x0],_0x403653=_0x575a63[_0x494446(0x126)];let _0x11ad5c=_0x32cde6;_0x403653&&!_0x32cde6[_0x494446(0x109)]('/')&&(_0x11ad5c=_0x403653+'/'+_0x32cde6,_0x53c736[_0x494446(0x103)]&&console['error']('Resolved\x20relative\x20path\x20to:\x20'+_0x11ad5c));const _0x2e204d=parsePath(_0x11ad5c);if(_0x2e204d[_0x494446(0x10c)][_0x494446(0x111)]<0x2)return console[_0x494446(0x120)](_0x494446(0x10d)),console[_0x494446(0x120)](_0x494446(0x11e)),0x1;const _0x5ba859=_0x2e204d[_0x494446(0x10c)][0x0],_0xfea0e4=getBaseName(_0x11ad5c),_0x5db791=getParentPath(_0x11ad5c);_0x53c736[_0x494446(0x103)]&&(console[_0x494446(0x120)](_0x494446(0x118)+_0x53c736[_0x494446(0x128)]),console[_0x494446(0x120)](_0x494446(0x116)+_0x11ad5c),console[_0x494446(0x120)](_0x494446(0x102)+_0x5ba859),console[_0x494446(0x120)]('Segment\x20name:\x20'+_0xfea0e4),console[_0x494446(0x120)](_0x494446(0x117)+_0x5db791));const _0x3669c5=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x5ba859+_0x494446(0xfc),()=>_0x476732[_0x494446(0x11d)]['resolveParentId'](_0x5ba859),{'verbose':_0x53c736[_0x494446(0x103)]}),_0x4d0d28=_0x3669c5[_0x494446(0x113)];let _0x8c704b;if(_0x2e204d[_0x494446(0x10c)][_0x494446(0x111)]>0x2){const _0x527c02=await withSpinner(_0x494446(0x10e)+_0x5db791+_0x494446(0xfc),()=>_0x476732[_0x494446(0x11d)]['resolvePathToResource'](_0x5db791),{'verbose':_0x53c736[_0x494446(0x103)]}),_0x233613=_0x527c02[_0x494446(0x113)];if(_0x233613['type']!==_0x494446(0x107)&&_0x233613[_0x494446(0x112)]!==_0x494446(0x125))return console[_0x494446(0x120)](_0x494446(0x11c)),0x1;_0x8c704b=_0x233613[_0x494446(0x10f)];}else{if(_0x53c736[_0x494446(0x107)]){const _0x13b3a9=await withSpinner('Resolving\x20folder\x20\x27'+_0x53c736['folder']+_0x494446(0xfc),()=>_0x476732[_0x494446(0x11d)][_0x494446(0x108)](_0x4d0d28,_0x53c736[_0x494446(0x107)]),{'verbose':_0x53c736[_0x494446(0x103)]});_0x8c704b=_0x13b3a9[_0x494446(0x113)];}}_0x53c736[_0x494446(0x103)]&&_0x8c704b&&console[_0x494446(0x120)]('Resolved\x20folder\x20ID:\x20'+_0x8c704b);const _0x2a500e=await loadJSONFromOptions(_0x53c736['rule'],_0x53c736[_0x494446(0x11f)]),_0x558cc4={'name':_0xfea0e4,'description':_0x53c736[_0x494446(0x129)],'rule':_0x2a500e,'kind':_0x53c736[_0x494446(0x105)]!==undefined?parseInt(_0x53c736[_0x494446(0x105)],0xa):undefined,'isVisible':_0x53c736[_0x494446(0x122)]?![]:undefined,'segmentFolderId':_0x8c704b,'countPopulation':_0x53c736['noCountPopulation']?![]:undefined},_0x54bba5=await withSpinner(_0x494446(0xfd)+_0xfea0e4+_0x494446(0xfc),()=>_0x476732[_0x494446(0x11d)]['createSegment'](_0x4d0d28,_0x558cc4),{'verbose':_0x53c736['verbose']}),_0x4a17ce=_0x54bba5[_0x494446(0x113)];return console[_0x494446(0x120)]('✔\x20Created\x20segment\x20\x27'+_0x4a17ce[_0x494446(0x104)]+'\x27\x20with\x20ID:\x20'+_0x4a17ce['id']),_0x11ad5c!==_0x32cde6&&console[_0x494446(0x120)]('\x20\x20\x20Path:\x20'+_0x11ad5c),await handleSDKOutput([_0x4a17ce],_0x53c736),0x0;}}
1
+ const a38_0x566440=a38_0x2054;(function(_0x598936,_0x5664d2){const _0x4a3d3b=a38_0x2054,_0x216a9c=_0x598936();while(!![]){try{const _0x5e9422=-parseInt(_0x4a3d3b(0x13f))/0x1+-parseInt(_0x4a3d3b(0x116))/0x2*(-parseInt(_0x4a3d3b(0x12c))/0x3)+parseInt(_0x4a3d3b(0x137))/0x4+parseInt(_0x4a3d3b(0x13c))/0x5+parseInt(_0x4a3d3b(0x11c))/0x6+parseInt(_0x4a3d3b(0x127))/0x7+-parseInt(_0x4a3d3b(0x13d))/0x8*(parseInt(_0x4a3d3b(0x134))/0x9);if(_0x5e9422===_0x5664d2)break;else _0x216a9c['push'](_0x216a9c['shift']());}catch(_0x86e377){_0x216a9c['push'](_0x216a9c['shift']());}}}(a38_0x5c11,0x365ce));function a38_0x2054(_0x2a6c0e,_0x4002b3){_0x2a6c0e=_0x2a6c0e-0x10f;const _0x5c11fa=a38_0x5c11();let _0x2054ec=_0x5c11fa[_0x2a6c0e];return _0x2054ec;}function a38_0x5c11(){const _0x572aa5=['68397AVMESN','\x27...','invisible','segment','Examples:','Create\x20child\x20segment\x20with\x20filtering\x20rules','type','resolvePathToResource','68067NDuCfu','Error:\x20Full\x20path\x20required\x20(parent/segment_name\x20or\x20parent/folder/segment_name)','verbose','98028CWDJeD','yellow','data','noCountPopulation','parent','1751550enfeOe','424NvQrdS','✔\x20Created\x20segment\x20\x27','260059LQJeID','error','length','Resolving\x20folder\x20path\x20\x27','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/High\x20Value\x22\x20--rule\x20\x27...\x27','Usage:\x20tdx\x20segment\x20create\x20<parent/segment_name>\x20[options]','description','kind','16HoMxfB','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/Marketing/Premium\x22\x20--rule\x20\x27...\x27','segments','\x20\x20\x20Path:\x20','Resolving\x20folder\x20\x27','resolveFolderId','1946268ptPkvg','Error:\x20Cannot\x20create\x20segment\x20in\x20a\x20segment.\x20Parent\x20path\x20must\x20be\x20a\x20folder\x20or\x20parent.','createSegment','resolveParentId','Target\x20path:\x20','Error:\x20Segment\x20path\x20or\x20name\x20is\x20required','segmentPath','Usage:\x20tdx\x20segment\x20create\x20<path>\x20[options]','Parent:\x20','folderId','folder','13867ucwvdj','⚠\x20Deprecation\x20warning:\x20`segment\x20create`\x20is\x20deprecated.','name','includes','Resolved\x20folder\x20ID:\x20'];a38_0x5c11=function(){return _0x572aa5;};return a38_0x5c11();}import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import{loadJSONFromOptions}from'../utils/json-loader.js';import{parsePath,getParentPath,getBaseName}from'../sdk/segment/segment-path-parser.js';import a38_0x203bf5 from'chalk';export class SegmentCreateCommand extends BaseCommand{['name']='segment:create';[a38_0x566440(0x114)]=a38_0x566440(0x131);async['execute'](_0x31fcf2){const _0x5f2d63=a38_0x566440;console['error'](a38_0x203bf5[_0x5f2d63(0x138)](_0x5f2d63(0x128))),console[_0x5f2d63(0x10f)](a38_0x203bf5[_0x5f2d63(0x138)]('\x20\x20Use\x20`tdx\x20sg\x20push`\x20with\x20YAML\x20files\x20instead.\x0a'));const {options:_0x272d27,args:_0x46968c,tdx:_0x4a5fec}=_0x31fcf2,_0x19c2c3=_0x272d27;if(_0x46968c[_0x5f2d63(0x110)]===0x0)return console[_0x5f2d63(0x10f)](_0x5f2d63(0x121)),console[_0x5f2d63(0x10f)](_0x5f2d63(0x123)),console['error'](_0x5f2d63(0x130)),console[_0x5f2d63(0x10f)](_0x5f2d63(0x112)),console[_0x5f2d63(0x10f)](_0x5f2d63(0x117)),console[_0x5f2d63(0x10f)]('\x20\x20tdx\x20segment\x20create\x20\x22Premium\x22\x20--rule\x20\x27...\x27\x20\x20#\x20Relative\x20to\x20context'),0x1;const _0x1d7616=_0x46968c[0x0],_0x7be425=_0x272d27[_0x5f2d63(0x122)];let _0x4fbbd3=_0x1d7616;_0x7be425&&!_0x1d7616[_0x5f2d63(0x12a)]('/')&&(_0x4fbbd3=_0x7be425+'/'+_0x1d7616,_0x19c2c3[_0x5f2d63(0x136)]&&console[_0x5f2d63(0x10f)]('Resolved\x20relative\x20path\x20to:\x20'+_0x4fbbd3));const _0x2c72cf=parsePath(_0x4fbbd3);if(_0x2c72cf[_0x5f2d63(0x118)]['length']<0x2)return console[_0x5f2d63(0x10f)](_0x5f2d63(0x135)),console['error'](_0x5f2d63(0x113)),0x1;const _0x1d384a=_0x2c72cf[_0x5f2d63(0x118)][0x0],_0x1b46cc=getBaseName(_0x4fbbd3),_0x18cbf5=getParentPath(_0x4fbbd3);_0x19c2c3['verbose']&&(console[_0x5f2d63(0x10f)]('Site:\x20'+_0x19c2c3['site']),console[_0x5f2d63(0x10f)](_0x5f2d63(0x120)+_0x4fbbd3),console[_0x5f2d63(0x10f)](_0x5f2d63(0x124)+_0x1d384a),console['error']('Segment\x20name:\x20'+_0x1b46cc),console[_0x5f2d63(0x10f)]('Parent\x20path:\x20'+_0x18cbf5));const _0x228bab=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x1d384a+_0x5f2d63(0x12d),()=>_0x4a5fec['segment'][_0x5f2d63(0x11f)](_0x1d384a),{'verbose':_0x19c2c3[_0x5f2d63(0x136)]}),_0x1b36c1=_0x228bab[_0x5f2d63(0x139)];let _0x509c9e;if(_0x2c72cf['segments'][_0x5f2d63(0x110)]>0x2){const _0xd3e0ba=await withSpinner(_0x5f2d63(0x111)+_0x18cbf5+_0x5f2d63(0x12d),()=>_0x4a5fec[_0x5f2d63(0x12f)][_0x5f2d63(0x133)](_0x18cbf5),{'verbose':_0x19c2c3[_0x5f2d63(0x136)]}),_0x43a24f=_0xd3e0ba['data'];if(_0x43a24f[_0x5f2d63(0x132)]!==_0x5f2d63(0x126)&&_0x43a24f[_0x5f2d63(0x132)]!==_0x5f2d63(0x13b))return console[_0x5f2d63(0x10f)](_0x5f2d63(0x11d)),0x1;_0x509c9e=_0x43a24f[_0x5f2d63(0x125)];}else{if(_0x19c2c3[_0x5f2d63(0x126)]){const _0x1c4171=await withSpinner(_0x5f2d63(0x11a)+_0x19c2c3[_0x5f2d63(0x126)]+_0x5f2d63(0x12d),()=>_0x4a5fec[_0x5f2d63(0x12f)][_0x5f2d63(0x11b)](_0x1b36c1,_0x19c2c3['folder']),{'verbose':_0x19c2c3[_0x5f2d63(0x136)]});_0x509c9e=_0x1c4171[_0x5f2d63(0x139)];}}_0x19c2c3['verbose']&&_0x509c9e&&console[_0x5f2d63(0x10f)](_0x5f2d63(0x12b)+_0x509c9e);const _0x49ddaa=await loadJSONFromOptions(_0x19c2c3['rule'],_0x19c2c3['ruleFile']),_0x27237b={'name':_0x1b46cc,'description':_0x19c2c3['description'],'rule':_0x49ddaa,'kind':_0x19c2c3['kind']!==undefined?parseInt(_0x19c2c3[_0x5f2d63(0x115)],0xa):undefined,'isVisible':_0x19c2c3[_0x5f2d63(0x12e)]?![]:undefined,'segmentFolderId':_0x509c9e,'countPopulation':_0x19c2c3[_0x5f2d63(0x13a)]?![]:undefined},_0x4b975f=await withSpinner('Creating\x20segment\x20\x27'+_0x1b46cc+_0x5f2d63(0x12d),()=>_0x4a5fec['segment'][_0x5f2d63(0x11e)](_0x1b36c1,_0x27237b),{'verbose':_0x19c2c3['verbose']}),_0x40903f=_0x4b975f[_0x5f2d63(0x139)];return console[_0x5f2d63(0x10f)](_0x5f2d63(0x13e)+_0x40903f[_0x5f2d63(0x129)]+'\x27\x20with\x20ID:\x20'+_0x40903f['id']),_0x4fbbd3!==_0x1d7616&&console[_0x5f2d63(0x10f)](_0x5f2d63(0x119)+_0x4fbbd3),await handleSDKOutput([_0x40903f],_0x19c2c3),0x0;}}
@@ -1 +1 @@
1
- function a39_0x5ace(_0x298616,_0x1ae1e4){_0x298616=_0x298616-0x1c0;const _0x191faa=a39_0x191f();let _0x5ace77=_0x191faa[_0x298616];return _0x5ace77;}const a39_0x3b6a14=a39_0x5ace;(function(_0x548426,_0x183882){const _0x3b9b13=a39_0x5ace,_0x3da5c0=_0x548426();while(!![]){try{const _0x215bb0=parseInt(_0x3b9b13(0x1d9))/0x1+-parseInt(_0x3b9b13(0x1d6))/0x2+parseInt(_0x3b9b13(0x1ca))/0x3+-parseInt(_0x3b9b13(0x1c3))/0x4+parseInt(_0x3b9b13(0x1c7))/0x5+parseInt(_0x3b9b13(0x1d8))/0x6+-parseInt(_0x3b9b13(0x1db))/0x7;if(_0x215bb0===_0x183882)break;else _0x3da5c0['push'](_0x3da5c0['shift']());}catch(_0x28ced7){_0x3da5c0['push'](_0x3da5c0['shift']());}}}(a39_0x191f,0x6cfba));import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import{displayFieldsHumanReadable}from'../sdk/segment/fields-display.js';function a39_0x191f(){const _0x3283cb=['Site:\x20','Parent\x20segment:\x20','name','listFields','segment','223274AAmeol','length','1548696gSofvo','230225xylJPv','List\x20available\x20fields\x20for\x20segmentation','4007003REFbhn','data','\x27...','Error:\x20Parent\x20segment\x20name\x20is\x20required','1590096awijUl','Usage:\x20tdx\x20segment\x20fields\x20<parent_name>','error','verbose','1628985ymlBpz','description','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','2141538viIQEI','Listing\x20fields\x20for\x20\x27','segment:fields','✔\x20Found\x20','\x20field','parentSegment','json'];a39_0x191f=function(){return _0x3283cb;};return a39_0x191f();}export class SegmentFieldsCommand extends BaseCommand{[a39_0x3b6a14(0x1d3)]=a39_0x3b6a14(0x1cc);[a39_0x3b6a14(0x1c8)]=a39_0x3b6a14(0x1da);async['execute'](_0x1d4fe2){const _0x43c004=a39_0x3b6a14,{options:_0x4f44b4,args:_0x3da323,tdx:_0x2a6b65}=_0x1d4fe2,_0x3e56cf=_0x3da323[0x0]||_0x4f44b4[_0x43c004(0x1cf)];if(!_0x3e56cf)return console[_0x43c004(0x1c5)](_0x43c004(0x1c2)),console[_0x43c004(0x1c5)](_0x43c004(0x1c4)),console[_0x43c004(0x1c5)](_0x43c004(0x1c9)),0x1;_0x4f44b4[_0x43c004(0x1c6)]&&(console[_0x43c004(0x1c5)](_0x43c004(0x1d1)+_0x4f44b4['site']),console[_0x43c004(0x1c5)](_0x43c004(0x1d2)+_0x3e56cf));const _0x318ec8=await withSpinner(_0x43c004(0x1cb)+_0x3e56cf+_0x43c004(0x1c1),()=>_0x2a6b65[_0x43c004(0x1d5)][_0x43c004(0x1d4)](_0x3e56cf),{'verbose':_0x4f44b4[_0x43c004(0x1c6)]}),_0x4d8aaf=_0x318ec8[_0x43c004(0x1c0)];console[_0x43c004(0x1c5)](_0x43c004(0x1cd)+_0x4d8aaf[_0x43c004(0x1d7)]+_0x43c004(0x1ce)+(_0x4d8aaf[_0x43c004(0x1d7)]!==0x1?'s':''));if(_0x4f44b4[_0x43c004(0x1d0)]||_0x4f44b4['jsonl'])return await handleSDKOutput(_0x4d8aaf,_0x4f44b4),0x0;return displayFieldsHumanReadable(_0x4d8aaf,_0x3e56cf),0x0;}}
1
+ const a39_0x11b3a3=a39_0x1d63;(function(_0x1a1e44,_0xa78db3){const _0x5f3ba4=a39_0x1d63,_0x539b60=_0x1a1e44();while(!![]){try{const _0x5cd202=-parseInt(_0x5f3ba4(0x18f))/0x1+-parseInt(_0x5f3ba4(0x19b))/0x2+-parseInt(_0x5f3ba4(0x193))/0x3*(-parseInt(_0x5f3ba4(0x1a0))/0x4)+parseInt(_0x5f3ba4(0x192))/0x5+parseInt(_0x5f3ba4(0x19d))/0x6+-parseInt(_0x5f3ba4(0x191))/0x7+parseInt(_0x5f3ba4(0x19a))/0x8;if(_0x5cd202===_0xa78db3)break;else _0x539b60['push'](_0x539b60['shift']());}catch(_0x569680){_0x539b60['push'](_0x539b60['shift']());}}}(a39_0x2d9d,0xb6269));import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../core/command-output.js';function a39_0x1d63(_0x2e6a1d,_0x34e9d7){_0x2e6a1d=_0x2e6a1d-0x188;const _0x2d9daa=a39_0x2d9d();let _0x1d6385=_0x2d9daa[_0x2e6a1d];return _0x1d6385;}import{withSpinner}from'../utils/spinner.js';import{displayFieldsHumanReadable}from'../sdk/segment/fields-display.js';function a39_0x2d9d(){const _0x15761=['List\x20available\x20fields\x20for\x20segmentation','Site:\x20','execute','error','730941jvIehK','jsonl','5536377rhPHHu','1230345VZbXmy','192vXoFuj','\x27...','parentSegment','verbose','length','Usage:\x20tdx\x20segment\x20fields\x20<parent_name>','segment:fields','20499696rZlVMe','1970406JvOXVd','json','1209630fqyTdX','Error:\x20Parent\x20segment\x20name\x20is\x20required','\x20field','15188vXFBuI','name','data','listFields','description'];a39_0x2d9d=function(){return _0x15761;};return a39_0x2d9d();}export class SegmentFieldsCommand extends BaseCommand{[a39_0x11b3a3(0x1a1)]=a39_0x11b3a3(0x199);[a39_0x11b3a3(0x18a)]=a39_0x11b3a3(0x18b);async[a39_0x11b3a3(0x18d)](_0x550a46){const _0x4c4f6b=a39_0x11b3a3,{options:_0x2bffb7,args:_0x4a1679,tdx:_0x2c691d}=_0x550a46,_0x1296a3=_0x4a1679[0x0]||_0x2bffb7[_0x4c4f6b(0x195)];if(!_0x1296a3)return console[_0x4c4f6b(0x18e)](_0x4c4f6b(0x19e)),console['error'](_0x4c4f6b(0x198)),console[_0x4c4f6b(0x18e)]('\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>'),0x1;_0x2bffb7[_0x4c4f6b(0x196)]&&(console[_0x4c4f6b(0x18e)](_0x4c4f6b(0x18c)+_0x2bffb7['site']),console[_0x4c4f6b(0x18e)]('Parent\x20segment:\x20'+_0x1296a3));const _0x56a999=await withSpinner('Listing\x20fields\x20for\x20\x27'+_0x1296a3+_0x4c4f6b(0x194),()=>_0x2c691d['segment'][_0x4c4f6b(0x189)](_0x1296a3),{'verbose':_0x2bffb7[_0x4c4f6b(0x196)]}),_0x2ffc9e=_0x56a999[_0x4c4f6b(0x188)];console[_0x4c4f6b(0x18e)]('✔\x20Found\x20'+_0x2ffc9e[_0x4c4f6b(0x197)]+_0x4c4f6b(0x19f)+(_0x2ffc9e[_0x4c4f6b(0x197)]!==0x1?'s':''));if(_0x2bffb7[_0x4c4f6b(0x19c)]||_0x2bffb7[_0x4c4f6b(0x190)])return await handleSDKOutput(_0x2ffc9e,_0x2bffb7),0x0;return displayFieldsHumanReadable(_0x2ffc9e,_0x1296a3),0x0;}}